From: Andrea Amorese Date: Wed, 11 Aug 2021 15:23:10 +0000 (+0200) Subject: Built motion from commit 38931571.|2.5.33 X-Git-Url: http://repos.xcallymotion.com/base/%22angular-material.themes.css/%22card-image.png//%27?a=commitdiff_plain;h=3edf73ee56370b736f51de38d41e0845c3e674bc;p=motion2.git Built motion from commit 38931571.|2.5.33 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 063ce69..b2072e3 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-08-11T15:06:10.705Z", + "time": "2021-08-11T15:14:45.953Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index e13e8c4..186b285 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2021-08-11T15:06:10.705Z", + "time": "2021-08-11T15:14:45.953Z", "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 130724c..95f465f 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 _0x76e1=['urlForward','browser','bot','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','motionbar[NULL,NULL,WinAppArguments]','exports','VIRTUAL','getDataValue','action','STRING','contactManager','integration','jscripty'];(function(_0x2940fa,_0x255ebe){var _0x410701=function(_0x47e9af){while(--_0x47e9af){_0x2940fa['push'](_0x2940fa['shift']());}};_0x410701(++_0x255ebe);}(_0x76e1,0x171));var _0x176e=function(_0x6cfa7f,_0x99a34){_0x6cfa7f=_0x6cfa7f-0x0;var _0x5863f4=_0x76e1[_0x6cfa7f];return _0x5863f4;};'use strict';var Sequelize=require('sequelize');module[_0x176e('0x0')]={'name':{'type':Sequelize[_0x176e('0x1')],'get':function(_0x1602c3){return this[_0x176e('0x2')](_0x176e('0x3'));}},'action':{'type':Sequelize[_0x176e('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x176e('0x5'),_0x176e('0x6'),'motionbar',_0x176e('0x7'),_0x176e('0x8'),_0x176e('0x9'),_0x176e('0xa'),'script']],'msg':_0x176e('0xb')}},'comment':_0x176e('0xb')},'data1':{'type':Sequelize[_0x176e('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize['STRING'](0x1000),'comment':'integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]'},'data3':{'type':Sequelize[_0x176e('0x4')](0x1000),'comment':_0x176e('0xc')},'data4':{'type':Sequelize['STRING'](0x1000)},'data5':{'type':Sequelize[_0x176e('0x4')](0x1000)},'data6':{'type':Sequelize[_0x176e('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x2d61=['Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20urlForward[URL]','sequelize','exports','VIRTUAL','getDataValue','STRING','contactManager','integration','motionbar','jscripty','urlForward','browser','bot','script'];(function(_0x14ebf7,_0x26e86c){var _0x704dea=function(_0x397024){while(--_0x397024){_0x14ebf7['push'](_0x14ebf7['shift']());}};_0x704dea(++_0x26e86c);}(_0x2d61,0xd4));var _0x12d6=function(_0x5ea601,_0x38f5d4){_0x5ea601=_0x5ea601-0x0;var _0x3a1a87=_0x2d61[_0x5ea601];return _0x3a1a87;};'use strict';var Sequelize=require(_0x12d6('0x0'));module[_0x12d6('0x1')]={'name':{'type':Sequelize[_0x12d6('0x2')],'get':function(_0x139247){return this[_0x12d6('0x3')]('action');}},'action':{'type':Sequelize[_0x12d6('0x4')],'allowNull':![],'validate':{'isIn':{'args':[[_0x12d6('0x5'),_0x12d6('0x6'),_0x12d6('0x7'),_0x12d6('0x8'),_0x12d6('0x9'),_0x12d6('0xa'),_0x12d6('0xb'),_0x12d6('0xc')]],'msg':_0x12d6('0xd')}},'comment':_0x12d6('0xd')},'data1':{'type':Sequelize[_0x12d6('0x4')](0x1000),'comment':'contactManager[ListId],\x20integration[intName(zendesk)],\x20motionbar[Popup(0),URL(1),WinApp(2)],\x20urlForward[GET,POST],\x20browser[TemplateId(0),URL(1)]'},'data2':{'type':Sequelize[_0x12d6('0x4')](0x1000),'comment':_0x12d6('0xe')},'data3':{'type':Sequelize['STRING'](0x1000),'comment':'motionbar[NULL,NULL,WinAppArguments]'},'data4':{'type':Sequelize[_0x12d6('0x4')](0x1000)},'data5':{'type':Sequelize[_0x12d6('0x4')](0x1000)},'data6':{'type':Sequelize[_0x12d6('0x4')]},'data7':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index 936b124..8d2c485 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 _0x894f=['moment','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','body','params','catch','find','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x3aee02,_0x89f68c){var _0x1a4405=function(_0x3b0fed){while(--_0x3b0fed){_0x3aee02['push'](_0x3aee02['shift']());}};_0x1a4405(++_0x89f68c);}(_0x894f,0x8c));var _0xf894=function(_0x42dcd7,_0xe9661e){_0x42dcd7=_0x42dcd7-0x0;var _0x163e4b=_0x894f[_0x42dcd7];return _0x163e4b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf894('0x0'));var zipdir=require(_0xf894('0x1'));var jsonpatch=require(_0xf894('0x2'));var rp=require(_0xf894('0x3'));var moment=require(_0xf894('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xf894('0x5'));var path=require(_0xf894('0x6'));var sox=require(_0xf894('0x7'));var csv=require(_0xf894('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf894('0x9'));var _=require(_0xf894('0xa'));var squel=require(_0xf894('0xb'));var crypto=require(_0xf894('0xc'));var jsforce=require(_0xf894('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf894('0x8'));var querystring=require(_0xf894('0xe'));var Papa=require(_0xf894('0xf'));var Redis=require(_0xf894('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xf894('0x11'));var as=require(_0xf894('0x12'));var hardwareService=require(_0xf894('0x13'));var logger=require(_0xf894('0x14'))(_0xf894('0x15'));var utils=require(_0xf894('0x16'));var config=require(_0xf894('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5dac1c,_0x3c5a63){_0x3c5a63=_0x3c5a63||0xcc;return function(_0x4c8e64){if(_0x4c8e64){return _0x5dac1c[_0xf894('0x18')](_0x3c5a63);}return _0x5dac1c['status'](_0x3c5a63)['end']();};}function respondWithResult(_0x467bd8,_0x5f1748){_0x5f1748=_0x5f1748||0xc8;return function(_0x341b99){if(_0x341b99){return _0x467bd8[_0xf894('0x19')](_0x5f1748)[_0xf894('0x1a')](_0x341b99);}};}function respondWithFilteredResult(_0x1cf373,_0x50f570){return function(_0x33f96c){if(_0x33f96c){var _0x5a16ea=typeof _0x50f570[_0xf894('0x1b')]===_0xf894('0x1c')&&typeof _0x50f570['limit']===_0xf894('0x1c');var _0x3241f2=_0x33f96c[_0xf894('0x1d')];var _0x3cc24b=_0x5a16ea?0x0:_0x50f570[_0xf894('0x1b')];var _0x59f079=_0x5a16ea?_0x33f96c[_0xf894('0x1d')]:_0x50f570[_0xf894('0x1b')]+_0x50f570[_0xf894('0x1e')];var _0x5f5be2;if(_0x59f079>=_0x3241f2){_0x59f079=_0x3241f2;_0x5f5be2=0xc8;}else{_0x5f5be2=0xce;}_0x1cf373[_0xf894('0x19')](_0x5f5be2);return _0x1cf373[_0xf894('0x1f')](_0xf894('0x20'),_0x3cc24b+'-'+_0x59f079+'/'+_0x3241f2)[_0xf894('0x1a')](_0x33f96c);}return null;};}function patchUpdates(_0x3fb63b){return function(_0x5e356a){try{jsonpatch[_0xf894('0x21')](_0x5e356a,_0x3fb63b,!![]);}catch(_0x598fe5){return BPromise[_0xf894('0x22')](_0x598fe5);}return _0x5e356a[_0xf894('0x23')]();};}function saveUpdates(_0x2e6c98,_0x4dd320){return function(_0x4f3942){if(_0x4f3942){return _0x4f3942[_0xf894('0x24')](_0x2e6c98)['then'](function(_0x52e02e){return _0x52e02e;});}return null;};}function removeEntity(_0x4357d1,_0xcfe7b2){return function(_0x2028d0){if(_0x2028d0){return _0x2028d0[_0xf894('0x25')]()[_0xf894('0x26')](function(){_0x4357d1[_0xf894('0x19')](0xcc)[_0xf894('0x27')]();});}};}function handleEntityNotFound(_0x1580aa,_0x13cba6){return function(_0x150673){if(!_0x150673){_0x1580aa[_0xf894('0x18')](0x194);}return _0x150673;};}function handleError(_0x3eeea5,_0x4e205d){_0x4e205d=_0x4e205d||0x1f4;return function(_0x50a692){logger[_0xf894('0x28')](_0x50a692[_0xf894('0x29')]);if(_0x50a692[_0xf894('0x2a')]){delete _0x50a692[_0xf894('0x2a')];}_0x3eeea5[_0xf894('0x19')](_0x4e205d)[_0xf894('0x2b')](_0x50a692);};}exports['update']=function(_0x1efb2f,_0x4e7555){if(_0x1efb2f[_0xf894('0x2c')]['id']){delete _0x1efb2f[_0xf894('0x2c')]['id'];}return db['Action']['find']({'where':{'id':_0x1efb2f[_0xf894('0x2d')]['id']}})[_0xf894('0x26')](handleEntityNotFound(_0x4e7555,null))[_0xf894('0x26')](saveUpdates(_0x1efb2f[_0xf894('0x2c')],null))[_0xf894('0x26')](respondWithResult(_0x4e7555,null))[_0xf894('0x2e')](handleError(_0x4e7555,null));};exports['destroy']=function(_0x26bd3c,_0x2e9c50){return db['Action'][_0xf894('0x2f')]({'where':{'id':_0x26bd3c[_0xf894('0x2d')]['id']}})[_0xf894('0x26')](handleEntityNotFound(_0x2e9c50,null))[_0xf894('0x26')](removeEntity(_0x2e9c50,null))['catch'](handleError(_0x2e9c50,null));}; \ No newline at end of file +var _0xa380=['sox','to-csv','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','end','stack','name','update','body','Action','find','catch','destroy','params','eml-format','rimraf','zip-dir','bluebird','mustache','path'];(function(_0xbc3606,_0x38e769){var _0x1ec2c9=function(_0x42bfbe){while(--_0x42bfbe){_0xbc3606['push'](_0xbc3606['shift']());}};_0x1ec2c9(++_0x38e769);}(_0xa380,0x127));var _0x0a38=function(_0x2e9bc5,_0x4aaf05){_0x2e9bc5=_0x2e9bc5-0x0;var _0x3a78f4=_0xa380[_0x2e9bc5];return _0x3a78f4;};'use strict';var emlformat=require(_0x0a38('0x0'));var rimraf=require(_0x0a38('0x1'));var zipdir=require(_0x0a38('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0a38('0x3'));var Mustache=require(_0x0a38('0x4'));var util=require('util');var path=require(_0x0a38('0x5'));var sox=require(_0x0a38('0x6'));var csv=require(_0x0a38('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0a38('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0a38('0x9'));var deskjs=require(_0x0a38('0xa'));var toCsv=require(_0x0a38('0x7'));var querystring=require('querystring');var Papa=require(_0x0a38('0xb'));var Redis=require(_0x0a38('0xc'));var authService=require(_0x0a38('0xd'));var qs=require(_0x0a38('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a38('0xf'));var logger=require(_0x0a38('0x10'))(_0x0a38('0x11'));var utils=require('../../config/utils');var config=require(_0x0a38('0x12'));var licenseUtil=require(_0x0a38('0x13'));var db=require(_0x0a38('0x14'))['db'];function respondWithStatusCode(_0x288061,_0x366f3d){_0x366f3d=_0x366f3d||0xcc;return function(_0x2755b2){if(_0x2755b2){return _0x288061[_0x0a38('0x15')](_0x366f3d);}return _0x288061[_0x0a38('0x16')](_0x366f3d)['end']();};}function respondWithResult(_0x195629,_0x55cf55){_0x55cf55=_0x55cf55||0xc8;return function(_0x17a90d){if(_0x17a90d){return _0x195629[_0x0a38('0x16')](_0x55cf55)[_0x0a38('0x17')](_0x17a90d);}};}function respondWithFilteredResult(_0x592949,_0x4dea7b){return function(_0x2b408e){if(_0x2b408e){var _0x371ba9=typeof _0x4dea7b['offset']===_0x0a38('0x18')&&typeof _0x4dea7b[_0x0a38('0x19')]==='undefined';var _0x5e3409=_0x2b408e[_0x0a38('0x1a')];var _0x549b26=_0x371ba9?0x0:_0x4dea7b[_0x0a38('0x1b')];var _0x1945a2=_0x371ba9?_0x2b408e[_0x0a38('0x1a')]:_0x4dea7b[_0x0a38('0x1b')]+_0x4dea7b[_0x0a38('0x19')];var _0x8af931;if(_0x1945a2>=_0x5e3409){_0x1945a2=_0x5e3409;_0x8af931=0xc8;}else{_0x8af931=0xce;}_0x592949[_0x0a38('0x16')](_0x8af931);return _0x592949[_0x0a38('0x1c')](_0x0a38('0x1d'),_0x549b26+'-'+_0x1945a2+'/'+_0x5e3409)['json'](_0x2b408e);}return null;};}function patchUpdates(_0x369462){return function(_0x585cdb){try{jsonpatch[_0x0a38('0x1e')](_0x585cdb,_0x369462,!![]);}catch(_0x2ef6de){return BPromise['reject'](_0x2ef6de);}return _0x585cdb[_0x0a38('0x1f')]();};}function saveUpdates(_0xaa7662,_0x1f6201){return function(_0x379f51){if(_0x379f51){return _0x379f51['update'](_0xaa7662)[_0x0a38('0x20')](function(_0x57a83e){return _0x57a83e;});}return null;};}function removeEntity(_0x597a6e,_0x553c62){return function(_0x3b137e){if(_0x3b137e){return _0x3b137e['destroy']()[_0x0a38('0x20')](function(){_0x597a6e['status'](0xcc)[_0x0a38('0x21')]();});}};}function handleEntityNotFound(_0x5c6854,_0x59c44d){return function(_0x1c9878){if(!_0x1c9878){_0x5c6854[_0x0a38('0x15')](0x194);}return _0x1c9878;};}function handleError(_0x57ae28,_0x2ed761){_0x2ed761=_0x2ed761||0x1f4;return function(_0x2716d7){logger['error'](_0x2716d7[_0x0a38('0x22')]);if(_0x2716d7['name']){delete _0x2716d7[_0x0a38('0x23')];}_0x57ae28[_0x0a38('0x16')](_0x2ed761)['send'](_0x2716d7);};}exports[_0x0a38('0x24')]=function(_0x31e744,_0x1c60c4){if(_0x31e744[_0x0a38('0x25')]['id']){delete _0x31e744[_0x0a38('0x25')]['id'];}return db[_0x0a38('0x26')][_0x0a38('0x27')]({'where':{'id':_0x31e744['params']['id']}})['then'](handleEntityNotFound(_0x1c60c4,null))['then'](saveUpdates(_0x31e744[_0x0a38('0x25')],null))[_0x0a38('0x20')](respondWithResult(_0x1c60c4,null))[_0x0a38('0x28')](handleError(_0x1c60c4,null));};exports[_0x0a38('0x29')]=function(_0x191178,_0x364169){return db[_0x0a38('0x26')][_0x0a38('0x27')]({'where':{'id':_0x191178[_0x0a38('0x2a')]['id']}})[_0x0a38('0x20')](handleEntityNotFound(_0x364169,null))['then'](removeEntity(_0x364169,null))['catch'](handleError(_0x364169,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index 85bd199..0996981 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 _0x653d=['rimraf','../../config/environment','./action.attributes','exports','Action','tools_actions','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x3607e8,_0x43f505){var _0x275b7a=function(_0xf72f34){while(--_0xf72f34){_0x3607e8['push'](_0x3607e8['shift']());}};_0x275b7a(++_0x43f505);}(_0x653d,0xfd));var _0xd653=function(_0x15beeb,_0x32bd4f){_0x15beeb=_0x15beeb-0x0;var _0x5b681a=_0x653d[_0x15beeb];return _0x5b681a;};'use strict';var _=require(_0xd653('0x0'));var util=require(_0xd653('0x1'));var logger=require(_0xd653('0x2'))(_0xd653('0x3'));var moment=require(_0xd653('0x4'));var BPromise=require(_0xd653('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd653('0x6'));var rimraf=require(_0xd653('0x7'));var config=require(_0xd653('0x8'));var attributes=require(_0xd653('0x9'));module[_0xd653('0xa')]=function(_0x497a5e,_0x5755b4){return _0x497a5e['define'](_0xd653('0xb'),attributes,{'tableName':_0xd653('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf51f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','define','Action','tools_actions','util','../../config/logger'];(function(_0x4b9806,_0x1517c0){var _0x12f4d4=function(_0x2f0984){while(--_0x2f0984){_0x4b9806['push'](_0x4b9806['shift']());}};_0x12f4d4(++_0x1517c0);}(_0xf51f,0x191));var _0xff51=function(_0x20e7e3,_0x1529be){_0x20e7e3=_0x20e7e3-0x0;var _0x14b9de=_0xf51f[_0x20e7e3];return _0x14b9de;};'use strict';var _=require('lodash');var util=require(_0xff51('0x0'));var logger=require(_0xff51('0x1'))(_0xff51('0x2'));var moment=require(_0xff51('0x3'));var BPromise=require(_0xff51('0x4'));var rp=require(_0xff51('0x5'));var fs=require('fs');var path=require(_0xff51('0x6'));var rimraf=require(_0xff51('0x7'));var config=require(_0xff51('0x8'));var attributes=require(_0xff51('0x9'));module['exports']=function(_0x264072,_0x4ddd55){return _0x264072[_0xff51('0xa')](_0xff51('0xb'),attributes,{'tableName':_0xff51('0xc'),'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 a18ec70..673050d 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 _0x1cb9=['error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0x1cb9,0x14e));var _0x91cb=function(_0x31294a,_0x21b359){_0x31294a=_0x31294a-0x0;var _0x4426a8=_0x1cb9[_0x31294a];return _0x4426a8;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var moment=require(_0x91cb('0x1'));var BPromise=require(_0x91cb('0x2'));var rs=require(_0x91cb('0x3'));var fs=require('fs');var Redis=require(_0x91cb('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x91cb('0x5'));var logger=require(_0x91cb('0x6'))('rpc');var config=require(_0x91cb('0x7'));var jayson=require(_0x91cb('0x8'));var client=jayson[_0x91cb('0x9')][_0x91cb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3b9d98,_0x8f8a3b,_0x4c1f56){return new BPromise(function(_0x15c517,_0x5bda2f){return client[_0x91cb('0xb')](_0x3b9d98,_0x4c1f56)['then'](function(_0xa43e7a){logger[_0x91cb('0xc')](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));logger[_0x91cb('0xf')](_0x91cb('0x10'),_0x8f8a3b,_0x91cb('0xe'),JSON[_0x91cb('0x11')](_0xa43e7a));if(_0xa43e7a[_0x91cb('0x12')]){if(_0xa43e7a[_0x91cb('0x12')]['code']===0x1f4){logger[_0x91cb('0x12')](_0x91cb('0xd'),_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x5bda2f(_0xa43e7a[_0x91cb('0x12')][_0x91cb('0x13')]);}logger[_0x91cb('0x12')]('Action,\x20%s,\x20%s',_0x8f8a3b,_0xa43e7a['error'][_0x91cb('0x13')]);return _0x15c517(_0xa43e7a[_0x91cb('0x12')]['message']);}else{logger['info'](_0x91cb('0xd'),_0x8f8a3b,_0x91cb('0xe'));_0x15c517(_0xa43e7a[_0x91cb('0x14')]['message']);}})[_0x91cb('0x15')](function(_0x135890){logger['error'](_0x91cb('0xd'),_0x8f8a3b,_0x135890);_0x5bda2f(_0x135890);});});} \ No newline at end of file +var _0x5fab=['../../config/environment','jayson/promise','client','request','then','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Action,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x53cb8b,_0x1074de){var _0x5a7658=function(_0xc3b5c9){while(--_0xc3b5c9){_0x53cb8b['push'](_0x53cb8b['shift']());}};_0x5a7658(++_0x1074de);}(_0x5fab,0x177));var _0xb5fa=function(_0x42eaca,_0x1fbbbc){_0x42eaca=_0x42eaca-0x0;var _0x2832d1=_0x5fab[_0x42eaca];return _0x2832d1;};'use strict';var _=require(_0xb5fa('0x0'));var util=require(_0xb5fa('0x1'));var moment=require('moment');var BPromise=require(_0xb5fa('0x2'));var rs=require(_0xb5fa('0x3'));var fs=require('fs');var Redis=require(_0xb5fa('0x4'));var db=require(_0xb5fa('0x5'))['db'];var utils=require(_0xb5fa('0x6'));var logger=require(_0xb5fa('0x7'))(_0xb5fa('0x8'));var config=require(_0xb5fa('0x9'));var jayson=require(_0xb5fa('0xa'));var client=jayson[_0xb5fa('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5d70f6,_0x2e3804,_0x1aec3e){return new BPromise(function(_0x9c7bce,_0x56d018){return client[_0xb5fa('0xc')](_0x5d70f6,_0x1aec3e)[_0xb5fa('0xd')](function(_0x2cf4a5){logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));logger[_0xb5fa('0xf')](_0xb5fa('0x10'),_0x2e3804,_0xb5fa('0xe'),JSON[_0xb5fa('0x11')](_0x2cf4a5));if(_0x2cf4a5[_0xb5fa('0x12')]){if(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x13')]===0x1f4){logger[_0xb5fa('0x12')]('Action,\x20%s,\x20%s',_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x56d018(_0x2cf4a5['error'][_0xb5fa('0x14')]);}logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);return _0x9c7bce(_0x2cf4a5[_0xb5fa('0x12')][_0xb5fa('0x14')]);}else{logger['info']('Action,\x20%s,\x20%s',_0x2e3804,_0xb5fa('0xe'));_0x9c7bce(_0x2cf4a5[_0xb5fa('0x16')][_0xb5fa('0x14')]);}})[_0xb5fa('0x17')](function(_0x56fe10){logger['error'](_0xb5fa('0x15'),_0x2e3804,_0x56fe10);_0x56d018(_0x56fe10);});});} \ No newline at end of file diff --git a/server/api/action/index.js b/server/api/action/index.js index 2d27260..89dfdc1 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 _0xc944=['destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./action.controller','put','/:id','isAuthenticated'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0xc944,0x1b2));var _0x4c94=function(_0x13c4ab,_0x38b81b){_0x13c4ab=_0x13c4ab-0x0;var _0x5ce8f5=_0xc944[_0x13c4ab];return _0x5ce8f5;};'use strict';var multer=require(_0x4c94('0x0'));var util=require(_0x4c94('0x1'));var path=require(_0x4c94('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x4c94('0x3'));var auth=require(_0x4c94('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x4c94('0x5'));var controller=require(_0x4c94('0x6'));router[_0x4c94('0x7')](_0x4c94('0x8'),auth[_0x4c94('0x9')](),controller['update']);router['delete'](_0x4c94('0x8'),auth['isAuthenticated'](),controller[_0x4c94('0xa')]);module[_0x4c94('0xb')]=router; \ No newline at end of file +var _0xac90=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./action.controller','isAuthenticated','update','delete','/:id','destroy','exports','multer','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac90,0x1e8));var _0x0ac9=function(_0x1f4608,_0x9822d6){_0x1f4608=_0x1f4608-0x0;var _0x13be13=_0xac90[_0x1f4608];return _0x13be13;};'use strict';var multer=require(_0x0ac9('0x0'));var util=require(_0x0ac9('0x1'));var path=require('path');var timeout=require(_0x0ac9('0x2'));var express=require(_0x0ac9('0x3'));var router=express['Router']();var fs_extra=require(_0x0ac9('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0ac9('0x5'));var config=require(_0x0ac9('0x6'));var controller=require(_0x0ac9('0x7'));router['put']('/:id',auth[_0x0ac9('0x8')](),controller[_0x0ac9('0x9')]);router[_0x0ac9('0xa')](_0x0ac9('0xb'),auth[_0x0ac9('0x8')](),controller[_0x0ac9('0xc')]);module[_0x0ac9('0xd')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1cc02ee..09729af 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 _0x5fd1=['STRING','TEXT','sequelize'];(function(_0x2a0350,_0x249319){var _0x425220=function(_0x1d5f78){while(--_0x1d5f78){_0x2a0350['push'](_0x2a0350['shift']());}};_0x425220(++_0x249319);}(_0x5fd1,0x155));var _0x15fd=function(_0x1cff8e,_0x2c975a){_0x1cff8e=_0x1cff8e-0x0;var _0x59021a=_0x5fd1[_0x1cff8e];return _0x59021a;};'use strict';var Sequelize=require(_0x15fd('0x0'));module['exports']={'name':{'type':Sequelize[_0x15fd('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x15fd('0x1')]},'parent':{'type':Sequelize[_0x15fd('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x15fd('0x2')]}}; \ No newline at end of file +var _0x6aa7=['TEXT','sequelize','STRING'];(function(_0x24b245,_0x1b3508){var _0x56f828=function(_0x21752a){while(--_0x21752a){_0x24b245['push'](_0x24b245['shift']());}};_0x56f828(++_0x1b3508);}(_0x6aa7,0x178));var _0x76aa=function(_0xf57c63,_0x208274){_0xf57c63=_0xf57c63-0x0;var _0x48023f=_0x6aa7[_0xf57c63];return _0x48023f;};'use strict';var Sequelize=require(_0x76aa('0x0'));module['exports']={'name':{'type':Sequelize[_0x76aa('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x76aa('0x1')]},'parent':{'type':Sequelize[_0x76aa('0x1')]},'table':{'type':Sequelize[_0x76aa('0x1')]},'conditions':{'type':Sequelize['TEXT']},'joins':{'type':Sequelize[_0x76aa('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index 79dc14e..9a8d13c 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 _0x6799=['ioredis','../../components/auth/service','../../config/license/hardware','../../config/license/util','../../mysqldb','dbH','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','get','CustomReports','UserProfileResource','destroy','error','stack','name','index','map','AnalyticCustomReport','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','findAll','rows','show','params','rawAttributes','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','preview','join','left_join','cross_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%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)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NOT\x20NULL','IS\x20EMPTY','rules','operator','group','condition','value','getFields','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','table','MetricId','field','function','format','replace','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','conditions','sequelize','toString','QueryTypes','SELECT','right_join','COUNT(DISTINCT\x20%s)','IS\x20NULL','Sequelize','keyBy','from','metric','%s.%s\x20=\x20%s.%s','clone','output','web','fullPath','%s-%s.%s','randomstring','generate','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','../../components/export/','../../files/reports','COUNT(*)','run','runReport','IS\x20NOT\x20EMPTY','debug','Limited\x20Query:','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring'];(function(_0x2643cb,_0x64141a){var _0x4fd8f8=function(_0x1117e4){while(--_0x1117e4){_0x2643cb['push'](_0x2643cb['shift']());}};_0x4fd8f8(++_0x64141a);}(_0x6799,0x91));var _0x9679=function(_0x5773d9,_0x41c1c6){_0x5773d9=_0x5773d9-0x0;var _0x1ec279=_0x6799[_0x5773d9];return _0x1ec279;};'use strict';var emlformat=require(_0x9679('0x0'));var rimraf=require(_0x9679('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9679('0x2'));var rp=require('request-promise');var moment=require(_0x9679('0x3'));var BPromise=require(_0x9679('0x4'));var Mustache=require(_0x9679('0x5'));var util=require(_0x9679('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x9679('0x7'));var ejs=require(_0x9679('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9679('0x9'));var squel=require(_0x9679('0xa'));var crypto=require('crypto');var jsforce=require(_0x9679('0xb'));var deskjs=require(_0x9679('0xc'));var toCsv=require(_0x9679('0x7'));var querystring=require(_0x9679('0xd'));var Papa=require('papaparse');var Redis=require(_0x9679('0xe'));var authService=require(_0x9679('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9679('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x9679('0x11'));var db=require(_0x9679('0x12'))['db'];var dbH=require(_0x9679('0x12'))[_0x9679('0x13')];function respondWithStatusCode(_0x502036,_0x4ccc87){_0x4ccc87=_0x4ccc87||0xcc;return function(_0x3cb60a){if(_0x3cb60a){return _0x502036[_0x9679('0x14')](_0x4ccc87);}return _0x502036['status'](_0x4ccc87)[_0x9679('0x15')]();};}function respondWithResult(_0x4841a9,_0x55b5f1){_0x55b5f1=_0x55b5f1||0xc8;return function(_0x5d2035){if(_0x5d2035){return _0x4841a9[_0x9679('0x16')](_0x55b5f1)[_0x9679('0x17')](_0x5d2035);}};}function respondWithFilteredResult(_0x1adac8,_0xb91487){return function(_0x4fd29c){if(_0x4fd29c){var _0x13f95f=typeof _0xb91487[_0x9679('0x18')]===_0x9679('0x19')&&typeof _0xb91487[_0x9679('0x1a')]===_0x9679('0x19');var _0x285098=_0x4fd29c[_0x9679('0x1b')];var _0x371b46=_0x13f95f?0x0:_0xb91487[_0x9679('0x18')];var _0x59a039=_0x13f95f?_0x4fd29c[_0x9679('0x1b')]:_0xb91487[_0x9679('0x18')]+_0xb91487[_0x9679('0x1a')];var _0x401261;if(_0x59a039>=_0x285098){_0x59a039=_0x285098;_0x401261=0xc8;}else{_0x401261=0xce;}_0x1adac8[_0x9679('0x16')](_0x401261);return _0x1adac8[_0x9679('0x1c')](_0x9679('0x1d'),_0x371b46+'-'+_0x59a039+'/'+_0x285098)[_0x9679('0x17')](_0x4fd29c);}return null;};}function patchUpdates(_0x2a0caa){return function(_0x4c7d00){try{jsonpatch['apply'](_0x4c7d00,_0x2a0caa,!![]);}catch(_0x377dfb){return BPromise[_0x9679('0x1e')](_0x377dfb);}return _0x4c7d00['save']();};}function saveUpdates(_0x1d9176,_0x345c99){return function(_0x322c83){if(_0x322c83){return _0x322c83[_0x9679('0x1f')](_0x1d9176)['then'](function(_0x1e3dc1){return _0x1e3dc1;});}return null;};}function removeEntity(_0x26be85,_0x532b63){return function(_0x2b9a0e){if(_0x2b9a0e){return _0x2b9a0e['destroy']()[_0x9679('0x20')](function(){var _0x4a9427=_0x2b9a0e[_0x9679('0x21')]({'plain':!![]});var _0x248f72=_0x9679('0x22');return db[_0x9679('0x23')][_0x9679('0x24')]({'where':{'type':_0x248f72,'resourceId':_0x4a9427['id']}})[_0x9679('0x20')](function(){return _0x2b9a0e;});})[_0x9679('0x20')](function(){_0x26be85[_0x9679('0x16')](0xcc)[_0x9679('0x15')]();});}};}function handleEntityNotFound(_0x656fd9,_0x377cb0){return function(_0xa6f43b){if(!_0xa6f43b){_0x656fd9['sendStatus'](0x194);}return _0xa6f43b;};}function handleError(_0x58762e,_0x57831e){_0x57831e=_0x57831e||0x1f4;return function(_0x55717c){logger[_0x9679('0x25')](_0x55717c[_0x9679('0x26')]);if(_0x55717c[_0x9679('0x27')]){delete _0x55717c[_0x9679('0x27')];}_0x58762e[_0x9679('0x16')](_0x57831e)['send'](_0x55717c);};}exports[_0x9679('0x28')]=function(_0x45fe61,_0x4fd06b){var _0x64d95e={},_0x36493f={},_0x5359d1={'count':0x0,'rows':[]};var _0x5da5f9=_[_0x9679('0x29')](db[_0x9679('0x2a')]['rawAttributes'],function(_0x746007){return{'name':_0x746007[_0x9679('0x2b')],'type':_0x746007[_0x9679('0x2c')]['key']};});_0x36493f[_0x9679('0x2d')]=_[_0x9679('0x29')](_0x5da5f9,'name');_0x36493f[_0x9679('0x2e')]=_[_0x9679('0x2f')](_0x45fe61[_0x9679('0x2e')]);_0x36493f[_0x9679('0x30')]=_[_0x9679('0x31')](_0x36493f['model'],_0x36493f['query']);_0x64d95e['attributes']=_[_0x9679('0x31')](_0x36493f[_0x9679('0x2d')],qs[_0x9679('0x32')](_0x45fe61[_0x9679('0x2e')][_0x9679('0x32')]));_0x64d95e[_0x9679('0x33')]=_0x64d95e['attributes'][_0x9679('0x34')]?_0x64d95e[_0x9679('0x33')]:_0x36493f['model'];if(!_0x45fe61[_0x9679('0x2e')][_0x9679('0x35')](_0x9679('0x36'))){_0x64d95e[_0x9679('0x1a')]=qs[_0x9679('0x1a')](_0x45fe61[_0x9679('0x2e')][_0x9679('0x1a')]);_0x64d95e[_0x9679('0x18')]=qs[_0x9679('0x18')](_0x45fe61[_0x9679('0x2e')][_0x9679('0x18')]);}_0x64d95e[_0x9679('0x37')]=qs[_0x9679('0x38')](_0x45fe61[_0x9679('0x2e')][_0x9679('0x38')]);_0x64d95e[_0x9679('0x39')]=qs[_0x9679('0x30')](_['pick'](_0x45fe61[_0x9679('0x2e')],_0x36493f[_0x9679('0x30')]),_0x5da5f9);if(_0x45fe61[_0x9679('0x2e')][_0x9679('0x3a')]){_0x64d95e['where']=_[_0x9679('0x3b')](_0x64d95e['where'],{'$or':_['map'](_0x5da5f9,function(_0x28ffc0){if(_0x28ffc0[_0x9679('0x2c')]!=='VIRTUAL'){var _0x47fe1={};_0x47fe1[_0x28ffc0['name']]={'$like':'%'+_0x45fe61[_0x9679('0x2e')][_0x9679('0x3a')]+'%'};return _0x47fe1;}})});}_0x64d95e=_[_0x9679('0x3b')]({},_0x64d95e,_0x45fe61[_0x9679('0x3c')]);var _0x4c4896={'where':_0x64d95e['where']};return db[_0x9679('0x2a')][_0x9679('0x1b')](_0x4c4896)['then'](function(_0x574cfe){_0x5359d1[_0x9679('0x1b')]=_0x574cfe;if(_0x45fe61[_0x9679('0x2e')][_0x9679('0x3d')]){_0x64d95e[_0x9679('0x3e')]=[{'all':!![]}];}return db[_0x9679('0x2a')][_0x9679('0x3f')](_0x64d95e);})[_0x9679('0x20')](function(_0x16f052){_0x5359d1[_0x9679('0x40')]=_0x16f052;return _0x5359d1;})[_0x9679('0x20')](respondWithFilteredResult(_0x4fd06b,_0x64d95e))['catch'](handleError(_0x4fd06b,null));};exports[_0x9679('0x41')]=function(_0x53551b,_0x1043d9){var _0x54b4c4={'raw':![],'where':{'id':_0x53551b[_0x9679('0x42')]['id']}},_0x579606={};_0x579606[_0x9679('0x2d')]=_[_0x9679('0x2f')](db[_0x9679('0x2a')][_0x9679('0x43')]);_0x579606[_0x9679('0x2e')]=_[_0x9679('0x2f')](_0x53551b['query']);_0x579606[_0x9679('0x30')]=_['intersection'](_0x579606[_0x9679('0x2d')],_0x579606['query']);_0x54b4c4[_0x9679('0x33')]=_[_0x9679('0x31')](_0x579606[_0x9679('0x2d')],qs[_0x9679('0x32')](_0x53551b['query'][_0x9679('0x32')]));_0x54b4c4[_0x9679('0x33')]=_0x54b4c4['attributes'][_0x9679('0x34')]?_0x54b4c4[_0x9679('0x33')]:_0x579606[_0x9679('0x2d')];if(_0x53551b['query'][_0x9679('0x3d')]){_0x54b4c4['include']=[{'all':!![]}];}_0x54b4c4=_[_0x9679('0x3b')]({},_0x54b4c4,_0x53551b[_0x9679('0x3c')]);return db[_0x9679('0x2a')]['find'](_0x54b4c4)[_0x9679('0x20')](handleEntityNotFound(_0x1043d9,null))[_0x9679('0x20')](respondWithResult(_0x1043d9,null))[_0x9679('0x44')](handleError(_0x1043d9,null));};exports[_0x9679('0x45')]=function(_0x1af9fc,_0x5f24e0){return db['AnalyticCustomReport'][_0x9679('0x45')](_0x1af9fc['body'],{})['then'](function(_0x39ab28){var _0xf4a833=_0x1af9fc[_0x9679('0x46')][_0x9679('0x21')]({'plain':!![]});if(!_0xf4a833)throw new Error(_0x9679('0x47'));if(_0xf4a833[_0x9679('0x48')]===_0x9679('0x46')){var _0x1beefa=_0x39ab28[_0x9679('0x21')]({'plain':!![]});var _0xcd4af6=_0x9679('0x49');return db[_0x9679('0x4a')][_0x9679('0x4b')]({'where':{'name':_0xcd4af6,'userProfileId':_0xf4a833['userProfileId']},'raw':!![]})[_0x9679('0x20')](function(_0xb6ed29){if(_0xb6ed29&&_0xb6ed29[_0x9679('0x4c')]===0x0){return db[_0x9679('0x23')][_0x9679('0x45')]({'name':_0x1beefa[_0x9679('0x27')],'resourceId':_0x1beefa['id'],'type':_0x9679('0x22'),'sectionId':_0xb6ed29['id']},{})[_0x9679('0x20')](function(){return _0x39ab28;});}else{return _0x39ab28;}})[_0x9679('0x44')](function(_0x222416){logger[_0x9679('0x25')](_0x9679('0x4d'),_0x222416);throw _0x222416;});}return _0x39ab28;})[_0x9679('0x20')](respondWithResult(_0x5f24e0,0xc9))[_0x9679('0x44')](handleError(_0x5f24e0,null));};exports[_0x9679('0x1f')]=function(_0x3cd676,_0x4e48b7){if(_0x3cd676[_0x9679('0x4e')]['id']){delete _0x3cd676[_0x9679('0x4e')]['id'];}return db['AnalyticCustomReport'][_0x9679('0x4b')]({'where':{'id':_0x3cd676[_0x9679('0x42')]['id']}})['then'](handleEntityNotFound(_0x4e48b7,null))[_0x9679('0x20')](saveUpdates(_0x3cd676[_0x9679('0x4e')],null))[_0x9679('0x20')](respondWithResult(_0x4e48b7,null))['catch'](handleError(_0x4e48b7,null));};exports['destroy']=function(_0x1a307e,_0x638309){return db[_0x9679('0x2a')][_0x9679('0x4b')]({'where':{'id':_0x1a307e[_0x9679('0x42')]['id']}})['then'](handleEntityNotFound(_0x638309,null))['then'](removeEntity(_0x638309,null))[_0x9679('0x44')](handleError(_0x638309,null));};exports[_0x9679('0x4f')]=function(_0x492f01,_0x3da4ed){var _0x1ee5a3=0xa;var _0x3ba9e9=[_0x9679('0x50'),_0x9679('0x51'),'right_join',_0x9679('0x52')];var _0x23bef8={'SUM':_0x9679('0x53'),'COUNT':_0x9679('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9679('0x55'),'MIN':_0x9679('0x56'),'AVG':_0x9679('0x57'),'GROUP_CONCAT':_0x9679('0x58'),'GROUP_CONCAT ASC':_0x9679('0x59'),'GROUP_CONCAT DESC':_0x9679('0x5a')};var _0x4a86d5={'SEC_TO_TIME':_0x9679('0x5b'),'DATE':_0x9679('0x5c'),'HOUR':_0x9679('0x5d'),'ROUND':_0x9679('0x5e'),'UNIX_TIMESTAMP':_0x9679('0x5f')};var _0x3138ed=function(_0x6ff7f1){return!_[_0x9679('0x60')](['IS\x20NULL',_0x9679('0x61'),_0x9679('0x62'),'IS\x20NOT\x20EMPTY'],_0x6ff7f1);};var _0x5b1f50=function(_0xbc1950){if(!_0xbc1950||!_0xbc1950[_0x9679('0x63')][_0x9679('0x34')]){return'';}for(var _0x108764='(',_0x210dfd=0x0;_0x210dfd<_0xbc1950[_0x9679('0x63')][_0x9679('0x34')];_0x210dfd+=0x1){_0x210dfd>0x0&&(_0x108764+='\x20'+_0xbc1950[_0x9679('0x64')]+'\x20');_0x108764+=_0xbc1950[_0x9679('0x63')][_0x210dfd][_0x9679('0x65')]?_0x5b1f50(_0xbc1950[_0x9679('0x63')][_0x210dfd][_0x9679('0x65')]):_0xbc1950[_0x9679('0x63')][_0x210dfd]['field']+'\x20'+_0xbc1950[_0x9679('0x63')][_0x210dfd][_0x9679('0x66')]+(_0x3138ed(_0xbc1950[_0x9679('0x63')][_0x210dfd][_0x9679('0x66')])?'\x20'+_0xbc1950[_0x9679('0x63')][_0x210dfd][_0x9679('0x67')]:'');}return _0x108764+')';};var _0x15ebf3={'where':{'id':_0x492f01[_0x9679('0x42')]['id']}},_0xe98949,_0x40832c,_0x5cd7f4,_0xd3a270,_0x5e4c81;_0x15ebf3=_[_0x9679('0x3b')]({},_0x15ebf3,_0x492f01['options']);return db[_0x9679('0x2a')][_0x9679('0x4b')](_0x15ebf3)['then'](function(_0x2c5582){if(_0x2c5582){_0xe98949=_0x2c5582;return _0x2c5582[_0x9679('0x68')]();}return null;})[_0x9679('0x20')](function(_0x34d483){if(_0x34d483){if(!_0x34d483[_0x9679('0x34')]){throw new db['Sequelize'][(_0x9679('0x69'))](_0x9679('0x6a'),0x193);}_0x40832c=_0x34d483;return db[_0x9679('0x6b')][_0x9679('0x3f')]({'raw':!![]});}return null;})[_0x9679('0x20')](function(_0x22c262){if(_0x22c262){_0x5cd7f4=_['keyBy'](_0x22c262,'id');var _0x3a1d43;var _0x489479=squel[_0x9679('0x6c')]();_0x489479['from'](_0xe98949[_0x9679('0x6d')]);for(var _0x4bbe4c=0x0;_0x4bbe4c<_0x40832c[_0x9679('0x34')];_0x4bbe4c+=0x1){_0x3a1d43=_0x40832c[_0x4bbe4c][_0x9679('0x6e')]?_0x5cd7f4[_0x40832c[_0x4bbe4c][_0x9679('0x6e')]]['metric']:_0x40832c[_0x4bbe4c][_0x9679('0x6f')];_0x3a1d43=_0x40832c[_0x4bbe4c][_0x9679('0x70')]?_['replace'](_0x23bef8[_0x40832c[_0x4bbe4c][_0x9679('0x70')]],'%s',_0x3a1d43):_0x3a1d43;_0x3a1d43=_0x40832c[_0x4bbe4c][_0x9679('0x71')]?_[_0x9679('0x72')](_0x4a86d5[_0x40832c[_0x4bbe4c][_0x9679('0x71')]],'%s',_0x3a1d43):_0x3a1d43;if(_0x40832c[_0x4bbe4c][_0x9679('0x73')]){_0x489479['group'](_0x3a1d43);}_0x40832c[_0x4bbe4c][_0x9679('0x74')]&&_0x489479[_0x9679('0x37')](_0x3a1d43,_0x40832c[_0x4bbe4c][_0x9679('0x74')]===_0x9679('0x75')?![]:!![]);_0x489479[_0x9679('0x6f')](_0x3a1d43,_0x40832c[_0x4bbe4c][_0x9679('0x76')]||_0x3a1d43);}if(_0xe98949[_0x9679('0x77')]){_0xe98949[_0x9679('0x77')]=JSON[_0x9679('0x78')](_0xe98949[_0x9679('0x77')]);for(var _0x54b731=0x0;_0x54b731<_0xe98949[_0x9679('0x77')][_0x9679('0x34')];_0x54b731+=0x1){if(_0xe98949[_0x9679('0x77')][_0x54b731]['type']&&_[_0x9679('0x60')](_0x3ba9e9,_0xe98949[_0x9679('0x77')][_0x54b731][_0x9679('0x2c')])&&_0xe98949[_0x9679('0x77')][_0x54b731][_0x9679('0x79')]&&_0xe98949[_0x9679('0x77')][_0x54b731][_0x9679('0x7a')]&&_0xe98949['joins'][_0x54b731][_0x9679('0x7b')]){_0x489479[_0xe98949['joins'][_0x54b731]['type']](_0xe98949['joins'][_0x54b731][_0x9679('0x7a')],null,util[_0x9679('0x71')]('%s.%s\x20=\x20%s.%s',_0xe98949[_0x9679('0x6d')],_0xe98949[_0x9679('0x77')][_0x54b731][_0x9679('0x79')],_0xe98949[_0x9679('0x77')][_0x54b731]['foreignTable'],_0xe98949['joins'][_0x54b731]['foreignKey']));}}}if(_0xe98949[_0x9679('0x7c')]){_0xe98949[_0x9679('0x7c')]=JSON[_0x9679('0x78')](_0xe98949['conditions']);_0x489479['where'](_0x5b1f50(_0xe98949['conditions']['group']));}_0x5e4c81=_0x489479['clone']();_0x489479[_0x9679('0x1a')](_0x1ee5a3);_0x489479[_0x9679('0x18')](0x0);logger['debug']('Limited\x20Query:',_0x489479['toString']());return dbH[_0x9679('0x7d')][_0x9679('0x2e')](_0x489479[_0x9679('0x7e')](),{'type':dbH[_0x9679('0x7d')][_0x9679('0x7f')][_0x9679('0x80')]});}})[_0x9679('0x20')](respondWithResult(_0x3da4ed,null))['catch'](handleError(_0x3da4ed,null));};function runReport(_0xafead7,_0x18c2fa,_0x4f38e3){var _0x549e7d=_0x18c2fa[_0x9679('0x27')];var _0x101043=0xa;var _0x21df29=[_0x9679('0x50'),_0x9679('0x51'),_0x9679('0x81'),_0x9679('0x52')];var _0x3be28e={'SUM':_0x9679('0x53'),'COUNT':_0x9679('0x54'),'COUNT DISTINCT':_0x9679('0x82'),'MAX':_0x9679('0x55'),'MIN':_0x9679('0x56'),'AVG':_0x9679('0x57'),'GROUP_CONCAT':_0x9679('0x58'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x9679('0x5a')};var _0x3ab364={'SEC_TO_TIME':_0x9679('0x5b'),'DATE':_0x9679('0x5c'),'HOUR':'HOUR(%s)','ROUND':_0x9679('0x5e'),'UNIX_TIMESTAMP':_0x9679('0x5f')};var _0x59b2b6=function(_0x27a65d){return!_[_0x9679('0x60')]([_0x9679('0x83'),_0x9679('0x61'),_0x9679('0x62'),'IS\x20NOT\x20EMPTY'],_0x27a65d);};var _0x5263a1=function(_0x1bf0cb){if(!_0x1bf0cb||!_0x1bf0cb['rules'][_0x9679('0x34')]){return'';}for(var _0x2235fe='(',_0x277376=0x0;_0x277376<_0x1bf0cb['rules'][_0x9679('0x34')];_0x277376+=0x1){_0x277376>0x0&&(_0x2235fe+='\x20'+_0x1bf0cb[_0x9679('0x64')]+'\x20');_0x2235fe+=_0x1bf0cb[_0x9679('0x63')][_0x277376][_0x9679('0x65')]?_0x5263a1(_0x1bf0cb[_0x9679('0x63')][_0x277376][_0x9679('0x65')]):_0x1bf0cb['rules'][_0x277376][_0x9679('0x6f')]+'\x20'+_0x1bf0cb[_0x9679('0x63')][_0x277376][_0x9679('0x66')]+(_0x59b2b6(_0x1bf0cb['rules'][_0x277376][_0x9679('0x66')])?'\x20'+_0x1bf0cb[_0x9679('0x63')][_0x277376][_0x9679('0x67')]:'');}return _0x2235fe+')';};var _0x2af671={'where':{'id':_0xafead7['id']}},_0x241108,_0x344af5,_0x4a15a7,_0x5e5e53,_0x214cbb;_0x2af671=_[_0x9679('0x3b')]({},_0x2af671,_0x4f38e3);return db[_0x9679('0x2a')]['find'](_0x2af671)[_0x9679('0x20')](function(_0x2a8212){if(_0x2a8212){_0x241108=_0x2a8212;return _0x2a8212[_0x9679('0x68')]();}return null;})[_0x9679('0x20')](function(_0x24d8c0){if(_0x24d8c0){if(!_0x24d8c0['length']){throw new db[(_0x9679('0x84'))][(_0x9679('0x69'))](_0x9679('0x6a'),0x193);}_0x344af5=_0x24d8c0;return db[_0x9679('0x6b')]['findAll']({'raw':!![]});}return null;})[_0x9679('0x20')](function(_0x1b33b2){if(_0x1b33b2){_0x4a15a7=_[_0x9679('0x85')](_0x1b33b2,'id');var _0x5bf20d;var _0x42336e=squel[_0x9679('0x6c')]();_0x42336e[_0x9679('0x86')](_0x241108['table']);for(var _0x27a3c2=0x0;_0x27a3c2<_0x344af5[_0x9679('0x34')];_0x27a3c2+=0x1){_0x5bf20d=_0x344af5[_0x27a3c2][_0x9679('0x6e')]?_0x4a15a7[_0x344af5[_0x27a3c2][_0x9679('0x6e')]][_0x9679('0x87')]:_0x344af5[_0x27a3c2][_0x9679('0x6f')];_0x5bf20d=_0x344af5[_0x27a3c2][_0x9679('0x70')]?_[_0x9679('0x72')](_0x3be28e[_0x344af5[_0x27a3c2][_0x9679('0x70')]],'%s',_0x5bf20d):_0x5bf20d;_0x5bf20d=_0x344af5[_0x27a3c2]['format']?_[_0x9679('0x72')](_0x3ab364[_0x344af5[_0x27a3c2][_0x9679('0x71')]],'%s',_0x5bf20d):_0x5bf20d;if(_0x344af5[_0x27a3c2][_0x9679('0x73')]){_0x42336e[_0x9679('0x65')](_0x5bf20d);}_0x344af5[_0x27a3c2]['orderBy']&&_0x42336e[_0x9679('0x37')](_0x5bf20d,_0x344af5[_0x27a3c2][_0x9679('0x74')]==='DESC'?![]:!![]);_0x42336e[_0x9679('0x6f')](_0x5bf20d,_0x344af5[_0x27a3c2][_0x9679('0x76')]||_0x5bf20d);}if(_0x241108['joins']){_0x241108['joins']=JSON['parse'](_0x241108[_0x9679('0x77')]);for(var _0x5cedbc=0x0;_0x5cedbc<_0x241108['joins']['length'];_0x5cedbc+=0x1){if(_0x241108[_0x9679('0x77')][_0x5cedbc]['type']&&_['includes'](_0x21df29,_0x241108[_0x9679('0x77')][_0x5cedbc][_0x9679('0x2c')])&&_0x241108[_0x9679('0x77')][_0x5cedbc][_0x9679('0x79')]&&_0x241108[_0x9679('0x77')][_0x5cedbc][_0x9679('0x7a')]&&_0x241108[_0x9679('0x77')][_0x5cedbc][_0x9679('0x7b')]){_0x42336e[_0x241108['joins'][_0x5cedbc][_0x9679('0x2c')]](_0x241108[_0x9679('0x77')][_0x5cedbc][_0x9679('0x7a')],null,util[_0x9679('0x71')](_0x9679('0x88'),_0x241108['table'],_0x241108[_0x9679('0x77')][_0x5cedbc][_0x9679('0x79')],_0x241108[_0x9679('0x77')][_0x5cedbc]['foreignTable'],_0x241108[_0x9679('0x77')][_0x5cedbc][_0x9679('0x7b')]));}}}if(_0x241108[_0x9679('0x7c')]){_0x241108[_0x9679('0x7c')]=JSON['parse'](_0x241108[_0x9679('0x7c')]);_0x42336e[_0x9679('0x39')](_0x5263a1(_0x241108[_0x9679('0x7c')][_0x9679('0x65')]));}_0x214cbb=_0x42336e[_0x9679('0x89')]();_0x42336e[_0x9679('0x1a')](_0x101043);_0x42336e[_0x9679('0x18')](0x0);return;}})[_0x9679('0x20')](function(){if(_0x18c2fa[_0x9679('0x8a')]===_0x9679('0x8b')){return null;}var _0x30a40f=_[_0x9679('0x3b')](_0x18c2fa,{'name':_0x18c2fa[_0x9679('0x8c')]||_0x18c2fa[_0x9679('0x27')]||_0x241108[_0x9679('0x27')],'basename':_0x549e7d,'savename':util[_0x9679('0x71')](_0x9679('0x8d'),_0x18c2fa[_0x9679('0x27')]||_0x241108[_0x9679('0x27')],require(_0x9679('0x8e'))[_0x9679('0x8f')](0x4),_0x18c2fa[_0x9679('0x8a')]||'csv'),'reportId':_0x241108['id'],'reportType':_0x9679('0x90')});return db[_0x9679('0x91')]['create'](_0x30a40f,{'raw':!![]});})[_0x9679('0x20')](function(_0x41f666){if(_0x241108[_0x9679('0x6d')]==='cdr'){_0x214cbb['where'](_0x241108[_0x9679('0x6d')]+_0x9679('0x92'),_0x18c2fa[_0x9679('0x93')],_0x18c2fa[_0x9679('0x94')]);}else{_0x214cbb['where'](_0x241108[_0x9679('0x6d')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x18c2fa[_0x9679('0x93')],_0x18c2fa[_0x9679('0x94')]);}if(_0x41f666){logger[_0x9679('0x95')](_0x9679('0x96'),_0x214cbb['toString']());require('child_process')['fork'](path['join'](__dirname,_0x9679('0x97'),_0x41f666['output']),[_0x41f666['id'],_0x214cbb[_0x9679('0x7e')](),path[_0x9679('0x50')](__dirname,_0x9679('0x98'),_0x41f666['savename']),_0x549e7d]);return _0x41f666;}else{var _0x4a2051=squel[_0x9679('0x6c')]();_0x4a2051[_0x9679('0x86')]('('+_0x214cbb[_0x9679('0x7e')]()+')','countTable');_0x4a2051[_0x9679('0x6f')](_0x9679('0x99'),_0x9679('0x1b'));_0x214cbb[_0x9679('0x1a')](_0x18c2fa[_0x9679('0x1a')]||_0x101043);_0x214cbb[_0x9679('0x18')](_0x18c2fa[_0x9679('0x18')]||0x0);return dbH['sequelize']['query'](_0x4a2051[_0x9679('0x7e')](),{'type':dbH[_0x9679('0x7d')][_0x9679('0x7f')]['SELECT']})[_0x9679('0x20')](function(_0x5528f6){if(!_0x5528f6[_0x9679('0x34')]){_0x5e5e53=0x0;}else{_0x5e5e53=_0x5528f6[0x0][_0x9679('0x1b')]||0x0;}return dbH['sequelize']['query'](_0x214cbb[_0x9679('0x7e')](),{'type':dbH[_0x9679('0x7d')][_0x9679('0x7f')]['SELECT']});})['then'](function(_0x7863c9){return{'rows':_0x7863c9||[],'count':_0x5e5e53};});}});}exports[_0x9679('0x9a')]=function(_0xd5bb8f,_0x2e2eb1){return runReport(_0xd5bb8f['params'],_0xd5bb8f['query'],_0xd5bb8f[_0x9679('0x3c')])[_0x9679('0x20')](respondWithResult(_0x2e2eb1,null))[_0x9679('0x44')](handleError(_0x2e2eb1,null));};exports[_0x9679('0x9b')]=runReport;exports['query']=function(_0xb762e4,_0x394e66){var _0x236c9d=0xa;var _0x54376e=[_0x9679('0x50'),_0x9679('0x51'),_0x9679('0x81'),_0x9679('0x52')];var _0x20bc1c={'SUM':_0x9679('0x53'),'COUNT':_0x9679('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x9679('0x55'),'MIN':_0x9679('0x56'),'AVG':_0x9679('0x57'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x9679('0x59'),'GROUP_CONCAT DESC':_0x9679('0x5a')};var _0x5c8161={'SEC_TO_TIME':_0x9679('0x5b'),'DATE':'DATE(%s)','HOUR':_0x9679('0x5d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1bd4f9=function(_0x3c3802){return!_['includes']([_0x9679('0x83'),_0x9679('0x61'),'IS\x20EMPTY',_0x9679('0x9c')],_0x3c3802);};var _0x24c5fc=function(_0x5bac9a){if(!_0x5bac9a||!_0x5bac9a['rules'][_0x9679('0x34')]){return'';}for(var _0x351a81='(',_0xb2be4d=0x0;_0xb2be4d<_0x5bac9a[_0x9679('0x63')][_0x9679('0x34')];_0xb2be4d+=0x1){_0xb2be4d>0x0&&(_0x351a81+='\x20'+_0x5bac9a[_0x9679('0x64')]+'\x20');_0x351a81+=_0x5bac9a[_0x9679('0x63')][_0xb2be4d]['group']?_0x24c5fc(_0x5bac9a[_0x9679('0x63')][_0xb2be4d][_0x9679('0x65')]):_0x5bac9a['rules'][_0xb2be4d][_0x9679('0x6f')]+'\x20'+_0x5bac9a[_0x9679('0x63')][_0xb2be4d][_0x9679('0x66')]+(_0x1bd4f9(_0x5bac9a[_0x9679('0x63')][_0xb2be4d][_0x9679('0x66')])?'\x20'+_0x5bac9a[_0x9679('0x63')][_0xb2be4d][_0x9679('0x67')]:'');}return _0x351a81+')';};var _0x314415={'where':{'id':_0xb762e4[_0x9679('0x42')]['id']}},_0x1c821b,_0x488877,_0x3e5f08,_0x49b3cf,_0x5e5177;_0x314415=_[_0x9679('0x3b')]({},_0x314415,_0xb762e4[_0x9679('0x3c')]);return db[_0x9679('0x2a')][_0x9679('0x4b')](_0x314415)[_0x9679('0x20')](function(_0x264f31){if(_0x264f31){_0x1c821b=_0x264f31;return _0x264f31[_0x9679('0x68')]();}return null;})[_0x9679('0x20')](function(_0x5d716d){if(_0x5d716d){if(!_0x5d716d[_0x9679('0x34')]){throw new db[(_0x9679('0x84'))][(_0x9679('0x69'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x488877=_0x5d716d;return db['AnalyticMetric'][_0x9679('0x3f')]({'raw':!![]});}return null;})[_0x9679('0x20')](function(_0x46e9c0){if(_0x46e9c0){_0x3e5f08=_[_0x9679('0x85')](_0x46e9c0,'id');var _0x20cb7e;var _0x4cdf49=squel[_0x9679('0x6c')]();_0x4cdf49['from'](_0x1c821b[_0x9679('0x6d')]);for(var _0x3efb6d=0x0;_0x3efb6d<_0x488877[_0x9679('0x34')];_0x3efb6d+=0x1){_0x20cb7e=_0x488877[_0x3efb6d]['MetricId']?_0x3e5f08[_0x488877[_0x3efb6d][_0x9679('0x6e')]][_0x9679('0x87')]:_0x488877[_0x3efb6d][_0x9679('0x6f')];_0x20cb7e=_0x488877[_0x3efb6d][_0x9679('0x70')]?_[_0x9679('0x72')](_0x20bc1c[_0x488877[_0x3efb6d][_0x9679('0x70')]],'%s',_0x20cb7e):_0x20cb7e;_0x20cb7e=_0x488877[_0x3efb6d][_0x9679('0x71')]?_[_0x9679('0x72')](_0x5c8161[_0x488877[_0x3efb6d][_0x9679('0x71')]],'%s',_0x20cb7e):_0x20cb7e;if(_0x488877[_0x3efb6d][_0x9679('0x73')]){_0x4cdf49[_0x9679('0x65')](_0x20cb7e);}_0x488877[_0x3efb6d]['orderBy']&&_0x4cdf49[_0x9679('0x37')](_0x20cb7e,_0x488877[_0x3efb6d]['orderBy']===_0x9679('0x75')?![]:!![]);_0x4cdf49[_0x9679('0x6f')](_0x20cb7e,_0x488877[_0x3efb6d][_0x9679('0x76')]||_0x20cb7e);}if(_0x1c821b[_0x9679('0x77')]){_0x1c821b['joins']=JSON[_0x9679('0x78')](_0x1c821b[_0x9679('0x77')]);for(var _0x474d6e=0x0;_0x474d6e<_0x1c821b['joins'][_0x9679('0x34')];_0x474d6e+=0x1){if(_0x1c821b[_0x9679('0x77')][_0x474d6e][_0x9679('0x2c')]&&_[_0x9679('0x60')](_0x54376e,_0x1c821b[_0x9679('0x77')][_0x474d6e]['type'])&&_0x1c821b['joins'][_0x474d6e][_0x9679('0x79')]&&_0x1c821b[_0x9679('0x77')][_0x474d6e][_0x9679('0x7a')]&&_0x1c821b[_0x9679('0x77')][_0x474d6e][_0x9679('0x7b')]){_0x4cdf49[_0x1c821b[_0x9679('0x77')][_0x474d6e][_0x9679('0x2c')]](_0x1c821b[_0x9679('0x77')][_0x474d6e][_0x9679('0x7a')],null,util['format'](_0x9679('0x88'),_0x1c821b[_0x9679('0x6d')],_0x1c821b[_0x9679('0x77')][_0x474d6e][_0x9679('0x79')],_0x1c821b['joins'][_0x474d6e][_0x9679('0x7a')],_0x1c821b[_0x9679('0x77')][_0x474d6e][_0x9679('0x7b')]));}}}if(_0x1c821b[_0x9679('0x7c')]){_0x1c821b[_0x9679('0x7c')]=JSON[_0x9679('0x78')](_0x1c821b[_0x9679('0x7c')]);_0x4cdf49[_0x9679('0x39')](_0x24c5fc(_0x1c821b[_0x9679('0x7c')]['group']));}_0x5e5177=_0x4cdf49['clone']();_0x4cdf49[_0x9679('0x1a')](_0x236c9d);_0x4cdf49[_0x9679('0x18')](0x0);logger[_0x9679('0x9d')](_0x9679('0x9e'),_0x4cdf49['toString']());return dbH['sequelize']['query'](_0x4cdf49['toString'](),{'type':dbH[_0x9679('0x7d')][_0x9679('0x7f')]['SELECT']});}})[_0x9679('0x20')](function(){return{'sql':_0x5e5177[_0x9679('0x7e')]()};})['then'](respondWithResult(_0x394e66,null))['catch'](handleError(_0x394e66,null));}; \ No newline at end of file +var _0x6e5e=['../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','dbH','status','end','json','offset','undefined','limit','count','set','apply','save','then','destroy','CustomReports','sendStatus','error','stack','name','send','index','map','AnalyticCustomReport','fieldName','type','key','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','model','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Reports','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','SEC_TO_TIME(%s)','DATE(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','from','table','MetricId','metric','function','format','replace','groupBy','orderBy','order','DESC','alias','joins','parse','%s.%s\x20=\x20%s.%s','parentKey','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','left_join','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','HOUR(%s)','value','includes','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','child_process','fork','../../components/export/','../../files/reports','savename','run','runReport','getFields','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x6e5e,0x1de));var _0xe6e5=function(_0xb5a00f,_0x1e969e){_0xb5a00f=_0xb5a00f-0x0;var _0x484f5a=_0x6e5e[_0xb5a00f];return _0x484f5a;};'use strict';var emlformat=require(_0xe6e5('0x0'));var rimraf=require(_0xe6e5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe6e5('0x2'));var rp=require('request-promise');var moment=require(_0xe6e5('0x3'));var BPromise=require(_0xe6e5('0x4'));var Mustache=require('mustache');var util=require(_0xe6e5('0x5'));var path=require(_0xe6e5('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xe6e5('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe6e5('0x8'));var squel=require(_0xe6e5('0x9'));var crypto=require(_0xe6e5('0xa'));var jsforce=require(_0xe6e5('0xb'));var deskjs=require(_0xe6e5('0xc'));var toCsv=require(_0xe6e5('0xd'));var querystring=require(_0xe6e5('0xe'));var Papa=require('papaparse');var Redis=require(_0xe6e5('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe6e5('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe6e5('0x11'));var logger=require('../../config/logger')(_0xe6e5('0x12'));var utils=require(_0xe6e5('0x13'));var config=require(_0xe6e5('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xe6e5('0x15'))['db'];var dbH=require(_0xe6e5('0x15'))[_0xe6e5('0x16')];function respondWithStatusCode(_0xd3cbb2,_0x1008ac){_0x1008ac=_0x1008ac||0xcc;return function(_0x29faa8){if(_0x29faa8){return _0xd3cbb2['sendStatus'](_0x1008ac);}return _0xd3cbb2[_0xe6e5('0x17')](_0x1008ac)[_0xe6e5('0x18')]();};}function respondWithResult(_0x291e7,_0xa48b79){_0xa48b79=_0xa48b79||0xc8;return function(_0x15e489){if(_0x15e489){return _0x291e7['status'](_0xa48b79)[_0xe6e5('0x19')](_0x15e489);}};}function respondWithFilteredResult(_0x50044e,_0x140efa){return function(_0x552443){if(_0x552443){var _0x2d2ead=typeof _0x140efa[_0xe6e5('0x1a')]===_0xe6e5('0x1b')&&typeof _0x140efa[_0xe6e5('0x1c')]===_0xe6e5('0x1b');var _0x3a2f37=_0x552443[_0xe6e5('0x1d')];var _0x22469d=_0x2d2ead?0x0:_0x140efa[_0xe6e5('0x1a')];var _0x4b3f2c=_0x2d2ead?_0x552443[_0xe6e5('0x1d')]:_0x140efa[_0xe6e5('0x1a')]+_0x140efa[_0xe6e5('0x1c')];var _0x5d2a31;if(_0x4b3f2c>=_0x3a2f37){_0x4b3f2c=_0x3a2f37;_0x5d2a31=0xc8;}else{_0x5d2a31=0xce;}_0x50044e[_0xe6e5('0x17')](_0x5d2a31);return _0x50044e[_0xe6e5('0x1e')]('Content-Range',_0x22469d+'-'+_0x4b3f2c+'/'+_0x3a2f37)[_0xe6e5('0x19')](_0x552443);}return null;};}function patchUpdates(_0x1a2679){return function(_0x460797){try{jsonpatch[_0xe6e5('0x1f')](_0x460797,_0x1a2679,!![]);}catch(_0x44348c){return BPromise['reject'](_0x44348c);}return _0x460797[_0xe6e5('0x20')]();};}function saveUpdates(_0xa11379,_0x1cc133){return function(_0x265f0e){if(_0x265f0e){return _0x265f0e['update'](_0xa11379)[_0xe6e5('0x21')](function(_0x1ca7fd){return _0x1ca7fd;});}return null;};}function removeEntity(_0x5f8aef,_0x56148e){return function(_0x1f45d3){if(_0x1f45d3){return _0x1f45d3[_0xe6e5('0x22')]()[_0xe6e5('0x21')](function(){var _0x35ba28=_0x1f45d3['get']({'plain':!![]});var _0x2fdf60=_0xe6e5('0x23');return db['UserProfileResource'][_0xe6e5('0x22')]({'where':{'type':_0x2fdf60,'resourceId':_0x35ba28['id']}})[_0xe6e5('0x21')](function(){return _0x1f45d3;});})['then'](function(){_0x5f8aef['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x31b4b1,_0x1e998c){return function(_0x444428){if(!_0x444428){_0x31b4b1[_0xe6e5('0x24')](0x194);}return _0x444428;};}function handleError(_0x284d38,_0x42fd1d){_0x42fd1d=_0x42fd1d||0x1f4;return function(_0x4e5083){logger[_0xe6e5('0x25')](_0x4e5083[_0xe6e5('0x26')]);if(_0x4e5083['name']){delete _0x4e5083[_0xe6e5('0x27')];}_0x284d38[_0xe6e5('0x17')](_0x42fd1d)[_0xe6e5('0x28')](_0x4e5083);};}exports[_0xe6e5('0x29')]=function(_0x194405,_0x178930){var _0x3b387b={},_0x2415fa={},_0x3fa1ff={'count':0x0,'rows':[]};var _0x29e51d=_[_0xe6e5('0x2a')](db[_0xe6e5('0x2b')]['rawAttributes'],function(_0x12ac4e){return{'name':_0x12ac4e[_0xe6e5('0x2c')],'type':_0x12ac4e[_0xe6e5('0x2d')][_0xe6e5('0x2e')]};});_0x2415fa['model']=_[_0xe6e5('0x2a')](_0x29e51d,'name');_0x2415fa[_0xe6e5('0x2f')]=_[_0xe6e5('0x30')](_0x194405[_0xe6e5('0x2f')]);_0x2415fa['filters']=_[_0xe6e5('0x31')](_0x2415fa['model'],_0x2415fa[_0xe6e5('0x2f')]);_0x3b387b[_0xe6e5('0x32')]=_['intersection'](_0x2415fa['model'],qs['fields'](_0x194405['query'][_0xe6e5('0x33')]));_0x3b387b['attributes']=_0x3b387b[_0xe6e5('0x32')][_0xe6e5('0x34')]?_0x3b387b['attributes']:_0x2415fa['model'];if(!_0x194405['query'][_0xe6e5('0x35')](_0xe6e5('0x36'))){_0x3b387b['limit']=qs[_0xe6e5('0x1c')](_0x194405[_0xe6e5('0x2f')][_0xe6e5('0x1c')]);_0x3b387b[_0xe6e5('0x1a')]=qs['offset'](_0x194405[_0xe6e5('0x2f')][_0xe6e5('0x1a')]);}_0x3b387b['order']=qs[_0xe6e5('0x37')](_0x194405[_0xe6e5('0x2f')][_0xe6e5('0x37')]);_0x3b387b[_0xe6e5('0x38')]=qs[_0xe6e5('0x39')](_[_0xe6e5('0x3a')](_0x194405[_0xe6e5('0x2f')],_0x2415fa[_0xe6e5('0x39')]),_0x29e51d);if(_0x194405[_0xe6e5('0x2f')][_0xe6e5('0x3b')]){_0x3b387b['where']=_[_0xe6e5('0x3c')](_0x3b387b[_0xe6e5('0x38')],{'$or':_[_0xe6e5('0x2a')](_0x29e51d,function(_0x2217e8){if(_0x2217e8['type']!==_0xe6e5('0x3d')){var _0x2830fb={};_0x2830fb[_0x2217e8[_0xe6e5('0x27')]]={'$like':'%'+_0x194405[_0xe6e5('0x2f')]['filter']+'%'};return _0x2830fb;}})});}_0x3b387b=_[_0xe6e5('0x3c')]({},_0x3b387b,_0x194405[_0xe6e5('0x3e')]);var _0xfe66c9={'where':_0x3b387b[_0xe6e5('0x38')]};return db[_0xe6e5('0x2b')]['count'](_0xfe66c9)[_0xe6e5('0x21')](function(_0x457a64){_0x3fa1ff[_0xe6e5('0x1d')]=_0x457a64;if(_0x194405[_0xe6e5('0x2f')][_0xe6e5('0x3f')]){_0x3b387b[_0xe6e5('0x40')]=[{'all':!![]}];}return db[_0xe6e5('0x2b')][_0xe6e5('0x41')](_0x3b387b);})[_0xe6e5('0x21')](function(_0x559dd5){_0x3fa1ff[_0xe6e5('0x42')]=_0x559dd5;return _0x3fa1ff;})['then'](respondWithFilteredResult(_0x178930,_0x3b387b))[_0xe6e5('0x43')](handleError(_0x178930,null));};exports[_0xe6e5('0x44')]=function(_0x48e65e,_0x34367e){var _0x55b6fb={'raw':![],'where':{'id':_0x48e65e[_0xe6e5('0x45')]['id']}},_0x464d24={};_0x464d24[_0xe6e5('0x46')]=_[_0xe6e5('0x30')](db[_0xe6e5('0x2b')]['rawAttributes']);_0x464d24[_0xe6e5('0x2f')]=_[_0xe6e5('0x30')](_0x48e65e[_0xe6e5('0x2f')]);_0x464d24['filters']=_[_0xe6e5('0x31')](_0x464d24[_0xe6e5('0x46')],_0x464d24['query']);_0x55b6fb[_0xe6e5('0x32')]=_[_0xe6e5('0x31')](_0x464d24['model'],qs['fields'](_0x48e65e[_0xe6e5('0x2f')][_0xe6e5('0x33')]));_0x55b6fb['attributes']=_0x55b6fb['attributes'][_0xe6e5('0x34')]?_0x55b6fb[_0xe6e5('0x32')]:_0x464d24[_0xe6e5('0x46')];if(_0x48e65e[_0xe6e5('0x2f')]['includeAll']){_0x55b6fb['include']=[{'all':!![]}];}_0x55b6fb=_[_0xe6e5('0x3c')]({},_0x55b6fb,_0x48e65e['options']);return db[_0xe6e5('0x2b')][_0xe6e5('0x47')](_0x55b6fb)[_0xe6e5('0x21')](handleEntityNotFound(_0x34367e,null))[_0xe6e5('0x21')](respondWithResult(_0x34367e,null))[_0xe6e5('0x43')](handleError(_0x34367e,null));};exports[_0xe6e5('0x48')]=function(_0x1a3405,_0x15e2ac){return db[_0xe6e5('0x2b')]['create'](_0x1a3405[_0xe6e5('0x49')],{})[_0xe6e5('0x21')](function(_0x456597){var _0x1cbe9f=_0x1a3405[_0xe6e5('0x4a')][_0xe6e5('0x4b')]({'plain':!![]});if(!_0x1cbe9f)throw new Error(_0xe6e5('0x4c'));if(_0x1cbe9f[_0xe6e5('0x4d')]==='user'){var _0x2e5428=_0x456597[_0xe6e5('0x4b')]({'plain':!![]});var _0x3bc216=_0xe6e5('0x4e');return db[_0xe6e5('0x4f')]['find']({'where':{'name':_0x3bc216,'userProfileId':_0x1cbe9f[_0xe6e5('0x50')]},'raw':!![]})['then'](function(_0x53b0ee){if(_0x53b0ee&&_0x53b0ee['autoAssociation']===0x0){return db['UserProfileResource'][_0xe6e5('0x48')]({'name':_0x2e5428['name'],'resourceId':_0x2e5428['id'],'type':'CustomReports','sectionId':_0x53b0ee['id']},{})[_0xe6e5('0x21')](function(){return _0x456597;});}else{return _0x456597;}})['catch'](function(_0x814dea){logger['error'](_0xe6e5('0x51'),_0x814dea);throw _0x814dea;});}return _0x456597;})[_0xe6e5('0x21')](respondWithResult(_0x15e2ac,0xc9))[_0xe6e5('0x43')](handleError(_0x15e2ac,null));};exports[_0xe6e5('0x52')]=function(_0xb355b2,_0x28df5e){if(_0xb355b2[_0xe6e5('0x49')]['id']){delete _0xb355b2[_0xe6e5('0x49')]['id'];}return db[_0xe6e5('0x2b')][_0xe6e5('0x47')]({'where':{'id':_0xb355b2[_0xe6e5('0x45')]['id']}})['then'](handleEntityNotFound(_0x28df5e,null))[_0xe6e5('0x21')](saveUpdates(_0xb355b2[_0xe6e5('0x49')],null))[_0xe6e5('0x21')](respondWithResult(_0x28df5e,null))['catch'](handleError(_0x28df5e,null));};exports[_0xe6e5('0x22')]=function(_0x126201,_0x5c89c5){return db[_0xe6e5('0x2b')]['find']({'where':{'id':_0x126201['params']['id']}})[_0xe6e5('0x21')](handleEntityNotFound(_0x5c89c5,null))['then'](removeEntity(_0x5c89c5,null))[_0xe6e5('0x43')](handleError(_0x5c89c5,null));};exports[_0xe6e5('0x53')]=function(_0xfecd9e,_0x32f710){var _0x13b252=0xa;var _0x1238dc=[_0xe6e5('0x54'),'left_join',_0xe6e5('0x55'),_0xe6e5('0x56')];var _0x4f9a1b={'SUM':_0xe6e5('0x57'),'COUNT':_0xe6e5('0x58'),'COUNT DISTINCT':_0xe6e5('0x59'),'MAX':_0xe6e5('0x5a'),'MIN':_0xe6e5('0x5b'),'AVG':_0xe6e5('0x5c'),'GROUP_CONCAT':_0xe6e5('0x5d'),'GROUP_CONCAT ASC':_0xe6e5('0x5e'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x50bd90={'SEC_TO_TIME':_0xe6e5('0x5f'),'DATE':_0xe6e5('0x60'),'HOUR':'HOUR(%s)','ROUND':_0xe6e5('0x61'),'UNIX_TIMESTAMP':_0xe6e5('0x62')};var _0x54eca1=function(_0x1c5496){return!_['includes']([_0xe6e5('0x63'),_0xe6e5('0x64'),_0xe6e5('0x65'),_0xe6e5('0x66')],_0x1c5496);};var _0xfce9e4=function(_0x460b39){if(!_0x460b39||!_0x460b39['rules'][_0xe6e5('0x34')]){return'';}for(var _0xae421b='(',_0x34d778=0x0;_0x34d778<_0x460b39['rules'][_0xe6e5('0x34')];_0x34d778+=0x1){_0x34d778>0x0&&(_0xae421b+='\x20'+_0x460b39[_0xe6e5('0x67')]+'\x20');_0xae421b+=_0x460b39[_0xe6e5('0x68')][_0x34d778][_0xe6e5('0x69')]?_0xfce9e4(_0x460b39['rules'][_0x34d778][_0xe6e5('0x69')]):_0x460b39[_0xe6e5('0x68')][_0x34d778][_0xe6e5('0x6a')]+'\x20'+_0x460b39[_0xe6e5('0x68')][_0x34d778][_0xe6e5('0x6b')]+(_0x54eca1(_0x460b39[_0xe6e5('0x68')][_0x34d778][_0xe6e5('0x6b')])?'\x20'+_0x460b39[_0xe6e5('0x68')][_0x34d778]['value']:'');}return _0xae421b+')';};var _0x3e4d91={'where':{'id':_0xfecd9e['params']['id']}},_0x1d2890,_0x4426c9,_0x8f624,_0x1dc0fb,_0x2ab243;_0x3e4d91=_[_0xe6e5('0x3c')]({},_0x3e4d91,_0xfecd9e['options']);return db['AnalyticCustomReport'][_0xe6e5('0x47')](_0x3e4d91)['then'](function(_0x4e164e){if(_0x4e164e){_0x1d2890=_0x4e164e;return _0x4e164e['getFields']();}return null;})[_0xe6e5('0x21')](function(_0x26d5cd){if(_0x26d5cd){if(!_0x26d5cd['length']){throw new db[(_0xe6e5('0x6c'))][(_0xe6e5('0x6d'))](_0xe6e5('0x6e'),0x193);}_0x4426c9=_0x26d5cd;return db[_0xe6e5('0x6f')][_0xe6e5('0x41')]({'raw':!![]});}return null;})[_0xe6e5('0x21')](function(_0xf9c61){if(_0xf9c61){_0x8f624=_[_0xe6e5('0x70')](_0xf9c61,'id');var _0x3822aa;var _0x179de7=squel[_0xe6e5('0x71')]();_0x179de7[_0xe6e5('0x72')](_0x1d2890[_0xe6e5('0x73')]);for(var _0x2f3f72=0x0;_0x2f3f72<_0x4426c9['length'];_0x2f3f72+=0x1){_0x3822aa=_0x4426c9[_0x2f3f72]['MetricId']?_0x8f624[_0x4426c9[_0x2f3f72][_0xe6e5('0x74')]][_0xe6e5('0x75')]:_0x4426c9[_0x2f3f72][_0xe6e5('0x6a')];_0x3822aa=_0x4426c9[_0x2f3f72][_0xe6e5('0x76')]?_['replace'](_0x4f9a1b[_0x4426c9[_0x2f3f72][_0xe6e5('0x76')]],'%s',_0x3822aa):_0x3822aa;_0x3822aa=_0x4426c9[_0x2f3f72][_0xe6e5('0x77')]?_[_0xe6e5('0x78')](_0x50bd90[_0x4426c9[_0x2f3f72][_0xe6e5('0x77')]],'%s',_0x3822aa):_0x3822aa;if(_0x4426c9[_0x2f3f72][_0xe6e5('0x79')]){_0x179de7['group'](_0x3822aa);}_0x4426c9[_0x2f3f72][_0xe6e5('0x7a')]&&_0x179de7[_0xe6e5('0x7b')](_0x3822aa,_0x4426c9[_0x2f3f72][_0xe6e5('0x7a')]===_0xe6e5('0x7c')?![]:!![]);_0x179de7[_0xe6e5('0x6a')](_0x3822aa,_0x4426c9[_0x2f3f72][_0xe6e5('0x7d')]||_0x3822aa);}if(_0x1d2890['joins']){_0x1d2890[_0xe6e5('0x7e')]=JSON[_0xe6e5('0x7f')](_0x1d2890['joins']);for(var _0x4f5317=0x0;_0x4f5317<_0x1d2890['joins'][_0xe6e5('0x34')];_0x4f5317+=0x1){if(_0x1d2890[_0xe6e5('0x7e')][_0x4f5317]['type']&&_['includes'](_0x1238dc,_0x1d2890[_0xe6e5('0x7e')][_0x4f5317][_0xe6e5('0x2d')])&&_0x1d2890[_0xe6e5('0x7e')][_0x4f5317]['parentKey']&&_0x1d2890[_0xe6e5('0x7e')][_0x4f5317]['foreignTable']&&_0x1d2890['joins'][_0x4f5317]['foreignKey']){_0x179de7[_0x1d2890[_0xe6e5('0x7e')][_0x4f5317][_0xe6e5('0x2d')]](_0x1d2890[_0xe6e5('0x7e')][_0x4f5317]['foreignTable'],null,util['format'](_0xe6e5('0x80'),_0x1d2890['table'],_0x1d2890[_0xe6e5('0x7e')][_0x4f5317][_0xe6e5('0x81')],_0x1d2890['joins'][_0x4f5317][_0xe6e5('0x82')],_0x1d2890['joins'][_0x4f5317]['foreignKey']));}}}if(_0x1d2890[_0xe6e5('0x83')]){_0x1d2890['conditions']=JSON[_0xe6e5('0x7f')](_0x1d2890['conditions']);_0x179de7[_0xe6e5('0x38')](_0xfce9e4(_0x1d2890['conditions'][_0xe6e5('0x69')]));}_0x2ab243=_0x179de7[_0xe6e5('0x84')]();_0x179de7[_0xe6e5('0x1c')](_0x13b252);_0x179de7[_0xe6e5('0x1a')](0x0);logger[_0xe6e5('0x85')](_0xe6e5('0x86'),_0x179de7[_0xe6e5('0x87')]());return dbH['sequelize'][_0xe6e5('0x2f')](_0x179de7['toString'](),{'type':dbH[_0xe6e5('0x88')][_0xe6e5('0x89')][_0xe6e5('0x8a')]});}})[_0xe6e5('0x21')](respondWithResult(_0x32f710,null))[_0xe6e5('0x43')](handleError(_0x32f710,null));};function runReport(_0x58b91b,_0x4b8d9a,_0x256934){var _0x40ab6d=_0x4b8d9a[_0xe6e5('0x27')];var _0x33240e=0xa;var _0x677854=['join',_0xe6e5('0x8b'),_0xe6e5('0x55'),_0xe6e5('0x56')];var _0x126410={'SUM':_0xe6e5('0x57'),'COUNT':_0xe6e5('0x58'),'COUNT DISTINCT':_0xe6e5('0x59'),'MAX':_0xe6e5('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xe6e5('0x5e'),'GROUP_CONCAT DESC':_0xe6e5('0x8c')};var _0x2ae5d3={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe6e5('0x60'),'HOUR':_0xe6e5('0x8d'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xe6e5('0x62')};var _0x56f143=function(_0x1eb385){return!_['includes']([_0xe6e5('0x63'),_0xe6e5('0x64'),'IS\x20EMPTY','IS\x20NOT\x20EMPTY'],_0x1eb385);};var _0x594987=function(_0x196b49){if(!_0x196b49||!_0x196b49[_0xe6e5('0x68')]['length']){return'';}for(var _0x133f6b='(',_0x2d9f82=0x0;_0x2d9f82<_0x196b49['rules']['length'];_0x2d9f82+=0x1){_0x2d9f82>0x0&&(_0x133f6b+='\x20'+_0x196b49[_0xe6e5('0x67')]+'\x20');_0x133f6b+=_0x196b49[_0xe6e5('0x68')][_0x2d9f82][_0xe6e5('0x69')]?_0x594987(_0x196b49['rules'][_0x2d9f82][_0xe6e5('0x69')]):_0x196b49[_0xe6e5('0x68')][_0x2d9f82][_0xe6e5('0x6a')]+'\x20'+_0x196b49[_0xe6e5('0x68')][_0x2d9f82]['condition']+(_0x56f143(_0x196b49[_0xe6e5('0x68')][_0x2d9f82][_0xe6e5('0x6b')])?'\x20'+_0x196b49[_0xe6e5('0x68')][_0x2d9f82][_0xe6e5('0x8e')]:'');}return _0x133f6b+')';};var _0x348daf={'where':{'id':_0x58b91b['id']}},_0x34e09c,_0x129ae2,_0x12e3db,_0xbeadb3,_0x31bba8;_0x348daf=_[_0xe6e5('0x3c')]({},_0x348daf,_0x256934);return db[_0xe6e5('0x2b')][_0xe6e5('0x47')](_0x348daf)[_0xe6e5('0x21')](function(_0x5f1970){if(_0x5f1970){_0x34e09c=_0x5f1970;return _0x5f1970['getFields']();}return null;})['then'](function(_0x4611dd){if(_0x4611dd){if(!_0x4611dd[_0xe6e5('0x34')]){throw new db[(_0xe6e5('0x6c'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x129ae2=_0x4611dd;return db[_0xe6e5('0x6f')][_0xe6e5('0x41')]({'raw':!![]});}return null;})[_0xe6e5('0x21')](function(_0x4678ce){if(_0x4678ce){_0x12e3db=_[_0xe6e5('0x70')](_0x4678ce,'id');var _0x5dce79;var _0x183d52=squel[_0xe6e5('0x71')]();_0x183d52[_0xe6e5('0x72')](_0x34e09c[_0xe6e5('0x73')]);for(var _0x39d333=0x0;_0x39d333<_0x129ae2[_0xe6e5('0x34')];_0x39d333+=0x1){_0x5dce79=_0x129ae2[_0x39d333][_0xe6e5('0x74')]?_0x12e3db[_0x129ae2[_0x39d333]['MetricId']][_0xe6e5('0x75')]:_0x129ae2[_0x39d333][_0xe6e5('0x6a')];_0x5dce79=_0x129ae2[_0x39d333][_0xe6e5('0x76')]?_['replace'](_0x126410[_0x129ae2[_0x39d333][_0xe6e5('0x76')]],'%s',_0x5dce79):_0x5dce79;_0x5dce79=_0x129ae2[_0x39d333][_0xe6e5('0x77')]?_[_0xe6e5('0x78')](_0x2ae5d3[_0x129ae2[_0x39d333][_0xe6e5('0x77')]],'%s',_0x5dce79):_0x5dce79;if(_0x129ae2[_0x39d333][_0xe6e5('0x79')]){_0x183d52[_0xe6e5('0x69')](_0x5dce79);}_0x129ae2[_0x39d333][_0xe6e5('0x7a')]&&_0x183d52['order'](_0x5dce79,_0x129ae2[_0x39d333][_0xe6e5('0x7a')]==='DESC'?![]:!![]);_0x183d52['field'](_0x5dce79,_0x129ae2[_0x39d333]['alias']||_0x5dce79);}if(_0x34e09c[_0xe6e5('0x7e')]){_0x34e09c[_0xe6e5('0x7e')]=JSON[_0xe6e5('0x7f')](_0x34e09c[_0xe6e5('0x7e')]);for(var _0x396f2a=0x0;_0x396f2a<_0x34e09c[_0xe6e5('0x7e')][_0xe6e5('0x34')];_0x396f2a+=0x1){if(_0x34e09c[_0xe6e5('0x7e')][_0x396f2a][_0xe6e5('0x2d')]&&_[_0xe6e5('0x8f')](_0x677854,_0x34e09c[_0xe6e5('0x7e')][_0x396f2a][_0xe6e5('0x2d')])&&_0x34e09c[_0xe6e5('0x7e')][_0x396f2a][_0xe6e5('0x81')]&&_0x34e09c[_0xe6e5('0x7e')][_0x396f2a]['foreignTable']&&_0x34e09c[_0xe6e5('0x7e')][_0x396f2a]['foreignKey']){_0x183d52[_0x34e09c['joins'][_0x396f2a]['type']](_0x34e09c[_0xe6e5('0x7e')][_0x396f2a][_0xe6e5('0x82')],null,util[_0xe6e5('0x77')]('%s.%s\x20=\x20%s.%s',_0x34e09c[_0xe6e5('0x73')],_0x34e09c[_0xe6e5('0x7e')][_0x396f2a]['parentKey'],_0x34e09c[_0xe6e5('0x7e')][_0x396f2a][_0xe6e5('0x82')],_0x34e09c['joins'][_0x396f2a][_0xe6e5('0x90')]));}}}if(_0x34e09c[_0xe6e5('0x83')]){_0x34e09c[_0xe6e5('0x83')]=JSON[_0xe6e5('0x7f')](_0x34e09c['conditions']);_0x183d52[_0xe6e5('0x38')](_0x594987(_0x34e09c[_0xe6e5('0x83')][_0xe6e5('0x69')]));}_0x31bba8=_0x183d52[_0xe6e5('0x84')]();_0x183d52[_0xe6e5('0x1c')](_0x33240e);_0x183d52[_0xe6e5('0x1a')](0x0);return;}})[_0xe6e5('0x21')](function(){if(_0x4b8d9a[_0xe6e5('0x91')]==='web'){return null;}var _0x919d57=_[_0xe6e5('0x3c')](_0x4b8d9a,{'name':_0x4b8d9a[_0xe6e5('0x92')]||_0x4b8d9a[_0xe6e5('0x27')]||_0x34e09c[_0xe6e5('0x27')],'basename':_0x40ab6d,'savename':util[_0xe6e5('0x77')](_0xe6e5('0x93'),_0x4b8d9a[_0xe6e5('0x27')]||_0x34e09c[_0xe6e5('0x27')],require(_0xe6e5('0x94'))[_0xe6e5('0x95')](0x4),_0x4b8d9a[_0xe6e5('0x91')]||_0xe6e5('0x96')),'reportId':_0x34e09c['id'],'reportType':_0xe6e5('0x97')});return db[_0xe6e5('0x98')][_0xe6e5('0x48')](_0x919d57,{'raw':!![]});})['then'](function(_0x12583d){if(_0x34e09c[_0xe6e5('0x73')]==='cdr'){_0x31bba8[_0xe6e5('0x38')](_0x34e09c[_0xe6e5('0x73')]+_0xe6e5('0x99'),_0x4b8d9a['startDate'],_0x4b8d9a['endDate']);}else{_0x31bba8[_0xe6e5('0x38')](_0x34e09c[_0xe6e5('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4b8d9a[_0xe6e5('0x9a')],_0x4b8d9a[_0xe6e5('0x9b')]);}if(_0x12583d){logger[_0xe6e5('0x9c')]('Run\x20Query:',_0x31bba8[_0xe6e5('0x87')]());require(_0xe6e5('0x9d'))[_0xe6e5('0x9e')](path['join'](__dirname,_0xe6e5('0x9f'),_0x12583d[_0xe6e5('0x91')]),[_0x12583d['id'],_0x31bba8[_0xe6e5('0x87')](),path[_0xe6e5('0x54')](__dirname,_0xe6e5('0xa0'),_0x12583d[_0xe6e5('0xa1')]),_0x40ab6d]);return _0x12583d;}else{var _0x21bd5a=squel[_0xe6e5('0x71')]();_0x21bd5a['from']('('+_0x31bba8[_0xe6e5('0x87')]()+')','countTable');_0x21bd5a[_0xe6e5('0x6a')]('COUNT(*)','count');_0x31bba8[_0xe6e5('0x1c')](_0x4b8d9a['limit']||_0x33240e);_0x31bba8[_0xe6e5('0x1a')](_0x4b8d9a[_0xe6e5('0x1a')]||0x0);return dbH[_0xe6e5('0x88')]['query'](_0x21bd5a['toString'](),{'type':dbH[_0xe6e5('0x88')]['QueryTypes'][_0xe6e5('0x8a')]})[_0xe6e5('0x21')](function(_0x1c9567){if(!_0x1c9567['length']){_0xbeadb3=0x0;}else{_0xbeadb3=_0x1c9567[0x0][_0xe6e5('0x1d')]||0x0;}return dbH[_0xe6e5('0x88')][_0xe6e5('0x2f')](_0x31bba8[_0xe6e5('0x87')](),{'type':dbH['sequelize']['QueryTypes'][_0xe6e5('0x8a')]});})[_0xe6e5('0x21')](function(_0x3645aa){return{'rows':_0x3645aa||[],'count':_0xbeadb3};});}});}exports[_0xe6e5('0xa2')]=function(_0x22cb43,_0x5b01b6){return runReport(_0x22cb43['params'],_0x22cb43[_0xe6e5('0x2f')],_0x22cb43[_0xe6e5('0x3e')])[_0xe6e5('0x21')](respondWithResult(_0x5b01b6,null))[_0xe6e5('0x43')](handleError(_0x5b01b6,null));};exports[_0xe6e5('0xa3')]=runReport;exports['query']=function(_0x23716d,_0x2fa103){var _0x218075=0xa;var _0x2b23e8=[_0xe6e5('0x54'),'left_join',_0xe6e5('0x55'),_0xe6e5('0x56')];var _0x4f86ec={'SUM':_0xe6e5('0x57'),'COUNT':_0xe6e5('0x58'),'COUNT DISTINCT':_0xe6e5('0x59'),'MAX':_0xe6e5('0x5a'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xe6e5('0x5d'),'GROUP_CONCAT ASC':_0xe6e5('0x5e'),'GROUP_CONCAT DESC':_0xe6e5('0x8c')};var _0x4a8a85={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0xe6e5('0x60'),'HOUR':_0xe6e5('0x8d'),'ROUND':_0xe6e5('0x61'),'UNIX_TIMESTAMP':_0xe6e5('0x62')};var _0x18e674=function(_0x1e9584){return!_[_0xe6e5('0x8f')]([_0xe6e5('0x63'),'IS\x20NOT\x20NULL',_0xe6e5('0x65'),_0xe6e5('0x66')],_0x1e9584);};var _0x34c9ce=function(_0x2ad677){if(!_0x2ad677||!_0x2ad677[_0xe6e5('0x68')][_0xe6e5('0x34')]){return'';}for(var _0x584d19='(',_0x177b68=0x0;_0x177b68<_0x2ad677['rules'][_0xe6e5('0x34')];_0x177b68+=0x1){_0x177b68>0x0&&(_0x584d19+='\x20'+_0x2ad677[_0xe6e5('0x67')]+'\x20');_0x584d19+=_0x2ad677[_0xe6e5('0x68')][_0x177b68][_0xe6e5('0x69')]?_0x34c9ce(_0x2ad677[_0xe6e5('0x68')][_0x177b68][_0xe6e5('0x69')]):_0x2ad677[_0xe6e5('0x68')][_0x177b68]['field']+'\x20'+_0x2ad677[_0xe6e5('0x68')][_0x177b68][_0xe6e5('0x6b')]+(_0x18e674(_0x2ad677[_0xe6e5('0x68')][_0x177b68][_0xe6e5('0x6b')])?'\x20'+_0x2ad677[_0xe6e5('0x68')][_0x177b68][_0xe6e5('0x8e')]:'');}return _0x584d19+')';};var _0x442036={'where':{'id':_0x23716d['params']['id']}},_0x58de9d,_0x4d1148,_0x8e471f,_0x5723a5,_0x3a357a;_0x442036=_['merge']({},_0x442036,_0x23716d['options']);return db[_0xe6e5('0x2b')][_0xe6e5('0x47')](_0x442036)[_0xe6e5('0x21')](function(_0x59fcf8){if(_0x59fcf8){_0x58de9d=_0x59fcf8;return _0x59fcf8[_0xe6e5('0xa4')]();}return null;})[_0xe6e5('0x21')](function(_0x2abbef){if(_0x2abbef){if(!_0x2abbef[_0xe6e5('0x34')]){throw new db[(_0xe6e5('0x6c'))][(_0xe6e5('0x6d'))](_0xe6e5('0x6e'),0x193);}_0x4d1148=_0x2abbef;return db['AnalyticMetric'][_0xe6e5('0x41')]({'raw':!![]});}return null;})[_0xe6e5('0x21')](function(_0x572ebe){if(_0x572ebe){_0x8e471f=_[_0xe6e5('0x70')](_0x572ebe,'id');var _0x3f270f;var _0x3cbdf5=squel[_0xe6e5('0x71')]();_0x3cbdf5[_0xe6e5('0x72')](_0x58de9d[_0xe6e5('0x73')]);for(var _0xa1ff58=0x0;_0xa1ff58<_0x4d1148[_0xe6e5('0x34')];_0xa1ff58+=0x1){_0x3f270f=_0x4d1148[_0xa1ff58][_0xe6e5('0x74')]?_0x8e471f[_0x4d1148[_0xa1ff58][_0xe6e5('0x74')]]['metric']:_0x4d1148[_0xa1ff58]['field'];_0x3f270f=_0x4d1148[_0xa1ff58][_0xe6e5('0x76')]?_[_0xe6e5('0x78')](_0x4f86ec[_0x4d1148[_0xa1ff58][_0xe6e5('0x76')]],'%s',_0x3f270f):_0x3f270f;_0x3f270f=_0x4d1148[_0xa1ff58]['format']?_[_0xe6e5('0x78')](_0x4a8a85[_0x4d1148[_0xa1ff58]['format']],'%s',_0x3f270f):_0x3f270f;if(_0x4d1148[_0xa1ff58]['groupBy']){_0x3cbdf5[_0xe6e5('0x69')](_0x3f270f);}_0x4d1148[_0xa1ff58][_0xe6e5('0x7a')]&&_0x3cbdf5[_0xe6e5('0x7b')](_0x3f270f,_0x4d1148[_0xa1ff58][_0xe6e5('0x7a')]===_0xe6e5('0x7c')?![]:!![]);_0x3cbdf5[_0xe6e5('0x6a')](_0x3f270f,_0x4d1148[_0xa1ff58][_0xe6e5('0x7d')]||_0x3f270f);}if(_0x58de9d[_0xe6e5('0x7e')]){_0x58de9d[_0xe6e5('0x7e')]=JSON[_0xe6e5('0x7f')](_0x58de9d[_0xe6e5('0x7e')]);for(var _0x58afe7=0x0;_0x58afe7<_0x58de9d[_0xe6e5('0x7e')][_0xe6e5('0x34')];_0x58afe7+=0x1){if(_0x58de9d['joins'][_0x58afe7][_0xe6e5('0x2d')]&&_[_0xe6e5('0x8f')](_0x2b23e8,_0x58de9d[_0xe6e5('0x7e')][_0x58afe7][_0xe6e5('0x2d')])&&_0x58de9d[_0xe6e5('0x7e')][_0x58afe7][_0xe6e5('0x81')]&&_0x58de9d[_0xe6e5('0x7e')][_0x58afe7][_0xe6e5('0x82')]&&_0x58de9d[_0xe6e5('0x7e')][_0x58afe7][_0xe6e5('0x90')]){_0x3cbdf5[_0x58de9d[_0xe6e5('0x7e')][_0x58afe7][_0xe6e5('0x2d')]](_0x58de9d[_0xe6e5('0x7e')][_0x58afe7][_0xe6e5('0x82')],null,util[_0xe6e5('0x77')]('%s.%s\x20=\x20%s.%s',_0x58de9d[_0xe6e5('0x73')],_0x58de9d[_0xe6e5('0x7e')][_0x58afe7]['parentKey'],_0x58de9d[_0xe6e5('0x7e')][_0x58afe7][_0xe6e5('0x82')],_0x58de9d[_0xe6e5('0x7e')][_0x58afe7][_0xe6e5('0x90')]));}}}if(_0x58de9d[_0xe6e5('0x83')]){_0x58de9d[_0xe6e5('0x83')]=JSON[_0xe6e5('0x7f')](_0x58de9d[_0xe6e5('0x83')]);_0x3cbdf5[_0xe6e5('0x38')](_0x34c9ce(_0x58de9d[_0xe6e5('0x83')][_0xe6e5('0x69')]));}_0x3a357a=_0x3cbdf5[_0xe6e5('0x84')]();_0x3cbdf5[_0xe6e5('0x1c')](_0x218075);_0x3cbdf5[_0xe6e5('0x1a')](0x0);logger[_0xe6e5('0x85')](_0xe6e5('0x86'),_0x3cbdf5[_0xe6e5('0x87')]());return dbH[_0xe6e5('0x88')]['query'](_0x3cbdf5[_0xe6e5('0x87')](),{'type':dbH[_0xe6e5('0x88')][_0xe6e5('0x89')]['SELECT']});}})[_0xe6e5('0x21')](function(){return{'sql':_0x3a357a['toString']()};})[_0xe6e5('0x21')](respondWithResult(_0x2fa103,null))[_0xe6e5('0x43')](handleError(_0x2fa103,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index 44afa8b..2d5a04e 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 _0xddb4=['AnalyticCustomReport','analytics_custom_reports','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticCustomReport.attributes','exports','define'];(function(_0xce93c,_0x555be5){var _0x230720=function(_0x6d5428){while(--_0x6d5428){_0xce93c['push'](_0xce93c['shift']());}};_0x230720(++_0x555be5);}(_0xddb4,0x106));var _0x4ddb=function(_0x3a13cf,_0x478c62){_0x3a13cf=_0x3a13cf-0x0;var _0x4817c=_0xddb4[_0x3a13cf];return _0x4817c;};'use strict';var _=require(_0x4ddb('0x0'));var util=require('util');var logger=require(_0x4ddb('0x1'))(_0x4ddb('0x2'));var moment=require(_0x4ddb('0x3'));var BPromise=require(_0x4ddb('0x4'));var rp=require(_0x4ddb('0x5'));var fs=require('fs');var path=require(_0x4ddb('0x6'));var rimraf=require('rimraf');var config=require(_0x4ddb('0x7'));var attributes=require(_0x4ddb('0x8'));module[_0x4ddb('0x9')]=function(_0x16ec50,_0x27fc82){return _0x16ec50[_0x4ddb('0xa')](_0x4ddb('0xb'),attributes,{'tableName':_0x4ddb('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3363=['exports','define','AnalyticCustomReport','analytics_custom_reports','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x70c4c2,_0x59f0d9){var _0x50e714=function(_0x13de50){while(--_0x13de50){_0x70c4c2['push'](_0x70c4c2['shift']());}};_0x50e714(++_0x59f0d9);}(_0x3363,0x156));var _0x3336=function(_0x36e237,_0x2155ea){_0x36e237=_0x36e237-0x0;var _0x1ca569=_0x3363[_0x36e237];return _0x1ca569;};'use strict';var _=require('lodash');var util=require(_0x3336('0x0'));var logger=require(_0x3336('0x1'))(_0x3336('0x2'));var moment=require(_0x3336('0x3'));var BPromise=require(_0x3336('0x4'));var rp=require(_0x3336('0x5'));var fs=require('fs');var path=require(_0x3336('0x6'));var rimraf=require(_0x3336('0x7'));var config=require(_0x3336('0x8'));var attributes=require('./analyticCustomReport.attributes');module[_0x3336('0x9')]=function(_0x8f3601,_0x13199c){return _0x8f3601[_0x3336('0xa')](_0x3336('0xb'),attributes,{'tableName':_0x3336('0xc'),'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 c0494d1..e13c1e0 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 _0xd292=['debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','http','request','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent'];(function(_0x2c9894,_0x5e32f8){var _0x135f0c=function(_0xf1d2d7){while(--_0xf1d2d7){_0x2c9894['push'](_0x2c9894['shift']());}};_0x135f0c(++_0x5e32f8);}(_0xd292,0x8c));var _0x2d29=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd292[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2d29('0x0'));var util=require(_0x2d29('0x1'));var moment=require('moment');var BPromise=require(_0x2d29('0x2'));var rs=require(_0x2d29('0x3'));var fs=require('fs');var Redis=require(_0x2d29('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d29('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2d29('0x6'));var client=jayson['client'][_0x2d29('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x30d2b5,_0x5b3833,_0x5685f7){return new BPromise(function(_0x2c3339,_0x172a56){return client[_0x2d29('0x8')](_0x30d2b5,_0x5685f7)['then'](function(_0x4bad99){logger[_0x2d29('0x9')](_0x2d29('0xa'),_0x5b3833,_0x2d29('0xb'));logger[_0x2d29('0xc')](_0x2d29('0xd'),_0x5b3833,_0x2d29('0xb'),JSON['stringify'](_0x4bad99));if(_0x4bad99[_0x2d29('0xe')]){if(_0x4bad99[_0x2d29('0xe')][_0x2d29('0xf')]===0x1f4){logger[_0x2d29('0xe')](_0x2d29('0xa'),_0x5b3833,_0x4bad99[_0x2d29('0xe')][_0x2d29('0x10')]);return _0x172a56(_0x4bad99[_0x2d29('0xe')][_0x2d29('0x10')]);}logger[_0x2d29('0xe')](_0x2d29('0xa'),_0x5b3833,_0x4bad99[_0x2d29('0xe')][_0x2d29('0x10')]);return _0x2c3339(_0x4bad99[_0x2d29('0xe')][_0x2d29('0x10')]);}else{logger[_0x2d29('0x9')](_0x2d29('0xa'),_0x5b3833,_0x2d29('0xb'));_0x2c3339(_0x4bad99[_0x2d29('0x11')]['message']);}})[_0x2d29('0x12')](function(_0x48d54a){logger['error'](_0x2d29('0xa'),_0x5b3833,_0x48d54a);_0x172a56(_0x48d54a);});});} \ No newline at end of file +var _0x1f18=['AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0xaed13a,_0x22fc01){var _0x524321=function(_0x5d0054){while(--_0x5d0054){_0xaed13a['push'](_0xaed13a['shift']());}};_0x524321(++_0x22fc01);}(_0x1f18,0x130));var _0x81f1=function(_0x40fd79,_0x592340){_0x40fd79=_0x40fd79-0x0;var _0x21e2f6=_0x1f18[_0x40fd79];return _0x21e2f6;};'use strict';var _=require(_0x81f1('0x0'));var util=require(_0x81f1('0x1'));var moment=require(_0x81f1('0x2'));var BPromise=require(_0x81f1('0x3'));var rs=require(_0x81f1('0x4'));var fs=require('fs');var Redis=require(_0x81f1('0x5'));var db=require(_0x81f1('0x6'))['db'];var utils=require(_0x81f1('0x7'));var logger=require(_0x81f1('0x8'))('rpc');var config=require(_0x81f1('0x9'));var jayson=require(_0x81f1('0xa'));var client=jayson[_0x81f1('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4d7577,_0x43a990,_0x5496c2){return new BPromise(function(_0x36c1b0,_0x529015){return client[_0x81f1('0xc')](_0x4d7577,_0x5496c2)[_0x81f1('0xd')](function(_0x279563){logger[_0x81f1('0xe')](_0x81f1('0xf'),_0x43a990,_0x81f1('0x10'));logger[_0x81f1('0x11')](_0x81f1('0x12'),_0x43a990,_0x81f1('0x10'),JSON[_0x81f1('0x13')](_0x279563));if(_0x279563[_0x81f1('0x14')]){if(_0x279563[_0x81f1('0x14')][_0x81f1('0x15')]===0x1f4){logger[_0x81f1('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x43a990,_0x279563['error'][_0x81f1('0x16')]);return _0x529015(_0x279563[_0x81f1('0x14')][_0x81f1('0x16')]);}logger[_0x81f1('0x14')]('AnalyticCustomReport,\x20%s,\x20%s',_0x43a990,_0x279563[_0x81f1('0x14')][_0x81f1('0x16')]);return _0x36c1b0(_0x279563['error']['message']);}else{logger['info'](_0x81f1('0xf'),_0x43a990,_0x81f1('0x10'));_0x36c1b0(_0x279563['result']['message']);}})['catch'](function(_0x590063){logger[_0x81f1('0x14')](_0x81f1('0xf'),_0x43a990,_0x590063);_0x529015(_0x590063);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index becc253..ffbb88e 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 _0xee11=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','index','get','/:id','show','/:id/preview','preview','/:id/run','isAuthenticated','run','query','create','put','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee11,0x1db));var _0x1ee1=function(_0x5e7361,_0x31140d){_0x5e7361=_0x5e7361-0x0;var _0x248a05=_0xee11[_0x5e7361];return _0x248a05;};'use strict';var multer=require(_0x1ee1('0x0'));var util=require(_0x1ee1('0x1'));var path=require(_0x1ee1('0x2'));var timeout=require(_0x1ee1('0x3'));var express=require('express');var router=express[_0x1ee1('0x4')]();var fs_extra=require(_0x1ee1('0x5'));var auth=require(_0x1ee1('0x6'));var interaction=require(_0x1ee1('0x7'));var config=require(_0x1ee1('0x8'));var controller=require('./analyticCustomReport.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x1ee1('0x9')]);router[_0x1ee1('0xa')](_0x1ee1('0xb'),auth['isAuthenticated'](),controller[_0x1ee1('0xc')]);router[_0x1ee1('0xa')](_0x1ee1('0xd'),auth['isAuthenticated'](),controller[_0x1ee1('0xe')]);router[_0x1ee1('0xa')](_0x1ee1('0xf'),auth[_0x1ee1('0x10')](),controller[_0x1ee1('0x11')]);router[_0x1ee1('0xa')]('/:id/query',auth[_0x1ee1('0x10')](),controller[_0x1ee1('0x12')]);router['post']('/',auth[_0x1ee1('0x10')](),controller[_0x1ee1('0x13')]);router[_0x1ee1('0x14')](_0x1ee1('0xb'),auth[_0x1ee1('0x10')](),controller[_0x1ee1('0x15')]);router[_0x1ee1('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x1ee1('0x17')]);module[_0x1ee1('0x18')]=router; \ No newline at end of file +var _0x2b07=['create','put','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','/:id','show','/:id/preview','/:id/run','run','/:id/query','query'];(function(_0x176317,_0x4897b3){var _0xef2759=function(_0x581e2b){while(--_0x581e2b){_0x176317['push'](_0x176317['shift']());}};_0xef2759(++_0x4897b3);}(_0x2b07,0x154));var _0x72b0=function(_0x285c85,_0x132c21){_0x285c85=_0x285c85-0x0;var _0x2f81cd=_0x2b07[_0x285c85];return _0x2f81cd;};'use strict';var multer=require(_0x72b0('0x0'));var util=require(_0x72b0('0x1'));var path=require(_0x72b0('0x2'));var timeout=require('connect-timeout');var express=require(_0x72b0('0x3'));var router=express[_0x72b0('0x4')]();var fs_extra=require(_0x72b0('0x5'));var auth=require(_0x72b0('0x6'));var interaction=require(_0x72b0('0x7'));var config=require(_0x72b0('0x8'));var controller=require(_0x72b0('0x9'));router[_0x72b0('0xa')]('/',auth[_0x72b0('0xb')](),controller[_0x72b0('0xc')]);router[_0x72b0('0xa')](_0x72b0('0xd'),auth[_0x72b0('0xb')](),controller[_0x72b0('0xe')]);router[_0x72b0('0xa')](_0x72b0('0xf'),auth[_0x72b0('0xb')](),controller['preview']);router[_0x72b0('0xa')](_0x72b0('0x10'),auth[_0x72b0('0xb')](),controller[_0x72b0('0x11')]);router[_0x72b0('0xa')](_0x72b0('0x12'),auth[_0x72b0('0xb')](),controller[_0x72b0('0x13')]);router['post']('/',auth[_0x72b0('0xb')](),controller[_0x72b0('0x14')]);router[_0x72b0('0x15')]('/:id',auth[_0x72b0('0xb')](),controller['update']);router[_0x72b0('0x16')](_0x72b0('0xd'),auth[_0x72b0('0xb')](),controller[_0x72b0('0x17')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 0d913d1..19dd794 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 _0xda19=['exports','STRING','TEXT'];(function(_0x17d817,_0x1925be){var _0xaf9fa4=function(_0x39e244){while(--_0x39e244){_0x17d817['push'](_0x17d817['shift']());}};_0xaf9fa4(++_0x1925be);}(_0xda19,0xd5));var _0x9da1=function(_0x222418,_0xe8c3c7){_0x222418=_0x222418-0x0;var _0x408475=_0xda19[_0x222418];return _0x408475;};'use strict';var Sequelize=require('sequelize');module[_0x9da1('0x0')]={'name':{'type':Sequelize[_0x9da1('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x9da1('0x1')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x9da1('0x2')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x24bc89,_0xabf867){var _0x223c30=function(_0x4bd043){while(--_0x4bd043){_0x24bc89['push'](_0x24bc89['shift']());}};_0x223c30(++_0xabf867);}(_0x1883,0xab));var _0x3188=function(_0x452725,_0x21ac31){_0x452725=_0x452725-0x0;var _0x16d15d=_0x1883[_0x452725];return _0x16d15d;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 9c757cb..5585860 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 _0x53ec=['IS\x20NULL','IS\x20NOT\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','value','getFields','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','keyBy','select','from','table','MetricId','metric','function','format','replace','orderBy','DESC','alias','joins','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','parse','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','right_join','SUM(%s)','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s)','HOUR(%s)','ROUND(%s)','condition','Sequelize','groupBy','foreignKey','output','fullPath','%s-%s.%s','randomstring','generate','csv','default','AnalyticExtractedReport','cdr','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','Run\x20Query:','child_process','fork','../../files/reports','savename','countTable','COUNT(*)','SELECT','runReport','cross_join','COUNT(%s)','MIN(%s)','ValidationErrorItem','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','DefaultReports','UserProfileResource','error','stack','name','send','index','map','rawAttributes','key','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','filter','merge','type','include','AnalyticDefaultReport','params','includeAll','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','preview','join','left_join','MAX(%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','includes'];(function(_0x3ee31f,_0x41c88e){var _0x5a7cee=function(_0x310cf3){while(--_0x310cf3){_0x3ee31f['push'](_0x3ee31f['shift']());}};_0x5a7cee(++_0x41c88e);}(_0x53ec,0x192));var _0xc53e=function(_0x251d43,_0xd5a05a){_0x251d43=_0x251d43-0x0;var _0x3d7759=_0x53ec[_0x251d43];return _0x3d7759;};'use strict';var emlformat=require(_0xc53e('0x0'));var rimraf=require(_0xc53e('0x1'));var zipdir=require(_0xc53e('0x2'));var jsonpatch=require(_0xc53e('0x3'));var rp=require(_0xc53e('0x4'));var moment=require(_0xc53e('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc53e('0x6'));var util=require('util');var path=require(_0xc53e('0x7'));var sox=require(_0xc53e('0x8'));var csv=require('to-csv');var ejs=require(_0xc53e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc53e('0xa'));var squel=require(_0xc53e('0xb'));var crypto=require('crypto');var jsforce=require(_0xc53e('0xc'));var deskjs=require(_0xc53e('0xd'));var toCsv=require(_0xc53e('0xe'));var querystring=require(_0xc53e('0xf'));var Papa=require(_0xc53e('0x10'));var Redis=require(_0xc53e('0x11'));var authService=require(_0xc53e('0x12'));var qs=require(_0xc53e('0x13'));var as=require(_0xc53e('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xc53e('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc53e('0x16'));var db=require(_0xc53e('0x17'))['db'];var dbH=require(_0xc53e('0x17'))[_0xc53e('0x18')];function respondWithStatusCode(_0x56f0e5,_0x4e74c9){_0x4e74c9=_0x4e74c9||0xcc;return function(_0x1c06cd){if(_0x1c06cd){return _0x56f0e5[_0xc53e('0x19')](_0x4e74c9);}return _0x56f0e5[_0xc53e('0x1a')](_0x4e74c9)[_0xc53e('0x1b')]();};}function respondWithResult(_0x358ef3,_0x382e87){_0x382e87=_0x382e87||0xc8;return function(_0x3dc2fa){if(_0x3dc2fa){return _0x358ef3[_0xc53e('0x1a')](_0x382e87)[_0xc53e('0x1c')](_0x3dc2fa);}};}function respondWithFilteredResult(_0x2ad6eb,_0x5b0a88){return function(_0x8a522e){if(_0x8a522e){var _0x191567=typeof _0x5b0a88[_0xc53e('0x1d')]===_0xc53e('0x1e')&&typeof _0x5b0a88[_0xc53e('0x1f')]===_0xc53e('0x1e');var _0x164016=_0x8a522e[_0xc53e('0x20')];var _0x3b550e=_0x191567?0x0:_0x5b0a88['offset'];var _0x546fab=_0x191567?_0x8a522e[_0xc53e('0x20')]:_0x5b0a88[_0xc53e('0x1d')]+_0x5b0a88[_0xc53e('0x1f')];var _0x2e85df;if(_0x546fab>=_0x164016){_0x546fab=_0x164016;_0x2e85df=0xc8;}else{_0x2e85df=0xce;}_0x2ad6eb[_0xc53e('0x1a')](_0x2e85df);return _0x2ad6eb[_0xc53e('0x21')](_0xc53e('0x22'),_0x3b550e+'-'+_0x546fab+'/'+_0x164016)[_0xc53e('0x1c')](_0x8a522e);}return null;};}function patchUpdates(_0x364c80){return function(_0x401af6){try{jsonpatch[_0xc53e('0x23')](_0x401af6,_0x364c80,!![]);}catch(_0x44fd93){return BPromise[_0xc53e('0x24')](_0x44fd93);}return _0x401af6['save']();};}function saveUpdates(_0x47cfdd,_0x531ede){return function(_0x4f4304){if(_0x4f4304){return _0x4f4304[_0xc53e('0x25')](_0x47cfdd)[_0xc53e('0x26')](function(_0x4015c8){return _0x4015c8;});}return null;};}function removeEntity(_0x180811,_0x5009e1){return function(_0x5e5377){if(_0x5e5377){return _0x5e5377[_0xc53e('0x27')]()['then'](function(){var _0x1ae55e=_0x5e5377[_0xc53e('0x28')]({'plain':!![]});var _0x443179=_0xc53e('0x29');return db[_0xc53e('0x2a')]['destroy']({'where':{'type':_0x443179,'resourceId':_0x1ae55e['id']}})[_0xc53e('0x26')](function(){return _0x5e5377;});})['then'](function(){_0x180811['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c5056,_0x57a1f5){return function(_0x28240a){if(!_0x28240a){_0x3c5056['sendStatus'](0x194);}return _0x28240a;};}function handleError(_0x24a77e,_0x5112d2){_0x5112d2=_0x5112d2||0x1f4;return function(_0x5ce216){logger[_0xc53e('0x2b')](_0x5ce216[_0xc53e('0x2c')]);if(_0x5ce216[_0xc53e('0x2d')]){delete _0x5ce216[_0xc53e('0x2d')];}_0x24a77e[_0xc53e('0x1a')](_0x5112d2)[_0xc53e('0x2e')](_0x5ce216);};}exports[_0xc53e('0x2f')]=function(_0x2a2ca9,_0x4ace0b){var _0x437893={},_0x311835={},_0x2d36c0={'count':0x0,'rows':[]};var _0x56206b=_[_0xc53e('0x30')](db['AnalyticDefaultReport'][_0xc53e('0x31')],function(_0x2467f4){return{'name':_0x2467f4['fieldName'],'type':_0x2467f4['type'][_0xc53e('0x32')]};});_0x311835[_0xc53e('0x33')]=_[_0xc53e('0x30')](_0x56206b,_0xc53e('0x2d'));_0x311835[_0xc53e('0x34')]=_[_0xc53e('0x35')](_0x2a2ca9[_0xc53e('0x34')]);_0x311835[_0xc53e('0x36')]=_['intersection'](_0x311835[_0xc53e('0x33')],_0x311835[_0xc53e('0x34')]);_0x437893[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x311835[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x39')]));_0x437893[_0xc53e('0x37')]=_0x437893['attributes'][_0xc53e('0x3a')]?_0x437893['attributes']:_0x311835[_0xc53e('0x33')];if(!_0x2a2ca9[_0xc53e('0x34')]['hasOwnProperty'](_0xc53e('0x3b'))){_0x437893[_0xc53e('0x1f')]=qs[_0xc53e('0x1f')](_0x2a2ca9['query'][_0xc53e('0x1f')]);_0x437893[_0xc53e('0x1d')]=qs[_0xc53e('0x1d')](_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x1d')]);}_0x437893[_0xc53e('0x3c')]=qs[_0xc53e('0x3d')](_0x2a2ca9['query'][_0xc53e('0x3d')]);_0x437893[_0xc53e('0x3e')]=qs[_0xc53e('0x36')](_['pick'](_0x2a2ca9[_0xc53e('0x34')],_0x311835['filters']),_0x56206b);if(_0x2a2ca9[_0xc53e('0x34')][_0xc53e('0x3f')]){_0x437893[_0xc53e('0x3e')]=_[_0xc53e('0x40')](_0x437893[_0xc53e('0x3e')],{'$or':_['map'](_0x56206b,function(_0x3dda55){if(_0x3dda55[_0xc53e('0x41')]!=='VIRTUAL'){var _0x5b7354={};_0x5b7354[_0x3dda55['name']]={'$like':'%'+_0x2a2ca9['query'][_0xc53e('0x3f')]+'%'};return _0x5b7354;}})});}_0x437893=_[_0xc53e('0x40')]({},_0x437893,_0x2a2ca9['options']);var _0x460ee6={'where':_0x437893['where']};return db['AnalyticDefaultReport']['count'](_0x460ee6)[_0xc53e('0x26')](function(_0x4ba96f){_0x2d36c0['count']=_0x4ba96f;if(_0x2a2ca9[_0xc53e('0x34')]['includeAll']){_0x437893[_0xc53e('0x42')]=[{'all':!![]}];}return db[_0xc53e('0x43')]['findAll'](_0x437893);})[_0xc53e('0x26')](function(_0x3a4ebc){_0x2d36c0['rows']=_0x3a4ebc;return _0x2d36c0;})[_0xc53e('0x26')](respondWithFilteredResult(_0x4ace0b,_0x437893))['catch'](handleError(_0x4ace0b,null));};exports['show']=function(_0x481e6d,_0x4efee5){var _0x887d78={'raw':!![],'where':{'id':_0x481e6d[_0xc53e('0x44')]['id']}},_0x17b586={};_0x17b586['model']=_[_0xc53e('0x35')](db[_0xc53e('0x43')]['rawAttributes']);_0x17b586['query']=_[_0xc53e('0x35')](_0x481e6d[_0xc53e('0x34')]);_0x17b586[_0xc53e('0x36')]=_['intersection'](_0x17b586[_0xc53e('0x33')],_0x17b586[_0xc53e('0x34')]);_0x887d78[_0xc53e('0x37')]=_[_0xc53e('0x38')](_0x17b586[_0xc53e('0x33')],qs[_0xc53e('0x39')](_0x481e6d[_0xc53e('0x34')]['fields']));_0x887d78[_0xc53e('0x37')]=_0x887d78[_0xc53e('0x37')][_0xc53e('0x3a')]?_0x887d78['attributes']:_0x17b586[_0xc53e('0x33')];if(_0x481e6d[_0xc53e('0x34')][_0xc53e('0x45')]){_0x887d78[_0xc53e('0x42')]=[{'all':!![]}];}_0x887d78=_[_0xc53e('0x40')]({},_0x887d78,_0x481e6d[_0xc53e('0x46')]);return db['AnalyticDefaultReport'][_0xc53e('0x47')](_0x887d78)[_0xc53e('0x26')](handleEntityNotFound(_0x4efee5,null))[_0xc53e('0x26')](respondWithResult(_0x4efee5,null))['catch'](handleError(_0x4efee5,null));};exports[_0xc53e('0x48')]=function(_0x1d2491,_0x1eeb65){return db[_0xc53e('0x43')][_0xc53e('0x48')](_0x1d2491[_0xc53e('0x49')],{})[_0xc53e('0x26')](function(_0x2ba2b4){var _0x34de2d=_0x1d2491[_0xc53e('0x4a')]['get']({'plain':!![]});if(!_0x34de2d)throw new Error(_0xc53e('0x4b'));if(_0x34de2d[_0xc53e('0x4c')]===_0xc53e('0x4a')){var _0x3d74ac=_0x2ba2b4[_0xc53e('0x28')]({'plain':!![]});var _0x52dac7='Reports';return db[_0xc53e('0x4d')]['find']({'where':{'name':_0x52dac7,'userProfileId':_0x34de2d[_0xc53e('0x4e')]},'raw':!![]})['then'](function(_0x3a49a4){if(_0x3a49a4&&_0x3a49a4[_0xc53e('0x4f')]===0x0){return db[_0xc53e('0x2a')]['create']({'name':_0x3d74ac[_0xc53e('0x2d')],'resourceId':_0x3d74ac['id'],'type':_0xc53e('0x29'),'sectionId':_0x3a49a4['id']},{})[_0xc53e('0x26')](function(){return _0x2ba2b4;});}else{return _0x2ba2b4;}})['catch'](function(_0x2f7df2){logger['error'](_0xc53e('0x50'),_0x2f7df2);throw _0x2f7df2;});}return _0x2ba2b4;})[_0xc53e('0x26')](respondWithResult(_0x1eeb65,0xc9))['catch'](handleError(_0x1eeb65,null));};exports[_0xc53e('0x25')]=function(_0x1515ea,_0x5bba72){if(_0x1515ea[_0xc53e('0x49')]['id']){delete _0x1515ea[_0xc53e('0x49')]['id'];}return db[_0xc53e('0x43')][_0xc53e('0x47')]({'where':{'id':_0x1515ea[_0xc53e('0x44')]['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x5bba72,null))[_0xc53e('0x26')](saveUpdates(_0x1515ea[_0xc53e('0x49')],null))[_0xc53e('0x26')](respondWithResult(_0x5bba72,null))[_0xc53e('0x51')](handleError(_0x5bba72,null));};exports[_0xc53e('0x27')]=function(_0x47dd5a,_0x8364f6){return db['AnalyticDefaultReport'][_0xc53e('0x47')]({'where':{'id':_0x47dd5a['params']['id']}})[_0xc53e('0x26')](handleEntityNotFound(_0x8364f6,null))[_0xc53e('0x26')](removeEntity(_0x8364f6,null))['catch'](handleError(_0x8364f6,null));};exports[_0xc53e('0x52')]=function(_0x7f0bc0,_0x9c0112){var _0x432a91=0xa;var _0x53083b=[_0xc53e('0x53'),_0xc53e('0x54'),'right_join','cross_join'];var _0x3c0aa1={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x5fcd58={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x37b091=function(_0x31e22b){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x31e22b);};var _0x13bf71=function(_0x16d8a1){if(!_0x16d8a1||!_0x16d8a1[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xdc0e49='(',_0x520738=0x0;_0x520738<_0x16d8a1[_0xc53e('0x61')]['length'];_0x520738+=0x1){_0x520738>0x0&&(_0xdc0e49+='\x20'+_0x16d8a1[_0xc53e('0x62')]+'\x20');_0xdc0e49+=_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]?_0x13bf71(_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x63')]):_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x64')]+'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738]['condition']+(_0x37b091(_0x16d8a1['rules'][_0x520738]['condition'])?'\x20'+_0x16d8a1[_0xc53e('0x61')][_0x520738][_0xc53e('0x65')]:'');}return _0xdc0e49+')';};var _0x37ac78={'where':{'id':_0x7f0bc0['params']['id']}},_0x25e4b6,_0x247d99,_0x160ca3,_0x3581ab,_0x5a9596;_0x37ac78=_['merge']({},_0x37ac78,_0x7f0bc0[_0xc53e('0x46')]);return db[_0xc53e('0x43')]['find'](_0x37ac78)[_0xc53e('0x26')](function(_0x235a6b){if(_0x235a6b){_0x25e4b6=_0x235a6b;return _0x235a6b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x22829b){if(_0x22829b){if(!_0x22829b[_0xc53e('0x3a')]){throw new db['Sequelize']['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x247d99=_0x22829b;return db[_0xc53e('0x68')][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x29ee08){if(_0x29ee08){_0x160ca3=_[_0xc53e('0x6a')](_0x29ee08,'id');var _0x5a1a4b;var _0x2b6734=squel[_0xc53e('0x6b')]();_0x2b6734[_0xc53e('0x6c')](_0x25e4b6[_0xc53e('0x6d')]);for(var _0x4d2609=0x0;_0x4d2609<_0x247d99[_0xc53e('0x3a')];_0x4d2609+=0x1){_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x6e')]?_0x160ca3[_0x247d99[_0x4d2609][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x247d99[_0x4d2609][_0xc53e('0x64')];_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x70')]?_['replace'](_0x3c0aa1[_0x247d99[_0x4d2609][_0xc53e('0x70')]],'%s',_0x5a1a4b):_0x5a1a4b;_0x5a1a4b=_0x247d99[_0x4d2609][_0xc53e('0x71')]?_[_0xc53e('0x72')](_0x5fcd58[_0x247d99[_0x4d2609][_0xc53e('0x71')]],'%s',_0x5a1a4b):_0x5a1a4b;if(_0x247d99[_0x4d2609]['groupBy']){_0x2b6734['group'](_0x5a1a4b);}_0x247d99[_0x4d2609][_0xc53e('0x73')]&&_0x2b6734[_0xc53e('0x3c')](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x2b6734['field'](_0x5a1a4b,_0x247d99[_0x4d2609][_0xc53e('0x75')]||_0x5a1a4b);}if(_0x25e4b6['joins']){_0x25e4b6[_0xc53e('0x76')]=JSON['parse'](_0x25e4b6[_0xc53e('0x76')]);for(var _0x4e128a=0x0;_0x4e128a<_0x25e4b6[_0xc53e('0x76')][_0xc53e('0x3a')];_0x4e128a+=0x1){if(_0x25e4b6['joins'][_0x4e128a][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x53083b,_0x25e4b6['joins'][_0x4e128a]['type'])&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')]&&_0x25e4b6['joins'][_0x4e128a]['foreignTable']&&_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']){_0x2b6734[_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['type']](_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x25e4b6[_0xc53e('0x6d')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x77')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a][_0xc53e('0x78')],_0x25e4b6[_0xc53e('0x76')][_0x4e128a]['foreignKey']));}}}if(_0x25e4b6[_0xc53e('0x7a')]){_0x25e4b6['conditions']=JSON[_0xc53e('0x7b')](_0x25e4b6[_0xc53e('0x7a')]);_0x2b6734[_0xc53e('0x3e')](_0x13bf71(_0x25e4b6[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x5a9596=_0x2b6734[_0xc53e('0x7c')]();_0x2b6734[_0xc53e('0x1f')](_0x432a91);_0x2b6734[_0xc53e('0x1d')](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x2b6734['toString']());return dbH[_0xc53e('0x7f')]['query'](_0x2b6734[_0xc53e('0x80')](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']});}})[_0xc53e('0x26')](respondWithResult(_0x9c0112,null))[_0xc53e('0x51')](handleError(_0x9c0112,null));};function runReport(_0x381652,_0xec3738,_0x3a84a2){var _0x508671=_0xec3738[_0xc53e('0x2d')];var _0x48e337=0xa;var _0x56c66f=[_0xc53e('0x53'),_0xc53e('0x54'),_0xc53e('0x82'),'cross_join'];var _0x35b6dc={'SUM':_0xc53e('0x83'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0xc53e('0x85'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xc53e('0x58')};var _0x3d2636={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':'DATE(%s)','HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x4c8112=function(_0x1a8ae4){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),'IS\x20NOT\x20EMPTY'],_0x1a8ae4);};var _0x3dac82=function(_0x325287){if(!_0x325287||!_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')]){return'';}for(var _0xe6a976='(',_0x4102bc=0x0;_0x4102bc<_0x325287[_0xc53e('0x61')][_0xc53e('0x3a')];_0x4102bc+=0x1){_0x4102bc>0x0&&(_0xe6a976+='\x20'+_0x325287[_0xc53e('0x62')]+'\x20');_0xe6a976+=_0x325287['rules'][_0x4102bc][_0xc53e('0x63')]?_0x3dac82(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x63')]):_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x64')]+'\x20'+_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')]+(_0x4c8112(_0x325287[_0xc53e('0x61')][_0x4102bc][_0xc53e('0x88')])?'\x20'+_0x325287['rules'][_0x4102bc][_0xc53e('0x65')]:'');}return _0xe6a976+')';};var _0x190509={'where':{'id':_0x381652['id']}},_0x110e32,_0x2135d4,_0x4bbf8a,_0x31b06d,_0x21fc8d;_0x190509=_[_0xc53e('0x40')]({},_0x190509,_0x3a84a2);return db[_0xc53e('0x43')]['find'](_0x190509)[_0xc53e('0x26')](function(_0x138870){if(_0x138870){_0x110e32=_0x138870;return _0x138870[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x621e78){if(_0x621e78){if(!_0x621e78[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))]['ValidationErrorItem'](_0xc53e('0x67'),0x193);}_0x2135d4=_0x621e78;return db['AnalyticMetric'][_0xc53e('0x69')]({'raw':!![]});}return null;})[_0xc53e('0x26')](function(_0x3fe278){if(_0x3fe278){_0x4bbf8a=_['keyBy'](_0x3fe278,'id');var _0x7c56eb;var _0x36dffe=squel[_0xc53e('0x6b')]();_0x36dffe['from'](_0x110e32[_0xc53e('0x6d')]);for(var _0xedb93a=0x0;_0xedb93a<_0x2135d4[_0xc53e('0x3a')];_0xedb93a+=0x1){_0x7c56eb=_0x2135d4[_0xedb93a]['MetricId']?_0x4bbf8a[_0x2135d4[_0xedb93a][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x2135d4[_0xedb93a][_0xc53e('0x64')];_0x7c56eb=_0x2135d4[_0xedb93a][_0xc53e('0x70')]?_[_0xc53e('0x72')](_0x35b6dc[_0x2135d4[_0xedb93a]['function']],'%s',_0x7c56eb):_0x7c56eb;_0x7c56eb=_0x2135d4[_0xedb93a]['format']?_['replace'](_0x3d2636[_0x2135d4[_0xedb93a][_0xc53e('0x71')]],'%s',_0x7c56eb):_0x7c56eb;if(_0x2135d4[_0xedb93a][_0xc53e('0x8a')]){_0x36dffe[_0xc53e('0x63')](_0x7c56eb);}_0x2135d4[_0xedb93a][_0xc53e('0x73')]&&_0x36dffe['order'](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x73')]==='DESC'?![]:!![]);_0x36dffe[_0xc53e('0x64')](_0x7c56eb,_0x2135d4[_0xedb93a][_0xc53e('0x75')]||_0x7c56eb);}if(_0x110e32[_0xc53e('0x76')]){_0x110e32[_0xc53e('0x76')]=JSON['parse'](_0x110e32[_0xc53e('0x76')]);for(var _0xc23eef=0x0;_0xc23eef<_0x110e32[_0xc53e('0x76')][_0xc53e('0x3a')];_0xc23eef+=0x1){if(_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]&&_[_0xc53e('0x5c')](_0x56c66f,_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')])&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')]&&_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x8b')]){_0x36dffe[_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x41')]](_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x78')],null,util[_0xc53e('0x71')](_0xc53e('0x79'),_0x110e32[_0xc53e('0x6d')],_0x110e32[_0xc53e('0x76')][_0xc23eef][_0xc53e('0x77')],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignTable'],_0x110e32[_0xc53e('0x76')][_0xc23eef]['foreignKey']));}}}if(_0x110e32[_0xc53e('0x7a')]){_0x110e32[_0xc53e('0x7a')]=JSON['parse'](_0x110e32[_0xc53e('0x7a')]);_0x36dffe[_0xc53e('0x3e')](_0x3dac82(_0x110e32[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x21fc8d=_0x36dffe[_0xc53e('0x7c')]();_0x36dffe[_0xc53e('0x1f')](_0x48e337);_0x36dffe[_0xc53e('0x1d')](0x0);return;}})[_0xc53e('0x26')](function(){if(_0xec3738[_0xc53e('0x8c')]==='web'){return null;}var _0x37c8e6=_['merge'](_0xec3738,{'name':_0xec3738[_0xc53e('0x8d')]||_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],'basename':_0x508671,'savename':util[_0xc53e('0x71')](_0xc53e('0x8e'),_0xec3738[_0xc53e('0x2d')]||_0x110e32[_0xc53e('0x2d')],require(_0xc53e('0x8f'))[_0xc53e('0x90')](0x4),_0xec3738[_0xc53e('0x8c')]||_0xc53e('0x91')),'reportId':_0x110e32['id'],'reportType':_0xc53e('0x92')});return db[_0xc53e('0x93')]['create'](_0x37c8e6,{'raw':!![]});})[_0xc53e('0x26')](function(_0x575ef5){if(_0x110e32[_0xc53e('0x6d')]===_0xc53e('0x94')){_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+'.calldate\x20BETWEEN\x20?\x20AND\x20?',_0xec3738['startDate'],_0xec3738[_0xc53e('0x95')]);}else{_0x21fc8d[_0xc53e('0x3e')](_0x110e32[_0xc53e('0x6d')]+_0xc53e('0x96'),_0xec3738['startDate'],_0xec3738['endDate']);}if(_0x575ef5){logger[_0xc53e('0x97')](_0xc53e('0x98'),_0x21fc8d[_0xc53e('0x80')]());require(_0xc53e('0x99'))[_0xc53e('0x9a')](path[_0xc53e('0x53')](__dirname,'../../components/export/',_0x575ef5[_0xc53e('0x8c')]),[_0x575ef5['id'],_0x21fc8d[_0xc53e('0x80')](),path[_0xc53e('0x53')](__dirname,_0xc53e('0x9b'),_0x575ef5[_0xc53e('0x9c')]),_0x508671]);return _0x575ef5;}else{var _0x4f527e=squel[_0xc53e('0x6b')]();_0x4f527e[_0xc53e('0x6c')]('('+_0x21fc8d[_0xc53e('0x80')]()+')',_0xc53e('0x9d'));_0x4f527e[_0xc53e('0x64')](_0xc53e('0x9e'),_0xc53e('0x20'));_0x21fc8d[_0xc53e('0x1f')](_0xec3738[_0xc53e('0x1f')]||_0x48e337);_0x21fc8d[_0xc53e('0x1d')](_0xec3738[_0xc53e('0x1d')]||0x0);return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x4f527e['toString'](),{'type':dbH[_0xc53e('0x7f')][_0xc53e('0x81')]['SELECT']})[_0xc53e('0x26')](function(_0x4ee56b){if(!_0x4ee56b['length']){_0x31b06d=0x0;}else{_0x31b06d=_0x4ee56b[0x0][_0xc53e('0x20')]||0x0;}return dbH['sequelize'][_0xc53e('0x34')](_0x21fc8d['toString'](),{'type':dbH[_0xc53e('0x7f')]['QueryTypes'][_0xc53e('0x9f')]});})[_0xc53e('0x26')](function(_0x10ad32){return{'rows':_0x10ad32||[],'count':_0x31b06d};});}});}exports['run']=function(_0xf3f34a,_0x5dd87e){return runReport(_0xf3f34a[_0xc53e('0x44')],_0xf3f34a[_0xc53e('0x34')],_0xf3f34a[_0xc53e('0x46')])[_0xc53e('0x26')](respondWithResult(_0x5dd87e,null))[_0xc53e('0x51')](handleError(_0x5dd87e,null));};exports[_0xc53e('0xa0')]=runReport;exports[_0xc53e('0x34')]=function(_0x265292,_0x2c776c){var _0x383f22=0xa;var _0x51f2a4=['join',_0xc53e('0x54'),'right_join',_0xc53e('0xa1')];var _0xbc960={'SUM':_0xc53e('0x83'),'COUNT':_0xc53e('0xa2'),'COUNT DISTINCT':_0xc53e('0x84'),'MAX':_0xc53e('0x55'),'MIN':_0xc53e('0xa3'),'AVG':_0xc53e('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0xc53e('0x57'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x34cb12={'SEC_TO_TIME':_0xc53e('0x59'),'DATE':_0xc53e('0x5a'),'HOUR':_0xc53e('0x86'),'ROUND':_0xc53e('0x87'),'UNIX_TIMESTAMP':_0xc53e('0x5b')};var _0x227e0c=function(_0x4c0802){return!_[_0xc53e('0x5c')]([_0xc53e('0x5d'),_0xc53e('0x5e'),_0xc53e('0x5f'),_0xc53e('0x60')],_0x4c0802);};var _0x590fb6=function(_0x15d269){if(!_0x15d269||!_0x15d269[_0xc53e('0x61')]['length']){return'';}for(var _0x5253b1='(',_0x208c17=0x0;_0x208c17<_0x15d269['rules'][_0xc53e('0x3a')];_0x208c17+=0x1){_0x208c17>0x0&&(_0x5253b1+='\x20'+_0x15d269[_0xc53e('0x62')]+'\x20');_0x5253b1+=_0x15d269['rules'][_0x208c17]['group']?_0x590fb6(_0x15d269[_0xc53e('0x61')][_0x208c17]['group']):_0x15d269[_0xc53e('0x61')][_0x208c17]['field']+'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')]+(_0x227e0c(_0x15d269[_0xc53e('0x61')][_0x208c17][_0xc53e('0x88')])?'\x20'+_0x15d269[_0xc53e('0x61')][_0x208c17]['value']:'');}return _0x5253b1+')';};var _0x2f5d22={'where':{'id':_0x265292[_0xc53e('0x44')]['id']}},_0x478e57,_0x5e427a,_0x3e666b,_0x365a98,_0x375d8b;_0x2f5d22=_[_0xc53e('0x40')]({},_0x2f5d22,_0x265292[_0xc53e('0x46')]);return db[_0xc53e('0x43')][_0xc53e('0x47')](_0x2f5d22)[_0xc53e('0x26')](function(_0x3b778b){if(_0x3b778b){_0x478e57=_0x3b778b;return _0x3b778b[_0xc53e('0x66')]();}return null;})[_0xc53e('0x26')](function(_0x55581a){if(_0x55581a){if(!_0x55581a[_0xc53e('0x3a')]){throw new db[(_0xc53e('0x89'))][(_0xc53e('0xa4'))](_0xc53e('0x67'),0x193);}_0x5e427a=_0x55581a;return db[_0xc53e('0x68')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x34c717){if(_0x34c717){_0x3e666b=_[_0xc53e('0x6a')](_0x34c717,'id');var _0x2718fe;var _0x15014e=squel[_0xc53e('0x6b')]();_0x15014e[_0xc53e('0x6c')](_0x478e57[_0xc53e('0x6d')]);for(var _0x2d80f5=0x0;_0x2d80f5<_0x5e427a[_0xc53e('0x3a')];_0x2d80f5+=0x1){_0x2718fe=_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]?_0x3e666b[_0x5e427a[_0x2d80f5][_0xc53e('0x6e')]][_0xc53e('0x6f')]:_0x5e427a[_0x2d80f5][_0xc53e('0x64')];_0x2718fe=_0x5e427a[_0x2d80f5]['function']?_[_0xc53e('0x72')](_0xbc960[_0x5e427a[_0x2d80f5][_0xc53e('0x70')]],'%s',_0x2718fe):_0x2718fe;_0x2718fe=_0x5e427a[_0x2d80f5]['format']?_[_0xc53e('0x72')](_0x34cb12[_0x5e427a[_0x2d80f5][_0xc53e('0x71')]],'%s',_0x2718fe):_0x2718fe;if(_0x5e427a[_0x2d80f5][_0xc53e('0x8a')]){_0x15014e['group'](_0x2718fe);}_0x5e427a[_0x2d80f5]['orderBy']&&_0x15014e[_0xc53e('0x3c')](_0x2718fe,_0x5e427a[_0x2d80f5][_0xc53e('0x73')]===_0xc53e('0x74')?![]:!![]);_0x15014e[_0xc53e('0x64')](_0x2718fe,_0x5e427a[_0x2d80f5]['alias']||_0x2718fe);}if(_0x478e57[_0xc53e('0x76')]){_0x478e57[_0xc53e('0x76')]=JSON[_0xc53e('0x7b')](_0x478e57['joins']);for(var _0x48d301=0x0;_0x48d301<_0x478e57[_0xc53e('0x76')][_0xc53e('0x3a')];_0x48d301+=0x1){if(_0x478e57[_0xc53e('0x76')][_0x48d301]['type']&&_[_0xc53e('0x5c')](_0x51f2a4,_0x478e57[_0xc53e('0x76')][_0x48d301]['type'])&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')]&&_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x78')]&&_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']){_0x15014e[_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x41')]](_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],null,util['format'](_0xc53e('0x79'),_0x478e57[_0xc53e('0x6d')],_0x478e57[_0xc53e('0x76')][_0x48d301][_0xc53e('0x77')],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignTable'],_0x478e57[_0xc53e('0x76')][_0x48d301]['foreignKey']));}}}if(_0x478e57[_0xc53e('0x7a')]){_0x478e57[_0xc53e('0x7a')]=JSON[_0xc53e('0x7b')](_0x478e57[_0xc53e('0x7a')]);_0x15014e[_0xc53e('0x3e')](_0x590fb6(_0x478e57[_0xc53e('0x7a')][_0xc53e('0x63')]));}_0x375d8b=_0x15014e[_0xc53e('0x7c')]();_0x15014e[_0xc53e('0x1f')](_0x383f22);_0x15014e['offset'](0x0);logger[_0xc53e('0x7d')](_0xc53e('0x7e'),_0x15014e[_0xc53e('0x80')]());return dbH[_0xc53e('0x7f')][_0xc53e('0x34')](_0x15014e[_0xc53e('0x80')](),{'type':dbH['sequelize'][_0xc53e('0x81')][_0xc53e('0x9f')]});}})[_0xc53e('0x26')](function(){return{'sql':_0x375d8b[_0xc53e('0x80')]()};})[_0xc53e('0x26')](respondWithResult(_0x2c776c,null))[_0xc53e('0x51')](handleError(_0x2c776c,null));}; \ No newline at end of file +var _0x31f0=['fullPath','%s-%s.%s','randomstring','generate','default','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','info','child_process','../../components/export/','../../files/reports','countTable','COUNT(*)','run','runReport','DATE(%s)','keyBy','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','dbH','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','get','DefaultReports','destroy','error','name','send','index','AnalyticDefaultReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','include','findAll','rows','catch','params','length','find','create','user','role','Reports','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','preview','join','left_join','right_join','SUM(%s)','COUNT(%s)','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','condition','value','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','select','from','table','function','replace','format','orderBy','DESC','field','alias','parse','joins','parentKey','foreignKey','%s.%s\x20=\x20%s.%s','foreignTable','conditions','clone','debug','Limited\x20Query:','toString','sequelize','QueryTypes','SELECT','cross_join','COUNT(DISTINCT\x20%s)','AVG(%s)','HOUR(%s)','ROUND(%s)','IS\x20NOT\x20NULL','getFields','MetricId','metric','groupBy','output','web'];(function(_0x3182bd,_0x40053a){var _0x47e8c8=function(_0x27bec9){while(--_0x27bec9){_0x3182bd['push'](_0x3182bd['shift']());}};_0x47e8c8(++_0x40053a);}(_0x31f0,0xb7));var _0x031f=function(_0x2b948d,_0xcb6869){_0x2b948d=_0x2b948d-0x0;var _0x492511=_0x31f0[_0x2b948d];return _0x492511;};'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'];var dbH=require(_0x031f('0x17'))[_0x031f('0x18')];function respondWithStatusCode(_0x405896,_0x1c230d){_0x1c230d=_0x1c230d||0xcc;return function(_0x5d0457){if(_0x5d0457){return _0x405896[_0x031f('0x19')](_0x1c230d);}return _0x405896[_0x031f('0x1a')](_0x1c230d)[_0x031f('0x1b')]();};}function respondWithResult(_0x2e3dfe,_0x2ea549){_0x2ea549=_0x2ea549||0xc8;return function(_0x57f9c0){if(_0x57f9c0){return _0x2e3dfe['status'](_0x2ea549)[_0x031f('0x1c')](_0x57f9c0);}};}function respondWithFilteredResult(_0x3a10aa,_0xe4fc1d){return function(_0x286177){if(_0x286177){var _0x5196b1=typeof _0xe4fc1d[_0x031f('0x1d')]===_0x031f('0x1e')&&typeof _0xe4fc1d['limit']===_0x031f('0x1e');var _0x535e70=_0x286177[_0x031f('0x1f')];var _0x5f2199=_0x5196b1?0x0:_0xe4fc1d[_0x031f('0x1d')];var _0xaa155=_0x5196b1?_0x286177[_0x031f('0x1f')]:_0xe4fc1d[_0x031f('0x1d')]+_0xe4fc1d[_0x031f('0x20')];var _0x2825ef;if(_0xaa155>=_0x535e70){_0xaa155=_0x535e70;_0x2825ef=0xc8;}else{_0x2825ef=0xce;}_0x3a10aa[_0x031f('0x1a')](_0x2825ef);return _0x3a10aa[_0x031f('0x21')](_0x031f('0x22'),_0x5f2199+'-'+_0xaa155+'/'+_0x535e70)['json'](_0x286177);}return null;};}function patchUpdates(_0xf72793){return function(_0x33926c){try{jsonpatch[_0x031f('0x23')](_0x33926c,_0xf72793,!![]);}catch(_0x4d6706){return BPromise['reject'](_0x4d6706);}return _0x33926c[_0x031f('0x24')]();};}function saveUpdates(_0x4d0f92,_0x3472a2){return function(_0x57f6c4){if(_0x57f6c4){return _0x57f6c4['update'](_0x4d0f92)['then'](function(_0x971691){return _0x971691;});}return null;};}function removeEntity(_0x12c406,_0x2920cd){return function(_0x4c8126){if(_0x4c8126){return _0x4c8126['destroy']()[_0x031f('0x25')](function(){var _0x5a64c0=_0x4c8126[_0x031f('0x26')]({'plain':!![]});var _0x1f5a14=_0x031f('0x27');return db['UserProfileResource'][_0x031f('0x28')]({'where':{'type':_0x1f5a14,'resourceId':_0x5a64c0['id']}})[_0x031f('0x25')](function(){return _0x4c8126;});})['then'](function(){_0x12c406[_0x031f('0x1a')](0xcc)[_0x031f('0x1b')]();});}};}function handleEntityNotFound(_0x2403e9,_0x5395ea){return function(_0xa308b){if(!_0xa308b){_0x2403e9[_0x031f('0x19')](0x194);}return _0xa308b;};}function handleError(_0xb6ed6c,_0xaf5bea){_0xaf5bea=_0xaf5bea||0x1f4;return function(_0xfaa36){logger[_0x031f('0x29')](_0xfaa36['stack']);if(_0xfaa36[_0x031f('0x2a')]){delete _0xfaa36[_0x031f('0x2a')];}_0xb6ed6c[_0x031f('0x1a')](_0xaf5bea)[_0x031f('0x2b')](_0xfaa36);};}exports[_0x031f('0x2c')]=function(_0x2d24f0,_0x378692){var _0x87dc07={},_0x2034ac={},_0xfc4a89={'count':0x0,'rows':[]};var _0x2cf3a8=_['map'](db[_0x031f('0x2d')][_0x031f('0x2e')],function(_0xb3a6bd){return{'name':_0xb3a6bd[_0x031f('0x2f')],'type':_0xb3a6bd[_0x031f('0x30')][_0x031f('0x31')]};});_0x2034ac[_0x031f('0x32')]=_[_0x031f('0x33')](_0x2cf3a8,_0x031f('0x2a'));_0x2034ac[_0x031f('0x34')]=_[_0x031f('0x35')](_0x2d24f0[_0x031f('0x34')]);_0x2034ac[_0x031f('0x36')]=_['intersection'](_0x2034ac[_0x031f('0x32')],_0x2034ac[_0x031f('0x34')]);_0x87dc07['attributes']=_[_0x031f('0x37')](_0x2034ac[_0x031f('0x32')],qs['fields'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x38')]));_0x87dc07[_0x031f('0x39')]=_0x87dc07[_0x031f('0x39')]['length']?_0x87dc07['attributes']:_0x2034ac[_0x031f('0x32')];if(!_0x2d24f0['query'][_0x031f('0x3a')](_0x031f('0x3b'))){_0x87dc07[_0x031f('0x20')]=qs['limit'](_0x2d24f0['query'][_0x031f('0x20')]);_0x87dc07['offset']=qs['offset'](_0x2d24f0[_0x031f('0x34')][_0x031f('0x1d')]);}_0x87dc07[_0x031f('0x3c')]=qs[_0x031f('0x3d')](_0x2d24f0[_0x031f('0x34')][_0x031f('0x3d')]);_0x87dc07[_0x031f('0x3e')]=qs['filters'](_[_0x031f('0x3f')](_0x2d24f0[_0x031f('0x34')],_0x2034ac[_0x031f('0x36')]),_0x2cf3a8);if(_0x2d24f0[_0x031f('0x34')]['filter']){_0x87dc07[_0x031f('0x3e')]=_[_0x031f('0x40')](_0x87dc07[_0x031f('0x3e')],{'$or':_['map'](_0x2cf3a8,function(_0x24ec95){if(_0x24ec95[_0x031f('0x30')]!=='VIRTUAL'){var _0x36bafa={};_0x36bafa[_0x24ec95[_0x031f('0x2a')]]={'$like':'%'+_0x2d24f0['query']['filter']+'%'};return _0x36bafa;}})});}_0x87dc07=_[_0x031f('0x40')]({},_0x87dc07,_0x2d24f0[_0x031f('0x41')]);var _0x9efbc4={'where':_0x87dc07[_0x031f('0x3e')]};return db[_0x031f('0x2d')][_0x031f('0x1f')](_0x9efbc4)[_0x031f('0x25')](function(_0x5a212c){_0xfc4a89[_0x031f('0x1f')]=_0x5a212c;if(_0x2d24f0[_0x031f('0x34')]['includeAll']){_0x87dc07[_0x031f('0x42')]=[{'all':!![]}];}return db['AnalyticDefaultReport'][_0x031f('0x43')](_0x87dc07);})[_0x031f('0x25')](function(_0x56dd24){_0xfc4a89[_0x031f('0x44')]=_0x56dd24;return _0xfc4a89;})[_0x031f('0x25')](respondWithFilteredResult(_0x378692,_0x87dc07))[_0x031f('0x45')](handleError(_0x378692,null));};exports['show']=function(_0x98747f,_0x213e1c){var _0x1d3324={'raw':!![],'where':{'id':_0x98747f[_0x031f('0x46')]['id']}},_0x2a6cba={};_0x2a6cba[_0x031f('0x32')]=_[_0x031f('0x35')](db[_0x031f('0x2d')][_0x031f('0x2e')]);_0x2a6cba['query']=_[_0x031f('0x35')](_0x98747f[_0x031f('0x34')]);_0x2a6cba[_0x031f('0x36')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],_0x2a6cba[_0x031f('0x34')]);_0x1d3324[_0x031f('0x39')]=_[_0x031f('0x37')](_0x2a6cba[_0x031f('0x32')],qs['fields'](_0x98747f[_0x031f('0x34')]['fields']));_0x1d3324['attributes']=_0x1d3324[_0x031f('0x39')][_0x031f('0x47')]?_0x1d3324[_0x031f('0x39')]:_0x2a6cba[_0x031f('0x32')];if(_0x98747f[_0x031f('0x34')]['includeAll']){_0x1d3324[_0x031f('0x42')]=[{'all':!![]}];}_0x1d3324=_[_0x031f('0x40')]({},_0x1d3324,_0x98747f[_0x031f('0x41')]);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0x1d3324)[_0x031f('0x25')](handleEntityNotFound(_0x213e1c,null))[_0x031f('0x25')](respondWithResult(_0x213e1c,null))[_0x031f('0x45')](handleError(_0x213e1c,null));};exports[_0x031f('0x49')]=function(_0x12d28e,_0x5caeb5){return db['AnalyticDefaultReport'][_0x031f('0x49')](_0x12d28e['body'],{})[_0x031f('0x25')](function(_0x3bba44){var _0x5a29e0=_0x12d28e[_0x031f('0x4a')]['get']({'plain':!![]});if(!_0x5a29e0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a29e0[_0x031f('0x4b')]==='user'){var _0x16bade=_0x3bba44['get']({'plain':!![]});var _0x11bf43=_0x031f('0x4c');return db['UserProfileSection'][_0x031f('0x48')]({'where':{'name':_0x11bf43,'userProfileId':_0x5a29e0[_0x031f('0x4d')]},'raw':!![]})['then'](function(_0x46471a){if(_0x46471a&&_0x46471a['autoAssociation']===0x0){return db[_0x031f('0x4e')]['create']({'name':_0x16bade[_0x031f('0x2a')],'resourceId':_0x16bade['id'],'type':_0x031f('0x27'),'sectionId':_0x46471a['id']},{})[_0x031f('0x25')](function(){return _0x3bba44;});}else{return _0x3bba44;}})[_0x031f('0x45')](function(_0x691a68){logger['error'](_0x031f('0x4f'),_0x691a68);throw _0x691a68;});}return _0x3bba44;})['then'](respondWithResult(_0x5caeb5,0xc9))[_0x031f('0x45')](handleError(_0x5caeb5,null));};exports[_0x031f('0x50')]=function(_0x4d49f8,_0x1f9c55){if(_0x4d49f8[_0x031f('0x51')]['id']){delete _0x4d49f8['body']['id'];}return db[_0x031f('0x2d')][_0x031f('0x48')]({'where':{'id':_0x4d49f8[_0x031f('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f9c55,null))[_0x031f('0x25')](saveUpdates(_0x4d49f8['body'],null))[_0x031f('0x25')](respondWithResult(_0x1f9c55,null))['catch'](handleError(_0x1f9c55,null));};exports[_0x031f('0x28')]=function(_0x561a2b,_0xa52a54){return db[_0x031f('0x2d')]['find']({'where':{'id':_0x561a2b['params']['id']}})[_0x031f('0x25')](handleEntityNotFound(_0xa52a54,null))[_0x031f('0x25')](removeEntity(_0xa52a54,null))['catch'](handleError(_0xa52a54,null));};exports[_0x031f('0x52')]=function(_0xb44c73,_0x255003){var _0x286d4e=0xa;var _0x21a89d=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),'cross_join'];var _0xe452c2={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0x031f('0x58'),'MIN':_0x031f('0x59'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x198e2e={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x031f('0x5d')};var _0xcf8b7=function(_0x4a7fbb){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),'IS\x20NOT\x20NULL',_0x031f('0x60'),_0x031f('0x61')],_0x4a7fbb);};var _0x451c71=function(_0x22d211){if(!_0x22d211||!_0x22d211[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x2ddf15='(',_0x4527e5=0x0;_0x4527e5<_0x22d211[_0x031f('0x62')]['length'];_0x4527e5+=0x1){_0x4527e5>0x0&&(_0x2ddf15+='\x20'+_0x22d211[_0x031f('0x63')]+'\x20');_0x2ddf15+=_0x22d211['rules'][_0x4527e5][_0x031f('0x64')]?_0x451c71(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x64')]):_0x22d211['rules'][_0x4527e5]['field']+'\x20'+_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')]+(_0xcf8b7(_0x22d211[_0x031f('0x62')][_0x4527e5][_0x031f('0x65')])?'\x20'+_0x22d211['rules'][_0x4527e5][_0x031f('0x66')]:'');}return _0x2ddf15+')';};var _0x5a181c={'where':{'id':_0xb44c73[_0x031f('0x46')]['id']}},_0x478982,_0x2179ee,_0x534bae,_0x50d618,_0x71e67;_0x5a181c=_[_0x031f('0x40')]({},_0x5a181c,_0xb44c73[_0x031f('0x41')]);return db[_0x031f('0x2d')]['find'](_0x5a181c)['then'](function(_0x214eec){if(_0x214eec){_0x478982=_0x214eec;return _0x214eec['getFields']();}return null;})[_0x031f('0x25')](function(_0xa921b2){if(_0xa921b2){if(!_0xa921b2['length']){throw new db[(_0x031f('0x67'))][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2179ee=_0xa921b2;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5bea08){if(_0x5bea08){_0x534bae=_['keyBy'](_0x5bea08,'id');var _0x3bcc7e;var _0x232b62=squel[_0x031f('0x6b')]();_0x232b62[_0x031f('0x6c')](_0x478982[_0x031f('0x6d')]);for(var _0x26fa57=0x0;_0x26fa57<_0x2179ee[_0x031f('0x47')];_0x26fa57+=0x1){_0x3bcc7e=_0x2179ee[_0x26fa57]['MetricId']?_0x534bae[_0x2179ee[_0x26fa57]['MetricId']]['metric']:_0x2179ee[_0x26fa57]['field'];_0x3bcc7e=_0x2179ee[_0x26fa57][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xe452c2[_0x2179ee[_0x26fa57][_0x031f('0x6e')]],'%s',_0x3bcc7e):_0x3bcc7e;_0x3bcc7e=_0x2179ee[_0x26fa57]['format']?_[_0x031f('0x6f')](_0x198e2e[_0x2179ee[_0x26fa57][_0x031f('0x70')]],'%s',_0x3bcc7e):_0x3bcc7e;if(_0x2179ee[_0x26fa57]['groupBy']){_0x232b62[_0x031f('0x64')](_0x3bcc7e);}_0x2179ee[_0x26fa57][_0x031f('0x71')]&&_0x232b62[_0x031f('0x3c')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x232b62[_0x031f('0x73')](_0x3bcc7e,_0x2179ee[_0x26fa57][_0x031f('0x74')]||_0x3bcc7e);}if(_0x478982['joins']){_0x478982['joins']=JSON[_0x031f('0x75')](_0x478982['joins']);for(var _0x2ed9c1=0x0;_0x2ed9c1<_0x478982['joins'][_0x031f('0x47')];_0x2ed9c1+=0x1){if(_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]&&_['includes'](_0x21a89d,_0x478982[_0x031f('0x76')][_0x2ed9c1]['type'])&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x77')]&&_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable']&&_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]){_0x232b62[_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x30')]](_0x478982[_0x031f('0x76')][_0x2ed9c1]['foreignTable'],null,util['format'](_0x031f('0x79'),_0x478982[_0x031f('0x6d')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x77')],_0x478982['joins'][_0x2ed9c1][_0x031f('0x7a')],_0x478982[_0x031f('0x76')][_0x2ed9c1][_0x031f('0x78')]));}}}if(_0x478982[_0x031f('0x7b')]){_0x478982['conditions']=JSON[_0x031f('0x75')](_0x478982[_0x031f('0x7b')]);_0x232b62[_0x031f('0x3e')](_0x451c71(_0x478982['conditions'][_0x031f('0x64')]));}_0x71e67=_0x232b62[_0x031f('0x7c')]();_0x232b62['limit'](_0x286d4e);_0x232b62[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x232b62[_0x031f('0x7f')]());return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232b62[_0x031f('0x7f')](),{'type':dbH['sequelize'][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](respondWithResult(_0x255003,null))['catch'](handleError(_0x255003,null));};function runReport(_0x4f4aff,_0x26de7c,_0x5bd344){var _0x54f02d=_0x26de7c[_0x031f('0x2a')];var _0x184bbd=0xa;var _0x1c8055=[_0x031f('0x53'),_0x031f('0x54'),_0x031f('0x55'),_0x031f('0x83')];var _0x32c626={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':_0x031f('0x59'),'AVG':_0x031f('0x85'),'GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x6970f5={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0x031f('0x86'),'ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x510bb6=function(_0x3cfaa4){return!_[_0x031f('0x5e')]([_0x031f('0x5f'),_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x3cfaa4);};var _0x5e0853=function(_0x263658){if(!_0x263658||!_0x263658[_0x031f('0x62')]['length']){return'';}for(var _0x25ea89='(',_0x2f2e96=0x0;_0x2f2e96<_0x263658[_0x031f('0x62')][_0x031f('0x47')];_0x2f2e96+=0x1){_0x2f2e96>0x0&&(_0x25ea89+='\x20'+_0x263658[_0x031f('0x63')]+'\x20');_0x25ea89+=_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x64')]?_0x5e0853(_0x263658['rules'][_0x2f2e96][_0x031f('0x64')]):_0x263658['rules'][_0x2f2e96][_0x031f('0x73')]+'\x20'+_0x263658[_0x031f('0x62')][_0x2f2e96][_0x031f('0x65')]+(_0x510bb6(_0x263658['rules'][_0x2f2e96]['condition'])?'\x20'+_0x263658['rules'][_0x2f2e96][_0x031f('0x66')]:'');}return _0x25ea89+')';};var _0xee744={'where':{'id':_0x4f4aff['id']}},_0x8f0afd,_0x2985fe,_0x290f82,_0x307246,_0x232aa0;_0xee744=_['merge']({},_0xee744,_0x5bd344);return db['AnalyticDefaultReport'][_0x031f('0x48')](_0xee744)[_0x031f('0x25')](function(_0x54d86e){if(_0x54d86e){_0x8f0afd=_0x54d86e;return _0x54d86e[_0x031f('0x89')]();}return null;})['then'](function(_0x1c31d5){if(_0x1c31d5){if(!_0x1c31d5[_0x031f('0x47')]){throw new db['Sequelize'][(_0x031f('0x68'))](_0x031f('0x69'),0x193);}_0x2985fe=_0x1c31d5;return db['AnalyticMetric'][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x1b588e){if(_0x1b588e){_0x290f82=_['keyBy'](_0x1b588e,'id');var _0xa9b5e2;var _0x31504b=squel[_0x031f('0x6b')]();_0x31504b[_0x031f('0x6c')](_0x8f0afd[_0x031f('0x6d')]);for(var _0x2b3326=0x0;_0x2b3326<_0x2985fe['length'];_0x2b3326+=0x1){_0xa9b5e2=_0x2985fe[_0x2b3326][_0x031f('0x8a')]?_0x290f82[_0x2985fe[_0x2b3326][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x2985fe[_0x2b3326][_0x031f('0x73')];_0xa9b5e2=_0x2985fe[_0x2b3326]['function']?_[_0x031f('0x6f')](_0x32c626[_0x2985fe[_0x2b3326][_0x031f('0x6e')]],'%s',_0xa9b5e2):_0xa9b5e2;_0xa9b5e2=_0x2985fe[_0x2b3326]['format']?_[_0x031f('0x6f')](_0x6970f5[_0x2985fe[_0x2b3326][_0x031f('0x70')]],'%s',_0xa9b5e2):_0xa9b5e2;if(_0x2985fe[_0x2b3326][_0x031f('0x8c')]){_0x31504b[_0x031f('0x64')](_0xa9b5e2);}_0x2985fe[_0x2b3326][_0x031f('0x71')]&&_0x31504b[_0x031f('0x3c')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x31504b[_0x031f('0x73')](_0xa9b5e2,_0x2985fe[_0x2b3326][_0x031f('0x74')]||_0xa9b5e2);}if(_0x8f0afd[_0x031f('0x76')]){_0x8f0afd[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x76')]);for(var _0x2433ce=0x0;_0x2433ce<_0x8f0afd['joins'][_0x031f('0x47')];_0x2433ce+=0x1){if(_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0x1c8055,_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')])&&_0x8f0afd['joins'][_0x2433ce]['parentKey']&&_0x8f0afd['joins'][_0x2433ce][_0x031f('0x7a')]&&_0x8f0afd[_0x031f('0x76')][_0x2433ce]['foreignKey']){_0x31504b[_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x30')]](_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],null,util['format'](_0x031f('0x79'),_0x8f0afd[_0x031f('0x6d')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x77')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x7a')],_0x8f0afd[_0x031f('0x76')][_0x2433ce][_0x031f('0x78')]));}}}if(_0x8f0afd[_0x031f('0x7b')]){_0x8f0afd[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x8f0afd[_0x031f('0x7b')]);_0x31504b['where'](_0x5e0853(_0x8f0afd[_0x031f('0x7b')][_0x031f('0x64')]));}_0x232aa0=_0x31504b['clone']();_0x31504b[_0x031f('0x20')](_0x184bbd);_0x31504b[_0x031f('0x1d')](0x0);return;}})['then'](function(){if(_0x26de7c[_0x031f('0x8d')]===_0x031f('0x8e')){return null;}var _0x1ade73=_[_0x031f('0x40')](_0x26de7c,{'name':_0x26de7c[_0x031f('0x8f')]||_0x26de7c[_0x031f('0x2a')]||_0x8f0afd[_0x031f('0x2a')],'basename':_0x54f02d,'savename':util[_0x031f('0x70')](_0x031f('0x90'),_0x26de7c['name']||_0x8f0afd[_0x031f('0x2a')],require(_0x031f('0x91'))[_0x031f('0x92')](0x4),_0x26de7c['output']||'csv'),'reportId':_0x8f0afd['id'],'reportType':_0x031f('0x93')});return db['AnalyticExtractedReport'][_0x031f('0x49')](_0x1ade73,{'raw':!![]});})[_0x031f('0x25')](function(_0x4a96f2){if(_0x8f0afd[_0x031f('0x6d')]===_0x031f('0x94')){_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x95'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}else{_0x232aa0[_0x031f('0x3e')](_0x8f0afd[_0x031f('0x6d')]+_0x031f('0x98'),_0x26de7c[_0x031f('0x96')],_0x26de7c[_0x031f('0x97')]);}if(_0x4a96f2){logger[_0x031f('0x99')]('Run\x20Query:',_0x232aa0['toString']());require(_0x031f('0x9a'))['fork'](path[_0x031f('0x53')](__dirname,_0x031f('0x9b'),_0x4a96f2[_0x031f('0x8d')]),[_0x4a96f2['id'],_0x232aa0['toString'](),path[_0x031f('0x53')](__dirname,_0x031f('0x9c'),_0x4a96f2['savename']),_0x54f02d]);return _0x4a96f2;}else{var _0x185085=squel[_0x031f('0x6b')]();_0x185085[_0x031f('0x6c')]('('+_0x232aa0[_0x031f('0x7f')]()+')',_0x031f('0x9d'));_0x185085[_0x031f('0x73')](_0x031f('0x9e'),'count');_0x232aa0[_0x031f('0x20')](_0x26de7c[_0x031f('0x20')]||_0x184bbd);_0x232aa0[_0x031f('0x1d')](_0x26de7c[_0x031f('0x1d')]||0x0);return dbH['sequelize']['query'](_0x185085[_0x031f('0x7f')](),{'type':dbH['sequelize']['QueryTypes'][_0x031f('0x82')]})['then'](function(_0x579ade){if(!_0x579ade[_0x031f('0x47')]){_0x307246=0x0;}else{_0x307246=_0x579ade[0x0][_0x031f('0x1f')]||0x0;}return dbH[_0x031f('0x80')][_0x031f('0x34')](_0x232aa0[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')]['QueryTypes'][_0x031f('0x82')]});})[_0x031f('0x25')](function(_0x52a3f0){return{'rows':_0x52a3f0||[],'count':_0x307246};});}});}exports[_0x031f('0x9f')]=function(_0x355e1a,_0x30c32f){return runReport(_0x355e1a[_0x031f('0x46')],_0x355e1a['query'],_0x355e1a['options'])['then'](respondWithResult(_0x30c32f,null))[_0x031f('0x45')](handleError(_0x30c32f,null));};exports[_0x031f('0xa0')]=runReport;exports[_0x031f('0x34')]=function(_0x3ec98a,_0x3ed663){var _0xac324f=0xa;var _0xcf0af9=[_0x031f('0x53'),_0x031f('0x54'),'right_join',_0x031f('0x83')];var _0xde544e={'SUM':_0x031f('0x56'),'COUNT':_0x031f('0x57'),'COUNT DISTINCT':_0x031f('0x84'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':'AVG(%s)','GROUP_CONCAT':_0x031f('0x5a'),'GROUP_CONCAT ASC':_0x031f('0x5b'),'GROUP_CONCAT DESC':_0x031f('0x5c')};var _0x84cd0c={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x031f('0xa1'),'HOUR':'HOUR(%s)','ROUND':_0x031f('0x87'),'UNIX_TIMESTAMP':_0x031f('0x5d')};var _0x24aff3=function(_0x35a1f1){return!_[_0x031f('0x5e')](['IS\x20NULL',_0x031f('0x88'),_0x031f('0x60'),_0x031f('0x61')],_0x35a1f1);};var _0x3cb099=function(_0x4a4d8f){if(!_0x4a4d8f||!_0x4a4d8f[_0x031f('0x62')][_0x031f('0x47')]){return'';}for(var _0x578201='(',_0xdbf09f=0x0;_0xdbf09f<_0x4a4d8f['rules'][_0x031f('0x47')];_0xdbf09f+=0x1){_0xdbf09f>0x0&&(_0x578201+='\x20'+_0x4a4d8f[_0x031f('0x63')]+'\x20');_0x578201+=_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x64')]?_0x3cb099(_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['group']):_0x4a4d8f[_0x031f('0x62')][_0xdbf09f]['field']+'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x65')]+(_0x24aff3(_0x4a4d8f['rules'][_0xdbf09f][_0x031f('0x65')])?'\x20'+_0x4a4d8f[_0x031f('0x62')][_0xdbf09f][_0x031f('0x66')]:'');}return _0x578201+')';};var _0x123b4d={'where':{'id':_0x3ec98a['params']['id']}},_0x3f80b5,_0x53cd67,_0x516f11,_0x50cdb2,_0x2e9a3b;_0x123b4d=_[_0x031f('0x40')]({},_0x123b4d,_0x3ec98a[_0x031f('0x41')]);return db[_0x031f('0x2d')][_0x031f('0x48')](_0x123b4d)[_0x031f('0x25')](function(_0x53911d){if(_0x53911d){_0x3f80b5=_0x53911d;return _0x53911d[_0x031f('0x89')]();}return null;})['then'](function(_0x30fa18){if(_0x30fa18){if(!_0x30fa18[_0x031f('0x47')]){throw new db[(_0x031f('0x67'))]['ValidationErrorItem'](_0x031f('0x69'),0x193);}_0x53cd67=_0x30fa18;return db[_0x031f('0x6a')][_0x031f('0x43')]({'raw':!![]});}return null;})[_0x031f('0x25')](function(_0x5b092c){if(_0x5b092c){_0x516f11=_[_0x031f('0xa2')](_0x5b092c,'id');var _0x7b8699;var _0x14a497=squel[_0x031f('0x6b')]();_0x14a497[_0x031f('0x6c')](_0x3f80b5[_0x031f('0x6d')]);for(var _0x59fd9a=0x0;_0x59fd9a<_0x53cd67[_0x031f('0x47')];_0x59fd9a+=0x1){_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x8a')]?_0x516f11[_0x53cd67[_0x59fd9a][_0x031f('0x8a')]][_0x031f('0x8b')]:_0x53cd67[_0x59fd9a][_0x031f('0x73')];_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x6e')]?_[_0x031f('0x6f')](_0xde544e[_0x53cd67[_0x59fd9a]['function']],'%s',_0x7b8699):_0x7b8699;_0x7b8699=_0x53cd67[_0x59fd9a][_0x031f('0x70')]?_[_0x031f('0x6f')](_0x84cd0c[_0x53cd67[_0x59fd9a][_0x031f('0x70')]],'%s',_0x7b8699):_0x7b8699;if(_0x53cd67[_0x59fd9a][_0x031f('0x8c')]){_0x14a497[_0x031f('0x64')](_0x7b8699);}_0x53cd67[_0x59fd9a]['orderBy']&&_0x14a497[_0x031f('0x3c')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x71')]===_0x031f('0x72')?![]:!![]);_0x14a497[_0x031f('0x73')](_0x7b8699,_0x53cd67[_0x59fd9a][_0x031f('0x74')]||_0x7b8699);}if(_0x3f80b5['joins']){_0x3f80b5[_0x031f('0x76')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x76')]);for(var _0x110747=0x0;_0x110747<_0x3f80b5[_0x031f('0x76')]['length'];_0x110747+=0x1){if(_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]&&_[_0x031f('0x5e')](_0xcf0af9,_0x3f80b5['joins'][_0x110747][_0x031f('0x30')])&&_0x3f80b5['joins'][_0x110747][_0x031f('0x77')]&&_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')]&&_0x3f80b5[_0x031f('0x76')][_0x110747]['foreignKey']){_0x14a497[_0x3f80b5['joins'][_0x110747][_0x031f('0x30')]](_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x7a')],null,util[_0x031f('0x70')]('%s.%s\x20=\x20%s.%s',_0x3f80b5[_0x031f('0x6d')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x77')],_0x3f80b5['joins'][_0x110747][_0x031f('0x7a')],_0x3f80b5[_0x031f('0x76')][_0x110747][_0x031f('0x78')]));}}}if(_0x3f80b5['conditions']){_0x3f80b5[_0x031f('0x7b')]=JSON[_0x031f('0x75')](_0x3f80b5[_0x031f('0x7b')]);_0x14a497[_0x031f('0x3e')](_0x3cb099(_0x3f80b5[_0x031f('0x7b')]['group']));}_0x2e9a3b=_0x14a497[_0x031f('0x7c')]();_0x14a497[_0x031f('0x20')](_0xac324f);_0x14a497[_0x031f('0x1d')](0x0);logger[_0x031f('0x7d')](_0x031f('0x7e'),_0x14a497[_0x031f('0x7f')]());return dbH['sequelize']['query'](_0x14a497[_0x031f('0x7f')](),{'type':dbH[_0x031f('0x80')][_0x031f('0x81')][_0x031f('0x82')]});}})[_0x031f('0x25')](function(){return{'sql':_0x2e9a3b[_0x031f('0x7f')]()};})[_0x031f('0x25')](respondWithResult(_0x3ed663,null))['catch'](handleError(_0x3ed663,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index 99f74fa..f41a8c3 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 _0xc01a=['bluebird','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','../../config/logger','api','moment'];(function(_0x4a6284,_0x3335bb){var _0x2f6bbc=function(_0xc16b56){while(--_0xc16b56){_0x4a6284['push'](_0x4a6284['shift']());}};_0x2f6bbc(++_0x3335bb);}(_0xc01a,0x1a9));var _0xac01=function(_0x152c02,_0x2b970f){_0x152c02=_0x152c02-0x0;var _0x3e4b32=_0xc01a[_0x152c02];return _0x3e4b32;};'use strict';var _=require(_0xac01('0x0'));var util=require('util');var logger=require(_0xac01('0x1'))(_0xac01('0x2'));var moment=require(_0xac01('0x3'));var BPromise=require(_0xac01('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xac01('0x5'));var rimraf=require(_0xac01('0x6'));var config=require(_0xac01('0x7'));var attributes=require(_0xac01('0x8'));module[_0xac01('0x9')]=function(_0xcf9410,_0x3ec819){return _0xcf9410[_0xac01('0xa')](_0xac01('0xb'),attributes,{'tableName':_0xac01('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8835=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes','exports','define','analytics_default_reports'];(function(_0x835f74,_0x123452){var _0x46a4d6=function(_0x5b7adc){while(--_0x5b7adc){_0x835f74['push'](_0x835f74['shift']());}};_0x46a4d6(++_0x123452);}(_0x8835,0x70));var _0x5883=function(_0x582b54,_0x54f75a){_0x582b54=_0x582b54-0x0;var _0x1b1cec=_0x8835[_0x582b54];return _0x1b1cec;};'use strict';var _=require(_0x5883('0x0'));var util=require(_0x5883('0x1'));var logger=require(_0x5883('0x2'))(_0x5883('0x3'));var moment=require(_0x5883('0x4'));var BPromise=require(_0x5883('0x5'));var rp=require(_0x5883('0x6'));var fs=require('fs');var path=require(_0x5883('0x7'));var rimraf=require(_0x5883('0x8'));var config=require(_0x5883('0x9'));var attributes=require(_0x5883('0xa'));module[_0x5883('0xb')]=function(_0x1268a7,_0x2d7630){return _0x1268a7[_0x5883('0xc')]('AnalyticDefaultReport',attributes,{'tableName':_0x5883('0xd'),'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 ed58778..eb55a2b 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 _0xa7e8=['../../mysqldb','../../config/utils','../../config/environment','client','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','randomstring','ioredis'];(function(_0x2389bc,_0x167cd2){var _0x170548=function(_0x2da7f2){while(--_0x2da7f2){_0x2389bc['push'](_0x2389bc['shift']());}};_0x170548(++_0x167cd2);}(_0xa7e8,0x176));var _0x8a7e=function(_0x5cb735,_0xf92c9){_0x5cb735=_0x5cb735-0x0;var _0x5c3ec0=_0xa7e8[_0x5cb735];return _0x5c3ec0;};'use strict';var _=require(_0x8a7e('0x0'));var util=require('util');var moment=require(_0x8a7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x8a7e('0x2'));var fs=require('fs');var Redis=require(_0x8a7e('0x3'));var db=require(_0x8a7e('0x4'))['db'];var utils=require(_0x8a7e('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x8a7e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x8a7e('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56afbe,_0x257ada,_0x1bfaa2){return new BPromise(function(_0x4e340c,_0xa803ea){return client[_0x8a7e('0x8')](_0x56afbe,_0x1bfaa2)[_0x8a7e('0x9')](function(_0x243216){logger[_0x8a7e('0xa')](_0x8a7e('0xb'),_0x257ada,_0x8a7e('0xc'));logger[_0x8a7e('0xd')](_0x8a7e('0xe'),_0x257ada,_0x8a7e('0xc'),JSON['stringify'](_0x243216));if(_0x243216[_0x8a7e('0xf')]){if(_0x243216['error']['code']===0x1f4){logger['error'](_0x8a7e('0xb'),_0x257ada,_0x243216[_0x8a7e('0xf')]['message']);return _0xa803ea(_0x243216[_0x8a7e('0xf')]['message']);}logger[_0x8a7e('0xf')](_0x8a7e('0xb'),_0x257ada,_0x243216[_0x8a7e('0xf')][_0x8a7e('0x10')]);return _0x4e340c(_0x243216[_0x8a7e('0xf')]['message']);}else{logger[_0x8a7e('0xa')](_0x8a7e('0xb'),_0x257ada,_0x8a7e('0xc'));_0x4e340c(_0x243216[_0x8a7e('0x11')]['message']);}})['catch'](function(_0x3a6824){logger[_0x8a7e('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x257ada,_0x3a6824);_0xa803ea(_0x3a6824);});});} \ No newline at end of file +var _0x4c87=['randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticDefaultReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird'];(function(_0x1beef3,_0x57c4b8){var _0x5af964=function(_0x36f463){while(--_0x36f463){_0x1beef3['push'](_0x1beef3['shift']());}};_0x5af964(++_0x57c4b8);}(_0x4c87,0x1b2));var _0x74c8=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4c87[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x74c8('0x0'));var util=require(_0x74c8('0x1'));var moment=require('moment');var BPromise=require(_0x74c8('0x2'));var rs=require(_0x74c8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x74c8('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x74c8('0x5'));var jayson=require(_0x74c8('0x6'));var client=jayson[_0x74c8('0x7')][_0x74c8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf93888,_0x253b65,_0x4bccda){return new BPromise(function(_0x26078f,_0x2b2840){return client['request'](_0xf93888,_0x4bccda)['then'](function(_0xae2f05){logger[_0x74c8('0x9')](_0x74c8('0xa'),_0x253b65,_0x74c8('0xb'));logger[_0x74c8('0xc')](_0x74c8('0xd'),_0x253b65,_0x74c8('0xb'),JSON[_0x74c8('0xe')](_0xae2f05));if(_0xae2f05[_0x74c8('0xf')]){if(_0xae2f05['error'][_0x74c8('0x10')]===0x1f4){logger[_0x74c8('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x253b65,_0xae2f05[_0x74c8('0xf')][_0x74c8('0x11')]);return _0x2b2840(_0xae2f05[_0x74c8('0xf')][_0x74c8('0x11')]);}logger[_0x74c8('0xf')](_0x74c8('0xa'),_0x253b65,_0xae2f05[_0x74c8('0xf')][_0x74c8('0x11')]);return _0x26078f(_0xae2f05[_0x74c8('0xf')]['message']);}else{logger[_0x74c8('0x9')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x253b65,_0x74c8('0xb'));_0x26078f(_0xae2f05[_0x74c8('0x12')][_0x74c8('0x11')]);}})['catch'](function(_0x56e768){logger[_0x74c8('0xf')](_0x74c8('0xa'),_0x253b65,_0x56e768);_0x2b2840(_0x56e768);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index 92af156..258069b 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 _0x8b6b=['update','delete','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','show','preview','/:id/run','run','/:id/query','post','create','put','/:id'];(function(_0x17e69b,_0x512806){var _0x55eea8=function(_0x510384){while(--_0x510384){_0x17e69b['push'](_0x17e69b['shift']());}};_0x55eea8(++_0x512806);}(_0x8b6b,0x13d));var _0xb8b6=function(_0x8841d8,_0x189df0){_0x8841d8=_0x8841d8-0x0;var _0x68567b=_0x8b6b[_0x8841d8];return _0x68567b;};'use strict';var multer=require('multer');var util=require(_0xb8b6('0x0'));var path=require(_0xb8b6('0x1'));var timeout=require(_0xb8b6('0x2'));var express=require(_0xb8b6('0x3'));var router=express[_0xb8b6('0x4')]();var fs_extra=require(_0xb8b6('0x5'));var auth=require(_0xb8b6('0x6'));var interaction=require(_0xb8b6('0x7'));var config=require('../../config/environment');var controller=require('./analyticDefaultReport.controller');router[_0xb8b6('0x8')]('/',auth[_0xb8b6('0x9')](),controller['index']);router[_0xb8b6('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb8b6('0xa')]);router[_0xb8b6('0x8')]('/:id/preview',auth[_0xb8b6('0x9')](),controller[_0xb8b6('0xb')]);router[_0xb8b6('0x8')](_0xb8b6('0xc'),auth[_0xb8b6('0x9')](),controller[_0xb8b6('0xd')]);router['get'](_0xb8b6('0xe'),auth[_0xb8b6('0x9')](),controller['query']);router[_0xb8b6('0xf')]('/',auth[_0xb8b6('0x9')](),controller[_0xb8b6('0x10')]);router[_0xb8b6('0x11')](_0xb8b6('0x12'),auth[_0xb8b6('0x9')](),controller[_0xb8b6('0x13')]);router[_0xb8b6('0x14')](_0xb8b6('0x12'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x4cf1=['get','isAuthenticated','index','show','/:id/preview','preview','/:id/run','/:id/query','query','post','create','put','/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x560057,_0x49195f){var _0x553f8b=function(_0x1cec3){while(--_0x1cec3){_0x560057['push'](_0x560057['shift']());}};_0x553f8b(++_0x49195f);}(_0x4cf1,0x13c));var _0x14cf=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x4cf1[_0x51020b];return _0x371e47;};'use strict';var multer=require('multer');var util=require(_0x14cf('0x0'));var path=require(_0x14cf('0x1'));var timeout=require(_0x14cf('0x2'));var express=require(_0x14cf('0x3'));var router=express[_0x14cf('0x4')]();var fs_extra=require(_0x14cf('0x5'));var auth=require(_0x14cf('0x6'));var interaction=require(_0x14cf('0x7'));var config=require(_0x14cf('0x8'));var controller=require('./analyticDefaultReport.controller');router[_0x14cf('0x9')]('/',auth[_0x14cf('0xa')](),controller[_0x14cf('0xb')]);router[_0x14cf('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x14cf('0xc')]);router[_0x14cf('0x9')](_0x14cf('0xd'),auth[_0x14cf('0xa')](),controller[_0x14cf('0xe')]);router['get'](_0x14cf('0xf'),auth[_0x14cf('0xa')](),controller['run']);router[_0x14cf('0x9')](_0x14cf('0x10'),auth[_0x14cf('0xa')](),controller[_0x14cf('0x11')]);router[_0x14cf('0x12')]('/',auth[_0x14cf('0xa')](),controller[_0x14cf('0x13')]);router[_0x14cf('0x14')](_0x14cf('0x15'),auth[_0x14cf('0xa')](),controller[_0x14cf('0x16')]);router[_0x14cf('0x17')](_0x14cf('0x15'),auth[_0x14cf('0xa')](),controller['destroy']);module[_0x14cf('0x18')]=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index 151afe1..9d3a4fe 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 _0xfa59=['manual','scheduled','INTEGER','UNSIGNED','sequelize','exports','STRING','ENUM','csv','xlsx','DATE','Loading'];(function(_0x4144da,_0x5a052f){var _0x284011=function(_0x10c13a){while(--_0x10c13a){_0x4144da['push'](_0x4144da['shift']());}};_0x284011(++_0x5a052f);}(_0xfa59,0x130));var _0x9fa5=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xfa59[_0x21a9d9];return _0x46adce;};'use strict';var Sequelize=require(_0x9fa5('0x0'));var moment=require('moment');module[_0x9fa5('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x9fa5('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x9fa5('0x3')](_0x9fa5('0x4'),'pdf',_0x9fa5('0x5')),'allowNull':![],'defaultValue':_0x9fa5('0x4')},'savename':{'type':Sequelize[_0x9fa5('0x2')],'allowNull':![]},'startDate':{'type':Sequelize['DATE']},'endDate':{'type':Sequelize[_0x9fa5('0x6')]},'status':{'type':Sequelize[_0x9fa5('0x2')],'defaultValue':_0x9fa5('0x7')},'type':{'type':Sequelize[_0x9fa5('0x3')](_0x9fa5('0x8'),_0x9fa5('0x9')),'allowNull':![],'defaultValue':'manual'},'reportId':{'type':Sequelize[_0x9fa5('0xa')](0xb)[_0x9fa5('0xb')]},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3315=['UNSIGNED','sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual','scheduled','INTEGER'];(function(_0x41f8ce,_0x57df14){var _0x2e2ac3=function(_0x40733a){while(--_0x40733a){_0x41f8ce['push'](_0x41f8ce['shift']());}};_0x2e2ac3(++_0x57df14);}(_0x3315,0x127));var _0x5331=function(_0x58dcdc,_0x35b327){_0x58dcdc=_0x58dcdc-0x0;var _0x238077=_0x3315[_0x58dcdc];return _0x238077;};'use strict';var Sequelize=require(_0x5331('0x0'));var moment=require(_0x5331('0x1'));module[_0x5331('0x2')]={'name':{'type':Sequelize[_0x5331('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0x5331('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0x5331('0x4')](_0x5331('0x5'),_0x5331('0x6'),_0x5331('0x7')),'allowNull':![],'defaultValue':_0x5331('0x5')},'savename':{'type':Sequelize[_0x5331('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0x5331('0x8')]},'endDate':{'type':Sequelize[_0x5331('0x8')]},'status':{'type':Sequelize[_0x5331('0x3')],'defaultValue':_0x5331('0x9')},'type':{'type':Sequelize[_0x5331('0x4')](_0x5331('0xa'),_0x5331('0xb')),'allowNull':![],'defaultValue':_0x5331('0xa')},'reportId':{'type':Sequelize[_0x5331('0xc')](0xb)[_0x5331('0xd')]},'reportType':{'type':Sequelize[_0x5331('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index fa4a1fb..8d9ecfa 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 _0xaa90=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','download','basename','savename','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','format','output','toLowerCase','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','apply','save','update','then','destroy','get','ExtractedReports','UserProfileResource','stack','name','send','map','AnalyticExtractedReport','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','rows','catch','show','rawAttributes','intersection','includeAll','find'];(function(_0x19f5c5,_0xea21a4){var _0xab7e93=function(_0x26fb5d){while(--_0x26fb5d){_0x19f5c5['push'](_0x19f5c5['shift']());}};_0xab7e93(++_0xea21a4);}(_0xaa90,0x1e8));var _0x0aa9=function(_0x1565c0,_0x2c4d33){_0x1565c0=_0x1565c0-0x0;var _0x5ce681=_0xaa90[_0x1565c0];return _0x5ce681;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0aa9('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0aa9('0x1'));var rp=require(_0x0aa9('0x2'));var moment=require(_0x0aa9('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0aa9('0x4'));var util=require(_0x0aa9('0x5'));var path=require(_0x0aa9('0x6'));var sox=require('sox');var csv=require(_0x0aa9('0x7'));var ejs=require(_0x0aa9('0x8'));var fs=require('fs');var fs_extra=require(_0x0aa9('0x9'));var _=require(_0x0aa9('0xa'));var squel=require(_0x0aa9('0xb'));var crypto=require(_0x0aa9('0xc'));var jsforce=require(_0x0aa9('0xd'));var deskjs=require(_0x0aa9('0xe'));var toCsv=require(_0x0aa9('0x7'));var querystring=require(_0x0aa9('0xf'));var Papa=require('papaparse');var Redis=require(_0x0aa9('0x10'));var authService=require(_0x0aa9('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0aa9('0x12'));var logger=require(_0x0aa9('0x13'))('api');var utils=require(_0x0aa9('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0aa9('0x15'));var db=require(_0x0aa9('0x16'))['db'];function respondWithStatusCode(_0x496708,_0x4861d3){_0x4861d3=_0x4861d3||0xcc;return function(_0x3f9019){if(_0x3f9019){return _0x496708[_0x0aa9('0x17')](_0x4861d3);}return _0x496708[_0x0aa9('0x18')](_0x4861d3)[_0x0aa9('0x19')]();};}function respondWithResult(_0x48b06f,_0x49af1c){_0x49af1c=_0x49af1c||0xc8;return function(_0x4f1ad8){if(_0x4f1ad8){return _0x48b06f[_0x0aa9('0x18')](_0x49af1c)['json'](_0x4f1ad8);}};}function respondWithFilteredResult(_0xb86703,_0x581250){return function(_0x4bea1b){if(_0x4bea1b){var _0x27ec04=typeof _0x581250['offset']===_0x0aa9('0x1a')&&typeof _0x581250[_0x0aa9('0x1b')]==='undefined';var _0x280dee=_0x4bea1b['count'];var _0x4108d9=_0x27ec04?0x0:_0x581250[_0x0aa9('0x1c')];var _0x3d7ad3=_0x27ec04?_0x4bea1b[_0x0aa9('0x1d')]:_0x581250[_0x0aa9('0x1c')]+_0x581250[_0x0aa9('0x1b')];var _0x231c1e;if(_0x3d7ad3>=_0x280dee){_0x3d7ad3=_0x280dee;_0x231c1e=0xc8;}else{_0x231c1e=0xce;}_0xb86703['status'](_0x231c1e);return _0xb86703['set'](_0x0aa9('0x1e'),_0x4108d9+'-'+_0x3d7ad3+'/'+_0x280dee)['json'](_0x4bea1b);}return null;};}function patchUpdates(_0x2262e2){return function(_0x4567ad){try{jsonpatch[_0x0aa9('0x1f')](_0x4567ad,_0x2262e2,!![]);}catch(_0x3bf51a){return BPromise['reject'](_0x3bf51a);}return _0x4567ad[_0x0aa9('0x20')]();};}function saveUpdates(_0x28d46a,_0x53b636){return function(_0x5af363){if(_0x5af363){return _0x5af363[_0x0aa9('0x21')](_0x28d46a)[_0x0aa9('0x22')](function(_0x4d32e4){return _0x4d32e4;});}return null;};}function removeEntity(_0x20e2b5,_0x3c7681){return function(_0x909541){if(_0x909541){return _0x909541[_0x0aa9('0x23')]()[_0x0aa9('0x22')](function(){var _0x1c5725=_0x909541[_0x0aa9('0x24')]({'plain':!![]});var _0x1a8b73=_0x0aa9('0x25');return db[_0x0aa9('0x26')][_0x0aa9('0x23')]({'where':{'type':_0x1a8b73,'resourceId':_0x1c5725['id']}})[_0x0aa9('0x22')](function(){return _0x909541;});})[_0x0aa9('0x22')](function(){_0x20e2b5['status'](0xcc)[_0x0aa9('0x19')]();});}};}function handleEntityNotFound(_0x1ff222,_0x15574c){return function(_0x567368){if(!_0x567368){_0x1ff222[_0x0aa9('0x17')](0x194);}return _0x567368;};}function handleError(_0x4203eb,_0x1deae2){_0x1deae2=_0x1deae2||0x1f4;return function(_0x169818){logger['error'](_0x169818[_0x0aa9('0x27')]);if(_0x169818[_0x0aa9('0x28')]){delete _0x169818[_0x0aa9('0x28')];}_0x4203eb['status'](_0x1deae2)[_0x0aa9('0x29')](_0x169818);};}exports['index']=function(_0x3f6561,_0x4fe790){var _0x2a8c4b={},_0x38d4cc={},_0x13f018={'count':0x0,'rows':[]};var _0x1f501b=_[_0x0aa9('0x2a')](db[_0x0aa9('0x2b')]['rawAttributes'],function(_0x9b9b89){return{'name':_0x9b9b89[_0x0aa9('0x2c')],'type':_0x9b9b89[_0x0aa9('0x2d')][_0x0aa9('0x2e')]};});_0x38d4cc[_0x0aa9('0x2f')]=_['map'](_0x1f501b,_0x0aa9('0x28'));_0x38d4cc[_0x0aa9('0x30')]=_[_0x0aa9('0x31')](_0x3f6561['query']);_0x38d4cc[_0x0aa9('0x32')]=_['intersection'](_0x38d4cc[_0x0aa9('0x2f')],_0x38d4cc[_0x0aa9('0x30')]);_0x2a8c4b['attributes']=_['intersection'](_0x38d4cc[_0x0aa9('0x2f')],qs[_0x0aa9('0x33')](_0x3f6561[_0x0aa9('0x30')][_0x0aa9('0x33')]));_0x2a8c4b['attributes']=_0x2a8c4b[_0x0aa9('0x34')][_0x0aa9('0x35')]?_0x2a8c4b[_0x0aa9('0x34')]:_0x38d4cc['model'];if(!_0x3f6561[_0x0aa9('0x30')][_0x0aa9('0x36')](_0x0aa9('0x37'))){_0x2a8c4b[_0x0aa9('0x1b')]=qs['limit'](_0x3f6561[_0x0aa9('0x30')]['limit']);_0x2a8c4b['offset']=qs['offset'](_0x3f6561[_0x0aa9('0x30')][_0x0aa9('0x1c')]);}_0x2a8c4b[_0x0aa9('0x38')]=qs[_0x0aa9('0x39')](_0x3f6561['query'][_0x0aa9('0x39')]);_0x2a8c4b[_0x0aa9('0x3a')]=qs['filters'](_[_0x0aa9('0x3b')](_0x3f6561[_0x0aa9('0x30')],_0x38d4cc[_0x0aa9('0x32')]),_0x1f501b);if(_0x3f6561[_0x0aa9('0x30')][_0x0aa9('0x3c')]){_0x2a8c4b[_0x0aa9('0x3a')]=_['merge'](_0x2a8c4b[_0x0aa9('0x3a')],{'$or':_['map'](_0x1f501b,function(_0x5a244a){if(_0x5a244a[_0x0aa9('0x2d')]!==_0x0aa9('0x3d')){var _0x239513={};_0x239513[_0x5a244a[_0x0aa9('0x28')]]={'$like':'%'+_0x3f6561['query'][_0x0aa9('0x3c')]+'%'};return _0x239513;}})});}_0x2a8c4b=_[_0x0aa9('0x3e')]({},_0x2a8c4b,_0x3f6561['options']);var _0x12c8d0={'where':_0x2a8c4b[_0x0aa9('0x3a')]};return db[_0x0aa9('0x2b')][_0x0aa9('0x1d')](_0x12c8d0)[_0x0aa9('0x22')](function(_0x1cb4ef){_0x13f018[_0x0aa9('0x1d')]=_0x1cb4ef;if(_0x3f6561[_0x0aa9('0x30')]['includeAll']){_0x2a8c4b['include']=[{'all':!![]}];}return db['AnalyticExtractedReport']['findAll'](_0x2a8c4b);})[_0x0aa9('0x22')](function(_0x174b77){_0x13f018[_0x0aa9('0x3f')]=_0x174b77;return _0x13f018;})['then'](respondWithFilteredResult(_0x4fe790,_0x2a8c4b))[_0x0aa9('0x40')](handleError(_0x4fe790,null));};exports[_0x0aa9('0x41')]=function(_0x4df96a,_0xbe18a){var _0x2b4499={'raw':!![],'where':{'id':_0x4df96a['params']['id']}},_0x5017cb={};_0x5017cb[_0x0aa9('0x2f')]=_[_0x0aa9('0x31')](db[_0x0aa9('0x2b')][_0x0aa9('0x42')]);_0x5017cb[_0x0aa9('0x30')]=_['keys'](_0x4df96a[_0x0aa9('0x30')]);_0x5017cb[_0x0aa9('0x32')]=_[_0x0aa9('0x43')](_0x5017cb[_0x0aa9('0x2f')],_0x5017cb[_0x0aa9('0x30')]);_0x2b4499['attributes']=_[_0x0aa9('0x43')](_0x5017cb[_0x0aa9('0x2f')],qs[_0x0aa9('0x33')](_0x4df96a[_0x0aa9('0x30')][_0x0aa9('0x33')]));_0x2b4499[_0x0aa9('0x34')]=_0x2b4499[_0x0aa9('0x34')]['length']?_0x2b4499[_0x0aa9('0x34')]:_0x5017cb[_0x0aa9('0x2f')];if(_0x4df96a[_0x0aa9('0x30')][_0x0aa9('0x44')]){_0x2b4499['include']=[{'all':!![]}];}_0x2b4499=_[_0x0aa9('0x3e')]({},_0x2b4499,_0x4df96a['options']);return db['AnalyticExtractedReport'][_0x0aa9('0x45')](_0x2b4499)[_0x0aa9('0x22')](handleEntityNotFound(_0xbe18a,null))[_0x0aa9('0x22')](respondWithResult(_0xbe18a,null))['catch'](handleError(_0xbe18a,null));};exports[_0x0aa9('0x46')]=function(_0xb7f945,_0x3a7b1a){return db['AnalyticExtractedReport']['create'](_0xb7f945[_0x0aa9('0x47')],{})[_0x0aa9('0x22')](function(_0x1f3b67){var _0x1ef45e=_0xb7f945[_0x0aa9('0x48')][_0x0aa9('0x24')]({'plain':!![]});if(!_0x1ef45e)throw new Error(_0x0aa9('0x49'));if(_0x1ef45e['role']===_0x0aa9('0x48')){var _0x4f4645=_0x1f3b67[_0x0aa9('0x24')]({'plain':!![]});var _0x5d777d=_0x0aa9('0x25');return db[_0x0aa9('0x4a')][_0x0aa9('0x45')]({'where':{'name':_0x5d777d,'userProfileId':_0x1ef45e[_0x0aa9('0x4b')]},'raw':!![]})[_0x0aa9('0x22')](function(_0xdc89f3){if(_0xdc89f3&&_0xdc89f3[_0x0aa9('0x4c')]===0x0){return db['UserProfileResource'][_0x0aa9('0x46')]({'name':_0x4f4645[_0x0aa9('0x28')],'resourceId':_0x4f4645['id'],'type':_0xdc89f3['name'],'sectionId':_0xdc89f3['id']},{})[_0x0aa9('0x22')](function(){return _0x1f3b67;});}else{return _0x1f3b67;}})['catch'](function(_0x422f07){logger[_0x0aa9('0x4d')](_0x0aa9('0x4e'),_0x422f07);throw _0x422f07;});}return _0x1f3b67;})[_0x0aa9('0x22')](respondWithResult(_0x3a7b1a,0xc9))[_0x0aa9('0x40')](handleError(_0x3a7b1a,null));};exports[_0x0aa9('0x21')]=function(_0x5ec067,_0x27d330){if(_0x5ec067[_0x0aa9('0x47')]['id']){delete _0x5ec067['body']['id'];}return db[_0x0aa9('0x2b')][_0x0aa9('0x45')]({'where':{'id':_0x5ec067['params']['id']}})[_0x0aa9('0x22')](handleEntityNotFound(_0x27d330,null))[_0x0aa9('0x22')](saveUpdates(_0x5ec067['body'],null))[_0x0aa9('0x22')](respondWithResult(_0x27d330,null))[_0x0aa9('0x40')](handleError(_0x27d330,null));};exports[_0x0aa9('0x23')]=function(_0x208f61,_0x1252ab){return db[_0x0aa9('0x2b')][_0x0aa9('0x45')]({'where':{'id':_0x208f61[_0x0aa9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x1252ab,null))[_0x0aa9('0x22')](removeEntity(_0x1252ab,null))['catch'](handleError(_0x1252ab,null));};exports[_0x0aa9('0x50')]=function(_0x3bf594,_0x38b32f,_0x27e6bc){return db[_0x0aa9('0x2b')][_0x0aa9('0x45')]({'where':{'id':_0x3bf594[_0x0aa9('0x4f')]['id']},'attributes':[_0x0aa9('0x28'),_0x0aa9('0x51'),_0x0aa9('0x52'),'output'],'raw':!![]})[_0x0aa9('0x22')](handleEntityNotFound(_0x38b32f,null))['then'](function(_0x3c8385){if(_0x3c8385){if(!fs['existsSync'](path[_0x0aa9('0x53')](config[_0x0aa9('0x54')],_0x0aa9('0x55'),_0x3c8385[_0x0aa9('0x52')]))){throw new db[(_0x0aa9('0x56'))][(_0x0aa9('0x57'))](_0x0aa9('0x58'));}if(_0x3bf594[_0x0aa9('0x30')][_0x0aa9('0x59')]){return _0x38b32f[_0x0aa9('0x17')](0xc8);}return _0x38b32f[_0x0aa9('0x50')](path[_0x0aa9('0x53')](config[_0x0aa9('0x54')],_0x0aa9('0x55'),_0x3c8385[_0x0aa9('0x52')]),util[_0x0aa9('0x5a')]('%s.%s',_0x3c8385[_0x0aa9('0x51')]||_0x3c8385['name'],_0x3c8385[_0x0aa9('0x5b')][_0x0aa9('0x5c')]()));}})[_0x0aa9('0x40')](handleError(_0x38b32f,null));}; \ No newline at end of file +var _0x94dc=['intersection','includeAll','find','create','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','basename','savename','existsSync','join','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','download','root','format','%s.%s','output','toLowerCase','rimraf','mustache','to-csv','ejs','fs-extra','lodash','crypto','jsforce','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','Content-Range','apply','reject','save','update','then','destroy','ExtractedReports','error','stack','name','send','map','AnalyticExtractedReport','rawAttributes','fieldName','key','query','filters','model','attributes','fields','length','nolimit','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','keys'];(function(_0x5ef3cd,_0x2d0b15){var _0x414d12=function(_0x584cd4){while(--_0x584cd4){_0x5ef3cd['push'](_0x5ef3cd['shift']());}};_0x414d12(++_0x2d0b15);}(_0x94dc,0x77));var _0xc94d=function(_0x4279b2,_0x441ba9){_0x4279b2=_0x4279b2-0x0;var _0x514057=_0x94dc[_0x4279b2];return _0x514057;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc94d('0x0'));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(_0xc94d('0x1'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xc94d('0x2'));var ejs=require(_0xc94d('0x3'));var fs=require('fs');var fs_extra=require(_0xc94d('0x4'));var _=require(_0xc94d('0x5'));var squel=require('squel');var crypto=require(_0xc94d('0x6'));var jsforce=require(_0xc94d('0x7'));var deskjs=require('desk.js');var toCsv=require(_0xc94d('0x2'));var querystring=require(_0xc94d('0x8'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc94d('0x9'));var qs=require(_0xc94d('0xa'));var as=require(_0xc94d('0xb'));var hardwareService=require(_0xc94d('0xc'));var logger=require('../../config/logger')(_0xc94d('0xd'));var utils=require(_0xc94d('0xe'));var config=require(_0xc94d('0xf'));var licenseUtil=require(_0xc94d('0x10'));var db=require(_0xc94d('0x11'))['db'];function respondWithStatusCode(_0x788601,_0x334ebf){_0x334ebf=_0x334ebf||0xcc;return function(_0x4a4e32){if(_0x4a4e32){return _0x788601[_0xc94d('0x12')](_0x334ebf);}return _0x788601[_0xc94d('0x13')](_0x334ebf)[_0xc94d('0x14')]();};}function respondWithResult(_0x715305,_0x28542c){_0x28542c=_0x28542c||0xc8;return function(_0x5aa12e){if(_0x5aa12e){return _0x715305['status'](_0x28542c)[_0xc94d('0x15')](_0x5aa12e);}};}function respondWithFilteredResult(_0x3dffad,_0x394fec){return function(_0x3d10e6){if(_0x3d10e6){var _0x343353=typeof _0x394fec[_0xc94d('0x16')]===_0xc94d('0x17')&&typeof _0x394fec[_0xc94d('0x18')]==='undefined';var _0x225006=_0x3d10e6[_0xc94d('0x19')];var _0x19a7e6=_0x343353?0x0:_0x394fec[_0xc94d('0x16')];var _0x309f72=_0x343353?_0x3d10e6[_0xc94d('0x19')]:_0x394fec[_0xc94d('0x16')]+_0x394fec[_0xc94d('0x18')];var _0x5a9b91;if(_0x309f72>=_0x225006){_0x309f72=_0x225006;_0x5a9b91=0xc8;}else{_0x5a9b91=0xce;}_0x3dffad[_0xc94d('0x13')](_0x5a9b91);return _0x3dffad['set'](_0xc94d('0x1a'),_0x19a7e6+'-'+_0x309f72+'/'+_0x225006)[_0xc94d('0x15')](_0x3d10e6);}return null;};}function patchUpdates(_0x342e78){return function(_0x5ab22){try{jsonpatch[_0xc94d('0x1b')](_0x5ab22,_0x342e78,!![]);}catch(_0x3a5384){return BPromise[_0xc94d('0x1c')](_0x3a5384);}return _0x5ab22[_0xc94d('0x1d')]();};}function saveUpdates(_0x4d6bbc,_0x352f87){return function(_0x5bfb57){if(_0x5bfb57){return _0x5bfb57[_0xc94d('0x1e')](_0x4d6bbc)[_0xc94d('0x1f')](function(_0x479010){return _0x479010;});}return null;};}function removeEntity(_0x70afb3,_0x1902c8){return function(_0x23bbb0){if(_0x23bbb0){return _0x23bbb0[_0xc94d('0x20')]()[_0xc94d('0x1f')](function(){var _0x27dc75=_0x23bbb0['get']({'plain':!![]});var _0x2156ad=_0xc94d('0x21');return db['UserProfileResource'][_0xc94d('0x20')]({'where':{'type':_0x2156ad,'resourceId':_0x27dc75['id']}})[_0xc94d('0x1f')](function(){return _0x23bbb0;});})[_0xc94d('0x1f')](function(){_0x70afb3[_0xc94d('0x13')](0xcc)[_0xc94d('0x14')]();});}};}function handleEntityNotFound(_0x45285c,_0x1c8efb){return function(_0x51db98){if(!_0x51db98){_0x45285c[_0xc94d('0x12')](0x194);}return _0x51db98;};}function handleError(_0x319edb,_0x5812d1){_0x5812d1=_0x5812d1||0x1f4;return function(_0x3136a9){logger[_0xc94d('0x22')](_0x3136a9[_0xc94d('0x23')]);if(_0x3136a9[_0xc94d('0x24')]){delete _0x3136a9['name'];}_0x319edb[_0xc94d('0x13')](_0x5812d1)[_0xc94d('0x25')](_0x3136a9);};}exports['index']=function(_0x131064,_0x21df36){var _0x25a8d9={},_0x9b4dd8={},_0x2aab9d={'count':0x0,'rows':[]};var _0x308ddf=_[_0xc94d('0x26')](db[_0xc94d('0x27')][_0xc94d('0x28')],function(_0x27ccd4){return{'name':_0x27ccd4[_0xc94d('0x29')],'type':_0x27ccd4['type'][_0xc94d('0x2a')]};});_0x9b4dd8['model']=_[_0xc94d('0x26')](_0x308ddf,'name');_0x9b4dd8['query']=_['keys'](_0x131064[_0xc94d('0x2b')]);_0x9b4dd8[_0xc94d('0x2c')]=_['intersection'](_0x9b4dd8[_0xc94d('0x2d')],_0x9b4dd8[_0xc94d('0x2b')]);_0x25a8d9[_0xc94d('0x2e')]=_['intersection'](_0x9b4dd8[_0xc94d('0x2d')],qs[_0xc94d('0x2f')](_0x131064[_0xc94d('0x2b')][_0xc94d('0x2f')]));_0x25a8d9['attributes']=_0x25a8d9[_0xc94d('0x2e')][_0xc94d('0x30')]?_0x25a8d9[_0xc94d('0x2e')]:_0x9b4dd8[_0xc94d('0x2d')];if(!_0x131064[_0xc94d('0x2b')]['hasOwnProperty'](_0xc94d('0x31'))){_0x25a8d9[_0xc94d('0x18')]=qs[_0xc94d('0x18')](_0x131064[_0xc94d('0x2b')][_0xc94d('0x18')]);_0x25a8d9['offset']=qs[_0xc94d('0x16')](_0x131064[_0xc94d('0x2b')][_0xc94d('0x16')]);}_0x25a8d9[_0xc94d('0x32')]=qs[_0xc94d('0x33')](_0x131064[_0xc94d('0x2b')][_0xc94d('0x33')]);_0x25a8d9[_0xc94d('0x34')]=qs[_0xc94d('0x2c')](_['pick'](_0x131064[_0xc94d('0x2b')],_0x9b4dd8['filters']),_0x308ddf);if(_0x131064[_0xc94d('0x2b')][_0xc94d('0x35')]){_0x25a8d9[_0xc94d('0x34')]=_[_0xc94d('0x36')](_0x25a8d9[_0xc94d('0x34')],{'$or':_[_0xc94d('0x26')](_0x308ddf,function(_0x3e9cff){if(_0x3e9cff[_0xc94d('0x37')]!==_0xc94d('0x38')){var _0x14ae27={};_0x14ae27[_0x3e9cff[_0xc94d('0x24')]]={'$like':'%'+_0x131064[_0xc94d('0x2b')][_0xc94d('0x35')]+'%'};return _0x14ae27;}})});}_0x25a8d9=_[_0xc94d('0x36')]({},_0x25a8d9,_0x131064[_0xc94d('0x39')]);var _0x23a80b={'where':_0x25a8d9[_0xc94d('0x34')]};return db['AnalyticExtractedReport'][_0xc94d('0x19')](_0x23a80b)[_0xc94d('0x1f')](function(_0xf65056){_0x2aab9d[_0xc94d('0x19')]=_0xf65056;if(_0x131064[_0xc94d('0x2b')]['includeAll']){_0x25a8d9[_0xc94d('0x3a')]=[{'all':!![]}];}return db[_0xc94d('0x27')][_0xc94d('0x3b')](_0x25a8d9);})[_0xc94d('0x1f')](function(_0x379cec){_0x2aab9d[_0xc94d('0x3c')]=_0x379cec;return _0x2aab9d;})[_0xc94d('0x1f')](respondWithFilteredResult(_0x21df36,_0x25a8d9))[_0xc94d('0x3d')](handleError(_0x21df36,null));};exports[_0xc94d('0x3e')]=function(_0x496036,_0x249af){var _0x8ecca2={'raw':!![],'where':{'id':_0x496036[_0xc94d('0x3f')]['id']}},_0x7160e6={};_0x7160e6[_0xc94d('0x2d')]=_[_0xc94d('0x40')](db[_0xc94d('0x27')][_0xc94d('0x28')]);_0x7160e6[_0xc94d('0x2b')]=_[_0xc94d('0x40')](_0x496036[_0xc94d('0x2b')]);_0x7160e6[_0xc94d('0x2c')]=_['intersection'](_0x7160e6[_0xc94d('0x2d')],_0x7160e6[_0xc94d('0x2b')]);_0x8ecca2['attributes']=_[_0xc94d('0x41')](_0x7160e6[_0xc94d('0x2d')],qs[_0xc94d('0x2f')](_0x496036[_0xc94d('0x2b')][_0xc94d('0x2f')]));_0x8ecca2['attributes']=_0x8ecca2[_0xc94d('0x2e')][_0xc94d('0x30')]?_0x8ecca2[_0xc94d('0x2e')]:_0x7160e6[_0xc94d('0x2d')];if(_0x496036['query'][_0xc94d('0x42')]){_0x8ecca2[_0xc94d('0x3a')]=[{'all':!![]}];}_0x8ecca2=_[_0xc94d('0x36')]({},_0x8ecca2,_0x496036[_0xc94d('0x39')]);return db['AnalyticExtractedReport'][_0xc94d('0x43')](_0x8ecca2)[_0xc94d('0x1f')](handleEntityNotFound(_0x249af,null))['then'](respondWithResult(_0x249af,null))[_0xc94d('0x3d')](handleError(_0x249af,null));};exports['create']=function(_0x308c68,_0x25071b){return db['AnalyticExtractedReport'][_0xc94d('0x44')](_0x308c68['body'],{})['then'](function(_0x2cd031){var _0xd9d3e5=_0x308c68['user'][_0xc94d('0x45')]({'plain':!![]});if(!_0xd9d3e5)throw new Error(_0xc94d('0x46'));if(_0xd9d3e5['role']==='user'){var _0x4f1ef1=_0x2cd031['get']({'plain':!![]});var _0x3f294a='ExtractedReports';return db[_0xc94d('0x47')][_0xc94d('0x43')]({'where':{'name':_0x3f294a,'userProfileId':_0xd9d3e5[_0xc94d('0x48')]},'raw':!![]})[_0xc94d('0x1f')](function(_0x10715b){if(_0x10715b&&_0x10715b[_0xc94d('0x49')]===0x0){return db[_0xc94d('0x4a')][_0xc94d('0x44')]({'name':_0x4f1ef1[_0xc94d('0x24')],'resourceId':_0x4f1ef1['id'],'type':_0x10715b[_0xc94d('0x24')],'sectionId':_0x10715b['id']},{})[_0xc94d('0x1f')](function(){return _0x2cd031;});}else{return _0x2cd031;}})['catch'](function(_0x2ee770){logger[_0xc94d('0x22')](_0xc94d('0x4b'),_0x2ee770);throw _0x2ee770;});}return _0x2cd031;})[_0xc94d('0x1f')](respondWithResult(_0x25071b,0xc9))[_0xc94d('0x3d')](handleError(_0x25071b,null));};exports[_0xc94d('0x1e')]=function(_0x46e733,_0x50c203){if(_0x46e733[_0xc94d('0x4c')]['id']){delete _0x46e733[_0xc94d('0x4c')]['id'];}return db[_0xc94d('0x27')][_0xc94d('0x43')]({'where':{'id':_0x46e733[_0xc94d('0x3f')]['id']}})[_0xc94d('0x1f')](handleEntityNotFound(_0x50c203,null))[_0xc94d('0x1f')](saveUpdates(_0x46e733[_0xc94d('0x4c')],null))[_0xc94d('0x1f')](respondWithResult(_0x50c203,null))['catch'](handleError(_0x50c203,null));};exports[_0xc94d('0x20')]=function(_0x403556,_0x2507b2){return db[_0xc94d('0x27')][_0xc94d('0x43')]({'where':{'id':_0x403556['params']['id']}})[_0xc94d('0x1f')](handleEntityNotFound(_0x2507b2,null))[_0xc94d('0x1f')](removeEntity(_0x2507b2,null))[_0xc94d('0x3d')](handleError(_0x2507b2,null));};exports['download']=function(_0x380451,_0x21be57,_0x939454){return db['AnalyticExtractedReport']['find']({'where':{'id':_0x380451[_0xc94d('0x3f')]['id']},'attributes':[_0xc94d('0x24'),_0xc94d('0x4d'),_0xc94d('0x4e'),'output'],'raw':!![]})['then'](handleEntityNotFound(_0x21be57,null))[_0xc94d('0x1f')](function(_0x580059){if(_0x580059){if(!fs[_0xc94d('0x4f')](path[_0xc94d('0x50')](config['root'],_0xc94d('0x51'),_0x580059[_0xc94d('0x4e')]))){throw new db[(_0xc94d('0x52'))][(_0xc94d('0x53'))](_0xc94d('0x54'));}if(_0x380451[_0xc94d('0x2b')][_0xc94d('0x55')]){return _0x21be57[_0xc94d('0x12')](0xc8);}return _0x21be57[_0xc94d('0x56')](path['join'](config[_0xc94d('0x57')],_0xc94d('0x51'),_0x580059[_0xc94d('0x4e')]),util[_0xc94d('0x58')](_0xc94d('0x59'),_0x580059[_0xc94d('0x4d')]||_0x580059[_0xc94d('0x24')],_0x580059[_0xc94d('0x5a')][_0xc94d('0x5b')]()));}})['catch'](handleError(_0x21be57,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index d513cee..e337512 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 _0xb42f=['rimraf','../../config/environment','./analyticExtractedReport.attributes','exports','AnalyticExtractedReport','analytics_extracted_reports','util','../../config/logger','bluebird','path'];(function(_0xa79977,_0x4f7f12){var _0x109f10=function(_0x56780f){while(--_0x56780f){_0xa79977['push'](_0xa79977['shift']());}};_0x109f10(++_0x4f7f12);}(_0xb42f,0x1a0));var _0xfb42=function(_0x5c3b87,_0x2b0fe9){_0x5c3b87=_0x5c3b87-0x0;var _0x3c05aa=_0xb42f[_0x5c3b87];return _0x3c05aa;};'use strict';var _=require('lodash');var util=require(_0xfb42('0x0'));var logger=require(_0xfb42('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfb42('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfb42('0x3'));var rimraf=require(_0xfb42('0x4'));var config=require(_0xfb42('0x5'));var attributes=require(_0xfb42('0x6'));module[_0xfb42('0x7')]=function(_0x4fc1d1,_0xaed1e9){return _0x4fc1d1['define'](_0xfb42('0x8'),attributes,{'tableName':_0xfb42('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6ee3=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','AnalyticExtractedReport','lodash','util'];(function(_0x199210,_0x151314){var _0x511b64=function(_0x5a9f49){while(--_0x5a9f49){_0x199210['push'](_0x199210['shift']());}};_0x511b64(++_0x151314);}(_0x6ee3,0x1ba));var _0x36ee=function(_0x595fa1,_0x47b15f){_0x595fa1=_0x595fa1-0x0;var _0x368588=_0x6ee3[_0x595fa1];return _0x368588;};'use strict';var _=require(_0x36ee('0x0'));var util=require(_0x36ee('0x1'));var logger=require(_0x36ee('0x2'))(_0x36ee('0x3'));var moment=require(_0x36ee('0x4'));var BPromise=require(_0x36ee('0x5'));var rp=require(_0x36ee('0x6'));var fs=require('fs');var path=require(_0x36ee('0x7'));var rimraf=require(_0x36ee('0x8'));var config=require(_0x36ee('0x9'));var attributes=require('./analyticExtractedReport.attributes');module['exports']=function(_0x4ab09c,_0xa9412a){return _0x4ab09c[_0x36ee('0xa')](_0x36ee('0xb'),attributes,{'tableName':'analytics_extracted_reports','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 be335f8..60506c2 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 _0x51fb=['lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch'];(function(_0x12c2fe,_0x340166){var _0x5572d4=function(_0x45f0f5){while(--_0x45f0f5){_0x12c2fe['push'](_0x12c2fe['shift']());}};_0x5572d4(++_0x340166);}(_0x51fb,0x138));var _0xb51f=function(_0x13212c,_0x2dfe5e){_0x13212c=_0x13212c-0x0;var _0x4c2975=_0x51fb[_0x13212c];return _0x4c2975;};'use strict';var _=require(_0xb51f('0x0'));var util=require('util');var moment=require(_0xb51f('0x1'));var BPromise=require(_0xb51f('0x2'));var rs=require(_0xb51f('0x3'));var fs=require('fs');var Redis=require(_0xb51f('0x4'));var db=require(_0xb51f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb51f('0x6'));var config=require(_0xb51f('0x7'));var jayson=require(_0xb51f('0x8'));var client=jayson[_0xb51f('0x9')][_0xb51f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x48b226,_0x1cbf25,_0xfa42a4){return new BPromise(function(_0x9f7bda,_0x4b4edd){return client[_0xb51f('0xb')](_0x48b226,_0xfa42a4)[_0xb51f('0xc')](function(_0x2b400b){logger['info'](_0xb51f('0xd'),_0x1cbf25,_0xb51f('0xe'));logger[_0xb51f('0xf')](_0xb51f('0x10'),_0x1cbf25,_0xb51f('0xe'),JSON[_0xb51f('0x11')](_0x2b400b));if(_0x2b400b['error']){if(_0x2b400b[_0xb51f('0x12')][_0xb51f('0x13')]===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x1cbf25,_0x2b400b['error'][_0xb51f('0x14')]);return _0x4b4edd(_0x2b400b[_0xb51f('0x12')][_0xb51f('0x14')]);}logger[_0xb51f('0x12')](_0xb51f('0xd'),_0x1cbf25,_0x2b400b['error']['message']);return _0x9f7bda(_0x2b400b[_0xb51f('0x12')][_0xb51f('0x14')]);}else{logger[_0xb51f('0x15')](_0xb51f('0xd'),_0x1cbf25,_0xb51f('0xe'));_0x9f7bda(_0x2b400b[_0xb51f('0x16')]['message']);}})[_0xb51f('0x17')](function(_0x9b97f6){logger[_0xb51f('0x12')](_0xb51f('0xd'),_0x1cbf25,_0x9b97f6);_0x4b4edd(_0x9b97f6);});});} \ No newline at end of file +var _0x0362=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x20c974,_0x373f71){var _0xd5828d=function(_0x4cd15e){while(--_0x4cd15e){_0x20c974['push'](_0x20c974['shift']());}};_0xd5828d(++_0x373f71);}(_0x0362,0x15d));var _0x2036=function(_0x1930c4,_0x559200){_0x1930c4=_0x1930c4-0x0;var _0x474f43=_0x0362[_0x1930c4];return _0x474f43;};'use strict';var _=require(_0x2036('0x0'));var util=require('util');var moment=require(_0x2036('0x1'));var BPromise=require('bluebird');var rs=require(_0x2036('0x2'));var fs=require('fs');var Redis=require(_0x2036('0x3'));var db=require(_0x2036('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2036('0x5'))(_0x2036('0x6'));var config=require(_0x2036('0x7'));var jayson=require(_0x2036('0x8'));var client=jayson[_0x2036('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf9f334,_0x36bd09,_0x5959af){return new BPromise(function(_0x4928b0,_0x1e9142){return client[_0x2036('0xa')](_0xf9f334,_0x5959af)['then'](function(_0x423723){logger[_0x2036('0xb')](_0x2036('0xc'),_0x36bd09,_0x2036('0xd'));logger[_0x2036('0xe')](_0x2036('0xf'),_0x36bd09,_0x2036('0xd'),JSON[_0x2036('0x10')](_0x423723));if(_0x423723[_0x2036('0x11')]){if(_0x423723['error']['code']===0x1f4){logger[_0x2036('0x11')](_0x2036('0xc'),_0x36bd09,_0x423723[_0x2036('0x11')][_0x2036('0x12')]);return _0x1e9142(_0x423723[_0x2036('0x11')]['message']);}logger[_0x2036('0x11')](_0x2036('0xc'),_0x36bd09,_0x423723[_0x2036('0x11')]['message']);return _0x4928b0(_0x423723['error'][_0x2036('0x12')]);}else{logger[_0x2036('0xb')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x36bd09,_0x2036('0xd'));_0x4928b0(_0x423723['result']['message']);}})[_0x2036('0x13')](function(_0x2eb7fe){logger[_0x2036('0x11')](_0x2036('0xc'),_0x36bd09,_0x2eb7fe);_0x1e9142(_0x2eb7fe);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 07d5bae..ccff191 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 _0x03aa=['fs-extra','../../components/interaction/service','./analyticExtractedReport.controller','isAuthenticated','get','/:id','show','download','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','express','Router'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x03aa,0xea));var _0xa03a=function(_0x53c347,_0x248122){_0x53c347=_0x53c347-0x0;var _0x56a966=_0x03aa[_0x53c347];return _0x56a966;};'use strict';var multer=require(_0xa03a('0x0'));var util=require(_0xa03a('0x1'));var path=require(_0xa03a('0x2'));var timeout=require(_0xa03a('0x3'));var express=require(_0xa03a('0x4'));var router=express[_0xa03a('0x5')]();var fs_extra=require(_0xa03a('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa03a('0x7'));var config=require('../../config/environment');var controller=require(_0xa03a('0x8'));router['get']('/',auth[_0xa03a('0x9')](),controller['index']);router[_0xa03a('0xa')](_0xa03a('0xb'),auth[_0xa03a('0x9')](),controller[_0xa03a('0xc')]);router['get']('/:id/download',auth[_0xa03a('0x9')](),controller[_0xa03a('0xd')]);router[_0xa03a('0xe')]('/',auth[_0xa03a('0x9')](),controller[_0xa03a('0xf')]);router[_0xa03a('0x10')](_0xa03a('0xb'),auth[_0xa03a('0x9')](),controller[_0xa03a('0x11')]);router[_0xa03a('0x12')](_0xa03a('0xb'),auth['isAuthenticated'](),controller[_0xa03a('0x13')]);module['exports']=router; \ No newline at end of file +var _0xfbac=['path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated','index','show','/:id/download','create','put','/:id','update','delete','destroy','exports','multer','util'];(function(_0x1dbaaf,_0x294503){var _0x3ca453=function(_0x2b5e5b){while(--_0x2b5e5b){_0x1dbaaf['push'](_0x1dbaaf['shift']());}};_0x3ca453(++_0x294503);}(_0xfbac,0x18e));var _0xcfba=function(_0xbc187e,_0x52f43d){_0xbc187e=_0xbc187e-0x0;var _0x4175bf=_0xfbac[_0xbc187e];return _0x4175bf;};'use strict';var multer=require(_0xcfba('0x0'));var util=require(_0xcfba('0x1'));var path=require(_0xcfba('0x2'));var timeout=require(_0xcfba('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xcfba('0x4'));var auth=require(_0xcfba('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xcfba('0x6'));var controller=require(_0xcfba('0x7'));router[_0xcfba('0x8')]('/',auth[_0xcfba('0x9')](),controller[_0xcfba('0xa')]);router[_0xcfba('0x8')]('/:id',auth[_0xcfba('0x9')](),controller[_0xcfba('0xb')]);router['get'](_0xcfba('0xc'),auth[_0xcfba('0x9')](),controller['download']);router['post']('/',auth[_0xcfba('0x9')](),controller[_0xcfba('0xd')]);router[_0xcfba('0xe')](_0xcfba('0xf'),auth['isAuthenticated'](),controller[_0xcfba('0x10')]);router[_0xcfba('0x11')](_0xcfba('0xf'),auth[_0xcfba('0x9')](),controller[_0xcfba('0x12')]);module[_0xcfba('0x13')]=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index e1bb54d..d96a1c6 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 _0x78fe=['STRING','BOOLEAN','sequelize'];(function(_0x39fcd5,_0x474d5a){var _0xeb5477=function(_0x1623e6){while(--_0x1623e6){_0x39fcd5['push'](_0x39fcd5['shift']());}};_0xeb5477(++_0x474d5a);}(_0x78fe,0x95));var _0xe78f=function(_0x37ca50,_0x7ac0c1){_0x37ca50=_0x37ca50-0x0;var _0x3696c0=_0x78fe[_0x37ca50];return _0x3696c0;};'use strict';var Sequelize=require(_0xe78f('0x0'));module['exports']={'field':{'type':Sequelize['TEXT']},'alias':{'type':Sequelize[_0xe78f('0x1')]},'function':{'type':Sequelize[_0xe78f('0x1')]},'format':{'type':Sequelize[_0xe78f('0x1')]},'groupBy':{'type':Sequelize[_0xe78f('0x2')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0xe78f('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x8658=['exports','TEXT','STRING','BOOLEAN','sequelize'];(function(_0x40bf3f,_0x5b85d4){var _0x8b0b91=function(_0x145eb9){while(--_0x145eb9){_0x40bf3f['push'](_0x40bf3f['shift']());}};_0x8b0b91(++_0x5b85d4);}(_0x8658,0x1c6));var _0x8865=function(_0x40220a,_0x22feb1){_0x40220a=_0x40220a-0x0;var _0x3903cc=_0x8658[_0x40220a];return _0x3903cc;};'use strict';var Sequelize=require(_0x8865('0x0'));module[_0x8865('0x1')]={'field':{'type':Sequelize[_0x8865('0x2')]},'alias':{'type':Sequelize[_0x8865('0x3')]},'function':{'type':Sequelize[_0x8865('0x3')]},'format':{'type':Sequelize['STRING']},'groupBy':{'type':Sequelize[_0x8865('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize['STRING']},'custom':{'type':Sequelize[_0x8865('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.controller.js b/server/api/analyticFieldReport/analyticFieldReport.controller.js index e8da8b2..ccaf9d6 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 _0x61cf=['name','options','then','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','bulkCreate','update','bulkDestroy','ids','addFields','AnalyticCustomReport','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','destroy','error','stack','send','index','map','AnalyticFieldReport','fieldName','type','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x17406a,_0x1e2320){var _0x1501ff=function(_0x4b075a){while(--_0x4b075a){_0x17406a['push'](_0x17406a['shift']());}};_0x1501ff(++_0x1e2320);}(_0x61cf,0x168));var _0xf61c=function(_0x57e8a9,_0x137294){_0x57e8a9=_0x57e8a9-0x0;var _0x567b30=_0x61cf[_0x57e8a9];return _0x567b30;};'use strict';var emlformat=require(_0xf61c('0x0'));var rimraf=require(_0xf61c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf61c('0x2'));var rp=require(_0xf61c('0x3'));var moment=require(_0xf61c('0x4'));var BPromise=require(_0xf61c('0x5'));var Mustache=require('mustache');var util=require(_0xf61c('0x6'));var path=require(_0xf61c('0x7'));var sox=require('sox');var csv=require(_0xf61c('0x8'));var ejs=require(_0xf61c('0x9'));var fs=require('fs');var fs_extra=require(_0xf61c('0xa'));var _=require(_0xf61c('0xb'));var squel=require(_0xf61c('0xc'));var crypto=require(_0xf61c('0xd'));var jsforce=require(_0xf61c('0xe'));var deskjs=require(_0xf61c('0xf'));var toCsv=require(_0xf61c('0x8'));var querystring=require(_0xf61c('0x10'));var Papa=require('papaparse');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(_0xf61c('0x11'));var logger=require(_0xf61c('0x12'))(_0xf61c('0x13'));var utils=require(_0xf61c('0x14'));var config=require(_0xf61c('0x15'));var licenseUtil=require(_0xf61c('0x16'));var db=require(_0xf61c('0x17'))['db'];function respondWithStatusCode(_0x25e1c4,_0x12e97d){_0x12e97d=_0x12e97d||0xcc;return function(_0x5a233b){if(_0x5a233b){return _0x25e1c4[_0xf61c('0x18')](_0x12e97d);}return _0x25e1c4[_0xf61c('0x19')](_0x12e97d)[_0xf61c('0x1a')]();};}function respondWithResult(_0x32998b,_0xb24a09){_0xb24a09=_0xb24a09||0xc8;return function(_0x5d6069){if(_0x5d6069){return _0x32998b[_0xf61c('0x19')](_0xb24a09)[_0xf61c('0x1b')](_0x5d6069);}};}function respondWithFilteredResult(_0x20ffe8,_0x79d2c2){return function(_0x31970f){if(_0x31970f){var _0x14aae5=typeof _0x79d2c2['offset']==='undefined'&&typeof _0x79d2c2[_0xf61c('0x1c')]===_0xf61c('0x1d');var _0x4149c4=_0x31970f[_0xf61c('0x1e')];var _0x8b44ca=_0x14aae5?0x0:_0x79d2c2[_0xf61c('0x1f')];var _0x3474e6=_0x14aae5?_0x31970f[_0xf61c('0x1e')]:_0x79d2c2['offset']+_0x79d2c2[_0xf61c('0x1c')];var _0xd550b6;if(_0x3474e6>=_0x4149c4){_0x3474e6=_0x4149c4;_0xd550b6=0xc8;}else{_0xd550b6=0xce;}_0x20ffe8[_0xf61c('0x19')](_0xd550b6);return _0x20ffe8['set'](_0xf61c('0x20'),_0x8b44ca+'-'+_0x3474e6+'/'+_0x4149c4)['json'](_0x31970f);}return null;};}function patchUpdates(_0x4b6556){return function(_0x3646ea){try{jsonpatch[_0xf61c('0x21')](_0x3646ea,_0x4b6556,!![]);}catch(_0x3fb271){return BPromise[_0xf61c('0x22')](_0x3fb271);}return _0x3646ea[_0xf61c('0x23')]();};}function saveUpdates(_0x33a4a0,_0x2cb771){return function(_0x5c9d49){if(_0x5c9d49){return _0x5c9d49['update'](_0x33a4a0)['then'](function(_0x54d308){return _0x54d308;});}return null;};}function removeEntity(_0x115379,_0x186268){return function(_0x1bce1e){if(_0x1bce1e){return _0x1bce1e[_0xf61c('0x24')]()['then'](function(){_0x115379[_0xf61c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x23a689,_0x23b6eb){return function(_0x3adab0){if(!_0x3adab0){_0x23a689[_0xf61c('0x18')](0x194);}return _0x3adab0;};}function handleError(_0x17ce62,_0x5f42cf){_0x5f42cf=_0x5f42cf||0x1f4;return function(_0xba7877){logger[_0xf61c('0x25')](_0xba7877[_0xf61c('0x26')]);if(_0xba7877['name']){delete _0xba7877['name'];}_0x17ce62['status'](_0x5f42cf)[_0xf61c('0x27')](_0xba7877);};}exports[_0xf61c('0x28')]=function(_0x8373dc,_0x281187){var _0x16d326={},_0x2f4d5b={},_0x30fdd6={'count':0x0,'rows':[]};var _0x2b2822=_[_0xf61c('0x29')](db[_0xf61c('0x2a')]['rawAttributes'],function(_0x5504c8){return{'name':_0x5504c8[_0xf61c('0x2b')],'type':_0x5504c8[_0xf61c('0x2c')]['key']};});_0x2f4d5b['model']=_['map'](_0x2b2822,'name');_0x2f4d5b[_0xf61c('0x2d')]=_[_0xf61c('0x2e')](_0x8373dc['query']);_0x2f4d5b[_0xf61c('0x2f')]=_[_0xf61c('0x30')](_0x2f4d5b[_0xf61c('0x31')],_0x2f4d5b['query']);_0x16d326['attributes']=_[_0xf61c('0x30')](_0x2f4d5b[_0xf61c('0x31')],qs[_0xf61c('0x32')](_0x8373dc[_0xf61c('0x2d')]['fields']));_0x16d326[_0xf61c('0x33')]=_0x16d326['attributes']['length']?_0x16d326[_0xf61c('0x33')]:_0x2f4d5b[_0xf61c('0x31')];if(!_0x8373dc[_0xf61c('0x2d')][_0xf61c('0x34')](_0xf61c('0x35'))){_0x16d326[_0xf61c('0x1c')]=qs[_0xf61c('0x1c')](_0x8373dc[_0xf61c('0x2d')][_0xf61c('0x1c')]);_0x16d326[_0xf61c('0x1f')]=qs[_0xf61c('0x1f')](_0x8373dc[_0xf61c('0x2d')][_0xf61c('0x1f')]);}_0x16d326[_0xf61c('0x36')]=qs['sort'](_0x8373dc['query'][_0xf61c('0x37')]);_0x16d326[_0xf61c('0x38')]=qs['filters'](_[_0xf61c('0x39')](_0x8373dc['query'],_0x2f4d5b['filters']),_0x2b2822);if(_0x8373dc[_0xf61c('0x2d')][_0xf61c('0x3a')]){_0x16d326[_0xf61c('0x38')]=_[_0xf61c('0x3b')](_0x16d326[_0xf61c('0x38')],{'$or':_[_0xf61c('0x29')](_0x2b2822,function(_0x4e8735){if(_0x4e8735[_0xf61c('0x2c')]!=='VIRTUAL'){var _0x124755={};_0x124755[_0x4e8735[_0xf61c('0x3c')]]={'$like':'%'+_0x8373dc[_0xf61c('0x2d')][_0xf61c('0x3a')]+'%'};return _0x124755;}})});}_0x16d326=_[_0xf61c('0x3b')]({},_0x16d326,_0x8373dc[_0xf61c('0x3d')]);var _0x13a56f={'where':_0x16d326[_0xf61c('0x38')]};return db[_0xf61c('0x2a')][_0xf61c('0x1e')](_0x13a56f)[_0xf61c('0x3e')](function(_0xf29ff8){_0x30fdd6[_0xf61c('0x1e')]=_0xf29ff8;if(_0x8373dc[_0xf61c('0x2d')]['includeAll']){_0x16d326[_0xf61c('0x3f')]=[{'all':!![]}];}return db[_0xf61c('0x2a')][_0xf61c('0x40')](_0x16d326);})[_0xf61c('0x3e')](function(_0x32322d){_0x30fdd6[_0xf61c('0x41')]=_0x32322d;return _0x30fdd6;})[_0xf61c('0x3e')](respondWithFilteredResult(_0x281187,_0x16d326))[_0xf61c('0x42')](handleError(_0x281187,null));};exports[_0xf61c('0x43')]=function(_0x4c45e9,_0xd7ac77){var _0x1d47d2={'raw':![],'where':{'id':_0x4c45e9[_0xf61c('0x44')]['id']}},_0x1b302f={};_0x1b302f[_0xf61c('0x31')]=_['keys'](db['AnalyticFieldReport'][_0xf61c('0x45')]);_0x1b302f['query']=_[_0xf61c('0x2e')](_0x4c45e9['query']);_0x1b302f[_0xf61c('0x2f')]=_[_0xf61c('0x30')](_0x1b302f[_0xf61c('0x31')],_0x1b302f[_0xf61c('0x2d')]);_0x1d47d2[_0xf61c('0x33')]=_[_0xf61c('0x30')](_0x1b302f[_0xf61c('0x31')],qs['fields'](_0x4c45e9[_0xf61c('0x2d')][_0xf61c('0x32')]));_0x1d47d2[_0xf61c('0x33')]=_0x1d47d2['attributes'][_0xf61c('0x46')]?_0x1d47d2['attributes']:_0x1b302f[_0xf61c('0x31')];if(_0x4c45e9[_0xf61c('0x2d')]['includeAll']){_0x1d47d2[_0xf61c('0x3f')]=[{'all':!![]}];}_0x1d47d2=_[_0xf61c('0x3b')]({},_0x1d47d2,_0x4c45e9[_0xf61c('0x3d')]);return db[_0xf61c('0x2a')][_0xf61c('0x47')](_0x1d47d2)[_0xf61c('0x3e')](handleEntityNotFound(_0xd7ac77,null))[_0xf61c('0x3e')](respondWithResult(_0xd7ac77,null))[_0xf61c('0x42')](handleError(_0xd7ac77,null));};exports[_0xf61c('0x48')]=function(_0x53397b,_0x2ada5f){return db['AnalyticFieldReport'][_0xf61c('0x48')](_0x53397b[_0xf61c('0x49')],{})[_0xf61c('0x3e')](respondWithResult(_0x2ada5f,0xc9))[_0xf61c('0x42')](handleError(_0x2ada5f,null));};exports[_0xf61c('0x4a')]=function(_0x2705db,_0x1e5431){return db[_0xf61c('0x2a')][_0xf61c('0x4a')](_0x2705db[_0xf61c('0x49')],{'raw':![],'individualHooks':!![]})[_0xf61c('0x3e')](respondWithResult(_0x1e5431,0xc9))[_0xf61c('0x42')](handleError(_0x1e5431,null));};exports[_0xf61c('0x4b')]=function(_0x85a66d,_0x517e40){if(_0x85a66d[_0xf61c('0x49')]['id']){delete _0x85a66d['body']['id'];}return db['AnalyticFieldReport'][_0xf61c('0x47')]({'where':{'id':_0x85a66d['params']['id']}})[_0xf61c('0x3e')](handleEntityNotFound(_0x517e40,null))[_0xf61c('0x3e')](saveUpdates(_0x85a66d[_0xf61c('0x49')],null))[_0xf61c('0x3e')](respondWithResult(_0x517e40,null))['catch'](handleError(_0x517e40,null));};exports[_0xf61c('0x24')]=function(_0x19203c,_0x388c94){return db['AnalyticFieldReport'][_0xf61c('0x47')]({'where':{'id':_0x19203c[_0xf61c('0x44')]['id']}})[_0xf61c('0x3e')](handleEntityNotFound(_0x388c94,null))['then'](removeEntity(_0x388c94,null))[_0xf61c('0x42')](handleError(_0x388c94,null));};exports[_0xf61c('0x4c')]=function(_0x5a144a,_0x4997df){return db['AnalyticFieldReport'][_0xf61c('0x24')]({'where':{'id':_0x5a144a[_0xf61c('0x2d')][_0xf61c('0x4d')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x4997df,0xcc))['catch'](handleError(_0x4997df,null));};exports[_0xf61c('0x4e')]=function(_0x23c8b5,_0x331f73,_0x205602){return db[_0xf61c('0x4f')][_0xf61c('0x50')]({'where':{'id':_0x23c8b5[_0xf61c('0x44')]['id']}})[_0xf61c('0x3e')](handleEntityNotFound(_0x331f73,null))[_0xf61c('0x3e')](function(_0x1bcb12){if(_0x1bcb12){return db[_0xf61c('0x51')][_0xf61c('0x52')](function(_0x1dd2ef){return db['AnalyticFieldReport'][_0xf61c('0x24')]({'where':{'CustomReportId':_0x23c8b5['params']['id']},'transaction':_0x1dd2ef})[_0xf61c('0x3e')](function(_0x31327f){var _0x372f66=_[_0xf61c('0x29')](_0x23c8b5[_0xf61c('0x49')],function(_0x32fd80){delete _0x32fd80['id'];_0x32fd80[_0xf61c('0x53')]=_0x23c8b5['params']['id'];return _0x32fd80;});return db[_0xf61c('0x2a')]['bulkCreate'](_0x372f66,{'transaction':_0x1dd2ef});});})[_0xf61c('0x3e')](function(){return db[_0xf61c('0x2a')][_0xf61c('0x40')]({'where':{'CustomReportId':_0x23c8b5[_0xf61c('0x44')]['id']}});});}})[_0xf61c('0x3e')](respondWithResult(_0x331f73,null))['catch'](handleError(_0x331f73,null));}; \ No newline at end of file +var _0xbf6b=['params','fields','length','options','find','catch','create','bulkCreate','body','bulkDestroy','ids','addFields','findOne','sequelize','transaction','CustomReportId','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','show'];(function(_0x28da2a,_0x45fc18){var _0x30d36e=function(_0x290856){while(--_0x290856){_0x28da2a['push'](_0x28da2a['shift']());}};_0x30d36e(++_0x45fc18);}(_0xbf6b,0x168));var _0xbbf6=function(_0x5a776b,_0x46f785){_0x5a776b=_0x5a776b-0x0;var _0xbbef59=_0xbf6b[_0x5a776b];return _0xbbef59;};'use strict';var emlformat=require(_0xbbf6('0x0'));var rimraf=require(_0xbbf6('0x1'));var zipdir=require(_0xbbf6('0x2'));var jsonpatch=require(_0xbbf6('0x3'));var rp=require(_0xbbf6('0x4'));var moment=require('moment');var BPromise=require(_0xbbf6('0x5'));var Mustache=require(_0xbbf6('0x6'));var util=require(_0xbbf6('0x7'));var path=require(_0xbbf6('0x8'));var sox=require(_0xbbf6('0x9'));var csv=require(_0xbbf6('0xa'));var ejs=require(_0xbbf6('0xb'));var fs=require('fs');var fs_extra=require(_0xbbf6('0xc'));var _=require(_0xbbf6('0xd'));var squel=require(_0xbbf6('0xe'));var crypto=require(_0xbbf6('0xf'));var jsforce=require(_0xbbf6('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xbbf6('0xa'));var querystring=require(_0xbbf6('0x11'));var Papa=require(_0xbbf6('0x12'));var Redis=require(_0xbbf6('0x13'));var authService=require(_0xbbf6('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0xbbf6('0x15'));var hardwareService=require(_0xbbf6('0x16'));var logger=require(_0xbbf6('0x17'))(_0xbbf6('0x18'));var utils=require(_0xbbf6('0x19'));var config=require(_0xbbf6('0x1a'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x558863,_0x4a2f47){_0x4a2f47=_0x4a2f47||0xcc;return function(_0x803762){if(_0x803762){return _0x558863[_0xbbf6('0x1b')](_0x4a2f47);}return _0x558863['status'](_0x4a2f47)[_0xbbf6('0x1c')]();};}function respondWithResult(_0x14e0a6,_0x510fa0){_0x510fa0=_0x510fa0||0xc8;return function(_0x277c23){if(_0x277c23){return _0x14e0a6[_0xbbf6('0x1d')](_0x510fa0)[_0xbbf6('0x1e')](_0x277c23);}};}function respondWithFilteredResult(_0x5e48ca,_0x1a40a1){return function(_0x4b4a57){if(_0x4b4a57){var _0xe699c0=typeof _0x1a40a1['offset']===_0xbbf6('0x1f')&&typeof _0x1a40a1[_0xbbf6('0x20')]===_0xbbf6('0x1f');var _0x18c1e1=_0x4b4a57[_0xbbf6('0x21')];var _0x4d0ba9=_0xe699c0?0x0:_0x1a40a1[_0xbbf6('0x22')];var _0x1cefa1=_0xe699c0?_0x4b4a57[_0xbbf6('0x21')]:_0x1a40a1['offset']+_0x1a40a1['limit'];var _0x4b525f;if(_0x1cefa1>=_0x18c1e1){_0x1cefa1=_0x18c1e1;_0x4b525f=0xc8;}else{_0x4b525f=0xce;}_0x5e48ca['status'](_0x4b525f);return _0x5e48ca[_0xbbf6('0x23')](_0xbbf6('0x24'),_0x4d0ba9+'-'+_0x1cefa1+'/'+_0x18c1e1)[_0xbbf6('0x1e')](_0x4b4a57);}return null;};}function patchUpdates(_0x602c8){return function(_0x415b24){try{jsonpatch[_0xbbf6('0x25')](_0x415b24,_0x602c8,!![]);}catch(_0x10cb93){return BPromise[_0xbbf6('0x26')](_0x10cb93);}return _0x415b24[_0xbbf6('0x27')]();};}function saveUpdates(_0x2c9ba4,_0x10e3a5){return function(_0x4295b0){if(_0x4295b0){return _0x4295b0[_0xbbf6('0x28')](_0x2c9ba4)[_0xbbf6('0x29')](function(_0x3040b1){return _0x3040b1;});}return null;};}function removeEntity(_0x162f05,_0x57efe3){return function(_0x2cfe00){if(_0x2cfe00){return _0x2cfe00[_0xbbf6('0x2a')]()[_0xbbf6('0x29')](function(){_0x162f05[_0xbbf6('0x1d')](0xcc)[_0xbbf6('0x1c')]();});}};}function handleEntityNotFound(_0x55c0e0,_0x30296f){return function(_0x4838d7){if(!_0x4838d7){_0x55c0e0['sendStatus'](0x194);}return _0x4838d7;};}function handleError(_0x2e5bde,_0x3487c8){_0x3487c8=_0x3487c8||0x1f4;return function(_0x240509){logger['error'](_0x240509[_0xbbf6('0x2b')]);if(_0x240509[_0xbbf6('0x2c')]){delete _0x240509[_0xbbf6('0x2c')];}_0x2e5bde[_0xbbf6('0x1d')](_0x3487c8)[_0xbbf6('0x2d')](_0x240509);};}exports[_0xbbf6('0x2e')]=function(_0x599b34,_0x7cfbe5){var _0x52b79c={},_0x354716={},_0x558349={'count':0x0,'rows':[]};var _0x4c579a=_[_0xbbf6('0x2f')](db[_0xbbf6('0x30')][_0xbbf6('0x31')],function(_0x2aa5e9){return{'name':_0x2aa5e9[_0xbbf6('0x32')],'type':_0x2aa5e9[_0xbbf6('0x33')]['key']};});_0x354716[_0xbbf6('0x34')]=_[_0xbbf6('0x2f')](_0x4c579a,'name');_0x354716[_0xbbf6('0x35')]=_[_0xbbf6('0x36')](_0x599b34['query']);_0x354716[_0xbbf6('0x37')]=_[_0xbbf6('0x38')](_0x354716[_0xbbf6('0x34')],_0x354716['query']);_0x52b79c['attributes']=_[_0xbbf6('0x38')](_0x354716[_0xbbf6('0x34')],qs['fields'](_0x599b34[_0xbbf6('0x35')]['fields']));_0x52b79c[_0xbbf6('0x39')]=_0x52b79c[_0xbbf6('0x39')]['length']?_0x52b79c[_0xbbf6('0x39')]:_0x354716[_0xbbf6('0x34')];if(!_0x599b34[_0xbbf6('0x35')][_0xbbf6('0x3a')](_0xbbf6('0x3b'))){_0x52b79c[_0xbbf6('0x20')]=qs['limit'](_0x599b34[_0xbbf6('0x35')]['limit']);_0x52b79c[_0xbbf6('0x22')]=qs[_0xbbf6('0x22')](_0x599b34['query']['offset']);}_0x52b79c[_0xbbf6('0x3c')]=qs[_0xbbf6('0x3d')](_0x599b34[_0xbbf6('0x35')][_0xbbf6('0x3d')]);_0x52b79c[_0xbbf6('0x3e')]=qs[_0xbbf6('0x37')](_[_0xbbf6('0x3f')](_0x599b34[_0xbbf6('0x35')],_0x354716[_0xbbf6('0x37')]),_0x4c579a);if(_0x599b34['query']['filter']){_0x52b79c[_0xbbf6('0x3e')]=_[_0xbbf6('0x40')](_0x52b79c[_0xbbf6('0x3e')],{'$or':_['map'](_0x4c579a,function(_0x1c8e1e){if(_0x1c8e1e[_0xbbf6('0x33')]!=='VIRTUAL'){var _0xd8ff81={};_0xd8ff81[_0x1c8e1e['name']]={'$like':'%'+_0x599b34[_0xbbf6('0x35')][_0xbbf6('0x41')]+'%'};return _0xd8ff81;}})});}_0x52b79c=_[_0xbbf6('0x40')]({},_0x52b79c,_0x599b34['options']);var _0x2df38d={'where':_0x52b79c[_0xbbf6('0x3e')]};return db[_0xbbf6('0x30')]['count'](_0x2df38d)[_0xbbf6('0x29')](function(_0xc72a0f){_0x558349[_0xbbf6('0x21')]=_0xc72a0f;if(_0x599b34[_0xbbf6('0x35')][_0xbbf6('0x42')]){_0x52b79c[_0xbbf6('0x43')]=[{'all':!![]}];}return db[_0xbbf6('0x30')][_0xbbf6('0x44')](_0x52b79c);})[_0xbbf6('0x29')](function(_0x148d8b){_0x558349['rows']=_0x148d8b;return _0x558349;})[_0xbbf6('0x29')](respondWithFilteredResult(_0x7cfbe5,_0x52b79c))['catch'](handleError(_0x7cfbe5,null));};exports[_0xbbf6('0x45')]=function(_0x25ab59,_0x2cb32c){var _0x58fc81={'raw':![],'where':{'id':_0x25ab59[_0xbbf6('0x46')]['id']}},_0x27a6b4={};_0x27a6b4['model']=_[_0xbbf6('0x36')](db[_0xbbf6('0x30')][_0xbbf6('0x31')]);_0x27a6b4[_0xbbf6('0x35')]=_['keys'](_0x25ab59[_0xbbf6('0x35')]);_0x27a6b4['filters']=_[_0xbbf6('0x38')](_0x27a6b4['model'],_0x27a6b4[_0xbbf6('0x35')]);_0x58fc81['attributes']=_[_0xbbf6('0x38')](_0x27a6b4[_0xbbf6('0x34')],qs[_0xbbf6('0x47')](_0x25ab59[_0xbbf6('0x35')][_0xbbf6('0x47')]));_0x58fc81[_0xbbf6('0x39')]=_0x58fc81[_0xbbf6('0x39')][_0xbbf6('0x48')]?_0x58fc81[_0xbbf6('0x39')]:_0x27a6b4['model'];if(_0x25ab59[_0xbbf6('0x35')]['includeAll']){_0x58fc81['include']=[{'all':!![]}];}_0x58fc81=_[_0xbbf6('0x40')]({},_0x58fc81,_0x25ab59[_0xbbf6('0x49')]);return db['AnalyticFieldReport'][_0xbbf6('0x4a')](_0x58fc81)[_0xbbf6('0x29')](handleEntityNotFound(_0x2cb32c,null))[_0xbbf6('0x29')](respondWithResult(_0x2cb32c,null))[_0xbbf6('0x4b')](handleError(_0x2cb32c,null));};exports[_0xbbf6('0x4c')]=function(_0x5a2b87,_0x2cb629){return db[_0xbbf6('0x30')][_0xbbf6('0x4c')](_0x5a2b87['body'],{})['then'](respondWithResult(_0x2cb629,0xc9))[_0xbbf6('0x4b')](handleError(_0x2cb629,null));};exports[_0xbbf6('0x4d')]=function(_0x345f94,_0xc6e776){return db[_0xbbf6('0x30')][_0xbbf6('0x4d')](_0x345f94[_0xbbf6('0x4e')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0xc6e776,0xc9))[_0xbbf6('0x4b')](handleError(_0xc6e776,null));};exports[_0xbbf6('0x28')]=function(_0x551cf2,_0x85495e){if(_0x551cf2[_0xbbf6('0x4e')]['id']){delete _0x551cf2['body']['id'];}return db['AnalyticFieldReport'][_0xbbf6('0x4a')]({'where':{'id':_0x551cf2[_0xbbf6('0x46')]['id']}})[_0xbbf6('0x29')](handleEntityNotFound(_0x85495e,null))[_0xbbf6('0x29')](saveUpdates(_0x551cf2[_0xbbf6('0x4e')],null))[_0xbbf6('0x29')](respondWithResult(_0x85495e,null))['catch'](handleError(_0x85495e,null));};exports[_0xbbf6('0x2a')]=function(_0x27b3e2,_0x24bd9c){return db['AnalyticFieldReport']['find']({'where':{'id':_0x27b3e2[_0xbbf6('0x46')]['id']}})['then'](handleEntityNotFound(_0x24bd9c,null))[_0xbbf6('0x29')](removeEntity(_0x24bd9c,null))[_0xbbf6('0x4b')](handleError(_0x24bd9c,null));};exports[_0xbbf6('0x4f')]=function(_0x3e2db0,_0x385ebd){return db[_0xbbf6('0x30')][_0xbbf6('0x2a')]({'where':{'id':_0x3e2db0['query'][_0xbbf6('0x50')]||[]},'raw':![],'individualHooks':!![]})[_0xbbf6('0x29')](respondWithResult(_0x385ebd,0xcc))['catch'](handleError(_0x385ebd,null));};exports[_0xbbf6('0x51')]=function(_0x31d3ff,_0xbeb33c,_0x5c6537){return db['AnalyticCustomReport'][_0xbbf6('0x52')]({'where':{'id':_0x31d3ff[_0xbbf6('0x46')]['id']}})[_0xbbf6('0x29')](handleEntityNotFound(_0xbeb33c,null))[_0xbbf6('0x29')](function(_0x5c4704){if(_0x5c4704){return db[_0xbbf6('0x53')][_0xbbf6('0x54')](function(_0x526b45){return db[_0xbbf6('0x30')][_0xbbf6('0x2a')]({'where':{'CustomReportId':_0x31d3ff[_0xbbf6('0x46')]['id']},'transaction':_0x526b45})[_0xbbf6('0x29')](function(_0x2251e7){var _0x2d6413=_[_0xbbf6('0x2f')](_0x31d3ff[_0xbbf6('0x4e')],function(_0x4a923a){delete _0x4a923a['id'];_0x4a923a[_0xbbf6('0x55')]=_0x31d3ff[_0xbbf6('0x46')]['id'];return _0x4a923a;});return db['AnalyticFieldReport'][_0xbbf6('0x4d')](_0x2d6413,{'transaction':_0x526b45});});})[_0xbbf6('0x29')](function(){return db[_0xbbf6('0x30')][_0xbbf6('0x44')]({'where':{'CustomReportId':_0x31d3ff[_0xbbf6('0x46')]['id']}});});}})[_0xbbf6('0x29')](respondWithResult(_0xbeb33c,null))[_0xbbf6('0x4b')](handleError(_0xbeb33c,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index 4ba968f..744b1c1 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 _0x70d8=['../../config/environment','./analyticFieldReport.attributes','exports','define','AnalyticFieldReport','analytics_report_fields','lodash','util','../../config/logger','api','request-promise','rimraf'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x70d8,0x156));var _0x870d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x70d8[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x870d('0x0'));var util=require(_0x870d('0x1'));var logger=require(_0x870d('0x2'))(_0x870d('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x870d('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x870d('0x5'));var config=require(_0x870d('0x6'));var attributes=require(_0x870d('0x7'));module[_0x870d('0x8')]=function(_0x4c7236,_0x50608d){return _0x4c7236[_0x870d('0x9')](_0x870d('0xa'),attributes,{'tableName':_0x870d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x47d9=['../../config/environment','./analyticFieldReport.attributes','exports','define','analytics_report_fields','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x7148a3,_0x1c6652){var _0x52f31d=function(_0x31c8a7){while(--_0x31c8a7){_0x7148a3['push'](_0x7148a3['shift']());}};_0x52f31d(++_0x1c6652);}(_0x47d9,0x7e));var _0x947d=function(_0x4f8e94,_0x3736fd){_0x4f8e94=_0x4f8e94-0x0;var _0x4c2836=_0x47d9[_0x4f8e94];return _0x4c2836;};'use strict';var _=require(_0x947d('0x0'));var util=require(_0x947d('0x1'));var logger=require(_0x947d('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x947d('0x3'));var fs=require('fs');var path=require(_0x947d('0x4'));var rimraf=require(_0x947d('0x5'));var config=require(_0x947d('0x6'));var attributes=require(_0x947d('0x7'));module[_0x947d('0x8')]=function(_0x19e410,_0x357b1e){return _0x19e410[_0x947d('0x9')]('AnalyticFieldReport',attributes,{'tableName':_0x947d('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 de0cb94..53fab2c 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 _0x5588=['error','code','message','result','catch','util','moment','randomstring','../../config/utils','client','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s'];(function(_0x417e70,_0x48ea98){var _0x4163c9=function(_0x2f695c){while(--_0x2f695c){_0x417e70['push'](_0x417e70['shift']());}};_0x4163c9(++_0x48ea98);}(_0x5588,0x7c));var _0x8558=function(_0x59a30c,_0x5c8de1){_0x59a30c=_0x59a30c-0x0;var _0x515827=_0x5588[_0x59a30c];return _0x515827;};'use strict';var _=require('lodash');var util=require(_0x8558('0x0'));var moment=require(_0x8558('0x1'));var BPromise=require('bluebird');var rs=require(_0x8558('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8558('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x8558('0x4')][_0x8558('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x2f5133,_0x464540,_0xca5df0){return new BPromise(function(_0x24a0b9,_0xae5352){return client[_0x8558('0x6')](_0x2f5133,_0xca5df0)[_0x8558('0x7')](function(_0x4db476){logger[_0x8558('0x8')](_0x8558('0x9'),_0x464540,_0x8558('0xa'));logger['debug'](_0x8558('0xb'),_0x464540,_0x8558('0xa'),JSON['stringify'](_0x4db476));if(_0x4db476[_0x8558('0xc')]){if(_0x4db476[_0x8558('0xc')][_0x8558('0xd')]===0x1f4){logger[_0x8558('0xc')]('AnalyticFieldReport,\x20%s,\x20%s',_0x464540,_0x4db476[_0x8558('0xc')][_0x8558('0xe')]);return _0xae5352(_0x4db476[_0x8558('0xc')]['message']);}logger[_0x8558('0xc')](_0x8558('0x9'),_0x464540,_0x4db476[_0x8558('0xc')][_0x8558('0xe')]);return _0x24a0b9(_0x4db476[_0x8558('0xc')][_0x8558('0xe')]);}else{logger[_0x8558('0x8')](_0x8558('0x9'),_0x464540,_0x8558('0xa'));_0x24a0b9(_0x4db476[_0x8558('0xf')][_0x8558('0xe')]);}})[_0x8558('0x10')](function(_0x59f55f){logger['error'](_0x8558('0x9'),_0x464540,_0x59f55f);_0xae5352(_0x59f55f);});});} \ No newline at end of file +var _0x503a=['http','info','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','AnalyticFieldReport,\x20%s,\x20%s','result','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client'];(function(_0x4f6bd3,_0x466469){var _0x26bebf=function(_0x1690db){while(--_0x1690db){_0x4f6bd3['push'](_0x4f6bd3['shift']());}};_0x26bebf(++_0x466469);}(_0x503a,0x69));var _0xa503=function(_0x519c88,_0xb84103){_0x519c88=_0x519c88-0x0;var _0x4668d7=_0x503a[_0x519c88];return _0x4668d7;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa503('0x0'));var BPromise=require(_0xa503('0x1'));var rs=require(_0xa503('0x2'));var fs=require('fs');var Redis=require(_0xa503('0x3'));var db=require(_0xa503('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xa503('0x5'))(_0xa503('0x6'));var config=require('../../config/environment');var jayson=require(_0xa503('0x7'));var client=jayson[_0xa503('0x8')][_0xa503('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ac7fa,_0x2f149a,_0x68e194){return new BPromise(function(_0x492f81,_0x4bed8b){return client['request'](_0x4ac7fa,_0x68e194)['then'](function(_0xa40786){logger[_0xa503('0xa')]('AnalyticFieldReport,\x20%s,\x20%s',_0x2f149a,'request\x20sent');logger[_0xa503('0xb')](_0xa503('0xc'),_0x2f149a,_0xa503('0xd'),JSON[_0xa503('0xe')](_0xa40786));if(_0xa40786[_0xa503('0xf')]){if(_0xa40786[_0xa503('0xf')]['code']===0x1f4){logger['error']('AnalyticFieldReport,\x20%s,\x20%s',_0x2f149a,_0xa40786[_0xa503('0xf')][_0xa503('0x10')]);return _0x4bed8b(_0xa40786['error'][_0xa503('0x10')]);}logger[_0xa503('0xf')](_0xa503('0x11'),_0x2f149a,_0xa40786['error'][_0xa503('0x10')]);return _0x492f81(_0xa40786[_0xa503('0xf')]['message']);}else{logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x2f149a,_0xa503('0xd'));_0x492f81(_0xa40786[_0xa503('0x12')][_0xa503('0x10')]);}})['catch'](function(_0x15a0a1){logger['error'](_0xa503('0x11'),_0x2f149a,_0x15a0a1);_0x4bed8b(_0x15a0a1);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index acd5bde..438b8d2 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 _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x45c726,_0x4ad231){var _0x4c52dd=function(_0x18e1ee){while(--_0x18e1ee){_0x45c726['push'](_0x45c726['shift']());}};_0x4c52dd(++_0x4ad231);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4709c0,_0x3396c7){_0x4709c0=_0x4709c0-0x0;var _0x13348b=_0xa9e0[_0x4709c0];return _0x13348b;};'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['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x86f5a9,_0xcf5313){var _0x3e7856=function(_0x297555){while(--_0x297555){_0x86f5a9['push'](_0x86f5a9['shift']());}};_0x3e7856(++_0xcf5313);}(_0xa9e0,0x123));var _0x0a9e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xa9e0[_0x501510];return _0x1e6ee5;};'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['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index f7f52ba..4673116 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 _0x351d=['sequelize','STRING','name'];(function(_0x42e603,_0x11d977){var _0xa1e64d=function(_0x2e00be){while(--_0x2e00be){_0x42e603['push'](_0x42e603['shift']());}};_0xa1e64d(++_0x11d977);}(_0x351d,0x90));var _0xd351=function(_0x53b8c8,_0x345f06){_0x53b8c8=_0x53b8c8-0x0;var _0x5c9b31=_0x351d[_0x53b8c8];return _0x5c9b31;};'use strict';var Sequelize=require(_0xd351('0x0'));module['exports']={'name':{'type':Sequelize[_0xd351('0x1')],'allowNull':![],'unique':_0xd351('0x2')},'table':{'type':Sequelize[_0xd351('0x1')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0xd351('0x1')]}}; \ No newline at end of file +var _0x3657=['exports','STRING','TEXT','sequelize'];(function(_0x104049,_0x2ef746){var _0x3375e1=function(_0x2d93ce){while(--_0x2d93ce){_0x104049['push'](_0x104049['shift']());}};_0x3375e1(++_0x2ef746);}(_0x3657,0x183));var _0x7365=function(_0x10bcc4,_0x4400e2){_0x10bcc4=_0x10bcc4-0x0;var _0x2da988=_0x3657[_0x10bcc4];return _0x2da988;};'use strict';var Sequelize=require(_0x7365('0x0'));module[_0x7365('0x1')]={'name':{'type':Sequelize[_0x7365('0x2')],'allowNull':![],'unique':'name'},'table':{'type':Sequelize[_0x7365('0x2')]},'metric':{'type':Sequelize[_0x7365('0x3')]},'description':{'type':Sequelize[_0x7365('0x2')]}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 5fed6d1..4a325f0 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 _0x5fc3=['user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','reject','save','update','then','destroy','get','Metrics','error','stack','name','send','index','map','AnalyticMetric','rawAttributes','fieldName','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','sort','pick','filter','where','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body'];(function(_0x59df78,_0x183215){var _0xf4c866=function(_0x1a1b6c){while(--_0x1a1b6c){_0x59df78['push'](_0x59df78['shift']());}};_0xf4c866(++_0x183215);}(_0x5fc3,0xa8));var _0x35fc=function(_0x874cf1,_0x2a4954){_0x874cf1=_0x874cf1-0x0;var _0x233579=_0x5fc3[_0x874cf1];return _0x233579;};'use strict';var emlformat=require(_0x35fc('0x0'));var rimraf=require(_0x35fc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x35fc('0x2'));var rp=require(_0x35fc('0x3'));var moment=require(_0x35fc('0x4'));var BPromise=require(_0x35fc('0x5'));var Mustache=require(_0x35fc('0x6'));var util=require('util');var path=require(_0x35fc('0x7'));var sox=require(_0x35fc('0x8'));var csv=require(_0x35fc('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x35fc('0xa'));var squel=require('squel');var crypto=require(_0x35fc('0xb'));var jsforce=require(_0x35fc('0xc'));var deskjs=require(_0x35fc('0xd'));var toCsv=require(_0x35fc('0x9'));var querystring=require(_0x35fc('0xe'));var Papa=require(_0x35fc('0xf'));var Redis=require(_0x35fc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x35fc('0x11'));var as=require(_0x35fc('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x35fc('0x13'))(_0x35fc('0x14'));var utils=require('../../config/utils');var config=require(_0x35fc('0x15'));var licenseUtil=require(_0x35fc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4cbe74,_0x409357){_0x409357=_0x409357||0xcc;return function(_0x5d462a){if(_0x5d462a){return _0x4cbe74[_0x35fc('0x17')](_0x409357);}return _0x4cbe74[_0x35fc('0x18')](_0x409357)[_0x35fc('0x19')]();};}function respondWithResult(_0x29730f,_0x38d9f2){_0x38d9f2=_0x38d9f2||0xc8;return function(_0x5cfe94){if(_0x5cfe94){return _0x29730f['status'](_0x38d9f2)['json'](_0x5cfe94);}};}function respondWithFilteredResult(_0x558364,_0x398b67){return function(_0x229d56){if(_0x229d56){var _0x53b898=typeof _0x398b67[_0x35fc('0x1a')]===_0x35fc('0x1b')&&typeof _0x398b67[_0x35fc('0x1c')]==='undefined';var _0x26ba54=_0x229d56[_0x35fc('0x1d')];var _0x553677=_0x53b898?0x0:_0x398b67[_0x35fc('0x1a')];var _0x363e47=_0x53b898?_0x229d56[_0x35fc('0x1d')]:_0x398b67['offset']+_0x398b67[_0x35fc('0x1c')];var _0x3c58ea;if(_0x363e47>=_0x26ba54){_0x363e47=_0x26ba54;_0x3c58ea=0xc8;}else{_0x3c58ea=0xce;}_0x558364[_0x35fc('0x18')](_0x3c58ea);return _0x558364['set'](_0x35fc('0x1e'),_0x553677+'-'+_0x363e47+'/'+_0x26ba54)[_0x35fc('0x1f')](_0x229d56);}return null;};}function patchUpdates(_0x3229d1){return function(_0x251a1f){try{jsonpatch[_0x35fc('0x20')](_0x251a1f,_0x3229d1,!![]);}catch(_0x21f1a9){return BPromise[_0x35fc('0x21')](_0x21f1a9);}return _0x251a1f[_0x35fc('0x22')]();};}function saveUpdates(_0x2405e8,_0x427eae){return function(_0x5bd2b8){if(_0x5bd2b8){return _0x5bd2b8[_0x35fc('0x23')](_0x2405e8)[_0x35fc('0x24')](function(_0x257719){return _0x257719;});}return null;};}function removeEntity(_0x2d8183,_0x3b4743){return function(_0x55e9e7){if(_0x55e9e7){return _0x55e9e7[_0x35fc('0x25')]()[_0x35fc('0x24')](function(){var _0x561bf8=_0x55e9e7[_0x35fc('0x26')]({'plain':!![]});var _0x5a93df=_0x35fc('0x27');return db['UserProfileResource'][_0x35fc('0x25')]({'where':{'type':_0x5a93df,'resourceId':_0x561bf8['id']}})['then'](function(){return _0x55e9e7;});})[_0x35fc('0x24')](function(){_0x2d8183[_0x35fc('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x519264,_0x47774c){return function(_0x58edb6){if(!_0x58edb6){_0x519264[_0x35fc('0x17')](0x194);}return _0x58edb6;};}function handleError(_0x1a5d92,_0x57001c){_0x57001c=_0x57001c||0x1f4;return function(_0x26b7cb){logger[_0x35fc('0x28')](_0x26b7cb[_0x35fc('0x29')]);if(_0x26b7cb[_0x35fc('0x2a')]){delete _0x26b7cb[_0x35fc('0x2a')];}_0x1a5d92[_0x35fc('0x18')](_0x57001c)[_0x35fc('0x2b')](_0x26b7cb);};}exports[_0x35fc('0x2c')]=function(_0x54aedc,_0x1cd1ae){var _0x220931={},_0x22af18={},_0x52acc5={'count':0x0,'rows':[]};var _0xe79f52=_[_0x35fc('0x2d')](db[_0x35fc('0x2e')][_0x35fc('0x2f')],function(_0xd8a4ca){return{'name':_0xd8a4ca[_0x35fc('0x30')],'type':_0xd8a4ca[_0x35fc('0x31')][_0x35fc('0x32')]};});_0x22af18[_0x35fc('0x33')]=_[_0x35fc('0x2d')](_0xe79f52,'name');_0x22af18['query']=_[_0x35fc('0x34')](_0x54aedc['query']);_0x22af18[_0x35fc('0x35')]=_[_0x35fc('0x36')](_0x22af18[_0x35fc('0x33')],_0x22af18[_0x35fc('0x37')]);_0x220931[_0x35fc('0x38')]=_[_0x35fc('0x36')](_0x22af18['model'],qs[_0x35fc('0x39')](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x39')]));_0x220931[_0x35fc('0x38')]=_0x220931[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x220931['attributes']:_0x22af18[_0x35fc('0x33')];if(!_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3b')]('nolimit')){_0x220931[_0x35fc('0x1c')]=qs['limit'](_0x54aedc[_0x35fc('0x37')][_0x35fc('0x1c')]);_0x220931[_0x35fc('0x1a')]=qs[_0x35fc('0x1a')](_0x54aedc['query']['offset']);}_0x220931['order']=qs[_0x35fc('0x3c')](_0x54aedc['query'][_0x35fc('0x3c')]);_0x220931['where']=qs[_0x35fc('0x35')](_[_0x35fc('0x3d')](_0x54aedc[_0x35fc('0x37')],_0x22af18[_0x35fc('0x35')]),_0xe79f52);if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]){_0x220931[_0x35fc('0x3f')]=_['merge'](_0x220931[_0x35fc('0x3f')],{'$or':_[_0x35fc('0x2d')](_0xe79f52,function(_0x4e0ce3){if(_0x4e0ce3[_0x35fc('0x31')]!==_0x35fc('0x40')){var _0x1aac67={};_0x1aac67[_0x4e0ce3[_0x35fc('0x2a')]]={'$like':'%'+_0x54aedc[_0x35fc('0x37')][_0x35fc('0x3e')]+'%'};return _0x1aac67;}})});}_0x220931=_['merge']({},_0x220931,_0x54aedc[_0x35fc('0x41')]);var _0x267858={'where':_0x220931[_0x35fc('0x3f')]};return db['AnalyticMetric'][_0x35fc('0x1d')](_0x267858)[_0x35fc('0x24')](function(_0x596919){_0x52acc5[_0x35fc('0x1d')]=_0x596919;if(_0x54aedc[_0x35fc('0x37')][_0x35fc('0x42')]){_0x220931[_0x35fc('0x43')]=[{'all':!![]}];}return db[_0x35fc('0x2e')][_0x35fc('0x44')](_0x220931);})[_0x35fc('0x24')](function(_0x3ec51f){_0x52acc5['rows']=_0x3ec51f;return _0x52acc5;})['then'](respondWithFilteredResult(_0x1cd1ae,_0x220931))[_0x35fc('0x45')](handleError(_0x1cd1ae,null));};exports[_0x35fc('0x46')]=function(_0x4fdc6d,_0x5c2e5c){var _0x4ff202={'raw':!![],'where':{'id':_0x4fdc6d[_0x35fc('0x47')]['id']}},_0x79677d={};_0x79677d['model']=_[_0x35fc('0x34')](db[_0x35fc('0x2e')][_0x35fc('0x2f')]);_0x79677d[_0x35fc('0x37')]=_['keys'](_0x4fdc6d['query']);_0x79677d['filters']=_['intersection'](_0x79677d['model'],_0x79677d[_0x35fc('0x37')]);_0x4ff202[_0x35fc('0x38')]=_['intersection'](_0x79677d[_0x35fc('0x33')],qs['fields'](_0x4fdc6d[_0x35fc('0x37')][_0x35fc('0x39')]));_0x4ff202[_0x35fc('0x38')]=_0x4ff202[_0x35fc('0x38')][_0x35fc('0x3a')]?_0x4ff202['attributes']:_0x79677d[_0x35fc('0x33')];if(_0x4fdc6d[_0x35fc('0x37')]['includeAll']){_0x4ff202[_0x35fc('0x43')]=[{'all':!![]}];}_0x4ff202=_[_0x35fc('0x48')]({},_0x4ff202,_0x4fdc6d[_0x35fc('0x41')]);return db[_0x35fc('0x2e')]['find'](_0x4ff202)[_0x35fc('0x24')](handleEntityNotFound(_0x5c2e5c,null))['then'](respondWithResult(_0x5c2e5c,null))['catch'](handleError(_0x5c2e5c,null));};exports[_0x35fc('0x49')]=function(_0x9db7e8,_0x18dc78){return db[_0x35fc('0x2e')][_0x35fc('0x49')](_0x9db7e8[_0x35fc('0x4a')],{})[_0x35fc('0x24')](function(_0x16afa6){var _0x4f555f=_0x9db7e8[_0x35fc('0x4b')][_0x35fc('0x26')]({'plain':!![]});if(!_0x4f555f)throw new Error(_0x35fc('0x4c'));if(_0x4f555f[_0x35fc('0x4d')]===_0x35fc('0x4b')){var _0x1e3221=_0x16afa6[_0x35fc('0x26')]({'plain':!![]});var _0x347a4a=_0x35fc('0x27');return db[_0x35fc('0x4e')][_0x35fc('0x4f')]({'where':{'name':_0x347a4a,'userProfileId':_0x4f555f[_0x35fc('0x50')]},'raw':!![]})[_0x35fc('0x24')](function(_0x3146e2){if(_0x3146e2&&_0x3146e2['autoAssociation']===0x0){return db['UserProfileResource'][_0x35fc('0x49')]({'name':_0x1e3221[_0x35fc('0x2a')],'resourceId':_0x1e3221['id'],'type':_0x3146e2[_0x35fc('0x2a')],'sectionId':_0x3146e2['id']},{})[_0x35fc('0x24')](function(){return _0x16afa6;});}else{return _0x16afa6;}})[_0x35fc('0x45')](function(_0x3e6494){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e6494);throw _0x3e6494;});}return _0x16afa6;})[_0x35fc('0x24')](respondWithResult(_0x18dc78,0xc9))[_0x35fc('0x45')](handleError(_0x18dc78,null));};exports[_0x35fc('0x23')]=function(_0x38bc78,_0x5b2595){if(_0x38bc78[_0x35fc('0x4a')]['id']){delete _0x38bc78[_0x35fc('0x4a')]['id'];}return db['AnalyticMetric'][_0x35fc('0x4f')]({'where':{'id':_0x38bc78[_0x35fc('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b2595,null))[_0x35fc('0x24')](saveUpdates(_0x38bc78[_0x35fc('0x4a')],null))[_0x35fc('0x24')](respondWithResult(_0x5b2595,null))[_0x35fc('0x45')](handleError(_0x5b2595,null));};exports['destroy']=function(_0x4de34b,_0x502a15){return db[_0x35fc('0x2e')][_0x35fc('0x4f')]({'where':{'id':_0x4de34b['params']['id']}})[_0x35fc('0x24')](handleEntityNotFound(_0x502a15,null))[_0x35fc('0x24')](removeEntity(_0x502a15,null))[_0x35fc('0x45')](handleError(_0x502a15,null));}; \ No newline at end of file +var _0xdc97=['mustache','path','sox','to-csv','ejs','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','get','destroy','sendStatus','error','stack','name','send','AnalyticMetric','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','rows','catch','params','keys','fields','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Metrics','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','request-promise','bluebird'];(function(_0x4b4c4e,_0x447cb0){var _0x17f2df=function(_0x3dcac7){while(--_0x3dcac7){_0x4b4c4e['push'](_0x4b4c4e['shift']());}};_0x17f2df(++_0x447cb0);}(_0xdc97,0x13b));var _0x7dc9=function(_0x3597f4,_0x51352b){_0x3597f4=_0x3597f4-0x0;var _0x548913=_0xdc97[_0x3597f4];return _0x548913;};'use strict';var emlformat=require(_0x7dc9('0x0'));var rimraf=require(_0x7dc9('0x1'));var zipdir=require(_0x7dc9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x7dc9('0x3'));var moment=require('moment');var BPromise=require(_0x7dc9('0x4'));var Mustache=require(_0x7dc9('0x5'));var util=require('util');var path=require(_0x7dc9('0x6'));var sox=require(_0x7dc9('0x7'));var csv=require(_0x7dc9('0x8'));var ejs=require(_0x7dc9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7dc9('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7dc9('0xb'));var deskjs=require(_0x7dc9('0xc'));var toCsv=require(_0x7dc9('0x8'));var querystring=require(_0x7dc9('0xd'));var Papa=require(_0x7dc9('0xe'));var Redis=require('ioredis');var authService=require(_0x7dc9('0xf'));var qs=require(_0x7dc9('0x10'));var as=require(_0x7dc9('0x11'));var hardwareService=require(_0x7dc9('0x12'));var logger=require(_0x7dc9('0x13'))(_0x7dc9('0x14'));var utils=require(_0x7dc9('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x599ef1,_0x94c75a){_0x94c75a=_0x94c75a||0xcc;return function(_0x14e5db){if(_0x14e5db){return _0x599ef1['sendStatus'](_0x94c75a);}return _0x599ef1[_0x7dc9('0x16')](_0x94c75a)[_0x7dc9('0x17')]();};}function respondWithResult(_0xaadf2,_0xf37bc7){_0xf37bc7=_0xf37bc7||0xc8;return function(_0x31d43d){if(_0x31d43d){return _0xaadf2[_0x7dc9('0x16')](_0xf37bc7)['json'](_0x31d43d);}};}function respondWithFilteredResult(_0x3a54f2,_0x278191){return function(_0x1b0aa1){if(_0x1b0aa1){var _0x442819=typeof _0x278191[_0x7dc9('0x18')]===_0x7dc9('0x19')&&typeof _0x278191[_0x7dc9('0x1a')]===_0x7dc9('0x19');var _0x4778d5=_0x1b0aa1['count'];var _0x22577e=_0x442819?0x0:_0x278191['offset'];var _0x1f5906=_0x442819?_0x1b0aa1[_0x7dc9('0x1b')]:_0x278191['offset']+_0x278191[_0x7dc9('0x1a')];var _0x3b738a;if(_0x1f5906>=_0x4778d5){_0x1f5906=_0x4778d5;_0x3b738a=0xc8;}else{_0x3b738a=0xce;}_0x3a54f2[_0x7dc9('0x16')](_0x3b738a);return _0x3a54f2[_0x7dc9('0x1c')](_0x7dc9('0x1d'),_0x22577e+'-'+_0x1f5906+'/'+_0x4778d5)[_0x7dc9('0x1e')](_0x1b0aa1);}return null;};}function patchUpdates(_0x2dad65){return function(_0x2895f5){try{jsonpatch[_0x7dc9('0x1f')](_0x2895f5,_0x2dad65,!![]);}catch(_0x2b38d6){return BPromise['reject'](_0x2b38d6);}return _0x2895f5['save']();};}function saveUpdates(_0x12954f,_0x5981e2){return function(_0x596e0f){if(_0x596e0f){return _0x596e0f[_0x7dc9('0x20')](_0x12954f)[_0x7dc9('0x21')](function(_0x5e9525){return _0x5e9525;});}return null;};}function removeEntity(_0xffc080,_0x43d31f){return function(_0x41110a){if(_0x41110a){return _0x41110a['destroy']()[_0x7dc9('0x21')](function(){var _0x1e3a8d=_0x41110a[_0x7dc9('0x22')]({'plain':!![]});var _0x55a482='Metrics';return db['UserProfileResource'][_0x7dc9('0x23')]({'where':{'type':_0x55a482,'resourceId':_0x1e3a8d['id']}})[_0x7dc9('0x21')](function(){return _0x41110a;});})['then'](function(){_0xffc080['status'](0xcc)[_0x7dc9('0x17')]();});}};}function handleEntityNotFound(_0x5afb7d,_0x2d22eb){return function(_0x1c690b){if(!_0x1c690b){_0x5afb7d[_0x7dc9('0x24')](0x194);}return _0x1c690b;};}function handleError(_0x3e4102,_0xa2aaa9){_0xa2aaa9=_0xa2aaa9||0x1f4;return function(_0x450124){logger[_0x7dc9('0x25')](_0x450124[_0x7dc9('0x26')]);if(_0x450124[_0x7dc9('0x27')]){delete _0x450124[_0x7dc9('0x27')];}_0x3e4102[_0x7dc9('0x16')](_0xa2aaa9)[_0x7dc9('0x28')](_0x450124);};}exports['index']=function(_0x4e929c,_0x513dd6){var _0x49a4a5={},_0x4a68f0={},_0x553a03={'count':0x0,'rows':[]};var _0x58c4e8=_['map'](db[_0x7dc9('0x29')][_0x7dc9('0x2a')],function(_0x29dcef){return{'name':_0x29dcef[_0x7dc9('0x2b')],'type':_0x29dcef[_0x7dc9('0x2c')][_0x7dc9('0x2d')]};});_0x4a68f0['model']=_['map'](_0x58c4e8,'name');_0x4a68f0[_0x7dc9('0x2e')]=_['keys'](_0x4e929c[_0x7dc9('0x2e')]);_0x4a68f0[_0x7dc9('0x2f')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],_0x4a68f0[_0x7dc9('0x2e')]);_0x49a4a5[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0x4a68f0[_0x7dc9('0x31')],qs['fields'](_0x4e929c[_0x7dc9('0x2e')]['fields']));_0x49a4a5[_0x7dc9('0x32')]=_0x49a4a5[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x49a4a5[_0x7dc9('0x32')]:_0x4a68f0['model'];if(!_0x4e929c[_0x7dc9('0x2e')]['hasOwnProperty'](_0x7dc9('0x34'))){_0x49a4a5['limit']=qs['limit'](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x1a')]);_0x49a4a5[_0x7dc9('0x18')]=qs[_0x7dc9('0x18')](_0x4e929c['query'][_0x7dc9('0x18')]);}_0x49a4a5[_0x7dc9('0x35')]=qs[_0x7dc9('0x36')](_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x36')]);_0x49a4a5[_0x7dc9('0x37')]=qs[_0x7dc9('0x2f')](_[_0x7dc9('0x38')](_0x4e929c[_0x7dc9('0x2e')],_0x4a68f0[_0x7dc9('0x2f')]),_0x58c4e8);if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]){_0x49a4a5['where']=_[_0x7dc9('0x3a')](_0x49a4a5[_0x7dc9('0x37')],{'$or':_[_0x7dc9('0x3b')](_0x58c4e8,function(_0xfd2612){if(_0xfd2612['type']!==_0x7dc9('0x3c')){var _0x89db0e={};_0x89db0e[_0xfd2612[_0x7dc9('0x27')]]={'$like':'%'+_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x39')]+'%'};return _0x89db0e;}})});}_0x49a4a5=_[_0x7dc9('0x3a')]({},_0x49a4a5,_0x4e929c['options']);var _0x553230={'where':_0x49a4a5[_0x7dc9('0x37')]};return db[_0x7dc9('0x29')]['count'](_0x553230)[_0x7dc9('0x21')](function(_0x4a37ec){_0x553a03[_0x7dc9('0x1b')]=_0x4a37ec;if(_0x4e929c[_0x7dc9('0x2e')][_0x7dc9('0x3d')]){_0x49a4a5['include']=[{'all':!![]}];}return db[_0x7dc9('0x29')][_0x7dc9('0x3e')](_0x49a4a5);})[_0x7dc9('0x21')](function(_0x95513c){_0x553a03[_0x7dc9('0x3f')]=_0x95513c;return _0x553a03;})[_0x7dc9('0x21')](respondWithFilteredResult(_0x513dd6,_0x49a4a5))[_0x7dc9('0x40')](handleError(_0x513dd6,null));};exports['show']=function(_0x187aa6,_0x4f29b2){var _0x52d883={'raw':!![],'where':{'id':_0x187aa6[_0x7dc9('0x41')]['id']}},_0xcced6c={};_0xcced6c[_0x7dc9('0x31')]=_[_0x7dc9('0x42')](db[_0x7dc9('0x29')][_0x7dc9('0x2a')]);_0xcced6c[_0x7dc9('0x2e')]=_[_0x7dc9('0x42')](_0x187aa6[_0x7dc9('0x2e')]);_0xcced6c['filters']=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],_0xcced6c[_0x7dc9('0x2e')]);_0x52d883[_0x7dc9('0x32')]=_[_0x7dc9('0x30')](_0xcced6c[_0x7dc9('0x31')],qs['fields'](_0x187aa6[_0x7dc9('0x2e')][_0x7dc9('0x43')]));_0x52d883['attributes']=_0x52d883[_0x7dc9('0x32')][_0x7dc9('0x33')]?_0x52d883[_0x7dc9('0x32')]:_0xcced6c['model'];if(_0x187aa6[_0x7dc9('0x2e')]['includeAll']){_0x52d883['include']=[{'all':!![]}];}_0x52d883=_[_0x7dc9('0x3a')]({},_0x52d883,_0x187aa6[_0x7dc9('0x44')]);return db[_0x7dc9('0x29')]['find'](_0x52d883)['then'](handleEntityNotFound(_0x4f29b2,null))[_0x7dc9('0x21')](respondWithResult(_0x4f29b2,null))['catch'](handleError(_0x4f29b2,null));};exports[_0x7dc9('0x45')]=function(_0x4ab558,_0x5e2d59){return db[_0x7dc9('0x29')][_0x7dc9('0x45')](_0x4ab558[_0x7dc9('0x46')],{})[_0x7dc9('0x21')](function(_0x414bf4){var _0x113087=_0x4ab558[_0x7dc9('0x47')][_0x7dc9('0x22')]({'plain':!![]});if(!_0x113087)throw new Error(_0x7dc9('0x48'));if(_0x113087[_0x7dc9('0x49')]===_0x7dc9('0x47')){var _0x13580b=_0x414bf4[_0x7dc9('0x22')]({'plain':!![]});var _0x59be9b=_0x7dc9('0x4a');return db['UserProfileSection']['find']({'where':{'name':_0x59be9b,'userProfileId':_0x113087[_0x7dc9('0x4b')]},'raw':!![]})[_0x7dc9('0x21')](function(_0x40e382){if(_0x40e382&&_0x40e382[_0x7dc9('0x4c')]===0x0){return db[_0x7dc9('0x4d')]['create']({'name':_0x13580b[_0x7dc9('0x27')],'resourceId':_0x13580b['id'],'type':_0x40e382[_0x7dc9('0x27')],'sectionId':_0x40e382['id']},{})[_0x7dc9('0x21')](function(){return _0x414bf4;});}else{return _0x414bf4;}})['catch'](function(_0x341909){logger[_0x7dc9('0x25')](_0x7dc9('0x4e'),_0x341909);throw _0x341909;});}return _0x414bf4;})[_0x7dc9('0x21')](respondWithResult(_0x5e2d59,0xc9))[_0x7dc9('0x40')](handleError(_0x5e2d59,null));};exports[_0x7dc9('0x20')]=function(_0x593132,_0x366b8b){if(_0x593132[_0x7dc9('0x46')]['id']){delete _0x593132[_0x7dc9('0x46')]['id'];}return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x593132[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x366b8b,null))[_0x7dc9('0x21')](saveUpdates(_0x593132[_0x7dc9('0x46')],null))[_0x7dc9('0x21')](respondWithResult(_0x366b8b,null))[_0x7dc9('0x40')](handleError(_0x366b8b,null));};exports[_0x7dc9('0x23')]=function(_0x4fec6e,_0x1767b6){return db[_0x7dc9('0x29')][_0x7dc9('0x4f')]({'where':{'id':_0x4fec6e[_0x7dc9('0x41')]['id']}})[_0x7dc9('0x21')](handleEntityNotFound(_0x1767b6,null))['then'](removeEntity(_0x1767b6,null))[_0x7dc9('0x40')](handleError(_0x1767b6,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2b1e9e1..e40f156 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 _0x9bb8=['bluebird','request-promise','path','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics','lodash','util','../../config/logger','api','moment'];(function(_0x13e562,_0x11d922){var _0x2cf94b=function(_0x3d9565){while(--_0x3d9565){_0x13e562['push'](_0x13e562['shift']());}};_0x2cf94b(++_0x11d922);}(_0x9bb8,0x1ae));var _0x89bb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9bb8[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x89bb('0x0'));var util=require(_0x89bb('0x1'));var logger=require(_0x89bb('0x2'))(_0x89bb('0x3'));var moment=require(_0x89bb('0x4'));var BPromise=require(_0x89bb('0x5'));var rp=require(_0x89bb('0x6'));var fs=require('fs');var path=require(_0x89bb('0x7'));var rimraf=require(_0x89bb('0x8'));var config=require(_0x89bb('0x9'));var attributes=require(_0x89bb('0xa'));module[_0x89bb('0xb')]=function(_0x4e2aeb,_0x4271c5){return _0x4e2aeb[_0x89bb('0xc')](_0x89bb('0xd'),attributes,{'tableName':_0x89bb('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d17=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./analyticMetric.attributes','exports','define','AnalyticMetric','analytics_metrics'];(function(_0x19840d,_0x24b8c0){var _0x3e46ed=function(_0xa01b2d){while(--_0xa01b2d){_0x19840d['push'](_0x19840d['shift']());}};_0x3e46ed(++_0x24b8c0);}(_0x5d17,0x114));var _0x75d1=function(_0x45cb02,_0x1f26d4){_0x45cb02=_0x45cb02-0x0;var _0x333239=_0x5d17[_0x45cb02];return _0x333239;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'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 34eaaa4..b2ee4ca 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 _0xb3c6=['../../config/environment','jayson/promise','then','info','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','AnalyticMetric,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x301486,_0x27b799){var _0x418d16=function(_0x5f0d58){while(--_0x5f0d58){_0x301486['push'](_0x301486['shift']());}};_0x418d16(++_0x27b799);}(_0xb3c6,0xbd));var _0x6b3c=function(_0x2ed08e,_0x31e039){_0x2ed08e=_0x2ed08e-0x0;var _0x5d98cb=_0xb3c6[_0x2ed08e];return _0x5d98cb;};'use strict';var _=require(_0x6b3c('0x0'));var util=require(_0x6b3c('0x1'));var moment=require(_0x6b3c('0x2'));var BPromise=require(_0x6b3c('0x3'));var rs=require(_0x6b3c('0x4'));var fs=require('fs');var Redis=require(_0x6b3c('0x5'));var db=require(_0x6b3c('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x6b3c('0x7'))(_0x6b3c('0x8'));var config=require(_0x6b3c('0x9'));var jayson=require(_0x6b3c('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x30a712,_0x43ac0b,_0x350fd6){return new BPromise(function(_0xc4c6fe,_0x8f1401){return client['request'](_0x30a712,_0x350fd6)[_0x6b3c('0xb')](function(_0x3ffdcc){logger[_0x6b3c('0xc')]('AnalyticMetric,\x20%s,\x20%s',_0x43ac0b,'request\x20sent');logger[_0x6b3c('0xd')](_0x6b3c('0xe'),_0x43ac0b,_0x6b3c('0xf'),JSON['stringify'](_0x3ffdcc));if(_0x3ffdcc[_0x6b3c('0x10')]){if(_0x3ffdcc[_0x6b3c('0x10')][_0x6b3c('0x11')]===0x1f4){logger[_0x6b3c('0x10')](_0x6b3c('0x12'),_0x43ac0b,_0x3ffdcc['error'][_0x6b3c('0x13')]);return _0x8f1401(_0x3ffdcc['error'][_0x6b3c('0x13')]);}logger[_0x6b3c('0x10')]('AnalyticMetric,\x20%s,\x20%s',_0x43ac0b,_0x3ffdcc[_0x6b3c('0x10')]['message']);return _0xc4c6fe(_0x3ffdcc[_0x6b3c('0x10')]['message']);}else{logger[_0x6b3c('0xc')](_0x6b3c('0x12'),_0x43ac0b,_0x6b3c('0xf'));_0xc4c6fe(_0x3ffdcc[_0x6b3c('0x14')][_0x6b3c('0x13')]);}})[_0x6b3c('0x15')](function(_0xd934a3){logger[_0x6b3c('0x10')](_0x6b3c('0x12'),_0x43ac0b,_0xd934a3);_0x8f1401(_0xd934a3);});});} \ No newline at end of file +var _0x3179=['client','http','request','info','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify','error','code','message','AnalyticMetric,\x20%s,\x20%s','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1473c6,_0x567bfd){var _0x1f9eb2=function(_0x42c44b){while(--_0x42c44b){_0x1473c6['push'](_0x1473c6['shift']());}};_0x1f9eb2(++_0x567bfd);}(_0x3179,0x1c1));var _0x9317=function(_0x368ee1,_0x34d588){_0x368ee1=_0x368ee1-0x0;var _0x16af4f=_0x3179[_0x368ee1];return _0x16af4f;};'use strict';var _=require(_0x9317('0x0'));var util=require(_0x9317('0x1'));var moment=require(_0x9317('0x2'));var BPromise=require(_0x9317('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9317('0x4'));var db=require(_0x9317('0x5'))['db'];var utils=require(_0x9317('0x6'));var logger=require(_0x9317('0x7'))(_0x9317('0x8'));var config=require(_0x9317('0x9'));var jayson=require(_0x9317('0xa'));var client=jayson[_0x9317('0xb')][_0x9317('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4b2bce,_0x32f9d4,_0x502251){return new BPromise(function(_0x316d46,_0x2cd7b7){return client[_0x9317('0xd')](_0x4b2bce,_0x502251)['then'](function(_0x1ea682){logger[_0x9317('0xe')]('AnalyticMetric,\x20%s,\x20%s',_0x32f9d4,_0x9317('0xf'));logger[_0x9317('0x10')](_0x9317('0x11'),_0x32f9d4,_0x9317('0xf'),JSON[_0x9317('0x12')](_0x1ea682));if(_0x1ea682[_0x9317('0x13')]){if(_0x1ea682[_0x9317('0x13')][_0x9317('0x14')]===0x1f4){logger[_0x9317('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x32f9d4,_0x1ea682[_0x9317('0x13')]['message']);return _0x2cd7b7(_0x1ea682[_0x9317('0x13')]['message']);}logger[_0x9317('0x13')]('AnalyticMetric,\x20%s,\x20%s',_0x32f9d4,_0x1ea682['error'][_0x9317('0x15')]);return _0x316d46(_0x1ea682['error'][_0x9317('0x15')]);}else{logger[_0x9317('0xe')](_0x9317('0x16'),_0x32f9d4,_0x9317('0xf'));_0x316d46(_0x1ea682['result'][_0x9317('0x15')]);}})['catch'](function(_0x50f1fe){logger['error'](_0x9317('0x16'),_0x32f9d4,_0x50f1fe);_0x2cd7b7(_0x50f1fe);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index fcd494a..b5253ab 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 _0x2a9a=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','create','put','/:id','update','delete','destroy','exports','multer','path'];(function(_0xc4f025,_0x508132){var _0x3dbcf4=function(_0x1145c4){while(--_0x1145c4){_0xc4f025['push'](_0xc4f025['shift']());}};_0x3dbcf4(++_0x508132);}(_0x2a9a,0x64));var _0xa2a9=function(_0x5caa60,_0x247758){_0x5caa60=_0x5caa60-0x0;var _0x5311d1=_0x2a9a[_0x5caa60];return _0x5311d1;};'use strict';var multer=require(_0xa2a9('0x0'));var util=require('util');var path=require(_0xa2a9('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa2a9('0x2')]();var fs_extra=require(_0xa2a9('0x3'));var auth=require(_0xa2a9('0x4'));var interaction=require(_0xa2a9('0x5'));var config=require(_0xa2a9('0x6'));var controller=require('./analyticMetric.controller');router[_0xa2a9('0x7')]('/',auth[_0xa2a9('0x8')](),controller[_0xa2a9('0x9')]);router[_0xa2a9('0x7')]('/:id',auth['isAuthenticated'](),controller['show']);router['post']('/',auth[_0xa2a9('0x8')](),controller[_0xa2a9('0xa')]);router[_0xa2a9('0xb')](_0xa2a9('0xc'),auth['isAuthenticated'](),controller[_0xa2a9('0xd')]);router[_0xa2a9('0xe')]('/:id',auth[_0xa2a9('0x8')](),controller[_0xa2a9('0xf')]);module[_0xa2a9('0x10')]=router; \ No newline at end of file +var _0x1782=['../../components/interaction/service','./analyticMetric.controller','isAuthenticated','index','get','show','post','create','put','/:id','update','delete','destroy','exports','util','path','Router','../../components/auth/service'];(function(_0x4ea1c0,_0x151643){var _0x58ada1=function(_0x410fd5){while(--_0x410fd5){_0x4ea1c0['push'](_0x4ea1c0['shift']());}};_0x58ada1(++_0x151643);}(_0x1782,0x188));var _0x2178=function(_0x2288e9,_0x15e163){_0x2288e9=_0x2288e9-0x0;var _0x24bec9=_0x1782[_0x2288e9];return _0x24bec9;};'use strict';var multer=require('multer');var util=require(_0x2178('0x0'));var path=require(_0x2178('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x2178('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2178('0x3'));var interaction=require(_0x2178('0x4'));var config=require('../../config/environment');var controller=require(_0x2178('0x5'));router['get']('/',auth[_0x2178('0x6')](),controller[_0x2178('0x7')]);router[_0x2178('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x2178('0x9')]);router[_0x2178('0xa')]('/',auth[_0x2178('0x6')](),controller[_0x2178('0xb')]);router[_0x2178('0xc')](_0x2178('0xd'),auth['isAuthenticated'](),controller[_0x2178('0xe')]);router[_0x2178('0xf')](_0x2178('0xd'),auth['isAuthenticated'](),controller[_0x2178('0x10')]);module[_0x2178('0x11')]=router; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.attributes.js b/server/api/analyticTreeReport/analyticTreeReport.attributes.js index 11a9fb6..f22ac53 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 _0xa20d=['exports','TEXT','sequelize'];(function(_0x2c5d4e,_0x6d5975){var _0xe27290=function(_0x4ef4d6){while(--_0x4ef4d6){_0x2c5d4e['push'](_0x2c5d4e['shift']());}};_0xe27290(++_0x6d5975);}(_0xa20d,0x12b));var _0xda20=function(_0x1c6c11,_0x6ce770){_0x1c6c11=_0x1c6c11-0x0;var _0x496364=_0xa20d[_0x1c6c11];return _0x496364;};'use strict';var Sequelize=require(_0xda20('0x0'));module[_0xda20('0x1')]={'tree':{'type':Sequelize[_0xda20('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xde4b=['exports','sequelize'];(function(_0xfb7ee3,_0x6f1f19){var _0x5c061d=function(_0x404867){while(--_0x404867){_0xfb7ee3['push'](_0xfb7ee3['shift']());}};_0x5c061d(++_0x6f1f19);}(_0xde4b,0xd5));var _0xbde4=function(_0x42b270,_0x1a5a1c){_0x42b270=_0x42b270-0x0;var _0x1defeb=_0xde4b[_0x42b270];return _0x1defeb;};'use strict';var Sequelize=require(_0xbde4('0x0'));module[_0xbde4('0x1')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index abd1b27..d9f9746 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 _0x1f95=['key','model','query','keys','filters','attributes','intersection','length','nolimit','order','sort','where','merge','VIRTUAL','filter','options','AnalyticTreeReport','includeAll','include','findAll','rows','params','fields','find','catch','create','body','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','apply','reject','save','then','destroy','name','send','index','map','rawAttributes','fieldName','type'];(function(_0x2c1e7a,_0x155f86){var _0xcacb4f=function(_0x2b2eb3){while(--_0x2b2eb3){_0x2c1e7a['push'](_0x2c1e7a['shift']());}};_0xcacb4f(++_0x155f86);}(_0x1f95,0x174));var _0x51f9=function(_0x5d2ef5,_0x1642c8){_0x5d2ef5=_0x5d2ef5-0x0;var _0xcadc3c=_0x1f95[_0x5d2ef5];return _0xcadc3c;};'use strict';var emlformat=require(_0x51f9('0x0'));var rimraf=require(_0x51f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x51f9('0x2'));var moment=require(_0x51f9('0x3'));var BPromise=require(_0x51f9('0x4'));var Mustache=require(_0x51f9('0x5'));var util=require(_0x51f9('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x51f9('0x7'));var ejs=require(_0x51f9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x51f9('0x9'));var squel=require(_0x51f9('0xa'));var crypto=require(_0x51f9('0xb'));var jsforce=require(_0x51f9('0xc'));var deskjs=require(_0x51f9('0xd'));var toCsv=require(_0x51f9('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x51f9('0xe'));var authService=require(_0x51f9('0xf'));var qs=require(_0x51f9('0x10'));var as=require(_0x51f9('0x11'));var hardwareService=require(_0x51f9('0x12'));var logger=require(_0x51f9('0x13'))(_0x51f9('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x51f9('0x15'));var db=require(_0x51f9('0x16'))['db'];function respondWithStatusCode(_0x53524f,_0x3cb7a6){_0x3cb7a6=_0x3cb7a6||0xcc;return function(_0x28e785){if(_0x28e785){return _0x53524f['sendStatus'](_0x3cb7a6);}return _0x53524f['status'](_0x3cb7a6)[_0x51f9('0x17')]();};}function respondWithResult(_0x775a17,_0x5a3502){_0x5a3502=_0x5a3502||0xc8;return function(_0x5a9415){if(_0x5a9415){return _0x775a17[_0x51f9('0x18')](_0x5a3502)[_0x51f9('0x19')](_0x5a9415);}};}function respondWithFilteredResult(_0x1616a1,_0x5a5afc){return function(_0x2a14b0){if(_0x2a14b0){var _0x39d832=typeof _0x5a5afc[_0x51f9('0x1a')]===_0x51f9('0x1b')&&typeof _0x5a5afc[_0x51f9('0x1c')]==='undefined';var _0x5bf2ce=_0x2a14b0[_0x51f9('0x1d')];var _0x435679=_0x39d832?0x0:_0x5a5afc[_0x51f9('0x1a')];var _0x5164d2=_0x39d832?_0x2a14b0[_0x51f9('0x1d')]:_0x5a5afc[_0x51f9('0x1a')]+_0x5a5afc[_0x51f9('0x1c')];var _0xd7c8e;if(_0x5164d2>=_0x5bf2ce){_0x5164d2=_0x5bf2ce;_0xd7c8e=0xc8;}else{_0xd7c8e=0xce;}_0x1616a1[_0x51f9('0x18')](_0xd7c8e);return _0x1616a1['set']('Content-Range',_0x435679+'-'+_0x5164d2+'/'+_0x5bf2ce)[_0x51f9('0x19')](_0x2a14b0);}return null;};}function patchUpdates(_0x35600b){return function(_0x34343b){try{jsonpatch[_0x51f9('0x1e')](_0x34343b,_0x35600b,!![]);}catch(_0x167637){return BPromise[_0x51f9('0x1f')](_0x167637);}return _0x34343b[_0x51f9('0x20')]();};}function saveUpdates(_0x363b36,_0x3b431e){return function(_0x3be58a){if(_0x3be58a){return _0x3be58a['update'](_0x363b36)[_0x51f9('0x21')](function(_0x2c3a00){return _0x2c3a00;});}return null;};}function removeEntity(_0x43268e,_0x36a488){return function(_0x3a2447){if(_0x3a2447){return _0x3a2447[_0x51f9('0x22')]()[_0x51f9('0x21')](function(){_0x43268e['status'](0xcc)[_0x51f9('0x17')]();});}};}function handleEntityNotFound(_0x232f87,_0x26a557){return function(_0x3ffbac){if(!_0x3ffbac){_0x232f87['sendStatus'](0x194);}return _0x3ffbac;};}function handleError(_0x211989,_0x230414){_0x230414=_0x230414||0x1f4;return function(_0x3acde1){logger['error'](_0x3acde1['stack']);if(_0x3acde1[_0x51f9('0x23')]){delete _0x3acde1[_0x51f9('0x23')];}_0x211989['status'](_0x230414)[_0x51f9('0x24')](_0x3acde1);};}exports[_0x51f9('0x25')]=function(_0x544866,_0x3f9454){var _0x2607f9={},_0x1a9a43={},_0x12ce60={'count':0x0,'rows':[]};var _0x106723=_[_0x51f9('0x26')](db['AnalyticTreeReport'][_0x51f9('0x27')],function(_0x5a9825){return{'name':_0x5a9825[_0x51f9('0x28')],'type':_0x5a9825[_0x51f9('0x29')][_0x51f9('0x2a')]};});_0x1a9a43[_0x51f9('0x2b')]=_[_0x51f9('0x26')](_0x106723,_0x51f9('0x23'));_0x1a9a43[_0x51f9('0x2c')]=_[_0x51f9('0x2d')](_0x544866[_0x51f9('0x2c')]);_0x1a9a43[_0x51f9('0x2e')]=_['intersection'](_0x1a9a43[_0x51f9('0x2b')],_0x1a9a43[_0x51f9('0x2c')]);_0x2607f9[_0x51f9('0x2f')]=_[_0x51f9('0x30')](_0x1a9a43['model'],qs['fields'](_0x544866['query']['fields']));_0x2607f9[_0x51f9('0x2f')]=_0x2607f9[_0x51f9('0x2f')][_0x51f9('0x31')]?_0x2607f9['attributes']:_0x1a9a43['model'];if(!_0x544866[_0x51f9('0x2c')]['hasOwnProperty'](_0x51f9('0x32'))){_0x2607f9[_0x51f9('0x1c')]=qs[_0x51f9('0x1c')](_0x544866[_0x51f9('0x2c')][_0x51f9('0x1c')]);_0x2607f9[_0x51f9('0x1a')]=qs[_0x51f9('0x1a')](_0x544866[_0x51f9('0x2c')][_0x51f9('0x1a')]);}_0x2607f9[_0x51f9('0x33')]=qs[_0x51f9('0x34')](_0x544866[_0x51f9('0x2c')][_0x51f9('0x34')]);_0x2607f9[_0x51f9('0x35')]=qs['filters'](_['pick'](_0x544866[_0x51f9('0x2c')],_0x1a9a43[_0x51f9('0x2e')]),_0x106723);if(_0x544866[_0x51f9('0x2c')]['filter']){_0x2607f9[_0x51f9('0x35')]=_[_0x51f9('0x36')](_0x2607f9[_0x51f9('0x35')],{'$or':_['map'](_0x106723,function(_0x900ceb){if(_0x900ceb[_0x51f9('0x29')]!==_0x51f9('0x37')){var _0x576894={};_0x576894[_0x900ceb[_0x51f9('0x23')]]={'$like':'%'+_0x544866[_0x51f9('0x2c')][_0x51f9('0x38')]+'%'};return _0x576894;}})});}_0x2607f9=_[_0x51f9('0x36')]({},_0x2607f9,_0x544866[_0x51f9('0x39')]);var _0x3ec8ef={'where':_0x2607f9[_0x51f9('0x35')]};return db[_0x51f9('0x3a')][_0x51f9('0x1d')](_0x3ec8ef)['then'](function(_0x340d01){_0x12ce60['count']=_0x340d01;if(_0x544866['query'][_0x51f9('0x3b')]){_0x2607f9[_0x51f9('0x3c')]=[{'all':!![]}];}return db[_0x51f9('0x3a')][_0x51f9('0x3d')](_0x2607f9);})[_0x51f9('0x21')](function(_0x41706d){_0x12ce60[_0x51f9('0x3e')]=_0x41706d;return _0x12ce60;})[_0x51f9('0x21')](respondWithFilteredResult(_0x3f9454,_0x2607f9))['catch'](handleError(_0x3f9454,null));};exports['show']=function(_0x41388a,_0x408bc9){var _0x146373={'raw':!![],'where':{'id':_0x41388a[_0x51f9('0x3f')]['id']}},_0x340f83={};_0x340f83[_0x51f9('0x2b')]=_[_0x51f9('0x2d')](db['AnalyticTreeReport'][_0x51f9('0x27')]);_0x340f83[_0x51f9('0x2c')]=_[_0x51f9('0x2d')](_0x41388a['query']);_0x340f83[_0x51f9('0x2e')]=_[_0x51f9('0x30')](_0x340f83[_0x51f9('0x2b')],_0x340f83[_0x51f9('0x2c')]);_0x146373[_0x51f9('0x2f')]=_[_0x51f9('0x30')](_0x340f83[_0x51f9('0x2b')],qs[_0x51f9('0x40')](_0x41388a[_0x51f9('0x2c')][_0x51f9('0x40')]));_0x146373[_0x51f9('0x2f')]=_0x146373['attributes']['length']?_0x146373[_0x51f9('0x2f')]:_0x340f83['model'];if(_0x41388a[_0x51f9('0x2c')][_0x51f9('0x3b')]){_0x146373[_0x51f9('0x3c')]=[{'all':!![]}];}_0x146373=_[_0x51f9('0x36')]({},_0x146373,_0x41388a[_0x51f9('0x39')]);return db[_0x51f9('0x3a')][_0x51f9('0x41')](_0x146373)[_0x51f9('0x21')](handleEntityNotFound(_0x408bc9,null))['then'](respondWithResult(_0x408bc9,null))[_0x51f9('0x42')](handleError(_0x408bc9,null));};exports[_0x51f9('0x43')]=function(_0x1e43a5,_0xd425aa){return db['AnalyticTreeReport'][_0x51f9('0x43')](_0x1e43a5[_0x51f9('0x44')],{})[_0x51f9('0x21')](respondWithResult(_0xd425aa,0xc9))[_0x51f9('0x42')](handleError(_0xd425aa,null));};exports['update']=function(_0x5e4523,_0x501d83){if(_0x5e4523['body']['id']){delete _0x5e4523[_0x51f9('0x44')]['id'];}return db[_0x51f9('0x3a')][_0x51f9('0x41')]({'where':{'id':_0x5e4523[_0x51f9('0x3f')]['id']}})[_0x51f9('0x21')](handleEntityNotFound(_0x501d83,null))[_0x51f9('0x21')](saveUpdates(_0x5e4523[_0x51f9('0x44')],null))[_0x51f9('0x21')](respondWithResult(_0x501d83,null))[_0x51f9('0x42')](handleError(_0x501d83,null));};exports[_0x51f9('0x22')]=function(_0x12ba38,_0x16e6f4){return db[_0x51f9('0x3a')]['find']({'where':{'id':_0x12ba38[_0x51f9('0x3f')]['id']}})['then'](handleEntityNotFound(_0x16e6f4,null))[_0x51f9('0x21')](removeEntity(_0x16e6f4,null))['catch'](handleError(_0x16e6f4,null));}; \ No newline at end of file +var _0x5715=['rawAttributes','options','find','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','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','Content-Range','apply','reject','update','destroy','error','stack','name','send','index','map','AnalyticTreeReport','fieldName','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','filter','type','merge','count','then','includeAll','include','findAll','rows','catch','show','params'];(function(_0x30fb8b,_0x1e134d){var _0x4c46c1=function(_0x3855c4){while(--_0x3855c4){_0x30fb8b['push'](_0x30fb8b['shift']());}};_0x4c46c1(++_0x1e134d);}(_0x5715,0x1bb));var _0x5571=function(_0x3438cf,_0x73b174){_0x3438cf=_0x3438cf-0x0;var _0x278698=_0x5715[_0x3438cf];return _0x278698;};'use strict';var emlformat=require(_0x5571('0x0'));var rimraf=require(_0x5571('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5571('0x2'));var rp=require(_0x5571('0x3'));var moment=require(_0x5571('0x4'));var BPromise=require(_0x5571('0x5'));var Mustache=require(_0x5571('0x6'));var util=require('util');var path=require(_0x5571('0x7'));var sox=require(_0x5571('0x8'));var csv=require(_0x5571('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5571('0xa'));var squel=require(_0x5571('0xb'));var crypto=require(_0x5571('0xc'));var jsforce=require(_0x5571('0xd'));var deskjs=require(_0x5571('0xe'));var toCsv=require(_0x5571('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5571('0xf'));var authService=require(_0x5571('0x10'));var qs=require(_0x5571('0x11'));var as=require(_0x5571('0x12'));var hardwareService=require(_0x5571('0x13'));var logger=require('../../config/logger')(_0x5571('0x14'));var utils=require(_0x5571('0x15'));var config=require(_0x5571('0x16'));var licenseUtil=require(_0x5571('0x17'));var db=require(_0x5571('0x18'))['db'];function respondWithStatusCode(_0x2fca68,_0x1f61b1){_0x1f61b1=_0x1f61b1||0xcc;return function(_0x15d7a6){if(_0x15d7a6){return _0x2fca68[_0x5571('0x19')](_0x1f61b1);}return _0x2fca68[_0x5571('0x1a')](_0x1f61b1)[_0x5571('0x1b')]();};}function respondWithResult(_0xd8fe8c,_0x48626a){_0x48626a=_0x48626a||0xc8;return function(_0x5e3d07){if(_0x5e3d07){return _0xd8fe8c[_0x5571('0x1a')](_0x48626a)[_0x5571('0x1c')](_0x5e3d07);}};}function respondWithFilteredResult(_0x5682a6,_0x1c94c3){return function(_0x3eccea){if(_0x3eccea){var _0x3a0869=typeof _0x1c94c3[_0x5571('0x1d')]===_0x5571('0x1e')&&typeof _0x1c94c3['limit']===_0x5571('0x1e');var _0x1942d9=_0x3eccea['count'];var _0x3ddb2c=_0x3a0869?0x0:_0x1c94c3[_0x5571('0x1d')];var _0x360a9e=_0x3a0869?_0x3eccea['count']:_0x1c94c3[_0x5571('0x1d')]+_0x1c94c3[_0x5571('0x1f')];var _0x50797f;if(_0x360a9e>=_0x1942d9){_0x360a9e=_0x1942d9;_0x50797f=0xc8;}else{_0x50797f=0xce;}_0x5682a6[_0x5571('0x1a')](_0x50797f);return _0x5682a6['set'](_0x5571('0x20'),_0x3ddb2c+'-'+_0x360a9e+'/'+_0x1942d9)[_0x5571('0x1c')](_0x3eccea);}return null;};}function patchUpdates(_0x5967a3){return function(_0x27cf36){try{jsonpatch[_0x5571('0x21')](_0x27cf36,_0x5967a3,!![]);}catch(_0x2f62ae){return BPromise[_0x5571('0x22')](_0x2f62ae);}return _0x27cf36['save']();};}function saveUpdates(_0x176cb3,_0x1cb14e){return function(_0x13bd2d){if(_0x13bd2d){return _0x13bd2d[_0x5571('0x23')](_0x176cb3)['then'](function(_0x56f862){return _0x56f862;});}return null;};}function removeEntity(_0x482ccd,_0x5badec){return function(_0x1045b9){if(_0x1045b9){return _0x1045b9[_0x5571('0x24')]()['then'](function(){_0x482ccd[_0x5571('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0xc34de0,_0x873a93){return function(_0x584c97){if(!_0x584c97){_0xc34de0[_0x5571('0x19')](0x194);}return _0x584c97;};}function handleError(_0x3b803e,_0x172e4d){_0x172e4d=_0x172e4d||0x1f4;return function(_0x1d5154){logger[_0x5571('0x25')](_0x1d5154[_0x5571('0x26')]);if(_0x1d5154[_0x5571('0x27')]){delete _0x1d5154[_0x5571('0x27')];}_0x3b803e[_0x5571('0x1a')](_0x172e4d)[_0x5571('0x28')](_0x1d5154);};}exports[_0x5571('0x29')]=function(_0xe73960,_0x25a616){var _0x170dd5={},_0x43ce8b={},_0xeb4ba={'count':0x0,'rows':[]};var _0x67bfb1=_[_0x5571('0x2a')](db[_0x5571('0x2b')]['rawAttributes'],function(_0x141598){return{'name':_0x141598[_0x5571('0x2c')],'type':_0x141598['type']['key']};});_0x43ce8b[_0x5571('0x2d')]=_['map'](_0x67bfb1,'name');_0x43ce8b[_0x5571('0x2e')]=_[_0x5571('0x2f')](_0xe73960[_0x5571('0x2e')]);_0x43ce8b[_0x5571('0x30')]=_[_0x5571('0x31')](_0x43ce8b[_0x5571('0x2d')],_0x43ce8b['query']);_0x170dd5[_0x5571('0x32')]=_[_0x5571('0x31')](_0x43ce8b[_0x5571('0x2d')],qs['fields'](_0xe73960[_0x5571('0x2e')][_0x5571('0x33')]));_0x170dd5[_0x5571('0x32')]=_0x170dd5['attributes']['length']?_0x170dd5[_0x5571('0x32')]:_0x43ce8b['model'];if(!_0xe73960[_0x5571('0x2e')][_0x5571('0x34')](_0x5571('0x35'))){_0x170dd5['limit']=qs[_0x5571('0x1f')](_0xe73960[_0x5571('0x2e')][_0x5571('0x1f')]);_0x170dd5[_0x5571('0x1d')]=qs[_0x5571('0x1d')](_0xe73960[_0x5571('0x2e')][_0x5571('0x1d')]);}_0x170dd5[_0x5571('0x36')]=qs['sort'](_0xe73960[_0x5571('0x2e')]['sort']);_0x170dd5[_0x5571('0x37')]=qs[_0x5571('0x30')](_['pick'](_0xe73960[_0x5571('0x2e')],_0x43ce8b[_0x5571('0x30')]),_0x67bfb1);if(_0xe73960['query'][_0x5571('0x38')]){_0x170dd5[_0x5571('0x37')]=_['merge'](_0x170dd5[_0x5571('0x37')],{'$or':_[_0x5571('0x2a')](_0x67bfb1,function(_0x32fd3d){if(_0x32fd3d[_0x5571('0x39')]!=='VIRTUAL'){var _0x279c65={};_0x279c65[_0x32fd3d[_0x5571('0x27')]]={'$like':'%'+_0xe73960['query'][_0x5571('0x38')]+'%'};return _0x279c65;}})});}_0x170dd5=_[_0x5571('0x3a')]({},_0x170dd5,_0xe73960['options']);var _0x4b07e8={'where':_0x170dd5[_0x5571('0x37')]};return db[_0x5571('0x2b')][_0x5571('0x3b')](_0x4b07e8)[_0x5571('0x3c')](function(_0x5334a9){_0xeb4ba[_0x5571('0x3b')]=_0x5334a9;if(_0xe73960[_0x5571('0x2e')][_0x5571('0x3d')]){_0x170dd5[_0x5571('0x3e')]=[{'all':!![]}];}return db[_0x5571('0x2b')][_0x5571('0x3f')](_0x170dd5);})[_0x5571('0x3c')](function(_0x4f9472){_0xeb4ba[_0x5571('0x40')]=_0x4f9472;return _0xeb4ba;})[_0x5571('0x3c')](respondWithFilteredResult(_0x25a616,_0x170dd5))[_0x5571('0x41')](handleError(_0x25a616,null));};exports[_0x5571('0x42')]=function(_0x443dc9,_0x1f4f92){var _0x2ca587={'raw':!![],'where':{'id':_0x443dc9[_0x5571('0x43')]['id']}},_0x11268f={};_0x11268f[_0x5571('0x2d')]=_['keys'](db[_0x5571('0x2b')][_0x5571('0x44')]);_0x11268f[_0x5571('0x2e')]=_['keys'](_0x443dc9[_0x5571('0x2e')]);_0x11268f[_0x5571('0x30')]=_['intersection'](_0x11268f[_0x5571('0x2d')],_0x11268f[_0x5571('0x2e')]);_0x2ca587['attributes']=_[_0x5571('0x31')](_0x11268f['model'],qs[_0x5571('0x33')](_0x443dc9[_0x5571('0x2e')][_0x5571('0x33')]));_0x2ca587[_0x5571('0x32')]=_0x2ca587[_0x5571('0x32')]['length']?_0x2ca587[_0x5571('0x32')]:_0x11268f[_0x5571('0x2d')];if(_0x443dc9[_0x5571('0x2e')]['includeAll']){_0x2ca587[_0x5571('0x3e')]=[{'all':!![]}];}_0x2ca587=_[_0x5571('0x3a')]({},_0x2ca587,_0x443dc9[_0x5571('0x45')]);return db['AnalyticTreeReport'][_0x5571('0x46')](_0x2ca587)[_0x5571('0x3c')](handleEntityNotFound(_0x1f4f92,null))[_0x5571('0x3c')](respondWithResult(_0x1f4f92,null))[_0x5571('0x41')](handleError(_0x1f4f92,null));};exports[_0x5571('0x47')]=function(_0x519ff1,_0x37e6a2){return db[_0x5571('0x2b')][_0x5571('0x47')](_0x519ff1[_0x5571('0x48')],{})[_0x5571('0x3c')](respondWithResult(_0x37e6a2,0xc9))[_0x5571('0x41')](handleError(_0x37e6a2,null));};exports[_0x5571('0x23')]=function(_0x3d1ba6,_0x123e5){if(_0x3d1ba6[_0x5571('0x48')]['id']){delete _0x3d1ba6[_0x5571('0x48')]['id'];}return db['AnalyticTreeReport']['find']({'where':{'id':_0x3d1ba6['params']['id']}})['then'](handleEntityNotFound(_0x123e5,null))[_0x5571('0x3c')](saveUpdates(_0x3d1ba6[_0x5571('0x48')],null))[_0x5571('0x3c')](respondWithResult(_0x123e5,null))[_0x5571('0x41')](handleError(_0x123e5,null));};exports[_0x5571('0x24')]=function(_0x2c1fcf,_0x54a533){return db['AnalyticTreeReport']['find']({'where':{'id':_0x2c1fcf[_0x5571('0x43')]['id']}})['then'](handleEntityNotFound(_0x54a533,null))[_0x5571('0x3c')](removeEntity(_0x54a533,null))[_0x5571('0x41')](handleError(_0x54a533,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 07ed173..4b387b2 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 _0xbdf1=['analytics_report_trees','util','../../config/logger','api','rimraf','./analyticTreeReport.attributes','define','AnalyticTreeReport'];(function(_0x1132be,_0x54eec0){var _0x3c7a9e=function(_0x2beb49){while(--_0x2beb49){_0x1132be['push'](_0x1132be['shift']());}};_0x3c7a9e(++_0x54eec0);}(_0xbdf1,0x111));var _0x1bdf=function(_0x22ce30,_0x15e5ac){_0x22ce30=_0x22ce30-0x0;var _0x5e4e1d=_0xbdf1[_0x22ce30];return _0x5e4e1d;};'use strict';var _=require('lodash');var util=require(_0x1bdf('0x0'));var logger=require(_0x1bdf('0x1'))(_0x1bdf('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(_0x1bdf('0x3'));var config=require('../../config/environment');var attributes=require(_0x1bdf('0x4'));module['exports']=function(_0x21eadc,_0xe91259){return _0x21eadc[_0x1bdf('0x5')](_0x1bdf('0x6'),attributes,{'tableName':_0x1bdf('0x7'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa7a9=['exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./analyticTreeReport.attributes'];(function(_0x55db0d,_0x35285c){var _0x4a9e63=function(_0x32eaba){while(--_0x32eaba){_0x55db0d['push'](_0x55db0d['shift']());}};_0x4a9e63(++_0x35285c);}(_0xa7a9,0x1e5));var _0x9a7a=function(_0x26b148,_0x58b873){_0x26b148=_0x26b148-0x0;var _0x2611b7=_0xa7a9[_0x26b148];return _0x2611b7;};'use strict';var _=require(_0x9a7a('0x0'));var util=require(_0x9a7a('0x1'));var logger=require(_0x9a7a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x9a7a('0x3'));var rp=require(_0x9a7a('0x4'));var fs=require('fs');var path=require(_0x9a7a('0x5'));var rimraf=require(_0x9a7a('0x6'));var config=require(_0x9a7a('0x7'));var attributes=require(_0x9a7a('0x8'));module[_0x9a7a('0x9')]=function(_0x1618ea,_0x2b67bc){return _0x1618ea[_0x9a7a('0xa')](_0x9a7a('0xb'),attributes,{'tableName':_0x9a7a('0xc'),'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 bf91e97..1e6b6a9 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 _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','AnalyticTreeReport,\x20%s,\x20%s','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x26f96a,_0x13636a){var _0x2b3b20=function(_0x170d5f){while(--_0x170d5f){_0x26f96a['push'](_0x26f96a['shift']());}};_0x2b3b20(++_0x13636a);}(_0x2ef3,0xba));var _0x32ef=function(_0x3adeba,_0x16c07b){_0x3adeba=_0x3adeba-0x0;var _0x434c07=_0x2ef3[_0x3adeba];return _0x434c07;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('AnalyticTreeReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0xbed5e2,_0x9d54bb){var _0x3d7cc4=function(_0x3999ef){while(--_0x3999ef){_0xbed5e2['push'](_0xbed5e2['shift']());}};_0x3d7cc4(++_0x9d54bb);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index bef6592..285d0c5 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 _0xdea2=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','index','/:id','show','create','put','isAuthenticated','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xdea2,0x178));var _0x2dea=function(_0x37a0ed,_0x399b23){_0x37a0ed=_0x37a0ed-0x0;var _0xba6f39=_0xdea2[_0x37a0ed];return _0xba6f39;};'use strict';var multer=require(_0x2dea('0x0'));var util=require(_0x2dea('0x1'));var path=require(_0x2dea('0x2'));var timeout=require(_0x2dea('0x3'));var express=require(_0x2dea('0x4'));var router=express[_0x2dea('0x5')]();var fs_extra=require(_0x2dea('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2dea('0x7'));var config=require(_0x2dea('0x8'));var controller=require(_0x2dea('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x2dea('0xa')]);router['get'](_0x2dea('0xb'),auth['isAuthenticated'](),controller[_0x2dea('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x2dea('0xd')]);router[_0x2dea('0xe')](_0x2dea('0xb'),auth[_0x2dea('0xf')](),controller[_0x2dea('0x10')]);router[_0x2dea('0x11')](_0x2dea('0xb'),auth['isAuthenticated'](),controller[_0x2dea('0x12')]);module[_0x2dea('0x13')]=router; \ No newline at end of file +var _0xa8b5=['post','create','update','delete','/:id','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','show'];(function(_0x11d70b,_0x6eed8c){var _0x203e62=function(_0x15233d){while(--_0x15233d){_0x11d70b['push'](_0x11d70b['shift']());}};_0x203e62(++_0x6eed8c);}(_0xa8b5,0x8c));var _0x5a8b=function(_0x4861ed,_0x96dc11){_0x4861ed=_0x4861ed-0x0;var _0x432532=_0xa8b5[_0x4861ed];return _0x432532;};'use strict';var multer=require('multer');var util=require(_0x5a8b('0x0'));var path=require(_0x5a8b('0x1'));var timeout=require(_0x5a8b('0x2'));var express=require(_0x5a8b('0x3'));var router=express['Router']();var fs_extra=require(_0x5a8b('0x4'));var auth=require(_0x5a8b('0x5'));var interaction=require(_0x5a8b('0x6'));var config=require(_0x5a8b('0x7'));var controller=require('./analyticTreeReport.controller');router[_0x5a8b('0x8')]('/',auth['isAuthenticated'](),controller[_0x5a8b('0x9')]);router['get']('/:id',auth[_0x5a8b('0xa')](),controller[_0x5a8b('0xb')]);router[_0x5a8b('0xc')]('/',auth['isAuthenticated'](),controller[_0x5a8b('0xd')]);router['put']('/:id',auth[_0x5a8b('0xa')](),controller[_0x5a8b('0xe')]);router[_0x5a8b('0xf')](_0x5a8b('0x10'),auth['isAuthenticated'](),controller[_0x5a8b('0x11')]);module[_0x5a8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 6453f4a..2f67b38 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 _0x98e1=['exports','STRING'];(function(_0x2eeaef,_0x218a98){var _0x573816=function(_0x761532){while(--_0x761532){_0x2eeaef['push'](_0x2eeaef['shift']());}};_0x573816(++_0x218a98);}(_0x98e1,0x160));var _0x198e=function(_0x49cda8,_0x5af8b3){_0x49cda8=_0x49cda8-0x0;var _0x14866d=_0x98e1[_0x49cda8];return _0x14866d;};'use strict';var Sequelize=require('sequelize');module[_0x198e('0x0')]={'name':{'type':Sequelize[_0x198e('0x1')]},'basename':{'type':Sequelize[_0x198e('0x1')]},'type':{'type':Sequelize[_0x198e('0x1')]}}; \ No newline at end of file +var _0xf9bb=['sequelize','exports','STRING'];(function(_0x5627f0,_0x350279){var _0x5832d4=function(_0x4f67c9){while(--_0x4f67c9){_0x5627f0['push'](_0x5627f0['shift']());}};_0x5832d4(++_0x350279);}(_0xf9bb,0x14d));var _0xbf9b=function(_0x55b745,_0x36e0fa){_0x55b745=_0x55b745-0x0;var _0x1772a7=_0xf9bb[_0x55b745];return _0x1772a7;};'use strict';var Sequelize=require(_0xbf9b('0x0'));module[_0xbf9b('0x1')]={'name':{'type':Sequelize[_0xbf9b('0x2')]},'basename':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xbf9b('0x2')]}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 1ce31bb..4e78bc3 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 _0xfa4b=['count','limit','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','map','Attachment','rawAttributes','fieldName','key','model','keys','filters','query','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','intersection','find','clone','get','createdAt','updatedAt','omit','body','create','destroy','file','originalname','basename','type','mimetype','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xfa4b,0xf7));var _0xbfa4=function(_0x153701,_0x1f5416){_0x153701=_0x153701-0x0;var _0x340a2d=_0xfa4b[_0x153701];return _0x340a2d;};'use strict';var emlformat=require(_0xbfa4('0x0'));var rimraf=require(_0xbfa4('0x1'));var zipdir=require(_0xbfa4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xbfa4('0x3'));var BPromise=require(_0xbfa4('0x4'));var Mustache=require(_0xbfa4('0x5'));var util=require(_0xbfa4('0x6'));var path=require(_0xbfa4('0x7'));var sox=require(_0xbfa4('0x8'));var csv=require(_0xbfa4('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbfa4('0xa'));var squel=require('squel');var crypto=require(_0xbfa4('0xb'));var jsforce=require(_0xbfa4('0xc'));var deskjs=require(_0xbfa4('0xd'));var toCsv=require(_0xbfa4('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbfa4('0xe'));var authService=require(_0xbfa4('0xf'));var qs=require(_0xbfa4('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbfa4('0x11'));var logger=require(_0xbfa4('0x12'))(_0xbfa4('0x13'));var utils=require('../../config/utils');var config=require(_0xbfa4('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xbfa4('0x15'))['db'];function respondWithStatusCode(_0xac31d0,_0x2b5b39){_0x2b5b39=_0x2b5b39||0xcc;return function(_0x1d464b){if(_0x1d464b){return _0xac31d0[_0xbfa4('0x16')](_0x2b5b39);}return _0xac31d0['status'](_0x2b5b39)['end']();};}function respondWithResult(_0x1ebd46,_0x182d08){_0x182d08=_0x182d08||0xc8;return function(_0x16e85a){if(_0x16e85a){return _0x1ebd46[_0xbfa4('0x17')](_0x182d08)[_0xbfa4('0x18')](_0x16e85a);}};}function respondWithFilteredResult(_0xff0d35,_0x782220){return function(_0x168447){if(_0x168447){var _0x23a5dd=typeof _0x782220[_0xbfa4('0x19')]==='undefined'&&typeof _0x782220['limit']==='undefined';var _0x415c32=_0x168447[_0xbfa4('0x1a')];var _0xa4da20=_0x23a5dd?0x0:_0x782220['offset'];var _0x1e761b=_0x23a5dd?_0x168447[_0xbfa4('0x1a')]:_0x782220[_0xbfa4('0x19')]+_0x782220[_0xbfa4('0x1b')];var _0x14d7b1;if(_0x1e761b>=_0x415c32){_0x1e761b=_0x415c32;_0x14d7b1=0xc8;}else{_0x14d7b1=0xce;}_0xff0d35[_0xbfa4('0x17')](_0x14d7b1);return _0xff0d35[_0xbfa4('0x1c')](_0xbfa4('0x1d'),_0xa4da20+'-'+_0x1e761b+'/'+_0x415c32)[_0xbfa4('0x18')](_0x168447);}return null;};}function patchUpdates(_0x1512d4){return function(_0x489996){try{jsonpatch[_0xbfa4('0x1e')](_0x489996,_0x1512d4,!![]);}catch(_0x3a7c6c){return BPromise[_0xbfa4('0x1f')](_0x3a7c6c);}return _0x489996[_0xbfa4('0x20')]();};}function saveUpdates(_0x392672,_0x5815cd){return function(_0x9187bb){if(_0x9187bb){return _0x9187bb[_0xbfa4('0x21')](_0x392672)[_0xbfa4('0x22')](function(_0x52c6eb){return _0x52c6eb;});}return null;};}function removeEntity(_0x175841,_0x1da480){return function(_0x1d4e89){if(_0x1d4e89){return _0x1d4e89['destroy']()[_0xbfa4('0x22')](function(){_0x175841[_0xbfa4('0x17')](0xcc)[_0xbfa4('0x23')]();});}};}function handleEntityNotFound(_0x1abca7,_0x5f1b82){return function(_0x3fe2b1){if(!_0x3fe2b1){_0x1abca7[_0xbfa4('0x16')](0x194);}return _0x3fe2b1;};}function handleError(_0x44a8e2,_0x590335){_0x590335=_0x590335||0x1f4;return function(_0x167305){logger[_0xbfa4('0x24')](_0x167305[_0xbfa4('0x25')]);if(_0x167305[_0xbfa4('0x26')]){delete _0x167305['name'];}_0x44a8e2[_0xbfa4('0x17')](_0x590335)[_0xbfa4('0x27')](_0x167305);};}exports[_0xbfa4('0x28')]=function(_0x20ba20,_0x4bfbf1){var _0x59f478={},_0x15876c={},_0x46e5dc={'count':0x0,'rows':[]};var _0x311743=_[_0xbfa4('0x29')](db[_0xbfa4('0x2a')][_0xbfa4('0x2b')],function(_0x80ff52){return{'name':_0x80ff52[_0xbfa4('0x2c')],'type':_0x80ff52['type'][_0xbfa4('0x2d')]};});_0x15876c[_0xbfa4('0x2e')]=_[_0xbfa4('0x29')](_0x311743,'name');_0x15876c['query']=_[_0xbfa4('0x2f')](_0x20ba20['query']);_0x15876c[_0xbfa4('0x30')]=_['intersection'](_0x15876c[_0xbfa4('0x2e')],_0x15876c[_0xbfa4('0x31')]);_0x59f478[_0xbfa4('0x32')]=_['intersection'](_0x15876c[_0xbfa4('0x2e')],qs[_0xbfa4('0x33')](_0x20ba20[_0xbfa4('0x31')][_0xbfa4('0x33')]));_0x59f478[_0xbfa4('0x32')]=_0x59f478[_0xbfa4('0x32')][_0xbfa4('0x34')]?_0x59f478[_0xbfa4('0x32')]:_0x15876c[_0xbfa4('0x2e')];if(!_0x20ba20['query'][_0xbfa4('0x35')](_0xbfa4('0x36'))){_0x59f478[_0xbfa4('0x1b')]=qs[_0xbfa4('0x1b')](_0x20ba20[_0xbfa4('0x31')][_0xbfa4('0x1b')]);_0x59f478[_0xbfa4('0x19')]=qs[_0xbfa4('0x19')](_0x20ba20[_0xbfa4('0x31')][_0xbfa4('0x19')]);}_0x59f478[_0xbfa4('0x37')]=qs['sort'](_0x20ba20[_0xbfa4('0x31')]['sort']);_0x59f478[_0xbfa4('0x38')]=qs['filters'](_[_0xbfa4('0x39')](_0x20ba20[_0xbfa4('0x31')],_0x15876c[_0xbfa4('0x30')]),_0x311743);if(_0x20ba20[_0xbfa4('0x31')][_0xbfa4('0x3a')]){_0x59f478[_0xbfa4('0x38')]=_['merge'](_0x59f478[_0xbfa4('0x38')],{'$or':_[_0xbfa4('0x29')](_0x311743,function(_0x1204af){if(_0x1204af['type']!==_0xbfa4('0x3b')){var _0x32b50e={};_0x32b50e[_0x1204af[_0xbfa4('0x26')]]={'$like':'%'+_0x20ba20[_0xbfa4('0x31')]['filter']+'%'};return _0x32b50e;}})});}_0x59f478=_[_0xbfa4('0x3c')]({},_0x59f478,_0x20ba20[_0xbfa4('0x3d')]);var _0x139d86={'where':_0x59f478[_0xbfa4('0x38')]};return db['Attachment'][_0xbfa4('0x1a')](_0x139d86)[_0xbfa4('0x22')](function(_0x38849e){_0x46e5dc[_0xbfa4('0x1a')]=_0x38849e;if(_0x20ba20[_0xbfa4('0x31')][_0xbfa4('0x3e')]){_0x59f478[_0xbfa4('0x3f')]=[{'all':!![]}];}return db[_0xbfa4('0x2a')][_0xbfa4('0x40')](_0x59f478);})[_0xbfa4('0x22')](function(_0x1f2a95){_0x46e5dc[_0xbfa4('0x41')]=_0x1f2a95;return _0x46e5dc;})['then'](respondWithFilteredResult(_0x4bfbf1,_0x59f478))[_0xbfa4('0x42')](handleError(_0x4bfbf1,null));};exports[_0xbfa4('0x43')]=function(_0x3620fb,_0x42d84c){var _0x4745a3={'raw':!![],'where':{'id':_0x3620fb[_0xbfa4('0x44')]['id']}},_0x5d27b1={};_0x5d27b1[_0xbfa4('0x2e')]=_[_0xbfa4('0x2f')](db[_0xbfa4('0x2a')][_0xbfa4('0x2b')]);_0x5d27b1[_0xbfa4('0x31')]=_[_0xbfa4('0x2f')](_0x3620fb['query']);_0x5d27b1[_0xbfa4('0x30')]=_['intersection'](_0x5d27b1[_0xbfa4('0x2e')],_0x5d27b1[_0xbfa4('0x31')]);_0x4745a3[_0xbfa4('0x32')]=_[_0xbfa4('0x45')](_0x5d27b1[_0xbfa4('0x2e')],qs['fields'](_0x3620fb[_0xbfa4('0x31')][_0xbfa4('0x33')]));_0x4745a3[_0xbfa4('0x32')]=_0x4745a3[_0xbfa4('0x32')][_0xbfa4('0x34')]?_0x4745a3[_0xbfa4('0x32')]:_0x5d27b1[_0xbfa4('0x2e')];if(_0x3620fb[_0xbfa4('0x31')]['includeAll']){_0x4745a3['include']=[{'all':!![]}];}_0x4745a3=_['merge']({},_0x4745a3,_0x3620fb[_0xbfa4('0x3d')]);return db[_0xbfa4('0x2a')][_0xbfa4('0x46')](_0x4745a3)[_0xbfa4('0x22')](handleEntityNotFound(_0x42d84c,null))[_0xbfa4('0x22')](respondWithResult(_0x42d84c,null))[_0xbfa4('0x42')](handleError(_0x42d84c,null));};exports[_0xbfa4('0x47')]=function(_0x285a33,_0xe870f5){var _0x1c3ff0={'where':{'id':_0x285a33['params']['id']}},_0x3ffb19={};_0x3ffb19[_0xbfa4('0x2e')]=_[_0xbfa4('0x2f')](db[_0xbfa4('0x2a')][_0xbfa4('0x2b')]);_0x1c3ff0[_0xbfa4('0x32')]=_[_0xbfa4('0x45')](_0x3ffb19[_0xbfa4('0x2e')],qs[_0xbfa4('0x33')](_0x285a33[_0xbfa4('0x31')]['fields']));_0x1c3ff0[_0xbfa4('0x32')]=_0x1c3ff0[_0xbfa4('0x32')]['length']?_0x1c3ff0[_0xbfa4('0x32')]:_0x3ffb19[_0xbfa4('0x2e')];if(_0x285a33['query'][_0xbfa4('0x3e')]){_0x1c3ff0['include']=[{'all':!![]}];}_0x1c3ff0=_[_0xbfa4('0x3c')]({},_0x1c3ff0,_0x285a33[_0xbfa4('0x3d')]);return db['Attachment'][_0xbfa4('0x46')](_0x1c3ff0)[_0xbfa4('0x22')](handleEntityNotFound(_0xe870f5,null))[_0xbfa4('0x22')](function(_0x1835aa){if(_0x1835aa){var _0x2e2669=_0x1835aa[_0xbfa4('0x48')]({'plain':!![]});_0x2e2669=qs['omit'](_0x2e2669,['id',_0xbfa4('0x49'),_0xbfa4('0x4a')]);_0x285a33['body']=_[_0xbfa4('0x4b')](_0x285a33[_0xbfa4('0x4c')],['id',_0xbfa4('0x49'),_0xbfa4('0x4a')]);return db[_0xbfa4('0x2a')][_0xbfa4('0x4d')](_['merge'](_0x2e2669,_0x285a33[_0xbfa4('0x4c')]),{'include':_0x285a33['query'][_0xbfa4('0x3e')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0xe870f5,0xc9))[_0xbfa4('0x42')](handleError(_0xe870f5,null));};exports[_0xbfa4('0x21')]=function(_0x54d314,_0x166a5d){if(_0x54d314[_0xbfa4('0x4c')]['id']){delete _0x54d314[_0xbfa4('0x4c')]['id'];}return db['Attachment'][_0xbfa4('0x46')]({'where':{'id':_0x54d314[_0xbfa4('0x44')]['id']}})['then'](handleEntityNotFound(_0x166a5d,null))['then'](saveUpdates(_0x54d314[_0xbfa4('0x4c')],null))[_0xbfa4('0x22')](respondWithResult(_0x166a5d,null))[_0xbfa4('0x42')](handleError(_0x166a5d,null));};exports[_0xbfa4('0x4e')]=function(_0x4c15a2,_0x1b4bde){return db['Attachment'][_0xbfa4('0x46')]({'where':{'id':_0x4c15a2['params']['id']}})['then'](handleEntityNotFound(_0x1b4bde,null))['then'](removeEntity(_0x1b4bde,null))[_0xbfa4('0x42')](handleError(_0x1b4bde,null));};exports[_0xbfa4('0x4d')]=function(_0x1204d8,_0x167270,_0x4ae056){_0x1204d8['body']['name']=_0x1204d8[_0xbfa4('0x4f')][_0xbfa4('0x50')];_0x1204d8[_0xbfa4('0x4c')][_0xbfa4('0x51')]=_0x1204d8['file']['filename'];_0x1204d8['body'][_0xbfa4('0x52')]=_0x1204d8[_0xbfa4('0x4f')][_0xbfa4('0x53')];return db[_0xbfa4('0x2a')]['create'](_0x1204d8[_0xbfa4('0x4c')])[_0xbfa4('0x22')](respondWithResult(_0x167270,0xc9))[_0xbfa4('0x42')](handleError(_0x167270,null));};exports[_0xbfa4('0x54')]=function(_0x4d4a57,_0x285296,_0x57c32c){return db[_0xbfa4('0x2a')][_0xbfa4('0x55')]({'where':{'id':_0x4d4a57[_0xbfa4('0x44')]['id']},'raw':!![]})[_0xbfa4('0x22')](handleEntityNotFound(_0x285296,null))[_0xbfa4('0x22')](function(_0x56de62){if(_0x56de62){var _0x1fa2bc=_0x56de62[_0xbfa4('0x56')]!==null;var _0x344258=path[_0xbfa4('0x57')](config[_0xbfa4('0x58')],_0xbfa4('0x59'));if(_0x1fa2bc){_0x344258=path[_0xbfa4('0x57')](_0x344258,_0xbfa4('0x5a'));}var _0x200bbd=path[_0xbfa4('0x57')](_0x344258,_0x56de62[_0xbfa4('0x51')]);return _0x285296[_0xbfa4('0x54')](_0x200bbd);}})[_0xbfa4('0x42')](handleError(_0x285296,null));}; \ No newline at end of file +var _0x1780=['../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','then','status','sendStatus','error','name','send','index','map','Attachment','rawAttributes','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','catch','show','keys','include','find','clone','params','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','mimetype','ChatOfflineMessageId','root','server/files/attachments/','join','offline-chat/','eml-format','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0xf3bba2,_0x4158bb){var _0x4340cc=function(_0x532235){while(--_0x532235){_0xf3bba2['push'](_0xf3bba2['shift']());}};_0x4340cc(++_0x4158bb);}(_0x1780,0x1da));var _0x0178=function(_0x5ced41,_0x13a927){_0x5ced41=_0x5ced41-0x0;var _0x5d8b33=_0x1780[_0x5ced41];return _0x5d8b33;};'use strict';var emlformat=require(_0x0178('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0178('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0178('0x2'));var Mustache=require(_0x0178('0x3'));var util=require(_0x0178('0x4'));var path=require(_0x0178('0x5'));var sox=require(_0x0178('0x6'));var csv=require(_0x0178('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0178('0x8'));var _=require(_0x0178('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x0178('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x0178('0x7'));var querystring=require(_0x0178('0xb'));var Papa=require(_0x0178('0xc'));var Redis=require('ioredis');var authService=require(_0x0178('0xd'));var qs=require(_0x0178('0xe'));var as=require(_0x0178('0xf'));var hardwareService=require(_0x0178('0x10'));var logger=require(_0x0178('0x11'))('api');var utils=require(_0x0178('0x12'));var config=require(_0x0178('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x0178('0x14'))['db'];function respondWithStatusCode(_0x332b92,_0x273696){_0x273696=_0x273696||0xcc;return function(_0x4861cf){if(_0x4861cf){return _0x332b92['sendStatus'](_0x273696);}return _0x332b92['status'](_0x273696)[_0x0178('0x15')]();};}function respondWithResult(_0x14343a,_0x5748ac){_0x5748ac=_0x5748ac||0xc8;return function(_0x33825d){if(_0x33825d){return _0x14343a['status'](_0x5748ac)[_0x0178('0x16')](_0x33825d);}};}function respondWithFilteredResult(_0x3e59cd,_0x540f95){return function(_0x56fee8){if(_0x56fee8){var _0x2ddff3=typeof _0x540f95[_0x0178('0x17')]===_0x0178('0x18')&&typeof _0x540f95[_0x0178('0x19')]===_0x0178('0x18');var _0x26c95c=_0x56fee8[_0x0178('0x1a')];var _0xcf1d81=_0x2ddff3?0x0:_0x540f95[_0x0178('0x17')];var _0x153d9f=_0x2ddff3?_0x56fee8[_0x0178('0x1a')]:_0x540f95[_0x0178('0x17')]+_0x540f95[_0x0178('0x19')];var _0x125e07;if(_0x153d9f>=_0x26c95c){_0x153d9f=_0x26c95c;_0x125e07=0xc8;}else{_0x125e07=0xce;}_0x3e59cd['status'](_0x125e07);return _0x3e59cd[_0x0178('0x1b')](_0x0178('0x1c'),_0xcf1d81+'-'+_0x153d9f+'/'+_0x26c95c)[_0x0178('0x16')](_0x56fee8);}return null;};}function patchUpdates(_0x21f9eb){return function(_0x5d8487){try{jsonpatch['apply'](_0x5d8487,_0x21f9eb,!![]);}catch(_0x556498){return BPromise[_0x0178('0x1d')](_0x556498);}return _0x5d8487['save']();};}function saveUpdates(_0x19ce18,_0x2b7bee){return function(_0x201fe5){if(_0x201fe5){return _0x201fe5[_0x0178('0x1e')](_0x19ce18)[_0x0178('0x1f')](function(_0x19e05a){return _0x19e05a;});}return null;};}function removeEntity(_0x3b8f98,_0x2d0e51){return function(_0x3e035f){if(_0x3e035f){return _0x3e035f['destroy']()[_0x0178('0x1f')](function(){_0x3b8f98[_0x0178('0x20')](0xcc)[_0x0178('0x15')]();});}};}function handleEntityNotFound(_0x202662,_0x1e367f){return function(_0x175d8c){if(!_0x175d8c){_0x202662[_0x0178('0x21')](0x194);}return _0x175d8c;};}function handleError(_0x43519d,_0x43807e){_0x43807e=_0x43807e||0x1f4;return function(_0x1c0600){logger[_0x0178('0x22')](_0x1c0600['stack']);if(_0x1c0600[_0x0178('0x23')]){delete _0x1c0600[_0x0178('0x23')];}_0x43519d[_0x0178('0x20')](_0x43807e)[_0x0178('0x24')](_0x1c0600);};}exports[_0x0178('0x25')]=function(_0x9342c4,_0x446479){var _0x1be6c8={},_0x1666e6={},_0x4790ba={'count':0x0,'rows':[]};var _0x209cc7=_[_0x0178('0x26')](db[_0x0178('0x27')][_0x0178('0x28')],function(_0x4af393){return{'name':_0x4af393[_0x0178('0x29')],'type':_0x4af393[_0x0178('0x2a')]['key']};});_0x1666e6[_0x0178('0x2b')]=_[_0x0178('0x26')](_0x209cc7,_0x0178('0x23'));_0x1666e6[_0x0178('0x2c')]=_['keys'](_0x9342c4[_0x0178('0x2c')]);_0x1666e6['filters']=_[_0x0178('0x2d')](_0x1666e6[_0x0178('0x2b')],_0x1666e6[_0x0178('0x2c')]);_0x1be6c8[_0x0178('0x2e')]=_[_0x0178('0x2d')](_0x1666e6[_0x0178('0x2b')],qs[_0x0178('0x2f')](_0x9342c4[_0x0178('0x2c')][_0x0178('0x2f')]));_0x1be6c8['attributes']=_0x1be6c8['attributes'][_0x0178('0x30')]?_0x1be6c8[_0x0178('0x2e')]:_0x1666e6[_0x0178('0x2b')];if(!_0x9342c4[_0x0178('0x2c')][_0x0178('0x31')](_0x0178('0x32'))){_0x1be6c8[_0x0178('0x19')]=qs['limit'](_0x9342c4['query'][_0x0178('0x19')]);_0x1be6c8['offset']=qs[_0x0178('0x17')](_0x9342c4[_0x0178('0x2c')]['offset']);}_0x1be6c8['order']=qs['sort'](_0x9342c4[_0x0178('0x2c')]['sort']);_0x1be6c8[_0x0178('0x33')]=qs[_0x0178('0x34')](_[_0x0178('0x35')](_0x9342c4[_0x0178('0x2c')],_0x1666e6[_0x0178('0x34')]),_0x209cc7);if(_0x9342c4[_0x0178('0x2c')]['filter']){_0x1be6c8['where']=_[_0x0178('0x36')](_0x1be6c8[_0x0178('0x33')],{'$or':_[_0x0178('0x26')](_0x209cc7,function(_0x1ee718){if(_0x1ee718[_0x0178('0x2a')]!==_0x0178('0x37')){var _0x4182c5={};_0x4182c5[_0x1ee718[_0x0178('0x23')]]={'$like':'%'+_0x9342c4[_0x0178('0x2c')][_0x0178('0x38')]+'%'};return _0x4182c5;}})});}_0x1be6c8=_['merge']({},_0x1be6c8,_0x9342c4[_0x0178('0x39')]);var _0x482659={'where':_0x1be6c8[_0x0178('0x33')]};return db[_0x0178('0x27')][_0x0178('0x1a')](_0x482659)[_0x0178('0x1f')](function(_0x368f93){_0x4790ba[_0x0178('0x1a')]=_0x368f93;if(_0x9342c4[_0x0178('0x2c')][_0x0178('0x3a')]){_0x1be6c8['include']=[{'all':!![]}];}return db[_0x0178('0x27')][_0x0178('0x3b')](_0x1be6c8);})['then'](function(_0x34cece){_0x4790ba['rows']=_0x34cece;return _0x4790ba;})[_0x0178('0x1f')](respondWithFilteredResult(_0x446479,_0x1be6c8))[_0x0178('0x3c')](handleError(_0x446479,null));};exports[_0x0178('0x3d')]=function(_0x1b737c,_0x7924bf){var _0x4d66b3={'raw':!![],'where':{'id':_0x1b737c['params']['id']}},_0x39098c={};_0x39098c[_0x0178('0x2b')]=_['keys'](db[_0x0178('0x27')]['rawAttributes']);_0x39098c['query']=_[_0x0178('0x3e')](_0x1b737c['query']);_0x39098c[_0x0178('0x34')]=_[_0x0178('0x2d')](_0x39098c['model'],_0x39098c[_0x0178('0x2c')]);_0x4d66b3[_0x0178('0x2e')]=_[_0x0178('0x2d')](_0x39098c[_0x0178('0x2b')],qs[_0x0178('0x2f')](_0x1b737c[_0x0178('0x2c')][_0x0178('0x2f')]));_0x4d66b3[_0x0178('0x2e')]=_0x4d66b3[_0x0178('0x2e')][_0x0178('0x30')]?_0x4d66b3[_0x0178('0x2e')]:_0x39098c[_0x0178('0x2b')];if(_0x1b737c[_0x0178('0x2c')][_0x0178('0x3a')]){_0x4d66b3[_0x0178('0x3f')]=[{'all':!![]}];}_0x4d66b3=_[_0x0178('0x36')]({},_0x4d66b3,_0x1b737c['options']);return db[_0x0178('0x27')][_0x0178('0x40')](_0x4d66b3)[_0x0178('0x1f')](handleEntityNotFound(_0x7924bf,null))[_0x0178('0x1f')](respondWithResult(_0x7924bf,null))['catch'](handleError(_0x7924bf,null));};exports[_0x0178('0x41')]=function(_0x45b1b8,_0x50a6ef){var _0x132b48={'where':{'id':_0x45b1b8[_0x0178('0x42')]['id']}},_0x31fdfb={};_0x31fdfb[_0x0178('0x2b')]=_[_0x0178('0x3e')](db[_0x0178('0x27')][_0x0178('0x28')]);_0x132b48['attributes']=_[_0x0178('0x2d')](_0x31fdfb[_0x0178('0x2b')],qs[_0x0178('0x2f')](_0x45b1b8['query'][_0x0178('0x2f')]));_0x132b48[_0x0178('0x2e')]=_0x132b48[_0x0178('0x2e')][_0x0178('0x30')]?_0x132b48['attributes']:_0x31fdfb[_0x0178('0x2b')];if(_0x45b1b8[_0x0178('0x2c')]['includeAll']){_0x132b48[_0x0178('0x3f')]=[{'all':!![]}];}_0x132b48=_['merge']({},_0x132b48,_0x45b1b8[_0x0178('0x39')]);return db[_0x0178('0x27')][_0x0178('0x40')](_0x132b48)[_0x0178('0x1f')](handleEntityNotFound(_0x50a6ef,null))[_0x0178('0x1f')](function(_0x52fc31){if(_0x52fc31){var _0x410a20=_0x52fc31[_0x0178('0x43')]({'plain':!![]});_0x410a20=qs[_0x0178('0x44')](_0x410a20,['id',_0x0178('0x45'),_0x0178('0x46')]);_0x45b1b8[_0x0178('0x47')]=_['omit'](_0x45b1b8[_0x0178('0x47')],['id',_0x0178('0x45'),'updatedAt']);return db[_0x0178('0x27')][_0x0178('0x48')](_[_0x0178('0x36')](_0x410a20,_0x45b1b8[_0x0178('0x47')]),{'include':_0x45b1b8[_0x0178('0x2c')][_0x0178('0x3a')]?[{'all':!![]}]:undefined});}})[_0x0178('0x1f')](respondWithResult(_0x50a6ef,0xc9))['catch'](handleError(_0x50a6ef,null));};exports[_0x0178('0x1e')]=function(_0x48b9db,_0x36fb39){if(_0x48b9db[_0x0178('0x47')]['id']){delete _0x48b9db[_0x0178('0x47')]['id'];}return db[_0x0178('0x27')]['find']({'where':{'id':_0x48b9db[_0x0178('0x42')]['id']}})['then'](handleEntityNotFound(_0x36fb39,null))[_0x0178('0x1f')](saveUpdates(_0x48b9db[_0x0178('0x47')],null))['then'](respondWithResult(_0x36fb39,null))['catch'](handleError(_0x36fb39,null));};exports['destroy']=function(_0x2ce5d2,_0x4446b4){return db['Attachment'][_0x0178('0x40')]({'where':{'id':_0x2ce5d2[_0x0178('0x42')]['id']}})[_0x0178('0x1f')](handleEntityNotFound(_0x4446b4,null))[_0x0178('0x1f')](removeEntity(_0x4446b4,null))[_0x0178('0x3c')](handleError(_0x4446b4,null));};exports[_0x0178('0x48')]=function(_0x3aa33a,_0x463158,_0x409633){_0x3aa33a['body']['name']=_0x3aa33a[_0x0178('0x49')][_0x0178('0x4a')];_0x3aa33a[_0x0178('0x47')][_0x0178('0x4b')]=_0x3aa33a['file']['filename'];_0x3aa33a[_0x0178('0x47')][_0x0178('0x2a')]=_0x3aa33a[_0x0178('0x49')][_0x0178('0x4c')];return db[_0x0178('0x27')][_0x0178('0x48')](_0x3aa33a[_0x0178('0x47')])[_0x0178('0x1f')](respondWithResult(_0x463158,0xc9))[_0x0178('0x3c')](handleError(_0x463158,null));};exports['download']=function(_0x143b4e,_0xbfbbc8,_0x31ea46){return db['Attachment']['findOne']({'where':{'id':_0x143b4e[_0x0178('0x42')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0xbfbbc8,null))['then'](function(_0x32b093){if(_0x32b093){var _0x24147d=_0x32b093[_0x0178('0x4d')]!==null;var _0x37b5f8=path['join'](config[_0x0178('0x4e')],_0x0178('0x4f'));if(_0x24147d){_0x37b5f8=path[_0x0178('0x50')](_0x37b5f8,_0x0178('0x51'));}var _0x340902=path[_0x0178('0x50')](_0x37b5f8,_0x32b093[_0x0178('0x4b')]);return _0xbfbbc8['download'](_0x340902);}})[_0x0178('0x3c')](handleError(_0xbfbbc8,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 1c6ed8e..6a326b2 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 _0x6644=['bluebird','request-promise','rimraf','../../config/environment','./attachment.attributes','exports','define','Attachment','lodash','util','../../config/logger','api','moment'];(function(_0x122cc1,_0x5c956e){var _0x1e33af=function(_0x949b75){while(--_0x949b75){_0x122cc1['push'](_0x122cc1['shift']());}};_0x1e33af(++_0x5c956e);}(_0x6644,0x1dc));var _0x4664=function(_0xfd2fdc,_0x2b61db){_0xfd2fdc=_0xfd2fdc-0x0;var _0x558d5d=_0x6644[_0xfd2fdc];return _0x558d5d;};'use strict';var _=require(_0x4664('0x0'));var util=require(_0x4664('0x1'));var logger=require(_0x4664('0x2'))(_0x4664('0x3'));var moment=require(_0x4664('0x4'));var BPromise=require(_0x4664('0x5'));var rp=require(_0x4664('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4664('0x7'));var config=require(_0x4664('0x8'));var attributes=require(_0x4664('0x9'));module[_0x4664('0xa')]=function(_0x597619,_0x40d044){return _0x597619[_0x4664('0xb')](_0x4664('0xc'),attributes,{'tableName':'attachments','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb3e7=['define','Attachment','util','api','moment','request-promise','rimraf','exports'];(function(_0x34cbbf,_0x540ce2){var _0x3ec76e=function(_0x4e77e1){while(--_0x4e77e1){_0x34cbbf['push'](_0x34cbbf['shift']());}};_0x3ec76e(++_0x540ce2);}(_0xb3e7,0x1d2));var _0x7b3e=function(_0x42245d,_0x51758f){_0x42245d=_0x42245d-0x0;var _0x4b211a=_0xb3e7[_0x42245d];return _0x4b211a;};'use strict';var _=require('lodash');var util=require(_0x7b3e('0x0'));var logger=require('../../config/logger')(_0x7b3e('0x1'));var moment=require(_0x7b3e('0x2'));var BPromise=require('bluebird');var rp=require(_0x7b3e('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7b3e('0x4'));var config=require('../../config/environment');var attributes=require('./attachment.attributes');module[_0x7b3e('0x5')]=function(_0x12b50e,_0x3ddf2b){return _0x12b50e[_0x7b3e('0x6')](_0x7b3e('0x7'),attributes,{'tableName':'attachments','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 915703e..f393335 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 _0x153f=['then','info','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','CreateAttachment','Attachment','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x153f,0x15b));var _0xf153=function(_0x302d37,_0x59fb4a){_0x302d37=_0x302d37-0x0;var _0x3d270c=_0x153f[_0x302d37];return _0x3d270c;};'use strict';var _=require(_0xf153('0x0'));var util=require(_0xf153('0x1'));var moment=require(_0xf153('0x2'));var BPromise=require(_0xf153('0x3'));var rs=require(_0xf153('0x4'));var fs=require('fs');var Redis=require(_0xf153('0x5'));var db=require(_0xf153('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xf153('0x7'))('rpc');var config=require(_0xf153('0x8'));var jayson=require(_0xf153('0x9'));var client=jayson[_0xf153('0xa')][_0xf153('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x21f432,_0x4c8ae5,_0x17ba96){return new BPromise(function(_0x143497,_0x224f88){return client[_0xf153('0xc')](_0x21f432,_0x17ba96)[_0xf153('0xd')](function(_0x3e7a82){logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));logger[_0xf153('0x11')]('Attachment,\x20%s,\x20%s,\x20%s',_0x4c8ae5,_0xf153('0x10'),JSON[_0xf153('0x12')](_0x3e7a82));if(_0x3e7a82[_0xf153('0x13')]){if(_0x3e7a82['error'][_0xf153('0x14')]===0x1f4){logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);return _0x224f88(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}logger[_0xf153('0x13')](_0xf153('0xf'),_0x4c8ae5,_0x3e7a82['error'][_0xf153('0x15')]);return _0x143497(_0x3e7a82[_0xf153('0x13')][_0xf153('0x15')]);}else{logger[_0xf153('0xe')](_0xf153('0xf'),_0x4c8ae5,_0xf153('0x10'));_0x143497(_0x3e7a82[_0xf153('0x16')][_0xf153('0x15')]);}})['catch'](function(_0x35f4e8){logger['error'](_0xf153('0xf'),_0x4c8ae5,_0x35f4e8);_0x224f88(_0x35f4e8);});});}exports[_0xf153('0x17')]=function(_0x138dbe){var _0x44272e=this;return new Promise(function(_0x4e790d,_0x357d57){return db[_0xf153('0x18')][_0xf153('0x19')](_0x138dbe[_0xf153('0x1a')],{'raw':_0x138dbe[_0xf153('0x1b')]?_0x138dbe[_0xf153('0x1b')][_0xf153('0x1c')]===undefined?!![]:![]:!![]})[_0xf153('0xd')](function(_0x3735a7){logger[_0xf153('0xe')](_0xf153('0x17'),_0x138dbe);logger[_0xf153('0x11')]('CreateAttachment',_0x138dbe,JSON[_0xf153('0x12')](_0x3735a7));_0x4e790d(_0x3735a7);})[_0xf153('0x1d')](function(_0x3d3e41){logger[_0xf153('0x13')](_0xf153('0x17'),_0x3d3e41[_0xf153('0x15')],_0x138dbe);_0x357d57(_0x44272e[_0xf153('0x13')](0x1f4,_0x3d3e41[_0xf153('0x15')]));});});}; \ No newline at end of file +var _0x0439=['CreateAttachment','Attachment','create','body','options','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','Attachment,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch'];(function(_0x10c91b,_0x4b2217){var _0x49fc2a=function(_0x53b9c1){while(--_0x53b9c1){_0x10c91b['push'](_0x10c91b['shift']());}};_0x49fc2a(++_0x4b2217);}(_0x0439,0xdd));var _0x9043=function(_0x45a244,_0x12f982){_0x45a244=_0x45a244-0x0;var _0x57edbc=_0x0439[_0x45a244];return _0x57edbc;};'use strict';var _=require(_0x9043('0x0'));var util=require(_0x9043('0x1'));var moment=require(_0x9043('0x2'));var BPromise=require(_0x9043('0x3'));var rs=require(_0x9043('0x4'));var fs=require('fs');var Redis=require(_0x9043('0x5'));var db=require(_0x9043('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9043('0x7'))(_0x9043('0x8'));var config=require(_0x9043('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x9043('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f79c2,_0x2fe4da,_0x19bf02){return new BPromise(function(_0x5bea98,_0x135a40){return client['request'](_0x4f79c2,_0x19bf02)[_0x9043('0xb')](function(_0x36a5cb){logger['info'](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));logger[_0x9043('0xe')]('Attachment,\x20%s,\x20%s,\x20%s',_0x2fe4da,'request\x20sent',JSON[_0x9043('0xf')](_0x36a5cb));if(_0x36a5cb[_0x9043('0x10')]){if(_0x36a5cb['error'][_0x9043('0x11')]===0x1f4){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb[_0x9043('0x10')][_0x9043('0x12')]);return _0x135a40(_0x36a5cb[_0x9043('0x10')]['message']);}logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x36a5cb['error'][_0x9043('0x12')]);return _0x5bea98(_0x36a5cb[_0x9043('0x10')]['message']);}else{logger[_0x9043('0x13')](_0x9043('0xc'),_0x2fe4da,_0x9043('0xd'));_0x5bea98(_0x36a5cb[_0x9043('0x14')][_0x9043('0x12')]);}})[_0x9043('0x15')](function(_0x13b613){logger[_0x9043('0x10')](_0x9043('0xc'),_0x2fe4da,_0x13b613);_0x135a40(_0x13b613);});});}exports[_0x9043('0x16')]=function(_0x51823a){var _0x584fd9=this;return new Promise(function(_0x47fbdc,_0x2612f8){return db[_0x9043('0x17')][_0x9043('0x18')](_0x51823a[_0x9043('0x19')],{'raw':_0x51823a['options']?_0x51823a[_0x9043('0x1a')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x161511){logger[_0x9043('0x13')](_0x9043('0x16'),_0x51823a);logger[_0x9043('0xe')](_0x9043('0x16'),_0x51823a,JSON[_0x9043('0xf')](_0x161511));_0x47fbdc(_0x161511);})[_0x9043('0x15')](function(_0x366695){logger['error'](_0x9043('0x16'),_0x366695[_0x9043('0x12')],_0x51823a);_0x2612f8(_0x584fd9[_0x9043('0x10')](0x1f4,_0x366695['message']));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 128ad18..4987796 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 _0xdb28=['path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','download','/:id/clone','clone','join','root','server/files/attachments/','%s-%s','now','originalname','replace','post','single','file','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xdb28,0x106));var _0x8db2=function(_0x1c8edb,_0x31877f){_0x1c8edb=_0x1c8edb-0x0;var _0x261cca=_0xdb28[_0x1c8edb];return _0x261cca;};'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('./attachment.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'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1d9371,_0x150942,_0x576475){_0x576475(null,path[_0x8db2('0x11')](config[_0x8db2('0x12')],_0x8db2('0x13')));},'filename':function(_0x204f49,_0x37d017,_0x559fb1){_0x559fb1(null,util['format'](_0x8db2('0x14'),Date[_0x8db2('0x15')](),_0x37d017[_0x8db2('0x16')][_0x8db2('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x8db2('0x18')]('/',upload[_0x8db2('0x19')](_0x8db2('0x1a')),controller[_0x8db2('0x1b')]);router[_0x8db2('0x1c')](_0x8db2('0xb'),auth['isAuthenticated'](),controller[_0x8db2('0x1d')]);router[_0x8db2('0x1e')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);module[_0x8db2('0x20')]=router; \ No newline at end of file +var _0x5f66=['fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','/:id/download','/:id/clone','clone','diskStorage','root','format','%s-%s','now','originalname','replace','post','single','file','create','delete','destroy','exports','util','connect-timeout','express','Router'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0x5f66,0x1a0));var _0x65f6=function(_0x173441,_0x26b0d9){_0x173441=_0x173441-0x0;var _0x2423a8=_0x5f66[_0x173441];return _0x2423a8;};'use strict';var multer=require('multer');var util=require(_0x65f6('0x0'));var path=require('path');var timeout=require(_0x65f6('0x1'));var express=require(_0x65f6('0x2'));var router=express[_0x65f6('0x3')]();var fs_extra=require(_0x65f6('0x4'));var auth=require(_0x65f6('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x65f6('0x6'));var controller=require('./attachment.controller');router[_0x65f6('0x7')]('/',auth[_0x65f6('0x8')](),controller['index']);router['get'](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xa')]);router[_0x65f6('0x7')](_0x65f6('0xb'),auth[_0x65f6('0x8')](),controller['download']);router['post'](_0x65f6('0xc'),auth[_0x65f6('0x8')](),controller[_0x65f6('0xd')]);var upload=multer({'storage':multer[_0x65f6('0xe')]({'destination':function(_0x50d26d,_0x41a7fd,_0x571436){_0x571436(null,path['join'](config[_0x65f6('0xf')],'server/files/attachments/'));},'filename':function(_0x419819,_0x4862a5,_0x2f964a){_0x2f964a(null,util[_0x65f6('0x10')](_0x65f6('0x11'),Date[_0x65f6('0x12')](),_0x4862a5[_0x65f6('0x13')][_0x65f6('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x65f6('0x15')]('/',upload[_0x65f6('0x16')](_0x65f6('0x17')),controller[_0x65f6('0x18')]);router['put'](_0x65f6('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x65f6('0x19')](_0x65f6('0x9'),auth[_0x65f6('0x8')](),controller[_0x65f6('0x1a')]);module[_0x65f6('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 0bc1661..7be6b8d 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 _0x4720=['../../components/auth/service','signToken','authenticate','google','callback','/login','use','clientID','secret','callbackURL','Setting','findOne','allowedLoginAttempts','blockDuration','then','map','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','minutes','clearBlockUser','getLicense','catch','passport','passport-google-oauth20','Strategy','moment'];(function(_0x3731c2,_0x686035){var _0x5a50e3=function(_0x34c8bf){while(--_0x34c8bf){_0x3731c2['push'](_0x3731c2['shift']());}};_0x5a50e3(++_0x686035);}(_0x4720,0xe3));var _0x0472=function(_0xcf4569,_0x1ce755){_0xcf4569=_0xcf4569-0x0;var _0x7fef=_0x4720[_0xcf4569];return _0x7fef;};'use strict';var _=require('lodash');var passport=require(_0x0472('0x0'));var GoogleStrategy=require(_0x0472('0x1'))[_0x0472('0x2')];var moment=require(_0x0472('0x3'));var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var signToken=require(_0x0472('0x4'))[_0x0472('0x5')];var utils=require('../../config/utils');exports['login']=passport[_0x0472('0x6')](_0x0472('0x7'),{'failureRedirect':'/login','scope':['profile','email'],'session':![]});exports[_0x0472('0x8')]=passport[_0x0472('0x6')](_0x0472('0x7'),{'failureRedirect':_0x0472('0x9'),'session':![]});passport[_0x0472('0xa')](new GoogleStrategy({'clientID':config[_0x0472('0x7')]?config['google'][_0x0472('0xb')]:'id','clientSecret':config['google']?config[_0x0472('0x7')]['clientSecret']:_0x0472('0xc'),'callbackURL':config[_0x0472('0x7')]?config['google'][_0x0472('0xd')]:''},function(_0x3bd2b0,_0x4b8d07,_0xd2574b,_0x30638a){var _0x119a8b,_0x3fda87;return db[_0x0472('0xe')][_0x0472('0xf')]({'where':{'id':0x1},'attributes':[_0x0472('0x10'),_0x0472('0x11')],'raw':!![]})[_0x0472('0x12')](function(_0x3ee0bd){_0x119a8b=_0x3ee0bd;return db['User']['find']({'where':{'email':_[_0x0472('0x13')](_0xd2574b['emails'],_0x0472('0x14')),'role':{'$or':[_0x0472('0x15'),_0x0472('0x16'),_0x0472('0x17')]}}});})[_0x0472('0x12')](function(_0x30d5cc){_0x3fda87=_0x30d5cc;if(_0x3fda87){if(_0x3fda87[_0x0472('0x18')]){return _0x30638a(_0x0472('0x19'));}else if(_0x119a8b[_0x0472('0x11')]>0x0){if(_0x3fda87[_0x0472('0x1a')]){if(moment(_0x3fda87[_0x0472('0x1b')])[_0x0472('0x1c')](_0x119a8b[_0x0472('0x11')],_0x0472('0x1d'))>moment()){return _0x30638a(_0x0472('0x19'));}else{return utils[_0x0472('0x1e')](_0x3fda87,0x0,![],null)[_0x0472('0x12')](function(){return utils[_0x0472('0x1f')](_0x3fda87);})[_0x0472('0x12')](function(){return _0x30638a(null,_0x3fda87);});}}else{return utils[_0x0472('0x1f')](_0x3fda87)[_0x0472('0x12')](function(){return _0x30638a(null,_0x3fda87);});}}else{return utils['getLicense'](_0x3fda87)[_0x0472('0x12')](function(){return _0x30638a(null,_0x3fda87);});}}return _0x30638a(_0x0472('0x19'));})[_0x0472('0x20')](function(_0x56ded4){_0x30638a(_0x56ded4);});})); \ No newline at end of file +var _0x96a6=['catch','lodash','passport','../../mysqldb','../../config/environment','../../components/auth/service','signToken','../../config/utils','login','google','/login','profile','callback','authenticate','use','clientID','clientSecret','secret','callbackURL','findOne','allowedLoginAttempts','then','User','find','emails','value','admin','user','agent','disabled','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blocked','blockedAt','add','blockDuration','clearBlockUser','getLicense'];(function(_0x25cb87,_0xc2d352){var _0x3a7537=function(_0x53516a){while(--_0x53516a){_0x25cb87['push'](_0x25cb87['shift']());}};_0x3a7537(++_0xc2d352);}(_0x96a6,0xba));var _0x696a=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x96a6[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x696a('0x0'));var passport=require(_0x696a('0x1'));var GoogleStrategy=require('passport-google-oauth20')['Strategy'];var moment=require('moment');var db=require(_0x696a('0x2'))['db'];var config=require(_0x696a('0x3'));var signToken=require(_0x696a('0x4'))[_0x696a('0x5')];var utils=require(_0x696a('0x6'));exports[_0x696a('0x7')]=passport['authenticate'](_0x696a('0x8'),{'failureRedirect':_0x696a('0x9'),'scope':[_0x696a('0xa'),'email'],'session':![]});exports[_0x696a('0xb')]=passport[_0x696a('0xc')](_0x696a('0x8'),{'failureRedirect':_0x696a('0x9'),'session':![]});passport[_0x696a('0xd')](new GoogleStrategy({'clientID':config['google']?config[_0x696a('0x8')][_0x696a('0xe')]:'id','clientSecret':config['google']?config[_0x696a('0x8')][_0x696a('0xf')]:_0x696a('0x10'),'callbackURL':config[_0x696a('0x8')]?config[_0x696a('0x8')][_0x696a('0x11')]:''},function(_0x2684be,_0x375be7,_0x4a5745,_0x388f50){var _0x5f01ed,_0x47a03a;return db['Setting'][_0x696a('0x12')]({'where':{'id':0x1},'attributes':[_0x696a('0x13'),'blockDuration'],'raw':!![]})[_0x696a('0x14')](function(_0xfb4534){_0x5f01ed=_0xfb4534;return db[_0x696a('0x15')][_0x696a('0x16')]({'where':{'email':_['map'](_0x4a5745[_0x696a('0x17')],_0x696a('0x18')),'role':{'$or':[_0x696a('0x19'),_0x696a('0x1a'),_0x696a('0x1b')]}}});})[_0x696a('0x14')](function(_0x357ad0){_0x47a03a=_0x357ad0;if(_0x47a03a){if(_0x47a03a[_0x696a('0x1c')]){return _0x388f50(_0x696a('0x1d'));}else if(_0x5f01ed['blockDuration']>0x0){if(_0x47a03a[_0x696a('0x1e')]){if(moment(_0x47a03a[_0x696a('0x1f')])[_0x696a('0x20')](_0x5f01ed[_0x696a('0x21')],'minutes')>moment()){return _0x388f50(_0x696a('0x1d'));}else{return utils[_0x696a('0x22')](_0x47a03a,0x0,![],null)['then'](function(){return utils['getLicense'](_0x47a03a);})[_0x696a('0x14')](function(){return _0x388f50(null,_0x47a03a);});}}else{return utils[_0x696a('0x23')](_0x47a03a)[_0x696a('0x14')](function(){return _0x388f50(null,_0x47a03a);});}}else{return utils[_0x696a('0x23')](_0x47a03a)[_0x696a('0x14')](function(){return _0x388f50(null,_0x47a03a);});}}return _0x388f50(_0x696a('0x1d'));})[_0x696a('0x24')](function(_0x510849){_0x388f50(_0x510849);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index 8fdf43e..473fc1d 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 _0xc4d2=['exports','express','passport','Router','../../components/auth/service','get','login','callback','isMiddleware'];(function(_0x46caa5,_0x45d21c){var _0x70f407=function(_0x1fecae){while(--_0x1fecae){_0x46caa5['push'](_0x46caa5['shift']());}};_0x70f407(++_0x45d21c);}(_0xc4d2,0x88));var _0x2c4d=function(_0x5e2e8e,_0x2a9dcb){_0x5e2e8e=_0x5e2e8e-0x0;var _0x629259=_0xc4d2[_0x5e2e8e];return _0x629259;};'use strict';var express=require(_0x2c4d('0x0'));var passport=require(_0x2c4d('0x1'));var router=express[_0x2c4d('0x2')]();var controller=require('./authGoogle.controller');var userController=require('../user/user.controller.js');var authService=require(_0x2c4d('0x3'));router[_0x2c4d('0x4')]('/',controller[_0x2c4d('0x5')]);router[_0x2c4d('0x4')]('/callback',controller[_0x2c4d('0x6')],authService[_0x2c4d('0x7')],userController['login'],authService['setTokenCookie']);module[_0x2c4d('0x8')]=router; \ No newline at end of file +var _0xd2e6=['express','Router','./authGoogle.controller','../../components/auth/service','get','/callback','callback','isMiddleware','setTokenCookie'];(function(_0x592d7c,_0x405966){var _0xaa8d19=function(_0x20a67a){while(--_0x20a67a){_0x592d7c['push'](_0x592d7c['shift']());}};_0xaa8d19(++_0x405966);}(_0xd2e6,0x195));var _0x6d2e=function(_0x5f3cd5,_0xa7984c){_0x5f3cd5=_0x5f3cd5-0x0;var _0x24cbef=_0xd2e6[_0x5f3cd5];return _0x24cbef;};'use strict';var express=require(_0x6d2e('0x0'));var passport=require('passport');var router=express[_0x6d2e('0x1')]();var controller=require(_0x6d2e('0x2'));var userController=require('../user/user.controller.js');var authService=require(_0x6d2e('0x3'));router[_0x6d2e('0x4')]('/',controller['login']);router['get'](_0x6d2e('0x5'),controller[_0x6d2e('0x6')],authService[_0x6d2e('0x7')],userController['login'],authService[_0x6d2e('0x8')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index b13dcb4..471b657 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 _0xf90e=['blockDuration','add','clearBlockUser','minutes','getLicense','catch','find','email','MailServerOut','Smtp','service','host','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','request','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','stringify','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','User','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/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','status','send','Reset\x20Email\x20sent!','params','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','validatePasswordPattern','password','enforcePasswordHistory','validatePasswordHistory','previousPasswords','Password\x20reset!','passport','passport-local','Strategy','lodash','randomstring','moment','../../config/utils','client','Setting','findOne','allowedLoginAttempts','name','salt','role','disabled','blocked','blockedAt','admin','user','then','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate'];(function(_0x3d5d27,_0x5477ac){var _0x4dcacc=function(_0x49884b){while(--_0x49884b){_0x3d5d27['push'](_0x3d5d27['shift']());}};_0x4dcacc(++_0x5477ac);}(_0xf90e,0x1d6));var _0xef90=function(_0x6b5ef0,_0x488e50){_0x6b5ef0=_0x6b5ef0-0x0;var _0x42d49c=_0xf90e[_0x6b5ef0];return _0x42d49c;};'use strict';var util=require('util');var passport=require(_0xef90('0x0'));var LocalStrategy=require(_0xef90('0x1'))[_0xef90('0x2')];var jayson=require('jayson/promise');var _=require(_0xef90('0x3'));var rs=require(_0xef90('0x4'));var moment=require(_0xef90('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xef90('0x6'));var client=jayson[_0xef90('0x7')]['http']({'port':0x232b});function localAuthenticate(_0x219511,_0x349cce,_0x34a0e6,_0x441605){var _0x2a0df2,_0x2f35a7;return db[_0xef90('0x8')][_0xef90('0x9')]({'where':{'id':0x1},'attributes':[_0xef90('0xa'),'blockDuration'],'raw':!![]})['then'](function(_0x2f661a){_0x2a0df2=_0x2f661a;return _0x219511[_0xef90('0x9')]({'attributes':['id',_0xef90('0xb'),'password',_0xef90('0xc'),_0xef90('0xd'),_0xef90('0xe'),_0xef90('0xf'),_0xef90('0x10'),'loginAttempts'],'where':{'name':_0x349cce,'role':{'$or':[_0xef90('0x11'),_0xef90('0x12'),'agent']}}});})[_0xef90('0x13')](function(_0x55fc9c){if(!_0x55fc9c||_0x55fc9c&&_0x55fc9c[_0xef90('0xb')]!==_0x349cce){throw new Error(_0xef90('0x14'));}else{_0x2f35a7=_0x55fc9c;return _0x2f35a7;}})[_0xef90('0x13')](function(){_0x2f35a7[_0xef90('0x15')](_0x34a0e6,function(_0x224b0f,_0x2e6c0d){var _0x569ab5=_0x2f35a7['loginAttempts']+0x1;if(_0x224b0f){return _0x441605(_0x224b0f);}else if(!_0x2e6c0d){if(_0x2f35a7[_0xef90('0xe')]){return _0x441605(null,![],{'message':_0xef90('0x14')});}else if(_0x2a0df2[_0xef90('0xa')]>0x0){if(_0x2f35a7[_0xef90('0xf')]){if(_0x2a0df2[_0xef90('0x16')]>0x0){if(moment(_0x2f35a7[_0xef90('0x10')])[_0xef90('0x17')](_0x2a0df2[_0xef90('0x16')],'minutes')>moment()){return _0x441605(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x2f35a7,_0x569ab5,![],null)[_0xef90('0x13')](function(){return _0x441605(null,![],{'message':_0xef90('0x14')});});}}else{return _0x441605(null,![],{'message':_0xef90('0x14')});}}else{if(_0x569ab5>=_0x2a0df2['allowedLoginAttempts']){return utils[_0xef90('0x18')](_0x2f35a7,0x0,!![],moment())['then'](function(){return _0x441605(null,![],{'message':_0xef90('0x14')});});}else{return utils[_0xef90('0x18')](_0x2f35a7,_0x569ab5,![],null)[_0xef90('0x13')](function(){return _0x441605(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x441605(null,![],{'message':_0xef90('0x14')});}}else{if(_0x2f35a7[_0xef90('0xe')]){return _0x441605(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x2a0df2['allowedLoginAttempts']>0x0){if(_0x2f35a7[_0xef90('0xf')]){if(_0x2a0df2[_0xef90('0x16')]>0x0){if(moment(_0x2f35a7[_0xef90('0x10')])[_0xef90('0x17')](_0x2a0df2[_0xef90('0x16')],_0xef90('0x19'))>moment()){return _0x441605(null,![],{'message':_0xef90('0x14')});}else{return utils[_0xef90('0x18')](_0x2f35a7,0x0,![],null)[_0xef90('0x13')](function(){return utils['getLicense'](_0x2f35a7);})[_0xef90('0x13')](function(){return _0x441605(null,_0x2f35a7);});}}else{return _0x441605(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{return utils['clearBlockUser'](_0x2f35a7,0x0,![],null)['then'](function(){return utils[_0xef90('0x1a')](_0x2f35a7);})[_0xef90('0x13')](function(){return _0x441605(null,_0x2f35a7);})['catch'](function(_0x2b1629){return _0x441605(null,![],_0x2b1629);});}}else{if(_0x2f35a7[_0xef90('0xf')]){return _0x441605(null,![],{'message':_0xef90('0x14')});}else{return utils[_0xef90('0x1a')](_0x2f35a7)[_0xef90('0x13')](function(){return _0x441605(null,_0x2f35a7);});}}}});})[_0xef90('0x1b')](function(_0x2bde1d){return _0x441605(null,![],_0x2bde1d);});}function sendServiceMail(_0x3b7e45){return db['MailAccount'][_0xef90('0x1c')]({'where':{'service':!![]},'attributes':['id',_0xef90('0xb'),_0xef90('0x1d')],'include':[{'model':db[_0xef90('0x1e')],'as':_0xef90('0x1f')}]})[_0xef90('0x13')](function(_0x2d0fea){if(!_0x2d0fea){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x2b7eb7={'tls':{'rejectUnauthorized':![]}};if(_0x2d0fea['Smtp'][_0xef90('0x20')]){_0x2b7eb7[_0xef90('0x20')]=_0x2d0fea[_0xef90('0x1f')][_0xef90('0x20')];}else{_0x2b7eb7[_0xef90('0x21')]=_0x2d0fea[_0xef90('0x1f')]['host'];_0x2b7eb7['port']=_0x2d0fea['Smtp']['port'];_0x2b7eb7['secure']=_0x2d0fea[_0xef90('0x1f')][_0xef90('0x22')];}if(_0x2d0fea[_0xef90('0x1f')][_0xef90('0x23')]){_0x2b7eb7[_0xef90('0x24')]={'user':_0x2d0fea[_0xef90('0x1f')][_0xef90('0x12')],'pass':_0x2d0fea[_0xef90('0x1f')][_0xef90('0x25')]};}var _0x1a2994={'account':_0x2b7eb7,'message':_[_0xef90('0x26')]({'from':util[_0xef90('0x27')](_0xef90('0x28'),_0x2d0fea['name'],_0x2d0fea['email']||_0x2d0fea[_0xef90('0x1f')][_0xef90('0x12')])},_0x3b7e45)};return client[_0xef90('0x29')](_0xef90('0x2a'),_0x1a2994);})[_0xef90('0x13')](function(_0x3eae44){if(_0x3eae44[_0xef90('0x2b')]){throw new Error(util[_0xef90('0x27')](_0xef90('0x2c'),_0x3eae44[_0xef90('0x2b')]['message']||JSON[_0xef90('0x2d')](_0x3eae44[_0xef90('0x2b')])));}return!![];});}function handleError(_0x176321,_0x1bd3ab,_0x2dd062){return _0x176321['status'](_0x1bd3ab||0x1f4)['send']({'message':_0x2dd062?_0x2dd062[_0xef90('0x2e')]||_0x2dd062:''});}exports['login']=function(_0x1df2b7,_0x1f4015,_0x3caed6){passport[_0xef90('0x15')]('local',function(_0xe689d,_0x36ac38,_0x3aa050){var _0x17499f=_0xe689d||_0x3aa050;if(_0x17499f){return handleError(_0x1f4015,0x191,_0x17499f);}if(!_0x36ac38){return handleError(_0x1f4015,0x194,{'message':_0xef90('0x2f')});}else{var _0x1c1741={'payload':{'id':_0x36ac38['id'],'role':_0x36ac38[_0xef90('0xd')]},'options':{'expiresIn':0x15180}};return authService[_0xef90('0x30')](_0x1c1741)[_0xef90('0x13')](function(_0x54cee3){_0x1f4015['json']({'id':_0x36ac38['id'],'token':_0x54cee3,'statusCall':'','isAlreadyLogged':_0x36ac38[_0xef90('0x31')]});});}})(_0x1df2b7,_0x1f4015,_0x3caed6);};exports[_0xef90('0x32')]=function(_0x3a9346,_0x5157c1,_0x53a6f2){if(!_0x3a9346[_0xef90('0x33')]['email']){return handleError(_0x5157c1,0x1f4,{'message':_0xef90('0x34')});}var _0x4ec5f3=rs[_0xef90('0x35')]();_0x3a9346[_0xef90('0x33')][_0xef90('0x1d')]=_0x3a9346[_0xef90('0x33')][_0xef90('0x1d')][_0xef90('0x36')]()['toLowerCase']();var _0x87f0ce;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xef90('0xa'),_0xef90('0x16')],'raw':!![]})['then'](function(_0x31b83a){_0x87f0ce=_0x31b83a;return db[_0xef90('0x37')][_0xef90('0x1c')]({'where':{'email':_0x3a9346[_0xef90('0x33')][_0xef90('0x1d')]}});})[_0xef90('0x13')](function(_0x25bf92){if(!_0x25bf92){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x25bf92[_0xef90('0xe')]){throw new Error('The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.');}if(_0x25bf92[_0xef90('0xf')]){if(moment(_0x25bf92[_0xef90('0x10')])['add'](_0x87f0ce[_0xef90('0x16')],_0xef90('0x19'))>moment()){throw new Error(_0xef90('0x38'));}else{_0x25bf92[_0xef90('0xf')]=![];_0x25bf92[_0xef90('0x10')]=null;}}_0x25bf92[_0xef90('0x39')]=_0x4ec5f3;_0x25bf92[_0xef90('0x3a')]=Date['now']()+0x36ee80;return _0x25bf92[_0xef90('0x3b')]();})[_0xef90('0x13')](function(){return sendServiceMail({'to':_0x3a9346[_0xef90('0x33')]['email'],'subject':_0xef90('0x3c'),'text':_0xef90('0x3d')+_0xef90('0x3e')+_0xef90('0x3f')+_0x3a9346[_0xef90('0x40')][_0xef90('0x21')]+_0xef90('0x41')+_0x4ec5f3+'\x0a\x0a'+_0xef90('0x42')});})[_0xef90('0x13')](function(){_0x5157c1[_0xef90('0x43')](0xc8)[_0xef90('0x44')]({'message':_0xef90('0x45')});})[_0xef90('0x1b')](function(_0x1610b2){return handleError(_0x5157c1,0x1f4,_0x1610b2);});};exports['reset']=function(_0x504790,_0x1f20f0,_0x1258cf){return db[_0xef90('0x37')][_0xef90('0x1c')]({'where':{'resetPasswordToken':_0x504790[_0xef90('0x46')][_0xef90('0x47')],'resetPasswordExpires':{'$gt':Date[_0xef90('0x48')]()}}})[_0xef90('0x13')](function(_0x374f0c){if(!_0x374f0c){throw new Error(_0xef90('0x49'));}return db['Setting'][_0xef90('0x9')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xef90('0x4a')]})['then'](function(_0x4a72bd){if(_0x4a72bd[_0xef90('0x4b')])authService[_0xef90('0x4c')](_0x504790[_0xef90('0x33')][_0xef90('0x4d')]);if(!_0x4a72bd[_0xef90('0x4e')]||!_0x374f0c['previousPasswords'])return _0x374f0c;authService[_0xef90('0x4f')](_0x504790[_0xef90('0x33')][_0xef90('0x4d')],_0x374f0c[_0xef90('0x50')],_0x4a72bd[_0xef90('0x4a')]);return _0x374f0c;})[_0xef90('0x13')](function(){_0x374f0c[_0xef90('0x4d')]=_0x504790[_0xef90('0x33')][_0xef90('0x4d')];_0x374f0c['resetPasswordToken']=null;_0x374f0c[_0xef90('0x3a')]=null;return _0x374f0c[_0xef90('0x3b')]();});})[_0xef90('0x13')](function(){_0x1f20f0[_0xef90('0x43')](0xc8)['send']({'message':_0xef90('0x51')});})[_0xef90('0x1b')](function(_0x17a388){return handleError(_0x1f20f0,0x1f4,_0x17a388);});};passport['use'](new LocalStrategy({'usernameField':_0xef90('0xb'),'passwordField':'password'},function(_0x2ba031,_0x1ea04c,_0x33c9d7){return localAuthenticate(db[_0xef90('0x37')],_0x2ba031,_0x1ea04c,_0x33c9d7);})); \ No newline at end of file +var _0x2828=['host','port','secure','authentication','auth','pass','merge','format','\x22%s\x22\x20<%s>','email','SendMail','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','forgot','body','Email\x20parameter\x20is\x20missing','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordToken','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','headers','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','find','token','now','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','resetPasswordExpires','Password\x20reset!','use','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','../../mysqldb','../../config/utils','http','Setting','findOne','allowedLoginAttempts','blockDuration','then','name','password','role','disabled','blocked','loginAttempts','admin','user','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','blockedAt','add','clearBlockUser','minutes','getLicense','catch','MailServerOut','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','Smtp','service'];(function(_0x5b1b64,_0x49796f){var _0x3c4b0b=function(_0xf56bf9){while(--_0xf56bf9){_0x5b1b64['push'](_0x5b1b64['shift']());}};_0x3c4b0b(++_0x49796f);}(_0x2828,0x1dc));var _0x8282=function(_0x4eaf72,_0x306e55){_0x4eaf72=_0x4eaf72-0x0;var _0x595136=_0x2828[_0x4eaf72];return _0x595136;};'use strict';var util=require('util');var passport=require(_0x8282('0x0'));var LocalStrategy=require(_0x8282('0x1'))[_0x8282('0x2')];var jayson=require(_0x8282('0x3'));var _=require(_0x8282('0x4'));var rs=require(_0x8282('0x5'));var moment=require('moment');var db=require(_0x8282('0x6'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x8282('0x7'));var client=jayson['client'][_0x8282('0x8')]({'port':0x232b});function localAuthenticate(_0x214502,_0x6259,_0x775436,_0x1db2d5){var _0x4b06ee,_0x2031ed;return db[_0x8282('0x9')][_0x8282('0xa')]({'where':{'id':0x1},'attributes':[_0x8282('0xb'),_0x8282('0xc')],'raw':!![]})[_0x8282('0xd')](function(_0x2da87a){_0x4b06ee=_0x2da87a;return _0x214502['findOne']({'attributes':['id',_0x8282('0xe'),_0x8282('0xf'),'salt',_0x8282('0x10'),_0x8282('0x11'),_0x8282('0x12'),'blockedAt',_0x8282('0x13')],'where':{'name':_0x6259,'role':{'$or':[_0x8282('0x14'),_0x8282('0x15'),'agent']}}});})['then'](function(_0x3a04b7){if(!_0x3a04b7||_0x3a04b7&&_0x3a04b7[_0x8282('0xe')]!==_0x6259){throw new Error(_0x8282('0x16'));}else{_0x2031ed=_0x3a04b7;return _0x2031ed;}})[_0x8282('0xd')](function(){_0x2031ed[_0x8282('0x17')](_0x775436,function(_0x11c2f7,_0x4e7e84){var _0x271758=_0x2031ed[_0x8282('0x13')]+0x1;if(_0x11c2f7){return _0x1db2d5(_0x11c2f7);}else if(!_0x4e7e84){if(_0x2031ed[_0x8282('0x11')]){return _0x1db2d5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x4b06ee[_0x8282('0xb')]>0x0){if(_0x2031ed[_0x8282('0x12')]){if(_0x4b06ee[_0x8282('0xc')]>0x0){if(moment(_0x2031ed[_0x8282('0x18')])[_0x8282('0x19')](_0x4b06ee[_0x8282('0xc')],'minutes')>moment()){return _0x1db2d5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x2031ed,_0x271758,![],null)['then'](function(){return _0x1db2d5(null,![],{'message':_0x8282('0x16')});});}}else{return _0x1db2d5(null,![],{'message':_0x8282('0x16')});}}else{if(_0x271758>=_0x4b06ee[_0x8282('0xb')]){return utils[_0x8282('0x1a')](_0x2031ed,0x0,!![],moment())['then'](function(){return _0x1db2d5(null,![],{'message':_0x8282('0x16')});});}else{return utils['clearBlockUser'](_0x2031ed,_0x271758,![],null)[_0x8282('0xd')](function(){return _0x1db2d5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}}}else{return _0x1db2d5(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}}else{if(_0x2031ed[_0x8282('0x11')]){return _0x1db2d5(null,![],{'message':_0x8282('0x16')});}else if(_0x4b06ee['allowedLoginAttempts']>0x0){if(_0x2031ed[_0x8282('0x12')]){if(_0x4b06ee[_0x8282('0xc')]>0x0){if(moment(_0x2031ed[_0x8282('0x18')])[_0x8282('0x19')](_0x4b06ee[_0x8282('0xc')],_0x8282('0x1b'))>moment()){return _0x1db2d5(null,![],{'message':_0x8282('0x16')});}else{return utils[_0x8282('0x1a')](_0x2031ed,0x0,![],null)[_0x8282('0xd')](function(){return utils[_0x8282('0x1c')](_0x2031ed);})[_0x8282('0xd')](function(){return _0x1db2d5(null,_0x2031ed);});}}else{return _0x1db2d5(null,![],{'message':_0x8282('0x16')});}}else{return utils[_0x8282('0x1a')](_0x2031ed,0x0,![],null)[_0x8282('0xd')](function(){return utils[_0x8282('0x1c')](_0x2031ed);})['then'](function(){return _0x1db2d5(null,_0x2031ed);})[_0x8282('0x1d')](function(_0x4b0afb){return _0x1db2d5(null,![],_0x4b0afb);});}}else{if(_0x2031ed[_0x8282('0x12')]){return _0x1db2d5(null,![],{'message':_0x8282('0x16')});}else{return utils[_0x8282('0x1c')](_0x2031ed)['then'](function(){return _0x1db2d5(null,_0x2031ed);});}}}});})[_0x8282('0x1d')](function(_0x2f00f3){return _0x1db2d5(null,![],_0x2f00f3);});}function sendServiceMail(_0x866ad6){return db['MailAccount']['find']({'where':{'service':!![]},'attributes':['id',_0x8282('0xe'),'email'],'include':[{'model':db[_0x8282('0x1e')],'as':'Smtp'}]})['then'](function(_0x33e07f){if(!_0x33e07f){throw new Error(_0x8282('0x1f'));}var _0x5999b2={'tls':{'rejectUnauthorized':![]}};if(_0x33e07f[_0x8282('0x20')][_0x8282('0x21')]){_0x5999b2[_0x8282('0x21')]=_0x33e07f[_0x8282('0x20')][_0x8282('0x21')];}else{_0x5999b2[_0x8282('0x22')]=_0x33e07f['Smtp'][_0x8282('0x22')];_0x5999b2[_0x8282('0x23')]=_0x33e07f['Smtp']['port'];_0x5999b2[_0x8282('0x24')]=_0x33e07f[_0x8282('0x20')]['secure'];}if(_0x33e07f['Smtp'][_0x8282('0x25')]){_0x5999b2[_0x8282('0x26')]={'user':_0x33e07f[_0x8282('0x20')][_0x8282('0x15')],'pass':_0x33e07f[_0x8282('0x20')][_0x8282('0x27')]};}var _0x141325={'account':_0x5999b2,'message':_[_0x8282('0x28')]({'from':util[_0x8282('0x29')](_0x8282('0x2a'),_0x33e07f[_0x8282('0xe')],_0x33e07f[_0x8282('0x2b')]||_0x33e07f[_0x8282('0x20')]['user'])},_0x866ad6)};return client['request'](_0x8282('0x2c'),_0x141325);})[_0x8282('0xd')](function(_0x40015f){if(_0x40015f[_0x8282('0x2d')]){throw new Error(util[_0x8282('0x29')](_0x8282('0x2e'),_0x40015f[_0x8282('0x2d')][_0x8282('0x2f')]||JSON[_0x8282('0x30')](_0x40015f[_0x8282('0x2d')])));}return!![];});}function handleError(_0x235724,_0x63a48b,_0x3f1a56){return _0x235724[_0x8282('0x31')](_0x63a48b||0x1f4)[_0x8282('0x32')]({'message':_0x3f1a56?_0x3f1a56[_0x8282('0x2f')]||_0x3f1a56:''});}exports[_0x8282('0x33')]=function(_0x4095bf,_0x8b4e1f,_0xdbcb32){passport[_0x8282('0x17')](_0x8282('0x34'),function(_0x5e966e,_0x25b8bd,_0x15ad66){var _0x5d8e06=_0x5e966e||_0x15ad66;if(_0x5d8e06){return handleError(_0x8b4e1f,0x191,_0x5d8e06);}if(!_0x25b8bd){return handleError(_0x8b4e1f,0x194,{'message':_0x8282('0x35')});}else{var _0x42bf02={'payload':{'id':_0x25b8bd['id'],'role':_0x25b8bd[_0x8282('0x10')]},'options':{'expiresIn':0x15180}};return authService[_0x8282('0x36')](_0x42bf02)[_0x8282('0xd')](function(_0x440b12){_0x8b4e1f['json']({'id':_0x25b8bd['id'],'token':_0x440b12,'statusCall':'','isAlreadyLogged':_0x25b8bd['online']});});}})(_0x4095bf,_0x8b4e1f,_0xdbcb32);};exports[_0x8282('0x37')]=function(_0x172031,_0x2e88e9,_0x46e7cc){if(!_0x172031[_0x8282('0x38')][_0x8282('0x2b')]){return handleError(_0x2e88e9,0x1f4,{'message':_0x8282('0x39')});}var _0x1e0244=rs['generate']();_0x172031[_0x8282('0x38')][_0x8282('0x2b')]=_0x172031[_0x8282('0x38')]['email'][_0x8282('0x3a')]()[_0x8282('0x3b')]();var _0x3e4461;return db[_0x8282('0x9')][_0x8282('0xa')]({'where':{'id':0x1},'attributes':[_0x8282('0xb'),_0x8282('0xc')],'raw':!![]})[_0x8282('0xd')](function(_0x5edace){_0x3e4461=_0x5edace;return db[_0x8282('0x3c')]['find']({'where':{'email':_0x172031['body'][_0x8282('0x2b')]}});})[_0x8282('0xd')](function(_0x15720b){if(!_0x15720b){throw new Error(_0x8282('0x3d'));}if(_0x15720b[_0x8282('0x11')]){throw new Error(_0x8282('0x3e'));}if(_0x15720b['blocked']){if(moment(_0x15720b[_0x8282('0x18')])[_0x8282('0x19')](_0x3e4461[_0x8282('0xc')],_0x8282('0x1b'))>moment()){throw new Error(_0x8282('0x3f'));}else{_0x15720b[_0x8282('0x12')]=![];_0x15720b[_0x8282('0x18')]=null;}}_0x15720b[_0x8282('0x40')]=_0x1e0244;_0x15720b['resetPasswordExpires']=Date['now']()+0x36ee80;return _0x15720b[_0x8282('0x41')]();})[_0x8282('0xd')](function(){return sendServiceMail({'to':_0x172031['body'][_0x8282('0x2b')],'subject':_0x8282('0x42'),'text':_0x8282('0x43')+_0x8282('0x44')+'https://'+_0x172031[_0x8282('0x45')][_0x8282('0x22')]+_0x8282('0x46')+_0x1e0244+'\x0a\x0a'+_0x8282('0x47')});})[_0x8282('0xd')](function(){_0x2e88e9[_0x8282('0x31')](0xc8)[_0x8282('0x32')]({'message':'Reset\x20Email\x20sent!'});})[_0x8282('0x1d')](function(_0x2c9634){return handleError(_0x2e88e9,0x1f4,_0x2c9634);});};exports[_0x8282('0x48')]=function(_0x547283,_0x162eb6,_0x6b6965){return db[_0x8282('0x3c')][_0x8282('0x49')]({'where':{'resetPasswordToken':_0x547283['params'][_0x8282('0x4a')],'resetPasswordExpires':{'$gt':Date[_0x8282('0x4b')]()}}})[_0x8282('0xd')](function(_0x5a3bb7){if(!_0x5a3bb7){throw new Error(_0x8282('0x4c'));}return db[_0x8282('0x9')]['findOne']({'attributes':['id',_0x8282('0x4d'),_0x8282('0x4e'),_0x8282('0x4f')]})[_0x8282('0xd')](function(_0x6339f6){if(_0x6339f6['securePassword'])authService['validatePasswordPattern'](_0x547283[_0x8282('0x38')]['password']);if(!_0x6339f6[_0x8282('0x4e')]||!_0x5a3bb7[_0x8282('0x50')])return _0x5a3bb7;authService[_0x8282('0x51')](_0x547283[_0x8282('0x38')][_0x8282('0xf')],_0x5a3bb7['previousPasswords'],_0x6339f6[_0x8282('0x4f')]);return _0x5a3bb7;})['then'](function(){_0x5a3bb7[_0x8282('0xf')]=_0x547283[_0x8282('0x38')]['password'];_0x5a3bb7[_0x8282('0x40')]=null;_0x5a3bb7[_0x8282('0x52')]=null;return _0x5a3bb7[_0x8282('0x41')]();});})[_0x8282('0xd')](function(){_0x162eb6['status'](0xc8)[_0x8282('0x32')]({'message':_0x8282('0x53')});})[_0x8282('0x1d')](function(_0x59cf3f){return handleError(_0x162eb6,0x1f4,_0x59cf3f);});};passport[_0x8282('0x54')](new LocalStrategy({'usernameField':_0x8282('0xe'),'passwordField':_0x8282('0xf')},function(_0x58e16c,_0x484f69,_0x158007){return localAuthenticate(db['User'],_0x58e16c,_0x484f69,_0x158007);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 6614941..da52361 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 _0x8b28=['Router','./authLocal.controller','post','reset','exports','express'];(function(_0x40d5cc,_0xf9d2c7){var _0x6950af=function(_0x295221){while(--_0x295221){_0x40d5cc['push'](_0x40d5cc['shift']());}};_0x6950af(++_0xf9d2c7);}(_0x8b28,0x149));var _0x88b2=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x8b28[_0x14add3];return _0x4a174f;};'use strict';var express=require(_0x88b2('0x0'));var router=express[_0x88b2('0x1')]();var controller=require(_0x88b2('0x2'));router[_0x88b2('0x3')]('/',controller['login']);router['post']('/forgot',controller['forgot']);router[_0x88b2('0x3')]('/reset/:token',controller[_0x88b2('0x4')]);module[_0x88b2('0x5')]=router; \ No newline at end of file +var _0x814b=['post','/reset/:token','reset','exports','express','./authLocal.controller','/forgot'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x814b,0x74));var _0xb814=function(_0x4052c0,_0x4271ab){_0x4052c0=_0x4052c0-0x0;var _0x296f04=_0x814b[_0x4052c0];return _0x296f04;};'use strict';var express=require(_0xb814('0x0'));var router=express['Router']();var controller=require(_0xb814('0x1'));router['post']('/',controller['login']);router['post'](_0xb814('0x2'),controller['forgot']);router[_0xb814('0x3')](_0xb814('0x4'),controller[_0xb814('0x5')]);module[_0xb814('0x6')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 4a591ed..5f5b224 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 _0xeabd=['exports','STRING','BOOLEAN','INTEGER'];(function(_0x1730da,_0x3fb186){var _0x4f071b=function(_0x432720){while(--_0x432720){_0x1730da['push'](_0x1730da['shift']());}};_0x4f071b(++_0x3fb186);}(_0xeabd,0x100));var _0xdeab=function(_0x501edd,_0x5402ad){_0x501edd=_0x501edd-0x0;var _0x141605=_0xeabd[_0x501edd];return _0x141605;};'use strict';var Sequelize=require('sequelize');module[_0xdeab('0x0')]={'name':{'type':Sequelize[_0xdeab('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xdeab('0x1')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize[_0xdeab('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0xdeab('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0xda75=['STRING','BOOLEAN','INTEGER','sequelize','exports'];(function(_0x20cb20,_0x256051){var _0x2fcf4b=function(_0x26200b){while(--_0x26200b){_0x20cb20['push'](_0x20cb20['shift']());}};_0x2fcf4b(++_0x256051);}(_0xda75,0x17a));var _0x5da7=function(_0x2e3efc,_0x2b26c2){_0x2e3efc=_0x2e3efc-0x0;var _0x275be1=_0xda75[_0x2e3efc];return _0x275be1;};'use strict';var Sequelize=require(_0x5da7('0x0'));module[_0x5da7('0x1')]={'name':{'type':Sequelize[_0x5da7('0x2')],'allowNull':![]},'channel':{'type':Sequelize[_0x5da7('0x2')]},'description':{'type':Sequelize[_0x5da7('0x2')]},'status':{'type':Sequelize[_0x5da7('0x3')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x5da7('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 f3ea813..6db00b2 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 _0xf64d=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','set','destroy','error','stack','name','send','index','map','Automation','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','then','includeAll','include','rows','catch','show','params','keys','length','options','find','body','update','Condition','omit','ids','getConditions','findOne','addActions','getActions','Action','nolimit','eml-format','rimraf'];(function(_0x4b7ea4,_0x43875d){var _0x5578b6=function(_0x4fbd5e){while(--_0x4fbd5e){_0x4b7ea4['push'](_0x4b7ea4['shift']());}};_0x5578b6(++_0x43875d);}(_0xf64d,0x14e));var _0xdf64=function(_0x585221,_0xb7e318){_0x585221=_0x585221-0x0;var _0x17111b=_0xf64d[_0x585221];return _0x17111b;};'use strict';var emlformat=require(_0xdf64('0x0'));var rimraf=require(_0xdf64('0x1'));var zipdir=require(_0xdf64('0x2'));var jsonpatch=require(_0xdf64('0x3'));var rp=require(_0xdf64('0x4'));var moment=require(_0xdf64('0x5'));var BPromise=require(_0xdf64('0x6'));var Mustache=require(_0xdf64('0x7'));var util=require(_0xdf64('0x8'));var path=require(_0xdf64('0x9'));var sox=require('sox');var csv=require(_0xdf64('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xdf64('0xb'));var _=require(_0xdf64('0xc'));var squel=require('squel');var crypto=require(_0xdf64('0xd'));var jsforce=require(_0xdf64('0xe'));var deskjs=require(_0xdf64('0xf'));var toCsv=require(_0xdf64('0xa'));var querystring=require(_0xdf64('0x10'));var Papa=require(_0xdf64('0x11'));var Redis=require(_0xdf64('0x12'));var authService=require(_0xdf64('0x13'));var qs=require(_0xdf64('0x14'));var as=require(_0xdf64('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf64('0x16'))(_0xdf64('0x17'));var utils=require(_0xdf64('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xdf64('0x19'));var db=require(_0xdf64('0x1a'))['db'];function respondWithStatusCode(_0x5d29c6,_0xcce89b){_0xcce89b=_0xcce89b||0xcc;return function(_0x332c81){if(_0x332c81){return _0x5d29c6[_0xdf64('0x1b')](_0xcce89b);}return _0x5d29c6[_0xdf64('0x1c')](_0xcce89b)[_0xdf64('0x1d')]();};}function respondWithResult(_0x5e1044,_0x4b819e){_0x4b819e=_0x4b819e||0xc8;return function(_0x5dcc34){if(_0x5dcc34){return _0x5e1044['status'](_0x4b819e)[_0xdf64('0x1e')](_0x5dcc34);}};}function respondWithFilteredResult(_0x9ce9a1,_0x804969){return function(_0x58ae0e){if(_0x58ae0e){var _0xc4fb78=typeof _0x804969[_0xdf64('0x1f')]===_0xdf64('0x20')&&typeof _0x804969[_0xdf64('0x21')]==='undefined';var _0xf414c8=_0x58ae0e[_0xdf64('0x22')];var _0x14deaa=_0xc4fb78?0x0:_0x804969[_0xdf64('0x1f')];var _0x433f5f=_0xc4fb78?_0x58ae0e[_0xdf64('0x22')]:_0x804969[_0xdf64('0x1f')]+_0x804969[_0xdf64('0x21')];var _0xd419d2;if(_0x433f5f>=_0xf414c8){_0x433f5f=_0xf414c8;_0xd419d2=0xc8;}else{_0xd419d2=0xce;}_0x9ce9a1[_0xdf64('0x1c')](_0xd419d2);return _0x9ce9a1[_0xdf64('0x23')]('Content-Range',_0x14deaa+'-'+_0x433f5f+'/'+_0xf414c8)[_0xdf64('0x1e')](_0x58ae0e);}return null;};}function patchUpdates(_0x573a4c){return function(_0x2e41d5){try{jsonpatch['apply'](_0x2e41d5,_0x573a4c,!![]);}catch(_0x44da01){return BPromise['reject'](_0x44da01);}return _0x2e41d5['save']();};}function saveUpdates(_0x453fa0,_0x48616b){return function(_0x59b780){if(_0x59b780){return _0x59b780['update'](_0x453fa0)['then'](function(_0x534078){return _0x534078;});}return null;};}function removeEntity(_0x5bc348,_0x428f94){return function(_0x1bda26){if(_0x1bda26){return _0x1bda26[_0xdf64('0x24')]()['then'](function(){_0x5bc348['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f776d,_0x123f26){return function(_0x3ed04a){if(!_0x3ed04a){_0x4f776d['sendStatus'](0x194);}return _0x3ed04a;};}function handleError(_0x9d8333,_0x400c41){_0x400c41=_0x400c41||0x1f4;return function(_0x528976){logger[_0xdf64('0x25')](_0x528976[_0xdf64('0x26')]);if(_0x528976[_0xdf64('0x27')]){delete _0x528976[_0xdf64('0x27')];}_0x9d8333[_0xdf64('0x1c')](_0x400c41)[_0xdf64('0x28')](_0x528976);};}exports[_0xdf64('0x29')]=function(_0x3dc8ac,_0x34a235){var _0x1bd96d={},_0x5b94dc={},_0x1e622e={'count':0x0,'rows':[]};var _0x4e9ddc=_[_0xdf64('0x2a')](db[_0xdf64('0x2b')][_0xdf64('0x2c')],function(_0x34d127){return{'name':_0x34d127[_0xdf64('0x2d')],'type':_0x34d127[_0xdf64('0x2e')][_0xdf64('0x2f')]};});_0x5b94dc[_0xdf64('0x30')]=_['map'](_0x4e9ddc,_0xdf64('0x27'));_0x5b94dc[_0xdf64('0x31')]=_['keys'](_0x3dc8ac['query']);_0x5b94dc[_0xdf64('0x32')]=_['intersection'](_0x5b94dc['model'],_0x5b94dc[_0xdf64('0x31')]);_0x1bd96d['attributes']=_[_0xdf64('0x33')](_0x5b94dc[_0xdf64('0x30')],qs[_0xdf64('0x34')](_0x3dc8ac['query'][_0xdf64('0x34')]));_0x1bd96d[_0xdf64('0x35')]=_0x1bd96d[_0xdf64('0x35')]['length']?_0x1bd96d[_0xdf64('0x35')]:_0x5b94dc[_0xdf64('0x30')];if(!_0x3dc8ac['query'][_0xdf64('0x36')]('nolimit')){_0x1bd96d[_0xdf64('0x21')]=qs[_0xdf64('0x21')](_0x3dc8ac[_0xdf64('0x31')][_0xdf64('0x21')]);_0x1bd96d['offset']=qs['offset'](_0x3dc8ac['query'][_0xdf64('0x1f')]);}_0x1bd96d[_0xdf64('0x37')]=qs['sort'](_0x3dc8ac[_0xdf64('0x31')][_0xdf64('0x38')]);_0x1bd96d[_0xdf64('0x39')]=qs['filters'](_[_0xdf64('0x3a')](_0x3dc8ac['query'],_0x5b94dc[_0xdf64('0x32')]),_0x4e9ddc);if(_0x3dc8ac[_0xdf64('0x31')][_0xdf64('0x3b')]){_0x1bd96d[_0xdf64('0x39')]=_[_0xdf64('0x3c')](_0x1bd96d[_0xdf64('0x39')],{'$or':_[_0xdf64('0x2a')](_0x4e9ddc,function(_0x2ea94b){if(_0x2ea94b['type']!==_0xdf64('0x3d')){var _0x43b906={};_0x43b906[_0x2ea94b[_0xdf64('0x27')]]={'$like':'%'+_0x3dc8ac['query'][_0xdf64('0x3b')]+'%'};return _0x43b906;}})});}_0x1bd96d=_[_0xdf64('0x3c')]({},_0x1bd96d,_0x3dc8ac['options']);var _0x2b504a={'where':_0x1bd96d[_0xdf64('0x39')]};return db[_0xdf64('0x2b')]['count'](_0x2b504a)[_0xdf64('0x3e')](function(_0x5295bc){_0x1e622e[_0xdf64('0x22')]=_0x5295bc;if(_0x3dc8ac['query'][_0xdf64('0x3f')]){_0x1bd96d[_0xdf64('0x40')]=[{'all':!![]}];}return db['Automation']['findAll'](_0x1bd96d);})[_0xdf64('0x3e')](function(_0x41c888){_0x1e622e[_0xdf64('0x41')]=_0x41c888;return _0x1e622e;})[_0xdf64('0x3e')](respondWithFilteredResult(_0x34a235,_0x1bd96d))[_0xdf64('0x42')](handleError(_0x34a235,null));};exports[_0xdf64('0x43')]=function(_0x4218d1,_0x55a47d){var _0x2c2bf3={'raw':![],'where':{'id':_0x4218d1[_0xdf64('0x44')]['id']}},_0x4479a7={};_0x4479a7[_0xdf64('0x30')]=_[_0xdf64('0x45')](db['Automation'][_0xdf64('0x2c')]);_0x4479a7[_0xdf64('0x31')]=_[_0xdf64('0x45')](_0x4218d1[_0xdf64('0x31')]);_0x4479a7[_0xdf64('0x32')]=_[_0xdf64('0x33')](_0x4479a7[_0xdf64('0x30')],_0x4479a7[_0xdf64('0x31')]);_0x2c2bf3[_0xdf64('0x35')]=_[_0xdf64('0x33')](_0x4479a7[_0xdf64('0x30')],qs[_0xdf64('0x34')](_0x4218d1[_0xdf64('0x31')][_0xdf64('0x34')]));_0x2c2bf3[_0xdf64('0x35')]=_0x2c2bf3['attributes'][_0xdf64('0x46')]?_0x2c2bf3[_0xdf64('0x35')]:_0x4479a7['model'];if(_0x4218d1['query'][_0xdf64('0x3f')]){_0x2c2bf3[_0xdf64('0x40')]=[{'all':!![]}];}_0x2c2bf3=_['merge']({},_0x2c2bf3,_0x4218d1[_0xdf64('0x47')]);return db['Automation'][_0xdf64('0x48')](_0x2c2bf3)['then'](handleEntityNotFound(_0x55a47d,null))[_0xdf64('0x3e')](respondWithResult(_0x55a47d,null))[_0xdf64('0x42')](handleError(_0x55a47d,null));};exports['create']=function(_0x7ac0c6,_0x30ac62){return db[_0xdf64('0x2b')]['create'](_0x7ac0c6[_0xdf64('0x49')],{})[_0xdf64('0x3e')](respondWithResult(_0x30ac62,0xc9))[_0xdf64('0x42')](handleError(_0x30ac62,null));};exports[_0xdf64('0x4a')]=function(_0x319b88,_0x325b42){if(_0x319b88[_0xdf64('0x49')]['id']){delete _0x319b88[_0xdf64('0x49')]['id'];}return db[_0xdf64('0x2b')][_0xdf64('0x48')]({'where':{'id':_0x319b88[_0xdf64('0x44')]['id']}})[_0xdf64('0x3e')](handleEntityNotFound(_0x325b42,null))[_0xdf64('0x3e')](saveUpdates(_0x319b88[_0xdf64('0x49')],null))[_0xdf64('0x3e')](respondWithResult(_0x325b42,null))['catch'](handleError(_0x325b42,null));};exports[_0xdf64('0x24')]=function(_0x272af6,_0x27b96d){return db[_0xdf64('0x2b')][_0xdf64('0x48')]({'where':{'id':_0x272af6[_0xdf64('0x44')]['id']}})[_0xdf64('0x3e')](handleEntityNotFound(_0x27b96d,null))[_0xdf64('0x3e')](removeEntity(_0x27b96d,null))['catch'](handleError(_0x27b96d,null));};exports['addConditions']=function(_0x39602c,_0x108871,_0x2e28fc){return db[_0xdf64('0x4b')][_0xdf64('0x48')]({'where':{'id':_0x39602c[_0xdf64('0x44')]['id']}})[_0xdf64('0x3e')](handleEntityNotFound(_0x108871,null))[_0xdf64('0x3e')](function(_0x5374b2){if(_0x5374b2){return _0x5374b2['addConditions'](_0x39602c[_0xdf64('0x49')]['ids'],_[_0xdf64('0x4c')](_0x39602c['body'],[_0xdf64('0x4d'),'id'])||{});}})[_0xdf64('0x3e')](respondWithResult(_0x108871,null))['catch'](handleError(_0x108871,null));};exports[_0xdf64('0x4e')]=function(_0x588753,_0x5edb11,_0x34575e){var _0xa7fee3={};var _0x1bda7d={};var _0xa440b2;var _0x50acfb;return db['Automation'][_0xdf64('0x4f')]({'where':{'id':_0x588753['params']['id']}})[_0xdf64('0x3e')](handleEntityNotFound(_0x5edb11,null))[_0xdf64('0x3e')](function(_0x430a4f){if(_0x430a4f){_0xa440b2=_0x430a4f;_0x1bda7d[_0xdf64('0x30')]=_[_0xdf64('0x45')](db['Condition'][_0xdf64('0x2c')]);_0x1bda7d[_0xdf64('0x31')]=_[_0xdf64('0x45')](_0x588753['query']);_0x1bda7d[_0xdf64('0x32')]=_[_0xdf64('0x33')](_0x1bda7d['model'],_0x1bda7d['query']);_0xa7fee3[_0xdf64('0x35')]=_['intersection'](_0x1bda7d['model'],qs[_0xdf64('0x34')](_0x588753[_0xdf64('0x31')][_0xdf64('0x34')]));_0xa7fee3[_0xdf64('0x35')]=_0xa7fee3[_0xdf64('0x35')][_0xdf64('0x46')]?_0xa7fee3[_0xdf64('0x35')]:_0x1bda7d[_0xdf64('0x30')];_0xa7fee3[_0xdf64('0x37')]=qs[_0xdf64('0x38')](_0x588753[_0xdf64('0x31')][_0xdf64('0x38')]);_0xa7fee3['where']=qs[_0xdf64('0x32')](_[_0xdf64('0x3a')](_0x588753[_0xdf64('0x31')],_0x1bda7d[_0xdf64('0x32')]));if(_0x588753[_0xdf64('0x31')][_0xdf64('0x3b')]){_0xa7fee3[_0xdf64('0x39')]=_[_0xdf64('0x3c')](_0xa7fee3[_0xdf64('0x39')],{'$or':_[_0xdf64('0x2a')](_0xa7fee3[_0xdf64('0x35')],function(_0x1c80d4){var _0x6216bb={};_0x6216bb[_0x1c80d4]={'$like':'%'+_0x588753[_0xdf64('0x31')][_0xdf64('0x3b')]+'%'};return _0x6216bb;})});}_0xa7fee3=_['merge']({},_0xa7fee3,_0x588753[_0xdf64('0x47')]);return _0xa440b2[_0xdf64('0x4e')](_0xa7fee3);}})[_0xdf64('0x3e')](function(_0x11982a){if(_0x11982a){_0x50acfb=_0x11982a[_0xdf64('0x46')];if(!_0x588753['query'][_0xdf64('0x36')]('nolimit')){_0xa7fee3[_0xdf64('0x21')]=qs['limit'](_0x588753[_0xdf64('0x31')]['limit']);_0xa7fee3[_0xdf64('0x1f')]=qs[_0xdf64('0x1f')](_0x588753[_0xdf64('0x31')][_0xdf64('0x1f')]);}return _0xa440b2[_0xdf64('0x4e')](_0xa7fee3);}})[_0xdf64('0x3e')](function(_0x439319){if(_0x439319){return _0x439319?{'count':_0x50acfb,'rows':_0x439319}:null;}})[_0xdf64('0x3e')](respondWithResult(_0x5edb11,null))[_0xdf64('0x42')](handleError(_0x5edb11,null));};exports['addActions']=function(_0x59eef9,_0xa40ec6,_0x5482fe){return db['Action'][_0xdf64('0x48')]({'where':{'id':_0x59eef9[_0xdf64('0x44')]['id']}})[_0xdf64('0x3e')](handleEntityNotFound(_0xa40ec6,null))['then'](function(_0xf88c18){if(_0xf88c18){return _0xf88c18[_0xdf64('0x50')](_0x59eef9[_0xdf64('0x49')]['ids'],_['omit'](_0x59eef9[_0xdf64('0x49')],[_0xdf64('0x4d'),'id'])||{});}})['then'](respondWithResult(_0xa40ec6,null))[_0xdf64('0x42')](handleError(_0xa40ec6,null));};exports[_0xdf64('0x51')]=function(_0x534443,_0x567fe9,_0x28afa8){var _0x121766={};var _0x775d1c={};var _0x495896;var _0x24529b;return db['Automation'][_0xdf64('0x4f')]({'where':{'id':_0x534443[_0xdf64('0x44')]['id']}})[_0xdf64('0x3e')](handleEntityNotFound(_0x567fe9,null))[_0xdf64('0x3e')](function(_0x1f153d){if(_0x1f153d){_0x495896=_0x1f153d;_0x775d1c[_0xdf64('0x30')]=_[_0xdf64('0x45')](db[_0xdf64('0x52')]['rawAttributes']);_0x775d1c['query']=_[_0xdf64('0x45')](_0x534443[_0xdf64('0x31')]);_0x775d1c['filters']=_[_0xdf64('0x33')](_0x775d1c['model'],_0x775d1c[_0xdf64('0x31')]);_0x121766[_0xdf64('0x35')]=_['intersection'](_0x775d1c[_0xdf64('0x30')],qs[_0xdf64('0x34')](_0x534443[_0xdf64('0x31')]['fields']));_0x121766['attributes']=_0x121766['attributes'][_0xdf64('0x46')]?_0x121766[_0xdf64('0x35')]:_0x775d1c[_0xdf64('0x30')];_0x121766[_0xdf64('0x37')]=qs[_0xdf64('0x38')](_0x534443[_0xdf64('0x31')]['sort']);_0x121766[_0xdf64('0x39')]=qs[_0xdf64('0x32')](_['pick'](_0x534443[_0xdf64('0x31')],_0x775d1c['filters']));if(_0x534443[_0xdf64('0x31')][_0xdf64('0x3b')]){_0x121766[_0xdf64('0x39')]=_['merge'](_0x121766['where'],{'$or':_[_0xdf64('0x2a')](_0x121766[_0xdf64('0x35')],function(_0x8c74ed){var _0xde532e={};_0xde532e[_0x8c74ed]={'$like':'%'+_0x534443[_0xdf64('0x31')]['filter']+'%'};return _0xde532e;})});}_0x121766=_[_0xdf64('0x3c')]({},_0x121766,_0x534443[_0xdf64('0x47')]);return _0x495896['getActions'](_0x121766);}})['then'](function(_0x3fc557){if(_0x3fc557){_0x24529b=_0x3fc557[_0xdf64('0x46')];if(!_0x534443[_0xdf64('0x31')][_0xdf64('0x36')](_0xdf64('0x53'))){_0x121766['limit']=qs['limit'](_0x534443[_0xdf64('0x31')]['limit']);_0x121766[_0xdf64('0x1f')]=qs['offset'](_0x534443[_0xdf64('0x31')][_0xdf64('0x1f')]);}return _0x495896['getActions'](_0x121766);}})[_0xdf64('0x3e')](function(_0xe80bfa){if(_0xe80bfa){return _0xe80bfa?{'count':_0x24529b,'rows':_0xe80bfa}:null;}})['then'](respondWithResult(_0x567fe9,null))[_0xdf64('0x42')](handleError(_0x567fe9,null));}; \ No newline at end of file +var _0xc1d3=['rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','merge','filter','options','Automation','count','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','addConditions','Condition','ids','findOne','order','getConditions','hasOwnProperty','addActions','Action','omit','getActions','eml-format','fast-json-patch','request-promise','util','path','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','Content-Range','json','apply','save','then','destroy','error','name','send'];(function(_0x37c925,_0x2ee082){var _0xa19ebc=function(_0xd820e0){while(--_0xd820e0){_0x37c925['push'](_0x37c925['shift']());}};_0xa19ebc(++_0x2ee082);}(_0xc1d3,0x11a));var _0x3c1d=function(_0x561c94,_0x26879d){_0x561c94=_0x561c94-0x0;var _0x1ffdf9=_0xc1d3[_0x561c94];return _0x1ffdf9;};'use strict';var emlformat=require(_0x3c1d('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x3c1d('0x1'));var rp=require(_0x3c1d('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x3c1d('0x3'));var path=require(_0x3c1d('0x4'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x3c1d('0x5'));var fs=require('fs');var fs_extra=require(_0x3c1d('0x6'));var _=require(_0x3c1d('0x7'));var squel=require(_0x3c1d('0x8'));var crypto=require(_0x3c1d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x3c1d('0xa'));var toCsv=require(_0x3c1d('0xb'));var querystring=require(_0x3c1d('0xc'));var Papa=require(_0x3c1d('0xd'));var Redis=require('ioredis');var authService=require(_0x3c1d('0xe'));var qs=require(_0x3c1d('0xf'));var as=require(_0x3c1d('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3c1d('0x11'))('api');var utils=require(_0x3c1d('0x12'));var config=require(_0x3c1d('0x13'));var licenseUtil=require(_0x3c1d('0x14'));var db=require(_0x3c1d('0x15'))['db'];function respondWithStatusCode(_0x1ac4a6,_0x544d13){_0x544d13=_0x544d13||0xcc;return function(_0x1bb519){if(_0x1bb519){return _0x1ac4a6[_0x3c1d('0x16')](_0x544d13);}return _0x1ac4a6[_0x3c1d('0x17')](_0x544d13)[_0x3c1d('0x18')]();};}function respondWithResult(_0x33dd51,_0x4bf55b){_0x4bf55b=_0x4bf55b||0xc8;return function(_0x5778f8){if(_0x5778f8){return _0x33dd51['status'](_0x4bf55b)['json'](_0x5778f8);}};}function respondWithFilteredResult(_0x4fd029,_0x406367){return function(_0x370e8a){if(_0x370e8a){var _0x2b4d49=typeof _0x406367[_0x3c1d('0x19')]===_0x3c1d('0x1a')&&typeof _0x406367[_0x3c1d('0x1b')]===_0x3c1d('0x1a');var _0x1a82a1=_0x370e8a['count'];var _0x1f4fdc=_0x2b4d49?0x0:_0x406367[_0x3c1d('0x19')];var _0x353c6f=_0x2b4d49?_0x370e8a['count']:_0x406367[_0x3c1d('0x19')]+_0x406367['limit'];var _0x40c40f;if(_0x353c6f>=_0x1a82a1){_0x353c6f=_0x1a82a1;_0x40c40f=0xc8;}else{_0x40c40f=0xce;}_0x4fd029['status'](_0x40c40f);return _0x4fd029[_0x3c1d('0x1c')](_0x3c1d('0x1d'),_0x1f4fdc+'-'+_0x353c6f+'/'+_0x1a82a1)[_0x3c1d('0x1e')](_0x370e8a);}return null;};}function patchUpdates(_0x31a17d){return function(_0x188f7f){try{jsonpatch[_0x3c1d('0x1f')](_0x188f7f,_0x31a17d,!![]);}catch(_0x5ee0c1){return BPromise['reject'](_0x5ee0c1);}return _0x188f7f[_0x3c1d('0x20')]();};}function saveUpdates(_0x855e86,_0x57becd){return function(_0x5ba9b0){if(_0x5ba9b0){return _0x5ba9b0['update'](_0x855e86)[_0x3c1d('0x21')](function(_0xa36771){return _0xa36771;});}return null;};}function removeEntity(_0xcc3135,_0x4e91be){return function(_0x1db316){if(_0x1db316){return _0x1db316[_0x3c1d('0x22')]()['then'](function(){_0xcc3135[_0x3c1d('0x17')](0xcc)[_0x3c1d('0x18')]();});}};}function handleEntityNotFound(_0x97ab32,_0x1b0acd){return function(_0x1cb804){if(!_0x1cb804){_0x97ab32['sendStatus'](0x194);}return _0x1cb804;};}function handleError(_0x2d475d,_0x17e363){_0x17e363=_0x17e363||0x1f4;return function(_0x38f4ac){logger[_0x3c1d('0x23')](_0x38f4ac['stack']);if(_0x38f4ac['name']){delete _0x38f4ac[_0x3c1d('0x24')];}_0x2d475d[_0x3c1d('0x17')](_0x17e363)[_0x3c1d('0x25')](_0x38f4ac);};}exports['index']=function(_0x48f872,_0x57dd15){var _0x110de8={},_0x4e648d={},_0x4c3a09={'count':0x0,'rows':[]};var _0x412984=_['map'](db['Automation'][_0x3c1d('0x26')],function(_0x484b74){return{'name':_0x484b74[_0x3c1d('0x27')],'type':_0x484b74[_0x3c1d('0x28')]['key']};});_0x4e648d[_0x3c1d('0x29')]=_[_0x3c1d('0x2a')](_0x412984,_0x3c1d('0x24'));_0x4e648d[_0x3c1d('0x2b')]=_[_0x3c1d('0x2c')](_0x48f872[_0x3c1d('0x2b')]);_0x4e648d[_0x3c1d('0x2d')]=_[_0x3c1d('0x2e')](_0x4e648d[_0x3c1d('0x29')],_0x4e648d['query']);_0x110de8['attributes']=_[_0x3c1d('0x2e')](_0x4e648d['model'],qs[_0x3c1d('0x2f')](_0x48f872[_0x3c1d('0x2b')][_0x3c1d('0x2f')]));_0x110de8[_0x3c1d('0x30')]=_0x110de8[_0x3c1d('0x30')]['length']?_0x110de8[_0x3c1d('0x30')]:_0x4e648d[_0x3c1d('0x29')];if(!_0x48f872['query']['hasOwnProperty'](_0x3c1d('0x31'))){_0x110de8[_0x3c1d('0x1b')]=qs[_0x3c1d('0x1b')](_0x48f872['query'][_0x3c1d('0x1b')]);_0x110de8['offset']=qs[_0x3c1d('0x19')](_0x48f872[_0x3c1d('0x2b')][_0x3c1d('0x19')]);}_0x110de8['order']=qs[_0x3c1d('0x32')](_0x48f872['query']['sort']);_0x110de8[_0x3c1d('0x33')]=qs['filters'](_[_0x3c1d('0x34')](_0x48f872[_0x3c1d('0x2b')],_0x4e648d['filters']),_0x412984);if(_0x48f872['query']['filter']){_0x110de8[_0x3c1d('0x33')]=_[_0x3c1d('0x35')](_0x110de8[_0x3c1d('0x33')],{'$or':_[_0x3c1d('0x2a')](_0x412984,function(_0x1fdad9){if(_0x1fdad9[_0x3c1d('0x28')]!=='VIRTUAL'){var _0xedae48={};_0xedae48[_0x1fdad9[_0x3c1d('0x24')]]={'$like':'%'+_0x48f872[_0x3c1d('0x2b')][_0x3c1d('0x36')]+'%'};return _0xedae48;}})});}_0x110de8=_['merge']({},_0x110de8,_0x48f872[_0x3c1d('0x37')]);var _0x169dd6={'where':_0x110de8[_0x3c1d('0x33')]};return db[_0x3c1d('0x38')][_0x3c1d('0x39')](_0x169dd6)['then'](function(_0x6259cc){_0x4c3a09[_0x3c1d('0x39')]=_0x6259cc;if(_0x48f872[_0x3c1d('0x2b')][_0x3c1d('0x3a')]){_0x110de8[_0x3c1d('0x3b')]=[{'all':!![]}];}return db[_0x3c1d('0x38')][_0x3c1d('0x3c')](_0x110de8);})[_0x3c1d('0x21')](function(_0x419227){_0x4c3a09[_0x3c1d('0x3d')]=_0x419227;return _0x4c3a09;})[_0x3c1d('0x21')](respondWithFilteredResult(_0x57dd15,_0x110de8))[_0x3c1d('0x3e')](handleError(_0x57dd15,null));};exports[_0x3c1d('0x3f')]=function(_0x546a92,_0x27d20d){var _0xe7234c={'raw':![],'where':{'id':_0x546a92[_0x3c1d('0x40')]['id']}},_0x15a9c8={};_0x15a9c8[_0x3c1d('0x29')]=_[_0x3c1d('0x2c')](db[_0x3c1d('0x38')][_0x3c1d('0x26')]);_0x15a9c8[_0x3c1d('0x2b')]=_['keys'](_0x546a92[_0x3c1d('0x2b')]);_0x15a9c8[_0x3c1d('0x2d')]=_[_0x3c1d('0x2e')](_0x15a9c8['model'],_0x15a9c8['query']);_0xe7234c[_0x3c1d('0x30')]=_['intersection'](_0x15a9c8['model'],qs[_0x3c1d('0x2f')](_0x546a92[_0x3c1d('0x2b')][_0x3c1d('0x2f')]));_0xe7234c[_0x3c1d('0x30')]=_0xe7234c[_0x3c1d('0x30')][_0x3c1d('0x41')]?_0xe7234c[_0x3c1d('0x30')]:_0x15a9c8[_0x3c1d('0x29')];if(_0x546a92[_0x3c1d('0x2b')][_0x3c1d('0x3a')]){_0xe7234c['include']=[{'all':!![]}];}_0xe7234c=_[_0x3c1d('0x35')]({},_0xe7234c,_0x546a92[_0x3c1d('0x37')]);return db[_0x3c1d('0x38')][_0x3c1d('0x42')](_0xe7234c)['then'](handleEntityNotFound(_0x27d20d,null))[_0x3c1d('0x21')](respondWithResult(_0x27d20d,null))[_0x3c1d('0x3e')](handleError(_0x27d20d,null));};exports[_0x3c1d('0x43')]=function(_0x1de339,_0x57a297){return db[_0x3c1d('0x38')][_0x3c1d('0x43')](_0x1de339[_0x3c1d('0x44')],{})[_0x3c1d('0x21')](respondWithResult(_0x57a297,0xc9))[_0x3c1d('0x3e')](handleError(_0x57a297,null));};exports['update']=function(_0x3dbb2b,_0xff5a0){if(_0x3dbb2b['body']['id']){delete _0x3dbb2b[_0x3c1d('0x44')]['id'];}return db[_0x3c1d('0x38')][_0x3c1d('0x42')]({'where':{'id':_0x3dbb2b[_0x3c1d('0x40')]['id']}})[_0x3c1d('0x21')](handleEntityNotFound(_0xff5a0,null))[_0x3c1d('0x21')](saveUpdates(_0x3dbb2b[_0x3c1d('0x44')],null))['then'](respondWithResult(_0xff5a0,null))[_0x3c1d('0x3e')](handleError(_0xff5a0,null));};exports[_0x3c1d('0x22')]=function(_0x2b1954,_0x1d24c5){return db[_0x3c1d('0x38')][_0x3c1d('0x42')]({'where':{'id':_0x2b1954[_0x3c1d('0x40')]['id']}})[_0x3c1d('0x21')](handleEntityNotFound(_0x1d24c5,null))[_0x3c1d('0x21')](removeEntity(_0x1d24c5,null))[_0x3c1d('0x3e')](handleError(_0x1d24c5,null));};exports[_0x3c1d('0x45')]=function(_0x747459,_0x29cd44,_0xcd9b1f){return db[_0x3c1d('0x46')][_0x3c1d('0x42')]({'where':{'id':_0x747459['params']['id']}})['then'](handleEntityNotFound(_0x29cd44,null))[_0x3c1d('0x21')](function(_0x4470b5){if(_0x4470b5){return _0x4470b5[_0x3c1d('0x45')](_0x747459[_0x3c1d('0x44')][_0x3c1d('0x47')],_['omit'](_0x747459[_0x3c1d('0x44')],[_0x3c1d('0x47'),'id'])||{});}})['then'](respondWithResult(_0x29cd44,null))[_0x3c1d('0x3e')](handleError(_0x29cd44,null));};exports['getConditions']=function(_0x291baf,_0x5da6f2,_0x5a9b1f){var _0xe816af={};var _0x41cf83={};var _0x3e2c1d;var _0x36cdcf;return db[_0x3c1d('0x38')][_0x3c1d('0x48')]({'where':{'id':_0x291baf[_0x3c1d('0x40')]['id']}})[_0x3c1d('0x21')](handleEntityNotFound(_0x5da6f2,null))[_0x3c1d('0x21')](function(_0x503cf3){if(_0x503cf3){_0x3e2c1d=_0x503cf3;_0x41cf83[_0x3c1d('0x29')]=_[_0x3c1d('0x2c')](db[_0x3c1d('0x46')][_0x3c1d('0x26')]);_0x41cf83[_0x3c1d('0x2b')]=_[_0x3c1d('0x2c')](_0x291baf['query']);_0x41cf83[_0x3c1d('0x2d')]=_[_0x3c1d('0x2e')](_0x41cf83[_0x3c1d('0x29')],_0x41cf83[_0x3c1d('0x2b')]);_0xe816af[_0x3c1d('0x30')]=_[_0x3c1d('0x2e')](_0x41cf83[_0x3c1d('0x29')],qs['fields'](_0x291baf[_0x3c1d('0x2b')][_0x3c1d('0x2f')]));_0xe816af['attributes']=_0xe816af[_0x3c1d('0x30')][_0x3c1d('0x41')]?_0xe816af[_0x3c1d('0x30')]:_0x41cf83[_0x3c1d('0x29')];_0xe816af[_0x3c1d('0x49')]=qs[_0x3c1d('0x32')](_0x291baf[_0x3c1d('0x2b')][_0x3c1d('0x32')]);_0xe816af[_0x3c1d('0x33')]=qs[_0x3c1d('0x2d')](_[_0x3c1d('0x34')](_0x291baf['query'],_0x41cf83[_0x3c1d('0x2d')]));if(_0x291baf['query'][_0x3c1d('0x36')]){_0xe816af[_0x3c1d('0x33')]=_['merge'](_0xe816af[_0x3c1d('0x33')],{'$or':_['map'](_0xe816af[_0x3c1d('0x30')],function(_0x200199){var _0x17fcf8={};_0x17fcf8[_0x200199]={'$like':'%'+_0x291baf[_0x3c1d('0x2b')][_0x3c1d('0x36')]+'%'};return _0x17fcf8;})});}_0xe816af=_[_0x3c1d('0x35')]({},_0xe816af,_0x291baf[_0x3c1d('0x37')]);return _0x3e2c1d[_0x3c1d('0x4a')](_0xe816af);}})['then'](function(_0x394bfb){if(_0x394bfb){_0x36cdcf=_0x394bfb[_0x3c1d('0x41')];if(!_0x291baf[_0x3c1d('0x2b')][_0x3c1d('0x4b')]('nolimit')){_0xe816af[_0x3c1d('0x1b')]=qs[_0x3c1d('0x1b')](_0x291baf[_0x3c1d('0x2b')][_0x3c1d('0x1b')]);_0xe816af['offset']=qs[_0x3c1d('0x19')](_0x291baf[_0x3c1d('0x2b')][_0x3c1d('0x19')]);}return _0x3e2c1d[_0x3c1d('0x4a')](_0xe816af);}})[_0x3c1d('0x21')](function(_0x1cf3a6){if(_0x1cf3a6){return _0x1cf3a6?{'count':_0x36cdcf,'rows':_0x1cf3a6}:null;}})[_0x3c1d('0x21')](respondWithResult(_0x5da6f2,null))['catch'](handleError(_0x5da6f2,null));};exports[_0x3c1d('0x4c')]=function(_0x2dfafb,_0x4651e1,_0x451a8c){return db[_0x3c1d('0x4d')][_0x3c1d('0x42')]({'where':{'id':_0x2dfafb[_0x3c1d('0x40')]['id']}})['then'](handleEntityNotFound(_0x4651e1,null))[_0x3c1d('0x21')](function(_0xd0c0d5){if(_0xd0c0d5){return _0xd0c0d5[_0x3c1d('0x4c')](_0x2dfafb[_0x3c1d('0x44')]['ids'],_[_0x3c1d('0x4e')](_0x2dfafb['body'],['ids','id'])||{});}})[_0x3c1d('0x21')](respondWithResult(_0x4651e1,null))[_0x3c1d('0x3e')](handleError(_0x4651e1,null));};exports[_0x3c1d('0x4f')]=function(_0x45d24e,_0x1421f4,_0x5c9580){var _0x22e865={};var _0x55168e={};var _0x28baa2;var _0x42fda5;return db['Automation']['findOne']({'where':{'id':_0x45d24e[_0x3c1d('0x40')]['id']}})[_0x3c1d('0x21')](handleEntityNotFound(_0x1421f4,null))[_0x3c1d('0x21')](function(_0x552255){if(_0x552255){_0x28baa2=_0x552255;_0x55168e[_0x3c1d('0x29')]=_[_0x3c1d('0x2c')](db[_0x3c1d('0x4d')][_0x3c1d('0x26')]);_0x55168e[_0x3c1d('0x2b')]=_[_0x3c1d('0x2c')](_0x45d24e[_0x3c1d('0x2b')]);_0x55168e[_0x3c1d('0x2d')]=_[_0x3c1d('0x2e')](_0x55168e[_0x3c1d('0x29')],_0x55168e[_0x3c1d('0x2b')]);_0x22e865[_0x3c1d('0x30')]=_[_0x3c1d('0x2e')](_0x55168e[_0x3c1d('0x29')],qs['fields'](_0x45d24e[_0x3c1d('0x2b')][_0x3c1d('0x2f')]));_0x22e865[_0x3c1d('0x30')]=_0x22e865[_0x3c1d('0x30')]['length']?_0x22e865[_0x3c1d('0x30')]:_0x55168e['model'];_0x22e865[_0x3c1d('0x49')]=qs['sort'](_0x45d24e[_0x3c1d('0x2b')][_0x3c1d('0x32')]);_0x22e865[_0x3c1d('0x33')]=qs['filters'](_[_0x3c1d('0x34')](_0x45d24e[_0x3c1d('0x2b')],_0x55168e[_0x3c1d('0x2d')]));if(_0x45d24e[_0x3c1d('0x2b')][_0x3c1d('0x36')]){_0x22e865[_0x3c1d('0x33')]=_[_0x3c1d('0x35')](_0x22e865[_0x3c1d('0x33')],{'$or':_[_0x3c1d('0x2a')](_0x22e865[_0x3c1d('0x30')],function(_0x3b70ab){var _0x4ea7a9={};_0x4ea7a9[_0x3b70ab]={'$like':'%'+_0x45d24e[_0x3c1d('0x2b')]['filter']+'%'};return _0x4ea7a9;})});}_0x22e865=_[_0x3c1d('0x35')]({},_0x22e865,_0x45d24e[_0x3c1d('0x37')]);return _0x28baa2[_0x3c1d('0x4f')](_0x22e865);}})['then'](function(_0x3037d2){if(_0x3037d2){_0x42fda5=_0x3037d2['length'];if(!_0x45d24e[_0x3c1d('0x2b')][_0x3c1d('0x4b')](_0x3c1d('0x31'))){_0x22e865[_0x3c1d('0x1b')]=qs['limit'](_0x45d24e[_0x3c1d('0x2b')][_0x3c1d('0x1b')]);_0x22e865[_0x3c1d('0x19')]=qs[_0x3c1d('0x19')](_0x45d24e[_0x3c1d('0x2b')][_0x3c1d('0x19')]);}return _0x28baa2[_0x3c1d('0x4f')](_0x22e865);}})['then'](function(_0x3d75a6){if(_0x3d75a6){return _0x3d75a6?{'count':_0x42fda5,'rows':_0x3d75a6}:null;}})[_0x3c1d('0x21')](respondWithResult(_0x1421f4,null))[_0x3c1d('0x3e')](handleError(_0x1421f4,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 5a94db0..65ee572 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 _0x2b09=['./automation.attributes','exports','define','Automation','tools_automations','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment'];(function(_0x210d7f,_0x2abe4f){var _0x42d687=function(_0x46b2ae){while(--_0x46b2ae){_0x210d7f['push'](_0x210d7f['shift']());}};_0x42d687(++_0x2abe4f);}(_0x2b09,0x13d));var _0x92b0=function(_0x5ee83b,_0x36fd6b){_0x5ee83b=_0x5ee83b-0x0;var _0x2b9ad9=_0x2b09[_0x5ee83b];return _0x2b9ad9;};'use strict';var _=require('lodash');var util=require(_0x92b0('0x0'));var logger=require(_0x92b0('0x1'))(_0x92b0('0x2'));var moment=require(_0x92b0('0x3'));var BPromise=require(_0x92b0('0x4'));var rp=require(_0x92b0('0x5'));var fs=require('fs');var path=require(_0x92b0('0x6'));var rimraf=require('rimraf');var config=require(_0x92b0('0x7'));var attributes=require(_0x92b0('0x8'));module[_0x92b0('0x9')]=function(_0x33009d,_0x35c14d){return _0x33009d[_0x92b0('0xa')](_0x92b0('0xb'),attributes,{'tableName':_0x92b0('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x55e7=['Automation','tools_automations','lodash','util','../../config/logger','api','bluebird','request-promise','./automation.attributes','exports','define'];(function(_0x24b2a9,_0x4c82ab){var _0x5b23b7=function(_0x3af677){while(--_0x3af677){_0x24b2a9['push'](_0x24b2a9['shift']());}};_0x5b23b7(++_0x4c82ab);}(_0x55e7,0xe9));var _0x755e=function(_0xf0b52a,_0x102dc2){_0xf0b52a=_0xf0b52a-0x0;var _0x350e3e=_0x55e7[_0xf0b52a];return _0x350e3e;};'use strict';var _=require(_0x755e('0x0'));var util=require(_0x755e('0x1'));var logger=require(_0x755e('0x2'))(_0x755e('0x3'));var moment=require('moment');var BPromise=require(_0x755e('0x4'));var rp=require(_0x755e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x755e('0x6'));module[_0x755e('0x7')]=function(_0x2e4b02,_0x5e6429){return _0x2e4b02[_0x755e('0x8')](_0x755e('0x9'),attributes,{'tableName':_0x755e('0xa'),'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 16a1f7e..9e1e080 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 _0x390a=['jayson/promise','client','request','then','info','debug','Automation,\x20%s,\x20%s,\x20%s','request\x20sent','error','Automation,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x43cdcf,_0x20eb14){var _0xa2bd23=function(_0x1ea60c){while(--_0x1ea60c){_0x43cdcf['push'](_0x43cdcf['shift']());}};_0xa2bd23(++_0x20eb14);}(_0x390a,0xc9));var _0xa390=function(_0x5bfa9c,_0x16b6a6){_0x5bfa9c=_0x5bfa9c-0x0;var _0xca7cf1=_0x390a[_0x5bfa9c];return _0xca7cf1;};'use strict';var _=require(_0xa390('0x0'));var util=require(_0xa390('0x1'));var moment=require(_0xa390('0x2'));var BPromise=require(_0xa390('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa390('0x4'));var db=require(_0xa390('0x5'))['db'];var utils=require(_0xa390('0x6'));var logger=require(_0xa390('0x7'))('rpc');var config=require(_0xa390('0x8'));var jayson=require(_0xa390('0x9'));var client=jayson[_0xa390('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2d49cc,_0x1f9de0,_0x53bfb4){return new BPromise(function(_0x492418,_0xc8cd85){return client[_0xa390('0xb')](_0x2d49cc,_0x53bfb4)[_0xa390('0xc')](function(_0x226003){logger[_0xa390('0xd')]('Automation,\x20%s,\x20%s',_0x1f9de0,'request\x20sent');logger[_0xa390('0xe')](_0xa390('0xf'),_0x1f9de0,_0xa390('0x10'),JSON['stringify'](_0x226003));if(_0x226003[_0xa390('0x11')]){if(_0x226003[_0xa390('0x11')]['code']===0x1f4){logger[_0xa390('0x11')](_0xa390('0x12'),_0x1f9de0,_0x226003['error']['message']);return _0xc8cd85(_0x226003[_0xa390('0x11')][_0xa390('0x13')]);}logger['error'](_0xa390('0x12'),_0x1f9de0,_0x226003['error']['message']);return _0x492418(_0x226003['error'][_0xa390('0x13')]);}else{logger['info'](_0xa390('0x12'),_0x1f9de0,_0xa390('0x10'));_0x492418(_0x226003['result'][_0xa390('0x13')]);}})[_0xa390('0x14')](function(_0x59d609){logger[_0xa390('0x11')]('Automation,\x20%s,\x20%s',_0x1f9de0,_0x59d609);_0xc8cd85(_0x59d609);});});} \ No newline at end of file +var _0x6b19=['ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','then','info','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','moment','bluebird'];(function(_0xaf81d7,_0x5c2f22){var _0x51ee56=function(_0x3c7269){while(--_0x3c7269){_0xaf81d7['push'](_0xaf81d7['shift']());}};_0x51ee56(++_0x5c2f22);}(_0x6b19,0xf4));var _0x96b1=function(_0x7840de,_0x1f7b08){_0x7840de=_0x7840de-0x0;var _0x58ff45=_0x6b19[_0x7840de];return _0x58ff45;};'use strict';var _=require(_0x96b1('0x0'));var util=require('util');var moment=require(_0x96b1('0x1'));var BPromise=require(_0x96b1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96b1('0x3'));var db=require(_0x96b1('0x4'))['db'];var utils=require(_0x96b1('0x5'));var logger=require(_0x96b1('0x6'))('rpc');var config=require(_0x96b1('0x7'));var jayson=require(_0x96b1('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x288d77,_0x2347c5,_0x519fbe){return new BPromise(function(_0x280b00,_0x2300ad){return client['request'](_0x288d77,_0x519fbe)[_0x96b1('0x9')](function(_0x6323a6){logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x2347c5,_0x96b1('0xc'));logger['debug'](_0x96b1('0xd'),_0x2347c5,'request\x20sent',JSON['stringify'](_0x6323a6));if(_0x6323a6['error']){if(_0x6323a6['error'][_0x96b1('0xe')]===0x1f4){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x2300ad(_0x6323a6['error'][_0x96b1('0x10')]);}logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);return _0x280b00(_0x6323a6[_0x96b1('0xf')][_0x96b1('0x10')]);}else{logger[_0x96b1('0xa')](_0x96b1('0xb'),_0x2347c5,'request\x20sent');_0x280b00(_0x6323a6[_0x96b1('0x11')][_0x96b1('0x10')]);}})[_0x96b1('0x12')](function(_0x350b2c){logger[_0x96b1('0xf')](_0x96b1('0xb'),_0x2347c5,_0x350b2c);_0x2300ad(_0x350b2c);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 6500bc2..1243dc0 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 _0xe914=['/:id','isAuthenticated','/:id/conditions','/:id/actions','getActions','create','post','addConditions','addActions','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./automation.controller','get','index'];(function(_0x524b9b,_0x3dcf4d){var _0xfae645=function(_0x3b76a4){while(--_0x3b76a4){_0x524b9b['push'](_0x524b9b['shift']());}};_0xfae645(++_0x3dcf4d);}(_0xe914,0x7f));var _0x4e91=function(_0x409f9f,_0x43bb9d){_0x409f9f=_0x409f9f-0x0;var _0x4d2c04=_0xe914[_0x409f9f];return _0x4d2c04;};'use strict';var multer=require(_0x4e91('0x0'));var util=require(_0x4e91('0x1'));var path=require('path');var timeout=require(_0x4e91('0x2'));var express=require(_0x4e91('0x3'));var router=express[_0x4e91('0x4')]();var fs_extra=require(_0x4e91('0x5'));var auth=require(_0x4e91('0x6'));var interaction=require(_0x4e91('0x7'));var config=require('../../config/environment');var controller=require(_0x4e91('0x8'));router[_0x4e91('0x9')]('/',auth['isAuthenticated'](),controller[_0x4e91('0xa')]);router[_0x4e91('0x9')](_0x4e91('0xb'),auth[_0x4e91('0xc')](),controller['show']);router['get'](_0x4e91('0xd'),auth['isAuthenticated'](),controller['getConditions']);router[_0x4e91('0x9')](_0x4e91('0xe'),auth[_0x4e91('0xc')](),controller[_0x4e91('0xf')]);router['post']('/',auth[_0x4e91('0xc')](),controller[_0x4e91('0x10')]);router[_0x4e91('0x11')]('/:id/conditions',auth[_0x4e91('0xc')](),controller[_0x4e91('0x12')]);router[_0x4e91('0x11')](_0x4e91('0xe'),auth[_0x4e91('0xc')](),controller[_0x4e91('0x13')]);router[_0x4e91('0x14')](_0x4e91('0xb'),auth[_0x4e91('0xc')](),controller['update']);router[_0x4e91('0x15')](_0x4e91('0xb'),auth[_0x4e91('0xc')](),controller['destroy']);module[_0x4e91('0x16')]=router; \ No newline at end of file +var _0xc576=['post','addConditions','addActions','put','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./automation.controller','isAuthenticated','get','/:id','show','/:id/conditions','/:id/actions','getActions','create'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0xc576,0x1ea));var _0x6c57=function(_0xa3fadc,_0xd1e16){_0xa3fadc=_0xa3fadc-0x0;var _0x23ecb8=_0xc576[_0xa3fadc];return _0x23ecb8;};'use strict';var multer=require(_0x6c57('0x0'));var util=require(_0x6c57('0x1'));var path=require(_0x6c57('0x2'));var timeout=require(_0x6c57('0x3'));var express=require(_0x6c57('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6c57('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x6c57('0x6'));var controller=require(_0x6c57('0x7'));router['get']('/',auth[_0x6c57('0x8')](),controller['index']);router[_0x6c57('0x9')](_0x6c57('0xa'),auth['isAuthenticated'](),controller[_0x6c57('0xb')]);router['get'](_0x6c57('0xc'),auth[_0x6c57('0x8')](),controller['getConditions']);router[_0x6c57('0x9')](_0x6c57('0xd'),auth[_0x6c57('0x8')](),controller[_0x6c57('0xe')]);router['post']('/',auth[_0x6c57('0x8')](),controller[_0x6c57('0xf')]);router[_0x6c57('0x10')](_0x6c57('0xc'),auth[_0x6c57('0x8')](),controller[_0x6c57('0x11')]);router['post'](_0x6c57('0xd'),auth[_0x6c57('0x8')](),controller[_0x6c57('0x12')]);router[_0x6c57('0x13')](_0x6c57('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6c57('0x14')](_0x6c57('0xa'),auth[_0x6c57('0x8')](),controller[_0x6c57('0x15')]);module[_0x6c57('0x16')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 9fd534e..d956130 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 _0xc904=['onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','sequelize','exports','STRING','name','ENUM','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','UNSIGNED','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#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\x20(min:1,\x20max:999)','always','never'];(function(_0x392f82,_0x4dc713){var _0x3ad0b8=function(_0x29da4b){while(--_0x29da4b){_0x392f82['push'](_0x392f82['shift']());}};_0x3ad0b8(++_0x4dc713);}(_0xc904,0xf0));var _0x4c90=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0xc904[_0x5d80de];return _0x1c7556;};'use strict';var Sequelize=require(_0x4c90('0x0'));module[_0x4c90('0x1')]={'name':{'type':Sequelize[_0x4c90('0x2')],'unique':_0x4c90('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0x4c90('0x4')](_0x4c90('0x5')),'allowNull':![],'defaultValue':_0x4c90('0x5')},'description':{'type':Sequelize[_0x4c90('0x2')]},'active':{'type':Sequelize[_0x4c90('0x6')],'defaultValue':0x0,'comment':_0x4c90('0x7')},'limitCalls':{'type':Sequelize[_0x4c90('0x8')](0x4)[_0x4c90('0x9')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x4c90('0xa')},'dialOriginateCallerIdName':{'type':Sequelize[_0x4c90('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4c90('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4c90('0xb')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4c90('0x8')](0x3)[_0x4c90('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4c90('0xc')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4c90('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4c90('0xd')},'dialBusyMaxRetry':{'type':Sequelize[_0x4c90('0x8')](0x3)[_0x4c90('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4c90('0xe')},'dialBusyRetryFrequency':{'type':Sequelize[_0x4c90('0x8')](0x5)[_0x4c90('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4c90('0xf')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4c90('0x8')](0x3)[_0x4c90('0x9')],'defaultValue':0x3,'comment':_0x4c90('0x10')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x4c90('0x8')](0x5)[_0x4c90('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize[_0x4c90('0x8')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x4c90('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4c90('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4c90('0x11'),_0x4c90('0x12'),_0x4c90('0x13')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x4c90('0x6')],'defaultValue':0x0,'comment':_0x4c90('0x14')},'dialAMDInitialSilence':{'type':Sequelize[_0x4c90('0x8')](0x9)[_0x4c90('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4c90('0x15')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)[_0x4c90('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4c90('0x16')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4c90('0x8')](0x9)[_0x4c90('0x9')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4c90('0x8')](0x9)[_0x4c90('0x9')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4c90('0x17')},'dialAMDMinWordLength':{'type':Sequelize[_0x4c90('0x8')](0x9)[_0x4c90('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4c90('0x18')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4c90('0x8')](0x9)[_0x4c90('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4c90('0x8')](0x9)[_0x4c90('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x4c90('0x19')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4c90('0x8')](0x5)[_0x4c90('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x4c90('0x1a')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4c90('0x8')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4c90('0x1b')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4c90('0x4')](_0x4c90('0x1c'),_0x4c90('0x1d')),'defaultValue':_0x4c90('0x1c')},'dialPrefix':{'type':Sequelize[_0x4c90('0x2')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4c90('0x8')](0x3)[_0x4c90('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4c90('0x1e')},'dialCutDigit':{'type':Sequelize[_0x4c90('0x8')](0x3)[_0x4c90('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4c90('0x1f')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x4c90('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4c90('0x20')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4c90('0x8')](0x5)[_0x4c90('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialDropMaxRetry':{'type':Sequelize[_0x4c90('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x4c90('0x8')](0x5)[_0x4c90('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4c90('0x8')](0x3)[_0x4c90('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x4c90('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4c90('0x21')},'dialMachineMaxRetry':{'type':Sequelize[_0x4c90('0x8')](0x3)[_0x4c90('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4c90('0x22')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4c90('0x8')](0x5)[_0x4c90('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4c90('0x8')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4c90('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x4c90('0x8')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4c90('0x24')}}; \ No newline at end of file +var _0x40d5=['#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','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\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)','sequelize','exports','STRING','ivr','BOOLEAN','Active/Disactive\x20Campaign','INTEGER','Max\x20200\x20calls.','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','UNSIGNED','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','ENUM','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting'];(function(_0x3eda57,_0x35011e){var _0x158719=function(_0x51785c){while(--_0x51785c){_0x3eda57['push'](_0x3eda57['shift']());}};_0x158719(++_0x35011e);}(_0x40d5,0x15d));var _0x540d=function(_0x492221,_0x9e2521){_0x492221=_0x492221-0x0;var _0x398bf9=_0x40d5[_0x492221];return _0x398bf9;};'use strict';var Sequelize=require(_0x540d('0x0'));module[_0x540d('0x1')]={'name':{'type':Sequelize[_0x540d('0x2')],'unique':'name','allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0x540d('0x3')),'allowNull':![],'defaultValue':_0x540d('0x3')},'description':{'type':Sequelize[_0x540d('0x2')]},'active':{'type':Sequelize[_0x540d('0x4')],'defaultValue':0x0,'comment':_0x540d('0x5')},'limitCalls':{'type':Sequelize[_0x540d('0x6')](0x4)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0x540d('0x7')},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x540d('0x2')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x540d('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0x540d('0x6')](0x3)[_0x540d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x540d('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x540d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x540d('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0x540d('0x6')](0x3)[_0x540d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x540d('0xc')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x540d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':_0x540d('0xd')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x540d('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0x540d('0x6')](0x3)[_0x540d('0x9')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x540d('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x540d('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialCheckDuplicateType':{'type':Sequelize[_0x540d('0xf')]('always',_0x540d('0x10'),_0x540d('0x11')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x540d('0x4')],'defaultValue':0x0,'comment':_0x540d('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0x540d('0x6')](0x9)[_0x540d('0x9')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x540d('0x13')},'dialAMDGreeting':{'type':Sequelize[_0x540d('0x6')](0x9)[_0x540d('0x9')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x540d('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x540d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x540d('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x540d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x540d('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0x540d('0x6')](0x9)[_0x540d('0x9')],'defaultValue':0x64,'validate':{'min':0x0},'comment':'#AMD\x20Min\x20Word\x20Length'},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x540d('0x6')](0x9)[_0x540d('0x9')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0x540d('0x9')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x540d('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize['INTEGER'](0x5)[_0x540d('0x9')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x540d('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x540d('0x6')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x540d('0x19')},'dialOrderByScheduledAt':{'type':Sequelize[_0x540d('0xf')](_0x540d('0x1a'),_0x540d('0x1b')),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize['STRING'],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x540d('0x6')](0x3)[_0x540d('0x9')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x540d('0x1c')},'dialCutDigit':{'type':Sequelize[_0x540d('0x6')](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x540d('0x6')](0x3)[_0x540d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x540d('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x540d('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x540d('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0x540d('0x6')](0x3)[_0x540d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x540d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x540d('0x1f')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x540d('0x6')](0x3)[_0x540d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x540d('0x20')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x540d('0x6')](0x5)[_0x540d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x540d('0x6')](0x3)[_0x540d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x540d('0x21')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x540d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x540d('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x540d('0x9')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x540d('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x540d('0x6')](0x5)[_0x540d('0x9')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x540d('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 9f6fa3e..fa79f2f 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 _0x62a6=['getLists','CmList','addLists','ids','spread','dialCheckDuplicateType','insert','into','cm_hopper','fromQuery','phone','ContactId','select','field','NOW()','scheduledAt','CmListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(phone,\x27\x27)','onlyIfOpen','ListId','push','sequelize','all','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','then','destroy','get','IvrCampaigns','UserProfileResource','end','sendStatus','error','stack','name','send','map','Campaign','fieldName','model','query','keys','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','catch','params','rawAttributes','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','updatedAt','getHoppers','CampaignId','CmHopper','getHopperHistories','CmHopperHistory','hasOwnProperty','order','getHopperFinals','findOne','CmHopperFinal','CmHopperBlack'];(function(_0x88c540,_0x38fe79){var _0x33b3fc=function(_0x2bd4db){while(--_0x2bd4db){_0x88c540['push'](_0x88c540['shift']());}};_0x33b3fc(++_0x38fe79);}(_0x62a6,0xac));var _0x662a=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x62a6[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0x662a('0x0'));var rimraf=require(_0x662a('0x1'));var zipdir=require(_0x662a('0x2'));var jsonpatch=require(_0x662a('0x3'));var rp=require('request-promise');var moment=require(_0x662a('0x4'));var BPromise=require(_0x662a('0x5'));var Mustache=require('mustache');var util=require(_0x662a('0x6'));var path=require(_0x662a('0x7'));var sox=require(_0x662a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x662a('0x9'));var _=require(_0x662a('0xa'));var squel=require(_0x662a('0xb'));var crypto=require('crypto');var jsforce=require(_0x662a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x662a('0xd'));var Papa=require(_0x662a('0xe'));var Redis=require(_0x662a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x662a('0x10'));var as=require(_0x662a('0x11'));var hardwareService=require(_0x662a('0x12'));var logger=require(_0x662a('0x13'))(_0x662a('0x14'));var utils=require(_0x662a('0x15'));var config=require(_0x662a('0x16'));var licenseUtil=require(_0x662a('0x17'));var db=require(_0x662a('0x18'))['db'];function respondWithStatusCode(_0x1925f4,_0x178990){_0x178990=_0x178990||0xcc;return function(_0x4cc917){if(_0x4cc917){return _0x1925f4['sendStatus'](_0x178990);}return _0x1925f4['status'](_0x178990)['end']();};}function respondWithResult(_0x541d05,_0x504d8d){_0x504d8d=_0x504d8d||0xc8;return function(_0x1dd367){if(_0x1dd367){return _0x541d05['status'](_0x504d8d)[_0x662a('0x19')](_0x1dd367);}};}function respondWithFilteredResult(_0x4e9cf7,_0x17be8e){return function(_0x54337c){if(_0x54337c){var _0x160776=typeof _0x17be8e[_0x662a('0x1a')]===_0x662a('0x1b')&&typeof _0x17be8e[_0x662a('0x1c')]===_0x662a('0x1b');var _0xb17dd1=_0x54337c[_0x662a('0x1d')];var _0x3a3370=_0x160776?0x0:_0x17be8e[_0x662a('0x1a')];var _0x377689=_0x160776?_0x54337c[_0x662a('0x1d')]:_0x17be8e['offset']+_0x17be8e[_0x662a('0x1c')];var _0x5bc4ad;if(_0x377689>=_0xb17dd1){_0x377689=_0xb17dd1;_0x5bc4ad=0xc8;}else{_0x5bc4ad=0xce;}_0x4e9cf7[_0x662a('0x1e')](_0x5bc4ad);return _0x4e9cf7[_0x662a('0x1f')](_0x662a('0x20'),_0x3a3370+'-'+_0x377689+'/'+_0xb17dd1)['json'](_0x54337c);}return null;};}function patchUpdates(_0x5b2b27){return function(_0x333790){try{jsonpatch[_0x662a('0x21')](_0x333790,_0x5b2b27,!![]);}catch(_0x4896cc){return BPromise[_0x662a('0x22')](_0x4896cc);}return _0x333790['save']();};}function saveUpdates(_0x3f9ed3,_0x19ff8b){return function(_0x553fa5){if(_0x553fa5){return _0x553fa5['update'](_0x3f9ed3)[_0x662a('0x23')](function(_0x2c9a27){return _0x2c9a27;});}return null;};}function removeEntity(_0x2958a0,_0x3bacce){return function(_0x564b2a){if(_0x564b2a){return _0x564b2a[_0x662a('0x24')]()[_0x662a('0x23')](function(){var _0x5eac41=_0x564b2a[_0x662a('0x25')]({'plain':!![]});var _0x15a1ff=_0x662a('0x26');return db[_0x662a('0x27')][_0x662a('0x24')]({'where':{'type':_0x15a1ff,'resourceId':_0x5eac41['id']}})[_0x662a('0x23')](function(){return _0x564b2a;});})[_0x662a('0x23')](function(){_0x2958a0['status'](0xcc)[_0x662a('0x28')]();});}};}function handleEntityNotFound(_0x281ad0,_0x9e5ce){return function(_0xc23402){if(!_0xc23402){_0x281ad0[_0x662a('0x29')](0x194);}return _0xc23402;};}function handleError(_0x5c9808,_0x230338){_0x230338=_0x230338||0x1f4;return function(_0x5855ed){logger[_0x662a('0x2a')](_0x5855ed[_0x662a('0x2b')]);if(_0x5855ed[_0x662a('0x2c')]){delete _0x5855ed[_0x662a('0x2c')];}_0x5c9808[_0x662a('0x1e')](_0x230338)[_0x662a('0x2d')](_0x5855ed);};}exports['index']=function(_0x215594,_0x29a7da){var _0x555a74={},_0x35eab5={},_0x42c36b={'count':0x0,'rows':[]};var _0x3cbc04=_[_0x662a('0x2e')](db[_0x662a('0x2f')]['rawAttributes'],function(_0x4339b1){return{'name':_0x4339b1[_0x662a('0x30')],'type':_0x4339b1['type']['key']};});_0x35eab5[_0x662a('0x31')]=_[_0x662a('0x2e')](_0x3cbc04,_0x662a('0x2c'));_0x35eab5[_0x662a('0x32')]=_[_0x662a('0x33')](_0x215594[_0x662a('0x32')]);_0x35eab5[_0x662a('0x34')]=_[_0x662a('0x35')](_0x35eab5[_0x662a('0x31')],_0x35eab5[_0x662a('0x32')]);_0x555a74['attributes']=_[_0x662a('0x35')](_0x35eab5[_0x662a('0x31')],qs[_0x662a('0x36')](_0x215594[_0x662a('0x32')][_0x662a('0x36')]));_0x555a74['attributes']=_0x555a74['attributes']['length']?_0x555a74[_0x662a('0x37')]:_0x35eab5['model'];if(!_0x215594[_0x662a('0x32')]['hasOwnProperty'](_0x662a('0x38'))){_0x555a74[_0x662a('0x1c')]=qs[_0x662a('0x1c')](_0x215594['query']['limit']);_0x555a74[_0x662a('0x1a')]=qs['offset'](_0x215594[_0x662a('0x32')][_0x662a('0x1a')]);}_0x555a74['order']=qs[_0x662a('0x39')](_0x215594[_0x662a('0x32')][_0x662a('0x39')]);_0x555a74[_0x662a('0x3a')]=qs['filters'](_[_0x662a('0x3b')](_0x215594[_0x662a('0x32')],_0x35eab5[_0x662a('0x34')]),_0x3cbc04);if(_0x215594[_0x662a('0x32')][_0x662a('0x3c')]){_0x555a74[_0x662a('0x3a')]=_[_0x662a('0x3d')](_0x555a74[_0x662a('0x3a')],{'$or':_['map'](_0x3cbc04,function(_0x42478f){if(_0x42478f[_0x662a('0x3e')]!==_0x662a('0x3f')){var _0x2fcd77={};_0x2fcd77[_0x42478f[_0x662a('0x2c')]]={'$like':'%'+_0x215594[_0x662a('0x32')][_0x662a('0x3c')]+'%'};return _0x2fcd77;}})});}_0x555a74=_[_0x662a('0x3d')]({},_0x555a74,_0x215594['options']);var _0x25ac40={'where':_0x555a74['where']};return db[_0x662a('0x2f')][_0x662a('0x1d')](_0x25ac40)[_0x662a('0x23')](function(_0x545af0){_0x42c36b['count']=_0x545af0;if(_0x215594[_0x662a('0x32')][_0x662a('0x40')]){_0x555a74[_0x662a('0x41')]=[{'all':!![]}];}return db[_0x662a('0x2f')][_0x662a('0x42')](_0x555a74);})['then'](function(_0x286524){_0x42c36b[_0x662a('0x43')]=_0x286524;return _0x42c36b;})['then'](respondWithFilteredResult(_0x29a7da,_0x555a74))[_0x662a('0x44')](handleError(_0x29a7da,null));};exports['show']=function(_0x53ba98,_0xdf9632){var _0x28d2eb={'raw':![],'where':{'id':_0x53ba98[_0x662a('0x45')]['id']}},_0x282cc8={};_0x282cc8[_0x662a('0x31')]=_[_0x662a('0x33')](db['Campaign'][_0x662a('0x46')]);_0x282cc8[_0x662a('0x32')]=_[_0x662a('0x33')](_0x53ba98[_0x662a('0x32')]);_0x282cc8[_0x662a('0x34')]=_['intersection'](_0x282cc8[_0x662a('0x31')],_0x282cc8[_0x662a('0x32')]);_0x28d2eb[_0x662a('0x37')]=_[_0x662a('0x35')](_0x282cc8[_0x662a('0x31')],qs[_0x662a('0x36')](_0x53ba98['query'][_0x662a('0x36')]));_0x28d2eb[_0x662a('0x37')]=_0x28d2eb[_0x662a('0x37')][_0x662a('0x47')]?_0x28d2eb[_0x662a('0x37')]:_0x282cc8[_0x662a('0x31')];if(_0x53ba98['query'][_0x662a('0x40')]){_0x28d2eb[_0x662a('0x41')]=[{'all':!![]}];}_0x28d2eb=_[_0x662a('0x3d')]({},_0x28d2eb,_0x53ba98[_0x662a('0x48')]);return db[_0x662a('0x2f')][_0x662a('0x49')](_0x28d2eb)[_0x662a('0x23')](handleEntityNotFound(_0xdf9632,null))[_0x662a('0x23')](respondWithResult(_0xdf9632,null))['catch'](handleError(_0xdf9632,null));};exports[_0x662a('0x4a')]=function(_0x39f732,_0xb1125b){return db['Campaign']['create'](_0x39f732[_0x662a('0x4b')],{})['then'](function(_0x4653d7){var _0x1dece2=_0x39f732[_0x662a('0x4c')][_0x662a('0x25')]({'plain':!![]});if(!_0x1dece2)throw new Error(_0x662a('0x4d'));if(_0x1dece2[_0x662a('0x4e')]===_0x662a('0x4c')){var _0x2113f9=_0x4653d7['get']({'plain':!![]});var _0x1e4016=_0x662a('0x26');return db[_0x662a('0x4f')]['find']({'where':{'name':_0x1e4016,'userProfileId':_0x1dece2[_0x662a('0x50')]},'raw':!![]})[_0x662a('0x23')](function(_0x772652){if(_0x772652&&_0x772652[_0x662a('0x51')]===0x0){return db[_0x662a('0x27')][_0x662a('0x4a')]({'name':_0x2113f9[_0x662a('0x2c')],'resourceId':_0x2113f9['id'],'type':_0x772652[_0x662a('0x2c')],'sectionId':_0x772652['id']},{})['then'](function(){return _0x4653d7;});}else{return _0x4653d7;}})[_0x662a('0x44')](function(_0x2588d5){logger[_0x662a('0x2a')](_0x662a('0x52'),_0x2588d5);throw _0x2588d5;});}return _0x4653d7;})[_0x662a('0x23')](respondWithResult(_0xb1125b,0xc9))[_0x662a('0x44')](handleError(_0xb1125b,null));};exports[_0x662a('0x53')]=function(_0x369e52,_0x248307){var _0x21a1f6={'where':{'id':_0x369e52[_0x662a('0x45')]['id']}},_0x23d0b9={};_0x23d0b9[_0x662a('0x31')]=_['keys'](db[_0x662a('0x2f')]['rawAttributes']);_0x21a1f6[_0x662a('0x37')]=_[_0x662a('0x35')](_0x23d0b9[_0x662a('0x31')],qs[_0x662a('0x36')](_0x369e52[_0x662a('0x32')][_0x662a('0x36')]));_0x21a1f6[_0x662a('0x37')]=_0x21a1f6['attributes'][_0x662a('0x47')]?_0x21a1f6['attributes']:_0x23d0b9[_0x662a('0x31')];if(_0x369e52[_0x662a('0x32')]['includeAll']){_0x21a1f6[_0x662a('0x41')]=[{'all':!![]}];}_0x21a1f6=_['merge']({},_0x21a1f6,_0x369e52[_0x662a('0x48')]);return db['Campaign']['find'](_0x21a1f6)[_0x662a('0x23')](handleEntityNotFound(_0x248307,null))[_0x662a('0x23')](function(_0x39d6a2){if(_0x39d6a2){var _0x4507c9=_0x39d6a2[_0x662a('0x25')]({'plain':!![]});_0x4507c9=qs[_0x662a('0x54')](_0x4507c9,['id',_0x662a('0x55'),_0x662a('0x56')]);_0x369e52[_0x662a('0x4b')]=_[_0x662a('0x54')](_0x369e52['body'],['id',_0x662a('0x55'),_0x662a('0x56')]);return db[_0x662a('0x2f')][_0x662a('0x4a')](_[_0x662a('0x3d')](_0x4507c9,_0x369e52[_0x662a('0x4b')]),{'include':_0x369e52['query']['includeAll']?[{'all':!![]}]:undefined})['then'](function(_0x344317){var _0x3553f6=_0x369e52[_0x662a('0x4c')][_0x662a('0x25')]({'plain':!![]});if(!_0x3553f6)throw new Error(_0x662a('0x4d'));if(_0x3553f6[_0x662a('0x4e')]==='user'){var _0x385acd=_0x344317[_0x662a('0x25')]({'plain':!![]});var _0x358b2a=_0x662a('0x26');return db[_0x662a('0x4f')][_0x662a('0x49')]({'where':{'name':_0x358b2a,'userProfileId':_0x3553f6[_0x662a('0x50')]},'raw':!![]})[_0x662a('0x23')](function(_0x40af37){if(_0x40af37&&_0x40af37[_0x662a('0x51')]===0x0){return db[_0x662a('0x27')][_0x662a('0x4a')]({'name':_0x385acd['name'],'resourceId':_0x385acd['id'],'type':_0x40af37['name'],'sectionId':_0x40af37['id']},{})[_0x662a('0x23')](function(){return _0x344317;});}else{return _0x344317;}})[_0x662a('0x44')](function(_0x5f4819){logger[_0x662a('0x2a')](_0x662a('0x52'),_0x5f4819);throw _0x5f4819;});}return _0x344317;});}})['then'](respondWithResult(_0x248307,0xc9))[_0x662a('0x44')](handleError(_0x248307,null));};exports['update']=function(_0x207282,_0x5e4be5){if(_0x207282['body']['id']){delete _0x207282[_0x662a('0x4b')]['id'];}return db['Campaign']['find']({'where':{'id':_0x207282[_0x662a('0x45')]['id']}})['then'](handleEntityNotFound(_0x5e4be5,null))[_0x662a('0x23')](saveUpdates(_0x207282[_0x662a('0x4b')],null))[_0x662a('0x23')](respondWithResult(_0x5e4be5,null))['catch'](handleError(_0x5e4be5,null));};exports[_0x662a('0x24')]=function(_0x38a27a,_0x151b3f){return db[_0x662a('0x2f')]['find']({'where':{'id':_0x38a27a[_0x662a('0x45')]['id']}})[_0x662a('0x23')](handleEntityNotFound(_0x151b3f,null))[_0x662a('0x23')](removeEntity(_0x151b3f,null))[_0x662a('0x44')](handleError(_0x151b3f,null));};exports[_0x662a('0x57')]=function(_0x304ede,_0x2f49a8,_0x173ca9){var _0x1ed3eb={'raw':!![],'where':{}};var _0x368e70={};var _0x14d783={'count':0x0,'rows':[]};return db[_0x662a('0x2f')]['findOne']({'where':{'id':_0x304ede['params']['id']}})['then'](handleEntityNotFound(_0x2f49a8,null))[_0x662a('0x23')](function(_0x2386a1){if(_0x2386a1){_0x368e70[_0x662a('0x31')]=_[_0x662a('0x33')](db['CmHopper'][_0x662a('0x46')]);_0x368e70['query']=_[_0x662a('0x33')](_0x304ede[_0x662a('0x32')]);_0x368e70[_0x662a('0x34')]=_[_0x662a('0x35')](_0x368e70[_0x662a('0x31')],_0x368e70[_0x662a('0x32')]);_0x1ed3eb['attributes']=_[_0x662a('0x35')](_0x368e70[_0x662a('0x31')],qs[_0x662a('0x36')](_0x304ede[_0x662a('0x32')][_0x662a('0x36')]));_0x1ed3eb['attributes']=_0x1ed3eb[_0x662a('0x37')][_0x662a('0x47')]?_0x1ed3eb[_0x662a('0x37')]:_0x368e70['model'];if(!_0x304ede[_0x662a('0x32')]['hasOwnProperty']('nolimit')){_0x1ed3eb[_0x662a('0x1c')]=qs[_0x662a('0x1c')](_0x304ede['query'][_0x662a('0x1c')]);_0x1ed3eb[_0x662a('0x1a')]=qs[_0x662a('0x1a')](_0x304ede[_0x662a('0x32')]['offset']);}_0x1ed3eb['order']=qs[_0x662a('0x39')](_0x304ede[_0x662a('0x32')][_0x662a('0x39')]);_0x1ed3eb[_0x662a('0x3a')]=qs[_0x662a('0x34')](_[_0x662a('0x3b')](_0x304ede[_0x662a('0x32')],_0x368e70['filters']));_0x1ed3eb['where'][_0x662a('0x58')]=_0x2386a1['id'];if(_0x304ede[_0x662a('0x32')][_0x662a('0x3c')]){_0x1ed3eb[_0x662a('0x3a')]=_[_0x662a('0x3d')](_0x1ed3eb[_0x662a('0x3a')],{'$or':_[_0x662a('0x2e')](_0x1ed3eb[_0x662a('0x37')],function(_0x76d8f9){var _0x3c9972={};_0x3c9972[_0x76d8f9]={'$like':'%'+_0x304ede['query'][_0x662a('0x3c')]+'%'};return _0x3c9972;})});}_0x1ed3eb=_['merge']({},_0x1ed3eb,_0x304ede[_0x662a('0x48')]);return db[_0x662a('0x59')][_0x662a('0x1d')]({'where':_0x1ed3eb['where']})['then'](function(_0x1806fd){_0x14d783[_0x662a('0x1d')]=_0x1806fd;if(_0x304ede[_0x662a('0x32')][_0x662a('0x40')]){_0x1ed3eb[_0x662a('0x41')]=[{'all':!![]}];}return db['CmHopper'][_0x662a('0x42')](_0x1ed3eb);})[_0x662a('0x23')](function(_0x5dbb4e){_0x14d783[_0x662a('0x43')]=_0x5dbb4e;return _0x14d783;});}})[_0x662a('0x23')](respondWithFilteredResult(_0x2f49a8,_0x1ed3eb))[_0x662a('0x44')](handleError(_0x2f49a8,null));};exports[_0x662a('0x5a')]=function(_0x514493,_0x1fa8df,_0x10cc8c){var _0x10c5ca={'raw':!![],'where':{}};var _0x43596d={};var _0x2d3cf3={'count':0x0,'rows':[]};return db[_0x662a('0x2f')]['findOne']({'where':{'id':_0x514493['params']['id']}})['then'](handleEntityNotFound(_0x1fa8df,null))[_0x662a('0x23')](function(_0x198e1b){if(_0x198e1b){_0x43596d[_0x662a('0x31')]=_[_0x662a('0x33')](db[_0x662a('0x5b')]['rawAttributes']);_0x43596d[_0x662a('0x32')]=_[_0x662a('0x33')](_0x514493[_0x662a('0x32')]);_0x43596d[_0x662a('0x34')]=_['intersection'](_0x43596d['model'],_0x43596d[_0x662a('0x32')]);_0x10c5ca[_0x662a('0x37')]=_[_0x662a('0x35')](_0x43596d['model'],qs[_0x662a('0x36')](_0x514493['query'][_0x662a('0x36')]));_0x10c5ca[_0x662a('0x37')]=_0x10c5ca[_0x662a('0x37')][_0x662a('0x47')]?_0x10c5ca[_0x662a('0x37')]:_0x43596d[_0x662a('0x31')];if(!_0x514493[_0x662a('0x32')][_0x662a('0x5c')](_0x662a('0x38'))){_0x10c5ca[_0x662a('0x1c')]=qs[_0x662a('0x1c')](_0x514493[_0x662a('0x32')][_0x662a('0x1c')]);_0x10c5ca[_0x662a('0x1a')]=qs['offset'](_0x514493['query'][_0x662a('0x1a')]);}_0x10c5ca[_0x662a('0x5d')]=qs[_0x662a('0x39')](_0x514493[_0x662a('0x32')][_0x662a('0x39')]);_0x10c5ca[_0x662a('0x3a')]=qs[_0x662a('0x34')](_[_0x662a('0x3b')](_0x514493['query'],_0x43596d[_0x662a('0x34')]));_0x10c5ca[_0x662a('0x3a')][_0x662a('0x58')]=_0x198e1b['id'];if(_0x514493[_0x662a('0x32')][_0x662a('0x3c')]){_0x10c5ca[_0x662a('0x3a')]=_['merge'](_0x10c5ca['where'],{'$or':_[_0x662a('0x2e')](_0x10c5ca['attributes'],function(_0x255d19){var _0x579263={};_0x579263[_0x255d19]={'$like':'%'+_0x514493[_0x662a('0x32')][_0x662a('0x3c')]+'%'};return _0x579263;})});}_0x10c5ca=_[_0x662a('0x3d')]({},_0x10c5ca,_0x514493[_0x662a('0x48')]);return db[_0x662a('0x5b')]['count']({'where':_0x10c5ca[_0x662a('0x3a')]})[_0x662a('0x23')](function(_0x3918c6){_0x2d3cf3['count']=_0x3918c6;if(_0x514493['query'][_0x662a('0x40')]){_0x10c5ca[_0x662a('0x41')]=[{'all':!![]}];}return db[_0x662a('0x5b')][_0x662a('0x42')](_0x10c5ca);})[_0x662a('0x23')](function(_0x2f6df7){_0x2d3cf3[_0x662a('0x43')]=_0x2f6df7;return _0x2d3cf3;});}})[_0x662a('0x23')](respondWithFilteredResult(_0x1fa8df,_0x10c5ca))[_0x662a('0x44')](handleError(_0x1fa8df,null));};exports[_0x662a('0x5e')]=function(_0x44fa20,_0x5da5a5,_0x41a38a){var _0x3cf158={'raw':!![],'where':{}};var _0xbb5bbb={};var _0x356cb3={'count':0x0,'rows':[]};return db['Campaign'][_0x662a('0x5f')]({'where':{'id':_0x44fa20[_0x662a('0x45')]['id']}})['then'](handleEntityNotFound(_0x5da5a5,null))[_0x662a('0x23')](function(_0x4ecd8f){if(_0x4ecd8f){_0xbb5bbb[_0x662a('0x31')]=_[_0x662a('0x33')](db['CmHopperFinal'][_0x662a('0x46')]);_0xbb5bbb['query']=_[_0x662a('0x33')](_0x44fa20[_0x662a('0x32')]);_0xbb5bbb[_0x662a('0x34')]=_[_0x662a('0x35')](_0xbb5bbb[_0x662a('0x31')],_0xbb5bbb['query']);_0x3cf158[_0x662a('0x37')]=_['intersection'](_0xbb5bbb[_0x662a('0x31')],qs[_0x662a('0x36')](_0x44fa20[_0x662a('0x32')]['fields']));_0x3cf158[_0x662a('0x37')]=_0x3cf158[_0x662a('0x37')][_0x662a('0x47')]?_0x3cf158[_0x662a('0x37')]:_0xbb5bbb[_0x662a('0x31')];if(!_0x44fa20[_0x662a('0x32')][_0x662a('0x5c')](_0x662a('0x38'))){_0x3cf158[_0x662a('0x1c')]=qs['limit'](_0x44fa20[_0x662a('0x32')][_0x662a('0x1c')]);_0x3cf158[_0x662a('0x1a')]=qs[_0x662a('0x1a')](_0x44fa20[_0x662a('0x32')][_0x662a('0x1a')]);}_0x3cf158['order']=qs[_0x662a('0x39')](_0x44fa20[_0x662a('0x32')]['sort']);_0x3cf158[_0x662a('0x3a')]=qs['filters'](_[_0x662a('0x3b')](_0x44fa20[_0x662a('0x32')],_0xbb5bbb['filters']));_0x3cf158[_0x662a('0x3a')][_0x662a('0x58')]=_0x4ecd8f['id'];if(_0x44fa20[_0x662a('0x32')]['filter']){_0x3cf158[_0x662a('0x3a')]=_[_0x662a('0x3d')](_0x3cf158[_0x662a('0x3a')],{'$or':_[_0x662a('0x2e')](_0x3cf158[_0x662a('0x37')],function(_0x1d020f){var _0x31a2dd={};_0x31a2dd[_0x1d020f]={'$like':'%'+_0x44fa20[_0x662a('0x32')][_0x662a('0x3c')]+'%'};return _0x31a2dd;})});}_0x3cf158=_[_0x662a('0x3d')]({},_0x3cf158,_0x44fa20['options']);return db['CmHopperFinal'][_0x662a('0x1d')]({'where':_0x3cf158[_0x662a('0x3a')]})['then'](function(_0xe894e0){_0x356cb3[_0x662a('0x1d')]=_0xe894e0;if(_0x44fa20['query'][_0x662a('0x40')]){_0x3cf158[_0x662a('0x41')]=[{'all':!![]}];}return db[_0x662a('0x60')][_0x662a('0x42')](_0x3cf158);})[_0x662a('0x23')](function(_0x93a026){_0x356cb3[_0x662a('0x43')]=_0x93a026;return _0x356cb3;});}})[_0x662a('0x23')](respondWithFilteredResult(_0x5da5a5,_0x3cf158))[_0x662a('0x44')](handleError(_0x5da5a5,null));};exports['getHopperBlacks']=function(_0x86471f,_0x4f741e,_0x9d01ab){var _0x3fba0d={'raw':!![],'where':{}};var _0x5be5ae={};var _0x3d5fd9={'count':0x0,'rows':[]};return db['Campaign'][_0x662a('0x5f')]({'where':{'id':_0x86471f[_0x662a('0x45')]['id']}})[_0x662a('0x23')](handleEntityNotFound(_0x4f741e,null))[_0x662a('0x23')](function(_0x2f4b07){if(_0x2f4b07){_0x5be5ae[_0x662a('0x31')]=_[_0x662a('0x33')](db[_0x662a('0x61')][_0x662a('0x46')]);_0x5be5ae[_0x662a('0x32')]=_[_0x662a('0x33')](_0x86471f[_0x662a('0x32')]);_0x5be5ae['filters']=_['intersection'](_0x5be5ae['model'],_0x5be5ae[_0x662a('0x32')]);_0x3fba0d[_0x662a('0x37')]=_[_0x662a('0x35')](_0x5be5ae['model'],qs['fields'](_0x86471f[_0x662a('0x32')][_0x662a('0x36')]));_0x3fba0d[_0x662a('0x37')]=_0x3fba0d[_0x662a('0x37')][_0x662a('0x47')]?_0x3fba0d[_0x662a('0x37')]:_0x5be5ae['model'];if(!_0x86471f[_0x662a('0x32')][_0x662a('0x5c')](_0x662a('0x38'))){_0x3fba0d['limit']=qs[_0x662a('0x1c')](_0x86471f['query'][_0x662a('0x1c')]);_0x3fba0d[_0x662a('0x1a')]=qs[_0x662a('0x1a')](_0x86471f[_0x662a('0x32')][_0x662a('0x1a')]);}_0x3fba0d[_0x662a('0x5d')]=qs[_0x662a('0x39')](_0x86471f[_0x662a('0x32')]['sort']);_0x3fba0d[_0x662a('0x3a')]=qs['filters'](_[_0x662a('0x3b')](_0x86471f[_0x662a('0x32')],_0x5be5ae[_0x662a('0x34')]));_0x3fba0d[_0x662a('0x3a')]['CampaignId']=_0x2f4b07['id'];if(_0x86471f[_0x662a('0x32')][_0x662a('0x3c')]){_0x3fba0d[_0x662a('0x3a')]=_[_0x662a('0x3d')](_0x3fba0d[_0x662a('0x3a')],{'$or':_[_0x662a('0x2e')](_0x3fba0d['attributes'],function(_0x4fe109){var _0x4c114d={};_0x4c114d[_0x4fe109]={'$like':'%'+_0x86471f['query'][_0x662a('0x3c')]+'%'};return _0x4c114d;})});}_0x3fba0d=_['merge']({},_0x3fba0d,_0x86471f[_0x662a('0x48')]);return db['CmHopperBlack']['count']({'where':_0x3fba0d[_0x662a('0x3a')]})[_0x662a('0x23')](function(_0x1a8091){_0x3d5fd9[_0x662a('0x1d')]=_0x1a8091;if(_0x86471f['query'][_0x662a('0x40')]){_0x3fba0d['include']=[{'all':!![]}];}return db[_0x662a('0x61')][_0x662a('0x42')](_0x3fba0d);})[_0x662a('0x23')](function(_0x452a06){_0x3d5fd9[_0x662a('0x43')]=_0x452a06;return _0x3d5fd9;});}})[_0x662a('0x23')](respondWithFilteredResult(_0x4f741e,_0x3fba0d))[_0x662a('0x44')](handleError(_0x4f741e,null));};exports[_0x662a('0x62')]=function(_0x5da492,_0x53379e,_0x15ee14){var _0x3df7f9={};var _0x5e0dc7={};var _0x577716;var _0x55c3bb;return db['Campaign'][_0x662a('0x5f')]({'where':{'id':_0x5da492[_0x662a('0x45')]['id']}})['then'](handleEntityNotFound(_0x53379e,null))[_0x662a('0x23')](function(_0x39127c){if(_0x39127c){_0x577716=_0x39127c;_0x5e0dc7['model']=_[_0x662a('0x33')](db[_0x662a('0x63')][_0x662a('0x46')]);_0x5e0dc7[_0x662a('0x32')]=_[_0x662a('0x33')](_0x5da492[_0x662a('0x32')]);_0x5e0dc7[_0x662a('0x34')]=_['intersection'](_0x5e0dc7['model'],_0x5e0dc7[_0x662a('0x32')]);_0x3df7f9['attributes']=_[_0x662a('0x35')](_0x5e0dc7['model'],qs[_0x662a('0x36')](_0x5da492[_0x662a('0x32')][_0x662a('0x36')]));_0x3df7f9[_0x662a('0x37')]=_0x3df7f9[_0x662a('0x37')][_0x662a('0x47')]?_0x3df7f9['attributes']:_0x5e0dc7[_0x662a('0x31')];_0x3df7f9[_0x662a('0x5d')]=qs[_0x662a('0x39')](_0x5da492[_0x662a('0x32')][_0x662a('0x39')]);_0x3df7f9[_0x662a('0x3a')]=qs[_0x662a('0x34')](_[_0x662a('0x3b')](_0x5da492['query'],_0x5e0dc7[_0x662a('0x34')]));if(_0x5da492[_0x662a('0x32')][_0x662a('0x3c')]){_0x3df7f9[_0x662a('0x3a')]=_[_0x662a('0x3d')](_0x3df7f9[_0x662a('0x3a')],{'$or':_[_0x662a('0x2e')](_0x3df7f9[_0x662a('0x37')],function(_0x3845fe){var _0x434ebe={};_0x434ebe[_0x3845fe]={'$like':'%'+_0x5da492['query'][_0x662a('0x3c')]+'%'};return _0x434ebe;})});}_0x3df7f9=_['merge']({},_0x3df7f9,_0x5da492[_0x662a('0x48')]);return _0x577716[_0x662a('0x62')](_0x3df7f9);}})[_0x662a('0x23')](function(_0x38732d){if(_0x38732d){_0x55c3bb=_0x38732d[_0x662a('0x47')];if(!_0x5da492['query'][_0x662a('0x5c')](_0x662a('0x38'))){_0x3df7f9[_0x662a('0x1c')]=qs['limit'](_0x5da492['query'][_0x662a('0x1c')]);_0x3df7f9[_0x662a('0x1a')]=qs[_0x662a('0x1a')](_0x5da492[_0x662a('0x32')][_0x662a('0x1a')]);}return _0x577716[_0x662a('0x62')](_0x3df7f9);}})[_0x662a('0x23')](function(_0x3961f9){if(_0x3961f9){return _0x3961f9?{'count':_0x55c3bb,'rows':_0x3961f9}:null;}})[_0x662a('0x23')](respondWithResult(_0x53379e,null))[_0x662a('0x44')](handleError(_0x53379e,null));};exports['addLists']=function(_0x4027d1,_0x5564d9,_0xd51689){var _0x3eb299,_0x284863;return db['Campaign'][_0x662a('0x49')]({'where':{'id':_0x4027d1['params']['id']}})[_0x662a('0x23')](handleEntityNotFound(_0x5564d9,null))['then'](function(_0x4d4cc5){if(_0x4d4cc5){_0x284863=_0x4d4cc5;return _0x4d4cc5[_0x662a('0x64')](_0x4027d1[_0x662a('0x4b')][_0x662a('0x65')],_[_0x662a('0x54')](_0x4027d1[_0x662a('0x4b')],[_0x662a('0x65'),'id'])||{});}return null;})[_0x662a('0x66')](function(_0x5c36c2){var _0x2db234;_0x3eb299=_0x5c36c2||[];var _0x49b289=[];if(_0x5c36c2){for(var _0x58c189=0x0;_0x58c189<_0x5c36c2['length'];_0x58c189+=0x1){var _0x3d175d=_0x5c36c2[_0x58c189]['get']({'plain':!![]});_0x284863[_0x662a('0x67')]=_0x4027d1['body']['dialCheckDuplicateType']?_0x4027d1[_0x662a('0x4b')]['dialCheckDuplicateType']:_0x284863['dialCheckDuplicateType'];switch(_0x284863['dialCheckDuplicateType']){case'always':_0x2db234=squel[_0x662a('0x68')]()[_0x662a('0x69')](_0x662a('0x6a'))[_0x662a('0x6b')]([_0x662a('0x6c'),'scheduledAt',_0x662a('0x6d'),'ListId',_0x662a('0x58'),_0x662a('0x55'),'updatedAt'],squel[_0x662a('0x6e')]()[_0x662a('0x6f')](_0x662a('0x6c'),_0x662a('0x6c'))[_0x662a('0x6f')](_0x662a('0x70'),_0x662a('0x71'))[_0x662a('0x6f')]('id',_0x662a('0x6d'))[_0x662a('0x6f')](_0x3d175d[_0x662a('0x72')][_0x662a('0x73')](),'ListId')['field'](_0x4027d1[_0x662a('0x45')]['id'][_0x662a('0x73')](),_0x662a('0x58'))[_0x662a('0x6f')](_0x662a('0x70'),'createdAt')[_0x662a('0x6f')](_0x662a('0x70'),_0x662a('0x56'))[_0x662a('0x74')](_0x662a('0x75'))[_0x662a('0x3a')](_0x662a('0x76'))[_0x662a('0x3a')](_0x662a('0x77'),_0x3d175d[_0x662a('0x72')]['toString']())[_0x662a('0x3a')](_0x662a('0x78'))[_0x662a('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x662a('0x6f')](_0x662a('0x79'))[_0x662a('0x74')](_0x662a('0x7a'))[_0x662a('0x3a')](_0x662a('0x7b'),_0x4027d1['params']['id'][_0x662a('0x73')]()))[_0x662a('0x3a')](_0x662a('0x7c'),squel[_0x662a('0x6e')]()['field'](_0x662a('0x7d'))[_0x662a('0x74')](_0x662a('0x6a'))[_0x662a('0x3a')]('CampaignId\x20=\x20?',_0x4027d1[_0x662a('0x45')]['id'][_0x662a('0x73')]())))[_0x662a('0x73')]();break;case _0x662a('0x7e'):_0x2db234=squel['insert']()[_0x662a('0x69')](_0x662a('0x6a'))[_0x662a('0x6b')](['phone',_0x662a('0x71'),_0x662a('0x6d'),_0x662a('0x7f'),_0x662a('0x58'),_0x662a('0x55'),_0x662a('0x56')],squel['select']()[_0x662a('0x6f')](_0x662a('0x6c'),'phone')[_0x662a('0x6f')](_0x662a('0x70'),'scheduledAt')[_0x662a('0x6f')]('id','ContactId')['field'](_0x3d175d[_0x662a('0x72')][_0x662a('0x73')](),_0x662a('0x7f'))[_0x662a('0x6f')](_0x4027d1[_0x662a('0x45')]['id'][_0x662a('0x73')](),'CampaignId')[_0x662a('0x6f')](_0x662a('0x70'),_0x662a('0x55'))['field'](_0x662a('0x70'),_0x662a('0x56'))[_0x662a('0x74')]('cm_contacts')[_0x662a('0x3a')]('deletedAt\x20IS\x20NULL')[_0x662a('0x3a')](_0x662a('0x77'),_0x3d175d['CmListId'][_0x662a('0x73')]())[_0x662a('0x3a')](_0x662a('0x78'))[_0x662a('0x3a')](_0x662a('0x7c'),squel[_0x662a('0x6e')]()[_0x662a('0x6f')](_0x662a('0x7d'))['from'](_0x662a('0x6a'))[_0x662a('0x3a')](_0x662a('0x7b'),_0x4027d1['params']['id'][_0x662a('0x73')]())))[_0x662a('0x73')]();break;default:_0x2db234=squel[_0x662a('0x68')]()[_0x662a('0x69')]('cm_hopper')[_0x662a('0x6b')]([_0x662a('0x6c'),_0x662a('0x71'),_0x662a('0x6d'),'ListId',_0x662a('0x58'),'createdAt','updatedAt'],squel[_0x662a('0x6e')]()[_0x662a('0x6f')](_0x662a('0x6c'),_0x662a('0x6c'))[_0x662a('0x6f')]('NOW()',_0x662a('0x71'))['field']('id',_0x662a('0x6d'))[_0x662a('0x6f')](_0x3d175d[_0x662a('0x72')]['toString'](),_0x662a('0x7f'))[_0x662a('0x6f')](_0x4027d1[_0x662a('0x45')]['id'][_0x662a('0x73')](),_0x662a('0x58'))[_0x662a('0x6f')](_0x662a('0x70'),'createdAt')[_0x662a('0x6f')]('NOW()','updatedAt')['from'](_0x662a('0x75'))['where'](_0x662a('0x76'))[_0x662a('0x3a')]('ListId\x20=\x20?',_0x3d175d[_0x662a('0x72')][_0x662a('0x73')]())[_0x662a('0x3a')](_0x662a('0x78')))[_0x662a('0x73')]();}_0x49b289[_0x662a('0x80')](db[_0x662a('0x81')][_0x662a('0x32')](_0x2db234));}return BPromise[_0x662a('0x82')](_0x49b289);}})[_0x662a('0x23')](function(){return _0x3eb299;})[_0x662a('0x23')](respondWithResult(_0x5564d9,null))['catch'](handleError(_0x5564d9,null));};exports[_0x662a('0x83')]=function(_0x22b223,_0x48a4fd,_0x155e19){return db['Campaign']['find']({'where':{'id':_0x22b223[_0x662a('0x45')]['id']}})[_0x662a('0x23')](handleEntityNotFound(_0x48a4fd,null))[_0x662a('0x23')](function(_0x405e31){if(_0x405e31){return _0x405e31[_0x662a('0x83')](_0x22b223[_0x662a('0x32')][_0x662a('0x65')]);}})['then'](function(_0x5b3dfd){if(_0x5b3dfd){return db[_0x662a('0x59')][_0x662a('0x24')]({'where':{'ListId':_0x22b223['query'][_0x662a('0x65')],'CampaignId':_0x22b223[_0x662a('0x45')]['id']}})[_0x662a('0x23')](function(){return _0x5b3dfd;});}})[_0x662a('0x23')](respondWithStatusCode(_0x48a4fd,null))[_0x662a('0x44')](handleError(_0x48a4fd,null));};exports[_0x662a('0x84')]=function(_0x3726cb,_0x42d30a,_0x4b4bec){var _0x26bcfa={};var _0x17ce49={};var _0x36c0a3;var _0x974d6a;return db[_0x662a('0x2f')][_0x662a('0x5f')]({'where':{'id':_0x3726cb[_0x662a('0x45')]['id']}})['then'](handleEntityNotFound(_0x42d30a,null))[_0x662a('0x23')](function(_0x4b50d6){if(_0x4b50d6){_0x36c0a3=_0x4b50d6;_0x17ce49[_0x662a('0x31')]=_[_0x662a('0x33')](db['CmList'][_0x662a('0x46')]);_0x17ce49[_0x662a('0x32')]=_[_0x662a('0x33')](_0x3726cb[_0x662a('0x32')]);_0x17ce49['filters']=_[_0x662a('0x35')](_0x17ce49['model'],_0x17ce49['query']);_0x26bcfa['attributes']=_[_0x662a('0x35')](_0x17ce49[_0x662a('0x31')],qs[_0x662a('0x36')](_0x3726cb['query'][_0x662a('0x36')]));_0x26bcfa['attributes']=_0x26bcfa[_0x662a('0x37')]['length']?_0x26bcfa[_0x662a('0x37')]:_0x17ce49[_0x662a('0x31')];_0x26bcfa['order']=qs[_0x662a('0x39')](_0x3726cb['query']['sort']);_0x26bcfa[_0x662a('0x3a')]=qs['filters'](_[_0x662a('0x3b')](_0x3726cb['query'],_0x17ce49['filters']));if(_0x3726cb['query']['filter']){_0x26bcfa['where']=_[_0x662a('0x3d')](_0x26bcfa[_0x662a('0x3a')],{'$or':_['map'](_0x26bcfa[_0x662a('0x37')],function(_0x3e1e74){var _0x54800d={};_0x54800d[_0x3e1e74]={'$like':'%'+_0x3726cb['query'][_0x662a('0x3c')]+'%'};return _0x54800d;})});}_0x26bcfa=_[_0x662a('0x3d')]({},_0x26bcfa,_0x3726cb[_0x662a('0x48')]);return _0x36c0a3[_0x662a('0x84')](_0x26bcfa);}})[_0x662a('0x23')](function(_0x520def){if(_0x520def){_0x974d6a=_0x520def[_0x662a('0x47')];if(!_0x3726cb[_0x662a('0x32')]['hasOwnProperty'](_0x662a('0x38'))){_0x26bcfa[_0x662a('0x1c')]=qs[_0x662a('0x1c')](_0x3726cb[_0x662a('0x32')][_0x662a('0x1c')]);_0x26bcfa[_0x662a('0x1a')]=qs[_0x662a('0x1a')](_0x3726cb[_0x662a('0x32')][_0x662a('0x1a')]);}return _0x36c0a3[_0x662a('0x84')](_0x26bcfa);}})[_0x662a('0x23')](function(_0x2a4201){if(_0x2a4201){return _0x2a4201?{'count':_0x974d6a,'rows':_0x2a4201}:null;}})[_0x662a('0x23')](respondWithResult(_0x42d30a,null))[_0x662a('0x44')](handleError(_0x42d30a,null));};exports[_0x662a('0x85')]=function(_0xcbb7c9,_0x3aaece,_0x5423e3){var _0xc18e1c,_0x5e876f;return db['Campaign'][_0x662a('0x49')]({'where':{'id':_0xcbb7c9[_0x662a('0x45')]['id']}})['then'](handleEntityNotFound(_0x3aaece,null))[_0x662a('0x23')](function(_0x2898b8){if(_0x2898b8){_0x5e876f=_0x2898b8;return _0x2898b8[_0x662a('0x85')](_0xcbb7c9['body']['ids'],_[_0x662a('0x54')](_0xcbb7c9[_0x662a('0x4b')],['ids','id'])||{});}return null;})[_0x662a('0x66')](function(_0x54d643){var _0x4abdf3;_0xc18e1c=_0x54d643||[];var _0x1c3202=[];if(_0x54d643){for(var _0x4d6e79=0x0;_0x4d6e79<_0x54d643[_0x662a('0x47')];_0x4d6e79+=0x1){var _0x4cab06=_0x54d643[_0x4d6e79][_0x662a('0x25')]({'plain':!![]});_0x4abdf3=squel[_0x662a('0x68')]()['into']('cm_hopper_black')[_0x662a('0x6b')](['phone',_0x662a('0x6d'),_0x662a('0x7f'),_0x662a('0x58'),_0x662a('0x55'),'updatedAt'],squel[_0x662a('0x6e')]()[_0x662a('0x6f')](_0x662a('0x6c'),_0x662a('0x6c'))[_0x662a('0x6f')]('id',_0x662a('0x6d'))[_0x662a('0x6f')](_0x4cab06['CmListId'][_0x662a('0x73')](),_0x662a('0x7f'))[_0x662a('0x6f')](_0xcbb7c9['params']['id'][_0x662a('0x73')](),_0x662a('0x58'))[_0x662a('0x6f')](_0x662a('0x70'),'createdAt')[_0x662a('0x6f')](_0x662a('0x70'),_0x662a('0x56'))[_0x662a('0x74')](_0x662a('0x75'))[_0x662a('0x3a')](_0x662a('0x76'))[_0x662a('0x3a')](_0x662a('0x77'),_0x4cab06[_0x662a('0x72')][_0x662a('0x73')]())['where'](_0x662a('0x78')))[_0x662a('0x73')]();_0x1c3202[_0x662a('0x80')](db[_0x662a('0x81')][_0x662a('0x32')](_0x4abdf3));}return BPromise[_0x662a('0x82')](_0x1c3202);}})[_0x662a('0x23')](function(){return _0xc18e1c;})[_0x662a('0x23')](respondWithResult(_0x3aaece,null))[_0x662a('0x44')](handleError(_0x3aaece,null));};exports[_0x662a('0x86')]=function(_0x1999f4,_0x1c54e3,_0x1c8529){return db['Campaign'][_0x662a('0x49')]({'where':{'id':_0x1999f4[_0x662a('0x45')]['id']}})['then'](handleEntityNotFound(_0x1c54e3,null))[_0x662a('0x23')](function(_0x4ecc4a){if(_0x4ecc4a){return _0x4ecc4a[_0x662a('0x86')](_0x1999f4[_0x662a('0x32')][_0x662a('0x65')]);}})['then'](function(_0x51a22e){if(_0x51a22e){return db[_0x662a('0x61')]['destroy']({'where':{'ListId':_0x1999f4[_0x662a('0x32')][_0x662a('0x65')],'CampaignId':_0x1999f4[_0x662a('0x45')]['id']}})[_0x662a('0x23')](function(){return _0x51a22e;});}})[_0x662a('0x23')](respondWithStatusCode(_0x1c54e3,null))[_0x662a('0x44')](handleError(_0x1c54e3,null));}; \ No newline at end of file +var _0xbe35=['bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','status','end','offset','limit','set','Content-Range','json','apply','save','update','then','destroy','IvrCampaigns','UserProfileResource','sendStatus','error','stack','name','send','index','rawAttributes','key','model','map','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','Campaign','count','include','findAll','rows','catch','show','params','includeAll','find','create','body','user','get','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','getHoppers','findOne','CmHopper','CampaignId','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','CmList','getLists','addLists','ids','spread','dialCheckDuplicateType','into','cm_hopper','phone','scheduledAt','select','field','NOW()','ContactId','ListId','toString','from','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','CmListId','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','CampaignId\x20=\x20?','insert','fromQuery','push','sequelize','removeLists','getBlackLists','addBlackLists','cm_hopper_black','all','removeBlackLists','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1d9950,_0x22f390){var _0x259c7c=function(_0x41d36b){while(--_0x41d36b){_0x1d9950['push'](_0x1d9950['shift']());}};_0x259c7c(++_0x22f390);}(_0xbe35,0x82));var _0x5be3=function(_0x5a95fa,_0x4a2fc9){_0x5a95fa=_0x5a95fa-0x0;var _0x1a61b8=_0xbe35[_0x5a95fa];return _0x1a61b8;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5be3('0x0'));var zipdir=require(_0x5be3('0x1'));var jsonpatch=require(_0x5be3('0x2'));var rp=require(_0x5be3('0x3'));var moment=require(_0x5be3('0x4'));var BPromise=require(_0x5be3('0x5'));var Mustache=require(_0x5be3('0x6'));var util=require(_0x5be3('0x7'));var path=require(_0x5be3('0x8'));var sox=require(_0x5be3('0x9'));var csv=require(_0x5be3('0xa'));var ejs=require(_0x5be3('0xb'));var fs=require('fs');var fs_extra=require(_0x5be3('0xc'));var _=require(_0x5be3('0xd'));var squel=require('squel');var crypto=require(_0x5be3('0xe'));var jsforce=require(_0x5be3('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x5be3('0xa'));var querystring=require('querystring');var Papa=require(_0x5be3('0x10'));var Redis=require('ioredis');var authService=require(_0x5be3('0x11'));var qs=require(_0x5be3('0x12'));var as=require(_0x5be3('0x13'));var hardwareService=require(_0x5be3('0x14'));var logger=require('../../config/logger')(_0x5be3('0x15'));var utils=require(_0x5be3('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5be3('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5b5466,_0x12469a){_0x12469a=_0x12469a||0xcc;return function(_0x58245e){if(_0x58245e){return _0x5b5466['sendStatus'](_0x12469a);}return _0x5b5466[_0x5be3('0x18')](_0x12469a)[_0x5be3('0x19')]();};}function respondWithResult(_0x242d52,_0x21fde5){_0x21fde5=_0x21fde5||0xc8;return function(_0x411139){if(_0x411139){return _0x242d52[_0x5be3('0x18')](_0x21fde5)['json'](_0x411139);}};}function respondWithFilteredResult(_0xb589f8,_0xd36d4b){return function(_0x2a10e6){if(_0x2a10e6){var _0xd168fc=typeof _0xd36d4b[_0x5be3('0x1a')]==='undefined'&&typeof _0xd36d4b[_0x5be3('0x1b')]==='undefined';var _0x576510=_0x2a10e6['count'];var _0x252f10=_0xd168fc?0x0:_0xd36d4b[_0x5be3('0x1a')];var _0x57906a=_0xd168fc?_0x2a10e6['count']:_0xd36d4b[_0x5be3('0x1a')]+_0xd36d4b[_0x5be3('0x1b')];var _0x2088cc;if(_0x57906a>=_0x576510){_0x57906a=_0x576510;_0x2088cc=0xc8;}else{_0x2088cc=0xce;}_0xb589f8[_0x5be3('0x18')](_0x2088cc);return _0xb589f8[_0x5be3('0x1c')](_0x5be3('0x1d'),_0x252f10+'-'+_0x57906a+'/'+_0x576510)[_0x5be3('0x1e')](_0x2a10e6);}return null;};}function patchUpdates(_0xe47a52){return function(_0x4eb500){try{jsonpatch[_0x5be3('0x1f')](_0x4eb500,_0xe47a52,!![]);}catch(_0x155cba){return BPromise['reject'](_0x155cba);}return _0x4eb500[_0x5be3('0x20')]();};}function saveUpdates(_0x106198,_0x5d001d){return function(_0x1d7be4){if(_0x1d7be4){return _0x1d7be4[_0x5be3('0x21')](_0x106198)[_0x5be3('0x22')](function(_0x26b7f6){return _0x26b7f6;});}return null;};}function removeEntity(_0x3a0021,_0x4db19e){return function(_0x4e35b9){if(_0x4e35b9){return _0x4e35b9[_0x5be3('0x23')]()[_0x5be3('0x22')](function(){var _0x591f8f=_0x4e35b9['get']({'plain':!![]});var _0x5df2dc=_0x5be3('0x24');return db[_0x5be3('0x25')][_0x5be3('0x23')]({'where':{'type':_0x5df2dc,'resourceId':_0x591f8f['id']}})[_0x5be3('0x22')](function(){return _0x4e35b9;});})[_0x5be3('0x22')](function(){_0x3a0021[_0x5be3('0x18')](0xcc)[_0x5be3('0x19')]();});}};}function handleEntityNotFound(_0x334d06,_0x6af49){return function(_0x54b381){if(!_0x54b381){_0x334d06[_0x5be3('0x26')](0x194);}return _0x54b381;};}function handleError(_0x5756d2,_0x4daaf7){_0x4daaf7=_0x4daaf7||0x1f4;return function(_0x344637){logger[_0x5be3('0x27')](_0x344637[_0x5be3('0x28')]);if(_0x344637[_0x5be3('0x29')]){delete _0x344637[_0x5be3('0x29')];}_0x5756d2['status'](_0x4daaf7)[_0x5be3('0x2a')](_0x344637);};}exports[_0x5be3('0x2b')]=function(_0x5b01c9,_0x2885a8){var _0x273dbc={},_0x439277={},_0x45b4e9={'count':0x0,'rows':[]};var _0x4288b2=_['map'](db['Campaign'][_0x5be3('0x2c')],function(_0x2dd688){return{'name':_0x2dd688['fieldName'],'type':_0x2dd688['type'][_0x5be3('0x2d')]};});_0x439277[_0x5be3('0x2e')]=_[_0x5be3('0x2f')](_0x4288b2,_0x5be3('0x29'));_0x439277[_0x5be3('0x30')]=_[_0x5be3('0x31')](_0x5b01c9[_0x5be3('0x30')]);_0x439277['filters']=_[_0x5be3('0x32')](_0x439277[_0x5be3('0x2e')],_0x439277[_0x5be3('0x30')]);_0x273dbc[_0x5be3('0x33')]=_['intersection'](_0x439277[_0x5be3('0x2e')],qs[_0x5be3('0x34')](_0x5b01c9['query'][_0x5be3('0x34')]));_0x273dbc['attributes']=_0x273dbc[_0x5be3('0x33')][_0x5be3('0x35')]?_0x273dbc[_0x5be3('0x33')]:_0x439277[_0x5be3('0x2e')];if(!_0x5b01c9['query'][_0x5be3('0x36')](_0x5be3('0x37'))){_0x273dbc[_0x5be3('0x1b')]=qs[_0x5be3('0x1b')](_0x5b01c9[_0x5be3('0x30')]['limit']);_0x273dbc[_0x5be3('0x1a')]=qs[_0x5be3('0x1a')](_0x5b01c9[_0x5be3('0x30')][_0x5be3('0x1a')]);}_0x273dbc[_0x5be3('0x38')]=qs[_0x5be3('0x39')](_0x5b01c9['query'][_0x5be3('0x39')]);_0x273dbc['where']=qs[_0x5be3('0x3a')](_[_0x5be3('0x3b')](_0x5b01c9[_0x5be3('0x30')],_0x439277[_0x5be3('0x3a')]),_0x4288b2);if(_0x5b01c9['query'][_0x5be3('0x3c')]){_0x273dbc[_0x5be3('0x3d')]=_[_0x5be3('0x3e')](_0x273dbc[_0x5be3('0x3d')],{'$or':_[_0x5be3('0x2f')](_0x4288b2,function(_0x4946d3){if(_0x4946d3[_0x5be3('0x3f')]!==_0x5be3('0x40')){var _0x527c82={};_0x527c82[_0x4946d3[_0x5be3('0x29')]]={'$like':'%'+_0x5b01c9[_0x5be3('0x30')][_0x5be3('0x3c')]+'%'};return _0x527c82;}})});}_0x273dbc=_[_0x5be3('0x3e')]({},_0x273dbc,_0x5b01c9[_0x5be3('0x41')]);var _0x1e7b76={'where':_0x273dbc[_0x5be3('0x3d')]};return db[_0x5be3('0x42')][_0x5be3('0x43')](_0x1e7b76)[_0x5be3('0x22')](function(_0x19cffe){_0x45b4e9[_0x5be3('0x43')]=_0x19cffe;if(_0x5b01c9['query']['includeAll']){_0x273dbc[_0x5be3('0x44')]=[{'all':!![]}];}return db[_0x5be3('0x42')][_0x5be3('0x45')](_0x273dbc);})[_0x5be3('0x22')](function(_0x487c93){_0x45b4e9[_0x5be3('0x46')]=_0x487c93;return _0x45b4e9;})[_0x5be3('0x22')](respondWithFilteredResult(_0x2885a8,_0x273dbc))[_0x5be3('0x47')](handleError(_0x2885a8,null));};exports[_0x5be3('0x48')]=function(_0x42c48b,_0x3eb0b9){var _0x1725d2={'raw':![],'where':{'id':_0x42c48b[_0x5be3('0x49')]['id']}},_0x3e120c={};_0x3e120c[_0x5be3('0x2e')]=_[_0x5be3('0x31')](db[_0x5be3('0x42')][_0x5be3('0x2c')]);_0x3e120c[_0x5be3('0x30')]=_[_0x5be3('0x31')](_0x42c48b[_0x5be3('0x30')]);_0x3e120c[_0x5be3('0x3a')]=_['intersection'](_0x3e120c[_0x5be3('0x2e')],_0x3e120c[_0x5be3('0x30')]);_0x1725d2[_0x5be3('0x33')]=_[_0x5be3('0x32')](_0x3e120c[_0x5be3('0x2e')],qs[_0x5be3('0x34')](_0x42c48b[_0x5be3('0x30')][_0x5be3('0x34')]));_0x1725d2[_0x5be3('0x33')]=_0x1725d2[_0x5be3('0x33')]['length']?_0x1725d2[_0x5be3('0x33')]:_0x3e120c[_0x5be3('0x2e')];if(_0x42c48b['query'][_0x5be3('0x4a')]){_0x1725d2[_0x5be3('0x44')]=[{'all':!![]}];}_0x1725d2=_['merge']({},_0x1725d2,_0x42c48b[_0x5be3('0x41')]);return db[_0x5be3('0x42')][_0x5be3('0x4b')](_0x1725d2)[_0x5be3('0x22')](handleEntityNotFound(_0x3eb0b9,null))[_0x5be3('0x22')](respondWithResult(_0x3eb0b9,null))['catch'](handleError(_0x3eb0b9,null));};exports[_0x5be3('0x4c')]=function(_0x4e04de,_0x5aa29){return db[_0x5be3('0x42')][_0x5be3('0x4c')](_0x4e04de[_0x5be3('0x4d')],{})['then'](function(_0x1e83f8){var _0x472d9a=_0x4e04de[_0x5be3('0x4e')][_0x5be3('0x4f')]({'plain':!![]});if(!_0x472d9a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x472d9a[_0x5be3('0x50')]===_0x5be3('0x4e')){var _0x36a875=_0x1e83f8['get']({'plain':!![]});var _0x16fd48=_0x5be3('0x24');return db[_0x5be3('0x51')]['find']({'where':{'name':_0x16fd48,'userProfileId':_0x472d9a[_0x5be3('0x52')]},'raw':!![]})[_0x5be3('0x22')](function(_0x14d006){if(_0x14d006&&_0x14d006[_0x5be3('0x53')]===0x0){return db[_0x5be3('0x25')][_0x5be3('0x4c')]({'name':_0x36a875[_0x5be3('0x29')],'resourceId':_0x36a875['id'],'type':_0x14d006[_0x5be3('0x29')],'sectionId':_0x14d006['id']},{})['then'](function(){return _0x1e83f8;});}else{return _0x1e83f8;}})[_0x5be3('0x47')](function(_0x152c2a){logger[_0x5be3('0x27')](_0x5be3('0x54'),_0x152c2a);throw _0x152c2a;});}return _0x1e83f8;})['then'](respondWithResult(_0x5aa29,0xc9))[_0x5be3('0x47')](handleError(_0x5aa29,null));};exports['clone']=function(_0x377f9f,_0x518b13){var _0x3bb23b={'where':{'id':_0x377f9f['params']['id']}},_0x2ab68d={};_0x2ab68d[_0x5be3('0x2e')]=_['keys'](db[_0x5be3('0x42')][_0x5be3('0x2c')]);_0x3bb23b['attributes']=_['intersection'](_0x2ab68d[_0x5be3('0x2e')],qs['fields'](_0x377f9f['query'][_0x5be3('0x34')]));_0x3bb23b[_0x5be3('0x33')]=_0x3bb23b[_0x5be3('0x33')]['length']?_0x3bb23b[_0x5be3('0x33')]:_0x2ab68d[_0x5be3('0x2e')];if(_0x377f9f[_0x5be3('0x30')]['includeAll']){_0x3bb23b[_0x5be3('0x44')]=[{'all':!![]}];}_0x3bb23b=_[_0x5be3('0x3e')]({},_0x3bb23b,_0x377f9f[_0x5be3('0x41')]);return db[_0x5be3('0x42')]['find'](_0x3bb23b)[_0x5be3('0x22')](handleEntityNotFound(_0x518b13,null))['then'](function(_0x3295b9){if(_0x3295b9){var _0x5e060e=_0x3295b9[_0x5be3('0x4f')]({'plain':!![]});_0x5e060e=qs[_0x5be3('0x55')](_0x5e060e,['id','createdAt','updatedAt']);_0x377f9f[_0x5be3('0x4d')]=_[_0x5be3('0x55')](_0x377f9f[_0x5be3('0x4d')],['id',_0x5be3('0x56'),_0x5be3('0x57')]);return db[_0x5be3('0x42')][_0x5be3('0x4c')](_['merge'](_0x5e060e,_0x377f9f[_0x5be3('0x4d')]),{'include':_0x377f9f['query'][_0x5be3('0x4a')]?[{'all':!![]}]:undefined})[_0x5be3('0x22')](function(_0x1511c8){var _0x52d73d=_0x377f9f[_0x5be3('0x4e')][_0x5be3('0x4f')]({'plain':!![]});if(!_0x52d73d)throw new Error(_0x5be3('0x58'));if(_0x52d73d[_0x5be3('0x50')]===_0x5be3('0x4e')){var _0xa3bd25=_0x1511c8['get']({'plain':!![]});var _0x4b8d2c=_0x5be3('0x24');return db[_0x5be3('0x51')][_0x5be3('0x4b')]({'where':{'name':_0x4b8d2c,'userProfileId':_0x52d73d[_0x5be3('0x52')]},'raw':!![]})['then'](function(_0x324dfb){if(_0x324dfb&&_0x324dfb['autoAssociation']===0x0){return db[_0x5be3('0x25')][_0x5be3('0x4c')]({'name':_0xa3bd25['name'],'resourceId':_0xa3bd25['id'],'type':_0x324dfb[_0x5be3('0x29')],'sectionId':_0x324dfb['id']},{})[_0x5be3('0x22')](function(){return _0x1511c8;});}else{return _0x1511c8;}})[_0x5be3('0x47')](function(_0x5477c0){logger[_0x5be3('0x27')](_0x5be3('0x54'),_0x5477c0);throw _0x5477c0;});}return _0x1511c8;});}})['then'](respondWithResult(_0x518b13,0xc9))[_0x5be3('0x47')](handleError(_0x518b13,null));};exports[_0x5be3('0x21')]=function(_0x28976e,_0x4f3691){if(_0x28976e[_0x5be3('0x4d')]['id']){delete _0x28976e[_0x5be3('0x4d')]['id'];}return db[_0x5be3('0x42')][_0x5be3('0x4b')]({'where':{'id':_0x28976e['params']['id']}})['then'](handleEntityNotFound(_0x4f3691,null))[_0x5be3('0x22')](saveUpdates(_0x28976e[_0x5be3('0x4d')],null))[_0x5be3('0x22')](respondWithResult(_0x4f3691,null))[_0x5be3('0x47')](handleError(_0x4f3691,null));};exports[_0x5be3('0x23')]=function(_0x1e04c8,_0x11bda5){return db['Campaign']['find']({'where':{'id':_0x1e04c8['params']['id']}})[_0x5be3('0x22')](handleEntityNotFound(_0x11bda5,null))['then'](removeEntity(_0x11bda5,null))[_0x5be3('0x47')](handleError(_0x11bda5,null));};exports[_0x5be3('0x59')]=function(_0x3fce99,_0x8701f2,_0x3fbea2){var _0x946850={'raw':!![],'where':{}};var _0x403efa={};var _0x2a16ce={'count':0x0,'rows':[]};return db[_0x5be3('0x42')][_0x5be3('0x5a')]({'where':{'id':_0x3fce99['params']['id']}})[_0x5be3('0x22')](handleEntityNotFound(_0x8701f2,null))[_0x5be3('0x22')](function(_0x5d3f35){if(_0x5d3f35){_0x403efa[_0x5be3('0x2e')]=_[_0x5be3('0x31')](db[_0x5be3('0x5b')][_0x5be3('0x2c')]);_0x403efa[_0x5be3('0x30')]=_['keys'](_0x3fce99[_0x5be3('0x30')]);_0x403efa[_0x5be3('0x3a')]=_[_0x5be3('0x32')](_0x403efa[_0x5be3('0x2e')],_0x403efa['query']);_0x946850[_0x5be3('0x33')]=_[_0x5be3('0x32')](_0x403efa['model'],qs[_0x5be3('0x34')](_0x3fce99[_0x5be3('0x30')][_0x5be3('0x34')]));_0x946850[_0x5be3('0x33')]=_0x946850[_0x5be3('0x33')][_0x5be3('0x35')]?_0x946850[_0x5be3('0x33')]:_0x403efa[_0x5be3('0x2e')];if(!_0x3fce99['query'][_0x5be3('0x36')](_0x5be3('0x37'))){_0x946850['limit']=qs[_0x5be3('0x1b')](_0x3fce99[_0x5be3('0x30')][_0x5be3('0x1b')]);_0x946850[_0x5be3('0x1a')]=qs[_0x5be3('0x1a')](_0x3fce99[_0x5be3('0x30')][_0x5be3('0x1a')]);}_0x946850[_0x5be3('0x38')]=qs[_0x5be3('0x39')](_0x3fce99[_0x5be3('0x30')]['sort']);_0x946850[_0x5be3('0x3d')]=qs[_0x5be3('0x3a')](_[_0x5be3('0x3b')](_0x3fce99[_0x5be3('0x30')],_0x403efa[_0x5be3('0x3a')]));_0x946850[_0x5be3('0x3d')][_0x5be3('0x5c')]=_0x5d3f35['id'];if(_0x3fce99[_0x5be3('0x30')][_0x5be3('0x3c')]){_0x946850[_0x5be3('0x3d')]=_[_0x5be3('0x3e')](_0x946850['where'],{'$or':_[_0x5be3('0x2f')](_0x946850[_0x5be3('0x33')],function(_0x2fcb03){var _0x54d320={};_0x54d320[_0x2fcb03]={'$like':'%'+_0x3fce99[_0x5be3('0x30')][_0x5be3('0x3c')]+'%'};return _0x54d320;})});}_0x946850=_[_0x5be3('0x3e')]({},_0x946850,_0x3fce99[_0x5be3('0x41')]);return db['CmHopper'][_0x5be3('0x43')]({'where':_0x946850[_0x5be3('0x3d')]})['then'](function(_0x11f841){_0x2a16ce[_0x5be3('0x43')]=_0x11f841;if(_0x3fce99['query'][_0x5be3('0x4a')]){_0x946850[_0x5be3('0x44')]=[{'all':!![]}];}return db['CmHopper'][_0x5be3('0x45')](_0x946850);})[_0x5be3('0x22')](function(_0x290af9){_0x2a16ce[_0x5be3('0x46')]=_0x290af9;return _0x2a16ce;});}})['then'](respondWithFilteredResult(_0x8701f2,_0x946850))[_0x5be3('0x47')](handleError(_0x8701f2,null));};exports[_0x5be3('0x5d')]=function(_0x496281,_0x7f94f1,_0x1cf1a8){var _0x4f6f51={'raw':!![],'where':{}};var _0x424bfb={};var _0x2efc22={'count':0x0,'rows':[]};return db[_0x5be3('0x42')][_0x5be3('0x5a')]({'where':{'id':_0x496281['params']['id']}})['then'](handleEntityNotFound(_0x7f94f1,null))[_0x5be3('0x22')](function(_0x14d019){if(_0x14d019){_0x424bfb[_0x5be3('0x2e')]=_[_0x5be3('0x31')](db[_0x5be3('0x5e')][_0x5be3('0x2c')]);_0x424bfb[_0x5be3('0x30')]=_[_0x5be3('0x31')](_0x496281[_0x5be3('0x30')]);_0x424bfb[_0x5be3('0x3a')]=_[_0x5be3('0x32')](_0x424bfb['model'],_0x424bfb[_0x5be3('0x30')]);_0x4f6f51[_0x5be3('0x33')]=_[_0x5be3('0x32')](_0x424bfb[_0x5be3('0x2e')],qs[_0x5be3('0x34')](_0x496281[_0x5be3('0x30')][_0x5be3('0x34')]));_0x4f6f51['attributes']=_0x4f6f51[_0x5be3('0x33')][_0x5be3('0x35')]?_0x4f6f51[_0x5be3('0x33')]:_0x424bfb[_0x5be3('0x2e')];if(!_0x496281[_0x5be3('0x30')]['hasOwnProperty']('nolimit')){_0x4f6f51[_0x5be3('0x1b')]=qs[_0x5be3('0x1b')](_0x496281[_0x5be3('0x30')][_0x5be3('0x1b')]);_0x4f6f51['offset']=qs[_0x5be3('0x1a')](_0x496281['query'][_0x5be3('0x1a')]);}_0x4f6f51[_0x5be3('0x38')]=qs[_0x5be3('0x39')](_0x496281[_0x5be3('0x30')][_0x5be3('0x39')]);_0x4f6f51[_0x5be3('0x3d')]=qs[_0x5be3('0x3a')](_[_0x5be3('0x3b')](_0x496281['query'],_0x424bfb[_0x5be3('0x3a')]));_0x4f6f51[_0x5be3('0x3d')]['CampaignId']=_0x14d019['id'];if(_0x496281[_0x5be3('0x30')][_0x5be3('0x3c')]){_0x4f6f51[_0x5be3('0x3d')]=_[_0x5be3('0x3e')](_0x4f6f51[_0x5be3('0x3d')],{'$or':_['map'](_0x4f6f51['attributes'],function(_0xc5201d){var _0x554834={};_0x554834[_0xc5201d]={'$like':'%'+_0x496281['query'][_0x5be3('0x3c')]+'%'};return _0x554834;})});}_0x4f6f51=_['merge']({},_0x4f6f51,_0x496281['options']);return db[_0x5be3('0x5e')][_0x5be3('0x43')]({'where':_0x4f6f51[_0x5be3('0x3d')]})[_0x5be3('0x22')](function(_0x2c8d7f){_0x2efc22[_0x5be3('0x43')]=_0x2c8d7f;if(_0x496281[_0x5be3('0x30')][_0x5be3('0x4a')]){_0x4f6f51[_0x5be3('0x44')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x5be3('0x45')](_0x4f6f51);})['then'](function(_0x58468e){_0x2efc22[_0x5be3('0x46')]=_0x58468e;return _0x2efc22;});}})[_0x5be3('0x22')](respondWithFilteredResult(_0x7f94f1,_0x4f6f51))[_0x5be3('0x47')](handleError(_0x7f94f1,null));};exports[_0x5be3('0x5f')]=function(_0x322e00,_0x533ad8,_0x1cdf8f){var _0xad05a8={'raw':!![],'where':{}};var _0x3908a0={};var _0x395ae1={'count':0x0,'rows':[]};return db[_0x5be3('0x42')]['findOne']({'where':{'id':_0x322e00[_0x5be3('0x49')]['id']}})[_0x5be3('0x22')](handleEntityNotFound(_0x533ad8,null))[_0x5be3('0x22')](function(_0x9f6a54){if(_0x9f6a54){_0x3908a0[_0x5be3('0x2e')]=_[_0x5be3('0x31')](db['CmHopperFinal'][_0x5be3('0x2c')]);_0x3908a0[_0x5be3('0x30')]=_[_0x5be3('0x31')](_0x322e00['query']);_0x3908a0[_0x5be3('0x3a')]=_['intersection'](_0x3908a0[_0x5be3('0x2e')],_0x3908a0['query']);_0xad05a8[_0x5be3('0x33')]=_[_0x5be3('0x32')](_0x3908a0[_0x5be3('0x2e')],qs[_0x5be3('0x34')](_0x322e00[_0x5be3('0x30')][_0x5be3('0x34')]));_0xad05a8[_0x5be3('0x33')]=_0xad05a8[_0x5be3('0x33')][_0x5be3('0x35')]?_0xad05a8[_0x5be3('0x33')]:_0x3908a0[_0x5be3('0x2e')];if(!_0x322e00[_0x5be3('0x30')][_0x5be3('0x36')](_0x5be3('0x37'))){_0xad05a8[_0x5be3('0x1b')]=qs[_0x5be3('0x1b')](_0x322e00[_0x5be3('0x30')][_0x5be3('0x1b')]);_0xad05a8[_0x5be3('0x1a')]=qs[_0x5be3('0x1a')](_0x322e00[_0x5be3('0x30')][_0x5be3('0x1a')]);}_0xad05a8[_0x5be3('0x38')]=qs[_0x5be3('0x39')](_0x322e00[_0x5be3('0x30')][_0x5be3('0x39')]);_0xad05a8[_0x5be3('0x3d')]=qs[_0x5be3('0x3a')](_[_0x5be3('0x3b')](_0x322e00['query'],_0x3908a0[_0x5be3('0x3a')]));_0xad05a8[_0x5be3('0x3d')][_0x5be3('0x5c')]=_0x9f6a54['id'];if(_0x322e00['query'][_0x5be3('0x3c')]){_0xad05a8[_0x5be3('0x3d')]=_[_0x5be3('0x3e')](_0xad05a8[_0x5be3('0x3d')],{'$or':_[_0x5be3('0x2f')](_0xad05a8[_0x5be3('0x33')],function(_0x1432c7){var _0x42e4dd={};_0x42e4dd[_0x1432c7]={'$like':'%'+_0x322e00['query'][_0x5be3('0x3c')]+'%'};return _0x42e4dd;})});}_0xad05a8=_['merge']({},_0xad05a8,_0x322e00['options']);return db[_0x5be3('0x60')][_0x5be3('0x43')]({'where':_0xad05a8[_0x5be3('0x3d')]})[_0x5be3('0x22')](function(_0x4341d0){_0x395ae1[_0x5be3('0x43')]=_0x4341d0;if(_0x322e00[_0x5be3('0x30')][_0x5be3('0x4a')]){_0xad05a8['include']=[{'all':!![]}];}return db[_0x5be3('0x60')]['findAll'](_0xad05a8);})[_0x5be3('0x22')](function(_0x5025ca){_0x395ae1['rows']=_0x5025ca;return _0x395ae1;});}})[_0x5be3('0x22')](respondWithFilteredResult(_0x533ad8,_0xad05a8))[_0x5be3('0x47')](handleError(_0x533ad8,null));};exports[_0x5be3('0x61')]=function(_0x2418c2,_0x1b05ed,_0x59a45f){var _0x203013={'raw':!![],'where':{}};var _0x192a5e={};var _0x291bdb={'count':0x0,'rows':[]};return db[_0x5be3('0x42')][_0x5be3('0x5a')]({'where':{'id':_0x2418c2['params']['id']}})[_0x5be3('0x22')](handleEntityNotFound(_0x1b05ed,null))[_0x5be3('0x22')](function(_0x2d2eab){if(_0x2d2eab){_0x192a5e['model']=_['keys'](db[_0x5be3('0x62')][_0x5be3('0x2c')]);_0x192a5e[_0x5be3('0x30')]=_[_0x5be3('0x31')](_0x2418c2[_0x5be3('0x30')]);_0x192a5e[_0x5be3('0x3a')]=_[_0x5be3('0x32')](_0x192a5e['model'],_0x192a5e[_0x5be3('0x30')]);_0x203013[_0x5be3('0x33')]=_[_0x5be3('0x32')](_0x192a5e[_0x5be3('0x2e')],qs[_0x5be3('0x34')](_0x2418c2[_0x5be3('0x30')][_0x5be3('0x34')]));_0x203013[_0x5be3('0x33')]=_0x203013[_0x5be3('0x33')][_0x5be3('0x35')]?_0x203013[_0x5be3('0x33')]:_0x192a5e['model'];if(!_0x2418c2[_0x5be3('0x30')][_0x5be3('0x36')](_0x5be3('0x37'))){_0x203013[_0x5be3('0x1b')]=qs['limit'](_0x2418c2[_0x5be3('0x30')][_0x5be3('0x1b')]);_0x203013[_0x5be3('0x1a')]=qs['offset'](_0x2418c2[_0x5be3('0x30')][_0x5be3('0x1a')]);}_0x203013[_0x5be3('0x38')]=qs['sort'](_0x2418c2['query'][_0x5be3('0x39')]);_0x203013['where']=qs[_0x5be3('0x3a')](_[_0x5be3('0x3b')](_0x2418c2[_0x5be3('0x30')],_0x192a5e[_0x5be3('0x3a')]));_0x203013[_0x5be3('0x3d')]['CampaignId']=_0x2d2eab['id'];if(_0x2418c2['query'][_0x5be3('0x3c')]){_0x203013[_0x5be3('0x3d')]=_[_0x5be3('0x3e')](_0x203013[_0x5be3('0x3d')],{'$or':_[_0x5be3('0x2f')](_0x203013[_0x5be3('0x33')],function(_0x12ce9a){var _0x1b4492={};_0x1b4492[_0x12ce9a]={'$like':'%'+_0x2418c2[_0x5be3('0x30')][_0x5be3('0x3c')]+'%'};return _0x1b4492;})});}_0x203013=_[_0x5be3('0x3e')]({},_0x203013,_0x2418c2[_0x5be3('0x41')]);return db[_0x5be3('0x62')][_0x5be3('0x43')]({'where':_0x203013['where']})[_0x5be3('0x22')](function(_0x2b9c46){_0x291bdb[_0x5be3('0x43')]=_0x2b9c46;if(_0x2418c2[_0x5be3('0x30')][_0x5be3('0x4a')]){_0x203013['include']=[{'all':!![]}];}return db[_0x5be3('0x62')][_0x5be3('0x45')](_0x203013);})['then'](function(_0x488cf5){_0x291bdb[_0x5be3('0x46')]=_0x488cf5;return _0x291bdb;});}})[_0x5be3('0x22')](respondWithFilteredResult(_0x1b05ed,_0x203013))[_0x5be3('0x47')](handleError(_0x1b05ed,null));};exports['getLists']=function(_0x23c7d6,_0x4e8bdb,_0x53f0e){var _0x28ba02={};var _0x401dfb={};var _0x475159;var _0x7a387e;return db['Campaign'][_0x5be3('0x5a')]({'where':{'id':_0x23c7d6[_0x5be3('0x49')]['id']}})[_0x5be3('0x22')](handleEntityNotFound(_0x4e8bdb,null))[_0x5be3('0x22')](function(_0x2a4635){if(_0x2a4635){_0x475159=_0x2a4635;_0x401dfb[_0x5be3('0x2e')]=_[_0x5be3('0x31')](db[_0x5be3('0x63')][_0x5be3('0x2c')]);_0x401dfb['query']=_['keys'](_0x23c7d6[_0x5be3('0x30')]);_0x401dfb[_0x5be3('0x3a')]=_['intersection'](_0x401dfb[_0x5be3('0x2e')],_0x401dfb[_0x5be3('0x30')]);_0x28ba02[_0x5be3('0x33')]=_[_0x5be3('0x32')](_0x401dfb[_0x5be3('0x2e')],qs[_0x5be3('0x34')](_0x23c7d6['query']['fields']));_0x28ba02[_0x5be3('0x33')]=_0x28ba02['attributes'][_0x5be3('0x35')]?_0x28ba02[_0x5be3('0x33')]:_0x401dfb['model'];_0x28ba02[_0x5be3('0x38')]=qs[_0x5be3('0x39')](_0x23c7d6[_0x5be3('0x30')][_0x5be3('0x39')]);_0x28ba02[_0x5be3('0x3d')]=qs['filters'](_[_0x5be3('0x3b')](_0x23c7d6[_0x5be3('0x30')],_0x401dfb[_0x5be3('0x3a')]));if(_0x23c7d6['query']['filter']){_0x28ba02[_0x5be3('0x3d')]=_['merge'](_0x28ba02[_0x5be3('0x3d')],{'$or':_[_0x5be3('0x2f')](_0x28ba02['attributes'],function(_0x259432){var _0x1447df={};_0x1447df[_0x259432]={'$like':'%'+_0x23c7d6['query'][_0x5be3('0x3c')]+'%'};return _0x1447df;})});}_0x28ba02=_[_0x5be3('0x3e')]({},_0x28ba02,_0x23c7d6[_0x5be3('0x41')]);return _0x475159[_0x5be3('0x64')](_0x28ba02);}})[_0x5be3('0x22')](function(_0x5d73d4){if(_0x5d73d4){_0x7a387e=_0x5d73d4[_0x5be3('0x35')];if(!_0x23c7d6[_0x5be3('0x30')]['hasOwnProperty']('nolimit')){_0x28ba02[_0x5be3('0x1b')]=qs[_0x5be3('0x1b')](_0x23c7d6['query'][_0x5be3('0x1b')]);_0x28ba02[_0x5be3('0x1a')]=qs['offset'](_0x23c7d6[_0x5be3('0x30')][_0x5be3('0x1a')]);}return _0x475159[_0x5be3('0x64')](_0x28ba02);}})[_0x5be3('0x22')](function(_0x35e83e){if(_0x35e83e){return _0x35e83e?{'count':_0x7a387e,'rows':_0x35e83e}:null;}})['then'](respondWithResult(_0x4e8bdb,null))[_0x5be3('0x47')](handleError(_0x4e8bdb,null));};exports['addLists']=function(_0x202653,_0x4e9e5f,_0x10bd29){var _0x11cfcd,_0xdf8296;return db[_0x5be3('0x42')][_0x5be3('0x4b')]({'where':{'id':_0x202653[_0x5be3('0x49')]['id']}})[_0x5be3('0x22')](handleEntityNotFound(_0x4e9e5f,null))[_0x5be3('0x22')](function(_0x13cc72){if(_0x13cc72){_0xdf8296=_0x13cc72;return _0x13cc72[_0x5be3('0x65')](_0x202653['body'][_0x5be3('0x66')],_[_0x5be3('0x55')](_0x202653[_0x5be3('0x4d')],[_0x5be3('0x66'),'id'])||{});}return null;})[_0x5be3('0x67')](function(_0x4778ce){var _0x575bf9;_0x11cfcd=_0x4778ce||[];var _0x2fe4cd=[];if(_0x4778ce){for(var _0x2e0872=0x0;_0x2e0872<_0x4778ce[_0x5be3('0x35')];_0x2e0872+=0x1){var _0x524a4d=_0x4778ce[_0x2e0872][_0x5be3('0x4f')]({'plain':!![]});_0xdf8296[_0x5be3('0x68')]=_0x202653[_0x5be3('0x4d')][_0x5be3('0x68')]?_0x202653['body'][_0x5be3('0x68')]:_0xdf8296['dialCheckDuplicateType'];switch(_0xdf8296[_0x5be3('0x68')]){case'always':_0x575bf9=squel['insert']()[_0x5be3('0x69')](_0x5be3('0x6a'))['fromQuery']([_0x5be3('0x6b'),_0x5be3('0x6c'),'ContactId','ListId',_0x5be3('0x5c'),_0x5be3('0x56'),_0x5be3('0x57')],squel[_0x5be3('0x6d')]()['field']('phone','phone')[_0x5be3('0x6e')](_0x5be3('0x6f'),_0x5be3('0x6c'))['field']('id',_0x5be3('0x70'))['field'](_0x524a4d['CmListId']['toString'](),_0x5be3('0x71'))[_0x5be3('0x6e')](_0x202653['params']['id'][_0x5be3('0x72')](),_0x5be3('0x5c'))[_0x5be3('0x6e')]('NOW()',_0x5be3('0x56'))[_0x5be3('0x6e')](_0x5be3('0x6f'),_0x5be3('0x57'))[_0x5be3('0x73')](_0x5be3('0x74'))['where'](_0x5be3('0x75'))[_0x5be3('0x3d')](_0x5be3('0x76'),_0x524a4d[_0x5be3('0x77')]['toString']())[_0x5be3('0x3d')](_0x5be3('0x78'))[_0x5be3('0x3d')](_0x5be3('0x79'),squel[_0x5be3('0x6d')]()[_0x5be3('0x6e')](_0x5be3('0x7a'))[_0x5be3('0x73')]('cm_hopper_final')[_0x5be3('0x3d')]('CampaignId\x20=\x20?',_0x202653[_0x5be3('0x49')]['id'][_0x5be3('0x72')]()))[_0x5be3('0x3d')](_0x5be3('0x79'),squel[_0x5be3('0x6d')]()[_0x5be3('0x6e')](_0x5be3('0x7b'))['from'](_0x5be3('0x6a'))[_0x5be3('0x3d')](_0x5be3('0x7c'),_0x202653[_0x5be3('0x49')]['id'][_0x5be3('0x72')]())))[_0x5be3('0x72')]();break;case'onlyIfOpen':_0x575bf9=squel[_0x5be3('0x7d')]()[_0x5be3('0x69')]('cm_hopper')[_0x5be3('0x7e')]([_0x5be3('0x6b'),'scheduledAt',_0x5be3('0x70'),'ListId',_0x5be3('0x5c'),_0x5be3('0x56'),_0x5be3('0x57')],squel['select']()[_0x5be3('0x6e')]('phone',_0x5be3('0x6b'))[_0x5be3('0x6e')](_0x5be3('0x6f'),_0x5be3('0x6c'))['field']('id','ContactId')[_0x5be3('0x6e')](_0x524a4d[_0x5be3('0x77')][_0x5be3('0x72')](),_0x5be3('0x71'))[_0x5be3('0x6e')](_0x202653['params']['id'][_0x5be3('0x72')](),_0x5be3('0x5c'))['field'](_0x5be3('0x6f'),_0x5be3('0x56'))[_0x5be3('0x6e')](_0x5be3('0x6f'),_0x5be3('0x57'))['from'](_0x5be3('0x74'))[_0x5be3('0x3d')](_0x5be3('0x75'))[_0x5be3('0x3d')]('ListId\x20=\x20?',_0x524a4d[_0x5be3('0x77')]['toString']())[_0x5be3('0x3d')](_0x5be3('0x78'))[_0x5be3('0x3d')](_0x5be3('0x79'),squel['select']()['field'](_0x5be3('0x7b'))[_0x5be3('0x73')](_0x5be3('0x6a'))[_0x5be3('0x3d')](_0x5be3('0x7c'),_0x202653[_0x5be3('0x49')]['id'][_0x5be3('0x72')]())))[_0x5be3('0x72')]();break;default:_0x575bf9=squel[_0x5be3('0x7d')]()[_0x5be3('0x69')]('cm_hopper')[_0x5be3('0x7e')]([_0x5be3('0x6b'),_0x5be3('0x6c'),_0x5be3('0x70'),_0x5be3('0x71'),_0x5be3('0x5c'),'createdAt','updatedAt'],squel['select']()[_0x5be3('0x6e')](_0x5be3('0x6b'),_0x5be3('0x6b'))['field'](_0x5be3('0x6f'),_0x5be3('0x6c'))['field']('id','ContactId')['field'](_0x524a4d[_0x5be3('0x77')][_0x5be3('0x72')](),'ListId')[_0x5be3('0x6e')](_0x202653[_0x5be3('0x49')]['id'][_0x5be3('0x72')](),_0x5be3('0x5c'))[_0x5be3('0x6e')](_0x5be3('0x6f'),_0x5be3('0x56'))['field'](_0x5be3('0x6f'),_0x5be3('0x57'))[_0x5be3('0x73')](_0x5be3('0x74'))['where'](_0x5be3('0x75'))[_0x5be3('0x3d')](_0x5be3('0x76'),_0x524a4d['CmListId'][_0x5be3('0x72')]())[_0x5be3('0x3d')](_0x5be3('0x78')))[_0x5be3('0x72')]();}_0x2fe4cd[_0x5be3('0x7f')](db[_0x5be3('0x80')][_0x5be3('0x30')](_0x575bf9));}return BPromise['all'](_0x2fe4cd);}})[_0x5be3('0x22')](function(){return _0x11cfcd;})[_0x5be3('0x22')](respondWithResult(_0x4e9e5f,null))[_0x5be3('0x47')](handleError(_0x4e9e5f,null));};exports[_0x5be3('0x81')]=function(_0x1f2444,_0x41a95b,_0x534add){return db['Campaign'][_0x5be3('0x4b')]({'where':{'id':_0x1f2444['params']['id']}})[_0x5be3('0x22')](handleEntityNotFound(_0x41a95b,null))[_0x5be3('0x22')](function(_0xfbf574){if(_0xfbf574){return _0xfbf574['removeLists'](_0x1f2444[_0x5be3('0x30')]['ids']);}})[_0x5be3('0x22')](function(_0x483661){if(_0x483661){return db[_0x5be3('0x5b')]['destroy']({'where':{'ListId':_0x1f2444[_0x5be3('0x30')][_0x5be3('0x66')],'CampaignId':_0x1f2444['params']['id']}})[_0x5be3('0x22')](function(){return _0x483661;});}})['then'](respondWithStatusCode(_0x41a95b,null))[_0x5be3('0x47')](handleError(_0x41a95b,null));};exports['getBlackLists']=function(_0x20d375,_0x13515d,_0x288d9e){var _0x4ec923={};var _0x1d7258={};var _0x2fabf1;var _0x53648e;return db['Campaign'][_0x5be3('0x5a')]({'where':{'id':_0x20d375[_0x5be3('0x49')]['id']}})[_0x5be3('0x22')](handleEntityNotFound(_0x13515d,null))[_0x5be3('0x22')](function(_0x229375){if(_0x229375){_0x2fabf1=_0x229375;_0x1d7258[_0x5be3('0x2e')]=_[_0x5be3('0x31')](db[_0x5be3('0x63')][_0x5be3('0x2c')]);_0x1d7258['query']=_[_0x5be3('0x31')](_0x20d375['query']);_0x1d7258['filters']=_['intersection'](_0x1d7258[_0x5be3('0x2e')],_0x1d7258['query']);_0x4ec923[_0x5be3('0x33')]=_[_0x5be3('0x32')](_0x1d7258[_0x5be3('0x2e')],qs[_0x5be3('0x34')](_0x20d375[_0x5be3('0x30')]['fields']));_0x4ec923[_0x5be3('0x33')]=_0x4ec923['attributes'][_0x5be3('0x35')]?_0x4ec923[_0x5be3('0x33')]:_0x1d7258[_0x5be3('0x2e')];_0x4ec923[_0x5be3('0x38')]=qs[_0x5be3('0x39')](_0x20d375[_0x5be3('0x30')][_0x5be3('0x39')]);_0x4ec923[_0x5be3('0x3d')]=qs[_0x5be3('0x3a')](_[_0x5be3('0x3b')](_0x20d375['query'],_0x1d7258[_0x5be3('0x3a')]));if(_0x20d375['query'][_0x5be3('0x3c')]){_0x4ec923['where']=_['merge'](_0x4ec923[_0x5be3('0x3d')],{'$or':_[_0x5be3('0x2f')](_0x4ec923['attributes'],function(_0x2c3109){var _0x4fa1c4={};_0x4fa1c4[_0x2c3109]={'$like':'%'+_0x20d375[_0x5be3('0x30')][_0x5be3('0x3c')]+'%'};return _0x4fa1c4;})});}_0x4ec923=_[_0x5be3('0x3e')]({},_0x4ec923,_0x20d375[_0x5be3('0x41')]);return _0x2fabf1[_0x5be3('0x82')](_0x4ec923);}})[_0x5be3('0x22')](function(_0x46e29a){if(_0x46e29a){_0x53648e=_0x46e29a[_0x5be3('0x35')];if(!_0x20d375['query'][_0x5be3('0x36')](_0x5be3('0x37'))){_0x4ec923['limit']=qs[_0x5be3('0x1b')](_0x20d375[_0x5be3('0x30')][_0x5be3('0x1b')]);_0x4ec923[_0x5be3('0x1a')]=qs['offset'](_0x20d375[_0x5be3('0x30')][_0x5be3('0x1a')]);}return _0x2fabf1[_0x5be3('0x82')](_0x4ec923);}})[_0x5be3('0x22')](function(_0x28195a){if(_0x28195a){return _0x28195a?{'count':_0x53648e,'rows':_0x28195a}:null;}})['then'](respondWithResult(_0x13515d,null))[_0x5be3('0x47')](handleError(_0x13515d,null));};exports[_0x5be3('0x83')]=function(_0x214c05,_0x2631cd,_0x5010b8){var _0x1216de,_0x357b4d;return db['Campaign'][_0x5be3('0x4b')]({'where':{'id':_0x214c05['params']['id']}})['then'](handleEntityNotFound(_0x2631cd,null))[_0x5be3('0x22')](function(_0x18522c){if(_0x18522c){_0x357b4d=_0x18522c;return _0x18522c[_0x5be3('0x83')](_0x214c05[_0x5be3('0x4d')][_0x5be3('0x66')],_[_0x5be3('0x55')](_0x214c05['body'],[_0x5be3('0x66'),'id'])||{});}return null;})[_0x5be3('0x67')](function(_0x22a0c3){var _0xd1298d;_0x1216de=_0x22a0c3||[];var _0x45a46f=[];if(_0x22a0c3){for(var _0x4e005a=0x0;_0x4e005a<_0x22a0c3[_0x5be3('0x35')];_0x4e005a+=0x1){var _0x18f3d8=_0x22a0c3[_0x4e005a][_0x5be3('0x4f')]({'plain':!![]});_0xd1298d=squel[_0x5be3('0x7d')]()[_0x5be3('0x69')](_0x5be3('0x84'))[_0x5be3('0x7e')](['phone',_0x5be3('0x70'),'ListId','CampaignId',_0x5be3('0x56'),_0x5be3('0x57')],squel[_0x5be3('0x6d')]()[_0x5be3('0x6e')](_0x5be3('0x6b'),_0x5be3('0x6b'))[_0x5be3('0x6e')]('id',_0x5be3('0x70'))[_0x5be3('0x6e')](_0x18f3d8['CmListId'][_0x5be3('0x72')](),_0x5be3('0x71'))[_0x5be3('0x6e')](_0x214c05['params']['id'][_0x5be3('0x72')](),_0x5be3('0x5c'))[_0x5be3('0x6e')]('NOW()',_0x5be3('0x56'))['field'](_0x5be3('0x6f'),_0x5be3('0x57'))[_0x5be3('0x73')](_0x5be3('0x74'))[_0x5be3('0x3d')]('deletedAt\x20IS\x20NULL')[_0x5be3('0x3d')](_0x5be3('0x76'),_0x18f3d8[_0x5be3('0x77')][_0x5be3('0x72')]())['where'](_0x5be3('0x78')))[_0x5be3('0x72')]();_0x45a46f[_0x5be3('0x7f')](db[_0x5be3('0x80')][_0x5be3('0x30')](_0xd1298d));}return BPromise[_0x5be3('0x85')](_0x45a46f);}})[_0x5be3('0x22')](function(){return _0x1216de;})[_0x5be3('0x22')](respondWithResult(_0x2631cd,null))[_0x5be3('0x47')](handleError(_0x2631cd,null));};exports[_0x5be3('0x86')]=function(_0x2068e6,_0x541f4c,_0x32e542){return db[_0x5be3('0x42')][_0x5be3('0x4b')]({'where':{'id':_0x2068e6['params']['id']}})['then'](handleEntityNotFound(_0x541f4c,null))['then'](function(_0x1b0d58){if(_0x1b0d58){return _0x1b0d58[_0x5be3('0x86')](_0x2068e6['query'][_0x5be3('0x66')]);}})[_0x5be3('0x22')](function(_0x5ecee5){if(_0x5ecee5){return db[_0x5be3('0x62')][_0x5be3('0x23')]({'where':{'ListId':_0x2068e6[_0x5be3('0x30')][_0x5be3('0x66')],'CampaignId':_0x2068e6[_0x5be3('0x49')]['id']}})[_0x5be3('0x22')](function(){return _0x5ecee5;});}})[_0x5be3('0x22')](respondWithStatusCode(_0x541f4c,null))[_0x5be3('0x47')](handleError(_0x541f4c,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index 8791979..da7bb58 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 _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x4a4a3f,_0xc54857){var _0x4d7fe4=function(_0x2f1c41){while(--_0x2f1c41){_0x4a4a3f['push'](_0x4a4a3f['shift']());}};_0x4d7fe4(++_0xc54857);}(_0x7a54,0x106));var _0x47a5=function(_0x510f53,_0x3d7eaf){_0x510f53=_0x510f53-0x0;var _0x1eee32=_0x7a54[_0x510f53];return _0x1eee32;};'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':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9957=['exports','define','Campaign','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./campaign.attributes'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'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':'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 2e7c702..ba06ec4 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 _0x2904=['client','http','then','Campaign,\x20%s,\x20%s','request\x20sent','debug','Campaign,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCampaign','Campaign','options','raw','limit','include','model','attributes','map','info','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2904,0x137));var _0x4290=function(_0x2ad77f,_0x197179){_0x2ad77f=_0x2ad77f-0x0;var _0x2e1184=_0x2904[_0x2ad77f];return _0x2e1184;};'use strict';var _=require(_0x4290('0x0'));var util=require(_0x4290('0x1'));var moment=require('moment');var BPromise=require(_0x4290('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4290('0x3'));var db=require(_0x4290('0x4'))['db'];var utils=require(_0x4290('0x5'));var logger=require(_0x4290('0x6'))(_0x4290('0x7'));var config=require('../../config/environment');var jayson=require(_0x4290('0x8'));var client=jayson[_0x4290('0x9')][_0x4290('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4b8d4d,_0x4b1476,_0x5a4ac4){return new BPromise(function(_0x50248b,_0xa79538){return client['request'](_0x4b8d4d,_0x5a4ac4)[_0x4290('0xb')](function(_0x33a599){logger['info'](_0x4290('0xc'),_0x4b1476,_0x4290('0xd'));logger[_0x4290('0xe')](_0x4290('0xf'),_0x4b1476,_0x4290('0xd'),JSON[_0x4290('0x10')](_0x33a599));if(_0x33a599[_0x4290('0x11')]){if(_0x33a599[_0x4290('0x11')][_0x4290('0x12')]===0x1f4){logger['error'](_0x4290('0xc'),_0x4b1476,_0x33a599[_0x4290('0x11')]['message']);return _0xa79538(_0x33a599[_0x4290('0x11')]['message']);}logger[_0x4290('0x11')]('Campaign,\x20%s,\x20%s',_0x4b1476,_0x33a599[_0x4290('0x11')][_0x4290('0x13')]);return _0x50248b(_0x33a599['error'][_0x4290('0x13')]);}else{logger['info'](_0x4290('0xc'),_0x4b1476,_0x4290('0xd'));_0x50248b(_0x33a599[_0x4290('0x14')]['message']);}})[_0x4290('0x15')](function(_0x15f816){logger['error'](_0x4290('0xc'),_0x4b1476,_0x15f816);_0xa79538(_0x15f816);});});}exports[_0x4290('0x16')]=function(_0x3a3192){var _0x2d2537=this;return new Promise(function(_0x34245e,_0x538dd7){return db[_0x4290('0x17')]['findAll']({'raw':_0x3a3192[_0x4290('0x18')]?_0x3a3192[_0x4290('0x18')][_0x4290('0x19')]===undefined?!![]:![]:!![],'where':_0x3a3192['options']?_0x3a3192[_0x4290('0x18')]['where']||null:null,'attributes':_0x3a3192[_0x4290('0x18')]?_0x3a3192['options']['attributes']||null:null,'limit':_0x3a3192[_0x4290('0x18')]?_0x3a3192[_0x4290('0x18')][_0x4290('0x1a')]||null:null,'include':_0x3a3192[_0x4290('0x18')]?_0x3a3192[_0x4290('0x18')][_0x4290('0x1b')]?_['map'](_0x3a3192[_0x4290('0x18')]['include'],function(_0x14999){return{'model':db[_0x14999[_0x4290('0x1c')]],'as':_0x14999['as'],'attributes':_0x14999[_0x4290('0x1d')],'include':_0x14999[_0x4290('0x1b')]?_['map'](_0x14999['include'],function(_0x14f428){return{'model':db[_0x14f428[_0x4290('0x1c')]],'as':_0x14f428['as'],'attributes':_0x14f428[_0x4290('0x1d')],'include':_0x14f428[_0x4290('0x1b')]?_[_0x4290('0x1e')](_0x14f428[_0x4290('0x1b')],function(_0xdd3947){return{'model':db[_0xdd3947[_0x4290('0x1c')]],'as':_0xdd3947['as'],'attributes':_0xdd3947[_0x4290('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4290('0xb')](function(_0x524807){logger[_0x4290('0x1f')](_0x4290('0x16'),_0x3a3192);logger['debug'](_0x4290('0x16'),_0x3a3192,JSON[_0x4290('0x10')](_0x524807));_0x34245e(_0x524807);})[_0x4290('0x15')](function(_0x3b6579){logger['error'](_0x4290('0x16'),_0x3b6579[_0x4290('0x13')],_0x3a3192);_0x538dd7(_0x2d2537['error'](0x1f4,_0x3b6579[_0x4290('0x13')]));});});}; \ No newline at end of file +var _0x1db3=['findAll','options','where','attributes','limit','include','map','model','then','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Campaign,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','GetCampaign','Campaign'];(function(_0xb255ab,_0x3dbe94){var _0x5de5ad=function(_0x4b4c31){while(--_0x4b4c31){_0xb255ab['push'](_0xb255ab['shift']());}};_0x5de5ad(++_0x3dbe94);}(_0x1db3,0x1e5));var _0x31db=function(_0x4f0d98,_0x4e7c7c){_0x4f0d98=_0x4f0d98-0x0;var _0x562ea1=_0x1db3[_0x4f0d98];return _0x562ea1;};'use strict';var _=require('lodash');var util=require(_0x31db('0x0'));var moment=require(_0x31db('0x1'));var BPromise=require(_0x31db('0x2'));var rs=require(_0x31db('0x3'));var fs=require('fs');var Redis=require(_0x31db('0x4'));var db=require(_0x31db('0x5'))['db'];var utils=require(_0x31db('0x6'));var logger=require(_0x31db('0x7'))(_0x31db('0x8'));var config=require(_0x31db('0x9'));var jayson=require(_0x31db('0xa'));var client=jayson[_0x31db('0xb')][_0x31db('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x156381,_0xa4f685,_0x44e204){return new BPromise(function(_0x3a431e,_0x3881c8){return client[_0x31db('0xd')](_0x156381,_0x44e204)['then'](function(_0x19d1a9){logger[_0x31db('0xe')](_0x31db('0xf'),_0xa4f685,_0x31db('0x10'));logger[_0x31db('0x11')]('Campaign,\x20%s,\x20%s,\x20%s',_0xa4f685,_0x31db('0x10'),JSON[_0x31db('0x12')](_0x19d1a9));if(_0x19d1a9[_0x31db('0x13')]){if(_0x19d1a9['error'][_0x31db('0x14')]===0x1f4){logger[_0x31db('0x13')](_0x31db('0xf'),_0xa4f685,_0x19d1a9[_0x31db('0x13')][_0x31db('0x15')]);return _0x3881c8(_0x19d1a9[_0x31db('0x13')]['message']);}logger['error'](_0x31db('0xf'),_0xa4f685,_0x19d1a9['error'][_0x31db('0x15')]);return _0x3a431e(_0x19d1a9[_0x31db('0x13')][_0x31db('0x15')]);}else{logger[_0x31db('0xe')](_0x31db('0xf'),_0xa4f685,'request\x20sent');_0x3a431e(_0x19d1a9['result']['message']);}})[_0x31db('0x16')](function(_0x22aa89){logger[_0x31db('0x13')](_0x31db('0xf'),_0xa4f685,_0x22aa89);_0x3881c8(_0x22aa89);});});}exports[_0x31db('0x17')]=function(_0x1d3218){var _0x9f2780=this;return new Promise(function(_0x3df86e,_0x2d9dd7){return db[_0x31db('0x18')][_0x31db('0x19')]({'raw':_0x1d3218['options']?_0x1d3218[_0x31db('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x1d3218['options']?_0x1d3218[_0x31db('0x1a')][_0x31db('0x1b')]||null:null,'attributes':_0x1d3218[_0x31db('0x1a')]?_0x1d3218[_0x31db('0x1a')][_0x31db('0x1c')]||null:null,'limit':_0x1d3218[_0x31db('0x1a')]?_0x1d3218[_0x31db('0x1a')][_0x31db('0x1d')]||null:null,'include':_0x1d3218[_0x31db('0x1a')]?_0x1d3218[_0x31db('0x1a')][_0x31db('0x1e')]?_[_0x31db('0x1f')](_0x1d3218['options'][_0x31db('0x1e')],function(_0x335cc9){return{'model':db[_0x335cc9[_0x31db('0x20')]],'as':_0x335cc9['as'],'attributes':_0x335cc9['attributes'],'include':_0x335cc9[_0x31db('0x1e')]?_['map'](_0x335cc9['include'],function(_0x2ea3a6){return{'model':db[_0x2ea3a6[_0x31db('0x20')]],'as':_0x2ea3a6['as'],'attributes':_0x2ea3a6['attributes'],'include':_0x2ea3a6['include']?_['map'](_0x2ea3a6[_0x31db('0x1e')],function(_0x48668b){return{'model':db[_0x48668b[_0x31db('0x20')]],'as':_0x48668b['as'],'attributes':_0x48668b[_0x31db('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x31db('0x21')](function(_0x3effc4){logger[_0x31db('0xe')](_0x31db('0x17'),_0x1d3218);logger[_0x31db('0x11')](_0x31db('0x17'),_0x1d3218,JSON[_0x31db('0x12')](_0x3effc4));_0x3df86e(_0x3effc4);})['catch'](function(_0x1a1124){logger[_0x31db('0x13')]('GetCampaign',_0x1a1124['message'],_0x1d3218);_0x2d9dd7(_0x9f2780[_0x31db('0x13')](0x1f4,_0x1a1124['message']));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index 5115877..9ef228a 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 _0xf878=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','/:id/clone','addBlackLists','put','update','delete','destroy','removeLists','multer'];(function(_0x458ffe,_0x27a794){var _0x3d6e08=function(_0x4ee0d1){while(--_0x4ee0d1){_0x458ffe['push'](_0x458ffe['shift']());}};_0x3d6e08(++_0x27a794);}(_0xf878,0xdf));var _0x8f87=function(_0x1c310e,_0xd2be10){_0x1c310e=_0x1c310e-0x0;var _0x23325f=_0xf878[_0x1c310e];return _0x23325f;};'use strict';var multer=require(_0x8f87('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x8f87('0x1'));var express=require('express');var router=express[_0x8f87('0x2')]();var fs_extra=require(_0x8f87('0x3'));var auth=require(_0x8f87('0x4'));var interaction=require(_0x8f87('0x5'));var config=require(_0x8f87('0x6'));var controller=require(_0x8f87('0x7'));router[_0x8f87('0x8')]('/',auth['isAuthenticated'](),controller[_0x8f87('0x9')]);router[_0x8f87('0x8')](_0x8f87('0xa'),auth[_0x8f87('0xb')](),controller[_0x8f87('0xc')]);router[_0x8f87('0x8')](_0x8f87('0xd'),auth[_0x8f87('0xb')](),controller[_0x8f87('0xe')]);router[_0x8f87('0x8')](_0x8f87('0xf'),auth[_0x8f87('0xb')](),controller[_0x8f87('0x10')]);router[_0x8f87('0x8')](_0x8f87('0x11'),auth[_0x8f87('0xb')](),controller[_0x8f87('0x12')]);router[_0x8f87('0x8')](_0x8f87('0x13'),auth['isAuthenticated'](),controller[_0x8f87('0x14')]);router[_0x8f87('0x8')](_0x8f87('0x15'),auth[_0x8f87('0xb')](),controller[_0x8f87('0x16')]);router[_0x8f87('0x8')](_0x8f87('0x17'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0x8f87('0x18')]('/',auth[_0x8f87('0xb')](),controller['create']);router[_0x8f87('0x18')](_0x8f87('0x19'),auth[_0x8f87('0xb')](),controller['clone']);router['post']('/:id/lists',auth[_0x8f87('0xb')](),controller['addLists']);router[_0x8f87('0x18')](_0x8f87('0x17'),auth[_0x8f87('0xb')](),controller[_0x8f87('0x1a')]);router[_0x8f87('0x1b')](_0x8f87('0xa'),auth['isAuthenticated'](),controller[_0x8f87('0x1c')]);router[_0x8f87('0x1d')](_0x8f87('0xa'),auth[_0x8f87('0xb')](),controller[_0x8f87('0x1e')]);router[_0x8f87('0x1d')](_0x8f87('0x15'),auth['isAuthenticated'](),controller[_0x8f87('0x1f')]);router[_0x8f87('0x1d')](_0x8f87('0x17'),auth['isAuthenticated'](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file +var _0x12dc=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show','getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','getHopperBlacks','/:id/lists','getLists','/:id/blacklists','post','create','/:id/clone','clone','addLists','addBlackLists','update','destroy','delete','removeLists','exports'];(function(_0x171435,_0x548468){var _0x35b7fa=function(_0x5545b1){while(--_0x5545b1){_0x171435['push'](_0x171435['shift']());}};_0x35b7fa(++_0x548468);}(_0x12dc,0xb4));var _0xc12d=function(_0x40ed6e,_0x486355){_0x40ed6e=_0x40ed6e-0x0;var _0x14664a=_0x12dc[_0x40ed6e];return _0x14664a;};'use strict';var multer=require(_0xc12d('0x0'));var util=require(_0xc12d('0x1'));var path=require('path');var timeout=require(_0xc12d('0x2'));var express=require(_0xc12d('0x3'));var router=express[_0xc12d('0x4')]();var fs_extra=require(_0xc12d('0x5'));var auth=require(_0xc12d('0x6'));var interaction=require(_0xc12d('0x7'));var config=require(_0xc12d('0x8'));var controller=require(_0xc12d('0x9'));router[_0xc12d('0xa')]('/',auth['isAuthenticated'](),controller[_0xc12d('0xb')]);router[_0xc12d('0xa')](_0xc12d('0xc'),auth[_0xc12d('0xd')](),controller[_0xc12d('0xe')]);router[_0xc12d('0xa')]('/:id/hoppers',auth[_0xc12d('0xd')](),controller[_0xc12d('0xf')]);router['get'](_0xc12d('0x10'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x11')]);router[_0xc12d('0xa')](_0xc12d('0x12'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x13')]);router[_0xc12d('0xa')](_0xc12d('0x14'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x15')]);router[_0xc12d('0xa')](_0xc12d('0x16'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x17')]);router['get'](_0xc12d('0x18'),auth[_0xc12d('0xd')](),controller['getBlackLists']);router[_0xc12d('0x19')]('/',auth[_0xc12d('0xd')](),controller[_0xc12d('0x1a')]);router[_0xc12d('0x19')](_0xc12d('0x1b'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x1c')]);router[_0xc12d('0x19')](_0xc12d('0x16'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x1d')]);router[_0xc12d('0x19')](_0xc12d('0x18'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x1e')]);router['put'](_0xc12d('0xc'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x1f')]);router['delete'](_0xc12d('0xc'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x20')]);router[_0xc12d('0x21')](_0xc12d('0x16'),auth[_0xc12d('0xd')](),controller[_0xc12d('0x22')]);router[_0xc12d('0x21')](_0xc12d('0x18'),auth[_0xc12d('0xd')](),controller['removeBlackLists']);module[_0xc12d('0x23')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 33ca5c6..b00971b 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 _0xfd5d=['sequelize','exports','TEXT','VIRTUAL','getDataValue','key'];(function(_0x33bc64,_0x4d1e92){var _0x3fdd34=function(_0x4b40a4){while(--_0x4b40a4){_0x33bc64['push'](_0x33bc64['shift']());}};_0x3fdd34(++_0x4d1e92);}(_0xfd5d,0x102));var _0xdfd5=function(_0x12e073,_0x4d43db){_0x12e073=_0x12e073-0x0;var _0x267748=_0xfd5d[_0x12e073];return _0x267748;};'use strict';var Sequelize=require(_0xdfd5('0x0'));module[_0xdfd5('0x1')]={'key':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0xdfd5('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'name':{'type':Sequelize[_0xdfd5('0x3')],'get':function(){return this[_0xdfd5('0x4')](_0xdfd5('0x5'));}}}; \ No newline at end of file +var _0x9e41=['exports','STRING','VIRTUAL','key'];(function(_0x1a7691,_0xc6a24c){var _0x11d89b=function(_0x52018d){while(--_0x52018d){_0x1a7691['push'](_0x1a7691['shift']());}};_0x11d89b(++_0xc6a24c);}(_0x9e41,0x198));var _0x19e4=function(_0x2a95d3,_0x51b9ff){_0x2a95d3=_0x2a95d3-0x0;var _0x10ee3f=_0x9e41[_0x2a95d3];return _0x10ee3f;};'use strict';var Sequelize=require('sequelize');module[_0x19e4('0x0')]={'key':{'type':Sequelize[_0x19e4('0x1')],'allowNull':![]},'value':{'type':Sequelize['TEXT'],'allowNull':![]},'description':{'type':Sequelize[_0x19e4('0x1')]},'name':{'type':Sequelize[_0x19e4('0x2')],'get':function(){return this['getDataValue'](_0x19e4('0x3'));}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 0fa0415..9f774fa 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 _0xea7d=['fs-extra','lodash','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','CannedAnswers','UserProfileResource','destroy','error','stack','map','CannedAnswer','rawAttributes','fieldName','model','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','findAll','rows','catch','show','params','include','find','body','create','key','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','ValidationError','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','path','sox','ejs'];(function(_0x1dcf37,_0x150062){var _0x4323ea=function(_0x1743e3){while(--_0x1743e3){_0x1dcf37['push'](_0x1dcf37['shift']());}};_0x4323ea(++_0x150062);}(_0xea7d,0x140));var _0xdea7=function(_0x5d04ee,_0x2a38ca){_0x5d04ee=_0x5d04ee-0x0;var _0x4a666a=_0xea7d[_0x5d04ee];return _0x4a666a;};'use strict';var emlformat=require(_0xdea7('0x0'));var rimraf=require(_0xdea7('0x1'));var zipdir=require(_0xdea7('0x2'));var jsonpatch=require(_0xdea7('0x3'));var rp=require(_0xdea7('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdea7('0x5'));var sox=require(_0xdea7('0x6'));var csv=require('to-csv');var ejs=require(_0xdea7('0x7'));var fs=require('fs');var fs_extra=require(_0xdea7('0x8'));var _=require(_0xdea7('0x9'));var squel=require(_0xdea7('0xa'));var crypto=require(_0xdea7('0xb'));var jsforce=require(_0xdea7('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xdea7('0xd'));var querystring=require('querystring');var Papa=require(_0xdea7('0xe'));var Redis=require(_0xdea7('0xf'));var authService=require(_0xdea7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xdea7('0x11'));var hardwareService=require(_0xdea7('0x12'));var logger=require('../../config/logger')(_0xdea7('0x13'));var utils=require(_0xdea7('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x14b531,_0xdb93a0){_0xdb93a0=_0xdb93a0||0xcc;return function(_0x1951cd){if(_0x1951cd){return _0x14b531[_0xdea7('0x15')](_0xdb93a0);}return _0x14b531[_0xdea7('0x16')](_0xdb93a0)[_0xdea7('0x17')]();};}function respondWithResult(_0x2fa9ca,_0x56c478){_0x56c478=_0x56c478||0xc8;return function(_0x49b1be){if(_0x49b1be){return _0x2fa9ca[_0xdea7('0x16')](_0x56c478)[_0xdea7('0x18')](_0x49b1be);}};}function respondWithFilteredResult(_0x366e27,_0x57f6a3){return function(_0x4da20e){if(_0x4da20e){var _0x1999b5=typeof _0x57f6a3[_0xdea7('0x19')]===_0xdea7('0x1a')&&typeof _0x57f6a3[_0xdea7('0x1b')]===_0xdea7('0x1a');var _0x24307b=_0x4da20e[_0xdea7('0x1c')];var _0x522bb8=_0x1999b5?0x0:_0x57f6a3[_0xdea7('0x19')];var _0x55a01b=_0x1999b5?_0x4da20e[_0xdea7('0x1c')]:_0x57f6a3[_0xdea7('0x19')]+_0x57f6a3[_0xdea7('0x1b')];var _0x3b0356;if(_0x55a01b>=_0x24307b){_0x55a01b=_0x24307b;_0x3b0356=0xc8;}else{_0x3b0356=0xce;}_0x366e27['status'](_0x3b0356);return _0x366e27['set'](_0xdea7('0x1d'),_0x522bb8+'-'+_0x55a01b+'/'+_0x24307b)['json'](_0x4da20e);}return null;};}function patchUpdates(_0x7440d7){return function(_0x45859b){try{jsonpatch[_0xdea7('0x1e')](_0x45859b,_0x7440d7,!![]);}catch(_0xf89676){return BPromise[_0xdea7('0x1f')](_0xf89676);}return _0x45859b[_0xdea7('0x20')]();};}function saveUpdates(_0x4ac4dc,_0x3b6a94){return function(_0x3ab19d){if(_0x3ab19d){return _0x3ab19d[_0xdea7('0x21')](_0x4ac4dc)['then'](function(_0x21c581){return _0x21c581;});}return null;};}function removeEntity(_0x48c927,_0x5b2ee7){return function(_0x393471){if(_0x393471){return _0x393471['destroy']()[_0xdea7('0x22')](function(){var _0x74cea0=_0x393471['get']({'plain':!![]});var _0x955381=_0xdea7('0x23');return db[_0xdea7('0x24')][_0xdea7('0x25')]({'where':{'type':_0x955381,'resourceId':_0x74cea0['id']}})[_0xdea7('0x22')](function(){return _0x393471;});})[_0xdea7('0x22')](function(){_0x48c927[_0xdea7('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3256e3,_0xa6ab5e){return function(_0x35117a){if(!_0x35117a){_0x3256e3[_0xdea7('0x15')](0x194);}return _0x35117a;};}function handleError(_0x99c63a,_0xa5e647){_0xa5e647=_0xa5e647||0x1f4;return function(_0x16b6ba){logger[_0xdea7('0x26')](_0x16b6ba[_0xdea7('0x27')]);if(_0x16b6ba['name']){delete _0x16b6ba['name'];}_0x99c63a[_0xdea7('0x16')](_0xa5e647)['send'](_0x16b6ba);};}exports['index']=function(_0x775ce7,_0x2488f8){var _0x2c57a2={},_0x1ffee1={},_0x49d8ba={'count':0x0,'rows':[]};var _0x5b4d38=_[_0xdea7('0x28')](db[_0xdea7('0x29')][_0xdea7('0x2a')],function(_0x34a11f){return{'name':_0x34a11f[_0xdea7('0x2b')],'type':_0x34a11f['type']['key']};});_0x1ffee1[_0xdea7('0x2c')]=_[_0xdea7('0x28')](_0x5b4d38,_0xdea7('0x2d'));_0x1ffee1[_0xdea7('0x2e')]=_[_0xdea7('0x2f')](_0x775ce7[_0xdea7('0x2e')]);_0x1ffee1[_0xdea7('0x30')]=_[_0xdea7('0x31')](_0x1ffee1['model'],_0x1ffee1[_0xdea7('0x2e')]);_0x2c57a2[_0xdea7('0x32')]=_[_0xdea7('0x31')](_0x1ffee1['model'],qs['fields'](_0x775ce7[_0xdea7('0x2e')][_0xdea7('0x33')]));_0x2c57a2[_0xdea7('0x32')]=_0x2c57a2[_0xdea7('0x32')][_0xdea7('0x34')]?_0x2c57a2['attributes']:_0x1ffee1[_0xdea7('0x2c')];if(!_0x775ce7[_0xdea7('0x2e')][_0xdea7('0x35')](_0xdea7('0x36'))){_0x2c57a2['limit']=qs[_0xdea7('0x1b')](_0x775ce7[_0xdea7('0x2e')][_0xdea7('0x1b')]);_0x2c57a2[_0xdea7('0x19')]=qs[_0xdea7('0x19')](_0x775ce7['query'][_0xdea7('0x19')]);}_0x2c57a2[_0xdea7('0x37')]=qs[_0xdea7('0x38')](_0x775ce7['query'][_0xdea7('0x38')]);_0x2c57a2[_0xdea7('0x39')]=qs[_0xdea7('0x30')](_[_0xdea7('0x3a')](_0x775ce7[_0xdea7('0x2e')],_0x1ffee1[_0xdea7('0x30')]),_0x5b4d38);if(_0x775ce7['query']['filter']){_0x2c57a2['where']=_[_0xdea7('0x3b')](_0x2c57a2[_0xdea7('0x39')],{'$or':[{'key':{'$like':'%'+_0x775ce7[_0xdea7('0x2e')][_0xdea7('0x3c')]+'%'}},{'value':{'$like':'%'+_0x775ce7[_0xdea7('0x2e')]['filter']+'%'}}]});}_0x2c57a2=_[_0xdea7('0x3b')]({},_0x2c57a2,_0x775ce7['options']);var _0x1f83d3={'where':_0x2c57a2[_0xdea7('0x39')]};return db[_0xdea7('0x29')]['count'](_0x1f83d3)[_0xdea7('0x22')](function(_0x321393){_0x49d8ba[_0xdea7('0x1c')]=_0x321393;if(_0x775ce7['query'][_0xdea7('0x3d')]){_0x2c57a2['include']=[{'all':!![]}];}return db[_0xdea7('0x29')][_0xdea7('0x3e')](_0x2c57a2);})[_0xdea7('0x22')](function(_0x3ddafa){_0x49d8ba[_0xdea7('0x3f')]=_0x3ddafa;return _0x49d8ba;})[_0xdea7('0x22')](respondWithFilteredResult(_0x2488f8,_0x2c57a2))[_0xdea7('0x40')](handleError(_0x2488f8,null));};exports[_0xdea7('0x41')]=function(_0x48551b,_0x4dec88){var _0x381912={'raw':!![],'where':{'id':_0x48551b[_0xdea7('0x42')]['id']}},_0x1dbea6={};_0x1dbea6['model']=_[_0xdea7('0x2f')](db[_0xdea7('0x29')][_0xdea7('0x2a')]);_0x1dbea6[_0xdea7('0x2e')]=_[_0xdea7('0x2f')](_0x48551b[_0xdea7('0x2e')]);_0x1dbea6[_0xdea7('0x30')]=_['intersection'](_0x1dbea6['model'],_0x1dbea6['query']);_0x381912[_0xdea7('0x32')]=_[_0xdea7('0x31')](_0x1dbea6[_0xdea7('0x2c')],qs[_0xdea7('0x33')](_0x48551b[_0xdea7('0x2e')][_0xdea7('0x33')]));_0x381912[_0xdea7('0x32')]=_0x381912['attributes'][_0xdea7('0x34')]?_0x381912[_0xdea7('0x32')]:_0x1dbea6[_0xdea7('0x2c')];if(_0x48551b[_0xdea7('0x2e')][_0xdea7('0x3d')]){_0x381912[_0xdea7('0x43')]=[{'all':!![]}];}_0x381912=_[_0xdea7('0x3b')]({},_0x381912,_0x48551b['options']);return db[_0xdea7('0x29')][_0xdea7('0x44')](_0x381912)['then'](handleEntityNotFound(_0x4dec88,null))[_0xdea7('0x22')](respondWithResult(_0x4dec88,null))['catch'](handleError(_0x4dec88,null));};exports['update']=function(_0x51a15a,_0x4a2bca){if(_0x51a15a[_0xdea7('0x45')]['id']){delete _0x51a15a[_0xdea7('0x45')]['id'];}return db[_0xdea7('0x29')][_0xdea7('0x44')]({'where':{'id':_0x51a15a[_0xdea7('0x42')]['id']}})[_0xdea7('0x22')](handleEntityNotFound(_0x4a2bca,null))[_0xdea7('0x22')](saveUpdates(_0x51a15a['body'],null))['then'](respondWithResult(_0x4a2bca,null))[_0xdea7('0x40')](handleError(_0x4a2bca,null));};exports[_0xdea7('0x25')]=function(_0x24da22,_0x9e5d89){return db[_0xdea7('0x29')]['find']({'where':{'id':_0x24da22['params']['id']}})['then'](handleEntityNotFound(_0x9e5d89,null))['then'](removeEntity(_0x9e5d89,null))[_0xdea7('0x40')](handleError(_0x9e5d89,null));};exports[_0xdea7('0x46')]=function(_0x5215cd,_0x207d22){var _0x184cb4={'key':_0x5215cd[_0xdea7('0x45')][_0xdea7('0x47')]};if(_0x5215cd['body'][_0xdea7('0x48')]){_0x184cb4[_0xdea7('0x48')]=_0x5215cd['body']['MailAccountId'];}else if(_0x5215cd[_0xdea7('0x45')][_0xdea7('0x49')]){_0x184cb4['SmsAccountId']=_0x5215cd[_0xdea7('0x45')][_0xdea7('0x49')];}else if(_0x5215cd['body'][_0xdea7('0x4a')]){_0x184cb4[_0xdea7('0x4a')]=_0x5215cd[_0xdea7('0x45')]['OpenchannelAccountId'];}else if(_0x5215cd[_0xdea7('0x45')][_0xdea7('0x4b')]){_0x184cb4['ChatWebsiteId']=_0x5215cd['body'][_0xdea7('0x4b')];}return db['CannedAnswer'][_0xdea7('0x44')]({'where':_0x184cb4})[_0xdea7('0x22')](function(_0x4a8fd1){if(_0x4a8fd1){throw new db['Sequelize'][(_0xdea7('0x4c'))]('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xdea7('0x29')][_0xdea7('0x46')](_0x5215cd['body']);})[_0xdea7('0x22')](function(_0x123646){var _0x4a8e0c=_0x5215cd[_0xdea7('0x4d')]['get']({'plain':!![]});if(!_0x4a8e0c)throw new Error(_0xdea7('0x4e'));if(_0x4a8e0c['role']===_0xdea7('0x4d')){var _0x475e1d=_0x123646['get']({'plain':!![]});return db[_0xdea7('0x4f')]['find']({'where':{'name':_0xdea7('0x23'),'userProfileId':_0x4a8e0c['userProfileId']},'raw':!![]})[_0xdea7('0x22')](function(_0x25060e){if(_0x25060e&&_0x25060e[_0xdea7('0x50')]===0x0){return db[_0xdea7('0x24')][_0xdea7('0x46')]({'name':_0x475e1d[_0xdea7('0x2d')],'resourceId':_0x475e1d['id'],'type':_0x25060e[_0xdea7('0x2d')],'sectionId':_0x25060e['id']},{})[_0xdea7('0x22')](function(){return _0x123646;});}else{return _0x123646;}})[_0xdea7('0x40')](function(_0x16d6d2){logger['error'](_0xdea7('0x51'),_0x16d6d2);throw _0x16d6d2;});}return _0x123646;})[_0xdea7('0x22')](respondWithResult(_0x207d22,0xc9))['catch'](handleError(_0x207d22,null));}; \ No newline at end of file +var _0xcb0d=['merge','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','length','CannedAnswer','find','body','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','CannedAnswers','userProfileId','autoAssociation','UserProfileResource','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','save','update','get','destroy','then','error','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick'];(function(_0x402125,_0x3546a9){var _0x183c8b=function(_0x732136){while(--_0x732136){_0x402125['push'](_0x402125['shift']());}};_0x183c8b(++_0x3546a9);}(_0xcb0d,0x75));var _0xdcb0=function(_0x5a2c7b,_0x441265){_0x5a2c7b=_0x5a2c7b-0x0;var _0x3ad931=_0xcb0d[_0x5a2c7b];return _0x3ad931;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdcb0('0x0'));var zipdir=require(_0xdcb0('0x1'));var jsonpatch=require(_0xdcb0('0x2'));var rp=require(_0xdcb0('0x3'));var moment=require(_0xdcb0('0x4'));var BPromise=require(_0xdcb0('0x5'));var Mustache=require(_0xdcb0('0x6'));var util=require(_0xdcb0('0x7'));var path=require(_0xdcb0('0x8'));var sox=require(_0xdcb0('0x9'));var csv=require(_0xdcb0('0xa'));var ejs=require(_0xdcb0('0xb'));var fs=require('fs');var fs_extra=require(_0xdcb0('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xdcb0('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xdcb0('0xe'));var toCsv=require(_0xdcb0('0xa'));var querystring=require(_0xdcb0('0xf'));var Papa=require(_0xdcb0('0x10'));var Redis=require(_0xdcb0('0x11'));var authService=require(_0xdcb0('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdcb0('0x13'));var logger=require(_0xdcb0('0x14'))('api');var utils=require(_0xdcb0('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xdcb0('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3d9725,_0x2e63b2){_0x2e63b2=_0x2e63b2||0xcc;return function(_0xe9c0b7){if(_0xe9c0b7){return _0x3d9725[_0xdcb0('0x17')](_0x2e63b2);}return _0x3d9725[_0xdcb0('0x18')](_0x2e63b2)[_0xdcb0('0x19')]();};}function respondWithResult(_0x736cb5,_0x43ebe3){_0x43ebe3=_0x43ebe3||0xc8;return function(_0x31fa93){if(_0x31fa93){return _0x736cb5['status'](_0x43ebe3)['json'](_0x31fa93);}};}function respondWithFilteredResult(_0xd02364,_0x4c5012){return function(_0xda87dd){if(_0xda87dd){var _0x1a0b49=typeof _0x4c5012[_0xdcb0('0x1a')]===_0xdcb0('0x1b')&&typeof _0x4c5012['limit']===_0xdcb0('0x1b');var _0x297474=_0xda87dd[_0xdcb0('0x1c')];var _0x5e52cf=_0x1a0b49?0x0:_0x4c5012[_0xdcb0('0x1a')];var _0x4b74b1=_0x1a0b49?_0xda87dd[_0xdcb0('0x1c')]:_0x4c5012['offset']+_0x4c5012['limit'];var _0x42ea11;if(_0x4b74b1>=_0x297474){_0x4b74b1=_0x297474;_0x42ea11=0xc8;}else{_0x42ea11=0xce;}_0xd02364['status'](_0x42ea11);return _0xd02364[_0xdcb0('0x1d')](_0xdcb0('0x1e'),_0x5e52cf+'-'+_0x4b74b1+'/'+_0x297474)[_0xdcb0('0x1f')](_0xda87dd);}return null;};}function patchUpdates(_0x1367ad){return function(_0x996226){try{jsonpatch[_0xdcb0('0x20')](_0x996226,_0x1367ad,!![]);}catch(_0x150a93){return BPromise[_0xdcb0('0x21')](_0x150a93);}return _0x996226[_0xdcb0('0x22')]();};}function saveUpdates(_0x144188,_0x550788){return function(_0x52ed75){if(_0x52ed75){return _0x52ed75[_0xdcb0('0x23')](_0x144188)['then'](function(_0x1faa34){return _0x1faa34;});}return null;};}function removeEntity(_0x3357d2,_0x2c0fd6){return function(_0xca1e9e){if(_0xca1e9e){return _0xca1e9e['destroy']()['then'](function(){var _0x10ff7b=_0xca1e9e[_0xdcb0('0x24')]({'plain':!![]});var _0x26a2c4='CannedAnswers';return db['UserProfileResource'][_0xdcb0('0x25')]({'where':{'type':_0x26a2c4,'resourceId':_0x10ff7b['id']}})[_0xdcb0('0x26')](function(){return _0xca1e9e;});})['then'](function(){_0x3357d2[_0xdcb0('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x530288,_0x1cfb55){return function(_0x469e0e){if(!_0x469e0e){_0x530288[_0xdcb0('0x17')](0x194);}return _0x469e0e;};}function handleError(_0x1740c9,_0x10801e){_0x10801e=_0x10801e||0x1f4;return function(_0x49b440){logger[_0xdcb0('0x27')](_0x49b440[_0xdcb0('0x28')]);if(_0x49b440['name']){delete _0x49b440[_0xdcb0('0x29')];}_0x1740c9[_0xdcb0('0x18')](_0x10801e)['send'](_0x49b440);};}exports[_0xdcb0('0x2a')]=function(_0x2b618e,_0x7dde8a){var _0x2c8560={},_0x2dc573={},_0x3c0423={'count':0x0,'rows':[]};var _0x44c9ea=_[_0xdcb0('0x2b')](db['CannedAnswer'][_0xdcb0('0x2c')],function(_0x599bf7){return{'name':_0x599bf7[_0xdcb0('0x2d')],'type':_0x599bf7[_0xdcb0('0x2e')][_0xdcb0('0x2f')]};});_0x2dc573[_0xdcb0('0x30')]=_[_0xdcb0('0x2b')](_0x44c9ea,_0xdcb0('0x29'));_0x2dc573['query']=_['keys'](_0x2b618e[_0xdcb0('0x31')]);_0x2dc573[_0xdcb0('0x32')]=_[_0xdcb0('0x33')](_0x2dc573[_0xdcb0('0x30')],_0x2dc573[_0xdcb0('0x31')]);_0x2c8560[_0xdcb0('0x34')]=_[_0xdcb0('0x33')](_0x2dc573['model'],qs[_0xdcb0('0x35')](_0x2b618e[_0xdcb0('0x31')][_0xdcb0('0x35')]));_0x2c8560[_0xdcb0('0x34')]=_0x2c8560[_0xdcb0('0x34')]['length']?_0x2c8560[_0xdcb0('0x34')]:_0x2dc573[_0xdcb0('0x30')];if(!_0x2b618e[_0xdcb0('0x31')][_0xdcb0('0x36')](_0xdcb0('0x37'))){_0x2c8560['limit']=qs[_0xdcb0('0x38')](_0x2b618e[_0xdcb0('0x31')]['limit']);_0x2c8560[_0xdcb0('0x1a')]=qs['offset'](_0x2b618e[_0xdcb0('0x31')]['offset']);}_0x2c8560[_0xdcb0('0x39')]=qs[_0xdcb0('0x3a')](_0x2b618e[_0xdcb0('0x31')][_0xdcb0('0x3a')]);_0x2c8560[_0xdcb0('0x3b')]=qs[_0xdcb0('0x32')](_[_0xdcb0('0x3c')](_0x2b618e[_0xdcb0('0x31')],_0x2dc573[_0xdcb0('0x32')]),_0x44c9ea);if(_0x2b618e['query']['filter']){_0x2c8560['where']=_[_0xdcb0('0x3d')](_0x2c8560[_0xdcb0('0x3b')],{'$or':[{'key':{'$like':'%'+_0x2b618e[_0xdcb0('0x31')][_0xdcb0('0x3e')]+'%'}},{'value':{'$like':'%'+_0x2b618e[_0xdcb0('0x31')][_0xdcb0('0x3e')]+'%'}}]});}_0x2c8560=_[_0xdcb0('0x3d')]({},_0x2c8560,_0x2b618e[_0xdcb0('0x3f')]);var _0x47198c={'where':_0x2c8560['where']};return db['CannedAnswer'][_0xdcb0('0x1c')](_0x47198c)[_0xdcb0('0x26')](function(_0x1cbc54){_0x3c0423[_0xdcb0('0x1c')]=_0x1cbc54;if(_0x2b618e['query'][_0xdcb0('0x40')]){_0x2c8560[_0xdcb0('0x41')]=[{'all':!![]}];}return db['CannedAnswer'][_0xdcb0('0x42')](_0x2c8560);})[_0xdcb0('0x26')](function(_0x3fa7ba){_0x3c0423[_0xdcb0('0x43')]=_0x3fa7ba;return _0x3c0423;})[_0xdcb0('0x26')](respondWithFilteredResult(_0x7dde8a,_0x2c8560))[_0xdcb0('0x44')](handleError(_0x7dde8a,null));};exports[_0xdcb0('0x45')]=function(_0x20bc14,_0x3c4438){var _0x2bf7a5={'raw':!![],'where':{'id':_0x20bc14[_0xdcb0('0x46')]['id']}},_0x4978aa={};_0x4978aa['model']=_[_0xdcb0('0x47')](db['CannedAnswer'][_0xdcb0('0x2c')]);_0x4978aa['query']=_[_0xdcb0('0x47')](_0x20bc14['query']);_0x4978aa[_0xdcb0('0x32')]=_[_0xdcb0('0x33')](_0x4978aa['model'],_0x4978aa[_0xdcb0('0x31')]);_0x2bf7a5[_0xdcb0('0x34')]=_[_0xdcb0('0x33')](_0x4978aa[_0xdcb0('0x30')],qs[_0xdcb0('0x35')](_0x20bc14['query'][_0xdcb0('0x35')]));_0x2bf7a5[_0xdcb0('0x34')]=_0x2bf7a5[_0xdcb0('0x34')][_0xdcb0('0x48')]?_0x2bf7a5[_0xdcb0('0x34')]:_0x4978aa['model'];if(_0x20bc14[_0xdcb0('0x31')][_0xdcb0('0x40')]){_0x2bf7a5['include']=[{'all':!![]}];}_0x2bf7a5=_['merge']({},_0x2bf7a5,_0x20bc14['options']);return db[_0xdcb0('0x49')][_0xdcb0('0x4a')](_0x2bf7a5)[_0xdcb0('0x26')](handleEntityNotFound(_0x3c4438,null))['then'](respondWithResult(_0x3c4438,null))[_0xdcb0('0x44')](handleError(_0x3c4438,null));};exports[_0xdcb0('0x23')]=function(_0x5688c3,_0x49c11a){if(_0x5688c3[_0xdcb0('0x4b')]['id']){delete _0x5688c3[_0xdcb0('0x4b')]['id'];}return db[_0xdcb0('0x49')][_0xdcb0('0x4a')]({'where':{'id':_0x5688c3['params']['id']}})['then'](handleEntityNotFound(_0x49c11a,null))[_0xdcb0('0x26')](saveUpdates(_0x5688c3[_0xdcb0('0x4b')],null))['then'](respondWithResult(_0x49c11a,null))[_0xdcb0('0x44')](handleError(_0x49c11a,null));};exports[_0xdcb0('0x25')]=function(_0x50a031,_0x279da6){return db[_0xdcb0('0x49')][_0xdcb0('0x4a')]({'where':{'id':_0x50a031['params']['id']}})['then'](handleEntityNotFound(_0x279da6,null))[_0xdcb0('0x26')](removeEntity(_0x279da6,null))[_0xdcb0('0x44')](handleError(_0x279da6,null));};exports['create']=function(_0x2e0975,_0x230496){var _0x5291fd={'key':_0x2e0975[_0xdcb0('0x4b')][_0xdcb0('0x2f')]};if(_0x2e0975[_0xdcb0('0x4b')]['MailAccountId']){_0x5291fd[_0xdcb0('0x4c')]=_0x2e0975[_0xdcb0('0x4b')]['MailAccountId'];}else if(_0x2e0975[_0xdcb0('0x4b')][_0xdcb0('0x4d')]){_0x5291fd['SmsAccountId']=_0x2e0975[_0xdcb0('0x4b')][_0xdcb0('0x4d')];}else if(_0x2e0975[_0xdcb0('0x4b')]['OpenchannelAccountId']){_0x5291fd[_0xdcb0('0x4e')]=_0x2e0975[_0xdcb0('0x4b')][_0xdcb0('0x4e')];}else if(_0x2e0975['body'][_0xdcb0('0x4f')]){_0x5291fd[_0xdcb0('0x4f')]=_0x2e0975[_0xdcb0('0x4b')][_0xdcb0('0x4f')];}return db['CannedAnswer'][_0xdcb0('0x4a')]({'where':_0x5291fd})[_0xdcb0('0x26')](function(_0x1fa4b2){if(_0x1fa4b2){throw new db[(_0xdcb0('0x50'))]['ValidationError']('The\x20inserted\x20key\x20already\x20exists.');}return db[_0xdcb0('0x49')][_0xdcb0('0x51')](_0x2e0975['body']);})[_0xdcb0('0x26')](function(_0x497ad3){var _0x39e31e=_0x2e0975[_0xdcb0('0x52')][_0xdcb0('0x24')]({'plain':!![]});if(!_0x39e31e)throw new Error(_0xdcb0('0x53'));if(_0x39e31e['role']===_0xdcb0('0x52')){var _0x16c164=_0x497ad3[_0xdcb0('0x24')]({'plain':!![]});return db[_0xdcb0('0x54')][_0xdcb0('0x4a')]({'where':{'name':_0xdcb0('0x55'),'userProfileId':_0x39e31e[_0xdcb0('0x56')]},'raw':!![]})[_0xdcb0('0x26')](function(_0x1d1b11){if(_0x1d1b11&&_0x1d1b11[_0xdcb0('0x57')]===0x0){return db[_0xdcb0('0x58')][_0xdcb0('0x51')]({'name':_0x16c164['name'],'resourceId':_0x16c164['id'],'type':_0x1d1b11[_0xdcb0('0x29')],'sectionId':_0x1d1b11['id']},{})['then'](function(){return _0x497ad3;});}else{return _0x497ad3;}})[_0xdcb0('0x44')](function(_0x4f1a7c){logger[_0xdcb0('0x27')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4f1a7c);throw _0x4f1a7c;});}return _0x497ad3;})[_0xdcb0('0x26')](respondWithResult(_0x230496,0xc9))[_0xdcb0('0x44')](handleError(_0x230496,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 2f17a87..60e8ef2 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 _0x4f8c=['path','rimraf','../../config/environment','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','request-promise'];(function(_0x2bf466,_0x4929a5){var _0x856885=function(_0x102ef1){while(--_0x102ef1){_0x2bf466['push'](_0x2bf466['shift']());}};_0x856885(++_0x4929a5);}(_0x4f8c,0x1b6));var _0xc4f8=function(_0x10c2a6,_0x58814b){_0x10c2a6=_0x10c2a6-0x0;var _0x487d21=_0x4f8c[_0x10c2a6];return _0x487d21;};'use strict';var _=require(_0xc4f8('0x0'));var util=require('util');var logger=require(_0xc4f8('0x1'))(_0xc4f8('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xc4f8('0x3'));var fs=require('fs');var path=require(_0xc4f8('0x4'));var rimraf=require(_0xc4f8('0x5'));var config=require(_0xc4f8('0x6'));var attributes=require('./cannedAnswer.attributes');module[_0xc4f8('0x7')]=function(_0x22833c,_0x4cda4d){return _0x22833c[_0xc4f8('0x8')](_0xc4f8('0x9'),attributes,{'tableName':_0xc4f8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc4f8('0xb'),'collate':_0xc4f8('0xc')});}; \ No newline at end of file +var _0xd934=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x385732,_0x5765cd){var _0x1f4f64=function(_0x177a32){while(--_0x177a32){_0x385732['push'](_0x385732['shift']());}};_0x1f4f64(++_0x5765cd);}(_0xd934,0x15d));var _0x4d93=function(_0x339e15,_0x297af8){_0x339e15=_0x339e15-0x0;var _0x1786bb=_0xd934[_0x339e15];return _0x1786bb;};'use strict';var _=require(_0x4d93('0x0'));var util=require(_0x4d93('0x1'));var logger=require(_0x4d93('0x2'))(_0x4d93('0x3'));var moment=require(_0x4d93('0x4'));var BPromise=require(_0x4d93('0x5'));var rp=require(_0x4d93('0x6'));var fs=require('fs');var path=require(_0x4d93('0x7'));var rimraf=require(_0x4d93('0x8'));var config=require(_0x4d93('0x9'));var attributes=require(_0x4d93('0xa'));module[_0x4d93('0xb')]=function(_0x579f98,_0x19e053){return _0x579f98[_0x4d93('0xc')]('CannedAnswer',attributes,{'tableName':_0x4d93('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4d93('0xe'),'collate':_0x4d93('0xf')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 54cd127..0bfee3d 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 _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\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(_0xb1737,_0x1fbec6){var _0x5abe58=function(_0x17c99e){while(--_0x17c99e){_0xb1737['push'](_0xb1737['shift']());}};_0x5abe58(++_0x1fbec6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0xa9e0[_0x29b609];return _0x54c952;};'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','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\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(_0x406960,_0x55c0cb){var _0x1861b7=function(_0xdeb458){while(--_0xdeb458){_0x406960['push'](_0x406960['shift']());}};_0x1861b7(++_0x55c0cb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0xa9e0[_0x138f59];return _0x3d114d;};'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/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 003b2d6..ee7b719 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 _0x23dd=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','create','put','destroy','exports','multer','util','path'];(function(_0x3171d0,_0x2ee635){var _0x404bbb=function(_0x324b6b){while(--_0x324b6b){_0x3171d0['push'](_0x3171d0['shift']());}};_0x404bbb(++_0x2ee635);}(_0x23dd,0x165));var _0xd23d=function(_0x5b12a0,_0x5a0d8b){_0x5b12a0=_0x5b12a0-0x0;var _0x452bcd=_0x23dd[_0x5b12a0];return _0x452bcd;};'use strict';var multer=require(_0xd23d('0x0'));var util=require(_0xd23d('0x1'));var path=require(_0xd23d('0x2'));var timeout=require(_0xd23d('0x3'));var express=require(_0xd23d('0x4'));var router=express[_0xd23d('0x5')]();var fs_extra=require(_0xd23d('0x6'));var auth=require(_0xd23d('0x7'));var interaction=require(_0xd23d('0x8'));var config=require('../../config/environment');var controller=require('./cannedAnswer.controller');router[_0xd23d('0x9')]('/',auth[_0xd23d('0xa')](),controller['index']);router[_0xd23d('0x9')](_0xd23d('0xb'),auth[_0xd23d('0xa')](),controller[_0xd23d('0xc')]);router[_0xd23d('0xd')]('/',auth[_0xd23d('0xa')](),controller[_0xd23d('0xe')]);router[_0xd23d('0xf')](_0xd23d('0xb'),auth[_0xd23d('0xa')](),controller['update']);router['delete'](_0xd23d('0xb'),auth[_0xd23d('0xa')](),controller[_0xd23d('0x10')]);module[_0xd23d('0x11')]=router; \ No newline at end of file +var _0x69bb=['exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','/:id','show','post','isAuthenticated','put','update','delete','destroy'];(function(_0xed4aba,_0x184552){var _0xc93266=function(_0x56b187){while(--_0x56b187){_0xed4aba['push'](_0xed4aba['shift']());}};_0xc93266(++_0x184552);}(_0x69bb,0x16a));var _0xb69b=function(_0x212906,_0x14fd73){_0x212906=_0x212906-0x0;var _0x246636=_0x69bb[_0x212906];return _0x246636;};'use strict';var multer=require(_0xb69b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xb69b('0x1'));var express=require(_0xb69b('0x2'));var router=express[_0xb69b('0x3')]();var fs_extra=require(_0xb69b('0x4'));var auth=require(_0xb69b('0x5'));var interaction=require(_0xb69b('0x6'));var config=require(_0xb69b('0x7'));var controller=require(_0xb69b('0x8'));router[_0xb69b('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb69b('0x9')](_0xb69b('0xa'),auth['isAuthenticated'](),controller[_0xb69b('0xb')]);router[_0xb69b('0xc')]('/',auth[_0xb69b('0xd')](),controller['create']);router[_0xb69b('0xe')](_0xb69b('0xa'),auth[_0xb69b('0xd')](),controller[_0xb69b('0xf')]);router[_0xb69b('0x10')]('/:id',auth[_0xb69b('0xd')](),controller[_0xb69b('0x11')]);module[_0xb69b('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 2d1a7e1..1aaed85 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 _0x7be1=['STRING','INTEGER','exports','DATE','1970-01-01\x2000:00:01'];(function(_0x5f108c,_0x57c0a1){var _0x333268=function(_0x2fc46a){while(--_0x2fc46a){_0x5f108c['push'](_0x5f108c['shift']());}};_0x333268(++_0x57c0a1);}(_0x7be1,0x98));var _0x17be=function(_0x2e846f,_0x57929a){_0x2e846f=_0x2e846f-0x0;var _0x42f147=_0x7be1[_0x2e846f];return _0x42f147;};'use strict';var Sequelize=require('sequelize');module[_0x17be('0x0')]={'calldate':{'type':Sequelize[_0x17be('0x1')],'allowNull':![],'defaultValue':_0x17be('0x2')},'clid':{'type':Sequelize[_0x17be('0x3')]},'src':{'type':Sequelize[_0x17be('0x3')]},'dst':{'type':Sequelize['STRING']},'dcontext':{'type':Sequelize[_0x17be('0x3')]},'channel':{'type':Sequelize['STRING']},'dstchannel':{'type':Sequelize[_0x17be('0x3')]},'lastapp':{'type':Sequelize[_0x17be('0x3')]},'lastdata':{'type':Sequelize[_0x17be('0x3')]},'duration':{'type':Sequelize[_0x17be('0x4')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x17be('0x3')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0x17be('0x3')]},'uniqueid':{'type':Sequelize[_0x17be('0x3')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize['STRING']},'peeraccount':{'type':Sequelize[_0x17be('0x3')]},'type':{'type':Sequelize[_0x17be('0x3')]},'tag':{'type':Sequelize[_0x17be('0x3')]}}; \ No newline at end of file +var _0x6ea9=['exports','DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize'];(function(_0xa6f9d2,_0x276431){var _0x3fccb3=function(_0x3c101a){while(--_0x3c101a){_0xa6f9d2['push'](_0xa6f9d2['shift']());}};_0x3fccb3(++_0x276431);}(_0x6ea9,0x89));var _0x96ea=function(_0x5b2b40,_0x5a0fb3){_0x5b2b40=_0x5b2b40-0x0;var _0x33cff0=_0x6ea9[_0x5b2b40];return _0x33cff0;};'use strict';var Sequelize=require(_0x96ea('0x0'));module[_0x96ea('0x1')]={'calldate':{'type':Sequelize[_0x96ea('0x2')],'allowNull':![],'defaultValue':_0x96ea('0x3')},'clid':{'type':Sequelize[_0x96ea('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x96ea('0x4')]},'dcontext':{'type':Sequelize[_0x96ea('0x4')]},'channel':{'type':Sequelize[_0x96ea('0x4')]},'dstchannel':{'type':Sequelize['STRING']},'lastapp':{'type':Sequelize[_0x96ea('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x96ea('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x96ea('0x4')]},'amaflags':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x96ea('0x4')]},'userfield':{'type':Sequelize[_0x96ea('0x4')]},'uniqueid':{'type':Sequelize[_0x96ea('0x4')]},'linkedid':{'type':Sequelize[_0x96ea('0x4')]},'sequence':{'type':Sequelize[_0x96ea('0x4')]},'peeraccount':{'type':Sequelize[_0x96ea('0x4')]},'type':{'type':Sequelize['STRING']},'tag':{'type':Sequelize[_0x96ea('0x4')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index f04d2d9..e5be50e 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 _0x8a28=['filter','where','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','Cdr','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0xa20086,_0x3978a9){var _0x121c6e=function(_0x16a848){while(--_0x16a848){_0xa20086['push'](_0xa20086['shift']());}};_0x121c6e(++_0x3978a9);}(_0x8a28,0xfd));var _0x88a2=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0x8a28[_0x37bd26];return _0xe83dc4;};'use strict';var emlformat=require(_0x88a2('0x0'));var rimraf=require(_0x88a2('0x1'));var zipdir=require(_0x88a2('0x2'));var jsonpatch=require(_0x88a2('0x3'));var rp=require(_0x88a2('0x4'));var moment=require(_0x88a2('0x5'));var BPromise=require(_0x88a2('0x6'));var Mustache=require(_0x88a2('0x7'));var util=require('util');var path=require(_0x88a2('0x8'));var sox=require(_0x88a2('0x9'));var csv=require(_0x88a2('0xa'));var ejs=require(_0x88a2('0xb'));var fs=require('fs');var fs_extra=require(_0x88a2('0xc'));var _=require('lodash');var squel=require(_0x88a2('0xd'));var crypto=require('crypto');var jsforce=require(_0x88a2('0xe'));var deskjs=require(_0x88a2('0xf'));var toCsv=require(_0x88a2('0xa'));var querystring=require(_0x88a2('0x10'));var Papa=require(_0x88a2('0x11'));var Redis=require(_0x88a2('0x12'));var authService=require(_0x88a2('0x13'));var qs=require(_0x88a2('0x14'));var as=require(_0x88a2('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x88a2('0x16'));var utils=require(_0x88a2('0x17'));var config=require(_0x88a2('0x18'));var licenseUtil=require(_0x88a2('0x19'));var db=require(_0x88a2('0x1a'))['db'];function respondWithStatusCode(_0x4887fc,_0x210a52){_0x210a52=_0x210a52||0xcc;return function(_0x1a4056){if(_0x1a4056){return _0x4887fc[_0x88a2('0x1b')](_0x210a52);}return _0x4887fc[_0x88a2('0x1c')](_0x210a52)['end']();};}function respondWithResult(_0x923706,_0x407ef0){_0x407ef0=_0x407ef0||0xc8;return function(_0x3b83ce){if(_0x3b83ce){return _0x923706['status'](_0x407ef0)[_0x88a2('0x1d')](_0x3b83ce);}};}function respondWithFilteredResult(_0x207b12,_0x462b7b){return function(_0x42facc){if(_0x42facc){var _0x1beccd=typeof _0x462b7b[_0x88a2('0x1e')]===_0x88a2('0x1f')&&typeof _0x462b7b[_0x88a2('0x20')]===_0x88a2('0x1f');var _0x417bf8=_0x42facc[_0x88a2('0x21')];var _0x3c030e=_0x1beccd?0x0:_0x462b7b[_0x88a2('0x1e')];var _0x29dc1b=_0x1beccd?_0x42facc[_0x88a2('0x21')]:_0x462b7b[_0x88a2('0x1e')]+_0x462b7b[_0x88a2('0x20')];var _0x46ed82;if(_0x29dc1b>=_0x417bf8){_0x29dc1b=_0x417bf8;_0x46ed82=0xc8;}else{_0x46ed82=0xce;}_0x207b12['status'](_0x46ed82);return _0x207b12[_0x88a2('0x22')](_0x88a2('0x23'),_0x3c030e+'-'+_0x29dc1b+'/'+_0x417bf8)['json'](_0x42facc);}return null;};}function patchUpdates(_0x499891){return function(_0x7a054c){try{jsonpatch[_0x88a2('0x24')](_0x7a054c,_0x499891,!![]);}catch(_0x102139){return BPromise[_0x88a2('0x25')](_0x102139);}return _0x7a054c[_0x88a2('0x26')]();};}function saveUpdates(_0x54c6ed,_0x3b6401){return function(_0xda54c4){if(_0xda54c4){return _0xda54c4[_0x88a2('0x27')](_0x54c6ed)[_0x88a2('0x28')](function(_0x4be832){return _0x4be832;});}return null;};}function removeEntity(_0x1f104c,_0x527744){return function(_0x5bbd79){if(_0x5bbd79){return _0x5bbd79[_0x88a2('0x29')]()[_0x88a2('0x28')](function(){_0x1f104c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1343fc,_0xac4afe){return function(_0x5be767){if(!_0x5be767){_0x1343fc[_0x88a2('0x1b')](0x194);}return _0x5be767;};}function handleError(_0x4427a1,_0x2ba881){_0x2ba881=_0x2ba881||0x1f4;return function(_0x2474fc){logger['error'](_0x2474fc[_0x88a2('0x2a')]);if(_0x2474fc['name']){delete _0x2474fc[_0x88a2('0x2b')];}_0x4427a1[_0x88a2('0x1c')](_0x2ba881)[_0x88a2('0x2c')](_0x2474fc);};}exports['index']=function(_0x165259,_0x3eca1a){var _0x4c441a={},_0x21bd1b={},_0x537a8f={'count':0x0,'rows':[]};var _0x541cd0=_['map'](db[_0x88a2('0x2d')][_0x88a2('0x2e')],function(_0x1ceaab){return{'name':_0x1ceaab[_0x88a2('0x2f')],'type':_0x1ceaab[_0x88a2('0x30')][_0x88a2('0x31')]};});_0x21bd1b['model']=_[_0x88a2('0x32')](_0x541cd0,_0x88a2('0x2b'));_0x21bd1b[_0x88a2('0x33')]=_[_0x88a2('0x34')](_0x165259[_0x88a2('0x33')]);_0x21bd1b[_0x88a2('0x35')]=_[_0x88a2('0x36')](_0x21bd1b[_0x88a2('0x37')],_0x21bd1b[_0x88a2('0x33')]);_0x4c441a[_0x88a2('0x38')]=_['intersection'](_0x21bd1b['model'],qs[_0x88a2('0x39')](_0x165259[_0x88a2('0x33')][_0x88a2('0x39')]));_0x4c441a['attributes']=_0x4c441a[_0x88a2('0x38')][_0x88a2('0x3a')]?_0x4c441a['attributes']:_0x21bd1b[_0x88a2('0x37')];if(!_0x165259[_0x88a2('0x33')][_0x88a2('0x3b')]('nolimit')){_0x4c441a['limit']=qs[_0x88a2('0x20')](_0x165259[_0x88a2('0x33')]['limit']);_0x4c441a[_0x88a2('0x1e')]=qs[_0x88a2('0x1e')](_0x165259[_0x88a2('0x33')][_0x88a2('0x1e')]);}_0x4c441a[_0x88a2('0x3c')]=qs[_0x88a2('0x3d')](_0x165259[_0x88a2('0x33')][_0x88a2('0x3d')]);_0x4c441a['where']=qs[_0x88a2('0x35')](_[_0x88a2('0x3e')](_0x165259['query'],_0x21bd1b[_0x88a2('0x35')]),_0x541cd0);if(_0x165259[_0x88a2('0x33')][_0x88a2('0x3f')]){_0x4c441a[_0x88a2('0x40')]=_[_0x88a2('0x41')](_0x4c441a[_0x88a2('0x40')],{'$or':_[_0x88a2('0x32')](_0x541cd0,function(_0x21828b){if(_0x21828b[_0x88a2('0x30')]!==_0x88a2('0x42')){var _0x120e17={};_0x120e17[_0x21828b[_0x88a2('0x2b')]]={'$like':'%'+_0x165259[_0x88a2('0x33')][_0x88a2('0x3f')]+'%'};return _0x120e17;}})});}_0x4c441a=_[_0x88a2('0x41')]({},_0x4c441a,_0x165259[_0x88a2('0x43')]);var _0x1496d9={'where':_0x4c441a[_0x88a2('0x40')]};return db[_0x88a2('0x2d')][_0x88a2('0x21')](_0x1496d9)[_0x88a2('0x28')](function(_0x201591){_0x537a8f[_0x88a2('0x21')]=_0x201591;if(_0x165259[_0x88a2('0x33')][_0x88a2('0x44')]){_0x4c441a['include']=[{'all':!![]}];}return db['Cdr'][_0x88a2('0x45')](_0x4c441a);})[_0x88a2('0x28')](function(_0x555415){_0x537a8f[_0x88a2('0x46')]=_0x555415;return _0x537a8f;})[_0x88a2('0x28')](respondWithFilteredResult(_0x3eca1a,_0x4c441a))[_0x88a2('0x47')](handleError(_0x3eca1a,null));};exports[_0x88a2('0x48')]=function(_0x339648,_0x33a5c7){var _0x4d9726={'raw':!![],'where':{'id':_0x339648[_0x88a2('0x49')]['id']}},_0x23f8c8={};_0x23f8c8[_0x88a2('0x37')]=_['keys'](db[_0x88a2('0x2d')][_0x88a2('0x2e')]);_0x23f8c8[_0x88a2('0x33')]=_[_0x88a2('0x34')](_0x339648['query']);_0x23f8c8[_0x88a2('0x35')]=_[_0x88a2('0x36')](_0x23f8c8[_0x88a2('0x37')],_0x23f8c8[_0x88a2('0x33')]);_0x4d9726[_0x88a2('0x38')]=_[_0x88a2('0x36')](_0x23f8c8[_0x88a2('0x37')],qs[_0x88a2('0x39')](_0x339648[_0x88a2('0x33')][_0x88a2('0x39')]));_0x4d9726[_0x88a2('0x38')]=_0x4d9726[_0x88a2('0x38')][_0x88a2('0x3a')]?_0x4d9726[_0x88a2('0x38')]:_0x23f8c8[_0x88a2('0x37')];if(_0x339648[_0x88a2('0x33')][_0x88a2('0x44')]){_0x4d9726[_0x88a2('0x4a')]=[{'all':!![]}];}_0x4d9726=_[_0x88a2('0x41')]({},_0x4d9726,_0x339648[_0x88a2('0x43')]);return db['Cdr'][_0x88a2('0x4b')](_0x4d9726)['then'](handleEntityNotFound(_0x33a5c7,null))[_0x88a2('0x28')](respondWithResult(_0x33a5c7,null))['catch'](handleError(_0x33a5c7,null));};exports[_0x88a2('0x4c')]=function(_0x25dad5,_0x1c5e6b){return db[_0x88a2('0x2d')][_0x88a2('0x4c')](_0x25dad5[_0x88a2('0x4d')],{})[_0x88a2('0x28')](respondWithResult(_0x1c5e6b,0xc9))[_0x88a2('0x47')](handleError(_0x1c5e6b,null));};exports['update']=function(_0x1d773c,_0x1cc256){if(_0x1d773c['body']['id']){delete _0x1d773c[_0x88a2('0x4d')]['id'];}return db['Cdr'][_0x88a2('0x4b')]({'where':{'id':_0x1d773c['params']['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x1cc256,null))[_0x88a2('0x28')](saveUpdates(_0x1d773c[_0x88a2('0x4d')],null))[_0x88a2('0x28')](respondWithResult(_0x1cc256,null))[_0x88a2('0x47')](handleError(_0x1cc256,null));};exports[_0x88a2('0x29')]=function(_0x39bffe,_0x2fbdf4){return db[_0x88a2('0x2d')][_0x88a2('0x4b')]({'where':{'id':_0x39bffe[_0x88a2('0x49')]['id']}})[_0x88a2('0x28')](handleEntityNotFound(_0x2fbdf4,null))['then'](removeEntity(_0x2fbdf4,null))['catch'](handleError(_0x2fbdf4,null));};exports[_0x88a2('0x4e')]=function(_0x889d30,_0x20f198){return db[_0x88a2('0x2d')][_0x88a2('0x4e')]()['then'](respondWithResult(_0x20f198,null))[_0x88a2('0x47')](handleError(_0x20f198,null));}; \ No newline at end of file +var _0x56e7=['end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','Cdr','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','map','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','keys','length','create','body','find','describe','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status'];(function(_0x1803f9,_0x23d3d1){var _0x487eaf=function(_0x4d169c){while(--_0x4d169c){_0x1803f9['push'](_0x1803f9['shift']());}};_0x487eaf(++_0x23d3d1);}(_0x56e7,0x7b));var _0x756e=function(_0x4b2651,_0x3aca34){_0x4b2651=_0x4b2651-0x0;var _0x5a89af=_0x56e7[_0x4b2651];return _0x5a89af;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x756e('0x0'));var zipdir=require(_0x756e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x756e('0x2'));var moment=require(_0x756e('0x3'));var BPromise=require(_0x756e('0x4'));var Mustache=require(_0x756e('0x5'));var util=require(_0x756e('0x6'));var path=require(_0x756e('0x7'));var sox=require(_0x756e('0x8'));var csv=require('to-csv');var ejs=require(_0x756e('0x9'));var fs=require('fs');var fs_extra=require(_0x756e('0xa'));var _=require(_0x756e('0xb'));var squel=require(_0x756e('0xc'));var crypto=require('crypto');var jsforce=require(_0x756e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x756e('0xe'));var querystring=require(_0x756e('0xf'));var Papa=require(_0x756e('0x10'));var Redis=require(_0x756e('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x756e('0x12'));var hardwareService=require(_0x756e('0x13'));var logger=require(_0x756e('0x14'))('api');var utils=require(_0x756e('0x15'));var config=require(_0x756e('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b68ef,_0x569e8f){_0x569e8f=_0x569e8f||0xcc;return function(_0x459237){if(_0x459237){return _0x1b68ef[_0x756e('0x17')](_0x569e8f);}return _0x1b68ef[_0x756e('0x18')](_0x569e8f)[_0x756e('0x19')]();};}function respondWithResult(_0x252333,_0x4ae32a){_0x4ae32a=_0x4ae32a||0xc8;return function(_0x4b3660){if(_0x4b3660){return _0x252333[_0x756e('0x18')](_0x4ae32a)[_0x756e('0x1a')](_0x4b3660);}};}function respondWithFilteredResult(_0xccccd4,_0x59956f){return function(_0x530e36){if(_0x530e36){var _0x1f7161=typeof _0x59956f[_0x756e('0x1b')]===_0x756e('0x1c')&&typeof _0x59956f[_0x756e('0x1d')]===_0x756e('0x1c');var _0x285290=_0x530e36[_0x756e('0x1e')];var _0x1a8614=_0x1f7161?0x0:_0x59956f[_0x756e('0x1b')];var _0x4da91f=_0x1f7161?_0x530e36[_0x756e('0x1e')]:_0x59956f['offset']+_0x59956f['limit'];var _0x157be3;if(_0x4da91f>=_0x285290){_0x4da91f=_0x285290;_0x157be3=0xc8;}else{_0x157be3=0xce;}_0xccccd4[_0x756e('0x18')](_0x157be3);return _0xccccd4[_0x756e('0x1f')](_0x756e('0x20'),_0x1a8614+'-'+_0x4da91f+'/'+_0x285290)[_0x756e('0x1a')](_0x530e36);}return null;};}function patchUpdates(_0x4e99a2){return function(_0xb00195){try{jsonpatch[_0x756e('0x21')](_0xb00195,_0x4e99a2,!![]);}catch(_0x88787d){return BPromise[_0x756e('0x22')](_0x88787d);}return _0xb00195[_0x756e('0x23')]();};}function saveUpdates(_0x83cdb5,_0x42173f){return function(_0x24d4ad){if(_0x24d4ad){return _0x24d4ad[_0x756e('0x24')](_0x83cdb5)[_0x756e('0x25')](function(_0x4b3230){return _0x4b3230;});}return null;};}function removeEntity(_0x335523,_0x4b38b4){return function(_0x256dc1){if(_0x256dc1){return _0x256dc1[_0x756e('0x26')]()[_0x756e('0x25')](function(){_0x335523[_0x756e('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ef5ef,_0x4cbd7){return function(_0x2f4db8){if(!_0x2f4db8){_0x3ef5ef['sendStatus'](0x194);}return _0x2f4db8;};}function handleError(_0x32815d,_0x44f8f9){_0x44f8f9=_0x44f8f9||0x1f4;return function(_0x29dffb){logger['error'](_0x29dffb[_0x756e('0x27')]);if(_0x29dffb[_0x756e('0x28')]){delete _0x29dffb['name'];}_0x32815d[_0x756e('0x18')](_0x44f8f9)[_0x756e('0x29')](_0x29dffb);};}exports[_0x756e('0x2a')]=function(_0x5a1cf0,_0x3c332e){var _0x308153={},_0x5c6949={},_0x20543c={'count':0x0,'rows':[]};var _0x2a7fdb=_['map'](db[_0x756e('0x2b')][_0x756e('0x2c')],function(_0x39acd7){return{'name':_0x39acd7[_0x756e('0x2d')],'type':_0x39acd7[_0x756e('0x2e')]['key']};});_0x5c6949[_0x756e('0x2f')]=_['map'](_0x2a7fdb,'name');_0x5c6949[_0x756e('0x30')]=_['keys'](_0x5a1cf0[_0x756e('0x30')]);_0x5c6949[_0x756e('0x31')]=_[_0x756e('0x32')](_0x5c6949[_0x756e('0x2f')],_0x5c6949[_0x756e('0x30')]);_0x308153[_0x756e('0x33')]=_[_0x756e('0x32')](_0x5c6949[_0x756e('0x2f')],qs[_0x756e('0x34')](_0x5a1cf0[_0x756e('0x30')][_0x756e('0x34')]));_0x308153[_0x756e('0x33')]=_0x308153['attributes']['length']?_0x308153[_0x756e('0x33')]:_0x5c6949[_0x756e('0x2f')];if(!_0x5a1cf0[_0x756e('0x30')][_0x756e('0x35')](_0x756e('0x36'))){_0x308153[_0x756e('0x1d')]=qs[_0x756e('0x1d')](_0x5a1cf0['query']['limit']);_0x308153['offset']=qs[_0x756e('0x1b')](_0x5a1cf0[_0x756e('0x30')][_0x756e('0x1b')]);}_0x308153['order']=qs[_0x756e('0x37')](_0x5a1cf0[_0x756e('0x30')]['sort']);_0x308153[_0x756e('0x38')]=qs[_0x756e('0x31')](_[_0x756e('0x39')](_0x5a1cf0[_0x756e('0x30')],_0x5c6949[_0x756e('0x31')]),_0x2a7fdb);if(_0x5a1cf0[_0x756e('0x30')][_0x756e('0x3a')]){_0x308153[_0x756e('0x38')]=_['merge'](_0x308153[_0x756e('0x38')],{'$or':_[_0x756e('0x3b')](_0x2a7fdb,function(_0x20f979){if(_0x20f979[_0x756e('0x2e')]!==_0x756e('0x3c')){var _0x3a66fe={};_0x3a66fe[_0x20f979[_0x756e('0x28')]]={'$like':'%'+_0x5a1cf0[_0x756e('0x30')][_0x756e('0x3a')]+'%'};return _0x3a66fe;}})});}_0x308153=_[_0x756e('0x3d')]({},_0x308153,_0x5a1cf0['options']);var _0x41a100={'where':_0x308153[_0x756e('0x38')]};return db['Cdr'][_0x756e('0x1e')](_0x41a100)[_0x756e('0x25')](function(_0x2b4fc3){_0x20543c['count']=_0x2b4fc3;if(_0x5a1cf0[_0x756e('0x30')][_0x756e('0x3e')]){_0x308153[_0x756e('0x3f')]=[{'all':!![]}];}return db['Cdr'][_0x756e('0x40')](_0x308153);})[_0x756e('0x25')](function(_0x5856f){_0x20543c[_0x756e('0x41')]=_0x5856f;return _0x20543c;})[_0x756e('0x25')](respondWithFilteredResult(_0x3c332e,_0x308153))[_0x756e('0x42')](handleError(_0x3c332e,null));};exports['show']=function(_0x9bedd3,_0x2b593d){var _0x5c471e={'raw':!![],'where':{'id':_0x9bedd3[_0x756e('0x43')]['id']}},_0xa031fb={};_0xa031fb[_0x756e('0x2f')]=_[_0x756e('0x44')](db[_0x756e('0x2b')][_0x756e('0x2c')]);_0xa031fb[_0x756e('0x30')]=_[_0x756e('0x44')](_0x9bedd3[_0x756e('0x30')]);_0xa031fb['filters']=_[_0x756e('0x32')](_0xa031fb['model'],_0xa031fb[_0x756e('0x30')]);_0x5c471e[_0x756e('0x33')]=_[_0x756e('0x32')](_0xa031fb['model'],qs[_0x756e('0x34')](_0x9bedd3[_0x756e('0x30')][_0x756e('0x34')]));_0x5c471e['attributes']=_0x5c471e['attributes'][_0x756e('0x45')]?_0x5c471e[_0x756e('0x33')]:_0xa031fb['model'];if(_0x9bedd3['query'][_0x756e('0x3e')]){_0x5c471e[_0x756e('0x3f')]=[{'all':!![]}];}_0x5c471e=_[_0x756e('0x3d')]({},_0x5c471e,_0x9bedd3['options']);return db[_0x756e('0x2b')]['find'](_0x5c471e)[_0x756e('0x25')](handleEntityNotFound(_0x2b593d,null))[_0x756e('0x25')](respondWithResult(_0x2b593d,null))[_0x756e('0x42')](handleError(_0x2b593d,null));};exports['create']=function(_0x31d076,_0x5224f2){return db['Cdr'][_0x756e('0x46')](_0x31d076['body'],{})[_0x756e('0x25')](respondWithResult(_0x5224f2,0xc9))[_0x756e('0x42')](handleError(_0x5224f2,null));};exports[_0x756e('0x24')]=function(_0x2512d3,_0x95061c){if(_0x2512d3[_0x756e('0x47')]['id']){delete _0x2512d3['body']['id'];}return db[_0x756e('0x2b')]['find']({'where':{'id':_0x2512d3[_0x756e('0x43')]['id']}})['then'](handleEntityNotFound(_0x95061c,null))[_0x756e('0x25')](saveUpdates(_0x2512d3['body'],null))[_0x756e('0x25')](respondWithResult(_0x95061c,null))['catch'](handleError(_0x95061c,null));};exports[_0x756e('0x26')]=function(_0x37ddd0,_0x27a201){return db['Cdr'][_0x756e('0x48')]({'where':{'id':_0x37ddd0[_0x756e('0x43')]['id']}})['then'](handleEntityNotFound(_0x27a201,null))['then'](removeEntity(_0x27a201,null))[_0x756e('0x42')](handleError(_0x27a201,null));};exports[_0x756e('0x49')]=function(_0x34a556,_0x2ef29e){return db[_0x756e('0x2b')][_0x756e('0x49')]()[_0x756e('0x25')](respondWithResult(_0x2ef29e,null))[_0x756e('0x42')](handleError(_0x2ef29e,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index af1f280..fb3d6ef 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 _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x347887,_0x2ffffa){var _0x454f59=function(_0x4c3883){while(--_0x4c3883){_0x347887['push'](_0x347887['shift']());}};_0x454f59(++_0x2ffffa);}(_0x7a54,0x106));var _0x47a5=function(_0x3f484f,_0x1eebcd){_0x3f484f=_0x3f484f-0x0;var _0x233c80=_0x7a54[_0x3f484f];return _0x233c80;};'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':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x3925c5,_0x397043){var _0x209766=function(_0x943b76){while(--_0x943b76){_0x3925c5['push'](_0x3925c5['shift']());}};_0x209766(++_0x397043);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 0eedb74..3244108 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 _0xe5e0=['debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','Cdr,\x20%s,\x20%s'];(function(_0x5c5f2f,_0x4325f3){var _0x4ecef=function(_0x94d18c){while(--_0x94d18c){_0x5c5f2f['push'](_0x5c5f2f['shift']());}};_0x4ecef(++_0x4325f3);}(_0xe5e0,0xce));var _0x0e5e=function(_0x1a1bf9,_0x188f0f){_0x1a1bf9=_0x1a1bf9-0x0;var _0x3bbaf4=_0xe5e0[_0x1a1bf9];return _0x3bbaf4;};'use strict';var _=require('lodash');var util=require(_0x0e5e('0x0'));var moment=require(_0x0e5e('0x1'));var BPromise=require(_0x0e5e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e5e('0x3'));var db=require(_0x0e5e('0x4'))['db'];var utils=require(_0x0e5e('0x5'));var logger=require(_0x0e5e('0x6'))(_0x0e5e('0x7'));var config=require(_0x0e5e('0x8'));var jayson=require(_0x0e5e('0x9'));var client=jayson['client'][_0x0e5e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fb5d7,_0x2fcaba,_0x15630c){return new BPromise(function(_0x2fbed5,_0x3206c8){return client[_0x0e5e('0xb')](_0x4fb5d7,_0x15630c)['then'](function(_0x407bed){logger[_0x0e5e('0xc')](_0x0e5e('0xd'),_0x2fcaba,'request\x20sent');logger[_0x0e5e('0xe')](_0x0e5e('0xf'),_0x2fcaba,_0x0e5e('0x10'),JSON['stringify'](_0x407bed));if(_0x407bed[_0x0e5e('0x11')]){if(_0x407bed[_0x0e5e('0x11')][_0x0e5e('0x12')]===0x1f4){logger['error'](_0x0e5e('0xd'),_0x2fcaba,_0x407bed[_0x0e5e('0x11')][_0x0e5e('0x13')]);return _0x3206c8(_0x407bed[_0x0e5e('0x11')]['message']);}logger[_0x0e5e('0x11')](_0x0e5e('0xd'),_0x2fcaba,_0x407bed[_0x0e5e('0x11')][_0x0e5e('0x13')]);return _0x2fbed5(_0x407bed[_0x0e5e('0x11')][_0x0e5e('0x13')]);}else{logger['info'](_0x0e5e('0xd'),_0x2fcaba,_0x0e5e('0x10'));_0x2fbed5(_0x407bed[_0x0e5e('0x14')][_0x0e5e('0x13')]);}})[_0x0e5e('0x15')](function(_0x476707){logger['error'](_0x0e5e('0xd'),_0x2fcaba,_0x476707);_0x3206c8(_0x476707);});});} \ No newline at end of file +var _0x64bf=['moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','Cdr,\x20%s,\x20%s','request\x20sent','Cdr,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x64bf,0x1df));var _0xf64b=function(_0x52576c,_0x5e1424){_0x52576c=_0x52576c-0x0;var _0x246e11=_0x64bf[_0x52576c];return _0x246e11;};'use strict';var _=require('lodash');var util=require(_0xf64b('0x0'));var moment=require(_0xf64b('0x1'));var BPromise=require('bluebird');var rs=require(_0xf64b('0x2'));var fs=require('fs');var Redis=require(_0xf64b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf64b('0x4'));var logger=require(_0xf64b('0x5'))(_0xf64b('0x6'));var config=require(_0xf64b('0x7'));var jayson=require(_0xf64b('0x8'));var client=jayson[_0xf64b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x47be02,_0xaa00ed,_0x526c53){return new BPromise(function(_0x3cb232,_0x59e51e){return client[_0xf64b('0xa')](_0x47be02,_0x526c53)[_0xf64b('0xb')](function(_0x590ef5){logger['info'](_0xf64b('0xc'),_0xaa00ed,_0xf64b('0xd'));logger['debug'](_0xf64b('0xe'),_0xaa00ed,_0xf64b('0xd'),JSON[_0xf64b('0xf')](_0x590ef5));if(_0x590ef5[_0xf64b('0x10')]){if(_0x590ef5[_0xf64b('0x10')]['code']===0x1f4){logger['error'](_0xf64b('0xc'),_0xaa00ed,_0x590ef5[_0xf64b('0x10')][_0xf64b('0x11')]);return _0x59e51e(_0x590ef5[_0xf64b('0x10')][_0xf64b('0x11')]);}logger[_0xf64b('0x10')](_0xf64b('0xc'),_0xaa00ed,_0x590ef5['error'][_0xf64b('0x11')]);return _0x3cb232(_0x590ef5[_0xf64b('0x10')][_0xf64b('0x11')]);}else{logger['info'](_0xf64b('0xc'),_0xaa00ed,_0xf64b('0xd'));_0x3cb232(_0x590ef5[_0xf64b('0x12')]['message']);}})[_0xf64b('0x13')](function(_0x18bb75){logger['error'](_0xf64b('0xc'),_0xaa00ed,_0x18bb75);_0x59e51e(_0x18bb75);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index 04bbb34..00f4a7f 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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x4deff,_0x42c328){var _0x440123=function(_0x2d7dde){while(--_0x2d7dde){_0x4deff['push'](_0x4deff['shift']());}};_0x440123(++_0x42c328);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x55d0fd,_0x1b1bdd){var _0x40ce6f=function(_0x282df9){while(--_0x282df9){_0x55d0fd['push'](_0x55d0fd['shift']());}};_0x40ce6f(++_0x1b1bdd);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 13f3b6d..eaf3118 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 _0x562f=['noop','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x5f5c59,_0x169b7c){var _0x5a5f48=function(_0x5c6489){while(--_0x5c6489){_0x5f5c59['push'](_0x5f5c59['shift']());}};_0x5a5f48(++_0x169b7c);}(_0x562f,0x80));var _0xf562=function(_0xbb6fb5,_0x4db9fb){_0xbb6fb5=_0xbb6fb5-0x0;var _0x2f9501=_0x562f[_0xbb6fb5];return _0x2f9501;};'use strict';var Sequelize=require(_0xf562('0x0'));module[_0xf562('0x1')]={'priority':{'type':Sequelize[_0xf562('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xf562('0x3')],'allowNull':![],'defaultValue':_0xf562('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xf562('0x5')}}; \ No newline at end of file +var _0xf782=['STRING','noop','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x3a52dd,_0x3b1603){var _0x4e7166=function(_0xebfce2){while(--_0xebfce2){_0x3a52dd['push'](_0x3a52dd['shift']());}};_0x4e7166(++_0x3b1603);}(_0xf782,0x123));var _0x2f78=function(_0xe47217,_0x3a35db){_0xe47217=_0xe47217-0x0;var _0x3dc84c=_0xf782[_0xe47217];return _0x3dc84c;};'use strict';var Sequelize=require(_0x2f78('0x0'));module[_0x2f78('0x1')]={'priority':{'type':Sequelize[_0x2f78('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x2f78('0x3')],'allowNull':![],'defaultValue':_0x2f78('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x2f78('0x3')]},'interval':{'type':Sequelize[_0x2f78('0x3')],'defaultValue':_0x2f78('0x5')}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 114e258..952b7de 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 _0x6075=['apply','reject','save','update','then','destroy','sendStatus','stack','name','send','params','model','keys','ChatApplication','rawAttributes','query','filters','intersection','attributes','fields','length','include','merge','options','find','catch','body','eml-format','rimraf','fast-json-patch','request-promise','mustache','sox','ejs','lodash','crypto','jsforce','desk.js','to-csv','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','end','json','offset','undefined','limit','count','Content-Range'];(function(_0x281e9,_0x55c617){var _0x1734c5=function(_0x1aecb7){while(--_0x1aecb7){_0x281e9['push'](_0x281e9['shift']());}};_0x1734c5(++_0x55c617);}(_0x6075,0x142));var _0x5607=function(_0xc63e3b,_0x5bb8a6){_0xc63e3b=_0xc63e3b-0x0;var _0x369881=_0x6075[_0xc63e3b];return _0x369881;};'use strict';var emlformat=require(_0x5607('0x0'));var rimraf=require(_0x5607('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5607('0x2'));var rp=require(_0x5607('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x5607('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5607('0x5'));var csv=require('to-csv');var ejs=require(_0x5607('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5607('0x7'));var squel=require('squel');var crypto=require(_0x5607('0x8'));var jsforce=require(_0x5607('0x9'));var deskjs=require(_0x5607('0xa'));var toCsv=require(_0x5607('0xb'));var querystring=require(_0x5607('0xc'));var Papa=require(_0x5607('0xd'));var Redis=require(_0x5607('0xe'));var authService=require(_0x5607('0xf'));var qs=require(_0x5607('0x10'));var as=require(_0x5607('0x11'));var hardwareService=require(_0x5607('0x12'));var logger=require(_0x5607('0x13'))(_0x5607('0x14'));var utils=require('../../config/utils');var config=require(_0x5607('0x15'));var licenseUtil=require(_0x5607('0x16'));var db=require(_0x5607('0x17'))['db'];function respondWithStatusCode(_0x5d9418,_0x8d61f1){_0x8d61f1=_0x8d61f1||0xcc;return function(_0x4166c7){if(_0x4166c7){return _0x5d9418['sendStatus'](_0x8d61f1);}return _0x5d9418[_0x5607('0x18')](_0x8d61f1)[_0x5607('0x19')]();};}function respondWithResult(_0x47dd56,_0x44642d){_0x44642d=_0x44642d||0xc8;return function(_0x514d22){if(_0x514d22){return _0x47dd56[_0x5607('0x18')](_0x44642d)[_0x5607('0x1a')](_0x514d22);}};}function respondWithFilteredResult(_0x255936,_0x381634){return function(_0x5ba100){if(_0x5ba100){var _0x17ede4=typeof _0x381634[_0x5607('0x1b')]===_0x5607('0x1c')&&typeof _0x381634[_0x5607('0x1d')]===_0x5607('0x1c');var _0xb3bf29=_0x5ba100[_0x5607('0x1e')];var _0xe089=_0x17ede4?0x0:_0x381634[_0x5607('0x1b')];var _0x4295b5=_0x17ede4?_0x5ba100[_0x5607('0x1e')]:_0x381634[_0x5607('0x1b')]+_0x381634['limit'];var _0x58b8de;if(_0x4295b5>=_0xb3bf29){_0x4295b5=_0xb3bf29;_0x58b8de=0xc8;}else{_0x58b8de=0xce;}_0x255936['status'](_0x58b8de);return _0x255936['set'](_0x5607('0x1f'),_0xe089+'-'+_0x4295b5+'/'+_0xb3bf29)[_0x5607('0x1a')](_0x5ba100);}return null;};}function patchUpdates(_0x450dd3){return function(_0x28cd0e){try{jsonpatch[_0x5607('0x20')](_0x28cd0e,_0x450dd3,!![]);}catch(_0x274cfa){return BPromise[_0x5607('0x21')](_0x274cfa);}return _0x28cd0e[_0x5607('0x22')]();};}function saveUpdates(_0x5ecb83,_0x5bb8c7){return function(_0x3e0cbb){if(_0x3e0cbb){return _0x3e0cbb[_0x5607('0x23')](_0x5ecb83)[_0x5607('0x24')](function(_0x479615){return _0x479615;});}return null;};}function removeEntity(_0x2bfa58,_0x82265b){return function(_0x158211){if(_0x158211){return _0x158211[_0x5607('0x25')]()[_0x5607('0x24')](function(){_0x2bfa58[_0x5607('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c215a,_0x294ed1){return function(_0x2234c4){if(!_0x2234c4){_0x4c215a[_0x5607('0x26')](0x194);}return _0x2234c4;};}function handleError(_0x47fe80,_0x4a0f55){_0x4a0f55=_0x4a0f55||0x1f4;return function(_0x1b4e3f){logger['error'](_0x1b4e3f[_0x5607('0x27')]);if(_0x1b4e3f[_0x5607('0x28')]){delete _0x1b4e3f[_0x5607('0x28')];}_0x47fe80[_0x5607('0x18')](_0x4a0f55)[_0x5607('0x29')](_0x1b4e3f);};}exports['show']=function(_0x5bb86c,_0x3cbaa1){var _0x261b36={'raw':!![],'where':{'id':_0x5bb86c[_0x5607('0x2a')]['id']}},_0x207b11={};_0x207b11[_0x5607('0x2b')]=_[_0x5607('0x2c')](db[_0x5607('0x2d')][_0x5607('0x2e')]);_0x207b11['query']=_[_0x5607('0x2c')](_0x5bb86c[_0x5607('0x2f')]);_0x207b11[_0x5607('0x30')]=_[_0x5607('0x31')](_0x207b11[_0x5607('0x2b')],_0x207b11[_0x5607('0x2f')]);_0x261b36[_0x5607('0x32')]=_[_0x5607('0x31')](_0x207b11[_0x5607('0x2b')],qs[_0x5607('0x33')](_0x5bb86c['query'][_0x5607('0x33')]));_0x261b36['attributes']=_0x261b36[_0x5607('0x32')][_0x5607('0x34')]?_0x261b36[_0x5607('0x32')]:_0x207b11[_0x5607('0x2b')];if(_0x5bb86c[_0x5607('0x2f')]['includeAll']){_0x261b36[_0x5607('0x35')]=[{'all':!![]}];}_0x261b36=_[_0x5607('0x36')]({},_0x261b36,_0x5bb86c[_0x5607('0x37')]);return db[_0x5607('0x2d')][_0x5607('0x38')](_0x261b36)[_0x5607('0x24')](handleEntityNotFound(_0x3cbaa1,null))[_0x5607('0x24')](respondWithResult(_0x3cbaa1,null))[_0x5607('0x39')](handleError(_0x3cbaa1,null));};exports[_0x5607('0x23')]=function(_0x52ac21,_0x674370){if(_0x52ac21[_0x5607('0x3a')]['id']){delete _0x52ac21[_0x5607('0x3a')]['id'];}return db[_0x5607('0x2d')]['find']({'where':{'id':_0x52ac21['params']['id']}})[_0x5607('0x24')](handleEntityNotFound(_0x674370,null))[_0x5607('0x24')](saveUpdates(_0x52ac21[_0x5607('0x3a')],null))[_0x5607('0x24')](respondWithResult(_0x674370,null))['catch'](handleError(_0x674370,null));};exports[_0x5607('0x25')]=function(_0x23d6af,_0x16ae2d){return db['ChatApplication'][_0x5607('0x38')]({'where':{'id':_0x23d6af['params']['id']}})[_0x5607('0x24')](handleEntityNotFound(_0x16ae2d,null))[_0x5607('0x24')](removeEntity(_0x16ae2d,null))[_0x5607('0x39')](handleError(_0x16ae2d,null));}; \ No newline at end of file +var _0x7633=['find','catch','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','to-csv','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','count','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','show','model','keys','ChatApplication','query','filters','intersection','attributes','fields','includeAll'];(function(_0x4320ce,_0x49f5f5){var _0x537dae=function(_0x5991ef){while(--_0x5991ef){_0x4320ce['push'](_0x4320ce['shift']());}};_0x537dae(++_0x49f5f5);}(_0x7633,0x1c4));var _0x3763=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x7633[_0x1d1779];return _0x2377e9;};'use strict';var emlformat=require(_0x3763('0x0'));var rimraf=require(_0x3763('0x1'));var zipdir=require(_0x3763('0x2'));var jsonpatch=require(_0x3763('0x3'));var rp=require(_0x3763('0x4'));var moment=require('moment');var BPromise=require(_0x3763('0x5'));var Mustache=require(_0x3763('0x6'));var util=require('util');var path=require(_0x3763('0x7'));var sox=require(_0x3763('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3763('0x9'));var _=require(_0x3763('0xa'));var squel=require(_0x3763('0xb'));var crypto=require(_0x3763('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3763('0xd'));var querystring=require(_0x3763('0xe'));var Papa=require('papaparse');var Redis=require(_0x3763('0xf'));var authService=require(_0x3763('0x10'));var qs=require(_0x3763('0x11'));var as=require(_0x3763('0x12'));var hardwareService=require(_0x3763('0x13'));var logger=require(_0x3763('0x14'))(_0x3763('0x15'));var utils=require(_0x3763('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x3763('0x17'));var db=require(_0x3763('0x18'))['db'];function respondWithStatusCode(_0x11d390,_0x52728b){_0x52728b=_0x52728b||0xcc;return function(_0x59980c){if(_0x59980c){return _0x11d390[_0x3763('0x19')](_0x52728b);}return _0x11d390['status'](_0x52728b)[_0x3763('0x1a')]();};}function respondWithResult(_0x12582e,_0xf9d237){_0xf9d237=_0xf9d237||0xc8;return function(_0x3d91da){if(_0x3d91da){return _0x12582e[_0x3763('0x1b')](_0xf9d237)[_0x3763('0x1c')](_0x3d91da);}};}function respondWithFilteredResult(_0x1110e0,_0x4c877a){return function(_0xa95c5b){if(_0xa95c5b){var _0x368434=typeof _0x4c877a[_0x3763('0x1d')]==='undefined'&&typeof _0x4c877a['limit']==='undefined';var _0x1bb7bc=_0xa95c5b[_0x3763('0x1e')];var _0x33dd0e=_0x368434?0x0:_0x4c877a[_0x3763('0x1d')];var _0x23087d=_0x368434?_0xa95c5b[_0x3763('0x1e')]:_0x4c877a[_0x3763('0x1d')]+_0x4c877a['limit'];var _0x38a33f;if(_0x23087d>=_0x1bb7bc){_0x23087d=_0x1bb7bc;_0x38a33f=0xc8;}else{_0x38a33f=0xce;}_0x1110e0[_0x3763('0x1b')](_0x38a33f);return _0x1110e0[_0x3763('0x1f')](_0x3763('0x20'),_0x33dd0e+'-'+_0x23087d+'/'+_0x1bb7bc)['json'](_0xa95c5b);}return null;};}function patchUpdates(_0x485836){return function(_0x2cb398){try{jsonpatch[_0x3763('0x21')](_0x2cb398,_0x485836,!![]);}catch(_0x427c15){return BPromise[_0x3763('0x22')](_0x427c15);}return _0x2cb398['save']();};}function saveUpdates(_0x36ff74,_0x5e5f4e){return function(_0xafb9f5){if(_0xafb9f5){return _0xafb9f5[_0x3763('0x23')](_0x36ff74)['then'](function(_0x3083e){return _0x3083e;});}return null;};}function removeEntity(_0x195945,_0xa53ba5){return function(_0xd6086f){if(_0xd6086f){return _0xd6086f[_0x3763('0x24')]()[_0x3763('0x25')](function(){_0x195945[_0x3763('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x57036c,_0x51e77a){return function(_0x434fa3){if(!_0x434fa3){_0x57036c[_0x3763('0x19')](0x194);}return _0x434fa3;};}function handleError(_0x28a17a,_0xe5beb5){_0xe5beb5=_0xe5beb5||0x1f4;return function(_0x3f6644){logger[_0x3763('0x26')](_0x3f6644[_0x3763('0x27')]);if(_0x3f6644[_0x3763('0x28')]){delete _0x3f6644[_0x3763('0x28')];}_0x28a17a[_0x3763('0x1b')](_0xe5beb5)[_0x3763('0x29')](_0x3f6644);};}exports[_0x3763('0x2a')]=function(_0x4f9a96,_0xd128d8){var _0xb1b938={'raw':!![],'where':{'id':_0x4f9a96['params']['id']}},_0x2f6e9d={};_0x2f6e9d[_0x3763('0x2b')]=_[_0x3763('0x2c')](db[_0x3763('0x2d')]['rawAttributes']);_0x2f6e9d[_0x3763('0x2e')]=_[_0x3763('0x2c')](_0x4f9a96[_0x3763('0x2e')]);_0x2f6e9d[_0x3763('0x2f')]=_[_0x3763('0x30')](_0x2f6e9d['model'],_0x2f6e9d['query']);_0xb1b938[_0x3763('0x31')]=_[_0x3763('0x30')](_0x2f6e9d[_0x3763('0x2b')],qs[_0x3763('0x32')](_0x4f9a96[_0x3763('0x2e')][_0x3763('0x32')]));_0xb1b938[_0x3763('0x31')]=_0xb1b938[_0x3763('0x31')]['length']?_0xb1b938[_0x3763('0x31')]:_0x2f6e9d[_0x3763('0x2b')];if(_0x4f9a96[_0x3763('0x2e')][_0x3763('0x33')]){_0xb1b938['include']=[{'all':!![]}];}_0xb1b938=_['merge']({},_0xb1b938,_0x4f9a96['options']);return db['ChatApplication'][_0x3763('0x34')](_0xb1b938)[_0x3763('0x25')](handleEntityNotFound(_0xd128d8,null))['then'](respondWithResult(_0xd128d8,null))[_0x3763('0x35')](handleError(_0xd128d8,null));};exports[_0x3763('0x23')]=function(_0x51e756,_0x805718){if(_0x51e756[_0x3763('0x36')]['id']){delete _0x51e756[_0x3763('0x36')]['id'];}return db[_0x3763('0x2d')][_0x3763('0x34')]({'where':{'id':_0x51e756[_0x3763('0x37')]['id']}})[_0x3763('0x25')](handleEntityNotFound(_0x805718,null))[_0x3763('0x25')](saveUpdates(_0x51e756['body'],null))[_0x3763('0x25')](respondWithResult(_0x805718,null))[_0x3763('0x35')](handleError(_0x805718,null));};exports['destroy']=function(_0x3a52f1,_0x231aa4){return db[_0x3763('0x2d')]['find']({'where':{'id':_0x3a52f1[_0x3763('0x37')]['id']}})['then'](handleEntityNotFound(_0x231aa4,null))[_0x3763('0x25')](removeEntity(_0x231aa4,null))['catch'](handleError(_0x231aa4,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 6be7ed6..319a76b 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 _0x1d25=['exports','define','chat_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./chatApplication.attributes'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x1d25,0xba));var _0x51d2=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x1d25[_0x5a3cf0];return _0x5a64ee;};'use strict';var _=require(_0x51d2('0x0'));var util=require(_0x51d2('0x1'));var logger=require(_0x51d2('0x2'))(_0x51d2('0x3'));var moment=require(_0x51d2('0x4'));var BPromise=require('bluebird');var rp=require(_0x51d2('0x5'));var fs=require('fs');var path=require(_0x51d2('0x6'));var rimraf=require('rimraf');var config=require(_0x51d2('0x7'));var attributes=require(_0x51d2('0x8'));module[_0x51d2('0x9')]=function(_0x407091,_0x449fec){return _0x407091[_0x51d2('0xa')]('ChatApplication',attributes,{'tableName':_0x51d2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x51d2('0xc')});}; \ No newline at end of file +var _0x073d=['api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ChatApplication','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x336e6d,_0x5f4320){var _0x2a5212=function(_0x15736a){while(--_0x15736a){_0x336e6d['push'](_0x336e6d['shift']());}};_0x2a5212(++_0x5f4320);}(_0x073d,0x103));var _0xd073=function(_0x33403b,_0x5cca9c){_0x33403b=_0x33403b-0x0;var _0x2d8657=_0x073d[_0x33403b];return _0x2d8657;};'use strict';var _=require(_0xd073('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xd073('0x1'));var moment=require(_0xd073('0x2'));var BPromise=require(_0xd073('0x3'));var rp=require(_0xd073('0x4'));var fs=require('fs');var path=require(_0xd073('0x5'));var rimraf=require('rimraf');var config=require(_0xd073('0x6'));var attributes=require('./chatApplication.attributes');module[_0xd073('0x7')]=function(_0x1444f9,_0x363852){return _0x1444f9[_0xd073('0x8')](_0xd073('0x9'),attributes,{'tableName':_0xd073('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd073('0xb'),'collate':_0xd073('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index fbb1ed3..a76ce0c 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 _0xa56f=['request','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x3ccad5,_0x2abd75){var _0x1cc50a=function(_0x3a4fba){while(--_0x3a4fba){_0x3ccad5['push'](_0x3ccad5['shift']());}};_0x1cc50a(++_0x2abd75);}(_0xa56f,0x1da));var _0xfa56=function(_0x1bdc6f,_0x59e236){_0x1bdc6f=_0x1bdc6f-0x0;var _0x2a71e1=_0xa56f[_0x1bdc6f];return _0x2a71e1;};'use strict';var _=require('lodash');var util=require(_0xfa56('0x0'));var moment=require('moment');var BPromise=require(_0xfa56('0x1'));var rs=require(_0xfa56('0x2'));var fs=require('fs');var Redis=require(_0xfa56('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfa56('0x4'))(_0xfa56('0x5'));var config=require(_0xfa56('0x6'));var jayson=require(_0xfa56('0x7'));var client=jayson[_0xfa56('0x8')][_0xfa56('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4e77cc,_0xd3b90f,_0x427660){return new BPromise(function(_0x19eeb6,_0x456883){return client[_0xfa56('0xa')](_0x4e77cc,_0x427660)[_0xfa56('0xb')](function(_0x46ccd8){logger[_0xfa56('0xc')](_0xfa56('0xd'),_0xd3b90f,_0xfa56('0xe'));logger[_0xfa56('0xf')]('ChatApplication,\x20%s,\x20%s,\x20%s',_0xd3b90f,_0xfa56('0xe'),JSON[_0xfa56('0x10')](_0x46ccd8));if(_0x46ccd8[_0xfa56('0x11')]){if(_0x46ccd8['error'][_0xfa56('0x12')]===0x1f4){logger[_0xfa56('0x11')](_0xfa56('0xd'),_0xd3b90f,_0x46ccd8[_0xfa56('0x11')][_0xfa56('0x13')]);return _0x456883(_0x46ccd8[_0xfa56('0x11')][_0xfa56('0x13')]);}logger[_0xfa56('0x11')](_0xfa56('0xd'),_0xd3b90f,_0x46ccd8[_0xfa56('0x11')]['message']);return _0x19eeb6(_0x46ccd8['error'][_0xfa56('0x13')]);}else{logger[_0xfa56('0xc')]('ChatApplication,\x20%s,\x20%s',_0xd3b90f,_0xfa56('0xe'));_0x19eeb6(_0x46ccd8[_0xfa56('0x14')][_0xfa56('0x13')]);}})[_0xfa56('0x15')](function(_0x121384){logger['error']('ChatApplication,\x20%s,\x20%s',_0xd3b90f,_0x121384);_0x456883(_0x121384);});});} \ No newline at end of file +var _0xdecb=['info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x29fd52,_0x28fe66){var _0x4683d9=function(_0x4c0e0a){while(--_0x4c0e0a){_0x29fd52['push'](_0x29fd52['shift']());}};_0x4683d9(++_0x28fe66);}(_0xdecb,0xe9));var _0xbdec=function(_0x3ea6e5,_0x46643a){_0x3ea6e5=_0x3ea6e5-0x0;var _0x4db60f=_0xdecb[_0x3ea6e5];return _0x4db60f;};'use strict';var _=require(_0xbdec('0x0'));var util=require(_0xbdec('0x1'));var moment=require(_0xbdec('0x2'));var BPromise=require('bluebird');var rs=require(_0xbdec('0x3'));var fs=require('fs');var Redis=require(_0xbdec('0x4'));var db=require(_0xbdec('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbdec('0x6'))(_0xbdec('0x7'));var config=require(_0xbdec('0x8'));var jayson=require(_0xbdec('0x9'));var client=jayson[_0xbdec('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x40d069,_0x80fa82,_0xaffb8a){return new BPromise(function(_0x2657e1,_0xeb6d67){return client['request'](_0x40d069,_0xaffb8a)[_0xbdec('0xb')](function(_0x12a45a){logger['info'](_0xbdec('0xc'),_0x80fa82,_0xbdec('0xd'));logger[_0xbdec('0xe')](_0xbdec('0xf'),_0x80fa82,_0xbdec('0xd'),JSON['stringify'](_0x12a45a));if(_0x12a45a[_0xbdec('0x10')]){if(_0x12a45a[_0xbdec('0x10')][_0xbdec('0x11')]===0x1f4){logger[_0xbdec('0x10')](_0xbdec('0xc'),_0x80fa82,_0x12a45a['error'][_0xbdec('0x12')]);return _0xeb6d67(_0x12a45a[_0xbdec('0x10')][_0xbdec('0x12')]);}logger['error']('ChatApplication,\x20%s,\x20%s',_0x80fa82,_0x12a45a[_0xbdec('0x10')][_0xbdec('0x12')]);return _0x2657e1(_0x12a45a[_0xbdec('0x10')][_0xbdec('0x12')]);}else{logger[_0xbdec('0x13')](_0xbdec('0xc'),_0x80fa82,'request\x20sent');_0x2657e1(_0x12a45a['result'][_0xbdec('0x12')]);}})[_0xbdec('0x14')](function(_0x1e8f4f){logger['error'](_0xbdec('0xc'),_0x80fa82,_0x1e8f4f);_0xeb6d67(_0x1e8f4f);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index 039f0c7..24fb42f 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 _0xb41c=['../../components/interaction/service','get','/:id','isAuthenticated','put','delete','exports','multer','express','Router','fs-extra','../../components/auth/service'];(function(_0x52fcdf,_0x45b61f){var _0x10fd6a=function(_0xe6c8f4){while(--_0xe6c8f4){_0x52fcdf['push'](_0x52fcdf['shift']());}};_0x10fd6a(++_0x45b61f);}(_0xb41c,0x1f3));var _0xcb41=function(_0x493922,_0x50fe7f){_0x493922=_0x493922-0x0;var _0x3b21b3=_0xb41c[_0x493922];return _0x3b21b3;};'use strict';var multer=require(_0xcb41('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xcb41('0x1'));var router=express[_0xcb41('0x2')]();var fs_extra=require(_0xcb41('0x3'));var auth=require(_0xcb41('0x4'));var interaction=require(_0xcb41('0x5'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router[_0xcb41('0x6')](_0xcb41('0x7'),auth[_0xcb41('0x8')](),controller['show']);router[_0xcb41('0x9')](_0xcb41('0x7'),auth[_0xcb41('0x8')](),controller['update']);router[_0xcb41('0xa')]('/:id',auth[_0xcb41('0x8')](),controller['destroy']);module[_0xcb41('0xb')]=router; \ No newline at end of file +var _0x25ff=['delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','isAuthenticated','put','update'];(function(_0x3da40b,_0x1c82d4){var _0x5b0c34=function(_0x6df507){while(--_0x6df507){_0x3da40b['push'](_0x3da40b['shift']());}};_0x5b0c34(++_0x1c82d4);}(_0x25ff,0xd5));var _0xf25f=function(_0x476ac9,_0x20ca96){_0x476ac9=_0x476ac9-0x0;var _0x3a126b=_0x25ff[_0x476ac9];return _0x3a126b;};'use strict';var multer=require(_0xf25f('0x0'));var util=require(_0xf25f('0x1'));var path=require(_0xf25f('0x2'));var timeout=require(_0xf25f('0x3'));var express=require(_0xf25f('0x4'));var router=express[_0xf25f('0x5')]();var fs_extra=require(_0xf25f('0x6'));var auth=require(_0xf25f('0x7'));var interaction=require(_0xf25f('0x8'));var config=require(_0xf25f('0x9'));var controller=require(_0xf25f('0xa'));router[_0xf25f('0xb')]('/:id',auth[_0xf25f('0xc')](),controller['show']);router[_0xf25f('0xd')]('/:id',auth[_0xf25f('0xc')](),controller[_0xf25f('0xe')]);router[_0xf25f('0xf')](_0xf25f('0x10'),auth[_0xf25f('0xc')](),controller[_0xf25f('0x11')]);module[_0xf25f('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index d74b655..2768d11 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 _0x2533=['sequelize','exports','STRING','BOOLEAN'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x2533,0x68));var _0x3253=function(_0x3ec333,_0x26bcbe){_0x3ec333=_0x3ec333-0x0;var _0x15ccb8=_0x2533[_0x3ec333];return _0x15ccb8;};'use strict';var Sequelize=require(_0x3253('0x0'));module[_0x3253('0x1')]={'name':{'type':Sequelize[_0x3253('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x3253('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xd1f1=['sequelize','exports','STRING','BOOLEAN'];(function(_0x12162a,_0x19bb76){var _0x4d76f1=function(_0x430c77){while(--_0x430c77){_0x12162a['push'](_0x12162a['shift']());}};_0x4d76f1(++_0x19bb76);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x41dcdb,_0x4e1a2f){_0x41dcdb=_0x41dcdb-0x0;var _0xce4042=_0xd1f1[_0x41dcdb];return _0xce4042;};'use strict';var Sequelize=require(_0x1d1f('0x0'));module[_0x1d1f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x1d1f('0x2')]},'write':{'type':Sequelize[_0x1d1f('0x3')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 08fb9d1..23e50f4 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 _0xe8d3=['count','offset','set','apply','reject','save','then','error','stack','name','index','map','ChatGroup','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','catch','show','params','keys','length','create','body','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','getMembers','findOne','User','removeMembers','addMessage','ChatGroupId','split','format','getMessages','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./chatGroup.socket','register','status','end','json','undefined','limit'];(function(_0x3611a4,_0x577693){var _0x3c8787=function(_0xe645f5){while(--_0xe645f5){_0x3611a4['push'](_0x3611a4['shift']());}};_0x3c8787(++_0x577693);}(_0xe8d3,0x14e));var _0x3e8d=function(_0x5c7670,_0x58d07b){_0x5c7670=_0x5c7670-0x0;var _0x19d985=_0xe8d3[_0x5c7670];return _0x19d985;};'use strict';var emlformat=require(_0x3e8d('0x0'));var rimraf=require(_0x3e8d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e8d('0x2'));var rp=require(_0x3e8d('0x3'));var moment=require(_0x3e8d('0x4'));var BPromise=require(_0x3e8d('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e8d('0x6'));var sox=require('sox');var csv=require(_0x3e8d('0x7'));var ejs=require(_0x3e8d('0x8'));var fs=require('fs');var fs_extra=require(_0x3e8d('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x3e8d('0xa'));var jsforce=require(_0x3e8d('0xb'));var deskjs=require(_0x3e8d('0xc'));var toCsv=require(_0x3e8d('0x7'));var querystring=require(_0x3e8d('0xd'));var Papa=require(_0x3e8d('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x3e8d('0xf'));var as=require(_0x3e8d('0x10'));var hardwareService=require(_0x3e8d('0x11'));var logger=require(_0x3e8d('0x12'))(_0x3e8d('0x13'));var utils=require(_0x3e8d('0x14'));var config=require(_0x3e8d('0x15'));var licenseUtil=require(_0x3e8d('0x16'));var db=require(_0x3e8d('0x17'))['db'];config['redis']=_[_0x3e8d('0x18')](config[_0x3e8d('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x3e8d('0x1a'))(new Redis(config[_0x3e8d('0x19')]));require(_0x3e8d('0x1b'))[_0x3e8d('0x1c')](socket);function respondWithStatusCode(_0xd7ef1a,_0xc04a96){_0xc04a96=_0xc04a96||0xcc;return function(_0x378980){if(_0x378980){return _0xd7ef1a['sendStatus'](_0xc04a96);}return _0xd7ef1a[_0x3e8d('0x1d')](_0xc04a96)[_0x3e8d('0x1e')]();};}function respondWithResult(_0x4eb8c7,_0x451517){_0x451517=_0x451517||0xc8;return function(_0x36d63f){if(_0x36d63f){return _0x4eb8c7['status'](_0x451517)[_0x3e8d('0x1f')](_0x36d63f);}};}function respondWithFilteredResult(_0x10f217,_0x2b08af){return function(_0x290998){if(_0x290998){var _0x296bb9=typeof _0x2b08af['offset']===_0x3e8d('0x20')&&typeof _0x2b08af[_0x3e8d('0x21')]===_0x3e8d('0x20');var _0xe98a76=_0x290998[_0x3e8d('0x22')];var _0x5c3ac3=_0x296bb9?0x0:_0x2b08af[_0x3e8d('0x23')];var _0x51e65d=_0x296bb9?_0x290998[_0x3e8d('0x22')]:_0x2b08af['offset']+_0x2b08af[_0x3e8d('0x21')];var _0x14b5fd;if(_0x51e65d>=_0xe98a76){_0x51e65d=_0xe98a76;_0x14b5fd=0xc8;}else{_0x14b5fd=0xce;}_0x10f217[_0x3e8d('0x1d')](_0x14b5fd);return _0x10f217[_0x3e8d('0x24')]('Content-Range',_0x5c3ac3+'-'+_0x51e65d+'/'+_0xe98a76)[_0x3e8d('0x1f')](_0x290998);}return null;};}function patchUpdates(_0x165b76){return function(_0x573364){try{jsonpatch[_0x3e8d('0x25')](_0x573364,_0x165b76,!![]);}catch(_0x8f1013){return BPromise[_0x3e8d('0x26')](_0x8f1013);}return _0x573364[_0x3e8d('0x27')]();};}function saveUpdates(_0x494542,_0x459408){return function(_0x428659){if(_0x428659){return _0x428659['update'](_0x494542)[_0x3e8d('0x28')](function(_0x126ce0){return _0x126ce0;});}return null;};}function removeEntity(_0xa2c233,_0x29e9bb){return function(_0x3453a8){if(_0x3453a8){return _0x3453a8['destroy']()[_0x3e8d('0x28')](function(){_0xa2c233[_0x3e8d('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3e4293,_0x48b6d6){return function(_0x16a619){if(!_0x16a619){_0x3e4293['sendStatus'](0x194);}return _0x16a619;};}function handleError(_0x4a273e,_0x35bc55){_0x35bc55=_0x35bc55||0x1f4;return function(_0x56df3f){logger[_0x3e8d('0x29')](_0x56df3f[_0x3e8d('0x2a')]);if(_0x56df3f[_0x3e8d('0x2b')]){delete _0x56df3f['name'];}_0x4a273e[_0x3e8d('0x1d')](_0x35bc55)['send'](_0x56df3f);};}exports[_0x3e8d('0x2c')]=function(_0x217b67,_0x2a51b4){var _0x394863={},_0x299eea={},_0xc64cbf={'count':0x0,'rows':[]};var _0x42fb1f=_[_0x3e8d('0x2d')](db[_0x3e8d('0x2e')][_0x3e8d('0x2f')],function(_0x30d3de){return{'name':_0x30d3de[_0x3e8d('0x30')],'type':_0x30d3de[_0x3e8d('0x31')]['key']};});_0x299eea['model']=_['map'](_0x42fb1f,_0x3e8d('0x2b'));_0x299eea['query']=_['keys'](_0x217b67[_0x3e8d('0x32')]);_0x299eea[_0x3e8d('0x33')]=_[_0x3e8d('0x34')](_0x299eea[_0x3e8d('0x35')],_0x299eea[_0x3e8d('0x32')]);_0x394863[_0x3e8d('0x36')]=_[_0x3e8d('0x34')](_0x299eea['model'],qs[_0x3e8d('0x37')](_0x217b67[_0x3e8d('0x32')][_0x3e8d('0x37')]));_0x394863[_0x3e8d('0x36')]=_0x394863[_0x3e8d('0x36')]['length']?_0x394863[_0x3e8d('0x36')]:_0x299eea[_0x3e8d('0x35')];if(!_0x217b67[_0x3e8d('0x32')][_0x3e8d('0x38')](_0x3e8d('0x39'))){_0x394863['limit']=qs[_0x3e8d('0x21')](_0x217b67['query']['limit']);_0x394863['offset']=qs['offset'](_0x217b67[_0x3e8d('0x32')]['offset']);}_0x394863[_0x3e8d('0x3a')]=qs[_0x3e8d('0x3b')](_0x217b67['query'][_0x3e8d('0x3b')]);_0x394863[_0x3e8d('0x3c')]=qs[_0x3e8d('0x33')](_[_0x3e8d('0x3d')](_0x217b67[_0x3e8d('0x32')],_0x299eea[_0x3e8d('0x33')]),_0x42fb1f);if(_0x217b67[_0x3e8d('0x32')][_0x3e8d('0x3e')]){_0x394863[_0x3e8d('0x3c')]=_[_0x3e8d('0x3f')](_0x394863[_0x3e8d('0x3c')],{'$or':_['map'](_0x42fb1f,function(_0xa5a96a){if(_0xa5a96a['type']!=='VIRTUAL'){var _0x11d006={};_0x11d006[_0xa5a96a[_0x3e8d('0x2b')]]={'$like':'%'+_0x217b67['query'][_0x3e8d('0x3e')]+'%'};return _0x11d006;}})});}_0x394863=_[_0x3e8d('0x3f')]({},_0x394863,_0x217b67[_0x3e8d('0x40')]);var _0x20ab1a={'where':_0x394863[_0x3e8d('0x3c')]};return db[_0x3e8d('0x2e')][_0x3e8d('0x22')](_0x20ab1a)['then'](function(_0x407608){_0xc64cbf['count']=_0x407608;if(_0x217b67[_0x3e8d('0x32')][_0x3e8d('0x41')]){_0x394863[_0x3e8d('0x42')]=[{'all':!![]}];}return db[_0x3e8d('0x2e')]['findAll'](_0x394863);})[_0x3e8d('0x28')](function(_0x4e94e3){_0xc64cbf[_0x3e8d('0x43')]=_0x4e94e3;return _0xc64cbf;})[_0x3e8d('0x28')](respondWithFilteredResult(_0x2a51b4,_0x394863))[_0x3e8d('0x44')](handleError(_0x2a51b4,null));};exports[_0x3e8d('0x45')]=function(_0x1394b0,_0x2ddcbb){var _0x5a1e07={'raw':!![],'where':{'id':_0x1394b0[_0x3e8d('0x46')]['id']}},_0x4ef929={};_0x4ef929[_0x3e8d('0x35')]=_[_0x3e8d('0x47')](db[_0x3e8d('0x2e')][_0x3e8d('0x2f')]);_0x4ef929[_0x3e8d('0x32')]=_[_0x3e8d('0x47')](_0x1394b0[_0x3e8d('0x32')]);_0x4ef929['filters']=_[_0x3e8d('0x34')](_0x4ef929[_0x3e8d('0x35')],_0x4ef929['query']);_0x5a1e07[_0x3e8d('0x36')]=_['intersection'](_0x4ef929[_0x3e8d('0x35')],qs['fields'](_0x1394b0[_0x3e8d('0x32')]['fields']));_0x5a1e07[_0x3e8d('0x36')]=_0x5a1e07[_0x3e8d('0x36')][_0x3e8d('0x48')]?_0x5a1e07[_0x3e8d('0x36')]:_0x4ef929[_0x3e8d('0x35')];if(_0x1394b0['query'][_0x3e8d('0x41')]){_0x5a1e07[_0x3e8d('0x42')]=[{'all':!![]}];}_0x5a1e07=_['merge']({},_0x5a1e07,_0x1394b0['options']);return db[_0x3e8d('0x2e')]['find'](_0x5a1e07)[_0x3e8d('0x28')](handleEntityNotFound(_0x2ddcbb,null))[_0x3e8d('0x28')](respondWithResult(_0x2ddcbb,null))[_0x3e8d('0x44')](handleError(_0x2ddcbb,null));};exports[_0x3e8d('0x49')]=function(_0x5b38e6,_0x473239){return db[_0x3e8d('0x2e')][_0x3e8d('0x49')](_0x5b38e6[_0x3e8d('0x4a')],{})[_0x3e8d('0x28')](respondWithResult(_0x473239,0xc9))['catch'](handleError(_0x473239,null));};exports['update']=function(_0x33cb98,_0x327004){if(_0x33cb98['body']['id']){delete _0x33cb98[_0x3e8d('0x4a')]['id'];}return db[_0x3e8d('0x2e')]['find']({'where':{'id':_0x33cb98['params']['id']}})[_0x3e8d('0x28')](handleEntityNotFound(_0x327004,null))[_0x3e8d('0x28')](saveUpdates(_0x33cb98[_0x3e8d('0x4a')],null))[_0x3e8d('0x28')](respondWithResult(_0x327004,null))['catch'](handleError(_0x327004,null));};exports['destroy']=function(_0x2c1550,_0x44923d){return db['ChatGroup'][_0x3e8d('0x4b')]({'where':{'id':_0x2c1550[_0x3e8d('0x46')]['id']}})[_0x3e8d('0x28')](handleEntityNotFound(_0x44923d,null))['then'](removeEntity(_0x44923d,null))[_0x3e8d('0x44')](handleError(_0x44923d,null));};exports[_0x3e8d('0x4c')]=function(_0x503327,_0x1325b7){return db[_0x3e8d('0x2e')][_0x3e8d('0x4c')]()[_0x3e8d('0x28')](respondWithResult(_0x1325b7,null))[_0x3e8d('0x44')](handleError(_0x1325b7,null));};exports['getUnread']=function(_0x2baaca,_0x2876c1,_0xa8316a){return db[_0x3e8d('0x4d')][_0x3e8d('0x22')]({'where':{'ChatGroupId':_0x2baaca['params']['id'],'ToId':_0x2baaca[_0x3e8d('0x4e')]['id'],'read':![]}})[_0x3e8d('0x28')](function(_0x57a94e){return{'id':_[_0x3e8d('0x4f')](_0x2baaca[_0x3e8d('0x46')]['id']),'count':_0x57a94e};})['then'](respondWithResult(_0x2876c1,null))['catch'](handleError(_0x2876c1,null));};exports[_0x3e8d('0x50')]=function(_0x462e8d,_0x7e8323,_0x44c922){return db[_0x3e8d('0x2e')]['find']({'where':{'id':_0x462e8d[_0x3e8d('0x46')]['id']}})['then'](handleEntityNotFound(_0x7e8323,null))['then'](function(_0x51f5f3){if(_0x51f5f3){return _0x51f5f3[_0x3e8d('0x50')](_0x462e8d[_0x3e8d('0x4a')][_0x3e8d('0x51')],_[_0x3e8d('0x52')](_0x462e8d[_0x3e8d('0x4a')],[_0x3e8d('0x51'),'id'])||{});}})['then'](respondWithResult(_0x7e8323,null))['catch'](handleError(_0x7e8323,null));};exports[_0x3e8d('0x53')]=function(_0x4114fe,_0x541849,_0x3a940a){var _0x3f1e51={};var _0x2dcc96={};var _0x3faa7b;var _0x3a2ad6;return db[_0x3e8d('0x2e')][_0x3e8d('0x54')]({'where':{'id':_0x4114fe[_0x3e8d('0x46')]['id']}})[_0x3e8d('0x28')](handleEntityNotFound(_0x541849,null))[_0x3e8d('0x28')](function(_0x8a5b0a){if(_0x8a5b0a){_0x3faa7b=_0x8a5b0a;_0x2dcc96[_0x3e8d('0x35')]=_[_0x3e8d('0x47')](db[_0x3e8d('0x55')][_0x3e8d('0x2f')]);_0x2dcc96[_0x3e8d('0x32')]=_[_0x3e8d('0x47')](_0x4114fe[_0x3e8d('0x32')]);_0x2dcc96[_0x3e8d('0x33')]=_[_0x3e8d('0x34')](_0x2dcc96[_0x3e8d('0x35')],_0x2dcc96[_0x3e8d('0x32')]);_0x3f1e51[_0x3e8d('0x36')]=_[_0x3e8d('0x34')](_0x2dcc96['model'],qs[_0x3e8d('0x37')](_0x4114fe[_0x3e8d('0x32')][_0x3e8d('0x37')]));_0x3f1e51[_0x3e8d('0x36')]=_0x3f1e51[_0x3e8d('0x36')]['length']?_0x3f1e51['attributes']:_0x2dcc96['model'];_0x3f1e51[_0x3e8d('0x3a')]=qs['sort'](_0x4114fe[_0x3e8d('0x32')][_0x3e8d('0x3b')]);_0x3f1e51[_0x3e8d('0x3c')]=qs[_0x3e8d('0x33')](_['pick'](_0x4114fe[_0x3e8d('0x32')],_0x2dcc96[_0x3e8d('0x33')]));if(_0x4114fe[_0x3e8d('0x32')][_0x3e8d('0x3e')]){_0x3f1e51[_0x3e8d('0x3c')]=_['merge'](_0x3f1e51[_0x3e8d('0x3c')],{'$or':_[_0x3e8d('0x2d')](_0x3f1e51[_0x3e8d('0x36')],function(_0x1682a9){var _0x5daf1e={};_0x5daf1e[_0x1682a9]={'$like':'%'+_0x4114fe[_0x3e8d('0x32')][_0x3e8d('0x3e')]+'%'};return _0x5daf1e;})});}_0x3f1e51=_[_0x3e8d('0x3f')]({},_0x3f1e51,_0x4114fe[_0x3e8d('0x40')]);return _0x3faa7b['getMembers'](_0x3f1e51);}})[_0x3e8d('0x28')](function(_0xe9073e){if(_0xe9073e){_0x3a2ad6=_0xe9073e['length'];if(!_0x4114fe[_0x3e8d('0x32')][_0x3e8d('0x38')]('nolimit')){_0x3f1e51[_0x3e8d('0x21')]=qs[_0x3e8d('0x21')](_0x4114fe[_0x3e8d('0x32')]['limit']);_0x3f1e51[_0x3e8d('0x23')]=qs['offset'](_0x4114fe[_0x3e8d('0x32')][_0x3e8d('0x23')]);}return _0x3faa7b[_0x3e8d('0x53')](_0x3f1e51);}})[_0x3e8d('0x28')](function(_0x56fba1){if(_0x56fba1){return _0x56fba1?{'count':_0x3a2ad6,'rows':_0x56fba1}:null;}})[_0x3e8d('0x28')](respondWithResult(_0x541849,null))[_0x3e8d('0x44')](handleError(_0x541849,null));};exports[_0x3e8d('0x56')]=function(_0x2f2eb3,_0x4ff068,_0x381b79){return db[_0x3e8d('0x2e')][_0x3e8d('0x4b')]({'where':{'id':_0x2f2eb3[_0x3e8d('0x46')]['id']}})['then'](handleEntityNotFound(_0x4ff068,null))[_0x3e8d('0x28')](function(_0x5961f4){if(_0x5961f4){return _0x5961f4[_0x3e8d('0x56')](_0x2f2eb3['query'][_0x3e8d('0x51')]);}})['then'](respondWithStatusCode(_0x4ff068,null))[_0x3e8d('0x44')](handleError(_0x4ff068,null));};exports[_0x3e8d('0x57')]=function(_0x20cf6d,_0x294113,_0x85dfc7){if(_0x20cf6d[_0x3e8d('0x4a')]['id']){delete _0x20cf6d[_0x3e8d('0x4a')]['id'];}return db['ChatGroup'][_0x3e8d('0x4b')]({'where':{'id':_0x20cf6d[_0x3e8d('0x46')]['id']}})[_0x3e8d('0x28')](handleEntityNotFound(_0x294113,null))[_0x3e8d('0x28')](function(_0x5b5ee3){if(_0x5b5ee3){_0x20cf6d[_0x3e8d('0x4a')][_0x3e8d('0x58')]=_0x5b5ee3['id'];return db[_0x3e8d('0x4d')][_0x3e8d('0x49')](_0x20cf6d[_0x3e8d('0x4a')]);}})[_0x3e8d('0x28')](respondWithResult(_0x294113,null))[_0x3e8d('0x44')](handleError(_0x294113,null));};exports['getMessages']=function(_0x522cf5,_0x2fbb3b,_0x39e532){var _0x15353={};var _0x49b633={};var _0x5e1e9e;var _0x47fce0;return db[_0x3e8d('0x2e')][_0x3e8d('0x54')]({'where':{'id':_0x522cf5[_0x3e8d('0x46')]['id']}})[_0x3e8d('0x28')](handleEntityNotFound(_0x2fbb3b,null))['then'](function(_0x1ccc8f){if(_0x1ccc8f){_0x5e1e9e=_0x1ccc8f;_0x49b633[_0x3e8d('0x35')]=_[_0x3e8d('0x47')](db['ChatInternalMessage'][_0x3e8d('0x2f')]);_0x49b633[_0x3e8d('0x32')]=_['keys'](_0x522cf5['query']);_0x49b633[_0x3e8d('0x33')]=_[_0x3e8d('0x34')](_0x49b633['model'],_0x49b633[_0x3e8d('0x32')]);_0x15353[_0x3e8d('0x36')]=_[_0x3e8d('0x34')](_0x49b633[_0x3e8d('0x35')],qs[_0x3e8d('0x37')](_0x522cf5['query']['fields']));_0x15353[_0x3e8d('0x36')]=_0x15353[_0x3e8d('0x36')][_0x3e8d('0x48')]?_0x15353[_0x3e8d('0x36')]:_0x49b633['model'];_0x15353[_0x3e8d('0x3a')]=qs[_0x3e8d('0x3b')](_0x522cf5['query'][_0x3e8d('0x3b')]);_0x15353[_0x3e8d('0x3c')]=qs['filters'](_[_0x3e8d('0x3d')](_0x522cf5[_0x3e8d('0x32')],_0x49b633[_0x3e8d('0x33')]));if(_0x522cf5['query']['filter']){_0x15353[_0x3e8d('0x3c')]=_[_0x3e8d('0x3f')](_0x15353['where'],{'$or':_['map'](_0x15353[_0x3e8d('0x36')],function(_0x447142){var _0x56e765={};_0x56e765[_0x447142]={'$like':'%'+_0x522cf5['query']['filter']+'%'};return _0x56e765;})});}if(_0x522cf5[_0x3e8d('0x32')]['$gte']){var _0xf17763=_0x522cf5['query']['$gte'][_0x3e8d('0x59')](',');var _0x42df8b={};_0x42df8b[_0xf17763[0x0]]={'$gte':moment(_0xf17763[0x1])[_0x3e8d('0x5a')]('YYYY-MM-DD\x20HH:mm:ss')};_0x15353[_0x3e8d('0x3c')]=_[_0x3e8d('0x3f')](_0x15353[_0x3e8d('0x3c')],_0x42df8b);}_0x15353=_[_0x3e8d('0x3f')]({},_0x15353,_0x522cf5['options']);return _0x5e1e9e[_0x3e8d('0x5b')](_0x15353);}})[_0x3e8d('0x28')](function(_0x38aa65){if(_0x38aa65){_0x47fce0=_0x38aa65[_0x3e8d('0x48')];if(!_0x522cf5[_0x3e8d('0x32')][_0x3e8d('0x38')](_0x3e8d('0x39'))){_0x15353[_0x3e8d('0x21')]=qs[_0x3e8d('0x21')](_0x522cf5[_0x3e8d('0x32')][_0x3e8d('0x21')]);_0x15353[_0x3e8d('0x23')]=qs['offset'](_0x522cf5['query'][_0x3e8d('0x23')]);}return _0x5e1e9e[_0x3e8d('0x5b')](_0x15353);}})['then'](function(_0x90063){if(_0x90063){return _0x90063?{'count':_0x47fce0,'rows':_0x90063}:null;}})['then'](respondWithResult(_0x2fbb3b,null))[_0x3e8d('0x44')](handleError(_0x2fbb3b,null));}; \ No newline at end of file +var _0x5830=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','defaults','localhost','socket.io-emitter','redis','./chatGroup.socket','register','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','create','body','find','describe','ChatInternalMessage','user','toInteger','addMembers','ids','omit','User','getMembers','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','YYYY-MM-DD\x20HH:mm:ss','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x48d66d,_0x41338a){var _0x3e6027=function(_0x322bdc){while(--_0x322bdc){_0x48d66d['push'](_0x48d66d['shift']());}};_0x3e6027(++_0x41338a);}(_0x5830,0x179));var _0x0583=function(_0xbd4246,_0x5e6474){_0xbd4246=_0xbd4246-0x0;var _0x525ce5=_0x5830[_0xbd4246];return _0x525ce5;};'use strict';var emlformat=require(_0x0583('0x0'));var rimraf=require(_0x0583('0x1'));var zipdir=require(_0x0583('0x2'));var jsonpatch=require(_0x0583('0x3'));var rp=require(_0x0583('0x4'));var moment=require(_0x0583('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0583('0x6'));var util=require('util');var path=require(_0x0583('0x7'));var sox=require('sox');var csv=require(_0x0583('0x8'));var ejs=require(_0x0583('0x9'));var fs=require('fs');var fs_extra=require(_0x0583('0xa'));var _=require('lodash');var squel=require(_0x0583('0xb'));var crypto=require(_0x0583('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0583('0xd'));var toCsv=require(_0x0583('0x8'));var querystring=require(_0x0583('0xe'));var Papa=require(_0x0583('0xf'));var Redis=require(_0x0583('0x10'));var authService=require(_0x0583('0x11'));var qs=require(_0x0583('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0583('0x13'));var logger=require(_0x0583('0x14'))(_0x0583('0x15'));var utils=require(_0x0583('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0583('0x17'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x0583('0x18')](config['redis'],{'host':_0x0583('0x19'),'port':0x18eb});var socket=require(_0x0583('0x1a'))(new Redis(config[_0x0583('0x1b')]));require(_0x0583('0x1c'))[_0x0583('0x1d')](socket);function respondWithStatusCode(_0x1379ca,_0x612b45){_0x612b45=_0x612b45||0xcc;return function(_0x2b375a){if(_0x2b375a){return _0x1379ca[_0x0583('0x1e')](_0x612b45);}return _0x1379ca['status'](_0x612b45)[_0x0583('0x1f')]();};}function respondWithResult(_0x5d6ae1,_0x1fa3ad){_0x1fa3ad=_0x1fa3ad||0xc8;return function(_0x328bac){if(_0x328bac){return _0x5d6ae1[_0x0583('0x20')](_0x1fa3ad)[_0x0583('0x21')](_0x328bac);}};}function respondWithFilteredResult(_0x27e45a,_0x28cf33){return function(_0x3d7535){if(_0x3d7535){var _0x211acf=typeof _0x28cf33[_0x0583('0x22')]==='undefined'&&typeof _0x28cf33['limit']===_0x0583('0x23');var _0x2afcbc=_0x3d7535[_0x0583('0x24')];var _0x4a96c4=_0x211acf?0x0:_0x28cf33[_0x0583('0x22')];var _0xbd48f2=_0x211acf?_0x3d7535[_0x0583('0x24')]:_0x28cf33[_0x0583('0x22')]+_0x28cf33[_0x0583('0x25')];var _0x466da9;if(_0xbd48f2>=_0x2afcbc){_0xbd48f2=_0x2afcbc;_0x466da9=0xc8;}else{_0x466da9=0xce;}_0x27e45a['status'](_0x466da9);return _0x27e45a[_0x0583('0x26')]('Content-Range',_0x4a96c4+'-'+_0xbd48f2+'/'+_0x2afcbc)[_0x0583('0x21')](_0x3d7535);}return null;};}function patchUpdates(_0x1f0bed){return function(_0x512588){try{jsonpatch[_0x0583('0x27')](_0x512588,_0x1f0bed,!![]);}catch(_0x2afc78){return BPromise[_0x0583('0x28')](_0x2afc78);}return _0x512588[_0x0583('0x29')]();};}function saveUpdates(_0x589cdb,_0x5b6563){return function(_0x3ad533){if(_0x3ad533){return _0x3ad533[_0x0583('0x2a')](_0x589cdb)[_0x0583('0x2b')](function(_0xff6bc7){return _0xff6bc7;});}return null;};}function removeEntity(_0x3c3145,_0x36866c){return function(_0x26c20c){if(_0x26c20c){return _0x26c20c[_0x0583('0x2c')]()[_0x0583('0x2b')](function(){_0x3c3145[_0x0583('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ccc38,_0x2954f3){return function(_0x1ae384){if(!_0x1ae384){_0x4ccc38[_0x0583('0x1e')](0x194);}return _0x1ae384;};}function handleError(_0x395bab,_0x1109c3){_0x1109c3=_0x1109c3||0x1f4;return function(_0x5b5549){logger[_0x0583('0x2d')](_0x5b5549[_0x0583('0x2e')]);if(_0x5b5549['name']){delete _0x5b5549[_0x0583('0x2f')];}_0x395bab[_0x0583('0x20')](_0x1109c3)[_0x0583('0x30')](_0x5b5549);};}exports[_0x0583('0x31')]=function(_0x334db6,_0xbc77b4){var _0x5eb962={},_0x4c98ce={},_0x94efaf={'count':0x0,'rows':[]};var _0x1fca3f=_[_0x0583('0x32')](db[_0x0583('0x33')][_0x0583('0x34')],function(_0x2749cb){return{'name':_0x2749cb['fieldName'],'type':_0x2749cb[_0x0583('0x35')]['key']};});_0x4c98ce[_0x0583('0x36')]=_[_0x0583('0x32')](_0x1fca3f,_0x0583('0x2f'));_0x4c98ce[_0x0583('0x37')]=_[_0x0583('0x38')](_0x334db6[_0x0583('0x37')]);_0x4c98ce[_0x0583('0x39')]=_[_0x0583('0x3a')](_0x4c98ce['model'],_0x4c98ce[_0x0583('0x37')]);_0x5eb962[_0x0583('0x3b')]=_[_0x0583('0x3a')](_0x4c98ce[_0x0583('0x36')],qs['fields'](_0x334db6['query']['fields']));_0x5eb962[_0x0583('0x3b')]=_0x5eb962[_0x0583('0x3b')][_0x0583('0x3c')]?_0x5eb962[_0x0583('0x3b')]:_0x4c98ce['model'];if(!_0x334db6[_0x0583('0x37')]['hasOwnProperty'](_0x0583('0x3d'))){_0x5eb962['limit']=qs['limit'](_0x334db6[_0x0583('0x37')][_0x0583('0x25')]);_0x5eb962[_0x0583('0x22')]=qs[_0x0583('0x22')](_0x334db6[_0x0583('0x37')][_0x0583('0x22')]);}_0x5eb962[_0x0583('0x3e')]=qs[_0x0583('0x3f')](_0x334db6[_0x0583('0x37')][_0x0583('0x3f')]);_0x5eb962['where']=qs['filters'](_[_0x0583('0x40')](_0x334db6['query'],_0x4c98ce[_0x0583('0x39')]),_0x1fca3f);if(_0x334db6['query']['filter']){_0x5eb962['where']=_[_0x0583('0x41')](_0x5eb962[_0x0583('0x42')],{'$or':_[_0x0583('0x32')](_0x1fca3f,function(_0x4d76d0){if(_0x4d76d0['type']!==_0x0583('0x43')){var _0x2971cd={};_0x2971cd[_0x4d76d0['name']]={'$like':'%'+_0x334db6[_0x0583('0x37')][_0x0583('0x44')]+'%'};return _0x2971cd;}})});}_0x5eb962=_['merge']({},_0x5eb962,_0x334db6[_0x0583('0x45')]);var _0x2763b9={'where':_0x5eb962[_0x0583('0x42')]};return db[_0x0583('0x33')][_0x0583('0x24')](_0x2763b9)['then'](function(_0x3bb779){_0x94efaf[_0x0583('0x24')]=_0x3bb779;if(_0x334db6[_0x0583('0x37')][_0x0583('0x46')]){_0x5eb962[_0x0583('0x47')]=[{'all':!![]}];}return db[_0x0583('0x33')][_0x0583('0x48')](_0x5eb962);})[_0x0583('0x2b')](function(_0x4c1ba9){_0x94efaf[_0x0583('0x49')]=_0x4c1ba9;return _0x94efaf;})[_0x0583('0x2b')](respondWithFilteredResult(_0xbc77b4,_0x5eb962))[_0x0583('0x4a')](handleError(_0xbc77b4,null));};exports[_0x0583('0x4b')]=function(_0x126388,_0x59efb3){var _0x342303={'raw':!![],'where':{'id':_0x126388[_0x0583('0x4c')]['id']}},_0x2c7146={};_0x2c7146['model']=_['keys'](db[_0x0583('0x33')][_0x0583('0x34')]);_0x2c7146[_0x0583('0x37')]=_[_0x0583('0x38')](_0x126388[_0x0583('0x37')]);_0x2c7146[_0x0583('0x39')]=_[_0x0583('0x3a')](_0x2c7146['model'],_0x2c7146[_0x0583('0x37')]);_0x342303[_0x0583('0x3b')]=_[_0x0583('0x3a')](_0x2c7146[_0x0583('0x36')],qs[_0x0583('0x4d')](_0x126388['query'][_0x0583('0x4d')]));_0x342303[_0x0583('0x3b')]=_0x342303['attributes']['length']?_0x342303[_0x0583('0x3b')]:_0x2c7146[_0x0583('0x36')];if(_0x126388[_0x0583('0x37')][_0x0583('0x46')]){_0x342303[_0x0583('0x47')]=[{'all':!![]}];}_0x342303=_[_0x0583('0x41')]({},_0x342303,_0x126388[_0x0583('0x45')]);return db[_0x0583('0x33')]['find'](_0x342303)[_0x0583('0x2b')](handleEntityNotFound(_0x59efb3,null))[_0x0583('0x2b')](respondWithResult(_0x59efb3,null))[_0x0583('0x4a')](handleError(_0x59efb3,null));};exports[_0x0583('0x4e')]=function(_0x25bf6a,_0x3edfe3){return db[_0x0583('0x33')][_0x0583('0x4e')](_0x25bf6a[_0x0583('0x4f')],{})[_0x0583('0x2b')](respondWithResult(_0x3edfe3,0xc9))[_0x0583('0x4a')](handleError(_0x3edfe3,null));};exports[_0x0583('0x2a')]=function(_0xcec16d,_0x59057e){if(_0xcec16d[_0x0583('0x4f')]['id']){delete _0xcec16d[_0x0583('0x4f')]['id'];}return db['ChatGroup']['find']({'where':{'id':_0xcec16d[_0x0583('0x4c')]['id']}})[_0x0583('0x2b')](handleEntityNotFound(_0x59057e,null))[_0x0583('0x2b')](saveUpdates(_0xcec16d['body'],null))[_0x0583('0x2b')](respondWithResult(_0x59057e,null))[_0x0583('0x4a')](handleError(_0x59057e,null));};exports[_0x0583('0x2c')]=function(_0xfd4ef,_0x1801c2){return db[_0x0583('0x33')][_0x0583('0x50')]({'where':{'id':_0xfd4ef[_0x0583('0x4c')]['id']}})[_0x0583('0x2b')](handleEntityNotFound(_0x1801c2,null))[_0x0583('0x2b')](removeEntity(_0x1801c2,null))[_0x0583('0x4a')](handleError(_0x1801c2,null));};exports[_0x0583('0x51')]=function(_0x3ec80a,_0x49f0f2){return db[_0x0583('0x33')]['describe']()[_0x0583('0x2b')](respondWithResult(_0x49f0f2,null))[_0x0583('0x4a')](handleError(_0x49f0f2,null));};exports['getUnread']=function(_0x408d2f,_0x51b982,_0x5e1d15){return db[_0x0583('0x52')][_0x0583('0x24')]({'where':{'ChatGroupId':_0x408d2f[_0x0583('0x4c')]['id'],'ToId':_0x408d2f[_0x0583('0x53')]['id'],'read':![]}})[_0x0583('0x2b')](function(_0x1fe926){return{'id':_[_0x0583('0x54')](_0x408d2f[_0x0583('0x4c')]['id']),'count':_0x1fe926};})[_0x0583('0x2b')](respondWithResult(_0x51b982,null))[_0x0583('0x4a')](handleError(_0x51b982,null));};exports[_0x0583('0x55')]=function(_0x4925c7,_0x26e832,_0x3aabd0){return db[_0x0583('0x33')][_0x0583('0x50')]({'where':{'id':_0x4925c7['params']['id']}})[_0x0583('0x2b')](handleEntityNotFound(_0x26e832,null))[_0x0583('0x2b')](function(_0x5c5711){if(_0x5c5711){return _0x5c5711['addMembers'](_0x4925c7['body'][_0x0583('0x56')],_[_0x0583('0x57')](_0x4925c7[_0x0583('0x4f')],[_0x0583('0x56'),'id'])||{});}})[_0x0583('0x2b')](respondWithResult(_0x26e832,null))[_0x0583('0x4a')](handleError(_0x26e832,null));};exports['getMembers']=function(_0x17fdf8,_0xd3cf40,_0x530ce7){var _0x556704={};var _0x5a5823={};var _0x3d8896;var _0x412031;return db[_0x0583('0x33')]['findOne']({'where':{'id':_0x17fdf8[_0x0583('0x4c')]['id']}})[_0x0583('0x2b')](handleEntityNotFound(_0xd3cf40,null))[_0x0583('0x2b')](function(_0x57f6e4){if(_0x57f6e4){_0x3d8896=_0x57f6e4;_0x5a5823[_0x0583('0x36')]=_[_0x0583('0x38')](db[_0x0583('0x58')][_0x0583('0x34')]);_0x5a5823[_0x0583('0x37')]=_[_0x0583('0x38')](_0x17fdf8['query']);_0x5a5823['filters']=_[_0x0583('0x3a')](_0x5a5823[_0x0583('0x36')],_0x5a5823[_0x0583('0x37')]);_0x556704[_0x0583('0x3b')]=_[_0x0583('0x3a')](_0x5a5823[_0x0583('0x36')],qs['fields'](_0x17fdf8['query'][_0x0583('0x4d')]));_0x556704[_0x0583('0x3b')]=_0x556704[_0x0583('0x3b')][_0x0583('0x3c')]?_0x556704[_0x0583('0x3b')]:_0x5a5823[_0x0583('0x36')];_0x556704['order']=qs[_0x0583('0x3f')](_0x17fdf8[_0x0583('0x37')][_0x0583('0x3f')]);_0x556704[_0x0583('0x42')]=qs[_0x0583('0x39')](_[_0x0583('0x40')](_0x17fdf8[_0x0583('0x37')],_0x5a5823['filters']));if(_0x17fdf8[_0x0583('0x37')][_0x0583('0x44')]){_0x556704[_0x0583('0x42')]=_[_0x0583('0x41')](_0x556704['where'],{'$or':_['map'](_0x556704[_0x0583('0x3b')],function(_0x12adff){var _0x3bdda1={};_0x3bdda1[_0x12adff]={'$like':'%'+_0x17fdf8[_0x0583('0x37')][_0x0583('0x44')]+'%'};return _0x3bdda1;})});}_0x556704=_[_0x0583('0x41')]({},_0x556704,_0x17fdf8['options']);return _0x3d8896[_0x0583('0x59')](_0x556704);}})['then'](function(_0x3e57b3){if(_0x3e57b3){_0x412031=_0x3e57b3[_0x0583('0x3c')];if(!_0x17fdf8[_0x0583('0x37')][_0x0583('0x5a')]('nolimit')){_0x556704[_0x0583('0x25')]=qs[_0x0583('0x25')](_0x17fdf8[_0x0583('0x37')]['limit']);_0x556704[_0x0583('0x22')]=qs['offset'](_0x17fdf8[_0x0583('0x37')][_0x0583('0x22')]);}return _0x3d8896['getMembers'](_0x556704);}})[_0x0583('0x2b')](function(_0x1fa60f){if(_0x1fa60f){return _0x1fa60f?{'count':_0x412031,'rows':_0x1fa60f}:null;}})[_0x0583('0x2b')](respondWithResult(_0xd3cf40,null))[_0x0583('0x4a')](handleError(_0xd3cf40,null));};exports[_0x0583('0x5b')]=function(_0x1b962f,_0x458133,_0x87c92b){return db[_0x0583('0x33')][_0x0583('0x50')]({'where':{'id':_0x1b962f[_0x0583('0x4c')]['id']}})[_0x0583('0x2b')](handleEntityNotFound(_0x458133,null))[_0x0583('0x2b')](function(_0xfec60e){if(_0xfec60e){return _0xfec60e[_0x0583('0x5b')](_0x1b962f['query'][_0x0583('0x56')]);}})['then'](respondWithStatusCode(_0x458133,null))[_0x0583('0x4a')](handleError(_0x458133,null));};exports[_0x0583('0x5c')]=function(_0x55506f,_0x1a0b09,_0x184edd){if(_0x55506f[_0x0583('0x4f')]['id']){delete _0x55506f['body']['id'];}return db['ChatGroup'][_0x0583('0x50')]({'where':{'id':_0x55506f['params']['id']}})[_0x0583('0x2b')](handleEntityNotFound(_0x1a0b09,null))[_0x0583('0x2b')](function(_0x4f282c){if(_0x4f282c){_0x55506f[_0x0583('0x4f')][_0x0583('0x5d')]=_0x4f282c['id'];return db[_0x0583('0x52')][_0x0583('0x4e')](_0x55506f[_0x0583('0x4f')]);}})[_0x0583('0x2b')](respondWithResult(_0x1a0b09,null))[_0x0583('0x4a')](handleError(_0x1a0b09,null));};exports[_0x0583('0x5e')]=function(_0x12dbe9,_0x105cde,_0x212a88){var _0x430658={};var _0x4504c8={};var _0x2c20c4;var _0x311c50;return db[_0x0583('0x33')][_0x0583('0x5f')]({'where':{'id':_0x12dbe9[_0x0583('0x4c')]['id']}})['then'](handleEntityNotFound(_0x105cde,null))[_0x0583('0x2b')](function(_0x2e3270){if(_0x2e3270){_0x2c20c4=_0x2e3270;_0x4504c8[_0x0583('0x36')]=_[_0x0583('0x38')](db[_0x0583('0x52')][_0x0583('0x34')]);_0x4504c8[_0x0583('0x37')]=_[_0x0583('0x38')](_0x12dbe9['query']);_0x4504c8[_0x0583('0x39')]=_[_0x0583('0x3a')](_0x4504c8[_0x0583('0x36')],_0x4504c8[_0x0583('0x37')]);_0x430658[_0x0583('0x3b')]=_[_0x0583('0x3a')](_0x4504c8[_0x0583('0x36')],qs['fields'](_0x12dbe9[_0x0583('0x37')][_0x0583('0x4d')]));_0x430658[_0x0583('0x3b')]=_0x430658[_0x0583('0x3b')]['length']?_0x430658[_0x0583('0x3b')]:_0x4504c8[_0x0583('0x36')];_0x430658[_0x0583('0x3e')]=qs['sort'](_0x12dbe9[_0x0583('0x37')]['sort']);_0x430658['where']=qs[_0x0583('0x39')](_['pick'](_0x12dbe9[_0x0583('0x37')],_0x4504c8[_0x0583('0x39')]));if(_0x12dbe9['query'][_0x0583('0x44')]){_0x430658['where']=_['merge'](_0x430658[_0x0583('0x42')],{'$or':_[_0x0583('0x32')](_0x430658[_0x0583('0x3b')],function(_0xbc49cc){var _0x7173c4={};_0x7173c4[_0xbc49cc]={'$like':'%'+_0x12dbe9[_0x0583('0x37')][_0x0583('0x44')]+'%'};return _0x7173c4;})});}if(_0x12dbe9[_0x0583('0x37')][_0x0583('0x60')]){var _0x19ea3a=_0x12dbe9['query'][_0x0583('0x60')][_0x0583('0x61')](',');var _0x39412c={};_0x39412c[_0x19ea3a[0x0]]={'$gte':moment(_0x19ea3a[0x1])['format'](_0x0583('0x62'))};_0x430658[_0x0583('0x42')]=_['merge'](_0x430658[_0x0583('0x42')],_0x39412c);}_0x430658=_[_0x0583('0x41')]({},_0x430658,_0x12dbe9[_0x0583('0x45')]);return _0x2c20c4[_0x0583('0x5e')](_0x430658);}})[_0x0583('0x2b')](function(_0x4864fa){if(_0x4864fa){_0x311c50=_0x4864fa[_0x0583('0x3c')];if(!_0x12dbe9[_0x0583('0x37')][_0x0583('0x5a')](_0x0583('0x3d'))){_0x430658[_0x0583('0x25')]=qs[_0x0583('0x25')](_0x12dbe9[_0x0583('0x37')][_0x0583('0x25')]);_0x430658[_0x0583('0x22')]=qs['offset'](_0x12dbe9['query']['offset']);}return _0x2c20c4['getMessages'](_0x430658);}})[_0x0583('0x2b')](function(_0x5886eb){if(_0x5886eb){return _0x5886eb?{'count':_0x311c50,'rows':_0x5886eb}:null;}})[_0x0583('0x2b')](respondWithResult(_0x105cde,null))[_0x0583('0x4a')](handleError(_0x105cde,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index 93d10fa..15f863f 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 _0x258c=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0x258c,0x168));var _0xc258=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x258c[_0x29d915];return _0x160f86;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xc258('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xc258('0x1')](0x0);var events={'afterCreate':_0xc258('0x2'),'afterUpdate':_0xc258('0x3'),'afterDestroy':_0xc258('0x4')};function emitEvent(_0x5eb02f){return function(_0x163cdc,_0x193b6d,_0x2130d0){ChatGroupEvents[_0xc258('0x5')](_0x5eb02f+':'+_0x163cdc['id'],_0x163cdc);ChatGroupEvents['emit'](_0x5eb02f,_0x163cdc);_0x2130d0(null);};}for(var e in events){if(events[_0xc258('0x6')](e)){var event=events[e];ChatGroup[_0xc258('0x7')](e,emitEvent(event));}}module['exports']=ChatGroupEvents; \ No newline at end of file +var _0x3f3c=['update','remove','emit','exports','../../mysqldb','ChatGroup','save'];(function(_0x21e79a,_0x5a7990){var _0x506c02=function(_0x566c95){while(--_0x566c95){_0x21e79a['push'](_0x21e79a['shift']());}};_0x506c02(++_0x5a7990);}(_0x3f3c,0x1e0));var _0xc3f3=function(_0xc43097,_0x3e4039){_0xc43097=_0xc43097-0x0;var _0x446b44=_0x3f3c[_0xc43097];return _0x446b44;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0xc3f3('0x0'))['db'][_0xc3f3('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xc3f3('0x2'),'afterUpdate':_0xc3f3('0x3'),'afterDestroy':_0xc3f3('0x4')};function emitEvent(_0x2b7ca0){return function(_0xb3c191,_0x591199,_0xdf1d7a){ChatGroupEvents[_0xc3f3('0x5')](_0x2b7ca0+':'+_0xb3c191['id'],_0xb3c191);ChatGroupEvents[_0xc3f3('0x5')](_0x2b7ca0,_0xb3c191);_0xdf1d7a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xc3f3('0x6')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index 235a4f5..5942baa 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 _0x7c57=['moment','bluebird','request-promise','path','rimraf','./chatGroup.attributes','exports','ChatGroup','chat_groups','lodash','util','../../config/logger'];(function(_0x2b76fc,_0x4d1bed){var _0x407917=function(_0x4f33c8){while(--_0x4f33c8){_0x2b76fc['push'](_0x2b76fc['shift']());}};_0x407917(++_0x4d1bed);}(_0x7c57,0x14d));var _0x77c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c57[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x77c5('0x0'));var util=require(_0x77c5('0x1'));var logger=require(_0x77c5('0x2'))('api');var moment=require(_0x77c5('0x3'));var BPromise=require(_0x77c5('0x4'));var rp=require(_0x77c5('0x5'));var fs=require('fs');var path=require(_0x77c5('0x6'));var rimraf=require(_0x77c5('0x7'));var config=require('../../config/environment');var attributes=require(_0x77c5('0x8'));module[_0x77c5('0x9')]=function(_0x2801ef,_0x5b3b07){return _0x2801ef['define'](_0x77c5('0xa'),attributes,{'tableName':_0x77c5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd1a=['exports','define','ChatGroup','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x2071cc,_0x5d728e){var _0x31aa5d=function(_0x2febbd){while(--_0x2febbd){_0x2071cc['push'](_0x2071cc['shift']());}};_0x31aa5d(++_0x5d728e);}(_0xdd1a,0x189));var _0xadd1=function(_0x36938b,_0x46e38a){_0x36938b=_0x36938b-0x0;var _0x59f590=_0xdd1a[_0x36938b];return _0x59f590;};'use strict';var _=require(_0xadd1('0x0'));var util=require('util');var logger=require(_0xadd1('0x1'))(_0xadd1('0x2'));var moment=require(_0xadd1('0x3'));var BPromise=require(_0xadd1('0x4'));var rp=require(_0xadd1('0x5'));var fs=require('fs');var path=require(_0xadd1('0x6'));var rimraf=require(_0xadd1('0x7'));var config=require(_0xadd1('0x8'));var attributes=require(_0xadd1('0x9'));module[_0xadd1('0xa')]=function(_0x3f2040,_0x284644){return _0x3f2040[_0xadd1('0xb')](_0xadd1('0xc'),attributes,{'tableName':'chat_groups','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 5cfb682..f41e31a 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 _0x34e7=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','register','info','ChatGroup,\x20%s,\x20%s','request\x20sent','ChatGroup,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x52f427,_0x46e88e){var _0x2bea3e=function(_0x287a20){while(--_0x287a20){_0x52f427['push'](_0x52f427['shift']());}};_0x2bea3e(++_0x46e88e);}(_0x34e7,0x164));var _0x734e=function(_0x1c5adf,_0x12a026){_0x1c5adf=_0x1c5adf-0x0;var _0x3dd9c2=_0x34e7[_0x1c5adf];return _0x3dd9c2;};'use strict';var _=require(_0x734e('0x0'));var util=require(_0x734e('0x1'));var moment=require(_0x734e('0x2'));var BPromise=require(_0x734e('0x3'));var rs=require(_0x734e('0x4'));var fs=require('fs');var Redis=require(_0x734e('0x5'));var db=require(_0x734e('0x6'))['db'];var utils=require(_0x734e('0x7'));var logger=require(_0x734e('0x8'))(_0x734e('0x9'));var config=require(_0x734e('0xa'));var jayson=require(_0x734e('0xb'));var client=jayson[_0x734e('0xc')][_0x734e('0xd')]({'port':0x232a});config['redis']=_[_0x734e('0xe')](config[_0x734e('0xf')],{'host':_0x734e('0x10'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x734e('0xf')]));require('./chatGroup.socket')[_0x734e('0x11')](socket);function respondWithRpcPromise(_0x436f6b,_0x3eee26,_0x4161e2){return new BPromise(function(_0x37350f,_0x3d117e){return client['request'](_0x436f6b,_0x4161e2)['then'](function(_0xaabf6b){logger[_0x734e('0x12')](_0x734e('0x13'),_0x3eee26,_0x734e('0x14'));logger['debug'](_0x734e('0x15'),_0x3eee26,_0x734e('0x14'),JSON['stringify'](_0xaabf6b));if(_0xaabf6b[_0x734e('0x16')]){if(_0xaabf6b[_0x734e('0x16')][_0x734e('0x17')]===0x1f4){logger[_0x734e('0x16')](_0x734e('0x13'),_0x3eee26,_0xaabf6b['error'][_0x734e('0x18')]);return _0x3d117e(_0xaabf6b[_0x734e('0x16')][_0x734e('0x18')]);}logger['error'](_0x734e('0x13'),_0x3eee26,_0xaabf6b['error'][_0x734e('0x18')]);return _0x37350f(_0xaabf6b[_0x734e('0x16')]['message']);}else{logger[_0x734e('0x12')]('ChatGroup,\x20%s,\x20%s',_0x3eee26,_0x734e('0x14'));_0x37350f(_0xaabf6b['result'][_0x734e('0x18')]);}})[_0x734e('0x19')](function(_0x207a8f){logger[_0x734e('0x16')](_0x734e('0x13'),_0x3eee26,_0x207a8f);_0x3d117e(_0x207a8f);});});} \ No newline at end of file +var _0x76ed=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','register','then','info','debug','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring'];(function(_0x4d7d83,_0x541c99){var _0x44ca19=function(_0x196b7d){while(--_0x196b7d){_0x4d7d83['push'](_0x4d7d83['shift']());}};_0x44ca19(++_0x541c99);}(_0x76ed,0x1d0));var _0xd76e=function(_0x19c535,_0x2ad2b5){_0x19c535=_0x19c535-0x0;var _0x282e28=_0x76ed[_0x19c535];return _0x282e28;};'use strict';var _=require(_0xd76e('0x0'));var util=require(_0xd76e('0x1'));var moment=require('moment');var BPromise=require(_0xd76e('0x2'));var rs=require(_0xd76e('0x3'));var fs=require('fs');var Redis=require(_0xd76e('0x4'));var db=require(_0xd76e('0x5'))['db'];var utils=require(_0xd76e('0x6'));var logger=require(_0xd76e('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xd76e('0x8'));var client=jayson[_0xd76e('0x9')][_0xd76e('0xa')]({'port':0x232a});config[_0xd76e('0xb')]=_[_0xd76e('0xc')](config[_0xd76e('0xb')],{'host':_0xd76e('0xd'),'port':0x18eb});var socket=require(_0xd76e('0xe'))(new Redis(config['redis']));require(_0xd76e('0xf'))[_0xd76e('0x10')](socket);function respondWithRpcPromise(_0x3fc332,_0x2037d7,_0x5df681){return new BPromise(function(_0xaebd5b,_0x7b3d4c){return client['request'](_0x3fc332,_0x5df681)[_0xd76e('0x11')](function(_0x807b29){logger[_0xd76e('0x12')]('ChatGroup,\x20%s,\x20%s',_0x2037d7,'request\x20sent');logger[_0xd76e('0x13')]('ChatGroup,\x20%s,\x20%s,\x20%s',_0x2037d7,'request\x20sent',JSON[_0xd76e('0x14')](_0x807b29));if(_0x807b29[_0xd76e('0x15')]){if(_0x807b29[_0xd76e('0x15')][_0xd76e('0x16')]===0x1f4){logger[_0xd76e('0x15')](_0xd76e('0x17'),_0x2037d7,_0x807b29['error'][_0xd76e('0x18')]);return _0x7b3d4c(_0x807b29[_0xd76e('0x15')][_0xd76e('0x18')]);}logger['error'](_0xd76e('0x17'),_0x2037d7,_0x807b29['error'][_0xd76e('0x18')]);return _0xaebd5b(_0x807b29['error'][_0xd76e('0x18')]);}else{logger['info']('ChatGroup,\x20%s,\x20%s',_0x2037d7,'request\x20sent');_0xaebd5b(_0x807b29[_0xd76e('0x19')][_0xd76e('0x18')]);}})['catch'](function(_0x13a9f9){logger[_0xd76e('0x15')](_0xd76e('0x17'),_0x2037d7,_0x13a9f9);_0x7b3d4c(_0x13a9f9);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index 8260905..6a73eb3 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 _0x2888=['length','chatGroup:','save','update','removeListener','register'];(function(_0x4e979e,_0xc85b3c){var _0x32c261=function(_0x211567){while(--_0x211567){_0x4e979e['push'](_0x4e979e['shift']());}};_0x32c261(++_0xc85b3c);}(_0x2888,0x15e));var _0x8288=function(_0x6b1ccf,_0x330398){_0x6b1ccf=_0x6b1ccf-0x0;var _0x563a68=_0x2888[_0x6b1ccf];return _0x563a68;};'use strict';var ChatGroupEvents=require('./chatGroup.events');var events=[_0x8288('0x0'),'remove',_0x8288('0x1')];function createListener(_0x45921a,_0x5b7c8b){return function(_0x3c6c41){_0x5b7c8b['emit'](_0x45921a,_0x3c6c41);};}function removeListener(_0x244a78,_0x1b84c1){return function(){ChatGroupEvents[_0x8288('0x2')](_0x244a78,_0x1b84c1);};}exports[_0x8288('0x3')]=function(_0x8bd21b){for(var _0x3b3af3=0x0,_0x9b8c3=events[_0x8288('0x4')];_0x3b3af3<_0x9b8c3;_0x3b3af3++){var _0x590f74=events[_0x3b3af3];var _0x29e695=createListener(_0x8288('0x5')+_0x590f74,_0x8bd21b);ChatGroupEvents['on'](_0x590f74,_0x29e695);}}; \ No newline at end of file +var _0x3658=['remove','emit','length','chatGroup:','./chatGroup.events','save'];(function(_0x25bd49,_0x225020){var _0x1f6a47=function(_0x450696){while(--_0x450696){_0x25bd49['push'](_0x25bd49['shift']());}};_0x1f6a47(++_0x225020);}(_0x3658,0x13c));var _0x8365=function(_0x30bbc8,_0x932a63){_0x30bbc8=_0x30bbc8-0x0;var _0x17faa8=_0x3658[_0x30bbc8];return _0x17faa8;};'use strict';var ChatGroupEvents=require(_0x8365('0x0'));var events=[_0x8365('0x1'),_0x8365('0x2'),'update'];function createListener(_0x401b3a,_0x2ca2a3){return function(_0x1c7485){_0x2ca2a3[_0x8365('0x3')](_0x401b3a,_0x1c7485);};}function removeListener(_0x33d222,_0x43cb3d){return function(){ChatGroupEvents['removeListener'](_0x33d222,_0x43cb3d);};}exports['register']=function(_0x573bf6){for(var _0x325216=0x0,_0x42f9e9=events[_0x8365('0x4')];_0x325216<_0x42f9e9;_0x325216++){var _0x870ee8=events[_0x325216];var _0x34d9b0=createListener(_0x8365('0x5')+_0x870ee8,_0x573bf6);ChatGroupEvents['on'](_0x870ee8,_0x34d9b0);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 9fd351e..cb1e539 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 _0x81dd=['getMessages','create','post','addMessage','/:id','delete','destroy','/:id/members','removeMembers','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','isAuthenticated','/describe','describe','get','show','/:id/unread','getUnread','getMembers','/:id/messages'];(function(_0x5027b1,_0x1409a5){var _0x4a46cf=function(_0x121920){while(--_0x121920){_0x5027b1['push'](_0x5027b1['shift']());}};_0x4a46cf(++_0x1409a5);}(_0x81dd,0x12c));var _0xd81d=function(_0x395942,_0x187734){_0x395942=_0x395942-0x0;var _0x275e29=_0x81dd[_0x395942];return _0x275e29;};'use strict';var multer=require(_0xd81d('0x0'));var util=require(_0xd81d('0x1'));var path=require(_0xd81d('0x2'));var timeout=require(_0xd81d('0x3'));var express=require(_0xd81d('0x4'));var router=express['Router']();var fs_extra=require(_0xd81d('0x5'));var auth=require(_0xd81d('0x6'));var interaction=require(_0xd81d('0x7'));var config=require(_0xd81d('0x8'));var controller=require(_0xd81d('0x9'));router['get']('/',auth[_0xd81d('0xa')](),controller['index']);router['get'](_0xd81d('0xb'),auth['isAuthenticated'](),controller[_0xd81d('0xc')]);router[_0xd81d('0xd')]('/:id',auth[_0xd81d('0xa')](),controller[_0xd81d('0xe')]);router[_0xd81d('0xd')](_0xd81d('0xf'),auth[_0xd81d('0xa')](),controller[_0xd81d('0x10')]);router['get']('/:id/members',auth['isAuthenticated'](),controller[_0xd81d('0x11')]);router[_0xd81d('0xd')](_0xd81d('0x12'),auth[_0xd81d('0xa')](),controller[_0xd81d('0x13')]);router['post']('/',auth[_0xd81d('0xa')](),controller[_0xd81d('0x14')]);router[_0xd81d('0x15')]('/:id/members',auth[_0xd81d('0xa')](),controller['addMembers']);router['post']('/:id/messages',auth['isAuthenticated'](),controller[_0xd81d('0x16')]);router['put'](_0xd81d('0x17'),auth['isAuthenticated'](),controller['update']);router[_0xd81d('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xd81d('0x19')]);router[_0xd81d('0x18')](_0xd81d('0x1a'),auth['isAuthenticated'](),controller[_0xd81d('0x1b')]);module[_0xd81d('0x1c')]=router; \ No newline at end of file +var _0xb754=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatGroup.controller','get','isAuthenticated','index','describe','show','/:id/unread','getUnread','/:id/messages','getMessages','post','create','/:id/members','addMembers','addMessage','put','/:id','update','delete','destroy','removeMembers','exports','multer','util','path','connect-timeout','express'];(function(_0x41ecb2,_0x306e02){var _0x1137d9=function(_0x4be3ef){while(--_0x4be3ef){_0x41ecb2['push'](_0x41ecb2['shift']());}};_0x1137d9(++_0x306e02);}(_0xb754,0x15b));var _0x4b75=function(_0x51c4f3,_0x1ce048){_0x51c4f3=_0x51c4f3-0x0;var _0x2d46be=_0xb754[_0x51c4f3];return _0x2d46be;};'use strict';var multer=require(_0x4b75('0x0'));var util=require(_0x4b75('0x1'));var path=require(_0x4b75('0x2'));var timeout=require(_0x4b75('0x3'));var express=require(_0x4b75('0x4'));var router=express[_0x4b75('0x5')]();var fs_extra=require(_0x4b75('0x6'));var auth=require(_0x4b75('0x7'));var interaction=require(_0x4b75('0x8'));var config=require(_0x4b75('0x9'));var controller=require(_0x4b75('0xa'));router[_0x4b75('0xb')]('/',auth[_0x4b75('0xc')](),controller[_0x4b75('0xd')]);router[_0x4b75('0xb')]('/describe',auth[_0x4b75('0xc')](),controller[_0x4b75('0xe')]);router[_0x4b75('0xb')]('/:id',auth[_0x4b75('0xc')](),controller[_0x4b75('0xf')]);router[_0x4b75('0xb')](_0x4b75('0x10'),auth[_0x4b75('0xc')](),controller[_0x4b75('0x11')]);router[_0x4b75('0xb')]('/:id/members',auth[_0x4b75('0xc')](),controller['getMembers']);router[_0x4b75('0xb')](_0x4b75('0x12'),auth[_0x4b75('0xc')](),controller[_0x4b75('0x13')]);router[_0x4b75('0x14')]('/',auth[_0x4b75('0xc')](),controller[_0x4b75('0x15')]);router['post'](_0x4b75('0x16'),auth[_0x4b75('0xc')](),controller[_0x4b75('0x17')]);router[_0x4b75('0x14')](_0x4b75('0x12'),auth[_0x4b75('0xc')](),controller[_0x4b75('0x18')]);router[_0x4b75('0x19')](_0x4b75('0x1a'),auth[_0x4b75('0xc')](),controller[_0x4b75('0x1b')]);router[_0x4b75('0x1c')]('/:id',auth[_0x4b75('0xc')](),controller[_0x4b75('0x1d')]);router[_0x4b75('0x1c')]('/:id/members',auth['isAuthenticated'](),controller[_0x4b75('0x1e')]);module[_0x4b75('0x1f')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index aeef6e3..4f2f0b1 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 _0xc686=['BOOLEAN','ENUM','thumb','star','TEXT','STRING','DATE','out'];(function(_0x339240,_0x4864a1){var _0x591d4c=function(_0x102680){while(--_0x102680){_0x339240['push'](_0x339240['shift']());}};_0x591d4c(++_0x4864a1);}(_0xc686,0x148));var _0x6c68=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xc686[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require('sequelize');module['exports']={'closed':{'type':Sequelize[_0x6c68('0x0')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x6c68('0x1')]('star',_0x6c68('0x2')),'defaultValue':_0x6c68('0x3')},'ratingMessage':{'type':Sequelize[_0x6c68('0x4')]},'pathTranscript':{'type':Sequelize[_0x6c68('0x4')]},'mailTranscript':{'type':Sequelize[_0x6c68('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6c68('0x6')]},'disposition':{'type':Sequelize[_0x6c68('0x5')]},'secondDisposition':{'type':Sequelize[_0x6c68('0x5')]},'thirdDisposition':{'type':Sequelize[_0x6c68('0x5')]},'note':{'type':Sequelize[_0x6c68('0x5')]},'browserName':{'type':Sequelize[_0x6c68('0x5')]},'browserVersion':{'type':Sequelize[_0x6c68('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize[_0x6c68('0x5')]},'deviceModel':{'type':Sequelize[_0x6c68('0x5')]},'deviceVendor':{'type':Sequelize['STRING']},'deviceType':{'type':Sequelize[_0x6c68('0x5')]},'referer':{'type':Sequelize['TEXT']},'customerIp':{'type':Sequelize[_0x6c68('0x5')]},'formData':{'type':Sequelize[_0x6c68('0x4')]('long')},'read1stAt':{'type':Sequelize[_0x6c68('0x6')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x6c68('0x1')]('in',_0x6c68('0x7')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x6c68('0x5')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xf996=['star','TEXT','STRING','DATE','long','out','sequelize','exports','BOOLEAN','ENUM'];(function(_0x146a85,_0x529b52){var _0x1b59bf=function(_0x4af0fd){while(--_0x4af0fd){_0x146a85['push'](_0x146a85['shift']());}};_0x1b59bf(++_0x529b52);}(_0xf996,0x74));var _0x6f99=function(_0x47e691,_0x450beb){_0x47e691=_0x47e691-0x0;var _0x14380e=_0xf996[_0x47e691];return _0x14380e;};'use strict';var Sequelize=require(_0x6f99('0x0'));module[_0x6f99('0x1')]={'closed':{'type':Sequelize[_0x6f99('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize['INTEGER']},'ratingType':{'type':Sequelize[_0x6f99('0x3')]('star','thumb'),'defaultValue':_0x6f99('0x4')},'ratingMessage':{'type':Sequelize[_0x6f99('0x5')]},'pathTranscript':{'type':Sequelize[_0x6f99('0x5')]},'mailTranscript':{'type':Sequelize[_0x6f99('0x6')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x6f99('0x7')]},'disposition':{'type':Sequelize[_0x6f99('0x6')]},'secondDisposition':{'type':Sequelize[_0x6f99('0x6')]},'thirdDisposition':{'type':Sequelize[_0x6f99('0x6')]},'note':{'type':Sequelize[_0x6f99('0x6')]},'browserName':{'type':Sequelize[_0x6f99('0x6')]},'browserVersion':{'type':Sequelize['STRING']},'osName':{'type':Sequelize[_0x6f99('0x6')]},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x6f99('0x6')]},'deviceVendor':{'type':Sequelize[_0x6f99('0x6')]},'deviceType':{'type':Sequelize[_0x6f99('0x6')]},'referer':{'type':Sequelize[_0x6f99('0x5')]},'customerIp':{'type':Sequelize[_0x6f99('0x6')]},'formData':{'type':Sequelize[_0x6f99('0x5')](_0x6f99('0x8'))},'read1stAt':{'type':Sequelize[_0x6f99('0x7')]},'lastMsgAt':{'type':Sequelize[_0x6f99('0x7')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x6f99('0x9')),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize['STRING']},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x6f99('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index cf258ad..a4428a4 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 _0xda2d=['update','destroy','name','send','render','merge','agent','interaction','account','Users','map','Tags','split','forEach','TagIds','index','ChatInteraction','rawAttributes','fieldName','type','key','model','keys','query','intersection','fields','attributes','nolimit','order','sort','filters','pick','field','color','tools_tags','select','u.id','u.fullname','from','user_has_chat_interactions','left_join','u.id\x20=\x20ui.UserId','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','length','find','unreadMessages','value','having','`\x20=\x200','`\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','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','start','body','some','compact','where','i.ChatWebsiteId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','SELECT','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','isEmpty','t.id\x20IN\x20?','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','role','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','toString','sequelize','keyBy','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','i.*','c.firstName','c.lastName','Contact.lastName','c.email','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','groupBy','ChatInteractionId','push','show','params','include','options','create','describe','findOne','ChatWebsiteId','vidaooEscalation','vidaooTopic','vidaooApiKey','fullname','email','contact','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','vidaooNote','follow','vidaooMetadata','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','join_url','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','CmContact','abandon','Interaction\x20already\x20assigned','disposition','attachmentUpload','file','filename','mimetype','attachmentDownload','closed','Unauthorized','attachId','ChatOfflineMessageId','join','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','now','pathTranscript','Messages','ChatWebsite','format','%s%d','agentAlias','customer','Visitor','website_alias','UserId','System','agent_alias','alias','agent_fullname','MM/DD/YYYY\x20HH:mm:ss','direction','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','omit','getMessages','hasOwnProperty','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','addTags','setTags','findAll','chatInteractionTags:save','removeTags','unix','server','tmp','files','attachments','firstName','lastName','Attachment','Account','Owner','get','Chat','N.A.','browserName','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','sox','to-csv','ejs','fs-extra','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','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','reject','save'];(function(_0x46066f,_0x23105c){var _0x411977=function(_0x5743ff){while(--_0x5743ff){_0x46066f['push'](_0x46066f['shift']());}};_0x411977(++_0x23105c);}(_0xda2d,0x102));var _0xdda2=function(_0x30f795,_0x451a21){_0x30f795=_0x30f795-0x0;var _0x2da77c=_0xda2d[_0x30f795];return _0x2da77c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda2('0x0'));var zipdir=require(_0xdda2('0x1'));var jsonpatch=require(_0xdda2('0x2'));var rp=require(_0xdda2('0x3'));var moment=require(_0xdda2('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xdda2('0x5'));var sox=require(_0xdda2('0x6'));var csv=require(_0xdda2('0x7'));var ejs=require(_0xdda2('0x8'));var fs=require('fs');var fs_extra=require(_0xdda2('0x9'));var _=require(_0xdda2('0xa'));var squel=require(_0xdda2('0xb'));var crypto=require(_0xdda2('0xc'));var jsforce=require(_0xdda2('0xd'));var deskjs=require(_0xdda2('0xe'));var toCsv=require('to-csv');var querystring=require(_0xdda2('0xf'));var Papa=require(_0xdda2('0x10'));var Redis=require('ioredis');var authService=require(_0xdda2('0x11'));var qs=require(_0xdda2('0x12'));var as=require(_0xdda2('0x13'));var pdf=require(_0xdda2('0x14'));var hardwareService=require(_0xdda2('0x15'));var logger=require(_0xdda2('0x16'))(_0xdda2('0x17'));var utils=require(_0xdda2('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0xdda2('0x19')]=_[_0xdda2('0x1a')](config[_0xdda2('0x19')],{'host':_0xdda2('0x1b'),'port':0x18eb});var socket=require(_0xdda2('0x1c'))(new Redis(config[_0xdda2('0x19')]));require(_0xdda2('0x1d'))['register'](socket);var jayson=require(_0xdda2('0x1e'));var client=jayson['client'][_0xdda2('0x1f')]({'port':0x232b});var client9004=jayson[_0xdda2('0x20')][_0xdda2('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x457764,_0x1922b1,_0x5d8a83,_0x55d674){return new BPromise(function(_0x43f67b,_0x518c6d){var _0x1a5192=_0x55d674||client;return _0x1a5192[_0xdda2('0x21')](_0x457764,_0x5d8a83)[_0xdda2('0x22')](function(_0x2b6ee8){logger[_0xdda2('0x23')](_0xdda2('0x24'),_0x1922b1,_0xdda2('0x25'));logger[_0xdda2('0x26')](_0xdda2('0x27'),_0x1922b1,_0xdda2('0x25'),JSON[_0xdda2('0x28')](_0x2b6ee8));if(_0x2b6ee8[_0xdda2('0x29')]){if(_0x2b6ee8['error'][_0xdda2('0x2a')]===0x1f4){logger['error'](_0xdda2('0x24'),_0x1922b1,_0x2b6ee8[_0xdda2('0x29')][_0xdda2('0x2b')]);return _0x518c6d(_0x2b6ee8['error'][_0xdda2('0x2b')]);}logger['error'](_0xdda2('0x24'),_0x1922b1,_0x2b6ee8[_0xdda2('0x29')]['message']);return _0x43f67b(_0x2b6ee8[_0xdda2('0x29')][_0xdda2('0x2b')]);}else{logger[_0xdda2('0x23')](_0xdda2('0x24'),_0x1922b1,_0xdda2('0x25'));_0x43f67b(_0x2b6ee8['result'][_0xdda2('0x2b')]);}})[_0xdda2('0x2c')](function(_0x2391a5){logger[_0xdda2('0x29')]('ChatInteraction,\x20%s,\x20%s',_0x1922b1,_0x2391a5);_0x518c6d(_0x2391a5);});});}function respondWithStatusCode(_0x4e97dc,_0x28da54){_0x28da54=_0x28da54||0xcc;return function(_0x4567e7){if(_0x4567e7){return _0x4e97dc[_0xdda2('0x2d')](_0x28da54);}return _0x4e97dc['status'](_0x28da54)[_0xdda2('0x2e')]();};}function respondWithResult(_0x5d26ae,_0x2e755b){_0x2e755b=_0x2e755b||0xc8;return function(_0xe53dee){if(_0xe53dee){return _0x5d26ae[_0xdda2('0x2f')](_0x2e755b)[_0xdda2('0x30')](_0xe53dee);}};}function respondWithFilteredResult(_0x4bb8a4,_0x24c37d){return function(_0x255bbc){if(_0x255bbc){var _0x53acb5=typeof _0x24c37d[_0xdda2('0x31')]===_0xdda2('0x32')&&typeof _0x24c37d[_0xdda2('0x33')]===_0xdda2('0x32');var _0x5540e5=_0x255bbc[_0xdda2('0x34')];var _0x5e107f=_0x53acb5?0x0:_0x24c37d['offset'];var _0x1ca9f3=_0x53acb5?_0x255bbc['count']:_0x24c37d[_0xdda2('0x31')]+_0x24c37d['limit'];var _0x53ff76;if(_0x1ca9f3>=_0x5540e5){_0x1ca9f3=_0x5540e5;_0x53ff76=0xc8;}else{_0x53ff76=0xce;}_0x4bb8a4['status'](_0x53ff76);return _0x4bb8a4[_0xdda2('0x35')]('Content-Range',_0x5e107f+'-'+_0x1ca9f3+'/'+_0x5540e5)[_0xdda2('0x30')](_0x255bbc);}return null;};}function patchUpdates(_0x508664){return function(_0x5cba58){try{jsonpatch['apply'](_0x5cba58,_0x508664,!![]);}catch(_0x4637c1){return BPromise[_0xdda2('0x36')](_0x4637c1);}return _0x5cba58[_0xdda2('0x37')]();};}function saveUpdates(_0x2fd592,_0x12e96d){return function(_0x644a24){if(_0x644a24){return _0x644a24[_0xdda2('0x38')](_0x2fd592)[_0xdda2('0x22')](function(_0x3cddbd){return _0x3cddbd;});}return null;};}function removeEntity(_0x2bcf47,_0x4a32ea){return function(_0x461621){if(_0x461621){return _0x461621[_0xdda2('0x39')]()[_0xdda2('0x22')](function(){_0x2bcf47[_0xdda2('0x2f')](0xcc)[_0xdda2('0x2e')]();});}};}function handleEntityNotFound(_0x33c4b0,_0x45d3ad){return function(_0x5835cd){if(!_0x5835cd){_0x33c4b0['sendStatus'](0x194);}return _0x5835cd;};}function handleError(_0xa03f5,_0x1cf553){_0x1cf553=_0x1cf553||0x1f4;return function(_0x40eb19){logger['error'](_0x40eb19['stack']);if(_0x40eb19[_0xdda2('0x3a')]){delete _0x40eb19[_0xdda2('0x3a')];}_0xa03f5[_0xdda2('0x2f')](_0x1cf553)[_0xdda2('0x3b')](_0x40eb19);};}function getMustacheRender(_0x246001,_0x5ab419){return Mustache[_0xdda2('0x3c')](_0x246001,_[_0xdda2('0x3d')](_0x5ab419['body'],{'contact':_0x5ab419['contact'],'message':_0x5ab419[_0xdda2('0x2b')],'agent':_0x5ab419[_0xdda2('0x3e')],'interaction':_0x5ab419[_0xdda2('0x3f')],'account':_0x5ab419[_0xdda2('0x40')]}))||'';}function getInteractionUsers(_0x20969d,_0x585eba){return new BPromise(function(_0x2e7847,_0x226de2){try{if(_0x585eba[_0x20969d['id']]){_0x20969d[_0xdda2('0x41')]=_[_0xdda2('0x42')](_0x585eba[_0x20969d['id']],function(_0x50c4ae){return{'id':_0x50c4ae['id'],'fullname':_0x50c4ae['fullname']};});}}catch(_0x203972){_0x226de2(_0x203972);}_0x2e7847(_0x20969d);});}function getInteractionTags(_0x2e0524,_0x7a25fe){return new BPromise(function(_0x5a92e9,_0x1bb2a7){try{if(_0x2e0524['TagIds']){_0x2e0524[_0xdda2('0x43')]=[];_0x2e0524['TagIds'][_0xdda2('0x44')](',')[_0xdda2('0x45')](function(_0x1db762){_0x2e0524[_0xdda2('0x43')]['push'](_0x7a25fe[_0x1db762]);});}delete _0x2e0524[_0xdda2('0x46')];}catch(_0x574f8f){_0x1bb2a7(_0x574f8f);}_0x5a92e9(_0x2e0524);});}function updateChatInteraction(_0x392f70,_0x4d3b78,_0x1d1678){return new BPromise(function(_0x12589b,_0x153acf){return getInteractionUsers(_0x392f70,_0x1d1678)[_0xdda2('0x22')](function(_0x38dc03){return getInteractionTags(_0x38dc03,_0x4d3b78);})['then'](function(_0x1e29dc){_0x12589b(_0x1e29dc);})[_0xdda2('0x2c')](function(_0x54735b){_0x153acf(_0x54735b);});});}exports[_0xdda2('0x47')]=function(_0x546847,_0x292e70){var _0x45c802={},_0x1741a0={},_0x355b6a={'count':0x0,'rows':[]};var _0x3f1f9b=_[_0xdda2('0x42')](db[_0xdda2('0x48')][_0xdda2('0x49')],function(_0xff55){return{'name':_0xff55[_0xdda2('0x4a')],'type':_0xff55[_0xdda2('0x4b')][_0xdda2('0x4c')]};});_0x1741a0[_0xdda2('0x4d')]=_['map'](_0x3f1f9b,'name');_0x1741a0['query']=_[_0xdda2('0x4e')](_0x546847[_0xdda2('0x4f')]);_0x1741a0['filters']=_[_0xdda2('0x50')](_0x1741a0[_0xdda2('0x4d')],_0x1741a0[_0xdda2('0x4f')]);_0x45c802['attributes']=_[_0xdda2('0x50')](_0x1741a0[_0xdda2('0x4d')],qs['fields'](_0x546847['query'][_0xdda2('0x51')]));_0x45c802['attributes']=_0x45c802[_0xdda2('0x52')]['length']?_0x45c802[_0xdda2('0x52')]:_0x1741a0[_0xdda2('0x4d')];if(!_0x546847['query']['hasOwnProperty'](_0xdda2('0x53'))){_0x45c802[_0xdda2('0x33')]=qs[_0xdda2('0x33')](_0x546847[_0xdda2('0x4f')]['limit']);_0x45c802[_0xdda2('0x31')]=qs[_0xdda2('0x31')](_0x546847[_0xdda2('0x4f')][_0xdda2('0x31')]);}_0x45c802[_0xdda2('0x54')]=qs['sort'](_0x546847[_0xdda2('0x4f')][_0xdda2('0x55')]);_0x45c802['where']=qs[_0xdda2('0x56')](_[_0xdda2('0x57')](_0x546847[_0xdda2('0x4f')],_0x1741a0[_0xdda2('0x56')]),_0x3f1f9b);var _0x161d7b=[];var _0x265169=squel['select']()[_0xdda2('0x58')]('id')['field'](_0xdda2('0x3a'))['field'](_0xdda2('0x59'))['from'](_0xdda2('0x5a'));var _0x11c8b1=squel[_0xdda2('0x5b')]()[_0xdda2('0x58')](_0xdda2('0x5c'))[_0xdda2('0x58')](_0xdda2('0x5d'))[_0xdda2('0x58')]('ui.ChatInteractionId')[_0xdda2('0x5e')](_0xdda2('0x5f'),'ui')[_0xdda2('0x60')]('users','u',_0xdda2('0x61'));var _0x1c2d24=squel['select']()[_0xdda2('0x5e')]('chat_interactions','i')[_0xdda2('0x60')](_0xdda2('0x62'),'c',_0xdda2('0x63'))[_0xdda2('0x60')](_0xdda2('0x64'),'o','o.id\x20=\x20i.UserId')['left_join']('chat_websites','a',_0xdda2('0x65'))[_0xdda2('0x60')]('chat_messages','me',_0xdda2('0x66'))[_0xdda2('0x60')](_0xdda2('0x67'),'it','it.ChatInteractionId\x20=\x20i.id')[_0xdda2('0x60')](_0xdda2('0x5a'),'t',_0xdda2('0x68'));var _0x58ae15=squel[_0xdda2('0x69')]();var _0x4495e5=[];var _0x7eb83f=squel[_0xdda2('0x69')]();var _0x5d8602;if(_0x546847[_0xdda2('0x4f')]['search']){_0x5d8602=as['parseSearch'](_0x546847['query'][_0xdda2('0x6a')]);var _0x35b38a=_0x5d8602[_0xdda2('0x6b')];for(var _0x433cb0=0x0;_0x433cb0<_0x5d8602[_0xdda2('0x6c')][_0xdda2('0x6d')];_0x433cb0++){var _0x29a739=_0x5d8602[_0xdda2('0x6c')][_0x433cb0];var _0x269ad1='i';var _0x138c2f=_[_0xdda2('0x6e')](_0x3f1f9b,['name',_0x29a739[_0xdda2('0x58')]]);if(!_0x138c2f){switch(_0x29a739[_0xdda2('0x58')]){case _0xdda2('0x6f'):if(_0x29a739[_0xdda2('0x70')]==0x1){_0x1c2d24[_0xdda2('0x71')]('`'+_0x29a739[_0xdda2('0x58')]+_0xdda2('0x72'));}else{_0x1c2d24['having']('`'+_0x29a739[_0xdda2('0x58')]+_0xdda2('0x73'));}break;case _0xdda2('0x74'):if(_0x29a739[_0xdda2('0x75')]===_0xdda2('0x76')){if(_0x29a739['value'][_0xdda2('0x44')]('\x20')[_0xdda2('0x6d')]>0x1){_0x58ae15[_0x35b38a](_0xdda2('0x77'),qs[_0xdda2('0x78')](_0x29a739[_0xdda2('0x70')]),null);}else{var _0x4a6f28='%'+_0x29a739[_0xdda2('0x70')]+'%';_0x58ae15[_0x35b38a](_0xdda2('0x79'),_0x4a6f28,_0x4a6f28,_0x4a6f28);}}else{_0x138c2f=_[_0xdda2('0x6e')](_0x3f1f9b,[_0xdda2('0x3a'),_0xdda2('0x7a')]);_0x29a739['field']=_0xdda2('0x7a');_0x27780e=as[_0xdda2('0x7b')](_0x269ad1,_0x138c2f[_0xdda2('0x4b')],_0x29a739);_0x58ae15[_0x35b38a](_0x27780e['text'],_0x27780e[_0xdda2('0x70')]['start'],_0x27780e[_0xdda2('0x70')][_0xdda2('0x2e')]);}break;case _0xdda2('0x7c'):var _0x5c351c=_0x29a739[_0xdda2('0x70')][_0xdda2('0x44')](',')['map'](function(_0x13c0d9){return Number(_0x13c0d9);});_0x5c351c['forEach'](function(_0x3d645b){_0x7eb83f['or'](_0xdda2('0x7d'),'%,'+_0x3d645b+',%');});_0x4495e5=_[_0xdda2('0x7e')](_0x4495e5,_0x5c351c);break;case _0xdda2('0x7f'):if(_0x29a739[_0xdda2('0x75')]==='$substring'){_0x58ae15[_0x35b38a]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x29a739[_0xdda2('0x70')]+'%',null);}else{_0x138c2f=_[_0xdda2('0x6e')](_0x3f1f9b,['name','UserId']);_0x29a739[_0xdda2('0x58')]='UserId';_0x27780e=as[_0xdda2('0x7b')](_0x269ad1,_0x138c2f[_0xdda2('0x4b')],_0x29a739);_0x58ae15[_0x35b38a](_0x27780e['text'],_0x27780e[_0xdda2('0x70')][_0xdda2('0x80')],_0x27780e[_0xdda2('0x70')][_0xdda2('0x2e')]);}break;case _0xdda2('0x81'):_0x27780e=as[_0xdda2('0x7b')]('me',null,_0x29a739);_0x58ae15[_0x35b38a](_0x27780e['text'],_0x27780e[_0xdda2('0x70')][_0xdda2('0x80')],_0x27780e[_0xdda2('0x70')]['end']);break;}}else{var _0x27780e=as[_0xdda2('0x7b')](_0x269ad1,_0x138c2f['type'],_0x29a739);_0x58ae15[_0x35b38a](_0x27780e['text'],_0x27780e[_0xdda2('0x70')][_0xdda2('0x80')],_0x27780e[_0xdda2('0x70')]['end']);}}}else{var _0x585a72=_(_0x546847[_0xdda2('0x4f')])['keys']()[_0xdda2('0x42')](function(_0x150dcd){return _[_0xdda2('0x82')](_0x3f1f9b,[_0xdda2('0x3a'),_0x150dcd])?_0x150dcd:undefined;})[_0xdda2('0x83')]()[_0xdda2('0x70')]();if(!_['isEmpty'](_0x585a72)){_0x585a72['forEach'](function(_0x218b96){if(_0x218b96==='ChatWebsiteId'){_0x1c2d24[_0xdda2('0x84')](_0xdda2('0x85'),[][_0xdda2('0x86')](_0x546847[_0xdda2('0x4f')][_0x218b96]));}else if(_0x218b96===_0xdda2('0x87')){var _0x104024=JSON[_0xdda2('0x88')](_0x546847[_0xdda2('0x4f')][_0x218b96])[_0xdda2('0x89')];var _0x495a28=JSON[_0xdda2('0x88')](_0x546847[_0xdda2('0x4f')][_0x218b96])[_0xdda2('0x8a')];_0x1c2d24[_0xdda2('0x84')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x104024,_0x495a28);}else{if(_0x546847[_0xdda2('0x4f')][_0x218b96]===_0xdda2('0x8b')){_0x1c2d24[_0xdda2('0x84')]('i.'+_0x218b96+_0xdda2('0x8c'));}else{_0x1c2d24['where']('i.'+_0x218b96+'\x20=\x20?',_0x546847[_0xdda2('0x4f')][_0x218b96]);}}});}if(_0x546847[_0xdda2('0x4f')][_0xdda2('0x8d')]){if(_0x546847[_0xdda2('0x4f')]['read']==0x1){_0x1c2d24[_0xdda2('0x71')](_0xdda2('0x8e'));}else{_0x1c2d24[_0xdda2('0x71')](_0xdda2('0x8f'));}}if(_0x546847[_0xdda2('0x4f')][_0xdda2('0x90')]){_0x4495e5=_[_0xdda2('0x91')](_0x546847[_0xdda2('0x4f')][_0xdda2('0x90')])?_0x546847[_0xdda2('0x4f')][_0xdda2('0x90')]:new Array(_0x546847[_0xdda2('0x4f')][_0xdda2('0x90')]);_0x4495e5[_0xdda2('0x45')](function(_0x2411e8){_0x7eb83f['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x2411e8+',%');});}if(_0x546847[_0xdda2('0x4f')][_0xdda2('0x92')]){var _0x58fcea=_0x546847['query'][_0xdda2('0x92')][_0xdda2('0x93')]('\x5c','\x5c\x5c')[_0xdda2('0x93')](/'/g,'\x27\x27');if(qs[_0xdda2('0x94')](_0x58fcea)){_0x58ae15['or'](_0xdda2('0x95'),_0x58fcea+'%');}else{_0x58ae15['or'](_0xdda2('0x96'),qs['getFullTextValue'](_0x58fcea))['or'](_0xdda2('0x97'),_0x58fcea+'%');}}}_0x1c2d24[_0xdda2('0x84')](_0x58ae15);_0x1c2d24[_0xdda2('0x98')](_0xdda2('0x99'));var _0x563be8={'type':db[_0xdda2('0x9a')]['QueryTypes'][_0xdda2('0x9b')],'raw':!![]};var _0x6b6dad=_0x1c2d24['clone']();_0x6b6dad[_0xdda2('0x58')](_0xdda2('0x99'));_0x6b6dad[_0xdda2('0x58')](_0xdda2('0x9c'),_0xdda2('0x6f'));if(_0x45c802[_0xdda2('0x54')]){_0x45c802[_0xdda2('0x54')][_0xdda2('0x45')](function(_0x3a375d){var _0x3e82bb=_0x3a375d[0x0]===_0xdda2('0x9d')?_0x3a375d[0x0]:'i.'+_0x3a375d[0x0];_0x1c2d24['order'](_0x3e82bb,_0x3a375d[0x1]===_0xdda2('0x9e')?![]:!![]);});}if(!_[_0xdda2('0x9f')](_0x4495e5)){_0x1c2d24[_0xdda2('0x71')](_0x7eb83f);_0x6b6dad[_0xdda2('0x84')](_0xdda2('0xa0'),_0x4495e5);}BPromise['resolve']()[_0xdda2('0x22')](function(){if(!_0x5d8602){if(_0x546847[_0xdda2('0x4f')]['ChatWebsiteId'])return;_0x6b6dad[_0xdda2('0x84')](_0xdda2('0xa1'));_0x1c2d24['where']('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');return;}if(_0x546847[_0xdda2('0xa2')][_0xdda2('0xa3')]!==_0xdda2('0x3e'))return;return _0x546847[_0xdda2('0xa2')][_0xdda2('0xa4')]({'attributes':['id'],'raw':!![]})[_0xdda2('0x22')](function(_0x525e93){if(_[_0xdda2('0x9f')](_0x525e93)){_0x6b6dad[_0xdda2('0x84')]('i.ChatWebsiteId\x20IS\x20NULL');_0x1c2d24[_0xdda2('0x84')](_0xdda2('0xa5'));}else{_0x6b6dad['where'](_0xdda2('0x85'),_[_0xdda2('0x42')](_0x525e93,'id'));_0x1c2d24[_0xdda2('0x84')]('i.ChatWebsiteId\x20IN\x20?',_[_0xdda2('0x42')](_0x525e93,'id'));}});})['then'](function(){if(_0x546847[_0xdda2('0xa2')][_0xdda2('0xa3')]===_0xdda2('0x3e')&&!_0x5d8602&&!_0x546847[_0xdda2('0x4f')]['ChatWebsiteId'])return[];return db['sequelize'][_0xdda2('0x4f')](_0x6b6dad[_0xdda2('0xa6')](),_0x563be8);})['then'](function(_0x468e32){_0x355b6a[_0xdda2('0x34')]=_0x468e32[_0xdda2('0x6d')];if(_0x355b6a[_0xdda2('0x34')]===0x0)return[];return db[_0xdda2('0xa7')][_0xdda2('0x4f')](_0x265169[_0xdda2('0xa6')](),_0x563be8)[_0xdda2('0x22')](function(_0x3046c1){_0x161d7b=_[_0xdda2('0xa8')](_0x3046c1,'id');_0x563be8=_[_0xdda2('0x3d')](_0x563be8,{'model':db[_0xdda2('0x48')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x546847['query']['fields']){_0x45c802['attributes'][_0xdda2('0x45')](function(_0x4edf20){_0x1c2d24[_0xdda2('0x58')]('i.'+_0x4edf20);});}else{_0x1c2d24[_0xdda2('0x58')](_0xdda2('0x9c'),_0xdda2('0x6f'));_0x1c2d24['field'](_0xdda2('0xa9'),_0xdda2('0xaa'));_0x1c2d24[_0xdda2('0x58')]('a.mandatoryDisposition',_0xdda2('0xab'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xac'),'contactName');_0x1c2d24['field'](_0xdda2('0xad'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xae'),'Contact.firstName');_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xaf'),_0xdda2('0xb0'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xb1'),_0xdda2('0xb2'));_0x1c2d24[_0xdda2('0x58')]('c.phone',_0xdda2('0xb3'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xb4'),_0xdda2('0xb5'));_0x1c2d24['field'](_0xdda2('0xb6'),_0xdda2('0xb7'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xb8'),'Owner.fullname');_0x1c2d24['field']('o.internal',_0xdda2('0xb9'));_0x1c2d24[_0xdda2('0x58')](_0xdda2('0xba'),_0xdda2('0x46'));}if(_0x45c802[_0xdda2('0x33')])_0x1c2d24[_0xdda2('0x33')](_0x45c802['limit']);if(_0x45c802[_0xdda2('0x31')])_0x1c2d24[_0xdda2('0x31')](_0x45c802[_0xdda2('0x31')]);return db[_0xdda2('0xa7')][_0xdda2('0x4f')](_0x1c2d24[_0xdda2('0xa6')](),_0x563be8);})[_0xdda2('0x22')](function(_0xbfd011){if(_0xbfd011['length']>0x0)_0x11c8b1[_0xdda2('0x84')]('ui.ChatInteractionId\x20IN\x20?',_[_0xdda2('0x42')](_0xbfd011,'id'));return db['sequelize'][_0xdda2('0x4f')](_0x11c8b1['toString'](),_0x563be8)[_0xdda2('0x22')](function(_0x31e555){var _0x329d18=_[_0xdda2('0xbb')](_0x31e555,_0xdda2('0xbc'));var _0x18a102=[];_0xbfd011[_0xdda2('0x45')](function(_0x28ba40){_0x18a102[_0xdda2('0xbd')](updateChatInteraction(_0x28ba40,_0x161d7b,_0x329d18));});return BPromise['all'](_0x18a102);});});})[_0xdda2('0x22')](function(_0x434d79){_0x355b6a['rows']=_0x434d79;return _0x355b6a;})[_0xdda2('0x22')](respondWithFilteredResult(_0x292e70,_0x45c802))[_0xdda2('0x2c')](handleError(_0x292e70,null));};exports[_0xdda2('0xbe')]=function(_0x5600da,_0x1702ae){var _0x21ade3={'raw':![],'where':{'id':_0x5600da[_0xdda2('0xbf')]['id']}},_0x251408={};_0x251408[_0xdda2('0x4d')]=_[_0xdda2('0x4e')](db[_0xdda2('0x48')][_0xdda2('0x49')]);_0x251408[_0xdda2('0x4f')]=_[_0xdda2('0x4e')](_0x5600da['query']);_0x251408[_0xdda2('0x56')]=_[_0xdda2('0x50')](_0x251408[_0xdda2('0x4d')],_0x251408[_0xdda2('0x4f')]);_0x21ade3[_0xdda2('0x52')]=_['intersection'](_0x251408[_0xdda2('0x4d')],qs[_0xdda2('0x51')](_0x5600da[_0xdda2('0x4f')]['fields']));_0x21ade3[_0xdda2('0x52')]=_0x21ade3[_0xdda2('0x52')][_0xdda2('0x6d')]?_0x21ade3['attributes']:_0x251408[_0xdda2('0x4d')];if(_0x5600da['query']['includeAll']){_0x21ade3[_0xdda2('0xc0')]=[{'all':!![]}];}_0x21ade3=_[_0xdda2('0x3d')]({},_0x21ade3,_0x5600da[_0xdda2('0xc1')]);return db[_0xdda2('0x48')][_0xdda2('0x6e')](_0x21ade3)[_0xdda2('0x22')](handleEntityNotFound(_0x1702ae,null))[_0xdda2('0x22')](respondWithResult(_0x1702ae,null))['catch'](handleError(_0x1702ae,null));};exports['create']=function(_0x3aab39,_0x1c1cf6){return db[_0xdda2('0x48')][_0xdda2('0xc2')](_0x3aab39[_0xdda2('0x81')],{})['then'](respondWithResult(_0x1c1cf6,0xc9))[_0xdda2('0x2c')](handleError(_0x1c1cf6,null));};exports[_0xdda2('0x38')]=function(_0x489cda,_0x233494){if(_0x489cda[_0xdda2('0x81')]['id']){delete _0x489cda[_0xdda2('0x81')]['id'];}return db[_0xdda2('0x48')][_0xdda2('0x6e')]({'where':{'id':_0x489cda[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x233494,null))[_0xdda2('0x22')](saveUpdates(_0x489cda[_0xdda2('0x81')],null))[_0xdda2('0x22')](respondWithResult(_0x233494,null))[_0xdda2('0x2c')](handleError(_0x233494,null));};exports[_0xdda2('0x39')]=function(_0x416993,_0x47b7a5){return db[_0xdda2('0x48')]['find']({'where':{'id':_0x416993[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x47b7a5,null))[_0xdda2('0x22')](removeEntity(_0x47b7a5,null))['catch'](handleError(_0x47b7a5,null));};exports[_0xdda2('0xc3')]=function(_0xb93d3b,_0x3d59cb){return db['ChatInteraction'][_0xdda2('0xc3')]()[_0xdda2('0x22')](respondWithResult(_0x3d59cb,null))[_0xdda2('0x2c')](handleError(_0x3d59cb,null));};exports['createVidaooSession']=function(_0x5916cb,_0x123065){var _0x5611a0=_0x5916cb[_0xdda2('0xbf')]['id'];var _0x174eb9;var _0x23b9bd;var _0x182570;return db['ChatInteraction'][_0xdda2('0xc4')]({'where':{'id':_0x5611a0}})['then'](function(_0x5a1e60){_0x174eb9=_0x5a1e60;return db['ChatWebsite']['findOne']({'where':{'id':_0x5a1e60[_0xdda2('0xc5')]},'attributes':['id','vidaooApiKey',_0xdda2('0xc6'),_0xdda2('0xc7'),'vidaooNote','vidaooMetadata'],'raw':!![]});})[_0xdda2('0x22')](function(_0x255853){if(_0x255853&&_0x255853[_0xdda2('0xc8')]&&_0x255853[_0xdda2('0xc6')]){_0x23b9bd=_0x255853;var _0x55d25d={'interaction':{'id':_0x5611a0},'agent':{'id':_0x5916cb['user']['id'],'name':_0x5916cb[_0xdda2('0xa2')][_0xdda2('0x3a')],'fullname':_0x5916cb[_0xdda2('0xa2')][_0xdda2('0xc9')],'email':_0x5916cb['user'][_0xdda2('0xca')]},'contact':_0x5916cb[_0xdda2('0x81')][_0xdda2('0xcb')],'account':_0x5916cb[_0xdda2('0x81')][_0xdda2('0x40')]};var _0x1fdc68={'rejectUnauthorized':![],'method':_0xdda2('0xcc'),'url':_0xdda2('0xcd'),'headers':{'X-APIKEY':_0x255853[_0xdda2('0xc8')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x5916cb[_0xdda2('0xa2')][_0xdda2('0xca')]],'buttons':null,'topic':_0x23b9bd[_0xdda2('0xc7')],'note':_[_0xdda2('0xce')](_0x23b9bd[_0xdda2('0xcf')])?null:getMustacheRender(_0x23b9bd[_0xdda2('0xcf')],_0x55d25d),'metadata':null},'redirect':_0xdda2('0xd0'),'json':!![]};try{if(!_['isNull'](_0x23b9bd[_0xdda2('0xd1')])){var _0x1e5460=getMustacheRender(_0x23b9bd[_0xdda2('0xd1')],_0x55d25d);var _0xa386d1=JSON[_0xdda2('0x88')](_0x1e5460);_0x1fdc68[_0xdda2('0x81')][_0xdda2('0xd2')]=_0xa386d1;}}catch(_0x1945bc){throw new db[(_0xdda2('0x9a'))][(_0xdda2('0xd3'))](_0xdda2('0xd4'));}return rp(_0x1fdc68);}else{throw new db[(_0xdda2('0x9a'))][(_0xdda2('0xd3'))](_0xdda2('0xd5'));}})[_0xdda2('0x22')](function(_0x5308f1){_0x182570=_0x5308f1;if(_0x182570['id']){var _0x17c084={'body':_0x182570[_0xdda2('0xd6')],'ChatWebsiteId':_0x23b9bd['id'],'ChatInteractionId':_0x174eb9['id'],'direction':_0xdda2('0xd7'),'UserId':_0x5916cb[_0xdda2('0xa2')]['id']};return db[_0xdda2('0xd8')][_0xdda2('0xc2')](_0x17c084,{});}else{throw new db[(_0xdda2('0x9a'))][(_0xdda2('0xd3'))](_0xdda2('0xd9'));}})[_0xdda2('0x22')](function(){return _0x174eb9['updateAttributes']({'vidaooSessionId':_0x182570['id']});})[_0xdda2('0x22')](respondWithResult(_0x123065,null))['catch'](handleError(_0x123065,null));};exports['customUpdate']=function(_0xfd249a,_0x142e6a){if(_0xfd249a[_0xdda2('0x81')]['id']){delete _0xfd249a[_0xdda2('0x81')]['id'];}return db[_0xdda2('0x48')]['find']({'where':{'id':_0xfd249a[_0xdda2('0xbf')]['id']},'include':[{'model':db[_0xdda2('0xda')],'as':_0xdda2('0x74')}]})[_0xdda2('0x22')](handleEntityNotFound(_0x142e6a,null))[_0xdda2('0x22')](saveUpdates(_0xfd249a[_0xdda2('0x81')],null))[_0xdda2('0x22')](respondWithResult(_0x142e6a,null))[_0xdda2('0x2c')](handleError(_0x142e6a,null));};exports['abandon']=function(_0x5738f9,_0x3795b2,_0x38902f){if(_0x5738f9[_0xdda2('0x81')]['id']){delete _0x5738f9['body']['id'];}return db['ChatInteraction']['find']({'where':{'id':_0x5738f9[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](function(_0x253ca6){if(!_0x253ca6){logger[_0xdda2('0x29')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0xdda2('0xdb'),0x194,'entity\x20not\x20found');_0x3795b2[_0xdda2('0x2d')](0x194);}else{if(_0x253ca6['UserId']){throw new db[(_0xdda2('0x9a'))][(_0xdda2('0xd3'))](_0xdda2('0xdc'));}}return _0x253ca6;})['then'](function(_0x335dc1){if(_0x335dc1){return _0x335dc1[_0xdda2('0x38')]({'closed':_0x5738f9[_0xdda2('0x81')]['closed'],'disposition':_0x5738f9[_0xdda2('0x81')][_0xdda2('0xdd')]})['then'](function(_0x1ec330){return _0x1ec330;});}})[_0xdda2('0x22')](function(_0x48e6e6){return respondWithRpcPromise('AbandonInteraction','abandon',_0x5738f9[_0xdda2('0x81')],client9004);})['then'](respondWithResult(_0x3795b2,null))['catch'](handleError(_0x3795b2,null));};exports[_0xdda2('0xde')]=function(_0x4444b4,_0x2279f8,_0x40e6a9){_0x4444b4[_0xdda2('0x81')][_0xdda2('0x3a')]=_0x4444b4['file']['originalname'];_0x4444b4[_0xdda2('0x81')]['basename']=_0x4444b4[_0xdda2('0xdf')][_0xdda2('0xe0')];_0x4444b4[_0xdda2('0x81')][_0xdda2('0x4b')]=_0x4444b4[_0xdda2('0xdf')][_0xdda2('0xe1')];return db['Attachment'][_0xdda2('0xc2')](_0x4444b4['body'])[_0xdda2('0x22')](respondWithResult(_0x2279f8,0xc9))[_0xdda2('0x2c')](handleError(_0x2279f8,null));};exports[_0xdda2('0xe2')]=function(_0x245ab5,_0x1001ce,_0x343795){return db[_0xdda2('0x48')][_0xdda2('0xc4')]({'where':{'id':_0x245ab5[_0xdda2('0xbf')]['id']},'raw':!![]})[_0xdda2('0x22')](handleEntityNotFound(_0x1001ce,null))[_0xdda2('0x22')](function(_0x3fb6a2){if(_0x3fb6a2){if(_0x3fb6a2[_0xdda2('0xe3')]){return _0x1001ce[_0xdda2('0x2f')](0x193)[_0xdda2('0x30')]({'status':0x193,'message':_0xdda2('0xe4')});}return db['Attachment'][_0xdda2('0xc4')]({'where':{'id':_0x245ab5[_0xdda2('0x4f')][_0xdda2('0xe5')]},'raw':!![]})[_0xdda2('0x22')](handleEntityNotFound(_0x1001ce,null));}})[_0xdda2('0x22')](function(_0xb42ead){if(_0xb42ead){var _0x29aa4e=_0xb42ead[_0xdda2('0xe6')]!==null;var _0xb38883=path[_0xdda2('0xe7')](config['root'],'server/files/attachments/');if(_0x29aa4e){_0xb38883=path['join'](_0xb38883,_0xdda2('0xe8'));}var _0x447793=path['join'](_0xb38883,_0xb42ead[_0xdda2('0xe9')]);return _0x1001ce[_0xdda2('0xea')](_0x447793);}})[_0xdda2('0x2c')](handleError(_0x1001ce,null));};exports[_0xdda2('0xeb')]=function(_0x105176,_0x1b4d6c){var _0x4aecf6=null;var _0x11d373=null;var _0x5898cf=null;var _0x319929=null;if(_0x105176[_0xdda2('0x81')]['id']){delete _0x105176[_0xdda2('0x81')]['id'];}if(_0x105176['body'][_0xdda2('0xec')]){_0x319929=path[_0xdda2('0xe7')](config[_0xdda2('0xed')],_0xdda2('0xee'),util['format'](_0xdda2('0xef'),Date[_0xdda2('0xf0')]()));_0x105176[_0xdda2('0x81')][_0xdda2('0xf1')]=_0x319929;}return db[_0xdda2('0x48')]['find']({'where':{'id':_0x105176[_0xdda2('0xbf')]['id']},'include':[{'model':db['ChatMessage'],'as':_0xdda2('0xf2'),'include':[{'model':db[_0xdda2('0x7f')],'as':_0xdda2('0x7f')}]}]})['then'](handleEntityNotFound(_0x1b4d6c,null))[_0xdda2('0x22')](saveUpdates(_0x105176[_0xdda2('0x81')],null))[_0xdda2('0x22')](function(_0x1894fc){if(_0x1894fc){_0x4aecf6=_0x1894fc;return db[_0xdda2('0xf3')][_0xdda2('0x6e')]({'where':{'id':_0x4aecf6[_0xdda2('0xc5')]}});}})[_0xdda2('0x22')](function(_0x469635){if(_0x469635){_0x5898cf=_0x469635;return db[_0xdda2('0xda')][_0xdda2('0x6e')]({'where':{'id':_0x4aecf6[_0xdda2('0x7a')]}});}})[_0xdda2('0x22')](function(_0x1d2039){if(_0x1d2039){_0x11d373=_0x1d2039;if(_0x319929){var _0xee0164=null;for(var _0x58fa2a=0x1;_0x58fa2a<_0x4aecf6[_0xdda2('0xf2')]['length'];++_0x58fa2a){_0xee0164=_0x4aecf6[_0xdda2('0xf2')][_0x58fa2a];var _0xbe4ca=_0xee0164['UserId']?util[_0xdda2('0xf4')](_0xdda2('0xf5'),_0x5898cf[_0xdda2('0xf6')],_0xee0164['UserId']):'System';var _0x5c88b4=_0x105176[_0xdda2('0x81')][_0xdda2('0xf7')]||util[_0xdda2('0xf4')]('%s%d',_0xdda2('0xf8'),_0xee0164[_0xdda2('0x7a')]);switch(_0x5898cf['agentIdentifier']){case _0xdda2('0xf9'):_0xbe4ca=_0xee0164[_0xdda2('0xfa')]?util[_0xdda2('0xf4')]('%s%d',_0x5898cf[_0xdda2('0xf6')],_0xee0164[_0xdda2('0xfa')]):_0xdda2('0xfb');break;case _0xdda2('0xfc'):_0xbe4ca=_0xee0164[_0xdda2('0xfa')]?_0xee0164['User'][_0xdda2('0xfd')]||_0xee0164['User'][_0xdda2('0xc9')]:_0xdda2('0xfb');break;case _0xdda2('0xfe'):_0xbe4ca=_0xee0164['UserId']?_0xee0164['User'][_0xdda2('0xc9')]:_0xdda2('0xfb');break;default:_0xbe4ca=_0xee0164[_0xdda2('0xfa')]?util[_0xdda2('0xf4')](_0xdda2('0xf5'),_0x5898cf[_0xdda2('0xf6')],_0xee0164[_0xdda2('0xfa')]):'System';}var _0x2506bb=util[_0xdda2('0xf4')]('[%s]\x20%s:\x20%s\x0a',moment(_0xee0164[_0xdda2('0x87')])[_0xdda2('0xf4')](_0xdda2('0xff')),_0xee0164[_0xdda2('0x100')]==='in'?_0x5c88b4:_0xbe4ca,_0xee0164[_0xdda2('0x81')]);if(!_0xee0164['secret']){fs[_0xdda2('0x101')](_0x319929,_0x2506bb);}}return db[_0xdda2('0x102')][_0xdda2('0xc4')]({'where':{'service':!![]},'include':[{'model':db[_0xdda2('0x103')],'as':_0xdda2('0x104'),'raw':!![]}]});}}})['then'](function(_0x4dcc77){if(_0x4dcc77&&_0x4dcc77[_0xdda2('0x104')]&&_0x105176[_0xdda2('0x81')]){var _0xbcc6b9={'tls':{'rejectUnauthorized':![]}};if(_0x4dcc77[_0xdda2('0x104')]['service']){_0xbcc6b9['service']=_0x4dcc77[_0xdda2('0x104')][_0xdda2('0x105')];}else{_0xbcc6b9[_0xdda2('0x106')]=_0x4dcc77[_0xdda2('0x104')][_0xdda2('0x106')];_0xbcc6b9[_0xdda2('0x107')]=_0x4dcc77[_0xdda2('0x104')]['port'];_0xbcc6b9['secure']=_0x4dcc77[_0xdda2('0x104')][_0xdda2('0x108')];}if(_0x4dcc77['Smtp'][_0xdda2('0x109')]){_0xbcc6b9[_0xdda2('0x10a')]={'user':_0x4dcc77[_0xdda2('0x104')][_0xdda2('0xa2')],'pass':_0x4dcc77['Smtp'][_0xdda2('0x10b')]};}return respondWithRpcPromise(_0xdda2('0x10c'),_0xdda2('0x10d'),{'account':_0xbcc6b9,'message':{'from':util[_0xdda2('0xf4')]('\x22%s\x22\x20<%s>',_0x4dcc77[_0xdda2('0x3a')],_0x4dcc77['email']||_0x4dcc77['Smtp']['user']),'to':_0x105176[_0xdda2('0x81')][_0xdda2('0xec')],'subject':_0xdda2('0x10e'),'text':util[_0xdda2('0xf4')](_0xdda2('0x10f'),_0x105176['body'][_0xdda2('0xec')]),'attachments':[{'path':_0x319929}]}})[_0xdda2('0x22')](function(){return _0x4aecf6;})['catch'](function(_0x202a23){console[_0xdda2('0x29')](_0x202a23);});}else{return _0x4aecf6;}})[_0xdda2('0x22')](respondWithStatusCode(_0x1b4d6c,0xc8))[_0xdda2('0x2c')](handleError(_0x1b4d6c,null));};exports[_0xdda2('0x110')]=function(_0x12a7f4,_0x62b26e,_0x642b33){return db['ChatMessage']['find']({'where':{'id':_0x12a7f4[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x62b26e,null))[_0xdda2('0x22')](function(_0x2139ff){if(_0x2139ff){return _0x2139ff[_0xdda2('0x110')](_0x12a7f4[_0xdda2('0x81')][_0xdda2('0x111')],_[_0xdda2('0x112')](_0x12a7f4[_0xdda2('0x81')],[_0xdda2('0x111'),'id'])||{});}})[_0xdda2('0x22')](respondWithResult(_0x62b26e,null))['catch'](handleError(_0x62b26e,null));};exports[_0xdda2('0x113')]=function(_0x3da9e4,_0x5fa59e,_0x6280b0){var _0x228f40={'raw':![],'where':{}};var _0x27ff5d={};var _0x325be9={'count':0x0,'rows':[]};return db['ChatInteraction'][_0xdda2('0xc4')]({'where':{'id':_0x3da9e4[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x5fa59e,null))[_0xdda2('0x22')](function(_0x11db0f){if(_0x11db0f){_0x27ff5d['model']=_[_0xdda2('0x4e')](db[_0xdda2('0xd8')][_0xdda2('0x49')]);_0x27ff5d[_0xdda2('0x4f')]=_[_0xdda2('0x4e')](_0x3da9e4['query']);_0x27ff5d[_0xdda2('0x56')]=_['intersection'](_0x27ff5d['model'],_0x27ff5d[_0xdda2('0x4f')]);_0x228f40['attributes']=_[_0xdda2('0x50')](_0x27ff5d[_0xdda2('0x4d')],qs[_0xdda2('0x51')](_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x51')]));_0x228f40[_0xdda2('0x52')]=_0x228f40[_0xdda2('0x52')][_0xdda2('0x6d')]?_0x228f40[_0xdda2('0x52')]:_0x27ff5d[_0xdda2('0x4d')];if(!_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x114')](_0xdda2('0x53'))){_0x228f40[_0xdda2('0x33')]=qs[_0xdda2('0x33')](_0x3da9e4[_0xdda2('0x4f')]['limit']);_0x228f40['offset']=qs[_0xdda2('0x31')](_0x3da9e4[_0xdda2('0x4f')]['offset']);}_0x228f40[_0xdda2('0x54')]=qs[_0xdda2('0x55')](_0x3da9e4[_0xdda2('0x4f')]['sort']);_0x228f40['where']=qs[_0xdda2('0x56')](_[_0xdda2('0x57')](_0x3da9e4['query'],_0x27ff5d[_0xdda2('0x56')]));_0x228f40[_0xdda2('0x84')][_0xdda2('0xbc')]=_0x11db0f['id'];if(_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x92')]){_0x228f40[_0xdda2('0x84')]=_[_0xdda2('0x3d')](_0x228f40[_0xdda2('0x84')],{'$or':_[_0xdda2('0x42')](_0x228f40[_0xdda2('0x52')],function(_0x39a334){var _0xeedb00={};_0xeedb00[_0x39a334]={'$like':'%'+_0x3da9e4['query'][_0xdda2('0x92')]+'%'};return _0xeedb00;})});}if(_0x3da9e4['query']['$gte']){var _0x27765b=_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x89')][_0xdda2('0x44')](',');var _0x4d288d={};_0x4d288d[_0x27765b[0x0]]={'$gte':moment(_0x27765b[0x1])[_0xdda2('0xf4')](_0xdda2('0x115'))};_0x228f40[_0xdda2('0x84')]=_[_0xdda2('0x3d')](_0x228f40['where'],_0x4d288d);}_0x228f40=_['merge']({},_0x228f40,_0x3da9e4[_0xdda2('0xc1')]);return db[_0xdda2('0xd8')][_0xdda2('0x34')]({'where':_0x228f40[_0xdda2('0x84')]})[_0xdda2('0x22')](function(_0x1f8f48){_0x325be9[_0xdda2('0x34')]=_0x1f8f48;if(_0x3da9e4[_0xdda2('0x4f')][_0xdda2('0x116')]){_0x228f40[_0xdda2('0xc0')]=[{'all':!![]}];}return db[_0xdda2('0xd8')]['findAll'](_0x228f40);})[_0xdda2('0x22')](function(_0x4dbada){_0x325be9[_0xdda2('0x117')]=_0x4dbada;return _0x325be9;});}})['then'](respondWithFilteredResult(_0x5fa59e,_0x228f40))[_0xdda2('0x2c')](handleError(_0x5fa59e,null));};exports[_0xdda2('0x118')]=function(_0x25650a,_0x3410ec,_0x59441d){var _0x4948ae={'where':{}},_0x472860={},_0x32564c={'count':0x0,'rows':[]};return db[_0xdda2('0x48')][_0xdda2('0xc4')]({'where':{'id':_0x25650a['params']['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x3410ec,null))[_0xdda2('0x22')](function(_0x316316){if(_0x316316){_0x472860[_0xdda2('0x4d')]=_[_0xdda2('0x4e')](db[_0xdda2('0xd8')][_0xdda2('0x49')]);_0x472860[_0xdda2('0x4f')]=_[_0xdda2('0x4e')](_0x25650a[_0xdda2('0x4f')]);_0x472860[_0xdda2('0x56')]=_[_0xdda2('0x50')](_0x472860[_0xdda2('0x4d')],_0x472860[_0xdda2('0x4f')]);_0x4948ae['attributes']=_[_0xdda2('0x50')](_0x472860[_0xdda2('0x4d')],qs['fields'](_0x25650a[_0xdda2('0x4f')][_0xdda2('0x51')]));_0x4948ae[_0xdda2('0x52')]=_0x4948ae[_0xdda2('0x52')][_0xdda2('0x6d')]?_0x4948ae[_0xdda2('0x52')]:_0x472860['model'];if(!_0x25650a[_0xdda2('0x4f')][_0xdda2('0x114')](_0xdda2('0x53'))){_0x4948ae['limit']=qs[_0xdda2('0x33')](_0x25650a[_0xdda2('0x4f')][_0xdda2('0x33')]);_0x4948ae[_0xdda2('0x31')]=qs['offset'](_0x25650a['query']['offset']);}_0x4948ae[_0xdda2('0x54')]=qs[_0xdda2('0x55')](_0x25650a[_0xdda2('0x4f')][_0xdda2('0x55')]);_0x4948ae['where']=qs[_0xdda2('0x56')](_[_0xdda2('0x57')](_0x25650a['query'],_0x472860[_0xdda2('0x56')]));_0x4948ae[_0xdda2('0x84')]['ChatInteractionId']=_0x316316['id'];if(_0x25650a[_0xdda2('0x4f')]['filter']){_0x4948ae[_0xdda2('0x84')]=_[_0xdda2('0x3d')](_0x4948ae['where'],{'$or':_[_0xdda2('0x42')](_0x4948ae[_0xdda2('0x52')],function(_0x57cf2b){var _0x30e01c={};_0x30e01c[_0x57cf2b]={'$like':'%'+_0x25650a[_0xdda2('0x4f')]['filter']+'%'};return _0x30e01c;})});}_0x4948ae[_0xdda2('0x84')]['secret']=![];if(_0x25650a[_0xdda2('0x4f')]['id']){_0x4948ae[_0xdda2('0x84')]['id']={'$gt':_0x25650a[_0xdda2('0x4f')]['id']};}_0x4948ae=_[_0xdda2('0x3d')]({},_0x4948ae,_0x25650a[_0xdda2('0xc1')]);return db[_0xdda2('0xd8')][_0xdda2('0x34')]({'where':_0x4948ae[_0xdda2('0x84')]})['then'](function(_0x5343eb){_0x32564c[_0xdda2('0x34')]=_0x5343eb;_0x4948ae['include']=[];if(_0x25650a[_0xdda2('0x4f')]['includeAgent']){_0x4948ae['include'][_0xdda2('0xbd')]({'model':db[_0xdda2('0x7f')],'as':_0xdda2('0x7f'),'attributes':['id',_0xdda2('0xc9'),_0xdda2('0xfd')]});}if(_0x25650a[_0xdda2('0x4f')][_0xdda2('0x116')]){_0x4948ae[_0xdda2('0xc0')]=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4948ae);})[_0xdda2('0x22')](function(_0x1eb2df){_0x32564c[_0xdda2('0x117')]=_0x1eb2df;return _0x32564c;});}})[_0xdda2('0x22')](respondWithFilteredResult(_0x3410ec,_0x4948ae))[_0xdda2('0x2c')](handleError(_0x3410ec,null));};exports[_0xdda2('0x119')]=function(_0x198e16,_0x12d2a9,_0xc6dbe4){return db[_0xdda2('0x48')][_0xdda2('0x6e')]({'where':{'id':_0x198e16[_0xdda2('0xbf')]['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x12d2a9,null))['then'](function(_0xaabf31){if(_0xaabf31){return _0xaabf31[_0xdda2('0x11a')](_0x198e16[_0xdda2('0x81')][_0xdda2('0x111')],_[_0xdda2('0x112')](_0x198e16[_0xdda2('0x81')],[_0xdda2('0x111'),'id'])||{})['spread'](function(){return db[_0xdda2('0x7c')][_0xdda2('0x11b')]({'attributes':['id',_0xdda2('0x3a'),_0xdda2('0x59')],'where':{'id':_0x198e16[_0xdda2('0x81')][_0xdda2('0x111')]}});})[_0xdda2('0x22')](function(_0x39b18f){socket['emit'](_0xdda2('0x11c'),{'id':Number(_0x198e16['params']['id']),'tags':_0x39b18f||[]});return{'id':Number(_0x198e16['params']['id']),'tags':_0x39b18f||[]};});}})[_0xdda2('0x22')](respondWithResult(_0x12d2a9,null))[_0xdda2('0x2c')](handleError(_0x12d2a9,null));};exports[_0xdda2('0x11d')]=function(_0xa13c22,_0x3b8dca,_0x1bbd6e){return db[_0xdda2('0x48')][_0xdda2('0x6e')]({'where':{'id':_0xa13c22['params']['id']}})[_0xdda2('0x22')](handleEntityNotFound(_0x3b8dca,null))['then'](function(_0x4e85b0){if(_0x4e85b0){return _0x4e85b0[_0xdda2('0x11d')](_0xa13c22[_0xdda2('0x4f')][_0xdda2('0x111')]);}})[_0xdda2('0x22')](respondWithStatusCode(_0x3b8dca,null))[_0xdda2('0x2c')](handleError(_0x3b8dca,null));};exports['download']=function(_0x18d90c,_0xeae3c3){var _0x47a929=moment()[_0xdda2('0x11e')]()[_0xdda2('0xa6')]();var _0x1ebdd0=path[_0xdda2('0xe7')](config[_0xdda2('0xed')],_0xdda2('0x11f'),'files',_0xdda2('0x120'));var _0x5496df=path[_0xdda2('0xe7')](config[_0xdda2('0xed')],'server',_0xdda2('0x121'),_0xdda2('0x122'));var _0x5671bf=path['join'](_0x1ebdd0,_0x47a929);var _0x35cdcd=util['format']('transcript-%d-%s.zip',_0x18d90c['params']['id'],_0x47a929);var _0xc13cd3=path[_0xdda2('0xe7')](_0x1ebdd0,_0x35cdcd);var _0x20f56f=[];_0x20f56f[_0xdda2('0xbd')]({'model':db[_0xdda2('0x7f')],'as':'User','attributes':['id',_0xdda2('0xc9')],'raw':!![]});_0x20f56f[_0xdda2('0xbd')]({'model':db[_0xdda2('0xda')],'as':_0xdda2('0x74'),'attributes':['id',_0xdda2('0x123'),_0xdda2('0x124')],'raw':!![]});if(_0x18d90c[_0xdda2('0x4f')]['attachments']){_0x20f56f['push']({'model':db[_0xdda2('0x125')],'as':_0xdda2('0x125'),'raw':!![]});}var _0x749b15=[{'model':db[_0xdda2('0xd8')],'as':_0xdda2('0xf2'),'attributes':['id',_0xdda2('0x81'),_0xdda2('0x87'),_0xdda2('0x100'),'secret','read'],'include':_0x20f56f}];_0x749b15['push']({'model':db[_0xdda2('0xf3')],'as':_0xdda2('0x126'),'attributes':['id',_0xdda2('0x3a')]});_0x749b15[_0xdda2('0xbd')]({'model':db[_0xdda2('0x7f')],'as':_0xdda2('0x127'),'attributes':['id','fullname']});return db[_0xdda2('0x48')][_0xdda2('0x6e')]({'where':{'id':_0x18d90c['params']['id']},'include':_0x749b15})[_0xdda2('0x22')](handleEntityNotFound(_0xeae3c3,null))[_0xdda2('0x22')](function(_0x50b325){if(_0x50b325){var _0x35ea7f=_0x50b325[_0xdda2('0x128')]({'plain':!![]});fs['mkdirSync'](_0x5671bf);var _0x10719d={'channel':_0xdda2('0x129'),'account':_0x35ea7f[_0xdda2('0x126')]['name'],'agent':_0x35ea7f[_0xdda2('0x127')]?_0x35ea7f[_0xdda2('0x127')][_0xdda2('0xc9')]:_0xdda2('0x12a'),'createdAt':moment(_0x35ea7f[_0xdda2('0x87')])[_0xdda2('0xf4')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdda2('0xa6')](),'closedAt':_0x35ea7f[_0xdda2('0xe3')]?moment(_0x35ea7f['closedAt'])[_0xdda2('0xf4')](_0xdda2('0x115'))['toString']():'','disposition':_0x35ea7f[_0xdda2('0xdd')],'chatInfo':{'browser':_0x35ea7f[_0xdda2('0x12b')],'os':_0x35ea7f[_0xdda2('0x12c')],'referer':_0x35ea7f[_0xdda2('0x12d')],'customerIp':_0x35ea7f[_0xdda2('0x12e')],'customerPort':_0x35ea7f[_0xdda2('0x12f')]?_0x35ea7f[_0xdda2('0x12f')]:_0xdda2('0x12a')},'messages':_(_0x35ea7f[_0xdda2('0xf2')])[_0xdda2('0x130')]()[_0xdda2('0x92')]({'secret':![]})[_0xdda2('0x42')](function(_0x57f1ad){if(_0x57f1ad[_0xdda2('0x125')]){var _0x8fa72e=path[_0xdda2('0xe7')](_0x5496df,_0x57f1ad['Attachment']['basename']);if(fs[_0xdda2('0x131')](_0x8fa72e)){fs[_0xdda2('0x132')](_0x8fa72e)['pipe'](fs['createWriteStream'](path[_0xdda2('0xe7')](_0x5671bf,_0x57f1ad['Attachment'][_0xdda2('0xe9')])));}}return{'date':moment(_0x57f1ad[_0xdda2('0x87')])['format'](_0xdda2('0x115'))[_0xdda2('0xa6')](),'sender':_0x57f1ad[_0xdda2('0x100')]===_0xdda2('0xd7')?_0x57f1ad[_0xdda2('0x7f')]?_0x57f1ad[_0xdda2('0x7f')]['fullname']:'System':_0x57f1ad[_0xdda2('0x74')][_0xdda2('0x123')]+(_0x57f1ad[_0xdda2('0x74')][_0xdda2('0x124')]?'\x20'+_0x57f1ad[_0xdda2('0x74')][_0xdda2('0x124')]:''),'body':_0x57f1ad[_0xdda2('0x125')]?_0x57f1ad[_0xdda2('0x125')][_0xdda2('0xe9')]:_0x57f1ad[_0xdda2('0x81')],'direction':_0x57f1ad[_0xdda2('0x100')]===_0xdda2('0xd7')?'A':'C','secret':_0x57f1ad['secret'],'read':_0x57f1ad[_0xdda2('0x8d')],'attachment':_0x57f1ad[_0xdda2('0x125')]};})['value']()};return ejs[_0xdda2('0x133')](path['join'](config[_0xdda2('0xed')],_0xdda2('0x11f'),_0xdda2('0x134'),_0xdda2('0x135')),{'interaction':_0x10719d})[_0xdda2('0x22')](function(_0x3d8f28){var _0x1826a9=path['join'](_0x5671bf,'transcript-'+_0x35ea7f['id']+'-'+_0x47a929+_0xdda2('0x136'));var _0x20b702={'path':_0x1826a9,'channel':_0xdda2('0x129'),'interactionId':_0x35ea7f['id']};return pdf[_0xdda2('0x137')](_0x3d8f28,_0x20b702);})[_0xdda2('0x22')](function(){return new BPromise(function(_0xf9ca6e,_0x3eb4b7){zipdir(_0x5671bf,{'saveTo':_0xc13cd3},function(_0x5eb398,_0x315585){if(_0x5eb398)return _0x3eb4b7(_0x5eb398);return _0xf9ca6e(_0x315585);});})['then'](function(){return new BPromise(function(_0x4f20d3,_0x1685e4){rimraf(_0x5671bf,function(_0x5dbd5d){if(_0x5dbd5d)_0x1685e4(_0x5dbd5d);return _0x4f20d3();});});})['then'](function(){return _0xeae3c3['download'](_0xc13cd3,_0x35cdcd,function(_0x43c68a){if(_0x43c68a){console['log'](_0xdda2('0x138'),_0x43c68a);}else{fs[_0xdda2('0x139')](_0xc13cd3);}});});});}else{return _0xeae3c3['sendStatus'](0xc8);}})[_0xdda2('0x2c')](handleError(_0xeae3c3,null));}; \ No newline at end of file +var _0x14a0=['t.id\x20IN\x20?','resolve','i.ChatWebsiteId\x20IS\x20NOT\x20NULL','user','getChatWebsites','i.ChatWebsiteId\x20IS\x20NULL','role','sequelize','toString','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.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','contactName','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','Contact.phone','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','ChatInteractionId','rows','show','params','intersection','includeAll','include','options','create','describe','findOne','ChatWebsite','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooNote','vidaooMetadata','email','POST','https://api-vidaoo.xcally.com/api/v1/meetings','isNull','follow','metadata','ValidationError','Error\x20in\x20Vidaoo\x20configuration','join_url','customUpdate','CmContact','Contact','abandon','closed','disposition','AbandonInteraction','file','originalname','basename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','join','root','server/files/attachments/','offline-chat/','download','server/files/chat/upload/','transcript-%s.txt','now','ChatMessage','Messages','format','agentAlias','System','customer','agentIdentifier','%s%d','agent_alias','alias','agent_fullname','createdAt','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','service','host','port','secure','authentication','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','mailTranscript','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','pick','$gte','YYYY-MM-DD\x20HH:mm:ss','findAll','getMyMessages','includeAgent','addTags','omit','spread','chatInteractionTags:save','removeTags','files','server','attachments','firstName','lastName','Account','get','Chat','Owner','N.A.','closedAt','osName','referer','customerPort','existsSync','createReadStream','pipe','out','views','transcript-','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','squel','crypto','jsforce','querystring','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','client','http','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','stack','name','send','merge','contact','agent','interaction','account','Users','map','fullname','Tags','TagIds','split','forEach','push','ChatInteraction','rawAttributes','type','key','model','query','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','select','color','tools_tags','field','u.fullname','ui.ChatInteractionId','from','user_has_chat_interactions','left_join','users','u.id\x20=\x20ui.UserId','chat_interactions','cm_contacts','chat_websites','a.id\x20=\x20i.ChatWebsiteId','me.ChatInteractionId\x20=\x20i.id','chat_interaction_has_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','unreadMessages','value','having','length','getFullTextValue','ContactId','buildExpression','text','start','union','User','operator','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','isEmpty','ChatWebsiteId','where','i.ChatWebsiteId\x20IN\x20?','parse','$lte','null','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','clone','DESC'];(function(_0x425716,_0x3e9d1c){var _0x2d39af=function(_0x1febc1){while(--_0x1febc1){_0x425716['push'](_0x425716['shift']());}};_0x2d39af(++_0x3e9d1c);}(_0x14a0,0x8e));var _0x014a=function(_0x2a1955,_0x24548b){_0x2a1955=_0x2a1955-0x0;var _0xbd319=_0x14a0[_0x2a1955];return _0xbd319;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x014a('0x0'));var zipdir=require(_0x014a('0x1'));var jsonpatch=require(_0x014a('0x2'));var rp=require(_0x014a('0x3'));var moment=require(_0x014a('0x4'));var BPromise=require(_0x014a('0x5'));var Mustache=require(_0x014a('0x6'));var util=require('util');var path=require('path');var sox=require(_0x014a('0x7'));var csv=require(_0x014a('0x8'));var ejs=require(_0x014a('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x014a('0xa'));var crypto=require(_0x014a('0xb'));var jsforce=require(_0x014a('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x014a('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x014a('0xe'));var pdf=require('../../components/export/pdf');var hardwareService=require(_0x014a('0xf'));var logger=require(_0x014a('0x10'))('api');var utils=require(_0x014a('0x11'));var config=require(_0x014a('0x12'));var licenseUtil=require(_0x014a('0x13'));var db=require(_0x014a('0x14'))['db'];config[_0x014a('0x15')]=_[_0x014a('0x16')](config[_0x014a('0x15')],{'host':_0x014a('0x17'),'port':0x18eb});var socket=require(_0x014a('0x18'))(new Redis(config[_0x014a('0x15')]));require(_0x014a('0x19'))[_0x014a('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0x014a('0x1b')][_0x014a('0x1c')]({'port':0x232b});var client9004=jayson['client'][_0x014a('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x128c46,_0x59a4ea,_0x16e6fc,_0x17e4be){return new BPromise(function(_0x20f148,_0x12da95){var _0x2c26ac=_0x17e4be||client;return _0x2c26ac[_0x014a('0x1d')](_0x128c46,_0x16e6fc)[_0x014a('0x1e')](function(_0x263b07){logger[_0x014a('0x1f')](_0x014a('0x20'),_0x59a4ea,_0x014a('0x21'));logger[_0x014a('0x22')](_0x014a('0x23'),_0x59a4ea,_0x014a('0x21'),JSON['stringify'](_0x263b07));if(_0x263b07[_0x014a('0x24')]){if(_0x263b07[_0x014a('0x24')][_0x014a('0x25')]===0x1f4){logger[_0x014a('0x24')](_0x014a('0x20'),_0x59a4ea,_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);return _0x12da95(_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);}logger['error'](_0x014a('0x20'),_0x59a4ea,_0x263b07['error'][_0x014a('0x26')]);return _0x20f148(_0x263b07[_0x014a('0x24')][_0x014a('0x26')]);}else{logger[_0x014a('0x1f')](_0x014a('0x20'),_0x59a4ea,_0x014a('0x21'));_0x20f148(_0x263b07[_0x014a('0x27')][_0x014a('0x26')]);}})[_0x014a('0x28')](function(_0x4c2627){logger[_0x014a('0x24')]('ChatInteraction,\x20%s,\x20%s',_0x59a4ea,_0x4c2627);_0x12da95(_0x4c2627);});});}function respondWithStatusCode(_0x39a432,_0x28701e){_0x28701e=_0x28701e||0xcc;return function(_0x4f1c44){if(_0x4f1c44){return _0x39a432['sendStatus'](_0x28701e);}return _0x39a432[_0x014a('0x29')](_0x28701e)[_0x014a('0x2a')]();};}function respondWithResult(_0x143346,_0x5ed71b){_0x5ed71b=_0x5ed71b||0xc8;return function(_0x183f19){if(_0x183f19){return _0x143346[_0x014a('0x29')](_0x5ed71b)['json'](_0x183f19);}};}function respondWithFilteredResult(_0x31dc95,_0x2560a6){return function(_0x496040){if(_0x496040){var _0x4f9c1c=typeof _0x2560a6[_0x014a('0x2b')]===_0x014a('0x2c')&&typeof _0x2560a6[_0x014a('0x2d')]===_0x014a('0x2c');var _0x4ea00c=_0x496040[_0x014a('0x2e')];var _0x147e7e=_0x4f9c1c?0x0:_0x2560a6[_0x014a('0x2b')];var _0x402d3b=_0x4f9c1c?_0x496040[_0x014a('0x2e')]:_0x2560a6[_0x014a('0x2b')]+_0x2560a6[_0x014a('0x2d')];var _0x1dae8e;if(_0x402d3b>=_0x4ea00c){_0x402d3b=_0x4ea00c;_0x1dae8e=0xc8;}else{_0x1dae8e=0xce;}_0x31dc95[_0x014a('0x29')](_0x1dae8e);return _0x31dc95[_0x014a('0x2f')](_0x014a('0x30'),_0x147e7e+'-'+_0x402d3b+'/'+_0x4ea00c)['json'](_0x496040);}return null;};}function patchUpdates(_0x105d4a){return function(_0x41ead8){try{jsonpatch[_0x014a('0x31')](_0x41ead8,_0x105d4a,!![]);}catch(_0x457883){return BPromise[_0x014a('0x32')](_0x457883);}return _0x41ead8[_0x014a('0x33')]();};}function saveUpdates(_0x211d18,_0x4dd025){return function(_0x116a24){if(_0x116a24){return _0x116a24[_0x014a('0x34')](_0x211d18)['then'](function(_0x415f83){return _0x415f83;});}return null;};}function removeEntity(_0x12de94,_0x40738f){return function(_0x467032){if(_0x467032){return _0x467032[_0x014a('0x35')]()[_0x014a('0x1e')](function(){_0x12de94[_0x014a('0x29')](0xcc)[_0x014a('0x2a')]();});}};}function handleEntityNotFound(_0x5e37e4,_0x19cee1){return function(_0x1dfe6e){if(!_0x1dfe6e){_0x5e37e4[_0x014a('0x36')](0x194);}return _0x1dfe6e;};}function handleError(_0x1f31c8,_0x5127f3){_0x5127f3=_0x5127f3||0x1f4;return function(_0x427c7a){logger[_0x014a('0x24')](_0x427c7a[_0x014a('0x37')]);if(_0x427c7a[_0x014a('0x38')]){delete _0x427c7a[_0x014a('0x38')];}_0x1f31c8[_0x014a('0x29')](_0x5127f3)[_0x014a('0x39')](_0x427c7a);};}function getMustacheRender(_0x36187b,_0x1ec350){return Mustache['render'](_0x36187b,_[_0x014a('0x3a')](_0x1ec350['body'],{'contact':_0x1ec350[_0x014a('0x3b')],'message':_0x1ec350[_0x014a('0x26')],'agent':_0x1ec350[_0x014a('0x3c')],'interaction':_0x1ec350[_0x014a('0x3d')],'account':_0x1ec350[_0x014a('0x3e')]}))||'';}function getInteractionUsers(_0x55126d,_0x1c6f6f){return new BPromise(function(_0x3f4a61,_0x51dca8){try{if(_0x1c6f6f[_0x55126d['id']]){_0x55126d[_0x014a('0x3f')]=_[_0x014a('0x40')](_0x1c6f6f[_0x55126d['id']],function(_0x3e5ecf){return{'id':_0x3e5ecf['id'],'fullname':_0x3e5ecf[_0x014a('0x41')]};});}}catch(_0x3788d6){_0x51dca8(_0x3788d6);}_0x3f4a61(_0x55126d);});}function getInteractionTags(_0x313eb8,_0x17b1b6){return new BPromise(function(_0x764fbe,_0x2beddc){try{if(_0x313eb8['TagIds']){_0x313eb8[_0x014a('0x42')]=[];_0x313eb8[_0x014a('0x43')][_0x014a('0x44')](',')[_0x014a('0x45')](function(_0x5f1a91){_0x313eb8[_0x014a('0x42')][_0x014a('0x46')](_0x17b1b6[_0x5f1a91]);});}delete _0x313eb8[_0x014a('0x43')];}catch(_0x1355dd){_0x2beddc(_0x1355dd);}_0x764fbe(_0x313eb8);});}function updateChatInteraction(_0x1dc647,_0x430a56,_0x5f2969){return new BPromise(function(_0x361866,_0x2830e1){return getInteractionUsers(_0x1dc647,_0x5f2969)['then'](function(_0xc086b3){return getInteractionTags(_0xc086b3,_0x430a56);})[_0x014a('0x1e')](function(_0x2c45f1){_0x361866(_0x2c45f1);})['catch'](function(_0x5bcf8){_0x2830e1(_0x5bcf8);});});}exports['index']=function(_0x5ab5e8,_0x67b30f){var _0x29c9ca={},_0x5aa496={},_0x1557ad={'count':0x0,'rows':[]};var _0x11c0d5=_[_0x014a('0x40')](db[_0x014a('0x47')][_0x014a('0x48')],function(_0xbaf8c6){return{'name':_0xbaf8c6['fieldName'],'type':_0xbaf8c6[_0x014a('0x49')][_0x014a('0x4a')]};});_0x5aa496[_0x014a('0x4b')]=_['map'](_0x11c0d5,'name');_0x5aa496[_0x014a('0x4c')]=_['keys'](_0x5ab5e8['query']);_0x5aa496[_0x014a('0x4d')]=_['intersection'](_0x5aa496[_0x014a('0x4b')],_0x5aa496[_0x014a('0x4c')]);_0x29c9ca[_0x014a('0x4e')]=_['intersection'](_0x5aa496[_0x014a('0x4b')],qs[_0x014a('0x4f')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x4f')]));_0x29c9ca[_0x014a('0x4e')]=_0x29c9ca[_0x014a('0x4e')]['length']?_0x29c9ca[_0x014a('0x4e')]:_0x5aa496[_0x014a('0x4b')];if(!_0x5ab5e8['query'][_0x014a('0x50')](_0x014a('0x51'))){_0x29c9ca[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x2d')]);_0x29c9ca[_0x014a('0x2b')]=qs[_0x014a('0x2b')](_0x5ab5e8['query'][_0x014a('0x2b')]);}_0x29c9ca[_0x014a('0x52')]=qs[_0x014a('0x53')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x53')]);_0x29c9ca['where']=qs[_0x014a('0x4d')](_['pick'](_0x5ab5e8[_0x014a('0x4c')],_0x5aa496[_0x014a('0x4d')]),_0x11c0d5);var _0x40e02b=[];var _0x479dc0=squel[_0x014a('0x54')]()['field']('id')['field']('name')['field'](_0x014a('0x55'))['from'](_0x014a('0x56'));var _0x5b5318=squel['select']()[_0x014a('0x57')]('u.id')[_0x014a('0x57')](_0x014a('0x58'))[_0x014a('0x57')](_0x014a('0x59'))[_0x014a('0x5a')](_0x014a('0x5b'),'ui')[_0x014a('0x5c')](_0x014a('0x5d'),'u',_0x014a('0x5e'));var _0x3fc9ab=squel['select']()['from'](_0x014a('0x5f'),'i')[_0x014a('0x5c')](_0x014a('0x60'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')['left_join'](_0x014a('0x5d'),'o','o.id\x20=\x20i.UserId')[_0x014a('0x5c')](_0x014a('0x61'),'a',_0x014a('0x62'))[_0x014a('0x5c')]('chat_messages','me',_0x014a('0x63'))[_0x014a('0x5c')](_0x014a('0x64'),'it','it.ChatInteractionId\x20=\x20i.id')[_0x014a('0x5c')]('tools_tags','t',_0x014a('0x65'));var _0x47074f=squel[_0x014a('0x66')]();var _0x24d433=[];var _0xd0334a=squel[_0x014a('0x66')]();var _0x4e9260;if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x67')]){_0x4e9260=as[_0x014a('0x68')](_0x5ab5e8['query'][_0x014a('0x67')]);var _0x17f9d7=_0x4e9260[_0x014a('0x69')];for(var _0xa4fd8d=0x0;_0xa4fd8d<_0x4e9260[_0x014a('0x6a')]['length'];_0xa4fd8d++){var _0x8ac9cd=_0x4e9260[_0x014a('0x6a')][_0xa4fd8d];var _0x63c341='i';var _0x37a7b8=_[_0x014a('0x6b')](_0x11c0d5,[_0x014a('0x38'),_0x8ac9cd[_0x014a('0x57')]]);if(!_0x37a7b8){switch(_0x8ac9cd[_0x014a('0x57')]){case _0x014a('0x6c'):if(_0x8ac9cd[_0x014a('0x6d')]==0x1){_0x3fc9ab[_0x014a('0x6e')]('`'+_0x8ac9cd[_0x014a('0x57')]+'`\x20=\x200');}else{_0x3fc9ab[_0x014a('0x6e')]('`'+_0x8ac9cd['field']+'`\x20>\x200');}break;case'Contact':if(_0x8ac9cd['operator']==='$substring'){if(_0x8ac9cd[_0x014a('0x6d')][_0x014a('0x44')]('\x20')[_0x014a('0x6f')]>0x1){_0x47074f[_0x17f9d7]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x014a('0x70')](_0x8ac9cd[_0x014a('0x6d')]),null);}else{var _0x3071c8='%'+_0x8ac9cd[_0x014a('0x6d')]+'%';_0x47074f[_0x17f9d7]('c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?',_0x3071c8,_0x3071c8,_0x3071c8);}}else{_0x37a7b8=_['find'](_0x11c0d5,[_0x014a('0x38'),_0x014a('0x71')]);_0x8ac9cd[_0x014a('0x57')]=_0x014a('0x71');_0x58e087=as[_0x014a('0x72')](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')][_0x014a('0x74')],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);}break;case'Tag':var _0x2d87e3=_0x8ac9cd[_0x014a('0x6d')]['split'](',')[_0x014a('0x40')](function(_0x3e39c9){return Number(_0x3e39c9);});_0x2d87e3['forEach'](function(_0x14f2e2){_0xd0334a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x14f2e2+',%');});_0x24d433=_[_0x014a('0x75')](_0x24d433,_0x2d87e3);break;case _0x014a('0x76'):if(_0x8ac9cd[_0x014a('0x77')]===_0x014a('0x78')){_0x47074f[_0x17f9d7](_0x014a('0x79'),'%'+_0x8ac9cd['value']+'%',null);}else{_0x37a7b8=_[_0x014a('0x6b')](_0x11c0d5,[_0x014a('0x38'),_0x014a('0x7a')]);_0x8ac9cd[_0x014a('0x57')]=_0x014a('0x7a');_0x58e087=as['buildExpression'](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')]['start'],_0x58e087[_0x014a('0x6d')]['end']);}break;case _0x014a('0x7b'):_0x58e087=as[_0x014a('0x72')]('me',null,_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087[_0x014a('0x73')],_0x58e087[_0x014a('0x6d')][_0x014a('0x74')],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);break;}}else{var _0x58e087=as['buildExpression'](_0x63c341,_0x37a7b8[_0x014a('0x49')],_0x8ac9cd);_0x47074f[_0x17f9d7](_0x58e087['text'],_0x58e087[_0x014a('0x6d')]['start'],_0x58e087[_0x014a('0x6d')][_0x014a('0x2a')]);}}}else{var _0x55bca3=_(_0x5ab5e8['query'])[_0x014a('0x7c')]()[_0x014a('0x40')](function(_0x5f391d){return _[_0x014a('0x7d')](_0x11c0d5,[_0x014a('0x38'),_0x5f391d])?_0x5f391d:undefined;})['compact']()['value']();if(!_[_0x014a('0x7e')](_0x55bca3)){_0x55bca3[_0x014a('0x45')](function(_0x1ee130){if(_0x1ee130===_0x014a('0x7f')){_0x3fc9ab[_0x014a('0x80')](_0x014a('0x81'),[]['concat'](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130]));}else if(_0x1ee130==='createdAt'){var _0x5a8351=JSON[_0x014a('0x82')](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130])['$gte'];var _0x27e363=JSON[_0x014a('0x82')](_0x5ab5e8[_0x014a('0x4c')][_0x1ee130])[_0x014a('0x83')];_0x3fc9ab[_0x014a('0x80')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5a8351,_0x27e363);}else{if(_0x5ab5e8[_0x014a('0x4c')][_0x1ee130]===_0x014a('0x84')){_0x3fc9ab[_0x014a('0x80')]('i.'+_0x1ee130+_0x014a('0x85'));}else{_0x3fc9ab['where']('i.'+_0x1ee130+_0x014a('0x86'),_0x5ab5e8['query'][_0x1ee130]);}}});}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x87')]){if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x87')]==0x1){_0x3fc9ab[_0x014a('0x6e')](_0x014a('0x88'));}else{_0x3fc9ab['having'](_0x014a('0x89'));}}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')]){_0x24d433=_[_0x014a('0x8b')](_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')])?_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8a')]:new Array(_0x5ab5e8['query'][_0x014a('0x8a')]);_0x24d433[_0x014a('0x45')](function(_0x3c2a39){_0xd0334a['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3c2a39+',%');});}if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8c')]){var _0x1cdfa5=_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x8c')][_0x014a('0x8d')]('\x5c','\x5c\x5c')[_0x014a('0x8d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x1cdfa5)){_0x47074f['or']('i.id\x20LIKE\x20?',_0x1cdfa5+'%');}else{_0x47074f['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x1cdfa5))['or'](_0x014a('0x8e'),_0x1cdfa5+'%');}}}_0x3fc9ab[_0x014a('0x80')](_0x47074f);_0x3fc9ab[_0x014a('0x8f')](_0x014a('0x90'));var _0xe1b5ed={'type':db[_0x014a('0x91')][_0x014a('0x92')]['SELECT'],'raw':!![]};var _0x24ffb0=_0x3fc9ab[_0x014a('0x93')]();_0x24ffb0[_0x014a('0x57')](_0x014a('0x90'));_0x24ffb0['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x014a('0x6c'));if(_0x29c9ca[_0x014a('0x52')]){_0x29c9ca['order']['forEach'](function(_0x9aa04b){var _0x5bcaf9=_0x9aa04b[0x0]==='contactName'?_0x9aa04b[0x0]:'i.'+_0x9aa04b[0x0];_0x3fc9ab[_0x014a('0x52')](_0x5bcaf9,_0x9aa04b[0x1]===_0x014a('0x94')?![]:!![]);});}if(!_['isEmpty'](_0x24d433)){_0x3fc9ab[_0x014a('0x6e')](_0xd0334a);_0x24ffb0[_0x014a('0x80')](_0x014a('0x95'),_0x24d433);}BPromise[_0x014a('0x96')]()[_0x014a('0x1e')](function(){if(!_0x4e9260){if(_0x5ab5e8[_0x014a('0x4c')][_0x014a('0x7f')])return;_0x24ffb0[_0x014a('0x80')]('i.ChatWebsiteId\x20IS\x20NOT\x20NULL');_0x3fc9ab['where'](_0x014a('0x97'));return;}if(_0x5ab5e8['user']['role']!=='agent')return;return _0x5ab5e8[_0x014a('0x98')][_0x014a('0x99')]({'attributes':['id'],'raw':!![]})[_0x014a('0x1e')](function(_0x55408f){if(_[_0x014a('0x7e')](_0x55408f)){_0x24ffb0[_0x014a('0x80')](_0x014a('0x9a'));_0x3fc9ab[_0x014a('0x80')]('i.ChatWebsiteId\x20IS\x20NULL');}else{_0x24ffb0[_0x014a('0x80')](_0x014a('0x81'),_[_0x014a('0x40')](_0x55408f,'id'));_0x3fc9ab['where'](_0x014a('0x81'),_[_0x014a('0x40')](_0x55408f,'id'));}});})['then'](function(){if(_0x5ab5e8[_0x014a('0x98')][_0x014a('0x9b')]===_0x014a('0x3c')&&!_0x4e9260&&!_0x5ab5e8['query'][_0x014a('0x7f')])return[];return db[_0x014a('0x9c')]['query'](_0x24ffb0[_0x014a('0x9d')](),_0xe1b5ed);})[_0x014a('0x1e')](function(_0x317df3){_0x1557ad[_0x014a('0x2e')]=_0x317df3[_0x014a('0x6f')];if(_0x1557ad[_0x014a('0x2e')]===0x0)return[];return db[_0x014a('0x9c')][_0x014a('0x4c')](_0x479dc0['toString'](),_0xe1b5ed)[_0x014a('0x1e')](function(_0x1806d0){_0x40e02b=_['keyBy'](_0x1806d0,'id');_0xe1b5ed=_['merge'](_0xe1b5ed,{'model':db[_0x014a('0x47')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5ab5e8[_0x014a('0x4c')]['fields']){_0x29c9ca[_0x014a('0x4e')][_0x014a('0x45')](function(_0x216b27){_0x3fc9ab['field']('i.'+_0x216b27);});}else{_0x3fc9ab[_0x014a('0x57')](_0x014a('0x9e'),'unreadMessages');_0x3fc9ab['field'](_0x014a('0x9f'),'Account.key');_0x3fc9ab[_0x014a('0x57')]('a.mandatoryDisposition',_0x014a('0xa0'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa1'),_0x014a('0xa2'));_0x3fc9ab[_0x014a('0x57')]('i.*');_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa3'),_0x014a('0xa4'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa5'),_0x014a('0xa6'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xa7'),'Contact.email');_0x3fc9ab[_0x014a('0x57')]('c.phone',_0x014a('0xa8'));_0x3fc9ab['field']('c.mobile','Contact.mobile');_0x3fc9ab['field'](_0x014a('0xa9'),_0x014a('0xaa'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xab'),_0x014a('0xac'));_0x3fc9ab[_0x014a('0x57')](_0x014a('0xad'),_0x014a('0xae'));_0x3fc9ab['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x014a('0x43'));}if(_0x29c9ca[_0x014a('0x2d')])_0x3fc9ab[_0x014a('0x2d')](_0x29c9ca[_0x014a('0x2d')]);if(_0x29c9ca[_0x014a('0x2b')])_0x3fc9ab[_0x014a('0x2b')](_0x29c9ca[_0x014a('0x2b')]);return db[_0x014a('0x9c')]['query'](_0x3fc9ab[_0x014a('0x9d')](),_0xe1b5ed);})[_0x014a('0x1e')](function(_0x3a2752){if(_0x3a2752[_0x014a('0x6f')]>0x0)_0x5b5318[_0x014a('0x80')]('ui.ChatInteractionId\x20IN\x20?',_[_0x014a('0x40')](_0x3a2752,'id'));return db[_0x014a('0x9c')][_0x014a('0x4c')](_0x5b5318[_0x014a('0x9d')](),_0xe1b5ed)[_0x014a('0x1e')](function(_0x567357){var _0x3036e4=_['groupBy'](_0x567357,_0x014a('0xaf'));var _0x5a83ab=[];_0x3a2752['forEach'](function(_0x1667c8){_0x5a83ab[_0x014a('0x46')](updateChatInteraction(_0x1667c8,_0x40e02b,_0x3036e4));});return BPromise['all'](_0x5a83ab);});});})[_0x014a('0x1e')](function(_0x3199b9){_0x1557ad[_0x014a('0xb0')]=_0x3199b9;return _0x1557ad;})['then'](respondWithFilteredResult(_0x67b30f,_0x29c9ca))[_0x014a('0x28')](handleError(_0x67b30f,null));};exports[_0x014a('0xb1')]=function(_0x2feb8a,_0x336bcf){var _0x2f7969={'raw':![],'where':{'id':_0x2feb8a[_0x014a('0xb2')]['id']}},_0x263212={};_0x263212[_0x014a('0x4b')]=_[_0x014a('0x7c')](db['ChatInteraction']['rawAttributes']);_0x263212[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x2feb8a[_0x014a('0x4c')]);_0x263212['filters']=_[_0x014a('0xb3')](_0x263212[_0x014a('0x4b')],_0x263212[_0x014a('0x4c')]);_0x2f7969[_0x014a('0x4e')]=_[_0x014a('0xb3')](_0x263212[_0x014a('0x4b')],qs['fields'](_0x2feb8a[_0x014a('0x4c')][_0x014a('0x4f')]));_0x2f7969[_0x014a('0x4e')]=_0x2f7969[_0x014a('0x4e')]['length']?_0x2f7969[_0x014a('0x4e')]:_0x263212[_0x014a('0x4b')];if(_0x2feb8a[_0x014a('0x4c')][_0x014a('0xb4')]){_0x2f7969[_0x014a('0xb5')]=[{'all':!![]}];}_0x2f7969=_['merge']({},_0x2f7969,_0x2feb8a[_0x014a('0xb6')]);return db['ChatInteraction']['find'](_0x2f7969)[_0x014a('0x1e')](handleEntityNotFound(_0x336bcf,null))[_0x014a('0x1e')](respondWithResult(_0x336bcf,null))[_0x014a('0x28')](handleError(_0x336bcf,null));};exports[_0x014a('0xb7')]=function(_0x3646b8,_0x243fd9){return db[_0x014a('0x47')][_0x014a('0xb7')](_0x3646b8[_0x014a('0x7b')],{})[_0x014a('0x1e')](respondWithResult(_0x243fd9,0xc9))[_0x014a('0x28')](handleError(_0x243fd9,null));};exports[_0x014a('0x34')]=function(_0x383bd8,_0x175c12){if(_0x383bd8[_0x014a('0x7b')]['id']){delete _0x383bd8[_0x014a('0x7b')]['id'];}return db['ChatInteraction'][_0x014a('0x6b')]({'where':{'id':_0x383bd8[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x175c12,null))['then'](saveUpdates(_0x383bd8[_0x014a('0x7b')],null))[_0x014a('0x1e')](respondWithResult(_0x175c12,null))[_0x014a('0x28')](handleError(_0x175c12,null));};exports[_0x014a('0x35')]=function(_0x116631,_0xbfd7f8){return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x116631[_0x014a('0xb2')]['id']}})['then'](handleEntityNotFound(_0xbfd7f8,null))[_0x014a('0x1e')](removeEntity(_0xbfd7f8,null))[_0x014a('0x28')](handleError(_0xbfd7f8,null));};exports[_0x014a('0xb8')]=function(_0x11aab3,_0x4f91f1){return db[_0x014a('0x47')]['describe']()['then'](respondWithResult(_0x4f91f1,null))[_0x014a('0x28')](handleError(_0x4f91f1,null));};exports['createVidaooSession']=function(_0x2de457,_0x2ca658){var _0x4ee77b=_0x2de457[_0x014a('0xb2')]['id'];var _0x4e75e4;var _0x172210;var _0x8cc35d;return db['ChatInteraction'][_0x014a('0xb9')]({'where':{'id':_0x4ee77b}})[_0x014a('0x1e')](function(_0x50a129){_0x4e75e4=_0x50a129;return db[_0x014a('0xba')][_0x014a('0xb9')]({'where':{'id':_0x50a129[_0x014a('0x7f')]},'attributes':['id',_0x014a('0xbb'),_0x014a('0xbc'),_0x014a('0xbd'),_0x014a('0xbe'),_0x014a('0xbf')],'raw':!![]});})[_0x014a('0x1e')](function(_0x38df6c){if(_0x38df6c&&_0x38df6c[_0x014a('0xbb')]&&_0x38df6c[_0x014a('0xbc')]){_0x172210=_0x38df6c;var _0x4e0c1a={'interaction':{'id':_0x4ee77b},'agent':{'id':_0x2de457[_0x014a('0x98')]['id'],'name':_0x2de457[_0x014a('0x98')][_0x014a('0x38')],'fullname':_0x2de457[_0x014a('0x98')][_0x014a('0x41')],'email':_0x2de457[_0x014a('0x98')][_0x014a('0xc0')]},'contact':_0x2de457[_0x014a('0x7b')]['contact'],'account':_0x2de457[_0x014a('0x7b')][_0x014a('0x3e')]};var _0x2b3dc0={'rejectUnauthorized':![],'method':_0x014a('0xc1'),'url':_0x014a('0xc2'),'headers':{'X-APIKEY':_0x38df6c[_0x014a('0xbb')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x2de457['user'][_0x014a('0xc0')]],'buttons':null,'topic':_0x172210[_0x014a('0xbd')],'note':_[_0x014a('0xc3')](_0x172210['vidaooNote'])?null:getMustacheRender(_0x172210['vidaooNote'],_0x4e0c1a),'metadata':null},'redirect':_0x014a('0xc4'),'json':!![]};try{if(!_[_0x014a('0xc3')](_0x172210[_0x014a('0xbf')])){var _0x31e65e=getMustacheRender(_0x172210[_0x014a('0xbf')],_0x4e0c1a);var _0x537353=JSON[_0x014a('0x82')](_0x31e65e);_0x2b3dc0[_0x014a('0x7b')][_0x014a('0xc5')]=_0x537353;}}catch(_0x5dd7a5){throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Error\x20in\x20conversion\x20vidaooMetadata');}return rp(_0x2b3dc0);}else{throw new db[(_0x014a('0x91'))]['ValidationError'](_0x014a('0xc7'));}})['then'](function(_0x57d852){_0x8cc35d=_0x57d852;if(_0x8cc35d['id']){var _0x581c3a={'body':_0x8cc35d[_0x014a('0xc8')],'ChatWebsiteId':_0x172210['id'],'ChatInteractionId':_0x4e75e4['id'],'direction':'out','UserId':_0x2de457[_0x014a('0x98')]['id']};return db['ChatMessage'][_0x014a('0xb7')](_0x581c3a,{});}else{throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Unable\x20to\x20create\x20Vidaoo\x20session');}})[_0x014a('0x1e')](function(){return _0x4e75e4['updateAttributes']({'vidaooSessionId':_0x8cc35d['id']});})[_0x014a('0x1e')](respondWithResult(_0x2ca658,null))[_0x014a('0x28')](handleError(_0x2ca658,null));};exports[_0x014a('0xc9')]=function(_0x533371,_0x57b53b){if(_0x533371[_0x014a('0x7b')]['id']){delete _0x533371[_0x014a('0x7b')]['id'];}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x533371[_0x014a('0xb2')]['id']},'include':[{'model':db[_0x014a('0xca')],'as':_0x014a('0xcb')}]})[_0x014a('0x1e')](handleEntityNotFound(_0x57b53b,null))[_0x014a('0x1e')](saveUpdates(_0x533371[_0x014a('0x7b')],null))[_0x014a('0x1e')](respondWithResult(_0x57b53b,null))[_0x014a('0x28')](handleError(_0x57b53b,null));};exports[_0x014a('0xcc')]=function(_0x4adbd2,_0x55a4bb,_0x38807c){if(_0x4adbd2[_0x014a('0x7b')]['id']){delete _0x4adbd2['body']['id'];}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x4adbd2['params']['id']}})['then'](function(_0xf01aa6){if(!_0xf01aa6){logger[_0x014a('0x24')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x014a('0xcc'),0x194,'entity\x20not\x20found');_0x55a4bb[_0x014a('0x36')](0x194);}else{if(_0xf01aa6[_0x014a('0x7a')]){throw new db[(_0x014a('0x91'))][(_0x014a('0xc6'))]('Interaction\x20already\x20assigned');}}return _0xf01aa6;})['then'](function(_0x5db9d1){if(_0x5db9d1){return _0x5db9d1['update']({'closed':_0x4adbd2[_0x014a('0x7b')][_0x014a('0xcd')],'disposition':_0x4adbd2[_0x014a('0x7b')][_0x014a('0xce')]})[_0x014a('0x1e')](function(_0x3e19c0){return _0x3e19c0;});}})[_0x014a('0x1e')](function(_0x3546e7){return respondWithRpcPromise(_0x014a('0xcf'),_0x014a('0xcc'),_0x4adbd2[_0x014a('0x7b')],client9004);})['then'](respondWithResult(_0x55a4bb,null))['catch'](handleError(_0x55a4bb,null));};exports['attachmentUpload']=function(_0x190839,_0x28f011,_0x4da4a1){_0x190839[_0x014a('0x7b')][_0x014a('0x38')]=_0x190839[_0x014a('0xd0')][_0x014a('0xd1')];_0x190839['body'][_0x014a('0xd2')]=_0x190839[_0x014a('0xd0')]['filename'];_0x190839[_0x014a('0x7b')][_0x014a('0x49')]=_0x190839['file'][_0x014a('0xd3')];return db[_0x014a('0xd4')][_0x014a('0xb7')](_0x190839[_0x014a('0x7b')])[_0x014a('0x1e')](respondWithResult(_0x28f011,0xc9))[_0x014a('0x28')](handleError(_0x28f011,null));};exports[_0x014a('0xd5')]=function(_0xd50ab0,_0x4cee0b,_0x129deb){return db[_0x014a('0x47')][_0x014a('0xb9')]({'where':{'id':_0xd50ab0[_0x014a('0xb2')]['id']},'raw':!![]})[_0x014a('0x1e')](handleEntityNotFound(_0x4cee0b,null))[_0x014a('0x1e')](function(_0x2573bd){if(_0x2573bd){if(_0x2573bd[_0x014a('0xcd')]){return _0x4cee0b[_0x014a('0x29')](0x193)['json']({'status':0x193,'message':_0x014a('0xd6')});}return db['Attachment'][_0x014a('0xb9')]({'where':{'id':_0xd50ab0[_0x014a('0x4c')][_0x014a('0xd7')]},'raw':!![]})['then'](handleEntityNotFound(_0x4cee0b,null));}})['then'](function(_0x293ee3){if(_0x293ee3){var _0x4ce807=_0x293ee3['ChatOfflineMessageId']!==null;var _0x5c002b=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0xda'));if(_0x4ce807){_0x5c002b=path['join'](_0x5c002b,_0x014a('0xdb'));}var _0x19a2ed=path['join'](_0x5c002b,_0x293ee3[_0x014a('0xd2')]);return _0x4cee0b[_0x014a('0xdc')](_0x19a2ed);}})[_0x014a('0x28')](handleError(_0x4cee0b,null));};exports['close']=function(_0x5b82f2,_0x2b622f){var _0x24e9d7=null;var _0x344adb=null;var _0x1441ed=null;var _0x34b528=null;if(_0x5b82f2[_0x014a('0x7b')]['id']){delete _0x5b82f2['body']['id'];}if(_0x5b82f2['body']['mailTranscript']){_0x34b528=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0xdd'),util['format'](_0x014a('0xde'),Date[_0x014a('0xdf')]()));_0x5b82f2[_0x014a('0x7b')]['pathTranscript']=_0x34b528;}return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x5b82f2[_0x014a('0xb2')]['id']},'include':[{'model':db[_0x014a('0xe0')],'as':'Messages','include':[{'model':db[_0x014a('0x76')],'as':'User'}]}]})[_0x014a('0x1e')](handleEntityNotFound(_0x2b622f,null))[_0x014a('0x1e')](saveUpdates(_0x5b82f2[_0x014a('0x7b')],null))['then'](function(_0xdd63f){if(_0xdd63f){_0x24e9d7=_0xdd63f;return db[_0x014a('0xba')][_0x014a('0x6b')]({'where':{'id':_0x24e9d7[_0x014a('0x7f')]}});}})[_0x014a('0x1e')](function(_0x49a1eb){if(_0x49a1eb){_0x1441ed=_0x49a1eb;return db[_0x014a('0xca')][_0x014a('0x6b')]({'where':{'id':_0x24e9d7[_0x014a('0x71')]}});}})[_0x014a('0x1e')](function(_0x2432ac){if(_0x2432ac){_0x344adb=_0x2432ac;if(_0x34b528){var _0xb91589=null;for(var _0x53260c=0x1;_0x53260c<_0x24e9d7[_0x014a('0xe1')][_0x014a('0x6f')];++_0x53260c){_0xb91589=_0x24e9d7['Messages'][_0x53260c];var _0x1b5b25=_0xb91589['UserId']?util[_0x014a('0xe2')]('%s%d',_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):_0x014a('0xe4');var _0x10b3c5=_0x5b82f2[_0x014a('0x7b')][_0x014a('0xe5')]||util[_0x014a('0xe2')]('%s%d','Visitor',_0xb91589[_0x014a('0x71')]);switch(_0x1441ed[_0x014a('0xe6')]){case'website_alias':_0x1b5b25=_0xb91589[_0x014a('0x7a')]?util[_0x014a('0xe2')](_0x014a('0xe7'),_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):'System';break;case _0x014a('0xe8'):_0x1b5b25=_0xb91589[_0x014a('0x7a')]?_0xb91589[_0x014a('0x76')][_0x014a('0xe9')]||_0xb91589['User'][_0x014a('0x41')]:'System';break;case _0x014a('0xea'):_0x1b5b25=_0xb91589[_0x014a('0x7a')]?_0xb91589[_0x014a('0x76')][_0x014a('0x41')]:_0x014a('0xe4');break;default:_0x1b5b25=_0xb91589[_0x014a('0x7a')]?util[_0x014a('0xe2')]('%s%d',_0x1441ed[_0x014a('0xe3')],_0xb91589[_0x014a('0x7a')]):_0x014a('0xe4');}var _0x343b5e=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0xb91589[_0x014a('0xeb')])[_0x014a('0xe2')]('MM/DD/YYYY\x20HH:mm:ss'),_0xb91589[_0x014a('0xec')]==='in'?_0x10b3c5:_0x1b5b25,_0xb91589[_0x014a('0x7b')]);if(!_0xb91589[_0x014a('0xed')]){fs[_0x014a('0xee')](_0x34b528,_0x343b5e);}}return db[_0x014a('0xef')][_0x014a('0xb9')]({'where':{'service':!![]},'include':[{'model':db[_0x014a('0xf0')],'as':_0x014a('0xf1'),'raw':!![]}]});}}})[_0x014a('0x1e')](function(_0x4ad0c6){if(_0x4ad0c6&&_0x4ad0c6[_0x014a('0xf1')]&&_0x5b82f2['body']){var _0x5f8d5b={'tls':{'rejectUnauthorized':![]}};if(_0x4ad0c6[_0x014a('0xf1')]['service']){_0x5f8d5b[_0x014a('0xf2')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf2')];}else{_0x5f8d5b[_0x014a('0xf3')]=_0x4ad0c6[_0x014a('0xf1')]['host'];_0x5f8d5b[_0x014a('0xf4')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf4')];_0x5f8d5b[_0x014a('0xf5')]=_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf5')];}if(_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf6')]){_0x5f8d5b['auth']={'user':_0x4ad0c6[_0x014a('0xf1')]['user'],'pass':_0x4ad0c6[_0x014a('0xf1')][_0x014a('0xf7')]};}return respondWithRpcPromise(_0x014a('0xf8'),_0x014a('0xf9'),{'account':_0x5f8d5b,'message':{'from':util[_0x014a('0xe2')](_0x014a('0xfa'),_0x4ad0c6['name'],_0x4ad0c6[_0x014a('0xc0')]||_0x4ad0c6['Smtp'][_0x014a('0x98')]),'to':_0x5b82f2[_0x014a('0x7b')][_0x014a('0xfb')],'subject':_0x014a('0xfc'),'text':util[_0x014a('0xe2')](_0x014a('0xfd'),_0x5b82f2[_0x014a('0x7b')][_0x014a('0xfb')]),'attachments':[{'path':_0x34b528}]}})['then'](function(){return _0x24e9d7;})['catch'](function(_0xac886c){console[_0x014a('0x24')](_0xac886c);});}else{return _0x24e9d7;}})[_0x014a('0x1e')](respondWithStatusCode(_0x2b622f,0xc8))[_0x014a('0x28')](handleError(_0x2b622f,null));};exports[_0x014a('0xfe')]=function(_0x30aa7b,_0x451579,_0x3858a1){return db[_0x014a('0xe0')][_0x014a('0x6b')]({'where':{'id':_0x30aa7b[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x451579,null))[_0x014a('0x1e')](function(_0x57bd30){if(_0x57bd30){return _0x57bd30[_0x014a('0xfe')](_0x30aa7b[_0x014a('0x7b')][_0x014a('0xff')],_['omit'](_0x30aa7b[_0x014a('0x7b')],[_0x014a('0xff'),'id'])||{});}})[_0x014a('0x1e')](respondWithResult(_0x451579,null))[_0x014a('0x28')](handleError(_0x451579,null));};exports[_0x014a('0x100')]=function(_0x36c94d,_0x44cb05,_0x30a903){var _0x3bb1f={'raw':![],'where':{}};var _0x4775a4={};var _0x13ec10={'count':0x0,'rows':[]};return db[_0x014a('0x47')]['findOne']({'where':{'id':_0x36c94d['params']['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x44cb05,null))[_0x014a('0x1e')](function(_0x4a361b){if(_0x4a361b){_0x4775a4[_0x014a('0x4b')]=_[_0x014a('0x7c')](db[_0x014a('0xe0')][_0x014a('0x48')]);_0x4775a4[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x36c94d[_0x014a('0x4c')]);_0x4775a4[_0x014a('0x4d')]=_['intersection'](_0x4775a4[_0x014a('0x4b')],_0x4775a4[_0x014a('0x4c')]);_0x3bb1f[_0x014a('0x4e')]=_[_0x014a('0xb3')](_0x4775a4['model'],qs[_0x014a('0x4f')](_0x36c94d[_0x014a('0x4c')][_0x014a('0x4f')]));_0x3bb1f['attributes']=_0x3bb1f[_0x014a('0x4e')][_0x014a('0x6f')]?_0x3bb1f['attributes']:_0x4775a4[_0x014a('0x4b')];if(!_0x36c94d[_0x014a('0x4c')][_0x014a('0x50')]('nolimit')){_0x3bb1f[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x36c94d[_0x014a('0x4c')]['limit']);_0x3bb1f[_0x014a('0x2b')]=qs['offset'](_0x36c94d[_0x014a('0x4c')]['offset']);}_0x3bb1f[_0x014a('0x52')]=qs[_0x014a('0x53')](_0x36c94d['query'][_0x014a('0x53')]);_0x3bb1f['where']=qs[_0x014a('0x4d')](_[_0x014a('0x101')](_0x36c94d[_0x014a('0x4c')],_0x4775a4[_0x014a('0x4d')]));_0x3bb1f[_0x014a('0x80')]['ChatInteractionId']=_0x4a361b['id'];if(_0x36c94d[_0x014a('0x4c')][_0x014a('0x8c')]){_0x3bb1f[_0x014a('0x80')]=_['merge'](_0x3bb1f[_0x014a('0x80')],{'$or':_[_0x014a('0x40')](_0x3bb1f['attributes'],function(_0x565da5){var _0x309858={};_0x309858[_0x565da5]={'$like':'%'+_0x36c94d[_0x014a('0x4c')]['filter']+'%'};return _0x309858;})});}if(_0x36c94d[_0x014a('0x4c')]['$gte']){var _0x56bfaf=_0x36c94d[_0x014a('0x4c')][_0x014a('0x102')]['split'](',');var _0x5f14e4={};_0x5f14e4[_0x56bfaf[0x0]]={'$gte':moment(_0x56bfaf[0x1])['format'](_0x014a('0x103'))};_0x3bb1f[_0x014a('0x80')]=_[_0x014a('0x3a')](_0x3bb1f['where'],_0x5f14e4);}_0x3bb1f=_['merge']({},_0x3bb1f,_0x36c94d[_0x014a('0xb6')]);return db['ChatMessage'][_0x014a('0x2e')]({'where':_0x3bb1f[_0x014a('0x80')]})['then'](function(_0x4acfe9){_0x13ec10[_0x014a('0x2e')]=_0x4acfe9;if(_0x36c94d[_0x014a('0x4c')]['includeAll']){_0x3bb1f[_0x014a('0xb5')]=[{'all':!![]}];}return db['ChatMessage'][_0x014a('0x104')](_0x3bb1f);})['then'](function(_0x8c21a7){_0x13ec10[_0x014a('0xb0')]=_0x8c21a7;return _0x13ec10;});}})[_0x014a('0x1e')](respondWithFilteredResult(_0x44cb05,_0x3bb1f))[_0x014a('0x28')](handleError(_0x44cb05,null));};exports[_0x014a('0x105')]=function(_0x260f79,_0x68de07,_0x4126a3){var _0x4f1f23={'where':{}},_0x1ef9b0={},_0x11d0e9={'count':0x0,'rows':[]};return db[_0x014a('0x47')][_0x014a('0xb9')]({'where':{'id':_0x260f79[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x68de07,null))[_0x014a('0x1e')](function(_0x4f7960){if(_0x4f7960){_0x1ef9b0['model']=_[_0x014a('0x7c')](db[_0x014a('0xe0')][_0x014a('0x48')]);_0x1ef9b0[_0x014a('0x4c')]=_[_0x014a('0x7c')](_0x260f79[_0x014a('0x4c')]);_0x1ef9b0[_0x014a('0x4d')]=_[_0x014a('0xb3')](_0x1ef9b0[_0x014a('0x4b')],_0x1ef9b0[_0x014a('0x4c')]);_0x4f1f23[_0x014a('0x4e')]=_['intersection'](_0x1ef9b0[_0x014a('0x4b')],qs[_0x014a('0x4f')](_0x260f79[_0x014a('0x4c')][_0x014a('0x4f')]));_0x4f1f23[_0x014a('0x4e')]=_0x4f1f23[_0x014a('0x4e')][_0x014a('0x6f')]?_0x4f1f23['attributes']:_0x1ef9b0['model'];if(!_0x260f79[_0x014a('0x4c')][_0x014a('0x50')](_0x014a('0x51'))){_0x4f1f23[_0x014a('0x2d')]=qs[_0x014a('0x2d')](_0x260f79['query'][_0x014a('0x2d')]);_0x4f1f23[_0x014a('0x2b')]=qs['offset'](_0x260f79[_0x014a('0x4c')][_0x014a('0x2b')]);}_0x4f1f23[_0x014a('0x52')]=qs['sort'](_0x260f79[_0x014a('0x4c')][_0x014a('0x53')]);_0x4f1f23[_0x014a('0x80')]=qs['filters'](_[_0x014a('0x101')](_0x260f79[_0x014a('0x4c')],_0x1ef9b0['filters']));_0x4f1f23[_0x014a('0x80')][_0x014a('0xaf')]=_0x4f7960['id'];if(_0x260f79[_0x014a('0x4c')]['filter']){_0x4f1f23[_0x014a('0x80')]=_['merge'](_0x4f1f23['where'],{'$or':_['map'](_0x4f1f23['attributes'],function(_0xf3e4fb){var _0x126084={};_0x126084[_0xf3e4fb]={'$like':'%'+_0x260f79[_0x014a('0x4c')][_0x014a('0x8c')]+'%'};return _0x126084;})});}_0x4f1f23[_0x014a('0x80')][_0x014a('0xed')]=![];if(_0x260f79[_0x014a('0x4c')]['id']){_0x4f1f23['where']['id']={'$gt':_0x260f79[_0x014a('0x4c')]['id']};}_0x4f1f23=_['merge']({},_0x4f1f23,_0x260f79[_0x014a('0xb6')]);return db[_0x014a('0xe0')][_0x014a('0x2e')]({'where':_0x4f1f23['where']})[_0x014a('0x1e')](function(_0x58421d){_0x11d0e9['count']=_0x58421d;_0x4f1f23[_0x014a('0xb5')]=[];if(_0x260f79[_0x014a('0x4c')][_0x014a('0x106')]){_0x4f1f23['include']['push']({'model':db[_0x014a('0x76')],'as':_0x014a('0x76'),'attributes':['id',_0x014a('0x41'),_0x014a('0xe9')]});}if(_0x260f79[_0x014a('0x4c')][_0x014a('0xb4')]){_0x4f1f23['include']=[{'all':!![]}];}return db['ChatMessage']['findAll'](_0x4f1f23);})[_0x014a('0x1e')](function(_0x40a47f){_0x11d0e9[_0x014a('0xb0')]=_0x40a47f;return _0x11d0e9;});}})['then'](respondWithFilteredResult(_0x68de07,_0x4f1f23))[_0x014a('0x28')](handleError(_0x68de07,null));};exports[_0x014a('0x107')]=function(_0x8a099,_0x81208d,_0x320be9){return db[_0x014a('0x47')][_0x014a('0x6b')]({'where':{'id':_0x8a099[_0x014a('0xb2')]['id']}})['then'](handleEntityNotFound(_0x81208d,null))[_0x014a('0x1e')](function(_0x46a2c5){if(_0x46a2c5){return _0x46a2c5['setTags'](_0x8a099[_0x014a('0x7b')][_0x014a('0xff')],_[_0x014a('0x108')](_0x8a099['body'],[_0x014a('0xff'),'id'])||{})[_0x014a('0x109')](function(){return db['Tag'][_0x014a('0x104')]({'attributes':['id','name',_0x014a('0x55')],'where':{'id':_0x8a099[_0x014a('0x7b')][_0x014a('0xff')]}});})[_0x014a('0x1e')](function(_0x4f56a9){socket['emit'](_0x014a('0x10a'),{'id':Number(_0x8a099[_0x014a('0xb2')]['id']),'tags':_0x4f56a9||[]});return{'id':Number(_0x8a099[_0x014a('0xb2')]['id']),'tags':_0x4f56a9||[]};});}})[_0x014a('0x1e')](respondWithResult(_0x81208d,null))[_0x014a('0x28')](handleError(_0x81208d,null));};exports[_0x014a('0x10b')]=function(_0x32ba5d,_0x120047,_0x570898){return db['ChatInteraction']['find']({'where':{'id':_0x32ba5d[_0x014a('0xb2')]['id']}})[_0x014a('0x1e')](handleEntityNotFound(_0x120047,null))[_0x014a('0x1e')](function(_0x47cd44){if(_0x47cd44){return _0x47cd44[_0x014a('0x10b')](_0x32ba5d[_0x014a('0x4c')][_0x014a('0xff')]);}})['then'](respondWithStatusCode(_0x120047,null))[_0x014a('0x28')](handleError(_0x120047,null));};exports['download']=function(_0x546af7,_0x4c492f){var _0x331ba9=moment()['unix']()[_0x014a('0x9d')]();var _0x3e7923=path['join'](config[_0x014a('0xd9')],'server',_0x014a('0x10c'),'tmp');var _0x387e49=path[_0x014a('0xd8')](config[_0x014a('0xd9')],_0x014a('0x10d'),_0x014a('0x10c'),_0x014a('0x10e'));var _0x1c5606=path['join'](_0x3e7923,_0x331ba9);var _0x4b4336=util[_0x014a('0xe2')]('transcript-%d-%s.zip',_0x546af7[_0x014a('0xb2')]['id'],_0x331ba9);var _0x1b3f4d=path[_0x014a('0xd8')](_0x3e7923,_0x4b4336);var _0x5f58bd=[];_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0x76')],'as':'User','attributes':['id',_0x014a('0x41')],'raw':!![]});_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0xca')],'as':_0x014a('0xcb'),'attributes':['id',_0x014a('0x10f'),_0x014a('0x110')],'raw':!![]});if(_0x546af7[_0x014a('0x4c')]['attachments']){_0x5f58bd[_0x014a('0x46')]({'model':db[_0x014a('0xd4')],'as':'Attachment','raw':!![]});}var _0x5104b1=[{'model':db[_0x014a('0xe0')],'as':_0x014a('0xe1'),'attributes':['id',_0x014a('0x7b'),_0x014a('0xeb'),'direction',_0x014a('0xed'),_0x014a('0x87')],'include':_0x5f58bd}];_0x5104b1[_0x014a('0x46')]({'model':db[_0x014a('0xba')],'as':_0x014a('0x111'),'attributes':['id',_0x014a('0x38')]});_0x5104b1['push']({'model':db['User'],'as':'Owner','attributes':['id',_0x014a('0x41')]});return db['ChatInteraction'][_0x014a('0x6b')]({'where':{'id':_0x546af7[_0x014a('0xb2')]['id']},'include':_0x5104b1})[_0x014a('0x1e')](handleEntityNotFound(_0x4c492f,null))['then'](function(_0x501d05){if(_0x501d05){var _0x48c669=_0x501d05[_0x014a('0x112')]({'plain':!![]});fs['mkdirSync'](_0x1c5606);var _0x5d4bae={'channel':_0x014a('0x113'),'account':_0x48c669[_0x014a('0x111')][_0x014a('0x38')],'agent':_0x48c669[_0x014a('0x114')]?_0x48c669[_0x014a('0x114')][_0x014a('0x41')]:_0x014a('0x115'),'createdAt':moment(_0x48c669[_0x014a('0xeb')])['format']('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'closedAt':_0x48c669['closed']?moment(_0x48c669[_0x014a('0x116')])[_0x014a('0xe2')](_0x014a('0x103'))[_0x014a('0x9d')]():'','disposition':_0x48c669[_0x014a('0xce')],'chatInfo':{'browser':_0x48c669['browserName'],'os':_0x48c669[_0x014a('0x117')],'referer':_0x48c669[_0x014a('0x118')],'customerIp':_0x48c669['customerIp'],'customerPort':_0x48c669[_0x014a('0x119')]?_0x48c669[_0x014a('0x119')]:_0x014a('0x115')},'messages':_(_0x48c669[_0x014a('0xe1')])['tail']()[_0x014a('0x8c')]({'secret':![]})[_0x014a('0x40')](function(_0x5afb91){if(_0x5afb91[_0x014a('0xd4')]){var _0x172440=path[_0x014a('0xd8')](_0x387e49,_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')]);if(fs[_0x014a('0x11a')](_0x172440)){fs[_0x014a('0x11b')](_0x172440)[_0x014a('0x11c')](fs['createWriteStream'](path[_0x014a('0xd8')](_0x1c5606,_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')])));}}return{'date':moment(_0x5afb91['createdAt'])['format'](_0x014a('0x103'))[_0x014a('0x9d')](),'sender':_0x5afb91[_0x014a('0xec')]==='out'?_0x5afb91[_0x014a('0x76')]?_0x5afb91[_0x014a('0x76')][_0x014a('0x41')]:_0x014a('0xe4'):_0x5afb91[_0x014a('0xcb')][_0x014a('0x10f')]+(_0x5afb91[_0x014a('0xcb')][_0x014a('0x110')]?'\x20'+_0x5afb91[_0x014a('0xcb')][_0x014a('0x110')]:''),'body':_0x5afb91[_0x014a('0xd4')]?_0x5afb91[_0x014a('0xd4')][_0x014a('0xd2')]:_0x5afb91[_0x014a('0x7b')],'direction':_0x5afb91[_0x014a('0xec')]===_0x014a('0x11d')?'A':'C','secret':_0x5afb91[_0x014a('0xed')],'read':_0x5afb91['read'],'attachment':_0x5afb91[_0x014a('0xd4')]};})[_0x014a('0x6d')]()};return ejs['renderFile'](path['join'](config['root'],_0x014a('0x10d'),_0x014a('0x11e'),'downloadInteraction.ejs'),{'interaction':_0x5d4bae})['then'](function(_0x374e3d){var _0x2d9178=path['join'](_0x1c5606,_0x014a('0x11f')+_0x48c669['id']+'-'+_0x331ba9+'.pdf');var _0x30c604={'path':_0x2d9178,'channel':'Chat','interactionId':_0x48c669['id']};return pdf['createPdfFromHTML'](_0x374e3d,_0x30c604);})[_0x014a('0x1e')](function(){return new BPromise(function(_0x321a17,_0x2f20e7){zipdir(_0x1c5606,{'saveTo':_0x1b3f4d},function(_0x18edd1,_0xcad1af){if(_0x18edd1)return _0x2f20e7(_0x18edd1);return _0x321a17(_0xcad1af);});})['then'](function(){return new BPromise(function(_0x42cd23,_0x82d77b){rimraf(_0x1c5606,function(_0x48bcec){if(_0x48bcec)_0x82d77b(_0x48bcec);return _0x42cd23();});});})[_0x014a('0x1e')](function(){return _0x4c492f[_0x014a('0xdc')](_0x1b3f4d,_0x4b4336,function(_0x1d8179){if(_0x1d8179){console[_0x014a('0x120')](_0x014a('0x121'),_0x1d8179);}else{fs[_0x014a('0x122')](_0x1b3f4d);}});});});}else{return _0x4c492f[_0x014a('0x36')](0xc8);}})['catch'](handleError(_0x4c492f,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 8e9b341..6eec8a3 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 _0xe8f7=['setDataValue','Users','map','findAll','length','emit','catch','hasOwnProperty','exports','../../mysqldb','ChatInteraction','ChatMessage','save','remove','getUsers','then'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xe8f7,0x1d9));var _0x7e8f=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe8f7[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0x7e8f('0x0'))['db'][_0x7e8f('0x1')];var ChatMessage=require(_0x7e8f('0x0'))['db'][_0x7e8f('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7e8f('0x3'),'afterUpdate':'update','afterDestroy':_0x7e8f('0x4')};function emitEvent(_0x352699){return function(_0x3628a8,_0x8b0566,_0x41a7f7){_0x3628a8[_0x7e8f('0x5')]({'attributes':['id'],'raw':!![]})[_0x7e8f('0x6')](function(_0x536137){_0x3628a8[_0x7e8f('0x7')](_0x7e8f('0x8'),_0x536137[_0x7e8f('0x9')](function(_0x2e82d8){return{'id':_0x2e82d8['id']};}));return ChatMessage[_0x7e8f('0xa')]({'where':{'ChatInteractionId':_0x3628a8['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x5876bc){_0x3628a8[_0x7e8f('0x7')]('unreadMessages',_0x5876bc[_0x7e8f('0xb')]);ChatInteractionEvents[_0x7e8f('0xc')](_0x352699+':'+_0x3628a8['id'],_0x3628a8);ChatInteractionEvents['emit'](_0x352699,_0x3628a8);_0x41a7f7(null);})[_0x7e8f('0xd')](_0x41a7f7(null));};}for(var e in events){if(events[_0x7e8f('0xe')](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0x7e8f('0xf')]=ChatInteractionEvents; \ No newline at end of file +var _0xe11e=['remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','exports','events','../../mysqldb','ChatInteraction','ChatMessage','setMaxListeners','update'];(function(_0x125c1e,_0x3cb7d0){var _0x403e4a=function(_0x395622){while(--_0x395622){_0x125c1e['push'](_0x125c1e['shift']());}};_0x403e4a(++_0x3cb7d0);}(_0xe11e,0x9c));var _0xee11=function(_0x55caed,_0x5aa080){_0x55caed=_0x55caed-0x0;var _0x3aed5f=_0xe11e[_0x55caed];return _0x3aed5f;};'use strict';var EventEmitter=require(_0xee11('0x0'));var ChatInteraction=require(_0xee11('0x1'))['db'][_0xee11('0x2')];var ChatMessage=require(_0xee11('0x1'))['db'][_0xee11('0x3')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0xee11('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0xee11('0x5'),'afterDestroy':_0xee11('0x6')};function emitEvent(_0x518d47){return function(_0x2ce7aa,_0xda0f64,_0x10d853){_0x2ce7aa[_0xee11('0x7')]({'attributes':['id'],'raw':!![]})[_0xee11('0x8')](function(_0xbe27c8){_0x2ce7aa[_0xee11('0x9')](_0xee11('0xa'),_0xbe27c8[_0xee11('0xb')](function(_0x337c86){return{'id':_0x337c86['id']};}));return ChatMessage[_0xee11('0xc')]({'where':{'ChatInteractionId':_0x2ce7aa['id'],'direction':'in','read':![]},'raw':!![]});})[_0xee11('0x8')](function(_0x4042aa){_0x2ce7aa[_0xee11('0x9')](_0xee11('0xd'),_0x4042aa[_0xee11('0xe')]);ChatInteractionEvents[_0xee11('0xf')](_0x518d47+':'+_0x2ce7aa['id'],_0x2ce7aa);ChatInteractionEvents[_0xee11('0xf')](_0x518d47,_0x2ce7aa);_0x10d853(null);})[_0xee11('0x10')](_0x10d853(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInteraction['hook'](e,emitEvent(event));}}module[_0xee11('0x11')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index bd2576d..9e7d4cd 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 _0xcc3f=['rimraf','../../config/environment','./chatInteraction.attributes','ChatInteraction','format','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x5972a0,_0x4d8087){var _0x5ba972=function(_0x3250d9){while(--_0x3250d9){_0x5972a0['push'](_0x5972a0['shift']());}};_0x5ba972(++_0x4d8087);}(_0xcc3f,0xa8));var _0xfcc3=function(_0x4bc84d,_0x31d7ea){_0x4bc84d=_0x4bc84d-0x0;var _0x576234=_0xcc3f[_0x4bc84d];return _0x576234;};'use strict';var _=require(_0xfcc3('0x0'));var util=require(_0xfcc3('0x1'));var logger=require(_0xfcc3('0x2'))(_0xfcc3('0x3'));var moment=require(_0xfcc3('0x4'));var BPromise=require(_0xfcc3('0x5'));var rp=require(_0xfcc3('0x6'));var fs=require('fs');var path=require(_0xfcc3('0x7'));var rimraf=require(_0xfcc3('0x8'));var config=require(_0xfcc3('0x9'));var attributes=require(_0xfcc3('0xa'));module['exports']=function(_0xadd71,_0x1bc20c){return _0xadd71['define'](_0xfcc3('0xb'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2b2ad7,_0x2b50ae,_0x2f21ec){if(_0x2b2ad7['changed']('closed')){_0x2b2ad7['closedAt']=moment()[_0xfcc3('0xc')](_0xfcc3('0xd'));}_0x2f21ec(null,_0x2b2ad7);}},'charset':_0xfcc3('0xe'),'collate':_0xfcc3('0xf')});}; \ No newline at end of file +var _0x412c=['ChatInteraction','changed','closed','YYYY-MM-DD\x20HH:mm:ss','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','path','../../config/environment','exports','define'];(function(_0x15dbca,_0x1d7c3c){var _0x326533=function(_0x507ee2){while(--_0x507ee2){_0x15dbca['push'](_0x15dbca['shift']());}};_0x326533(++_0x1d7c3c);}(_0x412c,0x13a));var _0xc412=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x412c[_0x126558];return _0x1f6d14;};'use strict';var _=require('lodash');var util=require(_0xc412('0x0'));var logger=require(_0xc412('0x1'))(_0xc412('0x2'));var moment=require(_0xc412('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc412('0x4'));var rimraf=require('rimraf');var config=require(_0xc412('0x5'));var attributes=require('./chatInteraction.attributes');module[_0xc412('0x6')]=function(_0x2c3876,_0x2b8ae6){return _0x2c3876[_0xc412('0x7')](_0xc412('0x8'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3ef99d,_0x2cf324,_0x43799d){if(_0x3ef99d[_0xc412('0x9')](_0xc412('0xa'))){_0x3ef99d['closedAt']=moment()['format'](_0xc412('0xb'));}_0x43799d(null,_0x3ef99d);}},'charset':_0xc412('0xc'),'collate':_0xc412('0xd')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index bccd04f..0245ff4 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 _0x2b6e=['then','info','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','ChatInteraction,\x20%s,\x20%s','UpdateChatInteraction','ChatInteraction','update','body','options','raw','where','limit','catch','AddTagsToChatInteraction','addTags','ids','omit','AddTags','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./chatInteraction.socket','register','request'];(function(_0x5000cc,_0x1eec1d){var _0x20aa1d=function(_0xa3f4af){while(--_0xa3f4af){_0x5000cc['push'](_0x5000cc['shift']());}};_0x20aa1d(++_0x1eec1d);}(_0x2b6e,0x191));var _0xe2b6=function(_0x78d9f7,_0x5c6284){_0x78d9f7=_0x78d9f7-0x0;var _0x5c9987=_0x2b6e[_0x78d9f7];return _0x5c9987;};'use strict';var _=require(_0xe2b6('0x0'));var util=require(_0xe2b6('0x1'));var moment=require(_0xe2b6('0x2'));var BPromise=require('bluebird');var rs=require(_0xe2b6('0x3'));var fs=require('fs');var Redis=require(_0xe2b6('0x4'));var db=require(_0xe2b6('0x5'))['db'];var utils=require(_0xe2b6('0x6'));var logger=require(_0xe2b6('0x7'))(_0xe2b6('0x8'));var config=require(_0xe2b6('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xe2b6('0xa')][_0xe2b6('0xb')]({'port':0x232a});config[_0xe2b6('0xc')]=_[_0xe2b6('0xd')](config[_0xe2b6('0xc')],{'host':_0xe2b6('0xe'),'port':0x18eb});var socket=require(_0xe2b6('0xf'))(new Redis(config['redis']));require(_0xe2b6('0x10'))[_0xe2b6('0x11')](socket);function respondWithRpcPromise(_0xa8a655,_0x1fd3ef,_0x47f23b){return new BPromise(function(_0x207c1b,_0x988d4f){return client[_0xe2b6('0x12')](_0xa8a655,_0x47f23b)[_0xe2b6('0x13')](function(_0x5cc0ba){logger[_0xe2b6('0x14')]('ChatInteraction,\x20%s,\x20%s',_0x1fd3ef,_0xe2b6('0x15'));logger[_0xe2b6('0x16')](_0xe2b6('0x17'),_0x1fd3ef,_0xe2b6('0x15'),JSON[_0xe2b6('0x18')](_0x5cc0ba));if(_0x5cc0ba[_0xe2b6('0x19')]){if(_0x5cc0ba[_0xe2b6('0x19')]['code']===0x1f4){logger[_0xe2b6('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x1fd3ef,_0x5cc0ba[_0xe2b6('0x19')][_0xe2b6('0x1a')]);return _0x988d4f(_0x5cc0ba[_0xe2b6('0x19')]['message']);}logger['error'](_0xe2b6('0x1b'),_0x1fd3ef,_0x5cc0ba['error'][_0xe2b6('0x1a')]);return _0x207c1b(_0x5cc0ba['error']['message']);}else{logger[_0xe2b6('0x14')](_0xe2b6('0x1b'),_0x1fd3ef,_0xe2b6('0x15'));_0x207c1b(_0x5cc0ba['result']['message']);}})['catch'](function(_0x456d0b){logger[_0xe2b6('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x1fd3ef,_0x456d0b);_0x988d4f(_0x456d0b);});});}exports[_0xe2b6('0x1c')]=function(_0x4bbb0f){var _0x4b77f0=this;return new Promise(function(_0x1c4626,_0x2b2a64){return db[_0xe2b6('0x1d')][_0xe2b6('0x1e')](_0x4bbb0f[_0xe2b6('0x1f')],{'raw':_0x4bbb0f[_0xe2b6('0x20')]?_0x4bbb0f[_0xe2b6('0x20')][_0xe2b6('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4bbb0f[_0xe2b6('0x20')]?_0x4bbb0f[_0xe2b6('0x20')][_0xe2b6('0x22')]||null:null,'attributes':_0x4bbb0f['options']?_0x4bbb0f[_0xe2b6('0x20')]['attributes']||null:null,'limit':_0x4bbb0f[_0xe2b6('0x20')]?_0x4bbb0f[_0xe2b6('0x20')][_0xe2b6('0x23')]||null:null})[_0xe2b6('0x13')](function(_0x3d00a1){logger['info']('UpdateChatInteraction',_0x4bbb0f);logger[_0xe2b6('0x16')](_0xe2b6('0x1c'),_0x4bbb0f,JSON[_0xe2b6('0x18')](_0x3d00a1));_0x1c4626(_0x3d00a1);})[_0xe2b6('0x24')](function(_0x1cd31f){logger[_0xe2b6('0x19')](_0xe2b6('0x1c'),_0x1cd31f[_0xe2b6('0x1a')],_0x4bbb0f);_0x2b2a64(_0x4b77f0[_0xe2b6('0x19')](0x1f4,_0x1cd31f['message']));});});};exports[_0xe2b6('0x25')]=function(_0x47da10){return new Promise(function(_0x5010af,_0x2c96eb){return db[_0xe2b6('0x1d')]['find']({'where':_0x47da10[_0xe2b6('0x20')]?_0x47da10[_0xe2b6('0x20')]['where']||null:null})['then'](function(_0x28a42e){if(_0x28a42e){return _0x28a42e[_0xe2b6('0x26')](_0x47da10[_0xe2b6('0x1f')][_0xe2b6('0x27')],_[_0xe2b6('0x28')](_0x47da10[_0xe2b6('0x1f')],[_0xe2b6('0x27'),'id'])||{});}})['spread'](function(_0x23a08f){logger[_0xe2b6('0x14')]('AddTags',_0x47da10);logger[_0xe2b6('0x16')](_0xe2b6('0x29'),_0x47da10,JSON[_0xe2b6('0x18')](_0x23a08f));_0x5010af(_0x23a08f);})['catch'](function(_0x4fc9cb){logger[_0xe2b6('0x19')]('AddTags',_0x4fc9cb[_0xe2b6('0x1a')],_0x47da10);_0x2c96eb(_this[_0xe2b6('0x19')](0x1f4,_0x4fc9cb['message']));});});}; \ No newline at end of file +var _0x2082=['../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','./chatInteraction.socket','register','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateChatInteraction','update','body','options','raw','where','attributes','limit','AddTagsToChatInteraction','ChatInteraction','find','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4a53d,_0x58a95e){var _0x27410e=function(_0x38fc90){while(--_0x38fc90){_0x4a53d['push'](_0x4a53d['shift']());}};_0x27410e(++_0x58a95e);}(_0x2082,0x120));var _0x2208=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x2082[_0x1c34e7];return _0x378cb1;};'use strict';var _=require(_0x2208('0x0'));var util=require(_0x2208('0x1'));var moment=require('moment');var BPromise=require(_0x2208('0x2'));var rs=require(_0x2208('0x3'));var fs=require('fs');var Redis=require(_0x2208('0x4'));var db=require(_0x2208('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2208('0x6'))('rpc');var config=require(_0x2208('0x7'));var jayson=require(_0x2208('0x8'));var client=jayson[_0x2208('0x9')][_0x2208('0xa')]({'port':0x232a});config[_0x2208('0xb')]=_['defaults'](config['redis'],{'host':_0x2208('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x2208('0xd'))[_0x2208('0xe')](socket);function respondWithRpcPromise(_0x518500,_0x13e401,_0x50f4ae){return new BPromise(function(_0x8d4c02,_0x3a00e4){return client[_0x2208('0xf')](_0x518500,_0x50f4ae)[_0x2208('0x10')](function(_0x3f2aee){logger[_0x2208('0x11')](_0x2208('0x12'),_0x13e401,_0x2208('0x13'));logger[_0x2208('0x14')](_0x2208('0x15'),_0x13e401,_0x2208('0x13'),JSON[_0x2208('0x16')](_0x3f2aee));if(_0x3f2aee[_0x2208('0x17')]){if(_0x3f2aee[_0x2208('0x17')][_0x2208('0x18')]===0x1f4){logger[_0x2208('0x17')](_0x2208('0x12'),_0x13e401,_0x3f2aee[_0x2208('0x17')]['message']);return _0x3a00e4(_0x3f2aee['error'][_0x2208('0x19')]);}logger['error'](_0x2208('0x12'),_0x13e401,_0x3f2aee[_0x2208('0x17')]['message']);return _0x8d4c02(_0x3f2aee[_0x2208('0x17')][_0x2208('0x19')]);}else{logger[_0x2208('0x11')](_0x2208('0x12'),_0x13e401,'request\x20sent');_0x8d4c02(_0x3f2aee[_0x2208('0x1a')]['message']);}})[_0x2208('0x1b')](function(_0x26405e){logger[_0x2208('0x17')](_0x2208('0x12'),_0x13e401,_0x26405e);_0x3a00e4(_0x26405e);});});}exports[_0x2208('0x1c')]=function(_0x532e6e){var _0x17381d=this;return new Promise(function(_0x4f69e1,_0x58c718){return db['ChatInteraction'][_0x2208('0x1d')](_0x532e6e[_0x2208('0x1e')],{'raw':_0x532e6e[_0x2208('0x1f')]?_0x532e6e[_0x2208('0x1f')][_0x2208('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x532e6e[_0x2208('0x1f')]?_0x532e6e['options'][_0x2208('0x21')]||null:null,'attributes':_0x532e6e['options']?_0x532e6e[_0x2208('0x1f')][_0x2208('0x22')]||null:null,'limit':_0x532e6e['options']?_0x532e6e[_0x2208('0x1f')][_0x2208('0x23')]||null:null})[_0x2208('0x10')](function(_0x2e772c){logger[_0x2208('0x11')](_0x2208('0x1c'),_0x532e6e);logger[_0x2208('0x14')](_0x2208('0x1c'),_0x532e6e,JSON['stringify'](_0x2e772c));_0x4f69e1(_0x2e772c);})[_0x2208('0x1b')](function(_0x2616af){logger['error'](_0x2208('0x1c'),_0x2616af[_0x2208('0x19')],_0x532e6e);_0x58c718(_0x17381d[_0x2208('0x17')](0x1f4,_0x2616af[_0x2208('0x19')]));});});};exports[_0x2208('0x24')]=function(_0x2e65fc){return new Promise(function(_0x506211,_0x7255b6){return db[_0x2208('0x25')][_0x2208('0x26')]({'where':_0x2e65fc[_0x2208('0x1f')]?_0x2e65fc[_0x2208('0x1f')][_0x2208('0x21')]||null:null})['then'](function(_0x3d8a8a){if(_0x3d8a8a){return _0x3d8a8a['addTags'](_0x2e65fc[_0x2208('0x1e')][_0x2208('0x27')],_['omit'](_0x2e65fc[_0x2208('0x1e')],[_0x2208('0x27'),'id'])||{});}})[_0x2208('0x28')](function(_0x5210db){logger[_0x2208('0x11')](_0x2208('0x29'),_0x2e65fc);logger['debug']('AddTags',_0x2e65fc,JSON['stringify'](_0x5210db));_0x506211(_0x5210db);})['catch'](function(_0x2a29df){logger[_0x2208('0x17')](_0x2208('0x29'),_0x2a29df[_0x2208('0x19')],_0x2e65fc);_0x7255b6(_this['error'](0x1f4,_0x2a29df[_0x2208('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index f539f04..efa4f72 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 _0xc6e2=['save','emit','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x3fabcd,_0x263514){var _0x1127b9=function(_0x4773d0){while(--_0x4773d0){_0x3fabcd['push'](_0x3fabcd['shift']());}};_0x1127b9(++_0x263514);}(_0xc6e2,0x12b));var _0x2c6e=function(_0x93ce2f,_0xa2a1bc){_0x93ce2f=_0x93ce2f-0x0;var _0x50bb5b=_0xc6e2[_0x93ce2f];return _0x50bb5b;};'use strict';var ChatInteractionEvents=require(_0x2c6e('0x0'));var events=[_0x2c6e('0x1'),'remove','update'];function createListener(_0xc4bc05,_0x7105e0){return function(_0x28b99f){_0x7105e0[_0x2c6e('0x2')](_0xc4bc05,_0x28b99f);};}function removeListener(_0x4de0f0,_0x50c9e7){return function(){ChatInteractionEvents['removeListener'](_0x4de0f0,_0x50c9e7);};}exports[_0x2c6e('0x3')]=function(_0xb331a3){for(var _0x5544e6=0x0,_0x1a0230=events[_0x2c6e('0x4')];_0x5544e6<_0x1a0230;_0x5544e6++){var _0x2b3483=events[_0x5544e6];var _0x3d73d5=createListener(_0x2c6e('0x5')+_0x2b3483,_0xb331a3);ChatInteractionEvents['on'](_0x2b3483,_0x3d73d5);}}; \ No newline at end of file +var _0x34ee=['remove','register','length','chatInteraction:','./chatInteraction.events'];(function(_0x4d079e,_0x49c226){var _0x202acf=function(_0x281265){while(--_0x281265){_0x4d079e['push'](_0x4d079e['shift']());}};_0x202acf(++_0x49c226);}(_0x34ee,0x144));var _0xe34e=function(_0x36d2a1,_0x176456){_0x36d2a1=_0x36d2a1-0x0;var _0x5de65d=_0x34ee[_0x36d2a1];return _0x5de65d;};'use strict';var ChatInteractionEvents=require(_0xe34e('0x0'));var events=['save',_0xe34e('0x1'),'update'];function createListener(_0x30b758,_0x5cbed4){return function(_0x12afb6){_0x5cbed4['emit'](_0x30b758,_0x12afb6);};}function removeListener(_0x2890db,_0x193ac2){return function(){ChatInteractionEvents['removeListener'](_0x2890db,_0x193ac2);};}exports[_0xe34e('0x2')]=function(_0x14930d){for(var _0x42aff0=0x0,_0x449ca4=events[_0xe34e('0x3')];_0x42aff0<_0x449ca4;_0x42aff0++){var _0x3832c9=events[_0x42aff0];var _0x3954f4=createListener(_0xe34e('0x4')+_0x3832c9,_0x14930d);ChatInteractionEvents['on'](_0x3832c9,_0x3954f4);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 50e71a2..f3ee05a 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 _0xcbb3=['../../config/environment','./chatInteraction.controller','index','get','/describe','isAuthenticated','describe','/:id','/:id/attachment_download','isChatInteractionAuthorized','attachmentDownload','/:id/messages','getMessages','/:id/download','post','create','/:id/vidaoo','createVidaooSession','join','root','format','%s-%s','now','originalname','replace','/:id/attachment_upload','attachmentUpload','addMessage','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','abandon','/:id/close','close','delete','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x55f8e8,_0x214e8d){var _0x5c24a1=function(_0x3c8f7a){while(--_0x3c8f7a){_0x55f8e8['push'](_0x55f8e8['shift']());}};_0x5c24a1(++_0x214e8d);}(_0xcbb3,0x9a));var _0x3cbb=function(_0x5bd55c,_0x38eb2a){_0x5bd55c=_0x5bd55c-0x0;var _0x44f70f=_0xcbb3[_0x5bd55c];return _0x44f70f;};'use strict';var multer=require(_0x3cbb('0x0'));var util=require('util');var path=require(_0x3cbb('0x1'));var timeout=require(_0x3cbb('0x2'));var express=require(_0x3cbb('0x3'));var router=express[_0x3cbb('0x4')]();var fs_extra=require(_0x3cbb('0x5'));var auth=require(_0x3cbb('0x6'));var interaction=require(_0x3cbb('0x7'));var config=require(_0x3cbb('0x8'));var controller=require(_0x3cbb('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x3cbb('0xa')]);router[_0x3cbb('0xb')](_0x3cbb('0xc'),auth[_0x3cbb('0xd')](),controller[_0x3cbb('0xe')]);router[_0x3cbb('0xb')](_0x3cbb('0xf'),auth['isChatInteractionAuthorized'](),controller['show']);router[_0x3cbb('0xb')](_0x3cbb('0x10'),auth[_0x3cbb('0x11')](),controller[_0x3cbb('0x12')]);router[_0x3cbb('0xb')](_0x3cbb('0x13'),auth[_0x3cbb('0xd')](),controller[_0x3cbb('0x14')]);router['get']('/:id/my_messages',auth[_0x3cbb('0x11')](),controller['getMyMessages']);router[_0x3cbb('0xb')](_0x3cbb('0x15'),auth['isAuthenticated'](),controller['download']);router[_0x3cbb('0x16')]('/',auth[_0x3cbb('0xd')](),controller[_0x3cbb('0x17')]);router[_0x3cbb('0x16')](_0x3cbb('0x18'),auth[_0x3cbb('0xd')](),controller[_0x3cbb('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x492ee6,_0x229e64,_0x12793e){_0x12793e(null,path[_0x3cbb('0x1a')](config[_0x3cbb('0x1b')],'server/files/attachments/'));},'filename':function(_0x23ad8b,_0x460c0f,_0x4a47fd){_0x4a47fd(null,util[_0x3cbb('0x1c')](_0x3cbb('0x1d'),Date[_0x3cbb('0x1e')](),_0x460c0f[_0x3cbb('0x1f')][_0x3cbb('0x20')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x3cbb('0x16')](_0x3cbb('0x21'),upload['single']('file'),controller[_0x3cbb('0x22')]);router[_0x3cbb('0x16')](_0x3cbb('0x13'),auth[_0x3cbb('0x11')](),controller[_0x3cbb('0x23')]);router[_0x3cbb('0x16')]('/:id/tags',auth[_0x3cbb('0xd')](),interaction[_0x3cbb('0x24')](_0x3cbb('0x25'),_0x3cbb('0x26')),controller[_0x3cbb('0x27')]);router[_0x3cbb('0x28')](_0x3cbb('0xf'),auth[_0x3cbb('0xd')](),interaction[_0x3cbb('0x24')](_0x3cbb('0x25'),_0x3cbb('0x29')),controller['update']);router[_0x3cbb('0x28')](_0x3cbb('0x2a'),controller[_0x3cbb('0x2b')]);router['put'](_0x3cbb('0x2c'),auth['isChatInteractionAuthorized'](),controller[_0x3cbb('0x2d')]);router[_0x3cbb('0x28')](_0x3cbb('0x2e'),controller[_0x3cbb('0x2f')]);router[_0x3cbb('0x30')]('/:id',auth[_0x3cbb('0xd')](),interaction[_0x3cbb('0x24')](_0x3cbb('0x25'),_0x3cbb('0x31')),controller[_0x3cbb('0x32')]);router[_0x3cbb('0x30')](_0x3cbb('0x33'),auth[_0x3cbb('0xd')](),controller[_0x3cbb('0x34')]);module[_0x3cbb('0x35')]=router; \ No newline at end of file +var _0x2880=['/:id/attachment_upload','file','addMessage','/:id/tags','tracked','chatinteraction:addtags','addTags','put','chat','chatinteraction:update','update','/:id/custom_update','customUpdate','/:id/abandon','abandon','close','delete','chatinteraction:destroy','destroy','removeTags','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','./chatInteraction.controller','get','index','isAuthenticated','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','replace'];(function(_0x5a4400,_0xfae3b6){var _0xf9b532=function(_0x39804e){while(--_0x39804e){_0x5a4400['push'](_0x5a4400['shift']());}};_0xf9b532(++_0xfae3b6);}(_0x2880,0x1e0));var _0x0288=function(_0x3eb435,_0x3be1e3){_0x3eb435=_0x3eb435-0x0;var _0x42203d=_0x2880[_0x3eb435];return _0x42203d;};'use strict';var multer=require('multer');var util=require(_0x0288('0x0'));var path=require(_0x0288('0x1'));var timeout=require(_0x0288('0x2'));var express=require(_0x0288('0x3'));var router=express['Router']();var fs_extra=require(_0x0288('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x0288('0x5'));var config=require('../../config/environment');var controller=require(_0x0288('0x6'));router[_0x0288('0x7')]('/',auth['isAuthenticated'](),controller[_0x0288('0x8')]);router['get']('/describe',auth[_0x0288('0x9')](),controller['describe']);router['get'](_0x0288('0xa'),auth[_0x0288('0xb')](),controller[_0x0288('0xc')]);router[_0x0288('0x7')]('/:id/attachment_download',auth[_0x0288('0xb')](),controller[_0x0288('0xd')]);router['get'](_0x0288('0xe'),auth[_0x0288('0x9')](),controller[_0x0288('0xf')]);router[_0x0288('0x7')](_0x0288('0x10'),auth[_0x0288('0xb')](),controller['getMyMessages']);router[_0x0288('0x7')](_0x0288('0x11'),auth[_0x0288('0x9')](),controller[_0x0288('0x12')]);router[_0x0288('0x13')]('/',auth[_0x0288('0x9')](),controller[_0x0288('0x14')]);router['post'](_0x0288('0x15'),auth[_0x0288('0x9')](),controller[_0x0288('0x16')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x21208f,_0x5419a8,_0x421c30){_0x421c30(null,path[_0x0288('0x17')](config[_0x0288('0x18')],_0x0288('0x19')));},'filename':function(_0x7206,_0x5686dc,_0x44c1ee){_0x44c1ee(null,util[_0x0288('0x1a')](_0x0288('0x1b'),Date[_0x0288('0x1c')](),_0x5686dc['originalname'][_0x0288('0x1d')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x0288('0x13')](_0x0288('0x1e'),upload['single'](_0x0288('0x1f')),controller['attachmentUpload']);router[_0x0288('0x13')](_0x0288('0xe'),auth['isChatInteractionAuthorized'](),controller[_0x0288('0x20')]);router[_0x0288('0x13')](_0x0288('0x21'),auth['isAuthenticated'](),interaction[_0x0288('0x22')]('chat',_0x0288('0x23')),controller[_0x0288('0x24')]);router[_0x0288('0x25')](_0x0288('0xa'),auth['isAuthenticated'](),interaction[_0x0288('0x22')](_0x0288('0x26'),_0x0288('0x27')),controller[_0x0288('0x28')]);router[_0x0288('0x25')](_0x0288('0x29'),controller[_0x0288('0x2a')]);router[_0x0288('0x25')](_0x0288('0x2b'),auth[_0x0288('0xb')](),controller[_0x0288('0x2c')]);router['put']('/:id/close',controller[_0x0288('0x2d')]);router[_0x0288('0x2e')](_0x0288('0xa'),auth['isAuthenticated'](),interaction[_0x0288('0x22')]('chat',_0x0288('0x2f')),controller[_0x0288('0x30')]);router['delete'](_0x0288('0x21'),auth[_0x0288('0x9')](),controller[_0x0288('0x31')]);module[_0x0288('0x32')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 1b8f661..092684c 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 _0xcdfc=['BOOLEAN','exports','TEXT','medium'];(function(_0x59bc73,_0xa0742c){var _0x284358=function(_0x49e50c){while(--_0x49e50c){_0x59bc73['push'](_0x59bc73['shift']());}};_0x284358(++_0xa0742c);}(_0xcdfc,0xf9));var _0xccdf=function(_0x11ef16,_0x113d6f){_0x11ef16=_0x11ef16-0x0;var _0x510a6a=_0xcdfc[_0x11ef16];return _0x510a6a;};'use strict';var Sequelize=require('sequelize');module[_0xccdf('0x0')]={'body':{'type':Sequelize[_0xccdf('0x1')](_0xccdf('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0xccdf('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xab2a=['exports','TEXT','medium','INTEGER','sequelize'];(function(_0xa3d535,_0x135979){var _0x3e4408=function(_0x3476c0){while(--_0x3476c0){_0xa3d535['push'](_0xa3d535['shift']());}};_0x3e4408(++_0x135979);}(_0xab2a,0xf9));var _0xaab2=function(_0x247b37,_0x510538){_0x247b37=_0x247b37-0x0;var _0x3faad2=_0xab2a[_0x247b37];return _0x3faad2;};'use strict';var Sequelize=require(_0xaab2('0x0'));module[_0xaab2('0x1')]={'body':{'type':Sequelize[_0xaab2('0x2')](_0xaab2('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xaab2('0x4')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index b299d06..70ab41b 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 _0x6157=['to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','register','sendStatus','status','json','offset','undefined','limit','count','apply','save','update','then','stack','name','send','index','map','ChatInternalMessage','fieldName','type','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','destroy','describe','get','messages','lastMessageAt','lastMessage','YYYY-MM-DD\x20HH:mm:ss','User','agent','admin','fullname','internal','online','showWebBar','-online','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','autoAssociation','UserProfileResource','isEmpty','role','resourceId','push','createdAt','FromId','ToId','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x6157,0x139));var _0x7615=function(_0xd06c7e,_0x5c5482){_0xd06c7e=_0xd06c7e-0x0;var _0x4dc139=_0x6157[_0xd06c7e];return _0x4dc139;};'use strict';var emlformat=require(_0x7615('0x0'));var rimraf=require(_0x7615('0x1'));var zipdir=require(_0x7615('0x2'));var jsonpatch=require(_0x7615('0x3'));var rp=require('request-promise');var moment=require(_0x7615('0x4'));var BPromise=require(_0x7615('0x5'));var Mustache=require(_0x7615('0x6'));var util=require('util');var path=require('path');var sox=require(_0x7615('0x7'));var csv=require(_0x7615('0x8'));var ejs=require(_0x7615('0x9'));var fs=require('fs');var fs_extra=require(_0x7615('0xa'));var _=require(_0x7615('0xb'));var squel=require(_0x7615('0xc'));var crypto=require('crypto');var jsforce=require(_0x7615('0xd'));var deskjs=require(_0x7615('0xe'));var toCsv=require(_0x7615('0x8'));var querystring=require('querystring');var Papa=require(_0x7615('0xf'));var Redis=require('ioredis');var authService=require(_0x7615('0x10'));var qs=require(_0x7615('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x7615('0x12'));var logger=require(_0x7615('0x13'))('api');var utils=require(_0x7615('0x14'));var config=require(_0x7615('0x15'));var licenseUtil=require(_0x7615('0x16'));var db=require('../../mysqldb')['db'];config[_0x7615('0x17')]=_[_0x7615('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7615('0x19'))(new Redis(config[_0x7615('0x17')]));require(_0x7615('0x1a'))[_0x7615('0x1b')](socket);function respondWithStatusCode(_0x465363,_0x5bc389){_0x5bc389=_0x5bc389||0xcc;return function(_0x2eb7c2){if(_0x2eb7c2){return _0x465363[_0x7615('0x1c')](_0x5bc389);}return _0x465363[_0x7615('0x1d')](_0x5bc389)['end']();};}function respondWithResult(_0x5ad8cb,_0x3b8a9e){_0x3b8a9e=_0x3b8a9e||0xc8;return function(_0x230e2b){if(_0x230e2b){return _0x5ad8cb[_0x7615('0x1d')](_0x3b8a9e)[_0x7615('0x1e')](_0x230e2b);}};}function respondWithFilteredResult(_0x5dcee3,_0x13b229){return function(_0x46116b){if(_0x46116b){var _0x508b85=typeof _0x13b229[_0x7615('0x1f')]===_0x7615('0x20')&&typeof _0x13b229[_0x7615('0x21')]==='undefined';var _0x2f910f=_0x46116b['count'];var _0x1e9f6e=_0x508b85?0x0:_0x13b229[_0x7615('0x1f')];var _0x3b5302=_0x508b85?_0x46116b[_0x7615('0x22')]:_0x13b229[_0x7615('0x1f')]+_0x13b229['limit'];var _0x48dcf6;if(_0x3b5302>=_0x2f910f){_0x3b5302=_0x2f910f;_0x48dcf6=0xc8;}else{_0x48dcf6=0xce;}_0x5dcee3[_0x7615('0x1d')](_0x48dcf6);return _0x5dcee3['set']('Content-Range',_0x1e9f6e+'-'+_0x3b5302+'/'+_0x2f910f)[_0x7615('0x1e')](_0x46116b);}return null;};}function patchUpdates(_0x436161){return function(_0x23287f){try{jsonpatch[_0x7615('0x23')](_0x23287f,_0x436161,!![]);}catch(_0x2d186b){return BPromise['reject'](_0x2d186b);}return _0x23287f[_0x7615('0x24')]();};}function saveUpdates(_0x2eb8e0,_0x394a0b){return function(_0x55c0ea){if(_0x55c0ea){return _0x55c0ea[_0x7615('0x25')](_0x2eb8e0)[_0x7615('0x26')](function(_0x436bf2){return _0x436bf2;});}return null;};}function removeEntity(_0xf33f73,_0x28b6cf){return function(_0x3c6e8a){if(_0x3c6e8a){return _0x3c6e8a['destroy']()[_0x7615('0x26')](function(){_0xf33f73[_0x7615('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5718a8,_0x274810){return function(_0x4f1799){if(!_0x4f1799){_0x5718a8[_0x7615('0x1c')](0x194);}return _0x4f1799;};}function handleError(_0x1e93d6,_0x399262){_0x399262=_0x399262||0x1f4;return function(_0x533568){logger['error'](_0x533568[_0x7615('0x27')]);if(_0x533568[_0x7615('0x28')]){delete _0x533568[_0x7615('0x28')];}_0x1e93d6[_0x7615('0x1d')](_0x399262)[_0x7615('0x29')](_0x533568);};}exports[_0x7615('0x2a')]=function(_0x579f8d,_0x8e5735){var _0x3f8c0b={},_0x551921={},_0xabdc25={'count':0x0,'rows':[]};var _0x4d5717=_[_0x7615('0x2b')](db[_0x7615('0x2c')]['rawAttributes'],function(_0x40892f){return{'name':_0x40892f[_0x7615('0x2d')],'type':_0x40892f[_0x7615('0x2e')]['key']};});_0x551921['model']=_[_0x7615('0x2b')](_0x4d5717,_0x7615('0x28'));_0x551921['query']=_[_0x7615('0x2f')](_0x579f8d[_0x7615('0x30')]);_0x551921[_0x7615('0x31')]=_['intersection'](_0x551921[_0x7615('0x32')],_0x551921[_0x7615('0x30')]);_0x3f8c0b[_0x7615('0x33')]=_[_0x7615('0x34')](_0x551921['model'],qs[_0x7615('0x35')](_0x579f8d[_0x7615('0x30')][_0x7615('0x35')]));_0x3f8c0b[_0x7615('0x33')]=_0x3f8c0b[_0x7615('0x33')][_0x7615('0x36')]?_0x3f8c0b[_0x7615('0x33')]:_0x551921['model'];if(!_0x579f8d[_0x7615('0x30')][_0x7615('0x37')](_0x7615('0x38'))){_0x3f8c0b[_0x7615('0x21')]=qs[_0x7615('0x21')](_0x579f8d[_0x7615('0x30')][_0x7615('0x21')]);_0x3f8c0b[_0x7615('0x1f')]=qs[_0x7615('0x1f')](_0x579f8d[_0x7615('0x30')][_0x7615('0x1f')]);}_0x3f8c0b[_0x7615('0x39')]=qs[_0x7615('0x3a')](_0x579f8d[_0x7615('0x30')][_0x7615('0x3a')]);_0x3f8c0b[_0x7615('0x3b')]=qs[_0x7615('0x31')](_['pick'](_0x579f8d[_0x7615('0x30')],_0x551921['filters']),_0x4d5717);if(_0x579f8d['query'][_0x7615('0x3c')]){_0x3f8c0b[_0x7615('0x3b')]=_[_0x7615('0x3d')](_0x3f8c0b[_0x7615('0x3b')],{'$or':_['map'](_0x4d5717,function(_0x3afd96){if(_0x3afd96[_0x7615('0x2e')]!==_0x7615('0x3e')){var _0x400fe7={};_0x400fe7[_0x3afd96[_0x7615('0x28')]]={'$like':'%'+_0x579f8d[_0x7615('0x30')][_0x7615('0x3c')]+'%'};return _0x400fe7;}})});}_0x3f8c0b=_[_0x7615('0x3d')]({},_0x3f8c0b,_0x579f8d[_0x7615('0x3f')]);var _0x1ea588={'where':_0x3f8c0b[_0x7615('0x3b')]};return db['ChatInternalMessage'][_0x7615('0x22')](_0x1ea588)[_0x7615('0x26')](function(_0x24d5ce){_0xabdc25['count']=_0x24d5ce;if(_0x579f8d[_0x7615('0x30')][_0x7615('0x40')]){_0x3f8c0b[_0x7615('0x41')]=[{'all':!![]}];}return db[_0x7615('0x2c')][_0x7615('0x42')](_0x3f8c0b);})[_0x7615('0x26')](function(_0x36823a){_0xabdc25[_0x7615('0x43')]=_0x36823a;return _0xabdc25;})['then'](respondWithFilteredResult(_0x8e5735,_0x3f8c0b))[_0x7615('0x44')](handleError(_0x8e5735,null));};exports[_0x7615('0x45')]=function(_0x5ffe09,_0x41b6b9){var _0x5edca1={'raw':!![],'where':{'id':_0x5ffe09[_0x7615('0x46')]['id']}},_0x477be4={};_0x477be4[_0x7615('0x32')]=_[_0x7615('0x2f')](db[_0x7615('0x2c')][_0x7615('0x47')]);_0x477be4[_0x7615('0x30')]=_[_0x7615('0x2f')](_0x5ffe09[_0x7615('0x30')]);_0x477be4[_0x7615('0x31')]=_['intersection'](_0x477be4[_0x7615('0x32')],_0x477be4[_0x7615('0x30')]);_0x5edca1['attributes']=_[_0x7615('0x34')](_0x477be4[_0x7615('0x32')],qs['fields'](_0x5ffe09[_0x7615('0x30')]['fields']));_0x5edca1[_0x7615('0x33')]=_0x5edca1[_0x7615('0x33')]['length']?_0x5edca1[_0x7615('0x33')]:_0x477be4['model'];if(_0x5ffe09[_0x7615('0x30')][_0x7615('0x40')]){_0x5edca1[_0x7615('0x41')]=[{'all':!![]}];}_0x5edca1=_['merge']({},_0x5edca1,_0x5ffe09[_0x7615('0x3f')]);return db[_0x7615('0x2c')][_0x7615('0x48')](_0x5edca1)[_0x7615('0x26')](handleEntityNotFound(_0x41b6b9,null))[_0x7615('0x26')](respondWithResult(_0x41b6b9,null))[_0x7615('0x44')](handleError(_0x41b6b9,null));};exports['create']=function(_0x24c0fd,_0x2b12e6){return db[_0x7615('0x2c')][_0x7615('0x49')](_0x24c0fd[_0x7615('0x4a')],{})[_0x7615('0x26')](respondWithResult(_0x2b12e6,0xc9))[_0x7615('0x44')](handleError(_0x2b12e6,null));};exports['update']=function(_0x4ebd0d,_0x1f5789){if(_0x4ebd0d['body']['id']){delete _0x4ebd0d[_0x7615('0x4a')]['id'];}return db[_0x7615('0x2c')][_0x7615('0x48')]({'where':{'id':_0x4ebd0d['params']['id']}})[_0x7615('0x26')](handleEntityNotFound(_0x1f5789,null))['then'](saveUpdates(_0x4ebd0d[_0x7615('0x4a')],null))[_0x7615('0x26')](respondWithResult(_0x1f5789,null))[_0x7615('0x44')](handleError(_0x1f5789,null));};exports[_0x7615('0x4b')]=function(_0x3681aa,_0x3eb630){return db[_0x7615('0x2c')][_0x7615('0x48')]({'where':{'id':_0x3681aa['params']['id']}})[_0x7615('0x26')](handleEntityNotFound(_0x3eb630,null))[_0x7615('0x26')](removeEntity(_0x3eb630,null))[_0x7615('0x44')](handleError(_0x3eb630,null));};exports[_0x7615('0x4c')]=function(_0xc95ea,_0x4a3cd8){return db[_0x7615('0x2c')][_0x7615('0x4c')]()['then'](respondWithResult(_0x4a3cd8,null))[_0x7615('0x44')](handleError(_0x4a3cd8,null));};function wrapUser(_0x3f37c2){return function(_0x1b6724){var _0x15cfe6=_0x3f37c2[_0x7615('0x4d')]({'plain':!![]});_0x15cfe6[_0x7615('0x4e')]=[];if(_0x1b6724){_0x15cfe6[_0x7615('0x4f')]=_0x1b6724['createdAt'];_0x15cfe6[_0x7615('0x50')]=_0x1b6724;}else{_0x15cfe6[_0x7615('0x4f')]=moment(0x0)['format'](_0x7615('0x51'));_0x15cfe6[_0x7615('0x50')]={};}return _0x15cfe6;};}exports['getUsers']=function(_0x433a99,_0x268332,_0x28da44){var _0x4223d7=[];return db[_0x7615('0x52')][_0x7615('0x42')]({'where':{'role':[_0x7615('0x53'),_0x7615('0x54'),'user']},'attributes':['id',_0x7615('0x55'),_0x7615('0x28'),'role','userpic',_0x7615('0x56'),_0x7615('0x57'),'lastLoginAt','allowmessenger',_0x7615('0x58')],'order':qs[_0x7615('0x3a')](_0x7615('0x59')),'include':[{'model':db['VoiceQueue'],'as':_0x7615('0x5a'),'attributes':['id','name',_0x7615('0x2e')],'through':{'attributes':[]}}]})[_0x7615('0x26')](function(_0x46b724){if(_0x46b724){var _0x1b6daa=_0x433a99[_0x7615('0x5b')][_0x7615('0x4d')]({'plain':!![]});if(!_0x1b6daa)throw new Error(_0x7615('0x5c'));if(_0x1b6daa['role']===_0x7615('0x5b')){return db[_0x7615('0x5d')][_0x7615('0x48')]({'where':{'name':_0x7615('0x5e'),'userProfileId':_0x1b6daa['userProfileId']},'raw':!![]})[_0x7615('0x26')](function(_0x1d1ddd){if(_0x1d1ddd){if(_0x1d1ddd[_0x7615('0x5f')]===0x0){return db[_0x7615('0x60')][_0x7615('0x42')]({'where':{'sectionId':_0x1d1ddd['id']},'raw':!![]})[_0x7615('0x26')](function(_0x1694cf){var _0x16ae37=[];if(_[_0x7615('0x61')](_0x1694cf)){_0x16ae37=_[_0x7615('0x3c')](_0x46b724,function(_0x2b264d){if(_0x2b264d[_0x7615('0x62')]!=='agent'){return _0x2b264d;}});return _0x16ae37;}else{for(var _0x9fe55e=0x0;_0x9fe55e<_0x46b724[_0x7615('0x36')];_0x9fe55e++){var _0x21155b=_0x46b724[_0x9fe55e];if(_0x21155b['role']===_0x7615('0x53')){var _0x44f7a1=_[_0x7615('0x48')](_0x1694cf,function(_0x1af7f2){return _0x1af7f2[_0x7615('0x63')]===_0x21155b['id'];});if(_0x44f7a1)_0x16ae37[_0x7615('0x64')](_0x21155b);}else{_0x16ae37[_0x7615('0x64')](_0x21155b);}}return _0x16ae37;}});}else{return _0x46b724;}}else{var _0x3c98be=_[_0x7615('0x3c')](_0x46b724,function(_0x41186d){if(_0x41186d[_0x7615('0x62')]!==_0x7615('0x53')){return _0x41186d;}});return _0x3c98be;}});}else{return _0x46b724;}}})['then'](function(_0x87f6ba){var _0x4c3a4c=[];if(_0x87f6ba){_0x4223d7=_0x87f6ba;for(var _0x31ccc1=0x0;_0x31ccc1<_0x87f6ba[_0x7615('0x36')];_0x31ccc1+=0x1){_0x4223d7[_0x31ccc1][_0x7615('0x4e')]=[];_0x4c3a4c['push'](db[_0x7615('0x2c')][_0x7615('0x48')]({'where':{'FromId':[_0x433a99[_0x7615('0x5b')]['id'],_0x87f6ba[_0x31ccc1]['id']],'ToId':[_0x433a99[_0x7615('0x5b')]['id'],_0x87f6ba[_0x31ccc1]['id']],'ChatGroupId':null},'attributes':['id',_0x7615('0x65'),_0x7615('0x66'),_0x7615('0x67'),_0x7615('0x68'),'body'],'order':qs[_0x7615('0x3a')](_0x7615('0x69')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x87f6ba[_0x31ccc1])));}return BPromise[_0x7615('0x6a')](_0x4c3a4c);}return[];})[_0x7615('0x26')](function(_0x21ef2b){return{'rows':_0x21ef2b,'count':_0x21ef2b[_0x7615('0x36')]};})[_0x7615('0x26')](respondWithResult(_0x268332,null))[_0x7615('0x44')](handleError(_0x268332,null));}; \ No newline at end of file +var _0x2ca3=['zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','socket.io-emitter','./chatInternalMessage.socket','sendStatus','status','end','limit','undefined','count','offset','json','apply','update','then','error','stack','name','index','map','ChatInternalMessage','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','findAll','rows','params','include','catch','create','body','destroy','find','describe','messages','lastMessageAt','createdAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','agent','admin','user','fullname','role','online','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','resourceId','push','FromId','ToId','read','-createdAt','all','eml-format','rimraf'];(function(_0x27c25f,_0x4ff5fe){var _0x2da4c4=function(_0x1f3c9a){while(--_0x1f3c9a){_0x27c25f['push'](_0x27c25f['shift']());}};_0x2da4c4(++_0x4ff5fe);}(_0x2ca3,0x19a));var _0x32ca=function(_0x32a5d7,_0x4d7412){_0x32a5d7=_0x32a5d7-0x0;var _0x4fca92=_0x2ca3[_0x32a5d7];return _0x4fca92;};'use strict';var emlformat=require(_0x32ca('0x0'));var rimraf=require(_0x32ca('0x1'));var zipdir=require(_0x32ca('0x2'));var jsonpatch=require(_0x32ca('0x3'));var rp=require(_0x32ca('0x4'));var moment=require(_0x32ca('0x5'));var BPromise=require(_0x32ca('0x6'));var Mustache=require(_0x32ca('0x7'));var util=require(_0x32ca('0x8'));var path=require(_0x32ca('0x9'));var sox=require('sox');var csv=require(_0x32ca('0xa'));var ejs=require(_0x32ca('0xb'));var fs=require('fs');var fs_extra=require(_0x32ca('0xc'));var _=require(_0x32ca('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x32ca('0xe'));var toCsv=require(_0x32ca('0xa'));var querystring=require(_0x32ca('0xf'));var Papa=require(_0x32ca('0x10'));var Redis=require(_0x32ca('0x11'));var authService=require(_0x32ca('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ca('0x13'));var logger=require('../../config/logger')(_0x32ca('0x14'));var utils=require(_0x32ca('0x15'));var config=require(_0x32ca('0x16'));var licenseUtil=require(_0x32ca('0x17'));var db=require('../../mysqldb')['db'];config[_0x32ca('0x18')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x32ca('0x19'))(new Redis(config[_0x32ca('0x18')]));require(_0x32ca('0x1a'))['register'](socket);function respondWithStatusCode(_0x411e54,_0x187c4b){_0x187c4b=_0x187c4b||0xcc;return function(_0x4ef270){if(_0x4ef270){return _0x411e54[_0x32ca('0x1b')](_0x187c4b);}return _0x411e54[_0x32ca('0x1c')](_0x187c4b)[_0x32ca('0x1d')]();};}function respondWithResult(_0x519f09,_0x452c54){_0x452c54=_0x452c54||0xc8;return function(_0x5e315f){if(_0x5e315f){return _0x519f09[_0x32ca('0x1c')](_0x452c54)['json'](_0x5e315f);}};}function respondWithFilteredResult(_0x49b7a4,_0x40cc67){return function(_0x2b419a){if(_0x2b419a){var _0x131859=typeof _0x40cc67['offset']==='undefined'&&typeof _0x40cc67[_0x32ca('0x1e')]===_0x32ca('0x1f');var _0x354d03=_0x2b419a[_0x32ca('0x20')];var _0x58231c=_0x131859?0x0:_0x40cc67[_0x32ca('0x21')];var _0x467ccb=_0x131859?_0x2b419a[_0x32ca('0x20')]:_0x40cc67['offset']+_0x40cc67[_0x32ca('0x1e')];var _0x407928;if(_0x467ccb>=_0x354d03){_0x467ccb=_0x354d03;_0x407928=0xc8;}else{_0x407928=0xce;}_0x49b7a4[_0x32ca('0x1c')](_0x407928);return _0x49b7a4['set']('Content-Range',_0x58231c+'-'+_0x467ccb+'/'+_0x354d03)[_0x32ca('0x22')](_0x2b419a);}return null;};}function patchUpdates(_0x5d06c8){return function(_0x5aa4f8){try{jsonpatch[_0x32ca('0x23')](_0x5aa4f8,_0x5d06c8,!![]);}catch(_0x44cbaf){return BPromise['reject'](_0x44cbaf);}return _0x5aa4f8['save']();};}function saveUpdates(_0x6d1082,_0xb67d8e){return function(_0x4aa28b){if(_0x4aa28b){return _0x4aa28b[_0x32ca('0x24')](_0x6d1082)[_0x32ca('0x25')](function(_0x5d1fee){return _0x5d1fee;});}return null;};}function removeEntity(_0x3bba08,_0x3d084c){return function(_0x2d5e4c){if(_0x2d5e4c){return _0x2d5e4c['destroy']()[_0x32ca('0x25')](function(){_0x3bba08[_0x32ca('0x1c')](0xcc)[_0x32ca('0x1d')]();});}};}function handleEntityNotFound(_0x11e562,_0x5db8dc){return function(_0x10c6b3){if(!_0x10c6b3){_0x11e562[_0x32ca('0x1b')](0x194);}return _0x10c6b3;};}function handleError(_0x5666a7,_0x2534dc){_0x2534dc=_0x2534dc||0x1f4;return function(_0x26bfca){logger[_0x32ca('0x26')](_0x26bfca[_0x32ca('0x27')]);if(_0x26bfca[_0x32ca('0x28')]){delete _0x26bfca[_0x32ca('0x28')];}_0x5666a7[_0x32ca('0x1c')](_0x2534dc)['send'](_0x26bfca);};}exports[_0x32ca('0x29')]=function(_0x5bde09,_0x303e15){var _0x15cb57={},_0x35f14b={},_0x1624f1={'count':0x0,'rows':[]};var _0x387ac0=_[_0x32ca('0x2a')](db[_0x32ca('0x2b')][_0x32ca('0x2c')],function(_0x12fcdf){return{'name':_0x12fcdf[_0x32ca('0x2d')],'type':_0x12fcdf[_0x32ca('0x2e')]['key']};});_0x35f14b[_0x32ca('0x2f')]=_[_0x32ca('0x2a')](_0x387ac0,_0x32ca('0x28'));_0x35f14b[_0x32ca('0x30')]=_[_0x32ca('0x31')](_0x5bde09['query']);_0x35f14b[_0x32ca('0x32')]=_['intersection'](_0x35f14b[_0x32ca('0x2f')],_0x35f14b[_0x32ca('0x30')]);_0x15cb57[_0x32ca('0x33')]=_[_0x32ca('0x34')](_0x35f14b[_0x32ca('0x2f')],qs[_0x32ca('0x35')](_0x5bde09[_0x32ca('0x30')][_0x32ca('0x35')]));_0x15cb57[_0x32ca('0x33')]=_0x15cb57['attributes'][_0x32ca('0x36')]?_0x15cb57[_0x32ca('0x33')]:_0x35f14b[_0x32ca('0x2f')];if(!_0x5bde09['query'][_0x32ca('0x37')](_0x32ca('0x38'))){_0x15cb57[_0x32ca('0x1e')]=qs['limit'](_0x5bde09['query']['limit']);_0x15cb57['offset']=qs[_0x32ca('0x21')](_0x5bde09[_0x32ca('0x30')][_0x32ca('0x21')]);}_0x15cb57[_0x32ca('0x39')]=qs[_0x32ca('0x3a')](_0x5bde09[_0x32ca('0x30')][_0x32ca('0x3a')]);_0x15cb57[_0x32ca('0x3b')]=qs[_0x32ca('0x32')](_['pick'](_0x5bde09[_0x32ca('0x30')],_0x35f14b[_0x32ca('0x32')]),_0x387ac0);if(_0x5bde09[_0x32ca('0x30')][_0x32ca('0x3c')]){_0x15cb57[_0x32ca('0x3b')]=_[_0x32ca('0x3d')](_0x15cb57[_0x32ca('0x3b')],{'$or':_[_0x32ca('0x2a')](_0x387ac0,function(_0x347569){if(_0x347569[_0x32ca('0x2e')]!==_0x32ca('0x3e')){var _0x2f2045={};_0x2f2045[_0x347569[_0x32ca('0x28')]]={'$like':'%'+_0x5bde09[_0x32ca('0x30')][_0x32ca('0x3c')]+'%'};return _0x2f2045;}})});}_0x15cb57=_[_0x32ca('0x3d')]({},_0x15cb57,_0x5bde09['options']);var _0x49d4cd={'where':_0x15cb57['where']};return db[_0x32ca('0x2b')][_0x32ca('0x20')](_0x49d4cd)[_0x32ca('0x25')](function(_0x4c3fcc){_0x1624f1['count']=_0x4c3fcc;if(_0x5bde09[_0x32ca('0x30')][_0x32ca('0x3f')]){_0x15cb57['include']=[{'all':!![]}];}return db[_0x32ca('0x2b')][_0x32ca('0x40')](_0x15cb57);})[_0x32ca('0x25')](function(_0xd7273d){_0x1624f1[_0x32ca('0x41')]=_0xd7273d;return _0x1624f1;})[_0x32ca('0x25')](respondWithFilteredResult(_0x303e15,_0x15cb57))['catch'](handleError(_0x303e15,null));};exports['show']=function(_0x2640ca,_0xd6a461){var _0x20fed8={'raw':!![],'where':{'id':_0x2640ca[_0x32ca('0x42')]['id']}},_0x354c8={};_0x354c8[_0x32ca('0x2f')]=_[_0x32ca('0x31')](db[_0x32ca('0x2b')][_0x32ca('0x2c')]);_0x354c8[_0x32ca('0x30')]=_['keys'](_0x2640ca[_0x32ca('0x30')]);_0x354c8['filters']=_['intersection'](_0x354c8[_0x32ca('0x2f')],_0x354c8['query']);_0x20fed8[_0x32ca('0x33')]=_['intersection'](_0x354c8[_0x32ca('0x2f')],qs[_0x32ca('0x35')](_0x2640ca[_0x32ca('0x30')][_0x32ca('0x35')]));_0x20fed8['attributes']=_0x20fed8['attributes']['length']?_0x20fed8[_0x32ca('0x33')]:_0x354c8['model'];if(_0x2640ca[_0x32ca('0x30')][_0x32ca('0x3f')]){_0x20fed8[_0x32ca('0x43')]=[{'all':!![]}];}_0x20fed8=_[_0x32ca('0x3d')]({},_0x20fed8,_0x2640ca['options']);return db[_0x32ca('0x2b')]['find'](_0x20fed8)[_0x32ca('0x25')](handleEntityNotFound(_0xd6a461,null))[_0x32ca('0x25')](respondWithResult(_0xd6a461,null))[_0x32ca('0x44')](handleError(_0xd6a461,null));};exports['create']=function(_0x251d49,_0x339e1c){return db[_0x32ca('0x2b')][_0x32ca('0x45')](_0x251d49[_0x32ca('0x46')],{})[_0x32ca('0x25')](respondWithResult(_0x339e1c,0xc9))[_0x32ca('0x44')](handleError(_0x339e1c,null));};exports['update']=function(_0x23362f,_0x26f698){if(_0x23362f[_0x32ca('0x46')]['id']){delete _0x23362f[_0x32ca('0x46')]['id'];}return db[_0x32ca('0x2b')]['find']({'where':{'id':_0x23362f['params']['id']}})['then'](handleEntityNotFound(_0x26f698,null))['then'](saveUpdates(_0x23362f['body'],null))[_0x32ca('0x25')](respondWithResult(_0x26f698,null))[_0x32ca('0x44')](handleError(_0x26f698,null));};exports[_0x32ca('0x47')]=function(_0x5cd202,_0xdac8b1){return db[_0x32ca('0x2b')][_0x32ca('0x48')]({'where':{'id':_0x5cd202[_0x32ca('0x42')]['id']}})['then'](handleEntityNotFound(_0xdac8b1,null))[_0x32ca('0x25')](removeEntity(_0xdac8b1,null))[_0x32ca('0x44')](handleError(_0xdac8b1,null));};exports[_0x32ca('0x49')]=function(_0x3ae6ff,_0x4a259a){return db[_0x32ca('0x2b')][_0x32ca('0x49')]()[_0x32ca('0x25')](respondWithResult(_0x4a259a,null))[_0x32ca('0x44')](handleError(_0x4a259a,null));};function wrapUser(_0x56000a){return function(_0x2a5deb){var _0x45fbbb=_0x56000a['get']({'plain':!![]});_0x45fbbb[_0x32ca('0x4a')]=[];if(_0x2a5deb){_0x45fbbb[_0x32ca('0x4b')]=_0x2a5deb[_0x32ca('0x4c')];_0x45fbbb[_0x32ca('0x4d')]=_0x2a5deb;}else{_0x45fbbb['lastMessageAt']=moment(0x0)[_0x32ca('0x4e')](_0x32ca('0x4f'));_0x45fbbb[_0x32ca('0x4d')]={};}return _0x45fbbb;};}exports[_0x32ca('0x50')]=function(_0x178bde,_0x8f6fc9,_0x1f0bea){var _0x364d67=[];return db['User'][_0x32ca('0x40')]({'where':{'role':[_0x32ca('0x51'),_0x32ca('0x52'),_0x32ca('0x53')]},'attributes':['id',_0x32ca('0x54'),_0x32ca('0x28'),_0x32ca('0x55'),'userpic','internal',_0x32ca('0x56'),'lastLoginAt',_0x32ca('0x57'),_0x32ca('0x58')],'order':qs[_0x32ca('0x3a')](_0x32ca('0x59')),'include':[{'model':db[_0x32ca('0x5a')],'as':_0x32ca('0x5b'),'attributes':['id',_0x32ca('0x28'),_0x32ca('0x2e')],'through':{'attributes':[]}}]})['then'](function(_0x329e9c){if(_0x329e9c){var _0x4bb4cc=_0x178bde[_0x32ca('0x53')][_0x32ca('0x5c')]({'plain':!![]});if(!_0x4bb4cc)throw new Error(_0x32ca('0x5d'));if(_0x4bb4cc[_0x32ca('0x55')]===_0x32ca('0x53')){return db['UserProfileSection'][_0x32ca('0x48')]({'where':{'name':'Agents','userProfileId':_0x4bb4cc[_0x32ca('0x5e')]},'raw':!![]})['then'](function(_0x5f140d){if(_0x5f140d){if(_0x5f140d[_0x32ca('0x5f')]===0x0){return db['UserProfileResource'][_0x32ca('0x40')]({'where':{'sectionId':_0x5f140d['id']},'raw':!![]})[_0x32ca('0x25')](function(_0x13fbf2){var _0x2c6e80=[];if(_['isEmpty'](_0x13fbf2)){_0x2c6e80=_['filter'](_0x329e9c,function(_0xd03920){if(_0xd03920['role']!==_0x32ca('0x51')){return _0xd03920;}});return _0x2c6e80;}else{for(var _0x37bb67=0x0;_0x37bb67<_0x329e9c[_0x32ca('0x36')];_0x37bb67++){var _0x2e6e5a=_0x329e9c[_0x37bb67];if(_0x2e6e5a['role']===_0x32ca('0x51')){var _0x55f62e=_['find'](_0x13fbf2,function(_0x6755f){return _0x6755f[_0x32ca('0x60')]===_0x2e6e5a['id'];});if(_0x55f62e)_0x2c6e80['push'](_0x2e6e5a);}else{_0x2c6e80[_0x32ca('0x61')](_0x2e6e5a);}}return _0x2c6e80;}});}else{return _0x329e9c;}}else{var _0x53658e=_[_0x32ca('0x3c')](_0x329e9c,function(_0x5d6018){if(_0x5d6018[_0x32ca('0x55')]!==_0x32ca('0x51')){return _0x5d6018;}});return _0x53658e;}});}else{return _0x329e9c;}}})[_0x32ca('0x25')](function(_0x46c173){var _0xc56065=[];if(_0x46c173){_0x364d67=_0x46c173;for(var _0x44afd7=0x0;_0x44afd7<_0x46c173[_0x32ca('0x36')];_0x44afd7+=0x1){_0x364d67[_0x44afd7][_0x32ca('0x4a')]=[];_0xc56065[_0x32ca('0x61')](db[_0x32ca('0x2b')][_0x32ca('0x48')]({'where':{'FromId':[_0x178bde[_0x32ca('0x53')]['id'],_0x46c173[_0x44afd7]['id']],'ToId':[_0x178bde['user']['id'],_0x46c173[_0x44afd7]['id']],'ChatGroupId':null},'attributes':['id',_0x32ca('0x4c'),_0x32ca('0x62'),_0x32ca('0x63'),_0x32ca('0x64'),_0x32ca('0x46')],'order':qs[_0x32ca('0x3a')](_0x32ca('0x65')),'limit':0x1,'offset':0x0,'raw':!![]})['then'](wrapUser(_0x46c173[_0x44afd7])));}return BPromise[_0x32ca('0x66')](_0xc56065);}return[];})[_0x32ca('0x25')](function(_0x253b10){return{'rows':_0x253b10,'count':_0x253b10[_0x32ca('0x36')]};})[_0x32ca('0x25')](respondWithResult(_0x8f6fc9,null))[_0x32ca('0x44')](handleError(_0x8f6fc9,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 9c4e6fc..c418148 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 _0xdd9a=['../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','hook','events'];(function(_0x402244,_0x34dfa2){var _0x2ac631=function(_0x50939f){while(--_0x50939f){_0x402244['push'](_0x402244['shift']());}};_0x2ac631(++_0x34dfa2);}(_0xdd9a,0x1d7));var _0xadd9=function(_0x3bd3a8,_0x2190f1){_0x3bd3a8=_0x3bd3a8-0x0;var _0x2f72f6=_0xdd9a[_0x3bd3a8];return _0x2f72f6;};'use strict';var EventEmitter=require(_0xadd9('0x0'));var ChatInternalMessage=require(_0xadd9('0x1'))['db'][_0xadd9('0x2')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xadd9('0x3')](0x0);var events={'afterCreate':_0xadd9('0x4'),'afterUpdate':_0xadd9('0x5'),'afterDestroy':_0xadd9('0x6')};function emitEvent(_0x548ce2){return function(_0x4502ba,_0x4ab140,_0x4555be){ChatInternalMessageEvents['emit'](_0x548ce2+':'+_0x4502ba['id'],_0x4502ba);ChatInternalMessageEvents['emit'](_0x548ce2,_0x4502ba);_0x4555be(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0xadd9('0x7')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file +var _0x24cf=['hook','../../mysqldb','ChatInternalMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x370723,_0x179030){var _0x4f82bb=function(_0x49f0ee){while(--_0x49f0ee){_0x370723['push'](_0x370723['shift']());}};_0x4f82bb(++_0x179030);}(_0x24cf,0x64));var _0xf24c=function(_0x58d9a4,_0x3dd915){_0x58d9a4=_0x58d9a4-0x0;var _0x4af948=_0x24cf[_0x58d9a4];return _0x4af948;};'use strict';var EventEmitter=require('events');var ChatInternalMessage=require(_0xf24c('0x0'))['db'][_0xf24c('0x1')];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0xf24c('0x2')](0x0);var events={'afterCreate':_0xf24c('0x3'),'afterUpdate':_0xf24c('0x4'),'afterDestroy':_0xf24c('0x5')};function emitEvent(_0x3dc8f3){return function(_0xe81bfe,_0x42a709,_0x14389a){ChatInternalMessageEvents['emit'](_0x3dc8f3+':'+_0xe81bfe['id'],_0xe81bfe);ChatInternalMessageEvents[_0xf24c('0x6')](_0x3dc8f3,_0xe81bfe);_0x14389a(null);};}for(var e in events){if(events[_0xf24c('0x7')](e)){var event=events[e];ChatInternalMessage[_0xf24c('0x8')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index bfb84bd..9cf804f 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 _0x94c3=['rimraf','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','path'];(function(_0x527824,_0xc824a9){var _0xc8b8ed=function(_0x1b0e19){while(--_0x1b0e19){_0x527824['push'](_0x527824['shift']());}};_0xc8b8ed(++_0xc824a9);}(_0x94c3,0x86));var _0x394c=function(_0x5b836a,_0x22e8f3){_0x5b836a=_0x5b836a-0x0;var _0x489dc2=_0x94c3[_0x5b836a];return _0x489dc2;};'use strict';var _=require(_0x394c('0x0'));var util=require(_0x394c('0x1'));var logger=require(_0x394c('0x2'))(_0x394c('0x3'));var moment=require(_0x394c('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x394c('0x5'));var rimraf=require(_0x394c('0x6'));var config=require('../../config/environment');var attributes=require(_0x394c('0x7'));module[_0x394c('0x8')]=function(_0x25579c,_0x44ae56){return _0x25579c[_0x394c('0x9')](_0x394c('0xa'),attributes,{'tableName':_0x394c('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x394c('0xc'),'collate':_0x394c('0xd')});}; \ No newline at end of file +var _0x8396=['ChatInternalMessage','chat_internal_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','exports','define'];(function(_0xead5f0,_0x30581c){var _0x73c2a6=function(_0x27f32d){while(--_0x27f32d){_0xead5f0['push'](_0xead5f0['shift']());}};_0x73c2a6(++_0x30581c);}(_0x8396,0x1b1));var _0x6839=function(_0x29e1a7,_0x463172){_0x29e1a7=_0x29e1a7-0x0;var _0x488353=_0x8396[_0x29e1a7];return _0x488353;};'use strict';var _=require(_0x6839('0x0'));var util=require(_0x6839('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x6839('0x2'));var BPromise=require(_0x6839('0x3'));var rp=require(_0x6839('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6839('0x5'));var config=require(_0x6839('0x6'));var attributes=require('./chatInternalMessage.attributes');module[_0x6839('0x7')]=function(_0x5722e1,_0x1a9c96){return _0x5722e1[_0x6839('0x8')](_0x6839('0x9'),attributes,{'tableName':_0x6839('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6839('0xb'),'collate':_0x6839('0xc')});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 72cdf89..b10f9e4 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 _0x6dd6=['redis','localhost','socket.io-emitter','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','defaults'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0x6dd6,0xcc));var _0x66dd=function(_0x21fec0,_0x2f9a99){_0x21fec0=_0x21fec0-0x0;var _0xcf272e=_0x6dd6[_0x21fec0];return _0xcf272e;};'use strict';var _=require('lodash');var util=require(_0x66dd('0x0'));var moment=require(_0x66dd('0x1'));var BPromise=require(_0x66dd('0x2'));var rs=require(_0x66dd('0x3'));var fs=require('fs');var Redis=require(_0x66dd('0x4'));var db=require(_0x66dd('0x5'))['db'];var utils=require(_0x66dd('0x6'));var logger=require(_0x66dd('0x7'))(_0x66dd('0x8'));var config=require('../../config/environment');var jayson=require(_0x66dd('0x9'));var client=jayson['client'][_0x66dd('0xa')]({'port':0x232a});config['redis']=_[_0x66dd('0xb')](config[_0x66dd('0xc')],{'host':_0x66dd('0xd'),'port':0x18eb});var socket=require(_0x66dd('0xe'))(new Redis(config[_0x66dd('0xc')]));require('./chatInternalMessage.socket')['register'](socket);function respondWithRpcPromise(_0x49866e,_0x31cef0,_0xe7290d){return new BPromise(function(_0x7f5ff0,_0x460052){return client[_0x66dd('0xf')](_0x49866e,_0xe7290d)[_0x66dd('0x10')](function(_0x21ea6d){logger[_0x66dd('0x11')](_0x66dd('0x12'),_0x31cef0,_0x66dd('0x13'));logger[_0x66dd('0x14')](_0x66dd('0x15'),_0x31cef0,_0x66dd('0x13'),JSON[_0x66dd('0x16')](_0x21ea6d));if(_0x21ea6d[_0x66dd('0x17')]){if(_0x21ea6d[_0x66dd('0x17')]['code']===0x1f4){logger[_0x66dd('0x17')](_0x66dd('0x12'),_0x31cef0,_0x21ea6d['error'][_0x66dd('0x18')]);return _0x460052(_0x21ea6d['error']['message']);}logger[_0x66dd('0x17')](_0x66dd('0x12'),_0x31cef0,_0x21ea6d['error'][_0x66dd('0x18')]);return _0x7f5ff0(_0x21ea6d[_0x66dd('0x17')][_0x66dd('0x18')]);}else{logger[_0x66dd('0x11')]('ChatInternalMessage,\x20%s,\x20%s',_0x31cef0,_0x66dd('0x13'));_0x7f5ff0(_0x21ea6d[_0x66dd('0x19')][_0x66dd('0x18')]);}})[_0x66dd('0x1a')](function(_0x1c9cff){logger[_0x66dd('0x17')](_0x66dd('0x12'),_0x31cef0,_0x1c9cff);_0x460052(_0x1c9cff);});});} \ No newline at end of file +var _0xb715=['catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','redis','localhost','socket.io-emitter','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x549182,_0x2f05ea){var _0x5aa4e0=function(_0x168538){while(--_0x168538){_0x549182['push'](_0x549182['shift']());}};_0x5aa4e0(++_0x2f05ea);}(_0xb715,0x16d));var _0x5b71=function(_0x4ba210,_0xeeb38d){_0x4ba210=_0x4ba210-0x0;var _0x4c057d=_0xb715[_0x4ba210];return _0x4c057d;};'use strict';var _=require('lodash');var util=require(_0x5b71('0x0'));var moment=require('moment');var BPromise=require(_0x5b71('0x1'));var rs=require(_0x5b71('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5b71('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x5b71('0x4'))(_0x5b71('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x5b71('0x6')][_0x5b71('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0x5b71('0x8')],{'host':_0x5b71('0x9'),'port':0x18eb});var socket=require(_0x5b71('0xa'))(new Redis(config[_0x5b71('0x8')]));require(_0x5b71('0xb'))[_0x5b71('0xc')](socket);function respondWithRpcPromise(_0x2f42cb,_0x3e0f28,_0x370ec0){return new BPromise(function(_0x55718e,_0x34bdd1){return client[_0x5b71('0xd')](_0x2f42cb,_0x370ec0)[_0x5b71('0xe')](function(_0x25ea1d){logger[_0x5b71('0xf')](_0x5b71('0x10'),_0x3e0f28,_0x5b71('0x11'));logger[_0x5b71('0x12')](_0x5b71('0x13'),_0x3e0f28,_0x5b71('0x11'),JSON[_0x5b71('0x14')](_0x25ea1d));if(_0x25ea1d[_0x5b71('0x15')]){if(_0x25ea1d[_0x5b71('0x15')][_0x5b71('0x16')]===0x1f4){logger['error'](_0x5b71('0x10'),_0x3e0f28,_0x25ea1d[_0x5b71('0x15')][_0x5b71('0x17')]);return _0x34bdd1(_0x25ea1d[_0x5b71('0x15')][_0x5b71('0x17')]);}logger[_0x5b71('0x15')](_0x5b71('0x10'),_0x3e0f28,_0x25ea1d['error'][_0x5b71('0x17')]);return _0x55718e(_0x25ea1d[_0x5b71('0x15')]['message']);}else{logger[_0x5b71('0xf')](_0x5b71('0x10'),_0x3e0f28,'request\x20sent');_0x55718e(_0x25ea1d[_0x5b71('0x18')][_0x5b71('0x17')]);}})[_0x5b71('0x19')](function(_0x2c9700){logger[_0x5b71('0x15')](_0x5b71('0x10'),_0x3e0f28,_0x2c9700);_0x34bdd1(_0x2c9700);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 0f2a206..b87e634 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 _0xad04=['register','length','chatInternalMessage:','./chatInternalMessage.events','update','emit','removeListener'];(function(_0x4352a3,_0x1f2d04){var _0xd551cc=function(_0x4caa8b){while(--_0x4caa8b){_0x4352a3['push'](_0x4352a3['shift']());}};_0xd551cc(++_0x1f2d04);}(_0xad04,0xb9));var _0x4ad0=function(_0x33beb9,_0x31707c){_0x33beb9=_0x33beb9-0x0;var _0x575875=_0xad04[_0x33beb9];return _0x575875;};'use strict';var ChatInternalMessageEvents=require(_0x4ad0('0x0'));var events=['save','remove',_0x4ad0('0x1')];function createListener(_0x48e9dd,_0x3c66a5){return function(_0x1582ac){_0x3c66a5[_0x4ad0('0x2')](_0x48e9dd,_0x1582ac);};}function removeListener(_0x2fd395,_0x2d8e44){return function(){ChatInternalMessageEvents[_0x4ad0('0x3')](_0x2fd395,_0x2d8e44);};}exports[_0x4ad0('0x4')]=function(_0x2bbc08){for(var _0x337637=0x0,_0x2ffa2f=events[_0x4ad0('0x5')];_0x337637<_0x2ffa2f;_0x337637++){var _0x4b3c52=events[_0x337637];var _0x30256e=createListener(_0x4ad0('0x6')+_0x4b3c52,_0x2bbc08);ChatInternalMessageEvents['on'](_0x4b3c52,_0x30256e);}}; \ No newline at end of file +var _0xf39c=['./chatInternalMessage.events','save','remove','update','emit','register','length'];(function(_0x20cf52,_0x5e712b){var _0x279e49=function(_0x4ab317){while(--_0x4ab317){_0x20cf52['push'](_0x20cf52['shift']());}};_0x279e49(++_0x5e712b);}(_0xf39c,0x1c0));var _0xcf39=function(_0x2106a9,_0x2b4ac0){_0x2106a9=_0x2106a9-0x0;var _0x39b0b2=_0xf39c[_0x2106a9];return _0x39b0b2;};'use strict';var ChatInternalMessageEvents=require(_0xcf39('0x0'));var events=[_0xcf39('0x1'),_0xcf39('0x2'),_0xcf39('0x3')];function createListener(_0x1d4d90,_0x5b0bfa){return function(_0x18148e){_0x5b0bfa[_0xcf39('0x4')](_0x1d4d90,_0x18148e);};}function removeListener(_0xc33325,_0x3d407a){return function(){ChatInternalMessageEvents['removeListener'](_0xc33325,_0x3d407a);};}exports[_0xcf39('0x5')]=function(_0x73d7b4){for(var _0x15830a=0x0,_0x301a25=events[_0xcf39('0x6')];_0x15830a<_0x301a25;_0x15830a++){var _0x25e8bc=events[_0x15830a];var _0x433afd=createListener('chatInternalMessage:'+_0x25e8bc,_0x73d7b4);ChatInternalMessageEvents['on'](_0x25e8bc,_0x433afd);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 15e58b4..2748753 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 _0x0923=['delete','destroy','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/describe','describe','get','/users','isAuthenticated','/:id','show','post','create','put','update'];(function(_0x4775c6,_0x2d9d4d){var _0x2e8afa=function(_0x2a4e9a){while(--_0x2a4e9a){_0x4775c6['push'](_0x4775c6['shift']());}};_0x2e8afa(++_0x2d9d4d);}(_0x0923,0xd4));var _0x3092=function(_0x1221d6,_0x44c034){_0x1221d6=_0x1221d6-0x0;var _0x3ef699=_0x0923[_0x1221d6];return _0x3ef699;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x3092('0x0'));var timeout=require(_0x3092('0x1'));var express=require(_0x3092('0x2'));var router=express[_0x3092('0x3')]();var fs_extra=require(_0x3092('0x4'));var auth=require(_0x3092('0x5'));var interaction=require(_0x3092('0x6'));var config=require(_0x3092('0x7'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x3092('0x8'),auth['isAuthenticated'](),controller[_0x3092('0x9')]);router[_0x3092('0xa')](_0x3092('0xb'),auth[_0x3092('0xc')](),controller['getUsers']);router[_0x3092('0xa')](_0x3092('0xd'),auth['isAuthenticated'](),controller[_0x3092('0xe')]);router[_0x3092('0xf')]('/',auth[_0x3092('0xc')](),controller[_0x3092('0x10')]);router[_0x3092('0x11')](_0x3092('0xd'),controller[_0x3092('0x12')]);router[_0x3092('0x13')](_0x3092('0xd'),auth[_0x3092('0xc')](),controller[_0x3092('0x14')]);module['exports']=router; \ No newline at end of file +var _0x93d3=['../../config/environment','describe','/users','isAuthenticated','get','show','post','put','/:id','update','delete','destroy','exports','multer','path','../../components/auth/service','../../components/interaction/service'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x93d3,0x1e9));var _0x393d=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x93d3[_0x18ab2a];return _0x16dcee;};'use strict';var multer=require(_0x393d('0x0'));var util=require('util');var path=require(_0x393d('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x393d('0x2'));var interaction=require(_0x393d('0x3'));var config=require(_0x393d('0x4'));var controller=require('./chatInternalMessage.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth['isAuthenticated'](),controller[_0x393d('0x5')]);router['get'](_0x393d('0x6'),auth[_0x393d('0x7')](),controller['getUsers']);router[_0x393d('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x393d('0x9')]);router[_0x393d('0xa')]('/',auth[_0x393d('0x7')](),controller['create']);router[_0x393d('0xb')](_0x393d('0xc'),controller[_0x393d('0xd')]);router[_0x393d('0xe')]('/:id',auth[_0x393d('0x7')](),controller[_0x393d('0xf')]);module[_0x393d('0x10')]=router; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.attributes.js b/server/api/chatMessage/chatMessage.attributes.js index 9d01bbf..4d61924 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 _0x19e1=['out','DATE','STRING','sequelize','exports','TEXT','medium','ENUM'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x19e1,0x163));var _0x119e=function(_0x2bb3f6,_0x25fde0){_0x2bb3f6=_0x2bb3f6-0x0;var _0x62b339=_0x19e1[_0x2bb3f6];return _0x62b339;};'use strict';var Sequelize=require(_0x119e('0x0'));module[_0x119e('0x1')]={'body':{'type':Sequelize[_0x119e('0x2')](_0x119e('0x3')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x119e('0x4')]('in',_0x119e('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x119e('0x6')]},'providerName':{'type':Sequelize[_0x119e('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x9ffd=['DATE','STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x3a1ae8,_0x1e9b4b){_0x3a1ae8=_0x3a1ae8-0x0;var _0x4d23a5=_0x9ffd[_0x3a1ae8];return _0x4d23a5;};'use strict';var Sequelize=require(_0xd9ff('0x0'));module[_0xd9ff('0x1')]={'body':{'type':Sequelize[_0xd9ff('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd9ff('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0xd9ff('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xd9ff('0x4')]('in',_0xd9ff('0x5')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0xd9ff('0x6')]},'providerName':{'type':Sequelize[_0xd9ff('0x7')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 0048aef..d8b3bff 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=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','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','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x52bcb3,_0x2736dd){var _0x106b67=function(_0x11717a){while(--_0x11717a){_0x52bcb3['push'](_0x52bcb3['shift']());}};_0x106b67(++_0x2736dd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0xa9e0[_0x36dfbd];return _0x4ecad9;};'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);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file +var _0xa9e0=['interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','contact','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','chat','ChatInteraction','RejectMessage','rejectMessage','Sequelize','QueryTypes','SELECT','fullname','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','map','ChatMessage','fieldName','type','keys','query','filters','intersection','attributes','fields','length','model','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','body','find','describe','../../config/logger','accept','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','ChatInteractionId','isNil','read1stAt','format'];(function(_0x331f5f,_0x55e36b){var _0xffd910=function(_0x5ad882){while(--_0x5ad882){_0x331f5f['push'](_0x331f5f['shift']());}};_0xffd910(++_0x55e36b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'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);};}exports['index']=function(_0x24936a,_0x3d9717){var _0x381c37={},_0x1ef87a={},_0x4f41ae={'count':0x0,'rows':[]};var _0x31916f=_[_0x0a9e('0x3a')](db[_0x0a9e('0x3b')]['rawAttributes'],function(_0x1dbf74){return{'name':_0x1dbf74[_0x0a9e('0x3c')],'type':_0x1dbf74[_0x0a9e('0x3d')]['key']};});_0x1ef87a['model']=_[_0x0a9e('0x3a')](_0x31916f,_0x0a9e('0x38'));_0x1ef87a['query']=_[_0x0a9e('0x3e')](_0x24936a[_0x0a9e('0x3f')]);_0x1ef87a[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],_0x1ef87a['query']);_0x381c37[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x1ef87a['model'],qs[_0x0a9e('0x43')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x43')]));_0x381c37['attributes']=_0x381c37[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x381c37[_0x0a9e('0x42')]:_0x1ef87a[_0x0a9e('0x45')];if(!_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x46')](_0x0a9e('0x47'))){_0x381c37[_0x0a9e('0x30')]=qs[_0x0a9e('0x30')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x30')]);_0x381c37[_0x0a9e('0x2d')]=qs[_0x0a9e('0x2d')](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x2d')]);}_0x381c37['order']=qs['sort'](_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x48')]);_0x381c37[_0x0a9e('0x49')]=qs[_0x0a9e('0x40')](_[_0x0a9e('0x4a')](_0x24936a[_0x0a9e('0x3f')],_0x1ef87a[_0x0a9e('0x40')]),_0x31916f);if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]){_0x381c37[_0x0a9e('0x49')]=_[_0x0a9e('0x4c')](_0x381c37[_0x0a9e('0x49')],{'$or':_['map'](_0x31916f,function(_0x117c99){if(_0x117c99[_0x0a9e('0x3d')]!==_0x0a9e('0x4d')){var _0xfbd5ad={};_0xfbd5ad[_0x117c99[_0x0a9e('0x38')]]={'$like':'%'+_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4b')]+'%'};return _0xfbd5ad;}})});}_0x381c37=_[_0x0a9e('0x4c')]({},_0x381c37,_0x24936a['options']);var _0x2e9d90={'where':_0x381c37['where']};return db[_0x0a9e('0x3b')][_0x0a9e('0x2f')](_0x2e9d90)[_0x0a9e('0x1d')](function(_0x562fb4){_0x4f41ae[_0x0a9e('0x2f')]=_0x562fb4;if(_0x24936a[_0x0a9e('0x3f')][_0x0a9e('0x4e')]){_0x381c37[_0x0a9e('0x4f')]=[{'all':!![]}];}return db[_0x0a9e('0x3b')][_0x0a9e('0x50')](_0x381c37);})[_0x0a9e('0x1d')](function(_0x5bbcde){_0x4f41ae[_0x0a9e('0x51')]=_0x5bbcde;return _0x4f41ae;})[_0x0a9e('0x1d')](respondWithFilteredResult(_0x3d9717,_0x381c37))[_0x0a9e('0x28')](handleError(_0x3d9717,null));};exports[_0x0a9e('0x52')]=function(_0x409789,_0x992c77){var _0x6054ee={'raw':!![],'where':{'id':_0x409789[_0x0a9e('0x53')]['id']}},_0x19383e={};_0x19383e['model']=_[_0x0a9e('0x3e')](db[_0x0a9e('0x3b')]['rawAttributes']);_0x19383e['query']=_['keys'](_0x409789[_0x0a9e('0x3f')]);_0x19383e[_0x0a9e('0x40')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],_0x19383e[_0x0a9e('0x3f')]);_0x6054ee[_0x0a9e('0x42')]=_[_0x0a9e('0x41')](_0x19383e[_0x0a9e('0x45')],qs['fields'](_0x409789['query']['fields']));_0x6054ee[_0x0a9e('0x42')]=_0x6054ee[_0x0a9e('0x42')][_0x0a9e('0x44')]?_0x6054ee['attributes']:_0x19383e[_0x0a9e('0x45')];if(_0x409789[_0x0a9e('0x3f')]['includeAll']){_0x6054ee['include']=[{'all':!![]}];}_0x6054ee=_[_0x0a9e('0x4c')]({},_0x6054ee,_0x409789['options']);return db[_0x0a9e('0x3b')]['find'](_0x6054ee)[_0x0a9e('0x1d')](handleEntityNotFound(_0x992c77,null))[_0x0a9e('0x1d')](respondWithResult(_0x992c77,null))[_0x0a9e('0x28')](handleError(_0x992c77,null));};exports['create']=function(_0x2f82da,_0x1bf38a){return db['ChatMessage']['create'](_0x2f82da[_0x0a9e('0x54')],{})[_0x0a9e('0x1d')](respondWithResult(_0x1bf38a,0xc9))['catch'](handleError(_0x1bf38a,null));};exports[_0x0a9e('0x35')]=function(_0x5ce9ac,_0x211ef9){if(_0x5ce9ac['body']['id']){delete _0x5ce9ac[_0x0a9e('0x54')]['id'];}return db['ChatMessage']['find']({'where':{'id':_0x5ce9ac['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x211ef9,null))['then'](saveUpdates(_0x5ce9ac[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](respondWithResult(_0x211ef9,null))[_0x0a9e('0x28')](handleError(_0x211ef9,null));};exports[_0x0a9e('0x36')]=function(_0x232830,_0x272738){return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x232830['params']['id']}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x272738,null))[_0x0a9e('0x1d')](removeEntity(_0x272738,null))[_0x0a9e('0x28')](handleError(_0x272738,null));};exports[_0x0a9e('0x56')]=function(_0xb83dfd,_0x156662){return db['ChatMessage'][_0x0a9e('0x56')]()[_0x0a9e('0x1d')](respondWithResult(_0x156662,null))['catch'](handleError(_0x156662,null));};var interaction_log=require(_0x0a9e('0x57'))('chat-interactions');exports[_0x0a9e('0x58')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee){var _0x273cb5={'agent':{},'channel':'chat'};if(_0x5ba1f9[_0x0a9e('0x54')]['id']){delete _0x5ba1f9[_0x0a9e('0x54')]['id'];}_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x59')]=!![];_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5a')]=moment()['format'](_0x0a9e('0x5b'));_0x5ba1f9['body'][_0x0a9e('0x5c')]=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')]||_0x5ba1f9['user']['id'];_0x273cb5[_0x0a9e('0x5d')]['id']=_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')];return db[_0x0a9e('0x3b')]['find']({'where':{'id':_0x5ba1f9[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](saveUpdates(_0x5ba1f9[_0x0a9e('0x54')],null))[_0x0a9e('0x1d')](function(_0x88dcbf){if(_0x88dcbf){_0x273cb5[_0x0a9e('0x26')]=_0x88dcbf[_0x0a9e('0x5e')]({'plain':!![]});return db['ChatInteraction'][_0x0a9e('0x55')]({'where':{'id':_0x88dcbf[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x4b3c1a,null))['then'](function(_0x3528b7){if(_0x3528b7){return _0x3528b7['update']({'UserId':_0x5ba1f9['body'][_0x0a9e('0x5c')],'read1stAt':_[_0x0a9e('0x60')](_0x3528b7[_0x0a9e('0x61')])?moment()[_0x0a9e('0x62')](_0x0a9e('0x5b')):undefined});}return null;})[_0x0a9e('0x1d')](function(_0x387489){if(_0x387489){_0x273cb5[_0x0a9e('0x63')]=_0x387489[_0x0a9e('0x5e')]({'plain':!![]});interaction_log[_0x0a9e('0x1e')](_0x0a9e('0x64'),_0x5ba1f9[_0x0a9e('0x65')]['id'],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x66')],_0x273cb5[_0x0a9e('0x63')]['id'],_0x5ba1f9[_0x0a9e('0x54')]?JSON['stringify'](_0x5ba1f9[_0x0a9e('0x54')]):_0x0a9e('0x67'));return respondWithRpcPromise(_0x0a9e('0x68'),'acceptMessage',_0x273cb5);}return null;})[_0x0a9e('0x1d')](function(_0x30944e){var _0x4b341d=_0x0a9e('0x69')+_0x30944e[_0x0a9e('0x26')][_0x0a9e('0x6a')];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0x4b341d,{'type':db['Sequelize']['QueryTypes']['SELECT'],'raw':!![]})[_0x0a9e('0x1d')](function(_0x18bf5d){return _0x18bf5d;});})[_0x0a9e('0x1d')](function(_0x23a7d3){if(_0x23a7d3){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x23a7d3[0x0];if(!_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),'fullname',_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})['then'](function(_0x2ed01e){if(!_0x2ed01e)return null;_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x2ed01e;return _0x273cb5;})[_0x0a9e('0x1d')](function(_0x542ece){if(_0x542ece){if(_0x5ba1f9[_0x0a9e('0x54')][_0x0a9e('0x6f')]){_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x70')]=util['format'](_0x0a9e('0x71'),_0x5ba1f9[_0x0a9e('0x65')][_0x0a9e('0x38')]);_0x273cb5[_0x0a9e('0x26')]['channel']=_0x273cb5[_0x0a9e('0x72')];_0x273cb5[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x58');return respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x75'),'message':_[_0x0a9e('0x4c')](_0x273cb5[_0x0a9e('0x26')],JSON[_0x0a9e('0x76')](_0x273cb5[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002)[_0x0a9e('0x1d')](function(){return _0x273cb5;});}return _0x273cb5;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x4b3c1a,null))['catch'](handleError(_0x4b3c1a,null));};var interaction_log=require(_0x0a9e('0x57'))(_0x0a9e('0x78'));exports[_0x0a9e('0x33')]=function(_0x563627,_0x3736e0,_0x33dda0){var _0x8cea96={'agent':{},'channel':_0x0a9e('0x79')};if(_0x563627['body']['id']){delete _0x563627['body']['id'];}_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')]=_0x563627['body'][_0x0a9e('0x5c')]||_0x563627['user']['id'];_0x8cea96[_0x0a9e('0x5d')]['id']=_0x563627[_0x0a9e('0x54')]['UserId'];return db[_0x0a9e('0x3b')][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x53')]['id'],'UserId':null}})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))[_0x0a9e('0x1d')](function(_0x1f42a0){if(_0x1f42a0){_0x8cea96[_0x0a9e('0x26')]=_0x1f42a0['get']({'plain':!![]});return db[_0x0a9e('0x7a')][_0x0a9e('0x55')]({'where':{'id':_0x1f42a0[_0x0a9e('0x5f')]}});}return null;})[_0x0a9e('0x1d')](handleEntityNotFound(_0x3736e0,null))['then'](function(_0xf51744){if(_0xf51744){_0x8cea96[_0x0a9e('0x63')]=_0xf51744['get']({'plain':!![]});interaction_log[_0x0a9e('0x1e')]('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x563627[_0x0a9e('0x65')]['id'],_0x563627[_0x0a9e('0x65')][_0x0a9e('0x38')],_0x563627[_0x0a9e('0x65')]['role'],_0x8cea96['interaction']['id'],_0x563627[_0x0a9e('0x54')]?JSON[_0x0a9e('0x23')](_0x563627[_0x0a9e('0x54')]):'null');return respondWithRpcPromise(_0x0a9e('0x7b'),_0x0a9e('0x7c'),_0x8cea96);}return null;})['then'](function(_0x4e46b2){var _0xf0a802='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4e46b2['message']['ContactId'];return db[_0x0a9e('0x6b')][_0x0a9e('0x3f')](_0xf0a802,{'type':db[_0x0a9e('0x7d')][_0x0a9e('0x7e')][_0x0a9e('0x7f')],'raw':!![]})[_0x0a9e('0x1d')](function(_0x5a8854){return _0x5a8854;});})[_0x0a9e('0x1d')](function(_0x5955f1){if(_0x5955f1){_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x6c')]=_0x5955f1[0x0];if(!_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')])return;return db['User'][_0x0a9e('0x55')]({'where':{'id':_0x563627[_0x0a9e('0x54')][_0x0a9e('0x5c')],'role':'agent'},'attributes':['id',_0x0a9e('0x38'),_0x0a9e('0x80'),_0x0a9e('0x6d'),_0x0a9e('0x6e')],'raw':!![]});}return null;})[_0x0a9e('0x1d')](function(_0x1910bf){if(!_0x1910bf)return null;_0x8cea96[_0x0a9e('0x26')][_0x0a9e('0x5d')]=_0x1910bf;return _0x8cea96;})['then'](function(_0x2645d6){if(_0x2645d6){_0x2645d6[_0x0a9e('0x26')]['interface']=util[_0x0a9e('0x62')](_0x0a9e('0x71'),_0x563627[_0x0a9e('0x65')]['name']);_0x2645d6[_0x0a9e('0x26')]['channel']=_0x8cea96[_0x0a9e('0x72')];_0x2645d6[_0x0a9e('0x26')][_0x0a9e('0x73')]=_0x0a9e('0x33');respondWithRpcPromise(_0x0a9e('0x74'),_0x0a9e('0x74'),{'event':_0x0a9e('0x81'),'message':_[_0x0a9e('0x4c')](_0x8cea96['message'],JSON[_0x0a9e('0x76')](_0x8cea96[_0x0a9e('0x63')][_0x0a9e('0x77')]))},client9002);return _0x8cea96;}return null;})[_0x0a9e('0x1d')](respondWithResult(_0x3736e0,null))[_0x0a9e('0x28')](handleError(_0x3736e0,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 5cdbb55..9e7c5e4 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 _0xdc98=['remove','emit','hasOwnProperty','hook','events','ChatMessage','setMaxListeners','save','update'];(function(_0x58e78f,_0x4c0d29){var _0x4e3aed=function(_0x4033fc){while(--_0x4033fc){_0x58e78f['push'](_0x58e78f['shift']());}};_0x4e3aed(++_0x4c0d29);}(_0xdc98,0x1c6));var _0x8dc9=function(_0x341e0f,_0x4a09d0){_0x341e0f=_0x341e0f-0x0;var _0x59555a=_0xdc98[_0x341e0f];return _0x59555a;};'use strict';var EventEmitter=require(_0x8dc9('0x0'));var ChatMessage=require('../../mysqldb')['db'][_0x8dc9('0x1')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x8dc9('0x2')](0x0);var events={'afterCreate':_0x8dc9('0x3'),'afterUpdate':_0x8dc9('0x4'),'afterDestroy':_0x8dc9('0x5')};function emitEvent(_0x218bac){return function(_0x51039e,_0x4c7169,_0x2f2f36){ChatMessageEvents[_0x8dc9('0x6')](_0x218bac+':'+_0x51039e['id'],_0x51039e);ChatMessageEvents[_0x8dc9('0x6')](_0x218bac,_0x51039e);_0x2f2f36(null);};}for(var e in events){if(events[_0x8dc9('0x7')](e)){var event=events[e];ChatMessage[_0x8dc9('0x8')](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file +var _0xe229=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatMessage','setMaxListeners','save','update'];(function(_0x795d14,_0x192d54){var _0xd15eef=function(_0x4edb2a){while(--_0x4edb2a){_0x795d14['push'](_0x795d14['shift']());}};_0xd15eef(++_0x192d54);}(_0xe229,0x94));var _0x9e22=function(_0x580ca3,_0x50473d){_0x580ca3=_0x580ca3-0x0;var _0x5d898b=_0xe229[_0x580ca3];return _0x5d898b;};'use strict';var EventEmitter=require(_0x9e22('0x0'));var ChatMessage=require(_0x9e22('0x1'))['db'][_0x9e22('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0x9e22('0x3')](0x0);var events={'afterCreate':_0x9e22('0x4'),'afterUpdate':_0x9e22('0x5'),'afterDestroy':_0x9e22('0x6')};function emitEvent(_0x6b4780){return function(_0x32a031,_0x11b2ba,_0x36baa0){ChatMessageEvents[_0x9e22('0x7')](_0x6b4780+':'+_0x32a031['id'],_0x32a031);ChatMessageEvents['emit'](_0x6b4780,_0x32a031);_0x36baa0(null);};}for(var e in events){if(events[_0x9e22('0x8')](e)){var event=events[e];ChatMessage[_0x9e22('0x9')](e,emitEvent(event));}}module[_0x9e22('0xa')]=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index bdf6e15..abc7aa5 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 _0x5119=['bluebird','request-promise','path','rimraf','../../config/environment','chat_messages','fti_chat_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','ChatInteraction','findOne','then','update','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment'];(function(_0x4d9329,_0x45ffc6){var _0x11cad0=function(_0x36a597){while(--_0x36a597){_0x4d9329['push'](_0x4d9329['shift']());}};_0x11cad0(++_0x45ffc6);}(_0x5119,0xc0));var _0x9511=function(_0x56085e,_0x5c69e9){_0x56085e=_0x56085e-0x0;var _0x4de130=_0x5119[_0x56085e];return _0x4de130;};'use strict';var _=require(_0x9511('0x0'));var util=require('util');var logger=require(_0x9511('0x1'))(_0x9511('0x2'));var moment=require(_0x9511('0x3'));var BPromise=require(_0x9511('0x4'));var rp=require(_0x9511('0x5'));var fs=require('fs');var path=require(_0x9511('0x6'));var rimraf=require(_0x9511('0x7'));var config=require(_0x9511('0x8'));var attributes=require('./chatMessage.attributes');module['exports']=function(_0x5575b5,_0xda3c1a){return _0x5575b5['define']('ChatMessage',attributes,{'tableName':_0x9511('0x9'),'paranoid':![],'indexes':[{'name':_0x9511('0xa'),'fields':[_0x9511('0xb')],'type':_0x9511('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3587fd,_0x37c27e,_0x5b041e){var _0x4996f7=_0x5575b5['models'];var _0x38a5cb=_0x3587fd[_0x9511('0xd')]({'plain':!![]});if(_0x38a5cb[_0x9511('0xe')]['toLowerCase']()==='in'||_0x38a5cb[_0x9511('0xe')][_0x9511('0xf')]()===_0x9511('0x10')&&!_0x38a5cb[_0x9511('0x11')]&&!_[_0x9511('0x12')](_0x38a5cb[_0x9511('0x13')])){_0x4996f7[_0x9511('0x14')][_0x9511('0x15')]({'where':{'id':_0x38a5cb['ChatInteractionId']}})[_0x9511('0x16')](function(_0x2c66d4){if(_0x2c66d4){_0x2c66d4[_0x9511('0x17')]({'lastMsgAt':_0x38a5cb['createdAt'],'lastMsgDirection':_0x38a5cb[_0x9511('0xe')]['toLowerCase']()});}})[_0x9511('0x18')](function(_0x5d2d26){console[_0x9511('0x19')](_0x5d2d26);});}_0x5b041e();}},'charset':_0x9511('0x1a'),'collate':_0x9511('0x1b')});}; \ No newline at end of file +var _0x4919=['ChatInteraction','ChatInteractionId','then','update','createdAt','catch','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatMessage.attributes','exports','define','ChatMessage','fti_chat_messages','FULLTEXT','get','direction','toLowerCase'];(function(_0x2ffa33,_0x5b8327){var _0x23e401=function(_0x65bd53){while(--_0x65bd53){_0x2ffa33['push'](_0x2ffa33['shift']());}};_0x23e401(++_0x5b8327);}(_0x4919,0xd7));var _0x9491=function(_0x2283dc,_0x2fcfc5){_0x2283dc=_0x2283dc-0x0;var _0x16db90=_0x4919[_0x2283dc];return _0x16db90;};'use strict';var _=require(_0x9491('0x0'));var util=require(_0x9491('0x1'));var logger=require(_0x9491('0x2'))(_0x9491('0x3'));var moment=require(_0x9491('0x4'));var BPromise=require(_0x9491('0x5'));var rp=require(_0x9491('0x6'));var fs=require('fs');var path=require(_0x9491('0x7'));var rimraf=require(_0x9491('0x8'));var config=require(_0x9491('0x9'));var attributes=require(_0x9491('0xa'));module[_0x9491('0xb')]=function(_0x138483,_0x5e12a7){return _0x138483[_0x9491('0xc')](_0x9491('0xd'),attributes,{'tableName':'chat_messages','paranoid':![],'indexes':[{'name':_0x9491('0xe'),'fields':['body'],'type':_0x9491('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2ae6c8,_0x40ecf5,_0x4c16ab){var _0x2b6e1b=_0x138483['models'];var _0x4413fa=_0x2ae6c8[_0x9491('0x10')]({'plain':!![]});if(_0x4413fa[_0x9491('0x11')][_0x9491('0x12')]()==='in'||_0x4413fa['direction'][_0x9491('0x12')]()==='out'&&!_0x4413fa['secret']&&!_['isNil'](_0x4413fa['UserId'])){_0x2b6e1b[_0x9491('0x13')]['findOne']({'where':{'id':_0x4413fa[_0x9491('0x14')]}})[_0x9491('0x15')](function(_0x382c03){if(_0x382c03){_0x382c03[_0x9491('0x16')]({'lastMsgAt':_0x4413fa[_0x9491('0x17')],'lastMsgDirection':_0x4413fa[_0x9491('0x11')]['toLowerCase']()});}})[_0x9491('0x18')](function(_0x3754a3){console['error'](_0x3754a3);});}_0x4c16ab();}},'charset':_0x9491('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 025c9b8..effba89 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 _0xc8a5=['body','options','raw','CreateChatMessage','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','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','code','message','catch','ChatMessage','create'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0xc8a5,0x1f3));var _0x5c8a=function(_0x3d14c4,_0x5c5807){_0x3d14c4=_0x3d14c4-0x0;var _0x359196=_0xc8a5[_0x3d14c4];return _0x359196;};'use strict';var _=require('lodash');var util=require(_0x5c8a('0x0'));var moment=require(_0x5c8a('0x1'));var BPromise=require('bluebird');var rs=require(_0x5c8a('0x2'));var fs=require('fs');var Redis=require(_0x5c8a('0x3'));var db=require(_0x5c8a('0x4'))['db'];var utils=require(_0x5c8a('0x5'));var logger=require(_0x5c8a('0x6'))('rpc');var config=require(_0x5c8a('0x7'));var jayson=require(_0x5c8a('0x8'));var client=jayson[_0x5c8a('0x9')][_0x5c8a('0xa')]({'port':0x232a});config[_0x5c8a('0xb')]=_['defaults'](config['redis'],{'host':_0x5c8a('0xc'),'port':0x18eb});var socket=require(_0x5c8a('0xd'))(new Redis(config[_0x5c8a('0xb')]));require(_0x5c8a('0xe'))[_0x5c8a('0xf')](socket);function respondWithRpcPromise(_0x1991f5,_0x1f8782,_0x4561bd){return new BPromise(function(_0x5043c7,_0x5c4640){return client[_0x5c8a('0x10')](_0x1991f5,_0x4561bd)[_0x5c8a('0x11')](function(_0x3f06a4){logger[_0x5c8a('0x12')](_0x5c8a('0x13'),_0x1f8782,_0x5c8a('0x14'));logger[_0x5c8a('0x15')]('ChatMessage,\x20%s,\x20%s,\x20%s',_0x1f8782,_0x5c8a('0x14'),JSON[_0x5c8a('0x16')](_0x3f06a4));if(_0x3f06a4['error']){if(_0x3f06a4[_0x5c8a('0x17')][_0x5c8a('0x18')]===0x1f4){logger[_0x5c8a('0x17')](_0x5c8a('0x13'),_0x1f8782,_0x3f06a4[_0x5c8a('0x17')]['message']);return _0x5c4640(_0x3f06a4['error'][_0x5c8a('0x19')]);}logger[_0x5c8a('0x17')](_0x5c8a('0x13'),_0x1f8782,_0x3f06a4[_0x5c8a('0x17')][_0x5c8a('0x19')]);return _0x5043c7(_0x3f06a4['error'][_0x5c8a('0x19')]);}else{logger[_0x5c8a('0x12')](_0x5c8a('0x13'),_0x1f8782,_0x5c8a('0x14'));_0x5043c7(_0x3f06a4['result']['message']);}})[_0x5c8a('0x1a')](function(_0x4b52ac){logger[_0x5c8a('0x17')](_0x5c8a('0x13'),_0x1f8782,_0x4b52ac);_0x5c4640(_0x4b52ac);});});}exports['CreateChatMessage']=function(_0x46cba6){var _0x1ee7c9=this;return new Promise(function(_0x5b504b,_0x5c263b){return db[_0x5c8a('0x1b')][_0x5c8a('0x1c')](_0x46cba6[_0x5c8a('0x1d')],{'raw':_0x46cba6[_0x5c8a('0x1e')]?_0x46cba6[_0x5c8a('0x1e')][_0x5c8a('0x1f')]===undefined?!![]:![]:!![]})[_0x5c8a('0x11')](function(_0x4b48c6){logger[_0x5c8a('0x12')](_0x5c8a('0x20'),_0x46cba6);logger['debug'](_0x5c8a('0x20'),_0x46cba6,JSON[_0x5c8a('0x16')](_0x4b48c6));_0x5b504b(_0x4b48c6);})[_0x5c8a('0x1a')](function(_0x4b3744){logger[_0x5c8a('0x17')](_0x5c8a('0x20'),_0x4b3744[_0x5c8a('0x19')],_0x46cba6);_0x5c263b(_0x1ee7c9[_0x5c8a('0x17')](0x1f4,_0x4b3744[_0x5c8a('0x19')]));});});}; \ No newline at end of file +var _0x124a=['ChatMessage','create','body','options','raw','CreateChatMessage','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','then','info','debug','ChatMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','ChatMessage,\x20%s,\x20%s','catch'];(function(_0x572706,_0xadcdb5){var _0x556ee9=function(_0x5c174b){while(--_0x5c174b){_0x572706['push'](_0x572706['shift']());}};_0x556ee9(++_0xadcdb5);}(_0x124a,0x171));var _0xa124=function(_0x18ccd6,_0x1098e8){_0x18ccd6=_0x18ccd6-0x0;var _0x587d2c=_0x124a[_0x18ccd6];return _0x587d2c;};'use strict';var _=require(_0xa124('0x0'));var util=require(_0xa124('0x1'));var moment=require(_0xa124('0x2'));var BPromise=require(_0xa124('0x3'));var rs=require(_0xa124('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xa124('0x5'));var logger=require(_0xa124('0x6'))('rpc');var config=require(_0xa124('0x7'));var jayson=require(_0xa124('0x8'));var client=jayson[_0xa124('0x9')]['http']({'port':0x232a});config[_0xa124('0xa')]=_['defaults'](config[_0xa124('0xa')],{'host':_0xa124('0xb'),'port':0x18eb});var socket=require(_0xa124('0xc'))(new Redis(config[_0xa124('0xa')]));require(_0xa124('0xd'))[_0xa124('0xe')](socket);function respondWithRpcPromise(_0x33ae07,_0x294747,_0x213f5c){return new BPromise(function(_0x1c8478,_0x49241a){return client[_0xa124('0xf')](_0x33ae07,_0x213f5c)[_0xa124('0x10')](function(_0x1e24c8){logger[_0xa124('0x11')]('ChatMessage,\x20%s,\x20%s',_0x294747,'request\x20sent');logger[_0xa124('0x12')](_0xa124('0x13'),_0x294747,_0xa124('0x14'),JSON[_0xa124('0x15')](_0x1e24c8));if(_0x1e24c8['error']){if(_0x1e24c8[_0xa124('0x16')][_0xa124('0x17')]===0x1f4){logger[_0xa124('0x16')]('ChatMessage,\x20%s,\x20%s',_0x294747,_0x1e24c8[_0xa124('0x16')][_0xa124('0x18')]);return _0x49241a(_0x1e24c8[_0xa124('0x16')][_0xa124('0x18')]);}logger['error'](_0xa124('0x19'),_0x294747,_0x1e24c8[_0xa124('0x16')]['message']);return _0x1c8478(_0x1e24c8[_0xa124('0x16')][_0xa124('0x18')]);}else{logger[_0xa124('0x11')](_0xa124('0x19'),_0x294747,_0xa124('0x14'));_0x1c8478(_0x1e24c8['result'][_0xa124('0x18')]);}})[_0xa124('0x1a')](function(_0x39e589){logger[_0xa124('0x16')](_0xa124('0x19'),_0x294747,_0x39e589);_0x49241a(_0x39e589);});});}exports['CreateChatMessage']=function(_0x5c1dee){var _0x3803a1=this;return new Promise(function(_0x132ddb,_0x39fe36){return db[_0xa124('0x1b')][_0xa124('0x1c')](_0x5c1dee[_0xa124('0x1d')],{'raw':_0x5c1dee['options']?_0x5c1dee[_0xa124('0x1e')][_0xa124('0x1f')]===undefined?!![]:![]:!![]})[_0xa124('0x10')](function(_0x564c11){logger[_0xa124('0x11')](_0xa124('0x20'),_0x5c1dee);logger['debug'](_0xa124('0x20'),_0x5c1dee,JSON['stringify'](_0x564c11));_0x132ddb(_0x564c11);})[_0xa124('0x1a')](function(_0x1d4a12){logger['error'](_0xa124('0x20'),_0x1d4a12[_0xa124('0x18')],_0x5c1dee);_0x39fe36(_0x3803a1[_0xa124('0x16')](0x1f4,_0x1d4a12[_0xa124('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 633e642..08ef478 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 _0x0fda=['register','length','./chatMessage.events','remove','update','emit'];(function(_0x55c485,_0x3fe77e){var _0x6bb521=function(_0x466a3d){while(--_0x466a3d){_0x55c485['push'](_0x55c485['shift']());}};_0x6bb521(++_0x3fe77e);}(_0x0fda,0x1a0));var _0xa0fd=function(_0x2380ca,_0x49a46a){_0x2380ca=_0x2380ca-0x0;var _0x5121f0=_0x0fda[_0x2380ca];return _0x5121f0;};'use strict';var ChatMessageEvents=require(_0xa0fd('0x0'));var events=['save',_0xa0fd('0x1'),_0xa0fd('0x2')];function createListener(_0x314a1a,_0x2f71f3){return function(_0x426242){_0x2f71f3[_0xa0fd('0x3')](_0x314a1a,_0x426242);};}function removeListener(_0x13c734,_0x574fca){return function(){ChatMessageEvents['removeListener'](_0x13c734,_0x574fca);};}exports[_0xa0fd('0x4')]=function(_0x4aec58){for(var _0x49b3c1=0x0,_0x868183=events[_0xa0fd('0x5')];_0x49b3c1<_0x868183;_0x49b3c1++){var _0x1aab41=events[_0x49b3c1];var _0x248cca=createListener('chatMessage:'+_0x1aab41,_0x4aec58);ChatMessageEvents['on'](_0x1aab41,_0x248cca);}}; \ No newline at end of file +var _0xae30=['length','chatMessage:','./chatMessage.events','save','remove','emit','removeListener','register'];(function(_0x3b4861,_0x59d989){var _0x4c5b77=function(_0x4de4f4){while(--_0x4de4f4){_0x3b4861['push'](_0x3b4861['shift']());}};_0x4c5b77(++_0x59d989);}(_0xae30,0x10a));var _0x0ae3=function(_0x49cdd0,_0x2508f9){_0x49cdd0=_0x49cdd0-0x0;var _0x13daaa=_0xae30[_0x49cdd0];return _0x13daaa;};'use strict';var ChatMessageEvents=require(_0x0ae3('0x0'));var events=[_0x0ae3('0x1'),_0x0ae3('0x2'),'update'];function createListener(_0x565144,_0x1352ef){return function(_0x405dd0){_0x1352ef[_0x0ae3('0x3')](_0x565144,_0x405dd0);};}function removeListener(_0x51f481,_0x23a7a1){return function(){ChatMessageEvents[_0x0ae3('0x4')](_0x51f481,_0x23a7a1);};}exports[_0x0ae3('0x5')]=function(_0x7ce33e){for(var _0x2b8c53=0x0,_0xda3853=events[_0x0ae3('0x6')];_0x2b8c53<_0xda3853;_0x2b8c53++){var _0x15b7e2=events[_0x2b8c53];var _0x32ea6e=createListener(_0x0ae3('0x7')+_0x15b7e2,_0x7ce33e);ChatMessageEvents['on'](_0x15b7e2,_0x32ea6e);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index c5108e3..08a21e4 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 _0x6ffe=['index','/describe','describe','/:id','show','post','tracked','chat','create','put','update','/:id/accept','isAuthenticated','accept','/:id/reject','reject','util','path','connect-timeout','express','../../components/auth/service','../../config/environment','./chatMessage.controller','get'];(function(_0x33f1f1,_0x3f2a10){var _0x3052d4=function(_0x2d62ad){while(--_0x2d62ad){_0x33f1f1['push'](_0x33f1f1['shift']());}};_0x3052d4(++_0x3f2a10);}(_0x6ffe,0x160));var _0xe6ff=function(_0x6f8972,_0x343da7){_0x6f8972=_0x6f8972-0x0;var _0x5677d9=_0x6ffe[_0x6f8972];return _0x5677d9;};'use strict';var multer=require('multer');var util=require(_0xe6ff('0x0'));var path=require(_0xe6ff('0x1'));var timeout=require(_0xe6ff('0x2'));var express=require(_0xe6ff('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe6ff('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe6ff('0x5'));var controller=require(_0xe6ff('0x6'));router[_0xe6ff('0x7')]('/',auth['isAuthenticated'](),controller[_0xe6ff('0x8')]);router[_0xe6ff('0x7')](_0xe6ff('0x9'),auth['isAuthenticated'](),controller[_0xe6ff('0xa')]);router[_0xe6ff('0x7')](_0xe6ff('0xb'),auth['isAuthenticated'](),controller[_0xe6ff('0xc')]);router[_0xe6ff('0xd')]('/',auth['isAuthenticated'](),interaction[_0xe6ff('0xe')](_0xe6ff('0xf'),'chatmessage:create'),controller[_0xe6ff('0x10')]);router[_0xe6ff('0x11')](_0xe6ff('0xb'),controller[_0xe6ff('0x12')]);router[_0xe6ff('0x11')](_0xe6ff('0x13'),auth[_0xe6ff('0x14')](),controller[_0xe6ff('0x15')]);router[_0xe6ff('0x11')](_0xe6ff('0x16'),auth[_0xe6ff('0x14')](),controller[_0xe6ff('0x17')]);router['delete']('/:id',auth[_0xe6ff('0x14')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x3e1c=['delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatMessage.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','tracked','chat','chatmessage:create','put','update','accept','/:id/reject'];(function(_0x3a852a,_0xf3f1d3){var _0x48c902=function(_0x22cdd1){while(--_0x22cdd1){_0x3a852a['push'](_0x3a852a['shift']());}};_0x48c902(++_0xf3f1d3);}(_0x3e1c,0x161));var _0xc3e1=function(_0x3134cd,_0x496ddf){_0x3134cd=_0x3134cd-0x0;var _0x47ec42=_0x3e1c[_0x3134cd];return _0x47ec42;};'use strict';var multer=require(_0xc3e1('0x0'));var util=require(_0xc3e1('0x1'));var path=require(_0xc3e1('0x2'));var timeout=require(_0xc3e1('0x3'));var express=require(_0xc3e1('0x4'));var router=express[_0xc3e1('0x5')]();var fs_extra=require(_0xc3e1('0x6'));var auth=require(_0xc3e1('0x7'));var interaction=require(_0xc3e1('0x8'));var config=require('../../config/environment');var controller=require(_0xc3e1('0x9'));router['get']('/',auth[_0xc3e1('0xa')](),controller[_0xc3e1('0xb')]);router[_0xc3e1('0xc')](_0xc3e1('0xd'),auth[_0xc3e1('0xa')](),controller[_0xc3e1('0xe')]);router[_0xc3e1('0xc')](_0xc3e1('0xf'),auth[_0xc3e1('0xa')](),controller[_0xc3e1('0x10')]);router[_0xc3e1('0x11')]('/',auth[_0xc3e1('0xa')](),interaction[_0xc3e1('0x12')](_0xc3e1('0x13'),_0xc3e1('0x14')),controller['create']);router[_0xc3e1('0x15')](_0xc3e1('0xf'),controller[_0xc3e1('0x16')]);router[_0xc3e1('0x15')]('/:id/accept',auth[_0xc3e1('0xa')](),controller[_0xc3e1('0x17')]);router['put'](_0xc3e1('0x18'),auth[_0xc3e1('0xa')](),controller['reject']);router[_0xc3e1('0x19')]('/:id',auth['isAuthenticated'](),controller[_0xc3e1('0x1a')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js index ef060e1..5449bb5 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 _0x983f=['medium','exports','TEXT'];(function(_0x1d1277,_0xb0d50d){var _0xdee093=function(_0x481872){while(--_0x481872){_0x1d1277['push'](_0x1d1277['shift']());}};_0xdee093(++_0xb0d50d);}(_0x983f,0x184));var _0xf983=function(_0x51781a,_0xad4f5c){_0x51781a=_0x51781a-0x0;var _0x2325f9=_0x983f[_0x51781a];return _0x2325f9;};'use strict';var Sequelize=require('sequelize');module[_0xf983('0x0')]={'body':{'type':Sequelize[_0xf983('0x1')](_0xf983('0x2')),'allowNull':![]}}; \ No newline at end of file +var _0x4a9e=['TEXT','sequelize'];(function(_0x4d1ce8,_0x1a778e){var _0x129384=function(_0x15e43b){while(--_0x15e43b){_0x4d1ce8['push'](_0x4d1ce8['shift']());}};_0x129384(++_0x1a778e);}(_0x4a9e,0x13d));var _0xe4a9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4a9e[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xe4a9('0x0'));module['exports']={'body':{'type':Sequelize[_0xe4a9('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index b347851..ddbe666 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 _0x7a54=['filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','Attachment','join','server','attachments','offline-chat','basename','remove','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','ChatOfflineMessage','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x7a54,0x106));var _0x47a5=function(_0x1f820b,_0x436a3b){_0x1f820b=_0x1f820b-0x0;var _0x540aeb=_0x7a54[_0x1f820b];return _0x540aeb;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['ChatOfflineMessage'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':!![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['ChatOfflineMessage']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['ChatOfflineMessage']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x48')][_0x47a5('0x3e')]({'where':{'ChatOfflineMessageId':_0x2dd1db[_0x47a5('0x41')]['id']},'raw':!![]})[_0x47a5('0x23')](function(_0x249de5){_0x249de5['forEach'](function(_0x45cca5){var _0x1c9a62=path[_0x47a5('0x49')](config['root'],_0x47a5('0x4a'),'files',_0x47a5('0x4b'),_0x47a5('0x4c'),_0x45cca5[_0x47a5('0x4d')]);var _0xf03bd5=fs['existsSync'](_0x1c9a62);if(_0xf03bd5)fs_extra[_0x47a5('0x4e')](_0x1c9a62);});})[_0x47a5('0x23')](function(){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']},'individualHooks':!![]});})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));};exports[_0x47a5('0x4f')]=function(_0x43721b,_0x187d7e){return db[_0x47a5('0x2a')][_0x47a5('0x4f')]()[_0x47a5('0x23')](respondWithResult(_0x187d7e,null))['catch'](handleError(_0x187d7e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','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'];(function(_0x190430,_0x1de9ae){var _0x55dfcf=function(_0x14aedc){while(--_0x14aedc){_0x190430['push'](_0x190430['shift']());}};_0x55dfcf(++_0x1de9ae);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'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'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index b71eef4..d93b594 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 _0xb971=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes','exports','ChatOfflineMessage','chat_offline_messages','utf8mb4','utf8mb4_unicode_ci','lodash','util'];(function(_0x5b564d,_0x533fa7){var _0x37cac6=function(_0x5e12a0){while(--_0x5e12a0){_0x5b564d['push'](_0x5b564d['shift']());}};_0x37cac6(++_0x533fa7);}(_0xb971,0x124));var _0x1b97=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb971[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1b97('0x0'));var util=require(_0x1b97('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x1b97('0x2'));var BPromise=require(_0x1b97('0x3'));var rp=require(_0x1b97('0x4'));var fs=require('fs');var path=require(_0x1b97('0x5'));var rimraf=require(_0x1b97('0x6'));var config=require(_0x1b97('0x7'));var attributes=require(_0x1b97('0x8'));module[_0x1b97('0x9')]=function(_0x399e9d,_0x2f01d4){return _0x399e9d['define'](_0x1b97('0xa'),attributes,{'tableName':_0x1b97('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x1b97('0xc'),'collate':_0x1b97('0xd')});}; \ No newline at end of file +var _0xeacf=['exports','define','ChatOfflineMessage','chat_offline_messages','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatOfflineMessage.attributes'];(function(_0x568cf0,_0x1a44cb){var _0x360f81=function(_0x414953){while(--_0x414953){_0x568cf0['push'](_0x568cf0['shift']());}};_0x360f81(++_0x1a44cb);}(_0xeacf,0x1f4));var _0xfeac=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xeacf[_0x2bf141];return _0x48277b;};'use strict';var _=require('lodash');var util=require(_0xfeac('0x0'));var logger=require(_0xfeac('0x1'))(_0xfeac('0x2'));var moment=require(_0xfeac('0x3'));var BPromise=require(_0xfeac('0x4'));var rp=require(_0xfeac('0x5'));var fs=require('fs');var path=require(_0xfeac('0x6'));var rimraf=require(_0xfeac('0x7'));var config=require(_0xfeac('0x8'));var attributes=require(_0xfeac('0x9'));module[_0xfeac('0xa')]=function(_0x237b76,_0x136fd0){return _0x237b76[_0xfeac('0xb')](_0xfeac('0xc'),attributes,{'tableName':_0xfeac('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xfeac('0xe')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index 420c284..f8d0ccd 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 _0x7c49=['randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x12b093,_0x328e89){var _0x419bb4=function(_0x5e6b5e){while(--_0x5e6b5e){_0x12b093['push'](_0x12b093['shift']());}};_0x419bb4(++_0x328e89);}(_0x7c49,0x141));var _0x97c4=function(_0x11c1a5,_0x54caef){_0x11c1a5=_0x11c1a5-0x0;var _0x4c176a=_0x7c49[_0x11c1a5];return _0x4c176a;};'use strict';var _=require(_0x97c4('0x0'));var util=require(_0x97c4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x97c4('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x97c4('0x3'))['db'];var utils=require(_0x97c4('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x97c4('0x5'));var jayson=require(_0x97c4('0x6'));var client=jayson[_0x97c4('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x249c86,_0x165334,_0x585222){return new BPromise(function(_0x373855,_0x339817){return client[_0x97c4('0x8')](_0x249c86,_0x585222)[_0x97c4('0x9')](function(_0x12e98d){logger[_0x97c4('0xa')](_0x97c4('0xb'),_0x165334,_0x97c4('0xc'));logger['debug']('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x165334,_0x97c4('0xc'),JSON[_0x97c4('0xd')](_0x12e98d));if(_0x12e98d['error']){if(_0x12e98d[_0x97c4('0xe')][_0x97c4('0xf')]===0x1f4){logger[_0x97c4('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x165334,_0x12e98d['error'][_0x97c4('0x10')]);return _0x339817(_0x12e98d[_0x97c4('0xe')]['message']);}logger[_0x97c4('0xe')]('ChatOfflineMessage,\x20%s,\x20%s',_0x165334,_0x12e98d[_0x97c4('0xe')][_0x97c4('0x10')]);return _0x373855(_0x12e98d[_0x97c4('0xe')][_0x97c4('0x10')]);}else{logger[_0x97c4('0xa')](_0x97c4('0xb'),_0x165334,'request\x20sent');_0x373855(_0x12e98d[_0x97c4('0x11')]['message']);}})[_0x97c4('0x12')](function(_0x465c79){logger[_0x97c4('0xe')](_0x97c4('0xb'),_0x165334,_0x465c79);_0x339817(_0x465c79);});});} \ No newline at end of file +var _0x3c75=['util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x5c43dc,_0x1d4884){var _0x17c8b0=function(_0x441664){while(--_0x441664){_0x5c43dc['push'](_0x5c43dc['shift']());}};_0x17c8b0(++_0x1d4884);}(_0x3c75,0xa8));var _0x53c7=function(_0x3c541c,_0x15a4b4){_0x3c541c=_0x3c541c-0x0;var _0x15e676=_0x3c75[_0x3c541c];return _0x15e676;};'use strict';var _=require('lodash');var util=require(_0x53c7('0x0'));var moment=require(_0x53c7('0x1'));var BPromise=require(_0x53c7('0x2'));var rs=require(_0x53c7('0x3'));var fs=require('fs');var Redis=require(_0x53c7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x53c7('0x5'));var logger=require(_0x53c7('0x6'))(_0x53c7('0x7'));var config=require(_0x53c7('0x8'));var jayson=require(_0x53c7('0x9'));var client=jayson[_0x53c7('0xa')][_0x53c7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5a5fe5,_0x4b876c,_0x5342fb){return new BPromise(function(_0x1478b6,_0x37da3b){return client[_0x53c7('0xc')](_0x5a5fe5,_0x5342fb)[_0x53c7('0xd')](function(_0x8ebc9d){logger[_0x53c7('0xe')](_0x53c7('0xf'),_0x4b876c,_0x53c7('0x10'));logger[_0x53c7('0x11')]('ChatOfflineMessage,\x20%s,\x20%s,\x20%s',_0x4b876c,_0x53c7('0x10'),JSON[_0x53c7('0x12')](_0x8ebc9d));if(_0x8ebc9d[_0x53c7('0x13')]){if(_0x8ebc9d['error'][_0x53c7('0x14')]===0x1f4){logger[_0x53c7('0x13')](_0x53c7('0xf'),_0x4b876c,_0x8ebc9d[_0x53c7('0x13')][_0x53c7('0x15')]);return _0x37da3b(_0x8ebc9d[_0x53c7('0x13')][_0x53c7('0x15')]);}logger[_0x53c7('0x13')](_0x53c7('0xf'),_0x4b876c,_0x8ebc9d['error']['message']);return _0x1478b6(_0x8ebc9d[_0x53c7('0x13')][_0x53c7('0x15')]);}else{logger[_0x53c7('0xe')](_0x53c7('0xf'),_0x4b876c,_0x53c7('0x10'));_0x1478b6(_0x8ebc9d[_0x53c7('0x16')]['message']);}})[_0x53c7('0x17')](function(_0x4f458b){logger[_0x53c7('0x13')]('ChatOfflineMessage,\x20%s,\x20%s',_0x4b876c,_0x4f458b);_0x37da3b(_0x4f458b);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index 7ec100b..971357f 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 _0x99bf=['post','create','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','/:id','show'];(function(_0x5d5b0c,_0x4aada9){var _0x3d8c82=function(_0x199a41){while(--_0x199a41){_0x5d5b0c['push'](_0x5d5b0c['shift']());}};_0x3d8c82(++_0x4aada9);}(_0x99bf,0x7f));var _0xf99b=function(_0x322177,_0x4a29c4){_0x322177=_0x322177-0x0;var _0x357c57=_0x99bf[_0x322177];return _0x357c57;};'use strict';var multer=require(_0xf99b('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf99b('0x1'));var express=require(_0xf99b('0x2'));var router=express[_0xf99b('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf99b('0x4'));var interaction=require(_0xf99b('0x5'));var config=require(_0xf99b('0x6'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0xf99b('0x7')](),controller[_0xf99b('0x8')]);router[_0xf99b('0x9')](_0xf99b('0xa'),auth[_0xf99b('0x7')](),controller['describe']);router[_0xf99b('0x9')](_0xf99b('0xb'),auth[_0xf99b('0x7')](),controller[_0xf99b('0xc')]);router[_0xf99b('0xd')]('/',auth['isAuthenticated'](),controller[_0xf99b('0xe')]);router[_0xf99b('0xf')](_0xf99b('0xb'),auth['isAuthenticated'](),controller[_0xf99b('0x10')]);router[_0xf99b('0x11')](_0xf99b('0xb'),auth[_0xf99b('0x7')](),controller[_0xf99b('0x12')]);module[_0xf99b('0x13')]=router; \ No newline at end of file +var _0xca6a=['get','describe','/:id','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','./chatOfflineMessage.controller','isAuthenticated','index'];(function(_0x9b4965,_0x49372d){var _0x344a8c=function(_0x5609b0){while(--_0x5609b0){_0x9b4965['push'](_0x9b4965['shift']());}};_0x344a8c(++_0x49372d);}(_0xca6a,0x14c));var _0xaca6=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0xca6a[_0x4c12ec];return _0x3ae42c;};'use strict';var multer=require(_0xaca6('0x0'));var util=require(_0xaca6('0x1'));var path=require(_0xaca6('0x2'));var timeout=require(_0xaca6('0x3'));var express=require('express');var router=express[_0xaca6('0x4')]();var fs_extra=require(_0xaca6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaca6('0x6'));var config=require('../../config/environment');var controller=require(_0xaca6('0x7'));router['get']('/',auth[_0xaca6('0x8')](),controller[_0xaca6('0x9')]);router[_0xaca6('0xa')]('/describe',auth['isAuthenticated'](),controller[_0xaca6('0xb')]);router['get'](_0xaca6('0xc'),auth[_0xaca6('0x8')](),controller['show']);router[_0xaca6('0xd')]('/',auth[_0xaca6('0x8')](),controller['create']);router[_0xaca6('0xe')](_0xaca6('0xc'),auth[_0xaca6('0x8')](),controller[_0xaca6('0xf')]);router[_0xaca6('0x10')](_0xaca6('0xc'),auth[_0xaca6('0x8')](),controller[_0xaca6('0x11')]);module[_0xaca6('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index e3bf57f..dae6ebe 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 _0x5cbb=['INTEGER','sequelize','exports','STRING','mouseOver','timeout'];(function(_0x50a7ae,_0x20a180){var _0x2a8683=function(_0x51fa9e){while(--_0x51fa9e){_0x50a7ae['push'](_0x50a7ae['shift']());}};_0x2a8683(++_0x20a180);}(_0x5cbb,0x15d));var _0xb5cb=function(_0x5a23b7,_0x5a1a7d){_0x5a23b7=_0x5a23b7-0x0;var _0x367554=_0x5cbb[_0x5a23b7];return _0x367554;};'use strict';var Sequelize=require(_0xb5cb('0x0'));module[_0xb5cb('0x1')]={'name':{'type':Sequelize[_0xb5cb('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xb5cb('0x3'),_0xb5cb('0x4')),'defaultValue':_0xb5cb('0x3')},'selector':{'type':Sequelize[_0xb5cb('0x2')]},'timeout':{'type':Sequelize[_0xb5cb('0x5')]}}; \ No newline at end of file +var _0x39bf=['ENUM','mouseOver','exports','STRING'];(function(_0x255142,_0x4ee506){var _0xecb1ec=function(_0x399331){while(--_0x399331){_0x255142['push'](_0x255142['shift']());}};_0xecb1ec(++_0x4ee506);}(_0x39bf,0x17e));var _0xf39b=function(_0x38788f,_0x58be0c){_0x38788f=_0x38788f-0x0;var _0x2bb9b0=_0x39bf[_0x38788f];return _0x2bb9b0;};'use strict';var Sequelize=require('sequelize');module[_0xf39b('0x0')]={'name':{'type':Sequelize[_0xf39b('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xf39b('0x2')]('mouseOver','timeout'),'defaultValue':_0xf39b('0x3')},'selector':{'type':Sequelize[_0xf39b('0x1')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index a44c16b..0ef5d57 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 _0x029b=['ejs','fs-extra','lodash','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','send','show','model','keys','ChatProactiveAction','query','filters','attributes','intersection','fields','include','merge','catch','create','body','params','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv'];(function(_0x129c6a,_0x4e6b64){var _0x1bfec3=function(_0x546ac8){while(--_0x546ac8){_0x129c6a['push'](_0x129c6a['shift']());}};_0x1bfec3(++_0x4e6b64);}(_0x029b,0x66));var _0xb029=function(_0x506be3,_0xcc6e66){_0x506be3=_0x506be3-0x0;var _0x20361b=_0x029b[_0x506be3];return _0x20361b;};'use strict';var emlformat=require(_0xb029('0x0'));var rimraf=require(_0xb029('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb029('0x2'));var rp=require(_0xb029('0x3'));var moment=require('moment');var BPromise=require(_0xb029('0x4'));var Mustache=require(_0xb029('0x5'));var util=require('util');var path=require('path');var sox=require(_0xb029('0x6'));var csv=require(_0xb029('0x7'));var ejs=require(_0xb029('0x8'));var fs=require('fs');var fs_extra=require(_0xb029('0x9'));var _=require(_0xb029('0xa'));var squel=require('squel');var crypto=require(_0xb029('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xb029('0xc'));var toCsv=require('to-csv');var querystring=require(_0xb029('0xd'));var Papa=require('papaparse');var Redis=require(_0xb029('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xb029('0xf'));var as=require(_0xb029('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb029('0x11'))(_0xb029('0x12'));var utils=require(_0xb029('0x13'));var config=require(_0xb029('0x14'));var licenseUtil=require(_0xb029('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x13c87c,_0x4b6202){_0x4b6202=_0x4b6202||0xcc;return function(_0x2ba6c2){if(_0x2ba6c2){return _0x13c87c[_0xb029('0x16')](_0x4b6202);}return _0x13c87c[_0xb029('0x17')](_0x4b6202)[_0xb029('0x18')]();};}function respondWithResult(_0x5ce391,_0x337ab5){_0x337ab5=_0x337ab5||0xc8;return function(_0x356552){if(_0x356552){return _0x5ce391[_0xb029('0x17')](_0x337ab5)['json'](_0x356552);}};}function respondWithFilteredResult(_0x5617c,_0x3afa2b){return function(_0x379fdb){if(_0x379fdb){var _0x3434cf=typeof _0x3afa2b[_0xb029('0x19')]===_0xb029('0x1a')&&typeof _0x3afa2b[_0xb029('0x1b')]===_0xb029('0x1a');var _0x3f91cb=_0x379fdb['count'];var _0x58fbe7=_0x3434cf?0x0:_0x3afa2b[_0xb029('0x19')];var _0x5373cd=_0x3434cf?_0x379fdb[_0xb029('0x1c')]:_0x3afa2b[_0xb029('0x19')]+_0x3afa2b[_0xb029('0x1b')];var _0x497ca0;if(_0x5373cd>=_0x3f91cb){_0x5373cd=_0x3f91cb;_0x497ca0=0xc8;}else{_0x497ca0=0xce;}_0x5617c['status'](_0x497ca0);return _0x5617c[_0xb029('0x1d')](_0xb029('0x1e'),_0x58fbe7+'-'+_0x5373cd+'/'+_0x3f91cb)[_0xb029('0x1f')](_0x379fdb);}return null;};}function patchUpdates(_0x3381b2){return function(_0x3c4396){try{jsonpatch[_0xb029('0x20')](_0x3c4396,_0x3381b2,!![]);}catch(_0x530486){return BPromise['reject'](_0x530486);}return _0x3c4396['save']();};}function saveUpdates(_0x5a79fa,_0x3e1dc4){return function(_0x1e16a3){if(_0x1e16a3){return _0x1e16a3[_0xb029('0x21')](_0x5a79fa)[_0xb029('0x22')](function(_0x500bb6){return _0x500bb6;});}return null;};}function removeEntity(_0x3642b5,_0x379ef3){return function(_0x42b91e){if(_0x42b91e){return _0x42b91e[_0xb029('0x23')]()[_0xb029('0x22')](function(){_0x3642b5[_0xb029('0x17')](0xcc)[_0xb029('0x18')]();});}};}function handleEntityNotFound(_0x3eb5ac,_0x147ad0){return function(_0x3671e6){if(!_0x3671e6){_0x3eb5ac[_0xb029('0x16')](0x194);}return _0x3671e6;};}function handleError(_0x22dccd,_0x279e4a){_0x279e4a=_0x279e4a||0x1f4;return function(_0x599a14){logger[_0xb029('0x24')](_0x599a14[_0xb029('0x25')]);if(_0x599a14['name']){delete _0x599a14['name'];}_0x22dccd[_0xb029('0x17')](_0x279e4a)[_0xb029('0x26')](_0x599a14);};}exports[_0xb029('0x27')]=function(_0x45cb0c,_0x3632a0){var _0x4af2ad={'raw':!![],'where':{'id':_0x45cb0c['params']['id']}},_0x605a61={};_0x605a61[_0xb029('0x28')]=_[_0xb029('0x29')](db[_0xb029('0x2a')]['rawAttributes']);_0x605a61[_0xb029('0x2b')]=_[_0xb029('0x29')](_0x45cb0c['query']);_0x605a61[_0xb029('0x2c')]=_['intersection'](_0x605a61[_0xb029('0x28')],_0x605a61['query']);_0x4af2ad[_0xb029('0x2d')]=_[_0xb029('0x2e')](_0x605a61[_0xb029('0x28')],qs[_0xb029('0x2f')](_0x45cb0c[_0xb029('0x2b')][_0xb029('0x2f')]));_0x4af2ad[_0xb029('0x2d')]=_0x4af2ad[_0xb029('0x2d')]['length']?_0x4af2ad[_0xb029('0x2d')]:_0x605a61[_0xb029('0x28')];if(_0x45cb0c[_0xb029('0x2b')]['includeAll']){_0x4af2ad[_0xb029('0x30')]=[{'all':!![]}];}_0x4af2ad=_[_0xb029('0x31')]({},_0x4af2ad,_0x45cb0c['options']);return db[_0xb029('0x2a')]['find'](_0x4af2ad)[_0xb029('0x22')](handleEntityNotFound(_0x3632a0,null))['then'](respondWithResult(_0x3632a0,null))[_0xb029('0x32')](handleError(_0x3632a0,null));};exports[_0xb029('0x33')]=function(_0x43bf36,_0xae3440){return db[_0xb029('0x2a')][_0xb029('0x33')](_0x43bf36[_0xb029('0x34')],{})['then'](respondWithResult(_0xae3440,0xc9))[_0xb029('0x32')](handleError(_0xae3440,null));};exports[_0xb029('0x21')]=function(_0x4ce95d,_0x38f4eb){if(_0x4ce95d[_0xb029('0x34')]['id']){delete _0x4ce95d[_0xb029('0x34')]['id'];}return db[_0xb029('0x2a')]['find']({'where':{'id':_0x4ce95d[_0xb029('0x35')]['id']}})[_0xb029('0x22')](handleEntityNotFound(_0x38f4eb,null))[_0xb029('0x22')](saveUpdates(_0x4ce95d['body'],null))[_0xb029('0x22')](respondWithResult(_0x38f4eb,null))[_0xb029('0x32')](handleError(_0x38f4eb,null));};exports[_0xb029('0x23')]=function(_0x35b3b9,_0x109fe6){return db[_0xb029('0x2a')][_0xb029('0x36')]({'where':{'id':_0x35b3b9[_0xb029('0x35')]['id']}})[_0xb029('0x22')](handleEntityNotFound(_0x109fe6,null))[_0xb029('0x22')](removeEntity(_0x109fe6,null))['catch'](handleError(_0x109fe6,null));}; \ No newline at end of file +var _0xa4ba=['status','json','offset','undefined','limit','count','set','reject','save','update','then','destroy','sendStatus','error','stack','name','send','show','params','model','ChatProactiveAction','rawAttributes','query','intersection','attributes','fields','length','includeAll','merge','find','create','catch','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','lodash','crypto','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'];(function(_0x3323e7,_0x3b77aa){var _0x27fc67=function(_0x3b125a){while(--_0x3b125a){_0x3323e7['push'](_0x3323e7['shift']());}};_0x27fc67(++_0x3b77aa);}(_0xa4ba,0x1b7));var _0xaa4b=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0xa4ba[_0x4ae6ef];return _0x3cbb4e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaa4b('0x0'));var zipdir=require(_0xaa4b('0x1'));var jsonpatch=require(_0xaa4b('0x2'));var rp=require(_0xaa4b('0x3'));var moment=require('moment');var BPromise=require(_0xaa4b('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xaa4b('0x5'));var sox=require(_0xaa4b('0x6'));var csv=require(_0xaa4b('0x7'));var ejs=require(_0xaa4b('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaa4b('0x9'));var squel=require('squel');var crypto=require(_0xaa4b('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xaa4b('0x7'));var querystring=require(_0xaa4b('0xb'));var Papa=require(_0xaa4b('0xc'));var Redis=require(_0xaa4b('0xd'));var authService=require(_0xaa4b('0xe'));var qs=require(_0xaa4b('0xf'));var as=require(_0xaa4b('0x10'));var hardwareService=require(_0xaa4b('0x11'));var logger=require(_0xaa4b('0x12'))(_0xaa4b('0x13'));var utils=require(_0xaa4b('0x14'));var config=require(_0xaa4b('0x15'));var licenseUtil=require(_0xaa4b('0x16'));var db=require(_0xaa4b('0x17'))['db'];function respondWithStatusCode(_0x398c2c,_0x110db3){_0x110db3=_0x110db3||0xcc;return function(_0x261e8c){if(_0x261e8c){return _0x398c2c['sendStatus'](_0x110db3);}return _0x398c2c['status'](_0x110db3)[_0xaa4b('0x18')]();};}function respondWithResult(_0x5d6f41,_0x5e73ad){_0x5e73ad=_0x5e73ad||0xc8;return function(_0x3eb6a0){if(_0x3eb6a0){return _0x5d6f41[_0xaa4b('0x19')](_0x5e73ad)[_0xaa4b('0x1a')](_0x3eb6a0);}};}function respondWithFilteredResult(_0x72fe11,_0x3d2565){return function(_0x130e13){if(_0x130e13){var _0x272e4b=typeof _0x3d2565[_0xaa4b('0x1b')]===_0xaa4b('0x1c')&&typeof _0x3d2565[_0xaa4b('0x1d')]===_0xaa4b('0x1c');var _0x34a6f0=_0x130e13[_0xaa4b('0x1e')];var _0x91c4ec=_0x272e4b?0x0:_0x3d2565[_0xaa4b('0x1b')];var _0x309555=_0x272e4b?_0x130e13[_0xaa4b('0x1e')]:_0x3d2565[_0xaa4b('0x1b')]+_0x3d2565['limit'];var _0x559e59;if(_0x309555>=_0x34a6f0){_0x309555=_0x34a6f0;_0x559e59=0xc8;}else{_0x559e59=0xce;}_0x72fe11[_0xaa4b('0x19')](_0x559e59);return _0x72fe11[_0xaa4b('0x1f')]('Content-Range',_0x91c4ec+'-'+_0x309555+'/'+_0x34a6f0)[_0xaa4b('0x1a')](_0x130e13);}return null;};}function patchUpdates(_0xf1a873){return function(_0xcd3957){try{jsonpatch['apply'](_0xcd3957,_0xf1a873,!![]);}catch(_0x87615f){return BPromise[_0xaa4b('0x20')](_0x87615f);}return _0xcd3957[_0xaa4b('0x21')]();};}function saveUpdates(_0xf59a5c,_0x3c1c71){return function(_0x2266eb){if(_0x2266eb){return _0x2266eb[_0xaa4b('0x22')](_0xf59a5c)[_0xaa4b('0x23')](function(_0x6ae7f2){return _0x6ae7f2;});}return null;};}function removeEntity(_0x404ca2,_0x5e5bb8){return function(_0x1d6c10){if(_0x1d6c10){return _0x1d6c10[_0xaa4b('0x24')]()['then'](function(){_0x404ca2[_0xaa4b('0x19')](0xcc)[_0xaa4b('0x18')]();});}};}function handleEntityNotFound(_0x15ec32,_0x2e254e){return function(_0x4b925b){if(!_0x4b925b){_0x15ec32[_0xaa4b('0x25')](0x194);}return _0x4b925b;};}function handleError(_0x1c681b,_0x5f3ade){_0x5f3ade=_0x5f3ade||0x1f4;return function(_0x45a0f3){logger[_0xaa4b('0x26')](_0x45a0f3[_0xaa4b('0x27')]);if(_0x45a0f3['name']){delete _0x45a0f3[_0xaa4b('0x28')];}_0x1c681b['status'](_0x5f3ade)[_0xaa4b('0x29')](_0x45a0f3);};}exports[_0xaa4b('0x2a')]=function(_0x3f768e,_0x494def){var _0x1a9c51={'raw':!![],'where':{'id':_0x3f768e[_0xaa4b('0x2b')]['id']}},_0x35c3c4={};_0x35c3c4[_0xaa4b('0x2c')]=_['keys'](db[_0xaa4b('0x2d')][_0xaa4b('0x2e')]);_0x35c3c4['query']=_['keys'](_0x3f768e[_0xaa4b('0x2f')]);_0x35c3c4['filters']=_[_0xaa4b('0x30')](_0x35c3c4[_0xaa4b('0x2c')],_0x35c3c4['query']);_0x1a9c51[_0xaa4b('0x31')]=_[_0xaa4b('0x30')](_0x35c3c4[_0xaa4b('0x2c')],qs[_0xaa4b('0x32')](_0x3f768e[_0xaa4b('0x2f')][_0xaa4b('0x32')]));_0x1a9c51[_0xaa4b('0x31')]=_0x1a9c51[_0xaa4b('0x31')][_0xaa4b('0x33')]?_0x1a9c51[_0xaa4b('0x31')]:_0x35c3c4['model'];if(_0x3f768e[_0xaa4b('0x2f')][_0xaa4b('0x34')]){_0x1a9c51['include']=[{'all':!![]}];}_0x1a9c51=_[_0xaa4b('0x35')]({},_0x1a9c51,_0x3f768e['options']);return db[_0xaa4b('0x2d')][_0xaa4b('0x36')](_0x1a9c51)[_0xaa4b('0x23')](handleEntityNotFound(_0x494def,null))[_0xaa4b('0x23')](respondWithResult(_0x494def,null))['catch'](handleError(_0x494def,null));};exports[_0xaa4b('0x37')]=function(_0x1fd94d,_0x5b25c9){return db[_0xaa4b('0x2d')][_0xaa4b('0x37')](_0x1fd94d['body'],{})[_0xaa4b('0x23')](respondWithResult(_0x5b25c9,0xc9))[_0xaa4b('0x38')](handleError(_0x5b25c9,null));};exports[_0xaa4b('0x22')]=function(_0x2d5e05,_0x2225bf){if(_0x2d5e05[_0xaa4b('0x39')]['id']){delete _0x2d5e05[_0xaa4b('0x39')]['id'];}return db[_0xaa4b('0x2d')][_0xaa4b('0x36')]({'where':{'id':_0x2d5e05[_0xaa4b('0x2b')]['id']}})[_0xaa4b('0x23')](handleEntityNotFound(_0x2225bf,null))['then'](saveUpdates(_0x2d5e05[_0xaa4b('0x39')],null))[_0xaa4b('0x23')](respondWithResult(_0x2225bf,null))[_0xaa4b('0x38')](handleError(_0x2225bf,null));};exports[_0xaa4b('0x24')]=function(_0x8ed873,_0x4bd8c0){return db[_0xaa4b('0x2d')]['find']({'where':{'id':_0x8ed873['params']['id']}})[_0xaa4b('0x23')](handleEntityNotFound(_0x4bd8c0,null))[_0xaa4b('0x23')](removeEntity(_0x4bd8c0,null))[_0xaa4b('0x38')](handleError(_0x4bd8c0,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index 9877fe9..7f1efe6 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 _0x3b5b=['rimraf','./chatProactiveAction.attributes','define','chat_proactive_actions','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x5c4f03,_0x4e97c9){var _0x51fc50=function(_0x43e627){while(--_0x43e627){_0x5c4f03['push'](_0x5c4f03['shift']());}};_0x51fc50(++_0x4e97c9);}(_0x3b5b,0x19e));var _0xb3b5=function(_0x3fb166,_0x4eb985){_0x3fb166=_0x3fb166-0x0;var _0x5e91be=_0x3b5b[_0x3fb166];return _0x5e91be;};'use strict';var _=require(_0xb3b5('0x0'));var util=require(_0xb3b5('0x1'));var logger=require(_0xb3b5('0x2'))('api');var moment=require(_0xb3b5('0x3'));var BPromise=require(_0xb3b5('0x4'));var rp=require(_0xb3b5('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb3b5('0x6'));var config=require('../../config/environment');var attributes=require(_0xb3b5('0x7'));module['exports']=function(_0x41fdfa,_0x267528){return _0x41fdfa[_0xb3b5('0x8')]('ChatProactiveAction',attributes,{'tableName':_0xb3b5('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4268=['rimraf','../../config/environment','exports','ChatProactiveAction','chat_proactive_actions','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x338587,_0x4639d7){var _0x5215f7=function(_0x3b9493){while(--_0x3b9493){_0x338587['push'](_0x338587['shift']());}};_0x5215f7(++_0x4639d7);}(_0x4268,0x191));var _0x8426=function(_0x15d13e,_0x3df4b1){_0x15d13e=_0x15d13e-0x0;var _0x5ee877=_0x4268[_0x15d13e];return _0x5ee877;};'use strict';var _=require(_0x8426('0x0'));var util=require(_0x8426('0x1'));var logger=require(_0x8426('0x2'))(_0x8426('0x3'));var moment=require('moment');var BPromise=require(_0x8426('0x4'));var rp=require(_0x8426('0x5'));var fs=require('fs');var path=require(_0x8426('0x6'));var rimraf=require(_0x8426('0x7'));var config=require(_0x8426('0x8'));var attributes=require('./chatProactiveAction.attributes');module[_0x8426('0x9')]=function(_0x4473e6,_0x316755){return _0x4473e6['define'](_0x8426('0xa'),attributes,{'tableName':_0x8426('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 8d86684..2df3770 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 _0xad41=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ChatProactiveAction,\x20%s,\x20%s','request\x20sent','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xad41,0x11e));var _0x1ad4=function(_0xd09668,_0x1435b2){_0xd09668=_0xd09668-0x0;var _0x68726=_0xad41[_0xd09668];return _0x68726;};'use strict';var _=require(_0x1ad4('0x0'));var util=require(_0x1ad4('0x1'));var moment=require(_0x1ad4('0x2'));var BPromise=require(_0x1ad4('0x3'));var rs=require(_0x1ad4('0x4'));var fs=require('fs');var Redis=require(_0x1ad4('0x5'));var db=require(_0x1ad4('0x6'))['db'];var utils=require(_0x1ad4('0x7'));var logger=require(_0x1ad4('0x8'))(_0x1ad4('0x9'));var config=require('../../config/environment');var jayson=require(_0x1ad4('0xa'));var client=jayson[_0x1ad4('0xb')][_0x1ad4('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb1a02d,_0x34c404,_0x154b83){return new BPromise(function(_0x259af7,_0x102276){return client[_0x1ad4('0xd')](_0xb1a02d,_0x154b83)[_0x1ad4('0xe')](function(_0x38184b){logger['info'](_0x1ad4('0xf'),_0x34c404,_0x1ad4('0x10'));logger[_0x1ad4('0x11')](_0x1ad4('0x12'),_0x34c404,_0x1ad4('0x10'),JSON[_0x1ad4('0x13')](_0x38184b));if(_0x38184b[_0x1ad4('0x14')]){if(_0x38184b['error'][_0x1ad4('0x15')]===0x1f4){logger[_0x1ad4('0x14')](_0x1ad4('0xf'),_0x34c404,_0x38184b[_0x1ad4('0x14')][_0x1ad4('0x16')]);return _0x102276(_0x38184b[_0x1ad4('0x14')][_0x1ad4('0x16')]);}logger[_0x1ad4('0x14')](_0x1ad4('0xf'),_0x34c404,_0x38184b[_0x1ad4('0x14')]['message']);return _0x259af7(_0x38184b[_0x1ad4('0x14')][_0x1ad4('0x16')]);}else{logger['info'](_0x1ad4('0xf'),_0x34c404,_0x1ad4('0x10'));_0x259af7(_0x38184b[_0x1ad4('0x17')][_0x1ad4('0x16')]);}})['catch'](function(_0x10bd42){logger[_0x1ad4('0x14')](_0x1ad4('0xf'),_0x34c404,_0x10bd42);_0x102276(_0x10bd42);});});} \ No newline at end of file +var _0x3c9b=['request\x20sent','stringify','error','code','ChatProactiveAction,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x44a352,_0x3cb610){var _0x2ffbba=function(_0x4e4051){while(--_0x4e4051){_0x44a352['push'](_0x44a352['shift']());}};_0x2ffbba(++_0x3cb610);}(_0x3c9b,0x1d4));var _0xb3c9=function(_0x2df9f0,_0x3876d6){_0x2df9f0=_0x2df9f0-0x0;var _0x27272d=_0x3c9b[_0x2df9f0];return _0x27272d;};'use strict';var _=require('lodash');var util=require(_0xb3c9('0x0'));var moment=require(_0xb3c9('0x1'));var BPromise=require(_0xb3c9('0x2'));var rs=require(_0xb3c9('0x3'));var fs=require('fs');var Redis=require(_0xb3c9('0x4'));var db=require(_0xb3c9('0x5'))['db'];var utils=require(_0xb3c9('0x6'));var logger=require(_0xb3c9('0x7'))(_0xb3c9('0x8'));var config=require(_0xb3c9('0x9'));var jayson=require(_0xb3c9('0xa'));var client=jayson[_0xb3c9('0xb')][_0xb3c9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4ec69c,_0x39d867,_0x2ad8d0){return new BPromise(function(_0x3d8981,_0x3a82c9){return client['request'](_0x4ec69c,_0x2ad8d0)[_0xb3c9('0xd')](function(_0x4e0bf5){logger[_0xb3c9('0xe')]('ChatProactiveAction,\x20%s,\x20%s',_0x39d867,_0xb3c9('0xf'));logger['debug']('ChatProactiveAction,\x20%s,\x20%s,\x20%s',_0x39d867,_0xb3c9('0xf'),JSON[_0xb3c9('0x10')](_0x4e0bf5));if(_0x4e0bf5['error']){if(_0x4e0bf5[_0xb3c9('0x11')][_0xb3c9('0x12')]===0x1f4){logger[_0xb3c9('0x11')](_0xb3c9('0x13'),_0x39d867,_0x4e0bf5[_0xb3c9('0x11')][_0xb3c9('0x14')]);return _0x3a82c9(_0x4e0bf5[_0xb3c9('0x11')][_0xb3c9('0x14')]);}logger[_0xb3c9('0x11')](_0xb3c9('0x13'),_0x39d867,_0x4e0bf5[_0xb3c9('0x11')]['message']);return _0x3d8981(_0x4e0bf5['error'][_0xb3c9('0x14')]);}else{logger[_0xb3c9('0xe')](_0xb3c9('0x13'),_0x39d867,'request\x20sent');_0x3d8981(_0x4e0bf5[_0xb3c9('0x15')]['message']);}})[_0xb3c9('0x16')](function(_0x28ef16){logger[_0xb3c9('0x11')](_0xb3c9('0x13'),_0x39d867,_0x28ef16);_0x3a82c9(_0x28ef16);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index 132cfb7..8814d2d 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 _0x55ca=['multer','util','Router','fs-extra','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','get','/:id','isAuthenticated','show','create','destroy','exports'];(function(_0x1efb91,_0x9c02e){var _0xf82028=function(_0x189957){while(--_0x189957){_0x1efb91['push'](_0x1efb91['shift']());}};_0xf82028(++_0x9c02e);}(_0x55ca,0x126));var _0xa55c=function(_0x111494,_0x1d73da){_0x111494=_0x111494-0x0;var _0x1d0d8b=_0x55ca[_0x111494];return _0x1d0d8b;};'use strict';var multer=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa55c('0x2')]();var fs_extra=require(_0xa55c('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var controller=require(_0xa55c('0x6'));router[_0xa55c('0x7')](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xa')]);router['post']('/',auth[_0xa55c('0x9')](),controller[_0xa55c('0xb')]);router['put'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller['update']);router['delete'](_0xa55c('0x8'),auth[_0xa55c('0x9')](),controller[_0xa55c('0xc')]);module[_0xa55c('0xd')]=router; \ No newline at end of file +var _0xeff8=['isAuthenticated','show','post','create','put','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0xeff8,0x186));var _0x8eff=function(_0x17406e,_0x1049fd){_0x17406e=_0x17406e-0x0;var _0x2bfc5a=_0xeff8[_0x17406e];return _0x2bfc5a;};'use strict';var multer=require(_0x8eff('0x0'));var util=require(_0x8eff('0x1'));var path=require('path');var timeout=require(_0x8eff('0x2'));var express=require(_0x8eff('0x3'));var router=express[_0x8eff('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8eff('0x5'));var interaction=require(_0x8eff('0x6'));var config=require(_0x8eff('0x7'));var controller=require(_0x8eff('0x8'));router['get'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xb')]);router[_0x8eff('0xc')]('/',auth['isAuthenticated'](),controller[_0x8eff('0xd')]);router[_0x8eff('0xe')](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller['update']);router['delete'](_0x8eff('0x9'),auth[_0x8eff('0xa')](),controller[_0x8eff('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index f847d7d..d7aad68 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 _0x6546=['sequelize','exports','STRING','name','ENUM','beepall','roundrobin'];(function(_0x7f30ae,_0xcaeaf3){var _0x4ec1fc=function(_0x550619){while(--_0x550619){_0x7f30ae['push'](_0x7f30ae['shift']());}};_0x4ec1fc(++_0xcaeaf3);}(_0x6546,0x181));var _0x6654=function(_0x238312,_0x2d86fc){_0x238312=_0x238312-0x0;var _0x9c100b=_0x6546[_0x238312];return _0x9c100b;};'use strict';var Sequelize=require(_0x6654('0x0'));module[_0x6654('0x1')]={'name':{'type':Sequelize[_0x6654('0x2')],'unique':_0x6654('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6654('0x4')]('rrmemory',_0x6654('0x5'),_0x6654('0x6'))}}; \ No newline at end of file +var _0x6758=['ENUM','rrmemory','exports','STRING','INTEGER'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6758,0x110));var _0x8675=function(_0x56a91b,_0x2391c8){_0x56a91b=_0x56a91b-0x0;var _0x227a5c=_0x6758[_0x56a91b];return _0x227a5c;};'use strict';var Sequelize=require('sequelize');module[_0x8675('0x0')]={'name':{'type':Sequelize[_0x8675('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x8675('0x1')]},'timeout':{'type':Sequelize[_0x8675('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8675('0x3')](_0x8675('0x4'),'beepall','roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index dd78f78..03109a8 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 _0xd81f=['socket.io-emitter','./chatQueue.socket','register','jayson/promise','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','apply','reject','save','destroy','get','ChatQueues','end','stack','name','send','map','ChatQueue','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','findAll','rows','show','includeAll','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','describe','getMembers','findOne','UserChatQueue','ChatQueueId','User','createdAt','SIP','chatPause','Team','getTeams','addTeams','ids','Agents','online','voicePause','flatMap','sequelize','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','toString','QueryTypes','SELECT','every','TeamId','includes','union','compact','isEmpty','removeAgents','userChatQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','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','redis','defaults','localhost'];(function(_0xeec2c5,_0x5b8897){var _0x142b91=function(_0x5bb92a){while(--_0x5bb92a){_0xeec2c5['push'](_0xeec2c5['shift']());}};_0x142b91(++_0x5b8897);}(_0xd81f,0x1a7));var _0xfd81=function(_0x383356,_0x33d2f5){_0x383356=_0x383356-0x0;var _0x32ee5a=_0xd81f[_0x383356];return _0x32ee5a;};'use strict';var emlformat=require(_0xfd81('0x0'));var rimraf=require(_0xfd81('0x1'));var zipdir=require(_0xfd81('0x2'));var jsonpatch=require(_0xfd81('0x3'));var rp=require(_0xfd81('0x4'));var moment=require(_0xfd81('0x5'));var BPromise=require(_0xfd81('0x6'));var Mustache=require(_0xfd81('0x7'));var util=require(_0xfd81('0x8'));var path=require(_0xfd81('0x9'));var sox=require(_0xfd81('0xa'));var csv=require(_0xfd81('0xb'));var ejs=require(_0xfd81('0xc'));var fs=require('fs');var fs_extra=require(_0xfd81('0xd'));var _=require('lodash');var squel=require(_0xfd81('0xe'));var crypto=require('crypto');var jsforce=require(_0xfd81('0xf'));var deskjs=require(_0xfd81('0x10'));var toCsv=require(_0xfd81('0xb'));var querystring=require(_0xfd81('0x11'));var Papa=require(_0xfd81('0x12'));var Redis=require(_0xfd81('0x13'));var authService=require(_0xfd81('0x14'));var qs=require(_0xfd81('0x15'));var as=require(_0xfd81('0x16'));var hardwareService=require(_0xfd81('0x17'));var logger=require(_0xfd81('0x18'))(_0xfd81('0x19'));var utils=require(_0xfd81('0x1a'));var config=require(_0xfd81('0x1b'));var licenseUtil=require(_0xfd81('0x1c'));var db=require(_0xfd81('0x1d'))['db'];config[_0xfd81('0x1e')]=_[_0xfd81('0x1f')](config[_0xfd81('0x1e')],{'host':_0xfd81('0x20'),'port':0x18eb});var socket=require(_0xfd81('0x21'))(new Redis(config[_0xfd81('0x1e')]));require(_0xfd81('0x22'))[_0xfd81('0x23')](socket);var jayson=require(_0xfd81('0x24'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1571f6,_0x1ca8d9,_0x1d4a13,_0x57f09c){return new BPromise(function(_0x541f8d,_0x1894a5){var _0x369964=_0x57f09c||client;return _0x369964[_0xfd81('0x25')](_0x1571f6,_0x1d4a13)[_0xfd81('0x26')](function(_0x5b762d){logger[_0xfd81('0x27')](_0xfd81('0x28'),_0x1ca8d9,_0xfd81('0x29'));logger[_0xfd81('0x2a')](_0xfd81('0x2b'),_0x1ca8d9,_0xfd81('0x29'),JSON['stringify'](_0x5b762d));if(_0x5b762d[_0xfd81('0x2c')]){if(_0x5b762d['error'][_0xfd81('0x2d')]===0x1f4){logger[_0xfd81('0x2c')](_0xfd81('0x28'),_0x1ca8d9,_0x5b762d[_0xfd81('0x2c')][_0xfd81('0x2e')]);return _0x1894a5(_0x5b762d['error'][_0xfd81('0x2e')]);}logger[_0xfd81('0x2c')](_0xfd81('0x28'),_0x1ca8d9,_0x5b762d['error'][_0xfd81('0x2e')]);return _0x541f8d(_0x5b762d[_0xfd81('0x2c')]['message']);}else{logger['info'](_0xfd81('0x28'),_0x1ca8d9,'request\x20sent');_0x541f8d(_0x5b762d[_0xfd81('0x2f')][_0xfd81('0x2e')]);}})[_0xfd81('0x30')](function(_0x942a4e){logger['error'](_0xfd81('0x28'),_0x1ca8d9,_0x942a4e);_0x1894a5(_0x942a4e);});});}function respondWithStatusCode(_0x2b0b9e,_0x47f207){_0x47f207=_0x47f207||0xcc;return function(_0x5a74c4){if(_0x5a74c4){return _0x2b0b9e[_0xfd81('0x31')](_0x47f207);}return _0x2b0b9e[_0xfd81('0x32')](_0x47f207)['end']();};}function respondWithResult(_0x2a90fa,_0x56afcc){_0x56afcc=_0x56afcc||0xc8;return function(_0x50ed76){if(_0x50ed76){return _0x2a90fa[_0xfd81('0x32')](_0x56afcc)[_0xfd81('0x33')](_0x50ed76);}};}function respondWithFilteredResult(_0x5154d3,_0x34f207){return function(_0x376e5c){if(_0x376e5c){var _0x3abe14=typeof _0x34f207[_0xfd81('0x34')]===_0xfd81('0x35')&&typeof _0x34f207[_0xfd81('0x36')]===_0xfd81('0x35');var _0x4d7bb1=_0x376e5c[_0xfd81('0x37')];var _0x57ceb8=_0x3abe14?0x0:_0x34f207[_0xfd81('0x34')];var _0xdb6e1b=_0x3abe14?_0x376e5c[_0xfd81('0x37')]:_0x34f207[_0xfd81('0x34')]+_0x34f207[_0xfd81('0x36')];var _0x413310;if(_0xdb6e1b>=_0x4d7bb1){_0xdb6e1b=_0x4d7bb1;_0x413310=0xc8;}else{_0x413310=0xce;}_0x5154d3[_0xfd81('0x32')](_0x413310);return _0x5154d3[_0xfd81('0x38')]('Content-Range',_0x57ceb8+'-'+_0xdb6e1b+'/'+_0x4d7bb1)[_0xfd81('0x33')](_0x376e5c);}return null;};}function patchUpdates(_0x2d6d2d){return function(_0x194f37){try{jsonpatch[_0xfd81('0x39')](_0x194f37,_0x2d6d2d,!![]);}catch(_0x3b4e06){return BPromise[_0xfd81('0x3a')](_0x3b4e06);}return _0x194f37[_0xfd81('0x3b')]();};}function saveUpdates(_0x5969ab,_0x431289){return function(_0x3034b0){if(_0x3034b0){return _0x3034b0['update'](_0x5969ab)[_0xfd81('0x26')](function(_0x352635){return _0x352635;});}return null;};}function removeEntity(_0x50b8bc,_0x23ac2d){return function(_0x14565c){if(_0x14565c){return _0x14565c[_0xfd81('0x3c')]()[_0xfd81('0x26')](function(){var _0x5db86f=_0x14565c[_0xfd81('0x3d')]({'plain':!![]});var _0xb7556=_0xfd81('0x3e');return db['UserProfileResource'][_0xfd81('0x3c')]({'where':{'type':_0xb7556,'resourceId':_0x5db86f['id']}})[_0xfd81('0x26')](function(){return _0x14565c;});})[_0xfd81('0x26')](function(){_0x50b8bc['status'](0xcc)[_0xfd81('0x3f')]();});}};}function handleEntityNotFound(_0x39fe1e,_0x4a1f3a){return function(_0x17befd){if(!_0x17befd){_0x39fe1e['sendStatus'](0x194);}return _0x17befd;};}function handleError(_0xc43e72,_0x5af025){_0x5af025=_0x5af025||0x1f4;return function(_0x4e9617){logger['error'](_0x4e9617[_0xfd81('0x40')]);if(_0x4e9617[_0xfd81('0x41')]){delete _0x4e9617['name'];}_0xc43e72['status'](_0x5af025)[_0xfd81('0x42')](_0x4e9617);};}exports['index']=function(_0x8a2710,_0x580805){var _0x51429e={},_0x592b99={},_0x1422a1={'count':0x0,'rows':[]};var _0xe26f88=_[_0xfd81('0x43')](db[_0xfd81('0x44')][_0xfd81('0x45')],function(_0x3ab70b){return{'name':_0x3ab70b[_0xfd81('0x46')],'type':_0x3ab70b[_0xfd81('0x47')][_0xfd81('0x48')]};});_0x592b99[_0xfd81('0x49')]=_[_0xfd81('0x43')](_0xe26f88,_0xfd81('0x41'));_0x592b99[_0xfd81('0x4a')]=_[_0xfd81('0x4b')](_0x8a2710[_0xfd81('0x4a')]);_0x592b99['filters']=_[_0xfd81('0x4c')](_0x592b99[_0xfd81('0x49')],_0x592b99[_0xfd81('0x4a')]);_0x51429e[_0xfd81('0x4d')]=_[_0xfd81('0x4c')](_0x592b99[_0xfd81('0x49')],qs[_0xfd81('0x4e')](_0x8a2710['query'][_0xfd81('0x4e')]));_0x51429e[_0xfd81('0x4d')]=_0x51429e['attributes'][_0xfd81('0x4f')]?_0x51429e['attributes']:_0x592b99[_0xfd81('0x49')];if(!_0x8a2710[_0xfd81('0x4a')][_0xfd81('0x50')](_0xfd81('0x51'))){_0x51429e[_0xfd81('0x36')]=qs['limit'](_0x8a2710['query'][_0xfd81('0x36')]);_0x51429e['offset']=qs[_0xfd81('0x34')](_0x8a2710[_0xfd81('0x4a')][_0xfd81('0x34')]);}_0x51429e[_0xfd81('0x52')]=qs[_0xfd81('0x53')](_0x8a2710[_0xfd81('0x4a')]['sort']);_0x51429e[_0xfd81('0x54')]=qs['filters'](_[_0xfd81('0x55')](_0x8a2710[_0xfd81('0x4a')],_0x592b99[_0xfd81('0x56')]),_0xe26f88);if(_0x8a2710[_0xfd81('0x4a')][_0xfd81('0x57')]){_0x51429e[_0xfd81('0x54')]=_['merge'](_0x51429e[_0xfd81('0x54')],{'$or':_[_0xfd81('0x43')](_0xe26f88,function(_0x1497f3){if(_0x1497f3[_0xfd81('0x47')]!=='VIRTUAL'){var _0x54aa98={};_0x54aa98[_0x1497f3['name']]={'$like':'%'+_0x8a2710['query']['filter']+'%'};return _0x54aa98;}})});}_0x51429e=_[_0xfd81('0x58')]({},_0x51429e,_0x8a2710['options']);var _0x479b9e={'where':_0x51429e[_0xfd81('0x54')]};return db[_0xfd81('0x44')][_0xfd81('0x37')](_0x479b9e)[_0xfd81('0x26')](function(_0x512fe4){_0x1422a1[_0xfd81('0x37')]=_0x512fe4;if(_0x8a2710[_0xfd81('0x4a')]['includeAll']){_0x51429e['include']=[{'all':!![]}];}return db[_0xfd81('0x44')][_0xfd81('0x59')](_0x51429e);})['then'](function(_0xc84caa){_0x1422a1[_0xfd81('0x5a')]=_0xc84caa;return _0x1422a1;})[_0xfd81('0x26')](respondWithFilteredResult(_0x580805,_0x51429e))[_0xfd81('0x30')](handleError(_0x580805,null));};exports[_0xfd81('0x5b')]=function(_0x3dbc7a,_0x27636d){var _0x124163={'raw':!![],'where':{'id':_0x3dbc7a['params']['id']}},_0x20fd01={};_0x20fd01[_0xfd81('0x49')]=_[_0xfd81('0x4b')](db['ChatQueue'][_0xfd81('0x45')]);_0x20fd01[_0xfd81('0x4a')]=_[_0xfd81('0x4b')](_0x3dbc7a['query']);_0x20fd01['filters']=_[_0xfd81('0x4c')](_0x20fd01['model'],_0x20fd01[_0xfd81('0x4a')]);_0x124163[_0xfd81('0x4d')]=_[_0xfd81('0x4c')](_0x20fd01[_0xfd81('0x49')],qs[_0xfd81('0x4e')](_0x3dbc7a['query'][_0xfd81('0x4e')]));_0x124163[_0xfd81('0x4d')]=_0x124163[_0xfd81('0x4d')][_0xfd81('0x4f')]?_0x124163[_0xfd81('0x4d')]:_0x20fd01['model'];if(_0x3dbc7a['query'][_0xfd81('0x5c')]){_0x124163[_0xfd81('0x5d')]=[{'all':!![]}];}_0x124163=_[_0xfd81('0x58')]({},_0x124163,_0x3dbc7a[_0xfd81('0x5e')]);return db[_0xfd81('0x44')]['find'](_0x124163)[_0xfd81('0x26')](handleEntityNotFound(_0x27636d,null))['then'](respondWithResult(_0x27636d,null))[_0xfd81('0x30')](handleError(_0x27636d,null));};exports[_0xfd81('0x5f')]=function(_0x14c7f3,_0x7f89f0){return db[_0xfd81('0x44')][_0xfd81('0x5f')](_0x14c7f3[_0xfd81('0x60')],{})[_0xfd81('0x26')](function(_0x9aa3d1){var _0x909889=_0x14c7f3[_0xfd81('0x61')][_0xfd81('0x3d')]({'plain':!![]});if(!_0x909889)throw new Error(_0xfd81('0x62'));if(_0x909889[_0xfd81('0x63')]===_0xfd81('0x61')){var _0x1e4766=_0x9aa3d1[_0xfd81('0x3d')]({'plain':!![]});var _0x12de19=_0xfd81('0x3e');return db[_0xfd81('0x64')]['find']({'where':{'name':_0x12de19,'userProfileId':_0x909889['userProfileId']},'raw':!![]})['then'](function(_0x55fc8f){if(_0x55fc8f&&_0x55fc8f['autoAssociation']===0x0){return db[_0xfd81('0x65')][_0xfd81('0x5f')]({'name':_0x1e4766[_0xfd81('0x41')],'resourceId':_0x1e4766['id'],'type':_0x55fc8f[_0xfd81('0x41')],'sectionId':_0x55fc8f['id']},{})['then'](function(){return _0x9aa3d1;});}else{return _0x9aa3d1;}})['catch'](function(_0x5f50e0){logger['error'](_0xfd81('0x66'),_0x5f50e0);throw _0x5f50e0;});}return _0x9aa3d1;})[_0xfd81('0x26')](respondWithResult(_0x7f89f0,0xc9))[_0xfd81('0x30')](handleError(_0x7f89f0,null));};exports['update']=function(_0x38ac46,_0x48e768){if(_0x38ac46['body']['id']){delete _0x38ac46[_0xfd81('0x60')]['id'];}return db[_0xfd81('0x44')][_0xfd81('0x67')]({'where':{'id':_0x38ac46[_0xfd81('0x68')]['id']}})[_0xfd81('0x26')](handleEntityNotFound(_0x48e768,null))[_0xfd81('0x26')](saveUpdates(_0x38ac46[_0xfd81('0x60')],null))[_0xfd81('0x26')](respondWithResult(_0x48e768,null))[_0xfd81('0x30')](handleError(_0x48e768,null));};exports[_0xfd81('0x3c')]=function(_0x49fdb4,_0x298b5d){return db[_0xfd81('0x44')][_0xfd81('0x67')]({'where':{'id':_0x49fdb4[_0xfd81('0x68')]['id']}})[_0xfd81('0x26')](handleEntityNotFound(_0x298b5d,null))['then'](removeEntity(_0x298b5d,null))['catch'](handleError(_0x298b5d,null));};exports[_0xfd81('0x69')]=function(_0x513110,_0x943c56){return db['ChatQueue']['describe']()[_0xfd81('0x26')](respondWithResult(_0x943c56,null))[_0xfd81('0x30')](handleError(_0x943c56,null));};exports[_0xfd81('0x6a')]=function(_0x557699,_0x1dfc42,_0x59b90f){var _0x260e18={'raw':!![],'where':{}},_0x3f5e3a={},_0xc7a84c;return db[_0xfd81('0x44')][_0xfd81('0x6b')]({'where':{'id':_0x557699['params']['id']}})[_0xfd81('0x26')](handleEntityNotFound(_0x1dfc42,null))['then'](function(_0x31b07b){if(_0x31b07b){_0xc7a84c=_0x31b07b[_0xfd81('0x3d')]({'plain':!![]});_0x3f5e3a[_0xfd81('0x49')]=_[_0xfd81('0x4b')](db[_0xfd81('0x6c')]['rawAttributes']);_0x3f5e3a[_0xfd81('0x4a')]=_['keys'](_0x557699[_0xfd81('0x4a')]);_0x3f5e3a['filters']=_[_0xfd81('0x4c')](_0x3f5e3a['model'],_0x3f5e3a[_0xfd81('0x4a')]);_0x260e18[_0xfd81('0x4d')]=_[_0xfd81('0x4c')](_0x3f5e3a[_0xfd81('0x49')],qs[_0xfd81('0x4e')](_0x557699['query'][_0xfd81('0x4e')]));_0x260e18[_0xfd81('0x4d')]=_0x260e18[_0xfd81('0x4d')]['length']?_0x260e18[_0xfd81('0x4d')]:_0x3f5e3a[_0xfd81('0x49')];if(!_0x557699[_0xfd81('0x4a')][_0xfd81('0x50')](_0xfd81('0x51'))){_0x260e18['limit']=qs[_0xfd81('0x36')](_0x557699['query'][_0xfd81('0x36')]);_0x260e18[_0xfd81('0x34')]=qs[_0xfd81('0x34')](_0x557699[_0xfd81('0x4a')][_0xfd81('0x34')]);}_0x260e18[_0xfd81('0x52')]=qs['sort'](_0x557699[_0xfd81('0x4a')][_0xfd81('0x53')]);_0x260e18[_0xfd81('0x54')]=qs[_0xfd81('0x56')](_[_0xfd81('0x55')](_0x557699['query'],_0x3f5e3a[_0xfd81('0x56')]));_0x260e18['where'][_0xfd81('0x6d')]=_0x31b07b['id'];if(_0x557699[_0xfd81('0x4a')][_0xfd81('0x57')]){_0x260e18[_0xfd81('0x54')]=_[_0xfd81('0x58')](_0x260e18['where'],{'$or':_[_0xfd81('0x43')](_0x260e18[_0xfd81('0x4d')],function(_0x4f639b){var _0x1c174d={};_0x1c174d[_0x4f639b]={'$like':'%'+_0x557699[_0xfd81('0x4a')][_0xfd81('0x57')]+'%'};return _0x1c174d;})});}_0x260e18=_['merge']({},_0x260e18,_0x557699['options']);return db[_0xfd81('0x6c')][_0xfd81('0x59')](_0x260e18);}})[_0xfd81('0x26')](function(_0x37a5d9){if(_0x37a5d9){return db[_0xfd81('0x6e')]['findAndCountAll']({'where':{'id':_[_0xfd81('0x43')](_0x37a5d9,'UserId'),'role':'agent'},'attributes':['id','name','chatPause','updatedAt',_0xfd81('0x6f')]});}})[_0xfd81('0x26')](function(_0x3d4ff1){if(_0x3d4ff1){return{'count':_0x3d4ff1[_0xfd81('0x37')],'rows':_[_0xfd81('0x43')](_0x3d4ff1[_0xfd81('0x5a')],function(_0x1d87f7){return{'membername':_0x1d87f7['name'],'UserId':_0x1d87f7['id'],'queue_name':_0xc7a84c[_0xfd81('0x41')],'ChatQueueId':_0xc7a84c['id'],'interface':util['format']('%s/%s',_0xfd81('0x70'),_0x1d87f7[_0xfd81('0x41')]),'penalty':0x0,'paused':_0x1d87f7[_0xfd81('0x71')],'createdAt':_0x1d87f7['createdAt'],'updatedAt':_0x1d87f7['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfd81('0x26')](respondWithFilteredResult(_0x1dfc42,_0x260e18))[_0xfd81('0x30')](handleError(_0x1dfc42,null));};exports['getTeams']=function(_0x4a5199,_0x251097,_0x195d77){var _0x18d906={};var _0x19bffa={};var _0x19f780;var _0x2972e2;return db[_0xfd81('0x44')][_0xfd81('0x6b')]({'where':{'id':_0x4a5199[_0xfd81('0x68')]['id']}})[_0xfd81('0x26')](handleEntityNotFound(_0x251097,null))[_0xfd81('0x26')](function(_0x15898e){if(_0x15898e){_0x19f780=_0x15898e;_0x19bffa[_0xfd81('0x49')]=_['keys'](db[_0xfd81('0x72')][_0xfd81('0x45')]);_0x19bffa[_0xfd81('0x4a')]=_[_0xfd81('0x4b')](_0x4a5199[_0xfd81('0x4a')]);_0x19bffa['filters']=_[_0xfd81('0x4c')](_0x19bffa[_0xfd81('0x49')],_0x19bffa[_0xfd81('0x4a')]);_0x18d906[_0xfd81('0x4d')]=_['intersection'](_0x19bffa[_0xfd81('0x49')],qs[_0xfd81('0x4e')](_0x4a5199[_0xfd81('0x4a')][_0xfd81('0x4e')]));_0x18d906['attributes']=_0x18d906['attributes'][_0xfd81('0x4f')]?_0x18d906[_0xfd81('0x4d')]:_0x19bffa[_0xfd81('0x49')];_0x18d906[_0xfd81('0x52')]=qs[_0xfd81('0x53')](_0x4a5199[_0xfd81('0x4a')][_0xfd81('0x53')]);_0x18d906[_0xfd81('0x54')]=qs[_0xfd81('0x56')](_[_0xfd81('0x55')](_0x4a5199[_0xfd81('0x4a')],_0x19bffa['filters']));if(_0x4a5199[_0xfd81('0x4a')][_0xfd81('0x57')]){_0x18d906['where']=_[_0xfd81('0x58')](_0x18d906[_0xfd81('0x54')],{'$or':_[_0xfd81('0x43')](_0x18d906[_0xfd81('0x4d')],function(_0x5ec1f9){var _0x435fda={};_0x435fda[_0x5ec1f9]={'$like':'%'+_0x4a5199['query'][_0xfd81('0x57')]+'%'};return _0x435fda;})});}_0x18d906=_[_0xfd81('0x58')]({},_0x18d906,_0x4a5199[_0xfd81('0x5e')]);return _0x19f780[_0xfd81('0x73')](_0x18d906);}})['then'](function(_0x216ef5){if(_0x216ef5){_0x2972e2=_0x216ef5[_0xfd81('0x4f')];if(!_0x4a5199[_0xfd81('0x4a')]['hasOwnProperty'](_0xfd81('0x51'))){_0x18d906['limit']=qs[_0xfd81('0x36')](_0x4a5199[_0xfd81('0x4a')][_0xfd81('0x36')]);_0x18d906[_0xfd81('0x34')]=qs[_0xfd81('0x34')](_0x4a5199[_0xfd81('0x4a')][_0xfd81('0x34')]);}return _0x19f780['getTeams'](_0x18d906);}})[_0xfd81('0x26')](function(_0x10a84e){if(_0x10a84e){return _0x10a84e?{'count':_0x2972e2,'rows':_0x10a84e}:null;}})[_0xfd81('0x26')](respondWithResult(_0x251097,null))['catch'](handleError(_0x251097,null));};exports[_0xfd81('0x74')]=function(_0x30a7d5,_0x3ee5a6,_0x5072cd){var _0x55afe0=_0x30a7d5[_0xfd81('0x60')][_0xfd81('0x75')];return db[_0xfd81('0x72')][_0xfd81('0x59')]({'where':{'id':_0x55afe0},'attributes':['id'],'include':[{'model':db[_0xfd81('0x6e')],'as':_0xfd81('0x76'),'attributes':['id',_0xfd81('0x41'),_0xfd81('0x77'),_0xfd81('0x78'),'interface'],'raw':!![]}]})[_0xfd81('0x26')](function(_0x2ae0a1){if(_0x2ae0a1){var _0x1f66b8=_[_0xfd81('0x79')](_0x2ae0a1,function(_0x2ec3ce){var _0x2bd88a=_0x2ec3ce['get']({'plain':!![]});return _0x2bd88a[_0xfd81('0x76')];});return db[_0xfd81('0x44')][_0xfd81('0x67')]({'where':{'id':_0x30a7d5['params']['id']}})['then'](function(_0x5081fe){return db[_0xfd81('0x7a')]['transaction'](function(_0x378d48){return _0x5081fe[_0xfd81('0x74')](_0x55afe0,{'transaction':_0x378d48})[_0xfd81('0x26')](function(){return BPromise[_0xfd81('0x7b')](_0x1f66b8,function(_0x1642db){return db['UserChatQueue'][_0xfd81('0x7c')]({'where':{'UserId':_0x1642db['id'],'ChatQueueId':_0x30a7d5[_0xfd81('0x68')]['id']},'transaction':_0x378d48});});})[_0xfd81('0x26')](function(){_0x1f66b8[_0xfd81('0x7d')](function(_0x4dc102){socket[_0xfd81('0x7e')](_0xfd81('0x7f'),{'UserId':_0x4dc102['id'],'ChatQueueId':_0x5081fe['id']});});});});});}})[_0xfd81('0x26')](respondWithStatusCode(_0x3ee5a6,null))[_0xfd81('0x30')](handleError(_0x3ee5a6,null));};exports[_0xfd81('0x80')]=function(_0x5248ad,_0x7f92c9,_0x170578){return db[_0xfd81('0x72')][_0xfd81('0x59')]({'where':{'id':_0x5248ad[_0xfd81('0x4a')][_0xfd81('0x75')]},'attributes':['id'],'include':[{'model':db[_0xfd81('0x6e')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xfd81('0x26')](handleEntityNotFound(_0x7f92c9,null))[_0xfd81('0x26')](function(_0xefade4){var _0x349e11=_[_0xfd81('0x43')](_0xefade4,'id');var _0xec375b=[];var _0x17cdd2=[];var _0x2709b2=squel[_0xfd81('0x81')]();_0x2709b2[_0xfd81('0x82')](_0xfd81('0x83'))[_0xfd81('0x84')](_0xfd81('0x85'),'tq')['join'](_0xfd81('0x86'),'ut',_0xfd81('0x87'))[_0xfd81('0x54')](_0xfd81('0x88'),_0x5248ad[_0xfd81('0x68')]['id']);for(var _0x2587eb=0x0;_0x2587eb<_0xefade4['length'];_0x2587eb+=0x1){let _0x273750=_0xefade4[_0x2587eb];for(var _0x4bc5aa=0x0;_0x4bc5aa<_0x273750['Agents'][_0xfd81('0x4f')];_0x4bc5aa+=0x1){let _0x4b8abf=_0x273750[_0xfd81('0x76')][_0x4bc5aa];var _0x8590a8=_0x2709b2['clone']();_0x8590a8['where']('ut.UserId\x20=\x20?',_0x4b8abf['id']);_0x17cdd2['push'](db[_0xfd81('0x7a')][_0xfd81('0x4a')](_0x8590a8[_0xfd81('0x89')](),{'type':db[_0xfd81('0x7a')][_0xfd81('0x8a')][_0xfd81('0x8b')]})[_0xfd81('0x26')](function(_0xf39a80){if(_0xf39a80[_0xfd81('0x4f')]===0x1){return _0x4b8abf['id'];}else{var _0x19dfc6=_[_0xfd81('0x8c')](_[_0xfd81('0x43')](_0xf39a80,_0xfd81('0x8d')),function(_0x4f584c){return _[_0xfd81('0x8e')](_0x349e11,_0x4f584c);});if(_0x19dfc6){return _0x4b8abf['id'];}}}));}}return BPromise['all'](_0x17cdd2)['then'](function(_0x5d4390){_0xec375b=_(_0xec375b)[_0xfd81('0x8f')](_0x5d4390)[_0xfd81('0x90')]()['value']();return db[_0xfd81('0x44')][_0xfd81('0x67')]({'where':{'id':_0x5248ad[_0xfd81('0x68')]['id']}})[_0xfd81('0x26')](function(_0x5d0724){return db[_0xfd81('0x7a')]['transaction'](function(_0x4fde0f){return _0x5d0724['removeTeams'](_0x5248ad[_0xfd81('0x4a')][_0xfd81('0x75')],{'transaction':_0x4fde0f})[_0xfd81('0x26')](function(){if(!_[_0xfd81('0x91')](_0xec375b)){return _0x5d0724[_0xfd81('0x92')](_0xec375b,{'transaction':_0x4fde0f});}})[_0xfd81('0x26')](function(){_0xec375b[_0xfd81('0x7d')](function(_0x5375ef){socket[_0xfd81('0x7e')](_0xfd81('0x93'),{'UserId':_0x5375ef,'ChatQueueId':_0x5d0724['id']});});});});});});})[_0xfd81('0x26')](respondWithStatusCode(_0x7f92c9,null))['catch'](handleError(_0x7f92c9,null));};exports[_0xfd81('0x94')]=function(_0x2bfe01,_0x2ac015,_0x194016){return db[_0xfd81('0x44')][_0xfd81('0x67')]({'where':{'id':_0x2bfe01['params']['id']}})[_0xfd81('0x26')](handleEntityNotFound(_0x2ac015,null))[_0xfd81('0x26')](function(_0x4c1d61){if(_0x4c1d61){return _0x4c1d61['addAgents'](_0x2bfe01[_0xfd81('0x60')][_0xfd81('0x75')],_['omit'](_0x2bfe01[_0xfd81('0x60')],[_0xfd81('0x75'),'id'])||{})[_0xfd81('0x95')](function(_0x1a78eb){for(var _0x244ce1=0x0;_0x244ce1<_0x2bfe01[_0xfd81('0x60')][_0xfd81('0x75')][_0xfd81('0x4f')];_0x244ce1+=0x1){socket[_0xfd81('0x7e')](_0xfd81('0x7f'),{'UserId':Number(_0x2bfe01['body'][_0xfd81('0x75')][_0x244ce1]),'ChatQueueId':Number(_0x2bfe01['params']['id'])});}return _0x1a78eb;});}})[_0xfd81('0x26')](respondWithResult(_0x2ac015,null))[_0xfd81('0x30')](handleError(_0x2ac015,null));};exports[_0xfd81('0x92')]=function(_0x28f2bd,_0x203e45,_0x338791){return db[_0xfd81('0x44')]['find']({'where':{'id':_0x28f2bd[_0xfd81('0x68')]['id']}})['then'](handleEntityNotFound(_0x203e45,null))[_0xfd81('0x26')](function(_0x5d3255){if(_0x5d3255){return _0x5d3255[_0xfd81('0x92')](_0x28f2bd['query']['ids'])[_0xfd81('0x26')](function(){if(_[_0xfd81('0x96')](_0x28f2bd[_0xfd81('0x4a')][_0xfd81('0x75')])){for(var _0x3cd628=0x0;_0x3cd628<_0x28f2bd[_0xfd81('0x4a')][_0xfd81('0x75')][_0xfd81('0x4f')];_0x3cd628+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x28f2bd[_0xfd81('0x4a')][_0xfd81('0x75')][_0x3cd628]),'ChatQueueId':Number(_0x28f2bd[_0xfd81('0x68')]['id'])});}}else{socket[_0xfd81('0x7e')](_0xfd81('0x93'),{'UserId':Number(_0x28f2bd['query'][_0xfd81('0x75')]),'ChatQueueId':Number(_0x28f2bd[_0xfd81('0x68')]['id'])});}});}})[_0xfd81('0x26')](respondWithStatusCode(_0x203e45,null))[_0xfd81('0x30')](handleError(_0x203e45,null));};exports[_0xfd81('0x97')]=function(_0x5481fc,_0x1321a8,_0x5a219d){var _0x2860d6={};var _0x57f8fa={};var _0x1107b9;var _0x41a45e;return db[_0xfd81('0x44')][_0xfd81('0x6b')]({'where':{'id':_0x5481fc[_0xfd81('0x68')]['id']}})[_0xfd81('0x26')](handleEntityNotFound(_0x1321a8,null))[_0xfd81('0x26')](function(_0x11d645){if(_0x11d645){_0x1107b9=_0x11d645;_0x57f8fa['model']=_[_0xfd81('0x4b')](db[_0xfd81('0x6e')][_0xfd81('0x45')]);_0x57f8fa['query']=_[_0xfd81('0x4b')](_0x5481fc['query']);_0x57f8fa[_0xfd81('0x56')]=_[_0xfd81('0x4c')](_0x57f8fa[_0xfd81('0x49')],_0x57f8fa[_0xfd81('0x4a')]);_0x2860d6[_0xfd81('0x4d')]=_[_0xfd81('0x4c')](_0x57f8fa[_0xfd81('0x49')],qs[_0xfd81('0x4e')](_0x5481fc['query']['fields']));_0x2860d6[_0xfd81('0x4d')]=_0x2860d6[_0xfd81('0x4d')][_0xfd81('0x4f')]?_0x2860d6[_0xfd81('0x4d')]:_0x57f8fa[_0xfd81('0x49')];_0x2860d6[_0xfd81('0x52')]=qs[_0xfd81('0x53')](_0x5481fc[_0xfd81('0x4a')][_0xfd81('0x53')]);_0x2860d6[_0xfd81('0x54')]=qs[_0xfd81('0x56')](_['pick'](_0x5481fc['query'],_0x57f8fa['filters']));if(_0x5481fc[_0xfd81('0x4a')]['filter']){_0x2860d6['where']=_[_0xfd81('0x58')](_0x2860d6[_0xfd81('0x54')],{'$or':_[_0xfd81('0x43')](_0x2860d6[_0xfd81('0x4d')],function(_0x48c8c7){var _0x28c809={};_0x28c809[_0x48c8c7]={'$like':'%'+_0x5481fc[_0xfd81('0x4a')][_0xfd81('0x57')]+'%'};return _0x28c809;})});}_0x2860d6=_[_0xfd81('0x58')]({},_0x2860d6,_0x5481fc['options']);return _0x1107b9[_0xfd81('0x97')](_0x2860d6);}})['then'](function(_0x5b5457){if(_0x5b5457){_0x41a45e=_0x5b5457[_0xfd81('0x4f')];if(!_0x5481fc[_0xfd81('0x4a')][_0xfd81('0x50')](_0xfd81('0x51'))){_0x2860d6['limit']=qs[_0xfd81('0x36')](_0x5481fc[_0xfd81('0x4a')][_0xfd81('0x36')]);_0x2860d6['offset']=qs[_0xfd81('0x34')](_0x5481fc[_0xfd81('0x4a')]['offset']);}return _0x1107b9[_0xfd81('0x97')](_0x2860d6);}})[_0xfd81('0x26')](function(_0x11963b){if(_0x11963b){return _0x11963b?{'count':_0x41a45e,'rows':_0x11963b}:null;}})[_0xfd81('0x26')](respondWithResult(_0x1321a8,null))[_0xfd81('0x30')](handleError(_0x1321a8,null));}; \ No newline at end of file +var _0xffda=['ChatQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userChatQueue:remove','addAgents','omit','spread','isArray','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','code','error','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','destroy','get','ChatQueues','UserProfileResource','stack','name','index','ChatQueue','rawAttributes','fieldName','type','model','map','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','filter','options','include','findAll','rows','params','keys','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserChatQueue','order','User','findAndCountAll','UserId','agent','chatPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','ids','Agents','online','interface','flatMap','transaction','addTeams','each','findOrCreate','forEach','emit','userChatQueue:save','removeTeams','Team','select','field','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId'];(function(_0x4f3b2d,_0x3bbf46){var _0x3dddfa=function(_0xb8179a){while(--_0xb8179a){_0x4f3b2d['push'](_0x4f3b2d['shift']());}};_0x3dddfa(++_0x3bbf46);}(_0xffda,0x1d8));var _0xaffd=function(_0x2ed575,_0x532dc3){_0x2ed575=_0x2ed575-0x0;var _0x215770=_0xffda[_0x2ed575];return _0x215770;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xaffd('0x0'));var zipdir=require(_0xaffd('0x1'));var jsonpatch=require(_0xaffd('0x2'));var rp=require(_0xaffd('0x3'));var moment=require(_0xaffd('0x4'));var BPromise=require(_0xaffd('0x5'));var Mustache=require(_0xaffd('0x6'));var util=require(_0xaffd('0x7'));var path=require('path');var sox=require(_0xaffd('0x8'));var csv=require(_0xaffd('0x9'));var ejs=require(_0xaffd('0xa'));var fs=require('fs');var fs_extra=require(_0xaffd('0xb'));var _=require(_0xaffd('0xc'));var squel=require(_0xaffd('0xd'));var crypto=require(_0xaffd('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xaffd('0xf'));var toCsv=require(_0xaffd('0x9'));var querystring=require(_0xaffd('0x10'));var Papa=require('papaparse');var Redis=require(_0xaffd('0x11'));var authService=require(_0xaffd('0x12'));var qs=require(_0xaffd('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaffd('0x14'))(_0xaffd('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xaffd('0x16'));var db=require(_0xaffd('0x17'))['db'];config[_0xaffd('0x18')]=_[_0xaffd('0x19')](config['redis'],{'host':_0xaffd('0x1a'),'port':0x18eb});var socket=require(_0xaffd('0x1b'))(new Redis(config[_0xaffd('0x18')]));require('./chatQueue.socket')[_0xaffd('0x1c')](socket);var jayson=require(_0xaffd('0x1d'));var client=jayson['client'][_0xaffd('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x2e2295,_0x284888,_0x51d11a,_0x4b0433){return new BPromise(function(_0x1a9966,_0x1e7ef7){var _0x1353e5=_0x4b0433||client;return _0x1353e5[_0xaffd('0x1f')](_0x2e2295,_0x51d11a)[_0xaffd('0x20')](function(_0x5d19de){logger[_0xaffd('0x21')](_0xaffd('0x22'),_0x284888,'request\x20sent');logger['debug']('ChatQueue,\x20%s,\x20%s,\x20%s',_0x284888,_0xaffd('0x23'),JSON['stringify'](_0x5d19de));if(_0x5d19de['error']){if(_0x5d19de['error'][_0xaffd('0x24')]===0x1f4){logger[_0xaffd('0x25')](_0xaffd('0x22'),_0x284888,_0x5d19de['error'][_0xaffd('0x26')]);return _0x1e7ef7(_0x5d19de[_0xaffd('0x25')]['message']);}logger[_0xaffd('0x25')]('ChatQueue,\x20%s,\x20%s',_0x284888,_0x5d19de[_0xaffd('0x25')][_0xaffd('0x26')]);return _0x1a9966(_0x5d19de[_0xaffd('0x25')][_0xaffd('0x26')]);}else{logger[_0xaffd('0x21')]('ChatQueue,\x20%s,\x20%s',_0x284888,_0xaffd('0x23'));_0x1a9966(_0x5d19de['result']['message']);}})[_0xaffd('0x27')](function(_0x4b71ec){logger[_0xaffd('0x25')](_0xaffd('0x22'),_0x284888,_0x4b71ec);_0x1e7ef7(_0x4b71ec);});});}function respondWithStatusCode(_0x3e2718,_0x588882){_0x588882=_0x588882||0xcc;return function(_0x1349e1){if(_0x1349e1){return _0x3e2718[_0xaffd('0x28')](_0x588882);}return _0x3e2718[_0xaffd('0x29')](_0x588882)[_0xaffd('0x2a')]();};}function respondWithResult(_0x266d41,_0x411c4e){_0x411c4e=_0x411c4e||0xc8;return function(_0x29964c){if(_0x29964c){return _0x266d41['status'](_0x411c4e)[_0xaffd('0x2b')](_0x29964c);}};}function respondWithFilteredResult(_0x53b674,_0x361778){return function(_0x8de102){if(_0x8de102){var _0x2664ab=typeof _0x361778[_0xaffd('0x2c')]===_0xaffd('0x2d')&&typeof _0x361778[_0xaffd('0x2e')]===_0xaffd('0x2d');var _0x1e2311=_0x8de102['count'];var _0x48ec67=_0x2664ab?0x0:_0x361778['offset'];var _0x323611=_0x2664ab?_0x8de102[_0xaffd('0x2f')]:_0x361778[_0xaffd('0x2c')]+_0x361778[_0xaffd('0x2e')];var _0x452fe2;if(_0x323611>=_0x1e2311){_0x323611=_0x1e2311;_0x452fe2=0xc8;}else{_0x452fe2=0xce;}_0x53b674['status'](_0x452fe2);return _0x53b674[_0xaffd('0x30')](_0xaffd('0x31'),_0x48ec67+'-'+_0x323611+'/'+_0x1e2311)[_0xaffd('0x2b')](_0x8de102);}return null;};}function patchUpdates(_0x11d492){return function(_0x33e6a2){try{jsonpatch['apply'](_0x33e6a2,_0x11d492,!![]);}catch(_0xe6bf40){return BPromise[_0xaffd('0x32')](_0xe6bf40);}return _0x33e6a2[_0xaffd('0x33')]();};}function saveUpdates(_0x3bd0f5,_0x361d24){return function(_0x2ab4b7){if(_0x2ab4b7){return _0x2ab4b7['update'](_0x3bd0f5)['then'](function(_0x500923){return _0x500923;});}return null;};}function removeEntity(_0x1af9f7,_0x37ebcb){return function(_0x85e10d){if(_0x85e10d){return _0x85e10d[_0xaffd('0x34')]()[_0xaffd('0x20')](function(){var _0x28fa98=_0x85e10d[_0xaffd('0x35')]({'plain':!![]});var _0x49c83b=_0xaffd('0x36');return db[_0xaffd('0x37')][_0xaffd('0x34')]({'where':{'type':_0x49c83b,'resourceId':_0x28fa98['id']}})[_0xaffd('0x20')](function(){return _0x85e10d;});})[_0xaffd('0x20')](function(){_0x1af9f7[_0xaffd('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0xbcf437,_0x532a13){return function(_0x47da1a){if(!_0x47da1a){_0xbcf437[_0xaffd('0x28')](0x194);}return _0x47da1a;};}function handleError(_0x333157,_0x1c7ada){_0x1c7ada=_0x1c7ada||0x1f4;return function(_0x2208e6){logger[_0xaffd('0x25')](_0x2208e6[_0xaffd('0x38')]);if(_0x2208e6[_0xaffd('0x39')]){delete _0x2208e6[_0xaffd('0x39')];}_0x333157[_0xaffd('0x29')](_0x1c7ada)['send'](_0x2208e6);};}exports[_0xaffd('0x3a')]=function(_0x838c27,_0x3e4f7d){var _0x552169={},_0x5aaccb={},_0x36f6aa={'count':0x0,'rows':[]};var _0x17d5d2=_['map'](db[_0xaffd('0x3b')][_0xaffd('0x3c')],function(_0x3d3c0a){return{'name':_0x3d3c0a[_0xaffd('0x3d')],'type':_0x3d3c0a[_0xaffd('0x3e')]['key']};});_0x5aaccb[_0xaffd('0x3f')]=_[_0xaffd('0x40')](_0x17d5d2,'name');_0x5aaccb[_0xaffd('0x41')]=_['keys'](_0x838c27['query']);_0x5aaccb[_0xaffd('0x42')]=_[_0xaffd('0x43')](_0x5aaccb[_0xaffd('0x3f')],_0x5aaccb[_0xaffd('0x41')]);_0x552169['attributes']=_[_0xaffd('0x43')](_0x5aaccb[_0xaffd('0x3f')],qs[_0xaffd('0x44')](_0x838c27[_0xaffd('0x41')][_0xaffd('0x44')]));_0x552169[_0xaffd('0x45')]=_0x552169['attributes'][_0xaffd('0x46')]?_0x552169[_0xaffd('0x45')]:_0x5aaccb['model'];if(!_0x838c27[_0xaffd('0x41')][_0xaffd('0x47')](_0xaffd('0x48'))){_0x552169['limit']=qs[_0xaffd('0x2e')](_0x838c27['query'][_0xaffd('0x2e')]);_0x552169[_0xaffd('0x2c')]=qs[_0xaffd('0x2c')](_0x838c27['query'][_0xaffd('0x2c')]);}_0x552169['order']=qs[_0xaffd('0x49')](_0x838c27['query']['sort']);_0x552169[_0xaffd('0x4a')]=qs[_0xaffd('0x42')](_[_0xaffd('0x4b')](_0x838c27[_0xaffd('0x41')],_0x5aaccb[_0xaffd('0x42')]),_0x17d5d2);if(_0x838c27[_0xaffd('0x41')]['filter']){_0x552169[_0xaffd('0x4a')]=_[_0xaffd('0x4c')](_0x552169[_0xaffd('0x4a')],{'$or':_['map'](_0x17d5d2,function(_0x704074){if(_0x704074[_0xaffd('0x3e')]!=='VIRTUAL'){var _0x1e7b14={};_0x1e7b14[_0x704074['name']]={'$like':'%'+_0x838c27[_0xaffd('0x41')][_0xaffd('0x4d')]+'%'};return _0x1e7b14;}})});}_0x552169=_[_0xaffd('0x4c')]({},_0x552169,_0x838c27[_0xaffd('0x4e')]);var _0x20a31d={'where':_0x552169['where']};return db[_0xaffd('0x3b')][_0xaffd('0x2f')](_0x20a31d)[_0xaffd('0x20')](function(_0x3473e8){_0x36f6aa[_0xaffd('0x2f')]=_0x3473e8;if(_0x838c27[_0xaffd('0x41')]['includeAll']){_0x552169[_0xaffd('0x4f')]=[{'all':!![]}];}return db[_0xaffd('0x3b')][_0xaffd('0x50')](_0x552169);})['then'](function(_0x54e881){_0x36f6aa[_0xaffd('0x51')]=_0x54e881;return _0x36f6aa;})[_0xaffd('0x20')](respondWithFilteredResult(_0x3e4f7d,_0x552169))[_0xaffd('0x27')](handleError(_0x3e4f7d,null));};exports['show']=function(_0x507ce6,_0x379c7f){var _0x3a2b7e={'raw':!![],'where':{'id':_0x507ce6[_0xaffd('0x52')]['id']}},_0x4b46af={};_0x4b46af['model']=_[_0xaffd('0x53')](db[_0xaffd('0x3b')][_0xaffd('0x3c')]);_0x4b46af['query']=_['keys'](_0x507ce6[_0xaffd('0x41')]);_0x4b46af[_0xaffd('0x42')]=_[_0xaffd('0x43')](_0x4b46af[_0xaffd('0x3f')],_0x4b46af[_0xaffd('0x41')]);_0x3a2b7e['attributes']=_['intersection'](_0x4b46af[_0xaffd('0x3f')],qs[_0xaffd('0x44')](_0x507ce6[_0xaffd('0x41')][_0xaffd('0x44')]));_0x3a2b7e[_0xaffd('0x45')]=_0x3a2b7e[_0xaffd('0x45')][_0xaffd('0x46')]?_0x3a2b7e[_0xaffd('0x45')]:_0x4b46af['model'];if(_0x507ce6[_0xaffd('0x41')][_0xaffd('0x54')]){_0x3a2b7e[_0xaffd('0x4f')]=[{'all':!![]}];}_0x3a2b7e=_[_0xaffd('0x4c')]({},_0x3a2b7e,_0x507ce6[_0xaffd('0x4e')]);return db[_0xaffd('0x3b')][_0xaffd('0x55')](_0x3a2b7e)[_0xaffd('0x20')](handleEntityNotFound(_0x379c7f,null))['then'](respondWithResult(_0x379c7f,null))['catch'](handleError(_0x379c7f,null));};exports[_0xaffd('0x56')]=function(_0x28e311,_0x1fbeb1){return db[_0xaffd('0x3b')][_0xaffd('0x56')](_0x28e311[_0xaffd('0x57')],{})['then'](function(_0x4fbc84){var _0x2a233c=_0x28e311[_0xaffd('0x58')][_0xaffd('0x35')]({'plain':!![]});if(!_0x2a233c)throw new Error(_0xaffd('0x59'));if(_0x2a233c[_0xaffd('0x5a')]===_0xaffd('0x58')){var _0x5629c6=_0x4fbc84['get']({'plain':!![]});var _0x41a25c=_0xaffd('0x36');return db['UserProfileSection'][_0xaffd('0x55')]({'where':{'name':_0x41a25c,'userProfileId':_0x2a233c[_0xaffd('0x5b')]},'raw':!![]})[_0xaffd('0x20')](function(_0x5251ed){if(_0x5251ed&&_0x5251ed['autoAssociation']===0x0){return db[_0xaffd('0x37')]['create']({'name':_0x5629c6['name'],'resourceId':_0x5629c6['id'],'type':_0x5251ed[_0xaffd('0x39')],'sectionId':_0x5251ed['id']},{})['then'](function(){return _0x4fbc84;});}else{return _0x4fbc84;}})['catch'](function(_0x2da187){logger[_0xaffd('0x25')](_0xaffd('0x5c'),_0x2da187);throw _0x2da187;});}return _0x4fbc84;})[_0xaffd('0x20')](respondWithResult(_0x1fbeb1,0xc9))[_0xaffd('0x27')](handleError(_0x1fbeb1,null));};exports['update']=function(_0x456cf0,_0xc879c6){if(_0x456cf0['body']['id']){delete _0x456cf0[_0xaffd('0x57')]['id'];}return db[_0xaffd('0x3b')][_0xaffd('0x55')]({'where':{'id':_0x456cf0[_0xaffd('0x52')]['id']}})['then'](handleEntityNotFound(_0xc879c6,null))[_0xaffd('0x20')](saveUpdates(_0x456cf0[_0xaffd('0x57')],null))['then'](respondWithResult(_0xc879c6,null))[_0xaffd('0x27')](handleError(_0xc879c6,null));};exports[_0xaffd('0x34')]=function(_0x173c94,_0x40a1cf){return db['ChatQueue'][_0xaffd('0x55')]({'where':{'id':_0x173c94[_0xaffd('0x52')]['id']}})[_0xaffd('0x20')](handleEntityNotFound(_0x40a1cf,null))[_0xaffd('0x20')](removeEntity(_0x40a1cf,null))[_0xaffd('0x27')](handleError(_0x40a1cf,null));};exports[_0xaffd('0x5d')]=function(_0x5e966d,_0x31a5a0){return db[_0xaffd('0x3b')]['describe']()[_0xaffd('0x20')](respondWithResult(_0x31a5a0,null))['catch'](handleError(_0x31a5a0,null));};exports[_0xaffd('0x5e')]=function(_0x1f752d,_0x33de81,_0x2d7de5){var _0x11c1c5={'raw':!![],'where':{}},_0x4d063e={},_0x13092b;return db[_0xaffd('0x3b')][_0xaffd('0x5f')]({'where':{'id':_0x1f752d[_0xaffd('0x52')]['id']}})[_0xaffd('0x20')](handleEntityNotFound(_0x33de81,null))['then'](function(_0x419f0a){if(_0x419f0a){_0x13092b=_0x419f0a[_0xaffd('0x35')]({'plain':!![]});_0x4d063e['model']=_[_0xaffd('0x53')](db[_0xaffd('0x60')][_0xaffd('0x3c')]);_0x4d063e[_0xaffd('0x41')]=_['keys'](_0x1f752d[_0xaffd('0x41')]);_0x4d063e[_0xaffd('0x42')]=_[_0xaffd('0x43')](_0x4d063e['model'],_0x4d063e[_0xaffd('0x41')]);_0x11c1c5['attributes']=_['intersection'](_0x4d063e[_0xaffd('0x3f')],qs[_0xaffd('0x44')](_0x1f752d[_0xaffd('0x41')][_0xaffd('0x44')]));_0x11c1c5['attributes']=_0x11c1c5[_0xaffd('0x45')][_0xaffd('0x46')]?_0x11c1c5[_0xaffd('0x45')]:_0x4d063e[_0xaffd('0x3f')];if(!_0x1f752d[_0xaffd('0x41')][_0xaffd('0x47')](_0xaffd('0x48'))){_0x11c1c5[_0xaffd('0x2e')]=qs[_0xaffd('0x2e')](_0x1f752d[_0xaffd('0x41')][_0xaffd('0x2e')]);_0x11c1c5[_0xaffd('0x2c')]=qs[_0xaffd('0x2c')](_0x1f752d[_0xaffd('0x41')][_0xaffd('0x2c')]);}_0x11c1c5[_0xaffd('0x61')]=qs[_0xaffd('0x49')](_0x1f752d[_0xaffd('0x41')][_0xaffd('0x49')]);_0x11c1c5[_0xaffd('0x4a')]=qs[_0xaffd('0x42')](_[_0xaffd('0x4b')](_0x1f752d[_0xaffd('0x41')],_0x4d063e[_0xaffd('0x42')]));_0x11c1c5[_0xaffd('0x4a')]['ChatQueueId']=_0x419f0a['id'];if(_0x1f752d['query']['filter']){_0x11c1c5['where']=_[_0xaffd('0x4c')](_0x11c1c5[_0xaffd('0x4a')],{'$or':_[_0xaffd('0x40')](_0x11c1c5[_0xaffd('0x45')],function(_0x44a8d9){var _0x1514a8={};_0x1514a8[_0x44a8d9]={'$like':'%'+_0x1f752d[_0xaffd('0x41')]['filter']+'%'};return _0x1514a8;})});}_0x11c1c5=_[_0xaffd('0x4c')]({},_0x11c1c5,_0x1f752d[_0xaffd('0x4e')]);return db['UserChatQueue']['findAll'](_0x11c1c5);}})['then'](function(_0x2fa6a1){if(_0x2fa6a1){return db[_0xaffd('0x62')][_0xaffd('0x63')]({'where':{'id':_['map'](_0x2fa6a1,_0xaffd('0x64')),'role':_0xaffd('0x65')},'attributes':['id',_0xaffd('0x39'),_0xaffd('0x66'),_0xaffd('0x67'),_0xaffd('0x68')]});}})[_0xaffd('0x20')](function(_0x7d072e){if(_0x7d072e){return{'count':_0x7d072e[_0xaffd('0x2f')],'rows':_[_0xaffd('0x40')](_0x7d072e['rows'],function(_0x586342){return{'membername':_0x586342[_0xaffd('0x39')],'UserId':_0x586342['id'],'queue_name':_0x13092b['name'],'ChatQueueId':_0x13092b['id'],'interface':util[_0xaffd('0x69')](_0xaffd('0x6a'),_0xaffd('0x6b'),_0x586342[_0xaffd('0x39')]),'penalty':0x0,'paused':_0x586342['chatPause'],'createdAt':_0x586342[_0xaffd('0x68')],'updatedAt':_0x586342[_0xaffd('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xaffd('0x20')](respondWithFilteredResult(_0x33de81,_0x11c1c5))[_0xaffd('0x27')](handleError(_0x33de81,null));};exports[_0xaffd('0x6c')]=function(_0x3a7357,_0x27dfc9,_0x12c4f4){var _0x4febce={};var _0x16070c={};var _0x3e3ea3;var _0x5e3bd4;return db[_0xaffd('0x3b')][_0xaffd('0x5f')]({'where':{'id':_0x3a7357[_0xaffd('0x52')]['id']}})['then'](handleEntityNotFound(_0x27dfc9,null))[_0xaffd('0x20')](function(_0x5eae02){if(_0x5eae02){_0x3e3ea3=_0x5eae02;_0x16070c[_0xaffd('0x3f')]=_['keys'](db['Team'][_0xaffd('0x3c')]);_0x16070c[_0xaffd('0x41')]=_['keys'](_0x3a7357[_0xaffd('0x41')]);_0x16070c[_0xaffd('0x42')]=_[_0xaffd('0x43')](_0x16070c[_0xaffd('0x3f')],_0x16070c[_0xaffd('0x41')]);_0x4febce['attributes']=_[_0xaffd('0x43')](_0x16070c[_0xaffd('0x3f')],qs[_0xaffd('0x44')](_0x3a7357['query'][_0xaffd('0x44')]));_0x4febce[_0xaffd('0x45')]=_0x4febce['attributes']['length']?_0x4febce[_0xaffd('0x45')]:_0x16070c[_0xaffd('0x3f')];_0x4febce[_0xaffd('0x61')]=qs['sort'](_0x3a7357[_0xaffd('0x41')]['sort']);_0x4febce['where']=qs[_0xaffd('0x42')](_[_0xaffd('0x4b')](_0x3a7357['query'],_0x16070c['filters']));if(_0x3a7357[_0xaffd('0x41')]['filter']){_0x4febce[_0xaffd('0x4a')]=_[_0xaffd('0x4c')](_0x4febce[_0xaffd('0x4a')],{'$or':_[_0xaffd('0x40')](_0x4febce[_0xaffd('0x45')],function(_0x38e25b){var _0xafb59={};_0xafb59[_0x38e25b]={'$like':'%'+_0x3a7357[_0xaffd('0x41')]['filter']+'%'};return _0xafb59;})});}_0x4febce=_[_0xaffd('0x4c')]({},_0x4febce,_0x3a7357[_0xaffd('0x4e')]);return _0x3e3ea3['getTeams'](_0x4febce);}})[_0xaffd('0x20')](function(_0x2d5410){if(_0x2d5410){_0x5e3bd4=_0x2d5410[_0xaffd('0x46')];if(!_0x3a7357['query'][_0xaffd('0x47')](_0xaffd('0x48'))){_0x4febce[_0xaffd('0x2e')]=qs[_0xaffd('0x2e')](_0x3a7357[_0xaffd('0x41')]['limit']);_0x4febce[_0xaffd('0x2c')]=qs[_0xaffd('0x2c')](_0x3a7357['query'][_0xaffd('0x2c')]);}return _0x3e3ea3[_0xaffd('0x6c')](_0x4febce);}})[_0xaffd('0x20')](function(_0x37739b){if(_0x37739b){return _0x37739b?{'count':_0x5e3bd4,'rows':_0x37739b}:null;}})[_0xaffd('0x20')](respondWithResult(_0x27dfc9,null))[_0xaffd('0x27')](handleError(_0x27dfc9,null));};exports['addTeams']=function(_0x357ab5,_0x5741b7,_0x338ba6){var _0x200f6c=_0x357ab5[_0xaffd('0x57')][_0xaffd('0x6d')];return db['Team'][_0xaffd('0x50')]({'where':{'id':_0x200f6c},'attributes':['id'],'include':[{'model':db[_0xaffd('0x62')],'as':_0xaffd('0x6e'),'attributes':['id',_0xaffd('0x39'),_0xaffd('0x6f'),'voicePause',_0xaffd('0x70')],'raw':!![]}]})[_0xaffd('0x20')](function(_0x5c0d4d){if(_0x5c0d4d){var _0x15b16a=_[_0xaffd('0x71')](_0x5c0d4d,function(_0x24b8f2){var _0x2fcc05=_0x24b8f2[_0xaffd('0x35')]({'plain':!![]});return _0x2fcc05[_0xaffd('0x6e')];});return db[_0xaffd('0x3b')][_0xaffd('0x55')]({'where':{'id':_0x357ab5[_0xaffd('0x52')]['id']}})['then'](function(_0x43bfb5){return db['sequelize'][_0xaffd('0x72')](function(_0x289ece){return _0x43bfb5[_0xaffd('0x73')](_0x200f6c,{'transaction':_0x289ece})[_0xaffd('0x20')](function(){return BPromise[_0xaffd('0x74')](_0x15b16a,function(_0x509cc4){return db[_0xaffd('0x60')][_0xaffd('0x75')]({'where':{'UserId':_0x509cc4['id'],'ChatQueueId':_0x357ab5[_0xaffd('0x52')]['id']},'transaction':_0x289ece});});})[_0xaffd('0x20')](function(){_0x15b16a[_0xaffd('0x76')](function(_0x4be827){socket[_0xaffd('0x77')](_0xaffd('0x78'),{'UserId':_0x4be827['id'],'ChatQueueId':_0x43bfb5['id']});});});});});}})[_0xaffd('0x20')](respondWithStatusCode(_0x5741b7,null))[_0xaffd('0x27')](handleError(_0x5741b7,null));};exports[_0xaffd('0x79')]=function(_0x471127,_0x492931,_0x14b172){return db[_0xaffd('0x7a')]['findAll']({'where':{'id':_0x471127[_0xaffd('0x41')][_0xaffd('0x6d')]},'attributes':['id'],'include':[{'model':db[_0xaffd('0x62')],'as':_0xaffd('0x6e'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x492931,null))[_0xaffd('0x20')](function(_0x1d8b2a){var _0x10844e=_['map'](_0x1d8b2a,'id');var _0x3831a6=[];var _0x4e47b9=[];var _0x2a5f1c=squel[_0xaffd('0x7b')]();_0x2a5f1c[_0xaffd('0x7c')]('tq.TeamId')['from']('team_has_chat_queues','tq')[_0xaffd('0x7d')](_0xaffd('0x7e'),'ut',_0xaffd('0x7f'))[_0xaffd('0x4a')](_0xaffd('0x80'),_0x471127['params']['id']);for(var _0x10e4ec=0x0;_0x10e4ec<_0x1d8b2a[_0xaffd('0x46')];_0x10e4ec+=0x1){let _0x2a8f2d=_0x1d8b2a[_0x10e4ec];for(var _0x514d40=0x0;_0x514d40<_0x2a8f2d[_0xaffd('0x6e')]['length'];_0x514d40+=0x1){let _0xae289b=_0x2a8f2d[_0xaffd('0x6e')][_0x514d40];var _0x201701=_0x2a5f1c[_0xaffd('0x81')]();_0x201701['where'](_0xaffd('0x82'),_0xae289b['id']);_0x4e47b9[_0xaffd('0x83')](db['sequelize'][_0xaffd('0x41')](_0x201701[_0xaffd('0x84')](),{'type':db[_0xaffd('0x85')][_0xaffd('0x86')][_0xaffd('0x87')]})[_0xaffd('0x20')](function(_0x4a9ac8){if(_0x4a9ac8['length']===0x1){return _0xae289b['id'];}else{var _0x36d149=_['every'](_[_0xaffd('0x40')](_0x4a9ac8,_0xaffd('0x88')),function(_0x2964e9){return _[_0xaffd('0x89')](_0x10844e,_0x2964e9);});if(_0x36d149){return _0xae289b['id'];}}}));}}return BPromise[_0xaffd('0x8a')](_0x4e47b9)[_0xaffd('0x20')](function(_0x325979){_0x3831a6=_(_0x3831a6)[_0xaffd('0x8b')](_0x325979)[_0xaffd('0x8c')]()[_0xaffd('0x8d')]();return db[_0xaffd('0x3b')][_0xaffd('0x55')]({'where':{'id':_0x471127['params']['id']}})[_0xaffd('0x20')](function(_0x31bb32){return db[_0xaffd('0x85')][_0xaffd('0x72')](function(_0x18a319){return _0x31bb32[_0xaffd('0x79')](_0x471127[_0xaffd('0x41')][_0xaffd('0x6d')],{'transaction':_0x18a319})['then'](function(){if(!_[_0xaffd('0x8e')](_0x3831a6)){return _0x31bb32[_0xaffd('0x8f')](_0x3831a6,{'transaction':_0x18a319});}})[_0xaffd('0x20')](function(){_0x3831a6[_0xaffd('0x76')](function(_0x4f3d13){socket[_0xaffd('0x77')](_0xaffd('0x90'),{'UserId':_0x4f3d13,'ChatQueueId':_0x31bb32['id']});});});});});});})[_0xaffd('0x20')](respondWithStatusCode(_0x492931,null))[_0xaffd('0x27')](handleError(_0x492931,null));};exports[_0xaffd('0x91')]=function(_0x2d5869,_0x32a060,_0x361c44){return db['ChatQueue'][_0xaffd('0x55')]({'where':{'id':_0x2d5869[_0xaffd('0x52')]['id']}})[_0xaffd('0x20')](handleEntityNotFound(_0x32a060,null))[_0xaffd('0x20')](function(_0xed160e){if(_0xed160e){return _0xed160e[_0xaffd('0x91')](_0x2d5869[_0xaffd('0x57')][_0xaffd('0x6d')],_[_0xaffd('0x92')](_0x2d5869[_0xaffd('0x57')],['ids','id'])||{})[_0xaffd('0x93')](function(_0x40f83a){for(var _0x31adaa=0x0;_0x31adaa<_0x2d5869['body']['ids'][_0xaffd('0x46')];_0x31adaa+=0x1){socket[_0xaffd('0x77')](_0xaffd('0x78'),{'UserId':Number(_0x2d5869[_0xaffd('0x57')]['ids'][_0x31adaa]),'ChatQueueId':Number(_0x2d5869[_0xaffd('0x52')]['id'])});}return _0x40f83a;});}})[_0xaffd('0x20')](respondWithResult(_0x32a060,null))[_0xaffd('0x27')](handleError(_0x32a060,null));};exports[_0xaffd('0x8f')]=function(_0x81b500,_0x376bfa,_0xfc609){return db['ChatQueue'][_0xaffd('0x55')]({'where':{'id':_0x81b500[_0xaffd('0x52')]['id']}})[_0xaffd('0x20')](handleEntityNotFound(_0x376bfa,null))[_0xaffd('0x20')](function(_0x42b582){if(_0x42b582){return _0x42b582[_0xaffd('0x8f')](_0x81b500[_0xaffd('0x41')][_0xaffd('0x6d')])['then'](function(){if(_[_0xaffd('0x94')](_0x81b500[_0xaffd('0x41')][_0xaffd('0x6d')])){for(var _0x451cbd=0x0;_0x451cbd<_0x81b500['query'][_0xaffd('0x6d')][_0xaffd('0x46')];_0x451cbd+=0x1){socket[_0xaffd('0x77')](_0xaffd('0x90'),{'UserId':Number(_0x81b500[_0xaffd('0x41')][_0xaffd('0x6d')][_0x451cbd]),'ChatQueueId':Number(_0x81b500[_0xaffd('0x52')]['id'])});}}else{socket[_0xaffd('0x77')]('userChatQueue:remove',{'UserId':Number(_0x81b500[_0xaffd('0x41')][_0xaffd('0x6d')]),'ChatQueueId':Number(_0x81b500[_0xaffd('0x52')]['id'])});}});}})[_0xaffd('0x20')](respondWithStatusCode(_0x376bfa,null))[_0xaffd('0x27')](handleError(_0x376bfa,null));};exports[_0xaffd('0x95')]=function(_0x1ef39f,_0x53eb25,_0x1c622c){var _0x353dc3={};var _0x127886={};var _0x5750d8;var _0xfea652;return db[_0xaffd('0x3b')][_0xaffd('0x5f')]({'where':{'id':_0x1ef39f[_0xaffd('0x52')]['id']}})[_0xaffd('0x20')](handleEntityNotFound(_0x53eb25,null))[_0xaffd('0x20')](function(_0x11e9d1){if(_0x11e9d1){_0x5750d8=_0x11e9d1;_0x127886[_0xaffd('0x3f')]=_['keys'](db[_0xaffd('0x62')][_0xaffd('0x3c')]);_0x127886[_0xaffd('0x41')]=_[_0xaffd('0x53')](_0x1ef39f[_0xaffd('0x41')]);_0x127886[_0xaffd('0x42')]=_[_0xaffd('0x43')](_0x127886[_0xaffd('0x3f')],_0x127886[_0xaffd('0x41')]);_0x353dc3[_0xaffd('0x45')]=_[_0xaffd('0x43')](_0x127886[_0xaffd('0x3f')],qs['fields'](_0x1ef39f[_0xaffd('0x41')][_0xaffd('0x44')]));_0x353dc3[_0xaffd('0x45')]=_0x353dc3[_0xaffd('0x45')][_0xaffd('0x46')]?_0x353dc3[_0xaffd('0x45')]:_0x127886['model'];_0x353dc3[_0xaffd('0x61')]=qs[_0xaffd('0x49')](_0x1ef39f[_0xaffd('0x41')][_0xaffd('0x49')]);_0x353dc3[_0xaffd('0x4a')]=qs[_0xaffd('0x42')](_[_0xaffd('0x4b')](_0x1ef39f[_0xaffd('0x41')],_0x127886['filters']));if(_0x1ef39f[_0xaffd('0x41')][_0xaffd('0x4d')]){_0x353dc3[_0xaffd('0x4a')]=_[_0xaffd('0x4c')](_0x353dc3['where'],{'$or':_[_0xaffd('0x40')](_0x353dc3[_0xaffd('0x45')],function(_0x1fc96e){var _0x258680={};_0x258680[_0x1fc96e]={'$like':'%'+_0x1ef39f[_0xaffd('0x41')]['filter']+'%'};return _0x258680;})});}_0x353dc3=_['merge']({},_0x353dc3,_0x1ef39f[_0xaffd('0x4e')]);return _0x5750d8[_0xaffd('0x95')](_0x353dc3);}})[_0xaffd('0x20')](function(_0x2f48ee){if(_0x2f48ee){_0xfea652=_0x2f48ee['length'];if(!_0x1ef39f['query'][_0xaffd('0x47')](_0xaffd('0x48'))){_0x353dc3['limit']=qs['limit'](_0x1ef39f[_0xaffd('0x41')][_0xaffd('0x2e')]);_0x353dc3[_0xaffd('0x2c')]=qs[_0xaffd('0x2c')](_0x1ef39f[_0xaffd('0x41')][_0xaffd('0x2c')]);}return _0x5750d8[_0xaffd('0x95')](_0x353dc3);}})[_0xaffd('0x20')](function(_0x351c7b){if(_0x351c7b){return _0x351c7b?{'count':_0xfea652,'rows':_0x351c7b}:null;}})['then'](respondWithResult(_0x53eb25,null))[_0xaffd('0x27')](handleError(_0x53eb25,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index 19a3fb0..b2c9b01 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 _0x7fef=['save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0x7fef,0x66));var _0xf7fe=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7fef[_0x321bb2];return _0x9c12ed;};'use strict';var EventEmitter=require(_0xf7fe('0x0'));var ChatQueue=require(_0xf7fe('0x1'))['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xf7fe('0x2'),'afterUpdate':_0xf7fe('0x3'),'afterDestroy':_0xf7fe('0x4')};function emitEvent(_0x5cff3e){return function(_0x1bf938,_0x5f4e08,_0xfa5de9){ChatQueueEvents[_0xf7fe('0x5')](_0x5cff3e+':'+_0x1bf938['id'],_0x1bf938);ChatQueueEvents[_0xf7fe('0x5')](_0x5cff3e,_0x1bf938);_0xfa5de9(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatQueue[_0xf7fe('0x6')](e,emitEvent(event));}}module[_0xf7fe('0x7')]=ChatQueueEvents; \ No newline at end of file +var _0x1145=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatQueue','emit'];(function(_0x12bda2,_0x39d232){var _0xa0938a=function(_0x248afa){while(--_0x248afa){_0x12bda2['push'](_0x12bda2['shift']());}};_0xa0938a(++_0x39d232);}(_0x1145,0xc7));var _0x5114=function(_0x1d3bce,_0xca9cfc){_0x1d3bce=_0x1d3bce-0x0;var _0x5f4564=_0x1145[_0x1d3bce];return _0x5f4564;};'use strict';var EventEmitter=require(_0x5114('0x0'));var ChatQueue=require(_0x5114('0x1'))['db'][_0x5114('0x2')];var ChatQueueEvents=new EventEmitter();ChatQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xb7afb3){return function(_0x460084,_0xb8d3c7,_0xe1b0dc){ChatQueueEvents[_0x5114('0x3')](_0xb7afb3+':'+_0x460084['id'],_0x460084);ChatQueueEvents[_0x5114('0x3')](_0xb7afb3,_0x460084);_0xe1b0dc(null);};}for(var e in events){if(events[_0x5114('0x4')](e)){var event=events[e];ChatQueue[_0x5114('0x5')](e,emitEvent(event));}}module[_0x5114('0x6')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 9414100..fe40289 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 _0x3f54=['moment','bluebird','../../config/environment','./chatQueue.attributes','ChatQueue','lodash','util','../../config/logger','api'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3f54,0xdd));var _0x43f5=function(_0x21f3bf,_0xfb0f59){_0x21f3bf=_0x21f3bf-0x0;var _0x249d08=_0x3f54[_0x21f3bf];return _0x249d08;};'use strict';var _=require(_0x43f5('0x0'));var util=require(_0x43f5('0x1'));var logger=require(_0x43f5('0x2'))(_0x43f5('0x3'));var moment=require(_0x43f5('0x4'));var BPromise=require(_0x43f5('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x43f5('0x6'));var attributes=require(_0x43f5('0x7'));module['exports']=function(_0xc88bd8,_0x11e15f){return _0xc88bd8['define'](_0x43f5('0x8'),attributes,{'tableName':'chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5e8e=['./chatQueue.attributes','exports','define','ChatQueue','chat_queues','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x5917c4,_0x230db0){var _0x20305f=function(_0x5ca3c6){while(--_0x5ca3c6){_0x5917c4['push'](_0x5917c4['shift']());}};_0x20305f(++_0x230db0);}(_0x5e8e,0x89));var _0xe5e8=function(_0x336221,_0x4e04de){_0x336221=_0x336221-0x0;var _0x2ad2a5=_0x5e8e[_0x336221];return _0x2ad2a5;};'use strict';var _=require('lodash');var util=require(_0xe5e8('0x0'));var logger=require(_0xe5e8('0x1'))('api');var moment=require(_0xe5e8('0x2'));var BPromise=require(_0xe5e8('0x3'));var rp=require(_0xe5e8('0x4'));var fs=require('fs');var path=require(_0xe5e8('0x5'));var rimraf=require(_0xe5e8('0x6'));var config=require('../../config/environment');var attributes=require(_0xe5e8('0x7'));module[_0xe5e8('0x8')]=function(_0x2c8420,_0x2e01de){return _0x2c8420[_0xe5e8('0x9')](_0xe5e8('0xa'),attributes,{'tableName':_0xe5e8('0xb'),'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 1f86288..dce7c2c 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 _0xefe3=['info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetChatQueue','ChatQueue','findAll','options','raw','attributes','limit','include','map','model','then','ShowChatQueue','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatQueue.socket','request'];(function(_0x23e7c1,_0x35110c){var _0x1add43=function(_0x238918){while(--_0x238918){_0x23e7c1['push'](_0x23e7c1['shift']());}};_0x1add43(++_0x35110c);}(_0xefe3,0xf5));var _0x3efe=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xefe3[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x3efe('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3efe('0x1'));var fs=require('fs');var Redis=require(_0x3efe('0x2'));var db=require(_0x3efe('0x3'))['db'];var utils=require(_0x3efe('0x4'));var logger=require('../../config/logger')(_0x3efe('0x5'));var config=require('../../config/environment');var jayson=require(_0x3efe('0x6'));var client=jayson['client'][_0x3efe('0x7')]({'port':0x232a});config[_0x3efe('0x8')]=_[_0x3efe('0x9')](config[_0x3efe('0x8')],{'host':_0x3efe('0xa'),'port':0x18eb});var socket=require(_0x3efe('0xb'))(new Redis(config['redis']));require(_0x3efe('0xc'))['register'](socket);function respondWithRpcPromise(_0x1edce8,_0x47781a,_0x5a4a3f){return new BPromise(function(_0x1d1d6a,_0x54d0ce){return client[_0x3efe('0xd')](_0x1edce8,_0x5a4a3f)['then'](function(_0x5c1b64){logger[_0x3efe('0xe')](_0x3efe('0xf'),_0x47781a,_0x3efe('0x10'));logger[_0x3efe('0x11')](_0x3efe('0x12'),_0x47781a,_0x3efe('0x10'),JSON[_0x3efe('0x13')](_0x5c1b64));if(_0x5c1b64[_0x3efe('0x14')]){if(_0x5c1b64[_0x3efe('0x14')][_0x3efe('0x15')]===0x1f4){logger[_0x3efe('0x14')]('ChatQueue,\x20%s,\x20%s',_0x47781a,_0x5c1b64[_0x3efe('0x14')][_0x3efe('0x16')]);return _0x54d0ce(_0x5c1b64[_0x3efe('0x14')][_0x3efe('0x16')]);}logger['error'](_0x3efe('0xf'),_0x47781a,_0x5c1b64[_0x3efe('0x14')][_0x3efe('0x16')]);return _0x1d1d6a(_0x5c1b64['error']['message']);}else{logger[_0x3efe('0xe')](_0x3efe('0xf'),_0x47781a,_0x3efe('0x10'));_0x1d1d6a(_0x5c1b64[_0x3efe('0x17')][_0x3efe('0x16')]);}})[_0x3efe('0x18')](function(_0x56f7c8){logger[_0x3efe('0x14')](_0x3efe('0xf'),_0x47781a,_0x56f7c8);_0x54d0ce(_0x56f7c8);});});}exports[_0x3efe('0x19')]=function(_0x182a6f){var _0x37dbba=this;return new Promise(function(_0x16c835,_0x41cfcd){return db[_0x3efe('0x1a')][_0x3efe('0x1b')]({'raw':_0x182a6f['options']?_0x182a6f[_0x3efe('0x1c')][_0x3efe('0x1d')]===undefined?!![]:![]:!![],'where':_0x182a6f[_0x3efe('0x1c')]?_0x182a6f[_0x3efe('0x1c')]['where']||null:null,'attributes':_0x182a6f['options']?_0x182a6f[_0x3efe('0x1c')][_0x3efe('0x1e')]||null:null,'limit':_0x182a6f['options']?_0x182a6f['options'][_0x3efe('0x1f')]||null:null,'include':_0x182a6f[_0x3efe('0x1c')]?_0x182a6f[_0x3efe('0x1c')][_0x3efe('0x20')]?_[_0x3efe('0x21')](_0x182a6f[_0x3efe('0x1c')][_0x3efe('0x20')],function(_0x17549){return{'model':db[_0x17549[_0x3efe('0x22')]],'as':_0x17549['as'],'attributes':_0x17549['attributes'],'include':_0x17549[_0x3efe('0x20')]?_['map'](_0x17549[_0x3efe('0x20')],function(_0x21c15d){return{'model':db[_0x21c15d['model']],'as':_0x21c15d['as'],'attributes':_0x21c15d[_0x3efe('0x1e')],'include':_0x21c15d[_0x3efe('0x20')]?_[_0x3efe('0x21')](_0x21c15d['include'],function(_0xdedd1c){return{'model':db[_0xdedd1c[_0x3efe('0x22')]],'as':_0xdedd1c['as'],'attributes':_0xdedd1c['attributes']};}):[]};}):[]};}):[]:[]})[_0x3efe('0x23')](function(_0x11778f){logger[_0x3efe('0xe')]('GetChatQueue',_0x182a6f);logger['debug'](_0x3efe('0x19'),_0x182a6f,JSON[_0x3efe('0x13')](_0x11778f));_0x16c835(_0x11778f);})[_0x3efe('0x18')](function(_0x1f08e2){logger[_0x3efe('0x14')](_0x3efe('0x19'),_0x1f08e2[_0x3efe('0x16')],_0x182a6f);_0x41cfcd(_0x37dbba['error'](0x1f4,_0x1f08e2[_0x3efe('0x16')]));});});};exports['ShowChatQueue']=function(_0x11c1f6){var _0x5e7994=this;return new Promise(function(_0x1ad40b,_0x534e4b){return db[_0x3efe('0x1a')]['find']({'raw':_0x11c1f6['options']?_0x11c1f6['options'][_0x3efe('0x1d')]===undefined?!![]:![]:!![],'where':_0x11c1f6['options']?_0x11c1f6['options']['where']||null:null,'attributes':_0x11c1f6[_0x3efe('0x1c')]?_0x11c1f6[_0x3efe('0x1c')]['attributes']||null:null,'include':_0x11c1f6[_0x3efe('0x1c')]?_0x11c1f6[_0x3efe('0x1c')][_0x3efe('0x20')]?_[_0x3efe('0x21')](_0x11c1f6[_0x3efe('0x1c')][_0x3efe('0x20')],function(_0x1bbf40){return{'model':db[_0x1bbf40[_0x3efe('0x22')]],'as':_0x1bbf40['as'],'attributes':_0x1bbf40[_0x3efe('0x1e')],'include':_0x1bbf40[_0x3efe('0x20')]?_[_0x3efe('0x21')](_0x1bbf40[_0x3efe('0x20')],function(_0x38e712){return{'model':db[_0x38e712[_0x3efe('0x22')]],'as':_0x38e712['as'],'attributes':_0x38e712[_0x3efe('0x1e')],'include':_0x38e712[_0x3efe('0x20')]?_[_0x3efe('0x21')](_0x38e712[_0x3efe('0x20')],function(_0x444db4){return{'model':db[_0x444db4[_0x3efe('0x22')]],'as':_0x444db4['as'],'attributes':_0x444db4['attributes']};}):[]};}):[]};}):[]:[]})[_0x3efe('0x23')](function(_0x32f19e){logger['info'](_0x3efe('0x24'),_0x11c1f6);logger['debug'](_0x3efe('0x24'),_0x11c1f6,JSON[_0x3efe('0x13')](_0x32f19e));_0x1ad40b(_0x32f19e);})[_0x3efe('0x18')](function(_0x23ff85){logger['error']('ShowChatQueue',_0x23ff85[_0x3efe('0x16')],_0x11c1f6);_0x534e4b(_0x5e7994['error'](0x1f4,_0x23ff85[_0x3efe('0x16')]));});});}; \ No newline at end of file +var _0xb98e=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','localhost','socket.io-emitter','./chatQueue.socket','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','message','result','catch','ChatQueue','findAll','raw','options','where','attributes','limit','include','map','model','GetChatQueue','stringify','ShowChatQueue','find','lodash','util'];(function(_0x5a0681,_0x5cbc10){var _0x2d3a74=function(_0x1ba48d){while(--_0x1ba48d){_0x5a0681['push'](_0x5a0681['shift']());}};_0x2d3a74(++_0x5cbc10);}(_0xb98e,0x184));var _0xeb98=function(_0x3b9b2a,_0x371138){_0x3b9b2a=_0x3b9b2a-0x0;var _0x449c4c=_0xb98e[_0x3b9b2a];return _0x449c4c;};'use strict';var _=require(_0xeb98('0x0'));var util=require(_0xeb98('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xeb98('0x2'));var fs=require('fs');var Redis=require(_0xeb98('0x3'));var db=require(_0xeb98('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xeb98('0x5'))(_0xeb98('0x6'));var config=require(_0xeb98('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xeb98('0x8')]['http']({'port':0x232a});config[_0xeb98('0x9')]=_['defaults'](config[_0xeb98('0x9')],{'host':_0xeb98('0xa'),'port':0x18eb});var socket=require(_0xeb98('0xb'))(new Redis(config[_0xeb98('0x9')]));require(_0xeb98('0xc'))[_0xeb98('0xd')](socket);function respondWithRpcPromise(_0x2669bb,_0x23edb5,_0x5ccd7f){return new BPromise(function(_0x28483,_0x8b537e){return client[_0xeb98('0xe')](_0x2669bb,_0x5ccd7f)[_0xeb98('0xf')](function(_0x1c8990){logger[_0xeb98('0x10')](_0xeb98('0x11'),_0x23edb5,_0xeb98('0x12'));logger[_0xeb98('0x13')](_0xeb98('0x14'),_0x23edb5,_0xeb98('0x12'),JSON['stringify'](_0x1c8990));if(_0x1c8990[_0xeb98('0x15')]){if(_0x1c8990[_0xeb98('0x15')]['code']===0x1f4){logger['error'](_0xeb98('0x11'),_0x23edb5,_0x1c8990[_0xeb98('0x15')][_0xeb98('0x16')]);return _0x8b537e(_0x1c8990[_0xeb98('0x15')][_0xeb98('0x16')]);}logger[_0xeb98('0x15')](_0xeb98('0x11'),_0x23edb5,_0x1c8990[_0xeb98('0x15')][_0xeb98('0x16')]);return _0x28483(_0x1c8990[_0xeb98('0x15')][_0xeb98('0x16')]);}else{logger[_0xeb98('0x10')](_0xeb98('0x11'),_0x23edb5,_0xeb98('0x12'));_0x28483(_0x1c8990[_0xeb98('0x17')][_0xeb98('0x16')]);}})[_0xeb98('0x18')](function(_0x25a13d){logger[_0xeb98('0x15')](_0xeb98('0x11'),_0x23edb5,_0x25a13d);_0x8b537e(_0x25a13d);});});}exports['GetChatQueue']=function(_0x38e22e){var _0x396419=this;return new Promise(function(_0x4f5267,_0x56b018){return db[_0xeb98('0x19')][_0xeb98('0x1a')]({'raw':_0x38e22e['options']?_0x38e22e['options'][_0xeb98('0x1b')]===undefined?!![]:![]:!![],'where':_0x38e22e['options']?_0x38e22e[_0xeb98('0x1c')][_0xeb98('0x1d')]||null:null,'attributes':_0x38e22e['options']?_0x38e22e[_0xeb98('0x1c')][_0xeb98('0x1e')]||null:null,'limit':_0x38e22e[_0xeb98('0x1c')]?_0x38e22e[_0xeb98('0x1c')][_0xeb98('0x1f')]||null:null,'include':_0x38e22e[_0xeb98('0x1c')]?_0x38e22e[_0xeb98('0x1c')][_0xeb98('0x20')]?_[_0xeb98('0x21')](_0x38e22e[_0xeb98('0x1c')][_0xeb98('0x20')],function(_0x499ae8){return{'model':db[_0x499ae8[_0xeb98('0x22')]],'as':_0x499ae8['as'],'attributes':_0x499ae8[_0xeb98('0x1e')],'include':_0x499ae8[_0xeb98('0x20')]?_[_0xeb98('0x21')](_0x499ae8[_0xeb98('0x20')],function(_0x175a0f){return{'model':db[_0x175a0f[_0xeb98('0x22')]],'as':_0x175a0f['as'],'attributes':_0x175a0f[_0xeb98('0x1e')],'include':_0x175a0f[_0xeb98('0x20')]?_[_0xeb98('0x21')](_0x175a0f[_0xeb98('0x20')],function(_0x37fdd6){return{'model':db[_0x37fdd6['model']],'as':_0x37fdd6['as'],'attributes':_0x37fdd6[_0xeb98('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xeb98('0xf')](function(_0x2eb410){logger[_0xeb98('0x10')]('GetChatQueue',_0x38e22e);logger[_0xeb98('0x13')](_0xeb98('0x23'),_0x38e22e,JSON[_0xeb98('0x24')](_0x2eb410));_0x4f5267(_0x2eb410);})[_0xeb98('0x18')](function(_0x430a6b){logger[_0xeb98('0x15')]('GetChatQueue',_0x430a6b['message'],_0x38e22e);_0x56b018(_0x396419[_0xeb98('0x15')](0x1f4,_0x430a6b[_0xeb98('0x16')]));});});};exports[_0xeb98('0x25')]=function(_0x50cbc6){var _0x3d3b87=this;return new Promise(function(_0x14a7e0,_0x352215){return db[_0xeb98('0x19')][_0xeb98('0x26')]({'raw':_0x50cbc6[_0xeb98('0x1c')]?_0x50cbc6[_0xeb98('0x1c')][_0xeb98('0x1b')]===undefined?!![]:![]:!![],'where':_0x50cbc6[_0xeb98('0x1c')]?_0x50cbc6[_0xeb98('0x1c')][_0xeb98('0x1d')]||null:null,'attributes':_0x50cbc6['options']?_0x50cbc6[_0xeb98('0x1c')][_0xeb98('0x1e')]||null:null,'include':_0x50cbc6[_0xeb98('0x1c')]?_0x50cbc6['options'][_0xeb98('0x20')]?_[_0xeb98('0x21')](_0x50cbc6['options'][_0xeb98('0x20')],function(_0x21bd76){return{'model':db[_0x21bd76[_0xeb98('0x22')]],'as':_0x21bd76['as'],'attributes':_0x21bd76['attributes'],'include':_0x21bd76['include']?_[_0xeb98('0x21')](_0x21bd76[_0xeb98('0x20')],function(_0x20c391){return{'model':db[_0x20c391[_0xeb98('0x22')]],'as':_0x20c391['as'],'attributes':_0x20c391['attributes'],'include':_0x20c391[_0xeb98('0x20')]?_[_0xeb98('0x21')](_0x20c391['include'],function(_0x4603eb){return{'model':db[_0x4603eb['model']],'as':_0x4603eb['as'],'attributes':_0x4603eb[_0xeb98('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xeb98('0xf')](function(_0x2ffbdf){logger[_0xeb98('0x10')](_0xeb98('0x25'),_0x50cbc6);logger['debug']('ShowChatQueue',_0x50cbc6,JSON[_0xeb98('0x24')](_0x2ffbdf));_0x14a7e0(_0x2ffbdf);})[_0xeb98('0x18')](function(_0x1ae437){logger[_0xeb98('0x15')](_0xeb98('0x25'),_0x1ae437[_0xeb98('0x16')],_0x50cbc6);_0x352215(_0x3d3b87[_0xeb98('0x15')](0x1f4,_0x1ae437[_0xeb98('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 417c7b9..f1dd416 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 _0x5636=['save','emit','removeListener','register','length','chatQueue:','./chatQueue.events'];(function(_0x24c2fb,_0x1552e4){var _0x1a9ad9=function(_0x1fcf7c){while(--_0x1fcf7c){_0x24c2fb['push'](_0x24c2fb['shift']());}};_0x1a9ad9(++_0x1552e4);}(_0x5636,0x102));var _0x6563=function(_0x304196,_0x17d612){_0x304196=_0x304196-0x0;var _0x197879=_0x5636[_0x304196];return _0x197879;};'use strict';var ChatQueueEvents=require(_0x6563('0x0'));var events=[_0x6563('0x1'),'remove','update'];function createListener(_0x579d5c,_0x44872c){return function(_0x3a95f7){_0x44872c[_0x6563('0x2')](_0x579d5c,_0x3a95f7);};}function removeListener(_0x4ac653,_0x166a58){return function(){ChatQueueEvents[_0x6563('0x3')](_0x4ac653,_0x166a58);};}exports[_0x6563('0x4')]=function(_0x39792f){for(var _0x29f687=0x0,_0x193942=events[_0x6563('0x5')];_0x29f687<_0x193942;_0x29f687++){var _0x2d57d5=events[_0x29f687];var _0x2d0d5b=createListener(_0x6563('0x6')+_0x2d57d5,_0x39792f);ChatQueueEvents['on'](_0x2d57d5,_0x2d0d5b);}}; \ No newline at end of file +var _0xc6d8=['remove','removeListener','register','length','chatQueue:','./chatQueue.events'];(function(_0x25b2be,_0x508c33){var _0x30d63d=function(_0x431ed1){while(--_0x431ed1){_0x25b2be['push'](_0x25b2be['shift']());}};_0x30d63d(++_0x508c33);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x2183ca,_0x3778a9){_0x2183ca=_0x2183ca-0x0;var _0x21d00e=_0xc6d8[_0x2183ca];return _0x21d00e;};'use strict';var ChatQueueEvents=require(_0x8c6d('0x0'));var events=['save',_0x8c6d('0x1'),'update'];function createListener(_0x3b88d1,_0x5974d3){return function(_0x292852){_0x5974d3['emit'](_0x3b88d1,_0x292852);};}function removeListener(_0x5b6b04,_0x352b8c){return function(){ChatQueueEvents[_0x8c6d('0x2')](_0x5b6b04,_0x352b8c);};}exports[_0x8c6d('0x3')]=function(_0x4f5e8f){for(var _0x3c265c=0x0,_0x2dbb52=events[_0x8c6d('0x4')];_0x3c265c<_0x2dbb52;_0x3c265c++){var _0x5529f1=events[_0x3c265c];var _0x1496ba=createListener(_0x8c6d('0x5')+_0x5529f1,_0x4f5e8f);ChatQueueEvents['on'](_0x5529f1,_0x1496ba);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 1afe4dd..a1ef83c 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 _0xe14b=['/describe','show','/:id/members','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','removeAgents','exports','multer','util','express','Router','../../components/auth/service','./chatQueue.controller','get','isAuthenticated','index'];(function(_0x3b7279,_0x382898){var _0x224927=function(_0x3072e9){while(--_0x3072e9){_0x3b7279['push'](_0x3b7279['shift']());}};_0x224927(++_0x382898);}(_0xe14b,0x93));var _0xbe14=function(_0x5c3891,_0x284f4c){_0x5c3891=_0x5c3891-0x0;var _0x34ecda=_0xe14b[_0x5c3891];return _0x34ecda;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['describe']);router['get']('/:id',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0x6')](_0xbe14('0xb'),auth['isAuthenticated'](),controller['getMembers']);router[_0xbe14('0x6')](_0xbe14('0xc'),auth['isAuthenticated'](),controller[_0xbe14('0xd')]);router[_0xbe14('0x6')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xf')]);router[_0xbe14('0x10')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x11')]);router[_0xbe14('0x10')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x12')]);router[_0xbe14('0x10')]('/:id/users',auth['isAuthenticated'](),controller[_0xbe14('0x13')]);router[_0xbe14('0x14')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0x16')](_0xbe14('0x15'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x17')]);router[_0xbe14('0x16')](_0xbe14('0xc'),auth[_0xbe14('0x7')](),controller['removeTeams']);router[_0xbe14('0x16')](_0xbe14('0xe'),auth[_0xbe14('0x7')](),controller[_0xbe14('0x18')]);module[_0xbe14('0x19')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','/:id','delete','destroy','/:id/teams','removeTeams','multer','util','path'];(function(_0x4c03bf,_0xeee5ef){var _0x363d97=function(_0x184b92){while(--_0x184b92){_0x4c03bf['push'](_0x4c03bf['shift']());}};_0x363d97(++_0xeee5ef);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'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')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x9')]('/:id/teams',auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router['get'](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x14')]('/:id/teams',auth['isAuthenticated'](),controller[_0x7995('0x16')]);router[_0x7995('0x14')](_0x7995('0x12'),auth[_0x7995('0xa')](),controller[_0x7995('0x17')]);router[_0x7995('0x18')](_0x7995('0x19'),auth[_0x7995('0xa')](),controller['update']);router[_0x7995('0x1a')]('/:id',auth[_0x7995('0xa')](),controller[_0x7995('0x1b')]);router[_0x7995('0x1a')](_0x7995('0x1c'),auth[_0x7995('0xa')](),controller[_0x7995('0x1d')]);router['delete']('/:id/users',auth[_0x7995('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index f83f46f..4226dad 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 _0x1639=['DATE','moment','sequelize','exports','STRING'];(function(_0x5c5ad4,_0x54f4bb){var _0x237da2=function(_0x1fe644){while(--_0x1fe644){_0x5c5ad4['push'](_0x5c5ad4['shift']());}};_0x237da2(++_0x54f4bb);}(_0x1639,0x173));var _0x9163=function(_0x52d9ad,_0x208849){_0x52d9ad=_0x52d9ad-0x0;var _0x2aa774=_0x1639[_0x52d9ad];return _0x2aa774;};'use strict';var moment=require(_0x9163('0x0'));var Sequelize=require(_0x9163('0x1'));module[_0x9163('0x2')]={'uniqueid':{'type':Sequelize[_0x9163('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x9163('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x9163('0x4')]},'acceptAt':{'type':Sequelize[_0x9163('0x4')]},'exitAt':{'type':Sequelize[_0x9163('0x4')]},'reason':{'type':Sequelize[_0x9163('0x3')]}}; \ No newline at end of file +var _0xb721=['DATE','STRING'];(function(_0x5a4ea3,_0x3ba1d0){var _0x1e6b27=function(_0x28a2d5){while(--_0x28a2d5){_0x5a4ea3['push'](_0x5a4ea3['shift']());}};_0x1e6b27(++_0x3ba1d0);}(_0xb721,0x169));var _0x1b72=function(_0x20ef64,_0x4a8fe9){_0x20ef64=_0x20ef64-0x0;var _0x3707d8=_0xb721[_0x20ef64];return _0x3707d8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module['exports']={'uniqueid':{'type':Sequelize[_0x1b72('0x0')],'allowNull':![]},'from':{'type':Sequelize[_0x1b72('0x0')]},'joinAt':{'type':Sequelize[_0x1b72('0x1')]},'leaveAt':{'type':Sequelize[_0x1b72('0x1')]},'acceptAt':{'type':Sequelize[_0x1b72('0x1')]},'exitAt':{'type':Sequelize[_0x1b72('0x1')]},'reason':{'type':Sequelize[_0x1b72('0x0')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index 4101b1f..8ae38ef 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 _0xb194=['moment','bluebird','util','path','to-csv','fs-extra','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','end','status','offset','undefined','count','set','Content-Range','json','apply','reject','then','destroy','error','stack','name','send','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','params','merge','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x7cb840,_0x5a712b){var _0x366df6=function(_0x57d997){while(--_0x57d997){_0x7cb840['push'](_0x7cb840['shift']());}};_0x366df6(++_0x5a712b);}(_0xb194,0x1b2));var _0x4b19=function(_0x5ca72f,_0xccbe4e){_0x5ca72f=_0x5ca72f-0x0;var _0x406089=_0xb194[_0x5ca72f];return _0x406089;};'use strict';var emlformat=require(_0x4b19('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4b19('0x1'));var jsonpatch=require(_0x4b19('0x2'));var rp=require(_0x4b19('0x3'));var moment=require(_0x4b19('0x4'));var BPromise=require(_0x4b19('0x5'));var Mustache=require('mustache');var util=require(_0x4b19('0x6'));var path=require(_0x4b19('0x7'));var sox=require('sox');var csv=require(_0x4b19('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4b19('0x9'));var _=require('lodash');var squel=require(_0x4b19('0xa'));var crypto=require(_0x4b19('0xb'));var jsforce=require(_0x4b19('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4b19('0xd'));var Papa=require('papaparse');var Redis=require(_0x4b19('0xe'));var authService=require(_0x4b19('0xf'));var qs=require(_0x4b19('0x10'));var as=require(_0x4b19('0x11'));var hardwareService=require(_0x4b19('0x12'));var logger=require(_0x4b19('0x13'))(_0x4b19('0x14'));var utils=require(_0x4b19('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x4b19('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5be1b2,_0x1ba972){_0x1ba972=_0x1ba972||0xcc;return function(_0x5167ae){if(_0x5167ae){return _0x5be1b2[_0x4b19('0x17')](_0x1ba972);}return _0x5be1b2['status'](_0x1ba972)[_0x4b19('0x18')]();};}function respondWithResult(_0x820063,_0x317d3b){_0x317d3b=_0x317d3b||0xc8;return function(_0x3a3af4){if(_0x3a3af4){return _0x820063[_0x4b19('0x19')](_0x317d3b)['json'](_0x3a3af4);}};}function respondWithFilteredResult(_0xcaaaf6,_0xffedd7){return function(_0x17c334){if(_0x17c334){var _0x3a19cf=typeof _0xffedd7[_0x4b19('0x1a')]===_0x4b19('0x1b')&&typeof _0xffedd7['limit']===_0x4b19('0x1b');var _0xd3f210=_0x17c334[_0x4b19('0x1c')];var _0xe7696a=_0x3a19cf?0x0:_0xffedd7[_0x4b19('0x1a')];var _0x17c7da=_0x3a19cf?_0x17c334[_0x4b19('0x1c')]:_0xffedd7[_0x4b19('0x1a')]+_0xffedd7['limit'];var _0x28a433;if(_0x17c7da>=_0xd3f210){_0x17c7da=_0xd3f210;_0x28a433=0xc8;}else{_0x28a433=0xce;}_0xcaaaf6['status'](_0x28a433);return _0xcaaaf6[_0x4b19('0x1d')](_0x4b19('0x1e'),_0xe7696a+'-'+_0x17c7da+'/'+_0xd3f210)[_0x4b19('0x1f')](_0x17c334);}return null;};}function patchUpdates(_0x2f2082){return function(_0x37cb0a){try{jsonpatch[_0x4b19('0x20')](_0x37cb0a,_0x2f2082,!![]);}catch(_0x56b421){return BPromise[_0x4b19('0x21')](_0x56b421);}return _0x37cb0a['save']();};}function saveUpdates(_0x19db04,_0x10d407){return function(_0x234632){if(_0x234632){return _0x234632['update'](_0x19db04)[_0x4b19('0x22')](function(_0x52e144){return _0x52e144;});}return null;};}function removeEntity(_0x313108,_0x18d376){return function(_0x53f903){if(_0x53f903){return _0x53f903[_0x4b19('0x23')]()[_0x4b19('0x22')](function(){_0x313108[_0x4b19('0x19')](0xcc)[_0x4b19('0x18')]();});}};}function handleEntityNotFound(_0x4c5f27,_0x12c4ac){return function(_0x4ceba3){if(!_0x4ceba3){_0x4c5f27['sendStatus'](0x194);}return _0x4ceba3;};}function handleError(_0x1d5fea,_0x5a84a2){_0x5a84a2=_0x5a84a2||0x1f4;return function(_0x294372){logger[_0x4b19('0x24')](_0x294372[_0x4b19('0x25')]);if(_0x294372[_0x4b19('0x26')]){delete _0x294372['name'];}_0x1d5fea[_0x4b19('0x19')](_0x5a84a2)[_0x4b19('0x27')](_0x294372);};}exports['index']=function(_0x2e1fab,_0x3bcc26){var _0x37d99b={},_0x5aec18={},_0x5240f9={'count':0x0,'rows':[]};var _0x160071=_[_0x4b19('0x28')](db[_0x4b19('0x29')][_0x4b19('0x2a')],function(_0x1d63a3){return{'name':_0x1d63a3['fieldName'],'type':_0x1d63a3[_0x4b19('0x2b')][_0x4b19('0x2c')]};});_0x5aec18[_0x4b19('0x2d')]=_[_0x4b19('0x28')](_0x160071,_0x4b19('0x26'));_0x5aec18[_0x4b19('0x2e')]=_[_0x4b19('0x2f')](_0x2e1fab[_0x4b19('0x2e')]);_0x5aec18[_0x4b19('0x30')]=_[_0x4b19('0x31')](_0x5aec18[_0x4b19('0x2d')],_0x5aec18[_0x4b19('0x2e')]);_0x37d99b['attributes']=_[_0x4b19('0x31')](_0x5aec18['model'],qs[_0x4b19('0x32')](_0x2e1fab[_0x4b19('0x2e')]['fields']));_0x37d99b[_0x4b19('0x33')]=_0x37d99b[_0x4b19('0x33')][_0x4b19('0x34')]?_0x37d99b[_0x4b19('0x33')]:_0x5aec18[_0x4b19('0x2d')];if(!_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x35')](_0x4b19('0x36'))){_0x37d99b[_0x4b19('0x37')]=qs[_0x4b19('0x37')](_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x37')]);_0x37d99b[_0x4b19('0x1a')]=qs['offset'](_0x2e1fab[_0x4b19('0x2e')]['offset']);}_0x37d99b['order']=qs[_0x4b19('0x38')](_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x38')]);_0x37d99b[_0x4b19('0x39')]=qs[_0x4b19('0x30')](_[_0x4b19('0x3a')](_0x2e1fab[_0x4b19('0x2e')],_0x5aec18[_0x4b19('0x30')]),_0x160071);if(_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x3b')]){_0x37d99b[_0x4b19('0x39')]=_['merge'](_0x37d99b[_0x4b19('0x39')],{'$or':_[_0x4b19('0x28')](_0x160071,function(_0x4c770a){if(_0x4c770a['type']!==_0x4b19('0x3c')){var _0x43a277={};_0x43a277[_0x4c770a[_0x4b19('0x26')]]={'$like':'%'+_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x3b')]+'%'};return _0x43a277;}})});}_0x37d99b=_['merge']({},_0x37d99b,_0x2e1fab['options']);var _0xfd7c70={'where':_0x37d99b[_0x4b19('0x39')]};return db[_0x4b19('0x29')][_0x4b19('0x1c')](_0xfd7c70)[_0x4b19('0x22')](function(_0x277a54){_0x5240f9[_0x4b19('0x1c')]=_0x277a54;if(_0x2e1fab[_0x4b19('0x2e')][_0x4b19('0x3d')]){_0x37d99b[_0x4b19('0x3e')]=[{'all':!![]}];}return db[_0x4b19('0x29')][_0x4b19('0x3f')](_0x37d99b);})[_0x4b19('0x22')](function(_0x516999){_0x5240f9[_0x4b19('0x40')]=_0x516999;return _0x5240f9;})[_0x4b19('0x22')](respondWithFilteredResult(_0x3bcc26,_0x37d99b))[_0x4b19('0x41')](handleError(_0x3bcc26,null));};exports['show']=function(_0x77640a,_0x372fdc){var _0x5fab72={'raw':!![],'where':{'id':_0x77640a[_0x4b19('0x42')]['id']}},_0x30023b={};_0x30023b['model']=_[_0x4b19('0x2f')](db['ChatQueueReport'][_0x4b19('0x2a')]);_0x30023b[_0x4b19('0x2e')]=_[_0x4b19('0x2f')](_0x77640a['query']);_0x30023b[_0x4b19('0x30')]=_[_0x4b19('0x31')](_0x30023b[_0x4b19('0x2d')],_0x30023b[_0x4b19('0x2e')]);_0x5fab72['attributes']=_['intersection'](_0x30023b['model'],qs[_0x4b19('0x32')](_0x77640a[_0x4b19('0x2e')][_0x4b19('0x32')]));_0x5fab72['attributes']=_0x5fab72[_0x4b19('0x33')]['length']?_0x5fab72[_0x4b19('0x33')]:_0x30023b[_0x4b19('0x2d')];if(_0x77640a[_0x4b19('0x2e')][_0x4b19('0x3d')]){_0x5fab72[_0x4b19('0x3e')]=[{'all':!![]}];}_0x5fab72=_[_0x4b19('0x43')]({},_0x5fab72,_0x77640a['options']);return db[_0x4b19('0x29')][_0x4b19('0x44')](_0x5fab72)[_0x4b19('0x22')](handleEntityNotFound(_0x372fdc,null))[_0x4b19('0x22')](respondWithResult(_0x372fdc,null))[_0x4b19('0x41')](handleError(_0x372fdc,null));};exports['create']=function(_0x52da1b,_0x20b465){return db[_0x4b19('0x29')][_0x4b19('0x45')](_0x52da1b[_0x4b19('0x46')],{})['then'](respondWithResult(_0x20b465,0xc9))['catch'](handleError(_0x20b465,null));};exports[_0x4b19('0x47')]=function(_0xe70530,_0x53b0df){if(_0xe70530['body']['id']){delete _0xe70530[_0x4b19('0x46')]['id'];}return db[_0x4b19('0x29')][_0x4b19('0x44')]({'where':{'id':_0xe70530[_0x4b19('0x42')]['id']}})[_0x4b19('0x22')](handleEntityNotFound(_0x53b0df,null))['then'](saveUpdates(_0xe70530[_0x4b19('0x46')],null))[_0x4b19('0x22')](respondWithResult(_0x53b0df,null))['catch'](handleError(_0x53b0df,null));};exports[_0x4b19('0x23')]=function(_0x4314ff,_0x5a9e77){return db[_0x4b19('0x29')][_0x4b19('0x44')]({'where':{'id':_0x4314ff[_0x4b19('0x42')]['id']}})[_0x4b19('0x22')](handleEntityNotFound(_0x5a9e77,null))[_0x4b19('0x22')](removeEntity(_0x5a9e77,null))[_0x4b19('0x41')](handleError(_0x5a9e77,null));};exports[_0x4b19('0x48')]=function(_0x1436c7,_0x10cc59){return db[_0x4b19('0x29')][_0x4b19('0x48')]()[_0x4b19('0x22')](respondWithResult(_0x10cc59,null))['catch'](handleError(_0x10cc59,null));}; \ No newline at end of file +var _0x1122=['attributes','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','ChatQueueReport','includeAll','include','findAll','catch','params','keys','fields','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','intersection'];(function(_0x9ddfcb,_0x179781){var _0x3fb475=function(_0x541eeb){while(--_0x541eeb){_0x9ddfcb['push'](_0x9ddfcb['shift']());}};_0x3fb475(++_0x179781);}(_0x1122,0xac));var _0x2112=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1122[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x2112('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2112('0x1'));var jsonpatch=require(_0x2112('0x2'));var rp=require(_0x2112('0x3'));var moment=require(_0x2112('0x4'));var BPromise=require(_0x2112('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2112('0x6'));var sox=require('sox');var csv=require(_0x2112('0x7'));var ejs=require(_0x2112('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2112('0x9'));var squel=require(_0x2112('0xa'));var crypto=require(_0x2112('0xb'));var jsforce=require(_0x2112('0xc'));var deskjs=require(_0x2112('0xd'));var toCsv=require(_0x2112('0x7'));var querystring=require(_0x2112('0xe'));var Papa=require(_0x2112('0xf'));var Redis=require(_0x2112('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x2112('0x11'));var as=require(_0x2112('0x12'));var hardwareService=require(_0x2112('0x13'));var logger=require(_0x2112('0x14'))('api');var utils=require(_0x2112('0x15'));var config=require(_0x2112('0x16'));var licenseUtil=require(_0x2112('0x17'));var db=require(_0x2112('0x18'))['db'];function respondWithStatusCode(_0x450ef8,_0x15d062){_0x15d062=_0x15d062||0xcc;return function(_0x410405){if(_0x410405){return _0x450ef8['sendStatus'](_0x15d062);}return _0x450ef8[_0x2112('0x19')](_0x15d062)['end']();};}function respondWithResult(_0x33e4c3,_0x1f76c2){_0x1f76c2=_0x1f76c2||0xc8;return function(_0x561c78){if(_0x561c78){return _0x33e4c3[_0x2112('0x19')](_0x1f76c2)['json'](_0x561c78);}};}function respondWithFilteredResult(_0x1d5afe,_0x5e5e55){return function(_0xc961a){if(_0xc961a){var _0xc1f5d1=typeof _0x5e5e55['offset']===_0x2112('0x1a')&&typeof _0x5e5e55['limit']===_0x2112('0x1a');var _0x4a9e46=_0xc961a['count'];var _0x454981=_0xc1f5d1?0x0:_0x5e5e55['offset'];var _0x4dee3c=_0xc1f5d1?_0xc961a[_0x2112('0x1b')]:_0x5e5e55[_0x2112('0x1c')]+_0x5e5e55[_0x2112('0x1d')];var _0x40a89d;if(_0x4dee3c>=_0x4a9e46){_0x4dee3c=_0x4a9e46;_0x40a89d=0xc8;}else{_0x40a89d=0xce;}_0x1d5afe[_0x2112('0x19')](_0x40a89d);return _0x1d5afe[_0x2112('0x1e')](_0x2112('0x1f'),_0x454981+'-'+_0x4dee3c+'/'+_0x4a9e46)['json'](_0xc961a);}return null;};}function patchUpdates(_0x5b7e84){return function(_0x154e10){try{jsonpatch[_0x2112('0x20')](_0x154e10,_0x5b7e84,!![]);}catch(_0x435428){return BPromise['reject'](_0x435428);}return _0x154e10[_0x2112('0x21')]();};}function saveUpdates(_0xd17981,_0x2b5c50){return function(_0x101565){if(_0x101565){return _0x101565[_0x2112('0x22')](_0xd17981)[_0x2112('0x23')](function(_0x2a2d44){return _0x2a2d44;});}return null;};}function removeEntity(_0x35a49a,_0x89db6d){return function(_0x51431d){if(_0x51431d){return _0x51431d[_0x2112('0x24')]()[_0x2112('0x23')](function(){_0x35a49a[_0x2112('0x19')](0xcc)[_0x2112('0x25')]();});}};}function handleEntityNotFound(_0x3002a6,_0x27433f){return function(_0x2f6b86){if(!_0x2f6b86){_0x3002a6[_0x2112('0x26')](0x194);}return _0x2f6b86;};}function handleError(_0x3b2c82,_0x5023ea){_0x5023ea=_0x5023ea||0x1f4;return function(_0x7a072c){logger[_0x2112('0x27')](_0x7a072c[_0x2112('0x28')]);if(_0x7a072c[_0x2112('0x29')]){delete _0x7a072c[_0x2112('0x29')];}_0x3b2c82['status'](_0x5023ea)[_0x2112('0x2a')](_0x7a072c);};}exports[_0x2112('0x2b')]=function(_0x1f0978,_0x49f589){var _0x19d559={},_0x1db82b={},_0x1c53da={'count':0x0,'rows':[]};var _0x55ebed=_['map'](db['ChatQueueReport'][_0x2112('0x2c')],function(_0x5d13d3){return{'name':_0x5d13d3[_0x2112('0x2d')],'type':_0x5d13d3[_0x2112('0x2e')][_0x2112('0x2f')]};});_0x1db82b[_0x2112('0x30')]=_[_0x2112('0x31')](_0x55ebed,_0x2112('0x29'));_0x1db82b['query']=_['keys'](_0x1f0978[_0x2112('0x32')]);_0x1db82b[_0x2112('0x33')]=_[_0x2112('0x34')](_0x1db82b['model'],_0x1db82b[_0x2112('0x32')]);_0x19d559[_0x2112('0x35')]=_[_0x2112('0x34')](_0x1db82b[_0x2112('0x30')],qs['fields'](_0x1f0978['query']['fields']));_0x19d559[_0x2112('0x35')]=_0x19d559['attributes'][_0x2112('0x36')]?_0x19d559[_0x2112('0x35')]:_0x1db82b['model'];if(!_0x1f0978[_0x2112('0x32')]['hasOwnProperty'](_0x2112('0x37'))){_0x19d559['limit']=qs['limit'](_0x1f0978[_0x2112('0x32')][_0x2112('0x1d')]);_0x19d559[_0x2112('0x1c')]=qs['offset'](_0x1f0978[_0x2112('0x32')][_0x2112('0x1c')]);}_0x19d559['order']=qs[_0x2112('0x38')](_0x1f0978[_0x2112('0x32')][_0x2112('0x38')]);_0x19d559[_0x2112('0x39')]=qs[_0x2112('0x33')](_[_0x2112('0x3a')](_0x1f0978['query'],_0x1db82b['filters']),_0x55ebed);if(_0x1f0978['query'][_0x2112('0x3b')]){_0x19d559[_0x2112('0x39')]=_[_0x2112('0x3c')](_0x19d559[_0x2112('0x39')],{'$or':_[_0x2112('0x31')](_0x55ebed,function(_0x12116c){if(_0x12116c[_0x2112('0x2e')]!==_0x2112('0x3d')){var _0x3a0cea={};_0x3a0cea[_0x12116c[_0x2112('0x29')]]={'$like':'%'+_0x1f0978[_0x2112('0x32')]['filter']+'%'};return _0x3a0cea;}})});}_0x19d559=_[_0x2112('0x3c')]({},_0x19d559,_0x1f0978[_0x2112('0x3e')]);var _0x2efe8d={'where':_0x19d559[_0x2112('0x39')]};return db[_0x2112('0x3f')][_0x2112('0x1b')](_0x2efe8d)[_0x2112('0x23')](function(_0x31a757){_0x1c53da[_0x2112('0x1b')]=_0x31a757;if(_0x1f0978['query'][_0x2112('0x40')]){_0x19d559[_0x2112('0x41')]=[{'all':!![]}];}return db[_0x2112('0x3f')][_0x2112('0x42')](_0x19d559);})[_0x2112('0x23')](function(_0x43d6c7){_0x1c53da['rows']=_0x43d6c7;return _0x1c53da;})[_0x2112('0x23')](respondWithFilteredResult(_0x49f589,_0x19d559))[_0x2112('0x43')](handleError(_0x49f589,null));};exports['show']=function(_0x18bfa0,_0x2061fd){var _0x42007a={'raw':!![],'where':{'id':_0x18bfa0[_0x2112('0x44')]['id']}},_0xdd0d1={};_0xdd0d1[_0x2112('0x30')]=_['keys'](db[_0x2112('0x3f')][_0x2112('0x2c')]);_0xdd0d1['query']=_[_0x2112('0x45')](_0x18bfa0[_0x2112('0x32')]);_0xdd0d1[_0x2112('0x33')]=_[_0x2112('0x34')](_0xdd0d1['model'],_0xdd0d1[_0x2112('0x32')]);_0x42007a[_0x2112('0x35')]=_[_0x2112('0x34')](_0xdd0d1[_0x2112('0x30')],qs[_0x2112('0x46')](_0x18bfa0[_0x2112('0x32')][_0x2112('0x46')]));_0x42007a['attributes']=_0x42007a[_0x2112('0x35')]['length']?_0x42007a[_0x2112('0x35')]:_0xdd0d1['model'];if(_0x18bfa0[_0x2112('0x32')][_0x2112('0x40')]){_0x42007a[_0x2112('0x41')]=[{'all':!![]}];}_0x42007a=_[_0x2112('0x3c')]({},_0x42007a,_0x18bfa0[_0x2112('0x3e')]);return db[_0x2112('0x3f')][_0x2112('0x47')](_0x42007a)[_0x2112('0x23')](handleEntityNotFound(_0x2061fd,null))[_0x2112('0x23')](respondWithResult(_0x2061fd,null))[_0x2112('0x43')](handleError(_0x2061fd,null));};exports[_0x2112('0x48')]=function(_0x30c5e4,_0x52428e){return db[_0x2112('0x3f')][_0x2112('0x48')](_0x30c5e4['body'],{})[_0x2112('0x23')](respondWithResult(_0x52428e,0xc9))[_0x2112('0x43')](handleError(_0x52428e,null));};exports['update']=function(_0x15edd9,_0x3ac54c){if(_0x15edd9[_0x2112('0x49')]['id']){delete _0x15edd9[_0x2112('0x49')]['id'];}return db[_0x2112('0x3f')]['find']({'where':{'id':_0x15edd9[_0x2112('0x44')]['id']}})[_0x2112('0x23')](handleEntityNotFound(_0x3ac54c,null))['then'](saveUpdates(_0x15edd9['body'],null))[_0x2112('0x23')](respondWithResult(_0x3ac54c,null))[_0x2112('0x43')](handleError(_0x3ac54c,null));};exports[_0x2112('0x24')]=function(_0x9a815d,_0x30d0b3){return db[_0x2112('0x3f')][_0x2112('0x47')]({'where':{'id':_0x9a815d[_0x2112('0x44')]['id']}})['then'](handleEntityNotFound(_0x30d0b3,null))['then'](removeEntity(_0x30d0b3,null))['catch'](handleError(_0x30d0b3,null));};exports[_0x2112('0x4a')]=function(_0x222bf9,_0x309271){return db[_0x2112('0x3f')][_0x2112('0x4a')]()[_0x2112('0x23')](respondWithResult(_0x309271,null))[_0x2112('0x43')](handleError(_0x309271,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index cc0a502..136d08d 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 _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x821251,_0x3e9f92){var _0x3d1154=function(_0x229c35){while(--_0x229c35){_0x821251['push'](_0x821251['shift']());}};_0x3d1154(++_0x3e9f92);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xb7e7=['../../config/logger','moment','request-promise','rimraf','../../config/environment','./chatQueueReport.attributes','define','ChatQueueReport','uniqueid','lodash'];(function(_0x2f7251,_0x5232da){var _0x23c782=function(_0x655aa){while(--_0x655aa){_0x2f7251['push'](_0x2f7251['shift']());}};_0x23c782(++_0x5232da);}(_0xb7e7,0x121));var _0x7b7e=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0xb7e7[_0x4b2863];return _0x567d67;};'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':'report_chat_queue','paranoid':![],'indexes':[{'name':_0x7b7e('0x9'),'fields':[_0x7b7e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 578fc97..c946634 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 _0x3aa9=['../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','ChatQueueReport,\x20%s,\x20%s','request\x20sent','debug','ChatQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','ChatQueueReport','create','body','options','raw','CreateChatQueueReport','UpdateChatQueueReport','where','attributes','limit','lodash','util','bluebird','randomstring','ioredis'];(function(_0x479684,_0x3172ff){var _0x539c93=function(_0x45b769){while(--_0x45b769){_0x479684['push'](_0x479684['shift']());}};_0x539c93(++_0x3172ff);}(_0x3aa9,0xfb));var _0x93aa=function(_0x11d90c,_0x3abfa8){_0x11d90c=_0x11d90c-0x0;var _0x2fc6a0=_0x3aa9[_0x11d90c];return _0x2fc6a0;};'use strict';var _=require(_0x93aa('0x0'));var util=require(_0x93aa('0x1'));var moment=require('moment');var BPromise=require(_0x93aa('0x2'));var rs=require(_0x93aa('0x3'));var fs=require('fs');var Redis=require(_0x93aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x93aa('0x5'));var logger=require(_0x93aa('0x6'))(_0x93aa('0x7'));var config=require('../../config/environment');var jayson=require(_0x93aa('0x8'));var client=jayson[_0x93aa('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1375b2,_0x4b7ed6,_0x326308){return new BPromise(function(_0xdb1599,_0x33b42a){return client[_0x93aa('0xa')](_0x1375b2,_0x326308)[_0x93aa('0xb')](function(_0x50ad91){logger['info'](_0x93aa('0xc'),_0x4b7ed6,_0x93aa('0xd'));logger[_0x93aa('0xe')](_0x93aa('0xf'),_0x4b7ed6,_0x93aa('0xd'),JSON[_0x93aa('0x10')](_0x50ad91));if(_0x50ad91[_0x93aa('0x11')]){if(_0x50ad91[_0x93aa('0x11')]['code']===0x1f4){logger['error'](_0x93aa('0xc'),_0x4b7ed6,_0x50ad91[_0x93aa('0x11')]['message']);return _0x33b42a(_0x50ad91[_0x93aa('0x11')][_0x93aa('0x12')]);}logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x4b7ed6,_0x50ad91[_0x93aa('0x11')]['message']);return _0xdb1599(_0x50ad91[_0x93aa('0x11')][_0x93aa('0x12')]);}else{logger[_0x93aa('0x13')](_0x93aa('0xc'),_0x4b7ed6,_0x93aa('0xd'));_0xdb1599(_0x50ad91[_0x93aa('0x14')][_0x93aa('0x12')]);}})[_0x93aa('0x15')](function(_0x294b12){logger[_0x93aa('0x11')](_0x93aa('0xc'),_0x4b7ed6,_0x294b12);_0x33b42a(_0x294b12);});});}exports['CreateChatQueueReport']=function(_0x59eddc){var _0x4bbdfb=this;return new Promise(function(_0x29dfeb,_0x10bbca){return db[_0x93aa('0x16')][_0x93aa('0x17')](_0x59eddc[_0x93aa('0x18')],{'raw':_0x59eddc['options']?_0x59eddc[_0x93aa('0x19')][_0x93aa('0x1a')]===undefined?!![]:![]:!![]})[_0x93aa('0xb')](function(_0x382747){logger[_0x93aa('0x13')](_0x93aa('0x1b'),_0x59eddc);logger[_0x93aa('0xe')](_0x93aa('0x1b'),_0x59eddc,JSON[_0x93aa('0x10')](_0x382747));_0x29dfeb(_0x382747);})[_0x93aa('0x15')](function(_0x3ae7f4){logger[_0x93aa('0x11')](_0x93aa('0x1b'),_0x3ae7f4[_0x93aa('0x12')],_0x59eddc);_0x10bbca(_0x4bbdfb[_0x93aa('0x11')](0x1f4,_0x3ae7f4['message']));});});};exports[_0x93aa('0x1c')]=function(_0x13ae03){var _0x5c75bd=this;return new Promise(function(_0x2f367c,_0x38dbde){return db['ChatQueueReport']['update'](_0x13ae03[_0x93aa('0x18')],{'raw':_0x13ae03[_0x93aa('0x19')]?_0x13ae03['options'][_0x93aa('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x13ae03['options']?_0x13ae03[_0x93aa('0x19')][_0x93aa('0x1d')]||null:null,'attributes':_0x13ae03[_0x93aa('0x19')]?_0x13ae03['options'][_0x93aa('0x1e')]||null:null,'limit':_0x13ae03[_0x93aa('0x19')]?_0x13ae03[_0x93aa('0x19')][_0x93aa('0x1f')]||null:null})[_0x93aa('0xb')](function(_0x248f74){logger[_0x93aa('0x13')](_0x93aa('0x1c'),_0x13ae03);logger['debug'](_0x93aa('0x1c'),_0x13ae03,JSON[_0x93aa('0x10')](_0x248f74));_0x2f367c(_0x248f74);})[_0x93aa('0x15')](function(_0x40b219){logger[_0x93aa('0x11')](_0x93aa('0x1c'),_0x40b219[_0x93aa('0x12')],_0x13ae03);_0x38dbde(_0x5c75bd[_0x93aa('0x11')](0x1f4,_0x40b219[_0x93aa('0x12')]));});});}; \ No newline at end of file +var _0xe25b=['info','ChatQueueReport,\x20%s,\x20%s','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','catch','CreateChatQueueReport','ChatQueueReport','body','options','then','UpdateChatQueueReport','where','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','request'];(function(_0x408b34,_0xb7d872){var _0x1182aa=function(_0x1825c4){while(--_0x1825c4){_0x408b34['push'](_0x408b34['shift']());}};_0x1182aa(++_0xb7d872);}(_0xe25b,0x129));var _0xbe25=function(_0x2f4d7f,_0x62f4b7){_0x2f4d7f=_0x2f4d7f-0x0;var _0x147ba1=_0xe25b[_0x2f4d7f];return _0x147ba1;};'use strict';var _=require(_0xbe25('0x0'));var util=require(_0xbe25('0x1'));var moment=require(_0xbe25('0x2'));var BPromise=require(_0xbe25('0x3'));var rs=require(_0xbe25('0x4'));var fs=require('fs');var Redis=require(_0xbe25('0x5'));var db=require(_0xbe25('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0xbe25('0x7'))('rpc');var config=require(_0xbe25('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xbe25('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2c659c,_0x3d7a03,_0x335454){return new BPromise(function(_0x4d33db,_0x2ba149){return client[_0xbe25('0xa')](_0x2c659c,_0x335454)['then'](function(_0x4bb6b5){logger[_0xbe25('0xb')](_0xbe25('0xc'),_0x3d7a03,'request\x20sent');logger['debug'](_0xbe25('0xd'),_0x3d7a03,_0xbe25('0xe'),JSON[_0xbe25('0xf')](_0x4bb6b5));if(_0x4bb6b5[_0xbe25('0x10')]){if(_0x4bb6b5[_0xbe25('0x10')]['code']===0x1f4){logger[_0xbe25('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x3d7a03,_0x4bb6b5[_0xbe25('0x10')][_0xbe25('0x11')]);return _0x2ba149(_0x4bb6b5['error'][_0xbe25('0x11')]);}logger[_0xbe25('0x10')](_0xbe25('0xc'),_0x3d7a03,_0x4bb6b5[_0xbe25('0x10')][_0xbe25('0x11')]);return _0x4d33db(_0x4bb6b5[_0xbe25('0x10')][_0xbe25('0x11')]);}else{logger['info'](_0xbe25('0xc'),_0x3d7a03,'request\x20sent');_0x4d33db(_0x4bb6b5['result'][_0xbe25('0x11')]);}})[_0xbe25('0x12')](function(_0x401bc3){logger[_0xbe25('0x10')](_0xbe25('0xc'),_0x3d7a03,_0x401bc3);_0x2ba149(_0x401bc3);});});}exports[_0xbe25('0x13')]=function(_0x218e63){var _0x193b54=this;return new Promise(function(_0x43d26e,_0x45cb9b){return db[_0xbe25('0x14')]['create'](_0x218e63[_0xbe25('0x15')],{'raw':_0x218e63[_0xbe25('0x16')]?_0x218e63[_0xbe25('0x16')]['raw']===undefined?!![]:![]:!![]})[_0xbe25('0x17')](function(_0x5bf982){logger[_0xbe25('0xb')]('CreateChatQueueReport',_0x218e63);logger['debug'](_0xbe25('0x13'),_0x218e63,JSON['stringify'](_0x5bf982));_0x43d26e(_0x5bf982);})[_0xbe25('0x12')](function(_0xc2a1cd){logger['error'](_0xbe25('0x13'),_0xc2a1cd[_0xbe25('0x11')],_0x218e63);_0x45cb9b(_0x193b54[_0xbe25('0x10')](0x1f4,_0xc2a1cd[_0xbe25('0x11')]));});});};exports[_0xbe25('0x18')]=function(_0x58e193){var _0x146b8b=this;return new Promise(function(_0x44f7b8,_0x2ab603){return db[_0xbe25('0x14')]['update'](_0x58e193[_0xbe25('0x15')],{'raw':_0x58e193[_0xbe25('0x16')]?_0x58e193[_0xbe25('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58e193[_0xbe25('0x16')]?_0x58e193[_0xbe25('0x16')][_0xbe25('0x19')]||null:null,'attributes':_0x58e193[_0xbe25('0x16')]?_0x58e193[_0xbe25('0x16')][_0xbe25('0x1a')]||null:null,'limit':_0x58e193[_0xbe25('0x16')]?_0x58e193['options'][_0xbe25('0x1b')]||null:null})[_0xbe25('0x17')](function(_0xe2dca6){logger[_0xbe25('0xb')]('UpdateChatQueueReport',_0x58e193);logger['debug'](_0xbe25('0x18'),_0x58e193,JSON[_0xbe25('0xf')](_0xe2dca6));_0x44f7b8(_0xe2dca6);})['catch'](function(_0x9f7120){logger[_0xbe25('0x10')](_0xbe25('0x18'),_0x9f7120[_0xbe25('0x11')],_0x58e193);_0x2ab603(_0x146b8b[_0xbe25('0x10')](0x1f4,_0x9f7120['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 1665e09..01f2c52 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 _0xb711=['/:id','put','update','delete','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','get','isAuthenticated','index','/describe'];(function(_0x4de5b6,_0x5cd845){var _0xc24eb1=function(_0x5bfa42){while(--_0x5bfa42){_0x4de5b6['push'](_0x4de5b6['shift']());}};_0xc24eb1(++_0x5cd845);}(_0xb711,0x103));var _0x1b71=function(_0x3ee4b7,_0x588719){_0x3ee4b7=_0x3ee4b7-0x0;var _0x1d3407=_0xb711[_0x3ee4b7];return _0x1d3407;};'use strict';var multer=require(_0x1b71('0x0'));var util=require(_0x1b71('0x1'));var path=require(_0x1b71('0x2'));var timeout=require(_0x1b71('0x3'));var express=require(_0x1b71('0x4'));var router=express[_0x1b71('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b71('0x6'));var config=require('../../config/environment');var controller=require('./chatQueueReport.controller');router[_0x1b71('0x7')]('/',auth[_0x1b71('0x8')](),controller[_0x1b71('0x9')]);router[_0x1b71('0x7')](_0x1b71('0xa'),auth[_0x1b71('0x8')](),controller['describe']);router[_0x1b71('0x7')](_0x1b71('0xb'),auth[_0x1b71('0x8')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x1b71('0xc')](_0x1b71('0xb'),auth[_0x1b71('0x8')](),controller[_0x1b71('0xd')]);router[_0x1b71('0xe')](_0x1b71('0xb'),auth[_0x1b71('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x8c05=['get','isAuthenticated','index','/describe','describe','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./chatQueueReport.controller'];(function(_0x2a71b1,_0x3644f8){var _0x4ae8a3=function(_0x20718f){while(--_0x20718f){_0x2a71b1['push'](_0x2a71b1['shift']());}};_0x4ae8a3(++_0x3644f8);}(_0x8c05,0x12b));var _0x58c0=function(_0x47aca7,_0x146518){_0x47aca7=_0x47aca7-0x0;var _0x524aef=_0x8c05[_0x47aca7];return _0x524aef;};'use strict';var multer=require(_0x58c0('0x0'));var util=require(_0x58c0('0x1'));var path=require(_0x58c0('0x2'));var timeout=require(_0x58c0('0x3'));var express=require(_0x58c0('0x4'));var router=express['Router']();var fs_extra=require(_0x58c0('0x5'));var auth=require(_0x58c0('0x6'));var interaction=require(_0x58c0('0x7'));var config=require('../../config/environment');var controller=require(_0x58c0('0x8'));router[_0x58c0('0x9')]('/',auth[_0x58c0('0xa')](),controller[_0x58c0('0xb')]);router[_0x58c0('0x9')](_0x58c0('0xc'),auth[_0x58c0('0xa')](),controller[_0x58c0('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x58c0('0xe')]);router[_0x58c0('0xf')]('/',auth[_0x58c0('0xa')](),controller['create']);router[_0x58c0('0x10')](_0x58c0('0x11'),auth[_0x58c0('0xa')](),controller[_0x58c0('0x12')]);router[_0x58c0('0x13')](_0x58c0('0x11'),auth['isAuthenticated'](),controller[_0x58c0('0x14')]);module[_0x58c0('0x15')]=router; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.attributes.js b/server/api/chatTransferReport/chatTransferReport.attributes.js index 3fb3b88..8861b89 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x23c559,_0x1415fe){var _0xd63e89=function(_0x58a527){while(--_0x58a527){_0x23c559['push'](_0x23c559['shift']());}};_0xd63e89(++_0x1415fe);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x3db0ba,_0x2be65c){_0x3db0ba=_0x3db0ba-0x0;var _0x2d8e9a=_0xf3cd[_0x3db0ba];return _0x2d8e9a;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x9c44=['ENUM','account','agent','queue','NOW','exports','STRING'];(function(_0x22a75f,_0xf98f1f){var _0x583584=function(_0x48a6cc){while(--_0x48a6cc){_0x22a75f['push'](_0x22a75f['shift']());}};_0x583584(++_0xf98f1f);}(_0x9c44,0x178));var _0x49c4=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x9c44[_0x68c979];return _0x4f0001;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x49c4('0x0')]={'uniqueid':{'type':Sequelize[_0x49c4('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x49c4('0x2')](_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x49c4('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index ef6990a..665ab87 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 _0x1161=['eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','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','../../config/license/util','sendStatus','status','end','offset','undefined','count','limit','Content-Range','apply','save','update','then','name','index','fieldName','type','map','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','ChatTransferReport','includeAll','include','findAll','catch','params','options','find','create','body','destroy','describe'];(function(_0x6bae35,_0x34dd88){var _0x26ad9d=function(_0x27dc69){while(--_0x27dc69){_0x6bae35['push'](_0x6bae35['shift']());}};_0x26ad9d(++_0x34dd88);}(_0x1161,0xd2));var _0x1116=function(_0x2ad574,_0x11dc97){_0x2ad574=_0x2ad574-0x0;var _0x3f61d0=_0x1161[_0x2ad574];return _0x3f61d0;};'use strict';var emlformat=require(_0x1116('0x0'));var rimraf=require(_0x1116('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1116('0x2'));var rp=require(_0x1116('0x3'));var moment=require(_0x1116('0x4'));var BPromise=require(_0x1116('0x5'));var Mustache=require('mustache');var util=require(_0x1116('0x6'));var path=require(_0x1116('0x7'));var sox=require(_0x1116('0x8'));var csv=require(_0x1116('0x9'));var ejs=require(_0x1116('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x1116('0xb'));var squel=require(_0x1116('0xc'));var crypto=require(_0x1116('0xd'));var jsforce=require(_0x1116('0xe'));var deskjs=require(_0x1116('0xf'));var toCsv=require('to-csv');var querystring=require(_0x1116('0x10'));var Papa=require('papaparse');var Redis=require(_0x1116('0x11'));var authService=require(_0x1116('0x12'));var qs=require(_0x1116('0x13'));var as=require(_0x1116('0x14'));var hardwareService=require(_0x1116('0x15'));var logger=require(_0x1116('0x16'))(_0x1116('0x17'));var utils=require(_0x1116('0x18'));var config=require(_0x1116('0x19'));var licenseUtil=require(_0x1116('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x180400,_0x5bcffa){_0x5bcffa=_0x5bcffa||0xcc;return function(_0xca6b9a){if(_0xca6b9a){return _0x180400[_0x1116('0x1b')](_0x5bcffa);}return _0x180400[_0x1116('0x1c')](_0x5bcffa)[_0x1116('0x1d')]();};}function respondWithResult(_0x3137d9,_0x1c0d1a){_0x1c0d1a=_0x1c0d1a||0xc8;return function(_0x4db6a4){if(_0x4db6a4){return _0x3137d9[_0x1116('0x1c')](_0x1c0d1a)['json'](_0x4db6a4);}};}function respondWithFilteredResult(_0x326d71,_0xa9d314){return function(_0x348b31){if(_0x348b31){var _0x3bab30=typeof _0xa9d314[_0x1116('0x1e')]==='undefined'&&typeof _0xa9d314['limit']===_0x1116('0x1f');var _0x586858=_0x348b31[_0x1116('0x20')];var _0x56df17=_0x3bab30?0x0:_0xa9d314[_0x1116('0x1e')];var _0x45e0da=_0x3bab30?_0x348b31['count']:_0xa9d314[_0x1116('0x1e')]+_0xa9d314[_0x1116('0x21')];var _0x3e632e;if(_0x45e0da>=_0x586858){_0x45e0da=_0x586858;_0x3e632e=0xc8;}else{_0x3e632e=0xce;}_0x326d71[_0x1116('0x1c')](_0x3e632e);return _0x326d71['set'](_0x1116('0x22'),_0x56df17+'-'+_0x45e0da+'/'+_0x586858)['json'](_0x348b31);}return null;};}function patchUpdates(_0x3b26c4){return function(_0x5d5041){try{jsonpatch[_0x1116('0x23')](_0x5d5041,_0x3b26c4,!![]);}catch(_0x5a4aee){return BPromise['reject'](_0x5a4aee);}return _0x5d5041[_0x1116('0x24')]();};}function saveUpdates(_0x249bd0,_0x1e73e9){return function(_0x7f1c9){if(_0x7f1c9){return _0x7f1c9[_0x1116('0x25')](_0x249bd0)['then'](function(_0x5a792d){return _0x5a792d;});}return null;};}function removeEntity(_0x1b2a5c,_0x4cb87c){return function(_0x330178){if(_0x330178){return _0x330178['destroy']()[_0x1116('0x26')](function(){_0x1b2a5c[_0x1116('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x387944,_0x277ac4){return function(_0x11b8b1){if(!_0x11b8b1){_0x387944['sendStatus'](0x194);}return _0x11b8b1;};}function handleError(_0x2ef9ef,_0x5b83ae){_0x5b83ae=_0x5b83ae||0x1f4;return function(_0x787d4d){logger['error'](_0x787d4d['stack']);if(_0x787d4d[_0x1116('0x27')]){delete _0x787d4d[_0x1116('0x27')];}_0x2ef9ef[_0x1116('0x1c')](_0x5b83ae)['send'](_0x787d4d);};}exports[_0x1116('0x28')]=function(_0x99713a,_0x55456e){var _0x4276be={},_0x5f3c07={},_0x4d1623={'count':0x0,'rows':[]};var _0x51a3b4=_['map'](db['ChatTransferReport']['rawAttributes'],function(_0x188565){return{'name':_0x188565[_0x1116('0x29')],'type':_0x188565[_0x1116('0x2a')]['key']};});_0x5f3c07['model']=_[_0x1116('0x2b')](_0x51a3b4,_0x1116('0x27'));_0x5f3c07[_0x1116('0x2c')]=_[_0x1116('0x2d')](_0x99713a[_0x1116('0x2c')]);_0x5f3c07[_0x1116('0x2e')]=_['intersection'](_0x5f3c07[_0x1116('0x2f')],_0x5f3c07[_0x1116('0x2c')]);_0x4276be[_0x1116('0x30')]=_[_0x1116('0x31')](_0x5f3c07[_0x1116('0x2f')],qs[_0x1116('0x32')](_0x99713a[_0x1116('0x2c')][_0x1116('0x32')]));_0x4276be[_0x1116('0x30')]=_0x4276be[_0x1116('0x30')][_0x1116('0x33')]?_0x4276be[_0x1116('0x30')]:_0x5f3c07[_0x1116('0x2f')];if(!_0x99713a[_0x1116('0x2c')][_0x1116('0x34')]('nolimit')){_0x4276be[_0x1116('0x21')]=qs['limit'](_0x99713a['query'][_0x1116('0x21')]);_0x4276be[_0x1116('0x1e')]=qs[_0x1116('0x1e')](_0x99713a[_0x1116('0x2c')][_0x1116('0x1e')]);}_0x4276be[_0x1116('0x35')]=qs[_0x1116('0x36')](_0x99713a[_0x1116('0x2c')][_0x1116('0x36')]);_0x4276be[_0x1116('0x37')]=qs[_0x1116('0x2e')](_['pick'](_0x99713a[_0x1116('0x2c')],_0x5f3c07[_0x1116('0x2e')]),_0x51a3b4);if(_0x99713a[_0x1116('0x2c')][_0x1116('0x38')]){_0x4276be[_0x1116('0x37')]=_[_0x1116('0x39')](_0x4276be[_0x1116('0x37')],{'$or':_[_0x1116('0x2b')](_0x51a3b4,function(_0x4049b2){if(_0x4049b2[_0x1116('0x2a')]!=='VIRTUAL'){var _0x524f6d={};_0x524f6d[_0x4049b2[_0x1116('0x27')]]={'$like':'%'+_0x99713a['query'][_0x1116('0x38')]+'%'};return _0x524f6d;}})});}_0x4276be=_['merge']({},_0x4276be,_0x99713a['options']);var _0x68bc54={'where':_0x4276be[_0x1116('0x37')]};return db[_0x1116('0x3a')][_0x1116('0x20')](_0x68bc54)[_0x1116('0x26')](function(_0x205d25){_0x4d1623['count']=_0x205d25;if(_0x99713a[_0x1116('0x2c')][_0x1116('0x3b')]){_0x4276be[_0x1116('0x3c')]=[{'all':!![]}];}return db[_0x1116('0x3a')][_0x1116('0x3d')](_0x4276be);})[_0x1116('0x26')](function(_0x1b6ee7){_0x4d1623['rows']=_0x1b6ee7;return _0x4d1623;})['then'](respondWithFilteredResult(_0x55456e,_0x4276be))[_0x1116('0x3e')](handleError(_0x55456e,null));};exports['show']=function(_0x27e123,_0x2e1286){var _0x281dc6={'raw':!![],'where':{'id':_0x27e123[_0x1116('0x3f')]['id']}},_0x923420={};_0x923420[_0x1116('0x2f')]=_[_0x1116('0x2d')](db['ChatTransferReport']['rawAttributes']);_0x923420[_0x1116('0x2c')]=_['keys'](_0x27e123['query']);_0x923420['filters']=_[_0x1116('0x31')](_0x923420['model'],_0x923420[_0x1116('0x2c')]);_0x281dc6[_0x1116('0x30')]=_[_0x1116('0x31')](_0x923420['model'],qs[_0x1116('0x32')](_0x27e123[_0x1116('0x2c')]['fields']));_0x281dc6[_0x1116('0x30')]=_0x281dc6[_0x1116('0x30')][_0x1116('0x33')]?_0x281dc6[_0x1116('0x30')]:_0x923420[_0x1116('0x2f')];if(_0x27e123[_0x1116('0x2c')]['includeAll']){_0x281dc6['include']=[{'all':!![]}];}_0x281dc6=_[_0x1116('0x39')]({},_0x281dc6,_0x27e123[_0x1116('0x40')]);return db['ChatTransferReport'][_0x1116('0x41')](_0x281dc6)[_0x1116('0x26')](handleEntityNotFound(_0x2e1286,null))[_0x1116('0x26')](respondWithResult(_0x2e1286,null))[_0x1116('0x3e')](handleError(_0x2e1286,null));};exports['create']=function(_0xc57ded,_0x346d32){return db[_0x1116('0x3a')][_0x1116('0x42')](_0xc57ded[_0x1116('0x43')],{})[_0x1116('0x26')](respondWithResult(_0x346d32,0xc9))[_0x1116('0x3e')](handleError(_0x346d32,null));};exports[_0x1116('0x25')]=function(_0x4f7b3b,_0x5647b8){if(_0x4f7b3b[_0x1116('0x43')]['id']){delete _0x4f7b3b[_0x1116('0x43')]['id'];}return db[_0x1116('0x3a')]['find']({'where':{'id':_0x4f7b3b[_0x1116('0x3f')]['id']}})['then'](handleEntityNotFound(_0x5647b8,null))[_0x1116('0x26')](saveUpdates(_0x4f7b3b[_0x1116('0x43')],null))[_0x1116('0x26')](respondWithResult(_0x5647b8,null))['catch'](handleError(_0x5647b8,null));};exports[_0x1116('0x44')]=function(_0xf38907,_0x1e6ce8){return db[_0x1116('0x3a')][_0x1116('0x41')]({'where':{'id':_0xf38907[_0x1116('0x3f')]['id']}})[_0x1116('0x26')](handleEntityNotFound(_0x1e6ce8,null))[_0x1116('0x26')](removeEntity(_0x1e6ce8,null))[_0x1116('0x3e')](handleError(_0x1e6ce8,null));};exports[_0x1116('0x45')]=function(_0x2e0351,_0x59f3f6){return db[_0x1116('0x3a')][_0x1116('0x45')]()[_0x1116('0x26')](respondWithResult(_0x59f3f6,null))[_0x1116('0x3e')](handleError(_0x59f3f6,null));}; \ No newline at end of file +var _0xe8ab=['update','then','destroy','status','error','name','send','index','ChatTransferReport','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','merge','VIRTUAL','options','includeAll','include','catch','show','params','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','count','set','Content-Range','apply','reject','save'];(function(_0xabfec4,_0x35076e){var _0x7bafa2=function(_0x52d551){while(--_0x52d551){_0xabfec4['push'](_0xabfec4['shift']());}};_0x7bafa2(++_0x35076e);}(_0xe8ab,0x104));var _0xbe8a=function(_0x1dc681,_0x7e1065){_0x1dc681=_0x1dc681-0x0;var _0x5c6937=_0xe8ab[_0x1dc681];return _0x5c6937;};'use strict';var emlformat=require(_0xbe8a('0x0'));var rimraf=require(_0xbe8a('0x1'));var zipdir=require(_0xbe8a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbe8a('0x3'));var moment=require(_0xbe8a('0x4'));var BPromise=require(_0xbe8a('0x5'));var Mustache=require(_0xbe8a('0x6'));var util=require(_0xbe8a('0x7'));var path=require(_0xbe8a('0x8'));var sox=require('sox');var csv=require(_0xbe8a('0x9'));var ejs=require(_0xbe8a('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbe8a('0xb'));var deskjs=require(_0xbe8a('0xc'));var toCsv=require('to-csv');var querystring=require(_0xbe8a('0xd'));var Papa=require(_0xbe8a('0xe'));var Redis=require(_0xbe8a('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xbe8a('0x10'));var as=require(_0xbe8a('0x11'));var hardwareService=require(_0xbe8a('0x12'));var logger=require(_0xbe8a('0x13'))(_0xbe8a('0x14'));var utils=require(_0xbe8a('0x15'));var config=require(_0xbe8a('0x16'));var licenseUtil=require(_0xbe8a('0x17'));var db=require(_0xbe8a('0x18'))['db'];function respondWithStatusCode(_0x459563,_0x41cd58){_0x41cd58=_0x41cd58||0xcc;return function(_0x59b40){if(_0x59b40){return _0x459563[_0xbe8a('0x19')](_0x41cd58);}return _0x459563['status'](_0x41cd58)[_0xbe8a('0x1a')]();};}function respondWithResult(_0x45b0ef,_0x527b87){_0x527b87=_0x527b87||0xc8;return function(_0x3f0a59){if(_0x3f0a59){return _0x45b0ef['status'](_0x527b87)[_0xbe8a('0x1b')](_0x3f0a59);}};}function respondWithFilteredResult(_0x232b33,_0x5f3bc8){return function(_0x15e622){if(_0x15e622){var _0x3240e9=typeof _0x5f3bc8[_0xbe8a('0x1c')]==='undefined'&&typeof _0x5f3bc8[_0xbe8a('0x1d')]==='undefined';var _0x43367a=_0x15e622[_0xbe8a('0x1e')];var _0x29dc8e=_0x3240e9?0x0:_0x5f3bc8[_0xbe8a('0x1c')];var _0x383751=_0x3240e9?_0x15e622[_0xbe8a('0x1e')]:_0x5f3bc8['offset']+_0x5f3bc8[_0xbe8a('0x1d')];var _0x2ff151;if(_0x383751>=_0x43367a){_0x383751=_0x43367a;_0x2ff151=0xc8;}else{_0x2ff151=0xce;}_0x232b33['status'](_0x2ff151);return _0x232b33[_0xbe8a('0x1f')](_0xbe8a('0x20'),_0x29dc8e+'-'+_0x383751+'/'+_0x43367a)[_0xbe8a('0x1b')](_0x15e622);}return null;};}function patchUpdates(_0x235531){return function(_0x383a58){try{jsonpatch[_0xbe8a('0x21')](_0x383a58,_0x235531,!![]);}catch(_0x461596){return BPromise[_0xbe8a('0x22')](_0x461596);}return _0x383a58[_0xbe8a('0x23')]();};}function saveUpdates(_0x41c2fd,_0x1941e5){return function(_0x28aa46){if(_0x28aa46){return _0x28aa46[_0xbe8a('0x24')](_0x41c2fd)[_0xbe8a('0x25')](function(_0x3d0e29){return _0x3d0e29;});}return null;};}function removeEntity(_0x344312,_0x4c59a6){return function(_0x568c92){if(_0x568c92){return _0x568c92[_0xbe8a('0x26')]()['then'](function(){_0x344312[_0xbe8a('0x27')](0xcc)[_0xbe8a('0x1a')]();});}};}function handleEntityNotFound(_0x593d03,_0x279089){return function(_0x517539){if(!_0x517539){_0x593d03[_0xbe8a('0x19')](0x194);}return _0x517539;};}function handleError(_0x476357,_0x7df02f){_0x7df02f=_0x7df02f||0x1f4;return function(_0x358d82){logger[_0xbe8a('0x28')](_0x358d82['stack']);if(_0x358d82['name']){delete _0x358d82[_0xbe8a('0x29')];}_0x476357[_0xbe8a('0x27')](_0x7df02f)[_0xbe8a('0x2a')](_0x358d82);};}exports[_0xbe8a('0x2b')]=function(_0x26f96e,_0x199902){var _0xd58eab={},_0x3822b1={},_0x1be766={'count':0x0,'rows':[]};var _0x51a3f5=_['map'](db[_0xbe8a('0x2c')][_0xbe8a('0x2d')],function(_0x1d20b8){return{'name':_0x1d20b8[_0xbe8a('0x2e')],'type':_0x1d20b8[_0xbe8a('0x2f')][_0xbe8a('0x30')]};});_0x3822b1[_0xbe8a('0x31')]=_[_0xbe8a('0x32')](_0x51a3f5,_0xbe8a('0x29'));_0x3822b1[_0xbe8a('0x33')]=_[_0xbe8a('0x34')](_0x26f96e[_0xbe8a('0x33')]);_0x3822b1[_0xbe8a('0x35')]=_[_0xbe8a('0x36')](_0x3822b1[_0xbe8a('0x31')],_0x3822b1[_0xbe8a('0x33')]);_0xd58eab['attributes']=_[_0xbe8a('0x36')](_0x3822b1[_0xbe8a('0x31')],qs[_0xbe8a('0x37')](_0x26f96e[_0xbe8a('0x33')][_0xbe8a('0x37')]));_0xd58eab['attributes']=_0xd58eab[_0xbe8a('0x38')]['length']?_0xd58eab[_0xbe8a('0x38')]:_0x3822b1['model'];if(!_0x26f96e[_0xbe8a('0x33')][_0xbe8a('0x39')]('nolimit')){_0xd58eab[_0xbe8a('0x1d')]=qs['limit'](_0x26f96e[_0xbe8a('0x33')][_0xbe8a('0x1d')]);_0xd58eab[_0xbe8a('0x1c')]=qs['offset'](_0x26f96e[_0xbe8a('0x33')][_0xbe8a('0x1c')]);}_0xd58eab[_0xbe8a('0x3a')]=qs['sort'](_0x26f96e['query'][_0xbe8a('0x3b')]);_0xd58eab[_0xbe8a('0x3c')]=qs[_0xbe8a('0x35')](_['pick'](_0x26f96e['query'],_0x3822b1[_0xbe8a('0x35')]),_0x51a3f5);if(_0x26f96e[_0xbe8a('0x33')]['filter']){_0xd58eab[_0xbe8a('0x3c')]=_[_0xbe8a('0x3d')](_0xd58eab[_0xbe8a('0x3c')],{'$or':_[_0xbe8a('0x32')](_0x51a3f5,function(_0x48cb43){if(_0x48cb43[_0xbe8a('0x2f')]!==_0xbe8a('0x3e')){var _0x227c34={};_0x227c34[_0x48cb43[_0xbe8a('0x29')]]={'$like':'%'+_0x26f96e['query']['filter']+'%'};return _0x227c34;}})});}_0xd58eab=_[_0xbe8a('0x3d')]({},_0xd58eab,_0x26f96e[_0xbe8a('0x3f')]);var _0x4b812b={'where':_0xd58eab[_0xbe8a('0x3c')]};return db[_0xbe8a('0x2c')]['count'](_0x4b812b)[_0xbe8a('0x25')](function(_0x48c3d4){_0x1be766[_0xbe8a('0x1e')]=_0x48c3d4;if(_0x26f96e[_0xbe8a('0x33')][_0xbe8a('0x40')]){_0xd58eab[_0xbe8a('0x41')]=[{'all':!![]}];}return db[_0xbe8a('0x2c')]['findAll'](_0xd58eab);})[_0xbe8a('0x25')](function(_0x1112df){_0x1be766['rows']=_0x1112df;return _0x1be766;})[_0xbe8a('0x25')](respondWithFilteredResult(_0x199902,_0xd58eab))[_0xbe8a('0x42')](handleError(_0x199902,null));};exports[_0xbe8a('0x43')]=function(_0x124d10,_0x54b810){var _0x2a1618={'raw':!![],'where':{'id':_0x124d10[_0xbe8a('0x44')]['id']}},_0x55b1a2={};_0x55b1a2['model']=_[_0xbe8a('0x34')](db[_0xbe8a('0x2c')][_0xbe8a('0x2d')]);_0x55b1a2[_0xbe8a('0x33')]=_[_0xbe8a('0x34')](_0x124d10[_0xbe8a('0x33')]);_0x55b1a2[_0xbe8a('0x35')]=_[_0xbe8a('0x36')](_0x55b1a2[_0xbe8a('0x31')],_0x55b1a2[_0xbe8a('0x33')]);_0x2a1618[_0xbe8a('0x38')]=_[_0xbe8a('0x36')](_0x55b1a2['model'],qs[_0xbe8a('0x37')](_0x124d10[_0xbe8a('0x33')][_0xbe8a('0x37')]));_0x2a1618[_0xbe8a('0x38')]=_0x2a1618['attributes'][_0xbe8a('0x45')]?_0x2a1618[_0xbe8a('0x38')]:_0x55b1a2['model'];if(_0x124d10[_0xbe8a('0x33')][_0xbe8a('0x40')]){_0x2a1618[_0xbe8a('0x41')]=[{'all':!![]}];}_0x2a1618=_['merge']({},_0x2a1618,_0x124d10[_0xbe8a('0x3f')]);return db['ChatTransferReport'][_0xbe8a('0x46')](_0x2a1618)[_0xbe8a('0x25')](handleEntityNotFound(_0x54b810,null))[_0xbe8a('0x25')](respondWithResult(_0x54b810,null))[_0xbe8a('0x42')](handleError(_0x54b810,null));};exports['create']=function(_0x92a9bf,_0x24c764){return db[_0xbe8a('0x2c')][_0xbe8a('0x47')](_0x92a9bf[_0xbe8a('0x48')],{})[_0xbe8a('0x25')](respondWithResult(_0x24c764,0xc9))[_0xbe8a('0x42')](handleError(_0x24c764,null));};exports['update']=function(_0x4490e0,_0x2fbacb){if(_0x4490e0[_0xbe8a('0x48')]['id']){delete _0x4490e0[_0xbe8a('0x48')]['id'];}return db['ChatTransferReport'][_0xbe8a('0x46')]({'where':{'id':_0x4490e0['params']['id']}})[_0xbe8a('0x25')](handleEntityNotFound(_0x2fbacb,null))['then'](saveUpdates(_0x4490e0['body'],null))[_0xbe8a('0x25')](respondWithResult(_0x2fbacb,null))['catch'](handleError(_0x2fbacb,null));};exports[_0xbe8a('0x26')]=function(_0x4b6ee2,_0x273d22){return db[_0xbe8a('0x2c')][_0xbe8a('0x46')]({'where':{'id':_0x4b6ee2[_0xbe8a('0x44')]['id']}})[_0xbe8a('0x25')](handleEntityNotFound(_0x273d22,null))[_0xbe8a('0x25')](removeEntity(_0x273d22,null))[_0xbe8a('0x42')](handleError(_0x273d22,null));};exports['describe']=function(_0x393d66,_0x595c41){return db['ChatTransferReport'][_0xbe8a('0x49')]()[_0xbe8a('0x25')](respondWithResult(_0x595c41,null))[_0xbe8a('0x42')](handleError(_0x595c41,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index abec3e5..96327bb 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 _0x3d6e=['bluebird','request-promise','path','rimraf','../../config/environment','define','ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','moment'];(function(_0x292c2a,_0x5ce78f){var _0x1b4c78=function(_0x56a90b){while(--_0x56a90b){_0x292c2a['push'](_0x292c2a['shift']());}};_0x1b4c78(++_0x5ce78f);}(_0x3d6e,0x1b6));var _0xe3d6=function(_0x4ea69d,_0x290f53){_0x4ea69d=_0x4ea69d-0x0;var _0x5318e0=_0x3d6e[_0x4ea69d];return _0x5318e0;};'use strict';var _=require(_0xe3d6('0x0'));var util=require(_0xe3d6('0x1'));var logger=require(_0xe3d6('0x2'))('api');var moment=require(_0xe3d6('0x3'));var BPromise=require(_0xe3d6('0x4'));var rp=require(_0xe3d6('0x5'));var fs=require('fs');var path=require(_0xe3d6('0x6'));var rimraf=require(_0xe3d6('0x7'));var config=require(_0xe3d6('0x8'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x219b1e,_0x52c9b4){return _0x219b1e[_0xe3d6('0x9')](_0xe3d6('0xa'),attributes,{'tableName':_0xe3d6('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe3d6('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ff9=['report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./chatTransferReport.attributes','exports','ChatTransferReport'];(function(_0x34ff96,_0xe04dfb){var _0x43486e=function(_0x49dd6){while(--_0x49dd6){_0x34ff96['push'](_0x34ff96['shift']());}};_0x43486e(++_0xe04dfb);}(_0x5ff9,0x128));var _0x95ff=function(_0x486645,_0x268291){_0x486645=_0x486645-0x0;var _0x350c35=_0x5ff9[_0x486645];return _0x350c35;};'use strict';var _=require(_0x95ff('0x0'));var util=require(_0x95ff('0x1'));var logger=require(_0x95ff('0x2'))(_0x95ff('0x3'));var moment=require(_0x95ff('0x4'));var BPromise=require('bluebird');var rp=require(_0x95ff('0x5'));var fs=require('fs');var path=require(_0x95ff('0x6'));var rimraf=require(_0x95ff('0x7'));var config=require(_0x95ff('0x8'));var attributes=require(_0x95ff('0x9'));module[_0x95ff('0xa')]=function(_0x141ec3,_0x4419b5){return _0x141ec3['define'](_0x95ff('0xb'),attributes,{'tableName':_0x95ff('0xc'),'paranoid':![],'indexes':[{'name':_0x95ff('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index b5145ee..e472693 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 _0x4d1b=['debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0x4d1b,0x16c));var _0xb4d1=function(_0x504c88,_0x1c3016){_0x504c88=_0x504c88-0x0;var _0xb5611e=_0x4d1b[_0x504c88];return _0xb5611e;};'use strict';var _=require(_0xb4d1('0x0'));var util=require('util');var moment=require(_0xb4d1('0x1'));var BPromise=require('bluebird');var rs=require(_0xb4d1('0x2'));var fs=require('fs');var Redis=require(_0xb4d1('0x3'));var db=require(_0xb4d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb4d1('0x5'))(_0xb4d1('0x6'));var config=require(_0xb4d1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb4d1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x276f7e,_0x39ae65,_0x7c7ea1){return new BPromise(function(_0x32d8e2,_0x2e7573){return client[_0xb4d1('0x9')](_0x276f7e,_0x7c7ea1)[_0xb4d1('0xa')](function(_0x41905e){logger[_0xb4d1('0xb')](_0xb4d1('0xc'),_0x39ae65,_0xb4d1('0xd'));logger[_0xb4d1('0xe')](_0xb4d1('0xf'),_0x39ae65,'request\x20sent',JSON['stringify'](_0x41905e));if(_0x41905e['error']){if(_0x41905e[_0xb4d1('0x10')][_0xb4d1('0x11')]===0x1f4){logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x39ae65,_0x41905e[_0xb4d1('0x10')][_0xb4d1('0x12')]);return _0x2e7573(_0x41905e[_0xb4d1('0x10')][_0xb4d1('0x12')]);}logger['error']('ChatTransferReport,\x20%s,\x20%s',_0x39ae65,_0x41905e[_0xb4d1('0x10')][_0xb4d1('0x12')]);return _0x32d8e2(_0x41905e[_0xb4d1('0x10')][_0xb4d1('0x12')]);}else{logger[_0xb4d1('0xb')](_0xb4d1('0xc'),_0x39ae65,_0xb4d1('0xd'));_0x32d8e2(_0x41905e[_0xb4d1('0x13')][_0xb4d1('0x12')]);}})[_0xb4d1('0x14')](function(_0x2edc70){logger[_0xb4d1('0x10')](_0xb4d1('0xc'),_0x39ae65,_0x2edc70);_0x2e7573(_0x2edc70);});});} \ No newline at end of file +var _0xde01=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','ChatTransferReport,\x20%s,\x20%s','request\x20sent','debug','ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xde01,0x122));var _0x1de0=function(_0x1102fe,_0xc5d9ed){_0x1102fe=_0x1102fe-0x0;var _0x19c8f9=_0xde01[_0x1102fe];return _0x19c8f9;};'use strict';var _=require(_0x1de0('0x0'));var util=require(_0x1de0('0x1'));var moment=require(_0x1de0('0x2'));var BPromise=require(_0x1de0('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1de0('0x4'));var db=require(_0x1de0('0x5'))['db'];var utils=require(_0x1de0('0x6'));var logger=require(_0x1de0('0x7'))('rpc');var config=require(_0x1de0('0x8'));var jayson=require(_0x1de0('0x9'));var client=jayson['client'][_0x1de0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c9245,_0x39eb21,_0x46d6f9){return new BPromise(function(_0x825611,_0x39b5e4){return client[_0x1de0('0xb')](_0x2c9245,_0x46d6f9)[_0x1de0('0xc')](function(_0x2e9ca8){logger[_0x1de0('0xd')](_0x1de0('0xe'),_0x39eb21,_0x1de0('0xf'));logger[_0x1de0('0x10')](_0x1de0('0x11'),_0x39eb21,_0x1de0('0xf'),JSON[_0x1de0('0x12')](_0x2e9ca8));if(_0x2e9ca8[_0x1de0('0x13')]){if(_0x2e9ca8[_0x1de0('0x13')][_0x1de0('0x14')]===0x1f4){logger[_0x1de0('0x13')]('ChatTransferReport,\x20%s,\x20%s',_0x39eb21,_0x2e9ca8['error'][_0x1de0('0x15')]);return _0x39b5e4(_0x2e9ca8[_0x1de0('0x13')][_0x1de0('0x15')]);}logger['error'](_0x1de0('0xe'),_0x39eb21,_0x2e9ca8['error'][_0x1de0('0x15')]);return _0x825611(_0x2e9ca8['error'][_0x1de0('0x15')]);}else{logger[_0x1de0('0xd')]('ChatTransferReport,\x20%s,\x20%s',_0x39eb21,_0x1de0('0xf'));_0x825611(_0x2e9ca8[_0x1de0('0x16')][_0x1de0('0x15')]);}})[_0x1de0('0x17')](function(_0x462f54){logger[_0x1de0('0x13')](_0x1de0('0xe'),_0x39eb21,_0x462f54);_0x39b5e4(_0x462f54);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index 2a03dff..16c2222 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 _0x40b1=['describe','/:id','show','post','create','update','delete','destroy','util','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','index'];(function(_0x5479a6,_0x45ccdc){var _0xa30e49=function(_0x4bca6c){while(--_0x4bca6c){_0x5479a6['push'](_0x5479a6['shift']());}};_0xa30e49(++_0x45ccdc);}(_0x40b1,0xf2));var _0x140b=function(_0x25d844,_0x18097f){_0x25d844=_0x25d844-0x0;var _0x2aa87a=_0x40b1[_0x25d844];return _0x2aa87a;};'use strict';var multer=require('multer');var util=require(_0x140b('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x140b('0x1'));var router=express[_0x140b('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x140b('0x3'));var interaction=require(_0x140b('0x4'));var config=require(_0x140b('0x5'));var controller=require(_0x140b('0x6'));router[_0x140b('0x7')]('/',auth[_0x140b('0x8')](),controller[_0x140b('0x9')]);router[_0x140b('0x7')]('/describe',auth[_0x140b('0x8')](),controller[_0x140b('0xa')]);router[_0x140b('0x7')](_0x140b('0xb'),auth[_0x140b('0x8')](),controller[_0x140b('0xc')]);router[_0x140b('0xd')]('/',auth[_0x140b('0x8')](),controller[_0x140b('0xe')]);router['put'](_0x140b('0xb'),auth['isAuthenticated'](),controller[_0x140b('0xf')]);router[_0x140b('0x10')](_0x140b('0xb'),auth['isAuthenticated'](),controller[_0x140b('0x11')]);module['exports']=router; \ No newline at end of file +var _0x6393=['destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./chatTransferReport.controller','get','isAuthenticated','describe','/:id','show','create','update','delete'];(function(_0x2f5f0b,_0x5250c1){var _0xd7932d=function(_0x36323f){while(--_0x36323f){_0x2f5f0b['push'](_0x2f5f0b['shift']());}};_0xd7932d(++_0x5250c1);}(_0x6393,0x1bb));var _0x3639=function(_0x5ee1ef,_0x8d83d5){_0x5ee1ef=_0x5ee1ef-0x0;var _0x601cdc=_0x6393[_0x5ee1ef];return _0x601cdc;};'use strict';var multer=require('multer');var util=require(_0x3639('0x0'));var path=require(_0x3639('0x1'));var timeout=require(_0x3639('0x2'));var express=require('express');var router=express[_0x3639('0x3')]();var fs_extra=require(_0x3639('0x4'));var auth=require(_0x3639('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x3639('0x6'));var controller=require(_0x3639('0x7'));router[_0x3639('0x8')]('/',auth[_0x3639('0x9')](),controller['index']);router[_0x3639('0x8')]('/describe',auth[_0x3639('0x9')](),controller[_0x3639('0xa')]);router[_0x3639('0x8')](_0x3639('0xb'),auth[_0x3639('0x9')](),controller[_0x3639('0xc')]);router['post']('/',auth[_0x3639('0x9')](),controller[_0x3639('0xd')]);router['put'](_0x3639('0xb'),auth['isAuthenticated'](),controller[_0x3639('0xe')]);router[_0x3639('0xf')](_0x3639('0xb'),auth[_0x3639('0x9')](),controller[_0x3639('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 0d75bd7..2aafa91 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 _0x514f=['squared','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Thanks\x20you\x20for\x20your\x20time!','Skip','star','thumb','TEXT','stringify','input','name','text','getDataValue','onlineForm','parse','setDataValue','textarea','Comments','Leave\x20your\x20comments','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','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.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','randomstring','exports','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded'];(function(_0x1337d5,_0x15f13c){var _0x35d212=function(_0x5cc3db){while(--_0x5cc3db){_0x1337d5['push'](_0x1337d5['shift']());}};_0x35d212(++_0x15f13c);}(_0x514f,0x88));var _0xf514=function(_0x50dc15,_0x3d8a1a){_0x50dc15=_0x50dc15-0x0;var _0x1123fb=_0x514f[_0x50dc15];return _0x1123fb;};'use strict';var Sequelize=require('sequelize');var rs=require(_0xf514('0x0'));module[_0xf514('0x1')]={'name':{'type':Sequelize[_0xf514('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0xf514('0x2')],'allowNull':![],'unique':'address'},'description':{'type':Sequelize['STRING']},'mapKey':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x3')},'mapKeyOffline':{'type':Sequelize[_0xf514('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0xf514('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x4')},'customerAlias':{'type':Sequelize[_0xf514('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf514('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xf514('0x2')],'allowNull':![],'defaultValue':_0xf514('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0xf514('0x2')],'allowNull':![],'defaultValue':_0xf514('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xf514('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0xf514('0x2')]},'animation':{'type':Sequelize[_0xf514('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xf514('0x9')](_0xf514('0xa'),_0xf514('0xb')),'defaultValue':_0xf514('0xa')},'header_online':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xf514('0xd')},'offline_chat_button':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0xe')},'header_offline':{'type':Sequelize[_0xf514('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xf514('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xf514('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':_0xf514('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xf514('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x12')},'noteTitle':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x13')},'placeholderMessage':{'type':Sequelize['STRING'],'defaultValue':'Type\x20a\x20message'},'closingMessage':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x14')},'closingMessageButton':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0xe')},'skipMessageButton':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x15')},'conditionAgreement':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':'Feedback'},'ratingType':{'type':Sequelize[_0xf514('0x9')](_0xf514('0x16'),_0xf514('0x17')),'defaultValue':_0xf514('0x16')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xf514('0x18')],'defaultValue':function(){return JSON[_0xf514('0x19')]({'items':[{'type':_0xf514('0x1a'),'variable':null,'config':{'placeholder':_0xf514('0x1b'),'type':_0xf514('0x1c'),'required':!![]},'props':{'title':_0xf514('0x1b'),'helpText':''}},{'type':'input','props':{'title':_0xf514('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xf514('0x3'),'type':_0xf514('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xf514('0x1d')](_0xf514('0x1e'))?JSON[_0xf514('0x1f')](this['getDataValue'](_0xf514('0x1e'))):{};},'set':function(_0x26f053){return this[_0xf514('0x20')](_0xf514('0x1e'),JSON[_0xf514('0x19')](_0x26f053));}},'offlineForm':{'type':Sequelize[_0xf514('0x18')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0xf514('0x1a'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0xf514('0x3'),'type':_0xf514('0x3')},'variable':null},{'type':_0xf514('0x21'),'config':{'placeholder':_0xf514('0x22')},'props':{'title':'Comments','helpText':_0xf514('0x23')}}],'fromKey':0x0});},'get':function(){return this['getDataValue']('offlineForm')?JSON[_0xf514('0x1f')](this[_0xf514('0x1d')]('offlineForm')):{};},'set':function(_0x324ed3){return this[_0xf514('0x20')]('offlineForm',JSON['stringify'](_0x324ed3));}},'token':{'type':Sequelize[_0xf514('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xf514('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize['STRING']},'waitingTitle':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x24')},'waitingMessage':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x25')},'offlineMessageSubject':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x26')},'offlineMessageBody':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x27')},'enableUnmanagedNote':{'type':Sequelize[_0xf514('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x28')},'skipUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0xf514('0x15')},'sendUnmanaged':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0xe')},'enableCustomerAttachment':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xf514('0x18')]},'showAgentAvatar':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0xf514('0x2')]},'notificationTemplate':{'type':Sequelize[_0xf514('0x18')],'defaultValue':function(){return _0xf514('0x29');}},'notificationSound':{'type':Sequelize[_0xf514('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x2a')},'waitForTheAssignedAgent':{'type':Sequelize[_0xf514('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x2b')},'verticalAlignment':{'type':Sequelize[_0xf514('0x7')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize['STRING'],'defaultValue':'alternate'},'defaultTitle':{'type':Sequelize[_0xf514('0x2')]},'customerAvatar':{'type':Sequelize[_0xf514('0x18')]},'showCustomerAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xf514('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf514('0x2c'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xf514('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xf514('0x2')],'defaultValue':_0xf514('0x2d')},'systemAvatar':{'type':Sequelize[_0xf514('0x18')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xf514('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![],'comment':_0xf514('0x2e'),'set':function(_0x418997){if(!_0x418997)this[_0xf514('0x20')]('mandatoryDispositionPauseId',null);this['setDataValue'](_0xf514('0x2f'),_0x418997);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize[_0xf514('0x2')]},'vidaooTopic':{'type':Sequelize[_0xf514('0x2')],'allowNull':![],'defaultValue':_0xf514('0x30')},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return'Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}';}},'vidaooMetadata':{'type':Sequelize[_0xf514('0x18')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xf514('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xf514('0x18')]}}; \ No newline at end of file +var _0x2c17=['Leave\x20your\x20comments','offlineForm','generate','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','Your\x20request\x20has\x20not\x20been\x20processed.','Send','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','exports','STRING','address','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','rounded','squared','We\x20are\x20here!','Chat','Contact\x20us','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','ENUM','thumb','star','TEXT','stringify','input','name','text','onlineForm','parse','getDataValue','setDataValue','Comments'];(function(_0x35d945,_0x2b7f95){var _0x5b2595=function(_0x57e1a7){while(--_0x57e1a7){_0x35d945['push'](_0x35d945['shift']());}};_0x5b2595(++_0x2b7f95);}(_0x2c17,0x83));var _0x72c1=function(_0x429666,_0x69f3d6){_0x429666=_0x429666-0x0;var _0x3117e1=_0x2c17[_0x429666];return _0x3117e1;};'use strict';var Sequelize=require(_0x72c1('0x0'));var rs=require('randomstring');module[_0x72c1('0x1')]={'name':{'type':Sequelize[_0x72c1('0x2')],'allowNull':![]},'address':{'type':Sequelize[_0x72c1('0x2')],'allowNull':![],'unique':_0x72c1('0x3')},'description':{'type':Sequelize[_0x72c1('0x2')]},'mapKey':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x4')},'mapKeyOffline':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':'email'},'key':{'type':Sequelize[_0x72c1('0x2')],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x5')},'customerAlias':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x72c1('0x2')],'allowNull':![],'defaultValue':_0x72c1('0x6'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x72c1('0x2')],'allowNull':![],'defaultValue':_0x72c1('0x6'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x72c1('0x2')],'allowNull':![],'defaultValue':_0x72c1('0x7'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x72c1('0x8')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x72c1('0x2')]},'animation':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':!![]},'header_shape':{'type':Sequelize['ENUM'](_0x72c1('0xa'),_0x72c1('0xb')),'defaultValue':_0x72c1('0xa')},'header_online':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0xc')},'start_chat_button':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0xd')},'offline_chat_button':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':'Send'},'header_offline':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0xe')},'download_transcript':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x72c1('0x8')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x12')},'noteTitle':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x13')},'placeholderMessage':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x14')},'closingMessage':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x15')},'closingMessageButton':{'type':Sequelize['STRING'],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x16')},'conditionAgreement':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'enableFeedback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enableSendButton':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'feedbackTitle':{'type':Sequelize['STRING'],'defaultValue':_0x72c1('0x17')},'ratingType':{'type':Sequelize[_0x72c1('0x18')]('star',_0x72c1('0x19')),'defaultValue':_0x72c1('0x1a')},'ratingStarsNumber':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x72c1('0x1b')],'defaultValue':function(){return JSON[_0x72c1('0x1c')]({'items':[{'type':_0x72c1('0x1d'),'variable':null,'config':{'placeholder':_0x72c1('0x1e'),'type':_0x72c1('0x1f'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x72c1('0x1d'),'props':{'title':_0x72c1('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x72c1('0x4'),'type':_0x72c1('0x4')},'variable':null}],'fromKey':0x1});},'get':function(){return this['getDataValue'](_0x72c1('0x20'))?JSON[_0x72c1('0x21')](this[_0x72c1('0x22')](_0x72c1('0x20'))):{};},'set':function(_0x3dd459){return this[_0x72c1('0x23')]('onlineForm',JSON['stringify'](_0x3dd459));}},'offlineForm':{'type':Sequelize[_0x72c1('0x1b')],'defaultValue':function(){return JSON['stringify']({'items':[{'type':_0x72c1('0x1d'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0x72c1('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x72c1('0x24')},'props':{'title':_0x72c1('0x24'),'helpText':_0x72c1('0x25')}}],'fromKey':0x0});},'get':function(){return this[_0x72c1('0x22')](_0x72c1('0x26'))?JSON[_0x72c1('0x21')](this[_0x72c1('0x22')](_0x72c1('0x26'))):{};},'set':function(_0x50219e){return this[_0x72c1('0x23')]('offlineForm',JSON[_0x72c1('0x1c')](_0x50219e));}},'token':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':function(){return rs[_0x72c1('0x27')]();}},'autoclose':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0x72c1('0x2')]},'forwardOffline':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x72c1('0x2')]},'waitingTitle':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x28')},'offlineMessageSubject':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x29')},'offlineMessageBody':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':'You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:'},'enableUnmanagedNote':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x2a')},'skipUnmanaged':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x16')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':_0x72c1('0x2b')},'enableCustomerAttachment':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x72c1('0x1b')]},'showAgentAvatar':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'timezone':{'type':Sequelize[_0x72c1('0x2')]},'notificationTemplate':{'type':Sequelize[_0x72c1('0x1b')],'defaultValue':function(){return _0x72c1('0x2c');}},'notificationSound':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':_0x72c1('0x2d')},'waitForTheAssignedAgent':{'type':Sequelize[_0x72c1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x2e')},'verticalAlignment':{'type':Sequelize[_0x72c1('0x8')],'defaultValue':0x1e},'messagesAlignment':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x2f')},'defaultTitle':{'type':Sequelize[_0x72c1('0x2')]},'customerAvatar':{'type':Sequelize[_0x72c1('0x1b')]},'showCustomerAvatar':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'messageFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x72c1('0x30'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x72c1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x72c1('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':_0x72c1('0x31')},'systemAvatar':{'type':Sequelize[_0x72c1('0x1b')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x72c1('0x8')],'comment':_0x72c1('0x32')},'mandatoryDisposition':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![],'comment':_0x72c1('0x33'),'set':function(_0x103540){if(!_0x103540)this['setDataValue'](_0x72c1('0x34'),null);this[_0x72c1('0x23')](_0x72c1('0x35'),_0x103540);}},'vidaooEscalation':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x72c1('0x2')],'allowNull':![],'defaultValue':_0x72c1('0x36')},'vidaooNote':{'type':Sequelize[_0x72c1('0x2')],'defaultValue':function(){return _0x72c1('0x37');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x72c1('0x9')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x72c1('0x1b')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index 84e3b01..b43f552 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 _0xe6cd=['../../config/license/util','custom','existsSync','server/files/images/logos/','download','getAvatar','server/files/images/avatars/default_avatar.png','isNil','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','customerAvatar','showCustomerAvatar','server/files/images/avatars/system_avatar.png','systemAvatar','notify','user-agent-parser','user-agent','getResult','chat','CmContact','describe','Sequelize','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','ChatApplication','List','account','applications','Applications','list','orderBy','priority','asc','headers','cf-connecting-ip','first','x-forwarded-for','split','lastName','x-real-port','referer','browser','version','format','%s\x20%s','unknown','device','%s\x20%s\x20%s','vendor','type','stringify','threadId','externalUrl','ContactId','interaction','ChatInteraction','spread','contact','firstName','messageId','created','autoclose','push','unmanaged','*,*,*,*','ChatMessage','UserId','unshift','agent','forcedOwnership','startRouting','Start','EventManager','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','render','toPairs','ChatOfflineMessage','originalname','server','attachments','basename','openNewInteraction','sequelize','transaction','Attachment','Smtp','forwardOffline','forwardOfflineAddress','service','host','secure','authentication','pass','sendMail','\x22%s\x22\x20<%s>','email','offlineMessageSubject','MailAccountId','toPairsIn','mapValues','subjectOffline','Chat','NotifyMailAccount','notifyMail','remove','addInteraction','omit','Contact','User','fullname','Tags','color','tag','timezone','iftime\x20%s,%s','interval','iftime\x20%s','indexOf','true','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','ONLINE','OFFLINE','No\x20timezone','inspect','getSnippet','Interval','Intervals','License','increment','chatLicenseExceeded','all','some','readFileSync','server/files/chat/iframe.ejs','utf8','remote','connection','remoteAddress','virtual','textColor','color_button','backgroundColor','findAndCountAll','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','emit','userChatWebsite:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','http','client','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','show','Pause','includeAll','include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','ChatWebsites','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','ChatWebsiteId','getDispositions','findOne','Disposition','CannedAnswer','getAnswers','order','removeAnswers','ids','file','filename','addAvatar','agentAvatar','addCustomerAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','sitepic'];(function(_0x33fafd,_0x371d2d){var _0x2ea1e8=function(_0x5d426c){while(--_0x5d426c){_0x33fafd['push'](_0x33fafd['shift']());}};_0x2ea1e8(++_0x371d2d);}(_0xe6cd,0x1e9));var _0xde6c=function(_0x2afb3a,_0x563228){_0x2afb3a=_0x2afb3a-0x0;var _0x382182=_0xe6cd[_0x2afb3a];return _0x382182;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xde6c('0x0'));var zipdir=require(_0xde6c('0x1'));var jsonpatch=require(_0xde6c('0x2'));var rp=require('request-promise');var moment=require(_0xde6c('0x3'));var BPromise=require(_0xde6c('0x4'));var Mustache=require(_0xde6c('0x5'));var util=require(_0xde6c('0x6'));var path=require(_0xde6c('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xde6c('0x8'));var _=require(_0xde6c('0x9'));var squel=require(_0xde6c('0xa'));var crypto=require(_0xde6c('0xb'));var jsforce=require(_0xde6c('0xc'));var deskjs=require(_0xde6c('0xd'));var toCsv=require(_0xde6c('0xe'));var querystring=require('querystring');var Papa=require(_0xde6c('0xf'));var Redis=require(_0xde6c('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xde6c('0x11'));var as=require(_0xde6c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xde6c('0x13'))(_0xde6c('0x14'));var utils=require(_0xde6c('0x15'));var config=require(_0xde6c('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xde6c('0x17'))['db'];config[_0xde6c('0x18')]=_[_0xde6c('0x19')](config['redis'],{'host':_0xde6c('0x1a'),'port':0x18eb});var socket=require(_0xde6c('0x1b'))(new Redis(config['redis']));require(_0xde6c('0x1c'))[_0xde6c('0x1d')](socket);var jayson=require(_0xde6c('0x1e'));var client=jayson['client'][_0xde6c('0x1f')]({'port':0x232c});var client9002=jayson[_0xde6c('0x20')][_0xde6c('0x1f')]({'port':0x232a});var client9003=jayson[_0xde6c('0x20')][_0xde6c('0x1f')]({'port':0x232b});var client9001=jayson[_0xde6c('0x20')][_0xde6c('0x1f')]({'port':0x2329});function respondWithRpcPromise(_0x4f9fbc,_0x567b78,_0x4aeb21,_0x184f6d){return new BPromise(function(_0x103976,_0xb549b5){var _0x4435f8=_0x184f6d||client;return _0x4435f8[_0xde6c('0x21')](_0x4f9fbc,_0x4aeb21)['then'](function(_0x5d7152){logger[_0xde6c('0x22')](_0xde6c('0x23'),_0x567b78,_0xde6c('0x24'));logger[_0xde6c('0x25')](_0xde6c('0x26'),_0x567b78,_0xde6c('0x24'),JSON['stringify'](_0x5d7152));if(_0x5d7152['error']){if(_0x5d7152[_0xde6c('0x27')][_0xde6c('0x28')]===0x1f4){logger[_0xde6c('0x27')](_0xde6c('0x23'),_0x567b78,_0x5d7152[_0xde6c('0x27')][_0xde6c('0x29')]);return _0xb549b5(_0x5d7152[_0xde6c('0x27')][_0xde6c('0x29')]);}logger[_0xde6c('0x27')](_0xde6c('0x23'),_0x567b78,_0x5d7152['error'][_0xde6c('0x29')]);return _0x103976(_0x5d7152[_0xde6c('0x27')][_0xde6c('0x29')]);}else{logger[_0xde6c('0x22')](_0xde6c('0x23'),_0x567b78,_0xde6c('0x24'));_0x103976(_0x5d7152[_0xde6c('0x2a')][_0xde6c('0x29')]);}})['catch'](function(_0x175d16){logger[_0xde6c('0x27')](_0xde6c('0x23'),_0x567b78,_0x175d16);_0xb549b5(_0x175d16);});});}function respondWithStatusCode(_0x31c740,_0x2ee9b7){_0x2ee9b7=_0x2ee9b7||0xcc;return function(_0x560624){if(_0x560624){return _0x31c740[_0xde6c('0x2b')](_0x2ee9b7);}return _0x31c740[_0xde6c('0x2c')](_0x2ee9b7)[_0xde6c('0x2d')]();};}function respondWithResult(_0x596f91,_0x3aeb29){_0x3aeb29=_0x3aeb29||0xc8;return function(_0x554b66){if(_0x554b66){return _0x596f91[_0xde6c('0x2c')](_0x3aeb29)[_0xde6c('0x2e')](_0x554b66);}};}function respondWithFilteredResult(_0x26c79e,_0x40c812){return function(_0x202dee){if(_0x202dee){var _0x591346=typeof _0x40c812['offset']===_0xde6c('0x2f')&&typeof _0x40c812[_0xde6c('0x30')]===_0xde6c('0x2f');var _0x166257=_0x202dee[_0xde6c('0x31')];var _0x2f46a6=_0x591346?0x0:_0x40c812[_0xde6c('0x32')];var _0x405cc8=_0x591346?_0x202dee[_0xde6c('0x31')]:_0x40c812[_0xde6c('0x32')]+_0x40c812[_0xde6c('0x30')];var _0x3fd14d;if(_0x405cc8>=_0x166257){_0x405cc8=_0x166257;_0x3fd14d=0xc8;}else{_0x3fd14d=0xce;}_0x26c79e[_0xde6c('0x2c')](_0x3fd14d);return _0x26c79e['set'](_0xde6c('0x33'),_0x2f46a6+'-'+_0x405cc8+'/'+_0x166257)[_0xde6c('0x2e')](_0x202dee);}return null;};}function patchUpdates(_0x3c6827){return function(_0x3e61de){try{jsonpatch['apply'](_0x3e61de,_0x3c6827,!![]);}catch(_0x2ec4d1){return BPromise[_0xde6c('0x34')](_0x2ec4d1);}return _0x3e61de[_0xde6c('0x35')]();};}function saveUpdates(_0x389c65,_0x271446){return function(_0x3e7d2c){if(_0x3e7d2c){return _0x3e7d2c[_0xde6c('0x36')](_0x389c65)[_0xde6c('0x37')](function(_0x279e38){return _0x279e38;});}return null;};}function removeEntity(_0xde9676,_0x5c09b5){return function(_0xa27c5c){if(_0xa27c5c){return _0xa27c5c[_0xde6c('0x38')]()['then'](function(){var _0x4d7227=_0xa27c5c[_0xde6c('0x39')]({'plain':!![]});var _0x4f63a7='ChatWebsites';return db[_0xde6c('0x3a')][_0xde6c('0x38')]({'where':{'type':_0x4f63a7,'resourceId':_0x4d7227['id']}})[_0xde6c('0x37')](function(){return _0xa27c5c;});})['then'](function(){_0xde9676['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x54748a,_0x154d33){return function(_0x4bd3bd){if(!_0x4bd3bd){_0x54748a[_0xde6c('0x2b')](0x194);}return _0x4bd3bd;};}function handleError(_0x490be2,_0x3b3a7a){_0x3b3a7a=_0x3b3a7a||0x1f4;return function(_0x59138a){logger[_0xde6c('0x27')](_0x59138a[_0xde6c('0x3b')]);if(_0x59138a[_0xde6c('0x3c')]){delete _0x59138a[_0xde6c('0x3c')];}_0x490be2[_0xde6c('0x2c')](_0x3b3a7a)['send'](_0x59138a);};}exports[_0xde6c('0x3d')]=function(_0x14a165,_0x8970bd){var _0x385620={'include':[{'model':db['Pause'],'as':_0xde6c('0x3e')}]},_0x54a45d={},_0x5aebb2={'count':0x0,'rows':[]};var _0x50d88d=_[_0xde6c('0x3f')](db[_0xde6c('0x40')][_0xde6c('0x41')],function(_0x374708){return{'name':_0x374708[_0xde6c('0x42')],'type':_0x374708['type'][_0xde6c('0x43')]};});_0x54a45d[_0xde6c('0x44')]=_[_0xde6c('0x3f')](_0x50d88d,_0xde6c('0x3c'));_0x54a45d['query']=_[_0xde6c('0x45')](_0x14a165['query']);_0x54a45d[_0xde6c('0x46')]=_[_0xde6c('0x47')](_0x54a45d[_0xde6c('0x44')],_0x54a45d[_0xde6c('0x48')]);_0x385620[_0xde6c('0x49')]=_[_0xde6c('0x47')](_0x54a45d[_0xde6c('0x44')],qs[_0xde6c('0x4a')](_0x14a165[_0xde6c('0x48')][_0xde6c('0x4a')]));_0x385620[_0xde6c('0x49')]=_0x385620[_0xde6c('0x49')][_0xde6c('0x4b')]?_0x385620['attributes']:_0x54a45d[_0xde6c('0x44')];if(!_0x14a165[_0xde6c('0x48')][_0xde6c('0x4c')](_0xde6c('0x4d'))){_0x385620[_0xde6c('0x30')]=qs[_0xde6c('0x30')](_0x14a165['query'][_0xde6c('0x30')]);_0x385620[_0xde6c('0x32')]=qs[_0xde6c('0x32')](_0x14a165[_0xde6c('0x48')][_0xde6c('0x32')]);}_0x385620['order']=qs[_0xde6c('0x4e')](_0x14a165[_0xde6c('0x48')][_0xde6c('0x4e')]);_0x385620[_0xde6c('0x4f')]=qs[_0xde6c('0x46')](_[_0xde6c('0x50')](_0x14a165[_0xde6c('0x48')],_0x54a45d[_0xde6c('0x46')]),_0x50d88d);if(_0x14a165['query'][_0xde6c('0x51')]){_0x385620[_0xde6c('0x4f')]=_[_0xde6c('0x52')](_0x385620[_0xde6c('0x4f')],{'$or':_[_0xde6c('0x3f')](_0x50d88d,function(_0x10606d){if(_0x10606d['type']!==_0xde6c('0x53')){var _0x12e9ee={};_0x12e9ee[_0x10606d[_0xde6c('0x3c')]]={'$like':'%'+_0x14a165['query']['filter']+'%'};return _0x12e9ee;}})});}_0x385620=_[_0xde6c('0x52')]({},_0x385620,_0x14a165[_0xde6c('0x54')]);var _0x2f107b={'where':_0x385620[_0xde6c('0x4f')]};return db[_0xde6c('0x40')][_0xde6c('0x31')](_0x2f107b)[_0xde6c('0x37')](function(_0x426289){_0x5aebb2['count']=_0x426289;if(_0x14a165['query']['includeAll']){_0x385620['include']=[{'all':!![]}];}return db[_0xde6c('0x40')][_0xde6c('0x55')](_0x385620);})['then'](function(_0x40c4dc){_0x5aebb2[_0xde6c('0x56')]=_0x40c4dc;return _0x5aebb2;})['then'](respondWithFilteredResult(_0x8970bd,_0x385620))[_0xde6c('0x57')](handleError(_0x8970bd,null));};exports[_0xde6c('0x58')]=function(_0xbcf243,_0x228a83){var _0x11858d={'raw':![],'where':{'id':_0xbcf243['params']['id']},'include':[{'model':db[_0xde6c('0x59')],'as':_0xde6c('0x3e')}]},_0x28b856={};_0x28b856[_0xde6c('0x44')]=_[_0xde6c('0x45')](db[_0xde6c('0x40')]['rawAttributes']);_0x28b856[_0xde6c('0x48')]=_[_0xde6c('0x45')](_0xbcf243[_0xde6c('0x48')]);_0x28b856[_0xde6c('0x46')]=_[_0xde6c('0x47')](_0x28b856[_0xde6c('0x44')],_0x28b856[_0xde6c('0x48')]);_0x11858d[_0xde6c('0x49')]=_[_0xde6c('0x47')](_0x28b856[_0xde6c('0x44')],qs['fields'](_0xbcf243[_0xde6c('0x48')][_0xde6c('0x4a')]));_0x11858d['attributes']=_0x11858d['attributes'][_0xde6c('0x4b')]?_0x11858d[_0xde6c('0x49')]:_0x28b856[_0xde6c('0x44')];if(_0xbcf243[_0xde6c('0x48')][_0xde6c('0x5a')]){_0x11858d[_0xde6c('0x5b')]=[{'all':!![]}];}_0x11858d=_[_0xde6c('0x52')]({},_0x11858d,_0xbcf243['options']);return db[_0xde6c('0x40')]['find'](_0x11858d)[_0xde6c('0x37')](handleEntityNotFound(_0x228a83,null))['then'](respondWithResult(_0x228a83,null))[_0xde6c('0x57')](handleError(_0x228a83,null));};exports[_0xde6c('0x5c')]=function(_0xabeb93,_0x15b9b6){return db[_0xde6c('0x40')]['create'](_0xabeb93[_0xde6c('0x5d')],{})['then'](function(_0x91e366){var _0x2c1f3f=_0xabeb93['user'][_0xde6c('0x39')]({'plain':!![]});if(!_0x2c1f3f)throw new Error(_0xde6c('0x5e'));if(_0x2c1f3f[_0xde6c('0x5f')]===_0xde6c('0x60')){var _0x233c66=_0x91e366[_0xde6c('0x39')]({'plain':!![]});var _0x1a8f19=_0xde6c('0x61');return db[_0xde6c('0x62')][_0xde6c('0x63')]({'where':{'name':_0x1a8f19,'userProfileId':_0x2c1f3f['userProfileId']},'raw':!![]})[_0xde6c('0x37')](function(_0xf71e87){if(_0xf71e87&&_0xf71e87[_0xde6c('0x64')]===0x0){return db['UserProfileResource']['create']({'name':_0x233c66[_0xde6c('0x3c')],'resourceId':_0x233c66['id'],'type':_0xf71e87[_0xde6c('0x3c')],'sectionId':_0xf71e87['id']},{})['then'](function(){return _0x91e366;});}else{return _0x91e366;}})[_0xde6c('0x57')](function(_0x1c8c52){logger['error'](_0xde6c('0x65'),_0x1c8c52);throw _0x1c8c52;});}return _0x91e366;})[_0xde6c('0x37')](respondWithResult(_0x15b9b6,0xc9))[_0xde6c('0x57')](handleError(_0x15b9b6,null));};exports[_0xde6c('0x36')]=function(_0x2459d7,_0x4da2b8){if(_0x2459d7[_0xde6c('0x5d')]['id']){delete _0x2459d7[_0xde6c('0x5d')]['id'];}return db[_0xde6c('0x40')]['find']({'where':{'id':_0x2459d7[_0xde6c('0x66')]['id']},'include':[{'model':db[_0xde6c('0x59')],'as':_0xde6c('0x3e')}]})['then'](handleEntityNotFound(_0x4da2b8,null))[_0xde6c('0x37')](saveUpdates(_0x2459d7[_0xde6c('0x5d')],null))[_0xde6c('0x37')](respondWithResult(_0x4da2b8,null))[_0xde6c('0x57')](handleError(_0x4da2b8,null));};exports[_0xde6c('0x38')]=function(_0x73d464,_0x303b2c){return db[_0xde6c('0x40')][_0xde6c('0x63')]({'where':{'id':_0x73d464[_0xde6c('0x66')]['id']}})['then'](handleEntityNotFound(_0x303b2c,null))[_0xde6c('0x37')](removeEntity(_0x303b2c,null))['catch'](handleError(_0x303b2c,null));};exports['describe']=function(_0x494ffe,_0xd1e074){return db['ChatWebsite']['describe']()[_0xde6c('0x37')](respondWithResult(_0xd1e074,null))[_0xde6c('0x57')](handleError(_0xd1e074,null));};exports[_0xde6c('0x67')]=function(_0x27d86b,_0x540aad,_0x34db44){if(_0x27d86b['body']['id']){delete _0x27d86b[_0xde6c('0x5d')]['id'];}return db['ChatWebsite'][_0xde6c('0x63')]({'where':{'id':_0x27d86b['params']['id']}})['then'](handleEntityNotFound(_0x540aad,null))['then'](function(_0x5254ad){if(_0x5254ad){_0x27d86b[_0xde6c('0x5d')][_0xde6c('0x68')]=_0x5254ad['id'];return db['Disposition'][_0xde6c('0x5c')](_0x27d86b['body']);}})[_0xde6c('0x37')](respondWithResult(_0x540aad,null))[_0xde6c('0x57')](handleError(_0x540aad,null));};exports[_0xde6c('0x69')]=function(_0x590544,_0x6ed0b8,_0x185808){var _0x15180c={'raw':![],'where':{}};var _0x865e5c={};var _0x4830b0={'count':0x0,'rows':[]};return db[_0xde6c('0x40')][_0xde6c('0x6a')]({'where':{'id':_0x590544[_0xde6c('0x66')]['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x6ed0b8,null))[_0xde6c('0x37')](function(_0x36a1d9){if(_0x36a1d9){_0x865e5c['model']=_['keys'](db[_0xde6c('0x6b')][_0xde6c('0x41')]);_0x865e5c[_0xde6c('0x48')]=_[_0xde6c('0x45')](_0x590544[_0xde6c('0x48')]);_0x865e5c[_0xde6c('0x46')]=_[_0xde6c('0x47')](_0x865e5c[_0xde6c('0x44')],_0x865e5c[_0xde6c('0x48')]);_0x15180c[_0xde6c('0x49')]=_[_0xde6c('0x47')](_0x865e5c[_0xde6c('0x44')],qs[_0xde6c('0x4a')](_0x590544['query'][_0xde6c('0x4a')]));_0x15180c[_0xde6c('0x49')]=_0x15180c[_0xde6c('0x49')]['length']?_0x15180c[_0xde6c('0x49')]:_0x865e5c[_0xde6c('0x44')];if(!_0x590544['query']['hasOwnProperty'](_0xde6c('0x4d'))){_0x15180c[_0xde6c('0x30')]=qs[_0xde6c('0x30')](_0x590544['query'][_0xde6c('0x30')]);_0x15180c[_0xde6c('0x32')]=qs['offset'](_0x590544[_0xde6c('0x48')][_0xde6c('0x32')]);}_0x15180c['order']=qs[_0xde6c('0x4e')](_0x590544[_0xde6c('0x48')][_0xde6c('0x4e')]);_0x15180c[_0xde6c('0x4f')]=qs[_0xde6c('0x46')](_['pick'](_0x590544[_0xde6c('0x48')],_0x865e5c['filters']));_0x15180c['where'][_0xde6c('0x68')]=_0x36a1d9['id'];if(_0x590544[_0xde6c('0x48')][_0xde6c('0x51')]){_0x15180c[_0xde6c('0x4f')]=_[_0xde6c('0x52')](_0x15180c['where'],{'$or':_[_0xde6c('0x3f')](_0x15180c[_0xde6c('0x49')],function(_0x24293c){var _0x5f186b={};_0x5f186b[_0x24293c]={'$like':'%'+_0x590544[_0xde6c('0x48')][_0xde6c('0x51')]+'%'};return _0x5f186b;})});}_0x15180c=_[_0xde6c('0x52')]({},_0x15180c,_0x590544[_0xde6c('0x54')]);return db[_0xde6c('0x6b')][_0xde6c('0x31')]({'where':_0x15180c[_0xde6c('0x4f')]})['then'](function(_0xc359d6){_0x4830b0['count']=_0xc359d6;if(_0x590544[_0xde6c('0x48')][_0xde6c('0x5a')]){_0x15180c[_0xde6c('0x5b')]=[{'all':!![]}];}return db['Disposition'][_0xde6c('0x55')](_0x15180c);})[_0xde6c('0x37')](function(_0x1934bc){_0x4830b0[_0xde6c('0x56')]=_0x1934bc;return _0x4830b0;});}})['then'](respondWithFilteredResult(_0x6ed0b8,_0x15180c))['catch'](handleError(_0x6ed0b8,null));};exports['removeDispositions']=function(_0x548fb7,_0x785273,_0x6d33a9){return db[_0xde6c('0x40')][_0xde6c('0x63')]({'where':{'id':_0x548fb7[_0xde6c('0x66')]['id']}})['then'](handleEntityNotFound(_0x785273,null))['then'](function(_0x29d7af){if(_0x29d7af){return _0x29d7af['removeDispositions'](_0x548fb7[_0xde6c('0x48')]['ids']);}})['then'](respondWithStatusCode(_0x785273,null))[_0xde6c('0x57')](handleError(_0x785273,null));};exports['addAnswer']=function(_0x4f6e8d,_0x2bab17,_0x3a8a70){if(_0x4f6e8d[_0xde6c('0x5d')]['id']){delete _0x4f6e8d[_0xde6c('0x5d')]['id'];}return db[_0xde6c('0x40')][_0xde6c('0x63')]({'where':{'id':_0x4f6e8d[_0xde6c('0x66')]['id']}})['then'](handleEntityNotFound(_0x2bab17,null))[_0xde6c('0x37')](function(_0x33208a){if(_0x33208a){_0x4f6e8d[_0xde6c('0x5d')][_0xde6c('0x68')]=_0x33208a['id'];return db[_0xde6c('0x6c')][_0xde6c('0x5c')](_0x4f6e8d[_0xde6c('0x5d')]);}})['then'](respondWithResult(_0x2bab17,null))[_0xde6c('0x57')](handleError(_0x2bab17,null));};exports[_0xde6c('0x6d')]=function(_0x516cbc,_0x144dfc,_0x470b76){var _0x2639d0={'raw':![],'where':{}};var _0x4004c7={};var _0x13e519={'count':0x0,'rows':[]};return db[_0xde6c('0x40')]['findOne']({'where':{'id':_0x516cbc[_0xde6c('0x66')]['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x144dfc,null))[_0xde6c('0x37')](function(_0x170ed6){if(_0x170ed6){_0x4004c7[_0xde6c('0x44')]=_[_0xde6c('0x45')](db['CannedAnswer'][_0xde6c('0x41')]);_0x4004c7[_0xde6c('0x48')]=_[_0xde6c('0x45')](_0x516cbc[_0xde6c('0x48')]);_0x4004c7[_0xde6c('0x46')]=_[_0xde6c('0x47')](_0x4004c7['model'],_0x4004c7[_0xde6c('0x48')]);_0x2639d0[_0xde6c('0x49')]=_[_0xde6c('0x47')](_0x4004c7['model'],qs[_0xde6c('0x4a')](_0x516cbc[_0xde6c('0x48')][_0xde6c('0x4a')]));_0x2639d0[_0xde6c('0x49')]=_0x2639d0[_0xde6c('0x49')]['length']?_0x2639d0[_0xde6c('0x49')]:_0x4004c7[_0xde6c('0x44')];if(!_0x516cbc[_0xde6c('0x48')][_0xde6c('0x4c')](_0xde6c('0x4d'))){_0x2639d0[_0xde6c('0x30')]=qs[_0xde6c('0x30')](_0x516cbc['query'][_0xde6c('0x30')]);_0x2639d0[_0xde6c('0x32')]=qs[_0xde6c('0x32')](_0x516cbc[_0xde6c('0x48')][_0xde6c('0x32')]);}_0x2639d0[_0xde6c('0x6e')]=qs[_0xde6c('0x4e')](_0x516cbc[_0xde6c('0x48')][_0xde6c('0x4e')]);_0x2639d0[_0xde6c('0x4f')]=qs[_0xde6c('0x46')](_[_0xde6c('0x50')](_0x516cbc['query'],_0x4004c7['filters']));_0x2639d0[_0xde6c('0x4f')][_0xde6c('0x68')]=_0x170ed6['id'];if(_0x516cbc['query'][_0xde6c('0x51')]){_0x2639d0[_0xde6c('0x4f')]=_[_0xde6c('0x52')](_0x2639d0['where'],{'$or':_[_0xde6c('0x3f')](_0x2639d0[_0xde6c('0x49')],function(_0x855403){var _0x362ee9={};_0x362ee9[_0x855403]={'$like':'%'+_0x516cbc[_0xde6c('0x48')]['filter']+'%'};return _0x362ee9;})});}_0x2639d0=_[_0xde6c('0x52')]({},_0x2639d0,_0x516cbc[_0xde6c('0x54')]);return db[_0xde6c('0x6c')][_0xde6c('0x31')]({'where':_0x2639d0[_0xde6c('0x4f')]})[_0xde6c('0x37')](function(_0x43c812){_0x13e519[_0xde6c('0x31')]=_0x43c812;if(_0x516cbc[_0xde6c('0x48')][_0xde6c('0x5a')]){_0x2639d0[_0xde6c('0x5b')]=[{'all':!![]}];}return db['CannedAnswer'][_0xde6c('0x55')](_0x2639d0);})[_0xde6c('0x37')](function(_0x785cc2){_0x13e519['rows']=_0x785cc2;return _0x13e519;});}})['then'](respondWithFilteredResult(_0x144dfc,_0x2639d0))[_0xde6c('0x57')](handleError(_0x144dfc,null));};exports['removeAnswers']=function(_0x3b7a22,_0x570249,_0x5d92a7){return db['ChatWebsite'][_0xde6c('0x63')]({'where':{'id':_0x3b7a22[_0xde6c('0x66')]['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x570249,null))[_0xde6c('0x37')](function(_0x906c82){if(_0x906c82){return _0x906c82[_0xde6c('0x6f')](_0x3b7a22[_0xde6c('0x48')][_0xde6c('0x70')]);}})[_0xde6c('0x37')](respondWithStatusCode(_0x570249,null))[_0xde6c('0x57')](handleError(_0x570249,null));};exports['addLogo']=function(_0x1f9922,_0x231bd8,_0x17578c){_0x1f9922[_0xde6c('0x5d')]['sitepic']=_0x1f9922[_0xde6c('0x71')][_0xde6c('0x72')];return db[_0xde6c('0x40')][_0xde6c('0x63')]({'where':{'id':_0x1f9922[_0xde6c('0x66')]['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x231bd8,null))[_0xde6c('0x37')](saveUpdates(_0x1f9922[_0xde6c('0x5d')],null))['then'](respondWithResult(_0x231bd8,null))[_0xde6c('0x57')](handleError(_0x231bd8,null));};exports[_0xde6c('0x73')]=function(_0x5ebcbf,_0x355fe6,_0x3e32ff){_0x5ebcbf[_0xde6c('0x5d')][_0xde6c('0x74')]=_0x5ebcbf[_0xde6c('0x71')]['filename'];return db[_0xde6c('0x40')][_0xde6c('0x63')]({'where':{'id':_0x5ebcbf[_0xde6c('0x66')]['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x355fe6,null))[_0xde6c('0x37')](saveUpdates(_0x5ebcbf['body'],null))[_0xde6c('0x37')](respondWithResult(_0x355fe6,null))[_0xde6c('0x57')](handleError(_0x355fe6,null));};exports[_0xde6c('0x75')]=function(_0x1da6f6,_0x2f9139,_0x1575a6){_0x1da6f6['body']['customerAvatar']=_0x1da6f6['file'][_0xde6c('0x72')];return db['ChatWebsite'][_0xde6c('0x63')]({'where':{'id':_0x1da6f6[_0xde6c('0x66')]['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x2f9139,null))['then'](saveUpdates(_0x1da6f6['body'],null))[_0xde6c('0x37')](respondWithResult(_0x2f9139,null))[_0xde6c('0x57')](handleError(_0x2f9139,null));};exports['addSystemAvatar']=function(_0x2124ec,_0x5ba535,_0x1c369c){_0x2124ec[_0xde6c('0x5d')]['systemAvatar']=_0x2124ec[_0xde6c('0x71')][_0xde6c('0x72')];return db[_0xde6c('0x40')][_0xde6c('0x63')]({'where':{'id':_0x2124ec[_0xde6c('0x66')]['id']}})['then'](handleEntityNotFound(_0x5ba535,null))['then'](saveUpdates(_0x2124ec[_0xde6c('0x5d')],null))[_0xde6c('0x37')](respondWithResult(_0x5ba535,null))[_0xde6c('0x57')](handleError(_0x5ba535,null));};exports[_0xde6c('0x76')]=function(_0x1bf571,_0x508a17,_0x22e71f){var _0x5c3245=path[_0xde6c('0x77')](config[_0xde6c('0x78')],_0xde6c('0x79'));var _0x553016={'where':{'id':_0x1bf571[_0xde6c('0x66')]['id']},'attributes':['id',_0xde6c('0x7a')],'raw':!![]};var _0x4ef856=![];return require(_0xde6c('0x7b'))['getLicense']()['then'](function(_0x42a032){if(_0x42a032){_0x4ef856=_0x42a032[_0xde6c('0x7c')];}})[_0xde6c('0x37')](function(){return db[_0xde6c('0x40')][_0xde6c('0x63')](_0x553016);})[_0xde6c('0x37')](handleEntityNotFound(_0x508a17,null))[_0xde6c('0x37')](function(_0x4504f5){if(_0x4504f5){if(!_['isNil'](_0x4504f5[_0xde6c('0x7a')])){if(fs[_0xde6c('0x7d')](path[_0xde6c('0x77')](config['root'],_0xde6c('0x7e'),_0x4504f5[_0xde6c('0x7a')]))&&_0x4ef856){_0x5c3245=path[_0xde6c('0x77')](config['root'],_0xde6c('0x7e'),_0x4504f5['sitepic']);}}return _0x508a17[_0xde6c('0x7f')](_0x5c3245);}})[_0xde6c('0x57')](handleError(_0x508a17,null));};exports[_0xde6c('0x80')]=function(_0x236445,_0x4c6222,_0x23b484){var _0x103e83=path[_0xde6c('0x77')](config['root'],_0xde6c('0x81'));var _0x12221b={'where':{'id':_0x236445[_0xde6c('0x66')]['id']},'attributes':['id',_0xde6c('0x74')],'raw':!![]};return db[_0xde6c('0x40')]['find'](_0x12221b)[_0xde6c('0x37')](handleEntityNotFound(_0x4c6222,null))[_0xde6c('0x37')](function(_0x30fde2){if(_0x30fde2){if(!_[_0xde6c('0x82')](_0x30fde2[_0xde6c('0x74')])){if(fs[_0xde6c('0x7d')](path[_0xde6c('0x77')](config[_0xde6c('0x78')],_0xde6c('0x83'),_0x30fde2['agentAvatar']))){_0x103e83=path[_0xde6c('0x77')](config['root'],_0xde6c('0x83'),_0x30fde2['agentAvatar']);}}return _0x4c6222['download'](_0x103e83);}})['catch'](handleError(_0x4c6222,null));};exports[_0xde6c('0x84')]=function(_0x3557ac,_0x53b77a,_0xf9e749){var _0x1ee476=path[_0xde6c('0x77')](config['root'],_0xde6c('0x85'));var _0x356d4a={'where':{'id':_0x3557ac[_0xde6c('0x66')]['id']},'attributes':['id',_0xde6c('0x86'),_0xde6c('0x87')],'raw':!![]};return db['ChatWebsite']['find'](_0x356d4a)[_0xde6c('0x37')](handleEntityNotFound(_0x53b77a,null))['then'](function(_0x1e9a63){if(_0x1e9a63){if(!_[_0xde6c('0x82')](_0x1e9a63[_0xde6c('0x86')])){if(fs[_0xde6c('0x7d')](path[_0xde6c('0x77')](config[_0xde6c('0x78')],'server/files/images/avatars/',_0x1e9a63[_0xde6c('0x86')]))&&_0x1e9a63[_0xde6c('0x87')]){_0x1ee476=path[_0xde6c('0x77')](config['root'],_0xde6c('0x83'),_0x1e9a63[_0xde6c('0x86')]);}}return _0x53b77a[_0xde6c('0x7f')](_0x1ee476);}})[_0xde6c('0x57')](handleError(_0x53b77a,null));};exports['getSystemAvatar']=function(_0x3d5456,_0x5c897a,_0x3c3fa7){var _0x1b9337=path['join'](config[_0xde6c('0x78')],_0xde6c('0x88'));var _0x2a2f41={'where':{'id':_0x3d5456[_0xde6c('0x66')]['id']},'attributes':['id',_0xde6c('0x89')],'raw':!![]};return db[_0xde6c('0x40')][_0xde6c('0x63')](_0x2a2f41)[_0xde6c('0x37')](handleEntityNotFound(_0x5c897a,null))[_0xde6c('0x37')](function(_0x2fed24){if(_0x2fed24){if(!_[_0xde6c('0x82')](_0x2fed24[_0xde6c('0x89')])){if(fs[_0xde6c('0x7d')](path[_0xde6c('0x77')](config[_0xde6c('0x78')],_0xde6c('0x83'),_0x2fed24['systemAvatar']))){_0x1b9337=path[_0xde6c('0x77')](config[_0xde6c('0x78')],_0xde6c('0x83'),_0x2fed24[_0xde6c('0x89')]);}}return _0x5c897a[_0xde6c('0x7f')](_0x1b9337);}})[_0xde6c('0x57')](handleError(_0x5c897a,null));};exports[_0xde6c('0x8a')]=function(_0x582901,_0x43307d,_0x2fe7f6){var _0x559a39=require(_0xde6c('0x8b'));var _0x2b95d6=new _0x559a39();var _0x4926c5=_0x2b95d6['setUA'](_0x582901['headers'][_0xde6c('0x8c')])[_0xde6c('0x8d')]();var _0x1fc22d={'body':_0x582901[_0xde6c('0x5d')],'channel':_0xde6c('0x8e')};var _0x3e2654=[];var _0x414976=[];var _0x324e54={};var _0x4f0e94=![];return db[_0xde6c('0x8f')][_0xde6c('0x90')]()[_0xde6c('0x37')](function(_0x3f97d){if(!_0x3f97d){throw new db[(_0xde6c('0x91'))]['ValidationError'](_0xde6c('0x92'));}_0x3e2654=_['difference'](_[_0xde6c('0x45')](_0x3f97d),[_0xde6c('0x93'),'updatedAt']);_0x414976=_[_0xde6c('0x94')](_['keys'](_0x3f97d),[_0xde6c('0x93'),_0xde6c('0x95'),_0xde6c('0x96'),_0xde6c('0x97')]);if(_0x582901[_0xde6c('0x5d')]['id']){delete _0x582901[_0xde6c('0x5d')]['id'];}if(_['isNil'](_0x582901['body'][_0xde6c('0x98')])){throw new db['Sequelize'][(_0xde6c('0x99'))](_0xde6c('0x9a'));}if(_[_0xde6c('0x82')](_0x582901[_0xde6c('0x5d')][_0xde6c('0x5d')])||_0x582901[_0xde6c('0x5d')][_0xde6c('0x5d')]===''){throw new db[(_0xde6c('0x91'))][(_0xde6c('0x99'))](_0xde6c('0x9b'));}if(_[_0xde6c('0x82')](_0x582901[_0xde6c('0x5d')][_0xde6c('0x9c')])){throw new db[(_0xde6c('0x91'))]['ValidationError']('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x414976);}if(!_['includes'](_0x414976,_0x582901[_0xde6c('0x5d')][_0xde6c('0x9c')])){throw new db[(_0xde6c('0x91'))][(_0xde6c('0x99'))](_0xde6c('0x9d')+_0x414976);}_0x324e54[_0x582901[_0xde6c('0x5d')]['mapKey']]=_0x582901['body'][_0xde6c('0x98')];})[_0xde6c('0x37')](function(){return db[_0xde6c('0x40')][_0xde6c('0x63')]({'where':{'id':_0x582901[_0xde6c('0x66')]['id']},'include':[{'model':db[_0xde6c('0x9e')],'as':'List','include':[{'model':db[_0xde6c('0x8f')],'as':_0xde6c('0x9f'),'where':_0x324e54,'limit':0x1,'order':[['updatedAt',_0xde6c('0xa0')]]}]},{'model':db[_0xde6c('0xa1')],'as':'Applications'}]});})[_0xde6c('0x37')](handleEntityNotFound(_0x43307d,null))['then'](function(_0x169de3){if(_0x169de3&&_0x169de3[_0xde6c('0xa2')]){_0x1fc22d[_0xde6c('0xa3')]=_0x169de3;_0x1fc22d[_0xde6c('0xa4')]=_0x169de3[_0xde6c('0xa5')];_0x1fc22d[_0xde6c('0xa6')]=_0x169de3['List'];_0x1fc22d[_0xde6c('0xa4')]=_[_0xde6c('0xa7')](_0x1fc22d[_0xde6c('0xa4')],[_0xde6c('0xa8')],[_0xde6c('0xa9')]);if(_0x1fc22d[_0xde6c('0xa3')]['Applications']){delete _0x1fc22d[_0xde6c('0xa3')]['Applications'];}if(_0x1fc22d[_0xde6c('0xa3')]['List']&&_0x1fc22d[_0xde6c('0xa3')][_0xde6c('0xa2')][_0xde6c('0x9f')][_0xde6c('0x4b')]){return _0x1fc22d[_0xde6c('0xa3')][_0xde6c('0xa2')][_0xde6c('0x9f')][0x0];}var _0x1a12ce=_[_0xde6c('0x19')](_0x582901['body'],{'firstName':_0x582901['body'][_0xde6c('0x98')],'ListId':_0x169de3[_0xde6c('0x97')]});_0x1a12ce[_0x582901[_0xde6c('0x5d')][_0xde6c('0x9c')]]=_0x582901[_0xde6c('0x5d')][_0xde6c('0x98')];return db[_0xde6c('0x8f')]['create'](_0x1a12ce,{'fields':_0x3e2654,'raw':!![]});}})[_0xde6c('0x37')](handleEntityNotFound(_0x43307d,null))[_0xde6c('0x37')](function(_0x1f352f){_0x1fc22d['contact']=_0x1f352f;var _0x3db668=_0x582901['body']['customerIp'];if(_0x582901[_0xde6c('0xaa')][_0xde6c('0xab')]){_0x3db668=_0x582901[_0xde6c('0xaa')][_0xde6c('0xab')];}else if(_0x582901['headers']['x-forwarded-for']){_0x3db668=_[_0xde6c('0xac')](_0x582901[_0xde6c('0xaa')][_0xde6c('0xad')][_0xde6c('0xae')](','));}if(_0x1f352f){var _0x32d4df={'ContactId':_0x1f352f['id'],'ChatWebsiteId':_0x582901[_0xde6c('0x66')]['id'],'from':(_0x1f352f['firstName']||'')+'\x20'+(_0x1f352f[_0xde6c('0xaf')]||''),'customerIp':_0x3db668,'customerPort':_0x582901['headers'][_0xde6c('0xb0')]?_0x582901[_0xde6c('0xaa')][_0xde6c('0xb0')]:null,'referer':_0x582901['body'][_0xde6c('0xb1')],'browserName':_0x4926c5[_0xde6c('0xb2')][_0xde6c('0x3c')]&&_0x4926c5['browser'][_0xde6c('0xb3')]?util[_0xde6c('0xb4')](_0xde6c('0xb5'),_0x4926c5[_0xde6c('0xb2')][_0xde6c('0x3c')],_0x4926c5[_0xde6c('0xb2')][_0xde6c('0xb3')]):_0xde6c('0xb6'),'browserVersion':_0x4926c5['browser'][_0xde6c('0xb3')]||_0xde6c('0xb6'),'osName':util[_0xde6c('0xb4')](_0xde6c('0xb5'),_0x4926c5['os'][_0xde6c('0x3c')],_0x4926c5['os'][_0xde6c('0xb3')]),'osVersion':_0x4926c5['os'][_0xde6c('0xb3')],'deviceModel':_0x4926c5[_0xde6c('0xb7')][_0xde6c('0x44')]&&_0x4926c5['device']['vendor']?util[_0xde6c('0xb4')](_0xde6c('0xb8'),_0x4926c5[_0xde6c('0xb7')][_0xde6c('0x44')],_0x4926c5[_0xde6c('0xb7')][_0xde6c('0xb9')],_0x4926c5[_0xde6c('0xb7')][_0xde6c('0xba')]):null,'deviceVendor':_0x4926c5[_0xde6c('0xb7')][_0xde6c('0xb9')],'deviceType':_0x4926c5[_0xde6c('0xb7')][_0xde6c('0xba')],'formData':JSON[_0xde6c('0xbb')](_0x582901['body'])};var _0x537796={'ChatWebsiteId':_0x582901[_0xde6c('0x66')]['id'],'closed':![]};if(_0x582901['body']['threadId']){_0x537796[_0xde6c('0xbc')]=_0x582901[_0xde6c('0x5d')][_0xde6c('0xbc')];return db['ChatInteraction'][_0xde6c('0x63')]({'where':_0x537796})[_0xde6c('0x37')](function(_0x4ebf77){if(_0x4ebf77){return[_0x4ebf77,![]];}_0x32d4df[_0xde6c('0xbc')]=_0x582901[_0xde6c('0x5d')]['threadId'];_0x32d4df['externalUrl']=_0x582901[_0xde6c('0x5d')][_0xde6c('0xbd')];return db['ChatInteraction'][_0xde6c('0x5c')](_0x32d4df)[_0xde6c('0x37')](function(_0x497ddb){return[_0x497ddb,!![]];});});}_0x537796[_0xde6c('0xbe')]=_0x1f352f['id'];if(_0x582901[_0xde6c('0x5d')]['interaction']&&_0x582901['body'][_0xde6c('0xbf')]['id']){_0x537796['id']=_0x582901[_0xde6c('0x5d')][_0xde6c('0xbf')]['id'];return db[_0xde6c('0xc0')][_0xde6c('0x63')]({'where':_0x537796})['then'](function(_0x255a08){if(_0x255a08){return[_0x255a08,![]];}return db[_0xde6c('0xc0')]['create'](_0x32d4df)[_0xde6c('0x37')](function(_0x3ab23e){return[_0x3ab23e,!![]];});});}return db[_0xde6c('0xc0')][_0xde6c('0x5c')](_0x32d4df)[_0xde6c('0x37')](function(_0x40dd4c){return[_0x40dd4c,!![]];});}})[_0xde6c('0xc1')](function(_0x29f267,_0x409a17){if(_0x29f267){_0x4f0e94=_0x409a17;if(!_0x409a17){var _0x13a913={'from':(_0x1fc22d[_0xde6c('0xc2')][_0xde6c('0xc3')]||'')+'\x20'+(_0x1fc22d['contact']['lastName']||'')};if(_0x582901['body'][_0xde6c('0xbc')]&&_0x582901[_0xde6c('0x5d')][_0xde6c('0xc4')]&&_0x582901[_0xde6c('0x5d')]['threadId']!=_0x582901[_0xde6c('0x5d')]['messageId']){_0x13a913['threadId']=_0x582901[_0xde6c('0x5d')][_0xde6c('0xc4')];}return _0x29f267[_0xde6c('0x36')](_0x13a913);}else{return _0x29f267;}}})[_0xde6c('0x37')](function(_0x2d88f3){_0x1fc22d['interaction']=_0x2d88f3[_0xde6c('0x39')]({'plain':!![]});_0x1fc22d[_0xde6c('0xbf')][_0xde6c('0xc5')]=_0x4f0e94;if(_0x1fc22d[_0xde6c('0xbf')][_0xde6c('0xc5')]){if(_0x1fc22d[_0xde6c('0xa3')][_0xde6c('0xc6')]){_0x1fc22d[_0xde6c('0xa4')][_0xde6c('0xc7')]({'id':0x0,'priority':_0x1fc22d['applications'][_0xde6c('0x4b')]+0x1,'app':'close','appdata':_0xde6c('0xc8'),'interval':_0xde6c('0xc9')});}}return db[_0xde6c('0xca')][_0xde6c('0x5c')]({'body':_0x582901['body']['body'],'ChatWebsiteId':_0x582901[_0xde6c('0x66')]['id'],'ChatInteractionId':_0x2d88f3['id'],'direction':'in','ContactId':_0x1fc22d['contact']['id'],'AttachmentId':_0x582901['body']['AttachmentId']});})['then'](function(_0x4cb353){_0x1fc22d[_0xde6c('0x29')]=_0x4cb353;if(_0x1fc22d[_0xde6c('0xbf')][_0xde6c('0xcb')]){return db['User'][_0xde6c('0x63')]({'attributes':['id','name'],'where':{'id':_0x1fc22d['interaction'][_0xde6c('0xcb')]}})[_0xde6c('0x37')](function(_0x4da7d1){if(_0x4da7d1){_0x1fc22d[_0xde6c('0xa4')][_0xde6c('0xcc')]({'id':0x0,'priority':0x0,'app':_0xde6c('0xcd'),'appdata':_0x4da7d1['name']+','+(_0x1fc22d[_0xde6c('0xa3')]['waitForTheAssignedAgent']||0xa),'interval':'*,*,*,*'});_0x1fc22d[_0xde6c('0xce')]=!![];}return respondWithRpcPromise('Start',_0xde6c('0xcf'),_0x1fc22d);});}return respondWithRpcPromise(_0xde6c('0xd0'),_0xde6c('0xcf'),_0x1fc22d);})[_0xde6c('0x37')](function(_0x58cbdc){respondWithRpcPromise(_0xde6c('0xd1'),'EventManager',{'event':'notify','message':_0x58cbdc},client9002);return _0x58cbdc;})[_0xde6c('0x37')](respondWithResult(_0x43307d,null))[_0xde6c('0x57')](handleError(_0x43307d,null));};exports[_0xde6c('0xd2')]=function(_0x556bfb,_0x1c71e8,_0x474fde){var _0x5b672c,_0x2546df,_0x1ad556;var _0xbd63be=[];var _0xd079ea=[];var _0x246691={};var _0x2f791e=_0x556bfb[_0xde6c('0xd3')]||[];var _0x5b779c=[];var _0x16a0c3;return db[_0xde6c('0x8f')][_0xde6c('0x90')]()['then'](function(_0x2e057a){if(!_0x2e057a){throw new db[(_0xde6c('0x91'))][(_0xde6c('0x99'))](_0xde6c('0x92'));}_0xd079ea=_[_0xde6c('0x94')](_[_0xde6c('0x45')](_0x2e057a),['createdAt','updatedAt']);_0xbd63be=_['difference'](_[_0xde6c('0x45')](_0x2e057a),[_0xde6c('0x93'),_0xde6c('0x95'),_0xde6c('0x96'),_0xde6c('0x97')]);if(_0x556bfb[_0xde6c('0x5d')]['id']){delete _0x556bfb[_0xde6c('0x5d')]['id'];}if(_[_0xde6c('0x82')](_0x556bfb[_0xde6c('0x5d')]['from'])){throw _0x1c71e8[_0xde6c('0x2c')](0x1f4)[_0xde6c('0xd4')](new db[(_0xde6c('0x91'))][(_0xde6c('0x99'))](_0xde6c('0x9a')));}if(_[_0xde6c('0x82')](_0x556bfb[_0xde6c('0x5d')][_0xde6c('0x5d')])||_0x556bfb[_0xde6c('0x5d')]['body']===''){throw _0x1c71e8['status'](0x1f4)[_0xde6c('0xd4')](new db[(_0xde6c('0x91'))][(_0xde6c('0x99'))](_0xde6c('0x9b')));}if(_['isNil'](_0x556bfb[_0xde6c('0x5d')][_0xde6c('0xd5')])){throw _0x1c71e8[_0xde6c('0x2c')](0x1f4)['send'](new db[(_0xde6c('0x91'))][(_0xde6c('0x99'))](_0xde6c('0xd6')+_0xbd63be));}if(!_[_0xde6c('0xd7')](_0xbd63be,_0x556bfb[_0xde6c('0x5d')][_0xde6c('0xd5')])){throw _0x1c71e8[_0xde6c('0x2c')](0x1f4)[_0xde6c('0xd4')](new db[(_0xde6c('0x91'))]['ValidationError'](_0xde6c('0xd8')+_0xbd63be));}_0x246691[_0x556bfb[_0xde6c('0x5d')][_0xde6c('0xd5')]]=_0x556bfb[_0xde6c('0x5d')]['from'];})[_0xde6c('0x37')](function(){return db[_0xde6c('0x40')]['find']({'where':{'id':_0x556bfb['params']['id']},'include':[{'model':db['CmList'],'as':_0xde6c('0xa2')},{'model':db[_0xde6c('0xd9')],'as':'MailAccount'}]});})[_0xde6c('0x37')](handleEntityNotFound(_0x1c71e8,null))[_0xde6c('0x37')](function(_0x1518ea){if(_0x1518ea&&_0x1518ea[_0xde6c('0xa2')]){_0x2546df=_0x1518ea;var _0x25d29e=_[_0xde6c('0x19')](_0x556bfb[_0xde6c('0x5d')],{'firstName':_0x556bfb[_0xde6c('0x5d')]['from'],'phone':_0x556bfb[_0xde6c('0x5d')][_0xde6c('0x98')],'ListId':_0x1518ea[_0xde6c('0x97')]});_0x25d29e[_0x556bfb[_0xde6c('0x5d')][_0xde6c('0xd5')]]=_0x556bfb[_0xde6c('0x5d')][_0xde6c('0x98')];return db[_0xde6c('0x8f')][_0xde6c('0xda')]({'where':_0x246691,'defaults':_0x25d29e});}})['spread'](function(_0x19d3fc){if(_0x19d3fc){_0x1ad556=_0x19d3fc;var _0x3d84ef=fs['readFileSync'](path[_0xde6c('0x77')](config[_0xde6c('0x78')],_0xde6c('0xdb')),'utf8');var _0x4d3243=ejs[_0xde6c('0xdc')](_0x3d84ef,{'body':_[_0xde6c('0xdd')](_0x556bfb[_0xde6c('0x5d')][_0xde6c('0x5d')]),'bodyTitle':_0x2546df['offlineMessageBody']});return db[_0xde6c('0xde')][_0xde6c('0x5c')]({'body':_0x4d3243,'ContactId':_0x19d3fc['id'],'ChatWebsiteId':_0x2546df['id']});}})[_0xde6c('0x37')](function(_0xf11565){_0x16a0c3=_0xf11565;if(_0x2f791e['length']){var _0xa4fd81=_0x2f791e['map'](function(_0x441e0a){return{'name':_0x441e0a[_0xde6c('0xdf')],'basename':_0x441e0a[_0xde6c('0x72')],'type':_0x441e0a['mimetype'],'ChatOfflineMessageId':_0xf11565['id']};});_0x5b779c=_0xa4fd81[_0xde6c('0x3f')](_0x1f1814=>{var _0x3fae8e={'filename':_0x1f1814['name'],'path':path['join'](config['root'],_0xde6c('0xe0'),_0xde6c('0xd3'),_0xde6c('0xe1'),'offline-chat',_0x1f1814[_0xde6c('0xe2')])};return _0x3fae8e;});if(!_0x2546df[_0xde6c('0xe3')]){return db[_0xde6c('0xe4')][_0xde6c('0xe5')](function(_0x3b0735){return db[_0xde6c('0xe6')]['bulkCreate'](_0xa4fd81,{'transaction':_0x3b0735});});}}})[_0xde6c('0x37')](function(){if(_0x16a0c3){_0x5b672c=_0x16a0c3;return db[_0xde6c('0xd9')][_0xde6c('0x6a')]({'where':{'active':!![]},'include':[{'model':db['MailServerOut'],'as':_0xde6c('0xe7'),'raw':!![]}]});}})[_0xde6c('0x37')](function(_0x40697e){if(_0x40697e&&_0x40697e[_0xde6c('0xe7')]&&_0x2546df[_0xde6c('0xe8')]&&_0x2546df[_0xde6c('0xe9')]){var _0x40d0dd={'tls':{'rejectUnauthorized':![]}};if(_0x40697e['Smtp'][_0xde6c('0xea')]){_0x40d0dd[_0xde6c('0xea')]=_0x40697e['Smtp'][_0xde6c('0xea')];}else{_0x40d0dd[_0xde6c('0xeb')]=_0x40697e[_0xde6c('0xe7')][_0xde6c('0xeb')];_0x40d0dd['port']=_0x40697e[_0xde6c('0xe7')]['port'];_0x40d0dd[_0xde6c('0xec')]=_0x40697e[_0xde6c('0xe7')]['secure'];}if(_0x40697e[_0xde6c('0xe7')][_0xde6c('0xed')]){_0x40d0dd['auth']={'user':_0x40697e[_0xde6c('0xe7')][_0xde6c('0x60')],'pass':_0x40697e[_0xde6c('0xe7')][_0xde6c('0xee')]};}return respondWithRpcPromise('SendMail',_0xde6c('0xef'),{'account':_0x40d0dd,'message':{'from':util[_0xde6c('0xb4')](_0xde6c('0xf0'),_0x40697e['name'],_0x40697e[_0xde6c('0xf1')]||_0x40697e['Smtp'][_0xde6c('0x60')]),'to':_0x2546df['forwardOfflineAddress'],'subject':_0x2546df[_0xde6c('0xf2')],'html':_0x5b672c[_0xde6c('0x5d')],'attachments':_0x5b779c}},client9003)['then'](function(){return _0x5b672c;})[_0xde6c('0x57')](function(_0x2a1e7d){console[_0xde6c('0x27')](_0x2a1e7d);});}})[_0xde6c('0x37')](function(){if(_0x2546df&&_0x2546df[_0xde6c('0xe3')]&&_0x2546df[_0xde6c('0xf3')]){var _0x4a8c40=[];if(_0x2f791e['length']){_0x4a8c40=_0x2f791e[_0xde6c('0x3f')](function(_0x3caad9){return{'name':_0x3caad9[_0xde6c('0xdf')],'basename':_0x3caad9[_0xde6c('0x72')],'type':_0x3caad9['mimetype'],'ChatOfflineMessageId':_0x16a0c3['id']};});}var _0x4ec01d;if(!_[_0xde6c('0x82')](_0x2546df['subjectOffline'])){var _0x37b39e=_[_0xde6c('0x3f')](_0x556bfb[_0xde6c('0x5d')],function(_0x36327d){return _0x36327d;});var _0x5ccbce=_[_0xde6c('0xf4')](_0x37b39e)[0x0];var _0x17e6d7=_[_0xde6c('0xf5')](_0x5ccbce,function(_0x5d915f){return _0x5d915f;});_0x4ec01d=_0x17e6d7[0x1][_0x2546df[_0xde6c('0xf6')]];}var _0x2c73da={'from':_0x1ad556[_0xde6c('0xf1')],'firstName':_0x1ad556[_0xde6c('0xc3')],'lastName':_0x1ad556[_0xde6c('0xaf')],'mapKey':_0xde6c('0xf1'),'message':{'from':_0x1ad556[_0xde6c('0xf1')],'to':_0x2546df[_0xde6c('0xd9')][_0xde6c('0xf1')],'cc':'','subject':_[_0xde6c('0x82')](_0x4ec01d)?_0x2546df[_0xde6c('0xf2')]:_0x4ec01d,'messageId':'','sentAt':new Date(),'attach':_0x4a8c40[_0xde6c('0x4b')],'attachments':_0x4a8c40,'originChannel':_0xde6c('0xf7'),'ChatWebsiteId':_0x2546df['id'],'ChatOfflineMessageId':_0x5b672c['id'],'originTo':_0x2546df[_0xde6c('0xd9')]['email']},'body':_0x5b672c[_0xde6c('0x5d')]};var _0x293a86={'account':{'id':_0x2546df['MailAccountId']},'body':_0x2c73da,'log':_0xde6c('0xf8')};return respondWithRpcPromise(_0xde6c('0xf8'),_0xde6c('0xf9'),_0x293a86,client9001)[_0xde6c('0x37')](function(){return _0x5b672c;})[_0xde6c('0x57')](function(_0x4bce26){console['error'](_0x4bce26);});}return;})[_0xde6c('0x37')](function(){if(_0x5b672c){return _0x5b672c;}})[_0xde6c('0x37')](respondWithResult(_0x1c71e8,null))['catch'](function(_0x3bbe51){console[_0xde6c('0x27')]('catch',_0x3bbe51);for(var _0x50dd3f of _0x2f791e){var _0x4d74eb=path['join'](config[_0xde6c('0x78')],_0xde6c('0xe0'),_0xde6c('0xd3'),_0xde6c('0xe1'),'offline-chat',_0x50dd3f[_0xde6c('0x72')]);fs_extra[_0xde6c('0xfa')](_0x4d74eb)[_0xde6c('0x57')](function(_0x47a072){console[_0xde6c('0x27')]('Could\x20not\x20remove\x20attachment\x20file',_0x4d74eb,_0x47a072);});}});};exports[_0xde6c('0xfb')]=function(_0x5abadd,_0x4f5edd,_0x13d269){return db[_0xde6c('0xc0')][_0xde6c('0x63')]({'where':{'id':_0x5abadd[_0xde6c('0x66')]['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x4f5edd,null))[_0xde6c('0x37')](function(_0x1cd38d){if(_0x1cd38d){return _0x1cd38d[_0xde6c('0xfb')](_0x5abadd[_0xde6c('0x5d')][_0xde6c('0x70')],_[_0xde6c('0xfc')](_0x5abadd[_0xde6c('0x5d')],[_0xde6c('0x70'),'id'])||{});}})[_0xde6c('0x37')](respondWithResult(_0x4f5edd,null))[_0xde6c('0x57')](handleError(_0x4f5edd,null));};exports['getInteractions']=function(_0x495e05,_0x111c43,_0x22b1c8){var _0xce2ab6={'raw':![],'where':{}};var _0x281df3={};var _0x2ccd12={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0x495e05[_0xde6c('0x66')]['id']}})['then'](handleEntityNotFound(_0x111c43,null))['then'](function(_0x1974b5){if(_0x1974b5){_0x281df3[_0xde6c('0x44')]=_[_0xde6c('0x45')](db[_0xde6c('0xc0')][_0xde6c('0x41')]);_0x281df3[_0xde6c('0x48')]=_[_0xde6c('0x45')](_0x495e05[_0xde6c('0x48')]);_0x281df3[_0xde6c('0x46')]=_[_0xde6c('0x47')](_0x281df3[_0xde6c('0x44')],_0x281df3[_0xde6c('0x48')]);_0xce2ab6[_0xde6c('0x49')]=_[_0xde6c('0x47')](_0x281df3['model'],qs['fields'](_0x495e05[_0xde6c('0x48')]['fields']));_0xce2ab6[_0xde6c('0x49')]=_0xce2ab6[_0xde6c('0x49')][_0xde6c('0x4b')]?_0xce2ab6[_0xde6c('0x49')]:_0x281df3[_0xde6c('0x44')];if(!_0x495e05[_0xde6c('0x48')][_0xde6c('0x4c')]('nolimit')){_0xce2ab6['limit']=qs[_0xde6c('0x30')](_0x495e05['query'][_0xde6c('0x30')]);_0xce2ab6[_0xde6c('0x32')]=qs[_0xde6c('0x32')](_0x495e05['query'][_0xde6c('0x32')]);}_0xce2ab6['order']=qs[_0xde6c('0x4e')](_0x495e05[_0xde6c('0x48')][_0xde6c('0x4e')]);_0xce2ab6[_0xde6c('0x4f')]=qs[_0xde6c('0x46')](_['pick'](_0x495e05[_0xde6c('0x48')],_0x281df3[_0xde6c('0x46')]));_0xce2ab6[_0xde6c('0x4f')][_0xde6c('0x68')]=_0x1974b5['id'];if(_0x495e05[_0xde6c('0x48')]['filter']){_0xce2ab6[_0xde6c('0x4f')]=_[_0xde6c('0x52')](_0xce2ab6[_0xde6c('0x4f')],{'$or':_['map'](_0xce2ab6[_0xde6c('0x49')],function(_0x160088){var _0x6b86e9={};_0x6b86e9[_0x160088]={'$like':'%'+_0x495e05[_0xde6c('0x48')][_0xde6c('0x51')]+'%'};return _0x6b86e9;})});}_0xce2ab6=_[_0xde6c('0x52')]({},_0xce2ab6,_0x495e05['options']);return db['ChatInteraction'][_0xde6c('0x31')]({'where':_0xce2ab6['where']})[_0xde6c('0x37')](function(_0x353cae){_0x2ccd12[_0xde6c('0x31')]=_0x353cae;if(_0x495e05[_0xde6c('0x48')][_0xde6c('0x5a')]){_0xce2ab6[_0xde6c('0x5b')]=[{'model':db['CmContact'],'as':_0xde6c('0xfd'),'required':![]},{'model':db[_0xde6c('0xfe')],'as':'Owner','attributes':[_0xde6c('0x3c'),_0xde6c('0xff'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xde6c('0x100'),'attributes':['id','name',_0xde6c('0x101')],'where':_0x495e05[_0xde6c('0x48')][_0xde6c('0x102')]?{'id':_0x495e05[_0xde6c('0x48')][_0xde6c('0x102')]}:undefined,'required':_0x495e05[_0xde6c('0x48')][_0xde6c('0x102')]?!![]:![]}];}return db['ChatInteraction'][_0xde6c('0x55')](_0xce2ab6);})[_0xde6c('0x37')](function(_0x371cf3){_0x2ccd12[_0xde6c('0x56')]=_0x371cf3;return _0x2ccd12;});}})[_0xde6c('0x37')](respondWithFilteredResult(_0x111c43,_0xce2ab6))['catch'](handleError(_0x111c43,null));};function iftimePromise(_0x10eb93,_0x461b65){return respondWithRpcPromise('Command','getSnippet',{'command':_0x461b65[_0xde6c('0x103')]?util[_0xde6c('0xb4')](_0xde6c('0x104'),_0x10eb93[_0xde6c('0x105')],_0x461b65[_0xde6c('0x103')]):util[_0xde6c('0xb4')](_0xde6c('0x106'),_0x10eb93['interval'])},client9002)['then'](function(_0x22ced1){var _0x3d6e67=_0x22ced1&&_0x22ced1[_0xde6c('0x107')](_0xde6c('0x108'))>=0x0?!![]:![];logger[_0xde6c('0x22')](_0xde6c('0x109'),_0x461b65['id'],_0x10eb93['id'],_0x10eb93[_0xde6c('0x105')],_0x3d6e67?_0xde6c('0x10a'):_0xde6c('0x10b'),_0x461b65[_0xde6c('0x103')]?_0x461b65['timezone']:_0xde6c('0x10c'));return _0x3d6e67;})[_0xde6c('0x57')](function(_0x2c7b96){logger[_0xde6c('0x27')](_0xde6c('0x109'),_0x461b65['id'],_0x10eb93['id'],_0x10eb93[_0xde6c('0x105')],util[_0xde6c('0x10d')](_0x2c7b96,{'showHidden':![],'depth':null}),_0x461b65[_0xde6c('0x103')]?_0x461b65[_0xde6c('0x103')]:_0xde6c('0x10c'));return![];});}exports[_0xde6c('0x10e')]=function(_0x37111a,_0x36c155,_0x4f9bbe){var _0x2fc3e9=0x0;var _0x5b438e=0x0;var _0xc23d0a=![];var _0x51bb09;var _0x4903f9;return db[_0xde6c('0x40')][_0xde6c('0x63')]({'where':{'id':_0x37111a['params']['id']},'include':[{'model':db[_0xde6c('0x10f')],'as':_0xde6c('0x10f'),'include':[{'model':db[_0xde6c('0x10f')],'as':_0xde6c('0x110'),'attributes':['id',_0xde6c('0x105')],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x36c155,null))[_0xde6c('0x37')](function(_0x1786b4){if(_0x1786b4){_0x51bb09=_0x1786b4;return _0x1786b4['getProactiveActions']({'raw':!![]});}})[_0xde6c('0x37')](function(_0x50e497){if(_0x51bb09){if(_0x50e497){_0x4903f9=_0x50e497;}}return require(_0xde6c('0x7b'))['getLicense']();})[_0xde6c('0x37')](function(_0x2e6f0f){if(_0x2e6f0f){_0x5b438e=_0x2e6f0f['virtual'];_0xc23d0a=_0x2e6f0f[_0xde6c('0x7c')];}})[_0xde6c('0x37')](function(){return db['ChatInteraction'][_0xde6c('0x31')]({'where':{'closed':![]}});})[_0xde6c('0x37')](function(_0x325125){_0x2fc3e9=_0x325125;if(_0x5b438e&&_0x325125>_0x5b438e){return db[_0xde6c('0x111')][_0xde6c('0x6a')]({'where':{'id':0x1}})[_0xde6c('0x37')](function(_0xa0723a){if(_0xa0723a){_0xa0723a[_0xde6c('0x112')](_0xde6c('0x113'));}});}})[_0xde6c('0x37')](function(){if(_0x51bb09[_0xde6c('0x10f')]&&_0x51bb09[_0xde6c('0x10f')][_0xde6c('0x110')]){var _0x1bd2ab=[];for(var _0x699f10=0x0;_0x699f10<_0x51bb09[_0xde6c('0x10f')][_0xde6c('0x110')][_0xde6c('0x4b')];_0x699f10++){var _0xe0aa0b=_0x51bb09['Interval'][_0xde6c('0x110')][_0x699f10][_0xde6c('0x39')]({'plain':!![]});_0x1bd2ab[_0xde6c('0xc7')](iftimePromise(_0xe0aa0b,_0x51bb09));}return BPromise[_0xde6c('0x114')](_0x1bd2ab)['then'](function(_0x5d6872){return _[_0xde6c('0x115')](_0x5d6872);});}else{return!![];}})[_0xde6c('0x37')](function(_0x18e6ce){var _0x90c03a=fs[_0xde6c('0x116')](path[_0xde6c('0x77')](config[_0xde6c('0x78')],_0xde6c('0x117')),_0xde6c('0x118'));var _0x2610d9={'remote':_0x51bb09[_0xde6c('0x119')],'query':querystring[_0xde6c('0xbb')](_['merge'](_0x51bb09[_0xde6c('0x39')]({'plain':!![]}),{'customerIp':_0x37111a[_0xde6c('0xaa')][_0xde6c('0xad')]||_0x37111a[_0xde6c('0xaa')]['x-real-ip']||_0x37111a[_0xde6c('0x11a')][_0xde6c('0x11b')]||_0x37111a['ip'],'referer':_0x37111a[_0xde6c('0xaa')][_0xde6c('0xb1')],'openedInteractions':_0x2fc3e9,'maxInteractions':_0x5b438e,'virtual':_0xc23d0a[_0xde6c('0x11c')],'online':_0x18e6ce,'custom':_0xc23d0a}))['replace'](/'/g,'\x5c\x27')};_0x36c155[_0xde6c('0xd4')](ejs['render'](Mustache[_0xde6c('0xdc')](_0x90c03a,_0x2610d9),{'proactiveActions':_0x4903f9,'alignment':_0x51bb09['alignment'],'verticalAlignment':_0x51bb09['verticalAlignment'],'div_color':_0x51bb09['color'],'text_color':_0x51bb09[_0xde6c('0x11d')],'button_color':_0x51bb09[_0xde6c('0x11e')],'background_color':_0x51bb09[_0xde6c('0x11f')]}));})[_0xde6c('0x57')](handleError(_0x36c155,null));};exports['addApplications']=function(_0x731606,_0x3fccd0,_0x442320){return db[_0xde6c('0x40')][_0xde6c('0x6a')]({'where':{'id':_0x731606['params']['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x3fccd0,null))['then'](function(_0x341276){if(_0x341276){return db['sequelize'][_0xde6c('0xe5')](function(_0x41c719){return db[_0xde6c('0xa1')][_0xde6c('0x38')]({'where':{'ChatWebsiteId':_0x731606[_0xde6c('0x66')]['id']},'transaction':_0x41c719})[_0xde6c('0x37')](function(_0x1c4374){var _0xf79b36=_[_0xde6c('0x3f')](_0x731606['body'],function(_0x27e343){_0x27e343[_0xde6c('0x68')]=_0x731606['params']['id'];return _0x27e343;});return db['ChatApplication']['bulkCreate'](_0xf79b36,{'transaction':_0x41c719});});})[_0xde6c('0x37')](function(){return db['ChatApplication'][_0xde6c('0x120')]({'where':{'ChatWebsiteId':_0x731606[_0xde6c('0x66')]['id']},'order':'priority'});});}})[_0xde6c('0x37')](respondWithResult(_0x3fccd0,null))[_0xde6c('0x57')](handleError(_0x3fccd0,null));};exports[_0xde6c('0x121')]=function(_0x395dc9,_0x490134,_0x53c7bb){var _0x55a2d2={};var _0xba35f={};var _0x2df196;var _0x39ce24;return db[_0xde6c('0x40')][_0xde6c('0x6a')]({'where':{'id':_0x395dc9['params']['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x490134,null))[_0xde6c('0x37')](function(_0x41d28d){if(_0x41d28d){_0x2df196=_0x41d28d;_0xba35f['model']=_['keys'](db[_0xde6c('0xa1')][_0xde6c('0x41')]);_0xba35f[_0xde6c('0x48')]=_[_0xde6c('0x45')](_0x395dc9[_0xde6c('0x48')]);_0xba35f[_0xde6c('0x46')]=_[_0xde6c('0x47')](_0xba35f['model'],_0xba35f[_0xde6c('0x48')]);_0x55a2d2[_0xde6c('0x49')]=_[_0xde6c('0x47')](_0xba35f[_0xde6c('0x44')],qs[_0xde6c('0x4a')](_0x395dc9[_0xde6c('0x48')]['fields']));_0x55a2d2[_0xde6c('0x49')]=_0x55a2d2[_0xde6c('0x49')][_0xde6c('0x4b')]?_0x55a2d2[_0xde6c('0x49')]:_0xba35f[_0xde6c('0x44')];_0x55a2d2[_0xde6c('0x6e')]=qs[_0xde6c('0x4e')](_0x395dc9[_0xde6c('0x48')]['sort']);_0x55a2d2[_0xde6c('0x4f')]=qs[_0xde6c('0x46')](_[_0xde6c('0x50')](_0x395dc9[_0xde6c('0x48')],_0xba35f['filters']));if(_0x395dc9[_0xde6c('0x48')]['filter']){_0x55a2d2[_0xde6c('0x4f')]=_[_0xde6c('0x52')](_0x55a2d2['where'],{'$or':_[_0xde6c('0x3f')](_0x55a2d2[_0xde6c('0x49')],function(_0x462dc0){var _0x45d865={};_0x45d865[_0x462dc0]={'$like':'%'+_0x395dc9['query'][_0xde6c('0x51')]+'%'};return _0x45d865;})});}_0x55a2d2=_[_0xde6c('0x52')]({},_0x55a2d2,_0x395dc9[_0xde6c('0x54')]);return _0x2df196['getApplications'](_0x55a2d2);}})['then'](function(_0x3036d7){if(_0x3036d7){_0x39ce24=_0x3036d7[_0xde6c('0x4b')];if(!_0x395dc9[_0xde6c('0x48')][_0xde6c('0x4c')]('nolimit')){_0x55a2d2[_0xde6c('0x30')]=qs['limit'](_0x395dc9[_0xde6c('0x48')]['limit']);_0x55a2d2['offset']=qs[_0xde6c('0x32')](_0x395dc9[_0xde6c('0x48')][_0xde6c('0x32')]);}return _0x2df196[_0xde6c('0x121')](_0x55a2d2);}})[_0xde6c('0x37')](function(_0x5291e4){if(_0x5291e4){return _0x5291e4?{'count':_0x39ce24,'rows':_0x5291e4}:null;}})[_0xde6c('0x37')](respondWithResult(_0x490134,null))[_0xde6c('0x57')](handleError(_0x490134,null));};exports[_0xde6c('0x122')]=function(_0x1234bc,_0x2a875e,_0x38bd9d){return db[_0xde6c('0x123')]['find']({'where':{'id':_0x1234bc['params']['id']}})['then'](handleEntityNotFound(_0x2a875e,null))[_0xde6c('0x37')](function(_0x2da21a){if(_0x2da21a){return _0x2da21a['addProactiveActions'](_0x1234bc['body'][_0xde6c('0x70')],_[_0xde6c('0xfc')](_0x1234bc[_0xde6c('0x5d')],[_0xde6c('0x70'),'id'])||{});}})['then'](respondWithResult(_0x2a875e,null))[_0xde6c('0x57')](handleError(_0x2a875e,null));};exports[_0xde6c('0x124')]=function(_0x6cbb68,_0x2ab21e,_0x25531a){var _0x355428={};var _0x220a5c={};var _0x3dac78;var _0x15c07e;return db[_0xde6c('0x40')][_0xde6c('0x6a')]({'where':{'id':_0x6cbb68['params']['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x2ab21e,null))[_0xde6c('0x37')](function(_0x3a1c50){if(_0x3a1c50){_0x3dac78=_0x3a1c50;_0x220a5c[_0xde6c('0x44')]=_[_0xde6c('0x45')](db[_0xde6c('0x125')][_0xde6c('0x41')]);_0x220a5c[_0xde6c('0x48')]=_['keys'](_0x6cbb68[_0xde6c('0x48')]);_0x220a5c[_0xde6c('0x46')]=_['intersection'](_0x220a5c[_0xde6c('0x44')],_0x220a5c[_0xde6c('0x48')]);_0x355428[_0xde6c('0x49')]=_[_0xde6c('0x47')](_0x220a5c[_0xde6c('0x44')],qs[_0xde6c('0x4a')](_0x6cbb68[_0xde6c('0x48')][_0xde6c('0x4a')]));_0x355428['attributes']=_0x355428[_0xde6c('0x49')][_0xde6c('0x4b')]?_0x355428[_0xde6c('0x49')]:_0x220a5c[_0xde6c('0x44')];_0x355428['order']=qs['sort'](_0x6cbb68[_0xde6c('0x48')][_0xde6c('0x4e')]);_0x355428[_0xde6c('0x4f')]=qs['filters'](_['pick'](_0x6cbb68[_0xde6c('0x48')],_0x220a5c[_0xde6c('0x46')]));if(_0x6cbb68['query'][_0xde6c('0x51')]){_0x355428[_0xde6c('0x4f')]=_[_0xde6c('0x52')](_0x355428['where'],{'$or':_[_0xde6c('0x3f')](_0x355428[_0xde6c('0x49')],function(_0x1c0220){var _0x6da5e3={};_0x6da5e3[_0x1c0220]={'$like':'%'+_0x6cbb68['query']['filter']+'%'};return _0x6da5e3;})});}_0x355428=_[_0xde6c('0x52')]({},_0x355428,_0x6cbb68[_0xde6c('0x54')]);return _0x3dac78[_0xde6c('0x124')](_0x355428);}})[_0xde6c('0x37')](function(_0x4a8993){if(_0x4a8993){_0x15c07e=_0x4a8993[_0xde6c('0x4b')];if(!_0x6cbb68[_0xde6c('0x48')][_0xde6c('0x4c')](_0xde6c('0x4d'))){_0x355428[_0xde6c('0x30')]=qs[_0xde6c('0x30')](_0x6cbb68['query'][_0xde6c('0x30')]);_0x355428[_0xde6c('0x32')]=qs[_0xde6c('0x32')](_0x6cbb68[_0xde6c('0x48')][_0xde6c('0x32')]);}return _0x3dac78[_0xde6c('0x124')](_0x355428);}})[_0xde6c('0x37')](function(_0xe39a6f){if(_0xe39a6f){return _0xe39a6f?{'count':_0x15c07e,'rows':_0xe39a6f}:null;}})['then'](respondWithResult(_0x2ab21e,null))['catch'](handleError(_0x2ab21e,null));};exports[_0xde6c('0x126')]=function(_0x3083ca,_0x1ca992,_0xfa4251){var _0x23f038=_0x3083ca[_0xde6c('0x48')]['online']===_0xde6c('0x127')?_0xde6c('0x128'):_0xde6c('0x129');return db[_0xde6c('0x40')][_0xde6c('0x63')]({'attributes':['id',_0x23f038],'where':{'id':_0x3083ca['params']['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x1ca992,null))[_0xde6c('0x37')](function(_0x2cff8b){if(_0x2cff8b){var _0x5659df=_0x2cff8b[_0x23f038];var _0x59c04a=_0x5659df&&_0x5659df[_0xde6c('0x12a')]?_0x5659df[_0xde6c('0x12a')]:[];_0x1ca992[_0xde6c('0xd4')]({'fromKey':_[_0xde6c('0x82')](_0x5659df[_0xde6c('0x12b')])?undefined:_0x5659df[_0xde6c('0x12b')],'count':_0x59c04a[_0xde6c('0x4b')],'rows':_0x59c04a});}})[_0xde6c('0x57')](handleError(_0x1ca992,null));};exports[_0xde6c('0x12c')]=function(_0xf8c735,_0x23c320,_0x5becbd){var _0x5a7f56={'raw':![],'where':{}};var _0x1da3e8={};var _0x7ffe43={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xde6c('0x6a')]({'where':{'id':_0xf8c735['params']['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x23c320,null))[_0xde6c('0x37')](function(_0x161062){if(_0x161062){_0x1da3e8['model']=_[_0xde6c('0x45')](db[_0xde6c('0xde')][_0xde6c('0x41')]);_0x1da3e8['query']=_[_0xde6c('0x45')](_0xf8c735[_0xde6c('0x48')]);_0x1da3e8[_0xde6c('0x46')]=_[_0xde6c('0x47')](_0x1da3e8[_0xde6c('0x44')],_0x1da3e8[_0xde6c('0x48')]);_0x5a7f56[_0xde6c('0x49')]=_['intersection'](_0x1da3e8[_0xde6c('0x44')],qs[_0xde6c('0x4a')](_0xf8c735[_0xde6c('0x48')][_0xde6c('0x4a')]));_0x5a7f56[_0xde6c('0x49')]=_0x5a7f56[_0xde6c('0x49')][_0xde6c('0x4b')]?_0x5a7f56[_0xde6c('0x49')]:_0x1da3e8[_0xde6c('0x44')];if(!_0xf8c735[_0xde6c('0x48')][_0xde6c('0x4c')](_0xde6c('0x4d'))){_0x5a7f56[_0xde6c('0x30')]=qs[_0xde6c('0x30')](_0xf8c735['query']['limit']);_0x5a7f56[_0xde6c('0x32')]=qs[_0xde6c('0x32')](_0xf8c735[_0xde6c('0x48')][_0xde6c('0x32')]);}_0x5a7f56[_0xde6c('0x6e')]=qs[_0xde6c('0x4e')](_0xf8c735[_0xde6c('0x48')]['sort']);_0x5a7f56[_0xde6c('0x4f')]=qs[_0xde6c('0x46')](_['pick'](_0xf8c735['query'],_0x1da3e8[_0xde6c('0x46')]));_0x5a7f56[_0xde6c('0x4f')][_0xde6c('0x68')]=_0x161062['id'];if(_0xf8c735[_0xde6c('0x48')]['filter']){_0x5a7f56[_0xde6c('0x4f')]=_['merge'](_0x5a7f56[_0xde6c('0x4f')],{'$or':_[_0xde6c('0x3f')](_0x5a7f56[_0xde6c('0x49')],function(_0x541223){var _0x4ab638={};_0x4ab638[_0x541223]={'$like':'%'+_0xf8c735[_0xde6c('0x48')][_0xde6c('0x51')]+'%'};return _0x4ab638;})});}_0x5a7f56=_[_0xde6c('0x52')]({},_0x5a7f56,_0xf8c735['options']);return db[_0xde6c('0xde')][_0xde6c('0x31')]({'where':_0x5a7f56[_0xde6c('0x4f')]})[_0xde6c('0x37')](function(_0x30d5a2){_0x7ffe43[_0xde6c('0x31')]=_0x30d5a2;if(_0xf8c735[_0xde6c('0x48')][_0xde6c('0x5a')]){_0x5a7f56[_0xde6c('0x5b')]=[{'all':!![]}];}else{_0x5a7f56['include']=[{'model':db['CmContact'],'as':_0xde6c('0xfd'),'required':![]},{'model':db[_0xde6c('0xe6')],'as':_0xde6c('0x12d'),'required':![]}];}return db[_0xde6c('0xde')]['findAll'](_0x5a7f56);})[_0xde6c('0x37')](function(_0x46d1f8){_0x7ffe43[_0xde6c('0x56')]=_0x46d1f8;return _0x7ffe43;});}})[_0xde6c('0x37')](respondWithFilteredResult(_0x23c320,_0x5a7f56))[_0xde6c('0x57')](handleError(_0x23c320,null));};exports['addAgents']=function(_0x56a33e,_0x1017fe,_0x3ed1a7){return db[_0xde6c('0x40')]['find']({'where':{'id':_0x56a33e['params']['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x1017fe,null))[_0xde6c('0x37')](function(_0x515675){if(_0x515675){return _0x515675[_0xde6c('0x12e')](_0x56a33e['body'][_0xde6c('0x70')],_[_0xde6c('0xfc')](_0x56a33e[_0xde6c('0x5d')],[_0xde6c('0x70'),'id'])||{})[_0xde6c('0xc1')](function(_0x3dc71f){for(var _0x18a8db=0x0;_0x18a8db<_0x56a33e[_0xde6c('0x5d')][_0xde6c('0x70')][_0xde6c('0x4b')];_0x18a8db+=0x1){socket[_0xde6c('0x12f')]('userChatWebsite:save',{'UserId':Number(_0x56a33e[_0xde6c('0x5d')]['ids'][_0x18a8db]),'ChatWebsiteId':Number(_0x56a33e[_0xde6c('0x66')]['id'])});}return _0x3dc71f;});}})[_0xde6c('0x37')](respondWithResult(_0x1017fe,null))['catch'](handleError(_0x1017fe,null));};exports['removeAgents']=function(_0x395c88,_0x10999c,_0x1d7289){return db[_0xde6c('0x40')]['find']({'where':{'id':_0x395c88[_0xde6c('0x66')]['id']}})[_0xde6c('0x37')](handleEntityNotFound(_0x10999c,null))[_0xde6c('0x37')](function(_0x5907a3){if(_0x5907a3){return _0x5907a3['removeAgents'](_0x395c88['query']['ids'])[_0xde6c('0x37')](function(){if(_['isArray'](_0x395c88[_0xde6c('0x48')][_0xde6c('0x70')])){for(var _0x5dbe71=0x0;_0x5dbe71<_0x395c88[_0xde6c('0x48')]['ids'][_0xde6c('0x4b')];_0x5dbe71+=0x1){socket[_0xde6c('0x12f')](_0xde6c('0x130'),{'UserId':Number(_0x395c88[_0xde6c('0x48')]['ids'][_0x5dbe71]),'ChatWebsiteId':Number(_0x395c88[_0xde6c('0x66')]['id'])});}}else{socket[_0xde6c('0x12f')](_0xde6c('0x130'),{'UserId':Number(_0x395c88['query'][_0xde6c('0x70')]),'ChatWebsiteId':Number(_0x395c88[_0xde6c('0x66')]['id'])});}});}})['then'](respondWithStatusCode(_0x10999c,null))[_0xde6c('0x57')](handleError(_0x10999c,null));};exports[_0xde6c('0x131')]=function(_0x5b4dc7,_0x51c71f,_0x3a45ee){var _0x26733a={};var _0x45b4e9={};var _0x42af12;var _0x331fac;return db[_0xde6c('0x40')][_0xde6c('0x6a')]({'where':{'id':_0x5b4dc7[_0xde6c('0x66')]['id']}})['then'](handleEntityNotFound(_0x51c71f,null))[_0xde6c('0x37')](function(_0x3f0a15){if(_0x3f0a15){_0x42af12=_0x3f0a15;_0x45b4e9[_0xde6c('0x44')]=_[_0xde6c('0x45')](db[_0xde6c('0xfe')][_0xde6c('0x41')]);_0x45b4e9[_0xde6c('0x48')]=_[_0xde6c('0x45')](_0x5b4dc7[_0xde6c('0x48')]);_0x45b4e9[_0xde6c('0x46')]=_['intersection'](_0x45b4e9[_0xde6c('0x44')],_0x45b4e9['query']);_0x26733a[_0xde6c('0x49')]=_['intersection'](_0x45b4e9['model'],qs[_0xde6c('0x4a')](_0x5b4dc7[_0xde6c('0x48')][_0xde6c('0x4a')]));_0x26733a[_0xde6c('0x49')]=_0x26733a[_0xde6c('0x49')][_0xde6c('0x4b')]?_0x26733a['attributes']:_0x45b4e9[_0xde6c('0x44')];_0x26733a['order']=qs[_0xde6c('0x4e')](_0x5b4dc7[_0xde6c('0x48')][_0xde6c('0x4e')]);_0x26733a[_0xde6c('0x4f')]=qs[_0xde6c('0x46')](_['pick'](_0x5b4dc7[_0xde6c('0x48')],_0x45b4e9[_0xde6c('0x46')]));if(_0x5b4dc7[_0xde6c('0x48')][_0xde6c('0x51')]){_0x26733a[_0xde6c('0x4f')]=_[_0xde6c('0x52')](_0x26733a[_0xde6c('0x4f')],{'$or':_[_0xde6c('0x3f')](_0x26733a[_0xde6c('0x49')],function(_0x540c5d){var _0x8a1318={};_0x8a1318[_0x540c5d]={'$like':'%'+_0x5b4dc7[_0xde6c('0x48')][_0xde6c('0x51')]+'%'};return _0x8a1318;})});}_0x26733a=_[_0xde6c('0x52')]({},_0x26733a,_0x5b4dc7['options']);return _0x42af12[_0xde6c('0x131')](_0x26733a);}})[_0xde6c('0x37')](function(_0x57de5f){if(_0x57de5f){_0x331fac=_0x57de5f[_0xde6c('0x4b')];if(!_0x5b4dc7['query']['hasOwnProperty'](_0xde6c('0x4d'))){_0x26733a[_0xde6c('0x30')]=qs[_0xde6c('0x30')](_0x5b4dc7[_0xde6c('0x48')]['limit']);_0x26733a['offset']=qs[_0xde6c('0x32')](_0x5b4dc7[_0xde6c('0x48')][_0xde6c('0x32')]);}return _0x42af12[_0xde6c('0x131')](_0x26733a);}})[_0xde6c('0x37')](function(_0x50b621){if(_0x50b621){return _0x50b621?{'count':_0x331fac,'rows':_0x50b621}:null;}})['then'](respondWithResult(_0x51c71f,null))[_0xde6c('0x57')](handleError(_0x51c71f,null));}; \ No newline at end of file +var _0xa60b=['Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','CmContact','List','account','list','applications','Applications','Contacts','contact','customerIp','cf-connecting-ip','headers','x-forwarded-for','split','firstName','x-real-port','referer','browser','version','format','unknown','%s\x20%s','device','vendor','%s\x20%s\x20%s','threadId','ChatInteraction','externalUrl','interaction','spread','lastName','messageId','created','push','close','unmanaged','ChatMessage','AttachmentId','UserId','User','unshift','waitForTheAssignedAgent','*,*,*,*','forcedOwnership','startRouting','Start','EventManager','offline','files','from\x20is\x20mandatory','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline','MailAccount','findOrCreate','readFileSync','utf8','render','toPairs','offlineMessageBody','ChatOfflineMessage','originalname','server','attachments','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','service','host','port','secure','authentication','auth','pass','SendMail','sendMail','\x22%s\x22\x20<%s>','email','forwardOfflineAddress','offlineMessageSubject','MailAccountId','mimetype','subjectOffline','Chat','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','omit','Contact','Owner','fullname','Tag','Tags','color','tag','Command','getSnippet','timezone','iftime\x20%s','interval','indexOf','true','ONLINE','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','No\x20timezone','Interval','Intervals','getProactiveActions','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','remote','x-real-ip','remoteAddress','virtual','alignment','textColor','backgroundColor','addApplications','transaction','ChatApplication','findAndCountAll','priority','getApplications','chatProactiveAction','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','Attachments','addAgents','emit','isArray','userChatWebsite:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','register','jayson/promise','client','http','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','then','destroy','get','ChatWebsites','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','ChatWebsite','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getDispositions','findOne','Disposition','hasOwnProperty','ChatWebsiteId','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','../../config/license/util','getLicense','custom','isNil','existsSync','server/files/images/logos/','download','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','notify','user-agent-parser','setUA','user-agent','getResult','ValidationError','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from'];(function(_0x526272,_0x3b4b17){var _0x5e2e58=function(_0x3f4a90){while(--_0x3f4a90){_0x526272['push'](_0x526272['shift']());}};_0x5e2e58(++_0x3b4b17);}(_0xa60b,0x1ca));var _0xba60=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0xa60b[_0x13d07a];return _0x5ee0ee;};'use strict';var emlformat=require(_0xba60('0x0'));var rimraf=require(_0xba60('0x1'));var zipdir=require(_0xba60('0x2'));var jsonpatch=require(_0xba60('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xba60('0x4'));var Mustache=require(_0xba60('0x5'));var util=require(_0xba60('0x6'));var path=require('path');var sox=require(_0xba60('0x7'));var csv=require(_0xba60('0x8'));var ejs=require(_0xba60('0x9'));var fs=require('fs');var fs_extra=require(_0xba60('0xa'));var _=require('lodash');var squel=require(_0xba60('0xb'));var crypto=require('crypto');var jsforce=require(_0xba60('0xc'));var deskjs=require(_0xba60('0xd'));var toCsv=require(_0xba60('0x8'));var querystring=require(_0xba60('0xe'));var Papa=require('papaparse');var Redis=require(_0xba60('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xba60('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xba60('0x11'));var logger=require(_0xba60('0x12'))('api');var utils=require(_0xba60('0x13'));var config=require(_0xba60('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0xba60('0x15'))['db'];config[_0xba60('0x16')]=_[_0xba60('0x17')](config[_0xba60('0x16')],{'host':_0xba60('0x18'),'port':0x18eb});var socket=require(_0xba60('0x19'))(new Redis(config[_0xba60('0x16')]));require(_0xba60('0x1a'))[_0xba60('0x1b')](socket);var jayson=require(_0xba60('0x1c'));var client=jayson[_0xba60('0x1d')][_0xba60('0x1e')]({'port':0x232c});var client9002=jayson[_0xba60('0x1d')][_0xba60('0x1e')]({'port':0x232a});var client9003=jayson[_0xba60('0x1d')]['http']({'port':0x232b});var client9001=jayson[_0xba60('0x1d')]['http']({'port':0x2329});function respondWithRpcPromise(_0x23656b,_0x559608,_0x5da9d6,_0x41e72d){return new BPromise(function(_0xa4cf68,_0x541409){var _0x1d2bc8=_0x41e72d||client;return _0x1d2bc8[_0xba60('0x1f')](_0x23656b,_0x5da9d6)['then'](function(_0x212e2a){logger[_0xba60('0x20')](_0xba60('0x21'),_0x559608,_0xba60('0x22'));logger[_0xba60('0x23')](_0xba60('0x24'),_0x559608,_0xba60('0x22'),JSON[_0xba60('0x25')](_0x212e2a));if(_0x212e2a[_0xba60('0x26')]){if(_0x212e2a[_0xba60('0x26')][_0xba60('0x27')]===0x1f4){logger[_0xba60('0x26')]('ChatWebsite,\x20%s,\x20%s',_0x559608,_0x212e2a['error']['message']);return _0x541409(_0x212e2a[_0xba60('0x26')][_0xba60('0x28')]);}logger[_0xba60('0x26')](_0xba60('0x21'),_0x559608,_0x212e2a[_0xba60('0x26')][_0xba60('0x28')]);return _0xa4cf68(_0x212e2a[_0xba60('0x26')][_0xba60('0x28')]);}else{logger[_0xba60('0x20')](_0xba60('0x21'),_0x559608,'request\x20sent');_0xa4cf68(_0x212e2a[_0xba60('0x29')]['message']);}})[_0xba60('0x2a')](function(_0x16cc33){logger['error'](_0xba60('0x21'),_0x559608,_0x16cc33);_0x541409(_0x16cc33);});});}function respondWithStatusCode(_0x55b3cb,_0x1816ac){_0x1816ac=_0x1816ac||0xcc;return function(_0x258a08){if(_0x258a08){return _0x55b3cb[_0xba60('0x2b')](_0x1816ac);}return _0x55b3cb['status'](_0x1816ac)[_0xba60('0x2c')]();};}function respondWithResult(_0x22b36d,_0xab4742){_0xab4742=_0xab4742||0xc8;return function(_0x35d6f9){if(_0x35d6f9){return _0x22b36d[_0xba60('0x2d')](_0xab4742)[_0xba60('0x2e')](_0x35d6f9);}};}function respondWithFilteredResult(_0x1d2a11,_0x2c049b){return function(_0x174d31){if(_0x174d31){var _0x51cb9d=typeof _0x2c049b[_0xba60('0x2f')]==='undefined'&&typeof _0x2c049b[_0xba60('0x30')]===_0xba60('0x31');var _0xaa711a=_0x174d31[_0xba60('0x32')];var _0x13b4c8=_0x51cb9d?0x0:_0x2c049b['offset'];var _0x363e77=_0x51cb9d?_0x174d31[_0xba60('0x32')]:_0x2c049b[_0xba60('0x2f')]+_0x2c049b['limit'];var _0x399cb6;if(_0x363e77>=_0xaa711a){_0x363e77=_0xaa711a;_0x399cb6=0xc8;}else{_0x399cb6=0xce;}_0x1d2a11[_0xba60('0x2d')](_0x399cb6);return _0x1d2a11[_0xba60('0x33')](_0xba60('0x34'),_0x13b4c8+'-'+_0x363e77+'/'+_0xaa711a)[_0xba60('0x2e')](_0x174d31);}return null;};}function patchUpdates(_0x2ad31d){return function(_0xc821c){try{jsonpatch[_0xba60('0x35')](_0xc821c,_0x2ad31d,!![]);}catch(_0x314ec1){return BPromise[_0xba60('0x36')](_0x314ec1);}return _0xc821c[_0xba60('0x37')]();};}function saveUpdates(_0x3ac62a,_0xc6d794){return function(_0x3b9703){if(_0x3b9703){return _0x3b9703['update'](_0x3ac62a)[_0xba60('0x38')](function(_0x138019){return _0x138019;});}return null;};}function removeEntity(_0x407483,_0x3b858c){return function(_0x5b0937){if(_0x5b0937){return _0x5b0937[_0xba60('0x39')]()[_0xba60('0x38')](function(){var _0x5f55cd=_0x5b0937[_0xba60('0x3a')]({'plain':!![]});var _0x518be3=_0xba60('0x3b');return db[_0xba60('0x3c')][_0xba60('0x39')]({'where':{'type':_0x518be3,'resourceId':_0x5f55cd['id']}})[_0xba60('0x38')](function(){return _0x5b0937;});})[_0xba60('0x38')](function(){_0x407483['status'](0xcc)[_0xba60('0x2c')]();});}};}function handleEntityNotFound(_0x59ceea,_0x3481b2){return function(_0x3f47b2){if(!_0x3f47b2){_0x59ceea[_0xba60('0x2b')](0x194);}return _0x3f47b2;};}function handleError(_0x2c3209,_0x408a33){_0x408a33=_0x408a33||0x1f4;return function(_0x7023f3){logger['error'](_0x7023f3[_0xba60('0x3d')]);if(_0x7023f3[_0xba60('0x3e')]){delete _0x7023f3[_0xba60('0x3e')];}_0x2c3209[_0xba60('0x2d')](_0x408a33)[_0xba60('0x3f')](_0x7023f3);};}exports[_0xba60('0x40')]=function(_0x42b818,_0x1f3c9b){var _0x37ffee={'include':[{'model':db[_0xba60('0x41')],'as':_0xba60('0x42')}]},_0x7294d6={},_0x5262c8={'count':0x0,'rows':[]};var _0x5e0010=_[_0xba60('0x43')](db[_0xba60('0x44')][_0xba60('0x45')],function(_0x4c38c4){return{'name':_0x4c38c4[_0xba60('0x46')],'type':_0x4c38c4[_0xba60('0x47')]['key']};});_0x7294d6[_0xba60('0x48')]=_[_0xba60('0x43')](_0x5e0010,_0xba60('0x3e'));_0x7294d6[_0xba60('0x49')]=_['keys'](_0x42b818['query']);_0x7294d6[_0xba60('0x4a')]=_[_0xba60('0x4b')](_0x7294d6[_0xba60('0x48')],_0x7294d6[_0xba60('0x49')]);_0x37ffee[_0xba60('0x4c')]=_[_0xba60('0x4b')](_0x7294d6[_0xba60('0x48')],qs[_0xba60('0x4d')](_0x42b818[_0xba60('0x49')][_0xba60('0x4d')]));_0x37ffee[_0xba60('0x4c')]=_0x37ffee[_0xba60('0x4c')]['length']?_0x37ffee['attributes']:_0x7294d6[_0xba60('0x48')];if(!_0x42b818[_0xba60('0x49')]['hasOwnProperty'](_0xba60('0x4e'))){_0x37ffee[_0xba60('0x30')]=qs[_0xba60('0x30')](_0x42b818['query'][_0xba60('0x30')]);_0x37ffee[_0xba60('0x2f')]=qs[_0xba60('0x2f')](_0x42b818['query'][_0xba60('0x2f')]);}_0x37ffee[_0xba60('0x4f')]=qs['sort'](_0x42b818['query'][_0xba60('0x50')]);_0x37ffee[_0xba60('0x51')]=qs['filters'](_[_0xba60('0x52')](_0x42b818[_0xba60('0x49')],_0x7294d6['filters']),_0x5e0010);if(_0x42b818[_0xba60('0x49')][_0xba60('0x53')]){_0x37ffee[_0xba60('0x51')]=_[_0xba60('0x54')](_0x37ffee[_0xba60('0x51')],{'$or':_[_0xba60('0x43')](_0x5e0010,function(_0x1c5e19){if(_0x1c5e19[_0xba60('0x47')]!==_0xba60('0x55')){var _0x3a6818={};_0x3a6818[_0x1c5e19[_0xba60('0x3e')]]={'$like':'%'+_0x42b818[_0xba60('0x49')][_0xba60('0x53')]+'%'};return _0x3a6818;}})});}_0x37ffee=_[_0xba60('0x54')]({},_0x37ffee,_0x42b818[_0xba60('0x56')]);var _0x3da65d={'where':_0x37ffee[_0xba60('0x51')]};return db[_0xba60('0x44')][_0xba60('0x32')](_0x3da65d)['then'](function(_0x51ce92){_0x5262c8[_0xba60('0x32')]=_0x51ce92;if(_0x42b818[_0xba60('0x49')][_0xba60('0x57')]){_0x37ffee[_0xba60('0x58')]=[{'all':!![]}];}return db['ChatWebsite'][_0xba60('0x59')](_0x37ffee);})['then'](function(_0x36de41){_0x5262c8[_0xba60('0x5a')]=_0x36de41;return _0x5262c8;})['then'](respondWithFilteredResult(_0x1f3c9b,_0x37ffee))[_0xba60('0x2a')](handleError(_0x1f3c9b,null));};exports[_0xba60('0x5b')]=function(_0x11c0e6,_0x52fed8){var _0x28cb58={'raw':![],'where':{'id':_0x11c0e6[_0xba60('0x5c')]['id']},'include':[{'model':db[_0xba60('0x41')],'as':'mandatoryDispositionPause'}]},_0x49f052={};_0x49f052['model']=_[_0xba60('0x5d')](db[_0xba60('0x44')][_0xba60('0x45')]);_0x49f052[_0xba60('0x49')]=_[_0xba60('0x5d')](_0x11c0e6[_0xba60('0x49')]);_0x49f052[_0xba60('0x4a')]=_[_0xba60('0x4b')](_0x49f052[_0xba60('0x48')],_0x49f052[_0xba60('0x49')]);_0x28cb58[_0xba60('0x4c')]=_[_0xba60('0x4b')](_0x49f052[_0xba60('0x48')],qs['fields'](_0x11c0e6[_0xba60('0x49')][_0xba60('0x4d')]));_0x28cb58['attributes']=_0x28cb58[_0xba60('0x4c')][_0xba60('0x5e')]?_0x28cb58['attributes']:_0x49f052[_0xba60('0x48')];if(_0x11c0e6[_0xba60('0x49')]['includeAll']){_0x28cb58[_0xba60('0x58')]=[{'all':!![]}];}_0x28cb58=_[_0xba60('0x54')]({},_0x28cb58,_0x11c0e6[_0xba60('0x56')]);return db['ChatWebsite'][_0xba60('0x5f')](_0x28cb58)['then'](handleEntityNotFound(_0x52fed8,null))['then'](respondWithResult(_0x52fed8,null))['catch'](handleError(_0x52fed8,null));};exports[_0xba60('0x60')]=function(_0x3b3123,_0x3753eb){return db[_0xba60('0x44')]['create'](_0x3b3123[_0xba60('0x61')],{})[_0xba60('0x38')](function(_0x19b6cf){var _0xa29b21=_0x3b3123[_0xba60('0x62')][_0xba60('0x3a')]({'plain':!![]});if(!_0xa29b21)throw new Error(_0xba60('0x63'));if(_0xa29b21[_0xba60('0x64')]===_0xba60('0x62')){var _0x3482ac=_0x19b6cf[_0xba60('0x3a')]({'plain':!![]});var _0xdc52f0=_0xba60('0x3b');return db['UserProfileSection']['find']({'where':{'name':_0xdc52f0,'userProfileId':_0xa29b21[_0xba60('0x65')]},'raw':!![]})[_0xba60('0x38')](function(_0x2f19f5){if(_0x2f19f5&&_0x2f19f5[_0xba60('0x66')]===0x0){return db['UserProfileResource']['create']({'name':_0x3482ac[_0xba60('0x3e')],'resourceId':_0x3482ac['id'],'type':_0x2f19f5[_0xba60('0x3e')],'sectionId':_0x2f19f5['id']},{})[_0xba60('0x38')](function(){return _0x19b6cf;});}else{return _0x19b6cf;}})[_0xba60('0x2a')](function(_0x524034){logger[_0xba60('0x26')](_0xba60('0x67'),_0x524034);throw _0x524034;});}return _0x19b6cf;})[_0xba60('0x38')](respondWithResult(_0x3753eb,0xc9))[_0xba60('0x2a')](handleError(_0x3753eb,null));};exports[_0xba60('0x68')]=function(_0x2ff2db,_0x48997e){if(_0x2ff2db['body']['id']){delete _0x2ff2db[_0xba60('0x61')]['id'];}return db['ChatWebsite'][_0xba60('0x5f')]({'where':{'id':_0x2ff2db[_0xba60('0x5c')]['id']},'include':[{'model':db[_0xba60('0x41')],'as':'mandatoryDispositionPause'}]})[_0xba60('0x38')](handleEntityNotFound(_0x48997e,null))[_0xba60('0x38')](saveUpdates(_0x2ff2db[_0xba60('0x61')],null))['then'](respondWithResult(_0x48997e,null))[_0xba60('0x2a')](handleError(_0x48997e,null));};exports[_0xba60('0x39')]=function(_0x531228,_0xf1069c){return db[_0xba60('0x44')]['find']({'where':{'id':_0x531228[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0xf1069c,null))[_0xba60('0x38')](removeEntity(_0xf1069c,null))[_0xba60('0x2a')](handleError(_0xf1069c,null));};exports[_0xba60('0x69')]=function(_0x53856e,_0x39f384){return db[_0xba60('0x44')][_0xba60('0x69')]()['then'](respondWithResult(_0x39f384,null))[_0xba60('0x2a')](handleError(_0x39f384,null));};exports['addDisposition']=function(_0x481eb4,_0x484dc4,_0x24b5a2){if(_0x481eb4['body']['id']){delete _0x481eb4[_0xba60('0x61')]['id'];}return db[_0xba60('0x44')]['find']({'where':{'id':_0x481eb4[_0xba60('0x5c')]['id']}})['then'](handleEntityNotFound(_0x484dc4,null))[_0xba60('0x38')](function(_0x5b9d8b){if(_0x5b9d8b){_0x481eb4[_0xba60('0x61')]['ChatWebsiteId']=_0x5b9d8b['id'];return db['Disposition'][_0xba60('0x60')](_0x481eb4['body']);}})['then'](respondWithResult(_0x484dc4,null))[_0xba60('0x2a')](handleError(_0x484dc4,null));};exports[_0xba60('0x6a')]=function(_0x1f6efe,_0x44cd85,_0x3c6857){var _0x4b4466={'raw':![],'where':{}};var _0x37814c={};var _0x21c398={'count':0x0,'rows':[]};return db[_0xba60('0x44')][_0xba60('0x6b')]({'where':{'id':_0x1f6efe[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x44cd85,null))[_0xba60('0x38')](function(_0x514290){if(_0x514290){_0x37814c['model']=_['keys'](db[_0xba60('0x6c')]['rawAttributes']);_0x37814c[_0xba60('0x49')]=_[_0xba60('0x5d')](_0x1f6efe[_0xba60('0x49')]);_0x37814c['filters']=_[_0xba60('0x4b')](_0x37814c[_0xba60('0x48')],_0x37814c[_0xba60('0x49')]);_0x4b4466['attributes']=_[_0xba60('0x4b')](_0x37814c['model'],qs[_0xba60('0x4d')](_0x1f6efe[_0xba60('0x49')][_0xba60('0x4d')]));_0x4b4466[_0xba60('0x4c')]=_0x4b4466[_0xba60('0x4c')]['length']?_0x4b4466[_0xba60('0x4c')]:_0x37814c[_0xba60('0x48')];if(!_0x1f6efe[_0xba60('0x49')][_0xba60('0x6d')]('nolimit')){_0x4b4466[_0xba60('0x30')]=qs[_0xba60('0x30')](_0x1f6efe[_0xba60('0x49')][_0xba60('0x30')]);_0x4b4466[_0xba60('0x2f')]=qs[_0xba60('0x2f')](_0x1f6efe[_0xba60('0x49')]['offset']);}_0x4b4466[_0xba60('0x4f')]=qs['sort'](_0x1f6efe[_0xba60('0x49')][_0xba60('0x50')]);_0x4b4466['where']=qs['filters'](_[_0xba60('0x52')](_0x1f6efe[_0xba60('0x49')],_0x37814c[_0xba60('0x4a')]));_0x4b4466[_0xba60('0x51')][_0xba60('0x6e')]=_0x514290['id'];if(_0x1f6efe['query']['filter']){_0x4b4466['where']=_[_0xba60('0x54')](_0x4b4466[_0xba60('0x51')],{'$or':_['map'](_0x4b4466['attributes'],function(_0x3f39bb){var _0x471aac={};_0x471aac[_0x3f39bb]={'$like':'%'+_0x1f6efe[_0xba60('0x49')][_0xba60('0x53')]+'%'};return _0x471aac;})});}_0x4b4466=_[_0xba60('0x54')]({},_0x4b4466,_0x1f6efe[_0xba60('0x56')]);return db[_0xba60('0x6c')][_0xba60('0x32')]({'where':_0x4b4466[_0xba60('0x51')]})['then'](function(_0x3b646f){_0x21c398[_0xba60('0x32')]=_0x3b646f;if(_0x1f6efe[_0xba60('0x49')][_0xba60('0x57')]){_0x4b4466[_0xba60('0x58')]=[{'all':!![]}];}return db[_0xba60('0x6c')][_0xba60('0x59')](_0x4b4466);})[_0xba60('0x38')](function(_0x7c1205){_0x21c398[_0xba60('0x5a')]=_0x7c1205;return _0x21c398;});}})[_0xba60('0x38')](respondWithFilteredResult(_0x44cd85,_0x4b4466))[_0xba60('0x2a')](handleError(_0x44cd85,null));};exports[_0xba60('0x6f')]=function(_0x227f12,_0x333f88,_0x2ac184){return db[_0xba60('0x44')]['find']({'where':{'id':_0x227f12['params']['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x333f88,null))[_0xba60('0x38')](function(_0x9565b7){if(_0x9565b7){return _0x9565b7[_0xba60('0x6f')](_0x227f12['query'][_0xba60('0x70')]);}})[_0xba60('0x38')](respondWithStatusCode(_0x333f88,null))[_0xba60('0x2a')](handleError(_0x333f88,null));};exports['addAnswer']=function(_0x4db502,_0x43ae69,_0x3e54a1){if(_0x4db502[_0xba60('0x61')]['id']){delete _0x4db502['body']['id'];}return db[_0xba60('0x44')][_0xba60('0x5f')]({'where':{'id':_0x4db502['params']['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x43ae69,null))[_0xba60('0x38')](function(_0x3757ca){if(_0x3757ca){_0x4db502[_0xba60('0x61')]['ChatWebsiteId']=_0x3757ca['id'];return db[_0xba60('0x71')]['create'](_0x4db502['body']);}})['then'](respondWithResult(_0x43ae69,null))[_0xba60('0x2a')](handleError(_0x43ae69,null));};exports[_0xba60('0x72')]=function(_0x5631ac,_0x95796b,_0x3d9753){var _0x341896={'raw':![],'where':{}};var _0x1e02cb={};var _0x38c865={'count':0x0,'rows':[]};return db['ChatWebsite'][_0xba60('0x6b')]({'where':{'id':_0x5631ac[_0xba60('0x5c')]['id']}})['then'](handleEntityNotFound(_0x95796b,null))[_0xba60('0x38')](function(_0x1cb32c){if(_0x1cb32c){_0x1e02cb['model']=_['keys'](db[_0xba60('0x71')][_0xba60('0x45')]);_0x1e02cb[_0xba60('0x49')]=_[_0xba60('0x5d')](_0x5631ac[_0xba60('0x49')]);_0x1e02cb['filters']=_[_0xba60('0x4b')](_0x1e02cb[_0xba60('0x48')],_0x1e02cb[_0xba60('0x49')]);_0x341896[_0xba60('0x4c')]=_['intersection'](_0x1e02cb[_0xba60('0x48')],qs[_0xba60('0x4d')](_0x5631ac['query'][_0xba60('0x4d')]));_0x341896[_0xba60('0x4c')]=_0x341896[_0xba60('0x4c')][_0xba60('0x5e')]?_0x341896[_0xba60('0x4c')]:_0x1e02cb[_0xba60('0x48')];if(!_0x5631ac['query']['hasOwnProperty']('nolimit')){_0x341896[_0xba60('0x30')]=qs[_0xba60('0x30')](_0x5631ac[_0xba60('0x49')][_0xba60('0x30')]);_0x341896[_0xba60('0x2f')]=qs[_0xba60('0x2f')](_0x5631ac['query'][_0xba60('0x2f')]);}_0x341896['order']=qs[_0xba60('0x50')](_0x5631ac['query'][_0xba60('0x50')]);_0x341896[_0xba60('0x51')]=qs[_0xba60('0x4a')](_[_0xba60('0x52')](_0x5631ac[_0xba60('0x49')],_0x1e02cb[_0xba60('0x4a')]));_0x341896['where'][_0xba60('0x6e')]=_0x1cb32c['id'];if(_0x5631ac[_0xba60('0x49')]['filter']){_0x341896['where']=_[_0xba60('0x54')](_0x341896[_0xba60('0x51')],{'$or':_[_0xba60('0x43')](_0x341896[_0xba60('0x4c')],function(_0x43810e){var _0x56644c={};_0x56644c[_0x43810e]={'$like':'%'+_0x5631ac[_0xba60('0x49')]['filter']+'%'};return _0x56644c;})});}_0x341896=_['merge']({},_0x341896,_0x5631ac[_0xba60('0x56')]);return db['CannedAnswer']['count']({'where':_0x341896[_0xba60('0x51')]})[_0xba60('0x38')](function(_0x2f9ae2){_0x38c865[_0xba60('0x32')]=_0x2f9ae2;if(_0x5631ac[_0xba60('0x49')][_0xba60('0x57')]){_0x341896[_0xba60('0x58')]=[{'all':!![]}];}return db[_0xba60('0x71')][_0xba60('0x59')](_0x341896);})[_0xba60('0x38')](function(_0x31daab){_0x38c865['rows']=_0x31daab;return _0x38c865;});}})[_0xba60('0x38')](respondWithFilteredResult(_0x95796b,_0x341896))[_0xba60('0x2a')](handleError(_0x95796b,null));};exports[_0xba60('0x73')]=function(_0x3e8dfb,_0x48aea4,_0x11f43c){return db[_0xba60('0x44')][_0xba60('0x5f')]({'where':{'id':_0x3e8dfb['params']['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x48aea4,null))[_0xba60('0x38')](function(_0x59836b){if(_0x59836b){return _0x59836b['removeAnswers'](_0x3e8dfb[_0xba60('0x49')][_0xba60('0x70')]);}})['then'](respondWithStatusCode(_0x48aea4,null))[_0xba60('0x2a')](handleError(_0x48aea4,null));};exports['addLogo']=function(_0x5e72e1,_0xa4ee9,_0x35e731){_0x5e72e1[_0xba60('0x61')][_0xba60('0x74')]=_0x5e72e1[_0xba60('0x75')][_0xba60('0x76')];return db['ChatWebsite'][_0xba60('0x5f')]({'where':{'id':_0x5e72e1[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0xa4ee9,null))[_0xba60('0x38')](saveUpdates(_0x5e72e1['body'],null))[_0xba60('0x38')](respondWithResult(_0xa4ee9,null))[_0xba60('0x2a')](handleError(_0xa4ee9,null));};exports[_0xba60('0x77')]=function(_0x421cc7,_0x41da7f,_0x56cda3){_0x421cc7['body'][_0xba60('0x78')]=_0x421cc7[_0xba60('0x75')][_0xba60('0x76')];return db[_0xba60('0x44')][_0xba60('0x5f')]({'where':{'id':_0x421cc7[_0xba60('0x5c')]['id']}})['then'](handleEntityNotFound(_0x41da7f,null))[_0xba60('0x38')](saveUpdates(_0x421cc7['body'],null))[_0xba60('0x38')](respondWithResult(_0x41da7f,null))['catch'](handleError(_0x41da7f,null));};exports[_0xba60('0x79')]=function(_0x38fae7,_0xab1783,_0x2282e1){_0x38fae7['body'][_0xba60('0x7a')]=_0x38fae7[_0xba60('0x75')]['filename'];return db[_0xba60('0x44')][_0xba60('0x5f')]({'where':{'id':_0x38fae7[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0xab1783,null))[_0xba60('0x38')](saveUpdates(_0x38fae7[_0xba60('0x61')],null))[_0xba60('0x38')](respondWithResult(_0xab1783,null))[_0xba60('0x2a')](handleError(_0xab1783,null));};exports[_0xba60('0x7b')]=function(_0x41d2e3,_0x1379b3,_0x56466d){_0x41d2e3[_0xba60('0x61')][_0xba60('0x7c')]=_0x41d2e3[_0xba60('0x75')][_0xba60('0x76')];return db[_0xba60('0x44')]['find']({'where':{'id':_0x41d2e3[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x1379b3,null))[_0xba60('0x38')](saveUpdates(_0x41d2e3[_0xba60('0x61')],null))['then'](respondWithResult(_0x1379b3,null))[_0xba60('0x2a')](handleError(_0x1379b3,null));};exports[_0xba60('0x7d')]=function(_0x3e0acf,_0x3f3661,_0x305fb4){var _0x13868e=path[_0xba60('0x7e')](config[_0xba60('0x7f')],_0xba60('0x80'));var _0x73247a={'where':{'id':_0x3e0acf[_0xba60('0x5c')]['id']},'attributes':['id',_0xba60('0x74')],'raw':!![]};var _0x2ce4c0=![];return require(_0xba60('0x81'))[_0xba60('0x82')]()[_0xba60('0x38')](function(_0x25f012){if(_0x25f012){_0x2ce4c0=_0x25f012[_0xba60('0x83')];}})[_0xba60('0x38')](function(){return db['ChatWebsite'][_0xba60('0x5f')](_0x73247a);})[_0xba60('0x38')](handleEntityNotFound(_0x3f3661,null))[_0xba60('0x38')](function(_0x504fdf){if(_0x504fdf){if(!_[_0xba60('0x84')](_0x504fdf[_0xba60('0x74')])){if(fs[_0xba60('0x85')](path['join'](config[_0xba60('0x7f')],_0xba60('0x86'),_0x504fdf[_0xba60('0x74')]))&&_0x2ce4c0){_0x13868e=path[_0xba60('0x7e')](config['root'],'server/files/images/logos/',_0x504fdf['sitepic']);}}return _0x3f3661[_0xba60('0x87')](_0x13868e);}})['catch'](handleError(_0x3f3661,null));};exports['getAvatar']=function(_0x591d00,_0x18e13d,_0xd6b1b3){var _0x19e737=path['join'](config[_0xba60('0x7f')],_0xba60('0x88'));var _0x583a6d={'where':{'id':_0x591d00[_0xba60('0x5c')]['id']},'attributes':['id',_0xba60('0x78')],'raw':!![]};return db[_0xba60('0x44')][_0xba60('0x5f')](_0x583a6d)['then'](handleEntityNotFound(_0x18e13d,null))[_0xba60('0x38')](function(_0x2fbd92){if(_0x2fbd92){if(!_[_0xba60('0x84')](_0x2fbd92[_0xba60('0x78')])){if(fs[_0xba60('0x85')](path[_0xba60('0x7e')](config[_0xba60('0x7f')],_0xba60('0x89'),_0x2fbd92[_0xba60('0x78')]))){_0x19e737=path[_0xba60('0x7e')](config[_0xba60('0x7f')],_0xba60('0x89'),_0x2fbd92[_0xba60('0x78')]);}}return _0x18e13d[_0xba60('0x87')](_0x19e737);}})[_0xba60('0x2a')](handleError(_0x18e13d,null));};exports['getCustomerAvatar']=function(_0x4fc1c6,_0x171cf8,_0x561637){var _0xfa2823=path[_0xba60('0x7e')](config[_0xba60('0x7f')],'server/files/images/avatars/customer_avatar.png');var _0x5cd2f9={'where':{'id':_0x4fc1c6['params']['id']},'attributes':['id','customerAvatar',_0xba60('0x8a')],'raw':!![]};return db[_0xba60('0x44')][_0xba60('0x5f')](_0x5cd2f9)[_0xba60('0x38')](handleEntityNotFound(_0x171cf8,null))[_0xba60('0x38')](function(_0x17b384){if(_0x17b384){if(!_['isNil'](_0x17b384[_0xba60('0x7a')])){if(fs[_0xba60('0x85')](path[_0xba60('0x7e')](config[_0xba60('0x7f')],_0xba60('0x89'),_0x17b384[_0xba60('0x7a')]))&&_0x17b384[_0xba60('0x8a')]){_0xfa2823=path[_0xba60('0x7e')](config[_0xba60('0x7f')],_0xba60('0x89'),_0x17b384['customerAvatar']);}}return _0x171cf8[_0xba60('0x87')](_0xfa2823);}})[_0xba60('0x2a')](handleError(_0x171cf8,null));};exports[_0xba60('0x8b')]=function(_0x22c257,_0x3204be,_0x58e853){var _0x95fc0c=path['join'](config['root'],_0xba60('0x8c'));var _0x1cbb2f={'where':{'id':_0x22c257[_0xba60('0x5c')]['id']},'attributes':['id',_0xba60('0x7c')],'raw':!![]};return db[_0xba60('0x44')]['find'](_0x1cbb2f)[_0xba60('0x38')](handleEntityNotFound(_0x3204be,null))[_0xba60('0x38')](function(_0x43279e){if(_0x43279e){if(!_['isNil'](_0x43279e[_0xba60('0x7c')])){if(fs['existsSync'](path['join'](config['root'],'server/files/images/avatars/',_0x43279e[_0xba60('0x7c')]))){_0x95fc0c=path['join'](config['root'],_0xba60('0x89'),_0x43279e[_0xba60('0x7c')]);}}return _0x3204be[_0xba60('0x87')](_0x95fc0c);}})[_0xba60('0x2a')](handleError(_0x3204be,null));};exports[_0xba60('0x8d')]=function(_0x42e6bc,_0x572723,_0x99e913){var _0x2eb01f=require(_0xba60('0x8e'));var _0x41e418=new _0x2eb01f();var _0xd28009=_0x41e418[_0xba60('0x8f')](_0x42e6bc['headers'][_0xba60('0x90')])[_0xba60('0x91')]();var _0x25a455={'body':_0x42e6bc[_0xba60('0x61')],'channel':'chat'};var _0x52d27d=[];var _0x52e027=[];var _0x5a78c6={};var _0x102387=![];return db['CmContact'][_0xba60('0x69')]()[_0xba60('0x38')](function(_0x183505){if(!_0x183505){throw new db['Sequelize'][(_0xba60('0x92'))](_0xba60('0x93'));}_0x52d27d=_['difference'](_[_0xba60('0x5d')](_0x183505),[_0xba60('0x94'),_0xba60('0x95')]);_0x52e027=_[_0xba60('0x96')](_[_0xba60('0x5d')](_0x183505),[_0xba60('0x94'),_0xba60('0x95'),_0xba60('0x97'),_0xba60('0x98')]);if(_0x42e6bc[_0xba60('0x61')]['id']){delete _0x42e6bc[_0xba60('0x61')]['id'];}if(_[_0xba60('0x84')](_0x42e6bc[_0xba60('0x61')][_0xba60('0x99')])){throw new db[(_0xba60('0x9a'))][(_0xba60('0x92'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x42e6bc['body'][_0xba60('0x61')])||_0x42e6bc[_0xba60('0x61')][_0xba60('0x61')]===''){throw new db[(_0xba60('0x9a'))][(_0xba60('0x92'))](_0xba60('0x9b'));}if(_[_0xba60('0x84')](_0x42e6bc[_0xba60('0x61')]['mapKey'])){throw new db[(_0xba60('0x9a'))][(_0xba60('0x92'))](_0xba60('0x9c')+_0x52e027);}if(!_[_0xba60('0x9d')](_0x52e027,_0x42e6bc['body'][_0xba60('0x9e')])){throw new db['Sequelize'][(_0xba60('0x92'))](_0xba60('0x9f')+_0x52e027);}_0x5a78c6[_0x42e6bc[_0xba60('0x61')]['mapKey']]=_0x42e6bc['body'][_0xba60('0x99')];})[_0xba60('0x38')](function(){return db[_0xba60('0x44')][_0xba60('0x5f')]({'where':{'id':_0x42e6bc['params']['id']},'include':[{'model':db[_0xba60('0xa0')],'as':'List','include':[{'model':db[_0xba60('0xa1')],'as':'Contacts','where':_0x5a78c6,'limit':0x1,'order':[[_0xba60('0x95'),'DESC']]}]},{'model':db['ChatApplication'],'as':'Applications'}]});})[_0xba60('0x38')](handleEntityNotFound(_0x572723,null))[_0xba60('0x38')](function(_0x12dab1){if(_0x12dab1&&_0x12dab1[_0xba60('0xa2')]){_0x25a455[_0xba60('0xa3')]=_0x12dab1;_0x25a455['applications']=_0x12dab1['Applications'];_0x25a455[_0xba60('0xa4')]=_0x12dab1[_0xba60('0xa2')];_0x25a455[_0xba60('0xa5')]=_['orderBy'](_0x25a455[_0xba60('0xa5')],['priority'],['asc']);if(_0x25a455['account'][_0xba60('0xa6')]){delete _0x25a455[_0xba60('0xa3')][_0xba60('0xa6')];}if(_0x25a455[_0xba60('0xa3')][_0xba60('0xa2')]&&_0x25a455[_0xba60('0xa3')][_0xba60('0xa2')][_0xba60('0xa7')][_0xba60('0x5e')]){return _0x25a455[_0xba60('0xa3')][_0xba60('0xa2')][_0xba60('0xa7')][0x0];}var _0x1871eb=_[_0xba60('0x17')](_0x42e6bc[_0xba60('0x61')],{'firstName':_0x42e6bc[_0xba60('0x61')]['from'],'ListId':_0x12dab1[_0xba60('0x98')]});_0x1871eb[_0x42e6bc[_0xba60('0x61')][_0xba60('0x9e')]]=_0x42e6bc[_0xba60('0x61')]['from'];return db[_0xba60('0xa1')][_0xba60('0x60')](_0x1871eb,{'fields':_0x52d27d,'raw':!![]});}})[_0xba60('0x38')](handleEntityNotFound(_0x572723,null))['then'](function(_0x5a4f0c){_0x25a455[_0xba60('0xa8')]=_0x5a4f0c;var _0x16c215=_0x42e6bc[_0xba60('0x61')][_0xba60('0xa9')];if(_0x42e6bc['headers'][_0xba60('0xaa')]){_0x16c215=_0x42e6bc[_0xba60('0xab')][_0xba60('0xaa')];}else if(_0x42e6bc[_0xba60('0xab')][_0xba60('0xac')]){_0x16c215=_['first'](_0x42e6bc[_0xba60('0xab')][_0xba60('0xac')][_0xba60('0xad')](','));}if(_0x5a4f0c){var _0x498ac4={'ContactId':_0x5a4f0c['id'],'ChatWebsiteId':_0x42e6bc[_0xba60('0x5c')]['id'],'from':(_0x5a4f0c[_0xba60('0xae')]||'')+'\x20'+(_0x5a4f0c['lastName']||''),'customerIp':_0x16c215,'customerPort':_0x42e6bc[_0xba60('0xab')]['x-real-port']?_0x42e6bc[_0xba60('0xab')][_0xba60('0xaf')]:null,'referer':_0x42e6bc[_0xba60('0x61')][_0xba60('0xb0')],'browserName':_0xd28009[_0xba60('0xb1')][_0xba60('0x3e')]&&_0xd28009[_0xba60('0xb1')][_0xba60('0xb2')]?util[_0xba60('0xb3')]('%s\x20%s',_0xd28009[_0xba60('0xb1')][_0xba60('0x3e')],_0xd28009[_0xba60('0xb1')][_0xba60('0xb2')]):_0xba60('0xb4'),'browserVersion':_0xd28009[_0xba60('0xb1')]['version']||_0xba60('0xb4'),'osName':util['format'](_0xba60('0xb5'),_0xd28009['os'][_0xba60('0x3e')],_0xd28009['os'][_0xba60('0xb2')]),'osVersion':_0xd28009['os']['version'],'deviceModel':_0xd28009['device'][_0xba60('0x48')]&&_0xd28009[_0xba60('0xb6')][_0xba60('0xb7')]?util[_0xba60('0xb3')](_0xba60('0xb8'),_0xd28009[_0xba60('0xb6')][_0xba60('0x48')],_0xd28009[_0xba60('0xb6')][_0xba60('0xb7')],_0xd28009[_0xba60('0xb6')]['type']):null,'deviceVendor':_0xd28009[_0xba60('0xb6')][_0xba60('0xb7')],'deviceType':_0xd28009[_0xba60('0xb6')]['type'],'formData':JSON['stringify'](_0x42e6bc[_0xba60('0x61')])};var _0x1c6697={'ChatWebsiteId':_0x42e6bc[_0xba60('0x5c')]['id'],'closed':![]};if(_0x42e6bc[_0xba60('0x61')][_0xba60('0xb9')]){_0x1c6697[_0xba60('0xb9')]=_0x42e6bc[_0xba60('0x61')][_0xba60('0xb9')];return db[_0xba60('0xba')]['find']({'where':_0x1c6697})[_0xba60('0x38')](function(_0x3b5d0b){if(_0x3b5d0b){return[_0x3b5d0b,![]];}_0x498ac4[_0xba60('0xb9')]=_0x42e6bc[_0xba60('0x61')][_0xba60('0xb9')];_0x498ac4[_0xba60('0xbb')]=_0x42e6bc[_0xba60('0x61')][_0xba60('0xbb')];return db[_0xba60('0xba')][_0xba60('0x60')](_0x498ac4)[_0xba60('0x38')](function(_0x42281c){return[_0x42281c,!![]];});});}_0x1c6697['ContactId']=_0x5a4f0c['id'];if(_0x42e6bc[_0xba60('0x61')]['interaction']&&_0x42e6bc[_0xba60('0x61')][_0xba60('0xbc')]['id']){_0x1c6697['id']=_0x42e6bc[_0xba60('0x61')]['interaction']['id'];return db[_0xba60('0xba')][_0xba60('0x5f')]({'where':_0x1c6697})['then'](function(_0x4fca2f){if(_0x4fca2f){return[_0x4fca2f,![]];}return db[_0xba60('0xba')][_0xba60('0x60')](_0x498ac4)[_0xba60('0x38')](function(_0x9e393){return[_0x9e393,!![]];});});}return db[_0xba60('0xba')][_0xba60('0x60')](_0x498ac4)[_0xba60('0x38')](function(_0x301dd8){return[_0x301dd8,!![]];});}})[_0xba60('0xbd')](function(_0x33f9e7,_0xf8459d){if(_0x33f9e7){_0x102387=_0xf8459d;if(!_0xf8459d){var _0x327712={'from':(_0x25a455[_0xba60('0xa8')][_0xba60('0xae')]||'')+'\x20'+(_0x25a455[_0xba60('0xa8')][_0xba60('0xbe')]||'')};if(_0x42e6bc[_0xba60('0x61')]['threadId']&&_0x42e6bc[_0xba60('0x61')][_0xba60('0xbf')]&&_0x42e6bc[_0xba60('0x61')][_0xba60('0xb9')]!=_0x42e6bc[_0xba60('0x61')][_0xba60('0xbf')]){_0x327712[_0xba60('0xb9')]=_0x42e6bc[_0xba60('0x61')][_0xba60('0xbf')];}return _0x33f9e7[_0xba60('0x68')](_0x327712);}else{return _0x33f9e7;}}})['then'](function(_0x9eacaa){_0x25a455[_0xba60('0xbc')]=_0x9eacaa[_0xba60('0x3a')]({'plain':!![]});_0x25a455[_0xba60('0xbc')]['created']=_0x102387;if(_0x25a455[_0xba60('0xbc')][_0xba60('0xc0')]){if(_0x25a455[_0xba60('0xa3')]['autoclose']){_0x25a455[_0xba60('0xa5')][_0xba60('0xc1')]({'id':0x0,'priority':_0x25a455['applications']['length']+0x1,'app':_0xba60('0xc2'),'appdata':_0xba60('0xc3'),'interval':'*,*,*,*'});}}return db[_0xba60('0xc4')]['create']({'body':_0x42e6bc['body'][_0xba60('0x61')],'ChatWebsiteId':_0x42e6bc[_0xba60('0x5c')]['id'],'ChatInteractionId':_0x9eacaa['id'],'direction':'in','ContactId':_0x25a455[_0xba60('0xa8')]['id'],'AttachmentId':_0x42e6bc[_0xba60('0x61')][_0xba60('0xc5')]});})[_0xba60('0x38')](function(_0x4a26b7){_0x25a455['message']=_0x4a26b7;if(_0x25a455[_0xba60('0xbc')][_0xba60('0xc6')]){return db[_0xba60('0xc7')]['find']({'attributes':['id',_0xba60('0x3e')],'where':{'id':_0x25a455[_0xba60('0xbc')][_0xba60('0xc6')]}})[_0xba60('0x38')](function(_0xb6373e){if(_0xb6373e){_0x25a455[_0xba60('0xa5')][_0xba60('0xc8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xb6373e[_0xba60('0x3e')]+','+(_0x25a455['account'][_0xba60('0xc9')]||0xa),'interval':_0xba60('0xca')});_0x25a455[_0xba60('0xcb')]=!![];}return respondWithRpcPromise('Start',_0xba60('0xcc'),_0x25a455);});}return respondWithRpcPromise(_0xba60('0xcd'),_0xba60('0xcc'),_0x25a455);})[_0xba60('0x38')](function(_0x4b1e8e){respondWithRpcPromise(_0xba60('0xce'),'EventManager',{'event':_0xba60('0x8d'),'message':_0x4b1e8e},client9002);return _0x4b1e8e;})[_0xba60('0x38')](respondWithResult(_0x572723,null))[_0xba60('0x2a')](handleError(_0x572723,null));};exports[_0xba60('0xcf')]=function(_0x47300b,_0x7cb0c2,_0x13445e){var _0x552cdb,_0x12c8d6,_0x116755;var _0x95490b=[];var _0x3ad9c6=[];var _0x44b696={};var _0x21b039=_0x47300b[_0xba60('0xd0')]||[];var _0x1053d0=[];var _0x3ecd59;return db[_0xba60('0xa1')][_0xba60('0x69')]()[_0xba60('0x38')](function(_0x5bc1ab){if(!_0x5bc1ab){throw new db[(_0xba60('0x9a'))]['ValidationError'](_0xba60('0x93'));}_0x3ad9c6=_['difference'](_[_0xba60('0x5d')](_0x5bc1ab),[_0xba60('0x94'),'updatedAt']);_0x95490b=_[_0xba60('0x96')](_[_0xba60('0x5d')](_0x5bc1ab),[_0xba60('0x94'),_0xba60('0x95'),_0xba60('0x97'),_0xba60('0x98')]);if(_0x47300b[_0xba60('0x61')]['id']){delete _0x47300b[_0xba60('0x61')]['id'];}if(_[_0xba60('0x84')](_0x47300b[_0xba60('0x61')][_0xba60('0x99')])){throw _0x7cb0c2[_0xba60('0x2d')](0x1f4)[_0xba60('0x3f')](new db[(_0xba60('0x9a'))][(_0xba60('0x92'))](_0xba60('0xd1')));}if(_['isNil'](_0x47300b[_0xba60('0x61')][_0xba60('0x61')])||_0x47300b['body'][_0xba60('0x61')]===''){throw _0x7cb0c2[_0xba60('0x2d')](0x1f4)[_0xba60('0x3f')](new db['Sequelize']['ValidationError'](_0xba60('0x9b')));}if(_[_0xba60('0x84')](_0x47300b['body']['mapKeyOffline'])){throw _0x7cb0c2[_0xba60('0x2d')](0x1f4)['send'](new db[(_0xba60('0x9a'))][(_0xba60('0x92'))](_0xba60('0xd2')+_0x95490b));}if(!_[_0xba60('0x9d')](_0x95490b,_0x47300b[_0xba60('0x61')][_0xba60('0xd3')])){throw _0x7cb0c2[_0xba60('0x2d')](0x1f4)[_0xba60('0x3f')](new db[(_0xba60('0x9a'))][(_0xba60('0x92'))]('mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x95490b));}_0x44b696[_0x47300b[_0xba60('0x61')]['mapKeyOffline']]=_0x47300b[_0xba60('0x61')]['from'];})['then'](function(){return db[_0xba60('0x44')]['find']({'where':{'id':_0x47300b[_0xba60('0x5c')]['id']},'include':[{'model':db[_0xba60('0xa0')],'as':_0xba60('0xa2')},{'model':db[_0xba60('0xd4')],'as':_0xba60('0xd4')}]});})[_0xba60('0x38')](handleEntityNotFound(_0x7cb0c2,null))[_0xba60('0x38')](function(_0x1362ee){if(_0x1362ee&&_0x1362ee[_0xba60('0xa2')]){_0x12c8d6=_0x1362ee;var _0x2fb0b3=_[_0xba60('0x17')](_0x47300b['body'],{'firstName':_0x47300b[_0xba60('0x61')]['from'],'phone':_0x47300b[_0xba60('0x61')][_0xba60('0x99')],'ListId':_0x1362ee['ListId']});_0x2fb0b3[_0x47300b[_0xba60('0x61')]['mapKeyOffline']]=_0x47300b['body'][_0xba60('0x99')];return db['CmContact'][_0xba60('0xd5')]({'where':_0x44b696,'defaults':_0x2fb0b3});}})[_0xba60('0xbd')](function(_0x3d97b2){if(_0x3d97b2){_0x116755=_0x3d97b2;var _0x7cbe5e=fs[_0xba60('0xd6')](path[_0xba60('0x7e')](config[_0xba60('0x7f')],'server/files/templates/chatOfflineMessage.ejs'),_0xba60('0xd7'));var _0x1fcb2c=ejs[_0xba60('0xd8')](_0x7cbe5e,{'body':_[_0xba60('0xd9')](_0x47300b[_0xba60('0x61')][_0xba60('0x61')]),'bodyTitle':_0x12c8d6[_0xba60('0xda')]});return db[_0xba60('0xdb')]['create']({'body':_0x1fcb2c,'ContactId':_0x3d97b2['id'],'ChatWebsiteId':_0x12c8d6['id']});}})[_0xba60('0x38')](function(_0x254062){_0x3ecd59=_0x254062;if(_0x21b039[_0xba60('0x5e')]){var _0x404c61=_0x21b039[_0xba60('0x43')](function(_0x48c633){return{'name':_0x48c633[_0xba60('0xdc')],'basename':_0x48c633[_0xba60('0x76')],'type':_0x48c633['mimetype'],'ChatOfflineMessageId':_0x254062['id']};});_0x1053d0=_0x404c61[_0xba60('0x43')](_0x23d527=>{var _0x3fbb74={'filename':_0x23d527[_0xba60('0x3e')],'path':path['join'](config[_0xba60('0x7f')],_0xba60('0xdd'),'files',_0xba60('0xde'),'offline-chat',_0x23d527[_0xba60('0xdf')])};return _0x3fbb74;});if(!_0x12c8d6[_0xba60('0xe0')]){return db[_0xba60('0xe1')]['transaction'](function(_0x33f1d8){return db[_0xba60('0xe2')][_0xba60('0xe3')](_0x404c61,{'transaction':_0x33f1d8});});}}})['then'](function(){if(_0x3ecd59){_0x552cdb=_0x3ecd59;return db[_0xba60('0xd4')]['findOne']({'where':{'active':!![]},'include':[{'model':db[_0xba60('0xe4')],'as':'Smtp','raw':!![]}]});}})[_0xba60('0x38')](function(_0x288934){if(_0x288934&&_0x288934[_0xba60('0xe5')]&&_0x12c8d6['forwardOffline']&&_0x12c8d6['forwardOfflineAddress']){var _0xc23667={'tls':{'rejectUnauthorized':![]}};if(_0x288934[_0xba60('0xe5')][_0xba60('0xe6')]){_0xc23667['service']=_0x288934['Smtp'][_0xba60('0xe6')];}else{_0xc23667[_0xba60('0xe7')]=_0x288934['Smtp'][_0xba60('0xe7')];_0xc23667[_0xba60('0xe8')]=_0x288934['Smtp'][_0xba60('0xe8')];_0xc23667[_0xba60('0xe9')]=_0x288934[_0xba60('0xe5')][_0xba60('0xe9')];}if(_0x288934[_0xba60('0xe5')][_0xba60('0xea')]){_0xc23667[_0xba60('0xeb')]={'user':_0x288934[_0xba60('0xe5')][_0xba60('0x62')],'pass':_0x288934[_0xba60('0xe5')][_0xba60('0xec')]};}return respondWithRpcPromise(_0xba60('0xed'),_0xba60('0xee'),{'account':_0xc23667,'message':{'from':util[_0xba60('0xb3')](_0xba60('0xef'),_0x288934[_0xba60('0x3e')],_0x288934[_0xba60('0xf0')]||_0x288934[_0xba60('0xe5')][_0xba60('0x62')]),'to':_0x12c8d6[_0xba60('0xf1')],'subject':_0x12c8d6[_0xba60('0xf2')],'html':_0x552cdb[_0xba60('0x61')],'attachments':_0x1053d0}},client9003)[_0xba60('0x38')](function(){return _0x552cdb;})[_0xba60('0x2a')](function(_0x48c5c0){console[_0xba60('0x26')](_0x48c5c0);});}})['then'](function(){if(_0x12c8d6&&_0x12c8d6['openNewInteraction']&&_0x12c8d6[_0xba60('0xf3')]){var _0x288699=[];if(_0x21b039[_0xba60('0x5e')]){_0x288699=_0x21b039[_0xba60('0x43')](function(_0x475c80){return{'name':_0x475c80[_0xba60('0xdc')],'basename':_0x475c80['filename'],'type':_0x475c80[_0xba60('0xf4')],'ChatOfflineMessageId':_0x3ecd59['id']};});}var _0x38d38a;if(!_[_0xba60('0x84')](_0x12c8d6[_0xba60('0xf5')])){var _0x23f88f=_[_0xba60('0x43')](_0x47300b[_0xba60('0x61')],function(_0x1dbabb){return _0x1dbabb;});var _0x1d1ca3=_['toPairsIn'](_0x23f88f)[0x0];var _0x9d98b2=_['mapValues'](_0x1d1ca3,function(_0x4d2d4d){return _0x4d2d4d;});_0x38d38a=_0x9d98b2[0x1][_0x12c8d6[_0xba60('0xf5')]];}var _0x2dc38e={'from':_0x116755[_0xba60('0xf0')],'firstName':_0x116755['firstName'],'lastName':_0x116755[_0xba60('0xbe')],'mapKey':_0xba60('0xf0'),'message':{'from':_0x116755['email'],'to':_0x12c8d6[_0xba60('0xd4')][_0xba60('0xf0')],'cc':'','subject':_[_0xba60('0x84')](_0x38d38a)?_0x12c8d6['offlineMessageSubject']:_0x38d38a,'messageId':'','sentAt':new Date(),'attach':_0x288699[_0xba60('0x5e')],'attachments':_0x288699,'originChannel':_0xba60('0xf6'),'ChatWebsiteId':_0x12c8d6['id'],'ChatOfflineMessageId':_0x552cdb['id'],'originTo':_0x12c8d6[_0xba60('0xd4')]['email']},'body':_0x552cdb[_0xba60('0x61')]};var _0x18cf25={'account':{'id':_0x12c8d6[_0xba60('0xf3')]},'body':_0x2dc38e,'log':_0xba60('0xf7')};return respondWithRpcPromise(_0xba60('0xf7'),_0xba60('0xf8'),_0x18cf25,client9001)['then'](function(){return _0x552cdb;})['catch'](function(_0x47f71c){console[_0xba60('0x26')](_0x47f71c);});}return;})['then'](function(){if(_0x552cdb){return _0x552cdb;}})['then'](respondWithResult(_0x7cb0c2,null))[_0xba60('0x2a')](function(_0x26b5a8){console['error'](_0xba60('0x2a'),_0x26b5a8);for(var _0x245c6b of _0x21b039){var _0x319474=path[_0xba60('0x7e')](config[_0xba60('0x7f')],_0xba60('0xdd'),_0xba60('0xd0'),_0xba60('0xde'),'offline-chat',_0x245c6b[_0xba60('0x76')]);fs_extra[_0xba60('0xf9')](_0x319474)[_0xba60('0x2a')](function(_0x570c80){console[_0xba60('0x26')](_0xba60('0xfa'),_0x319474,_0x570c80);});}});};exports[_0xba60('0xfb')]=function(_0x5a0518,_0x1a9963,_0x124588){return db['ChatInteraction']['find']({'where':{'id':_0x5a0518['params']['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x1a9963,null))[_0xba60('0x38')](function(_0x3db18c){if(_0x3db18c){return _0x3db18c['addInteraction'](_0x5a0518['body'][_0xba60('0x70')],_[_0xba60('0xfc')](_0x5a0518[_0xba60('0x61')],[_0xba60('0x70'),'id'])||{});}})['then'](respondWithResult(_0x1a9963,null))[_0xba60('0x2a')](handleError(_0x1a9963,null));};exports['getInteractions']=function(_0x146b9a,_0x7fcb01,_0x8c3f36){var _0x5c5a58={'raw':![],'where':{}};var _0x193e7d={};var _0x198d56={'count':0x0,'rows':[]};return db[_0xba60('0x44')][_0xba60('0x6b')]({'where':{'id':_0x146b9a[_0xba60('0x5c')]['id']}})['then'](handleEntityNotFound(_0x7fcb01,null))[_0xba60('0x38')](function(_0x41d039){if(_0x41d039){_0x193e7d[_0xba60('0x48')]=_[_0xba60('0x5d')](db[_0xba60('0xba')][_0xba60('0x45')]);_0x193e7d[_0xba60('0x49')]=_['keys'](_0x146b9a[_0xba60('0x49')]);_0x193e7d['filters']=_[_0xba60('0x4b')](_0x193e7d['model'],_0x193e7d[_0xba60('0x49')]);_0x5c5a58[_0xba60('0x4c')]=_['intersection'](_0x193e7d[_0xba60('0x48')],qs[_0xba60('0x4d')](_0x146b9a['query'][_0xba60('0x4d')]));_0x5c5a58[_0xba60('0x4c')]=_0x5c5a58[_0xba60('0x4c')]['length']?_0x5c5a58['attributes']:_0x193e7d[_0xba60('0x48')];if(!_0x146b9a[_0xba60('0x49')][_0xba60('0x6d')](_0xba60('0x4e'))){_0x5c5a58[_0xba60('0x30')]=qs[_0xba60('0x30')](_0x146b9a[_0xba60('0x49')]['limit']);_0x5c5a58[_0xba60('0x2f')]=qs[_0xba60('0x2f')](_0x146b9a['query'][_0xba60('0x2f')]);}_0x5c5a58[_0xba60('0x4f')]=qs[_0xba60('0x50')](_0x146b9a['query'][_0xba60('0x50')]);_0x5c5a58['where']=qs['filters'](_[_0xba60('0x52')](_0x146b9a['query'],_0x193e7d[_0xba60('0x4a')]));_0x5c5a58[_0xba60('0x51')]['ChatWebsiteId']=_0x41d039['id'];if(_0x146b9a[_0xba60('0x49')][_0xba60('0x53')]){_0x5c5a58['where']=_['merge'](_0x5c5a58['where'],{'$or':_[_0xba60('0x43')](_0x5c5a58['attributes'],function(_0x403731){var _0x5abc84={};_0x5abc84[_0x403731]={'$like':'%'+_0x146b9a[_0xba60('0x49')]['filter']+'%'};return _0x5abc84;})});}_0x5c5a58=_[_0xba60('0x54')]({},_0x5c5a58,_0x146b9a[_0xba60('0x56')]);return db[_0xba60('0xba')][_0xba60('0x32')]({'where':_0x5c5a58[_0xba60('0x51')]})[_0xba60('0x38')](function(_0x39d940){_0x198d56[_0xba60('0x32')]=_0x39d940;if(_0x146b9a[_0xba60('0x49')][_0xba60('0x57')]){_0x5c5a58[_0xba60('0x58')]=[{'model':db['CmContact'],'as':_0xba60('0xfd'),'required':![]},{'model':db[_0xba60('0xc7')],'as':_0xba60('0xfe'),'attributes':[_0xba60('0x3e'),_0xba60('0xff'),'internal'],'required':![]},{'model':db[_0xba60('0x100')],'as':_0xba60('0x101'),'attributes':['id',_0xba60('0x3e'),_0xba60('0x102')],'where':_0x146b9a['query']['tag']?{'id':_0x146b9a[_0xba60('0x49')]['tag']}:undefined,'required':_0x146b9a['query'][_0xba60('0x103')]?!![]:![]}];}return db[_0xba60('0xba')][_0xba60('0x59')](_0x5c5a58);})['then'](function(_0xbaa60b){_0x198d56[_0xba60('0x5a')]=_0xbaa60b;return _0x198d56;});}})['then'](respondWithFilteredResult(_0x7fcb01,_0x5c5a58))[_0xba60('0x2a')](handleError(_0x7fcb01,null));};function iftimePromise(_0x3dfc60,_0x250293){return respondWithRpcPromise(_0xba60('0x104'),_0xba60('0x105'),{'command':_0x250293[_0xba60('0x106')]?util[_0xba60('0xb3')]('iftime\x20%s,%s',_0x3dfc60['interval'],_0x250293[_0xba60('0x106')]):util[_0xba60('0xb3')](_0xba60('0x107'),_0x3dfc60[_0xba60('0x108')])},client9002)[_0xba60('0x38')](function(_0x10a8c8){var _0x5d8a8f=_0x10a8c8&&_0x10a8c8[_0xba60('0x109')](_0xba60('0x10a'))>=0x0?!![]:![];logger[_0xba60('0x20')]('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x250293['id'],_0x3dfc60['id'],_0x3dfc60[_0xba60('0x108')],_0x5d8a8f?_0xba60('0x10b'):'OFFLINE',_0x250293['timezone']?_0x250293['timezone']:'No\x20timezone');return _0x5d8a8f;})[_0xba60('0x2a')](function(_0x1c81ce){logger[_0xba60('0x26')](_0xba60('0x10c'),_0x250293['id'],_0x3dfc60['id'],_0x3dfc60[_0xba60('0x108')],util[_0xba60('0x10d')](_0x1c81ce,{'showHidden':![],'depth':null}),_0x250293[_0xba60('0x106')]?_0x250293[_0xba60('0x106')]:_0xba60('0x10e'));return![];});}exports[_0xba60('0x105')]=function(_0x2a979c,_0x50daa9,_0x4b03c5){var _0x1eae04=0x0;var _0x41760e=0x0;var _0x2e372c=![];var _0x9f4ab0;var _0x346f93;return db[_0xba60('0x44')]['find']({'where':{'id':_0x2a979c[_0xba60('0x5c')]['id']},'include':[{'model':db[_0xba60('0x10f')],'as':_0xba60('0x10f'),'include':[{'model':db[_0xba60('0x10f')],'as':_0xba60('0x110'),'attributes':['id','interval'],'raw':!![]}]}]})['then'](handleEntityNotFound(_0x50daa9,null))[_0xba60('0x38')](function(_0x45e22f){if(_0x45e22f){_0x9f4ab0=_0x45e22f;return _0x45e22f[_0xba60('0x111')]({'raw':!![]});}})[_0xba60('0x38')](function(_0x48f692){if(_0x9f4ab0){if(_0x48f692){_0x346f93=_0x48f692;}}return require(_0xba60('0x81'))['getLicense']();})['then'](function(_0xc5527b){if(_0xc5527b){_0x41760e=_0xc5527b['virtual'];_0x2e372c=_0xc5527b[_0xba60('0x83')];}})[_0xba60('0x38')](function(){return db['ChatInteraction']['count']({'where':{'closed':![]}});})['then'](function(_0x69f5a9){_0x1eae04=_0x69f5a9;if(_0x41760e&&_0x69f5a9>_0x41760e){return db['License']['findOne']({'where':{'id':0x1}})[_0xba60('0x38')](function(_0x3a5d22){if(_0x3a5d22){_0x3a5d22[_0xba60('0x112')](_0xba60('0x113'));}});}})[_0xba60('0x38')](function(){if(_0x9f4ab0[_0xba60('0x10f')]&&_0x9f4ab0['Interval'][_0xba60('0x110')]){var _0x8920ef=[];for(var _0x3086ee=0x0;_0x3086ee<_0x9f4ab0['Interval']['Intervals'][_0xba60('0x5e')];_0x3086ee++){var _0x4c9480=_0x9f4ab0[_0xba60('0x10f')][_0xba60('0x110')][_0x3086ee][_0xba60('0x3a')]({'plain':!![]});_0x8920ef[_0xba60('0xc1')](iftimePromise(_0x4c9480,_0x9f4ab0));}return BPromise[_0xba60('0x114')](_0x8920ef)[_0xba60('0x38')](function(_0x4ea105){return _['some'](_0x4ea105);});}else{return!![];}})[_0xba60('0x38')](function(_0x5442f9){var _0x4455f2=fs[_0xba60('0xd6')](path[_0xba60('0x7e')](config[_0xba60('0x7f')],_0xba60('0x115')),_0xba60('0xd7'));var _0x10c2f5={'remote':_0x9f4ab0[_0xba60('0x116')],'query':querystring[_0xba60('0x25')](_['merge'](_0x9f4ab0['get']({'plain':!![]}),{'customerIp':_0x2a979c['headers']['x-forwarded-for']||_0x2a979c[_0xba60('0xab')][_0xba60('0x117')]||_0x2a979c['connection'][_0xba60('0x118')]||_0x2a979c['ip'],'referer':_0x2a979c[_0xba60('0xab')][_0xba60('0xb0')],'openedInteractions':_0x1eae04,'maxInteractions':_0x41760e,'virtual':_0x2e372c[_0xba60('0x119')],'online':_0x5442f9,'custom':_0x2e372c}))['replace'](/'/g,'\x5c\x27')};_0x50daa9[_0xba60('0x3f')](ejs[_0xba60('0xd8')](Mustache['render'](_0x4455f2,_0x10c2f5),{'proactiveActions':_0x346f93,'alignment':_0x9f4ab0[_0xba60('0x11a')],'verticalAlignment':_0x9f4ab0['verticalAlignment'],'div_color':_0x9f4ab0[_0xba60('0x102')],'text_color':_0x9f4ab0[_0xba60('0x11b')],'button_color':_0x9f4ab0['color_button'],'background_color':_0x9f4ab0[_0xba60('0x11c')]}));})[_0xba60('0x2a')](handleError(_0x50daa9,null));};exports[_0xba60('0x11d')]=function(_0x80a052,_0x561940,_0x118204){return db[_0xba60('0x44')][_0xba60('0x6b')]({'where':{'id':_0x80a052[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x561940,null))['then'](function(_0x187ca0){if(_0x187ca0){return db[_0xba60('0xe1')][_0xba60('0x11e')](function(_0x19ede6){return db['ChatApplication'][_0xba60('0x39')]({'where':{'ChatWebsiteId':_0x80a052[_0xba60('0x5c')]['id']},'transaction':_0x19ede6})[_0xba60('0x38')](function(_0x5d2636){var _0x416995=_['map'](_0x80a052[_0xba60('0x61')],function(_0x178b8e){_0x178b8e[_0xba60('0x6e')]=_0x80a052[_0xba60('0x5c')]['id'];return _0x178b8e;});return db[_0xba60('0x11f')][_0xba60('0xe3')](_0x416995,{'transaction':_0x19ede6});});})['then'](function(){return db[_0xba60('0x11f')][_0xba60('0x120')]({'where':{'ChatWebsiteId':_0x80a052[_0xba60('0x5c')]['id']},'order':_0xba60('0x121')});});}})[_0xba60('0x38')](respondWithResult(_0x561940,null))[_0xba60('0x2a')](handleError(_0x561940,null));};exports[_0xba60('0x122')]=function(_0x42c248,_0x1a3c47,_0x1662bf){var _0x1f2b39={};var _0x5758b1={};var _0x2d3e85;var _0x423b4a;return db[_0xba60('0x44')]['findOne']({'where':{'id':_0x42c248[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x1a3c47,null))[_0xba60('0x38')](function(_0x46ffba){if(_0x46ffba){_0x2d3e85=_0x46ffba;_0x5758b1['model']=_[_0xba60('0x5d')](db[_0xba60('0x11f')][_0xba60('0x45')]);_0x5758b1[_0xba60('0x49')]=_['keys'](_0x42c248['query']);_0x5758b1[_0xba60('0x4a')]=_[_0xba60('0x4b')](_0x5758b1['model'],_0x5758b1['query']);_0x1f2b39[_0xba60('0x4c')]=_[_0xba60('0x4b')](_0x5758b1[_0xba60('0x48')],qs[_0xba60('0x4d')](_0x42c248[_0xba60('0x49')][_0xba60('0x4d')]));_0x1f2b39['attributes']=_0x1f2b39['attributes'][_0xba60('0x5e')]?_0x1f2b39[_0xba60('0x4c')]:_0x5758b1['model'];_0x1f2b39[_0xba60('0x4f')]=qs[_0xba60('0x50')](_0x42c248[_0xba60('0x49')]['sort']);_0x1f2b39[_0xba60('0x51')]=qs[_0xba60('0x4a')](_[_0xba60('0x52')](_0x42c248['query'],_0x5758b1[_0xba60('0x4a')]));if(_0x42c248[_0xba60('0x49')][_0xba60('0x53')]){_0x1f2b39[_0xba60('0x51')]=_['merge'](_0x1f2b39['where'],{'$or':_[_0xba60('0x43')](_0x1f2b39['attributes'],function(_0x196e01){var _0x18f96e={};_0x18f96e[_0x196e01]={'$like':'%'+_0x42c248[_0xba60('0x49')][_0xba60('0x53')]+'%'};return _0x18f96e;})});}_0x1f2b39=_[_0xba60('0x54')]({},_0x1f2b39,_0x42c248[_0xba60('0x56')]);return _0x2d3e85[_0xba60('0x122')](_0x1f2b39);}})[_0xba60('0x38')](function(_0x3f1994){if(_0x3f1994){_0x423b4a=_0x3f1994[_0xba60('0x5e')];if(!_0x42c248['query']['hasOwnProperty'](_0xba60('0x4e'))){_0x1f2b39[_0xba60('0x30')]=qs['limit'](_0x42c248[_0xba60('0x49')]['limit']);_0x1f2b39[_0xba60('0x2f')]=qs[_0xba60('0x2f')](_0x42c248[_0xba60('0x49')][_0xba60('0x2f')]);}return _0x2d3e85[_0xba60('0x122')](_0x1f2b39);}})['then'](function(_0x5b1a9e){if(_0x5b1a9e){return _0x5b1a9e?{'count':_0x423b4a,'rows':_0x5b1a9e}:null;}})[_0xba60('0x38')](respondWithResult(_0x1a3c47,null))['catch'](handleError(_0x1a3c47,null));};exports['addProactiveActions']=function(_0x14161f,_0x4bbc24,_0x2f7e1e){return db[_0xba60('0x123')][_0xba60('0x5f')]({'where':{'id':_0x14161f[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x4bbc24,null))['then'](function(_0x1deff1){if(_0x1deff1){return _0x1deff1['addProactiveActions'](_0x14161f[_0xba60('0x61')][_0xba60('0x70')],_[_0xba60('0xfc')](_0x14161f[_0xba60('0x61')],['ids','id'])||{});}})['then'](respondWithResult(_0x4bbc24,null))[_0xba60('0x2a')](handleError(_0x4bbc24,null));};exports['getProactiveActions']=function(_0x22680d,_0x70506d,_0x301ea6){var _0x4761e1={};var _0xe94280={};var _0x436fd9;var _0x548e08;return db[_0xba60('0x44')][_0xba60('0x6b')]({'where':{'id':_0x22680d['params']['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x70506d,null))[_0xba60('0x38')](function(_0x3164eb){if(_0x3164eb){_0x436fd9=_0x3164eb;_0xe94280[_0xba60('0x48')]=_[_0xba60('0x5d')](db[_0xba60('0x124')][_0xba60('0x45')]);_0xe94280['query']=_[_0xba60('0x5d')](_0x22680d[_0xba60('0x49')]);_0xe94280[_0xba60('0x4a')]=_['intersection'](_0xe94280[_0xba60('0x48')],_0xe94280[_0xba60('0x49')]);_0x4761e1['attributes']=_[_0xba60('0x4b')](_0xe94280['model'],qs[_0xba60('0x4d')](_0x22680d[_0xba60('0x49')][_0xba60('0x4d')]));_0x4761e1['attributes']=_0x4761e1[_0xba60('0x4c')][_0xba60('0x5e')]?_0x4761e1[_0xba60('0x4c')]:_0xe94280[_0xba60('0x48')];_0x4761e1['order']=qs[_0xba60('0x50')](_0x22680d[_0xba60('0x49')][_0xba60('0x50')]);_0x4761e1[_0xba60('0x51')]=qs[_0xba60('0x4a')](_[_0xba60('0x52')](_0x22680d[_0xba60('0x49')],_0xe94280[_0xba60('0x4a')]));if(_0x22680d['query'][_0xba60('0x53')]){_0x4761e1['where']=_[_0xba60('0x54')](_0x4761e1[_0xba60('0x51')],{'$or':_[_0xba60('0x43')](_0x4761e1['attributes'],function(_0x3f42ed){var _0x478eba={};_0x478eba[_0x3f42ed]={'$like':'%'+_0x22680d[_0xba60('0x49')][_0xba60('0x53')]+'%'};return _0x478eba;})});}_0x4761e1=_[_0xba60('0x54')]({},_0x4761e1,_0x22680d[_0xba60('0x56')]);return _0x436fd9['getProactiveActions'](_0x4761e1);}})[_0xba60('0x38')](function(_0x3cb3f2){if(_0x3cb3f2){_0x548e08=_0x3cb3f2[_0xba60('0x5e')];if(!_0x22680d[_0xba60('0x49')][_0xba60('0x6d')]('nolimit')){_0x4761e1[_0xba60('0x30')]=qs[_0xba60('0x30')](_0x22680d[_0xba60('0x49')]['limit']);_0x4761e1[_0xba60('0x2f')]=qs['offset'](_0x22680d['query'][_0xba60('0x2f')]);}return _0x436fd9[_0xba60('0x111')](_0x4761e1);}})['then'](function(_0x327353){if(_0x327353){return _0x327353?{'count':_0x548e08,'rows':_0x327353}:null;}})[_0xba60('0x38')](respondWithResult(_0x70506d,null))['catch'](handleError(_0x70506d,null));};exports[_0xba60('0x125')]=function(_0xb60d49,_0xa90353,_0x2a2e9a){var _0x10ec1f=_0xb60d49[_0xba60('0x49')][_0xba60('0x126')]===_0xba60('0x127')?_0xba60('0x128'):_0xba60('0x129');return db[_0xba60('0x44')][_0xba60('0x5f')]({'attributes':['id',_0x10ec1f],'where':{'id':_0xb60d49[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0xa90353,null))[_0xba60('0x38')](function(_0x3bcd76){if(_0x3bcd76){var _0x37258c=_0x3bcd76[_0x10ec1f];var _0x3a3bda=_0x37258c&&_0x37258c['items']?_0x37258c[_0xba60('0x12a')]:[];_0xa90353[_0xba60('0x3f')]({'fromKey':_[_0xba60('0x84')](_0x37258c[_0xba60('0x12b')])?undefined:_0x37258c['fromKey'],'count':_0x3a3bda[_0xba60('0x5e')],'rows':_0x3a3bda});}})['catch'](handleError(_0xa90353,null));};exports['getOfflineMessages']=function(_0x318c15,_0x47bca6,_0x23f7f1){var _0x29f37d={'raw':![],'where':{}};var _0x2a3624={};var _0x1e2af4={'count':0x0,'rows':[]};return db[_0xba60('0x44')][_0xba60('0x6b')]({'where':{'id':_0x318c15['params']['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x47bca6,null))[_0xba60('0x38')](function(_0x832242){if(_0x832242){_0x2a3624['model']=_[_0xba60('0x5d')](db[_0xba60('0xdb')][_0xba60('0x45')]);_0x2a3624['query']=_['keys'](_0x318c15[_0xba60('0x49')]);_0x2a3624['filters']=_[_0xba60('0x4b')](_0x2a3624[_0xba60('0x48')],_0x2a3624[_0xba60('0x49')]);_0x29f37d['attributes']=_['intersection'](_0x2a3624[_0xba60('0x48')],qs[_0xba60('0x4d')](_0x318c15[_0xba60('0x49')][_0xba60('0x4d')]));_0x29f37d[_0xba60('0x4c')]=_0x29f37d[_0xba60('0x4c')][_0xba60('0x5e')]?_0x29f37d[_0xba60('0x4c')]:_0x2a3624['model'];if(!_0x318c15[_0xba60('0x49')]['hasOwnProperty'](_0xba60('0x4e'))){_0x29f37d[_0xba60('0x30')]=qs[_0xba60('0x30')](_0x318c15[_0xba60('0x49')][_0xba60('0x30')]);_0x29f37d[_0xba60('0x2f')]=qs['offset'](_0x318c15[_0xba60('0x49')][_0xba60('0x2f')]);}_0x29f37d[_0xba60('0x4f')]=qs[_0xba60('0x50')](_0x318c15[_0xba60('0x49')]['sort']);_0x29f37d[_0xba60('0x51')]=qs[_0xba60('0x4a')](_[_0xba60('0x52')](_0x318c15['query'],_0x2a3624[_0xba60('0x4a')]));_0x29f37d[_0xba60('0x51')][_0xba60('0x6e')]=_0x832242['id'];if(_0x318c15[_0xba60('0x49')][_0xba60('0x53')]){_0x29f37d[_0xba60('0x51')]=_[_0xba60('0x54')](_0x29f37d[_0xba60('0x51')],{'$or':_[_0xba60('0x43')](_0x29f37d[_0xba60('0x4c')],function(_0x14e8c9){var _0x306a19={};_0x306a19[_0x14e8c9]={'$like':'%'+_0x318c15[_0xba60('0x49')][_0xba60('0x53')]+'%'};return _0x306a19;})});}_0x29f37d=_[_0xba60('0x54')]({},_0x29f37d,_0x318c15[_0xba60('0x56')]);return db['ChatOfflineMessage'][_0xba60('0x32')]({'where':_0x29f37d[_0xba60('0x51')]})[_0xba60('0x38')](function(_0x598ee0){_0x1e2af4[_0xba60('0x32')]=_0x598ee0;if(_0x318c15['query']['includeAll']){_0x29f37d[_0xba60('0x58')]=[{'all':!![]}];}else{_0x29f37d[_0xba60('0x58')]=[{'model':db[_0xba60('0xa1')],'as':'Contact','required':![]},{'model':db[_0xba60('0xe2')],'as':_0xba60('0x12c'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x29f37d);})[_0xba60('0x38')](function(_0x2c3f51){_0x1e2af4['rows']=_0x2c3f51;return _0x1e2af4;});}})['then'](respondWithFilteredResult(_0x47bca6,_0x29f37d))[_0xba60('0x2a')](handleError(_0x47bca6,null));};exports[_0xba60('0x12d')]=function(_0x1305da,_0x4fe3b7,_0x1e98cc){return db[_0xba60('0x44')][_0xba60('0x5f')]({'where':{'id':_0x1305da[_0xba60('0x5c')]['id']}})['then'](handleEntityNotFound(_0x4fe3b7,null))[_0xba60('0x38')](function(_0x12143a){if(_0x12143a){return _0x12143a['addAgents'](_0x1305da[_0xba60('0x61')][_0xba60('0x70')],_[_0xba60('0xfc')](_0x1305da[_0xba60('0x61')],['ids','id'])||{})[_0xba60('0xbd')](function(_0x587d6a){for(var _0x34f48f=0x0;_0x34f48f<_0x1305da[_0xba60('0x61')][_0xba60('0x70')][_0xba60('0x5e')];_0x34f48f+=0x1){socket[_0xba60('0x12e')]('userChatWebsite:save',{'UserId':Number(_0x1305da['body'][_0xba60('0x70')][_0x34f48f]),'ChatWebsiteId':Number(_0x1305da['params']['id'])});}return _0x587d6a;});}})[_0xba60('0x38')](respondWithResult(_0x4fe3b7,null))['catch'](handleError(_0x4fe3b7,null));};exports['removeAgents']=function(_0x24bde2,_0x5302b1,_0x320d88){return db[_0xba60('0x44')][_0xba60('0x5f')]({'where':{'id':_0x24bde2[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x5302b1,null))[_0xba60('0x38')](function(_0x3ddcfb){if(_0x3ddcfb){return _0x3ddcfb['removeAgents'](_0x24bde2[_0xba60('0x49')][_0xba60('0x70')])[_0xba60('0x38')](function(){if(_[_0xba60('0x12f')](_0x24bde2[_0xba60('0x49')]['ids'])){for(var _0x3b2488=0x0;_0x3b2488<_0x24bde2[_0xba60('0x49')]['ids']['length'];_0x3b2488+=0x1){socket[_0xba60('0x12e')]('userChatWebsite:remove',{'UserId':Number(_0x24bde2[_0xba60('0x49')][_0xba60('0x70')][_0x3b2488]),'ChatWebsiteId':Number(_0x24bde2[_0xba60('0x5c')]['id'])});}}else{socket[_0xba60('0x12e')](_0xba60('0x130'),{'UserId':Number(_0x24bde2[_0xba60('0x49')][_0xba60('0x70')]),'ChatWebsiteId':Number(_0x24bde2['params']['id'])});}});}})[_0xba60('0x38')](respondWithStatusCode(_0x5302b1,null))['catch'](handleError(_0x5302b1,null));};exports[_0xba60('0x131')]=function(_0x558b9e,_0x548932,_0x583765){var _0x437f68={};var _0x14613f={};var _0x18d473;var _0x161c3f;return db['ChatWebsite'][_0xba60('0x6b')]({'where':{'id':_0x558b9e[_0xba60('0x5c')]['id']}})[_0xba60('0x38')](handleEntityNotFound(_0x548932,null))[_0xba60('0x38')](function(_0xa04c4f){if(_0xa04c4f){_0x18d473=_0xa04c4f;_0x14613f[_0xba60('0x48')]=_['keys'](db['User'][_0xba60('0x45')]);_0x14613f['query']=_[_0xba60('0x5d')](_0x558b9e[_0xba60('0x49')]);_0x14613f[_0xba60('0x4a')]=_[_0xba60('0x4b')](_0x14613f[_0xba60('0x48')],_0x14613f['query']);_0x437f68[_0xba60('0x4c')]=_[_0xba60('0x4b')](_0x14613f['model'],qs['fields'](_0x558b9e['query'][_0xba60('0x4d')]));_0x437f68[_0xba60('0x4c')]=_0x437f68[_0xba60('0x4c')][_0xba60('0x5e')]?_0x437f68['attributes']:_0x14613f[_0xba60('0x48')];_0x437f68[_0xba60('0x4f')]=qs[_0xba60('0x50')](_0x558b9e[_0xba60('0x49')][_0xba60('0x50')]);_0x437f68[_0xba60('0x51')]=qs[_0xba60('0x4a')](_[_0xba60('0x52')](_0x558b9e[_0xba60('0x49')],_0x14613f[_0xba60('0x4a')]));if(_0x558b9e[_0xba60('0x49')][_0xba60('0x53')]){_0x437f68['where']=_['merge'](_0x437f68[_0xba60('0x51')],{'$or':_[_0xba60('0x43')](_0x437f68[_0xba60('0x4c')],function(_0x1afd89){var _0x2b82a7={};_0x2b82a7[_0x1afd89]={'$like':'%'+_0x558b9e[_0xba60('0x49')][_0xba60('0x53')]+'%'};return _0x2b82a7;})});}_0x437f68=_[_0xba60('0x54')]({},_0x437f68,_0x558b9e['options']);return _0x18d473[_0xba60('0x131')](_0x437f68);}})[_0xba60('0x38')](function(_0x5ca5af){if(_0x5ca5af){_0x161c3f=_0x5ca5af[_0xba60('0x5e')];if(!_0x558b9e[_0xba60('0x49')][_0xba60('0x6d')](_0xba60('0x4e'))){_0x437f68[_0xba60('0x30')]=qs[_0xba60('0x30')](_0x558b9e['query'][_0xba60('0x30')]);_0x437f68[_0xba60('0x2f')]=qs['offset'](_0x558b9e[_0xba60('0x49')][_0xba60('0x2f')]);}return _0x18d473[_0xba60('0x131')](_0x437f68);}})[_0xba60('0x38')](function(_0x146c35){if(_0x146c35){return _0x146c35?{'count':_0x161c3f,'rows':_0x146c35}:null;}})[_0xba60('0x38')](respondWithResult(_0x548932,null))[_0xba60('0x2a')](handleError(_0x548932,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index c5303d1..6c8f482 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 _0x9224=['hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','update','remove','emit'];(function(_0x1963eb,_0x2fb154){var _0xc6afcc=function(_0x5590f3){while(--_0x5590f3){_0x1963eb['push'](_0x1963eb['shift']());}};_0xc6afcc(++_0x2fb154);}(_0x9224,0xa3));var _0x4922=function(_0x100468,_0x20cccd){_0x100468=_0x100468-0x0;var _0xd8582=_0x9224[_0x100468];return _0xd8582;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0x4922('0x0'))['db'][_0x4922('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0x4922('0x2')](0x0);var events={'afterCreate':_0x4922('0x3'),'afterUpdate':_0x4922('0x4'),'afterDestroy':_0x4922('0x5')};function emitEvent(_0x59ed16){return function(_0x582640,_0x572f8f,_0x244e23){ChatWebsiteEvents['emit'](_0x59ed16+':'+_0x582640['id'],_0x582640);ChatWebsiteEvents[_0x4922('0x6')](_0x59ed16,_0x582640);_0x244e23(null);};}for(var e in events){if(events[_0x4922('0x7')](e)){var event=events[e];ChatWebsite[_0x4922('0x8')](e,emitEvent(event));}}module[_0x4922('0x9')]=ChatWebsiteEvents; \ No newline at end of file +var _0xe799=['events','ChatWebsite','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x258340,_0x5dcb68){var _0x5ce531=function(_0x2048e8){while(--_0x2048e8){_0x258340['push'](_0x258340['shift']());}};_0x5ce531(++_0x5dcb68);}(_0xe799,0x170));var _0x9e79=function(_0x498ca0,_0x45dcc6){_0x498ca0=_0x498ca0-0x0;var _0x46b700=_0xe799[_0x498ca0];return _0x46b700;};'use strict';var EventEmitter=require(_0x9e79('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0x9e79('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x9e79('0x2'),'afterUpdate':_0x9e79('0x3'),'afterDestroy':'remove'};function emitEvent(_0x34a40e){return function(_0x3f0a4f,_0x809ffd,_0x4cfc04){ChatWebsiteEvents[_0x9e79('0x4')](_0x34a40e+':'+_0x3f0a4f['id'],_0x3f0a4f);ChatWebsiteEvents['emit'](_0x34a40e,_0x3f0a4f);_0x4cfc04(null);};}for(var e in events){if(events[_0x9e79('0x5')](e)){var event=events[e];ChatWebsite[_0x9e79('0x6')](e,emitEvent(event));}}module[_0x9e79('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 0d5c7c5..26b6bfe 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 _0xd2df=['chat_websites','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','exports','define','ChatWebsite'];(function(_0x179c89,_0x3a69b2){var _0x4b87e5=function(_0xbdf6f2){while(--_0xbdf6f2){_0x179c89['push'](_0x179c89['shift']());}};_0x4b87e5(++_0x3a69b2);}(_0xd2df,0x18d));var _0xfd2d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd2df[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xfd2d('0x0'));var util=require(_0xfd2d('0x1'));var logger=require(_0xfd2d('0x2'))(_0xfd2d('0x3'));var moment=require(_0xfd2d('0x4'));var BPromise=require('bluebird');var rp=require(_0xfd2d('0x5'));var fs=require('fs');var path=require(_0xfd2d('0x6'));var rimraf=require('rimraf');var config=require(_0xfd2d('0x7'));var attributes=require('./chatWebsite.attributes');module[_0xfd2d('0x8')]=function(_0x43ee73,_0x1f96ba){return _0x43ee73[_0xfd2d('0x9')](_0xfd2d('0xa'),attributes,{'tableName':_0xfd2d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x41ba=['path','rimraf','define','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x41ba,0x147));var _0xa41b=function(_0x377c37,_0x480c02){_0x377c37=_0x377c37-0x0;var _0x33b628=_0x41ba[_0x377c37];return _0x33b628;};'use strict';var _=require(_0xa41b('0x0'));var util=require(_0xa41b('0x1'));var logger=require(_0xa41b('0x2'))(_0xa41b('0x3'));var moment=require(_0xa41b('0x4'));var BPromise=require('bluebird');var rp=require(_0xa41b('0x5'));var fs=require('fs');var path=require(_0xa41b('0x6'));var rimraf=require(_0xa41b('0x7'));var config=require('../../config/environment');var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x1b8277,_0x565b62){return _0x1b8277[_0xa41b('0x8')]('ChatWebsite',attributes,{'tableName':'chat_websites','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 7025257..dc09540 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 _0x5426=['./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x12fc8d,_0x19ee33){var _0x3f9d04=function(_0x52e51c){while(--_0x52e51c){_0x12fc8d['push'](_0x12fc8d['shift']());}};_0x3f9d04(++_0x19ee33);}(_0x5426,0x125));var _0x6542=function(_0x5c42c8,_0xb76a51){_0x5c42c8=_0x5c42c8-0x0;var _0x4d0afb=_0x5426[_0x5c42c8];return _0x4d0afb;};'use strict';var _=require('lodash');var util=require(_0x6542('0x0'));var moment=require(_0x6542('0x1'));var BPromise=require(_0x6542('0x2'));var rs=require(_0x6542('0x3'));var fs=require('fs');var Redis=require(_0x6542('0x4'));var db=require(_0x6542('0x5'))['db'];var utils=require(_0x6542('0x6'));var logger=require('../../config/logger')(_0x6542('0x7'));var config=require(_0x6542('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6542('0x9')][_0x6542('0xa')]({'port':0x232a});config[_0x6542('0xb')]=_[_0x6542('0xc')](config[_0x6542('0xb')],{'host':_0x6542('0xd'),'port':0x18eb});var socket=require(_0x6542('0xe'))(new Redis(config[_0x6542('0xb')]));require(_0x6542('0xf'))[_0x6542('0x10')](socket);function respondWithRpcPromise(_0x32f34b,_0x29e1e1,_0x42be4e){return new BPromise(function(_0x1705a0,_0x45fd20){return client[_0x6542('0x11')](_0x32f34b,_0x42be4e)[_0x6542('0x12')](function(_0x4a48c7){logger['info'](_0x6542('0x13'),_0x29e1e1,'request\x20sent');logger[_0x6542('0x14')](_0x6542('0x15'),_0x29e1e1,'request\x20sent',JSON[_0x6542('0x16')](_0x4a48c7));if(_0x4a48c7[_0x6542('0x17')]){if(_0x4a48c7[_0x6542('0x17')][_0x6542('0x18')]===0x1f4){logger[_0x6542('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x29e1e1,_0x4a48c7['error']['message']);return _0x45fd20(_0x4a48c7[_0x6542('0x17')][_0x6542('0x19')]);}logger[_0x6542('0x17')](_0x6542('0x13'),_0x29e1e1,_0x4a48c7[_0x6542('0x17')][_0x6542('0x19')]);return _0x1705a0(_0x4a48c7['error'][_0x6542('0x19')]);}else{logger[_0x6542('0x1a')]('ChatWebsite,\x20%s,\x20%s',_0x29e1e1,'request\x20sent');_0x1705a0(_0x4a48c7['result'][_0x6542('0x19')]);}})[_0x6542('0x1b')](function(_0x283f3d){logger[_0x6542('0x17')](_0x6542('0x13'),_0x29e1e1,_0x283f3d);_0x45fd20(_0x283f3d);});});} \ No newline at end of file +var _0x96b3=['ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','request','then','info'];(function(_0x1a0f69,_0x1242ea){var _0x3521a1=function(_0x20c621){while(--_0x20c621){_0x1a0f69['push'](_0x1a0f69['shift']());}};_0x3521a1(++_0x1242ea);}(_0x96b3,0x75));var _0x396b=function(_0x2aabc9,_0x1d965d){_0x2aabc9=_0x2aabc9-0x0;var _0x40b3c2=_0x96b3[_0x2aabc9];return _0x40b3c2;};'use strict';var _=require(_0x396b('0x0'));var util=require(_0x396b('0x1'));var moment=require('moment');var BPromise=require(_0x396b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x396b('0x3'));var db=require(_0x396b('0x4'))['db'];var utils=require(_0x396b('0x5'));var logger=require(_0x396b('0x6'))('rpc');var config=require(_0x396b('0x7'));var jayson=require(_0x396b('0x8'));var client=jayson['client'][_0x396b('0x9')]({'port':0x232a});config[_0x396b('0xa')]=_[_0x396b('0xb')](config[_0x396b('0xa')],{'host':_0x396b('0xc'),'port':0x18eb});var socket=require(_0x396b('0xd'))(new Redis(config[_0x396b('0xa')]));require(_0x396b('0xe'))['register'](socket);function respondWithRpcPromise(_0x31ac91,_0x3e3013,_0x5704d7){return new BPromise(function(_0x1c0c4b,_0x3add8d){return client[_0x396b('0xf')](_0x31ac91,_0x5704d7)[_0x396b('0x10')](function(_0x4f5949){logger[_0x396b('0x11')](_0x396b('0x12'),_0x3e3013,_0x396b('0x13'));logger['debug'](_0x396b('0x14'),_0x3e3013,_0x396b('0x13'),JSON[_0x396b('0x15')](_0x4f5949));if(_0x4f5949[_0x396b('0x16')]){if(_0x4f5949['error'][_0x396b('0x17')]===0x1f4){logger['error']('ChatWebsite,\x20%s,\x20%s',_0x3e3013,_0x4f5949['error'][_0x396b('0x18')]);return _0x3add8d(_0x4f5949[_0x396b('0x16')][_0x396b('0x18')]);}logger[_0x396b('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x3e3013,_0x4f5949[_0x396b('0x16')][_0x396b('0x18')]);return _0x1c0c4b(_0x4f5949[_0x396b('0x16')][_0x396b('0x18')]);}else{logger[_0x396b('0x11')](_0x396b('0x12'),_0x3e3013,_0x396b('0x13'));_0x1c0c4b(_0x4f5949[_0x396b('0x19')][_0x396b('0x18')]);}})[_0x396b('0x1a')](function(_0x154189){logger[_0x396b('0x16')]('ChatWebsite,\x20%s,\x20%s',_0x3e3013,_0x154189);_0x3add8d(_0x154189);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 4a5a0d9..3ba6a5d 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 _0x806e=['removeListener','register','length','./chatWebsite.events','save','remove','update'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0x806e,0x1a7));var _0xe806=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x806e[_0x20a584];return _0x4b41a8;};'use strict';var ChatWebsiteEvents=require(_0xe806('0x0'));var events=[_0xe806('0x1'),_0xe806('0x2'),_0xe806('0x3')];function createListener(_0x5c622c,_0x11be87){return function(_0xf702){_0x11be87['emit'](_0x5c622c,_0xf702);};}function removeListener(_0x14b7bc,_0x7d8df5){return function(){ChatWebsiteEvents[_0xe806('0x4')](_0x14b7bc,_0x7d8df5);};}exports[_0xe806('0x5')]=function(_0x1f0d0){for(var _0x51a37c=0x0,_0x119441=events[_0xe806('0x6')];_0x51a37c<_0x119441;_0x51a37c++){var _0x53d46a=events[_0x51a37c];var _0x1cba7e=createListener('chatWebsite:'+_0x53d46a,_0x1f0d0);ChatWebsiteEvents['on'](_0x53d46a,_0x1cba7e);}}; \ No newline at end of file +var _0x47cd=['register','length','chatWebsite:','./chatWebsite.events','save','remove','update','emit','removeListener'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x47cd,0x162));var _0xd47c=function(_0x23f49a,_0xf5538e){_0x23f49a=_0x23f49a-0x0;var _0x3934e1=_0x47cd[_0x23f49a];return _0x3934e1;};'use strict';var ChatWebsiteEvents=require(_0xd47c('0x0'));var events=[_0xd47c('0x1'),_0xd47c('0x2'),_0xd47c('0x3')];function createListener(_0x4ff5a1,_0x4b18b0){return function(_0x1d19f3){_0x4b18b0[_0xd47c('0x4')](_0x4ff5a1,_0x1d19f3);};}function removeListener(_0x23a40f,_0x575fc9){return function(){ChatWebsiteEvents[_0xd47c('0x5')](_0x23a40f,_0x575fc9);};}exports[_0xd47c('0x6')]=function(_0x2a77b9){for(var _0x372c89=0x0,_0x40d8e6=events[_0xd47c('0x7')];_0x372c89<_0x40d8e6;_0x372c89++){var _0x39da37=events[_0x372c89];var _0x1b601b=createListener(_0xd47c('0x8')+_0x39da37,_0x2a77b9);ChatWebsiteEvents['on'](_0x39da37,_0x1b601b);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index e4179cb..515ba8b 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 _0xcec9=['server/files/images/avatars/','format','now','addAvatar','addCustomerAvatar','addSystemAvatar','/:id/notify','offline-chat','ensureDir','replace','extname','/:id/offline','any','offline','/:id/applications','addApplications','addProactiveActions','addAgents','put','/:id','update','delete','destroy','removeDispositions','removeAgents','exports','multer','connect-timeout','express','../../config/environment','./chatWebsite.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','getAnswers','/:id/logo','getLogo','/:id/avatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getOfflineMessages','/:id/users','getAgents','post','create','addDisposition','/:id/canned_answers','addAnswer','diskStorage','join','root','server/files/images/logos/','%s-%s','originalname','single','file','addLogo'];(function(_0x445fc4,_0x3fed58){var _0x26dc55=function(_0x132bec){while(--_0x132bec){_0x445fc4['push'](_0x445fc4['shift']());}};_0x26dc55(++_0x3fed58);}(_0xcec9,0x17d));var _0x9cec=function(_0x109b1e,_0x2c11b8){_0x109b1e=_0x109b1e-0x0;var _0x5813ff=_0xcec9[_0x109b1e];return _0x5813ff;};'use strict';var multer=require(_0x9cec('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9cec('0x1'));var express=require(_0x9cec('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9cec('0x3'));var controller=require(_0x9cec('0x4'));router[_0x9cec('0x5')]('/',auth[_0x9cec('0x6')](),controller[_0x9cec('0x7')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x9cec('0x8')]);router['get']('/:id',auth[_0x9cec('0x6')](),controller[_0x9cec('0x9')]);router[_0x9cec('0x5')](_0x9cec('0xa'),auth['isAuthenticated'](),controller[_0x9cec('0xb')]);router[_0x9cec('0x5')]('/:id/canned_answers',auth[_0x9cec('0x6')](),controller[_0x9cec('0xc')]);router[_0x9cec('0x5')](_0x9cec('0xd'),controller[_0x9cec('0xe')]);router[_0x9cec('0x5')](_0x9cec('0xf'),controller['getAvatar']);router[_0x9cec('0x5')](_0x9cec('0x10'),controller[_0x9cec('0x11')]);router[_0x9cec('0x5')](_0x9cec('0x12'),controller[_0x9cec('0x13')]);router[_0x9cec('0x5')](_0x9cec('0x14'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x15')]);router[_0x9cec('0x5')](_0x9cec('0x16'),controller[_0x9cec('0x17')]);router['get']('/:id/applications',auth[_0x9cec('0x6')](),controller[_0x9cec('0x18')]);router['get'](_0x9cec('0x19'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x1a')]);router[_0x9cec('0x5')](_0x9cec('0x1b'),controller['getFields']);router['get']('/:id/offline_messages',auth[_0x9cec('0x6')](),controller[_0x9cec('0x1c')]);router[_0x9cec('0x5')](_0x9cec('0x1d'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x1e')]);router[_0x9cec('0x1f')]('/',auth[_0x9cec('0x6')](),controller[_0x9cec('0x20')]);router[_0x9cec('0x1f')](_0x9cec('0xa'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x21')]);router[_0x9cec('0x1f')](_0x9cec('0x22'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x23')]);var upload=multer({'storage':multer[_0x9cec('0x24')]({'destination':function(_0x4f0979,_0x5f3a10,_0x45ec93){_0x45ec93(null,path[_0x9cec('0x25')](config[_0x9cec('0x26')],_0x9cec('0x27')));},'filename':function(_0x19a8cb,_0x46819e,_0x1f8b89){_0x1f8b89(null,util['format'](_0x9cec('0x28'),Date['now'](),_0x46819e[_0x9cec('0x29')]));}})});router[_0x9cec('0x1f')]('/:id/logo',upload[_0x9cec('0x2a')](_0x9cec('0x2b')),controller[_0x9cec('0x2c')]);var upload=multer({'storage':multer[_0x9cec('0x24')]({'destination':function(_0x3bd7a2,_0x1a486c,_0x5c1577){_0x5c1577(null,path['join'](config[_0x9cec('0x26')],_0x9cec('0x2d')));},'filename':function(_0x28979f,_0x58386b,_0x1fa92e){_0x1fa92e(null,util[_0x9cec('0x2e')](_0x9cec('0x28'),Date[_0x9cec('0x2f')](),_0x58386b[_0x9cec('0x29')]));}})});router['post'](_0x9cec('0xf'),upload[_0x9cec('0x2a')]('file'),controller[_0x9cec('0x30')]);var upload=multer({'storage':multer[_0x9cec('0x24')]({'destination':function(_0x3c54ce,_0x38e543,_0xa2b85e){_0xa2b85e(null,path[_0x9cec('0x25')](config['root'],_0x9cec('0x2d')));},'filename':function(_0x46cb57,_0xb4c416,_0xc2f7a7){_0xc2f7a7(null,util[_0x9cec('0x2e')](_0x9cec('0x28'),Date[_0x9cec('0x2f')](),_0xb4c416[_0x9cec('0x29')]));}})});router[_0x9cec('0x1f')]('/:id/customer_avatar',upload[_0x9cec('0x2a')](_0x9cec('0x2b')),controller[_0x9cec('0x31')]);var upload=multer({'storage':multer[_0x9cec('0x24')]({'destination':function(_0x51757d,_0x320298,_0xc1d186){_0xc1d186(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x100559,_0x428ee7,_0x4ff1c5){_0x4ff1c5(null,util[_0x9cec('0x2e')](_0x9cec('0x28'),Date[_0x9cec('0x2f')](),_0x428ee7['originalname']));}})});router[_0x9cec('0x1f')](_0x9cec('0x12'),upload[_0x9cec('0x2a')](_0x9cec('0x2b')),controller[_0x9cec('0x32')]);router[_0x9cec('0x1f')](_0x9cec('0x33'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x1295b1,_0x27e972,_0x1c295d){const _0x1d5352=path['join'](config[_0x9cec('0x26')],'server/files','attachments',_0x9cec('0x34'));fs_extra[_0x9cec('0x35')](_0x1d5352,function(){_0x1c295d(null,_0x1d5352);});},'filename':function(_0x483db4,_0x5eed54,_0x7b1038){const _0xe14764=_0x5eed54[_0x9cec('0x29')][_0x9cec('0x36')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3c4158=path[_0x9cec('0x37')](_0xe14764);const _0x4fcf09=Date['now']()+'-'+_0xe14764[_0x9cec('0x36')](_0x3c4158,'')+_0x3c4158;_0x7b1038(null,_0x4fcf09);}})});router['post'](_0x9cec('0x38'),offlineUploadMulter[_0x9cec('0x39')](),controller[_0x9cec('0x3a')]);router[_0x9cec('0x1f')](_0x9cec('0x14'),auth[_0x9cec('0x6')](),controller['addInteraction']);router[_0x9cec('0x1f')](_0x9cec('0x3b'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x3c')]);router[_0x9cec('0x1f')](_0x9cec('0x19'),auth['isAuthenticated'](),controller[_0x9cec('0x3d')]);router[_0x9cec('0x1f')](_0x9cec('0x1d'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x3e')]);router[_0x9cec('0x3f')](_0x9cec('0x40'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x41')]);router[_0x9cec('0x42')](_0x9cec('0x40'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x43')]);router[_0x9cec('0x42')](_0x9cec('0xa'),auth[_0x9cec('0x6')](),controller[_0x9cec('0x44')]);router[_0x9cec('0x42')]('/:id/canned_answers',auth[_0x9cec('0x6')](),controller['removeAnswers']);router['delete'](_0x9cec('0x1d'),auth['isAuthenticated'](),controller[_0x9cec('0x45')]);module[_0x9cec('0x46')]=router; \ No newline at end of file +var _0xba02=['post','addDisposition','diskStorage','join','root','server/files/images/logos/','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','addAvatar','addCustomerAvatar','server/files/images/avatars/','/:id/notify','notify','offline-chat','ensureDir','replace','extname','any','offline','addInteraction','/:id/applications','addProactiveActions','addAgents','put','update','delete','removeDispositions','removeAgents','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','index','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','getLogo','getAvatar','/:id/customer_avatar','getCustomerAvatar','/:id/system_avatar','getSystemAvatar','/:id/interactions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','/:id/users','getAgents','create'];(function(_0x3b9bbb,_0x3deb8f){var _0x3517e6=function(_0x3b97a7){while(--_0x3b97a7){_0x3b9bbb['push'](_0x3b9bbb['shift']());}};_0x3517e6(++_0x3deb8f);}(_0xba02,0x69));var _0x2ba0=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0xba02[_0x25d386];return _0x857f4a;};'use strict';var multer=require(_0x2ba0('0x0'));var util=require('util');var path=require(_0x2ba0('0x1'));var timeout=require('connect-timeout');var express=require(_0x2ba0('0x2'));var router=express[_0x2ba0('0x3')]();var fs_extra=require(_0x2ba0('0x4'));var auth=require(_0x2ba0('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2ba0('0x6'));var controller=require('./chatWebsite.controller');router[_0x2ba0('0x7')]('/',auth['isAuthenticated'](),controller[_0x2ba0('0x8')]);router[_0x2ba0('0x7')]('/describe',auth[_0x2ba0('0x9')](),controller[_0x2ba0('0xa')]);router[_0x2ba0('0x7')](_0x2ba0('0xb'),auth[_0x2ba0('0x9')](),controller[_0x2ba0('0xc')]);router[_0x2ba0('0x7')](_0x2ba0('0xd'),auth['isAuthenticated'](),controller[_0x2ba0('0xe')]);router[_0x2ba0('0x7')](_0x2ba0('0xf'),auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x10')]);router[_0x2ba0('0x7')]('/:id/logo',controller[_0x2ba0('0x11')]);router[_0x2ba0('0x7')]('/:id/avatar',controller[_0x2ba0('0x12')]);router[_0x2ba0('0x7')](_0x2ba0('0x13'),controller[_0x2ba0('0x14')]);router[_0x2ba0('0x7')](_0x2ba0('0x15'),controller[_0x2ba0('0x16')]);router['get'](_0x2ba0('0x17'),auth[_0x2ba0('0x9')](),controller['getInteractions']);router[_0x2ba0('0x7')](_0x2ba0('0x18'),controller[_0x2ba0('0x19')]);router['get']('/:id/applications',auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x1a')]);router[_0x2ba0('0x7')](_0x2ba0('0x1b'),auth['isAuthenticated'](),controller[_0x2ba0('0x1c')]);router[_0x2ba0('0x7')](_0x2ba0('0x1d'),controller[_0x2ba0('0x1e')]);router[_0x2ba0('0x7')](_0x2ba0('0x1f'),auth[_0x2ba0('0x9')](),controller['getOfflineMessages']);router[_0x2ba0('0x7')](_0x2ba0('0x20'),auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x21')]);router['post']('/',auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x22')]);router[_0x2ba0('0x23')](_0x2ba0('0xd'),auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x24')]);router[_0x2ba0('0x23')](_0x2ba0('0xf'),auth[_0x2ba0('0x9')](),controller['addAnswer']);var upload=multer({'storage':multer[_0x2ba0('0x25')]({'destination':function(_0x4ee461,_0xace504,_0x59a1a6){_0x59a1a6(null,path[_0x2ba0('0x26')](config[_0x2ba0('0x27')],_0x2ba0('0x28')));},'filename':function(_0x226708,_0x55d8fa,_0x1cdd0c){_0x1cdd0c(null,util[_0x2ba0('0x29')](_0x2ba0('0x2a'),Date[_0x2ba0('0x2b')](),_0x55d8fa[_0x2ba0('0x2c')]));}})});router[_0x2ba0('0x23')](_0x2ba0('0x2d'),upload[_0x2ba0('0x2e')](_0x2ba0('0x2f')),controller[_0x2ba0('0x30')]);var upload=multer({'storage':multer[_0x2ba0('0x25')]({'destination':function(_0x5d1758,_0x595f8f,_0x313bf6){_0x313bf6(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x455103,_0x551352,_0x4ed3df){_0x4ed3df(null,util[_0x2ba0('0x29')](_0x2ba0('0x2a'),Date['now'](),_0x551352['originalname']));}})});router[_0x2ba0('0x23')]('/:id/avatar',upload[_0x2ba0('0x2e')](_0x2ba0('0x2f')),controller[_0x2ba0('0x31')]);var upload=multer({'storage':multer[_0x2ba0('0x25')]({'destination':function(_0x47c62f,_0x23ee83,_0x53321c){_0x53321c(null,path['join'](config[_0x2ba0('0x27')],'server/files/images/avatars/'));},'filename':function(_0x183a57,_0x96f77e,_0x23b0b6){_0x23b0b6(null,util[_0x2ba0('0x29')](_0x2ba0('0x2a'),Date[_0x2ba0('0x2b')](),_0x96f77e['originalname']));}})});router[_0x2ba0('0x23')](_0x2ba0('0x13'),upload[_0x2ba0('0x2e')](_0x2ba0('0x2f')),controller[_0x2ba0('0x32')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x200846,_0x57a8e1,_0x540a7c){_0x540a7c(null,path[_0x2ba0('0x26')](config['root'],_0x2ba0('0x33')));},'filename':function(_0x44529b,_0x3edf15,_0x48470b){_0x48470b(null,util['format']('%s-%s',Date[_0x2ba0('0x2b')](),_0x3edf15[_0x2ba0('0x2c')]));}})});router[_0x2ba0('0x23')](_0x2ba0('0x15'),upload['single'](_0x2ba0('0x2f')),controller['addSystemAvatar']);router['post'](_0x2ba0('0x34'),controller[_0x2ba0('0x35')]);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x216775,_0x272ad3,_0x43f4fd){const _0x5b8e31=path[_0x2ba0('0x26')](config[_0x2ba0('0x27')],'server/files','attachments',_0x2ba0('0x36'));fs_extra[_0x2ba0('0x37')](_0x5b8e31,function(){_0x43f4fd(null,_0x5b8e31);});},'filename':function(_0x2cff25,_0x8afe6d,_0x5258a5){const _0x2b0c0f=_0x8afe6d[_0x2ba0('0x2c')][_0x2ba0('0x38')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0xced879=path[_0x2ba0('0x39')](_0x2b0c0f);const _0x32752f=Date['now']()+'-'+_0x2b0c0f[_0x2ba0('0x38')](_0xced879,'')+_0xced879;_0x5258a5(null,_0x32752f);}})});router['post']('/:id/offline',offlineUploadMulter[_0x2ba0('0x3a')](),controller[_0x2ba0('0x3b')]);router['post'](_0x2ba0('0x17'),auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x3c')]);router[_0x2ba0('0x23')](_0x2ba0('0x3d'),auth[_0x2ba0('0x9')](),controller['addApplications']);router['post'](_0x2ba0('0x1b'),auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x3e')]);router[_0x2ba0('0x23')](_0x2ba0('0x20'),auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x3f')]);router[_0x2ba0('0x40')](_0x2ba0('0xb'),auth['isAuthenticated'](),controller[_0x2ba0('0x41')]);router['delete'](_0x2ba0('0xb'),auth['isAuthenticated'](),controller['destroy']);router[_0x2ba0('0x42')]('/:id/dispositions',auth[_0x2ba0('0x9')](),controller[_0x2ba0('0x43')]);router[_0x2ba0('0x42')]('/:id/canned_answers',auth[_0x2ba0('0x9')](),controller['removeAnswers']);router[_0x2ba0('0x42')](_0x2ba0('0x20'),auth['isAuthenticated'](),controller[_0x2ba0('0x44')]);module[_0x2ba0('0x45')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index d4ddff2..f5f54fe 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 _0xc812=['STRING','AmazonAWS','Google','sequelize','exports'];(function(_0x1de0f6,_0x524b66){var _0x220d44=function(_0x54a04a){while(--_0x54a04a){_0x1de0f6['push'](_0x1de0f6['shift']());}};_0x220d44(++_0x524b66);}(_0xc812,0xbc));var _0x2c81=function(_0x203ae3,_0x32dcd9){_0x203ae3=_0x203ae3-0x0;var _0x1088bb=_0xc812[_0x203ae3];return _0x1088bb;};'use strict';var Sequelize=require(_0x2c81('0x0'));module[_0x2c81('0x1')]={'name':{'type':Sequelize[_0x2c81('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x2c81('0x3'),_0x2c81('0x4')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize[_0x2c81('0x2')]},'data2':{'type':Sequelize[_0x2c81('0x2')]}}; \ No newline at end of file +var _0x7d10=['AmazonAWS','Google','exports','STRING'];(function(_0x530498,_0x4a8d94){var _0x24a0e2=function(_0x147d26){while(--_0x147d26){_0x530498['push'](_0x530498['shift']());}};_0x24a0e2(++_0x4a8d94);}(_0x7d10,0x1ce));var _0x07d1=function(_0x3b5e09,_0x45b0f3){_0x3b5e09=_0x3b5e09-0x0;var _0x2a1708=_0x7d10[_0x3b5e09];return _0x2a1708;};'use strict';var Sequelize=require('sequelize');module[_0x07d1('0x0')]={'name':{'type':Sequelize[_0x07d1('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize['ENUM'](_0x07d1('0x2'),_0x07d1('0x3')),'allowNull':![],'validate':{'notEmpty':!![]}},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x07d1('0x1')]}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index ff7e3bf..3e4f374 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 _0x2032=['body','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','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','CloudProvider','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','rows','show','params','keys','rawAttributes','includeAll','find','catch'];(function(_0x158f9c,_0x207274){var _0x4e54df=function(_0x2290ed){while(--_0x2290ed){_0x158f9c['push'](_0x158f9c['shift']());}};_0x4e54df(++_0x207274);}(_0x2032,0xd9));var _0x2203=function(_0x2dfd51,_0xa6ea78){_0x2dfd51=_0x2dfd51-0x0;var _0x5cabf8=_0x2032[_0x2dfd51];return _0x5cabf8;};'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'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'all':!![]}];}return db[_0x2203('0x2c')]['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x446209){_0x34b8ba[_0x2203('0x3f')]=_0x446209;return _0x34b8ba;})['then'](respondWithFilteredResult(_0x1df508,_0x9c53f))['catch'](handleError(_0x1df508,null));};exports[_0x2203('0x40')]=function(_0x3739f6,_0x368444){var _0x1e09f3={'raw':!![],'where':{'id':_0x3739f6[_0x2203('0x41')]['id']}},_0x372709={};_0x372709['model']=_[_0x2203('0x42')](db[_0x2203('0x2c')][_0x2203('0x43')]);_0x372709[_0x2203('0x30')]=_[_0x2203('0x42')](_0x3739f6[_0x2203('0x30')]);_0x372709[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],_0x372709[_0x2203('0x30')]);_0x1e09f3['attributes']=_[_0x2203('0x33')](_0x372709[_0x2203('0x31')],qs[_0x2203('0x34')](_0x3739f6[_0x2203('0x30')]['fields']));_0x1e09f3['attributes']=_0x1e09f3[_0x2203('0x32')]['length']?_0x1e09f3[_0x2203('0x32')]:_0x372709[_0x2203('0x31')];if(_0x3739f6[_0x2203('0x30')][_0x2203('0x44')]){_0x1e09f3['include']=[{'all':!![]}];}_0x1e09f3=_[_0x2203('0x3c')]({},_0x1e09f3,_0x3739f6[_0x2203('0x3e')]);return db['CloudProvider'][_0x2203('0x45')](_0x1e09f3)[_0x2203('0x23')](handleEntityNotFound(_0x368444,null))[_0x2203('0x23')](respondWithResult(_0x368444,null))[_0x2203('0x46')](handleError(_0x368444,null));};exports['create']=function(_0x4c1a29,_0x21b8ab){return db['CloudProvider']['create'](_0x4c1a29[_0x2203('0x47')],{})[_0x2203('0x23')](respondWithResult(_0x21b8ab,0xc9))[_0x2203('0x46')](handleError(_0x21b8ab,null));};exports['update']=function(_0x4c1496,_0x131aec){if(_0x4c1496[_0x2203('0x47')]['id']){delete _0x4c1496[_0x2203('0x47')]['id'];}return db[_0x2203('0x2c')][_0x2203('0x45')]({'where':{'id':_0x4c1496[_0x2203('0x41')]['id']}})['then'](handleEntityNotFound(_0x131aec,null))[_0x2203('0x23')](saveUpdates(_0x4c1496['body'],null))[_0x2203('0x23')](respondWithResult(_0x131aec,null))[_0x2203('0x46')](handleError(_0x131aec,null));};exports[_0x2203('0x24')]=function(_0x1e49dd,_0x58b9bb){return db['CloudProvider'][_0x2203('0x45')]({'where':{'id':_0x1e49dd[_0x2203('0x41')]['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x58b9bb,null))[_0x2203('0x23')](removeEntity(_0x58b9bb,null))['catch'](handleError(_0x58b9bb,null));}; \ No newline at end of file +var _0x2ef3=['update','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','CloudProvider','then','includeAll','include','findAll','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save'];(function(_0x48a397,_0x1d039a){var _0x3b1f03=function(_0x5cdf2e){while(--_0x5cdf2e){_0x48a397['push'](_0x48a397['shift']());}};_0x3b1f03(++_0x1d039a);}(_0x2ef3,0xba));var _0x32ef=function(_0x2deef5,_0xd7900c){_0x2deef5=_0x2deef5-0x0;var _0x5a6aa7=_0x2ef3[_0x2deef5];return _0x5a6aa7;};'use strict';var emlformat=require(_0x32ef('0x0'));var rimraf=require(_0x32ef('0x1'));var zipdir=require(_0x32ef('0x2'));var jsonpatch=require(_0x32ef('0x3'));var rp=require(_0x32ef('0x4'));var moment=require(_0x32ef('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x32ef('0x6'));var util=require(_0x32ef('0x7'));var path=require('path');var sox=require(_0x32ef('0x8'));var csv=require(_0x32ef('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x32ef('0xa'));var squel=require(_0x32ef('0xb'));var crypto=require(_0x32ef('0xc'));var jsforce=require(_0x32ef('0xd'));var deskjs=require(_0x32ef('0xe'));var toCsv=require(_0x32ef('0x9'));var querystring=require(_0x32ef('0xf'));var Papa=require(_0x32ef('0x10'));var Redis=require(_0x32ef('0x11'));var authService=require(_0x32ef('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x32ef('0x13'));var logger=require(_0x32ef('0x14'))(_0x32ef('0x15'));var utils=require(_0x32ef('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x32ef('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5106,_0x49d590){_0x49d590=_0x49d590||0xcc;return function(_0x3e98df){if(_0x3e98df){return _0x1a5106[_0x32ef('0x18')](_0x49d590);}return _0x1a5106['status'](_0x49d590)['end']();};}function respondWithResult(_0x19ce1,_0x4d8009){_0x4d8009=_0x4d8009||0xc8;return function(_0x326fce){if(_0x326fce){return _0x19ce1[_0x32ef('0x19')](_0x4d8009)[_0x32ef('0x1a')](_0x326fce);}};}function respondWithFilteredResult(_0x54c7f5,_0x57aff1){return function(_0x55bf0b){if(_0x55bf0b){var _0x531e30=typeof _0x57aff1[_0x32ef('0x1b')]===_0x32ef('0x1c')&&typeof _0x57aff1[_0x32ef('0x1d')]==='undefined';var _0x5d559b=_0x55bf0b[_0x32ef('0x1e')];var _0x1a9476=_0x531e30?0x0:_0x57aff1[_0x32ef('0x1b')];var _0x57863c=_0x531e30?_0x55bf0b[_0x32ef('0x1e')]:_0x57aff1[_0x32ef('0x1b')]+_0x57aff1['limit'];var _0x304505;if(_0x57863c>=_0x5d559b){_0x57863c=_0x5d559b;_0x304505=0xc8;}else{_0x304505=0xce;}_0x54c7f5[_0x32ef('0x19')](_0x304505);return _0x54c7f5[_0x32ef('0x1f')](_0x32ef('0x20'),_0x1a9476+'-'+_0x57863c+'/'+_0x5d559b)[_0x32ef('0x1a')](_0x55bf0b);}return null;};}function patchUpdates(_0x3aec05){return function(_0x4de441){try{jsonpatch[_0x32ef('0x21')](_0x4de441,_0x3aec05,!![]);}catch(_0x5cc3ef){return BPromise[_0x32ef('0x22')](_0x5cc3ef);}return _0x4de441[_0x32ef('0x23')]();};}function saveUpdates(_0x49f2d8,_0x1af371){return function(_0x97780){if(_0x97780){return _0x97780[_0x32ef('0x24')](_0x49f2d8)['then'](function(_0x57f5e5){return _0x57f5e5;});}return null;};}function removeEntity(_0x22f2d7,_0xb30fab){return function(_0x225feb){if(_0x225feb){return _0x225feb['destroy']()['then'](function(){_0x22f2d7[_0x32ef('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51a412,_0x278495){return function(_0x14d4b3){if(!_0x14d4b3){_0x51a412[_0x32ef('0x18')](0x194);}return _0x14d4b3;};}function handleError(_0x1dbe98,_0x15ce54){_0x15ce54=_0x15ce54||0x1f4;return function(_0x234175){logger[_0x32ef('0x25')](_0x234175[_0x32ef('0x26')]);if(_0x234175[_0x32ef('0x27')]){delete _0x234175[_0x32ef('0x27')];}_0x1dbe98[_0x32ef('0x19')](_0x15ce54)[_0x32ef('0x28')](_0x234175);};}exports['index']=function(_0xd65fde,_0x2f5d06){var _0x5a04cd={},_0x12de1a={},_0x3c569d={'count':0x0,'rows':[]};var _0x30b250=_[_0x32ef('0x29')](db['CloudProvider'][_0x32ef('0x2a')],function(_0x22bf86){return{'name':_0x22bf86[_0x32ef('0x2b')],'type':_0x22bf86[_0x32ef('0x2c')][_0x32ef('0x2d')]};});_0x12de1a[_0x32ef('0x2e')]=_[_0x32ef('0x29')](_0x30b250,'name');_0x12de1a[_0x32ef('0x2f')]=_['keys'](_0xd65fde[_0x32ef('0x2f')]);_0x12de1a[_0x32ef('0x30')]=_['intersection'](_0x12de1a[_0x32ef('0x2e')],_0x12de1a[_0x32ef('0x2f')]);_0x5a04cd[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x12de1a[_0x32ef('0x2e')],qs['fields'](_0xd65fde['query'][_0x32ef('0x33')]));_0x5a04cd['attributes']=_0x5a04cd[_0x32ef('0x31')][_0x32ef('0x34')]?_0x5a04cd[_0x32ef('0x31')]:_0x12de1a[_0x32ef('0x2e')];if(!_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x35')]('nolimit')){_0x5a04cd['limit']=qs['limit'](_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x1d')]);_0x5a04cd[_0x32ef('0x1b')]=qs['offset'](_0xd65fde['query'][_0x32ef('0x1b')]);}_0x5a04cd[_0x32ef('0x36')]=qs[_0x32ef('0x37')](_0xd65fde['query']['sort']);_0x5a04cd[_0x32ef('0x38')]=qs[_0x32ef('0x30')](_[_0x32ef('0x39')](_0xd65fde[_0x32ef('0x2f')],_0x12de1a[_0x32ef('0x30')]),_0x30b250);if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]){_0x5a04cd[_0x32ef('0x38')]=_[_0x32ef('0x3b')](_0x5a04cd['where'],{'$or':_[_0x32ef('0x29')](_0x30b250,function(_0x36e374){if(_0x36e374[_0x32ef('0x2c')]!=='VIRTUAL'){var _0x365125={};_0x365125[_0x36e374[_0x32ef('0x27')]]={'$like':'%'+_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3a')]+'%'};return _0x365125;}})});}_0x5a04cd=_[_0x32ef('0x3b')]({},_0x5a04cd,_0xd65fde[_0x32ef('0x3c')]);var _0x256c40={'where':_0x5a04cd[_0x32ef('0x38')]};return db[_0x32ef('0x3d')][_0x32ef('0x1e')](_0x256c40)[_0x32ef('0x3e')](function(_0x4615b4){_0x3c569d['count']=_0x4615b4;if(_0xd65fde[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5a04cd[_0x32ef('0x40')]=[{'all':!![]}];}return db[_0x32ef('0x3d')][_0x32ef('0x41')](_0x5a04cd);})[_0x32ef('0x3e')](function(_0x3c0e44){_0x3c569d['rows']=_0x3c0e44;return _0x3c569d;})['then'](respondWithFilteredResult(_0x2f5d06,_0x5a04cd))[_0x32ef('0x42')](handleError(_0x2f5d06,null));};exports[_0x32ef('0x43')]=function(_0x2a33dd,_0x765c63){var _0x5dca14={'raw':!![],'where':{'id':_0x2a33dd[_0x32ef('0x44')]['id']}},_0x2901a1={};_0x2901a1['model']=_[_0x32ef('0x45')](db['CloudProvider'][_0x32ef('0x2a')]);_0x2901a1[_0x32ef('0x2f')]=_[_0x32ef('0x45')](_0x2a33dd[_0x32ef('0x2f')]);_0x2901a1[_0x32ef('0x30')]=_[_0x32ef('0x32')](_0x2901a1[_0x32ef('0x2e')],_0x2901a1[_0x32ef('0x2f')]);_0x5dca14[_0x32ef('0x31')]=_[_0x32ef('0x32')](_0x2901a1['model'],qs[_0x32ef('0x33')](_0x2a33dd['query'][_0x32ef('0x33')]));_0x5dca14[_0x32ef('0x31')]=_0x5dca14[_0x32ef('0x31')]['length']?_0x5dca14[_0x32ef('0x31')]:_0x2901a1[_0x32ef('0x2e')];if(_0x2a33dd[_0x32ef('0x2f')][_0x32ef('0x3f')]){_0x5dca14[_0x32ef('0x40')]=[{'all':!![]}];}_0x5dca14=_[_0x32ef('0x3b')]({},_0x5dca14,_0x2a33dd[_0x32ef('0x3c')]);return db['CloudProvider']['find'](_0x5dca14)[_0x32ef('0x3e')](handleEntityNotFound(_0x765c63,null))[_0x32ef('0x3e')](respondWithResult(_0x765c63,null))[_0x32ef('0x42')](handleError(_0x765c63,null));};exports[_0x32ef('0x46')]=function(_0x209361,_0xd67dc9){return db[_0x32ef('0x3d')][_0x32ef('0x46')](_0x209361[_0x32ef('0x47')],{})[_0x32ef('0x3e')](respondWithResult(_0xd67dc9,0xc9))[_0x32ef('0x42')](handleError(_0xd67dc9,null));};exports[_0x32ef('0x24')]=function(_0x36a65c,_0x4c2534){if(_0x36a65c[_0x32ef('0x47')]['id']){delete _0x36a65c[_0x32ef('0x47')]['id'];}return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x36a65c[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x4c2534,null))[_0x32ef('0x3e')](saveUpdates(_0x36a65c[_0x32ef('0x47')],null))[_0x32ef('0x3e')](respondWithResult(_0x4c2534,null))[_0x32ef('0x42')](handleError(_0x4c2534,null));};exports[_0x32ef('0x49')]=function(_0x29d456,_0x272377){return db[_0x32ef('0x3d')][_0x32ef('0x48')]({'where':{'id':_0x29d456[_0x32ef('0x44')]['id']}})[_0x32ef('0x3e')](handleEntityNotFound(_0x272377,null))[_0x32ef('0x3e')](removeEntity(_0x272377,null))['catch'](handleError(_0x272377,null));}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index e02fae9..dd5cc7f 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 _0x64fa=['./cloudProvider.attributes','exports','define','cloud_providers','lodash','util','../../config/logger','moment','bluebird','request-promise','../../config/environment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x64fa,0x14e));var _0xa64f=function(_0x1eb017,_0x27ec0b){_0x1eb017=_0x1eb017-0x0;var _0x5f2f07=_0x64fa[_0x1eb017];return _0x5f2f07;};'use strict';var _=require(_0xa64f('0x0'));var util=require(_0xa64f('0x1'));var logger=require(_0xa64f('0x2'))('api');var moment=require(_0xa64f('0x3'));var BPromise=require(_0xa64f('0x4'));var rp=require(_0xa64f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xa64f('0x6'));var attributes=require(_0xa64f('0x7'));module[_0xa64f('0x8')]=function(_0x966fba,_0x42c913){return _0x966fba[_0xa64f('0x9')]('CloudProvider',attributes,{'tableName':_0xa64f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe0f=['lodash','util','api','moment','bluebird','request-promise','rimraf','./cloudProvider.attributes','define','CloudProvider'];(function(_0x3e98a8,_0xccee6c){var _0x1c58e9=function(_0x45534f){while(--_0x45534f){_0x3e98a8['push'](_0x3e98a8['shift']());}};_0x1c58e9(++_0xccee6c);}(_0xfe0f,0x136));var _0xffe0=function(_0x40c81c,_0x4be505){_0x40c81c=_0x40c81c-0x0;var _0x1b4116=_0xfe0f[_0x40c81c];return _0x1b4116;};'use strict';var _=require(_0xffe0('0x0'));var util=require(_0xffe0('0x1'));var logger=require('../../config/logger')(_0xffe0('0x2'));var moment=require(_0xffe0('0x3'));var BPromise=require(_0xffe0('0x4'));var rp=require(_0xffe0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xffe0('0x6'));var config=require('../../config/environment');var attributes=require(_0xffe0('0x7'));module['exports']=function(_0x439c09,_0x55d74a){return _0x439c09[_0xffe0('0x8')](_0xffe0('0x9'),attributes,{'tableName':'cloud_providers','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 e17750e..cf3f753 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 _0x1f75=['catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','CloudProvider,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x35e433,_0x4eb657){var _0x283366=function(_0x27557c){while(--_0x27557c){_0x35e433['push'](_0x35e433['shift']());}};_0x283366(++_0x4eb657);}(_0x1f75,0x13c));var _0x51f7=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0x1f75[_0x45e98e];return _0x374dba;};'use strict';var _=require('lodash');var util=require(_0x51f7('0x0'));var moment=require(_0x51f7('0x1'));var BPromise=require(_0x51f7('0x2'));var rs=require(_0x51f7('0x3'));var fs=require('fs');var Redis=require(_0x51f7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x51f7('0x5'));var logger=require(_0x51f7('0x6'))(_0x51f7('0x7'));var config=require(_0x51f7('0x8'));var jayson=require(_0x51f7('0x9'));var client=jayson[_0x51f7('0xa')][_0x51f7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xb4e621,_0x3d2a15,_0x47069a){return new BPromise(function(_0x20d374,_0x4158a6){return client['request'](_0xb4e621,_0x47069a)[_0x51f7('0xc')](function(_0x450767){logger['info'](_0x51f7('0xd'),_0x3d2a15,_0x51f7('0xe'));logger['debug']('CloudProvider,\x20%s,\x20%s,\x20%s',_0x3d2a15,_0x51f7('0xe'),JSON[_0x51f7('0xf')](_0x450767));if(_0x450767['error']){if(_0x450767[_0x51f7('0x10')][_0x51f7('0x11')]===0x1f4){logger['error'](_0x51f7('0xd'),_0x3d2a15,_0x450767[_0x51f7('0x10')][_0x51f7('0x12')]);return _0x4158a6(_0x450767['error']['message']);}logger[_0x51f7('0x10')](_0x51f7('0xd'),_0x3d2a15,_0x450767[_0x51f7('0x10')][_0x51f7('0x12')]);return _0x20d374(_0x450767[_0x51f7('0x10')][_0x51f7('0x12')]);}else{logger['info'](_0x51f7('0xd'),_0x3d2a15,_0x51f7('0xe'));_0x20d374(_0x450767[_0x51f7('0x13')][_0x51f7('0x12')]);}})[_0x51f7('0x14')](function(_0x1b3532){logger[_0x51f7('0x10')]('CloudProvider,\x20%s,\x20%s',_0x3d2a15,_0x1b3532);_0x4158a6(_0x1b3532);});});} \ No newline at end of file +var _0xb94c=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','CloudProvider,\x20%s,\x20%s','debug','CloudProvider,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0xb94c,0x176));var _0xcb94=function(_0x4bd361,_0x1c15e){_0x4bd361=_0x4bd361-0x0;var _0x1d41c5=_0xb94c[_0x4bd361];return _0x1d41c5;};'use strict';var _=require(_0xcb94('0x0'));var util=require(_0xcb94('0x1'));var moment=require('moment');var BPromise=require(_0xcb94('0x2'));var rs=require(_0xcb94('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xcb94('0x5'))(_0xcb94('0x6'));var config=require(_0xcb94('0x7'));var jayson=require(_0xcb94('0x8'));var client=jayson[_0xcb94('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ab328,_0x27441c,_0x20f879){return new BPromise(function(_0x22cac1,_0x16288f){return client['request'](_0x3ab328,_0x20f879)[_0xcb94('0xa')](function(_0x3305c9){logger[_0xcb94('0xb')](_0xcb94('0xc'),_0x27441c,'request\x20sent');logger[_0xcb94('0xd')](_0xcb94('0xe'),_0x27441c,_0xcb94('0xf'),JSON[_0xcb94('0x10')](_0x3305c9));if(_0x3305c9[_0xcb94('0x11')]){if(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x12')]===0x1f4){logger[_0xcb94('0x11')](_0xcb94('0xc'),_0x27441c,_0x3305c9[_0xcb94('0x11')]['message']);return _0x16288f(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x13')]);}logger['error']('CloudProvider,\x20%s,\x20%s',_0x27441c,_0x3305c9['error']['message']);return _0x22cac1(_0x3305c9[_0xcb94('0x11')][_0xcb94('0x13')]);}else{logger[_0xcb94('0xb')]('CloudProvider,\x20%s,\x20%s',_0x27441c,_0xcb94('0xf'));_0x22cac1(_0x3305c9['result'][_0xcb94('0x13')]);}})[_0xcb94('0x14')](function(_0x3dbfbb){logger[_0xcb94('0x11')](_0xcb94('0xc'),_0x27441c,_0x3dbfbb);_0x16288f(_0x3dbfbb);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 9a50397..262c49c 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 _0x2c06=['multer','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./cloudProvider.controller','get','isAuthenticated','index','/:id','show','post','update','delete','destroy','exports'];(function(_0x53e296,_0x4526d7){var _0x23b042=function(_0x1fa38a){while(--_0x1fa38a){_0x53e296['push'](_0x53e296['shift']());}};_0x23b042(++_0x4526d7);}(_0x2c06,0x1dc));var _0x62c0=function(_0x58b95c,_0x59e69b){_0x58b95c=_0x58b95c-0x0;var _0x1a2bba=_0x2c06[_0x58b95c];return _0x1a2bba;};'use strict';var multer=require(_0x62c0('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x62c0('0x1'));var express=require(_0x62c0('0x2'));var router=express['Router']();var fs_extra=require(_0x62c0('0x3'));var auth=require(_0x62c0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x62c0('0x5'));var controller=require(_0x62c0('0x6'));router[_0x62c0('0x7')]('/',auth[_0x62c0('0x8')](),controller[_0x62c0('0x9')]);router[_0x62c0('0x7')](_0x62c0('0xa'),auth[_0x62c0('0x8')](),controller[_0x62c0('0xb')]);router[_0x62c0('0xc')]('/',auth[_0x62c0('0x8')](),controller['create']);router['put'](_0x62c0('0xa'),auth[_0x62c0('0x8')](),controller[_0x62c0('0xd')]);router[_0x62c0('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x62c0('0xf')]);module[_0x62c0('0x10')]=router; \ No newline at end of file +var _0x7cdc=['util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','put','update','destroy','exports'];(function(_0x381379,_0x3f3b86){var _0x3e1063=function(_0x4c282d){while(--_0x4c282d){_0x381379['push'](_0x381379['shift']());}};_0x3e1063(++_0x3f3b86);}(_0x7cdc,0x190));var _0xc7cd=function(_0x203c91,_0x1ac27f){_0x203c91=_0x203c91-0x0;var _0x4f3e46=_0x7cdc[_0x203c91];return _0x4f3e46;};'use strict';var multer=require('multer');var util=require(_0xc7cd('0x0'));var path=require(_0xc7cd('0x1'));var timeout=require('connect-timeout');var express=require(_0xc7cd('0x2'));var router=express[_0xc7cd('0x3')]();var fs_extra=require(_0xc7cd('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc7cd('0x5'));var config=require(_0xc7cd('0x6'));var controller=require('./cloudProvider.controller');router[_0xc7cd('0x7')]('/',auth[_0xc7cd('0x8')](),controller[_0xc7cd('0x9')]);router[_0xc7cd('0x7')](_0xc7cd('0xa'),auth[_0xc7cd('0x8')](),controller[_0xc7cd('0xb')]);router['post']('/',auth[_0xc7cd('0x8')](),controller['create']);router[_0xc7cd('0xc')](_0xc7cd('0xa'),auth[_0xc7cd('0x8')](),controller[_0xc7cd('0xd')]);router['delete'](_0xc7cd('0xa'),auth[_0xc7cd('0x8')](),controller[_0xc7cd('0xe')]);module[_0xc7cd('0xf')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index c224364..9f0171f 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 _0x4bd0=['STRING','name'];(function(_0x4ca1b8,_0x9faad5){var _0x49b9e4=function(_0x360bcd){while(--_0x360bcd){_0x4ca1b8['push'](_0x4ca1b8['shift']());}};_0x49b9e4(++_0x9faad5);}(_0x4bd0,0x143));var _0x04bd=function(_0x11fb47,_0x50fbf8){_0x11fb47=_0x11fb47-0x0;var _0xa0d270=_0x4bd0[_0x11fb47];return _0xa0d270;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x04bd('0x0'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x04bd('0x1')]},'companyId':{'type':Sequelize[_0x04bd('0x1')]},'website':{'type':Sequelize[_0x04bd('0x1')]},'phone':{'type':Sequelize[_0x04bd('0x1')]},'fax':{'type':Sequelize[_0x04bd('0x1')]},'type':{'type':Sequelize[_0x04bd('0x1')]},'street':{'type':Sequelize[_0x04bd('0x1')]},'postalCode':{'type':Sequelize[_0x04bd('0x1')]},'city':{'type':Sequelize[_0x04bd('0x1')]},'country':{'type':Sequelize[_0x04bd('0x1')]},'email':{'type':Sequelize[_0x04bd('0x1')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x04bd('0x1')]},'sStreet':{'type':Sequelize[_0x04bd('0x1')]},'sPostalCode':{'type':Sequelize[_0x04bd('0x1')]},'sCity':{'type':Sequelize[_0x04bd('0x1')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x04bd('0x1')]}}; \ No newline at end of file +var _0xa7ac=['STRING','exports','name'];(function(_0x8d7eee,_0x1f8cbb){var _0x29157a=function(_0x48d630){while(--_0x48d630){_0x8d7eee['push'](_0x8d7eee['shift']());}};_0x29157a(++_0x1f8cbb);}(_0xa7ac,0x14e));var _0xca7a=function(_0x27dc64,_0x247c79){_0x27dc64=_0x27dc64-0x0;var _0x33b77a=_0xa7ac[_0x27dc64];return _0x33b77a;};'use strict';var Sequelize=require('sequelize');module[_0xca7a('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0xca7a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize['STRING']},'companyId':{'type':Sequelize[_0xca7a('0x2')]},'website':{'type':Sequelize[_0xca7a('0x2')]},'phone':{'type':Sequelize[_0xca7a('0x2')]},'fax':{'type':Sequelize[_0xca7a('0x2')]},'type':{'type':Sequelize[_0xca7a('0x2')]},'street':{'type':Sequelize[_0xca7a('0x2')]},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0xca7a('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xca7a('0x2')]},'sStreet':{'type':Sequelize['STRING']},'sPostalCode':{'type':Sequelize[_0xca7a('0x2')]},'sCity':{'type':Sequelize[_0xca7a('0x2')]},'sCountry':{'type':Sequelize[_0xca7a('0x2')]},'description':{'type':Sequelize[_0xca7a('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 8acbacb..f7835ed 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 _0xb2cb=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','map','options','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addContacts','CmContact','ids','omit','getContacts','findOne','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','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','limit','count','set','Content-Range','apply','reject','save','update','then','get','Companies','destroy','error','stack','name','send','index','CmCompany','describe','model','keys'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xb2cb,0xdf));var _0xbb2c=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0xb2cb[_0x479160];return _0x47ac6d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb2c('0x0'));var zipdir=require(_0xbb2c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xbb2c('0x2'));var moment=require(_0xbb2c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xbb2c('0x4'));var util=require(_0xbb2c('0x5'));var path=require(_0xbb2c('0x6'));var sox=require(_0xbb2c('0x7'));var csv=require(_0xbb2c('0x8'));var ejs=require(_0xbb2c('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xbb2c('0xa'));var squel=require(_0xbb2c('0xb'));var crypto=require(_0xbb2c('0xc'));var jsforce=require(_0xbb2c('0xd'));var deskjs=require(_0xbb2c('0xe'));var toCsv=require(_0xbb2c('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbb2c('0xf'));var authService=require(_0xbb2c('0x10'));var qs=require(_0xbb2c('0x11'));var as=require(_0xbb2c('0x12'));var hardwareService=require(_0xbb2c('0x13'));var logger=require(_0xbb2c('0x14'))(_0xbb2c('0x15'));var utils=require(_0xbb2c('0x16'));var config=require(_0xbb2c('0x17'));var licenseUtil=require(_0xbb2c('0x18'));var db=require(_0xbb2c('0x19'))['db'];function respondWithStatusCode(_0x477b0d,_0x4d0d4e){_0x4d0d4e=_0x4d0d4e||0xcc;return function(_0x45538e){if(_0x45538e){return _0x477b0d[_0xbb2c('0x1a')](_0x4d0d4e);}return _0x477b0d[_0xbb2c('0x1b')](_0x4d0d4e)[_0xbb2c('0x1c')]();};}function respondWithResult(_0xd6854f,_0x1cac9f){_0x1cac9f=_0x1cac9f||0xc8;return function(_0x97d98){if(_0x97d98){return _0xd6854f[_0xbb2c('0x1b')](_0x1cac9f)[_0xbb2c('0x1d')](_0x97d98);}};}function respondWithFilteredResult(_0x553591,_0x1b0aa4){return function(_0x40b0d2){if(_0x40b0d2){var _0x23241a=typeof _0x1b0aa4[_0xbb2c('0x1e')]===_0xbb2c('0x1f')&&typeof _0x1b0aa4[_0xbb2c('0x20')]===_0xbb2c('0x1f');var _0x3aacee=_0x40b0d2[_0xbb2c('0x21')];var _0x6581b1=_0x23241a?0x0:_0x1b0aa4[_0xbb2c('0x1e')];var _0x319835=_0x23241a?_0x40b0d2[_0xbb2c('0x21')]:_0x1b0aa4['offset']+_0x1b0aa4[_0xbb2c('0x20')];var _0x4c43cd;if(_0x319835>=_0x3aacee){_0x319835=_0x3aacee;_0x4c43cd=0xc8;}else{_0x4c43cd=0xce;}_0x553591[_0xbb2c('0x1b')](_0x4c43cd);return _0x553591[_0xbb2c('0x22')](_0xbb2c('0x23'),_0x6581b1+'-'+_0x319835+'/'+_0x3aacee)[_0xbb2c('0x1d')](_0x40b0d2);}return null;};}function patchUpdates(_0xeff86c){return function(_0x10b9e7){try{jsonpatch[_0xbb2c('0x24')](_0x10b9e7,_0xeff86c,!![]);}catch(_0x585890){return BPromise[_0xbb2c('0x25')](_0x585890);}return _0x10b9e7[_0xbb2c('0x26')]();};}function saveUpdates(_0x1d61c6,_0x54241b){return function(_0x418596){if(_0x418596){return _0x418596[_0xbb2c('0x27')](_0x1d61c6)['then'](function(_0x432468){return _0x432468;});}return null;};}function removeEntity(_0x39da60,_0x1fa61e){return function(_0x4a9e03){if(_0x4a9e03){return _0x4a9e03['destroy']()[_0xbb2c('0x28')](function(){var _0x36b1c1=_0x4a9e03[_0xbb2c('0x29')]({'plain':!![]});var _0x224ce1=_0xbb2c('0x2a');return db['UserProfileResource'][_0xbb2c('0x2b')]({'where':{'type':_0x224ce1,'resourceId':_0x36b1c1['id']}})['then'](function(){return _0x4a9e03;});})[_0xbb2c('0x28')](function(){_0x39da60[_0xbb2c('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21e379,_0x35c317){return function(_0x2e89ca){if(!_0x2e89ca){_0x21e379[_0xbb2c('0x1a')](0x194);}return _0x2e89ca;};}function handleError(_0x1c2d70,_0x1ec0b4){_0x1ec0b4=_0x1ec0b4||0x1f4;return function(_0x31370c){logger[_0xbb2c('0x2c')](_0x31370c[_0xbb2c('0x2d')]);if(_0x31370c[_0xbb2c('0x2e')]){delete _0x31370c[_0xbb2c('0x2e')];}_0x1c2d70['status'](_0x1ec0b4)[_0xbb2c('0x2f')](_0x31370c);};}exports[_0xbb2c('0x30')]=function(_0x1cff02,_0x3a010d){var _0x292a60={},_0x117a80={},_0x22f43d={'count':0x0,'rows':[]};return db[_0xbb2c('0x31')][_0xbb2c('0x32')]()[_0xbb2c('0x28')](function(_0x1c40c8){_0x117a80[_0xbb2c('0x33')]=_[_0xbb2c('0x34')](_0x1c40c8);_0x117a80[_0xbb2c('0x35')]=_['keys'](_0x1cff02[_0xbb2c('0x35')]);_0x117a80[_0xbb2c('0x36')]=_[_0xbb2c('0x37')](_0x117a80[_0xbb2c('0x33')],_0x117a80[_0xbb2c('0x35')]);_0x292a60[_0xbb2c('0x38')]=_[_0xbb2c('0x37')](_0x117a80['model'],qs[_0xbb2c('0x39')](_0x1cff02['query'][_0xbb2c('0x39')]));_0x292a60['attributes']=_0x292a60[_0xbb2c('0x38')][_0xbb2c('0x3a')]?_0x292a60[_0xbb2c('0x38')]:_0x117a80[_0xbb2c('0x33')];if(!_0x1cff02[_0xbb2c('0x35')][_0xbb2c('0x3b')](_0xbb2c('0x3c'))){_0x292a60[_0xbb2c('0x20')]=qs[_0xbb2c('0x20')](_0x1cff02[_0xbb2c('0x35')][_0xbb2c('0x20')]);_0x292a60[_0xbb2c('0x1e')]=qs[_0xbb2c('0x1e')](_0x1cff02[_0xbb2c('0x35')][_0xbb2c('0x1e')]);}_0x292a60[_0xbb2c('0x3d')]=qs[_0xbb2c('0x3e')](_0x1cff02[_0xbb2c('0x35')][_0xbb2c('0x3e')]);_0x292a60[_0xbb2c('0x3f')]=qs[_0xbb2c('0x36')](_['pick'](_0x1cff02['query'],_0x117a80[_0xbb2c('0x36')]),_0x1c40c8);if(_0x1cff02[_0xbb2c('0x35')][_0xbb2c('0x40')]){_0x292a60[_0xbb2c('0x3f')]=_[_0xbb2c('0x41')](_0x292a60['where'],{'$or':_[_0xbb2c('0x42')](_0x292a60[_0xbb2c('0x38')],function(_0x54057b){var _0x14664f={};_0x14664f[_0x54057b]={'$like':'%'+_0x1cff02[_0xbb2c('0x35')][_0xbb2c('0x40')]+'%'};return _0x14664f;})});}_0x292a60=_[_0xbb2c('0x41')]({},_0x292a60,_0x1cff02[_0xbb2c('0x43')]);var _0x1096e4={'where':_0x292a60[_0xbb2c('0x3f')]};return db[_0xbb2c('0x31')][_0xbb2c('0x21')](_0x1096e4)['then'](function(_0x2650ad){_0x22f43d['count']=_0x2650ad;if(_0x1cff02[_0xbb2c('0x35')][_0xbb2c('0x44')]){_0x292a60['include']=[{'all':!![]}];}return db[_0xbb2c('0x31')][_0xbb2c('0x45')](_0x292a60);})['then'](function(_0x4cd79c){_0x22f43d[_0xbb2c('0x46')]=_0x4cd79c;return _0x22f43d;})[_0xbb2c('0x28')](respondWithFilteredResult(_0x3a010d,_0x292a60))[_0xbb2c('0x47')](handleError(_0x3a010d,null));})[_0xbb2c('0x47')](handleError(_0x3a010d,null));};exports[_0xbb2c('0x48')]=function(_0x36f97b,_0x14183d){var _0x2c3d17={'raw':![],'where':{'id':_0x36f97b[_0xbb2c('0x49')]['id']}},_0x20aded={};_0x20aded[_0xbb2c('0x33')]=_['keys'](db[_0xbb2c('0x31')][_0xbb2c('0x4a')]);_0x20aded['query']=_['keys'](_0x36f97b[_0xbb2c('0x35')]);_0x20aded[_0xbb2c('0x36')]=_[_0xbb2c('0x37')](_0x20aded[_0xbb2c('0x33')],_0x20aded['query']);_0x2c3d17[_0xbb2c('0x38')]=_[_0xbb2c('0x37')](_0x20aded[_0xbb2c('0x33')],qs[_0xbb2c('0x39')](_0x36f97b[_0xbb2c('0x35')][_0xbb2c('0x39')]));_0x2c3d17[_0xbb2c('0x38')]=_0x2c3d17['attributes'][_0xbb2c('0x3a')]?_0x2c3d17['attributes']:_0x20aded[_0xbb2c('0x33')];if(_0x36f97b[_0xbb2c('0x35')]['includeAll']){_0x2c3d17[_0xbb2c('0x4b')]=[{'all':!![]}];}_0x2c3d17=_[_0xbb2c('0x41')]({},_0x2c3d17,_0x36f97b[_0xbb2c('0x43')]);return db[_0xbb2c('0x31')][_0xbb2c('0x4c')](_0x2c3d17)[_0xbb2c('0x28')](handleEntityNotFound(_0x14183d,null))[_0xbb2c('0x28')](respondWithResult(_0x14183d,null))['catch'](handleError(_0x14183d,null));};exports[_0xbb2c('0x4d')]=function(_0x312ebd,_0x2ac0f4){return db[_0xbb2c('0x31')][_0xbb2c('0x4d')](_0x312ebd[_0xbb2c('0x4e')],{})[_0xbb2c('0x28')](function(_0x482f45){var _0x4349ed=_0x312ebd[_0xbb2c('0x4f')][_0xbb2c('0x29')]({'plain':!![]});if(!_0x4349ed)throw new Error(_0xbb2c('0x50'));if(_0x4349ed[_0xbb2c('0x51')]===_0xbb2c('0x4f')){var _0x45a345=_0x482f45['get']({'plain':!![]});var _0x32e90b=_0xbb2c('0x2a');return db[_0xbb2c('0x52')][_0xbb2c('0x4c')]({'where':{'name':_0x32e90b,'userProfileId':_0x4349ed[_0xbb2c('0x53')]},'raw':!![]})[_0xbb2c('0x28')](function(_0x2f2255){if(_0x2f2255&&_0x2f2255[_0xbb2c('0x54')]===0x0){return db['UserProfileResource'][_0xbb2c('0x4d')]({'name':_0x45a345[_0xbb2c('0x2e')],'resourceId':_0x45a345['id'],'type':_0x2f2255[_0xbb2c('0x2e')],'sectionId':_0x2f2255['id']},{})[_0xbb2c('0x28')](function(){return _0x482f45;});}else{return _0x482f45;}})['catch'](function(_0x145ac8){logger[_0xbb2c('0x2c')](_0xbb2c('0x55'),_0x145ac8);throw _0x145ac8;});}return _0x482f45;})[_0xbb2c('0x28')](respondWithResult(_0x2ac0f4,0xc9))[_0xbb2c('0x47')](handleError(_0x2ac0f4,null));};exports[_0xbb2c('0x27')]=function(_0x484e53,_0x498635){if(_0x484e53[_0xbb2c('0x4e')]['id']){delete _0x484e53[_0xbb2c('0x4e')]['id'];}return db['CmCompany'][_0xbb2c('0x4c')]({'where':{'id':_0x484e53['params']['id']}})[_0xbb2c('0x28')](handleEntityNotFound(_0x498635,null))[_0xbb2c('0x28')](saveUpdates(_0x484e53['body'],null))[_0xbb2c('0x28')](respondWithResult(_0x498635,null))['catch'](handleError(_0x498635,null));};exports[_0xbb2c('0x2b')]=function(_0x578802,_0x24ed27){return db[_0xbb2c('0x31')][_0xbb2c('0x4c')]({'where':{'id':_0x578802[_0xbb2c('0x49')]['id']}})[_0xbb2c('0x28')](handleEntityNotFound(_0x24ed27,null))['then'](removeEntity(_0x24ed27,null))['catch'](handleError(_0x24ed27,null));};exports['describe']=function(_0x5afb6d,_0xdb9ca5){return db['CmCompany']['describe']()[_0xbb2c('0x28')](respondWithResult(_0xdb9ca5,null))[_0xbb2c('0x47')](handleError(_0xdb9ca5,null));};exports[_0xbb2c('0x56')]=function(_0x28e720,_0x5c15ae,_0x357927){return db[_0xbb2c('0x57')]['find']({'where':{'id':_0x28e720[_0xbb2c('0x49')]['id']}})[_0xbb2c('0x28')](handleEntityNotFound(_0x5c15ae,null))[_0xbb2c('0x28')](function(_0x5653cd){if(_0x5653cd){return _0x5653cd[_0xbb2c('0x56')](_0x28e720[_0xbb2c('0x4e')][_0xbb2c('0x58')],_[_0xbb2c('0x59')](_0x28e720['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x5c15ae,null))[_0xbb2c('0x47')](handleError(_0x5c15ae,null));};exports[_0xbb2c('0x5a')]=function(_0x4b5110,_0x17865e,_0x276a73){var _0x35be29={};var _0x2604f2={};var _0x117ab7;var _0x515f8b;return db[_0xbb2c('0x31')][_0xbb2c('0x5b')]({'where':{'id':_0x4b5110[_0xbb2c('0x49')]['id']}})[_0xbb2c('0x28')](handleEntityNotFound(_0x17865e,null))[_0xbb2c('0x28')](function(_0x2ce03a){if(_0x2ce03a){_0x117ab7=_0x2ce03a;_0x2604f2['model']=_[_0xbb2c('0x34')](db[_0xbb2c('0x57')][_0xbb2c('0x4a')]);_0x2604f2['query']=_[_0xbb2c('0x34')](_0x4b5110[_0xbb2c('0x35')]);_0x2604f2[_0xbb2c('0x36')]=_[_0xbb2c('0x37')](_0x2604f2[_0xbb2c('0x33')],_0x2604f2[_0xbb2c('0x35')]);_0x35be29['attributes']=_[_0xbb2c('0x37')](_0x2604f2['model'],qs[_0xbb2c('0x39')](_0x4b5110['query']['fields']));_0x35be29[_0xbb2c('0x38')]=_0x35be29['attributes'][_0xbb2c('0x3a')]?_0x35be29[_0xbb2c('0x38')]:_0x2604f2[_0xbb2c('0x33')];_0x35be29[_0xbb2c('0x3d')]=qs[_0xbb2c('0x3e')](_0x4b5110['query'][_0xbb2c('0x3e')]);_0x35be29[_0xbb2c('0x3f')]=qs['filters'](_['pick'](_0x4b5110['query'],_0x2604f2[_0xbb2c('0x36')]));if(_0x4b5110[_0xbb2c('0x35')][_0xbb2c('0x40')]){_0x35be29['where']=_[_0xbb2c('0x41')](_0x35be29[_0xbb2c('0x3f')],{'$or':_['map'](_0x35be29[_0xbb2c('0x38')],function(_0x3f4bb3){var _0xa0c59e={};_0xa0c59e[_0x3f4bb3]={'$like':'%'+_0x4b5110['query'][_0xbb2c('0x40')]+'%'};return _0xa0c59e;})});}_0x35be29=_[_0xbb2c('0x41')]({},_0x35be29,_0x4b5110['options']);return _0x117ab7[_0xbb2c('0x5a')](_0x35be29);}})['then'](function(_0x4dc0dd){if(_0x4dc0dd){_0x515f8b=_0x4dc0dd[_0xbb2c('0x3a')];if(!_0x4b5110[_0xbb2c('0x35')][_0xbb2c('0x3b')](_0xbb2c('0x3c'))){_0x35be29[_0xbb2c('0x20')]=qs['limit'](_0x4b5110[_0xbb2c('0x35')][_0xbb2c('0x20')]);_0x35be29[_0xbb2c('0x1e')]=qs['offset'](_0x4b5110[_0xbb2c('0x35')][_0xbb2c('0x1e')]);}return _0x117ab7['getContacts'](_0x35be29);}})['then'](function(_0x2dbce4){if(_0x2dbce4){return _0x2dbce4?{'count':_0x515f8b,'rows':_0x2dbce4}:null;}})[_0xbb2c('0x28')](respondWithResult(_0x17865e,null))[_0xbb2c('0x47')](handleError(_0x17865e,null));}; \ No newline at end of file +var _0x8d61=['includeAll','include','rows','catch','show','params','rawAttributes','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','addContacts','ids','omit','getContacts','findOne','CmContact','order','options','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','ejs','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/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','Companies','destroy','error','stack','name','index','describe','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','map','CmCompany'];(function(_0x4a00f7,_0x4e86c6){var _0x4f6f0c=function(_0x2e869c){while(--_0x2e869c){_0x4a00f7['push'](_0x4a00f7['shift']());}};_0x4f6f0c(++_0x4e86c6);}(_0x8d61,0x123));var _0x18d6=function(_0xc7348b,_0x145880){_0xc7348b=_0xc7348b-0x0;var _0x307cec=_0x8d61[_0xc7348b];return _0x307cec;};'use strict';var emlformat=require(_0x18d6('0x0'));var rimraf=require(_0x18d6('0x1'));var zipdir=require(_0x18d6('0x2'));var jsonpatch=require(_0x18d6('0x3'));var rp=require(_0x18d6('0x4'));var moment=require(_0x18d6('0x5'));var BPromise=require(_0x18d6('0x6'));var Mustache=require(_0x18d6('0x7'));var util=require('util');var path=require(_0x18d6('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x18d6('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x18d6('0xa'));var squel=require(_0x18d6('0xb'));var crypto=require(_0x18d6('0xc'));var jsforce=require(_0x18d6('0xd'));var deskjs=require(_0x18d6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x18d6('0xf'));var Papa=require(_0x18d6('0x10'));var Redis=require('ioredis');var authService=require(_0x18d6('0x11'));var qs=require(_0x18d6('0x12'));var as=require(_0x18d6('0x13'));var hardwareService=require(_0x18d6('0x14'));var logger=require(_0x18d6('0x15'))(_0x18d6('0x16'));var utils=require(_0x18d6('0x17'));var config=require(_0x18d6('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x18d6('0x19'))['db'];function respondWithStatusCode(_0xcdeac0,_0x4165d2){_0x4165d2=_0x4165d2||0xcc;return function(_0x4cde7f){if(_0x4cde7f){return _0xcdeac0[_0x18d6('0x1a')](_0x4165d2);}return _0xcdeac0[_0x18d6('0x1b')](_0x4165d2)[_0x18d6('0x1c')]();};}function respondWithResult(_0x44e51e,_0xd73858){_0xd73858=_0xd73858||0xc8;return function(_0x2a4ac9){if(_0x2a4ac9){return _0x44e51e['status'](_0xd73858)['json'](_0x2a4ac9);}};}function respondWithFilteredResult(_0x39c971,_0x21c894){return function(_0x2935ba){if(_0x2935ba){var _0x4d728c=typeof _0x21c894[_0x18d6('0x1d')]===_0x18d6('0x1e')&&typeof _0x21c894[_0x18d6('0x1f')]===_0x18d6('0x1e');var _0xb23e89=_0x2935ba[_0x18d6('0x20')];var _0x8b944d=_0x4d728c?0x0:_0x21c894[_0x18d6('0x1d')];var _0x58361b=_0x4d728c?_0x2935ba['count']:_0x21c894[_0x18d6('0x1d')]+_0x21c894[_0x18d6('0x1f')];var _0xc8f201;if(_0x58361b>=_0xb23e89){_0x58361b=_0xb23e89;_0xc8f201=0xc8;}else{_0xc8f201=0xce;}_0x39c971[_0x18d6('0x1b')](_0xc8f201);return _0x39c971[_0x18d6('0x21')](_0x18d6('0x22'),_0x8b944d+'-'+_0x58361b+'/'+_0xb23e89)[_0x18d6('0x23')](_0x2935ba);}return null;};}function patchUpdates(_0x2cdb90){return function(_0x27849b){try{jsonpatch[_0x18d6('0x24')](_0x27849b,_0x2cdb90,!![]);}catch(_0x4c4c44){return BPromise[_0x18d6('0x25')](_0x4c4c44);}return _0x27849b[_0x18d6('0x26')]();};}function saveUpdates(_0x386109,_0x535bcf){return function(_0xc49bea){if(_0xc49bea){return _0xc49bea[_0x18d6('0x27')](_0x386109)[_0x18d6('0x28')](function(_0x1fae29){return _0x1fae29;});}return null;};}function removeEntity(_0x2e25b9,_0x484f2e){return function(_0x1e0370){if(_0x1e0370){return _0x1e0370['destroy']()[_0x18d6('0x28')](function(){var _0x4d9060=_0x1e0370[_0x18d6('0x29')]({'plain':!![]});var _0x5b1870=_0x18d6('0x2a');return db['UserProfileResource'][_0x18d6('0x2b')]({'where':{'type':_0x5b1870,'resourceId':_0x4d9060['id']}})[_0x18d6('0x28')](function(){return _0x1e0370;});})['then'](function(){_0x2e25b9[_0x18d6('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x451d80,_0x412fdf){return function(_0x83420d){if(!_0x83420d){_0x451d80['sendStatus'](0x194);}return _0x83420d;};}function handleError(_0x2d4195,_0x2f63c0){_0x2f63c0=_0x2f63c0||0x1f4;return function(_0x37d8ec){logger[_0x18d6('0x2c')](_0x37d8ec[_0x18d6('0x2d')]);if(_0x37d8ec[_0x18d6('0x2e')]){delete _0x37d8ec[_0x18d6('0x2e')];}_0x2d4195['status'](_0x2f63c0)['send'](_0x37d8ec);};}exports[_0x18d6('0x2f')]=function(_0x3a4f06,_0x2be273){var _0x36aaf7={},_0x1b44fd={},_0x380abe={'count':0x0,'rows':[]};return db['CmCompany'][_0x18d6('0x30')]()[_0x18d6('0x28')](function(_0x70f700){_0x1b44fd[_0x18d6('0x31')]=_['keys'](_0x70f700);_0x1b44fd['query']=_[_0x18d6('0x32')](_0x3a4f06[_0x18d6('0x33')]);_0x1b44fd[_0x18d6('0x34')]=_[_0x18d6('0x35')](_0x1b44fd[_0x18d6('0x31')],_0x1b44fd[_0x18d6('0x33')]);_0x36aaf7[_0x18d6('0x36')]=_[_0x18d6('0x35')](_0x1b44fd[_0x18d6('0x31')],qs['fields'](_0x3a4f06[_0x18d6('0x33')][_0x18d6('0x37')]));_0x36aaf7[_0x18d6('0x36')]=_0x36aaf7[_0x18d6('0x36')][_0x18d6('0x38')]?_0x36aaf7[_0x18d6('0x36')]:_0x1b44fd[_0x18d6('0x31')];if(!_0x3a4f06[_0x18d6('0x33')][_0x18d6('0x39')](_0x18d6('0x3a'))){_0x36aaf7[_0x18d6('0x1f')]=qs[_0x18d6('0x1f')](_0x3a4f06[_0x18d6('0x33')][_0x18d6('0x1f')]);_0x36aaf7['offset']=qs[_0x18d6('0x1d')](_0x3a4f06[_0x18d6('0x33')][_0x18d6('0x1d')]);}_0x36aaf7['order']=qs['sort'](_0x3a4f06['query'][_0x18d6('0x3b')]);_0x36aaf7[_0x18d6('0x3c')]=qs['filters'](_['pick'](_0x3a4f06[_0x18d6('0x33')],_0x1b44fd[_0x18d6('0x34')]),_0x70f700);if(_0x3a4f06['query'][_0x18d6('0x3d')]){_0x36aaf7[_0x18d6('0x3c')]=_[_0x18d6('0x3e')](_0x36aaf7[_0x18d6('0x3c')],{'$or':_[_0x18d6('0x3f')](_0x36aaf7['attributes'],function(_0xafea9f){var _0x1224bd={};_0x1224bd[_0xafea9f]={'$like':'%'+_0x3a4f06[_0x18d6('0x33')][_0x18d6('0x3d')]+'%'};return _0x1224bd;})});}_0x36aaf7=_[_0x18d6('0x3e')]({},_0x36aaf7,_0x3a4f06['options']);var _0x2d77fb={'where':_0x36aaf7['where']};return db[_0x18d6('0x40')][_0x18d6('0x20')](_0x2d77fb)[_0x18d6('0x28')](function(_0x3bc403){_0x380abe[_0x18d6('0x20')]=_0x3bc403;if(_0x3a4f06['query'][_0x18d6('0x41')]){_0x36aaf7[_0x18d6('0x42')]=[{'all':!![]}];}return db[_0x18d6('0x40')]['findAll'](_0x36aaf7);})['then'](function(_0x2f3b64){_0x380abe[_0x18d6('0x43')]=_0x2f3b64;return _0x380abe;})[_0x18d6('0x28')](respondWithFilteredResult(_0x2be273,_0x36aaf7))[_0x18d6('0x44')](handleError(_0x2be273,null));})[_0x18d6('0x44')](handleError(_0x2be273,null));};exports[_0x18d6('0x45')]=function(_0x1807a3,_0x22de26){var _0x1ed6cb={'raw':![],'where':{'id':_0x1807a3[_0x18d6('0x46')]['id']}},_0x12762c={};_0x12762c[_0x18d6('0x31')]=_[_0x18d6('0x32')](db[_0x18d6('0x40')][_0x18d6('0x47')]);_0x12762c[_0x18d6('0x33')]=_[_0x18d6('0x32')](_0x1807a3[_0x18d6('0x33')]);_0x12762c[_0x18d6('0x34')]=_['intersection'](_0x12762c['model'],_0x12762c['query']);_0x1ed6cb[_0x18d6('0x36')]=_['intersection'](_0x12762c['model'],qs[_0x18d6('0x37')](_0x1807a3[_0x18d6('0x33')]['fields']));_0x1ed6cb[_0x18d6('0x36')]=_0x1ed6cb[_0x18d6('0x36')][_0x18d6('0x38')]?_0x1ed6cb[_0x18d6('0x36')]:_0x12762c[_0x18d6('0x31')];if(_0x1807a3[_0x18d6('0x33')]['includeAll']){_0x1ed6cb[_0x18d6('0x42')]=[{'all':!![]}];}_0x1ed6cb=_[_0x18d6('0x3e')]({},_0x1ed6cb,_0x1807a3['options']);return db[_0x18d6('0x40')][_0x18d6('0x48')](_0x1ed6cb)[_0x18d6('0x28')](handleEntityNotFound(_0x22de26,null))[_0x18d6('0x28')](respondWithResult(_0x22de26,null))['catch'](handleError(_0x22de26,null));};exports[_0x18d6('0x49')]=function(_0x35ba81,_0x993acc){return db[_0x18d6('0x40')][_0x18d6('0x49')](_0x35ba81[_0x18d6('0x4a')],{})[_0x18d6('0x28')](function(_0x53a573){var _0x40931b=_0x35ba81[_0x18d6('0x4b')][_0x18d6('0x29')]({'plain':!![]});if(!_0x40931b)throw new Error(_0x18d6('0x4c'));if(_0x40931b[_0x18d6('0x4d')]==='user'){var _0xf604ce=_0x53a573[_0x18d6('0x29')]({'plain':!![]});var _0x255b88='Companies';return db[_0x18d6('0x4e')][_0x18d6('0x48')]({'where':{'name':_0x255b88,'userProfileId':_0x40931b[_0x18d6('0x4f')]},'raw':!![]})[_0x18d6('0x28')](function(_0x190a85){if(_0x190a85&&_0x190a85[_0x18d6('0x50')]===0x0){return db['UserProfileResource'][_0x18d6('0x49')]({'name':_0xf604ce[_0x18d6('0x2e')],'resourceId':_0xf604ce['id'],'type':_0x190a85[_0x18d6('0x2e')],'sectionId':_0x190a85['id']},{})[_0x18d6('0x28')](function(){return _0x53a573;});}else{return _0x53a573;}})[_0x18d6('0x44')](function(_0x397220){logger[_0x18d6('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x397220);throw _0x397220;});}return _0x53a573;})['then'](respondWithResult(_0x993acc,0xc9))['catch'](handleError(_0x993acc,null));};exports['update']=function(_0x409228,_0x341ebd){if(_0x409228[_0x18d6('0x4a')]['id']){delete _0x409228[_0x18d6('0x4a')]['id'];}return db[_0x18d6('0x40')]['find']({'where':{'id':_0x409228[_0x18d6('0x46')]['id']}})[_0x18d6('0x28')](handleEntityNotFound(_0x341ebd,null))[_0x18d6('0x28')](saveUpdates(_0x409228['body'],null))['then'](respondWithResult(_0x341ebd,null))[_0x18d6('0x44')](handleError(_0x341ebd,null));};exports[_0x18d6('0x2b')]=function(_0x269ec5,_0x5bcbe2){return db[_0x18d6('0x40')][_0x18d6('0x48')]({'where':{'id':_0x269ec5['params']['id']}})['then'](handleEntityNotFound(_0x5bcbe2,null))[_0x18d6('0x28')](removeEntity(_0x5bcbe2,null))[_0x18d6('0x44')](handleError(_0x5bcbe2,null));};exports['describe']=function(_0x1e5d8e,_0x46ed7e){return db[_0x18d6('0x40')][_0x18d6('0x30')]()[_0x18d6('0x28')](respondWithResult(_0x46ed7e,null))[_0x18d6('0x44')](handleError(_0x46ed7e,null));};exports[_0x18d6('0x51')]=function(_0x36c2c7,_0x545447,_0x14487b){return db['CmContact'][_0x18d6('0x48')]({'where':{'id':_0x36c2c7[_0x18d6('0x46')]['id']}})[_0x18d6('0x28')](handleEntityNotFound(_0x545447,null))['then'](function(_0x5b95df){if(_0x5b95df){return _0x5b95df[_0x18d6('0x51')](_0x36c2c7[_0x18d6('0x4a')][_0x18d6('0x52')],_[_0x18d6('0x53')](_0x36c2c7[_0x18d6('0x4a')],[_0x18d6('0x52'),'id'])||{});}})[_0x18d6('0x28')](respondWithResult(_0x545447,null))[_0x18d6('0x44')](handleError(_0x545447,null));};exports[_0x18d6('0x54')]=function(_0x31694c,_0x41856e,_0x5af615){var _0x1db8f1={};var _0x362db5={};var _0x4d9762;var _0x16e4e6;return db[_0x18d6('0x40')][_0x18d6('0x55')]({'where':{'id':_0x31694c[_0x18d6('0x46')]['id']}})['then'](handleEntityNotFound(_0x41856e,null))[_0x18d6('0x28')](function(_0x4ad59d){if(_0x4ad59d){_0x4d9762=_0x4ad59d;_0x362db5[_0x18d6('0x31')]=_['keys'](db[_0x18d6('0x56')]['rawAttributes']);_0x362db5[_0x18d6('0x33')]=_[_0x18d6('0x32')](_0x31694c[_0x18d6('0x33')]);_0x362db5['filters']=_['intersection'](_0x362db5[_0x18d6('0x31')],_0x362db5[_0x18d6('0x33')]);_0x1db8f1['attributes']=_[_0x18d6('0x35')](_0x362db5[_0x18d6('0x31')],qs[_0x18d6('0x37')](_0x31694c[_0x18d6('0x33')][_0x18d6('0x37')]));_0x1db8f1['attributes']=_0x1db8f1[_0x18d6('0x36')]['length']?_0x1db8f1[_0x18d6('0x36')]:_0x362db5[_0x18d6('0x31')];_0x1db8f1[_0x18d6('0x57')]=qs[_0x18d6('0x3b')](_0x31694c[_0x18d6('0x33')][_0x18d6('0x3b')]);_0x1db8f1['where']=qs[_0x18d6('0x34')](_['pick'](_0x31694c[_0x18d6('0x33')],_0x362db5[_0x18d6('0x34')]));if(_0x31694c[_0x18d6('0x33')][_0x18d6('0x3d')]){_0x1db8f1[_0x18d6('0x3c')]=_[_0x18d6('0x3e')](_0x1db8f1[_0x18d6('0x3c')],{'$or':_['map'](_0x1db8f1[_0x18d6('0x36')],function(_0x328669){var _0x421f5f={};_0x421f5f[_0x328669]={'$like':'%'+_0x31694c[_0x18d6('0x33')][_0x18d6('0x3d')]+'%'};return _0x421f5f;})});}_0x1db8f1=_['merge']({},_0x1db8f1,_0x31694c[_0x18d6('0x58')]);return _0x4d9762[_0x18d6('0x54')](_0x1db8f1);}})[_0x18d6('0x28')](function(_0x29276a){if(_0x29276a){_0x16e4e6=_0x29276a[_0x18d6('0x38')];if(!_0x31694c['query'][_0x18d6('0x39')](_0x18d6('0x3a'))){_0x1db8f1['limit']=qs[_0x18d6('0x1f')](_0x31694c[_0x18d6('0x33')][_0x18d6('0x1f')]);_0x1db8f1['offset']=qs['offset'](_0x31694c[_0x18d6('0x33')][_0x18d6('0x1d')]);}return _0x4d9762[_0x18d6('0x54')](_0x1db8f1);}})[_0x18d6('0x28')](function(_0x31cbc7){if(_0x31cbc7){return _0x31cbc7?{'count':_0x16e4e6,'rows':_0x31cbc7}:null;}})['then'](respondWithResult(_0x41856e,null))['catch'](handleError(_0x41856e,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index d5abe60..1277548 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 _0xb28e=['./cmCompany.attributes','exports','define','CmCompany','cm_companies','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x2c7618,_0x26be9c){var _0x5ce3f0=function(_0x1837b3){while(--_0x1837b3){_0x2c7618['push'](_0x2c7618['shift']());}};_0x5ce3f0(++_0x26be9c);}(_0xb28e,0x1c7));var _0xeb28=function(_0xf34109,_0x380779){_0xf34109=_0xf34109-0x0;var _0x570bfc=_0xb28e[_0xf34109];return _0x570bfc;};'use strict';var _=require(_0xeb28('0x0'));var util=require(_0xeb28('0x1'));var logger=require(_0xeb28('0x2'))(_0xeb28('0x3'));var moment=require(_0xeb28('0x4'));var BPromise=require(_0xeb28('0x5'));var rp=require(_0xeb28('0x6'));var fs=require('fs');var path=require(_0xeb28('0x7'));var rimraf=require(_0xeb28('0x8'));var config=require(_0xeb28('0x9'));var attributes=require(_0xeb28('0xa'));module[_0xeb28('0xb')]=function(_0x51c5e7,_0x50399e){return _0x51c5e7[_0xeb28('0xc')](_0xeb28('0xd'),attributes,{'tableName':_0xeb28('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xccb9=['path','rimraf','../../config/environment','exports','define','cm_companies','util','api','moment','bluebird','request-promise'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xccb9,0x1be));var _0x9ccb=function(_0x1a7550,_0x1edace){_0x1a7550=_0x1a7550-0x0;var _0x426e22=_0xccb9[_0x1a7550];return _0x426e22;};'use strict';var _=require('lodash');var util=require(_0x9ccb('0x0'));var logger=require('../../config/logger')(_0x9ccb('0x1'));var moment=require(_0x9ccb('0x2'));var BPromise=require(_0x9ccb('0x3'));var rp=require(_0x9ccb('0x4'));var fs=require('fs');var path=require(_0x9ccb('0x5'));var rimraf=require(_0x9ccb('0x6'));var config=require(_0x9ccb('0x7'));var attributes=require('./cmCompany.attributes');module[_0x9ccb('0x8')]=function(_0x5b9f58,_0x1e1ce6){return _0x5b9f58[_0x9ccb('0x9')]('CmCompany',attributes,{'tableName':_0x9ccb('0xa'),'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 f91dabb..8cb93ed 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 _0x49b9=['request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmCompany,\x20%s,\x20%s','result','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x4dbda8,_0xbce830){var _0x1149ed=function(_0x299a39){while(--_0x299a39){_0x4dbda8['push'](_0x4dbda8['shift']());}};_0x1149ed(++_0xbce830);}(_0x49b9,0x153));var _0x949b=function(_0x560622,_0x2ba6d1){_0x560622=_0x560622-0x0;var _0x564ba7=_0x49b9[_0x560622];return _0x564ba7;};'use strict';var _=require('lodash');var util=require(_0x949b('0x0'));var moment=require(_0x949b('0x1'));var BPromise=require(_0x949b('0x2'));var rs=require(_0x949b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x949b('0x4'));var logger=require(_0x949b('0x5'))(_0x949b('0x6'));var config=require(_0x949b('0x7'));var jayson=require(_0x949b('0x8'));var client=jayson[_0x949b('0x9')][_0x949b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x188393,_0x520ef3,_0x2503d8){return new BPromise(function(_0x1c5921,_0x3c9afb){return client[_0x949b('0xb')](_0x188393,_0x2503d8)[_0x949b('0xc')](function(_0x240bbc){logger['info']('CmCompany,\x20%s,\x20%s',_0x520ef3,_0x949b('0xd'));logger[_0x949b('0xe')](_0x949b('0xf'),_0x520ef3,'request\x20sent',JSON[_0x949b('0x10')](_0x240bbc));if(_0x240bbc[_0x949b('0x11')]){if(_0x240bbc[_0x949b('0x11')][_0x949b('0x12')]===0x1f4){logger[_0x949b('0x11')]('CmCompany,\x20%s,\x20%s',_0x520ef3,_0x240bbc['error'][_0x949b('0x13')]);return _0x3c9afb(_0x240bbc['error'][_0x949b('0x13')]);}logger[_0x949b('0x11')](_0x949b('0x14'),_0x520ef3,_0x240bbc['error'][_0x949b('0x13')]);return _0x1c5921(_0x240bbc[_0x949b('0x11')][_0x949b('0x13')]);}else{logger['info'](_0x949b('0x14'),_0x520ef3,_0x949b('0xd'));_0x1c5921(_0x240bbc[_0x949b('0x15')][_0x949b('0x13')]);}})['catch'](function(_0x1c8ae2){logger[_0x949b('0x11')]('CmCompany,\x20%s,\x20%s',_0x520ef3,_0x1c8ae2);_0x3c9afb(_0x1c8ae2);});});} \ No newline at end of file +var _0x580a=['request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','CmCompany,\x20%s,\x20%s'];(function(_0x525563,_0x48a9ba){var _0x46251a=function(_0x5713d5){while(--_0x5713d5){_0x525563['push'](_0x525563['shift']());}};_0x46251a(++_0x48a9ba);}(_0x580a,0x1d5));var _0xa580=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x580a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa580('0x0'));var util=require(_0xa580('0x1'));var moment=require(_0xa580('0x2'));var BPromise=require('bluebird');var rs=require(_0xa580('0x3'));var fs=require('fs');var Redis=require(_0xa580('0x4'));var db=require(_0xa580('0x5'))['db'];var utils=require(_0xa580('0x6'));var logger=require(_0xa580('0x7'))('rpc');var config=require(_0xa580('0x8'));var jayson=require(_0xa580('0x9'));var client=jayson[_0xa580('0xa')][_0xa580('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xed6c7d,_0x5bb868,_0x1e13f8){return new BPromise(function(_0x47af31,_0x49fc4d){return client['request'](_0xed6c7d,_0x1e13f8)[_0xa580('0xc')](function(_0x126ab8){logger['info'](_0xa580('0xd'),_0x5bb868,_0xa580('0xe'));logger[_0xa580('0xf')](_0xa580('0x10'),_0x5bb868,_0xa580('0xe'),JSON[_0xa580('0x11')](_0x126ab8));if(_0x126ab8[_0xa580('0x12')]){if(_0x126ab8[_0xa580('0x12')]['code']===0x1f4){logger[_0xa580('0x12')](_0xa580('0xd'),_0x5bb868,_0x126ab8[_0xa580('0x12')][_0xa580('0x13')]);return _0x49fc4d(_0x126ab8[_0xa580('0x12')][_0xa580('0x13')]);}logger[_0xa580('0x12')]('CmCompany,\x20%s,\x20%s',_0x5bb868,_0x126ab8[_0xa580('0x12')]['message']);return _0x47af31(_0x126ab8[_0xa580('0x12')]['message']);}else{logger[_0xa580('0x14')](_0xa580('0xd'),_0x5bb868,_0xa580('0xe'));_0x47af31(_0x126ab8[_0xa580('0x15')][_0xa580('0x13')]);}})[_0xa580('0x16')](function(_0x5586cb){logger[_0xa580('0x12')](_0xa580('0xd'),_0x5bb868,_0x5586cb);_0x49fc4d(_0x5586cb);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index e3d4281..0ac8618 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 _0x9d10=['destroy','exports','multer','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','put','update','delete'];(function(_0x49d5c7,_0x3f77aa){var _0x2f1f5e=function(_0x58d445){while(--_0x58d445){_0x49d5c7['push'](_0x49d5c7['shift']());}};_0x2f1f5e(++_0x3f77aa);}(_0x9d10,0x8c));var _0x09d1=function(_0x3791cf,_0x317400){_0x3791cf=_0x3791cf-0x0;var _0x9383ca=_0x9d10[_0x3791cf];return _0x9383ca;};'use strict';var multer=require(_0x09d1('0x0'));var util=require('util');var path=require(_0x09d1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x09d1('0x2')]();var fs_extra=require(_0x09d1('0x3'));var auth=require(_0x09d1('0x4'));var interaction=require(_0x09d1('0x5'));var config=require(_0x09d1('0x6'));var controller=require('./cmCompany.controller');router['get']('/',auth[_0x09d1('0x7')](),controller[_0x09d1('0x8')]);router[_0x09d1('0x9')](_0x09d1('0xa'),auth[_0x09d1('0x7')](),controller[_0x09d1('0xb')]);router[_0x09d1('0x9')](_0x09d1('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x09d1('0x9')](_0x09d1('0xd'),auth[_0x09d1('0x7')](),controller[_0x09d1('0xe')]);router[_0x09d1('0xf')]('/',auth[_0x09d1('0x7')](),controller[_0x09d1('0x10')]);router[_0x09d1('0xf')](_0x09d1('0xd'),auth['isAuthenticated'](),controller[_0x09d1('0x11')]);router[_0x09d1('0x12')](_0x09d1('0xc'),auth[_0x09d1('0x7')](),controller[_0x09d1('0x13')]);router[_0x09d1('0x14')](_0x09d1('0xc'),auth['isAuthenticated'](),controller[_0x09d1('0x15')]);module[_0x09d1('0x16')]=router; \ No newline at end of file +var _0x46c1=['./cmCompany.controller','get','/describe','isAuthenticated','show','/:id/contacts','getContacts','post','create','addContacts','/:id','update','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x46e258,_0x19069a){var _0x33494c=function(_0x2bc4d9){while(--_0x2bc4d9){_0x46e258['push'](_0x46e258['shift']());}};_0x33494c(++_0x19069a);}(_0x46c1,0x7c));var _0x146c=function(_0x4dbd92,_0x27fca6){_0x4dbd92=_0x4dbd92-0x0;var _0x449779=_0x46c1[_0x4dbd92];return _0x449779;};'use strict';var multer=require('multer');var util=require(_0x146c('0x0'));var path=require(_0x146c('0x1'));var timeout=require(_0x146c('0x2'));var express=require(_0x146c('0x3'));var router=express[_0x146c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x146c('0x5'));var interaction=require(_0x146c('0x6'));var config=require(_0x146c('0x7'));var controller=require(_0x146c('0x8'));router[_0x146c('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x146c('0x9')](_0x146c('0xa'),auth[_0x146c('0xb')](),controller['describe']);router[_0x146c('0x9')]('/:id',auth[_0x146c('0xb')](),controller[_0x146c('0xc')]);router['get'](_0x146c('0xd'),auth[_0x146c('0xb')](),controller[_0x146c('0xe')]);router[_0x146c('0xf')]('/',auth['isAuthenticated'](),controller[_0x146c('0x10')]);router['post'](_0x146c('0xd'),auth[_0x146c('0xb')](),controller[_0x146c('0x11')]);router['put'](_0x146c('0x12'),auth['isAuthenticated'](),controller[_0x146c('0x13')]);router['delete'](_0x146c('0x12'),auth[_0x146c('0xb')](),controller[_0x146c('0x14')]);module[_0x146c('0x15')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index 37dad7c..d54267d 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 _0x6e15=['TEXT','DATE','NOW','lodash','sequelize','exports','STRING'];(function(_0x4eb496,_0x398c2e){var _0x1dd09a=function(_0x558fb4){while(--_0x558fb4){_0x4eb496['push'](_0x4eb496['shift']());}};_0x1dd09a(++_0x398c2e);}(_0x6e15,0x192));var _0x56e1=function(_0x58b062,_0x4bb868){_0x58b062=_0x58b062-0x0;var _0x31b07e=_0x6e15[_0x58b062];return _0x31b07e;};'use strict';var _=require(_0x56e1('0x0'));var Sequelize=require(_0x56e1('0x1'));module[_0x56e1('0x2')]={'firstName':{'type':Sequelize[_0x56e1('0x3')],'allowNull':![]},'lastName':{'type':Sequelize['STRING']},'street':{'type':Sequelize[_0x56e1('0x3')]},'postalCode':{'type':Sequelize[_0x56e1('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0x56e1('0x3')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x56e1('0x4')]},'phone':{'type':Sequelize[_0x56e1('0x3')]},'mobile':{'type':Sequelize[_0x56e1('0x3')]},'fax':{'type':Sequelize[_0x56e1('0x3')]},'email':{'type':Sequelize[_0x56e1('0x3')]},'url':{'type':Sequelize[_0x56e1('0x3')]},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x56e1('0x3')]},'twitter':{'type':Sequelize[_0x56e1('0x3')]},'skype':{'type':Sequelize['STRING']},'teams':{'type':Sequelize[_0x56e1('0x3')]},'viber':{'type':Sequelize[_0x56e1('0x3')]},'line':{'type':Sequelize[_0x56e1('0x3')]},'wechat':{'type':Sequelize[_0x56e1('0x3')]},'telegram':{'type':Sequelize[_0x56e1('0x3')]},'UserId':{'type':Sequelize['INTEGER']},'priority':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x56e1('0x5')],'defaultValue':Sequelize[_0x56e1('0x6')]}}; \ No newline at end of file +var _0xc15f=['UNSIGNED','DATE','NOW','lodash','sequelize','STRING','TEXT','INTEGER'];(function(_0x27e7e3,_0x278f23){var _0x2582ef=function(_0x3ae989){while(--_0x3ae989){_0x27e7e3['push'](_0x27e7e3['shift']());}};_0x2582ef(++_0x278f23);}(_0xc15f,0xb3));var _0xfc15=function(_0x3a6e4b,_0x118cd9){_0x3a6e4b=_0x3a6e4b-0x0;var _0x36572d=_0xc15f[_0x3a6e4b];return _0x36572d;};'use strict';var _=require(_0xfc15('0x0'));var Sequelize=require(_0xfc15('0x1'));module['exports']={'firstName':{'type':Sequelize[_0xfc15('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0xfc15('0x2')]},'street':{'type':Sequelize[_0xfc15('0x2')]},'postalCode':{'type':Sequelize[_0xfc15('0x2')]},'city':{'type':Sequelize[_0xfc15('0x2')]},'country':{'type':Sequelize[_0xfc15('0x2')]},'dateOfBirth':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xfc15('0x3')]},'phone':{'type':Sequelize['STRING']},'mobile':{'type':Sequelize[_0xfc15('0x2')]},'fax':{'type':Sequelize[_0xfc15('0x2')]},'email':{'type':Sequelize[_0xfc15('0x2')]},'url':{'type':Sequelize[_0xfc15('0x2')]},'facebook':{'type':Sequelize[_0xfc15('0x2')]},'fb_data':{'type':Sequelize[_0xfc15('0x2')]},'twitter':{'type':Sequelize[_0xfc15('0x2')]},'skype':{'type':Sequelize[_0xfc15('0x2')]},'teams':{'type':Sequelize[_0xfc15('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize['STRING']},'wechat':{'type':Sequelize[_0xfc15('0x2')]},'telegram':{'type':Sequelize['STRING']},'UserId':{'type':Sequelize[_0xfc15('0x4')]},'priority':{'type':Sequelize[_0xfc15('0x4')](0x2)[_0xfc15('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xfc15('0x6')],'defaultValue':Sequelize[_0xfc15('0x7')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index fb61228..f6051e2 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 _0x8168=['OpenchannelMessage','CmHopperFinal','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','each','duplicates','findOrCreate','show','params','$and','format','cf_%d','find','omit','cm_contacts','setFields','id\x20=\x20?','toParam','phone','CmHopper','options','getTags','rawAttributes','ContactId','include','includeAll','CmHopperHistory','getHopperFinals','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','Incorrect\x20binding\x20parameters\x20passed!','No\x20phone\x20column\x20specified','No\x20firstName\x20column\x20specified','root','file','filename','chmodSync','child_process','fork','../../components/import/cm/csv','CompanyId','File\x20uploaded\x20correctly!','pid','send','upload','createReadStream','parse','meta','import','User','binding','firstName','stringify','message','error\x20child\x20process','getJourney','fax','whatsapp','voice','-createdAt','channel','includes','Invalid\x20channel','toLowerCase','range','Invalid\x20date\x20for\x20range\x20from\x20filter','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter','uniqueid','source','destination','callerid','starttime','endtime','duration','createdAt','userDisposition','userThirdDisposition','UserId','fullname','alias','findAndCountAll','startCase','chat','Website','Account','closed','closedAt','note','disposition','customerIp','customerPort','deviceModel','osName','referer','subject','substatus','openchannel','externalUrl','threadId','Owner','flatten','reverse','slice','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','defaults','redis','localhost','./cmContact.socket','register','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','CmContact','describe','length','keys','startsWith','cf_','push','CmCustomField','findOne','trimStart','all','fieldType','type','query','intersection','model','fields','attributes','hasOwnProperty','nolimit','order','sort','where','filters','pick','field','color','from','tools_tags','select','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20c.id','cm_contact_has_tags','c.deletedAt\x20IS\x20NULL','expr','search','parseSearch','conditions','Tag','value','map','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','and','uc.UserId\x20=\x20?','dateOfBirth','datetime','castTo','buildExpression','text','start','filter','isNil','isEmpty','forEach','ListId','c.ListId\x20IN\x20?','concat','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','tag','isArray','replace','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','group','c.id','Sequelize','QueryTypes','SELECT','clone','DESC','having','t.id\x20IN\x20?','resolve','user','role','agent','getLists','c.ListId\x20IS\x20NULL','sequelize','toString','keyBy','c.firstName','c.lastName','c.phone','c.fax','c.ListId','c.CompanyId','GROUP_CONCAT(DISTINCT\x20t.id)','TagIds','Tags','split','rows','catch','tags','columnName','findAll','values','merge','body','get','mergeWith','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','MailInteraction','MailMessage','SmsInteraction'];(function(_0x179c4a,_0x10eb06){var _0x5d1879=function(_0x1f1dcd){while(--_0x1f1dcd){_0x179c4a['push'](_0x179c4a['shift']());}};_0x5d1879(++_0x10eb06);}(_0x8168,0x18c));var _0x8816=function(_0x5751e6,_0x125e5e){_0x5751e6=_0x5751e6-0x0;var _0x4199e4=_0x8168[_0x5751e6];return _0x4199e4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8816('0x0'));var zipdir=require(_0x8816('0x1'));var jsonpatch=require(_0x8816('0x2'));var rp=require(_0x8816('0x3'));var moment=require(_0x8816('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8816('0x5'));var util=require(_0x8816('0x6'));var path=require(_0x8816('0x7'));var sox=require(_0x8816('0x8'));var csv=require('to-csv');var ejs=require(_0x8816('0x9'));var fs=require('fs');var fs_extra=require(_0x8816('0xa'));var _=require(_0x8816('0xb'));var squel=require('squel');var crypto=require(_0x8816('0xc'));var jsforce=require(_0x8816('0xd'));var deskjs=require(_0x8816('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8816('0xf'));var Papa=require(_0x8816('0x10'));var Redis=require('ioredis');var authService=require(_0x8816('0x11'));var qs=require(_0x8816('0x12'));var as=require(_0x8816('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8816('0x14'))(_0x8816('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x8816('0x16')](config[_0x8816('0x17')],{'host':_0x8816('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x8816('0x19'))[_0x8816('0x1a')](socket);function respondWithStatusCode(_0x55cef2,_0x236105){_0x236105=_0x236105||0xcc;return function(_0x4bfcd4){if(_0x4bfcd4){return _0x55cef2['sendStatus'](_0x236105);}return _0x55cef2[_0x8816('0x1b')](_0x236105)[_0x8816('0x1c')]();};}function respondWithResult(_0x44842f,_0x3d67a1){_0x3d67a1=_0x3d67a1||0xc8;return function(_0x31c438){if(_0x31c438){return _0x44842f[_0x8816('0x1b')](_0x3d67a1)[_0x8816('0x1d')](_0x31c438);}};}function respondWithFilteredResult(_0x2b94f3,_0x13cbe5){return function(_0x4e3cbd){if(_0x4e3cbd){var _0x1a7dc0=typeof _0x13cbe5[_0x8816('0x1e')]===_0x8816('0x1f')&&typeof _0x13cbe5['limit']===_0x8816('0x1f');var _0x94cf5d=_0x4e3cbd[_0x8816('0x20')];var _0x39210b=_0x1a7dc0?0x0:_0x13cbe5[_0x8816('0x1e')];var _0x56116e=_0x1a7dc0?_0x4e3cbd[_0x8816('0x20')]:_0x13cbe5[_0x8816('0x1e')]+_0x13cbe5[_0x8816('0x21')];var _0x42a2d4;if(_0x56116e>=_0x94cf5d){_0x56116e=_0x94cf5d;_0x42a2d4=0xc8;}else{_0x42a2d4=0xce;}_0x2b94f3[_0x8816('0x1b')](_0x42a2d4);return _0x2b94f3['set']('Content-Range',_0x39210b+'-'+_0x56116e+'/'+_0x94cf5d)[_0x8816('0x1d')](_0x4e3cbd);}return null;};}function patchUpdates(_0x530150){return function(_0x12781c){try{jsonpatch[_0x8816('0x22')](_0x12781c,_0x530150,!![]);}catch(_0x5960c5){return BPromise[_0x8816('0x23')](_0x5960c5);}return _0x12781c[_0x8816('0x24')]();};}function saveUpdates(_0x3527f1,_0x784102){return function(_0x5f324b){if(_0x5f324b){return _0x5f324b[_0x8816('0x25')](_0x3527f1)[_0x8816('0x26')](function(_0xb76b7b){return _0xb76b7b;});}return null;};}function removeEntity(_0xca1a16,_0x5e7a74){return function(_0x12c702){if(_0x12c702){return _0x12c702[_0x8816('0x27')]()[_0x8816('0x26')](function(){_0xca1a16['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10840,_0x1adca1){return function(_0x575545){if(!_0x575545){_0x10840[_0x8816('0x28')](0x194);}return _0x575545;};}function handleError(_0x55729b,_0x450d03){_0x450d03=_0x450d03||0x1f4;return function(_0x156527){logger[_0x8816('0x29')](_0x156527[_0x8816('0x2a')]);if(_0x156527[_0x8816('0x2b')]){delete _0x156527[_0x8816('0x2b')];}_0x55729b['status'](_0x450d03)['send'](_0x156527);};}exports['index']=function(_0x51fbf5,_0x3c062d){var _0xd40e66={},_0x268765={},_0x321b7d={'count':0x0,'rows':[]};return db[_0x8816('0x2c')][_0x8816('0x2d')]()[_0x8816('0x26')](function(_0x5dff15){var _0x475423=[];for(var _0x56ef21=0x0;_0x56ef210x1){_0x51a050['or'](_0x8816('0x6c'),qs[_0x8816('0x6d')](_0x2f1981),null);}else{if(qs[_0x8816('0x6e')](_0x2f1981)){_0x51a050['or'](_0x8816('0x6f'),_0x2f1981+'%');_0x51a050['or'](_0x8816('0x70'),_0x2f1981+'%');_0x51a050['or'](_0x8816('0x71'),_0x2f1981+'%');_0x51a050['or'](_0x8816('0x72'),_0x2f1981+'%');}else if(qs[_0x8816('0x73')](_0x2f1981)){_0x51a050['or'](_0x8816('0x74'),_0x2f1981+'%');}else{_0x51a050['or']('c.firstName\x20LIKE\x20?','%'+_0x2f1981+'%');_0x51a050['or'](_0x8816('0x75'),'%'+_0x2f1981+'%');_0x51a050['or'](_0x8816('0x74'),'%'+_0x2f1981+'%');}}}}_0x52443d['where'](_0x51a050);_0x52443d[_0x8816('0x76')](_0x8816('0x77'));var _0x43b2b5={'type':db[_0x8816('0x78')][_0x8816('0x79')][_0x8816('0x7a')],'raw':!![]};var _0x1cac48=_0x52443d[_0x8816('0x7b')]()['field']('c.id');if(_0xd40e66['order']){_0xd40e66[_0x8816('0x40')][_0x8816('0x63')](function(_0x4d9f05){_0x52443d['order']('c.'+_0x4d9f05[0x0],_0x4d9f05[0x1]===_0x8816('0x7c')?![]:!![]);});}if(!_[_0x8816('0x62')](_0x3a6405)){_0x52443d[_0x8816('0x7d')](_0x6edf52);_0x1cac48['where'](_0x8816('0x7e'),_0x3a6405);}BPromise[_0x8816('0x7f')]()[_0x8816('0x26')](function(){if(!_0x463eac)return;if(_0x51fbf5[_0x8816('0x80')][_0x8816('0x81')]!==_0x8816('0x82'))return;if(!_['some'](_0x463eac[_0x8816('0x52')],[_0x8816('0x45'),'User'])){return _0x51fbf5[_0x8816('0x80')][_0x8816('0x83')]({'attributes':['id'],'raw':!![]})[_0x8816('0x26')](function(_0x205ce2){if(_[_0x8816('0x62')](_0x205ce2)){_0x1cac48['where'](_0x8816('0x84'));_0x52443d[_0x8816('0x42')](_0x8816('0x84'));}else{_0x1cac48[_0x8816('0x42')](_0x8816('0x65'),_[_0x8816('0x55')](_0x205ce2,'id'));_0x52443d[_0x8816('0x42')]('c.ListId\x20IN\x20?',_[_0x8816('0x55')](_0x205ce2,'id'));}});}})[_0x8816('0x26')](function(){if(_0x51fbf5[_0x8816('0x80')]['role']===_0x8816('0x82')&&!_0x463eac&&!_0x51fbf5[_0x8816('0x39')][_0x8816('0x64')])return[];return db[_0x8816('0x85')][_0x8816('0x39')](_0x1cac48[_0x8816('0x86')](),_0x43b2b5);})[_0x8816('0x26')](function(_0x346569){_0x321b7d[_0x8816('0x20')]=_0x346569['length'];if(_0x321b7d['count']===0x0)return[];return db[_0x8816('0x85')][_0x8816('0x39')](_0x594148[_0x8816('0x86')](),_0x43b2b5)[_0x8816('0x26')](function(_0x272b6b){_0x28f967=_[_0x8816('0x87')](_0x272b6b,'id');_0x43b2b5=_['merge'](_0x43b2b5,{'model':db[_0x8816('0x2c')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x51fbf5['query'][_0x8816('0x3c')]){_0xd40e66['attributes'][_0x8816('0x63')](function(_0x44dd8b){_0x52443d[_0x8816('0x45')]('c.'+_0x44dd8b);});}else{_0x52443d['field'](_0x8816('0x77'));_0x52443d[_0x8816('0x45')](_0x8816('0x88'));_0x52443d['field'](_0x8816('0x89'));_0x52443d['field'](_0x8816('0x8a'));_0x52443d[_0x8816('0x45')]('c.mobile');_0x52443d[_0x8816('0x45')](_0x8816('0x8b'));_0x52443d['field']('c.email');_0x52443d[_0x8816('0x45')](_0x8816('0x8c'));_0x52443d[_0x8816('0x45')]('c.createdAt');_0x52443d[_0x8816('0x45')]('c.deletedAt');_0x52443d[_0x8816('0x45')](_0x8816('0x8d'));_0x52443d['field'](_0x8816('0x8e'),_0x8816('0x8f'));}if(_0xd40e66[_0x8816('0x21')])_0x52443d[_0x8816('0x21')](_0xd40e66[_0x8816('0x21')]);if(_0xd40e66[_0x8816('0x1e')])_0x52443d[_0x8816('0x1e')](_0xd40e66[_0x8816('0x1e')]);return db[_0x8816('0x85')]['query'](_0x52443d['toString'](),_0x43b2b5);});})[_0x8816('0x26')](function(_0x57f747){_0x57f747[_0x8816('0x63')](function(_0x1bff31){if(_0x1bff31[_0x8816('0x8f')]){_0x1bff31[_0x8816('0x90')]=[];_0x1bff31[_0x8816('0x8f')][_0x8816('0x91')](',')[_0x8816('0x63')](function(_0x36e406){_0x1bff31[_0x8816('0x90')][_0x8816('0x32')](_0x28f967[_0x36e406]);});}delete _0x1bff31[_0x8816('0x8f')];});_0x321b7d[_0x8816('0x92')]=_0x57f747;return _0x321b7d;})[_0x8816('0x26')](respondWithFilteredResult(_0x3c062d,_0xd40e66));})[_0x8816('0x93')](handleError(_0x3c062d,null));};exports['destroy']=function(_0x284493,_0x51c863){return db[_0x8816('0x2c')]['find']({'where':{'id':_0x284493['params']['id']}})[_0x8816('0x26')](handleEntityNotFound(_0x51c863,null))['then'](removeEntity(_0x51c863,null))[_0x8816('0x93')](handleError(_0x51c863,null));};exports[_0x8816('0x2d')]=function(_0x33dbba,_0x325116){return db[_0x8816('0x2c')][_0x8816('0x2d')]()['then'](function(_0x80b14f){delete _0x80b14f[_0x8816('0x94')];for(var _0x24de0e=0x0;_0x24de0e=_0x1134fc){_0x273e71=_0x1134fc;_0x5f0fd2=0xc8;}else{_0x5f0fd2=0xce;}_0x19658b[_0x4579('0x20')](_0x5f0fd2);return _0x19658b[_0x4579('0x27')]('Content-Range',_0x4665a9+'-'+_0x273e71+'/'+_0x1134fc)[_0x4579('0x22')](_0x536a8f);}return null;};}function patchUpdates(_0x4bd1d7){return function(_0x5485c1){try{jsonpatch[_0x4579('0x28')](_0x5485c1,_0x4bd1d7,!![]);}catch(_0x3ecdbc){return BPromise[_0x4579('0x29')](_0x3ecdbc);}return _0x5485c1[_0x4579('0x2a')]();};}function saveUpdates(_0x5a86f6,_0x4811da){return function(_0x2fd579){if(_0x2fd579){return _0x2fd579[_0x4579('0x2b')](_0x5a86f6)[_0x4579('0x2c')](function(_0x436944){return _0x436944;});}return null;};}function removeEntity(_0x3a1b71,_0x3ff190){return function(_0x3ef692){if(_0x3ef692){return _0x3ef692['destroy']()[_0x4579('0x2c')](function(){_0x3a1b71[_0x4579('0x20')](0xcc)[_0x4579('0x21')]();});}};}function handleEntityNotFound(_0x3364f4,_0x266320){return function(_0xe48b0a){if(!_0xe48b0a){_0x3364f4['sendStatus'](0x194);}return _0xe48b0a;};}function handleError(_0x1cb59a,_0xdbfcf3){_0xdbfcf3=_0xdbfcf3||0x1f4;return function(_0x594469){logger[_0x4579('0x2d')](_0x594469[_0x4579('0x2e')]);if(_0x594469[_0x4579('0x2f')]){delete _0x594469[_0x4579('0x2f')];}_0x1cb59a[_0x4579('0x20')](_0xdbfcf3)['send'](_0x594469);};}exports[_0x4579('0x30')]=function(_0x17be89,_0x511f68){var _0x1393b5={},_0x43ef67={},_0xb6f6={'count':0x0,'rows':[]};return db[_0x4579('0x31')][_0x4579('0x32')]()[_0x4579('0x2c')](function(_0x3936f2){var _0x2f4a38=[];for(var _0x4c15e7=0x0;_0x4c15e70x1){_0x135c02['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4579('0x6e')](_0x2281ab),null);}else{if(qs[_0x4579('0x6f')](_0x2281ab)){_0x135c02['or'](_0x4579('0x70'),_0x2281ab+'%');_0x135c02['or'](_0x4579('0x71'),_0x2281ab+'%');_0x135c02['or'](_0x4579('0x72'),_0x2281ab+'%');_0x135c02['or']('c.fax\x20LIKE\x20?',_0x2281ab+'%');}else if(qs[_0x4579('0x73')](_0x2281ab)){_0x135c02['or'](_0x4579('0x74'),_0x2281ab+'%');}else{_0x135c02['or'](_0x4579('0x75'),'%'+_0x2281ab+'%');_0x135c02['or'](_0x4579('0x76'),'%'+_0x2281ab+'%');_0x135c02['or']('c.email\x20LIKE\x20?','%'+_0x2281ab+'%');}}}}_0x1060ef[_0x4579('0x53')](_0x135c02);_0x1060ef[_0x4579('0x77')](_0x4579('0x78'));var _0x49a577={'type':db['Sequelize'][_0x4579('0x79')][_0x4579('0x7a')],'raw':!![]};var _0x40c4cb=_0x1060ef[_0x4579('0x7b')]()[_0x4579('0x47')](_0x4579('0x78'));if(_0x1393b5[_0x4579('0x44')]){_0x1393b5['order'][_0x4579('0x67')](function(_0x40aa2a){_0x1060ef['order']('c.'+_0x40aa2a[0x0],_0x40aa2a[0x1]===_0x4579('0x7c')?![]:!![]);});}if(!_[_0x4579('0x66')](_0x535214)){_0x1060ef[_0x4579('0x7d')](_0x43c51c);_0x40c4cb['where'](_0x4579('0x7e'),_0x535214);}BPromise['resolve']()[_0x4579('0x2c')](function(){if(!_0x26aec7)return;if(_0x17be89[_0x4579('0x7f')][_0x4579('0x80')]!=='agent')return;if(!_['some'](_0x26aec7[_0x4579('0x57')],[_0x4579('0x47'),_0x4579('0x5c')])){return _0x17be89[_0x4579('0x7f')][_0x4579('0x81')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4a8a92){if(_['isEmpty'](_0x4a8a92)){_0x40c4cb[_0x4579('0x53')]('c.ListId\x20IS\x20NULL');_0x1060ef[_0x4579('0x53')](_0x4579('0x82'));}else{_0x40c4cb[_0x4579('0x53')](_0x4579('0x69'),_[_0x4579('0x5b')](_0x4a8a92,'id'));_0x1060ef[_0x4579('0x53')]('c.ListId\x20IN\x20?',_['map'](_0x4a8a92,'id'));}});}})['then'](function(){if(_0x17be89['user'][_0x4579('0x80')]===_0x4579('0x83')&&!_0x26aec7&&!_0x17be89[_0x4579('0x3d')][_0x4579('0x68')])return[];return db[_0x4579('0x84')][_0x4579('0x3d')](_0x40c4cb[_0x4579('0x85')](),_0x49a577);})[_0x4579('0x2c')](function(_0x13f1c1){_0xb6f6[_0x4579('0x26')]=_0x13f1c1['length'];if(_0xb6f6[_0x4579('0x26')]===0x0)return[];return db[_0x4579('0x84')][_0x4579('0x3d')](_0x29047a['toString'](),_0x49a577)['then'](function(_0x27fc78){_0x1b5eb9=_[_0x4579('0x86')](_0x27fc78,'id');_0x49a577=_[_0x4579('0x87')](_0x49a577,{'model':db[_0x4579('0x31')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x17be89[_0x4579('0x3d')][_0x4579('0x40')]){_0x1393b5['attributes'][_0x4579('0x67')](function(_0x268883){_0x1060ef[_0x4579('0x47')]('c.'+_0x268883);});}else{_0x1060ef[_0x4579('0x47')](_0x4579('0x78'));_0x1060ef[_0x4579('0x47')](_0x4579('0x88'));_0x1060ef[_0x4579('0x47')]('c.lastName');_0x1060ef[_0x4579('0x47')](_0x4579('0x89'));_0x1060ef[_0x4579('0x47')]('c.mobile');_0x1060ef[_0x4579('0x47')](_0x4579('0x8a'));_0x1060ef[_0x4579('0x47')](_0x4579('0x8b'));_0x1060ef[_0x4579('0x47')](_0x4579('0x8c'));_0x1060ef[_0x4579('0x47')]('c.createdAt');_0x1060ef[_0x4579('0x47')](_0x4579('0x8d'));_0x1060ef[_0x4579('0x47')](_0x4579('0x8e'));_0x1060ef[_0x4579('0x47')](_0x4579('0x8f'),_0x4579('0x90'));}if(_0x1393b5['limit'])_0x1060ef[_0x4579('0x25')](_0x1393b5[_0x4579('0x25')]);if(_0x1393b5['offset'])_0x1060ef[_0x4579('0x23')](_0x1393b5[_0x4579('0x23')]);return db[_0x4579('0x84')][_0x4579('0x3d')](_0x1060ef[_0x4579('0x85')](),_0x49a577);});})[_0x4579('0x2c')](function(_0x26f6ea){_0x26f6ea[_0x4579('0x67')](function(_0x59ed03){if(_0x59ed03[_0x4579('0x90')]){_0x59ed03['Tags']=[];_0x59ed03[_0x4579('0x90')][_0x4579('0x5a')](',')[_0x4579('0x67')](function(_0x221141){_0x59ed03['Tags'][_0x4579('0x36')](_0x1b5eb9[_0x221141]);});}delete _0x59ed03['TagIds'];});_0xb6f6[_0x4579('0x91')]=_0x26f6ea;return _0xb6f6;})[_0x4579('0x2c')](respondWithFilteredResult(_0x511f68,_0x1393b5));})[_0x4579('0x92')](handleError(_0x511f68,null));};exports[_0x4579('0x93')]=function(_0xec0197,_0x444e66){return db[_0x4579('0x31')][_0x4579('0x94')]({'where':{'id':_0xec0197[_0x4579('0x95')]['id']}})[_0x4579('0x2c')](handleEntityNotFound(_0x444e66,null))['then'](removeEntity(_0x444e66,null))[_0x4579('0x92')](handleError(_0x444e66,null));};exports[_0x4579('0x32')]=function(_0x51e86c,_0x45d03b){return db['CmContact'][_0x4579('0x32')]()['then'](function(_0x112919){delete _0x112919[_0x4579('0x96')];for(var _0x147827=0x0;_0x147827{}\s\\|]/g,'-');_0xb0ac28(null,util['format'](_0x7186('0x1f'),path[_0x7186('0x20')](_0x3f932b[_0x7186('0x21')],path['extname'](_0x3f932b[_0x7186('0x21')])),Date[_0x7186('0x22')](),path[_0x7186('0x23')](_0x3f932b[_0x7186('0x21')])));}})});router[_0x7186('0x18')]('/csv',upload[_0x7186('0x24')](_0x7186('0x25')),controller[_0x7186('0x26')]);var upload=multer({'storage':multer[_0x7186('0x27')]({'destination':function(_0x321bec,_0x3f1eb1,_0x156466){_0x156466(null,path[_0x7186('0x1e')](config['root'],_0x7186('0x28')));},'filename':function(_0x463f1e,_0x49c1d5,_0x40356a){_0x49c1d5['originalname']=_0x49c1d5[_0x7186('0x21')][_0x7186('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x40356a(null,util[_0x7186('0x2a')](_0x7186('0x1f'),path[_0x7186('0x20')](_0x49c1d5['originalname'],path[_0x7186('0x23')](_0x49c1d5[_0x7186('0x21')])),Date[_0x7186('0x22')](),path[_0x7186('0x23')](_0x49c1d5[_0x7186('0x21')])));}})});router['post'](_0x7186('0x2b'),upload[_0x7186('0x24')](_0x7186('0x25')),controller['upload']);router[_0x7186('0x18')](_0x7186('0x2c'),auth[_0x7186('0xa')](),controller[_0x7186('0x2d')]);router[_0x7186('0x2e')]('/:id',auth['isAuthenticated'](),controller[_0x7186('0x2f')]);router['delete'](_0x7186('0xd'),auth[_0x7186('0xa')](),controller[_0x7186('0x30')]);module['exports']=router; \ No newline at end of file +var _0x38e9=['./cmContact.controller','get','isAuthenticated','/describe','/:id','show','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','getJourney','post','create','/create_many','bulkCreate','setTags','diskStorage','root','server/files/tmp','originalname','format','%s-%s%s','basename','extname','now','/csv','single','file','uploadCsv','join','replace','/upload','upload','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x1e8982,_0x37bfc7){var _0x115066=function(_0x202cb1){while(--_0x202cb1){_0x1e8982['push'](_0x1e8982['shift']());}};_0x115066(++_0x37bfc7);}(_0x38e9,0x8a));var _0x938e=function(_0x2e6184,_0xf2fc16){_0x2e6184=_0x2e6184-0x0;var _0x1e4c2c=_0x38e9[_0x2e6184];return _0x1e4c2c;};'use strict';var multer=require(_0x938e('0x0'));var util=require(_0x938e('0x1'));var path=require(_0x938e('0x2'));var timeout=require(_0x938e('0x3'));var express=require(_0x938e('0x4'));var router=express[_0x938e('0x5')]();var fs_extra=require(_0x938e('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x938e('0x7'));var config=require(_0x938e('0x8'));var controller=require(_0x938e('0x9'));router[_0x938e('0xa')]('/',auth[_0x938e('0xb')](),controller['index']);router[_0x938e('0xa')](_0x938e('0xc'),auth[_0x938e('0xb')](),controller['describe']);router[_0x938e('0xa')](_0x938e('0xd'),auth[_0x938e('0xb')](),controller[_0x938e('0xe')]);router['get']('/:id/tags',auth[_0x938e('0xb')](),controller[_0x938e('0xf')]);router[_0x938e('0xa')](_0x938e('0x10'),auth['isAuthenticated'](),controller[_0x938e('0x11')]);router[_0x938e('0xa')](_0x938e('0x12'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0x938e('0xa')](_0x938e('0x13'),auth['isAuthenticated'](),controller[_0x938e('0x14')]);router[_0x938e('0xa')]('/:id/jscripty_sessions',auth['isAuthenticated'](),controller['getJscriptySessions']);router[_0x938e('0xa')]('/:id/journey',auth['isAuthenticated'](),controller[_0x938e('0x15')]);router['post']('/merge',auth[_0x938e('0xb')](),controller['merge']);router[_0x938e('0x16')]('/',auth[_0x938e('0xb')](),controller[_0x938e('0x17')]);router[_0x938e('0x16')](_0x938e('0x18'),auth['isAuthenticated'](),controller[_0x938e('0x19')]);router[_0x938e('0x16')]('/:id/tags',auth['isAuthenticated'](),controller[_0x938e('0x1a')]);var upload=multer({'storage':multer[_0x938e('0x1b')]({'destination':function(_0x5c0bf1,_0x15c5ad,_0xc4b9f9){_0xc4b9f9(null,path['join'](config[_0x938e('0x1c')],_0x938e('0x1d')));},'filename':function(_0xd30f96,_0x33769e,_0x588a12){_0x33769e[_0x938e('0x1e')]=_0x33769e['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x588a12(null,util[_0x938e('0x1f')](_0x938e('0x20'),path[_0x938e('0x21')](_0x33769e[_0x938e('0x1e')],path[_0x938e('0x22')](_0x33769e[_0x938e('0x1e')])),Date[_0x938e('0x23')](),path['extname'](_0x33769e[_0x938e('0x1e')])));}})});router[_0x938e('0x16')](_0x938e('0x24'),upload[_0x938e('0x25')](_0x938e('0x26')),controller[_0x938e('0x27')]);var upload=multer({'storage':multer[_0x938e('0x1b')]({'destination':function(_0x431de3,_0x11425d,_0x4ff600){_0x4ff600(null,path[_0x938e('0x28')](config[_0x938e('0x1c')],'server/files/tmp'));},'filename':function(_0xca7d74,_0x2f1a12,_0x3f62e0){_0x2f1a12[_0x938e('0x1e')]=_0x2f1a12['originalname'][_0x938e('0x29')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3f62e0(null,util[_0x938e('0x1f')]('%s-%s%s',path[_0x938e('0x21')](_0x2f1a12['originalname'],path[_0x938e('0x22')](_0x2f1a12['originalname'])),Date[_0x938e('0x23')](),path[_0x938e('0x22')](_0x2f1a12[_0x938e('0x1e')])));}})});router[_0x938e('0x16')](_0x938e('0x2a'),upload[_0x938e('0x25')](_0x938e('0x26')),controller[_0x938e('0x2b')]);router[_0x938e('0x16')]('/upload/:id',auth['isAuthenticated'](),controller['import']);router[_0x938e('0x2c')](_0x938e('0xd'),auth[_0x938e('0xb')](),controller[_0x938e('0x2d')]);router[_0x938e('0x2e')](_0x938e('0xd'),auth['isAuthenticated'](),controller[_0x938e('0x2f')]);module[_0x938e('0x30')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 57f39f6..96a48bf 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 _0xf8ee=['type','values','isArray','setDataValue','stringify','BOOLEAN','ENUM','sequelize','lodash','exports','VIRTUAL','getDataValue','alias','STRING','name','TEXT'];(function(_0x25b5bc,_0x122b66){var _0x5ee4f7=function(_0x2e2896){while(--_0x2e2896){_0x25b5bc['push'](_0x25b5bc['shift']());}};_0x5ee4f7(++_0x122b66);}(_0xf8ee,0xe7));var _0xef8e=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xf8ee[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xef8e('0x0'));var _=require(_0xef8e('0x1'));module[_0xef8e('0x2')]={'name':{'type':Sequelize[_0xef8e('0x3')],'get':function(_0x3f04f8){return this[_0xef8e('0x4')](_0xef8e('0x5'));}},'alias':{'type':Sequelize[_0xef8e('0x6')],'allowNull':![],'set':function(_0x58c7ca){this['setDataValue'](_0xef8e('0x5'),_0x58c7ca?_0x58c7ca:this[_0xef8e('0x4')](_0xef8e('0x7')));}},'type':{'type':Sequelize[_0xef8e('0x6')],'allowNull':![]},'values':{'type':Sequelize[_0xef8e('0x8')]('long'),'get':function(){if(this[_0xef8e('0x4')](_0xef8e('0x9'))==='select'){return JSON['parse'](this[_0xef8e('0x4')]('values'));}else{return this[_0xef8e('0x4')](_0xef8e('0xa'));}},'set':function(_0x2bd2a3){if(Array[_0xef8e('0xb')](_0x2bd2a3)){this[_0xef8e('0xc')](_0xef8e('0xa'),JSON[_0xef8e('0xd')](_0x2bd2a3));}else{this['setDataValue'](_0xef8e('0xa'),_0x2bd2a3);}}},'required':{'type':Sequelize[_0xef8e('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'actionType':{'type':Sequelize[_0xef8e('0xf')]('voice')}}; \ No newline at end of file +var _0xf327=['alias','STRING','setDataValue','name','long','type','parse','getDataValue','values','isArray','stringify','BOOLEAN','ENUM','voice','sequelize','lodash','exports','VIRTUAL'];(function(_0xbd08b4,_0x4790ed){var _0x314f1e=function(_0x161589){while(--_0x161589){_0xbd08b4['push'](_0xbd08b4['shift']());}};_0x314f1e(++_0x4790ed);}(_0xf327,0x176));var _0x7f32=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf327[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x7f32('0x0'));var _=require(_0x7f32('0x1'));module[_0x7f32('0x2')]={'name':{'type':Sequelize[_0x7f32('0x3')],'get':function(_0x21d1d2){return this['getDataValue'](_0x7f32('0x4'));}},'alias':{'type':Sequelize[_0x7f32('0x5')],'allowNull':![],'set':function(_0x40502f){this[_0x7f32('0x6')](_0x7f32('0x4'),_0x40502f?_0x40502f:this['getDataValue'](_0x7f32('0x7')));}},'type':{'type':Sequelize[_0x7f32('0x5')],'allowNull':![]},'values':{'type':Sequelize['TEXT'](_0x7f32('0x8')),'get':function(){if(this['getDataValue'](_0x7f32('0x9'))==='select'){return JSON[_0x7f32('0xa')](this[_0x7f32('0xb')](_0x7f32('0xc')));}else{return this[_0x7f32('0xb')]('values');}},'set':function(_0x1b4980){if(Array[_0x7f32('0xd')](_0x1b4980)){this['setDataValue'](_0x7f32('0xc'),JSON[_0x7f32('0xe')](_0x1b4980));}else{this[_0x7f32('0x6')](_0x7f32('0xc'),_0x1b4980);}}},'required':{'type':Sequelize[_0x7f32('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x7f32('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x7f32('0x10')](_0x7f32('0x11'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 0d207ca..91ae33b 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 _0x0f1a=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','index','CmCustomField','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','body','find','params','sequelize','create','Sequelize','TEXT','number','INTEGER','BOOLEAN','defaultValue','queryInterface','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis'];(function(_0x4a599b,_0x1d2125){var _0x2d53d3=function(_0x5e7982){while(--_0x5e7982){_0x4a599b['push'](_0x4a599b['shift']());}};_0x2d53d3(++_0x1d2125);}(_0x0f1a,0x101));var _0xa0f1=function(_0x3c700f,_0x2ad2c8){_0x3c700f=_0x3c700f-0x0;var _0x1bf773=_0x0f1a[_0x3c700f];return _0x1bf773;};'use strict';var emlformat=require(_0xa0f1('0x0'));var rimraf=require(_0xa0f1('0x1'));var zipdir=require(_0xa0f1('0x2'));var jsonpatch=require(_0xa0f1('0x3'));var rp=require(_0xa0f1('0x4'));var moment=require(_0xa0f1('0x5'));var BPromise=require(_0xa0f1('0x6'));var Mustache=require('mustache');var util=require(_0xa0f1('0x7'));var path=require(_0xa0f1('0x8'));var sox=require(_0xa0f1('0x9'));var csv=require('to-csv');var ejs=require(_0xa0f1('0xa'));var fs=require('fs');var fs_extra=require(_0xa0f1('0xb'));var _=require(_0xa0f1('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa0f1('0xd'));var deskjs=require(_0xa0f1('0xe'));var toCsv=require(_0xa0f1('0xf'));var querystring=require(_0xa0f1('0x10'));var Papa=require(_0xa0f1('0x11'));var Redis=require(_0xa0f1('0x12'));var authService=require(_0xa0f1('0x13'));var qs=require(_0xa0f1('0x14'));var as=require(_0xa0f1('0x15'));var hardwareService=require(_0xa0f1('0x16'));var logger=require(_0xa0f1('0x17'))('api');var utils=require(_0xa0f1('0x18'));var config=require(_0xa0f1('0x19'));var licenseUtil=require(_0xa0f1('0x1a'));var db=require(_0xa0f1('0x1b'))['db'];function respondWithStatusCode(_0x43397a,_0x2c06cb){_0x2c06cb=_0x2c06cb||0xcc;return function(_0x5e8646){if(_0x5e8646){return _0x43397a['sendStatus'](_0x2c06cb);}return _0x43397a['status'](_0x2c06cb)[_0xa0f1('0x1c')]();};}function respondWithResult(_0x41b2d4,_0x35443d){_0x35443d=_0x35443d||0xc8;return function(_0x28d85f){if(_0x28d85f){return _0x41b2d4[_0xa0f1('0x1d')](_0x35443d)[_0xa0f1('0x1e')](_0x28d85f);}};}function respondWithFilteredResult(_0x4ee5bb,_0x33019f){return function(_0x570219){if(_0x570219){var _0x46ce8a=typeof _0x33019f[_0xa0f1('0x1f')]===_0xa0f1('0x20')&&typeof _0x33019f['limit']==='undefined';var _0x305fd2=_0x570219[_0xa0f1('0x21')];var _0xcfb63d=_0x46ce8a?0x0:_0x33019f[_0xa0f1('0x1f')];var _0x46b4b8=_0x46ce8a?_0x570219[_0xa0f1('0x21')]:_0x33019f['offset']+_0x33019f['limit'];var _0x5d5472;if(_0x46b4b8>=_0x305fd2){_0x46b4b8=_0x305fd2;_0x5d5472=0xc8;}else{_0x5d5472=0xce;}_0x4ee5bb['status'](_0x5d5472);return _0x4ee5bb[_0xa0f1('0x22')](_0xa0f1('0x23'),_0xcfb63d+'-'+_0x46b4b8+'/'+_0x305fd2)[_0xa0f1('0x1e')](_0x570219);}return null;};}function patchUpdates(_0x2c38bc){return function(_0x42ed9e){try{jsonpatch[_0xa0f1('0x24')](_0x42ed9e,_0x2c38bc,!![]);}catch(_0x3c8f31){return BPromise[_0xa0f1('0x25')](_0x3c8f31);}return _0x42ed9e[_0xa0f1('0x26')]();};}function saveUpdates(_0x2c50eb,_0x947ac3){return function(_0x37216f){if(_0x37216f){return _0x37216f[_0xa0f1('0x27')](_0x2c50eb)[_0xa0f1('0x28')](function(_0x309782){return _0x309782;});}return null;};}function removeEntity(_0x266d55,_0x26cf14){return function(_0x119685){if(_0x119685){return _0x119685[_0xa0f1('0x29')]()[_0xa0f1('0x28')](function(){_0x266d55[_0xa0f1('0x1d')](0xcc)[_0xa0f1('0x1c')]();});}};}function handleEntityNotFound(_0x4a594b,_0x195fff){return function(_0x50cbc6){if(!_0x50cbc6){_0x4a594b[_0xa0f1('0x2a')](0x194);}return _0x50cbc6;};}function handleError(_0x1d00f4,_0xd41efe){_0xd41efe=_0xd41efe||0x1f4;return function(_0x27cbde){logger[_0xa0f1('0x2b')](_0x27cbde[_0xa0f1('0x2c')]);if(_0x27cbde[_0xa0f1('0x2d')]){delete _0x27cbde[_0xa0f1('0x2d')];}_0x1d00f4['status'](_0xd41efe)['send'](_0x27cbde);};}exports[_0xa0f1('0x2e')]=function(_0x475a0b,_0x312e6d){var _0x127efd={},_0xa2930c={},_0x4e986d={'count':0x0,'rows':[]};var _0x428f3c=_['map'](db[_0xa0f1('0x2f')][_0xa0f1('0x30')],function(_0x177489){return{'name':_0x177489[_0xa0f1('0x31')],'type':_0x177489[_0xa0f1('0x32')][_0xa0f1('0x33')]};});_0xa2930c[_0xa0f1('0x34')]=_[_0xa0f1('0x35')](_[_0xa0f1('0x36')](_0x428f3c,'name'),['name']);_0xa2930c[_0xa0f1('0x37')]=_[_0xa0f1('0x38')](_0x475a0b[_0xa0f1('0x37')]);_0xa2930c[_0xa0f1('0x39')]=_[_0xa0f1('0x3a')](_0xa2930c['model'],_0xa2930c[_0xa0f1('0x37')]);_0x127efd[_0xa0f1('0x3b')]=_[_0xa0f1('0x3a')](_0xa2930c[_0xa0f1('0x34')],qs[_0xa0f1('0x3c')](_0x475a0b[_0xa0f1('0x37')][_0xa0f1('0x3c')]));_0x127efd[_0xa0f1('0x3b')]=_0x127efd['attributes'][_0xa0f1('0x3d')]?_0x127efd[_0xa0f1('0x3b')]:_0xa2930c['model'];if(!_0x475a0b['query'][_0xa0f1('0x3e')](_0xa0f1('0x3f'))){_0x127efd[_0xa0f1('0x40')]=qs[_0xa0f1('0x40')](_0x475a0b[_0xa0f1('0x37')][_0xa0f1('0x40')]);_0x127efd[_0xa0f1('0x1f')]=qs[_0xa0f1('0x1f')](_0x475a0b[_0xa0f1('0x37')]['offset']);}_0x127efd[_0xa0f1('0x41')]=qs[_0xa0f1('0x42')](_0x475a0b[_0xa0f1('0x37')][_0xa0f1('0x42')]);_0x127efd[_0xa0f1('0x43')]=qs[_0xa0f1('0x39')](_[_0xa0f1('0x44')](_0x475a0b['query'],_0xa2930c[_0xa0f1('0x39')]),_0x428f3c);if(_0x475a0b[_0xa0f1('0x37')][_0xa0f1('0x45')]){_0x127efd[_0xa0f1('0x43')]=_[_0xa0f1('0x46')](_0x127efd['where'],{'$or':_[_0xa0f1('0x36')](_0x428f3c,function(_0x3e984d){if(_0x3e984d[_0xa0f1('0x32')]!=='VIRTUAL'){var _0xc188bf={};_0xc188bf[_0x3e984d[_0xa0f1('0x2d')]]={'$like':'%'+_0x475a0b[_0xa0f1('0x37')]['filter']+'%'};return _0xc188bf;}})});}_0x127efd=_[_0xa0f1('0x46')]({},_0x127efd,_0x475a0b[_0xa0f1('0x47')]);var _0x1330fe={'where':_0x127efd[_0xa0f1('0x43')]};return db[_0xa0f1('0x2f')][_0xa0f1('0x21')](_0x1330fe)[_0xa0f1('0x28')](function(_0x5593a5){_0x4e986d['count']=_0x5593a5;if(_0x475a0b[_0xa0f1('0x37')][_0xa0f1('0x48')]){_0x127efd[_0xa0f1('0x49')]=[{'all':!![]}];}return db[_0xa0f1('0x2f')][_0xa0f1('0x4a')](_0x127efd);})[_0xa0f1('0x28')](function(_0x44db47){_0x4e986d['rows']=_0x44db47;return _0x4e986d;})['then'](respondWithFilteredResult(_0x312e6d,_0x127efd))[_0xa0f1('0x4b')](handleError(_0x312e6d,null));};exports[_0xa0f1('0x4c')]=function(_0x15ae58,_0x2e4856){var _0x220870={'raw':!![],'where':{'id':_0x15ae58['params']['id']}},_0x53015e={};_0x53015e[_0xa0f1('0x34')]=_['keys'](db[_0xa0f1('0x2f')][_0xa0f1('0x30')]);_0x53015e[_0xa0f1('0x37')]=_[_0xa0f1('0x38')](_0x15ae58[_0xa0f1('0x37')]);_0x53015e[_0xa0f1('0x39')]=_[_0xa0f1('0x3a')](_0x53015e[_0xa0f1('0x34')],_0x53015e[_0xa0f1('0x37')]);_0x220870[_0xa0f1('0x3b')]=_[_0xa0f1('0x3a')](_0x53015e[_0xa0f1('0x34')],qs[_0xa0f1('0x3c')](_0x15ae58[_0xa0f1('0x37')][_0xa0f1('0x3c')]));_0x220870[_0xa0f1('0x3b')]=_0x220870[_0xa0f1('0x3b')][_0xa0f1('0x3d')]?_0x220870[_0xa0f1('0x3b')]:_0x53015e['model'];if(_0x15ae58['query']['includeAll']){_0x220870['include']=[{'all':!![]}];}_0x220870=_[_0xa0f1('0x46')]({},_0x220870,_0x15ae58['options']);return db[_0xa0f1('0x2f')]['find'](_0x220870)[_0xa0f1('0x28')](handleEntityNotFound(_0x2e4856,null))[_0xa0f1('0x28')](respondWithResult(_0x2e4856,null))[_0xa0f1('0x4b')](handleError(_0x2e4856,null));};exports[_0xa0f1('0x27')]=function(_0x25ef50,_0x4014a6){if(_0x25ef50[_0xa0f1('0x4d')]['id']){delete _0x25ef50[_0xa0f1('0x4d')]['id'];}return db[_0xa0f1('0x2f')][_0xa0f1('0x4e')]({'where':{'id':_0x25ef50[_0xa0f1('0x4f')]['id']}})[_0xa0f1('0x28')](handleEntityNotFound(_0x4014a6,null))[_0xa0f1('0x28')](saveUpdates(_0x25ef50['body'],null))[_0xa0f1('0x28')](respondWithResult(_0x4014a6,null))['catch'](handleError(_0x4014a6,null));};exports[_0xa0f1('0x29')]=function(_0x488e3e,_0x19b2f5){return db[_0xa0f1('0x2f')][_0xa0f1('0x4e')]({'where':{'id':_0x488e3e[_0xa0f1('0x4f')]['id']}})[_0xa0f1('0x28')](handleEntityNotFound(_0x19b2f5,null))[_0xa0f1('0x28')](removeEntity(_0x19b2f5,null))[_0xa0f1('0x4b')](handleError(_0x19b2f5,null));};exports['create']=function(_0x13808f,_0xe18f36){var _0x53a9eb;return db[_0xa0f1('0x50')]['transaction'](function(_0x4c684c){return db['CmCustomField'][_0xa0f1('0x51')](_0x13808f[_0xa0f1('0x4d')],{'transaction':_0x4c684c})['then'](function(_0x12a0a6){_0x53a9eb=_0x12a0a6;var _0x2aa471={'type':db[_0xa0f1('0x52')][_0xa0f1('0x53')],'transaction':_0x4c684c};switch(_0x13808f[_0xa0f1('0x4d')][_0xa0f1('0x32')]){case'text':_0x2aa471[_0xa0f1('0x32')]=db[_0xa0f1('0x52')][_0xa0f1('0x53')];break;case _0xa0f1('0x54'):_0x2aa471['type']=db[_0xa0f1('0x52')][_0xa0f1('0x55')];break;case'switch':_0x2aa471[_0xa0f1('0x32')]=db['Sequelize'][_0xa0f1('0x56')];_0x2aa471[_0xa0f1('0x57')]=![];break;default:}return db[_0xa0f1('0x50')][_0xa0f1('0x58')]['addColumn'](_0xa0f1('0x59'),util[_0xa0f1('0x5a')](_0xa0f1('0x5b'),_0x53a9eb['id']),_0x2aa471);})[_0xa0f1('0x28')](function(){return _0x53a9eb;});})['then'](respondWithResult(_0xe18f36,0xc9))[_0xa0f1('0x4b')](handleError(_0xe18f36,null));}; \ No newline at end of file +var _0x2561=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','CmCustomField','then','includeAll','rows','show','params','include','find','catch','body','create','sequelize','transaction','Sequelize','TEXT','number','INTEGER','defaultValue','queryInterface','addColumn','cm_contacts','format','cf_%d','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','filters','attributes','intersection'];(function(_0x376195,_0x401af2){var _0x5733ef=function(_0x512e97){while(--_0x512e97){_0x376195['push'](_0x376195['shift']());}};_0x5733ef(++_0x401af2);}(_0x2561,0x1f3));var _0x1256=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x2561[_0x2be8c2];return _0x97f531;};'use strict';var emlformat=require(_0x1256('0x0'));var rimraf=require(_0x1256('0x1'));var zipdir=require(_0x1256('0x2'));var jsonpatch=require(_0x1256('0x3'));var rp=require('request-promise');var moment=require(_0x1256('0x4'));var BPromise=require(_0x1256('0x5'));var Mustache=require(_0x1256('0x6'));var util=require(_0x1256('0x7'));var path=require(_0x1256('0x8'));var sox=require(_0x1256('0x9'));var csv=require('to-csv');var ejs=require(_0x1256('0xa'));var fs=require('fs');var fs_extra=require(_0x1256('0xb'));var _=require(_0x1256('0xc'));var squel=require('squel');var crypto=require(_0x1256('0xd'));var jsforce=require(_0x1256('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x1256('0xf'));var querystring=require(_0x1256('0x10'));var Papa=require(_0x1256('0x11'));var Redis=require(_0x1256('0x12'));var authService=require(_0x1256('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1256('0x14'));var hardwareService=require(_0x1256('0x15'));var logger=require(_0x1256('0x16'))(_0x1256('0x17'));var utils=require(_0x1256('0x18'));var config=require(_0x1256('0x19'));var licenseUtil=require(_0x1256('0x1a'));var db=require(_0x1256('0x1b'))['db'];function respondWithStatusCode(_0x1f731e,_0x433ae5){_0x433ae5=_0x433ae5||0xcc;return function(_0x8a2648){if(_0x8a2648){return _0x1f731e[_0x1256('0x1c')](_0x433ae5);}return _0x1f731e[_0x1256('0x1d')](_0x433ae5)[_0x1256('0x1e')]();};}function respondWithResult(_0x4ffe8b,_0x40aec9){_0x40aec9=_0x40aec9||0xc8;return function(_0x262e75){if(_0x262e75){return _0x4ffe8b[_0x1256('0x1d')](_0x40aec9)[_0x1256('0x1f')](_0x262e75);}};}function respondWithFilteredResult(_0x9c589a,_0x340388){return function(_0x15628f){if(_0x15628f){var _0x21cbd5=typeof _0x340388[_0x1256('0x20')]===_0x1256('0x21')&&typeof _0x340388[_0x1256('0x22')]==='undefined';var _0x384a61=_0x15628f[_0x1256('0x23')];var _0x2564aa=_0x21cbd5?0x0:_0x340388[_0x1256('0x20')];var _0x19f08a=_0x21cbd5?_0x15628f[_0x1256('0x23')]:_0x340388[_0x1256('0x20')]+_0x340388[_0x1256('0x22')];var _0x1be36c;if(_0x19f08a>=_0x384a61){_0x19f08a=_0x384a61;_0x1be36c=0xc8;}else{_0x1be36c=0xce;}_0x9c589a[_0x1256('0x1d')](_0x1be36c);return _0x9c589a[_0x1256('0x24')](_0x1256('0x25'),_0x2564aa+'-'+_0x19f08a+'/'+_0x384a61)[_0x1256('0x1f')](_0x15628f);}return null;};}function patchUpdates(_0x2173a4){return function(_0x3d0307){try{jsonpatch['apply'](_0x3d0307,_0x2173a4,!![]);}catch(_0xe25e2){return BPromise[_0x1256('0x26')](_0xe25e2);}return _0x3d0307[_0x1256('0x27')]();};}function saveUpdates(_0xfafbde,_0x3554c8){return function(_0x346025){if(_0x346025){return _0x346025[_0x1256('0x28')](_0xfafbde)['then'](function(_0x5bb11e){return _0x5bb11e;});}return null;};}function removeEntity(_0x34a857,_0x4caf3b){return function(_0x145f4d){if(_0x145f4d){return _0x145f4d[_0x1256('0x29')]()['then'](function(){_0x34a857[_0x1256('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3f420f,_0x39ee23){return function(_0x3cf71d){if(!_0x3cf71d){_0x3f420f[_0x1256('0x1c')](0x194);}return _0x3cf71d;};}function handleError(_0x1b6c98,_0x19af37){_0x19af37=_0x19af37||0x1f4;return function(_0x366ae8){logger[_0x1256('0x2a')](_0x366ae8[_0x1256('0x2b')]);if(_0x366ae8[_0x1256('0x2c')]){delete _0x366ae8[_0x1256('0x2c')];}_0x1b6c98[_0x1256('0x1d')](_0x19af37)[_0x1256('0x2d')](_0x366ae8);};}exports[_0x1256('0x2e')]=function(_0x1eccfb,_0x3a60d6){var _0x5bbe32={},_0x56ec08={},_0x2e8472={'count':0x0,'rows':[]};var _0x45f0d9=_['map'](db['CmCustomField'][_0x1256('0x2f')],function(_0x12823b){return{'name':_0x12823b[_0x1256('0x30')],'type':_0x12823b[_0x1256('0x31')][_0x1256('0x32')]};});_0x56ec08[_0x1256('0x33')]=_[_0x1256('0x34')](_[_0x1256('0x35')](_0x45f0d9,_0x1256('0x2c')),[_0x1256('0x2c')]);_0x56ec08[_0x1256('0x36')]=_[_0x1256('0x37')](_0x1eccfb[_0x1256('0x36')]);_0x56ec08[_0x1256('0x38')]=_['intersection'](_0x56ec08['model'],_0x56ec08[_0x1256('0x36')]);_0x5bbe32[_0x1256('0x39')]=_[_0x1256('0x3a')](_0x56ec08[_0x1256('0x33')],qs['fields'](_0x1eccfb[_0x1256('0x36')][_0x1256('0x3b')]));_0x5bbe32[_0x1256('0x39')]=_0x5bbe32[_0x1256('0x39')][_0x1256('0x3c')]?_0x5bbe32[_0x1256('0x39')]:_0x56ec08[_0x1256('0x33')];if(!_0x1eccfb[_0x1256('0x36')][_0x1256('0x3d')](_0x1256('0x3e'))){_0x5bbe32[_0x1256('0x22')]=qs[_0x1256('0x22')](_0x1eccfb[_0x1256('0x36')][_0x1256('0x22')]);_0x5bbe32['offset']=qs['offset'](_0x1eccfb['query'][_0x1256('0x20')]);}_0x5bbe32[_0x1256('0x3f')]=qs['sort'](_0x1eccfb['query'][_0x1256('0x40')]);_0x5bbe32[_0x1256('0x41')]=qs[_0x1256('0x38')](_[_0x1256('0x42')](_0x1eccfb['query'],_0x56ec08[_0x1256('0x38')]),_0x45f0d9);if(_0x1eccfb[_0x1256('0x36')][_0x1256('0x43')]){_0x5bbe32[_0x1256('0x41')]=_[_0x1256('0x44')](_0x5bbe32[_0x1256('0x41')],{'$or':_[_0x1256('0x35')](_0x45f0d9,function(_0x2d8056){if(_0x2d8056[_0x1256('0x31')]!=='VIRTUAL'){var _0x5506f7={};_0x5506f7[_0x2d8056[_0x1256('0x2c')]]={'$like':'%'+_0x1eccfb[_0x1256('0x36')][_0x1256('0x43')]+'%'};return _0x5506f7;}})});}_0x5bbe32=_[_0x1256('0x44')]({},_0x5bbe32,_0x1eccfb[_0x1256('0x45')]);var _0x284a58={'where':_0x5bbe32['where']};return db[_0x1256('0x46')][_0x1256('0x23')](_0x284a58)[_0x1256('0x47')](function(_0x4fb0bf){_0x2e8472[_0x1256('0x23')]=_0x4fb0bf;if(_0x1eccfb[_0x1256('0x36')][_0x1256('0x48')]){_0x5bbe32['include']=[{'all':!![]}];}return db['CmCustomField']['findAll'](_0x5bbe32);})[_0x1256('0x47')](function(_0x377eb9){_0x2e8472[_0x1256('0x49')]=_0x377eb9;return _0x2e8472;})[_0x1256('0x47')](respondWithFilteredResult(_0x3a60d6,_0x5bbe32))['catch'](handleError(_0x3a60d6,null));};exports[_0x1256('0x4a')]=function(_0x338e0f,_0x550358){var _0x18a0b6={'raw':!![],'where':{'id':_0x338e0f[_0x1256('0x4b')]['id']}},_0x542386={};_0x542386[_0x1256('0x33')]=_[_0x1256('0x37')](db['CmCustomField'][_0x1256('0x2f')]);_0x542386[_0x1256('0x36')]=_[_0x1256('0x37')](_0x338e0f[_0x1256('0x36')]);_0x542386[_0x1256('0x38')]=_[_0x1256('0x3a')](_0x542386[_0x1256('0x33')],_0x542386[_0x1256('0x36')]);_0x18a0b6[_0x1256('0x39')]=_[_0x1256('0x3a')](_0x542386[_0x1256('0x33')],qs[_0x1256('0x3b')](_0x338e0f[_0x1256('0x36')][_0x1256('0x3b')]));_0x18a0b6[_0x1256('0x39')]=_0x18a0b6[_0x1256('0x39')][_0x1256('0x3c')]?_0x18a0b6[_0x1256('0x39')]:_0x542386[_0x1256('0x33')];if(_0x338e0f[_0x1256('0x36')]['includeAll']){_0x18a0b6[_0x1256('0x4c')]=[{'all':!![]}];}_0x18a0b6=_['merge']({},_0x18a0b6,_0x338e0f[_0x1256('0x45')]);return db[_0x1256('0x46')][_0x1256('0x4d')](_0x18a0b6)[_0x1256('0x47')](handleEntityNotFound(_0x550358,null))[_0x1256('0x47')](respondWithResult(_0x550358,null))[_0x1256('0x4e')](handleError(_0x550358,null));};exports[_0x1256('0x28')]=function(_0x27f556,_0x482665){if(_0x27f556[_0x1256('0x4f')]['id']){delete _0x27f556['body']['id'];}return db['CmCustomField'][_0x1256('0x4d')]({'where':{'id':_0x27f556[_0x1256('0x4b')]['id']}})[_0x1256('0x47')](handleEntityNotFound(_0x482665,null))[_0x1256('0x47')](saveUpdates(_0x27f556['body'],null))[_0x1256('0x47')](respondWithResult(_0x482665,null))[_0x1256('0x4e')](handleError(_0x482665,null));};exports[_0x1256('0x29')]=function(_0x20ebfd,_0x34fe3e){return db[_0x1256('0x46')]['find']({'where':{'id':_0x20ebfd[_0x1256('0x4b')]['id']}})[_0x1256('0x47')](handleEntityNotFound(_0x34fe3e,null))['then'](removeEntity(_0x34fe3e,null))[_0x1256('0x4e')](handleError(_0x34fe3e,null));};exports[_0x1256('0x50')]=function(_0x19d3f2,_0x3faa71){var _0x3fa381;return db[_0x1256('0x51')][_0x1256('0x52')](function(_0x48e64a){return db[_0x1256('0x46')][_0x1256('0x50')](_0x19d3f2[_0x1256('0x4f')],{'transaction':_0x48e64a})['then'](function(_0xa23624){_0x3fa381=_0xa23624;var _0x2c1a4a={'type':db[_0x1256('0x53')]['TEXT'],'transaction':_0x48e64a};switch(_0x19d3f2['body'][_0x1256('0x31')]){case'text':_0x2c1a4a[_0x1256('0x31')]=db['Sequelize'][_0x1256('0x54')];break;case _0x1256('0x55'):_0x2c1a4a[_0x1256('0x31')]=db['Sequelize'][_0x1256('0x56')];break;case'switch':_0x2c1a4a['type']=db[_0x1256('0x53')]['BOOLEAN'];_0x2c1a4a[_0x1256('0x57')]=![];break;default:}return db[_0x1256('0x51')][_0x1256('0x58')][_0x1256('0x59')](_0x1256('0x5a'),util[_0x1256('0x5b')](_0x1256('0x5c'),_0x3fa381['id']),_0x2c1a4a);})[_0x1256('0x47')](function(){return _0x3fa381;});})[_0x1256('0x47')](respondWithResult(_0x3faa71,0xc9))[_0x1256('0x4e')](handleError(_0x3faa71,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index fd0644d..f7b055c 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 _0xe192=['cm_custom_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmCustomField.attributes','define','CmCustomField'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xe192,0xeb));var _0x2e19=function(_0x41e570,_0x4145f2){_0x41e570=_0x41e570-0x0;var _0x4720ce=_0xe192[_0x41e570];return _0x4720ce;};'use strict';var _=require(_0x2e19('0x0'));var util=require(_0x2e19('0x1'));var logger=require(_0x2e19('0x2'))('api');var moment=require(_0x2e19('0x3'));var BPromise=require(_0x2e19('0x4'));var rp=require(_0x2e19('0x5'));var fs=require('fs');var path=require(_0x2e19('0x6'));var rimraf=require(_0x2e19('0x7'));var config=require(_0x2e19('0x8'));var attributes=require(_0x2e19('0x9'));module['exports']=function(_0x283750,_0x26b326){return _0x283750[_0x2e19('0xa')](_0x2e19('0xb'),attributes,{'tableName':_0x2e19('0xc'),'paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7e15=['define','cm_custom_fields','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x11f73e,_0x3a686d){var _0x30bea9=function(_0x8013bd){while(--_0x8013bd){_0x11f73e['push'](_0x11f73e['shift']());}};_0x30bea9(++_0x3a686d);}(_0x7e15,0x1c4));var _0x57e1=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7e15[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x57e1('0x0'));var util=require(_0x57e1('0x1'));var logger=require(_0x57e1('0x2'))(_0x57e1('0x3'));var moment=require(_0x57e1('0x4'));var BPromise=require(_0x57e1('0x5'));var rp=require(_0x57e1('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x57e1('0x7'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x39b805,_0x229f72){return _0x39b805[_0x57e1('0x8')]('CmCustomField',attributes,{'tableName':_0x57e1('0x9'),'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 ba86aed..732b27c 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 _0xcee5=['rpc','../../config/environment','jayson/promise','client','http','request','info','CmCustomField,\x20%s,\x20%s','request\x20sent','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0x231b71,_0x53f4b7){var _0x68bd0f=function(_0xfcfb99){while(--_0xfcfb99){_0x231b71['push'](_0x231b71['shift']());}};_0x68bd0f(++_0x53f4b7);}(_0xcee5,0x1de));var _0x5cee=function(_0x5bfeac,_0x15f5e5){_0x5bfeac=_0x5bfeac-0x0;var _0x4be1d3=_0xcee5[_0x5bfeac];return _0x4be1d3;};'use strict';var _=require('lodash');var util=require(_0x5cee('0x0'));var moment=require('moment');var BPromise=require(_0x5cee('0x1'));var rs=require(_0x5cee('0x2'));var fs=require('fs');var Redis=require(_0x5cee('0x3'));var db=require(_0x5cee('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x5cee('0x5'))(_0x5cee('0x6'));var config=require(_0x5cee('0x7'));var jayson=require(_0x5cee('0x8'));var client=jayson[_0x5cee('0x9')][_0x5cee('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3fe04c,_0x59a6d1,_0x36f04e){return new BPromise(function(_0x2c5e03,_0x101452){return client[_0x5cee('0xb')](_0x3fe04c,_0x36f04e)['then'](function(_0x2cf95b){logger[_0x5cee('0xc')](_0x5cee('0xd'),_0x59a6d1,_0x5cee('0xe'));logger['debug'](_0x5cee('0xf'),_0x59a6d1,_0x5cee('0xe'),JSON[_0x5cee('0x10')](_0x2cf95b));if(_0x2cf95b[_0x5cee('0x11')]){if(_0x2cf95b[_0x5cee('0x11')][_0x5cee('0x12')]===0x1f4){logger['error']('CmCustomField,\x20%s,\x20%s',_0x59a6d1,_0x2cf95b['error'][_0x5cee('0x13')]);return _0x101452(_0x2cf95b[_0x5cee('0x11')][_0x5cee('0x13')]);}logger['error'](_0x5cee('0xd'),_0x59a6d1,_0x2cf95b[_0x5cee('0x11')][_0x5cee('0x13')]);return _0x2c5e03(_0x2cf95b[_0x5cee('0x11')][_0x5cee('0x13')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x59a6d1,_0x5cee('0xe'));_0x2c5e03(_0x2cf95b[_0x5cee('0x14')][_0x5cee('0x13')]);}})[_0x5cee('0x15')](function(_0x567080){logger[_0x5cee('0x11')](_0x5cee('0xd'),_0x59a6d1,_0x567080);_0x101452(_0x567080);});});} \ No newline at end of file +var _0x705b=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x705b,0xaf));var _0xb705=function(_0x52c4b4,_0x48278b){_0x52c4b4=_0x52c4b4-0x0;var _0x12be5b=_0x705b[_0x52c4b4];return _0x12be5b;};'use strict';var _=require('lodash');var util=require(_0xb705('0x0'));var moment=require(_0xb705('0x1'));var BPromise=require(_0xb705('0x2'));var rs=require(_0xb705('0x3'));var fs=require('fs');var Redis=require(_0xb705('0x4'));var db=require(_0xb705('0x5'))['db'];var utils=require(_0xb705('0x6'));var logger=require('../../config/logger')(_0xb705('0x7'));var config=require(_0xb705('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb705('0x9')][_0xb705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x428cc5,_0x16e5f9,_0x2007d2){return new BPromise(function(_0x4d4f10,_0x1f0b46){return client[_0xb705('0xb')](_0x428cc5,_0x2007d2)[_0xb705('0xc')](function(_0x4832f8){logger[_0xb705('0xd')](_0xb705('0xe'),_0x16e5f9,_0xb705('0xf'));logger[_0xb705('0x10')](_0xb705('0x11'),_0x16e5f9,_0xb705('0xf'),JSON[_0xb705('0x12')](_0x4832f8));if(_0x4832f8[_0xb705('0x13')]){if(_0x4832f8[_0xb705('0x13')]['code']===0x1f4){logger[_0xb705('0x13')](_0xb705('0xe'),_0x16e5f9,_0x4832f8['error']['message']);return _0x1f0b46(_0x4832f8[_0xb705('0x13')][_0xb705('0x14')]);}logger[_0xb705('0x13')](_0xb705('0xe'),_0x16e5f9,_0x4832f8[_0xb705('0x13')][_0xb705('0x14')]);return _0x4d4f10(_0x4832f8[_0xb705('0x13')]['message']);}else{logger[_0xb705('0xd')](_0xb705('0xe'),_0x16e5f9,'request\x20sent');_0x4d4f10(_0x4832f8['result'][_0xb705('0x14')]);}})[_0xb705('0x15')](function(_0xd8ab17){logger[_0xb705('0x13')]('CmCustomField,\x20%s,\x20%s',_0x16e5f9,_0xd8ab17);_0x1f0b46(_0xd8ab17);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index bcd885c..2735cdc 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 _0x99fb=['../../config/environment','get','isAuthenticated','index','/:id','show','create','update','delete','destroy','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x7e081d,_0x2c2971){var _0x41b0d3=function(_0x278ae4){while(--_0x278ae4){_0x7e081d['push'](_0x7e081d['shift']());}};_0x41b0d3(++_0x2c2971);}(_0x99fb,0x92));var _0xb99f=function(_0x56ff26,_0xe940ea){_0x56ff26=_0x56ff26-0x0;var _0x1dc496=_0x99fb[_0x56ff26];return _0x1dc496;};'use strict';var multer=require(_0xb99f('0x0'));var util=require('util');var path=require(_0xb99f('0x1'));var timeout=require(_0xb99f('0x2'));var express=require(_0xb99f('0x3'));var router=express[_0xb99f('0x4')]();var fs_extra=require(_0xb99f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb99f('0x6'));var config=require(_0xb99f('0x7'));var controller=require('./cmCustomField.controller');router[_0xb99f('0x8')]('/',auth[_0xb99f('0x9')](),controller[_0xb99f('0xa')]);router['get'](_0xb99f('0xb'),auth['isAuthenticated'](),controller[_0xb99f('0xc')]);router['post']('/',auth[_0xb99f('0x9')](),controller[_0xb99f('0xd')]);router['put'](_0xb99f('0xb'),auth[_0xb99f('0x9')](),controller[_0xb99f('0xe')]);router[_0xb99f('0xf')](_0xb99f('0xb'),auth[_0xb99f('0x9')](),controller[_0xb99f('0x10')]);module['exports']=router; \ No newline at end of file +var _0x6c21=['../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x19dd7a,_0x51de21){var _0x3feb6a=function(_0x4a3c84){while(--_0x4a3c84){_0x19dd7a['push'](_0x19dd7a['shift']());}};_0x3feb6a(++_0x51de21);}(_0x6c21,0x1b2));var _0x16c2=function(_0x3f43fa,_0x1ccd65){_0x3f43fa=_0x3f43fa-0x0;var _0x3cf4bb=_0x6c21[_0x3f43fa];return _0x3cf4bb;};'use strict';var multer=require(_0x16c2('0x0'));var util=require(_0x16c2('0x1'));var path=require(_0x16c2('0x2'));var timeout=require(_0x16c2('0x3'));var express=require('express');var router=express[_0x16c2('0x4')]();var fs_extra=require(_0x16c2('0x5'));var auth=require(_0x16c2('0x6'));var interaction=require(_0x16c2('0x7'));var config=require(_0x16c2('0x8'));var controller=require('./cmCustomField.controller');router[_0x16c2('0x9')]('/',auth[_0x16c2('0xa')](),controller[_0x16c2('0xb')]);router[_0x16c2('0x9')](_0x16c2('0xc'),auth[_0x16c2('0xa')](),controller[_0x16c2('0xd')]);router[_0x16c2('0xe')]('/',auth[_0x16c2('0xa')](),controller[_0x16c2('0xf')]);router[_0x16c2('0x10')](_0x16c2('0xc'),auth['isAuthenticated'](),controller[_0x16c2('0x11')]);router[_0x16c2('0x12')]('/:id',auth[_0x16c2('0xa')](),controller[_0x16c2('0x13')]);module[_0x16c2('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index 3bf6ed2..5f3fd36 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 _0xa518=['moment','sequelize','exports','STRING','BOOLEAN','DATE','format','INTEGER','UNSIGNED','contactListQueue'];(function(_0x4fd750,_0x3bf5b9){var _0x434551=function(_0x1b105f){while(--_0x1b105f){_0x4fd750['push'](_0x4fd750['shift']());}};_0x434551(++_0x3bf5b9);}(_0xa518,0xd2));var _0x8a51=function(_0x3feb8a,_0x47c784){_0x3feb8a=_0x3feb8a-0x0;var _0x4523ca=_0xa518[_0x3feb8a];return _0x4523ca;};'use strict';var moment=require(_0x8a51('0x0'));var Sequelize=require(_0x8a51('0x1'));module[_0x8a51('0x2')]={'phone':{'type':Sequelize[_0x8a51('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0x8a51('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0x8a51('0x5')],'defaultValue':moment()[_0x8a51('0x6')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x8a51('0x7')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8a51('0x7')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8a51('0x7')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8a51('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8a51('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8a51('0x5')]},'priority':{'type':Sequelize[_0x8a51('0x7')](0x2)[_0x8a51('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8a51('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize[_0x8a51('0x7')],'unique':_0x8a51('0x9')},'ListId':{'type':Sequelize[_0x8a51('0x7')],'unique':_0x8a51('0x9')},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0x8a51('0x7')],'unique':_0x8a51('0x9')},'CampaignId':{'type':Sequelize[_0x8a51('0x7')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8a51('0x7')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8a51('0x7')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xebb8=['sequelize','STRING','BOOLEAN','format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','DATE','UNSIGNED','contactListQueue','moment'];(function(_0x38f432,_0x16c9b7){var _0x4d703e=function(_0x1c1c4d){while(--_0x1c1c4d){_0x38f432['push'](_0x38f432['shift']());}};_0x4d703e(++_0x16c9b7);}(_0xebb8,0x13f));var _0x8ebb=function(_0x4bd8ef,_0x4bf8be){_0x4bd8ef=_0x4bd8ef-0x0;var _0x1e4a92=_0xebb8[_0x4bd8ef];return _0x1e4a92;};'use strict';var moment=require(_0x8ebb('0x0'));var Sequelize=require(_0x8ebb('0x1'));module['exports']={'phone':{'type':Sequelize[_0x8ebb('0x2')],'allowNull':![]},'active':{'type':Sequelize[_0x8ebb('0x3')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x8ebb('0x4')](_0x8ebb('0x5'))},'countbusyretry':{'type':Sequelize[_0x8ebb('0x6')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8ebb('0x6')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8ebb('0x3')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8ebb('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8ebb('0x7')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8ebb('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8ebb('0x3')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x8ebb('0x6')],'unique':_0x8ebb('0x9')},'UserId':{'type':Sequelize[_0x8ebb('0x6')]},'VoiceQueueId':{'type':Sequelize[_0x8ebb('0x6')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize['INTEGER']},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8ebb('0x6')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 6cb8ac4..e91268d 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 _0x6036=['Campaign','omit','dataValues','createdAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','calleridnum','phone','campaigntype','queue','CmContact','ContactId','lastName','isNil','firstName','calleridname','CmHopperFinal','getPreview','outbound','preview','dialOrderByScheduledAt','format','direction','prev','isEmpty','hopperIds','priority','ASC','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','scheduledAt','findOne','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','CmList','List','VoiceQueue','Queue','getOpenContacts','getVoiceQueues','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','save','update','then','destroy','end','stack','name','send','CmHopper','rawAttributes','fieldName','type','model','query','filters','intersection','concat','$and','$or','$gt','$lt','$lte','$ne','$eq','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contained','$any','attributes','fields','nolimit','order','sort','where','pick','merge','map','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','keys','length','include','find','create','body','describe','VoiceQueueId','CampaignId'];(function(_0x10e872,_0x14c5ea){var _0x376afb=function(_0x441f4a){while(--_0x441f4a){_0x10e872['push'](_0x10e872['shift']());}};_0x376afb(++_0x14c5ea);}(_0x6036,0xc6));var _0x6603=function(_0x459148,_0x38d912){_0x459148=_0x459148-0x0;var _0x2f4765=_0x6036[_0x459148];return _0x2f4765;};'use strict';var emlformat=require(_0x6603('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6603('0x1'));var jsonpatch=require(_0x6603('0x2'));var rp=require(_0x6603('0x3'));var moment=require(_0x6603('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6603('0x5'));var util=require('util');var path=require(_0x6603('0x6'));var sox=require(_0x6603('0x7'));var csv=require(_0x6603('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6603('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6603('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6603('0x8'));var querystring=require(_0x6603('0xb'));var Papa=require(_0x6603('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x6603('0xd'));var as=require(_0x6603('0xe'));var hardwareService=require(_0x6603('0xf'));var logger=require(_0x6603('0x10'))(_0x6603('0x11'));var utils=require(_0x6603('0x12'));var config=require(_0x6603('0x13'));var licenseUtil=require(_0x6603('0x14'));var db=require(_0x6603('0x15'))['db'];function respondWithStatusCode(_0x3acbda,_0x680e64){_0x680e64=_0x680e64||0xcc;return function(_0x4b1b31){if(_0x4b1b31){return _0x3acbda[_0x6603('0x16')](_0x680e64);}return _0x3acbda[_0x6603('0x17')](_0x680e64)['end']();};}function respondWithResult(_0x2cb1c2,_0x4d077f){_0x4d077f=_0x4d077f||0xc8;return function(_0x4260d1){if(_0x4260d1){return _0x2cb1c2[_0x6603('0x17')](_0x4d077f)[_0x6603('0x18')](_0x4260d1);}};}function respondWithFilteredResult(_0x47ac21,_0x5c3d06){return function(_0x25012d){if(_0x25012d){var _0x502994=typeof _0x5c3d06[_0x6603('0x19')]===_0x6603('0x1a')&&typeof _0x5c3d06[_0x6603('0x1b')]===_0x6603('0x1a');var _0x172fa5=_0x25012d['count'];var _0x239290=_0x502994?0x0:_0x5c3d06[_0x6603('0x19')];var _0xd769c3=_0x502994?_0x25012d[_0x6603('0x1c')]:_0x5c3d06['offset']+_0x5c3d06[_0x6603('0x1b')];var _0x376db4;if(_0xd769c3>=_0x172fa5){_0xd769c3=_0x172fa5;_0x376db4=0xc8;}else{_0x376db4=0xce;}_0x47ac21[_0x6603('0x17')](_0x376db4);return _0x47ac21['set'](_0x6603('0x1d'),_0x239290+'-'+_0xd769c3+'/'+_0x172fa5)[_0x6603('0x18')](_0x25012d);}return null;};}function patchUpdates(_0x131518){return function(_0x22fe9d){try{jsonpatch['apply'](_0x22fe9d,_0x131518,!![]);}catch(_0x57ab4b){return BPromise['reject'](_0x57ab4b);}return _0x22fe9d[_0x6603('0x1e')]();};}function saveUpdates(_0x18358f,_0x559014){return function(_0x38304b){if(_0x38304b){return _0x38304b[_0x6603('0x1f')](_0x18358f)[_0x6603('0x20')](function(_0x345b08){return _0x345b08;});}return null;};}function removeEntity(_0x2ad31d,_0x45e1bb){return function(_0x6663d0){if(_0x6663d0){return _0x6663d0[_0x6603('0x21')]()[_0x6603('0x20')](function(){_0x2ad31d['status'](0xcc)[_0x6603('0x22')]();});}};}function handleEntityNotFound(_0x48f3ca,_0x371042){return function(_0x400b2a){if(!_0x400b2a){_0x48f3ca['sendStatus'](0x194);}return _0x400b2a;};}function handleError(_0x2421e6,_0x1d5aa5){_0x1d5aa5=_0x1d5aa5||0x1f4;return function(_0x557e9c){logger['error'](_0x557e9c[_0x6603('0x23')]);if(_0x557e9c[_0x6603('0x24')]){delete _0x557e9c[_0x6603('0x24')];}_0x2421e6[_0x6603('0x17')](_0x1d5aa5)[_0x6603('0x25')](_0x557e9c);};}exports['index']=function(_0x557567,_0x488eb7){var _0x2f085b={},_0x17450b={},_0x2b7999={'count':0x0,'rows':[]};var _0x3b3c52=_['map'](db[_0x6603('0x26')][_0x6603('0x27')],function(_0x1b18bf){return{'name':_0x1b18bf[_0x6603('0x28')],'type':_0x1b18bf[_0x6603('0x29')]['key']};});_0x17450b[_0x6603('0x2a')]=_['map'](_0x3b3c52,_0x6603('0x24'));_0x17450b['query']=_['keys'](_0x557567[_0x6603('0x2b')]);_0x17450b[_0x6603('0x2c')]=_[_0x6603('0x2d')](_0x17450b[_0x6603('0x2a')],_0x17450b[_0x6603('0x2b')]);_0x17450b[_0x6603('0x2c')]=_[_0x6603('0x2e')](_0x17450b[_0x6603('0x2c')],[_0x6603('0x2f'),_0x6603('0x30'),_0x6603('0x31'),'$gte',_0x6603('0x32'),_0x6603('0x33'),_0x6603('0x34'),_0x6603('0x35'),'$not','$between',_0x6603('0x36'),_0x6603('0x37'),_0x6603('0x38'),_0x6603('0x39'),_0x6603('0x3a'),_0x6603('0x3b'),_0x6603('0x3c'),_0x6603('0x39'),_0x6603('0x3d'),'$contains',_0x6603('0x3e'),_0x6603('0x3f')]);_0x2f085b[_0x6603('0x40')]=_['intersection'](_0x17450b[_0x6603('0x2a')],qs['fields'](_0x557567['query'][_0x6603('0x41')]));_0x2f085b[_0x6603('0x40')]=_0x2f085b[_0x6603('0x40')]['length']?_0x2f085b[_0x6603('0x40')]:_0x17450b['model'];if(!_0x557567[_0x6603('0x2b')]['hasOwnProperty'](_0x6603('0x42'))){_0x2f085b[_0x6603('0x1b')]=qs[_0x6603('0x1b')](_0x557567['query'][_0x6603('0x1b')]);_0x2f085b[_0x6603('0x19')]=qs[_0x6603('0x19')](_0x557567[_0x6603('0x2b')]['offset']);}_0x2f085b[_0x6603('0x43')]=qs[_0x6603('0x44')](_0x557567[_0x6603('0x2b')][_0x6603('0x44')]);_0x2f085b[_0x6603('0x45')]=qs[_0x6603('0x2c')](_[_0x6603('0x46')](_0x557567[_0x6603('0x2b')],_0x17450b['filters']),_0x3b3c52);if(_0x557567[_0x6603('0x2b')]['filter']){_0x2f085b[_0x6603('0x45')]=_[_0x6603('0x47')](_0x2f085b[_0x6603('0x45')],{'$or':_[_0x6603('0x48')](_0x3b3c52,function(_0x95e826){if(_0x95e826[_0x6603('0x29')]!==_0x6603('0x49')){var _0x37eb4e={};_0x37eb4e[_0x95e826[_0x6603('0x24')]]={'$like':'%'+_0x557567[_0x6603('0x2b')][_0x6603('0x4a')]+'%'};return _0x37eb4e;}})});}_0x2f085b=_[_0x6603('0x47')]({},_0x2f085b,_0x557567['options']);var _0x148343={'where':_0x2f085b['where']};return db[_0x6603('0x26')]['count'](_0x148343)[_0x6603('0x20')](function(_0x1181ce){_0x2b7999[_0x6603('0x1c')]=_0x1181ce;if(_0x557567[_0x6603('0x2b')][_0x6603('0x4b')]){_0x2f085b['include']=[{'all':!![]}];}return db['CmHopper'][_0x6603('0x4c')](_0x2f085b);})[_0x6603('0x20')](function(_0x52b063){_0x2b7999[_0x6603('0x4d')]=_0x52b063;return _0x2b7999;})[_0x6603('0x20')](respondWithFilteredResult(_0x488eb7,_0x2f085b))[_0x6603('0x4e')](handleError(_0x488eb7,null));};exports[_0x6603('0x4f')]=function(_0x3e219c,_0x15e095){var _0x51f8e={'raw':!![],'where':{'id':_0x3e219c[_0x6603('0x50')]['id']}},_0x24f81b={};_0x24f81b[_0x6603('0x2a')]=_[_0x6603('0x51')](db[_0x6603('0x26')][_0x6603('0x27')]);_0x24f81b[_0x6603('0x2b')]=_[_0x6603('0x51')](_0x3e219c[_0x6603('0x2b')]);_0x24f81b[_0x6603('0x2c')]=_[_0x6603('0x2d')](_0x24f81b[_0x6603('0x2a')],_0x24f81b[_0x6603('0x2b')]);_0x51f8e[_0x6603('0x40')]=_[_0x6603('0x2d')](_0x24f81b['model'],qs['fields'](_0x3e219c[_0x6603('0x2b')]['fields']));_0x51f8e[_0x6603('0x40')]=_0x51f8e['attributes'][_0x6603('0x52')]?_0x51f8e[_0x6603('0x40')]:_0x24f81b[_0x6603('0x2a')];if(_0x3e219c[_0x6603('0x2b')][_0x6603('0x4b')]){_0x51f8e[_0x6603('0x53')]=[{'all':!![]}];}_0x51f8e=_[_0x6603('0x47')]({},_0x51f8e,_0x3e219c['options']);return db['CmHopper'][_0x6603('0x54')](_0x51f8e)[_0x6603('0x20')](handleEntityNotFound(_0x15e095,null))[_0x6603('0x20')](respondWithResult(_0x15e095,null))['catch'](handleError(_0x15e095,null));};exports[_0x6603('0x55')]=function(_0x5a128b,_0xba9453){return db[_0x6603('0x26')]['create'](_0x5a128b[_0x6603('0x56')],{})[_0x6603('0x20')](respondWithResult(_0xba9453,0xc9))[_0x6603('0x4e')](handleError(_0xba9453,null));};exports[_0x6603('0x1f')]=function(_0xe24da7,_0x3de18a){if(_0xe24da7[_0x6603('0x56')]['id']){delete _0xe24da7[_0x6603('0x56')]['id'];}return db['CmHopper'][_0x6603('0x54')]({'where':{'id':_0xe24da7[_0x6603('0x50')]['id']}})['then'](handleEntityNotFound(_0x3de18a,null))['then'](saveUpdates(_0xe24da7[_0x6603('0x56')],null))[_0x6603('0x20')](respondWithResult(_0x3de18a,null))[_0x6603('0x4e')](handleError(_0x3de18a,null));};exports[_0x6603('0x57')]=function(_0x1924b4,_0x3b5ef8){return db[_0x6603('0x26')]['describe']()[_0x6603('0x20')](respondWithResult(_0x3b5ef8,null))[_0x6603('0x4e')](handleError(_0x3b5ef8,null));};exports[_0x6603('0x21')]=function(_0x360e31,_0x3bc237){var _0x30b703;return db[_0x6603('0x26')]['find']({'where':{'id':_0x360e31[_0x6603('0x50')]['id']}})[_0x6603('0x20')](handleEntityNotFound(_0x3bc237,null))[_0x6603('0x20')](function(_0x1f51c1){if(_0x1f51c1){return _0x1f51c1[_0x6603('0x21')]()[_0x6603('0x20')](function(_0x488ec0){return _0x488ec0;});}})[_0x6603('0x20')](function(_0x1d2306){_0x30b703=_0x1d2306;if(_0x1d2306){if(_0x1d2306[_0x6603('0x58')]||_0x1d2306[_0x6603('0x59')]){return db[_0x1d2306[_0x6603('0x58')]?'VoiceQueue':_0x6603('0x5a')][_0x6603('0x54')]({'where':{'id':_0x1d2306[_0x6603('0x58')]?_0x1d2306[_0x6603('0x58')]:_0x1d2306['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})['then'](function(_0x15620f){var _0x280f68={};if(_0x15620f){_[_0x6603('0x47')](_0x280f68,_[_0x6603('0x5b')](_0x30b703[_0x6603('0x5c')],[_0x6603('0x5d'),'updatedAt','id']));_0x280f68['state']=0x15;_0x280f68[_0x6603('0x5e')]=_0x6603('0x5f');_0x280f68[_0x6603('0x60')]=_0x15620f[_0x6603('0x24')];_0x280f68[_0x6603('0x61')]=_0x360e31[_0x6603('0x62')][_0x6603('0x24')];_0x280f68[_0x6603('0x63')]=_0x360e31[_0x6603('0x62')]['id'];_0x280f68['deleted']=!![];_0x280f68[_0x6603('0x64')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x280f68[_0x6603('0x65')]=_0x30b703[_0x6603('0x66')];_0x280f68[_0x6603('0x67')]=_0x30b703[_0x6603('0x58')]?_0x6603('0x68'):'ivr';return db[_0x6603('0x69')]['find']({'where':{'id':_0x280f68[_0x6603('0x6a')]},'attributes':['firstName',_0x6603('0x6b')]})[_0x6603('0x20')](function(_0x148c2f){if(!_[_0x6603('0x6c')](_0x3bc237)&&!_[_0x6603('0x6c')](_0x148c2f[_0x6603('0x6d')])){_0x280f68[_0x6603('0x6e')]=_0x148c2f[_0x6603('0x6d')];if(!_[_0x6603('0x6c')](_0x148c2f[_0x6603('0x6b')])){_0x280f68[_0x6603('0x6e')]+='\x20'+_0x148c2f[_0x6603('0x6b')];}}})['finally'](function(){return db[_0x6603('0x6f')][_0x6603('0x55')](_0x280f68);});}})[_0x6603('0x20')](function(){return _0x3bc237[_0x6603('0x17')](0xcc)[_0x6603('0x22')]();})[_0x6603('0x4e')](handleError(_0x3bc237,null));};exports[_0x6603('0x70')]=function(_0x2dd211,_0x537969,_0x1b73f1){var _0x2f4442=[];return db[_0x6603('0x69')][_0x6603('0x57')]()[_0x6603('0x20')](function(_0x1850e7){_0x2f4442=_['keys'](_0x1850e7);return _0x2dd211[_0x6603('0x62')]['getVoiceQueues']({'where':{'type':_0x6603('0x71'),'dialActive':!![],'dialMethod':_0x6603('0x72')},'attributes':['id',_0x6603('0x73')],'raw':!![]});})[_0x6603('0x20')](function(_0x166efb){if(_0x166efb&&_0x166efb[_0x6603('0x52')]){return db['sequelize']['transaction'](function(_0x353865){var _0x40f9ff={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x6603('0x74')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x6603('0x48')](_0x166efb,'id')},'$or':[{'UserId':null},{'UserId':_0x2dd211['user']['id']}]};var _0x1b36a7=[];if(_0x2dd211['body'][_0x6603('0x75')]&&_0x2dd211[_0x6603('0x56')][_0x6603('0x75')]===_0x6603('0x76')){if(!_[_0x6603('0x77')](_0x2dd211[_0x6603('0x56')][_0x6603('0x78')])){_0x40f9ff['id']={'$in':_0x2dd211[_0x6603('0x56')][_0x6603('0x78')]};}_0x1b36a7=[[_0x6603('0x79'),_0x6603('0x7a')],['scheduledAt',_0x166efb[0x0][_0x6603('0x73')]===_0x6603('0x7a')?'DESC':'ASC'],db[_0x6603('0x7b')][_0x6603('0x7c')](_0x6603('0x7d')),['id','DESC']];}else{if(!_['isEmpty'](_0x2dd211[_0x6603('0x56')][_0x6603('0x78')])){_0x40f9ff['id']={'$notIn':_0x2dd211[_0x6603('0x56')]['hopperIds']};}_0x1b36a7=[[_0x6603('0x79'),'DESC'],[_0x6603('0x7e'),_0x166efb[0x0][_0x6603('0x73')]],db[_0x6603('0x7b')][_0x6603('0x7c')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x6603('0x7a')]];}return db[_0x6603('0x26')][_0x6603('0x7f')]({'attributes':['id',_0x6603('0x80')],'where':_0x40f9ff,'order':_0x1b36a7,'transaction':_0x353865,'lock':_0x353865[_0x6603('0x81')][_0x6603('0x82')],'include':[{'model':db[_0x6603('0x69')],'as':_0x6603('0x83'),'attributes':_0x2f4442,'include':[{'model':db[_0x6603('0x84')],'as':_0x6603('0x85'),'attributes':['id','name']}]},{'model':db[_0x6603('0x86')],'as':_0x6603('0x87'),'attributes':['id',_0x6603('0x24')]},{'model':db[_0x6603('0x88')],'as':_0x6603('0x89'),'attributes':['id','name','dialActive']}]})[_0x6603('0x20')](function(_0x48699b){if(_0x48699b){return _0x48699b['update']({'UserId':_0x2dd211[_0x6603('0x62')]['id']},{'transaction':_0x353865});}});});}})[_0x6603('0x20')](handleEntityNotFound(_0x537969,null))[_0x6603('0x20')](respondWithResult(_0x537969,null))[_0x6603('0x4e')](handleError(_0x537969,null));};exports[_0x6603('0x8a')]=function(_0x3df0fa,_0x1b42ba,_0x575efa){return _0x3df0fa[_0x6603('0x62')][_0x6603('0x8b')]({'where':{'type':_0x6603('0x71'),'dialActive':!![],'dialMethod':_0x6603('0x72')},'attributes':['id'],'raw':!![]})['then'](function(_0x17cf8c){if(_0x17cf8c&&_0x17cf8c[_0x6603('0x52')]){return db[_0x6603('0x26')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_[_0x6603('0x48')](_0x17cf8c,'id')},'$or':[{'UserId':null},{'UserId':_0x3df0fa[_0x6603('0x62')]['id']}]}});}return 0x0;})[_0x6603('0x20')](function(_0x4cfca9){if(!_[_0x6603('0x6c')](_0x4cfca9)&&_[_0x6603('0x8c')](_0x4cfca9)){return _0x1b42ba[_0x6603('0x17')](0xc8)['json']({'contacts':_0x4cfca9});}else{logger[_0x6603('0x8d')](_0x6603('0x8e'),_0x6603('0x8a'),0x194,_0x6603('0x8f'));_0x1b42ba[_0x6603('0x16')](0x194);}})[_0x6603('0x4e')](handleError(_0x1b42ba,null));}; \ No newline at end of file +var _0xc081=['crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','reject','save','update','then','destroy','stack','name','send','index','CmHopper','rawAttributes','fieldName','type','key','model','map','query','filters','$and','$or','$gt','$gte','$lt','$lte','$ne','$eq','$not','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$any','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','includeAll','include','findAll','rows','catch','params','intersection','length','options','find','create','body','describe','VoiceQueueId','VoiceQueue','CampaignId','merge','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','campaigntype','queue','CmContact','ContactId','firstName','lastName','isNil','calleridname','finally','CmHopperFinal','getPreview','getVoiceQueues','outbound','preview','dialOrderByScheduledAt','transaction','direction','prev','hopperIds','priority','ASC','scheduledAt','sequelize','literal','COALESCE(CmHopper.UserId,\x200)\x20ASC','DESC','isEmpty','COALESCE(CmHopper.UserId,\x200)\x20DESC','findOne','scheduledat','LOCK','Contact','Company','CmList','List','dialActive','getOpenContacts','isNumber','error','CmHopper,\x20%s,\x20%s,\x20%s','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x45ad71,_0x3a2f23){var _0x1d958f=function(_0x27b074){while(--_0x27b074){_0x45ad71['push'](_0x45ad71['shift']());}};_0x1d958f(++_0x3a2f23);}(_0xc081,0x8a));var _0x1c08=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xc081[_0x2ec461];return _0x28603d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1c08('0x0'));var zipdir=require(_0x1c08('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1c08('0x2'));var moment=require(_0x1c08('0x3'));var BPromise=require(_0x1c08('0x4'));var Mustache=require(_0x1c08('0x5'));var util=require(_0x1c08('0x6'));var path=require(_0x1c08('0x7'));var sox=require(_0x1c08('0x8'));var csv=require(_0x1c08('0x9'));var ejs=require(_0x1c08('0xa'));var fs=require('fs');var fs_extra=require(_0x1c08('0xb'));var _=require(_0x1c08('0xc'));var squel=require(_0x1c08('0xd'));var crypto=require(_0x1c08('0xe'));var jsforce=require(_0x1c08('0xf'));var deskjs=require(_0x1c08('0x10'));var toCsv=require(_0x1c08('0x9'));var querystring=require(_0x1c08('0x11'));var Papa=require(_0x1c08('0x12'));var Redis=require(_0x1c08('0x13'));var authService=require(_0x1c08('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x1c08('0x15'));var hardwareService=require(_0x1c08('0x16'));var logger=require(_0x1c08('0x17'))(_0x1c08('0x18'));var utils=require('../../config/utils');var config=require(_0x1c08('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1c08('0x1a'))['db'];function respondWithStatusCode(_0x32e8ab,_0x479f6f){_0x479f6f=_0x479f6f||0xcc;return function(_0x1197cc){if(_0x1197cc){return _0x32e8ab[_0x1c08('0x1b')](_0x479f6f);}return _0x32e8ab[_0x1c08('0x1c')](_0x479f6f)[_0x1c08('0x1d')]();};}function respondWithResult(_0x496f47,_0x16337d){_0x16337d=_0x16337d||0xc8;return function(_0x538d88){if(_0x538d88){return _0x496f47[_0x1c08('0x1c')](_0x16337d)[_0x1c08('0x1e')](_0x538d88);}};}function respondWithFilteredResult(_0x3d65f2,_0x51b93c){return function(_0x3c6b4b){if(_0x3c6b4b){var _0x358613=typeof _0x51b93c[_0x1c08('0x1f')]===_0x1c08('0x20')&&typeof _0x51b93c['limit']===_0x1c08('0x20');var _0x445199=_0x3c6b4b['count'];var _0x290ea8=_0x358613?0x0:_0x51b93c[_0x1c08('0x1f')];var _0x16dca8=_0x358613?_0x3c6b4b[_0x1c08('0x21')]:_0x51b93c['offset']+_0x51b93c[_0x1c08('0x22')];var _0x315e79;if(_0x16dca8>=_0x445199){_0x16dca8=_0x445199;_0x315e79=0xc8;}else{_0x315e79=0xce;}_0x3d65f2[_0x1c08('0x1c')](_0x315e79);return _0x3d65f2['set']('Content-Range',_0x290ea8+'-'+_0x16dca8+'/'+_0x445199)['json'](_0x3c6b4b);}return null;};}function patchUpdates(_0x17dbe9){return function(_0x41917f){try{jsonpatch['apply'](_0x41917f,_0x17dbe9,!![]);}catch(_0x55405e){return BPromise[_0x1c08('0x23')](_0x55405e);}return _0x41917f[_0x1c08('0x24')]();};}function saveUpdates(_0x197d35,_0x45eaed){return function(_0x29694e){if(_0x29694e){return _0x29694e[_0x1c08('0x25')](_0x197d35)[_0x1c08('0x26')](function(_0x81e203){return _0x81e203;});}return null;};}function removeEntity(_0x4fd9bd,_0x597ece){return function(_0x528812){if(_0x528812){return _0x528812[_0x1c08('0x27')]()[_0x1c08('0x26')](function(){_0x4fd9bd[_0x1c08('0x1c')](0xcc)[_0x1c08('0x1d')]();});}};}function handleEntityNotFound(_0x12fecf,_0x32a5b3){return function(_0x555b4e){if(!_0x555b4e){_0x12fecf[_0x1c08('0x1b')](0x194);}return _0x555b4e;};}function handleError(_0x40849a,_0x8fc16d){_0x8fc16d=_0x8fc16d||0x1f4;return function(_0x36d571){logger['error'](_0x36d571[_0x1c08('0x28')]);if(_0x36d571['name']){delete _0x36d571[_0x1c08('0x29')];}_0x40849a[_0x1c08('0x1c')](_0x8fc16d)[_0x1c08('0x2a')](_0x36d571);};}exports[_0x1c08('0x2b')]=function(_0x2d2f5c,_0x24b08a){var _0x56109a={},_0x157959={},_0x3013e0={'count':0x0,'rows':[]};var _0x2148cb=_['map'](db[_0x1c08('0x2c')][_0x1c08('0x2d')],function(_0x100075){return{'name':_0x100075[_0x1c08('0x2e')],'type':_0x100075[_0x1c08('0x2f')][_0x1c08('0x30')]};});_0x157959[_0x1c08('0x31')]=_[_0x1c08('0x32')](_0x2148cb,_0x1c08('0x29'));_0x157959[_0x1c08('0x33')]=_['keys'](_0x2d2f5c['query']);_0x157959['filters']=_['intersection'](_0x157959[_0x1c08('0x31')],_0x157959['query']);_0x157959[_0x1c08('0x34')]=_['concat'](_0x157959[_0x1c08('0x34')],[_0x1c08('0x35'),_0x1c08('0x36'),_0x1c08('0x37'),_0x1c08('0x38'),_0x1c08('0x39'),_0x1c08('0x3a'),_0x1c08('0x3b'),_0x1c08('0x3c'),_0x1c08('0x3d'),_0x1c08('0x3e'),_0x1c08('0x3f'),_0x1c08('0x40'),_0x1c08('0x41'),_0x1c08('0x42'),_0x1c08('0x43'),_0x1c08('0x44'),_0x1c08('0x45'),'$like',_0x1c08('0x46'),'$contains','$contained',_0x1c08('0x47')]);_0x56109a[_0x1c08('0x48')]=_['intersection'](_0x157959['model'],qs[_0x1c08('0x49')](_0x2d2f5c[_0x1c08('0x33')][_0x1c08('0x49')]));_0x56109a[_0x1c08('0x48')]=_0x56109a[_0x1c08('0x48')]['length']?_0x56109a[_0x1c08('0x48')]:_0x157959[_0x1c08('0x31')];if(!_0x2d2f5c[_0x1c08('0x33')][_0x1c08('0x4a')](_0x1c08('0x4b'))){_0x56109a[_0x1c08('0x22')]=qs[_0x1c08('0x22')](_0x2d2f5c[_0x1c08('0x33')][_0x1c08('0x22')]);_0x56109a[_0x1c08('0x1f')]=qs[_0x1c08('0x1f')](_0x2d2f5c[_0x1c08('0x33')][_0x1c08('0x1f')]);}_0x56109a[_0x1c08('0x4c')]=qs[_0x1c08('0x4d')](_0x2d2f5c[_0x1c08('0x33')][_0x1c08('0x4d')]);_0x56109a[_0x1c08('0x4e')]=qs[_0x1c08('0x34')](_['pick'](_0x2d2f5c[_0x1c08('0x33')],_0x157959[_0x1c08('0x34')]),_0x2148cb);if(_0x2d2f5c[_0x1c08('0x33')][_0x1c08('0x4f')]){_0x56109a[_0x1c08('0x4e')]=_['merge'](_0x56109a[_0x1c08('0x4e')],{'$or':_[_0x1c08('0x32')](_0x2148cb,function(_0x23ecaa){if(_0x23ecaa[_0x1c08('0x2f')]!=='VIRTUAL'){var _0x283e1a={};_0x283e1a[_0x23ecaa[_0x1c08('0x29')]]={'$like':'%'+_0x2d2f5c[_0x1c08('0x33')][_0x1c08('0x4f')]+'%'};return _0x283e1a;}})});}_0x56109a=_['merge']({},_0x56109a,_0x2d2f5c['options']);var _0x2bf5db={'where':_0x56109a[_0x1c08('0x4e')]};return db[_0x1c08('0x2c')][_0x1c08('0x21')](_0x2bf5db)['then'](function(_0x547208){_0x3013e0[_0x1c08('0x21')]=_0x547208;if(_0x2d2f5c[_0x1c08('0x33')][_0x1c08('0x50')]){_0x56109a[_0x1c08('0x51')]=[{'all':!![]}];}return db[_0x1c08('0x2c')][_0x1c08('0x52')](_0x56109a);})['then'](function(_0x1336d9){_0x3013e0[_0x1c08('0x53')]=_0x1336d9;return _0x3013e0;})[_0x1c08('0x26')](respondWithFilteredResult(_0x24b08a,_0x56109a))[_0x1c08('0x54')](handleError(_0x24b08a,null));};exports['show']=function(_0x52d4c6,_0x42c36b){var _0x2e92c4={'raw':!![],'where':{'id':_0x52d4c6[_0x1c08('0x55')]['id']}},_0xb3f27e={};_0xb3f27e[_0x1c08('0x31')]=_['keys'](db[_0x1c08('0x2c')][_0x1c08('0x2d')]);_0xb3f27e[_0x1c08('0x33')]=_['keys'](_0x52d4c6[_0x1c08('0x33')]);_0xb3f27e[_0x1c08('0x34')]=_[_0x1c08('0x56')](_0xb3f27e['model'],_0xb3f27e[_0x1c08('0x33')]);_0x2e92c4[_0x1c08('0x48')]=_['intersection'](_0xb3f27e[_0x1c08('0x31')],qs[_0x1c08('0x49')](_0x52d4c6['query'][_0x1c08('0x49')]));_0x2e92c4[_0x1c08('0x48')]=_0x2e92c4['attributes'][_0x1c08('0x57')]?_0x2e92c4['attributes']:_0xb3f27e[_0x1c08('0x31')];if(_0x52d4c6[_0x1c08('0x33')]['includeAll']){_0x2e92c4[_0x1c08('0x51')]=[{'all':!![]}];}_0x2e92c4=_['merge']({},_0x2e92c4,_0x52d4c6[_0x1c08('0x58')]);return db['CmHopper'][_0x1c08('0x59')](_0x2e92c4)[_0x1c08('0x26')](handleEntityNotFound(_0x42c36b,null))['then'](respondWithResult(_0x42c36b,null))['catch'](handleError(_0x42c36b,null));};exports[_0x1c08('0x5a')]=function(_0x3374ef,_0x5a603c){return db[_0x1c08('0x2c')][_0x1c08('0x5a')](_0x3374ef[_0x1c08('0x5b')],{})[_0x1c08('0x26')](respondWithResult(_0x5a603c,0xc9))[_0x1c08('0x54')](handleError(_0x5a603c,null));};exports[_0x1c08('0x25')]=function(_0x4ff487,_0xf6c6f4){if(_0x4ff487[_0x1c08('0x5b')]['id']){delete _0x4ff487['body']['id'];}return db['CmHopper'][_0x1c08('0x59')]({'where':{'id':_0x4ff487[_0x1c08('0x55')]['id']}})[_0x1c08('0x26')](handleEntityNotFound(_0xf6c6f4,null))[_0x1c08('0x26')](saveUpdates(_0x4ff487[_0x1c08('0x5b')],null))[_0x1c08('0x26')](respondWithResult(_0xf6c6f4,null))['catch'](handleError(_0xf6c6f4,null));};exports[_0x1c08('0x5c')]=function(_0xb4cece,_0xa01d65){return db[_0x1c08('0x2c')][_0x1c08('0x5c')]()[_0x1c08('0x26')](respondWithResult(_0xa01d65,null))['catch'](handleError(_0xa01d65,null));};exports[_0x1c08('0x27')]=function(_0x5b470a,_0x1f790d){var _0x1e31d9;return db['CmHopper'][_0x1c08('0x59')]({'where':{'id':_0x5b470a['params']['id']}})[_0x1c08('0x26')](handleEntityNotFound(_0x1f790d,null))[_0x1c08('0x26')](function(_0x540a37){if(_0x540a37){return _0x540a37[_0x1c08('0x27')]()[_0x1c08('0x26')](function(_0x1fe679){return _0x1fe679;});}})['then'](function(_0xf6e364){_0x1e31d9=_0xf6e364;if(_0xf6e364){if(_0xf6e364[_0x1c08('0x5d')]||_0xf6e364['CampaignId']){return db[_0xf6e364[_0x1c08('0x5d')]?_0x1c08('0x5e'):'Campaign'][_0x1c08('0x59')]({'where':{'id':_0xf6e364[_0x1c08('0x5d')]?_0xf6e364[_0x1c08('0x5d')]:_0xf6e364[_0x1c08('0x5f')]},'attributes':['id',_0x1c08('0x29')],'raw':!![]});}}})[_0x1c08('0x26')](function(_0xa97ba0){var _0x5589da={};if(_0xa97ba0){_[_0x1c08('0x60')](_0x5589da,_[_0x1c08('0x61')](_0x1e31d9[_0x1c08('0x62')],[_0x1c08('0x63'),_0x1c08('0x64'),'id']));_0x5589da[_0x1c08('0x65')]=0x15;_0x5589da[_0x1c08('0x66')]=_0x1c08('0x67');_0x5589da[_0x1c08('0x68')]=_0xa97ba0[_0x1c08('0x29')];_0x5589da[_0x1c08('0x69')]=_0x5b470a[_0x1c08('0x6a')][_0x1c08('0x29')];_0x5589da[_0x1c08('0x6b')]=_0x5b470a[_0x1c08('0x6a')]['id'];_0x5589da[_0x1c08('0x67')]=!![];_0x5589da[_0x1c08('0x6c')]=moment()[_0x1c08('0x6d')](_0x1c08('0x6e'));_0x5589da[_0x1c08('0x6f')]=_0x1e31d9['phone'];_0x5589da[_0x1c08('0x70')]=_0x1e31d9[_0x1c08('0x5d')]?_0x1c08('0x71'):'ivr';return db[_0x1c08('0x72')][_0x1c08('0x59')]({'where':{'id':_0x5589da[_0x1c08('0x73')]},'attributes':[_0x1c08('0x74'),_0x1c08('0x75')]})['then'](function(_0x309a19){if(!_[_0x1c08('0x76')](_0x1f790d)&&!_[_0x1c08('0x76')](_0x309a19[_0x1c08('0x74')])){_0x5589da[_0x1c08('0x77')]=_0x309a19[_0x1c08('0x74')];if(!_[_0x1c08('0x76')](_0x309a19['lastName'])){_0x5589da[_0x1c08('0x77')]+='\x20'+_0x309a19['lastName'];}}})[_0x1c08('0x78')](function(){return db[_0x1c08('0x79')]['create'](_0x5589da);});}})[_0x1c08('0x26')](function(){return _0x1f790d[_0x1c08('0x1c')](0xcc)[_0x1c08('0x1d')]();})[_0x1c08('0x54')](handleError(_0x1f790d,null));};exports[_0x1c08('0x7a')]=function(_0x20170e,_0x145764,_0x56505f){var _0x1d0820=[];return db[_0x1c08('0x72')]['describe']()[_0x1c08('0x26')](function(_0x324e5a){_0x1d0820=_['keys'](_0x324e5a);return _0x20170e[_0x1c08('0x6a')][_0x1c08('0x7b')]({'where':{'type':_0x1c08('0x7c'),'dialActive':!![],'dialMethod':_0x1c08('0x7d')},'attributes':['id',_0x1c08('0x7e')],'raw':!![]});})['then'](function(_0x3c272a){if(_0x3c272a&&_0x3c272a[_0x1c08('0x57')]){return db['sequelize'][_0x1c08('0x7f')](function(_0x28d4d4){var _0x1fbc3c={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1c08('0x6d')](_0x1c08('0x6e'))},'VoiceQueueId':{'$in':_[_0x1c08('0x32')](_0x3c272a,'id')},'$or':[{'UserId':null},{'UserId':_0x20170e[_0x1c08('0x6a')]['id']}]};var _0x2bd587=[];if(_0x20170e[_0x1c08('0x5b')][_0x1c08('0x80')]&&_0x20170e[_0x1c08('0x5b')]['direction']===_0x1c08('0x81')){if(!_['isEmpty'](_0x20170e[_0x1c08('0x5b')][_0x1c08('0x82')])){_0x1fbc3c['id']={'$in':_0x20170e[_0x1c08('0x5b')][_0x1c08('0x82')]};}_0x2bd587=[[_0x1c08('0x83'),_0x1c08('0x84')],[_0x1c08('0x85'),_0x3c272a[0x0][_0x1c08('0x7e')]===_0x1c08('0x84')?'DESC':'ASC'],db[_0x1c08('0x86')][_0x1c08('0x87')](_0x1c08('0x88')),['id',_0x1c08('0x89')]];}else{if(!_[_0x1c08('0x8a')](_0x20170e[_0x1c08('0x5b')][_0x1c08('0x82')])){_0x1fbc3c['id']={'$notIn':_0x20170e[_0x1c08('0x5b')][_0x1c08('0x82')]};}_0x2bd587=[[_0x1c08('0x83'),_0x1c08('0x89')],[_0x1c08('0x85'),_0x3c272a[0x0][_0x1c08('0x7e')]],db[_0x1c08('0x86')][_0x1c08('0x87')](_0x1c08('0x8b')),['id',_0x1c08('0x84')]];}return db[_0x1c08('0x2c')][_0x1c08('0x8c')]({'attributes':['id',_0x1c08('0x8d')],'where':_0x1fbc3c,'order':_0x2bd587,'transaction':_0x28d4d4,'lock':_0x28d4d4[_0x1c08('0x8e')]['UPDATE'],'include':[{'model':db[_0x1c08('0x72')],'as':_0x1c08('0x8f'),'attributes':_0x1d0820,'include':[{'model':db['CmCompany'],'as':_0x1c08('0x90'),'attributes':['id',_0x1c08('0x29')]}]},{'model':db[_0x1c08('0x91')],'as':_0x1c08('0x92'),'attributes':['id',_0x1c08('0x29')]},{'model':db[_0x1c08('0x5e')],'as':'Queue','attributes':['id','name',_0x1c08('0x93')]}]})[_0x1c08('0x26')](function(_0x375fb6){if(_0x375fb6){return _0x375fb6[_0x1c08('0x25')]({'UserId':_0x20170e[_0x1c08('0x6a')]['id']},{'transaction':_0x28d4d4});}});});}})[_0x1c08('0x26')](handleEntityNotFound(_0x145764,null))[_0x1c08('0x26')](respondWithResult(_0x145764,null))['catch'](handleError(_0x145764,null));};exports[_0x1c08('0x94')]=function(_0x51594a,_0x5a15eb,_0x2a30ab){return _0x51594a[_0x1c08('0x6a')]['getVoiceQueues']({'where':{'type':_0x1c08('0x7c'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})[_0x1c08('0x26')](function(_0x462669){if(_0x462669&&_0x462669['length']){return db[_0x1c08('0x2c')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x1c08('0x6d')](_0x1c08('0x6e'))},'VoiceQueueId':{'$in':_[_0x1c08('0x32')](_0x462669,'id')},'$or':[{'UserId':null},{'UserId':_0x51594a[_0x1c08('0x6a')]['id']}]}});}return 0x0;})[_0x1c08('0x26')](function(_0x4cce59){if(!_[_0x1c08('0x76')](_0x4cce59)&&_[_0x1c08('0x95')](_0x4cce59)){return _0x5a15eb['status'](0xc8)[_0x1c08('0x1e')]({'contacts':_0x4cce59});}else{logger[_0x1c08('0x96')](_0x1c08('0x97'),_0x1c08('0x94'),0x194,'entity\x20not\x20found');_0x5a15eb[_0x1c08('0x1b')](0x194);}})['catch'](handleError(_0x5a15eb,null));}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index 2839f0d..67db7e7 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 _0x687b=['lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat','phone','priority'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x687b,0x14a));var _0xb687=function(_0xff659d,_0x2283a1){_0xff659d=_0xff659d-0x0;var _0x19c170=_0x687b[_0xff659d];return _0x19c170;};'use strict';var _=require(_0xb687('0x0'));var util=require(_0xb687('0x1'));var logger=require(_0xb687('0x2'))(_0xb687('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb687('0x4'));var fs=require('fs');var path=require(_0xb687('0x5'));var rimraf=require(_0xb687('0x6'));var config=require(_0xb687('0x7'));var attributes=require(_0xb687('0x8'));module[_0xb687('0x9')]=function(_0x16ccf3,_0xf43a1f){return _0x16ccf3[_0xb687('0xa')](_0xb687('0xb'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb687('0xc'),'fields':[_0xb687('0xc')]},{'name':'phone','fields':[_0xb687('0xd')]},{'name':_0xb687('0xe'),'fields':[_0xb687('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x0295=['define','scheduledat','phone','priority','lodash','api','request-promise','path','rimraf','../../config/environment','./cmHopper.attributes','exports'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x0295,0x1f0));var _0x5029=function(_0x4d62ae,_0x1509f5){_0x4d62ae=_0x4d62ae-0x0;var _0x54d4b7=_0x0295[_0x4d62ae];return _0x54d4b7;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5029('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x5029('0x2'));var fs=require('fs');var path=require(_0x5029('0x3'));var rimraf=require(_0x5029('0x4'));var config=require(_0x5029('0x5'));var attributes=require(_0x5029('0x6'));module[_0x5029('0x7')]=function(_0x200217,_0x215955){return _0x200217[_0x5029('0x8')]('CmHopper',attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':'scheduledat','fields':[_0x5029('0x9')]},{'name':'phone','fields':[_0x5029('0xa')]},{'name':'priority','fields':[_0x5029('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index 4f2b4e2..90ffc90 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 _0x9359=['Contact','keys','User','Agent','name','voicePause','length','push','update','all','GetContactDialer','MoveContactManagedDialer','transaction','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','contactsRescheduled','GetContactRecallMe','UserId','GetCmHopperPreview','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopper,\x20%s,\x20%s','request\x20sent','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetCmHopper','options','raw','where','attributes','include','model','map','CmHopper','find','ShowCmHopper','debug','CreateCmHopper','create','body','limit','UpdateCmHopper','DestroyCmHopper','CmContact','describe','sequelize','findAll','order','LOCK','UPDATE'];(function(_0x1c5e01,_0x2e5dc5){var _0x4f0e4c=function(_0x774b55){while(--_0x774b55){_0x1c5e01['push'](_0x1c5e01['shift']());}};_0x4f0e4c(++_0x2e5dc5);}(_0x9359,0x184));var _0x9935=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9359[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x9935('0x0'));var util=require(_0x9935('0x1'));var moment=require(_0x9935('0x2'));var BPromise=require(_0x9935('0x3'));var rs=require(_0x9935('0x4'));var fs=require('fs');var Redis=require(_0x9935('0x5'));var db=require(_0x9935('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x9935('0x7'))(_0x9935('0x8'));var config=require(_0x9935('0x9'));var jayson=require(_0x9935('0xa'));var client=jayson[_0x9935('0xb')][_0x9935('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x298b31,_0x3576b9,_0x1f487b){return new BPromise(function(_0xb1bfe4,_0x3886f1){return client[_0x9935('0xd')](_0x298b31,_0x1f487b)[_0x9935('0xe')](function(_0x5c40a2){logger[_0x9935('0xf')](_0x9935('0x10'),_0x3576b9,_0x9935('0x11'));logger['debug'](_0x9935('0x12'),_0x3576b9,_0x9935('0x11'),JSON[_0x9935('0x13')](_0x5c40a2));if(_0x5c40a2[_0x9935('0x14')]){if(_0x5c40a2[_0x9935('0x14')][_0x9935('0x15')]===0x1f4){logger[_0x9935('0x14')]('CmHopper,\x20%s,\x20%s',_0x3576b9,_0x5c40a2[_0x9935('0x14')]['message']);return _0x3886f1(_0x5c40a2['error'][_0x9935('0x16')]);}logger['error'](_0x9935('0x10'),_0x3576b9,_0x5c40a2[_0x9935('0x14')][_0x9935('0x16')]);return _0xb1bfe4(_0x5c40a2[_0x9935('0x14')]['message']);}else{logger[_0x9935('0xf')](_0x9935('0x10'),_0x3576b9,_0x9935('0x11'));_0xb1bfe4(_0x5c40a2[_0x9935('0x17')][_0x9935('0x16')]);}})[_0x9935('0x18')](function(_0x31f913){logger['error'](_0x9935('0x10'),_0x3576b9,_0x31f913);_0x3886f1(_0x31f913);});});}exports[_0x9935('0x19')]=function(_0x314605){var _0x5c45fa=this;return new Promise(function(_0x3c0ec5,_0x1cb994){return db['CmHopper']['findAll']({'raw':_0x314605[_0x9935('0x1a')]?_0x314605[_0x9935('0x1a')][_0x9935('0x1b')]===undefined?!![]:![]:!![],'where':_0x314605['options']?_0x314605[_0x9935('0x1a')][_0x9935('0x1c')]||null:null,'attributes':_0x314605[_0x9935('0x1a')]?_0x314605[_0x9935('0x1a')][_0x9935('0x1d')]||null:null,'limit':_0x314605[_0x9935('0x1a')]?_0x314605[_0x9935('0x1a')]['limit']||null:null,'include':_0x314605[_0x9935('0x1a')]?_0x314605['options'][_0x9935('0x1e')]?_['map'](_0x314605[_0x9935('0x1a')][_0x9935('0x1e')],function(_0xb15fd5){return{'model':db[_0xb15fd5[_0x9935('0x1f')]],'as':_0xb15fd5['as'],'attributes':_0xb15fd5[_0x9935('0x1d')],'include':_0xb15fd5['include']?_[_0x9935('0x20')](_0xb15fd5[_0x9935('0x1e')],function(_0x5b6c54){return{'model':db[_0x5b6c54[_0x9935('0x1f')]],'as':_0x5b6c54['as'],'attributes':_0x5b6c54['attributes'],'include':_0x5b6c54[_0x9935('0x1e')]?_[_0x9935('0x20')](_0x5b6c54['include'],function(_0xee49bd){return{'model':db[_0xee49bd[_0x9935('0x1f')]],'as':_0xee49bd['as'],'attributes':_0xee49bd[_0x9935('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc121d3){logger[_0x9935('0xf')](_0x9935('0x19'),_0x314605);logger['debug'](_0x9935('0x19'),_0x314605,JSON[_0x9935('0x13')](_0xc121d3));_0x3c0ec5(_0xc121d3);})[_0x9935('0x18')](function(_0x3898fb){logger[_0x9935('0x14')]('GetCmHopper',_0x3898fb[_0x9935('0x16')],_0x314605);_0x1cb994(_0x5c45fa['error'](0x1f4,_0x3898fb[_0x9935('0x16')]));});});};exports['ShowCmHopper']=function(_0x2d9568){var _0x39804b=this;return new Promise(function(_0xac674e,_0x277d1c){return db[_0x9935('0x21')][_0x9935('0x22')]({'raw':_0x2d9568[_0x9935('0x1a')]?_0x2d9568[_0x9935('0x1a')][_0x9935('0x1b')]===undefined?!![]:![]:!![],'where':_0x2d9568['options']?_0x2d9568[_0x9935('0x1a')][_0x9935('0x1c')]||null:null,'attributes':_0x2d9568[_0x9935('0x1a')]?_0x2d9568[_0x9935('0x1a')][_0x9935('0x1d')]||null:null,'include':_0x2d9568['options']?_0x2d9568[_0x9935('0x1a')][_0x9935('0x1e')]?_['map'](_0x2d9568[_0x9935('0x1a')][_0x9935('0x1e')],function(_0x20062a){return{'model':db[_0x20062a[_0x9935('0x1f')]],'as':_0x20062a['as'],'attributes':_0x20062a['attributes'],'include':_0x20062a[_0x9935('0x1e')]?_[_0x9935('0x20')](_0x20062a[_0x9935('0x1e')],function(_0x478df9){return{'model':db[_0x478df9[_0x9935('0x1f')]],'as':_0x478df9['as'],'attributes':_0x478df9[_0x9935('0x1d')],'include':_0x478df9['include']?_[_0x9935('0x20')](_0x478df9['include'],function(_0x4d1b4d){return{'model':db[_0x4d1b4d['model']],'as':_0x4d1b4d['as'],'attributes':_0x4d1b4d[_0x9935('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9935('0xe')](function(_0x28d38b){logger[_0x9935('0xf')](_0x9935('0x23'),_0x2d9568);logger[_0x9935('0x24')](_0x9935('0x23'),_0x2d9568,JSON[_0x9935('0x13')](_0x28d38b));_0xac674e(_0x28d38b);})[_0x9935('0x18')](function(_0xa39b99){logger[_0x9935('0x14')]('ShowCmHopper',_0xa39b99[_0x9935('0x16')],_0x2d9568);_0x277d1c(_0x39804b[_0x9935('0x14')](0x1f4,_0xa39b99[_0x9935('0x16')]));});});};exports[_0x9935('0x25')]=function(_0x395658){var _0x1b330b=this;return new Promise(function(_0x602ac0,_0x4cc039){return db['CmHopper'][_0x9935('0x26')](_0x395658['body'],{'raw':_0x395658[_0x9935('0x1a')]?_0x395658[_0x9935('0x1a')][_0x9935('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x121ecb){logger[_0x9935('0xf')](_0x9935('0x25'),_0x395658);logger[_0x9935('0x24')]('CreateCmHopper',_0x395658,JSON[_0x9935('0x13')](_0x121ecb));_0x602ac0(_0x121ecb);})[_0x9935('0x18')](function(_0x5bee21){logger[_0x9935('0x14')]('CreateCmHopper',_0x5bee21['message'],_0x395658);_0x4cc039(_0x1b330b['error'](0x1f4,_0x5bee21['message']));});});};exports['UpdateCmHopper']=function(_0x1f309d){var _0x366e72=this;return new Promise(function(_0x3fe12f,_0x29b361){return db[_0x9935('0x21')]['update'](_0x1f309d[_0x9935('0x27')],{'raw':_0x1f309d[_0x9935('0x1a')]?_0x1f309d[_0x9935('0x1a')][_0x9935('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f309d[_0x9935('0x1a')]?_0x1f309d['options'][_0x9935('0x1c')]||null:null,'attributes':_0x1f309d['options']?_0x1f309d[_0x9935('0x1a')][_0x9935('0x1d')]||null:null,'limit':_0x1f309d[_0x9935('0x1a')]?_0x1f309d[_0x9935('0x1a')][_0x9935('0x28')]||null:null})[_0x9935('0xe')](function(_0x2900c1){logger['info'](_0x9935('0x29'),_0x1f309d);logger['debug'](_0x9935('0x29'),_0x1f309d,JSON[_0x9935('0x13')](_0x2900c1));_0x3fe12f(_0x2900c1);})[_0x9935('0x18')](function(_0x505374){logger[_0x9935('0x14')](_0x9935('0x29'),_0x505374[_0x9935('0x16')],_0x1f309d);_0x29b361(_0x366e72[_0x9935('0x14')](0x1f4,_0x505374[_0x9935('0x16')]));});});};exports[_0x9935('0x2a')]=function(_0xd222b8){var _0x2d9be3=this;return new Promise(function(_0x39db9e,_0x3e5f12){return db[_0x9935('0x21')]['destroy']({'where':_0xd222b8[_0x9935('0x1a')]?_0xd222b8[_0x9935('0x1a')][_0x9935('0x1c')]||null:null})[_0x9935('0xe')](function(_0x2a96c0){logger[_0x9935('0xf')](_0x9935('0x2a'),_0xd222b8);logger['debug'](_0x9935('0x2a'),_0xd222b8,JSON[_0x9935('0x13')](_0x2a96c0));_0x39db9e(_0x2a96c0);})['catch'](function(_0x4d07a5){logger[_0x9935('0x14')](_0x9935('0x2a'),_0x4d07a5[_0x9935('0x16')],_0xd222b8);_0x3e5f12(_0x2d9be3[_0x9935('0x14')](0x1f4,_0x4d07a5['message']));});});};exports['GetContactDialer']=function(_0x1a0c3a){var _0x269960=this;return new Promise(function(_0x183adc,_0x1d8eeb){return db[_0x9935('0x2b')][_0x9935('0x2c')]()[_0x9935('0xe')](function(_0xbbdb4b){return db[_0x9935('0x2d')]['transaction'](function(_0x45a172){return db[_0x9935('0x21')][_0x9935('0x2e')]({'where':_0x1a0c3a[_0x9935('0x1a')]?_0x1a0c3a[_0x9935('0x1a')][_0x9935('0x1c')]||null:null,'attributes':_0x1a0c3a['options']?_0x1a0c3a[_0x9935('0x1a')]['attributes']||null:null,'limit':_0x1a0c3a[_0x9935('0x1a')]?_0x1a0c3a[_0x9935('0x1a')][_0x9935('0x28')]||null:null,'order':_0x1a0c3a[_0x9935('0x1a')]?_0x1a0c3a[_0x9935('0x1a')][_0x9935('0x2f')]||null:null,'transaction':_0x45a172,'lock':_0x45a172[_0x9935('0x30')][_0x9935('0x31')],'include':[{'model':db[_0x9935('0x2b')],'as':_0x9935('0x32'),'attributes':_[_0x9935('0x33')](_0xbbdb4b)},{'model':db[_0x9935('0x34')],'as':_0x9935('0x35'),'attributes':['id',_0x9935('0x36'),_0x9935('0x37')]}]})[_0x9935('0xe')](function(_0x4ec3c0){var _0x2f24c9=[];var _0x169126=[];for(var _0x4c856f=0x0;_0x4c856f<_0x4ec3c0[_0x9935('0x38')];_0x4c856f+=0x1){var _0x1c2fc7=_0x4ec3c0[_0x4c856f]['UserId'];if(_0x1c2fc7===null){_0x2f24c9[_0x9935('0x39')](_0x4ec3c0[_0x4c856f][_0x9935('0x3a')](_0x1a0c3a[_0x9935('0x27')],{'transaction':_0x45a172}));}else if(!_0x169126['includes'](_0x1c2fc7)){_0x169126[_0x9935('0x39')](_0x1c2fc7);_0x2f24c9[_0x9935('0x39')](_0x4ec3c0[_0x4c856f]['update'](_0x1a0c3a[_0x9935('0x27')],{'transaction':_0x45a172}));}}return BPromise[_0x9935('0x3b')](_0x2f24c9);});})[_0x9935('0xe')](function(_0x3f09b8){logger[_0x9935('0xf')]('GetContactDialer',_0x1a0c3a);logger[_0x9935('0x24')](_0x9935('0x3c'),_0x1a0c3a,JSON[_0x9935('0x13')](_0x3f09b8));_0x183adc(_0x3f09b8);})[_0x9935('0x18')](function(_0x464cf4){logger[_0x9935('0x14')]('GetContactDialer',_0x464cf4[_0x9935('0x16')],_0x1a0c3a);_0x1d8eeb(_0x269960[_0x9935('0x14')](0x1f4,_0x464cf4['message']));});});});};exports[_0x9935('0x3d')]=function(_0x2a8b4b){var _0x16940e=this;return new Promise(function(_0x26558c,_0x9dccab){return db[_0x9935('0x2d')][_0x9935('0x3e')](function(_0x43c215){return db['CmHopperFinal']['create'](_0x2a8b4b[_0x9935('0x27')],{'raw':_0x2a8b4b[_0x9935('0x1a')]?_0x2a8b4b[_0x9935('0x1a')][_0x9935('0x1b')]===undefined?!![]:![]:!![],'transaction':_0x43c215})['then'](function(){return db[_0x9935('0x21')]['destroy']({'where':_0x2a8b4b[_0x9935('0x1a')]?_0x2a8b4b[_0x9935('0x1a')]['where']||null:null,'transaction':_0x43c215});});})[_0x9935('0xe')](function(_0x2668c0){logger['info'](_0x9935('0x3d'),_0x2a8b4b);logger[_0x9935('0x24')]('MoveContactManagedDialer',_0x2a8b4b,JSON[_0x9935('0x13')](_0x2668c0));_0x26558c(_0x2668c0);})[_0x9935('0x18')](function(_0x57d429){logger['error']('MoveContactManagedDialer',_0x57d429[_0x9935('0x16')],_0x2a8b4b);_0x9dccab(_0x16940e[_0x9935('0x14')](0x1f4,_0x57d429['message']));});});};exports[_0x9935('0x3f')]=function(_0x2e46b6){var _0x595302=this;return new Promise(function(_0x58fd45,_0x38c13f){return db['CmHopper'][_0x9935('0x2e')]({'raw':_0x2e46b6[_0x9935('0x1a')]?_0x2e46b6[_0x9935('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2e46b6[_0x9935('0x1a')]?_0x2e46b6[_0x9935('0x1a')]['where']||null:null,'attributes':[[db[_0x9935('0x2d')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x9935('0x2d')][_0x9935('0x40')](_0x9935('0x41')+util[_0x9935('0x42')](_0x9935('0x43'),moment()[_0x9935('0x42')](_0x9935('0x44')))+'\x20,\x201,\x20null'))),_0x9935('0x45')]]})[_0x9935('0xe')](function(_0x23e5c3){logger[_0x9935('0xf')](_0x9935('0x3f'),_0x2e46b6);logger[_0x9935('0x24')](_0x9935('0x3f'),_0x2e46b6,JSON[_0x9935('0x13')](_0x23e5c3));_0x58fd45(_0x23e5c3);})[_0x9935('0x18')](function(_0x385f46){logger['error'](_0x9935('0x3f'),_0x385f46[_0x9935('0x16')],_0x2e46b6);_0x38c13f(_0x595302[_0x9935('0x14')](0x1f4,_0x385f46[_0x9935('0x16')]));});});};exports[_0x9935('0x46')]=function(_0x46c563){var _0x5b7b1e=this;return new Promise(function(_0x17e0bf,_0x4ba15b){return db[_0x9935('0x2b')]['describe']()[_0x9935('0xe')](function(_0x18e228){return db[_0x9935('0x2d')][_0x9935('0x3e')](function(_0x5eb8bb){return db[_0x9935('0x21')][_0x9935('0x2e')]({'where':_0x46c563[_0x9935('0x1a')]?_0x46c563['options'][_0x9935('0x1c')]||null:null,'attributes':_0x46c563[_0x9935('0x1a')]?_0x46c563[_0x9935('0x1a')]['attributes']||null:null,'limit':0x1,'order':_0x46c563[_0x9935('0x1a')]?_0x46c563[_0x9935('0x1a')]['order']||null:null,'group':db[_0x9935('0x21')][_0x9935('0x47')],'transaction':_0x5eb8bb,'lock':_0x5eb8bb[_0x9935('0x30')][_0x9935('0x31')],'include':_0x46c563['options']?_0x46c563[_0x9935('0x1a')]['include']?_['map'](_0x46c563[_0x9935('0x1a')]['include'],function(_0x3ee6b6){return{'model':db[_0x3ee6b6[_0x9935('0x1f')]],'as':_0x3ee6b6['as'],'attributes':_0x3ee6b6[_0x9935('0x1d')],'include':_0x3ee6b6[_0x9935('0x1e')]?_[_0x9935('0x20')](_0x3ee6b6[_0x9935('0x1e')],function(_0x493cef){return{'model':db[_0x493cef[_0x9935('0x1f')]],'as':_0x493cef['as'],'attributes':_0x493cef[_0x9935('0x1d')],'include':_0x493cef[_0x9935('0x1e')]?_[_0x9935('0x20')](_0x493cef['include'],function(_0xa8c6ee){return{'model':db[_0xa8c6ee[_0x9935('0x1f')]],'as':_0xa8c6ee['as'],'attributes':_0xa8c6ee[_0x9935('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x9935('0xe')](function(_0x24db72){var _0x2d26c3=[];for(var _0x490692=0x0;_0x490692<_0x24db72['length'];_0x490692+=0x1){_0x2d26c3['push'](_0x24db72[_0x490692]['update'](_0x46c563[_0x9935('0x27')],{'transaction':_0x5eb8bb}));}return BPromise[_0x9935('0x3b')](_0x2d26c3);});})[_0x9935('0xe')](function(_0x4fb7f6){logger[_0x9935('0xf')](_0x9935('0x46'),_0x46c563);logger['debug'](_0x9935('0x46'),_0x46c563,JSON['stringify'](_0x4fb7f6));_0x17e0bf(_0x4fb7f6);})[_0x9935('0x18')](function(_0x547f42){logger[_0x9935('0x14')](_0x9935('0x46'),_0x547f42[_0x9935('0x16')],_0x46c563);_0x4ba15b(_0x5b7b1e[_0x9935('0x14')](0x1f4,_0x547f42['message']));});});});};exports[_0x9935('0x48')]=function(_0x4c33fe){var _0x548c00=this;return new Promise(function(_0x533455,_0x3debab){db[_0x9935('0x2b')][_0x9935('0x2c')]()[_0x9935('0xe')](function(_0x55ba31){return db[_0x9935('0x21')][_0x9935('0x2e')]({'raw':_0x4c33fe[_0x9935('0x1a')]?_0x4c33fe['options']['raw']===undefined?!![]:![]:!![],'where':_0x4c33fe[_0x9935('0x1a')]?_0x4c33fe['options']['where']||null:null,'attributes':_0x4c33fe[_0x9935('0x1a')]?_0x4c33fe['options']['attributes']||null:null,'limit':_0x4c33fe['options']?_0x4c33fe['options'][_0x9935('0x28')]||null:null,'include':_0x4c33fe['options']?_0x4c33fe[_0x9935('0x1a')]['include']?_[_0x9935('0x20')](_0x4c33fe[_0x9935('0x1a')][_0x9935('0x1e')],function(_0x2142ec){return{'model':db[_0x2142ec[_0x9935('0x1f')]],'as':_0x2142ec['as'],'attributes':_0x2142ec['as']===_0x9935('0x32')?_[_0x9935('0x33')](_0x55ba31):_0x2142ec['attributes'],'include':_0x2142ec[_0x9935('0x1e')]?_[_0x9935('0x20')](_0x2142ec[_0x9935('0x1e')],function(_0x3a2a2c){return{'model':db[_0x3a2a2c[_0x9935('0x1f')]],'as':_0x3a2a2c['as'],'attributes':_0x3a2a2c[_0x9935('0x1d')],'include':_0x3a2a2c[_0x9935('0x1e')]?_[_0x9935('0x20')](_0x3a2a2c[_0x9935('0x1e')],function(_0x4af3b7){return{'model':db[_0x4af3b7[_0x9935('0x1f')]],'as':_0x4af3b7['as'],'attributes':_0x4af3b7['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ee157){logger[_0x9935('0xf')](_0x9935('0x19'),_0x4c33fe);logger['debug'](_0x9935('0x19'),_0x4c33fe,JSON[_0x9935('0x13')](_0x2ee157));_0x533455(_0x2ee157);})[_0x9935('0x18')](function(_0x50a593){logger[_0x9935('0x14')](_0x9935('0x19'),_0x50a593[_0x9935('0x16')],_0x4c33fe);_0x3debab(_0x548c00[_0x9935('0x14')](0x1f4,_0x50a593[_0x9935('0x16')]));});});});}; \ No newline at end of file +var _0x81fd=['order','UPDATE','Contact','keys','User','Agent','name','length','UserId','push','includes','all','MoveContactManagedDialer','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x20,\x201,\x20null','GetContactRecallMe','LOCK','GetCmHopperPreview','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','debug','CmHopper,\x20%s,\x20%s,\x20%s','stringify','error','code','CmHopper,\x20%s,\x20%s','message','catch','GetCmHopper','findAll','options','where','attributes','limit','include','map','model','ShowCmHopper','find','CreateCmHopper','create','UpdateCmHopper','CmHopper','update','body','raw','DestroyCmHopper','destroy','GetContactDialer','CmContact','describe','sequelize','transaction'];(function(_0x34dc41,_0x51bbbd){var _0x26c32d=function(_0x208eac){while(--_0x208eac){_0x34dc41['push'](_0x34dc41['shift']());}};_0x26c32d(++_0x51bbbd);}(_0x81fd,0x126));var _0xd81f=function(_0x2ac1b7,_0x2e3301){_0x2ac1b7=_0x2ac1b7-0x0;var _0x35e16d=_0x81fd[_0x2ac1b7];return _0x35e16d;};'use strict';var _=require('lodash');var util=require(_0xd81f('0x0'));var moment=require('moment');var BPromise=require(_0xd81f('0x1'));var rs=require(_0xd81f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd81f('0x3'))['db'];var utils=require(_0xd81f('0x4'));var logger=require(_0xd81f('0x5'))(_0xd81f('0x6'));var config=require(_0xd81f('0x7'));var jayson=require(_0xd81f('0x8'));var client=jayson['client'][_0xd81f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x305d4d,_0x311abc,_0x5b7d5b){return new BPromise(function(_0x36aff9,_0x514fec){return client['request'](_0x305d4d,_0x5b7d5b)[_0xd81f('0xa')](function(_0x199ced){logger[_0xd81f('0xb')]('CmHopper,\x20%s,\x20%s',_0x311abc,_0xd81f('0xc'));logger[_0xd81f('0xd')](_0xd81f('0xe'),_0x311abc,_0xd81f('0xc'),JSON[_0xd81f('0xf')](_0x199ced));if(_0x199ced['error']){if(_0x199ced[_0xd81f('0x10')][_0xd81f('0x11')]===0x1f4){logger[_0xd81f('0x10')](_0xd81f('0x12'),_0x311abc,_0x199ced['error'][_0xd81f('0x13')]);return _0x514fec(_0x199ced[_0xd81f('0x10')][_0xd81f('0x13')]);}logger[_0xd81f('0x10')](_0xd81f('0x12'),_0x311abc,_0x199ced[_0xd81f('0x10')][_0xd81f('0x13')]);return _0x36aff9(_0x199ced['error'][_0xd81f('0x13')]);}else{logger['info'](_0xd81f('0x12'),_0x311abc,_0xd81f('0xc'));_0x36aff9(_0x199ced['result'][_0xd81f('0x13')]);}})[_0xd81f('0x14')](function(_0x2f5c80){logger[_0xd81f('0x10')]('CmHopper,\x20%s,\x20%s',_0x311abc,_0x2f5c80);_0x514fec(_0x2f5c80);});});}exports[_0xd81f('0x15')]=function(_0x587295){var _0x6c71bf=this;return new Promise(function(_0x36990f,_0x1b75a1){return db['CmHopper'][_0xd81f('0x16')]({'raw':_0x587295[_0xd81f('0x17')]?_0x587295[_0xd81f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x587295[_0xd81f('0x17')]?_0x587295[_0xd81f('0x17')][_0xd81f('0x18')]||null:null,'attributes':_0x587295['options']?_0x587295['options'][_0xd81f('0x19')]||null:null,'limit':_0x587295['options']?_0x587295[_0xd81f('0x17')][_0xd81f('0x1a')]||null:null,'include':_0x587295[_0xd81f('0x17')]?_0x587295[_0xd81f('0x17')][_0xd81f('0x1b')]?_[_0xd81f('0x1c')](_0x587295['options'][_0xd81f('0x1b')],function(_0x599de8){return{'model':db[_0x599de8[_0xd81f('0x1d')]],'as':_0x599de8['as'],'attributes':_0x599de8['attributes'],'include':_0x599de8['include']?_['map'](_0x599de8[_0xd81f('0x1b')],function(_0x4bddf4){return{'model':db[_0x4bddf4[_0xd81f('0x1d')]],'as':_0x4bddf4['as'],'attributes':_0x4bddf4[_0xd81f('0x19')],'include':_0x4bddf4['include']?_[_0xd81f('0x1c')](_0x4bddf4[_0xd81f('0x1b')],function(_0x569a4a){return{'model':db[_0x569a4a['model']],'as':_0x569a4a['as'],'attributes':_0x569a4a[_0xd81f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd81f('0xa')](function(_0x21a236){logger['info'](_0xd81f('0x15'),_0x587295);logger[_0xd81f('0xd')](_0xd81f('0x15'),_0x587295,JSON[_0xd81f('0xf')](_0x21a236));_0x36990f(_0x21a236);})[_0xd81f('0x14')](function(_0x5ae86b){logger[_0xd81f('0x10')]('GetCmHopper',_0x5ae86b[_0xd81f('0x13')],_0x587295);_0x1b75a1(_0x6c71bf[_0xd81f('0x10')](0x1f4,_0x5ae86b[_0xd81f('0x13')]));});});};exports[_0xd81f('0x1e')]=function(_0x395f20){var _0x2a8dd8=this;return new Promise(function(_0x2d2dd9,_0x2d6abd){return db['CmHopper'][_0xd81f('0x1f')]({'raw':_0x395f20[_0xd81f('0x17')]?_0x395f20[_0xd81f('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x395f20[_0xd81f('0x17')]?_0x395f20['options']['where']||null:null,'attributes':_0x395f20[_0xd81f('0x17')]?_0x395f20['options'][_0xd81f('0x19')]||null:null,'include':_0x395f20['options']?_0x395f20[_0xd81f('0x17')][_0xd81f('0x1b')]?_[_0xd81f('0x1c')](_0x395f20['options'][_0xd81f('0x1b')],function(_0x45d7c9){return{'model':db[_0x45d7c9[_0xd81f('0x1d')]],'as':_0x45d7c9['as'],'attributes':_0x45d7c9['attributes'],'include':_0x45d7c9[_0xd81f('0x1b')]?_[_0xd81f('0x1c')](_0x45d7c9[_0xd81f('0x1b')],function(_0x53bcb8){return{'model':db[_0x53bcb8[_0xd81f('0x1d')]],'as':_0x53bcb8['as'],'attributes':_0x53bcb8['attributes'],'include':_0x53bcb8[_0xd81f('0x1b')]?_[_0xd81f('0x1c')](_0x53bcb8[_0xd81f('0x1b')],function(_0x4ce485){return{'model':db[_0x4ce485['model']],'as':_0x4ce485['as'],'attributes':_0x4ce485[_0xd81f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd81f('0xa')](function(_0x1e3b97){logger[_0xd81f('0xb')](_0xd81f('0x1e'),_0x395f20);logger[_0xd81f('0xd')](_0xd81f('0x1e'),_0x395f20,JSON[_0xd81f('0xf')](_0x1e3b97));_0x2d2dd9(_0x1e3b97);})[_0xd81f('0x14')](function(_0xe5619a){logger['error']('ShowCmHopper',_0xe5619a[_0xd81f('0x13')],_0x395f20);_0x2d6abd(_0x2a8dd8[_0xd81f('0x10')](0x1f4,_0xe5619a[_0xd81f('0x13')]));});});};exports[_0xd81f('0x20')]=function(_0x374168){var _0x5f2590=this;return new Promise(function(_0x5257be,_0x2e6b87){return db['CmHopper'][_0xd81f('0x21')](_0x374168['body'],{'raw':_0x374168['options']?_0x374168[_0xd81f('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xd81f('0xa')](function(_0x36b139){logger[_0xd81f('0xb')]('CreateCmHopper',_0x374168);logger[_0xd81f('0xd')](_0xd81f('0x20'),_0x374168,JSON['stringify'](_0x36b139));_0x5257be(_0x36b139);})['catch'](function(_0xa57fa3){logger['error'](_0xd81f('0x20'),_0xa57fa3[_0xd81f('0x13')],_0x374168);_0x2e6b87(_0x5f2590[_0xd81f('0x10')](0x1f4,_0xa57fa3['message']));});});};exports[_0xd81f('0x22')]=function(_0x2201f1){var _0x337003=this;return new Promise(function(_0x353514,_0xb61009){return db[_0xd81f('0x23')][_0xd81f('0x24')](_0x2201f1[_0xd81f('0x25')],{'raw':_0x2201f1[_0xd81f('0x17')]?_0x2201f1[_0xd81f('0x17')][_0xd81f('0x26')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2201f1[_0xd81f('0x17')]?_0x2201f1[_0xd81f('0x17')]['where']||null:null,'attributes':_0x2201f1[_0xd81f('0x17')]?_0x2201f1[_0xd81f('0x17')][_0xd81f('0x19')]||null:null,'limit':_0x2201f1[_0xd81f('0x17')]?_0x2201f1[_0xd81f('0x17')][_0xd81f('0x1a')]||null:null})['then'](function(_0x53a99e){logger['info'](_0xd81f('0x22'),_0x2201f1);logger[_0xd81f('0xd')](_0xd81f('0x22'),_0x2201f1,JSON['stringify'](_0x53a99e));_0x353514(_0x53a99e);})[_0xd81f('0x14')](function(_0x3abac8){logger[_0xd81f('0x10')](_0xd81f('0x22'),_0x3abac8[_0xd81f('0x13')],_0x2201f1);_0xb61009(_0x337003[_0xd81f('0x10')](0x1f4,_0x3abac8[_0xd81f('0x13')]));});});};exports[_0xd81f('0x27')]=function(_0x587702){var _0xe52f68=this;return new Promise(function(_0x54b154,_0x5745ff){return db['CmHopper'][_0xd81f('0x28')]({'where':_0x587702['options']?_0x587702[_0xd81f('0x17')][_0xd81f('0x18')]||null:null})[_0xd81f('0xa')](function(_0x1e4ad3){logger[_0xd81f('0xb')](_0xd81f('0x27'),_0x587702);logger[_0xd81f('0xd')](_0xd81f('0x27'),_0x587702,JSON['stringify'](_0x1e4ad3));_0x54b154(_0x1e4ad3);})[_0xd81f('0x14')](function(_0x91ae48){logger[_0xd81f('0x10')](_0xd81f('0x27'),_0x91ae48[_0xd81f('0x13')],_0x587702);_0x5745ff(_0xe52f68[_0xd81f('0x10')](0x1f4,_0x91ae48[_0xd81f('0x13')]));});});};exports[_0xd81f('0x29')]=function(_0xcb093b){var _0x3e1855=this;return new Promise(function(_0x5a5a41,_0x35b4d7){return db[_0xd81f('0x2a')][_0xd81f('0x2b')]()[_0xd81f('0xa')](function(_0x36f325){return db[_0xd81f('0x2c')][_0xd81f('0x2d')](function(_0x57fbc8){return db['CmHopper']['findAll']({'where':_0xcb093b[_0xd81f('0x17')]?_0xcb093b[_0xd81f('0x17')][_0xd81f('0x18')]||null:null,'attributes':_0xcb093b['options']?_0xcb093b['options'][_0xd81f('0x19')]||null:null,'limit':_0xcb093b[_0xd81f('0x17')]?_0xcb093b[_0xd81f('0x17')][_0xd81f('0x1a')]||null:null,'order':_0xcb093b[_0xd81f('0x17')]?_0xcb093b['options'][_0xd81f('0x2e')]||null:null,'transaction':_0x57fbc8,'lock':_0x57fbc8['LOCK'][_0xd81f('0x2f')],'include':[{'model':db[_0xd81f('0x2a')],'as':_0xd81f('0x30'),'attributes':_[_0xd81f('0x31')](_0x36f325)},{'model':db[_0xd81f('0x32')],'as':_0xd81f('0x33'),'attributes':['id',_0xd81f('0x34'),'voicePause']}]})[_0xd81f('0xa')](function(_0x5b7359){var _0x7e6ed2=[];var _0x3b3767=[];for(var _0x4e19cd=0x0;_0x4e19cd<_0x5b7359[_0xd81f('0x35')];_0x4e19cd+=0x1){var _0x4196a8=_0x5b7359[_0x4e19cd][_0xd81f('0x36')];if(_0x4196a8===null){_0x7e6ed2[_0xd81f('0x37')](_0x5b7359[_0x4e19cd][_0xd81f('0x24')](_0xcb093b[_0xd81f('0x25')],{'transaction':_0x57fbc8}));}else if(!_0x3b3767[_0xd81f('0x38')](_0x4196a8)){_0x3b3767[_0xd81f('0x37')](_0x4196a8);_0x7e6ed2['push'](_0x5b7359[_0x4e19cd][_0xd81f('0x24')](_0xcb093b[_0xd81f('0x25')],{'transaction':_0x57fbc8}));}}return BPromise[_0xd81f('0x39')](_0x7e6ed2);});})[_0xd81f('0xa')](function(_0x3713b6){logger[_0xd81f('0xb')](_0xd81f('0x29'),_0xcb093b);logger[_0xd81f('0xd')](_0xd81f('0x29'),_0xcb093b,JSON[_0xd81f('0xf')](_0x3713b6));_0x5a5a41(_0x3713b6);})[_0xd81f('0x14')](function(_0x53c4e3){logger[_0xd81f('0x10')](_0xd81f('0x29'),_0x53c4e3[_0xd81f('0x13')],_0xcb093b);_0x35b4d7(_0x3e1855[_0xd81f('0x10')](0x1f4,_0x53c4e3['message']));});});});};exports[_0xd81f('0x3a')]=function(_0x45b25b){var _0x1d3bd2=this;return new Promise(function(_0x862316,_0x4c7fb5){return db[_0xd81f('0x2c')][_0xd81f('0x2d')](function(_0x8475c2){return db['CmHopperFinal'][_0xd81f('0x21')](_0x45b25b[_0xd81f('0x25')],{'raw':_0x45b25b[_0xd81f('0x17')]?_0x45b25b[_0xd81f('0x17')][_0xd81f('0x26')]===undefined?!![]:![]:!![],'transaction':_0x8475c2})['then'](function(){return db['CmHopper'][_0xd81f('0x28')]({'where':_0x45b25b[_0xd81f('0x17')]?_0x45b25b[_0xd81f('0x17')]['where']||null:null,'transaction':_0x8475c2});});})[_0xd81f('0xa')](function(_0x5701db){logger['info'](_0xd81f('0x3a'),_0x45b25b);logger[_0xd81f('0xd')](_0xd81f('0x3a'),_0x45b25b,JSON[_0xd81f('0xf')](_0x5701db));_0x862316(_0x5701db);})['catch'](function(_0x3292ab){logger['error'](_0xd81f('0x3a'),_0x3292ab[_0xd81f('0x13')],_0x45b25b);_0x4c7fb5(_0x1d3bd2[_0xd81f('0x10')](0x1f4,_0x3292ab[_0xd81f('0x13')]));});});};exports[_0xd81f('0x3b')]=function(_0x460fd5){var _0x439dbf=this;return new Promise(function(_0x2c3466,_0x107c04){return db[_0xd81f('0x23')][_0xd81f('0x16')]({'raw':_0x460fd5[_0xd81f('0x17')]?_0x460fd5['options'][_0xd81f('0x26')]===undefined?!![]:![]:!![],'where':_0x460fd5[_0xd81f('0x17')]?_0x460fd5[_0xd81f('0x17')][_0xd81f('0x18')]||null:null,'attributes':[[db[_0xd81f('0x2c')]['fn'](_0xd81f('0x3c'),db[_0xd81f('0x2c')]['fn']('IF',db['sequelize'][_0xd81f('0x3d')](_0xd81f('0x3e')+util['format']('\x22%s\x22',moment()[_0xd81f('0x3f')]('YYYY-MM-DD\x20HH:mm:ss'))+_0xd81f('0x40')))),'contactsRescheduled']]})['then'](function(_0x3d51a3){logger[_0xd81f('0xb')](_0xd81f('0x3b'),_0x460fd5);logger[_0xd81f('0xd')](_0xd81f('0x3b'),_0x460fd5,JSON[_0xd81f('0xf')](_0x3d51a3));_0x2c3466(_0x3d51a3);})[_0xd81f('0x14')](function(_0x4fc5f6){logger['error'](_0xd81f('0x3b'),_0x4fc5f6[_0xd81f('0x13')],_0x460fd5);_0x107c04(_0x439dbf['error'](0x1f4,_0x4fc5f6[_0xd81f('0x13')]));});});};exports[_0xd81f('0x41')]=function(_0x59b581){var _0x249246=this;return new Promise(function(_0x4d5225,_0x2637cf){return db[_0xd81f('0x2a')][_0xd81f('0x2b')]()[_0xd81f('0xa')](function(_0x161f34){return db[_0xd81f('0x2c')][_0xd81f('0x2d')](function(_0x5ee4b1){return db[_0xd81f('0x23')][_0xd81f('0x16')]({'where':_0x59b581['options']?_0x59b581[_0xd81f('0x17')][_0xd81f('0x18')]||null:null,'attributes':_0x59b581[_0xd81f('0x17')]?_0x59b581[_0xd81f('0x17')][_0xd81f('0x19')]||null:null,'limit':0x1,'order':_0x59b581['options']?_0x59b581[_0xd81f('0x17')][_0xd81f('0x2e')]||null:null,'group':db[_0xd81f('0x23')][_0xd81f('0x36')],'transaction':_0x5ee4b1,'lock':_0x5ee4b1[_0xd81f('0x42')][_0xd81f('0x2f')],'include':_0x59b581[_0xd81f('0x17')]?_0x59b581[_0xd81f('0x17')][_0xd81f('0x1b')]?_['map'](_0x59b581[_0xd81f('0x17')][_0xd81f('0x1b')],function(_0x7803d1){return{'model':db[_0x7803d1[_0xd81f('0x1d')]],'as':_0x7803d1['as'],'attributes':_0x7803d1[_0xd81f('0x19')],'include':_0x7803d1[_0xd81f('0x1b')]?_[_0xd81f('0x1c')](_0x7803d1[_0xd81f('0x1b')],function(_0x4f8e7a){return{'model':db[_0x4f8e7a[_0xd81f('0x1d')]],'as':_0x4f8e7a['as'],'attributes':_0x4f8e7a['attributes'],'include':_0x4f8e7a['include']?_[_0xd81f('0x1c')](_0x4f8e7a[_0xd81f('0x1b')],function(_0x23a56d){return{'model':db[_0x23a56d[_0xd81f('0x1d')]],'as':_0x23a56d['as'],'attributes':_0x23a56d[_0xd81f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd81f('0xa')](function(_0x33fa53){var _0x135f7c=[];for(var _0x111f9d=0x0;_0x111f9d<_0x33fa53[_0xd81f('0x35')];_0x111f9d+=0x1){_0x135f7c[_0xd81f('0x37')](_0x33fa53[_0x111f9d]['update'](_0x59b581[_0xd81f('0x25')],{'transaction':_0x5ee4b1}));}return BPromise['all'](_0x135f7c);});})[_0xd81f('0xa')](function(_0xf21beb){logger['info'](_0xd81f('0x41'),_0x59b581);logger[_0xd81f('0xd')](_0xd81f('0x41'),_0x59b581,JSON['stringify'](_0xf21beb));_0x4d5225(_0xf21beb);})[_0xd81f('0x14')](function(_0x5db21b){logger[_0xd81f('0x10')](_0xd81f('0x41'),_0x5db21b[_0xd81f('0x13')],_0x59b581);_0x2637cf(_0x249246[_0xd81f('0x10')](0x1f4,_0x5db21b[_0xd81f('0x13')]));});});});};exports[_0xd81f('0x43')]=function(_0x325d1a){var _0x1eb364=this;return new Promise(function(_0x3b0776,_0x187e66){db[_0xd81f('0x2a')][_0xd81f('0x2b')]()[_0xd81f('0xa')](function(_0x4afae2){return db[_0xd81f('0x23')][_0xd81f('0x16')]({'raw':_0x325d1a[_0xd81f('0x17')]?_0x325d1a[_0xd81f('0x17')][_0xd81f('0x26')]===undefined?!![]:![]:!![],'where':_0x325d1a[_0xd81f('0x17')]?_0x325d1a[_0xd81f('0x17')]['where']||null:null,'attributes':_0x325d1a[_0xd81f('0x17')]?_0x325d1a[_0xd81f('0x17')][_0xd81f('0x19')]||null:null,'limit':_0x325d1a[_0xd81f('0x17')]?_0x325d1a[_0xd81f('0x17')][_0xd81f('0x1a')]||null:null,'include':_0x325d1a[_0xd81f('0x17')]?_0x325d1a['options']['include']?_[_0xd81f('0x1c')](_0x325d1a[_0xd81f('0x17')][_0xd81f('0x1b')],function(_0x30a64b){return{'model':db[_0x30a64b[_0xd81f('0x1d')]],'as':_0x30a64b['as'],'attributes':_0x30a64b['as']===_0xd81f('0x30')?_['keys'](_0x4afae2):_0x30a64b['attributes'],'include':_0x30a64b[_0xd81f('0x1b')]?_[_0xd81f('0x1c')](_0x30a64b['include'],function(_0x11b08a){return{'model':db[_0x11b08a[_0xd81f('0x1d')]],'as':_0x11b08a['as'],'attributes':_0x11b08a[_0xd81f('0x19')],'include':_0x11b08a[_0xd81f('0x1b')]?_[_0xd81f('0x1c')](_0x11b08a['include'],function(_0x34ead4){return{'model':db[_0x34ead4[_0xd81f('0x1d')]],'as':_0x34ead4['as'],'attributes':_0x34ead4[_0xd81f('0x19')]};}):[]};}):[]};}):[]:[]})[_0xd81f('0xa')](function(_0x76deab){logger[_0xd81f('0xb')](_0xd81f('0x15'),_0x325d1a);logger['debug']('GetCmHopper',_0x325d1a,JSON[_0xd81f('0xf')](_0x76deab));_0x3b0776(_0x76deab);})[_0xd81f('0x14')](function(_0x4e4aad){logger[_0xd81f('0x10')](_0xd81f('0x15'),_0x4e4aad[_0xd81f('0x13')],_0x325d1a);_0x187e66(_0x1eb364[_0xd81f('0x10')](0x1f4,_0x4e4aad['message']));});});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 77e4bfc..1130f0f 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 _0xa3f2=['show','post','create','getPreview','put','update','delete','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopper.controller','get','isAuthenticated','index','describe','getOpenContacts','/:id'];(function(_0x2f1762,_0xab43df){var _0x8ab21=function(_0xf6c1f5){while(--_0xf6c1f5){_0x2f1762['push'](_0x2f1762['shift']());}};_0x8ab21(++_0xab43df);}(_0xa3f2,0x152));var _0x2a3f=function(_0x479574,_0x3f86b1){_0x479574=_0x479574-0x0;var _0x44522d=_0xa3f2[_0x479574];return _0x44522d;};'use strict';var multer=require(_0x2a3f('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x2a3f('0x1'));var express=require(_0x2a3f('0x2'));var router=express[_0x2a3f('0x3')]();var fs_extra=require(_0x2a3f('0x4'));var auth=require(_0x2a3f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2a3f('0x6'));var controller=require(_0x2a3f('0x7'));router[_0x2a3f('0x8')]('/',auth[_0x2a3f('0x9')](),controller[_0x2a3f('0xa')]);router[_0x2a3f('0x8')]('/describe',auth[_0x2a3f('0x9')](),controller[_0x2a3f('0xb')]);router['get']('/opencontacts',auth[_0x2a3f('0x9')](),controller[_0x2a3f('0xc')]);router[_0x2a3f('0x8')](_0x2a3f('0xd'),auth[_0x2a3f('0x9')](),controller[_0x2a3f('0xe')]);router[_0x2a3f('0xf')]('/',auth[_0x2a3f('0x9')](),controller[_0x2a3f('0x10')]);router[_0x2a3f('0xf')]('/preview',auth[_0x2a3f('0x9')](),controller[_0x2a3f('0x11')]);router[_0x2a3f('0x12')](_0x2a3f('0xd'),auth[_0x2a3f('0x9')](),controller[_0x2a3f('0x13')]);router[_0x2a3f('0x14')]('/:id',auth[_0x2a3f('0x9')](),controller['destroy']);module[_0x2a3f('0x15')]=router; \ No newline at end of file +var _0x905c=['getOpenContacts','/:id','show','post','create','/preview','getPreview','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../config/environment','./cmHopper.controller','get','index','/describe','isAuthenticated','describe','/opencontacts'];(function(_0x335937,_0x3a4bcb){var _0x4c89d0=function(_0x28a048){while(--_0x28a048){_0x335937['push'](_0x335937['shift']());}};_0x4c89d0(++_0x3a4bcb);}(_0x905c,0x9c));var _0xc905=function(_0xf760b0,_0x5d9ff5){_0xf760b0=_0xf760b0-0x0;var _0x5d948e=_0x905c[_0xf760b0];return _0x5d948e;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc905('0x0'));var express=require(_0xc905('0x1'));var router=express[_0xc905('0x2')]();var fs_extra=require(_0xc905('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc905('0x4'));var controller=require(_0xc905('0x5'));router[_0xc905('0x6')]('/',auth['isAuthenticated'](),controller[_0xc905('0x7')]);router[_0xc905('0x6')](_0xc905('0x8'),auth[_0xc905('0x9')](),controller[_0xc905('0xa')]);router[_0xc905('0x6')](_0xc905('0xb'),auth[_0xc905('0x9')](),controller[_0xc905('0xc')]);router['get'](_0xc905('0xd'),auth[_0xc905('0x9')](),controller[_0xc905('0xe')]);router[_0xc905('0xf')]('/',auth[_0xc905('0x9')](),controller[_0xc905('0x10')]);router[_0xc905('0xf')](_0xc905('0x11'),auth[_0xc905('0x9')](),controller[_0xc905('0x12')]);router[_0xc905('0x13')](_0xc905('0xd'),auth[_0xc905('0x9')](),controller[_0xc905('0x14')]);router[_0xc905('0x15')]('/:id',auth[_0xc905('0x9')](),controller[_0xc905('0x16')]);module[_0xc905('0x17')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 0c400cd..fb8ca33 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 _0x4745=['contactListQueue','moment','sequelize','exports','STRING','INTEGER'];(function(_0x25cbbb,_0x2f490f){var _0x2e995a=function(_0x491673){while(--_0x491673){_0x25cbbb['push'](_0x25cbbb['shift']());}};_0x2e995a(++_0x2f490f);}(_0x4745,0x1e7));var _0x5474=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x4745[_0x46aff0];return _0x9d78cf;};'use strict';var moment=require(_0x5474('0x0'));var Sequelize=require(_0x5474('0x1'));module[_0x5474('0x2')]={'phone':{'type':Sequelize[_0x5474('0x3')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x5474('0x4')],'unique':_0x5474('0x5')},'ListId':{'type':Sequelize[_0x5474('0x4')],'unique':_0x5474('0x5')},'VoiceQueueId':{'type':Sequelize[_0x5474('0x4')],'unique':_0x5474('0x5')}}; \ No newline at end of file +var _0xb85a=['contactListQueue','sequelize','exports','STRING','INTEGER'];(function(_0x122111,_0x2cec78){var _0x1bac28=function(_0x187a94){while(--_0x187a94){_0x122111['push'](_0x122111['shift']());}};_0x1bac28(++_0x2cec78);}(_0xb85a,0xb0));var _0xab85=function(_0x11f1fd,_0xce95a8){_0x11f1fd=_0x11f1fd-0x0;var _0x2d1215=_0xb85a[_0x11f1fd];return _0x2d1215;};'use strict';var moment=require('moment');var Sequelize=require(_0xab85('0x0'));module[_0xab85('0x1')]={'phone':{'type':Sequelize[_0xab85('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0xab85('0x3')],'unique':_0xab85('0x4')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0xab85('0x3')],'unique':_0xab85('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index a106b7a..5145ced 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 _0x5ad8=['error','name','send','map','CmHopperBlack','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','keys','find','body','zip-dir','fast-json-patch','bluebird','mustache','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4b91fb,_0xe92b69){var _0x5eca8e=function(_0x3c859f){while(--_0x3c859f){_0x4b91fb['push'](_0x4b91fb['shift']());}};_0x5eca8e(++_0xe92b69);}(_0x5ad8,0xef));var _0x85ad=function(_0xb5b530,_0x1c89fc){_0xb5b530=_0xb5b530-0x0;var _0x58b0fb=_0x5ad8[_0xb5b530];return _0x58b0fb;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x85ad('0x0'));var jsonpatch=require(_0x85ad('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x85ad('0x2'));var Mustache=require(_0x85ad('0x3'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x85ad('0x4'));var fs=require('fs');var fs_extra=require(_0x85ad('0x5'));var _=require(_0x85ad('0x6'));var squel=require(_0x85ad('0x7'));var crypto=require(_0x85ad('0x8'));var jsforce=require(_0x85ad('0x9'));var deskjs=require(_0x85ad('0xa'));var toCsv=require(_0x85ad('0xb'));var querystring=require(_0x85ad('0xc'));var Papa=require(_0x85ad('0xd'));var Redis=require(_0x85ad('0xe'));var authService=require(_0x85ad('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x85ad('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x85ad('0x11'))(_0x85ad('0x12'));var utils=require('../../config/utils');var config=require(_0x85ad('0x13'));var licenseUtil=require(_0x85ad('0x14'));var db=require(_0x85ad('0x15'))['db'];function respondWithStatusCode(_0x583f70,_0x3732cf){_0x3732cf=_0x3732cf||0xcc;return function(_0x3953ca){if(_0x3953ca){return _0x583f70[_0x85ad('0x16')](_0x3732cf);}return _0x583f70[_0x85ad('0x17')](_0x3732cf)[_0x85ad('0x18')]();};}function respondWithResult(_0x2c34c1,_0x5853fe){_0x5853fe=_0x5853fe||0xc8;return function(_0x5baa7e){if(_0x5baa7e){return _0x2c34c1['status'](_0x5853fe)[_0x85ad('0x19')](_0x5baa7e);}};}function respondWithFilteredResult(_0xd936,_0x35d7f8){return function(_0x177194){if(_0x177194){var _0x409ff2=typeof _0x35d7f8[_0x85ad('0x1a')]===_0x85ad('0x1b')&&typeof _0x35d7f8['limit']===_0x85ad('0x1b');var _0x2f1af4=_0x177194[_0x85ad('0x1c')];var _0x4a4823=_0x409ff2?0x0:_0x35d7f8[_0x85ad('0x1a')];var _0x31ed0b=_0x409ff2?_0x177194[_0x85ad('0x1c')]:_0x35d7f8[_0x85ad('0x1a')]+_0x35d7f8['limit'];var _0x179072;if(_0x31ed0b>=_0x2f1af4){_0x31ed0b=_0x2f1af4;_0x179072=0xc8;}else{_0x179072=0xce;}_0xd936['status'](_0x179072);return _0xd936[_0x85ad('0x1d')](_0x85ad('0x1e'),_0x4a4823+'-'+_0x31ed0b+'/'+_0x2f1af4)[_0x85ad('0x19')](_0x177194);}return null;};}function patchUpdates(_0x564a47){return function(_0x2eae28){try{jsonpatch[_0x85ad('0x1f')](_0x2eae28,_0x564a47,!![]);}catch(_0x5d2572){return BPromise[_0x85ad('0x20')](_0x5d2572);}return _0x2eae28[_0x85ad('0x21')]();};}function saveUpdates(_0x2ff4be,_0xc7e6b){return function(_0x4d10ca){if(_0x4d10ca){return _0x4d10ca[_0x85ad('0x22')](_0x2ff4be)[_0x85ad('0x23')](function(_0x10f1e6){return _0x10f1e6;});}return null;};}function removeEntity(_0x55b359,_0x428746){return function(_0x577fc2){if(_0x577fc2){return _0x577fc2[_0x85ad('0x24')]()[_0x85ad('0x23')](function(){_0x55b359[_0x85ad('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb2137c,_0x219c14){return function(_0x46667a){if(!_0x46667a){_0xb2137c[_0x85ad('0x16')](0x194);}return _0x46667a;};}function handleError(_0x4781f1,_0x225a57){_0x225a57=_0x225a57||0x1f4;return function(_0xb0a91e){logger[_0x85ad('0x25')](_0xb0a91e['stack']);if(_0xb0a91e[_0x85ad('0x26')]){delete _0xb0a91e[_0x85ad('0x26')];}_0x4781f1[_0x85ad('0x17')](_0x225a57)[_0x85ad('0x27')](_0xb0a91e);};}exports['index']=function(_0x158838,_0x1e23ef){var _0x49b0c0={},_0x3b69b4={},_0x144a12={'count':0x0,'rows':[]};var _0x4594b5=_[_0x85ad('0x28')](db[_0x85ad('0x29')][_0x85ad('0x2a')],function(_0x2be00c){return{'name':_0x2be00c[_0x85ad('0x2b')],'type':_0x2be00c[_0x85ad('0x2c')]['key']};});_0x3b69b4[_0x85ad('0x2d')]=_[_0x85ad('0x28')](_0x4594b5,_0x85ad('0x26'));_0x3b69b4[_0x85ad('0x2e')]=_['keys'](_0x158838[_0x85ad('0x2e')]);_0x3b69b4[_0x85ad('0x2f')]=_[_0x85ad('0x30')](_0x3b69b4['model'],_0x3b69b4[_0x85ad('0x2e')]);_0x49b0c0[_0x85ad('0x31')]=_['intersection'](_0x3b69b4[_0x85ad('0x2d')],qs['fields'](_0x158838[_0x85ad('0x2e')][_0x85ad('0x32')]));_0x49b0c0[_0x85ad('0x31')]=_0x49b0c0[_0x85ad('0x31')][_0x85ad('0x33')]?_0x49b0c0[_0x85ad('0x31')]:_0x3b69b4[_0x85ad('0x2d')];if(!_0x158838[_0x85ad('0x2e')][_0x85ad('0x34')](_0x85ad('0x35'))){_0x49b0c0['limit']=qs[_0x85ad('0x36')](_0x158838[_0x85ad('0x2e')][_0x85ad('0x36')]);_0x49b0c0[_0x85ad('0x1a')]=qs[_0x85ad('0x1a')](_0x158838['query']['offset']);}_0x49b0c0['order']=qs[_0x85ad('0x37')](_0x158838['query'][_0x85ad('0x37')]);_0x49b0c0[_0x85ad('0x38')]=qs[_0x85ad('0x2f')](_[_0x85ad('0x39')](_0x158838[_0x85ad('0x2e')],_0x3b69b4[_0x85ad('0x2f')]),_0x4594b5);if(_0x158838[_0x85ad('0x2e')][_0x85ad('0x3a')]){_0x49b0c0[_0x85ad('0x38')]=_[_0x85ad('0x3b')](_0x49b0c0['where'],{'$or':_[_0x85ad('0x28')](_0x4594b5,function(_0xb3eaf){if(_0xb3eaf[_0x85ad('0x2c')]!==_0x85ad('0x3c')){var _0x4172f0={};_0x4172f0[_0xb3eaf[_0x85ad('0x26')]]={'$like':'%'+_0x158838[_0x85ad('0x2e')]['filter']+'%'};return _0x4172f0;}})});}_0x49b0c0=_[_0x85ad('0x3b')]({},_0x49b0c0,_0x158838[_0x85ad('0x3d')]);var _0x2fdc67={'where':_0x49b0c0[_0x85ad('0x38')]};return db[_0x85ad('0x29')][_0x85ad('0x1c')](_0x2fdc67)[_0x85ad('0x23')](function(_0x52d221){_0x144a12[_0x85ad('0x1c')]=_0x52d221;if(_0x158838[_0x85ad('0x2e')][_0x85ad('0x3e')]){_0x49b0c0[_0x85ad('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x49b0c0);})[_0x85ad('0x23')](function(_0x3b42d5){_0x144a12['rows']=_0x3b42d5;return _0x144a12;})[_0x85ad('0x23')](respondWithFilteredResult(_0x1e23ef,_0x49b0c0))[_0x85ad('0x40')](handleError(_0x1e23ef,null));};exports['show']=function(_0x34b7f1,_0x45524f){var _0x2147eb={'raw':!![],'where':{'id':_0x34b7f1[_0x85ad('0x41')]['id']}},_0x4e85bc={};_0x4e85bc[_0x85ad('0x2d')]=_[_0x85ad('0x42')](db['CmHopperBlack'][_0x85ad('0x2a')]);_0x4e85bc[_0x85ad('0x2e')]=_[_0x85ad('0x42')](_0x34b7f1[_0x85ad('0x2e')]);_0x4e85bc[_0x85ad('0x2f')]=_[_0x85ad('0x30')](_0x4e85bc[_0x85ad('0x2d')],_0x4e85bc[_0x85ad('0x2e')]);_0x2147eb['attributes']=_[_0x85ad('0x30')](_0x4e85bc[_0x85ad('0x2d')],qs[_0x85ad('0x32')](_0x34b7f1[_0x85ad('0x2e')][_0x85ad('0x32')]));_0x2147eb[_0x85ad('0x31')]=_0x2147eb['attributes'][_0x85ad('0x33')]?_0x2147eb['attributes']:_0x4e85bc[_0x85ad('0x2d')];if(_0x34b7f1[_0x85ad('0x2e')]['includeAll']){_0x2147eb[_0x85ad('0x3f')]=[{'all':!![]}];}_0x2147eb=_[_0x85ad('0x3b')]({},_0x2147eb,_0x34b7f1[_0x85ad('0x3d')]);return db['CmHopperBlack'][_0x85ad('0x43')](_0x2147eb)[_0x85ad('0x23')](handleEntityNotFound(_0x45524f,null))[_0x85ad('0x23')](respondWithResult(_0x45524f,null))[_0x85ad('0x40')](handleError(_0x45524f,null));};exports[_0x85ad('0x22')]=function(_0x5761ba,_0x55802e){if(_0x5761ba[_0x85ad('0x44')]['id']){delete _0x5761ba[_0x85ad('0x44')]['id'];}return db['CmHopperBlack'][_0x85ad('0x43')]({'where':{'id':_0x5761ba[_0x85ad('0x41')]['id']}})['then'](handleEntityNotFound(_0x55802e,null))[_0x85ad('0x23')](saveUpdates(_0x5761ba['body'],null))[_0x85ad('0x23')](respondWithResult(_0x55802e,null))[_0x85ad('0x40')](handleError(_0x55802e,null));};exports['destroy']=function(_0x31bd63,_0x281183){return db[_0x85ad('0x29')]['find']({'where':{'id':_0x31bd63[_0x85ad('0x41')]['id']}})[_0x85ad('0x23')](handleEntityNotFound(_0x281183,null))['then'](removeEntity(_0x281183,null))['catch'](handleError(_0x281183,null));};exports['describe']=function(_0x2cb097,_0x3a8ecc){return db[_0x85ad('0x29')]['describe']()['then'](respondWithResult(_0x3a8ecc,null))[_0x85ad('0x40')](handleError(_0x3a8ecc,null));}; \ No newline at end of file +var _0x5c1a=['sox','to-csv','ejs','lodash','squel','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','reject','save','update','destroy','then','end','stack','name','index','map','CmHopperBlack','rawAttributes','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','body','describe','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache'];(function(_0x5e7754,_0x3c180f){var _0x13aee9=function(_0x12e356){while(--_0x12e356){_0x5e7754['push'](_0x5e7754['shift']());}};_0x13aee9(++_0x3c180f);}(_0x5c1a,0x13f));var _0xa5c1=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x5c1a[_0x101e7b];return _0x4995c0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa5c1('0x0'));var zipdir=require(_0xa5c1('0x1'));var jsonpatch=require(_0xa5c1('0x2'));var rp=require('request-promise');var moment=require(_0xa5c1('0x3'));var BPromise=require(_0xa5c1('0x4'));var Mustache=require(_0xa5c1('0x5'));var util=require('util');var path=require('path');var sox=require(_0xa5c1('0x6'));var csv=require(_0xa5c1('0x7'));var ejs=require(_0xa5c1('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xa5c1('0x9'));var squel=require(_0xa5c1('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa5c1('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa5c1('0xb'));var as=require(_0xa5c1('0xc'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa5c1('0xd'))(_0xa5c1('0xe'));var utils=require(_0xa5c1('0xf'));var config=require(_0xa5c1('0x10'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x450d24,_0xc019b9){_0xc019b9=_0xc019b9||0xcc;return function(_0x18efb7){if(_0x18efb7){return _0x450d24[_0xa5c1('0x11')](_0xc019b9);}return _0x450d24[_0xa5c1('0x12')](_0xc019b9)['end']();};}function respondWithResult(_0x4e6717,_0x547576){_0x547576=_0x547576||0xc8;return function(_0x4558dd){if(_0x4558dd){return _0x4e6717['status'](_0x547576)[_0xa5c1('0x13')](_0x4558dd);}};}function respondWithFilteredResult(_0x290ee3,_0xeeddd9){return function(_0x3704ae){if(_0x3704ae){var _0x17ca53=typeof _0xeeddd9[_0xa5c1('0x14')]===_0xa5c1('0x15')&&typeof _0xeeddd9[_0xa5c1('0x16')]===_0xa5c1('0x15');var _0x3c816a=_0x3704ae[_0xa5c1('0x17')];var _0x46756c=_0x17ca53?0x0:_0xeeddd9[_0xa5c1('0x14')];var _0x5f5735=_0x17ca53?_0x3704ae['count']:_0xeeddd9[_0xa5c1('0x14')]+_0xeeddd9[_0xa5c1('0x16')];var _0x37d88a;if(_0x5f5735>=_0x3c816a){_0x5f5735=_0x3c816a;_0x37d88a=0xc8;}else{_0x37d88a=0xce;}_0x290ee3[_0xa5c1('0x12')](_0x37d88a);return _0x290ee3['set']('Content-Range',_0x46756c+'-'+_0x5f5735+'/'+_0x3c816a)['json'](_0x3704ae);}return null;};}function patchUpdates(_0x5ad99c){return function(_0x198886){try{jsonpatch['apply'](_0x198886,_0x5ad99c,!![]);}catch(_0x1fb55f){return BPromise[_0xa5c1('0x18')](_0x1fb55f);}return _0x198886[_0xa5c1('0x19')]();};}function saveUpdates(_0x2b54de,_0x105020){return function(_0x111b57){if(_0x111b57){return _0x111b57[_0xa5c1('0x1a')](_0x2b54de)['then'](function(_0x21c728){return _0x21c728;});}return null;};}function removeEntity(_0x307bd8,_0x348494){return function(_0x5713b0){if(_0x5713b0){return _0x5713b0[_0xa5c1('0x1b')]()[_0xa5c1('0x1c')](function(){_0x307bd8[_0xa5c1('0x12')](0xcc)[_0xa5c1('0x1d')]();});}};}function handleEntityNotFound(_0x2480e7,_0x228110){return function(_0x2f7d60){if(!_0x2f7d60){_0x2480e7[_0xa5c1('0x11')](0x194);}return _0x2f7d60;};}function handleError(_0x4b4e37,_0x48ef20){_0x48ef20=_0x48ef20||0x1f4;return function(_0x40a53b){logger['error'](_0x40a53b[_0xa5c1('0x1e')]);if(_0x40a53b[_0xa5c1('0x1f')]){delete _0x40a53b[_0xa5c1('0x1f')];}_0x4b4e37[_0xa5c1('0x12')](_0x48ef20)['send'](_0x40a53b);};}exports[_0xa5c1('0x20')]=function(_0x21ce25,_0x566c21){var _0x556871={},_0x19c4f2={},_0x1026ec={'count':0x0,'rows':[]};var _0x55e23d=_[_0xa5c1('0x21')](db[_0xa5c1('0x22')][_0xa5c1('0x23')],function(_0x4526af){return{'name':_0x4526af['fieldName'],'type':_0x4526af[_0xa5c1('0x24')][_0xa5c1('0x25')]};});_0x19c4f2[_0xa5c1('0x26')]=_[_0xa5c1('0x21')](_0x55e23d,_0xa5c1('0x1f'));_0x19c4f2['query']=_[_0xa5c1('0x27')](_0x21ce25[_0xa5c1('0x28')]);_0x19c4f2[_0xa5c1('0x29')]=_['intersection'](_0x19c4f2[_0xa5c1('0x26')],_0x19c4f2['query']);_0x556871['attributes']=_[_0xa5c1('0x2a')](_0x19c4f2[_0xa5c1('0x26')],qs[_0xa5c1('0x2b')](_0x21ce25[_0xa5c1('0x28')][_0xa5c1('0x2b')]));_0x556871[_0xa5c1('0x2c')]=_0x556871[_0xa5c1('0x2c')][_0xa5c1('0x2d')]?_0x556871[_0xa5c1('0x2c')]:_0x19c4f2[_0xa5c1('0x26')];if(!_0x21ce25['query'][_0xa5c1('0x2e')](_0xa5c1('0x2f'))){_0x556871[_0xa5c1('0x16')]=qs[_0xa5c1('0x16')](_0x21ce25[_0xa5c1('0x28')]['limit']);_0x556871['offset']=qs['offset'](_0x21ce25[_0xa5c1('0x28')][_0xa5c1('0x14')]);}_0x556871[_0xa5c1('0x30')]=qs[_0xa5c1('0x31')](_0x21ce25[_0xa5c1('0x28')][_0xa5c1('0x31')]);_0x556871['where']=qs[_0xa5c1('0x29')](_[_0xa5c1('0x32')](_0x21ce25[_0xa5c1('0x28')],_0x19c4f2[_0xa5c1('0x29')]),_0x55e23d);if(_0x21ce25['query'][_0xa5c1('0x33')]){_0x556871[_0xa5c1('0x34')]=_[_0xa5c1('0x35')](_0x556871['where'],{'$or':_['map'](_0x55e23d,function(_0x4eab03){if(_0x4eab03['type']!=='VIRTUAL'){var _0x41e115={};_0x41e115[_0x4eab03[_0xa5c1('0x1f')]]={'$like':'%'+_0x21ce25[_0xa5c1('0x28')][_0xa5c1('0x33')]+'%'};return _0x41e115;}})});}_0x556871=_[_0xa5c1('0x35')]({},_0x556871,_0x21ce25[_0xa5c1('0x36')]);var _0x4e9894={'where':_0x556871[_0xa5c1('0x34')]};return db['CmHopperBlack'][_0xa5c1('0x17')](_0x4e9894)[_0xa5c1('0x1c')](function(_0x5601b3){_0x1026ec['count']=_0x5601b3;if(_0x21ce25[_0xa5c1('0x28')][_0xa5c1('0x37')]){_0x556871[_0xa5c1('0x38')]=[{'all':!![]}];}return db['CmHopperBlack'][_0xa5c1('0x39')](_0x556871);})[_0xa5c1('0x1c')](function(_0x36dd46){_0x1026ec[_0xa5c1('0x3a')]=_0x36dd46;return _0x1026ec;})['then'](respondWithFilteredResult(_0x566c21,_0x556871))[_0xa5c1('0x3b')](handleError(_0x566c21,null));};exports[_0xa5c1('0x3c')]=function(_0x196280,_0x23facf){var _0x158dbc={'raw':!![],'where':{'id':_0x196280[_0xa5c1('0x3d')]['id']}},_0x10d8a2={};_0x10d8a2[_0xa5c1('0x26')]=_[_0xa5c1('0x27')](db[_0xa5c1('0x22')]['rawAttributes']);_0x10d8a2['query']=_[_0xa5c1('0x27')](_0x196280[_0xa5c1('0x28')]);_0x10d8a2[_0xa5c1('0x29')]=_[_0xa5c1('0x2a')](_0x10d8a2[_0xa5c1('0x26')],_0x10d8a2['query']);_0x158dbc['attributes']=_[_0xa5c1('0x2a')](_0x10d8a2['model'],qs[_0xa5c1('0x2b')](_0x196280['query'][_0xa5c1('0x2b')]));_0x158dbc['attributes']=_0x158dbc[_0xa5c1('0x2c')][_0xa5c1('0x2d')]?_0x158dbc['attributes']:_0x10d8a2['model'];if(_0x196280[_0xa5c1('0x28')]['includeAll']){_0x158dbc[_0xa5c1('0x38')]=[{'all':!![]}];}_0x158dbc=_[_0xa5c1('0x35')]({},_0x158dbc,_0x196280[_0xa5c1('0x36')]);return db['CmHopperBlack'][_0xa5c1('0x3e')](_0x158dbc)[_0xa5c1('0x1c')](handleEntityNotFound(_0x23facf,null))['then'](respondWithResult(_0x23facf,null))[_0xa5c1('0x3b')](handleError(_0x23facf,null));};exports[_0xa5c1('0x1a')]=function(_0xa18f99,_0x51c341){if(_0xa18f99[_0xa5c1('0x3f')]['id']){delete _0xa18f99['body']['id'];}return db[_0xa5c1('0x22')]['find']({'where':{'id':_0xa18f99[_0xa5c1('0x3d')]['id']}})['then'](handleEntityNotFound(_0x51c341,null))['then'](saveUpdates(_0xa18f99[_0xa5c1('0x3f')],null))[_0xa5c1('0x1c')](respondWithResult(_0x51c341,null))[_0xa5c1('0x3b')](handleError(_0x51c341,null));};exports[_0xa5c1('0x1b')]=function(_0x182ed6,_0xcf63a0){return db[_0xa5c1('0x22')][_0xa5c1('0x3e')]({'where':{'id':_0x182ed6[_0xa5c1('0x3d')]['id']}})[_0xa5c1('0x1c')](handleEntityNotFound(_0xcf63a0,null))[_0xa5c1('0x1c')](removeEntity(_0xcf63a0,null))[_0xa5c1('0x3b')](handleError(_0xcf63a0,null));};exports[_0xa5c1('0x40')]=function(_0x15360e,_0x24110e){return db['CmHopperBlack'][_0xa5c1('0x40')]()[_0xa5c1('0x1c')](respondWithResult(_0x24110e,null))[_0xa5c1('0x3b')](handleError(_0x24110e,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index 89df2cb..9103b38 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 _0xbee0=['moment','request-promise','path','./cmHopperBlack.attributes','define','lodash','../../config/logger','api'];(function(_0x122728,_0x456b42){var _0x4739c3=function(_0x50813b){while(--_0x50813b){_0x122728['push'](_0x122728['shift']());}};_0x4739c3(++_0x456b42);}(_0xbee0,0xd5));var _0x0bee=function(_0xd5662c,_0x1ee76c){_0xd5662c=_0xd5662c-0x0;var _0x223b32=_0xbee0[_0xd5662c];return _0x223b32;};'use strict';var _=require(_0x0bee('0x0'));var util=require('util');var logger=require(_0x0bee('0x1'))(_0x0bee('0x2'));var moment=require(_0x0bee('0x3'));var BPromise=require('bluebird');var rp=require(_0x0bee('0x4'));var fs=require('fs');var path=require(_0x0bee('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x0bee('0x6'));module['exports']=function(_0x359faa,_0xd787ea){return _0x359faa[_0x0bee('0x7')]('CmHopperBlack',attributes,{'tableName':'cm_hopper_black','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8e69=['request-promise','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','cm_hopper_black','lodash','../../config/logger','api','moment','bluebird'];(function(_0x272638,_0x42b993){var _0x19d027=function(_0x27ac44){while(--_0x27ac44){_0x272638['push'](_0x272638['shift']());}};_0x19d027(++_0x42b993);}(_0x8e69,0x103));var _0x98e6=function(_0x5e5e29,_0x36b17d){_0x5e5e29=_0x5e5e29-0x0;var _0x12a889=_0x8e69[_0x5e5e29];return _0x12a889;};'use strict';var _=require(_0x98e6('0x0'));var util=require('util');var logger=require(_0x98e6('0x1'))(_0x98e6('0x2'));var moment=require(_0x98e6('0x3'));var BPromise=require(_0x98e6('0x4'));var rp=require(_0x98e6('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x98e6('0x6'));var config=require(_0x98e6('0x7'));var attributes=require(_0x98e6('0x8'));module[_0x98e6('0x9')]=function(_0x50e295,_0x36d243){return _0x50e295['define']('CmHopperBlack',attributes,{'tableName':_0x98e6('0xa'),'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 dd180a7..77dbe54 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 _0xa513=['findAll','options','raw','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','limit','DestroyCmHopperBlack','info','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','CmHopperBlack,\x20%s,\x20%s','request\x20sent','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CmHopperBlack'];(function(_0x40c7f7,_0x42bc78){var _0x479755=function(_0x502b1e){while(--_0x502b1e){_0x40c7f7['push'](_0x40c7f7['shift']());}};_0x479755(++_0x42bc78);}(_0xa513,0x94));var _0x3a51=function(_0x7c73e9,_0x203cbb){_0x7c73e9=_0x7c73e9-0x0;var _0x8dd1ee=_0xa513[_0x7c73e9];return _0x8dd1ee;};'use strict';var _=require(_0x3a51('0x0'));var util=require('util');var moment=require(_0x3a51('0x1'));var BPromise=require(_0x3a51('0x2'));var rs=require(_0x3a51('0x3'));var fs=require('fs');var Redis=require(_0x3a51('0x4'));var db=require(_0x3a51('0x5'))['db'];var utils=require(_0x3a51('0x6'));var logger=require(_0x3a51('0x7'))(_0x3a51('0x8'));var config=require(_0x3a51('0x9'));var jayson=require(_0x3a51('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x24e03b,_0x258454,_0x19261a){return new BPromise(function(_0x5e186d,_0x600f55){return client[_0x3a51('0xb')](_0x24e03b,_0x19261a)[_0x3a51('0xc')](function(_0x2bd3ad){logger['info'](_0x3a51('0xd'),_0x258454,_0x3a51('0xe'));logger[_0x3a51('0xf')](_0x3a51('0x10'),_0x258454,_0x3a51('0xe'),JSON[_0x3a51('0x11')](_0x2bd3ad));if(_0x2bd3ad[_0x3a51('0x12')]){if(_0x2bd3ad[_0x3a51('0x12')]['code']===0x1f4){logger[_0x3a51('0x12')](_0x3a51('0xd'),_0x258454,_0x2bd3ad[_0x3a51('0x12')][_0x3a51('0x13')]);return _0x600f55(_0x2bd3ad[_0x3a51('0x12')][_0x3a51('0x13')]);}logger[_0x3a51('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x258454,_0x2bd3ad[_0x3a51('0x12')][_0x3a51('0x13')]);return _0x5e186d(_0x2bd3ad['error'][_0x3a51('0x13')]);}else{logger['info'](_0x3a51('0xd'),_0x258454,_0x3a51('0xe'));_0x5e186d(_0x2bd3ad['result'][_0x3a51('0x13')]);}})[_0x3a51('0x14')](function(_0xd1a06d){logger[_0x3a51('0x12')](_0x3a51('0xd'),_0x258454,_0xd1a06d);_0x600f55(_0xd1a06d);});});}exports['GetCmHopperBlack']=function(_0x3f2c94){var _0x281aa6=this;return new Promise(function(_0x47283a,_0x18aef2){return db[_0x3a51('0x15')][_0x3a51('0x16')]({'raw':_0x3f2c94['options']?_0x3f2c94[_0x3a51('0x17')][_0x3a51('0x18')]===undefined?!![]:![]:!![],'where':_0x3f2c94[_0x3a51('0x17')]?_0x3f2c94[_0x3a51('0x17')]['where']||null:null,'attributes':_0x3f2c94[_0x3a51('0x17')]?_0x3f2c94['options'][_0x3a51('0x19')]||null:null,'limit':_0x3f2c94[_0x3a51('0x17')]?_0x3f2c94[_0x3a51('0x17')]['limit']||null:null,'include':_0x3f2c94[_0x3a51('0x17')]?_0x3f2c94[_0x3a51('0x17')][_0x3a51('0x1a')]?_[_0x3a51('0x1b')](_0x3f2c94['options'][_0x3a51('0x1a')],function(_0x12687e){return{'model':db[_0x12687e[_0x3a51('0x1c')]],'as':_0x12687e['as'],'attributes':_0x12687e['attributes'],'include':_0x12687e[_0x3a51('0x1a')]?_[_0x3a51('0x1b')](_0x12687e[_0x3a51('0x1a')],function(_0x169e1a){return{'model':db[_0x169e1a['model']],'as':_0x169e1a['as'],'attributes':_0x169e1a[_0x3a51('0x19')],'include':_0x169e1a[_0x3a51('0x1a')]?_['map'](_0x169e1a[_0x3a51('0x1a')],function(_0x582cad){return{'model':db[_0x582cad[_0x3a51('0x1c')]],'as':_0x582cad['as'],'attributes':_0x582cad[_0x3a51('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4491e5){logger['info'](_0x3a51('0x1d'),_0x3f2c94);logger[_0x3a51('0xf')]('GetCmHopperBlack',_0x3f2c94,JSON['stringify'](_0x4491e5));_0x47283a(_0x4491e5);})[_0x3a51('0x14')](function(_0x56af85){logger[_0x3a51('0x12')](_0x3a51('0x1d'),_0x56af85[_0x3a51('0x13')],_0x3f2c94);_0x18aef2(_0x281aa6[_0x3a51('0x12')](0x1f4,_0x56af85[_0x3a51('0x13')]));});});};exports[_0x3a51('0x1e')]=function(_0x18dda4){var _0x57f7a4=this;return new Promise(function(_0xa86f40,_0x42e380){return db['CmHopperBlack']['update'](_0x18dda4['body'],{'raw':_0x18dda4[_0x3a51('0x17')]?_0x18dda4[_0x3a51('0x17')][_0x3a51('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x18dda4['options']?_0x18dda4[_0x3a51('0x17')]['where']||null:null,'attributes':_0x18dda4[_0x3a51('0x17')]?_0x18dda4['options'][_0x3a51('0x19')]||null:null,'limit':_0x18dda4[_0x3a51('0x17')]?_0x18dda4['options'][_0x3a51('0x1f')]||null:null})[_0x3a51('0xc')](function(_0x49269d){logger['info']('UpdateCmHopperBlack',_0x18dda4);logger[_0x3a51('0xf')](_0x3a51('0x1e'),_0x18dda4,JSON[_0x3a51('0x11')](_0x49269d));_0xa86f40(_0x49269d);})[_0x3a51('0x14')](function(_0x50a1bd){logger[_0x3a51('0x12')]('UpdateCmHopperBlack',_0x50a1bd['message'],_0x18dda4);_0x42e380(_0x57f7a4[_0x3a51('0x12')](0x1f4,_0x50a1bd[_0x3a51('0x13')]));});});};exports[_0x3a51('0x20')]=function(_0x5833a7){var _0x1efcb6=this;return new Promise(function(_0x1fea33,_0x502db9){return db[_0x3a51('0x15')]['destroy']({'where':_0x5833a7['options']?_0x5833a7[_0x3a51('0x17')]['where']||null:null})[_0x3a51('0xc')](function(_0x3b5e4b){logger[_0x3a51('0x21')](_0x3a51('0x20'),_0x5833a7);logger[_0x3a51('0xf')](_0x3a51('0x20'),_0x5833a7,JSON[_0x3a51('0x11')](_0x3b5e4b));_0x1fea33(_0x3b5e4b);})[_0x3a51('0x14')](function(_0xc00496){logger[_0x3a51('0x12')](_0x3a51('0x20'),_0xc00496[_0x3a51('0x13')],_0x5833a7);_0x502db9(_0x1efcb6[_0x3a51('0x12')](0x1f4,_0xc00496[_0x3a51('0x13')]));});});}; \ No newline at end of file +var _0x6a37=['lodash','moment','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','request','then','CmHopperBlack,\x20%s,\x20%s','debug','CmHopperBlack,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','findAll','options','raw','where','attributes','include','map','model','GetCmHopperBlack','UpdateCmHopperBlack','body','DestroyCmHopperBlack','destroy'];(function(_0x1244aa,_0x18b45c){var _0x578c4a=function(_0x2e79f0){while(--_0x2e79f0){_0x1244aa['push'](_0x1244aa['shift']());}};_0x578c4a(++_0x18b45c);}(_0x6a37,0xe7));var _0x76a3=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x6a37[_0x459423];return _0x42ed14;};'use strict';var _=require(_0x76a3('0x0'));var util=require('util');var moment=require(_0x76a3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76a3('0x2'));var db=require(_0x76a3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x76a3('0x4'))(_0x76a3('0x5'));var config=require('../../config/environment');var jayson=require(_0x76a3('0x6'));var client=jayson['client'][_0x76a3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x292426,_0x10afac,_0x32a4dd){return new BPromise(function(_0x22ba5e,_0x1de3a2){return client[_0x76a3('0x8')](_0x292426,_0x32a4dd)[_0x76a3('0x9')](function(_0x2430d7){logger['info'](_0x76a3('0xa'),_0x10afac,'request\x20sent');logger[_0x76a3('0xb')](_0x76a3('0xc'),_0x10afac,'request\x20sent',JSON[_0x76a3('0xd')](_0x2430d7));if(_0x2430d7['error']){if(_0x2430d7[_0x76a3('0xe')][_0x76a3('0xf')]===0x1f4){logger[_0x76a3('0xe')](_0x76a3('0xa'),_0x10afac,_0x2430d7[_0x76a3('0xe')][_0x76a3('0x10')]);return _0x1de3a2(_0x2430d7[_0x76a3('0xe')][_0x76a3('0x10')]);}logger['error'](_0x76a3('0xa'),_0x10afac,_0x2430d7[_0x76a3('0xe')]['message']);return _0x22ba5e(_0x2430d7['error'][_0x76a3('0x10')]);}else{logger[_0x76a3('0x11')](_0x76a3('0xa'),_0x10afac,_0x76a3('0x12'));_0x22ba5e(_0x2430d7['result'][_0x76a3('0x10')]);}})[_0x76a3('0x13')](function(_0x28edde){logger[_0x76a3('0xe')](_0x76a3('0xa'),_0x10afac,_0x28edde);_0x1de3a2(_0x28edde);});});}exports['GetCmHopperBlack']=function(_0x566ee1){var _0x1051e9=this;return new Promise(function(_0x30ad19,_0x55d015){return db['CmHopperBlack'][_0x76a3('0x14')]({'raw':_0x566ee1[_0x76a3('0x15')]?_0x566ee1[_0x76a3('0x15')][_0x76a3('0x16')]===undefined?!![]:![]:!![],'where':_0x566ee1[_0x76a3('0x15')]?_0x566ee1[_0x76a3('0x15')][_0x76a3('0x17')]||null:null,'attributes':_0x566ee1[_0x76a3('0x15')]?_0x566ee1[_0x76a3('0x15')][_0x76a3('0x18')]||null:null,'limit':_0x566ee1[_0x76a3('0x15')]?_0x566ee1[_0x76a3('0x15')]['limit']||null:null,'include':_0x566ee1[_0x76a3('0x15')]?_0x566ee1[_0x76a3('0x15')][_0x76a3('0x19')]?_[_0x76a3('0x1a')](_0x566ee1[_0x76a3('0x15')][_0x76a3('0x19')],function(_0x289a76){return{'model':db[_0x289a76['model']],'as':_0x289a76['as'],'attributes':_0x289a76[_0x76a3('0x18')],'include':_0x289a76[_0x76a3('0x19')]?_[_0x76a3('0x1a')](_0x289a76[_0x76a3('0x19')],function(_0x47ae47){return{'model':db[_0x47ae47[_0x76a3('0x1b')]],'as':_0x47ae47['as'],'attributes':_0x47ae47[_0x76a3('0x18')],'include':_0x47ae47[_0x76a3('0x19')]?_[_0x76a3('0x1a')](_0x47ae47[_0x76a3('0x19')],function(_0x328bf4){return{'model':db[_0x328bf4['model']],'as':_0x328bf4['as'],'attributes':_0x328bf4[_0x76a3('0x18')]};}):[]};}):[]};}):[]:[]})[_0x76a3('0x9')](function(_0x4ee9df){logger[_0x76a3('0x11')](_0x76a3('0x1c'),_0x566ee1);logger['debug']('GetCmHopperBlack',_0x566ee1,JSON['stringify'](_0x4ee9df));_0x30ad19(_0x4ee9df);})[_0x76a3('0x13')](function(_0x2adb02){logger['error'](_0x76a3('0x1c'),_0x2adb02[_0x76a3('0x10')],_0x566ee1);_0x55d015(_0x1051e9[_0x76a3('0xe')](0x1f4,_0x2adb02[_0x76a3('0x10')]));});});};exports[_0x76a3('0x1d')]=function(_0x363a38){var _0x52a360=this;return new Promise(function(_0xf961ce,_0x434124){return db['CmHopperBlack']['update'](_0x363a38[_0x76a3('0x1e')],{'raw':_0x363a38['options']?_0x363a38['options'][_0x76a3('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x363a38['options']?_0x363a38[_0x76a3('0x15')][_0x76a3('0x17')]||null:null,'attributes':_0x363a38[_0x76a3('0x15')]?_0x363a38['options']['attributes']||null:null,'limit':_0x363a38['options']?_0x363a38[_0x76a3('0x15')]['limit']||null:null})['then'](function(_0x46b28a){logger[_0x76a3('0x11')](_0x76a3('0x1d'),_0x363a38);logger[_0x76a3('0xb')]('UpdateCmHopperBlack',_0x363a38,JSON['stringify'](_0x46b28a));_0xf961ce(_0x46b28a);})['catch'](function(_0x5df9bd){logger[_0x76a3('0xe')]('UpdateCmHopperBlack',_0x5df9bd['message'],_0x363a38);_0x434124(_0x52a360[_0x76a3('0xe')](0x1f4,_0x5df9bd['message']));});});};exports[_0x76a3('0x1f')]=function(_0xe47ca4){var _0x8e99a6=this;return new Promise(function(_0x498ae8,_0x523f69){return db['CmHopperBlack'][_0x76a3('0x20')]({'where':_0xe47ca4[_0x76a3('0x15')]?_0xe47ca4[_0x76a3('0x15')][_0x76a3('0x17')]||null:null})[_0x76a3('0x9')](function(_0x320e29){logger[_0x76a3('0x11')]('DestroyCmHopperBlack',_0xe47ca4);logger[_0x76a3('0xb')]('DestroyCmHopperBlack',_0xe47ca4,JSON[_0x76a3('0xd')](_0x320e29));_0x498ae8(_0x320e29);})[_0x76a3('0x13')](function(_0x3da946){logger[_0x76a3('0xe')](_0x76a3('0x1f'),_0x3da946['message'],_0xe47ca4);_0x523f69(_0x8e99a6[_0x76a3('0xe')](0x1f4,_0x3da946[_0x76a3('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index dfe2b53..b495479 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 _0x1883=['../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x584fce,_0x37bd52){var _0x577006=function(_0x3ff9c9){while(--_0x3ff9c9){_0x584fce['push'](_0x584fce['shift']());}};_0x577006(++_0x37bd52);}(_0x1883,0xab));var _0x3188=function(_0x24136f,_0x526392){_0x24136f=_0x24136f-0x0;var _0x38dc46=_0x1883[_0x24136f];return _0x38dc46;};'use strict';var multer=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var path=require(_0x3188('0x2'));var timeout=require(_0x3188('0x3'));var express=require(_0x3188('0x4'));var router=express[_0x3188('0x5')]();var fs_extra=require(_0x3188('0x6'));var auth=require(_0x3188('0x7'));var interaction=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var controller=require(_0x3188('0xa'));router[_0x3188('0xb')]('/',auth[_0x3188('0xc')](),controller[_0x3188('0xd')]);router[_0x3188('0xb')](_0x3188('0xe'),auth[_0x3188('0xc')](),controller['describe']);router[_0x3188('0xb')](_0x3188('0xf'),auth['isAuthenticated'](),controller[_0x3188('0x10')]);router['put'](_0x3188('0xf'),auth[_0x3188('0xc')](),controller[_0x3188('0x11')]);router[_0x3188('0x12')]('/:id',auth[_0x3188('0xc')](),controller[_0x3188('0x13')]);module['exports']=router; \ No newline at end of file +var _0x741c=['get','isAuthenticated','index','/describe','/:id','show','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','./cmHopperBlack.controller'];(function(_0x3567ae,_0x87d1f3){var _0x2ad11b=function(_0x4207ef){while(--_0x4207ef){_0x3567ae['push'](_0x3567ae['shift']());}};_0x2ad11b(++_0x87d1f3);}(_0x741c,0x196));var _0xc741=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x741c[_0x57b54c];return _0x59cc19;};'use strict';var multer=require(_0xc741('0x0'));var util=require(_0xc741('0x1'));var path=require(_0xc741('0x2'));var timeout=require(_0xc741('0x3'));var express=require(_0xc741('0x4'));var router=express[_0xc741('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xc741('0x6'));var config=require('../../config/environment');var controller=require(_0xc741('0x7'));router[_0xc741('0x8')]('/',auth[_0xc741('0x9')](),controller[_0xc741('0xa')]);router[_0xc741('0x8')](_0xc741('0xb'),auth[_0xc741('0x9')](),controller['describe']);router[_0xc741('0x8')](_0xc741('0xc'),auth['isAuthenticated'](),controller[_0xc741('0xd')]);router['put']('/:id',auth[_0xc741('0x9')](),controller[_0xc741('0xe')]);router[_0xc741('0xf')](_0xc741('0xc'),auth[_0xc741('0x9')](),controller[_0xc741('0x10')]);module[_0xc741('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index bca5876..997c366 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 _0x78b0=['exports','INTEGER','DATE','STRING','endtime','setDataValue','followuptime','seconds','BOOLEAN','sequelize','moment'];(function(_0xe2e5a7,_0x213d71){var _0x1658e5=function(_0x12eb35){while(--_0x12eb35){_0xe2e5a7['push'](_0xe2e5a7['shift']());}};_0x1658e5(++_0x213d71);}(_0x78b0,0x127));var _0x078b=function(_0x2b3d1f,_0x40c8b6){_0x2b3d1f=_0x2b3d1f-0x0;var _0x187469=_0x78b0[_0x2b3d1f];return _0x187469;};'use strict';var Sequelize=require(_0x078b('0x0'));var moment=require(_0x078b('0x1'));module[_0x078b('0x2')]={'state':{'type':Sequelize[_0x078b('0x3')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x078b('0x4')]},'countbusyretry':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x078b('0x5')]},'originatecalleridnum':{'type':Sequelize[_0x078b('0x5')]},'originatecalleridname':{'type':Sequelize[_0x078b('0x5')]},'calleridnum':{'type':Sequelize[_0x078b('0x5')]},'calleridname':{'type':Sequelize[_0x078b('0x5')]},'starttime':{'type':Sequelize[_0x078b('0x4')]},'responsetime':{'type':Sequelize[_0x078b('0x4')]},'answertime':{'type':Sequelize[_0x078b('0x4')]},'droptime':{'type':Sequelize[_0x078b('0x4')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x078b('0x5')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x078b('0x5')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x078b('0x5')]},'dispositionat':{'type':Sequelize[_0x078b('0x4')],'set':function(_0x21f7f0){var _0x4a8add=this['getDataValue'](_0x078b('0x6'));if(_0x4a8add&&_0x21f7f0){this[_0x078b('0x7')](_0x078b('0x8'),moment(_0x21f7f0)['diff'](moment(_0x4a8add),_0x078b('0x9')));}return this[_0x078b('0x7')]('dispositionat',_0x21f7f0);}},'amd':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x078b('0xa')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x078b('0xa')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0x078b('0xa')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x078b('0x5')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x078b('0x5')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x078b('0x4')]},'recallme':{'type':Sequelize[_0x078b('0xa')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x078b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x992f=['sequelize','moment','DATE','INTEGER','STRING','endtime','diff','setDataValue','BOOLEAN'];(function(_0x16a8e1,_0x131926){var _0x2171ab=function(_0x5c071c){while(--_0x5c071c){_0x16a8e1['push'](_0x16a8e1['shift']());}};_0x2171ab(++_0x131926);}(_0x992f,0xd8));var _0xf992=function(_0x1fa8c9,_0xefa79f){_0x1fa8c9=_0x1fa8c9-0x0;var _0x19274e=_0x992f[_0x1fa8c9];return _0x19274e;};'use strict';var Sequelize=require(_0xf992('0x0'));var moment=require(_0xf992('0x1'));module['exports']={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xf992('0x2')]},'countbusyretry':{'type':Sequelize[_0xf992('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xf992('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xf992('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xf992('0x3')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xf992('0x4')]},'originatecalleridnum':{'type':Sequelize[_0xf992('0x4')]},'originatecalleridname':{'type':Sequelize[_0xf992('0x4')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xf992('0x2')]},'answertime':{'type':Sequelize[_0xf992('0x2')]},'droptime':{'type':Sequelize[_0xf992('0x2')]},'endtime':{'type':Sequelize[_0xf992('0x2')]},'ringtime':{'type':Sequelize[_0xf992('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xf992('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xf992('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xf992('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'reason':{'type':Sequelize[_0xf992('0x4')]},'disposition':{'type':Sequelize[_0xf992('0x4')]},'secondDisposition':{'type':Sequelize[_0xf992('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'dispositionat':{'type':Sequelize[_0xf992('0x2')],'set':function(_0x380f88){var _0x32fc68=this['getDataValue'](_0xf992('0x5'));if(_0x32fc68&&_0x380f88){this['setDataValue']('followuptime',moment(_0x380f88)[_0xf992('0x6')](moment(_0x32fc68),'seconds'));}return this[_0xf992('0x7')]('dispositionat',_0x380f88);}},'amd':{'type':Sequelize[_0xf992('0x8')],'defaultValue':![]},'fax':{'type':Sequelize[_0xf992('0x8')],'defaultValue':![]},'blacklist':{'type':Sequelize[_0xf992('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xf992('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xf992('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xf992('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize[_0xf992('0x2')]},'recallme':{'type':Sequelize[_0xf992('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize['DATE']},'countnosuchnumberretry':{'type':Sequelize[_0xf992('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xf992('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf992('0x3')],'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 136bfef..3fe6baa 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 _0xacf4=['reject','update','then','destroy','error','stack','name','send','index','map','CmHopperFinal','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','hasOwnProperty','sort','where','pick','filter','type','VIRTUAL','merge','options','include','findAll','rows','catch','show','params','intersection','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x205,\x201,\x20null','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','countContactsIvrCampaignHopperFinal','`state`\x20=\x200,\x201,\x20null','busyContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2022,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','createdAt','updatedAt','field','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','state\x20=\x20?','state','toString','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','CampaignId','select','ANY_VALUE(ContactId)','ANY_VALUE(CampaignId)','NOW()','CampaignId\x20=\x20?','checkContactHopper','CmHopper','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range'];(function(_0x664c3d,_0x4f1198){var _0x455a32=function(_0x581c2a){while(--_0x581c2a){_0x664c3d['push'](_0x664c3d['shift']());}};_0x455a32(++_0x4f1198);}(_0xacf4,0xe7));var _0x4acf=function(_0x26068a,_0x11058c){_0x26068a=_0x26068a-0x0;var _0x4c2517=_0xacf4[_0x26068a];return _0x4c2517;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x4acf('0x0'));var jsonpatch=require(_0x4acf('0x1'));var rp=require(_0x4acf('0x2'));var moment=require(_0x4acf('0x3'));var BPromise=require(_0x4acf('0x4'));var Mustache=require(_0x4acf('0x5'));var util=require(_0x4acf('0x6'));var path=require('path');var sox=require(_0x4acf('0x7'));var csv=require(_0x4acf('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4acf('0x9'));var _=require(_0x4acf('0xa'));var squel=require(_0x4acf('0xb'));var crypto=require(_0x4acf('0xc'));var jsforce=require(_0x4acf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4acf('0xe'));var Papa=require('papaparse');var Redis=require(_0x4acf('0xf'));var authService=require(_0x4acf('0x10'));var qs=require(_0x4acf('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4acf('0x12'));var logger=require(_0x4acf('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x4acf('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1783d2,_0x979f49){_0x979f49=_0x979f49||0xcc;return function(_0x3734e1){if(_0x3734e1){return _0x1783d2[_0x4acf('0x15')](_0x979f49);}return _0x1783d2[_0x4acf('0x16')](_0x979f49)[_0x4acf('0x17')]();};}function respondWithResult(_0x7ab3ea,_0x15386a){_0x15386a=_0x15386a||0xc8;return function(_0x2025ca){if(_0x2025ca){return _0x7ab3ea[_0x4acf('0x16')](_0x15386a)[_0x4acf('0x18')](_0x2025ca);}};}function respondWithFilteredResult(_0x5f0260,_0x1b584a){return function(_0x57d8e0){if(_0x57d8e0){var _0x34cec1=typeof _0x1b584a[_0x4acf('0x19')]===_0x4acf('0x1a')&&typeof _0x1b584a['limit']==='undefined';var _0x13d10e=_0x57d8e0[_0x4acf('0x1b')];var _0x240c00=_0x34cec1?0x0:_0x1b584a['offset'];var _0x2a678b=_0x34cec1?_0x57d8e0[_0x4acf('0x1b')]:_0x1b584a[_0x4acf('0x19')]+_0x1b584a[_0x4acf('0x1c')];var _0x2f0cec;if(_0x2a678b>=_0x13d10e){_0x2a678b=_0x13d10e;_0x2f0cec=0xc8;}else{_0x2f0cec=0xce;}_0x5f0260[_0x4acf('0x16')](_0x2f0cec);return _0x5f0260[_0x4acf('0x1d')](_0x4acf('0x1e'),_0x240c00+'-'+_0x2a678b+'/'+_0x13d10e)[_0x4acf('0x18')](_0x57d8e0);}return null;};}function patchUpdates(_0x2feb89){return function(_0x1a3118){try{jsonpatch['apply'](_0x1a3118,_0x2feb89,!![]);}catch(_0x28d698){return BPromise[_0x4acf('0x1f')](_0x28d698);}return _0x1a3118['save']();};}function saveUpdates(_0x41e5d2,_0x17775f){return function(_0x569d9e){if(_0x569d9e){return _0x569d9e[_0x4acf('0x20')](_0x41e5d2)[_0x4acf('0x21')](function(_0x433b7a){return _0x433b7a;});}return null;};}function removeEntity(_0x454555,_0x53885f){return function(_0x1a2286){if(_0x1a2286){return _0x1a2286[_0x4acf('0x22')]()['then'](function(){_0x454555[_0x4acf('0x16')](0xcc)[_0x4acf('0x17')]();});}};}function handleEntityNotFound(_0x52a84a,_0x126522){return function(_0x7ebb){if(!_0x7ebb){_0x52a84a[_0x4acf('0x15')](0x194);}return _0x7ebb;};}function handleError(_0x16458f,_0x571a30){_0x571a30=_0x571a30||0x1f4;return function(_0x50236d){logger[_0x4acf('0x23')](_0x50236d[_0x4acf('0x24')]);if(_0x50236d[_0x4acf('0x25')]){delete _0x50236d[_0x4acf('0x25')];}_0x16458f[_0x4acf('0x16')](_0x571a30)[_0x4acf('0x26')](_0x50236d);};}exports[_0x4acf('0x27')]=function(_0x7a1e79,_0x382c41){var _0x2a3830={},_0x57989e={},_0x3521c2={'count':0x0,'rows':[]};var _0x3f5614=_[_0x4acf('0x28')](db[_0x4acf('0x29')][_0x4acf('0x2a')],function(_0x28570f){return{'name':_0x28570f[_0x4acf('0x2b')],'type':_0x28570f['type'][_0x4acf('0x2c')]};});_0x57989e[_0x4acf('0x2d')]=_[_0x4acf('0x28')](_0x3f5614,'name');_0x57989e[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0x7a1e79[_0x4acf('0x2e')]);_0x57989e[_0x4acf('0x30')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],_0x57989e[_0x4acf('0x2e')]);_0x2a3830[_0x4acf('0x31')]=_['intersection'](_0x57989e[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x32')]));_0x2a3830[_0x4acf('0x31')]=_0x2a3830[_0x4acf('0x31')]['length']?_0x2a3830[_0x4acf('0x31')]:_0x57989e[_0x4acf('0x2d')];if(!_0x7a1e79['query'][_0x4acf('0x33')]('nolimit')){_0x2a3830['limit']=qs['limit'](_0x7a1e79['query']['limit']);_0x2a3830['offset']=qs['offset'](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x19')]);}_0x2a3830['order']=qs[_0x4acf('0x34')](_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x34')]);_0x2a3830[_0x4acf('0x35')]=qs[_0x4acf('0x30')](_[_0x4acf('0x36')](_0x7a1e79[_0x4acf('0x2e')],_0x57989e[_0x4acf('0x30')]),_0x3f5614);if(_0x7a1e79[_0x4acf('0x2e')][_0x4acf('0x37')]){_0x2a3830['where']=_['merge'](_0x2a3830[_0x4acf('0x35')],{'$or':_[_0x4acf('0x28')](_0x3f5614,function(_0x4859b6){if(_0x4859b6[_0x4acf('0x38')]!==_0x4acf('0x39')){var _0x43a2ea={};_0x43a2ea[_0x4859b6[_0x4acf('0x25')]]={'$like':'%'+_0x7a1e79['query']['filter']+'%'};return _0x43a2ea;}})});}_0x2a3830=_[_0x4acf('0x3a')]({},_0x2a3830,_0x7a1e79[_0x4acf('0x3b')]);var _0x3d5529={'where':_0x2a3830[_0x4acf('0x35')]};return db['CmHopperFinal'][_0x4acf('0x1b')](_0x3d5529)[_0x4acf('0x21')](function(_0x4e9370){_0x3521c2['count']=_0x4e9370;if(_0x7a1e79['query']['includeAll']){_0x2a3830[_0x4acf('0x3c')]=[{'all':!![]}];}return db[_0x4acf('0x29')][_0x4acf('0x3d')](_0x2a3830);})['then'](function(_0x1015e3){_0x3521c2[_0x4acf('0x3e')]=_0x1015e3;return _0x3521c2;})[_0x4acf('0x21')](respondWithFilteredResult(_0x382c41,_0x2a3830))[_0x4acf('0x3f')](handleError(_0x382c41,null));};exports[_0x4acf('0x40')]=function(_0xea75e4,_0x7cf2a){var _0x17d5e9={'raw':!![],'where':{'id':_0xea75e4[_0x4acf('0x41')]['id']}},_0x461547={};_0x461547[_0x4acf('0x2d')]=_['keys'](db[_0x4acf('0x29')][_0x4acf('0x2a')]);_0x461547[_0x4acf('0x2e')]=_[_0x4acf('0x2f')](_0xea75e4[_0x4acf('0x2e')]);_0x461547['filters']=_['intersection'](_0x461547[_0x4acf('0x2d')],_0x461547[_0x4acf('0x2e')]);_0x17d5e9[_0x4acf('0x31')]=_[_0x4acf('0x42')](_0x461547[_0x4acf('0x2d')],qs[_0x4acf('0x32')](_0xea75e4['query'][_0x4acf('0x32')]));_0x17d5e9['attributes']=_0x17d5e9[_0x4acf('0x31')][_0x4acf('0x43')]?_0x17d5e9['attributes']:_0x461547['model'];if(_0xea75e4[_0x4acf('0x2e')][_0x4acf('0x44')]){_0x17d5e9[_0x4acf('0x3c')]=[{'all':!![]}];}_0x17d5e9=_[_0x4acf('0x3a')]({},_0x17d5e9,_0xea75e4['options']);return db[_0x4acf('0x29')][_0x4acf('0x45')](_0x17d5e9)[_0x4acf('0x21')](handleEntityNotFound(_0x7cf2a,null))[_0x4acf('0x21')](respondWithResult(_0x7cf2a,null))[_0x4acf('0x3f')](handleError(_0x7cf2a,null));};exports[_0x4acf('0x46')]=function(_0x1bd7d0,_0x2d946c){return db['CmHopperFinal']['describe']()[_0x4acf('0x21')](respondWithResult(_0x2d946c,null))[_0x4acf('0x3f')](handleError(_0x2d946c,null));};exports[_0x4acf('0x20')]=function(_0x33bc52,_0x287406){if(_0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')]){delete _0x33bc52[_0x4acf('0x47')][_0x4acf('0x48')];}return db[_0x4acf('0x29')][_0x4acf('0x45')]({'where':{'uniqueid':_0x33bc52[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x287406,null))[_0x4acf('0x21')](saveUpdates(_0x33bc52[_0x4acf('0x47')],null))[_0x4acf('0x21')](respondWithResult(_0x287406,null))[_0x4acf('0x3f')](handleError(_0x287406,null));};exports[_0x4acf('0x49')]=function(_0x3cf54a,_0x2785b9,_0x2d0561){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'VoiceQueueId':_0x3cf54a[_0x4acf('0x41')]['id']},'attributes':[[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x200,\x201,\x20null'))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),'busyContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x51')))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x4acf('0x53')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x54')))),_0x4acf('0x55')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')]('`state`\x20=\x2022,\x201,\x20null'))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn']('COUNT',db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal'](_0x4acf('0x57')))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x2785b9,null))['then'](respondWithResult(_0x2785b9,null))[_0x4acf('0x3f')](handleError(_0x2785b9,null));};exports[_0x4acf('0x59')]=function(_0xb5bd81,_0x452ee6,_0x54b093){return db[_0x4acf('0x29')][_0x4acf('0x3d')]({'raw':![],'where':{'CampaignId':_0xb5bd81[_0x4acf('0x41')]['id']},'attributes':[[db['sequelize']['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x5a')))),_0x4acf('0x4d')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x4e')))),_0x4acf('0x4f')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db[_0x4acf('0x4a')][_0x4acf('0x4c')](_0x4acf('0x50')))),_0x4acf('0x5b')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x208,\x201,\x20null'))),_0x4acf('0x52')],[db['sequelize']['fn'](_0x4acf('0x4b'),db['sequelize']['fn']('IF',db['sequelize']['literal'](_0x4acf('0x5c')))),_0x4acf('0x53')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db[_0x4acf('0x4a')]['literal']('`state`\x20=\x2011\x20,\x201,\x20null'))),'abandonedContacts'],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')](_0x4acf('0x5d')))),_0x4acf('0x56')],[db[_0x4acf('0x4a')]['fn'](_0x4acf('0x4b'),db[_0x4acf('0x4a')]['fn']('IF',db['sequelize'][_0x4acf('0x4c')]('`state`\x20=\x2019,\x201,\x20null'))),_0x4acf('0x58')]]})[_0x4acf('0x21')](handleEntityNotFound(_0x452ee6,null))[_0x4acf('0x21')](respondWithResult(_0x452ee6,null))[_0x4acf('0x3f')](handleError(_0x452ee6,null));};exports[_0x4acf('0x5e')]=function(_0x173655,_0x1f2dbc,_0xc0d942){return db[_0x4acf('0x5f')][_0x4acf('0x45')]({'where':{'id':_0x173655[_0x4acf('0x41')]['id']}})[_0x4acf('0x21')](handleEntityNotFound(_0x1f2dbc,null))['then'](function(_0x11f356){var _0xacca91;if(_0x11f356){_0xacca91=squel[_0x4acf('0x60')]()[_0x4acf('0x61')](_0x4acf('0x62'))[_0x4acf('0x63')]([_0x4acf('0x64'),_0x4acf('0x65'),_0x4acf('0x66'),_0x4acf('0x67'),'VoiceQueueId',_0x4acf('0x68'),_0x4acf('0x69')],squel['select']()[_0x4acf('0x6a')](_0x4acf('0x6b'),'phone')[_0x4acf('0x6a')]('NOW()','scheduledAt')[_0x4acf('0x6a')]('ANY_VALUE(ContactId)',_0x4acf('0x66'))[_0x4acf('0x6a')](_0x4acf('0x6c'),_0x4acf('0x67'))['field'](_0x4acf('0x6d'),_0x4acf('0x6e'))['field']('NOW()','createdAt')[_0x4acf('0x6a')]('NOW()',_0x4acf('0x69'))[_0x4acf('0x6f')](_0x4acf('0x70'))['where'](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())[_0x4acf('0x35')](_0x4acf('0x72'),_0x173655['body'][_0x4acf('0x73')][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel['select']()[_0x4acf('0x6a')]('phone')[_0x4acf('0x6f')](_0x4acf('0x62'))['where']('VoiceQueueId\x20=\x20?',_0x173655['params']['id'][_0x4acf('0x74')]()))['where']('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x71'),_0x173655[_0x4acf('0x41')]['id']['toString']())['where'](_0x4acf('0x77')))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0xacca91);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1f2dbc,null))[_0x4acf('0x3f')](handleError(_0x1f2dbc,null));};exports[_0x4acf('0x79')]=function(_0x453c6d,_0x1a82e7,_0x3d02c7){return db[_0x4acf('0x7a')]['find']({'where':{'id':_0x453c6d[_0x4acf('0x41')]['id']}})['then'](handleEntityNotFound(_0x1a82e7,null))[_0x4acf('0x21')](function(_0x1bbe6d){var _0x2a36e2;if(_0x1bbe6d){_0x2a36e2=squel[_0x4acf('0x60')]()[_0x4acf('0x61')]('cm_hopper')[_0x4acf('0x63')](['phone',_0x4acf('0x65'),_0x4acf('0x66'),'ListId',_0x4acf('0x7b'),_0x4acf('0x68'),_0x4acf('0x69')],squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('ANY_VALUE(calleridnum)',_0x4acf('0x64'))['field']('NOW()',_0x4acf('0x65'))[_0x4acf('0x6a')](_0x4acf('0x7d'),_0x4acf('0x66'))['field']('ANY_VALUE(ListId)',_0x4acf('0x67'))[_0x4acf('0x6a')](_0x4acf('0x7e'),_0x4acf('0x7b'))[_0x4acf('0x6a')](_0x4acf('0x7f'),_0x4acf('0x68'))[_0x4acf('0x6a')]('NOW()','updatedAt')[_0x4acf('0x6f')](_0x4acf('0x70'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x72'),_0x453c6d[_0x4acf('0x47')]['state'][_0x4acf('0x74')]())[_0x4acf('0x35')](_0x4acf('0x75'))[_0x4acf('0x35')](_0x4acf('0x76'),squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')](_0x4acf('0x64'))[_0x4acf('0x6f')](_0x4acf('0x62'))[_0x4acf('0x35')](_0x4acf('0x80'),_0x453c6d[_0x4acf('0x41')]['id']['toString']()))[_0x4acf('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x4acf('0x7c')]()[_0x4acf('0x6a')]('calleridnum')[_0x4acf('0x6f')](_0x4acf('0x70'))['where']('CampaignId\x20=\x20?',_0x453c6d[_0x4acf('0x41')]['id'][_0x4acf('0x74')]())['where']('state\x20=\x204'))[_0x4acf('0x78')](_0x4acf('0x66')))[_0x4acf('0x74')]();return db[_0x4acf('0x4a')]['query'](_0x2a36e2);}return[];})[_0x4acf('0x21')](respondWithResult(_0x1a82e7,null))[_0x4acf('0x3f')](handleError(_0x1a82e7,null));};exports[_0x4acf('0x81')]=function(_0x34e1ea,_0x43e9bf,_0x367ad4){return db[_0x4acf('0x82')]['findOne']({'where':{'VoiceQueueId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x6e')],'CampaignId':_0x34e1ea[_0x4acf('0x47')]['CampaignId'],'ContactId':_0x34e1ea[_0x4acf('0x47')][_0x4acf('0x66')]}})[_0x4acf('0x21')](handleEntityNotFound(_0x43e9bf,null))[_0x4acf('0x21')](function(_0x37ffab){if(_0x37ffab){return _0x37ffab;}return null;})[_0x4acf('0x21')](respondWithResult(_0x43e9bf,null))[_0x4acf('0x3f')](handleError(_0x43e9bf,null));}; \ No newline at end of file +var _0x1261=['attributes','fields','length','hasOwnProperty','sort','pick','filters','where','type','VIRTUAL','filter','merge','options','findAll','rows','params','include','find','describe','catch','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','COUNT','literal','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','congestionContacts','dropContacts','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','answeringMachine','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','moveContactsQueueCampaignHopperFinal','VoiceQueue','cm_hopper','fromQuery','phone','scheduledAt','createdAt','updatedAt','select','field','NOW()','ANY_VALUE(ContactId)','ContactId','ANY_VALUE(ListId)','VoiceQueueId','from','VoiceQueueId\x20=\x20?','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','calleridnum','cm_hopper_final','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','into','ListId','CampaignId','ANY_VALUE(calleridnum)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','state\x20=\x20?','checkContactHopper','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','send','CmHopperFinal','model','map','name','keys','query','intersection'];(function(_0x4727a2,_0x2ba8e6){var _0x28bbbb=function(_0x24e982){while(--_0x24e982){_0x4727a2['push'](_0x4727a2['shift']());}};_0x28bbbb(++_0x2ba8e6);}(_0x1261,0x144));var _0x1126=function(_0x40c043,_0x1d064e){_0x40c043=_0x40c043-0x0;var _0x5c2c8d=_0x1261[_0x40c043];return _0x5c2c8d;};'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'];function respondWithStatusCode(_0xd26a32,_0x273896){_0x273896=_0x273896||0xcc;return function(_0xca0355){if(_0xca0355){return _0xd26a32[_0x1126('0x18')](_0x273896);}return _0xd26a32[_0x1126('0x19')](_0x273896)[_0x1126('0x1a')]();};}function respondWithResult(_0x43850b,_0x53a8f0){_0x53a8f0=_0x53a8f0||0xc8;return function(_0x5de9a7){if(_0x5de9a7){return _0x43850b[_0x1126('0x19')](_0x53a8f0)[_0x1126('0x1b')](_0x5de9a7);}};}function respondWithFilteredResult(_0x279455,_0x4be0c6){return function(_0x45149c){if(_0x45149c){var _0x4794a7=typeof _0x4be0c6[_0x1126('0x1c')]===_0x1126('0x1d')&&typeof _0x4be0c6[_0x1126('0x1e')]==='undefined';var _0x245cd7=_0x45149c[_0x1126('0x1f')];var _0x4a7b49=_0x4794a7?0x0:_0x4be0c6['offset'];var _0x22ae0b=_0x4794a7?_0x45149c[_0x1126('0x1f')]:_0x4be0c6['offset']+_0x4be0c6['limit'];var _0x4564c0;if(_0x22ae0b>=_0x245cd7){_0x22ae0b=_0x245cd7;_0x4564c0=0xc8;}else{_0x4564c0=0xce;}_0x279455['status'](_0x4564c0);return _0x279455[_0x1126('0x20')](_0x1126('0x21'),_0x4a7b49+'-'+_0x22ae0b+'/'+_0x245cd7)[_0x1126('0x1b')](_0x45149c);}return null;};}function patchUpdates(_0x54400a){return function(_0x2a08ba){try{jsonpatch['apply'](_0x2a08ba,_0x54400a,!![]);}catch(_0x56efeb){return BPromise[_0x1126('0x22')](_0x56efeb);}return _0x2a08ba[_0x1126('0x23')]();};}function saveUpdates(_0x25b24b,_0x36d254){return function(_0x526ca1){if(_0x526ca1){return _0x526ca1[_0x1126('0x24')](_0x25b24b)[_0x1126('0x25')](function(_0x48a08d){return _0x48a08d;});}return null;};}function removeEntity(_0x2175fa,_0x59cd8e){return function(_0x529dd9){if(_0x529dd9){return _0x529dd9['destroy']()[_0x1126('0x25')](function(){_0x2175fa[_0x1126('0x19')](0xcc)[_0x1126('0x1a')]();});}};}function handleEntityNotFound(_0x34bcf1,_0x566c09){return function(_0x1b07a7){if(!_0x1b07a7){_0x34bcf1[_0x1126('0x18')](0x194);}return _0x1b07a7;};}function handleError(_0x38119d,_0x589725){_0x589725=_0x589725||0x1f4;return function(_0x35eec3){logger[_0x1126('0x26')](_0x35eec3[_0x1126('0x27')]);if(_0x35eec3['name']){delete _0x35eec3['name'];}_0x38119d[_0x1126('0x19')](_0x589725)[_0x1126('0x28')](_0x35eec3);};}exports['index']=function(_0x2fb797,_0x23d2bc){var _0x4a334a={},_0x3fa694={},_0x4bf807={'count':0x0,'rows':[]};var _0xc62460=_['map'](db[_0x1126('0x29')]['rawAttributes'],function(_0x378f4d){return{'name':_0x378f4d['fieldName'],'type':_0x378f4d['type']['key']};});_0x3fa694[_0x1126('0x2a')]=_[_0x1126('0x2b')](_0xc62460,_0x1126('0x2c'));_0x3fa694['query']=_[_0x1126('0x2d')](_0x2fb797[_0x1126('0x2e')]);_0x3fa694['filters']=_[_0x1126('0x2f')](_0x3fa694[_0x1126('0x2a')],_0x3fa694[_0x1126('0x2e')]);_0x4a334a[_0x1126('0x30')]=_['intersection'](_0x3fa694['model'],qs[_0x1126('0x31')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x31')]));_0x4a334a[_0x1126('0x30')]=_0x4a334a['attributes'][_0x1126('0x32')]?_0x4a334a[_0x1126('0x30')]:_0x3fa694[_0x1126('0x2a')];if(!_0x2fb797[_0x1126('0x2e')][_0x1126('0x33')]('nolimit')){_0x4a334a[_0x1126('0x1e')]=qs[_0x1126('0x1e')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1e')]);_0x4a334a['offset']=qs['offset'](_0x2fb797[_0x1126('0x2e')][_0x1126('0x1c')]);}_0x4a334a['order']=qs[_0x1126('0x34')](_0x2fb797[_0x1126('0x2e')][_0x1126('0x34')]);_0x4a334a['where']=qs['filters'](_[_0x1126('0x35')](_0x2fb797[_0x1126('0x2e')],_0x3fa694[_0x1126('0x36')]),_0xc62460);if(_0x2fb797[_0x1126('0x2e')]['filter']){_0x4a334a[_0x1126('0x37')]=_['merge'](_0x4a334a[_0x1126('0x37')],{'$or':_[_0x1126('0x2b')](_0xc62460,function(_0xfa96e0){if(_0xfa96e0[_0x1126('0x38')]!==_0x1126('0x39')){var _0x5746f6={};_0x5746f6[_0xfa96e0[_0x1126('0x2c')]]={'$like':'%'+_0x2fb797[_0x1126('0x2e')][_0x1126('0x3a')]+'%'};return _0x5746f6;}})});}_0x4a334a=_[_0x1126('0x3b')]({},_0x4a334a,_0x2fb797[_0x1126('0x3c')]);var _0x3442b8={'where':_0x4a334a[_0x1126('0x37')]};return db['CmHopperFinal'][_0x1126('0x1f')](_0x3442b8)[_0x1126('0x25')](function(_0x227a6b){_0x4bf807[_0x1126('0x1f')]=_0x227a6b;if(_0x2fb797[_0x1126('0x2e')]['includeAll']){_0x4a334a['include']=[{'all':!![]}];}return db[_0x1126('0x29')][_0x1126('0x3d')](_0x4a334a);})[_0x1126('0x25')](function(_0x21c38e){_0x4bf807[_0x1126('0x3e')]=_0x21c38e;return _0x4bf807;})[_0x1126('0x25')](respondWithFilteredResult(_0x23d2bc,_0x4a334a))['catch'](handleError(_0x23d2bc,null));};exports['show']=function(_0x4cb1db,_0xb8054e){var _0x5d4194={'raw':!![],'where':{'id':_0x4cb1db[_0x1126('0x3f')]['id']}},_0xf84005={};_0xf84005[_0x1126('0x2a')]=_[_0x1126('0x2d')](db['CmHopperFinal']['rawAttributes']);_0xf84005[_0x1126('0x2e')]=_[_0x1126('0x2d')](_0x4cb1db[_0x1126('0x2e')]);_0xf84005['filters']=_[_0x1126('0x2f')](_0xf84005['model'],_0xf84005[_0x1126('0x2e')]);_0x5d4194['attributes']=_[_0x1126('0x2f')](_0xf84005[_0x1126('0x2a')],qs[_0x1126('0x31')](_0x4cb1db['query'][_0x1126('0x31')]));_0x5d4194[_0x1126('0x30')]=_0x5d4194[_0x1126('0x30')]['length']?_0x5d4194['attributes']:_0xf84005['model'];if(_0x4cb1db[_0x1126('0x2e')]['includeAll']){_0x5d4194[_0x1126('0x40')]=[{'all':!![]}];}_0x5d4194=_['merge']({},_0x5d4194,_0x4cb1db[_0x1126('0x3c')]);return db[_0x1126('0x29')][_0x1126('0x41')](_0x5d4194)[_0x1126('0x25')](handleEntityNotFound(_0xb8054e,null))[_0x1126('0x25')](respondWithResult(_0xb8054e,null))['catch'](handleError(_0xb8054e,null));};exports[_0x1126('0x42')]=function(_0x512f60,_0x5111d3){return db[_0x1126('0x29')][_0x1126('0x42')]()['then'](respondWithResult(_0x5111d3,null))[_0x1126('0x43')](handleError(_0x5111d3,null));};exports[_0x1126('0x24')]=function(_0x518e0a,_0x3e4eeb){if(_0x518e0a[_0x1126('0x44')][_0x1126('0x45')]){delete _0x518e0a['body'][_0x1126('0x45')];}return db[_0x1126('0x29')][_0x1126('0x41')]({'where':{'uniqueid':_0x518e0a[_0x1126('0x3f')]['id']}})[_0x1126('0x25')](handleEntityNotFound(_0x3e4eeb,null))[_0x1126('0x25')](saveUpdates(_0x518e0a[_0x1126('0x44')],null))[_0x1126('0x25')](respondWithResult(_0x3e4eeb,null))['catch'](handleError(_0x3e4eeb,null));};exports[_0x1126('0x46')]=function(_0x5a2287,_0x40168e,_0x2ad118){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'VoiceQueueId':_0x5a2287[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4a')))),_0x1126('0x4b')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize']['literal']('`state`\x20=\x203,\x201,\x20null'))),'noAnswerContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x4e')))),_0x1126('0x4f')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0x1126('0x50')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0x1126('0x51')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),_0x1126('0x53')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')]['literal'](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x40168e,null))[_0x1126('0x25')](respondWithResult(_0x40168e,null))[_0x1126('0x43')](handleError(_0x40168e,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0xcc1a95,_0x315386,_0x5e0ea1){return db[_0x1126('0x29')]['findAll']({'raw':![],'where':{'CampaignId':_0xcc1a95[_0x1126('0x3f')]['id']},'attributes':[[db[_0x1126('0x47')]['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')]('`state`\x20=\x200,\x201,\x20null'))),_0x1126('0x4b')],[db['sequelize']['fn']('COUNT',db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x56')))),_0x1126('0x57')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x4c')))),_0x1126('0x4d')],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x4e')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x58')))),'dropContacts'],[db[_0x1126('0x47')]['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x59')))),_0x1126('0x51')],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db[_0x1126('0x47')][_0x1126('0x49')](_0x1126('0x52')))),'reCallContacts'],[db['sequelize']['fn'](_0x1126('0x48'),db[_0x1126('0x47')]['fn']('IF',db['sequelize'][_0x1126('0x49')](_0x1126('0x54')))),_0x1126('0x55')]]})[_0x1126('0x25')](handleEntityNotFound(_0x315386,null))[_0x1126('0x25')](respondWithResult(_0x315386,null))[_0x1126('0x43')](handleError(_0x315386,null));};exports[_0x1126('0x5a')]=function(_0x247f12,_0xd20fbe,_0x3d5e15){return db[_0x1126('0x5b')][_0x1126('0x41')]({'where':{'id':_0x247f12[_0x1126('0x3f')]['id']}})['then'](handleEntityNotFound(_0xd20fbe,null))[_0x1126('0x25')](function(_0x274343){var _0x2b61ae;if(_0x274343){_0x2b61ae=squel['insert']()['into'](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),'ContactId','ListId','VoiceQueueId',_0x1126('0x60'),_0x1126('0x61')],squel[_0x1126('0x62')]()[_0x1126('0x63')]('ANY_VALUE(calleridnum)',_0x1126('0x5e'))['field'](_0x1126('0x64'),_0x1126('0x5f'))[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),'ListId')[_0x1126('0x63')]('ANY_VALUE(VoiceQueueId)',_0x1126('0x68'))[_0x1126('0x63')]('NOW()',_0x1126('0x60'))[_0x1126('0x63')]('NOW()',_0x1126('0x61'))[_0x1126('0x69')]('cm_hopper_final')['where'](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())['where']('state\x20=\x20?',_0x247f12['body'][_0x1126('0x6c')]['toString']())['where'](_0x1126('0x6d'))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()['field'](_0x1126('0x5e'))[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12['params']['id'][_0x1126('0x6b')]()))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x6a'),_0x247f12[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')](_0x1126('0x71')))[_0x1126('0x72')](_0x1126('0x66')))[_0x1126('0x6b')]();return db[_0x1126('0x47')][_0x1126('0x2e')](_0x2b61ae);}return[];})['then'](respondWithResult(_0xd20fbe,null))[_0x1126('0x43')](handleError(_0xd20fbe,null));};exports[_0x1126('0x73')]=function(_0x33cccf,_0x1483f4,_0x3be5bf){return db['Campaign'][_0x1126('0x41')]({'where':{'id':_0x33cccf['params']['id']}})['then'](handleEntityNotFound(_0x1483f4,null))[_0x1126('0x25')](function(_0x2b1884){var _0x55f366;if(_0x2b1884){_0x55f366=squel['insert']()[_0x1126('0x74')](_0x1126('0x5c'))[_0x1126('0x5d')]([_0x1126('0x5e'),_0x1126('0x5f'),_0x1126('0x66'),_0x1126('0x75'),_0x1126('0x76'),_0x1126('0x60'),'updatedAt'],squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x77'),_0x1126('0x5e'))[_0x1126('0x63')](_0x1126('0x64'),'scheduledAt')[_0x1126('0x63')](_0x1126('0x65'),_0x1126('0x66'))[_0x1126('0x63')](_0x1126('0x67'),_0x1126('0x75'))[_0x1126('0x63')](_0x1126('0x78'),_0x1126('0x76'))[_0x1126('0x63')]('NOW()','createdAt')[_0x1126('0x63')]('NOW()',_0x1126('0x61'))['from'](_0x1126('0x70'))['where'](_0x1126('0x79'),_0x33cccf['params']['id']['toString']())['where'](_0x1126('0x7a'),_0x33cccf[_0x1126('0x44')]['state']['toString']())[_0x1126('0x37')](_0x1126('0x6d'))[_0x1126('0x37')]('calleridnum\x20NOT\x20IN\x20(?)',squel['select']()[_0x1126('0x63')]('phone')[_0x1126('0x69')](_0x1126('0x5c'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id']['toString']()))['where'](_0x1126('0x6e'),squel[_0x1126('0x62')]()[_0x1126('0x63')](_0x1126('0x6f'))[_0x1126('0x69')](_0x1126('0x70'))[_0x1126('0x37')](_0x1126('0x79'),_0x33cccf[_0x1126('0x3f')]['id'][_0x1126('0x6b')]())[_0x1126('0x37')]('state\x20=\x204'))[_0x1126('0x72')]('ContactId'))[_0x1126('0x6b')]();return db['sequelize'][_0x1126('0x2e')](_0x55f366);}return[];})[_0x1126('0x25')](respondWithResult(_0x1483f4,null))[_0x1126('0x43')](handleError(_0x1483f4,null));};exports[_0x1126('0x7b')]=function(_0x59c04b,_0x429183,_0x834360){return db['CmHopper']['findOne']({'where':{'VoiceQueueId':_0x59c04b[_0x1126('0x44')][_0x1126('0x68')],'CampaignId':_0x59c04b[_0x1126('0x44')]['CampaignId'],'ContactId':_0x59c04b[_0x1126('0x44')]['ContactId']}})[_0x1126('0x25')](handleEntityNotFound(_0x429183,null))[_0x1126('0x25')](function(_0x4d6bb2){if(_0x4d6bb2){return _0x4d6bb2;}return null;})[_0x1126('0x25')](respondWithResult(_0x429183,null))[_0x1126('0x43')](handleError(_0x429183,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index cdf3aec..a0ec3ec 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 _0x7b03=['define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports'];(function(_0x4a5494,_0x3ad336){var _0x57cbb5=function(_0xa5a1ac){while(--_0xa5a1ac){_0x4a5494['push'](_0x4a5494['shift']());}};_0x57cbb5(++_0x3ad336);}(_0x7b03,0x1d3));var _0x37b0=function(_0x3eef60,_0x9eb279){_0x3eef60=_0x3eef60-0x0;var _0x569efe=_0x7b03[_0x3eef60];return _0x569efe;};'use strict';var _=require(_0x37b0('0x0'));var util=require('util');var logger=require(_0x37b0('0x1'))(_0x37b0('0x2'));var moment=require('moment');var BPromise=require(_0x37b0('0x3'));var rp=require(_0x37b0('0x4'));var fs=require('fs');var path=require(_0x37b0('0x5'));var rimraf=require('rimraf');var config=require(_0x37b0('0x6'));var attributes=require(_0x37b0('0x7'));module[_0x37b0('0x8')]=function(_0x33440f,_0x22709b){return _0x33440f[_0x37b0('0x9')](_0x37b0('0xa'),attributes,{'tableName':_0x37b0('0xb'),'paranoid':![],'indexes':[{'name':_0x37b0('0xc'),'fields':['calleridnum']},{'name':_0x37b0('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x55ac=['bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','util','moment'];(function(_0x35186d,_0x4706ee){var _0x133acf=function(_0x2238a8){while(--_0x2238a8){_0x35186d['push'](_0x35186d['shift']());}};_0x133acf(++_0x4706ee);}(_0x55ac,0x1ae));var _0xc55a=function(_0x3c771b,_0xadfa84){_0x3c771b=_0x3c771b-0x0;var _0xb1ca2d=_0x55ac[_0x3c771b];return _0xb1ca2d;};'use strict';var _=require('lodash');var util=require(_0xc55a('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xc55a('0x1'));var BPromise=require(_0xc55a('0x2'));var rp=require(_0xc55a('0x3'));var fs=require('fs');var path=require(_0xc55a('0x4'));var rimraf=require('rimraf');var config=require(_0xc55a('0x5'));var attributes=require(_0xc55a('0x6'));module[_0xc55a('0x7')]=function(_0x25d40d,_0x31e16b){return _0x25d40d['define'](_0xc55a('0x8'),attributes,{'tableName':_0xc55a('0x9'),'paranoid':![],'indexes':[{'name':_0xc55a('0xa'),'fields':['calleridnum']},{'name':_0xc55a('0xb'),'fields':[_0xc55a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index df869d3..4685fac 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 _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0xf1999c,_0x5b780a){var _0x133ade=function(_0x451019){while(--_0x451019){_0xf1999c['push'](_0xf1999c['shift']());}};_0x133ade(++_0x5b780a);}(_0xb10b,0x12a));var _0xbb10=function(_0x767fe7,_0x1db449){_0x767fe7=_0x767fe7-0x0;var _0x47771d=_0xb10b[_0x767fe7];return _0x47771d;};'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?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x22c3f5,_0x3616b4){var _0x286071=function(_0xd3a20){while(--_0xd3a20){_0x22c3f5['push'](_0x22c3f5['shift']());}};_0x286071(++_0x3616b4);}(_0xb10b,0x12a));var _0xbb10=function(_0x5466d3,_0x3e47ae){_0x5466d3=_0x5466d3-0x0;var _0x147302=_0xb10b[_0x5466d3];return _0x147302;};'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?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index e7c29b9..fc2586d 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 _0x3376=['/:id','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put'];(function(_0x53cf89,_0x437980){var _0x4928de=function(_0x24c7b9){while(--_0x24c7b9){_0x53cf89['push'](_0x53cf89['shift']());}};_0x4928de(++_0x437980);}(_0x3376,0xe7));var _0x6337=function(_0x33711d,_0x5ad343){_0x33711d=_0x33711d-0x0;var _0x5568d3=_0x3376[_0x33711d];return _0x5568d3;};'use strict';var multer=require(_0x6337('0x0'));var util=require(_0x6337('0x1'));var path=require('path');var timeout=require(_0x6337('0x2'));var express=require(_0x6337('0x3'));var router=express['Router']();var fs_extra=require(_0x6337('0x4'));var auth=require(_0x6337('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./cmHopperFinal.controller');router[_0x6337('0x6')]('/',auth[_0x6337('0x7')](),controller[_0x6337('0x8')]);router['get'](_0x6337('0x9'),auth['isAuthenticated'](),controller[_0x6337('0xa')]);router[_0x6337('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x6337('0xb')]);router['get'](_0x6337('0xc'),auth[_0x6337('0x7')](),controller[_0x6337('0xd')]);router[_0x6337('0x6')](_0x6337('0xe'),auth[_0x6337('0x7')](),controller[_0x6337('0xf')]);router[_0x6337('0x10')](_0x6337('0x11'),auth[_0x6337('0x7')](),controller[_0x6337('0x12')]);router[_0x6337('0x10')]('/voice/campaign/moveContacts/:id',auth['isAuthenticated'](),controller[_0x6337('0x13')]);router[_0x6337('0x10')](_0x6337('0x14'),auth['isAuthenticated'](),controller['checkContactHopper']);router[_0x6337('0x15')](_0x6337('0x16'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x7a8b=['/checkContactHopper','checkContactHopper','put','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./cmHopperFinal.controller','isAuthenticated','index','get','/describe','describe','/:id','show','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal'];(function(_0x1c9256,_0x266ae0){var _0x3ef89b=function(_0x5688a0){while(--_0x5688a0){_0x1c9256['push'](_0x1c9256['shift']());}};_0x3ef89b(++_0x266ae0);}(_0x7a8b,0x153));var _0xb7a8=function(_0x1194da,_0x43946a){_0x1194da=_0x1194da-0x0;var _0x410256=_0x7a8b[_0x1194da];return _0x410256;};'use strict';var multer=require(_0xb7a8('0x0'));var util=require(_0xb7a8('0x1'));var path=require(_0xb7a8('0x2'));var timeout=require(_0xb7a8('0x3'));var express=require(_0xb7a8('0x4'));var router=express[_0xb7a8('0x5')]();var fs_extra=require(_0xb7a8('0x6'));var auth=require(_0xb7a8('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb7a8('0x8'));var controller=require(_0xb7a8('0x9'));router['get']('/',auth[_0xb7a8('0xa')](),controller[_0xb7a8('0xb')]);router[_0xb7a8('0xc')](_0xb7a8('0xd'),auth[_0xb7a8('0xa')](),controller[_0xb7a8('0xe')]);router[_0xb7a8('0xc')](_0xb7a8('0xf'),auth[_0xb7a8('0xa')](),controller[_0xb7a8('0x10')]);router[_0xb7a8('0xc')]('/voice/queue/countAttributes/:id',auth[_0xb7a8('0xa')](),controller[_0xb7a8('0x11')]);router['get'](_0xb7a8('0x12'),auth[_0xb7a8('0xa')](),controller[_0xb7a8('0x13')]);router[_0xb7a8('0x14')](_0xb7a8('0x15'),auth[_0xb7a8('0xa')](),controller[_0xb7a8('0x16')]);router[_0xb7a8('0x14')](_0xb7a8('0x17'),auth[_0xb7a8('0xa')](),controller[_0xb7a8('0x18')]);router[_0xb7a8('0x14')](_0xb7a8('0x19'),auth[_0xb7a8('0xa')](),controller[_0xb7a8('0x1a')]);router[_0xb7a8('0x1b')](_0xb7a8('0xf'),auth[_0xb7a8('0xa')](),controller['update']);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 0daefb4..fc4166f 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 _0x0840=['STRING','DATE','BOOLEAN','exports','INTEGER'];(function(_0xa47894,_0xd492dd){var _0x57de0f=function(_0x13accd){while(--_0x13accd){_0xa47894['push'](_0xa47894['shift']());}};_0x57de0f(++_0xd492dd);}(_0x0840,0x80));var _0x0084=function(_0x31f9c7,_0x1d5f54){_0x31f9c7=_0x31f9c7-0x0;var _0x46c5b3=_0x0840[_0x31f9c7];return _0x46c5b3;};'use strict';var Sequelize=require('sequelize');module[_0x0084('0x0')]={'state':{'type':Sequelize[_0x0084('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x0084('0x2')]},'scheduledat':{'type':Sequelize['DATE']},'countbusyretry':{'type':Sequelize[_0x0084('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x0084('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0x0084('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x0084('0x2')]},'originatecalleridnum':{'type':Sequelize[_0x0084('0x2')]},'originatecalleridname':{'type':Sequelize[_0x0084('0x2')]},'calleridnum':{'type':Sequelize[_0x0084('0x2')]},'calleridname':{'type':Sequelize[_0x0084('0x2')]},'starttime':{'type':Sequelize[_0x0084('0x3')]},'responsetime':{'type':Sequelize[_0x0084('0x3')]},'answertime':{'type':Sequelize[_0x0084('0x3')]},'droptime':{'type':Sequelize[_0x0084('0x3')]},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0x0084('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x0084('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x0084('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0x0084('0x2')]},'campaign':{'type':Sequelize[_0x0084('0x2')]},'campaigntype':{'type':Sequelize[_0x0084('0x2')]},'membername':{'type':Sequelize[_0x0084('0x2')]},'reason':{'type':Sequelize['STRING']},'amd':{'type':Sequelize[_0x0084('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0x0084('0x4')],'defaultValue':![]},'callback':{'type':Sequelize[_0x0084('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x0084('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x0084('0x3')]},'recallme':{'type':Sequelize[_0x0084('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0x0084('0x3')]},'edited':{'type':Sequelize[_0x0084('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x0084('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xe3ea=['STRING','BOOLEAN','sequelize','exports','INTEGER','DATE'];(function(_0x1caf6a,_0x26a5bf){var _0x1bf493=function(_0x3982f5){while(--_0x3982f5){_0x1caf6a['push'](_0x1caf6a['shift']());}};_0x1bf493(++_0x26a5bf);}(_0xe3ea,0xc8));var _0xae3e=function(_0x5497e4,_0x13d97a){_0x5497e4=_0x5497e4-0x0;var _0x1cf6fb=_0xe3ea[_0x5497e4];return _0x1cf6fb;};'use strict';var Sequelize=require(_0xae3e('0x0'));module[_0xae3e('0x1')]={'state':{'type':Sequelize[_0xae3e('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0xae3e('0x3')]},'countbusyretry':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xae3e('0x4')]},'originatecalleridname':{'type':Sequelize[_0xae3e('0x4')]},'calleridnum':{'type':Sequelize[_0xae3e('0x4')]},'calleridname':{'type':Sequelize[_0xae3e('0x4')]},'starttime':{'type':Sequelize[_0xae3e('0x3')]},'responsetime':{'type':Sequelize[_0xae3e('0x3')]},'answertime':{'type':Sequelize[_0xae3e('0x3')]},'droptime':{'type':Sequelize[_0xae3e('0x3')]},'endtime':{'type':Sequelize[_0xae3e('0x3')]},'ringtime':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xae3e('0x4')]},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0xae3e('0x4')]},'membername':{'type':Sequelize[_0xae3e('0x4')]},'reason':{'type':Sequelize[_0xae3e('0x4')]},'amd':{'type':Sequelize[_0xae3e('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xae3e('0x5')],'defaultValue':![]},'callback':{'type':Sequelize[_0xae3e('0x5')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xae3e('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xae3e('0x3')]},'recallme':{'type':Sequelize[_0xae3e('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xae3e('0x3')]},'edited':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xae3e('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'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 59589c6..6d42897 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 _0x02cf=['lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','CmHopperHistory','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','catch','length','options','find','create','body','describe','uniqueid','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x02cf,0x170));var _0xf02c=function(_0x30f496,_0x4f0611){_0x30f496=_0x30f496-0x0;var _0x3960be=_0x02cf[_0x30f496];return _0x3960be;};'use strict';var emlformat=require(_0xf02c('0x0'));var rimraf=require(_0xf02c('0x1'));var zipdir=require(_0xf02c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf02c('0x3'));var moment=require(_0xf02c('0x4'));var BPromise=require(_0xf02c('0x5'));var Mustache=require(_0xf02c('0x6'));var util=require(_0xf02c('0x7'));var path=require(_0xf02c('0x8'));var sox=require('sox');var csv=require(_0xf02c('0x9'));var ejs=require(_0xf02c('0xa'));var fs=require('fs');var fs_extra=require(_0xf02c('0xb'));var _=require(_0xf02c('0xc'));var squel=require(_0xf02c('0xd'));var crypto=require(_0xf02c('0xe'));var jsforce=require(_0xf02c('0xf'));var deskjs=require(_0xf02c('0x10'));var toCsv=require(_0xf02c('0x9'));var querystring=require(_0xf02c('0x11'));var Papa=require(_0xf02c('0x12'));var Redis=require(_0xf02c('0x13'));var authService=require(_0xf02c('0x14'));var qs=require(_0xf02c('0x15'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xf02c('0x16'))('api');var utils=require('../../config/utils');var config=require(_0xf02c('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf02c('0x18'))['db'];function respondWithStatusCode(_0x4ca023,_0x47bc6c){_0x47bc6c=_0x47bc6c||0xcc;return function(_0x32c162){if(_0x32c162){return _0x4ca023[_0xf02c('0x19')](_0x47bc6c);}return _0x4ca023['status'](_0x47bc6c)['end']();};}function respondWithResult(_0x1dc02d,_0x4aed5b){_0x4aed5b=_0x4aed5b||0xc8;return function(_0x52c7ee){if(_0x52c7ee){return _0x1dc02d[_0xf02c('0x1a')](_0x4aed5b)[_0xf02c('0x1b')](_0x52c7ee);}};}function respondWithFilteredResult(_0x599321,_0x4ed9b3){return function(_0x4ff122){if(_0x4ff122){var _0x322388=typeof _0x4ed9b3[_0xf02c('0x1c')]===_0xf02c('0x1d')&&typeof _0x4ed9b3[_0xf02c('0x1e')]===_0xf02c('0x1d');var _0x48ff02=_0x4ff122[_0xf02c('0x1f')];var _0xe4bf1=_0x322388?0x0:_0x4ed9b3['offset'];var _0x117f25=_0x322388?_0x4ff122[_0xf02c('0x1f')]:_0x4ed9b3['offset']+_0x4ed9b3[_0xf02c('0x1e')];var _0x287185;if(_0x117f25>=_0x48ff02){_0x117f25=_0x48ff02;_0x287185=0xc8;}else{_0x287185=0xce;}_0x599321['status'](_0x287185);return _0x599321['set'](_0xf02c('0x20'),_0xe4bf1+'-'+_0x117f25+'/'+_0x48ff02)['json'](_0x4ff122);}return null;};}function patchUpdates(_0x5a2f0a){return function(_0xb621fc){try{jsonpatch[_0xf02c('0x21')](_0xb621fc,_0x5a2f0a,!![]);}catch(_0x2ab851){return BPromise[_0xf02c('0x22')](_0x2ab851);}return _0xb621fc['save']();};}function saveUpdates(_0x55c5a5,_0x34179f){return function(_0x286ece){if(_0x286ece){return _0x286ece[_0xf02c('0x23')](_0x55c5a5)[_0xf02c('0x24')](function(_0x39a9cd){return _0x39a9cd;});}return null;};}function removeEntity(_0x1f395a,_0x22b85b){return function(_0x3f5130){if(_0x3f5130){return _0x3f5130[_0xf02c('0x25')]()[_0xf02c('0x24')](function(){_0x1f395a['status'](0xcc)[_0xf02c('0x26')]();});}};}function handleEntityNotFound(_0x1627ae,_0x3a7887){return function(_0x8cf459){if(!_0x8cf459){_0x1627ae[_0xf02c('0x19')](0x194);}return _0x8cf459;};}function handleError(_0x116c1e,_0xc87dcd){_0xc87dcd=_0xc87dcd||0x1f4;return function(_0x1fa6a3){logger[_0xf02c('0x27')](_0x1fa6a3[_0xf02c('0x28')]);if(_0x1fa6a3[_0xf02c('0x29')]){delete _0x1fa6a3[_0xf02c('0x29')];}_0x116c1e[_0xf02c('0x1a')](_0xc87dcd)[_0xf02c('0x2a')](_0x1fa6a3);};}exports[_0xf02c('0x2b')]=function(_0x3c7420,_0x3f6783){var _0x77d8de={},_0x2f2ac7={},_0x203efb={'count':0x0,'rows':[]};var _0x53c508=_[_0xf02c('0x2c')](db[_0xf02c('0x2d')][_0xf02c('0x2e')],function(_0x42dba7){return{'name':_0x42dba7[_0xf02c('0x2f')],'type':_0x42dba7[_0xf02c('0x30')][_0xf02c('0x31')]};});_0x2f2ac7[_0xf02c('0x32')]=_[_0xf02c('0x2c')](_0x53c508,_0xf02c('0x29'));_0x2f2ac7['query']=_[_0xf02c('0x33')](_0x3c7420[_0xf02c('0x34')]);_0x2f2ac7[_0xf02c('0x35')]=_[_0xf02c('0x36')](_0x2f2ac7[_0xf02c('0x32')],_0x2f2ac7[_0xf02c('0x34')]);_0x77d8de[_0xf02c('0x37')]=_[_0xf02c('0x36')](_0x2f2ac7[_0xf02c('0x32')],qs['fields'](_0x3c7420[_0xf02c('0x34')][_0xf02c('0x38')]));_0x77d8de[_0xf02c('0x37')]=_0x77d8de[_0xf02c('0x37')]['length']?_0x77d8de[_0xf02c('0x37')]:_0x2f2ac7[_0xf02c('0x32')];if(!_0x3c7420[_0xf02c('0x34')][_0xf02c('0x39')](_0xf02c('0x3a'))){_0x77d8de[_0xf02c('0x1e')]=qs[_0xf02c('0x1e')](_0x3c7420[_0xf02c('0x34')]['limit']);_0x77d8de[_0xf02c('0x1c')]=qs[_0xf02c('0x1c')](_0x3c7420[_0xf02c('0x34')][_0xf02c('0x1c')]);}_0x77d8de[_0xf02c('0x3b')]=qs[_0xf02c('0x3c')](_0x3c7420[_0xf02c('0x34')][_0xf02c('0x3c')]);_0x77d8de[_0xf02c('0x3d')]=qs['filters'](_[_0xf02c('0x3e')](_0x3c7420[_0xf02c('0x34')],_0x2f2ac7['filters']),_0x53c508);if(_0x3c7420[_0xf02c('0x34')][_0xf02c('0x3f')]){_0x77d8de[_0xf02c('0x3d')]=_[_0xf02c('0x40')](_0x77d8de[_0xf02c('0x3d')],{'$or':_[_0xf02c('0x2c')](_0x53c508,function(_0x1429f0){if(_0x1429f0[_0xf02c('0x30')]!==_0xf02c('0x41')){var _0x5b26e3={};_0x5b26e3[_0x1429f0['name']]={'$like':'%'+_0x3c7420[_0xf02c('0x34')][_0xf02c('0x3f')]+'%'};return _0x5b26e3;}})});}_0x77d8de=_[_0xf02c('0x40')]({},_0x77d8de,_0x3c7420['options']);var _0x226937={'where':_0x77d8de[_0xf02c('0x3d')]};return db['CmHopperHistory'][_0xf02c('0x1f')](_0x226937)[_0xf02c('0x24')](function(_0x343ab2){_0x203efb[_0xf02c('0x1f')]=_0x343ab2;if(_0x3c7420[_0xf02c('0x34')][_0xf02c('0x42')]){_0x77d8de[_0xf02c('0x43')]=[{'all':!![]}];}return db[_0xf02c('0x2d')]['findAll'](_0x77d8de);})[_0xf02c('0x24')](function(_0x25914b){_0x203efb['rows']=_0x25914b;return _0x203efb;})[_0xf02c('0x24')](respondWithFilteredResult(_0x3f6783,_0x77d8de))[_0xf02c('0x44')](handleError(_0x3f6783,null));};exports['show']=function(_0x3b8d88,_0x2b4ba7){var _0x24eb8c={'raw':!![],'where':{'id':_0x3b8d88['params']['id']}},_0x16a441={};_0x16a441['model']=_[_0xf02c('0x33')](db[_0xf02c('0x2d')][_0xf02c('0x2e')]);_0x16a441[_0xf02c('0x34')]=_[_0xf02c('0x33')](_0x3b8d88[_0xf02c('0x34')]);_0x16a441[_0xf02c('0x35')]=_[_0xf02c('0x36')](_0x16a441[_0xf02c('0x32')],_0x16a441[_0xf02c('0x34')]);_0x24eb8c['attributes']=_[_0xf02c('0x36')](_0x16a441[_0xf02c('0x32')],qs[_0xf02c('0x38')](_0x3b8d88[_0xf02c('0x34')][_0xf02c('0x38')]));_0x24eb8c['attributes']=_0x24eb8c[_0xf02c('0x37')][_0xf02c('0x45')]?_0x24eb8c[_0xf02c('0x37')]:_0x16a441[_0xf02c('0x32')];if(_0x3b8d88[_0xf02c('0x34')][_0xf02c('0x42')]){_0x24eb8c[_0xf02c('0x43')]=[{'all':!![]}];}_0x24eb8c=_['merge']({},_0x24eb8c,_0x3b8d88[_0xf02c('0x46')]);return db['CmHopperHistory'][_0xf02c('0x47')](_0x24eb8c)[_0xf02c('0x24')](handleEntityNotFound(_0x2b4ba7,null))[_0xf02c('0x24')](respondWithResult(_0x2b4ba7,null))[_0xf02c('0x44')](handleError(_0x2b4ba7,null));};exports[_0xf02c('0x48')]=function(_0x48ac06,_0x15687b){return db[_0xf02c('0x2d')][_0xf02c('0x48')](_0x48ac06[_0xf02c('0x49')],{})[_0xf02c('0x24')](respondWithResult(_0x15687b,0xc9))['catch'](handleError(_0x15687b,null));};exports[_0xf02c('0x4a')]=function(_0x1cd605,_0x564728){return db['CmHopperHistory'][_0xf02c('0x4a')]()[_0xf02c('0x24')](respondWithResult(_0x564728,null))[_0xf02c('0x44')](handleError(_0x564728,null));};exports[_0xf02c('0x23')]=function(_0x4a52dd,_0x3aeea1){if(_0x4a52dd[_0xf02c('0x49')]['uniqueid']){delete _0x4a52dd[_0xf02c('0x49')][_0xf02c('0x4b')];}return db[_0xf02c('0x2d')][_0xf02c('0x47')]({'where':{'uniqueid':_0x4a52dd['params']['id']}})[_0xf02c('0x24')](handleEntityNotFound(_0x3aeea1,null))[_0xf02c('0x24')](saveUpdates(_0x4a52dd[_0xf02c('0x49')],null))[_0xf02c('0x24')](respondWithResult(_0x3aeea1,null))['catch'](handleError(_0x3aeea1,null));}; \ No newline at end of file +var _0x6dc4=['options','CmHopperHistory','includeAll','include','findAll','catch','params','length','find','create','describe','body','uniqueid','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','undefined','count','offset','limit','set','apply','reject','update','then','destroy','error','name','send','map','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL'];(function(_0x1f0e6f,_0x1bc543){var _0x2da10d=function(_0x261a81){while(--_0x261a81){_0x1f0e6f['push'](_0x1f0e6f['shift']());}};_0x2da10d(++_0x1bc543);}(_0x6dc4,0x16b));var _0x46dc=function(_0x20cb46,_0x5b1fd3){_0x20cb46=_0x20cb46-0x0;var _0x3a58f3=_0x6dc4[_0x20cb46];return _0x3a58f3;};'use strict';var emlformat=require(_0x46dc('0x0'));var rimraf=require(_0x46dc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x46dc('0x2'));var rp=require(_0x46dc('0x3'));var moment=require(_0x46dc('0x4'));var BPromise=require(_0x46dc('0x5'));var Mustache=require(_0x46dc('0x6'));var util=require(_0x46dc('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x46dc('0x8'));var ejs=require(_0x46dc('0x9'));var fs=require('fs');var fs_extra=require(_0x46dc('0xa'));var _=require(_0x46dc('0xb'));var squel=require('squel');var crypto=require(_0x46dc('0xc'));var jsforce=require(_0x46dc('0xd'));var deskjs=require(_0x46dc('0xe'));var toCsv=require(_0x46dc('0x8'));var querystring=require('querystring');var Papa=require(_0x46dc('0xf'));var Redis=require(_0x46dc('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x46dc('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x46dc('0x12'))(_0x46dc('0x13'));var utils=require(_0x46dc('0x14'));var config=require(_0x46dc('0x15'));var licenseUtil=require(_0x46dc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x498b7e,_0x2a1237){_0x2a1237=_0x2a1237||0xcc;return function(_0x972237){if(_0x972237){return _0x498b7e['sendStatus'](_0x2a1237);}return _0x498b7e[_0x46dc('0x17')](_0x2a1237)[_0x46dc('0x18')]();};}function respondWithResult(_0xa60344,_0x30e153){_0x30e153=_0x30e153||0xc8;return function(_0x123a51){if(_0x123a51){return _0xa60344['status'](_0x30e153)[_0x46dc('0x19')](_0x123a51);}};}function respondWithFilteredResult(_0x2d611a,_0x2c910b){return function(_0x4389bf){if(_0x4389bf){var _0x35d9f9=typeof _0x2c910b['offset']===_0x46dc('0x1a')&&typeof _0x2c910b['limit']==='undefined';var _0x4d5107=_0x4389bf['count'];var _0x596a4a=_0x35d9f9?0x0:_0x2c910b['offset'];var _0x35549f=_0x35d9f9?_0x4389bf[_0x46dc('0x1b')]:_0x2c910b[_0x46dc('0x1c')]+_0x2c910b[_0x46dc('0x1d')];var _0x2ecf27;if(_0x35549f>=_0x4d5107){_0x35549f=_0x4d5107;_0x2ecf27=0xc8;}else{_0x2ecf27=0xce;}_0x2d611a[_0x46dc('0x17')](_0x2ecf27);return _0x2d611a[_0x46dc('0x1e')]('Content-Range',_0x596a4a+'-'+_0x35549f+'/'+_0x4d5107)['json'](_0x4389bf);}return null;};}function patchUpdates(_0x575023){return function(_0x2e3182){try{jsonpatch[_0x46dc('0x1f')](_0x2e3182,_0x575023,!![]);}catch(_0x13297f){return BPromise[_0x46dc('0x20')](_0x13297f);}return _0x2e3182['save']();};}function saveUpdates(_0x54e544,_0x25e5b4){return function(_0x25bb2d){if(_0x25bb2d){return _0x25bb2d[_0x46dc('0x21')](_0x54e544)[_0x46dc('0x22')](function(_0x1e63b5){return _0x1e63b5;});}return null;};}function removeEntity(_0xdc458d,_0x4bc329){return function(_0x475b66){if(_0x475b66){return _0x475b66[_0x46dc('0x23')]()[_0x46dc('0x22')](function(){_0xdc458d[_0x46dc('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c7d0,_0x164a67){return function(_0x50b8e5){if(!_0x50b8e5){_0x34c7d0['sendStatus'](0x194);}return _0x50b8e5;};}function handleError(_0x185cd8,_0x13a679){_0x13a679=_0x13a679||0x1f4;return function(_0x127210){logger[_0x46dc('0x24')](_0x127210['stack']);if(_0x127210['name']){delete _0x127210[_0x46dc('0x25')];}_0x185cd8[_0x46dc('0x17')](_0x13a679)[_0x46dc('0x26')](_0x127210);};}exports['index']=function(_0x38aaf6,_0x5612ca){var _0x726b1d={},_0x146e86={},_0x360479={'count':0x0,'rows':[]};var _0x2570d2=_[_0x46dc('0x27')](db['CmHopperHistory'][_0x46dc('0x28')],function(_0x2a6338){return{'name':_0x2a6338['fieldName'],'type':_0x2a6338[_0x46dc('0x29')]['key']};});_0x146e86[_0x46dc('0x2a')]=_['map'](_0x2570d2,_0x46dc('0x25'));_0x146e86[_0x46dc('0x2b')]=_[_0x46dc('0x2c')](_0x38aaf6[_0x46dc('0x2b')]);_0x146e86[_0x46dc('0x2d')]=_[_0x46dc('0x2e')](_0x146e86['model'],_0x146e86['query']);_0x726b1d[_0x46dc('0x2f')]=_['intersection'](_0x146e86[_0x46dc('0x2a')],qs[_0x46dc('0x30')](_0x38aaf6[_0x46dc('0x2b')][_0x46dc('0x30')]));_0x726b1d['attributes']=_0x726b1d[_0x46dc('0x2f')]['length']?_0x726b1d['attributes']:_0x146e86['model'];if(!_0x38aaf6['query'][_0x46dc('0x31')](_0x46dc('0x32'))){_0x726b1d['limit']=qs[_0x46dc('0x1d')](_0x38aaf6['query'][_0x46dc('0x1d')]);_0x726b1d[_0x46dc('0x1c')]=qs[_0x46dc('0x1c')](_0x38aaf6['query'][_0x46dc('0x1c')]);}_0x726b1d[_0x46dc('0x33')]=qs['sort'](_0x38aaf6[_0x46dc('0x2b')][_0x46dc('0x34')]);_0x726b1d['where']=qs['filters'](_['pick'](_0x38aaf6[_0x46dc('0x2b')],_0x146e86['filters']),_0x2570d2);if(_0x38aaf6[_0x46dc('0x2b')][_0x46dc('0x35')]){_0x726b1d[_0x46dc('0x36')]=_[_0x46dc('0x37')](_0x726b1d[_0x46dc('0x36')],{'$or':_['map'](_0x2570d2,function(_0x524692){if(_0x524692[_0x46dc('0x29')]!==_0x46dc('0x38')){var _0x400022={};_0x400022[_0x524692['name']]={'$like':'%'+_0x38aaf6[_0x46dc('0x2b')][_0x46dc('0x35')]+'%'};return _0x400022;}})});}_0x726b1d=_['merge']({},_0x726b1d,_0x38aaf6[_0x46dc('0x39')]);var _0x40b6ff={'where':_0x726b1d[_0x46dc('0x36')]};return db[_0x46dc('0x3a')]['count'](_0x40b6ff)[_0x46dc('0x22')](function(_0x407c9f){_0x360479[_0x46dc('0x1b')]=_0x407c9f;if(_0x38aaf6[_0x46dc('0x2b')][_0x46dc('0x3b')]){_0x726b1d[_0x46dc('0x3c')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x46dc('0x3d')](_0x726b1d);})[_0x46dc('0x22')](function(_0x59f321){_0x360479['rows']=_0x59f321;return _0x360479;})[_0x46dc('0x22')](respondWithFilteredResult(_0x5612ca,_0x726b1d))[_0x46dc('0x3e')](handleError(_0x5612ca,null));};exports['show']=function(_0x73e530,_0x56d805){var _0x2ebfc0={'raw':!![],'where':{'id':_0x73e530[_0x46dc('0x3f')]['id']}},_0x30035a={};_0x30035a['model']=_[_0x46dc('0x2c')](db[_0x46dc('0x3a')][_0x46dc('0x28')]);_0x30035a[_0x46dc('0x2b')]=_[_0x46dc('0x2c')](_0x73e530['query']);_0x30035a[_0x46dc('0x2d')]=_[_0x46dc('0x2e')](_0x30035a['model'],_0x30035a[_0x46dc('0x2b')]);_0x2ebfc0['attributes']=_['intersection'](_0x30035a['model'],qs[_0x46dc('0x30')](_0x73e530['query'][_0x46dc('0x30')]));_0x2ebfc0[_0x46dc('0x2f')]=_0x2ebfc0[_0x46dc('0x2f')][_0x46dc('0x40')]?_0x2ebfc0[_0x46dc('0x2f')]:_0x30035a[_0x46dc('0x2a')];if(_0x73e530[_0x46dc('0x2b')]['includeAll']){_0x2ebfc0[_0x46dc('0x3c')]=[{'all':!![]}];}_0x2ebfc0=_[_0x46dc('0x37')]({},_0x2ebfc0,_0x73e530['options']);return db['CmHopperHistory'][_0x46dc('0x41')](_0x2ebfc0)[_0x46dc('0x22')](handleEntityNotFound(_0x56d805,null))['then'](respondWithResult(_0x56d805,null))[_0x46dc('0x3e')](handleError(_0x56d805,null));};exports['create']=function(_0x9e9430,_0x4859c3){return db[_0x46dc('0x3a')][_0x46dc('0x42')](_0x9e9430['body'],{})[_0x46dc('0x22')](respondWithResult(_0x4859c3,0xc9))['catch'](handleError(_0x4859c3,null));};exports['describe']=function(_0x550dd4,_0x2d6ace){return db[_0x46dc('0x3a')][_0x46dc('0x43')]()[_0x46dc('0x22')](respondWithResult(_0x2d6ace,null))[_0x46dc('0x3e')](handleError(_0x2d6ace,null));};exports[_0x46dc('0x21')]=function(_0x269079,_0x5db59b){if(_0x269079[_0x46dc('0x44')][_0x46dc('0x45')]){delete _0x269079[_0x46dc('0x44')][_0x46dc('0x45')];}return db['CmHopperHistory'][_0x46dc('0x41')]({'where':{'uniqueid':_0x269079[_0x46dc('0x3f')]['id']}})[_0x46dc('0x22')](handleEntityNotFound(_0x5db59b,null))[_0x46dc('0x22')](saveUpdates(_0x269079[_0x46dc('0x44')],null))[_0x46dc('0x22')](respondWithResult(_0x5db59b,null))[_0x46dc('0x3e')](handleError(_0x5db59b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 034ae15..db18528 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 _0xfa94=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cmHopperHistory.attributes','exports','CmHopperHistory','cm_hopper_history','uniqueid','lodash'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xfa94,0xef));var _0x4fa9=function(_0x20025e,_0x44c8e1){_0x20025e=_0x20025e-0x0;var _0x4a5ac4=_0xfa94[_0x20025e];return _0x4a5ac4;};'use strict';var _=require(_0x4fa9('0x0'));var util=require('util');var logger=require(_0x4fa9('0x1'))('api');var moment=require(_0x4fa9('0x2'));var BPromise=require(_0x4fa9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4fa9('0x4'));var rimraf=require(_0x4fa9('0x5'));var config=require(_0x4fa9('0x6'));var attributes=require(_0x4fa9('0x7'));module[_0x4fa9('0x8')]=function(_0x460a55,_0x3b703f){return _0x460a55['define'](_0x4fa9('0x9'),attributes,{'tableName':_0x4fa9('0xa'),'paranoid':![],'indexes':[{'name':'endtime','fields':['endtime']},{'name':_0x4fa9('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x0755=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','endtime','uniqueid','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0755,0x7c));var _0x5075=function(_0xf2c0d7,_0x95dec0){_0xf2c0d7=_0xf2c0d7-0x0;var _0x2ec8d3=_0x0755[_0xf2c0d7];return _0x2ec8d3;};'use strict';var _=require(_0x5075('0x0'));var util=require(_0x5075('0x1'));var logger=require(_0x5075('0x2'))(_0x5075('0x3'));var moment=require(_0x5075('0x4'));var BPromise=require(_0x5075('0x5'));var rp=require(_0x5075('0x6'));var fs=require('fs');var path=require(_0x5075('0x7'));var rimraf=require(_0x5075('0x8'));var config=require(_0x5075('0x9'));var attributes=require('./cmHopperHistory.attributes');module[_0x5075('0xa')]=function(_0x2a7be,_0x3f4fea){return _0x2a7be[_0x5075('0xb')]('CmHopperHistory',attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':'endtime','fields':[_0x5075('0xc')]},{'name':_0x5075('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 88b9755..8de85ac 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 _0x7035=['GetVoiceQueueHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','GetCampaignHopperHistory','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','info','request\x20sent','stringify','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','create','body','options','then','debug','raw','where','sequelize','predictiveIntervalTotalCalls','COUNT','literal','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','predictiveIntervalAvgTalktime','AvgHandleTime','CmHopperHistory','findAll','campaign','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundReCallsDay'];(function(_0x3737ac,_0x53ebe6){var _0x542c8d=function(_0x432f74){while(--_0x432f74){_0x3737ac['push'](_0x3737ac['shift']());}};_0x542c8d(++_0x53ebe6);}(_0x7035,0x15e));var _0x5703=function(_0x3cdb45,_0x1e0f26){_0x3cdb45=_0x3cdb45-0x0;var _0x59d8fb=_0x7035[_0x3cdb45];return _0x59d8fb;};'use strict';var _=require(_0x5703('0x0'));var util=require('util');var moment=require(_0x5703('0x1'));var BPromise=require(_0x5703('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x5703('0x3'));var db=require(_0x5703('0x4'))['db'];var utils=require(_0x5703('0x5'));var logger=require(_0x5703('0x6'))(_0x5703('0x7'));var config=require('../../config/environment');var jayson=require(_0x5703('0x8'));var client=jayson[_0x5703('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2e2e90,_0x1b1ee9,_0x401d33){return new BPromise(function(_0x291988,_0x1afe73){return client[_0x5703('0xa')](_0x2e2e90,_0x401d33)['then'](function(_0x58a04c){logger[_0x5703('0xb')]('CmHopperHistory,\x20%s,\x20%s',_0x1b1ee9,_0x5703('0xc'));logger['debug']('CmHopperHistory,\x20%s,\x20%s,\x20%s',_0x1b1ee9,_0x5703('0xc'),JSON[_0x5703('0xd')](_0x58a04c));if(_0x58a04c[_0x5703('0xe')]){if(_0x58a04c['error'][_0x5703('0xf')]===0x1f4){logger['error'](_0x5703('0x10'),_0x1b1ee9,_0x58a04c[_0x5703('0xe')][_0x5703('0x11')]);return _0x1afe73(_0x58a04c[_0x5703('0xe')][_0x5703('0x11')]);}logger[_0x5703('0xe')](_0x5703('0x10'),_0x1b1ee9,_0x58a04c[_0x5703('0xe')][_0x5703('0x11')]);return _0x291988(_0x58a04c[_0x5703('0xe')][_0x5703('0x11')]);}else{logger['info'](_0x5703('0x10'),_0x1b1ee9,_0x5703('0xc'));_0x291988(_0x58a04c[_0x5703('0x12')][_0x5703('0x11')]);}})[_0x5703('0x13')](function(_0x4576d4){logger[_0x5703('0xe')](_0x5703('0x10'),_0x1b1ee9,_0x4576d4);_0x1afe73(_0x4576d4);});});}exports[_0x5703('0x14')]=function(_0x595fca){var _0xa46a39=this;return new Promise(function(_0xba6348,_0x51f0d6){return db['CmHopperHistory'][_0x5703('0x15')](_0x595fca[_0x5703('0x16')],{'raw':_0x595fca['options']?_0x595fca[_0x5703('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x5703('0x18')](function(_0x33d30a){logger[_0x5703('0xb')](_0x5703('0x14'),_0x595fca);logger[_0x5703('0x19')](_0x5703('0x14'),_0x595fca,JSON[_0x5703('0xd')](_0x33d30a));_0xba6348(_0x33d30a);})['catch'](function(_0x4f90e7){logger[_0x5703('0xe')](_0x5703('0x14'),_0x4f90e7['message'],_0x595fca);_0x51f0d6(_0xa46a39[_0x5703('0xe')](0x1f4,_0x4f90e7[_0x5703('0x11')]));});});};exports['AvgHandleTime']=function(_0x27da08){var _0x25a56e=this;return new Promise(function(_0x30c6ac,_0x5e98e4){return db['CmHopperHistory']['findAll']({'raw':_0x27da08[_0x5703('0x17')]?_0x27da08['options'][_0x5703('0x1a')]===undefined?!![]:![]:!![],'where':_0x27da08[_0x5703('0x17')]?_0x27da08[_0x5703('0x17')][_0x5703('0x1b')]||null:null,'attributes':[[db[_0x5703('0x1c')]['fn']('COUNT',db[_0x5703('0x1c')]['col']('id')),_0x5703('0x1d')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db['sequelize']['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')]('`state`\x20=\x204,\x201,\x20null'))),_0x5703('0x20')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x5703('0x21')))),_0x5703('0x22')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')](_0x5703('0x23')))),_0x5703('0x24')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x25'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')]['literal']('`state`\x20=\x204,\x20`holdtime`,\x20null'))),'predictiveIntervalAvgHoldtime'],[db[_0x5703('0x1c')]['fn'](_0x5703('0x25'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0x5703('0x26')]]})[_0x5703('0x18')](function(_0x13319d){logger['info'](_0x5703('0x27'),_0x27da08);logger[_0x5703('0x19')](_0x5703('0x27'),_0x27da08,JSON[_0x5703('0xd')](_0x13319d));_0x30c6ac(_0x13319d);})['catch'](function(_0x3d5ef5){logger[_0x5703('0xe')]('AvgHandleTime',_0x3d5ef5[_0x5703('0x11')],_0x27da08);_0x5e98e4(_0x25a56e[_0x5703('0xe')](0x1f4,_0x3d5ef5[_0x5703('0x11')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x2d3f66){var _0x50ec6d=this;return new Promise(function(_0x5a4730,_0x319aa6){return db[_0x5703('0x28')][_0x5703('0x29')]({'raw':_0x2d3f66['options']?_0x2d3f66['options'][_0x5703('0x1a')]===undefined?!![]:![]:!![],'where':_0x2d3f66[_0x5703('0x17')]?_0x2d3f66[_0x5703('0x17')][_0x5703('0x1b')]||null:null,'attributes':[[_0x5703('0x2a'),'name'],[db['sequelize']['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')](_0x5703('0x2b')))),_0x5703('0x2c')],[db['sequelize']['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')](_0x5703('0x2d')))),_0x5703('0x2e')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db['sequelize'][_0x5703('0x1f')](_0x5703('0x2f')))),'outboundAnswerCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')]['literal'](_0x5703('0x30')))),_0x5703('0x31')],[db['sequelize']['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')]('`state`\x20=\x208,\x201,\x20null'))),_0x5703('0x32')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')](_0x5703('0x33')))),'outboundDropCallsDayTimeout'],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')](_0x5703('0x34')))),_0x5703('0x35')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db['sequelize'][_0x5703('0x1f')](_0x5703('0x36')))),_0x5703('0x37')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')](_0x5703('0x38')))),_0x5703('0x39')],[db[_0x5703('0x1c')]['fn']('COUNT',db[_0x5703('0x1c')]['fn']('IF',db['sequelize'][_0x5703('0x1f')](_0x5703('0x3a')))),_0x5703('0x3b')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')]['literal'](_0x5703('0x3c')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')]['literal']('`state`\x20=\x2016,\x201,\x20null'))),_0x5703('0x3d')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')](_0x5703('0x3e')))),'outboundRejectCallsDay'],[db['sequelize']['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')]('`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null'))),_0x5703('0x3f')]],'group':[_0x5703('0x2a')]})[_0x5703('0x18')](function(_0x3a7d37){logger['info'](_0x5703('0x40'),_0x2d3f66);logger[_0x5703('0x19')](_0x5703('0x40'),_0x2d3f66,JSON[_0x5703('0xd')](_0x3a7d37));_0x5a4730(_0x3a7d37);})[_0x5703('0x13')](function(_0x51bc9f){logger[_0x5703('0xe')](_0x5703('0x40'),_0x51bc9f[_0x5703('0x11')],_0x2d3f66);_0x319aa6(_0x50ec6d[_0x5703('0xe')](0x1f4,_0x51bc9f['message']));});});};exports['GetCampaignHopperHistory']=function(_0x85f9b5){var _0x4dee78=this;return new Promise(function(_0x5a8505,_0x4ff9b0){return db[_0x5703('0x28')][_0x5703('0x29')]({'raw':_0x85f9b5[_0x5703('0x17')]?_0x85f9b5[_0x5703('0x17')][_0x5703('0x1a')]===undefined?!![]:![]:!![],'where':_0x85f9b5[_0x5703('0x17')]?_0x85f9b5[_0x5703('0x17')]['where']||null:null,'attributes':[['campaign',_0x5703('0x41')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['col']('id')),_0x5703('0x42')],[db[_0x5703('0x1c')]['fn'](_0x5703('0x1e'),db[_0x5703('0x1c')]['fn']('IF',db[_0x5703('0x1c')][_0x5703('0x1f')](_0x5703('0x2f')))),_0x5703('0x43')]],'group':[_0x5703('0x2a')]})[_0x5703('0x18')](function(_0x1cec65){logger[_0x5703('0xb')](_0x5703('0x44'),_0x85f9b5);logger[_0x5703('0x19')](_0x5703('0x44'),_0x85f9b5,JSON[_0x5703('0xd')](_0x1cec65));_0x5a8505(_0x1cec65);})[_0x5703('0x13')](function(_0xc5c069){logger[_0x5703('0xe')]('GetCampaignHopperHistory',_0xc5c069[_0x5703('0x11')],_0x85f9b5);_0x4ff9b0(_0x4dee78[_0x5703('0xe')](0x1f4,_0xc5c069[_0x5703('0x11')]));});});}; \ No newline at end of file +var _0x16e3=['../../config/environment','jayson/promise','http','request','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateCmHopperHistory','CmHopperHistory','create','body','options','then','debug','stringify','AvgHandleTime','raw','where','sequelize','COUNT','col','predictiveIntervalTotalCalls','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalAnsweredCalls','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','findAll','campaign','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','outboundOriginateFailureCallsDay','`state`\x20=\x2018,\x201,\x20null','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','outboundRejectCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetVoiceQueueHopperHistory','GetCampaignHopperHistory','name','ivrTotalCallsDays','ivrAnswerCallsDay','lodash','bluebird','ioredis','../../mysqldb','../../config/logger'];(function(_0x3480ee,_0xe4b2fb){var _0x1cccbd=function(_0x1de9c3){while(--_0x1de9c3){_0x3480ee['push'](_0x3480ee['shift']());}};_0x1cccbd(++_0xe4b2fb);}(_0x16e3,0x168));var _0x316e=function(_0x485f1,_0xdeea1f){_0x485f1=_0x485f1-0x0;var _0x40cedc=_0x16e3[_0x485f1];return _0x40cedc;};'use strict';var _=require(_0x316e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x316e('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x316e('0x2'));var db=require(_0x316e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x316e('0x4'))('rpc');var config=require(_0x316e('0x5'));var jayson=require(_0x316e('0x6'));var client=jayson['client'][_0x316e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5d7a5e,_0xb85517,_0x4ca4fc){return new BPromise(function(_0x250138,_0x5ac590){return client[_0x316e('0x8')](_0x5d7a5e,_0x4ca4fc)['then'](function(_0x538cba){logger['info'](_0x316e('0x9'),_0xb85517,_0x316e('0xa'));logger['debug'](_0x316e('0xb'),_0xb85517,_0x316e('0xa'),JSON['stringify'](_0x538cba));if(_0x538cba[_0x316e('0xc')]){if(_0x538cba['error']['code']===0x1f4){logger[_0x316e('0xc')](_0x316e('0x9'),_0xb85517,_0x538cba[_0x316e('0xc')][_0x316e('0xd')]);return _0x5ac590(_0x538cba['error'][_0x316e('0xd')]);}logger['error'](_0x316e('0x9'),_0xb85517,_0x538cba[_0x316e('0xc')][_0x316e('0xd')]);return _0x250138(_0x538cba['error'][_0x316e('0xd')]);}else{logger[_0x316e('0xe')](_0x316e('0x9'),_0xb85517,'request\x20sent');_0x250138(_0x538cba[_0x316e('0xf')][_0x316e('0xd')]);}})[_0x316e('0x10')](function(_0x127ca0){logger[_0x316e('0xc')](_0x316e('0x9'),_0xb85517,_0x127ca0);_0x5ac590(_0x127ca0);});});}exports[_0x316e('0x11')]=function(_0x5a25b8){var _0x3ca181=this;return new Promise(function(_0x1c5fe9,_0xb48d69){return db[_0x316e('0x12')][_0x316e('0x13')](_0x5a25b8[_0x316e('0x14')],{'raw':_0x5a25b8[_0x316e('0x15')]?_0x5a25b8[_0x316e('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x316e('0x16')](function(_0x59acee){logger[_0x316e('0xe')](_0x316e('0x11'),_0x5a25b8);logger[_0x316e('0x17')](_0x316e('0x11'),_0x5a25b8,JSON[_0x316e('0x18')](_0x59acee));_0x1c5fe9(_0x59acee);})[_0x316e('0x10')](function(_0x3c725d){logger[_0x316e('0xc')](_0x316e('0x11'),_0x3c725d[_0x316e('0xd')],_0x5a25b8);_0xb48d69(_0x3ca181[_0x316e('0xc')](0x1f4,_0x3c725d[_0x316e('0xd')]));});});};exports[_0x316e('0x19')]=function(_0x3f62fb){var _0x15252b=this;return new Promise(function(_0x193463,_0x554dde){return db[_0x316e('0x12')]['findAll']({'raw':_0x3f62fb[_0x316e('0x15')]?_0x3f62fb[_0x316e('0x15')][_0x316e('0x1a')]===undefined?!![]:![]:!![],'where':_0x3f62fb[_0x316e('0x15')]?_0x3f62fb[_0x316e('0x15')][_0x316e('0x1b')]||null:null,'attributes':[[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')][_0x316e('0x1e')]('id')),_0x316e('0x1f')],[db[_0x316e('0x1c')]['fn']('COUNT',db[_0x316e('0x1c')]['fn']('IF',db['sequelize'][_0x316e('0x20')](_0x316e('0x21')))),_0x316e('0x22')],[db[_0x316e('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x316e('0x20')](_0x316e('0x23')))),_0x316e('0x24')],[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['fn']('IF',db[_0x316e('0x1c')][_0x316e('0x20')](_0x316e('0x25')))),_0x316e('0x26')],[db[_0x316e('0x1c')]['fn'](_0x316e('0x27'),db[_0x316e('0x1c')]['fn']('IF',db['sequelize'][_0x316e('0x20')](_0x316e('0x28')))),_0x316e('0x29')],[db['sequelize']['fn']('AVG',db['sequelize']['fn']('IF',db[_0x316e('0x1c')]['literal'](_0x316e('0x2a')))),_0x316e('0x2b')]]})[_0x316e('0x16')](function(_0x32a8a6){logger[_0x316e('0xe')](_0x316e('0x19'),_0x3f62fb);logger['debug'](_0x316e('0x19'),_0x3f62fb,JSON[_0x316e('0x18')](_0x32a8a6));_0x193463(_0x32a8a6);})['catch'](function(_0x4a07c6){logger['error'](_0x316e('0x19'),_0x4a07c6[_0x316e('0xd')],_0x3f62fb);_0x554dde(_0x15252b[_0x316e('0xc')](0x1f4,_0x4a07c6[_0x316e('0xd')]));});});};exports['GetVoiceQueueHopperHistory']=function(_0x42c812){var _0x85191=this;return new Promise(function(_0xb5b46d,_0xc39193){return db[_0x316e('0x12')][_0x316e('0x2c')]({'raw':_0x42c812[_0x316e('0x15')]?_0x42c812[_0x316e('0x15')][_0x316e('0x1a')]===undefined?!![]:![]:!![],'where':_0x42c812[_0x316e('0x15')]?_0x42c812[_0x316e('0x15')][_0x316e('0x1b')]||null:null,'attributes':[[_0x316e('0x2d'),'name'],[db['sequelize']['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['fn']('IF',db[_0x316e('0x1c')]['literal'](_0x316e('0x2e')))),'outboundNoSuchCallsDay'],[db[_0x316e('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x316e('0x1c')][_0x316e('0x20')](_0x316e('0x2f')))),_0x316e('0x30')],[db['sequelize']['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x316e('0x1c')][_0x316e('0x20')](_0x316e('0x21')))),_0x316e('0x31')],[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['fn']('IF',db[_0x316e('0x1c')]['literal']('`state`\x20=\x205,\x201,\x20null'))),_0x316e('0x32')],[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['fn']('IF',db['sequelize']['literal'](_0x316e('0x33')))),'outboundCongestionCallsDay'],[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db['sequelize']['fn']('IF',db[_0x316e('0x1c')]['literal'](_0x316e('0x34')))),_0x316e('0x35')],[db['sequelize']['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['fn']('IF',db['sequelize'][_0x316e('0x20')](_0x316e('0x36')))),_0x316e('0x37')],[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['fn']('IF',db[_0x316e('0x1c')]['literal'](_0x316e('0x38')))),_0x316e('0x39')],[db[_0x316e('0x1c')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0x316e('0x20')](_0x316e('0x3a')))),_0x316e('0x3b')],[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['fn']('IF',db[_0x316e('0x1c')][_0x316e('0x20')](_0x316e('0x3c')))),_0x316e('0x3d')],[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['fn']('IF',db[_0x316e('0x1c')]['literal'](_0x316e('0x3e')))),'outboundRejectCallsDay'],[db['sequelize']['fn']('COUNT',db[_0x316e('0x1c')]['fn']('IF',db[_0x316e('0x1c')][_0x316e('0x20')](_0x316e('0x3f')))),_0x316e('0x40')],[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['fn']('IF',db[_0x316e('0x1c')]['literal'](_0x316e('0x41')))),_0x316e('0x42')],[db[_0x316e('0x1c')]['fn']('COUNT',db[_0x316e('0x1c')]['fn']('IF',db[_0x316e('0x1c')][_0x316e('0x20')](_0x316e('0x43')))),'outboundReCallsDay']],'group':[_0x316e('0x2d')]})['then'](function(_0x5a1442){logger['info'](_0x316e('0x44'),_0x42c812);logger[_0x316e('0x17')](_0x316e('0x44'),_0x42c812,JSON[_0x316e('0x18')](_0x5a1442));_0xb5b46d(_0x5a1442);})[_0x316e('0x10')](function(_0x5c366d){logger['error'](_0x316e('0x44'),_0x5c366d[_0x316e('0xd')],_0x42c812);_0xc39193(_0x85191['error'](0x1f4,_0x5c366d['message']));});});};exports[_0x316e('0x45')]=function(_0x41670e){var _0x133d65=this;return new Promise(function(_0x15b15a,_0x458158){return db[_0x316e('0x12')]['findAll']({'raw':_0x41670e['options']?_0x41670e[_0x316e('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x41670e['options']?_0x41670e['options'][_0x316e('0x1b')]||null:null,'attributes':[[_0x316e('0x2d'),_0x316e('0x46')],[db['sequelize']['fn'](_0x316e('0x1d'),db[_0x316e('0x1c')]['col']('id')),_0x316e('0x47')],[db[_0x316e('0x1c')]['fn'](_0x316e('0x1d'),db['sequelize']['fn']('IF',db[_0x316e('0x1c')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x316e('0x48')]],'group':[_0x316e('0x2d')]})[_0x316e('0x16')](function(_0xe0b431){logger[_0x316e('0xe')](_0x316e('0x45'),_0x41670e);logger[_0x316e('0x17')](_0x316e('0x45'),_0x41670e,JSON[_0x316e('0x18')](_0xe0b431));_0x15b15a(_0xe0b431);})[_0x316e('0x10')](function(_0x4b6a3a){logger['error'](_0x316e('0x45'),_0x4b6a3a[_0x316e('0xd')],_0x41670e);_0x458158(_0x133d65[_0x316e('0xc')](0x1f4,_0x4b6a3a['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index b0710c0..d9faceb 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 _0xb9ba=['../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index','describe','/:id','post','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb9ba,0xe9));var _0xab9b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xb9ba[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xab9b('0x0'));var util=require(_0xab9b('0x1'));var path=require(_0xab9b('0x2'));var timeout=require('connect-timeout');var express=require(_0xab9b('0x3'));var router=express[_0xab9b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xab9b('0x5'));var interaction=require(_0xab9b('0x6'));var config=require(_0xab9b('0x7'));var controller=require(_0xab9b('0x8'));router[_0xab9b('0x9')]('/',auth[_0xab9b('0xa')](),controller[_0xab9b('0xb')]);router[_0xab9b('0x9')]('/describe',auth[_0xab9b('0xa')](),controller[_0xab9b('0xc')]);router[_0xab9b('0x9')](_0xab9b('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xab9b('0xe')]('/',auth[_0xab9b('0xa')](),controller['create']);router['put'](_0xab9b('0xd'),auth['isAuthenticated'](),controller['update']);module[_0xab9b('0xf')]=router; \ No newline at end of file +var _0xaac9=['index','describe','/:id','show','post','update','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated'];(function(_0x5888d5,_0x50d053){var _0x4ce407=function(_0x3a51ff){while(--_0x3a51ff){_0x5888d5['push'](_0x5888d5['shift']());}};_0x4ce407(++_0x50d053);}(_0xaac9,0x128));var _0x9aac=function(_0x1fb1c1,_0x4ebe69){_0x1fb1c1=_0x1fb1c1-0x0;var _0x1622df=_0xaac9[_0x1fb1c1];return _0x1622df;};'use strict';var multer=require(_0x9aac('0x0'));var util=require(_0x9aac('0x1'));var path=require('path');var timeout=require(_0x9aac('0x2'));var express=require('express');var router=express[_0x9aac('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9aac('0x4'));var interaction=require(_0x9aac('0x5'));var config=require(_0x9aac('0x6'));var controller=require(_0x9aac('0x7'));router[_0x9aac('0x8')]('/',auth[_0x9aac('0x9')](),controller[_0x9aac('0xa')]);router['get']('/describe',auth[_0x9aac('0x9')](),controller[_0x9aac('0xb')]);router[_0x9aac('0x8')](_0x9aac('0xc'),auth['isAuthenticated'](),controller[_0x9aac('0xd')]);router[_0x9aac('0xe')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x9aac('0x9')](),controller[_0x9aac('0xf')]);module[_0x9aac('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 b222f28..957b7c8 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 _0x3c7b=['name','sequelize','exports','STRING'];(function(_0x2f2360,_0x151089){var _0x1cc8d3=function(_0x5e356f){while(--_0x5e356f){_0x2f2360['push'](_0x2f2360['shift']());}};_0x1cc8d3(++_0x151089);}(_0x3c7b,0x11d));var _0xb3c7=function(_0x4bd775,_0x3af2c6){_0x4bd775=_0x4bd775-0x0;var _0x270e5e=_0x3c7b[_0x4bd775];return _0x270e5e;};'use strict';var Sequelize=require(_0xb3c7('0x0'));module[_0xb3c7('0x1')]={'name':{'type':Sequelize[_0xb3c7('0x2')],'unique':_0xb3c7('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xb3c7('0x2')]},'dialPrefix':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xcd59=['exports','STRING','name','sequelize'];(function(_0x98c1b1,_0x518137){var _0x337152=function(_0x3edab3){while(--_0x3edab3){_0x98c1b1['push'](_0x98c1b1['shift']());}};_0x337152(++_0x518137);}(_0xcd59,0x14b));var _0x9cd5=function(_0x5b733d,_0x272606){_0x5b733d=_0x5b733d-0x0;var _0x2b7995=_0xcd59[_0x5b733d];return _0x2b7995;};'use strict';var Sequelize=require(_0x9cd5('0x0'));module[_0x9cd5('0x1')]={'name':{'type':Sequelize[_0x9cd5('0x2')],'unique':_0x9cd5('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x9cd5('0x2')]},'dialPrefix':{'type':Sequelize[_0x9cd5('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index d911de6..fcc37b5 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 _0xeedf=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addDisposition','ListId','getDispositions','findOne','Disposition','removeDispositions','ids','addContacts','CmContact','describe','tags','isArray','join','push','omit','success','dataValues','errors','Malformed\x20request\x20syntax','CmCustomField','concat','CustomFields','cf_%d','raw','getContacts','isEmpty','writeFileSync','format','/tmp/list_%d_%s.csv','setHeader','Content-disposition','list_%d_%s.csv','text/csv','sequelize','addCustomFields','Sequelize','INTEGER','switch','BOOLEAN','defaultValue','queryInterface','addColumn','cm_contacts','getCustomFields','findAndCountAll','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','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','../../mysqldb','redis','defaults','./cmList.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','get','Lists','UserProfileResource','error','stack','name','send','map','CmList','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','rawAttributes','find'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xeedf,0xc9));var _0xfeed=function(_0x27669d,_0x166428){_0x27669d=_0x27669d-0x0;var _0x25568c=_0xeedf[_0x27669d];return _0x25568c;};'use strict';var emlformat=require(_0xfeed('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfeed('0x1'));var rp=require('request-promise');var moment=require(_0xfeed('0x2'));var BPromise=require(_0xfeed('0x3'));var Mustache=require(_0xfeed('0x4'));var util=require(_0xfeed('0x5'));var path=require(_0xfeed('0x6'));var sox=require(_0xfeed('0x7'));var csv=require(_0xfeed('0x8'));var ejs=require(_0xfeed('0x9'));var fs=require('fs');var fs_extra=require(_0xfeed('0xa'));var _=require(_0xfeed('0xb'));var squel=require('squel');var crypto=require(_0xfeed('0xc'));var jsforce=require(_0xfeed('0xd'));var deskjs=require(_0xfeed('0xe'));var toCsv=require(_0xfeed('0x8'));var querystring=require(_0xfeed('0xf'));var Papa=require(_0xfeed('0x10'));var Redis=require(_0xfeed('0x11'));var authService=require(_0xfeed('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xfeed('0x13'));var hardwareService=require(_0xfeed('0x14'));var logger=require(_0xfeed('0x15'))(_0xfeed('0x16'));var utils=require(_0xfeed('0x17'));var config=require(_0xfeed('0x18'));var licenseUtil=require(_0xfeed('0x19'));var db=require(_0xfeed('0x1a'))['db'];config[_0xfeed('0x1b')]=_[_0xfeed('0x1c')](config[_0xfeed('0x1b')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfeed('0x1d'))[_0xfeed('0x1e')](socket);function respondWithStatusCode(_0x344641,_0x47378f){_0x47378f=_0x47378f||0xcc;return function(_0x40810c){if(_0x40810c){return _0x344641[_0xfeed('0x1f')](_0x47378f);}return _0x344641[_0xfeed('0x20')](_0x47378f)[_0xfeed('0x21')]();};}function respondWithResult(_0x532948,_0x3ca5b2){_0x3ca5b2=_0x3ca5b2||0xc8;return function(_0x2149eb){if(_0x2149eb){return _0x532948[_0xfeed('0x20')](_0x3ca5b2)[_0xfeed('0x22')](_0x2149eb);}};}function respondWithFilteredResult(_0x1b5d59,_0x4a8500){return function(_0x3b0d26){if(_0x3b0d26){var _0x50c6ad=typeof _0x4a8500[_0xfeed('0x23')]===_0xfeed('0x24')&&typeof _0x4a8500[_0xfeed('0x25')]===_0xfeed('0x24');var _0x1d453e=_0x3b0d26[_0xfeed('0x26')];var _0x4711d3=_0x50c6ad?0x0:_0x4a8500[_0xfeed('0x23')];var _0x29c626=_0x50c6ad?_0x3b0d26[_0xfeed('0x26')]:_0x4a8500[_0xfeed('0x23')]+_0x4a8500[_0xfeed('0x25')];var _0x302079;if(_0x29c626>=_0x1d453e){_0x29c626=_0x1d453e;_0x302079=0xc8;}else{_0x302079=0xce;}_0x1b5d59[_0xfeed('0x20')](_0x302079);return _0x1b5d59[_0xfeed('0x27')](_0xfeed('0x28'),_0x4711d3+'-'+_0x29c626+'/'+_0x1d453e)[_0xfeed('0x22')](_0x3b0d26);}return null;};}function patchUpdates(_0x6db848){return function(_0x49d90e){try{jsonpatch[_0xfeed('0x29')](_0x49d90e,_0x6db848,!![]);}catch(_0xac2147){return BPromise['reject'](_0xac2147);}return _0x49d90e[_0xfeed('0x2a')]();};}function saveUpdates(_0xdf1921,_0x5c2bcb){return function(_0xc1984a){if(_0xc1984a){return _0xc1984a['update'](_0xdf1921)[_0xfeed('0x2b')](function(_0x1fcbd9){return _0x1fcbd9;});}return null;};}function removeEntity(_0x201e7e,_0x1deed8){return function(_0x11ab9a){if(_0x11ab9a){return _0x11ab9a[_0xfeed('0x2c')]()[_0xfeed('0x2b')](function(){var _0xb14102=_0x11ab9a[_0xfeed('0x2d')]({'plain':!![]});var _0x2e989b=_0xfeed('0x2e');return db[_0xfeed('0x2f')][_0xfeed('0x2c')]({'where':{'type':_0x2e989b,'resourceId':_0xb14102['id']}})[_0xfeed('0x2b')](function(){return _0x11ab9a;});})['then'](function(){_0x201e7e[_0xfeed('0x20')](0xcc)[_0xfeed('0x21')]();});}};}function handleEntityNotFound(_0xe2f6dd,_0x43bd79){return function(_0x1f0ce9){if(!_0x1f0ce9){_0xe2f6dd[_0xfeed('0x1f')](0x194);}return _0x1f0ce9;};}function handleError(_0xce11b9,_0x594f59){_0x594f59=_0x594f59||0x1f4;return function(_0x4885ef){logger[_0xfeed('0x30')](_0x4885ef[_0xfeed('0x31')]);if(_0x4885ef[_0xfeed('0x32')]){delete _0x4885ef[_0xfeed('0x32')];}_0xce11b9['status'](_0x594f59)[_0xfeed('0x33')](_0x4885ef);};}exports['index']=function(_0x3e97b3,_0x3586cf){var _0x17c92e={},_0x2fd78a={},_0x804539={'count':0x0,'rows':[]};var _0x2ece70=_[_0xfeed('0x34')](db[_0xfeed('0x35')]['rawAttributes'],function(_0x1f418b){return{'name':_0x1f418b[_0xfeed('0x36')],'type':_0x1f418b['type'][_0xfeed('0x37')]};});_0x2fd78a[_0xfeed('0x38')]=_[_0xfeed('0x34')](_0x2ece70,'name');_0x2fd78a['query']=_[_0xfeed('0x39')](_0x3e97b3['query']);_0x2fd78a[_0xfeed('0x3a')]=_[_0xfeed('0x3b')](_0x2fd78a['model'],_0x2fd78a[_0xfeed('0x3c')]);_0x17c92e[_0xfeed('0x3d')]=_['intersection'](_0x2fd78a[_0xfeed('0x38')],qs[_0xfeed('0x3e')](_0x3e97b3[_0xfeed('0x3c')][_0xfeed('0x3e')]));_0x17c92e['attributes']=_0x17c92e[_0xfeed('0x3d')][_0xfeed('0x3f')]?_0x17c92e['attributes']:_0x2fd78a[_0xfeed('0x38')];if(!_0x3e97b3[_0xfeed('0x3c')][_0xfeed('0x40')](_0xfeed('0x41'))){_0x17c92e[_0xfeed('0x25')]=qs[_0xfeed('0x25')](_0x3e97b3[_0xfeed('0x3c')][_0xfeed('0x25')]);_0x17c92e['offset']=qs[_0xfeed('0x23')](_0x3e97b3[_0xfeed('0x3c')][_0xfeed('0x23')]);}_0x17c92e[_0xfeed('0x42')]=qs[_0xfeed('0x43')](_0x3e97b3[_0xfeed('0x3c')]['sort']);_0x17c92e['where']=qs[_0xfeed('0x3a')](_[_0xfeed('0x44')](_0x3e97b3[_0xfeed('0x3c')],_0x2fd78a[_0xfeed('0x3a')]),_0x2ece70);if(_0x3e97b3[_0xfeed('0x3c')][_0xfeed('0x45')]){_0x17c92e['where']=_[_0xfeed('0x46')](_0x17c92e[_0xfeed('0x47')],{'$or':_[_0xfeed('0x34')](_0x2ece70,function(_0x5d5791){if(_0x5d5791[_0xfeed('0x48')]!==_0xfeed('0x49')){var _0x286e4a={};_0x286e4a[_0x5d5791[_0xfeed('0x32')]]={'$like':'%'+_0x3e97b3[_0xfeed('0x3c')][_0xfeed('0x45')]+'%'};return _0x286e4a;}})});}_0x17c92e=_[_0xfeed('0x46')]({},_0x17c92e,_0x3e97b3[_0xfeed('0x4a')]);var _0x8c10bf={'where':_0x17c92e['where']};return db[_0xfeed('0x35')][_0xfeed('0x26')](_0x8c10bf)[_0xfeed('0x2b')](function(_0x20d90f){_0x804539['count']=_0x20d90f;if(_0x3e97b3[_0xfeed('0x3c')][_0xfeed('0x4b')]){_0x17c92e[_0xfeed('0x4c')]=[{'all':!![]}];}return db[_0xfeed('0x35')][_0xfeed('0x4d')](_0x17c92e);})[_0xfeed('0x2b')](function(_0xe03314){_0x804539['rows']=_0xe03314;return _0x804539;})[_0xfeed('0x2b')](respondWithFilteredResult(_0x3586cf,_0x17c92e))[_0xfeed('0x4e')](handleError(_0x3586cf,null));};exports[_0xfeed('0x4f')]=function(_0x585387,_0x636080){var _0xd7346a={'raw':![],'where':{'id':_0x585387[_0xfeed('0x50')]['id']}},_0x15be55={};_0x15be55['model']=_[_0xfeed('0x39')](db['CmList'][_0xfeed('0x51')]);_0x15be55[_0xfeed('0x3c')]=_['keys'](_0x585387['query']);_0x15be55['filters']=_['intersection'](_0x15be55[_0xfeed('0x38')],_0x15be55['query']);_0xd7346a[_0xfeed('0x3d')]=_[_0xfeed('0x3b')](_0x15be55['model'],qs[_0xfeed('0x3e')](_0x585387['query']['fields']));_0xd7346a[_0xfeed('0x3d')]=_0xd7346a[_0xfeed('0x3d')][_0xfeed('0x3f')]?_0xd7346a[_0xfeed('0x3d')]:_0x15be55[_0xfeed('0x38')];if(_0x585387[_0xfeed('0x3c')][_0xfeed('0x4b')]){_0xd7346a[_0xfeed('0x4c')]=[{'all':!![]}];}_0xd7346a=_[_0xfeed('0x46')]({},_0xd7346a,_0x585387[_0xfeed('0x4a')]);return db['CmList'][_0xfeed('0x52')](_0xd7346a)['then'](handleEntityNotFound(_0x636080,null))[_0xfeed('0x2b')](respondWithResult(_0x636080,null))['catch'](handleError(_0x636080,null));};exports[_0xfeed('0x53')]=function(_0x4be236,_0x50e6d4){return db[_0xfeed('0x35')][_0xfeed('0x53')](_0x4be236[_0xfeed('0x54')],{})['then'](function(_0x416595){var _0x2a1610=_0x4be236[_0xfeed('0x55')]['get']({'plain':!![]});if(!_0x2a1610)throw new Error(_0xfeed('0x56'));if(_0x2a1610[_0xfeed('0x57')]==='user'){var _0x3746f8=_0x416595[_0xfeed('0x2d')]({'plain':!![]});var _0x9b5e5='Lists';return db[_0xfeed('0x58')][_0xfeed('0x52')]({'where':{'name':_0x9b5e5,'userProfileId':_0x2a1610['userProfileId']},'raw':!![]})[_0xfeed('0x2b')](function(_0x589f94){if(_0x589f94&&_0x589f94['autoAssociation']===0x0){return db[_0xfeed('0x2f')][_0xfeed('0x53')]({'name':_0x3746f8['name'],'resourceId':_0x3746f8['id'],'type':_0x589f94[_0xfeed('0x32')],'sectionId':_0x589f94['id']},{})[_0xfeed('0x2b')](function(){return _0x416595;});}else{return _0x416595;}})[_0xfeed('0x4e')](function(_0x193cd3){logger[_0xfeed('0x30')](_0xfeed('0x59'),_0x193cd3);throw _0x193cd3;});}return _0x416595;})[_0xfeed('0x2b')](respondWithResult(_0x50e6d4,0xc9))[_0xfeed('0x4e')](handleError(_0x50e6d4,null));};exports['update']=function(_0x46c286,_0x5d08b5){if(_0x46c286[_0xfeed('0x54')]['id']){delete _0x46c286[_0xfeed('0x54')]['id'];}return db[_0xfeed('0x35')][_0xfeed('0x52')]({'where':{'id':_0x46c286[_0xfeed('0x50')]['id']}})['then'](handleEntityNotFound(_0x5d08b5,null))['then'](saveUpdates(_0x46c286[_0xfeed('0x54')],null))['then'](respondWithResult(_0x5d08b5,null))[_0xfeed('0x4e')](handleError(_0x5d08b5,null));};exports[_0xfeed('0x2c')]=function(_0x56d0e7,_0x4e6c93){return db[_0xfeed('0x35')][_0xfeed('0x52')]({'where':{'id':_0x56d0e7[_0xfeed('0x50')]['id']}})[_0xfeed('0x2b')](handleEntityNotFound(_0x4e6c93,null))[_0xfeed('0x2b')](removeEntity(_0x4e6c93,null))['catch'](handleError(_0x4e6c93,null));};exports['describe']=function(_0x50ea86,_0x47b650){return db[_0xfeed('0x35')]['describe']()[_0xfeed('0x2b')](respondWithResult(_0x47b650,null))[_0xfeed('0x4e')](handleError(_0x47b650,null));};exports[_0xfeed('0x5a')]=function(_0x3888aa,_0x5efc75,_0x4aa78d){if(_0x3888aa[_0xfeed('0x54')]['id']){delete _0x3888aa[_0xfeed('0x54')]['id'];}return db[_0xfeed('0x35')][_0xfeed('0x52')]({'where':{'id':_0x3888aa['params']['id']}})[_0xfeed('0x2b')](handleEntityNotFound(_0x5efc75,null))[_0xfeed('0x2b')](function(_0x5dc1e5){if(_0x5dc1e5){_0x3888aa[_0xfeed('0x54')][_0xfeed('0x5b')]=_0x5dc1e5['id'];return db['Disposition'][_0xfeed('0x53')](_0x3888aa[_0xfeed('0x54')]);}})['then'](respondWithResult(_0x5efc75,null))[_0xfeed('0x4e')](handleError(_0x5efc75,null));};exports[_0xfeed('0x5c')]=function(_0x486290,_0x4f6fb8,_0x52b5f1){var _0x58fdb8={'raw':![],'where':{}};var _0x6a63d2={};var _0x2abdc8={'count':0x0,'rows':[]};return db[_0xfeed('0x35')][_0xfeed('0x5d')]({'where':{'id':_0x486290[_0xfeed('0x50')]['id']}})['then'](handleEntityNotFound(_0x4f6fb8,null))['then'](function(_0x190636){if(_0x190636){_0x6a63d2[_0xfeed('0x38')]=_[_0xfeed('0x39')](db[_0xfeed('0x5e')]['rawAttributes']);_0x6a63d2[_0xfeed('0x3c')]=_[_0xfeed('0x39')](_0x486290[_0xfeed('0x3c')]);_0x6a63d2[_0xfeed('0x3a')]=_[_0xfeed('0x3b')](_0x6a63d2[_0xfeed('0x38')],_0x6a63d2[_0xfeed('0x3c')]);_0x58fdb8[_0xfeed('0x3d')]=_[_0xfeed('0x3b')](_0x6a63d2['model'],qs['fields'](_0x486290['query']['fields']));_0x58fdb8['attributes']=_0x58fdb8[_0xfeed('0x3d')][_0xfeed('0x3f')]?_0x58fdb8[_0xfeed('0x3d')]:_0x6a63d2[_0xfeed('0x38')];if(!_0x486290[_0xfeed('0x3c')][_0xfeed('0x40')]('nolimit')){_0x58fdb8[_0xfeed('0x25')]=qs['limit'](_0x486290['query'][_0xfeed('0x25')]);_0x58fdb8[_0xfeed('0x23')]=qs[_0xfeed('0x23')](_0x486290[_0xfeed('0x3c')][_0xfeed('0x23')]);}_0x58fdb8[_0xfeed('0x42')]=qs[_0xfeed('0x43')](_0x486290[_0xfeed('0x3c')][_0xfeed('0x43')]);_0x58fdb8[_0xfeed('0x47')]=qs[_0xfeed('0x3a')](_[_0xfeed('0x44')](_0x486290[_0xfeed('0x3c')],_0x6a63d2['filters']));_0x58fdb8[_0xfeed('0x47')][_0xfeed('0x5b')]=_0x190636['id'];if(_0x486290['query']['filter']){_0x58fdb8['where']=_['merge'](_0x58fdb8[_0xfeed('0x47')],{'$or':_[_0xfeed('0x34')](_0x58fdb8[_0xfeed('0x3d')],function(_0x1668a0){var _0xece637={};_0xece637[_0x1668a0]={'$like':'%'+_0x486290[_0xfeed('0x3c')][_0xfeed('0x45')]+'%'};return _0xece637;})});}_0x58fdb8=_[_0xfeed('0x46')]({},_0x58fdb8,_0x486290[_0xfeed('0x4a')]);return db[_0xfeed('0x5e')]['count']({'where':_0x58fdb8[_0xfeed('0x47')]})[_0xfeed('0x2b')](function(_0x19efe4){_0x2abdc8['count']=_0x19efe4;if(_0x486290[_0xfeed('0x3c')]['includeAll']){_0x58fdb8[_0xfeed('0x4c')]=[{'all':!![]}];}return db[_0xfeed('0x5e')]['findAll'](_0x58fdb8);})['then'](function(_0x25b0a8){_0x2abdc8['rows']=_0x25b0a8;return _0x2abdc8;});}})[_0xfeed('0x2b')](respondWithFilteredResult(_0x4f6fb8,_0x58fdb8))[_0xfeed('0x4e')](handleError(_0x4f6fb8,null));};exports['removeDispositions']=function(_0x463cd6,_0x5afa2c,_0x5ae7a3){return db[_0xfeed('0x35')]['find']({'where':{'id':_0x463cd6['params']['id']}})[_0xfeed('0x2b')](handleEntityNotFound(_0x5afa2c,null))[_0xfeed('0x2b')](function(_0x3a5329){if(_0x3a5329){return _0x3a5329[_0xfeed('0x5f')](_0x463cd6[_0xfeed('0x3c')][_0xfeed('0x60')]);}})[_0xfeed('0x2b')](respondWithStatusCode(_0x5afa2c,null))[_0xfeed('0x4e')](handleError(_0x5afa2c,null));};exports[_0xfeed('0x61')]=function(_0x43ecac,_0x58ef0c,_0x2f0ca0){return db[_0xfeed('0x35')][_0xfeed('0x52')]({'where':{'id':_0x43ecac[_0xfeed('0x50')]['id']}})[_0xfeed('0x2b')](handleEntityNotFound(_0x58ef0c,null))[_0xfeed('0x2b')](function(_0x59d639){if(_0x59d639){var _0x3be51f=[];var _0x42bfe0={'success':[],'errors':[]};return db[_0xfeed('0x62')][_0xfeed('0x63')]()['then'](function(_0x1507c9){if(_0x43ecac[_0xfeed('0x54')][_0xfeed('0x64')]&&_[_0xfeed('0x65')](_0x43ecac['body'][_0xfeed('0x64')])){if(_0x43ecac[_0xfeed('0x54')][_0xfeed('0x64')]['length']){_0x43ecac['body'][_0xfeed('0x64')]=_0x43ecac['body'][_0xfeed('0x64')][_0xfeed('0x66')](';')+';';}else{_0x43ecac['body'][_0xfeed('0x64')]=null;}}else{_0x43ecac[_0xfeed('0x54')][_0xfeed('0x64')]=null;}if(_0x43ecac['body']&&_[_0xfeed('0x65')](_0x43ecac[_0xfeed('0x54')])){for(var _0x360024=0x0;_0x360024<_0x43ecac[_0xfeed('0x54')][_0xfeed('0x3f')];_0x360024+=0x1){_0x43ecac[_0xfeed('0x54')][_0x360024][_0xfeed('0x5b')]=_0x43ecac['params']['id'];_0x3be51f[_0xfeed('0x67')](_0x43ecac[_0xfeed('0x54')][_0x360024]);}return BPromise['each'](_0x3be51f,function(_0x14cca4){return db[_0xfeed('0x62')][_0xfeed('0x53')](_[_0xfeed('0x68')](_0x14cca4,['ids','id'])||{},{'fields':_[_0xfeed('0x39')](_0x1507c9),'raw':!![]})[_0xfeed('0x2b')](function(_0x40071f){_0x42bfe0[_0xfeed('0x69')]['push'](_0x40071f[_0xfeed('0x6a')]);})[_0xfeed('0x4e')](function(_0x35f3d4){_0x42bfe0[_0xfeed('0x6b')]['push']({'data':_0x14cca4,'error':_0x35f3d4['message']});});})[_0xfeed('0x2b')](function(_0xe43bbd){return _0x42bfe0;})[_0xfeed('0x4e')](function(_0xec7aee){return _0xec7aee;});}else{_0x58ef0c[_0xfeed('0x20')](0x190)[_0xfeed('0x22')]({'message':_0xfeed('0x6c')});}});}})[_0xfeed('0x2b')](respondWithResult(_0x58ef0c,null))[_0xfeed('0x4e')](handleError(_0x58ef0c,null));};exports['getContacts']=function(_0x4f8349,_0x12ecfe,_0x53219e){var _0x17976e;return db[_0xfeed('0x35')][_0xfeed('0x52')]({'where':{'id':_0x4f8349[_0xfeed('0x50')]['id']},'include':[{'model':db[_0xfeed('0x6d')],'as':'CustomFields'}]})[_0xfeed('0x2b')](handleEntityNotFound(_0x12ecfe,null))[_0xfeed('0x2b')](function(_0x49d0d6){if(_0x49d0d6){_0x17976e=_0x49d0d6;return db[_0xfeed('0x62')][_0xfeed('0x51')];}})[_0xfeed('0x2b')](function(_0x585f8a){if(_0x585f8a){var _0x58200d={};var _0x3b1e7b={};_0x3b1e7b[_0xfeed('0x38')]=_[_0xfeed('0x6e')](_[_0xfeed('0x39')](_0x585f8a),_[_0xfeed('0x34')](_0x17976e[_0xfeed('0x6f')],function(_0x3ec333){return util['format'](_0xfeed('0x70'),_0x3ec333['id']);}));_0x3b1e7b[_0xfeed('0x3c')]=_[_0xfeed('0x39')](_0x4f8349['query']);_0x3b1e7b[_0xfeed('0x3a')]=_[_0xfeed('0x3b')](_0x3b1e7b[_0xfeed('0x38')],_0x3b1e7b[_0xfeed('0x3c')]);_0x58200d[_0xfeed('0x3d')]=_['intersection'](_0x3b1e7b[_0xfeed('0x38')],qs['fields'](_0x4f8349['query'][_0xfeed('0x3e')]));_0x58200d[_0xfeed('0x3d')]=_0x58200d[_0xfeed('0x3d')][_0xfeed('0x3f')]?_0x58200d[_0xfeed('0x3d')]:_0x3b1e7b['model'];if(!_0x4f8349[_0xfeed('0x3c')][_0xfeed('0x40')]('nolimit')){_0x58200d[_0xfeed('0x25')]=qs[_0xfeed('0x25')](_0x4f8349[_0xfeed('0x3c')]['limit']);_0x58200d[_0xfeed('0x23')]=qs[_0xfeed('0x23')](_0x4f8349[_0xfeed('0x3c')][_0xfeed('0x23')]);}_0x58200d[_0xfeed('0x42')]=qs[_0xfeed('0x43')](_0x4f8349['query']['sort']);_0x58200d['where']=qs[_0xfeed('0x3a')](_[_0xfeed('0x44')](_0x4f8349[_0xfeed('0x3c')],_0x3b1e7b['filters']));_0x58200d[_0xfeed('0x71')]=!![];if(_0x4f8349['query'][_0xfeed('0x45')]){_0x58200d['where']=_[_0xfeed('0x46')](_0x58200d[_0xfeed('0x47')],{'$or':_[_0xfeed('0x34')](_0x58200d[_0xfeed('0x3d')],function(_0x170d95){var _0x308621={};_0x308621[_0x170d95]={'$like':'%'+_0x4f8349[_0xfeed('0x3c')]['filter']+'%'};return _0x308621;})});}_0x58200d=_[_0xfeed('0x46')]({},_0x58200d,_0x4f8349['options']);return _0x17976e[_0xfeed('0x72')](_0x58200d);}})[_0xfeed('0x2b')](respondWithResult(_0x12ecfe,null))[_0xfeed('0x4e')](handleError(_0x12ecfe,null));};exports['getContactsCsv']=function(_0x53b2f2,_0x55271f,_0x404be4){var _0x22c3ca;return db[_0xfeed('0x35')]['find']({'where':{'id':_0x53b2f2[_0xfeed('0x50')]['id']},'include':[{'model':db['CmCustomField'],'as':_0xfeed('0x6f')}]})[_0xfeed('0x2b')](handleEntityNotFound(_0x55271f,null))[_0xfeed('0x2b')](function(_0x3d53eb){if(_0x3d53eb){_0x22c3ca=_0x3d53eb;return db[_0xfeed('0x62')][_0xfeed('0x51')];}})[_0xfeed('0x2b')](function(_0x5d50fe){if(_0x5d50fe){var _0x3faf6c={};var _0x23af64={};_0x23af64[_0xfeed('0x38')]=_['concat'](_[_0xfeed('0x39')](_0x5d50fe),_[_0xfeed('0x34')](_0x22c3ca['CustomFields'],function(_0x2f35ef){return util['format'](_0xfeed('0x70'),_0x2f35ef['id']);}));_0x23af64[_0xfeed('0x3c')]=_[_0xfeed('0x39')](_0x53b2f2['query']);_0x23af64[_0xfeed('0x3a')]=_['intersection'](_0x23af64[_0xfeed('0x38')],_0x23af64[_0xfeed('0x3c')]);_0x3faf6c[_0xfeed('0x3d')]=_[_0xfeed('0x3b')](_0x23af64[_0xfeed('0x38')],qs[_0xfeed('0x3e')](_0x53b2f2[_0xfeed('0x3c')]['fields']));_0x3faf6c['attributes']=_0x3faf6c[_0xfeed('0x3d')]['length']?_0x3faf6c[_0xfeed('0x3d')]:_0x23af64[_0xfeed('0x38')];if(!_0x53b2f2[_0xfeed('0x3c')]['hasOwnProperty'](_0xfeed('0x41'))){_0x3faf6c[_0xfeed('0x25')]=qs[_0xfeed('0x25')](_0x53b2f2['query'][_0xfeed('0x25')]);_0x3faf6c[_0xfeed('0x23')]=qs[_0xfeed('0x23')](_0x53b2f2[_0xfeed('0x3c')][_0xfeed('0x23')]);}_0x3faf6c[_0xfeed('0x42')]=qs[_0xfeed('0x43')](_0x53b2f2[_0xfeed('0x3c')]['sort']);_0x3faf6c[_0xfeed('0x47')]=qs[_0xfeed('0x3a')](_['pick'](_0x53b2f2[_0xfeed('0x3c')],_0x23af64['filters']));_0x3faf6c[_0xfeed('0x71')]=!![];if(_0x53b2f2[_0xfeed('0x3c')][_0xfeed('0x45')]){_0x3faf6c['where']=_[_0xfeed('0x46')](_0x3faf6c['where'],{'$or':_[_0xfeed('0x34')](_0x3faf6c[_0xfeed('0x3d')],function(_0x584f2a){var _0x5c82d7={};_0x5c82d7[_0x584f2a]={'$like':'%'+_0x53b2f2[_0xfeed('0x3c')]['filter']+'%'};return _0x5c82d7;})});}_0x3faf6c=_[_0xfeed('0x46')]({},_0x3faf6c,_0x53b2f2[_0xfeed('0x4a')]);return _0x22c3ca[_0xfeed('0x72')](_0x3faf6c);}})[_0xfeed('0x2b')](function(_0x9bbd2e){if(!_[_0xfeed('0x73')](_0x9bbd2e)){var _0x1c8048=toCsv(_0x9bbd2e);var _0x11e821=Date['now']();fs[_0xfeed('0x74')](util[_0xfeed('0x75')](_0xfeed('0x76'),_0x22c3ca['id'],_0x11e821),_0x1c8048);_0x55271f[_0xfeed('0x77')](_0xfeed('0x78'),'attachment;\x20filename='+util[_0xfeed('0x75')](_0xfeed('0x79'),_0x22c3ca['id'],_0x11e821));_0x55271f[_0xfeed('0x77')]('Content-type',_0xfeed('0x7a'));return _0x55271f['download'](util[_0xfeed('0x75')](_0xfeed('0x76'),_0x22c3ca['id'],_0x11e821));}else{return _0x55271f['sendStatus'](0xcc);}})[_0xfeed('0x4e')](handleError(_0x55271f,null));};exports['addCustomField']=function(_0x390576,_0x324dbf,_0x30e33f){var _0x151923;delete _0x390576[_0xfeed('0x54')]['id'];return db[_0xfeed('0x35')]['findOne']({'where':{'id':_0x390576[_0xfeed('0x50')]['id']}})[_0xfeed('0x2b')](handleEntityNotFound(_0x324dbf,null))['then'](function(_0x2d47eb){if(_0x2d47eb){return db[_0xfeed('0x7b')]['transaction'](function(_0x3b01ba){return db[_0xfeed('0x6d')][_0xfeed('0x53')](_0x390576[_0xfeed('0x54')],{'transaction':_0x3b01ba})[_0xfeed('0x2b')](function(_0x44c1e2){_0x151923=_0x44c1e2;return _0x2d47eb[_0xfeed('0x7c')](_0x44c1e2,{'transaction':_0x3b01ba});})[_0xfeed('0x2b')](function(){var _0x23fb83={'type':db[_0xfeed('0x7d')]['TEXT'],'transaction':_0x3b01ba};switch(_0x390576['body']['type']){case'text':_0x23fb83[_0xfeed('0x48')]=db['Sequelize']['TEXT'];break;case'number':_0x23fb83[_0xfeed('0x48')]=db[_0xfeed('0x7d')][_0xfeed('0x7e')];break;case _0xfeed('0x7f'):_0x23fb83['type']=db['Sequelize'][_0xfeed('0x80')];_0x23fb83[_0xfeed('0x81')]=![];break;default:}return db[_0xfeed('0x7b')][_0xfeed('0x82')][_0xfeed('0x83')](_0xfeed('0x84'),util['format']('cf_%s',_0x151923['id']),_0x23fb83);})[_0xfeed('0x2b')](function(){return _0x151923;});});}})[_0xfeed('0x2b')](respondWithResult(_0x324dbf,null))[_0xfeed('0x4e')](handleError(_0x324dbf,null));};exports[_0xfeed('0x85')]=function(_0x2c1b22,_0x82c93a,_0x13a5db){var _0x33cab1={};var _0x375a3f={};var _0x254d7e;var _0x409e6f;return db[_0xfeed('0x35')]['findOne']({'where':{'id':_0x2c1b22['params']['id']}})[_0xfeed('0x2b')](handleEntityNotFound(_0x82c93a,null))[_0xfeed('0x2b')](function(_0x359536){if(_0x359536){_0x254d7e=_0x359536;_0x375a3f[_0xfeed('0x38')]=_[_0xfeed('0x39')](db['CmCustomField']['rawAttributes']);_0x375a3f['query']=_['keys'](_0x2c1b22[_0xfeed('0x3c')]);_0x375a3f['filters']=_[_0xfeed('0x3b')](_0x375a3f['model'],_0x375a3f[_0xfeed('0x3c')]);_0x33cab1[_0xfeed('0x3d')]=_[_0xfeed('0x3b')](_0x375a3f['model'],qs[_0xfeed('0x3e')](_0x2c1b22['query'][_0xfeed('0x3e')]));_0x33cab1[_0xfeed('0x3d')]=_0x33cab1['attributes']['length']?_0x33cab1[_0xfeed('0x3d')]:_0x375a3f[_0xfeed('0x38')];_0x33cab1[_0xfeed('0x42')]=qs[_0xfeed('0x43')](_0x2c1b22[_0xfeed('0x3c')][_0xfeed('0x43')]);_0x33cab1['where']=qs[_0xfeed('0x3a')](_[_0xfeed('0x44')](_0x2c1b22[_0xfeed('0x3c')],_0x375a3f['filters']));_0x33cab1[_0xfeed('0x47')]=_[_0xfeed('0x46')](_0x33cab1[_0xfeed('0x47')],{'$or':[{'ListId':_0x359536['id']},{'ListId':null}]});if(_0x2c1b22[_0xfeed('0x3c')][_0xfeed('0x45')]){_0x33cab1[_0xfeed('0x47')]=_['merge'](_0x33cab1[_0xfeed('0x47')],{'$or':_[_0xfeed('0x34')](_0x33cab1[_0xfeed('0x3d')],function(_0xa7ccc3){var _0x8d811f={};_0x8d811f[_0xa7ccc3]={'$like':'%'+_0x2c1b22['query'][_0xfeed('0x45')]+'%'};return _0x8d811f;})});}_0x33cab1=_[_0xfeed('0x46')]({},_0x33cab1,_0x2c1b22[_0xfeed('0x4a')]);return db[_0xfeed('0x6d')][_0xfeed('0x86')](_0x33cab1);}})[_0xfeed('0x2b')](respondWithResult(_0x82c93a,null))[_0xfeed('0x4e')](handleError(_0x82c93a,null));};exports[_0xfeed('0x87')]=function(_0x4a0e71,_0x52fa36,_0x53dc20){return db[_0xfeed('0x35')][_0xfeed('0x52')]({'where':{'id':_0x4a0e71[_0xfeed('0x50')]['id']}})[_0xfeed('0x2b')](handleEntityNotFound(_0x52fa36,null))['then'](function(_0x34e9c9){if(_0x34e9c9){return _0x34e9c9[_0xfeed('0x87')](_0x4a0e71[_0xfeed('0x54')]['ids'],_[_0xfeed('0x68')](_0x4a0e71['body'],[_0xfeed('0x60'),'id'])||{})[_0xfeed('0x88')](function(_0x389cde){for(var _0x485046=0x0;_0x485046<_0x4a0e71[_0xfeed('0x54')][_0xfeed('0x60')][_0xfeed('0x3f')];_0x485046+=0x1){socket[_0xfeed('0x89')](_0xfeed('0x8a'),{'UserId':Number(_0x4a0e71['body']['ids'][_0x485046]),'CmListId':Number(_0x4a0e71[_0xfeed('0x50')]['id'])});}return _0x389cde;});}})[_0xfeed('0x2b')](respondWithResult(_0x52fa36,null))[_0xfeed('0x4e')](handleError(_0x52fa36,null));};exports['removeAgents']=function(_0x738103,_0x3f1487,_0x29ae85){return db[_0xfeed('0x35')][_0xfeed('0x52')]({'where':{'id':_0x738103[_0xfeed('0x50')]['id']}})[_0xfeed('0x2b')](handleEntityNotFound(_0x3f1487,null))[_0xfeed('0x2b')](function(_0x4ce4d3){if(_0x4ce4d3){return _0x4ce4d3[_0xfeed('0x8b')](_0x738103['query'][_0xfeed('0x60')])[_0xfeed('0x2b')](function(){if(_['isArray'](_0x738103[_0xfeed('0x3c')][_0xfeed('0x60')])){for(var _0x4f637a=0x0;_0x4f637a<_0x738103[_0xfeed('0x3c')][_0xfeed('0x60')][_0xfeed('0x3f')];_0x4f637a+=0x1){socket[_0xfeed('0x89')](_0xfeed('0x8c'),{'UserId':Number(_0x738103['query']['ids'][_0x4f637a]),'CmListId':Number(_0x738103[_0xfeed('0x50')]['id'])});}}else{socket[_0xfeed('0x89')]('userCmList:remove',{'UserId':Number(_0x738103[_0xfeed('0x3c')][_0xfeed('0x60')]),'CmListId':Number(_0x738103['params']['id'])});}});}})[_0xfeed('0x2b')](respondWithStatusCode(_0x3f1487,null))[_0xfeed('0x4e')](handleError(_0x3f1487,null));};exports[_0xfeed('0x8d')]=function(_0xb368d6,_0x51dd64,_0x2f4116){var _0x2b009c={};var _0x2734f6={};var _0xa5249d;var _0x4d55b3;return db['CmList'][_0xfeed('0x5d')]({'where':{'id':_0xb368d6['params']['id']}})[_0xfeed('0x2b')](handleEntityNotFound(_0x51dd64,null))['then'](function(_0x5dab08){if(_0x5dab08){_0xa5249d=_0x5dab08;_0x2734f6['model']=_[_0xfeed('0x39')](db['User'][_0xfeed('0x51')]);_0x2734f6[_0xfeed('0x3c')]=_['keys'](_0xb368d6[_0xfeed('0x3c')]);_0x2734f6[_0xfeed('0x3a')]=_[_0xfeed('0x3b')](_0x2734f6[_0xfeed('0x38')],_0x2734f6[_0xfeed('0x3c')]);_0x2b009c[_0xfeed('0x3d')]=_[_0xfeed('0x3b')](_0x2734f6['model'],qs[_0xfeed('0x3e')](_0xb368d6[_0xfeed('0x3c')][_0xfeed('0x3e')]));_0x2b009c[_0xfeed('0x3d')]=_0x2b009c[_0xfeed('0x3d')][_0xfeed('0x3f')]?_0x2b009c[_0xfeed('0x3d')]:_0x2734f6[_0xfeed('0x38')];_0x2b009c[_0xfeed('0x42')]=qs[_0xfeed('0x43')](_0xb368d6[_0xfeed('0x3c')][_0xfeed('0x43')]);_0x2b009c[_0xfeed('0x47')]=qs[_0xfeed('0x3a')](_[_0xfeed('0x44')](_0xb368d6[_0xfeed('0x3c')],_0x2734f6[_0xfeed('0x3a')]));if(_0xb368d6[_0xfeed('0x3c')][_0xfeed('0x45')]){_0x2b009c[_0xfeed('0x47')]=_[_0xfeed('0x46')](_0x2b009c['where'],{'$or':_[_0xfeed('0x34')](_0x2b009c[_0xfeed('0x3d')],function(_0x2e57b3){var _0x53bf48={};_0x53bf48[_0x2e57b3]={'$like':'%'+_0xb368d6[_0xfeed('0x3c')][_0xfeed('0x45')]+'%'};return _0x53bf48;})});}_0x2b009c=_[_0xfeed('0x46')]({},_0x2b009c,_0xb368d6[_0xfeed('0x4a')]);return _0xa5249d[_0xfeed('0x8d')](_0x2b009c);}})[_0xfeed('0x2b')](function(_0x520f32){if(_0x520f32){_0x4d55b3=_0x520f32[_0xfeed('0x3f')];if(!_0xb368d6[_0xfeed('0x3c')][_0xfeed('0x40')](_0xfeed('0x41'))){_0x2b009c['limit']=qs[_0xfeed('0x25')](_0xb368d6[_0xfeed('0x3c')][_0xfeed('0x25')]);_0x2b009c[_0xfeed('0x23')]=qs[_0xfeed('0x23')](_0xb368d6[_0xfeed('0x3c')][_0xfeed('0x23')]);}return _0xa5249d[_0xfeed('0x8d')](_0x2b009c);}})[_0xfeed('0x2b')](function(_0x1f63bd){if(_0x1f63bd){return _0x1f63bd?{'count':_0x4d55b3,'rows':_0x1f63bd}:null;}})['then'](respondWithResult(_0x51dd64,null))[_0xfeed('0x4e')](handleError(_0x51dd64,null));}; \ No newline at end of file +var _0x9589=['update','destroy','then','Lists','UserProfileResource','end','sendStatus','error','stack','send','CmList','rawAttributes','type','key','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','filter','merge','VIRTUAL','options','include','findAll','catch','show','params','includeAll','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','ListId','Disposition','getDispositions','nolimit','pick','rows','removeDispositions','ids','addContacts','CmContact','tags','isArray','join','each','success','push','dataValues','errors','message','CmCustomField','concat','CustomFields','raw','getContacts','format','cf_%d','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','list_%d_%s.csv','Content-type','download','findOne','transaction','addCustomFields','TEXT','text','Sequelize','INTEGER','switch','BOOLEAN','sequelize','queryInterface','addColumn','cm_contacts','cf_%s','getCustomFields','findAndCountAll','omit','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','eml-format','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','./cmList.socket','status','offset','undefined','limit','count','Content-Range','json','apply','reject','save'];(function(_0x55b9fd,_0x387763){var _0x29da5e=function(_0x115009){while(--_0x115009){_0x55b9fd['push'](_0x55b9fd['shift']());}};_0x29da5e(++_0x387763);}(_0x9589,0x6a));var _0x9958=function(_0x45fc97,_0x336321){_0x45fc97=_0x45fc97-0x0;var _0xbe04a=_0x9589[_0x45fc97];return _0xbe04a;};'use strict';var emlformat=require(_0x9958('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9958('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9958('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x9958('0x3'));var util=require(_0x9958('0x4'));var path=require(_0x9958('0x5'));var sox=require(_0x9958('0x6'));var csv=require(_0x9958('0x7'));var ejs=require(_0x9958('0x8'));var fs=require('fs');var fs_extra=require(_0x9958('0x9'));var _=require('lodash');var squel=require(_0x9958('0xa'));var crypto=require(_0x9958('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x9958('0xc'));var toCsv=require('to-csv');var querystring=require(_0x9958('0xd'));var Papa=require(_0x9958('0xe'));var Redis=require(_0x9958('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9958('0x10'));var hardwareService=require(_0x9958('0x11'));var logger=require('../../config/logger')(_0x9958('0x12'));var utils=require(_0x9958('0x13'));var config=require(_0x9958('0x14'));var licenseUtil=require(_0x9958('0x15'));var db=require('../../mysqldb')['db'];config[_0x9958('0x16')]=_[_0x9958('0x17')](config[_0x9958('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0x9958('0x18'))(new Redis(config[_0x9958('0x16')]));require(_0x9958('0x19'))['register'](socket);function respondWithStatusCode(_0x28fe69,_0x4a9a6f){_0x4a9a6f=_0x4a9a6f||0xcc;return function(_0x56b81d){if(_0x56b81d){return _0x28fe69['sendStatus'](_0x4a9a6f);}return _0x28fe69[_0x9958('0x1a')](_0x4a9a6f)['end']();};}function respondWithResult(_0x5b36b8,_0x4f44cf){_0x4f44cf=_0x4f44cf||0xc8;return function(_0x102712){if(_0x102712){return _0x5b36b8[_0x9958('0x1a')](_0x4f44cf)['json'](_0x102712);}};}function respondWithFilteredResult(_0x5b6563,_0x3eb93d){return function(_0x48a625){if(_0x48a625){var _0x38e79e=typeof _0x3eb93d[_0x9958('0x1b')]===_0x9958('0x1c')&&typeof _0x3eb93d[_0x9958('0x1d')]===_0x9958('0x1c');var _0x337521=_0x48a625[_0x9958('0x1e')];var _0x580fb1=_0x38e79e?0x0:_0x3eb93d['offset'];var _0x1235a2=_0x38e79e?_0x48a625[_0x9958('0x1e')]:_0x3eb93d[_0x9958('0x1b')]+_0x3eb93d[_0x9958('0x1d')];var _0x915a67;if(_0x1235a2>=_0x337521){_0x1235a2=_0x337521;_0x915a67=0xc8;}else{_0x915a67=0xce;}_0x5b6563[_0x9958('0x1a')](_0x915a67);return _0x5b6563['set'](_0x9958('0x1f'),_0x580fb1+'-'+_0x1235a2+'/'+_0x337521)[_0x9958('0x20')](_0x48a625);}return null;};}function patchUpdates(_0x1d259e){return function(_0xacc00a){try{jsonpatch[_0x9958('0x21')](_0xacc00a,_0x1d259e,!![]);}catch(_0x2cee30){return BPromise[_0x9958('0x22')](_0x2cee30);}return _0xacc00a[_0x9958('0x23')]();};}function saveUpdates(_0xb5db71,_0x3e198e){return function(_0x38b76d){if(_0x38b76d){return _0x38b76d[_0x9958('0x24')](_0xb5db71)['then'](function(_0x886488){return _0x886488;});}return null;};}function removeEntity(_0x5cb8f3,_0x13be30){return function(_0x1f294b){if(_0x1f294b){return _0x1f294b[_0x9958('0x25')]()[_0x9958('0x26')](function(){var _0x4df63a=_0x1f294b['get']({'plain':!![]});var _0x2ab313=_0x9958('0x27');return db[_0x9958('0x28')][_0x9958('0x25')]({'where':{'type':_0x2ab313,'resourceId':_0x4df63a['id']}})[_0x9958('0x26')](function(){return _0x1f294b;});})['then'](function(){_0x5cb8f3[_0x9958('0x1a')](0xcc)[_0x9958('0x29')]();});}};}function handleEntityNotFound(_0x1c9eff,_0x249e00){return function(_0x42bec6){if(!_0x42bec6){_0x1c9eff[_0x9958('0x2a')](0x194);}return _0x42bec6;};}function handleError(_0x45596b,_0x1df28a){_0x1df28a=_0x1df28a||0x1f4;return function(_0x1cd0d3){logger[_0x9958('0x2b')](_0x1cd0d3[_0x9958('0x2c')]);if(_0x1cd0d3['name']){delete _0x1cd0d3['name'];}_0x45596b[_0x9958('0x1a')](_0x1df28a)[_0x9958('0x2d')](_0x1cd0d3);};}exports['index']=function(_0x33509f,_0x40875e){var _0x48f0cb={},_0x5f0023={},_0x5068f6={'count':0x0,'rows':[]};var _0x1a8dbe=_['map'](db[_0x9958('0x2e')][_0x9958('0x2f')],function(_0x34809a){return{'name':_0x34809a['fieldName'],'type':_0x34809a[_0x9958('0x30')][_0x9958('0x31')]};});_0x5f0023[_0x9958('0x32')]=_[_0x9958('0x33')](_0x1a8dbe,_0x9958('0x34'));_0x5f0023[_0x9958('0x35')]=_[_0x9958('0x36')](_0x33509f['query']);_0x5f0023['filters']=_[_0x9958('0x37')](_0x5f0023[_0x9958('0x32')],_0x5f0023[_0x9958('0x35')]);_0x48f0cb[_0x9958('0x38')]=_[_0x9958('0x37')](_0x5f0023['model'],qs[_0x9958('0x39')](_0x33509f[_0x9958('0x35')]['fields']));_0x48f0cb[_0x9958('0x38')]=_0x48f0cb[_0x9958('0x38')][_0x9958('0x3a')]?_0x48f0cb[_0x9958('0x38')]:_0x5f0023['model'];if(!_0x33509f[_0x9958('0x35')][_0x9958('0x3b')]('nolimit')){_0x48f0cb[_0x9958('0x1d')]=qs[_0x9958('0x1d')](_0x33509f[_0x9958('0x35')][_0x9958('0x1d')]);_0x48f0cb['offset']=qs[_0x9958('0x1b')](_0x33509f['query'][_0x9958('0x1b')]);}_0x48f0cb[_0x9958('0x3c')]=qs['sort'](_0x33509f[_0x9958('0x35')][_0x9958('0x3d')]);_0x48f0cb[_0x9958('0x3e')]=qs['filters'](_['pick'](_0x33509f[_0x9958('0x35')],_0x5f0023[_0x9958('0x3f')]),_0x1a8dbe);if(_0x33509f[_0x9958('0x35')][_0x9958('0x40')]){_0x48f0cb[_0x9958('0x3e')]=_[_0x9958('0x41')](_0x48f0cb['where'],{'$or':_[_0x9958('0x33')](_0x1a8dbe,function(_0x2a2831){if(_0x2a2831[_0x9958('0x30')]!==_0x9958('0x42')){var _0x51c10b={};_0x51c10b[_0x2a2831[_0x9958('0x34')]]={'$like':'%'+_0x33509f[_0x9958('0x35')]['filter']+'%'};return _0x51c10b;}})});}_0x48f0cb=_[_0x9958('0x41')]({},_0x48f0cb,_0x33509f[_0x9958('0x43')]);var _0x32bb76={'where':_0x48f0cb[_0x9958('0x3e')]};return db[_0x9958('0x2e')][_0x9958('0x1e')](_0x32bb76)[_0x9958('0x26')](function(_0x2622ad){_0x5068f6[_0x9958('0x1e')]=_0x2622ad;if(_0x33509f[_0x9958('0x35')]['includeAll']){_0x48f0cb[_0x9958('0x44')]=[{'all':!![]}];}return db[_0x9958('0x2e')][_0x9958('0x45')](_0x48f0cb);})[_0x9958('0x26')](function(_0x55a73f){_0x5068f6['rows']=_0x55a73f;return _0x5068f6;})['then'](respondWithFilteredResult(_0x40875e,_0x48f0cb))[_0x9958('0x46')](handleError(_0x40875e,null));};exports[_0x9958('0x47')]=function(_0xf47f24,_0x209012){var _0x5a9d8d={'raw':![],'where':{'id':_0xf47f24[_0x9958('0x48')]['id']}},_0x214f07={};_0x214f07[_0x9958('0x32')]=_[_0x9958('0x36')](db[_0x9958('0x2e')][_0x9958('0x2f')]);_0x214f07[_0x9958('0x35')]=_[_0x9958('0x36')](_0xf47f24[_0x9958('0x35')]);_0x214f07['filters']=_[_0x9958('0x37')](_0x214f07[_0x9958('0x32')],_0x214f07[_0x9958('0x35')]);_0x5a9d8d[_0x9958('0x38')]=_['intersection'](_0x214f07[_0x9958('0x32')],qs['fields'](_0xf47f24[_0x9958('0x35')][_0x9958('0x39')]));_0x5a9d8d[_0x9958('0x38')]=_0x5a9d8d[_0x9958('0x38')]['length']?_0x5a9d8d[_0x9958('0x38')]:_0x214f07[_0x9958('0x32')];if(_0xf47f24[_0x9958('0x35')][_0x9958('0x49')]){_0x5a9d8d[_0x9958('0x44')]=[{'all':!![]}];}_0x5a9d8d=_[_0x9958('0x41')]({},_0x5a9d8d,_0xf47f24[_0x9958('0x43')]);return db[_0x9958('0x2e')][_0x9958('0x4a')](_0x5a9d8d)['then'](handleEntityNotFound(_0x209012,null))[_0x9958('0x26')](respondWithResult(_0x209012,null))[_0x9958('0x46')](handleError(_0x209012,null));};exports[_0x9958('0x4b')]=function(_0x215cc6,_0xa8a9bc){return db[_0x9958('0x2e')][_0x9958('0x4b')](_0x215cc6[_0x9958('0x4c')],{})['then'](function(_0x2e4a04){var _0x3a04ab=_0x215cc6[_0x9958('0x4d')][_0x9958('0x4e')]({'plain':!![]});if(!_0x3a04ab)throw new Error(_0x9958('0x4f'));if(_0x3a04ab[_0x9958('0x50')]===_0x9958('0x4d')){var _0x35d063=_0x2e4a04[_0x9958('0x4e')]({'plain':!![]});var _0x5dc035=_0x9958('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x5dc035,'userProfileId':_0x3a04ab['userProfileId']},'raw':!![]})['then'](function(_0x384825){if(_0x384825&&_0x384825[_0x9958('0x51')]===0x0){return db[_0x9958('0x28')][_0x9958('0x4b')]({'name':_0x35d063[_0x9958('0x34')],'resourceId':_0x35d063['id'],'type':_0x384825[_0x9958('0x34')],'sectionId':_0x384825['id']},{})[_0x9958('0x26')](function(){return _0x2e4a04;});}else{return _0x2e4a04;}})[_0x9958('0x46')](function(_0x2eadbb){logger[_0x9958('0x2b')](_0x9958('0x52'),_0x2eadbb);throw _0x2eadbb;});}return _0x2e4a04;})[_0x9958('0x26')](respondWithResult(_0xa8a9bc,0xc9))[_0x9958('0x46')](handleError(_0xa8a9bc,null));};exports[_0x9958('0x24')]=function(_0x5484dc,_0x2184d0){if(_0x5484dc[_0x9958('0x4c')]['id']){delete _0x5484dc[_0x9958('0x4c')]['id'];}return db['CmList']['find']({'where':{'id':_0x5484dc['params']['id']}})['then'](handleEntityNotFound(_0x2184d0,null))['then'](saveUpdates(_0x5484dc['body'],null))[_0x9958('0x26')](respondWithResult(_0x2184d0,null))['catch'](handleError(_0x2184d0,null));};exports[_0x9958('0x25')]=function(_0x3ab0c8,_0x1368a3){return db[_0x9958('0x2e')]['find']({'where':{'id':_0x3ab0c8[_0x9958('0x48')]['id']}})[_0x9958('0x26')](handleEntityNotFound(_0x1368a3,null))[_0x9958('0x26')](removeEntity(_0x1368a3,null))[_0x9958('0x46')](handleError(_0x1368a3,null));};exports[_0x9958('0x53')]=function(_0x50db4e,_0x1778dd){return db[_0x9958('0x2e')]['describe']()[_0x9958('0x26')](respondWithResult(_0x1778dd,null))[_0x9958('0x46')](handleError(_0x1778dd,null));};exports[_0x9958('0x54')]=function(_0x3173ec,_0x46b2da,_0x3be0d5){if(_0x3173ec[_0x9958('0x4c')]['id']){delete _0x3173ec[_0x9958('0x4c')]['id'];}return db[_0x9958('0x2e')][_0x9958('0x4a')]({'where':{'id':_0x3173ec[_0x9958('0x48')]['id']}})[_0x9958('0x26')](handleEntityNotFound(_0x46b2da,null))[_0x9958('0x26')](function(_0x1c6790){if(_0x1c6790){_0x3173ec[_0x9958('0x4c')][_0x9958('0x55')]=_0x1c6790['id'];return db[_0x9958('0x56')][_0x9958('0x4b')](_0x3173ec['body']);}})['then'](respondWithResult(_0x46b2da,null))[_0x9958('0x46')](handleError(_0x46b2da,null));};exports[_0x9958('0x57')]=function(_0x1ad48c,_0x5dc9a,_0x427b2f){var _0x690111={'raw':![],'where':{}};var _0xa163e6={};var _0x49465b={'count':0x0,'rows':[]};return db[_0x9958('0x2e')]['findOne']({'where':{'id':_0x1ad48c[_0x9958('0x48')]['id']}})[_0x9958('0x26')](handleEntityNotFound(_0x5dc9a,null))[_0x9958('0x26')](function(_0x54b3f5){if(_0x54b3f5){_0xa163e6[_0x9958('0x32')]=_[_0x9958('0x36')](db[_0x9958('0x56')]['rawAttributes']);_0xa163e6['query']=_['keys'](_0x1ad48c[_0x9958('0x35')]);_0xa163e6[_0x9958('0x3f')]=_['intersection'](_0xa163e6['model'],_0xa163e6[_0x9958('0x35')]);_0x690111['attributes']=_[_0x9958('0x37')](_0xa163e6[_0x9958('0x32')],qs['fields'](_0x1ad48c[_0x9958('0x35')][_0x9958('0x39')]));_0x690111['attributes']=_0x690111['attributes'][_0x9958('0x3a')]?_0x690111[_0x9958('0x38')]:_0xa163e6[_0x9958('0x32')];if(!_0x1ad48c[_0x9958('0x35')][_0x9958('0x3b')](_0x9958('0x58'))){_0x690111[_0x9958('0x1d')]=qs[_0x9958('0x1d')](_0x1ad48c['query'][_0x9958('0x1d')]);_0x690111['offset']=qs['offset'](_0x1ad48c[_0x9958('0x35')][_0x9958('0x1b')]);}_0x690111[_0x9958('0x3c')]=qs['sort'](_0x1ad48c[_0x9958('0x35')][_0x9958('0x3d')]);_0x690111[_0x9958('0x3e')]=qs[_0x9958('0x3f')](_[_0x9958('0x59')](_0x1ad48c[_0x9958('0x35')],_0xa163e6[_0x9958('0x3f')]));_0x690111['where']['ListId']=_0x54b3f5['id'];if(_0x1ad48c[_0x9958('0x35')][_0x9958('0x40')]){_0x690111[_0x9958('0x3e')]=_['merge'](_0x690111['where'],{'$or':_[_0x9958('0x33')](_0x690111[_0x9958('0x38')],function(_0x1eaa88){var _0x45cf1b={};_0x45cf1b[_0x1eaa88]={'$like':'%'+_0x1ad48c['query'][_0x9958('0x40')]+'%'};return _0x45cf1b;})});}_0x690111=_['merge']({},_0x690111,_0x1ad48c['options']);return db[_0x9958('0x56')][_0x9958('0x1e')]({'where':_0x690111[_0x9958('0x3e')]})[_0x9958('0x26')](function(_0x62546b){_0x49465b[_0x9958('0x1e')]=_0x62546b;if(_0x1ad48c[_0x9958('0x35')][_0x9958('0x49')]){_0x690111['include']=[{'all':!![]}];}return db[_0x9958('0x56')][_0x9958('0x45')](_0x690111);})['then'](function(_0x53fd05){_0x49465b[_0x9958('0x5a')]=_0x53fd05;return _0x49465b;});}})['then'](respondWithFilteredResult(_0x5dc9a,_0x690111))[_0x9958('0x46')](handleError(_0x5dc9a,null));};exports['removeDispositions']=function(_0x327190,_0x3e150e,_0x2bfd84){return db['CmList'][_0x9958('0x4a')]({'where':{'id':_0x327190[_0x9958('0x48')]['id']}})[_0x9958('0x26')](handleEntityNotFound(_0x3e150e,null))['then'](function(_0x583378){if(_0x583378){return _0x583378[_0x9958('0x5b')](_0x327190[_0x9958('0x35')][_0x9958('0x5c')]);}})[_0x9958('0x26')](respondWithStatusCode(_0x3e150e,null))[_0x9958('0x46')](handleError(_0x3e150e,null));};exports[_0x9958('0x5d')]=function(_0x7076,_0x56c96d,_0x4fcc3f){return db[_0x9958('0x2e')]['find']({'where':{'id':_0x7076['params']['id']}})[_0x9958('0x26')](handleEntityNotFound(_0x56c96d,null))['then'](function(_0x2f8296){if(_0x2f8296){var _0xa19a4c=[];var _0x35fc93={'success':[],'errors':[]};return db[_0x9958('0x5e')]['describe']()[_0x9958('0x26')](function(_0x5c09ad){if(_0x7076[_0x9958('0x4c')][_0x9958('0x5f')]&&_[_0x9958('0x60')](_0x7076[_0x9958('0x4c')][_0x9958('0x5f')])){if(_0x7076['body'][_0x9958('0x5f')][_0x9958('0x3a')]){_0x7076[_0x9958('0x4c')][_0x9958('0x5f')]=_0x7076[_0x9958('0x4c')][_0x9958('0x5f')][_0x9958('0x61')](';')+';';}else{_0x7076[_0x9958('0x4c')][_0x9958('0x5f')]=null;}}else{_0x7076['body']['tags']=null;}if(_0x7076[_0x9958('0x4c')]&&_[_0x9958('0x60')](_0x7076[_0x9958('0x4c')])){for(var _0x23f262=0x0;_0x23f262<_0x7076[_0x9958('0x4c')][_0x9958('0x3a')];_0x23f262+=0x1){_0x7076[_0x9958('0x4c')][_0x23f262][_0x9958('0x55')]=_0x7076[_0x9958('0x48')]['id'];_0xa19a4c['push'](_0x7076[_0x9958('0x4c')][_0x23f262]);}return BPromise[_0x9958('0x62')](_0xa19a4c,function(_0x1d4354){return db[_0x9958('0x5e')][_0x9958('0x4b')](_['omit'](_0x1d4354,[_0x9958('0x5c'),'id'])||{},{'fields':_[_0x9958('0x36')](_0x5c09ad),'raw':!![]})[_0x9958('0x26')](function(_0x26e858){_0x35fc93[_0x9958('0x63')][_0x9958('0x64')](_0x26e858[_0x9958('0x65')]);})[_0x9958('0x46')](function(_0x47333b){_0x35fc93[_0x9958('0x66')]['push']({'data':_0x1d4354,'error':_0x47333b[_0x9958('0x67')]});});})['then'](function(_0x460671){return _0x35fc93;})[_0x9958('0x46')](function(_0x269814){return _0x269814;});}else{_0x56c96d[_0x9958('0x1a')](0x190)[_0x9958('0x20')]({'message':'Malformed\x20request\x20syntax'});}});}})[_0x9958('0x26')](respondWithResult(_0x56c96d,null))[_0x9958('0x46')](handleError(_0x56c96d,null));};exports['getContacts']=function(_0x102fca,_0x17e87f,_0x13e9a1){var _0x279ed9;return db['CmList'][_0x9958('0x4a')]({'where':{'id':_0x102fca[_0x9958('0x48')]['id']},'include':[{'model':db[_0x9958('0x68')],'as':'CustomFields'}]})[_0x9958('0x26')](handleEntityNotFound(_0x17e87f,null))[_0x9958('0x26')](function(_0x3b605c){if(_0x3b605c){_0x279ed9=_0x3b605c;return db['CmContact'][_0x9958('0x2f')];}})[_0x9958('0x26')](function(_0x2f00b8){if(_0x2f00b8){var _0x1f7a99={};var _0x448fbb={};_0x448fbb[_0x9958('0x32')]=_[_0x9958('0x69')](_[_0x9958('0x36')](_0x2f00b8),_['map'](_0x279ed9[_0x9958('0x6a')],function(_0x2cdfc0){return util['format']('cf_%d',_0x2cdfc0['id']);}));_0x448fbb['query']=_[_0x9958('0x36')](_0x102fca['query']);_0x448fbb['filters']=_[_0x9958('0x37')](_0x448fbb[_0x9958('0x32')],_0x448fbb[_0x9958('0x35')]);_0x1f7a99[_0x9958('0x38')]=_[_0x9958('0x37')](_0x448fbb['model'],qs[_0x9958('0x39')](_0x102fca['query']['fields']));_0x1f7a99['attributes']=_0x1f7a99[_0x9958('0x38')][_0x9958('0x3a')]?_0x1f7a99[_0x9958('0x38')]:_0x448fbb['model'];if(!_0x102fca[_0x9958('0x35')]['hasOwnProperty']('nolimit')){_0x1f7a99[_0x9958('0x1d')]=qs[_0x9958('0x1d')](_0x102fca[_0x9958('0x35')][_0x9958('0x1d')]);_0x1f7a99[_0x9958('0x1b')]=qs[_0x9958('0x1b')](_0x102fca['query'][_0x9958('0x1b')]);}_0x1f7a99[_0x9958('0x3c')]=qs[_0x9958('0x3d')](_0x102fca['query']['sort']);_0x1f7a99[_0x9958('0x3e')]=qs[_0x9958('0x3f')](_['pick'](_0x102fca[_0x9958('0x35')],_0x448fbb[_0x9958('0x3f')]));_0x1f7a99[_0x9958('0x6b')]=!![];if(_0x102fca[_0x9958('0x35')][_0x9958('0x40')]){_0x1f7a99[_0x9958('0x3e')]=_[_0x9958('0x41')](_0x1f7a99[_0x9958('0x3e')],{'$or':_[_0x9958('0x33')](_0x1f7a99['attributes'],function(_0x240b44){var _0x17a072={};_0x17a072[_0x240b44]={'$like':'%'+_0x102fca[_0x9958('0x35')][_0x9958('0x40')]+'%'};return _0x17a072;})});}_0x1f7a99=_[_0x9958('0x41')]({},_0x1f7a99,_0x102fca[_0x9958('0x43')]);return _0x279ed9[_0x9958('0x6c')](_0x1f7a99);}})[_0x9958('0x26')](respondWithResult(_0x17e87f,null))[_0x9958('0x46')](handleError(_0x17e87f,null));};exports['getContactsCsv']=function(_0x3b298d,_0x5767e4,_0x204ba2){var _0x4b0954;return db['CmList'][_0x9958('0x4a')]({'where':{'id':_0x3b298d[_0x9958('0x48')]['id']},'include':[{'model':db[_0x9958('0x68')],'as':_0x9958('0x6a')}]})[_0x9958('0x26')](handleEntityNotFound(_0x5767e4,null))['then'](function(_0x53c56c){if(_0x53c56c){_0x4b0954=_0x53c56c;return db['CmContact'][_0x9958('0x2f')];}})[_0x9958('0x26')](function(_0x4babc2){if(_0x4babc2){var _0x2147d6={};var _0x137b8a={};_0x137b8a[_0x9958('0x32')]=_[_0x9958('0x69')](_[_0x9958('0x36')](_0x4babc2),_[_0x9958('0x33')](_0x4b0954[_0x9958('0x6a')],function(_0x1d55bc){return util[_0x9958('0x6d')](_0x9958('0x6e'),_0x1d55bc['id']);}));_0x137b8a['query']=_[_0x9958('0x36')](_0x3b298d['query']);_0x137b8a[_0x9958('0x3f')]=_[_0x9958('0x37')](_0x137b8a['model'],_0x137b8a[_0x9958('0x35')]);_0x2147d6[_0x9958('0x38')]=_[_0x9958('0x37')](_0x137b8a[_0x9958('0x32')],qs[_0x9958('0x39')](_0x3b298d[_0x9958('0x35')]['fields']));_0x2147d6[_0x9958('0x38')]=_0x2147d6[_0x9958('0x38')]['length']?_0x2147d6[_0x9958('0x38')]:_0x137b8a['model'];if(!_0x3b298d[_0x9958('0x35')][_0x9958('0x3b')](_0x9958('0x58'))){_0x2147d6[_0x9958('0x1d')]=qs['limit'](_0x3b298d[_0x9958('0x35')][_0x9958('0x1d')]);_0x2147d6['offset']=qs[_0x9958('0x1b')](_0x3b298d[_0x9958('0x35')][_0x9958('0x1b')]);}_0x2147d6[_0x9958('0x3c')]=qs[_0x9958('0x3d')](_0x3b298d[_0x9958('0x35')][_0x9958('0x3d')]);_0x2147d6[_0x9958('0x3e')]=qs['filters'](_['pick'](_0x3b298d[_0x9958('0x35')],_0x137b8a[_0x9958('0x3f')]));_0x2147d6['raw']=!![];if(_0x3b298d[_0x9958('0x35')][_0x9958('0x40')]){_0x2147d6[_0x9958('0x3e')]=_['merge'](_0x2147d6[_0x9958('0x3e')],{'$or':_[_0x9958('0x33')](_0x2147d6[_0x9958('0x38')],function(_0x4a78a5){var _0x3b2462={};_0x3b2462[_0x4a78a5]={'$like':'%'+_0x3b298d[_0x9958('0x35')][_0x9958('0x40')]+'%'};return _0x3b2462;})});}_0x2147d6=_['merge']({},_0x2147d6,_0x3b298d[_0x9958('0x43')]);return _0x4b0954['getContacts'](_0x2147d6);}})['then'](function(_0x3d55cc){if(!_['isEmpty'](_0x3d55cc)){var _0x4193f5=toCsv(_0x3d55cc);var _0x15e778=Date[_0x9958('0x6f')]();fs[_0x9958('0x70')](util[_0x9958('0x6d')](_0x9958('0x71'),_0x4b0954['id'],_0x15e778),_0x4193f5);_0x5767e4[_0x9958('0x72')](_0x9958('0x73'),_0x9958('0x74')+util['format'](_0x9958('0x75'),_0x4b0954['id'],_0x15e778));_0x5767e4['setHeader'](_0x9958('0x76'),'text/csv');return _0x5767e4[_0x9958('0x77')](util[_0x9958('0x6d')]('/tmp/list_%d_%s.csv',_0x4b0954['id'],_0x15e778));}else{return _0x5767e4[_0x9958('0x2a')](0xcc);}})[_0x9958('0x46')](handleError(_0x5767e4,null));};exports['addCustomField']=function(_0x35651e,_0xc2d7f7,_0xafbf7b){var _0x2b210e;delete _0x35651e[_0x9958('0x4c')]['id'];return db[_0x9958('0x2e')][_0x9958('0x78')]({'where':{'id':_0x35651e[_0x9958('0x48')]['id']}})[_0x9958('0x26')](handleEntityNotFound(_0xc2d7f7,null))[_0x9958('0x26')](function(_0x21aaa2){if(_0x21aaa2){return db['sequelize'][_0x9958('0x79')](function(_0x4e242d){return db[_0x9958('0x68')]['create'](_0x35651e['body'],{'transaction':_0x4e242d})[_0x9958('0x26')](function(_0x4051a5){_0x2b210e=_0x4051a5;return _0x21aaa2[_0x9958('0x7a')](_0x4051a5,{'transaction':_0x4e242d});})['then'](function(){var _0x4157b5={'type':db['Sequelize'][_0x9958('0x7b')],'transaction':_0x4e242d};switch(_0x35651e['body'][_0x9958('0x30')]){case _0x9958('0x7c'):_0x4157b5['type']=db[_0x9958('0x7d')]['TEXT'];break;case'number':_0x4157b5[_0x9958('0x30')]=db[_0x9958('0x7d')][_0x9958('0x7e')];break;case _0x9958('0x7f'):_0x4157b5[_0x9958('0x30')]=db[_0x9958('0x7d')][_0x9958('0x80')];_0x4157b5['defaultValue']=![];break;default:}return db[_0x9958('0x81')][_0x9958('0x82')][_0x9958('0x83')](_0x9958('0x84'),util[_0x9958('0x6d')](_0x9958('0x85'),_0x2b210e['id']),_0x4157b5);})[_0x9958('0x26')](function(){return _0x2b210e;});});}})[_0x9958('0x26')](respondWithResult(_0xc2d7f7,null))[_0x9958('0x46')](handleError(_0xc2d7f7,null));};exports[_0x9958('0x86')]=function(_0x15e724,_0x7bfb7a,_0x3611da){var _0x217c11={};var _0x166357={};var _0x46392c;var _0x392fd0;return db[_0x9958('0x2e')][_0x9958('0x78')]({'where':{'id':_0x15e724[_0x9958('0x48')]['id']}})[_0x9958('0x26')](handleEntityNotFound(_0x7bfb7a,null))[_0x9958('0x26')](function(_0x467dd2){if(_0x467dd2){_0x46392c=_0x467dd2;_0x166357[_0x9958('0x32')]=_['keys'](db[_0x9958('0x68')][_0x9958('0x2f')]);_0x166357[_0x9958('0x35')]=_[_0x9958('0x36')](_0x15e724[_0x9958('0x35')]);_0x166357[_0x9958('0x3f')]=_['intersection'](_0x166357[_0x9958('0x32')],_0x166357[_0x9958('0x35')]);_0x217c11['attributes']=_[_0x9958('0x37')](_0x166357[_0x9958('0x32')],qs['fields'](_0x15e724[_0x9958('0x35')][_0x9958('0x39')]));_0x217c11[_0x9958('0x38')]=_0x217c11[_0x9958('0x38')]['length']?_0x217c11[_0x9958('0x38')]:_0x166357[_0x9958('0x32')];_0x217c11[_0x9958('0x3c')]=qs[_0x9958('0x3d')](_0x15e724[_0x9958('0x35')]['sort']);_0x217c11[_0x9958('0x3e')]=qs[_0x9958('0x3f')](_[_0x9958('0x59')](_0x15e724[_0x9958('0x35')],_0x166357[_0x9958('0x3f')]));_0x217c11[_0x9958('0x3e')]=_['merge'](_0x217c11[_0x9958('0x3e')],{'$or':[{'ListId':_0x467dd2['id']},{'ListId':null}]});if(_0x15e724[_0x9958('0x35')][_0x9958('0x40')]){_0x217c11[_0x9958('0x3e')]=_[_0x9958('0x41')](_0x217c11[_0x9958('0x3e')],{'$or':_[_0x9958('0x33')](_0x217c11[_0x9958('0x38')],function(_0x272339){var _0x3f4fa7={};_0x3f4fa7[_0x272339]={'$like':'%'+_0x15e724['query'][_0x9958('0x40')]+'%'};return _0x3f4fa7;})});}_0x217c11=_[_0x9958('0x41')]({},_0x217c11,_0x15e724[_0x9958('0x43')]);return db['CmCustomField'][_0x9958('0x87')](_0x217c11);}})[_0x9958('0x26')](respondWithResult(_0x7bfb7a,null))[_0x9958('0x46')](handleError(_0x7bfb7a,null));};exports['addAgents']=function(_0x36f6cc,_0x2e9762,_0x539510){return db['CmList'][_0x9958('0x4a')]({'where':{'id':_0x36f6cc[_0x9958('0x48')]['id']}})['then'](handleEntityNotFound(_0x2e9762,null))[_0x9958('0x26')](function(_0x40f353){if(_0x40f353){return _0x40f353['addAgents'](_0x36f6cc[_0x9958('0x4c')][_0x9958('0x5c')],_[_0x9958('0x88')](_0x36f6cc['body'],[_0x9958('0x5c'),'id'])||{})['spread'](function(_0x4eb35c){for(var _0x20ceac=0x0;_0x20ceac<_0x36f6cc[_0x9958('0x4c')]['ids'][_0x9958('0x3a')];_0x20ceac+=0x1){socket[_0x9958('0x89')](_0x9958('0x8a'),{'UserId':Number(_0x36f6cc[_0x9958('0x4c')]['ids'][_0x20ceac]),'CmListId':Number(_0x36f6cc['params']['id'])});}return _0x4eb35c;});}})[_0x9958('0x26')](respondWithResult(_0x2e9762,null))[_0x9958('0x46')](handleError(_0x2e9762,null));};exports['removeAgents']=function(_0x2a4b34,_0x43d367,_0x4e6d02){return db[_0x9958('0x2e')][_0x9958('0x4a')]({'where':{'id':_0x2a4b34[_0x9958('0x48')]['id']}})[_0x9958('0x26')](handleEntityNotFound(_0x43d367,null))[_0x9958('0x26')](function(_0x391330){if(_0x391330){return _0x391330[_0x9958('0x8b')](_0x2a4b34['query'][_0x9958('0x5c')])[_0x9958('0x26')](function(){if(_[_0x9958('0x60')](_0x2a4b34[_0x9958('0x35')][_0x9958('0x5c')])){for(var _0x549473=0x0;_0x549473<_0x2a4b34['query'][_0x9958('0x5c')][_0x9958('0x3a')];_0x549473+=0x1){socket[_0x9958('0x89')]('userCmList:remove',{'UserId':Number(_0x2a4b34['query'][_0x9958('0x5c')][_0x549473]),'CmListId':Number(_0x2a4b34['params']['id'])});}}else{socket[_0x9958('0x89')](_0x9958('0x8c'),{'UserId':Number(_0x2a4b34['query'][_0x9958('0x5c')]),'CmListId':Number(_0x2a4b34[_0x9958('0x48')]['id'])});}});}})[_0x9958('0x26')](respondWithStatusCode(_0x43d367,null))[_0x9958('0x46')](handleError(_0x43d367,null));};exports[_0x9958('0x8d')]=function(_0x48879c,_0x322944,_0xa0b3b8){var _0x50859d={};var _0x35aff5={};var _0x1fd076;var _0x17f8e1;return db[_0x9958('0x2e')][_0x9958('0x78')]({'where':{'id':_0x48879c[_0x9958('0x48')]['id']}})[_0x9958('0x26')](handleEntityNotFound(_0x322944,null))[_0x9958('0x26')](function(_0x5434fb){if(_0x5434fb){_0x1fd076=_0x5434fb;_0x35aff5[_0x9958('0x32')]=_[_0x9958('0x36')](db['User'][_0x9958('0x2f')]);_0x35aff5['query']=_[_0x9958('0x36')](_0x48879c[_0x9958('0x35')]);_0x35aff5[_0x9958('0x3f')]=_['intersection'](_0x35aff5[_0x9958('0x32')],_0x35aff5[_0x9958('0x35')]);_0x50859d[_0x9958('0x38')]=_[_0x9958('0x37')](_0x35aff5[_0x9958('0x32')],qs[_0x9958('0x39')](_0x48879c[_0x9958('0x35')][_0x9958('0x39')]));_0x50859d[_0x9958('0x38')]=_0x50859d[_0x9958('0x38')]['length']?_0x50859d['attributes']:_0x35aff5[_0x9958('0x32')];_0x50859d[_0x9958('0x3c')]=qs[_0x9958('0x3d')](_0x48879c[_0x9958('0x35')][_0x9958('0x3d')]);_0x50859d['where']=qs[_0x9958('0x3f')](_[_0x9958('0x59')](_0x48879c['query'],_0x35aff5[_0x9958('0x3f')]));if(_0x48879c[_0x9958('0x35')]['filter']){_0x50859d[_0x9958('0x3e')]=_[_0x9958('0x41')](_0x50859d[_0x9958('0x3e')],{'$or':_[_0x9958('0x33')](_0x50859d[_0x9958('0x38')],function(_0x461501){var _0x4edea1={};_0x4edea1[_0x461501]={'$like':'%'+_0x48879c[_0x9958('0x35')][_0x9958('0x40')]+'%'};return _0x4edea1;})});}_0x50859d=_['merge']({},_0x50859d,_0x48879c[_0x9958('0x43')]);return _0x1fd076[_0x9958('0x8d')](_0x50859d);}})['then'](function(_0x120c8b){if(_0x120c8b){_0x17f8e1=_0x120c8b[_0x9958('0x3a')];if(!_0x48879c['query'][_0x9958('0x3b')](_0x9958('0x58'))){_0x50859d[_0x9958('0x1d')]=qs[_0x9958('0x1d')](_0x48879c[_0x9958('0x35')][_0x9958('0x1d')]);_0x50859d['offset']=qs[_0x9958('0x1b')](_0x48879c[_0x9958('0x35')][_0x9958('0x1b')]);}return _0x1fd076[_0x9958('0x8d')](_0x50859d);}})[_0x9958('0x26')](function(_0x25b498){if(_0x25b498){return _0x25b498?{'count':_0x17f8e1,'rows':_0x25b498}:null;}})['then'](respondWithResult(_0x322944,null))[_0x9958('0x46')](handleError(_0x322944,null));}; \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 1352763..43756c4 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 _0x55ca=['events','../../mysqldb','update','remove','emit','hasOwnProperty','hook'];(function(_0x251d9c,_0x580977){var _0x16ae64=function(_0x4d3b53){while(--_0x4d3b53){_0x251d9c['push'](_0x251d9c['shift']());}};_0x16ae64(++_0x580977);}(_0x55ca,0x126));var _0xa55c=function(_0x595604,_0x2cc998){_0x595604=_0x595604-0x0;var _0x1466f3=_0x55ca[_0x595604];return _0x1466f3;};'use strict';var EventEmitter=require(_0xa55c('0x0'));var CmList=require(_0xa55c('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xa55c('0x2'),'afterDestroy':_0xa55c('0x3')};function emitEvent(_0x5dc716){return function(_0x3b478a,_0x2db02a,_0xcb02e3){CmListEvents[_0xa55c('0x4')](_0x5dc716+':'+_0x3b478a['id'],_0x3b478a);CmListEvents[_0xa55c('0x4')](_0x5dc716,_0x3b478a);_0xcb02e3(null);};}for(var e in events){if(events[_0xa55c('0x5')](e)){var event=events[e];CmList[_0xa55c('0x6')](e,emitEvent(event));}}module['exports']=CmListEvents; \ No newline at end of file +var _0x9957=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','CmList'];(function(_0x4fab58,_0x4e9f09){var _0xcebea3=function(_0x12148d){while(--_0x12148d){_0x4fab58['push'](_0x4fab58['shift']());}};_0xcebea3(++_0x4e9f09);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var EventEmitter=require(_0x7995('0x0'));var CmList=require(_0x7995('0x1'))['db'][_0x7995('0x2')];var CmListEvents=new EventEmitter();CmListEvents[_0x7995('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7995('0x4'),'afterDestroy':_0x7995('0x5')};function emitEvent(_0x1902b4){return function(_0x462a03,_0x576d89,_0x744bea){CmListEvents[_0x7995('0x6')](_0x1902b4+':'+_0x462a03['id'],_0x462a03);CmListEvents[_0x7995('0x6')](_0x1902b4,_0x462a03);_0x744bea(null);};}for(var e in events){if(events[_0x7995('0x7')](e)){var event=events[e];CmList[_0x7995('0x8')](e,emitEvent(event));}}module[_0x7995('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 a932fff..425fd45 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 _0x55e0=['./cmList.attributes','exports','define','cm_lists','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x55e0,0xdc));var _0x055e=function(_0x2ac72f,_0x3cd48f){_0x2ac72f=_0x2ac72f-0x0;var _0xa1c492=_0x55e0[_0x2ac72f];return _0xa1c492;};'use strict';var _=require(_0x055e('0x0'));var util=require(_0x055e('0x1'));var logger=require(_0x055e('0x2'))(_0x055e('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x055e('0x4'));var fs=require('fs');var path=require(_0x055e('0x5'));var rimraf=require(_0x055e('0x6'));var config=require(_0x055e('0x7'));var attributes=require(_0x055e('0x8'));module[_0x055e('0x9')]=function(_0x490ee1,_0x5239f6){return _0x490ee1[_0x055e('0xa')]('CmList',attributes,{'tableName':_0x055e('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xee5b=['request-promise','path','rimraf','exports','define','lodash','../../config/logger','api','bluebird'];(function(_0x1d64c6,_0x599bbb){var _0x2d8cd4=function(_0x4b6fc4){while(--_0x4b6fc4){_0x1d64c6['push'](_0x1d64c6['shift']());}};_0x2d8cd4(++_0x599bbb);}(_0xee5b,0x1f4));var _0xbee5=function(_0x430ef2,_0x530a49){_0x430ef2=_0x430ef2-0x0;var _0x1fa089=_0xee5b[_0x430ef2];return _0x1fa089;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var logger=require(_0xbee5('0x1'))(_0xbee5('0x2'));var moment=require('moment');var BPromise=require(_0xbee5('0x3'));var rp=require(_0xbee5('0x4'));var fs=require('fs');var path=require(_0xbee5('0x5'));var rimraf=require(_0xbee5('0x6'));var config=require('../../config/environment');var attributes=require('./cmList.attributes');module[_0xbee5('0x7')]=function(_0x2c0bde,_0xab6e4d){return _0x2c0bde[_0xbee5('0x8')]('CmList',attributes,{'tableName':'cm_lists','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 446b191..780e87b 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 _0xe1e0=['request','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register'];(function(_0x5bbf70,_0x2f58b3){var _0x397a54=function(_0x4b1bc7){while(--_0x4b1bc7){_0x5bbf70['push'](_0x5bbf70['shift']());}};_0x397a54(++_0x2f58b3);}(_0xe1e0,0x93));var _0x0e1e=function(_0x93d2c9,_0x1a3046){_0x93d2c9=_0x93d2c9-0x0;var _0x108bd0=_0xe1e0[_0x93d2c9];return _0x108bd0;};'use strict';var _=require(_0x0e1e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0e1e('0x1'));var db=require(_0x0e1e('0x2'))['db'];var utils=require(_0x0e1e('0x3'));var logger=require(_0x0e1e('0x4'))(_0x0e1e('0x5'));var config=require(_0x0e1e('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x0e1e('0x7')][_0x0e1e('0x8')]({'port':0x232a});config[_0x0e1e('0x9')]=_[_0x0e1e('0xa')](config[_0x0e1e('0x9')],{'host':_0x0e1e('0xb'),'port':0x18eb});var socket=require(_0x0e1e('0xc'))(new Redis(config[_0x0e1e('0x9')]));require(_0x0e1e('0xd'))[_0x0e1e('0xe')](socket);function respondWithRpcPromise(_0x346524,_0x58a5ba,_0x1291e9){return new BPromise(function(_0x5c8edd,_0x327420){return client[_0x0e1e('0xf')](_0x346524,_0x1291e9)['then'](function(_0x15d922){logger[_0x0e1e('0x10')](_0x0e1e('0x11'),_0x58a5ba,_0x0e1e('0x12'));logger[_0x0e1e('0x13')](_0x0e1e('0x14'),_0x58a5ba,_0x0e1e('0x12'),JSON[_0x0e1e('0x15')](_0x15d922));if(_0x15d922[_0x0e1e('0x16')]){if(_0x15d922[_0x0e1e('0x16')][_0x0e1e('0x17')]===0x1f4){logger[_0x0e1e('0x16')](_0x0e1e('0x11'),_0x58a5ba,_0x15d922[_0x0e1e('0x16')][_0x0e1e('0x18')]);return _0x327420(_0x15d922[_0x0e1e('0x16')]['message']);}logger[_0x0e1e('0x16')]('CmList,\x20%s,\x20%s',_0x58a5ba,_0x15d922[_0x0e1e('0x16')]['message']);return _0x5c8edd(_0x15d922[_0x0e1e('0x16')][_0x0e1e('0x18')]);}else{logger[_0x0e1e('0x10')](_0x0e1e('0x11'),_0x58a5ba,_0x0e1e('0x12'));_0x5c8edd(_0x15d922[_0x0e1e('0x19')][_0x0e1e('0x18')]);}})[_0x0e1e('0x1a')](function(_0x3691a9){logger[_0x0e1e('0x16')]('CmList,\x20%s,\x20%s',_0x58a5ba,_0x3691a9);_0x327420(_0x3691a9);});});} \ No newline at end of file +var _0xdc14=['request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./cmList.socket','register'];(function(_0x965e5,_0x28c754){var _0x3c1144=function(_0x474a86){while(--_0x474a86){_0x965e5['push'](_0x965e5['shift']());}};_0x3c1144(++_0x28c754);}(_0xdc14,0xb8));var _0x4dc1=function(_0x55e58c,_0x5278e9){_0x55e58c=_0x55e58c-0x0;var _0x32ce31=_0xdc14[_0x55e58c];return _0x32ce31;};'use strict';var _=require(_0x4dc1('0x0'));var util=require(_0x4dc1('0x1'));var moment=require(_0x4dc1('0x2'));var BPromise=require('bluebird');var rs=require(_0x4dc1('0x3'));var fs=require('fs');var Redis=require(_0x4dc1('0x4'));var db=require(_0x4dc1('0x5'))['db'];var utils=require(_0x4dc1('0x6'));var logger=require(_0x4dc1('0x7'))(_0x4dc1('0x8'));var config=require(_0x4dc1('0x9'));var jayson=require(_0x4dc1('0xa'));var client=jayson[_0x4dc1('0xb')][_0x4dc1('0xc')]({'port':0x232a});config[_0x4dc1('0xd')]=_[_0x4dc1('0xe')](config[_0x4dc1('0xd')],{'host':_0x4dc1('0xf'),'port':0x18eb});var socket=require(_0x4dc1('0x10'))(new Redis(config[_0x4dc1('0xd')]));require(_0x4dc1('0x11'))[_0x4dc1('0x12')](socket);function respondWithRpcPromise(_0x172715,_0x501e2d,_0x31f7b2){return new BPromise(function(_0x3a9c20,_0x4075ab){return client[_0x4dc1('0x13')](_0x172715,_0x31f7b2)[_0x4dc1('0x14')](function(_0x310729){logger[_0x4dc1('0x15')](_0x4dc1('0x16'),_0x501e2d,_0x4dc1('0x17'));logger[_0x4dc1('0x18')]('CmList,\x20%s,\x20%s,\x20%s',_0x501e2d,_0x4dc1('0x17'),JSON['stringify'](_0x310729));if(_0x310729[_0x4dc1('0x19')]){if(_0x310729[_0x4dc1('0x19')][_0x4dc1('0x1a')]===0x1f4){logger['error'](_0x4dc1('0x16'),_0x501e2d,_0x310729[_0x4dc1('0x19')][_0x4dc1('0x1b')]);return _0x4075ab(_0x310729['error']['message']);}logger[_0x4dc1('0x19')]('CmList,\x20%s,\x20%s',_0x501e2d,_0x310729[_0x4dc1('0x19')][_0x4dc1('0x1b')]);return _0x3a9c20(_0x310729[_0x4dc1('0x19')][_0x4dc1('0x1b')]);}else{logger['info']('CmList,\x20%s,\x20%s',_0x501e2d,_0x4dc1('0x17'));_0x3a9c20(_0x310729['result'][_0x4dc1('0x1b')]);}})[_0x4dc1('0x1c')](function(_0x43e2da){logger['error'](_0x4dc1('0x16'),_0x501e2d,_0x43e2da);_0x4075ab(_0x43e2da);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index 0664649..eb2119a 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 _0x6cb6=['cmList:','./cmList.events','remove','emit','removeListener','register','length'];(function(_0x4c6d6f,_0x291557){var _0x2d4478=function(_0x106946){while(--_0x106946){_0x4c6d6f['push'](_0x4c6d6f['shift']());}};_0x2d4478(++_0x291557);}(_0x6cb6,0xe1));var _0x66cb=function(_0x311c35,_0x534915){_0x311c35=_0x311c35-0x0;var _0x5cc50c=_0x6cb6[_0x311c35];return _0x5cc50c;};'use strict';var CmListEvents=require(_0x66cb('0x0'));var events=['save',_0x66cb('0x1'),'update'];function createListener(_0x4bb353,_0x38b7ec){return function(_0x38ad3){_0x38b7ec[_0x66cb('0x2')](_0x4bb353,_0x38ad3);};}function removeListener(_0x268283,_0x6b6982){return function(){CmListEvents[_0x66cb('0x3')](_0x268283,_0x6b6982);};}exports[_0x66cb('0x4')]=function(_0x39dac6){for(var _0xbf2a9e=0x0,_0x7b89c4=events[_0x66cb('0x5')];_0xbf2a9e<_0x7b89c4;_0xbf2a9e++){var _0x245be1=events[_0xbf2a9e];var _0x3eb2c=createListener(_0x66cb('0x6')+_0x245be1,_0x39dac6);CmListEvents['on'](_0x245be1,_0x3eb2c);}}; \ No newline at end of file +var _0x4d92=['length','cmList:','./cmList.events','remove','emit','removeListener'];(function(_0x444b65,_0x835835){var _0x45afb1=function(_0x2057f4){while(--_0x2057f4){_0x444b65['push'](_0x444b65['shift']());}};_0x45afb1(++_0x835835);}(_0x4d92,0x1be));var _0x24d9=function(_0x24f326,_0x616a7){_0x24f326=_0x24f326-0x0;var _0x488e2d=_0x4d92[_0x24f326];return _0x488e2d;};'use strict';var CmListEvents=require(_0x24d9('0x0'));var events=['save',_0x24d9('0x1'),'update'];function createListener(_0x25e4a7,_0x229f0a){return function(_0x570785){_0x229f0a[_0x24d9('0x2')](_0x25e4a7,_0x570785);};}function removeListener(_0x49eb8d,_0x5ded15){return function(){CmListEvents[_0x24d9('0x3')](_0x49eb8d,_0x5ded15);};}exports['register']=function(_0xbaf753){for(var _0x5c2692=0x0,_0x5c3f98=events[_0x24d9('0x4')];_0x5c2692<_0x5c3f98;_0x5c2692++){var _0x1833ba=events[_0x5c2692];var _0x1b793c=createListener(_0x24d9('0x5')+_0x1833ba,_0xbaf753);CmListEvents['on'](_0x1833ba,_0x1b793c);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index fddb702..9be711b 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 _0xcdc9=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id/dispositions','getDispositions','/:id/contacts','getContactsCsv','/:id/fields','getCustomFields','/:id/users','getAgents','post','create','addDisposition','addContacts','addCustomField','put','/:id','update','delete','removeDispositions','removeAgents','exports','multer','util','connect-timeout','express','Router'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xcdc9,0x10b));var _0x9cdc=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xcdc9[_0x3ab51d];return _0x29a04e;};'use strict';var multer=require(_0x9cdc('0x0'));var util=require(_0x9cdc('0x1'));var path=require('path');var timeout=require(_0x9cdc('0x2'));var express=require(_0x9cdc('0x3'));var router=express[_0x9cdc('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9cdc('0x5'));var interaction=require(_0x9cdc('0x6'));var config=require(_0x9cdc('0x7'));var controller=require(_0x9cdc('0x8'));router[_0x9cdc('0x9')]('/',auth[_0x9cdc('0xa')](),controller[_0x9cdc('0xb')]);router[_0x9cdc('0x9')](_0x9cdc('0xc'),auth[_0x9cdc('0xa')](),controller[_0x9cdc('0xd')]);router[_0x9cdc('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x9cdc('0x9')](_0x9cdc('0xe'),auth[_0x9cdc('0xa')](),controller[_0x9cdc('0xf')]);router[_0x9cdc('0x9')](_0x9cdc('0x10'),auth[_0x9cdc('0xa')](),controller['getContacts']);router['get']('/:id/contacts/csv',auth[_0x9cdc('0xa')](),controller[_0x9cdc('0x11')]);router[_0x9cdc('0x9')](_0x9cdc('0x12'),auth[_0x9cdc('0xa')](),controller[_0x9cdc('0x13')]);router[_0x9cdc('0x9')](_0x9cdc('0x14'),auth[_0x9cdc('0xa')](),controller[_0x9cdc('0x15')]);router[_0x9cdc('0x16')]('/',auth[_0x9cdc('0xa')](),controller[_0x9cdc('0x17')]);router['post'](_0x9cdc('0xe'),auth[_0x9cdc('0xa')](),controller[_0x9cdc('0x18')]);router[_0x9cdc('0x16')]('/:id/contacts',auth[_0x9cdc('0xa')](),controller[_0x9cdc('0x19')]);router[_0x9cdc('0x16')](_0x9cdc('0x12'),auth['isAuthenticated'](),controller[_0x9cdc('0x1a')]);router[_0x9cdc('0x16')](_0x9cdc('0x14'),auth[_0x9cdc('0xa')](),controller['addAgents']);router[_0x9cdc('0x1b')](_0x9cdc('0x1c'),auth[_0x9cdc('0xa')](),controller[_0x9cdc('0x1d')]);router[_0x9cdc('0x1e')](_0x9cdc('0x1c'),auth['isAuthenticated'](),controller['destroy']);router['delete'](_0x9cdc('0xe'),auth['isAuthenticated'](),controller[_0x9cdc('0x1f')]);router[_0x9cdc('0x1e')](_0x9cdc('0x14'),auth[_0x9cdc('0xa')](),controller[_0x9cdc('0x20')]);module[_0x9cdc('0x21')]=router; \ No newline at end of file +var _0x752d=['delete','removeAgents','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getAgents','post','addContacts','addCustomField','/:id/users','addAgents','update','destroy','removeDispositions'];(function(_0x12f689,_0x41a363){var _0x34d31b=function(_0x19ba54){while(--_0x19ba54){_0x12f689['push'](_0x12f689['shift']());}};_0x34d31b(++_0x41a363);}(_0x752d,0x1ca));var _0xd752=function(_0x5dc94e,_0x4616f4){_0x5dc94e=_0x5dc94e-0x0;var _0x265975=_0x752d[_0x5dc94e];return _0x265975;};'use strict';var multer=require(_0xd752('0x0'));var util=require(_0xd752('0x1'));var path=require(_0xd752('0x2'));var timeout=require(_0xd752('0x3'));var express=require('express');var router=express[_0xd752('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xd752('0x5'));var interaction=require(_0xd752('0x6'));var config=require(_0xd752('0x7'));var controller=require(_0xd752('0x8'));router[_0xd752('0x9')]('/',auth[_0xd752('0xa')](),controller[_0xd752('0xb')]);router[_0xd752('0x9')](_0xd752('0xc'),auth[_0xd752('0xa')](),controller[_0xd752('0xd')]);router[_0xd752('0x9')](_0xd752('0xe'),auth[_0xd752('0xa')](),controller[_0xd752('0xf')]);router[_0xd752('0x9')](_0xd752('0x10'),auth[_0xd752('0xa')](),controller[_0xd752('0x11')]);router[_0xd752('0x9')](_0xd752('0x12'),auth[_0xd752('0xa')](),controller[_0xd752('0x13')]);router['get'](_0xd752('0x14'),auth[_0xd752('0xa')](),controller[_0xd752('0x15')]);router['get'](_0xd752('0x16'),auth['isAuthenticated'](),controller['getCustomFields']);router[_0xd752('0x9')]('/:id/users',auth[_0xd752('0xa')](),controller[_0xd752('0x17')]);router[_0xd752('0x18')]('/',auth[_0xd752('0xa')](),controller['create']);router[_0xd752('0x18')](_0xd752('0x10'),auth[_0xd752('0xa')](),controller['addDisposition']);router[_0xd752('0x18')]('/:id/contacts',auth[_0xd752('0xa')](),controller[_0xd752('0x19')]);router['post']('/:id/fields',auth[_0xd752('0xa')](),controller[_0xd752('0x1a')]);router[_0xd752('0x18')](_0xd752('0x1b'),auth[_0xd752('0xa')](),controller[_0xd752('0x1c')]);router['put'](_0xd752('0xe'),auth[_0xd752('0xa')](),controller[_0xd752('0x1d')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xd752('0x1e')]);router['delete'](_0xd752('0x10'),auth[_0xd752('0xa')](),controller[_0xd752('0x1f')]);router[_0xd752('0x20')](_0xd752('0x1b'),auth[_0xd752('0xa')](),controller[_0xd752('0x21')]);module[_0xd752('0x22')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6933cb6..d5537e2 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 _0x2be9=['STRING','sequelize','exports','VIRTUAL'];(function(_0x23f7d1,_0x1a678f){var _0x7f22=function(_0x45afa8){while(--_0x45afa8){_0x23f7d1['push'](_0x23f7d1['shift']());}};_0x7f22(++_0x1a678f);}(_0x2be9,0x179));var _0x92be=function(_0xf3e4a0,_0x16a172){_0xf3e4a0=_0xf3e4a0-0x0;var _0x43f1cc=_0x2be9[_0xf3e4a0];return _0x43f1cc;};'use strict';var Sequelize=require(_0x92be('0x0'));module[_0x92be('0x1')]={'name':{'type':Sequelize[_0x92be('0x2')],'get':function(_0x55e779){return this['getDataValue']('field');}},'field':{'type':Sequelize['STRING'],'allowNull':![]},'operator':{'type':Sequelize[_0x92be('0x3')],'allowNull':![]},'value':{'type':Sequelize[_0x92be('0x3')],'allowNull':![]}}; \ No newline at end of file +var _0x9526=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x5e578a,_0x45ab3c){var _0x2dceb2=function(_0x3fe378){while(--_0x3fe378){_0x5e578a['push'](_0x5e578a['shift']());}};_0x2dceb2(++_0x45ab3c);}(_0x9526,0x82));var _0x6952=function(_0x5ecadc,_0x1cf9f1){_0x5ecadc=_0x5ecadc-0x0;var _0x565037=_0x9526[_0x5ecadc];return _0x565037;};'use strict';var Sequelize=require(_0x6952('0x0'));module[_0x6952('0x1')]={'name':{'type':Sequelize[_0x6952('0x2')],'get':function(_0x3a3233){return this[_0x6952('0x3')](_0x6952('0x4'));}},'field':{'type':Sequelize[_0x6952('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x6952('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x6952('0x5')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/condition/condition.controller.js b/server/api/condition/condition.controller.js index a6b7dc3..e9137b5 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 _0x9957=['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','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x345c64,_0x4ed1a5){var _0x30542c=function(_0x4e5abc){while(--_0x4e5abc){_0x345c64['push'](_0x345c64['shift']());}};_0x30542c(++_0x4ed1a5);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file +var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0xf5787c,_0xe115a9){var _0x46e8bb=function(_0x227a59){while(--_0x227a59){_0xf5787c['push'](_0xf5787c['shift']());}};_0x46e8bb(++_0xe115a9);}(_0x7a54,0x106));var _0x47a5=function(_0x1e7ec5,_0x1ccbf5){_0x1e7ec5=_0x1e7ec5-0x0;var _0x39f0c7=_0x7a54[_0x1e7ec5];return _0x39f0c7;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 07e1973..7d145ca 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 _0xc902=['Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc902,0x14c));var _0x2c90=function(_0x3290d8,_0x5b617e){_0x3290d8=_0x3290d8-0x0;var _0xb59ad3=_0xc902[_0x3290d8];return _0xb59ad3;};'use strict';var _=require(_0x2c90('0x0'));var util=require(_0x2c90('0x1'));var logger=require(_0x2c90('0x2'))(_0x2c90('0x3'));var moment=require(_0x2c90('0x4'));var BPromise=require(_0x2c90('0x5'));var rp=require(_0x2c90('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2c90('0x7'));var attributes=require('./condition.attributes');module[_0x2c90('0x8')]=function(_0x3401e2,_0x8f7a3){return _0x3401e2['define'](_0x2c90('0x9'),attributes,{'tableName':_0x2c90('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d0d=['request-promise','path','../../config/environment','./condition.attributes','exports','Condition','tools_conditions','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x468497,_0x3e4392){var _0x358103=function(_0x2c11fb){while(--_0x2c11fb){_0x468497['push'](_0x468497['shift']());}};_0x358103(++_0x3e4392);}(_0x3d0d,0xa3));var _0xd3d0=function(_0x58eb87,_0x10e943){_0x58eb87=_0x58eb87-0x0;var _0x53675e=_0x3d0d[_0x58eb87];return _0x53675e;};'use strict';var _=require(_0xd3d0('0x0'));var util=require(_0xd3d0('0x1'));var logger=require(_0xd3d0('0x2'))(_0xd3d0('0x3'));var moment=require(_0xd3d0('0x4'));var BPromise=require(_0xd3d0('0x5'));var rp=require(_0xd3d0('0x6'));var fs=require('fs');var path=require(_0xd3d0('0x7'));var rimraf=require('rimraf');var config=require(_0xd3d0('0x8'));var attributes=require(_0xd3d0('0x9'));module[_0xd3d0('0xa')]=function(_0x3f52e4,_0x1758e3){return _0x3f52e4['define'](_0xd3d0('0xb'),attributes,{'tableName':_0xd3d0('0xc'),'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 860c3c0..51e3230 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 _0x0af6=['request\x20sent','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s'];(function(_0x5ea710,_0x40a4f8){var _0x5397e2=function(_0x234979){while(--_0x234979){_0x5ea710['push'](_0x5ea710['shift']());}};_0x5397e2(++_0x40a4f8);}(_0x0af6,0x1c0));var _0x60af=function(_0x5712f8,_0x17156b){_0x5712f8=_0x5712f8-0x0;var _0x14a364=_0x0af6[_0x5712f8];return _0x14a364;};'use strict';var _=require(_0x60af('0x0'));var util=require(_0x60af('0x1'));var moment=require(_0x60af('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x60af('0x3'));var db=require(_0x60af('0x4'))['db'];var utils=require(_0x60af('0x5'));var logger=require('../../config/logger')(_0x60af('0x6'));var config=require(_0x60af('0x7'));var jayson=require(_0x60af('0x8'));var client=jayson[_0x60af('0x9')][_0x60af('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x554f69,_0x6f1084,_0x167607){return new BPromise(function(_0x36bd75,_0x371aa4){return client[_0x60af('0xb')](_0x554f69,_0x167607)['then'](function(_0x3aaff1){logger['info'](_0x60af('0xc'),_0x6f1084,'request\x20sent');logger['debug'](_0x60af('0xd'),_0x6f1084,_0x60af('0xe'),JSON[_0x60af('0xf')](_0x3aaff1));if(_0x3aaff1['error']){if(_0x3aaff1[_0x60af('0x10')][_0x60af('0x11')]===0x1f4){logger[_0x60af('0x10')](_0x60af('0xc'),_0x6f1084,_0x3aaff1[_0x60af('0x10')][_0x60af('0x12')]);return _0x371aa4(_0x3aaff1[_0x60af('0x10')][_0x60af('0x12')]);}logger[_0x60af('0x10')]('Condition,\x20%s,\x20%s',_0x6f1084,_0x3aaff1[_0x60af('0x10')]['message']);return _0x36bd75(_0x3aaff1['error'][_0x60af('0x12')]);}else{logger[_0x60af('0x13')](_0x60af('0xc'),_0x6f1084,_0x60af('0xe'));_0x36bd75(_0x3aaff1[_0x60af('0x14')][_0x60af('0x12')]);}})[_0x60af('0x15')](function(_0x2a54b8){logger[_0x60af('0x10')](_0x60af('0xc'),_0x6f1084,_0x2a54b8);_0x371aa4(_0x2a54b8);});});} \ No newline at end of file +var _0x1a3c=['ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring'];(function(_0x3a6b77,_0x45db32){var _0x55fce9=function(_0x535626){while(--_0x535626){_0x3a6b77['push'](_0x3a6b77['shift']());}};_0x55fce9(++_0x45db32);}(_0x1a3c,0x1c4));var _0xc1a3=function(_0x221cd3,_0x5cdbf2){_0x221cd3=_0x221cd3-0x0;var _0x18e650=_0x1a3c[_0x221cd3];return _0x18e650;};'use strict';var _=require(_0xc1a3('0x0'));var util=require(_0xc1a3('0x1'));var moment=require('moment');var BPromise=require(_0xc1a3('0x2'));var rs=require(_0xc1a3('0x3'));var fs=require('fs');var Redis=require(_0xc1a3('0x4'));var db=require(_0xc1a3('0x5'))['db'];var utils=require(_0xc1a3('0x6'));var logger=require(_0xc1a3('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xc1a3('0x8'));var client=jayson[_0xc1a3('0x9')][_0xc1a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x394aa9,_0x18cb67,_0x82937c){return new BPromise(function(_0x57e465,_0x435ace){return client[_0xc1a3('0xb')](_0x394aa9,_0x82937c)[_0xc1a3('0xc')](function(_0x398705){logger[_0xc1a3('0xd')]('Condition,\x20%s,\x20%s',_0x18cb67,_0xc1a3('0xe'));logger[_0xc1a3('0xf')](_0xc1a3('0x10'),_0x18cb67,_0xc1a3('0xe'),JSON[_0xc1a3('0x11')](_0x398705));if(_0x398705[_0xc1a3('0x12')]){if(_0x398705[_0xc1a3('0x12')][_0xc1a3('0x13')]===0x1f4){logger[_0xc1a3('0x12')](_0xc1a3('0x14'),_0x18cb67,_0x398705[_0xc1a3('0x12')][_0xc1a3('0x15')]);return _0x435ace(_0x398705['error'][_0xc1a3('0x15')]);}logger[_0xc1a3('0x12')](_0xc1a3('0x14'),_0x18cb67,_0x398705['error'][_0xc1a3('0x15')]);return _0x57e465(_0x398705[_0xc1a3('0x12')][_0xc1a3('0x15')]);}else{logger['info'](_0xc1a3('0x14'),_0x18cb67,'request\x20sent');_0x57e465(_0x398705[_0xc1a3('0x16')]['message']);}})[_0xc1a3('0x17')](function(_0x5a709b){logger[_0xc1a3('0x12')](_0xc1a3('0x14'),_0x18cb67,_0x5a709b);_0x435ace(_0x5a709b);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 4d3b736..f2c5d2e 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 _0xb42d=['connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','exports','multer','util','path'];(function(_0x49c997,_0x51594d){var _0x5717a5=function(_0x11714c){while(--_0x11714c){_0x49c997['push'](_0x49c997['shift']());}};_0x5717a5(++_0x51594d);}(_0xb42d,0x7d));var _0xdb42=function(_0x1c7664,_0x4485d7){_0x1c7664=_0x1c7664-0x0;var _0x55013f=_0xb42d[_0x1c7664];return _0x55013f;};'use strict';var multer=require(_0xdb42('0x0'));var util=require(_0xdb42('0x1'));var path=require(_0xdb42('0x2'));var timeout=require(_0xdb42('0x3'));var express=require('express');var router=express[_0xdb42('0x4')]();var fs_extra=require(_0xdb42('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb42('0x6'));var config=require(_0xdb42('0x7'));var controller=require(_0xdb42('0x8'));router[_0xdb42('0x9')](_0xdb42('0xa'),auth['isAuthenticated'](),controller[_0xdb42('0xb')]);router[_0xdb42('0xc')](_0xdb42('0xa'),auth[_0xdb42('0xd')](),controller[_0xdb42('0xe')]);module[_0xdb42('0xf')]=router; \ No newline at end of file +var _0xc768=['../../components/interaction/service','../../config/environment','./condition.controller','put','/:id','update','delete','isAuthenticated','destroy','multer','express','Router','fs-extra'];(function(_0xfebe8f,_0x54af65){var _0x4c33a5=function(_0x5351c3){while(--_0x5351c3){_0xfebe8f['push'](_0xfebe8f['shift']());}};_0x4c33a5(++_0x54af65);}(_0xc768,0x18f));var _0x8c76=function(_0x19eb1b,_0x142b0d){_0x19eb1b=_0x19eb1b-0x0;var _0x4d77f8=_0xc768[_0x19eb1b];return _0x4d77f8;};'use strict';var multer=require(_0x8c76('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x8c76('0x1'));var router=express[_0x8c76('0x2')]();var fs_extra=require(_0x8c76('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x8c76('0x4'));var config=require(_0x8c76('0x5'));var controller=require(_0x8c76('0x6'));router[_0x8c76('0x7')](_0x8c76('0x8'),auth['isAuthenticated'](),controller[_0x8c76('0x9')]);router[_0x8c76('0xa')]('/:id',auth[_0x8c76('0xb')](),controller[_0x8c76('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index ffeba54..8cb4e66 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 _0xbaf0=['name','exports','STRING'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_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')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0x2032=['name','exports','STRING'];(function(_0x13a6a4,_0x227cd4){var _0x1ad469=function(_0x2a76a8){while(--_0x2a76a8){_0x13a6a4['push'](_0x13a6a4['shift']());}};_0x1ad469(++_0x227cd4);}(_0x2032,0xd9));var _0x2203=function(_0x156db8,_0x50c236){_0x156db8=_0x156db8-0x0;var _0xd1e927=_0x2032[_0x156db8];return _0xd1e927;};'use strict';var Sequelize=require('sequelize');module[_0x2203('0x0')]={'name':{'type':Sequelize[_0x2203('0x1')],'allowNull':![],'unique':_0x2203('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index dcf7414..071b711 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 _0x9433=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','omit','createdAt','updatedAt','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','iframe','attrUrl','attrs','value','https://','custom','attrHourFormat','HH:mm:ss','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','reportType','attrRefresh','widgetAttributes:\x20%s','addItem','DashboardItem','findOne','getItems','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','mustache','util','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','CustomDashboards','UserProfileResource','destroy','stack','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','query','intersection','attributes','fields','length','model','hasOwnProperty','sort','filters','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','body','user','get'];(function(_0x26dc90,_0x398701){var _0x402cf2=function(_0x51b1c7){while(--_0x51b1c7){_0x26dc90['push'](_0x26dc90['shift']());}};_0x402cf2(++_0x398701);}(_0x9433,0x112));var _0x3943=function(_0x1e9534,_0x85034a){_0x1e9534=_0x1e9534-0x0;var _0x2effcf=_0x9433[_0x1e9534];return _0x2effcf;};'use strict';var emlformat=require(_0x3943('0x0'));var rimraf=require(_0x3943('0x1'));var zipdir=require(_0x3943('0x2'));var jsonpatch=require(_0x3943('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x3943('0x4'));var util=require(_0x3943('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(_0x3943('0x6'));var _=require('lodash');var squel=require(_0x3943('0x7'));var crypto=require(_0x3943('0x8'));var jsforce=require(_0x3943('0x9'));var deskjs=require(_0x3943('0xa'));var toCsv=require('to-csv');var querystring=require(_0x3943('0xb'));var Papa=require('papaparse');var Redis=require(_0x3943('0xc'));var authService=require(_0x3943('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x3943('0xe'));var hardwareService=require(_0x3943('0xf'));var logger=require(_0x3943('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x3943('0x11'));var licenseUtil=require(_0x3943('0x12'));var db=require(_0x3943('0x13'))['db'];config[_0x3943('0x14')]=_['defaults'](config[_0x3943('0x14')],{'host':_0x3943('0x15'),'port':0x18eb});var socket=require(_0x3943('0x16'))(new Redis(config[_0x3943('0x14')]));require(_0x3943('0x17'))[_0x3943('0x18')](socket);function respondWithStatusCode(_0xfa403b,_0x193ac3){_0x193ac3=_0x193ac3||0xcc;return function(_0xa2aa2d){if(_0xa2aa2d){return _0xfa403b[_0x3943('0x19')](_0x193ac3);}return _0xfa403b[_0x3943('0x1a')](_0x193ac3)[_0x3943('0x1b')]();};}function respondWithResult(_0xca07a,_0x4d4462){_0x4d4462=_0x4d4462||0xc8;return function(_0x509fdb){if(_0x509fdb){return _0xca07a[_0x3943('0x1a')](_0x4d4462)[_0x3943('0x1c')](_0x509fdb);}};}function respondWithFilteredResult(_0x3c11f8,_0x4413c4){return function(_0x12840e){if(_0x12840e){var _0xf50028=typeof _0x4413c4[_0x3943('0x1d')]===_0x3943('0x1e')&&typeof _0x4413c4[_0x3943('0x1f')]===_0x3943('0x1e');var _0x1a9c4b=_0x12840e[_0x3943('0x20')];var _0x36a105=_0xf50028?0x0:_0x4413c4[_0x3943('0x1d')];var _0x52f504=_0xf50028?_0x12840e['count']:_0x4413c4['offset']+_0x4413c4['limit'];var _0x39d87c;if(_0x52f504>=_0x1a9c4b){_0x52f504=_0x1a9c4b;_0x39d87c=0xc8;}else{_0x39d87c=0xce;}_0x3c11f8[_0x3943('0x1a')](_0x39d87c);return _0x3c11f8[_0x3943('0x21')](_0x3943('0x22'),_0x36a105+'-'+_0x52f504+'/'+_0x1a9c4b)[_0x3943('0x1c')](_0x12840e);}return null;};}function patchUpdates(_0x555bff){return function(_0x14214b){try{jsonpatch['apply'](_0x14214b,_0x555bff,!![]);}catch(_0x2be97e){return BPromise[_0x3943('0x23')](_0x2be97e);}return _0x14214b[_0x3943('0x24')]();};}function saveUpdates(_0x4634e1,_0x3129be){return function(_0x28e2bb){if(_0x28e2bb){return _0x28e2bb[_0x3943('0x25')](_0x4634e1)[_0x3943('0x26')](function(_0x57cde7){return _0x57cde7;});}return null;};}function removeEntity(_0x568747,_0x5b775b){return function(_0x45b88d){if(_0x45b88d){return _0x45b88d['destroy']()['then'](function(){var _0x36ff59=_0x45b88d['get']({'plain':!![]});var _0x18ab41=_0x3943('0x27');return db[_0x3943('0x28')][_0x3943('0x29')]({'where':{'type':_0x18ab41,'resourceId':_0x36ff59['id']}})[_0x3943('0x26')](function(){return _0x45b88d;});})['then'](function(){_0x568747[_0x3943('0x1a')](0xcc)[_0x3943('0x1b')]();});}};}function handleEntityNotFound(_0x15e9af,_0x5df9e2){return function(_0x4142e8){if(!_0x4142e8){_0x15e9af[_0x3943('0x19')](0x194);}return _0x4142e8;};}function handleError(_0x12ed65,_0x176cdc){_0x176cdc=_0x176cdc||0x1f4;return function(_0x19cdd6){logger['error'](_0x19cdd6[_0x3943('0x2a')]);if(_0x19cdd6[_0x3943('0x2b')]){delete _0x19cdd6[_0x3943('0x2b')];}_0x12ed65[_0x3943('0x1a')](_0x176cdc)[_0x3943('0x2c')](_0x19cdd6);};}exports[_0x3943('0x2d')]=function(_0x11f71d,_0x1c7d66){var _0x1bc193={},_0x5e7211={},_0x415cba={'count':0x0,'rows':[]};var _0x7e3639=_[_0x3943('0x2e')](db[_0x3943('0x2f')][_0x3943('0x30')],function(_0x498f7a){return{'name':_0x498f7a[_0x3943('0x31')],'type':_0x498f7a[_0x3943('0x32')][_0x3943('0x33')]};});_0x5e7211['model']=_[_0x3943('0x2e')](_0x7e3639,_0x3943('0x2b'));_0x5e7211['query']=_['keys'](_0x11f71d[_0x3943('0x34')]);_0x5e7211['filters']=_[_0x3943('0x35')](_0x5e7211['model'],_0x5e7211[_0x3943('0x34')]);_0x1bc193[_0x3943('0x36')]=_['intersection'](_0x5e7211['model'],qs[_0x3943('0x37')](_0x11f71d['query']['fields']));_0x1bc193[_0x3943('0x36')]=_0x1bc193[_0x3943('0x36')][_0x3943('0x38')]?_0x1bc193[_0x3943('0x36')]:_0x5e7211[_0x3943('0x39')];if(!_0x11f71d[_0x3943('0x34')][_0x3943('0x3a')]('nolimit')){_0x1bc193[_0x3943('0x1f')]=qs['limit'](_0x11f71d[_0x3943('0x34')][_0x3943('0x1f')]);_0x1bc193['offset']=qs[_0x3943('0x1d')](_0x11f71d[_0x3943('0x34')][_0x3943('0x1d')]);}_0x1bc193['order']=qs[_0x3943('0x3b')](_0x11f71d['query']['sort']);_0x1bc193['where']=qs[_0x3943('0x3c')](_[_0x3943('0x3d')](_0x11f71d[_0x3943('0x34')],_0x5e7211[_0x3943('0x3c')]),_0x7e3639);if(_0x11f71d[_0x3943('0x34')]['filter']){_0x1bc193[_0x3943('0x3e')]=_[_0x3943('0x3f')](_0x1bc193[_0x3943('0x3e')],{'$or':_['map'](_0x7e3639,function(_0x409aa0){if(_0x409aa0[_0x3943('0x32')]!==_0x3943('0x40')){var _0x105384={};_0x105384[_0x409aa0[_0x3943('0x2b')]]={'$like':'%'+_0x11f71d[_0x3943('0x34')][_0x3943('0x41')]+'%'};return _0x105384;}})});}_0x1bc193=_['merge']({},_0x1bc193,_0x11f71d[_0x3943('0x42')]);var _0x22cf62={'where':_0x1bc193[_0x3943('0x3e')]};return db[_0x3943('0x2f')][_0x3943('0x20')](_0x22cf62)[_0x3943('0x26')](function(_0x1a6bf7){_0x415cba['count']=_0x1a6bf7;if(_0x11f71d[_0x3943('0x34')][_0x3943('0x43')]){_0x1bc193[_0x3943('0x44')]=[{'all':!![]}];}return db[_0x3943('0x2f')][_0x3943('0x45')](_0x1bc193);})['then'](function(_0x37c1df){_0x415cba[_0x3943('0x46')]=_0x37c1df;return _0x415cba;})[_0x3943('0x26')](respondWithFilteredResult(_0x1c7d66,_0x1bc193))[_0x3943('0x47')](handleError(_0x1c7d66,null));};exports[_0x3943('0x48')]=function(_0x3a5e02,_0x56d988){var _0x41f9a7={'raw':![],'where':{'id':_0x3a5e02[_0x3943('0x49')]['id']}},_0x23944e={};_0x23944e[_0x3943('0x39')]=_[_0x3943('0x4a')](db[_0x3943('0x2f')]['rawAttributes']);_0x23944e[_0x3943('0x34')]=_['keys'](_0x3a5e02[_0x3943('0x34')]);_0x23944e['filters']=_[_0x3943('0x35')](_0x23944e[_0x3943('0x39')],_0x23944e['query']);_0x41f9a7[_0x3943('0x36')]=_['intersection'](_0x23944e[_0x3943('0x39')],qs['fields'](_0x3a5e02[_0x3943('0x34')][_0x3943('0x37')]));_0x41f9a7[_0x3943('0x36')]=_0x41f9a7[_0x3943('0x36')]['length']?_0x41f9a7['attributes']:_0x23944e[_0x3943('0x39')];if(_0x3a5e02[_0x3943('0x34')]['includeAll']){_0x41f9a7[_0x3943('0x44')]=[{'all':!![]}];}_0x41f9a7=_[_0x3943('0x3f')]({},_0x41f9a7,_0x3a5e02['options']);return db[_0x3943('0x2f')][_0x3943('0x4b')](_0x41f9a7)['then'](handleEntityNotFound(_0x56d988,null))[_0x3943('0x26')](respondWithResult(_0x56d988,null))[_0x3943('0x47')](handleError(_0x56d988,null));};exports[_0x3943('0x4c')]=function(_0x55b066,_0x408952){return db[_0x3943('0x2f')]['create'](_0x55b066[_0x3943('0x4d')],{})[_0x3943('0x26')](function(_0x42bed9){var _0x25cdeb=_0x55b066[_0x3943('0x4e')][_0x3943('0x4f')]({'plain':!![]});if(!_0x25cdeb)throw new Error(_0x3943('0x50'));if(_0x25cdeb[_0x3943('0x51')]==='user'){var _0x34d237=_0x42bed9[_0x3943('0x4f')]({'plain':!![]});var _0x32046d='CustomDashboards';return db[_0x3943('0x52')][_0x3943('0x4b')]({'where':{'name':_0x32046d,'userProfileId':_0x25cdeb[_0x3943('0x53')]},'raw':!![]})[_0x3943('0x26')](function(_0x482c6c){if(_0x482c6c&&_0x482c6c[_0x3943('0x54')]===0x0){return db['UserProfileResource'][_0x3943('0x4c')]({'name':_0x34d237['name'],'resourceId':_0x34d237['id'],'type':_0x482c6c[_0x3943('0x2b')],'sectionId':_0x482c6c['id']},{})[_0x3943('0x26')](function(){return _0x42bed9;});}else{return _0x42bed9;}})['catch'](function(_0x15ca48){logger[_0x3943('0x55')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x15ca48);throw _0x15ca48;});}return _0x42bed9;})[_0x3943('0x26')](respondWithResult(_0x408952,0xc9))[_0x3943('0x47')](handleError(_0x408952,null));};exports['clone']=function(_0x290cf8,_0x466959){var _0x939aee={'where':{'id':_0x290cf8[_0x3943('0x49')]['id']}},_0x2d6a01={};_0x2d6a01['model']=_[_0x3943('0x4a')](db[_0x3943('0x2f')][_0x3943('0x30')]);_0x939aee['attributes']=_[_0x3943('0x35')](_0x2d6a01['model'],qs[_0x3943('0x37')](_0x290cf8[_0x3943('0x34')][_0x3943('0x37')]));_0x939aee['attributes']=_0x939aee['attributes'][_0x3943('0x38')]?_0x939aee[_0x3943('0x36')]:_0x2d6a01['model'];if(_0x290cf8[_0x3943('0x34')][_0x3943('0x43')]){_0x939aee[_0x3943('0x44')]=[{'all':!![]}];}_0x939aee=_['merge']({},_0x939aee,_0x290cf8['options']);return db[_0x3943('0x2f')][_0x3943('0x4b')](_0x939aee)[_0x3943('0x26')](handleEntityNotFound(_0x466959,null))[_0x3943('0x26')](function(_0x3de6f6){if(_0x3de6f6){var _0x248e62=_0x3de6f6[_0x3943('0x4f')]({'plain':!![]});_0x248e62=qs[_0x3943('0x56')](_0x248e62,['id',_0x3943('0x57'),_0x3943('0x58')]);_0x290cf8[_0x3943('0x4d')]=_[_0x3943('0x56')](_0x290cf8['body'],['id',_0x3943('0x57'),'updatedAt']);return db[_0x3943('0x2f')][_0x3943('0x4c')](_[_0x3943('0x3f')](_0x248e62,_0x290cf8[_0x3943('0x4d')]),{'include':_0x290cf8[_0x3943('0x34')][_0x3943('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x3b5311){var _0x41384e=_0x290cf8[_0x3943('0x4e')][_0x3943('0x4f')]({'plain':!![]});if(!_0x41384e)throw new Error(_0x3943('0x50'));if(_0x41384e[_0x3943('0x51')]===_0x3943('0x4e')){var _0x53ea3b=_0x3b5311[_0x3943('0x4f')]({'plain':!![]});var _0x6dca77=_0x3943('0x27');return db['UserProfileSection'][_0x3943('0x4b')]({'where':{'name':_0x6dca77,'userProfileId':_0x41384e['userProfileId']},'raw':!![]})[_0x3943('0x26')](function(_0x2c0899){if(_0x2c0899&&_0x2c0899[_0x3943('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x53ea3b['name'],'resourceId':_0x53ea3b['id'],'type':_0x2c0899['name'],'sectionId':_0x2c0899['id']},{})['then'](function(){return _0x3b5311;});}else{return _0x3b5311;}})[_0x3943('0x47')](function(_0x924f3b){logger['error'](_0x3943('0x59'),_0x924f3b);throw _0x924f3b;});}return _0x3b5311;});}})[_0x3943('0x26')](respondWithResult(_0x466959,0xc9))[_0x3943('0x47')](handleError(_0x466959,null));};exports['update']=function(_0x48e27e,_0x4da8a2){if(_0x48e27e[_0x3943('0x4d')]['id']){delete _0x48e27e[_0x3943('0x4d')]['id'];}return db[_0x3943('0x2f')][_0x3943('0x4b')]({'where':{'id':_0x48e27e[_0x3943('0x49')]['id']}})[_0x3943('0x26')](handleEntityNotFound(_0x4da8a2,null))[_0x3943('0x26')](saveUpdates(_0x48e27e[_0x3943('0x4d')],null))[_0x3943('0x26')](respondWithResult(_0x4da8a2,null))[_0x3943('0x47')](handleError(_0x4da8a2,null));};exports[_0x3943('0x29')]=function(_0x3701bd,_0x34b4a4){return db[_0x3943('0x2f')]['find']({'where':{'id':_0x3701bd[_0x3943('0x49')]['id']}})[_0x3943('0x26')](handleEntityNotFound(_0x34b4a4,null))[_0x3943('0x26')](removeEntity(_0x34b4a4,null))[_0x3943('0x47')](handleError(_0x34b4a4,null));};function widgetAttributes(_0x5596f3){try{switch(_0x5596f3[_0x3943('0x32')]){case _0x3943('0x5a'):return[{'name':_0x3943('0x5b'),'value':_0x5596f3[_0x3943('0x5b')]||(_0x5596f3['attrs']&&_0x5596f3[_0x3943('0x5c')][0x0]?_0x5596f3['attrs'][0x0][_0x3943('0x5d')]:undefined)||_0x3943('0x5e')}];case _0x3943('0x5f'):return[{'name':'attrPath','value':_0x5596f3['attrPath']||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x0]?_0x5596f3['attrs'][0x0][_0x3943('0x5d')]:undefined)||''}];case'clock':return[{'name':_0x3943('0x60'),'value':_0x5596f3[_0x3943('0x60')]||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x0]?_0x5596f3[_0x3943('0x5c')][0x0]['value']:undefined)||_0x3943('0x61')},{'name':'attrTimezone','value':_0x5596f3['attrTimezone']||(_0x5596f3['attrs']&&_0x5596f3[_0x3943('0x5c')][0x1]?_0x5596f3[_0x3943('0x5c')][0x1][_0x3943('0x5d')]:undefined)||_0x3943('0x62')},{'name':_0x3943('0x63'),'value':_0x5596f3['attrFontSize']||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x2]?_0x5596f3[_0x3943('0x5c')][0x2]['value']:undefined)||0xc}];case _0x3943('0x64'):return[{'name':_0x3943('0x65'),'value':_0x5596f3[_0x3943('0x65')]||(_0x5596f3['attrs']&&_0x5596f3[_0x3943('0x5c')][0x0]?_0x5596f3[_0x3943('0x5c')][0x0][_0x3943('0x5d')]:undefined)||_0x3943('0x66')},{'name':_0x3943('0x67'),'value':_0x5596f3[_0x3943('0x67')]||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x1]?_0x5596f3[_0x3943('0x5c')][0x1][_0x3943('0x5d')]:undefined)||[]},{'name':_0x3943('0x63'),'value':_0x5596f3[_0x3943('0x63')]||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x2]?_0x5596f3[_0x3943('0x5c')][0x2][_0x3943('0x5d')]:undefined)||0x14}];case _0x3943('0x68'):case _0x3943('0x69'):return[{'name':_0x3943('0x6a'),'value':_0x5596f3[_0x3943('0x6a')]||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x0]?_0x5596f3['attrs'][0x0]['value']:undefined)||_0x3943('0x66')},{'name':_0x3943('0x6b'),'value':_0x5596f3['attrSerie2']||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x1]?_0x5596f3[_0x3943('0x5c')][0x1]['value']:undefined)||null},{'name':_0x3943('0x6c'),'value':_0x5596f3[_0x3943('0x6c')]||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x2]?_0x5596f3['attrs'][0x2][_0x3943('0x5d')]:undefined)||null},{'name':_0x3943('0x67'),'value':_0x5596f3[_0x3943('0x67')]||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3['attrs'][0x3]?_0x5596f3[_0x3943('0x5c')][0x3][_0x3943('0x5d')]:undefined)||[]}];case _0x3943('0x6d'):return[{'name':'attrReport','type':_0x5596f3[_0x3943('0x6e')]||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3['attrs'][0x0]?_0x5596f3[_0x3943('0x5c')][0x0]['type']:undefined)||null,'value':_0x5596f3['attrReport']||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x0]?_0x5596f3[_0x3943('0x5c')][0x0]['value']:undefined)||null},{'name':_0x3943('0x6f'),'value':_0x5596f3['attrRefresh']||(_0x5596f3[_0x3943('0x5c')]&&_0x5596f3[_0x3943('0x5c')][0x1]?_0x5596f3[_0x3943('0x5c')][0x1][_0x3943('0x5d')]:undefined)||0x0}];default:return[];}}catch(_0x3d4add){logger[_0x3943('0x55')](_0x3943('0x70'),JSON['stringify'](_0x3d4add));return[];}}exports[_0x3943('0x71')]=function(_0x4101f3,_0x9a1a46,_0x52db33){if(_0x4101f3[_0x3943('0x4d')]['id']){delete _0x4101f3[_0x3943('0x4d')]['id'];}return db['Dashboard']['find']({'where':{'id':_0x4101f3[_0x3943('0x49')]['id']}})['then'](handleEntityNotFound(_0x9a1a46,null))[_0x3943('0x26')](function(_0x45f37d){if(_0x45f37d){_0x4101f3[_0x3943('0x4d')]['DashboardId']=_0x45f37d['id'];_0x4101f3[_0x3943('0x4d')]['attrs']=widgetAttributes(_0x4101f3[_0x3943('0x4d')]);return db[_0x3943('0x72')][_0x3943('0x4c')](_0x4101f3[_0x3943('0x4d')]);}})[_0x3943('0x26')](respondWithResult(_0x9a1a46,null))[_0x3943('0x47')](handleError(_0x9a1a46,null));};exports['getItems']=function(_0x4c1ff2,_0x1d4a42,_0x2ac842){var _0x3e9214={};var _0x48a664={};var _0x3c6061;var _0x311605;return db[_0x3943('0x2f')][_0x3943('0x73')]({'where':{'id':_0x4c1ff2[_0x3943('0x49')]['id']}})[_0x3943('0x26')](handleEntityNotFound(_0x1d4a42,null))[_0x3943('0x26')](function(_0x478760){if(_0x478760){_0x3c6061=_0x478760;_0x48a664[_0x3943('0x39')]=_[_0x3943('0x4a')](db[_0x3943('0x72')]['rawAttributes']);_0x48a664[_0x3943('0x34')]=_['keys'](_0x4c1ff2[_0x3943('0x34')]);_0x48a664[_0x3943('0x3c')]=_['intersection'](_0x48a664[_0x3943('0x39')],_0x48a664[_0x3943('0x34')]);_0x3e9214['attributes']=_[_0x3943('0x35')](_0x48a664[_0x3943('0x39')],qs[_0x3943('0x37')](_0x4c1ff2[_0x3943('0x34')][_0x3943('0x37')]));_0x3e9214[_0x3943('0x36')]=_0x3e9214['attributes']['length']?_0x3e9214[_0x3943('0x36')]:_0x48a664['model'];_0x3e9214['order']=qs[_0x3943('0x3b')](_0x4c1ff2[_0x3943('0x34')][_0x3943('0x3b')]);_0x3e9214[_0x3943('0x3e')]=qs[_0x3943('0x3c')](_[_0x3943('0x3d')](_0x4c1ff2[_0x3943('0x34')],_0x48a664['filters']));if(_0x4c1ff2[_0x3943('0x34')][_0x3943('0x41')]){_0x3e9214[_0x3943('0x3e')]=_['merge'](_0x3e9214[_0x3943('0x3e')],{'$or':_[_0x3943('0x2e')](_0x3e9214[_0x3943('0x36')],function(_0x57568d){var _0x2a26e2={};_0x2a26e2[_0x57568d]={'$like':'%'+_0x4c1ff2[_0x3943('0x34')]['filter']+'%'};return _0x2a26e2;})});}_0x3e9214=_[_0x3943('0x3f')]({},_0x3e9214,_0x4c1ff2[_0x3943('0x42')]);return _0x3c6061[_0x3943('0x74')](_0x3e9214);}})['then'](function(_0x5ddeb7){if(_0x5ddeb7){_0x311605=_0x5ddeb7[_0x3943('0x38')];if(!_0x4c1ff2[_0x3943('0x34')]['hasOwnProperty'](_0x3943('0x75'))){_0x3e9214[_0x3943('0x1f')]=qs[_0x3943('0x1f')](_0x4c1ff2['query'][_0x3943('0x1f')]);_0x3e9214[_0x3943('0x1d')]=qs['offset'](_0x4c1ff2[_0x3943('0x34')]['offset']);}return _0x3c6061[_0x3943('0x74')](_0x3e9214);}})[_0x3943('0x26')](function(_0x3b1b1b){if(_0x3b1b1b){return _0x3b1b1b?{'count':_0x311605,'rows':_0x3b1b1b}:null;}})['then'](respondWithResult(_0x1d4a42,null))['catch'](handleError(_0x1d4a42,null));}; \ No newline at end of file +var _0xac98=['where','pick','VIRTUAL','merge','options','includeAll','findAll','rows','catch','params','keys','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','include','updatedAt','omit','body','createdAt','userProfileId','iframe','attrUrl','attrs','value','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrVoiceQueues','attrReport','reportType','attrRefresh','stringify','addItem','DashboardId','findOne','filter','getItems','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./dashboard.socket','register','sendStatus','end','status','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','name','send','index','map','Dashboard','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x87d07d,_0x30e3d2){var _0x503f14=function(_0x58b6b6){while(--_0x58b6b6){_0x87d07d['push'](_0x87d07d['shift']());}};_0x503f14(++_0x30e3d2);}(_0xac98,0xb4));var _0x8ac9=function(_0x3ddfef,_0x294dc2){_0x3ddfef=_0x3ddfef-0x0;var _0x251b30=_0xac98[_0x3ddfef];return _0x251b30;};'use strict';var emlformat=require(_0x8ac9('0x0'));var rimraf=require(_0x8ac9('0x1'));var zipdir=require(_0x8ac9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ac9('0x3'));var moment=require(_0x8ac9('0x4'));var BPromise=require(_0x8ac9('0x5'));var Mustache=require(_0x8ac9('0x6'));var util=require(_0x8ac9('0x7'));var path=require('path');var sox=require(_0x8ac9('0x8'));var csv=require(_0x8ac9('0x9'));var ejs=require(_0x8ac9('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ac9('0xb'));var squel=require(_0x8ac9('0xc'));var crypto=require(_0x8ac9('0xd'));var jsforce=require(_0x8ac9('0xe'));var deskjs=require(_0x8ac9('0xf'));var toCsv=require(_0x8ac9('0x9'));var querystring=require(_0x8ac9('0x10'));var Papa=require(_0x8ac9('0x11'));var Redis=require(_0x8ac9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8ac9('0x13'));var as=require(_0x8ac9('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ac9('0x15'))(_0x8ac9('0x16'));var utils=require(_0x8ac9('0x17'));var config=require(_0x8ac9('0x18'));var licenseUtil=require(_0x8ac9('0x19'));var db=require(_0x8ac9('0x1a'))['db'];config[_0x8ac9('0x1b')]=_['defaults'](config[_0x8ac9('0x1b')],{'host':_0x8ac9('0x1c'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8ac9('0x1b')]));require(_0x8ac9('0x1d'))[_0x8ac9('0x1e')](socket);function respondWithStatusCode(_0x4f5c08,_0x20cb5e){_0x20cb5e=_0x20cb5e||0xcc;return function(_0xb9ee13){if(_0xb9ee13){return _0x4f5c08[_0x8ac9('0x1f')](_0x20cb5e);}return _0x4f5c08['status'](_0x20cb5e)[_0x8ac9('0x20')]();};}function respondWithResult(_0x4970b7,_0x18d1b3){_0x18d1b3=_0x18d1b3||0xc8;return function(_0x9af59d){if(_0x9af59d){return _0x4970b7[_0x8ac9('0x21')](_0x18d1b3)[_0x8ac9('0x22')](_0x9af59d);}};}function respondWithFilteredResult(_0x3cfe5e,_0xa48bd2){return function(_0x196c03){if(_0x196c03){var _0x983257=typeof _0xa48bd2[_0x8ac9('0x23')]==='undefined'&&typeof _0xa48bd2[_0x8ac9('0x24')]===_0x8ac9('0x25');var _0x1395ec=_0x196c03[_0x8ac9('0x26')];var _0x134d6b=_0x983257?0x0:_0xa48bd2[_0x8ac9('0x23')];var _0x40a19a=_0x983257?_0x196c03['count']:_0xa48bd2[_0x8ac9('0x23')]+_0xa48bd2[_0x8ac9('0x24')];var _0x310480;if(_0x40a19a>=_0x1395ec){_0x40a19a=_0x1395ec;_0x310480=0xc8;}else{_0x310480=0xce;}_0x3cfe5e[_0x8ac9('0x21')](_0x310480);return _0x3cfe5e['set'](_0x8ac9('0x27'),_0x134d6b+'-'+_0x40a19a+'/'+_0x1395ec)['json'](_0x196c03);}return null;};}function patchUpdates(_0x3ba239){return function(_0x22646c){try{jsonpatch[_0x8ac9('0x28')](_0x22646c,_0x3ba239,!![]);}catch(_0x592c09){return BPromise[_0x8ac9('0x29')](_0x592c09);}return _0x22646c[_0x8ac9('0x2a')]();};}function saveUpdates(_0xf165a6,_0x3477f1){return function(_0x1e6015){if(_0x1e6015){return _0x1e6015[_0x8ac9('0x2b')](_0xf165a6)[_0x8ac9('0x2c')](function(_0x469b58){return _0x469b58;});}return null;};}function removeEntity(_0x49e085,_0x571718){return function(_0x606ad6){if(_0x606ad6){return _0x606ad6[_0x8ac9('0x2d')]()[_0x8ac9('0x2c')](function(){var _0x345fd5=_0x606ad6[_0x8ac9('0x2e')]({'plain':!![]});var _0x32e6eb=_0x8ac9('0x2f');return db[_0x8ac9('0x30')][_0x8ac9('0x2d')]({'where':{'type':_0x32e6eb,'resourceId':_0x345fd5['id']}})[_0x8ac9('0x2c')](function(){return _0x606ad6;});})[_0x8ac9('0x2c')](function(){_0x49e085[_0x8ac9('0x21')](0xcc)[_0x8ac9('0x20')]();});}};}function handleEntityNotFound(_0x1d4980,_0x213117){return function(_0x51df8d){if(!_0x51df8d){_0x1d4980[_0x8ac9('0x1f')](0x194);}return _0x51df8d;};}function handleError(_0x35580f,_0x2bd002){_0x2bd002=_0x2bd002||0x1f4;return function(_0x2c209e){logger[_0x8ac9('0x31')](_0x2c209e['stack']);if(_0x2c209e[_0x8ac9('0x32')]){delete _0x2c209e[_0x8ac9('0x32')];}_0x35580f['status'](_0x2bd002)[_0x8ac9('0x33')](_0x2c209e);};}exports[_0x8ac9('0x34')]=function(_0x17b3dd,_0x20b174){var _0x1c33d1={},_0x44f696={},_0x326124={'count':0x0,'rows':[]};var _0x4867bb=_[_0x8ac9('0x35')](db[_0x8ac9('0x36')][_0x8ac9('0x37')],function(_0x1756d3){return{'name':_0x1756d3[_0x8ac9('0x38')],'type':_0x1756d3[_0x8ac9('0x39')][_0x8ac9('0x3a')]};});_0x44f696[_0x8ac9('0x3b')]=_['map'](_0x4867bb,_0x8ac9('0x32'));_0x44f696[_0x8ac9('0x3c')]=_['keys'](_0x17b3dd[_0x8ac9('0x3c')]);_0x44f696[_0x8ac9('0x3d')]=_[_0x8ac9('0x3e')](_0x44f696[_0x8ac9('0x3b')],_0x44f696['query']);_0x1c33d1[_0x8ac9('0x3f')]=_[_0x8ac9('0x3e')](_0x44f696[_0x8ac9('0x3b')],qs[_0x8ac9('0x40')](_0x17b3dd[_0x8ac9('0x3c')][_0x8ac9('0x40')]));_0x1c33d1[_0x8ac9('0x3f')]=_0x1c33d1[_0x8ac9('0x3f')][_0x8ac9('0x41')]?_0x1c33d1[_0x8ac9('0x3f')]:_0x44f696[_0x8ac9('0x3b')];if(!_0x17b3dd[_0x8ac9('0x3c')][_0x8ac9('0x42')](_0x8ac9('0x43'))){_0x1c33d1['limit']=qs[_0x8ac9('0x24')](_0x17b3dd[_0x8ac9('0x3c')][_0x8ac9('0x24')]);_0x1c33d1[_0x8ac9('0x23')]=qs['offset'](_0x17b3dd[_0x8ac9('0x3c')][_0x8ac9('0x23')]);}_0x1c33d1[_0x8ac9('0x44')]=qs[_0x8ac9('0x45')](_0x17b3dd[_0x8ac9('0x3c')][_0x8ac9('0x45')]);_0x1c33d1[_0x8ac9('0x46')]=qs[_0x8ac9('0x3d')](_[_0x8ac9('0x47')](_0x17b3dd[_0x8ac9('0x3c')],_0x44f696[_0x8ac9('0x3d')]),_0x4867bb);if(_0x17b3dd[_0x8ac9('0x3c')]['filter']){_0x1c33d1[_0x8ac9('0x46')]=_['merge'](_0x1c33d1[_0x8ac9('0x46')],{'$or':_['map'](_0x4867bb,function(_0x4f017b){if(_0x4f017b['type']!==_0x8ac9('0x48')){var _0x5a9942={};_0x5a9942[_0x4f017b[_0x8ac9('0x32')]]={'$like':'%'+_0x17b3dd[_0x8ac9('0x3c')]['filter']+'%'};return _0x5a9942;}})});}_0x1c33d1=_[_0x8ac9('0x49')]({},_0x1c33d1,_0x17b3dd[_0x8ac9('0x4a')]);var _0x13b46e={'where':_0x1c33d1[_0x8ac9('0x46')]};return db[_0x8ac9('0x36')][_0x8ac9('0x26')](_0x13b46e)[_0x8ac9('0x2c')](function(_0x5ea7ff){_0x326124[_0x8ac9('0x26')]=_0x5ea7ff;if(_0x17b3dd[_0x8ac9('0x3c')][_0x8ac9('0x4b')]){_0x1c33d1['include']=[{'all':!![]}];}return db['Dashboard'][_0x8ac9('0x4c')](_0x1c33d1);})[_0x8ac9('0x2c')](function(_0x156025){_0x326124[_0x8ac9('0x4d')]=_0x156025;return _0x326124;})[_0x8ac9('0x2c')](respondWithFilteredResult(_0x20b174,_0x1c33d1))[_0x8ac9('0x4e')](handleError(_0x20b174,null));};exports['show']=function(_0x8bbd0c,_0x2569b2){var _0xa21727={'raw':![],'where':{'id':_0x8bbd0c[_0x8ac9('0x4f')]['id']}},_0x338d6e={};_0x338d6e['model']=_[_0x8ac9('0x50')](db[_0x8ac9('0x36')][_0x8ac9('0x37')]);_0x338d6e[_0x8ac9('0x3c')]=_[_0x8ac9('0x50')](_0x8bbd0c[_0x8ac9('0x3c')]);_0x338d6e[_0x8ac9('0x3d')]=_[_0x8ac9('0x3e')](_0x338d6e['model'],_0x338d6e['query']);_0xa21727[_0x8ac9('0x3f')]=_[_0x8ac9('0x3e')](_0x338d6e[_0x8ac9('0x3b')],qs[_0x8ac9('0x40')](_0x8bbd0c['query'][_0x8ac9('0x40')]));_0xa21727['attributes']=_0xa21727[_0x8ac9('0x3f')][_0x8ac9('0x41')]?_0xa21727[_0x8ac9('0x3f')]:_0x338d6e[_0x8ac9('0x3b')];if(_0x8bbd0c[_0x8ac9('0x3c')][_0x8ac9('0x4b')]){_0xa21727['include']=[{'all':!![]}];}_0xa21727=_[_0x8ac9('0x49')]({},_0xa21727,_0x8bbd0c[_0x8ac9('0x4a')]);return db[_0x8ac9('0x36')][_0x8ac9('0x51')](_0xa21727)[_0x8ac9('0x2c')](handleEntityNotFound(_0x2569b2,null))['then'](respondWithResult(_0x2569b2,null))[_0x8ac9('0x4e')](handleError(_0x2569b2,null));};exports[_0x8ac9('0x52')]=function(_0x271d76,_0x3ccf28){return db[_0x8ac9('0x36')]['create'](_0x271d76['body'],{})['then'](function(_0x3174ca){var _0xe4dd7a=_0x271d76[_0x8ac9('0x53')][_0x8ac9('0x2e')]({'plain':!![]});if(!_0xe4dd7a)throw new Error(_0x8ac9('0x54'));if(_0xe4dd7a[_0x8ac9('0x55')]===_0x8ac9('0x53')){var _0x88e61d=_0x3174ca[_0x8ac9('0x2e')]({'plain':!![]});var _0x430f11=_0x8ac9('0x2f');return db[_0x8ac9('0x56')][_0x8ac9('0x51')]({'where':{'name':_0x430f11,'userProfileId':_0xe4dd7a['userProfileId']},'raw':!![]})[_0x8ac9('0x2c')](function(_0x31ec80){if(_0x31ec80&&_0x31ec80[_0x8ac9('0x57')]===0x0){return db[_0x8ac9('0x30')][_0x8ac9('0x52')]({'name':_0x88e61d['name'],'resourceId':_0x88e61d['id'],'type':_0x31ec80[_0x8ac9('0x32')],'sectionId':_0x31ec80['id']},{})[_0x8ac9('0x2c')](function(){return _0x3174ca;});}else{return _0x3174ca;}})[_0x8ac9('0x4e')](function(_0x2e4a31){logger[_0x8ac9('0x31')](_0x8ac9('0x58'),_0x2e4a31);throw _0x2e4a31;});}return _0x3174ca;})[_0x8ac9('0x2c')](respondWithResult(_0x3ccf28,0xc9))[_0x8ac9('0x4e')](handleError(_0x3ccf28,null));};exports[_0x8ac9('0x59')]=function(_0x267fc0,_0x32d4dd){var _0x491c18={'where':{'id':_0x267fc0[_0x8ac9('0x4f')]['id']}},_0x481faf={};_0x481faf[_0x8ac9('0x3b')]=_[_0x8ac9('0x50')](db[_0x8ac9('0x36')]['rawAttributes']);_0x491c18[_0x8ac9('0x3f')]=_['intersection'](_0x481faf[_0x8ac9('0x3b')],qs[_0x8ac9('0x40')](_0x267fc0[_0x8ac9('0x3c')]['fields']));_0x491c18[_0x8ac9('0x3f')]=_0x491c18[_0x8ac9('0x3f')][_0x8ac9('0x41')]?_0x491c18[_0x8ac9('0x3f')]:_0x481faf[_0x8ac9('0x3b')];if(_0x267fc0[_0x8ac9('0x3c')][_0x8ac9('0x4b')]){_0x491c18[_0x8ac9('0x5a')]=[{'all':!![]}];}_0x491c18=_['merge']({},_0x491c18,_0x267fc0[_0x8ac9('0x4a')]);return db['Dashboard'][_0x8ac9('0x51')](_0x491c18)[_0x8ac9('0x2c')](handleEntityNotFound(_0x32d4dd,null))[_0x8ac9('0x2c')](function(_0x2dffb7){if(_0x2dffb7){var _0x575dce=_0x2dffb7['get']({'plain':!![]});_0x575dce=qs['omit'](_0x575dce,['id','createdAt',_0x8ac9('0x5b')]);_0x267fc0['body']=_[_0x8ac9('0x5c')](_0x267fc0[_0x8ac9('0x5d')],['id',_0x8ac9('0x5e'),_0x8ac9('0x5b')]);return db[_0x8ac9('0x36')][_0x8ac9('0x52')](_[_0x8ac9('0x49')](_0x575dce,_0x267fc0[_0x8ac9('0x5d')]),{'include':_0x267fc0[_0x8ac9('0x3c')][_0x8ac9('0x4b')]?[{'all':!![]}]:undefined})[_0x8ac9('0x2c')](function(_0x3cd747){var _0x128afa=_0x267fc0[_0x8ac9('0x53')][_0x8ac9('0x2e')]({'plain':!![]});if(!_0x128afa)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x128afa[_0x8ac9('0x55')]===_0x8ac9('0x53')){var _0x450180=_0x3cd747[_0x8ac9('0x2e')]({'plain':!![]});var _0x4aa741=_0x8ac9('0x2f');return db[_0x8ac9('0x56')][_0x8ac9('0x51')]({'where':{'name':_0x4aa741,'userProfileId':_0x128afa[_0x8ac9('0x5f')]},'raw':!![]})[_0x8ac9('0x2c')](function(_0x42fba7){if(_0x42fba7&&_0x42fba7[_0x8ac9('0x57')]===0x0){return db['UserProfileResource'][_0x8ac9('0x52')]({'name':_0x450180['name'],'resourceId':_0x450180['id'],'type':_0x42fba7[_0x8ac9('0x32')],'sectionId':_0x42fba7['id']},{})[_0x8ac9('0x2c')](function(){return _0x3cd747;});}else{return _0x3cd747;}})[_0x8ac9('0x4e')](function(_0x37a9a9){logger[_0x8ac9('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x37a9a9);throw _0x37a9a9;});}return _0x3cd747;});}})['then'](respondWithResult(_0x32d4dd,0xc9))[_0x8ac9('0x4e')](handleError(_0x32d4dd,null));};exports[_0x8ac9('0x2b')]=function(_0xce9e04,_0x888d7e){if(_0xce9e04[_0x8ac9('0x5d')]['id']){delete _0xce9e04[_0x8ac9('0x5d')]['id'];}return db[_0x8ac9('0x36')][_0x8ac9('0x51')]({'where':{'id':_0xce9e04[_0x8ac9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x888d7e,null))[_0x8ac9('0x2c')](saveUpdates(_0xce9e04['body'],null))['then'](respondWithResult(_0x888d7e,null))[_0x8ac9('0x4e')](handleError(_0x888d7e,null));};exports[_0x8ac9('0x2d')]=function(_0x571c93,_0x506d87){return db[_0x8ac9('0x36')][_0x8ac9('0x51')]({'where':{'id':_0x571c93[_0x8ac9('0x4f')]['id']}})[_0x8ac9('0x2c')](handleEntityNotFound(_0x506d87,null))[_0x8ac9('0x2c')](removeEntity(_0x506d87,null))[_0x8ac9('0x4e')](handleError(_0x506d87,null));};function widgetAttributes(_0x3ec058){try{switch(_0x3ec058[_0x8ac9('0x39')]){case _0x8ac9('0x60'):return[{'name':_0x8ac9('0x61'),'value':_0x3ec058[_0x8ac9('0x61')]||(_0x3ec058[_0x8ac9('0x62')]&&_0x3ec058[_0x8ac9('0x62')][0x0]?_0x3ec058[_0x8ac9('0x62')][0x0][_0x8ac9('0x63')]:undefined)||'https://'}];case _0x8ac9('0x64'):return[{'name':_0x8ac9('0x65'),'value':_0x3ec058[_0x8ac9('0x65')]||(_0x3ec058[_0x8ac9('0x62')]&&_0x3ec058[_0x8ac9('0x62')][0x0]?_0x3ec058[_0x8ac9('0x62')][0x0][_0x8ac9('0x63')]:undefined)||''}];case'clock':return[{'name':_0x8ac9('0x66'),'value':_0x3ec058['attrHourFormat']||(_0x3ec058['attrs']&&_0x3ec058[_0x8ac9('0x62')][0x0]?_0x3ec058[_0x8ac9('0x62')][0x0][_0x8ac9('0x63')]:undefined)||_0x8ac9('0x67')},{'name':_0x8ac9('0x68'),'value':_0x3ec058[_0x8ac9('0x68')]||(_0x3ec058['attrs']&&_0x3ec058[_0x8ac9('0x62')][0x1]?_0x3ec058[_0x8ac9('0x62')][0x1][_0x8ac9('0x63')]:undefined)||_0x8ac9('0x69')},{'name':_0x8ac9('0x6a'),'value':_0x3ec058['attrFontSize']||(_0x3ec058['attrs']&&_0x3ec058['attrs'][0x2]?_0x3ec058[_0x8ac9('0x62')][0x2][_0x8ac9('0x63')]:undefined)||0xc}];case _0x8ac9('0x6b'):return[{'name':_0x8ac9('0x6c'),'value':_0x3ec058[_0x8ac9('0x6c')]||(_0x3ec058[_0x8ac9('0x62')]&&_0x3ec058['attrs'][0x0]?_0x3ec058[_0x8ac9('0x62')][0x0][_0x8ac9('0x63')]:undefined)||_0x8ac9('0x6d')},{'name':'attrVoiceQueues','value':_0x3ec058['attrVoiceQueues']||(_0x3ec058['attrs']&&_0x3ec058[_0x8ac9('0x62')][0x1]?_0x3ec058['attrs'][0x1]['value']:undefined)||[]},{'name':_0x8ac9('0x6a'),'value':_0x3ec058[_0x8ac9('0x6a')]||(_0x3ec058[_0x8ac9('0x62')]&&_0x3ec058[_0x8ac9('0x62')][0x2]?_0x3ec058['attrs'][0x2][_0x8ac9('0x63')]:undefined)||0x14}];case _0x8ac9('0x6e'):case _0x8ac9('0x6f'):return[{'name':_0x8ac9('0x70'),'value':_0x3ec058[_0x8ac9('0x70')]||(_0x3ec058[_0x8ac9('0x62')]&&_0x3ec058[_0x8ac9('0x62')][0x0]?_0x3ec058[_0x8ac9('0x62')][0x0]['value']:undefined)||_0x8ac9('0x6d')},{'name':'attrSerie2','value':_0x3ec058[_0x8ac9('0x71')]||(_0x3ec058['attrs']&&_0x3ec058[_0x8ac9('0x62')][0x1]?_0x3ec058[_0x8ac9('0x62')][0x1][_0x8ac9('0x63')]:undefined)||null},{'name':'attrSerie3','value':_0x3ec058[_0x8ac9('0x72')]||(_0x3ec058['attrs']&&_0x3ec058[_0x8ac9('0x62')][0x2]?_0x3ec058[_0x8ac9('0x62')][0x2]['value']:undefined)||null},{'name':_0x8ac9('0x73'),'value':_0x3ec058[_0x8ac9('0x73')]||(_0x3ec058[_0x8ac9('0x62')]&&_0x3ec058[_0x8ac9('0x62')][0x3]?_0x3ec058['attrs'][0x3][_0x8ac9('0x63')]:undefined)||[]}];case'web-report':return[{'name':_0x8ac9('0x74'),'type':_0x3ec058[_0x8ac9('0x75')]||(_0x3ec058['attrs']&&_0x3ec058['attrs'][0x0]?_0x3ec058[_0x8ac9('0x62')][0x0][_0x8ac9('0x39')]:undefined)||null,'value':_0x3ec058['attrReport']||(_0x3ec058[_0x8ac9('0x62')]&&_0x3ec058['attrs'][0x0]?_0x3ec058[_0x8ac9('0x62')][0x0]['value']:undefined)||null},{'name':_0x8ac9('0x76'),'value':_0x3ec058[_0x8ac9('0x76')]||(_0x3ec058[_0x8ac9('0x62')]&&_0x3ec058['attrs'][0x1]?_0x3ec058['attrs'][0x1][_0x8ac9('0x63')]:undefined)||0x0}];default:return[];}}catch(_0x23dbf1){logger[_0x8ac9('0x31')]('widgetAttributes:\x20%s',JSON[_0x8ac9('0x77')](_0x23dbf1));return[];}}exports[_0x8ac9('0x78')]=function(_0x4a9706,_0x59470c,_0x57de72){if(_0x4a9706[_0x8ac9('0x5d')]['id']){delete _0x4a9706[_0x8ac9('0x5d')]['id'];}return db['Dashboard'][_0x8ac9('0x51')]({'where':{'id':_0x4a9706[_0x8ac9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x59470c,null))[_0x8ac9('0x2c')](function(_0x3ae233){if(_0x3ae233){_0x4a9706[_0x8ac9('0x5d')][_0x8ac9('0x79')]=_0x3ae233['id'];_0x4a9706[_0x8ac9('0x5d')][_0x8ac9('0x62')]=widgetAttributes(_0x4a9706[_0x8ac9('0x5d')]);return db['DashboardItem'][_0x8ac9('0x52')](_0x4a9706[_0x8ac9('0x5d')]);}})[_0x8ac9('0x2c')](respondWithResult(_0x59470c,null))[_0x8ac9('0x4e')](handleError(_0x59470c,null));};exports['getItems']=function(_0x3f2cbb,_0x347637,_0x5e1ffa){var _0x1a0e04={};var _0xd48185={};var _0x141bee;var _0x5a45b3;return db[_0x8ac9('0x36')][_0x8ac9('0x7a')]({'where':{'id':_0x3f2cbb[_0x8ac9('0x4f')]['id']}})['then'](handleEntityNotFound(_0x347637,null))[_0x8ac9('0x2c')](function(_0x3a40ad){if(_0x3a40ad){_0x141bee=_0x3a40ad;_0xd48185[_0x8ac9('0x3b')]=_[_0x8ac9('0x50')](db['DashboardItem'][_0x8ac9('0x37')]);_0xd48185['query']=_[_0x8ac9('0x50')](_0x3f2cbb[_0x8ac9('0x3c')]);_0xd48185[_0x8ac9('0x3d')]=_[_0x8ac9('0x3e')](_0xd48185[_0x8ac9('0x3b')],_0xd48185[_0x8ac9('0x3c')]);_0x1a0e04[_0x8ac9('0x3f')]=_[_0x8ac9('0x3e')](_0xd48185[_0x8ac9('0x3b')],qs['fields'](_0x3f2cbb['query']['fields']));_0x1a0e04['attributes']=_0x1a0e04[_0x8ac9('0x3f')]['length']?_0x1a0e04[_0x8ac9('0x3f')]:_0xd48185['model'];_0x1a0e04[_0x8ac9('0x44')]=qs[_0x8ac9('0x45')](_0x3f2cbb['query'][_0x8ac9('0x45')]);_0x1a0e04[_0x8ac9('0x46')]=qs[_0x8ac9('0x3d')](_[_0x8ac9('0x47')](_0x3f2cbb[_0x8ac9('0x3c')],_0xd48185[_0x8ac9('0x3d')]));if(_0x3f2cbb['query']['filter']){_0x1a0e04[_0x8ac9('0x46')]=_[_0x8ac9('0x49')](_0x1a0e04[_0x8ac9('0x46')],{'$or':_['map'](_0x1a0e04['attributes'],function(_0x572750){var _0x80b564={};_0x80b564[_0x572750]={'$like':'%'+_0x3f2cbb[_0x8ac9('0x3c')][_0x8ac9('0x7b')]+'%'};return _0x80b564;})});}_0x1a0e04=_[_0x8ac9('0x49')]({},_0x1a0e04,_0x3f2cbb[_0x8ac9('0x4a')]);return _0x141bee[_0x8ac9('0x7c')](_0x1a0e04);}})[_0x8ac9('0x2c')](function(_0x3d798f){if(_0x3d798f){_0x5a45b3=_0x3d798f['length'];if(!_0x3f2cbb[_0x8ac9('0x3c')][_0x8ac9('0x42')](_0x8ac9('0x43'))){_0x1a0e04[_0x8ac9('0x24')]=qs[_0x8ac9('0x24')](_0x3f2cbb[_0x8ac9('0x3c')]['limit']);_0x1a0e04['offset']=qs['offset'](_0x3f2cbb['query'][_0x8ac9('0x23')]);}return _0x141bee[_0x8ac9('0x7c')](_0x1a0e04);}})['then'](function(_0x28bbab){if(_0x28bbab){return _0x28bbab?{'count':_0x5a45b3,'rows':_0x28bbab}:null;}})[_0x8ac9('0x2c')](respondWithResult(_0x347637,null))[_0x8ac9('0x4e')](handleError(_0x347637,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 8346a53..0a07cf1 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 _0x78c6=['hasOwnProperty','hook','exports','setMaxListeners','save','remove','emit'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x78c6,0x168));var _0x678c=function(_0x5064c6,_0x5c66a7){_0x5064c6=_0x5064c6-0x0;var _0x2b371d=_0x78c6[_0x5064c6];return _0x2b371d;};'use strict';var EventEmitter=require('events');var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0x678c('0x0')](0x0);var events={'afterCreate':_0x678c('0x1'),'afterUpdate':'update','afterDestroy':_0x678c('0x2')};function emitEvent(_0x5339f7){return function(_0x75a6fd,_0x30a6b2,_0x388cc5){DashboardEvents['emit'](_0x5339f7+':'+_0x75a6fd['id'],_0x75a6fd);DashboardEvents[_0x678c('0x3')](_0x5339f7,_0x75a6fd);_0x388cc5(null);};}for(var e in events){if(events[_0x678c('0x4')](e)){var event=events[e];Dashboard[_0x678c('0x5')](e,emitEvent(event));}}module[_0x678c('0x6')]=DashboardEvents; \ No newline at end of file +var _0xc77f=['remove','emit','hasOwnProperty','exports','events','setMaxListeners','save'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc77f,0x1d9));var _0xfc77=function(_0x426711,_0x12264c){_0x426711=_0x426711-0x0;var _0x592991=_0xc77f[_0x426711];return _0x592991;};'use strict';var EventEmitter=require(_0xfc77('0x0'));var Dashboard=require('../../mysqldb')['db']['Dashboard'];var DashboardEvents=new EventEmitter();DashboardEvents[_0xfc77('0x1')](0x0);var events={'afterCreate':_0xfc77('0x2'),'afterUpdate':'update','afterDestroy':_0xfc77('0x3')};function emitEvent(_0x19ff42){return function(_0x321416,_0x5e0034,_0x52a0b4){DashboardEvents['emit'](_0x19ff42+':'+_0x321416['id'],_0x321416);DashboardEvents[_0xfc77('0x4')](_0x19ff42,_0x321416);_0x52a0b4(null);};}for(var e in events){if(events[_0xfc77('0x5')](e)){var event=events[e];Dashboard['hook'](e,emitEvent(event));}}module[_0xfc77('0x6')]=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index e671c73..3a92413 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 _0x8138=['request-promise','path','rimraf','../../config/environment','./dashboard.attributes','exports','Dashboard','lodash','util','api'];(function(_0x462aae,_0x590f4d){var _0x34232b=function(_0x3d9b34){while(--_0x3d9b34){_0x462aae['push'](_0x462aae['shift']());}};_0x34232b(++_0x590f4d);}(_0x8138,0xed));var _0x8813=function(_0x484cac,_0x30ad3a){_0x484cac=_0x484cac-0x0;var _0x1d6e77=_0x8138[_0x484cac];return _0x1d6e77;};'use strict';var _=require(_0x8813('0x0'));var util=require(_0x8813('0x1'));var logger=require('../../config/logger')(_0x8813('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8813('0x3'));var fs=require('fs');var path=require(_0x8813('0x4'));var rimraf=require(_0x8813('0x5'));var config=require(_0x8813('0x6'));var attributes=require(_0x8813('0x7'));module[_0x8813('0x8')]=function(_0x2db205,_0x29da68){return _0x2db205['define'](_0x8813('0x9'),attributes,{'tableName':'dashboards','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cba=['./dashboard.attributes','exports','dashboards','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x232196,_0x3e4ae4){var _0x377951=function(_0x45f13c){while(--_0x45f13c){_0x232196['push'](_0x232196['shift']());}};_0x377951(++_0x3e4ae4);}(_0x0cba,0x18f));var _0xa0cb=function(_0x5d3903,_0x3d6c3e){_0x5d3903=_0x5d3903-0x0;var _0x4b8bc9=_0x0cba[_0x5d3903];return _0x4b8bc9;};'use strict';var _=require(_0xa0cb('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xa0cb('0x1'));var moment=require(_0xa0cb('0x2'));var BPromise=require(_0xa0cb('0x3'));var rp=require(_0xa0cb('0x4'));var fs=require('fs');var path=require(_0xa0cb('0x5'));var rimraf=require(_0xa0cb('0x6'));var config=require(_0xa0cb('0x7'));var attributes=require(_0xa0cb('0x8'));module[_0xa0cb('0x9')]=function(_0x201875,_0x4f6f0c){return _0x201875['define']('Dashboard',attributes,{'tableName':_0xa0cb('0xa'),'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 c3e15e9..3cadde6 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 _0x2b3e=['then','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','./dashboard.socket','register','request'];(function(_0x2a790e,_0x2859c3){var _0x5b7e7a=function(_0x3828a8){while(--_0x3828a8){_0x2a790e['push'](_0x2a790e['shift']());}};_0x5b7e7a(++_0x2859c3);}(_0x2b3e,0x1e9));var _0xe2b3=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x2b3e[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xe2b3('0x0'));var util=require(_0xe2b3('0x1'));var moment=require('moment');var BPromise=require(_0xe2b3('0x2'));var rs=require(_0xe2b3('0x3'));var fs=require('fs');var Redis=require(_0xe2b3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe2b3('0x5'));var logger=require(_0xe2b3('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xe2b3('0x7'));var client=jayson[_0xe2b3('0x8')][_0xe2b3('0x9')]({'port':0x232a});config[_0xe2b3('0xa')]=_[_0xe2b3('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe2b3('0xa')]));require(_0xe2b3('0xc'))[_0xe2b3('0xd')](socket);function respondWithRpcPromise(_0x1c9dc4,_0x121685,_0x2f6592){return new BPromise(function(_0x27628e,_0x1cd7c0){return client[_0xe2b3('0xe')](_0x1c9dc4,_0x2f6592)[_0xe2b3('0xf')](function(_0xea034a){logger[_0xe2b3('0x10')](_0xe2b3('0x11'),_0x121685,_0xe2b3('0x12'));logger[_0xe2b3('0x13')]('Dashboard,\x20%s,\x20%s,\x20%s',_0x121685,_0xe2b3('0x12'),JSON[_0xe2b3('0x14')](_0xea034a));if(_0xea034a['error']){if(_0xea034a[_0xe2b3('0x15')][_0xe2b3('0x16')]===0x1f4){logger[_0xe2b3('0x15')](_0xe2b3('0x11'),_0x121685,_0xea034a[_0xe2b3('0x15')][_0xe2b3('0x17')]);return _0x1cd7c0(_0xea034a[_0xe2b3('0x15')]['message']);}logger[_0xe2b3('0x15')](_0xe2b3('0x11'),_0x121685,_0xea034a[_0xe2b3('0x15')][_0xe2b3('0x17')]);return _0x27628e(_0xea034a['error'][_0xe2b3('0x17')]);}else{logger[_0xe2b3('0x10')](_0xe2b3('0x11'),_0x121685,_0xe2b3('0x12'));_0x27628e(_0xea034a['result'][_0xe2b3('0x17')]);}})['catch'](function(_0x527d0b){logger['error'](_0xe2b3('0x11'),_0x121685,_0x527d0b);_0x1cd7c0(_0x527d0b);});});} \ No newline at end of file +var _0x642b=['redis','socket.io-emitter','./dashboard.socket','register','request','info','Dashboard,\x20%s,\x20%s','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults'];(function(_0x3fa1c7,_0x13d816){var _0x21e45d=function(_0x390c64){while(--_0x390c64){_0x3fa1c7['push'](_0x3fa1c7['shift']());}};_0x21e45d(++_0x13d816);}(_0x642b,0x196));var _0xb642=function(_0x88cd7b,_0x4c884c){_0x88cd7b=_0x88cd7b-0x0;var _0x56fcc8=_0x642b[_0x88cd7b];return _0x56fcc8;};'use strict';var _=require('lodash');var util=require(_0xb642('0x0'));var moment=require(_0xb642('0x1'));var BPromise=require(_0xb642('0x2'));var rs=require(_0xb642('0x3'));var fs=require('fs');var Redis=require(_0xb642('0x4'));var db=require(_0xb642('0x5'))['db'];var utils=require(_0xb642('0x6'));var logger=require(_0xb642('0x7'))(_0xb642('0x8'));var config=require(_0xb642('0x9'));var jayson=require(_0xb642('0xa'));var client=jayson[_0xb642('0xb')][_0xb642('0xc')]({'port':0x232a});config['redis']=_[_0xb642('0xd')](config[_0xb642('0xe')],{'host':'localhost','port':0x18eb});var socket=require(_0xb642('0xf'))(new Redis(config[_0xb642('0xe')]));require(_0xb642('0x10'))[_0xb642('0x11')](socket);function respondWithRpcPromise(_0x376eda,_0x2996c7,_0x5709f4){return new BPromise(function(_0x43600b,_0xf5d7){return client[_0xb642('0x12')](_0x376eda,_0x5709f4)['then'](function(_0x1b94a3){logger[_0xb642('0x13')](_0xb642('0x14'),_0x2996c7,_0xb642('0x15'));logger[_0xb642('0x16')](_0xb642('0x17'),_0x2996c7,'request\x20sent',JSON[_0xb642('0x18')](_0x1b94a3));if(_0x1b94a3['error']){if(_0x1b94a3['error'][_0xb642('0x19')]===0x1f4){logger[_0xb642('0x1a')]('Dashboard,\x20%s,\x20%s',_0x2996c7,_0x1b94a3['error'][_0xb642('0x1b')]);return _0xf5d7(_0x1b94a3['error'][_0xb642('0x1b')]);}logger[_0xb642('0x1a')](_0xb642('0x14'),_0x2996c7,_0x1b94a3[_0xb642('0x1a')][_0xb642('0x1b')]);return _0x43600b(_0x1b94a3[_0xb642('0x1a')][_0xb642('0x1b')]);}else{logger[_0xb642('0x13')]('Dashboard,\x20%s,\x20%s',_0x2996c7,_0xb642('0x15'));_0x43600b(_0x1b94a3[_0xb642('0x1c')][_0xb642('0x1b')]);}})[_0xb642('0x1d')](function(_0x13430a){logger[_0xb642('0x1a')](_0xb642('0x14'),_0x2996c7,_0x13430a);_0xf5d7(_0x13430a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 8673c57..4413dda 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 _0x687e=['dashboard:','./dashboard.events','remove','emit','register','length'];(function(_0xcbec0f,_0x2f7473){var _0x11603f=function(_0x3003a4){while(--_0x3003a4){_0xcbec0f['push'](_0xcbec0f['shift']());}};_0x11603f(++_0x2f7473);}(_0x687e,0x1bd));var _0xe687=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0x687e[_0x46698a];return _0x356db0;};'use strict';var DashboardEvents=require(_0xe687('0x0'));var events=['save',_0xe687('0x1'),'update'];function createListener(_0xad30de,_0x36b1e0){return function(_0x50b922){_0x36b1e0[_0xe687('0x2')](_0xad30de,_0x50b922);};}function removeListener(_0x56cf90,_0x3a47b6){return function(){DashboardEvents['removeListener'](_0x56cf90,_0x3a47b6);};}exports[_0xe687('0x3')]=function(_0x5b724c){for(var _0x1f5a53=0x0,_0x5043e=events[_0xe687('0x4')];_0x1f5a53<_0x5043e;_0x1f5a53++){var _0x29bf0f=events[_0x1f5a53];var _0x325aee=createListener(_0xe687('0x5')+_0x29bf0f,_0x5b724c);DashboardEvents['on'](_0x29bf0f,_0x325aee);}}; \ No newline at end of file +var _0x1f42=['removeListener','register','length','save','remove','update','emit'];(function(_0x99d9e1,_0x5df69e){var _0x30ebcc=function(_0x1ee1a3){while(--_0x1ee1a3){_0x99d9e1['push'](_0x99d9e1['shift']());}};_0x30ebcc(++_0x5df69e);}(_0x1f42,0x192));var _0x21f4=function(_0x33529a,_0x20803e){_0x33529a=_0x33529a-0x0;var _0x163df5=_0x1f42[_0x33529a];return _0x163df5;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x21f4('0x0'),_0x21f4('0x1'),_0x21f4('0x2')];function createListener(_0x229334,_0x4c261b){return function(_0x24dbfb){_0x4c261b[_0x21f4('0x3')](_0x229334,_0x24dbfb);};}function removeListener(_0xaf54c8,_0x1f924f){return function(){DashboardEvents[_0x21f4('0x4')](_0xaf54c8,_0x1f924f);};}exports[_0x21f4('0x5')]=function(_0xa7c5dd){for(var _0x3435ea=0x0,_0x1804e1=events[_0x21f4('0x6')];_0x3435ea<_0x1804e1;_0x3435ea++){var _0x297c4d=events[_0x3435ea];var _0x8e0b25=createListener('dashboard:'+_0x297c4d,_0xa7c5dd);DashboardEvents['on'](_0x297c4d,_0x8e0b25);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 5d6abab..fca7c26 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 _0x819b=['create','clone','put','update','delete','destroy','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./dashboard.controller','get','index','/:id','show','/:id/items','post','isAuthenticated'];(function(_0xfb7317,_0x567424){var _0x22a7f8=function(_0x5313be){while(--_0x5313be){_0xfb7317['push'](_0xfb7317['shift']());}};_0x22a7f8(++_0x567424);}(_0x819b,0xf6));var _0xb819=function(_0xea7461,_0x357cdb){_0xea7461=_0xea7461-0x0;var _0x48a33b=_0x819b[_0xea7461];return _0x48a33b;};'use strict';var multer=require('multer');var util=require(_0xb819('0x0'));var path=require('path');var timeout=require(_0xb819('0x1'));var express=require(_0xb819('0x2'));var router=express[_0xb819('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xb819('0x4'));var config=require(_0xb819('0x5'));var controller=require(_0xb819('0x6'));router[_0xb819('0x7')]('/',auth['isAuthenticated'](),controller[_0xb819('0x8')]);router[_0xb819('0x7')](_0xb819('0x9'),auth['isAuthenticated'](),controller[_0xb819('0xa')]);router[_0xb819('0x7')](_0xb819('0xb'),auth['isAuthenticated'](),controller['getItems']);router[_0xb819('0xc')]('/',auth[_0xb819('0xd')](),controller[_0xb819('0xe')]);router[_0xb819('0xc')]('/:id/clone',auth[_0xb819('0xd')](),controller[_0xb819('0xf')]);router[_0xb819('0xc')]('/:id/items',auth[_0xb819('0xd')](),controller['addItem']);router[_0xb819('0x10')](_0xb819('0x9'),auth[_0xb819('0xd')](),controller[_0xb819('0x11')]);router[_0xb819('0x12')](_0xb819('0x9'),auth[_0xb819('0xd')](),controller[_0xb819('0x13')]);module['exports']=router; \ No newline at end of file +var _0x82c8=['util','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','/:id/items','getItems','post','/:id/clone','addItem','put','delete','destroy','multer'];(function(_0x400215,_0x368418){var _0x34011b=function(_0x37b064){while(--_0x37b064){_0x400215['push'](_0x400215['shift']());}};_0x34011b(++_0x368418);}(_0x82c8,0xfb));var _0x882c=function(_0x938a39,_0x1f2355){_0x938a39=_0x938a39-0x0;var _0x4bc7dd=_0x82c8[_0x938a39];return _0x4bc7dd;};'use strict';var multer=require(_0x882c('0x0'));var util=require(_0x882c('0x1'));var path=require('path');var timeout=require(_0x882c('0x2'));var express=require(_0x882c('0x3'));var router=express['Router']();var fs_extra=require(_0x882c('0x4'));var auth=require(_0x882c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x882c('0x6'));var controller=require(_0x882c('0x7'));router[_0x882c('0x8')]('/',auth[_0x882c('0x9')](),controller[_0x882c('0xa')]);router[_0x882c('0x8')](_0x882c('0xb'),auth['isAuthenticated'](),controller[_0x882c('0xc')]);router[_0x882c('0x8')](_0x882c('0xd'),auth[_0x882c('0x9')](),controller[_0x882c('0xe')]);router['post']('/',auth[_0x882c('0x9')](),controller['create']);router[_0x882c('0xf')](_0x882c('0x10'),auth[_0x882c('0x9')](),controller['clone']);router[_0x882c('0xf')]('/:id/items',auth[_0x882c('0x9')](),controller[_0x882c('0x11')]);router[_0x882c('0x12')](_0x882c('0xb'),auth[_0x882c('0x9')](),controller['update']);router[_0x882c('0x13')](_0x882c('0xb'),auth['isAuthenticated'](),controller[_0x882c('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 33b7b18..227a8c7 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 _0x1967=['parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#2196f3','squel','lodash','exports','STRING','TEXT','long'];(function(_0x28d18d,_0x55896b){var _0x470640=function(_0x57e78b){while(--_0x57e78b){_0x28d18d['push'](_0x28d18d['shift']());}};_0x470640(++_0x55896b);}(_0x1967,0x173));var _0x7196=function(_0x5a8631,_0x162c1b){_0x5a8631=_0x5a8631-0x0;var _0x4e52f9=_0x1967[_0x5a8631];return _0x4e52f9;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x7196('0x0'));var _=require(_0x7196('0x1'));module[_0x7196('0x2')]={'title':{'type':Sequelize[_0x7196('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0x7196('0x3')](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7196('0x4')](_0x7196('0x5')),'get':function(){try{return JSON[_0x7196('0x6')](this[_0x7196('0x7')](_0x7196('0x8')));}catch(_0x5c128f){return[];}},'set':function(_0x36b01e){try{this[_0x7196('0x9')](_0x7196('0x8'),JSON[_0x7196('0xa')](_0x36b01e));}catch(_0x266a6e){this[_0x7196('0x9')]('attrs',JSON[_0x7196('0xa')]([]));}}},'sizeX':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7196('0xb')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7196('0xb')]},'col':{'type':Sequelize[_0x7196('0xb')]},'background':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7196('0x3')],'allowNull':![],'defaultValue':_0x7196('0xc'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7196('0x3')]},'titleFontSize':{'type':Sequelize[_0x7196('0xb')],'defaultValue':0xc}}; \ No newline at end of file +var _0xc1c6=['long','parse','setDataValue','stringify','attrs','INTEGER','#ffffff','sequelize','squel','lodash','STRING','TEXT'];(function(_0x47b498,_0x5260d8){var _0xa96394=function(_0x54903f){while(--_0x54903f){_0x47b498['push'](_0x47b498['shift']());}};_0xa96394(++_0x5260d8);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x568683,_0xa1181f){_0x568683=_0x568683-0x0;var _0x37812c=_0xc1c6[_0x568683];return _0x37812c;};'use strict';var Sequelize=require(_0x6c1c('0x0'));var squel=require(_0x6c1c('0x1'));var _=require(_0x6c1c('0x2'));module['exports']={'title':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x6c1c('0x4')](_0x6c1c('0x5')),'get':function(){try{return JSON[_0x6c1c('0x6')](this['getDataValue']('attrs'));}catch(_0x32af84){return[];}},'set':function(_0x524a6b){try{this[_0x6c1c('0x7')]('attrs',JSON[_0x6c1c('0x8')](_0x524a6b));}catch(_0x2eb1ba){this[_0x6c1c('0x7')](_0x6c1c('0x9'),JSON['stringify']([]));}}},'sizeX':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x6c1c('0xa')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x6c1c('0xa')]},'background':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':_0x6c1c('0xb'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x6c1c('0x3')],'allowNull':![],'defaultValue':'#2196f3','validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x6c1c('0x3')]},'titleFontSize':{'type':Sequelize[_0x6c1c('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 30eb8df..aa113d2 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 _0xdbf0=['destroy','error','stack','name','model','DashboardItem','rawAttributes','query','filters','intersection','attributes','fields','length','include','options','then','catch','find','params','attrUrl','attrs','attrPath','value','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','reject','save','update'];(function(_0x48c2ae,_0x4cea90){var _0x8f7531=function(_0x126458){while(--_0x126458){_0x48c2ae['push'](_0x48c2ae['shift']());}};_0x8f7531(++_0x4cea90);}(_0xdbf0,0x191));var _0x0dbf=function(_0x178e48,_0x3c9509){_0x178e48=_0x178e48-0x0;var _0x440d7e=_0xdbf0[_0x178e48];return _0x440d7e;};'use strict';var emlformat=require(_0x0dbf('0x0'));var rimraf=require(_0x0dbf('0x1'));var zipdir=require(_0x0dbf('0x2'));var jsonpatch=require(_0x0dbf('0x3'));var rp=require(_0x0dbf('0x4'));var moment=require(_0x0dbf('0x5'));var BPromise=require(_0x0dbf('0x6'));var Mustache=require(_0x0dbf('0x7'));var util=require(_0x0dbf('0x8'));var path=require('path');var sox=require(_0x0dbf('0x9'));var csv=require(_0x0dbf('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0dbf('0xb'));var _=require('lodash');var squel=require(_0x0dbf('0xc'));var crypto=require(_0x0dbf('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x0dbf('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0dbf('0xf'));var Papa=require(_0x0dbf('0x10'));var Redis=require(_0x0dbf('0x11'));var authService=require(_0x0dbf('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0dbf('0x13'));var logger=require(_0x0dbf('0x14'))(_0x0dbf('0x15'));var utils=require(_0x0dbf('0x16'));var config=require(_0x0dbf('0x17'));var licenseUtil=require(_0x0dbf('0x18'));var db=require(_0x0dbf('0x19'))['db'];config[_0x0dbf('0x1a')]=_[_0x0dbf('0x1b')](config[_0x0dbf('0x1a')],{'host':_0x0dbf('0x1c'),'port':0x18eb});var socket=require(_0x0dbf('0x1d'))(new Redis(config[_0x0dbf('0x1a')]));require(_0x0dbf('0x1e'))[_0x0dbf('0x1f')](socket);function respondWithStatusCode(_0x53a6c5,_0x527ddc){_0x527ddc=_0x527ddc||0xcc;return function(_0x540b7f){if(_0x540b7f){return _0x53a6c5[_0x0dbf('0x20')](_0x527ddc);}return _0x53a6c5[_0x0dbf('0x21')](_0x527ddc)[_0x0dbf('0x22')]();};}function respondWithResult(_0x44b9b7,_0x52dbdb){_0x52dbdb=_0x52dbdb||0xc8;return function(_0x3f77e7){if(_0x3f77e7){return _0x44b9b7['status'](_0x52dbdb)[_0x0dbf('0x23')](_0x3f77e7);}};}function respondWithFilteredResult(_0x480031,_0x157c29){return function(_0x5da7df){if(_0x5da7df){var _0x5913aa=typeof _0x157c29[_0x0dbf('0x24')]===_0x0dbf('0x25')&&typeof _0x157c29['limit']==='undefined';var _0xc4f880=_0x5da7df[_0x0dbf('0x26')];var _0x33812b=_0x5913aa?0x0:_0x157c29[_0x0dbf('0x24')];var _0x588d2c=_0x5913aa?_0x5da7df['count']:_0x157c29[_0x0dbf('0x24')]+_0x157c29[_0x0dbf('0x27')];var _0x3153be;if(_0x588d2c>=_0xc4f880){_0x588d2c=_0xc4f880;_0x3153be=0xc8;}else{_0x3153be=0xce;}_0x480031[_0x0dbf('0x21')](_0x3153be);return _0x480031[_0x0dbf('0x28')]('Content-Range',_0x33812b+'-'+_0x588d2c+'/'+_0xc4f880)[_0x0dbf('0x23')](_0x5da7df);}return null;};}function patchUpdates(_0x1a5b07){return function(_0x5561c8){try{jsonpatch['apply'](_0x5561c8,_0x1a5b07,!![]);}catch(_0x492579){return BPromise[_0x0dbf('0x29')](_0x492579);}return _0x5561c8[_0x0dbf('0x2a')]();};}function saveUpdates(_0x31e801,_0x49569c){return function(_0x5b5e7c){if(_0x5b5e7c){return _0x5b5e7c[_0x0dbf('0x2b')](_0x31e801)['then'](function(_0x3e776b){return _0x3e776b;});}return null;};}function removeEntity(_0x72c486,_0x325bb2){return function(_0x3fa28a){if(_0x3fa28a){return _0x3fa28a[_0x0dbf('0x2c')]()['then'](function(){_0x72c486[_0x0dbf('0x21')](0xcc)[_0x0dbf('0x22')]();});}};}function handleEntityNotFound(_0x1a892c,_0x442bca){return function(_0x15673f){if(!_0x15673f){_0x1a892c[_0x0dbf('0x20')](0x194);}return _0x15673f;};}function handleError(_0x2fe612,_0xeb513d){_0xeb513d=_0xeb513d||0x1f4;return function(_0x9b4e4a){logger[_0x0dbf('0x2d')](_0x9b4e4a[_0x0dbf('0x2e')]);if(_0x9b4e4a[_0x0dbf('0x2f')]){delete _0x9b4e4a[_0x0dbf('0x2f')];}_0x2fe612['status'](_0xeb513d)['send'](_0x9b4e4a);};}exports['show']=function(_0x448618,_0x17a1f6){var _0x3fa772={'raw':![],'where':{'id':_0x448618['params']['id']}},_0x697dab={};_0x697dab[_0x0dbf('0x30')]=_['keys'](db[_0x0dbf('0x31')][_0x0dbf('0x32')]);_0x697dab[_0x0dbf('0x33')]=_['keys'](_0x448618[_0x0dbf('0x33')]);_0x697dab[_0x0dbf('0x34')]=_[_0x0dbf('0x35')](_0x697dab['model'],_0x697dab[_0x0dbf('0x33')]);_0x3fa772[_0x0dbf('0x36')]=_['intersection'](_0x697dab[_0x0dbf('0x30')],qs[_0x0dbf('0x37')](_0x448618[_0x0dbf('0x33')]['fields']));_0x3fa772['attributes']=_0x3fa772['attributes'][_0x0dbf('0x38')]?_0x3fa772[_0x0dbf('0x36')]:_0x697dab['model'];if(_0x448618[_0x0dbf('0x33')]['includeAll']){_0x3fa772[_0x0dbf('0x39')]=[{'all':!![]}];}_0x3fa772=_['merge']({},_0x3fa772,_0x448618[_0x0dbf('0x3a')]);return db[_0x0dbf('0x31')]['find'](_0x3fa772)[_0x0dbf('0x3b')](handleEntityNotFound(_0x17a1f6,null))['then'](respondWithResult(_0x17a1f6,null))[_0x0dbf('0x3c')](handleError(_0x17a1f6,null));};exports['destroy']=function(_0xa64262,_0x726747){return db['DashboardItem'][_0x0dbf('0x3d')]({'where':{'id':_0xa64262[_0x0dbf('0x3e')]['id']}})[_0x0dbf('0x3b')](handleEntityNotFound(_0x726747,null))[_0x0dbf('0x3b')](removeEntity(_0x726747,null))[_0x0dbf('0x3c')](handleError(_0x726747,null));};function widgetAttributes(_0xd5a2ac){try{switch(_0xd5a2ac['type']){case'iframe':return[{'name':_0x0dbf('0x3f'),'value':_0xd5a2ac['attrUrl']||(_0xd5a2ac['attrs']&&_0xd5a2ac['attrs'][0x0]?_0xd5a2ac[_0x0dbf('0x40')][0x0]['value']:undefined)||'https://'}];case'custom':return[{'name':_0x0dbf('0x41'),'value':_0xd5a2ac['attrPath']||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac[_0x0dbf('0x40')][0x0]?_0xd5a2ac[_0x0dbf('0x40')][0x0][_0x0dbf('0x42')]:undefined)||''}];case'clock':return[{'name':_0x0dbf('0x43'),'value':_0xd5a2ac[_0x0dbf('0x43')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac[_0x0dbf('0x40')][0x0]?_0xd5a2ac[_0x0dbf('0x40')][0x0][_0x0dbf('0x42')]:undefined)||_0x0dbf('0x44')},{'name':_0x0dbf('0x45'),'value':_0xd5a2ac['attrTimezone']||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac['attrs'][0x1]?_0xd5a2ac[_0x0dbf('0x40')][0x1][_0x0dbf('0x42')]:undefined)||_0x0dbf('0x46')},{'name':_0x0dbf('0x47'),'value':_0xd5a2ac[_0x0dbf('0x47')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac['attrs'][0x2]?_0xd5a2ac[_0x0dbf('0x40')][0x2][_0x0dbf('0x42')]:undefined)||0xc}];case _0x0dbf('0x48'):return[{'name':_0x0dbf('0x49'),'value':_0xd5a2ac[_0x0dbf('0x49')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac[_0x0dbf('0x40')][0x0]?_0xd5a2ac[_0x0dbf('0x40')][0x0][_0x0dbf('0x42')]:undefined)||_0x0dbf('0x4a')},{'name':'attrVoiceQueues','value':_0xd5a2ac[_0x0dbf('0x4b')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac[_0x0dbf('0x40')][0x1]?_0xd5a2ac['attrs'][0x1][_0x0dbf('0x42')]:undefined)||[]},{'name':_0x0dbf('0x47'),'value':_0xd5a2ac[_0x0dbf('0x47')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac[_0x0dbf('0x40')][0x2]?_0xd5a2ac[_0x0dbf('0x40')][0x2][_0x0dbf('0x42')]:undefined)||0x14}];case _0x0dbf('0x4c'):case _0x0dbf('0x4d'):return[{'name':_0x0dbf('0x4e'),'value':_0xd5a2ac[_0x0dbf('0x4e')]||(_0xd5a2ac['attrs']&&_0xd5a2ac[_0x0dbf('0x40')][0x0]?_0xd5a2ac[_0x0dbf('0x40')][0x0]['value']:undefined)||_0x0dbf('0x4a')},{'name':_0x0dbf('0x4f'),'value':_0xd5a2ac[_0x0dbf('0x4f')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac['attrs'][0x1]?_0xd5a2ac[_0x0dbf('0x40')][0x1][_0x0dbf('0x42')]:undefined)||null},{'name':_0x0dbf('0x50'),'value':_0xd5a2ac[_0x0dbf('0x50')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac[_0x0dbf('0x40')][0x2]?_0xd5a2ac[_0x0dbf('0x40')][0x2][_0x0dbf('0x42')]:undefined)||null},{'name':_0x0dbf('0x4b'),'value':_0xd5a2ac['attrVoiceQueues']||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac[_0x0dbf('0x40')][0x3]?_0xd5a2ac[_0x0dbf('0x40')][0x3][_0x0dbf('0x42')]:undefined)||[]}];case _0x0dbf('0x51'):return[{'name':_0x0dbf('0x52'),'type':_0xd5a2ac[_0x0dbf('0x53')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac[_0x0dbf('0x40')][0x0]?_0xd5a2ac[_0x0dbf('0x40')][0x0]['type']:undefined)||null,'value':_0xd5a2ac[_0x0dbf('0x52')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac[_0x0dbf('0x40')][0x0]?_0xd5a2ac[_0x0dbf('0x40')][0x0][_0x0dbf('0x42')]:undefined)||null},{'name':_0x0dbf('0x54'),'value':_0xd5a2ac[_0x0dbf('0x54')]||(_0xd5a2ac[_0x0dbf('0x40')]&&_0xd5a2ac['attrs'][0x1]?_0xd5a2ac['attrs'][0x1][_0x0dbf('0x42')]:undefined)||0x0}];default:return[];}}catch(_0x1f07da){logger[_0x0dbf('0x2d')](_0x0dbf('0x55'),JSON[_0x0dbf('0x56')](_0x1f07da));return[];}}exports[_0x0dbf('0x57')]=function(_0x15e682,_0x13df66){if(_0x15e682[_0x0dbf('0x58')]){_0x15e682[_0x0dbf('0x58')]['attrs']=widgetAttributes(_0x15e682[_0x0dbf('0x58')]);}return db[_0x0dbf('0x31')]['create'](_0x15e682[_0x0dbf('0x58')],{})[_0x0dbf('0x3b')](respondWithResult(_0x13df66,0xc9))['catch'](handleError(_0x13df66,null));};exports[_0x0dbf('0x2b')]=function(_0x4c4ce9,_0x53e95a){if(_0x4c4ce9[_0x0dbf('0x58')]['id']){delete _0x4c4ce9[_0x0dbf('0x58')]['id'];}_0x4c4ce9['body'][_0x0dbf('0x40')]=widgetAttributes(_0x4c4ce9[_0x0dbf('0x58')]);return db[_0x0dbf('0x31')][_0x0dbf('0x3d')]({'where':{'id':_0x4c4ce9[_0x0dbf('0x3e')]['id']}})[_0x0dbf('0x3b')](handleEntityNotFound(_0x53e95a,null))[_0x0dbf('0x3b')](saveUpdates(_0x4c4ce9[_0x0dbf('0x58')],null))[_0x0dbf('0x3b')](respondWithResult(_0x53e95a,null))[_0x0dbf('0x3c')](handleError(_0x53e95a,null));}; \ No newline at end of file +var _0xaea0=['find','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrMetric','attrVoiceQueues','multibar-chart','attrSerie1','total','attrSerie2','attrReport','error','stringify','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','lodash','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','then','stack','send','show','params','model','keys','DashboardItem','rawAttributes','query','intersection','attributes','fields','length','includeAll','include','merge','options','catch'];(function(_0x5eae6e,_0x2a1aeb){var _0x217174=function(_0x290527){while(--_0x290527){_0x5eae6e['push'](_0x5eae6e['shift']());}};_0x217174(++_0x2a1aeb);}(_0xaea0,0x165));var _0x0aea=function(_0x36c6eb,_0x4fb127){_0x36c6eb=_0x36c6eb-0x0;var _0x30675b=_0xaea0[_0x36c6eb];return _0x30675b;};'use strict';var emlformat=require(_0x0aea('0x0'));var rimraf=require(_0x0aea('0x1'));var zipdir=require(_0x0aea('0x2'));var jsonpatch=require(_0x0aea('0x3'));var rp=require(_0x0aea('0x4'));var moment=require('moment');var BPromise=require(_0x0aea('0x5'));var Mustache=require(_0x0aea('0x6'));var util=require(_0x0aea('0x7'));var path=require('path');var sox=require(_0x0aea('0x8'));var csv=require('to-csv');var ejs=require(_0x0aea('0x9'));var fs=require('fs');var fs_extra=require(_0x0aea('0xa'));var _=require(_0x0aea('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x0aea('0xc'));var querystring=require(_0x0aea('0xd'));var Papa=require(_0x0aea('0xe'));var Redis=require(_0x0aea('0xf'));var authService=require(_0x0aea('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x0aea('0x11'));var hardwareService=require(_0x0aea('0x12'));var logger=require('../../config/logger')(_0x0aea('0x13'));var utils=require(_0x0aea('0x14'));var config=require(_0x0aea('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0aea('0x16'))['db'];config['redis']=_['defaults'](config[_0x0aea('0x17')],{'host':_0x0aea('0x18'),'port':0x18eb});var socket=require(_0x0aea('0x19'))(new Redis(config[_0x0aea('0x17')]));require('./dashboardItem.socket')['register'](socket);function respondWithStatusCode(_0x3bc2c8,_0x33dc84){_0x33dc84=_0x33dc84||0xcc;return function(_0x2bee61){if(_0x2bee61){return _0x3bc2c8[_0x0aea('0x1a')](_0x33dc84);}return _0x3bc2c8[_0x0aea('0x1b')](_0x33dc84)[_0x0aea('0x1c')]();};}function respondWithResult(_0x51372e,_0x2a4c82){_0x2a4c82=_0x2a4c82||0xc8;return function(_0x2bc986){if(_0x2bc986){return _0x51372e[_0x0aea('0x1b')](_0x2a4c82)['json'](_0x2bc986);}};}function respondWithFilteredResult(_0x2e3915,_0x5543ca){return function(_0x323c02){if(_0x323c02){var _0x590e01=typeof _0x5543ca[_0x0aea('0x1d')]===_0x0aea('0x1e')&&typeof _0x5543ca['limit']===_0x0aea('0x1e');var _0x21d193=_0x323c02[_0x0aea('0x1f')];var _0x4fbb88=_0x590e01?0x0:_0x5543ca[_0x0aea('0x1d')];var _0xd3506a=_0x590e01?_0x323c02['count']:_0x5543ca[_0x0aea('0x1d')]+_0x5543ca[_0x0aea('0x20')];var _0x1fa9e0;if(_0xd3506a>=_0x21d193){_0xd3506a=_0x21d193;_0x1fa9e0=0xc8;}else{_0x1fa9e0=0xce;}_0x2e3915['status'](_0x1fa9e0);return _0x2e3915[_0x0aea('0x21')](_0x0aea('0x22'),_0x4fbb88+'-'+_0xd3506a+'/'+_0x21d193)['json'](_0x323c02);}return null;};}function patchUpdates(_0x382a30){return function(_0x2e55bb){try{jsonpatch[_0x0aea('0x23')](_0x2e55bb,_0x382a30,!![]);}catch(_0x40c058){return BPromise['reject'](_0x40c058);}return _0x2e55bb[_0x0aea('0x24')]();};}function saveUpdates(_0x3d70c4,_0x5dd26a){return function(_0x2bf25b){if(_0x2bf25b){return _0x2bf25b[_0x0aea('0x25')](_0x3d70c4)['then'](function(_0x4c2902){return _0x4c2902;});}return null;};}function removeEntity(_0x168bd7,_0x2fdd6b){return function(_0x3dae13){if(_0x3dae13){return _0x3dae13[_0x0aea('0x26')]()[_0x0aea('0x27')](function(){_0x168bd7[_0x0aea('0x1b')](0xcc)[_0x0aea('0x1c')]();});}};}function handleEntityNotFound(_0x53805c,_0x4e181f){return function(_0x282019){if(!_0x282019){_0x53805c[_0x0aea('0x1a')](0x194);}return _0x282019;};}function handleError(_0x4c81db,_0x3594f0){_0x3594f0=_0x3594f0||0x1f4;return function(_0x2597e8){logger['error'](_0x2597e8[_0x0aea('0x28')]);if(_0x2597e8['name']){delete _0x2597e8['name'];}_0x4c81db[_0x0aea('0x1b')](_0x3594f0)[_0x0aea('0x29')](_0x2597e8);};}exports[_0x0aea('0x2a')]=function(_0x5590a1,_0x4b5065){var _0x52d611={'raw':![],'where':{'id':_0x5590a1[_0x0aea('0x2b')]['id']}},_0x246ca2={};_0x246ca2[_0x0aea('0x2c')]=_[_0x0aea('0x2d')](db[_0x0aea('0x2e')][_0x0aea('0x2f')]);_0x246ca2[_0x0aea('0x30')]=_[_0x0aea('0x2d')](_0x5590a1['query']);_0x246ca2['filters']=_[_0x0aea('0x31')](_0x246ca2[_0x0aea('0x2c')],_0x246ca2[_0x0aea('0x30')]);_0x52d611[_0x0aea('0x32')]=_[_0x0aea('0x31')](_0x246ca2[_0x0aea('0x2c')],qs['fields'](_0x5590a1['query'][_0x0aea('0x33')]));_0x52d611[_0x0aea('0x32')]=_0x52d611['attributes'][_0x0aea('0x34')]?_0x52d611['attributes']:_0x246ca2['model'];if(_0x5590a1[_0x0aea('0x30')][_0x0aea('0x35')]){_0x52d611[_0x0aea('0x36')]=[{'all':!![]}];}_0x52d611=_[_0x0aea('0x37')]({},_0x52d611,_0x5590a1[_0x0aea('0x38')]);return db['DashboardItem']['find'](_0x52d611)[_0x0aea('0x27')](handleEntityNotFound(_0x4b5065,null))[_0x0aea('0x27')](respondWithResult(_0x4b5065,null))[_0x0aea('0x39')](handleError(_0x4b5065,null));};exports[_0x0aea('0x26')]=function(_0x3d6b93,_0x5a3e7d){return db[_0x0aea('0x2e')][_0x0aea('0x3a')]({'where':{'id':_0x3d6b93['params']['id']}})[_0x0aea('0x27')](handleEntityNotFound(_0x5a3e7d,null))[_0x0aea('0x27')](removeEntity(_0x5a3e7d,null))['catch'](handleError(_0x5a3e7d,null));};function widgetAttributes(_0xb1dfdc){try{switch(_0xb1dfdc[_0x0aea('0x3b')]){case _0x0aea('0x3c'):return[{'name':_0x0aea('0x3d'),'value':_0xb1dfdc[_0x0aea('0x3d')]||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc['attrs'][0x0]?_0xb1dfdc[_0x0aea('0x3e')][0x0][_0x0aea('0x3f')]:undefined)||_0x0aea('0x40')}];case _0x0aea('0x41'):return[{'name':_0x0aea('0x42'),'value':_0xb1dfdc[_0x0aea('0x42')]||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc[_0x0aea('0x3e')][0x0]?_0xb1dfdc[_0x0aea('0x3e')][0x0]['value']:undefined)||''}];case _0x0aea('0x43'):return[{'name':_0x0aea('0x44'),'value':_0xb1dfdc[_0x0aea('0x44')]||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc['attrs'][0x0]?_0xb1dfdc['attrs'][0x0][_0x0aea('0x3f')]:undefined)||_0x0aea('0x45')},{'name':_0x0aea('0x46'),'value':_0xb1dfdc[_0x0aea('0x46')]||(_0xb1dfdc['attrs']&&_0xb1dfdc['attrs'][0x1]?_0xb1dfdc[_0x0aea('0x3e')][0x1][_0x0aea('0x3f')]:undefined)||_0x0aea('0x47')},{'name':_0x0aea('0x48'),'value':_0xb1dfdc['attrFontSize']||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc[_0x0aea('0x3e')][0x2]?_0xb1dfdc[_0x0aea('0x3e')][0x2]['value']:undefined)||0xc}];case'counter':return[{'name':_0x0aea('0x49'),'value':_0xb1dfdc[_0x0aea('0x49')]||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc[_0x0aea('0x3e')][0x0]?_0xb1dfdc['attrs'][0x0][_0x0aea('0x3f')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0xb1dfdc[_0x0aea('0x4a')]||(_0xb1dfdc['attrs']&&_0xb1dfdc['attrs'][0x1]?_0xb1dfdc['attrs'][0x1][_0x0aea('0x3f')]:undefined)||[]},{'name':'attrFontSize','value':_0xb1dfdc['attrFontSize']||(_0xb1dfdc['attrs']&&_0xb1dfdc[_0x0aea('0x3e')][0x2]?_0xb1dfdc[_0x0aea('0x3e')][0x2][_0x0aea('0x3f')]:undefined)||0x14}];case _0x0aea('0x4b'):case'pie-chart':return[{'name':_0x0aea('0x4c'),'value':_0xb1dfdc[_0x0aea('0x4c')]||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc[_0x0aea('0x3e')][0x0]?_0xb1dfdc[_0x0aea('0x3e')][0x0]['value']:undefined)||_0x0aea('0x4d')},{'name':_0x0aea('0x4e'),'value':_0xb1dfdc[_0x0aea('0x4e')]||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc[_0x0aea('0x3e')][0x1]?_0xb1dfdc[_0x0aea('0x3e')][0x1]['value']:undefined)||null},{'name':'attrSerie3','value':_0xb1dfdc['attrSerie3']||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc['attrs'][0x2]?_0xb1dfdc[_0x0aea('0x3e')][0x2][_0x0aea('0x3f')]:undefined)||null},{'name':_0x0aea('0x4a'),'value':_0xb1dfdc[_0x0aea('0x4a')]||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc[_0x0aea('0x3e')][0x3]?_0xb1dfdc[_0x0aea('0x3e')][0x3][_0x0aea('0x3f')]:undefined)||[]}];case'web-report':return[{'name':_0x0aea('0x4f'),'type':_0xb1dfdc['reportType']||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc[_0x0aea('0x3e')][0x0]?_0xb1dfdc[_0x0aea('0x3e')][0x0][_0x0aea('0x3b')]:undefined)||null,'value':_0xb1dfdc['attrReport']||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc[_0x0aea('0x3e')][0x0]?_0xb1dfdc['attrs'][0x0][_0x0aea('0x3f')]:undefined)||null},{'name':'attrRefresh','value':_0xb1dfdc['attrRefresh']||(_0xb1dfdc[_0x0aea('0x3e')]&&_0xb1dfdc[_0x0aea('0x3e')][0x1]?_0xb1dfdc[_0x0aea('0x3e')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x2e7010){logger[_0x0aea('0x50')]('widgetAttributes:\x20%s',JSON[_0x0aea('0x51')](_0x2e7010));return[];}}exports['create']=function(_0x49756b,_0x1b6012){if(_0x49756b[_0x0aea('0x52')]){_0x49756b[_0x0aea('0x52')][_0x0aea('0x3e')]=widgetAttributes(_0x49756b['body']);}return db['DashboardItem']['create'](_0x49756b[_0x0aea('0x52')],{})[_0x0aea('0x27')](respondWithResult(_0x1b6012,0xc9))[_0x0aea('0x39')](handleError(_0x1b6012,null));};exports[_0x0aea('0x25')]=function(_0x3652c1,_0x192386){if(_0x3652c1[_0x0aea('0x52')]['id']){delete _0x3652c1[_0x0aea('0x52')]['id'];}_0x3652c1['body'][_0x0aea('0x3e')]=widgetAttributes(_0x3652c1[_0x0aea('0x52')]);return db['DashboardItem'][_0x0aea('0x3a')]({'where':{'id':_0x3652c1[_0x0aea('0x2b')]['id']}})[_0x0aea('0x27')](handleEntityNotFound(_0x192386,null))[_0x0aea('0x27')](saveUpdates(_0x3652c1['body'],null))[_0x0aea('0x27')](respondWithResult(_0x192386,null))[_0x0aea('0x39')](handleError(_0x192386,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index d1a8807..8ba825d 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 _0x3177=['../../mysqldb','DashboardItem','setMaxListeners','update','remove','hasOwnProperty','hook'];(function(_0x7bef6b,_0x48feb5){var _0x254044=function(_0x38ad4f){while(--_0x38ad4f){_0x7bef6b['push'](_0x7bef6b['shift']());}};_0x254044(++_0x48feb5);}(_0x3177,0x149));var _0x7317=function(_0x5a8d3c,_0x449b49){_0x5a8d3c=_0x5a8d3c-0x0;var _0x5450be=_0x3177[_0x5a8d3c];return _0x5450be;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0x7317('0x0'))['db'][_0x7317('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x7317('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x7317('0x3'),'afterDestroy':_0x7317('0x4')};function emitEvent(_0xddfda7){return function(_0x53417a,_0xc458b4,_0x313fb9){DashboardItemEvents['emit'](_0xddfda7+':'+_0x53417a['id'],_0x53417a);DashboardItemEvents['emit'](_0xddfda7,_0x53417a);_0x313fb9(null);};}for(var e in events){if(events[_0x7317('0x5')](e)){var event=events[e];DashboardItem[_0x7317('0x6')](e,emitEvent(event));}}module['exports']=DashboardItemEvents; \ No newline at end of file +var _0x2e7d=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','DashboardItem'];(function(_0x9cfe28,_0x1a335c){var _0x54a1d0=function(_0x46bc02){while(--_0x46bc02){_0x9cfe28['push'](_0x9cfe28['shift']());}};_0x54a1d0(++_0x1a335c);}(_0x2e7d,0x103));var _0xd2e7=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0x2e7d[_0x35885a];return _0xe86249;};'use strict';var EventEmitter=require('events');var DashboardItem=require(_0xd2e7('0x0'))['db'][_0xd2e7('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0xd2e7('0x2')](0x0);var events={'afterCreate':_0xd2e7('0x3'),'afterUpdate':'update','afterDestroy':_0xd2e7('0x4')};function emitEvent(_0x2fc4f5){return function(_0x44e2a1,_0x1d2dc7,_0x500052){DashboardItemEvents[_0xd2e7('0x5')](_0x2fc4f5+':'+_0x44e2a1['id'],_0x44e2a1);DashboardItemEvents['emit'](_0x2fc4f5,_0x44e2a1);_0x500052(null);};}for(var e in events){if(events[_0xd2e7('0x6')](e)){var event=events[e];DashboardItem[_0xd2e7('0x7')](e,emitEvent(event));}}module[_0xd2e7('0x8')]=DashboardItemEvents; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.model.js b/server/api/dashboardItem/dashboardItem.model.js index 35abac2..ce9b846 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 _0xd24f=['path','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0x555eac,_0x3db605){var _0x191b2f=function(_0x1a7a03){while(--_0x1a7a03){_0x555eac['push'](_0x555eac['shift']());}};_0x191b2f(++_0x3db605);}(_0xd24f,0x16e));var _0xfd24=function(_0x4879b8,_0x55569f){_0x4879b8=_0x4879b8-0x0;var _0x34abae=_0xd24f[_0x4879b8];return _0x34abae;};'use strict';var _=require(_0xfd24('0x0'));var util=require(_0xfd24('0x1'));var logger=require(_0xfd24('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfd24('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xfd24('0x4'));module[_0xfd24('0x5')]=function(_0x17d388,_0x1447d9){return _0x17d388[_0xfd24('0x6')](_0xfd24('0x7'),attributes,{'tableName':_0xfd24('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xabfc=['api','path','../../config/environment','./dashboardItem.attributes','exports','define','DashboardItem','dashboard_items','lodash','util','../../config/logger'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xabfc,0x194));var _0xcabf=function(_0x3b711c,_0x4b22dc){_0x3b711c=_0x3b711c-0x0;var _0x2685f0=_0xabfc[_0x3b711c];return _0x2685f0;};'use strict';var _=require(_0xcabf('0x0'));var util=require(_0xcabf('0x1'));var logger=require(_0xcabf('0x2'))(_0xcabf('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xcabf('0x4'));var rimraf=require('rimraf');var config=require(_0xcabf('0x5'));var attributes=require(_0xcabf('0x6'));module[_0xcabf('0x7')]=function(_0x2a7a65,_0x73a9c6){return _0x2a7a65[_0xcabf('0x8')](_0xcabf('0x9'),attributes,{'tableName':_0xcabf('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 e452edc..c4e6189 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 _0xfbdd=['./dashboardItem.socket','register','request','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','info','result','catch','lodash','moment','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter'];(function(_0x3949a7,_0x8ae927){var _0x3bb48c=function(_0x394d03){while(--_0x394d03){_0x3949a7['push'](_0x3949a7['shift']());}};_0x3bb48c(++_0x8ae927);}(_0xfbdd,0x107));var _0xdfbd=function(_0x15f7c3,_0x33c743){_0x15f7c3=_0x15f7c3-0x0;var _0x47301f=_0xfbdd[_0x15f7c3];return _0x47301f;};'use strict';var _=require(_0xdfbd('0x0'));var util=require('util');var moment=require(_0xdfbd('0x1'));var BPromise=require('bluebird');var rs=require(_0xdfbd('0x2'));var fs=require('fs');var Redis=require(_0xdfbd('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xdfbd('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xdfbd('0x5'));var jayson=require(_0xdfbd('0x6'));var client=jayson[_0xdfbd('0x7')]['http']({'port':0x232a});config[_0xdfbd('0x8')]=_[_0xdfbd('0x9')](config[_0xdfbd('0x8')],{'host':_0xdfbd('0xa'),'port':0x18eb});var socket=require(_0xdfbd('0xb'))(new Redis(config['redis']));require(_0xdfbd('0xc'))[_0xdfbd('0xd')](socket);function respondWithRpcPromise(_0x467238,_0x555845,_0x191d6c){return new BPromise(function(_0x4ff732,_0x12e322){return client[_0xdfbd('0xe')](_0x467238,_0x191d6c)['then'](function(_0x3a51aa){logger['info'](_0xdfbd('0xf'),_0x555845,'request\x20sent');logger[_0xdfbd('0x10')](_0xdfbd('0x11'),_0x555845,_0xdfbd('0x12'),JSON['stringify'](_0x3a51aa));if(_0x3a51aa['error']){if(_0x3a51aa['error'][_0xdfbd('0x13')]===0x1f4){logger[_0xdfbd('0x14')]('DashboardItem,\x20%s,\x20%s',_0x555845,_0x3a51aa['error']['message']);return _0x12e322(_0x3a51aa[_0xdfbd('0x14')][_0xdfbd('0x15')]);}logger[_0xdfbd('0x14')](_0xdfbd('0xf'),_0x555845,_0x3a51aa[_0xdfbd('0x14')][_0xdfbd('0x15')]);return _0x4ff732(_0x3a51aa[_0xdfbd('0x14')][_0xdfbd('0x15')]);}else{logger[_0xdfbd('0x16')](_0xdfbd('0xf'),_0x555845,'request\x20sent');_0x4ff732(_0x3a51aa[_0xdfbd('0x17')][_0xdfbd('0x15')]);}})[_0xdfbd('0x18')](function(_0x1423a0){logger[_0xdfbd('0x14')]('DashboardItem,\x20%s,\x20%s',_0x555845,_0x1423a0);_0x12e322(_0x1423a0);});});} \ No newline at end of file +var _0x3681=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','defaults','redis','localhost','socket.io-emitter','./dashboardItem.socket','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch'];(function(_0x2f7db8,_0x38ec21){var _0x1b3566=function(_0x3d5600){while(--_0x3d5600){_0x2f7db8['push'](_0x2f7db8['shift']());}};_0x1b3566(++_0x38ec21);}(_0x3681,0xf0));var _0x1368=function(_0x4c3c94,_0xd18ede){_0x4c3c94=_0x4c3c94-0x0;var _0xa3a025=_0x3681[_0x4c3c94];return _0xa3a025;};'use strict';var _=require('lodash');var util=require(_0x1368('0x0'));var moment=require(_0x1368('0x1'));var BPromise=require(_0x1368('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1368('0x3'));var db=require(_0x1368('0x4'))['db'];var utils=require(_0x1368('0x5'));var logger=require(_0x1368('0x6'))('rpc');var config=require(_0x1368('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1368('0x8')]({'port':0x232a});config['redis']=_[_0x1368('0x9')](config[_0x1368('0xa')],{'host':_0x1368('0xb'),'port':0x18eb});var socket=require(_0x1368('0xc'))(new Redis(config[_0x1368('0xa')]));require(_0x1368('0xd'))['register'](socket);function respondWithRpcPromise(_0x2a8ab7,_0x33c807,_0x4d4b57){return new BPromise(function(_0x3973c4,_0x19c1b0){return client[_0x1368('0xe')](_0x2a8ab7,_0x4d4b57)[_0x1368('0xf')](function(_0x2b8ac5){logger[_0x1368('0x10')](_0x1368('0x11'),_0x33c807,'request\x20sent');logger['debug']('DashboardItem,\x20%s,\x20%s,\x20%s',_0x33c807,_0x1368('0x12'),JSON[_0x1368('0x13')](_0x2b8ac5));if(_0x2b8ac5['error']){if(_0x2b8ac5[_0x1368('0x14')]['code']===0x1f4){logger[_0x1368('0x14')](_0x1368('0x11'),_0x33c807,_0x2b8ac5[_0x1368('0x14')][_0x1368('0x15')]);return _0x19c1b0(_0x2b8ac5[_0x1368('0x14')][_0x1368('0x15')]);}logger[_0x1368('0x14')](_0x1368('0x11'),_0x33c807,_0x2b8ac5[_0x1368('0x14')][_0x1368('0x15')]);return _0x3973c4(_0x2b8ac5[_0x1368('0x14')][_0x1368('0x15')]);}else{logger['info'](_0x1368('0x11'),_0x33c807,_0x1368('0x12'));_0x3973c4(_0x2b8ac5[_0x1368('0x16')]['message']);}})[_0x1368('0x17')](function(_0x3f6509){logger[_0x1368('0x14')](_0x1368('0x11'),_0x33c807,_0x3f6509);_0x19c1b0(_0x3f6509);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 917dd12..0eab7f7 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 _0xb72c=['removeListener','register','length','dashboardItem:','./dashboardItem.events','save','update','emit'];(function(_0x247ab5,_0x112b9d){var _0x3e7944=function(_0x20ef98){while(--_0x20ef98){_0x247ab5['push'](_0x247ab5['shift']());}};_0x3e7944(++_0x112b9d);}(_0xb72c,0x12c));var _0xcb72=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb72c[_0x3dd15e];return _0x231fd0;};'use strict';var DashboardItemEvents=require(_0xcb72('0x0'));var events=[_0xcb72('0x1'),'remove',_0xcb72('0x2')];function createListener(_0x545dc4,_0x4533af){return function(_0x18ca51){_0x4533af[_0xcb72('0x3')](_0x545dc4,_0x18ca51);};}function removeListener(_0x112ff0,_0x24d453){return function(){DashboardItemEvents[_0xcb72('0x4')](_0x112ff0,_0x24d453);};}exports[_0xcb72('0x5')]=function(_0x4037c){for(var _0x4a5b15=0x0,_0x38c7a8=events[_0xcb72('0x6')];_0x4a5b15<_0x38c7a8;_0x4a5b15++){var _0x5d9202=events[_0x4a5b15];var _0x3a453d=createListener(_0xcb72('0x7')+_0x5d9202,_0x4037c);DashboardItemEvents['on'](_0x5d9202,_0x3a453d);}}; \ No newline at end of file +var _0x03ae=['emit','removeListener','length','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x1b1510,_0x1db2ca){var _0x31d7d0=function(_0x444baa){while(--_0x444baa){_0x1b1510['push'](_0x1b1510['shift']());}};_0x31d7d0(++_0x1db2ca);}(_0x03ae,0x10e));var _0xe03a=function(_0x39096d,_0x51f8a0){_0x39096d=_0x39096d-0x0;var _0x13da4f=_0x03ae[_0x39096d];return _0x13da4f;};'use strict';var DashboardItemEvents=require(_0xe03a('0x0'));var events=[_0xe03a('0x1'),'remove',_0xe03a('0x2')];function createListener(_0x3d302e,_0xaad9e9){return function(_0x292998){_0xaad9e9[_0xe03a('0x3')](_0x3d302e,_0x292998);};}function removeListener(_0x57d168,_0x55a4e5){return function(){DashboardItemEvents[_0xe03a('0x4')](_0x57d168,_0x55a4e5);};}exports['register']=function(_0x4c5ecf){for(var _0x5dc2b3=0x0,_0x356cdf=events[_0xe03a('0x5')];_0x5dc2b3<_0x356cdf;_0x5dc2b3++){var _0x4c928e=events[_0x5dc2b3];var _0x4314e2=createListener(_0xe03a('0x6')+_0x4c928e,_0x4c5ecf);DashboardItemEvents['on'](_0x4c928e,_0x4314e2);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index 5d75ba3..fd8db3a 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 _0xa9f1=['create','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','show','isAuthenticated'];(function(_0x5bf4fd,_0x5823f0){var _0x5be488=function(_0x1bb20e){while(--_0x1bb20e){_0x5bf4fd['push'](_0x5bf4fd['shift']());}};_0x5be488(++_0x5823f0);}(_0xa9f1,0x194));var _0x1a9f=function(_0x231d55,_0x164460){_0x231d55=_0x231d55-0x0;var _0xdecc44=_0xa9f1[_0x231d55];return _0xdecc44;};'use strict';var multer=require(_0x1a9f('0x0'));var util=require(_0x1a9f('0x1'));var path=require(_0x1a9f('0x2'));var timeout=require(_0x1a9f('0x3'));var express=require(_0x1a9f('0x4'));var router=express[_0x1a9f('0x5')]();var fs_extra=require(_0x1a9f('0x6'));var auth=require(_0x1a9f('0x7'));var interaction=require(_0x1a9f('0x8'));var config=require(_0x1a9f('0x9'));var controller=require(_0x1a9f('0xa'));router[_0x1a9f('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x1a9f('0xc')]);router['post']('/',auth[_0x1a9f('0xd')](),controller[_0x1a9f('0xe')]);router[_0x1a9f('0xf')]('/:id',auth['isAuthenticated'](),controller[_0x1a9f('0x10')]);router[_0x1a9f('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1a9f('0x12')]=router; \ No newline at end of file +var _0x4922=['exports','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','isAuthenticated','show','post','put','delete'];(function(_0x4aa52a,_0x25cce6){var _0x43840c=function(_0x5b70b1){while(--_0x5b70b1){_0x4aa52a['push'](_0x4aa52a['shift']());}};_0x43840c(++_0x25cce6);}(_0x4922,0x1cf));var _0x2492=function(_0x3d2810,_0x22f3ba){_0x3d2810=_0x3d2810-0x0;var _0x3ea966=_0x4922[_0x3d2810];return _0x3ea966;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2492('0x0'));var express=require('express');var router=express[_0x2492('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0x2492('0x2'));var interaction=require(_0x2492('0x3'));var config=require(_0x2492('0x4'));var controller=require(_0x2492('0x5'));router[_0x2492('0x6')](_0x2492('0x7'),auth[_0x2492('0x8')](),controller[_0x2492('0x9')]);router[_0x2492('0xa')]('/',auth[_0x2492('0x8')](),controller['create']);router[_0x2492('0xb')](_0x2492('0x7'),auth[_0x2492('0x8')](),controller['update']);router[_0x2492('0xc')](_0x2492('0x7'),auth['isAuthenticated'](),controller['destroy']);module[_0x2492('0xd')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index 9fb5e46..9dbc4bf 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 _0xa5bd=['third','first','sequelize','exports','STRING','ENUM','second'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0xa5bd,0x95));var _0xda5b=function(_0x5d2cf3,_0x16bfd2){_0x5d2cf3=_0x5d2cf3-0x0;var _0x45a3fc=_0xa5bd[_0x5d2cf3];return _0x45a3fc;};'use strict';var Sequelize=require(_0xda5b('0x0'));module[_0xda5b('0x1')]={'name':{'type':Sequelize[_0xda5b('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xda5b('0x3')]('first',_0xda5b('0x4'),_0xda5b('0x5')),'allowNull':![],'defaultValue':_0xda5b('0x6')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3c1e=['STRING','first','second','third','sequelize','exports'];(function(_0x337e1b,_0x34e77f){var _0x1de6fb=function(_0x70eda3){while(--_0x70eda3){_0x337e1b['push'](_0x337e1b['shift']());}};_0x1de6fb(++_0x34e77f);}(_0x3c1e,0x12a));var _0xe3c1=function(_0x4ad803,_0x248e18){_0x4ad803=_0x4ad803-0x0;var _0x5e1194=_0x3c1e[_0x4ad803];return _0x5e1194;};'use strict';var Sequelize=require(_0xe3c1('0x0'));module[_0xe3c1('0x1')]={'name':{'type':Sequelize[_0xe3c1('0x2')],'allowNull':![]},'level':{'type':Sequelize['ENUM'](_0xe3c1('0x3'),_0xe3c1('0x4'),_0xe3c1('0x5')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xe3c1('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 5d19188..0ba6f67 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 _0x2db5=['Content-Range','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','name','index','map','rawAttributes','type','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','Disposition','includeAll','include','rows','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','find','rimraf','request-promise','bluebird','util','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','count','set'];(function(_0x314079,_0x2b98a0){var _0x423351=function(_0x501dcc){while(--_0x501dcc){_0x314079['push'](_0x314079['shift']());}};_0x423351(++_0x2b98a0);}(_0x2db5,0x168));var _0x52db=function(_0x197065,_0x2e79d0){_0x197065=_0x197065-0x0;var _0x3d9404=_0x2db5[_0x197065];return _0x3d9404;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x52db('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x52db('0x1'));var moment=require('moment');var BPromise=require(_0x52db('0x2'));var Mustache=require('mustache');var util=require(_0x52db('0x3'));var path=require('path');var sox=require(_0x52db('0x4'));var csv=require('to-csv');var ejs=require(_0x52db('0x5'));var fs=require('fs');var fs_extra=require(_0x52db('0x6'));var _=require(_0x52db('0x7'));var squel=require(_0x52db('0x8'));var crypto=require(_0x52db('0x9'));var jsforce=require(_0x52db('0xa'));var deskjs=require(_0x52db('0xb'));var toCsv=require(_0x52db('0xc'));var querystring=require(_0x52db('0xd'));var Papa=require('papaparse');var Redis=require(_0x52db('0xe'));var authService=require(_0x52db('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x52db('0x10'));var logger=require(_0x52db('0x11'))(_0x52db('0x12'));var utils=require(_0x52db('0x13'));var config=require(_0x52db('0x14'));var licenseUtil=require(_0x52db('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3423fd,_0x2a698b){_0x2a698b=_0x2a698b||0xcc;return function(_0x464621){if(_0x464621){return _0x3423fd[_0x52db('0x16')](_0x2a698b);}return _0x3423fd['status'](_0x2a698b)[_0x52db('0x17')]();};}function respondWithResult(_0x5bae38,_0x561cf7){_0x561cf7=_0x561cf7||0xc8;return function(_0x47b21d){if(_0x47b21d){return _0x5bae38[_0x52db('0x18')](_0x561cf7)[_0x52db('0x19')](_0x47b21d);}};}function respondWithFilteredResult(_0x565e6c,_0x2a9c89){return function(_0x133747){if(_0x133747){var _0x491023=typeof _0x2a9c89[_0x52db('0x1a')]===_0x52db('0x1b')&&typeof _0x2a9c89['limit']==='undefined';var _0x4f280c=_0x133747['count'];var _0x4efee7=_0x491023?0x0:_0x2a9c89[_0x52db('0x1a')];var _0x49c6d8=_0x491023?_0x133747[_0x52db('0x1c')]:_0x2a9c89[_0x52db('0x1a')]+_0x2a9c89['limit'];var _0xf54426;if(_0x49c6d8>=_0x4f280c){_0x49c6d8=_0x4f280c;_0xf54426=0xc8;}else{_0xf54426=0xce;}_0x565e6c['status'](_0xf54426);return _0x565e6c[_0x52db('0x1d')](_0x52db('0x1e'),_0x4efee7+'-'+_0x49c6d8+'/'+_0x4f280c)[_0x52db('0x19')](_0x133747);}return null;};}function patchUpdates(_0xf3bd26){return function(_0x57d4c8){try{jsonpatch[_0x52db('0x1f')](_0x57d4c8,_0xf3bd26,!![]);}catch(_0x326cb7){return BPromise[_0x52db('0x20')](_0x326cb7);}return _0x57d4c8[_0x52db('0x21')]();};}function saveUpdates(_0x53b6b1,_0x31ef34){return function(_0x47034f){if(_0x47034f){return _0x47034f[_0x52db('0x22')](_0x53b6b1)[_0x52db('0x23')](function(_0x446ac0){return _0x446ac0;});}return null;};}function removeEntity(_0xcfdef8,_0x2e967a){return function(_0x44668b){if(_0x44668b){return _0x44668b[_0x52db('0x24')]()[_0x52db('0x23')](function(){var _0x24d395=_0x44668b[_0x52db('0x25')]({'plain':!![]});var _0x57d8c6=_0x52db('0x26');return db[_0x52db('0x27')][_0x52db('0x24')]({'where':{'type':_0x57d8c6,'resourceId':_0x24d395['id']}})[_0x52db('0x23')](function(){return _0x44668b;});})[_0x52db('0x23')](function(){_0xcfdef8['status'](0xcc)[_0x52db('0x17')]();});}};}function handleEntityNotFound(_0x3dac3a,_0x193a03){return function(_0x574d27){if(!_0x574d27){_0x3dac3a['sendStatus'](0x194);}return _0x574d27;};}function handleError(_0x439bc5,_0x52c318){_0x52c318=_0x52c318||0x1f4;return function(_0x13c7c6){logger[_0x52db('0x28')](_0x13c7c6['stack']);if(_0x13c7c6[_0x52db('0x29')]){delete _0x13c7c6[_0x52db('0x29')];}_0x439bc5[_0x52db('0x18')](_0x52c318)['send'](_0x13c7c6);};}exports[_0x52db('0x2a')]=function(_0x96c2c5,_0x50b94c){var _0x347264={},_0x41a006={},_0x33cd9d={'count':0x0,'rows':[]};var _0x3442fe=_[_0x52db('0x2b')](db['Disposition'][_0x52db('0x2c')],function(_0x57f2c7){return{'name':_0x57f2c7['fieldName'],'type':_0x57f2c7[_0x52db('0x2d')]['key']};});_0x41a006['model']=_[_0x52db('0x2b')](_0x3442fe,_0x52db('0x29'));_0x41a006[_0x52db('0x2e')]=_[_0x52db('0x2f')](_0x96c2c5[_0x52db('0x2e')]);_0x41a006[_0x52db('0x30')]=_[_0x52db('0x31')](_0x41a006[_0x52db('0x32')],_0x41a006[_0x52db('0x2e')]);_0x347264[_0x52db('0x33')]=_['intersection'](_0x41a006[_0x52db('0x32')],qs[_0x52db('0x34')](_0x96c2c5[_0x52db('0x2e')]['fields']));_0x347264[_0x52db('0x33')]=_0x347264[_0x52db('0x33')][_0x52db('0x35')]?_0x347264['attributes']:_0x41a006[_0x52db('0x32')];if(!_0x96c2c5['query'][_0x52db('0x36')](_0x52db('0x37'))){_0x347264[_0x52db('0x38')]=qs[_0x52db('0x38')](_0x96c2c5[_0x52db('0x2e')]['limit']);_0x347264[_0x52db('0x1a')]=qs[_0x52db('0x1a')](_0x96c2c5['query'][_0x52db('0x1a')]);}_0x347264[_0x52db('0x39')]=qs[_0x52db('0x3a')](_0x96c2c5[_0x52db('0x2e')]['sort']);_0x347264[_0x52db('0x3b')]=qs['filters'](_[_0x52db('0x3c')](_0x96c2c5[_0x52db('0x2e')],_0x41a006[_0x52db('0x30')]),_0x3442fe);if(_0x96c2c5[_0x52db('0x2e')][_0x52db('0x3d')]){_0x347264['where']=_[_0x52db('0x3e')](_0x347264['where'],{'$or':_[_0x52db('0x2b')](_0x3442fe,function(_0x4828f9){if(_0x4828f9[_0x52db('0x2d')]!==_0x52db('0x3f')){var _0x1928fc={};_0x1928fc[_0x4828f9[_0x52db('0x29')]]={'$like':'%'+_0x96c2c5[_0x52db('0x2e')][_0x52db('0x3d')]+'%'};return _0x1928fc;}})});}_0x347264=_[_0x52db('0x3e')]({},_0x347264,_0x96c2c5[_0x52db('0x40')]);var _0x405de0={'where':_0x347264[_0x52db('0x3b')]};return db[_0x52db('0x41')][_0x52db('0x1c')](_0x405de0)['then'](function(_0x40fe58){_0x33cd9d['count']=_0x40fe58;if(_0x96c2c5[_0x52db('0x2e')][_0x52db('0x42')]){_0x347264[_0x52db('0x43')]=[{'all':!![]}];}return db[_0x52db('0x41')]['findAll'](_0x347264);})[_0x52db('0x23')](function(_0x45d66b){_0x33cd9d[_0x52db('0x44')]=_0x45d66b;return _0x33cd9d;})[_0x52db('0x23')](respondWithFilteredResult(_0x50b94c,_0x347264))['catch'](handleError(_0x50b94c,null));};exports['show']=function(_0x2eff70,_0x13cb59){var _0x100394={'raw':!![],'where':{'id':_0x2eff70[_0x52db('0x45')]['id']}},_0x1f8d64={};_0x1f8d64['model']=_[_0x52db('0x2f')](db[_0x52db('0x41')][_0x52db('0x2c')]);_0x1f8d64[_0x52db('0x2e')]=_[_0x52db('0x2f')](_0x2eff70[_0x52db('0x2e')]);_0x1f8d64[_0x52db('0x30')]=_['intersection'](_0x1f8d64[_0x52db('0x32')],_0x1f8d64['query']);_0x100394[_0x52db('0x33')]=_[_0x52db('0x31')](_0x1f8d64[_0x52db('0x32')],qs[_0x52db('0x34')](_0x2eff70[_0x52db('0x2e')][_0x52db('0x34')]));_0x100394[_0x52db('0x33')]=_0x100394['attributes'][_0x52db('0x35')]?_0x100394[_0x52db('0x33')]:_0x1f8d64['model'];if(_0x2eff70[_0x52db('0x2e')]['includeAll']){_0x100394['include']=[{'all':!![]}];}_0x100394=_[_0x52db('0x3e')]({},_0x100394,_0x2eff70[_0x52db('0x40')]);return db[_0x52db('0x41')]['find'](_0x100394)['then'](handleEntityNotFound(_0x13cb59,null))[_0x52db('0x23')](respondWithResult(_0x13cb59,null))['catch'](handleError(_0x13cb59,null));};exports[_0x52db('0x46')]=function(_0x44efb5,_0x146143){return db[_0x52db('0x41')]['create'](_0x44efb5[_0x52db('0x47')],{})[_0x52db('0x23')](function(_0x52f635){var _0x125623=_0x44efb5[_0x52db('0x48')][_0x52db('0x25')]({'plain':!![]});if(!_0x125623)throw new Error(_0x52db('0x49'));if(_0x125623[_0x52db('0x4a')]===_0x52db('0x48')){var _0x2b5d67=_0x52f635['get']({'plain':!![]});var _0x32aa6b=_0x52db('0x26');return db['UserProfileSection']['find']({'where':{'name':_0x32aa6b,'userProfileId':_0x125623['userProfileId']},'raw':!![]})[_0x52db('0x23')](function(_0x35987b){if(_0x35987b&&_0x35987b['autoAssociation']===0x0){return db[_0x52db('0x27')][_0x52db('0x46')]({'name':_0x2b5d67[_0x52db('0x29')],'resourceId':_0x2b5d67['id'],'type':_0x35987b[_0x52db('0x29')],'sectionId':_0x35987b['id']},{})[_0x52db('0x23')](function(){return _0x52f635;});}else{return _0x52f635;}})['catch'](function(_0x5445fc){logger['error'](_0x52db('0x4b'),_0x5445fc);throw _0x5445fc;});}return _0x52f635;})[_0x52db('0x23')](respondWithResult(_0x146143,0xc9))[_0x52db('0x4c')](handleError(_0x146143,null));};exports[_0x52db('0x22')]=function(_0x551913,_0x50c4ad){if(_0x551913[_0x52db('0x47')]['id']){delete _0x551913[_0x52db('0x47')]['id'];}return db[_0x52db('0x41')][_0x52db('0x4d')]({'where':{'id':_0x551913[_0x52db('0x45')]['id']}})[_0x52db('0x23')](handleEntityNotFound(_0x50c4ad,null))[_0x52db('0x23')](saveUpdates(_0x551913[_0x52db('0x47')],null))['then'](respondWithResult(_0x50c4ad,null))[_0x52db('0x4c')](handleError(_0x50c4ad,null));};exports['destroy']=function(_0x38c2c4,_0x5b5a70){return db[_0x52db('0x41')][_0x52db('0x4d')]({'where':{'id':_0x38c2c4['params']['id']}})[_0x52db('0x23')](handleEntityNotFound(_0x5b5a70,null))['then'](removeEntity(_0x5b5a70,null))[_0x52db('0x4c')](handleError(_0x5b5a70,null));}; \ No newline at end of file +var _0x55fd=['sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','count','set','json','apply','reject','save','update','then','destroy','get','Dispositions','UserProfileResource','error','stack','name','send','index','map','Disposition','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order'];(function(_0x5f34fd,_0x580546){var _0x2cd892=function(_0xeaf7f2){while(--_0xeaf7f2){_0x5f34fd['push'](_0x5f34fd['shift']());}};_0x2cd892(++_0x580546);}(_0x55fd,0xbf));var _0xd55f=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x55fd[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0xd55f('0x0'));var rimraf=require(_0xd55f('0x1'));var zipdir=require(_0xd55f('0x2'));var jsonpatch=require(_0xd55f('0x3'));var rp=require('request-promise');var moment=require(_0xd55f('0x4'));var BPromise=require(_0xd55f('0x5'));var Mustache=require('mustache');var util=require(_0xd55f('0x6'));var path=require('path');var sox=require(_0xd55f('0x7'));var csv=require(_0xd55f('0x8'));var ejs=require(_0xd55f('0x9'));var fs=require('fs');var fs_extra=require(_0xd55f('0xa'));var _=require(_0xd55f('0xb'));var squel=require('squel');var crypto=require(_0xd55f('0xc'));var jsforce=require(_0xd55f('0xd'));var deskjs=require(_0xd55f('0xe'));var toCsv=require(_0xd55f('0x8'));var querystring=require(_0xd55f('0xf'));var Papa=require('papaparse');var Redis=require(_0xd55f('0x10'));var authService=require(_0xd55f('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd55f('0x12'));var hardwareService=require(_0xd55f('0x13'));var logger=require(_0xd55f('0x14'))(_0xd55f('0x15'));var utils=require('../../config/utils');var config=require(_0xd55f('0x16'));var licenseUtil=require(_0xd55f('0x17'));var db=require(_0xd55f('0x18'))['db'];function respondWithStatusCode(_0xe89eee,_0x19fd36){_0x19fd36=_0x19fd36||0xcc;return function(_0x5b1a76){if(_0x5b1a76){return _0xe89eee[_0xd55f('0x19')](_0x19fd36);}return _0xe89eee[_0xd55f('0x1a')](_0x19fd36)[_0xd55f('0x1b')]();};}function respondWithResult(_0x5eacba,_0x5d2970){_0x5d2970=_0x5d2970||0xc8;return function(_0x20cc63){if(_0x20cc63){return _0x5eacba['status'](_0x5d2970)['json'](_0x20cc63);}};}function respondWithFilteredResult(_0x3435f4,_0x4e4981){return function(_0x42a5af){if(_0x42a5af){var _0x11862e=typeof _0x4e4981[_0xd55f('0x1c')]==='undefined'&&typeof _0x4e4981[_0xd55f('0x1d')]==='undefined';var _0x24d103=_0x42a5af[_0xd55f('0x1e')];var _0x13ca08=_0x11862e?0x0:_0x4e4981[_0xd55f('0x1c')];var _0x2b0ee5=_0x11862e?_0x42a5af['count']:_0x4e4981[_0xd55f('0x1c')]+_0x4e4981[_0xd55f('0x1d')];var _0x223184;if(_0x2b0ee5>=_0x24d103){_0x2b0ee5=_0x24d103;_0x223184=0xc8;}else{_0x223184=0xce;}_0x3435f4[_0xd55f('0x1a')](_0x223184);return _0x3435f4[_0xd55f('0x1f')]('Content-Range',_0x13ca08+'-'+_0x2b0ee5+'/'+_0x24d103)[_0xd55f('0x20')](_0x42a5af);}return null;};}function patchUpdates(_0x46a929){return function(_0x379527){try{jsonpatch[_0xd55f('0x21')](_0x379527,_0x46a929,!![]);}catch(_0x324a3b){return BPromise[_0xd55f('0x22')](_0x324a3b);}return _0x379527[_0xd55f('0x23')]();};}function saveUpdates(_0x55469e,_0x568ab6){return function(_0x27ee9d){if(_0x27ee9d){return _0x27ee9d[_0xd55f('0x24')](_0x55469e)[_0xd55f('0x25')](function(_0x224de8){return _0x224de8;});}return null;};}function removeEntity(_0x44f496,_0x3807b1){return function(_0x1940e6){if(_0x1940e6){return _0x1940e6[_0xd55f('0x26')]()[_0xd55f('0x25')](function(){var _0x1e0eae=_0x1940e6[_0xd55f('0x27')]({'plain':!![]});var _0x569e8c=_0xd55f('0x28');return db[_0xd55f('0x29')][_0xd55f('0x26')]({'where':{'type':_0x569e8c,'resourceId':_0x1e0eae['id']}})[_0xd55f('0x25')](function(){return _0x1940e6;});})[_0xd55f('0x25')](function(){_0x44f496[_0xd55f('0x1a')](0xcc)[_0xd55f('0x1b')]();});}};}function handleEntityNotFound(_0x17193f,_0x4cc0fd){return function(_0x1101d5){if(!_0x1101d5){_0x17193f[_0xd55f('0x19')](0x194);}return _0x1101d5;};}function handleError(_0x32bd59,_0x50eb63){_0x50eb63=_0x50eb63||0x1f4;return function(_0x33b400){logger[_0xd55f('0x2a')](_0x33b400[_0xd55f('0x2b')]);if(_0x33b400[_0xd55f('0x2c')]){delete _0x33b400[_0xd55f('0x2c')];}_0x32bd59[_0xd55f('0x1a')](_0x50eb63)[_0xd55f('0x2d')](_0x33b400);};}exports[_0xd55f('0x2e')]=function(_0x4cb2e6,_0x5b6451){var _0x5cfc7e={},_0x36dad9={},_0x4d8058={'count':0x0,'rows':[]};var _0x472269=_[_0xd55f('0x2f')](db[_0xd55f('0x30')][_0xd55f('0x31')],function(_0x346997){return{'name':_0x346997['fieldName'],'type':_0x346997['type'][_0xd55f('0x32')]};});_0x36dad9[_0xd55f('0x33')]=_[_0xd55f('0x2f')](_0x472269,_0xd55f('0x2c'));_0x36dad9[_0xd55f('0x34')]=_[_0xd55f('0x35')](_0x4cb2e6[_0xd55f('0x34')]);_0x36dad9[_0xd55f('0x36')]=_[_0xd55f('0x37')](_0x36dad9[_0xd55f('0x33')],_0x36dad9[_0xd55f('0x34')]);_0x5cfc7e['attributes']=_[_0xd55f('0x37')](_0x36dad9['model'],qs[_0xd55f('0x38')](_0x4cb2e6[_0xd55f('0x34')][_0xd55f('0x38')]));_0x5cfc7e[_0xd55f('0x39')]=_0x5cfc7e['attributes'][_0xd55f('0x3a')]?_0x5cfc7e[_0xd55f('0x39')]:_0x36dad9[_0xd55f('0x33')];if(!_0x4cb2e6[_0xd55f('0x34')]['hasOwnProperty'](_0xd55f('0x3b'))){_0x5cfc7e['limit']=qs[_0xd55f('0x1d')](_0x4cb2e6[_0xd55f('0x34')][_0xd55f('0x1d')]);_0x5cfc7e[_0xd55f('0x1c')]=qs[_0xd55f('0x1c')](_0x4cb2e6[_0xd55f('0x34')]['offset']);}_0x5cfc7e[_0xd55f('0x3c')]=qs[_0xd55f('0x3d')](_0x4cb2e6[_0xd55f('0x34')][_0xd55f('0x3d')]);_0x5cfc7e['where']=qs['filters'](_[_0xd55f('0x3e')](_0x4cb2e6['query'],_0x36dad9[_0xd55f('0x36')]),_0x472269);if(_0x4cb2e6[_0xd55f('0x34')]['filter']){_0x5cfc7e[_0xd55f('0x3f')]=_[_0xd55f('0x40')](_0x5cfc7e[_0xd55f('0x3f')],{'$or':_[_0xd55f('0x2f')](_0x472269,function(_0x4fb04d){if(_0x4fb04d['type']!==_0xd55f('0x41')){var _0xb689b3={};_0xb689b3[_0x4fb04d[_0xd55f('0x2c')]]={'$like':'%'+_0x4cb2e6[_0xd55f('0x34')][_0xd55f('0x42')]+'%'};return _0xb689b3;}})});}_0x5cfc7e=_[_0xd55f('0x40')]({},_0x5cfc7e,_0x4cb2e6[_0xd55f('0x43')]);var _0x43a6a3={'where':_0x5cfc7e[_0xd55f('0x3f')]};return db['Disposition'][_0xd55f('0x1e')](_0x43a6a3)['then'](function(_0x14d803){_0x4d8058[_0xd55f('0x1e')]=_0x14d803;if(_0x4cb2e6[_0xd55f('0x34')][_0xd55f('0x44')]){_0x5cfc7e[_0xd55f('0x45')]=[{'all':!![]}];}return db[_0xd55f('0x30')][_0xd55f('0x46')](_0x5cfc7e);})[_0xd55f('0x25')](function(_0x9775b9){_0x4d8058[_0xd55f('0x47')]=_0x9775b9;return _0x4d8058;})['then'](respondWithFilteredResult(_0x5b6451,_0x5cfc7e))[_0xd55f('0x48')](handleError(_0x5b6451,null));};exports[_0xd55f('0x49')]=function(_0x47a2ac,_0x95fab1){var _0x51bb71={'raw':!![],'where':{'id':_0x47a2ac[_0xd55f('0x4a')]['id']}},_0x132dbd={};_0x132dbd['model']=_['keys'](db['Disposition'][_0xd55f('0x31')]);_0x132dbd[_0xd55f('0x34')]=_[_0xd55f('0x35')](_0x47a2ac[_0xd55f('0x34')]);_0x132dbd[_0xd55f('0x36')]=_[_0xd55f('0x37')](_0x132dbd['model'],_0x132dbd[_0xd55f('0x34')]);_0x51bb71[_0xd55f('0x39')]=_[_0xd55f('0x37')](_0x132dbd['model'],qs[_0xd55f('0x38')](_0x47a2ac[_0xd55f('0x34')][_0xd55f('0x38')]));_0x51bb71[_0xd55f('0x39')]=_0x51bb71['attributes'][_0xd55f('0x3a')]?_0x51bb71[_0xd55f('0x39')]:_0x132dbd[_0xd55f('0x33')];if(_0x47a2ac[_0xd55f('0x34')][_0xd55f('0x44')]){_0x51bb71[_0xd55f('0x45')]=[{'all':!![]}];}_0x51bb71=_[_0xd55f('0x40')]({},_0x51bb71,_0x47a2ac[_0xd55f('0x43')]);return db[_0xd55f('0x30')][_0xd55f('0x4b')](_0x51bb71)[_0xd55f('0x25')](handleEntityNotFound(_0x95fab1,null))[_0xd55f('0x25')](respondWithResult(_0x95fab1,null))[_0xd55f('0x48')](handleError(_0x95fab1,null));};exports[_0xd55f('0x4c')]=function(_0x371f58,_0x8365d1){return db[_0xd55f('0x30')]['create'](_0x371f58[_0xd55f('0x4d')],{})[_0xd55f('0x25')](function(_0x322a50){var _0x5e3489=_0x371f58[_0xd55f('0x4e')][_0xd55f('0x27')]({'plain':!![]});if(!_0x5e3489)throw new Error(_0xd55f('0x4f'));if(_0x5e3489[_0xd55f('0x50')]===_0xd55f('0x4e')){var _0xae6b10=_0x322a50[_0xd55f('0x27')]({'plain':!![]});var _0x351a81=_0xd55f('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x351a81,'userProfileId':_0x5e3489[_0xd55f('0x51')]},'raw':!![]})['then'](function(_0x12be97){if(_0x12be97&&_0x12be97[_0xd55f('0x52')]===0x0){return db['UserProfileResource']['create']({'name':_0xae6b10[_0xd55f('0x2c')],'resourceId':_0xae6b10['id'],'type':_0x12be97[_0xd55f('0x2c')],'sectionId':_0x12be97['id']},{})['then'](function(){return _0x322a50;});}else{return _0x322a50;}})['catch'](function(_0x414a2c){logger[_0xd55f('0x2a')](_0xd55f('0x53'),_0x414a2c);throw _0x414a2c;});}return _0x322a50;})[_0xd55f('0x25')](respondWithResult(_0x8365d1,0xc9))[_0xd55f('0x48')](handleError(_0x8365d1,null));};exports[_0xd55f('0x24')]=function(_0x40fdbe,_0x53bb67){if(_0x40fdbe[_0xd55f('0x4d')]['id']){delete _0x40fdbe[_0xd55f('0x4d')]['id'];}return db['Disposition'][_0xd55f('0x4b')]({'where':{'id':_0x40fdbe[_0xd55f('0x4a')]['id']}})[_0xd55f('0x25')](handleEntityNotFound(_0x53bb67,null))[_0xd55f('0x25')](saveUpdates(_0x40fdbe[_0xd55f('0x4d')],null))[_0xd55f('0x25')](respondWithResult(_0x53bb67,null))['catch'](handleError(_0x53bb67,null));};exports[_0xd55f('0x26')]=function(_0x1e719a,_0x8859bd){return db[_0xd55f('0x30')][_0xd55f('0x4b')]({'where':{'id':_0x1e719a['params']['id']}})[_0xd55f('0x25')](handleEntityNotFound(_0x8859bd,null))[_0xd55f('0x25')](removeEntity(_0x8859bd,null))[_0xd55f('0x48')](handleError(_0x8859bd,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index 24ac59b..6d3f013 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 _0xd452=['lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','name_mail','MailAccountId','name_sms','SmsAccountId','name_fax','name_openchannel','OpenchannelAccountId','name_whatsapp'];(function(_0x259b73,_0x2b1ece){var _0x5f942f=function(_0x3c7678){while(--_0x3c7678){_0x259b73['push'](_0x259b73['shift']());}};_0x5f942f(++_0x2b1ece);}(_0xd452,0x108));var _0x2d45=function(_0x1d87fc,_0x1e5321){_0x1d87fc=_0x1d87fc-0x0;var _0x492b56=_0xd452[_0x1d87fc];return _0x492b56;};'use strict';var _=require(_0x2d45('0x0'));var util=require('util');var logger=require(_0x2d45('0x1'))(_0x2d45('0x2'));var moment=require('moment');var BPromise=require(_0x2d45('0x3'));var rp=require(_0x2d45('0x4'));var fs=require('fs');var path=require(_0x2d45('0x5'));var rimraf=require(_0x2d45('0x6'));var config=require(_0x2d45('0x7'));var attributes=require('./disposition.attributes');module[_0x2d45('0x8')]=function(_0x4e3cbf,_0x4cbb8e){return _0x4e3cbf['define'](_0x2d45('0x9'),attributes,{'tableName':_0x2d45('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x2d45('0xb'),'fields':[_0x2d45('0xc'),_0x2d45('0xd')]},{'unique':!![],'name':_0x2d45('0xe'),'fields':[_0x2d45('0xc'),_0x2d45('0xf')]},{'unique':!![],'name':_0x2d45('0x10'),'fields':[_0x2d45('0xc'),_0x2d45('0x11')]},{'unique':!![],'name':_0x2d45('0x12'),'fields':[_0x2d45('0xc'),_0x2d45('0x13')]},{'unique':!![],'name':_0x2d45('0x14'),'fields':[_0x2d45('0xc'),'FaxAccountId']},{'unique':!![],'name':_0x2d45('0x15'),'fields':[_0x2d45('0xc'),_0x2d45('0x16')]},{'unique':!![],'name':_0x2d45('0x17'),'fields':[_0x2d45('0xc'),'WhatsappAccountId']}],'timestamps':!![]});}; \ No newline at end of file +var _0x3178=['name_whatsapp','WhatsappAccountId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./disposition.attributes','exports','define','Disposition','tools_dispositions','name_voice','name','ListId','name_chat','ChatWebsiteId','MailAccountId','name_sms','SmsAccountId','name_fax','OpenchannelAccountId'];(function(_0x5949c1,_0x35ec47){var _0x95c24d=function(_0x2ec0e5){while(--_0x2ec0e5){_0x5949c1['push'](_0x5949c1['shift']());}};_0x95c24d(++_0x35ec47);}(_0x3178,0x7f));var _0x8317=function(_0x3f9264,_0x2caf6f){_0x3f9264=_0x3f9264-0x0;var _0x15268c=_0x3178[_0x3f9264];return _0x15268c;};'use strict';var _=require(_0x8317('0x0'));var util=require(_0x8317('0x1'));var logger=require('../../config/logger')(_0x8317('0x2'));var moment=require(_0x8317('0x3'));var BPromise=require(_0x8317('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8317('0x5'));var rimraf=require(_0x8317('0x6'));var config=require(_0x8317('0x7'));var attributes=require(_0x8317('0x8'));module[_0x8317('0x9')]=function(_0x192198,_0x44776e){return _0x192198[_0x8317('0xa')](_0x8317('0xb'),attributes,{'tableName':_0x8317('0xc'),'paranoid':![],'indexes':[{'unique':!![],'name':_0x8317('0xd'),'fields':[_0x8317('0xe'),_0x8317('0xf')]},{'unique':!![],'name':_0x8317('0x10'),'fields':[_0x8317('0xe'),_0x8317('0x11')]},{'unique':!![],'name':'name_mail','fields':['name',_0x8317('0x12')]},{'unique':!![],'name':_0x8317('0x13'),'fields':[_0x8317('0xe'),_0x8317('0x14')]},{'unique':!![],'name':_0x8317('0x15'),'fields':[_0x8317('0xe'),'FaxAccountId']},{'unique':!![],'name':'name_openchannel','fields':[_0x8317('0xe'),_0x8317('0x16')]},{'unique':!![],'name':_0x8317('0x17'),'fields':[_0x8317('0xe'),_0x8317('0x18')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index 8ce600f..1612d59 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 _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\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(_0x200d8b,_0x1373cd){var _0x7a3345=function(_0x46720e){while(--_0x46720e){_0x200d8b['push'](_0x200d8b['shift']());}};_0x7a3345(++_0x1373cd);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'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','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\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(_0x5ef46c,_0x4dccc8){var _0x345d27=function(_0x46dd1c){while(--_0x46dd1c){_0x5ef46c['push'](_0x5ef46c['shift']());}};_0x345d27(++_0x4dccc8);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'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/disposition/index.js b/server/api/disposition/index.js index 44dcb90..8d1d6c3 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 _0xdfd1=['isAuthenticated','index','post','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./disposition.controller','get'];(function(_0x1795df,_0xcb261e){var _0x3f13c0=function(_0x52c5cf){while(--_0x52c5cf){_0x1795df['push'](_0x1795df['shift']());}};_0x3f13c0(++_0xcb261e);}(_0xdfd1,0x125));var _0x1dfd=function(_0x56dd53,_0x3876e1){_0x56dd53=_0x56dd53-0x0;var _0x5761f8=_0xdfd1[_0x56dd53];return _0x5761f8;};'use strict';var multer=require(_0x1dfd('0x0'));var util=require(_0x1dfd('0x1'));var path=require(_0x1dfd('0x2'));var timeout=require(_0x1dfd('0x3'));var express=require(_0x1dfd('0x4'));var router=express[_0x1dfd('0x5')]();var fs_extra=require(_0x1dfd('0x6'));var auth=require(_0x1dfd('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x1dfd('0x8'));var controller=require(_0x1dfd('0x9'));router[_0x1dfd('0xa')]('/',auth[_0x1dfd('0xb')](),controller[_0x1dfd('0xc')]);router[_0x1dfd('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x1dfd('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x1dfd('0xe'),auth[_0x1dfd('0xb')](),controller[_0x1dfd('0xf')]);router[_0x1dfd('0x10')](_0x1dfd('0xe'),auth[_0x1dfd('0xb')](),controller[_0x1dfd('0x11')]);module[_0x1dfd('0x12')]=router; \ No newline at end of file +var _0xfcc3=['/:id','show','post','create','update','delete','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1f48b0,_0x1ed1f2){var _0x4bf08a=function(_0x471bbb){while(--_0x471bbb){_0x1f48b0['push'](_0x1f48b0['shift']());}};_0x4bf08a(++_0x1ed1f2);}(_0xfcc3,0xd3));var _0x3fcc=function(_0x2705aa,_0x378b4c){_0x2705aa=_0x2705aa-0x0;var _0x50ebc2=_0xfcc3[_0x2705aa];return _0x50ebc2;};'use strict';var multer=require(_0x3fcc('0x0'));var util=require(_0x3fcc('0x1'));var path=require(_0x3fcc('0x2'));var timeout=require('connect-timeout');var express=require(_0x3fcc('0x3'));var router=express['Router']();var fs_extra=require(_0x3fcc('0x4'));var auth=require(_0x3fcc('0x5'));var interaction=require(_0x3fcc('0x6'));var config=require(_0x3fcc('0x7'));var controller=require('./disposition.controller');router[_0x3fcc('0x8')]('/',auth[_0x3fcc('0x9')](),controller['index']);router[_0x3fcc('0x8')](_0x3fcc('0xa'),auth['isAuthenticated'](),controller[_0x3fcc('0xb')]);router[_0x3fcc('0xc')]('/',auth[_0x3fcc('0x9')](),controller[_0x3fcc('0xd')]);router['put'](_0x3fcc('0xa'),auth[_0x3fcc('0x9')](),controller[_0x3fcc('0xe')]);router[_0x3fcc('0xf')](_0x3fcc('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x3fcc('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 e7b22c5..11d36ef 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 _0xa767=['ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','12000','14400','v17,v27,v29','INTEGER','IAX','KHOMP','SIP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDisposition','exports','STRING'];(function(_0x3ab9ee,_0x4a74b8){var _0x82ee88=function(_0x6ccc7e){while(--_0x6ccc7e){_0x3ab9ee['push'](_0x3ab9ee['shift']());}};_0x82ee88(++_0x4a74b8);}(_0xa767,0x18a));var _0x7a76=function(_0x5e5241,_0x36a826){_0x5e5241=_0x5e5241-0x0;var _0x45c70c=_0xa767[_0x5e5241];return _0x45c70c;};'use strict';var Sequelize=require('sequelize');module[_0x7a76('0x0')]={'name':{'type':Sequelize[_0x7a76('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x7a76('0x1')]},'ecm':{'type':Sequelize[_0x7a76('0x2')](_0x7a76('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x7a76('0x1')],'defaultValue':_0x7a76('0x4')},'localstationid':{'type':Sequelize[_0x7a76('0x1')],'unique':_0x7a76('0x5')},'minrate':{'type':Sequelize[_0x7a76('0x2')](_0x7a76('0x6'),_0x7a76('0x7'),_0x7a76('0x8'),'9600',_0x7a76('0x9'),'14400'),'defaultValue':_0x7a76('0x7')},'maxrate':{'type':Sequelize[_0x7a76('0x2')]('2400',_0x7a76('0x7'),_0x7a76('0x8'),'9600',_0x7a76('0x9'),_0x7a76('0xa')),'defaultValue':'14400'},'modem':{'type':Sequelize[_0x7a76('0x1')],'defaultValue':_0x7a76('0xb')},'gateway':{'type':Sequelize[_0x7a76('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x7a76('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x7a76('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x7a76('0x2')]('SIP',_0x7a76('0xd'),'DADHI',_0x7a76('0xe')),'defaultValue':_0x7a76('0xf')},'key':{'type':Sequelize[_0x7a76('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x7a76('0x10')],'defaultValue':function(){return _0x7a76('0x11');}},'notificationSound':{'type':Sequelize[_0x7a76('0x12')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x7a76('0x12')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x7a76('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x7a76('0x12')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x7a76('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x7a76('0x12')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x7a76('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x7a76('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x7a76('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x7a76('0x12')],'defaultValue':![],'comment':_0x7a76('0x14'),'set':function(_0x5002ed){if(!_0x5002ed)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x7a76('0x15'),_0x5002ed);}}}; \ No newline at end of file +var _0x1e89=['BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDisposition','sequelize','exports','STRING','ENUM','yes','xCALLY\x20Motion\x20Fax','localstationid','2400','4800','7200','9600','12000','14400','v17,v27,v29','INTEGER','SIP','IAX','DADHI','TEXT'];(function(_0x546247,_0x498043){var _0x59dfae=function(_0x32586a){while(--_0x32586a){_0x546247['push'](_0x546247['shift']());}};_0x59dfae(++_0x498043);}(_0x1e89,0xf5));var _0x91e8=function(_0x4e56df,_0x3344f5){_0x4e56df=_0x4e56df-0x0;var _0x1735e5=_0x1e89[_0x4e56df];return _0x1735e5;};'use strict';var Sequelize=require(_0x91e8('0x0'));module[_0x91e8('0x1')]={'name':{'type':Sequelize[_0x91e8('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x91e8('0x2')]},'ecm':{'type':Sequelize[_0x91e8('0x3')]('yes','no'),'defaultValue':_0x91e8('0x4')},'headerinfo':{'type':Sequelize[_0x91e8('0x2')],'defaultValue':_0x91e8('0x5')},'localstationid':{'type':Sequelize[_0x91e8('0x2')],'unique':_0x91e8('0x6')},'minrate':{'type':Sequelize['ENUM'](_0x91e8('0x7'),_0x91e8('0x8'),_0x91e8('0x9'),_0x91e8('0xa'),'12000','14400'),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x91e8('0x3')](_0x91e8('0x7'),_0x91e8('0x8'),_0x91e8('0x9'),'9600',_0x91e8('0xb'),_0x91e8('0xc')),'defaultValue':_0x91e8('0xc')},'modem':{'type':Sequelize[_0x91e8('0x2')],'defaultValue':_0x91e8('0xd')},'gateway':{'type':Sequelize['STRING'],'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[_0x91e8('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0x91e8('0x3')](_0x91e8('0xf'),_0x91e8('0x10'),_0x91e8('0x11'),'KHOMP'),'defaultValue':_0x91e8('0xf')},'key':{'type':Sequelize[_0x91e8('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x91e8('0x12')],'defaultValue':function(){return'Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}';}},'notificationSound':{'type':Sequelize[_0x91e8('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x91e8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x91e8('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x91e8('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x91e8('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x91e8('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x91e8('0x13')],'defaultValue':![],'comment':_0x91e8('0x15'),'set':function(_0x511d2b){if(!_0x511d2b)this[_0x91e8('0x16')]('mandatoryDispositionPauseId',null);this[_0x91e8('0x16')](_0x91e8('0x17'),_0x511d2b);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index 550e533..9e51cdf 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 _0x7f53=['rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','options','count','includeAll','include','findAll','rows','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','sort','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','addInteraction','ids','omit','getInteractions','FaxInteraction','CmContact','User','Owner','fullname','Tag','tag','sequelize','transaction','FaxApplication','findAndCountAll','priority','getApplications','context','from-voip-provider','exten','localstationid','system','description','Fax\x20Extension','push','CDR(type)=inbound-fax','Set','gateway','faxdetect','maxrate','modem','t38timeout','FAXOPT(','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','addAccountApplications','VoiceExtension','bulkCreate','tech','createdAt','updatedAt','TrunkId','ListId','findById','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','attachments','join','root','basename','CheckAfterSend','isNil','path','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','out','Messages','Contact\x20not\x20found','spread','filename','ContactId','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxAccount.socket','client','http','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','end','status','json','offset','limit','undefined','set','Content-Range','save','update','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount'];(function(_0x43abc9,_0x56bbb2){var _0xfc1f66=function(_0x41ac64){while(--_0x41ac64){_0x43abc9['push'](_0x43abc9['shift']());}};_0xfc1f66(++_0x56bbb2);}(_0x7f53,0x148));var _0x37f5=function(_0x26bf51,_0x5e261a){_0x26bf51=_0x26bf51-0x0;var _0x503415=_0x7f53[_0x26bf51];return _0x503415;};'use strict';var emlformat=require(_0x37f5('0x0'));var rimraf=require(_0x37f5('0x1'));var zipdir=require(_0x37f5('0x2'));var jsonpatch=require(_0x37f5('0x3'));var rp=require(_0x37f5('0x4'));var moment=require(_0x37f5('0x5'));var BPromise=require(_0x37f5('0x6'));var Mustache=require(_0x37f5('0x7'));var util=require(_0x37f5('0x8'));var path=require('path');var sox=require(_0x37f5('0x9'));var csv=require(_0x37f5('0xa'));var ejs=require(_0x37f5('0xb'));var fs=require('fs');var fs_extra=require(_0x37f5('0xc'));var _=require(_0x37f5('0xd'));var squel=require(_0x37f5('0xe'));var crypto=require('crypto');var jsforce=require(_0x37f5('0xf'));var deskjs=require(_0x37f5('0x10'));var toCsv=require('to-csv');var querystring=require(_0x37f5('0x11'));var Papa=require(_0x37f5('0x12'));var Redis=require('ioredis');var authService=require(_0x37f5('0x13'));var qs=require(_0x37f5('0x14'));var as=require(_0x37f5('0x15'));var hardwareService=require(_0x37f5('0x16'));var logger=require('../../config/logger')(_0x37f5('0x17'));var utils=require(_0x37f5('0x18'));var config=require(_0x37f5('0x19'));var licenseUtil=require(_0x37f5('0x1a'));var db=require(_0x37f5('0x1b'))['db'];config[_0x37f5('0x1c')]=_[_0x37f5('0x1d')](config[_0x37f5('0x1c')],{'host':_0x37f5('0x1e'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37f5('0x1c')]));require(_0x37f5('0x1f'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0x37f5('0x20')]['http']({'port':0x232c});var client9002=jayson[_0x37f5('0x20')][_0x37f5('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x43020c,_0x3022a8,_0x3ce4d2,_0x26fe0f){return new BPromise(function(_0x4b55d8,_0x31c9b7){var _0xbe409b=_0x26fe0f||client;return _0xbe409b[_0x37f5('0x22')](_0x43020c,_0x3ce4d2)[_0x37f5('0x23')](function(_0x315387){logger[_0x37f5('0x24')](_0x37f5('0x25'),_0x3022a8,_0x37f5('0x26'));logger[_0x37f5('0x27')](_0x37f5('0x28'),_0x3022a8,_0x37f5('0x26'),JSON[_0x37f5('0x29')](_0x315387));if(_0x315387[_0x37f5('0x2a')]){if(_0x315387['error'][_0x37f5('0x2b')]===0x1f4){logger[_0x37f5('0x2a')]('FaxAccount,\x20%s,\x20%s',_0x3022a8,_0x315387['error'][_0x37f5('0x2c')]);return _0x31c9b7(_0x315387[_0x37f5('0x2a')][_0x37f5('0x2c')]);}logger[_0x37f5('0x2a')](_0x37f5('0x25'),_0x3022a8,_0x315387[_0x37f5('0x2a')][_0x37f5('0x2c')]);return _0x4b55d8(_0x315387[_0x37f5('0x2a')][_0x37f5('0x2c')]);}else{logger[_0x37f5('0x24')](_0x37f5('0x25'),_0x3022a8,_0x37f5('0x26'));_0x4b55d8(_0x315387[_0x37f5('0x2d')][_0x37f5('0x2c')]);}})[_0x37f5('0x2e')](function(_0x31aad0){logger[_0x37f5('0x2a')](_0x37f5('0x25'),_0x3022a8,_0x31aad0);_0x31c9b7(_0x31aad0);});});}function respondWithStatusCode(_0x1ace3a,_0x5abbeb){_0x5abbeb=_0x5abbeb||0xcc;return function(_0x5a7e67){if(_0x5a7e67){return _0x1ace3a[_0x37f5('0x2f')](_0x5abbeb);}return _0x1ace3a['status'](_0x5abbeb)[_0x37f5('0x30')]();};}function respondWithResult(_0x5d5c90,_0x485182){_0x485182=_0x485182||0xc8;return function(_0x8427c){if(_0x8427c){return _0x5d5c90[_0x37f5('0x31')](_0x485182)[_0x37f5('0x32')](_0x8427c);}};}function respondWithFilteredResult(_0x24fbce,_0x11d818){return function(_0x34c7d6){if(_0x34c7d6){var _0x5e89fb=typeof _0x11d818[_0x37f5('0x33')]==='undefined'&&typeof _0x11d818[_0x37f5('0x34')]===_0x37f5('0x35');var _0x4f8d4d=_0x34c7d6['count'];var _0x596d10=_0x5e89fb?0x0:_0x11d818[_0x37f5('0x33')];var _0x2c14d5=_0x5e89fb?_0x34c7d6['count']:_0x11d818['offset']+_0x11d818[_0x37f5('0x34')];var _0x143272;if(_0x2c14d5>=_0x4f8d4d){_0x2c14d5=_0x4f8d4d;_0x143272=0xc8;}else{_0x143272=0xce;}_0x24fbce[_0x37f5('0x31')](_0x143272);return _0x24fbce[_0x37f5('0x36')](_0x37f5('0x37'),_0x596d10+'-'+_0x2c14d5+'/'+_0x4f8d4d)[_0x37f5('0x32')](_0x34c7d6);}return null;};}function patchUpdates(_0x7c2ab9){return function(_0x291397){try{jsonpatch['apply'](_0x291397,_0x7c2ab9,!![]);}catch(_0x141e56){return BPromise['reject'](_0x141e56);}return _0x291397[_0x37f5('0x38')]();};}function saveUpdates(_0x77eb47,_0x1af5c1){return function(_0x320d51){if(_0x320d51){return _0x320d51[_0x37f5('0x39')](_0x77eb47)[_0x37f5('0x23')](function(_0x9e7b77){return _0x9e7b77;});}return null;};}function removeEntity(_0x341c0f,_0xc61b30){return function(_0x144ba7){if(_0x144ba7){return _0x144ba7[_0x37f5('0x3a')]()[_0x37f5('0x23')](function(){var _0x2a2356=_0x144ba7[_0x37f5('0x3b')]({'plain':!![]});var _0x5e1774=_0x37f5('0x3c');return db[_0x37f5('0x3d')][_0x37f5('0x3a')]({'where':{'type':_0x5e1774,'resourceId':_0x2a2356['id']}})['then'](function(){return _0x144ba7;});})[_0x37f5('0x23')](function(){_0x341c0f[_0x37f5('0x31')](0xcc)['end']();});}};}function handleEntityNotFound(_0x584310,_0x548704){return function(_0x2f37a3){if(!_0x2f37a3){_0x584310['sendStatus'](0x194);}return _0x2f37a3;};}function handleError(_0x1499f5,_0x308c28){_0x308c28=_0x308c28||0x1f4;return function(_0x405625){logger[_0x37f5('0x2a')](_0x405625[_0x37f5('0x3e')]);if(_0x405625[_0x37f5('0x3f')]){delete _0x405625[_0x37f5('0x3f')];}_0x1499f5[_0x37f5('0x31')](_0x308c28)[_0x37f5('0x40')](_0x405625);};}exports[_0x37f5('0x41')]=function(_0x4139bc,_0x36f3dd){var _0x43ba6e={'include':[{'model':db[_0x37f5('0x42')],'as':_0x37f5('0x43')}]},_0x31ac59={},_0x1f0117={'count':0x0,'rows':[]};var _0x5c0c17=_[_0x37f5('0x44')](db[_0x37f5('0x45')][_0x37f5('0x46')],function(_0x395147){return{'name':_0x395147[_0x37f5('0x47')],'type':_0x395147[_0x37f5('0x48')][_0x37f5('0x49')]};});_0x31ac59['model']=_[_0x37f5('0x44')](_0x5c0c17,_0x37f5('0x3f'));_0x31ac59[_0x37f5('0x4a')]=_[_0x37f5('0x4b')](_0x4139bc[_0x37f5('0x4a')]);_0x31ac59['filters']=_[_0x37f5('0x4c')](_0x31ac59[_0x37f5('0x4d')],_0x31ac59[_0x37f5('0x4a')]);_0x43ba6e[_0x37f5('0x4e')]=_[_0x37f5('0x4c')](_0x31ac59[_0x37f5('0x4d')],qs[_0x37f5('0x4f')](_0x4139bc[_0x37f5('0x4a')]['fields']));_0x43ba6e[_0x37f5('0x4e')]=_0x43ba6e['attributes'][_0x37f5('0x50')]?_0x43ba6e[_0x37f5('0x4e')]:_0x31ac59[_0x37f5('0x4d')];if(!_0x4139bc[_0x37f5('0x4a')][_0x37f5('0x51')](_0x37f5('0x52'))){_0x43ba6e[_0x37f5('0x34')]=qs['limit'](_0x4139bc[_0x37f5('0x4a')]['limit']);_0x43ba6e[_0x37f5('0x33')]=qs[_0x37f5('0x33')](_0x4139bc[_0x37f5('0x4a')]['offset']);}_0x43ba6e[_0x37f5('0x53')]=qs['sort'](_0x4139bc['query']['sort']);_0x43ba6e[_0x37f5('0x54')]=qs[_0x37f5('0x55')](_[_0x37f5('0x56')](_0x4139bc[_0x37f5('0x4a')],_0x31ac59[_0x37f5('0x55')]),_0x5c0c17);if(_0x4139bc[_0x37f5('0x4a')][_0x37f5('0x57')]){_0x43ba6e[_0x37f5('0x54')]=_[_0x37f5('0x58')](_0x43ba6e[_0x37f5('0x54')],{'$or':_[_0x37f5('0x44')](_0x5c0c17,function(_0x41baed){if(_0x41baed['type']!=='VIRTUAL'){var _0x4657a7={};_0x4657a7[_0x41baed[_0x37f5('0x3f')]]={'$like':'%'+_0x4139bc[_0x37f5('0x4a')]['filter']+'%'};return _0x4657a7;}})});}_0x43ba6e=_[_0x37f5('0x58')]({},_0x43ba6e,_0x4139bc[_0x37f5('0x59')]);var _0x3039d3={'where':_0x43ba6e[_0x37f5('0x54')]};return db[_0x37f5('0x45')][_0x37f5('0x5a')](_0x3039d3)[_0x37f5('0x23')](function(_0x30bd26){_0x1f0117['count']=_0x30bd26;if(_0x4139bc[_0x37f5('0x4a')][_0x37f5('0x5b')]){_0x43ba6e[_0x37f5('0x5c')]=[{'all':!![]}];}return db[_0x37f5('0x45')][_0x37f5('0x5d')](_0x43ba6e);})[_0x37f5('0x23')](function(_0xffde01){_0x1f0117[_0x37f5('0x5e')]=_0xffde01;return _0x1f0117;})[_0x37f5('0x23')](respondWithFilteredResult(_0x36f3dd,_0x43ba6e))[_0x37f5('0x2e')](handleError(_0x36f3dd,null));};exports[_0x37f5('0x5f')]=function(_0x271bfe,_0x523f12){var _0x3789fa={'raw':![],'where':{'id':_0x271bfe[_0x37f5('0x60')]['id']},'include':[{'model':db[_0x37f5('0x42')],'as':'mandatoryDispositionPause'}]},_0x3ed764={};_0x3ed764[_0x37f5('0x4d')]=_['keys'](db['FaxAccount'][_0x37f5('0x46')]);_0x3ed764[_0x37f5('0x4a')]=_[_0x37f5('0x4b')](_0x271bfe[_0x37f5('0x4a')]);_0x3ed764[_0x37f5('0x55')]=_[_0x37f5('0x4c')](_0x3ed764['model'],_0x3ed764[_0x37f5('0x4a')]);_0x3789fa[_0x37f5('0x4e')]=_[_0x37f5('0x4c')](_0x3ed764['model'],qs['fields'](_0x271bfe[_0x37f5('0x4a')][_0x37f5('0x4f')]));_0x3789fa['attributes']=_0x3789fa[_0x37f5('0x4e')][_0x37f5('0x50')]?_0x3789fa[_0x37f5('0x4e')]:_0x3ed764[_0x37f5('0x4d')];if(_0x271bfe[_0x37f5('0x4a')][_0x37f5('0x5b')]){_0x3789fa[_0x37f5('0x5c')]=[{'all':!![]}];}_0x3789fa=_[_0x37f5('0x58')]({},_0x3789fa,_0x271bfe['options']);return db['FaxAccount'][_0x37f5('0x61')](_0x3789fa)[_0x37f5('0x23')](handleEntityNotFound(_0x523f12,null))['then'](respondWithResult(_0x523f12,null))[_0x37f5('0x2e')](handleError(_0x523f12,null));};exports[_0x37f5('0x62')]=function(_0x1d8c80,_0x349d9f){return db[_0x37f5('0x45')][_0x37f5('0x62')](_0x1d8c80[_0x37f5('0x63')],{})[_0x37f5('0x23')](function(_0x5914bf){var _0x5af1fe=_0x1d8c80[_0x37f5('0x64')][_0x37f5('0x3b')]({'plain':!![]});if(!_0x5af1fe)throw new Error(_0x37f5('0x65'));if(_0x5af1fe['role']===_0x37f5('0x64')){var _0x4138f2=_0x5914bf[_0x37f5('0x3b')]({'plain':!![]});var _0x25bd25=_0x37f5('0x3c');return db[_0x37f5('0x66')][_0x37f5('0x61')]({'where':{'name':_0x25bd25,'userProfileId':_0x5af1fe[_0x37f5('0x67')]},'raw':!![]})[_0x37f5('0x23')](function(_0x4fbbf3){if(_0x4fbbf3&&_0x4fbbf3[_0x37f5('0x68')]===0x0){return db[_0x37f5('0x3d')][_0x37f5('0x62')]({'name':_0x4138f2[_0x37f5('0x3f')],'resourceId':_0x4138f2['id'],'type':_0x4fbbf3[_0x37f5('0x3f')],'sectionId':_0x4fbbf3['id']},{})[_0x37f5('0x23')](function(){return _0x5914bf;});}else{return _0x5914bf;}})['catch'](function(_0x43e6e8){logger[_0x37f5('0x2a')](_0x37f5('0x69'),_0x43e6e8);throw _0x43e6e8;});}return _0x5914bf;})['then'](respondWithResult(_0x349d9f,0xc9))[_0x37f5('0x2e')](handleError(_0x349d9f,null));};exports['update']=function(_0x22faf2,_0x52660d){if(_0x22faf2[_0x37f5('0x63')]['id']){delete _0x22faf2['body']['id'];}return db[_0x37f5('0x45')]['find']({'where':{'id':_0x22faf2[_0x37f5('0x60')]['id']},'include':[{'model':db[_0x37f5('0x42')],'as':_0x37f5('0x43')}]})['then'](handleEntityNotFound(_0x52660d,null))[_0x37f5('0x23')](saveUpdates(_0x22faf2[_0x37f5('0x63')],null))[_0x37f5('0x23')](respondWithResult(_0x52660d,null))[_0x37f5('0x2e')](handleError(_0x52660d,null));};exports[_0x37f5('0x3a')]=function(_0x40e5d1,_0x1188f7){return db[_0x37f5('0x45')][_0x37f5('0x61')]({'where':{'id':_0x40e5d1['params']['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0x1188f7,null))[_0x37f5('0x23')](removeEntity(_0x1188f7,null))['catch'](handleError(_0x1188f7,null));};exports[_0x37f5('0x6a')]=function(_0x532950,_0x38edfe){return db[_0x37f5('0x45')][_0x37f5('0x6a')]()[_0x37f5('0x23')](respondWithResult(_0x38edfe,null))[_0x37f5('0x2e')](handleError(_0x38edfe,null));};exports[_0x37f5('0x6b')]=function(_0x1eb0ee,_0x1056b2,_0xadb728){if(_0x1eb0ee[_0x37f5('0x63')]['id']){delete _0x1eb0ee[_0x37f5('0x63')]['id'];}return db['FaxAccount'][_0x37f5('0x61')]({'where':{'id':_0x1eb0ee[_0x37f5('0x60')]['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0x1056b2,null))[_0x37f5('0x23')](function(_0x400bab){if(_0x400bab){_0x1eb0ee[_0x37f5('0x63')][_0x37f5('0x6c')]=_0x400bab['id'];return db[_0x37f5('0x6d')][_0x37f5('0x62')](_0x1eb0ee[_0x37f5('0x63')]);}})[_0x37f5('0x23')](respondWithResult(_0x1056b2,null))['catch'](handleError(_0x1056b2,null));};exports['getDispositions']=function(_0x5bca0,_0xf14e19,_0xe78a4){var _0x2c9c9b={'raw':![],'where':{}};var _0x4a45f6={};var _0x106476={'count':0x0,'rows':[]};return db[_0x37f5('0x45')][_0x37f5('0x6e')]({'where':{'id':_0x5bca0[_0x37f5('0x60')]['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0xf14e19,null))['then'](function(_0x1027f6){if(_0x1027f6){_0x4a45f6[_0x37f5('0x4d')]=_[_0x37f5('0x4b')](db[_0x37f5('0x6d')][_0x37f5('0x46')]);_0x4a45f6[_0x37f5('0x4a')]=_[_0x37f5('0x4b')](_0x5bca0['query']);_0x4a45f6[_0x37f5('0x55')]=_[_0x37f5('0x4c')](_0x4a45f6[_0x37f5('0x4d')],_0x4a45f6[_0x37f5('0x4a')]);_0x2c9c9b['attributes']=_[_0x37f5('0x4c')](_0x4a45f6['model'],qs[_0x37f5('0x4f')](_0x5bca0[_0x37f5('0x4a')][_0x37f5('0x4f')]));_0x2c9c9b['attributes']=_0x2c9c9b[_0x37f5('0x4e')][_0x37f5('0x50')]?_0x2c9c9b[_0x37f5('0x4e')]:_0x4a45f6[_0x37f5('0x4d')];if(!_0x5bca0[_0x37f5('0x4a')][_0x37f5('0x51')](_0x37f5('0x52'))){_0x2c9c9b['limit']=qs[_0x37f5('0x34')](_0x5bca0[_0x37f5('0x4a')][_0x37f5('0x34')]);_0x2c9c9b['offset']=qs[_0x37f5('0x33')](_0x5bca0[_0x37f5('0x4a')][_0x37f5('0x33')]);}_0x2c9c9b[_0x37f5('0x53')]=qs[_0x37f5('0x6f')](_0x5bca0[_0x37f5('0x4a')][_0x37f5('0x6f')]);_0x2c9c9b[_0x37f5('0x54')]=qs[_0x37f5('0x55')](_['pick'](_0x5bca0[_0x37f5('0x4a')],_0x4a45f6[_0x37f5('0x55')]));_0x2c9c9b[_0x37f5('0x54')][_0x37f5('0x6c')]=_0x1027f6['id'];if(_0x5bca0['query'][_0x37f5('0x57')]){_0x2c9c9b[_0x37f5('0x54')]=_[_0x37f5('0x58')](_0x2c9c9b['where'],{'$or':_[_0x37f5('0x44')](_0x2c9c9b[_0x37f5('0x4e')],function(_0x2f9655){var _0x342cab={};_0x342cab[_0x2f9655]={'$like':'%'+_0x5bca0[_0x37f5('0x4a')][_0x37f5('0x57')]+'%'};return _0x342cab;})});}_0x2c9c9b=_['merge']({},_0x2c9c9b,_0x5bca0[_0x37f5('0x59')]);return db[_0x37f5('0x6d')][_0x37f5('0x5a')]({'where':_0x2c9c9b[_0x37f5('0x54')]})[_0x37f5('0x23')](function(_0x251275){_0x106476[_0x37f5('0x5a')]=_0x251275;if(_0x5bca0[_0x37f5('0x4a')][_0x37f5('0x5b')]){_0x2c9c9b['include']=[{'all':!![]}];}return db[_0x37f5('0x6d')][_0x37f5('0x5d')](_0x2c9c9b);})[_0x37f5('0x23')](function(_0x4d5967){_0x106476['rows']=_0x4d5967;return _0x106476;});}})[_0x37f5('0x23')](respondWithFilteredResult(_0xf14e19,_0x2c9c9b))['catch'](handleError(_0xf14e19,null));};exports[_0x37f5('0x70')]=function(_0x568e9e,_0x179947,_0x125093){return db['FaxAccount'][_0x37f5('0x61')]({'where':{'id':_0x568e9e['params']['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0x179947,null))[_0x37f5('0x23')](function(_0x38dbdd){if(_0x38dbdd){return _0x38dbdd[_0x37f5('0x70')](_0x568e9e['query']['ids']);}})[_0x37f5('0x23')](respondWithStatusCode(_0x179947,null))[_0x37f5('0x2e')](handleError(_0x179947,null));};exports[_0x37f5('0x71')]=function(_0x174732,_0x464bf8,_0x41aac4){if(_0x174732[_0x37f5('0x63')]['id']){delete _0x174732['body']['id'];}return db['FaxAccount'][_0x37f5('0x61')]({'where':{'id':_0x174732[_0x37f5('0x60')]['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0x464bf8,null))[_0x37f5('0x23')](function(_0x2ba10c){if(_0x2ba10c){_0x174732[_0x37f5('0x63')][_0x37f5('0x6c')]=_0x2ba10c['id'];return db[_0x37f5('0x72')]['create'](_0x174732[_0x37f5('0x63')]);}})['then'](respondWithResult(_0x464bf8,null))[_0x37f5('0x2e')](handleError(_0x464bf8,null));};exports[_0x37f5('0x73')]=function(_0x56cb08,_0x58d285,_0x400366){var _0x4f09e4={'raw':![],'where':{}};var _0x32d565={};var _0x474d77={'count':0x0,'rows':[]};return db[_0x37f5('0x45')]['findOne']({'where':{'id':_0x56cb08[_0x37f5('0x60')]['id']}})['then'](handleEntityNotFound(_0x58d285,null))[_0x37f5('0x23')](function(_0x124738){if(_0x124738){_0x32d565[_0x37f5('0x4d')]=_[_0x37f5('0x4b')](db[_0x37f5('0x72')][_0x37f5('0x46')]);_0x32d565[_0x37f5('0x4a')]=_[_0x37f5('0x4b')](_0x56cb08[_0x37f5('0x4a')]);_0x32d565['filters']=_[_0x37f5('0x4c')](_0x32d565[_0x37f5('0x4d')],_0x32d565[_0x37f5('0x4a')]);_0x4f09e4[_0x37f5('0x4e')]=_[_0x37f5('0x4c')](_0x32d565[_0x37f5('0x4d')],qs['fields'](_0x56cb08[_0x37f5('0x4a')][_0x37f5('0x4f')]));_0x4f09e4[_0x37f5('0x4e')]=_0x4f09e4[_0x37f5('0x4e')][_0x37f5('0x50')]?_0x4f09e4[_0x37f5('0x4e')]:_0x32d565[_0x37f5('0x4d')];if(!_0x56cb08['query'][_0x37f5('0x51')]('nolimit')){_0x4f09e4[_0x37f5('0x34')]=qs[_0x37f5('0x34')](_0x56cb08[_0x37f5('0x4a')][_0x37f5('0x34')]);_0x4f09e4[_0x37f5('0x33')]=qs['offset'](_0x56cb08['query'][_0x37f5('0x33')]);}_0x4f09e4[_0x37f5('0x53')]=qs[_0x37f5('0x6f')](_0x56cb08['query']['sort']);_0x4f09e4[_0x37f5('0x54')]=qs[_0x37f5('0x55')](_[_0x37f5('0x56')](_0x56cb08[_0x37f5('0x4a')],_0x32d565[_0x37f5('0x55')]));_0x4f09e4['where'][_0x37f5('0x6c')]=_0x124738['id'];if(_0x56cb08[_0x37f5('0x4a')]['filter']){_0x4f09e4[_0x37f5('0x54')]=_[_0x37f5('0x58')](_0x4f09e4['where'],{'$or':_[_0x37f5('0x44')](_0x4f09e4[_0x37f5('0x4e')],function(_0x203f99){var _0x54f1a1={};_0x54f1a1[_0x203f99]={'$like':'%'+_0x56cb08['query'][_0x37f5('0x57')]+'%'};return _0x54f1a1;})});}_0x4f09e4=_[_0x37f5('0x58')]({},_0x4f09e4,_0x56cb08[_0x37f5('0x59')]);return db[_0x37f5('0x72')][_0x37f5('0x5a')]({'where':_0x4f09e4[_0x37f5('0x54')]})[_0x37f5('0x23')](function(_0x5c0634){_0x474d77[_0x37f5('0x5a')]=_0x5c0634;if(_0x56cb08[_0x37f5('0x4a')][_0x37f5('0x5b')]){_0x4f09e4[_0x37f5('0x5c')]=[{'all':!![]}];}return db['CannedAnswer'][_0x37f5('0x5d')](_0x4f09e4);})[_0x37f5('0x23')](function(_0x2d0d79){_0x474d77['rows']=_0x2d0d79;return _0x474d77;});}})['then'](respondWithFilteredResult(_0x58d285,_0x4f09e4))[_0x37f5('0x2e')](handleError(_0x58d285,null));};exports[_0x37f5('0x74')]=function(_0x35f830,_0x440541,_0x2c9888){return db['FaxAccount']['find']({'where':{'id':_0x35f830[_0x37f5('0x60')]['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0x440541,null))['then'](function(_0x15231d){if(_0x15231d){return _0x15231d[_0x37f5('0x74')](_0x35f830[_0x37f5('0x4a')]['ids']);}})[_0x37f5('0x23')](respondWithStatusCode(_0x440541,null))[_0x37f5('0x2e')](handleError(_0x440541,null));};exports['addInteraction']=function(_0x28f0fa,_0xdb7f55,_0x126fa8){return db['FaxInteraction']['find']({'where':{'id':_0x28f0fa[_0x37f5('0x60')]['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0xdb7f55,null))[_0x37f5('0x23')](function(_0x1ab000){if(_0x1ab000){return _0x1ab000[_0x37f5('0x75')](_0x28f0fa[_0x37f5('0x63')][_0x37f5('0x76')],_[_0x37f5('0x77')](_0x28f0fa[_0x37f5('0x63')],[_0x37f5('0x76'),'id'])||{});}})[_0x37f5('0x23')](respondWithResult(_0xdb7f55,null))['catch'](handleError(_0xdb7f55,null));};exports[_0x37f5('0x78')]=function(_0x330c8a,_0x5d4c2d,_0x361953){var _0x3e4fec={'raw':![],'where':{}};var _0x3de813={};var _0x3ffca0={'count':0x0,'rows':[]};return db[_0x37f5('0x45')][_0x37f5('0x6e')]({'where':{'id':_0x330c8a[_0x37f5('0x60')]['id']}})['then'](handleEntityNotFound(_0x5d4c2d,null))[_0x37f5('0x23')](function(_0x94c332){if(_0x94c332){_0x3de813[_0x37f5('0x4d')]=_[_0x37f5('0x4b')](db[_0x37f5('0x79')][_0x37f5('0x46')]);_0x3de813[_0x37f5('0x4a')]=_[_0x37f5('0x4b')](_0x330c8a[_0x37f5('0x4a')]);_0x3de813[_0x37f5('0x55')]=_[_0x37f5('0x4c')](_0x3de813['model'],_0x3de813[_0x37f5('0x4a')]);_0x3e4fec[_0x37f5('0x4e')]=_['intersection'](_0x3de813[_0x37f5('0x4d')],qs[_0x37f5('0x4f')](_0x330c8a[_0x37f5('0x4a')]['fields']));_0x3e4fec[_0x37f5('0x4e')]=_0x3e4fec[_0x37f5('0x4e')]['length']?_0x3e4fec[_0x37f5('0x4e')]:_0x3de813[_0x37f5('0x4d')];if(!_0x330c8a[_0x37f5('0x4a')][_0x37f5('0x51')](_0x37f5('0x52'))){_0x3e4fec[_0x37f5('0x34')]=qs[_0x37f5('0x34')](_0x330c8a[_0x37f5('0x4a')][_0x37f5('0x34')]);_0x3e4fec[_0x37f5('0x33')]=qs[_0x37f5('0x33')](_0x330c8a[_0x37f5('0x4a')]['offset']);}_0x3e4fec[_0x37f5('0x53')]=qs['sort'](_0x330c8a['query'][_0x37f5('0x6f')]);_0x3e4fec[_0x37f5('0x54')]=qs[_0x37f5('0x55')](_[_0x37f5('0x56')](_0x330c8a[_0x37f5('0x4a')],_0x3de813[_0x37f5('0x55')]));_0x3e4fec[_0x37f5('0x54')]['FaxAccountId']=_0x94c332['id'];if(_0x330c8a[_0x37f5('0x4a')][_0x37f5('0x57')]){_0x3e4fec['where']=_['merge'](_0x3e4fec['where'],{'$or':_[_0x37f5('0x44')](_0x3e4fec[_0x37f5('0x4e')],function(_0x32bc4c){var _0x5ad420={};_0x5ad420[_0x32bc4c]={'$like':'%'+_0x330c8a['query'][_0x37f5('0x57')]+'%'};return _0x5ad420;})});}_0x3e4fec=_[_0x37f5('0x58')]({},_0x3e4fec,_0x330c8a[_0x37f5('0x59')]);return db[_0x37f5('0x79')][_0x37f5('0x5a')]({'where':_0x3e4fec['where']})[_0x37f5('0x23')](function(_0x522842){_0x3ffca0[_0x37f5('0x5a')]=_0x522842;if(_0x330c8a[_0x37f5('0x4a')][_0x37f5('0x5b')]){_0x3e4fec[_0x37f5('0x5c')]=[{'model':db[_0x37f5('0x7a')],'as':'Contact','required':![]},{'model':db[_0x37f5('0x7b')],'as':_0x37f5('0x7c'),'attributes':[_0x37f5('0x3f'),_0x37f5('0x7d'),'internal'],'required':![]},{'model':db[_0x37f5('0x7e')],'as':'Tags','attributes':['id',_0x37f5('0x3f'),'color'],'where':_0x330c8a[_0x37f5('0x4a')]['tag']?{'id':_0x330c8a[_0x37f5('0x4a')][_0x37f5('0x7f')]}:undefined,'required':_0x330c8a[_0x37f5('0x4a')][_0x37f5('0x7f')]?!![]:![]}];}return db['FaxInteraction'][_0x37f5('0x5d')](_0x3e4fec);})[_0x37f5('0x23')](function(_0x6a73d6){_0x3ffca0[_0x37f5('0x5e')]=_0x6a73d6;return _0x3ffca0;});}})[_0x37f5('0x23')](respondWithFilteredResult(_0x5d4c2d,_0x3e4fec))[_0x37f5('0x2e')](handleError(_0x5d4c2d,null));};exports['addApplications']=function(_0x43cb0c,_0x48b84f,_0x55858e){return db['FaxAccount'][_0x37f5('0x6e')]({'where':{'id':_0x43cb0c['params']['id']}})['then'](handleEntityNotFound(_0x48b84f,null))[_0x37f5('0x23')](function(_0x5a1062){if(_0x5a1062){return db[_0x37f5('0x80')][_0x37f5('0x81')](function(_0x507626){return db[_0x37f5('0x82')][_0x37f5('0x3a')]({'where':{'FaxAccountId':_0x43cb0c['params']['id']},'transaction':_0x507626})[_0x37f5('0x23')](function(_0x3552db){var _0x468dcd=_[_0x37f5('0x44')](_0x43cb0c['body'],function(_0x43bfcb){_0x43bfcb[_0x37f5('0x6c')]=_0x43cb0c['params']['id'];return _0x43bfcb;});return db['FaxApplication']['bulkCreate'](_0x468dcd,{'transaction':_0x507626});});})[_0x37f5('0x23')](function(){return db[_0x37f5('0x82')][_0x37f5('0x83')]({'where':{'FaxAccountId':_0x43cb0c[_0x37f5('0x60')]['id']},'order':_0x37f5('0x84')});});}})[_0x37f5('0x23')](respondWithResult(_0x48b84f,null))[_0x37f5('0x2e')](handleError(_0x48b84f,null));};exports['getApplications']=function(_0x35eec4,_0x3ec6be,_0x5b8d7c){var _0x524b6b={};var _0x53044a={};var _0x4822ee;var _0x3f0c52;return db[_0x37f5('0x45')][_0x37f5('0x6e')]({'where':{'id':_0x35eec4[_0x37f5('0x60')]['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0x3ec6be,null))[_0x37f5('0x23')](function(_0x4161d2){if(_0x4161d2){_0x4822ee=_0x4161d2;_0x53044a[_0x37f5('0x4d')]=_[_0x37f5('0x4b')](db[_0x37f5('0x82')]['rawAttributes']);_0x53044a[_0x37f5('0x4a')]=_[_0x37f5('0x4b')](_0x35eec4[_0x37f5('0x4a')]);_0x53044a['filters']=_[_0x37f5('0x4c')](_0x53044a[_0x37f5('0x4d')],_0x53044a[_0x37f5('0x4a')]);_0x524b6b[_0x37f5('0x4e')]=_[_0x37f5('0x4c')](_0x53044a['model'],qs[_0x37f5('0x4f')](_0x35eec4[_0x37f5('0x4a')][_0x37f5('0x4f')]));_0x524b6b[_0x37f5('0x4e')]=_0x524b6b[_0x37f5('0x4e')][_0x37f5('0x50')]?_0x524b6b[_0x37f5('0x4e')]:_0x53044a[_0x37f5('0x4d')];_0x524b6b[_0x37f5('0x53')]=qs['sort'](_0x35eec4[_0x37f5('0x4a')][_0x37f5('0x6f')]);_0x524b6b[_0x37f5('0x54')]=qs['filters'](_['pick'](_0x35eec4['query'],_0x53044a[_0x37f5('0x55')]));if(_0x35eec4[_0x37f5('0x4a')]['filter']){_0x524b6b[_0x37f5('0x54')]=_[_0x37f5('0x58')](_0x524b6b[_0x37f5('0x54')],{'$or':_[_0x37f5('0x44')](_0x524b6b[_0x37f5('0x4e')],function(_0x8ceaa3){var _0x19cb6b={};_0x19cb6b[_0x8ceaa3]={'$like':'%'+_0x35eec4[_0x37f5('0x4a')][_0x37f5('0x57')]+'%'};return _0x19cb6b;})});}_0x524b6b=_[_0x37f5('0x58')]({},_0x524b6b,_0x35eec4[_0x37f5('0x59')]);return _0x4822ee[_0x37f5('0x85')](_0x524b6b);}})['then'](function(_0x24c668){if(_0x24c668){_0x3f0c52=_0x24c668[_0x37f5('0x50')];if(!_0x35eec4['query']['hasOwnProperty'](_0x37f5('0x52'))){_0x524b6b[_0x37f5('0x34')]=qs[_0x37f5('0x34')](_0x35eec4[_0x37f5('0x4a')]['limit']);_0x524b6b['offset']=qs[_0x37f5('0x33')](_0x35eec4['query'][_0x37f5('0x33')]);}return _0x4822ee[_0x37f5('0x85')](_0x524b6b);}})[_0x37f5('0x23')](function(_0x42f14b){if(_0x42f14b){return _0x42f14b?{'count':_0x3f0c52,'rows':_0x42f14b}:null;}})[_0x37f5('0x23')](respondWithResult(_0x3ec6be,null))[_0x37f5('0x2e')](handleError(_0x3ec6be,null));};function Extension(_0x50879d,_0x336925,_0x275960,_0x20c85e){this[_0x37f5('0x86')]=_0x37f5('0x87');this[_0x37f5('0x88')]=_0x50879d[_0x37f5('0x89')];this['app']=_0x20c85e;this[_0x37f5('0x48')]=_0x37f5('0x8a');this[_0x37f5('0x8b')]=_0x37f5('0x8c');this[_0x37f5('0x6c')]=_0x50879d['id'];this[_0x37f5('0x84')]=_0x336925;this['appdata']=_0x275960;}function createExtensionsReciveFax(_0x435c2f){var _0x58528a=0x1;var _0x561de7=[];_0x561de7['push'](new Extension(_0x435c2f,_0x58528a,'','Answer'));_0x58528a+=0x1;_0x561de7[_0x37f5('0x8d')](new Extension(_0x435c2f,_0x58528a,_0x37f5('0x8e'),_0x37f5('0x8f')));_0x58528a+=0x1;for(var _0x52ab8a in _0x435c2f){if(_0x435c2f[_0x37f5('0x51')](_0x52ab8a)&&(_0x52ab8a==='ecm'||_0x52ab8a===_0x37f5('0x89')||_0x52ab8a===_0x37f5('0x90')||_0x52ab8a===_0x37f5('0x91')||_0x52ab8a==='headerinfo'||_0x52ab8a===_0x37f5('0x92')||_0x52ab8a==='minrate'||_0x52ab8a===_0x37f5('0x93')||_0x52ab8a===_0x37f5('0x94'))){_0x561de7[_0x37f5('0x8d')](new Extension(_0x435c2f,_0x58528a,_0x37f5('0x95')+_0x52ab8a+')='+_0x435c2f[_0x52ab8a],_0x37f5('0x8f')));_0x58528a+=0x1;}}_0x561de7[_0x37f5('0x8d')](new Extension(_0x435c2f,_0x58528a,'6',_0x37f5('0x96')));_0x58528a+=0x1;_0x561de7['push'](new Extension(_0x435c2f,_0x58528a,_0x37f5('0x97'),_0x37f5('0x98')));_0x58528a=0x0;return _0x561de7;}exports[_0x37f5('0x99')]=function(_0x41f080,_0x251307,_0x5dbf63){var _0x250fc9;return db['sequelize']['transaction'](function(_0x2818c8){return db[_0x37f5('0x45')][_0x37f5('0x62')](_0x41f080['body'],{'transaction':_0x2818c8})['then'](function(_0x5b8ded){_0x250fc9=_0x5b8ded[_0x37f5('0x3b')]({'plain':!![]});return db[_0x37f5('0x9a')][_0x37f5('0x9b')](createExtensionsReciveFax(_0x250fc9),{'transaction':_0x2818c8});});})[_0x37f5('0x23')](function(){return _0x250fc9;})['then'](respondWithResult(_0x251307,null))[_0x37f5('0x2e')](handleError(_0x251307,null));};exports['updateAccountApplications']=function(_0x527cde,_0x53ba67,_0x330fb8){var _0x438339;return db[_0x37f5('0x80')][_0x37f5('0x81')](function(_0x36bef3){return db[_0x37f5('0x45')][_0x37f5('0x39')](_0x527cde[_0x37f5('0x63')],{'where':{'id':_0x527cde[_0x37f5('0x63')]['id']},'transaction':_0x36bef3})[_0x37f5('0x23')](function(_0x3e0b8a){return db['VoiceExtension']['destroy']({'where':{'FaxAccountId':_0x527cde['body']['id']},'transaction':_0x36bef3})[_0x37f5('0x23')](function(_0x2df5eb){return db[_0x37f5('0x9a')][_0x37f5('0x9b')](createExtensionsReciveFax(_['omit'](_0x527cde[_0x37f5('0x63')],[_0x37f5('0x9c'),'key',_0x37f5('0x9d'),_0x37f5('0x9e'),_0x37f5('0x9f'),_0x37f5('0xa0')])),{'transaction':_0x36bef3});});});})[_0x37f5('0x23')](function(){return db['FaxAccount'][_0x37f5('0xa1')](_0x527cde['body']['id']);})['then'](respondWithResult(_0x53ba67,null))[_0x37f5('0x2e')](handleError(_0x53ba67,null));};exports[_0x37f5('0xa2')]=function(_0x1ed3d2,_0x5a1e91,_0xf697ac){var _0x18c9b5={'raw':!![],'where':{}};var _0x982d26={};var _0x182199={'count':0x0,'rows':[]};return db[_0x37f5('0x45')]['findOne']({'where':{'id':_0x1ed3d2['params']['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0x5a1e91,null))[_0x37f5('0x23')](function(_0x2c4a50){if(_0x2c4a50){_0x982d26[_0x37f5('0x4d')]=_[_0x37f5('0x4b')](db[_0x37f5('0xa3')][_0x37f5('0x46')]);_0x982d26[_0x37f5('0x4a')]=_[_0x37f5('0x4b')](_0x1ed3d2[_0x37f5('0x4a')]);_0x982d26[_0x37f5('0x55')]=_[_0x37f5('0x4c')](_0x982d26[_0x37f5('0x4d')],_0x982d26['query']);_0x18c9b5[_0x37f5('0x4e')]=_['intersection'](_0x982d26[_0x37f5('0x4d')],qs[_0x37f5('0x4f')](_0x1ed3d2['query'][_0x37f5('0x4f')]));_0x18c9b5[_0x37f5('0x4e')]=_0x18c9b5[_0x37f5('0x4e')][_0x37f5('0x50')]?_0x18c9b5[_0x37f5('0x4e')]:_0x982d26['model'];if(!_0x1ed3d2[_0x37f5('0x4a')][_0x37f5('0x51')]('nolimit')){_0x18c9b5['limit']=qs['limit'](_0x1ed3d2['query'][_0x37f5('0x34')]);_0x18c9b5[_0x37f5('0x33')]=qs[_0x37f5('0x33')](_0x1ed3d2[_0x37f5('0x4a')][_0x37f5('0x33')]);}_0x18c9b5['order']=qs['sort'](_0x1ed3d2['query'][_0x37f5('0x6f')]);_0x18c9b5[_0x37f5('0x54')]=qs[_0x37f5('0x55')](_[_0x37f5('0x56')](_0x1ed3d2[_0x37f5('0x4a')],_0x982d26[_0x37f5('0x55')]));_0x18c9b5['where'][_0x37f5('0x6c')]=_0x2c4a50['id'];if(_0x1ed3d2['query'][_0x37f5('0x57')]){_0x18c9b5[_0x37f5('0x54')]=_['merge'](_0x18c9b5[_0x37f5('0x54')],{'$or':_[_0x37f5('0x44')](_0x18c9b5[_0x37f5('0x4e')],function(_0x1eb8ac){var _0x68d3f3={};_0x68d3f3[_0x1eb8ac]={'$like':'%'+_0x1ed3d2[_0x37f5('0x4a')][_0x37f5('0x57')]+'%'};return _0x68d3f3;})});}if(_0x1ed3d2[_0x37f5('0x4a')][_0x37f5('0xa4')]){var _0x1a139e=_0x1ed3d2[_0x37f5('0x4a')][_0x37f5('0xa4')][_0x37f5('0xa5')](',');var _0x532776={};_0x532776[_0x1a139e[0x0]]={'$gte':moment(_0x1a139e[0x1])[_0x37f5('0xa6')](_0x37f5('0xa7'))};_0x18c9b5[_0x37f5('0x54')]=_[_0x37f5('0x58')](_0x18c9b5[_0x37f5('0x54')],_0x532776);}_0x18c9b5=_[_0x37f5('0x58')]({},_0x18c9b5,_0x1ed3d2[_0x37f5('0x59')]);return db[_0x37f5('0xa3')][_0x37f5('0x5a')]({'where':_0x18c9b5[_0x37f5('0x54')]})[_0x37f5('0x23')](function(_0x3f2ac2){_0x182199[_0x37f5('0x5a')]=_0x3f2ac2;if(_0x1ed3d2[_0x37f5('0x4a')]['includeAll']){_0x18c9b5['include']=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x18c9b5);})[_0x37f5('0x23')](function(_0x5453c0){_0x182199[_0x37f5('0x5e')]=_0x5453c0;return _0x182199;});}})[_0x37f5('0x23')](respondWithFilteredResult(_0x5a1e91,_0x18c9b5))['catch'](handleError(_0x5a1e91,null));};exports[_0x37f5('0x40')]=function(_0x2c549c,_0x10b1ff,_0x5ca6dd){var _0x4d06d1,_0x52eae8={},_0x36b730;if(_0x2c549c[_0x37f5('0x63')]['to']){_0x36b730=_0x2c549c['body']['to'][0x0];}return db['FaxAccount']['find']({'where':{'id':_0x2c549c[_0x37f5('0x60')]['id']},'include':[{'model':db[_0x37f5('0xa8')],'as':_0x37f5('0xa9'),'include':[{'model':db[_0x37f5('0x7a')],'as':_0x37f5('0xaa'),'where':{'fax':_0x36b730},'limit':0x1,'order':[[_0x37f5('0x9e'),'DESC']]}]}]})['then'](handleEntityNotFound(_0x10b1ff,null))[_0x37f5('0x23')](function(_0x1052ad){_0x4d06d1=_0x1052ad;if(_0x2c549c[_0x37f5('0x63')][_0x37f5('0xab')]&&_0x2c549c['body'][_0x37f5('0xab')][_0x37f5('0x50')]){for(var _0x3ac2fd=0x0;_0x3ac2fd<_0x2c549c[_0x37f5('0x63')][_0x37f5('0xab')]['length'];_0x3ac2fd+=0x1){_0x2c549c['body']['attachments'][_0x3ac2fd]={'filename':_0x2c549c['body']['attachments'][_0x3ac2fd][_0x37f5('0x3f')],'id':_0x2c549c['body'][_0x37f5('0xab')][_0x3ac2fd]['id'],'path':path[_0x37f5('0xac')](config[_0x37f5('0xad')],'server/files/attachments',_0x2c549c['body']['attachments'][_0x3ac2fd][_0x37f5('0xae')])};}}return respondWithRpcPromise(_0x37f5('0xaf'),_0x37f5('0xaf'),{'FaxAccountId':_[_0x37f5('0xb0')](_0x2c549c[_0x37f5('0x60')]['id'])?undefined:_0x2c549c['params']['id'],'path':_[_0x37f5('0xb0')](_0x2c549c[_0x37f5('0x63')][_0x37f5('0xab')][0x0][_0x37f5('0xb1')])?undefined:_0x2c549c['body'][_0x37f5('0xab')][0x0][_0x37f5('0xb1')],'fax':_[_0x37f5('0xb0')](_0x2c549c[_0x37f5('0x63')]['to'][0x0])?undefined:_0x2c549c[_0x37f5('0x63')]['to'][0x0]},client9002);})[_0x37f5('0x23')](function(){if(_0x4d06d1){if(_[_0x37f5('0xb0')](_0x2c549c[_0x37f5('0x63')]['from'])){_0x2c549c['body'][_0x37f5('0xb2')]=util['format'](_0x37f5('0xb3'),_0x4d06d1[_0x37f5('0x3f')],_0x4d06d1[_0x37f5('0xb4')]);}if(_0x4d06d1[_0x37f5('0xa9')]){if(_0x4d06d1['List'][_0x37f5('0xaa')][_0x37f5('0x50')]){return _0x4d06d1['List'][_0x37f5('0xaa')][0x0];}else{return db[_0x37f5('0x7a')][_0x37f5('0x62')](_[_0x37f5('0x1d')](_0x2c549c[_0x37f5('0x63')],{'firstName':_0x2c549c['body']['to'][0x0],'phone':_0x2c549c[_0x37f5('0x63')]['to'][0x0],'fax':_0x2c549c[_0x37f5('0x63')]['to'][0x0],'ListId':_0x4d06d1['ListId']}));}}else{throw new Error(_0x37f5('0xb5'));}}else{throw new Error(_0x37f5('0xb6'));}})[_0x37f5('0x23')](function(_0x428c4d){if(_0x428c4d){return db[_0x37f5('0x79')][_0x37f5('0x61')]({'where':{'ContactId':_0x428c4d['id'],'closed':![],'FaxAccountId':_0x4d06d1['id']}})[_0x37f5('0x23')](function(_0x3e6788){if(_0x3e6788){return[_0x3e6788,![]];}return db['FaxInteraction'][_0x37f5('0x62')]({'UserId':_0x2c549c[_0x37f5('0x64')]['id'],'ContactId':_0x428c4d['id'],'FaxAccountId':_0x4d06d1['id'],'fax':_0x2c549c[_0x37f5('0x63')]['to'][0x0],'firstMsgDirection':_0x37f5('0xb7'),'Messages':[_['merge'](_0x2c549c[_0x37f5('0x63')],{'read':![],'body':_0x2c549c[_0x37f5('0x63')]['attachments'][0x0]['filename'],'FaxAccountId':_0x4d06d1['id'],'UserId':_0x2c549c['user']['id'],'ContactId':_0x428c4d['id'],'AttachmentId':_0x2c549c['body']['attachments'][0x0]['id']})]},{'include':[{'model':db[_0x37f5('0xa3')],'as':_0x37f5('0xb8')}]})[_0x37f5('0x23')](function(_0x583eb1){return[_0x583eb1,!![]];});});}else{throw new Error(_0x37f5('0xb9'));}})[_0x37f5('0xba')](function(_0x59c1e2,_0x301d8c){if(_0x301d8c){return _0x59c1e2;}return db[_0x37f5('0xa3')][_0x37f5('0x62')]({'direction':_0x37f5('0xb7'),'read':![],'body':_0x2c549c['body'][_0x37f5('0xab')][0x0][_0x37f5('0xbb')],'FaxAccountId':_0x4d06d1['id'],'FaxInteractionId':_0x59c1e2['id'],'UserId':_0x2c549c[_0x37f5('0x64')]['id'],'ContactId':_0x59c1e2[_0x37f5('0xbc')],'AttachmentId':_0x2c549c[_0x37f5('0x63')][_0x37f5('0xab')][0x0]['id']})[_0x37f5('0x23')](function(_0x529ebf){_0x59c1e2['dataValues'][_0x37f5('0xb8')]=[];_0x59c1e2[_0x37f5('0xbd')][_0x37f5('0xb8')]['push'](_0x529ebf['dataValues']);return _0x59c1e2;});})['then'](function(_0x4332db){respondWithRpcPromise(_0x37f5('0xbe'),_0x37f5('0xbe'),{'FaxAccountId':_[_0x37f5('0xb0')](_0x2c549c[_0x37f5('0x60')]['id'])?undefined:_0x2c549c[_0x37f5('0x60')]['id'],'path':_[_0x37f5('0xb0')](_0x2c549c[_0x37f5('0x63')]['attachments'][0x0]['path'])?undefined:_0x2c549c[_0x37f5('0x63')][_0x37f5('0xab')][0x0][_0x37f5('0xb1')],'fax':_['isNil'](_0x2c549c[_0x37f5('0x63')]['to'][0x0])?undefined:_0x2c549c[_0x37f5('0x63')]['to'][0x0],'AttachmentId':_0x2c549c[_0x37f5('0x63')][_0x37f5('0xab')][0x0]['id']},client9002)[_0x37f5('0x23')](function(_0x388b2a){logger[_0x37f5('0x24')](_0x37f5('0xbf'),_0x388b2a);})[_0x37f5('0x2e')](function(_0x1196f1){logger[_0x37f5('0x24')](_0x37f5('0xbf'),_0x1196f1);});return _0x4332db;})[_0x37f5('0x23')](respondWithResult(_0x10b1ff,null))[_0x37f5('0x2e')](handleError(_0x10b1ff,null));};exports['addAgents']=function(_0x243b24,_0x10c0a3,_0x110303){return db[_0x37f5('0x45')][_0x37f5('0x61')]({'where':{'id':_0x243b24['params']['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0x10c0a3,null))[_0x37f5('0x23')](function(_0x2fdf8f){if(_0x2fdf8f){return _0x2fdf8f[_0x37f5('0xc0')](_0x243b24['body'][_0x37f5('0x76')],_[_0x37f5('0x77')](_0x243b24['body'],[_0x37f5('0x76'),'id'])||{})[_0x37f5('0xba')](function(_0x4e8e8f){for(var _0x21f362=0x0;_0x21f362<_0x243b24[_0x37f5('0x63')][_0x37f5('0x76')][_0x37f5('0x50')];_0x21f362+=0x1){socket[_0x37f5('0xc1')](_0x37f5('0xc2'),{'UserId':Number(_0x243b24[_0x37f5('0x63')][_0x37f5('0x76')][_0x21f362]),'FaxAccountId':Number(_0x243b24[_0x37f5('0x60')]['id'])});}return _0x4e8e8f;});}})[_0x37f5('0x23')](respondWithResult(_0x10c0a3,null))['catch'](handleError(_0x10c0a3,null));};exports[_0x37f5('0xc3')]=function(_0x391311,_0x3872e6,_0xe761d){return db[_0x37f5('0x45')][_0x37f5('0x61')]({'where':{'id':_0x391311[_0x37f5('0x60')]['id']}})['then'](handleEntityNotFound(_0x3872e6,null))[_0x37f5('0x23')](function(_0xbbdd42){if(_0xbbdd42){return _0xbbdd42['removeAgents'](_0x391311[_0x37f5('0x4a')][_0x37f5('0x76')])[_0x37f5('0x23')](function(){if(_[_0x37f5('0xc4')](_0x391311[_0x37f5('0x4a')]['ids'])){for(var _0x3d763a=0x0;_0x3d763a<_0x391311['query']['ids'][_0x37f5('0x50')];_0x3d763a+=0x1){socket['emit'](_0x37f5('0xc5'),{'UserId':Number(_0x391311[_0x37f5('0x4a')][_0x37f5('0x76')][_0x3d763a]),'FaxAccountId':Number(_0x391311[_0x37f5('0x60')]['id'])});}}else{socket[_0x37f5('0xc1')](_0x37f5('0xc5'),{'UserId':Number(_0x391311[_0x37f5('0x4a')][_0x37f5('0x76')]),'FaxAccountId':Number(_0x391311['params']['id'])});}});}})[_0x37f5('0x23')](respondWithStatusCode(_0x3872e6,null))[_0x37f5('0x2e')](handleError(_0x3872e6,null));};exports[_0x37f5('0xc6')]=function(_0x34f23b,_0x24b90a,_0x35b613){var _0x4f327f={};var _0x538a14={};var _0x26c705;var _0x526967;return db['FaxAccount'][_0x37f5('0x6e')]({'where':{'id':_0x34f23b[_0x37f5('0x60')]['id']}})[_0x37f5('0x23')](handleEntityNotFound(_0x24b90a,null))['then'](function(_0x5fe13c){if(_0x5fe13c){_0x26c705=_0x5fe13c;_0x538a14[_0x37f5('0x4d')]=_['keys'](db[_0x37f5('0x7b')][_0x37f5('0x46')]);_0x538a14['query']=_[_0x37f5('0x4b')](_0x34f23b['query']);_0x538a14['filters']=_[_0x37f5('0x4c')](_0x538a14[_0x37f5('0x4d')],_0x538a14[_0x37f5('0x4a')]);_0x4f327f[_0x37f5('0x4e')]=_['intersection'](_0x538a14[_0x37f5('0x4d')],qs[_0x37f5('0x4f')](_0x34f23b[_0x37f5('0x4a')]['fields']));_0x4f327f[_0x37f5('0x4e')]=_0x4f327f[_0x37f5('0x4e')][_0x37f5('0x50')]?_0x4f327f['attributes']:_0x538a14[_0x37f5('0x4d')];_0x4f327f['order']=qs[_0x37f5('0x6f')](_0x34f23b[_0x37f5('0x4a')][_0x37f5('0x6f')]);_0x4f327f['where']=qs['filters'](_[_0x37f5('0x56')](_0x34f23b[_0x37f5('0x4a')],_0x538a14[_0x37f5('0x55')]));if(_0x34f23b[_0x37f5('0x4a')]['filter']){_0x4f327f[_0x37f5('0x54')]=_[_0x37f5('0x58')](_0x4f327f[_0x37f5('0x54')],{'$or':_[_0x37f5('0x44')](_0x4f327f['attributes'],function(_0x207e9b){var _0x2d5d66={};_0x2d5d66[_0x207e9b]={'$like':'%'+_0x34f23b['query'][_0x37f5('0x57')]+'%'};return _0x2d5d66;})});}_0x4f327f=_[_0x37f5('0x58')]({},_0x4f327f,_0x34f23b[_0x37f5('0x59')]);return _0x26c705[_0x37f5('0xc6')](_0x4f327f);}})['then'](function(_0x4d2341){if(_0x4d2341){_0x526967=_0x4d2341['length'];if(!_0x34f23b[_0x37f5('0x4a')][_0x37f5('0x51')]('nolimit')){_0x4f327f[_0x37f5('0x34')]=qs[_0x37f5('0x34')](_0x34f23b['query'][_0x37f5('0x34')]);_0x4f327f[_0x37f5('0x33')]=qs['offset'](_0x34f23b[_0x37f5('0x4a')][_0x37f5('0x33')]);}return _0x26c705['getAgents'](_0x4f327f);}})[_0x37f5('0x23')](function(_0x2bee6d){if(_0x2bee6d){return _0x2bee6d?{'count':_0x526967,'rows':_0x2bee6d}:null;}})[_0x37f5('0x23')](respondWithResult(_0x24b90a,null))[_0x37f5('0x2e')](handleError(_0x24b90a,null));}; \ No newline at end of file +var _0x690c=['includeAll','rows','removeDispositions','ids','CannedAnswer','getAnswers','order','addInteraction','FaxInteraction','omit','getInteractions','findOne','CmContact','Contact','Owner','fullname','Tag','Tags','color','tag','addApplications','sequelize','FaxApplication','bulkCreate','findAndCountAll','getApplications','context','from-voip-provider','exten','localstationid','app','type','system','description','Fax\x20Extension','priority','appdata','push','Answer','Set','headerinfo','maxrate','minrate','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','addAccountApplications','transaction','VoiceExtension','updateAccountApplications','tech','createdAt','updatedAt','TrunkId','findById','FaxMessage','split','YYYY-MM-DD\x20HH:mm:ss','CmList','Contacts','DESC','attachments','join','root','server/files/attachments','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List','ListId','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','Messages','Contact\x20not\x20found','spread','dataValues','SendFax','SendFaxRpc,\x20%s','addAgents','emit','userFaxAccount:save','removeAgents','isArray','userFaxAccount:remove','User','getAgents','eml-format','zip-dir','bluebird','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','redis','defaults','socket.io-emitter','./faxAccount.socket','register','jayson/promise','client','http','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','undefined','count','offset','set','Content-Range','apply','update','get','FaxAccounts','UserProfileResource','destroy','name','send','mandatoryDispositionPause','map','rawAttributes','fieldName','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','filter','merge','VIRTUAL','options','FaxAccount','include','findAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','body','params','Pause','describe','addDisposition','FaxAccountId','Disposition'];(function(_0x526f01,_0x2f0ddd){var _0x4def12=function(_0x2ea82b){while(--_0x2ea82b){_0x526f01['push'](_0x526f01['shift']());}};_0x4def12(++_0x2f0ddd);}(_0x690c,0x1d2));var _0xc690=function(_0x4bd335,_0x3b47a3){_0x4bd335=_0x4bd335-0x0;var _0x3e3adf=_0x690c[_0x4bd335];return _0x3e3adf;};'use strict';var emlformat=require(_0xc690('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc690('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc690('0x2'));var Mustache=require('mustache');var util=require(_0xc690('0x3'));var path=require(_0xc690('0x4'));var sox=require(_0xc690('0x5'));var csv=require('to-csv');var ejs=require(_0xc690('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc690('0x7'));var squel=require(_0xc690('0x8'));var crypto=require(_0xc690('0x9'));var jsforce=require(_0xc690('0xa'));var deskjs=require(_0xc690('0xb'));var toCsv=require(_0xc690('0xc'));var querystring=require(_0xc690('0xd'));var Papa=require('papaparse');var Redis=require(_0xc690('0xe'));var authService=require(_0xc690('0xf'));var qs=require(_0xc690('0x10'));var as=require(_0xc690('0x11'));var hardwareService=require(_0xc690('0x12'));var logger=require(_0xc690('0x13'))(_0xc690('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc690('0x15'));var db=require('../../mysqldb')['db'];config[_0xc690('0x16')]=_[_0xc690('0x17')](config[_0xc690('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc690('0x18'))(new Redis(config[_0xc690('0x16')]));require(_0xc690('0x19'))[_0xc690('0x1a')](socket);var jayson=require(_0xc690('0x1b'));var client=jayson[_0xc690('0x1c')][_0xc690('0x1d')]({'port':0x232c});var client9002=jayson[_0xc690('0x1c')][_0xc690('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x32dd51,_0x396852,_0x4b6741,_0xeb79c6){return new BPromise(function(_0x256ab7,_0x1a2e65){var _0xbdb5f=_0xeb79c6||client;return _0xbdb5f['request'](_0x32dd51,_0x4b6741)[_0xc690('0x1e')](function(_0xb1fac3){logger[_0xc690('0x1f')](_0xc690('0x20'),_0x396852,_0xc690('0x21'));logger[_0xc690('0x22')](_0xc690('0x23'),_0x396852,_0xc690('0x21'),JSON[_0xc690('0x24')](_0xb1fac3));if(_0xb1fac3[_0xc690('0x25')]){if(_0xb1fac3[_0xc690('0x25')][_0xc690('0x26')]===0x1f4){logger[_0xc690('0x25')](_0xc690('0x20'),_0x396852,_0xb1fac3[_0xc690('0x25')][_0xc690('0x27')]);return _0x1a2e65(_0xb1fac3['error'][_0xc690('0x27')]);}logger[_0xc690('0x25')]('FaxAccount,\x20%s,\x20%s',_0x396852,_0xb1fac3[_0xc690('0x25')][_0xc690('0x27')]);return _0x256ab7(_0xb1fac3[_0xc690('0x25')][_0xc690('0x27')]);}else{logger[_0xc690('0x1f')](_0xc690('0x20'),_0x396852,_0xc690('0x21'));_0x256ab7(_0xb1fac3[_0xc690('0x28')]['message']);}})[_0xc690('0x29')](function(_0x2bd8e2){logger[_0xc690('0x25')](_0xc690('0x20'),_0x396852,_0x2bd8e2);_0x1a2e65(_0x2bd8e2);});});}function respondWithStatusCode(_0x30bb8e,_0x1239b7){_0x1239b7=_0x1239b7||0xcc;return function(_0x122999){if(_0x122999){return _0x30bb8e[_0xc690('0x2a')](_0x1239b7);}return _0x30bb8e[_0xc690('0x2b')](_0x1239b7)[_0xc690('0x2c')]();};}function respondWithResult(_0x2f4d18,_0x5c712d){_0x5c712d=_0x5c712d||0xc8;return function(_0x221201){if(_0x221201){return _0x2f4d18['status'](_0x5c712d)[_0xc690('0x2d')](_0x221201);}};}function respondWithFilteredResult(_0x2b8e53,_0x41dd0b){return function(_0x39c0b9){if(_0x39c0b9){var _0x39e9d1=typeof _0x41dd0b['offset']===_0xc690('0x2e')&&typeof _0x41dd0b['limit']===_0xc690('0x2e');var _0x215d2d=_0x39c0b9[_0xc690('0x2f')];var _0x126517=_0x39e9d1?0x0:_0x41dd0b[_0xc690('0x30')];var _0x524a13=_0x39e9d1?_0x39c0b9[_0xc690('0x2f')]:_0x41dd0b[_0xc690('0x30')]+_0x41dd0b['limit'];var _0x4d7b62;if(_0x524a13>=_0x215d2d){_0x524a13=_0x215d2d;_0x4d7b62=0xc8;}else{_0x4d7b62=0xce;}_0x2b8e53[_0xc690('0x2b')](_0x4d7b62);return _0x2b8e53[_0xc690('0x31')](_0xc690('0x32'),_0x126517+'-'+_0x524a13+'/'+_0x215d2d)[_0xc690('0x2d')](_0x39c0b9);}return null;};}function patchUpdates(_0x35d8e2){return function(_0x4e9f8a){try{jsonpatch[_0xc690('0x33')](_0x4e9f8a,_0x35d8e2,!![]);}catch(_0x3b3293){return BPromise['reject'](_0x3b3293);}return _0x4e9f8a['save']();};}function saveUpdates(_0x374725,_0x27ab03){return function(_0x395651){if(_0x395651){return _0x395651[_0xc690('0x34')](_0x374725)['then'](function(_0x4dd9ba){return _0x4dd9ba;});}return null;};}function removeEntity(_0x29ec05,_0x361363){return function(_0x29f8dc){if(_0x29f8dc){return _0x29f8dc['destroy']()['then'](function(){var _0x273edd=_0x29f8dc[_0xc690('0x35')]({'plain':!![]});var _0x15f9f5=_0xc690('0x36');return db[_0xc690('0x37')][_0xc690('0x38')]({'where':{'type':_0x15f9f5,'resourceId':_0x273edd['id']}})['then'](function(){return _0x29f8dc;});})[_0xc690('0x1e')](function(){_0x29ec05['status'](0xcc)[_0xc690('0x2c')]();});}};}function handleEntityNotFound(_0x3339c0,_0x56a6bb){return function(_0x5f5a27){if(!_0x5f5a27){_0x3339c0[_0xc690('0x2a')](0x194);}return _0x5f5a27;};}function handleError(_0x38c714,_0x560133){_0x560133=_0x560133||0x1f4;return function(_0x4c7a4f){logger[_0xc690('0x25')](_0x4c7a4f['stack']);if(_0x4c7a4f[_0xc690('0x39')]){delete _0x4c7a4f[_0xc690('0x39')];}_0x38c714['status'](_0x560133)[_0xc690('0x3a')](_0x4c7a4f);};}exports['index']=function(_0x228ff3,_0xc88834){var _0x457208={'include':[{'model':db['Pause'],'as':_0xc690('0x3b')}]},_0x7f940e={},_0x4ee678={'count':0x0,'rows':[]};var _0x5da106=_[_0xc690('0x3c')](db['FaxAccount'][_0xc690('0x3d')],function(_0x5e6769){return{'name':_0x5e6769[_0xc690('0x3e')],'type':_0x5e6769['type'][_0xc690('0x3f')]};});_0x7f940e[_0xc690('0x40')]=_['map'](_0x5da106,_0xc690('0x39'));_0x7f940e['query']=_[_0xc690('0x41')](_0x228ff3[_0xc690('0x42')]);_0x7f940e[_0xc690('0x43')]=_[_0xc690('0x44')](_0x7f940e[_0xc690('0x40')],_0x7f940e[_0xc690('0x42')]);_0x457208[_0xc690('0x45')]=_[_0xc690('0x44')](_0x7f940e[_0xc690('0x40')],qs[_0xc690('0x46')](_0x228ff3[_0xc690('0x42')]['fields']));_0x457208['attributes']=_0x457208[_0xc690('0x45')][_0xc690('0x47')]?_0x457208[_0xc690('0x45')]:_0x7f940e[_0xc690('0x40')];if(!_0x228ff3['query'][_0xc690('0x48')](_0xc690('0x49'))){_0x457208[_0xc690('0x4a')]=qs['limit'](_0x228ff3['query'][_0xc690('0x4a')]);_0x457208[_0xc690('0x30')]=qs[_0xc690('0x30')](_0x228ff3['query'][_0xc690('0x30')]);}_0x457208['order']=qs[_0xc690('0x4b')](_0x228ff3['query'][_0xc690('0x4b')]);_0x457208[_0xc690('0x4c')]=qs[_0xc690('0x43')](_[_0xc690('0x4d')](_0x228ff3[_0xc690('0x42')],_0x7f940e[_0xc690('0x43')]),_0x5da106);if(_0x228ff3[_0xc690('0x42')][_0xc690('0x4e')]){_0x457208[_0xc690('0x4c')]=_[_0xc690('0x4f')](_0x457208['where'],{'$or':_[_0xc690('0x3c')](_0x5da106,function(_0x3afd0c){if(_0x3afd0c['type']!==_0xc690('0x50')){var _0x1d2638={};_0x1d2638[_0x3afd0c['name']]={'$like':'%'+_0x228ff3[_0xc690('0x42')][_0xc690('0x4e')]+'%'};return _0x1d2638;}})});}_0x457208=_[_0xc690('0x4f')]({},_0x457208,_0x228ff3[_0xc690('0x51')]);var _0x5194d4={'where':_0x457208['where']};return db[_0xc690('0x52')][_0xc690('0x2f')](_0x5194d4)['then'](function(_0x3c5620){_0x4ee678[_0xc690('0x2f')]=_0x3c5620;if(_0x228ff3[_0xc690('0x42')]['includeAll']){_0x457208[_0xc690('0x53')]=[{'all':!![]}];}return db['FaxAccount'][_0xc690('0x54')](_0x457208);})['then'](function(_0x308143){_0x4ee678['rows']=_0x308143;return _0x4ee678;})[_0xc690('0x1e')](respondWithFilteredResult(_0xc88834,_0x457208))['catch'](handleError(_0xc88834,null));};exports['show']=function(_0x322fb7,_0x4a888f){var _0x199d39={'raw':![],'where':{'id':_0x322fb7['params']['id']},'include':[{'model':db['Pause'],'as':_0xc690('0x3b')}]},_0xad70d1={};_0xad70d1[_0xc690('0x40')]=_[_0xc690('0x41')](db[_0xc690('0x52')]['rawAttributes']);_0xad70d1[_0xc690('0x42')]=_[_0xc690('0x41')](_0x322fb7['query']);_0xad70d1['filters']=_[_0xc690('0x44')](_0xad70d1[_0xc690('0x40')],_0xad70d1[_0xc690('0x42')]);_0x199d39[_0xc690('0x45')]=_[_0xc690('0x44')](_0xad70d1[_0xc690('0x40')],qs['fields'](_0x322fb7['query']['fields']));_0x199d39[_0xc690('0x45')]=_0x199d39[_0xc690('0x45')][_0xc690('0x47')]?_0x199d39[_0xc690('0x45')]:_0xad70d1['model'];if(_0x322fb7[_0xc690('0x42')]['includeAll']){_0x199d39[_0xc690('0x53')]=[{'all':!![]}];}_0x199d39=_[_0xc690('0x4f')]({},_0x199d39,_0x322fb7['options']);return db[_0xc690('0x52')][_0xc690('0x55')](_0x199d39)[_0xc690('0x1e')](handleEntityNotFound(_0x4a888f,null))[_0xc690('0x1e')](respondWithResult(_0x4a888f,null))[_0xc690('0x29')](handleError(_0x4a888f,null));};exports[_0xc690('0x56')]=function(_0x5c642d,_0x3c9b68){return db[_0xc690('0x52')][_0xc690('0x56')](_0x5c642d['body'],{})[_0xc690('0x1e')](function(_0x2558a2){var _0x28b182=_0x5c642d[_0xc690('0x57')]['get']({'plain':!![]});if(!_0x28b182)throw new Error(_0xc690('0x58'));if(_0x28b182[_0xc690('0x59')]===_0xc690('0x57')){var _0x2c5c18=_0x2558a2[_0xc690('0x35')]({'plain':!![]});var _0x358563=_0xc690('0x36');return db['UserProfileSection'][_0xc690('0x55')]({'where':{'name':_0x358563,'userProfileId':_0x28b182[_0xc690('0x5a')]},'raw':!![]})['then'](function(_0x30aa6b){if(_0x30aa6b&&_0x30aa6b['autoAssociation']===0x0){return db[_0xc690('0x37')][_0xc690('0x56')]({'name':_0x2c5c18[_0xc690('0x39')],'resourceId':_0x2c5c18['id'],'type':_0x30aa6b[_0xc690('0x39')],'sectionId':_0x30aa6b['id']},{})['then'](function(){return _0x2558a2;});}else{return _0x2558a2;}})[_0xc690('0x29')](function(_0x23ad93){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x23ad93);throw _0x23ad93;});}return _0x2558a2;})[_0xc690('0x1e')](respondWithResult(_0x3c9b68,0xc9))['catch'](handleError(_0x3c9b68,null));};exports[_0xc690('0x34')]=function(_0xcd44ca,_0x4499e6){if(_0xcd44ca[_0xc690('0x5b')]['id']){delete _0xcd44ca[_0xc690('0x5b')]['id'];}return db[_0xc690('0x52')][_0xc690('0x55')]({'where':{'id':_0xcd44ca[_0xc690('0x5c')]['id']},'include':[{'model':db[_0xc690('0x5d')],'as':_0xc690('0x3b')}]})[_0xc690('0x1e')](handleEntityNotFound(_0x4499e6,null))[_0xc690('0x1e')](saveUpdates(_0xcd44ca[_0xc690('0x5b')],null))[_0xc690('0x1e')](respondWithResult(_0x4499e6,null))[_0xc690('0x29')](handleError(_0x4499e6,null));};exports[_0xc690('0x38')]=function(_0x540866,_0x27f7df){return db[_0xc690('0x52')][_0xc690('0x55')]({'where':{'id':_0x540866[_0xc690('0x5c')]['id']}})[_0xc690('0x1e')](handleEntityNotFound(_0x27f7df,null))[_0xc690('0x1e')](removeEntity(_0x27f7df,null))['catch'](handleError(_0x27f7df,null));};exports[_0xc690('0x5e')]=function(_0x3b7867,_0x244de1){return db['FaxAccount'][_0xc690('0x5e')]()['then'](respondWithResult(_0x244de1,null))[_0xc690('0x29')](handleError(_0x244de1,null));};exports[_0xc690('0x5f')]=function(_0xb643e8,_0x559ac6,_0x333193){if(_0xb643e8['body']['id']){delete _0xb643e8['body']['id'];}return db[_0xc690('0x52')][_0xc690('0x55')]({'where':{'id':_0xb643e8[_0xc690('0x5c')]['id']}})[_0xc690('0x1e')](handleEntityNotFound(_0x559ac6,null))['then'](function(_0x961162){if(_0x961162){_0xb643e8[_0xc690('0x5b')][_0xc690('0x60')]=_0x961162['id'];return db['Disposition'][_0xc690('0x56')](_0xb643e8[_0xc690('0x5b')]);}})[_0xc690('0x1e')](respondWithResult(_0x559ac6,null))['catch'](handleError(_0x559ac6,null));};exports['getDispositions']=function(_0x7aa8e0,_0x3f6f60,_0xa47713){var _0x47cd9d={'raw':![],'where':{}};var _0x58a4ad={};var _0x44677f={'count':0x0,'rows':[]};return db[_0xc690('0x52')]['findOne']({'where':{'id':_0x7aa8e0[_0xc690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3f6f60,null))[_0xc690('0x1e')](function(_0x5b4f40){if(_0x5b4f40){_0x58a4ad['model']=_[_0xc690('0x41')](db[_0xc690('0x61')][_0xc690('0x3d')]);_0x58a4ad[_0xc690('0x42')]=_[_0xc690('0x41')](_0x7aa8e0[_0xc690('0x42')]);_0x58a4ad[_0xc690('0x43')]=_[_0xc690('0x44')](_0x58a4ad[_0xc690('0x40')],_0x58a4ad[_0xc690('0x42')]);_0x47cd9d[_0xc690('0x45')]=_[_0xc690('0x44')](_0x58a4ad[_0xc690('0x40')],qs[_0xc690('0x46')](_0x7aa8e0[_0xc690('0x42')][_0xc690('0x46')]));_0x47cd9d[_0xc690('0x45')]=_0x47cd9d['attributes'][_0xc690('0x47')]?_0x47cd9d[_0xc690('0x45')]:_0x58a4ad[_0xc690('0x40')];if(!_0x7aa8e0[_0xc690('0x42')][_0xc690('0x48')]('nolimit')){_0x47cd9d[_0xc690('0x4a')]=qs['limit'](_0x7aa8e0[_0xc690('0x42')][_0xc690('0x4a')]);_0x47cd9d[_0xc690('0x30')]=qs[_0xc690('0x30')](_0x7aa8e0[_0xc690('0x42')][_0xc690('0x30')]);}_0x47cd9d['order']=qs[_0xc690('0x4b')](_0x7aa8e0[_0xc690('0x42')][_0xc690('0x4b')]);_0x47cd9d[_0xc690('0x4c')]=qs[_0xc690('0x43')](_['pick'](_0x7aa8e0['query'],_0x58a4ad[_0xc690('0x43')]));_0x47cd9d[_0xc690('0x4c')]['FaxAccountId']=_0x5b4f40['id'];if(_0x7aa8e0['query'][_0xc690('0x4e')]){_0x47cd9d[_0xc690('0x4c')]=_['merge'](_0x47cd9d[_0xc690('0x4c')],{'$or':_[_0xc690('0x3c')](_0x47cd9d[_0xc690('0x45')],function(_0x36e296){var _0x42eea5={};_0x42eea5[_0x36e296]={'$like':'%'+_0x7aa8e0[_0xc690('0x42')][_0xc690('0x4e')]+'%'};return _0x42eea5;})});}_0x47cd9d=_[_0xc690('0x4f')]({},_0x47cd9d,_0x7aa8e0[_0xc690('0x51')]);return db[_0xc690('0x61')][_0xc690('0x2f')]({'where':_0x47cd9d[_0xc690('0x4c')]})[_0xc690('0x1e')](function(_0x44a013){_0x44677f['count']=_0x44a013;if(_0x7aa8e0['query'][_0xc690('0x62')]){_0x47cd9d[_0xc690('0x53')]=[{'all':!![]}];}return db[_0xc690('0x61')]['findAll'](_0x47cd9d);})[_0xc690('0x1e')](function(_0x5cd07d){_0x44677f[_0xc690('0x63')]=_0x5cd07d;return _0x44677f;});}})[_0xc690('0x1e')](respondWithFilteredResult(_0x3f6f60,_0x47cd9d))[_0xc690('0x29')](handleError(_0x3f6f60,null));};exports[_0xc690('0x64')]=function(_0x5407a8,_0x2c4dd5,_0x35048a){return db[_0xc690('0x52')][_0xc690('0x55')]({'where':{'id':_0x5407a8['params']['id']}})[_0xc690('0x1e')](handleEntityNotFound(_0x2c4dd5,null))[_0xc690('0x1e')](function(_0xfff84c){if(_0xfff84c){return _0xfff84c[_0xc690('0x64')](_0x5407a8[_0xc690('0x42')][_0xc690('0x65')]);}})[_0xc690('0x1e')](respondWithStatusCode(_0x2c4dd5,null))[_0xc690('0x29')](handleError(_0x2c4dd5,null));};exports['addAnswer']=function(_0x50c82a,_0x34ea54,_0x303459){if(_0x50c82a[_0xc690('0x5b')]['id']){delete _0x50c82a[_0xc690('0x5b')]['id'];}return db['FaxAccount'][_0xc690('0x55')]({'where':{'id':_0x50c82a['params']['id']}})[_0xc690('0x1e')](handleEntityNotFound(_0x34ea54,null))[_0xc690('0x1e')](function(_0xad2ee2){if(_0xad2ee2){_0x50c82a[_0xc690('0x5b')][_0xc690('0x60')]=_0xad2ee2['id'];return db[_0xc690('0x66')]['create'](_0x50c82a[_0xc690('0x5b')]);}})[_0xc690('0x1e')](respondWithResult(_0x34ea54,null))[_0xc690('0x29')](handleError(_0x34ea54,null));};exports[_0xc690('0x67')]=function(_0x98a84f,_0x392fc3,_0x34a716){var _0x52aee5={'raw':![],'where':{}};var _0x1c3b98={};var _0x3dfcf7={'count':0x0,'rows':[]};return db[_0xc690('0x52')]['findOne']({'where':{'id':_0x98a84f[_0xc690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x392fc3,null))[_0xc690('0x1e')](function(_0x5a9f3d){if(_0x5a9f3d){_0x1c3b98['model']=_['keys'](db['CannedAnswer'][_0xc690('0x3d')]);_0x1c3b98[_0xc690('0x42')]=_[_0xc690('0x41')](_0x98a84f['query']);_0x1c3b98['filters']=_[_0xc690('0x44')](_0x1c3b98[_0xc690('0x40')],_0x1c3b98[_0xc690('0x42')]);_0x52aee5[_0xc690('0x45')]=_[_0xc690('0x44')](_0x1c3b98[_0xc690('0x40')],qs[_0xc690('0x46')](_0x98a84f['query'][_0xc690('0x46')]));_0x52aee5['attributes']=_0x52aee5['attributes'][_0xc690('0x47')]?_0x52aee5['attributes']:_0x1c3b98[_0xc690('0x40')];if(!_0x98a84f[_0xc690('0x42')][_0xc690('0x48')](_0xc690('0x49'))){_0x52aee5['limit']=qs[_0xc690('0x4a')](_0x98a84f[_0xc690('0x42')]['limit']);_0x52aee5[_0xc690('0x30')]=qs[_0xc690('0x30')](_0x98a84f[_0xc690('0x42')][_0xc690('0x30')]);}_0x52aee5[_0xc690('0x68')]=qs['sort'](_0x98a84f[_0xc690('0x42')][_0xc690('0x4b')]);_0x52aee5[_0xc690('0x4c')]=qs[_0xc690('0x43')](_[_0xc690('0x4d')](_0x98a84f[_0xc690('0x42')],_0x1c3b98[_0xc690('0x43')]));_0x52aee5[_0xc690('0x4c')][_0xc690('0x60')]=_0x5a9f3d['id'];if(_0x98a84f[_0xc690('0x42')][_0xc690('0x4e')]){_0x52aee5['where']=_['merge'](_0x52aee5[_0xc690('0x4c')],{'$or':_['map'](_0x52aee5[_0xc690('0x45')],function(_0x536a35){var _0x580070={};_0x580070[_0x536a35]={'$like':'%'+_0x98a84f[_0xc690('0x42')][_0xc690('0x4e')]+'%'};return _0x580070;})});}_0x52aee5=_['merge']({},_0x52aee5,_0x98a84f[_0xc690('0x51')]);return db['CannedAnswer']['count']({'where':_0x52aee5['where']})[_0xc690('0x1e')](function(_0x5e0750){_0x3dfcf7[_0xc690('0x2f')]=_0x5e0750;if(_0x98a84f['query'][_0xc690('0x62')]){_0x52aee5['include']=[{'all':!![]}];}return db[_0xc690('0x66')][_0xc690('0x54')](_0x52aee5);})['then'](function(_0x349dd6){_0x3dfcf7[_0xc690('0x63')]=_0x349dd6;return _0x3dfcf7;});}})[_0xc690('0x1e')](respondWithFilteredResult(_0x392fc3,_0x52aee5))[_0xc690('0x29')](handleError(_0x392fc3,null));};exports['removeAnswers']=function(_0x44936,_0x37c947,_0x285aea){return db[_0xc690('0x52')][_0xc690('0x55')]({'where':{'id':_0x44936[_0xc690('0x5c')]['id']}})[_0xc690('0x1e')](handleEntityNotFound(_0x37c947,null))[_0xc690('0x1e')](function(_0x404918){if(_0x404918){return _0x404918['removeAnswers'](_0x44936['query']['ids']);}})[_0xc690('0x1e')](respondWithStatusCode(_0x37c947,null))['catch'](handleError(_0x37c947,null));};exports[_0xc690('0x69')]=function(_0x3f35fb,_0x846552,_0x396c50){return db[_0xc690('0x6a')][_0xc690('0x55')]({'where':{'id':_0x3f35fb['params']['id']}})[_0xc690('0x1e')](handleEntityNotFound(_0x846552,null))['then'](function(_0x553f5d){if(_0x553f5d){return _0x553f5d[_0xc690('0x69')](_0x3f35fb[_0xc690('0x5b')]['ids'],_[_0xc690('0x6b')](_0x3f35fb['body'],[_0xc690('0x65'),'id'])||{});}})['then'](respondWithResult(_0x846552,null))[_0xc690('0x29')](handleError(_0x846552,null));};exports[_0xc690('0x6c')]=function(_0xcabbd7,_0x194498,_0xe7eea8){var _0x4b0734={'raw':![],'where':{}};var _0xca932c={};var _0x547bce={'count':0x0,'rows':[]};return db['FaxAccount'][_0xc690('0x6d')]({'where':{'id':_0xcabbd7[_0xc690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x194498,null))[_0xc690('0x1e')](function(_0xda6064){if(_0xda6064){_0xca932c['model']=_[_0xc690('0x41')](db[_0xc690('0x6a')][_0xc690('0x3d')]);_0xca932c[_0xc690('0x42')]=_['keys'](_0xcabbd7[_0xc690('0x42')]);_0xca932c['filters']=_[_0xc690('0x44')](_0xca932c[_0xc690('0x40')],_0xca932c[_0xc690('0x42')]);_0x4b0734['attributes']=_[_0xc690('0x44')](_0xca932c[_0xc690('0x40')],qs[_0xc690('0x46')](_0xcabbd7[_0xc690('0x42')][_0xc690('0x46')]));_0x4b0734[_0xc690('0x45')]=_0x4b0734['attributes']['length']?_0x4b0734[_0xc690('0x45')]:_0xca932c[_0xc690('0x40')];if(!_0xcabbd7['query']['hasOwnProperty'](_0xc690('0x49'))){_0x4b0734['limit']=qs[_0xc690('0x4a')](_0xcabbd7['query'][_0xc690('0x4a')]);_0x4b0734[_0xc690('0x30')]=qs['offset'](_0xcabbd7[_0xc690('0x42')][_0xc690('0x30')]);}_0x4b0734[_0xc690('0x68')]=qs[_0xc690('0x4b')](_0xcabbd7[_0xc690('0x42')][_0xc690('0x4b')]);_0x4b0734[_0xc690('0x4c')]=qs[_0xc690('0x43')](_['pick'](_0xcabbd7[_0xc690('0x42')],_0xca932c[_0xc690('0x43')]));_0x4b0734['where'][_0xc690('0x60')]=_0xda6064['id'];if(_0xcabbd7[_0xc690('0x42')]['filter']){_0x4b0734[_0xc690('0x4c')]=_[_0xc690('0x4f')](_0x4b0734[_0xc690('0x4c')],{'$or':_[_0xc690('0x3c')](_0x4b0734['attributes'],function(_0x4a40c7){var _0x3de0dd={};_0x3de0dd[_0x4a40c7]={'$like':'%'+_0xcabbd7['query'][_0xc690('0x4e')]+'%'};return _0x3de0dd;})});}_0x4b0734=_[_0xc690('0x4f')]({},_0x4b0734,_0xcabbd7[_0xc690('0x51')]);return db[_0xc690('0x6a')]['count']({'where':_0x4b0734[_0xc690('0x4c')]})[_0xc690('0x1e')](function(_0x292c2a){_0x547bce[_0xc690('0x2f')]=_0x292c2a;if(_0xcabbd7[_0xc690('0x42')][_0xc690('0x62')]){_0x4b0734[_0xc690('0x53')]=[{'model':db[_0xc690('0x6e')],'as':_0xc690('0x6f'),'required':![]},{'model':db['User'],'as':_0xc690('0x70'),'attributes':[_0xc690('0x39'),_0xc690('0x71'),'internal'],'required':![]},{'model':db[_0xc690('0x72')],'as':_0xc690('0x73'),'attributes':['id',_0xc690('0x39'),_0xc690('0x74')],'where':_0xcabbd7['query'][_0xc690('0x75')]?{'id':_0xcabbd7[_0xc690('0x42')][_0xc690('0x75')]}:undefined,'required':_0xcabbd7['query'][_0xc690('0x75')]?!![]:![]}];}return db[_0xc690('0x6a')][_0xc690('0x54')](_0x4b0734);})[_0xc690('0x1e')](function(_0x381860){_0x547bce[_0xc690('0x63')]=_0x381860;return _0x547bce;});}})[_0xc690('0x1e')](respondWithFilteredResult(_0x194498,_0x4b0734))[_0xc690('0x29')](handleError(_0x194498,null));};exports[_0xc690('0x76')]=function(_0x55c405,_0xd33dd6,_0x22be17){return db[_0xc690('0x52')][_0xc690('0x6d')]({'where':{'id':_0x55c405[_0xc690('0x5c')]['id']}})['then'](handleEntityNotFound(_0xd33dd6,null))[_0xc690('0x1e')](function(_0x20cade){if(_0x20cade){return db[_0xc690('0x77')]['transaction'](function(_0x176b73){return db[_0xc690('0x78')][_0xc690('0x38')]({'where':{'FaxAccountId':_0x55c405[_0xc690('0x5c')]['id']},'transaction':_0x176b73})[_0xc690('0x1e')](function(_0x4b0faf){var _0x4c6c4a=_[_0xc690('0x3c')](_0x55c405[_0xc690('0x5b')],function(_0x776a04){_0x776a04[_0xc690('0x60')]=_0x55c405[_0xc690('0x5c')]['id'];return _0x776a04;});return db[_0xc690('0x78')][_0xc690('0x79')](_0x4c6c4a,{'transaction':_0x176b73});});})['then'](function(){return db[_0xc690('0x78')][_0xc690('0x7a')]({'where':{'FaxAccountId':_0x55c405[_0xc690('0x5c')]['id']},'order':'priority'});});}})[_0xc690('0x1e')](respondWithResult(_0xd33dd6,null))[_0xc690('0x29')](handleError(_0xd33dd6,null));};exports['getApplications']=function(_0xf0a74d,_0x2bf647,_0x310853){var _0x337c54={};var _0x3aa1a7={};var _0x42101b;var _0x1c459d;return db['FaxAccount'][_0xc690('0x6d')]({'where':{'id':_0xf0a74d[_0xc690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x2bf647,null))[_0xc690('0x1e')](function(_0x208b07){if(_0x208b07){_0x42101b=_0x208b07;_0x3aa1a7['model']=_['keys'](db[_0xc690('0x78')][_0xc690('0x3d')]);_0x3aa1a7['query']=_['keys'](_0xf0a74d['query']);_0x3aa1a7[_0xc690('0x43')]=_[_0xc690('0x44')](_0x3aa1a7[_0xc690('0x40')],_0x3aa1a7['query']);_0x337c54[_0xc690('0x45')]=_[_0xc690('0x44')](_0x3aa1a7[_0xc690('0x40')],qs[_0xc690('0x46')](_0xf0a74d[_0xc690('0x42')][_0xc690('0x46')]));_0x337c54['attributes']=_0x337c54[_0xc690('0x45')][_0xc690('0x47')]?_0x337c54[_0xc690('0x45')]:_0x3aa1a7[_0xc690('0x40')];_0x337c54[_0xc690('0x68')]=qs[_0xc690('0x4b')](_0xf0a74d[_0xc690('0x42')]['sort']);_0x337c54[_0xc690('0x4c')]=qs['filters'](_['pick'](_0xf0a74d['query'],_0x3aa1a7[_0xc690('0x43')]));if(_0xf0a74d[_0xc690('0x42')][_0xc690('0x4e')]){_0x337c54[_0xc690('0x4c')]=_[_0xc690('0x4f')](_0x337c54[_0xc690('0x4c')],{'$or':_['map'](_0x337c54[_0xc690('0x45')],function(_0x617ffc){var _0x4a97cf={};_0x4a97cf[_0x617ffc]={'$like':'%'+_0xf0a74d[_0xc690('0x42')][_0xc690('0x4e')]+'%'};return _0x4a97cf;})});}_0x337c54=_[_0xc690('0x4f')]({},_0x337c54,_0xf0a74d['options']);return _0x42101b[_0xc690('0x7b')](_0x337c54);}})[_0xc690('0x1e')](function(_0x266463){if(_0x266463){_0x1c459d=_0x266463[_0xc690('0x47')];if(!_0xf0a74d[_0xc690('0x42')]['hasOwnProperty'](_0xc690('0x49'))){_0x337c54[_0xc690('0x4a')]=qs[_0xc690('0x4a')](_0xf0a74d[_0xc690('0x42')][_0xc690('0x4a')]);_0x337c54[_0xc690('0x30')]=qs['offset'](_0xf0a74d[_0xc690('0x42')][_0xc690('0x30')]);}return _0x42101b[_0xc690('0x7b')](_0x337c54);}})[_0xc690('0x1e')](function(_0x4d6a8b){if(_0x4d6a8b){return _0x4d6a8b?{'count':_0x1c459d,'rows':_0x4d6a8b}:null;}})['then'](respondWithResult(_0x2bf647,null))['catch'](handleError(_0x2bf647,null));};function Extension(_0x45344a,_0x102986,_0x4f9b41,_0x93d4d2){this[_0xc690('0x7c')]=_0xc690('0x7d');this[_0xc690('0x7e')]=_0x45344a[_0xc690('0x7f')];this[_0xc690('0x80')]=_0x93d4d2;this[_0xc690('0x81')]=_0xc690('0x82');this[_0xc690('0x83')]=_0xc690('0x84');this[_0xc690('0x60')]=_0x45344a['id'];this[_0xc690('0x85')]=_0x102986;this[_0xc690('0x86')]=_0x4f9b41;}function createExtensionsReciveFax(_0x5a0f5b){var _0x18deee=0x1;var _0x26c5a3=[];_0x26c5a3[_0xc690('0x87')](new Extension(_0x5a0f5b,_0x18deee,'',_0xc690('0x88')));_0x18deee+=0x1;_0x26c5a3[_0xc690('0x87')](new Extension(_0x5a0f5b,_0x18deee,'CDR(type)=inbound-fax',_0xc690('0x89')));_0x18deee+=0x1;for(var _0x3c8229 in _0x5a0f5b){if(_0x5a0f5b[_0xc690('0x48')](_0x3c8229)&&(_0x3c8229==='ecm'||_0x3c8229===_0xc690('0x7f')||_0x3c8229==='gateway'||_0x3c8229==='faxdetect'||_0x3c8229===_0xc690('0x8a')||_0x3c8229===_0xc690('0x8b')||_0x3c8229===_0xc690('0x8c')||_0x3c8229==='modem'||_0x3c8229==='t38timeout')){_0x26c5a3['push'](new Extension(_0x5a0f5b,_0x18deee,'FAXOPT('+_0x3c8229+')='+_0x5a0f5b[_0x3c8229],'Set'));_0x18deee+=0x1;}}_0x26c5a3['push'](new Extension(_0x5a0f5b,_0x18deee,'6',_0xc690('0x8d')));_0x18deee+=0x1;_0x26c5a3[_0xc690('0x87')](new Extension(_0x5a0f5b,_0x18deee,_0xc690('0x8e'),_0xc690('0x8f')));_0x18deee=0x0;return _0x26c5a3;}exports[_0xc690('0x90')]=function(_0x23fc28,_0x4afd44,_0x56e5c7){var _0x162905;return db[_0xc690('0x77')][_0xc690('0x91')](function(_0x2ddd8f){return db[_0xc690('0x52')][_0xc690('0x56')](_0x23fc28[_0xc690('0x5b')],{'transaction':_0x2ddd8f})['then'](function(_0x39eb29){_0x162905=_0x39eb29[_0xc690('0x35')]({'plain':!![]});return db[_0xc690('0x92')]['bulkCreate'](createExtensionsReciveFax(_0x162905),{'transaction':_0x2ddd8f});});})[_0xc690('0x1e')](function(){return _0x162905;})[_0xc690('0x1e')](respondWithResult(_0x4afd44,null))[_0xc690('0x29')](handleError(_0x4afd44,null));};exports[_0xc690('0x93')]=function(_0x56b6db,_0x41a133,_0x12fe4b){var _0x3d0162;return db[_0xc690('0x77')][_0xc690('0x91')](function(_0x1936a6){return db[_0xc690('0x52')][_0xc690('0x34')](_0x56b6db['body'],{'where':{'id':_0x56b6db[_0xc690('0x5b')]['id']},'transaction':_0x1936a6})[_0xc690('0x1e')](function(_0x4d8a8f){return db[_0xc690('0x92')][_0xc690('0x38')]({'where':{'FaxAccountId':_0x56b6db[_0xc690('0x5b')]['id']},'transaction':_0x1936a6})['then'](function(_0x18e9a9){return db[_0xc690('0x92')][_0xc690('0x79')](createExtensionsReciveFax(_['omit'](_0x56b6db[_0xc690('0x5b')],[_0xc690('0x94'),_0xc690('0x3f'),_0xc690('0x95'),_0xc690('0x96'),_0xc690('0x97'),'ListId'])),{'transaction':_0x1936a6});});});})['then'](function(){return db[_0xc690('0x52')][_0xc690('0x98')](_0x56b6db[_0xc690('0x5b')]['id']);})['then'](respondWithResult(_0x41a133,null))[_0xc690('0x29')](handleError(_0x41a133,null));};exports['getMessages']=function(_0xee57db,_0x5cbbba,_0x33b1ad){var _0x50b807={'raw':!![],'where':{}};var _0x684970={};var _0x24f664={'count':0x0,'rows':[]};return db[_0xc690('0x52')][_0xc690('0x6d')]({'where':{'id':_0xee57db[_0xc690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x5cbbba,null))[_0xc690('0x1e')](function(_0x4fc097){if(_0x4fc097){_0x684970[_0xc690('0x40')]=_[_0xc690('0x41')](db[_0xc690('0x99')]['rawAttributes']);_0x684970['query']=_['keys'](_0xee57db[_0xc690('0x42')]);_0x684970[_0xc690('0x43')]=_['intersection'](_0x684970[_0xc690('0x40')],_0x684970[_0xc690('0x42')]);_0x50b807[_0xc690('0x45')]=_[_0xc690('0x44')](_0x684970[_0xc690('0x40')],qs[_0xc690('0x46')](_0xee57db[_0xc690('0x42')]['fields']));_0x50b807[_0xc690('0x45')]=_0x50b807['attributes'][_0xc690('0x47')]?_0x50b807[_0xc690('0x45')]:_0x684970[_0xc690('0x40')];if(!_0xee57db[_0xc690('0x42')][_0xc690('0x48')]('nolimit')){_0x50b807['limit']=qs[_0xc690('0x4a')](_0xee57db[_0xc690('0x42')]['limit']);_0x50b807[_0xc690('0x30')]=qs[_0xc690('0x30')](_0xee57db['query']['offset']);}_0x50b807[_0xc690('0x68')]=qs['sort'](_0xee57db[_0xc690('0x42')][_0xc690('0x4b')]);_0x50b807[_0xc690('0x4c')]=qs[_0xc690('0x43')](_['pick'](_0xee57db[_0xc690('0x42')],_0x684970[_0xc690('0x43')]));_0x50b807[_0xc690('0x4c')]['FaxAccountId']=_0x4fc097['id'];if(_0xee57db[_0xc690('0x42')]['filter']){_0x50b807[_0xc690('0x4c')]=_[_0xc690('0x4f')](_0x50b807[_0xc690('0x4c')],{'$or':_[_0xc690('0x3c')](_0x50b807[_0xc690('0x45')],function(_0x395617){var _0x40946c={};_0x40946c[_0x395617]={'$like':'%'+_0xee57db[_0xc690('0x42')][_0xc690('0x4e')]+'%'};return _0x40946c;})});}if(_0xee57db['query']['$gte']){var _0x472e06=_0xee57db[_0xc690('0x42')]['$gte'][_0xc690('0x9a')](',');var _0x2c9bac={};_0x2c9bac[_0x472e06[0x0]]={'$gte':moment(_0x472e06[0x1])['format'](_0xc690('0x9b'))};_0x50b807['where']=_[_0xc690('0x4f')](_0x50b807[_0xc690('0x4c')],_0x2c9bac);}_0x50b807=_[_0xc690('0x4f')]({},_0x50b807,_0xee57db[_0xc690('0x51')]);return db[_0xc690('0x99')][_0xc690('0x2f')]({'where':_0x50b807[_0xc690('0x4c')]})[_0xc690('0x1e')](function(_0x33cf22){_0x24f664[_0xc690('0x2f')]=_0x33cf22;if(_0xee57db[_0xc690('0x42')][_0xc690('0x62')]){_0x50b807[_0xc690('0x53')]=[{'all':!![]}];}return db[_0xc690('0x99')][_0xc690('0x54')](_0x50b807);})[_0xc690('0x1e')](function(_0x1f90d5){_0x24f664[_0xc690('0x63')]=_0x1f90d5;return _0x24f664;});}})[_0xc690('0x1e')](respondWithFilteredResult(_0x5cbbba,_0x50b807))[_0xc690('0x29')](handleError(_0x5cbbba,null));};exports[_0xc690('0x3a')]=function(_0x13b0b6,_0x5dd26b,_0x5be6af){var _0x3294ec,_0x5b0b63={},_0x2e6a3b;if(_0x13b0b6['body']['to']){_0x2e6a3b=_0x13b0b6['body']['to'][0x0];}return db[_0xc690('0x52')][_0xc690('0x55')]({'where':{'id':_0x13b0b6['params']['id']},'include':[{'model':db[_0xc690('0x9c')],'as':'List','include':[{'model':db[_0xc690('0x6e')],'as':_0xc690('0x9d'),'where':{'fax':_0x2e6a3b},'limit':0x1,'order':[['updatedAt',_0xc690('0x9e')]]}]}]})['then'](handleEntityNotFound(_0x5dd26b,null))[_0xc690('0x1e')](function(_0x18825c){_0x3294ec=_0x18825c;if(_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')]&&_0x13b0b6['body'][_0xc690('0x9f')]['length']){for(var _0x7cd883=0x0;_0x7cd883<_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')]['length'];_0x7cd883+=0x1){_0x13b0b6[_0xc690('0x5b')]['attachments'][_0x7cd883]={'filename':_0x13b0b6['body'][_0xc690('0x9f')][_0x7cd883][_0xc690('0x39')],'id':_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')][_0x7cd883]['id'],'path':path[_0xc690('0xa0')](config[_0xc690('0xa1')],_0xc690('0xa2'),_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')][_0x7cd883]['basename'])};}}return respondWithRpcPromise('CheckAfterSend',_0xc690('0xa3'),{'FaxAccountId':_[_0xc690('0xa4')](_0x13b0b6[_0xc690('0x5c')]['id'])?undefined:_0x13b0b6[_0xc690('0x5c')]['id'],'path':_['isNil'](_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')][0x0][_0xc690('0x4')])?undefined:_0x13b0b6['body'][_0xc690('0x9f')][0x0]['path'],'fax':_[_0xc690('0xa4')](_0x13b0b6[_0xc690('0x5b')]['to'][0x0])?undefined:_0x13b0b6['body']['to'][0x0]},client9002);})['then'](function(){if(_0x3294ec){if(_[_0xc690('0xa4')](_0x13b0b6[_0xc690('0x5b')][_0xc690('0xa5')])){_0x13b0b6['body'][_0xc690('0xa5')]=util['format'](_0xc690('0xa6'),_0x3294ec['name'],_0x3294ec[_0xc690('0xa7')]);}if(_0x3294ec[_0xc690('0xa8')]){if(_0x3294ec[_0xc690('0xa8')][_0xc690('0x9d')][_0xc690('0x47')]){return _0x3294ec[_0xc690('0xa8')][_0xc690('0x9d')][0x0];}else{return db[_0xc690('0x6e')][_0xc690('0x56')](_[_0xc690('0x17')](_0x13b0b6[_0xc690('0x5b')],{'firstName':_0x13b0b6['body']['to'][0x0],'phone':_0x13b0b6[_0xc690('0x5b')]['to'][0x0],'fax':_0x13b0b6[_0xc690('0x5b')]['to'][0x0],'ListId':_0x3294ec[_0xc690('0xa9')]}));}}else{throw new Error(_0xc690('0xaa'));}}else{throw new Error(_0xc690('0xab'));}})[_0xc690('0x1e')](function(_0x56b3dc){if(_0x56b3dc){return db[_0xc690('0x6a')][_0xc690('0x55')]({'where':{'ContactId':_0x56b3dc['id'],'closed':![],'FaxAccountId':_0x3294ec['id']}})[_0xc690('0x1e')](function(_0x5d4f0a){if(_0x5d4f0a){return[_0x5d4f0a,![]];}return db[_0xc690('0x6a')][_0xc690('0x56')]({'UserId':_0x13b0b6[_0xc690('0x57')]['id'],'ContactId':_0x56b3dc['id'],'FaxAccountId':_0x3294ec['id'],'fax':_0x13b0b6[_0xc690('0x5b')]['to'][0x0],'firstMsgDirection':_0xc690('0xac'),'Messages':[_[_0xc690('0x4f')](_0x13b0b6[_0xc690('0x5b')],{'read':![],'body':_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')][0x0][_0xc690('0xad')],'FaxAccountId':_0x3294ec['id'],'UserId':_0x13b0b6[_0xc690('0x57')]['id'],'ContactId':_0x56b3dc['id'],'AttachmentId':_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')][0x0]['id']})]},{'include':[{'model':db[_0xc690('0x99')],'as':_0xc690('0xae')}]})[_0xc690('0x1e')](function(_0xfcf791){return[_0xfcf791,!![]];});});}else{throw new Error(_0xc690('0xaf'));}})[_0xc690('0xb0')](function(_0xfc3b8d,_0x1be594){if(_0x1be594){return _0xfc3b8d;}return db[_0xc690('0x99')][_0xc690('0x56')]({'direction':'out','read':![],'body':_0x13b0b6[_0xc690('0x5b')]['attachments'][0x0][_0xc690('0xad')],'FaxAccountId':_0x3294ec['id'],'FaxInteractionId':_0xfc3b8d['id'],'UserId':_0x13b0b6['user']['id'],'ContactId':_0xfc3b8d['ContactId'],'AttachmentId':_0x13b0b6['body'][_0xc690('0x9f')][0x0]['id']})[_0xc690('0x1e')](function(_0x43e808){_0xfc3b8d[_0xc690('0xb1')]['Messages']=[];_0xfc3b8d['dataValues'][_0xc690('0xae')][_0xc690('0x87')](_0x43e808[_0xc690('0xb1')]);return _0xfc3b8d;});})[_0xc690('0x1e')](function(_0x349c65){respondWithRpcPromise(_0xc690('0xb2'),_0xc690('0xb2'),{'FaxAccountId':_[_0xc690('0xa4')](_0x13b0b6['params']['id'])?undefined:_0x13b0b6[_0xc690('0x5c')]['id'],'path':_[_0xc690('0xa4')](_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')][0x0][_0xc690('0x4')])?undefined:_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')][0x0][_0xc690('0x4')],'fax':_['isNil'](_0x13b0b6[_0xc690('0x5b')]['to'][0x0])?undefined:_0x13b0b6[_0xc690('0x5b')]['to'][0x0],'AttachmentId':_0x13b0b6[_0xc690('0x5b')][_0xc690('0x9f')][0x0]['id']},client9002)[_0xc690('0x1e')](function(_0x2f33e8){logger['info'](_0xc690('0xb3'),_0x2f33e8);})[_0xc690('0x29')](function(_0xb23ba9){logger[_0xc690('0x1f')](_0xc690('0xb3'),_0xb23ba9);});return _0x349c65;})['then'](respondWithResult(_0x5dd26b,null))['catch'](handleError(_0x5dd26b,null));};exports[_0xc690('0xb4')]=function(_0x3b733e,_0x3a3426,_0x2b070f){return db[_0xc690('0x52')]['find']({'where':{'id':_0x3b733e[_0xc690('0x5c')]['id']}})['then'](handleEntityNotFound(_0x3a3426,null))['then'](function(_0x298ed8){if(_0x298ed8){return _0x298ed8[_0xc690('0xb4')](_0x3b733e[_0xc690('0x5b')]['ids'],_[_0xc690('0x6b')](_0x3b733e[_0xc690('0x5b')],[_0xc690('0x65'),'id'])||{})[_0xc690('0xb0')](function(_0x1f344f){for(var _0x2bbd17=0x0;_0x2bbd17<_0x3b733e[_0xc690('0x5b')][_0xc690('0x65')][_0xc690('0x47')];_0x2bbd17+=0x1){socket[_0xc690('0xb5')](_0xc690('0xb6'),{'UserId':Number(_0x3b733e[_0xc690('0x5b')][_0xc690('0x65')][_0x2bbd17]),'FaxAccountId':Number(_0x3b733e[_0xc690('0x5c')]['id'])});}return _0x1f344f;});}})[_0xc690('0x1e')](respondWithResult(_0x3a3426,null))[_0xc690('0x29')](handleError(_0x3a3426,null));};exports[_0xc690('0xb7')]=function(_0x1feba5,_0x4f9b1b,_0x49b1a){return db[_0xc690('0x52')][_0xc690('0x55')]({'where':{'id':_0x1feba5[_0xc690('0x5c')]['id']}})[_0xc690('0x1e')](handleEntityNotFound(_0x4f9b1b,null))[_0xc690('0x1e')](function(_0x1ee4c3){if(_0x1ee4c3){return _0x1ee4c3[_0xc690('0xb7')](_0x1feba5['query'][_0xc690('0x65')])[_0xc690('0x1e')](function(){if(_[_0xc690('0xb8')](_0x1feba5[_0xc690('0x42')][_0xc690('0x65')])){for(var _0x14e0c8=0x0;_0x14e0c8<_0x1feba5[_0xc690('0x42')][_0xc690('0x65')][_0xc690('0x47')];_0x14e0c8+=0x1){socket[_0xc690('0xb5')](_0xc690('0xb9'),{'UserId':Number(_0x1feba5[_0xc690('0x42')][_0xc690('0x65')][_0x14e0c8]),'FaxAccountId':Number(_0x1feba5[_0xc690('0x5c')]['id'])});}}else{socket[_0xc690('0xb5')](_0xc690('0xb9'),{'UserId':Number(_0x1feba5[_0xc690('0x42')][_0xc690('0x65')]),'FaxAccountId':Number(_0x1feba5[_0xc690('0x5c')]['id'])});}});}})[_0xc690('0x1e')](respondWithStatusCode(_0x4f9b1b,null))[_0xc690('0x29')](handleError(_0x4f9b1b,null));};exports['getAgents']=function(_0x370e4e,_0x57f6f8,_0xf35878){var _0x272895={};var _0x3275e6={};var _0x5d9529;var _0x150b6b;return db[_0xc690('0x52')][_0xc690('0x6d')]({'where':{'id':_0x370e4e[_0xc690('0x5c')]['id']}})[_0xc690('0x1e')](handleEntityNotFound(_0x57f6f8,null))[_0xc690('0x1e')](function(_0x153cbb){if(_0x153cbb){_0x5d9529=_0x153cbb;_0x3275e6['model']=_[_0xc690('0x41')](db[_0xc690('0xba')][_0xc690('0x3d')]);_0x3275e6[_0xc690('0x42')]=_['keys'](_0x370e4e['query']);_0x3275e6[_0xc690('0x43')]=_[_0xc690('0x44')](_0x3275e6['model'],_0x3275e6[_0xc690('0x42')]);_0x272895[_0xc690('0x45')]=_[_0xc690('0x44')](_0x3275e6[_0xc690('0x40')],qs[_0xc690('0x46')](_0x370e4e[_0xc690('0x42')]['fields']));_0x272895[_0xc690('0x45')]=_0x272895[_0xc690('0x45')][_0xc690('0x47')]?_0x272895['attributes']:_0x3275e6[_0xc690('0x40')];_0x272895['order']=qs[_0xc690('0x4b')](_0x370e4e[_0xc690('0x42')][_0xc690('0x4b')]);_0x272895[_0xc690('0x4c')]=qs[_0xc690('0x43')](_[_0xc690('0x4d')](_0x370e4e[_0xc690('0x42')],_0x3275e6[_0xc690('0x43')]));if(_0x370e4e[_0xc690('0x42')][_0xc690('0x4e')]){_0x272895[_0xc690('0x4c')]=_[_0xc690('0x4f')](_0x272895['where'],{'$or':_['map'](_0x272895[_0xc690('0x45')],function(_0x3e9244){var _0x73d7d3={};_0x73d7d3[_0x3e9244]={'$like':'%'+_0x370e4e[_0xc690('0x42')][_0xc690('0x4e')]+'%'};return _0x73d7d3;})});}_0x272895=_['merge']({},_0x272895,_0x370e4e[_0xc690('0x51')]);return _0x5d9529['getAgents'](_0x272895);}})[_0xc690('0x1e')](function(_0x4bcb5b){if(_0x4bcb5b){_0x150b6b=_0x4bcb5b[_0xc690('0x47')];if(!_0x370e4e[_0xc690('0x42')][_0xc690('0x48')](_0xc690('0x49'))){_0x272895[_0xc690('0x4a')]=qs[_0xc690('0x4a')](_0x370e4e[_0xc690('0x42')]['limit']);_0x272895[_0xc690('0x30')]=qs['offset'](_0x370e4e[_0xc690('0x42')][_0xc690('0x30')]);}return _0x5d9529[_0xc690('0xbb')](_0x272895);}})['then'](function(_0x171981){if(_0x171981){return _0x171981?{'count':_0x150b6b,'rows':_0x171981}:null;}})[_0xc690('0x1e')](respondWithResult(_0x57f6f8,null))['catch'](handleError(_0x57f6f8,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index c32f377..41ba12f 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 _0x98d8=['remove','emit','hook','exports','events','FaxAccount','save','update'];(function(_0x5a4250,_0x4da5fb){var _0x371281=function(_0x540862){while(--_0x540862){_0x5a4250['push'](_0x5a4250['shift']());}};_0x371281(++_0x4da5fb);}(_0x98d8,0x184));var _0x898d=function(_0x1e5c8d,_0x1bd355){_0x1e5c8d=_0x1e5c8d-0x0;var _0x17f720=_0x98d8[_0x1e5c8d];return _0x17f720;};'use strict';var EventEmitter=require(_0x898d('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x898d('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x898d('0x2'),'afterUpdate':_0x898d('0x3'),'afterDestroy':_0x898d('0x4')};function emitEvent(_0x393e61){return function(_0x4a1fe9,_0x13540e,_0x4b2f54){FaxAccountEvents['emit'](_0x393e61+':'+_0x4a1fe9['id'],_0x4a1fe9);FaxAccountEvents[_0x898d('0x5')](_0x393e61,_0x4a1fe9);_0x4b2f54(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxAccount[_0x898d('0x6')](e,emitEvent(event));}}module[_0x898d('0x7')]=FaxAccountEvents; \ No newline at end of file +var _0x7508=['remove','emit','hasOwnProperty','events','FaxAccount','save'];(function(_0xfe7f96,_0xaa3476){var _0x375622=function(_0x5b5e62){while(--_0x5b5e62){_0xfe7f96['push'](_0xfe7f96['shift']());}};_0x375622(++_0xaa3476);}(_0x7508,0xc3));var _0x8750=function(_0x665f34,_0x4e413d){_0x665f34=_0x665f34-0x0;var _0x2a0869=_0x7508[_0x665f34];return _0x2a0869;};'use strict';var EventEmitter=require(_0x8750('0x0'));var FaxAccount=require('../../mysqldb')['db'][_0x8750('0x1')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8750('0x2'),'afterUpdate':'update','afterDestroy':_0x8750('0x3')};function emitEvent(_0x521fb4){return function(_0x104831,_0x3295f5,_0x4e755d){FaxAccountEvents[_0x8750('0x4')](_0x521fb4+':'+_0x104831['id'],_0x104831);FaxAccountEvents[_0x8750('0x4')](_0x521fb4,_0x104831);_0x4e755d(null);};}for(var e in events){if(events[_0x8750('0x5')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module['exports']=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index df97823..b8fdfaf 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 _0x9d59=['util','../../config/logger','api','moment','request-promise','path','../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9d59,0x137));var _0x99d5=function(_0x3473ee,_0x1150a3){_0x3473ee=_0x3473ee-0x0;var _0xcdd55d=_0x9d59[_0x3473ee];return _0xcdd55d;};'use strict';var _=require(_0x99d5('0x0'));var util=require(_0x99d5('0x1'));var logger=require(_0x99d5('0x2'))(_0x99d5('0x3'));var moment=require(_0x99d5('0x4'));var BPromise=require('bluebird');var rp=require(_0x99d5('0x5'));var fs=require('fs');var path=require(_0x99d5('0x6'));var rimraf=require('rimraf');var config=require(_0x99d5('0x7'));var attributes=require(_0x99d5('0x8'));module[_0x99d5('0x9')]=function(_0x19f12d,_0x29d555){return _0x19f12d['define'](_0x99d5('0xa'),attributes,{'tableName':_0x99d5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8c90=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxAccount.attributes','exports','define','fax_accounts','lodash','util'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x8c90,0x136));var _0x08c9=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0x8c90[_0x40ac5e];return _0x2839d6;};'use strict';var _=require(_0x08c9('0x0'));var util=require(_0x08c9('0x1'));var logger=require('../../config/logger')(_0x08c9('0x2'));var moment=require(_0x08c9('0x3'));var BPromise=require(_0x08c9('0x4'));var rp=require(_0x08c9('0x5'));var fs=require('fs');var path=require(_0x08c9('0x6'));var rimraf=require(_0x08c9('0x7'));var config=require(_0x08c9('0x8'));var attributes=require(_0x08c9('0x9'));module[_0x08c9('0xa')]=function(_0x5474f3,_0x1d5cd2){return _0x5474f3[_0x08c9('0xb')]('FaxAccount',attributes,{'tableName':_0x08c9('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 47d96be..d3a33a8 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 _0x127a=['debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','findAll','options','raw','where','attributes','include','map','model','GetFaxAccount','body','describe','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','Sequelize','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','FaxAccount','find','account','List','CmContact','FaxApplication','Applications','applications','orderBy','asc','length','Contacts','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','close','unmanaged','*,*,*,*','created','interaction','create','AttachmentId','UserId','name','unshift','agent','Start','startRouting','lodash','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./faxAccount.socket','register','request','then','info','FaxAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x31e29a,_0x349c9b){var _0x32d892=function(_0x41cc86){while(--_0x41cc86){_0x31e29a['push'](_0x31e29a['shift']());}};_0x32d892(++_0x349c9b);}(_0x127a,0x13c));var _0xa127=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0x127a[_0x1a36a5];return _0x746243;};'use strict';var _=require(_0xa127('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa127('0x1'));var fs=require('fs');var Redis=require(_0xa127('0x2'));var db=require(_0xa127('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa127('0x4'))(_0xa127('0x5'));var config=require(_0xa127('0x6'));var jayson=require(_0xa127('0x7'));var client=jayson[_0xa127('0x8')][_0xa127('0x9')]({'port':0x232c});config[_0xa127('0xa')]=_['defaults'](config['redis'],{'host':_0xa127('0xb'),'port':0x18eb});var socket=require(_0xa127('0xc'))(new Redis(config[_0xa127('0xa')]));require(_0xa127('0xd'))[_0xa127('0xe')](socket);function respondWithRpcPromise(_0x1ace48,_0x1e0b9d,_0x2974a7){return new BPromise(function(_0x208405,_0x25ca87){return client[_0xa127('0xf')](_0x1ace48,_0x2974a7)[_0xa127('0x10')](function(_0x1735d4){logger[_0xa127('0x11')](_0xa127('0x12'),_0x1e0b9d,_0xa127('0x13'));logger[_0xa127('0x14')](_0xa127('0x15'),_0x1e0b9d,'request\x20sent',JSON[_0xa127('0x16')](_0x1735d4));if(_0x1735d4[_0xa127('0x17')]){if(_0x1735d4[_0xa127('0x17')]['code']===0x1f4){logger['error'](_0xa127('0x12'),_0x1e0b9d,_0x1735d4['error'][_0xa127('0x18')]);return _0x25ca87(_0x1735d4[_0xa127('0x17')][_0xa127('0x18')]);}logger['error'](_0xa127('0x12'),_0x1e0b9d,_0x1735d4[_0xa127('0x17')][_0xa127('0x18')]);return _0x208405(_0x1735d4[_0xa127('0x17')]['message']);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1e0b9d,_0xa127('0x13'));_0x208405(_0x1735d4[_0xa127('0x19')][_0xa127('0x18')]);}})[_0xa127('0x1a')](function(_0x6847fc){logger['error'](_0xa127('0x12'),_0x1e0b9d,_0x6847fc);_0x25ca87(_0x6847fc);});});}exports['GetFaxAccount']=function(_0x5ba5fb){var _0x47079a=this;return new Promise(function(_0x35d227,_0x36eda8){return db['FaxAccount'][_0xa127('0x1b')]({'raw':_0x5ba5fb[_0xa127('0x1c')]?_0x5ba5fb[_0xa127('0x1c')][_0xa127('0x1d')]===undefined?!![]:![]:!![],'where':_0x5ba5fb['options']?_0x5ba5fb['options'][_0xa127('0x1e')]||null:null,'attributes':_0x5ba5fb[_0xa127('0x1c')]?_0x5ba5fb['options'][_0xa127('0x1f')]||null:null,'limit':_0x5ba5fb['options']?_0x5ba5fb[_0xa127('0x1c')]['limit']||null:null,'include':_0x5ba5fb['options']?_0x5ba5fb[_0xa127('0x1c')][_0xa127('0x20')]?_[_0xa127('0x21')](_0x5ba5fb[_0xa127('0x1c')][_0xa127('0x20')],function(_0x1e9127){return{'model':db[_0x1e9127[_0xa127('0x22')]],'as':_0x1e9127['as'],'attributes':_0x1e9127[_0xa127('0x1f')],'include':_0x1e9127[_0xa127('0x20')]?_[_0xa127('0x21')](_0x1e9127[_0xa127('0x20')],function(_0x413525){return{'model':db[_0x413525['model']],'as':_0x413525['as'],'attributes':_0x413525[_0xa127('0x1f')],'include':_0x413525[_0xa127('0x20')]?_[_0xa127('0x21')](_0x413525[_0xa127('0x20')],function(_0x20d74f){return{'model':db[_0x20d74f[_0xa127('0x22')]],'as':_0x20d74f['as'],'attributes':_0x20d74f[_0xa127('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa127('0x10')](function(_0x1dcad3){logger[_0xa127('0x11')]('GetFaxAccount',_0x5ba5fb);logger[_0xa127('0x14')](_0xa127('0x23'),_0x5ba5fb,JSON['stringify'](_0x1dcad3));_0x35d227(_0x1dcad3);})[_0xa127('0x1a')](function(_0x59209a){logger[_0xa127('0x17')](_0xa127('0x23'),_0x59209a[_0xa127('0x18')],_0x5ba5fb);_0x36eda8(_0x47079a['error'](0x1f4,_0x59209a[_0xa127('0x18')]));});});};exports['NotifyFaxAccount']=function(_0x456e22,_0x34d407,_0x51fe3c){var _0xecc99a=this;return new Promise(function(_0x16d3ac,_0x25b85e){var _0x5a2605={'body':_0x456e22[_0xa127('0x24')],'channel':'fax'};var _0x3d610b=[];var _0x53405e=[];var _0x2212ad={};return db['CmContact'][_0xa127('0x25')]()[_0xa127('0x10')](function(_0x198980){if(!_0x198980){throw new db['Sequelize'][(_0xa127('0x26'))](_0xa127('0x27'));}_0x3d610b=_[_0xa127('0x28')](_[_0xa127('0x29')](_0x198980),['createdAt',_0xa127('0x2a')]);_0x53405e=_[_0xa127('0x28')](_[_0xa127('0x29')](_0x198980),['createdAt','updatedAt','CompanyId',_0xa127('0x2b')]);if(_0x456e22[_0xa127('0x24')]['id']){delete _0x456e22[_0xa127('0x24')]['id'];}if(_[_0xa127('0x2c')](_0x456e22['body'][_0xa127('0x2d')])){throw new db['Sequelize'][(_0xa127('0x26'))]('from\x20is\x20mandatory');}if(_['isNil'](_0x456e22[_0xa127('0x24')][_0xa127('0x24')])||_0x456e22['body']['body']===''){throw new db['Sequelize']['ValidationError'](_0xa127('0x2e'));}if(_[_0xa127('0x2c')](_0x456e22['body'][_0xa127('0x2f')])){throw new db[(_0xa127('0x30'))][(_0xa127('0x26'))](_0xa127('0x31')+_0x53405e);}if(!_[_0xa127('0x32')](_0x53405e,_0x456e22[_0xa127('0x24')][_0xa127('0x2f')])){throw new db[(_0xa127('0x30'))][(_0xa127('0x26'))](_0xa127('0x33')+_0x53405e);}_0x2212ad[_0x456e22[_0xa127('0x24')][_0xa127('0x2f')]]=_0x456e22[_0xa127('0x24')][_0xa127('0x2d')];})[_0xa127('0x10')](function(){return db[_0xa127('0x34')][_0xa127('0x35')]({'where':{'id':_0x456e22[_0xa127('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0xa127('0x37'),'include':[{'model':db[_0xa127('0x38')],'as':'Contacts','where':_0x2212ad,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0xa127('0x39')],'as':_0xa127('0x3a')}]});})[_0xa127('0x10')](function(_0x1d8528){if(_0x1d8528&&_0x1d8528['List']){var _0x49f9cc=_0x1d8528['get']({'plain':!![]});_0x5a2605[_0xa127('0x36')]=_0x49f9cc;_0x5a2605[_0xa127('0x3b')]=_0x49f9cc['Applications'];_0x5a2605['list']=_0x49f9cc[_0xa127('0x37')];_0x5a2605['applications']=_[_0xa127('0x3c')](_0x5a2605['applications'],['priority'],[_0xa127('0x3d')]);if(_0x5a2605[_0xa127('0x36')][_0xa127('0x3a')]){delete _0x5a2605[_0xa127('0x36')][_0xa127('0x3a')];}if(_0x5a2605[_0xa127('0x36')]['List']&&_0x5a2605[_0xa127('0x36')]['List']['Contacts'][_0xa127('0x3e')]){return _0x5a2605[_0xa127('0x36')][_0xa127('0x37')][_0xa127('0x3f')][0x0];}var _0x639af6=_['defaults'](_0x456e22[_0xa127('0x24')],{'firstName':_0x456e22[_0xa127('0x24')]['from'],'ListId':_0x49f9cc['ListId']});_0x639af6[_0x456e22['body'][_0xa127('0x2f')]]=_0x456e22['body']['from'];return db['CmContact']['create'](_0x639af6,{'fields':_0x3d610b,'raw':!![]});}})[_0xa127('0x10')](function(_0x40def7){_0x5a2605[_0xa127('0x40')]=_0x40def7;if(_0x40def7){var _0x1fab71={'ContactId':_0x40def7['id'],'FaxAccountId':_0x456e22[_0xa127('0x36')]['id'],'fax':_0x40def7[_0xa127('0x41')]};return db['FaxInteraction'][_0xa127('0x35')]({'where':{'ContactId':_0x40def7['id'],'closed':![],'FaxAccountId':_0x456e22[_0xa127('0x36')]['id']}})[_0xa127('0x10')](function(_0x4b8ffa){if(_0x4b8ffa){return[_0x4b8ffa,![]];}return db[_0xa127('0x42')]['create'](_0x1fab71)['then'](function(_0x120642){return[_0x120642,!![]];});});}else{throw new Error(_0xa127('0x43'));}})[_0xa127('0x44')](function(_0x316cd2,_0x4d3561){var _0x1e418e=_0x316cd2[_0xa127('0x45')]({'plain':!![]});if(_0x4d3561){if(_0x5a2605[_0xa127('0x36')][_0xa127('0x46')]){_0x5a2605[_0xa127('0x3b')]['push']({'id':0x0,'priority':_0x5a2605[_0xa127('0x3b')][_0xa127('0x3e')]+0x1,'app':_0xa127('0x47'),'appdata':_0xa127('0x48'),'interval':_0xa127('0x49')});}_0x1e418e[_0xa127('0x4a')]=!![];}else{_0x1e418e[_0xa127('0x4a')]=![];}_0x5a2605[_0xa127('0x4b')]=_0x1e418e;return db['FaxMessage'][_0xa127('0x4c')]({'body':_0x456e22[_0xa127('0x24')][_0xa127('0x24')],'FaxAccountId':_0x456e22[_0xa127('0x36')]['id'],'FaxInteractionId':_0x316cd2['id'],'direction':'in','ContactId':_0x316cd2['ContactId'],'AttachmentId':_0x456e22[_0xa127('0x24')][_0xa127('0x4d')]});})['then'](function(_0x407564){_0x5a2605[_0xa127('0x18')]=_0x407564;if(_0x5a2605['interaction'][_0xa127('0x4e')]){return db['User'][_0xa127('0x35')]({'attributes':['id',_0xa127('0x4f')],'where':{'id':_0x5a2605[_0xa127('0x4b')][_0xa127('0x4e')]}})[_0xa127('0x10')](function(_0x31fe03){if(_0x31fe03){_0x5a2605['applications'][_0xa127('0x50')]({'id':0x0,'priority':0x0,'app':_0xa127('0x51'),'appdata':_0x31fe03[_0xa127('0x4f')]+','+(_0x5a2605[_0xa127('0x36')]['waitForTheAssignedAgent']||0xa),'interval':_0xa127('0x49')});}return respondWithRpcPromise('Start','startRouting',_0x5a2605);});}return respondWithRpcPromise(_0xa127('0x52'),_0xa127('0x53'),_0x5a2605);})['then'](function(_0x3783ae){_0x16d3ac(_0x3783ae);})['catch'](function(_0x29e272){_0x25b85e(_0xecc99a[_0xa127('0x17')](0x1f4,_0x29e272[_0xa127('0x18')]));});});}; \ No newline at end of file +var _0xe66b=['options','where','include','map','model','attributes','then','fax','CmContact','describe','Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','CompanyId','ListId','body','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','List','Contacts','updatedAt','DESC','FaxApplication','Applications','get','account','applications','orderBy','priority','asc','length','FaxInteraction','find','spread','autoclose','push','unmanaged','*,*,*,*','created','interaction','FaxMessage','AttachmentId','UserId','User','name','unshift','Start','startRouting','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','GetFaxAccount','FaxAccount','findAll'];(function(_0x315467,_0x4a661f){var _0x50656f=function(_0x28b832){while(--_0x28b832){_0x315467['push'](_0x315467['shift']());}};_0x50656f(++_0x4a661f);}(_0xe66b,0x17f));var _0xbe66=function(_0x4def59,_0x138fcb){_0x4def59=_0x4def59-0x0;var _0x4cfe14=_0xe66b[_0x4def59];return _0x4cfe14;};'use strict';var _=require(_0xbe66('0x0'));var util=require(_0xbe66('0x1'));var moment=require('moment');var BPromise=require(_0xbe66('0x2'));var rs=require(_0xbe66('0x3'));var fs=require('fs');var Redis=require(_0xbe66('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbe66('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xbe66('0x6'));var jayson=require(_0xbe66('0x7'));var client=jayson['client'][_0xbe66('0x8')]({'port':0x232c});config[_0xbe66('0x9')]=_[_0xbe66('0xa')](config[_0xbe66('0x9')],{'host':_0xbe66('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./faxAccount.socket')[_0xbe66('0xc')](socket);function respondWithRpcPromise(_0x444bdb,_0x2b470c,_0x5c7bfa){return new BPromise(function(_0x3608cb,_0x5266ba){return client[_0xbe66('0xd')](_0x444bdb,_0x5c7bfa)['then'](function(_0x21d8b9){logger['info'](_0xbe66('0xe'),_0x2b470c,_0xbe66('0xf'));logger[_0xbe66('0x10')]('FaxAccount,\x20%s,\x20%s,\x20%s',_0x2b470c,_0xbe66('0xf'),JSON[_0xbe66('0x11')](_0x21d8b9));if(_0x21d8b9[_0xbe66('0x12')]){if(_0x21d8b9[_0xbe66('0x12')][_0xbe66('0x13')]===0x1f4){logger['error'](_0xbe66('0xe'),_0x2b470c,_0x21d8b9[_0xbe66('0x12')][_0xbe66('0x14')]);return _0x5266ba(_0x21d8b9[_0xbe66('0x12')]['message']);}logger[_0xbe66('0x12')](_0xbe66('0xe'),_0x2b470c,_0x21d8b9[_0xbe66('0x12')][_0xbe66('0x14')]);return _0x3608cb(_0x21d8b9['error'][_0xbe66('0x14')]);}else{logger[_0xbe66('0x15')](_0xbe66('0xe'),_0x2b470c,_0xbe66('0xf'));_0x3608cb(_0x21d8b9[_0xbe66('0x16')][_0xbe66('0x14')]);}})[_0xbe66('0x17')](function(_0xaf8592){logger['error'](_0xbe66('0xe'),_0x2b470c,_0xaf8592);_0x5266ba(_0xaf8592);});});}exports[_0xbe66('0x18')]=function(_0x233a5f){var _0x53117c=this;return new Promise(function(_0x688274,_0x5a147c){return db[_0xbe66('0x19')][_0xbe66('0x1a')]({'raw':_0x233a5f[_0xbe66('0x1b')]?_0x233a5f[_0xbe66('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x233a5f[_0xbe66('0x1b')]?_0x233a5f[_0xbe66('0x1b')][_0xbe66('0x1c')]||null:null,'attributes':_0x233a5f[_0xbe66('0x1b')]?_0x233a5f[_0xbe66('0x1b')]['attributes']||null:null,'limit':_0x233a5f[_0xbe66('0x1b')]?_0x233a5f['options']['limit']||null:null,'include':_0x233a5f[_0xbe66('0x1b')]?_0x233a5f[_0xbe66('0x1b')][_0xbe66('0x1d')]?_[_0xbe66('0x1e')](_0x233a5f[_0xbe66('0x1b')][_0xbe66('0x1d')],function(_0x2a0db9){return{'model':db[_0x2a0db9[_0xbe66('0x1f')]],'as':_0x2a0db9['as'],'attributes':_0x2a0db9[_0xbe66('0x20')],'include':_0x2a0db9[_0xbe66('0x1d')]?_[_0xbe66('0x1e')](_0x2a0db9[_0xbe66('0x1d')],function(_0x3ed214){return{'model':db[_0x3ed214[_0xbe66('0x1f')]],'as':_0x3ed214['as'],'attributes':_0x3ed214[_0xbe66('0x20')],'include':_0x3ed214[_0xbe66('0x1d')]?_['map'](_0x3ed214['include'],function(_0xeb291b){return{'model':db[_0xeb291b['model']],'as':_0xeb291b['as'],'attributes':_0xeb291b[_0xbe66('0x20')]};}):[]};}):[]};}):[]:[]})[_0xbe66('0x21')](function(_0x50f456){logger['info'](_0xbe66('0x18'),_0x233a5f);logger[_0xbe66('0x10')](_0xbe66('0x18'),_0x233a5f,JSON[_0xbe66('0x11')](_0x50f456));_0x688274(_0x50f456);})['catch'](function(_0x2f3958){logger[_0xbe66('0x12')](_0xbe66('0x18'),_0x2f3958[_0xbe66('0x14')],_0x233a5f);_0x5a147c(_0x53117c[_0xbe66('0x12')](0x1f4,_0x2f3958[_0xbe66('0x14')]));});});};exports['NotifyFaxAccount']=function(_0x80fad,_0x16e0b2,_0x3409b2){var _0x253132=this;return new Promise(function(_0x35920f,_0x3000f6){var _0xe3995c={'body':_0x80fad['body'],'channel':_0xbe66('0x22')};var _0x4f7e6c=[];var _0x4969b2=[];var _0x1bed88={};return db[_0xbe66('0x23')][_0xbe66('0x24')]()[_0xbe66('0x21')](function(_0x37717c){if(!_0x37717c){throw new db[(_0xbe66('0x25'))][(_0xbe66('0x26'))](_0xbe66('0x27'));}_0x4f7e6c=_['difference'](_['keys'](_0x37717c),['createdAt','updatedAt']);_0x4969b2=_[_0xbe66('0x28')](_[_0xbe66('0x29')](_0x37717c),['createdAt','updatedAt',_0xbe66('0x2a'),_0xbe66('0x2b')]);if(_0x80fad[_0xbe66('0x2c')]['id']){delete _0x80fad['body']['id'];}if(_[_0xbe66('0x2d')](_0x80fad[_0xbe66('0x2c')][_0xbe66('0x2e')])){throw new db[(_0xbe66('0x25'))][(_0xbe66('0x26'))](_0xbe66('0x2f'));}if(_['isNil'](_0x80fad[_0xbe66('0x2c')][_0xbe66('0x2c')])||_0x80fad[_0xbe66('0x2c')][_0xbe66('0x2c')]===''){throw new db[(_0xbe66('0x25'))][(_0xbe66('0x26'))](_0xbe66('0x30'));}if(_[_0xbe66('0x2d')](_0x80fad['body'][_0xbe66('0x31')])){throw new db[(_0xbe66('0x25'))]['ValidationError'](_0xbe66('0x32')+_0x4969b2);}if(!_['includes'](_0x4969b2,_0x80fad[_0xbe66('0x2c')][_0xbe66('0x31')])){throw new db[(_0xbe66('0x25'))][(_0xbe66('0x26'))](_0xbe66('0x33')+_0x4969b2);}_0x1bed88[_0x80fad['body'][_0xbe66('0x31')]]=_0x80fad[_0xbe66('0x2c')][_0xbe66('0x2e')];})[_0xbe66('0x21')](function(){return db[_0xbe66('0x19')]['find']({'where':{'id':_0x80fad['account']['id']},'include':[{'model':db['CmList'],'as':_0xbe66('0x34'),'include':[{'model':db[_0xbe66('0x23')],'as':_0xbe66('0x35'),'where':_0x1bed88,'limit':0x1,'order':[[_0xbe66('0x36'),_0xbe66('0x37')]]}]},{'model':db[_0xbe66('0x38')],'as':_0xbe66('0x39')}]});})['then'](function(_0x24b5a1){if(_0x24b5a1&&_0x24b5a1[_0xbe66('0x34')]){var _0x23d18e=_0x24b5a1[_0xbe66('0x3a')]({'plain':!![]});_0xe3995c[_0xbe66('0x3b')]=_0x23d18e;_0xe3995c[_0xbe66('0x3c')]=_0x23d18e[_0xbe66('0x39')];_0xe3995c['list']=_0x23d18e[_0xbe66('0x34')];_0xe3995c[_0xbe66('0x3c')]=_[_0xbe66('0x3d')](_0xe3995c[_0xbe66('0x3c')],[_0xbe66('0x3e')],[_0xbe66('0x3f')]);if(_0xe3995c[_0xbe66('0x3b')][_0xbe66('0x39')]){delete _0xe3995c[_0xbe66('0x3b')][_0xbe66('0x39')];}if(_0xe3995c['account'][_0xbe66('0x34')]&&_0xe3995c[_0xbe66('0x3b')][_0xbe66('0x34')][_0xbe66('0x35')][_0xbe66('0x40')]){return _0xe3995c[_0xbe66('0x3b')][_0xbe66('0x34')][_0xbe66('0x35')][0x0];}var _0x113970=_[_0xbe66('0xa')](_0x80fad[_0xbe66('0x2c')],{'firstName':_0x80fad[_0xbe66('0x2c')][_0xbe66('0x2e')],'ListId':_0x23d18e[_0xbe66('0x2b')]});_0x113970[_0x80fad[_0xbe66('0x2c')]['mapKey']]=_0x80fad[_0xbe66('0x2c')][_0xbe66('0x2e')];return db[_0xbe66('0x23')]['create'](_0x113970,{'fields':_0x4f7e6c,'raw':!![]});}})[_0xbe66('0x21')](function(_0x5e4fd8){_0xe3995c['contact']=_0x5e4fd8;if(_0x5e4fd8){var _0x19c850={'ContactId':_0x5e4fd8['id'],'FaxAccountId':_0x80fad['account']['id'],'fax':_0x5e4fd8[_0xbe66('0x22')]};return db[_0xbe66('0x41')][_0xbe66('0x42')]({'where':{'ContactId':_0x5e4fd8['id'],'closed':![],'FaxAccountId':_0x80fad['account']['id']}})['then'](function(_0xf40c33){if(_0xf40c33){return[_0xf40c33,![]];}return db[_0xbe66('0x41')]['create'](_0x19c850)[_0xbe66('0x21')](function(_0x15074a){return[_0x15074a,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})[_0xbe66('0x43')](function(_0x34aacd,_0x3e091a){var _0x1095aa=_0x34aacd[_0xbe66('0x3a')]({'plain':!![]});if(_0x3e091a){if(_0xe3995c[_0xbe66('0x3b')][_0xbe66('0x44')]){_0xe3995c[_0xbe66('0x3c')][_0xbe66('0x45')]({'id':0x0,'priority':_0xe3995c[_0xbe66('0x3c')][_0xbe66('0x40')]+0x1,'app':'close','appdata':_0xbe66('0x46'),'interval':_0xbe66('0x47')});}_0x1095aa['created']=!![];}else{_0x1095aa[_0xbe66('0x48')]=![];}_0xe3995c[_0xbe66('0x49')]=_0x1095aa;return db[_0xbe66('0x4a')]['create']({'body':_0x80fad['body'][_0xbe66('0x2c')],'FaxAccountId':_0x80fad['account']['id'],'FaxInteractionId':_0x34aacd['id'],'direction':'in','ContactId':_0x34aacd['ContactId'],'AttachmentId':_0x80fad[_0xbe66('0x2c')][_0xbe66('0x4b')]});})['then'](function(_0x1b13b8){_0xe3995c[_0xbe66('0x14')]=_0x1b13b8;if(_0xe3995c['interaction'][_0xbe66('0x4c')]){return db[_0xbe66('0x4d')][_0xbe66('0x42')]({'attributes':['id',_0xbe66('0x4e')],'where':{'id':_0xe3995c[_0xbe66('0x49')][_0xbe66('0x4c')]}})[_0xbe66('0x21')](function(_0x5b4bb3){if(_0x5b4bb3){_0xe3995c[_0xbe66('0x3c')][_0xbe66('0x4f')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5b4bb3[_0xbe66('0x4e')]+','+(_0xe3995c[_0xbe66('0x3b')]['waitForTheAssignedAgent']||0xa),'interval':_0xbe66('0x47')});}return respondWithRpcPromise(_0xbe66('0x50'),_0xbe66('0x51'),_0xe3995c);});}return respondWithRpcPromise('Start',_0xbe66('0x51'),_0xe3995c);})['then'](function(_0x75d02c){_0x35920f(_0x75d02c);})[_0xbe66('0x17')](function(_0x385e12){_0x3000f6(_0x253132['error'](0x1f4,_0x385e12['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index c900cfe..c48dddf 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 _0x0b64=['./faxAccount.events','save','remove','update','emit','removeListener','register','faxAccount:'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x0b64,0x68));var _0x40b6=function(_0x370023,_0x1d4cd){_0x370023=_0x370023-0x0;var _0xf3d3fa=_0x0b64[_0x370023];return _0xf3d3fa;};'use strict';var FaxAccountEvents=require(_0x40b6('0x0'));var events=[_0x40b6('0x1'),_0x40b6('0x2'),_0x40b6('0x3')];function createListener(_0x4dbc40,_0xfded59){return function(_0x354759){_0xfded59[_0x40b6('0x4')](_0x4dbc40,_0x354759);};}function removeListener(_0x164bd1,_0xb17be9){return function(){FaxAccountEvents[_0x40b6('0x5')](_0x164bd1,_0xb17be9);};}exports[_0x40b6('0x6')]=function(_0x1be07e){for(var _0xf6b884=0x0,_0x35f6b7=events['length'];_0xf6b884<_0x35f6b7;_0xf6b884++){var _0x24fbdc=events[_0xf6b884];var _0x57a23c=createListener(_0x40b6('0x7')+_0x24fbdc,_0x1be07e);FaxAccountEvents['on'](_0x24fbdc,_0x57a23c);}}; \ No newline at end of file +var _0xe25f=['faxAccount:','./faxAccount.events','remove','register','length'];(function(_0x26d94d,_0x20e809){var _0x4190b7=function(_0x59fe4f){while(--_0x59fe4f){_0x26d94d['push'](_0x26d94d['shift']());}};_0x4190b7(++_0x20e809);}(_0xe25f,0x97));var _0xfe25=function(_0x3ec05e,_0x535b70){_0x3ec05e=_0x3ec05e-0x0;var _0x334fc6=_0xe25f[_0x3ec05e];return _0x334fc6;};'use strict';var FaxAccountEvents=require(_0xfe25('0x0'));var events=['save',_0xfe25('0x1'),'update'];function createListener(_0x50228e,_0x2f696d){return function(_0x3be653){_0x2f696d['emit'](_0x50228e,_0x3be653);};}function removeListener(_0x51019f,_0x494872){return function(){FaxAccountEvents['removeListener'](_0x51019f,_0x494872);};}exports[_0xfe25('0x2')]=function(_0x5d7589){for(var _0x1e6ca4=0x0,_0x384b89=events[_0xfe25('0x3')];_0x1e6ca4<_0x384b89;_0x1e6ca4++){var _0x4e4981=events[_0x1e6ca4];var _0x2cc4be=createListener(_0xfe25('0x4')+_0x4e4981,_0x5d7589);FaxAccountEvents['on'](_0x4e4981,_0x2cc4be);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index 14e76b2..0996041 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x20db31,_0x1937a4){var _0x1faf7e=function(_0x5f0b73){while(--_0x5f0b73){_0x20db31['push'](_0x20db31['shift']());}};_0x1faf7e(++_0x1937a4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x44f9d0,_0xba73f4){var _0x230ff7=function(_0x33f324){while(--_0x33f324){_0x44f9d0['push'](_0x44f9d0['shift']());}};_0x230ff7(++_0xba73f4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'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/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 9ee22d8..a342ac4 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 _0xb83e=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x73d140,_0xfd42b2){var _0x29a520=function(_0x2370c6){while(--_0x2370c6){_0x73d140['push'](_0x73d140['shift']());}};_0x29a520(++_0xfd42b2);}(_0xb83e,0x9d));var _0xeb83=function(_0x5abad9,_0x15f0d8){_0x5abad9=_0x5abad9-0x0;var _0x17e4c8=_0xb83e[_0x5abad9];return _0x17e4c8;};'use strict';var Sequelize=require(_0xeb83('0x0'));module[_0xeb83('0x1')]={'priority':{'type':Sequelize[_0xeb83('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xeb83('0x3')],'allowNull':![],'defaultValue':_0xeb83('0x4')},'appdata':{'type':Sequelize[_0xeb83('0x5')]()},'description':{'type':Sequelize[_0xeb83('0x3')]},'interval':{'type':Sequelize[_0xeb83('0x3')],'defaultValue':_0xeb83('0x6')}}; \ No newline at end of file +var _0xfdc0=['TEXT','*,*,*,*','exports','STRING','noop'];(function(_0x1d29f9,_0x4454f5){var _0x22ae0d=function(_0x3c07c3){while(--_0x3c07c3){_0x1d29f9['push'](_0x1d29f9['shift']());}};_0x22ae0d(++_0x4454f5);}(_0xfdc0,0x98));var _0x0fdc=function(_0x47f7ec,_0x369f9d){_0x47f7ec=_0x47f7ec-0x0;var _0x415101=_0xfdc0[_0x47f7ec];return _0x415101;};'use strict';var Sequelize=require('sequelize');module[_0x0fdc('0x0')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0fdc('0x1')],'allowNull':![],'defaultValue':_0x0fdc('0x2')},'appdata':{'type':Sequelize[_0x0fdc('0x3')]()},'description':{'type':Sequelize[_0x0fdc('0x1')]},'interval':{'type':Sequelize[_0x0fdc('0x1')],'defaultValue':_0x0fdc('0x4')}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index a695981..5176c58 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 _0x6139=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','save','update','then','destroy','error','stack','name','send','index','FaxApplication','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0xdc8a88,_0x39ba){var _0x23e31c=function(_0x4a51c6){while(--_0x4a51c6){_0xdc8a88['push'](_0xdc8a88['shift']());}};_0x23e31c(++_0x39ba);}(_0x6139,0x16a));var _0x9613=function(_0x3f2cfe,_0x16fd1c){_0x3f2cfe=_0x3f2cfe-0x0;var _0x36c4ae=_0x6139[_0x3f2cfe];return _0x36c4ae;};'use strict';var emlformat=require(_0x9613('0x0'));var rimraf=require(_0x9613('0x1'));var zipdir=require(_0x9613('0x2'));var jsonpatch=require(_0x9613('0x3'));var rp=require('request-promise');var moment=require(_0x9613('0x4'));var BPromise=require(_0x9613('0x5'));var Mustache=require(_0x9613('0x6'));var util=require(_0x9613('0x7'));var path=require(_0x9613('0x8'));var sox=require(_0x9613('0x9'));var csv=require(_0x9613('0xa'));var ejs=require(_0x9613('0xb'));var fs=require('fs');var fs_extra=require(_0x9613('0xc'));var _=require(_0x9613('0xd'));var squel=require(_0x9613('0xe'));var crypto=require('crypto');var jsforce=require(_0x9613('0xf'));var deskjs=require(_0x9613('0x10'));var toCsv=require(_0x9613('0xa'));var querystring=require(_0x9613('0x11'));var Papa=require(_0x9613('0x12'));var Redis=require('ioredis');var authService=require(_0x9613('0x13'));var qs=require(_0x9613('0x14'));var as=require(_0x9613('0x15'));var hardwareService=require(_0x9613('0x16'));var logger=require(_0x9613('0x17'))(_0x9613('0x18'));var utils=require(_0x9613('0x19'));var config=require(_0x9613('0x1a'));var licenseUtil=require(_0x9613('0x1b'));var db=require(_0x9613('0x1c'))['db'];function respondWithStatusCode(_0x308285,_0x1ecd02){_0x1ecd02=_0x1ecd02||0xcc;return function(_0x118cc8){if(_0x118cc8){return _0x308285[_0x9613('0x1d')](_0x1ecd02);}return _0x308285[_0x9613('0x1e')](_0x1ecd02)['end']();};}function respondWithResult(_0x117e0c,_0x5b2dc9){_0x5b2dc9=_0x5b2dc9||0xc8;return function(_0x5e899b){if(_0x5e899b){return _0x117e0c[_0x9613('0x1e')](_0x5b2dc9)[_0x9613('0x1f')](_0x5e899b);}};}function respondWithFilteredResult(_0xa08e19,_0x2c5502){return function(_0x105604){if(_0x105604){var _0x5d2b57=typeof _0x2c5502['offset']==='undefined'&&typeof _0x2c5502[_0x9613('0x20')]===_0x9613('0x21');var _0x4b8d3b=_0x105604['count'];var _0x4e1d49=_0x5d2b57?0x0:_0x2c5502[_0x9613('0x22')];var _0x4bdb91=_0x5d2b57?_0x105604[_0x9613('0x23')]:_0x2c5502[_0x9613('0x22')]+_0x2c5502['limit'];var _0x16626d;if(_0x4bdb91>=_0x4b8d3b){_0x4bdb91=_0x4b8d3b;_0x16626d=0xc8;}else{_0x16626d=0xce;}_0xa08e19[_0x9613('0x1e')](_0x16626d);return _0xa08e19['set']('Content-Range',_0x4e1d49+'-'+_0x4bdb91+'/'+_0x4b8d3b)['json'](_0x105604);}return null;};}function patchUpdates(_0x34e938){return function(_0x56f5a0){try{jsonpatch['apply'](_0x56f5a0,_0x34e938,!![]);}catch(_0x254385){return BPromise['reject'](_0x254385);}return _0x56f5a0[_0x9613('0x24')]();};}function saveUpdates(_0x5db94f,_0x2f3ecf){return function(_0x45e190){if(_0x45e190){return _0x45e190[_0x9613('0x25')](_0x5db94f)[_0x9613('0x26')](function(_0x5517f9){return _0x5517f9;});}return null;};}function removeEntity(_0x2e213c,_0x342c73){return function(_0x37b8a2){if(_0x37b8a2){return _0x37b8a2[_0x9613('0x27')]()[_0x9613('0x26')](function(){_0x2e213c[_0x9613('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x14ed4b,_0x3e42c0){return function(_0x48e9a0){if(!_0x48e9a0){_0x14ed4b['sendStatus'](0x194);}return _0x48e9a0;};}function handleError(_0x36366e,_0x373c95){_0x373c95=_0x373c95||0x1f4;return function(_0x20f7c1){logger[_0x9613('0x28')](_0x20f7c1[_0x9613('0x29')]);if(_0x20f7c1[_0x9613('0x2a')]){delete _0x20f7c1[_0x9613('0x2a')];}_0x36366e[_0x9613('0x1e')](_0x373c95)[_0x9613('0x2b')](_0x20f7c1);};}exports[_0x9613('0x2c')]=function(_0x4a6bbe,_0x595cf5){var _0x4d0f69={},_0x53ec73={},_0x5309e0={'count':0x0,'rows':[]};var _0x5b2ec8=_['map'](db[_0x9613('0x2d')][_0x9613('0x2e')],function(_0x24b236){return{'name':_0x24b236[_0x9613('0x2f')],'type':_0x24b236[_0x9613('0x30')]['key']};});_0x53ec73[_0x9613('0x31')]=_[_0x9613('0x32')](_0x5b2ec8,_0x9613('0x2a'));_0x53ec73[_0x9613('0x33')]=_[_0x9613('0x34')](_0x4a6bbe['query']);_0x53ec73[_0x9613('0x35')]=_[_0x9613('0x36')](_0x53ec73[_0x9613('0x31')],_0x53ec73['query']);_0x4d0f69[_0x9613('0x37')]=_[_0x9613('0x36')](_0x53ec73['model'],qs[_0x9613('0x38')](_0x4a6bbe['query'][_0x9613('0x38')]));_0x4d0f69[_0x9613('0x37')]=_0x4d0f69[_0x9613('0x37')][_0x9613('0x39')]?_0x4d0f69[_0x9613('0x37')]:_0x53ec73[_0x9613('0x31')];if(!_0x4a6bbe[_0x9613('0x33')][_0x9613('0x3a')]('nolimit')){_0x4d0f69[_0x9613('0x20')]=qs['limit'](_0x4a6bbe[_0x9613('0x33')]['limit']);_0x4d0f69[_0x9613('0x22')]=qs[_0x9613('0x22')](_0x4a6bbe[_0x9613('0x33')][_0x9613('0x22')]);}_0x4d0f69[_0x9613('0x3b')]=qs[_0x9613('0x3c')](_0x4a6bbe['query'][_0x9613('0x3c')]);_0x4d0f69['where']=qs['filters'](_[_0x9613('0x3d')](_0x4a6bbe[_0x9613('0x33')],_0x53ec73[_0x9613('0x35')]),_0x5b2ec8);if(_0x4a6bbe[_0x9613('0x33')][_0x9613('0x3e')]){_0x4d0f69[_0x9613('0x3f')]=_['merge'](_0x4d0f69[_0x9613('0x3f')],{'$or':_['map'](_0x5b2ec8,function(_0x3320b4){if(_0x3320b4[_0x9613('0x30')]!==_0x9613('0x40')){var _0x4094ea={};_0x4094ea[_0x3320b4[_0x9613('0x2a')]]={'$like':'%'+_0x4a6bbe['query']['filter']+'%'};return _0x4094ea;}})});}_0x4d0f69=_[_0x9613('0x41')]({},_0x4d0f69,_0x4a6bbe[_0x9613('0x42')]);var _0x5e1ac9={'where':_0x4d0f69[_0x9613('0x3f')]};return db['FaxApplication'][_0x9613('0x23')](_0x5e1ac9)['then'](function(_0x24b546){_0x5309e0[_0x9613('0x23')]=_0x24b546;if(_0x4a6bbe[_0x9613('0x33')][_0x9613('0x43')]){_0x4d0f69[_0x9613('0x44')]=[{'all':!![]}];}return db[_0x9613('0x2d')][_0x9613('0x45')](_0x4d0f69);})[_0x9613('0x26')](function(_0x2eee9f){_0x5309e0[_0x9613('0x46')]=_0x2eee9f;return _0x5309e0;})[_0x9613('0x26')](respondWithFilteredResult(_0x595cf5,_0x4d0f69))[_0x9613('0x47')](handleError(_0x595cf5,null));};exports[_0x9613('0x48')]=function(_0x10579d,_0x215f7e){var _0x11d3dc={'raw':!![],'where':{'id':_0x10579d[_0x9613('0x49')]['id']}},_0x4f57b9={};_0x4f57b9[_0x9613('0x31')]=_[_0x9613('0x34')](db['FaxApplication']['rawAttributes']);_0x4f57b9[_0x9613('0x33')]=_[_0x9613('0x34')](_0x10579d[_0x9613('0x33')]);_0x4f57b9['filters']=_['intersection'](_0x4f57b9[_0x9613('0x31')],_0x4f57b9[_0x9613('0x33')]);_0x11d3dc[_0x9613('0x37')]=_[_0x9613('0x36')](_0x4f57b9[_0x9613('0x31')],qs[_0x9613('0x38')](_0x10579d['query']['fields']));_0x11d3dc[_0x9613('0x37')]=_0x11d3dc[_0x9613('0x37')][_0x9613('0x39')]?_0x11d3dc['attributes']:_0x4f57b9['model'];if(_0x10579d[_0x9613('0x33')][_0x9613('0x43')]){_0x11d3dc[_0x9613('0x44')]=[{'all':!![]}];}_0x11d3dc=_['merge']({},_0x11d3dc,_0x10579d[_0x9613('0x42')]);return db[_0x9613('0x2d')][_0x9613('0x4a')](_0x11d3dc)[_0x9613('0x26')](handleEntityNotFound(_0x215f7e,null))[_0x9613('0x26')](respondWithResult(_0x215f7e,null))['catch'](handleError(_0x215f7e,null));};exports[_0x9613('0x4b')]=function(_0x59364e,_0x4689dd){return db[_0x9613('0x2d')][_0x9613('0x4b')](_0x59364e['body'],{})[_0x9613('0x26')](respondWithResult(_0x4689dd,0xc9))[_0x9613('0x47')](handleError(_0x4689dd,null));};exports['update']=function(_0x50b4e3,_0x584bfa){if(_0x50b4e3['body']['id']){delete _0x50b4e3['body']['id'];}return db[_0x9613('0x2d')][_0x9613('0x4a')]({'where':{'id':_0x50b4e3[_0x9613('0x49')]['id']}})[_0x9613('0x26')](handleEntityNotFound(_0x584bfa,null))[_0x9613('0x26')](saveUpdates(_0x50b4e3[_0x9613('0x4c')],null))[_0x9613('0x26')](respondWithResult(_0x584bfa,null))[_0x9613('0x47')](handleError(_0x584bfa,null));};exports[_0x9613('0x27')]=function(_0x1d3f18,_0xf9a155){return db[_0x9613('0x2d')][_0x9613('0x4a')]({'where':{'id':_0x1d3f18[_0x9613('0x49')]['id']}})[_0x9613('0x26')](handleEntityNotFound(_0xf9a155,null))['then'](removeEntity(_0xf9a155,null))[_0x9613('0x47')](handleError(_0xf9a155,null));}; \ No newline at end of file +var _0xacac=['../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','end','stack','name','send','index','map','FaxApplication','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','filter','options','includeAll','include','rows','params','rawAttributes','length','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/environment'];(function(_0x4b7634,_0x12aca7){var _0x236d79=function(_0x5c83ce){while(--_0x5c83ce){_0x4b7634['push'](_0x4b7634['shift']());}};_0x236d79(++_0x12aca7);}(_0xacac,0xc1));var _0xcaca=function(_0xed4a5e,_0x494a01){_0xed4a5e=_0xed4a5e-0x0;var _0x593bda=_0xacac[_0xed4a5e];return _0x593bda;};'use strict';var emlformat=require(_0xcaca('0x0'));var rimraf=require(_0xcaca('0x1'));var zipdir=require(_0xcaca('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xcaca('0x3'));var BPromise=require(_0xcaca('0x4'));var Mustache=require(_0xcaca('0x5'));var util=require(_0xcaca('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xcaca('0x7'));var ejs=require(_0xcaca('0x8'));var fs=require('fs');var fs_extra=require(_0xcaca('0x9'));var _=require(_0xcaca('0xa'));var squel=require(_0xcaca('0xb'));var crypto=require(_0xcaca('0xc'));var jsforce=require(_0xcaca('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xcaca('0x7'));var querystring=require(_0xcaca('0xe'));var Papa=require(_0xcaca('0xf'));var Redis=require(_0xcaca('0x10'));var authService=require(_0xcaca('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xcaca('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xcaca('0x13'));var licenseUtil=require(_0xcaca('0x14'));var db=require(_0xcaca('0x15'))['db'];function respondWithStatusCode(_0x240782,_0x3db6eb){_0x3db6eb=_0x3db6eb||0xcc;return function(_0x1a4b10){if(_0x1a4b10){return _0x240782[_0xcaca('0x16')](_0x3db6eb);}return _0x240782['status'](_0x3db6eb)['end']();};}function respondWithResult(_0x138973,_0x3e09a8){_0x3e09a8=_0x3e09a8||0xc8;return function(_0x411636){if(_0x411636){return _0x138973[_0xcaca('0x17')](_0x3e09a8)[_0xcaca('0x18')](_0x411636);}};}function respondWithFilteredResult(_0x4b1cdc,_0x466ed1){return function(_0x112bc5){if(_0x112bc5){var _0x3f427b=typeof _0x466ed1[_0xcaca('0x19')]===_0xcaca('0x1a')&&typeof _0x466ed1['limit']===_0xcaca('0x1a');var _0xe1ec59=_0x112bc5[_0xcaca('0x1b')];var _0x556f29=_0x3f427b?0x0:_0x466ed1['offset'];var _0x2b336b=_0x3f427b?_0x112bc5[_0xcaca('0x1b')]:_0x466ed1['offset']+_0x466ed1['limit'];var _0x4dd0ab;if(_0x2b336b>=_0xe1ec59){_0x2b336b=_0xe1ec59;_0x4dd0ab=0xc8;}else{_0x4dd0ab=0xce;}_0x4b1cdc['status'](_0x4dd0ab);return _0x4b1cdc[_0xcaca('0x1c')](_0xcaca('0x1d'),_0x556f29+'-'+_0x2b336b+'/'+_0xe1ec59)['json'](_0x112bc5);}return null;};}function patchUpdates(_0x1e18df){return function(_0x142350){try{jsonpatch[_0xcaca('0x1e')](_0x142350,_0x1e18df,!![]);}catch(_0x5eb92d){return BPromise[_0xcaca('0x1f')](_0x5eb92d);}return _0x142350[_0xcaca('0x20')]();};}function saveUpdates(_0xa44228,_0x517cfc){return function(_0x2f8e15){if(_0x2f8e15){return _0x2f8e15[_0xcaca('0x21')](_0xa44228)['then'](function(_0x5894ec){return _0x5894ec;});}return null;};}function removeEntity(_0x50615f,_0x254b99){return function(_0x1e049a){if(_0x1e049a){return _0x1e049a['destroy']()[_0xcaca('0x22')](function(){_0x50615f['status'](0xcc)[_0xcaca('0x23')]();});}};}function handleEntityNotFound(_0x34f450,_0xc2b26d){return function(_0x405bd5){if(!_0x405bd5){_0x34f450[_0xcaca('0x16')](0x194);}return _0x405bd5;};}function handleError(_0xb0ab35,_0x1f1733){_0x1f1733=_0x1f1733||0x1f4;return function(_0x14850e){logger['error'](_0x14850e[_0xcaca('0x24')]);if(_0x14850e[_0xcaca('0x25')]){delete _0x14850e['name'];}_0xb0ab35[_0xcaca('0x17')](_0x1f1733)[_0xcaca('0x26')](_0x14850e);};}exports[_0xcaca('0x27')]=function(_0xfb60a5,_0x414c73){var _0x5cece4={},_0x1e7cf7={},_0x583b50={'count':0x0,'rows':[]};var _0x440e39=_[_0xcaca('0x28')](db[_0xcaca('0x29')]['rawAttributes'],function(_0x139944){return{'name':_0x139944['fieldName'],'type':_0x139944[_0xcaca('0x2a')]['key']};});_0x1e7cf7[_0xcaca('0x2b')]=_[_0xcaca('0x28')](_0x440e39,_0xcaca('0x25'));_0x1e7cf7['query']=_[_0xcaca('0x2c')](_0xfb60a5[_0xcaca('0x2d')]);_0x1e7cf7[_0xcaca('0x2e')]=_[_0xcaca('0x2f')](_0x1e7cf7[_0xcaca('0x2b')],_0x1e7cf7[_0xcaca('0x2d')]);_0x5cece4[_0xcaca('0x30')]=_[_0xcaca('0x2f')](_0x1e7cf7[_0xcaca('0x2b')],qs['fields'](_0xfb60a5[_0xcaca('0x2d')][_0xcaca('0x31')]));_0x5cece4[_0xcaca('0x30')]=_0x5cece4['attributes']['length']?_0x5cece4[_0xcaca('0x30')]:_0x1e7cf7[_0xcaca('0x2b')];if(!_0xfb60a5[_0xcaca('0x2d')][_0xcaca('0x32')](_0xcaca('0x33'))){_0x5cece4[_0xcaca('0x34')]=qs[_0xcaca('0x34')](_0xfb60a5['query'][_0xcaca('0x34')]);_0x5cece4[_0xcaca('0x19')]=qs[_0xcaca('0x19')](_0xfb60a5[_0xcaca('0x2d')]['offset']);}_0x5cece4[_0xcaca('0x35')]=qs[_0xcaca('0x36')](_0xfb60a5[_0xcaca('0x2d')][_0xcaca('0x36')]);_0x5cece4[_0xcaca('0x37')]=qs['filters'](_[_0xcaca('0x38')](_0xfb60a5['query'],_0x1e7cf7['filters']),_0x440e39);if(_0xfb60a5[_0xcaca('0x2d')]['filter']){_0x5cece4[_0xcaca('0x37')]=_[_0xcaca('0x39')](_0x5cece4['where'],{'$or':_['map'](_0x440e39,function(_0x1822ef){if(_0x1822ef['type']!=='VIRTUAL'){var _0x4e684e={};_0x4e684e[_0x1822ef['name']]={'$like':'%'+_0xfb60a5[_0xcaca('0x2d')][_0xcaca('0x3a')]+'%'};return _0x4e684e;}})});}_0x5cece4=_['merge']({},_0x5cece4,_0xfb60a5[_0xcaca('0x3b')]);var _0x35b7dc={'where':_0x5cece4[_0xcaca('0x37')]};return db['FaxApplication'][_0xcaca('0x1b')](_0x35b7dc)[_0xcaca('0x22')](function(_0x445f91){_0x583b50[_0xcaca('0x1b')]=_0x445f91;if(_0xfb60a5['query'][_0xcaca('0x3c')]){_0x5cece4[_0xcaca('0x3d')]=[{'all':!![]}];}return db[_0xcaca('0x29')]['findAll'](_0x5cece4);})[_0xcaca('0x22')](function(_0x4f21fe){_0x583b50[_0xcaca('0x3e')]=_0x4f21fe;return _0x583b50;})['then'](respondWithFilteredResult(_0x414c73,_0x5cece4))['catch'](handleError(_0x414c73,null));};exports['show']=function(_0x3e3c81,_0x225639){var _0x53b1f3={'raw':!![],'where':{'id':_0x3e3c81[_0xcaca('0x3f')]['id']}},_0x55c4c1={};_0x55c4c1['model']=_[_0xcaca('0x2c')](db[_0xcaca('0x29')][_0xcaca('0x40')]);_0x55c4c1[_0xcaca('0x2d')]=_[_0xcaca('0x2c')](_0x3e3c81['query']);_0x55c4c1[_0xcaca('0x2e')]=_[_0xcaca('0x2f')](_0x55c4c1[_0xcaca('0x2b')],_0x55c4c1[_0xcaca('0x2d')]);_0x53b1f3[_0xcaca('0x30')]=_[_0xcaca('0x2f')](_0x55c4c1['model'],qs['fields'](_0x3e3c81[_0xcaca('0x2d')][_0xcaca('0x31')]));_0x53b1f3[_0xcaca('0x30')]=_0x53b1f3[_0xcaca('0x30')][_0xcaca('0x41')]?_0x53b1f3[_0xcaca('0x30')]:_0x55c4c1['model'];if(_0x3e3c81[_0xcaca('0x2d')][_0xcaca('0x3c')]){_0x53b1f3[_0xcaca('0x3d')]=[{'all':!![]}];}_0x53b1f3=_['merge']({},_0x53b1f3,_0x3e3c81[_0xcaca('0x3b')]);return db[_0xcaca('0x29')][_0xcaca('0x42')](_0x53b1f3)[_0xcaca('0x22')](handleEntityNotFound(_0x225639,null))[_0xcaca('0x22')](respondWithResult(_0x225639,null))[_0xcaca('0x43')](handleError(_0x225639,null));};exports[_0xcaca('0x44')]=function(_0x332eae,_0x5824ef){return db[_0xcaca('0x29')][_0xcaca('0x44')](_0x332eae[_0xcaca('0x45')],{})[_0xcaca('0x22')](respondWithResult(_0x5824ef,0xc9))[_0xcaca('0x43')](handleError(_0x5824ef,null));};exports[_0xcaca('0x21')]=function(_0x5567c0,_0x5aa6e1){if(_0x5567c0['body']['id']){delete _0x5567c0[_0xcaca('0x45')]['id'];}return db['FaxApplication'][_0xcaca('0x42')]({'where':{'id':_0x5567c0['params']['id']}})[_0xcaca('0x22')](handleEntityNotFound(_0x5aa6e1,null))['then'](saveUpdates(_0x5567c0['body'],null))['then'](respondWithResult(_0x5aa6e1,null))[_0xcaca('0x43')](handleError(_0x5aa6e1,null));};exports[_0xcaca('0x46')]=function(_0x20aff8,_0x511adf){return db[_0xcaca('0x29')]['find']({'where':{'id':_0x20aff8['params']['id']}})['then'](handleEntityNotFound(_0x511adf,null))[_0xcaca('0x22')](removeEntity(_0x511adf,null))[_0xcaca('0x43')](handleError(_0x511adf,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b674033..f7f77ec 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 _0xbca8=['define','FaxApplication','fax_applications','utf8mb4','utf8mb4_unicode_ci','lodash','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x2b81be,_0x544bdf){var _0x8ed4a7=function(_0x4a7bf4){while(--_0x4a7bf4){_0x2b81be['push'](_0x2b81be['shift']());}};_0x8ed4a7(++_0x544bdf);}(_0xbca8,0xf5));var _0x8bca=function(_0x3f56bf,_0x5f2ea5){_0x3f56bf=_0x3f56bf-0x0;var _0x382111=_0xbca8[_0x3f56bf];return _0x382111;};'use strict';var _=require(_0x8bca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x8bca('0x1'));var moment=require(_0x8bca('0x2'));var BPromise=require(_0x8bca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8bca('0x4'));var rimraf=require(_0x8bca('0x5'));var config=require(_0x8bca('0x6'));var attributes=require('./faxApplication.attributes');module['exports']=function(_0x2fa9c4,_0x82f014){return _0x2fa9c4[_0x8bca('0x7')](_0x8bca('0x8'),attributes,{'tableName':_0x8bca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8bca('0xa'),'collate':_0x8bca('0xb')});}; \ No newline at end of file +var _0x18cd=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxApplication.attributes','FaxApplication','fax_applications','utf8mb4','lodash','util','../../config/logger'];(function(_0x2304e2,_0x80cd5f){var _0x5cc051=function(_0x1ba229){while(--_0x1ba229){_0x2304e2['push'](_0x2304e2['shift']());}};_0x5cc051(++_0x80cd5f);}(_0x18cd,0x169));var _0xd18c=function(_0x15323d,_0x2d2b53){_0x15323d=_0x15323d-0x0;var _0x47c234=_0x18cd[_0x15323d];return _0x47c234;};'use strict';var _=require(_0xd18c('0x0'));var util=require(_0xd18c('0x1'));var logger=require(_0xd18c('0x2'))(_0xd18c('0x3'));var moment=require(_0xd18c('0x4'));var BPromise=require(_0xd18c('0x5'));var rp=require(_0xd18c('0x6'));var fs=require('fs');var path=require(_0xd18c('0x7'));var rimraf=require(_0xd18c('0x8'));var config=require(_0xd18c('0x9'));var attributes=require(_0xd18c('0xa'));module['exports']=function(_0x346e0e,_0x1a88a1){return _0x346e0e['define'](_0xd18c('0xb'),attributes,{'tableName':_0xd18c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd18c('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 50258b4..63d314c 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 _0x553b=['error','message','result','catch','FaxApplication','body','options','raw','where','limit','UpdateFaxApplication','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','FaxApplication,\x20%s,\x20%s','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x55eb91,_0x3ee9c5){var _0x4a9bda=function(_0x1773a2){while(--_0x1773a2){_0x55eb91['push'](_0x55eb91['shift']());}};_0x4a9bda(++_0x3ee9c5);}(_0x553b,0xfb));var _0xb553=function(_0xba7332,_0x1a5031){_0xba7332=_0xba7332-0x0;var _0xc0538e=_0x553b[_0xba7332];return _0xc0538e;};'use strict';var _=require(_0xb553('0x0'));var util=require(_0xb553('0x1'));var moment=require('moment');var BPromise=require(_0xb553('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb553('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb553('0x4'));var logger=require(_0xb553('0x5'))(_0xb553('0x6'));var config=require(_0xb553('0x7'));var jayson=require(_0xb553('0x8'));var client=jayson[_0xb553('0x9')][_0xb553('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3c0850,_0x6c513,_0x4ac28c){return new BPromise(function(_0x373e29,_0x5ca32c){return client[_0xb553('0xb')](_0x3c0850,_0x4ac28c)[_0xb553('0xc')](function(_0x297d6c){logger[_0xb553('0xd')](_0xb553('0xe'),_0x6c513,_0xb553('0xf'));logger[_0xb553('0x10')](_0xb553('0x11'),_0x6c513,_0xb553('0xf'),JSON[_0xb553('0x12')](_0x297d6c));if(_0x297d6c[_0xb553('0x13')]){if(_0x297d6c[_0xb553('0x13')]['code']===0x1f4){logger['error'](_0xb553('0xe'),_0x6c513,_0x297d6c[_0xb553('0x13')][_0xb553('0x14')]);return _0x5ca32c(_0x297d6c[_0xb553('0x13')][_0xb553('0x14')]);}logger['error']('FaxApplication,\x20%s,\x20%s',_0x6c513,_0x297d6c[_0xb553('0x13')]['message']);return _0x373e29(_0x297d6c['error'][_0xb553('0x14')]);}else{logger[_0xb553('0xd')]('FaxApplication,\x20%s,\x20%s',_0x6c513,_0xb553('0xf'));_0x373e29(_0x297d6c[_0xb553('0x15')]['message']);}})[_0xb553('0x16')](function(_0x2c665c){logger[_0xb553('0x13')]('FaxApplication,\x20%s,\x20%s',_0x6c513,_0x2c665c);_0x5ca32c(_0x2c665c);});});}exports['UpdateFaxApplication']=function(_0x24639e){var _0x3f475a=this;return new Promise(function(_0x39a3eb,_0x4cbf20){return db[_0xb553('0x17')]['update'](_0x24639e[_0xb553('0x18')],{'raw':_0x24639e[_0xb553('0x19')]?_0x24639e[_0xb553('0x19')][_0xb553('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x24639e[_0xb553('0x19')]?_0x24639e['options'][_0xb553('0x1b')]||null:null,'attributes':_0x24639e[_0xb553('0x19')]?_0x24639e[_0xb553('0x19')]['attributes']||null:null,'limit':_0x24639e[_0xb553('0x19')]?_0x24639e[_0xb553('0x19')][_0xb553('0x1c')]||null:null})[_0xb553('0xc')](function(_0x49edc1){logger[_0xb553('0xd')](_0xb553('0x1d'),_0x24639e);logger[_0xb553('0x10')](_0xb553('0x1d'),_0x24639e,JSON['stringify'](_0x49edc1));_0x39a3eb(_0x49edc1);})['catch'](function(_0x22770e){logger['error'](_0xb553('0x1d'),_0x22770e['message'],_0x24639e);_0x4cbf20(_0x3f475a['error'](0x1f4,_0x22770e[_0xb553('0x14')]));});});}; \ No newline at end of file +var _0x7ed3=['UpdateFaxApplication','FaxApplication','update','options','attributes','limit','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','request','then','info','FaxApplication,\x20%s,\x20%s','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x2ddc60,_0x11236f){var _0x3fb03c=function(_0x5c09cb){while(--_0x5c09cb){_0x2ddc60['push'](_0x2ddc60['shift']());}};_0x3fb03c(++_0x11236f);}(_0x7ed3,0x1c0));var _0x37ed=function(_0x22ff75,_0x5ce0db){_0x22ff75=_0x22ff75-0x0;var _0x4874c1=_0x7ed3[_0x22ff75];return _0x4874c1;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x37ed('0x0'));var BPromise=require(_0x37ed('0x1'));var rs=require(_0x37ed('0x2'));var fs=require('fs');var Redis=require(_0x37ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x37ed('0x4'));var jayson=require(_0x37ed('0x5'));var client=jayson[_0x37ed('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x18bb2e,_0x401065,_0x5e2b58){return new BPromise(function(_0x25da0b,_0x56974c){return client[_0x37ed('0x7')](_0x18bb2e,_0x5e2b58)[_0x37ed('0x8')](function(_0x7abcc3){logger[_0x37ed('0x9')](_0x37ed('0xa'),_0x401065,'request\x20sent');logger[_0x37ed('0xb')](_0x37ed('0xc'),_0x401065,'request\x20sent',JSON[_0x37ed('0xd')](_0x7abcc3));if(_0x7abcc3[_0x37ed('0xe')]){if(_0x7abcc3[_0x37ed('0xe')][_0x37ed('0xf')]===0x1f4){logger[_0x37ed('0xe')](_0x37ed('0xa'),_0x401065,_0x7abcc3[_0x37ed('0xe')][_0x37ed('0x10')]);return _0x56974c(_0x7abcc3[_0x37ed('0xe')][_0x37ed('0x10')]);}logger['error'](_0x37ed('0xa'),_0x401065,_0x7abcc3[_0x37ed('0xe')][_0x37ed('0x10')]);return _0x25da0b(_0x7abcc3[_0x37ed('0xe')][_0x37ed('0x10')]);}else{logger[_0x37ed('0x9')](_0x37ed('0xa'),_0x401065,_0x37ed('0x11'));_0x25da0b(_0x7abcc3[_0x37ed('0x12')][_0x37ed('0x10')]);}})[_0x37ed('0x13')](function(_0x4b1e38){logger[_0x37ed('0xe')](_0x37ed('0xa'),_0x401065,_0x4b1e38);_0x56974c(_0x4b1e38);});});}exports[_0x37ed('0x14')]=function(_0x14148e){var _0x791e35=this;return new Promise(function(_0x435f5e,_0x210b8a){return db[_0x37ed('0x15')][_0x37ed('0x16')](_0x14148e['body'],{'raw':_0x14148e[_0x37ed('0x17')]?_0x14148e[_0x37ed('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x14148e[_0x37ed('0x17')]?_0x14148e[_0x37ed('0x17')]['where']||null:null,'attributes':_0x14148e[_0x37ed('0x17')]?_0x14148e[_0x37ed('0x17')][_0x37ed('0x18')]||null:null,'limit':_0x14148e[_0x37ed('0x17')]?_0x14148e['options'][_0x37ed('0x19')]||null:null})[_0x37ed('0x8')](function(_0x1e3133){logger[_0x37ed('0x9')](_0x37ed('0x14'),_0x14148e);logger['debug'](_0x37ed('0x14'),_0x14148e,JSON['stringify'](_0x1e3133));_0x435f5e(_0x1e3133);})[_0x37ed('0x13')](function(_0xf1112b){logger[_0x37ed('0xe')]('UpdateFaxApplication',_0xf1112b[_0x37ed('0x10')],_0x14148e);_0x210b8a(_0x791e35[_0x37ed('0xe')](0x1f4,_0xf1112b['message']));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 08bb0a6..41f4482 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 _0x4024=['express','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','update','destroy','exports','multer','util','connect-timeout'];(function(_0x708b26,_0x3a98c4){var _0x3f2a98=function(_0x50357b){while(--_0x50357b){_0x708b26['push'](_0x708b26['shift']());}};_0x3f2a98(++_0x3a98c4);}(_0x4024,0x89));var _0x4402=function(_0x424ee3,_0x32c808){_0x424ee3=_0x424ee3-0x0;var _0x3c3723=_0x4024[_0x424ee3];return _0x3c3723;};'use strict';var multer=require(_0x4402('0x0'));var util=require(_0x4402('0x1'));var path=require('path');var timeout=require(_0x4402('0x2'));var express=require(_0x4402('0x3'));var router=express['Router']();var fs_extra=require(_0x4402('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x4402('0x5'));var config=require(_0x4402('0x6'));var controller=require('./faxApplication.controller');router['get']('/',auth[_0x4402('0x7')](),controller[_0x4402('0x8')]);router[_0x4402('0x9')]('/:id',auth[_0x4402('0x7')](),controller['show']);router['post']('/',auth[_0x4402('0x7')](),controller['create']);router['put'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xb')]);router['delete'](_0x4402('0xa'),auth['isAuthenticated'](),controller[_0x4402('0xc')]);module[_0x4402('0xd')]=router; \ No newline at end of file +var _0x9ffd=['util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./faxApplication.controller','isAuthenticated','index','get','/:id','show','post','create','delete','destroy','exports','multer'];(function(_0x3054be,_0x1bdc8b){var _0x3df150=function(_0x56cfbf){while(--_0x56cfbf){_0x3054be['push'](_0x3054be['shift']());}};_0x3df150(++_0x1bdc8b);}(_0x9ffd,0xaa));var _0xd9ff=function(_0x26a4ed,_0x30379b){_0x26a4ed=_0x26a4ed-0x0;var _0x59ef55=_0x9ffd[_0x26a4ed];return _0x59ef55;};'use strict';var multer=require(_0xd9ff('0x0'));var util=require(_0xd9ff('0x1'));var path=require(_0xd9ff('0x2'));var timeout=require('connect-timeout');var express=require(_0xd9ff('0x3'));var router=express[_0xd9ff('0x4')]();var fs_extra=require(_0xd9ff('0x5'));var auth=require(_0xd9ff('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xd9ff('0x7'));var controller=require(_0xd9ff('0x8'));router['get']('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xa')]);router[_0xd9ff('0xb')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xd')]);router[_0xd9ff('0xe')]('/',auth[_0xd9ff('0x9')](),controller[_0xd9ff('0xf')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xd9ff('0x10')](_0xd9ff('0xc'),auth[_0xd9ff('0x9')](),controller[_0xd9ff('0x11')]);module[_0xd9ff('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index c8c3493..0f667f2 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 _0x5496=['ENUM','out','exports','DATE','STRING'];(function(_0x231a22,_0x237892){var _0x53f9d3=function(_0x31c722){while(--_0x31c722){_0x231a22['push'](_0x231a22['shift']());}};_0x53f9d3(++_0x237892);}(_0x5496,0xb1));var _0x6549=function(_0x32afe1,_0x85042e){_0x32afe1=_0x32afe1-0x0;var _0x1e886f=_0x5496[_0x32afe1];return _0x1e886f;};'use strict';var Sequelize=require('sequelize');module[_0x6549('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x6549('0x1')]},'disposition':{'type':Sequelize[_0x6549('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6549('0x2')]},'note':{'type':Sequelize[_0x6549('0x2')]},'read1stAt':{'type':Sequelize[_0x6549('0x1')]},'fax':{'type':Sequelize[_0x6549('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x6549('0x3')]('in',_0x6549('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x6549('0x1')]},'lastMsgDirection':{'type':Sequelize[_0x6549('0x3')]('in',_0x6549('0x4')),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0xd853=['STRING','DATE','ENUM','out','sequelize','exports','BOOLEAN'];(function(_0x2e9eec,_0x3991ee){var _0x3cd0f3=function(_0x143d83){while(--_0x143d83){_0x2e9eec['push'](_0x2e9eec['shift']());}};_0x3cd0f3(++_0x3991ee);}(_0xd853,0xb3));var _0x3d85=function(_0x4b03d3,_0x32f1d2){_0x4b03d3=_0x4b03d3-0x0;var _0x58a968=_0xd853[_0x4b03d3];return _0x58a968;};'use strict';var Sequelize=require(_0x3d85('0x0'));module[_0x3d85('0x1')]={'closed':{'type':Sequelize[_0x3d85('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3d85('0x3')]},'secondDisposition':{'type':Sequelize[_0x3d85('0x3')]},'thirdDisposition':{'type':Sequelize[_0x3d85('0x3')]},'note':{'type':Sequelize[_0x3d85('0x3')]},'read1stAt':{'type':Sequelize[_0x3d85('0x4')]},'fax':{'type':Sequelize[_0x3d85('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x3d85('0x5')]('in',_0x3d85('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x3d85('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 25120c6..7123bf1 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 _0x4881=['ui.FaxInteractionId','left_join','users','fax_interactions','cm_contacts','o.id\x20=\x20i.UserId','fax_accounts','fax_messages','fax_interaction_has_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','conditions','length','find','unreadMessages','having','`\x20=\x200','`\x20>\x200','Contact','operator','$substring','value','split','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','start','Tag','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','buildExpression','keys','some','FaxAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\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?','group','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.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','isEmpty','i.FaxAccountId\x20IS\x20NULL','i.FaxAccountId\x20IN\x20?','sequelize','count','toString','keyBy','merge','fields','Account.key','a.mandatoryDisposition','Account.mandatoryDisposition','i.*','c.firstName','Contact.firstName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.fullname','o.internal','groupBy','FaxInteractionId','all','rows','params','rawAttributes','includeAll','options','create','body','destroy','describe','addMessage','FaxMessage','omit','ids','getMessages','findOne','pick','format','include','addTags','setTags','spread','findAll','faxInteractionTags:save','removeTags','download','join','files','tmp','root','server','attachments','transcript-%d-%s.zip','push','Messages','get','mkdirSync','Attachment','basename','createWriteStream','log','err','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','sendStatus','status','end','offset','undefined','limit','set','json','apply','reject','update','then','error','stack','name','send','map','fullname','TagIds','Tags','forEach','catch','index','FaxInteraction','fieldName','type','key','model','query','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','filters','select','field','color','from','tools_tags','u.id','u.fullname'];(function(_0x145f21,_0x1296bd){var _0x90912d=function(_0x69e9cc){while(--_0x69e9cc){_0x145f21['push'](_0x145f21['shift']());}};_0x90912d(++_0x1296bd);}(_0x4881,0x8a));var _0x1488=function(_0x491e33,_0x3e47fe){_0x491e33=_0x491e33-0x0;var _0x557c71=_0x4881[_0x491e33];return _0x557c71;};'use strict';var emlformat=require(_0x1488('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x1488('0x1'));var rp=require(_0x1488('0x2'));var moment=require(_0x1488('0x3'));var BPromise=require(_0x1488('0x4'));var Mustache=require(_0x1488('0x5'));var util=require(_0x1488('0x6'));var path=require(_0x1488('0x7'));var sox=require(_0x1488('0x8'));var csv=require(_0x1488('0x9'));var ejs=require(_0x1488('0xa'));var fs=require('fs');var fs_extra=require(_0x1488('0xb'));var _=require(_0x1488('0xc'));var squel=require(_0x1488('0xd'));var crypto=require(_0x1488('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x1488('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x1488('0x10'));var authService=require(_0x1488('0x11'));var qs=require(_0x1488('0x12'));var as=require(_0x1488('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1488('0x14'))(_0x1488('0x15'));var utils=require(_0x1488('0x16'));var config=require(_0x1488('0x17'));var licenseUtil=require(_0x1488('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x1488('0x19')](config[_0x1488('0x1a')],{'host':_0x1488('0x1b'),'port':0x18eb});var socket=require(_0x1488('0x1c'))(new Redis(config[_0x1488('0x1a')]));require(_0x1488('0x1d'))['register'](socket);function respondWithStatusCode(_0x3e7a67,_0x3045e1){_0x3045e1=_0x3045e1||0xcc;return function(_0xb9d0f8){if(_0xb9d0f8){return _0x3e7a67[_0x1488('0x1e')](_0x3045e1);}return _0x3e7a67[_0x1488('0x1f')](_0x3045e1)[_0x1488('0x20')]();};}function respondWithResult(_0x16c40e,_0x441b1f){_0x441b1f=_0x441b1f||0xc8;return function(_0x4357d4){if(_0x4357d4){return _0x16c40e[_0x1488('0x1f')](_0x441b1f)['json'](_0x4357d4);}};}function respondWithFilteredResult(_0x825f08,_0xc7a3ed){return function(_0x26cec1){if(_0x26cec1){var _0x41afcb=typeof _0xc7a3ed[_0x1488('0x21')]===_0x1488('0x22')&&typeof _0xc7a3ed['limit']==='undefined';var _0x4b0dec=_0x26cec1['count'];var _0x2e2224=_0x41afcb?0x0:_0xc7a3ed[_0x1488('0x21')];var _0x5d7928=_0x41afcb?_0x26cec1['count']:_0xc7a3ed[_0x1488('0x21')]+_0xc7a3ed[_0x1488('0x23')];var _0x45a8e5;if(_0x5d7928>=_0x4b0dec){_0x5d7928=_0x4b0dec;_0x45a8e5=0xc8;}else{_0x45a8e5=0xce;}_0x825f08['status'](_0x45a8e5);return _0x825f08[_0x1488('0x24')]('Content-Range',_0x2e2224+'-'+_0x5d7928+'/'+_0x4b0dec)[_0x1488('0x25')](_0x26cec1);}return null;};}function patchUpdates(_0x44e983){return function(_0x689a9c){try{jsonpatch[_0x1488('0x26')](_0x689a9c,_0x44e983,!![]);}catch(_0x3f5de8){return BPromise[_0x1488('0x27')](_0x3f5de8);}return _0x689a9c['save']();};}function saveUpdates(_0x2d20f8,_0x346202){return function(_0x14509b){if(_0x14509b){return _0x14509b[_0x1488('0x28')](_0x2d20f8)[_0x1488('0x29')](function(_0x5896a7){return _0x5896a7;});}return null;};}function removeEntity(_0x30609e,_0x1919e2){return function(_0x1110d4){if(_0x1110d4){return _0x1110d4['destroy']()[_0x1488('0x29')](function(){_0x30609e['status'](0xcc)[_0x1488('0x20')]();});}};}function handleEntityNotFound(_0x344b8a,_0x48c17c){return function(_0x473d01){if(!_0x473d01){_0x344b8a['sendStatus'](0x194);}return _0x473d01;};}function handleError(_0x4c35cd,_0x19e35d){_0x19e35d=_0x19e35d||0x1f4;return function(_0x2f1209){logger[_0x1488('0x2a')](_0x2f1209[_0x1488('0x2b')]);if(_0x2f1209[_0x1488('0x2c')]){delete _0x2f1209[_0x1488('0x2c')];}_0x4c35cd[_0x1488('0x1f')](_0x19e35d)[_0x1488('0x2d')](_0x2f1209);};}function getInteractionUsers(_0x2f51ca,_0xd986ce){return new BPromise(function(_0x486a90,_0x19c6c4){try{if(_0xd986ce[_0x2f51ca['id']]){_0x2f51ca['Users']=_[_0x1488('0x2e')](_0xd986ce[_0x2f51ca['id']],function(_0x4f8098){return{'id':_0x4f8098['id'],'fullname':_0x4f8098[_0x1488('0x2f')]};});}}catch(_0x1f7cc7){_0x19c6c4(_0x1f7cc7);}_0x486a90(_0x2f51ca);});}function getInteractionTags(_0x1df9cf,_0x35848b){return new BPromise(function(_0x3f1ba5,_0x59448c){try{if(_0x1df9cf[_0x1488('0x30')]){_0x1df9cf[_0x1488('0x31')]=[];_0x1df9cf[_0x1488('0x30')]['split'](',')[_0x1488('0x32')](function(_0x25f213){_0x1df9cf[_0x1488('0x31')]['push'](_0x35848b[_0x25f213]);});}delete _0x1df9cf[_0x1488('0x30')];}catch(_0x243c0a){_0x59448c(_0x243c0a);}_0x3f1ba5(_0x1df9cf);});}function updateFaxInteraction(_0x2b4324,_0x554602,_0x30367d){return new BPromise(function(_0x4d867a,_0x2f5348){return getInteractionUsers(_0x2b4324,_0x30367d)[_0x1488('0x29')](function(_0x2bb983){return getInteractionTags(_0x2bb983,_0x554602);})[_0x1488('0x29')](function(_0x173c82){_0x4d867a(_0x173c82);})[_0x1488('0x33')](function(_0x592da5){_0x2f5348(_0x592da5);});});}exports[_0x1488('0x34')]=function(_0x295b1e,_0x108841){var _0x4ff334={},_0x95e1db={},_0xdc8ddb={'count':0x0,'rows':[]};var _0x1a8e9a=_[_0x1488('0x2e')](db[_0x1488('0x35')]['rawAttributes'],function(_0x2a7d68){return{'name':_0x2a7d68[_0x1488('0x36')],'type':_0x2a7d68[_0x1488('0x37')][_0x1488('0x38')]};});_0x95e1db[_0x1488('0x39')]=_[_0x1488('0x2e')](_0x1a8e9a,_0x1488('0x2c'));_0x95e1db[_0x1488('0x3a')]=_['keys'](_0x295b1e[_0x1488('0x3a')]);_0x95e1db['filters']=_[_0x1488('0x3b')](_0x95e1db[_0x1488('0x39')],_0x95e1db[_0x1488('0x3a')]);_0x4ff334[_0x1488('0x3c')]=_['intersection'](_0x95e1db[_0x1488('0x39')],qs['fields'](_0x295b1e[_0x1488('0x3a')]['fields']));_0x4ff334[_0x1488('0x3c')]=_0x4ff334[_0x1488('0x3c')]['length']?_0x4ff334[_0x1488('0x3c')]:_0x95e1db[_0x1488('0x39')];if(!_0x295b1e[_0x1488('0x3a')][_0x1488('0x3d')](_0x1488('0x3e'))){_0x4ff334[_0x1488('0x23')]=qs[_0x1488('0x23')](_0x295b1e[_0x1488('0x3a')][_0x1488('0x23')]);_0x4ff334['offset']=qs[_0x1488('0x21')](_0x295b1e[_0x1488('0x3a')]['offset']);}_0x4ff334[_0x1488('0x3f')]=qs[_0x1488('0x40')](_0x295b1e['query']['sort']);_0x4ff334[_0x1488('0x41')]=qs['filters'](_['pick'](_0x295b1e['query'],_0x95e1db[_0x1488('0x42')]),_0x1a8e9a);var _0x474781=[];var _0xa69a91=squel[_0x1488('0x43')]()[_0x1488('0x44')]('id')[_0x1488('0x44')](_0x1488('0x2c'))[_0x1488('0x44')](_0x1488('0x45'))[_0x1488('0x46')](_0x1488('0x47'));var _0x4ad7a2=squel[_0x1488('0x43')]()[_0x1488('0x44')](_0x1488('0x48'))[_0x1488('0x44')](_0x1488('0x49'))[_0x1488('0x44')](_0x1488('0x4a'))[_0x1488('0x46')]('user_has_fax_interactions','ui')[_0x1488('0x4b')](_0x1488('0x4c'),'u','u.id\x20=\x20ui.UserId');var _0x1685a7=squel[_0x1488('0x43')]()['from'](_0x1488('0x4d'),'i')['left_join'](_0x1488('0x4e'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x1488('0x4b')](_0x1488('0x4c'),'o',_0x1488('0x4f'))['left_join'](_0x1488('0x50'),'a','a.id\x20=\x20i.FaxAccountId')[_0x1488('0x4b')](_0x1488('0x51'),'me','me.FaxInteractionId\x20=\x20i.id')[_0x1488('0x4b')](_0x1488('0x52'),'it','it.FaxInteractionId\x20=\x20i.id')[_0x1488('0x4b')](_0x1488('0x47'),'t',_0x1488('0x53'));var _0xf96811=squel['expr']();var _0x446d2a=[];var _0x8208bb=squel[_0x1488('0x54')]();var _0x1f82df;if(_0x295b1e[_0x1488('0x3a')]['search']){_0x1f82df=as[_0x1488('0x55')](_0x295b1e[_0x1488('0x3a')][_0x1488('0x56')]);var _0x1f9650=_0x1f82df['sqlOperator'];for(var _0x5d1d35=0x0;_0x5d1d35<_0x1f82df[_0x1488('0x57')][_0x1488('0x58')];_0x5d1d35++){var _0x26a157=_0x1f82df[_0x1488('0x57')][_0x5d1d35];var _0x13e05f='i';var _0x59fd10=_[_0x1488('0x59')](_0x1a8e9a,[_0x1488('0x2c'),_0x26a157['field']]);if(!_0x59fd10){switch(_0x26a157[_0x1488('0x44')]){case _0x1488('0x5a'):if(_0x26a157['value']==0x1){_0x1685a7[_0x1488('0x5b')]('`'+_0x26a157[_0x1488('0x44')]+_0x1488('0x5c'));}else{_0x1685a7[_0x1488('0x5b')]('`'+_0x26a157[_0x1488('0x44')]+_0x1488('0x5d'));}break;case _0x1488('0x5e'):if(_0x26a157[_0x1488('0x5f')]===_0x1488('0x60')){if(_0x26a157[_0x1488('0x61')][_0x1488('0x62')]('\x20')[_0x1488('0x58')]>0x1){_0xf96811[_0x1f9650](_0x1488('0x63'),qs[_0x1488('0x64')](_0x26a157[_0x1488('0x61')]),null);}else{var _0x445e65='%'+_0x26a157[_0x1488('0x61')]+'%';_0xf96811[_0x1f9650](_0x1488('0x65'),_0x445e65,_0x445e65,_0x445e65);}}else{_0x59fd10=_['find'](_0x1a8e9a,[_0x1488('0x2c'),_0x1488('0x66')]);_0x26a157[_0x1488('0x44')]=_0x1488('0x66');_0x3eb91a=as['buildExpression'](_0x13e05f,_0x59fd10[_0x1488('0x37')],_0x26a157);_0xf96811[_0x1f9650](_0x3eb91a['text'],_0x3eb91a['value'][_0x1488('0x67')],_0x3eb91a['value'][_0x1488('0x20')]);}break;case _0x1488('0x68'):var _0x4f61f3=_0x26a157['value'][_0x1488('0x62')](',')['map'](function(_0x1dde71){return Number(_0x1dde71);});_0x4f61f3[_0x1488('0x32')](function(_0x3ad8ac){_0x8208bb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3ad8ac+',%');});_0x446d2a=_[_0x1488('0x69')](_0x446d2a,_0x4f61f3);break;case _0x1488('0x6a'):if(_0x26a157['operator']===_0x1488('0x60')){_0xf96811[_0x1f9650](_0x1488('0x6b'),'%'+_0x26a157[_0x1488('0x61')]+'%',null);}else{_0x59fd10=_[_0x1488('0x59')](_0x1a8e9a,[_0x1488('0x2c'),_0x1488('0x6c')]);_0x26a157[_0x1488('0x44')]=_0x1488('0x6c');_0x3eb91a=as['buildExpression'](_0x13e05f,_0x59fd10[_0x1488('0x37')],_0x26a157);_0xf96811[_0x1f9650](_0x3eb91a[_0x1488('0x6d')],_0x3eb91a[_0x1488('0x61')]['start'],_0x3eb91a[_0x1488('0x61')][_0x1488('0x20')]);}break;case'body':_0x3eb91a=as['buildExpression']('me',null,_0x26a157);_0xf96811[_0x1f9650](_0x3eb91a[_0x1488('0x6d')],_0x3eb91a[_0x1488('0x61')][_0x1488('0x67')],_0x3eb91a[_0x1488('0x61')][_0x1488('0x20')]);break;}}else{var _0x3eb91a=as[_0x1488('0x6e')](_0x13e05f,_0x59fd10[_0x1488('0x37')],_0x26a157);_0xf96811[_0x1f9650](_0x3eb91a['text'],_0x3eb91a[_0x1488('0x61')][_0x1488('0x67')],_0x3eb91a[_0x1488('0x61')]['end']);}}}else{var _0x296bb3=_(_0x295b1e[_0x1488('0x3a')])[_0x1488('0x6f')]()[_0x1488('0x2e')](function(_0x4efbc0){return _[_0x1488('0x70')](_0x1a8e9a,[_0x1488('0x2c'),_0x4efbc0])?_0x4efbc0:undefined;})['compact']()[_0x1488('0x61')]();if(!_['isEmpty'](_0x296bb3)){_0x296bb3[_0x1488('0x32')](function(_0x2eea71){if(_0x2eea71===_0x1488('0x71')){_0x1685a7[_0x1488('0x41')]('i.FaxAccountId\x20IN\x20?',[]['concat'](_0x295b1e[_0x1488('0x3a')][_0x2eea71]));}else if(_0x2eea71===_0x1488('0x72')){var _0x27f1e6=JSON[_0x1488('0x73')](_0x295b1e[_0x1488('0x3a')][_0x2eea71])[_0x1488('0x74')];var _0x4e1d13=JSON['parse'](_0x295b1e[_0x1488('0x3a')][_0x2eea71])[_0x1488('0x75')];_0x1685a7[_0x1488('0x41')](_0x1488('0x76'),_0x27f1e6,_0x4e1d13);}else{if(_0x295b1e[_0x1488('0x3a')][_0x2eea71]==='null'){_0x1685a7[_0x1488('0x41')]('i.'+_0x2eea71+_0x1488('0x77'));}else{_0x1685a7[_0x1488('0x41')]('i.'+_0x2eea71+_0x1488('0x78'),_0x295b1e['query'][_0x2eea71]);}}});}if(_0x295b1e[_0x1488('0x3a')][_0x1488('0x79')]){if(_0x295b1e[_0x1488('0x3a')]['read']==0x1){_0x1685a7[_0x1488('0x5b')](_0x1488('0x7a'));}else{_0x1685a7[_0x1488('0x5b')](_0x1488('0x7b'));}}if(_0x295b1e['query'][_0x1488('0x7c')]){_0x446d2a=_['isArray'](_0x295b1e[_0x1488('0x3a')][_0x1488('0x7c')])?_0x295b1e[_0x1488('0x3a')][_0x1488('0x7c')]:new Array(_0x295b1e[_0x1488('0x3a')]['tag']);_0x446d2a[_0x1488('0x32')](function(_0x3f98d5){_0x8208bb['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x3f98d5+',%');});}if(_0x295b1e[_0x1488('0x3a')][_0x1488('0x7d')]){var _0x211ecd=_0x295b1e['query'][_0x1488('0x7d')][_0x1488('0x7e')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x1488('0x7f')](_0x211ecd)){_0xf96811['or'](_0x1488('0x80'),_0x211ecd+'%')['or']('i.fax\x20LIKE\x20?',_0x211ecd+'%');}_0xf96811['or'](_0x1488('0x81'),_0x211ecd+'%');}}_0x1685a7[_0x1488('0x41')](_0xf96811);_0x1685a7[_0x1488('0x82')](_0x1488('0x83'));var _0x203db2={'type':db[_0x1488('0x84')][_0x1488('0x85')][_0x1488('0x86')],'raw':!![]};var _0x5354d1=_0x1685a7[_0x1488('0x87')]();_0x5354d1[_0x1488('0x44')]('i.id');_0x5354d1[_0x1488('0x44')](_0x1488('0x88'),_0x1488('0x5a'));if(_0x4ff334[_0x1488('0x3f')]){_0x4ff334[_0x1488('0x3f')]['forEach'](function(_0x32fcda){var _0x19765f=_0x32fcda[0x0]===_0x1488('0x89')?_0x32fcda[0x0]:'i.'+_0x32fcda[0x0];_0x1685a7[_0x1488('0x3f')](_0x19765f,_0x32fcda[0x1]==='DESC'?![]:!![]);});}if(!_['isEmpty'](_0x446d2a)){_0x1685a7[_0x1488('0x5b')](_0x8208bb);_0x5354d1[_0x1488('0x41')](_0x1488('0x8a'),_0x446d2a);}BPromise[_0x1488('0x8b')]()[_0x1488('0x29')](function(){if(!_0x1f82df){if(_0x295b1e['query']['FaxAccountId'])return;_0x5354d1[_0x1488('0x41')]('i.FaxAccountId\x20IS\x20NOT\x20NULL');_0x1685a7[_0x1488('0x41')](_0x1488('0x8c'));return;}if(_0x295b1e[_0x1488('0x8d')][_0x1488('0x8e')]!==_0x1488('0x8f'))return;return _0x295b1e[_0x1488('0x8d')][_0x1488('0x90')]({'attributes':['id'],'raw':!![]})[_0x1488('0x29')](function(_0x2ea0f4){if(_[_0x1488('0x91')](_0x2ea0f4)){_0x5354d1[_0x1488('0x41')](_0x1488('0x92'));_0x1685a7[_0x1488('0x41')](_0x1488('0x92'));}else{_0x5354d1[_0x1488('0x41')](_0x1488('0x93'),_['map'](_0x2ea0f4,'id'));_0x1685a7[_0x1488('0x41')](_0x1488('0x93'),_[_0x1488('0x2e')](_0x2ea0f4,'id'));}});})[_0x1488('0x29')](function(){if(_0x295b1e[_0x1488('0x8d')][_0x1488('0x8e')]===_0x1488('0x8f')&&!_0x1f82df&&!_0x295b1e['query'][_0x1488('0x71')])return[];return db[_0x1488('0x94')][_0x1488('0x3a')](_0x5354d1['toString'](),_0x203db2);})['then'](function(_0x42639a){_0xdc8ddb[_0x1488('0x95')]=_0x42639a[_0x1488('0x58')];if(_0xdc8ddb[_0x1488('0x95')]===0x0)return[];return db[_0x1488('0x94')][_0x1488('0x3a')](_0xa69a91[_0x1488('0x96')](),_0x203db2)[_0x1488('0x29')](function(_0x544cc4){_0x474781=_[_0x1488('0x97')](_0x544cc4,'id');_0x203db2=_[_0x1488('0x98')](_0x203db2,{'model':db[_0x1488('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x295b1e['query'][_0x1488('0x99')]){_0x4ff334[_0x1488('0x3c')]['forEach'](function(_0x4a7946){_0x1685a7[_0x1488('0x44')]('i.'+_0x4a7946);});}else{_0x1685a7[_0x1488('0x44')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x1488('0x5a'));_0x1685a7[_0x1488('0x44')]('a.key',_0x1488('0x9a'));_0x1685a7[_0x1488('0x44')](_0x1488('0x9b'),_0x1488('0x9c'));_0x1685a7[_0x1488('0x44')]('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',_0x1488('0x89'));_0x1685a7[_0x1488('0x44')](_0x1488('0x9d'));_0x1685a7[_0x1488('0x44')](_0x1488('0x9e'),_0x1488('0x9f'));_0x1685a7[_0x1488('0x44')]('c.lastName',_0x1488('0xa0'));_0x1685a7[_0x1488('0x44')]('c.email',_0x1488('0xa1'));_0x1685a7[_0x1488('0x44')]('c.phone','Contact.phone');_0x1685a7['field'](_0x1488('0xa2'),_0x1488('0xa3'));_0x1685a7[_0x1488('0x44')](_0x1488('0xa4'),_0x1488('0xa5'));_0x1685a7[_0x1488('0x44')]('o.fullname',_0x1488('0xa6'));_0x1685a7[_0x1488('0x44')](_0x1488('0xa7'),'Owner.internal');_0x1685a7['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x1488('0x30'));}if(_0x4ff334[_0x1488('0x23')])_0x1685a7['limit'](_0x4ff334['limit']);if(_0x4ff334[_0x1488('0x21')])_0x1685a7['offset'](_0x4ff334[_0x1488('0x21')]);return db[_0x1488('0x94')]['query'](_0x1685a7[_0x1488('0x96')](),_0x203db2);})[_0x1488('0x29')](function(_0x287fd0){if(_0x287fd0[_0x1488('0x58')]>0x0)_0x4ad7a2[_0x1488('0x41')]('ui.FaxInteractionId\x20IN\x20?',_['map'](_0x287fd0,'id'));return db[_0x1488('0x94')]['query'](_0x4ad7a2[_0x1488('0x96')](),_0x203db2)['then'](function(_0x2ddd42){var _0x38fe01=_[_0x1488('0xa8')](_0x2ddd42,_0x1488('0xa9'));var _0x294fb2=[];_0x287fd0[_0x1488('0x32')](function(_0x2e9c9e){_0x294fb2['push'](updateFaxInteraction(_0x2e9c9e,_0x474781,_0x38fe01));});return BPromise[_0x1488('0xaa')](_0x294fb2);});});})[_0x1488('0x29')](function(_0x43fd4b){_0xdc8ddb[_0x1488('0xab')]=_0x43fd4b;return _0xdc8ddb;})[_0x1488('0x29')](respondWithFilteredResult(_0x108841,_0x4ff334))['catch'](handleError(_0x108841,null));};exports['show']=function(_0x55ed4b,_0x5e83d7){var _0x5e2d48={'raw':![],'where':{'id':_0x55ed4b[_0x1488('0xac')]['id']}},_0x34c3ac={};_0x34c3ac[_0x1488('0x39')]=_[_0x1488('0x6f')](db[_0x1488('0x35')][_0x1488('0xad')]);_0x34c3ac[_0x1488('0x3a')]=_[_0x1488('0x6f')](_0x55ed4b['query']);_0x34c3ac['filters']=_[_0x1488('0x3b')](_0x34c3ac[_0x1488('0x39')],_0x34c3ac[_0x1488('0x3a')]);_0x5e2d48['attributes']=_['intersection'](_0x34c3ac[_0x1488('0x39')],qs[_0x1488('0x99')](_0x55ed4b[_0x1488('0x3a')][_0x1488('0x99')]));_0x5e2d48[_0x1488('0x3c')]=_0x5e2d48[_0x1488('0x3c')][_0x1488('0x58')]?_0x5e2d48[_0x1488('0x3c')]:_0x34c3ac[_0x1488('0x39')];if(_0x55ed4b[_0x1488('0x3a')][_0x1488('0xae')]){_0x5e2d48['include']=[{'all':!![]}];}_0x5e2d48=_[_0x1488('0x98')]({},_0x5e2d48,_0x55ed4b[_0x1488('0xaf')]);return db[_0x1488('0x35')][_0x1488('0x59')](_0x5e2d48)[_0x1488('0x29')](handleEntityNotFound(_0x5e83d7,null))[_0x1488('0x29')](respondWithResult(_0x5e83d7,null))[_0x1488('0x33')](handleError(_0x5e83d7,null));};exports[_0x1488('0xb0')]=function(_0x9de76f,_0x2cde6e){return db[_0x1488('0x35')][_0x1488('0xb0')](_0x9de76f['body'],{})['then'](respondWithResult(_0x2cde6e,0xc9))[_0x1488('0x33')](handleError(_0x2cde6e,null));};exports[_0x1488('0x28')]=function(_0x1ecf26,_0x1eb0ba){if(_0x1ecf26['body']['id']){delete _0x1ecf26[_0x1488('0xb1')]['id'];}return db[_0x1488('0x35')][_0x1488('0x59')]({'where':{'id':_0x1ecf26['params']['id']}})['then'](handleEntityNotFound(_0x1eb0ba,null))['then'](saveUpdates(_0x1ecf26[_0x1488('0xb1')],null))[_0x1488('0x29')](respondWithResult(_0x1eb0ba,null))[_0x1488('0x33')](handleError(_0x1eb0ba,null));};exports[_0x1488('0xb2')]=function(_0x15b2fe,_0x7e26fc){return db['FaxInteraction'][_0x1488('0x59')]({'where':{'id':_0x15b2fe[_0x1488('0xac')]['id']}})[_0x1488('0x29')](handleEntityNotFound(_0x7e26fc,null))[_0x1488('0x29')](removeEntity(_0x7e26fc,null))[_0x1488('0x33')](handleError(_0x7e26fc,null));};exports['describe']=function(_0x596069,_0x510591){return db[_0x1488('0x35')][_0x1488('0xb3')]()[_0x1488('0x29')](respondWithResult(_0x510591,null))[_0x1488('0x33')](handleError(_0x510591,null));};exports[_0x1488('0xb4')]=function(_0x36ca2f,_0x4a8930,_0x3e4765){return db[_0x1488('0xb5')][_0x1488('0x59')]({'where':{'id':_0x36ca2f[_0x1488('0xac')]['id']}})[_0x1488('0x29')](handleEntityNotFound(_0x4a8930,null))[_0x1488('0x29')](function(_0x4478a3){if(_0x4478a3){return _0x4478a3['addMessage'](_0x36ca2f[_0x1488('0xb1')]['ids'],_[_0x1488('0xb6')](_0x36ca2f[_0x1488('0xb1')],[_0x1488('0xb7'),'id'])||{});}})['then'](respondWithResult(_0x4a8930,null))[_0x1488('0x33')](handleError(_0x4a8930,null));};exports[_0x1488('0xb8')]=function(_0x1bb359,_0x5b94c2,_0x3afde1){var _0x2a3e11={'raw':![],'where':{}};var _0x5d7ccf={};var _0xa57b72={'count':0x0,'rows':[]};return db[_0x1488('0x35')][_0x1488('0xb9')]({'where':{'id':_0x1bb359[_0x1488('0xac')]['id']}})['then'](handleEntityNotFound(_0x5b94c2,null))[_0x1488('0x29')](function(_0x38006c){if(_0x38006c){_0x5d7ccf['model']=_['keys'](db[_0x1488('0xb5')][_0x1488('0xad')]);_0x5d7ccf['query']=_['keys'](_0x1bb359[_0x1488('0x3a')]);_0x5d7ccf[_0x1488('0x42')]=_['intersection'](_0x5d7ccf[_0x1488('0x39')],_0x5d7ccf['query']);_0x2a3e11[_0x1488('0x3c')]=_[_0x1488('0x3b')](_0x5d7ccf[_0x1488('0x39')],qs[_0x1488('0x99')](_0x1bb359[_0x1488('0x3a')][_0x1488('0x99')]));_0x2a3e11[_0x1488('0x3c')]=_0x2a3e11['attributes']['length']?_0x2a3e11[_0x1488('0x3c')]:_0x5d7ccf[_0x1488('0x39')];if(!_0x1bb359[_0x1488('0x3a')][_0x1488('0x3d')](_0x1488('0x3e'))){_0x2a3e11[_0x1488('0x23')]=qs[_0x1488('0x23')](_0x1bb359[_0x1488('0x3a')][_0x1488('0x23')]);_0x2a3e11[_0x1488('0x21')]=qs[_0x1488('0x21')](_0x1bb359[_0x1488('0x3a')][_0x1488('0x21')]);}_0x2a3e11[_0x1488('0x3f')]=qs[_0x1488('0x40')](_0x1bb359[_0x1488('0x3a')][_0x1488('0x40')]);_0x2a3e11[_0x1488('0x41')]=qs[_0x1488('0x42')](_[_0x1488('0xba')](_0x1bb359[_0x1488('0x3a')],_0x5d7ccf[_0x1488('0x42')]));_0x2a3e11[_0x1488('0x41')][_0x1488('0xa9')]=_0x38006c['id'];if(_0x1bb359[_0x1488('0x3a')][_0x1488('0x7d')]){_0x2a3e11[_0x1488('0x41')]=_[_0x1488('0x98')](_0x2a3e11['where'],{'$or':_[_0x1488('0x2e')](_0x2a3e11[_0x1488('0x3c')],function(_0x2b31e0){var _0x497517={};_0x497517[_0x2b31e0]={'$like':'%'+_0x1bb359[_0x1488('0x3a')][_0x1488('0x7d')]+'%'};return _0x497517;})});}if(_0x1bb359[_0x1488('0x3a')]['$gte']){var _0x2498fd=_0x1bb359[_0x1488('0x3a')]['$gte'][_0x1488('0x62')](',');var _0xa7f5cb={};_0xa7f5cb[_0x2498fd[0x0]]={'$gte':moment(_0x2498fd[0x1])[_0x1488('0xbb')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2a3e11[_0x1488('0x41')]=_[_0x1488('0x98')](_0x2a3e11[_0x1488('0x41')],_0xa7f5cb);}_0x2a3e11=_[_0x1488('0x98')]({},_0x2a3e11,_0x1bb359[_0x1488('0xaf')]);return db[_0x1488('0xb5')]['count']({'where':_0x2a3e11[_0x1488('0x41')]})[_0x1488('0x29')](function(_0x526ac9){_0xa57b72[_0x1488('0x95')]=_0x526ac9;if(_0x1bb359['query']['includeAll']){_0x2a3e11[_0x1488('0xbc')]=[{'all':!![]}];}return db['FaxMessage']['findAll'](_0x2a3e11);})[_0x1488('0x29')](function(_0x18a550){_0xa57b72[_0x1488('0xab')]=_0x18a550;return _0xa57b72;});}})['then'](respondWithFilteredResult(_0x5b94c2,_0x2a3e11))[_0x1488('0x33')](handleError(_0x5b94c2,null));};exports[_0x1488('0xbd')]=function(_0x46b0e2,_0x1eb988,_0xd1e809){return db['FaxInteraction'][_0x1488('0x59')]({'where':{'id':_0x46b0e2[_0x1488('0xac')]['id']}})[_0x1488('0x29')](handleEntityNotFound(_0x1eb988,null))[_0x1488('0x29')](function(_0xa3aabc){if(_0xa3aabc){return _0xa3aabc[_0x1488('0xbe')](_0x46b0e2[_0x1488('0xb1')][_0x1488('0xb7')],_[_0x1488('0xb6')](_0x46b0e2[_0x1488('0xb1')],[_0x1488('0xb7'),'id'])||{})[_0x1488('0xbf')](function(){return db[_0x1488('0x68')][_0x1488('0xc0')]({'attributes':['id',_0x1488('0x2c'),_0x1488('0x45')],'where':{'id':_0x46b0e2[_0x1488('0xb1')][_0x1488('0xb7')]}});})[_0x1488('0x29')](function(_0x19b36f){socket['emit'](_0x1488('0xc1'),{'id':Number(_0x46b0e2[_0x1488('0xac')]['id']),'tags':_0x19b36f||[]});return{'id':Number(_0x46b0e2['params']['id']),'tags':_0x19b36f||[]};});}})[_0x1488('0x29')](respondWithResult(_0x1eb988,null))['catch'](handleError(_0x1eb988,null));};exports[_0x1488('0xc2')]=function(_0x5678b7,_0x1fb11a,_0x330064){return db[_0x1488('0x35')][_0x1488('0x59')]({'where':{'id':_0x5678b7[_0x1488('0xac')]['id']}})['then'](handleEntityNotFound(_0x1fb11a,null))['then'](function(_0x3d4a09){if(_0x3d4a09){return _0x3d4a09['removeTags'](_0x5678b7[_0x1488('0x3a')][_0x1488('0xb7')]);}})[_0x1488('0x29')](respondWithStatusCode(_0x1fb11a,null))['catch'](handleError(_0x1fb11a,null));};exports[_0x1488('0xc3')]=function(_0x1b45c4,_0x157ddc){var _0x1b3e5b=moment()['unix']()[_0x1488('0x96')]();var _0xb4390e=path[_0x1488('0xc4')](config['root'],'server',_0x1488('0xc5'),_0x1488('0xc6'));var _0x556553=path[_0x1488('0xc4')](config[_0x1488('0xc7')],_0x1488('0xc8'),_0x1488('0xc5'),_0x1488('0xc9'));var _0x38ea6f=path[_0x1488('0xc4')](_0xb4390e,_0x1b3e5b);var _0x13554a=util['format'](_0x1488('0xca'),_0x1b45c4[_0x1488('0xac')]['id'],_0x1b3e5b);var _0x307307=path[_0x1488('0xc4')](_0xb4390e,_0x13554a);var _0x1eac32=[];_0x1eac32[_0x1488('0xcb')]({'model':db['Attachment'],'as':'Attachment','raw':!![]});var _0x2e9274=[{'model':db[_0x1488('0xb5')],'as':_0x1488('0xcc'),'attributes':['id','body',_0x1488('0x72')],'include':_0x1eac32}];return db[_0x1488('0x35')]['find']({'where':{'id':_0x1b45c4['params']['id']},'include':_0x2e9274})['then'](handleEntityNotFound(_0x157ddc,null))['then'](function(_0x1abb2b){if(_0x1abb2b&&_0x1abb2b[_0x1488('0xcc')]){var _0x1a8b3a=_0x1abb2b[_0x1488('0xcd')]({'plain':!![]});fs[_0x1488('0xce')](_0x38ea6f);for(var _0x3450fb=0x0;_0x3450fb<_0x1a8b3a['Messages'][_0x1488('0x58')];_0x3450fb++){var _0x1da4e=_0x1a8b3a[_0x1488('0xcc')][_0x3450fb][_0x1488('0xcf')];if(_0x1da4e){var _0x1495d0=path[_0x1488('0xc4')](_0x556553,_0x1da4e[_0x1488('0xd0')]);if(fs['existsSync'](_0x1495d0)){fs['createReadStream'](_0x1495d0)['pipe'](fs[_0x1488('0xd1')](path[_0x1488('0xc4')](_0x38ea6f,_0x1da4e[_0x1488('0xd0')])));}}}return BPromise[_0x1488('0x8b')]()[_0x1488('0x29')](function(){return new BPromise(function(_0x472e8e,_0x42f79f){zipdir(_0x38ea6f,{'saveTo':_0x307307},function(_0x37e733,_0x454af5){if(_0x37e733)return _0x42f79f(_0x37e733);return _0x472e8e(_0x454af5);});})[_0x1488('0x29')](function(){return new BPromise(function(_0x1f3c50,_0x448c4b){rimraf(_0x38ea6f,function(_0xfc8aef){if(_0xfc8aef)_0x448c4b(_0xfc8aef);return _0x1f3c50();});});})['then'](function(){return _0x157ddc[_0x1488('0xc3')](_0x307307,_0x13554a,function(_0x1d2308){if(_0x1d2308){console[_0x1488('0xd2')](_0x1488('0xd3'),_0x1d2308);}else{fs['unlinkSync'](_0x307307);}});});});}else{return _0x157ddc['sendStatus'](0xc8);}})[_0x1488('0x33')](handleError(_0x157ddc,null));}; \ No newline at end of file +var _0xa116=['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/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./faxInteraction.socket','register','sendStatus','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','then','destroy','end','error','name','Users','map','fullname','TagIds','Tags','split','forEach','push','catch','index','rawAttributes','type','key','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','ui.FaxInteractionId','user_has_fax_interactions','left_join','users','fax_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','a.id\x20=\x20i.FaxAccountId','fax_interaction_has_tags','it.FaxInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\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','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','some','compact','i.FaxAccountId\x20IN\x20?','concat','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','read','having','tag','isArray','filter','replace','isNumeric','i.fax\x20LIKE\x20?','group','i.id','Sequelize','QueryTypes','SELECT','clone','contactName','DESC','isEmpty','resolve','i.FaxAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getFaxAccounts','FaxAccountId','toString','keyBy','merge','FaxInteraction','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','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','c.firstName','Contact.firstName','Contact.email','c.phone','c.mobile','Contact.mobile','c.fax','o.fullname','Owner.fullname','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','sequelize','ui.FaxInteractionId\x20IN\x20?','groupBy','FaxInteractionId','all','params','intersection','include','update','describe','addMessage','FaxMessage','ids','omit','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','options','findAll','rows','addTags','removeTags','download','unix','join','root','server','tmp','files','Attachment','Messages','get','mkdirSync','basename','existsSync','createReadStream','pipe','createWriteStream','log','err','unlinkSync','rimraf','zip-dir','request-promise','moment','mustache'];(function(_0x372915,_0x2dbd58){var _0x42ea51=function(_0x139233){while(--_0x139233){_0x372915['push'](_0x372915['shift']());}};_0x42ea51(++_0x2dbd58);}(_0xa116,0xcf));var _0x6a11=function(_0xf90f51,_0x581d2f){_0xf90f51=_0xf90f51-0x0;var _0x4478de=_0xa116[_0xf90f51];return _0x4478de;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6a11('0x0'));var zipdir=require(_0x6a11('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6a11('0x2'));var moment=require(_0x6a11('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6a11('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6a11('0x5'));var fs=require('fs');var fs_extra=require(_0x6a11('0x6'));var _=require(_0x6a11('0x7'));var squel=require(_0x6a11('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x6a11('0x9'));var toCsv=require(_0x6a11('0xa'));var querystring=require(_0x6a11('0xb'));var Papa=require(_0x6a11('0xc'));var Redis=require(_0x6a11('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x6a11('0xe'));var as=require(_0x6a11('0xf'));var hardwareService=require(_0x6a11('0x10'));var logger=require(_0x6a11('0x11'))(_0x6a11('0x12'));var utils=require(_0x6a11('0x13'));var config=require(_0x6a11('0x14'));var licenseUtil=require(_0x6a11('0x15'));var db=require(_0x6a11('0x16'))['db'];config[_0x6a11('0x17')]=_[_0x6a11('0x18')](config[_0x6a11('0x17')],{'host':_0x6a11('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6a11('0x1a'))[_0x6a11('0x1b')](socket);function respondWithStatusCode(_0x14b86c,_0x33e0e3){_0x33e0e3=_0x33e0e3||0xcc;return function(_0x3ba22d){if(_0x3ba22d){return _0x14b86c[_0x6a11('0x1c')](_0x33e0e3);}return _0x14b86c['status'](_0x33e0e3)['end']();};}function respondWithResult(_0x440a99,_0x2841de){_0x2841de=_0x2841de||0xc8;return function(_0x3b68e8){if(_0x3b68e8){return _0x440a99[_0x6a11('0x1d')](_0x2841de)[_0x6a11('0x1e')](_0x3b68e8);}};}function respondWithFilteredResult(_0x461612,_0x5a4877){return function(_0x238f25){if(_0x238f25){var _0x344cab=typeof _0x5a4877[_0x6a11('0x1f')]==='undefined'&&typeof _0x5a4877['limit']===_0x6a11('0x20');var _0x4d5d3c=_0x238f25[_0x6a11('0x21')];var _0x3c098d=_0x344cab?0x0:_0x5a4877['offset'];var _0x289951=_0x344cab?_0x238f25[_0x6a11('0x21')]:_0x5a4877[_0x6a11('0x1f')]+_0x5a4877[_0x6a11('0x22')];var _0x3b797d;if(_0x289951>=_0x4d5d3c){_0x289951=_0x4d5d3c;_0x3b797d=0xc8;}else{_0x3b797d=0xce;}_0x461612[_0x6a11('0x1d')](_0x3b797d);return _0x461612['set'](_0x6a11('0x23'),_0x3c098d+'-'+_0x289951+'/'+_0x4d5d3c)[_0x6a11('0x1e')](_0x238f25);}return null;};}function patchUpdates(_0x52d994){return function(_0x1d25f4){try{jsonpatch[_0x6a11('0x24')](_0x1d25f4,_0x52d994,!![]);}catch(_0x150872){return BPromise[_0x6a11('0x25')](_0x150872);}return _0x1d25f4[_0x6a11('0x26')]();};}function saveUpdates(_0x1c9804,_0x11cd3d){return function(_0x1a1557){if(_0x1a1557){return _0x1a1557['update'](_0x1c9804)[_0x6a11('0x27')](function(_0x2e8fe4){return _0x2e8fe4;});}return null;};}function removeEntity(_0x45ee95,_0x15a469){return function(_0x269225){if(_0x269225){return _0x269225[_0x6a11('0x28')]()[_0x6a11('0x27')](function(){_0x45ee95[_0x6a11('0x1d')](0xcc)[_0x6a11('0x29')]();});}};}function handleEntityNotFound(_0xa6c354,_0xf99dc4){return function(_0x1e8cd9){if(!_0x1e8cd9){_0xa6c354['sendStatus'](0x194);}return _0x1e8cd9;};}function handleError(_0xd36bda,_0x594afb){_0x594afb=_0x594afb||0x1f4;return function(_0x1d4231){logger[_0x6a11('0x2a')](_0x1d4231['stack']);if(_0x1d4231[_0x6a11('0x2b')]){delete _0x1d4231['name'];}_0xd36bda[_0x6a11('0x1d')](_0x594afb)['send'](_0x1d4231);};}function getInteractionUsers(_0x334a78,_0x1a539a){return new BPromise(function(_0x2d9582,_0x4e3d46){try{if(_0x1a539a[_0x334a78['id']]){_0x334a78[_0x6a11('0x2c')]=_[_0x6a11('0x2d')](_0x1a539a[_0x334a78['id']],function(_0x37fcb2){return{'id':_0x37fcb2['id'],'fullname':_0x37fcb2[_0x6a11('0x2e')]};});}}catch(_0x46af00){_0x4e3d46(_0x46af00);}_0x2d9582(_0x334a78);});}function getInteractionTags(_0x27f8ca,_0x2c32b5){return new BPromise(function(_0x5069f0,_0x13e063){try{if(_0x27f8ca[_0x6a11('0x2f')]){_0x27f8ca[_0x6a11('0x30')]=[];_0x27f8ca[_0x6a11('0x2f')][_0x6a11('0x31')](',')[_0x6a11('0x32')](function(_0x597ab7){_0x27f8ca[_0x6a11('0x30')][_0x6a11('0x33')](_0x2c32b5[_0x597ab7]);});}delete _0x27f8ca[_0x6a11('0x2f')];}catch(_0x13ef62){_0x13e063(_0x13ef62);}_0x5069f0(_0x27f8ca);});}function updateFaxInteraction(_0x1db131,_0x5487d5,_0x38b5e8){return new BPromise(function(_0x2ee4eb,_0x2a8590){return getInteractionUsers(_0x1db131,_0x38b5e8)['then'](function(_0x5673bf){return getInteractionTags(_0x5673bf,_0x5487d5);})[_0x6a11('0x27')](function(_0x565b70){_0x2ee4eb(_0x565b70);})[_0x6a11('0x34')](function(_0x1cda5e){_0x2a8590(_0x1cda5e);});});}exports[_0x6a11('0x35')]=function(_0xb08cf4,_0x4f1ff1){var _0x57dd1d={},_0x4c497a={},_0x2d3bf5={'count':0x0,'rows':[]};var _0x252e1a=_[_0x6a11('0x2d')](db['FaxInteraction'][_0x6a11('0x36')],function(_0x39f579){return{'name':_0x39f579['fieldName'],'type':_0x39f579[_0x6a11('0x37')][_0x6a11('0x38')]};});_0x4c497a['model']=_[_0x6a11('0x2d')](_0x252e1a,'name');_0x4c497a[_0x6a11('0x39')]=_[_0x6a11('0x3a')](_0xb08cf4[_0x6a11('0x39')]);_0x4c497a[_0x6a11('0x3b')]=_['intersection'](_0x4c497a[_0x6a11('0x3c')],_0x4c497a[_0x6a11('0x39')]);_0x57dd1d['attributes']=_['intersection'](_0x4c497a[_0x6a11('0x3c')],qs[_0x6a11('0x3d')](_0xb08cf4['query'][_0x6a11('0x3d')]));_0x57dd1d[_0x6a11('0x3e')]=_0x57dd1d[_0x6a11('0x3e')][_0x6a11('0x3f')]?_0x57dd1d[_0x6a11('0x3e')]:_0x4c497a[_0x6a11('0x3c')];if(!_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x40')](_0x6a11('0x41'))){_0x57dd1d['limit']=qs['limit'](_0xb08cf4[_0x6a11('0x39')]['limit']);_0x57dd1d[_0x6a11('0x1f')]=qs[_0x6a11('0x1f')](_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x1f')]);}_0x57dd1d[_0x6a11('0x42')]=qs['sort'](_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x43')]);_0x57dd1d[_0x6a11('0x44')]=qs[_0x6a11('0x3b')](_[_0x6a11('0x45')](_0xb08cf4[_0x6a11('0x39')],_0x4c497a['filters']),_0x252e1a);var _0x3b4bf6=[];var _0x26bb4c=squel[_0x6a11('0x46')]()['field']('id')[_0x6a11('0x47')](_0x6a11('0x2b'))[_0x6a11('0x47')](_0x6a11('0x48'))[_0x6a11('0x49')](_0x6a11('0x4a'));var _0x49414f=squel[_0x6a11('0x46')]()[_0x6a11('0x47')](_0x6a11('0x4b'))[_0x6a11('0x47')](_0x6a11('0x4c'))[_0x6a11('0x47')](_0x6a11('0x4d'))[_0x6a11('0x49')](_0x6a11('0x4e'),'ui')[_0x6a11('0x4f')](_0x6a11('0x50'),'u','u.id\x20=\x20ui.UserId');var _0x5a404a=squel[_0x6a11('0x46')]()[_0x6a11('0x49')](_0x6a11('0x51'),'i')[_0x6a11('0x4f')](_0x6a11('0x52'),'c',_0x6a11('0x53'))[_0x6a11('0x4f')](_0x6a11('0x50'),'o',_0x6a11('0x54'))[_0x6a11('0x4f')]('fax_accounts','a',_0x6a11('0x55'))['left_join']('fax_messages','me','me.FaxInteractionId\x20=\x20i.id')['left_join'](_0x6a11('0x56'),'it',_0x6a11('0x57'))['left_join'](_0x6a11('0x4a'),'t',_0x6a11('0x58'));var _0x5f08d3=squel['expr']();var _0x11f044=[];var _0x318a7a=squel[_0x6a11('0x59')]();var _0x5a3f24;if(_0xb08cf4['query']['search']){_0x5a3f24=as['parseSearch'](_0xb08cf4['query'][_0x6a11('0x5a')]);var _0x2b1f2b=_0x5a3f24[_0x6a11('0x5b')];for(var _0x364059=0x0;_0x364059<_0x5a3f24[_0x6a11('0x5c')]['length'];_0x364059++){var _0x5a0564=_0x5a3f24[_0x6a11('0x5c')][_0x364059];var _0xbd7ecc='i';var _0x11aebc=_[_0x6a11('0x5d')](_0x252e1a,[_0x6a11('0x2b'),_0x5a0564[_0x6a11('0x47')]]);if(!_0x11aebc){switch(_0x5a0564[_0x6a11('0x47')]){case _0x6a11('0x5e'):if(_0x5a0564[_0x6a11('0x5f')]==0x1){_0x5a404a['having']('`'+_0x5a0564[_0x6a11('0x47')]+_0x6a11('0x60'));}else{_0x5a404a['having']('`'+_0x5a0564[_0x6a11('0x47')]+'`\x20>\x200');}break;case _0x6a11('0x61'):if(_0x5a0564[_0x6a11('0x62')]===_0x6a11('0x63')){if(_0x5a0564[_0x6a11('0x5f')][_0x6a11('0x31')]('\x20')[_0x6a11('0x3f')]>0x1){_0x5f08d3[_0x2b1f2b](_0x6a11('0x64'),qs[_0x6a11('0x65')](_0x5a0564[_0x6a11('0x5f')]),null);}else{var _0x3c9616='%'+_0x5a0564['value']+'%';_0x5f08d3[_0x2b1f2b](_0x6a11('0x66'),_0x3c9616,_0x3c9616,_0x3c9616);}}else{_0x11aebc=_[_0x6a11('0x5d')](_0x252e1a,['name',_0x6a11('0x67')]);_0x5a0564[_0x6a11('0x47')]='ContactId';_0x25713a=as[_0x6a11('0x68')](_0xbd7ecc,_0x11aebc[_0x6a11('0x37')],_0x5a0564);_0x5f08d3[_0x2b1f2b](_0x25713a[_0x6a11('0x69')],_0x25713a[_0x6a11('0x5f')][_0x6a11('0x6a')],_0x25713a[_0x6a11('0x5f')]['end']);}break;case _0x6a11('0x6b'):var _0x4a22d3=_0x5a0564['value'][_0x6a11('0x31')](',')[_0x6a11('0x2d')](function(_0xdb8645){return Number(_0xdb8645);});_0x4a22d3['forEach'](function(_0x443c8f){_0x318a7a['or'](_0x6a11('0x6c'),'%,'+_0x443c8f+',%');});_0x11f044=_[_0x6a11('0x6d')](_0x11f044,_0x4a22d3);break;case _0x6a11('0x6e'):if(_0x5a0564[_0x6a11('0x62')]===_0x6a11('0x63')){_0x5f08d3[_0x2b1f2b](_0x6a11('0x6f'),'%'+_0x5a0564[_0x6a11('0x5f')]+'%',null);}else{_0x11aebc=_[_0x6a11('0x5d')](_0x252e1a,[_0x6a11('0x2b'),_0x6a11('0x70')]);_0x5a0564[_0x6a11('0x47')]=_0x6a11('0x70');_0x25713a=as[_0x6a11('0x68')](_0xbd7ecc,_0x11aebc['type'],_0x5a0564);_0x5f08d3[_0x2b1f2b](_0x25713a[_0x6a11('0x69')],_0x25713a[_0x6a11('0x5f')][_0x6a11('0x6a')],_0x25713a['value'][_0x6a11('0x29')]);}break;case _0x6a11('0x71'):_0x25713a=as[_0x6a11('0x68')]('me',null,_0x5a0564);_0x5f08d3[_0x2b1f2b](_0x25713a[_0x6a11('0x69')],_0x25713a[_0x6a11('0x5f')]['start'],_0x25713a[_0x6a11('0x5f')][_0x6a11('0x29')]);break;}}else{var _0x25713a=as[_0x6a11('0x68')](_0xbd7ecc,_0x11aebc[_0x6a11('0x37')],_0x5a0564);_0x5f08d3[_0x2b1f2b](_0x25713a['text'],_0x25713a[_0x6a11('0x5f')][_0x6a11('0x6a')],_0x25713a[_0x6a11('0x5f')][_0x6a11('0x29')]);}}}else{var _0x2e031c=_(_0xb08cf4[_0x6a11('0x39')])[_0x6a11('0x3a')]()[_0x6a11('0x2d')](function(_0x570194){return _[_0x6a11('0x72')](_0x252e1a,[_0x6a11('0x2b'),_0x570194])?_0x570194:undefined;})[_0x6a11('0x73')]()['value']();if(!_['isEmpty'](_0x2e031c)){_0x2e031c[_0x6a11('0x32')](function(_0x4f3069){if(_0x4f3069==='FaxAccountId'){_0x5a404a['where'](_0x6a11('0x74'),[][_0x6a11('0x75')](_0xb08cf4[_0x6a11('0x39')][_0x4f3069]));}else if(_0x4f3069===_0x6a11('0x76')){var _0x6fcfaf=JSON[_0x6a11('0x77')](_0xb08cf4[_0x6a11('0x39')][_0x4f3069])['$gte'];var _0x19c1c2=JSON['parse'](_0xb08cf4[_0x6a11('0x39')][_0x4f3069])[_0x6a11('0x78')];_0x5a404a[_0x6a11('0x44')](_0x6a11('0x79'),_0x6fcfaf,_0x19c1c2);}else{if(_0xb08cf4[_0x6a11('0x39')][_0x4f3069]===_0x6a11('0x7a')){_0x5a404a[_0x6a11('0x44')]('i.'+_0x4f3069+_0x6a11('0x7b'));}else{_0x5a404a[_0x6a11('0x44')]('i.'+_0x4f3069+_0x6a11('0x7c'),_0xb08cf4['query'][_0x4f3069]);}}});}if(_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x7d')]){if(_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x7d')]==0x1){_0x5a404a[_0x6a11('0x7e')]('`unreadMessages`\x20=\x200');}else{_0x5a404a['having']('`unreadMessages`\x20>\x200');}}if(_0xb08cf4['query'][_0x6a11('0x7f')]){_0x11f044=_[_0x6a11('0x80')](_0xb08cf4[_0x6a11('0x39')]['tag'])?_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x7f')]:new Array(_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x7f')]);_0x11f044[_0x6a11('0x32')](function(_0x52b4ab){_0x318a7a['or'](_0x6a11('0x6c'),'%,'+_0x52b4ab+',%');});}if(_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x81')]){var _0x2e0fed=_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x81')][_0x6a11('0x82')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0x6a11('0x83')](_0x2e0fed)){_0x5f08d3['or']('i.id\x20LIKE\x20?',_0x2e0fed+'%')['or'](_0x6a11('0x84'),_0x2e0fed+'%');}_0x5f08d3['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x2e0fed+'%');}}_0x5a404a['where'](_0x5f08d3);_0x5a404a[_0x6a11('0x85')](_0x6a11('0x86'));var _0x3a2d0c={'type':db[_0x6a11('0x87')][_0x6a11('0x88')][_0x6a11('0x89')],'raw':!![]};var _0x58d3ad=_0x5a404a[_0x6a11('0x8a')]();_0x58d3ad[_0x6a11('0x47')](_0x6a11('0x86'));_0x58d3ad['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');if(_0x57dd1d[_0x6a11('0x42')]){_0x57dd1d[_0x6a11('0x42')][_0x6a11('0x32')](function(_0x4053de){var _0x2003db=_0x4053de[0x0]===_0x6a11('0x8b')?_0x4053de[0x0]:'i.'+_0x4053de[0x0];_0x5a404a[_0x6a11('0x42')](_0x2003db,_0x4053de[0x1]===_0x6a11('0x8c')?![]:!![]);});}if(!_[_0x6a11('0x8d')](_0x11f044)){_0x5a404a[_0x6a11('0x7e')](_0x318a7a);_0x58d3ad[_0x6a11('0x44')]('t.id\x20IN\x20?',_0x11f044);}BPromise[_0x6a11('0x8e')]()['then'](function(){if(!_0x5a3f24){if(_0xb08cf4[_0x6a11('0x39')]['FaxAccountId'])return;_0x58d3ad[_0x6a11('0x44')](_0x6a11('0x8f'));_0x5a404a['where'](_0x6a11('0x8f'));return;}if(_0xb08cf4[_0x6a11('0x90')][_0x6a11('0x91')]!==_0x6a11('0x92'))return;return _0xb08cf4[_0x6a11('0x90')][_0x6a11('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x8b4044){if(_['isEmpty'](_0x8b4044)){_0x58d3ad[_0x6a11('0x44')]('i.FaxAccountId\x20IS\x20NULL');_0x5a404a[_0x6a11('0x44')]('i.FaxAccountId\x20IS\x20NULL');}else{_0x58d3ad[_0x6a11('0x44')](_0x6a11('0x74'),_[_0x6a11('0x2d')](_0x8b4044,'id'));_0x5a404a[_0x6a11('0x44')]('i.FaxAccountId\x20IN\x20?',_['map'](_0x8b4044,'id'));}});})[_0x6a11('0x27')](function(){if(_0xb08cf4[_0x6a11('0x90')][_0x6a11('0x91')]==='agent'&&!_0x5a3f24&&!_0xb08cf4['query'][_0x6a11('0x94')])return[];return db['sequelize'][_0x6a11('0x39')](_0x58d3ad['toString'](),_0x3a2d0c);})[_0x6a11('0x27')](function(_0x225473){_0x2d3bf5[_0x6a11('0x21')]=_0x225473['length'];if(_0x2d3bf5['count']===0x0)return[];return db['sequelize']['query'](_0x26bb4c[_0x6a11('0x95')](),_0x3a2d0c)[_0x6a11('0x27')](function(_0x2b773b){_0x3b4bf6=_[_0x6a11('0x96')](_0x2b773b,'id');_0x3a2d0c=_[_0x6a11('0x97')](_0x3a2d0c,{'model':db[_0x6a11('0x98')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0xb08cf4[_0x6a11('0x39')][_0x6a11('0x3d')]){_0x57dd1d['attributes'][_0x6a11('0x32')](function(_0x1f8d4b){_0x5a404a['field']('i.'+_0x1f8d4b);});}else{_0x5a404a['field'](_0x6a11('0x99'),_0x6a11('0x5e'));_0x5a404a[_0x6a11('0x47')](_0x6a11('0x9a'),'Account.key');_0x5a404a[_0x6a11('0x47')](_0x6a11('0x9b'),_0x6a11('0x9c'));_0x5a404a[_0x6a11('0x47')](_0x6a11('0x9d'),'contactName');_0x5a404a[_0x6a11('0x47')]('i.*');_0x5a404a['field'](_0x6a11('0x9e'),_0x6a11('0x9f'));_0x5a404a['field']('c.lastName','Contact.lastName');_0x5a404a[_0x6a11('0x47')]('c.email',_0x6a11('0xa0'));_0x5a404a[_0x6a11('0x47')](_0x6a11('0xa1'),'Contact.phone');_0x5a404a['field'](_0x6a11('0xa2'),_0x6a11('0xa3'));_0x5a404a[_0x6a11('0x47')](_0x6a11('0xa4'),'Contact.fax');_0x5a404a[_0x6a11('0x47')](_0x6a11('0xa5'),_0x6a11('0xa6'));_0x5a404a['field'](_0x6a11('0xa7'),_0x6a11('0xa8'));_0x5a404a[_0x6a11('0x47')](_0x6a11('0xa9'),_0x6a11('0x2f'));}if(_0x57dd1d[_0x6a11('0x22')])_0x5a404a[_0x6a11('0x22')](_0x57dd1d['limit']);if(_0x57dd1d[_0x6a11('0x1f')])_0x5a404a[_0x6a11('0x1f')](_0x57dd1d['offset']);return db[_0x6a11('0xaa')][_0x6a11('0x39')](_0x5a404a['toString'](),_0x3a2d0c);})[_0x6a11('0x27')](function(_0x389b0e){if(_0x389b0e[_0x6a11('0x3f')]>0x0)_0x49414f[_0x6a11('0x44')](_0x6a11('0xab'),_['map'](_0x389b0e,'id'));return db['sequelize'][_0x6a11('0x39')](_0x49414f[_0x6a11('0x95')](),_0x3a2d0c)[_0x6a11('0x27')](function(_0x17579b){var _0x5fa3e=_[_0x6a11('0xac')](_0x17579b,_0x6a11('0xad'));var _0x59dc36=[];_0x389b0e[_0x6a11('0x32')](function(_0x477d4d){_0x59dc36[_0x6a11('0x33')](updateFaxInteraction(_0x477d4d,_0x3b4bf6,_0x5fa3e));});return BPromise[_0x6a11('0xae')](_0x59dc36);});});})[_0x6a11('0x27')](function(_0x10126a){_0x2d3bf5['rows']=_0x10126a;return _0x2d3bf5;})[_0x6a11('0x27')](respondWithFilteredResult(_0x4f1ff1,_0x57dd1d))['catch'](handleError(_0x4f1ff1,null));};exports['show']=function(_0x5470d6,_0x38c2ee){var _0x682194={'raw':![],'where':{'id':_0x5470d6[_0x6a11('0xaf')]['id']}},_0x249949={};_0x249949[_0x6a11('0x3c')]=_['keys'](db['FaxInteraction'][_0x6a11('0x36')]);_0x249949[_0x6a11('0x39')]=_[_0x6a11('0x3a')](_0x5470d6['query']);_0x249949[_0x6a11('0x3b')]=_[_0x6a11('0xb0')](_0x249949[_0x6a11('0x3c')],_0x249949['query']);_0x682194['attributes']=_[_0x6a11('0xb0')](_0x249949['model'],qs[_0x6a11('0x3d')](_0x5470d6[_0x6a11('0x39')][_0x6a11('0x3d')]));_0x682194['attributes']=_0x682194[_0x6a11('0x3e')][_0x6a11('0x3f')]?_0x682194[_0x6a11('0x3e')]:_0x249949[_0x6a11('0x3c')];if(_0x5470d6['query']['includeAll']){_0x682194[_0x6a11('0xb1')]=[{'all':!![]}];}_0x682194=_['merge']({},_0x682194,_0x5470d6['options']);return db['FaxInteraction'][_0x6a11('0x5d')](_0x682194)[_0x6a11('0x27')](handleEntityNotFound(_0x38c2ee,null))['then'](respondWithResult(_0x38c2ee,null))[_0x6a11('0x34')](handleError(_0x38c2ee,null));};exports['create']=function(_0x253113,_0x8588b7){return db['FaxInteraction']['create'](_0x253113[_0x6a11('0x71')],{})[_0x6a11('0x27')](respondWithResult(_0x8588b7,0xc9))[_0x6a11('0x34')](handleError(_0x8588b7,null));};exports[_0x6a11('0xb2')]=function(_0x344dbe,_0x5b79c0){if(_0x344dbe['body']['id']){delete _0x344dbe[_0x6a11('0x71')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x344dbe[_0x6a11('0xaf')]['id']}})[_0x6a11('0x27')](handleEntityNotFound(_0x5b79c0,null))[_0x6a11('0x27')](saveUpdates(_0x344dbe[_0x6a11('0x71')],null))['then'](respondWithResult(_0x5b79c0,null))[_0x6a11('0x34')](handleError(_0x5b79c0,null));};exports[_0x6a11('0x28')]=function(_0x123eba,_0x33420c){return db[_0x6a11('0x98')][_0x6a11('0x5d')]({'where':{'id':_0x123eba[_0x6a11('0xaf')]['id']}})[_0x6a11('0x27')](handleEntityNotFound(_0x33420c,null))[_0x6a11('0x27')](removeEntity(_0x33420c,null))['catch'](handleError(_0x33420c,null));};exports[_0x6a11('0xb3')]=function(_0x6c4f8b,_0x30c966){return db[_0x6a11('0x98')][_0x6a11('0xb3')]()['then'](respondWithResult(_0x30c966,null))[_0x6a11('0x34')](handleError(_0x30c966,null));};exports[_0x6a11('0xb4')]=function(_0x1214d6,_0x10c93c,_0x25d82b){return db[_0x6a11('0xb5')][_0x6a11('0x5d')]({'where':{'id':_0x1214d6[_0x6a11('0xaf')]['id']}})[_0x6a11('0x27')](handleEntityNotFound(_0x10c93c,null))['then'](function(_0x574315){if(_0x574315){return _0x574315[_0x6a11('0xb4')](_0x1214d6[_0x6a11('0x71')][_0x6a11('0xb6')],_[_0x6a11('0xb7')](_0x1214d6['body'],[_0x6a11('0xb6'),'id'])||{});}})[_0x6a11('0x27')](respondWithResult(_0x10c93c,null))[_0x6a11('0x34')](handleError(_0x10c93c,null));};exports['getMessages']=function(_0x10c28a,_0xf020a,_0x34479f){var _0x184a15={'raw':![],'where':{}};var _0x3f17f2={};var _0x286c15={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x6a11('0xb8')]({'where':{'id':_0x10c28a[_0x6a11('0xaf')]['id']}})[_0x6a11('0x27')](handleEntityNotFound(_0xf020a,null))[_0x6a11('0x27')](function(_0x226cf9){if(_0x226cf9){_0x3f17f2[_0x6a11('0x3c')]=_['keys'](db[_0x6a11('0xb5')][_0x6a11('0x36')]);_0x3f17f2[_0x6a11('0x39')]=_[_0x6a11('0x3a')](_0x10c28a[_0x6a11('0x39')]);_0x3f17f2[_0x6a11('0x3b')]=_[_0x6a11('0xb0')](_0x3f17f2['model'],_0x3f17f2[_0x6a11('0x39')]);_0x184a15[_0x6a11('0x3e')]=_[_0x6a11('0xb0')](_0x3f17f2['model'],qs['fields'](_0x10c28a[_0x6a11('0x39')][_0x6a11('0x3d')]));_0x184a15[_0x6a11('0x3e')]=_0x184a15[_0x6a11('0x3e')][_0x6a11('0x3f')]?_0x184a15[_0x6a11('0x3e')]:_0x3f17f2[_0x6a11('0x3c')];if(!_0x10c28a['query']['hasOwnProperty'](_0x6a11('0x41'))){_0x184a15[_0x6a11('0x22')]=qs[_0x6a11('0x22')](_0x10c28a[_0x6a11('0x39')]['limit']);_0x184a15['offset']=qs[_0x6a11('0x1f')](_0x10c28a['query'][_0x6a11('0x1f')]);}_0x184a15[_0x6a11('0x42')]=qs[_0x6a11('0x43')](_0x10c28a[_0x6a11('0x39')][_0x6a11('0x43')]);_0x184a15[_0x6a11('0x44')]=qs['filters'](_[_0x6a11('0x45')](_0x10c28a[_0x6a11('0x39')],_0x3f17f2[_0x6a11('0x3b')]));_0x184a15[_0x6a11('0x44')][_0x6a11('0xad')]=_0x226cf9['id'];if(_0x10c28a[_0x6a11('0x39')][_0x6a11('0x81')]){_0x184a15['where']=_[_0x6a11('0x97')](_0x184a15[_0x6a11('0x44')],{'$or':_[_0x6a11('0x2d')](_0x184a15[_0x6a11('0x3e')],function(_0x7a8ed7){var _0x5c1da1={};_0x5c1da1[_0x7a8ed7]={'$like':'%'+_0x10c28a[_0x6a11('0x39')][_0x6a11('0x81')]+'%'};return _0x5c1da1;})});}if(_0x10c28a[_0x6a11('0x39')][_0x6a11('0xb9')]){var _0x57b0b5=_0x10c28a['query'][_0x6a11('0xb9')][_0x6a11('0x31')](',');var _0x1210ce={};_0x1210ce[_0x57b0b5[0x0]]={'$gte':moment(_0x57b0b5[0x1])[_0x6a11('0xba')](_0x6a11('0xbb'))};_0x184a15['where']=_['merge'](_0x184a15[_0x6a11('0x44')],_0x1210ce);}_0x184a15=_[_0x6a11('0x97')]({},_0x184a15,_0x10c28a[_0x6a11('0xbc')]);return db[_0x6a11('0xb5')][_0x6a11('0x21')]({'where':_0x184a15['where']})[_0x6a11('0x27')](function(_0x44a2c6){_0x286c15[_0x6a11('0x21')]=_0x44a2c6;if(_0x10c28a[_0x6a11('0x39')]['includeAll']){_0x184a15[_0x6a11('0xb1')]=[{'all':!![]}];}return db[_0x6a11('0xb5')][_0x6a11('0xbd')](_0x184a15);})['then'](function(_0x123a63){_0x286c15[_0x6a11('0xbe')]=_0x123a63;return _0x286c15;});}})[_0x6a11('0x27')](respondWithFilteredResult(_0xf020a,_0x184a15))['catch'](handleError(_0xf020a,null));};exports[_0x6a11('0xbf')]=function(_0x17cf47,_0x59eb5e,_0x368751){return db[_0x6a11('0x98')]['find']({'where':{'id':_0x17cf47['params']['id']}})[_0x6a11('0x27')](handleEntityNotFound(_0x59eb5e,null))[_0x6a11('0x27')](function(_0xd3c7f9){if(_0xd3c7f9){return _0xd3c7f9['setTags'](_0x17cf47[_0x6a11('0x71')][_0x6a11('0xb6')],_[_0x6a11('0xb7')](_0x17cf47[_0x6a11('0x71')],[_0x6a11('0xb6'),'id'])||{})['spread'](function(){return db['Tag'][_0x6a11('0xbd')]({'attributes':['id',_0x6a11('0x2b'),_0x6a11('0x48')],'where':{'id':_0x17cf47[_0x6a11('0x71')][_0x6a11('0xb6')]}});})[_0x6a11('0x27')](function(_0x3a43d){socket['emit']('faxInteractionTags:save',{'id':Number(_0x17cf47[_0x6a11('0xaf')]['id']),'tags':_0x3a43d||[]});return{'id':Number(_0x17cf47[_0x6a11('0xaf')]['id']),'tags':_0x3a43d||[]};});}})[_0x6a11('0x27')](respondWithResult(_0x59eb5e,null))['catch'](handleError(_0x59eb5e,null));};exports[_0x6a11('0xc0')]=function(_0x228eb5,_0x33ca0b,_0x2c5d79){return db['FaxInteraction'][_0x6a11('0x5d')]({'where':{'id':_0x228eb5['params']['id']}})['then'](handleEntityNotFound(_0x33ca0b,null))[_0x6a11('0x27')](function(_0x581241){if(_0x581241){return _0x581241[_0x6a11('0xc0')](_0x228eb5[_0x6a11('0x39')][_0x6a11('0xb6')]);}})[_0x6a11('0x27')](respondWithStatusCode(_0x33ca0b,null))[_0x6a11('0x34')](handleError(_0x33ca0b,null));};exports[_0x6a11('0xc1')]=function(_0x20fc87,_0x16c848){var _0x42c80b=moment()[_0x6a11('0xc2')]()[_0x6a11('0x95')]();var _0x56db12=path[_0x6a11('0xc3')](config[_0x6a11('0xc4')],_0x6a11('0xc5'),'files',_0x6a11('0xc6'));var _0x3022f8=path[_0x6a11('0xc3')](config[_0x6a11('0xc4')],_0x6a11('0xc5'),_0x6a11('0xc7'),'attachments');var _0x487feb=path[_0x6a11('0xc3')](_0x56db12,_0x42c80b);var _0x4ac9b0=util['format']('transcript-%d-%s.zip',_0x20fc87['params']['id'],_0x42c80b);var _0x526894=path['join'](_0x56db12,_0x4ac9b0);var _0x5e970a=[];_0x5e970a['push']({'model':db['Attachment'],'as':_0x6a11('0xc8'),'raw':!![]});var _0x511d32=[{'model':db[_0x6a11('0xb5')],'as':_0x6a11('0xc9'),'attributes':['id',_0x6a11('0x71'),_0x6a11('0x76')],'include':_0x5e970a}];return db[_0x6a11('0x98')][_0x6a11('0x5d')]({'where':{'id':_0x20fc87[_0x6a11('0xaf')]['id']},'include':_0x511d32})['then'](handleEntityNotFound(_0x16c848,null))[_0x6a11('0x27')](function(_0x2524e2){if(_0x2524e2&&_0x2524e2[_0x6a11('0xc9')]){var _0xf3d30b=_0x2524e2[_0x6a11('0xca')]({'plain':!![]});fs[_0x6a11('0xcb')](_0x487feb);for(var _0xd9cfea=0x0;_0xd9cfea<_0xf3d30b[_0x6a11('0xc9')][_0x6a11('0x3f')];_0xd9cfea++){var _0xc5977a=_0xf3d30b[_0x6a11('0xc9')][_0xd9cfea][_0x6a11('0xc8')];if(_0xc5977a){var _0x34aa49=path['join'](_0x3022f8,_0xc5977a[_0x6a11('0xcc')]);if(fs[_0x6a11('0xcd')](_0x34aa49)){fs[_0x6a11('0xce')](_0x34aa49)[_0x6a11('0xcf')](fs[_0x6a11('0xd0')](path[_0x6a11('0xc3')](_0x487feb,_0xc5977a[_0x6a11('0xcc')])));}}}return BPromise[_0x6a11('0x8e')]()[_0x6a11('0x27')](function(){return new BPromise(function(_0x211a80,_0x5135e0){zipdir(_0x487feb,{'saveTo':_0x526894},function(_0x5b4239,_0x6e6896){if(_0x5b4239)return _0x5135e0(_0x5b4239);return _0x211a80(_0x6e6896);});})[_0x6a11('0x27')](function(){return new BPromise(function(_0x4218ee,_0x28fb8c){rimraf(_0x487feb,function(_0x174885){if(_0x174885)_0x28fb8c(_0x174885);return _0x4218ee();});});})[_0x6a11('0x27')](function(){return _0x16c848['download'](_0x526894,_0x4ac9b0,function(_0x1ed5fd){if(_0x1ed5fd){console[_0x6a11('0xd1')](_0x6a11('0xd2'),_0x1ed5fd);}else{fs[_0x6a11('0xd3')](_0x526894);}});});});}else{return _0x16c848['sendStatus'](0xc8);}})[_0x6a11('0x34')](handleError(_0x16c848,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 366a95f..7bd05cf 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 _0xaff9=['emit','catch','hook','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update','remove','getUsers','Users','map','then','setDataValue','unreadMessages','length'];(function(_0x36eeda,_0x5cf6a9){var _0x488b94=function(_0x317d30){while(--_0x317d30){_0x36eeda['push'](_0x36eeda['shift']());}};_0x488b94(++_0x5cf6a9);}(_0xaff9,0x135));var _0x9aff=function(_0x5b6d67,_0x24f457){_0x5b6d67=_0x5b6d67-0x0;var _0x48feb0=_0xaff9[_0x5b6d67];return _0x48feb0;};'use strict';var EventEmitter=require(_0x9aff('0x0'));var FaxInteraction=require(_0x9aff('0x1'))['db'][_0x9aff('0x2')];var FaxMessage=require(_0x9aff('0x1'))['db'][_0x9aff('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x9aff('0x4')](0x0);var events={'afterCreate':_0x9aff('0x5'),'afterUpdate':_0x9aff('0x6'),'afterDestroy':_0x9aff('0x7')};function emitEvent(_0x279d66){return function(_0x1abffa,_0x52d6f6,_0x503418){_0x1abffa[_0x9aff('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x1a002b){_0x1abffa['setDataValue'](_0x9aff('0x9'),_0x1a002b[_0x9aff('0xa')](function(_0x151f80){return{'id':_0x151f80['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x1abffa['id'],'direction':'in','read':![]},'raw':!![]});})[_0x9aff('0xb')](function(_0xd19651){_0x1abffa[_0x9aff('0xc')](_0x9aff('0xd'),_0xd19651[_0x9aff('0xe')]);FaxInteractionEvents[_0x9aff('0xf')](_0x279d66+':'+_0x1abffa['id'],_0x1abffa);FaxInteractionEvents[_0x9aff('0xf')](_0x279d66,_0x1abffa);_0x503418(null);})[_0x9aff('0x10')](_0x503418(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x9aff('0x11')](e,emitEvent(event));}}module['exports']=FaxInteractionEvents; \ No newline at end of file +var _0x71d9=['../../mysqldb','FaxInteraction','setMaxListeners','save','remove','getUsers','then','map','unreadMessages','length','emit','catch','hook','exports'];(function(_0x4db104,_0x1d0b4c){var _0x4e5836=function(_0x29b4bc){while(--_0x29b4bc){_0x4db104['push'](_0x4db104['shift']());}};_0x4e5836(++_0x1d0b4c);}(_0x71d9,0xc4));var _0x971d=function(_0x8f5332,_0x5f48ec){_0x8f5332=_0x8f5332-0x0;var _0x542250=_0x71d9[_0x8f5332];return _0x542250;};'use strict';var EventEmitter=require('events');var FaxInteraction=require(_0x971d('0x0'))['db'][_0x971d('0x1')];var FaxMessage=require(_0x971d('0x0'))['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x971d('0x2')](0x0);var events={'afterCreate':_0x971d('0x3'),'afterUpdate':'update','afterDestroy':_0x971d('0x4')};function emitEvent(_0x26d7e1){return function(_0x43c89f,_0x267ec5,_0x2fd55d){_0x43c89f[_0x971d('0x5')]({'attributes':['id'],'raw':!![]})[_0x971d('0x6')](function(_0x112e38){_0x43c89f['setDataValue']('Users',_0x112e38[_0x971d('0x7')](function(_0x4a7fbb){return{'id':_0x4a7fbb['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x43c89f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x971d('0x6')](function(_0x2bbe9b){_0x43c89f['setDataValue'](_0x971d('0x8'),_0x2bbe9b[_0x971d('0x9')]);FaxInteractionEvents[_0x971d('0xa')](_0x26d7e1+':'+_0x43c89f['id'],_0x43c89f);FaxInteractionEvents[_0x971d('0xa')](_0x26d7e1,_0x43c89f);_0x2fd55d(null);})[_0x971d('0xb')](_0x2fd55d(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];FaxInteraction[_0x971d('0xc')](e,emitEvent(event));}}module[_0x971d('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index 15cc2ea..3717e1c 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 _0x3d05=['fax_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','moment','request-promise','./faxInteraction.attributes','exports','FaxInteraction'];(function(_0x12fdee,_0x26283d){var _0x1e6d25=function(_0x291020){while(--_0x291020){_0x12fdee['push'](_0x12fdee['shift']());}};_0x1e6d25(++_0x26283d);}(_0x3d05,0x185));var _0x53d0=function(_0xe51596,_0x314d5b){_0xe51596=_0xe51596-0x0;var _0x22c705=_0x3d05[_0xe51596];return _0x22c705;};'use strict';var _=require(_0x53d0('0x0'));var util=require('util');var logger=require(_0x53d0('0x1'))('api');var moment=require(_0x53d0('0x2'));var BPromise=require('bluebird');var rp=require(_0x53d0('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x53d0('0x4'));module[_0x53d0('0x5')]=function(_0x4c45ad,_0x5dca8c){return _0x4c45ad['define'](_0x53d0('0x6'),attributes,{'tableName':_0x53d0('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4d4cfe,_0x5012ed,_0x3f2e3b){if(_0x4d4cfe['changed'](_0x53d0('0x8'))){_0x4d4cfe['closedAt']=moment()[_0x53d0('0x9')](_0x53d0('0xa'));}_0x3f2e3b(null,_0x4d4cfe);}}});}; \ No newline at end of file +var _0xf39e=['fax_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','request-promise','path','./faxInteraction.attributes','FaxInteraction'];(function(_0x209f78,_0x56d0dc){var _0x50c533=function(_0x1a2329){while(--_0x1a2329){_0x209f78['push'](_0x209f78['shift']());}};_0x50c533(++_0x56d0dc);}(_0xf39e,0x18b));var _0xef39=function(_0x499ae4,_0x4a2788){_0x499ae4=_0x499ae4-0x0;var _0xcbbd25=_0xf39e[_0x499ae4];return _0xcbbd25;};'use strict';var _=require(_0xef39('0x0'));var util=require(_0xef39('0x1'));var logger=require(_0xef39('0x2'))('api');var moment=require(_0xef39('0x3'));var BPromise=require('bluebird');var rp=require(_0xef39('0x4'));var fs=require('fs');var path=require(_0xef39('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xef39('0x6'));module['exports']=function(_0x45830e,_0x4b58ce){return _0x45830e['define'](_0xef39('0x7'),attributes,{'tableName':_0xef39('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x21579d,_0x3ea60e,_0x6d44e2){if(_0x21579d[_0xef39('0x9')](_0xef39('0xa'))){_0x21579d[_0xef39('0xb')]=moment()['format'](_0xef39('0xc'));}_0x6d44e2(null,_0x21579d);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index 55e0184..7dd0ac9 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 _0x370a=['./faxInteraction.socket','register','request','then','info','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','request\x20sent','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','raw','options','attributes','limit','AddTagsToFaxInteraction','find','where','addTags','ids','omit','spread','AddTags','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter'];(function(_0x26cf49,_0x1a1577){var _0x5beb96=function(_0xd0396f){while(--_0xd0396f){_0x26cf49['push'](_0x26cf49['shift']());}};_0x5beb96(++_0x1a1577);}(_0x370a,0x17f));var _0xa370=function(_0x3c9c94,_0x36b9a2){_0x3c9c94=_0x3c9c94-0x0;var _0xb35299=_0x370a[_0x3c9c94];return _0xb35299;};'use strict';var _=require(_0xa370('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa370('0x1'));var rs=require(_0xa370('0x2'));var fs=require('fs');var Redis=require(_0xa370('0x3'));var db=require(_0xa370('0x4'))['db'];var utils=require(_0xa370('0x5'));var logger=require('../../config/logger')(_0xa370('0x6'));var config=require(_0xa370('0x7'));var jayson=require(_0xa370('0x8'));var client=jayson[_0xa370('0x9')]['http']({'port':0x232a});config[_0xa370('0xa')]=_[_0xa370('0xb')](config[_0xa370('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xa370('0xc'))(new Redis(config[_0xa370('0xa')]));require(_0xa370('0xd'))[_0xa370('0xe')](socket);function respondWithRpcPromise(_0x1c16e5,_0x188da8,_0x1e0717){return new BPromise(function(_0x5a2637,_0x5675e1){return client[_0xa370('0xf')](_0x1c16e5,_0x1e0717)[_0xa370('0x10')](function(_0x547832){logger[_0xa370('0x11')]('FaxInteraction,\x20%s,\x20%s',_0x188da8,'request\x20sent');logger[_0xa370('0x12')](_0xa370('0x13'),_0x188da8,'request\x20sent',JSON[_0xa370('0x14')](_0x547832));if(_0x547832[_0xa370('0x15')]){if(_0x547832['error'][_0xa370('0x16')]===0x1f4){logger[_0xa370('0x15')](_0xa370('0x17'),_0x188da8,_0x547832['error'][_0xa370('0x18')]);return _0x5675e1(_0x547832[_0xa370('0x15')][_0xa370('0x18')]);}logger[_0xa370('0x15')]('FaxInteraction,\x20%s,\x20%s',_0x188da8,_0x547832[_0xa370('0x15')][_0xa370('0x18')]);return _0x5a2637(_0x547832[_0xa370('0x15')][_0xa370('0x18')]);}else{logger[_0xa370('0x11')](_0xa370('0x17'),_0x188da8,_0xa370('0x19'));_0x5a2637(_0x547832[_0xa370('0x1a')][_0xa370('0x18')]);}})[_0xa370('0x1b')](function(_0x555997){logger[_0xa370('0x15')](_0xa370('0x17'),_0x188da8,_0x555997);_0x5675e1(_0x555997);});});}exports[_0xa370('0x1c')]=function(_0x358781){var _0x474aa3=this;return new Promise(function(_0x599008,_0x3b2720){return db[_0xa370('0x1d')][_0xa370('0x1e')](_0x358781[_0xa370('0x1f')],{'raw':_0x358781['options']?_0x358781['options'][_0xa370('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x358781['options']?_0x358781[_0xa370('0x21')]['where']||null:null,'attributes':_0x358781[_0xa370('0x21')]?_0x358781[_0xa370('0x21')][_0xa370('0x22')]||null:null,'limit':_0x358781[_0xa370('0x21')]?_0x358781[_0xa370('0x21')][_0xa370('0x23')]||null:null})['then'](function(_0x4d61b1){logger[_0xa370('0x11')]('UpdateFaxInteraction',_0x358781);logger[_0xa370('0x12')](_0xa370('0x1c'),_0x358781,JSON[_0xa370('0x14')](_0x4d61b1));_0x599008(_0x4d61b1);})[_0xa370('0x1b')](function(_0x462d2a){logger['error'](_0xa370('0x1c'),_0x462d2a[_0xa370('0x18')],_0x358781);_0x3b2720(_0x474aa3['error'](0x1f4,_0x462d2a[_0xa370('0x18')]));});});};exports[_0xa370('0x24')]=function(_0x25e87f){return new Promise(function(_0x8ae5d5,_0x2bcb4e){return db['FaxInteraction'][_0xa370('0x25')]({'where':_0x25e87f[_0xa370('0x21')]?_0x25e87f[_0xa370('0x21')][_0xa370('0x26')]||null:null})[_0xa370('0x10')](function(_0x49b46e){if(_0x49b46e){return _0x49b46e[_0xa370('0x27')](_0x25e87f[_0xa370('0x1f')][_0xa370('0x28')],_[_0xa370('0x29')](_0x25e87f['body'],[_0xa370('0x28'),'id'])||{});}})[_0xa370('0x2a')](function(_0x16dfa2){logger[_0xa370('0x11')](_0xa370('0x2b'),_0x25e87f);logger['debug'](_0xa370('0x2b'),_0x25e87f,JSON[_0xa370('0x14')](_0x16dfa2));_0x8ae5d5(_0x16dfa2);})[_0xa370('0x1b')](function(_0x519f9d){logger['error'](_0xa370('0x2b'),_0x519f9d[_0xa370('0x18')],_0x25e87f);_0x2bcb4e(_this[_0xa370('0x15')](0x1f4,_0x519f9d[_0xa370('0x18')]));});});}; \ No newline at end of file +var _0x1c68=['addTags','ids','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','FaxInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxInteraction,\x20%s,\x20%s','message','result','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','where','attributes','limit','catch','AddTagsToFaxInteraction'];(function(_0x3fe70e,_0x24c439){var _0x3e31df=function(_0x3491bd){while(--_0x3491bd){_0x3fe70e['push'](_0x3fe70e['shift']());}};_0x3e31df(++_0x24c439);}(_0x1c68,0x18f));var _0x81c6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1c68[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x81c6('0x0'));var util=require(_0x81c6('0x1'));var moment=require(_0x81c6('0x2'));var BPromise=require(_0x81c6('0x3'));var rs=require(_0x81c6('0x4'));var fs=require('fs');var Redis=require(_0x81c6('0x5'));var db=require(_0x81c6('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x81c6('0x7'))(_0x81c6('0x8'));var config=require(_0x81c6('0x9'));var jayson=require(_0x81c6('0xa'));var client=jayson[_0x81c6('0xb')][_0x81c6('0xc')]({'port':0x232a});config['redis']=_[_0x81c6('0xd')](config[_0x81c6('0xe')],{'host':_0x81c6('0xf'),'port':0x18eb});var socket=require(_0x81c6('0x10'))(new Redis(config[_0x81c6('0xe')]));require('./faxInteraction.socket')[_0x81c6('0x11')](socket);function respondWithRpcPromise(_0x337721,_0x1e55c1,_0x53f2f4){return new BPromise(function(_0x242135,_0x199846){return client[_0x81c6('0x12')](_0x337721,_0x53f2f4)[_0x81c6('0x13')](function(_0x2c9df5){logger[_0x81c6('0x14')]('FaxInteraction,\x20%s,\x20%s',_0x1e55c1,_0x81c6('0x15'));logger[_0x81c6('0x16')](_0x81c6('0x17'),_0x1e55c1,_0x81c6('0x15'),JSON[_0x81c6('0x18')](_0x2c9df5));if(_0x2c9df5[_0x81c6('0x19')]){if(_0x2c9df5[_0x81c6('0x19')][_0x81c6('0x1a')]===0x1f4){logger[_0x81c6('0x19')](_0x81c6('0x1b'),_0x1e55c1,_0x2c9df5['error'][_0x81c6('0x1c')]);return _0x199846(_0x2c9df5[_0x81c6('0x19')][_0x81c6('0x1c')]);}logger[_0x81c6('0x19')]('FaxInteraction,\x20%s,\x20%s',_0x1e55c1,_0x2c9df5['error']['message']);return _0x242135(_0x2c9df5['error'][_0x81c6('0x1c')]);}else{logger['info']('FaxInteraction,\x20%s,\x20%s',_0x1e55c1,_0x81c6('0x15'));_0x242135(_0x2c9df5[_0x81c6('0x1d')]['message']);}})['catch'](function(_0x3adc95){logger[_0x81c6('0x19')](_0x81c6('0x1b'),_0x1e55c1,_0x3adc95);_0x199846(_0x3adc95);});});}exports[_0x81c6('0x1e')]=function(_0x5117ba){var _0x4474f3=this;return new Promise(function(_0x24d031,_0x3d36e1){return db[_0x81c6('0x1f')][_0x81c6('0x20')](_0x5117ba[_0x81c6('0x21')],{'raw':_0x5117ba[_0x81c6('0x22')]?_0x5117ba[_0x81c6('0x22')][_0x81c6('0x23')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5117ba[_0x81c6('0x22')]?_0x5117ba[_0x81c6('0x22')][_0x81c6('0x24')]||null:null,'attributes':_0x5117ba[_0x81c6('0x22')]?_0x5117ba['options'][_0x81c6('0x25')]||null:null,'limit':_0x5117ba[_0x81c6('0x22')]?_0x5117ba[_0x81c6('0x22')][_0x81c6('0x26')]||null:null})[_0x81c6('0x13')](function(_0x380a92){logger[_0x81c6('0x14')](_0x81c6('0x1e'),_0x5117ba);logger[_0x81c6('0x16')](_0x81c6('0x1e'),_0x5117ba,JSON['stringify'](_0x380a92));_0x24d031(_0x380a92);})[_0x81c6('0x27')](function(_0x450d97){logger['error'](_0x81c6('0x1e'),_0x450d97[_0x81c6('0x1c')],_0x5117ba);_0x3d36e1(_0x4474f3['error'](0x1f4,_0x450d97['message']));});});};exports[_0x81c6('0x28')]=function(_0x3d4d85){return new Promise(function(_0x412a9d,_0x624d95){return db[_0x81c6('0x1f')]['find']({'where':_0x3d4d85['options']?_0x3d4d85[_0x81c6('0x22')][_0x81c6('0x24')]||null:null})[_0x81c6('0x13')](function(_0x22c6fb){if(_0x22c6fb){return _0x22c6fb[_0x81c6('0x29')](_0x3d4d85[_0x81c6('0x21')][_0x81c6('0x2a')],_['omit'](_0x3d4d85[_0x81c6('0x21')],['ids','id'])||{});}})['spread'](function(_0x5b105c){logger['info'](_0x81c6('0x2b'),_0x3d4d85);logger[_0x81c6('0x16')](_0x81c6('0x2b'),_0x3d4d85,JSON[_0x81c6('0x18')](_0x5b105c));_0x412a9d(_0x5b105c);})[_0x81c6('0x27')](function(_0x25c3e7){logger[_0x81c6('0x19')](_0x81c6('0x2b'),_0x25c3e7['message'],_0x3d4d85);_0x624d95(_this[_0x81c6('0x19')](0x1f4,_0x25c3e7[_0x81c6('0x1c')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index f80e983..b08f7c5 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 _0xe4ab=['./faxInteraction.events','emit','removeListener','register','length'];(function(_0x5e3f0f,_0x16c6c7){var _0xbd8d66=function(_0x3f4da4){while(--_0x3f4da4){_0x5e3f0f['push'](_0x5e3f0f['shift']());}};_0xbd8d66(++_0x16c6c7);}(_0xe4ab,0x1ef));var _0xbe4a=function(_0x5467e2,_0x1ea05b){_0x5467e2=_0x5467e2-0x0;var _0x51a0f8=_0xe4ab[_0x5467e2];return _0x51a0f8;};'use strict';var FaxInteractionEvents=require(_0xbe4a('0x0'));var events=['save','remove','update'];function createListener(_0x16b512,_0x1ff025){return function(_0x310ddc){_0x1ff025[_0xbe4a('0x1')](_0x16b512,_0x310ddc);};}function removeListener(_0xdaaa04,_0x2e57bf){return function(){FaxInteractionEvents[_0xbe4a('0x2')](_0xdaaa04,_0x2e57bf);};}exports[_0xbe4a('0x3')]=function(_0x29825d){for(var _0x776f90=0x0,_0x5cdb1d=events[_0xbe4a('0x4')];_0x776f90<_0x5cdb1d;_0x776f90++){var _0x239408=events[_0x776f90];var _0x1f93e2=createListener('faxInteraction:'+_0x239408,_0x29825d);FaxInteractionEvents['on'](_0x239408,_0x1f93e2);}}; \ No newline at end of file +var _0xdd7d=['register','length','faxInteraction:','./faxInteraction.events','update','emit','removeListener'];(function(_0x5a112c,_0x20e290){var _0xa2f8e9=function(_0x24771c){while(--_0x24771c){_0x5a112c['push'](_0x5a112c['shift']());}};_0xa2f8e9(++_0x20e290);}(_0xdd7d,0x122));var _0xddd7=function(_0x3d216f,_0x345fc9){_0x3d216f=_0x3d216f-0x0;var _0x240d8c=_0xdd7d[_0x3d216f];return _0x240d8c;};'use strict';var FaxInteractionEvents=require(_0xddd7('0x0'));var events=['save','remove',_0xddd7('0x1')];function createListener(_0x2263ca,_0x2deabd){return function(_0x1c73c3){_0x2deabd[_0xddd7('0x2')](_0x2263ca,_0x1c73c3);};}function removeListener(_0x235c89,_0x341b86){return function(){FaxInteractionEvents[_0xddd7('0x3')](_0x235c89,_0x341b86);};}exports[_0xddd7('0x4')]=function(_0x25c2e9){for(var _0x55156a=0x0,_0x3264ff=events[_0xddd7('0x5')];_0x55156a<_0x3264ff;_0x55156a++){var _0x590add=events[_0x55156a];var _0x12f613=createListener(_0xddd7('0x6')+_0x590add,_0x25c2e9);FaxInteractionEvents['on'](_0x590add,_0x12f613);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index f7bf97a..652851c 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 _0xcdd0=['addMessage','post','tracked','put','fax','update','destroy','/:id/tags','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./faxInteraction.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/messages','getMessages','download','create'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xcdd0,0xd9));var _0x0cdd=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xcdd0[_0x47a7d0];return _0xb9bd08;};'use strict';var multer=require(_0x0cdd('0x0'));var util=require(_0x0cdd('0x1'));var path=require(_0x0cdd('0x2'));var timeout=require(_0x0cdd('0x3'));var express=require('express');var router=express[_0x0cdd('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x0cdd('0x5'));var config=require('../../config/environment');var controller=require(_0x0cdd('0x6'));router[_0x0cdd('0x7')]('/',auth[_0x0cdd('0x8')](),controller['index']);router[_0x0cdd('0x7')](_0x0cdd('0x9'),auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xa')]);router[_0x0cdd('0x7')](_0x0cdd('0xb'),auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xc')]);router[_0x0cdd('0x7')](_0x0cdd('0xd'),auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xe')]);router[_0x0cdd('0x7')]('/:id/download',auth[_0x0cdd('0x8')](),controller[_0x0cdd('0xf')]);router['post']('/',auth[_0x0cdd('0x8')](),controller[_0x0cdd('0x10')]);router['post'](_0x0cdd('0xd'),auth['isAuthenticated'](),controller[_0x0cdd('0x11')]);router[_0x0cdd('0x12')]('/:id/tags',auth['isAuthenticated'](),interaction[_0x0cdd('0x13')]('fax','faxinteraction:addtags'),controller['addTags']);router[_0x0cdd('0x14')]('/:id',auth[_0x0cdd('0x8')](),interaction[_0x0cdd('0x13')](_0x0cdd('0x15'),'faxinteraction:update'),controller[_0x0cdd('0x16')]);router['delete'](_0x0cdd('0xb'),auth[_0x0cdd('0x8')](),interaction[_0x0cdd('0x13')]('fax','faxinteraction:destroy'),controller[_0x0cdd('0x17')]);router['delete'](_0x0cdd('0x18'),auth[_0x0cdd('0x8')](),controller['removeTags']);module[_0x0cdd('0x19')]=router; \ No newline at end of file +var _0x984c=['get','isAuthenticated','describe','/:id','/:id/download','download','post','create','/:id/messages','addMessage','/:id/tags','faxinteraction:addtags','addTags','tracked','faxinteraction:update','delete','faxinteraction:destroy','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x5c9600,_0x710564){var _0x2eec81=function(_0x264230){while(--_0x264230){_0x5c9600['push'](_0x5c9600['shift']());}};_0x2eec81(++_0x710564);}(_0x984c,0xb5));var _0xc984=function(_0xb11c23,_0x2421ea){_0xb11c23=_0xb11c23-0x0;var _0x1c82ab=_0x984c[_0xb11c23];return _0x1c82ab;};'use strict';var multer=require(_0xc984('0x0'));var util=require('util');var path=require(_0xc984('0x1'));var timeout=require(_0xc984('0x2'));var express=require(_0xc984('0x3'));var router=express[_0xc984('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc984('0x5'));var interaction=require(_0xc984('0x6'));var config=require(_0xc984('0x7'));var controller=require('./faxInteraction.controller');router[_0xc984('0x8')]('/',auth[_0xc984('0x9')](),controller['index']);router[_0xc984('0x8')]('/describe',auth[_0xc984('0x9')](),controller[_0xc984('0xa')]);router[_0xc984('0x8')](_0xc984('0xb'),auth[_0xc984('0x9')](),controller['show']);router[_0xc984('0x8')]('/:id/messages',auth['isAuthenticated'](),controller['getMessages']);router['get'](_0xc984('0xc'),auth[_0xc984('0x9')](),controller[_0xc984('0xd')]);router[_0xc984('0xe')]('/',auth[_0xc984('0x9')](),controller[_0xc984('0xf')]);router[_0xc984('0xe')](_0xc984('0x10'),auth[_0xc984('0x9')](),controller[_0xc984('0x11')]);router['post'](_0xc984('0x12'),auth[_0xc984('0x9')](),interaction['tracked']('fax',_0xc984('0x13')),controller[_0xc984('0x14')]);router['put'](_0xc984('0xb'),auth[_0xc984('0x9')](),interaction[_0xc984('0x15')]('fax',_0xc984('0x16')),controller['update']);router[_0xc984('0x17')](_0xc984('0xb'),auth[_0xc984('0x9')](),interaction[_0xc984('0x15')]('fax',_0xc984('0x18')),controller[_0xc984('0x19')]);router[_0xc984('0x17')]('/:id/tags',auth[_0xc984('0x9')](),controller['removeTags']);module[_0xc984('0x1a')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index bb196d4..74fc079 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 _0xe630=['DATE','sequelize','exports','medium','BOOLEAN','ENUM','out','TEXT'];(function(_0x277107,_0x3420dc){var _0x1da046=function(_0x47122d){while(--_0x47122d){_0x277107['push'](_0x277107['shift']());}};_0x1da046(++_0x3420dc);}(_0xe630,0x149));var _0x0e63=function(_0x2335e6,_0x1bade8){_0x2335e6=_0x2335e6-0x0;var _0x370a50=_0xe630[_0x2335e6];return _0x370a50;};'use strict';var Sequelize=require(_0x0e63('0x0'));module[_0x0e63('0x1')]={'body':{'type':Sequelize['TEXT'](_0x0e63('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x0e63('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x0e63('0x4')]('in','out'),'defaultValue':_0x0e63('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x0e63('0x6')],'defaultValue':null},'readAt':{'type':Sequelize[_0x0e63('0x7')]}}; \ No newline at end of file +var _0xf72b=['TEXT','BOOLEAN','ENUM','out','DATE','sequelize'];(function(_0x506d83,_0x1899e9){var _0x335e8b=function(_0x4a7044){while(--_0x4a7044){_0x506d83['push'](_0x506d83['shift']());}};_0x335e8b(++_0x1899e9);}(_0xf72b,0x1d9));var _0xbf72=function(_0x1cf407,_0x265c97){_0x1cf407=_0x1cf407-0x0;var _0x14c14d=_0xf72b[_0x1cf407];return _0x14c14d;};'use strict';var Sequelize=require(_0xbf72('0x0'));module['exports']={'body':{'type':Sequelize[_0xbf72('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xbf72('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xbf72('0x3')]('in','out'),'defaultValue':_0xbf72('0x4'),'allowNull':![]},'failMessage':{'type':Sequelize[_0xbf72('0x1')],'defaultValue':null},'readAt':{'type':Sequelize[_0xbf72('0x5')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index b27e5fe..557d767 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 _0x05c9=['null','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','agent','fullname','internal','interface','event','EventManager','interaction','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','email','SIP/%s','channel','rejectmessage','create','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','eml-format','rimraf','zip-dir','fast-json-patch','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','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','socket.io-emitter','./faxMessage.socket','register','jayson/promise','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','status','end','json','offset','undefined','count','set','reject','update','destroy','sendStatus','stack','name','send','index','FaxMessage','rawAttributes','fieldName','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','limit','order','sort','filter','merge','where','VIRTUAL','options','include','rows','show','find','body','params','describe','../../config/logger','fax-interactions','accept','fax','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteraction','FaxInteractionId','isNil','format','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role'];(function(_0x4fe441,_0x4fa7a3){var _0x4ab8ea=function(_0x1937f2){while(--_0x1937f2){_0x4fe441['push'](_0x4fe441['shift']());}};_0x4ab8ea(++_0x4fa7a3);}(_0x05c9,0xb9));var _0x905c=function(_0x5d06ff,_0x172d84){_0x5d06ff=_0x5d06ff-0x0;var _0x1bead8=_0x05c9[_0x5d06ff];return _0x1bead8;};'use strict';var emlformat=require(_0x905c('0x0'));var rimraf=require(_0x905c('0x1'));var zipdir=require(_0x905c('0x2'));var jsonpatch=require(_0x905c('0x3'));var rp=require(_0x905c('0x4'));var moment=require(_0x905c('0x5'));var BPromise=require(_0x905c('0x6'));var Mustache=require(_0x905c('0x7'));var util=require(_0x905c('0x8'));var path=require(_0x905c('0x9'));var sox=require(_0x905c('0xa'));var csv=require(_0x905c('0xb'));var ejs=require(_0x905c('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x905c('0xd'));var squel=require(_0x905c('0xe'));var crypto=require(_0x905c('0xf'));var jsforce=require(_0x905c('0x10'));var deskjs=require(_0x905c('0x11'));var toCsv=require(_0x905c('0xb'));var querystring=require(_0x905c('0x12'));var Papa=require('papaparse');var Redis=require(_0x905c('0x13'));var authService=require(_0x905c('0x14'));var qs=require(_0x905c('0x15'));var as=require(_0x905c('0x16'));var hardwareService=require(_0x905c('0x17'));var logger=require('../../config/logger')(_0x905c('0x18'));var utils=require(_0x905c('0x19'));var config=require(_0x905c('0x1a'));var licenseUtil=require(_0x905c('0x1b'));var db=require(_0x905c('0x1c'))['db'];config['redis']=_[_0x905c('0x1d')](config[_0x905c('0x1e')],{'host':'localhost','port':0x18eb});var socket=require(_0x905c('0x1f'))(new Redis(config['redis']));require(_0x905c('0x20'))[_0x905c('0x21')](socket);var jayson=require(_0x905c('0x22'));var client=jayson[_0x905c('0x23')]['http']({'port':0x232c});var client9002=jayson[_0x905c('0x23')][_0x905c('0x24')]({'port':0x232a});function respondWithRpcPromise(_0x49a6a4,_0x448da5,_0x2c2059,_0x4e0cd1){return new BPromise(function(_0x2b22fd,_0x32ef57){var _0x1092c3=_0x4e0cd1||client;return _0x1092c3[_0x905c('0x25')](_0x49a6a4,_0x2c2059)[_0x905c('0x26')](function(_0x1696c9){logger[_0x905c('0x27')](_0x905c('0x28'),_0x448da5,_0x905c('0x29'));logger[_0x905c('0x2a')](_0x905c('0x2b'),_0x448da5,'request\x20sent',JSON[_0x905c('0x2c')](_0x1696c9));if(_0x1696c9[_0x905c('0x2d')]){if(_0x1696c9[_0x905c('0x2d')]['code']===0x1f4){logger[_0x905c('0x2d')](_0x905c('0x28'),_0x448da5,_0x1696c9['error']['message']);return _0x32ef57(_0x1696c9['error'][_0x905c('0x2e')]);}logger[_0x905c('0x2d')](_0x905c('0x28'),_0x448da5,_0x1696c9[_0x905c('0x2d')][_0x905c('0x2e')]);return _0x2b22fd(_0x1696c9['error']['message']);}else{logger[_0x905c('0x27')](_0x905c('0x28'),_0x448da5,_0x905c('0x29'));_0x2b22fd(_0x1696c9[_0x905c('0x2f')][_0x905c('0x2e')]);}})[_0x905c('0x30')](function(_0x228df8){logger[_0x905c('0x2d')](_0x905c('0x28'),_0x448da5,_0x228df8);_0x32ef57(_0x228df8);});});}function respondWithStatusCode(_0x18bf7d,_0x2e63a2){_0x2e63a2=_0x2e63a2||0xcc;return function(_0x11914f){if(_0x11914f){return _0x18bf7d['sendStatus'](_0x2e63a2);}return _0x18bf7d[_0x905c('0x31')](_0x2e63a2)[_0x905c('0x32')]();};}function respondWithResult(_0x56f55c,_0x56c893){_0x56c893=_0x56c893||0xc8;return function(_0x2934e7){if(_0x2934e7){return _0x56f55c[_0x905c('0x31')](_0x56c893)[_0x905c('0x33')](_0x2934e7);}};}function respondWithFilteredResult(_0x5610b3,_0x38bec6){return function(_0x3eb298){if(_0x3eb298){var _0x293efb=typeof _0x38bec6[_0x905c('0x34')]===_0x905c('0x35')&&typeof _0x38bec6['limit']===_0x905c('0x35');var _0x5aec7d=_0x3eb298[_0x905c('0x36')];var _0x2d809c=_0x293efb?0x0:_0x38bec6[_0x905c('0x34')];var _0x5f42b0=_0x293efb?_0x3eb298['count']:_0x38bec6[_0x905c('0x34')]+_0x38bec6['limit'];var _0x40bbc2;if(_0x5f42b0>=_0x5aec7d){_0x5f42b0=_0x5aec7d;_0x40bbc2=0xc8;}else{_0x40bbc2=0xce;}_0x5610b3['status'](_0x40bbc2);return _0x5610b3[_0x905c('0x37')]('Content-Range',_0x2d809c+'-'+_0x5f42b0+'/'+_0x5aec7d)[_0x905c('0x33')](_0x3eb298);}return null;};}function patchUpdates(_0x24db2f){return function(_0x2cc79c){try{jsonpatch['apply'](_0x2cc79c,_0x24db2f,!![]);}catch(_0x4b8733){return BPromise[_0x905c('0x38')](_0x4b8733);}return _0x2cc79c['save']();};}function saveUpdates(_0x16fb9a,_0x2891ea){return function(_0x17fdfc){if(_0x17fdfc){return _0x17fdfc[_0x905c('0x39')](_0x16fb9a)[_0x905c('0x26')](function(_0x5bc0a9){return _0x5bc0a9;});}return null;};}function removeEntity(_0x48d48a,_0x3f898a){return function(_0x4b9fa0){if(_0x4b9fa0){return _0x4b9fa0[_0x905c('0x3a')]()[_0x905c('0x26')](function(){_0x48d48a['status'](0xcc)[_0x905c('0x32')]();});}};}function handleEntityNotFound(_0x1c8550,_0x5d2bae){return function(_0x5bbe92){if(!_0x5bbe92){_0x1c8550[_0x905c('0x3b')](0x194);}return _0x5bbe92;};}function handleError(_0x4789d1,_0x693fc){_0x693fc=_0x693fc||0x1f4;return function(_0x14226d){logger[_0x905c('0x2d')](_0x14226d[_0x905c('0x3c')]);if(_0x14226d['name']){delete _0x14226d[_0x905c('0x3d')];}_0x4789d1['status'](_0x693fc)[_0x905c('0x3e')](_0x14226d);};}exports[_0x905c('0x3f')]=function(_0x35079d,_0x475fea){var _0x19d13c={},_0x25dfb5={},_0x4a7342={'count':0x0,'rows':[]};var _0x4f05a1=_['map'](db[_0x905c('0x40')][_0x905c('0x41')],function(_0x88396e){return{'name':_0x88396e[_0x905c('0x42')],'type':_0x88396e[_0x905c('0x43')][_0x905c('0x44')]};});_0x25dfb5[_0x905c('0x45')]=_['map'](_0x4f05a1,_0x905c('0x3d'));_0x25dfb5['query']=_[_0x905c('0x46')](_0x35079d[_0x905c('0x47')]);_0x25dfb5[_0x905c('0x48')]=_['intersection'](_0x25dfb5[_0x905c('0x45')],_0x25dfb5['query']);_0x19d13c[_0x905c('0x49')]=_[_0x905c('0x4a')](_0x25dfb5[_0x905c('0x45')],qs[_0x905c('0x4b')](_0x35079d['query']['fields']));_0x19d13c[_0x905c('0x49')]=_0x19d13c[_0x905c('0x49')][_0x905c('0x4c')]?_0x19d13c[_0x905c('0x49')]:_0x25dfb5[_0x905c('0x45')];if(!_0x35079d[_0x905c('0x47')][_0x905c('0x4d')]('nolimit')){_0x19d13c[_0x905c('0x4e')]=qs[_0x905c('0x4e')](_0x35079d[_0x905c('0x47')][_0x905c('0x4e')]);_0x19d13c[_0x905c('0x34')]=qs[_0x905c('0x34')](_0x35079d[_0x905c('0x47')][_0x905c('0x34')]);}_0x19d13c[_0x905c('0x4f')]=qs['sort'](_0x35079d['query'][_0x905c('0x50')]);_0x19d13c['where']=qs['filters'](_['pick'](_0x35079d['query'],_0x25dfb5[_0x905c('0x48')]),_0x4f05a1);if(_0x35079d[_0x905c('0x47')][_0x905c('0x51')]){_0x19d13c['where']=_[_0x905c('0x52')](_0x19d13c[_0x905c('0x53')],{'$or':_['map'](_0x4f05a1,function(_0x1b6dd9){if(_0x1b6dd9[_0x905c('0x43')]!==_0x905c('0x54')){var _0x271479={};_0x271479[_0x1b6dd9['name']]={'$like':'%'+_0x35079d[_0x905c('0x47')][_0x905c('0x51')]+'%'};return _0x271479;}})});}_0x19d13c=_['merge']({},_0x19d13c,_0x35079d[_0x905c('0x55')]);var _0x4229d9={'where':_0x19d13c[_0x905c('0x53')]};return db[_0x905c('0x40')][_0x905c('0x36')](_0x4229d9)[_0x905c('0x26')](function(_0x559bc9){_0x4a7342[_0x905c('0x36')]=_0x559bc9;if(_0x35079d[_0x905c('0x47')]['includeAll']){_0x19d13c[_0x905c('0x56')]=[{'all':!![]}];}return db[_0x905c('0x40')]['findAll'](_0x19d13c);})[_0x905c('0x26')](function(_0x2decf6){_0x4a7342[_0x905c('0x57')]=_0x2decf6;return _0x4a7342;})['then'](respondWithFilteredResult(_0x475fea,_0x19d13c))[_0x905c('0x30')](handleError(_0x475fea,null));};exports[_0x905c('0x58')]=function(_0x4eb1a6,_0x39e930){var _0x48fe3b={'raw':!![],'where':{'id':_0x4eb1a6['params']['id']}},_0x276b03={};_0x276b03[_0x905c('0x45')]=_[_0x905c('0x46')](db[_0x905c('0x40')][_0x905c('0x41')]);_0x276b03['query']=_[_0x905c('0x46')](_0x4eb1a6[_0x905c('0x47')]);_0x276b03[_0x905c('0x48')]=_[_0x905c('0x4a')](_0x276b03[_0x905c('0x45')],_0x276b03[_0x905c('0x47')]);_0x48fe3b['attributes']=_['intersection'](_0x276b03[_0x905c('0x45')],qs[_0x905c('0x4b')](_0x4eb1a6[_0x905c('0x47')]['fields']));_0x48fe3b[_0x905c('0x49')]=_0x48fe3b[_0x905c('0x49')][_0x905c('0x4c')]?_0x48fe3b['attributes']:_0x276b03['model'];if(_0x4eb1a6[_0x905c('0x47')]['includeAll']){_0x48fe3b[_0x905c('0x56')]=[{'all':!![]}];}_0x48fe3b=_[_0x905c('0x52')]({},_0x48fe3b,_0x4eb1a6['options']);return db[_0x905c('0x40')][_0x905c('0x59')](_0x48fe3b)[_0x905c('0x26')](handleEntityNotFound(_0x39e930,null))[_0x905c('0x26')](respondWithResult(_0x39e930,null))[_0x905c('0x30')](handleError(_0x39e930,null));};exports[_0x905c('0x39')]=function(_0x14ddc4,_0x3dad70){if(_0x14ddc4[_0x905c('0x5a')]['id']){delete _0x14ddc4[_0x905c('0x5a')]['id'];}return db[_0x905c('0x40')][_0x905c('0x59')]({'where':{'id':_0x14ddc4[_0x905c('0x5b')]['id']}})[_0x905c('0x26')](handleEntityNotFound(_0x3dad70,null))[_0x905c('0x26')](saveUpdates(_0x14ddc4[_0x905c('0x5a')],null))[_0x905c('0x26')](respondWithResult(_0x3dad70,null))[_0x905c('0x30')](handleError(_0x3dad70,null));};exports[_0x905c('0x3a')]=function(_0x2717fb,_0x5574e9){return db[_0x905c('0x40')][_0x905c('0x59')]({'where':{'id':_0x2717fb[_0x905c('0x5b')]['id']}})[_0x905c('0x26')](handleEntityNotFound(_0x5574e9,null))[_0x905c('0x26')](removeEntity(_0x5574e9,null))[_0x905c('0x30')](handleError(_0x5574e9,null));};exports[_0x905c('0x5c')]=function(_0x4130bb,_0x488a07){return db[_0x905c('0x40')][_0x905c('0x5c')]()[_0x905c('0x26')](respondWithResult(_0x488a07,null))[_0x905c('0x30')](handleError(_0x488a07,null));};var interaction_log=require(_0x905c('0x5d'))(_0x905c('0x5e'));exports[_0x905c('0x5f')]=function(_0x5324c3,_0x340fd1,_0x5b3780){var _0x670a5={'agent':{},'channel':_0x905c('0x60')};if(_0x5324c3['body']['id']){delete _0x5324c3[_0x905c('0x5a')]['id'];}_0x5324c3[_0x905c('0x5a')][_0x905c('0x61')]=!![];_0x5324c3['body'][_0x905c('0x62')]=moment()['format'](_0x905c('0x63'));_0x5324c3[_0x905c('0x5a')]['UserId']=_0x5324c3['body'][_0x905c('0x64')]||_0x5324c3[_0x905c('0x65')]['id'];_0x670a5['agent']['id']=_0x5324c3['body'][_0x905c('0x64')];return db[_0x905c('0x40')][_0x905c('0x59')]({'where':{'id':_0x5324c3[_0x905c('0x5b')]['id'],'UserId':null}})[_0x905c('0x26')](handleEntityNotFound(_0x340fd1,null))[_0x905c('0x26')](saveUpdates(_0x5324c3['body'],null))['then'](function(_0x4a81a5){if(_0x4a81a5){_0x670a5[_0x905c('0x2e')]=_0x4a81a5[_0x905c('0x66')]({'plain':!![]});return db[_0x905c('0x67')][_0x905c('0x59')]({'where':{'id':_0x4a81a5[_0x905c('0x68')]}});}return null;})[_0x905c('0x26')](handleEntityNotFound(_0x340fd1,null))[_0x905c('0x26')](function(_0x405d51){if(_0x405d51){return _0x405d51['update']({'UserId':_0x5324c3['body'][_0x905c('0x64')],'read1stAt':_[_0x905c('0x69')](_0x405d51['read1stAt'])?moment()[_0x905c('0x6a')](_0x905c('0x63')):undefined});}return null;})[_0x905c('0x26')](function(_0x2d1c00){if(_0x2d1c00){_0x670a5['interaction']=_0x2d1c00[_0x905c('0x66')]({'plain':!![]});interaction_log[_0x905c('0x27')](_0x905c('0x6b'),_0x5324c3[_0x905c('0x65')]['id'],_0x5324c3['user']['name'],_0x5324c3['user'][_0x905c('0x6c')],_0x670a5['interaction']['id'],_0x5324c3[_0x905c('0x5a')]?JSON[_0x905c('0x2c')](_0x5324c3[_0x905c('0x5a')]):_0x905c('0x6d'));return respondWithRpcPromise(_0x905c('0x6e'),_0x905c('0x6f'),_0x670a5);}return null;})['then'](function(_0x5d9f00){var _0x53fadd='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5d9f00[_0x905c('0x2e')][_0x905c('0x70')];return db[_0x905c('0x71')][_0x905c('0x47')](_0x53fadd,{'type':db[_0x905c('0x72')][_0x905c('0x73')][_0x905c('0x74')],'raw':!![]})[_0x905c('0x26')](function(_0x3eea57){return _0x3eea57;});})['then'](function(_0x11cf9e){if(_0x11cf9e){_0x670a5['message'][_0x905c('0x75')]=_0x11cf9e[0x0];if(!_0x5324c3['body'][_0x905c('0x64')])return;return db[_0x905c('0x76')][_0x905c('0x59')]({'where':{'id':_0x5324c3[_0x905c('0x5a')][_0x905c('0x64')],'role':_0x905c('0x77')},'attributes':['id',_0x905c('0x3d'),_0x905c('0x78'),'email',_0x905c('0x79')],'raw':!![]});}return null;})[_0x905c('0x26')](function(_0x2bb80b){if(!_0x2bb80b)return null;_0x670a5[_0x905c('0x2e')][_0x905c('0x77')]=_0x2bb80b;return _0x670a5;})[_0x905c('0x26')](function(_0x49b03a){if(_0x49b03a){if(_0x5324c3[_0x905c('0x5a')]['manual']){_0x670a5[_0x905c('0x2e')][_0x905c('0x7a')]=util[_0x905c('0x6a')]('SIP/%s',_0x5324c3['user'][_0x905c('0x3d')]);_0x670a5[_0x905c('0x2e')]['channel']=_0x670a5['channel'];_0x670a5['message'][_0x905c('0x7b')]=_0x905c('0x5f');return respondWithRpcPromise(_0x905c('0x7c'),_0x905c('0x7c'),{'event':'acceptmessage','message':_0x670a5[_0x905c('0x2e')]},client9002)[_0x905c('0x26')](function(){return _0x670a5;});}return _0x670a5;}return null;})['then'](respondWithResult(_0x340fd1,null))[_0x905c('0x30')](handleError(_0x340fd1,null));};var interaction_log=require(_0x905c('0x5d'))('fax-interactions');exports[_0x905c('0x38')]=function(_0x1093be,_0x11ffb8,_0x159181){var _0x2cd846={'agent':{},'channel':'fax'};if(_0x1093be['body']['id']){delete _0x1093be[_0x905c('0x5a')]['id'];}_0x1093be['body']['UserId']=_0x1093be['body'][_0x905c('0x64')]||_0x1093be['user']['id'];_0x2cd846[_0x905c('0x77')]['id']=_0x1093be[_0x905c('0x5a')][_0x905c('0x64')];return db['FaxMessage'][_0x905c('0x59')]({'where':{'id':_0x1093be[_0x905c('0x5b')]['id'],'UserId':null}})[_0x905c('0x26')](handleEntityNotFound(_0x11ffb8,null))[_0x905c('0x26')](function(_0x363f21){if(_0x363f21){_0x2cd846[_0x905c('0x2e')]=_0x363f21[_0x905c('0x66')]({'plain':!![]});return db[_0x905c('0x67')][_0x905c('0x59')]({'where':{'id':_0x363f21[_0x905c('0x68')]}});}return null;})[_0x905c('0x26')](handleEntityNotFound(_0x11ffb8,null))[_0x905c('0x26')](function(_0x1f5aec){if(_0x1f5aec){_0x2cd846[_0x905c('0x7d')]=_0x1f5aec[_0x905c('0x66')]({'plain':!![]});interaction_log['info'](_0x905c('0x7e'),_0x1093be['user']['id'],_0x1093be[_0x905c('0x65')][_0x905c('0x3d')],_0x1093be['user'][_0x905c('0x6c')],_0x2cd846[_0x905c('0x7d')]['id'],_0x1093be[_0x905c('0x5a')]?JSON[_0x905c('0x2c')](_0x1093be[_0x905c('0x5a')]):'null');return respondWithRpcPromise(_0x905c('0x7f'),_0x905c('0x80'),_0x2cd846);}return null;})[_0x905c('0x26')](function(_0x47a130){var _0x2385ea='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x47a130[_0x905c('0x2e')][_0x905c('0x70')];return db[_0x905c('0x71')][_0x905c('0x47')](_0x2385ea,{'type':db[_0x905c('0x72')][_0x905c('0x73')][_0x905c('0x74')],'raw':!![]})[_0x905c('0x26')](function(_0x21d49b){return _0x21d49b;});})[_0x905c('0x26')](function(_0x3ff3c3){if(_0x3ff3c3){_0x2cd846[_0x905c('0x2e')]['contact']=_0x3ff3c3[0x0];if(!_0x1093be[_0x905c('0x5a')][_0x905c('0x64')])return;return db[_0x905c('0x76')][_0x905c('0x59')]({'where':{'id':_0x1093be[_0x905c('0x5a')][_0x905c('0x64')],'role':_0x905c('0x77')},'attributes':['id',_0x905c('0x3d'),_0x905c('0x78'),_0x905c('0x81'),'internal'],'raw':!![]});}return null;})[_0x905c('0x26')](function(_0x304097){if(!_0x304097)return null;_0x2cd846[_0x905c('0x2e')]['agent']=_0x304097;return _0x2cd846;})['then'](function(_0x4fba5d){if(_0x4fba5d){_0x4fba5d[_0x905c('0x2e')]['interface']=util['format'](_0x905c('0x82'),_0x1093be[_0x905c('0x65')][_0x905c('0x3d')]);_0x4fba5d[_0x905c('0x2e')]['channel']=_0x2cd846[_0x905c('0x83')];_0x4fba5d[_0x905c('0x2e')]['event']='reject';respondWithRpcPromise('EventManager','EventManager',{'event':_0x905c('0x84'),'message':_0x4fba5d['message']},client9002);return _0x2cd846;}return null;})[_0x905c('0x26')](respondWithResult(_0x11ffb8,null))['catch'](handleError(_0x11ffb8,null));};exports[_0x905c('0x85')]=function(_0x4a7bdb,_0x2bbf09){var _0x4e0e3b;return db[_0x905c('0x40')][_0x905c('0x85')](_0x4a7bdb[_0x905c('0x5a')],{})[_0x905c('0x26')](function(_0x5d3734){_0x4e0e3b=_0x5d3734;return db[_0x905c('0x86')]['findOne']({'where':{'id':_0x4e0e3b[_0x905c('0x70')]}});})[_0x905c('0x26')](function(_0x2519ec){if(_[_0x905c('0x69')](_0x2519ec)){return;}else{_0x4e0e3b[_0x905c('0x60')]=_0x2519ec[_0x905c('0x60')];return db[_0x905c('0x87')][_0x905c('0x88')]({'where':{'id':_0x4e0e3b[_0x905c('0x89')]}});}})['then'](function(_0x1ab256){return respondWithRpcPromise('SendFax',_0x905c('0x8a'),{'FaxAccountId':_[_0x905c('0x69')](_0x4a7bdb[_0x905c('0x5a')])?undefined:_0x4a7bdb[_0x905c('0x5a')][_0x905c('0x8b')],'path':_['isNil'](_0x1ab256)?undefined:util[_0x905c('0x6a')](_0x905c('0x8c'),_0x1ab256[_0x905c('0x8d')]),'fax':_[_0x905c('0x69')](_0x4e0e3b['fax'])?undefined:_0x4e0e3b[_0x905c('0x60')],'AttachmentId':_0x4e0e3b[_0x905c('0x89')]},client9002);})[_0x905c('0x26')](respondWithResult(_0x2bbf09,0xc9))[_0x905c('0x30')](handleError(_0x2bbf09,null));};exports[_0x905c('0x8e')]=function(_0xf3e4e2,_0x595b2c){var _0x324f8d=path[_0x905c('0x8f')](config[_0x905c('0x90')],_0x905c('0x91'),'files',_0x905c('0x92'));return db[_0x905c('0x40')][_0x905c('0x59')]({'where':{'id':_0xf3e4e2[_0x905c('0x5b')]['id']},'include':[{'model':db[_0x905c('0x87')],'as':_0x905c('0x87')}]})[_0x905c('0x26')](handleEntityNotFound(_0x595b2c,null))[_0x905c('0x26')](function(_0x52a73f){if(_0x52a73f){return _0x595b2c['download'](path[_0x905c('0x8f')](_0x324f8d,_0x52a73f['Attachment']['basename']));}})[_0x905c('0x30')](handleError(_0x595b2c,null));}; \ No newline at end of file +var _0x7835=['sort','where','filters','type','VIRTUAL','merge','options','includeAll','include','rows','catch','show','params','keys','find','update','body','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','contact','User','manual','interface','SIP/%s','event','EventManager','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','sequelize','SELECT','fullname','email','channel','rejectmessage','CmContact','Attachment','findOne','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','download','root','server','files','attachments','basename','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','FaxMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','info','result','sendStatus','end','status','offset','undefined','count','limit','Content-Range','json','apply','reject','save','destroy','stack','name','index','map','FaxMessage','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order'];(function(_0x3e3064,_0x3dd6f5){var _0x4547e1=function(_0x785d07){while(--_0x785d07){_0x3e3064['push'](_0x3e3064['shift']());}};_0x4547e1(++_0x3dd6f5);}(_0x7835,0xd1));var _0x5783=function(_0x3dcf93,_0x32e737){_0x3dcf93=_0x3dcf93-0x0;var _0x5df323=_0x7835[_0x3dcf93];return _0x5df323;};'use strict';var emlformat=require(_0x5783('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5783('0x1'));var jsonpatch=require(_0x5783('0x2'));var rp=require(_0x5783('0x3'));var moment=require(_0x5783('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x5783('0x5'));var util=require(_0x5783('0x6'));var path=require('path');var sox=require(_0x5783('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5783('0x8'));var _=require(_0x5783('0x9'));var squel=require(_0x5783('0xa'));var crypto=require(_0x5783('0xb'));var jsforce=require(_0x5783('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x5783('0xd'));var querystring=require(_0x5783('0xe'));var Papa=require(_0x5783('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x5783('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5783('0x11'));var logger=require(_0x5783('0x12'))(_0x5783('0x13'));var utils=require(_0x5783('0x14'));var config=require(_0x5783('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x5783('0x16'))['db'];config[_0x5783('0x17')]=_[_0x5783('0x18')](config[_0x5783('0x17')],{'host':_0x5783('0x19'),'port':0x18eb});var socket=require(_0x5783('0x1a'))(new Redis(config['redis']));require('./faxMessage.socket')[_0x5783('0x1b')](socket);var jayson=require(_0x5783('0x1c'));var client=jayson[_0x5783('0x1d')][_0x5783('0x1e')]({'port':0x232c});var client9002=jayson[_0x5783('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4f090c,_0x1d5945,_0x3aa9d7,_0x524692){return new BPromise(function(_0x22e30a,_0x200eb1){var _0x48a21f=_0x524692||client;return _0x48a21f[_0x5783('0x1f')](_0x4f090c,_0x3aa9d7)[_0x5783('0x20')](function(_0x1a1004){logger['info'](_0x5783('0x21'),_0x1d5945,'request\x20sent');logger[_0x5783('0x22')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x1d5945,_0x5783('0x23'),JSON[_0x5783('0x24')](_0x1a1004));if(_0x1a1004['error']){if(_0x1a1004[_0x5783('0x25')]['code']===0x1f4){logger['error'](_0x5783('0x21'),_0x1d5945,_0x1a1004[_0x5783('0x25')][_0x5783('0x26')]);return _0x200eb1(_0x1a1004[_0x5783('0x25')][_0x5783('0x26')]);}logger[_0x5783('0x25')]('FaxMessage,\x20%s,\x20%s',_0x1d5945,_0x1a1004[_0x5783('0x25')][_0x5783('0x26')]);return _0x22e30a(_0x1a1004[_0x5783('0x25')][_0x5783('0x26')]);}else{logger[_0x5783('0x27')](_0x5783('0x21'),_0x1d5945,_0x5783('0x23'));_0x22e30a(_0x1a1004[_0x5783('0x28')][_0x5783('0x26')]);}})['catch'](function(_0x1236a1){logger[_0x5783('0x25')](_0x5783('0x21'),_0x1d5945,_0x1236a1);_0x200eb1(_0x1236a1);});});}function respondWithStatusCode(_0x28162b,_0x442924){_0x442924=_0x442924||0xcc;return function(_0x3faef7){if(_0x3faef7){return _0x28162b[_0x5783('0x29')](_0x442924);}return _0x28162b['status'](_0x442924)[_0x5783('0x2a')]();};}function respondWithResult(_0x2e21e4,_0x19b6b4){_0x19b6b4=_0x19b6b4||0xc8;return function(_0x4ffdb6){if(_0x4ffdb6){return _0x2e21e4[_0x5783('0x2b')](_0x19b6b4)['json'](_0x4ffdb6);}};}function respondWithFilteredResult(_0x14133c,_0xff4a0){return function(_0x24218d){if(_0x24218d){var _0xd844be=typeof _0xff4a0[_0x5783('0x2c')]===_0x5783('0x2d')&&typeof _0xff4a0['limit']===_0x5783('0x2d');var _0x55b2d4=_0x24218d['count'];var _0x33a10a=_0xd844be?0x0:_0xff4a0[_0x5783('0x2c')];var _0x4f105c=_0xd844be?_0x24218d[_0x5783('0x2e')]:_0xff4a0[_0x5783('0x2c')]+_0xff4a0[_0x5783('0x2f')];var _0x479e16;if(_0x4f105c>=_0x55b2d4){_0x4f105c=_0x55b2d4;_0x479e16=0xc8;}else{_0x479e16=0xce;}_0x14133c['status'](_0x479e16);return _0x14133c['set'](_0x5783('0x30'),_0x33a10a+'-'+_0x4f105c+'/'+_0x55b2d4)[_0x5783('0x31')](_0x24218d);}return null;};}function patchUpdates(_0x26f5fb){return function(_0x504476){try{jsonpatch[_0x5783('0x32')](_0x504476,_0x26f5fb,!![]);}catch(_0x1baeaf){return BPromise[_0x5783('0x33')](_0x1baeaf);}return _0x504476[_0x5783('0x34')]();};}function saveUpdates(_0x2d520c,_0x2712b1){return function(_0x12f057){if(_0x12f057){return _0x12f057['update'](_0x2d520c)[_0x5783('0x20')](function(_0x5b9619){return _0x5b9619;});}return null;};}function removeEntity(_0xc3137c,_0xea64a){return function(_0x2e5636){if(_0x2e5636){return _0x2e5636[_0x5783('0x35')]()[_0x5783('0x20')](function(){_0xc3137c[_0x5783('0x2b')](0xcc)[_0x5783('0x2a')]();});}};}function handleEntityNotFound(_0x1ada99,_0x29879d){return function(_0x1a936e){if(!_0x1a936e){_0x1ada99[_0x5783('0x29')](0x194);}return _0x1a936e;};}function handleError(_0x167205,_0x9480de){_0x9480de=_0x9480de||0x1f4;return function(_0x2f7d91){logger[_0x5783('0x25')](_0x2f7d91[_0x5783('0x36')]);if(_0x2f7d91[_0x5783('0x37')]){delete _0x2f7d91[_0x5783('0x37')];}_0x167205[_0x5783('0x2b')](_0x9480de)['send'](_0x2f7d91);};}exports[_0x5783('0x38')]=function(_0x2d2f6f,_0x1f9254){var _0xf0e980={},_0x9abfe0={},_0x45f793={'count':0x0,'rows':[]};var _0x1d5bdb=_[_0x5783('0x39')](db[_0x5783('0x3a')][_0x5783('0x3b')],function(_0x4c4bbb){return{'name':_0x4c4bbb[_0x5783('0x3c')],'type':_0x4c4bbb['type'][_0x5783('0x3d')]};});_0x9abfe0[_0x5783('0x3e')]=_[_0x5783('0x39')](_0x1d5bdb,_0x5783('0x37'));_0x9abfe0[_0x5783('0x3f')]=_['keys'](_0x2d2f6f[_0x5783('0x3f')]);_0x9abfe0['filters']=_[_0x5783('0x40')](_0x9abfe0[_0x5783('0x3e')],_0x9abfe0[_0x5783('0x3f')]);_0xf0e980[_0x5783('0x41')]=_[_0x5783('0x40')](_0x9abfe0[_0x5783('0x3e')],qs[_0x5783('0x42')](_0x2d2f6f[_0x5783('0x3f')][_0x5783('0x42')]));_0xf0e980['attributes']=_0xf0e980[_0x5783('0x41')][_0x5783('0x43')]?_0xf0e980[_0x5783('0x41')]:_0x9abfe0[_0x5783('0x3e')];if(!_0x2d2f6f[_0x5783('0x3f')][_0x5783('0x44')](_0x5783('0x45'))){_0xf0e980[_0x5783('0x2f')]=qs['limit'](_0x2d2f6f['query']['limit']);_0xf0e980[_0x5783('0x2c')]=qs[_0x5783('0x2c')](_0x2d2f6f[_0x5783('0x3f')]['offset']);}_0xf0e980[_0x5783('0x46')]=qs['sort'](_0x2d2f6f[_0x5783('0x3f')][_0x5783('0x47')]);_0xf0e980[_0x5783('0x48')]=qs[_0x5783('0x49')](_['pick'](_0x2d2f6f[_0x5783('0x3f')],_0x9abfe0['filters']),_0x1d5bdb);if(_0x2d2f6f['query']['filter']){_0xf0e980[_0x5783('0x48')]=_['merge'](_0xf0e980[_0x5783('0x48')],{'$or':_[_0x5783('0x39')](_0x1d5bdb,function(_0x99739){if(_0x99739[_0x5783('0x4a')]!==_0x5783('0x4b')){var _0x33e48d={};_0x33e48d[_0x99739[_0x5783('0x37')]]={'$like':'%'+_0x2d2f6f[_0x5783('0x3f')]['filter']+'%'};return _0x33e48d;}})});}_0xf0e980=_[_0x5783('0x4c')]({},_0xf0e980,_0x2d2f6f[_0x5783('0x4d')]);var _0xe7b27d={'where':_0xf0e980[_0x5783('0x48')]};return db['FaxMessage'][_0x5783('0x2e')](_0xe7b27d)[_0x5783('0x20')](function(_0x176870){_0x45f793[_0x5783('0x2e')]=_0x176870;if(_0x2d2f6f['query'][_0x5783('0x4e')]){_0xf0e980[_0x5783('0x4f')]=[{'all':!![]}];}return db[_0x5783('0x3a')]['findAll'](_0xf0e980);})[_0x5783('0x20')](function(_0x13c898){_0x45f793[_0x5783('0x50')]=_0x13c898;return _0x45f793;})[_0x5783('0x20')](respondWithFilteredResult(_0x1f9254,_0xf0e980))[_0x5783('0x51')](handleError(_0x1f9254,null));};exports[_0x5783('0x52')]=function(_0x5b70f8,_0x2be8fb){var _0x3a7886={'raw':!![],'where':{'id':_0x5b70f8[_0x5783('0x53')]['id']}},_0x3e026d={};_0x3e026d[_0x5783('0x3e')]=_[_0x5783('0x54')](db[_0x5783('0x3a')]['rawAttributes']);_0x3e026d[_0x5783('0x3f')]=_[_0x5783('0x54')](_0x5b70f8['query']);_0x3e026d[_0x5783('0x49')]=_['intersection'](_0x3e026d[_0x5783('0x3e')],_0x3e026d[_0x5783('0x3f')]);_0x3a7886[_0x5783('0x41')]=_['intersection'](_0x3e026d['model'],qs[_0x5783('0x42')](_0x5b70f8['query'][_0x5783('0x42')]));_0x3a7886[_0x5783('0x41')]=_0x3a7886[_0x5783('0x41')][_0x5783('0x43')]?_0x3a7886['attributes']:_0x3e026d[_0x5783('0x3e')];if(_0x5b70f8[_0x5783('0x3f')][_0x5783('0x4e')]){_0x3a7886[_0x5783('0x4f')]=[{'all':!![]}];}_0x3a7886=_[_0x5783('0x4c')]({},_0x3a7886,_0x5b70f8[_0x5783('0x4d')]);return db[_0x5783('0x3a')][_0x5783('0x55')](_0x3a7886)[_0x5783('0x20')](handleEntityNotFound(_0x2be8fb,null))[_0x5783('0x20')](respondWithResult(_0x2be8fb,null))[_0x5783('0x51')](handleError(_0x2be8fb,null));};exports[_0x5783('0x56')]=function(_0x2606b2,_0x513968){if(_0x2606b2[_0x5783('0x57')]['id']){delete _0x2606b2['body']['id'];}return db[_0x5783('0x3a')][_0x5783('0x55')]({'where':{'id':_0x2606b2['params']['id']}})[_0x5783('0x20')](handleEntityNotFound(_0x513968,null))['then'](saveUpdates(_0x2606b2['body'],null))[_0x5783('0x20')](respondWithResult(_0x513968,null))['catch'](handleError(_0x513968,null));};exports['destroy']=function(_0x15cf9c,_0x1e600c){return db[_0x5783('0x3a')][_0x5783('0x55')]({'where':{'id':_0x15cf9c[_0x5783('0x53')]['id']}})['then'](handleEntityNotFound(_0x1e600c,null))['then'](removeEntity(_0x1e600c,null))[_0x5783('0x51')](handleError(_0x1e600c,null));};exports[_0x5783('0x58')]=function(_0x186408,_0x3fd65b){return db[_0x5783('0x3a')][_0x5783('0x58')]()[_0x5783('0x20')](respondWithResult(_0x3fd65b,null))[_0x5783('0x51')](handleError(_0x3fd65b,null));};var interaction_log=require(_0x5783('0x12'))(_0x5783('0x59'));exports[_0x5783('0x5a')]=function(_0x159e68,_0x1813e7,_0x3f70a4){var _0x4e92fe={'agent':{},'channel':_0x5783('0x5b')};if(_0x159e68[_0x5783('0x57')]['id']){delete _0x159e68[_0x5783('0x57')]['id'];}_0x159e68[_0x5783('0x57')][_0x5783('0x5c')]=!![];_0x159e68[_0x5783('0x57')][_0x5783('0x5d')]=moment()[_0x5783('0x5e')](_0x5783('0x5f'));_0x159e68[_0x5783('0x57')][_0x5783('0x60')]=_0x159e68[_0x5783('0x57')][_0x5783('0x60')]||_0x159e68[_0x5783('0x61')]['id'];_0x4e92fe[_0x5783('0x62')]['id']=_0x159e68[_0x5783('0x57')]['UserId'];return db[_0x5783('0x3a')][_0x5783('0x55')]({'where':{'id':_0x159e68[_0x5783('0x53')]['id'],'UserId':null}})[_0x5783('0x20')](handleEntityNotFound(_0x1813e7,null))['then'](saveUpdates(_0x159e68[_0x5783('0x57')],null))[_0x5783('0x20')](function(_0x19f662){if(_0x19f662){_0x4e92fe[_0x5783('0x26')]=_0x19f662[_0x5783('0x63')]({'plain':!![]});return db[_0x5783('0x64')][_0x5783('0x55')]({'where':{'id':_0x19f662[_0x5783('0x65')]}});}return null;})[_0x5783('0x20')](handleEntityNotFound(_0x1813e7,null))['then'](function(_0x198fd8){if(_0x198fd8){return _0x198fd8['update']({'UserId':_0x159e68['body']['UserId'],'read1stAt':_[_0x5783('0x66')](_0x198fd8['read1stAt'])?moment()[_0x5783('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})['then'](function(_0x4d246e){if(_0x4d246e){_0x4e92fe[_0x5783('0x67')]=_0x4d246e[_0x5783('0x63')]({'plain':!![]});interaction_log[_0x5783('0x27')](_0x5783('0x68'),_0x159e68['user']['id'],_0x159e68[_0x5783('0x61')][_0x5783('0x37')],_0x159e68[_0x5783('0x61')]['role'],_0x4e92fe[_0x5783('0x67')]['id'],_0x159e68[_0x5783('0x57')]?JSON[_0x5783('0x24')](_0x159e68[_0x5783('0x57')]):_0x5783('0x69'));return respondWithRpcPromise(_0x5783('0x6a'),_0x5783('0x6b'),_0x4e92fe);}return null;})['then'](function(_0x56322c){var _0x2417b8=_0x5783('0x6c')+_0x56322c[_0x5783('0x26')][_0x5783('0x6d')];return db['sequelize'][_0x5783('0x3f')](_0x2417b8,{'type':db[_0x5783('0x6e')][_0x5783('0x6f')]['SELECT'],'raw':!![]})[_0x5783('0x20')](function(_0x2a4f5a){return _0x2a4f5a;});})[_0x5783('0x20')](function(_0xe52367){if(_0xe52367){_0x4e92fe['message'][_0x5783('0x70')]=_0xe52367[0x0];if(!_0x159e68[_0x5783('0x57')]['UserId'])return;return db[_0x5783('0x71')]['find']({'where':{'id':_0x159e68[_0x5783('0x57')][_0x5783('0x60')],'role':_0x5783('0x62')},'attributes':['id','name','fullname','email','internal'],'raw':!![]});}return null;})[_0x5783('0x20')](function(_0x13f97e){if(!_0x13f97e)return null;_0x4e92fe[_0x5783('0x26')][_0x5783('0x62')]=_0x13f97e;return _0x4e92fe;})['then'](function(_0x11fa63){if(_0x11fa63){if(_0x159e68[_0x5783('0x57')][_0x5783('0x72')]){_0x4e92fe[_0x5783('0x26')][_0x5783('0x73')]=util['format'](_0x5783('0x74'),_0x159e68[_0x5783('0x61')]['name']);_0x4e92fe[_0x5783('0x26')]['channel']=_0x4e92fe['channel'];_0x4e92fe['message'][_0x5783('0x75')]='accept';return respondWithRpcPromise(_0x5783('0x76'),'EventManager',{'event':'acceptmessage','message':_0x4e92fe[_0x5783('0x26')]},client9002)[_0x5783('0x20')](function(){return _0x4e92fe;});}return _0x4e92fe;}return null;})['then'](respondWithResult(_0x1813e7,null))['catch'](handleError(_0x1813e7,null));};var interaction_log=require(_0x5783('0x12'))('fax-interactions');exports[_0x5783('0x33')]=function(_0x4a9c98,_0x243035,_0x331d4b){var _0x2b40ae={'agent':{},'channel':_0x5783('0x5b')};if(_0x4a9c98[_0x5783('0x57')]['id']){delete _0x4a9c98[_0x5783('0x57')]['id'];}_0x4a9c98[_0x5783('0x57')][_0x5783('0x60')]=_0x4a9c98[_0x5783('0x57')][_0x5783('0x60')]||_0x4a9c98[_0x5783('0x61')]['id'];_0x2b40ae[_0x5783('0x62')]['id']=_0x4a9c98['body'][_0x5783('0x60')];return db[_0x5783('0x3a')][_0x5783('0x55')]({'where':{'id':_0x4a9c98['params']['id'],'UserId':null}})[_0x5783('0x20')](handleEntityNotFound(_0x243035,null))['then'](function(_0x3bd342){if(_0x3bd342){_0x2b40ae[_0x5783('0x26')]=_0x3bd342['get']({'plain':!![]});return db['FaxInteraction'][_0x5783('0x55')]({'where':{'id':_0x3bd342[_0x5783('0x65')]}});}return null;})[_0x5783('0x20')](handleEntityNotFound(_0x243035,null))['then'](function(_0x2b182d){if(_0x2b182d){_0x2b40ae[_0x5783('0x67')]=_0x2b182d['get']({'plain':!![]});interaction_log[_0x5783('0x27')](_0x5783('0x77'),_0x4a9c98['user']['id'],_0x4a9c98[_0x5783('0x61')][_0x5783('0x37')],_0x4a9c98['user']['role'],_0x2b40ae['interaction']['id'],_0x4a9c98[_0x5783('0x57')]?JSON['stringify'](_0x4a9c98[_0x5783('0x57')]):_0x5783('0x69'));return respondWithRpcPromise('RejectMessage',_0x5783('0x78'),_0x2b40ae);}return null;})[_0x5783('0x20')](function(_0x2dfa8b){var _0x138de5=_0x5783('0x6c')+_0x2dfa8b[_0x5783('0x26')][_0x5783('0x6d')];return db[_0x5783('0x79')][_0x5783('0x3f')](_0x138de5,{'type':db[_0x5783('0x6e')][_0x5783('0x6f')][_0x5783('0x7a')],'raw':!![]})['then'](function(_0x2e2472){return _0x2e2472;});})[_0x5783('0x20')](function(_0x1861f9){if(_0x1861f9){_0x2b40ae[_0x5783('0x26')][_0x5783('0x70')]=_0x1861f9[0x0];if(!_0x4a9c98[_0x5783('0x57')][_0x5783('0x60')])return;return db[_0x5783('0x71')][_0x5783('0x55')]({'where':{'id':_0x4a9c98['body']['UserId'],'role':_0x5783('0x62')},'attributes':['id',_0x5783('0x37'),_0x5783('0x7b'),_0x5783('0x7c'),'internal'],'raw':!![]});}return null;})[_0x5783('0x20')](function(_0x1c224e){if(!_0x1c224e)return null;_0x2b40ae['message'][_0x5783('0x62')]=_0x1c224e;return _0x2b40ae;})[_0x5783('0x20')](function(_0x260f11){if(_0x260f11){_0x260f11[_0x5783('0x26')]['interface']=util[_0x5783('0x5e')](_0x5783('0x74'),_0x4a9c98['user']['name']);_0x260f11['message'][_0x5783('0x7d')]=_0x2b40ae[_0x5783('0x7d')];_0x260f11['message']['event']=_0x5783('0x33');respondWithRpcPromise('EventManager',_0x5783('0x76'),{'event':_0x5783('0x7e'),'message':_0x260f11[_0x5783('0x26')]},client9002);return _0x2b40ae;}return null;})[_0x5783('0x20')](respondWithResult(_0x243035,null))['catch'](handleError(_0x243035,null));};exports['create']=function(_0x218d75,_0x30e84c){var _0x1d88a8;return db[_0x5783('0x3a')]['create'](_0x218d75[_0x5783('0x57')],{})[_0x5783('0x20')](function(_0x5a23ed){_0x1d88a8=_0x5a23ed;return db[_0x5783('0x7f')]['findOne']({'where':{'id':_0x1d88a8['ContactId']}});})[_0x5783('0x20')](function(_0x57d597){if(_[_0x5783('0x66')](_0x57d597)){return;}else{_0x1d88a8['fax']=_0x57d597[_0x5783('0x5b')];return db[_0x5783('0x80')][_0x5783('0x81')]({'where':{'id':_0x1d88a8[_0x5783('0x82')]}});}})['then'](function(_0x1a4cba){return respondWithRpcPromise(_0x5783('0x83'),_0x5783('0x83'),{'FaxAccountId':_[_0x5783('0x66')](_0x218d75['body'])?undefined:_0x218d75[_0x5783('0x57')][_0x5783('0x84')],'path':_[_0x5783('0x66')](_0x1a4cba)?undefined:util['format'](_0x5783('0x85'),_0x1a4cba['basename']),'fax':_[_0x5783('0x66')](_0x1d88a8['fax'])?undefined:_0x1d88a8['fax'],'AttachmentId':_0x1d88a8['AttachmentId']},client9002);})[_0x5783('0x20')](respondWithResult(_0x30e84c,0xc9))[_0x5783('0x51')](handleError(_0x30e84c,null));};exports[_0x5783('0x86')]=function(_0x10cb90,_0xd4660a){var _0x37ef8d=path['join'](config[_0x5783('0x87')],_0x5783('0x88'),_0x5783('0x89'),_0x5783('0x8a'));return db[_0x5783('0x3a')][_0x5783('0x55')]({'where':{'id':_0x10cb90[_0x5783('0x53')]['id']},'include':[{'model':db[_0x5783('0x80')],'as':_0x5783('0x80')}]})[_0x5783('0x20')](handleEntityNotFound(_0xd4660a,null))['then'](function(_0x4f5ada){if(_0x4f5ada){return _0xd4660a[_0x5783('0x86')](path['join'](_0x37ef8d,_0x4f5ada['Attachment'][_0x5783('0x8b')]));}})['catch'](handleError(_0xd4660a,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index e8acba1..156c962 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 _0x5419=['../../mysqldb','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x1dfea2,_0x1504c1){var _0x432cb7=function(_0x3c2fdd){while(--_0x3c2fdd){_0x1dfea2['push'](_0x1dfea2['shift']());}};_0x432cb7(++_0x1504c1);}(_0x5419,0x175));var _0x9541=function(_0x251530,_0x1211a4){_0x251530=_0x251530-0x0;var _0x4b0683=_0x5419[_0x251530];return _0x4b0683;};'use strict';var EventEmitter=require(_0x9541('0x0'));var FaxMessage=require(_0x9541('0x1'))['db'][_0x9541('0x2')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x9541('0x3')](0x0);var events={'afterCreate':_0x9541('0x4'),'afterUpdate':_0x9541('0x5'),'afterDestroy':_0x9541('0x6')};function emitEvent(_0x317e1e){return function(_0x307a35,_0xacdcfa,_0x4d8224){FaxMessageEvents[_0x9541('0x7')](_0x317e1e+':'+_0x307a35['id'],_0x307a35);FaxMessageEvents[_0x9541('0x7')](_0x317e1e,_0x307a35);_0x4d8224(null);};}for(var e in events){if(events[_0x9541('0x8')](e)){var event=events[e];FaxMessage[_0x9541('0x9')](e,emitEvent(event));}}module[_0x9541('0xa')]=FaxMessageEvents; \ No newline at end of file +var _0xed1f=['events','../../mysqldb','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed1f,0x170));var _0xfed1=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0xed1f[_0x368fb9];return _0x4892fb;};'use strict';var EventEmitter=require(_0xfed1('0x0'));var FaxMessage=require(_0xfed1('0x1'))['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfed1('0x2'),'afterUpdate':'update','afterDestroy':_0xfed1('0x3')};function emitEvent(_0x501da6){return function(_0x444ba8,_0x423af3,_0x198341){FaxMessageEvents[_0xfed1('0x4')](_0x501da6+':'+_0x444ba8['id'],_0x444ba8);FaxMessageEvents[_0xfed1('0x4')](_0x501da6,_0x444ba8);_0x198341(null);};}for(var e in events){if(events[_0xfed1('0x5')](e)){var event=events[e];FaxMessage[_0xfed1('0x6')](e,emitEvent(event));}}module[_0xfed1('0x7')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index e6f9f9a..9716adc 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 _0x3ee9=['path','rimraf','./faxMessage.attributes','define','fax_messages','fti_fax_messages','FULLTEXT','get','direction','toLowerCase','out','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','api','moment','bluebird','request-promise'];(function(_0xb74b87,_0x5b85cc){var _0x18d5de=function(_0x4939b1){while(--_0x4939b1){_0xb74b87['push'](_0xb74b87['shift']());}};_0x18d5de(++_0x5b85cc);}(_0x3ee9,0xef));var _0x93ee=function(_0x4cff6a,_0x5c396d){_0x4cff6a=_0x4cff6a-0x0;var _0x528b6a=_0x3ee9[_0x4cff6a];return _0x528b6a;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x93ee('0x0'));var moment=require(_0x93ee('0x1'));var BPromise=require(_0x93ee('0x2'));var rp=require(_0x93ee('0x3'));var fs=require('fs');var path=require(_0x93ee('0x4'));var rimraf=require(_0x93ee('0x5'));var config=require('../../config/environment');var attributes=require(_0x93ee('0x6'));module['exports']=function(_0x24db82,_0x482f02){return _0x24db82[_0x93ee('0x7')]('FaxMessage',attributes,{'tableName':_0x93ee('0x8'),'paranoid':![],'indexes':[{'name':_0x93ee('0x9'),'fields':['body'],'type':_0x93ee('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x19ed4d,_0x29ebdc,_0x2c1d9e){var _0x130f35=_0x24db82['models'];var _0x2df7fc=_0x19ed4d[_0x93ee('0xb')]({'plain':!![]});if(_0x2df7fc[_0x93ee('0xc')][_0x93ee('0xd')]()==='in'||_0x2df7fc[_0x93ee('0xc')][_0x93ee('0xd')]()===_0x93ee('0xe')&&!_0x2df7fc['secret']&&!_[_0x93ee('0xf')](_0x2df7fc[_0x93ee('0x10')])){_0x130f35[_0x93ee('0x11')][_0x93ee('0x12')]({'where':{'id':_0x2df7fc[_0x93ee('0x13')]}})[_0x93ee('0x14')](function(_0x293f14){if(_0x293f14){_0x293f14[_0x93ee('0x15')]({'lastMsgAt':_0x2df7fc[_0x93ee('0x16')],'lastMsgDirection':_0x2df7fc[_0x93ee('0xc')]['toLowerCase']()});}})[_0x93ee('0x17')](function(_0x844b76){console[_0x93ee('0x18')](_0x844b76);});}_0x2c1d9e();}},'charset':_0x93ee('0x19'),'collate':_0x93ee('0x1a')});}; \ No newline at end of file +var _0xbe91=['lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxMessage.attributes','exports','define','FaxMessage','fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','update','catch','error','utf8mb4_unicode_ci'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xbe91,0x105));var _0x1be9=function(_0x145d6f,_0x4b6750){_0x145d6f=_0x145d6f-0x0;var _0x108d53=_0xbe91[_0x145d6f];return _0x108d53;};'use strict';var _=require(_0x1be9('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1be9('0x1'));var moment=require(_0x1be9('0x2'));var BPromise=require(_0x1be9('0x3'));var rp=require(_0x1be9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1be9('0x5'));var config=require(_0x1be9('0x6'));var attributes=require(_0x1be9('0x7'));module[_0x1be9('0x8')]=function(_0x54a870,_0x546706){return _0x54a870[_0x1be9('0x9')](_0x1be9('0xa'),attributes,{'tableName':_0x1be9('0xb'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':[_0x1be9('0xc')],'type':_0x1be9('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x31b7e2,_0x3ccd28,_0x5218ab){var _0x4b4158=_0x54a870[_0x1be9('0xe')];var _0x30177b=_0x31b7e2[_0x1be9('0xf')]({'plain':!![]});if(_0x30177b[_0x1be9('0x10')][_0x1be9('0x11')]()==='in'||_0x30177b[_0x1be9('0x10')]['toLowerCase']()===_0x1be9('0x12')&&!_0x30177b[_0x1be9('0x13')]&&!_[_0x1be9('0x14')](_0x30177b[_0x1be9('0x15')])){_0x4b4158[_0x1be9('0x16')][_0x1be9('0x17')]({'where':{'id':_0x30177b[_0x1be9('0x18')]}})['then'](function(_0x5d9224){if(_0x5d9224){_0x5d9224[_0x1be9('0x19')]({'lastMsgAt':_0x30177b['createdAt'],'lastMsgDirection':_0x30177b['direction'][_0x1be9('0x11')]()});}})[_0x1be9('0x1a')](function(_0x5cedf4){console[_0x1be9('0x1b')](_0x5cedf4);});}_0x5218ab();}},'charset':'utf8mb4','collate':_0x1be9('0x1c')});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 1679c49..5b7992b 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 _0xb458=['info','result','catch','FaxMessage','create','body','options','then','CreateFaxMessage','update','raw','where','attributes','UpdateFaxMessage','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','redis','defaults','localhost','./faxMessage.socket','register','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x2e4aa2,_0x11956a){var _0x5e6092=function(_0x4c12c2){while(--_0x4c12c2){_0x2e4aa2['push'](_0x2e4aa2['shift']());}};_0x5e6092(++_0x11956a);}(_0xb458,0x103));var _0x8b45=function(_0x59f856,_0x56a0bc){_0x59f856=_0x59f856-0x0;var _0x154d31=_0xb458[_0x59f856];return _0x154d31;};'use strict';var _=require(_0x8b45('0x0'));var util=require(_0x8b45('0x1'));var moment=require(_0x8b45('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8b45('0x3'));var db=require(_0x8b45('0x4'))['db'];var utils=require(_0x8b45('0x5'));var logger=require(_0x8b45('0x6'))('rpc');var config=require(_0x8b45('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8b45('0x8')]({'port':0x232a});config[_0x8b45('0x9')]=_[_0x8b45('0xa')](config[_0x8b45('0x9')],{'host':_0x8b45('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x8b45('0x9')]));require(_0x8b45('0xc'))[_0x8b45('0xd')](socket);function respondWithRpcPromise(_0x2bc809,_0x2f7117,_0x499899){return new BPromise(function(_0x2a4c83,_0x7cc49b){return client['request'](_0x2bc809,_0x499899)['then'](function(_0x5bb708){logger['info'](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));logger[_0x8b45('0x10')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x2f7117,_0x8b45('0xf'),JSON[_0x8b45('0x11')](_0x5bb708));if(_0x5bb708[_0x8b45('0x12')]){if(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x13')]===0x1f4){logger[_0x8b45('0x12')]('FaxMessage,\x20%s,\x20%s',_0x2f7117,_0x5bb708['error'][_0x8b45('0x14')]);return _0x7cc49b(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);return _0x2a4c83(_0x5bb708[_0x8b45('0x12')][_0x8b45('0x14')]);}else{logger[_0x8b45('0x15')](_0x8b45('0xe'),_0x2f7117,_0x8b45('0xf'));_0x2a4c83(_0x5bb708[_0x8b45('0x16')][_0x8b45('0x14')]);}})[_0x8b45('0x17')](function(_0x31c6b4){logger[_0x8b45('0x12')](_0x8b45('0xe'),_0x2f7117,_0x31c6b4);_0x7cc49b(_0x31c6b4);});});}exports['CreateFaxMessage']=function(_0x25e8a1){var _0x2db2d1=this;return new Promise(function(_0x1767d5,_0x46e21a){return db[_0x8b45('0x18')][_0x8b45('0x19')](_0x25e8a1[_0x8b45('0x1a')],{'raw':_0x25e8a1[_0x8b45('0x1b')]?_0x25e8a1['options']['raw']===undefined?!![]:![]:!![]})[_0x8b45('0x1c')](function(_0x580e17){logger[_0x8b45('0x15')](_0x8b45('0x1d'),_0x25e8a1);logger[_0x8b45('0x10')](_0x8b45('0x1d'),_0x25e8a1,JSON[_0x8b45('0x11')](_0x580e17));_0x1767d5(_0x580e17);})[_0x8b45('0x17')](function(_0x32b12b){logger['error']('CreateFaxMessage',_0x32b12b[_0x8b45('0x14')],_0x25e8a1);_0x46e21a(_0x2db2d1[_0x8b45('0x12')](0x1f4,_0x32b12b['message']));});});};exports['UpdateFaxMessage']=function(_0x129c35){var _0x32f6f0=this;return new Promise(function(_0x2ca2d9,_0x2f37bc){return db['FaxMessage'][_0x8b45('0x1e')](_0x129c35[_0x8b45('0x1a')],{'raw':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x20')]||null:null,'attributes':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')][_0x8b45('0x21')]||null:null,'limit':_0x129c35[_0x8b45('0x1b')]?_0x129c35[_0x8b45('0x1b')]['limit']||null:null})[_0x8b45('0x1c')](function(_0x36db96){logger[_0x8b45('0x15')](_0x8b45('0x22'),_0x129c35);logger[_0x8b45('0x10')](_0x8b45('0x22'),_0x129c35,JSON[_0x8b45('0x11')](_0x36db96));_0x2ca2d9(_0x36db96);})[_0x8b45('0x17')](function(_0x5d8938){logger[_0x8b45('0x12')](_0x8b45('0x22'),_0x5d8938[_0x8b45('0x14')],_0x129c35);_0x2f37bc(_0x32f6f0[_0x8b45('0x12')](0x1f4,_0x5d8938[_0x8b45('0x14')]));});});}; \ No newline at end of file +var _0xa8a8=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','request','then','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','FaxMessage','create','body','options','raw','CreateFaxMessage','UpdateFaxMessage','where','attributes','limit','lodash','util','moment','bluebird'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xa8a8,0xec));var _0x8a8a=function(_0x34dcf0,_0x5a81d0){_0x34dcf0=_0x34dcf0-0x0;var _0x273b3a=_0xa8a8[_0x34dcf0];return _0x273b3a;};'use strict';var _=require(_0x8a8a('0x0'));var util=require(_0x8a8a('0x1'));var moment=require(_0x8a8a('0x2'));var BPromise=require(_0x8a8a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8a8a('0x4'));var db=require(_0x8a8a('0x5'))['db'];var utils=require(_0x8a8a('0x6'));var logger=require(_0x8a8a('0x7'))(_0x8a8a('0x8'));var config=require(_0x8a8a('0x9'));var jayson=require(_0x8a8a('0xa'));var client=jayson[_0x8a8a('0xb')][_0x8a8a('0xc')]({'port':0x232a});config[_0x8a8a('0xd')]=_[_0x8a8a('0xe')](config[_0x8a8a('0xd')],{'host':_0x8a8a('0xf'),'port':0x18eb});var socket=require(_0x8a8a('0x10'))(new Redis(config[_0x8a8a('0xd')]));require('./faxMessage.socket')['register'](socket);function respondWithRpcPromise(_0x3c01cd,_0x497b8a,_0x11788d){return new BPromise(function(_0x3d3a00,_0x532621){return client[_0x8a8a('0x11')](_0x3c01cd,_0x11788d)[_0x8a8a('0x12')](function(_0xb13fca){logger['info'](_0x8a8a('0x13'),_0x497b8a,_0x8a8a('0x14'));logger[_0x8a8a('0x15')](_0x8a8a('0x16'),_0x497b8a,'request\x20sent',JSON[_0x8a8a('0x17')](_0xb13fca));if(_0xb13fca['error']){if(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x19')]===0x1f4){logger[_0x8a8a('0x18')](_0x8a8a('0x13'),_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x532621(_0xb13fca[_0x8a8a('0x18')]['message']);}logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);return _0x3d3a00(_0xb13fca[_0x8a8a('0x18')][_0x8a8a('0x1a')]);}else{logger[_0x8a8a('0x1b')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x8a8a('0x14'));_0x3d3a00(_0xb13fca[_0x8a8a('0x1c')][_0x8a8a('0x1a')]);}})[_0x8a8a('0x1d')](function(_0x299827){logger[_0x8a8a('0x18')]('FaxMessage,\x20%s,\x20%s',_0x497b8a,_0x299827);_0x532621(_0x299827);});});}exports['CreateFaxMessage']=function(_0x5181b2){var _0x4e3d0a=this;return new Promise(function(_0x4a6601,_0x3a9b2f){return db[_0x8a8a('0x1e')][_0x8a8a('0x1f')](_0x5181b2[_0x8a8a('0x20')],{'raw':_0x5181b2[_0x8a8a('0x21')]?_0x5181b2[_0x8a8a('0x21')][_0x8a8a('0x22')]===undefined?!![]:![]:!![]})[_0x8a8a('0x12')](function(_0x25d5d4){logger[_0x8a8a('0x1b')](_0x8a8a('0x23'),_0x5181b2);logger[_0x8a8a('0x15')](_0x8a8a('0x23'),_0x5181b2,JSON[_0x8a8a('0x17')](_0x25d5d4));_0x4a6601(_0x25d5d4);})[_0x8a8a('0x1d')](function(_0x545a38){logger[_0x8a8a('0x18')](_0x8a8a('0x23'),_0x545a38[_0x8a8a('0x1a')],_0x5181b2);_0x3a9b2f(_0x4e3d0a[_0x8a8a('0x18')](0x1f4,_0x545a38[_0x8a8a('0x1a')]));});});};exports[_0x8a8a('0x24')]=function(_0x3aa46d){var _0x5f4dcc=this;return new Promise(function(_0x31d21a,_0x38c1e0){return db[_0x8a8a('0x1e')]['update'](_0x3aa46d['body'],{'raw':_0x3aa46d[_0x8a8a('0x21')]?_0x3aa46d[_0x8a8a('0x21')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aa46d['options']?_0x3aa46d['options'][_0x8a8a('0x25')]||null:null,'attributes':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x26')]||null:null,'limit':_0x3aa46d['options']?_0x3aa46d[_0x8a8a('0x21')][_0x8a8a('0x27')]||null:null})[_0x8a8a('0x12')](function(_0x8df0cb){logger[_0x8a8a('0x1b')](_0x8a8a('0x24'),_0x3aa46d);logger[_0x8a8a('0x15')](_0x8a8a('0x24'),_0x3aa46d,JSON['stringify'](_0x8df0cb));_0x31d21a(_0x8df0cb);})['catch'](function(_0x56e79e){logger[_0x8a8a('0x18')](_0x8a8a('0x24'),_0x56e79e['message'],_0x3aa46d);_0x38c1e0(_0x5f4dcc[_0x8a8a('0x18')](0x1f4,_0x56e79e[_0x8a8a('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index eb46e8a..372cb3f 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 _0x2d48=['./faxMessage.events','remove','update','removeListener','register','faxMessage:'];(function(_0x52f4f5,_0x5bd45b){var _0x2bb43c=function(_0xbfa695){while(--_0xbfa695){_0x52f4f5['push'](_0x52f4f5['shift']());}};_0x2bb43c(++_0x5bd45b);}(_0x2d48,0xd2));var _0x82d4=function(_0x1cf9c1,_0x487f27){_0x1cf9c1=_0x1cf9c1-0x0;var _0x197626=_0x2d48[_0x1cf9c1];return _0x197626;};'use strict';var FaxMessageEvents=require(_0x82d4('0x0'));var events=['save',_0x82d4('0x1'),_0x82d4('0x2')];function createListener(_0x2114c1,_0x91446d){return function(_0x3513a1){_0x91446d['emit'](_0x2114c1,_0x3513a1);};}function removeListener(_0x21806d,_0x3c8ff6){return function(){FaxMessageEvents[_0x82d4('0x3')](_0x21806d,_0x3c8ff6);};}exports[_0x82d4('0x4')]=function(_0x3456c0){for(var _0x2f6f43=0x0,_0x1d39e2=events['length'];_0x2f6f43<_0x1d39e2;_0x2f6f43++){var _0x5107b7=events[_0x2f6f43];var _0x5aeae1=createListener(_0x82d4('0x5')+_0x5107b7,_0x3456c0);FaxMessageEvents['on'](_0x5107b7,_0x5aeae1);}}; \ No newline at end of file +var _0xd12d=['./faxMessage.events','save','remove','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd12d,0x138));var _0xdd12=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0xd12d[_0x11005e];return _0x29338f;};'use strict';var FaxMessageEvents=require(_0xdd12('0x0'));var events=[_0xdd12('0x1'),_0xdd12('0x2'),'update'];function createListener(_0x15c1da,_0x5a4756){return function(_0x4c6252){_0x5a4756['emit'](_0x15c1da,_0x4c6252);};}function removeListener(_0x1db6d8,_0x2263e8){return function(){FaxMessageEvents['removeListener'](_0x1db6d8,_0x2263e8);};}exports['register']=function(_0x2c0284){for(var _0x53f85c=0x0,_0x304ecc=events[_0xdd12('0x3')];_0x53f85c<_0x304ecc;_0x53f85c++){var _0x3aaab3=events[_0x53f85c];var _0x7a1758=createListener('faxMessage:'+_0x3aaab3,_0x2c0284);FaxMessageEvents['on'](_0x3aaab3,_0x7a1758);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index 712d7ed..a81243f 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 _0xee5b=['update','/:id/accept','accept','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id'];(function(_0x1db96e,_0x386f7e){var _0xb73073=function(_0x3baef7){while(--_0x3baef7){_0x1db96e['push'](_0x1db96e['shift']());}};_0xb73073(++_0x386f7e);}(_0xee5b,0x1f4));var _0xbee5=function(_0x57530e,_0x425231){_0x57530e=_0x57530e-0x0;var _0x11fd80=_0xee5b[_0x57530e];return _0x11fd80;};'use strict';var multer=require(_0xbee5('0x0'));var util=require('util');var path=require(_0xbee5('0x1'));var timeout=require(_0xbee5('0x2'));var express=require('express');var router=express[_0xbee5('0x3')]();var fs_extra=require(_0xbee5('0x4'));var auth=require(_0xbee5('0x5'));var interaction=require(_0xbee5('0x6'));var config=require('../../config/environment');var controller=require('./faxMessage.controller');router[_0xbee5('0x7')]('/',auth[_0xbee5('0x8')](),controller[_0xbee5('0x9')]);router[_0xbee5('0x7')]('/describe',auth['isAuthenticated'](),controller['describe']);router['get']('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0xa')]);router[_0xbee5('0x7')](_0xbee5('0xb'),auth['isAuthenticated'](),controller[_0xbee5('0xc')]);router[_0xbee5('0xd')]('/',auth[_0xbee5('0x8')](),interaction[_0xbee5('0xe')](_0xbee5('0xf'),_0xbee5('0x10')),controller[_0xbee5('0x11')]);router[_0xbee5('0x12')](_0xbee5('0x13'),auth['isAuthenticated'](),controller[_0xbee5('0x14')]);router['put'](_0xbee5('0x15'),auth[_0xbee5('0x8')](),controller[_0xbee5('0x16')]);router['put']('/:id/reject',auth[_0xbee5('0x8')](),controller['reject']);router[_0xbee5('0x17')]('/:id',auth[_0xbee5('0x8')](),controller[_0xbee5('0x18')]);module[_0xbee5('0x19')]=router; \ No newline at end of file +var _0xa75b=['get','isAuthenticated','index','/describe','show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','/:id','/:id/accept','accept','/:id/reject','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxMessage.controller'];(function(_0x8e8073,_0x440f1e){var _0x425c95=function(_0x66447b){while(--_0x66447b){_0x8e8073['push'](_0x8e8073['shift']());}};_0x425c95(++_0x440f1e);}(_0xa75b,0x170));var _0xba75=function(_0x5f3f81,_0x562137){_0x5f3f81=_0x5f3f81-0x0;var _0x21522b=_0xa75b[_0x5f3f81];return _0x21522b;};'use strict';var multer=require(_0xba75('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xba75('0x1'));var express=require(_0xba75('0x2'));var router=express[_0xba75('0x3')]();var fs_extra=require(_0xba75('0x4'));var auth=require(_0xba75('0x5'));var interaction=require(_0xba75('0x6'));var config=require(_0xba75('0x7'));var controller=require(_0xba75('0x8'));router[_0xba75('0x9')]('/',auth[_0xba75('0xa')](),controller[_0xba75('0xb')]);router[_0xba75('0x9')](_0xba75('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xba75('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xba75('0xd')]);router['get'](_0xba75('0xe'),auth[_0xba75('0xa')](),controller[_0xba75('0xf')]);router[_0xba75('0x10')]('/',auth[_0xba75('0xa')](),interaction[_0xba75('0x11')](_0xba75('0x12'),_0xba75('0x13')),controller[_0xba75('0x14')]);router[_0xba75('0x15')](_0xba75('0x16'),auth[_0xba75('0xa')](),controller['update']);router['put'](_0xba75('0x17'),auth['isAuthenticated'](),controller[_0xba75('0x18')]);router[_0xba75('0x15')](_0xba75('0x19'),auth[_0xba75('0xa')](),controller['reject']);router[_0xba75('0x1a')](_0xba75('0x16'),auth[_0xba75('0xa')](),controller[_0xba75('0x1b')]);module[_0xba75('0x1c')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 92a4e19..7df61d0 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 _0x3eae=['sequelize','exports','STRING','name','INTEGER','ENUM'];(function(_0x1c2314,_0x55d32c){var _0x170827=function(_0x33cd73){while(--_0x33cd73){_0x1c2314['push'](_0x1c2314['shift']());}};_0x170827(++_0x55d32c);}(_0x3eae,0x162));var _0xe3ea=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x3eae[_0x2d4661];return _0x42ed1e;};'use strict';var Sequelize=require(_0xe3ea('0x0'));module[_0xe3ea('0x1')]={'name':{'type':Sequelize[_0xe3ea('0x2')],'unique':_0xe3ea('0x3'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xe3ea('0x4')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe3ea('0x5')]('rrmemory','beepall','roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x4a51=['STRING','INTEGER','rrmemory','beepall','sequelize','exports'];(function(_0x20774a,_0x3113cc){var _0x38de06=function(_0x38eac2){while(--_0x38eac2){_0x20774a['push'](_0x20774a['shift']());}};_0x38de06(++_0x3113cc);}(_0x4a51,0x14e));var _0x14a5=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4a51[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x14a5('0x0'));module[_0x14a5('0x1')]={'name':{'type':Sequelize[_0x14a5('0x2')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x14a5('0x2')]},'timeout':{'type':Sequelize[_0x14a5('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x14a5('0x4'),_0x14a5('0x5'),'roundrobin'),'allowNull':![]},'lastAgent':{'type':Sequelize['INTEGER'],'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 3ed3d96..6222278 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 _0x8142=['params','describe','getMembers','findOne','rawAttributes','nolimit','pick','FaxQueueId','UserFaxQueue','findAndCountAll','UserId','agent','updatedAt','createdAt','%s/%s','SIP','faxPause','getTeams','Team','ids','User','Agents','online','voicePause','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','FaxQueueId\x20=\x20?','clone','push','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then','destroy','get','FaxQueues','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','FaxQueue','includeAll','include','findAll','rows','catch','show','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x5ce6e9,_0x319d0a){var _0xac0a16=function(_0x2b5992){while(--_0x2b5992){_0x5ce6e9['push'](_0x5ce6e9['shift']());}};_0xac0a16(++_0x319d0a);}(_0x8142,0xd0));var _0x2814=function(_0x59ae8f,_0x148344){_0x59ae8f=_0x59ae8f-0x0;var _0x3900b5=_0x8142[_0x59ae8f];return _0x3900b5;};'use strict';var emlformat=require(_0x2814('0x0'));var rimraf=require(_0x2814('0x1'));var zipdir=require(_0x2814('0x2'));var jsonpatch=require(_0x2814('0x3'));var rp=require(_0x2814('0x4'));var moment=require(_0x2814('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x2814('0x6'));var util=require('util');var path=require(_0x2814('0x7'));var sox=require(_0x2814('0x8'));var csv=require(_0x2814('0x9'));var ejs=require(_0x2814('0xa'));var fs=require('fs');var fs_extra=require(_0x2814('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2814('0xc'));var deskjs=require(_0x2814('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2814('0xe'));var Redis=require(_0x2814('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2814('0x10'));var as=require(_0x2814('0x11'));var hardwareService=require(_0x2814('0x12'));var logger=require('../../config/logger')(_0x2814('0x13'));var utils=require('../../config/utils');var config=require(_0x2814('0x14'));var licenseUtil=require(_0x2814('0x15'));var db=require(_0x2814('0x16'))['db'];config[_0x2814('0x17')]=_[_0x2814('0x18')](config[_0x2814('0x17')],{'host':_0x2814('0x19'),'port':0x18eb});var socket=require(_0x2814('0x1a'))(new Redis(config['redis']));require(_0x2814('0x1b'))['register'](socket);function respondWithStatusCode(_0x56e735,_0x1f1f78){_0x1f1f78=_0x1f1f78||0xcc;return function(_0x3032a2){if(_0x3032a2){return _0x56e735[_0x2814('0x1c')](_0x1f1f78);}return _0x56e735['status'](_0x1f1f78)[_0x2814('0x1d')]();};}function respondWithResult(_0x4bc101,_0x26a1a9){_0x26a1a9=_0x26a1a9||0xc8;return function(_0x5dbfa4){if(_0x5dbfa4){return _0x4bc101[_0x2814('0x1e')](_0x26a1a9)[_0x2814('0x1f')](_0x5dbfa4);}};}function respondWithFilteredResult(_0x31746e,_0x10452a){return function(_0x43ecc8){if(_0x43ecc8){var _0x115700=typeof _0x10452a['offset']===_0x2814('0x20')&&typeof _0x10452a[_0x2814('0x21')]===_0x2814('0x20');var _0xf58dd5=_0x43ecc8[_0x2814('0x22')];var _0x5be3ac=_0x115700?0x0:_0x10452a[_0x2814('0x23')];var _0x696b93=_0x115700?_0x43ecc8[_0x2814('0x22')]:_0x10452a['offset']+_0x10452a['limit'];var _0x3b444e;if(_0x696b93>=_0xf58dd5){_0x696b93=_0xf58dd5;_0x3b444e=0xc8;}else{_0x3b444e=0xce;}_0x31746e['status'](_0x3b444e);return _0x31746e[_0x2814('0x24')](_0x2814('0x25'),_0x5be3ac+'-'+_0x696b93+'/'+_0xf58dd5)[_0x2814('0x1f')](_0x43ecc8);}return null;};}function patchUpdates(_0x58169c){return function(_0x1324eb){try{jsonpatch['apply'](_0x1324eb,_0x58169c,!![]);}catch(_0x5981df){return BPromise[_0x2814('0x26')](_0x5981df);}return _0x1324eb[_0x2814('0x27')]();};}function saveUpdates(_0x354681,_0x175685){return function(_0xc4e578){if(_0xc4e578){return _0xc4e578['update'](_0x354681)[_0x2814('0x28')](function(_0x2b0739){return _0x2b0739;});}return null;};}function removeEntity(_0x4bc5db,_0x20be9e){return function(_0x400fb6){if(_0x400fb6){return _0x400fb6[_0x2814('0x29')]()[_0x2814('0x28')](function(){var _0x2624f6=_0x400fb6[_0x2814('0x2a')]({'plain':!![]});var _0x3f1f2c=_0x2814('0x2b');return db[_0x2814('0x2c')][_0x2814('0x29')]({'where':{'type':_0x3f1f2c,'resourceId':_0x2624f6['id']}})[_0x2814('0x28')](function(){return _0x400fb6;});})[_0x2814('0x28')](function(){_0x4bc5db[_0x2814('0x1e')](0xcc)[_0x2814('0x1d')]();});}};}function handleEntityNotFound(_0x8f8e6c,_0xb6eeb8){return function(_0x105b76){if(!_0x105b76){_0x8f8e6c['sendStatus'](0x194);}return _0x105b76;};}function handleError(_0x508fe5,_0x5ad11e){_0x5ad11e=_0x5ad11e||0x1f4;return function(_0x11aeda){logger[_0x2814('0x2d')](_0x11aeda[_0x2814('0x2e')]);if(_0x11aeda[_0x2814('0x2f')]){delete _0x11aeda[_0x2814('0x2f')];}_0x508fe5[_0x2814('0x1e')](_0x5ad11e)[_0x2814('0x30')](_0x11aeda);};}exports['index']=function(_0x1edce2,_0x124c94){var _0x514788={},_0xa2c7d0={},_0x5e42ca={'count':0x0,'rows':[]};var _0xe4ab56=_[_0x2814('0x31')](db['FaxQueue']['rawAttributes'],function(_0x3de7ff){return{'name':_0x3de7ff[_0x2814('0x32')],'type':_0x3de7ff[_0x2814('0x33')][_0x2814('0x34')]};});_0xa2c7d0[_0x2814('0x35')]=_[_0x2814('0x31')](_0xe4ab56,_0x2814('0x2f'));_0xa2c7d0['query']=_['keys'](_0x1edce2[_0x2814('0x36')]);_0xa2c7d0[_0x2814('0x37')]=_[_0x2814('0x38')](_0xa2c7d0[_0x2814('0x35')],_0xa2c7d0[_0x2814('0x36')]);_0x514788[_0x2814('0x39')]=_[_0x2814('0x38')](_0xa2c7d0['model'],qs[_0x2814('0x3a')](_0x1edce2[_0x2814('0x36')][_0x2814('0x3a')]));_0x514788['attributes']=_0x514788['attributes'][_0x2814('0x3b')]?_0x514788[_0x2814('0x39')]:_0xa2c7d0[_0x2814('0x35')];if(!_0x1edce2[_0x2814('0x36')][_0x2814('0x3c')]('nolimit')){_0x514788[_0x2814('0x21')]=qs[_0x2814('0x21')](_0x1edce2['query'][_0x2814('0x21')]);_0x514788[_0x2814('0x23')]=qs['offset'](_0x1edce2[_0x2814('0x36')][_0x2814('0x23')]);}_0x514788[_0x2814('0x3d')]=qs[_0x2814('0x3e')](_0x1edce2['query']['sort']);_0x514788[_0x2814('0x3f')]=qs[_0x2814('0x37')](_['pick'](_0x1edce2[_0x2814('0x36')],_0xa2c7d0['filters']),_0xe4ab56);if(_0x1edce2[_0x2814('0x36')][_0x2814('0x40')]){_0x514788[_0x2814('0x3f')]=_[_0x2814('0x41')](_0x514788[_0x2814('0x3f')],{'$or':_[_0x2814('0x31')](_0xe4ab56,function(_0x244d71){if(_0x244d71[_0x2814('0x33')]!==_0x2814('0x42')){var _0x3b8e8c={};_0x3b8e8c[_0x244d71[_0x2814('0x2f')]]={'$like':'%'+_0x1edce2['query'][_0x2814('0x40')]+'%'};return _0x3b8e8c;}})});}_0x514788=_[_0x2814('0x41')]({},_0x514788,_0x1edce2[_0x2814('0x43')]);var _0x57d2d4={'where':_0x514788[_0x2814('0x3f')]};return db[_0x2814('0x44')][_0x2814('0x22')](_0x57d2d4)[_0x2814('0x28')](function(_0x2d06e7){_0x5e42ca[_0x2814('0x22')]=_0x2d06e7;if(_0x1edce2[_0x2814('0x36')][_0x2814('0x45')]){_0x514788[_0x2814('0x46')]=[{'all':!![]}];}return db[_0x2814('0x44')][_0x2814('0x47')](_0x514788);})['then'](function(_0x5b2fd6){_0x5e42ca[_0x2814('0x48')]=_0x5b2fd6;return _0x5e42ca;})[_0x2814('0x28')](respondWithFilteredResult(_0x124c94,_0x514788))[_0x2814('0x49')](handleError(_0x124c94,null));};exports[_0x2814('0x4a')]=function(_0x297bd6,_0xc3ac91){var _0x5a6a3c={'raw':!![],'where':{'id':_0x297bd6['params']['id']}},_0x223e56={};_0x223e56[_0x2814('0x35')]=_['keys'](db['FaxQueue']['rawAttributes']);_0x223e56[_0x2814('0x36')]=_[_0x2814('0x4b')](_0x297bd6[_0x2814('0x36')]);_0x223e56['filters']=_[_0x2814('0x38')](_0x223e56[_0x2814('0x35')],_0x223e56[_0x2814('0x36')]);_0x5a6a3c[_0x2814('0x39')]=_[_0x2814('0x38')](_0x223e56['model'],qs[_0x2814('0x3a')](_0x297bd6[_0x2814('0x36')][_0x2814('0x3a')]));_0x5a6a3c[_0x2814('0x39')]=_0x5a6a3c['attributes'][_0x2814('0x3b')]?_0x5a6a3c[_0x2814('0x39')]:_0x223e56[_0x2814('0x35')];if(_0x297bd6[_0x2814('0x36')]['includeAll']){_0x5a6a3c[_0x2814('0x46')]=[{'all':!![]}];}_0x5a6a3c=_[_0x2814('0x41')]({},_0x5a6a3c,_0x297bd6[_0x2814('0x43')]);return db[_0x2814('0x44')][_0x2814('0x4c')](_0x5a6a3c)[_0x2814('0x28')](handleEntityNotFound(_0xc3ac91,null))[_0x2814('0x28')](respondWithResult(_0xc3ac91,null))[_0x2814('0x49')](handleError(_0xc3ac91,null));};exports[_0x2814('0x4d')]=function(_0x14720b,_0x1e79dd){return db['FaxQueue'][_0x2814('0x4d')](_0x14720b[_0x2814('0x4e')],{})['then'](function(_0x20ef4b){var _0x3237b5=_0x14720b[_0x2814('0x4f')][_0x2814('0x2a')]({'plain':!![]});if(!_0x3237b5)throw new Error(_0x2814('0x50'));if(_0x3237b5[_0x2814('0x51')]==='user'){var _0x18cde6=_0x20ef4b[_0x2814('0x2a')]({'plain':!![]});var _0x2bc39c=_0x2814('0x2b');return db[_0x2814('0x52')]['find']({'where':{'name':_0x2bc39c,'userProfileId':_0x3237b5[_0x2814('0x53')]},'raw':!![]})['then'](function(_0xc32453){if(_0xc32453&&_0xc32453[_0x2814('0x54')]===0x0){return db['UserProfileResource']['create']({'name':_0x18cde6[_0x2814('0x2f')],'resourceId':_0x18cde6['id'],'type':_0xc32453[_0x2814('0x2f')],'sectionId':_0xc32453['id']},{})[_0x2814('0x28')](function(){return _0x20ef4b;});}else{return _0x20ef4b;}})[_0x2814('0x49')](function(_0x4f1dd5){logger['error'](_0x2814('0x55'),_0x4f1dd5);throw _0x4f1dd5;});}return _0x20ef4b;})['then'](respondWithResult(_0x1e79dd,0xc9))[_0x2814('0x49')](handleError(_0x1e79dd,null));};exports['update']=function(_0xe2f6cd,_0x44ae7d){if(_0xe2f6cd[_0x2814('0x4e')]['id']){delete _0xe2f6cd[_0x2814('0x4e')]['id'];}return db[_0x2814('0x44')][_0x2814('0x4c')]({'where':{'id':_0xe2f6cd[_0x2814('0x56')]['id']}})[_0x2814('0x28')](handleEntityNotFound(_0x44ae7d,null))['then'](saveUpdates(_0xe2f6cd[_0x2814('0x4e')],null))[_0x2814('0x28')](respondWithResult(_0x44ae7d,null))[_0x2814('0x49')](handleError(_0x44ae7d,null));};exports[_0x2814('0x29')]=function(_0x282ad7,_0x3ace4b){return db['FaxQueue'][_0x2814('0x4c')]({'where':{'id':_0x282ad7['params']['id']}})[_0x2814('0x28')](handleEntityNotFound(_0x3ace4b,null))[_0x2814('0x28')](removeEntity(_0x3ace4b,null))[_0x2814('0x49')](handleError(_0x3ace4b,null));};exports['describe']=function(_0x5d6eab,_0xb51366){return db['FaxQueue'][_0x2814('0x57')]()[_0x2814('0x28')](respondWithResult(_0xb51366,null))[_0x2814('0x49')](handleError(_0xb51366,null));};exports[_0x2814('0x58')]=function(_0x203b1f,_0x392b9f,_0xbc7309){var _0x497b50={'raw':!![],'where':{}},_0xa69702={},_0x1a0cc6;return db['FaxQueue'][_0x2814('0x59')]({'where':{'id':_0x203b1f[_0x2814('0x56')]['id']}})['then'](handleEntityNotFound(_0x392b9f,null))[_0x2814('0x28')](function(_0x3590fb){if(_0x3590fb){_0x1a0cc6=_0x3590fb[_0x2814('0x2a')]({'plain':!![]});_0xa69702[_0x2814('0x35')]=_[_0x2814('0x4b')](db['UserFaxQueue'][_0x2814('0x5a')]);_0xa69702[_0x2814('0x36')]=_['keys'](_0x203b1f[_0x2814('0x36')]);_0xa69702[_0x2814('0x37')]=_[_0x2814('0x38')](_0xa69702['model'],_0xa69702[_0x2814('0x36')]);_0x497b50[_0x2814('0x39')]=_[_0x2814('0x38')](_0xa69702[_0x2814('0x35')],qs[_0x2814('0x3a')](_0x203b1f[_0x2814('0x36')]['fields']));_0x497b50['attributes']=_0x497b50[_0x2814('0x39')][_0x2814('0x3b')]?_0x497b50[_0x2814('0x39')]:_0xa69702[_0x2814('0x35')];if(!_0x203b1f[_0x2814('0x36')][_0x2814('0x3c')](_0x2814('0x5b'))){_0x497b50[_0x2814('0x21')]=qs[_0x2814('0x21')](_0x203b1f['query'][_0x2814('0x21')]);_0x497b50[_0x2814('0x23')]=qs[_0x2814('0x23')](_0x203b1f[_0x2814('0x36')]['offset']);}_0x497b50['order']=qs['sort'](_0x203b1f[_0x2814('0x36')][_0x2814('0x3e')]);_0x497b50['where']=qs[_0x2814('0x37')](_[_0x2814('0x5c')](_0x203b1f[_0x2814('0x36')],_0xa69702[_0x2814('0x37')]));_0x497b50['where'][_0x2814('0x5d')]=_0x3590fb['id'];if(_0x203b1f[_0x2814('0x36')][_0x2814('0x40')]){_0x497b50[_0x2814('0x3f')]=_[_0x2814('0x41')](_0x497b50[_0x2814('0x3f')],{'$or':_[_0x2814('0x31')](_0x497b50[_0x2814('0x39')],function(_0x2a96f1){var _0x47198c={};_0x47198c[_0x2a96f1]={'$like':'%'+_0x203b1f[_0x2814('0x36')][_0x2814('0x40')]+'%'};return _0x47198c;})});}_0x497b50=_[_0x2814('0x41')]({},_0x497b50,_0x203b1f['options']);return db[_0x2814('0x5e')][_0x2814('0x47')](_0x497b50);}})[_0x2814('0x28')](function(_0x3bbf67){if(_0x3bbf67){return db['User'][_0x2814('0x5f')]({'where':{'id':_[_0x2814('0x31')](_0x3bbf67,_0x2814('0x60')),'role':_0x2814('0x61')},'attributes':['id',_0x2814('0x2f'),'faxPause',_0x2814('0x62'),_0x2814('0x63')]});}})['then'](function(_0x3c5137){if(_0x3c5137){return{'count':_0x3c5137[_0x2814('0x22')],'rows':_[_0x2814('0x31')](_0x3c5137[_0x2814('0x48')],function(_0x260c15){return{'membername':_0x260c15[_0x2814('0x2f')],'UserId':_0x260c15['id'],'queue_name':_0x1a0cc6[_0x2814('0x2f')],'FaxQueueId':_0x1a0cc6['id'],'interface':util['format'](_0x2814('0x64'),_0x2814('0x65'),_0x260c15[_0x2814('0x2f')]),'penalty':0x0,'paused':_0x260c15[_0x2814('0x66')],'createdAt':_0x260c15['createdAt'],'updatedAt':_0x260c15[_0x2814('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x2814('0x28')](respondWithFilteredResult(_0x392b9f,_0x497b50))[_0x2814('0x49')](handleError(_0x392b9f,null));};exports[_0x2814('0x67')]=function(_0x5592dc,_0x37508b,_0x82a7e2){var _0x46b7eb={};var _0x317455={};var _0x496825;var _0x44589c;return db[_0x2814('0x44')][_0x2814('0x59')]({'where':{'id':_0x5592dc[_0x2814('0x56')]['id']}})['then'](handleEntityNotFound(_0x37508b,null))['then'](function(_0x3ca306){if(_0x3ca306){_0x496825=_0x3ca306;_0x317455[_0x2814('0x35')]=_[_0x2814('0x4b')](db[_0x2814('0x68')][_0x2814('0x5a')]);_0x317455['query']=_[_0x2814('0x4b')](_0x5592dc['query']);_0x317455[_0x2814('0x37')]=_[_0x2814('0x38')](_0x317455[_0x2814('0x35')],_0x317455[_0x2814('0x36')]);_0x46b7eb[_0x2814('0x39')]=_[_0x2814('0x38')](_0x317455[_0x2814('0x35')],qs[_0x2814('0x3a')](_0x5592dc['query'][_0x2814('0x3a')]));_0x46b7eb[_0x2814('0x39')]=_0x46b7eb[_0x2814('0x39')][_0x2814('0x3b')]?_0x46b7eb['attributes']:_0x317455['model'];_0x46b7eb[_0x2814('0x3d')]=qs[_0x2814('0x3e')](_0x5592dc[_0x2814('0x36')]['sort']);_0x46b7eb[_0x2814('0x3f')]=qs[_0x2814('0x37')](_[_0x2814('0x5c')](_0x5592dc[_0x2814('0x36')],_0x317455[_0x2814('0x37')]));if(_0x5592dc[_0x2814('0x36')]['filter']){_0x46b7eb[_0x2814('0x3f')]=_[_0x2814('0x41')](_0x46b7eb[_0x2814('0x3f')],{'$or':_[_0x2814('0x31')](_0x46b7eb['attributes'],function(_0x5e66b4){var _0x51858e={};_0x51858e[_0x5e66b4]={'$like':'%'+_0x5592dc[_0x2814('0x36')]['filter']+'%'};return _0x51858e;})});}_0x46b7eb=_['merge']({},_0x46b7eb,_0x5592dc[_0x2814('0x43')]);return _0x496825['getTeams'](_0x46b7eb);}})[_0x2814('0x28')](function(_0x125069){if(_0x125069){_0x44589c=_0x125069[_0x2814('0x3b')];if(!_0x5592dc[_0x2814('0x36')][_0x2814('0x3c')](_0x2814('0x5b'))){_0x46b7eb[_0x2814('0x21')]=qs[_0x2814('0x21')](_0x5592dc[_0x2814('0x36')][_0x2814('0x21')]);_0x46b7eb['offset']=qs[_0x2814('0x23')](_0x5592dc[_0x2814('0x36')][_0x2814('0x23')]);}return _0x496825[_0x2814('0x67')](_0x46b7eb);}})[_0x2814('0x28')](function(_0x2a2892){if(_0x2a2892){return _0x2a2892?{'count':_0x44589c,'rows':_0x2a2892}:null;}})[_0x2814('0x28')](respondWithResult(_0x37508b,null))[_0x2814('0x49')](handleError(_0x37508b,null));};exports['addTeams']=function(_0x2c2592,_0x13f914,_0x171f69){var _0x4fc363=_0x2c2592['body'][_0x2814('0x69')];return db['Team'][_0x2814('0x47')]({'where':{'id':_0x4fc363},'attributes':['id'],'include':[{'model':db[_0x2814('0x6a')],'as':_0x2814('0x6b'),'attributes':['id',_0x2814('0x2f'),_0x2814('0x6c'),_0x2814('0x6d'),_0x2814('0x6e')],'raw':!![]}]})[_0x2814('0x28')](function(_0x1d3bcd){if(_0x1d3bcd){var _0x5d824c=_[_0x2814('0x6f')](_0x1d3bcd,function(_0x4bd562){var _0xf120fa=_0x4bd562[_0x2814('0x2a')]({'plain':!![]});return _0xf120fa[_0x2814('0x6b')];});return db[_0x2814('0x44')][_0x2814('0x4c')]({'where':{'id':_0x2c2592[_0x2814('0x56')]['id']}})[_0x2814('0x28')](function(_0x5f3d1b){return db[_0x2814('0x70')][_0x2814('0x71')](function(_0x581864){return _0x5f3d1b[_0x2814('0x72')](_0x4fc363,{'transaction':_0x581864})[_0x2814('0x28')](function(){return BPromise[_0x2814('0x73')](_0x5d824c,function(_0x4e76e5){return db[_0x2814('0x5e')][_0x2814('0x74')]({'where':{'UserId':_0x4e76e5['id'],'FaxQueueId':_0x2c2592[_0x2814('0x56')]['id']},'transaction':_0x581864});});})[_0x2814('0x28')](function(){_0x5d824c[_0x2814('0x75')](function(_0x1cf07d){socket[_0x2814('0x76')](_0x2814('0x77'),{'UserId':_0x1cf07d['id'],'FaxQueueId':_0x5f3d1b['id']});});});});});}})[_0x2814('0x28')](respondWithStatusCode(_0x13f914,null))['catch'](handleError(_0x13f914,null));};exports[_0x2814('0x78')]=function(_0x4d8706,_0x2bf1c9,_0x203099){return db['Team']['findAll']({'where':{'id':_0x4d8706['query'][_0x2814('0x69')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x2814('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x2814('0x28')](handleEntityNotFound(_0x2bf1c9,null))['then'](function(_0x5cd090){var _0x753734=_[_0x2814('0x31')](_0x5cd090,'id');var _0x40de89=[];var _0x34fef1=[];var _0x246afc=squel[_0x2814('0x79')]();_0x246afc[_0x2814('0x7a')](_0x2814('0x7b'))['from']('team_has_fax_queues','tq')[_0x2814('0x7c')](_0x2814('0x7d'),'ut',_0x2814('0x7e'))['where'](_0x2814('0x7f'),_0x4d8706['params']['id']);for(var _0x2a1f1e=0x0;_0x2a1f1e<_0x5cd090[_0x2814('0x3b')];_0x2a1f1e+=0x1){let _0x36c973=_0x5cd090[_0x2a1f1e];for(var _0x117efc=0x0;_0x117efc<_0x36c973[_0x2814('0x6b')][_0x2814('0x3b')];_0x117efc+=0x1){let _0xb7900b=_0x36c973[_0x2814('0x6b')][_0x117efc];var _0x9a9c37=_0x246afc[_0x2814('0x80')]();_0x9a9c37['where']('ut.UserId\x20=\x20?',_0xb7900b['id']);_0x34fef1[_0x2814('0x81')](db[_0x2814('0x70')][_0x2814('0x36')](_0x9a9c37[_0x2814('0x82')](),{'type':db['sequelize'][_0x2814('0x83')]['SELECT']})['then'](function(_0xfe64c2){if(_0xfe64c2[_0x2814('0x3b')]===0x1){return _0xb7900b['id'];}else{var _0x467943=_[_0x2814('0x84')](_['map'](_0xfe64c2,_0x2814('0x85')),function(_0x2c6b4b){return _[_0x2814('0x86')](_0x753734,_0x2c6b4b);});if(_0x467943){return _0xb7900b['id'];}}}));}}return BPromise[_0x2814('0x87')](_0x34fef1)['then'](function(_0x5dd48d){_0x40de89=_(_0x40de89)[_0x2814('0x88')](_0x5dd48d)[_0x2814('0x89')]()[_0x2814('0x8a')]();return db['FaxQueue'][_0x2814('0x4c')]({'where':{'id':_0x4d8706[_0x2814('0x56')]['id']}})['then'](function(_0x80dead){return db[_0x2814('0x70')][_0x2814('0x71')](function(_0x522f51){return _0x80dead['removeTeams'](_0x4d8706[_0x2814('0x36')][_0x2814('0x69')],{'transaction':_0x522f51})[_0x2814('0x28')](function(){if(!_[_0x2814('0x8b')](_0x40de89)){return _0x80dead[_0x2814('0x8c')](_0x40de89,{'transaction':_0x522f51});}})[_0x2814('0x28')](function(){_0x40de89[_0x2814('0x75')](function(_0xe9262e){socket[_0x2814('0x76')](_0x2814('0x8d'),{'UserId':_0xe9262e,'FaxQueueId':_0x80dead['id']});});});});});});})[_0x2814('0x28')](respondWithStatusCode(_0x2bf1c9,null))['catch'](handleError(_0x2bf1c9,null));};exports[_0x2814('0x8e')]=function(_0x2f2718,_0x48afcd,_0x268ba3){return db[_0x2814('0x44')][_0x2814('0x4c')]({'where':{'id':_0x2f2718[_0x2814('0x56')]['id']}})[_0x2814('0x28')](handleEntityNotFound(_0x48afcd,null))[_0x2814('0x28')](function(_0x23246a){if(_0x23246a){return _0x23246a[_0x2814('0x8e')](_0x2f2718[_0x2814('0x4e')]['ids'],_[_0x2814('0x8f')](_0x2f2718[_0x2814('0x4e')],[_0x2814('0x69'),'id'])||{})[_0x2814('0x90')](function(_0x38d0a){for(var _0x2af441=0x0;_0x2af441<_0x2f2718[_0x2814('0x4e')][_0x2814('0x69')][_0x2814('0x3b')];_0x2af441+=0x1){socket[_0x2814('0x76')](_0x2814('0x77'),{'UserId':Number(_0x2f2718[_0x2814('0x4e')][_0x2814('0x69')][_0x2af441]),'FaxQueueId':Number(_0x2f2718[_0x2814('0x56')]['id'])});}return _0x38d0a;});}})[_0x2814('0x28')](respondWithResult(_0x48afcd,null))[_0x2814('0x49')](handleError(_0x48afcd,null));};exports[_0x2814('0x8c')]=function(_0xcd0d74,_0x1427db,_0xb71dcb){return db[_0x2814('0x44')][_0x2814('0x4c')]({'where':{'id':_0xcd0d74[_0x2814('0x56')]['id']}})['then'](handleEntityNotFound(_0x1427db,null))[_0x2814('0x28')](function(_0x5ab898){if(_0x5ab898){return _0x5ab898[_0x2814('0x8c')](_0xcd0d74[_0x2814('0x36')][_0x2814('0x69')])['then'](function(){if(_[_0x2814('0x91')](_0xcd0d74['query'][_0x2814('0x69')])){for(var _0x229dce=0x0;_0x229dce<_0xcd0d74['query'][_0x2814('0x69')][_0x2814('0x3b')];_0x229dce+=0x1){socket[_0x2814('0x76')]('userFaxQueue:remove',{'UserId':Number(_0xcd0d74[_0x2814('0x36')]['ids'][_0x229dce]),'FaxQueueId':Number(_0xcd0d74[_0x2814('0x56')]['id'])});}}else{socket[_0x2814('0x76')](_0x2814('0x8d'),{'UserId':Number(_0xcd0d74[_0x2814('0x36')][_0x2814('0x69')]),'FaxQueueId':Number(_0xcd0d74[_0x2814('0x56')]['id'])});}});}})['then'](respondWithStatusCode(_0x1427db,null))[_0x2814('0x49')](handleError(_0x1427db,null));};exports[_0x2814('0x92')]=function(_0x4d0902,_0x2d3c9f,_0x59d3e6){var _0x3ed6a3={};var _0x1ed580={};var _0x6f87c1;var _0x4a23dc;return db[_0x2814('0x44')][_0x2814('0x59')]({'where':{'id':_0x4d0902[_0x2814('0x56')]['id']}})[_0x2814('0x28')](handleEntityNotFound(_0x2d3c9f,null))[_0x2814('0x28')](function(_0x383ea9){if(_0x383ea9){_0x6f87c1=_0x383ea9;_0x1ed580[_0x2814('0x35')]=_[_0x2814('0x4b')](db[_0x2814('0x6a')][_0x2814('0x5a')]);_0x1ed580[_0x2814('0x36')]=_[_0x2814('0x4b')](_0x4d0902[_0x2814('0x36')]);_0x1ed580[_0x2814('0x37')]=_[_0x2814('0x38')](_0x1ed580[_0x2814('0x35')],_0x1ed580[_0x2814('0x36')]);_0x3ed6a3[_0x2814('0x39')]=_[_0x2814('0x38')](_0x1ed580['model'],qs['fields'](_0x4d0902['query'][_0x2814('0x3a')]));_0x3ed6a3[_0x2814('0x39')]=_0x3ed6a3[_0x2814('0x39')]['length']?_0x3ed6a3['attributes']:_0x1ed580['model'];_0x3ed6a3[_0x2814('0x3d')]=qs[_0x2814('0x3e')](_0x4d0902[_0x2814('0x36')]['sort']);_0x3ed6a3[_0x2814('0x3f')]=qs[_0x2814('0x37')](_[_0x2814('0x5c')](_0x4d0902[_0x2814('0x36')],_0x1ed580[_0x2814('0x37')]));if(_0x4d0902[_0x2814('0x36')][_0x2814('0x40')]){_0x3ed6a3[_0x2814('0x3f')]=_[_0x2814('0x41')](_0x3ed6a3[_0x2814('0x3f')],{'$or':_['map'](_0x3ed6a3[_0x2814('0x39')],function(_0x3b2fc0){var _0x19d583={};_0x19d583[_0x3b2fc0]={'$like':'%'+_0x4d0902['query'][_0x2814('0x40')]+'%'};return _0x19d583;})});}_0x3ed6a3=_[_0x2814('0x41')]({},_0x3ed6a3,_0x4d0902['options']);return _0x6f87c1[_0x2814('0x92')](_0x3ed6a3);}})[_0x2814('0x28')](function(_0x54a4bf){if(_0x54a4bf){_0x4a23dc=_0x54a4bf[_0x2814('0x3b')];if(!_0x4d0902[_0x2814('0x36')][_0x2814('0x3c')](_0x2814('0x5b'))){_0x3ed6a3['limit']=qs['limit'](_0x4d0902['query'][_0x2814('0x21')]);_0x3ed6a3[_0x2814('0x23')]=qs[_0x2814('0x23')](_0x4d0902[_0x2814('0x36')][_0x2814('0x23')]);}return _0x6f87c1['getAgents'](_0x3ed6a3);}})[_0x2814('0x28')](function(_0x224243){if(_0x224243){return _0x224243?{'count':_0x4a23dc,'rows':_0x224243}:null;}})[_0x2814('0x28')](respondWithResult(_0x2d3c9f,null))[_0x2814('0x49')](handleError(_0x2d3c9f,null));}; \ No newline at end of file +var _0x7ed8=['Content-Range','json','reject','save','update','then','destroy','get','FaxQueues','UserProfileResource','end','error','name','index','map','FaxQueue','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','options','findAll','rows','params','includeAll','include','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserFaxQueue','nolimit','FaxQueueId','User','findAndCountAll','UserId','agent','updatedAt','%s/%s','SIP','faxPause','createdAt','getTeams','Team','addTeams','ids','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userFaxQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','FaxQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','union','value','userFaxQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','redis','localhost','./faxQueue.socket','sendStatus','status','undefined','limit','count'];(function(_0x3d7a61,_0xe8d0ec){var _0x58e78e=function(_0x27a2e5){while(--_0x27a2e5){_0x3d7a61['push'](_0x3d7a61['shift']());}};_0x58e78e(++_0xe8d0ec);}(_0x7ed8,0x187));var _0x87ed=function(_0x2bb7fb,_0x421f35){_0x2bb7fb=_0x2bb7fb-0x0;var _0x4b523e=_0x7ed8[_0x2bb7fb];return _0x4b523e;};'use strict';var emlformat=require(_0x87ed('0x0'));var rimraf=require(_0x87ed('0x1'));var zipdir=require(_0x87ed('0x2'));var jsonpatch=require(_0x87ed('0x3'));var rp=require(_0x87ed('0x4'));var moment=require('moment');var BPromise=require(_0x87ed('0x5'));var Mustache=require(_0x87ed('0x6'));var util=require(_0x87ed('0x7'));var path=require('path');var sox=require(_0x87ed('0x8'));var csv=require(_0x87ed('0x9'));var ejs=require(_0x87ed('0xa'));var fs=require('fs');var fs_extra=require(_0x87ed('0xb'));var _=require(_0x87ed('0xc'));var squel=require('squel');var crypto=require(_0x87ed('0xd'));var jsforce=require(_0x87ed('0xe'));var deskjs=require(_0x87ed('0xf'));var toCsv=require(_0x87ed('0x9'));var querystring=require('querystring');var Papa=require(_0x87ed('0x10'));var Redis=require('ioredis');var authService=require(_0x87ed('0x11'));var qs=require(_0x87ed('0x12'));var as=require(_0x87ed('0x13'));var hardwareService=require(_0x87ed('0x14'));var logger=require(_0x87ed('0x15'))(_0x87ed('0x16'));var utils=require(_0x87ed('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x87ed('0x18')]=_['defaults'](config['redis'],{'host':_0x87ed('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x87ed('0x1a'))['register'](socket);function respondWithStatusCode(_0xf0f31,_0x4566b3){_0x4566b3=_0x4566b3||0xcc;return function(_0x5d858b){if(_0x5d858b){return _0xf0f31[_0x87ed('0x1b')](_0x4566b3);}return _0xf0f31[_0x87ed('0x1c')](_0x4566b3)['end']();};}function respondWithResult(_0x6ff69b,_0x281144){_0x281144=_0x281144||0xc8;return function(_0x273bac){if(_0x273bac){return _0x6ff69b[_0x87ed('0x1c')](_0x281144)['json'](_0x273bac);}};}function respondWithFilteredResult(_0x1e1e7d,_0xc43581){return function(_0x2b0ff9){if(_0x2b0ff9){var _0x442002=typeof _0xc43581['offset']===_0x87ed('0x1d')&&typeof _0xc43581[_0x87ed('0x1e')]===_0x87ed('0x1d');var _0x16d770=_0x2b0ff9[_0x87ed('0x1f')];var _0x5a5dd0=_0x442002?0x0:_0xc43581['offset'];var _0x1cbb96=_0x442002?_0x2b0ff9[_0x87ed('0x1f')]:_0xc43581['offset']+_0xc43581[_0x87ed('0x1e')];var _0xc4e3f4;if(_0x1cbb96>=_0x16d770){_0x1cbb96=_0x16d770;_0xc4e3f4=0xc8;}else{_0xc4e3f4=0xce;}_0x1e1e7d[_0x87ed('0x1c')](_0xc4e3f4);return _0x1e1e7d['set'](_0x87ed('0x20'),_0x5a5dd0+'-'+_0x1cbb96+'/'+_0x16d770)[_0x87ed('0x21')](_0x2b0ff9);}return null;};}function patchUpdates(_0x320a22){return function(_0x344254){try{jsonpatch['apply'](_0x344254,_0x320a22,!![]);}catch(_0x293e16){return BPromise[_0x87ed('0x22')](_0x293e16);}return _0x344254[_0x87ed('0x23')]();};}function saveUpdates(_0x340d92,_0x5f0341){return function(_0x4db452){if(_0x4db452){return _0x4db452[_0x87ed('0x24')](_0x340d92)[_0x87ed('0x25')](function(_0x2cb685){return _0x2cb685;});}return null;};}function removeEntity(_0x1987ca,_0x27a365){return function(_0x4fdaaa){if(_0x4fdaaa){return _0x4fdaaa[_0x87ed('0x26')]()[_0x87ed('0x25')](function(){var _0x694685=_0x4fdaaa[_0x87ed('0x27')]({'plain':!![]});var _0x38f51b=_0x87ed('0x28');return db[_0x87ed('0x29')]['destroy']({'where':{'type':_0x38f51b,'resourceId':_0x694685['id']}})[_0x87ed('0x25')](function(){return _0x4fdaaa;});})['then'](function(){_0x1987ca[_0x87ed('0x1c')](0xcc)[_0x87ed('0x2a')]();});}};}function handleEntityNotFound(_0x45edb0,_0x388822){return function(_0x2b103d){if(!_0x2b103d){_0x45edb0[_0x87ed('0x1b')](0x194);}return _0x2b103d;};}function handleError(_0x2f08e0,_0x45ef39){_0x45ef39=_0x45ef39||0x1f4;return function(_0x44484d){logger[_0x87ed('0x2b')](_0x44484d['stack']);if(_0x44484d['name']){delete _0x44484d[_0x87ed('0x2c')];}_0x2f08e0[_0x87ed('0x1c')](_0x45ef39)['send'](_0x44484d);};}exports[_0x87ed('0x2d')]=function(_0x5264bb,_0x1e6795){var _0x4898a8={},_0x3caafc={},_0x21f056={'count':0x0,'rows':[]};var _0x41019f=_[_0x87ed('0x2e')](db[_0x87ed('0x2f')][_0x87ed('0x30')],function(_0x4fe7a2){return{'name':_0x4fe7a2['fieldName'],'type':_0x4fe7a2['type'][_0x87ed('0x31')]};});_0x3caafc[_0x87ed('0x32')]=_[_0x87ed('0x2e')](_0x41019f,'name');_0x3caafc[_0x87ed('0x33')]=_[_0x87ed('0x34')](_0x5264bb[_0x87ed('0x33')]);_0x3caafc[_0x87ed('0x35')]=_[_0x87ed('0x36')](_0x3caafc[_0x87ed('0x32')],_0x3caafc[_0x87ed('0x33')]);_0x4898a8[_0x87ed('0x37')]=_[_0x87ed('0x36')](_0x3caafc[_0x87ed('0x32')],qs['fields'](_0x5264bb[_0x87ed('0x33')][_0x87ed('0x38')]));_0x4898a8[_0x87ed('0x37')]=_0x4898a8['attributes'][_0x87ed('0x39')]?_0x4898a8[_0x87ed('0x37')]:_0x3caafc[_0x87ed('0x32')];if(!_0x5264bb[_0x87ed('0x33')][_0x87ed('0x3a')]('nolimit')){_0x4898a8[_0x87ed('0x1e')]=qs[_0x87ed('0x1e')](_0x5264bb['query']['limit']);_0x4898a8[_0x87ed('0x3b')]=qs[_0x87ed('0x3b')](_0x5264bb['query'][_0x87ed('0x3b')]);}_0x4898a8[_0x87ed('0x3c')]=qs[_0x87ed('0x3d')](_0x5264bb['query']['sort']);_0x4898a8[_0x87ed('0x3e')]=qs[_0x87ed('0x35')](_[_0x87ed('0x3f')](_0x5264bb['query'],_0x3caafc[_0x87ed('0x35')]),_0x41019f);if(_0x5264bb[_0x87ed('0x33')][_0x87ed('0x40')]){_0x4898a8[_0x87ed('0x3e')]=_[_0x87ed('0x41')](_0x4898a8['where'],{'$or':_[_0x87ed('0x2e')](_0x41019f,function(_0x25c439){if(_0x25c439[_0x87ed('0x42')]!==_0x87ed('0x43')){var _0x4bae25={};_0x4bae25[_0x25c439[_0x87ed('0x2c')]]={'$like':'%'+_0x5264bb[_0x87ed('0x33')][_0x87ed('0x40')]+'%'};return _0x4bae25;}})});}_0x4898a8=_[_0x87ed('0x41')]({},_0x4898a8,_0x5264bb[_0x87ed('0x44')]);var _0x48cc22={'where':_0x4898a8[_0x87ed('0x3e')]};return db[_0x87ed('0x2f')]['count'](_0x48cc22)['then'](function(_0x5e8e7b){_0x21f056[_0x87ed('0x1f')]=_0x5e8e7b;if(_0x5264bb[_0x87ed('0x33')]['includeAll']){_0x4898a8['include']=[{'all':!![]}];}return db[_0x87ed('0x2f')][_0x87ed('0x45')](_0x4898a8);})[_0x87ed('0x25')](function(_0x126baa){_0x21f056[_0x87ed('0x46')]=_0x126baa;return _0x21f056;})[_0x87ed('0x25')](respondWithFilteredResult(_0x1e6795,_0x4898a8))['catch'](handleError(_0x1e6795,null));};exports['show']=function(_0x2190d6,_0x4deb94){var _0x49ef2e={'raw':!![],'where':{'id':_0x2190d6[_0x87ed('0x47')]['id']}},_0x3c66ac={};_0x3c66ac[_0x87ed('0x32')]=_['keys'](db['FaxQueue'][_0x87ed('0x30')]);_0x3c66ac['query']=_['keys'](_0x2190d6[_0x87ed('0x33')]);_0x3c66ac[_0x87ed('0x35')]=_[_0x87ed('0x36')](_0x3c66ac[_0x87ed('0x32')],_0x3c66ac['query']);_0x49ef2e[_0x87ed('0x37')]=_['intersection'](_0x3c66ac[_0x87ed('0x32')],qs[_0x87ed('0x38')](_0x2190d6[_0x87ed('0x33')][_0x87ed('0x38')]));_0x49ef2e[_0x87ed('0x37')]=_0x49ef2e['attributes']['length']?_0x49ef2e['attributes']:_0x3c66ac[_0x87ed('0x32')];if(_0x2190d6[_0x87ed('0x33')][_0x87ed('0x48')]){_0x49ef2e[_0x87ed('0x49')]=[{'all':!![]}];}_0x49ef2e=_[_0x87ed('0x41')]({},_0x49ef2e,_0x2190d6['options']);return db[_0x87ed('0x2f')]['find'](_0x49ef2e)[_0x87ed('0x25')](handleEntityNotFound(_0x4deb94,null))[_0x87ed('0x25')](respondWithResult(_0x4deb94,null))['catch'](handleError(_0x4deb94,null));};exports[_0x87ed('0x4a')]=function(_0x435634,_0x3d64fd){return db[_0x87ed('0x2f')][_0x87ed('0x4a')](_0x435634[_0x87ed('0x4b')],{})[_0x87ed('0x25')](function(_0x44efeb){var _0x4dc7e3=_0x435634[_0x87ed('0x4c')][_0x87ed('0x27')]({'plain':!![]});if(!_0x4dc7e3)throw new Error(_0x87ed('0x4d'));if(_0x4dc7e3[_0x87ed('0x4e')]===_0x87ed('0x4c')){var _0x830aad=_0x44efeb[_0x87ed('0x27')]({'plain':!![]});var _0x1bb170=_0x87ed('0x28');return db[_0x87ed('0x4f')][_0x87ed('0x50')]({'where':{'name':_0x1bb170,'userProfileId':_0x4dc7e3[_0x87ed('0x51')]},'raw':!![]})[_0x87ed('0x25')](function(_0x173768){if(_0x173768&&_0x173768[_0x87ed('0x52')]===0x0){return db[_0x87ed('0x29')][_0x87ed('0x4a')]({'name':_0x830aad[_0x87ed('0x2c')],'resourceId':_0x830aad['id'],'type':_0x173768['name'],'sectionId':_0x173768['id']},{})[_0x87ed('0x25')](function(){return _0x44efeb;});}else{return _0x44efeb;}})[_0x87ed('0x53')](function(_0x22b84a){logger[_0x87ed('0x2b')](_0x87ed('0x54'),_0x22b84a);throw _0x22b84a;});}return _0x44efeb;})['then'](respondWithResult(_0x3d64fd,0xc9))['catch'](handleError(_0x3d64fd,null));};exports[_0x87ed('0x24')]=function(_0x3337fb,_0xc817fb){if(_0x3337fb[_0x87ed('0x4b')]['id']){delete _0x3337fb[_0x87ed('0x4b')]['id'];}return db['FaxQueue']['find']({'where':{'id':_0x3337fb[_0x87ed('0x47')]['id']}})[_0x87ed('0x25')](handleEntityNotFound(_0xc817fb,null))['then'](saveUpdates(_0x3337fb[_0x87ed('0x4b')],null))[_0x87ed('0x25')](respondWithResult(_0xc817fb,null))[_0x87ed('0x53')](handleError(_0xc817fb,null));};exports[_0x87ed('0x26')]=function(_0x360c58,_0x8320b0){return db[_0x87ed('0x2f')][_0x87ed('0x50')]({'where':{'id':_0x360c58['params']['id']}})['then'](handleEntityNotFound(_0x8320b0,null))['then'](removeEntity(_0x8320b0,null))[_0x87ed('0x53')](handleError(_0x8320b0,null));};exports[_0x87ed('0x55')]=function(_0x154b4c,_0xa5f31b){return db['FaxQueue'][_0x87ed('0x55')]()['then'](respondWithResult(_0xa5f31b,null))[_0x87ed('0x53')](handleError(_0xa5f31b,null));};exports[_0x87ed('0x56')]=function(_0x5afe78,_0xd26531,_0x5ae604){var _0x134892={'raw':!![],'where':{}},_0x5334f4={},_0x437e8c;return db[_0x87ed('0x2f')][_0x87ed('0x57')]({'where':{'id':_0x5afe78[_0x87ed('0x47')]['id']}})[_0x87ed('0x25')](handleEntityNotFound(_0xd26531,null))[_0x87ed('0x25')](function(_0x2d0904){if(_0x2d0904){_0x437e8c=_0x2d0904[_0x87ed('0x27')]({'plain':!![]});_0x5334f4[_0x87ed('0x32')]=_[_0x87ed('0x34')](db[_0x87ed('0x58')][_0x87ed('0x30')]);_0x5334f4[_0x87ed('0x33')]=_['keys'](_0x5afe78[_0x87ed('0x33')]);_0x5334f4[_0x87ed('0x35')]=_['intersection'](_0x5334f4[_0x87ed('0x32')],_0x5334f4[_0x87ed('0x33')]);_0x134892['attributes']=_[_0x87ed('0x36')](_0x5334f4[_0x87ed('0x32')],qs[_0x87ed('0x38')](_0x5afe78[_0x87ed('0x33')][_0x87ed('0x38')]));_0x134892[_0x87ed('0x37')]=_0x134892['attributes']['length']?_0x134892[_0x87ed('0x37')]:_0x5334f4[_0x87ed('0x32')];if(!_0x5afe78[_0x87ed('0x33')]['hasOwnProperty'](_0x87ed('0x59'))){_0x134892['limit']=qs[_0x87ed('0x1e')](_0x5afe78['query'][_0x87ed('0x1e')]);_0x134892['offset']=qs[_0x87ed('0x3b')](_0x5afe78[_0x87ed('0x33')]['offset']);}_0x134892[_0x87ed('0x3c')]=qs['sort'](_0x5afe78[_0x87ed('0x33')][_0x87ed('0x3d')]);_0x134892[_0x87ed('0x3e')]=qs[_0x87ed('0x35')](_[_0x87ed('0x3f')](_0x5afe78[_0x87ed('0x33')],_0x5334f4['filters']));_0x134892['where'][_0x87ed('0x5a')]=_0x2d0904['id'];if(_0x5afe78[_0x87ed('0x33')][_0x87ed('0x40')]){_0x134892[_0x87ed('0x3e')]=_['merge'](_0x134892['where'],{'$or':_['map'](_0x134892['attributes'],function(_0x5ba337){var _0x5e91d2={};_0x5e91d2[_0x5ba337]={'$like':'%'+_0x5afe78[_0x87ed('0x33')][_0x87ed('0x40')]+'%'};return _0x5e91d2;})});}_0x134892=_[_0x87ed('0x41')]({},_0x134892,_0x5afe78[_0x87ed('0x44')]);return db[_0x87ed('0x58')][_0x87ed('0x45')](_0x134892);}})[_0x87ed('0x25')](function(_0x330a29){if(_0x330a29){return db[_0x87ed('0x5b')][_0x87ed('0x5c')]({'where':{'id':_[_0x87ed('0x2e')](_0x330a29,_0x87ed('0x5d')),'role':_0x87ed('0x5e')},'attributes':['id',_0x87ed('0x2c'),'faxPause',_0x87ed('0x5f'),'createdAt']});}})[_0x87ed('0x25')](function(_0x1716cd){if(_0x1716cd){return{'count':_0x1716cd[_0x87ed('0x1f')],'rows':_[_0x87ed('0x2e')](_0x1716cd[_0x87ed('0x46')],function(_0x112ee3){return{'membername':_0x112ee3[_0x87ed('0x2c')],'UserId':_0x112ee3['id'],'queue_name':_0x437e8c['name'],'FaxQueueId':_0x437e8c['id'],'interface':util['format'](_0x87ed('0x60'),_0x87ed('0x61'),_0x112ee3[_0x87ed('0x2c')]),'penalty':0x0,'paused':_0x112ee3[_0x87ed('0x62')],'createdAt':_0x112ee3[_0x87ed('0x63')],'updatedAt':_0x112ee3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x87ed('0x25')](respondWithFilteredResult(_0xd26531,_0x134892))[_0x87ed('0x53')](handleError(_0xd26531,null));};exports[_0x87ed('0x64')]=function(_0xad00b6,_0x4acb5d,_0x358b55){var _0x10d48e={};var _0xc1d19={};var _0xc126d2;var _0xeb433d;return db[_0x87ed('0x2f')]['findOne']({'where':{'id':_0xad00b6[_0x87ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x4acb5d,null))['then'](function(_0x172655){if(_0x172655){_0xc126d2=_0x172655;_0xc1d19[_0x87ed('0x32')]=_[_0x87ed('0x34')](db[_0x87ed('0x65')][_0x87ed('0x30')]);_0xc1d19[_0x87ed('0x33')]=_[_0x87ed('0x34')](_0xad00b6[_0x87ed('0x33')]);_0xc1d19[_0x87ed('0x35')]=_[_0x87ed('0x36')](_0xc1d19['model'],_0xc1d19[_0x87ed('0x33')]);_0x10d48e['attributes']=_[_0x87ed('0x36')](_0xc1d19[_0x87ed('0x32')],qs['fields'](_0xad00b6[_0x87ed('0x33')]['fields']));_0x10d48e[_0x87ed('0x37')]=_0x10d48e[_0x87ed('0x37')]['length']?_0x10d48e[_0x87ed('0x37')]:_0xc1d19['model'];_0x10d48e[_0x87ed('0x3c')]=qs[_0x87ed('0x3d')](_0xad00b6[_0x87ed('0x33')]['sort']);_0x10d48e[_0x87ed('0x3e')]=qs[_0x87ed('0x35')](_[_0x87ed('0x3f')](_0xad00b6[_0x87ed('0x33')],_0xc1d19[_0x87ed('0x35')]));if(_0xad00b6['query'][_0x87ed('0x40')]){_0x10d48e[_0x87ed('0x3e')]=_[_0x87ed('0x41')](_0x10d48e['where'],{'$or':_[_0x87ed('0x2e')](_0x10d48e['attributes'],function(_0x50e614){var _0x205d3e={};_0x205d3e[_0x50e614]={'$like':'%'+_0xad00b6[_0x87ed('0x33')]['filter']+'%'};return _0x205d3e;})});}_0x10d48e=_[_0x87ed('0x41')]({},_0x10d48e,_0xad00b6[_0x87ed('0x44')]);return _0xc126d2[_0x87ed('0x64')](_0x10d48e);}})[_0x87ed('0x25')](function(_0x59725a){if(_0x59725a){_0xeb433d=_0x59725a[_0x87ed('0x39')];if(!_0xad00b6[_0x87ed('0x33')]['hasOwnProperty'](_0x87ed('0x59'))){_0x10d48e[_0x87ed('0x1e')]=qs[_0x87ed('0x1e')](_0xad00b6[_0x87ed('0x33')][_0x87ed('0x1e')]);_0x10d48e['offset']=qs[_0x87ed('0x3b')](_0xad00b6['query'][_0x87ed('0x3b')]);}return _0xc126d2[_0x87ed('0x64')](_0x10d48e);}})[_0x87ed('0x25')](function(_0x1768d6){if(_0x1768d6){return _0x1768d6?{'count':_0xeb433d,'rows':_0x1768d6}:null;}})[_0x87ed('0x25')](respondWithResult(_0x4acb5d,null))[_0x87ed('0x53')](handleError(_0x4acb5d,null));};exports[_0x87ed('0x66')]=function(_0x12eb08,_0x5447ed,_0x38ea66){var _0x171f13=_0x12eb08[_0x87ed('0x4b')][_0x87ed('0x67')];return db['Team'][_0x87ed('0x45')]({'where':{'id':_0x171f13},'attributes':['id'],'include':[{'model':db[_0x87ed('0x5b')],'as':'Agents','attributes':['id',_0x87ed('0x2c'),_0x87ed('0x68'),_0x87ed('0x69'),_0x87ed('0x6a')],'raw':!![]}]})['then'](function(_0x42c66b){if(_0x42c66b){var _0x5851df=_[_0x87ed('0x6b')](_0x42c66b,function(_0x444b6a){var _0x3a7528=_0x444b6a[_0x87ed('0x27')]({'plain':!![]});return _0x3a7528[_0x87ed('0x6c')];});return db[_0x87ed('0x2f')][_0x87ed('0x50')]({'where':{'id':_0x12eb08[_0x87ed('0x47')]['id']}})[_0x87ed('0x25')](function(_0x6cd8f2){return db[_0x87ed('0x6d')][_0x87ed('0x6e')](function(_0x1d8689){return _0x6cd8f2[_0x87ed('0x66')](_0x171f13,{'transaction':_0x1d8689})[_0x87ed('0x25')](function(){return BPromise[_0x87ed('0x6f')](_0x5851df,function(_0x2447e5){return db[_0x87ed('0x58')][_0x87ed('0x70')]({'where':{'UserId':_0x2447e5['id'],'FaxQueueId':_0x12eb08[_0x87ed('0x47')]['id']},'transaction':_0x1d8689});});})['then'](function(){_0x5851df[_0x87ed('0x71')](function(_0x531e8b){socket[_0x87ed('0x72')](_0x87ed('0x73'),{'UserId':_0x531e8b['id'],'FaxQueueId':_0x6cd8f2['id']});});});});});}})['then'](respondWithStatusCode(_0x5447ed,null))['catch'](handleError(_0x5447ed,null));};exports[_0x87ed('0x74')]=function(_0x12dab5,_0xf6588d,_0x5d796e){return db[_0x87ed('0x65')][_0x87ed('0x45')]({'where':{'id':_0x12dab5[_0x87ed('0x33')][_0x87ed('0x67')]},'attributes':['id'],'include':[{'model':db[_0x87ed('0x5b')],'as':_0x87ed('0x6c'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0xf6588d,null))[_0x87ed('0x25')](function(_0x2205c5){var _0x29ccb4=_[_0x87ed('0x2e')](_0x2205c5,'id');var _0x400a78=[];var _0x609292=[];var _0x241b3a=squel[_0x87ed('0x75')]();_0x241b3a[_0x87ed('0x76')](_0x87ed('0x77'))[_0x87ed('0x78')](_0x87ed('0x79'),'tq')['join'](_0x87ed('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x87ed('0x3e')](_0x87ed('0x7b'),_0x12dab5[_0x87ed('0x47')]['id']);for(var _0x37325f=0x0;_0x37325f<_0x2205c5[_0x87ed('0x39')];_0x37325f+=0x1){let _0x2d886a=_0x2205c5[_0x37325f];for(var _0x164156=0x0;_0x164156<_0x2d886a[_0x87ed('0x6c')][_0x87ed('0x39')];_0x164156+=0x1){let _0x16bb74=_0x2d886a['Agents'][_0x164156];var _0x4346bd=_0x241b3a['clone']();_0x4346bd[_0x87ed('0x3e')](_0x87ed('0x7c'),_0x16bb74['id']);_0x609292[_0x87ed('0x7d')](db[_0x87ed('0x6d')]['query'](_0x4346bd[_0x87ed('0x7e')](),{'type':db[_0x87ed('0x6d')]['QueryTypes'][_0x87ed('0x7f')]})[_0x87ed('0x25')](function(_0xdfc95){if(_0xdfc95[_0x87ed('0x39')]===0x1){return _0x16bb74['id'];}else{var _0x1ab980=_[_0x87ed('0x80')](_[_0x87ed('0x2e')](_0xdfc95,_0x87ed('0x81')),function(_0x55c053){return _[_0x87ed('0x82')](_0x29ccb4,_0x55c053);});if(_0x1ab980){return _0x16bb74['id'];}}}));}}return BPromise[_0x87ed('0x83')](_0x609292)[_0x87ed('0x25')](function(_0xeea5f3){_0x400a78=_(_0x400a78)[_0x87ed('0x84')](_0xeea5f3)['compact']()[_0x87ed('0x85')]();return db[_0x87ed('0x2f')]['find']({'where':{'id':_0x12dab5[_0x87ed('0x47')]['id']}})[_0x87ed('0x25')](function(_0x112ac3){return db[_0x87ed('0x6d')][_0x87ed('0x6e')](function(_0x2801f1){return _0x112ac3[_0x87ed('0x74')](_0x12dab5[_0x87ed('0x33')]['ids'],{'transaction':_0x2801f1})[_0x87ed('0x25')](function(){if(!_['isEmpty'](_0x400a78)){return _0x112ac3['removeAgents'](_0x400a78,{'transaction':_0x2801f1});}})[_0x87ed('0x25')](function(){_0x400a78[_0x87ed('0x71')](function(_0x457e83){socket[_0x87ed('0x72')](_0x87ed('0x86'),{'UserId':_0x457e83,'FaxQueueId':_0x112ac3['id']});});});});});});})[_0x87ed('0x25')](respondWithStatusCode(_0xf6588d,null))[_0x87ed('0x53')](handleError(_0xf6588d,null));};exports[_0x87ed('0x87')]=function(_0x5269a1,_0x3308c0,_0x432d44){return db[_0x87ed('0x2f')][_0x87ed('0x50')]({'where':{'id':_0x5269a1[_0x87ed('0x47')]['id']}})[_0x87ed('0x25')](handleEntityNotFound(_0x3308c0,null))[_0x87ed('0x25')](function(_0x40f0e6){if(_0x40f0e6){return _0x40f0e6[_0x87ed('0x87')](_0x5269a1['body']['ids'],_[_0x87ed('0x88')](_0x5269a1[_0x87ed('0x4b')],[_0x87ed('0x67'),'id'])||{})[_0x87ed('0x89')](function(_0x4bd52d){for(var _0x26a4ce=0x0;_0x26a4ce<_0x5269a1[_0x87ed('0x4b')]['ids'][_0x87ed('0x39')];_0x26a4ce+=0x1){socket[_0x87ed('0x72')](_0x87ed('0x73'),{'UserId':Number(_0x5269a1[_0x87ed('0x4b')][_0x87ed('0x67')][_0x26a4ce]),'FaxQueueId':Number(_0x5269a1[_0x87ed('0x47')]['id'])});}return _0x4bd52d;});}})[_0x87ed('0x25')](respondWithResult(_0x3308c0,null))[_0x87ed('0x53')](handleError(_0x3308c0,null));};exports[_0x87ed('0x8a')]=function(_0x2494ae,_0x363a98,_0xc29636){return db[_0x87ed('0x2f')][_0x87ed('0x50')]({'where':{'id':_0x2494ae[_0x87ed('0x47')]['id']}})[_0x87ed('0x25')](handleEntityNotFound(_0x363a98,null))[_0x87ed('0x25')](function(_0x9de977){if(_0x9de977){return _0x9de977['removeAgents'](_0x2494ae['query']['ids'])[_0x87ed('0x25')](function(){if(_[_0x87ed('0x8b')](_0x2494ae[_0x87ed('0x33')][_0x87ed('0x67')])){for(var _0x492f0b=0x0;_0x492f0b<_0x2494ae[_0x87ed('0x33')][_0x87ed('0x67')][_0x87ed('0x39')];_0x492f0b+=0x1){socket[_0x87ed('0x72')]('userFaxQueue:remove',{'UserId':Number(_0x2494ae[_0x87ed('0x33')][_0x87ed('0x67')][_0x492f0b]),'FaxQueueId':Number(_0x2494ae[_0x87ed('0x47')]['id'])});}}else{socket['emit'](_0x87ed('0x86'),{'UserId':Number(_0x2494ae[_0x87ed('0x33')][_0x87ed('0x67')]),'FaxQueueId':Number(_0x2494ae[_0x87ed('0x47')]['id'])});}});}})['then'](respondWithStatusCode(_0x363a98,null))[_0x87ed('0x53')](handleError(_0x363a98,null));};exports[_0x87ed('0x8c')]=function(_0x3a37c7,_0x4e7d61,_0x43de32){var _0x22fe57={};var _0x9e927={};var _0x51f9c4;var _0x33d73b;return db[_0x87ed('0x2f')][_0x87ed('0x57')]({'where':{'id':_0x3a37c7[_0x87ed('0x47')]['id']}})['then'](handleEntityNotFound(_0x4e7d61,null))[_0x87ed('0x25')](function(_0x2fb2c8){if(_0x2fb2c8){_0x51f9c4=_0x2fb2c8;_0x9e927[_0x87ed('0x32')]=_[_0x87ed('0x34')](db[_0x87ed('0x5b')][_0x87ed('0x30')]);_0x9e927[_0x87ed('0x33')]=_[_0x87ed('0x34')](_0x3a37c7[_0x87ed('0x33')]);_0x9e927[_0x87ed('0x35')]=_[_0x87ed('0x36')](_0x9e927[_0x87ed('0x32')],_0x9e927[_0x87ed('0x33')]);_0x22fe57[_0x87ed('0x37')]=_['intersection'](_0x9e927[_0x87ed('0x32')],qs[_0x87ed('0x38')](_0x3a37c7[_0x87ed('0x33')][_0x87ed('0x38')]));_0x22fe57[_0x87ed('0x37')]=_0x22fe57[_0x87ed('0x37')][_0x87ed('0x39')]?_0x22fe57[_0x87ed('0x37')]:_0x9e927[_0x87ed('0x32')];_0x22fe57[_0x87ed('0x3c')]=qs['sort'](_0x3a37c7['query'][_0x87ed('0x3d')]);_0x22fe57['where']=qs[_0x87ed('0x35')](_[_0x87ed('0x3f')](_0x3a37c7[_0x87ed('0x33')],_0x9e927[_0x87ed('0x35')]));if(_0x3a37c7[_0x87ed('0x33')][_0x87ed('0x40')]){_0x22fe57[_0x87ed('0x3e')]=_[_0x87ed('0x41')](_0x22fe57[_0x87ed('0x3e')],{'$or':_[_0x87ed('0x2e')](_0x22fe57[_0x87ed('0x37')],function(_0x16324a){var _0x2b90db={};_0x2b90db[_0x16324a]={'$like':'%'+_0x3a37c7[_0x87ed('0x33')][_0x87ed('0x40')]+'%'};return _0x2b90db;})});}_0x22fe57=_[_0x87ed('0x41')]({},_0x22fe57,_0x3a37c7[_0x87ed('0x44')]);return _0x51f9c4[_0x87ed('0x8c')](_0x22fe57);}})[_0x87ed('0x25')](function(_0x1288ef){if(_0x1288ef){_0x33d73b=_0x1288ef[_0x87ed('0x39')];if(!_0x3a37c7['query'][_0x87ed('0x3a')](_0x87ed('0x59'))){_0x22fe57['limit']=qs[_0x87ed('0x1e')](_0x3a37c7['query']['limit']);_0x22fe57[_0x87ed('0x3b')]=qs['offset'](_0x3a37c7[_0x87ed('0x33')][_0x87ed('0x3b')]);}return _0x51f9c4['getAgents'](_0x22fe57);}})[_0x87ed('0x25')](function(_0x264b33){if(_0x264b33){return _0x264b33?{'count':_0x33d73b,'rows':_0x264b33}:null;}})[_0x87ed('0x25')](respondWithResult(_0x4e7d61,null))[_0x87ed('0x53')](handleError(_0x4e7d61,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 9141661..b74a90a 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 _0xab5b=['exports','events','../../mysqldb','FaxQueue','save','emit','hasOwnProperty','hook'];(function(_0x122559,_0x3f7929){var _0x4def78=function(_0x5bd487){while(--_0x5bd487){_0x122559['push'](_0x122559['shift']());}};_0x4def78(++_0x3f7929);}(_0xab5b,0x1d1));var _0xbab5=function(_0x35e0e4,_0x162096){_0x35e0e4=_0x35e0e4-0x0;var _0x4589c1=_0xab5b[_0x35e0e4];return _0x4589c1;};'use strict';var EventEmitter=require(_0xbab5('0x0'));var FaxQueue=require(_0xbab5('0x1'))['db'][_0xbab5('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbab5('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x819c50){return function(_0x250610,_0x365730,_0x11e086){FaxQueueEvents[_0xbab5('0x4')](_0x819c50+':'+_0x250610['id'],_0x250610);FaxQueueEvents['emit'](_0x819c50,_0x250610);_0x11e086(null);};}for(var e in events){if(events[_0xbab5('0x5')](e)){var event=events[e];FaxQueue[_0xbab5('0x6')](e,emitEvent(event));}}module[_0xbab5('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x85af=['hasOwnProperty','hook','exports','events','../../mysqldb','FaxQueue','setMaxListeners','update','emit'];(function(_0x485f35,_0x45a0fc){var _0x2ad118=function(_0x296650){while(--_0x296650){_0x485f35['push'](_0x485f35['shift']());}};_0x2ad118(++_0x45a0fc);}(_0x85af,0x6f));var _0xf85a=function(_0x566598,_0x267c66){_0x566598=_0x566598-0x0;var _0x4d9ce5=_0x85af[_0x566598];return _0x4d9ce5;};'use strict';var EventEmitter=require(_0xf85a('0x0'));var FaxQueue=require(_0xf85a('0x1'))['db'][_0xf85a('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xf85a('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xf85a('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4e8831){return function(_0x3c321f,_0x2ad094,_0x358bc7){FaxQueueEvents[_0xf85a('0x5')](_0x4e8831+':'+_0x3c321f['id'],_0x3c321f);FaxQueueEvents['emit'](_0x4e8831,_0x3c321f);_0x358bc7(null);};}for(var e in events){if(events[_0xf85a('0x6')](e)){var event=events[e];FaxQueue[_0xf85a('0x7')](e,emitEvent(event));}}module[_0xf85a('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index d21650d..d578524 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 _0x4688=['api','moment','rimraf','../../config/environment','define','FaxQueue','fax_queues','util','../../config/logger'];(function(_0x55cf0a,_0x547793){var _0x367227=function(_0xf06910){while(--_0xf06910){_0x55cf0a['push'](_0x55cf0a['shift']());}};_0x367227(++_0x547793);}(_0x4688,0x10c));var _0x8468=function(_0x1c0261,_0xbe62af){_0x1c0261=_0x1c0261-0x0;var _0x1f81d0=_0x4688[_0x1c0261];return _0x1f81d0;};'use strict';var _=require('lodash');var util=require(_0x8468('0x0'));var logger=require(_0x8468('0x1'))(_0x8468('0x2'));var moment=require(_0x8468('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8468('0x4'));var config=require(_0x8468('0x5'));var attributes=require('./faxQueue.attributes');module['exports']=function(_0xfb1456,_0x45b236){return _0xfb1456[_0x8468('0x6')](_0x8468('0x7'),attributes,{'tableName':_0x8468('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x533b=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./faxQueue.attributes','exports','fax_queues','util'];(function(_0x11a55c,_0x4eced9){var _0x26c390=function(_0x5b0662){while(--_0x5b0662){_0x11a55c['push'](_0x11a55c['shift']());}};_0x26c390(++_0x4eced9);}(_0x533b,0x18b));var _0xb533=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x533b[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0xb533('0x0'));var logger=require(_0xb533('0x1'))(_0xb533('0x2'));var moment=require(_0xb533('0x3'));var BPromise=require(_0xb533('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb533('0x5'));var rimraf=require(_0xb533('0x6'));var config=require(_0xb533('0x7'));var attributes=require(_0xb533('0x8'));module[_0xb533('0x9')]=function(_0x2e1d5f,_0x15e56e){return _0x2e1d5f['define']('FaxQueue',attributes,{'tableName':_0xb533('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 23eac3d..7de9060 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 _0xef37=['register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','map','model','debug','catch','ShowFaxQueue','find','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x4ae625,_0xf396d0){var _0x31accf=function(_0x3ded6b){while(--_0x3ded6b){_0x4ae625['push'](_0x4ae625['shift']());}};_0x31accf(++_0xf396d0);}(_0xef37,0x96));var _0x7ef3=function(_0x45dd91,_0x28e7df){_0x45dd91=_0x45dd91-0x0;var _0x32eea1=_0xef37[_0x45dd91];return _0x32eea1;};'use strict';var _=require('lodash');var util=require(_0x7ef3('0x0'));var moment=require(_0x7ef3('0x1'));var BPromise=require(_0x7ef3('0x2'));var rs=require(_0x7ef3('0x3'));var fs=require('fs');var Redis=require(_0x7ef3('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7ef3('0x5'))(_0x7ef3('0x6'));var config=require('../../config/environment');var jayson=require(_0x7ef3('0x7'));var client=jayson[_0x7ef3('0x8')][_0x7ef3('0x9')]({'port':0x232a});config[_0x7ef3('0xa')]=_[_0x7ef3('0xb')](config['redis'],{'host':_0x7ef3('0xc'),'port':0x18eb});var socket=require(_0x7ef3('0xd'))(new Redis(config[_0x7ef3('0xa')]));require('./faxQueue.socket')[_0x7ef3('0xe')](socket);function respondWithRpcPromise(_0xce3239,_0x32cfb8,_0x40fa11){return new BPromise(function(_0x196014,_0x5b1f54){return client[_0x7ef3('0xf')](_0xce3239,_0x40fa11)[_0x7ef3('0x10')](function(_0x1994ca){logger[_0x7ef3('0x11')](_0x7ef3('0x12'),_0x32cfb8,_0x7ef3('0x13'));logger['debug'](_0x7ef3('0x14'),_0x32cfb8,_0x7ef3('0x13'),JSON[_0x7ef3('0x15')](_0x1994ca));if(_0x1994ca[_0x7ef3('0x16')]){if(_0x1994ca['error'][_0x7ef3('0x17')]===0x1f4){logger[_0x7ef3('0x16')](_0x7ef3('0x12'),_0x32cfb8,_0x1994ca[_0x7ef3('0x16')]['message']);return _0x5b1f54(_0x1994ca[_0x7ef3('0x16')][_0x7ef3('0x18')]);}logger[_0x7ef3('0x16')](_0x7ef3('0x12'),_0x32cfb8,_0x1994ca['error'][_0x7ef3('0x18')]);return _0x196014(_0x1994ca[_0x7ef3('0x16')][_0x7ef3('0x18')]);}else{logger[_0x7ef3('0x11')](_0x7ef3('0x12'),_0x32cfb8,_0x7ef3('0x13'));_0x196014(_0x1994ca[_0x7ef3('0x19')][_0x7ef3('0x18')]);}})['catch'](function(_0x5a246c){logger[_0x7ef3('0x16')](_0x7ef3('0x12'),_0x32cfb8,_0x5a246c);_0x5b1f54(_0x5a246c);});});}exports[_0x7ef3('0x1a')]=function(_0x5ea677){var _0x42e354=this;return new Promise(function(_0xefd29b,_0x348f6e){return db[_0x7ef3('0x1b')][_0x7ef3('0x1c')]({'raw':_0x5ea677[_0x7ef3('0x1d')]?_0x5ea677[_0x7ef3('0x1d')][_0x7ef3('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ea677[_0x7ef3('0x1d')]?_0x5ea677[_0x7ef3('0x1d')][_0x7ef3('0x1f')]||null:null,'attributes':_0x5ea677[_0x7ef3('0x1d')]?_0x5ea677[_0x7ef3('0x1d')][_0x7ef3('0x20')]||null:null,'limit':_0x5ea677[_0x7ef3('0x1d')]?_0x5ea677[_0x7ef3('0x1d')][_0x7ef3('0x21')]||null:null,'include':_0x5ea677['options']?_0x5ea677['options'][_0x7ef3('0x22')]?_[_0x7ef3('0x23')](_0x5ea677[_0x7ef3('0x1d')][_0x7ef3('0x22')],function(_0xae48e9){return{'model':db[_0xae48e9[_0x7ef3('0x24')]],'as':_0xae48e9['as'],'attributes':_0xae48e9[_0x7ef3('0x20')],'include':_0xae48e9['include']?_[_0x7ef3('0x23')](_0xae48e9['include'],function(_0x302d02){return{'model':db[_0x302d02[_0x7ef3('0x24')]],'as':_0x302d02['as'],'attributes':_0x302d02[_0x7ef3('0x20')],'include':_0x302d02['include']?_[_0x7ef3('0x23')](_0x302d02[_0x7ef3('0x22')],function(_0x11af7b){return{'model':db[_0x11af7b[_0x7ef3('0x24')]],'as':_0x11af7b['as'],'attributes':_0x11af7b[_0x7ef3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7ef3('0x10')](function(_0x297ed1){logger[_0x7ef3('0x11')](_0x7ef3('0x1a'),_0x5ea677);logger[_0x7ef3('0x25')](_0x7ef3('0x1a'),_0x5ea677,JSON[_0x7ef3('0x15')](_0x297ed1));_0xefd29b(_0x297ed1);})[_0x7ef3('0x26')](function(_0x99deff){logger[_0x7ef3('0x16')]('GetFaxQueue',_0x99deff[_0x7ef3('0x18')],_0x5ea677);_0x348f6e(_0x42e354[_0x7ef3('0x16')](0x1f4,_0x99deff[_0x7ef3('0x18')]));});});};exports[_0x7ef3('0x27')]=function(_0x30ab03){var _0x1d7991=this;return new Promise(function(_0x56ed04,_0x506b70){return db[_0x7ef3('0x1b')][_0x7ef3('0x28')]({'raw':_0x30ab03['options']?_0x30ab03[_0x7ef3('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x30ab03['options']?_0x30ab03[_0x7ef3('0x1d')][_0x7ef3('0x1f')]||null:null,'attributes':_0x30ab03[_0x7ef3('0x1d')]?_0x30ab03[_0x7ef3('0x1d')][_0x7ef3('0x20')]||null:null,'include':_0x30ab03[_0x7ef3('0x1d')]?_0x30ab03[_0x7ef3('0x1d')][_0x7ef3('0x22')]?_[_0x7ef3('0x23')](_0x30ab03['options'][_0x7ef3('0x22')],function(_0x424d86){return{'model':db[_0x424d86['model']],'as':_0x424d86['as'],'attributes':_0x424d86[_0x7ef3('0x20')],'include':_0x424d86[_0x7ef3('0x22')]?_[_0x7ef3('0x23')](_0x424d86[_0x7ef3('0x22')],function(_0x4a218e){return{'model':db[_0x4a218e[_0x7ef3('0x24')]],'as':_0x4a218e['as'],'attributes':_0x4a218e['attributes'],'include':_0x4a218e[_0x7ef3('0x22')]?_['map'](_0x4a218e['include'],function(_0x5b4243){return{'model':db[_0x5b4243[_0x7ef3('0x24')]],'as':_0x5b4243['as'],'attributes':_0x5b4243[_0x7ef3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x7ef3('0x10')](function(_0x59cd5d){logger[_0x7ef3('0x11')](_0x7ef3('0x27'),_0x30ab03);logger[_0x7ef3('0x25')](_0x7ef3('0x27'),_0x30ab03,JSON[_0x7ef3('0x15')](_0x59cd5d));_0x56ed04(_0x59cd5d);})['catch'](function(_0x42e161){logger[_0x7ef3('0x16')](_0x7ef3('0x27'),_0x42e161[_0x7ef3('0x18')],_0x30ab03);_0x506b70(_0x1d7991[_0x7ef3('0x16')](0x1f4,_0x42e161[_0x7ef3('0x18')]));});});}; \ No newline at end of file +var _0x6164=['socket.io-emitter','./faxQueue.socket','register','request','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','FaxQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','GetFaxQueue','FaxQueue','findAll','options','raw','attributes','model','include','map','then','ShowFaxQueue','find','where','stringify','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost'];(function(_0x2246f2,_0x32d10d){var _0x57438f=function(_0xafc755){while(--_0xafc755){_0x2246f2['push'](_0x2246f2['shift']());}};_0x57438f(++_0x32d10d);}(_0x6164,0xee));var _0x4616=function(_0x2cde0a,_0x1f9695){_0x2cde0a=_0x2cde0a-0x0;var _0x260610=_0x6164[_0x2cde0a];return _0x260610;};'use strict';var _=require(_0x4616('0x0'));var util=require(_0x4616('0x1'));var moment=require(_0x4616('0x2'));var BPromise=require(_0x4616('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4616('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x4616('0x5'));var logger=require(_0x4616('0x6'))(_0x4616('0x7'));var config=require(_0x4616('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4616('0x9')][_0x4616('0xa')]({'port':0x232a});config[_0x4616('0xb')]=_[_0x4616('0xc')](config[_0x4616('0xb')],{'host':_0x4616('0xd'),'port':0x18eb});var socket=require(_0x4616('0xe'))(new Redis(config[_0x4616('0xb')]));require(_0x4616('0xf'))[_0x4616('0x10')](socket);function respondWithRpcPromise(_0x3ced64,_0x4b0bfa,_0x4066b6){return new BPromise(function(_0x2f95c1,_0x2f8fb8){return client[_0x4616('0x11')](_0x3ced64,_0x4066b6)['then'](function(_0x573b00){logger['info'](_0x4616('0x12'),_0x4b0bfa,_0x4616('0x13'));logger[_0x4616('0x14')](_0x4616('0x15'),_0x4b0bfa,'request\x20sent',JSON['stringify'](_0x573b00));if(_0x573b00[_0x4616('0x16')]){if(_0x573b00[_0x4616('0x16')][_0x4616('0x17')]===0x1f4){logger[_0x4616('0x16')](_0x4616('0x12'),_0x4b0bfa,_0x573b00[_0x4616('0x16')]['message']);return _0x2f8fb8(_0x573b00[_0x4616('0x16')][_0x4616('0x18')]);}logger['error'](_0x4616('0x12'),_0x4b0bfa,_0x573b00['error'][_0x4616('0x18')]);return _0x2f95c1(_0x573b00['error'][_0x4616('0x18')]);}else{logger[_0x4616('0x19')]('FaxQueue,\x20%s,\x20%s',_0x4b0bfa,'request\x20sent');_0x2f95c1(_0x573b00[_0x4616('0x1a')][_0x4616('0x18')]);}})[_0x4616('0x1b')](function(_0xbbd13){logger['error'](_0x4616('0x12'),_0x4b0bfa,_0xbbd13);_0x2f8fb8(_0xbbd13);});});}exports[_0x4616('0x1c')]=function(_0x1ad9ae){var _0x4399e0=this;return new Promise(function(_0x281a7c,_0x325f07){return db[_0x4616('0x1d')][_0x4616('0x1e')]({'raw':_0x1ad9ae[_0x4616('0x1f')]?_0x1ad9ae[_0x4616('0x1f')][_0x4616('0x20')]===undefined?!![]:![]:!![],'where':_0x1ad9ae[_0x4616('0x1f')]?_0x1ad9ae[_0x4616('0x1f')]['where']||null:null,'attributes':_0x1ad9ae[_0x4616('0x1f')]?_0x1ad9ae[_0x4616('0x1f')][_0x4616('0x21')]||null:null,'limit':_0x1ad9ae[_0x4616('0x1f')]?_0x1ad9ae[_0x4616('0x1f')]['limit']||null:null,'include':_0x1ad9ae['options']?_0x1ad9ae[_0x4616('0x1f')]['include']?_['map'](_0x1ad9ae[_0x4616('0x1f')]['include'],function(_0x1a38fb){return{'model':db[_0x1a38fb[_0x4616('0x22')]],'as':_0x1a38fb['as'],'attributes':_0x1a38fb[_0x4616('0x21')],'include':_0x1a38fb[_0x4616('0x23')]?_[_0x4616('0x24')](_0x1a38fb['include'],function(_0xad7a47){return{'model':db[_0xad7a47[_0x4616('0x22')]],'as':_0xad7a47['as'],'attributes':_0xad7a47[_0x4616('0x21')],'include':_0xad7a47[_0x4616('0x23')]?_[_0x4616('0x24')](_0xad7a47[_0x4616('0x23')],function(_0x1f0441){return{'model':db[_0x1f0441[_0x4616('0x22')]],'as':_0x1f0441['as'],'attributes':_0x1f0441[_0x4616('0x21')]};}):[]};}):[]};}):[]:[]})[_0x4616('0x25')](function(_0x23447a){logger['info']('GetFaxQueue',_0x1ad9ae);logger['debug'](_0x4616('0x1c'),_0x1ad9ae,JSON['stringify'](_0x23447a));_0x281a7c(_0x23447a);})['catch'](function(_0x324320){logger[_0x4616('0x16')](_0x4616('0x1c'),_0x324320[_0x4616('0x18')],_0x1ad9ae);_0x325f07(_0x4399e0[_0x4616('0x16')](0x1f4,_0x324320[_0x4616('0x18')]));});});};exports[_0x4616('0x26')]=function(_0x2f0218){var _0x1eb612=this;return new Promise(function(_0x10f304,_0x25977b){return db[_0x4616('0x1d')][_0x4616('0x27')]({'raw':_0x2f0218[_0x4616('0x1f')]?_0x2f0218[_0x4616('0x1f')]['raw']===undefined?!![]:![]:!![],'where':_0x2f0218[_0x4616('0x1f')]?_0x2f0218['options'][_0x4616('0x28')]||null:null,'attributes':_0x2f0218['options']?_0x2f0218[_0x4616('0x1f')][_0x4616('0x21')]||null:null,'include':_0x2f0218[_0x4616('0x1f')]?_0x2f0218[_0x4616('0x1f')][_0x4616('0x23')]?_[_0x4616('0x24')](_0x2f0218[_0x4616('0x1f')][_0x4616('0x23')],function(_0x3efb63){return{'model':db[_0x3efb63[_0x4616('0x22')]],'as':_0x3efb63['as'],'attributes':_0x3efb63[_0x4616('0x21')],'include':_0x3efb63[_0x4616('0x23')]?_['map'](_0x3efb63['include'],function(_0x538e05){return{'model':db[_0x538e05[_0x4616('0x22')]],'as':_0x538e05['as'],'attributes':_0x538e05[_0x4616('0x21')],'include':_0x538e05[_0x4616('0x23')]?_[_0x4616('0x24')](_0x538e05[_0x4616('0x23')],function(_0x1d59ce){return{'model':db[_0x1d59ce[_0x4616('0x22')]],'as':_0x1d59ce['as'],'attributes':_0x1d59ce['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58ff06){logger[_0x4616('0x19')](_0x4616('0x26'),_0x2f0218);logger[_0x4616('0x14')](_0x4616('0x26'),_0x2f0218,JSON[_0x4616('0x29')](_0x58ff06));_0x10f304(_0x58ff06);})['catch'](function(_0x4b8dc7){logger[_0x4616('0x16')](_0x4616('0x26'),_0x4b8dc7[_0x4616('0x18')],_0x2f0218);_0x25977b(_0x1eb612[_0x4616('0x16')](0x1f4,_0x4b8dc7[_0x4616('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index 2c0780a..8ca80d1 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 _0x738c=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','save','remove','update'];(function(_0x7cd4e8,_0x454d1e){var _0x386720=function(_0x5752d0){while(--_0x5752d0){_0x7cd4e8['push'](_0x7cd4e8['shift']());}};_0x386720(++_0x454d1e);}(_0x738c,0xc2));var _0xc738=function(_0x5c86f8,_0x584d10){_0x5c86f8=_0x5c86f8-0x0;var _0x161119=_0x738c[_0x5c86f8];return _0x161119;};'use strict';var FaxQueueEvents=require(_0xc738('0x0'));var events=[_0xc738('0x1'),_0xc738('0x2'),_0xc738('0x3')];function createListener(_0x2c1c4a,_0x5952b5){return function(_0x488ee5){_0x5952b5[_0xc738('0x4')](_0x2c1c4a,_0x488ee5);};}function removeListener(_0x44b8f1,_0x53c3e5){return function(){FaxQueueEvents[_0xc738('0x5')](_0x44b8f1,_0x53c3e5);};}exports[_0xc738('0x6')]=function(_0x15dc17){for(var _0x5f3ce1=0x0,_0x375b61=events[_0xc738('0x7')];_0x5f3ce1<_0x375b61;_0x5f3ce1++){var _0x394480=events[_0x5f3ce1];var _0x1fb504=createListener(_0xc738('0x8')+_0x394480,_0x15dc17);FaxQueueEvents['on'](_0x394480,_0x1fb504);}}; \ No newline at end of file +var _0x9709=['emit','removeListener','register','length','faxQueue:','./faxQueue.events','save'];(function(_0x72937c,_0x6f3a05){var _0x4e01c8=function(_0x45e94c){while(--_0x45e94c){_0x72937c['push'](_0x72937c['shift']());}};_0x4e01c8(++_0x6f3a05);}(_0x9709,0x91));var _0x9970=function(_0x58b603,_0x450f6d){_0x58b603=_0x58b603-0x0;var _0xf76126=_0x9709[_0x58b603];return _0xf76126;};'use strict';var FaxQueueEvents=require(_0x9970('0x0'));var events=[_0x9970('0x1'),'remove','update'];function createListener(_0x2caf3d,_0xc47422){return function(_0x2977bc){_0xc47422[_0x9970('0x2')](_0x2caf3d,_0x2977bc);};}function removeListener(_0x3423ae,_0x9dc318){return function(){FaxQueueEvents[_0x9970('0x3')](_0x3423ae,_0x9dc318);};}exports[_0x9970('0x4')]=function(_0x138150){for(var _0x297f2a=0x0,_0x15783f=events[_0x9970('0x5')];_0x297f2a<_0x15783f;_0x297f2a++){var _0x4e8401=events[_0x297f2a];var _0xdcde4a=createListener(_0x9970('0x6')+_0x4e8401,_0x138150);FaxQueueEvents['on'](_0x4e8401,_0xdcde4a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 6c49ec4..3d965e7 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 _0x9b0d=['exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','put','update','delete','removeTeams'];(function(_0x26ddfc,_0x4e1d54){var _0x4092c8=function(_0x1bf8b5){while(--_0x1bf8b5){_0x26ddfc['push'](_0x26ddfc['shift']());}};_0x4092c8(++_0x4e1d54);}(_0x9b0d,0xb7));var _0xd9b0=function(_0x369ac4,_0x5d57a5){_0x369ac4=_0x369ac4-0x0;var _0x46ec45=_0x9b0d[_0x369ac4];return _0x46ec45;};'use strict';var multer=require('multer');var util=require(_0xd9b0('0x0'));var path=require(_0xd9b0('0x1'));var timeout=require(_0xd9b0('0x2'));var express=require(_0xd9b0('0x3'));var router=express['Router']();var fs_extra=require(_0xd9b0('0x4'));var auth=require(_0xd9b0('0x5'));var interaction=require(_0xd9b0('0x6'));var config=require(_0xd9b0('0x7'));var controller=require('./faxQueue.controller');router[_0xd9b0('0x8')]('/',auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xa')]);router[_0xd9b0('0x8')](_0xd9b0('0xb'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xc')]);router['get'](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller['show']);router[_0xd9b0('0x8')]('/:id/members',auth[_0xd9b0('0x9')](),controller['getMembers']);router[_0xd9b0('0x8')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0xf')]);router[_0xd9b0('0x8')](_0xd9b0('0x10'),auth['isAuthenticated'](),controller[_0xd9b0('0x11')]);router[_0xd9b0('0x12')]('/',auth['isAuthenticated'](),controller[_0xd9b0('0x13')]);router[_0xd9b0('0x12')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x14')]);router[_0xd9b0('0x12')]('/:id/users',auth[_0xd9b0('0x9')](),controller['addAgents']);router[_0xd9b0('0x15')](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x16')]);router[_0xd9b0('0x17')](_0xd9b0('0xd'),auth[_0xd9b0('0x9')](),controller['destroy']);router[_0xd9b0('0x17')](_0xd9b0('0xe'),auth[_0xd9b0('0x9')](),controller[_0xd9b0('0x18')]);router[_0xd9b0('0x17')](_0xd9b0('0x10'),auth[_0xd9b0('0x9')](),controller['removeAgents']);module[_0xd9b0('0x19')]=router; \ No newline at end of file +var _0x50a5=['exports','multer','util','fs-extra','../../components/interaction/service','../../config/environment','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addAgents','update','delete','destroy','removeAgents'];(function(_0x54eaf4,_0x470777){var _0x570ae3=function(_0x131993){while(--_0x131993){_0x54eaf4['push'](_0x54eaf4['shift']());}};_0x570ae3(++_0x470777);}(_0x50a5,0xd1));var _0x550a=function(_0x4791fb,_0x48991d){_0x4791fb=_0x4791fb-0x0;var _0x199ddc=_0x50a5[_0x4791fb];return _0x199ddc;};'use strict';var multer=require(_0x550a('0x0'));var util=require(_0x550a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x550a('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x550a('0x3'));var config=require(_0x550a('0x4'));var controller=require(_0x550a('0x5'));router[_0x550a('0x6')]('/',auth[_0x550a('0x7')](),controller[_0x550a('0x8')]);router[_0x550a('0x6')](_0x550a('0x9'),auth[_0x550a('0x7')](),controller[_0x550a('0xa')]);router[_0x550a('0x6')](_0x550a('0xb'),auth[_0x550a('0x7')](),controller['show']);router[_0x550a('0x6')](_0x550a('0xc'),auth[_0x550a('0x7')](),controller[_0x550a('0xd')]);router[_0x550a('0x6')](_0x550a('0xe'),auth['isAuthenticated'](),controller[_0x550a('0xf')]);router[_0x550a('0x6')](_0x550a('0x10'),auth[_0x550a('0x7')](),controller[_0x550a('0x11')]);router[_0x550a('0x12')]('/',auth[_0x550a('0x7')](),controller[_0x550a('0x13')]);router['post'](_0x550a('0xe'),auth['isAuthenticated'](),controller['addTeams']);router[_0x550a('0x12')](_0x550a('0x10'),auth['isAuthenticated'](),controller[_0x550a('0x14')]);router['put'](_0x550a('0xb'),auth['isAuthenticated'](),controller[_0x550a('0x15')]);router[_0x550a('0x16')](_0x550a('0xb'),auth[_0x550a('0x7')](),controller[_0x550a('0x17')]);router[_0x550a('0x16')]('/:id/teams',auth[_0x550a('0x7')](),controller['removeTeams']);router[_0x550a('0x16')](_0x550a('0x10'),auth[_0x550a('0x7')](),controller[_0x550a('0x18')]);module[_0x550a('0x19')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index f9da073..a739994 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 _0xba22=['moment','sequelize','STRING','DATE'];(function(_0x5692e1,_0x328a50){var _0xa981de=function(_0x55548e){while(--_0x55548e){_0x5692e1['push'](_0x5692e1['shift']());}};_0xa981de(++_0x328a50);}(_0xba22,0x1c0));var _0x2ba2=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xba22[_0x376b45];return _0x2341b3;};'use strict';var moment=require(_0x2ba2('0x0'));var Sequelize=require(_0x2ba2('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x2ba2('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x2ba2('0x2')]},'joinAt':{'type':Sequelize[_0x2ba2('0x3')]},'leaveAt':{'type':Sequelize[_0x2ba2('0x3')]},'acceptAt':{'type':Sequelize[_0x2ba2('0x3')]},'exitAt':{'type':Sequelize[_0x2ba2('0x3')]},'reason':{'type':Sequelize[_0x2ba2('0x2')]}}; \ No newline at end of file +var _0x0b36=['sequelize','exports','STRING','DATE'];(function(_0x52e0ee,_0x52f7c1){var _0x32534c=function(_0x535d65){while(--_0x535d65){_0x52e0ee['push'](_0x52e0ee['shift']());}};_0x32534c(++_0x52f7c1);}(_0x0b36,0x80));var _0x60b3=function(_0x38a876,_0x427f22){_0x38a876=_0x38a876-0x0;var _0x50a71f=_0x0b36[_0x38a876];return _0x50a71f;};'use strict';var moment=require('moment');var Sequelize=require(_0x60b3('0x0'));module[_0x60b3('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x60b3('0x2')]},'joinAt':{'type':Sequelize[_0x60b3('0x3')]},'leaveAt':{'type':Sequelize[_0x60b3('0x3')]},'acceptAt':{'type':Sequelize[_0x60b3('0x3')]},'exitAt':{'type':Sequelize[_0x60b3('0x3')]},'reason':{'type':Sequelize[_0x60b3('0x2')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 5c446a6..a58a616 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 _0x6584=['merge','includeAll','rows','catch','show','params','length','include','options','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','api','../../config/environment','../../mysqldb','sendStatus','status','undefined','count','offset','set','Content-Range','json','apply','reject','update','then','end','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','type'];(function(_0xaa90f9,_0x2c4f0c){var _0x16de8d=function(_0x4a180e){while(--_0x4a180e){_0xaa90f9['push'](_0xaa90f9['shift']());}};_0x16de8d(++_0x2c4f0c);}(_0x6584,0x175));var _0x4658=function(_0x1db251,_0xf0443d){_0x1db251=_0x1db251-0x0;var _0x56685a=_0x6584[_0x1db251];return _0x56685a;};'use strict';var emlformat=require(_0x4658('0x0'));var rimraf=require(_0x4658('0x1'));var zipdir=require(_0x4658('0x2'));var jsonpatch=require(_0x4658('0x3'));var rp=require('request-promise');var moment=require(_0x4658('0x4'));var BPromise=require(_0x4658('0x5'));var Mustache=require(_0x4658('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4658('0x7'));var csv=require(_0x4658('0x8'));var ejs=require(_0x4658('0x9'));var fs=require('fs');var fs_extra=require(_0x4658('0xa'));var _=require(_0x4658('0xb'));var squel=require('squel');var crypto=require(_0x4658('0xc'));var jsforce=require(_0x4658('0xd'));var deskjs=require(_0x4658('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4658('0xf'));var Papa=require(_0x4658('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4658('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4658('0x12'));var logger=require('../../config/logger')(_0x4658('0x13'));var utils=require('../../config/utils');var config=require(_0x4658('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x4658('0x15'))['db'];function respondWithStatusCode(_0x243444,_0x424206){_0x424206=_0x424206||0xcc;return function(_0x4eb5e5){if(_0x4eb5e5){return _0x243444[_0x4658('0x16')](_0x424206);}return _0x243444[_0x4658('0x17')](_0x424206)['end']();};}function respondWithResult(_0x4d3821,_0x18de39){_0x18de39=_0x18de39||0xc8;return function(_0x5cf165){if(_0x5cf165){return _0x4d3821[_0x4658('0x17')](_0x18de39)['json'](_0x5cf165);}};}function respondWithFilteredResult(_0x10c558,_0x2702b6){return function(_0x4a506c){if(_0x4a506c){var _0x27aede=typeof _0x2702b6['offset']==='undefined'&&typeof _0x2702b6['limit']===_0x4658('0x18');var _0x48b230=_0x4a506c[_0x4658('0x19')];var _0x3237e5=_0x27aede?0x0:_0x2702b6[_0x4658('0x1a')];var _0x1c9d11=_0x27aede?_0x4a506c[_0x4658('0x19')]:_0x2702b6[_0x4658('0x1a')]+_0x2702b6['limit'];var _0x5b4c93;if(_0x1c9d11>=_0x48b230){_0x1c9d11=_0x48b230;_0x5b4c93=0xc8;}else{_0x5b4c93=0xce;}_0x10c558[_0x4658('0x17')](_0x5b4c93);return _0x10c558[_0x4658('0x1b')](_0x4658('0x1c'),_0x3237e5+'-'+_0x1c9d11+'/'+_0x48b230)[_0x4658('0x1d')](_0x4a506c);}return null;};}function patchUpdates(_0x2e926f){return function(_0x4a5617){try{jsonpatch[_0x4658('0x1e')](_0x4a5617,_0x2e926f,!![]);}catch(_0x29a18f){return BPromise[_0x4658('0x1f')](_0x29a18f);}return _0x4a5617['save']();};}function saveUpdates(_0x2eb16d,_0x1625dc){return function(_0x2ffe7a){if(_0x2ffe7a){return _0x2ffe7a[_0x4658('0x20')](_0x2eb16d)[_0x4658('0x21')](function(_0x44f09a){return _0x44f09a;});}return null;};}function removeEntity(_0x265fab,_0x546b71){return function(_0x304ca4){if(_0x304ca4){return _0x304ca4['destroy']()[_0x4658('0x21')](function(){_0x265fab[_0x4658('0x17')](0xcc)[_0x4658('0x22')]();});}};}function handleEntityNotFound(_0x25ccb,_0x2f2f7a){return function(_0x58f99a){if(!_0x58f99a){_0x25ccb[_0x4658('0x16')](0x194);}return _0x58f99a;};}function handleError(_0x20586c,_0x36a9b7){_0x36a9b7=_0x36a9b7||0x1f4;return function(_0x39f885){logger[_0x4658('0x23')](_0x39f885[_0x4658('0x24')]);if(_0x39f885[_0x4658('0x25')]){delete _0x39f885[_0x4658('0x25')];}_0x20586c[_0x4658('0x17')](_0x36a9b7)['send'](_0x39f885);};}exports[_0x4658('0x26')]=function(_0x274edd,_0x36eaaa){var _0xb97c92={},_0x5dfa9c={},_0xb2a131={'count':0x0,'rows':[]};var _0x434e3f=_[_0x4658('0x27')](db[_0x4658('0x28')][_0x4658('0x29')],function(_0x53a133){return{'name':_0x53a133[_0x4658('0x2a')],'type':_0x53a133['type'][_0x4658('0x2b')]};});_0x5dfa9c[_0x4658('0x2c')]=_[_0x4658('0x27')](_0x434e3f,'name');_0x5dfa9c[_0x4658('0x2d')]=_[_0x4658('0x2e')](_0x274edd[_0x4658('0x2d')]);_0x5dfa9c[_0x4658('0x2f')]=_[_0x4658('0x30')](_0x5dfa9c[_0x4658('0x2c')],_0x5dfa9c['query']);_0xb97c92[_0x4658('0x31')]=_[_0x4658('0x30')](_0x5dfa9c[_0x4658('0x2c')],qs[_0x4658('0x32')](_0x274edd['query'][_0x4658('0x32')]));_0xb97c92[_0x4658('0x31')]=_0xb97c92[_0x4658('0x31')]['length']?_0xb97c92['attributes']:_0x5dfa9c[_0x4658('0x2c')];if(!_0x274edd[_0x4658('0x2d')][_0x4658('0x33')]('nolimit')){_0xb97c92[_0x4658('0x34')]=qs[_0x4658('0x34')](_0x274edd[_0x4658('0x2d')]['limit']);_0xb97c92[_0x4658('0x1a')]=qs[_0x4658('0x1a')](_0x274edd[_0x4658('0x2d')][_0x4658('0x1a')]);}_0xb97c92[_0x4658('0x35')]=qs[_0x4658('0x36')](_0x274edd[_0x4658('0x2d')][_0x4658('0x36')]);_0xb97c92[_0x4658('0x37')]=qs[_0x4658('0x2f')](_[_0x4658('0x38')](_0x274edd[_0x4658('0x2d')],_0x5dfa9c['filters']),_0x434e3f);if(_0x274edd[_0x4658('0x2d')][_0x4658('0x39')]){_0xb97c92[_0x4658('0x37')]=_['merge'](_0xb97c92[_0x4658('0x37')],{'$or':_['map'](_0x434e3f,function(_0x3339dc){if(_0x3339dc[_0x4658('0x3a')]!=='VIRTUAL'){var _0x4530f6={};_0x4530f6[_0x3339dc[_0x4658('0x25')]]={'$like':'%'+_0x274edd[_0x4658('0x2d')][_0x4658('0x39')]+'%'};return _0x4530f6;}})});}_0xb97c92=_[_0x4658('0x3b')]({},_0xb97c92,_0x274edd['options']);var _0x169602={'where':_0xb97c92['where']};return db[_0x4658('0x28')][_0x4658('0x19')](_0x169602)[_0x4658('0x21')](function(_0xda0223){_0xb2a131[_0x4658('0x19')]=_0xda0223;if(_0x274edd['query'][_0x4658('0x3c')]){_0xb97c92['include']=[{'all':!![]}];}return db[_0x4658('0x28')]['findAll'](_0xb97c92);})[_0x4658('0x21')](function(_0x716f9d){_0xb2a131[_0x4658('0x3d')]=_0x716f9d;return _0xb2a131;})[_0x4658('0x21')](respondWithFilteredResult(_0x36eaaa,_0xb97c92))[_0x4658('0x3e')](handleError(_0x36eaaa,null));};exports[_0x4658('0x3f')]=function(_0x186a11,_0x5c1b50){var _0x2d8e77={'raw':!![],'where':{'id':_0x186a11[_0x4658('0x40')]['id']}},_0x4c6e54={};_0x4c6e54[_0x4658('0x2c')]=_[_0x4658('0x2e')](db['FaxQueueReport'][_0x4658('0x29')]);_0x4c6e54['query']=_['keys'](_0x186a11[_0x4658('0x2d')]);_0x4c6e54['filters']=_[_0x4658('0x30')](_0x4c6e54['model'],_0x4c6e54[_0x4658('0x2d')]);_0x2d8e77['attributes']=_[_0x4658('0x30')](_0x4c6e54[_0x4658('0x2c')],qs['fields'](_0x186a11[_0x4658('0x2d')][_0x4658('0x32')]));_0x2d8e77['attributes']=_0x2d8e77[_0x4658('0x31')][_0x4658('0x41')]?_0x2d8e77['attributes']:_0x4c6e54[_0x4658('0x2c')];if(_0x186a11[_0x4658('0x2d')][_0x4658('0x3c')]){_0x2d8e77[_0x4658('0x42')]=[{'all':!![]}];}_0x2d8e77=_[_0x4658('0x3b')]({},_0x2d8e77,_0x186a11[_0x4658('0x43')]);return db[_0x4658('0x28')][_0x4658('0x44')](_0x2d8e77)[_0x4658('0x21')](handleEntityNotFound(_0x5c1b50,null))[_0x4658('0x21')](respondWithResult(_0x5c1b50,null))[_0x4658('0x3e')](handleError(_0x5c1b50,null));};exports[_0x4658('0x45')]=function(_0x2045be,_0x5b2156){return db[_0x4658('0x28')]['create'](_0x2045be['body'],{})['then'](respondWithResult(_0x5b2156,0xc9))['catch'](handleError(_0x5b2156,null));};exports[_0x4658('0x20')]=function(_0x3bc7e0,_0x1ee5f3){if(_0x3bc7e0[_0x4658('0x46')]['id']){delete _0x3bc7e0[_0x4658('0x46')]['id'];}return db['FaxQueueReport'][_0x4658('0x44')]({'where':{'id':_0x3bc7e0[_0x4658('0x40')]['id']}})['then'](handleEntityNotFound(_0x1ee5f3,null))[_0x4658('0x21')](saveUpdates(_0x3bc7e0[_0x4658('0x46')],null))['then'](respondWithResult(_0x1ee5f3,null))['catch'](handleError(_0x1ee5f3,null));};exports['destroy']=function(_0x3c5712,_0x1741e9){return db[_0x4658('0x28')][_0x4658('0x44')]({'where':{'id':_0x3c5712[_0x4658('0x40')]['id']}})[_0x4658('0x21')](handleEntityNotFound(_0x1741e9,null))['then'](removeEntity(_0x1741e9,null))[_0x4658('0x3e')](handleError(_0x1741e9,null));};exports[_0x4658('0x47')]=function(_0x2559f9,_0x3dd15d){return db[_0x4658('0x28')][_0x4658('0x47')]()['then'](respondWithResult(_0x3dd15d,null))[_0x4658('0x3e')](handleError(_0x3dd15d,null));}; \ No newline at end of file +var _0x6f0d=['zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','json','reject','update','destroy','then','error','stack','name','index','map','FaxQueueReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','params','find','catch','body','describe','rimraf'];(function(_0x2ecd33,_0x5e0890){var _0x502747=function(_0x219e85){while(--_0x219e85){_0x2ecd33['push'](_0x2ecd33['shift']());}};_0x502747(++_0x5e0890);}(_0x6f0d,0x16c));var _0xd6f0=function(_0x5b75cd,_0x44deb2){_0x5b75cd=_0x5b75cd-0x0;var _0x1363aa=_0x6f0d[_0x5b75cd];return _0x1363aa;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd6f0('0x0'));var zipdir=require(_0xd6f0('0x1'));var jsonpatch=require(_0xd6f0('0x2'));var rp=require(_0xd6f0('0x3'));var moment=require('moment');var BPromise=require(_0xd6f0('0x4'));var Mustache=require(_0xd6f0('0x5'));var util=require(_0xd6f0('0x6'));var path=require(_0xd6f0('0x7'));var sox=require(_0xd6f0('0x8'));var csv=require('to-csv');var ejs=require(_0xd6f0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd6f0('0xa'));var squel=require(_0xd6f0('0xb'));var crypto=require(_0xd6f0('0xc'));var jsforce=require(_0xd6f0('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xd6f0('0xe'));var Papa=require(_0xd6f0('0xf'));var Redis=require(_0xd6f0('0x10'));var authService=require(_0xd6f0('0x11'));var qs=require(_0xd6f0('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd6f0('0x13'));var logger=require(_0xd6f0('0x14'))(_0xd6f0('0x15'));var utils=require(_0xd6f0('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd6f0('0x17'));var db=require(_0xd6f0('0x18'))['db'];function respondWithStatusCode(_0x306aad,_0x45973d){_0x45973d=_0x45973d||0xcc;return function(_0x109655){if(_0x109655){return _0x306aad[_0xd6f0('0x19')](_0x45973d);}return _0x306aad[_0xd6f0('0x1a')](_0x45973d)[_0xd6f0('0x1b')]();};}function respondWithResult(_0x246dad,_0x4ab979){_0x4ab979=_0x4ab979||0xc8;return function(_0x2b3f32){if(_0x2b3f32){return _0x246dad[_0xd6f0('0x1a')](_0x4ab979)['json'](_0x2b3f32);}};}function respondWithFilteredResult(_0x419b7e,_0x593abe){return function(_0x3f4851){if(_0x3f4851){var _0x154e3e=typeof _0x593abe[_0xd6f0('0x1c')]===_0xd6f0('0x1d')&&typeof _0x593abe[_0xd6f0('0x1e')]===_0xd6f0('0x1d');var _0x25da0c=_0x3f4851[_0xd6f0('0x1f')];var _0x2e71bd=_0x154e3e?0x0:_0x593abe[_0xd6f0('0x1c')];var _0x23ab6c=_0x154e3e?_0x3f4851[_0xd6f0('0x1f')]:_0x593abe[_0xd6f0('0x1c')]+_0x593abe[_0xd6f0('0x1e')];var _0x1f43d7;if(_0x23ab6c>=_0x25da0c){_0x23ab6c=_0x25da0c;_0x1f43d7=0xc8;}else{_0x1f43d7=0xce;}_0x419b7e[_0xd6f0('0x1a')](_0x1f43d7);return _0x419b7e['set']('Content-Range',_0x2e71bd+'-'+_0x23ab6c+'/'+_0x25da0c)[_0xd6f0('0x20')](_0x3f4851);}return null;};}function patchUpdates(_0x264104){return function(_0x1158dc){try{jsonpatch['apply'](_0x1158dc,_0x264104,!![]);}catch(_0x67afa7){return BPromise[_0xd6f0('0x21')](_0x67afa7);}return _0x1158dc['save']();};}function saveUpdates(_0x86dde0,_0x515687){return function(_0x1ee584){if(_0x1ee584){return _0x1ee584[_0xd6f0('0x22')](_0x86dde0)['then'](function(_0xb9e820){return _0xb9e820;});}return null;};}function removeEntity(_0x45e99c,_0x5ea2dd){return function(_0x3dbdc3){if(_0x3dbdc3){return _0x3dbdc3[_0xd6f0('0x23')]()[_0xd6f0('0x24')](function(){_0x45e99c['status'](0xcc)[_0xd6f0('0x1b')]();});}};}function handleEntityNotFound(_0x3dc166,_0x5ecb16){return function(_0xcea0ae){if(!_0xcea0ae){_0x3dc166['sendStatus'](0x194);}return _0xcea0ae;};}function handleError(_0x2042d5,_0x3fb5c3){_0x3fb5c3=_0x3fb5c3||0x1f4;return function(_0x1630dc){logger[_0xd6f0('0x25')](_0x1630dc[_0xd6f0('0x26')]);if(_0x1630dc[_0xd6f0('0x27')]){delete _0x1630dc[_0xd6f0('0x27')];}_0x2042d5[_0xd6f0('0x1a')](_0x3fb5c3)['send'](_0x1630dc);};}exports[_0xd6f0('0x28')]=function(_0x1982d3,_0x55656c){var _0x38a3e9={},_0x385947={},_0x27db5e={'count':0x0,'rows':[]};var _0xb61222=_[_0xd6f0('0x29')](db[_0xd6f0('0x2a')][_0xd6f0('0x2b')],function(_0x3151f8){return{'name':_0x3151f8[_0xd6f0('0x2c')],'type':_0x3151f8[_0xd6f0('0x2d')][_0xd6f0('0x2e')]};});_0x385947[_0xd6f0('0x2f')]=_[_0xd6f0('0x29')](_0xb61222,_0xd6f0('0x27'));_0x385947[_0xd6f0('0x30')]=_[_0xd6f0('0x31')](_0x1982d3[_0xd6f0('0x30')]);_0x385947[_0xd6f0('0x32')]=_[_0xd6f0('0x33')](_0x385947[_0xd6f0('0x2f')],_0x385947[_0xd6f0('0x30')]);_0x38a3e9[_0xd6f0('0x34')]=_['intersection'](_0x385947[_0xd6f0('0x2f')],qs['fields'](_0x1982d3['query'][_0xd6f0('0x35')]));_0x38a3e9[_0xd6f0('0x34')]=_0x38a3e9[_0xd6f0('0x34')][_0xd6f0('0x36')]?_0x38a3e9[_0xd6f0('0x34')]:_0x385947['model'];if(!_0x1982d3[_0xd6f0('0x30')]['hasOwnProperty'](_0xd6f0('0x37'))){_0x38a3e9[_0xd6f0('0x1e')]=qs[_0xd6f0('0x1e')](_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x1e')]);_0x38a3e9['offset']=qs['offset'](_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x1c')]);}_0x38a3e9['order']=qs[_0xd6f0('0x38')](_0x1982d3['query'][_0xd6f0('0x38')]);_0x38a3e9[_0xd6f0('0x39')]=qs[_0xd6f0('0x32')](_[_0xd6f0('0x3a')](_0x1982d3[_0xd6f0('0x30')],_0x385947[_0xd6f0('0x32')]),_0xb61222);if(_0x1982d3[_0xd6f0('0x30')]['filter']){_0x38a3e9['where']=_[_0xd6f0('0x3b')](_0x38a3e9[_0xd6f0('0x39')],{'$or':_[_0xd6f0('0x29')](_0xb61222,function(_0x5c2d9a){if(_0x5c2d9a['type']!==_0xd6f0('0x3c')){var _0x2def01={};_0x2def01[_0x5c2d9a[_0xd6f0('0x27')]]={'$like':'%'+_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x3d')]+'%'};return _0x2def01;}})});}_0x38a3e9=_[_0xd6f0('0x3b')]({},_0x38a3e9,_0x1982d3[_0xd6f0('0x3e')]);var _0x64359c={'where':_0x38a3e9['where']};return db[_0xd6f0('0x2a')][_0xd6f0('0x1f')](_0x64359c)[_0xd6f0('0x24')](function(_0x3964e6){_0x27db5e['count']=_0x3964e6;if(_0x1982d3[_0xd6f0('0x30')][_0xd6f0('0x3f')]){_0x38a3e9[_0xd6f0('0x40')]=[{'all':!![]}];}return db[_0xd6f0('0x2a')][_0xd6f0('0x41')](_0x38a3e9);})['then'](function(_0x332809){_0x27db5e[_0xd6f0('0x42')]=_0x332809;return _0x27db5e;})[_0xd6f0('0x24')](respondWithFilteredResult(_0x55656c,_0x38a3e9))['catch'](handleError(_0x55656c,null));};exports[_0xd6f0('0x43')]=function(_0x1ddc40,_0x4b8cc7){var _0x516ffd={'raw':!![],'where':{'id':_0x1ddc40[_0xd6f0('0x44')]['id']}},_0x9cffd4={};_0x9cffd4[_0xd6f0('0x2f')]=_['keys'](db[_0xd6f0('0x2a')][_0xd6f0('0x2b')]);_0x9cffd4['query']=_[_0xd6f0('0x31')](_0x1ddc40[_0xd6f0('0x30')]);_0x9cffd4[_0xd6f0('0x32')]=_[_0xd6f0('0x33')](_0x9cffd4['model'],_0x9cffd4[_0xd6f0('0x30')]);_0x516ffd[_0xd6f0('0x34')]=_[_0xd6f0('0x33')](_0x9cffd4[_0xd6f0('0x2f')],qs[_0xd6f0('0x35')](_0x1ddc40[_0xd6f0('0x30')][_0xd6f0('0x35')]));_0x516ffd[_0xd6f0('0x34')]=_0x516ffd['attributes'][_0xd6f0('0x36')]?_0x516ffd[_0xd6f0('0x34')]:_0x9cffd4['model'];if(_0x1ddc40[_0xd6f0('0x30')][_0xd6f0('0x3f')]){_0x516ffd[_0xd6f0('0x40')]=[{'all':!![]}];}_0x516ffd=_[_0xd6f0('0x3b')]({},_0x516ffd,_0x1ddc40['options']);return db[_0xd6f0('0x2a')][_0xd6f0('0x45')](_0x516ffd)['then'](handleEntityNotFound(_0x4b8cc7,null))['then'](respondWithResult(_0x4b8cc7,null))[_0xd6f0('0x46')](handleError(_0x4b8cc7,null));};exports['create']=function(_0x35a8f5,_0x61b354){return db[_0xd6f0('0x2a')]['create'](_0x35a8f5[_0xd6f0('0x47')],{})[_0xd6f0('0x24')](respondWithResult(_0x61b354,0xc9))[_0xd6f0('0x46')](handleError(_0x61b354,null));};exports[_0xd6f0('0x22')]=function(_0xc4147e,_0x4c42ce){if(_0xc4147e[_0xd6f0('0x47')]['id']){delete _0xc4147e['body']['id'];}return db[_0xd6f0('0x2a')][_0xd6f0('0x45')]({'where':{'id':_0xc4147e[_0xd6f0('0x44')]['id']}})[_0xd6f0('0x24')](handleEntityNotFound(_0x4c42ce,null))['then'](saveUpdates(_0xc4147e['body'],null))[_0xd6f0('0x24')](respondWithResult(_0x4c42ce,null))[_0xd6f0('0x46')](handleError(_0x4c42ce,null));};exports['destroy']=function(_0xa68b18,_0x56c448){return db[_0xd6f0('0x2a')][_0xd6f0('0x45')]({'where':{'id':_0xa68b18[_0xd6f0('0x44')]['id']}})[_0xd6f0('0x24')](handleEntityNotFound(_0x56c448,null))[_0xd6f0('0x24')](removeEntity(_0x56c448,null))['catch'](handleError(_0x56c448,null));};exports[_0xd6f0('0x48')]=function(_0x335383,_0x3f9d29){return db[_0xd6f0('0x2a')][_0xd6f0('0x48')]()[_0xd6f0('0x24')](respondWithResult(_0x3f9d29,null))[_0xd6f0('0x46')](handleError(_0x3f9d29,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1d5213f..1dbb550 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 _0x1cb9=['api','moment','bluebird','path','rimraf','./faxQueueReport.attributes','exports','define','FaxQueueReport','uniqueid','lodash','../../config/logger'];(function(_0x5ac84c,_0x287781){var _0x3c53d2=function(_0x40cde0){while(--_0x40cde0){_0x5ac84c['push'](_0x5ac84c['shift']());}};_0x3c53d2(++_0x287781);}(_0x1cb9,0x14e));var _0x91cb=function(_0x5f41bf,_0x160f9f){_0x5f41bf=_0x5f41bf-0x0;var _0x4d5a93=_0x1cb9[_0x5f41bf];return _0x4d5a93;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0x91cb('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x326f=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','define','FaxQueueReport','report_fax_queue','uniqueid','lodash'];(function(_0x50cc3c,_0x55205c){var _0x5cbe61=function(_0x137c0b){while(--_0x137c0b){_0x50cc3c['push'](_0x50cc3c['shift']());}};_0x5cbe61(++_0x55205c);}(_0x326f,0xd1));var _0xf326=function(_0xf8b711,_0x2b494c){_0xf8b711=_0xf8b711-0x0;var _0xe77dc7=_0x326f[_0xf8b711];return _0xe77dc7;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf326('0x1'));var moment=require(_0xf326('0x2'));var BPromise=require(_0xf326('0x3'));var rp=require(_0xf326('0x4'));var fs=require('fs');var path=require(_0xf326('0x5'));var rimraf=require(_0xf326('0x6'));var config=require(_0xf326('0x7'));var attributes=require(_0xf326('0x8'));module[_0xf326('0x9')]=function(_0x3ace29,_0x4c2249){return _0x3ace29[_0xf326('0xa')](_0xf326('0xb'),attributes,{'tableName':_0xf326('0xc'),'paranoid':![],'indexes':[{'name':_0xf326('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index f64b4f2..df030d6 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 _0xecaf=['http','request','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','options','raw','then','UpdateFaxQueueReport','update','where','attributes','limit','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0xef6167,_0x7c7a2b){var _0x169d9b=function(_0x59109e){while(--_0x59109e){_0xef6167['push'](_0xef6167['shift']());}};_0x169d9b(++_0x7c7a2b);}(_0xecaf,0x19a));var _0xfeca=function(_0xd15d66,_0xefe0cd){_0xd15d66=_0xd15d66-0x0;var _0x15d83d=_0xecaf[_0xd15d66];return _0x15d83d;};'use strict';var _=require(_0xfeca('0x0'));var util=require(_0xfeca('0x1'));var moment=require('moment');var BPromise=require(_0xfeca('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfeca('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfeca('0x4'));var logger=require(_0xfeca('0x5'))(_0xfeca('0x6'));var config=require(_0xfeca('0x7'));var jayson=require(_0xfeca('0x8'));var client=jayson[_0xfeca('0x9')][_0xfeca('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x337984,_0x24a95b,_0x15f73b){return new BPromise(function(_0x2ca8d4,_0xba10a8){return client[_0xfeca('0xb')](_0x337984,_0x15f73b)['then'](function(_0x5ce799){logger[_0xfeca('0xc')](_0xfeca('0xd'),_0x24a95b,_0xfeca('0xe'));logger[_0xfeca('0xf')](_0xfeca('0x10'),_0x24a95b,'request\x20sent',JSON[_0xfeca('0x11')](_0x5ce799));if(_0x5ce799['error']){if(_0x5ce799[_0xfeca('0x12')][_0xfeca('0x13')]===0x1f4){logger[_0xfeca('0x12')](_0xfeca('0xd'),_0x24a95b,_0x5ce799[_0xfeca('0x12')][_0xfeca('0x14')]);return _0xba10a8(_0x5ce799[_0xfeca('0x12')][_0xfeca('0x14')]);}logger[_0xfeca('0x12')](_0xfeca('0xd'),_0x24a95b,_0x5ce799[_0xfeca('0x12')]['message']);return _0x2ca8d4(_0x5ce799['error'][_0xfeca('0x14')]);}else{logger[_0xfeca('0xc')](_0xfeca('0xd'),_0x24a95b,_0xfeca('0xe'));_0x2ca8d4(_0x5ce799[_0xfeca('0x15')][_0xfeca('0x14')]);}})[_0xfeca('0x16')](function(_0x50b70b){logger[_0xfeca('0x12')](_0xfeca('0xd'),_0x24a95b,_0x50b70b);_0xba10a8(_0x50b70b);});});}exports[_0xfeca('0x17')]=function(_0x25ccc0){var _0x32ee7d=this;return new Promise(function(_0x280709,_0x4cbf8e){return db[_0xfeca('0x18')][_0xfeca('0x19')](_0x25ccc0[_0xfeca('0x1a')],{'raw':_0x25ccc0[_0xfeca('0x1b')]?_0x25ccc0[_0xfeca('0x1b')][_0xfeca('0x1c')]===undefined?!![]:![]:!![]})[_0xfeca('0x1d')](function(_0x5d3eb5){logger[_0xfeca('0xc')](_0xfeca('0x17'),_0x25ccc0);logger['debug']('CreateFaxQueueReport',_0x25ccc0,JSON[_0xfeca('0x11')](_0x5d3eb5));_0x280709(_0x5d3eb5);})[_0xfeca('0x16')](function(_0x529d9a){logger['error'](_0xfeca('0x17'),_0x529d9a[_0xfeca('0x14')],_0x25ccc0);_0x4cbf8e(_0x32ee7d[_0xfeca('0x12')](0x1f4,_0x529d9a['message']));});});};exports[_0xfeca('0x1e')]=function(_0x203fc2){var _0x3d4ae8=this;return new Promise(function(_0x36e544,_0x48fa64){return db[_0xfeca('0x18')][_0xfeca('0x1f')](_0x203fc2[_0xfeca('0x1a')],{'raw':_0x203fc2[_0xfeca('0x1b')]?_0x203fc2[_0xfeca('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x203fc2[_0xfeca('0x1b')]?_0x203fc2[_0xfeca('0x1b')][_0xfeca('0x20')]||null:null,'attributes':_0x203fc2[_0xfeca('0x1b')]?_0x203fc2[_0xfeca('0x1b')][_0xfeca('0x21')]||null:null,'limit':_0x203fc2['options']?_0x203fc2[_0xfeca('0x1b')][_0xfeca('0x22')]||null:null})['then'](function(_0x5ae10d){logger[_0xfeca('0xc')]('UpdateFaxQueueReport',_0x203fc2);logger[_0xfeca('0xf')](_0xfeca('0x1e'),_0x203fc2,JSON[_0xfeca('0x11')](_0x5ae10d));_0x36e544(_0x5ae10d);})[_0xfeca('0x16')](function(_0x9fb86f){logger[_0xfeca('0x12')](_0xfeca('0x1e'),_0x9fb86f[_0xfeca('0x14')],_0x203fc2);_0x48fa64(_0x3d4ae8[_0xfeca('0x12')](0x1f4,_0x9fb86f[_0xfeca('0x14')]));});});}; \ No newline at end of file +var _0x315b=['then','UpdateFaxQueueReport','update','options','where','attributes','limit','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','info','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','FaxQueueReport,\x20%s,\x20%s','message','result','catch','CreateFaxQueueReport','FaxQueueReport','create','body','raw'];(function(_0x3649a4,_0x287489){var _0x1a1f0b=function(_0xc0aa95){while(--_0xc0aa95){_0x3649a4['push'](_0x3649a4['shift']());}};_0x1a1f0b(++_0x287489);}(_0x315b,0xc7));var _0xb315=function(_0x284fc2,_0x4d1c8f){_0x284fc2=_0x284fc2-0x0;var _0x43dffa=_0x315b[_0x284fc2];return _0x43dffa;};'use strict';var _=require('lodash');var util=require(_0xb315('0x0'));var moment=require(_0xb315('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb315('0x2'));var db=require(_0xb315('0x3'))['db'];var utils=require(_0xb315('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xb315('0x5'));var jayson=require(_0xb315('0x6'));var client=jayson['client'][_0xb315('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x306026,_0x59e227,_0x2fcb72){return new BPromise(function(_0x37cc1f,_0x288d78){return client[_0xb315('0x8')](_0x306026,_0x2fcb72)['then'](function(_0x4de526){logger[_0xb315('0x9')]('FaxQueueReport,\x20%s,\x20%s',_0x59e227,'request\x20sent');logger[_0xb315('0xa')](_0xb315('0xb'),_0x59e227,_0xb315('0xc'),JSON[_0xb315('0xd')](_0x4de526));if(_0x4de526[_0xb315('0xe')]){if(_0x4de526[_0xb315('0xe')][_0xb315('0xf')]===0x1f4){logger[_0xb315('0xe')](_0xb315('0x10'),_0x59e227,_0x4de526[_0xb315('0xe')][_0xb315('0x11')]);return _0x288d78(_0x4de526['error'][_0xb315('0x11')]);}logger['error'](_0xb315('0x10'),_0x59e227,_0x4de526[_0xb315('0xe')][_0xb315('0x11')]);return _0x37cc1f(_0x4de526[_0xb315('0xe')][_0xb315('0x11')]);}else{logger['info'](_0xb315('0x10'),_0x59e227,_0xb315('0xc'));_0x37cc1f(_0x4de526[_0xb315('0x12')][_0xb315('0x11')]);}})[_0xb315('0x13')](function(_0xc6a63f){logger[_0xb315('0xe')]('FaxQueueReport,\x20%s,\x20%s',_0x59e227,_0xc6a63f);_0x288d78(_0xc6a63f);});});}exports[_0xb315('0x14')]=function(_0x137fcc){var _0x18d10=this;return new Promise(function(_0x30f15a,_0x7afbde){return db[_0xb315('0x15')][_0xb315('0x16')](_0x137fcc[_0xb315('0x17')],{'raw':_0x137fcc['options']?_0x137fcc['options'][_0xb315('0x18')]===undefined?!![]:![]:!![]})[_0xb315('0x19')](function(_0x48e0e5){logger[_0xb315('0x9')]('CreateFaxQueueReport',_0x137fcc);logger[_0xb315('0xa')](_0xb315('0x14'),_0x137fcc,JSON[_0xb315('0xd')](_0x48e0e5));_0x30f15a(_0x48e0e5);})[_0xb315('0x13')](function(_0x49636a){logger['error'](_0xb315('0x14'),_0x49636a[_0xb315('0x11')],_0x137fcc);_0x7afbde(_0x18d10[_0xb315('0xe')](0x1f4,_0x49636a[_0xb315('0x11')]));});});};exports[_0xb315('0x1a')]=function(_0x110be3){var _0x461e93=this;return new Promise(function(_0x3cbb60,_0x18611d){return db[_0xb315('0x15')][_0xb315('0x1b')](_0x110be3[_0xb315('0x17')],{'raw':_0x110be3[_0xb315('0x1c')]?_0x110be3[_0xb315('0x1c')][_0xb315('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x110be3[_0xb315('0x1c')]?_0x110be3[_0xb315('0x1c')][_0xb315('0x1d')]||null:null,'attributes':_0x110be3['options']?_0x110be3[_0xb315('0x1c')][_0xb315('0x1e')]||null:null,'limit':_0x110be3[_0xb315('0x1c')]?_0x110be3[_0xb315('0x1c')][_0xb315('0x1f')]||null:null})[_0xb315('0x19')](function(_0x577857){logger[_0xb315('0x9')]('UpdateFaxQueueReport',_0x110be3);logger[_0xb315('0xa')](_0xb315('0x1a'),_0x110be3,JSON[_0xb315('0xd')](_0x577857));_0x3cbb60(_0x577857);})[_0xb315('0x13')](function(_0xc655fb){logger[_0xb315('0xe')]('UpdateFaxQueueReport',_0xc655fb['message'],_0x110be3);_0x18611d(_0x461e93[_0xb315('0xe')](0x1f4,_0xc655fb['message']));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 63f5c2c..ba47a44 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 _0xe7db=['post','put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','./faxQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show'];(function(_0x2baf40,_0x5ebef2){var _0x2bb2cb=function(_0x1a3fc1){while(--_0x1a3fc1){_0x2baf40['push'](_0x2baf40['shift']());}};_0x2bb2cb(++_0x5ebef2);}(_0xe7db,0x9f));var _0xbe7d=function(_0x21205e,_0x7eb8e7){_0x21205e=_0x21205e-0x0;var _0x136ebb=_0xe7db[_0x21205e];return _0x136ebb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xbe7d('0x0'));var timeout=require(_0xbe7d('0x1'));var express=require('express');var router=express[_0xbe7d('0x2')]();var fs_extra=require(_0xbe7d('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe7d('0x4'));router[_0xbe7d('0x5')]('/',auth[_0xbe7d('0x6')](),controller['index']);router[_0xbe7d('0x5')](_0xbe7d('0x7'),auth[_0xbe7d('0x6')](),controller[_0xbe7d('0x8')]);router[_0xbe7d('0x5')](_0xbe7d('0x9'),auth['isAuthenticated'](),controller[_0xbe7d('0xa')]);router[_0xbe7d('0xb')]('/',auth[_0xbe7d('0x6')](),controller['create']);router[_0xbe7d('0xc')](_0xbe7d('0x9'),auth['isAuthenticated'](),controller[_0xbe7d('0xd')]);router[_0xbe7d('0xe')](_0xbe7d('0x9'),auth[_0xbe7d('0x6')](),controller[_0xbe7d('0xf')]);module[_0xbe7d('0x10')]=router; \ No newline at end of file +var _0x4263=['./faxQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','create','put','update','delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x57c650,_0x2a70a7){var _0x394cb6=function(_0xbd38b1){while(--_0xbd38b1){_0x57c650['push'](_0x57c650['shift']());}};_0x394cb6(++_0x2a70a7);}(_0x4263,0xac));var _0x3426=function(_0x17bd84,_0x1cfcfb){_0x17bd84=_0x17bd84-0x0;var _0x124a5a=_0x4263[_0x17bd84];return _0x124a5a;};'use strict';var multer=require(_0x3426('0x0'));var util=require(_0x3426('0x1'));var path=require(_0x3426('0x2'));var timeout=require(_0x3426('0x3'));var express=require('express');var router=express[_0x3426('0x4')]();var fs_extra=require(_0x3426('0x5'));var auth=require(_0x3426('0x6'));var interaction=require(_0x3426('0x7'));var config=require('../../config/environment');var controller=require(_0x3426('0x8'));router['get']('/',auth[_0x3426('0x9')](),controller[_0x3426('0xa')]);router[_0x3426('0xb')](_0x3426('0xc'),auth['isAuthenticated'](),controller[_0x3426('0xd')]);router[_0x3426('0xb')](_0x3426('0xe'),auth[_0x3426('0x9')](),controller['show']);router['post']('/',auth[_0x3426('0x9')](),controller[_0x3426('0xf')]);router[_0x3426('0x10')]('/:id',auth[_0x3426('0x9')](),controller[_0x3426('0x11')]);router[_0x3426('0x12')](_0x3426('0xe'),auth['isAuthenticated'](),controller['destroy']);module[_0x3426('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.attributes.js b/server/api/faxTransferReport/faxTransferReport.attributes.js index 710fb4c..a611eb4 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 _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x51a56e,_0x5d6ee9){var _0x5a8685=function(_0x161c4c){while(--_0x161c4c){_0x51a56e['push'](_0x51a56e['shift']());}};_0x5a8685(++_0x5d6ee9);}(_0x008c,0x188));var _0xc008=function(_0x4cc03b,_0x299f1c){_0x4cc03b=_0x4cc03b-0x0;var _0xf0358c=_0x008c[_0x4cc03b];return _0xf0358c;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x58bbeb,_0x19caf1){var _0x5d9f3e=function(_0x27e100){while(--_0x27e100){_0x58bbeb['push'](_0x58bbeb['shift']());}};_0x5d9f3e(++_0x19caf1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index daf1def..134290f 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 _0x7649=['include','findAll','rows','catch','show','params','keys','options','find','create','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','FaxTransferReport','rawAttributes','type','key','query','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','includeAll'];(function(_0x1613e5,_0x4fe74d){var _0x2d8dd6=function(_0x25c56f){while(--_0x25c56f){_0x1613e5['push'](_0x1613e5['shift']());}};_0x2d8dd6(++_0x4fe74d);}(_0x7649,0x9d));var _0x9764=function(_0x26e75f,_0x5c0329){_0x26e75f=_0x26e75f-0x0;var _0x572773=_0x7649[_0x26e75f];return _0x572773;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9764('0x0'));var zipdir=require(_0x9764('0x1'));var jsonpatch=require(_0x9764('0x2'));var rp=require(_0x9764('0x3'));var moment=require(_0x9764('0x4'));var BPromise=require(_0x9764('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9764('0x6'));var sox=require(_0x9764('0x7'));var csv=require(_0x9764('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x9764('0x9'));var toCsv=require(_0x9764('0x8'));var querystring=require(_0x9764('0xa'));var Papa=require(_0x9764('0xb'));var Redis=require(_0x9764('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x9764('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9764('0xe'))('api');var utils=require(_0x9764('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0x9764('0x10'));var db=require(_0x9764('0x11'))['db'];function respondWithStatusCode(_0x1d9328,_0x3498e8){_0x3498e8=_0x3498e8||0xcc;return function(_0x1f1db8){if(_0x1f1db8){return _0x1d9328[_0x9764('0x12')](_0x3498e8);}return _0x1d9328[_0x9764('0x13')](_0x3498e8)[_0x9764('0x14')]();};}function respondWithResult(_0x592270,_0x56c758){_0x56c758=_0x56c758||0xc8;return function(_0xf6f8c4){if(_0xf6f8c4){return _0x592270[_0x9764('0x13')](_0x56c758)[_0x9764('0x15')](_0xf6f8c4);}};}function respondWithFilteredResult(_0x2628cc,_0x2c2199){return function(_0x96044d){if(_0x96044d){var _0x582fe4=typeof _0x2c2199[_0x9764('0x16')]===_0x9764('0x17')&&typeof _0x2c2199['limit']===_0x9764('0x17');var _0x331e5a=_0x96044d[_0x9764('0x18')];var _0x3af38=_0x582fe4?0x0:_0x2c2199[_0x9764('0x16')];var _0x8ccf80=_0x582fe4?_0x96044d[_0x9764('0x18')]:_0x2c2199[_0x9764('0x16')]+_0x2c2199[_0x9764('0x19')];var _0x122a42;if(_0x8ccf80>=_0x331e5a){_0x8ccf80=_0x331e5a;_0x122a42=0xc8;}else{_0x122a42=0xce;}_0x2628cc[_0x9764('0x13')](_0x122a42);return _0x2628cc[_0x9764('0x1a')](_0x9764('0x1b'),_0x3af38+'-'+_0x8ccf80+'/'+_0x331e5a)[_0x9764('0x15')](_0x96044d);}return null;};}function patchUpdates(_0x1fb320){return function(_0x38e3e8){try{jsonpatch[_0x9764('0x1c')](_0x38e3e8,_0x1fb320,!![]);}catch(_0x642992){return BPromise[_0x9764('0x1d')](_0x642992);}return _0x38e3e8[_0x9764('0x1e')]();};}function saveUpdates(_0x7238b0,_0x1468bf){return function(_0x5fa5b0){if(_0x5fa5b0){return _0x5fa5b0[_0x9764('0x1f')](_0x7238b0)['then'](function(_0xcfc42e){return _0xcfc42e;});}return null;};}function removeEntity(_0x12cddf,_0x50fa15){return function(_0x54b1f2){if(_0x54b1f2){return _0x54b1f2['destroy']()[_0x9764('0x20')](function(){_0x12cddf[_0x9764('0x13')](0xcc)[_0x9764('0x14')]();});}};}function handleEntityNotFound(_0x446aef,_0xd16c34){return function(_0x3d58f5){if(!_0x3d58f5){_0x446aef[_0x9764('0x12')](0x194);}return _0x3d58f5;};}function handleError(_0x5005e9,_0x1172c1){_0x1172c1=_0x1172c1||0x1f4;return function(_0x2d31e1){logger[_0x9764('0x21')](_0x2d31e1[_0x9764('0x22')]);if(_0x2d31e1[_0x9764('0x23')]){delete _0x2d31e1[_0x9764('0x23')];}_0x5005e9[_0x9764('0x13')](_0x1172c1)[_0x9764('0x24')](_0x2d31e1);};}exports[_0x9764('0x25')]=function(_0x1a5109,_0x533944){var _0x9f77d9={},_0x374dcd={},_0x39f697={'count':0x0,'rows':[]};var _0x502aff=_[_0x9764('0x26')](db[_0x9764('0x27')][_0x9764('0x28')],function(_0x4af25a){return{'name':_0x4af25a['fieldName'],'type':_0x4af25a[_0x9764('0x29')][_0x9764('0x2a')]};});_0x374dcd['model']=_['map'](_0x502aff,'name');_0x374dcd[_0x9764('0x2b')]=_['keys'](_0x1a5109[_0x9764('0x2b')]);_0x374dcd['filters']=_[_0x9764('0x2c')](_0x374dcd['model'],_0x374dcd['query']);_0x9f77d9[_0x9764('0x2d')]=_[_0x9764('0x2c')](_0x374dcd[_0x9764('0x2e')],qs[_0x9764('0x2f')](_0x1a5109['query']['fields']));_0x9f77d9[_0x9764('0x2d')]=_0x9f77d9[_0x9764('0x2d')][_0x9764('0x30')]?_0x9f77d9[_0x9764('0x2d')]:_0x374dcd[_0x9764('0x2e')];if(!_0x1a5109[_0x9764('0x2b')][_0x9764('0x31')](_0x9764('0x32'))){_0x9f77d9[_0x9764('0x19')]=qs[_0x9764('0x19')](_0x1a5109['query'][_0x9764('0x19')]);_0x9f77d9[_0x9764('0x16')]=qs[_0x9764('0x16')](_0x1a5109['query'][_0x9764('0x16')]);}_0x9f77d9[_0x9764('0x33')]=qs[_0x9764('0x34')](_0x1a5109['query'][_0x9764('0x34')]);_0x9f77d9[_0x9764('0x35')]=qs[_0x9764('0x36')](_['pick'](_0x1a5109[_0x9764('0x2b')],_0x374dcd[_0x9764('0x36')]),_0x502aff);if(_0x1a5109[_0x9764('0x2b')][_0x9764('0x37')]){_0x9f77d9['where']=_[_0x9764('0x38')](_0x9f77d9[_0x9764('0x35')],{'$or':_[_0x9764('0x26')](_0x502aff,function(_0x4d7f20){if(_0x4d7f20[_0x9764('0x29')]!==_0x9764('0x39')){var _0x2c9064={};_0x2c9064[_0x4d7f20[_0x9764('0x23')]]={'$like':'%'+_0x1a5109[_0x9764('0x2b')][_0x9764('0x37')]+'%'};return _0x2c9064;}})});}_0x9f77d9=_[_0x9764('0x38')]({},_0x9f77d9,_0x1a5109['options']);var _0xa13df0={'where':_0x9f77d9[_0x9764('0x35')]};return db[_0x9764('0x27')][_0x9764('0x18')](_0xa13df0)[_0x9764('0x20')](function(_0x29991c){_0x39f697[_0x9764('0x18')]=_0x29991c;if(_0x1a5109[_0x9764('0x2b')][_0x9764('0x3a')]){_0x9f77d9[_0x9764('0x3b')]=[{'all':!![]}];}return db['FaxTransferReport'][_0x9764('0x3c')](_0x9f77d9);})[_0x9764('0x20')](function(_0x99fa91){_0x39f697[_0x9764('0x3d')]=_0x99fa91;return _0x39f697;})[_0x9764('0x20')](respondWithFilteredResult(_0x533944,_0x9f77d9))[_0x9764('0x3e')](handleError(_0x533944,null));};exports[_0x9764('0x3f')]=function(_0x5c5a5b,_0xd3b541){var _0x547035={'raw':!![],'where':{'id':_0x5c5a5b[_0x9764('0x40')]['id']}},_0x156eb7={};_0x156eb7['model']=_[_0x9764('0x41')](db[_0x9764('0x27')][_0x9764('0x28')]);_0x156eb7[_0x9764('0x2b')]=_[_0x9764('0x41')](_0x5c5a5b['query']);_0x156eb7[_0x9764('0x36')]=_['intersection'](_0x156eb7[_0x9764('0x2e')],_0x156eb7[_0x9764('0x2b')]);_0x547035[_0x9764('0x2d')]=_[_0x9764('0x2c')](_0x156eb7[_0x9764('0x2e')],qs[_0x9764('0x2f')](_0x5c5a5b[_0x9764('0x2b')][_0x9764('0x2f')]));_0x547035['attributes']=_0x547035[_0x9764('0x2d')]['length']?_0x547035[_0x9764('0x2d')]:_0x156eb7['model'];if(_0x5c5a5b[_0x9764('0x2b')][_0x9764('0x3a')]){_0x547035['include']=[{'all':!![]}];}_0x547035=_['merge']({},_0x547035,_0x5c5a5b[_0x9764('0x42')]);return db[_0x9764('0x27')][_0x9764('0x43')](_0x547035)[_0x9764('0x20')](handleEntityNotFound(_0xd3b541,null))['then'](respondWithResult(_0xd3b541,null))[_0x9764('0x3e')](handleError(_0xd3b541,null));};exports[_0x9764('0x44')]=function(_0xb6f26e,_0x529769){return db[_0x9764('0x27')][_0x9764('0x44')](_0xb6f26e[_0x9764('0x45')],{})[_0x9764('0x20')](respondWithResult(_0x529769,0xc9))[_0x9764('0x3e')](handleError(_0x529769,null));};exports[_0x9764('0x1f')]=function(_0x1aab58,_0x281b52){if(_0x1aab58[_0x9764('0x45')]['id']){delete _0x1aab58['body']['id'];}return db[_0x9764('0x27')][_0x9764('0x43')]({'where':{'id':_0x1aab58[_0x9764('0x40')]['id']}})[_0x9764('0x20')](handleEntityNotFound(_0x281b52,null))['then'](saveUpdates(_0x1aab58[_0x9764('0x45')],null))[_0x9764('0x20')](respondWithResult(_0x281b52,null))['catch'](handleError(_0x281b52,null));};exports[_0x9764('0x46')]=function(_0x408bdc,_0x40e79d){return db[_0x9764('0x27')]['find']({'where':{'id':_0x408bdc[_0x9764('0x40')]['id']}})[_0x9764('0x20')](handleEntityNotFound(_0x40e79d,null))[_0x9764('0x20')](removeEntity(_0x40e79d,null))[_0x9764('0x3e')](handleError(_0x40e79d,null));};exports[_0x9764('0x47')]=function(_0x1a2bd7,_0xc3c9a5){return db[_0x9764('0x27')][_0x9764('0x47')]()[_0x9764('0x20')](respondWithResult(_0xc3c9a5,null))[_0x9764('0x3e')](handleError(_0xc3c9a5,null));}; \ No newline at end of file +var _0xfbb5=['send','index','map','FaxTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','filter','includeAll','catch','show','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','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/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','destroy','error','stack','name'];(function(_0x38fb8b,_0x70dd0a){var _0x1ec681=function(_0x58f130){while(--_0x58f130){_0x38fb8b['push'](_0x38fb8b['shift']());}};_0x1ec681(++_0x70dd0a);}(_0xfbb5,0x71));var _0x5fbb=function(_0x213491,_0x22aa07){_0x213491=_0x213491-0x0;var _0x4a8161=_0xfbb5[_0x213491];return _0x4a8161;};'use strict';var emlformat=require(_0x5fbb('0x0'));var rimraf=require(_0x5fbb('0x1'));var zipdir=require(_0x5fbb('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x5fbb('0x3'));var moment=require(_0x5fbb('0x4'));var BPromise=require(_0x5fbb('0x5'));var Mustache=require(_0x5fbb('0x6'));var util=require(_0x5fbb('0x7'));var path=require(_0x5fbb('0x8'));var sox=require(_0x5fbb('0x9'));var csv=require(_0x5fbb('0xa'));var ejs=require(_0x5fbb('0xb'));var fs=require('fs');var fs_extra=require(_0x5fbb('0xc'));var _=require(_0x5fbb('0xd'));var squel=require(_0x5fbb('0xe'));var crypto=require(_0x5fbb('0xf'));var jsforce=require(_0x5fbb('0x10'));var deskjs=require(_0x5fbb('0x11'));var toCsv=require(_0x5fbb('0xa'));var querystring=require(_0x5fbb('0x12'));var Papa=require(_0x5fbb('0x13'));var Redis=require(_0x5fbb('0x14'));var authService=require(_0x5fbb('0x15'));var qs=require('../../components/parsers/qs');var as=require(_0x5fbb('0x16'));var hardwareService=require(_0x5fbb('0x17'));var logger=require(_0x5fbb('0x18'))('api');var utils=require(_0x5fbb('0x19'));var config=require(_0x5fbb('0x1a'));var licenseUtil=require(_0x5fbb('0x1b'));var db=require(_0x5fbb('0x1c'))['db'];function respondWithStatusCode(_0x417635,_0x33109f){_0x33109f=_0x33109f||0xcc;return function(_0x5233f7){if(_0x5233f7){return _0x417635[_0x5fbb('0x1d')](_0x33109f);}return _0x417635[_0x5fbb('0x1e')](_0x33109f)[_0x5fbb('0x1f')]();};}function respondWithResult(_0x2129e7,_0x496b7a){_0x496b7a=_0x496b7a||0xc8;return function(_0x58831e){if(_0x58831e){return _0x2129e7[_0x5fbb('0x1e')](_0x496b7a)['json'](_0x58831e);}};}function respondWithFilteredResult(_0x707c55,_0x2805b8){return function(_0x395ec9){if(_0x395ec9){var _0x30cc81=typeof _0x2805b8[_0x5fbb('0x20')]===_0x5fbb('0x21')&&typeof _0x2805b8[_0x5fbb('0x22')]===_0x5fbb('0x21');var _0x1cb342=_0x395ec9[_0x5fbb('0x23')];var _0x5e5ad6=_0x30cc81?0x0:_0x2805b8[_0x5fbb('0x20')];var _0x64d0bd=_0x30cc81?_0x395ec9['count']:_0x2805b8[_0x5fbb('0x20')]+_0x2805b8[_0x5fbb('0x22')];var _0x1dbc0c;if(_0x64d0bd>=_0x1cb342){_0x64d0bd=_0x1cb342;_0x1dbc0c=0xc8;}else{_0x1dbc0c=0xce;}_0x707c55[_0x5fbb('0x1e')](_0x1dbc0c);return _0x707c55[_0x5fbb('0x24')]('Content-Range',_0x5e5ad6+'-'+_0x64d0bd+'/'+_0x1cb342)[_0x5fbb('0x25')](_0x395ec9);}return null;};}function patchUpdates(_0x36fb9f){return function(_0x3192fd){try{jsonpatch[_0x5fbb('0x26')](_0x3192fd,_0x36fb9f,!![]);}catch(_0x29f3b0){return BPromise[_0x5fbb('0x27')](_0x29f3b0);}return _0x3192fd[_0x5fbb('0x28')]();};}function saveUpdates(_0x3ec12c,_0x321f06){return function(_0x3b5d15){if(_0x3b5d15){return _0x3b5d15[_0x5fbb('0x29')](_0x3ec12c)[_0x5fbb('0x2a')](function(_0x266682){return _0x266682;});}return null;};}function removeEntity(_0x32c092,_0x5e3165){return function(_0xc1abdd){if(_0xc1abdd){return _0xc1abdd[_0x5fbb('0x2b')]()[_0x5fbb('0x2a')](function(){_0x32c092[_0x5fbb('0x1e')](0xcc)[_0x5fbb('0x1f')]();});}};}function handleEntityNotFound(_0x53118a,_0x39864a){return function(_0x211582){if(!_0x211582){_0x53118a[_0x5fbb('0x1d')](0x194);}return _0x211582;};}function handleError(_0x30cf08,_0x3474f0){_0x3474f0=_0x3474f0||0x1f4;return function(_0x2424e0){logger[_0x5fbb('0x2c')](_0x2424e0[_0x5fbb('0x2d')]);if(_0x2424e0[_0x5fbb('0x2e')]){delete _0x2424e0['name'];}_0x30cf08['status'](_0x3474f0)[_0x5fbb('0x2f')](_0x2424e0);};}exports[_0x5fbb('0x30')]=function(_0x48629f,_0x37ab70){var _0x4ff5f={},_0x10cfff={},_0x196c59={'count':0x0,'rows':[]};var _0x28cd50=_[_0x5fbb('0x31')](db[_0x5fbb('0x32')][_0x5fbb('0x33')],function(_0x11e240){return{'name':_0x11e240[_0x5fbb('0x34')],'type':_0x11e240[_0x5fbb('0x35')][_0x5fbb('0x36')]};});_0x10cfff[_0x5fbb('0x37')]=_[_0x5fbb('0x31')](_0x28cd50,_0x5fbb('0x2e'));_0x10cfff[_0x5fbb('0x38')]=_[_0x5fbb('0x39')](_0x48629f[_0x5fbb('0x38')]);_0x10cfff[_0x5fbb('0x3a')]=_[_0x5fbb('0x3b')](_0x10cfff[_0x5fbb('0x37')],_0x10cfff[_0x5fbb('0x38')]);_0x4ff5f[_0x5fbb('0x3c')]=_[_0x5fbb('0x3b')](_0x10cfff[_0x5fbb('0x37')],qs[_0x5fbb('0x3d')](_0x48629f[_0x5fbb('0x38')][_0x5fbb('0x3d')]));_0x4ff5f[_0x5fbb('0x3c')]=_0x4ff5f[_0x5fbb('0x3c')][_0x5fbb('0x3e')]?_0x4ff5f[_0x5fbb('0x3c')]:_0x10cfff[_0x5fbb('0x37')];if(!_0x48629f[_0x5fbb('0x38')][_0x5fbb('0x3f')](_0x5fbb('0x40'))){_0x4ff5f[_0x5fbb('0x22')]=qs[_0x5fbb('0x22')](_0x48629f['query']['limit']);_0x4ff5f[_0x5fbb('0x20')]=qs['offset'](_0x48629f[_0x5fbb('0x38')][_0x5fbb('0x20')]);}_0x4ff5f[_0x5fbb('0x41')]=qs['sort'](_0x48629f['query']['sort']);_0x4ff5f[_0x5fbb('0x42')]=qs['filters'](_[_0x5fbb('0x43')](_0x48629f[_0x5fbb('0x38')],_0x10cfff[_0x5fbb('0x3a')]),_0x28cd50);if(_0x48629f['query']['filter']){_0x4ff5f[_0x5fbb('0x42')]=_[_0x5fbb('0x44')](_0x4ff5f[_0x5fbb('0x42')],{'$or':_[_0x5fbb('0x31')](_0x28cd50,function(_0x396888){if(_0x396888[_0x5fbb('0x35')]!==_0x5fbb('0x45')){var _0x34d68a={};_0x34d68a[_0x396888[_0x5fbb('0x2e')]]={'$like':'%'+_0x48629f[_0x5fbb('0x38')][_0x5fbb('0x46')]+'%'};return _0x34d68a;}})});}_0x4ff5f=_[_0x5fbb('0x44')]({},_0x4ff5f,_0x48629f['options']);var _0x3448e7={'where':_0x4ff5f[_0x5fbb('0x42')]};return db[_0x5fbb('0x32')][_0x5fbb('0x23')](_0x3448e7)['then'](function(_0x4dea53){_0x196c59[_0x5fbb('0x23')]=_0x4dea53;if(_0x48629f['query'][_0x5fbb('0x47')]){_0x4ff5f['include']=[{'all':!![]}];}return db[_0x5fbb('0x32')]['findAll'](_0x4ff5f);})['then'](function(_0x4fe656){_0x196c59['rows']=_0x4fe656;return _0x196c59;})['then'](respondWithFilteredResult(_0x37ab70,_0x4ff5f))[_0x5fbb('0x48')](handleError(_0x37ab70,null));};exports[_0x5fbb('0x49')]=function(_0x5c69d6,_0x1c540b){var _0x1beb51={'raw':!![],'where':{'id':_0x5c69d6[_0x5fbb('0x4a')]['id']}},_0x41fecd={};_0x41fecd[_0x5fbb('0x37')]=_[_0x5fbb('0x39')](db[_0x5fbb('0x32')][_0x5fbb('0x33')]);_0x41fecd[_0x5fbb('0x38')]=_[_0x5fbb('0x39')](_0x5c69d6['query']);_0x41fecd[_0x5fbb('0x3a')]=_[_0x5fbb('0x3b')](_0x41fecd[_0x5fbb('0x37')],_0x41fecd['query']);_0x1beb51[_0x5fbb('0x3c')]=_[_0x5fbb('0x3b')](_0x41fecd[_0x5fbb('0x37')],qs['fields'](_0x5c69d6[_0x5fbb('0x38')]['fields']));_0x1beb51[_0x5fbb('0x3c')]=_0x1beb51['attributes'][_0x5fbb('0x3e')]?_0x1beb51[_0x5fbb('0x3c')]:_0x41fecd['model'];if(_0x5c69d6[_0x5fbb('0x38')][_0x5fbb('0x47')]){_0x1beb51[_0x5fbb('0x4b')]=[{'all':!![]}];}_0x1beb51=_['merge']({},_0x1beb51,_0x5c69d6['options']);return db['FaxTransferReport'][_0x5fbb('0x4c')](_0x1beb51)[_0x5fbb('0x2a')](handleEntityNotFound(_0x1c540b,null))['then'](respondWithResult(_0x1c540b,null))[_0x5fbb('0x48')](handleError(_0x1c540b,null));};exports[_0x5fbb('0x4d')]=function(_0x4eac23,_0x457512){return db[_0x5fbb('0x32')][_0x5fbb('0x4d')](_0x4eac23[_0x5fbb('0x4e')],{})[_0x5fbb('0x2a')](respondWithResult(_0x457512,0xc9))[_0x5fbb('0x48')](handleError(_0x457512,null));};exports['update']=function(_0x370c40,_0x2a60f7){if(_0x370c40[_0x5fbb('0x4e')]['id']){delete _0x370c40[_0x5fbb('0x4e')]['id'];}return db[_0x5fbb('0x32')][_0x5fbb('0x4c')]({'where':{'id':_0x370c40[_0x5fbb('0x4a')]['id']}})['then'](handleEntityNotFound(_0x2a60f7,null))[_0x5fbb('0x2a')](saveUpdates(_0x370c40[_0x5fbb('0x4e')],null))[_0x5fbb('0x2a')](respondWithResult(_0x2a60f7,null))['catch'](handleError(_0x2a60f7,null));};exports[_0x5fbb('0x2b')]=function(_0x1cd3d8,_0x3dd29b){return db['FaxTransferReport'][_0x5fbb('0x4c')]({'where':{'id':_0x1cd3d8[_0x5fbb('0x4a')]['id']}})[_0x5fbb('0x2a')](handleEntityNotFound(_0x3dd29b,null))[_0x5fbb('0x2a')](removeEntity(_0x3dd29b,null))['catch'](handleError(_0x3dd29b,null));};exports[_0x5fbb('0x4f')]=function(_0x317ba1,_0x29df5b){return db['FaxTransferReport'][_0x5fbb('0x4f')]()[_0x5fbb('0x2a')](respondWithResult(_0x29df5b,null))[_0x5fbb('0x48')](handleError(_0x29df5b,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 99b1ea3..0fb8f08 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 _0xf19d=['define','uniqueid','lodash','util','api','bluebird','path','rimraf','./faxTransferReport.attributes','exports'];(function(_0x35a531,_0x45e081){var _0x5a5112=function(_0x1b73e){while(--_0x1b73e){_0x35a531['push'](_0x35a531['shift']());}};_0x5a5112(++_0x45e081);}(_0xf19d,0xc0));var _0xdf19=function(_0x550d12,_0x5384bd){_0x550d12=_0x550d12-0x0;var _0x12103d=_0xf19d[_0x550d12];return _0x12103d;};'use strict';var _=require(_0xdf19('0x0'));var util=require(_0xdf19('0x1'));var logger=require('../../config/logger')(_0xdf19('0x2'));var moment=require('moment');var BPromise=require(_0xdf19('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdf19('0x4'));var rimraf=require(_0xdf19('0x5'));var config=require('../../config/environment');var attributes=require(_0xdf19('0x6'));module[_0xdf19('0x7')]=function(_0x43dc5c,_0x14f38f){return _0x43dc5c[_0xdf19('0x8')]('FaxTransferReport',attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0xdf19('0x9'),'fields':[_0xdf19('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x8ff4=['uniqueid','lodash','api','moment','request-promise','path','rimraf','../../config/environment','./faxTransferReport.attributes','exports','define','FaxTransferReport','report_fax_transfer'];(function(_0x18b477,_0x555d04){var _0x240b92=function(_0x343b06){while(--_0x343b06){_0x18b477['push'](_0x18b477['shift']());}};_0x240b92(++_0x555d04);}(_0x8ff4,0x11f));var _0x48ff=function(_0x9e7f3a,_0x37105f){_0x9e7f3a=_0x9e7f3a-0x0;var _0x5ab145=_0x8ff4[_0x9e7f3a];return _0x5ab145;};'use strict';var _=require(_0x48ff('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x48ff('0x1'));var moment=require(_0x48ff('0x2'));var BPromise=require('bluebird');var rp=require(_0x48ff('0x3'));var fs=require('fs');var path=require(_0x48ff('0x4'));var rimraf=require(_0x48ff('0x5'));var config=require(_0x48ff('0x6'));var attributes=require(_0x48ff('0x7'));module[_0x48ff('0x8')]=function(_0x2909ca,_0x61d3b9){return _0x2909ca[_0x48ff('0x9')](_0x48ff('0xa'),attributes,{'tableName':_0x48ff('0xb'),'paranoid':![],'indexes':[{'name':_0x48ff('0xc'),'fields':[_0x48ff('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 3473eb5..28c6b67 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 _0xb2d1=['util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x2892da,_0x191a40){var _0x28cff2=function(_0x57023d){while(--_0x57023d){_0x2892da['push'](_0x2892da['shift']());}};_0x28cff2(++_0x191a40);}(_0xb2d1,0x85));var _0x1b2d=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xb2d1[_0x41c381];return _0x427981;};'use strict';var _=require('lodash');var util=require(_0x1b2d('0x0'));var moment=require(_0x1b2d('0x1'));var BPromise=require('bluebird');var rs=require(_0x1b2d('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1b2d('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1b2d('0x4'))('rpc');var config=require(_0x1b2d('0x5'));var jayson=require(_0x1b2d('0x6'));var client=jayson[_0x1b2d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b8ba0,_0xefa451,_0x5f0f55){return new BPromise(function(_0xa1bd10,_0x24063d){return client[_0x1b2d('0x8')](_0x3b8ba0,_0x5f0f55)['then'](function(_0x4df45d){logger[_0x1b2d('0x9')](_0x1b2d('0xa'),_0xefa451,_0x1b2d('0xb'));logger[_0x1b2d('0xc')](_0x1b2d('0xd'),_0xefa451,_0x1b2d('0xb'),JSON[_0x1b2d('0xe')](_0x4df45d));if(_0x4df45d[_0x1b2d('0xf')]){if(_0x4df45d[_0x1b2d('0xf')][_0x1b2d('0x10')]===0x1f4){logger[_0x1b2d('0xf')](_0x1b2d('0xa'),_0xefa451,_0x4df45d['error']['message']);return _0x24063d(_0x4df45d['error'][_0x1b2d('0x11')]);}logger[_0x1b2d('0xf')](_0x1b2d('0xa'),_0xefa451,_0x4df45d[_0x1b2d('0xf')]['message']);return _0xa1bd10(_0x4df45d[_0x1b2d('0xf')][_0x1b2d('0x11')]);}else{logger[_0x1b2d('0x9')](_0x1b2d('0xa'),_0xefa451,_0x1b2d('0xb'));_0xa1bd10(_0x4df45d[_0x1b2d('0x12')][_0x1b2d('0x11')]);}})['catch'](function(_0x55ba34){logger[_0x1b2d('0xf')](_0x1b2d('0xa'),_0xefa451,_0x55ba34);_0x24063d(_0x55ba34);});});} \ No newline at end of file +var _0x2de2=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','util','bluebird','randomstring','ioredis'];(function(_0x21819d,_0x2d83d4){var _0xadaa73=function(_0x33cf23){while(--_0x33cf23){_0x21819d['push'](_0x21819d['shift']());}};_0xadaa73(++_0x2d83d4);}(_0x2de2,0x122));var _0x22de=function(_0x4aa9e2,_0x5a5ffe){_0x4aa9e2=_0x4aa9e2-0x0;var _0x166602=_0x2de2[_0x4aa9e2];return _0x166602;};'use strict';var _=require('lodash');var util=require(_0x22de('0x0'));var moment=require('moment');var BPromise=require(_0x22de('0x1'));var rs=require(_0x22de('0x2'));var fs=require('fs');var Redis=require(_0x22de('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x22de('0x4'));var logger=require(_0x22de('0x5'))(_0x22de('0x6'));var config=require(_0x22de('0x7'));var jayson=require(_0x22de('0x8'));var client=jayson[_0x22de('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3ff22c,_0x4a5356,_0x48ab03){return new BPromise(function(_0x41e798,_0x35f7ff){return client[_0x22de('0xa')](_0x3ff22c,_0x48ab03)['then'](function(_0x5a6f0b){logger[_0x22de('0xb')](_0x22de('0xc'),_0x4a5356,'request\x20sent');logger[_0x22de('0xd')](_0x22de('0xe'),_0x4a5356,_0x22de('0xf'),JSON[_0x22de('0x10')](_0x5a6f0b));if(_0x5a6f0b[_0x22de('0x11')]){if(_0x5a6f0b[_0x22de('0x11')][_0x22de('0x12')]===0x1f4){logger[_0x22de('0x11')](_0x22de('0xc'),_0x4a5356,_0x5a6f0b[_0x22de('0x11')][_0x22de('0x13')]);return _0x35f7ff(_0x5a6f0b[_0x22de('0x11')][_0x22de('0x13')]);}logger[_0x22de('0x11')](_0x22de('0xc'),_0x4a5356,_0x5a6f0b[_0x22de('0x11')]['message']);return _0x41e798(_0x5a6f0b[_0x22de('0x11')][_0x22de('0x13')]);}else{logger['info'](_0x22de('0xc'),_0x4a5356,_0x22de('0xf'));_0x41e798(_0x5a6f0b[_0x22de('0x14')][_0x22de('0x13')]);}})['catch'](function(_0x3924d6){logger[_0x22de('0x11')](_0x22de('0xc'),_0x4a5356,_0x3924d6);_0x35f7ff(_0x3924d6);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index b9c000f..569f1e0 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 _0xdb65=['Router','fs-extra','../../components/interaction/service','../../config/environment','./faxTransferReport.controller','get','/describe','isAuthenticated','/:id','post','create','update','delete','destroy','exports','util','path','connect-timeout','express'];(function(_0x58916b,_0x43fc5d){var _0x238322=function(_0x5cdf4a){while(--_0x5cdf4a){_0x58916b['push'](_0x58916b['shift']());}};_0x238322(++_0x43fc5d);}(_0xdb65,0xcd));var _0x5db6=function(_0x5cb8f3,_0x4fb586){_0x5cb8f3=_0x5cb8f3-0x0;var _0x33f788=_0xdb65[_0x5cb8f3];return _0x33f788;};'use strict';var multer=require('multer');var util=require(_0x5db6('0x0'));var path=require(_0x5db6('0x1'));var timeout=require(_0x5db6('0x2'));var express=require(_0x5db6('0x3'));var router=express[_0x5db6('0x4')]();var fs_extra=require(_0x5db6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x5db6('0x6'));var config=require(_0x5db6('0x7'));var controller=require(_0x5db6('0x8'));router[_0x5db6('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5db6('0xa'),auth[_0x5db6('0xb')](),controller['describe']);router[_0x5db6('0x9')](_0x5db6('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x5db6('0xd')]('/',auth[_0x5db6('0xb')](),controller[_0x5db6('0xe')]);router['put'](_0x5db6('0xc'),auth[_0x5db6('0xb')](),controller[_0x5db6('0xf')]);router[_0x5db6('0x10')](_0x5db6('0xc'),auth[_0x5db6('0xb')](),controller[_0x5db6('0x11')]);module[_0x5db6('0x12')]=router; \ No newline at end of file +var _0x9418=['describe','/:id','post','create','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./faxTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x2c9ac0,_0x1b214d){var _0x4adac3=function(_0x1f18df){while(--_0x1f18df){_0x2c9ac0['push'](_0x2c9ac0['shift']());}};_0x4adac3(++_0x1b214d);}(_0x9418,0xc5));var _0x8941=function(_0x42c2f7,_0x16bbdd){_0x42c2f7=_0x42c2f7-0x0;var _0x55c3ae=_0x9418[_0x42c2f7];return _0x55c3ae;};'use strict';var multer=require(_0x8941('0x0'));var util=require('util');var path=require(_0x8941('0x1'));var timeout=require(_0x8941('0x2'));var express=require(_0x8941('0x3'));var router=express['Router']();var fs_extra=require(_0x8941('0x4'));var auth=require(_0x8941('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8941('0x6'));var controller=require(_0x8941('0x7'));router[_0x8941('0x8')]('/',auth[_0x8941('0x9')](),controller[_0x8941('0xa')]);router[_0x8941('0x8')](_0x8941('0xb'),auth[_0x8941('0x9')](),controller[_0x8941('0xc')]);router[_0x8941('0x8')](_0x8941('0xd'),auth[_0x8941('0x9')](),controller['show']);router[_0x8941('0xe')]('/',auth[_0x8941('0x9')](),controller[_0x8941('0xf')]);router['put'](_0x8941('0xd'),auth[_0x8941('0x9')](),controller[_0x8941('0x10')]);router[_0x8941('0x11')](_0x8941('0xd'),auth[_0x8941('0x9')](),controller['destroy']);module[_0x8941('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 699b447..416398d 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 _0x4dca=['index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','create','addConfiguration','put','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskAccount.controller','isAuthenticated'];(function(_0x2ebab2,_0x5e77af){var _0x90cf47=function(_0x370928){while(--_0x370928){_0x2ebab2['push'](_0x2ebab2['shift']());}};_0x90cf47(++_0x5e77af);}(_0x4dca,0x1ef));var _0xa4dc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4dca[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xa4dc('0x0'));var util=require(_0xa4dc('0x1'));var path=require('path');var timeout=require(_0xa4dc('0x2'));var express=require(_0xa4dc('0x3'));var router=express[_0xa4dc('0x4')]();var fs_extra=require(_0xa4dc('0x5'));var auth=require(_0xa4dc('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xa4dc('0x7'));router['get']('/',auth[_0xa4dc('0x8')](),controller[_0xa4dc('0x9')]);router[_0xa4dc('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xa4dc('0xb')]);router[_0xa4dc('0xa')](_0xa4dc('0xc'),auth[_0xa4dc('0x8')](),controller[_0xa4dc('0xd')]);router[_0xa4dc('0xa')](_0xa4dc('0xe'),auth['isAuthenticated'](),controller[_0xa4dc('0xf')]);router['post']('/',auth[_0xa4dc('0x8')](),controller[_0xa4dc('0x10')]);router['post'](_0xa4dc('0xc'),auth['isAuthenticated'](),controller[_0xa4dc('0x11')]);router[_0xa4dc('0x12')](_0xa4dc('0x13'),auth[_0xa4dc('0x8')](),controller[_0xa4dc('0x14')]);router[_0xa4dc('0x15')]('/:id',auth[_0xa4dc('0x8')](),controller[_0xa4dc('0x16')]);module[_0xa4dc('0x17')]=router; \ No newline at end of file +var _0xdfcf=['/:id/configurations','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post'];(function(_0x503e82,_0x1e4c92){var _0x2eb490=function(_0x5f41d9){while(--_0x5f41d9){_0x503e82['push'](_0x503e82['shift']());}};_0x2eb490(++_0x1e4c92);}(_0xdfcf,0x176));var _0xfdfc=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xdfcf[_0x42cae2];return _0x5f256f;};'use strict';var multer=require('multer');var util=require(_0xfdfc('0x0'));var path=require(_0xfdfc('0x1'));var timeout=require(_0xfdfc('0x2'));var express=require(_0xfdfc('0x3'));var router=express[_0xfdfc('0x4')]();var fs_extra=require(_0xfdfc('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfdfc('0x6'));var config=require(_0xfdfc('0x7'));var controller=require('./intDeskAccount.controller');router[_0xfdfc('0x8')]('/',auth[_0xfdfc('0x9')](),controller[_0xfdfc('0xa')]);router['get'](_0xfdfc('0xb'),auth[_0xfdfc('0x9')](),controller[_0xfdfc('0xc')]);router[_0xfdfc('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0xfdfc('0xd')]);router[_0xfdfc('0x8')](_0xfdfc('0xe'),auth[_0xfdfc('0x9')](),controller[_0xfdfc('0xf')]);router[_0xfdfc('0x10')]('/',auth[_0xfdfc('0x9')](),controller['create']);router[_0xfdfc('0x10')](_0xfdfc('0x11'),auth[_0xfdfc('0x9')](),controller['addConfiguration']);router[_0xfdfc('0x12')](_0xfdfc('0xb'),auth[_0xfdfc('0x9')](),controller[_0xfdfc('0x13')]);router[_0xfdfc('0x14')](_0xfdfc('0xb'),auth['isAuthenticated'](),controller[_0xfdfc('0x15')]);module[_0xfdfc('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.attributes.js b/server/api/intDeskAccount/intDeskAccount.attributes.js index f172660..6fcc2ab 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 _0x23cd=['STRING','ENUM','basic','integrationTab','newTab','exports'];(function(_0x4df083,_0x286520){var _0x3cd107=function(_0x3e0e2f){while(--_0x3e0e2f){_0x4df083['push'](_0x4df083['shift']());}};_0x3cd107(++_0x286520);}(_0x23cd,0x95));var _0xd23c=function(_0x274d0b,_0x13e0a7){_0x274d0b=_0x274d0b-0x0;var _0x5ebb41=_0x23cd[_0x274d0b];return _0x5ebb41;};'use strict';var Sequelize=require('sequelize');module[_0xd23c('0x0')]={'name':{'type':Sequelize[_0xd23c('0x1')]},'description':{'type':Sequelize[_0xd23c('0x1')]},'username':{'type':Sequelize[_0xd23c('0x1')]},'remoteUri':{'type':Sequelize[_0xd23c('0x1')]},'authType':{'type':Sequelize[_0xd23c('0x2')](_0xd23c('0x3')),'defaultValue':_0xd23c('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xd23c('0x1')]},'consumerSecret':{'type':Sequelize[_0xd23c('0x1')]},'token':{'type':Sequelize[_0xd23c('0x1')]},'tokenSecret':{'type':Sequelize[_0xd23c('0x1')]},'serverUrl':{'type':Sequelize[_0xd23c('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xd23c('0x2')](_0xd23c('0x4'),_0xd23c('0x5')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x722c=['sequelize','STRING','ENUM','basic','integrationTab','newTab'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x722c,0x198));var _0xc722=function(_0x15a212,_0x5ad3e1){_0x15a212=_0x15a212-0x0;var _0x4a0eed=_0x722c[_0x15a212];return _0x4a0eed;};'use strict';var Sequelize=require(_0xc722('0x0'));module['exports']={'name':{'type':Sequelize[_0xc722('0x1')]},'description':{'type':Sequelize[_0xc722('0x1')]},'username':{'type':Sequelize[_0xc722('0x1')]},'remoteUri':{'type':Sequelize[_0xc722('0x1')]},'authType':{'type':Sequelize[_0xc722('0x2')](_0xc722('0x3')),'defaultValue':_0xc722('0x3')},'password':{'type':Sequelize['STRING']},'consumerKey':{'type':Sequelize[_0xc722('0x1')]},'consumerSecret':{'type':Sequelize[_0xc722('0x1')]},'token':{'type':Sequelize[_0xc722('0x1')]},'tokenSecret':{'type':Sequelize[_0xc722('0x1')]},'serverUrl':{'type':Sequelize[_0xc722('0x1')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0xc722('0x4'),_0xc722('0x5')),'defaultValue':_0xc722('0x4')}}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.controller.js b/server/api/intDeskAccount/intDeskAccount.controller.js index 1b35f18..fa52b49 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 _0x83e7=['error','stack','name','send','index','map','DeskAccount','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','VIRTUAL','merge','includeAll','include','rows','catch','params','rawAttributes','options','find','create','body','getConfigurations','findOne','DeskConfiguration','nolimit','addConfiguration','AccountId','getSubjects','Descriptions','getDescriptions','Subjects','DeskField','priority','remoteUri','authType','username','password','consumerSecret','token','tokenSecret','slice','GET','application/json','headers','Authorization','format','Basic\x20%s','%s:%s','toString','base64','concat','_embedded','entries','label','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','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','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','set','Content-Range','save','update','then'];(function(_0x1f4551,_0x27d4c8){var _0x1564f8=function(_0x233e89){while(--_0x233e89){_0x1f4551['push'](_0x1f4551['shift']());}};_0x1564f8(++_0x27d4c8);}(_0x83e7,0x1a5));var _0x783e=function(_0x4648ff,_0x582172){_0x4648ff=_0x4648ff-0x0;var _0x26070b=_0x83e7[_0x4648ff];return _0x26070b;};'use strict';var emlformat=require(_0x783e('0x0'));var rimraf=require(_0x783e('0x1'));var zipdir=require(_0x783e('0x2'));var jsonpatch=require(_0x783e('0x3'));var rp=require(_0x783e('0x4'));var moment=require(_0x783e('0x5'));var BPromise=require(_0x783e('0x6'));var Mustache=require(_0x783e('0x7'));var util=require(_0x783e('0x8'));var path=require(_0x783e('0x9'));var sox=require(_0x783e('0xa'));var csv=require(_0x783e('0xb'));var ejs=require(_0x783e('0xc'));var fs=require('fs');var fs_extra=require(_0x783e('0xd'));var _=require(_0x783e('0xe'));var squel=require(_0x783e('0xf'));var crypto=require(_0x783e('0x10'));var jsforce=require(_0x783e('0x11'));var deskjs=require('desk.js');var toCsv=require(_0x783e('0xb'));var querystring=require(_0x783e('0x12'));var Papa=require(_0x783e('0x13'));var Redis=require(_0x783e('0x14'));var authService=require(_0x783e('0x15'));var qs=require(_0x783e('0x16'));var as=require(_0x783e('0x17'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x783e('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x783e('0x19'));var db=require(_0x783e('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x45acd8,_0x26236b){_0x26236b=_0x26236b||0xcc;return function(_0x5c82a5){if(_0x5c82a5){return _0x45acd8[_0x783e('0x1b')](_0x26236b);}return _0x45acd8['status'](_0x26236b)[_0x783e('0x1c')]();};}function respondWithResult(_0x4c4039,_0x1aa4bb){_0x1aa4bb=_0x1aa4bb||0xc8;return function(_0x3ee66e){if(_0x3ee66e){return _0x4c4039[_0x783e('0x1d')](_0x1aa4bb)[_0x783e('0x1e')](_0x3ee66e);}};}function respondWithFilteredResult(_0x4ed28b,_0x4c6f41){return function(_0x468f20){if(_0x468f20){var _0x341996=typeof _0x4c6f41[_0x783e('0x1f')]===_0x783e('0x20')&&typeof _0x4c6f41['limit']==='undefined';var _0x1b1b32=_0x468f20[_0x783e('0x21')];var _0x40ff42=_0x341996?0x0:_0x4c6f41['offset'];var _0x17ba07=_0x341996?_0x468f20[_0x783e('0x21')]:_0x4c6f41[_0x783e('0x1f')]+_0x4c6f41['limit'];var _0x272602;if(_0x17ba07>=_0x1b1b32){_0x17ba07=_0x1b1b32;_0x272602=0xc8;}else{_0x272602=0xce;}_0x4ed28b[_0x783e('0x1d')](_0x272602);return _0x4ed28b[_0x783e('0x22')](_0x783e('0x23'),_0x40ff42+'-'+_0x17ba07+'/'+_0x1b1b32)[_0x783e('0x1e')](_0x468f20);}return null;};}function patchUpdates(_0x2a4787){return function(_0x44ed8a){try{jsonpatch['apply'](_0x44ed8a,_0x2a4787,!![]);}catch(_0x37e64e){return BPromise['reject'](_0x37e64e);}return _0x44ed8a[_0x783e('0x24')]();};}function saveUpdates(_0x5a9246,_0xea83db){return function(_0x2f49db){if(_0x2f49db){return _0x2f49db[_0x783e('0x25')](_0x5a9246)[_0x783e('0x26')](function(_0x570f70){return _0x570f70;});}return null;};}function removeEntity(_0x3784f3,_0x31ada3){return function(_0x5720b9){if(_0x5720b9){return _0x5720b9['destroy']()['then'](function(){_0x3784f3[_0x783e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c60b8,_0x22c058){return function(_0x3968ef){if(!_0x3968ef){_0x3c60b8[_0x783e('0x1b')](0x194);}return _0x3968ef;};}function handleError(_0x341e8f,_0xf3e523){_0xf3e523=_0xf3e523||0x1f4;return function(_0x3f0c49){logger[_0x783e('0x27')](_0x3f0c49[_0x783e('0x28')]);if(_0x3f0c49[_0x783e('0x29')]){delete _0x3f0c49[_0x783e('0x29')];}_0x341e8f[_0x783e('0x1d')](_0xf3e523)[_0x783e('0x2a')](_0x3f0c49);};}exports[_0x783e('0x2b')]=function(_0x55e95c,_0x2e55f1){var _0x5bef61={},_0x3cdc39={},_0x5d065f={'count':0x0,'rows':[]};var _0x24921f=_[_0x783e('0x2c')](db[_0x783e('0x2d')]['rawAttributes'],function(_0x587dbe){return{'name':_0x587dbe[_0x783e('0x2e')],'type':_0x587dbe[_0x783e('0x2f')][_0x783e('0x30')]};});_0x3cdc39[_0x783e('0x31')]=_[_0x783e('0x2c')](_0x24921f,_0x783e('0x29'));_0x3cdc39[_0x783e('0x32')]=_[_0x783e('0x33')](_0x55e95c[_0x783e('0x32')]);_0x3cdc39['filters']=_[_0x783e('0x34')](_0x3cdc39[_0x783e('0x31')],_0x3cdc39[_0x783e('0x32')]);_0x5bef61[_0x783e('0x35')]=_['intersection'](_0x3cdc39[_0x783e('0x31')],qs['fields'](_0x55e95c[_0x783e('0x32')][_0x783e('0x36')]));_0x5bef61[_0x783e('0x35')]=_0x5bef61[_0x783e('0x35')][_0x783e('0x37')]?_0x5bef61[_0x783e('0x35')]:_0x3cdc39[_0x783e('0x31')];if(!_0x55e95c[_0x783e('0x32')][_0x783e('0x38')]('nolimit')){_0x5bef61[_0x783e('0x39')]=qs[_0x783e('0x39')](_0x55e95c[_0x783e('0x32')][_0x783e('0x39')]);_0x5bef61['offset']=qs[_0x783e('0x1f')](_0x55e95c['query'][_0x783e('0x1f')]);}_0x5bef61[_0x783e('0x3a')]=qs[_0x783e('0x3b')](_0x55e95c[_0x783e('0x32')][_0x783e('0x3b')]);_0x5bef61[_0x783e('0x3c')]=qs['filters'](_[_0x783e('0x3d')](_0x55e95c[_0x783e('0x32')],_0x3cdc39[_0x783e('0x3e')]),_0x24921f);if(_0x55e95c['query'][_0x783e('0x3f')]){_0x5bef61[_0x783e('0x3c')]=_['merge'](_0x5bef61[_0x783e('0x3c')],{'$or':_['map'](_0x24921f,function(_0x2c1e3a){if(_0x2c1e3a['type']!==_0x783e('0x40')){var _0x53bc77={};_0x53bc77[_0x2c1e3a[_0x783e('0x29')]]={'$like':'%'+_0x55e95c['query']['filter']+'%'};return _0x53bc77;}})});}_0x5bef61=_[_0x783e('0x41')]({},_0x5bef61,_0x55e95c['options']);var _0x107447={'where':_0x5bef61[_0x783e('0x3c')]};return db[_0x783e('0x2d')][_0x783e('0x21')](_0x107447)[_0x783e('0x26')](function(_0xca1b9d){_0x5d065f[_0x783e('0x21')]=_0xca1b9d;if(_0x55e95c[_0x783e('0x32')][_0x783e('0x42')]){_0x5bef61[_0x783e('0x43')]=[{'all':!![]}];}return db[_0x783e('0x2d')]['findAll'](_0x5bef61);})[_0x783e('0x26')](function(_0x422463){_0x5d065f[_0x783e('0x44')]=_0x422463;return _0x5d065f;})[_0x783e('0x26')](respondWithFilteredResult(_0x2e55f1,_0x5bef61))[_0x783e('0x45')](handleError(_0x2e55f1,null));};exports['show']=function(_0x318a59,_0x546609){var _0x5926cf={'raw':![],'where':{'id':_0x318a59[_0x783e('0x46')]['id']}},_0x1eac33={};_0x1eac33[_0x783e('0x31')]=_[_0x783e('0x33')](db[_0x783e('0x2d')][_0x783e('0x47')]);_0x1eac33[_0x783e('0x32')]=_[_0x783e('0x33')](_0x318a59['query']);_0x1eac33[_0x783e('0x3e')]=_[_0x783e('0x34')](_0x1eac33['model'],_0x1eac33[_0x783e('0x32')]);_0x5926cf[_0x783e('0x35')]=_[_0x783e('0x34')](_0x1eac33[_0x783e('0x31')],qs[_0x783e('0x36')](_0x318a59['query'][_0x783e('0x36')]));_0x5926cf[_0x783e('0x35')]=_0x5926cf[_0x783e('0x35')][_0x783e('0x37')]?_0x5926cf[_0x783e('0x35')]:_0x1eac33[_0x783e('0x31')];if(_0x318a59[_0x783e('0x32')][_0x783e('0x42')]){_0x5926cf[_0x783e('0x43')]=[{'all':!![]}];}_0x5926cf=_[_0x783e('0x41')]({},_0x5926cf,_0x318a59[_0x783e('0x48')]);return db[_0x783e('0x2d')][_0x783e('0x49')](_0x5926cf)['then'](handleEntityNotFound(_0x546609,null))[_0x783e('0x26')](respondWithResult(_0x546609,null))[_0x783e('0x45')](handleError(_0x546609,null));};exports[_0x783e('0x4a')]=function(_0x330e6e,_0x1645b0){return db[_0x783e('0x2d')][_0x783e('0x4a')](_0x330e6e[_0x783e('0x4b')],{})[_0x783e('0x26')](respondWithResult(_0x1645b0,0xc9))['catch'](handleError(_0x1645b0,null));};exports['update']=function(_0x3ef6d7,_0x3e8d2a){if(_0x3ef6d7[_0x783e('0x4b')]['id']){delete _0x3ef6d7[_0x783e('0x4b')]['id'];}return db['DeskAccount'][_0x783e('0x49')]({'where':{'id':_0x3ef6d7[_0x783e('0x46')]['id']}})[_0x783e('0x26')](handleEntityNotFound(_0x3e8d2a,null))[_0x783e('0x26')](saveUpdates(_0x3ef6d7[_0x783e('0x4b')],null))[_0x783e('0x26')](respondWithResult(_0x3e8d2a,null))[_0x783e('0x45')](handleError(_0x3e8d2a,null));};exports['destroy']=function(_0x2750b0,_0x2abe3c){return db[_0x783e('0x2d')][_0x783e('0x49')]({'where':{'id':_0x2750b0['params']['id']}})['then'](handleEntityNotFound(_0x2abe3c,null))[_0x783e('0x26')](removeEntity(_0x2abe3c,null))['catch'](handleError(_0x2abe3c,null));};exports[_0x783e('0x4c')]=function(_0x31c559,_0x2bc76c,_0x4e52a6){var _0x4da32e={};var _0x5ba76f={};var _0x54c9c3;var _0x20157f;return db['DeskAccount'][_0x783e('0x4d')]({'where':{'id':_0x31c559[_0x783e('0x46')]['id']}})[_0x783e('0x26')](handleEntityNotFound(_0x2bc76c,null))[_0x783e('0x26')](function(_0xf57dee){if(_0xf57dee){_0x54c9c3=_0xf57dee;_0x5ba76f[_0x783e('0x31')]=_['keys'](db[_0x783e('0x4e')]['rawAttributes']);_0x5ba76f['query']=_[_0x783e('0x33')](_0x31c559[_0x783e('0x32')]);_0x5ba76f['filters']=_[_0x783e('0x34')](_0x5ba76f[_0x783e('0x31')],_0x5ba76f['query']);_0x4da32e[_0x783e('0x35')]=_[_0x783e('0x34')](_0x5ba76f['model'],qs[_0x783e('0x36')](_0x31c559[_0x783e('0x32')][_0x783e('0x36')]));_0x4da32e['attributes']=_0x4da32e['attributes']['length']?_0x4da32e[_0x783e('0x35')]:_0x5ba76f[_0x783e('0x31')];_0x4da32e[_0x783e('0x3a')]=qs['sort'](_0x31c559[_0x783e('0x32')][_0x783e('0x3b')]);_0x4da32e['where']=qs[_0x783e('0x3e')](_[_0x783e('0x3d')](_0x31c559[_0x783e('0x32')],_0x5ba76f[_0x783e('0x3e')]));if(_0x31c559['query'][_0x783e('0x3f')]){_0x4da32e[_0x783e('0x3c')]=_[_0x783e('0x41')](_0x4da32e[_0x783e('0x3c')],{'$or':_[_0x783e('0x2c')](_0x4da32e[_0x783e('0x35')],function(_0x3156cb){var _0x470895={};_0x470895[_0x3156cb]={'$like':'%'+_0x31c559[_0x783e('0x32')][_0x783e('0x3f')]+'%'};return _0x470895;})});}_0x4da32e=_[_0x783e('0x41')]({},_0x4da32e,_0x31c559['options']);return _0x54c9c3[_0x783e('0x4c')](_0x4da32e);}})[_0x783e('0x26')](function(_0x2d0b8a){if(_0x2d0b8a){_0x20157f=_0x2d0b8a['length'];if(!_0x31c559[_0x783e('0x32')]['hasOwnProperty'](_0x783e('0x4f'))){_0x4da32e['limit']=qs[_0x783e('0x39')](_0x31c559['query'][_0x783e('0x39')]);_0x4da32e[_0x783e('0x1f')]=qs[_0x783e('0x1f')](_0x31c559['query'][_0x783e('0x1f')]);}return _0x54c9c3[_0x783e('0x4c')](_0x4da32e);}})[_0x783e('0x26')](function(_0x3de5c9){if(_0x3de5c9){return _0x3de5c9?{'count':_0x20157f,'rows':_0x3de5c9}:null;}})[_0x783e('0x26')](respondWithResult(_0x2bc76c,null))['catch'](handleError(_0x2bc76c,null));};exports[_0x783e('0x50')]=function(_0x3705c4,_0x249b97,_0x313e82){if(_0x3705c4[_0x783e('0x4b')]['id']){delete _0x3705c4[_0x783e('0x4b')]['id'];}return db['DeskAccount'][_0x783e('0x4d')]({'where':{'id':_0x3705c4[_0x783e('0x46')]['id']}})[_0x783e('0x26')](handleEntityNotFound(_0x249b97,null))[_0x783e('0x26')](function(_0x35e455){if(_0x35e455){_0x3705c4[_0x783e('0x4b')][_0x783e('0x51')]=_0x35e455['id'];_0x3705c4[_0x783e('0x4b')]['Subjects']=integrations[_0x783e('0x52')](_0x3705c4[_0x783e('0x4b')]['channel'],_0x3705c4[_0x783e('0x4b')][_0x783e('0x2f')]);_0x3705c4['body'][_0x783e('0x53')]=integrations[_0x783e('0x54')](_0x3705c4[_0x783e('0x4b')]['channel'],_0x3705c4[_0x783e('0x4b')][_0x783e('0x2f')]);return db[_0x783e('0x4e')]['create'](_0x3705c4[_0x783e('0x4b')],{'include':[{'model':db['DeskField'],'as':_0x783e('0x55')},{'model':db[_0x783e('0x56')],'as':_0x783e('0x53')}]});}return null;})['then'](respondWithResult(_0x249b97,null))[_0x783e('0x45')](handleError(_0x249b97,null));};exports['getFields']=function(_0x2d48e7,_0x5bfeb1,_0x35a9ba){var _0x1645ff=[{'name':_0x783e('0x57'),'label':_0x783e('0x57'),'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 _0x590285='';return db['DeskAccount']['findOne']({'where':{'id':_0x2d48e7[_0x783e('0x46')]['id']},'attributes':['id',_0x783e('0x58'),_0x783e('0x59'),_0x783e('0x5a'),_0x783e('0x5b'),'consumerKey',_0x783e('0x5c'),_0x783e('0x5d'),_0x783e('0x5e')]})[_0x783e('0x26')](handleEntityNotFound(_0x5bfeb1,null))[_0x783e('0x26')](function(_0x2a61eb){if(_0x2a61eb){_0x590285=_0x2a61eb[_0x783e('0x58')];var _0x438946=_0x590285[_0x783e('0x5f')](-0x1);if(_0x438946==='/'){_0x590285=_0x590285['substring'](0x0,_0x590285['lastIndexOf'](_0x438946));}var _0x17ea43={'method':_0x783e('0x60'),'uri':util['format']('%s/custom_fields',_0x590285),'headers':{'Content-Type':_0x783e('0x61'),'Accept':_0x783e('0x61')},'json':!![]};if(_0x2a61eb[_0x783e('0x59')]==='basic'){_0x17ea43[_0x783e('0x62')][_0x783e('0x63')]=util[_0x783e('0x64')](_0x783e('0x65'),new Buffer(util[_0x783e('0x64')](_0x783e('0x66'),_0x2a61eb[_0x783e('0x5a')],_0x2a61eb[_0x783e('0x5b')]))[_0x783e('0x67')](_0x783e('0x68')));}return rp(_0x17ea43)[_0x783e('0x26')](function(_0x218d96){return _0x1645ff[_0x783e('0x69')](_['map'](_0x218d96[_0x783e('0x6a')][_0x783e('0x6b')],function(_0x4fe69d){return{'id':_0x4fe69d['name'],'name':_0x4fe69d['name'],'type':_0x4fe69d[_0x783e('0x2f')],'active':_0x4fe69d['active'],'label':_0x4fe69d[_0x783e('0x6c')],'custom':!![]};}));});}})[_0x783e('0x26')](function(_0x5630f6){return{'count':_0x5630f6[_0x783e('0x37')],'rows':_0x5630f6};})[_0x783e('0x26')](respondWithResult(_0x5bfeb1,null))[_0x783e('0x45')](function(_0x249f7b){var _0x437978=_0x2d48e7[_0x783e('0x32')][_0x783e('0x6d')]?0x1f4:_0x249f7b[_0x783e('0x6e')]||0x1f4;logger[_0x783e('0x27')](_0x783e('0x6f'),_0x783e('0x70'),_0x437978,JSON[_0x783e('0x71')](_0x249f7b));delete _0x249f7b[_0x783e('0x29')];if(_0x437978===0x191){_0x437978=0x190;}_0x5bfeb1[_0x783e('0x1d')](_0x437978)[_0x783e('0x2a')](_0x2d48e7[_0x783e('0x32')]['test']?{'message':_0x783e('0x72'),'statusCode':_0x249f7b[_0x783e('0x6e')]}:_0x249f7b);});}; \ No newline at end of file +var _0x52c6=['sort','pick','filter','where','merge','includeAll','include','rows','catch','show','params','keys','options','find','create','body','getConfigurations','findOne','DeskConfiguration','order','addConfiguration','channel','DeskField','Descriptions','priority','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','Basic\x20%s','%s:%s','username','toString','base64','_embedded','entries','active','label','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','test','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','error','stack','name','send','index','map','DeskAccount','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x13292f,_0x203f6f){var _0x4a2038=function(_0x567787){while(--_0x567787){_0x13292f['push'](_0x13292f['shift']());}};_0x4a2038(++_0x203f6f);}(_0x52c6,0x112));var _0x652c=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x52c6[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x652c('0x0'));var zipdir=require(_0x652c('0x1'));var jsonpatch=require(_0x652c('0x2'));var rp=require(_0x652c('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x652c('0x4'));var util=require(_0x652c('0x5'));var path=require(_0x652c('0x6'));var sox=require(_0x652c('0x7'));var csv=require('to-csv');var ejs=require(_0x652c('0x8'));var fs=require('fs');var fs_extra=require(_0x652c('0x9'));var _=require(_0x652c('0xa'));var squel=require('squel');var crypto=require(_0x652c('0xb'));var jsforce=require(_0x652c('0xc'));var deskjs=require(_0x652c('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x652c('0xe'));var qs=require(_0x652c('0xf'));var as=require(_0x652c('0x10'));var hardwareService=require(_0x652c('0x11'));var logger=require('../../config/logger')(_0x652c('0x12'));var utils=require(_0x652c('0x13'));var config=require(_0x652c('0x14'));var licenseUtil=require(_0x652c('0x15'));var db=require(_0x652c('0x16'))['db'];var integrations=require(_0x652c('0x17'));function respondWithStatusCode(_0xb04b9c,_0x1684d7){_0x1684d7=_0x1684d7||0xcc;return function(_0x31a469){if(_0x31a469){return _0xb04b9c[_0x652c('0x18')](_0x1684d7);}return _0xb04b9c[_0x652c('0x19')](_0x1684d7)['end']();};}function respondWithResult(_0x16c0eb,_0x448f38){_0x448f38=_0x448f38||0xc8;return function(_0x590c46){if(_0x590c46){return _0x16c0eb[_0x652c('0x19')](_0x448f38)[_0x652c('0x1a')](_0x590c46);}};}function respondWithFilteredResult(_0x1d9f24,_0x5cf312){return function(_0x33769f){if(_0x33769f){var _0xf1cf38=typeof _0x5cf312[_0x652c('0x1b')]===_0x652c('0x1c')&&typeof _0x5cf312['limit']===_0x652c('0x1c');var _0x5eecdd=_0x33769f['count'];var _0x4f8a9e=_0xf1cf38?0x0:_0x5cf312['offset'];var _0x51bdcb=_0xf1cf38?_0x33769f[_0x652c('0x1d')]:_0x5cf312[_0x652c('0x1b')]+_0x5cf312[_0x652c('0x1e')];var _0x504224;if(_0x51bdcb>=_0x5eecdd){_0x51bdcb=_0x5eecdd;_0x504224=0xc8;}else{_0x504224=0xce;}_0x1d9f24[_0x652c('0x19')](_0x504224);return _0x1d9f24[_0x652c('0x1f')](_0x652c('0x20'),_0x4f8a9e+'-'+_0x51bdcb+'/'+_0x5eecdd)[_0x652c('0x1a')](_0x33769f);}return null;};}function patchUpdates(_0x9b6d1f){return function(_0x5d0ae7){try{jsonpatch[_0x652c('0x21')](_0x5d0ae7,_0x9b6d1f,!![]);}catch(_0x13f054){return BPromise[_0x652c('0x22')](_0x13f054);}return _0x5d0ae7['save']();};}function saveUpdates(_0x5c4fe2,_0x69ef43){return function(_0x30db34){if(_0x30db34){return _0x30db34[_0x652c('0x23')](_0x5c4fe2)[_0x652c('0x24')](function(_0xcbf5c4){return _0xcbf5c4;});}return null;};}function removeEntity(_0x46e8b4,_0x30a52b){return function(_0x4aef6d){if(_0x4aef6d){return _0x4aef6d[_0x652c('0x25')]()['then'](function(){_0x46e8b4[_0x652c('0x19')](0xcc)[_0x652c('0x26')]();});}};}function handleEntityNotFound(_0x122845,_0x7d413d){return function(_0x36d582){if(!_0x36d582){_0x122845[_0x652c('0x18')](0x194);}return _0x36d582;};}function handleError(_0x2c6bca,_0x8fd7de){_0x8fd7de=_0x8fd7de||0x1f4;return function(_0x3c8973){logger[_0x652c('0x27')](_0x3c8973[_0x652c('0x28')]);if(_0x3c8973['name']){delete _0x3c8973[_0x652c('0x29')];}_0x2c6bca[_0x652c('0x19')](_0x8fd7de)[_0x652c('0x2a')](_0x3c8973);};}exports[_0x652c('0x2b')]=function(_0x12303f,_0x7ebd92){var _0x2c9f8c={},_0x3faa27={},_0x3f7f4d={'count':0x0,'rows':[]};var _0x366fb4=_[_0x652c('0x2c')](db[_0x652c('0x2d')][_0x652c('0x2e')],function(_0x35a70e){return{'name':_0x35a70e[_0x652c('0x2f')],'type':_0x35a70e[_0x652c('0x30')][_0x652c('0x31')]};});_0x3faa27[_0x652c('0x32')]=_[_0x652c('0x2c')](_0x366fb4,'name');_0x3faa27[_0x652c('0x33')]=_['keys'](_0x12303f['query']);_0x3faa27[_0x652c('0x34')]=_[_0x652c('0x35')](_0x3faa27[_0x652c('0x32')],_0x3faa27[_0x652c('0x33')]);_0x2c9f8c[_0x652c('0x36')]=_[_0x652c('0x35')](_0x3faa27[_0x652c('0x32')],qs[_0x652c('0x37')](_0x12303f[_0x652c('0x33')][_0x652c('0x37')]));_0x2c9f8c[_0x652c('0x36')]=_0x2c9f8c[_0x652c('0x36')][_0x652c('0x38')]?_0x2c9f8c[_0x652c('0x36')]:_0x3faa27[_0x652c('0x32')];if(!_0x12303f[_0x652c('0x33')][_0x652c('0x39')](_0x652c('0x3a'))){_0x2c9f8c[_0x652c('0x1e')]=qs[_0x652c('0x1e')](_0x12303f[_0x652c('0x33')][_0x652c('0x1e')]);_0x2c9f8c['offset']=qs[_0x652c('0x1b')](_0x12303f[_0x652c('0x33')][_0x652c('0x1b')]);}_0x2c9f8c['order']=qs[_0x652c('0x3b')](_0x12303f['query'][_0x652c('0x3b')]);_0x2c9f8c['where']=qs[_0x652c('0x34')](_[_0x652c('0x3c')](_0x12303f[_0x652c('0x33')],_0x3faa27['filters']),_0x366fb4);if(_0x12303f[_0x652c('0x33')][_0x652c('0x3d')]){_0x2c9f8c[_0x652c('0x3e')]=_['merge'](_0x2c9f8c[_0x652c('0x3e')],{'$or':_['map'](_0x366fb4,function(_0x2c8241){if(_0x2c8241[_0x652c('0x30')]!=='VIRTUAL'){var _0x326811={};_0x326811[_0x2c8241[_0x652c('0x29')]]={'$like':'%'+_0x12303f[_0x652c('0x33')][_0x652c('0x3d')]+'%'};return _0x326811;}})});}_0x2c9f8c=_[_0x652c('0x3f')]({},_0x2c9f8c,_0x12303f['options']);var _0x7fcf12={'where':_0x2c9f8c['where']};return db[_0x652c('0x2d')][_0x652c('0x1d')](_0x7fcf12)['then'](function(_0x307e99){_0x3f7f4d['count']=_0x307e99;if(_0x12303f[_0x652c('0x33')][_0x652c('0x40')]){_0x2c9f8c[_0x652c('0x41')]=[{'all':!![]}];}return db[_0x652c('0x2d')]['findAll'](_0x2c9f8c);})['then'](function(_0x48c2a9){_0x3f7f4d[_0x652c('0x42')]=_0x48c2a9;return _0x3f7f4d;})[_0x652c('0x24')](respondWithFilteredResult(_0x7ebd92,_0x2c9f8c))[_0x652c('0x43')](handleError(_0x7ebd92,null));};exports[_0x652c('0x44')]=function(_0x24c45d,_0xd77038){var _0x1ab0c8={'raw':![],'where':{'id':_0x24c45d[_0x652c('0x45')]['id']}},_0x555805={};_0x555805[_0x652c('0x32')]=_[_0x652c('0x46')](db['DeskAccount']['rawAttributes']);_0x555805[_0x652c('0x33')]=_[_0x652c('0x46')](_0x24c45d[_0x652c('0x33')]);_0x555805[_0x652c('0x34')]=_[_0x652c('0x35')](_0x555805[_0x652c('0x32')],_0x555805[_0x652c('0x33')]);_0x1ab0c8[_0x652c('0x36')]=_['intersection'](_0x555805[_0x652c('0x32')],qs['fields'](_0x24c45d[_0x652c('0x33')][_0x652c('0x37')]));_0x1ab0c8['attributes']=_0x1ab0c8[_0x652c('0x36')]['length']?_0x1ab0c8[_0x652c('0x36')]:_0x555805[_0x652c('0x32')];if(_0x24c45d[_0x652c('0x33')][_0x652c('0x40')]){_0x1ab0c8['include']=[{'all':!![]}];}_0x1ab0c8=_['merge']({},_0x1ab0c8,_0x24c45d[_0x652c('0x47')]);return db[_0x652c('0x2d')][_0x652c('0x48')](_0x1ab0c8)[_0x652c('0x24')](handleEntityNotFound(_0xd77038,null))[_0x652c('0x24')](respondWithResult(_0xd77038,null))[_0x652c('0x43')](handleError(_0xd77038,null));};exports['create']=function(_0x12c4fd,_0x45a782){return db['DeskAccount'][_0x652c('0x49')](_0x12c4fd[_0x652c('0x4a')],{})['then'](respondWithResult(_0x45a782,0xc9))[_0x652c('0x43')](handleError(_0x45a782,null));};exports[_0x652c('0x23')]=function(_0x12b69c,_0x4096e1){if(_0x12b69c[_0x652c('0x4a')]['id']){delete _0x12b69c[_0x652c('0x4a')]['id'];}return db['DeskAccount']['find']({'where':{'id':_0x12b69c[_0x652c('0x45')]['id']}})[_0x652c('0x24')](handleEntityNotFound(_0x4096e1,null))[_0x652c('0x24')](saveUpdates(_0x12b69c[_0x652c('0x4a')],null))[_0x652c('0x24')](respondWithResult(_0x4096e1,null))[_0x652c('0x43')](handleError(_0x4096e1,null));};exports[_0x652c('0x25')]=function(_0x3ac59d,_0x420ae1){return db[_0x652c('0x2d')][_0x652c('0x48')]({'where':{'id':_0x3ac59d[_0x652c('0x45')]['id']}})['then'](handleEntityNotFound(_0x420ae1,null))[_0x652c('0x24')](removeEntity(_0x420ae1,null))[_0x652c('0x43')](handleError(_0x420ae1,null));};exports[_0x652c('0x4b')]=function(_0x488cd4,_0x3ce467,_0xdae3c1){var _0x78b44={};var _0x3ad42f={};var _0x318a2e;var _0x24b3f8;return db[_0x652c('0x2d')][_0x652c('0x4c')]({'where':{'id':_0x488cd4[_0x652c('0x45')]['id']}})[_0x652c('0x24')](handleEntityNotFound(_0x3ce467,null))['then'](function(_0x1bba61){if(_0x1bba61){_0x318a2e=_0x1bba61;_0x3ad42f[_0x652c('0x32')]=_[_0x652c('0x46')](db[_0x652c('0x4d')][_0x652c('0x2e')]);_0x3ad42f[_0x652c('0x33')]=_['keys'](_0x488cd4['query']);_0x3ad42f['filters']=_[_0x652c('0x35')](_0x3ad42f[_0x652c('0x32')],_0x3ad42f[_0x652c('0x33')]);_0x78b44['attributes']=_[_0x652c('0x35')](_0x3ad42f[_0x652c('0x32')],qs[_0x652c('0x37')](_0x488cd4[_0x652c('0x33')]['fields']));_0x78b44[_0x652c('0x36')]=_0x78b44[_0x652c('0x36')][_0x652c('0x38')]?_0x78b44[_0x652c('0x36')]:_0x3ad42f['model'];_0x78b44[_0x652c('0x4e')]=qs['sort'](_0x488cd4[_0x652c('0x33')][_0x652c('0x3b')]);_0x78b44[_0x652c('0x3e')]=qs[_0x652c('0x34')](_[_0x652c('0x3c')](_0x488cd4[_0x652c('0x33')],_0x3ad42f[_0x652c('0x34')]));if(_0x488cd4[_0x652c('0x33')][_0x652c('0x3d')]){_0x78b44[_0x652c('0x3e')]=_[_0x652c('0x3f')](_0x78b44[_0x652c('0x3e')],{'$or':_[_0x652c('0x2c')](_0x78b44['attributes'],function(_0x57ae07){var _0x42220f={};_0x42220f[_0x57ae07]={'$like':'%'+_0x488cd4['query'][_0x652c('0x3d')]+'%'};return _0x42220f;})});}_0x78b44=_[_0x652c('0x3f')]({},_0x78b44,_0x488cd4['options']);return _0x318a2e['getConfigurations'](_0x78b44);}})[_0x652c('0x24')](function(_0x3520e7){if(_0x3520e7){_0x24b3f8=_0x3520e7[_0x652c('0x38')];if(!_0x488cd4[_0x652c('0x33')][_0x652c('0x39')]('nolimit')){_0x78b44[_0x652c('0x1e')]=qs[_0x652c('0x1e')](_0x488cd4[_0x652c('0x33')][_0x652c('0x1e')]);_0x78b44[_0x652c('0x1b')]=qs[_0x652c('0x1b')](_0x488cd4['query']['offset']);}return _0x318a2e['getConfigurations'](_0x78b44);}})[_0x652c('0x24')](function(_0x66bc50){if(_0x66bc50){return _0x66bc50?{'count':_0x24b3f8,'rows':_0x66bc50}:null;}})[_0x652c('0x24')](respondWithResult(_0x3ce467,null))['catch'](handleError(_0x3ce467,null));};exports[_0x652c('0x4f')]=function(_0x4c6c16,_0x23fbb6,_0x33b501){if(_0x4c6c16[_0x652c('0x4a')]['id']){delete _0x4c6c16[_0x652c('0x4a')]['id'];}return db[_0x652c('0x2d')][_0x652c('0x4c')]({'where':{'id':_0x4c6c16[_0x652c('0x45')]['id']}})[_0x652c('0x24')](handleEntityNotFound(_0x23fbb6,null))['then'](function(_0x167bb9){if(_0x167bb9){_0x4c6c16[_0x652c('0x4a')]['AccountId']=_0x167bb9['id'];_0x4c6c16['body']['Subjects']=integrations['getSubjects'](_0x4c6c16[_0x652c('0x4a')][_0x652c('0x50')],_0x4c6c16['body'][_0x652c('0x30')]);_0x4c6c16[_0x652c('0x4a')]['Descriptions']=integrations['getDescriptions'](_0x4c6c16[_0x652c('0x4a')][_0x652c('0x50')],_0x4c6c16[_0x652c('0x4a')][_0x652c('0x30')]);return db[_0x652c('0x4d')][_0x652c('0x49')](_0x4c6c16[_0x652c('0x4a')],{'include':[{'model':db[_0x652c('0x51')],'as':'Subjects'},{'model':db[_0x652c('0x51')],'as':_0x652c('0x52')}]});}return null;})[_0x652c('0x24')](respondWithResult(_0x23fbb6,null))['catch'](handleError(_0x23fbb6,null));};exports['getFields']=function(_0x45116d,_0x598a25,_0x118f49){var _0x555bfc=[{'name':_0x652c('0x53'),'label':_0x652c('0x53'),'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 _0x544426='';return db[_0x652c('0x2d')][_0x652c('0x4c')]({'where':{'id':_0x45116d[_0x652c('0x45')]['id']},'attributes':['id',_0x652c('0x54'),_0x652c('0x55'),'username',_0x652c('0x56'),_0x652c('0x57'),_0x652c('0x58'),_0x652c('0x59'),_0x652c('0x5a')]})[_0x652c('0x24')](handleEntityNotFound(_0x598a25,null))[_0x652c('0x24')](function(_0x1f74c7){if(_0x1f74c7){_0x544426=_0x1f74c7[_0x652c('0x54')];var _0x1314ba=_0x544426[_0x652c('0x5b')](-0x1);if(_0x1314ba==='/'){_0x544426=_0x544426[_0x652c('0x5c')](0x0,_0x544426[_0x652c('0x5d')](_0x1314ba));}var _0x29c928={'method':_0x652c('0x5e'),'uri':util[_0x652c('0x5f')](_0x652c('0x60'),_0x544426),'headers':{'Content-Type':_0x652c('0x61'),'Accept':_0x652c('0x61')},'json':!![]};if(_0x1f74c7[_0x652c('0x55')]==='basic'){_0x29c928['headers']['Authorization']=util[_0x652c('0x5f')](_0x652c('0x62'),new Buffer(util['format'](_0x652c('0x63'),_0x1f74c7[_0x652c('0x64')],_0x1f74c7['password']))[_0x652c('0x65')](_0x652c('0x66')));}return rp(_0x29c928)[_0x652c('0x24')](function(_0x20852a){return _0x555bfc['concat'](_[_0x652c('0x2c')](_0x20852a[_0x652c('0x67')][_0x652c('0x68')],function(_0x1bf0e6){return{'id':_0x1bf0e6['name'],'name':_0x1bf0e6[_0x652c('0x29')],'type':_0x1bf0e6['type'],'active':_0x1bf0e6[_0x652c('0x69')],'label':_0x1bf0e6[_0x652c('0x6a')],'custom':!![]};}));});}})[_0x652c('0x24')](function(_0x3544a9){return{'count':_0x3544a9['length'],'rows':_0x3544a9};})[_0x652c('0x24')](respondWithResult(_0x598a25,null))[_0x652c('0x43')](function(_0x59a16b){var _0xa32306=_0x45116d[_0x652c('0x33')]['test']?0x1f4:_0x59a16b[_0x652c('0x6b')]||0x1f4;logger[_0x652c('0x27')](_0x652c('0x6c'),_0x652c('0x6d'),_0xa32306,JSON['stringify'](_0x59a16b));delete _0x59a16b[_0x652c('0x29')];if(_0xa32306===0x191){_0xa32306=0x190;}_0x598a25[_0x652c('0x19')](_0xa32306)['send'](_0x45116d[_0x652c('0x33')][_0x652c('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0x59a16b['statusCode']}:_0x59a16b);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index c68b6b8..30e32e0 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 _0x2c38=['../../components/integrations/configuration','exports','define','int_desk_accounts','lodash','util','api','moment','bluebird','request-promise','path','rimraf','./intDeskAccount.attributes'];(function(_0x47adb8,_0x591ccc){var _0x4689a8=function(_0x2ba76f){while(--_0x2ba76f){_0x47adb8['push'](_0x47adb8['shift']());}};_0x4689a8(++_0x591ccc);}(_0x2c38,0x86));var _0x82c3=function(_0x324496,_0x3a4cdd){_0x324496=_0x324496-0x0;var _0x899545=_0x2c38[_0x324496];return _0x899545;};'use strict';var _=require(_0x82c3('0x0'));var util=require(_0x82c3('0x1'));var logger=require('../../config/logger')(_0x82c3('0x2'));var moment=require(_0x82c3('0x3'));var BPromise=require(_0x82c3('0x4'));var rp=require(_0x82c3('0x5'));var fs=require('fs');var path=require(_0x82c3('0x6'));var rimraf=require(_0x82c3('0x7'));var config=require('../../config/environment');var attributes=require(_0x82c3('0x8'));var integrations=require(_0x82c3('0x9'));module[_0x82c3('0xa')]=function(_0x1e4b49,_0x3388ee){return _0x1e4b49[_0x82c3('0xb')]('DeskAccount',attributes,{'tableName':_0x82c3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5470=['../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x2c25d1,_0x281dc4){var _0x1349b9=function(_0x36186c){while(--_0x36186c){_0x2c25d1['push'](_0x2c25d1['shift']());}};_0x1349b9(++_0x281dc4);}(_0x5470,0x18f));var _0x0547=function(_0x2aea65,_0x32cf14){_0x2aea65=_0x2aea65-0x0;var _0x3848b8=_0x5470[_0x2aea65];return _0x3848b8;};'use strict';var _=require(_0x0547('0x0'));var util=require('util');var logger=require(_0x0547('0x1'))(_0x0547('0x2'));var moment=require(_0x0547('0x3'));var BPromise=require(_0x0547('0x4'));var rp=require(_0x0547('0x5'));var fs=require('fs');var path=require(_0x0547('0x6'));var rimraf=require('rimraf');var config=require(_0x0547('0x7'));var attributes=require(_0x0547('0x8'));var integrations=require(_0x0547('0x9'));module[_0x0547('0xa')]=function(_0x3d407f,_0x5f1b8e){return _0x3d407f[_0x0547('0xb')](_0x0547('0xc'),attributes,{'tableName':_0x0547('0xd'),'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 6e7410a..a10a36c 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 _0x859b=['findAll','options','raw','where','attributes','include','map','model','GetDeskAccount','catch','ShowDeskAccount','find','then','lodash','util','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskAccount,\x20%s,\x20%s','message','result','DeskAccount'];(function(_0x51b3ca,_0x2f58cc){var _0x4d9cbd=function(_0x2fed75){while(--_0x2fed75){_0x51b3ca['push'](_0x51b3ca['shift']());}};_0x4d9cbd(++_0x2f58cc);}(_0x859b,0x9d));var _0xb859=function(_0x4749ad,_0x448224){_0x4749ad=_0x4749ad-0x0;var _0x35cb30=_0x859b[_0x4749ad];return _0x35cb30;};'use strict';var _=require(_0xb859('0x0'));var util=require(_0xb859('0x1'));var moment=require(_0xb859('0x2'));var BPromise=require(_0xb859('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb859('0x4'));var logger=require(_0xb859('0x5'))(_0xb859('0x6'));var config=require(_0xb859('0x7'));var jayson=require(_0xb859('0x8'));var client=jayson[_0xb859('0x9')][_0xb859('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xf68aea,_0x2e0122,_0x5e4c8e){return new BPromise(function(_0x119b04,_0x3e2da0){return client[_0xb859('0xb')](_0xf68aea,_0x5e4c8e)['then'](function(_0x4aeed1){logger[_0xb859('0xc')]('DeskAccount,\x20%s,\x20%s',_0x2e0122,_0xb859('0xd'));logger[_0xb859('0xe')](_0xb859('0xf'),_0x2e0122,_0xb859('0xd'),JSON[_0xb859('0x10')](_0x4aeed1));if(_0x4aeed1[_0xb859('0x11')]){if(_0x4aeed1[_0xb859('0x11')][_0xb859('0x12')]===0x1f4){logger[_0xb859('0x11')](_0xb859('0x13'),_0x2e0122,_0x4aeed1[_0xb859('0x11')]['message']);return _0x3e2da0(_0x4aeed1['error']['message']);}logger[_0xb859('0x11')](_0xb859('0x13'),_0x2e0122,_0x4aeed1[_0xb859('0x11')][_0xb859('0x14')]);return _0x119b04(_0x4aeed1[_0xb859('0x11')][_0xb859('0x14')]);}else{logger[_0xb859('0xc')](_0xb859('0x13'),_0x2e0122,'request\x20sent');_0x119b04(_0x4aeed1[_0xb859('0x15')][_0xb859('0x14')]);}})['catch'](function(_0x2add8c){logger['error'](_0xb859('0x13'),_0x2e0122,_0x2add8c);_0x3e2da0(_0x2add8c);});});}exports['GetDeskAccount']=function(_0x584389){var _0x4dbcf6=this;return new Promise(function(_0x3fc5b7,_0xb7333e){return db[_0xb859('0x16')][_0xb859('0x17')]({'raw':_0x584389['options']?_0x584389[_0xb859('0x18')][_0xb859('0x19')]===undefined?!![]:![]:!![],'where':_0x584389[_0xb859('0x18')]?_0x584389[_0xb859('0x18')][_0xb859('0x1a')]||null:null,'attributes':_0x584389[_0xb859('0x18')]?_0x584389['options'][_0xb859('0x1b')]||null:null,'limit':_0x584389['options']?_0x584389[_0xb859('0x18')]['limit']||null:null,'include':_0x584389['options']?_0x584389[_0xb859('0x18')][_0xb859('0x1c')]?_[_0xb859('0x1d')](_0x584389['options'][_0xb859('0x1c')],function(_0x70e8d7){return{'model':db[_0x70e8d7[_0xb859('0x1e')]],'as':_0x70e8d7['as'],'attributes':_0x70e8d7[_0xb859('0x1b')],'include':_0x70e8d7[_0xb859('0x1c')]?_[_0xb859('0x1d')](_0x70e8d7['include'],function(_0x143d98){return{'model':db[_0x143d98['model']],'as':_0x143d98['as'],'attributes':_0x143d98[_0xb859('0x1b')],'include':_0x143d98['include']?_['map'](_0x143d98[_0xb859('0x1c')],function(_0xfdf774){return{'model':db[_0xfdf774['model']],'as':_0xfdf774['as'],'attributes':_0xfdf774['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2ee0d4){logger[_0xb859('0xc')]('GetDeskAccount',_0x584389);logger[_0xb859('0xe')](_0xb859('0x1f'),_0x584389,JSON[_0xb859('0x10')](_0x2ee0d4));_0x3fc5b7(_0x2ee0d4);})[_0xb859('0x20')](function(_0x4eea84){logger[_0xb859('0x11')](_0xb859('0x1f'),_0x4eea84[_0xb859('0x14')],_0x584389);_0xb7333e(_0x4dbcf6[_0xb859('0x11')](0x1f4,_0x4eea84[_0xb859('0x14')]));});});};exports[_0xb859('0x21')]=function(_0x26ee99){var _0x59bc6c=this;return new Promise(function(_0x2f0a5e,_0x3dc1c1){return db['DeskAccount'][_0xb859('0x22')]({'raw':_0x26ee99['options']?_0x26ee99['options'][_0xb859('0x19')]===undefined?!![]:![]:!![],'where':_0x26ee99[_0xb859('0x18')]?_0x26ee99['options'][_0xb859('0x1a')]||null:null,'attributes':_0x26ee99[_0xb859('0x18')]?_0x26ee99[_0xb859('0x18')][_0xb859('0x1b')]||null:null,'include':_0x26ee99['options']?_0x26ee99[_0xb859('0x18')][_0xb859('0x1c')]?_['map'](_0x26ee99[_0xb859('0x18')][_0xb859('0x1c')],function(_0x57d942){return{'model':db[_0x57d942[_0xb859('0x1e')]],'as':_0x57d942['as'],'attributes':_0x57d942[_0xb859('0x1b')],'include':_0x57d942[_0xb859('0x1c')]?_[_0xb859('0x1d')](_0x57d942[_0xb859('0x1c')],function(_0x54f21f){return{'model':db[_0x54f21f[_0xb859('0x1e')]],'as':_0x54f21f['as'],'attributes':_0x54f21f['attributes'],'include':_0x54f21f[_0xb859('0x1c')]?_[_0xb859('0x1d')](_0x54f21f[_0xb859('0x1c')],function(_0x49becd){return{'model':db[_0x49becd[_0xb859('0x1e')]],'as':_0x49becd['as'],'attributes':_0x49becd['attributes']};}):[]};}):[]};}):[]:[]})[_0xb859('0x23')](function(_0x12f2bb){logger[_0xb859('0xc')](_0xb859('0x21'),_0x26ee99);logger[_0xb859('0xe')](_0xb859('0x21'),_0x26ee99,JSON[_0xb859('0x10')](_0x12f2bb));_0x2f0a5e(_0x12f2bb);})[_0xb859('0x20')](function(_0x360070){logger[_0xb859('0x11')](_0xb859('0x21'),_0x360070[_0xb859('0x14')],_0x26ee99);_0x3dc1c1(_0x59bc6c['error'](0x1f4,_0x360070['message']));});});}; \ No newline at end of file +var _0x4cf0=['rpc','../../config/environment','client','http','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','DeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetDeskAccount','DeskAccount','findAll','options','raw','where','attributes','limit','map','model','include','then','debug','ShowDeskAccount','lodash','util','ioredis','../../mysqldb','../../config/logger'];(function(_0x116215,_0x4c6240){var _0xfdc627=function(_0x6ccaa6){while(--_0x6ccaa6){_0x116215['push'](_0x116215['shift']());}};_0xfdc627(++_0x4c6240);}(_0x4cf0,0x7f));var _0x04cf=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4cf0[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x04cf('0x0'));var util=require(_0x04cf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x04cf('0x2'));var db=require(_0x04cf('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x04cf('0x4'))(_0x04cf('0x5'));var config=require(_0x04cf('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x04cf('0x7')][_0x04cf('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f3569,_0xc2de4b,_0x33f601){return new BPromise(function(_0x1758f8,_0x2de87b){return client[_0x04cf('0x9')](_0x2f3569,_0x33f601)['then'](function(_0x1e910b){logger[_0x04cf('0xa')](_0x04cf('0xb'),_0xc2de4b,_0x04cf('0xc'));logger['debug'](_0x04cf('0xd'),_0xc2de4b,'request\x20sent',JSON[_0x04cf('0xe')](_0x1e910b));if(_0x1e910b[_0x04cf('0xf')]){if(_0x1e910b[_0x04cf('0xf')]['code']===0x1f4){logger['error'](_0x04cf('0xb'),_0xc2de4b,_0x1e910b[_0x04cf('0xf')][_0x04cf('0x10')]);return _0x2de87b(_0x1e910b['error']['message']);}logger[_0x04cf('0xf')](_0x04cf('0xb'),_0xc2de4b,_0x1e910b[_0x04cf('0xf')]['message']);return _0x1758f8(_0x1e910b[_0x04cf('0xf')]['message']);}else{logger['info'](_0x04cf('0xb'),_0xc2de4b,_0x04cf('0xc'));_0x1758f8(_0x1e910b[_0x04cf('0x11')][_0x04cf('0x10')]);}})[_0x04cf('0x12')](function(_0x2af056){logger[_0x04cf('0xf')](_0x04cf('0xb'),_0xc2de4b,_0x2af056);_0x2de87b(_0x2af056);});});}exports[_0x04cf('0x13')]=function(_0x391508){var _0x34cba7=this;return new Promise(function(_0x26f0e8,_0x50e2df){return db[_0x04cf('0x14')][_0x04cf('0x15')]({'raw':_0x391508[_0x04cf('0x16')]?_0x391508[_0x04cf('0x16')][_0x04cf('0x17')]===undefined?!![]:![]:!![],'where':_0x391508['options']?_0x391508['options'][_0x04cf('0x18')]||null:null,'attributes':_0x391508['options']?_0x391508[_0x04cf('0x16')][_0x04cf('0x19')]||null:null,'limit':_0x391508[_0x04cf('0x16')]?_0x391508['options'][_0x04cf('0x1a')]||null:null,'include':_0x391508[_0x04cf('0x16')]?_0x391508[_0x04cf('0x16')]['include']?_[_0x04cf('0x1b')](_0x391508[_0x04cf('0x16')]['include'],function(_0x420cd2){return{'model':db[_0x420cd2[_0x04cf('0x1c')]],'as':_0x420cd2['as'],'attributes':_0x420cd2[_0x04cf('0x19')],'include':_0x420cd2[_0x04cf('0x1d')]?_[_0x04cf('0x1b')](_0x420cd2['include'],function(_0x5dbfee){return{'model':db[_0x5dbfee[_0x04cf('0x1c')]],'as':_0x5dbfee['as'],'attributes':_0x5dbfee[_0x04cf('0x19')],'include':_0x5dbfee['include']?_[_0x04cf('0x1b')](_0x5dbfee[_0x04cf('0x1d')],function(_0x1bc187){return{'model':db[_0x1bc187[_0x04cf('0x1c')]],'as':_0x1bc187['as'],'attributes':_0x1bc187['attributes']};}):[]};}):[]};}):[]:[]})[_0x04cf('0x1e')](function(_0x5631a6){logger[_0x04cf('0xa')](_0x04cf('0x13'),_0x391508);logger[_0x04cf('0x1f')](_0x04cf('0x13'),_0x391508,JSON['stringify'](_0x5631a6));_0x26f0e8(_0x5631a6);})[_0x04cf('0x12')](function(_0x57e96c){logger[_0x04cf('0xf')](_0x04cf('0x13'),_0x57e96c['message'],_0x391508);_0x50e2df(_0x34cba7[_0x04cf('0xf')](0x1f4,_0x57e96c['message']));});});};exports['ShowDeskAccount']=function(_0x244ebe){var _0x3af53c=this;return new Promise(function(_0x40cb75,_0x5cd4a2){return db[_0x04cf('0x14')]['find']({'raw':_0x244ebe[_0x04cf('0x16')]?_0x244ebe[_0x04cf('0x16')][_0x04cf('0x17')]===undefined?!![]:![]:!![],'where':_0x244ebe[_0x04cf('0x16')]?_0x244ebe['options']['where']||null:null,'attributes':_0x244ebe['options']?_0x244ebe[_0x04cf('0x16')][_0x04cf('0x19')]||null:null,'include':_0x244ebe['options']?_0x244ebe[_0x04cf('0x16')][_0x04cf('0x1d')]?_['map'](_0x244ebe[_0x04cf('0x16')][_0x04cf('0x1d')],function(_0x2cae81){return{'model':db[_0x2cae81['model']],'as':_0x2cae81['as'],'attributes':_0x2cae81[_0x04cf('0x19')],'include':_0x2cae81[_0x04cf('0x1d')]?_[_0x04cf('0x1b')](_0x2cae81[_0x04cf('0x1d')],function(_0x458788){return{'model':db[_0x458788[_0x04cf('0x1c')]],'as':_0x458788['as'],'attributes':_0x458788[_0x04cf('0x19')],'include':_0x458788['include']?_[_0x04cf('0x1b')](_0x458788[_0x04cf('0x1d')],function(_0x38ccfc){return{'model':db[_0x38ccfc[_0x04cf('0x1c')]],'as':_0x38ccfc['as'],'attributes':_0x38ccfc[_0x04cf('0x19')]};}):[]};}):[]};}):[]:[]})[_0x04cf('0x1e')](function(_0x589b67){logger[_0x04cf('0xa')](_0x04cf('0x20'),_0x244ebe);logger[_0x04cf('0x1f')]('ShowDeskAccount',_0x244ebe,JSON['stringify'](_0x589b67));_0x40cb75(_0x589b67);})[_0x04cf('0x12')](function(_0x271bb0){logger[_0x04cf('0xf')](_0x04cf('0x20'),_0x271bb0[_0x04cf('0x10')],_0x244ebe);_0x5cd4a2(_0x3af53c[_0x04cf('0xf')](0x1f4,_0x271bb0['message']));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index da93bfd..0a1c82a 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 _0x008c=['../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','getFields','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','setTags','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2fcf24,_0xdeb0e9){var _0xdf6d53=function(_0x318116){while(--_0x318116){_0x2fcf24['push'](_0x2fcf24['shift']());}};_0xdf6d53(++_0xdeb0e9);}(_0x008c,0x188));var _0xc008=function(_0x5c4d15,_0x32fe23){_0x5c4d15=_0x5c4d15-0x0;var _0x1f974a=_0x008c[_0x5c4d15];return _0x1f974a;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xa')]('/:id/fields',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/subjects',auth['isAuthenticated'](),controller['getSubjects']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0x10'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x14')](_0xc008('0x15'),auth[_0xc008('0xb')](),controller[_0xc008('0x16')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x17')]);module[_0xc008('0x18')]=router; \ No newline at end of file +var _0xedd9=['getTags','post','create','setTags','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getSubjects','/:id/descriptions','/:id/tags'];(function(_0x185679,_0x368ecf){var _0x3676b5=function(_0x437872){while(--_0x437872){_0x185679['push'](_0x185679['shift']());}};_0x3676b5(++_0x368ecf);}(_0xedd9,0xfc));var _0x9edd=function(_0x3d4e62,_0xcc9273){_0x3d4e62=_0x3d4e62-0x0;var _0x43bd00=_0xedd9[_0x3d4e62];return _0x43bd00;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0x9')](_0x9edd('0xe'),auth[_0x9edd('0xa')](),controller['getFields']);router[_0x9edd('0x9')]('/:id/subjects',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['get'](_0x9edd('0x10'),auth[_0x9edd('0xa')](),controller['getDescriptions']);router[_0x9edd('0x9')](_0x9edd('0x11'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);router[_0x9edd('0x13')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0x14')]);router[_0x9edd('0x13')]('/:id/tags',auth[_0x9edd('0xa')](),controller[_0x9edd('0x15')]);router[_0x9edd('0x16')](_0x9edd('0xc'),auth[_0x9edd('0xa')](),controller[_0x9edd('0x17')]);router[_0x9edd('0x18')](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x19')]);module[_0x9edd('0x1a')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index bdb5626..a4a7e3b 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 _0x67bd=['STRING','exports'];(function(_0x53d749,_0x3195c9){var _0x32e4c5=function(_0x23aaaa){while(--_0x23aaaa){_0x53d749['push'](_0x53d749['shift']());}};_0x32e4c5(++_0x3195c9);}(_0x67bd,0x1f3));var _0xd67b=function(_0x45cbab,_0x48c2a2){_0x45cbab=_0x45cbab-0x0;var _0xe2c131=_0x67bd[_0x45cbab];return _0xe2c131;};'use strict';var Sequelize=require('sequelize');module[_0xd67b('0x0')]={'name':{'type':Sequelize[_0xd67b('0x1')]},'description':{'type':Sequelize[_0xd67b('0x1')]}}; \ No newline at end of file +var _0xcf19=['sequelize','exports','STRING'];(function(_0x281a95,_0x4fc4f3){var _0x3369dd=function(_0x37a33a){while(--_0x37a33a){_0x281a95['push'](_0x281a95['shift']());}};_0x3369dd(++_0x4fc4f3);}(_0xcf19,0x72));var _0x9cf1=function(_0x27889f,_0x4809b9){_0x27889f=_0x27889f-0x0;var _0x201713=_0xcf19[_0x27889f];return _0x201713;};'use strict';var Sequelize=require(_0x9cf1('0x0'));module[_0x9cf1('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x9cf1('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index f1e3b6f..46b6a2b 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 _0x6c30=['DeskConfiguration','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','catch','params','find','create','body','destroy','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','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','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','index','map'];(function(_0xbb8cfd,_0x2b9025){var _0x2e86e9=function(_0xa69061){while(--_0xa69061){_0xbb8cfd['push'](_0xbb8cfd['shift']());}};_0x2e86e9(++_0x2b9025);}(_0x6c30,0xd3));var _0x06c3=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x6c30[_0x2adbeb];return _0x5e18a6;};'use strict';var emlformat=require(_0x06c3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x06c3('0x1'));var jsonpatch=require(_0x06c3('0x2'));var rp=require(_0x06c3('0x3'));var moment=require(_0x06c3('0x4'));var BPromise=require(_0x06c3('0x5'));var Mustache=require('mustache');var util=require(_0x06c3('0x6'));var path=require(_0x06c3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x06c3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x06c3('0x9'));var squel=require(_0x06c3('0xa'));var crypto=require(_0x06c3('0xb'));var jsforce=require(_0x06c3('0xc'));var deskjs=require(_0x06c3('0xd'));var toCsv=require(_0x06c3('0xe'));var querystring=require(_0x06c3('0xf'));var Papa=require(_0x06c3('0x10'));var Redis=require(_0x06c3('0x11'));var authService=require(_0x06c3('0x12'));var qs=require(_0x06c3('0x13'));var as=require(_0x06c3('0x14'));var hardwareService=require(_0x06c3('0x15'));var logger=require(_0x06c3('0x16'))(_0x06c3('0x17'));var utils=require(_0x06c3('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x06c3('0x19'));var db=require(_0x06c3('0x1a'))['db'];function respondWithStatusCode(_0xa70a94,_0x16f455){_0x16f455=_0x16f455||0xcc;return function(_0xae2d46){if(_0xae2d46){return _0xa70a94[_0x06c3('0x1b')](_0x16f455);}return _0xa70a94['status'](_0x16f455)[_0x06c3('0x1c')]();};}function respondWithResult(_0x3891f3,_0x2d878b){_0x2d878b=_0x2d878b||0xc8;return function(_0x30724e){if(_0x30724e){return _0x3891f3[_0x06c3('0x1d')](_0x2d878b)[_0x06c3('0x1e')](_0x30724e);}};}function respondWithFilteredResult(_0x2b0249,_0x2a929f){return function(_0x58fc57){if(_0x58fc57){var _0x11a2ae=typeof _0x2a929f[_0x06c3('0x1f')]==='undefined'&&typeof _0x2a929f['limit']===_0x06c3('0x20');var _0x1cb264=_0x58fc57['count'];var _0x1acd97=_0x11a2ae?0x0:_0x2a929f[_0x06c3('0x1f')];var _0x4c349b=_0x11a2ae?_0x58fc57[_0x06c3('0x21')]:_0x2a929f[_0x06c3('0x1f')]+_0x2a929f[_0x06c3('0x22')];var _0x12881d;if(_0x4c349b>=_0x1cb264){_0x4c349b=_0x1cb264;_0x12881d=0xc8;}else{_0x12881d=0xce;}_0x2b0249[_0x06c3('0x1d')](_0x12881d);return _0x2b0249[_0x06c3('0x23')](_0x06c3('0x24'),_0x1acd97+'-'+_0x4c349b+'/'+_0x1cb264)[_0x06c3('0x1e')](_0x58fc57);}return null;};}function patchUpdates(_0x3a9179){return function(_0x3475d4){try{jsonpatch[_0x06c3('0x25')](_0x3475d4,_0x3a9179,!![]);}catch(_0x39c407){return BPromise[_0x06c3('0x26')](_0x39c407);}return _0x3475d4[_0x06c3('0x27')]();};}function saveUpdates(_0x72b088,_0x22580a){return function(_0x14995d){if(_0x14995d){return _0x14995d['update'](_0x72b088)[_0x06c3('0x28')](function(_0x2e7e68){return _0x2e7e68;});}return null;};}function removeEntity(_0x4e3f03,_0x2d7f2c){return function(_0x4e92a6){if(_0x4e92a6){return _0x4e92a6['destroy']()[_0x06c3('0x28')](function(){_0x4e3f03[_0x06c3('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x30dda7,_0x397e11){return function(_0x5e2f3a){if(!_0x5e2f3a){_0x30dda7[_0x06c3('0x1b')](0x194);}return _0x5e2f3a;};}function handleError(_0x2c5a77,_0x3e0ea8){_0x3e0ea8=_0x3e0ea8||0x1f4;return function(_0x3146c7){logger[_0x06c3('0x29')](_0x3146c7[_0x06c3('0x2a')]);if(_0x3146c7[_0x06c3('0x2b')]){delete _0x3146c7[_0x06c3('0x2b')];}_0x2c5a77[_0x06c3('0x1d')](_0x3e0ea8)[_0x06c3('0x2c')](_0x3146c7);};}exports[_0x06c3('0x2d')]=function(_0x2bd983,_0xab308){var _0xefbc5a={},_0x59b6da={},_0x491001={'count':0x0,'rows':[]};var _0x2842c1=_[_0x06c3('0x2e')](db[_0x06c3('0x2f')][_0x06c3('0x30')],function(_0x36eafe){return{'name':_0x36eafe['fieldName'],'type':_0x36eafe['type'][_0x06c3('0x31')]};});_0x59b6da[_0x06c3('0x32')]=_[_0x06c3('0x2e')](_0x2842c1,'name');_0x59b6da['query']=_[_0x06c3('0x33')](_0x2bd983[_0x06c3('0x34')]);_0x59b6da[_0x06c3('0x35')]=_[_0x06c3('0x36')](_0x59b6da['model'],_0x59b6da[_0x06c3('0x34')]);_0xefbc5a['attributes']=_[_0x06c3('0x36')](_0x59b6da[_0x06c3('0x32')],qs[_0x06c3('0x37')](_0x2bd983[_0x06c3('0x34')][_0x06c3('0x37')]));_0xefbc5a[_0x06c3('0x38')]=_0xefbc5a['attributes'][_0x06c3('0x39')]?_0xefbc5a[_0x06c3('0x38')]:_0x59b6da[_0x06c3('0x32')];if(!_0x2bd983[_0x06c3('0x34')][_0x06c3('0x3a')]('nolimit')){_0xefbc5a[_0x06c3('0x22')]=qs[_0x06c3('0x22')](_0x2bd983[_0x06c3('0x34')]['limit']);_0xefbc5a['offset']=qs[_0x06c3('0x1f')](_0x2bd983[_0x06c3('0x34')][_0x06c3('0x1f')]);}_0xefbc5a[_0x06c3('0x3b')]=qs[_0x06c3('0x3c')](_0x2bd983[_0x06c3('0x34')][_0x06c3('0x3c')]);_0xefbc5a[_0x06c3('0x3d')]=qs[_0x06c3('0x35')](_[_0x06c3('0x3e')](_0x2bd983[_0x06c3('0x34')],_0x59b6da[_0x06c3('0x35')]),_0x2842c1);if(_0x2bd983[_0x06c3('0x34')][_0x06c3('0x3f')]){_0xefbc5a[_0x06c3('0x3d')]=_[_0x06c3('0x40')](_0xefbc5a[_0x06c3('0x3d')],{'$or':_[_0x06c3('0x2e')](_0x2842c1,function(_0x197d65){if(_0x197d65[_0x06c3('0x41')]!==_0x06c3('0x42')){var _0x3c9c5a={};_0x3c9c5a[_0x197d65[_0x06c3('0x2b')]]={'$like':'%'+_0x2bd983[_0x06c3('0x34')][_0x06c3('0x3f')]+'%'};return _0x3c9c5a;}})});}_0xefbc5a=_[_0x06c3('0x40')]({},_0xefbc5a,_0x2bd983[_0x06c3('0x43')]);var _0x53dc55={'where':_0xefbc5a[_0x06c3('0x3d')]};return db[_0x06c3('0x2f')]['count'](_0x53dc55)[_0x06c3('0x28')](function(_0x57d1e9){_0x491001['count']=_0x57d1e9;if(_0x2bd983[_0x06c3('0x34')][_0x06c3('0x44')]){_0xefbc5a['include']=[{'all':!![]}];}return db[_0x06c3('0x2f')]['findAll'](_0xefbc5a);})[_0x06c3('0x28')](function(_0x52ec74){_0x491001[_0x06c3('0x45')]=_0x52ec74;return _0x491001;})[_0x06c3('0x28')](respondWithFilteredResult(_0xab308,_0xefbc5a))[_0x06c3('0x46')](handleError(_0xab308,null));};exports['show']=function(_0x397a38,_0x497f8e){var _0x4cfce2={'raw':![],'where':{'id':_0x397a38[_0x06c3('0x47')]['id']}},_0x306a41={};_0x306a41[_0x06c3('0x32')]=_[_0x06c3('0x33')](db['DeskConfiguration'][_0x06c3('0x30')]);_0x306a41['query']=_[_0x06c3('0x33')](_0x397a38[_0x06c3('0x34')]);_0x306a41[_0x06c3('0x35')]=_[_0x06c3('0x36')](_0x306a41['model'],_0x306a41[_0x06c3('0x34')]);_0x4cfce2[_0x06c3('0x38')]=_[_0x06c3('0x36')](_0x306a41[_0x06c3('0x32')],qs[_0x06c3('0x37')](_0x397a38['query']['fields']));_0x4cfce2['attributes']=_0x4cfce2[_0x06c3('0x38')][_0x06c3('0x39')]?_0x4cfce2[_0x06c3('0x38')]:_0x306a41['model'];if(_0x397a38[_0x06c3('0x34')]['includeAll']){_0x4cfce2['include']=[{'all':!![]}];}_0x4cfce2=_[_0x06c3('0x40')]({},_0x4cfce2,_0x397a38['options']);return db[_0x06c3('0x2f')][_0x06c3('0x48')](_0x4cfce2)['then'](handleEntityNotFound(_0x497f8e,null))[_0x06c3('0x28')](respondWithResult(_0x497f8e,null))[_0x06c3('0x46')](handleError(_0x497f8e,null));};exports[_0x06c3('0x49')]=function(_0x5e34a0,_0x9c1210){return db[_0x06c3('0x2f')][_0x06c3('0x49')](_0x5e34a0[_0x06c3('0x4a')],{})[_0x06c3('0x28')](respondWithResult(_0x9c1210,0xc9))[_0x06c3('0x46')](handleError(_0x9c1210,null));};exports['update']=function(_0x167fc7,_0xd046cc){if(_0x167fc7[_0x06c3('0x4a')]['id']){delete _0x167fc7[_0x06c3('0x4a')]['id'];}return db[_0x06c3('0x2f')][_0x06c3('0x48')]({'where':{'id':_0x167fc7[_0x06c3('0x47')]['id']}})['then'](handleEntityNotFound(_0xd046cc,null))[_0x06c3('0x28')](saveUpdates(_0x167fc7[_0x06c3('0x4a')],null))['then'](respondWithResult(_0xd046cc,null))['catch'](handleError(_0xd046cc,null));};exports[_0x06c3('0x4b')]=function(_0x876a22,_0x1ebc39){return db['DeskConfiguration']['find']({'where':{'id':_0x876a22[_0x06c3('0x47')]['id']}})[_0x06c3('0x28')](handleEntityNotFound(_0x1ebc39,null))[_0x06c3('0x28')](removeEntity(_0x1ebc39,null))[_0x06c3('0x46')](handleError(_0x1ebc39,null));};exports[_0x06c3('0x4c')]=function(_0x32be85,_0x3310d2,_0x2cfbc9){var _0x47d159={};var _0x41463e={};var _0x44b13b;var _0x2ba368;return db[_0x06c3('0x2f')][_0x06c3('0x4d')]({'where':{'id':_0x32be85[_0x06c3('0x47')]['id']}})[_0x06c3('0x28')](handleEntityNotFound(_0x3310d2,null))[_0x06c3('0x28')](function(_0x2b18c3){if(_0x2b18c3){_0x44b13b=_0x2b18c3;_0x41463e[_0x06c3('0x32')]=_[_0x06c3('0x33')](db[_0x06c3('0x4e')][_0x06c3('0x30')]);_0x41463e[_0x06c3('0x34')]=_[_0x06c3('0x33')](_0x32be85[_0x06c3('0x34')]);_0x41463e['filters']=_[_0x06c3('0x36')](_0x41463e[_0x06c3('0x32')],_0x41463e[_0x06c3('0x34')]);_0x47d159[_0x06c3('0x38')]=_[_0x06c3('0x36')](_0x41463e[_0x06c3('0x32')],qs[_0x06c3('0x37')](_0x32be85[_0x06c3('0x34')][_0x06c3('0x37')]));_0x47d159[_0x06c3('0x38')]=_0x47d159['attributes']['length']?_0x47d159[_0x06c3('0x38')]:_0x41463e['model'];_0x47d159[_0x06c3('0x3b')]=qs[_0x06c3('0x3c')](_0x32be85[_0x06c3('0x34')][_0x06c3('0x3c')]);_0x47d159[_0x06c3('0x3d')]=qs[_0x06c3('0x35')](_[_0x06c3('0x3e')](_0x32be85[_0x06c3('0x34')],_0x41463e[_0x06c3('0x35')]));if(_0x32be85[_0x06c3('0x34')][_0x06c3('0x3f')]){_0x47d159[_0x06c3('0x3d')]=_[_0x06c3('0x40')](_0x47d159[_0x06c3('0x3d')],{'$or':_['map'](_0x47d159[_0x06c3('0x38')],function(_0x2f61ca){var _0x4faf51={};_0x4faf51[_0x2f61ca]={'$like':'%'+_0x32be85[_0x06c3('0x34')][_0x06c3('0x3f')]+'%'};return _0x4faf51;})});}_0x47d159=_[_0x06c3('0x40')]({},_0x47d159,_0x32be85['options']);return _0x44b13b[_0x06c3('0x4c')](_0x47d159);}})[_0x06c3('0x28')](function(_0x878365){if(_0x878365){_0x2ba368=_0x878365[_0x06c3('0x39')];if(!_0x32be85[_0x06c3('0x34')][_0x06c3('0x3a')](_0x06c3('0x4f'))){_0x47d159[_0x06c3('0x22')]=qs[_0x06c3('0x22')](_0x32be85['query'][_0x06c3('0x22')]);_0x47d159[_0x06c3('0x1f')]=qs[_0x06c3('0x1f')](_0x32be85[_0x06c3('0x34')][_0x06c3('0x1f')]);}return _0x44b13b[_0x06c3('0x4c')](_0x47d159);}})[_0x06c3('0x28')](function(_0x47c4cd){if(_0x47c4cd){return _0x47c4cd?{'count':_0x2ba368,'rows':_0x47c4cd}:null;}})['then'](respondWithResult(_0x3310d2,null))[_0x06c3('0x46')](handleError(_0x3310d2,null));};exports[_0x06c3('0x50')]=function(_0x32cc2a,_0x3326cd,_0x8b9351){var _0x371ca9={};var _0x4c0c18={};var _0xa581fe;var _0x53da29;return db[_0x06c3('0x2f')][_0x06c3('0x4d')]({'where':{'id':_0x32cc2a[_0x06c3('0x47')]['id']}})[_0x06c3('0x28')](handleEntityNotFound(_0x3326cd,null))[_0x06c3('0x28')](function(_0x366176){if(_0x366176){_0xa581fe=_0x366176;_0x4c0c18[_0x06c3('0x32')]=_[_0x06c3('0x33')](db[_0x06c3('0x4e')][_0x06c3('0x30')]);_0x4c0c18['query']=_[_0x06c3('0x33')](_0x32cc2a[_0x06c3('0x34')]);_0x4c0c18[_0x06c3('0x35')]=_[_0x06c3('0x36')](_0x4c0c18['model'],_0x4c0c18[_0x06c3('0x34')]);_0x371ca9[_0x06c3('0x38')]=_[_0x06c3('0x36')](_0x4c0c18[_0x06c3('0x32')],qs[_0x06c3('0x37')](_0x32cc2a[_0x06c3('0x34')][_0x06c3('0x37')]));_0x371ca9[_0x06c3('0x38')]=_0x371ca9[_0x06c3('0x38')][_0x06c3('0x39')]?_0x371ca9[_0x06c3('0x38')]:_0x4c0c18[_0x06c3('0x32')];_0x371ca9['order']=qs[_0x06c3('0x3c')](_0x32cc2a['query'][_0x06c3('0x3c')]);_0x371ca9[_0x06c3('0x3d')]=qs[_0x06c3('0x35')](_[_0x06c3('0x3e')](_0x32cc2a[_0x06c3('0x34')],_0x4c0c18['filters']));if(_0x32cc2a[_0x06c3('0x34')]['filter']){_0x371ca9[_0x06c3('0x3d')]=_['merge'](_0x371ca9['where'],{'$or':_[_0x06c3('0x2e')](_0x371ca9[_0x06c3('0x38')],function(_0x3f13b5){var _0x106e3e={};_0x106e3e[_0x3f13b5]={'$like':'%'+_0x32cc2a[_0x06c3('0x34')]['filter']+'%'};return _0x106e3e;})});}_0x371ca9=_[_0x06c3('0x40')]({},_0x371ca9,_0x32cc2a[_0x06c3('0x43')]);return _0xa581fe[_0x06c3('0x50')](_0x371ca9);}})[_0x06c3('0x28')](function(_0xc12832){if(_0xc12832){_0x53da29=_0xc12832[_0x06c3('0x39')];if(!_0x32cc2a['query'][_0x06c3('0x3a')](_0x06c3('0x4f'))){_0x371ca9[_0x06c3('0x22')]=qs[_0x06c3('0x22')](_0x32cc2a['query'][_0x06c3('0x22')]);_0x371ca9[_0x06c3('0x1f')]=qs[_0x06c3('0x1f')](_0x32cc2a[_0x06c3('0x34')][_0x06c3('0x1f')]);}return _0xa581fe[_0x06c3('0x50')](_0x371ca9);}})[_0x06c3('0x28')](function(_0x27e8ad){if(_0x27e8ad){return _0x27e8ad?{'count':_0x53da29,'rows':_0x27e8ad}:null;}})[_0x06c3('0x28')](respondWithResult(_0x3326cd,null))['catch'](handleError(_0x3326cd,null));};exports[_0x06c3('0x51')]=function(_0x215a71,_0x4be41a,_0x3acdd6){var _0x944f99={};var _0x2c1b7b={};var _0x5a5217;var _0xb6ceb5;return db[_0x06c3('0x2f')]['findOne']({'where':{'id':_0x215a71[_0x06c3('0x47')]['id']}})['then'](handleEntityNotFound(_0x4be41a,null))[_0x06c3('0x28')](function(_0x4d199e){if(_0x4d199e){_0x5a5217=_0x4d199e;_0x2c1b7b['model']=_[_0x06c3('0x33')](db[_0x06c3('0x4e')]['rawAttributes']);_0x2c1b7b[_0x06c3('0x34')]=_['keys'](_0x215a71[_0x06c3('0x34')]);_0x2c1b7b[_0x06c3('0x35')]=_[_0x06c3('0x36')](_0x2c1b7b[_0x06c3('0x32')],_0x2c1b7b['query']);_0x944f99[_0x06c3('0x38')]=_[_0x06c3('0x36')](_0x2c1b7b[_0x06c3('0x32')],qs[_0x06c3('0x37')](_0x215a71[_0x06c3('0x34')][_0x06c3('0x37')]));_0x944f99[_0x06c3('0x38')]=_0x944f99[_0x06c3('0x38')][_0x06c3('0x39')]?_0x944f99[_0x06c3('0x38')]:_0x2c1b7b[_0x06c3('0x32')];_0x944f99[_0x06c3('0x3b')]=qs[_0x06c3('0x3c')](_0x215a71[_0x06c3('0x34')][_0x06c3('0x3c')]);_0x944f99[_0x06c3('0x3d')]=qs[_0x06c3('0x35')](_['pick'](_0x215a71[_0x06c3('0x34')],_0x2c1b7b['filters']));if(_0x215a71['query'][_0x06c3('0x3f')]){_0x944f99[_0x06c3('0x3d')]=_['merge'](_0x944f99[_0x06c3('0x3d')],{'$or':_[_0x06c3('0x2e')](_0x944f99[_0x06c3('0x38')],function(_0x5c26f1){var _0x15ff89={};_0x15ff89[_0x5c26f1]={'$like':'%'+_0x215a71[_0x06c3('0x34')][_0x06c3('0x3f')]+'%'};return _0x15ff89;})});}_0x944f99=_['merge']({},_0x944f99,_0x215a71[_0x06c3('0x43')]);return _0x5a5217[_0x06c3('0x51')](_0x944f99);}})[_0x06c3('0x28')](function(_0x3ff2fa){if(_0x3ff2fa){_0xb6ceb5=_0x3ff2fa[_0x06c3('0x39')];if(!_0x215a71[_0x06c3('0x34')][_0x06c3('0x3a')](_0x06c3('0x4f'))){_0x944f99['limit']=qs[_0x06c3('0x22')](_0x215a71[_0x06c3('0x34')][_0x06c3('0x22')]);_0x944f99[_0x06c3('0x1f')]=qs[_0x06c3('0x1f')](_0x215a71[_0x06c3('0x34')]['offset']);}return _0x5a5217[_0x06c3('0x51')](_0x944f99);}})[_0x06c3('0x28')](function(_0x17bb66){if(_0x17bb66){return _0x17bb66?{'count':_0xb6ceb5,'rows':_0x17bb66}:null;}})[_0x06c3('0x28')](respondWithResult(_0x4be41a,null))[_0x06c3('0x46')](handleError(_0x4be41a,null));};exports[_0x06c3('0x52')]=function(_0x525ec8,_0x245b4e,_0x42ce33){var _0xeb6dd1={};var _0x4c47ea={};var _0x1205b9;var _0x2eb4fd;return db[_0x06c3('0x2f')][_0x06c3('0x4d')]({'where':{'id':_0x525ec8[_0x06c3('0x47')]['id']}})['then'](handleEntityNotFound(_0x245b4e,null))[_0x06c3('0x28')](function(_0x440ad5){if(_0x440ad5){_0x1205b9=_0x440ad5;_0x4c47ea[_0x06c3('0x32')]=_['keys'](db[_0x06c3('0x53')]['rawAttributes']);_0x4c47ea[_0x06c3('0x34')]=_[_0x06c3('0x33')](_0x525ec8['query']);_0x4c47ea[_0x06c3('0x35')]=_[_0x06c3('0x36')](_0x4c47ea[_0x06c3('0x32')],_0x4c47ea[_0x06c3('0x34')]);_0xeb6dd1[_0x06c3('0x38')]=_[_0x06c3('0x36')](_0x4c47ea[_0x06c3('0x32')],qs['fields'](_0x525ec8['query'][_0x06c3('0x37')]));_0xeb6dd1[_0x06c3('0x38')]=_0xeb6dd1[_0x06c3('0x38')][_0x06c3('0x39')]?_0xeb6dd1['attributes']:_0x4c47ea[_0x06c3('0x32')];_0xeb6dd1['order']=qs[_0x06c3('0x3c')](_0x525ec8['query'][_0x06c3('0x3c')]);_0xeb6dd1['where']=qs[_0x06c3('0x35')](_[_0x06c3('0x3e')](_0x525ec8[_0x06c3('0x34')],_0x4c47ea[_0x06c3('0x35')]));if(_0x525ec8[_0x06c3('0x34')][_0x06c3('0x3f')]){_0xeb6dd1[_0x06c3('0x3d')]=_[_0x06c3('0x40')](_0xeb6dd1[_0x06c3('0x3d')],{'$or':_[_0x06c3('0x2e')](_0xeb6dd1[_0x06c3('0x38')],function(_0xb0571a){var _0x2ffa15={};_0x2ffa15[_0xb0571a]={'$like':'%'+_0x525ec8[_0x06c3('0x34')][_0x06c3('0x3f')]+'%'};return _0x2ffa15;})});}_0xeb6dd1=_[_0x06c3('0x40')]({},_0xeb6dd1,_0x525ec8['options']);return _0x1205b9[_0x06c3('0x52')](_0xeb6dd1);}})[_0x06c3('0x28')](function(_0x1a178c){if(_0x1a178c){_0x2eb4fd=_0x1a178c[_0x06c3('0x39')];if(!_0x525ec8[_0x06c3('0x34')][_0x06c3('0x3a')](_0x06c3('0x4f'))){_0xeb6dd1[_0x06c3('0x22')]=qs[_0x06c3('0x22')](_0x525ec8[_0x06c3('0x34')][_0x06c3('0x22')]);_0xeb6dd1['offset']=qs[_0x06c3('0x1f')](_0x525ec8[_0x06c3('0x34')][_0x06c3('0x1f')]);}return _0x1205b9[_0x06c3('0x52')](_0xeb6dd1);}})['then'](function(_0x1ce9c4){if(_0x1ce9c4){return _0x1ce9c4?{'count':_0x2eb4fd,'rows':_0x1ce9c4}:null;}})[_0x06c3('0x28')](respondWithResult(_0x245b4e,null))['catch'](handleError(_0x245b4e,null));};exports[_0x06c3('0x54')]=function(_0x3da9d7,_0x4ee508,_0x16929a){if(_0x3da9d7[_0x06c3('0x4a')]['id']){delete _0x3da9d7[_0x06c3('0x4a')]['id'];}return db['DeskConfiguration'][_0x06c3('0x4d')]({'where':{'id':_0x3da9d7[_0x06c3('0x47')]['id']}})[_0x06c3('0x28')](handleEntityNotFound(_0x4ee508,null))[_0x06c3('0x28')](function(_0x471f25){if(_0x471f25){return _0x471f25[_0x06c3('0x54')](_0x3da9d7[_0x06c3('0x4a')][_0x06c3('0x55')]||[]);}return null;})[_0x06c3('0x28')](respondWithResult(_0x4ee508,null))[_0x06c3('0x46')](handleError(_0x4ee508,null));}; \ No newline at end of file +var _0x487c=['fields','length','nolimit','order','sort','where','filters','filter','merge','include','findAll','rows','show','intersection','includeAll','options','find','catch','create','body','params','findOne','DeskField','hasOwnProperty','getFields','pick','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send','index','DeskConfiguration','rawAttributes','type','key','model','map','keys','query','attributes'];(function(_0x1eb786,_0x1b5f72){var _0x460cad=function(_0x3ec7a6){while(--_0x3ec7a6){_0x1eb786['push'](_0x1eb786['shift']());}};_0x460cad(++_0x1b5f72);}(_0x487c,0x1c9));var _0xc487=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0x487c[_0x491a7f];return _0x3d8f44;};'use strict';var emlformat=require(_0xc487('0x0'));var rimraf=require(_0xc487('0x1'));var zipdir=require(_0xc487('0x2'));var jsonpatch=require(_0xc487('0x3'));var rp=require(_0xc487('0x4'));var moment=require(_0xc487('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xc487('0x6'));var util=require(_0xc487('0x7'));var path=require('path');var sox=require(_0xc487('0x8'));var csv=require(_0xc487('0x9'));var ejs=require(_0xc487('0xa'));var fs=require('fs');var fs_extra=require(_0xc487('0xb'));var _=require('lodash');var squel=require(_0xc487('0xc'));var crypto=require(_0xc487('0xd'));var jsforce=require(_0xc487('0xe'));var deskjs=require(_0xc487('0xf'));var toCsv=require(_0xc487('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xc487('0x10'));var authService=require(_0xc487('0x11'));var qs=require(_0xc487('0x12'));var as=require(_0xc487('0x13'));var hardwareService=require(_0xc487('0x14'));var logger=require('../../config/logger')(_0xc487('0x15'));var utils=require(_0xc487('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xc487('0x17'));var db=require(_0xc487('0x18'))['db'];function respondWithStatusCode(_0x14a7c4,_0x1658a1){_0x1658a1=_0x1658a1||0xcc;return function(_0x4a7ba4){if(_0x4a7ba4){return _0x14a7c4[_0xc487('0x19')](_0x1658a1);}return _0x14a7c4['status'](_0x1658a1)['end']();};}function respondWithResult(_0xafd417,_0x12f2f8){_0x12f2f8=_0x12f2f8||0xc8;return function(_0xa9c2b7){if(_0xa9c2b7){return _0xafd417[_0xc487('0x1a')](_0x12f2f8)[_0xc487('0x1b')](_0xa9c2b7);}};}function respondWithFilteredResult(_0x2c5824,_0x568f5a){return function(_0x1dff29){if(_0x1dff29){var _0x30accb=typeof _0x568f5a[_0xc487('0x1c')]==='undefined'&&typeof _0x568f5a[_0xc487('0x1d')]===_0xc487('0x1e');var _0xf02f33=_0x1dff29[_0xc487('0x1f')];var _0x169112=_0x30accb?0x0:_0x568f5a['offset'];var _0x2c9871=_0x30accb?_0x1dff29[_0xc487('0x1f')]:_0x568f5a[_0xc487('0x1c')]+_0x568f5a[_0xc487('0x1d')];var _0x331d70;if(_0x2c9871>=_0xf02f33){_0x2c9871=_0xf02f33;_0x331d70=0xc8;}else{_0x331d70=0xce;}_0x2c5824[_0xc487('0x1a')](_0x331d70);return _0x2c5824[_0xc487('0x20')](_0xc487('0x21'),_0x169112+'-'+_0x2c9871+'/'+_0xf02f33)[_0xc487('0x1b')](_0x1dff29);}return null;};}function patchUpdates(_0x43cf33){return function(_0x27f9ea){try{jsonpatch[_0xc487('0x22')](_0x27f9ea,_0x43cf33,!![]);}catch(_0x5dfeea){return BPromise[_0xc487('0x23')](_0x5dfeea);}return _0x27f9ea['save']();};}function saveUpdates(_0x18a1dd,_0x34df66){return function(_0x285c42){if(_0x285c42){return _0x285c42[_0xc487('0x24')](_0x18a1dd)[_0xc487('0x25')](function(_0x495e5c){return _0x495e5c;});}return null;};}function removeEntity(_0x885b34,_0x2d1959){return function(_0x278afc){if(_0x278afc){return _0x278afc[_0xc487('0x26')]()[_0xc487('0x25')](function(){_0x885b34[_0xc487('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3494b7,_0x53dc7f){return function(_0x49cb63){if(!_0x49cb63){_0x3494b7[_0xc487('0x19')](0x194);}return _0x49cb63;};}function handleError(_0x485f3f,_0x2610e4){_0x2610e4=_0x2610e4||0x1f4;return function(_0x125d5a){logger[_0xc487('0x27')](_0x125d5a[_0xc487('0x28')]);if(_0x125d5a[_0xc487('0x29')]){delete _0x125d5a['name'];}_0x485f3f[_0xc487('0x1a')](_0x2610e4)[_0xc487('0x2a')](_0x125d5a);};}exports[_0xc487('0x2b')]=function(_0x575ed5,_0x597166){var _0x399ba4={},_0x91d0a={},_0x810e5a={'count':0x0,'rows':[]};var _0x35d8a4=_['map'](db[_0xc487('0x2c')][_0xc487('0x2d')],function(_0x21387d){return{'name':_0x21387d['fieldName'],'type':_0x21387d[_0xc487('0x2e')][_0xc487('0x2f')]};});_0x91d0a[_0xc487('0x30')]=_[_0xc487('0x31')](_0x35d8a4,'name');_0x91d0a['query']=_[_0xc487('0x32')](_0x575ed5[_0xc487('0x33')]);_0x91d0a['filters']=_['intersection'](_0x91d0a[_0xc487('0x30')],_0x91d0a['query']);_0x399ba4[_0xc487('0x34')]=_['intersection'](_0x91d0a['model'],qs[_0xc487('0x35')](_0x575ed5[_0xc487('0x33')]['fields']));_0x399ba4[_0xc487('0x34')]=_0x399ba4[_0xc487('0x34')][_0xc487('0x36')]?_0x399ba4['attributes']:_0x91d0a[_0xc487('0x30')];if(!_0x575ed5[_0xc487('0x33')]['hasOwnProperty'](_0xc487('0x37'))){_0x399ba4['limit']=qs['limit'](_0x575ed5[_0xc487('0x33')]['limit']);_0x399ba4['offset']=qs[_0xc487('0x1c')](_0x575ed5['query'][_0xc487('0x1c')]);}_0x399ba4[_0xc487('0x38')]=qs[_0xc487('0x39')](_0x575ed5[_0xc487('0x33')][_0xc487('0x39')]);_0x399ba4[_0xc487('0x3a')]=qs['filters'](_['pick'](_0x575ed5['query'],_0x91d0a[_0xc487('0x3b')]),_0x35d8a4);if(_0x575ed5[_0xc487('0x33')][_0xc487('0x3c')]){_0x399ba4[_0xc487('0x3a')]=_[_0xc487('0x3d')](_0x399ba4[_0xc487('0x3a')],{'$or':_[_0xc487('0x31')](_0x35d8a4,function(_0x5e277c){if(_0x5e277c[_0xc487('0x2e')]!=='VIRTUAL'){var _0x2aa959={};_0x2aa959[_0x5e277c[_0xc487('0x29')]]={'$like':'%'+_0x575ed5[_0xc487('0x33')][_0xc487('0x3c')]+'%'};return _0x2aa959;}})});}_0x399ba4=_[_0xc487('0x3d')]({},_0x399ba4,_0x575ed5['options']);var _0x17a42f={'where':_0x399ba4[_0xc487('0x3a')]};return db[_0xc487('0x2c')][_0xc487('0x1f')](_0x17a42f)[_0xc487('0x25')](function(_0xcab9f5){_0x810e5a['count']=_0xcab9f5;if(_0x575ed5['query']['includeAll']){_0x399ba4[_0xc487('0x3e')]=[{'all':!![]}];}return db['DeskConfiguration'][_0xc487('0x3f')](_0x399ba4);})[_0xc487('0x25')](function(_0x1c907a){_0x810e5a[_0xc487('0x40')]=_0x1c907a;return _0x810e5a;})[_0xc487('0x25')](respondWithFilteredResult(_0x597166,_0x399ba4))['catch'](handleError(_0x597166,null));};exports[_0xc487('0x41')]=function(_0x260053,_0x21fca3){var _0x277999={'raw':![],'where':{'id':_0x260053['params']['id']}},_0x3fda4d={};_0x3fda4d[_0xc487('0x30')]=_['keys'](db[_0xc487('0x2c')]['rawAttributes']);_0x3fda4d[_0xc487('0x33')]=_[_0xc487('0x32')](_0x260053[_0xc487('0x33')]);_0x3fda4d[_0xc487('0x3b')]=_[_0xc487('0x42')](_0x3fda4d['model'],_0x3fda4d[_0xc487('0x33')]);_0x277999[_0xc487('0x34')]=_[_0xc487('0x42')](_0x3fda4d[_0xc487('0x30')],qs[_0xc487('0x35')](_0x260053[_0xc487('0x33')][_0xc487('0x35')]));_0x277999[_0xc487('0x34')]=_0x277999[_0xc487('0x34')]['length']?_0x277999[_0xc487('0x34')]:_0x3fda4d['model'];if(_0x260053[_0xc487('0x33')][_0xc487('0x43')]){_0x277999[_0xc487('0x3e')]=[{'all':!![]}];}_0x277999=_[_0xc487('0x3d')]({},_0x277999,_0x260053[_0xc487('0x44')]);return db[_0xc487('0x2c')][_0xc487('0x45')](_0x277999)[_0xc487('0x25')](handleEntityNotFound(_0x21fca3,null))[_0xc487('0x25')](respondWithResult(_0x21fca3,null))[_0xc487('0x46')](handleError(_0x21fca3,null));};exports[_0xc487('0x47')]=function(_0x2b776e,_0x17f7a8){return db[_0xc487('0x2c')][_0xc487('0x47')](_0x2b776e[_0xc487('0x48')],{})['then'](respondWithResult(_0x17f7a8,0xc9))[_0xc487('0x46')](handleError(_0x17f7a8,null));};exports[_0xc487('0x24')]=function(_0x11111e,_0x48d112){if(_0x11111e[_0xc487('0x48')]['id']){delete _0x11111e[_0xc487('0x48')]['id'];}return db[_0xc487('0x2c')][_0xc487('0x45')]({'where':{'id':_0x11111e[_0xc487('0x49')]['id']}})[_0xc487('0x25')](handleEntityNotFound(_0x48d112,null))[_0xc487('0x25')](saveUpdates(_0x11111e[_0xc487('0x48')],null))[_0xc487('0x25')](respondWithResult(_0x48d112,null))['catch'](handleError(_0x48d112,null));};exports['destroy']=function(_0x160c5e,_0x245585){return db[_0xc487('0x2c')][_0xc487('0x45')]({'where':{'id':_0x160c5e[_0xc487('0x49')]['id']}})[_0xc487('0x25')](handleEntityNotFound(_0x245585,null))[_0xc487('0x25')](removeEntity(_0x245585,null))[_0xc487('0x46')](handleError(_0x245585,null));};exports['getFields']=function(_0x23232a,_0x12c2a0,_0x4ea183){var _0x4c9df7={};var _0x44db29={};var _0x3afe63;var _0x81809f;return db['DeskConfiguration'][_0xc487('0x4a')]({'where':{'id':_0x23232a[_0xc487('0x49')]['id']}})[_0xc487('0x25')](handleEntityNotFound(_0x12c2a0,null))[_0xc487('0x25')](function(_0x2ce83a){if(_0x2ce83a){_0x3afe63=_0x2ce83a;_0x44db29[_0xc487('0x30')]=_[_0xc487('0x32')](db[_0xc487('0x4b')][_0xc487('0x2d')]);_0x44db29[_0xc487('0x33')]=_[_0xc487('0x32')](_0x23232a[_0xc487('0x33')]);_0x44db29[_0xc487('0x3b')]=_[_0xc487('0x42')](_0x44db29['model'],_0x44db29[_0xc487('0x33')]);_0x4c9df7[_0xc487('0x34')]=_['intersection'](_0x44db29[_0xc487('0x30')],qs[_0xc487('0x35')](_0x23232a[_0xc487('0x33')][_0xc487('0x35')]));_0x4c9df7['attributes']=_0x4c9df7[_0xc487('0x34')][_0xc487('0x36')]?_0x4c9df7[_0xc487('0x34')]:_0x44db29[_0xc487('0x30')];_0x4c9df7['order']=qs['sort'](_0x23232a['query']['sort']);_0x4c9df7[_0xc487('0x3a')]=qs[_0xc487('0x3b')](_['pick'](_0x23232a['query'],_0x44db29[_0xc487('0x3b')]));if(_0x23232a[_0xc487('0x33')][_0xc487('0x3c')]){_0x4c9df7[_0xc487('0x3a')]=_['merge'](_0x4c9df7[_0xc487('0x3a')],{'$or':_[_0xc487('0x31')](_0x4c9df7['attributes'],function(_0x117373){var _0xd0151c={};_0xd0151c[_0x117373]={'$like':'%'+_0x23232a[_0xc487('0x33')][_0xc487('0x3c')]+'%'};return _0xd0151c;})});}_0x4c9df7=_[_0xc487('0x3d')]({},_0x4c9df7,_0x23232a[_0xc487('0x44')]);return _0x3afe63['getFields'](_0x4c9df7);}})['then'](function(_0x4beaf4){if(_0x4beaf4){_0x81809f=_0x4beaf4['length'];if(!_0x23232a[_0xc487('0x33')][_0xc487('0x4c')](_0xc487('0x37'))){_0x4c9df7['limit']=qs[_0xc487('0x1d')](_0x23232a['query'][_0xc487('0x1d')]);_0x4c9df7[_0xc487('0x1c')]=qs['offset'](_0x23232a[_0xc487('0x33')]['offset']);}return _0x3afe63[_0xc487('0x4d')](_0x4c9df7);}})[_0xc487('0x25')](function(_0x1ad2ad){if(_0x1ad2ad){return _0x1ad2ad?{'count':_0x81809f,'rows':_0x1ad2ad}:null;}})[_0xc487('0x25')](respondWithResult(_0x12c2a0,null))[_0xc487('0x46')](handleError(_0x12c2a0,null));};exports['getSubjects']=function(_0xfd8a78,_0x2f7532,_0x25b6c){var _0x236d55={};var _0x28f852={};var _0x52a81a;var _0x3f329b;return db['DeskConfiguration']['findOne']({'where':{'id':_0xfd8a78['params']['id']}})[_0xc487('0x25')](handleEntityNotFound(_0x2f7532,null))[_0xc487('0x25')](function(_0x4b11a8){if(_0x4b11a8){_0x52a81a=_0x4b11a8;_0x28f852[_0xc487('0x30')]=_[_0xc487('0x32')](db[_0xc487('0x4b')][_0xc487('0x2d')]);_0x28f852['query']=_['keys'](_0xfd8a78['query']);_0x28f852[_0xc487('0x3b')]=_[_0xc487('0x42')](_0x28f852[_0xc487('0x30')],_0x28f852[_0xc487('0x33')]);_0x236d55[_0xc487('0x34')]=_[_0xc487('0x42')](_0x28f852[_0xc487('0x30')],qs[_0xc487('0x35')](_0xfd8a78[_0xc487('0x33')]['fields']));_0x236d55[_0xc487('0x34')]=_0x236d55['attributes'][_0xc487('0x36')]?_0x236d55[_0xc487('0x34')]:_0x28f852['model'];_0x236d55[_0xc487('0x38')]=qs[_0xc487('0x39')](_0xfd8a78[_0xc487('0x33')][_0xc487('0x39')]);_0x236d55[_0xc487('0x3a')]=qs[_0xc487('0x3b')](_[_0xc487('0x4e')](_0xfd8a78[_0xc487('0x33')],_0x28f852['filters']));if(_0xfd8a78[_0xc487('0x33')][_0xc487('0x3c')]){_0x236d55['where']=_[_0xc487('0x3d')](_0x236d55[_0xc487('0x3a')],{'$or':_[_0xc487('0x31')](_0x236d55[_0xc487('0x34')],function(_0x36d5f0){var _0x59ef24={};_0x59ef24[_0x36d5f0]={'$like':'%'+_0xfd8a78['query']['filter']+'%'};return _0x59ef24;})});}_0x236d55=_[_0xc487('0x3d')]({},_0x236d55,_0xfd8a78['options']);return _0x52a81a[_0xc487('0x4f')](_0x236d55);}})[_0xc487('0x25')](function(_0x42a7a6){if(_0x42a7a6){_0x3f329b=_0x42a7a6[_0xc487('0x36')];if(!_0xfd8a78[_0xc487('0x33')][_0xc487('0x4c')](_0xc487('0x37'))){_0x236d55[_0xc487('0x1d')]=qs['limit'](_0xfd8a78[_0xc487('0x33')][_0xc487('0x1d')]);_0x236d55[_0xc487('0x1c')]=qs['offset'](_0xfd8a78[_0xc487('0x33')][_0xc487('0x1c')]);}return _0x52a81a[_0xc487('0x4f')](_0x236d55);}})[_0xc487('0x25')](function(_0x2e3f6b){if(_0x2e3f6b){return _0x2e3f6b?{'count':_0x3f329b,'rows':_0x2e3f6b}:null;}})[_0xc487('0x25')](respondWithResult(_0x2f7532,null))[_0xc487('0x46')](handleError(_0x2f7532,null));};exports[_0xc487('0x50')]=function(_0x5a41b2,_0x194eac,_0x292088){var _0x5ba255={};var _0x47c500={};var _0x464eb9;var _0x14704f;return db['DeskConfiguration'][_0xc487('0x4a')]({'where':{'id':_0x5a41b2[_0xc487('0x49')]['id']}})['then'](handleEntityNotFound(_0x194eac,null))['then'](function(_0x1ac082){if(_0x1ac082){_0x464eb9=_0x1ac082;_0x47c500[_0xc487('0x30')]=_['keys'](db[_0xc487('0x4b')][_0xc487('0x2d')]);_0x47c500[_0xc487('0x33')]=_[_0xc487('0x32')](_0x5a41b2[_0xc487('0x33')]);_0x47c500[_0xc487('0x3b')]=_[_0xc487('0x42')](_0x47c500[_0xc487('0x30')],_0x47c500[_0xc487('0x33')]);_0x5ba255[_0xc487('0x34')]=_[_0xc487('0x42')](_0x47c500[_0xc487('0x30')],qs[_0xc487('0x35')](_0x5a41b2['query'][_0xc487('0x35')]));_0x5ba255['attributes']=_0x5ba255['attributes'][_0xc487('0x36')]?_0x5ba255['attributes']:_0x47c500['model'];_0x5ba255[_0xc487('0x38')]=qs['sort'](_0x5a41b2[_0xc487('0x33')]['sort']);_0x5ba255[_0xc487('0x3a')]=qs[_0xc487('0x3b')](_['pick'](_0x5a41b2[_0xc487('0x33')],_0x47c500[_0xc487('0x3b')]));if(_0x5a41b2[_0xc487('0x33')][_0xc487('0x3c')]){_0x5ba255[_0xc487('0x3a')]=_[_0xc487('0x3d')](_0x5ba255[_0xc487('0x3a')],{'$or':_[_0xc487('0x31')](_0x5ba255[_0xc487('0x34')],function(_0x3a82d3){var _0x35eb8d={};_0x35eb8d[_0x3a82d3]={'$like':'%'+_0x5a41b2[_0xc487('0x33')][_0xc487('0x3c')]+'%'};return _0x35eb8d;})});}_0x5ba255=_[_0xc487('0x3d')]({},_0x5ba255,_0x5a41b2[_0xc487('0x44')]);return _0x464eb9[_0xc487('0x50')](_0x5ba255);}})[_0xc487('0x25')](function(_0x36616d){if(_0x36616d){_0x14704f=_0x36616d['length'];if(!_0x5a41b2[_0xc487('0x33')][_0xc487('0x4c')](_0xc487('0x37'))){_0x5ba255[_0xc487('0x1d')]=qs[_0xc487('0x1d')](_0x5a41b2[_0xc487('0x33')][_0xc487('0x1d')]);_0x5ba255[_0xc487('0x1c')]=qs[_0xc487('0x1c')](_0x5a41b2[_0xc487('0x33')][_0xc487('0x1c')]);}return _0x464eb9[_0xc487('0x50')](_0x5ba255);}})[_0xc487('0x25')](function(_0x11cab2){if(_0x11cab2){return _0x11cab2?{'count':_0x14704f,'rows':_0x11cab2}:null;}})[_0xc487('0x25')](respondWithResult(_0x194eac,null))['catch'](handleError(_0x194eac,null));};exports[_0xc487('0x51')]=function(_0x8ed393,_0x204025,_0x3c704a){var _0x555511={};var _0x1d00ef={};var _0x3b4c86;var _0x3d9f96;return db[_0xc487('0x2c')][_0xc487('0x4a')]({'where':{'id':_0x8ed393[_0xc487('0x49')]['id']}})[_0xc487('0x25')](handleEntityNotFound(_0x204025,null))[_0xc487('0x25')](function(_0x5ced6b){if(_0x5ced6b){_0x3b4c86=_0x5ced6b;_0x1d00ef['model']=_[_0xc487('0x32')](db[_0xc487('0x52')]['rawAttributes']);_0x1d00ef[_0xc487('0x33')]=_['keys'](_0x8ed393[_0xc487('0x33')]);_0x1d00ef[_0xc487('0x3b')]=_[_0xc487('0x42')](_0x1d00ef['model'],_0x1d00ef[_0xc487('0x33')]);_0x555511[_0xc487('0x34')]=_[_0xc487('0x42')](_0x1d00ef[_0xc487('0x30')],qs[_0xc487('0x35')](_0x8ed393['query'][_0xc487('0x35')]));_0x555511['attributes']=_0x555511[_0xc487('0x34')][_0xc487('0x36')]?_0x555511[_0xc487('0x34')]:_0x1d00ef[_0xc487('0x30')];_0x555511[_0xc487('0x38')]=qs[_0xc487('0x39')](_0x8ed393['query'][_0xc487('0x39')]);_0x555511[_0xc487('0x3a')]=qs[_0xc487('0x3b')](_['pick'](_0x8ed393['query'],_0x1d00ef[_0xc487('0x3b')]));if(_0x8ed393[_0xc487('0x33')][_0xc487('0x3c')]){_0x555511[_0xc487('0x3a')]=_[_0xc487('0x3d')](_0x555511[_0xc487('0x3a')],{'$or':_[_0xc487('0x31')](_0x555511[_0xc487('0x34')],function(_0x37cfab){var _0x152ae6={};_0x152ae6[_0x37cfab]={'$like':'%'+_0x8ed393['query'][_0xc487('0x3c')]+'%'};return _0x152ae6;})});}_0x555511=_[_0xc487('0x3d')]({},_0x555511,_0x8ed393[_0xc487('0x44')]);return _0x3b4c86[_0xc487('0x51')](_0x555511);}})[_0xc487('0x25')](function(_0x5a9a5d){if(_0x5a9a5d){_0x3d9f96=_0x5a9a5d[_0xc487('0x36')];if(!_0x8ed393['query']['hasOwnProperty'](_0xc487('0x37'))){_0x555511[_0xc487('0x1d')]=qs[_0xc487('0x1d')](_0x8ed393[_0xc487('0x33')][_0xc487('0x1d')]);_0x555511[_0xc487('0x1c')]=qs[_0xc487('0x1c')](_0x8ed393[_0xc487('0x33')][_0xc487('0x1c')]);}return _0x3b4c86[_0xc487('0x51')](_0x555511);}})[_0xc487('0x25')](function(_0x5396e0){if(_0x5396e0){return _0x5396e0?{'count':_0x3d9f96,'rows':_0x5396e0}:null;}})[_0xc487('0x25')](respondWithResult(_0x204025,null))[_0xc487('0x46')](handleError(_0x204025,null));};exports[_0xc487('0x53')]=function(_0x528820,_0x8732a3,_0x5c2318){if(_0x528820['body']['id']){delete _0x528820[_0xc487('0x48')]['id'];}return db[_0xc487('0x2c')][_0xc487('0x4a')]({'where':{'id':_0x528820[_0xc487('0x49')]['id']}})[_0xc487('0x25')](handleEntityNotFound(_0x8732a3,null))[_0xc487('0x25')](function(_0x3cf50d){if(_0x3cf50d){return _0x3cf50d['setTags'](_0x528820[_0xc487('0x48')][_0xc487('0x54')]||[]);}return null;})[_0xc487('0x25')](respondWithResult(_0x8732a3,null))[_0xc487('0x46')](handleError(_0x8732a3,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index c5e5bb5..98a71a0 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 _0x7267=['bluebird','request-promise','path','rimraf','exports','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x18b165,_0x40a7ea){var _0x1d8e19=function(_0x49d432){while(--_0x49d432){_0x18b165['push'](_0x18b165['shift']());}};_0x1d8e19(++_0x40a7ea);}(_0x7267,0x97));var _0x7726=function(_0x2f6902,_0x1c2968){_0x2f6902=_0x2f6902-0x0;var _0x24b591=_0x7267[_0x2f6902];return _0x24b591;};'use strict';var _=require(_0x7726('0x0'));var util=require(_0x7726('0x1'));var logger=require(_0x7726('0x2'))(_0x7726('0x3'));var moment=require(_0x7726('0x4'));var BPromise=require(_0x7726('0x5'));var rp=require(_0x7726('0x6'));var fs=require('fs');var path=require(_0x7726('0x7'));var rimraf=require(_0x7726('0x8'));var config=require('../../config/environment');var attributes=require('./intDeskConfiguration.attributes');module[_0x7726('0x9')]=function(_0x17fba0,_0x2bae1d){return _0x17fba0[_0x7726('0xa')](_0x7726('0xb'),attributes,{'tableName':_0x7726('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x06de=['path','../../config/environment','./intDeskConfiguration.attributes','exports','define','DeskConfiguration','int_desk_configurations','util','../../config/logger','api','bluebird'];(function(_0x218972,_0x1f9794){var _0x1bb1a8=function(_0x3fb962){while(--_0x3fb962){_0x218972['push'](_0x218972['shift']());}};_0x1bb1a8(++_0x1f9794);}(_0x06de,0xd8));var _0xe06d=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0x06de[_0x58c851];return _0x534d8a;};'use strict';var _=require('lodash');var util=require(_0xe06d('0x0'));var logger=require(_0xe06d('0x1'))(_0xe06d('0x2'));var moment=require('moment');var BPromise=require(_0xe06d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe06d('0x4'));var rimraf=require('rimraf');var config=require(_0xe06d('0x5'));var attributes=require(_0xe06d('0x6'));module[_0xe06d('0x7')]=function(_0x1b5d5b,_0x18fdba){return _0x1b5d5b[_0xe06d('0x8')](_0xe06d('0x9'),attributes,{'tableName':_0xe06d('0xa'),'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 73272c3..3783d09 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 _0x1921=['rpc','../../config/environment','jayson/promise','client','request','then','info','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1921,0xf2));var _0x1192=function(_0x5a2fd5,_0x4b7bb6){_0x5a2fd5=_0x5a2fd5-0x0;var _0xfba2ec=_0x1921[_0x5a2fd5];return _0xfba2ec;};'use strict';var _=require(_0x1192('0x0'));var util=require('util');var moment=require(_0x1192('0x1'));var BPromise=require(_0x1192('0x2'));var rs=require(_0x1192('0x3'));var fs=require('fs');var Redis=require(_0x1192('0x4'));var db=require(_0x1192('0x5'))['db'];var utils=require(_0x1192('0x6'));var logger=require(_0x1192('0x7'))(_0x1192('0x8'));var config=require(_0x1192('0x9'));var jayson=require(_0x1192('0xa'));var client=jayson[_0x1192('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56989b,_0x350776,_0x1df881){return new BPromise(function(_0x19ed6f,_0x2d7ae4){return client[_0x1192('0xc')](_0x56989b,_0x1df881)[_0x1192('0xd')](function(_0x1fc22e){logger[_0x1192('0xe')]('DeskConfiguration,\x20%s,\x20%s',_0x350776,'request\x20sent');logger[_0x1192('0xf')](_0x1192('0x10'),_0x350776,_0x1192('0x11'),JSON[_0x1192('0x12')](_0x1fc22e));if(_0x1fc22e[_0x1192('0x13')]){if(_0x1fc22e[_0x1192('0x13')][_0x1192('0x14')]===0x1f4){logger['error'](_0x1192('0x15'),_0x350776,_0x1fc22e['error'][_0x1192('0x16')]);return _0x2d7ae4(_0x1fc22e[_0x1192('0x13')]['message']);}logger[_0x1192('0x13')](_0x1192('0x15'),_0x350776,_0x1fc22e[_0x1192('0x13')]['message']);return _0x19ed6f(_0x1fc22e[_0x1192('0x13')][_0x1192('0x16')]);}else{logger['info'](_0x1192('0x15'),_0x350776,_0x1192('0x11'));_0x19ed6f(_0x1fc22e[_0x1192('0x17')]['message']);}})[_0x1192('0x18')](function(_0x5ed569){logger[_0x1192('0x13')](_0x1192('0x15'),_0x350776,_0x5ed569);_0x2d7ae4(_0x5ed569);});});} \ No newline at end of file +var _0x19e1=['moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment','client','request','then','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','DeskConfiguration,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x2a9836,_0x43db2f){var _0x3dc3b6=function(_0x10dbfa){while(--_0x10dbfa){_0x2a9836['push'](_0x2a9836['shift']());}};_0x3dc3b6(++_0x43db2f);}(_0x19e1,0x163));var _0x119e=function(_0x56daff,_0xadca9a){_0x56daff=_0x56daff-0x0;var _0x132c82=_0x19e1[_0x56daff];return _0x132c82;};'use strict';var _=require(_0x119e('0x0'));var util=require(_0x119e('0x1'));var moment=require(_0x119e('0x2'));var BPromise=require(_0x119e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x119e('0x4'))['db'];var utils=require(_0x119e('0x5'));var logger=require('../../config/logger')(_0x119e('0x6'));var config=require(_0x119e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x119e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b5306,_0x25e166,_0x16a2ee){return new BPromise(function(_0x1b3797,_0x53d5b7){return client[_0x119e('0x9')](_0x1b5306,_0x16a2ee)[_0x119e('0xa')](function(_0x1a6747){logger['info']('DeskConfiguration,\x20%s,\x20%s',_0x25e166,_0x119e('0xb'));logger[_0x119e('0xc')](_0x119e('0xd'),_0x25e166,_0x119e('0xb'),JSON[_0x119e('0xe')](_0x1a6747));if(_0x1a6747[_0x119e('0xf')]){if(_0x1a6747[_0x119e('0xf')]['code']===0x1f4){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x53d5b7(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}logger['error'](_0x119e('0x10'),_0x25e166,_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);return _0x1b3797(_0x1a6747[_0x119e('0xf')][_0x119e('0x11')]);}else{logger[_0x119e('0x12')](_0x119e('0x10'),_0x25e166,_0x119e('0xb'));_0x1b3797(_0x1a6747[_0x119e('0x13')][_0x119e('0x11')]);}})[_0x119e('0x14')](function(_0x54c326){logger[_0x119e('0xf')](_0x119e('0x10'),_0x25e166,_0x54c326);_0x53d5b7(_0x54c326);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 88c6124..5cd1af9 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 _0xd276=['./intDeskField.controller','get','index','show','post','isAuthenticated','create','put','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x119cd8,_0x556b73){var _0x7072a3=function(_0x5908d1){while(--_0x5908d1){_0x119cd8['push'](_0x119cd8['shift']());}};_0x7072a3(++_0x556b73);}(_0xd276,0xfc));var _0x6d27=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xd276[_0x31e29a];return _0x32d892;};'use strict';var multer=require(_0x6d27('0x0'));var util=require(_0x6d27('0x1'));var path=require(_0x6d27('0x2'));var timeout=require(_0x6d27('0x3'));var express=require('express');var router=express[_0x6d27('0x4')]();var fs_extra=require(_0x6d27('0x5'));var auth=require(_0x6d27('0x6'));var interaction=require(_0x6d27('0x7'));var config=require('../../config/environment');var controller=require(_0x6d27('0x8'));router[_0x6d27('0x9')]('/',auth['isAuthenticated'](),controller[_0x6d27('0xa')]);router[_0x6d27('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x6d27('0xb')]);router[_0x6d27('0xc')]('/',auth[_0x6d27('0xd')](),controller[_0x6d27('0xe')]);router[_0x6d27('0xf')](_0x6d27('0x10'),auth[_0x6d27('0xd')](),controller[_0x6d27('0x11')]);router[_0x6d27('0x12')](_0x6d27('0x10'),auth['isAuthenticated'](),controller[_0x6d27('0x13')]);module['exports']=router; \ No newline at end of file +var _0xa805=['isAuthenticated','index','/:id','show','post','create','put','delete','destroy','exports','util','path','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get'];(function(_0x10fcd9,_0x56edaa){var _0x393a81=function(_0x3618f4){while(--_0x3618f4){_0x10fcd9['push'](_0x10fcd9['shift']());}};_0x393a81(++_0x56edaa);}(_0xa805,0xb4));var _0x5a80=function(_0x28ecbc,_0x1cd83e){_0x28ecbc=_0x28ecbc-0x0;var _0x5969f8=_0xa805[_0x28ecbc];return _0x5969f8;};'use strict';var multer=require('multer');var util=require(_0x5a80('0x0'));var path=require(_0x5a80('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x5a80('0x2'));var interaction=require(_0x5a80('0x3'));var config=require(_0x5a80('0x4'));var controller=require(_0x5a80('0x5'));router[_0x5a80('0x6')]('/',auth[_0x5a80('0x7')](),controller[_0x5a80('0x8')]);router[_0x5a80('0x6')](_0x5a80('0x9'),auth['isAuthenticated'](),controller[_0x5a80('0xa')]);router[_0x5a80('0xb')]('/',auth[_0x5a80('0x7')](),controller[_0x5a80('0xc')]);router[_0x5a80('0xd')](_0x5a80('0x9'),auth[_0x5a80('0x7')](),controller['update']);router[_0x5a80('0xe')](_0x5a80('0x9'),auth[_0x5a80('0x7')](),controller[_0x5a80('0xf')]);module[_0x5a80('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 adc61de..6163aa5 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 _0xf6cd=['keyValue','STRING','BOOLEAN','sequelize','exports','ENUM','string','customVariable'];(function(_0x4512d3,_0x5c779e){var _0x52ee09=function(_0x4ac3c9){while(--_0x4ac3c9){_0x4512d3['push'](_0x4512d3['shift']());}};_0x52ee09(++_0x5c779e);}(_0xf6cd,0x143));var _0xdf6c=function(_0x66f455,_0x43978d){_0x66f455=_0x66f455-0x0;var _0x2f4d67=_0xf6cd[_0x66f455];return _0x2f4d67;};'use strict';var Sequelize=require(_0xdf6c('0x0'));module[_0xdf6c('0x1')]={'type':{'type':Sequelize[_0xdf6c('0x2')](_0xdf6c('0x3'),'variable',_0xdf6c('0x4'),_0xdf6c('0x5'),'picklist'),'defaultValue':_0xdf6c('0x3')},'content':{'type':Sequelize[_0xdf6c('0x6')]},'key':{'type':Sequelize[_0xdf6c('0x6')]},'keyType':{'type':Sequelize[_0xdf6c('0x2')](_0xdf6c('0x3'),'variable',_0xdf6c('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0xdf6c('0x6')]},'customField':{'type':Sequelize[_0xdf6c('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdf6c('0x6')]}}; \ No newline at end of file +var _0xbff0=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x271d16,_0x126900){var _0x16558c=function(_0xa92c07){while(--_0xa92c07){_0x271d16['push'](_0x271d16['shift']());}};_0x16558c(++_0x126900);}(_0xbff0,0xb5));var _0x0bff=function(_0x16fe51,_0x393c2e){_0x16fe51=_0x16fe51-0x0;var _0x421c66=_0xbff0[_0x16fe51];return _0x421c66;};'use strict';var Sequelize=require(_0x0bff('0x0'));module[_0x0bff('0x1')]={'type':{'type':Sequelize[_0x0bff('0x2')](_0x0bff('0x3'),'variable',_0x0bff('0x4'),_0x0bff('0x5'),_0x0bff('0x6')),'defaultValue':_0x0bff('0x3')},'content':{'type':Sequelize[_0x0bff('0x7')]},'key':{'type':Sequelize[_0x0bff('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0x0bff('0x3'),_0x0bff('0x8'),_0x0bff('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x0bff('0x7')]},'nameField':{'type':Sequelize[_0x0bff('0x7')]},'customField':{'type':Sequelize[_0x0bff('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0bff('0x7')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 5d4a749..b1773ea 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 _0x9a8b=['find','create','catch','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','name','send','index','map','DeskField','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','findAll','show','params','includeAll','options'];(function(_0x54c695,_0x5d6677){var _0x3ce06b=function(_0x55bdf1){while(--_0x55bdf1){_0x54c695['push'](_0x54c695['shift']());}};_0x3ce06b(++_0x5d6677);}(_0x9a8b,0x1ba));var _0xb9a8=function(_0x38dd70,_0x351ddb){_0x38dd70=_0x38dd70-0x0;var _0x3a7d48=_0x9a8b[_0x38dd70];return _0x3a7d48;};'use strict';var emlformat=require(_0xb9a8('0x0'));var rimraf=require(_0xb9a8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb9a8('0x2'));var rp=require(_0xb9a8('0x3'));var moment=require(_0xb9a8('0x4'));var BPromise=require(_0xb9a8('0x5'));var Mustache=require(_0xb9a8('0x6'));var util=require(_0xb9a8('0x7'));var path=require(_0xb9a8('0x8'));var sox=require(_0xb9a8('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb9a8('0xa'));var _=require(_0xb9a8('0xb'));var squel=require(_0xb9a8('0xc'));var crypto=require(_0xb9a8('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xb9a8('0xe'));var Papa=require(_0xb9a8('0xf'));var Redis=require(_0xb9a8('0x10'));var authService=require(_0xb9a8('0x11'));var qs=require(_0xb9a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb9a8('0x13'));var logger=require(_0xb9a8('0x14'))(_0xb9a8('0x15'));var utils=require(_0xb9a8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xb9a8('0x17'));var db=require(_0xb9a8('0x18'))['db'];function respondWithStatusCode(_0x12e9bb,_0xd32cb){_0xd32cb=_0xd32cb||0xcc;return function(_0x62dbfb){if(_0x62dbfb){return _0x12e9bb[_0xb9a8('0x19')](_0xd32cb);}return _0x12e9bb[_0xb9a8('0x1a')](_0xd32cb)[_0xb9a8('0x1b')]();};}function respondWithResult(_0x1c882a,_0x3ad966){_0x3ad966=_0x3ad966||0xc8;return function(_0x3459bb){if(_0x3459bb){return _0x1c882a[_0xb9a8('0x1a')](_0x3ad966)[_0xb9a8('0x1c')](_0x3459bb);}};}function respondWithFilteredResult(_0x93f5a2,_0x51558b){return function(_0x290eb8){if(_0x290eb8){var _0x478395=typeof _0x51558b[_0xb9a8('0x1d')]===_0xb9a8('0x1e')&&typeof _0x51558b[_0xb9a8('0x1f')]==='undefined';var _0x5d6efe=_0x290eb8[_0xb9a8('0x20')];var _0x5c38ea=_0x478395?0x0:_0x51558b[_0xb9a8('0x1d')];var _0x4bf1a8=_0x478395?_0x290eb8[_0xb9a8('0x20')]:_0x51558b['offset']+_0x51558b[_0xb9a8('0x1f')];var _0x2b9cfd;if(_0x4bf1a8>=_0x5d6efe){_0x4bf1a8=_0x5d6efe;_0x2b9cfd=0xc8;}else{_0x2b9cfd=0xce;}_0x93f5a2[_0xb9a8('0x1a')](_0x2b9cfd);return _0x93f5a2[_0xb9a8('0x21')]('Content-Range',_0x5c38ea+'-'+_0x4bf1a8+'/'+_0x5d6efe)[_0xb9a8('0x1c')](_0x290eb8);}return null;};}function patchUpdates(_0x4a5365){return function(_0x1856ed){try{jsonpatch['apply'](_0x1856ed,_0x4a5365,!![]);}catch(_0x433db4){return BPromise[_0xb9a8('0x22')](_0x433db4);}return _0x1856ed[_0xb9a8('0x23')]();};}function saveUpdates(_0x44e8d8,_0x4da881){return function(_0x296210){if(_0x296210){return _0x296210[_0xb9a8('0x24')](_0x44e8d8)['then'](function(_0x5f4388){return _0x5f4388;});}return null;};}function removeEntity(_0x261cac,_0x3fab8d){return function(_0x5ae6a5){if(_0x5ae6a5){return _0x5ae6a5[_0xb9a8('0x25')]()[_0xb9a8('0x26')](function(){_0x261cac[_0xb9a8('0x1a')](0xcc)[_0xb9a8('0x1b')]();});}};}function handleEntityNotFound(_0x11c390,_0x2f4f16){return function(_0x2f254b){if(!_0x2f254b){_0x11c390[_0xb9a8('0x19')](0x194);}return _0x2f254b;};}function handleError(_0x429a17,_0x3c8c5d){_0x3c8c5d=_0x3c8c5d||0x1f4;return function(_0x3c8e19){logger[_0xb9a8('0x27')](_0x3c8e19[_0xb9a8('0x28')]);if(_0x3c8e19['name']){delete _0x3c8e19[_0xb9a8('0x29')];}_0x429a17[_0xb9a8('0x1a')](_0x3c8c5d)[_0xb9a8('0x2a')](_0x3c8e19);};}exports[_0xb9a8('0x2b')]=function(_0x1adabb,_0x159295){var _0x5dbad5={},_0x13d26b={},_0x1a30ad={'count':0x0,'rows':[]};var _0x2d7eb3=_[_0xb9a8('0x2c')](db[_0xb9a8('0x2d')][_0xb9a8('0x2e')],function(_0x53f9ad){return{'name':_0x53f9ad['fieldName'],'type':_0x53f9ad[_0xb9a8('0x2f')][_0xb9a8('0x30')]};});_0x13d26b[_0xb9a8('0x31')]=_[_0xb9a8('0x2c')](_0x2d7eb3,_0xb9a8('0x29'));_0x13d26b[_0xb9a8('0x32')]=_[_0xb9a8('0x33')](_0x1adabb[_0xb9a8('0x32')]);_0x13d26b[_0xb9a8('0x34')]=_[_0xb9a8('0x35')](_0x13d26b[_0xb9a8('0x31')],_0x13d26b[_0xb9a8('0x32')]);_0x5dbad5['attributes']=_[_0xb9a8('0x35')](_0x13d26b[_0xb9a8('0x31')],qs[_0xb9a8('0x36')](_0x1adabb[_0xb9a8('0x32')][_0xb9a8('0x36')]));_0x5dbad5[_0xb9a8('0x37')]=_0x5dbad5['attributes'][_0xb9a8('0x38')]?_0x5dbad5['attributes']:_0x13d26b[_0xb9a8('0x31')];if(!_0x1adabb[_0xb9a8('0x32')]['hasOwnProperty']('nolimit')){_0x5dbad5['limit']=qs['limit'](_0x1adabb[_0xb9a8('0x32')][_0xb9a8('0x1f')]);_0x5dbad5[_0xb9a8('0x1d')]=qs[_0xb9a8('0x1d')](_0x1adabb[_0xb9a8('0x32')][_0xb9a8('0x1d')]);}_0x5dbad5[_0xb9a8('0x39')]=qs['sort'](_0x1adabb[_0xb9a8('0x32')][_0xb9a8('0x3a')]);_0x5dbad5[_0xb9a8('0x3b')]=qs['filters'](_[_0xb9a8('0x3c')](_0x1adabb[_0xb9a8('0x32')],_0x13d26b[_0xb9a8('0x34')]),_0x2d7eb3);if(_0x1adabb['query'][_0xb9a8('0x3d')]){_0x5dbad5[_0xb9a8('0x3b')]=_[_0xb9a8('0x3e')](_0x5dbad5[_0xb9a8('0x3b')],{'$or':_[_0xb9a8('0x2c')](_0x2d7eb3,function(_0x3bf7e3){if(_0x3bf7e3['type']!==_0xb9a8('0x3f')){var _0x5ab616={};_0x5ab616[_0x3bf7e3['name']]={'$like':'%'+_0x1adabb['query'][_0xb9a8('0x3d')]+'%'};return _0x5ab616;}})});}_0x5dbad5=_[_0xb9a8('0x3e')]({},_0x5dbad5,_0x1adabb['options']);var _0x32746c={'where':_0x5dbad5[_0xb9a8('0x3b')]};return db['DeskField'][_0xb9a8('0x20')](_0x32746c)['then'](function(_0x33b2f5){_0x1a30ad[_0xb9a8('0x20')]=_0x33b2f5;if(_0x1adabb[_0xb9a8('0x32')]['includeAll']){_0x5dbad5['include']=[{'all':!![]}];}return db[_0xb9a8('0x2d')][_0xb9a8('0x40')](_0x5dbad5);})[_0xb9a8('0x26')](function(_0x18d3be){_0x1a30ad['rows']=_0x18d3be;return _0x1a30ad;})['then'](respondWithFilteredResult(_0x159295,_0x5dbad5))['catch'](handleError(_0x159295,null));};exports[_0xb9a8('0x41')]=function(_0xee12fc,_0x1e4ddf){var _0x3c4816={'raw':!![],'where':{'id':_0xee12fc[_0xb9a8('0x42')]['id']}},_0x5e7427={};_0x5e7427[_0xb9a8('0x31')]=_[_0xb9a8('0x33')](db[_0xb9a8('0x2d')]['rawAttributes']);_0x5e7427[_0xb9a8('0x32')]=_[_0xb9a8('0x33')](_0xee12fc['query']);_0x5e7427['filters']=_[_0xb9a8('0x35')](_0x5e7427[_0xb9a8('0x31')],_0x5e7427[_0xb9a8('0x32')]);_0x3c4816['attributes']=_['intersection'](_0x5e7427[_0xb9a8('0x31')],qs[_0xb9a8('0x36')](_0xee12fc[_0xb9a8('0x32')][_0xb9a8('0x36')]));_0x3c4816['attributes']=_0x3c4816['attributes'][_0xb9a8('0x38')]?_0x3c4816[_0xb9a8('0x37')]:_0x5e7427['model'];if(_0xee12fc['query'][_0xb9a8('0x43')]){_0x3c4816['include']=[{'all':!![]}];}_0x3c4816=_['merge']({},_0x3c4816,_0xee12fc[_0xb9a8('0x44')]);return db[_0xb9a8('0x2d')][_0xb9a8('0x45')](_0x3c4816)['then'](handleEntityNotFound(_0x1e4ddf,null))[_0xb9a8('0x26')](respondWithResult(_0x1e4ddf,null))['catch'](handleError(_0x1e4ddf,null));};exports[_0xb9a8('0x46')]=function(_0x5b53ea,_0x2d9482){return db[_0xb9a8('0x2d')][_0xb9a8('0x46')](_0x5b53ea['body'],{})['then'](respondWithResult(_0x2d9482,0xc9))[_0xb9a8('0x47')](handleError(_0x2d9482,null));};exports['update']=function(_0x38a619,_0x25b298){if(_0x38a619[_0xb9a8('0x48')]['id']){delete _0x38a619['body']['id'];}return db['DeskField'][_0xb9a8('0x45')]({'where':{'id':_0x38a619[_0xb9a8('0x42')]['id']}})[_0xb9a8('0x26')](handleEntityNotFound(_0x25b298,null))[_0xb9a8('0x26')](saveUpdates(_0x38a619[_0xb9a8('0x48')],null))[_0xb9a8('0x26')](respondWithResult(_0x25b298,null))['catch'](handleError(_0x25b298,null));};exports[_0xb9a8('0x25')]=function(_0x59e766,_0x191756){return db['DeskField'][_0xb9a8('0x45')]({'where':{'id':_0x59e766[_0xb9a8('0x42')]['id']}})[_0xb9a8('0x26')](handleEntityNotFound(_0x191756,null))['then'](removeEntity(_0x191756,null))[_0xb9a8('0x47')](handleError(_0x191756,null));}; \ No newline at end of file +var _0xd43e=['path','sox','to-csv','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','Content-Range','json','apply','update','then','destroy','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','DeskField','includeAll','findAll','rows','catch','show','params','keys','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','util'];(function(_0x4ade75,_0x11b53d){var _0x2b9a4a=function(_0x37ae01){while(--_0x37ae01){_0x4ade75['push'](_0x4ade75['shift']());}};_0x2b9a4a(++_0x11b53d);}(_0xd43e,0x88));var _0xed43=function(_0x458d81,_0x5cf4b1){_0x458d81=_0x458d81-0x0;var _0x2c97af=_0xd43e[_0x458d81];return _0x2c97af;};'use strict';var emlformat=require(_0xed43('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xed43('0x1'));var jsonpatch=require(_0xed43('0x2'));var rp=require(_0xed43('0x3'));var moment=require(_0xed43('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xed43('0x5'));var path=require(_0xed43('0x6'));var sox=require(_0xed43('0x7'));var csv=require(_0xed43('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xed43('0x9'));var _=require(_0xed43('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xed43('0xb'));var toCsv=require(_0xed43('0x8'));var querystring=require(_0xed43('0xc'));var Papa=require(_0xed43('0xd'));var Redis=require(_0xed43('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xed43('0xf'));var as=require(_0xed43('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xed43('0x11'))(_0xed43('0x12'));var utils=require(_0xed43('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xed43('0x14'))['db'];function respondWithStatusCode(_0x34027b,_0x4eed04){_0x4eed04=_0x4eed04||0xcc;return function(_0x1519aa){if(_0x1519aa){return _0x34027b[_0xed43('0x15')](_0x4eed04);}return _0x34027b[_0xed43('0x16')](_0x4eed04)[_0xed43('0x17')]();};}function respondWithResult(_0x2adbc5,_0x403a89){_0x403a89=_0x403a89||0xc8;return function(_0x597544){if(_0x597544){return _0x2adbc5[_0xed43('0x16')](_0x403a89)['json'](_0x597544);}};}function respondWithFilteredResult(_0x2ec9c3,_0x4a9621){return function(_0x2d457a){if(_0x2d457a){var _0x4caa03=typeof _0x4a9621['offset']===_0xed43('0x18')&&typeof _0x4a9621['limit']===_0xed43('0x18');var _0x1ada9c=_0x2d457a[_0xed43('0x19')];var _0x5f5093=_0x4caa03?0x0:_0x4a9621[_0xed43('0x1a')];var _0xa8a443=_0x4caa03?_0x2d457a['count']:_0x4a9621['offset']+_0x4a9621[_0xed43('0x1b')];var _0x46a875;if(_0xa8a443>=_0x1ada9c){_0xa8a443=_0x1ada9c;_0x46a875=0xc8;}else{_0x46a875=0xce;}_0x2ec9c3[_0xed43('0x16')](_0x46a875);return _0x2ec9c3['set'](_0xed43('0x1c'),_0x5f5093+'-'+_0xa8a443+'/'+_0x1ada9c)[_0xed43('0x1d')](_0x2d457a);}return null;};}function patchUpdates(_0x5bbd5c){return function(_0x3570ef){try{jsonpatch[_0xed43('0x1e')](_0x3570ef,_0x5bbd5c,!![]);}catch(_0x336ce7){return BPromise['reject'](_0x336ce7);}return _0x3570ef['save']();};}function saveUpdates(_0x2a6329,_0x42fb48){return function(_0x7f4c4c){if(_0x7f4c4c){return _0x7f4c4c[_0xed43('0x1f')](_0x2a6329)[_0xed43('0x20')](function(_0x45a24a){return _0x45a24a;});}return null;};}function removeEntity(_0x556440,_0x414c7a){return function(_0x30b5cf){if(_0x30b5cf){return _0x30b5cf[_0xed43('0x21')]()['then'](function(){_0x556440[_0xed43('0x16')](0xcc)[_0xed43('0x17')]();});}};}function handleEntityNotFound(_0x28a908,_0x90350a){return function(_0x549f91){if(!_0x549f91){_0x28a908[_0xed43('0x15')](0x194);}return _0x549f91;};}function handleError(_0x53f575,_0x3e7442){_0x3e7442=_0x3e7442||0x1f4;return function(_0xed8706){logger[_0xed43('0x22')](_0xed8706[_0xed43('0x23')]);if(_0xed8706['name']){delete _0xed8706[_0xed43('0x24')];}_0x53f575['status'](_0x3e7442)['send'](_0xed8706);};}exports[_0xed43('0x25')]=function(_0x51f128,_0x587d85){var _0x1b2f66={},_0x139750={},_0x325ab5={'count':0x0,'rows':[]};var _0x1f1207=_[_0xed43('0x26')](db['DeskField'][_0xed43('0x27')],function(_0x32c395){return{'name':_0x32c395[_0xed43('0x28')],'type':_0x32c395[_0xed43('0x29')][_0xed43('0x2a')]};});_0x139750['model']=_[_0xed43('0x26')](_0x1f1207,_0xed43('0x24'));_0x139750[_0xed43('0x2b')]=_['keys'](_0x51f128[_0xed43('0x2b')]);_0x139750[_0xed43('0x2c')]=_[_0xed43('0x2d')](_0x139750[_0xed43('0x2e')],_0x139750[_0xed43('0x2b')]);_0x1b2f66[_0xed43('0x2f')]=_[_0xed43('0x2d')](_0x139750[_0xed43('0x2e')],qs['fields'](_0x51f128['query'][_0xed43('0x30')]));_0x1b2f66['attributes']=_0x1b2f66[_0xed43('0x2f')][_0xed43('0x31')]?_0x1b2f66['attributes']:_0x139750[_0xed43('0x2e')];if(!_0x51f128[_0xed43('0x2b')][_0xed43('0x32')](_0xed43('0x33'))){_0x1b2f66[_0xed43('0x1b')]=qs[_0xed43('0x1b')](_0x51f128[_0xed43('0x2b')][_0xed43('0x1b')]);_0x1b2f66['offset']=qs['offset'](_0x51f128[_0xed43('0x2b')][_0xed43('0x1a')]);}_0x1b2f66[_0xed43('0x34')]=qs[_0xed43('0x35')](_0x51f128[_0xed43('0x2b')]['sort']);_0x1b2f66[_0xed43('0x36')]=qs['filters'](_[_0xed43('0x37')](_0x51f128[_0xed43('0x2b')],_0x139750[_0xed43('0x2c')]),_0x1f1207);if(_0x51f128['query'][_0xed43('0x38')]){_0x1b2f66[_0xed43('0x36')]=_['merge'](_0x1b2f66[_0xed43('0x36')],{'$or':_[_0xed43('0x26')](_0x1f1207,function(_0x5bf247){if(_0x5bf247[_0xed43('0x29')]!=='VIRTUAL'){var _0x16c207={};_0x16c207[_0x5bf247[_0xed43('0x24')]]={'$like':'%'+_0x51f128['query'][_0xed43('0x38')]+'%'};return _0x16c207;}})});}_0x1b2f66=_[_0xed43('0x39')]({},_0x1b2f66,_0x51f128[_0xed43('0x3a')]);var _0x4a6ff6={'where':_0x1b2f66[_0xed43('0x36')]};return db[_0xed43('0x3b')][_0xed43('0x19')](_0x4a6ff6)[_0xed43('0x20')](function(_0xa6a7c3){_0x325ab5[_0xed43('0x19')]=_0xa6a7c3;if(_0x51f128['query'][_0xed43('0x3c')]){_0x1b2f66['include']=[{'all':!![]}];}return db[_0xed43('0x3b')][_0xed43('0x3d')](_0x1b2f66);})[_0xed43('0x20')](function(_0x2a9a15){_0x325ab5[_0xed43('0x3e')]=_0x2a9a15;return _0x325ab5;})[_0xed43('0x20')](respondWithFilteredResult(_0x587d85,_0x1b2f66))[_0xed43('0x3f')](handleError(_0x587d85,null));};exports[_0xed43('0x40')]=function(_0x19d7de,_0x32ddec){var _0x3ec9c0={'raw':!![],'where':{'id':_0x19d7de[_0xed43('0x41')]['id']}},_0x57ac6b={};_0x57ac6b[_0xed43('0x2e')]=_[_0xed43('0x42')](db['DeskField'][_0xed43('0x27')]);_0x57ac6b[_0xed43('0x2b')]=_[_0xed43('0x42')](_0x19d7de['query']);_0x57ac6b[_0xed43('0x2c')]=_['intersection'](_0x57ac6b['model'],_0x57ac6b[_0xed43('0x2b')]);_0x3ec9c0[_0xed43('0x2f')]=_[_0xed43('0x2d')](_0x57ac6b[_0xed43('0x2e')],qs['fields'](_0x19d7de[_0xed43('0x2b')][_0xed43('0x30')]));_0x3ec9c0['attributes']=_0x3ec9c0['attributes'][_0xed43('0x31')]?_0x3ec9c0['attributes']:_0x57ac6b[_0xed43('0x2e')];if(_0x19d7de['query'][_0xed43('0x3c')]){_0x3ec9c0[_0xed43('0x43')]=[{'all':!![]}];}_0x3ec9c0=_[_0xed43('0x39')]({},_0x3ec9c0,_0x19d7de[_0xed43('0x3a')]);return db[_0xed43('0x3b')][_0xed43('0x44')](_0x3ec9c0)['then'](handleEntityNotFound(_0x32ddec,null))[_0xed43('0x20')](respondWithResult(_0x32ddec,null))[_0xed43('0x3f')](handleError(_0x32ddec,null));};exports[_0xed43('0x45')]=function(_0x2ff4cf,_0x298662){return db[_0xed43('0x3b')]['create'](_0x2ff4cf[_0xed43('0x46')],{})[_0xed43('0x20')](respondWithResult(_0x298662,0xc9))[_0xed43('0x3f')](handleError(_0x298662,null));};exports[_0xed43('0x1f')]=function(_0x567327,_0xeda46e){if(_0x567327[_0xed43('0x46')]['id']){delete _0x567327['body']['id'];}return db[_0xed43('0x3b')][_0xed43('0x44')]({'where':{'id':_0x567327[_0xed43('0x41')]['id']}})[_0xed43('0x20')](handleEntityNotFound(_0xeda46e,null))[_0xed43('0x20')](saveUpdates(_0x567327[_0xed43('0x46')],null))[_0xed43('0x20')](respondWithResult(_0xeda46e,null))[_0xed43('0x3f')](handleError(_0xeda46e,null));};exports[_0xed43('0x21')]=function(_0x5f1968,_0x47cb1e){return db[_0xed43('0x3b')][_0xed43('0x44')]({'where':{'id':_0x5f1968[_0xed43('0x41')]['id']}})['then'](handleEntityNotFound(_0x47cb1e,null))['then'](removeEntity(_0x47cb1e,null))[_0xed43('0x3f')](handleError(_0x47cb1e,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 10b8f70..9c04371 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 _0x498a=['DeskField','desk_unique_index','FieldId','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define'];(function(_0x53d03e,_0x78c2a3){var _0x6e2906=function(_0x25ed94){while(--_0x25ed94){_0x53d03e['push'](_0x53d03e['shift']());}};_0x6e2906(++_0x78c2a3);}(_0x498a,0x12e));var _0xa498=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x498a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa498('0x0'));var util=require(_0xa498('0x1'));var logger=require('../../config/logger')(_0xa498('0x2'));var moment=require(_0xa498('0x3'));var BPromise=require(_0xa498('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa498('0x5'));var rimraf=require(_0xa498('0x6'));var config=require(_0xa498('0x7'));var attributes=require(_0xa498('0x8'));module['exports']=function(_0x270827,_0x1a3180){return _0x270827[_0xa498('0x9')](_0xa498('0xa'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xa498('0xb'),'fields':['idField',_0xa498('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6caa=['DeskField','desk_unique_index','idField','lodash','util','bluebird','path','rimraf','../../config/environment','./intDeskField.attributes','define'];(function(_0x384904,_0x516a42){var _0x3bb81f=function(_0x4e8f5f){while(--_0x4e8f5f){_0x384904['push'](_0x384904['shift']());}};_0x3bb81f(++_0x516a42);}(_0x6caa,0x1d1));var _0xa6ca=function(_0x348e23,_0x15fe41){_0x348e23=_0x348e23-0x0;var _0x10d3dd=_0x6caa[_0x348e23];return _0x10d3dd;};'use strict';var _=require(_0xa6ca('0x0'));var util=require(_0xa6ca('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa6ca('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa6ca('0x3'));var rimraf=require(_0xa6ca('0x4'));var config=require(_0xa6ca('0x5'));var attributes=require(_0xa6ca('0x6'));module['exports']=function(_0x4e14d3,_0x102d72){return _0x4e14d3[_0xa6ca('0x7')](_0xa6ca('0x8'),attributes,{'tableName':'int_desk_fields','paranoid':![],'indexes':[{'name':_0xa6ca('0x9'),'fields':[_0xa6ca('0xa'),'FieldId'],'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 4eee16d..4af239a 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 _0x01e2=['../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x01e2,0x1c9));var _0x201e=function(_0x25d74a,_0x10d028){_0x25d74a=_0x25d74a-0x0;var _0x9f5f61=_0x01e2[_0x25d74a];return _0x9f5f61;};'use strict';var _=require('lodash');var util=require(_0x201e('0x0'));var moment=require(_0x201e('0x1'));var BPromise=require(_0x201e('0x2'));var rs=require(_0x201e('0x3'));var fs=require('fs');var Redis=require(_0x201e('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x201e('0x5'))(_0x201e('0x6'));var config=require(_0x201e('0x7'));var jayson=require(_0x201e('0x8'));var client=jayson['client'][_0x201e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5d725a,_0x171fff,_0xfa5852){return new BPromise(function(_0x526146,_0x1a633b){return client['request'](_0x5d725a,_0xfa5852)[_0x201e('0xa')](function(_0x580ea5){logger[_0x201e('0xb')](_0x201e('0xc'),_0x171fff,_0x201e('0xd'));logger[_0x201e('0xe')]('DeskField,\x20%s,\x20%s,\x20%s',_0x171fff,'request\x20sent',JSON[_0x201e('0xf')](_0x580ea5));if(_0x580ea5[_0x201e('0x10')]){if(_0x580ea5[_0x201e('0x10')][_0x201e('0x11')]===0x1f4){logger[_0x201e('0x10')]('DeskField,\x20%s,\x20%s',_0x171fff,_0x580ea5[_0x201e('0x10')][_0x201e('0x12')]);return _0x1a633b(_0x580ea5[_0x201e('0x10')][_0x201e('0x12')]);}logger[_0x201e('0x10')](_0x201e('0xc'),_0x171fff,_0x580ea5[_0x201e('0x10')][_0x201e('0x12')]);return _0x526146(_0x580ea5[_0x201e('0x10')]['message']);}else{logger[_0x201e('0xb')](_0x201e('0xc'),_0x171fff,_0x201e('0xd'));_0x526146(_0x580ea5[_0x201e('0x13')][_0x201e('0x12')]);}})[_0x201e('0x14')](function(_0xff9838){logger[_0x201e('0x10')](_0x201e('0xc'),_0x171fff,_0xff9838);_0x1a633b(_0xff9838);});});} \ No newline at end of file +var _0x57c4=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','DeskField,\x20%s,\x20%s','request\x20sent','debug','DeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result'];(function(_0x28f5d7,_0x5d66e4){var _0x390fbb=function(_0x1d4edd){while(--_0x1d4edd){_0x28f5d7['push'](_0x28f5d7['shift']());}};_0x390fbb(++_0x5d66e4);}(_0x57c4,0x65));var _0x457c=function(_0x10582f,_0x49b3ae){_0x10582f=_0x10582f-0x0;var _0x1301b5=_0x57c4[_0x10582f];return _0x1301b5;};'use strict';var _=require(_0x457c('0x0'));var util=require(_0x457c('0x1'));var moment=require(_0x457c('0x2'));var BPromise=require(_0x457c('0x3'));var rs=require(_0x457c('0x4'));var fs=require('fs');var Redis=require(_0x457c('0x5'));var db=require(_0x457c('0x6'))['db'];var utils=require(_0x457c('0x7'));var logger=require(_0x457c('0x8'))(_0x457c('0x9'));var config=require('../../config/environment');var jayson=require(_0x457c('0xa'));var client=jayson[_0x457c('0xb')][_0x457c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x59376f,_0x4b1677,_0xdbfa4d){return new BPromise(function(_0x381640,_0x455cb7){return client[_0x457c('0xd')](_0x59376f,_0xdbfa4d)['then'](function(_0x23c679){logger[_0x457c('0xe')](_0x457c('0xf'),_0x4b1677,_0x457c('0x10'));logger[_0x457c('0x11')](_0x457c('0x12'),_0x4b1677,_0x457c('0x10'),JSON[_0x457c('0x13')](_0x23c679));if(_0x23c679[_0x457c('0x14')]){if(_0x23c679[_0x457c('0x14')][_0x457c('0x15')]===0x1f4){logger['error'](_0x457c('0xf'),_0x4b1677,_0x23c679[_0x457c('0x14')][_0x457c('0x16')]);return _0x455cb7(_0x23c679[_0x457c('0x14')][_0x457c('0x16')]);}logger[_0x457c('0x14')](_0x457c('0xf'),_0x4b1677,_0x23c679['error'][_0x457c('0x16')]);return _0x381640(_0x23c679[_0x457c('0x14')][_0x457c('0x16')]);}else{logger[_0x457c('0xe')](_0x457c('0xf'),_0x4b1677,'request\x20sent');_0x381640(_0x23c679[_0x457c('0x17')][_0x457c('0x16')]);}})[_0x457c('0x18')](function(_0x4abad0){logger[_0x457c('0x14')]('DeskField,\x20%s,\x20%s',_0x4b1677,_0x4abad0);_0x455cb7(_0x4abad0);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 9db0f4b..cfefb1b 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 _0x16fc=['Router','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','/:id','show','getConfigurations','/:id/fields','getFields','create','/:id/configurations','addConfiguration','put','update','delete','destroy','exports','util','connect-timeout'];(function(_0x993df9,_0x2b0e56){var _0x831ad1=function(_0x585786){while(--_0x585786){_0x993df9['push'](_0x993df9['shift']());}};_0x831ad1(++_0x2b0e56);}(_0x16fc,0x1a2));var _0xc16f=function(_0x11266b,_0x46d943){_0x11266b=_0x11266b-0x0;var _0x542101=_0x16fc[_0x11266b];return _0x542101;};'use strict';var multer=require('multer');var util=require(_0xc16f('0x0'));var path=require('path');var timeout=require(_0xc16f('0x1'));var express=require('express');var router=express[_0xc16f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc16f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xc16f('0x4'));var controller=require(_0xc16f('0x5'));router[_0xc16f('0x6')]('/',auth[_0xc16f('0x7')](),controller['index']);router[_0xc16f('0x6')](_0xc16f('0x8'),auth[_0xc16f('0x7')](),controller[_0xc16f('0x9')]);router[_0xc16f('0x6')]('/:id/configurations',auth[_0xc16f('0x7')](),controller[_0xc16f('0xa')]);router['get'](_0xc16f('0xb'),auth[_0xc16f('0x7')](),controller[_0xc16f('0xc')]);router['post']('/',auth[_0xc16f('0x7')](),controller[_0xc16f('0xd')]);router['post'](_0xc16f('0xe'),auth[_0xc16f('0x7')](),controller[_0xc16f('0xf')]);router[_0xc16f('0x10')]('/:id',auth[_0xc16f('0x7')](),controller[_0xc16f('0x11')]);router[_0xc16f('0x12')](_0xc16f('0x8'),auth[_0xc16f('0x7')](),controller[_0xc16f('0x13')]);module[_0xc16f('0x14')]=router; \ No newline at end of file +var _0x5ade=['getFields','post','create','addConfiguration','update','delete','exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x5ade,0x1a5));var _0xe5ad=function(_0x2c60e3,_0x8baf0e){_0x2c60e3=_0x2c60e3-0x0;var _0x50c928=_0x5ade[_0x2c60e3];return _0x50c928;};'use strict';var multer=require(_0xe5ad('0x0'));var util=require('util');var path=require(_0xe5ad('0x1'));var timeout=require('connect-timeout');var express=require(_0xe5ad('0x2'));var router=express[_0xe5ad('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe5ad('0x4'));var interaction=require(_0xe5ad('0x5'));var config=require(_0xe5ad('0x6'));var controller=require(_0xe5ad('0x7'));router[_0xe5ad('0x8')]('/',auth[_0xe5ad('0x9')](),controller[_0xe5ad('0xa')]);router[_0xe5ad('0x8')](_0xe5ad('0xb'),auth['isAuthenticated'](),controller[_0xe5ad('0xc')]);router[_0xe5ad('0x8')](_0xe5ad('0xd'),auth['isAuthenticated'](),controller[_0xe5ad('0xe')]);router['get'](_0xe5ad('0xf'),auth[_0xe5ad('0x9')](),controller[_0xe5ad('0x10')]);router[_0xe5ad('0x11')]('/',auth[_0xe5ad('0x9')](),controller[_0xe5ad('0x12')]);router[_0xe5ad('0x11')](_0xe5ad('0xd'),auth[_0xe5ad('0x9')](),controller[_0xe5ad('0x13')]);router['put'](_0xe5ad('0xb'),auth[_0xe5ad('0x9')](),controller[_0xe5ad('0x14')]);router[_0xe5ad('0x15')]('/:id',auth[_0xe5ad('0x9')](),controller['destroy']);module[_0xe5ad('0x16')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index 602a0be..3c753fa 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 _0xbada=['exports','STRING','sequelize'];(function(_0x45df6c,_0x1df8db){var _0x3f60b3=function(_0x4c9693){while(--_0x4c9693){_0x45df6c['push'](_0x45df6c['shift']());}};_0x3f60b3(++_0x1df8db);}(_0xbada,0x18e));var _0xabad=function(_0x1b6c6d,_0x2983b0){_0x1b6c6d=_0x1b6c6d-0x0;var _0x290d9d=_0xbada[_0x1b6c6d];return _0x290d9d;};'use strict';var Sequelize=require(_0xabad('0x0'));module[_0xabad('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xabad('0x2')]},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize['STRING']},'tenantId':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0xabad('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xabad('0x2')]}}; \ No newline at end of file +var _0x8a7b=['exports','STRING','sequelize'];(function(_0x2764c7,_0x2951eb){var _0x186c96=function(_0x54387e){while(--_0x54387e){_0x2764c7['push'](_0x2764c7['shift']());}};_0x186c96(++_0x2951eb);}(_0x8a7b,0x188));var _0xb8a7=function(_0x2688d5,_0x45db72){_0x2688d5=_0x2688d5-0x0;var _0x372637=_0x8a7b[_0x2688d5];return _0x372637;};'use strict';var Sequelize=require(_0xb8a7('0x0'));module[_0xb8a7('0x1')]={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xb8a7('0x2')]},'password':{'type':Sequelize[_0xb8a7('0x2')]},'remoteUri':{'type':Sequelize[_0xb8a7('0x2')]},'tenantId':{'type':Sequelize[_0xb8a7('0x2')]},'clientId':{'type':Sequelize[_0xb8a7('0x2')]},'clientSecret':{'type':Sequelize[_0xb8a7('0x2')]},'serverUrl':{'type':Sequelize[_0xb8a7('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xb8a7('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index 261b6db..28b17fa 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 _0xd73a=['then','destroy','name','index','Dynamics365Account','rawAttributes','type','key','model','map','filters','attributes','intersection','query','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','show','keys','find','create','body','params','getConfigurations','Dynamics365Configuration','options','hasOwnProperty','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','getFields','ticketType','incident','Incident','title','customerid','ownerid','caseorigincode','phonenumber','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidyominame','contractdetailidname','contractidname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridyominame','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','followupby','influencescore','kbarticleidname','masteridname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridyominame','parentcaseidname','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolveby','responsiblecontactidname','slaname','socialprofileidname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','traversedpath','utcconversiontimezonecode','versionnumber','concat','findOne','username','password','tenantId','clientId','clientSecret','remoteUri','slice','lastIndexOf','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','includes','LogicalName','forEach','@odata.type','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','statusCode','error','stack','send','test',')/Attributes(','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update'];(function(_0x4d4827,_0x54e01e){var _0x12f272=function(_0xde446e){while(--_0xde446e){_0x4d4827['push'](_0x4d4827['shift']());}};_0x12f272(++_0x54e01e);}(_0xd73a,0x171));var _0xad73=function(_0x1616e9,_0x1104ba){_0x1616e9=_0x1616e9-0x0;var _0x311ac1=_0xd73a[_0x1616e9];return _0x311ac1;};'use strict';var emlformat=require(_0xad73('0x0'));var rimraf=require(_0xad73('0x1'));var zipdir=require(_0xad73('0x2'));var jsonpatch=require(_0xad73('0x3'));var rp=require(_0xad73('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xad73('0x5'));var util=require(_0xad73('0x6'));var path=require(_0xad73('0x7'));var sox=require(_0xad73('0x8'));var csv=require(_0xad73('0x9'));var ejs=require(_0xad73('0xa'));var fs=require('fs');var fs_extra=require(_0xad73('0xb'));var _=require(_0xad73('0xc'));var squel=require(_0xad73('0xd'));var crypto=require(_0xad73('0xe'));var jsforce=require(_0xad73('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xad73('0x9'));var querystring=require('querystring');var Papa=require(_0xad73('0x10'));var Redis=require(_0xad73('0x11'));var authService=require(_0xad73('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xad73('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad73('0x14'))('api');var utils=require(_0xad73('0x15'));var config=require(_0xad73('0x16'));var licenseUtil=require(_0xad73('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xad73('0x18'));function respondWithStatusCode(_0x241ff5,_0x488787){_0x488787=_0x488787||0xcc;return function(_0x10e1ab){if(_0x10e1ab){return _0x241ff5[_0xad73('0x19')](_0x488787);}return _0x241ff5[_0xad73('0x1a')](_0x488787)[_0xad73('0x1b')]();};}function respondWithResult(_0x15f72d,_0x82fe13){_0x82fe13=_0x82fe13||0xc8;return function(_0x49d705){if(_0x49d705){return _0x15f72d[_0xad73('0x1a')](_0x82fe13)[_0xad73('0x1c')](_0x49d705);}};}function respondWithFilteredResult(_0x4336fa,_0x155548){return function(_0x2f0dcd){if(_0x2f0dcd){var _0x9de467=typeof _0x155548[_0xad73('0x1d')]===_0xad73('0x1e')&&typeof _0x155548[_0xad73('0x1f')]===_0xad73('0x1e');var _0x490945=_0x2f0dcd[_0xad73('0x20')];var _0x4cafad=_0x9de467?0x0:_0x155548['offset'];var _0x28bd73=_0x9de467?_0x2f0dcd[_0xad73('0x20')]:_0x155548[_0xad73('0x1d')]+_0x155548['limit'];var _0x2ffd35;if(_0x28bd73>=_0x490945){_0x28bd73=_0x490945;_0x2ffd35=0xc8;}else{_0x2ffd35=0xce;}_0x4336fa[_0xad73('0x1a')](_0x2ffd35);return _0x4336fa['set'](_0xad73('0x21'),_0x4cafad+'-'+_0x28bd73+'/'+_0x490945)[_0xad73('0x1c')](_0x2f0dcd);}return null;};}function patchUpdates(_0x3e02ed){return function(_0x3c928d){try{jsonpatch[_0xad73('0x22')](_0x3c928d,_0x3e02ed,!![]);}catch(_0x3882c5){return BPromise[_0xad73('0x23')](_0x3882c5);}return _0x3c928d['save']();};}function saveUpdates(_0xfe2758,_0x31f5c4){return function(_0x2d16c9){if(_0x2d16c9){return _0x2d16c9[_0xad73('0x24')](_0xfe2758)[_0xad73('0x25')](function(_0x2a1295){return _0x2a1295;});}return null;};}function removeEntity(_0xbfb297,_0x439f09){return function(_0xcdb93d){if(_0xcdb93d){return _0xcdb93d[_0xad73('0x26')]()[_0xad73('0x25')](function(){_0xbfb297[_0xad73('0x1a')](0xcc)[_0xad73('0x1b')]();});}};}function handleEntityNotFound(_0xfec523,_0x1b7d84){return function(_0x3e0d42){if(!_0x3e0d42){_0xfec523[_0xad73('0x19')](0x194);}return _0x3e0d42;};}function handleError(_0x920ffc,_0xb7700c){_0xb7700c=_0xb7700c||0x1f4;return function(_0x44fdd3){logger['error'](_0x44fdd3['stack']);if(_0x44fdd3['name']){delete _0x44fdd3[_0xad73('0x27')];}_0x920ffc[_0xad73('0x1a')](_0xb7700c)['send'](_0x44fdd3);};}exports[_0xad73('0x28')]=function(_0x54a8f9,_0x54eadc){var _0x1f826c={},_0x377273={},_0x34fe4d={'count':0x0,'rows':[]};var _0x428dec=_['map'](db[_0xad73('0x29')][_0xad73('0x2a')],function(_0x6d8b43){return{'name':_0x6d8b43['fieldName'],'type':_0x6d8b43[_0xad73('0x2b')][_0xad73('0x2c')]};});_0x377273[_0xad73('0x2d')]=_[_0xad73('0x2e')](_0x428dec,_0xad73('0x27'));_0x377273['query']=_['keys'](_0x54a8f9['query']);_0x377273[_0xad73('0x2f')]=_['intersection'](_0x377273[_0xad73('0x2d')],_0x377273['query']);_0x1f826c[_0xad73('0x30')]=_[_0xad73('0x31')](_0x377273['model'],qs['fields'](_0x54a8f9[_0xad73('0x32')][_0xad73('0x33')]));_0x1f826c['attributes']=_0x1f826c['attributes'][_0xad73('0x34')]?_0x1f826c['attributes']:_0x377273[_0xad73('0x2d')];if(!_0x54a8f9[_0xad73('0x32')]['hasOwnProperty'](_0xad73('0x35'))){_0x1f826c['limit']=qs[_0xad73('0x1f')](_0x54a8f9[_0xad73('0x32')][_0xad73('0x1f')]);_0x1f826c[_0xad73('0x1d')]=qs[_0xad73('0x1d')](_0x54a8f9[_0xad73('0x32')][_0xad73('0x1d')]);}_0x1f826c[_0xad73('0x36')]=qs[_0xad73('0x37')](_0x54a8f9['query'][_0xad73('0x37')]);_0x1f826c[_0xad73('0x38')]=qs['filters'](_[_0xad73('0x39')](_0x54a8f9[_0xad73('0x32')],_0x377273[_0xad73('0x2f')]),_0x428dec);if(_0x54a8f9[_0xad73('0x32')][_0xad73('0x3a')]){_0x1f826c[_0xad73('0x38')]=_[_0xad73('0x3b')](_0x1f826c[_0xad73('0x38')],{'$or':_[_0xad73('0x2e')](_0x428dec,function(_0x4830f6){if(_0x4830f6[_0xad73('0x2b')]!==_0xad73('0x3c')){var _0x3b70d2={};_0x3b70d2[_0x4830f6['name']]={'$like':'%'+_0x54a8f9['query'][_0xad73('0x3a')]+'%'};return _0x3b70d2;}})});}_0x1f826c=_['merge']({},_0x1f826c,_0x54a8f9['options']);var _0xa8951a={'where':_0x1f826c[_0xad73('0x38')]};return db[_0xad73('0x29')][_0xad73('0x20')](_0xa8951a)['then'](function(_0x1f0bae){_0x34fe4d[_0xad73('0x20')]=_0x1f0bae;if(_0x54a8f9['query'][_0xad73('0x3d')]){_0x1f826c[_0xad73('0x3e')]=[{'all':!![]}];}return db['Dynamics365Account'][_0xad73('0x3f')](_0x1f826c);})[_0xad73('0x25')](function(_0x1cf4fb){_0x34fe4d['rows']=_0x1cf4fb;return _0x34fe4d;})[_0xad73('0x25')](respondWithFilteredResult(_0x54eadc,_0x1f826c))[_0xad73('0x40')](handleError(_0x54eadc,null));};exports[_0xad73('0x41')]=function(_0x3d2ef0,_0x1f46bf){var _0x4ee68d={'raw':![],'where':{'id':_0x3d2ef0['params']['id']}},_0x538b8c={};_0x538b8c[_0xad73('0x2d')]=_[_0xad73('0x42')](db[_0xad73('0x29')][_0xad73('0x2a')]);_0x538b8c[_0xad73('0x32')]=_[_0xad73('0x42')](_0x3d2ef0[_0xad73('0x32')]);_0x538b8c['filters']=_[_0xad73('0x31')](_0x538b8c[_0xad73('0x2d')],_0x538b8c['query']);_0x4ee68d['attributes']=_[_0xad73('0x31')](_0x538b8c[_0xad73('0x2d')],qs[_0xad73('0x33')](_0x3d2ef0[_0xad73('0x32')]['fields']));_0x4ee68d[_0xad73('0x30')]=_0x4ee68d[_0xad73('0x30')][_0xad73('0x34')]?_0x4ee68d['attributes']:_0x538b8c[_0xad73('0x2d')];if(_0x3d2ef0[_0xad73('0x32')][_0xad73('0x3d')]){_0x4ee68d[_0xad73('0x3e')]=[{'all':!![]}];}_0x4ee68d=_['merge']({},_0x4ee68d,_0x3d2ef0['options']);return db[_0xad73('0x29')][_0xad73('0x43')](_0x4ee68d)[_0xad73('0x25')](handleEntityNotFound(_0x1f46bf,null))[_0xad73('0x25')](respondWithResult(_0x1f46bf,null))[_0xad73('0x40')](handleError(_0x1f46bf,null));};exports[_0xad73('0x44')]=function(_0x21d57f,_0x9e5c6e){return db[_0xad73('0x29')]['create'](_0x21d57f['body'],{})[_0xad73('0x25')](respondWithResult(_0x9e5c6e,0xc9))[_0xad73('0x40')](handleError(_0x9e5c6e,null));};exports[_0xad73('0x24')]=function(_0x5b6e41,_0x445557){if(_0x5b6e41[_0xad73('0x45')]['id']){delete _0x5b6e41[_0xad73('0x45')]['id'];}return db[_0xad73('0x29')]['find']({'where':{'id':_0x5b6e41[_0xad73('0x46')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x445557,null))[_0xad73('0x25')](saveUpdates(_0x5b6e41['body'],null))[_0xad73('0x25')](respondWithResult(_0x445557,null))[_0xad73('0x40')](handleError(_0x445557,null));};exports[_0xad73('0x26')]=function(_0x15478a,_0x50706c){return db['Dynamics365Account'][_0xad73('0x43')]({'where':{'id':_0x15478a[_0xad73('0x46')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x50706c,null))['then'](removeEntity(_0x50706c,null))[_0xad73('0x40')](handleError(_0x50706c,null));};exports[_0xad73('0x47')]=function(_0x1e412f,_0x3a5971,_0x3fb4da){var _0x36fd80={};var _0xcb6a6a={};var _0x3715af;var _0x49c661;return db[_0xad73('0x29')]['findOne']({'where':{'id':_0x1e412f[_0xad73('0x46')]['id']}})['then'](handleEntityNotFound(_0x3a5971,null))['then'](function(_0x23b016){if(_0x23b016){_0x3715af=_0x23b016;_0xcb6a6a[_0xad73('0x2d')]=_['keys'](db[_0xad73('0x48')][_0xad73('0x2a')]);_0xcb6a6a[_0xad73('0x32')]=_[_0xad73('0x42')](_0x1e412f[_0xad73('0x32')]);_0xcb6a6a[_0xad73('0x2f')]=_[_0xad73('0x31')](_0xcb6a6a[_0xad73('0x2d')],_0xcb6a6a[_0xad73('0x32')]);_0x36fd80[_0xad73('0x30')]=_['intersection'](_0xcb6a6a[_0xad73('0x2d')],qs['fields'](_0x1e412f[_0xad73('0x32')][_0xad73('0x33')]));_0x36fd80[_0xad73('0x30')]=_0x36fd80[_0xad73('0x30')]['length']?_0x36fd80[_0xad73('0x30')]:_0xcb6a6a['model'];_0x36fd80['order']=qs[_0xad73('0x37')](_0x1e412f['query'][_0xad73('0x37')]);_0x36fd80['where']=qs[_0xad73('0x2f')](_[_0xad73('0x39')](_0x1e412f[_0xad73('0x32')],_0xcb6a6a['filters']));if(_0x1e412f[_0xad73('0x32')][_0xad73('0x3a')]){_0x36fd80[_0xad73('0x38')]=_['merge'](_0x36fd80[_0xad73('0x38')],{'$or':_['map'](_0x36fd80['attributes'],function(_0x3ea6bf){var _0xad1d1={};_0xad1d1[_0x3ea6bf]={'$like':'%'+_0x1e412f['query']['filter']+'%'};return _0xad1d1;})});}_0x36fd80=_[_0xad73('0x3b')]({},_0x36fd80,_0x1e412f[_0xad73('0x49')]);return _0x3715af['getConfigurations'](_0x36fd80);}})['then'](function(_0x172a8a){if(_0x172a8a){_0x49c661=_0x172a8a[_0xad73('0x34')];if(!_0x1e412f[_0xad73('0x32')][_0xad73('0x4a')](_0xad73('0x35'))){_0x36fd80['limit']=qs['limit'](_0x1e412f[_0xad73('0x32')][_0xad73('0x1f')]);_0x36fd80[_0xad73('0x1d')]=qs[_0xad73('0x1d')](_0x1e412f[_0xad73('0x32')][_0xad73('0x1d')]);}return _0x3715af[_0xad73('0x47')](_0x36fd80);}})[_0xad73('0x25')](function(_0x2dc796){if(_0x2dc796){return _0x2dc796?{'count':_0x49c661,'rows':_0x2dc796}:null;}})[_0xad73('0x25')](respondWithResult(_0x3a5971,null))[_0xad73('0x40')](handleError(_0x3a5971,null));};exports['addConfiguration']=function(_0x540f44,_0x40bf28,_0x110d1b){if(_0x540f44[_0xad73('0x45')]['id']){delete _0x540f44[_0xad73('0x45')]['id'];}return db['Dynamics365Account']['findOne']({'where':{'id':_0x540f44[_0xad73('0x46')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x40bf28,null))[_0xad73('0x25')](function(_0x394978){if(_0x394978){_0x540f44[_0xad73('0x45')][_0xad73('0x4b')]=_0x394978['id'];_0x540f44[_0xad73('0x45')][_0xad73('0x4c')]=integrations[_0xad73('0x4d')](_0x540f44[_0xad73('0x45')][_0xad73('0x4e')],_0x540f44['body'][_0xad73('0x2b')]);_0x540f44[_0xad73('0x45')][_0xad73('0x4f')]=integrations[_0xad73('0x50')](_0x540f44[_0xad73('0x45')][_0xad73('0x4e')],_0x540f44[_0xad73('0x45')]['type']);return db[_0xad73('0x48')][_0xad73('0x44')](_0x540f44[_0xad73('0x45')],{'include':[{'model':db[_0xad73('0x51')],'as':_0xad73('0x4c')},{'model':db[_0xad73('0x51')],'as':'Descriptions'}]});}return null;})[_0xad73('0x25')](respondWithResult(_0x40bf28,null))[_0xad73('0x40')](handleError(_0x40bf28,null));};exports[_0xad73('0x52')]=function(_0x3bd9c4,_0x255011,_0x585c76){var _0x3741cb=_0x3bd9c4[_0xad73('0x32')][_0xad73('0x53')];var _0x3e713c=_0x3741cb===_0xad73('0x54')?_0xad73('0x55'):'PhoneCall';var _0x32581f='';var _0x28f6da='';var _0x362401='';var _0x41ddbe='';var _0x2fac84='';var _0xec1025='';var _0xb2324e='';var _0x2ef993='';var _0x5a1235=[_0xad73('0x56'),'description',_0xad73('0x57'),_0xad73('0x58'),_0xad73('0x59'),'subject',_0xad73('0x5a'),_0xad73('0x5b'),_0xad73('0x5c'),'phonecall_activity_parties'];var _0xc7b161=[_0xad73('0x5d'),_0xad73('0x5e'),_0xad73('0x5f'),_0xad73('0x60'),'contactidname',_0xad73('0x61'),_0xad73('0x62'),_0xad73('0x63'),'createdbyexternalpartyname',_0xad73('0x64'),_0xad73('0x65'),_0xad73('0x66'),_0xad73('0x67'),_0xad73('0x68'),_0xad73('0x69'),_0xad73('0x6a'),'customeridtype',_0xad73('0x6b'),'emailaddress',_0xad73('0x6c'),_0xad73('0x6d'),_0xad73('0x6e'),_0xad73('0x6f'),_0xad73('0x70'),_0xad73('0x71'),_0xad73('0x72'),'importsequencenumber',_0xad73('0x73'),_0xad73('0x74'),'lastonholdtime',_0xad73('0x75'),'modifiedbyexternalpartyname',_0xad73('0x76'),_0xad73('0x77'),_0xad73('0x78'),_0xad73('0x79'),_0xad73('0x7a'),_0xad73('0x7b'),_0xad73('0x7c'),_0xad73('0x7d'),_0xad73('0x7e'),_0xad73('0x7f'),_0xad73('0x80'),'owneridname','owneridtype',_0xad73('0x81'),_0xad73('0x82'),_0xad73('0x83'),_0xad73('0x84'),_0xad73('0x85'),_0xad73('0x86'),_0xad73('0x87'),_0xad73('0x88'),'resolvebykpiidname','responseby',_0xad73('0x89'),'responsiblecontactidyominame','sentimentvalue','slainvokedidname',_0xad73('0x8a'),_0xad73('0x8b'),_0xad73('0x8c'),_0xad73('0x8d'),_0xad73('0x8e'),_0xad73('0x8f'),_0xad73('0x90'),'transactioncurrencyidname',_0xad73('0x91'),_0xad73('0x92'),_0xad73('0x93')];var _0x243db2=_0x5a1235[_0xad73('0x94')](_0xc7b161);return db['Dynamics365Account'][_0xad73('0x95')]({'where':{'id':_0x3bd9c4[_0xad73('0x46')]['id']},'attributes':['id',_0xad73('0x96'),_0xad73('0x97'),'remoteUri',_0xad73('0x98'),_0xad73('0x99'),_0xad73('0x9a')]})[_0xad73('0x25')](handleEntityNotFound(_0x255011,null))['then'](function(_0x57b439){if(_0x57b439){_0x2ef993=_0x57b439[_0xad73('0x9b')];var _0x3d7bc2=_0x2ef993[_0xad73('0x9c')](-0x1);if(_0x3d7bc2==='/'){_0x2ef993=_0x2ef993['substring'](0x0,_0x2ef993[_0xad73('0x9d')](_0x3d7bc2));}_0xb2324e=util['format'](_0xad73('0x9e'),_0x2ef993);var _0x1a0ebd={'method':_0xad73('0x9f'),'uri':_0xad73('0xa0')+_0x57b439['tenantId']+_0xad73('0xa1'),'form':{'client_id':_0x57b439[_0xad73('0x99')],'resource':_0x2ef993,'username':_0x57b439[_0xad73('0x96')],'password':_0x57b439['password'],'grant_type':_0xad73('0x97'),'client_secret':_0x57b439[_0xad73('0x9a')]},'json':!![]};return rp(_0x1a0ebd);}})['then'](function(_0x4fd05e){_0xec1025=_0x4fd05e['access_token'];var _0x36f411={'method':_0xad73('0xa2'),'uri':encodeURI(_0xb2324e+_0xad73('0xa3')+_0x3e713c+'\x27'),'headers':{'Authorization':_0xad73('0xa4')+_0xec1025,'If-None-Match':null,'OData-Version':_0xad73('0xa5')},'json':!![]};return rp(_0x36f411);})['then'](function(_0x2bbed0){var _0x272c7a=_0x2bbed0['value'][0x0];var _0xf4b476=_0x272c7a[_0xad73('0xa6')];var _0xa5a6c0={'method':'GET','uri':_0xb2324e+_0xad73('0xa7')+_0xf4b476+_0xad73('0xa8'),'headers':{'Authorization':'Bearer\x20'+_0xec1025,'If-None-Match':null,'OData-Version':_0xad73('0xa5')},'json':!![]};return rp(_0xa5a6c0);})[_0xad73('0x25')](function(_0x47dbef){_0x32581f=_0x47dbef;_0x28f6da=_0x32581f['Attributes'];_0x28f6da=_['remove'](_0x28f6da,function(_0x2113f0){return!_0x243db2[_0xad73('0xa9')](_0x2113f0[_0xad73('0xaa')]);});var _0x424682=[];var _0x3fec24=[];_0x28f6da[_0xad73('0xab')](function(_0x50c19c){if(_0x50c19c[_0xad73('0xac')]){var _0x550dd2=_0x50c19c['@odata.type']['substring'](_0x50c19c[_0xad73('0xac')][_0xad73('0x9d')]('.')+0x1);if(_0x550dd2==='PicklistAttributeMetadata'){_0x424682[_0xad73('0xad')](getSelectList(_0xb2324e,_0x3741cb,_0x3fec24,_0x32581f[_0xad73('0xa6')],_0x50c19c[_0xad73('0xa6')],_0xec1025));}}});return Promise[_0xad73('0xae')](_0x424682);})[_0xad73('0x25')](function(_0x1f3113){_0x362401=_0x1f3113[0x0];var _0x33fe59=[];var _0x234187=[];_0x28f6da[_0xad73('0xab')](function(_0x82941a){if(!_[_0xad73('0xaf')](_0x82941a['@odata.type'])){var _0x375875=_0x82941a[_0xad73('0xac')]['substring'](_0x82941a['@odata.type'][_0xad73('0x9d')]('.')+0x1);if(_0x375875===_0xad73('0xb0')){_0x33fe59[_0xad73('0xad')](getBooleanList(_0xb2324e,_0x3741cb,_0x234187,_0x32581f[_0xad73('0xa6')],_0x82941a[_0xad73('0xa6')],_0xec1025));}}});return Promise['all'](_0x33fe59);})['then'](function(_0x311bf9){_0x41ddbe=_0x311bf9[0x0];var _0x193f73=[];var _0x5c0ddc=[];_0x28f6da[_0xad73('0xab')](function(_0x570e02){if(_0x570e02[_0xad73('0xac')]){var _0xe3411f=_0x570e02['@odata.type']['substring'](_0x570e02[_0xad73('0xac')][_0xad73('0x9d')]('.')+0x1);if(_0xe3411f===_0xad73('0xb1')||_0xe3411f==='DoubleAttributeMetadata'||_0xe3411f===_0xad73('0xb2')||_0xe3411f===_0xad73('0xb3')||_0xe3411f===_0xad73('0xb4')||_0xe3411f==='DateTimeAttributeMetadata'||_0xe3411f==='StatusAttributeMetadata'||_0xe3411f===_0xad73('0xb5')||_0xe3411f===_0xad73('0xb6')||_0xe3411f===_0xad73('0xb7')){_0x193f73[_0xad73('0xad')](getInputList(_0xb2324e,_0x3741cb,_0xe3411f,_0x5c0ddc,_0x32581f[_0xad73('0xa6')],_0x570e02[_0xad73('0xa6')],_0xec1025));}}});return Promise[_0xad73('0xae')](_0x193f73);})[_0xad73('0x25')](function(_0x4e2bb7){_0x2fac84=_0x4e2bb7[0x0];var _0x5513b0=_0x362401[_0xad73('0x94')](_0x41ddbe)[_0xad73('0x94')](_0x2fac84);var _0x62777b={'count':_0x5513b0[_0xad73('0x34')],'rows':_0x5513b0};return _0x62777b;})[_0xad73('0x25')](respondWithResult(_0x255011,null))[_0xad73('0x40')](function(_0x4fd5c8){var _0x2ee75d=_0x3bd9c4[_0xad73('0x32')]['test']?0x1f4:_0x4fd5c8[_0xad73('0xb8')]||0x1f4;logger[_0xad73('0xb9')](_0x4fd5c8[_0xad73('0xba')]);delete _0x4fd5c8[_0xad73('0x27')];if(_0x2ee75d===0x191){_0x2ee75d=0x190;}_0x255011[_0xad73('0x1a')](_0x2ee75d)[_0xad73('0xbb')](_0x3bd9c4[_0xad73('0x32')][_0xad73('0xbc')]?{'message':'Wrong\x20credentials','statusCode':_0x4fd5c8[_0xad73('0xb8')]}:_0x4fd5c8);});};function getSelectList(_0x3d9b47,_0x518dca,_0x1248d3,_0x33724f,_0x2a2c3a,_0x8609df){var _0x300f4d={'method':'GET','uri':_0x3d9b47+_0xad73('0xa7')+_0x33724f+_0xad73('0xbd')+_0x2a2c3a+')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?'+_0xad73('0xbe'),'headers':{'Authorization':_0xad73('0xa4')+_0x8609df,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x300f4d)[_0xad73('0x25')](function(_0x5d9f24){var _0x6ace40=[];var _0x21e58b=_0x5d9f24[_0xad73('0xbf')]['Options'];_0x21e58b[_0xad73('0xab')](function(_0x1b87ef){_0x6ace40['push']({'name':_0x1b87ef[_0xad73('0xc0')][_0xad73('0xc1')][_0xad73('0xc0')],'value':String(_0x1b87ef[_0xad73('0xc2')])});});var _0x57a849={'id':_0x518dca+'_'+_0x5d9f24[_0xad73('0xaa')],'name':_0x5d9f24[_0xad73('0xc3')][_0xad73('0xc1')][_0xad73('0xc0')],'custom':![],'options':_0x6ace40};_0x1248d3[_0xad73('0xad')](_0x57a849);return _0x1248d3;});}function getBooleanList(_0x195f6a,_0x5cc5ed,_0x435dba,_0x2a5c96,_0x4363ba,_0x39654e){var _0x424669={'method':_0xad73('0xa2'),'uri':_0x195f6a+_0xad73('0xa7')+_0x2a5c96+')/Attributes('+_0x4363ba+_0xad73('0xc4'),'headers':{'Authorization':_0xad73('0xa4')+_0x39654e,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x424669)[_0xad73('0x25')](function(_0x5bd6d8){var _0x376eab=[];_0x376eab[_0xad73('0xad')]({'name':_0x5bd6d8['OptionSet'][_0xad73('0xc5')][_0xad73('0xc0')][_0xad73('0xc1')][_0xad73('0xc0')],'value':_0xad73('0xc6')},{'name':_0x5bd6d8[_0xad73('0xbf')][_0xad73('0xc7')]['Label'][_0xad73('0xc1')][_0xad73('0xc0')],'value':_0xad73('0xc8')});var _0x46e9b6={'id':_0x5cc5ed+'_'+_0x5bd6d8['LogicalName'],'name':_0x5bd6d8[_0xad73('0xc3')][_0xad73('0xc1')]['Label'],'custom':![],'options':_0x376eab};_0x435dba[_0xad73('0xad')](_0x46e9b6);return _0x435dba;});}function getInputList(_0x41852c,_0xdadabc,_0x2e0468,_0x2b989a,_0x2dbde5,_0x32c6d7,_0x29e4f1){var _0x309f9d={'method':_0xad73('0xa2'),'uri':_0x41852c+_0xad73('0xa7')+_0x2dbde5+')/Attributes('+_0x32c6d7+_0xad73('0xc9')+_0x2e0468+_0xad73('0xca'),'headers':{'Authorization':_0xad73('0xa4')+_0x29e4f1,'If-None-Match':null,'OData-Version':_0xad73('0xa5')},'json':!![]};return rp(_0x309f9d)[_0xad73('0x25')](function(_0x5a5310){var _0x3d1896={'id':_0xdadabc+'_'+_0x5a5310['LogicalName'],'name':_0x5a5310[_0xad73('0xc3')]['UserLocalizedLabel']?_0x5a5310['DisplayName'][_0xad73('0xc1')][_0xad73('0xc0')]:_0x5a5310[_0xad73('0xaa')],'custom':![],'options':[]};_0x2b989a['push'](_0x3d1896);return _0x2b989a;});} \ No newline at end of file +var _0xf842=['hasOwnProperty','nolimit','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','intersection','options','catch','create','body','find','params','getConfigurations','Dynamics365Configuration','sort','addConfiguration','findOne','AccountId','Subjects','channel','Descriptions','getDescriptions','getFields','ticketType','incident','Incident','PhoneCall','title','description','customerid','ownerid','caseorigincode','subject','regardingobjectid','directioncode','accountidname','accountidyominame','actualserviceunits','billedserviceunits','contactidname','contractdetailidname','contractidname','createdbyexternalpartyname','createdbyyominame','createdon','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','entityimage_timestamp','entityimage_url','escalatedon','exchangerate','followupby','importsequencenumber','lastonholdtime','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','overriddencreatedon','owneridtype','owneridyominame','primarycontactidname','primarycontactidyominame','prioritycodename','productidname','productserialnumber','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slainvokedidname','slaname','statecode','statuscode','subjectidname','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','versionnumber','username','password','tenantId','clientId','clientSecret','remoteUri','slice','substring','lastIndexOf','format','%s/api/data/v9.0/','POST','https://login.microsoftonline.com/','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','4.0','Attributes','LogicalName','forEach','@odata.type','PicklistAttributeMetadata','push','all','isNil','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StateAttributeMetadata','DecimalAttributeMetadata','concat','statusCode','test','Wrong\x20credentials',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','Value','UserLocalizedLabel',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true','FalseOption','false',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','DisplayName','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','then','destroy','error','stack','send','map','Dynamics365Account','rawAttributes','type','key','model','name','keys','filters','attributes','fields','query','length'];(function(_0x1e6659,_0x1f860c){var _0x4d16e4=function(_0x21c05a){while(--_0x21c05a){_0x1e6659['push'](_0x1e6659['shift']());}};_0x4d16e4(++_0x1f860c);}(_0xf842,0x172));var _0x2f84=function(_0x4ce028,_0x526d4b){_0x4ce028=_0x4ce028-0x0;var _0x583d0c=_0xf842[_0x4ce028];return _0x583d0c;};'use strict';var emlformat=require(_0x2f84('0x0'));var rimraf=require(_0x2f84('0x1'));var zipdir=require(_0x2f84('0x2'));var jsonpatch=require(_0x2f84('0x3'));var rp=require('request-promise');var moment=require(_0x2f84('0x4'));var BPromise=require(_0x2f84('0x5'));var Mustache=require(_0x2f84('0x6'));var util=require(_0x2f84('0x7'));var path=require(_0x2f84('0x8'));var sox=require('sox');var csv=require(_0x2f84('0x9'));var ejs=require(_0x2f84('0xa'));var fs=require('fs');var fs_extra=require(_0x2f84('0xb'));var _=require('lodash');var squel=require(_0x2f84('0xc'));var crypto=require(_0x2f84('0xd'));var jsforce=require(_0x2f84('0xe'));var deskjs=require(_0x2f84('0xf'));var toCsv=require(_0x2f84('0x9'));var querystring=require(_0x2f84('0x10'));var Papa=require(_0x2f84('0x11'));var Redis=require(_0x2f84('0x12'));var authService=require(_0x2f84('0x13'));var qs=require(_0x2f84('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2f84('0x15'));var logger=require('../../config/logger')(_0x2f84('0x16'));var utils=require(_0x2f84('0x17'));var config=require(_0x2f84('0x18'));var licenseUtil=require(_0x2f84('0x19'));var db=require(_0x2f84('0x1a'))['db'];var integrations=require(_0x2f84('0x1b'));function respondWithStatusCode(_0x3acad7,_0x2f2c2d){_0x2f2c2d=_0x2f2c2d||0xcc;return function(_0x3b3f6c){if(_0x3b3f6c){return _0x3acad7[_0x2f84('0x1c')](_0x2f2c2d);}return _0x3acad7[_0x2f84('0x1d')](_0x2f2c2d)[_0x2f84('0x1e')]();};}function respondWithResult(_0x4a07a5,_0x489f51){_0x489f51=_0x489f51||0xc8;return function(_0x50d906){if(_0x50d906){return _0x4a07a5[_0x2f84('0x1d')](_0x489f51)[_0x2f84('0x1f')](_0x50d906);}};}function respondWithFilteredResult(_0x27cce2,_0x51e4af){return function(_0x41848c){if(_0x41848c){var _0x31958b=typeof _0x51e4af[_0x2f84('0x20')]==='undefined'&&typeof _0x51e4af[_0x2f84('0x21')]===_0x2f84('0x22');var _0xed58cb=_0x41848c[_0x2f84('0x23')];var _0x59b952=_0x31958b?0x0:_0x51e4af[_0x2f84('0x20')];var _0x51bdee=_0x31958b?_0x41848c[_0x2f84('0x23')]:_0x51e4af['offset']+_0x51e4af['limit'];var _0x121b88;if(_0x51bdee>=_0xed58cb){_0x51bdee=_0xed58cb;_0x121b88=0xc8;}else{_0x121b88=0xce;}_0x27cce2[_0x2f84('0x1d')](_0x121b88);return _0x27cce2[_0x2f84('0x24')](_0x2f84('0x25'),_0x59b952+'-'+_0x51bdee+'/'+_0xed58cb)[_0x2f84('0x1f')](_0x41848c);}return null;};}function patchUpdates(_0x4600af){return function(_0x4c45bb){try{jsonpatch['apply'](_0x4c45bb,_0x4600af,!![]);}catch(_0x381361){return BPromise[_0x2f84('0x26')](_0x381361);}return _0x4c45bb[_0x2f84('0x27')]();};}function saveUpdates(_0xc31d0a,_0x39ee8b){return function(_0x206e88){if(_0x206e88){return _0x206e88['update'](_0xc31d0a)[_0x2f84('0x28')](function(_0x5f4740){return _0x5f4740;});}return null;};}function removeEntity(_0x289efc,_0x50e8ff){return function(_0x2bbaa2){if(_0x2bbaa2){return _0x2bbaa2[_0x2f84('0x29')]()[_0x2f84('0x28')](function(){_0x289efc['status'](0xcc)[_0x2f84('0x1e')]();});}};}function handleEntityNotFound(_0x2f74c7,_0x29c4aa){return function(_0x362ae8){if(!_0x362ae8){_0x2f74c7[_0x2f84('0x1c')](0x194);}return _0x362ae8;};}function handleError(_0x3a04fa,_0x5435df){_0x5435df=_0x5435df||0x1f4;return function(_0x3f6e2d){logger[_0x2f84('0x2a')](_0x3f6e2d[_0x2f84('0x2b')]);if(_0x3f6e2d['name']){delete _0x3f6e2d['name'];}_0x3a04fa[_0x2f84('0x1d')](_0x5435df)[_0x2f84('0x2c')](_0x3f6e2d);};}exports['index']=function(_0x3cadc2,_0x1de657){var _0x4e193d={},_0x46d0db={},_0x5c56fb={'count':0x0,'rows':[]};var _0x3674e7=_[_0x2f84('0x2d')](db[_0x2f84('0x2e')][_0x2f84('0x2f')],function(_0x1e7e37){return{'name':_0x1e7e37['fieldName'],'type':_0x1e7e37[_0x2f84('0x30')][_0x2f84('0x31')]};});_0x46d0db[_0x2f84('0x32')]=_[_0x2f84('0x2d')](_0x3674e7,_0x2f84('0x33'));_0x46d0db['query']=_[_0x2f84('0x34')](_0x3cadc2['query']);_0x46d0db[_0x2f84('0x35')]=_['intersection'](_0x46d0db['model'],_0x46d0db['query']);_0x4e193d[_0x2f84('0x36')]=_['intersection'](_0x46d0db[_0x2f84('0x32')],qs[_0x2f84('0x37')](_0x3cadc2[_0x2f84('0x38')]['fields']));_0x4e193d['attributes']=_0x4e193d[_0x2f84('0x36')][_0x2f84('0x39')]?_0x4e193d['attributes']:_0x46d0db[_0x2f84('0x32')];if(!_0x3cadc2[_0x2f84('0x38')][_0x2f84('0x3a')](_0x2f84('0x3b'))){_0x4e193d[_0x2f84('0x21')]=qs[_0x2f84('0x21')](_0x3cadc2[_0x2f84('0x38')]['limit']);_0x4e193d[_0x2f84('0x20')]=qs[_0x2f84('0x20')](_0x3cadc2['query'][_0x2f84('0x20')]);}_0x4e193d['order']=qs['sort'](_0x3cadc2[_0x2f84('0x38')]['sort']);_0x4e193d[_0x2f84('0x3c')]=qs[_0x2f84('0x35')](_[_0x2f84('0x3d')](_0x3cadc2['query'],_0x46d0db[_0x2f84('0x35')]),_0x3674e7);if(_0x3cadc2[_0x2f84('0x38')][_0x2f84('0x3e')]){_0x4e193d[_0x2f84('0x3c')]=_[_0x2f84('0x3f')](_0x4e193d[_0x2f84('0x3c')],{'$or':_[_0x2f84('0x2d')](_0x3674e7,function(_0x1047e6){if(_0x1047e6[_0x2f84('0x30')]!==_0x2f84('0x40')){var _0x426caa={};_0x426caa[_0x1047e6[_0x2f84('0x33')]]={'$like':'%'+_0x3cadc2['query'][_0x2f84('0x3e')]+'%'};return _0x426caa;}})});}_0x4e193d=_[_0x2f84('0x3f')]({},_0x4e193d,_0x3cadc2['options']);var _0x4c64d4={'where':_0x4e193d[_0x2f84('0x3c')]};return db[_0x2f84('0x2e')][_0x2f84('0x23')](_0x4c64d4)[_0x2f84('0x28')](function(_0x1d0cca){_0x5c56fb['count']=_0x1d0cca;if(_0x3cadc2[_0x2f84('0x38')][_0x2f84('0x41')]){_0x4e193d[_0x2f84('0x42')]=[{'all':!![]}];}return db['Dynamics365Account'][_0x2f84('0x43')](_0x4e193d);})[_0x2f84('0x28')](function(_0x9bdb29){_0x5c56fb[_0x2f84('0x44')]=_0x9bdb29;return _0x5c56fb;})['then'](respondWithFilteredResult(_0x1de657,_0x4e193d))['catch'](handleError(_0x1de657,null));};exports[_0x2f84('0x45')]=function(_0x2efae2,_0x5a192f){var _0x2ea1e7={'raw':![],'where':{'id':_0x2efae2['params']['id']}},_0x3053cc={};_0x3053cc['model']=_[_0x2f84('0x34')](db['Dynamics365Account'][_0x2f84('0x2f')]);_0x3053cc[_0x2f84('0x38')]=_[_0x2f84('0x34')](_0x2efae2[_0x2f84('0x38')]);_0x3053cc[_0x2f84('0x35')]=_[_0x2f84('0x46')](_0x3053cc[_0x2f84('0x32')],_0x3053cc[_0x2f84('0x38')]);_0x2ea1e7['attributes']=_['intersection'](_0x3053cc[_0x2f84('0x32')],qs[_0x2f84('0x37')](_0x2efae2[_0x2f84('0x38')][_0x2f84('0x37')]));_0x2ea1e7[_0x2f84('0x36')]=_0x2ea1e7[_0x2f84('0x36')][_0x2f84('0x39')]?_0x2ea1e7[_0x2f84('0x36')]:_0x3053cc[_0x2f84('0x32')];if(_0x2efae2['query'][_0x2f84('0x41')]){_0x2ea1e7[_0x2f84('0x42')]=[{'all':!![]}];}_0x2ea1e7=_[_0x2f84('0x3f')]({},_0x2ea1e7,_0x2efae2[_0x2f84('0x47')]);return db[_0x2f84('0x2e')]['find'](_0x2ea1e7)[_0x2f84('0x28')](handleEntityNotFound(_0x5a192f,null))[_0x2f84('0x28')](respondWithResult(_0x5a192f,null))[_0x2f84('0x48')](handleError(_0x5a192f,null));};exports[_0x2f84('0x49')]=function(_0x4e5dba,_0x2e29fe){return db[_0x2f84('0x2e')]['create'](_0x4e5dba[_0x2f84('0x4a')],{})[_0x2f84('0x28')](respondWithResult(_0x2e29fe,0xc9))[_0x2f84('0x48')](handleError(_0x2e29fe,null));};exports['update']=function(_0x40a8e0,_0x1658b6){if(_0x40a8e0[_0x2f84('0x4a')]['id']){delete _0x40a8e0[_0x2f84('0x4a')]['id'];}return db[_0x2f84('0x2e')][_0x2f84('0x4b')]({'where':{'id':_0x40a8e0[_0x2f84('0x4c')]['id']}})['then'](handleEntityNotFound(_0x1658b6,null))[_0x2f84('0x28')](saveUpdates(_0x40a8e0[_0x2f84('0x4a')],null))[_0x2f84('0x28')](respondWithResult(_0x1658b6,null))[_0x2f84('0x48')](handleError(_0x1658b6,null));};exports[_0x2f84('0x29')]=function(_0x1ce832,_0x3bcab5){return db[_0x2f84('0x2e')][_0x2f84('0x4b')]({'where':{'id':_0x1ce832['params']['id']}})[_0x2f84('0x28')](handleEntityNotFound(_0x3bcab5,null))[_0x2f84('0x28')](removeEntity(_0x3bcab5,null))['catch'](handleError(_0x3bcab5,null));};exports[_0x2f84('0x4d')]=function(_0x3ec302,_0x3c651b,_0x3e4bad){var _0x3ddfaf={};var _0x3c54ad={};var _0x11185c;var _0x5d9311;return db['Dynamics365Account']['findOne']({'where':{'id':_0x3ec302[_0x2f84('0x4c')]['id']}})[_0x2f84('0x28')](handleEntityNotFound(_0x3c651b,null))[_0x2f84('0x28')](function(_0x1d5e80){if(_0x1d5e80){_0x11185c=_0x1d5e80;_0x3c54ad['model']=_[_0x2f84('0x34')](db[_0x2f84('0x4e')][_0x2f84('0x2f')]);_0x3c54ad[_0x2f84('0x38')]=_[_0x2f84('0x34')](_0x3ec302[_0x2f84('0x38')]);_0x3c54ad[_0x2f84('0x35')]=_[_0x2f84('0x46')](_0x3c54ad[_0x2f84('0x32')],_0x3c54ad[_0x2f84('0x38')]);_0x3ddfaf[_0x2f84('0x36')]=_['intersection'](_0x3c54ad[_0x2f84('0x32')],qs[_0x2f84('0x37')](_0x3ec302[_0x2f84('0x38')][_0x2f84('0x37')]));_0x3ddfaf[_0x2f84('0x36')]=_0x3ddfaf[_0x2f84('0x36')][_0x2f84('0x39')]?_0x3ddfaf[_0x2f84('0x36')]:_0x3c54ad['model'];_0x3ddfaf['order']=qs['sort'](_0x3ec302[_0x2f84('0x38')][_0x2f84('0x4f')]);_0x3ddfaf['where']=qs[_0x2f84('0x35')](_['pick'](_0x3ec302[_0x2f84('0x38')],_0x3c54ad[_0x2f84('0x35')]));if(_0x3ec302['query'][_0x2f84('0x3e')]){_0x3ddfaf[_0x2f84('0x3c')]=_[_0x2f84('0x3f')](_0x3ddfaf['where'],{'$or':_['map'](_0x3ddfaf['attributes'],function(_0xb27691){var _0x534bf7={};_0x534bf7[_0xb27691]={'$like':'%'+_0x3ec302[_0x2f84('0x38')][_0x2f84('0x3e')]+'%'};return _0x534bf7;})});}_0x3ddfaf=_['merge']({},_0x3ddfaf,_0x3ec302[_0x2f84('0x47')]);return _0x11185c[_0x2f84('0x4d')](_0x3ddfaf);}})['then'](function(_0x3b8834){if(_0x3b8834){_0x5d9311=_0x3b8834[_0x2f84('0x39')];if(!_0x3ec302[_0x2f84('0x38')][_0x2f84('0x3a')]('nolimit')){_0x3ddfaf[_0x2f84('0x21')]=qs[_0x2f84('0x21')](_0x3ec302[_0x2f84('0x38')][_0x2f84('0x21')]);_0x3ddfaf['offset']=qs[_0x2f84('0x20')](_0x3ec302[_0x2f84('0x38')]['offset']);}return _0x11185c[_0x2f84('0x4d')](_0x3ddfaf);}})[_0x2f84('0x28')](function(_0x33da0e){if(_0x33da0e){return _0x33da0e?{'count':_0x5d9311,'rows':_0x33da0e}:null;}})[_0x2f84('0x28')](respondWithResult(_0x3c651b,null))[_0x2f84('0x48')](handleError(_0x3c651b,null));};exports[_0x2f84('0x50')]=function(_0x19ec0a,_0x115efe,_0x42b27f){if(_0x19ec0a[_0x2f84('0x4a')]['id']){delete _0x19ec0a[_0x2f84('0x4a')]['id'];}return db[_0x2f84('0x2e')][_0x2f84('0x51')]({'where':{'id':_0x19ec0a[_0x2f84('0x4c')]['id']}})[_0x2f84('0x28')](handleEntityNotFound(_0x115efe,null))[_0x2f84('0x28')](function(_0x21e6a9){if(_0x21e6a9){_0x19ec0a['body'][_0x2f84('0x52')]=_0x21e6a9['id'];_0x19ec0a[_0x2f84('0x4a')][_0x2f84('0x53')]=integrations['getSubjects'](_0x19ec0a[_0x2f84('0x4a')][_0x2f84('0x54')],_0x19ec0a['body'][_0x2f84('0x30')]);_0x19ec0a[_0x2f84('0x4a')][_0x2f84('0x55')]=integrations[_0x2f84('0x56')](_0x19ec0a[_0x2f84('0x4a')][_0x2f84('0x54')],_0x19ec0a[_0x2f84('0x4a')][_0x2f84('0x30')]);return db[_0x2f84('0x4e')][_0x2f84('0x49')](_0x19ec0a['body'],{'include':[{'model':db['Dynamics365Field'],'as':'Subjects'},{'model':db['Dynamics365Field'],'as':_0x2f84('0x55')}]});}return null;})[_0x2f84('0x28')](respondWithResult(_0x115efe,null))['catch'](handleError(_0x115efe,null));};exports[_0x2f84('0x57')]=function(_0x42de7e,_0x94aae1,_0x312358){var _0x44ed24=_0x42de7e[_0x2f84('0x38')][_0x2f84('0x58')];var _0xcaa44c=_0x44ed24===_0x2f84('0x59')?_0x2f84('0x5a'):_0x2f84('0x5b');var _0x49e2c9='';var _0xee2ecc='';var _0x37dbab='';var _0x343a15='';var _0x523daa='';var _0x2a89d8='';var _0x6eabea='';var _0xa8ef33='';var _0x1719d9=[_0x2f84('0x5c'),_0x2f84('0x5d'),_0x2f84('0x5e'),_0x2f84('0x5f'),_0x2f84('0x60'),_0x2f84('0x61'),'phonenumber',_0x2f84('0x62'),_0x2f84('0x63'),'phonecall_activity_parties'];var _0x4d25f8=[_0x2f84('0x64'),_0x2f84('0x65'),_0x2f84('0x66'),_0x2f84('0x67'),_0x2f84('0x68'),'contactidyominame',_0x2f84('0x69'),_0x2f84('0x6a'),_0x2f84('0x6b'),'createdbyexternalpartyyominame','createdbyname',_0x2f84('0x6c'),_0x2f84('0x6d'),_0x2f84('0x6e'),_0x2f84('0x6f'),_0x2f84('0x70'),_0x2f84('0x71'),_0x2f84('0x72'),_0x2f84('0x73'),_0x2f84('0x74'),_0x2f84('0x75'),_0x2f84('0x76'),_0x2f84('0x77'),_0x2f84('0x78'),'firstresponsebykpiidname',_0x2f84('0x79'),_0x2f84('0x7a'),'influencescore','kbarticleidname',_0x2f84('0x7b'),'masteridname','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame',_0x2f84('0x7c'),_0x2f84('0x7d'),_0x2f84('0x7e'),_0x2f84('0x7f'),_0x2f84('0x80'),_0x2f84('0x81'),_0x2f84('0x82'),_0x2f84('0x83'),'onholdtime',_0x2f84('0x84'),'owneridname',_0x2f84('0x85'),_0x2f84('0x86'),'parentcaseidname',_0x2f84('0x87'),_0x2f84('0x88'),_0x2f84('0x89'),_0x2f84('0x8a'),_0x2f84('0x8b'),'resolveby',_0x2f84('0x8c'),_0x2f84('0x8d'),_0x2f84('0x8e'),'responsiblecontactidyominame',_0x2f84('0x8f'),_0x2f84('0x90'),_0x2f84('0x91'),'socialprofileidname',_0x2f84('0x92'),_0x2f84('0x93'),_0x2f84('0x94'),_0x2f84('0x95'),_0x2f84('0x96'),_0x2f84('0x97'),_0x2f84('0x98'),_0x2f84('0x99'),_0x2f84('0x9a')];var _0x3bddb3=_0x1719d9['concat'](_0x4d25f8);return db[_0x2f84('0x2e')][_0x2f84('0x51')]({'where':{'id':_0x42de7e['params']['id']},'attributes':['id',_0x2f84('0x9b'),_0x2f84('0x9c'),'remoteUri',_0x2f84('0x9d'),_0x2f84('0x9e'),_0x2f84('0x9f')]})[_0x2f84('0x28')](handleEntityNotFound(_0x94aae1,null))['then'](function(_0x5a0f9b){if(_0x5a0f9b){_0xa8ef33=_0x5a0f9b[_0x2f84('0xa0')];var _0x150883=_0xa8ef33[_0x2f84('0xa1')](-0x1);if(_0x150883==='/'){_0xa8ef33=_0xa8ef33[_0x2f84('0xa2')](0x0,_0xa8ef33[_0x2f84('0xa3')](_0x150883));}_0x6eabea=util[_0x2f84('0xa4')](_0x2f84('0xa5'),_0xa8ef33);var _0x315cd6={'method':_0x2f84('0xa6'),'uri':_0x2f84('0xa7')+_0x5a0f9b[_0x2f84('0x9d')]+_0x2f84('0xa8'),'form':{'client_id':_0x5a0f9b['clientId'],'resource':_0xa8ef33,'username':_0x5a0f9b['username'],'password':_0x5a0f9b['password'],'grant_type':_0x2f84('0x9c'),'client_secret':_0x5a0f9b[_0x2f84('0x9f')]},'json':!![]};return rp(_0x315cd6);}})[_0x2f84('0x28')](function(_0xb3516e){_0x2a89d8=_0xb3516e['access_token'];var _0x36ff8c={'method':_0x2f84('0xa9'),'uri':encodeURI(_0x6eabea+_0x2f84('0xaa')+_0xcaa44c+'\x27'),'headers':{'Authorization':_0x2f84('0xab')+_0x2a89d8,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x36ff8c);})[_0x2f84('0x28')](function(_0x1d2ea1){var _0x27d9d5=_0x1d2ea1[_0x2f84('0xac')][0x0];var _0x4645d4=_0x27d9d5[_0x2f84('0xad')];var _0x56e72f={'method':_0x2f84('0xa9'),'uri':_0x6eabea+_0x2f84('0xae')+_0x4645d4+_0x2f84('0xaf'),'headers':{'Authorization':_0x2f84('0xab')+_0x2a89d8,'If-None-Match':null,'OData-Version':_0x2f84('0xb0')},'json':!![]};return rp(_0x56e72f);})[_0x2f84('0x28')](function(_0x19aa02){_0x49e2c9=_0x19aa02;_0xee2ecc=_0x49e2c9[_0x2f84('0xb1')];_0xee2ecc=_['remove'](_0xee2ecc,function(_0x1e3702){return!_0x3bddb3['includes'](_0x1e3702[_0x2f84('0xb2')]);});var _0x1bb65e=[];var _0x36432b=[];_0xee2ecc[_0x2f84('0xb3')](function(_0x39b494){if(_0x39b494['@odata.type']){var _0x9e8630=_0x39b494[_0x2f84('0xb4')][_0x2f84('0xa2')](_0x39b494['@odata.type'][_0x2f84('0xa3')]('.')+0x1);if(_0x9e8630===_0x2f84('0xb5')){_0x1bb65e[_0x2f84('0xb6')](getSelectList(_0x6eabea,_0x44ed24,_0x36432b,_0x49e2c9[_0x2f84('0xad')],_0x39b494['MetadataId'],_0x2a89d8));}}});return Promise[_0x2f84('0xb7')](_0x1bb65e);})['then'](function(_0x3fe8db){_0x37dbab=_0x3fe8db[0x0];var _0x449cdc=[];var _0x44a9a9=[];_0xee2ecc[_0x2f84('0xb3')](function(_0x4e2f1a){if(!_[_0x2f84('0xb8')](_0x4e2f1a[_0x2f84('0xb4')])){var _0x5acf43=_0x4e2f1a['@odata.type'][_0x2f84('0xa2')](_0x4e2f1a[_0x2f84('0xb4')][_0x2f84('0xa3')]('.')+0x1);if(_0x5acf43===_0x2f84('0xb9')){_0x449cdc[_0x2f84('0xb6')](getBooleanList(_0x6eabea,_0x44ed24,_0x44a9a9,_0x49e2c9[_0x2f84('0xad')],_0x4e2f1a[_0x2f84('0xad')],_0x2a89d8));}}});return Promise[_0x2f84('0xb7')](_0x449cdc);})['then'](function(_0x48b53c){_0x343a15=_0x48b53c[0x0];var _0x4c5d2b=[];var _0x6be81e=[];_0xee2ecc[_0x2f84('0xb3')](function(_0x32fb92){if(_0x32fb92[_0x2f84('0xb4')]){var _0xdde948=_0x32fb92[_0x2f84('0xb4')][_0x2f84('0xa2')](_0x32fb92[_0x2f84('0xb4')]['lastIndexOf']('.')+0x1);if(_0xdde948===_0x2f84('0xba')||_0xdde948===_0x2f84('0xbb')||_0xdde948===_0x2f84('0xbc')||_0xdde948===_0x2f84('0xbd')||_0xdde948===_0x2f84('0xbe')||_0xdde948===_0x2f84('0xbf')||_0xdde948==='StatusAttributeMetadata'||_0xdde948==='EntityNameAttributeMetadata'||_0xdde948===_0x2f84('0xc0')||_0xdde948===_0x2f84('0xc1')){_0x4c5d2b[_0x2f84('0xb6')](getInputList(_0x6eabea,_0x44ed24,_0xdde948,_0x6be81e,_0x49e2c9[_0x2f84('0xad')],_0x32fb92[_0x2f84('0xad')],_0x2a89d8));}}});return Promise[_0x2f84('0xb7')](_0x4c5d2b);})[_0x2f84('0x28')](function(_0x1f3a7c){_0x523daa=_0x1f3a7c[0x0];var _0x2c968c=_0x37dbab[_0x2f84('0xc2')](_0x343a15)[_0x2f84('0xc2')](_0x523daa);var _0x1c4c78={'count':_0x2c968c[_0x2f84('0x39')],'rows':_0x2c968c};return _0x1c4c78;})[_0x2f84('0x28')](respondWithResult(_0x94aae1,null))[_0x2f84('0x48')](function(_0x1f00d8){var _0x4ab15e=_0x42de7e[_0x2f84('0x38')]['test']?0x1f4:_0x1f00d8[_0x2f84('0xc3')]||0x1f4;logger[_0x2f84('0x2a')](_0x1f00d8[_0x2f84('0x2b')]);delete _0x1f00d8[_0x2f84('0x33')];if(_0x4ab15e===0x191){_0x4ab15e=0x190;}_0x94aae1[_0x2f84('0x1d')](_0x4ab15e)[_0x2f84('0x2c')](_0x42de7e[_0x2f84('0x38')][_0x2f84('0xc4')]?{'message':_0x2f84('0xc5'),'statusCode':_0x1f00d8['statusCode']}:_0x1f00d8);});};function getSelectList(_0x21ed0b,_0x1a9c68,_0x7497d4,_0x2bcd72,_0x5def16,_0x52b96d){var _0x1d2561={'method':_0x2f84('0xa9'),'uri':_0x21ed0b+'EntityDefinitions('+_0x2bcd72+_0x2f84('0xc6')+_0x5def16+_0x2f84('0xc7')+_0x2f84('0xc8'),'headers':{'Authorization':'Bearer\x20'+_0x52b96d,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x1d2561)[_0x2f84('0x28')](function(_0x29bfff){var _0x31cb7e=[];var _0xca218=_0x29bfff[_0x2f84('0xc9')][_0x2f84('0xca')];_0xca218[_0x2f84('0xb3')](function(_0xf52939){_0x31cb7e[_0x2f84('0xb6')]({'name':_0xf52939[_0x2f84('0xcb')]['UserLocalizedLabel']['Label'],'value':String(_0xf52939[_0x2f84('0xcc')])});});var _0x5a336a={'id':_0x1a9c68+'_'+_0x29bfff[_0x2f84('0xb2')],'name':_0x29bfff['DisplayName'][_0x2f84('0xcd')][_0x2f84('0xcb')],'custom':![],'options':_0x31cb7e};_0x7497d4[_0x2f84('0xb6')](_0x5a336a);return _0x7497d4;});}function getBooleanList(_0x365c00,_0xa88ebe,_0x1f1771,_0x303086,_0x4ca9c1,_0x2419ba){var _0x3225b1={'method':'GET','uri':_0x365c00+_0x2f84('0xae')+_0x303086+_0x2f84('0xc6')+_0x4ca9c1+_0x2f84('0xce'),'headers':{'Authorization':'Bearer\x20'+_0x2419ba,'If-None-Match':null,'OData-Version':_0x2f84('0xb0')},'json':!![]};return rp(_0x3225b1)[_0x2f84('0x28')](function(_0x5dca1d){var _0x4a5423=[];_0x4a5423[_0x2f84('0xb6')]({'name':_0x5dca1d[_0x2f84('0xc9')][_0x2f84('0xcf')][_0x2f84('0xcb')][_0x2f84('0xcd')][_0x2f84('0xcb')],'value':_0x2f84('0xd0')},{'name':_0x5dca1d['OptionSet'][_0x2f84('0xd1')][_0x2f84('0xcb')][_0x2f84('0xcd')]['Label'],'value':_0x2f84('0xd2')});var _0x2eb043={'id':_0xa88ebe+'_'+_0x5dca1d[_0x2f84('0xb2')],'name':_0x5dca1d['DisplayName'][_0x2f84('0xcd')][_0x2f84('0xcb')],'custom':![],'options':_0x4a5423};_0x1f1771[_0x2f84('0xb6')](_0x2eb043);return _0x1f1771;});}function getInputList(_0x284a07,_0x2f07cc,_0x369602,_0xb7ebd5,_0x10c68a,_0x5b502d,_0x33e70b){var _0x3ed676={'method':_0x2f84('0xa9'),'uri':_0x284a07+_0x2f84('0xae')+_0x10c68a+_0x2f84('0xc6')+_0x5b502d+_0x2f84('0xd3')+_0x369602+_0x2f84('0xd4'),'headers':{'Authorization':_0x2f84('0xab')+_0x33e70b,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x3ed676)[_0x2f84('0x28')](function(_0x4e609b){var _0x13ae75={'id':_0x2f07cc+'_'+_0x4e609b['LogicalName'],'name':_0x4e609b[_0x2f84('0xd5')]['UserLocalizedLabel']?_0x4e609b['DisplayName'][_0x2f84('0xcd')][_0x2f84('0xcb')]:_0x4e609b[_0x2f84('0xb2')],'custom':![],'options':[]};_0xb7ebd5['push'](_0x13ae75);return _0xb7ebd5;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index bc3fff8..ceee834 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 _0xd8b0=['exports','Dynamics365Account','int_dynamics365_accounts','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x3afe57,_0x2f86d8){var _0x356d81=function(_0x465987){while(--_0x465987){_0x3afe57['push'](_0x3afe57['shift']());}};_0x356d81(++_0x2f86d8);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./intDynamics365Account.attributes');var integrations=require('../../components/integrations/configuration');module[_0x0d8b('0x7')]=function(_0x227c63,_0x39f43a){return _0x227c63['define'](_0x0d8b('0x8'),attributes,{'tableName':_0x0d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x4d3e82,_0x382255){var _0x2d47a9=function(_0x3750f8){while(--_0x3750f8){_0x4d3e82['push'](_0x4d3e82['shift']());}};_0x2d47a9(++_0x382255);}(_0x757a,0xde));var _0xa757=function(_0x4435b9,_0x23b298){_0x4435b9=_0x4435b9-0x0;var _0x31af09=_0x757a[_0x4435b9];return _0x31af09;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'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 1492a64..5796eb6 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 _0xba48=['where','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Dynamics365Account,\x20%s,\x20%s','result','catch','Dynamics365Account','options','raw','attributes','limit','include','map','model','GetDynamics365Account','debug','ShowDynamics365Account','find'];(function(_0x25551b,_0x2a6634){var _0x246f95=function(_0x4435cd){while(--_0x4435cd){_0x25551b['push'](_0x25551b['shift']());}};_0x246f95(++_0x2a6634);}(_0xba48,0x1c8));var _0x8ba4=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0xba48[_0xd1d19a];return _0x52a79d;};'use strict';var _=require(_0x8ba4('0x0'));var util=require(_0x8ba4('0x1'));var moment=require(_0x8ba4('0x2'));var BPromise=require(_0x8ba4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8ba4('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ba4('0x5'));var logger=require(_0x8ba4('0x6'))(_0x8ba4('0x7'));var config=require(_0x8ba4('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ba4('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5208cb,_0x2bbb62,_0x51079e){return new BPromise(function(_0x2f7b11,_0x499259){return client[_0x8ba4('0xa')](_0x5208cb,_0x51079e)[_0x8ba4('0xb')](function(_0x560261){logger[_0x8ba4('0xc')]('Dynamics365Account,\x20%s,\x20%s',_0x2bbb62,_0x8ba4('0xd'));logger['debug'](_0x8ba4('0xe'),_0x2bbb62,_0x8ba4('0xd'),JSON[_0x8ba4('0xf')](_0x560261));if(_0x560261[_0x8ba4('0x10')]){if(_0x560261[_0x8ba4('0x10')][_0x8ba4('0x11')]===0x1f4){logger['error']('Dynamics365Account,\x20%s,\x20%s',_0x2bbb62,_0x560261[_0x8ba4('0x10')]['message']);return _0x499259(_0x560261[_0x8ba4('0x10')][_0x8ba4('0x12')]);}logger[_0x8ba4('0x10')]('Dynamics365Account,\x20%s,\x20%s',_0x2bbb62,_0x560261[_0x8ba4('0x10')][_0x8ba4('0x12')]);return _0x2f7b11(_0x560261[_0x8ba4('0x10')][_0x8ba4('0x12')]);}else{logger[_0x8ba4('0xc')](_0x8ba4('0x13'),_0x2bbb62,_0x8ba4('0xd'));_0x2f7b11(_0x560261[_0x8ba4('0x14')]['message']);}})[_0x8ba4('0x15')](function(_0x426f90){logger[_0x8ba4('0x10')](_0x8ba4('0x13'),_0x2bbb62,_0x426f90);_0x499259(_0x426f90);});});}exports['GetDynamics365Account']=function(_0x3f1345){var _0x1afc00=this;return new Promise(function(_0x644417,_0x145126){return db[_0x8ba4('0x16')]['findAll']({'raw':_0x3f1345[_0x8ba4('0x17')]?_0x3f1345[_0x8ba4('0x17')][_0x8ba4('0x18')]===undefined?!![]:![]:!![],'where':_0x3f1345[_0x8ba4('0x17')]?_0x3f1345['options']['where']||null:null,'attributes':_0x3f1345[_0x8ba4('0x17')]?_0x3f1345[_0x8ba4('0x17')][_0x8ba4('0x19')]||null:null,'limit':_0x3f1345[_0x8ba4('0x17')]?_0x3f1345[_0x8ba4('0x17')][_0x8ba4('0x1a')]||null:null,'include':_0x3f1345[_0x8ba4('0x17')]?_0x3f1345[_0x8ba4('0x17')][_0x8ba4('0x1b')]?_[_0x8ba4('0x1c')](_0x3f1345['options'][_0x8ba4('0x1b')],function(_0x54ed42){return{'model':db[_0x54ed42[_0x8ba4('0x1d')]],'as':_0x54ed42['as'],'attributes':_0x54ed42[_0x8ba4('0x19')],'include':_0x54ed42['include']?_[_0x8ba4('0x1c')](_0x54ed42['include'],function(_0x1e7f46){return{'model':db[_0x1e7f46[_0x8ba4('0x1d')]],'as':_0x1e7f46['as'],'attributes':_0x1e7f46[_0x8ba4('0x19')],'include':_0x1e7f46['include']?_['map'](_0x1e7f46[_0x8ba4('0x1b')],function(_0xc98988){return{'model':db[_0xc98988[_0x8ba4('0x1d')]],'as':_0xc98988['as'],'attributes':_0xc98988['attributes']};}):[]};}):[]};}):[]:[]})[_0x8ba4('0xb')](function(_0x2bfd29){logger['info'](_0x8ba4('0x1e'),_0x3f1345);logger[_0x8ba4('0x1f')](_0x8ba4('0x1e'),_0x3f1345,JSON[_0x8ba4('0xf')](_0x2bfd29));_0x644417(_0x2bfd29);})[_0x8ba4('0x15')](function(_0x364386){logger[_0x8ba4('0x10')](_0x8ba4('0x1e'),_0x364386[_0x8ba4('0x12')],_0x3f1345);_0x145126(_0x1afc00[_0x8ba4('0x10')](0x1f4,_0x364386['message']));});});};exports[_0x8ba4('0x20')]=function(_0x40535b){var _0x4b4fe6=this;return new Promise(function(_0x124d24,_0x218eb7){return db[_0x8ba4('0x16')][_0x8ba4('0x21')]({'raw':_0x40535b[_0x8ba4('0x17')]?_0x40535b[_0x8ba4('0x17')][_0x8ba4('0x18')]===undefined?!![]:![]:!![],'where':_0x40535b[_0x8ba4('0x17')]?_0x40535b['options'][_0x8ba4('0x22')]||null:null,'attributes':_0x40535b[_0x8ba4('0x17')]?_0x40535b[_0x8ba4('0x17')][_0x8ba4('0x19')]||null:null,'include':_0x40535b[_0x8ba4('0x17')]?_0x40535b[_0x8ba4('0x17')][_0x8ba4('0x1b')]?_[_0x8ba4('0x1c')](_0x40535b[_0x8ba4('0x17')][_0x8ba4('0x1b')],function(_0x5c7442){return{'model':db[_0x5c7442[_0x8ba4('0x1d')]],'as':_0x5c7442['as'],'attributes':_0x5c7442[_0x8ba4('0x19')],'include':_0x5c7442['include']?_[_0x8ba4('0x1c')](_0x5c7442['include'],function(_0x3cc25f){return{'model':db[_0x3cc25f[_0x8ba4('0x1d')]],'as':_0x3cc25f['as'],'attributes':_0x3cc25f['attributes'],'include':_0x3cc25f[_0x8ba4('0x1b')]?_['map'](_0x3cc25f[_0x8ba4('0x1b')],function(_0x513461){return{'model':db[_0x513461['model']],'as':_0x513461['as'],'attributes':_0x513461['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x6c7478){logger['info']('ShowDynamics365Account',_0x40535b);logger['debug']('ShowDynamics365Account',_0x40535b,JSON[_0x8ba4('0xf')](_0x6c7478));_0x124d24(_0x6c7478);})['catch'](function(_0x381a90){logger[_0x8ba4('0x10')](_0x8ba4('0x20'),_0x381a90[_0x8ba4('0x12')],_0x40535b);_0x218eb7(_0x4b4fe6['error'](0x1f4,_0x381a90[_0x8ba4('0x12')]));});});}; \ No newline at end of file +var _0xef34=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Account,\x20%s,\x20%s,\x20%s','error','code','message','GetDynamics365Account','findAll','options','raw','where','attributes','include','map','model','stringify','catch','ShowDynamics365Account','find','lodash','util','bluebird','randomstring'];(function(_0x638731,_0x3881f5){var _0x39c57e=function(_0x71ac74){while(--_0x71ac74){_0x638731['push'](_0x638731['shift']());}};_0x39c57e(++_0x3881f5);}(_0xef34,0xa6));var _0x4ef3=function(_0x35b62f,_0x5e7bb9){_0x35b62f=_0x35b62f-0x0;var _0x3776d1=_0xef34[_0x35b62f];return _0x3776d1;};'use strict';var _=require(_0x4ef3('0x0'));var util=require(_0x4ef3('0x1'));var moment=require('moment');var BPromise=require(_0x4ef3('0x2'));var rs=require(_0x4ef3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ef3('0x4'))['db'];var utils=require(_0x4ef3('0x5'));var logger=require(_0x4ef3('0x6'))(_0x4ef3('0x7'));var config=require(_0x4ef3('0x8'));var jayson=require(_0x4ef3('0x9'));var client=jayson[_0x4ef3('0xa')][_0x4ef3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4bbe53,_0x21956f,_0x4bb6a4){return new BPromise(function(_0x569b30,_0x24dfbd){return client['request'](_0x4bbe53,_0x4bb6a4)[_0x4ef3('0xc')](function(_0x35a0b1){logger[_0x4ef3('0xd')](_0x4ef3('0xe'),_0x21956f,_0x4ef3('0xf'));logger[_0x4ef3('0x10')](_0x4ef3('0x11'),_0x21956f,_0x4ef3('0xf'),JSON['stringify'](_0x35a0b1));if(_0x35a0b1[_0x4ef3('0x12')]){if(_0x35a0b1['error'][_0x4ef3('0x13')]===0x1f4){logger['error'](_0x4ef3('0xe'),_0x21956f,_0x35a0b1[_0x4ef3('0x12')][_0x4ef3('0x14')]);return _0x24dfbd(_0x35a0b1[_0x4ef3('0x12')][_0x4ef3('0x14')]);}logger['error'](_0x4ef3('0xe'),_0x21956f,_0x35a0b1[_0x4ef3('0x12')][_0x4ef3('0x14')]);return _0x569b30(_0x35a0b1[_0x4ef3('0x12')]['message']);}else{logger[_0x4ef3('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x21956f,_0x4ef3('0xf'));_0x569b30(_0x35a0b1['result'][_0x4ef3('0x14')]);}})['catch'](function(_0x375681){logger['error'](_0x4ef3('0xe'),_0x21956f,_0x375681);_0x24dfbd(_0x375681);});});}exports[_0x4ef3('0x15')]=function(_0x30869f){var _0x2dab1f=this;return new Promise(function(_0x17087c,_0x36c4ce){return db['Dynamics365Account'][_0x4ef3('0x16')]({'raw':_0x30869f[_0x4ef3('0x17')]?_0x30869f[_0x4ef3('0x17')][_0x4ef3('0x18')]===undefined?!![]:![]:!![],'where':_0x30869f[_0x4ef3('0x17')]?_0x30869f['options'][_0x4ef3('0x19')]||null:null,'attributes':_0x30869f[_0x4ef3('0x17')]?_0x30869f[_0x4ef3('0x17')][_0x4ef3('0x1a')]||null:null,'limit':_0x30869f[_0x4ef3('0x17')]?_0x30869f[_0x4ef3('0x17')]['limit']||null:null,'include':_0x30869f[_0x4ef3('0x17')]?_0x30869f[_0x4ef3('0x17')][_0x4ef3('0x1b')]?_[_0x4ef3('0x1c')](_0x30869f[_0x4ef3('0x17')][_0x4ef3('0x1b')],function(_0x5603c2){return{'model':db[_0x5603c2['model']],'as':_0x5603c2['as'],'attributes':_0x5603c2[_0x4ef3('0x1a')],'include':_0x5603c2['include']?_['map'](_0x5603c2[_0x4ef3('0x1b')],function(_0x2cc748){return{'model':db[_0x2cc748['model']],'as':_0x2cc748['as'],'attributes':_0x2cc748['attributes'],'include':_0x2cc748['include']?_[_0x4ef3('0x1c')](_0x2cc748['include'],function(_0xd18f30){return{'model':db[_0xd18f30[_0x4ef3('0x1d')]],'as':_0xd18f30['as'],'attributes':_0xd18f30[_0x4ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4ef3('0xc')](function(_0x47e160){logger[_0x4ef3('0xd')]('GetDynamics365Account',_0x30869f);logger[_0x4ef3('0x10')](_0x4ef3('0x15'),_0x30869f,JSON[_0x4ef3('0x1e')](_0x47e160));_0x17087c(_0x47e160);})[_0x4ef3('0x1f')](function(_0x51537a){logger['error']('GetDynamics365Account',_0x51537a[_0x4ef3('0x14')],_0x30869f);_0x36c4ce(_0x2dab1f[_0x4ef3('0x12')](0x1f4,_0x51537a['message']));});});};exports[_0x4ef3('0x20')]=function(_0x46c94f){var _0x41e981=this;return new Promise(function(_0x820a57,_0x27b4e8){return db['Dynamics365Account'][_0x4ef3('0x21')]({'raw':_0x46c94f['options']?_0x46c94f['options']['raw']===undefined?!![]:![]:!![],'where':_0x46c94f[_0x4ef3('0x17')]?_0x46c94f[_0x4ef3('0x17')]['where']||null:null,'attributes':_0x46c94f[_0x4ef3('0x17')]?_0x46c94f[_0x4ef3('0x17')][_0x4ef3('0x1a')]||null:null,'include':_0x46c94f['options']?_0x46c94f[_0x4ef3('0x17')][_0x4ef3('0x1b')]?_[_0x4ef3('0x1c')](_0x46c94f[_0x4ef3('0x17')][_0x4ef3('0x1b')],function(_0x37603d){return{'model':db[_0x37603d[_0x4ef3('0x1d')]],'as':_0x37603d['as'],'attributes':_0x37603d[_0x4ef3('0x1a')],'include':_0x37603d[_0x4ef3('0x1b')]?_[_0x4ef3('0x1c')](_0x37603d[_0x4ef3('0x1b')],function(_0x13569f){return{'model':db[_0x13569f[_0x4ef3('0x1d')]],'as':_0x13569f['as'],'attributes':_0x13569f[_0x4ef3('0x1a')],'include':_0x13569f[_0x4ef3('0x1b')]?_[_0x4ef3('0x1c')](_0x13569f[_0x4ef3('0x1b')],function(_0x86d4d){return{'model':db[_0x86d4d[_0x4ef3('0x1d')]],'as':_0x86d4d['as'],'attributes':_0x86d4d[_0x4ef3('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4ef3('0xc')](function(_0x3215b9){logger[_0x4ef3('0xd')](_0x4ef3('0x20'),_0x46c94f);logger[_0x4ef3('0x10')](_0x4ef3('0x20'),_0x46c94f,JSON['stringify'](_0x3215b9));_0x820a57(_0x3215b9);})['catch'](function(_0x30f2bf){logger[_0x4ef3('0x12')]('ShowDynamics365Account',_0x30f2bf[_0x4ef3('0x14')],_0x46c94f);_0x27b4e8(_0x41e981[_0x4ef3('0x12')](0x1f4,_0x30f2bf[_0x4ef3('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index befd6cf..f3712ad 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 _0x18f3=['/:id/fields','isAuthenticated','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','/:id','destroy','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./intDynamics365Configuration.controller','get','index','show'];(function(_0x47604d,_0x15a014){var _0x388e4c=function(_0x42a446){while(--_0x42a446){_0x47604d['push'](_0x47604d['shift']());}};_0x388e4c(++_0x15a014);}(_0x18f3,0x19f));var _0x318f=function(_0x484e36,_0x4482d8){_0x484e36=_0x484e36-0x0;var _0xafc85d=_0x18f3[_0x484e36];return _0xafc85d;};'use strict';var multer=require('multer');var util=require(_0x318f('0x0'));var path=require(_0x318f('0x1'));var timeout=require(_0x318f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x318f('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x318f('0x4'));var config=require(_0x318f('0x5'));var controller=require(_0x318f('0x6'));router[_0x318f('0x7')]('/',auth['isAuthenticated'](),controller[_0x318f('0x8')]);router[_0x318f('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x318f('0x9')]);router['get'](_0x318f('0xa'),auth[_0x318f('0xb')](),controller[_0x318f('0xc')]);router[_0x318f('0x7')](_0x318f('0xd'),auth[_0x318f('0xb')](),controller[_0x318f('0xe')]);router[_0x318f('0x7')](_0x318f('0xf'),auth[_0x318f('0xb')](),controller[_0x318f('0x10')]);router[_0x318f('0x11')]('/',auth[_0x318f('0xb')](),controller[_0x318f('0x12')]);router[_0x318f('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x318f('0x14')]);router[_0x318f('0x15')](_0x318f('0x16'),auth[_0x318f('0xb')](),controller[_0x318f('0x17')]);module[_0x318f('0x18')]=router; \ No newline at end of file +var _0xdd04=['./intDynamics365Configuration.controller','get','index','/:id','isAuthenticated','/:id/fields','getFields','getSubjects','getDescriptions','post','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x111e94,_0x31c837){var _0x3de107=function(_0x65bd1e){while(--_0x65bd1e){_0x111e94['push'](_0x111e94['shift']());}};_0x3de107(++_0x31c837);}(_0xdd04,0x15f));var _0x4dd0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdd04[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x4dd0('0x0'));var util=require(_0x4dd0('0x1'));var path=require('path');var timeout=require(_0x4dd0('0x2'));var express=require(_0x4dd0('0x3'));var router=express[_0x4dd0('0x4')]();var fs_extra=require(_0x4dd0('0x5'));var auth=require(_0x4dd0('0x6'));var interaction=require(_0x4dd0('0x7'));var config=require(_0x4dd0('0x8'));var controller=require(_0x4dd0('0x9'));router[_0x4dd0('0xa')]('/',auth['isAuthenticated'](),controller[_0x4dd0('0xb')]);router['get'](_0x4dd0('0xc'),auth[_0x4dd0('0xd')](),controller['show']);router[_0x4dd0('0xa')](_0x4dd0('0xe'),auth[_0x4dd0('0xd')](),controller[_0x4dd0('0xf')]);router[_0x4dd0('0xa')]('/:id/subjects',auth[_0x4dd0('0xd')](),controller[_0x4dd0('0x10')]);router[_0x4dd0('0xa')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x4dd0('0x11')]);router[_0x4dd0('0x12')]('/',auth[_0x4dd0('0xd')](),controller['create']);router[_0x4dd0('0x13')](_0x4dd0('0xc'),auth[_0x4dd0('0xd')](),controller[_0x4dd0('0x14')]);router[_0x4dd0('0x15')]('/:id',auth[_0x4dd0('0xd')](),controller[_0x4dd0('0x16')]);module[_0x4dd0('0x17')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index 2f6d7fd..d44b73f 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 _0xd803=['exports','ENUM','incident','phonecall'];(function(_0x395ab2,_0x1d85db){var _0x790980=function(_0x367fd9){while(--_0x367fd9){_0x395ab2['push'](_0x395ab2['shift']());}};_0x790980(++_0x1d85db);}(_0xd803,0x1ec));var _0x3d80=function(_0x120ab6,_0x65fbd6){_0x120ab6=_0x120ab6-0x0;var _0x4ab62f=_0xd803[_0x120ab6];return _0x4ab62f;};'use strict';var Sequelize=require('sequelize');module[_0x3d80('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x3d80('0x1')](_0x3d80('0x2'),_0x3d80('0x3')),'defaultValue':'incident'}}; \ No newline at end of file +var _0xcca0=['STRING','ENUM','incident','phonecall','sequelize','exports'];(function(_0x10dc20,_0x53b0ca){var _0x45c996=function(_0x5edcac){while(--_0x5edcac){_0x10dc20['push'](_0x10dc20['shift']());}};_0x45c996(++_0x53b0ca);}(_0xcca0,0xee));var _0x0cca=function(_0x1f5401,_0x197084){_0x1f5401=_0x1f5401-0x0;var _0xc21de5=_0xcca0[_0x1f5401];return _0xc21de5;};'use strict';var Sequelize=require(_0x0cca('0x0'));module[_0x0cca('0x1')]={'name':{'type':Sequelize[_0x0cca('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x0cca('0x3')](_0x0cca('0x4'),_0x0cca('0x5')),'defaultValue':_0x0cca('0x4')}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index bffebdb..e4cace3 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 _0x9a0c=['rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','create','update','body','find','params','findOne','order','pick','getFields','getSubjects','Dynamics365Field','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','end','error','name','index','Dynamics365Configuration'];(function(_0x57b8d1,_0x19b0a5){var _0xc26441=function(_0x70b85d){while(--_0x70b85d){_0x57b8d1['push'](_0x57b8d1['shift']());}};_0xc26441(++_0x19b0a5);}(_0x9a0c,0x15e));var _0xc9a0=function(_0x59994a,_0x41acde){_0x59994a=_0x59994a-0x0;var _0x398373=_0x9a0c[_0x59994a];return _0x398373;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc9a0('0x0'));var zipdir=require(_0xc9a0('0x1'));var jsonpatch=require(_0xc9a0('0x2'));var rp=require(_0xc9a0('0x3'));var moment=require(_0xc9a0('0x4'));var BPromise=require(_0xc9a0('0x5'));var Mustache=require('mustache');var util=require(_0xc9a0('0x6'));var path=require('path');var sox=require(_0xc9a0('0x7'));var csv=require('to-csv');var ejs=require(_0xc9a0('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc9a0('0x9'));var squel=require(_0xc9a0('0xa'));var crypto=require(_0xc9a0('0xb'));var jsforce=require(_0xc9a0('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xc9a0('0xd'));var querystring=require(_0xc9a0('0xe'));var Papa=require(_0xc9a0('0xf'));var Redis=require('ioredis');var authService=require(_0xc9a0('0x10'));var qs=require(_0xc9a0('0x11'));var as=require(_0xc9a0('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc9a0('0x13'))(_0xc9a0('0x14'));var utils=require('../../config/utils');var config=require(_0xc9a0('0x15'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xc8ae34,_0x38dcda){_0x38dcda=_0x38dcda||0xcc;return function(_0x2fae90){if(_0x2fae90){return _0xc8ae34[_0xc9a0('0x16')](_0x38dcda);}return _0xc8ae34[_0xc9a0('0x17')](_0x38dcda)['end']();};}function respondWithResult(_0x7b290c,_0x1c9f7f){_0x1c9f7f=_0x1c9f7f||0xc8;return function(_0x10e940){if(_0x10e940){return _0x7b290c[_0xc9a0('0x17')](_0x1c9f7f)[_0xc9a0('0x18')](_0x10e940);}};}function respondWithFilteredResult(_0x380afa,_0x56ab6c){return function(_0x2e595d){if(_0x2e595d){var _0x4f6f45=typeof _0x56ab6c[_0xc9a0('0x19')]===_0xc9a0('0x1a')&&typeof _0x56ab6c[_0xc9a0('0x1b')]===_0xc9a0('0x1a');var _0x38c48a=_0x2e595d['count'];var _0x20629c=_0x4f6f45?0x0:_0x56ab6c[_0xc9a0('0x19')];var _0x22174d=_0x4f6f45?_0x2e595d[_0xc9a0('0x1c')]:_0x56ab6c[_0xc9a0('0x19')]+_0x56ab6c[_0xc9a0('0x1b')];var _0x46c383;if(_0x22174d>=_0x38c48a){_0x22174d=_0x38c48a;_0x46c383=0xc8;}else{_0x46c383=0xce;}_0x380afa[_0xc9a0('0x17')](_0x46c383);return _0x380afa[_0xc9a0('0x1d')](_0xc9a0('0x1e'),_0x20629c+'-'+_0x22174d+'/'+_0x38c48a)[_0xc9a0('0x18')](_0x2e595d);}return null;};}function patchUpdates(_0x78254b){return function(_0x387d82){try{jsonpatch['apply'](_0x387d82,_0x78254b,!![]);}catch(_0x149d25){return BPromise[_0xc9a0('0x1f')](_0x149d25);}return _0x387d82[_0xc9a0('0x20')]();};}function saveUpdates(_0x53eff7,_0x4ad614){return function(_0x1dbd21){if(_0x1dbd21){return _0x1dbd21['update'](_0x53eff7)[_0xc9a0('0x21')](function(_0x4a8f0c){return _0x4a8f0c;});}return null;};}function removeEntity(_0x3cccbb,_0x3654ca){return function(_0xd4c79b){if(_0xd4c79b){return _0xd4c79b[_0xc9a0('0x22')]()[_0xc9a0('0x21')](function(){_0x3cccbb[_0xc9a0('0x17')](0xcc)[_0xc9a0('0x23')]();});}};}function handleEntityNotFound(_0x173520,_0x2fde22){return function(_0x4be286){if(!_0x4be286){_0x173520[_0xc9a0('0x16')](0x194);}return _0x4be286;};}function handleError(_0x554589,_0x37e5c5){_0x37e5c5=_0x37e5c5||0x1f4;return function(_0x1803ba){logger[_0xc9a0('0x24')](_0x1803ba['stack']);if(_0x1803ba['name']){delete _0x1803ba[_0xc9a0('0x25')];}_0x554589[_0xc9a0('0x17')](_0x37e5c5)['send'](_0x1803ba);};}exports[_0xc9a0('0x26')]=function(_0x4c596a,_0x1df478){var _0x143b4d={},_0x2559a6={},_0x15a6f5={'count':0x0,'rows':[]};var _0x328f79=_['map'](db[_0xc9a0('0x27')][_0xc9a0('0x28')],function(_0x255309){return{'name':_0x255309[_0xc9a0('0x29')],'type':_0x255309[_0xc9a0('0x2a')][_0xc9a0('0x2b')]};});_0x2559a6[_0xc9a0('0x2c')]=_[_0xc9a0('0x2d')](_0x328f79,_0xc9a0('0x25'));_0x2559a6[_0xc9a0('0x2e')]=_[_0xc9a0('0x2f')](_0x4c596a[_0xc9a0('0x2e')]);_0x2559a6[_0xc9a0('0x30')]=_[_0xc9a0('0x31')](_0x2559a6[_0xc9a0('0x2c')],_0x2559a6[_0xc9a0('0x2e')]);_0x143b4d[_0xc9a0('0x32')]=_['intersection'](_0x2559a6[_0xc9a0('0x2c')],qs['fields'](_0x4c596a[_0xc9a0('0x2e')][_0xc9a0('0x33')]));_0x143b4d[_0xc9a0('0x32')]=_0x143b4d[_0xc9a0('0x32')][_0xc9a0('0x34')]?_0x143b4d[_0xc9a0('0x32')]:_0x2559a6['model'];if(!_0x4c596a[_0xc9a0('0x2e')][_0xc9a0('0x35')](_0xc9a0('0x36'))){_0x143b4d[_0xc9a0('0x1b')]=qs[_0xc9a0('0x1b')](_0x4c596a[_0xc9a0('0x2e')][_0xc9a0('0x1b')]);_0x143b4d[_0xc9a0('0x19')]=qs[_0xc9a0('0x19')](_0x4c596a[_0xc9a0('0x2e')][_0xc9a0('0x19')]);}_0x143b4d['order']=qs[_0xc9a0('0x37')](_0x4c596a['query']['sort']);_0x143b4d[_0xc9a0('0x38')]=qs[_0xc9a0('0x30')](_['pick'](_0x4c596a[_0xc9a0('0x2e')],_0x2559a6[_0xc9a0('0x30')]),_0x328f79);if(_0x4c596a[_0xc9a0('0x2e')]['filter']){_0x143b4d[_0xc9a0('0x38')]=_['merge'](_0x143b4d[_0xc9a0('0x38')],{'$or':_[_0xc9a0('0x2d')](_0x328f79,function(_0x191a7f){if(_0x191a7f['type']!==_0xc9a0('0x39')){var _0x1baae9={};_0x1baae9[_0x191a7f[_0xc9a0('0x25')]]={'$like':'%'+_0x4c596a[_0xc9a0('0x2e')][_0xc9a0('0x3a')]+'%'};return _0x1baae9;}})});}_0x143b4d=_[_0xc9a0('0x3b')]({},_0x143b4d,_0x4c596a[_0xc9a0('0x3c')]);var _0x14d5ad={'where':_0x143b4d[_0xc9a0('0x38')]};return db[_0xc9a0('0x27')][_0xc9a0('0x1c')](_0x14d5ad)[_0xc9a0('0x21')](function(_0x173e02){_0x15a6f5['count']=_0x173e02;if(_0x4c596a[_0xc9a0('0x2e')][_0xc9a0('0x3d')]){_0x143b4d[_0xc9a0('0x3e')]=[{'all':!![]}];}return db[_0xc9a0('0x27')][_0xc9a0('0x3f')](_0x143b4d);})[_0xc9a0('0x21')](function(_0x5c80d4){_0x15a6f5[_0xc9a0('0x40')]=_0x5c80d4;return _0x15a6f5;})[_0xc9a0('0x21')](respondWithFilteredResult(_0x1df478,_0x143b4d))[_0xc9a0('0x41')](handleError(_0x1df478,null));};exports['show']=function(_0x48ba9f,_0x14d27a){var _0x3f11fd={'raw':![],'where':{'id':_0x48ba9f['params']['id']}},_0x185eb6={};_0x185eb6[_0xc9a0('0x2c')]=_[_0xc9a0('0x2f')](db['Dynamics365Configuration'][_0xc9a0('0x28')]);_0x185eb6[_0xc9a0('0x2e')]=_[_0xc9a0('0x2f')](_0x48ba9f[_0xc9a0('0x2e')]);_0x185eb6['filters']=_[_0xc9a0('0x31')](_0x185eb6[_0xc9a0('0x2c')],_0x185eb6[_0xc9a0('0x2e')]);_0x3f11fd[_0xc9a0('0x32')]=_['intersection'](_0x185eb6[_0xc9a0('0x2c')],qs[_0xc9a0('0x33')](_0x48ba9f['query'][_0xc9a0('0x33')]));_0x3f11fd[_0xc9a0('0x32')]=_0x3f11fd[_0xc9a0('0x32')]['length']?_0x3f11fd['attributes']:_0x185eb6[_0xc9a0('0x2c')];if(_0x48ba9f['query']['includeAll']){_0x3f11fd[_0xc9a0('0x3e')]=[{'all':!![]}];}_0x3f11fd=_[_0xc9a0('0x3b')]({},_0x3f11fd,_0x48ba9f[_0xc9a0('0x3c')]);return db[_0xc9a0('0x27')]['find'](_0x3f11fd)[_0xc9a0('0x21')](handleEntityNotFound(_0x14d27a,null))['then'](respondWithResult(_0x14d27a,null))[_0xc9a0('0x41')](handleError(_0x14d27a,null));};exports[_0xc9a0('0x42')]=function(_0x1f2ce1,_0x30c42c){return db['Dynamics365Configuration']['create'](_0x1f2ce1['body'],{})['then'](respondWithResult(_0x30c42c,0xc9))['catch'](handleError(_0x30c42c,null));};exports[_0xc9a0('0x43')]=function(_0xb9f386,_0x465aaa){if(_0xb9f386[_0xc9a0('0x44')]['id']){delete _0xb9f386[_0xc9a0('0x44')]['id'];}return db[_0xc9a0('0x27')][_0xc9a0('0x45')]({'where':{'id':_0xb9f386[_0xc9a0('0x46')]['id']}})['then'](handleEntityNotFound(_0x465aaa,null))[_0xc9a0('0x21')](saveUpdates(_0xb9f386['body'],null))[_0xc9a0('0x21')](respondWithResult(_0x465aaa,null))['catch'](handleError(_0x465aaa,null));};exports['destroy']=function(_0x1cc1d1,_0x5182c4){return db[_0xc9a0('0x27')][_0xc9a0('0x45')]({'where':{'id':_0x1cc1d1[_0xc9a0('0x46')]['id']}})[_0xc9a0('0x21')](handleEntityNotFound(_0x5182c4,null))['then'](removeEntity(_0x5182c4,null))[_0xc9a0('0x41')](handleError(_0x5182c4,null));};exports['getFields']=function(_0x22d2e0,_0x12df51,_0x413cd0){var _0x45ccd9={};var _0x26274f={};var _0x1fc236;var _0x5a6fce;return db[_0xc9a0('0x27')][_0xc9a0('0x47')]({'where':{'id':_0x22d2e0[_0xc9a0('0x46')]['id']}})[_0xc9a0('0x21')](handleEntityNotFound(_0x12df51,null))[_0xc9a0('0x21')](function(_0x226c85){if(_0x226c85){_0x1fc236=_0x226c85;_0x26274f[_0xc9a0('0x2c')]=_[_0xc9a0('0x2f')](db['Dynamics365Field'][_0xc9a0('0x28')]);_0x26274f['query']=_[_0xc9a0('0x2f')](_0x22d2e0['query']);_0x26274f['filters']=_[_0xc9a0('0x31')](_0x26274f['model'],_0x26274f[_0xc9a0('0x2e')]);_0x45ccd9[_0xc9a0('0x32')]=_[_0xc9a0('0x31')](_0x26274f[_0xc9a0('0x2c')],qs[_0xc9a0('0x33')](_0x22d2e0[_0xc9a0('0x2e')][_0xc9a0('0x33')]));_0x45ccd9[_0xc9a0('0x32')]=_0x45ccd9['attributes']['length']?_0x45ccd9[_0xc9a0('0x32')]:_0x26274f[_0xc9a0('0x2c')];_0x45ccd9[_0xc9a0('0x48')]=qs[_0xc9a0('0x37')](_0x22d2e0[_0xc9a0('0x2e')][_0xc9a0('0x37')]);_0x45ccd9[_0xc9a0('0x38')]=qs[_0xc9a0('0x30')](_[_0xc9a0('0x49')](_0x22d2e0['query'],_0x26274f['filters']));if(_0x22d2e0['query']['filter']){_0x45ccd9[_0xc9a0('0x38')]=_[_0xc9a0('0x3b')](_0x45ccd9[_0xc9a0('0x38')],{'$or':_[_0xc9a0('0x2d')](_0x45ccd9['attributes'],function(_0x871fc2){var _0x15d809={};_0x15d809[_0x871fc2]={'$like':'%'+_0x22d2e0['query'][_0xc9a0('0x3a')]+'%'};return _0x15d809;})});}_0x45ccd9=_[_0xc9a0('0x3b')]({},_0x45ccd9,_0x22d2e0[_0xc9a0('0x3c')]);return _0x1fc236[_0xc9a0('0x4a')](_0x45ccd9);}})[_0xc9a0('0x21')](function(_0x647821){if(_0x647821){_0x5a6fce=_0x647821[_0xc9a0('0x34')];if(!_0x22d2e0[_0xc9a0('0x2e')][_0xc9a0('0x35')]('nolimit')){_0x45ccd9[_0xc9a0('0x1b')]=qs['limit'](_0x22d2e0[_0xc9a0('0x2e')][_0xc9a0('0x1b')]);_0x45ccd9[_0xc9a0('0x19')]=qs['offset'](_0x22d2e0[_0xc9a0('0x2e')]['offset']);}return _0x1fc236[_0xc9a0('0x4a')](_0x45ccd9);}})[_0xc9a0('0x21')](function(_0x55b718){if(_0x55b718){return _0x55b718?{'count':_0x5a6fce,'rows':_0x55b718}:null;}})[_0xc9a0('0x21')](respondWithResult(_0x12df51,null))[_0xc9a0('0x41')](handleError(_0x12df51,null));};exports[_0xc9a0('0x4b')]=function(_0x3af891,_0x13a28e,_0x2c4f85){var _0x596190={};var _0x514e0b={};var _0x59a1a1;var _0x58872f;return db[_0xc9a0('0x27')][_0xc9a0('0x47')]({'where':{'id':_0x3af891[_0xc9a0('0x46')]['id']}})[_0xc9a0('0x21')](handleEntityNotFound(_0x13a28e,null))['then'](function(_0x34c796){if(_0x34c796){_0x59a1a1=_0x34c796;_0x514e0b['model']=_[_0xc9a0('0x2f')](db[_0xc9a0('0x4c')][_0xc9a0('0x28')]);_0x514e0b[_0xc9a0('0x2e')]=_[_0xc9a0('0x2f')](_0x3af891[_0xc9a0('0x2e')]);_0x514e0b[_0xc9a0('0x30')]=_['intersection'](_0x514e0b['model'],_0x514e0b[_0xc9a0('0x2e')]);_0x596190[_0xc9a0('0x32')]=_[_0xc9a0('0x31')](_0x514e0b[_0xc9a0('0x2c')],qs['fields'](_0x3af891[_0xc9a0('0x2e')]['fields']));_0x596190['attributes']=_0x596190['attributes']['length']?_0x596190['attributes']:_0x514e0b[_0xc9a0('0x2c')];_0x596190['order']=qs['sort'](_0x3af891[_0xc9a0('0x2e')][_0xc9a0('0x37')]);_0x596190[_0xc9a0('0x38')]=qs[_0xc9a0('0x30')](_[_0xc9a0('0x49')](_0x3af891[_0xc9a0('0x2e')],_0x514e0b[_0xc9a0('0x30')]));if(_0x3af891[_0xc9a0('0x2e')][_0xc9a0('0x3a')]){_0x596190[_0xc9a0('0x38')]=_[_0xc9a0('0x3b')](_0x596190[_0xc9a0('0x38')],{'$or':_[_0xc9a0('0x2d')](_0x596190[_0xc9a0('0x32')],function(_0x11f9ba){var _0x2c3be1={};_0x2c3be1[_0x11f9ba]={'$like':'%'+_0x3af891[_0xc9a0('0x2e')][_0xc9a0('0x3a')]+'%'};return _0x2c3be1;})});}_0x596190=_[_0xc9a0('0x3b')]({},_0x596190,_0x3af891['options']);return _0x59a1a1[_0xc9a0('0x4b')](_0x596190);}})[_0xc9a0('0x21')](function(_0x382951){if(_0x382951){_0x58872f=_0x382951[_0xc9a0('0x34')];if(!_0x3af891['query'][_0xc9a0('0x35')](_0xc9a0('0x36'))){_0x596190['limit']=qs[_0xc9a0('0x1b')](_0x3af891[_0xc9a0('0x2e')]['limit']);_0x596190[_0xc9a0('0x19')]=qs['offset'](_0x3af891[_0xc9a0('0x2e')]['offset']);}return _0x59a1a1[_0xc9a0('0x4b')](_0x596190);}})[_0xc9a0('0x21')](function(_0x4240a7){if(_0x4240a7){return _0x4240a7?{'count':_0x58872f,'rows':_0x4240a7}:null;}})[_0xc9a0('0x21')](respondWithResult(_0x13a28e,null))[_0xc9a0('0x41')](handleError(_0x13a28e,null));};exports[_0xc9a0('0x4d')]=function(_0x4093a8,_0x2e16fb,_0x29a10d){var _0x1be663={};var _0x2cb5ca={};var _0x10f5df;var _0xd42cd4;return db['Dynamics365Configuration'][_0xc9a0('0x47')]({'where':{'id':_0x4093a8[_0xc9a0('0x46')]['id']}})['then'](handleEntityNotFound(_0x2e16fb,null))[_0xc9a0('0x21')](function(_0x284971){if(_0x284971){_0x10f5df=_0x284971;_0x2cb5ca[_0xc9a0('0x2c')]=_[_0xc9a0('0x2f')](db[_0xc9a0('0x4c')]['rawAttributes']);_0x2cb5ca[_0xc9a0('0x2e')]=_[_0xc9a0('0x2f')](_0x4093a8[_0xc9a0('0x2e')]);_0x2cb5ca[_0xc9a0('0x30')]=_[_0xc9a0('0x31')](_0x2cb5ca['model'],_0x2cb5ca['query']);_0x1be663[_0xc9a0('0x32')]=_['intersection'](_0x2cb5ca[_0xc9a0('0x2c')],qs[_0xc9a0('0x33')](_0x4093a8[_0xc9a0('0x2e')][_0xc9a0('0x33')]));_0x1be663[_0xc9a0('0x32')]=_0x1be663[_0xc9a0('0x32')][_0xc9a0('0x34')]?_0x1be663[_0xc9a0('0x32')]:_0x2cb5ca[_0xc9a0('0x2c')];_0x1be663[_0xc9a0('0x48')]=qs[_0xc9a0('0x37')](_0x4093a8[_0xc9a0('0x2e')][_0xc9a0('0x37')]);_0x1be663['where']=qs[_0xc9a0('0x30')](_[_0xc9a0('0x49')](_0x4093a8[_0xc9a0('0x2e')],_0x2cb5ca[_0xc9a0('0x30')]));if(_0x4093a8['query']['filter']){_0x1be663[_0xc9a0('0x38')]=_['merge'](_0x1be663[_0xc9a0('0x38')],{'$or':_[_0xc9a0('0x2d')](_0x1be663[_0xc9a0('0x32')],function(_0x3c149a){var _0x47e9d9={};_0x47e9d9[_0x3c149a]={'$like':'%'+_0x4093a8['query'][_0xc9a0('0x3a')]+'%'};return _0x47e9d9;})});}_0x1be663=_[_0xc9a0('0x3b')]({},_0x1be663,_0x4093a8[_0xc9a0('0x3c')]);return _0x10f5df[_0xc9a0('0x4d')](_0x1be663);}})[_0xc9a0('0x21')](function(_0x5c70b6){if(_0x5c70b6){_0xd42cd4=_0x5c70b6[_0xc9a0('0x34')];if(!_0x4093a8['query'][_0xc9a0('0x35')]('nolimit')){_0x1be663[_0xc9a0('0x1b')]=qs['limit'](_0x4093a8[_0xc9a0('0x2e')][_0xc9a0('0x1b')]);_0x1be663[_0xc9a0('0x19')]=qs[_0xc9a0('0x19')](_0x4093a8['query'][_0xc9a0('0x19')]);}return _0x10f5df[_0xc9a0('0x4d')](_0x1be663);}})[_0xc9a0('0x21')](function(_0x2c0140){if(_0x2c0140){return _0x2c0140?{'count':_0xd42cd4,'rows':_0x2c0140}:null;}})[_0xc9a0('0x21')](respondWithResult(_0x2e16fb,null))['catch'](handleError(_0x2e16fb,null));}; \ No newline at end of file +var _0xdd92=['rows','catch','show','params','length','find','create','body','update','getFields','findOne','Dynamics365Field','order','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../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','undefined','count','Content-Range','apply','reject','save','destroy','then','name','send','index','map','Dynamics365Configuration','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','nolimit','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xdd92,0xb2));var _0x2dd9=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0xdd92[_0x21549c];return _0x426cbd;};'use strict';var emlformat=require(_0x2dd9('0x0'));var rimraf=require(_0x2dd9('0x1'));var zipdir=require(_0x2dd9('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x2dd9('0x3'));var Mustache=require(_0x2dd9('0x4'));var util=require(_0x2dd9('0x5'));var path=require('path');var sox=require(_0x2dd9('0x6'));var csv=require(_0x2dd9('0x7'));var ejs=require(_0x2dd9('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2dd9('0x9'));var squel=require(_0x2dd9('0xa'));var crypto=require(_0x2dd9('0xb'));var jsforce=require(_0x2dd9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2dd9('0x7'));var querystring=require(_0x2dd9('0xd'));var Papa=require(_0x2dd9('0xe'));var Redis=require(_0x2dd9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2dd9('0x10'));var as=require(_0x2dd9('0x11'));var hardwareService=require(_0x2dd9('0x12'));var logger=require(_0x2dd9('0x13'))(_0x2dd9('0x14'));var utils=require(_0x2dd9('0x15'));var config=require(_0x2dd9('0x16'));var licenseUtil=require(_0x2dd9('0x17'));var db=require(_0x2dd9('0x18'))['db'];function respondWithStatusCode(_0xc85305,_0x7c19db){_0x7c19db=_0x7c19db||0xcc;return function(_0x421818){if(_0x421818){return _0xc85305[_0x2dd9('0x19')](_0x7c19db);}return _0xc85305[_0x2dd9('0x1a')](_0x7c19db)[_0x2dd9('0x1b')]();};}function respondWithResult(_0x9a4250,_0x400d7a){_0x400d7a=_0x400d7a||0xc8;return function(_0x31964e){if(_0x31964e){return _0x9a4250['status'](_0x400d7a)[_0x2dd9('0x1c')](_0x31964e);}};}function respondWithFilteredResult(_0x4c6d76,_0x346fcb){return function(_0x1ddead){if(_0x1ddead){var _0x3a09b6=typeof _0x346fcb[_0x2dd9('0x1d')]==='undefined'&&typeof _0x346fcb[_0x2dd9('0x1e')]===_0x2dd9('0x1f');var _0x44fd5c=_0x1ddead[_0x2dd9('0x20')];var _0x275d31=_0x3a09b6?0x0:_0x346fcb[_0x2dd9('0x1d')];var _0x437213=_0x3a09b6?_0x1ddead[_0x2dd9('0x20')]:_0x346fcb[_0x2dd9('0x1d')]+_0x346fcb[_0x2dd9('0x1e')];var _0x21e36b;if(_0x437213>=_0x44fd5c){_0x437213=_0x44fd5c;_0x21e36b=0xc8;}else{_0x21e36b=0xce;}_0x4c6d76['status'](_0x21e36b);return _0x4c6d76['set'](_0x2dd9('0x21'),_0x275d31+'-'+_0x437213+'/'+_0x44fd5c)['json'](_0x1ddead);}return null;};}function patchUpdates(_0x50bd55){return function(_0x3d2db1){try{jsonpatch[_0x2dd9('0x22')](_0x3d2db1,_0x50bd55,!![]);}catch(_0x52a139){return BPromise[_0x2dd9('0x23')](_0x52a139);}return _0x3d2db1[_0x2dd9('0x24')]();};}function saveUpdates(_0x589bc6,_0x478655){return function(_0x2c9423){if(_0x2c9423){return _0x2c9423['update'](_0x589bc6)['then'](function(_0x180a47){return _0x180a47;});}return null;};}function removeEntity(_0x4d7b28,_0x462344){return function(_0x3d00b1){if(_0x3d00b1){return _0x3d00b1[_0x2dd9('0x25')]()[_0x2dd9('0x26')](function(){_0x4d7b28[_0x2dd9('0x1a')](0xcc)[_0x2dd9('0x1b')]();});}};}function handleEntityNotFound(_0x247124,_0x20a72a){return function(_0x15c8c5){if(!_0x15c8c5){_0x247124[_0x2dd9('0x19')](0x194);}return _0x15c8c5;};}function handleError(_0x184e5d,_0x261023){_0x261023=_0x261023||0x1f4;return function(_0x30f804){logger['error'](_0x30f804['stack']);if(_0x30f804[_0x2dd9('0x27')]){delete _0x30f804[_0x2dd9('0x27')];}_0x184e5d[_0x2dd9('0x1a')](_0x261023)[_0x2dd9('0x28')](_0x30f804);};}exports[_0x2dd9('0x29')]=function(_0x117222,_0x4bf219){var _0x3ea2bc={},_0x4c35cb={},_0x2bc172={'count':0x0,'rows':[]};var _0x118515=_[_0x2dd9('0x2a')](db[_0x2dd9('0x2b')][_0x2dd9('0x2c')],function(_0x5cd577){return{'name':_0x5cd577[_0x2dd9('0x2d')],'type':_0x5cd577[_0x2dd9('0x2e')][_0x2dd9('0x2f')]};});_0x4c35cb[_0x2dd9('0x30')]=_[_0x2dd9('0x2a')](_0x118515,'name');_0x4c35cb[_0x2dd9('0x31')]=_[_0x2dd9('0x32')](_0x117222[_0x2dd9('0x31')]);_0x4c35cb['filters']=_[_0x2dd9('0x33')](_0x4c35cb[_0x2dd9('0x30')],_0x4c35cb['query']);_0x3ea2bc[_0x2dd9('0x34')]=_[_0x2dd9('0x33')](_0x4c35cb[_0x2dd9('0x30')],qs[_0x2dd9('0x35')](_0x117222[_0x2dd9('0x31')][_0x2dd9('0x35')]));_0x3ea2bc[_0x2dd9('0x34')]=_0x3ea2bc['attributes']['length']?_0x3ea2bc[_0x2dd9('0x34')]:_0x4c35cb[_0x2dd9('0x30')];if(!_0x117222[_0x2dd9('0x31')]['hasOwnProperty'](_0x2dd9('0x36'))){_0x3ea2bc[_0x2dd9('0x1e')]=qs[_0x2dd9('0x1e')](_0x117222['query'][_0x2dd9('0x1e')]);_0x3ea2bc[_0x2dd9('0x1d')]=qs[_0x2dd9('0x1d')](_0x117222[_0x2dd9('0x31')][_0x2dd9('0x1d')]);}_0x3ea2bc['order']=qs[_0x2dd9('0x37')](_0x117222[_0x2dd9('0x31')][_0x2dd9('0x37')]);_0x3ea2bc[_0x2dd9('0x38')]=qs[_0x2dd9('0x39')](_[_0x2dd9('0x3a')](_0x117222[_0x2dd9('0x31')],_0x4c35cb['filters']),_0x118515);if(_0x117222[_0x2dd9('0x31')][_0x2dd9('0x3b')]){_0x3ea2bc[_0x2dd9('0x38')]=_['merge'](_0x3ea2bc[_0x2dd9('0x38')],{'$or':_[_0x2dd9('0x2a')](_0x118515,function(_0x3e1ff6){if(_0x3e1ff6[_0x2dd9('0x2e')]!=='VIRTUAL'){var _0x3a0167={};_0x3a0167[_0x3e1ff6['name']]={'$like':'%'+_0x117222[_0x2dd9('0x31')][_0x2dd9('0x3b')]+'%'};return _0x3a0167;}})});}_0x3ea2bc=_[_0x2dd9('0x3c')]({},_0x3ea2bc,_0x117222[_0x2dd9('0x3d')]);var _0x170d44={'where':_0x3ea2bc[_0x2dd9('0x38')]};return db[_0x2dd9('0x2b')][_0x2dd9('0x20')](_0x170d44)[_0x2dd9('0x26')](function(_0x30cde2){_0x2bc172[_0x2dd9('0x20')]=_0x30cde2;if(_0x117222[_0x2dd9('0x31')][_0x2dd9('0x3e')]){_0x3ea2bc[_0x2dd9('0x3f')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x2dd9('0x40')](_0x3ea2bc);})[_0x2dd9('0x26')](function(_0x203f72){_0x2bc172[_0x2dd9('0x41')]=_0x203f72;return _0x2bc172;})['then'](respondWithFilteredResult(_0x4bf219,_0x3ea2bc))[_0x2dd9('0x42')](handleError(_0x4bf219,null));};exports[_0x2dd9('0x43')]=function(_0xfe0fb,_0x1c2a36){var _0x203f61={'raw':![],'where':{'id':_0xfe0fb[_0x2dd9('0x44')]['id']}},_0x1d47b4={};_0x1d47b4[_0x2dd9('0x30')]=_[_0x2dd9('0x32')](db[_0x2dd9('0x2b')][_0x2dd9('0x2c')]);_0x1d47b4[_0x2dd9('0x31')]=_['keys'](_0xfe0fb['query']);_0x1d47b4[_0x2dd9('0x39')]=_[_0x2dd9('0x33')](_0x1d47b4[_0x2dd9('0x30')],_0x1d47b4[_0x2dd9('0x31')]);_0x203f61['attributes']=_['intersection'](_0x1d47b4[_0x2dd9('0x30')],qs[_0x2dd9('0x35')](_0xfe0fb[_0x2dd9('0x31')]['fields']));_0x203f61['attributes']=_0x203f61[_0x2dd9('0x34')][_0x2dd9('0x45')]?_0x203f61[_0x2dd9('0x34')]:_0x1d47b4[_0x2dd9('0x30')];if(_0xfe0fb[_0x2dd9('0x31')]['includeAll']){_0x203f61[_0x2dd9('0x3f')]=[{'all':!![]}];}_0x203f61=_[_0x2dd9('0x3c')]({},_0x203f61,_0xfe0fb[_0x2dd9('0x3d')]);return db[_0x2dd9('0x2b')][_0x2dd9('0x46')](_0x203f61)[_0x2dd9('0x26')](handleEntityNotFound(_0x1c2a36,null))['then'](respondWithResult(_0x1c2a36,null))[_0x2dd9('0x42')](handleError(_0x1c2a36,null));};exports[_0x2dd9('0x47')]=function(_0x394f6e,_0x40d256){return db['Dynamics365Configuration']['create'](_0x394f6e[_0x2dd9('0x48')],{})[_0x2dd9('0x26')](respondWithResult(_0x40d256,0xc9))[_0x2dd9('0x42')](handleError(_0x40d256,null));};exports[_0x2dd9('0x49')]=function(_0x16652c,_0xa63859){if(_0x16652c[_0x2dd9('0x48')]['id']){delete _0x16652c[_0x2dd9('0x48')]['id'];}return db[_0x2dd9('0x2b')]['find']({'where':{'id':_0x16652c[_0x2dd9('0x44')]['id']}})[_0x2dd9('0x26')](handleEntityNotFound(_0xa63859,null))[_0x2dd9('0x26')](saveUpdates(_0x16652c[_0x2dd9('0x48')],null))[_0x2dd9('0x26')](respondWithResult(_0xa63859,null))['catch'](handleError(_0xa63859,null));};exports[_0x2dd9('0x25')]=function(_0x2cb8cd,_0x566f07){return db['Dynamics365Configuration'][_0x2dd9('0x46')]({'where':{'id':_0x2cb8cd['params']['id']}})['then'](handleEntityNotFound(_0x566f07,null))['then'](removeEntity(_0x566f07,null))[_0x2dd9('0x42')](handleError(_0x566f07,null));};exports[_0x2dd9('0x4a')]=function(_0x527087,_0x5ea938,_0x2e5f80){var _0xb4b60b={};var _0x531e46={};var _0x292634;var _0x278056;return db[_0x2dd9('0x2b')][_0x2dd9('0x4b')]({'where':{'id':_0x527087[_0x2dd9('0x44')]['id']}})['then'](handleEntityNotFound(_0x5ea938,null))['then'](function(_0x1bc9ca){if(_0x1bc9ca){_0x292634=_0x1bc9ca;_0x531e46['model']=_[_0x2dd9('0x32')](db[_0x2dd9('0x4c')][_0x2dd9('0x2c')]);_0x531e46[_0x2dd9('0x31')]=_[_0x2dd9('0x32')](_0x527087[_0x2dd9('0x31')]);_0x531e46[_0x2dd9('0x39')]=_['intersection'](_0x531e46[_0x2dd9('0x30')],_0x531e46[_0x2dd9('0x31')]);_0xb4b60b[_0x2dd9('0x34')]=_[_0x2dd9('0x33')](_0x531e46[_0x2dd9('0x30')],qs['fields'](_0x527087[_0x2dd9('0x31')]['fields']));_0xb4b60b[_0x2dd9('0x34')]=_0xb4b60b[_0x2dd9('0x34')][_0x2dd9('0x45')]?_0xb4b60b[_0x2dd9('0x34')]:_0x531e46[_0x2dd9('0x30')];_0xb4b60b[_0x2dd9('0x4d')]=qs['sort'](_0x527087[_0x2dd9('0x31')][_0x2dd9('0x37')]);_0xb4b60b[_0x2dd9('0x38')]=qs['filters'](_[_0x2dd9('0x3a')](_0x527087['query'],_0x531e46[_0x2dd9('0x39')]));if(_0x527087[_0x2dd9('0x31')][_0x2dd9('0x3b')]){_0xb4b60b[_0x2dd9('0x38')]=_[_0x2dd9('0x3c')](_0xb4b60b[_0x2dd9('0x38')],{'$or':_[_0x2dd9('0x2a')](_0xb4b60b[_0x2dd9('0x34')],function(_0x20c067){var _0x4e07f0={};_0x4e07f0[_0x20c067]={'$like':'%'+_0x527087[_0x2dd9('0x31')]['filter']+'%'};return _0x4e07f0;})});}_0xb4b60b=_[_0x2dd9('0x3c')]({},_0xb4b60b,_0x527087['options']);return _0x292634['getFields'](_0xb4b60b);}})[_0x2dd9('0x26')](function(_0x3fcac7){if(_0x3fcac7){_0x278056=_0x3fcac7[_0x2dd9('0x45')];if(!_0x527087['query'][_0x2dd9('0x4e')](_0x2dd9('0x36'))){_0xb4b60b[_0x2dd9('0x1e')]=qs['limit'](_0x527087[_0x2dd9('0x31')][_0x2dd9('0x1e')]);_0xb4b60b['offset']=qs[_0x2dd9('0x1d')](_0x527087[_0x2dd9('0x31')][_0x2dd9('0x1d')]);}return _0x292634['getFields'](_0xb4b60b);}})[_0x2dd9('0x26')](function(_0x26c70e){if(_0x26c70e){return _0x26c70e?{'count':_0x278056,'rows':_0x26c70e}:null;}})[_0x2dd9('0x26')](respondWithResult(_0x5ea938,null))[_0x2dd9('0x42')](handleError(_0x5ea938,null));};exports['getSubjects']=function(_0xc5c7f7,_0x36f487,_0x4fccda){var _0x48a78e={};var _0x4804d1={};var _0x1e2a63;var _0x5ef4f6;return db[_0x2dd9('0x2b')][_0x2dd9('0x4b')]({'where':{'id':_0xc5c7f7[_0x2dd9('0x44')]['id']}})[_0x2dd9('0x26')](handleEntityNotFound(_0x36f487,null))['then'](function(_0x4662ce){if(_0x4662ce){_0x1e2a63=_0x4662ce;_0x4804d1[_0x2dd9('0x30')]=_[_0x2dd9('0x32')](db[_0x2dd9('0x4c')][_0x2dd9('0x2c')]);_0x4804d1['query']=_[_0x2dd9('0x32')](_0xc5c7f7['query']);_0x4804d1[_0x2dd9('0x39')]=_[_0x2dd9('0x33')](_0x4804d1[_0x2dd9('0x30')],_0x4804d1['query']);_0x48a78e[_0x2dd9('0x34')]=_[_0x2dd9('0x33')](_0x4804d1['model'],qs[_0x2dd9('0x35')](_0xc5c7f7['query'][_0x2dd9('0x35')]));_0x48a78e[_0x2dd9('0x34')]=_0x48a78e[_0x2dd9('0x34')][_0x2dd9('0x45')]?_0x48a78e[_0x2dd9('0x34')]:_0x4804d1[_0x2dd9('0x30')];_0x48a78e[_0x2dd9('0x4d')]=qs[_0x2dd9('0x37')](_0xc5c7f7[_0x2dd9('0x31')][_0x2dd9('0x37')]);_0x48a78e[_0x2dd9('0x38')]=qs['filters'](_[_0x2dd9('0x3a')](_0xc5c7f7['query'],_0x4804d1[_0x2dd9('0x39')]));if(_0xc5c7f7['query']['filter']){_0x48a78e['where']=_[_0x2dd9('0x3c')](_0x48a78e[_0x2dd9('0x38')],{'$or':_['map'](_0x48a78e[_0x2dd9('0x34')],function(_0xf466d7){var _0x42534c={};_0x42534c[_0xf466d7]={'$like':'%'+_0xc5c7f7[_0x2dd9('0x31')][_0x2dd9('0x3b')]+'%'};return _0x42534c;})});}_0x48a78e=_[_0x2dd9('0x3c')]({},_0x48a78e,_0xc5c7f7['options']);return _0x1e2a63['getSubjects'](_0x48a78e);}})[_0x2dd9('0x26')](function(_0x56cd0f){if(_0x56cd0f){_0x5ef4f6=_0x56cd0f[_0x2dd9('0x45')];if(!_0xc5c7f7['query']['hasOwnProperty'](_0x2dd9('0x36'))){_0x48a78e['limit']=qs[_0x2dd9('0x1e')](_0xc5c7f7[_0x2dd9('0x31')]['limit']);_0x48a78e['offset']=qs[_0x2dd9('0x1d')](_0xc5c7f7[_0x2dd9('0x31')][_0x2dd9('0x1d')]);}return _0x1e2a63[_0x2dd9('0x4f')](_0x48a78e);}})['then'](function(_0x4ddf20){if(_0x4ddf20){return _0x4ddf20?{'count':_0x5ef4f6,'rows':_0x4ddf20}:null;}})[_0x2dd9('0x26')](respondWithResult(_0x36f487,null))['catch'](handleError(_0x36f487,null));};exports[_0x2dd9('0x50')]=function(_0x5388d8,_0x138918,_0x4d18ab){var _0x12177c={};var _0x3cd2a0={};var _0x267b53;var _0x2b41ce;return db['Dynamics365Configuration'][_0x2dd9('0x4b')]({'where':{'id':_0x5388d8['params']['id']}})[_0x2dd9('0x26')](handleEntityNotFound(_0x138918,null))[_0x2dd9('0x26')](function(_0x22389f){if(_0x22389f){_0x267b53=_0x22389f;_0x3cd2a0[_0x2dd9('0x30')]=_['keys'](db[_0x2dd9('0x4c')][_0x2dd9('0x2c')]);_0x3cd2a0[_0x2dd9('0x31')]=_['keys'](_0x5388d8[_0x2dd9('0x31')]);_0x3cd2a0[_0x2dd9('0x39')]=_[_0x2dd9('0x33')](_0x3cd2a0[_0x2dd9('0x30')],_0x3cd2a0[_0x2dd9('0x31')]);_0x12177c['attributes']=_[_0x2dd9('0x33')](_0x3cd2a0['model'],qs[_0x2dd9('0x35')](_0x5388d8[_0x2dd9('0x31')][_0x2dd9('0x35')]));_0x12177c[_0x2dd9('0x34')]=_0x12177c['attributes'][_0x2dd9('0x45')]?_0x12177c[_0x2dd9('0x34')]:_0x3cd2a0['model'];_0x12177c['order']=qs[_0x2dd9('0x37')](_0x5388d8[_0x2dd9('0x31')][_0x2dd9('0x37')]);_0x12177c[_0x2dd9('0x38')]=qs[_0x2dd9('0x39')](_[_0x2dd9('0x3a')](_0x5388d8['query'],_0x3cd2a0[_0x2dd9('0x39')]));if(_0x5388d8['query'][_0x2dd9('0x3b')]){_0x12177c['where']=_[_0x2dd9('0x3c')](_0x12177c[_0x2dd9('0x38')],{'$or':_[_0x2dd9('0x2a')](_0x12177c[_0x2dd9('0x34')],function(_0x5a1b41){var _0x491e4b={};_0x491e4b[_0x5a1b41]={'$like':'%'+_0x5388d8[_0x2dd9('0x31')][_0x2dd9('0x3b')]+'%'};return _0x491e4b;})});}_0x12177c=_[_0x2dd9('0x3c')]({},_0x12177c,_0x5388d8['options']);return _0x267b53[_0x2dd9('0x50')](_0x12177c);}})['then'](function(_0x546e2a){if(_0x546e2a){_0x2b41ce=_0x546e2a['length'];if(!_0x5388d8['query'][_0x2dd9('0x4e')](_0x2dd9('0x36'))){_0x12177c[_0x2dd9('0x1e')]=qs['limit'](_0x5388d8[_0x2dd9('0x31')][_0x2dd9('0x1e')]);_0x12177c[_0x2dd9('0x1d')]=qs[_0x2dd9('0x1d')](_0x5388d8['query']['offset']);}return _0x267b53[_0x2dd9('0x50')](_0x12177c);}})[_0x2dd9('0x26')](function(_0x4277fa){if(_0x4277fa){return _0x4277fa?{'count':_0x2b41ce,'rows':_0x4277fa}:null;}})[_0x2dd9('0x26')](respondWithResult(_0x138918,null))[_0x2dd9('0x42')](handleError(_0x138918,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 311b039..401bde2 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 _0x70e0=['int_dynamics365_configurations','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./intDynamics365Configuration.attributes'];(function(_0x3767fb,_0x3b917c){var _0x9bd1b9=function(_0x37d2ba){while(--_0x37d2ba){_0x3767fb['push'](_0x3767fb['shift']());}};_0x9bd1b9(++_0x3b917c);}(_0x70e0,0x17b));var _0x070e=function(_0x1913e0,_0x4ce04f){_0x1913e0=_0x1913e0-0x0;var _0x44a81f=_0x70e0[_0x1913e0];return _0x44a81f;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('Dynamics365Configuration',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x84ab=['request-promise','path','../../config/environment','./intDynamics365Configuration.attributes','exports','Dynamics365Configuration','lodash','util','../../config/logger','api','moment'];(function(_0x2b814b,_0x1eeceb){var _0x1928db=function(_0x4815f0){while(--_0x4815f0){_0x2b814b['push'](_0x2b814b['shift']());}};_0x1928db(++_0x1eeceb);}(_0x84ab,0x12f));var _0xb84a=function(_0x1ba43c,_0x5bd2e8){_0x1ba43c=_0x1ba43c-0x0;var _0x2f60eb=_0x84ab[_0x1ba43c];return _0x2f60eb;};'use strict';var _=require(_0xb84a('0x0'));var util=require(_0xb84a('0x1'));var logger=require(_0xb84a('0x2'))(_0xb84a('0x3'));var moment=require(_0xb84a('0x4'));var BPromise=require('bluebird');var rp=require(_0xb84a('0x5'));var fs=require('fs');var path=require(_0xb84a('0x6'));var rimraf=require('rimraf');var config=require(_0xb84a('0x7'));var attributes=require(_0xb84a('0x8'));module[_0xb84a('0x9')]=function(_0x5b9def,_0x521a64){return _0x5b9def['define'](_0xb84a('0xa'),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 964d5d4..82ad1f6 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 _0x21ac=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0x21ac,0xed));var _0xc21a=function(_0x4706d6,_0x211d77){_0x4706d6=_0x4706d6-0x0;var _0x445d18=_0x21ac[_0x4706d6];return _0x445d18;};'use strict';var _=require('lodash');var util=require(_0xc21a('0x0'));var moment=require('moment');var BPromise=require(_0xc21a('0x1'));var rs=require(_0xc21a('0x2'));var fs=require('fs');var Redis=require(_0xc21a('0x3'));var db=require(_0xc21a('0x4'))['db'];var utils=require(_0xc21a('0x5'));var logger=require(_0xc21a('0x6'))(_0xc21a('0x7'));var config=require('../../config/environment');var jayson=require(_0xc21a('0x8'));var client=jayson[_0xc21a('0x9')][_0xc21a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4d064c,_0x50f06c,_0x5c69b5){return new BPromise(function(_0x284548,_0x551761){return client[_0xc21a('0xb')](_0x4d064c,_0x5c69b5)[_0xc21a('0xc')](function(_0x489a9e){logger[_0xc21a('0xd')](_0xc21a('0xe'),_0x50f06c,_0xc21a('0xf'));logger[_0xc21a('0x10')](_0xc21a('0x11'),_0x50f06c,_0xc21a('0xf'),JSON[_0xc21a('0x12')](_0x489a9e));if(_0x489a9e[_0xc21a('0x13')]){if(_0x489a9e['error'][_0xc21a('0x14')]===0x1f4){logger[_0xc21a('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x50f06c,_0x489a9e[_0xc21a('0x13')][_0xc21a('0x15')]);return _0x551761(_0x489a9e['error']['message']);}logger['error'](_0xc21a('0xe'),_0x50f06c,_0x489a9e[_0xc21a('0x13')][_0xc21a('0x15')]);return _0x284548(_0x489a9e['error'][_0xc21a('0x15')]);}else{logger[_0xc21a('0xd')]('Dynamics365Configuration,\x20%s,\x20%s',_0x50f06c,_0xc21a('0xf'));_0x284548(_0x489a9e[_0xc21a('0x16')][_0xc21a('0x15')]);}})['catch'](function(_0x277860){logger['error'](_0xc21a('0xe'),_0x50f06c,_0x277860);_0x551761(_0x277860);});});} \ No newline at end of file +var _0x0f2f=['debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent'];(function(_0x336c17,_0x304cfe){var _0x2e7af=function(_0x1bb34d){while(--_0x1bb34d){_0x336c17['push'](_0x336c17['shift']());}};_0x2e7af(++_0x304cfe);}(_0x0f2f,0x11b));var _0xf0f2=function(_0x376d5c,_0x21b2e8){_0x376d5c=_0x376d5c-0x0;var _0x168798=_0x0f2f[_0x376d5c];return _0x168798;};'use strict';var _=require(_0xf0f2('0x0'));var util=require(_0xf0f2('0x1'));var moment=require(_0xf0f2('0x2'));var BPromise=require('bluebird');var rs=require(_0xf0f2('0x3'));var fs=require('fs');var Redis=require(_0xf0f2('0x4'));var db=require(_0xf0f2('0x5'))['db'];var utils=require(_0xf0f2('0x6'));var logger=require(_0xf0f2('0x7'))('rpc');var config=require(_0xf0f2('0x8'));var jayson=require(_0xf0f2('0x9'));var client=jayson['client'][_0xf0f2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33c3d7,_0x1f0953,_0x572bd0){return new BPromise(function(_0x3a529d,_0x7dab1){return client[_0xf0f2('0xb')](_0x33c3d7,_0x572bd0)[_0xf0f2('0xc')](function(_0x103ecd){logger[_0xf0f2('0xd')](_0xf0f2('0xe'),_0x1f0953,_0xf0f2('0xf'));logger[_0xf0f2('0x10')](_0xf0f2('0x11'),_0x1f0953,'request\x20sent',JSON[_0xf0f2('0x12')](_0x103ecd));if(_0x103ecd[_0xf0f2('0x13')]){if(_0x103ecd[_0xf0f2('0x13')]['code']===0x1f4){logger[_0xf0f2('0x13')](_0xf0f2('0xe'),_0x1f0953,_0x103ecd['error'][_0xf0f2('0x14')]);return _0x7dab1(_0x103ecd['error']['message']);}logger[_0xf0f2('0x13')](_0xf0f2('0xe'),_0x1f0953,_0x103ecd['error'][_0xf0f2('0x14')]);return _0x3a529d(_0x103ecd[_0xf0f2('0x13')][_0xf0f2('0x14')]);}else{logger['info'](_0xf0f2('0xe'),_0x1f0953,_0xf0f2('0xf'));_0x3a529d(_0x103ecd[_0xf0f2('0x15')][_0xf0f2('0x14')]);}})[_0xf0f2('0x16')](function(_0x486e11){logger[_0xf0f2('0x13')]('Dynamics365Configuration,\x20%s,\x20%s',_0x1f0953,_0x486e11);_0x7dab1(_0x486e11);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 8a867d1..43b2528 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 _0xd59f=['./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x1c4866,_0x255b66){var _0x4239e6=function(_0xb477fe){while(--_0xb477fe){_0x1c4866['push'](_0x1c4866['shift']());}};_0x4239e6(++_0x255b66);}(_0xd59f,0x161));var _0xfd59=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0xd59f[_0x122096];return _0x3d1966;};'use strict';var multer=require('multer');var util=require(_0xfd59('0x0'));var path=require('path');var timeout=require(_0xfd59('0x1'));var express=require(_0xfd59('0x2'));var router=express[_0xfd59('0x3')]();var fs_extra=require(_0xfd59('0x4'));var auth=require(_0xfd59('0x5'));var interaction=require(_0xfd59('0x6'));var config=require('../../config/environment');var controller=require(_0xfd59('0x7'));router[_0xfd59('0x8')]('/',auth[_0xfd59('0x9')](),controller[_0xfd59('0xa')]);router[_0xfd59('0x8')](_0xfd59('0xb'),auth[_0xfd59('0x9')](),controller[_0xfd59('0xc')]);router['post']('/',auth[_0xfd59('0x9')](),controller[_0xfd59('0xd')]);router[_0xfd59('0xe')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xfd59('0xf')](_0xfd59('0xb'),auth[_0xfd59('0x9')](),controller[_0xfd59('0x10')]);module[_0xfd59('0x11')]=router; \ No newline at end of file +var _0xf2b5=['delete','destroy','exports','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf2b5,0x159));var _0x5f2b=function(_0x5ca52d,_0x3a4a22){_0x5ca52d=_0x5ca52d-0x0;var _0x89e54e=_0xf2b5[_0x5ca52d];return _0x89e54e;};'use strict';var multer=require('multer');var util=require(_0x5f2b('0x0'));var path=require(_0x5f2b('0x1'));var timeout=require(_0x5f2b('0x2'));var express=require(_0x5f2b('0x3'));var router=express[_0x5f2b('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5f2b('0x5'));var interaction=require(_0x5f2b('0x6'));var config=require(_0x5f2b('0x7'));var controller=require('./intDynamics365Field.controller');router[_0x5f2b('0x8')]('/',auth[_0x5f2b('0x9')](),controller[_0x5f2b('0xa')]);router['get'](_0x5f2b('0xb'),auth[_0x5f2b('0x9')](),controller[_0x5f2b('0xc')]);router[_0x5f2b('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x5f2b('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x5f2b('0xf')]);router[_0x5f2b('0x10')](_0x5f2b('0xb'),auth['isAuthenticated'](),controller[_0x5f2b('0x11')]);module[_0x5f2b('0x12')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 0daf45f..7f76354 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 _0xf6d4=['keyValue','string','STRING','variable','BOOLEAN','sequelize','exports','ENUM','customVariable'];(function(_0x331f16,_0x5439d2){var _0xf6dbf2=function(_0x1ebab1){while(--_0x1ebab1){_0x331f16['push'](_0x331f16['shift']());}};_0xf6dbf2(++_0x5439d2);}(_0xf6d4,0x137));var _0x4f6d=function(_0x18f417,_0x3c47fe){_0x18f417=_0x18f417-0x0;var _0x5b2df3=_0xf6d4[_0x18f417];return _0x5b2df3;};'use strict';var Sequelize=require(_0x4f6d('0x0'));module[_0x4f6d('0x1')]={'type':{'type':Sequelize[_0x4f6d('0x2')]('string','variable',_0x4f6d('0x3'),_0x4f6d('0x4'),'picklist'),'defaultValue':_0x4f6d('0x5')},'content':{'type':Sequelize[_0x4f6d('0x6')]},'key':{'type':Sequelize[_0x4f6d('0x6')]},'keyType':{'type':Sequelize[_0x4f6d('0x2')](_0x4f6d('0x5'),_0x4f6d('0x7'),_0x4f6d('0x3'))},'keyContent':{'type':Sequelize[_0x4f6d('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x4f6d('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4f6d('0x6')]}}; \ No newline at end of file +var _0x0648=['sequelize','exports','string','customVariable','keyValue','picklist','STRING','ENUM','variable','BOOLEAN'];(function(_0x169ec7,_0x374703){var _0x906927=function(_0x2547d5){while(--_0x2547d5){_0x169ec7['push'](_0x169ec7['shift']());}};_0x906927(++_0x374703);}(_0x0648,0x1b8));var _0x8064=function(_0x3c9bc6,_0x31339a){_0x3c9bc6=_0x3c9bc6-0x0;var _0x13135c=_0x0648[_0x3c9bc6];return _0x13135c;};'use strict';var Sequelize=require(_0x8064('0x0'));module[_0x8064('0x1')]={'type':{'type':Sequelize['ENUM'](_0x8064('0x2'),'variable',_0x8064('0x3'),_0x8064('0x4'),_0x8064('0x5')),'defaultValue':_0x8064('0x2')},'content':{'type':Sequelize[_0x8064('0x6')]},'key':{'type':Sequelize[_0x8064('0x6')]},'keyType':{'type':Sequelize[_0x8064('0x7')]('string',_0x8064('0x8'),_0x8064('0x3'))},'keyContent':{'type':Sequelize[_0x8064('0x6')]},'idField':{'type':Sequelize[_0x8064('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x8064('0x9')],'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 ad5f93f..c1c01f4 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 _0xcba7=['find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../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','json','apply','update','then','destroy','error','stack','name','send','map','Dynamics365Field','rawAttributes','fieldName','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params'];(function(_0x14d6bb,_0x477189){var _0x3c29d2=function(_0x4c6d7e){while(--_0x4c6d7e){_0x14d6bb['push'](_0x14d6bb['shift']());}};_0x3c29d2(++_0x477189);}(_0xcba7,0x9d));var _0x7cba=function(_0xc7b656,_0x3983fc){_0xc7b656=_0xc7b656-0x0;var _0x45479e=_0xcba7[_0xc7b656];return _0x45479e;};'use strict';var emlformat=require(_0x7cba('0x0'));var rimraf=require(_0x7cba('0x1'));var zipdir=require(_0x7cba('0x2'));var jsonpatch=require(_0x7cba('0x3'));var rp=require('request-promise');var moment=require(_0x7cba('0x4'));var BPromise=require(_0x7cba('0x5'));var Mustache=require(_0x7cba('0x6'));var util=require(_0x7cba('0x7'));var path=require(_0x7cba('0x8'));var sox=require(_0x7cba('0x9'));var csv=require(_0x7cba('0xa'));var ejs=require(_0x7cba('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7cba('0xc'));var squel=require(_0x7cba('0xd'));var crypto=require(_0x7cba('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x7cba('0xa'));var querystring=require(_0x7cba('0xf'));var Papa=require(_0x7cba('0x10'));var Redis=require(_0x7cba('0x11'));var authService=require(_0x7cba('0x12'));var qs=require(_0x7cba('0x13'));var as=require(_0x7cba('0x14'));var hardwareService=require(_0x7cba('0x15'));var logger=require(_0x7cba('0x16'))(_0x7cba('0x17'));var utils=require('../../config/utils');var config=require(_0x7cba('0x18'));var licenseUtil=require(_0x7cba('0x19'));var db=require(_0x7cba('0x1a'))['db'];function respondWithStatusCode(_0x12da60,_0xcc7914){_0xcc7914=_0xcc7914||0xcc;return function(_0x11a455){if(_0x11a455){return _0x12da60[_0x7cba('0x1b')](_0xcc7914);}return _0x12da60[_0x7cba('0x1c')](_0xcc7914)[_0x7cba('0x1d')]();};}function respondWithResult(_0x1215c6,_0xa3eaf3){_0xa3eaf3=_0xa3eaf3||0xc8;return function(_0x31c593){if(_0x31c593){return _0x1215c6['status'](_0xa3eaf3)['json'](_0x31c593);}};}function respondWithFilteredResult(_0x1a9ce8,_0x582d15){return function(_0x1f8036){if(_0x1f8036){var _0x3e81ce=typeof _0x582d15[_0x7cba('0x1e')]===_0x7cba('0x1f')&&typeof _0x582d15[_0x7cba('0x20')]===_0x7cba('0x1f');var _0x34eaa2=_0x1f8036[_0x7cba('0x21')];var _0x2b79e2=_0x3e81ce?0x0:_0x582d15['offset'];var _0x342686=_0x3e81ce?_0x1f8036[_0x7cba('0x21')]:_0x582d15[_0x7cba('0x1e')]+_0x582d15[_0x7cba('0x20')];var _0x3df923;if(_0x342686>=_0x34eaa2){_0x342686=_0x34eaa2;_0x3df923=0xc8;}else{_0x3df923=0xce;}_0x1a9ce8['status'](_0x3df923);return _0x1a9ce8[_0x7cba('0x22')]('Content-Range',_0x2b79e2+'-'+_0x342686+'/'+_0x34eaa2)[_0x7cba('0x23')](_0x1f8036);}return null;};}function patchUpdates(_0x552877){return function(_0x23ff62){try{jsonpatch[_0x7cba('0x24')](_0x23ff62,_0x552877,!![]);}catch(_0x401070){return BPromise['reject'](_0x401070);}return _0x23ff62['save']();};}function saveUpdates(_0x211099,_0xb10d56){return function(_0x13c7ae){if(_0x13c7ae){return _0x13c7ae[_0x7cba('0x25')](_0x211099)[_0x7cba('0x26')](function(_0x49245f){return _0x49245f;});}return null;};}function removeEntity(_0x46a9d6,_0x1dfd1e){return function(_0x461776){if(_0x461776){return _0x461776[_0x7cba('0x27')]()['then'](function(){_0x46a9d6[_0x7cba('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f068a,_0x4770cd){return function(_0x3af507){if(!_0x3af507){_0x1f068a[_0x7cba('0x1b')](0x194);}return _0x3af507;};}function handleError(_0x3e7c08,_0x4d07ee){_0x4d07ee=_0x4d07ee||0x1f4;return function(_0x12af6f){logger[_0x7cba('0x28')](_0x12af6f[_0x7cba('0x29')]);if(_0x12af6f['name']){delete _0x12af6f[_0x7cba('0x2a')];}_0x3e7c08[_0x7cba('0x1c')](_0x4d07ee)[_0x7cba('0x2b')](_0x12af6f);};}exports['index']=function(_0x2aeac8,_0x5e318e){var _0x525adb={},_0x2b6e2a={},_0x18503d={'count':0x0,'rows':[]};var _0x2314d9=_[_0x7cba('0x2c')](db[_0x7cba('0x2d')][_0x7cba('0x2e')],function(_0x3242f7){return{'name':_0x3242f7[_0x7cba('0x2f')],'type':_0x3242f7['type'][_0x7cba('0x30')]};});_0x2b6e2a['model']=_['map'](_0x2314d9,_0x7cba('0x2a'));_0x2b6e2a[_0x7cba('0x31')]=_[_0x7cba('0x32')](_0x2aeac8['query']);_0x2b6e2a[_0x7cba('0x33')]=_['intersection'](_0x2b6e2a[_0x7cba('0x34')],_0x2b6e2a['query']);_0x525adb[_0x7cba('0x35')]=_[_0x7cba('0x36')](_0x2b6e2a[_0x7cba('0x34')],qs[_0x7cba('0x37')](_0x2aeac8[_0x7cba('0x31')][_0x7cba('0x37')]));_0x525adb[_0x7cba('0x35')]=_0x525adb[_0x7cba('0x35')][_0x7cba('0x38')]?_0x525adb[_0x7cba('0x35')]:_0x2b6e2a[_0x7cba('0x34')];if(!_0x2aeac8['query'][_0x7cba('0x39')](_0x7cba('0x3a'))){_0x525adb[_0x7cba('0x20')]=qs['limit'](_0x2aeac8[_0x7cba('0x31')][_0x7cba('0x20')]);_0x525adb[_0x7cba('0x1e')]=qs['offset'](_0x2aeac8[_0x7cba('0x31')][_0x7cba('0x1e')]);}_0x525adb[_0x7cba('0x3b')]=qs[_0x7cba('0x3c')](_0x2aeac8[_0x7cba('0x31')][_0x7cba('0x3c')]);_0x525adb['where']=qs[_0x7cba('0x33')](_[_0x7cba('0x3d')](_0x2aeac8[_0x7cba('0x31')],_0x2b6e2a[_0x7cba('0x33')]),_0x2314d9);if(_0x2aeac8['query']['filter']){_0x525adb[_0x7cba('0x3e')]=_[_0x7cba('0x3f')](_0x525adb[_0x7cba('0x3e')],{'$or':_[_0x7cba('0x2c')](_0x2314d9,function(_0x510967){if(_0x510967['type']!==_0x7cba('0x40')){var _0x58d6ab={};_0x58d6ab[_0x510967['name']]={'$like':'%'+_0x2aeac8[_0x7cba('0x31')][_0x7cba('0x41')]+'%'};return _0x58d6ab;}})});}_0x525adb=_[_0x7cba('0x3f')]({},_0x525adb,_0x2aeac8[_0x7cba('0x42')]);var _0x2b5e3b={'where':_0x525adb[_0x7cba('0x3e')]};return db[_0x7cba('0x2d')][_0x7cba('0x21')](_0x2b5e3b)['then'](function(_0x5547e3){_0x18503d[_0x7cba('0x21')]=_0x5547e3;if(_0x2aeac8[_0x7cba('0x31')][_0x7cba('0x43')]){_0x525adb[_0x7cba('0x44')]=[{'all':!![]}];}return db[_0x7cba('0x2d')][_0x7cba('0x45')](_0x525adb);})[_0x7cba('0x26')](function(_0x21664b){_0x18503d[_0x7cba('0x46')]=_0x21664b;return _0x18503d;})[_0x7cba('0x26')](respondWithFilteredResult(_0x5e318e,_0x525adb))[_0x7cba('0x47')](handleError(_0x5e318e,null));};exports[_0x7cba('0x48')]=function(_0x171406,_0xda8bd){var _0x425bbb={'raw':!![],'where':{'id':_0x171406[_0x7cba('0x49')]['id']}},_0x288ee6={};_0x288ee6[_0x7cba('0x34')]=_['keys'](db[_0x7cba('0x2d')][_0x7cba('0x2e')]);_0x288ee6[_0x7cba('0x31')]=_['keys'](_0x171406[_0x7cba('0x31')]);_0x288ee6[_0x7cba('0x33')]=_[_0x7cba('0x36')](_0x288ee6[_0x7cba('0x34')],_0x288ee6['query']);_0x425bbb[_0x7cba('0x35')]=_['intersection'](_0x288ee6[_0x7cba('0x34')],qs[_0x7cba('0x37')](_0x171406['query']['fields']));_0x425bbb[_0x7cba('0x35')]=_0x425bbb['attributes'][_0x7cba('0x38')]?_0x425bbb['attributes']:_0x288ee6[_0x7cba('0x34')];if(_0x171406[_0x7cba('0x31')][_0x7cba('0x43')]){_0x425bbb[_0x7cba('0x44')]=[{'all':!![]}];}_0x425bbb=_[_0x7cba('0x3f')]({},_0x425bbb,_0x171406[_0x7cba('0x42')]);return db[_0x7cba('0x2d')][_0x7cba('0x4a')](_0x425bbb)[_0x7cba('0x26')](handleEntityNotFound(_0xda8bd,null))[_0x7cba('0x26')](respondWithResult(_0xda8bd,null))['catch'](handleError(_0xda8bd,null));};exports['create']=function(_0x516aa0,_0x227055){return db[_0x7cba('0x2d')][_0x7cba('0x4b')](_0x516aa0['body'],{})[_0x7cba('0x26')](respondWithResult(_0x227055,0xc9))[_0x7cba('0x47')](handleError(_0x227055,null));};exports['update']=function(_0x58aa95,_0x473293){if(_0x58aa95[_0x7cba('0x4c')]['id']){delete _0x58aa95[_0x7cba('0x4c')]['id'];}return db[_0x7cba('0x2d')][_0x7cba('0x4a')]({'where':{'id':_0x58aa95['params']['id']}})[_0x7cba('0x26')](handleEntityNotFound(_0x473293,null))[_0x7cba('0x26')](saveUpdates(_0x58aa95['body'],null))[_0x7cba('0x26')](respondWithResult(_0x473293,null))[_0x7cba('0x47')](handleError(_0x473293,null));};exports[_0x7cba('0x27')]=function(_0x276f3d,_0x3fbe93){return db[_0x7cba('0x2d')][_0x7cba('0x4a')]({'where':{'id':_0x276f3d['params']['id']}})[_0x7cba('0x26')](handleEntityNotFound(_0x3fbe93,null))['then'](removeEntity(_0x3fbe93,null))[_0x7cba('0x47')](handleError(_0x3fbe93,null));}; \ No newline at end of file +var _0xfd60=['error','name','send','index','Dynamics365Field','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','rows','show','params','rawAttributes','include','find','catch','create','body','update','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','apply','reject','save','then','end','sendStatus'];(function(_0x5eb85f,_0x1b444a){var _0x256703=function(_0x584084){while(--_0x584084){_0x5eb85f['push'](_0x5eb85f['shift']());}};_0x256703(++_0x1b444a);}(_0xfd60,0x1ee));var _0x0fd6=function(_0x242a4f,_0x369c57){_0x242a4f=_0x242a4f-0x0;var _0x122117=_0xfd60[_0x242a4f];return _0x122117;};'use strict';var emlformat=require(_0x0fd6('0x0'));var rimraf=require(_0x0fd6('0x1'));var zipdir=require(_0x0fd6('0x2'));var jsonpatch=require(_0x0fd6('0x3'));var rp=require(_0x0fd6('0x4'));var moment=require('moment');var BPromise=require(_0x0fd6('0x5'));var Mustache=require(_0x0fd6('0x6'));var util=require(_0x0fd6('0x7'));var path=require(_0x0fd6('0x8'));var sox=require(_0x0fd6('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0fd6('0xa'));var _=require('lodash');var squel=require(_0x0fd6('0xb'));var crypto=require(_0x0fd6('0xc'));var jsforce=require(_0x0fd6('0xd'));var deskjs=require(_0x0fd6('0xe'));var toCsv=require(_0x0fd6('0xf'));var querystring=require(_0x0fd6('0x10'));var Papa=require(_0x0fd6('0x11'));var Redis=require(_0x0fd6('0x12'));var authService=require(_0x0fd6('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x0fd6('0x14'))(_0x0fd6('0x15'));var utils=require(_0x0fd6('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0fd6('0x17'));var db=require(_0x0fd6('0x18'))['db'];function respondWithStatusCode(_0x9cad6f,_0x28a4f6){_0x28a4f6=_0x28a4f6||0xcc;return function(_0x2031c1){if(_0x2031c1){return _0x9cad6f['sendStatus'](_0x28a4f6);}return _0x9cad6f[_0x0fd6('0x19')](_0x28a4f6)['end']();};}function respondWithResult(_0x2e9d89,_0x46e498){_0x46e498=_0x46e498||0xc8;return function(_0x4fbbb8){if(_0x4fbbb8){return _0x2e9d89[_0x0fd6('0x19')](_0x46e498)[_0x0fd6('0x1a')](_0x4fbbb8);}};}function respondWithFilteredResult(_0x5203ee,_0x13093d){return function(_0x4581dd){if(_0x4581dd){var _0x4228d7=typeof _0x13093d[_0x0fd6('0x1b')]==='undefined'&&typeof _0x13093d[_0x0fd6('0x1c')]===_0x0fd6('0x1d');var _0x34d379=_0x4581dd[_0x0fd6('0x1e')];var _0x11725d=_0x4228d7?0x0:_0x13093d[_0x0fd6('0x1b')];var _0x2ae03c=_0x4228d7?_0x4581dd['count']:_0x13093d['offset']+_0x13093d[_0x0fd6('0x1c')];var _0x4ad045;if(_0x2ae03c>=_0x34d379){_0x2ae03c=_0x34d379;_0x4ad045=0xc8;}else{_0x4ad045=0xce;}_0x5203ee[_0x0fd6('0x19')](_0x4ad045);return _0x5203ee[_0x0fd6('0x1f')]('Content-Range',_0x11725d+'-'+_0x2ae03c+'/'+_0x34d379)[_0x0fd6('0x1a')](_0x4581dd);}return null;};}function patchUpdates(_0x3cd7c3){return function(_0x5c475f){try{jsonpatch[_0x0fd6('0x20')](_0x5c475f,_0x3cd7c3,!![]);}catch(_0x33f9a8){return BPromise[_0x0fd6('0x21')](_0x33f9a8);}return _0x5c475f[_0x0fd6('0x22')]();};}function saveUpdates(_0x370fe6,_0x142f1d){return function(_0x1dfbab){if(_0x1dfbab){return _0x1dfbab['update'](_0x370fe6)[_0x0fd6('0x23')](function(_0x335a1b){return _0x335a1b;});}return null;};}function removeEntity(_0x510954,_0x52c85f){return function(_0x2bd9d4){if(_0x2bd9d4){return _0x2bd9d4['destroy']()[_0x0fd6('0x23')](function(){_0x510954[_0x0fd6('0x19')](0xcc)[_0x0fd6('0x24')]();});}};}function handleEntityNotFound(_0x563fca,_0x3bb857){return function(_0x26f145){if(!_0x26f145){_0x563fca[_0x0fd6('0x25')](0x194);}return _0x26f145;};}function handleError(_0xf022b7,_0x58171e){_0x58171e=_0x58171e||0x1f4;return function(_0x22adf7){logger[_0x0fd6('0x26')](_0x22adf7['stack']);if(_0x22adf7[_0x0fd6('0x27')]){delete _0x22adf7[_0x0fd6('0x27')];}_0xf022b7['status'](_0x58171e)[_0x0fd6('0x28')](_0x22adf7);};}exports[_0x0fd6('0x29')]=function(_0x2b322c,_0x157ff0){var _0x40004b={},_0xc561bb={},_0x3c1134={'count':0x0,'rows':[]};var _0x151af8=_['map'](db[_0x0fd6('0x2a')]['rawAttributes'],function(_0x594fe0){return{'name':_0x594fe0[_0x0fd6('0x2b')],'type':_0x594fe0['type'][_0x0fd6('0x2c')]};});_0xc561bb[_0x0fd6('0x2d')]=_['map'](_0x151af8,'name');_0xc561bb[_0x0fd6('0x2e')]=_[_0x0fd6('0x2f')](_0x2b322c[_0x0fd6('0x2e')]);_0xc561bb[_0x0fd6('0x30')]=_[_0x0fd6('0x31')](_0xc561bb[_0x0fd6('0x2d')],_0xc561bb[_0x0fd6('0x2e')]);_0x40004b['attributes']=_['intersection'](_0xc561bb['model'],qs[_0x0fd6('0x32')](_0x2b322c[_0x0fd6('0x2e')][_0x0fd6('0x32')]));_0x40004b[_0x0fd6('0x33')]=_0x40004b[_0x0fd6('0x33')][_0x0fd6('0x34')]?_0x40004b[_0x0fd6('0x33')]:_0xc561bb[_0x0fd6('0x2d')];if(!_0x2b322c[_0x0fd6('0x2e')]['hasOwnProperty'](_0x0fd6('0x35'))){_0x40004b[_0x0fd6('0x1c')]=qs[_0x0fd6('0x1c')](_0x2b322c[_0x0fd6('0x2e')]['limit']);_0x40004b['offset']=qs[_0x0fd6('0x1b')](_0x2b322c[_0x0fd6('0x2e')][_0x0fd6('0x1b')]);}_0x40004b[_0x0fd6('0x36')]=qs['sort'](_0x2b322c[_0x0fd6('0x2e')][_0x0fd6('0x37')]);_0x40004b[_0x0fd6('0x38')]=qs[_0x0fd6('0x30')](_[_0x0fd6('0x39')](_0x2b322c['query'],_0xc561bb[_0x0fd6('0x30')]),_0x151af8);if(_0x2b322c['query'][_0x0fd6('0x3a')]){_0x40004b[_0x0fd6('0x38')]=_['merge'](_0x40004b[_0x0fd6('0x38')],{'$or':_['map'](_0x151af8,function(_0x434758){if(_0x434758[_0x0fd6('0x3b')]!==_0x0fd6('0x3c')){var _0x4656c5={};_0x4656c5[_0x434758[_0x0fd6('0x27')]]={'$like':'%'+_0x2b322c[_0x0fd6('0x2e')][_0x0fd6('0x3a')]+'%'};return _0x4656c5;}})});}_0x40004b=_[_0x0fd6('0x3d')]({},_0x40004b,_0x2b322c[_0x0fd6('0x3e')]);var _0x4ccac3={'where':_0x40004b[_0x0fd6('0x38')]};return db[_0x0fd6('0x2a')][_0x0fd6('0x1e')](_0x4ccac3)[_0x0fd6('0x23')](function(_0x19c633){_0x3c1134[_0x0fd6('0x1e')]=_0x19c633;if(_0x2b322c[_0x0fd6('0x2e')][_0x0fd6('0x3f')]){_0x40004b['include']=[{'all':!![]}];}return db[_0x0fd6('0x2a')][_0x0fd6('0x40')](_0x40004b);})[_0x0fd6('0x23')](function(_0x4d65a5){_0x3c1134[_0x0fd6('0x41')]=_0x4d65a5;return _0x3c1134;})[_0x0fd6('0x23')](respondWithFilteredResult(_0x157ff0,_0x40004b))['catch'](handleError(_0x157ff0,null));};exports[_0x0fd6('0x42')]=function(_0x1e1789,_0x517a3d){var _0x50896e={'raw':!![],'where':{'id':_0x1e1789[_0x0fd6('0x43')]['id']}},_0x32ea70={};_0x32ea70[_0x0fd6('0x2d')]=_['keys'](db[_0x0fd6('0x2a')][_0x0fd6('0x44')]);_0x32ea70['query']=_['keys'](_0x1e1789[_0x0fd6('0x2e')]);_0x32ea70['filters']=_[_0x0fd6('0x31')](_0x32ea70['model'],_0x32ea70[_0x0fd6('0x2e')]);_0x50896e['attributes']=_['intersection'](_0x32ea70[_0x0fd6('0x2d')],qs[_0x0fd6('0x32')](_0x1e1789['query']['fields']));_0x50896e[_0x0fd6('0x33')]=_0x50896e['attributes']['length']?_0x50896e['attributes']:_0x32ea70[_0x0fd6('0x2d')];if(_0x1e1789[_0x0fd6('0x2e')]['includeAll']){_0x50896e[_0x0fd6('0x45')]=[{'all':!![]}];}_0x50896e=_[_0x0fd6('0x3d')]({},_0x50896e,_0x1e1789[_0x0fd6('0x3e')]);return db[_0x0fd6('0x2a')][_0x0fd6('0x46')](_0x50896e)[_0x0fd6('0x23')](handleEntityNotFound(_0x517a3d,null))['then'](respondWithResult(_0x517a3d,null))[_0x0fd6('0x47')](handleError(_0x517a3d,null));};exports[_0x0fd6('0x48')]=function(_0x5abd1b,_0x3ab825){return db['Dynamics365Field'][_0x0fd6('0x48')](_0x5abd1b[_0x0fd6('0x49')],{})['then'](respondWithResult(_0x3ab825,0xc9))[_0x0fd6('0x47')](handleError(_0x3ab825,null));};exports[_0x0fd6('0x4a')]=function(_0x203794,_0x355230){if(_0x203794[_0x0fd6('0x49')]['id']){delete _0x203794[_0x0fd6('0x49')]['id'];}return db[_0x0fd6('0x2a')][_0x0fd6('0x46')]({'where':{'id':_0x203794[_0x0fd6('0x43')]['id']}})[_0x0fd6('0x23')](handleEntityNotFound(_0x355230,null))[_0x0fd6('0x23')](saveUpdates(_0x203794[_0x0fd6('0x49')],null))[_0x0fd6('0x23')](respondWithResult(_0x355230,null))[_0x0fd6('0x47')](handleError(_0x355230,null));};exports[_0x0fd6('0x4b')]=function(_0x5447c9,_0x30b1f5){return db[_0x0fd6('0x2a')][_0x0fd6('0x46')]({'where':{'id':_0x5447c9[_0x0fd6('0x43')]['id']}})['then'](handleEntityNotFound(_0x30b1f5,null))[_0x0fd6('0x23')](removeEntity(_0x30b1f5,null))[_0x0fd6('0x47')](handleError(_0x30b1f5,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index 426e402..3643e00 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 _0x6fbe=['rimraf','../../config/environment','./intDynamics365Field.attributes','exports','define','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','util','../../config/logger','api','moment','request-promise','path'];(function(_0x182cbd,_0x3b513a){var _0x48ade4=function(_0x544b8b){while(--_0x544b8b){_0x182cbd['push'](_0x182cbd['shift']());}};_0x48ade4(++_0x3b513a);}(_0x6fbe,0x1ad));var _0xe6fb=function(_0xb0d83a,_0x7461e0){_0xb0d83a=_0xb0d83a-0x0;var _0x5be2af=_0x6fbe[_0xb0d83a];return _0x5be2af;};'use strict';var _=require('lodash');var util=require(_0xe6fb('0x0'));var logger=require(_0xe6fb('0x1'))(_0xe6fb('0x2'));var moment=require(_0xe6fb('0x3'));var BPromise=require('bluebird');var rp=require(_0xe6fb('0x4'));var fs=require('fs');var path=require(_0xe6fb('0x5'));var rimraf=require(_0xe6fb('0x6'));var config=require(_0xe6fb('0x7'));var attributes=require(_0xe6fb('0x8'));module[_0xe6fb('0x9')]=function(_0x4081fa,_0x503ac4){return _0x4081fa[_0xe6fb('0xa')](_0xe6fb('0xb'),attributes,{'tableName':_0xe6fb('0xc'),'paranoid':![],'indexes':[{'name':_0xe6fb('0xd'),'fields':[_0xe6fb('0xe'),'FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xcc38=['moment','bluebird','request-promise','path','../../config/environment','./intDynamics365Field.attributes','Dynamics365Field','int_dynamics365_fields','dynamics365_unique_index','idField','FieldId','lodash','util','../../config/logger'];(function(_0x565678,_0x2e7b1e){var _0x3c6da3=function(_0x40013e){while(--_0x40013e){_0x565678['push'](_0x565678['shift']());}};_0x3c6da3(++_0x2e7b1e);}(_0xcc38,0x169));var _0x8cc3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xcc38[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8cc3('0x0'));var util=require(_0x8cc3('0x1'));var logger=require(_0x8cc3('0x2'))('api');var moment=require(_0x8cc3('0x3'));var BPromise=require(_0x8cc3('0x4'));var rp=require(_0x8cc3('0x5'));var fs=require('fs');var path=require(_0x8cc3('0x6'));var rimraf=require('rimraf');var config=require(_0x8cc3('0x7'));var attributes=require(_0x8cc3('0x8'));module['exports']=function(_0x299054,_0x1f5700){return _0x299054['define'](_0x8cc3('0x9'),attributes,{'tableName':_0x8cc3('0xa'),'paranoid':![],'indexes':[{'name':_0x8cc3('0xb'),'fields':[_0x8cc3('0xc'),_0x8cc3('0xd')],'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 af4ba7d..e49f355 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 _0xb63a=['debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Field,\x20%s,\x20%s','request\x20sent'];(function(_0x3b5b94,_0x1b1d80){var _0x507e9e=function(_0x2375e3){while(--_0x2375e3){_0x3b5b94['push'](_0x3b5b94['shift']());}};_0x507e9e(++_0x1b1d80);}(_0xb63a,0x85));var _0xab63=function(_0x1177d5,_0x22b649){_0x1177d5=_0x1177d5-0x0;var _0xc3ddc2=_0xb63a[_0x1177d5];return _0xc3ddc2;};'use strict';var _=require('lodash');var util=require(_0xab63('0x0'));var moment=require('moment');var BPromise=require(_0xab63('0x1'));var rs=require(_0xab63('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xab63('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xab63('0x4'))(_0xab63('0x5'));var config=require(_0xab63('0x6'));var jayson=require(_0xab63('0x7'));var client=jayson[_0xab63('0x8')][_0xab63('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x58751a,_0xedcfc0,_0xcf00b8){return new BPromise(function(_0x4d3c27,_0xb4ed18){return client[_0xab63('0xa')](_0x58751a,_0xcf00b8)[_0xab63('0xb')](function(_0x53c8f2){logger['info'](_0xab63('0xc'),_0xedcfc0,_0xab63('0xd'));logger[_0xab63('0xe')](_0xab63('0xf'),_0xedcfc0,_0xab63('0xd'),JSON['stringify'](_0x53c8f2));if(_0x53c8f2[_0xab63('0x10')]){if(_0x53c8f2[_0xab63('0x10')]['code']===0x1f4){logger['error'](_0xab63('0xc'),_0xedcfc0,_0x53c8f2[_0xab63('0x10')][_0xab63('0x11')]);return _0xb4ed18(_0x53c8f2['error']['message']);}logger['error'](_0xab63('0xc'),_0xedcfc0,_0x53c8f2[_0xab63('0x10')][_0xab63('0x11')]);return _0x4d3c27(_0x53c8f2[_0xab63('0x10')][_0xab63('0x11')]);}else{logger[_0xab63('0x12')]('Dynamics365Field,\x20%s,\x20%s',_0xedcfc0,_0xab63('0xd'));_0x4d3c27(_0x53c8f2[_0xab63('0x13')][_0xab63('0x11')]);}})[_0xab63('0x14')](function(_0x3ecaf0){logger[_0xab63('0x10')](_0xab63('0xc'),_0xedcfc0,_0x3ecaf0);_0xb4ed18(_0x3ecaf0);});});} \ No newline at end of file +var _0x14cb=['message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x2aed86,_0x1aecb1){var _0x1a1495=function(_0x148109){while(--_0x148109){_0x2aed86['push'](_0x2aed86['shift']());}};_0x1a1495(++_0x1aecb1);}(_0x14cb,0x121));var _0xb14c=function(_0x2b167a,_0x7e4a39){_0x2b167a=_0x2b167a-0x0;var _0x2d1293=_0x14cb[_0x2b167a];return _0x2d1293;};'use strict';var _=require(_0xb14c('0x0'));var util=require(_0xb14c('0x1'));var moment=require(_0xb14c('0x2'));var BPromise=require('bluebird');var rs=require(_0xb14c('0x3'));var fs=require('fs');var Redis=require(_0xb14c('0x4'));var db=require(_0xb14c('0x5'))['db'];var utils=require(_0xb14c('0x6'));var logger=require('../../config/logger')(_0xb14c('0x7'));var config=require('../../config/environment');var jayson=require(_0xb14c('0x8'));var client=jayson[_0xb14c('0x9')][_0xb14c('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a6be1,_0x6ed4b9,_0x4fa3f4){return new BPromise(function(_0x209744,_0x2be891){return client['request'](_0x5a6be1,_0x4fa3f4)[_0xb14c('0xb')](function(_0x532785){logger[_0xb14c('0xc')](_0xb14c('0xd'),_0x6ed4b9,_0xb14c('0xe'));logger[_0xb14c('0xf')](_0xb14c('0x10'),_0x6ed4b9,'request\x20sent',JSON['stringify'](_0x532785));if(_0x532785[_0xb14c('0x11')]){if(_0x532785[_0xb14c('0x11')][_0xb14c('0x12')]===0x1f4){logger[_0xb14c('0x11')](_0xb14c('0xd'),_0x6ed4b9,_0x532785[_0xb14c('0x11')]['message']);return _0x2be891(_0x532785['error'][_0xb14c('0x13')]);}logger[_0xb14c('0x11')](_0xb14c('0xd'),_0x6ed4b9,_0x532785[_0xb14c('0x11')][_0xb14c('0x13')]);return _0x209744(_0x532785[_0xb14c('0x11')][_0xb14c('0x13')]);}else{logger[_0xb14c('0xc')](_0xb14c('0xd'),_0x6ed4b9,_0xb14c('0xe'));_0x209744(_0x532785[_0xb14c('0x14')][_0xb14c('0x13')]);}})[_0xb14c('0x15')](function(_0xe8cbd4){logger[_0xb14c('0x11')](_0xb14c('0xd'),_0x6ed4b9,_0xe8cbd4);_0x2be891(_0xe8cbd4);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 80119ee..4f7e2b6 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 _0x1fac=['get','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','/:id','update','delete','exports','util','connect-timeout','express','fs-extra','../../components/interaction/service','isAuthenticated','index','show'];(function(_0xf6d69a,_0x4e0c67){var _0x21eda7=function(_0x2555d7){while(--_0x2555d7){_0xf6d69a['push'](_0xf6d69a['shift']());}};_0x21eda7(++_0x4e0c67);}(_0x1fac,0x14c));var _0xc1fa=function(_0x31030b,_0x1a822f){_0x31030b=_0x31030b-0x0;var _0xa60384=_0x1fac[_0x31030b];return _0xa60384;};'use strict';var multer=require('multer');var util=require(_0xc1fa('0x0'));var path=require('path');var timeout=require(_0xc1fa('0x1'));var express=require(_0xc1fa('0x2'));var router=express['Router']();var fs_extra=require(_0xc1fa('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0xc1fa('0x4'));var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router['get']('/',auth[_0xc1fa('0x5')](),controller[_0xc1fa('0x6')]);router['get']('/:id',auth[_0xc1fa('0x5')](),controller[_0xc1fa('0x7')]);router[_0xc1fa('0x8')](_0xc1fa('0x9'),auth[_0xc1fa('0x5')](),controller[_0xc1fa('0xa')]);router[_0xc1fa('0x8')](_0xc1fa('0xb'),auth[_0xc1fa('0x5')](),controller[_0xc1fa('0xc')]);router[_0xc1fa('0xd')]('/',auth[_0xc1fa('0x5')](),controller['create']);router['post'](_0xc1fa('0x9'),auth[_0xc1fa('0x5')](),controller[_0xc1fa('0xe')]);router[_0xc1fa('0xf')](_0xc1fa('0x10'),auth[_0xc1fa('0x5')](),controller[_0xc1fa('0x11')]);router[_0xc1fa('0x12')](_0xc1fa('0x10'),auth[_0xc1fa('0x5')](),controller['destroy']);module[_0xc1fa('0x13')]=router; \ No newline at end of file +var _0xf9d4=['addConfiguration','put','update','delete','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','index','get','/:id','show','/:id/fields','isAuthenticated','getFields','create','post','/:id/configurations'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0xf9d4,0x1b4));var _0x4f9d=function(_0x3940b4,_0x527331){_0x3940b4=_0x3940b4-0x0;var _0x590ddd=_0xf9d4[_0x3940b4];return _0x590ddd;};'use strict';var multer=require(_0x4f9d('0x0'));var util=require(_0x4f9d('0x1'));var path=require(_0x4f9d('0x2'));var timeout=require(_0x4f9d('0x3'));var express=require(_0x4f9d('0x4'));var router=express[_0x4f9d('0x5')]();var fs_extra=require(_0x4f9d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x4f9d('0x7'));var config=require(_0x4f9d('0x8'));var controller=require(_0x4f9d('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x4f9d('0xa')]);router[_0x4f9d('0xb')](_0x4f9d('0xc'),auth['isAuthenticated'](),controller[_0x4f9d('0xd')]);router['get']('/:id/configurations',auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x4f9d('0xe'),auth[_0x4f9d('0xf')](),controller[_0x4f9d('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x4f9d('0x11')]);router[_0x4f9d('0x12')](_0x4f9d('0x13'),auth[_0x4f9d('0xf')](),controller[_0x4f9d('0x14')]);router[_0x4f9d('0x15')](_0x4f9d('0xc'),auth[_0x4f9d('0xf')](),controller[_0x4f9d('0x16')]);router[_0x4f9d('0x17')](_0x4f9d('0xc'),auth[_0x4f9d('0xf')](),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 f64231c..0418252 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 _0x8952=['username','remoteUri','exports','STRING'];(function(_0x2cb642,_0x248ad5){var _0x346dad=function(_0x1905fb){while(--_0x1905fb){_0x2cb642['push'](_0x2cb642['shift']());}};_0x346dad(++_0x248ad5);}(_0x8952,0x17e));var _0x2895=function(_0x492b75,_0x167e95){_0x492b75=_0x492b75-0x0;var _0x1b2dde=_0x8952[_0x492b75];return _0x1b2dde;};'use strict';var Sequelize=require('sequelize');module[_0x2895('0x0')]={'name':{'type':Sequelize[_0x2895('0x1')]},'description':{'type':Sequelize[_0x2895('0x1')]},'username':{'type':Sequelize[_0x2895('0x1')],'unique':_0x2895('0x2')},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x2895('0x1')],'unique':_0x2895('0x3')},'serverUrl':{'type':Sequelize[_0x2895('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xd117=['remoteUri','sequelize','exports','STRING','username'];(function(_0x9b2ae0,_0x487c9b){var _0x462bb9=function(_0x26a267){while(--_0x26a267){_0x9b2ae0['push'](_0x9b2ae0['shift']());}};_0x462bb9(++_0x487c9b);}(_0xd117,0x182));var _0x7d11=function(_0x318dda,_0x1aa800){_0x318dda=_0x318dda-0x0;var _0x3f97ca=_0xd117[_0x318dda];return _0x3f97ca;};'use strict';var Sequelize=require(_0x7d11('0x0'));module[_0x7d11('0x1')]={'name':{'type':Sequelize[_0x7d11('0x2')]},'description':{'type':Sequelize[_0x7d11('0x2')]},'username':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x3')},'apiKey':{'type':Sequelize[_0x7d11('0x2')]},'remoteUri':{'type':Sequelize[_0x7d11('0x2')],'unique':_0x7d11('0x4')},'serverUrl':{'type':Sequelize[_0x7d11('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 38e7f38..86c41be 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 _0xb299=['attributes','model','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','options','includeAll','include','catch','show','params','keys','create','find','getConfigurations','findOne','FreshdeskConfiguration','nolimit','addConfiguration','body','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','remoteUri','apiKey','slice','substring','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','toString','base64','requester','agent','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','name','send','index','map','FreshdeskAccount','rawAttributes','fieldName','type','key','intersection','query'];(function(_0x18572b,_0x3404eb){var _0x36f1d9=function(_0xbf4757){while(--_0xbf4757){_0x18572b['push'](_0x18572b['shift']());}};_0x36f1d9(++_0x3404eb);}(_0xb299,0x19b));var _0x9b29=function(_0x4e1d7c,_0x4b4abf){_0x4e1d7c=_0x4e1d7c-0x0;var _0x52b7d4=_0xb299[_0x4e1d7c];return _0x52b7d4;};'use strict';var emlformat=require(_0x9b29('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9b29('0x1'));var jsonpatch=require(_0x9b29('0x2'));var rp=require(_0x9b29('0x3'));var moment=require(_0x9b29('0x4'));var BPromise=require(_0x9b29('0x5'));var Mustache=require(_0x9b29('0x6'));var util=require(_0x9b29('0x7'));var path=require('path');var sox=require(_0x9b29('0x8'));var csv=require(_0x9b29('0x9'));var ejs=require(_0x9b29('0xa'));var fs=require('fs');var fs_extra=require(_0x9b29('0xb'));var _=require(_0x9b29('0xc'));var squel=require(_0x9b29('0xd'));var crypto=require(_0x9b29('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x9b29('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9b29('0x10'));var Redis=require(_0x9b29('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9b29('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9b29('0x13'));var logger=require(_0x9b29('0x14'))(_0x9b29('0x15'));var utils=require('../../config/utils');var config=require(_0x9b29('0x16'));var licenseUtil=require(_0x9b29('0x17'));var db=require(_0x9b29('0x18'))['db'];var integrations=require(_0x9b29('0x19'));function respondWithStatusCode(_0x35da05,_0x353308){_0x353308=_0x353308||0xcc;return function(_0x2479a2){if(_0x2479a2){return _0x35da05[_0x9b29('0x1a')](_0x353308);}return _0x35da05[_0x9b29('0x1b')](_0x353308)[_0x9b29('0x1c')]();};}function respondWithResult(_0x370f86,_0x292a5f){_0x292a5f=_0x292a5f||0xc8;return function(_0x355806){if(_0x355806){return _0x370f86[_0x9b29('0x1b')](_0x292a5f)[_0x9b29('0x1d')](_0x355806);}};}function respondWithFilteredResult(_0x2e5976,_0x4773c3){return function(_0x45b857){if(_0x45b857){var _0x31d9a1=typeof _0x4773c3[_0x9b29('0x1e')]===_0x9b29('0x1f')&&typeof _0x4773c3[_0x9b29('0x20')]==='undefined';var _0x48d3b4=_0x45b857['count'];var _0xf8967d=_0x31d9a1?0x0:_0x4773c3[_0x9b29('0x1e')];var _0x24d45d=_0x31d9a1?_0x45b857[_0x9b29('0x21')]:_0x4773c3[_0x9b29('0x1e')]+_0x4773c3[_0x9b29('0x20')];var _0x12c2e4;if(_0x24d45d>=_0x48d3b4){_0x24d45d=_0x48d3b4;_0x12c2e4=0xc8;}else{_0x12c2e4=0xce;}_0x2e5976[_0x9b29('0x1b')](_0x12c2e4);return _0x2e5976[_0x9b29('0x22')](_0x9b29('0x23'),_0xf8967d+'-'+_0x24d45d+'/'+_0x48d3b4)['json'](_0x45b857);}return null;};}function patchUpdates(_0x598d3f){return function(_0xdebf3e){try{jsonpatch[_0x9b29('0x24')](_0xdebf3e,_0x598d3f,!![]);}catch(_0x7b8615){return BPromise[_0x9b29('0x25')](_0x7b8615);}return _0xdebf3e[_0x9b29('0x26')]();};}function saveUpdates(_0x389f27,_0x90a182){return function(_0x3ab389){if(_0x3ab389){return _0x3ab389[_0x9b29('0x27')](_0x389f27)[_0x9b29('0x28')](function(_0x4802f7){return _0x4802f7;});}return null;};}function removeEntity(_0x1d6743,_0x1861a4){return function(_0xeebf6c){if(_0xeebf6c){return _0xeebf6c['destroy']()[_0x9b29('0x28')](function(){_0x1d6743['status'](0xcc)[_0x9b29('0x1c')]();});}};}function handleEntityNotFound(_0x3d05fc,_0x48b85d){return function(_0x4ef61f){if(!_0x4ef61f){_0x3d05fc[_0x9b29('0x1a')](0x194);}return _0x4ef61f;};}function handleError(_0x405f2d,_0x50ea3d){_0x50ea3d=_0x50ea3d||0x1f4;return function(_0x3fa7b6){logger[_0x9b29('0x29')](_0x3fa7b6['stack']);if(_0x3fa7b6[_0x9b29('0x2a')]){delete _0x3fa7b6[_0x9b29('0x2a')];}_0x405f2d[_0x9b29('0x1b')](_0x50ea3d)[_0x9b29('0x2b')](_0x3fa7b6);};}exports[_0x9b29('0x2c')]=function(_0x49025f,_0x25a000){var _0x3cee24={},_0x36fb08={},_0x386c65={'count':0x0,'rows':[]};var _0x512e71=_[_0x9b29('0x2d')](db[_0x9b29('0x2e')][_0x9b29('0x2f')],function(_0x2fe6a5){return{'name':_0x2fe6a5[_0x9b29('0x30')],'type':_0x2fe6a5[_0x9b29('0x31')][_0x9b29('0x32')]};});_0x36fb08['model']=_[_0x9b29('0x2d')](_0x512e71,_0x9b29('0x2a'));_0x36fb08['query']=_['keys'](_0x49025f['query']);_0x36fb08['filters']=_[_0x9b29('0x33')](_0x36fb08['model'],_0x36fb08[_0x9b29('0x34')]);_0x3cee24[_0x9b29('0x35')]=_[_0x9b29('0x33')](_0x36fb08[_0x9b29('0x36')],qs[_0x9b29('0x37')](_0x49025f[_0x9b29('0x34')][_0x9b29('0x37')]));_0x3cee24['attributes']=_0x3cee24['attributes'][_0x9b29('0x38')]?_0x3cee24[_0x9b29('0x35')]:_0x36fb08[_0x9b29('0x36')];if(!_0x49025f[_0x9b29('0x34')][_0x9b29('0x39')]('nolimit')){_0x3cee24[_0x9b29('0x20')]=qs['limit'](_0x49025f['query'][_0x9b29('0x20')]);_0x3cee24[_0x9b29('0x1e')]=qs[_0x9b29('0x1e')](_0x49025f[_0x9b29('0x34')][_0x9b29('0x1e')]);}_0x3cee24[_0x9b29('0x3a')]=qs[_0x9b29('0x3b')](_0x49025f[_0x9b29('0x34')]['sort']);_0x3cee24[_0x9b29('0x3c')]=qs[_0x9b29('0x3d')](_[_0x9b29('0x3e')](_0x49025f[_0x9b29('0x34')],_0x36fb08[_0x9b29('0x3d')]),_0x512e71);if(_0x49025f[_0x9b29('0x34')][_0x9b29('0x3f')]){_0x3cee24[_0x9b29('0x3c')]=_[_0x9b29('0x40')](_0x3cee24[_0x9b29('0x3c')],{'$or':_[_0x9b29('0x2d')](_0x512e71,function(_0x1b7250){if(_0x1b7250[_0x9b29('0x31')]!=='VIRTUAL'){var _0x3a4699={};_0x3a4699[_0x1b7250[_0x9b29('0x2a')]]={'$like':'%'+_0x49025f[_0x9b29('0x34')]['filter']+'%'};return _0x3a4699;}})});}_0x3cee24=_[_0x9b29('0x40')]({},_0x3cee24,_0x49025f[_0x9b29('0x41')]);var _0x3620d9={'where':_0x3cee24['where']};return db[_0x9b29('0x2e')]['count'](_0x3620d9)[_0x9b29('0x28')](function(_0x8e91ed){_0x386c65['count']=_0x8e91ed;if(_0x49025f['query'][_0x9b29('0x42')]){_0x3cee24[_0x9b29('0x43')]=[{'all':!![]}];}return db[_0x9b29('0x2e')]['findAll'](_0x3cee24);})[_0x9b29('0x28')](function(_0x5a79fa){_0x386c65['rows']=_0x5a79fa;return _0x386c65;})[_0x9b29('0x28')](respondWithFilteredResult(_0x25a000,_0x3cee24))[_0x9b29('0x44')](handleError(_0x25a000,null));};exports[_0x9b29('0x45')]=function(_0x2d6be6,_0x59c3b0){var _0x6e0a00={'raw':![],'where':{'id':_0x2d6be6[_0x9b29('0x46')]['id']}},_0x116cb0={};_0x116cb0[_0x9b29('0x36')]=_['keys'](db['FreshdeskAccount'][_0x9b29('0x2f')]);_0x116cb0[_0x9b29('0x34')]=_[_0x9b29('0x47')](_0x2d6be6['query']);_0x116cb0[_0x9b29('0x3d')]=_[_0x9b29('0x33')](_0x116cb0[_0x9b29('0x36')],_0x116cb0['query']);_0x6e0a00[_0x9b29('0x35')]=_[_0x9b29('0x33')](_0x116cb0[_0x9b29('0x36')],qs[_0x9b29('0x37')](_0x2d6be6[_0x9b29('0x34')]['fields']));_0x6e0a00[_0x9b29('0x35')]=_0x6e0a00[_0x9b29('0x35')][_0x9b29('0x38')]?_0x6e0a00['attributes']:_0x116cb0[_0x9b29('0x36')];if(_0x2d6be6[_0x9b29('0x34')][_0x9b29('0x42')]){_0x6e0a00['include']=[{'all':!![]}];}_0x6e0a00=_[_0x9b29('0x40')]({},_0x6e0a00,_0x2d6be6[_0x9b29('0x41')]);return db[_0x9b29('0x2e')]['find'](_0x6e0a00)['then'](handleEntityNotFound(_0x59c3b0,null))['then'](respondWithResult(_0x59c3b0,null))[_0x9b29('0x44')](handleError(_0x59c3b0,null));};exports[_0x9b29('0x48')]=function(_0x31fcf9,_0x13d87d){return db[_0x9b29('0x2e')]['create'](_0x31fcf9['body'],{})[_0x9b29('0x28')](respondWithResult(_0x13d87d,0xc9))[_0x9b29('0x44')](handleError(_0x13d87d,null));};exports[_0x9b29('0x27')]=function(_0x50500e,_0x43508a){if(_0x50500e['body']['id']){delete _0x50500e['body']['id'];}return db[_0x9b29('0x2e')][_0x9b29('0x49')]({'where':{'id':_0x50500e[_0x9b29('0x46')]['id']}})[_0x9b29('0x28')](handleEntityNotFound(_0x43508a,null))[_0x9b29('0x28')](saveUpdates(_0x50500e['body'],null))['then'](respondWithResult(_0x43508a,null))['catch'](handleError(_0x43508a,null));};exports['destroy']=function(_0x2eb99c,_0x225c55){return db[_0x9b29('0x2e')][_0x9b29('0x49')]({'where':{'id':_0x2eb99c[_0x9b29('0x46')]['id']}})[_0x9b29('0x28')](handleEntityNotFound(_0x225c55,null))['then'](removeEntity(_0x225c55,null))[_0x9b29('0x44')](handleError(_0x225c55,null));};exports[_0x9b29('0x4a')]=function(_0x1fd72a,_0x4b53b2,_0x2088b9){var _0x193287={};var _0xab0b76={};var _0x16206c;var _0x3ac328;return db[_0x9b29('0x2e')][_0x9b29('0x4b')]({'where':{'id':_0x1fd72a[_0x9b29('0x46')]['id']}})[_0x9b29('0x28')](handleEntityNotFound(_0x4b53b2,null))['then'](function(_0x46484c){if(_0x46484c){_0x16206c=_0x46484c;_0xab0b76[_0x9b29('0x36')]=_[_0x9b29('0x47')](db[_0x9b29('0x4c')][_0x9b29('0x2f')]);_0xab0b76[_0x9b29('0x34')]=_[_0x9b29('0x47')](_0x1fd72a[_0x9b29('0x34')]);_0xab0b76[_0x9b29('0x3d')]=_[_0x9b29('0x33')](_0xab0b76[_0x9b29('0x36')],_0xab0b76[_0x9b29('0x34')]);_0x193287[_0x9b29('0x35')]=_['intersection'](_0xab0b76['model'],qs[_0x9b29('0x37')](_0x1fd72a[_0x9b29('0x34')]['fields']));_0x193287[_0x9b29('0x35')]=_0x193287[_0x9b29('0x35')][_0x9b29('0x38')]?_0x193287[_0x9b29('0x35')]:_0xab0b76[_0x9b29('0x36')];_0x193287[_0x9b29('0x3a')]=qs[_0x9b29('0x3b')](_0x1fd72a[_0x9b29('0x34')]['sort']);_0x193287['where']=qs[_0x9b29('0x3d')](_[_0x9b29('0x3e')](_0x1fd72a[_0x9b29('0x34')],_0xab0b76[_0x9b29('0x3d')]));if(_0x1fd72a['query'][_0x9b29('0x3f')]){_0x193287[_0x9b29('0x3c')]=_[_0x9b29('0x40')](_0x193287[_0x9b29('0x3c')],{'$or':_[_0x9b29('0x2d')](_0x193287[_0x9b29('0x35')],function(_0x82e152){var _0x297b75={};_0x297b75[_0x82e152]={'$like':'%'+_0x1fd72a[_0x9b29('0x34')][_0x9b29('0x3f')]+'%'};return _0x297b75;})});}_0x193287=_[_0x9b29('0x40')]({},_0x193287,_0x1fd72a['options']);return _0x16206c[_0x9b29('0x4a')](_0x193287);}})['then'](function(_0x28c5e9){if(_0x28c5e9){_0x3ac328=_0x28c5e9['length'];if(!_0x1fd72a[_0x9b29('0x34')][_0x9b29('0x39')](_0x9b29('0x4d'))){_0x193287[_0x9b29('0x20')]=qs[_0x9b29('0x20')](_0x1fd72a[_0x9b29('0x34')][_0x9b29('0x20')]);_0x193287[_0x9b29('0x1e')]=qs['offset'](_0x1fd72a[_0x9b29('0x34')][_0x9b29('0x1e')]);}return _0x16206c[_0x9b29('0x4a')](_0x193287);}})[_0x9b29('0x28')](function(_0x5a68b5){if(_0x5a68b5){return _0x5a68b5?{'count':_0x3ac328,'rows':_0x5a68b5}:null;}})[_0x9b29('0x28')](respondWithResult(_0x4b53b2,null))[_0x9b29('0x44')](handleError(_0x4b53b2,null));};exports[_0x9b29('0x4e')]=function(_0x3e9ff8,_0x1c37ad,_0x11036f){if(_0x3e9ff8[_0x9b29('0x4f')]['id']){delete _0x3e9ff8[_0x9b29('0x4f')]['id'];}return db[_0x9b29('0x2e')][_0x9b29('0x4b')]({'where':{'id':_0x3e9ff8['params']['id']}})[_0x9b29('0x28')](handleEntityNotFound(_0x1c37ad,null))[_0x9b29('0x28')](function(_0x478838){if(_0x478838){_0x3e9ff8[_0x9b29('0x4f')]['AccountId']=_0x478838['id'];_0x3e9ff8[_0x9b29('0x4f')][_0x9b29('0x50')]=integrations[_0x9b29('0x51')](_0x3e9ff8[_0x9b29('0x4f')][_0x9b29('0x52')],_0x3e9ff8[_0x9b29('0x4f')][_0x9b29('0x31')]);_0x3e9ff8[_0x9b29('0x4f')]['Descriptions']=integrations[_0x9b29('0x53')](_0x3e9ff8[_0x9b29('0x4f')]['channel'],_0x3e9ff8['body'][_0x9b29('0x31')]);return db[_0x9b29('0x4c')][_0x9b29('0x48')](_0x3e9ff8['body'],{'include':[{'model':db['FreshdeskField'],'as':_0x9b29('0x50')},{'model':db[_0x9b29('0x54')],'as':_0x9b29('0x55')}]});}return null;})[_0x9b29('0x28')](respondWithResult(_0x1c37ad,null))[_0x9b29('0x44')](handleError(_0x1c37ad,null));};exports['getFields']=function(_0x4248af,_0x4cd0bb,_0x48aa19){var _0x18eb00='';return db['FreshdeskAccount'][_0x9b29('0x4b')]({'where':{'id':_0x4248af[_0x9b29('0x46')]['id']},'attributes':['id',_0x9b29('0x56'),_0x9b29('0x57')]})[_0x9b29('0x28')](handleEntityNotFound(_0x4cd0bb,null))[_0x9b29('0x28')](function(_0x196bb1){if(_0x196bb1){_0x18eb00=_0x196bb1[_0x9b29('0x56')];var _0x5563f7=_0x18eb00[_0x9b29('0x58')](-0x1);if(_0x5563f7==='/'){_0x18eb00=_0x18eb00[_0x9b29('0x59')](0x0,_0x18eb00['lastIndexOf'](_0x5563f7));}return rp({'method':_0x9b29('0x5a'),'uri':util[_0x9b29('0x5b')](_0x9b29('0x5c'),_0x18eb00,_0x9b29('0x5d')),'headers':{'Authorization':util[_0x9b29('0x5b')](_0x9b29('0x5e'),new Buffer(util[_0x9b29('0x5b')](_0x9b29('0x5f'),_0x196bb1[_0x9b29('0x57')]))[_0x9b29('0x60')](_0x9b29('0x61')))},'json':!![]});}})[_0x9b29('0x28')](function(_0x514921){if(_0x514921){var _0x5d931b=[_0x9b29('0x62'),'subject',_0x9b29('0x63'),'description',_0x9b29('0x1b'),'priority',_0x9b29('0x64'),_0x9b29('0x65'),_0x9b29('0x66'),_0x9b29('0x64'),'company'];_[_0x9b29('0x67')](_0x514921,function(_0x2332e7){return _0x5d931b[_0x9b29('0x68')](_0x2332e7[_0x9b29('0x2a')])||!_0x2332e7[_0x9b29('0x69')]&&_0x2332e7[_0x9b29('0x31')]!==_0x9b29('0x6a')&&_0x2332e7[_0x9b29('0x31')]!==_0x9b29('0x6b');});return{'count':_0x514921[_0x9b29('0x38')],'rows':_['map'](_0x514921,function(_0x37e6f0){return{'id':_0x37e6f0['name'],'name':_0x37e6f0[_0x9b29('0x6c')],'custom':!_0x37e6f0['default'],'options':_0x37e6f0['choices']?_[_0x9b29('0x2d')](_0x37e6f0[_0x9b29('0x6d')],function(_0x10c151){return{'name':_[_0x9b29('0x6e')](_0x10c151),'value':_0x10c151};}):[]};})};}})['then'](respondWithResult(_0x4cd0bb,null))[_0x9b29('0x44')](function(_0x43cdf2){var _0x3a00fc=_0x4248af[_0x9b29('0x34')][_0x9b29('0x6f')]?0x1f4:_0x43cdf2[_0x9b29('0x70')]||0x1f4;logger['error'](_0x9b29('0x71'),_0x9b29('0x72'),_0x3a00fc,JSON[_0x9b29('0x73')](_0x43cdf2));delete _0x43cdf2[_0x9b29('0x2a')];if(_0x3a00fc===0x191){_0x3a00fc=0x190;}_0x4cd0bb['status'](_0x3a00fc)[_0x9b29('0x2b')](_0x4248af[_0x9b29('0x34')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x43cdf2[_0x9b29('0x70')]}:_0x43cdf2);});}; \ No newline at end of file +var _0x765b=['path','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','name','index','FreshdeskAccount','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','merge','map','filter','options','includeAll','include','findAll','catch','show','find','create','body','update','getConfigurations','findOne','params','hasOwnProperty','addConfiguration','Subjects','Descriptions','channel','FreshdeskConfiguration','FreshdeskField','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s:X','toString','requester','subject','agent','priority','group','source','ticket_type','remove','includes','custom_text','custom_dropdown','choices','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','fast-json-patch','moment','mustache','util'];(function(_0x2405b6,_0x5be88c){var _0x5eaa81=function(_0x42abb4){while(--_0x42abb4){_0x2405b6['push'](_0x2405b6['shift']());}};_0x5eaa81(++_0x5be88c);}(_0x765b,0x18c));var _0xb765=function(_0x1ebc6c,_0x58a00b){_0x1ebc6c=_0x1ebc6c-0x0;var _0x3a826d=_0x765b[_0x1ebc6c];return _0x3a826d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb765('0x0'));var rp=require('request-promise');var moment=require(_0xb765('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xb765('0x2'));var util=require(_0xb765('0x3'));var path=require(_0xb765('0x4'));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(_0xb765('0x5'));var squel=require('squel');var crypto=require(_0xb765('0x6'));var jsforce=require(_0xb765('0x7'));var deskjs=require(_0xb765('0x8'));var toCsv=require('to-csv');var querystring=require(_0xb765('0x9'));var Papa=require(_0xb765('0xa'));var Redis=require(_0xb765('0xb'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb765('0xc'));var logger=require(_0xb765('0xd'))(_0xb765('0xe'));var utils=require(_0xb765('0xf'));var config=require('../../config/environment');var licenseUtil=require(_0xb765('0x10'));var db=require(_0xb765('0x11'))['db'];var integrations=require(_0xb765('0x12'));function respondWithStatusCode(_0x3f9acb,_0x38ee06){_0x38ee06=_0x38ee06||0xcc;return function(_0xadac12){if(_0xadac12){return _0x3f9acb[_0xb765('0x13')](_0x38ee06);}return _0x3f9acb[_0xb765('0x14')](_0x38ee06)[_0xb765('0x15')]();};}function respondWithResult(_0x4d8eff,_0x2aebdb){_0x2aebdb=_0x2aebdb||0xc8;return function(_0x5d8852){if(_0x5d8852){return _0x4d8eff[_0xb765('0x14')](_0x2aebdb)[_0xb765('0x16')](_0x5d8852);}};}function respondWithFilteredResult(_0x4cecc1,_0x4b8e26){return function(_0x3f73f4){if(_0x3f73f4){var _0x2ab6b8=typeof _0x4b8e26[_0xb765('0x17')]===_0xb765('0x18')&&typeof _0x4b8e26[_0xb765('0x19')]===_0xb765('0x18');var _0x9bd542=_0x3f73f4[_0xb765('0x1a')];var _0x5c182f=_0x2ab6b8?0x0:_0x4b8e26[_0xb765('0x17')];var _0x132aab=_0x2ab6b8?_0x3f73f4[_0xb765('0x1a')]:_0x4b8e26[_0xb765('0x17')]+_0x4b8e26[_0xb765('0x19')];var _0x360b9e;if(_0x132aab>=_0x9bd542){_0x132aab=_0x9bd542;_0x360b9e=0xc8;}else{_0x360b9e=0xce;}_0x4cecc1[_0xb765('0x14')](_0x360b9e);return _0x4cecc1[_0xb765('0x1b')](_0xb765('0x1c'),_0x5c182f+'-'+_0x132aab+'/'+_0x9bd542)[_0xb765('0x16')](_0x3f73f4);}return null;};}function patchUpdates(_0x44936d){return function(_0x1b1184){try{jsonpatch['apply'](_0x1b1184,_0x44936d,!![]);}catch(_0x5d72a1){return BPromise[_0xb765('0x1d')](_0x5d72a1);}return _0x1b1184['save']();};}function saveUpdates(_0x3d69c7,_0x2e0196){return function(_0x461da8){if(_0x461da8){return _0x461da8['update'](_0x3d69c7)[_0xb765('0x1e')](function(_0x1a740c){return _0x1a740c;});}return null;};}function removeEntity(_0x5d1ea0,_0x3a05b1){return function(_0x3684e8){if(_0x3684e8){return _0x3684e8[_0xb765('0x1f')]()[_0xb765('0x1e')](function(){_0x5d1ea0['status'](0xcc)[_0xb765('0x15')]();});}};}function handleEntityNotFound(_0x6a5457,_0x4e12b8){return function(_0x4dc7d1){if(!_0x4dc7d1){_0x6a5457[_0xb765('0x13')](0x194);}return _0x4dc7d1;};}function handleError(_0x4715d7,_0x1c561a){_0x1c561a=_0x1c561a||0x1f4;return function(_0x562bd3){logger['error'](_0x562bd3['stack']);if(_0x562bd3[_0xb765('0x20')]){delete _0x562bd3[_0xb765('0x20')];}_0x4715d7[_0xb765('0x14')](_0x1c561a)['send'](_0x562bd3);};}exports[_0xb765('0x21')]=function(_0x3c7206,_0x48a84a){var _0x2842c2={},_0xe9f0b9={},_0x439162={'count':0x0,'rows':[]};var _0x5ce321=_['map'](db[_0xb765('0x22')][_0xb765('0x23')],function(_0x1d8970){return{'name':_0x1d8970['fieldName'],'type':_0x1d8970[_0xb765('0x24')][_0xb765('0x25')]};});_0xe9f0b9['model']=_['map'](_0x5ce321,_0xb765('0x20'));_0xe9f0b9[_0xb765('0x26')]=_[_0xb765('0x27')](_0x3c7206[_0xb765('0x26')]);_0xe9f0b9[_0xb765('0x28')]=_[_0xb765('0x29')](_0xe9f0b9[_0xb765('0x2a')],_0xe9f0b9['query']);_0x2842c2[_0xb765('0x2b')]=_[_0xb765('0x29')](_0xe9f0b9[_0xb765('0x2a')],qs[_0xb765('0x2c')](_0x3c7206['query']['fields']));_0x2842c2['attributes']=_0x2842c2[_0xb765('0x2b')][_0xb765('0x2d')]?_0x2842c2['attributes']:_0xe9f0b9[_0xb765('0x2a')];if(!_0x3c7206['query']['hasOwnProperty'](_0xb765('0x2e'))){_0x2842c2[_0xb765('0x19')]=qs['limit'](_0x3c7206[_0xb765('0x26')][_0xb765('0x19')]);_0x2842c2['offset']=qs[_0xb765('0x17')](_0x3c7206[_0xb765('0x26')][_0xb765('0x17')]);}_0x2842c2[_0xb765('0x2f')]=qs[_0xb765('0x30')](_0x3c7206[_0xb765('0x26')][_0xb765('0x30')]);_0x2842c2[_0xb765('0x31')]=qs['filters'](_[_0xb765('0x32')](_0x3c7206[_0xb765('0x26')],_0xe9f0b9['filters']),_0x5ce321);if(_0x3c7206[_0xb765('0x26')]['filter']){_0x2842c2[_0xb765('0x31')]=_[_0xb765('0x33')](_0x2842c2['where'],{'$or':_[_0xb765('0x34')](_0x5ce321,function(_0x19dbf4){if(_0x19dbf4['type']!=='VIRTUAL'){var _0x21c90e={};_0x21c90e[_0x19dbf4[_0xb765('0x20')]]={'$like':'%'+_0x3c7206[_0xb765('0x26')][_0xb765('0x35')]+'%'};return _0x21c90e;}})});}_0x2842c2=_['merge']({},_0x2842c2,_0x3c7206[_0xb765('0x36')]);var _0x25a243={'where':_0x2842c2[_0xb765('0x31')]};return db['FreshdeskAccount'][_0xb765('0x1a')](_0x25a243)[_0xb765('0x1e')](function(_0x3a46d9){_0x439162[_0xb765('0x1a')]=_0x3a46d9;if(_0x3c7206['query'][_0xb765('0x37')]){_0x2842c2[_0xb765('0x38')]=[{'all':!![]}];}return db['FreshdeskAccount'][_0xb765('0x39')](_0x2842c2);})[_0xb765('0x1e')](function(_0x29a469){_0x439162['rows']=_0x29a469;return _0x439162;})['then'](respondWithFilteredResult(_0x48a84a,_0x2842c2))[_0xb765('0x3a')](handleError(_0x48a84a,null));};exports[_0xb765('0x3b')]=function(_0x542372,_0x42a715){var _0x516b98={'raw':![],'where':{'id':_0x542372['params']['id']}},_0x4a0bd5={};_0x4a0bd5['model']=_[_0xb765('0x27')](db[_0xb765('0x22')][_0xb765('0x23')]);_0x4a0bd5[_0xb765('0x26')]=_[_0xb765('0x27')](_0x542372['query']);_0x4a0bd5[_0xb765('0x28')]=_[_0xb765('0x29')](_0x4a0bd5['model'],_0x4a0bd5[_0xb765('0x26')]);_0x516b98[_0xb765('0x2b')]=_['intersection'](_0x4a0bd5[_0xb765('0x2a')],qs[_0xb765('0x2c')](_0x542372[_0xb765('0x26')][_0xb765('0x2c')]));_0x516b98[_0xb765('0x2b')]=_0x516b98[_0xb765('0x2b')][_0xb765('0x2d')]?_0x516b98[_0xb765('0x2b')]:_0x4a0bd5[_0xb765('0x2a')];if(_0x542372['query'][_0xb765('0x37')]){_0x516b98[_0xb765('0x38')]=[{'all':!![]}];}_0x516b98=_[_0xb765('0x33')]({},_0x516b98,_0x542372['options']);return db['FreshdeskAccount'][_0xb765('0x3c')](_0x516b98)['then'](handleEntityNotFound(_0x42a715,null))[_0xb765('0x1e')](respondWithResult(_0x42a715,null))[_0xb765('0x3a')](handleError(_0x42a715,null));};exports['create']=function(_0x12eff7,_0x164dc9){return db[_0xb765('0x22')][_0xb765('0x3d')](_0x12eff7[_0xb765('0x3e')],{})[_0xb765('0x1e')](respondWithResult(_0x164dc9,0xc9))['catch'](handleError(_0x164dc9,null));};exports[_0xb765('0x3f')]=function(_0x2540fc,_0x7ae096){if(_0x2540fc[_0xb765('0x3e')]['id']){delete _0x2540fc[_0xb765('0x3e')]['id'];}return db[_0xb765('0x22')][_0xb765('0x3c')]({'where':{'id':_0x2540fc['params']['id']}})[_0xb765('0x1e')](handleEntityNotFound(_0x7ae096,null))['then'](saveUpdates(_0x2540fc[_0xb765('0x3e')],null))[_0xb765('0x1e')](respondWithResult(_0x7ae096,null))[_0xb765('0x3a')](handleError(_0x7ae096,null));};exports[_0xb765('0x1f')]=function(_0x5f37de,_0x41d67e){return db['FreshdeskAccount'][_0xb765('0x3c')]({'where':{'id':_0x5f37de['params']['id']}})[_0xb765('0x1e')](handleEntityNotFound(_0x41d67e,null))['then'](removeEntity(_0x41d67e,null))['catch'](handleError(_0x41d67e,null));};exports[_0xb765('0x40')]=function(_0x580a3d,_0x46a585,_0x405be7){var _0x39c4ca={};var _0x27cd8f={};var _0x14c3b0;var _0x3c9ace;return db['FreshdeskAccount'][_0xb765('0x41')]({'where':{'id':_0x580a3d[_0xb765('0x42')]['id']}})[_0xb765('0x1e')](handleEntityNotFound(_0x46a585,null))[_0xb765('0x1e')](function(_0x334e43){if(_0x334e43){_0x14c3b0=_0x334e43;_0x27cd8f[_0xb765('0x2a')]=_[_0xb765('0x27')](db['FreshdeskConfiguration'][_0xb765('0x23')]);_0x27cd8f[_0xb765('0x26')]=_['keys'](_0x580a3d['query']);_0x27cd8f[_0xb765('0x28')]=_[_0xb765('0x29')](_0x27cd8f[_0xb765('0x2a')],_0x27cd8f[_0xb765('0x26')]);_0x39c4ca[_0xb765('0x2b')]=_[_0xb765('0x29')](_0x27cd8f['model'],qs['fields'](_0x580a3d['query'][_0xb765('0x2c')]));_0x39c4ca[_0xb765('0x2b')]=_0x39c4ca['attributes'][_0xb765('0x2d')]?_0x39c4ca['attributes']:_0x27cd8f[_0xb765('0x2a')];_0x39c4ca[_0xb765('0x2f')]=qs[_0xb765('0x30')](_0x580a3d[_0xb765('0x26')][_0xb765('0x30')]);_0x39c4ca['where']=qs[_0xb765('0x28')](_[_0xb765('0x32')](_0x580a3d[_0xb765('0x26')],_0x27cd8f[_0xb765('0x28')]));if(_0x580a3d[_0xb765('0x26')][_0xb765('0x35')]){_0x39c4ca[_0xb765('0x31')]=_[_0xb765('0x33')](_0x39c4ca[_0xb765('0x31')],{'$or':_['map'](_0x39c4ca[_0xb765('0x2b')],function(_0x40a98a){var _0x3e76e2={};_0x3e76e2[_0x40a98a]={'$like':'%'+_0x580a3d[_0xb765('0x26')]['filter']+'%'};return _0x3e76e2;})});}_0x39c4ca=_[_0xb765('0x33')]({},_0x39c4ca,_0x580a3d[_0xb765('0x36')]);return _0x14c3b0['getConfigurations'](_0x39c4ca);}})[_0xb765('0x1e')](function(_0xd589c5){if(_0xd589c5){_0x3c9ace=_0xd589c5[_0xb765('0x2d')];if(!_0x580a3d[_0xb765('0x26')][_0xb765('0x43')]('nolimit')){_0x39c4ca[_0xb765('0x19')]=qs[_0xb765('0x19')](_0x580a3d[_0xb765('0x26')]['limit']);_0x39c4ca['offset']=qs[_0xb765('0x17')](_0x580a3d[_0xb765('0x26')][_0xb765('0x17')]);}return _0x14c3b0['getConfigurations'](_0x39c4ca);}})[_0xb765('0x1e')](function(_0x1e6b28){if(_0x1e6b28){return _0x1e6b28?{'count':_0x3c9ace,'rows':_0x1e6b28}:null;}})[_0xb765('0x1e')](respondWithResult(_0x46a585,null))[_0xb765('0x3a')](handleError(_0x46a585,null));};exports[_0xb765('0x44')]=function(_0x4a5a24,_0x1b3d82,_0x2a7296){if(_0x4a5a24[_0xb765('0x3e')]['id']){delete _0x4a5a24['body']['id'];}return db[_0xb765('0x22')][_0xb765('0x41')]({'where':{'id':_0x4a5a24[_0xb765('0x42')]['id']}})['then'](handleEntityNotFound(_0x1b3d82,null))[_0xb765('0x1e')](function(_0xf8ed84){if(_0xf8ed84){_0x4a5a24[_0xb765('0x3e')]['AccountId']=_0xf8ed84['id'];_0x4a5a24['body'][_0xb765('0x45')]=integrations['getSubjects'](_0x4a5a24['body']['channel'],_0x4a5a24[_0xb765('0x3e')]['type']);_0x4a5a24[_0xb765('0x3e')][_0xb765('0x46')]=integrations['getDescriptions'](_0x4a5a24[_0xb765('0x3e')][_0xb765('0x47')],_0x4a5a24['body'][_0xb765('0x24')]);return db[_0xb765('0x48')][_0xb765('0x3d')](_0x4a5a24[_0xb765('0x3e')],{'include':[{'model':db[_0xb765('0x49')],'as':_0xb765('0x45')},{'model':db['FreshdeskField'],'as':_0xb765('0x46')}]});}return null;})['then'](respondWithResult(_0x1b3d82,null))[_0xb765('0x3a')](handleError(_0x1b3d82,null));};exports[_0xb765('0x4a')]=function(_0x457bc9,_0x58be22,_0x35dc72){var _0x497d66='';return db[_0xb765('0x22')][_0xb765('0x41')]({'where':{'id':_0x457bc9['params']['id']},'attributes':['id',_0xb765('0x4b'),_0xb765('0x4c')]})[_0xb765('0x1e')](handleEntityNotFound(_0x58be22,null))['then'](function(_0x2b15b9){if(_0x2b15b9){_0x497d66=_0x2b15b9['remoteUri'];var _0x35735d=_0x497d66[_0xb765('0x4d')](-0x1);if(_0x35735d==='/'){_0x497d66=_0x497d66[_0xb765('0x4e')](0x0,_0x497d66[_0xb765('0x4f')](_0x35735d));}return rp({'method':_0xb765('0x50'),'uri':util['format']('%s/%s',_0x497d66,'api/v2/ticket_fields'),'headers':{'Authorization':util[_0xb765('0x51')]('Basic\x20%s',new Buffer(util[_0xb765('0x51')](_0xb765('0x52'),_0x2b15b9[_0xb765('0x4c')]))[_0xb765('0x53')]('base64'))},'json':!![]});}})['then'](function(_0x16b20c){if(_0x16b20c){var _0x2654cd=[_0xb765('0x54'),_0xb765('0x55'),_0xb765('0x56'),'description',_0xb765('0x14'),_0xb765('0x57'),_0xb765('0x58'),_0xb765('0x59'),_0xb765('0x5a'),_0xb765('0x58'),'company'];_[_0xb765('0x5b')](_0x16b20c,function(_0x3a152a){return _0x2654cd[_0xb765('0x5c')](_0x3a152a[_0xb765('0x20')])||!_0x3a152a['default']&&_0x3a152a['type']!==_0xb765('0x5d')&&_0x3a152a[_0xb765('0x24')]!==_0xb765('0x5e');});return{'count':_0x16b20c[_0xb765('0x2d')],'rows':_['map'](_0x16b20c,function(_0x46a5e6){return{'id':_0x46a5e6['name'],'name':_0x46a5e6['label'],'custom':!_0x46a5e6['default'],'options':_0x46a5e6[_0xb765('0x5f')]?_[_0xb765('0x34')](_0x46a5e6['choices'],function(_0x10e9cb){return{'name':_['capitalize'](_0x10e9cb),'value':_0x10e9cb};}):[]};})};}})[_0xb765('0x1e')](respondWithResult(_0x58be22,null))['catch'](function(_0x3da051){var _0x375223=_0x457bc9[_0xb765('0x26')][_0xb765('0x60')]?0x1f4:_0x3da051[_0xb765('0x61')]||0x1f4;logger['error'](_0xb765('0x62'),_0xb765('0x4a'),_0x375223,JSON['stringify'](_0x3da051));delete _0x3da051[_0xb765('0x20')];if(_0x375223===0x191){_0x375223=0x190;}_0x58be22[_0xb765('0x14')](_0x375223)['send'](_0x457bc9['query'][_0xb765('0x60')]?{'message':_0xb765('0x63'),'statusCode':_0x3da051[_0xb765('0x61')]}:_0x3da051);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index 81da1e2..e2d7b86 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 _0x02b6=['int_freshdesk_accounts','lodash','api','bluebird','request-promise','../../config/environment','./intFreshdeskAccount.attributes','define','FreshdeskAccount'];(function(_0x1b828b,_0x344400){var _0x98da1a=function(_0x1a0f5b){while(--_0x1a0f5b){_0x1b828b['push'](_0x1b828b['shift']());}};_0x98da1a(++_0x344400);}(_0x02b6,0x6d));var _0x602b=function(_0x33b549,_0x194748){_0x33b549=_0x33b549-0x0;var _0x46d510=_0x02b6[_0x33b549];return _0x46d510;};'use strict';var _=require(_0x602b('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x602b('0x1'));var moment=require('moment');var BPromise=require(_0x602b('0x2'));var rp=require(_0x602b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x602b('0x4'));var attributes=require(_0x602b('0x5'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x3a10a4,_0x591718){return _0x3a10a4[_0x602b('0x6')](_0x602b('0x7'),attributes,{'tableName':_0x602b('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x751c=['request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','lodash','api','moment','bluebird'];(function(_0x112337,_0x30f139){var _0x3099c5=function(_0x4a52b8){while(--_0x4a52b8){_0x112337['push'](_0x112337['shift']());}};_0x3099c5(++_0x30f139);}(_0x751c,0x1eb));var _0xc751=function(_0x2d78eb,_0x355be8){_0x2d78eb=_0x2d78eb-0x0;var _0x21af86=_0x751c[_0x2d78eb];return _0x21af86;};'use strict';var _=require(_0xc751('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc751('0x1'));var moment=require(_0xc751('0x2'));var BPromise=require(_0xc751('0x3'));var rp=require(_0xc751('0x4'));var fs=require('fs');var path=require(_0xc751('0x5'));var rimraf=require(_0xc751('0x6'));var config=require(_0xc751('0x7'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xc751('0x8'));module['exports']=function(_0x1ac7ea,_0x3cd959){return _0x1ac7ea['define']('FreshdeskAccount',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 1f5d7ee..453582d 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 _0x58c8=['lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','FreshdeskAccount,\x20%s,\x20%s','info','catch','FreshdeskAccount','findAll','options','attributes','limit','map','include','model','then','GetFreshdeskAccount','ShowFreshdeskAccount'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x58c8,0xc6));var _0x858c=function(_0x185b69,_0xe7dc4a){_0x185b69=_0x185b69-0x0;var _0x154c7a=_0x58c8[_0x185b69];return _0x154c7a;};'use strict';var _=require(_0x858c('0x0'));var util=require(_0x858c('0x1'));var moment=require(_0x858c('0x2'));var BPromise=require(_0x858c('0x3'));var rs=require(_0x858c('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x858c('0x5'))['db'];var utils=require(_0x858c('0x6'));var logger=require(_0x858c('0x7'))(_0x858c('0x8'));var config=require('../../config/environment');var jayson=require(_0x858c('0x9'));var client=jayson[_0x858c('0xa')][_0x858c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1c788a,_0x2120e0,_0x47fa89){return new BPromise(function(_0x37cc30,_0x1b9a4a){return client[_0x858c('0xc')](_0x1c788a,_0x47fa89)['then'](function(_0x19db25){logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x2120e0,'request\x20sent');logger['debug'](_0x858c('0xd'),_0x2120e0,_0x858c('0xe'),JSON[_0x858c('0xf')](_0x19db25));if(_0x19db25[_0x858c('0x10')]){if(_0x19db25['error'][_0x858c('0x11')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x2120e0,_0x19db25[_0x858c('0x10')][_0x858c('0x12')]);return _0x1b9a4a(_0x19db25[_0x858c('0x10')][_0x858c('0x12')]);}logger[_0x858c('0x10')](_0x858c('0x13'),_0x2120e0,_0x19db25['error'][_0x858c('0x12')]);return _0x37cc30(_0x19db25['error'][_0x858c('0x12')]);}else{logger[_0x858c('0x14')](_0x858c('0x13'),_0x2120e0,'request\x20sent');_0x37cc30(_0x19db25['result']['message']);}})[_0x858c('0x15')](function(_0x3bf421){logger[_0x858c('0x10')](_0x858c('0x13'),_0x2120e0,_0x3bf421);_0x1b9a4a(_0x3bf421);});});}exports['GetFreshdeskAccount']=function(_0x5149ed){var _0x450784=this;return new Promise(function(_0x218385,_0x154cde){return db[_0x858c('0x16')][_0x858c('0x17')]({'raw':_0x5149ed[_0x858c('0x18')]?_0x5149ed[_0x858c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x5149ed['options']?_0x5149ed[_0x858c('0x18')]['where']||null:null,'attributes':_0x5149ed[_0x858c('0x18')]?_0x5149ed[_0x858c('0x18')][_0x858c('0x19')]||null:null,'limit':_0x5149ed[_0x858c('0x18')]?_0x5149ed[_0x858c('0x18')][_0x858c('0x1a')]||null:null,'include':_0x5149ed[_0x858c('0x18')]?_0x5149ed[_0x858c('0x18')]['include']?_[_0x858c('0x1b')](_0x5149ed[_0x858c('0x18')][_0x858c('0x1c')],function(_0x3876fd){return{'model':db[_0x3876fd[_0x858c('0x1d')]],'as':_0x3876fd['as'],'attributes':_0x3876fd[_0x858c('0x19')],'include':_0x3876fd[_0x858c('0x1c')]?_[_0x858c('0x1b')](_0x3876fd[_0x858c('0x1c')],function(_0xc9fdf3){return{'model':db[_0xc9fdf3[_0x858c('0x1d')]],'as':_0xc9fdf3['as'],'attributes':_0xc9fdf3[_0x858c('0x19')],'include':_0xc9fdf3[_0x858c('0x1c')]?_[_0x858c('0x1b')](_0xc9fdf3[_0x858c('0x1c')],function(_0x286c42){return{'model':db[_0x286c42[_0x858c('0x1d')]],'as':_0x286c42['as'],'attributes':_0x286c42['attributes']};}):[]};}):[]};}):[]:[]})[_0x858c('0x1e')](function(_0x514a96){logger[_0x858c('0x14')](_0x858c('0x1f'),_0x5149ed);logger['debug'](_0x858c('0x1f'),_0x5149ed,JSON[_0x858c('0xf')](_0x514a96));_0x218385(_0x514a96);})[_0x858c('0x15')](function(_0x9f2900){logger[_0x858c('0x10')](_0x858c('0x1f'),_0x9f2900['message'],_0x5149ed);_0x154cde(_0x450784[_0x858c('0x10')](0x1f4,_0x9f2900['message']));});});};exports[_0x858c('0x20')]=function(_0x474c93){var _0x4ea997=this;return new Promise(function(_0x175a2d,_0x2d0b2a){return db[_0x858c('0x16')]['find']({'raw':_0x474c93[_0x858c('0x18')]?_0x474c93[_0x858c('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x474c93['options']?_0x474c93['options']['where']||null:null,'attributes':_0x474c93[_0x858c('0x18')]?_0x474c93[_0x858c('0x18')][_0x858c('0x19')]||null:null,'include':_0x474c93['options']?_0x474c93[_0x858c('0x18')][_0x858c('0x1c')]?_[_0x858c('0x1b')](_0x474c93[_0x858c('0x18')]['include'],function(_0x2990fc){return{'model':db[_0x2990fc[_0x858c('0x1d')]],'as':_0x2990fc['as'],'attributes':_0x2990fc[_0x858c('0x19')],'include':_0x2990fc['include']?_['map'](_0x2990fc[_0x858c('0x1c')],function(_0x2bbfb6){return{'model':db[_0x2bbfb6[_0x858c('0x1d')]],'as':_0x2bbfb6['as'],'attributes':_0x2bbfb6[_0x858c('0x19')],'include':_0x2bbfb6[_0x858c('0x1c')]?_[_0x858c('0x1b')](_0x2bbfb6[_0x858c('0x1c')],function(_0x888324){return{'model':db[_0x888324[_0x858c('0x1d')]],'as':_0x888324['as'],'attributes':_0x888324[_0x858c('0x19')]};}):[]};}):[]};}):[]:[]})[_0x858c('0x1e')](function(_0x58c265){logger[_0x858c('0x14')](_0x858c('0x20'),_0x474c93);logger['debug']('ShowFreshdeskAccount',_0x474c93,JSON[_0x858c('0xf')](_0x58c265));_0x175a2d(_0x58c265);})['catch'](function(_0x2d37d7){logger[_0x858c('0x10')](_0x858c('0x20'),_0x2d37d7[_0x858c('0x12')],_0x474c93);_0x2d0b2a(_0x4ea997[_0x858c('0x10')](0x1f4,_0x2d37d7[_0x858c('0x12')]));});});}; \ No newline at end of file +var _0x1000=['FreshdeskAccount,\x20%s,\x20%s','catch','GetFreshdeskAccount','findAll','options','raw','where','attributes','limit','include','map','model','ShowFreshdeskAccount','FreshdeskAccount','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0x54ca2c,_0x3df886){var _0x3004a0=function(_0x3c3f24){while(--_0x3c3f24){_0x54ca2c['push'](_0x54ca2c['shift']());}};_0x3004a0(++_0x3df886);}(_0x1000,0x75));var _0x0100=function(_0x5d3500,_0x1fcecc){_0x5d3500=_0x5d3500-0x0;var _0x38a81c=_0x1000[_0x5d3500];return _0x38a81c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0100('0x0'));var BPromise=require(_0x0100('0x1'));var rs=require(_0x0100('0x2'));var fs=require('fs');var Redis=require(_0x0100('0x3'));var db=require(_0x0100('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0100('0x5'))(_0x0100('0x6'));var config=require(_0x0100('0x7'));var jayson=require(_0x0100('0x8'));var client=jayson['client'][_0x0100('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48308f,_0x4779c9,_0x406d3c){return new BPromise(function(_0x32f13b,_0x5d6049){return client['request'](_0x48308f,_0x406d3c)[_0x0100('0xa')](function(_0x1ca863){logger[_0x0100('0xb')]('FreshdeskAccount,\x20%s,\x20%s',_0x4779c9,'request\x20sent');logger[_0x0100('0xc')](_0x0100('0xd'),_0x4779c9,_0x0100('0xe'),JSON[_0x0100('0xf')](_0x1ca863));if(_0x1ca863[_0x0100('0x10')]){if(_0x1ca863[_0x0100('0x10')][_0x0100('0x11')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x4779c9,_0x1ca863[_0x0100('0x10')]['message']);return _0x5d6049(_0x1ca863[_0x0100('0x10')][_0x0100('0x12')]);}logger[_0x0100('0x10')](_0x0100('0x13'),_0x4779c9,_0x1ca863['error'][_0x0100('0x12')]);return _0x32f13b(_0x1ca863['error'][_0x0100('0x12')]);}else{logger['info']('FreshdeskAccount,\x20%s,\x20%s',_0x4779c9,_0x0100('0xe'));_0x32f13b(_0x1ca863['result'][_0x0100('0x12')]);}})[_0x0100('0x14')](function(_0x262c96){logger['error'](_0x0100('0x13'),_0x4779c9,_0x262c96);_0x5d6049(_0x262c96);});});}exports[_0x0100('0x15')]=function(_0x12f838){var _0x3e7f1b=this;return new Promise(function(_0x446f4e,_0x44ef40){return db['FreshdeskAccount'][_0x0100('0x16')]({'raw':_0x12f838[_0x0100('0x17')]?_0x12f838['options'][_0x0100('0x18')]===undefined?!![]:![]:!![],'where':_0x12f838['options']?_0x12f838[_0x0100('0x17')][_0x0100('0x19')]||null:null,'attributes':_0x12f838[_0x0100('0x17')]?_0x12f838['options'][_0x0100('0x1a')]||null:null,'limit':_0x12f838[_0x0100('0x17')]?_0x12f838[_0x0100('0x17')][_0x0100('0x1b')]||null:null,'include':_0x12f838['options']?_0x12f838[_0x0100('0x17')][_0x0100('0x1c')]?_[_0x0100('0x1d')](_0x12f838[_0x0100('0x17')][_0x0100('0x1c')],function(_0x2a0048){return{'model':db[_0x2a0048[_0x0100('0x1e')]],'as':_0x2a0048['as'],'attributes':_0x2a0048[_0x0100('0x1a')],'include':_0x2a0048['include']?_[_0x0100('0x1d')](_0x2a0048['include'],function(_0x291c1e){return{'model':db[_0x291c1e[_0x0100('0x1e')]],'as':_0x291c1e['as'],'attributes':_0x291c1e[_0x0100('0x1a')],'include':_0x291c1e['include']?_[_0x0100('0x1d')](_0x291c1e[_0x0100('0x1c')],function(_0x4d3c2c){return{'model':db[_0x4d3c2c[_0x0100('0x1e')]],'as':_0x4d3c2c['as'],'attributes':_0x4d3c2c[_0x0100('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0100('0xa')](function(_0x23157b){logger[_0x0100('0xb')]('GetFreshdeskAccount',_0x12f838);logger[_0x0100('0xc')](_0x0100('0x15'),_0x12f838,JSON['stringify'](_0x23157b));_0x446f4e(_0x23157b);})[_0x0100('0x14')](function(_0x4bd0c7){logger[_0x0100('0x10')](_0x0100('0x15'),_0x4bd0c7[_0x0100('0x12')],_0x12f838);_0x44ef40(_0x3e7f1b['error'](0x1f4,_0x4bd0c7[_0x0100('0x12')]));});});};exports[_0x0100('0x1f')]=function(_0x34b225){var _0x33bdec=this;return new Promise(function(_0x49068f,_0x15b028){return db[_0x0100('0x20')][_0x0100('0x21')]({'raw':_0x34b225['options']?_0x34b225['options'][_0x0100('0x18')]===undefined?!![]:![]:!![],'where':_0x34b225[_0x0100('0x17')]?_0x34b225[_0x0100('0x17')]['where']||null:null,'attributes':_0x34b225[_0x0100('0x17')]?_0x34b225['options']['attributes']||null:null,'include':_0x34b225[_0x0100('0x17')]?_0x34b225[_0x0100('0x17')][_0x0100('0x1c')]?_[_0x0100('0x1d')](_0x34b225['options'][_0x0100('0x1c')],function(_0x1d2462){return{'model':db[_0x1d2462[_0x0100('0x1e')]],'as':_0x1d2462['as'],'attributes':_0x1d2462[_0x0100('0x1a')],'include':_0x1d2462[_0x0100('0x1c')]?_['map'](_0x1d2462[_0x0100('0x1c')],function(_0x2d574a){return{'model':db[_0x2d574a[_0x0100('0x1e')]],'as':_0x2d574a['as'],'attributes':_0x2d574a[_0x0100('0x1a')],'include':_0x2d574a[_0x0100('0x1c')]?_[_0x0100('0x1d')](_0x2d574a[_0x0100('0x1c')],function(_0x3e9909){return{'model':db[_0x3e9909['model']],'as':_0x3e9909['as'],'attributes':_0x3e9909[_0x0100('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0100('0xa')](function(_0x53bc12){logger[_0x0100('0xb')](_0x0100('0x1f'),_0x34b225);logger[_0x0100('0xc')](_0x0100('0x1f'),_0x34b225,JSON[_0x0100('0xf')](_0x53bc12));_0x49068f(_0x53bc12);})[_0x0100('0x14')](function(_0x1e9f08){logger[_0x0100('0x10')]('ShowFreshdeskAccount',_0x1e9f08[_0x0100('0x12')],_0x34b225);_0x15b028(_0x33bdec[_0x0100('0x10')](0x1f4,_0x1e9f08[_0x0100('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index e0595e2..4b215c8 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 _0x3af8=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','/:id','show','get','/:id/fields','getFields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags','put','update','delete','destroy'];(function(_0x1b70e3,_0x3a15b1){var _0x1452ab=function(_0x692883){while(--_0x692883){_0x1b70e3['push'](_0x1b70e3['shift']());}};_0x1452ab(++_0x3a15b1);}(_0x3af8,0x17a));var _0x83af=function(_0x169ebb,_0x207626){_0x169ebb=_0x169ebb-0x0;var _0x41e933=_0x3af8[_0x169ebb];return _0x41e933;};'use strict';var multer=require(_0x83af('0x0'));var util=require('util');var path=require(_0x83af('0x1'));var timeout=require(_0x83af('0x2'));var express=require(_0x83af('0x3'));var router=express[_0x83af('0x4')]();var fs_extra=require(_0x83af('0x5'));var auth=require(_0x83af('0x6'));var interaction=require(_0x83af('0x7'));var config=require(_0x83af('0x8'));var controller=require(_0x83af('0x9'));router['get']('/',auth[_0x83af('0xa')](),controller['index']);router['get'](_0x83af('0xb'),auth[_0x83af('0xa')](),controller[_0x83af('0xc')]);router[_0x83af('0xd')](_0x83af('0xe'),auth[_0x83af('0xa')](),controller[_0x83af('0xf')]);router[_0x83af('0xd')]('/:id/subjects',auth['isAuthenticated'](),controller[_0x83af('0x10')]);router[_0x83af('0xd')](_0x83af('0x11'),auth['isAuthenticated'](),controller[_0x83af('0x12')]);router[_0x83af('0xd')](_0x83af('0x13'),auth[_0x83af('0xa')](),controller[_0x83af('0x14')]);router['post']('/',auth[_0x83af('0xa')](),controller[_0x83af('0x15')]);router[_0x83af('0x16')](_0x83af('0x13'),auth[_0x83af('0xa')](),controller[_0x83af('0x17')]);router[_0x83af('0x18')]('/:id',auth[_0x83af('0xa')](),controller[_0x83af('0x19')]);router[_0x83af('0x1a')](_0x83af('0xb'),auth['isAuthenticated'](),controller[_0x83af('0x1b')]);module[_0x83af('0x1c')]=router; \ No newline at end of file +var _0xe46c=['put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./intFreshdeskConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','create','post','setTags'];(function(_0x3bc769,_0x107a17){var _0xb62664=function(_0x308f7f){while(--_0x308f7f){_0x3bc769['push'](_0x3bc769['shift']());}};_0xb62664(++_0x107a17);}(_0xe46c,0x1ea));var _0xce46=function(_0x24f49e,_0x507f50){_0x24f49e=_0x24f49e-0x0;var _0x50766c=_0xe46c[_0x24f49e];return _0x50766c;};'use strict';var multer=require(_0xce46('0x0'));var util=require(_0xce46('0x1'));var path=require(_0xce46('0x2'));var timeout=require(_0xce46('0x3'));var express=require(_0xce46('0x4'));var router=express['Router']();var fs_extra=require(_0xce46('0x5'));var auth=require(_0xce46('0x6'));var interaction=require(_0xce46('0x7'));var config=require('../../config/environment');var controller=require(_0xce46('0x8'));router[_0xce46('0x9')]('/',auth['isAuthenticated'](),controller[_0xce46('0xa')]);router[_0xce46('0x9')](_0xce46('0xb'),auth[_0xce46('0xc')](),controller[_0xce46('0xd')]);router[_0xce46('0x9')](_0xce46('0xe'),auth[_0xce46('0xc')](),controller['getFields']);router[_0xce46('0x9')]('/:id/subjects',auth[_0xce46('0xc')](),controller[_0xce46('0xf')]);router[_0xce46('0x9')](_0xce46('0x10'),auth[_0xce46('0xc')](),controller[_0xce46('0x11')]);router[_0xce46('0x9')](_0xce46('0x12'),auth['isAuthenticated'](),controller[_0xce46('0x13')]);router['post']('/',auth[_0xce46('0xc')](),controller[_0xce46('0x14')]);router[_0xce46('0x15')](_0xce46('0x12'),auth[_0xce46('0xc')](),controller[_0xce46('0x16')]);router[_0xce46('0x17')](_0xce46('0xb'),auth[_0xce46('0xc')](),controller[_0xce46('0x18')]);router[_0xce46('0x19')](_0xce46('0xb'),auth[_0xce46('0xc')](),controller['destroy']);module[_0xce46('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 72e6fdb..85bf3ef 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 _0x21f7=['sequelize','exports','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x21f7,0xe1));var _0x721f=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x21f7[_0x19e35c];return _0x3e1fe8;};'use strict';var Sequelize=require(_0x721f('0x0'));module[_0x721f('0x1')]={'name':{'type':Sequelize[_0x721f('0x2')]},'description':{'type':Sequelize[_0x721f('0x2')]}}; \ No newline at end of file +var _0xc80b=['sequelize','exports'];(function(_0x416aed,_0x556c97){var _0x2cbadc=function(_0x36cd40){while(--_0x36cd40){_0x416aed['push'](_0x416aed['shift']());}};_0x2cbadc(++_0x556c97);}(_0xc80b,0x19c));var _0xbc80=function(_0x1d13e9,_0x1883d5){_0x1d13e9=_0x1d13e9-0x0;var _0x57b648=_0xc80b[_0x1d13e9];return _0x57b648;};'use strict';var Sequelize=require(_0xbc80('0x0'));module[_0xbc80('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index 6317ae6..9afe3db 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 _0x2850=['setTags','ids','rimraf','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','limit','undefined','count','set','json','apply','reject','save','update','then','destroy','sendStatus','error','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','includeAll','include','rows','catch','params','options','find','body','FreshdeskField','getFields','length','getSubjects','findOne','getDescriptions','getTags','Tag'];(function(_0x2426d7,_0x515f06){var _0x236709=function(_0x10a8f2){while(--_0x10a8f2){_0x2426d7['push'](_0x2426d7['shift']());}};_0x236709(++_0x515f06);}(_0x2850,0x1d0));var _0x0285=function(_0x3365e8,_0x32cb9c){_0x3365e8=_0x3365e8-0x0;var _0x163494=_0x2850[_0x3365e8];return _0x163494;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0285('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x0285('0x1'));var moment=require(_0x0285('0x2'));var BPromise=require(_0x0285('0x3'));var Mustache=require(_0x0285('0x4'));var util=require(_0x0285('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x0285('0x6'));var ejs=require(_0x0285('0x7'));var fs=require('fs');var fs_extra=require(_0x0285('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0285('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x0285('0xa'));var toCsv=require(_0x0285('0x6'));var querystring=require(_0x0285('0xb'));var Papa=require(_0x0285('0xc'));var Redis=require(_0x0285('0xd'));var authService=require(_0x0285('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x0285('0xf'));var hardwareService=require(_0x0285('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x0285('0x11'));var licenseUtil=require(_0x0285('0x12'));var db=require(_0x0285('0x13'))['db'];function respondWithStatusCode(_0x1b2b49,_0x56c6e2){_0x56c6e2=_0x56c6e2||0xcc;return function(_0xe18bb3){if(_0xe18bb3){return _0x1b2b49['sendStatus'](_0x56c6e2);}return _0x1b2b49['status'](_0x56c6e2)[_0x0285('0x14')]();};}function respondWithResult(_0x4b7e45,_0x3afde9){_0x3afde9=_0x3afde9||0xc8;return function(_0x34e870){if(_0x34e870){return _0x4b7e45[_0x0285('0x15')](_0x3afde9)['json'](_0x34e870);}};}function respondWithFilteredResult(_0x2c3c7f,_0x5c623b){return function(_0x2b5560){if(_0x2b5560){var _0x446072=typeof _0x5c623b[_0x0285('0x16')]==='undefined'&&typeof _0x5c623b[_0x0285('0x17')]===_0x0285('0x18');var _0x7b8227=_0x2b5560[_0x0285('0x19')];var _0x37a078=_0x446072?0x0:_0x5c623b[_0x0285('0x16')];var _0x1e1989=_0x446072?_0x2b5560[_0x0285('0x19')]:_0x5c623b[_0x0285('0x16')]+_0x5c623b[_0x0285('0x17')];var _0xf99839;if(_0x1e1989>=_0x7b8227){_0x1e1989=_0x7b8227;_0xf99839=0xc8;}else{_0xf99839=0xce;}_0x2c3c7f[_0x0285('0x15')](_0xf99839);return _0x2c3c7f[_0x0285('0x1a')]('Content-Range',_0x37a078+'-'+_0x1e1989+'/'+_0x7b8227)[_0x0285('0x1b')](_0x2b5560);}return null;};}function patchUpdates(_0x360a39){return function(_0x30a3e3){try{jsonpatch[_0x0285('0x1c')](_0x30a3e3,_0x360a39,!![]);}catch(_0x5652b2){return BPromise[_0x0285('0x1d')](_0x5652b2);}return _0x30a3e3[_0x0285('0x1e')]();};}function saveUpdates(_0xcb5d24,_0x15c168){return function(_0x57944a){if(_0x57944a){return _0x57944a[_0x0285('0x1f')](_0xcb5d24)[_0x0285('0x20')](function(_0x41afcd){return _0x41afcd;});}return null;};}function removeEntity(_0x96d705,_0x18c1a1){return function(_0x53a3c9){if(_0x53a3c9){return _0x53a3c9[_0x0285('0x21')]()['then'](function(){_0x96d705[_0x0285('0x15')](0xcc)[_0x0285('0x14')]();});}};}function handleEntityNotFound(_0x5d9359,_0x5134de){return function(_0x172421){if(!_0x172421){_0x5d9359[_0x0285('0x22')](0x194);}return _0x172421;};}function handleError(_0x56c267,_0x5d23b3){_0x5d23b3=_0x5d23b3||0x1f4;return function(_0x493ec1){logger[_0x0285('0x23')](_0x493ec1['stack']);if(_0x493ec1['name']){delete _0x493ec1[_0x0285('0x24')];}_0x56c267[_0x0285('0x15')](_0x5d23b3)[_0x0285('0x25')](_0x493ec1);};}exports[_0x0285('0x26')]=function(_0x7ebfbe,_0x312a43){var _0xf84dc3={},_0x408389={},_0x19102c={'count':0x0,'rows':[]};var _0x610242=_[_0x0285('0x27')](db[_0x0285('0x28')][_0x0285('0x29')],function(_0x414842){return{'name':_0x414842[_0x0285('0x2a')],'type':_0x414842[_0x0285('0x2b')]['key']};});_0x408389[_0x0285('0x2c')]=_[_0x0285('0x27')](_0x610242,_0x0285('0x24'));_0x408389['query']=_[_0x0285('0x2d')](_0x7ebfbe[_0x0285('0x2e')]);_0x408389[_0x0285('0x2f')]=_[_0x0285('0x30')](_0x408389[_0x0285('0x2c')],_0x408389[_0x0285('0x2e')]);_0xf84dc3[_0x0285('0x31')]=_['intersection'](_0x408389[_0x0285('0x2c')],qs['fields'](_0x7ebfbe[_0x0285('0x2e')][_0x0285('0x32')]));_0xf84dc3[_0x0285('0x31')]=_0xf84dc3[_0x0285('0x31')]['length']?_0xf84dc3[_0x0285('0x31')]:_0x408389[_0x0285('0x2c')];if(!_0x7ebfbe[_0x0285('0x2e')][_0x0285('0x33')](_0x0285('0x34'))){_0xf84dc3['limit']=qs[_0x0285('0x17')](_0x7ebfbe[_0x0285('0x2e')][_0x0285('0x17')]);_0xf84dc3[_0x0285('0x16')]=qs[_0x0285('0x16')](_0x7ebfbe['query']['offset']);}_0xf84dc3[_0x0285('0x35')]=qs[_0x0285('0x36')](_0x7ebfbe[_0x0285('0x2e')][_0x0285('0x36')]);_0xf84dc3['where']=qs[_0x0285('0x2f')](_[_0x0285('0x37')](_0x7ebfbe[_0x0285('0x2e')],_0x408389[_0x0285('0x2f')]),_0x610242);if(_0x7ebfbe[_0x0285('0x2e')][_0x0285('0x38')]){_0xf84dc3[_0x0285('0x39')]=_['merge'](_0xf84dc3[_0x0285('0x39')],{'$or':_[_0x0285('0x27')](_0x610242,function(_0x34af5e){if(_0x34af5e[_0x0285('0x2b')]!=='VIRTUAL'){var _0x1abb6a={};_0x1abb6a[_0x34af5e[_0x0285('0x24')]]={'$like':'%'+_0x7ebfbe[_0x0285('0x2e')][_0x0285('0x38')]+'%'};return _0x1abb6a;}})});}_0xf84dc3=_[_0x0285('0x3a')]({},_0xf84dc3,_0x7ebfbe['options']);var _0x5b8af0={'where':_0xf84dc3[_0x0285('0x39')]};return db[_0x0285('0x28')][_0x0285('0x19')](_0x5b8af0)[_0x0285('0x20')](function(_0x1fe953){_0x19102c[_0x0285('0x19')]=_0x1fe953;if(_0x7ebfbe[_0x0285('0x2e')][_0x0285('0x3b')]){_0xf84dc3[_0x0285('0x3c')]=[{'all':!![]}];}return db[_0x0285('0x28')]['findAll'](_0xf84dc3);})[_0x0285('0x20')](function(_0x3dcd2d){_0x19102c[_0x0285('0x3d')]=_0x3dcd2d;return _0x19102c;})[_0x0285('0x20')](respondWithFilteredResult(_0x312a43,_0xf84dc3))[_0x0285('0x3e')](handleError(_0x312a43,null));};exports['show']=function(_0x66a81e,_0x15581d){var _0x2eb496={'raw':![],'where':{'id':_0x66a81e[_0x0285('0x3f')]['id']}},_0x72cae={};_0x72cae[_0x0285('0x2c')]=_['keys'](db[_0x0285('0x28')][_0x0285('0x29')]);_0x72cae[_0x0285('0x2e')]=_['keys'](_0x66a81e[_0x0285('0x2e')]);_0x72cae[_0x0285('0x2f')]=_[_0x0285('0x30')](_0x72cae[_0x0285('0x2c')],_0x72cae['query']);_0x2eb496[_0x0285('0x31')]=_[_0x0285('0x30')](_0x72cae[_0x0285('0x2c')],qs['fields'](_0x66a81e['query']['fields']));_0x2eb496[_0x0285('0x31')]=_0x2eb496[_0x0285('0x31')]['length']?_0x2eb496[_0x0285('0x31')]:_0x72cae[_0x0285('0x2c')];if(_0x66a81e[_0x0285('0x2e')][_0x0285('0x3b')]){_0x2eb496[_0x0285('0x3c')]=[{'all':!![]}];}_0x2eb496=_[_0x0285('0x3a')]({},_0x2eb496,_0x66a81e[_0x0285('0x40')]);return db[_0x0285('0x28')][_0x0285('0x41')](_0x2eb496)[_0x0285('0x20')](handleEntityNotFound(_0x15581d,null))[_0x0285('0x20')](respondWithResult(_0x15581d,null))['catch'](handleError(_0x15581d,null));};exports['create']=function(_0x51d7c7,_0x382a07){return db[_0x0285('0x28')]['create'](_0x51d7c7[_0x0285('0x42')],{})[_0x0285('0x20')](respondWithResult(_0x382a07,0xc9))[_0x0285('0x3e')](handleError(_0x382a07,null));};exports['update']=function(_0x4e1368,_0xd4206a){if(_0x4e1368[_0x0285('0x42')]['id']){delete _0x4e1368[_0x0285('0x42')]['id'];}return db[_0x0285('0x28')][_0x0285('0x41')]({'where':{'id':_0x4e1368['params']['id']}})['then'](handleEntityNotFound(_0xd4206a,null))[_0x0285('0x20')](saveUpdates(_0x4e1368[_0x0285('0x42')],null))[_0x0285('0x20')](respondWithResult(_0xd4206a,null))[_0x0285('0x3e')](handleError(_0xd4206a,null));};exports['destroy']=function(_0x5dd408,_0x325631){return db[_0x0285('0x28')][_0x0285('0x41')]({'where':{'id':_0x5dd408[_0x0285('0x3f')]['id']}})[_0x0285('0x20')](handleEntityNotFound(_0x325631,null))['then'](removeEntity(_0x325631,null))[_0x0285('0x3e')](handleError(_0x325631,null));};exports['getFields']=function(_0x40fb4e,_0x590ecf,_0x1a7aed){var _0x26a21d={};var _0x14eddd={};var _0x220b72;var _0x52e6c4;return db[_0x0285('0x28')]['findOne']({'where':{'id':_0x40fb4e[_0x0285('0x3f')]['id']}})[_0x0285('0x20')](handleEntityNotFound(_0x590ecf,null))[_0x0285('0x20')](function(_0x14e6a5){if(_0x14e6a5){_0x220b72=_0x14e6a5;_0x14eddd[_0x0285('0x2c')]=_[_0x0285('0x2d')](db[_0x0285('0x43')][_0x0285('0x29')]);_0x14eddd[_0x0285('0x2e')]=_[_0x0285('0x2d')](_0x40fb4e['query']);_0x14eddd[_0x0285('0x2f')]=_[_0x0285('0x30')](_0x14eddd['model'],_0x14eddd[_0x0285('0x2e')]);_0x26a21d[_0x0285('0x31')]=_['intersection'](_0x14eddd[_0x0285('0x2c')],qs[_0x0285('0x32')](_0x40fb4e['query'][_0x0285('0x32')]));_0x26a21d[_0x0285('0x31')]=_0x26a21d[_0x0285('0x31')]['length']?_0x26a21d[_0x0285('0x31')]:_0x14eddd[_0x0285('0x2c')];_0x26a21d[_0x0285('0x35')]=qs[_0x0285('0x36')](_0x40fb4e[_0x0285('0x2e')][_0x0285('0x36')]);_0x26a21d['where']=qs['filters'](_[_0x0285('0x37')](_0x40fb4e[_0x0285('0x2e')],_0x14eddd[_0x0285('0x2f')]));if(_0x40fb4e[_0x0285('0x2e')]['filter']){_0x26a21d[_0x0285('0x39')]=_[_0x0285('0x3a')](_0x26a21d[_0x0285('0x39')],{'$or':_[_0x0285('0x27')](_0x26a21d['attributes'],function(_0x14765f){var _0x336e6a={};_0x336e6a[_0x14765f]={'$like':'%'+_0x40fb4e[_0x0285('0x2e')][_0x0285('0x38')]+'%'};return _0x336e6a;})});}_0x26a21d=_[_0x0285('0x3a')]({},_0x26a21d,_0x40fb4e[_0x0285('0x40')]);return _0x220b72[_0x0285('0x44')](_0x26a21d);}})[_0x0285('0x20')](function(_0x238e40){if(_0x238e40){_0x52e6c4=_0x238e40[_0x0285('0x45')];if(!_0x40fb4e[_0x0285('0x2e')][_0x0285('0x33')]('nolimit')){_0x26a21d['limit']=qs[_0x0285('0x17')](_0x40fb4e[_0x0285('0x2e')][_0x0285('0x17')]);_0x26a21d[_0x0285('0x16')]=qs[_0x0285('0x16')](_0x40fb4e[_0x0285('0x2e')]['offset']);}return _0x220b72[_0x0285('0x44')](_0x26a21d);}})['then'](function(_0xd60e48){if(_0xd60e48){return _0xd60e48?{'count':_0x52e6c4,'rows':_0xd60e48}:null;}})[_0x0285('0x20')](respondWithResult(_0x590ecf,null))[_0x0285('0x3e')](handleError(_0x590ecf,null));};exports[_0x0285('0x46')]=function(_0x5e4f67,_0x5577a0,_0x4f1fa3){var _0x2e0aca={};var _0x10a817={};var _0x25c3c6;var _0x2c85ef;return db[_0x0285('0x28')][_0x0285('0x47')]({'where':{'id':_0x5e4f67['params']['id']}})[_0x0285('0x20')](handleEntityNotFound(_0x5577a0,null))['then'](function(_0x432700){if(_0x432700){_0x25c3c6=_0x432700;_0x10a817[_0x0285('0x2c')]=_[_0x0285('0x2d')](db[_0x0285('0x43')]['rawAttributes']);_0x10a817[_0x0285('0x2e')]=_[_0x0285('0x2d')](_0x5e4f67[_0x0285('0x2e')]);_0x10a817[_0x0285('0x2f')]=_[_0x0285('0x30')](_0x10a817['model'],_0x10a817[_0x0285('0x2e')]);_0x2e0aca[_0x0285('0x31')]=_[_0x0285('0x30')](_0x10a817[_0x0285('0x2c')],qs[_0x0285('0x32')](_0x5e4f67[_0x0285('0x2e')][_0x0285('0x32')]));_0x2e0aca[_0x0285('0x31')]=_0x2e0aca[_0x0285('0x31')][_0x0285('0x45')]?_0x2e0aca[_0x0285('0x31')]:_0x10a817[_0x0285('0x2c')];_0x2e0aca[_0x0285('0x35')]=qs[_0x0285('0x36')](_0x5e4f67[_0x0285('0x2e')]['sort']);_0x2e0aca[_0x0285('0x39')]=qs[_0x0285('0x2f')](_[_0x0285('0x37')](_0x5e4f67[_0x0285('0x2e')],_0x10a817[_0x0285('0x2f')]));if(_0x5e4f67[_0x0285('0x2e')][_0x0285('0x38')]){_0x2e0aca[_0x0285('0x39')]=_[_0x0285('0x3a')](_0x2e0aca[_0x0285('0x39')],{'$or':_[_0x0285('0x27')](_0x2e0aca[_0x0285('0x31')],function(_0x220b80){var _0x93d2ba={};_0x93d2ba[_0x220b80]={'$like':'%'+_0x5e4f67[_0x0285('0x2e')]['filter']+'%'};return _0x93d2ba;})});}_0x2e0aca=_[_0x0285('0x3a')]({},_0x2e0aca,_0x5e4f67[_0x0285('0x40')]);return _0x25c3c6[_0x0285('0x46')](_0x2e0aca);}})[_0x0285('0x20')](function(_0xa7712){if(_0xa7712){_0x2c85ef=_0xa7712[_0x0285('0x45')];if(!_0x5e4f67[_0x0285('0x2e')][_0x0285('0x33')](_0x0285('0x34'))){_0x2e0aca[_0x0285('0x17')]=qs[_0x0285('0x17')](_0x5e4f67[_0x0285('0x2e')]['limit']);_0x2e0aca['offset']=qs[_0x0285('0x16')](_0x5e4f67['query'][_0x0285('0x16')]);}return _0x25c3c6[_0x0285('0x46')](_0x2e0aca);}})[_0x0285('0x20')](function(_0x38401d){if(_0x38401d){return _0x38401d?{'count':_0x2c85ef,'rows':_0x38401d}:null;}})['then'](respondWithResult(_0x5577a0,null))['catch'](handleError(_0x5577a0,null));};exports[_0x0285('0x48')]=function(_0x238f40,_0x4b5ee3,_0x5e46ff){var _0x259d2c={};var _0x453a6a={};var _0x549389;var _0x2a4149;return db[_0x0285('0x28')][_0x0285('0x47')]({'where':{'id':_0x238f40[_0x0285('0x3f')]['id']}})[_0x0285('0x20')](handleEntityNotFound(_0x4b5ee3,null))[_0x0285('0x20')](function(_0x223993){if(_0x223993){_0x549389=_0x223993;_0x453a6a[_0x0285('0x2c')]=_[_0x0285('0x2d')](db[_0x0285('0x43')][_0x0285('0x29')]);_0x453a6a['query']=_[_0x0285('0x2d')](_0x238f40[_0x0285('0x2e')]);_0x453a6a[_0x0285('0x2f')]=_[_0x0285('0x30')](_0x453a6a[_0x0285('0x2c')],_0x453a6a[_0x0285('0x2e')]);_0x259d2c[_0x0285('0x31')]=_[_0x0285('0x30')](_0x453a6a[_0x0285('0x2c')],qs[_0x0285('0x32')](_0x238f40[_0x0285('0x2e')]['fields']));_0x259d2c[_0x0285('0x31')]=_0x259d2c[_0x0285('0x31')][_0x0285('0x45')]?_0x259d2c[_0x0285('0x31')]:_0x453a6a['model'];_0x259d2c[_0x0285('0x35')]=qs[_0x0285('0x36')](_0x238f40[_0x0285('0x2e')][_0x0285('0x36')]);_0x259d2c[_0x0285('0x39')]=qs[_0x0285('0x2f')](_[_0x0285('0x37')](_0x238f40[_0x0285('0x2e')],_0x453a6a[_0x0285('0x2f')]));if(_0x238f40[_0x0285('0x2e')][_0x0285('0x38')]){_0x259d2c[_0x0285('0x39')]=_[_0x0285('0x3a')](_0x259d2c['where'],{'$or':_[_0x0285('0x27')](_0x259d2c[_0x0285('0x31')],function(_0x3dfc7c){var _0x50d414={};_0x50d414[_0x3dfc7c]={'$like':'%'+_0x238f40[_0x0285('0x2e')][_0x0285('0x38')]+'%'};return _0x50d414;})});}_0x259d2c=_[_0x0285('0x3a')]({},_0x259d2c,_0x238f40[_0x0285('0x40')]);return _0x549389[_0x0285('0x48')](_0x259d2c);}})[_0x0285('0x20')](function(_0x4d5890){if(_0x4d5890){_0x2a4149=_0x4d5890[_0x0285('0x45')];if(!_0x238f40['query'][_0x0285('0x33')](_0x0285('0x34'))){_0x259d2c[_0x0285('0x17')]=qs[_0x0285('0x17')](_0x238f40[_0x0285('0x2e')]['limit']);_0x259d2c['offset']=qs[_0x0285('0x16')](_0x238f40['query'][_0x0285('0x16')]);}return _0x549389['getDescriptions'](_0x259d2c);}})[_0x0285('0x20')](function(_0x263875){if(_0x263875){return _0x263875?{'count':_0x2a4149,'rows':_0x263875}:null;}})[_0x0285('0x20')](respondWithResult(_0x4b5ee3,null))[_0x0285('0x3e')](handleError(_0x4b5ee3,null));};exports[_0x0285('0x49')]=function(_0x204515,_0x3db713,_0x1e69f8){var _0x2a0c29={};var _0x378928={};var _0x4ed1e7;var _0x117f4f;return db[_0x0285('0x28')][_0x0285('0x47')]({'where':{'id':_0x204515[_0x0285('0x3f')]['id']}})[_0x0285('0x20')](handleEntityNotFound(_0x3db713,null))[_0x0285('0x20')](function(_0x46c248){if(_0x46c248){_0x4ed1e7=_0x46c248;_0x378928['model']=_[_0x0285('0x2d')](db[_0x0285('0x4a')][_0x0285('0x29')]);_0x378928[_0x0285('0x2e')]=_[_0x0285('0x2d')](_0x204515[_0x0285('0x2e')]);_0x378928[_0x0285('0x2f')]=_[_0x0285('0x30')](_0x378928[_0x0285('0x2c')],_0x378928[_0x0285('0x2e')]);_0x2a0c29[_0x0285('0x31')]=_[_0x0285('0x30')](_0x378928[_0x0285('0x2c')],qs['fields'](_0x204515[_0x0285('0x2e')][_0x0285('0x32')]));_0x2a0c29['attributes']=_0x2a0c29[_0x0285('0x31')]['length']?_0x2a0c29[_0x0285('0x31')]:_0x378928[_0x0285('0x2c')];_0x2a0c29[_0x0285('0x35')]=qs[_0x0285('0x36')](_0x204515[_0x0285('0x2e')][_0x0285('0x36')]);_0x2a0c29['where']=qs['filters'](_[_0x0285('0x37')](_0x204515[_0x0285('0x2e')],_0x378928[_0x0285('0x2f')]));if(_0x204515[_0x0285('0x2e')][_0x0285('0x38')]){_0x2a0c29[_0x0285('0x39')]=_[_0x0285('0x3a')](_0x2a0c29[_0x0285('0x39')],{'$or':_[_0x0285('0x27')](_0x2a0c29[_0x0285('0x31')],function(_0x40a421){var _0xfe7823={};_0xfe7823[_0x40a421]={'$like':'%'+_0x204515[_0x0285('0x2e')][_0x0285('0x38')]+'%'};return _0xfe7823;})});}_0x2a0c29=_['merge']({},_0x2a0c29,_0x204515['options']);return _0x4ed1e7['getTags'](_0x2a0c29);}})['then'](function(_0x19df2d){if(_0x19df2d){_0x117f4f=_0x19df2d['length'];if(!_0x204515[_0x0285('0x2e')][_0x0285('0x33')]('nolimit')){_0x2a0c29[_0x0285('0x17')]=qs[_0x0285('0x17')](_0x204515[_0x0285('0x2e')][_0x0285('0x17')]);_0x2a0c29[_0x0285('0x16')]=qs[_0x0285('0x16')](_0x204515[_0x0285('0x2e')][_0x0285('0x16')]);}return _0x4ed1e7['getTags'](_0x2a0c29);}})[_0x0285('0x20')](function(_0x377cf0){if(_0x377cf0){return _0x377cf0?{'count':_0x117f4f,'rows':_0x377cf0}:null;}})[_0x0285('0x20')](respondWithResult(_0x3db713,null))[_0x0285('0x3e')](handleError(_0x3db713,null));};exports[_0x0285('0x4b')]=function(_0x3a1af6,_0x531f25,_0x476546){if(_0x3a1af6['body']['id']){delete _0x3a1af6[_0x0285('0x42')]['id'];}return db[_0x0285('0x28')][_0x0285('0x47')]({'where':{'id':_0x3a1af6['params']['id']}})[_0x0285('0x20')](handleEntityNotFound(_0x531f25,null))[_0x0285('0x20')](function(_0x374cee){if(_0x374cee){return _0x374cee['setTags'](_0x3a1af6['body'][_0x0285('0x4c')]||[]);}return null;})[_0x0285('0x20')](respondWithResult(_0x531f25,null))[_0x0285('0x3e')](handleError(_0x531f25,null));}; \ No newline at end of file +var _0xa8b1=['find','create','catch','update','body','getFields','findOne','FreshdeskField','hasOwnProperty','getSubjects','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','undefined','limit','count','offset','set','apply','reject','then','destroy','sendStatus','stack','send','map','rawAttributes','fieldName','key','query','model','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','where','merge','VIRTUAL','name','options','include','rows','show','params','keys','FreshdeskConfiguration'];(function(_0x388f39,_0xe30144){var _0x4a09aa=function(_0x2bcc27){while(--_0x2bcc27){_0x388f39['push'](_0x388f39['shift']());}};_0x4a09aa(++_0xe30144);}(_0xa8b1,0xad));var _0x1a8b=function(_0x5e2405,_0x3230fb){_0x5e2405=_0x5e2405-0x0;var _0x4a992f=_0xa8b1[_0x5e2405];return _0x4a992f;};'use strict';var emlformat=require(_0x1a8b('0x0'));var rimraf=require(_0x1a8b('0x1'));var zipdir=require(_0x1a8b('0x2'));var jsonpatch=require(_0x1a8b('0x3'));var rp=require('request-promise');var moment=require(_0x1a8b('0x4'));var BPromise=require(_0x1a8b('0x5'));var Mustache=require(_0x1a8b('0x6'));var util=require(_0x1a8b('0x7'));var path=require('path');var sox=require(_0x1a8b('0x8'));var csv=require(_0x1a8b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1a8b('0xa'));var _=require(_0x1a8b('0xb'));var squel=require(_0x1a8b('0xc'));var crypto=require('crypto');var jsforce=require(_0x1a8b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x1a8b('0x9'));var querystring=require(_0x1a8b('0xe'));var Papa=require('papaparse');var Redis=require(_0x1a8b('0xf'));var authService=require(_0x1a8b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1a8b('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x1a8b('0x12'));var utils=require(_0x1a8b('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x1a8b('0x14'));var db=require(_0x1a8b('0x15'))['db'];function respondWithStatusCode(_0xd66341,_0x874f1){_0x874f1=_0x874f1||0xcc;return function(_0x3bf01e){if(_0x3bf01e){return _0xd66341['sendStatus'](_0x874f1);}return _0xd66341[_0x1a8b('0x16')](_0x874f1)[_0x1a8b('0x17')]();};}function respondWithResult(_0x5e08c3,_0x522486){_0x522486=_0x522486||0xc8;return function(_0xc9fcaf){if(_0xc9fcaf){return _0x5e08c3[_0x1a8b('0x16')](_0x522486)[_0x1a8b('0x18')](_0xc9fcaf);}};}function respondWithFilteredResult(_0x224d99,_0x5ef472){return function(_0x44ba65){if(_0x44ba65){var _0x33af44=typeof _0x5ef472['offset']===_0x1a8b('0x19')&&typeof _0x5ef472[_0x1a8b('0x1a')]==='undefined';var _0x2faa40=_0x44ba65[_0x1a8b('0x1b')];var _0x1be845=_0x33af44?0x0:_0x5ef472[_0x1a8b('0x1c')];var _0xb17c9f=_0x33af44?_0x44ba65[_0x1a8b('0x1b')]:_0x5ef472['offset']+_0x5ef472[_0x1a8b('0x1a')];var _0x50c1a0;if(_0xb17c9f>=_0x2faa40){_0xb17c9f=_0x2faa40;_0x50c1a0=0xc8;}else{_0x50c1a0=0xce;}_0x224d99[_0x1a8b('0x16')](_0x50c1a0);return _0x224d99[_0x1a8b('0x1d')]('Content-Range',_0x1be845+'-'+_0xb17c9f+'/'+_0x2faa40)[_0x1a8b('0x18')](_0x44ba65);}return null;};}function patchUpdates(_0xe6d25b){return function(_0x45ea4e){try{jsonpatch[_0x1a8b('0x1e')](_0x45ea4e,_0xe6d25b,!![]);}catch(_0x3f84ce){return BPromise[_0x1a8b('0x1f')](_0x3f84ce);}return _0x45ea4e['save']();};}function saveUpdates(_0x189c79,_0x1d2706){return function(_0x553b96){if(_0x553b96){return _0x553b96['update'](_0x189c79)[_0x1a8b('0x20')](function(_0x1738be){return _0x1738be;});}return null;};}function removeEntity(_0x129c83,_0x3f2cf1){return function(_0x3bf26c){if(_0x3bf26c){return _0x3bf26c[_0x1a8b('0x21')]()['then'](function(){_0x129c83[_0x1a8b('0x16')](0xcc)[_0x1a8b('0x17')]();});}};}function handleEntityNotFound(_0x4cd75c,_0x502a9a){return function(_0x15adb5){if(!_0x15adb5){_0x4cd75c[_0x1a8b('0x22')](0x194);}return _0x15adb5;};}function handleError(_0x5448a2,_0x34cf5b){_0x34cf5b=_0x34cf5b||0x1f4;return function(_0x551609){logger['error'](_0x551609[_0x1a8b('0x23')]);if(_0x551609['name']){delete _0x551609['name'];}_0x5448a2[_0x1a8b('0x16')](_0x34cf5b)[_0x1a8b('0x24')](_0x551609);};}exports['index']=function(_0x47d820,_0x37fee4){var _0x3cd637={},_0x14eacd={},_0x238e28={'count':0x0,'rows':[]};var _0x1c96be=_[_0x1a8b('0x25')](db['FreshdeskConfiguration'][_0x1a8b('0x26')],function(_0x1afee6){return{'name':_0x1afee6[_0x1a8b('0x27')],'type':_0x1afee6['type'][_0x1a8b('0x28')]};});_0x14eacd['model']=_[_0x1a8b('0x25')](_0x1c96be,'name');_0x14eacd[_0x1a8b('0x29')]=_['keys'](_0x47d820[_0x1a8b('0x29')]);_0x14eacd['filters']=_['intersection'](_0x14eacd[_0x1a8b('0x2a')],_0x14eacd[_0x1a8b('0x29')]);_0x3cd637[_0x1a8b('0x2b')]=_[_0x1a8b('0x2c')](_0x14eacd[_0x1a8b('0x2a')],qs[_0x1a8b('0x2d')](_0x47d820[_0x1a8b('0x29')][_0x1a8b('0x2d')]));_0x3cd637[_0x1a8b('0x2b')]=_0x3cd637[_0x1a8b('0x2b')][_0x1a8b('0x2e')]?_0x3cd637[_0x1a8b('0x2b')]:_0x14eacd['model'];if(!_0x47d820[_0x1a8b('0x29')]['hasOwnProperty'](_0x1a8b('0x2f'))){_0x3cd637[_0x1a8b('0x1a')]=qs[_0x1a8b('0x1a')](_0x47d820['query']['limit']);_0x3cd637[_0x1a8b('0x1c')]=qs[_0x1a8b('0x1c')](_0x47d820[_0x1a8b('0x29')]['offset']);}_0x3cd637[_0x1a8b('0x30')]=qs[_0x1a8b('0x31')](_0x47d820[_0x1a8b('0x29')][_0x1a8b('0x31')]);_0x3cd637['where']=qs[_0x1a8b('0x32')](_[_0x1a8b('0x33')](_0x47d820[_0x1a8b('0x29')],_0x14eacd[_0x1a8b('0x32')]),_0x1c96be);if(_0x47d820[_0x1a8b('0x29')][_0x1a8b('0x34')]){_0x3cd637[_0x1a8b('0x35')]=_[_0x1a8b('0x36')](_0x3cd637[_0x1a8b('0x35')],{'$or':_[_0x1a8b('0x25')](_0x1c96be,function(_0x584e74){if(_0x584e74['type']!==_0x1a8b('0x37')){var _0x59f1b7={};_0x59f1b7[_0x584e74[_0x1a8b('0x38')]]={'$like':'%'+_0x47d820[_0x1a8b('0x29')]['filter']+'%'};return _0x59f1b7;}})});}_0x3cd637=_[_0x1a8b('0x36')]({},_0x3cd637,_0x47d820[_0x1a8b('0x39')]);var _0xd1cd94={'where':_0x3cd637[_0x1a8b('0x35')]};return db['FreshdeskConfiguration'][_0x1a8b('0x1b')](_0xd1cd94)['then'](function(_0x185fa6){_0x238e28['count']=_0x185fa6;if(_0x47d820[_0x1a8b('0x29')]['includeAll']){_0x3cd637[_0x1a8b('0x3a')]=[{'all':!![]}];}return db['FreshdeskConfiguration']['findAll'](_0x3cd637);})[_0x1a8b('0x20')](function(_0x4b8bf5){_0x238e28[_0x1a8b('0x3b')]=_0x4b8bf5;return _0x238e28;})['then'](respondWithFilteredResult(_0x37fee4,_0x3cd637))['catch'](handleError(_0x37fee4,null));};exports[_0x1a8b('0x3c')]=function(_0x30af7f,_0x42ad20){var _0x1cdd28={'raw':![],'where':{'id':_0x30af7f[_0x1a8b('0x3d')]['id']}},_0x3f43dc={};_0x3f43dc[_0x1a8b('0x2a')]=_[_0x1a8b('0x3e')](db[_0x1a8b('0x3f')]['rawAttributes']);_0x3f43dc[_0x1a8b('0x29')]=_[_0x1a8b('0x3e')](_0x30af7f[_0x1a8b('0x29')]);_0x3f43dc['filters']=_['intersection'](_0x3f43dc[_0x1a8b('0x2a')],_0x3f43dc['query']);_0x1cdd28[_0x1a8b('0x2b')]=_[_0x1a8b('0x2c')](_0x3f43dc[_0x1a8b('0x2a')],qs[_0x1a8b('0x2d')](_0x30af7f[_0x1a8b('0x29')][_0x1a8b('0x2d')]));_0x1cdd28[_0x1a8b('0x2b')]=_0x1cdd28['attributes'][_0x1a8b('0x2e')]?_0x1cdd28['attributes']:_0x3f43dc[_0x1a8b('0x2a')];if(_0x30af7f[_0x1a8b('0x29')]['includeAll']){_0x1cdd28[_0x1a8b('0x3a')]=[{'all':!![]}];}_0x1cdd28=_[_0x1a8b('0x36')]({},_0x1cdd28,_0x30af7f[_0x1a8b('0x39')]);return db[_0x1a8b('0x3f')][_0x1a8b('0x40')](_0x1cdd28)[_0x1a8b('0x20')](handleEntityNotFound(_0x42ad20,null))[_0x1a8b('0x20')](respondWithResult(_0x42ad20,null))['catch'](handleError(_0x42ad20,null));};exports[_0x1a8b('0x41')]=function(_0x323bf7,_0x5d75d9){return db[_0x1a8b('0x3f')][_0x1a8b('0x41')](_0x323bf7['body'],{})['then'](respondWithResult(_0x5d75d9,0xc9))[_0x1a8b('0x42')](handleError(_0x5d75d9,null));};exports[_0x1a8b('0x43')]=function(_0x173dd5,_0x2bf1de){if(_0x173dd5[_0x1a8b('0x44')]['id']){delete _0x173dd5[_0x1a8b('0x44')]['id'];}return db['FreshdeskConfiguration']['find']({'where':{'id':_0x173dd5[_0x1a8b('0x3d')]['id']}})[_0x1a8b('0x20')](handleEntityNotFound(_0x2bf1de,null))[_0x1a8b('0x20')](saveUpdates(_0x173dd5[_0x1a8b('0x44')],null))[_0x1a8b('0x20')](respondWithResult(_0x2bf1de,null))[_0x1a8b('0x42')](handleError(_0x2bf1de,null));};exports[_0x1a8b('0x21')]=function(_0xabcc83,_0x525a83){return db['FreshdeskConfiguration'][_0x1a8b('0x40')]({'where':{'id':_0xabcc83[_0x1a8b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x525a83,null))[_0x1a8b('0x20')](removeEntity(_0x525a83,null))[_0x1a8b('0x42')](handleError(_0x525a83,null));};exports[_0x1a8b('0x45')]=function(_0x3e58cf,_0x1530a8,_0x5db7cd){var _0x39c2a2={};var _0x167613={};var _0x21c90b;var _0x3a6d1e;return db[_0x1a8b('0x3f')][_0x1a8b('0x46')]({'where':{'id':_0x3e58cf[_0x1a8b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x1530a8,null))[_0x1a8b('0x20')](function(_0x534285){if(_0x534285){_0x21c90b=_0x534285;_0x167613[_0x1a8b('0x2a')]=_[_0x1a8b('0x3e')](db[_0x1a8b('0x47')][_0x1a8b('0x26')]);_0x167613['query']=_['keys'](_0x3e58cf[_0x1a8b('0x29')]);_0x167613[_0x1a8b('0x32')]=_['intersection'](_0x167613['model'],_0x167613[_0x1a8b('0x29')]);_0x39c2a2[_0x1a8b('0x2b')]=_[_0x1a8b('0x2c')](_0x167613[_0x1a8b('0x2a')],qs[_0x1a8b('0x2d')](_0x3e58cf[_0x1a8b('0x29')][_0x1a8b('0x2d')]));_0x39c2a2[_0x1a8b('0x2b')]=_0x39c2a2[_0x1a8b('0x2b')][_0x1a8b('0x2e')]?_0x39c2a2[_0x1a8b('0x2b')]:_0x167613[_0x1a8b('0x2a')];_0x39c2a2['order']=qs['sort'](_0x3e58cf[_0x1a8b('0x29')][_0x1a8b('0x31')]);_0x39c2a2['where']=qs[_0x1a8b('0x32')](_[_0x1a8b('0x33')](_0x3e58cf['query'],_0x167613[_0x1a8b('0x32')]));if(_0x3e58cf['query'][_0x1a8b('0x34')]){_0x39c2a2[_0x1a8b('0x35')]=_[_0x1a8b('0x36')](_0x39c2a2[_0x1a8b('0x35')],{'$or':_[_0x1a8b('0x25')](_0x39c2a2['attributes'],function(_0x12a9fd){var _0x584d1f={};_0x584d1f[_0x12a9fd]={'$like':'%'+_0x3e58cf[_0x1a8b('0x29')]['filter']+'%'};return _0x584d1f;})});}_0x39c2a2=_[_0x1a8b('0x36')]({},_0x39c2a2,_0x3e58cf[_0x1a8b('0x39')]);return _0x21c90b['getFields'](_0x39c2a2);}})[_0x1a8b('0x20')](function(_0x4b291a){if(_0x4b291a){_0x3a6d1e=_0x4b291a['length'];if(!_0x3e58cf['query'][_0x1a8b('0x48')]('nolimit')){_0x39c2a2[_0x1a8b('0x1a')]=qs[_0x1a8b('0x1a')](_0x3e58cf['query'][_0x1a8b('0x1a')]);_0x39c2a2[_0x1a8b('0x1c')]=qs['offset'](_0x3e58cf[_0x1a8b('0x29')][_0x1a8b('0x1c')]);}return _0x21c90b[_0x1a8b('0x45')](_0x39c2a2);}})[_0x1a8b('0x20')](function(_0x4269e7){if(_0x4269e7){return _0x4269e7?{'count':_0x3a6d1e,'rows':_0x4269e7}:null;}})[_0x1a8b('0x20')](respondWithResult(_0x1530a8,null))[_0x1a8b('0x42')](handleError(_0x1530a8,null));};exports[_0x1a8b('0x49')]=function(_0x17bfb9,_0x4e22f6,_0x2c1e35){var _0x36f9d1={};var _0x26165f={};var _0x8a2663;var _0x3e3ef7;return db['FreshdeskConfiguration'][_0x1a8b('0x46')]({'where':{'id':_0x17bfb9[_0x1a8b('0x3d')]['id']}})[_0x1a8b('0x20')](handleEntityNotFound(_0x4e22f6,null))[_0x1a8b('0x20')](function(_0x4f25cb){if(_0x4f25cb){_0x8a2663=_0x4f25cb;_0x26165f['model']=_[_0x1a8b('0x3e')](db[_0x1a8b('0x47')][_0x1a8b('0x26')]);_0x26165f['query']=_[_0x1a8b('0x3e')](_0x17bfb9['query']);_0x26165f['filters']=_['intersection'](_0x26165f[_0x1a8b('0x2a')],_0x26165f['query']);_0x36f9d1[_0x1a8b('0x2b')]=_['intersection'](_0x26165f[_0x1a8b('0x2a')],qs[_0x1a8b('0x2d')](_0x17bfb9[_0x1a8b('0x29')][_0x1a8b('0x2d')]));_0x36f9d1[_0x1a8b('0x2b')]=_0x36f9d1[_0x1a8b('0x2b')][_0x1a8b('0x2e')]?_0x36f9d1[_0x1a8b('0x2b')]:_0x26165f['model'];_0x36f9d1[_0x1a8b('0x30')]=qs[_0x1a8b('0x31')](_0x17bfb9[_0x1a8b('0x29')][_0x1a8b('0x31')]);_0x36f9d1[_0x1a8b('0x35')]=qs['filters'](_[_0x1a8b('0x33')](_0x17bfb9[_0x1a8b('0x29')],_0x26165f['filters']));if(_0x17bfb9['query'][_0x1a8b('0x34')]){_0x36f9d1['where']=_[_0x1a8b('0x36')](_0x36f9d1[_0x1a8b('0x35')],{'$or':_[_0x1a8b('0x25')](_0x36f9d1[_0x1a8b('0x2b')],function(_0x488ffd){var _0x2fc424={};_0x2fc424[_0x488ffd]={'$like':'%'+_0x17bfb9[_0x1a8b('0x29')][_0x1a8b('0x34')]+'%'};return _0x2fc424;})});}_0x36f9d1=_[_0x1a8b('0x36')]({},_0x36f9d1,_0x17bfb9[_0x1a8b('0x39')]);return _0x8a2663['getSubjects'](_0x36f9d1);}})[_0x1a8b('0x20')](function(_0x104270){if(_0x104270){_0x3e3ef7=_0x104270['length'];if(!_0x17bfb9[_0x1a8b('0x29')][_0x1a8b('0x48')](_0x1a8b('0x2f'))){_0x36f9d1[_0x1a8b('0x1a')]=qs[_0x1a8b('0x1a')](_0x17bfb9[_0x1a8b('0x29')][_0x1a8b('0x1a')]);_0x36f9d1['offset']=qs[_0x1a8b('0x1c')](_0x17bfb9['query']['offset']);}return _0x8a2663[_0x1a8b('0x49')](_0x36f9d1);}})[_0x1a8b('0x20')](function(_0x1f3010){if(_0x1f3010){return _0x1f3010?{'count':_0x3e3ef7,'rows':_0x1f3010}:null;}})['then'](respondWithResult(_0x4e22f6,null))['catch'](handleError(_0x4e22f6,null));};exports[_0x1a8b('0x4a')]=function(_0x223562,_0x53b025,_0xfda9dc){var _0x368812={};var _0x4c2fc2={};var _0xba853;var _0x2af260;return db[_0x1a8b('0x3f')][_0x1a8b('0x46')]({'where':{'id':_0x223562['params']['id']}})[_0x1a8b('0x20')](handleEntityNotFound(_0x53b025,null))['then'](function(_0x32f99f){if(_0x32f99f){_0xba853=_0x32f99f;_0x4c2fc2[_0x1a8b('0x2a')]=_['keys'](db[_0x1a8b('0x47')][_0x1a8b('0x26')]);_0x4c2fc2[_0x1a8b('0x29')]=_[_0x1a8b('0x3e')](_0x223562[_0x1a8b('0x29')]);_0x4c2fc2['filters']=_[_0x1a8b('0x2c')](_0x4c2fc2[_0x1a8b('0x2a')],_0x4c2fc2[_0x1a8b('0x29')]);_0x368812[_0x1a8b('0x2b')]=_[_0x1a8b('0x2c')](_0x4c2fc2[_0x1a8b('0x2a')],qs[_0x1a8b('0x2d')](_0x223562[_0x1a8b('0x29')]['fields']));_0x368812['attributes']=_0x368812[_0x1a8b('0x2b')][_0x1a8b('0x2e')]?_0x368812[_0x1a8b('0x2b')]:_0x4c2fc2[_0x1a8b('0x2a')];_0x368812['order']=qs['sort'](_0x223562[_0x1a8b('0x29')][_0x1a8b('0x31')]);_0x368812[_0x1a8b('0x35')]=qs[_0x1a8b('0x32')](_[_0x1a8b('0x33')](_0x223562[_0x1a8b('0x29')],_0x4c2fc2[_0x1a8b('0x32')]));if(_0x223562[_0x1a8b('0x29')][_0x1a8b('0x34')]){_0x368812[_0x1a8b('0x35')]=_[_0x1a8b('0x36')](_0x368812['where'],{'$or':_['map'](_0x368812[_0x1a8b('0x2b')],function(_0x5a2a34){var _0x2125db={};_0x2125db[_0x5a2a34]={'$like':'%'+_0x223562[_0x1a8b('0x29')][_0x1a8b('0x34')]+'%'};return _0x2125db;})});}_0x368812=_[_0x1a8b('0x36')]({},_0x368812,_0x223562[_0x1a8b('0x39')]);return _0xba853[_0x1a8b('0x4a')](_0x368812);}})[_0x1a8b('0x20')](function(_0x23ddad){if(_0x23ddad){_0x2af260=_0x23ddad[_0x1a8b('0x2e')];if(!_0x223562['query'][_0x1a8b('0x48')](_0x1a8b('0x2f'))){_0x368812[_0x1a8b('0x1a')]=qs[_0x1a8b('0x1a')](_0x223562['query'][_0x1a8b('0x1a')]);_0x368812[_0x1a8b('0x1c')]=qs[_0x1a8b('0x1c')](_0x223562['query']['offset']);}return _0xba853[_0x1a8b('0x4a')](_0x368812);}})[_0x1a8b('0x20')](function(_0x31b319){if(_0x31b319){return _0x31b319?{'count':_0x2af260,'rows':_0x31b319}:null;}})[_0x1a8b('0x20')](respondWithResult(_0x53b025,null))[_0x1a8b('0x42')](handleError(_0x53b025,null));};exports[_0x1a8b('0x4b')]=function(_0x589b26,_0xc8240a,_0x394477){var _0x1a12e8={};var _0x11969f={};var _0x1ded8f;var _0x1500a8;return db['FreshdeskConfiguration'][_0x1a8b('0x46')]({'where':{'id':_0x589b26[_0x1a8b('0x3d')]['id']}})['then'](handleEntityNotFound(_0xc8240a,null))[_0x1a8b('0x20')](function(_0x55e7c2){if(_0x55e7c2){_0x1ded8f=_0x55e7c2;_0x11969f['model']=_[_0x1a8b('0x3e')](db[_0x1a8b('0x4c')][_0x1a8b('0x26')]);_0x11969f['query']=_['keys'](_0x589b26['query']);_0x11969f['filters']=_[_0x1a8b('0x2c')](_0x11969f['model'],_0x11969f[_0x1a8b('0x29')]);_0x1a12e8[_0x1a8b('0x2b')]=_[_0x1a8b('0x2c')](_0x11969f[_0x1a8b('0x2a')],qs[_0x1a8b('0x2d')](_0x589b26[_0x1a8b('0x29')]['fields']));_0x1a12e8[_0x1a8b('0x2b')]=_0x1a12e8[_0x1a8b('0x2b')]['length']?_0x1a12e8[_0x1a8b('0x2b')]:_0x11969f[_0x1a8b('0x2a')];_0x1a12e8[_0x1a8b('0x30')]=qs[_0x1a8b('0x31')](_0x589b26['query'][_0x1a8b('0x31')]);_0x1a12e8['where']=qs[_0x1a8b('0x32')](_[_0x1a8b('0x33')](_0x589b26[_0x1a8b('0x29')],_0x11969f['filters']));if(_0x589b26[_0x1a8b('0x29')][_0x1a8b('0x34')]){_0x1a12e8['where']=_[_0x1a8b('0x36')](_0x1a12e8[_0x1a8b('0x35')],{'$or':_['map'](_0x1a12e8[_0x1a8b('0x2b')],function(_0x4b760f){var _0x17b8ce={};_0x17b8ce[_0x4b760f]={'$like':'%'+_0x589b26[_0x1a8b('0x29')][_0x1a8b('0x34')]+'%'};return _0x17b8ce;})});}_0x1a12e8=_[_0x1a8b('0x36')]({},_0x1a12e8,_0x589b26[_0x1a8b('0x39')]);return _0x1ded8f[_0x1a8b('0x4b')](_0x1a12e8);}})[_0x1a8b('0x20')](function(_0xb4e4b2){if(_0xb4e4b2){_0x1500a8=_0xb4e4b2['length'];if(!_0x589b26[_0x1a8b('0x29')][_0x1a8b('0x48')](_0x1a8b('0x2f'))){_0x1a12e8[_0x1a8b('0x1a')]=qs[_0x1a8b('0x1a')](_0x589b26[_0x1a8b('0x29')][_0x1a8b('0x1a')]);_0x1a12e8['offset']=qs['offset'](_0x589b26['query'][_0x1a8b('0x1c')]);}return _0x1ded8f[_0x1a8b('0x4b')](_0x1a12e8);}})[_0x1a8b('0x20')](function(_0x2047f2){if(_0x2047f2){return _0x2047f2?{'count':_0x1500a8,'rows':_0x2047f2}:null;}})[_0x1a8b('0x20')](respondWithResult(_0xc8240a,null))['catch'](handleError(_0xc8240a,null));};exports[_0x1a8b('0x4d')]=function(_0x22ae47,_0x5b840f,_0x5c03b8){if(_0x22ae47[_0x1a8b('0x44')]['id']){delete _0x22ae47[_0x1a8b('0x44')]['id'];}return db['FreshdeskConfiguration'][_0x1a8b('0x46')]({'where':{'id':_0x22ae47[_0x1a8b('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5b840f,null))['then'](function(_0x118b9e){if(_0x118b9e){return _0x118b9e[_0x1a8b('0x4d')](_0x22ae47[_0x1a8b('0x44')][_0x1a8b('0x4e')]||[]);}return null;})[_0x1a8b('0x20')](respondWithResult(_0x5b840f,null))[_0x1a8b('0x42')](handleError(_0x5b840f,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index aef20d2..876aad0 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 _0xef18=['define','FreshdeskConfiguration','int_freshdesk_configurations','util','moment','path','rimraf','../../config/environment','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xef18,0x93));var _0x8ef1=function(_0x154192,_0x2d360f){_0x154192=_0x154192-0x0;var _0x3c2792=_0xef18[_0x154192];return _0x3c2792;};'use strict';var _=require('lodash');var util=require(_0x8ef1('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x8ef1('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8ef1('0x2'));var rimraf=require(_0x8ef1('0x3'));var config=require(_0x8ef1('0x4'));var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x8ef1('0x5')]=function(_0x2d59c7,_0x4bb286){return _0x2d59c7[_0x8ef1('0x6')](_0x8ef1('0x7'),attributes,{'tableName':_0x8ef1('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x44e6=['bluebird','path','rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','lodash','util','api','moment'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x44e6,0x1d2));var _0x644e=function(_0x9f8c49,_0xf052a5){_0x9f8c49=_0x9f8c49-0x0;var _0xc13f84=_0x44e6[_0x9f8c49];return _0xc13f84;};'use strict';var _=require(_0x644e('0x0'));var util=require(_0x644e('0x1'));var logger=require('../../config/logger')(_0x644e('0x2'));var moment=require(_0x644e('0x3'));var BPromise=require(_0x644e('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x644e('0x5'));var rimraf=require(_0x644e('0x6'));var config=require(_0x644e('0x7'));var attributes=require(_0x644e('0x8'));module[_0x644e('0x9')]=function(_0x72cd10,_0x1124f8){return _0x72cd10['define']('FreshdeskConfiguration',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 bf9f121..a367920 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 _0x9068=['../../config/logger','jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5bfdae,_0x20f7c2){var _0x39fc13=function(_0x2433c8){while(--_0x2433c8){_0x5bfdae['push'](_0x5bfdae['shift']());}};_0x39fc13(++_0x20f7c2);}(_0x9068,0x68));var _0x8906=function(_0x139d53,_0x2fb64a){_0x139d53=_0x139d53-0x0;var _0x5ad7a7=_0x9068[_0x139d53];return _0x5ad7a7;};'use strict';var _=require(_0x8906('0x0'));var util=require(_0x8906('0x1'));var moment=require('moment');var BPromise=require(_0x8906('0x2'));var rs=require(_0x8906('0x3'));var fs=require('fs');var Redis=require(_0x8906('0x4'));var db=require(_0x8906('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8906('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x8906('0x7'));var client=jayson[_0x8906('0x8')][_0x8906('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x596ab4,_0xf668d7,_0x4096ba){return new BPromise(function(_0x365594,_0x4b52c0){return client[_0x8906('0xa')](_0x596ab4,_0x4096ba)[_0x8906('0xb')](function(_0x448f24){logger[_0x8906('0xc')](_0x8906('0xd'),_0xf668d7,'request\x20sent');logger[_0x8906('0xe')](_0x8906('0xf'),_0xf668d7,_0x8906('0x10'),JSON[_0x8906('0x11')](_0x448f24));if(_0x448f24['error']){if(_0x448f24[_0x8906('0x12')][_0x8906('0x13')]===0x1f4){logger['error']('FreshdeskConfiguration,\x20%s,\x20%s',_0xf668d7,_0x448f24[_0x8906('0x12')][_0x8906('0x14')]);return _0x4b52c0(_0x448f24[_0x8906('0x12')][_0x8906('0x14')]);}logger[_0x8906('0x12')](_0x8906('0xd'),_0xf668d7,_0x448f24[_0x8906('0x12')][_0x8906('0x14')]);return _0x365594(_0x448f24[_0x8906('0x12')][_0x8906('0x14')]);}else{logger[_0x8906('0xc')](_0x8906('0xd'),_0xf668d7,_0x8906('0x10'));_0x365594(_0x448f24['result']['message']);}})[_0x8906('0x15')](function(_0x5a5542){logger['error'](_0x8906('0xd'),_0xf668d7,_0x5a5542);_0x4b52c0(_0x5a5542);});});} \ No newline at end of file +var _0xd99f=['jayson/promise','client','http','request','then','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x433a86,_0x175b5c){var _0x23000c=function(_0x4b1fa0){while(--_0x4b1fa0){_0x433a86['push'](_0x433a86['shift']());}};_0x23000c(++_0x175b5c);}(_0xd99f,0x139));var _0xfd99=function(_0x51153d,_0x2f44de){_0x51153d=_0x51153d-0x0;var _0xf8c6f1=_0xd99f[_0x51153d];return _0xf8c6f1;};'use strict';var _=require('lodash');var util=require(_0xfd99('0x0'));var moment=require('moment');var BPromise=require(_0xfd99('0x1'));var rs=require(_0xfd99('0x2'));var fs=require('fs');var Redis=require(_0xfd99('0x3'));var db=require(_0xfd99('0x4'))['db'];var utils=require(_0xfd99('0x5'));var logger=require(_0xfd99('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfd99('0x7'));var client=jayson[_0xfd99('0x8')][_0xfd99('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x81c74b,_0x4f75e9,_0x509974){return new BPromise(function(_0x1ee3f0,_0x2abdd5){return client[_0xfd99('0xa')](_0x81c74b,_0x509974)[_0xfd99('0xb')](function(_0xdd56f2){logger[_0xfd99('0xc')](_0xfd99('0xd'),_0x4f75e9,_0xfd99('0xe'));logger[_0xfd99('0xf')]('FreshdeskConfiguration,\x20%s,\x20%s,\x20%s',_0x4f75e9,'request\x20sent',JSON[_0xfd99('0x10')](_0xdd56f2));if(_0xdd56f2[_0xfd99('0x11')]){if(_0xdd56f2[_0xfd99('0x11')]['code']===0x1f4){logger[_0xfd99('0x11')](_0xfd99('0xd'),_0x4f75e9,_0xdd56f2[_0xfd99('0x11')][_0xfd99('0x12')]);return _0x2abdd5(_0xdd56f2[_0xfd99('0x11')][_0xfd99('0x12')]);}logger[_0xfd99('0x11')](_0xfd99('0xd'),_0x4f75e9,_0xdd56f2[_0xfd99('0x11')][_0xfd99('0x12')]);return _0x1ee3f0(_0xdd56f2[_0xfd99('0x11')][_0xfd99('0x12')]);}else{logger['info']('FreshdeskConfiguration,\x20%s,\x20%s',_0x4f75e9,'request\x20sent');_0x1ee3f0(_0xdd56f2[_0xfd99('0x13')]['message']);}})['catch'](function(_0x54840f){logger[_0xfd99('0x11')](_0xfd99('0xd'),_0x4f75e9,_0x54840f);_0x2abdd5(_0x54840f);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 7db6e0e..e4b7838 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 _0x8086=['destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','create','put','update','delete'];(function(_0xc44e66,_0x5348ca){var _0x1e55a4=function(_0x2c2e3d){while(--_0x2c2e3d){_0xc44e66['push'](_0xc44e66['shift']());}};_0x1e55a4(++_0x5348ca);}(_0x8086,0x80));var _0x6808=function(_0x70c450,_0x75c9a){_0x70c450=_0x70c450-0x0;var _0x4c89c1=_0x8086[_0x70c450];return _0x4c89c1;};'use strict';var multer=require('multer');var util=require(_0x6808('0x0'));var path=require(_0x6808('0x1'));var timeout=require(_0x6808('0x2'));var express=require(_0x6808('0x3'));var router=express[_0x6808('0x4')]();var fs_extra=require(_0x6808('0x5'));var auth=require(_0x6808('0x6'));var interaction=require(_0x6808('0x7'));var config=require(_0x6808('0x8'));var controller=require('./intFreshdeskField.controller');router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6808('0x9')](_0x6808('0xa'),auth[_0x6808('0xb')](),controller['show']);router['post']('/',auth[_0x6808('0xb')](),controller[_0x6808('0xc')]);router[_0x6808('0xd')](_0x6808('0xa'),auth[_0x6808('0xb')](),controller[_0x6808('0xe')]);router[_0x6808('0xf')]('/:id',auth[_0x6808('0xb')](),controller[_0x6808('0x10')]);module[_0x6808('0x11')]=router; \ No newline at end of file +var _0xb1c6=['../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','show','create','update','delete','/:id','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x3299d1,_0x545733){var _0x44356e=function(_0x52fd77){while(--_0x52fd77){_0x3299d1['push'](_0x3299d1['shift']());}};_0x44356e(++_0x545733);}(_0xb1c6,0x161));var _0x6b1c=function(_0xbbeaac,_0x2da9a0){_0xbbeaac=_0xbbeaac-0x0;var _0x11ca51=_0xb1c6[_0xbbeaac];return _0x11ca51;};'use strict';var multer=require(_0x6b1c('0x0'));var util=require(_0x6b1c('0x1'));var path=require(_0x6b1c('0x2'));var timeout=require(_0x6b1c('0x3'));var express=require('express');var router=express[_0x6b1c('0x4')]();var fs_extra=require(_0x6b1c('0x5'));var auth=require(_0x6b1c('0x6'));var interaction=require(_0x6b1c('0x7'));var config=require(_0x6b1c('0x8'));var controller=require(_0x6b1c('0x9'));router[_0x6b1c('0xa')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6b1c('0xa')]('/:id',auth[_0x6b1c('0xb')](),controller[_0x6b1c('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6b1c('0xd')]);router['put']('/:id',auth[_0x6b1c('0xb')](),controller[_0x6b1c('0xe')]);router[_0x6b1c('0xf')](_0x6b1c('0x10'),auth[_0x6b1c('0xb')](),controller[_0x6b1c('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 8470824..49a91dc 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 _0x5e48=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x16f3c9,_0x369845){var _0x24fd14=function(_0x35dd60){while(--_0x35dd60){_0x16f3c9['push'](_0x16f3c9['shift']());}};_0x24fd14(++_0x369845);}(_0x5e48,0x10f));var _0x85e4=function(_0x5937a8,_0x5ba2c2){_0x5937a8=_0x5937a8-0x0;var _0x3e0162=_0x5e48[_0x5937a8];return _0x3e0162;};'use strict';var Sequelize=require(_0x85e4('0x0'));module[_0x85e4('0x1')]={'type':{'type':Sequelize[_0x85e4('0x2')](_0x85e4('0x3'),_0x85e4('0x4'),_0x85e4('0x5'),_0x85e4('0x6'),_0x85e4('0x7')),'defaultValue':_0x85e4('0x3')},'content':{'type':Sequelize[_0x85e4('0x8')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x85e4('0x2')](_0x85e4('0x3'),_0x85e4('0x4'),_0x85e4('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x85e4('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x85e4('0x8')]}}; \ No newline at end of file +var _0x9a7f=['variable','customVariable','STRING','ENUM','BOOLEAN','exports','string'];(function(_0x47131e,_0x5b341a){var _0x22baf9=function(_0x42b19c){while(--_0x42b19c){_0x47131e['push'](_0x47131e['shift']());}};_0x22baf9(++_0x5b341a);}(_0x9a7f,0xbb));var _0xf9a7=function(_0x143a6a,_0x560e0f){_0x143a6a=_0x143a6a-0x0;var _0x4bbe68=_0x9a7f[_0x143a6a];return _0x4bbe68;};'use strict';var Sequelize=require('sequelize');module[_0xf9a7('0x0')]={'type':{'type':Sequelize['ENUM'](_0xf9a7('0x1'),_0xf9a7('0x2'),_0xf9a7('0x3'),'keyValue','picklist'),'defaultValue':_0xf9a7('0x1')},'content':{'type':Sequelize[_0xf9a7('0x4')]},'key':{'type':Sequelize[_0xf9a7('0x4')]},'keyType':{'type':Sequelize[_0xf9a7('0x5')](_0xf9a7('0x1'),'variable',_0xf9a7('0x3'))},'keyContent':{'type':Sequelize[_0xf9a7('0x4')]},'idField':{'type':Sequelize[_0xf9a7('0x4')]},'nameField':{'type':Sequelize[_0xf9a7('0x4')]},'customField':{'type':Sequelize[_0xf9a7('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf9a7('0x4')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index c7f799b..7821b6b 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 _0xe130=['includeAll','include','findAll','show','params','keys','length','find','catch','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options'];(function(_0x3d5f84,_0x569548){var _0x1981b8=function(_0x3bf9f3){while(--_0x3bf9f3){_0x3d5f84['push'](_0x3d5f84['shift']());}};_0x1981b8(++_0x569548);}(_0xe130,0x127));var _0x0e13=function(_0x37b3e5,_0x126734){_0x37b3e5=_0x37b3e5-0x0;var _0x9ccf55=_0xe130[_0x37b3e5];return _0x9ccf55;};'use strict';var emlformat=require(_0x0e13('0x0'));var rimraf=require(_0x0e13('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0e13('0x2'));var rp=require(_0x0e13('0x3'));var moment=require(_0x0e13('0x4'));var BPromise=require(_0x0e13('0x5'));var Mustache=require(_0x0e13('0x6'));var util=require('util');var path=require(_0x0e13('0x7'));var sox=require(_0x0e13('0x8'));var csv=require(_0x0e13('0x9'));var ejs=require(_0x0e13('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0e13('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0e13('0xc'));var toCsv=require(_0x0e13('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x0e13('0xd'));var authService=require(_0x0e13('0xe'));var qs=require(_0x0e13('0xf'));var as=require(_0x0e13('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x0e13('0x11'));var utils=require(_0x0e13('0x12'));var config=require(_0x0e13('0x13'));var licenseUtil=require(_0x0e13('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1b4391,_0x4d9ea0){_0x4d9ea0=_0x4d9ea0||0xcc;return function(_0x2ef77e){if(_0x2ef77e){return _0x1b4391[_0x0e13('0x15')](_0x4d9ea0);}return _0x1b4391[_0x0e13('0x16')](_0x4d9ea0)[_0x0e13('0x17')]();};}function respondWithResult(_0x2f0d82,_0x1ec6ad){_0x1ec6ad=_0x1ec6ad||0xc8;return function(_0x27c3cf){if(_0x27c3cf){return _0x2f0d82[_0x0e13('0x16')](_0x1ec6ad)[_0x0e13('0x18')](_0x27c3cf);}};}function respondWithFilteredResult(_0x530f82,_0x302763){return function(_0xbc1617){if(_0xbc1617){var _0x2057fe=typeof _0x302763[_0x0e13('0x19')]===_0x0e13('0x1a')&&typeof _0x302763[_0x0e13('0x1b')]==='undefined';var _0x11ec50=_0xbc1617[_0x0e13('0x1c')];var _0x510a2b=_0x2057fe?0x0:_0x302763['offset'];var _0x3b85fd=_0x2057fe?_0xbc1617['count']:_0x302763[_0x0e13('0x19')]+_0x302763['limit'];var _0x294aea;if(_0x3b85fd>=_0x11ec50){_0x3b85fd=_0x11ec50;_0x294aea=0xc8;}else{_0x294aea=0xce;}_0x530f82[_0x0e13('0x16')](_0x294aea);return _0x530f82[_0x0e13('0x1d')](_0x0e13('0x1e'),_0x510a2b+'-'+_0x3b85fd+'/'+_0x11ec50)[_0x0e13('0x18')](_0xbc1617);}return null;};}function patchUpdates(_0x5ef062){return function(_0x5cfba8){try{jsonpatch['apply'](_0x5cfba8,_0x5ef062,!![]);}catch(_0x2dddef){return BPromise[_0x0e13('0x1f')](_0x2dddef);}return _0x5cfba8['save']();};}function saveUpdates(_0x515222,_0x295eb0){return function(_0x296ed3){if(_0x296ed3){return _0x296ed3[_0x0e13('0x20')](_0x515222)['then'](function(_0x400e87){return _0x400e87;});}return null;};}function removeEntity(_0x70c3db,_0x22cc15){return function(_0x20303b){if(_0x20303b){return _0x20303b[_0x0e13('0x21')]()[_0x0e13('0x22')](function(){_0x70c3db[_0x0e13('0x16')](0xcc)[_0x0e13('0x17')]();});}};}function handleEntityNotFound(_0x3d6abf,_0x260bf7){return function(_0x9621e2){if(!_0x9621e2){_0x3d6abf[_0x0e13('0x15')](0x194);}return _0x9621e2;};}function handleError(_0x230684,_0x45edf7){_0x45edf7=_0x45edf7||0x1f4;return function(_0xfd19ed){logger[_0x0e13('0x23')](_0xfd19ed[_0x0e13('0x24')]);if(_0xfd19ed['name']){delete _0xfd19ed[_0x0e13('0x25')];}_0x230684[_0x0e13('0x16')](_0x45edf7)[_0x0e13('0x26')](_0xfd19ed);};}exports['index']=function(_0x2182ae,_0x1deb3b){var _0xa38940={},_0x4606de={},_0x5d41c3={'count':0x0,'rows':[]};var _0xe9151f=_[_0x0e13('0x27')](db[_0x0e13('0x28')][_0x0e13('0x29')],function(_0x2e65e2){return{'name':_0x2e65e2[_0x0e13('0x2a')],'type':_0x2e65e2[_0x0e13('0x2b')][_0x0e13('0x2c')]};});_0x4606de['model']=_[_0x0e13('0x27')](_0xe9151f,_0x0e13('0x25'));_0x4606de[_0x0e13('0x2d')]=_['keys'](_0x2182ae[_0x0e13('0x2d')]);_0x4606de[_0x0e13('0x2e')]=_[_0x0e13('0x2f')](_0x4606de[_0x0e13('0x30')],_0x4606de[_0x0e13('0x2d')]);_0xa38940[_0x0e13('0x31')]=_[_0x0e13('0x2f')](_0x4606de[_0x0e13('0x30')],qs[_0x0e13('0x32')](_0x2182ae['query'][_0x0e13('0x32')]));_0xa38940[_0x0e13('0x31')]=_0xa38940[_0x0e13('0x31')]['length']?_0xa38940[_0x0e13('0x31')]:_0x4606de['model'];if(!_0x2182ae[_0x0e13('0x2d')][_0x0e13('0x33')](_0x0e13('0x34'))){_0xa38940[_0x0e13('0x1b')]=qs[_0x0e13('0x1b')](_0x2182ae[_0x0e13('0x2d')][_0x0e13('0x1b')]);_0xa38940['offset']=qs['offset'](_0x2182ae[_0x0e13('0x2d')][_0x0e13('0x19')]);}_0xa38940[_0x0e13('0x35')]=qs[_0x0e13('0x36')](_0x2182ae[_0x0e13('0x2d')][_0x0e13('0x36')]);_0xa38940[_0x0e13('0x37')]=qs['filters'](_[_0x0e13('0x38')](_0x2182ae[_0x0e13('0x2d')],_0x4606de[_0x0e13('0x2e')]),_0xe9151f);if(_0x2182ae[_0x0e13('0x2d')][_0x0e13('0x39')]){_0xa38940['where']=_[_0x0e13('0x3a')](_0xa38940[_0x0e13('0x37')],{'$or':_[_0x0e13('0x27')](_0xe9151f,function(_0x4b17f2){if(_0x4b17f2[_0x0e13('0x2b')]!=='VIRTUAL'){var _0x33af9a={};_0x33af9a[_0x4b17f2['name']]={'$like':'%'+_0x2182ae[_0x0e13('0x2d')]['filter']+'%'};return _0x33af9a;}})});}_0xa38940=_[_0x0e13('0x3a')]({},_0xa38940,_0x2182ae[_0x0e13('0x3b')]);var _0x3cdc25={'where':_0xa38940[_0x0e13('0x37')]};return db[_0x0e13('0x28')][_0x0e13('0x1c')](_0x3cdc25)['then'](function(_0x445949){_0x5d41c3[_0x0e13('0x1c')]=_0x445949;if(_0x2182ae[_0x0e13('0x2d')][_0x0e13('0x3c')]){_0xa38940[_0x0e13('0x3d')]=[{'all':!![]}];}return db[_0x0e13('0x28')][_0x0e13('0x3e')](_0xa38940);})['then'](function(_0x164720){_0x5d41c3['rows']=_0x164720;return _0x5d41c3;})['then'](respondWithFilteredResult(_0x1deb3b,_0xa38940))['catch'](handleError(_0x1deb3b,null));};exports[_0x0e13('0x3f')]=function(_0xe6bb04,_0x3060e1){var _0x14ab2a={'raw':!![],'where':{'id':_0xe6bb04[_0x0e13('0x40')]['id']}},_0x3ee751={};_0x3ee751[_0x0e13('0x30')]=_['keys'](db[_0x0e13('0x28')]['rawAttributes']);_0x3ee751['query']=_[_0x0e13('0x41')](_0xe6bb04[_0x0e13('0x2d')]);_0x3ee751[_0x0e13('0x2e')]=_[_0x0e13('0x2f')](_0x3ee751['model'],_0x3ee751[_0x0e13('0x2d')]);_0x14ab2a[_0x0e13('0x31')]=_['intersection'](_0x3ee751[_0x0e13('0x30')],qs[_0x0e13('0x32')](_0xe6bb04[_0x0e13('0x2d')][_0x0e13('0x32')]));_0x14ab2a[_0x0e13('0x31')]=_0x14ab2a[_0x0e13('0x31')][_0x0e13('0x42')]?_0x14ab2a[_0x0e13('0x31')]:_0x3ee751[_0x0e13('0x30')];if(_0xe6bb04[_0x0e13('0x2d')]['includeAll']){_0x14ab2a['include']=[{'all':!![]}];}_0x14ab2a=_[_0x0e13('0x3a')]({},_0x14ab2a,_0xe6bb04[_0x0e13('0x3b')]);return db[_0x0e13('0x28')][_0x0e13('0x43')](_0x14ab2a)[_0x0e13('0x22')](handleEntityNotFound(_0x3060e1,null))['then'](respondWithResult(_0x3060e1,null))[_0x0e13('0x44')](handleError(_0x3060e1,null));};exports[_0x0e13('0x45')]=function(_0x30b637,_0x548259){return db[_0x0e13('0x28')]['create'](_0x30b637[_0x0e13('0x46')],{})[_0x0e13('0x22')](respondWithResult(_0x548259,0xc9))[_0x0e13('0x44')](handleError(_0x548259,null));};exports[_0x0e13('0x20')]=function(_0x35249c,_0x47e5b8){if(_0x35249c[_0x0e13('0x46')]['id']){delete _0x35249c['body']['id'];}return db[_0x0e13('0x28')][_0x0e13('0x43')]({'where':{'id':_0x35249c['params']['id']}})[_0x0e13('0x22')](handleEntityNotFound(_0x47e5b8,null))[_0x0e13('0x22')](saveUpdates(_0x35249c[_0x0e13('0x46')],null))[_0x0e13('0x22')](respondWithResult(_0x47e5b8,null))['catch'](handleError(_0x47e5b8,null));};exports[_0x0e13('0x21')]=function(_0x359de5,_0x4d9afd){return db[_0x0e13('0x28')]['find']({'where':{'id':_0x359de5['params']['id']}})['then'](handleEntityNotFound(_0x4d9afd,null))[_0x0e13('0x22')](removeEntity(_0x4d9afd,null))['catch'](handleError(_0x4d9afd,null));}; \ No newline at end of file +var _0x668b=['attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','catch','show','params','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','bluebird','util','path','sox','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','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','update','destroy','then','error','stack','name','send','map','FreshdeskField','rawAttributes','fieldName','type','model','query','keys','filters','intersection'];(function(_0x41f10f,_0x77a2c7){var _0x45fbc1=function(_0x2e4470){while(--_0x2e4470){_0x41f10f['push'](_0x41f10f['shift']());}};_0x45fbc1(++_0x77a2c7);}(_0x668b,0x140));var _0xb668=function(_0x9729d7,_0x1b79a8){_0x9729d7=_0x9729d7-0x0;var _0x3c4ac6=_0x668b[_0x9729d7];return _0x3c4ac6;};'use strict';var emlformat=require(_0xb668('0x0'));var rimraf=require(_0xb668('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xb668('0x2'));var rp=require(_0xb668('0x3'));var moment=require('moment');var BPromise=require(_0xb668('0x4'));var Mustache=require('mustache');var util=require(_0xb668('0x5'));var path=require(_0xb668('0x6'));var sox=require(_0xb668('0x7'));var csv=require('to-csv');var ejs=require(_0xb668('0x8'));var fs=require('fs');var fs_extra=require(_0xb668('0x9'));var _=require(_0xb668('0xa'));var squel=require(_0xb668('0xb'));var crypto=require(_0xb668('0xc'));var jsforce=require(_0xb668('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xb668('0xe'));var querystring=require(_0xb668('0xf'));var Papa=require(_0xb668('0x10'));var Redis=require(_0xb668('0x11'));var authService=require(_0xb668('0x12'));var qs=require(_0xb668('0x13'));var as=require(_0xb668('0x14'));var hardwareService=require(_0xb668('0x15'));var logger=require('../../config/logger')(_0xb668('0x16'));var utils=require(_0xb668('0x17'));var config=require(_0xb668('0x18'));var licenseUtil=require(_0xb668('0x19'));var db=require(_0xb668('0x1a'))['db'];function respondWithStatusCode(_0x167057,_0x1d111a){_0x1d111a=_0x1d111a||0xcc;return function(_0x10ed24){if(_0x10ed24){return _0x167057[_0xb668('0x1b')](_0x1d111a);}return _0x167057[_0xb668('0x1c')](_0x1d111a)[_0xb668('0x1d')]();};}function respondWithResult(_0x3b7556,_0x3aed25){_0x3aed25=_0x3aed25||0xc8;return function(_0xd0450f){if(_0xd0450f){return _0x3b7556[_0xb668('0x1c')](_0x3aed25)[_0xb668('0x1e')](_0xd0450f);}};}function respondWithFilteredResult(_0x1ca6e7,_0x222cad){return function(_0x4fa32a){if(_0x4fa32a){var _0x4a755b=typeof _0x222cad[_0xb668('0x1f')]===_0xb668('0x20')&&typeof _0x222cad['limit']===_0xb668('0x20');var _0x567ad7=_0x4fa32a[_0xb668('0x21')];var _0x89fe72=_0x4a755b?0x0:_0x222cad['offset'];var _0x38595d=_0x4a755b?_0x4fa32a[_0xb668('0x21')]:_0x222cad['offset']+_0x222cad[_0xb668('0x22')];var _0x5b31ab;if(_0x38595d>=_0x567ad7){_0x38595d=_0x567ad7;_0x5b31ab=0xc8;}else{_0x5b31ab=0xce;}_0x1ca6e7[_0xb668('0x1c')](_0x5b31ab);return _0x1ca6e7[_0xb668('0x23')](_0xb668('0x24'),_0x89fe72+'-'+_0x38595d+'/'+_0x567ad7)[_0xb668('0x1e')](_0x4fa32a);}return null;};}function patchUpdates(_0x5d33ae){return function(_0x2b7f96){try{jsonpatch[_0xb668('0x25')](_0x2b7f96,_0x5d33ae,!![]);}catch(_0x25e5be){return BPromise['reject'](_0x25e5be);}return _0x2b7f96['save']();};}function saveUpdates(_0x43a70b,_0x1e5620){return function(_0x517eee){if(_0x517eee){return _0x517eee[_0xb668('0x26')](_0x43a70b)['then'](function(_0x2f1394){return _0x2f1394;});}return null;};}function removeEntity(_0x4bd365,_0x3f4745){return function(_0x1e1c94){if(_0x1e1c94){return _0x1e1c94[_0xb668('0x27')]()[_0xb668('0x28')](function(){_0x4bd365[_0xb668('0x1c')](0xcc)[_0xb668('0x1d')]();});}};}function handleEntityNotFound(_0x4d4bf8,_0x23084d){return function(_0x10d767){if(!_0x10d767){_0x4d4bf8[_0xb668('0x1b')](0x194);}return _0x10d767;};}function handleError(_0x49abfd,_0x5e0cee){_0x5e0cee=_0x5e0cee||0x1f4;return function(_0xe62fce){logger[_0xb668('0x29')](_0xe62fce[_0xb668('0x2a')]);if(_0xe62fce['name']){delete _0xe62fce[_0xb668('0x2b')];}_0x49abfd[_0xb668('0x1c')](_0x5e0cee)[_0xb668('0x2c')](_0xe62fce);};}exports['index']=function(_0x5709e2,_0x12919c){var _0x2619a4={},_0x589c58={},_0x2e5857={'count':0x0,'rows':[]};var _0x1791ff=_[_0xb668('0x2d')](db[_0xb668('0x2e')][_0xb668('0x2f')],function(_0x5f36b5){return{'name':_0x5f36b5[_0xb668('0x30')],'type':_0x5f36b5[_0xb668('0x31')]['key']};});_0x589c58[_0xb668('0x32')]=_['map'](_0x1791ff,_0xb668('0x2b'));_0x589c58[_0xb668('0x33')]=_[_0xb668('0x34')](_0x5709e2[_0xb668('0x33')]);_0x589c58[_0xb668('0x35')]=_[_0xb668('0x36')](_0x589c58[_0xb668('0x32')],_0x589c58[_0xb668('0x33')]);_0x2619a4[_0xb668('0x37')]=_['intersection'](_0x589c58[_0xb668('0x32')],qs[_0xb668('0x38')](_0x5709e2[_0xb668('0x33')]['fields']));_0x2619a4[_0xb668('0x37')]=_0x2619a4[_0xb668('0x37')][_0xb668('0x39')]?_0x2619a4[_0xb668('0x37')]:_0x589c58['model'];if(!_0x5709e2[_0xb668('0x33')][_0xb668('0x3a')](_0xb668('0x3b'))){_0x2619a4[_0xb668('0x22')]=qs[_0xb668('0x22')](_0x5709e2[_0xb668('0x33')][_0xb668('0x22')]);_0x2619a4['offset']=qs[_0xb668('0x1f')](_0x5709e2[_0xb668('0x33')]['offset']);}_0x2619a4[_0xb668('0x3c')]=qs['sort'](_0x5709e2['query'][_0xb668('0x3d')]);_0x2619a4[_0xb668('0x3e')]=qs['filters'](_[_0xb668('0x3f')](_0x5709e2['query'],_0x589c58[_0xb668('0x35')]),_0x1791ff);if(_0x5709e2['query']['filter']){_0x2619a4[_0xb668('0x3e')]=_[_0xb668('0x40')](_0x2619a4['where'],{'$or':_['map'](_0x1791ff,function(_0x218c1c){if(_0x218c1c[_0xb668('0x31')]!==_0xb668('0x41')){var _0x187f4d={};_0x187f4d[_0x218c1c[_0xb668('0x2b')]]={'$like':'%'+_0x5709e2['query']['filter']+'%'};return _0x187f4d;}})});}_0x2619a4=_[_0xb668('0x40')]({},_0x2619a4,_0x5709e2[_0xb668('0x42')]);var _0xcdf6a8={'where':_0x2619a4[_0xb668('0x3e')]};return db[_0xb668('0x2e')][_0xb668('0x21')](_0xcdf6a8)['then'](function(_0x51a482){_0x2e5857[_0xb668('0x21')]=_0x51a482;if(_0x5709e2[_0xb668('0x33')][_0xb668('0x43')]){_0x2619a4[_0xb668('0x44')]=[{'all':!![]}];}return db[_0xb668('0x2e')]['findAll'](_0x2619a4);})[_0xb668('0x28')](function(_0x429b14){_0x2e5857['rows']=_0x429b14;return _0x2e5857;})[_0xb668('0x28')](respondWithFilteredResult(_0x12919c,_0x2619a4))[_0xb668('0x45')](handleError(_0x12919c,null));};exports[_0xb668('0x46')]=function(_0x54353,_0x5273e8){var _0x583a61={'raw':!![],'where':{'id':_0x54353[_0xb668('0x47')]['id']}},_0x4b7192={};_0x4b7192['model']=_['keys'](db['FreshdeskField']['rawAttributes']);_0x4b7192[_0xb668('0x33')]=_['keys'](_0x54353[_0xb668('0x33')]);_0x4b7192[_0xb668('0x35')]=_[_0xb668('0x36')](_0x4b7192[_0xb668('0x32')],_0x4b7192[_0xb668('0x33')]);_0x583a61['attributes']=_[_0xb668('0x36')](_0x4b7192[_0xb668('0x32')],qs[_0xb668('0x38')](_0x54353[_0xb668('0x33')][_0xb668('0x38')]));_0x583a61[_0xb668('0x37')]=_0x583a61[_0xb668('0x37')][_0xb668('0x39')]?_0x583a61[_0xb668('0x37')]:_0x4b7192[_0xb668('0x32')];if(_0x54353[_0xb668('0x33')]['includeAll']){_0x583a61[_0xb668('0x44')]=[{'all':!![]}];}_0x583a61=_[_0xb668('0x40')]({},_0x583a61,_0x54353[_0xb668('0x42')]);return db['FreshdeskField']['find'](_0x583a61)[_0xb668('0x28')](handleEntityNotFound(_0x5273e8,null))['then'](respondWithResult(_0x5273e8,null))[_0xb668('0x45')](handleError(_0x5273e8,null));};exports['create']=function(_0x55a656,_0x4e2853){return db[_0xb668('0x2e')][_0xb668('0x48')](_0x55a656['body'],{})[_0xb668('0x28')](respondWithResult(_0x4e2853,0xc9))[_0xb668('0x45')](handleError(_0x4e2853,null));};exports[_0xb668('0x26')]=function(_0x1b649f,_0x16d06f){if(_0x1b649f[_0xb668('0x49')]['id']){delete _0x1b649f[_0xb668('0x49')]['id'];}return db[_0xb668('0x2e')][_0xb668('0x4a')]({'where':{'id':_0x1b649f[_0xb668('0x47')]['id']}})['then'](handleEntityNotFound(_0x16d06f,null))[_0xb668('0x28')](saveUpdates(_0x1b649f[_0xb668('0x49')],null))[_0xb668('0x28')](respondWithResult(_0x16d06f,null))[_0xb668('0x45')](handleError(_0x16d06f,null));};exports[_0xb668('0x27')]=function(_0x3da9ba,_0x381694){return db[_0xb668('0x2e')][_0xb668('0x4a')]({'where':{'id':_0x3da9ba['params']['id']}})[_0xb668('0x28')](handleEntityNotFound(_0x381694,null))[_0xb668('0x28')](removeEntity(_0x381694,null))[_0xb668('0x45')](handleError(_0x381694,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 180bc57..7420fb7 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 _0x28c4=['moment','path','./intFreshdeskField.attributes','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api'];(function(_0x23eb0b,_0x201029){var _0x2953ea=function(_0xa58f8d){while(--_0xa58f8d){_0x23eb0b['push'](_0x23eb0b['shift']());}};_0x2953ea(++_0x201029);}(_0x28c4,0x99));var _0x428c=function(_0x468a77,_0x1382be){_0x468a77=_0x468a77-0x0;var _0x2d1c33=_0x28c4[_0x468a77];return _0x2d1c33;};'use strict';var _=require('lodash');var util=require(_0x428c('0x0'));var logger=require(_0x428c('0x1'))(_0x428c('0x2'));var moment=require(_0x428c('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x428c('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x428c('0x5'));module['exports']=function(_0x3d09ce,_0x59eb90){return _0x3d09ce[_0x428c('0x6')](_0x428c('0x7'),attributes,{'tableName':_0x428c('0x8'),'paranoid':![],'indexes':[{'name':_0x428c('0x9'),'fields':[_0x428c('0xa'),_0x428c('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x6732=['int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','FreshdeskField'];(function(_0x2bf141,_0x31eac7){var _0x48277b=function(_0x9fe560){while(--_0x9fe560){_0x2bf141['push'](_0x2bf141['shift']());}};_0x48277b(++_0x31eac7);}(_0x6732,0x66));var _0x2673=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6732[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x2673('0x0'));var util=require(_0x2673('0x1'));var logger=require(_0x2673('0x2'))(_0x2673('0x3'));var moment=require('moment');var BPromise=require(_0x2673('0x4'));var rp=require(_0x2673('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2673('0x6'));var config=require(_0x2673('0x7'));var attributes=require('./intFreshdeskField.attributes');module['exports']=function(_0x90d6e5,_0x2ec408){return _0x90d6e5[_0x2673('0x8')](_0x2673('0x9'),attributes,{'tableName':_0x2673('0xa'),'paranoid':![],'indexes':[{'name':_0x2673('0xb'),'fields':[_0x2673('0xc'),_0x2673('0xd')],'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 15fb3b0..b81c363 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 _0x7d07=['request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','FreshdeskField,\x20%s,\x20%s'];(function(_0x47bf17,_0x1395fe){var _0x19094f=function(_0x535b16){while(--_0x535b16){_0x47bf17['push'](_0x47bf17['shift']());}};_0x19094f(++_0x1395fe);}(_0x7d07,0x1a8));var _0x77d0=function(_0x144b30,_0x77072d){_0x144b30=_0x144b30-0x0;var _0x1bb7bc=_0x7d07[_0x144b30];return _0x1bb7bc;};'use strict';var _=require(_0x77d0('0x0'));var util=require(_0x77d0('0x1'));var moment=require(_0x77d0('0x2'));var BPromise=require(_0x77d0('0x3'));var rs=require(_0x77d0('0x4'));var fs=require('fs');var Redis=require(_0x77d0('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x77d0('0x6'));var logger=require(_0x77d0('0x7'))('rpc');var config=require(_0x77d0('0x8'));var jayson=require(_0x77d0('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x220ea0,_0x4c235e,_0x489b21){return new BPromise(function(_0xd26c5a,_0x280a39){return client[_0x77d0('0xa')](_0x220ea0,_0x489b21)[_0x77d0('0xb')](function(_0x2a0d6e){logger['info'](_0x77d0('0xc'),_0x4c235e,_0x77d0('0xd'));logger[_0x77d0('0xe')](_0x77d0('0xf'),_0x4c235e,_0x77d0('0xd'),JSON[_0x77d0('0x10')](_0x2a0d6e));if(_0x2a0d6e[_0x77d0('0x11')]){if(_0x2a0d6e[_0x77d0('0x11')][_0x77d0('0x12')]===0x1f4){logger[_0x77d0('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x4c235e,_0x2a0d6e[_0x77d0('0x11')][_0x77d0('0x13')]);return _0x280a39(_0x2a0d6e[_0x77d0('0x11')][_0x77d0('0x13')]);}logger[_0x77d0('0x11')](_0x77d0('0xc'),_0x4c235e,_0x2a0d6e[_0x77d0('0x11')][_0x77d0('0x13')]);return _0xd26c5a(_0x2a0d6e[_0x77d0('0x11')][_0x77d0('0x13')]);}else{logger[_0x77d0('0x14')](_0x77d0('0xc'),_0x4c235e,'request\x20sent');_0xd26c5a(_0x2a0d6e[_0x77d0('0x15')]['message']);}})[_0x77d0('0x16')](function(_0x12cdbc){logger['error'](_0x77d0('0xc'),_0x4c235e,_0x12cdbc);_0x280a39(_0x12cdbc);});});} \ No newline at end of file +var _0x9bbf=['rpc','../../config/environment','jayson/promise','client','http','request','FreshdeskField,\x20%s,\x20%s','request\x20sent','debug','FreshdeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x5b2e3d,_0x2d7f7b){var _0x35a13c=function(_0x831acc){while(--_0x831acc){_0x5b2e3d['push'](_0x5b2e3d['shift']());}};_0x35a13c(++_0x2d7f7b);}(_0x9bbf,0xc9));var _0xf9bb=function(_0x19a9a8,_0x5ebf95){_0x19a9a8=_0x19a9a8-0x0;var _0x444319=_0x9bbf[_0x19a9a8];return _0x444319;};'use strict';var _=require(_0xf9bb('0x0'));var util=require(_0xf9bb('0x1'));var moment=require(_0xf9bb('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf9bb('0x3'));var db=require(_0xf9bb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf9bb('0x5'))(_0xf9bb('0x6'));var config=require(_0xf9bb('0x7'));var jayson=require(_0xf9bb('0x8'));var client=jayson[_0xf9bb('0x9')][_0xf9bb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37e02f,_0x3f3610,_0x146945){return new BPromise(function(_0x2804db,_0x394f9b){return client[_0xf9bb('0xb')](_0x37e02f,_0x146945)['then'](function(_0x1b5932){logger['info'](_0xf9bb('0xc'),_0x3f3610,_0xf9bb('0xd'));logger[_0xf9bb('0xe')](_0xf9bb('0xf'),_0x3f3610,_0xf9bb('0xd'),JSON[_0xf9bb('0x10')](_0x1b5932));if(_0x1b5932['error']){if(_0x1b5932[_0xf9bb('0x11')][_0xf9bb('0x12')]===0x1f4){logger['error'](_0xf9bb('0xc'),_0x3f3610,_0x1b5932[_0xf9bb('0x11')][_0xf9bb('0x13')]);return _0x394f9b(_0x1b5932[_0xf9bb('0x11')][_0xf9bb('0x13')]);}logger[_0xf9bb('0x11')](_0xf9bb('0xc'),_0x3f3610,_0x1b5932[_0xf9bb('0x11')][_0xf9bb('0x13')]);return _0x2804db(_0x1b5932[_0xf9bb('0x11')][_0xf9bb('0x13')]);}else{logger[_0xf9bb('0x14')](_0xf9bb('0xc'),_0x3f3610,_0xf9bb('0xd'));_0x2804db(_0x1b5932[_0xf9bb('0x15')]['message']);}})[_0xf9bb('0x16')](function(_0x1aa412){logger[_0xf9bb('0x11')]('FreshdeskField,\x20%s,\x20%s',_0x3f3610,_0x1aa412);_0x394f9b(_0x1aa412);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 41023bb..ec617fa 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 _0x44a3=['getFields','post','addConfiguration','update','delete','/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id/configurations','getConfigurations'];(function(_0x294547,_0x333824){var _0x4abf4e=function(_0x2c825e){while(--_0x2c825e){_0x294547['push'](_0x294547['shift']());}};_0x4abf4e(++_0x333824);}(_0x44a3,0x1a9));var _0x344a=function(_0x4b3d10,_0x3da823){_0x4b3d10=_0x4b3d10-0x0;var _0x3f62cc=_0x44a3[_0x4b3d10];return _0x3f62cc;};'use strict';var multer=require(_0x344a('0x0'));var util=require(_0x344a('0x1'));var path=require(_0x344a('0x2'));var timeout=require(_0x344a('0x3'));var express=require(_0x344a('0x4'));var router=express[_0x344a('0x5')]();var fs_extra=require(_0x344a('0x6'));var auth=require(_0x344a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x344a('0x8'));var controller=require(_0x344a('0x9'));router[_0x344a('0xa')]('/',auth[_0x344a('0xb')](),controller[_0x344a('0xc')]);router['get']('/:id',auth['isAuthenticated'](),controller['show']);router[_0x344a('0xa')](_0x344a('0xd'),auth[_0x344a('0xb')](),controller[_0x344a('0xe')]);router[_0x344a('0xa')]('/:id/fields',auth[_0x344a('0xb')](),controller[_0x344a('0xf')]);router['post']('/',auth[_0x344a('0xb')](),controller['create']);router[_0x344a('0x10')]('/:id/configurations',auth[_0x344a('0xb')](),controller[_0x344a('0x11')]);router['put']('/:id',auth[_0x344a('0xb')](),controller[_0x344a('0x12')]);router[_0x344a('0x13')](_0x344a('0x14'),auth[_0x344a('0xb')](),controller[_0x344a('0x15')]);module['exports']=router; \ No newline at end of file +var _0xcf66=['util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','post','create','put','update','delete','destroy','multer'];(function(_0x7373fb,_0xe48c3f){var _0x3454f1=function(_0x208653){while(--_0x208653){_0x7373fb['push'](_0x7373fb['shift']());}};_0x3454f1(++_0xe48c3f);}(_0xcf66,0x71));var _0x6cf6=function(_0x38e3c2,_0x26da45){_0x38e3c2=_0x38e3c2-0x0;var _0x1eb893=_0xcf66[_0x38e3c2];return _0x1eb893;};'use strict';var multer=require(_0x6cf6('0x0'));var util=require(_0x6cf6('0x1'));var path=require(_0x6cf6('0x2'));var timeout=require('connect-timeout');var express=require(_0x6cf6('0x3'));var router=express[_0x6cf6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6cf6('0x5'));var config=require(_0x6cf6('0x6'));var controller=require('./intFreshsalesAccount.controller');router[_0x6cf6('0x7')]('/',auth[_0x6cf6('0x8')](),controller[_0x6cf6('0x9')]);router['get'](_0x6cf6('0xa'),auth[_0x6cf6('0x8')](),controller[_0x6cf6('0xb')]);router[_0x6cf6('0x7')](_0x6cf6('0xc'),auth[_0x6cf6('0x8')](),controller['getConfigurations']);router['get']('/:id/fields',auth[_0x6cf6('0x8')](),controller['getFields']);router[_0x6cf6('0xd')]('/',auth[_0x6cf6('0x8')](),controller[_0x6cf6('0xe')]);router[_0x6cf6('0xd')]('/:id/configurations',auth['isAuthenticated'](),controller['addConfiguration']);router[_0x6cf6('0xf')](_0x6cf6('0xa'),auth[_0x6cf6('0x8')](),controller[_0x6cf6('0x10')]);router[_0x6cf6('0x11')](_0x6cf6('0xa'),auth['isAuthenticated'](),controller[_0x6cf6('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 4c3fb9d..d486e30 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 _0x4213=['exports','STRING','username','remoteUri','sequelize'];(function(_0x9aa254,_0x4b66ee){var _0x3e0b46=function(_0x4fd923){while(--_0x4fd923){_0x9aa254['push'](_0x9aa254['shift']());}};_0x3e0b46(++_0x4b66ee);}(_0x4213,0x77));var _0x3421=function(_0x172fc5,_0x22fdf6){_0x172fc5=_0x172fc5-0x0;var _0xe0bcde=_0x4213[_0x172fc5];return _0xe0bcde;};'use strict';var Sequelize=require(_0x3421('0x0'));module[_0x3421('0x1')]={'name':{'type':Sequelize[_0x3421('0x2')]},'description':{'type':Sequelize[_0x3421('0x2')]},'username':{'type':Sequelize[_0x3421('0x2')],'unique':_0x3421('0x3')},'apiKey':{'type':Sequelize[_0x3421('0x2')]},'remoteUri':{'type':Sequelize['STRING'],'unique':_0x3421('0x4')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0xed3c=['STRING','username','sequelize','exports'];(function(_0x56d4ae,_0xf198f7){var _0x5611f8=function(_0x34e810){while(--_0x34e810){_0x56d4ae['push'](_0x56d4ae['shift']());}};_0x5611f8(++_0xf198f7);}(_0xed3c,0x1a6));var _0xced3=function(_0x193927,_0x545c88){_0x193927=_0x193927-0x0;var _0x1d21b1=_0xed3c[_0x193927];return _0x1d21b1;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'name':{'type':Sequelize[_0xced3('0x2')]},'description':{'type':Sequelize[_0xced3('0x2')]},'username':{'type':Sequelize['STRING'],'unique':_0xced3('0x3')},'apiKey':{'type':Sequelize[_0xced3('0x2')]},'remoteUri':{'type':Sequelize[_0xced3('0x2')],'unique':'remoteUri'},'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 a211358..8e05b8a 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 _0x0bda=['index','FreshsalesAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','where','pick','map','VIRTUAL','merge','options','then','include','findAll','rows','catch','show','params','includeAll','find','create','body','destroy','findOne','length','sort','filter','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','getFields','username','remoteUri','apiKey','slice','substring','format','Token\x20token=','Requested\x20Resource\x20not\x20Found','test','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','reject','update','error','stack','name','send'];(function(_0xeddb9,_0x21ff8b){var _0xc4478=function(_0x20c757){while(--_0x20c757){_0xeddb9['push'](_0xeddb9['shift']());}};_0xc4478(++_0x21ff8b);}(_0x0bda,0xf8));var _0xa0bd=function(_0x55ae30,_0x22fb5d){_0x55ae30=_0x55ae30-0x0;var _0x11fe4d=_0x0bda[_0x55ae30];return _0x11fe4d;};'use strict';var emlformat=require(_0xa0bd('0x0'));var rimraf=require(_0xa0bd('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xa0bd('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xa0bd('0x3'));var Mustache=require(_0xa0bd('0x4'));var util=require(_0xa0bd('0x5'));var path=require(_0xa0bd('0x6'));var sox=require(_0xa0bd('0x7'));var csv=require(_0xa0bd('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa0bd('0x9'));var _=require(_0xa0bd('0xa'));var squel=require('squel');var crypto=require(_0xa0bd('0xb'));var jsforce=require('jsforce');var deskjs=require(_0xa0bd('0xc'));var toCsv=require(_0xa0bd('0x8'));var querystring=require(_0xa0bd('0xd'));var Papa=require(_0xa0bd('0xe'));var Redis=require(_0xa0bd('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xa0bd('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xa0bd('0x11'))['db'];var integrations=require(_0xa0bd('0x12'));function respondWithStatusCode(_0x4020eb,_0x2b0957){_0x2b0957=_0x2b0957||0xcc;return function(_0x50245a){if(_0x50245a){return _0x4020eb[_0xa0bd('0x13')](_0x2b0957);}return _0x4020eb['status'](_0x2b0957)[_0xa0bd('0x14')]();};}function respondWithResult(_0x19db7a,_0x4add59){_0x4add59=_0x4add59||0xc8;return function(_0x2b009f){if(_0x2b009f){return _0x19db7a[_0xa0bd('0x15')](_0x4add59)[_0xa0bd('0x16')](_0x2b009f);}};}function respondWithFilteredResult(_0x1cab58,_0x1e6447){return function(_0x3652d0){if(_0x3652d0){var _0x504386=typeof _0x1e6447[_0xa0bd('0x17')]===_0xa0bd('0x18')&&typeof _0x1e6447[_0xa0bd('0x19')]==='undefined';var _0x171a66=_0x3652d0[_0xa0bd('0x1a')];var _0x1db145=_0x504386?0x0:_0x1e6447['offset'];var _0x1ed3f4=_0x504386?_0x3652d0[_0xa0bd('0x1a')]:_0x1e6447[_0xa0bd('0x17')]+_0x1e6447[_0xa0bd('0x19')];var _0x18eb22;if(_0x1ed3f4>=_0x171a66){_0x1ed3f4=_0x171a66;_0x18eb22=0xc8;}else{_0x18eb22=0xce;}_0x1cab58['status'](_0x18eb22);return _0x1cab58['set'](_0xa0bd('0x1b'),_0x1db145+'-'+_0x1ed3f4+'/'+_0x171a66)[_0xa0bd('0x16')](_0x3652d0);}return null;};}function patchUpdates(_0x467bb3){return function(_0x2b6e6b){try{jsonpatch['apply'](_0x2b6e6b,_0x467bb3,!![]);}catch(_0x4c17c4){return BPromise[_0xa0bd('0x1c')](_0x4c17c4);}return _0x2b6e6b['save']();};}function saveUpdates(_0x35a50c,_0x5258ef){return function(_0x57d4b9){if(_0x57d4b9){return _0x57d4b9[_0xa0bd('0x1d')](_0x35a50c)['then'](function(_0x1ed243){return _0x1ed243;});}return null;};}function removeEntity(_0x4c2930,_0x1742e0){return function(_0x1768a8){if(_0x1768a8){return _0x1768a8['destroy']()['then'](function(){_0x4c2930['status'](0xcc)[_0xa0bd('0x14')]();});}};}function handleEntityNotFound(_0x416a2d,_0x415efe){return function(_0x1c99f2){if(!_0x1c99f2){_0x416a2d['sendStatus'](0x194);}return _0x1c99f2;};}function handleError(_0x57f66f,_0x14bc5c){_0x14bc5c=_0x14bc5c||0x1f4;return function(_0x1bfa0e){logger[_0xa0bd('0x1e')](_0x1bfa0e[_0xa0bd('0x1f')]);if(_0x1bfa0e[_0xa0bd('0x20')]){delete _0x1bfa0e['name'];}_0x57f66f[_0xa0bd('0x15')](_0x14bc5c)[_0xa0bd('0x21')](_0x1bfa0e);};}exports[_0xa0bd('0x22')]=function(_0xebec3d,_0x10710e){var _0x5cad04={},_0x31d137={},_0x2cf51d={'count':0x0,'rows':[]};var _0x102a62=_['map'](db[_0xa0bd('0x23')][_0xa0bd('0x24')],function(_0x47e8a6){return{'name':_0x47e8a6[_0xa0bd('0x25')],'type':_0x47e8a6[_0xa0bd('0x26')]['key']};});_0x31d137[_0xa0bd('0x27')]=_['map'](_0x102a62,_0xa0bd('0x20'));_0x31d137['query']=_[_0xa0bd('0x28')](_0xebec3d[_0xa0bd('0x29')]);_0x31d137[_0xa0bd('0x2a')]=_[_0xa0bd('0x2b')](_0x31d137[_0xa0bd('0x27')],_0x31d137[_0xa0bd('0x29')]);_0x5cad04[_0xa0bd('0x2c')]=_[_0xa0bd('0x2b')](_0x31d137[_0xa0bd('0x27')],qs['fields'](_0xebec3d[_0xa0bd('0x29')][_0xa0bd('0x2d')]));_0x5cad04[_0xa0bd('0x2c')]=_0x5cad04[_0xa0bd('0x2c')]['length']?_0x5cad04[_0xa0bd('0x2c')]:_0x31d137['model'];if(!_0xebec3d['query'][_0xa0bd('0x2e')](_0xa0bd('0x2f'))){_0x5cad04['limit']=qs[_0xa0bd('0x19')](_0xebec3d['query'][_0xa0bd('0x19')]);_0x5cad04[_0xa0bd('0x17')]=qs[_0xa0bd('0x17')](_0xebec3d[_0xa0bd('0x29')]['offset']);}_0x5cad04[_0xa0bd('0x30')]=qs['sort'](_0xebec3d[_0xa0bd('0x29')]['sort']);_0x5cad04[_0xa0bd('0x31')]=qs[_0xa0bd('0x2a')](_[_0xa0bd('0x32')](_0xebec3d[_0xa0bd('0x29')],_0x31d137[_0xa0bd('0x2a')]),_0x102a62);if(_0xebec3d[_0xa0bd('0x29')]['filter']){_0x5cad04[_0xa0bd('0x31')]=_['merge'](_0x5cad04[_0xa0bd('0x31')],{'$or':_[_0xa0bd('0x33')](_0x102a62,function(_0x2cb2ed){if(_0x2cb2ed['type']!==_0xa0bd('0x34')){var _0x38907d={};_0x38907d[_0x2cb2ed[_0xa0bd('0x20')]]={'$like':'%'+_0xebec3d['query']['filter']+'%'};return _0x38907d;}})});}_0x5cad04=_[_0xa0bd('0x35')]({},_0x5cad04,_0xebec3d[_0xa0bd('0x36')]);var _0x32415c={'where':_0x5cad04[_0xa0bd('0x31')]};return db[_0xa0bd('0x23')]['count'](_0x32415c)[_0xa0bd('0x37')](function(_0x467a1f){_0x2cf51d[_0xa0bd('0x1a')]=_0x467a1f;if(_0xebec3d[_0xa0bd('0x29')]['includeAll']){_0x5cad04[_0xa0bd('0x38')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0xa0bd('0x39')](_0x5cad04);})[_0xa0bd('0x37')](function(_0x248be6){_0x2cf51d[_0xa0bd('0x3a')]=_0x248be6;return _0x2cf51d;})[_0xa0bd('0x37')](respondWithFilteredResult(_0x10710e,_0x5cad04))[_0xa0bd('0x3b')](handleError(_0x10710e,null));};exports[_0xa0bd('0x3c')]=function(_0x3c74ed,_0x49a584){var _0x2993c8={'raw':![],'where':{'id':_0x3c74ed[_0xa0bd('0x3d')]['id']}},_0x10166b={};_0x10166b[_0xa0bd('0x27')]=_[_0xa0bd('0x28')](db[_0xa0bd('0x23')][_0xa0bd('0x24')]);_0x10166b[_0xa0bd('0x29')]=_['keys'](_0x3c74ed[_0xa0bd('0x29')]);_0x10166b[_0xa0bd('0x2a')]=_[_0xa0bd('0x2b')](_0x10166b[_0xa0bd('0x27')],_0x10166b[_0xa0bd('0x29')]);_0x2993c8['attributes']=_['intersection'](_0x10166b[_0xa0bd('0x27')],qs[_0xa0bd('0x2d')](_0x3c74ed[_0xa0bd('0x29')][_0xa0bd('0x2d')]));_0x2993c8['attributes']=_0x2993c8[_0xa0bd('0x2c')]['length']?_0x2993c8[_0xa0bd('0x2c')]:_0x10166b[_0xa0bd('0x27')];if(_0x3c74ed[_0xa0bd('0x29')][_0xa0bd('0x3e')]){_0x2993c8[_0xa0bd('0x38')]=[{'all':!![]}];}_0x2993c8=_[_0xa0bd('0x35')]({},_0x2993c8,_0x3c74ed[_0xa0bd('0x36')]);return db[_0xa0bd('0x23')][_0xa0bd('0x3f')](_0x2993c8)[_0xa0bd('0x37')](handleEntityNotFound(_0x49a584,null))['then'](respondWithResult(_0x49a584,null))[_0xa0bd('0x3b')](handleError(_0x49a584,null));};exports[_0xa0bd('0x40')]=function(_0x377cfd,_0x26f026){return db['FreshsalesAccount']['create'](_0x377cfd[_0xa0bd('0x41')],{})[_0xa0bd('0x37')](respondWithResult(_0x26f026,0xc9))['catch'](handleError(_0x26f026,null));};exports['update']=function(_0x12afe4,_0x2611cd){if(_0x12afe4['body']['id']){delete _0x12afe4['body']['id'];}return db[_0xa0bd('0x23')][_0xa0bd('0x3f')]({'where':{'id':_0x12afe4[_0xa0bd('0x3d')]['id']}})['then'](handleEntityNotFound(_0x2611cd,null))[_0xa0bd('0x37')](saveUpdates(_0x12afe4['body'],null))['then'](respondWithResult(_0x2611cd,null))[_0xa0bd('0x3b')](handleError(_0x2611cd,null));};exports[_0xa0bd('0x42')]=function(_0x4d7661,_0x49e0fa){return db[_0xa0bd('0x23')][_0xa0bd('0x3f')]({'where':{'id':_0x4d7661[_0xa0bd('0x3d')]['id']}})[_0xa0bd('0x37')](handleEntityNotFound(_0x49e0fa,null))[_0xa0bd('0x37')](removeEntity(_0x49e0fa,null))[_0xa0bd('0x3b')](handleError(_0x49e0fa,null));};exports['getConfigurations']=function(_0x4523a1,_0x433a8f,_0x6ae543){var _0x2f6aed={};var _0x2d0467={};var _0x1bb9e4;var _0x3664af;return db[_0xa0bd('0x23')][_0xa0bd('0x43')]({'where':{'id':_0x4523a1[_0xa0bd('0x3d')]['id']}})[_0xa0bd('0x37')](handleEntityNotFound(_0x433a8f,null))[_0xa0bd('0x37')](function(_0x12d72c){if(_0x12d72c){_0x1bb9e4=_0x12d72c;_0x2d0467[_0xa0bd('0x27')]=_[_0xa0bd('0x28')](db['FreshsalesConfiguration'][_0xa0bd('0x24')]);_0x2d0467[_0xa0bd('0x29')]=_[_0xa0bd('0x28')](_0x4523a1[_0xa0bd('0x29')]);_0x2d0467['filters']=_[_0xa0bd('0x2b')](_0x2d0467['model'],_0x2d0467['query']);_0x2f6aed['attributes']=_[_0xa0bd('0x2b')](_0x2d0467['model'],qs[_0xa0bd('0x2d')](_0x4523a1[_0xa0bd('0x29')][_0xa0bd('0x2d')]));_0x2f6aed[_0xa0bd('0x2c')]=_0x2f6aed[_0xa0bd('0x2c')][_0xa0bd('0x44')]?_0x2f6aed[_0xa0bd('0x2c')]:_0x2d0467['model'];_0x2f6aed[_0xa0bd('0x30')]=qs[_0xa0bd('0x45')](_0x4523a1['query'][_0xa0bd('0x45')]);_0x2f6aed[_0xa0bd('0x31')]=qs['filters'](_[_0xa0bd('0x32')](_0x4523a1['query'],_0x2d0467[_0xa0bd('0x2a')]));if(_0x4523a1[_0xa0bd('0x29')][_0xa0bd('0x46')]){_0x2f6aed[_0xa0bd('0x31')]=_[_0xa0bd('0x35')](_0x2f6aed['where'],{'$or':_[_0xa0bd('0x33')](_0x2f6aed[_0xa0bd('0x2c')],function(_0x6ef9e7){var _0x81a0a6={};_0x81a0a6[_0x6ef9e7]={'$like':'%'+_0x4523a1['query']['filter']+'%'};return _0x81a0a6;})});}_0x2f6aed=_[_0xa0bd('0x35')]({},_0x2f6aed,_0x4523a1[_0xa0bd('0x36')]);return _0x1bb9e4[_0xa0bd('0x47')](_0x2f6aed);}})[_0xa0bd('0x37')](function(_0x27c4a6){if(_0x27c4a6){_0x3664af=_0x27c4a6[_0xa0bd('0x44')];if(!_0x4523a1[_0xa0bd('0x29')][_0xa0bd('0x2e')]('nolimit')){_0x2f6aed['limit']=qs['limit'](_0x4523a1[_0xa0bd('0x29')][_0xa0bd('0x19')]);_0x2f6aed[_0xa0bd('0x17')]=qs[_0xa0bd('0x17')](_0x4523a1['query']['offset']);}return _0x1bb9e4[_0xa0bd('0x47')](_0x2f6aed);}})['then'](function(_0x3e696d){if(_0x3e696d){return _0x3e696d?{'count':_0x3664af,'rows':_0x3e696d}:null;}})[_0xa0bd('0x37')](respondWithResult(_0x433a8f,null))['catch'](handleError(_0x433a8f,null));};exports[_0xa0bd('0x48')]=function(_0x5bd58f,_0x34cdca,_0x44e6ff){if(_0x5bd58f['body']['id']){delete _0x5bd58f['body']['id'];}return db['FreshsalesAccount'][_0xa0bd('0x43')]({'where':{'id':_0x5bd58f['params']['id']}})[_0xa0bd('0x37')](handleEntityNotFound(_0x34cdca,null))[_0xa0bd('0x37')](function(_0x486f51){if(_0x486f51){_0x5bd58f[_0xa0bd('0x41')][_0xa0bd('0x49')]=_0x486f51['id'];_0x5bd58f['body'][_0xa0bd('0x4a')]=integrations[_0xa0bd('0x4b')](_0x5bd58f[_0xa0bd('0x41')][_0xa0bd('0x4c')],_0x5bd58f['body']['type']);_0x5bd58f['body'][_0xa0bd('0x4d')]=integrations[_0xa0bd('0x4e')](_0x5bd58f[_0xa0bd('0x41')][_0xa0bd('0x4c')],_0x5bd58f[_0xa0bd('0x41')][_0xa0bd('0x26')]);return db[_0xa0bd('0x4f')]['create'](_0x5bd58f[_0xa0bd('0x41')],{'include':[{'model':db[_0xa0bd('0x50')],'as':_0xa0bd('0x4a')},{'model':db[_0xa0bd('0x50')],'as':_0xa0bd('0x4d')}]});}return null;})[_0xa0bd('0x37')](respondWithResult(_0x34cdca,null))[_0xa0bd('0x3b')](handleError(_0x34cdca,null));};exports[_0xa0bd('0x51')]=function(_0x13754b,_0xbf84e2,_0x52a67c){var _0x3f4208='';var _0x2e9c5b='';return db[_0xa0bd('0x23')]['findOne']({'where':{'id':_0x13754b[_0xa0bd('0x3d')]['id']},'attributes':['id',_0xa0bd('0x52'),_0xa0bd('0x53'),_0xa0bd('0x54')]})['then'](handleEntityNotFound(_0xbf84e2,null))['then'](function(_0x1c322b){if(_0x1c322b){_0x2e9c5b=_0x1c322b['username'];_0x3f4208=_0x1c322b[_0xa0bd('0x53')];var _0x356bd9=_0x1c322b['remoteUri'][_0xa0bd('0x55')](-0x1);if(_0x356bd9==='/'){_0x3f4208=_0x3f4208[_0xa0bd('0x56')](0x0,_0x3f4208['lastIndexOf'](_0x356bd9));}return rp({'method':'GET','uri':util[_0xa0bd('0x57')]('%s%s',_0x3f4208,'/api/selector/owners'),'headers':{'Authorization':_0xa0bd('0x58')+_0x1c322b[_0xa0bd('0x54')]},'json':!![]});}})[_0xa0bd('0x37')](function(_0x446cab){if(_0x446cab){var _0x14ae39=_0x446cab['users'];var _0x1680f3=![];var _0x20f5ff=null;for(_0x20f5ff=0x0;_0x20f5ff<_0x14ae39[_0xa0bd('0x44')];_0x20f5ff++){if(_0x14ae39[_0x20f5ff]['email']===_0x2e9c5b){_0x1680f3=!![];}}if(_0x1680f3){return!![];}else{throw new Error({'statusCode':0x194,'message':_0xa0bd('0x59')});}}})['then'](respondWithResult(_0xbf84e2,null))[_0xa0bd('0x3b')](function(_0x6a850a){var _0x2407ac=_0x13754b[_0xa0bd('0x29')][_0xa0bd('0x5a')]?0x1f4:_0x6a850a[_0xa0bd('0x5b')]||0x1f4;logger[_0xa0bd('0x1e')]('getFields,\x20%s,\x20%s,\x20%s',_0xa0bd('0x51'),_0x2407ac,JSON[_0xa0bd('0x5c')](_0x6a850a));delete _0x6a850a[_0xa0bd('0x20')];if(_0x2407ac===0x191){_0x2407ac=0x190;}_0xbf84e2[_0xa0bd('0x15')](_0x2407ac)[_0xa0bd('0x21')](_0x13754b[_0xa0bd('0x29')]['test']?{'message':_0xa0bd('0x5d'),'statusCode':_0x6a850a[_0xa0bd('0x5b')]}:_0x6a850a);});}; \ No newline at end of file +var _0xc163=['filter','merge','VIRTUAL','options','FreshsalesAccount','includeAll','include','findAll','catch','show','keys','find','create','body','update','params','findOne','length','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesConfiguration','FreshsalesField','username','remoteUri','apiKey','slice','substring','GET','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','send','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','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','../../config/utils','../../config/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status','offset','limit','undefined','count','Content-Range','json','apply','reject','save','then','destroy','error','stack','name','index','rawAttributes','type','key','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x140d02,_0x3920c6){var _0x2ed5bd=function(_0x4fb454){while(--_0x4fb454){_0x140d02['push'](_0x140d02['shift']());}};_0x2ed5bd(++_0x3920c6);}(_0xc163,0x16b));var _0x3c16=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc163[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3c16('0x0'));var zipdir=require(_0x3c16('0x1'));var jsonpatch=require(_0x3c16('0x2'));var rp=require(_0x3c16('0x3'));var moment=require(_0x3c16('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x3c16('0x5'));var util=require('util');var path=require(_0x3c16('0x6'));var sox=require(_0x3c16('0x7'));var csv=require(_0x3c16('0x8'));var ejs=require(_0x3c16('0x9'));var fs=require('fs');var fs_extra=require(_0x3c16('0xa'));var _=require(_0x3c16('0xb'));var squel=require(_0x3c16('0xc'));var crypto=require(_0x3c16('0xd'));var jsforce=require(_0x3c16('0xe'));var deskjs=require(_0x3c16('0xf'));var toCsv=require(_0x3c16('0x8'));var querystring=require(_0x3c16('0x10'));var Papa=require(_0x3c16('0x11'));var Redis=require('ioredis');var authService=require(_0x3c16('0x12'));var qs=require(_0x3c16('0x13'));var as=require(_0x3c16('0x14'));var hardwareService=require(_0x3c16('0x15'));var logger=require(_0x3c16('0x16'))('api');var utils=require(_0x3c16('0x17'));var config=require(_0x3c16('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x3c16('0x19'))['db'];var integrations=require(_0x3c16('0x1a'));function respondWithStatusCode(_0x3ba8da,_0xeb5fde){_0xeb5fde=_0xeb5fde||0xcc;return function(_0x5081c8){if(_0x5081c8){return _0x3ba8da[_0x3c16('0x1b')](_0xeb5fde);}return _0x3ba8da['status'](_0xeb5fde)[_0x3c16('0x1c')]();};}function respondWithResult(_0x17c543,_0x111638){_0x111638=_0x111638||0xc8;return function(_0x4e1f4f){if(_0x4e1f4f){return _0x17c543[_0x3c16('0x1d')](_0x111638)['json'](_0x4e1f4f);}};}function respondWithFilteredResult(_0x2d8987,_0x54ccd6){return function(_0x3163ee){if(_0x3163ee){var _0x228c9d=typeof _0x54ccd6[_0x3c16('0x1e')]==='undefined'&&typeof _0x54ccd6[_0x3c16('0x1f')]===_0x3c16('0x20');var _0x332ba6=_0x3163ee[_0x3c16('0x21')];var _0x2cbba6=_0x228c9d?0x0:_0x54ccd6['offset'];var _0xe6947d=_0x228c9d?_0x3163ee[_0x3c16('0x21')]:_0x54ccd6['offset']+_0x54ccd6['limit'];var _0x3c25a2;if(_0xe6947d>=_0x332ba6){_0xe6947d=_0x332ba6;_0x3c25a2=0xc8;}else{_0x3c25a2=0xce;}_0x2d8987[_0x3c16('0x1d')](_0x3c25a2);return _0x2d8987['set'](_0x3c16('0x22'),_0x2cbba6+'-'+_0xe6947d+'/'+_0x332ba6)[_0x3c16('0x23')](_0x3163ee);}return null;};}function patchUpdates(_0x37f5c6){return function(_0x198452){try{jsonpatch[_0x3c16('0x24')](_0x198452,_0x37f5c6,!![]);}catch(_0xa89cab){return BPromise[_0x3c16('0x25')](_0xa89cab);}return _0x198452[_0x3c16('0x26')]();};}function saveUpdates(_0x56ef99,_0x834ff7){return function(_0x45d519){if(_0x45d519){return _0x45d519['update'](_0x56ef99)[_0x3c16('0x27')](function(_0x314839){return _0x314839;});}return null;};}function removeEntity(_0x5cd1e0,_0x169d3b){return function(_0x8b6667){if(_0x8b6667){return _0x8b6667[_0x3c16('0x28')]()[_0x3c16('0x27')](function(){_0x5cd1e0[_0x3c16('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a7361,_0x374246){return function(_0x4b2c8f){if(!_0x4b2c8f){_0x4a7361[_0x3c16('0x1b')](0x194);}return _0x4b2c8f;};}function handleError(_0x562cf6,_0x595e82){_0x595e82=_0x595e82||0x1f4;return function(_0x66f983){logger[_0x3c16('0x29')](_0x66f983[_0x3c16('0x2a')]);if(_0x66f983[_0x3c16('0x2b')]){delete _0x66f983[_0x3c16('0x2b')];}_0x562cf6[_0x3c16('0x1d')](_0x595e82)['send'](_0x66f983);};}exports[_0x3c16('0x2c')]=function(_0x48478d,_0x16198d){var _0x5d9e5b={},_0x2afd55={},_0x322033={'count':0x0,'rows':[]};var _0x5c4991=_['map'](db['FreshsalesAccount'][_0x3c16('0x2d')],function(_0x44517a){return{'name':_0x44517a['fieldName'],'type':_0x44517a[_0x3c16('0x2e')][_0x3c16('0x2f')]};});_0x2afd55[_0x3c16('0x30')]=_[_0x3c16('0x31')](_0x5c4991,_0x3c16('0x2b'));_0x2afd55[_0x3c16('0x32')]=_['keys'](_0x48478d[_0x3c16('0x32')]);_0x2afd55[_0x3c16('0x33')]=_[_0x3c16('0x34')](_0x2afd55['model'],_0x2afd55[_0x3c16('0x32')]);_0x5d9e5b[_0x3c16('0x35')]=_['intersection'](_0x2afd55['model'],qs[_0x3c16('0x36')](_0x48478d[_0x3c16('0x32')][_0x3c16('0x36')]));_0x5d9e5b[_0x3c16('0x35')]=_0x5d9e5b[_0x3c16('0x35')]['length']?_0x5d9e5b[_0x3c16('0x35')]:_0x2afd55[_0x3c16('0x30')];if(!_0x48478d[_0x3c16('0x32')][_0x3c16('0x37')](_0x3c16('0x38'))){_0x5d9e5b[_0x3c16('0x1f')]=qs['limit'](_0x48478d[_0x3c16('0x32')]['limit']);_0x5d9e5b[_0x3c16('0x1e')]=qs[_0x3c16('0x1e')](_0x48478d[_0x3c16('0x32')]['offset']);}_0x5d9e5b[_0x3c16('0x39')]=qs[_0x3c16('0x3a')](_0x48478d[_0x3c16('0x32')][_0x3c16('0x3a')]);_0x5d9e5b[_0x3c16('0x3b')]=qs[_0x3c16('0x33')](_[_0x3c16('0x3c')](_0x48478d[_0x3c16('0x32')],_0x2afd55[_0x3c16('0x33')]),_0x5c4991);if(_0x48478d['query'][_0x3c16('0x3d')]){_0x5d9e5b[_0x3c16('0x3b')]=_[_0x3c16('0x3e')](_0x5d9e5b[_0x3c16('0x3b')],{'$or':_['map'](_0x5c4991,function(_0x38e896){if(_0x38e896[_0x3c16('0x2e')]!==_0x3c16('0x3f')){var _0x5a90b9={};_0x5a90b9[_0x38e896[_0x3c16('0x2b')]]={'$like':'%'+_0x48478d[_0x3c16('0x32')]['filter']+'%'};return _0x5a90b9;}})});}_0x5d9e5b=_[_0x3c16('0x3e')]({},_0x5d9e5b,_0x48478d[_0x3c16('0x40')]);var _0x296bfe={'where':_0x5d9e5b[_0x3c16('0x3b')]};return db[_0x3c16('0x41')][_0x3c16('0x21')](_0x296bfe)[_0x3c16('0x27')](function(_0xa0b76){_0x322033[_0x3c16('0x21')]=_0xa0b76;if(_0x48478d[_0x3c16('0x32')][_0x3c16('0x42')]){_0x5d9e5b[_0x3c16('0x43')]=[{'all':!![]}];}return db['FreshsalesAccount'][_0x3c16('0x44')](_0x5d9e5b);})[_0x3c16('0x27')](function(_0xc66043){_0x322033['rows']=_0xc66043;return _0x322033;})['then'](respondWithFilteredResult(_0x16198d,_0x5d9e5b))[_0x3c16('0x45')](handleError(_0x16198d,null));};exports[_0x3c16('0x46')]=function(_0x5898b8,_0x262e76){var _0x4c137b={'raw':![],'where':{'id':_0x5898b8['params']['id']}},_0x2dc465={};_0x2dc465[_0x3c16('0x30')]=_[_0x3c16('0x47')](db[_0x3c16('0x41')][_0x3c16('0x2d')]);_0x2dc465[_0x3c16('0x32')]=_['keys'](_0x5898b8[_0x3c16('0x32')]);_0x2dc465[_0x3c16('0x33')]=_['intersection'](_0x2dc465['model'],_0x2dc465['query']);_0x4c137b[_0x3c16('0x35')]=_['intersection'](_0x2dc465[_0x3c16('0x30')],qs[_0x3c16('0x36')](_0x5898b8['query'][_0x3c16('0x36')]));_0x4c137b['attributes']=_0x4c137b[_0x3c16('0x35')]['length']?_0x4c137b[_0x3c16('0x35')]:_0x2dc465[_0x3c16('0x30')];if(_0x5898b8[_0x3c16('0x32')][_0x3c16('0x42')]){_0x4c137b[_0x3c16('0x43')]=[{'all':!![]}];}_0x4c137b=_[_0x3c16('0x3e')]({},_0x4c137b,_0x5898b8[_0x3c16('0x40')]);return db['FreshsalesAccount'][_0x3c16('0x48')](_0x4c137b)[_0x3c16('0x27')](handleEntityNotFound(_0x262e76,null))['then'](respondWithResult(_0x262e76,null))['catch'](handleError(_0x262e76,null));};exports[_0x3c16('0x49')]=function(_0x3c1ee7,_0x392124){return db['FreshsalesAccount']['create'](_0x3c1ee7[_0x3c16('0x4a')],{})[_0x3c16('0x27')](respondWithResult(_0x392124,0xc9))[_0x3c16('0x45')](handleError(_0x392124,null));};exports[_0x3c16('0x4b')]=function(_0x4d699f,_0x37c183){if(_0x4d699f[_0x3c16('0x4a')]['id']){delete _0x4d699f['body']['id'];}return db[_0x3c16('0x41')][_0x3c16('0x48')]({'where':{'id':_0x4d699f[_0x3c16('0x4c')]['id']}})[_0x3c16('0x27')](handleEntityNotFound(_0x37c183,null))['then'](saveUpdates(_0x4d699f[_0x3c16('0x4a')],null))['then'](respondWithResult(_0x37c183,null))[_0x3c16('0x45')](handleError(_0x37c183,null));};exports[_0x3c16('0x28')]=function(_0x5fb821,_0x48e1ab){return db[_0x3c16('0x41')][_0x3c16('0x48')]({'where':{'id':_0x5fb821[_0x3c16('0x4c')]['id']}})[_0x3c16('0x27')](handleEntityNotFound(_0x48e1ab,null))['then'](removeEntity(_0x48e1ab,null))[_0x3c16('0x45')](handleError(_0x48e1ab,null));};exports['getConfigurations']=function(_0x3f0d45,_0x1d11a8,_0x3f2909){var _0x870fb1={};var _0x1e5588={};var _0x4b021f;var _0x4730c2;return db['FreshsalesAccount'][_0x3c16('0x4d')]({'where':{'id':_0x3f0d45[_0x3c16('0x4c')]['id']}})[_0x3c16('0x27')](handleEntityNotFound(_0x1d11a8,null))[_0x3c16('0x27')](function(_0x2e0338){if(_0x2e0338){_0x4b021f=_0x2e0338;_0x1e5588[_0x3c16('0x30')]=_[_0x3c16('0x47')](db['FreshsalesConfiguration'][_0x3c16('0x2d')]);_0x1e5588[_0x3c16('0x32')]=_[_0x3c16('0x47')](_0x3f0d45[_0x3c16('0x32')]);_0x1e5588['filters']=_[_0x3c16('0x34')](_0x1e5588[_0x3c16('0x30')],_0x1e5588[_0x3c16('0x32')]);_0x870fb1[_0x3c16('0x35')]=_['intersection'](_0x1e5588[_0x3c16('0x30')],qs[_0x3c16('0x36')](_0x3f0d45[_0x3c16('0x32')][_0x3c16('0x36')]));_0x870fb1['attributes']=_0x870fb1['attributes'][_0x3c16('0x4e')]?_0x870fb1[_0x3c16('0x35')]:_0x1e5588[_0x3c16('0x30')];_0x870fb1['order']=qs[_0x3c16('0x3a')](_0x3f0d45[_0x3c16('0x32')][_0x3c16('0x3a')]);_0x870fb1['where']=qs[_0x3c16('0x33')](_[_0x3c16('0x3c')](_0x3f0d45[_0x3c16('0x32')],_0x1e5588[_0x3c16('0x33')]));if(_0x3f0d45['query'][_0x3c16('0x3d')]){_0x870fb1[_0x3c16('0x3b')]=_[_0x3c16('0x3e')](_0x870fb1['where'],{'$or':_[_0x3c16('0x31')](_0x870fb1[_0x3c16('0x35')],function(_0xb5e40){var _0x496945={};_0x496945[_0xb5e40]={'$like':'%'+_0x3f0d45['query'][_0x3c16('0x3d')]+'%'};return _0x496945;})});}_0x870fb1=_[_0x3c16('0x3e')]({},_0x870fb1,_0x3f0d45[_0x3c16('0x40')]);return _0x4b021f[_0x3c16('0x4f')](_0x870fb1);}})[_0x3c16('0x27')](function(_0x471132){if(_0x471132){_0x4730c2=_0x471132['length'];if(!_0x3f0d45[_0x3c16('0x32')][_0x3c16('0x37')](_0x3c16('0x38'))){_0x870fb1[_0x3c16('0x1f')]=qs[_0x3c16('0x1f')](_0x3f0d45[_0x3c16('0x32')][_0x3c16('0x1f')]);_0x870fb1[_0x3c16('0x1e')]=qs[_0x3c16('0x1e')](_0x3f0d45[_0x3c16('0x32')][_0x3c16('0x1e')]);}return _0x4b021f[_0x3c16('0x4f')](_0x870fb1);}})[_0x3c16('0x27')](function(_0x1fdd4e){if(_0x1fdd4e){return _0x1fdd4e?{'count':_0x4730c2,'rows':_0x1fdd4e}:null;}})[_0x3c16('0x27')](respondWithResult(_0x1d11a8,null))[_0x3c16('0x45')](handleError(_0x1d11a8,null));};exports[_0x3c16('0x50')]=function(_0x1fb31f,_0x93ef86,_0x52d408){if(_0x1fb31f['body']['id']){delete _0x1fb31f[_0x3c16('0x4a')]['id'];}return db['FreshsalesAccount'][_0x3c16('0x4d')]({'where':{'id':_0x1fb31f[_0x3c16('0x4c')]['id']}})[_0x3c16('0x27')](handleEntityNotFound(_0x93ef86,null))[_0x3c16('0x27')](function(_0x2cb835){if(_0x2cb835){_0x1fb31f[_0x3c16('0x4a')][_0x3c16('0x51')]=_0x2cb835['id'];_0x1fb31f[_0x3c16('0x4a')][_0x3c16('0x52')]=integrations[_0x3c16('0x53')](_0x1fb31f['body'][_0x3c16('0x54')],_0x1fb31f[_0x3c16('0x4a')]['type']);_0x1fb31f[_0x3c16('0x4a')][_0x3c16('0x55')]=integrations[_0x3c16('0x56')](_0x1fb31f[_0x3c16('0x4a')][_0x3c16('0x54')],_0x1fb31f[_0x3c16('0x4a')][_0x3c16('0x2e')]);return db[_0x3c16('0x57')][_0x3c16('0x49')](_0x1fb31f[_0x3c16('0x4a')],{'include':[{'model':db[_0x3c16('0x58')],'as':'Subjects'},{'model':db[_0x3c16('0x58')],'as':_0x3c16('0x55')}]});}return null;})[_0x3c16('0x27')](respondWithResult(_0x93ef86,null))['catch'](handleError(_0x93ef86,null));};exports['getFields']=function(_0x242b02,_0x159934,_0x25717e){var _0x918031='';var _0x4000d7='';return db['FreshsalesAccount'][_0x3c16('0x4d')]({'where':{'id':_0x242b02['params']['id']},'attributes':['id',_0x3c16('0x59'),_0x3c16('0x5a'),_0x3c16('0x5b')]})['then'](handleEntityNotFound(_0x159934,null))[_0x3c16('0x27')](function(_0x22ce85){if(_0x22ce85){_0x4000d7=_0x22ce85[_0x3c16('0x59')];_0x918031=_0x22ce85['remoteUri'];var _0x21397d=_0x22ce85[_0x3c16('0x5a')][_0x3c16('0x5c')](-0x1);if(_0x21397d==='/'){_0x918031=_0x918031[_0x3c16('0x5d')](0x0,_0x918031['lastIndexOf'](_0x21397d));}return rp({'method':_0x3c16('0x5e'),'uri':util['format'](_0x3c16('0x5f'),_0x918031,_0x3c16('0x60')),'headers':{'Authorization':_0x3c16('0x61')+_0x22ce85[_0x3c16('0x5b')]},'json':!![]});}})[_0x3c16('0x27')](function(_0x4c3be0){if(_0x4c3be0){var _0x4b7767=_0x4c3be0[_0x3c16('0x62')];var _0x346ed7=![];var _0xa23f9f=null;for(_0xa23f9f=0x0;_0xa23f9f<_0x4b7767['length'];_0xa23f9f++){if(_0x4b7767[_0xa23f9f][_0x3c16('0x63')]===_0x4000d7){_0x346ed7=!![];}}if(_0x346ed7){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x3c16('0x64')});}}})[_0x3c16('0x27')](respondWithResult(_0x159934,null))[_0x3c16('0x45')](function(_0x2cb1b5){var _0x3dccbe=_0x242b02[_0x3c16('0x32')][_0x3c16('0x65')]?0x1f4:_0x2cb1b5[_0x3c16('0x66')]||0x1f4;logger[_0x3c16('0x29')](_0x3c16('0x67'),'getFields',_0x3dccbe,JSON[_0x3c16('0x68')](_0x2cb1b5));delete _0x2cb1b5[_0x3c16('0x2b')];if(_0x3dccbe===0x191){_0x3dccbe=0x190;}_0x159934[_0x3c16('0x1d')](_0x3dccbe)[_0x3c16('0x69')](_0x242b02[_0x3c16('0x32')]['test']?{'message':'Wrong\x20credentials','statusCode':_0x2cb1b5[_0x3c16('0x66')]}:_0x2cb1b5);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index 8980058..719567d 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 _0x1a37=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration','define','FreshsalesAccount','lodash','util'];(function(_0x5617e2,_0x1ffcd7){var _0x27b60d=function(_0xf3f7a2){while(--_0xf3f7a2){_0x5617e2['push'](_0x5617e2['shift']());}};_0x27b60d(++_0x1ffcd7);}(_0x1a37,0xb4));var _0x71a3=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0x1a37[_0x231e16];return _0x570a7c;};'use strict';var _=require(_0x71a3('0x0'));var util=require(_0x71a3('0x1'));var logger=require(_0x71a3('0x2'))(_0x71a3('0x3'));var moment=require(_0x71a3('0x4'));var BPromise=require(_0x71a3('0x5'));var rp=require(_0x71a3('0x6'));var fs=require('fs');var path=require(_0x71a3('0x7'));var rimraf=require(_0x71a3('0x8'));var config=require(_0x71a3('0x9'));var attributes=require('./intFreshsalesAccount.attributes');var integrations=require(_0x71a3('0xa'));module['exports']=function(_0xd09f7,_0x45050a){return _0xd09f7[_0x71a3('0xb')](_0x71a3('0xc'),attributes,{'tableName':'int_freshsales_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x33af=['request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration','define','FreshsalesAccount','int_freshsales_accounts','util','api','moment','bluebird'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x33af,0xec));var _0xf33a=function(_0xa38cf2,_0x13e769){_0xa38cf2=_0xa38cf2-0x0;var _0x1c9a57=_0x33af[_0xa38cf2];return _0x1c9a57;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var logger=require('../../config/logger')(_0xf33a('0x1'));var moment=require(_0xf33a('0x2'));var BPromise=require(_0xf33a('0x3'));var rp=require(_0xf33a('0x4'));var fs=require('fs');var path=require(_0xf33a('0x5'));var rimraf=require(_0xf33a('0x6'));var config=require('../../config/environment');var attributes=require(_0xf33a('0x7'));var integrations=require(_0xf33a('0x8'));module['exports']=function(_0xc0dd13,_0x384b14){return _0xc0dd13[_0xf33a('0x9')](_0xf33a('0xa'),attributes,{'tableName':_0xf33a('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 f433cef..e71d5fe 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 _0x5430=['map','model','find','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','FreshsalesAccount,\x20%s,\x20%s','message','result','GetFreshsalesAccount','FreshsalesAccount','options','raw','where','attributes','limit','include'];(function(_0x3f0053,_0x4153ce){var _0x41b433=function(_0x5b3042){while(--_0x5b3042){_0x3f0053['push'](_0x3f0053['shift']());}};_0x41b433(++_0x4153ce);}(_0x5430,0x10c));var _0x0543=function(_0x1faced,_0x56df37){_0x1faced=_0x1faced-0x0;var _0x43f382=_0x5430[_0x1faced];return _0x43f382;};'use strict';var _=require(_0x0543('0x0'));var util=require(_0x0543('0x1'));var moment=require(_0x0543('0x2'));var BPromise=require(_0x0543('0x3'));var rs=require(_0x0543('0x4'));var fs=require('fs');var Redis=require(_0x0543('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x0543('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0543('0x7'));var client=jayson[_0x0543('0x8')][_0x0543('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x319568,_0x46bca7,_0x5ac352){return new BPromise(function(_0x372974,_0x7b8280){return client[_0x0543('0xa')](_0x319568,_0x5ac352)[_0x0543('0xb')](function(_0x2fb723){logger[_0x0543('0xc')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'));logger[_0x0543('0xe')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x46bca7,_0x0543('0xd'),JSON[_0x0543('0xf')](_0x2fb723));if(_0x2fb723[_0x0543('0x10')]){if(_0x2fb723[_0x0543('0x10')][_0x0543('0x11')]===0x1f4){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x7b8280(_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);}logger[_0x0543('0x10')]('FreshsalesAccount,\x20%s,\x20%s',_0x46bca7,_0x2fb723[_0x0543('0x10')][_0x0543('0x13')]);return _0x372974(_0x2fb723['error']['message']);}else{logger[_0x0543('0xc')](_0x0543('0x12'),_0x46bca7,_0x0543('0xd'));_0x372974(_0x2fb723[_0x0543('0x14')][_0x0543('0x13')]);}})['catch'](function(_0xe69a3d){logger[_0x0543('0x10')](_0x0543('0x12'),_0x46bca7,_0xe69a3d);_0x7b8280(_0xe69a3d);});});}exports[_0x0543('0x15')]=function(_0x20b396){var _0x285080=this;return new Promise(function(_0x577cf0,_0x5eb03e){return db[_0x0543('0x16')]['findAll']({'raw':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x20b396[_0x0543('0x17')]?_0x20b396['options'][_0x0543('0x19')]||null:null,'attributes':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'limit':_0x20b396['options']?_0x20b396[_0x0543('0x17')][_0x0543('0x1b')]||null:null,'include':_0x20b396[_0x0543('0x17')]?_0x20b396[_0x0543('0x17')][_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x20b396['options']['include'],function(_0x59f1b2){return{'model':db[_0x59f1b2[_0x0543('0x1e')]],'as':_0x59f1b2['as'],'attributes':_0x59f1b2[_0x0543('0x1a')],'include':_0x59f1b2[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x59f1b2[_0x0543('0x1c')],function(_0x26e500){return{'model':db[_0x26e500[_0x0543('0x1e')]],'as':_0x26e500['as'],'attributes':_0x26e500[_0x0543('0x1a')],'include':_0x26e500[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x26e500[_0x0543('0x1c')],function(_0x21fc63){return{'model':db[_0x21fc63['model']],'as':_0x21fc63['as'],'attributes':_0x21fc63[_0x0543('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x30ad9e){logger['info'](_0x0543('0x15'),_0x20b396);logger[_0x0543('0xe')](_0x0543('0x15'),_0x20b396,JSON[_0x0543('0xf')](_0x30ad9e));_0x577cf0(_0x30ad9e);})['catch'](function(_0x1732be){logger[_0x0543('0x10')]('GetFreshsalesAccount',_0x1732be['message'],_0x20b396);_0x5eb03e(_0x285080[_0x0543('0x10')](0x1f4,_0x1732be[_0x0543('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0x3b879b){var _0x2e03d1=this;return new Promise(function(_0x931ccc,_0x2bd6ce){return db[_0x0543('0x16')][_0x0543('0x1f')]({'raw':_0x3b879b[_0x0543('0x17')]?_0x3b879b['options'][_0x0543('0x18')]===undefined?!![]:![]:!![],'where':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')][_0x0543('0x19')]||null:null,'attributes':_0x3b879b[_0x0543('0x17')]?_0x3b879b[_0x0543('0x17')][_0x0543('0x1a')]||null:null,'include':_0x3b879b['options']?_0x3b879b[_0x0543('0x17')]['include']?_[_0x0543('0x1d')](_0x3b879b[_0x0543('0x17')][_0x0543('0x1c')],function(_0x327027){return{'model':db[_0x327027['model']],'as':_0x327027['as'],'attributes':_0x327027[_0x0543('0x1a')],'include':_0x327027['include']?_[_0x0543('0x1d')](_0x327027[_0x0543('0x1c')],function(_0x3fbf5f){return{'model':db[_0x3fbf5f[_0x0543('0x1e')]],'as':_0x3fbf5f['as'],'attributes':_0x3fbf5f[_0x0543('0x1a')],'include':_0x3fbf5f[_0x0543('0x1c')]?_[_0x0543('0x1d')](_0x3fbf5f[_0x0543('0x1c')],function(_0x8ef4d4){return{'model':db[_0x8ef4d4[_0x0543('0x1e')]],'as':_0x8ef4d4['as'],'attributes':_0x8ef4d4['attributes']};}):[]};}):[]};}):[]:[]})[_0x0543('0xb')](function(_0x2d76d6){logger['info'](_0x0543('0x20'),_0x3b879b);logger['debug'](_0x0543('0x20'),_0x3b879b,JSON[_0x0543('0xf')](_0x2d76d6));_0x931ccc(_0x2d76d6);})['catch'](function(_0x5e8800){logger[_0x0543('0x10')](_0x0543('0x20'),_0x5e8800['message'],_0x3b879b);_0x2bd6ce(_0x2e03d1[_0x0543('0x10')](0x1f4,_0x5e8800[_0x0543('0x13')]));});});}; \ No newline at end of file +var _0x4745=['debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','attributes','limit','include','map','model','then','raw','ShowFreshsalesAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','FreshsalesAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x29d623,_0x1a5c9c){var _0x242e59=function(_0x2c78ab){while(--_0x2c78ab){_0x29d623['push'](_0x29d623['shift']());}};_0x242e59(++_0x1a5c9c);}(_0x4745,0x1e7));var _0x5474=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x4745[_0x2f5ac5];return _0x37c9a8;};'use strict';var _=require(_0x5474('0x0'));var util=require(_0x5474('0x1'));var moment=require(_0x5474('0x2'));var BPromise=require(_0x5474('0x3'));var rs=require(_0x5474('0x4'));var fs=require('fs');var Redis=require(_0x5474('0x5'));var db=require(_0x5474('0x6'))['db'];var utils=require(_0x5474('0x7'));var logger=require(_0x5474('0x8'))(_0x5474('0x9'));var config=require(_0x5474('0xa'));var jayson=require(_0x5474('0xb'));var client=jayson['client'][_0x5474('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x431f81,_0x57add7,_0x13929f){return new BPromise(function(_0x5d778b,_0x902ba8){return client[_0x5474('0xd')](_0x431f81,_0x13929f)['then'](function(_0xf876f8){logger[_0x5474('0xe')](_0x5474('0xf'),_0x57add7,_0x5474('0x10'));logger[_0x5474('0x11')](_0x5474('0x12'),_0x57add7,_0x5474('0x10'),JSON[_0x5474('0x13')](_0xf876f8));if(_0xf876f8['error']){if(_0xf876f8[_0x5474('0x14')][_0x5474('0x15')]===0x1f4){logger[_0x5474('0x14')](_0x5474('0xf'),_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x902ba8(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}logger[_0x5474('0x14')]('FreshsalesAccount,\x20%s,\x20%s',_0x57add7,_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);return _0x5d778b(_0xf876f8[_0x5474('0x14')][_0x5474('0x16')]);}else{logger['info']('FreshsalesAccount,\x20%s,\x20%s',_0x57add7,'request\x20sent');_0x5d778b(_0xf876f8['result'][_0x5474('0x16')]);}})[_0x5474('0x17')](function(_0x2da774){logger['error'](_0x5474('0xf'),_0x57add7,_0x2da774);_0x902ba8(_0x2da774);});});}exports[_0x5474('0x18')]=function(_0x56dbfa){var _0x22b37d=this;return new Promise(function(_0x198fc8,_0x18b0fe){return db[_0x5474('0x19')][_0x5474('0x1a')]({'raw':_0x56dbfa['options']?_0x56dbfa[_0x5474('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')]['where']||null:null,'attributes':_0x56dbfa['options']?_0x56dbfa['options'][_0x5474('0x1c')]||null:null,'limit':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1d')]||null:null,'include':_0x56dbfa[_0x5474('0x1b')]?_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x56dbfa[_0x5474('0x1b')][_0x5474('0x1e')],function(_0x542d1f){return{'model':db[_0x542d1f['model']],'as':_0x542d1f['as'],'attributes':_0x542d1f[_0x5474('0x1c')],'include':_0x542d1f[_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x542d1f['include'],function(_0x24997a){return{'model':db[_0x24997a['model']],'as':_0x24997a['as'],'attributes':_0x24997a[_0x5474('0x1c')],'include':_0x24997a[_0x5474('0x1e')]?_['map'](_0x24997a[_0x5474('0x1e')],function(_0x5d4cd7){return{'model':db[_0x5d4cd7[_0x5474('0x20')]],'as':_0x5d4cd7['as'],'attributes':_0x5d4cd7['attributes']};}):[]};}):[]};}):[]:[]})[_0x5474('0x21')](function(_0x1384e4){logger[_0x5474('0xe')]('GetFreshsalesAccount',_0x56dbfa);logger[_0x5474('0x11')](_0x5474('0x18'),_0x56dbfa,JSON['stringify'](_0x1384e4));_0x198fc8(_0x1384e4);})['catch'](function(_0x5d2381){logger['error'](_0x5474('0x18'),_0x5d2381[_0x5474('0x16')],_0x56dbfa);_0x18b0fe(_0x22b37d['error'](0x1f4,_0x5d2381[_0x5474('0x16')]));});});};exports['ShowFreshsalesAccount']=function(_0xc1e0ce){var _0x58f27a=this;return new Promise(function(_0x70774f,_0x530cdb){return db[_0x5474('0x19')]['find']({'raw':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce[_0x5474('0x1b')][_0x5474('0x22')]===undefined?!![]:![]:!![],'where':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce['options']['where']||null:null,'attributes':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce[_0x5474('0x1b')][_0x5474('0x1c')]||null:null,'include':_0xc1e0ce[_0x5474('0x1b')]?_0xc1e0ce['options']['include']?_[_0x5474('0x1f')](_0xc1e0ce[_0x5474('0x1b')]['include'],function(_0x3ce359){return{'model':db[_0x3ce359[_0x5474('0x20')]],'as':_0x3ce359['as'],'attributes':_0x3ce359[_0x5474('0x1c')],'include':_0x3ce359[_0x5474('0x1e')]?_['map'](_0x3ce359[_0x5474('0x1e')],function(_0x409111){return{'model':db[_0x409111[_0x5474('0x20')]],'as':_0x409111['as'],'attributes':_0x409111['attributes'],'include':_0x409111[_0x5474('0x1e')]?_[_0x5474('0x1f')](_0x409111[_0x5474('0x1e')],function(_0x2f4589){return{'model':db[_0x2f4589['model']],'as':_0x2f4589['as'],'attributes':_0x2f4589['attributes']};}):[]};}):[]};}):[]:[]})[_0x5474('0x21')](function(_0x3eccef){logger[_0x5474('0xe')](_0x5474('0x23'),_0xc1e0ce);logger['debug'](_0x5474('0x23'),_0xc1e0ce,JSON[_0x5474('0x13')](_0x3eccef));_0x70774f(_0x3eccef);})[_0x5474('0x17')](function(_0x22009e){logger['error']('ShowFreshsalesAccount',_0x22009e['message'],_0xc1e0ce);_0x530cdb(_0x58f27a[_0x5474('0x14')](0x1f4,_0x22009e['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 96e3f89..c547afa 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 _0xbd61=['path','connect-timeout','express','Router','../../config/environment','get','index','isAuthenticated','/:id/descriptions','getDescriptions','getFields','post','create','put','update','delete','/:id','destroy','exports','util'];(function(_0x4ac6c6,_0xbaf850){var _0x3871b3=function(_0x1e2ccb){while(--_0x1e2ccb){_0x4ac6c6['push'](_0x4ac6c6['shift']());}};_0x3871b3(++_0xbaf850);}(_0xbd61,0x13f));var _0x1bd6=function(_0x240411,_0x489fdf){_0x240411=_0x240411-0x0;var _0x25eaeb=_0xbd61[_0x240411];return _0x25eaeb;};'use strict';var multer=require('multer');var util=require(_0x1bd6('0x0'));var path=require(_0x1bd6('0x1'));var timeout=require(_0x1bd6('0x2'));var express=require(_0x1bd6('0x3'));var router=express[_0x1bd6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1bd6('0x5'));var controller=require('./intFreshsalesConfiguration.controller');router[_0x1bd6('0x6')]('/',auth['isAuthenticated'](),controller[_0x1bd6('0x7')]);router[_0x1bd6('0x6')]('/:id',auth[_0x1bd6('0x8')](),controller['show']);router['get']('/:id/subjects',auth[_0x1bd6('0x8')](),controller['getSubjects']);router[_0x1bd6('0x6')](_0x1bd6('0x9'),auth['isAuthenticated'](),controller[_0x1bd6('0xa')]);router[_0x1bd6('0x6')]('/:id/fields',auth[_0x1bd6('0x8')](),controller[_0x1bd6('0xb')]);router[_0x1bd6('0xc')]('/',auth['isAuthenticated'](),controller[_0x1bd6('0xd')]);router[_0x1bd6('0xe')]('/:id',auth[_0x1bd6('0x8')](),controller[_0x1bd6('0xf')]);router[_0x1bd6('0x10')](_0x1bd6('0x11'),auth[_0x1bd6('0x8')](),controller[_0x1bd6('0x12')]);module[_0x1bd6('0x13')]=router; \ No newline at end of file +var _0xc066=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller','isAuthenticated','get','show','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/fields','getFields','post','create','put','/:id','update','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x560d66,_0xf86af7){var _0x1a7191=function(_0x47fdbc){while(--_0x47fdbc){_0x560d66['push'](_0x560d66['shift']());}};_0x1a7191(++_0xf86af7);}(_0xc066,0x166));var _0x6c06=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0xc066[_0x42cae2];return _0x5f256f;};'use strict';var multer=require(_0x6c06('0x0'));var util=require(_0x6c06('0x1'));var path=require(_0x6c06('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c06('0x3'));var router=express[_0x6c06('0x4')]();var fs_extra=require(_0x6c06('0x5'));var auth=require(_0x6c06('0x6'));var interaction=require(_0x6c06('0x7'));var config=require(_0x6c06('0x8'));var controller=require(_0x6c06('0x9'));router['get']('/',auth[_0x6c06('0xa')](),controller['index']);router[_0x6c06('0xb')]('/:id',auth[_0x6c06('0xa')](),controller[_0x6c06('0xc')]);router[_0x6c06('0xb')](_0x6c06('0xd'),auth['isAuthenticated'](),controller[_0x6c06('0xe')]);router[_0x6c06('0xb')](_0x6c06('0xf'),auth[_0x6c06('0xa')](),controller[_0x6c06('0x10')]);router[_0x6c06('0xb')](_0x6c06('0x11'),auth[_0x6c06('0xa')](),controller[_0x6c06('0x12')]);router[_0x6c06('0x13')]('/',auth[_0x6c06('0xa')](),controller[_0x6c06('0x14')]);router[_0x6c06('0x15')](_0x6c06('0x16'),auth[_0x6c06('0xa')](),controller[_0x6c06('0x17')]);router['delete'](_0x6c06('0x16'),auth['isAuthenticated'](),controller[_0x6c06('0x18')]);module[_0x6c06('0x19')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 7df895d..7506b39 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 _0xdff0=['STRING','sequelize'];(function(_0x38a297,_0x15d60a){var _0xa0f9b5=function(_0xca76e3){while(--_0xca76e3){_0x38a297['push'](_0x38a297['shift']());}};_0xa0f9b5(++_0x15d60a);}(_0xdff0,0xcd));var _0x0dff=function(_0x5eb65f,_0x3b64d4){_0x5eb65f=_0x5eb65f-0x0;var _0x301698=_0xdff0[_0x5eb65f];return _0x301698;};'use strict';var Sequelize=require(_0x0dff('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x0dff('0x1')]}}; \ No newline at end of file +var _0xa7d1=['exports','STRING','sequelize'];(function(_0x3bef91,_0x25ab24){var _0x2513b8=function(_0x3f2724){while(--_0x3f2724){_0x3bef91['push'](_0x3bef91['shift']());}};_0x2513b8(++_0x25ab24);}(_0xa7d1,0x1b8));var _0x1a7d=function(_0x5c8811,_0x4f77d5){_0x5c8811=_0x5c8811-0x0;var _0x2c0941=_0xa7d1[_0x5c8811];return _0x2c0941;};'use strict';var Sequelize=require(_0x1a7d('0x0'));module[_0x1a7d('0x1')]={'name':{'type':Sequelize[_0x1a7d('0x2')]},'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 32f6be3..e4d1ecf 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 _0x8d2e=['attributes','fields','order','sort','where','filters','pick','merge','filter','options','FreshsalesConfiguration','includeAll','include','show','length','find','catch','create','body','params','getSubjects','FreshsalesField','rawAttributes','hasOwnProperty','nolimit','getDescriptions','findOne','getFields','eml-format','rimraf','zip-dir','fast-json-patch','mustache','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/utils','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','name','send','index','map','fieldName','type','key','model','query','keys','intersection'];(function(_0x1badf3,_0x454ce5){var _0x4fc085=function(_0x2ff0bc){while(--_0x2ff0bc){_0x1badf3['push'](_0x1badf3['shift']());}};_0x4fc085(++_0x454ce5);}(_0x8d2e,0x1a2));var _0xe8d2=function(_0xacad55,_0x41a4ab){_0xacad55=_0xacad55-0x0;var _0x2a9454=_0x8d2e[_0xacad55];return _0x2a9454;};'use strict';var emlformat=require(_0xe8d2('0x0'));var rimraf=require(_0xe8d2('0x1'));var zipdir=require(_0xe8d2('0x2'));var jsonpatch=require(_0xe8d2('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xe8d2('0x4'));var util=require(_0xe8d2('0x5'));var path=require(_0xe8d2('0x6'));var sox=require(_0xe8d2('0x7'));var csv=require(_0xe8d2('0x8'));var ejs=require(_0xe8d2('0x9'));var fs=require('fs');var fs_extra=require(_0xe8d2('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xe8d2('0xb'));var jsforce=require(_0xe8d2('0xc'));var deskjs=require(_0xe8d2('0xd'));var toCsv=require(_0xe8d2('0x8'));var querystring=require(_0xe8d2('0xe'));var Papa=require(_0xe8d2('0xf'));var Redis=require(_0xe8d2('0x10'));var authService=require(_0xe8d2('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe8d2('0x12'));var logger=require(_0xe8d2('0x13'))(_0xe8d2('0x14'));var utils=require(_0xe8d2('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xe8d2('0x16'))['db'];function respondWithStatusCode(_0x4fa398,_0x5bdb45){_0x5bdb45=_0x5bdb45||0xcc;return function(_0x2fa00d){if(_0x2fa00d){return _0x4fa398[_0xe8d2('0x17')](_0x5bdb45);}return _0x4fa398[_0xe8d2('0x18')](_0x5bdb45)[_0xe8d2('0x19')]();};}function respondWithResult(_0x5eda00,_0x36391c){_0x36391c=_0x36391c||0xc8;return function(_0x4aed8b){if(_0x4aed8b){return _0x5eda00[_0xe8d2('0x18')](_0x36391c)['json'](_0x4aed8b);}};}function respondWithFilteredResult(_0x905c53,_0x338475){return function(_0x2dcffb){if(_0x2dcffb){var _0x58ddcb=typeof _0x338475['offset']===_0xe8d2('0x1a')&&typeof _0x338475[_0xe8d2('0x1b')]===_0xe8d2('0x1a');var _0x42b8af=_0x2dcffb[_0xe8d2('0x1c')];var _0x24b535=_0x58ddcb?0x0:_0x338475[_0xe8d2('0x1d')];var _0x416e84=_0x58ddcb?_0x2dcffb[_0xe8d2('0x1c')]:_0x338475[_0xe8d2('0x1d')]+_0x338475[_0xe8d2('0x1b')];var _0x9fbbe6;if(_0x416e84>=_0x42b8af){_0x416e84=_0x42b8af;_0x9fbbe6=0xc8;}else{_0x9fbbe6=0xce;}_0x905c53[_0xe8d2('0x18')](_0x9fbbe6);return _0x905c53[_0xe8d2('0x1e')](_0xe8d2('0x1f'),_0x24b535+'-'+_0x416e84+'/'+_0x42b8af)[_0xe8d2('0x20')](_0x2dcffb);}return null;};}function patchUpdates(_0x2dee61){return function(_0x2d97f0){try{jsonpatch[_0xe8d2('0x21')](_0x2d97f0,_0x2dee61,!![]);}catch(_0x27bb96){return BPromise['reject'](_0x27bb96);}return _0x2d97f0[_0xe8d2('0x22')]();};}function saveUpdates(_0xc4af0e,_0x455e65){return function(_0x315964){if(_0x315964){return _0x315964[_0xe8d2('0x23')](_0xc4af0e)[_0xe8d2('0x24')](function(_0x44ae8a){return _0x44ae8a;});}return null;};}function removeEntity(_0x2da2ba,_0x305d37){return function(_0x1a6291){if(_0x1a6291){return _0x1a6291[_0xe8d2('0x25')]()['then'](function(){_0x2da2ba[_0xe8d2('0x18')](0xcc)[_0xe8d2('0x19')]();});}};}function handleEntityNotFound(_0x243845,_0x5a774e){return function(_0x698ba4){if(!_0x698ba4){_0x243845[_0xe8d2('0x17')](0x194);}return _0x698ba4;};}function handleError(_0x298441,_0x479a83){_0x479a83=_0x479a83||0x1f4;return function(_0x126170){logger[_0xe8d2('0x26')](_0x126170['stack']);if(_0x126170[_0xe8d2('0x27')]){delete _0x126170[_0xe8d2('0x27')];}_0x298441[_0xe8d2('0x18')](_0x479a83)[_0xe8d2('0x28')](_0x126170);};}exports[_0xe8d2('0x29')]=function(_0x4a5a78,_0x2a76a1){var _0x11bc12={},_0x4cd7ee={},_0x20035d={'count':0x0,'rows':[]};var _0x2b9317=_[_0xe8d2('0x2a')](db['FreshsalesConfiguration']['rawAttributes'],function(_0x30af36){return{'name':_0x30af36[_0xe8d2('0x2b')],'type':_0x30af36[_0xe8d2('0x2c')][_0xe8d2('0x2d')]};});_0x4cd7ee[_0xe8d2('0x2e')]=_[_0xe8d2('0x2a')](_0x2b9317,'name');_0x4cd7ee[_0xe8d2('0x2f')]=_[_0xe8d2('0x30')](_0x4a5a78[_0xe8d2('0x2f')]);_0x4cd7ee['filters']=_[_0xe8d2('0x31')](_0x4cd7ee[_0xe8d2('0x2e')],_0x4cd7ee[_0xe8d2('0x2f')]);_0x11bc12[_0xe8d2('0x32')]=_[_0xe8d2('0x31')](_0x4cd7ee[_0xe8d2('0x2e')],qs['fields'](_0x4a5a78['query'][_0xe8d2('0x33')]));_0x11bc12[_0xe8d2('0x32')]=_0x11bc12['attributes']['length']?_0x11bc12['attributes']:_0x4cd7ee[_0xe8d2('0x2e')];if(!_0x4a5a78['query']['hasOwnProperty']('nolimit')){_0x11bc12[_0xe8d2('0x1b')]=qs[_0xe8d2('0x1b')](_0x4a5a78['query'][_0xe8d2('0x1b')]);_0x11bc12[_0xe8d2('0x1d')]=qs[_0xe8d2('0x1d')](_0x4a5a78['query'][_0xe8d2('0x1d')]);}_0x11bc12[_0xe8d2('0x34')]=qs[_0xe8d2('0x35')](_0x4a5a78[_0xe8d2('0x2f')][_0xe8d2('0x35')]);_0x11bc12[_0xe8d2('0x36')]=qs[_0xe8d2('0x37')](_[_0xe8d2('0x38')](_0x4a5a78[_0xe8d2('0x2f')],_0x4cd7ee[_0xe8d2('0x37')]),_0x2b9317);if(_0x4a5a78['query']['filter']){_0x11bc12['where']=_[_0xe8d2('0x39')](_0x11bc12['where'],{'$or':_['map'](_0x2b9317,function(_0x37531e){if(_0x37531e[_0xe8d2('0x2c')]!=='VIRTUAL'){var _0x2b5d77={};_0x2b5d77[_0x37531e[_0xe8d2('0x27')]]={'$like':'%'+_0x4a5a78[_0xe8d2('0x2f')][_0xe8d2('0x3a')]+'%'};return _0x2b5d77;}})});}_0x11bc12=_[_0xe8d2('0x39')]({},_0x11bc12,_0x4a5a78[_0xe8d2('0x3b')]);var _0x5681e3={'where':_0x11bc12[_0xe8d2('0x36')]};return db[_0xe8d2('0x3c')][_0xe8d2('0x1c')](_0x5681e3)['then'](function(_0x3b452e){_0x20035d[_0xe8d2('0x1c')]=_0x3b452e;if(_0x4a5a78['query'][_0xe8d2('0x3d')]){_0x11bc12[_0xe8d2('0x3e')]=[{'all':!![]}];}return db[_0xe8d2('0x3c')]['findAll'](_0x11bc12);})['then'](function(_0x12186c){_0x20035d['rows']=_0x12186c;return _0x20035d;})[_0xe8d2('0x24')](respondWithFilteredResult(_0x2a76a1,_0x11bc12))['catch'](handleError(_0x2a76a1,null));};exports[_0xe8d2('0x3f')]=function(_0x87a204,_0x523916){var _0x4a40f7={'raw':![],'where':{'id':_0x87a204['params']['id']}},_0x31c7e2={};_0x31c7e2[_0xe8d2('0x2e')]=_[_0xe8d2('0x30')](db[_0xe8d2('0x3c')]['rawAttributes']);_0x31c7e2['query']=_[_0xe8d2('0x30')](_0x87a204[_0xe8d2('0x2f')]);_0x31c7e2['filters']=_[_0xe8d2('0x31')](_0x31c7e2[_0xe8d2('0x2e')],_0x31c7e2[_0xe8d2('0x2f')]);_0x4a40f7[_0xe8d2('0x32')]=_[_0xe8d2('0x31')](_0x31c7e2[_0xe8d2('0x2e')],qs[_0xe8d2('0x33')](_0x87a204[_0xe8d2('0x2f')]['fields']));_0x4a40f7[_0xe8d2('0x32')]=_0x4a40f7[_0xe8d2('0x32')][_0xe8d2('0x40')]?_0x4a40f7[_0xe8d2('0x32')]:_0x31c7e2[_0xe8d2('0x2e')];if(_0x87a204[_0xe8d2('0x2f')][_0xe8d2('0x3d')]){_0x4a40f7[_0xe8d2('0x3e')]=[{'all':!![]}];}_0x4a40f7=_['merge']({},_0x4a40f7,_0x87a204[_0xe8d2('0x3b')]);return db[_0xe8d2('0x3c')][_0xe8d2('0x41')](_0x4a40f7)[_0xe8d2('0x24')](handleEntityNotFound(_0x523916,null))[_0xe8d2('0x24')](respondWithResult(_0x523916,null))[_0xe8d2('0x42')](handleError(_0x523916,null));};exports[_0xe8d2('0x43')]=function(_0x176d06,_0x2b689b){return db[_0xe8d2('0x3c')][_0xe8d2('0x43')](_0x176d06['body'],{})[_0xe8d2('0x24')](respondWithResult(_0x2b689b,0xc9))[_0xe8d2('0x42')](handleError(_0x2b689b,null));};exports[_0xe8d2('0x23')]=function(_0x2f44a8,_0x5ae758){if(_0x2f44a8[_0xe8d2('0x44')]['id']){delete _0x2f44a8[_0xe8d2('0x44')]['id'];}return db[_0xe8d2('0x3c')][_0xe8d2('0x41')]({'where':{'id':_0x2f44a8[_0xe8d2('0x45')]['id']}})['then'](handleEntityNotFound(_0x5ae758,null))[_0xe8d2('0x24')](saveUpdates(_0x2f44a8[_0xe8d2('0x44')],null))['then'](respondWithResult(_0x5ae758,null))[_0xe8d2('0x42')](handleError(_0x5ae758,null));};exports[_0xe8d2('0x25')]=function(_0x4b2b07,_0x2394e5){return db[_0xe8d2('0x3c')]['find']({'where':{'id':_0x4b2b07[_0xe8d2('0x45')]['id']}})['then'](handleEntityNotFound(_0x2394e5,null))[_0xe8d2('0x24')](removeEntity(_0x2394e5,null))[_0xe8d2('0x42')](handleError(_0x2394e5,null));};exports[_0xe8d2('0x46')]=function(_0x1f1cba,_0x3335a2,_0x17bc2c){var _0x5baff3={};var _0x35a505={};var _0xf40a95;var _0x28e00e;return db[_0xe8d2('0x3c')]['findOne']({'where':{'id':_0x1f1cba[_0xe8d2('0x45')]['id']}})['then'](handleEntityNotFound(_0x3335a2,null))[_0xe8d2('0x24')](function(_0x45e4dd){if(_0x45e4dd){_0xf40a95=_0x45e4dd;_0x35a505[_0xe8d2('0x2e')]=_[_0xe8d2('0x30')](db[_0xe8d2('0x47')][_0xe8d2('0x48')]);_0x35a505['query']=_[_0xe8d2('0x30')](_0x1f1cba['query']);_0x35a505[_0xe8d2('0x37')]=_['intersection'](_0x35a505[_0xe8d2('0x2e')],_0x35a505[_0xe8d2('0x2f')]);_0x5baff3['attributes']=_[_0xe8d2('0x31')](_0x35a505[_0xe8d2('0x2e')],qs[_0xe8d2('0x33')](_0x1f1cba[_0xe8d2('0x2f')][_0xe8d2('0x33')]));_0x5baff3['attributes']=_0x5baff3['attributes'][_0xe8d2('0x40')]?_0x5baff3[_0xe8d2('0x32')]:_0x35a505[_0xe8d2('0x2e')];_0x5baff3[_0xe8d2('0x34')]=qs[_0xe8d2('0x35')](_0x1f1cba[_0xe8d2('0x2f')][_0xe8d2('0x35')]);_0x5baff3[_0xe8d2('0x36')]=qs[_0xe8d2('0x37')](_[_0xe8d2('0x38')](_0x1f1cba[_0xe8d2('0x2f')],_0x35a505[_0xe8d2('0x37')]));if(_0x1f1cba[_0xe8d2('0x2f')][_0xe8d2('0x3a')]){_0x5baff3[_0xe8d2('0x36')]=_[_0xe8d2('0x39')](_0x5baff3['where'],{'$or':_[_0xe8d2('0x2a')](_0x5baff3[_0xe8d2('0x32')],function(_0x4260d5){var _0x24e2c3={};_0x24e2c3[_0x4260d5]={'$like':'%'+_0x1f1cba[_0xe8d2('0x2f')]['filter']+'%'};return _0x24e2c3;})});}_0x5baff3=_[_0xe8d2('0x39')]({},_0x5baff3,_0x1f1cba['options']);return _0xf40a95[_0xe8d2('0x46')](_0x5baff3);}})[_0xe8d2('0x24')](function(_0x2d2e2c){if(_0x2d2e2c){_0x28e00e=_0x2d2e2c[_0xe8d2('0x40')];if(!_0x1f1cba[_0xe8d2('0x2f')][_0xe8d2('0x49')](_0xe8d2('0x4a'))){_0x5baff3['limit']=qs[_0xe8d2('0x1b')](_0x1f1cba[_0xe8d2('0x2f')][_0xe8d2('0x1b')]);_0x5baff3[_0xe8d2('0x1d')]=qs[_0xe8d2('0x1d')](_0x1f1cba[_0xe8d2('0x2f')][_0xe8d2('0x1d')]);}return _0xf40a95[_0xe8d2('0x46')](_0x5baff3);}})[_0xe8d2('0x24')](function(_0x4cde92){if(_0x4cde92){return _0x4cde92?{'count':_0x28e00e,'rows':_0x4cde92}:null;}})[_0xe8d2('0x24')](respondWithResult(_0x3335a2,null))[_0xe8d2('0x42')](handleError(_0x3335a2,null));};exports[_0xe8d2('0x4b')]=function(_0x39453b,_0x568c30,_0x96bcf5){var _0x55493c={};var _0x26b3f7={};var _0x4c45c5;var _0x7d6428;return db[_0xe8d2('0x3c')][_0xe8d2('0x4c')]({'where':{'id':_0x39453b[_0xe8d2('0x45')]['id']}})[_0xe8d2('0x24')](handleEntityNotFound(_0x568c30,null))['then'](function(_0x19849c){if(_0x19849c){_0x4c45c5=_0x19849c;_0x26b3f7[_0xe8d2('0x2e')]=_['keys'](db['FreshsalesField'][_0xe8d2('0x48')]);_0x26b3f7[_0xe8d2('0x2f')]=_[_0xe8d2('0x30')](_0x39453b[_0xe8d2('0x2f')]);_0x26b3f7['filters']=_[_0xe8d2('0x31')](_0x26b3f7[_0xe8d2('0x2e')],_0x26b3f7[_0xe8d2('0x2f')]);_0x55493c[_0xe8d2('0x32')]=_[_0xe8d2('0x31')](_0x26b3f7['model'],qs[_0xe8d2('0x33')](_0x39453b['query'][_0xe8d2('0x33')]));_0x55493c[_0xe8d2('0x32')]=_0x55493c[_0xe8d2('0x32')][_0xe8d2('0x40')]?_0x55493c[_0xe8d2('0x32')]:_0x26b3f7[_0xe8d2('0x2e')];_0x55493c[_0xe8d2('0x34')]=qs[_0xe8d2('0x35')](_0x39453b['query'][_0xe8d2('0x35')]);_0x55493c['where']=qs[_0xe8d2('0x37')](_['pick'](_0x39453b[_0xe8d2('0x2f')],_0x26b3f7[_0xe8d2('0x37')]));if(_0x39453b[_0xe8d2('0x2f')]['filter']){_0x55493c['where']=_[_0xe8d2('0x39')](_0x55493c[_0xe8d2('0x36')],{'$or':_[_0xe8d2('0x2a')](_0x55493c[_0xe8d2('0x32')],function(_0x37aa70){var _0xd9ba06={};_0xd9ba06[_0x37aa70]={'$like':'%'+_0x39453b[_0xe8d2('0x2f')][_0xe8d2('0x3a')]+'%'};return _0xd9ba06;})});}_0x55493c=_[_0xe8d2('0x39')]({},_0x55493c,_0x39453b['options']);return _0x4c45c5[_0xe8d2('0x4b')](_0x55493c);}})[_0xe8d2('0x24')](function(_0x53b241){if(_0x53b241){_0x7d6428=_0x53b241[_0xe8d2('0x40')];if(!_0x39453b[_0xe8d2('0x2f')][_0xe8d2('0x49')](_0xe8d2('0x4a'))){_0x55493c[_0xe8d2('0x1b')]=qs[_0xe8d2('0x1b')](_0x39453b[_0xe8d2('0x2f')][_0xe8d2('0x1b')]);_0x55493c[_0xe8d2('0x1d')]=qs[_0xe8d2('0x1d')](_0x39453b['query']['offset']);}return _0x4c45c5['getDescriptions'](_0x55493c);}})[_0xe8d2('0x24')](function(_0x608ada){if(_0x608ada){return _0x608ada?{'count':_0x7d6428,'rows':_0x608ada}:null;}})['then'](respondWithResult(_0x568c30,null))[_0xe8d2('0x42')](handleError(_0x568c30,null));};exports[_0xe8d2('0x4d')]=function(_0x31904b,_0x43c712,_0x34f063){var _0x12a66e={};var _0x55a8e2={};var _0x46351b;var _0xca0d3e;return db[_0xe8d2('0x3c')][_0xe8d2('0x4c')]({'where':{'id':_0x31904b[_0xe8d2('0x45')]['id']}})[_0xe8d2('0x24')](handleEntityNotFound(_0x43c712,null))[_0xe8d2('0x24')](function(_0x3e72d6){if(_0x3e72d6){_0x46351b=_0x3e72d6;_0x55a8e2[_0xe8d2('0x2e')]=_[_0xe8d2('0x30')](db[_0xe8d2('0x47')][_0xe8d2('0x48')]);_0x55a8e2[_0xe8d2('0x2f')]=_[_0xe8d2('0x30')](_0x31904b[_0xe8d2('0x2f')]);_0x55a8e2[_0xe8d2('0x37')]=_['intersection'](_0x55a8e2[_0xe8d2('0x2e')],_0x55a8e2[_0xe8d2('0x2f')]);_0x12a66e['attributes']=_['intersection'](_0x55a8e2['model'],qs[_0xe8d2('0x33')](_0x31904b[_0xe8d2('0x2f')]['fields']));_0x12a66e[_0xe8d2('0x32')]=_0x12a66e['attributes'][_0xe8d2('0x40')]?_0x12a66e[_0xe8d2('0x32')]:_0x55a8e2['model'];_0x12a66e[_0xe8d2('0x34')]=qs[_0xe8d2('0x35')](_0x31904b[_0xe8d2('0x2f')][_0xe8d2('0x35')]);_0x12a66e[_0xe8d2('0x36')]=qs[_0xe8d2('0x37')](_[_0xe8d2('0x38')](_0x31904b[_0xe8d2('0x2f')],_0x55a8e2[_0xe8d2('0x37')]));if(_0x31904b['query'][_0xe8d2('0x3a')]){_0x12a66e[_0xe8d2('0x36')]=_['merge'](_0x12a66e[_0xe8d2('0x36')],{'$or':_[_0xe8d2('0x2a')](_0x12a66e[_0xe8d2('0x32')],function(_0x4e105d){var _0x1934f2={};_0x1934f2[_0x4e105d]={'$like':'%'+_0x31904b['query']['filter']+'%'};return _0x1934f2;})});}_0x12a66e=_['merge']({},_0x12a66e,_0x31904b['options']);return _0x46351b['getFields'](_0x12a66e);}})['then'](function(_0x3a87ba){if(_0x3a87ba){_0xca0d3e=_0x3a87ba[_0xe8d2('0x40')];if(!_0x31904b[_0xe8d2('0x2f')][_0xe8d2('0x49')](_0xe8d2('0x4a'))){_0x12a66e[_0xe8d2('0x1b')]=qs[_0xe8d2('0x1b')](_0x31904b['query']['limit']);_0x12a66e[_0xe8d2('0x1d')]=qs['offset'](_0x31904b[_0xe8d2('0x2f')][_0xe8d2('0x1d')]);}return _0x46351b[_0xe8d2('0x4d')](_0x12a66e);}})[_0xe8d2('0x24')](function(_0x4f781d){if(_0x4f781d){return _0x4f781d?{'count':_0xca0d3e,'rows':_0x4f781d}:null;}})[_0xe8d2('0x24')](respondWithResult(_0x43c712,null))['catch'](handleError(_0x43c712,null));}; \ No newline at end of file +var _0x91e1=['getFields','eml-format','rimraf','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','count','save','update','then','error','name','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','limit','order','sort','pick','filter','where','VIRTUAL','options','FreshsalesConfiguration','include','rows','catch','params','includeAll','merge','find','create','body','getSubjects','hasOwnProperty','getDescriptions','findOne','FreshsalesField'];(function(_0x5e7b0a,_0xe2a383){var _0x59e412=function(_0xd3a9cb){while(--_0xd3a9cb){_0x5e7b0a['push'](_0x5e7b0a['shift']());}};_0x59e412(++_0xe2a383);}(_0x91e1,0x1e4));var _0x191e=function(_0x315233,_0x4d054c){_0x315233=_0x315233-0x0;var _0x1360cc=_0x91e1[_0x315233];return _0x1360cc;};'use strict';var emlformat=require(_0x191e('0x0'));var rimraf=require(_0x191e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x191e('0x2'));var rp=require('request-promise');var moment=require(_0x191e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x191e('0x4'));var util=require('util');var path=require(_0x191e('0x5'));var sox=require(_0x191e('0x6'));var csv=require(_0x191e('0x7'));var ejs=require(_0x191e('0x8'));var fs=require('fs');var fs_extra=require(_0x191e('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x191e('0xa'));var toCsv=require(_0x191e('0x7'));var querystring=require(_0x191e('0xb'));var Papa=require(_0x191e('0xc'));var Redis=require('ioredis');var authService=require(_0x191e('0xd'));var qs=require(_0x191e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x191e('0xf'))(_0x191e('0x10'));var utils=require(_0x191e('0x11'));var config=require(_0x191e('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x191e('0x13'))['db'];function respondWithStatusCode(_0x272b1f,_0x5bd32f){_0x5bd32f=_0x5bd32f||0xcc;return function(_0x570a3a){if(_0x570a3a){return _0x272b1f[_0x191e('0x14')](_0x5bd32f);}return _0x272b1f[_0x191e('0x15')](_0x5bd32f)[_0x191e('0x16')]();};}function respondWithResult(_0x4126d0,_0x3f983b){_0x3f983b=_0x3f983b||0xc8;return function(_0x5337e0){if(_0x5337e0){return _0x4126d0['status'](_0x3f983b)[_0x191e('0x17')](_0x5337e0);}};}function respondWithFilteredResult(_0x4f8422,_0x44ed4f){return function(_0x1f1fe4){if(_0x1f1fe4){var _0x1a9e7b=typeof _0x44ed4f[_0x191e('0x18')]==='undefined'&&typeof _0x44ed4f['limit']==='undefined';var _0x31fe27=_0x1f1fe4[_0x191e('0x19')];var _0x30a3bd=_0x1a9e7b?0x0:_0x44ed4f[_0x191e('0x18')];var _0x24f14a=_0x1a9e7b?_0x1f1fe4[_0x191e('0x19')]:_0x44ed4f[_0x191e('0x18')]+_0x44ed4f['limit'];var _0x137ea5;if(_0x24f14a>=_0x31fe27){_0x24f14a=_0x31fe27;_0x137ea5=0xc8;}else{_0x137ea5=0xce;}_0x4f8422['status'](_0x137ea5);return _0x4f8422['set']('Content-Range',_0x30a3bd+'-'+_0x24f14a+'/'+_0x31fe27)[_0x191e('0x17')](_0x1f1fe4);}return null;};}function patchUpdates(_0x50f439){return function(_0x380ae9){try{jsonpatch['apply'](_0x380ae9,_0x50f439,!![]);}catch(_0x5c2236){return BPromise['reject'](_0x5c2236);}return _0x380ae9[_0x191e('0x1a')]();};}function saveUpdates(_0x57496e,_0x2f37d7){return function(_0x57f4de){if(_0x57f4de){return _0x57f4de[_0x191e('0x1b')](_0x57496e)[_0x191e('0x1c')](function(_0x563ab0){return _0x563ab0;});}return null;};}function removeEntity(_0x29cf41,_0x3475ce){return function(_0x2df483){if(_0x2df483){return _0x2df483['destroy']()['then'](function(){_0x29cf41[_0x191e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x40d202,_0x68e63a){return function(_0x2b4443){if(!_0x2b4443){_0x40d202[_0x191e('0x14')](0x194);}return _0x2b4443;};}function handleError(_0x5efac5,_0x20882f){_0x20882f=_0x20882f||0x1f4;return function(_0x35f52d){logger[_0x191e('0x1d')](_0x35f52d['stack']);if(_0x35f52d[_0x191e('0x1e')]){delete _0x35f52d[_0x191e('0x1e')];}_0x5efac5[_0x191e('0x15')](_0x20882f)['send'](_0x35f52d);};}exports['index']=function(_0x53b397,_0x371866){var _0x1862c2={},_0x435010={},_0x3b7cc7={'count':0x0,'rows':[]};var _0x521abe=_[_0x191e('0x1f')](db['FreshsalesConfiguration'][_0x191e('0x20')],function(_0x291cc2){return{'name':_0x291cc2[_0x191e('0x21')],'type':_0x291cc2[_0x191e('0x22')][_0x191e('0x23')]};});_0x435010[_0x191e('0x24')]=_['map'](_0x521abe,_0x191e('0x1e'));_0x435010[_0x191e('0x25')]=_[_0x191e('0x26')](_0x53b397[_0x191e('0x25')]);_0x435010[_0x191e('0x27')]=_[_0x191e('0x28')](_0x435010[_0x191e('0x24')],_0x435010['query']);_0x1862c2[_0x191e('0x29')]=_[_0x191e('0x28')](_0x435010[_0x191e('0x24')],qs[_0x191e('0x2a')](_0x53b397[_0x191e('0x25')]['fields']));_0x1862c2[_0x191e('0x29')]=_0x1862c2[_0x191e('0x29')][_0x191e('0x2b')]?_0x1862c2[_0x191e('0x29')]:_0x435010[_0x191e('0x24')];if(!_0x53b397[_0x191e('0x25')]['hasOwnProperty'](_0x191e('0x2c'))){_0x1862c2[_0x191e('0x2d')]=qs[_0x191e('0x2d')](_0x53b397['query']['limit']);_0x1862c2[_0x191e('0x18')]=qs[_0x191e('0x18')](_0x53b397['query'][_0x191e('0x18')]);}_0x1862c2[_0x191e('0x2e')]=qs[_0x191e('0x2f')](_0x53b397[_0x191e('0x25')][_0x191e('0x2f')]);_0x1862c2['where']=qs[_0x191e('0x27')](_[_0x191e('0x30')](_0x53b397[_0x191e('0x25')],_0x435010['filters']),_0x521abe);if(_0x53b397[_0x191e('0x25')][_0x191e('0x31')]){_0x1862c2['where']=_['merge'](_0x1862c2[_0x191e('0x32')],{'$or':_[_0x191e('0x1f')](_0x521abe,function(_0x2252a0){if(_0x2252a0[_0x191e('0x22')]!==_0x191e('0x33')){var _0x574cf2={};_0x574cf2[_0x2252a0[_0x191e('0x1e')]]={'$like':'%'+_0x53b397[_0x191e('0x25')][_0x191e('0x31')]+'%'};return _0x574cf2;}})});}_0x1862c2=_['merge']({},_0x1862c2,_0x53b397[_0x191e('0x34')]);var _0xa515a5={'where':_0x1862c2[_0x191e('0x32')]};return db[_0x191e('0x35')][_0x191e('0x19')](_0xa515a5)['then'](function(_0x1dbe38){_0x3b7cc7[_0x191e('0x19')]=_0x1dbe38;if(_0x53b397[_0x191e('0x25')]['includeAll']){_0x1862c2[_0x191e('0x36')]=[{'all':!![]}];}return db[_0x191e('0x35')]['findAll'](_0x1862c2);})[_0x191e('0x1c')](function(_0x4d114b){_0x3b7cc7[_0x191e('0x37')]=_0x4d114b;return _0x3b7cc7;})['then'](respondWithFilteredResult(_0x371866,_0x1862c2))[_0x191e('0x38')](handleError(_0x371866,null));};exports['show']=function(_0x3a4bbe,_0x2fcab9){var _0x3cf72e={'raw':![],'where':{'id':_0x3a4bbe[_0x191e('0x39')]['id']}},_0xf467ca={};_0xf467ca[_0x191e('0x24')]=_[_0x191e('0x26')](db[_0x191e('0x35')]['rawAttributes']);_0xf467ca[_0x191e('0x25')]=_[_0x191e('0x26')](_0x3a4bbe[_0x191e('0x25')]);_0xf467ca[_0x191e('0x27')]=_[_0x191e('0x28')](_0xf467ca[_0x191e('0x24')],_0xf467ca[_0x191e('0x25')]);_0x3cf72e['attributes']=_[_0x191e('0x28')](_0xf467ca[_0x191e('0x24')],qs[_0x191e('0x2a')](_0x3a4bbe[_0x191e('0x25')][_0x191e('0x2a')]));_0x3cf72e[_0x191e('0x29')]=_0x3cf72e[_0x191e('0x29')][_0x191e('0x2b')]?_0x3cf72e['attributes']:_0xf467ca['model'];if(_0x3a4bbe['query'][_0x191e('0x3a')]){_0x3cf72e[_0x191e('0x36')]=[{'all':!![]}];}_0x3cf72e=_[_0x191e('0x3b')]({},_0x3cf72e,_0x3a4bbe[_0x191e('0x34')]);return db['FreshsalesConfiguration'][_0x191e('0x3c')](_0x3cf72e)['then'](handleEntityNotFound(_0x2fcab9,null))['then'](respondWithResult(_0x2fcab9,null))[_0x191e('0x38')](handleError(_0x2fcab9,null));};exports['create']=function(_0x48c8e2,_0x29def5){return db[_0x191e('0x35')][_0x191e('0x3d')](_0x48c8e2[_0x191e('0x3e')],{})['then'](respondWithResult(_0x29def5,0xc9))[_0x191e('0x38')](handleError(_0x29def5,null));};exports[_0x191e('0x1b')]=function(_0x572180,_0x17ac8b){if(_0x572180[_0x191e('0x3e')]['id']){delete _0x572180[_0x191e('0x3e')]['id'];}return db['FreshsalesConfiguration'][_0x191e('0x3c')]({'where':{'id':_0x572180[_0x191e('0x39')]['id']}})[_0x191e('0x1c')](handleEntityNotFound(_0x17ac8b,null))[_0x191e('0x1c')](saveUpdates(_0x572180[_0x191e('0x3e')],null))[_0x191e('0x1c')](respondWithResult(_0x17ac8b,null))[_0x191e('0x38')](handleError(_0x17ac8b,null));};exports['destroy']=function(_0x35d045,_0x44d250){return db['FreshsalesConfiguration'][_0x191e('0x3c')]({'where':{'id':_0x35d045[_0x191e('0x39')]['id']}})[_0x191e('0x1c')](handleEntityNotFound(_0x44d250,null))[_0x191e('0x1c')](removeEntity(_0x44d250,null))[_0x191e('0x38')](handleError(_0x44d250,null));};exports['getSubjects']=function(_0x1c5a4c,_0x11dc47,_0x1a86a9){var _0x463838={};var _0x51ecc8={};var _0x59d671;var _0x3f34ea;return db[_0x191e('0x35')]['findOne']({'where':{'id':_0x1c5a4c['params']['id']}})['then'](handleEntityNotFound(_0x11dc47,null))['then'](function(_0x28df36){if(_0x28df36){_0x59d671=_0x28df36;_0x51ecc8[_0x191e('0x24')]=_[_0x191e('0x26')](db['FreshsalesField'][_0x191e('0x20')]);_0x51ecc8[_0x191e('0x25')]=_[_0x191e('0x26')](_0x1c5a4c[_0x191e('0x25')]);_0x51ecc8[_0x191e('0x27')]=_['intersection'](_0x51ecc8[_0x191e('0x24')],_0x51ecc8[_0x191e('0x25')]);_0x463838[_0x191e('0x29')]=_[_0x191e('0x28')](_0x51ecc8[_0x191e('0x24')],qs['fields'](_0x1c5a4c[_0x191e('0x25')]['fields']));_0x463838[_0x191e('0x29')]=_0x463838['attributes'][_0x191e('0x2b')]?_0x463838[_0x191e('0x29')]:_0x51ecc8['model'];_0x463838[_0x191e('0x2e')]=qs[_0x191e('0x2f')](_0x1c5a4c[_0x191e('0x25')][_0x191e('0x2f')]);_0x463838[_0x191e('0x32')]=qs[_0x191e('0x27')](_[_0x191e('0x30')](_0x1c5a4c['query'],_0x51ecc8[_0x191e('0x27')]));if(_0x1c5a4c[_0x191e('0x25')][_0x191e('0x31')]){_0x463838[_0x191e('0x32')]=_['merge'](_0x463838[_0x191e('0x32')],{'$or':_[_0x191e('0x1f')](_0x463838[_0x191e('0x29')],function(_0x3bffa1){var _0xb3ccd8={};_0xb3ccd8[_0x3bffa1]={'$like':'%'+_0x1c5a4c[_0x191e('0x25')][_0x191e('0x31')]+'%'};return _0xb3ccd8;})});}_0x463838=_['merge']({},_0x463838,_0x1c5a4c[_0x191e('0x34')]);return _0x59d671[_0x191e('0x3f')](_0x463838);}})['then'](function(_0x333fde){if(_0x333fde){_0x3f34ea=_0x333fde[_0x191e('0x2b')];if(!_0x1c5a4c[_0x191e('0x25')][_0x191e('0x40')]('nolimit')){_0x463838['limit']=qs[_0x191e('0x2d')](_0x1c5a4c[_0x191e('0x25')][_0x191e('0x2d')]);_0x463838[_0x191e('0x18')]=qs['offset'](_0x1c5a4c[_0x191e('0x25')]['offset']);}return _0x59d671['getSubjects'](_0x463838);}})['then'](function(_0x4c6370){if(_0x4c6370){return _0x4c6370?{'count':_0x3f34ea,'rows':_0x4c6370}:null;}})['then'](respondWithResult(_0x11dc47,null))[_0x191e('0x38')](handleError(_0x11dc47,null));};exports[_0x191e('0x41')]=function(_0x526c2a,_0x3be490,_0x37d897){var _0x4d5fa1={};var _0x3792e0={};var _0xb3a2f6;var _0x3c58b7;return db[_0x191e('0x35')][_0x191e('0x42')]({'where':{'id':_0x526c2a['params']['id']}})[_0x191e('0x1c')](handleEntityNotFound(_0x3be490,null))[_0x191e('0x1c')](function(_0x324746){if(_0x324746){_0xb3a2f6=_0x324746;_0x3792e0[_0x191e('0x24')]=_['keys'](db[_0x191e('0x43')][_0x191e('0x20')]);_0x3792e0['query']=_[_0x191e('0x26')](_0x526c2a[_0x191e('0x25')]);_0x3792e0[_0x191e('0x27')]=_[_0x191e('0x28')](_0x3792e0[_0x191e('0x24')],_0x3792e0['query']);_0x4d5fa1[_0x191e('0x29')]=_[_0x191e('0x28')](_0x3792e0['model'],qs[_0x191e('0x2a')](_0x526c2a['query']['fields']));_0x4d5fa1[_0x191e('0x29')]=_0x4d5fa1['attributes'][_0x191e('0x2b')]?_0x4d5fa1[_0x191e('0x29')]:_0x3792e0[_0x191e('0x24')];_0x4d5fa1[_0x191e('0x2e')]=qs[_0x191e('0x2f')](_0x526c2a[_0x191e('0x25')]['sort']);_0x4d5fa1[_0x191e('0x32')]=qs[_0x191e('0x27')](_['pick'](_0x526c2a['query'],_0x3792e0['filters']));if(_0x526c2a[_0x191e('0x25')][_0x191e('0x31')]){_0x4d5fa1[_0x191e('0x32')]=_[_0x191e('0x3b')](_0x4d5fa1[_0x191e('0x32')],{'$or':_[_0x191e('0x1f')](_0x4d5fa1[_0x191e('0x29')],function(_0xedcd70){var _0x596ef1={};_0x596ef1[_0xedcd70]={'$like':'%'+_0x526c2a['query'][_0x191e('0x31')]+'%'};return _0x596ef1;})});}_0x4d5fa1=_[_0x191e('0x3b')]({},_0x4d5fa1,_0x526c2a[_0x191e('0x34')]);return _0xb3a2f6[_0x191e('0x41')](_0x4d5fa1);}})[_0x191e('0x1c')](function(_0xbf5184){if(_0xbf5184){_0x3c58b7=_0xbf5184['length'];if(!_0x526c2a['query']['hasOwnProperty'](_0x191e('0x2c'))){_0x4d5fa1[_0x191e('0x2d')]=qs[_0x191e('0x2d')](_0x526c2a[_0x191e('0x25')][_0x191e('0x2d')]);_0x4d5fa1[_0x191e('0x18')]=qs[_0x191e('0x18')](_0x526c2a['query'][_0x191e('0x18')]);}return _0xb3a2f6['getDescriptions'](_0x4d5fa1);}})[_0x191e('0x1c')](function(_0x370d3a){if(_0x370d3a){return _0x370d3a?{'count':_0x3c58b7,'rows':_0x370d3a}:null;}})[_0x191e('0x1c')](respondWithResult(_0x3be490,null))[_0x191e('0x38')](handleError(_0x3be490,null));};exports[_0x191e('0x44')]=function(_0x179e08,_0x15d755,_0x26daba){var _0x50d89a={};var _0x5aced7={};var _0x390b1b;var _0x56d74b;return db[_0x191e('0x35')][_0x191e('0x42')]({'where':{'id':_0x179e08[_0x191e('0x39')]['id']}})[_0x191e('0x1c')](handleEntityNotFound(_0x15d755,null))[_0x191e('0x1c')](function(_0x16111c){if(_0x16111c){_0x390b1b=_0x16111c;_0x5aced7[_0x191e('0x24')]=_['keys'](db[_0x191e('0x43')]['rawAttributes']);_0x5aced7['query']=_['keys'](_0x179e08[_0x191e('0x25')]);_0x5aced7['filters']=_['intersection'](_0x5aced7[_0x191e('0x24')],_0x5aced7[_0x191e('0x25')]);_0x50d89a[_0x191e('0x29')]=_[_0x191e('0x28')](_0x5aced7[_0x191e('0x24')],qs['fields'](_0x179e08['query'][_0x191e('0x2a')]));_0x50d89a[_0x191e('0x29')]=_0x50d89a[_0x191e('0x29')]['length']?_0x50d89a[_0x191e('0x29')]:_0x5aced7[_0x191e('0x24')];_0x50d89a['order']=qs['sort'](_0x179e08[_0x191e('0x25')]['sort']);_0x50d89a[_0x191e('0x32')]=qs['filters'](_[_0x191e('0x30')](_0x179e08[_0x191e('0x25')],_0x5aced7[_0x191e('0x27')]));if(_0x179e08[_0x191e('0x25')]['filter']){_0x50d89a[_0x191e('0x32')]=_[_0x191e('0x3b')](_0x50d89a[_0x191e('0x32')],{'$or':_[_0x191e('0x1f')](_0x50d89a['attributes'],function(_0x538903){var _0x1eb349={};_0x1eb349[_0x538903]={'$like':'%'+_0x179e08[_0x191e('0x25')]['filter']+'%'};return _0x1eb349;})});}_0x50d89a=_[_0x191e('0x3b')]({},_0x50d89a,_0x179e08[_0x191e('0x34')]);return _0x390b1b[_0x191e('0x44')](_0x50d89a);}})['then'](function(_0x3cad2a){if(_0x3cad2a){_0x56d74b=_0x3cad2a['length'];if(!_0x179e08[_0x191e('0x25')][_0x191e('0x40')](_0x191e('0x2c'))){_0x50d89a['limit']=qs[_0x191e('0x2d')](_0x179e08[_0x191e('0x25')][_0x191e('0x2d')]);_0x50d89a[_0x191e('0x18')]=qs['offset'](_0x179e08[_0x191e('0x25')][_0x191e('0x18')]);}return _0x390b1b['getFields'](_0x50d89a);}})[_0x191e('0x1c')](function(_0x31755a){if(_0x31755a){return _0x31755a?{'count':_0x56d74b,'rows':_0x31755a}:null;}})['then'](respondWithResult(_0x15d755,null))[_0x191e('0x38')](handleError(_0x15d755,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 7d614e0..32d50d7 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 _0xb391=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./intFreshsalesConfiguration.attributes','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','util'];(function(_0x3c9ee8,_0x2f7ce6){var _0x33f5bd=function(_0xb95c38){while(--_0xb95c38){_0x3c9ee8['push'](_0x3c9ee8['shift']());}};_0x33f5bd(++_0x2f7ce6);}(_0xb391,0x76));var _0x1b39=function(_0x325ee2,_0xaf1371){_0x325ee2=_0x325ee2-0x0;var _0x7f2741=_0xb391[_0x325ee2];return _0x7f2741;};'use strict';var _=require(_0x1b39('0x0'));var util=require(_0x1b39('0x1'));var logger=require(_0x1b39('0x2'))('api');var moment=require(_0x1b39('0x3'));var BPromise=require(_0x1b39('0x4'));var rp=require(_0x1b39('0x5'));var fs=require('fs');var path=require(_0x1b39('0x6'));var rimraf=require('rimraf');var config=require(_0x1b39('0x7'));var attributes=require(_0x1b39('0x8'));module['exports']=function(_0x335026,_0x2d4df2){return _0x335026[_0x1b39('0x9')](_0x1b39('0xa'),attributes,{'tableName':_0x1b39('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdf83=['lodash','util','api','moment','bluebird','path','../../config/environment','exports','define','FreshsalesConfiguration','int_freshsales_configurations'];(function(_0x486718,_0x87a43c){var _0x3288e9=function(_0x36e240){while(--_0x36e240){_0x486718['push'](_0x486718['shift']());}};_0x3288e9(++_0x87a43c);}(_0xdf83,0x176));var _0x3df8=function(_0x3aea9c,_0x5efcb2){_0x3aea9c=_0x3aea9c-0x0;var _0x266511=_0xdf83[_0x3aea9c];return _0x266511;};'use strict';var _=require(_0x3df8('0x0'));var util=require(_0x3df8('0x1'));var logger=require('../../config/logger')(_0x3df8('0x2'));var moment=require(_0x3df8('0x3'));var BPromise=require(_0x3df8('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3df8('0x5'));var rimraf=require('rimraf');var config=require(_0x3df8('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x3df8('0x7')]=function(_0x5dde86,_0x5620a4){return _0x5dde86[_0x3df8('0x8')](_0x3df8('0x9'),attributes,{'tableName':_0x3df8('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 41f9d46..27bb8a2 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 _0xd236=['FreshsalesConfiguration,\x20%s,\x20%s','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then'];(function(_0x387777,_0x356171){var _0x3f84c0=function(_0x4d4423){while(--_0x4d4423){_0x387777['push'](_0x387777['shift']());}};_0x3f84c0(++_0x356171);}(_0xd236,0x1e3));var _0x6d23=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xd236[_0x138adb];return _0x1b27f2;};'use strict';var _=require(_0x6d23('0x0'));var util=require(_0x6d23('0x1'));var moment=require(_0x6d23('0x2'));var BPromise=require(_0x6d23('0x3'));var rs=require(_0x6d23('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6d23('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6d23('0x6'))('rpc');var config=require(_0x6d23('0x7'));var jayson=require(_0x6d23('0x8'));var client=jayson['client'][_0x6d23('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52661c,_0x1892ca,_0x220c86){return new BPromise(function(_0xd6f40b,_0x206a62){return client['request'](_0x52661c,_0x220c86)[_0x6d23('0xa')](function(_0x173f6a){logger['info'](_0x6d23('0xb'),_0x1892ca,'request\x20sent');logger[_0x6d23('0xc')](_0x6d23('0xd'),_0x1892ca,_0x6d23('0xe'),JSON['stringify'](_0x173f6a));if(_0x173f6a[_0x6d23('0xf')]){if(_0x173f6a['error']['code']===0x1f4){logger[_0x6d23('0xf')](_0x6d23('0xb'),_0x1892ca,_0x173f6a[_0x6d23('0xf')]['message']);return _0x206a62(_0x173f6a[_0x6d23('0xf')][_0x6d23('0x10')]);}logger['error'](_0x6d23('0xb'),_0x1892ca,_0x173f6a[_0x6d23('0xf')][_0x6d23('0x10')]);return _0xd6f40b(_0x173f6a['error']['message']);}else{logger[_0x6d23('0x11')](_0x6d23('0xb'),_0x1892ca,'request\x20sent');_0xd6f40b(_0x173f6a[_0x6d23('0x12')][_0x6d23('0x10')]);}})['catch'](function(_0x4209a1){logger[_0x6d23('0xf')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x1892ca,_0x4209a1);_0x206a62(_0x4209a1);});});} \ No newline at end of file +var _0x804d=['request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','FreshsalesConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info'];(function(_0x1182cb,_0x1b6b9c){var _0x503f58=function(_0x57e459){while(--_0x57e459){_0x1182cb['push'](_0x1182cb['shift']());}};_0x503f58(++_0x1b6b9c);}(_0x804d,0x17a));var _0xd804=function(_0x3e4fbe,_0x1a550d){_0x3e4fbe=_0x3e4fbe-0x0;var _0x158ba5=_0x804d[_0x3e4fbe];return _0x158ba5;};'use strict';var _=require(_0xd804('0x0'));var util=require(_0xd804('0x1'));var moment=require('moment');var BPromise=require(_0xd804('0x2'));var rs=require(_0xd804('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd804('0x4'))['db'];var utils=require(_0xd804('0x5'));var logger=require(_0xd804('0x6'))('rpc');var config=require(_0xd804('0x7'));var jayson=require(_0xd804('0x8'));var client=jayson['client'][_0xd804('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3051f9,_0x27ed49,_0x19d40e){return new BPromise(function(_0x5d9939,_0xa0a16){return client[_0xd804('0xa')](_0x3051f9,_0x19d40e)[_0xd804('0xb')](function(_0x23a16d){logger[_0xd804('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x27ed49,_0xd804('0xd'));logger[_0xd804('0xe')](_0xd804('0xf'),_0x27ed49,_0xd804('0xd'),JSON[_0xd804('0x10')](_0x23a16d));if(_0x23a16d[_0xd804('0x11')]){if(_0x23a16d[_0xd804('0x11')][_0xd804('0x12')]===0x1f4){logger[_0xd804('0x11')](_0xd804('0x13'),_0x27ed49,_0x23a16d[_0xd804('0x11')][_0xd804('0x14')]);return _0xa0a16(_0x23a16d[_0xd804('0x11')]['message']);}logger['error'](_0xd804('0x13'),_0x27ed49,_0x23a16d['error'][_0xd804('0x14')]);return _0x5d9939(_0x23a16d[_0xd804('0x11')]['message']);}else{logger['info'](_0xd804('0x13'),_0x27ed49,_0xd804('0xd'));_0x5d9939(_0x23a16d[_0xd804('0x15')][_0xd804('0x14')]);}})[_0xd804('0x16')](function(_0xe0121e){logger[_0xd804('0x11')](_0xd804('0x13'),_0x27ed49,_0xe0121e);_0xa0a16(_0xe0121e);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index eb602be..5796dee 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 _0x3140=['../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','post','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra'];(function(_0x4a6a6b,_0x1909e3){var _0x3335a6=function(_0x1a944e){while(--_0x1a944e){_0x4a6a6b['push'](_0x4a6a6b['shift']());}};_0x3335a6(++_0x1909e3);}(_0x3140,0xaf));var _0x0314=function(_0x17de24,_0x3c6c3c){_0x17de24=_0x17de24-0x0;var _0x4a7763=_0x3140[_0x17de24];return _0x4a7763;};'use strict';var multer=require(_0x0314('0x0'));var util=require(_0x0314('0x1'));var path=require(_0x0314('0x2'));var timeout=require(_0x0314('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0314('0x4'));var auth=require(_0x0314('0x5'));var interaction=require(_0x0314('0x6'));var config=require(_0x0314('0x7'));var controller=require(_0x0314('0x8'));router[_0x0314('0x9')]('/',auth[_0x0314('0xa')](),controller[_0x0314('0xb')]);router[_0x0314('0x9')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller['show']);router[_0x0314('0xd')]('/',auth[_0x0314('0xa')](),controller['create']);router['put'](_0x0314('0xc'),auth['isAuthenticated'](),controller[_0x0314('0xe')]);router[_0x0314('0xf')](_0x0314('0xc'),auth[_0x0314('0xa')](),controller[_0x0314('0x10')]);module[_0x0314('0x11')]=router; \ No newline at end of file +var _0xc9b7=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesField.controller','get','isAuthenticated','index','/:id','show'];(function(_0x17a618,_0x56738e){var _0x28cd35=function(_0x54e3e1){while(--_0x54e3e1){_0x17a618['push'](_0x17a618['shift']());}};_0x28cd35(++_0x56738e);}(_0xc9b7,0x1ab));var _0x7c9b=function(_0x3a8ce2,_0x552ad5){_0x3a8ce2=_0x3a8ce2-0x0;var _0x2e5a45=_0xc9b7[_0x3a8ce2];return _0x2e5a45;};'use strict';var multer=require(_0x7c9b('0x0'));var util=require(_0x7c9b('0x1'));var path=require(_0x7c9b('0x2'));var timeout=require(_0x7c9b('0x3'));var express=require('express');var router=express[_0x7c9b('0x4')]();var fs_extra=require(_0x7c9b('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x7c9b('0x6'));var config=require(_0x7c9b('0x7'));var controller=require(_0x7c9b('0x8'));router[_0x7c9b('0x9')]('/',auth[_0x7c9b('0xa')](),controller[_0x7c9b('0xb')]);router[_0x7c9b('0x9')](_0x7c9b('0xc'),auth[_0x7c9b('0xa')](),controller[_0x7c9b('0xd')]);router[_0x7c9b('0xe')]('/',auth[_0x7c9b('0xa')](),controller[_0x7c9b('0xf')]);router[_0x7c9b('0x10')](_0x7c9b('0xc'),auth[_0x7c9b('0xa')](),controller[_0x7c9b('0x11')]);router[_0x7c9b('0x12')]('/:id',auth[_0x7c9b('0xa')](),controller[_0x7c9b('0x13')]);module[_0x7c9b('0x14')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.attributes.js b/server/api/intFreshsalesField/intFreshsalesField.attributes.js index 5d29942..8954109 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 _0x9b89=['ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x38b3c0,_0x480752){var _0xfa46b3=function(_0x46aff0){while(--_0x46aff0){_0x38b3c0['push'](_0x38b3c0['shift']());}};_0xfa46b3(++_0x480752);}(_0x9b89,0x1ee));var _0x99b8=function(_0x545686,_0x570336){_0x545686=_0x545686-0x0;var _0x6ee74a=_0x9b89[_0x545686];return _0x6ee74a;};'use strict';var Sequelize=require(_0x99b8('0x0'));module['exports']={'type':{'type':Sequelize[_0x99b8('0x1')](_0x99b8('0x2'),_0x99b8('0x3'),_0x99b8('0x4'),_0x99b8('0x5'),_0x99b8('0x6')),'defaultValue':_0x99b8('0x2')},'content':{'type':Sequelize[_0x99b8('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x99b8('0x1')](_0x99b8('0x2'),'variable',_0x99b8('0x4'))},'keyContent':{'type':Sequelize[_0x99b8('0x7')]},'idField':{'type':Sequelize[_0x99b8('0x7')]},'nameField':{'type':Sequelize[_0x99b8('0x7')]},'customField':{'type':Sequelize[_0x99b8('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x99b8('0x7')]}}; \ No newline at end of file +var _0xedfe=['BOOLEAN','sequelize','exports','ENUM','variable','customVariable','keyValue','string','STRING'];(function(_0x7c7bae,_0x25f8f7){var _0x16805f=function(_0x4832d2){while(--_0x4832d2){_0x7c7bae['push'](_0x7c7bae['shift']());}};_0x16805f(++_0x25f8f7);}(_0xedfe,0x1e7));var _0xeedf=function(_0x49997a,_0x3c585d){_0x49997a=_0x49997a-0x0;var _0xc00f0e=_0xedfe[_0x49997a];return _0xc00f0e;};'use strict';var Sequelize=require(_0xeedf('0x0'));module[_0xeedf('0x1')]={'type':{'type':Sequelize[_0xeedf('0x2')]('string',_0xeedf('0x3'),_0xeedf('0x4'),_0xeedf('0x5'),'picklist'),'defaultValue':_0xeedf('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xeedf('0x7')]},'keyType':{'type':Sequelize[_0xeedf('0x2')](_0xeedf('0x6'),'variable',_0xeedf('0x4'))},'keyContent':{'type':Sequelize[_0xeedf('0x7')]},'idField':{'type':Sequelize[_0xeedf('0x7')]},'nameField':{'type':Sequelize[_0xeedf('0x7')]},'customField':{'type':Sequelize[_0xeedf('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xeedf('0x7')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.controller.js b/server/api/intFreshsalesField/intFreshsalesField.controller.js index 409f369..b42ef98 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 _0xe9ba=['../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','apply','reject','save','update','then','error','stack','send','index','FreshsalesField','fieldName','model','map','name','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','type','merge','options','count','includeAll','findAll','rows','catch','show','params','rawAttributes','include','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4fe286,_0x893656){var _0x47cac6=function(_0x3c76ef){while(--_0x3c76ef){_0x4fe286['push'](_0x4fe286['shift']());}};_0x47cac6(++_0x893656);}(_0xe9ba,0x120));var _0xae9b=function(_0x417c36,_0x51d4de){_0x417c36=_0x417c36-0x0;var _0x6095ec=_0xe9ba[_0x417c36];return _0x6095ec;};'use strict';var emlformat=require(_0xae9b('0x0'));var rimraf=require(_0xae9b('0x1'));var zipdir=require(_0xae9b('0x2'));var jsonpatch=require(_0xae9b('0x3'));var rp=require(_0xae9b('0x4'));var moment=require(_0xae9b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xae9b('0x6'));var util=require(_0xae9b('0x7'));var path=require(_0xae9b('0x8'));var sox=require(_0xae9b('0x9'));var csv=require(_0xae9b('0xa'));var ejs=require(_0xae9b('0xb'));var fs=require('fs');var fs_extra=require(_0xae9b('0xc'));var _=require(_0xae9b('0xd'));var squel=require(_0xae9b('0xe'));var crypto=require(_0xae9b('0xf'));var jsforce=require(_0xae9b('0x10'));var deskjs=require(_0xae9b('0x11'));var toCsv=require(_0xae9b('0xa'));var querystring=require(_0xae9b('0x12'));var Papa=require(_0xae9b('0x13'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xae9b('0x14'));var as=require(_0xae9b('0x15'));var hardwareService=require(_0xae9b('0x16'));var logger=require(_0xae9b('0x17'))('api');var utils=require('../../config/utils');var config=require(_0xae9b('0x18'));var licenseUtil=require(_0xae9b('0x19'));var db=require(_0xae9b('0x1a'))['db'];function respondWithStatusCode(_0x3b59f1,_0x32363c){_0x32363c=_0x32363c||0xcc;return function(_0x50029f){if(_0x50029f){return _0x3b59f1[_0xae9b('0x1b')](_0x32363c);}return _0x3b59f1[_0xae9b('0x1c')](_0x32363c)[_0xae9b('0x1d')]();};}function respondWithResult(_0x5ef574,_0xc16bee){_0xc16bee=_0xc16bee||0xc8;return function(_0x48ef3b){if(_0x48ef3b){return _0x5ef574[_0xae9b('0x1c')](_0xc16bee)[_0xae9b('0x1e')](_0x48ef3b);}};}function respondWithFilteredResult(_0x3ad9ad,_0x4f52af){return function(_0x8ff313){if(_0x8ff313){var _0x52f105=typeof _0x4f52af[_0xae9b('0x1f')]===_0xae9b('0x20')&&typeof _0x4f52af[_0xae9b('0x21')]==='undefined';var _0x29e067=_0x8ff313['count'];var _0x43f277=_0x52f105?0x0:_0x4f52af[_0xae9b('0x1f')];var _0x491853=_0x52f105?_0x8ff313['count']:_0x4f52af[_0xae9b('0x1f')]+_0x4f52af[_0xae9b('0x21')];var _0x17cbe1;if(_0x491853>=_0x29e067){_0x491853=_0x29e067;_0x17cbe1=0xc8;}else{_0x17cbe1=0xce;}_0x3ad9ad[_0xae9b('0x1c')](_0x17cbe1);return _0x3ad9ad[_0xae9b('0x22')]('Content-Range',_0x43f277+'-'+_0x491853+'/'+_0x29e067)[_0xae9b('0x1e')](_0x8ff313);}return null;};}function patchUpdates(_0x4a15e7){return function(_0x2cd2f5){try{jsonpatch[_0xae9b('0x23')](_0x2cd2f5,_0x4a15e7,!![]);}catch(_0x32dd1e){return BPromise[_0xae9b('0x24')](_0x32dd1e);}return _0x2cd2f5[_0xae9b('0x25')]();};}function saveUpdates(_0x404f6c,_0x2841d4){return function(_0x4e8a01){if(_0x4e8a01){return _0x4e8a01[_0xae9b('0x26')](_0x404f6c)['then'](function(_0x4c711f){return _0x4c711f;});}return null;};}function removeEntity(_0x1e80b9,_0x5097c5){return function(_0xf27e8){if(_0xf27e8){return _0xf27e8['destroy']()[_0xae9b('0x27')](function(){_0x1e80b9['status'](0xcc)[_0xae9b('0x1d')]();});}};}function handleEntityNotFound(_0x27a7f0,_0x405938){return function(_0x4a2032){if(!_0x4a2032){_0x27a7f0[_0xae9b('0x1b')](0x194);}return _0x4a2032;};}function handleError(_0x279479,_0x5308fb){_0x5308fb=_0x5308fb||0x1f4;return function(_0x4e2bb4){logger[_0xae9b('0x28')](_0x4e2bb4[_0xae9b('0x29')]);if(_0x4e2bb4['name']){delete _0x4e2bb4['name'];}_0x279479[_0xae9b('0x1c')](_0x5308fb)[_0xae9b('0x2a')](_0x4e2bb4);};}exports[_0xae9b('0x2b')]=function(_0x12d290,_0xa61dac){var _0x515fe6={},_0x4c1d87={},_0x579c7c={'count':0x0,'rows':[]};var _0x12779a=_['map'](db[_0xae9b('0x2c')]['rawAttributes'],function(_0x38fa54){return{'name':_0x38fa54[_0xae9b('0x2d')],'type':_0x38fa54['type']['key']};});_0x4c1d87[_0xae9b('0x2e')]=_[_0xae9b('0x2f')](_0x12779a,_0xae9b('0x30'));_0x4c1d87[_0xae9b('0x31')]=_[_0xae9b('0x32')](_0x12d290[_0xae9b('0x31')]);_0x4c1d87[_0xae9b('0x33')]=_[_0xae9b('0x34')](_0x4c1d87[_0xae9b('0x2e')],_0x4c1d87[_0xae9b('0x31')]);_0x515fe6[_0xae9b('0x35')]=_['intersection'](_0x4c1d87[_0xae9b('0x2e')],qs['fields'](_0x12d290[_0xae9b('0x31')][_0xae9b('0x36')]));_0x515fe6['attributes']=_0x515fe6[_0xae9b('0x35')][_0xae9b('0x37')]?_0x515fe6[_0xae9b('0x35')]:_0x4c1d87[_0xae9b('0x2e')];if(!_0x12d290[_0xae9b('0x31')][_0xae9b('0x38')](_0xae9b('0x39'))){_0x515fe6[_0xae9b('0x21')]=qs['limit'](_0x12d290[_0xae9b('0x31')][_0xae9b('0x21')]);_0x515fe6[_0xae9b('0x1f')]=qs[_0xae9b('0x1f')](_0x12d290[_0xae9b('0x31')][_0xae9b('0x1f')]);}_0x515fe6['order']=qs[_0xae9b('0x3a')](_0x12d290[_0xae9b('0x31')]['sort']);_0x515fe6[_0xae9b('0x3b')]=qs['filters'](_[_0xae9b('0x3c')](_0x12d290['query'],_0x4c1d87['filters']),_0x12779a);if(_0x12d290[_0xae9b('0x31')][_0xae9b('0x3d')]){_0x515fe6[_0xae9b('0x3b')]=_['merge'](_0x515fe6[_0xae9b('0x3b')],{'$or':_[_0xae9b('0x2f')](_0x12779a,function(_0x2aef4e){if(_0x2aef4e[_0xae9b('0x3e')]!=='VIRTUAL'){var _0x3f385b={};_0x3f385b[_0x2aef4e['name']]={'$like':'%'+_0x12d290[_0xae9b('0x31')]['filter']+'%'};return _0x3f385b;}})});}_0x515fe6=_[_0xae9b('0x3f')]({},_0x515fe6,_0x12d290[_0xae9b('0x40')]);var _0x1429bb={'where':_0x515fe6[_0xae9b('0x3b')]};return db[_0xae9b('0x2c')][_0xae9b('0x41')](_0x1429bb)[_0xae9b('0x27')](function(_0x502586){_0x579c7c[_0xae9b('0x41')]=_0x502586;if(_0x12d290[_0xae9b('0x31')][_0xae9b('0x42')]){_0x515fe6['include']=[{'all':!![]}];}return db[_0xae9b('0x2c')][_0xae9b('0x43')](_0x515fe6);})['then'](function(_0x564827){_0x579c7c[_0xae9b('0x44')]=_0x564827;return _0x579c7c;})[_0xae9b('0x27')](respondWithFilteredResult(_0xa61dac,_0x515fe6))[_0xae9b('0x45')](handleError(_0xa61dac,null));};exports[_0xae9b('0x46')]=function(_0x49912b,_0x3c244a){var _0x324fd9={'raw':!![],'where':{'id':_0x49912b[_0xae9b('0x47')]['id']}},_0x4d306f={};_0x4d306f[_0xae9b('0x2e')]=_[_0xae9b('0x32')](db['FreshsalesField'][_0xae9b('0x48')]);_0x4d306f['query']=_[_0xae9b('0x32')](_0x49912b['query']);_0x4d306f[_0xae9b('0x33')]=_[_0xae9b('0x34')](_0x4d306f['model'],_0x4d306f[_0xae9b('0x31')]);_0x324fd9[_0xae9b('0x35')]=_[_0xae9b('0x34')](_0x4d306f['model'],qs[_0xae9b('0x36')](_0x49912b['query'][_0xae9b('0x36')]));_0x324fd9[_0xae9b('0x35')]=_0x324fd9[_0xae9b('0x35')][_0xae9b('0x37')]?_0x324fd9[_0xae9b('0x35')]:_0x4d306f[_0xae9b('0x2e')];if(_0x49912b[_0xae9b('0x31')]['includeAll']){_0x324fd9[_0xae9b('0x49')]=[{'all':!![]}];}_0x324fd9=_[_0xae9b('0x3f')]({},_0x324fd9,_0x49912b[_0xae9b('0x40')]);return db[_0xae9b('0x2c')][_0xae9b('0x4a')](_0x324fd9)['then'](handleEntityNotFound(_0x3c244a,null))[_0xae9b('0x27')](respondWithResult(_0x3c244a,null))[_0xae9b('0x45')](handleError(_0x3c244a,null));};exports['create']=function(_0x4f56ae,_0x44a7d7){return db[_0xae9b('0x2c')][_0xae9b('0x4b')](_0x4f56ae[_0xae9b('0x4c')],{})['then'](respondWithResult(_0x44a7d7,0xc9))[_0xae9b('0x45')](handleError(_0x44a7d7,null));};exports[_0xae9b('0x26')]=function(_0x234562,_0x252eab){if(_0x234562[_0xae9b('0x4c')]['id']){delete _0x234562[_0xae9b('0x4c')]['id'];}return db[_0xae9b('0x2c')][_0xae9b('0x4a')]({'where':{'id':_0x234562[_0xae9b('0x47')]['id']}})[_0xae9b('0x27')](handleEntityNotFound(_0x252eab,null))[_0xae9b('0x27')](saveUpdates(_0x234562[_0xae9b('0x4c')],null))[_0xae9b('0x27')](respondWithResult(_0x252eab,null))[_0xae9b('0x45')](handleError(_0x252eab,null));};exports[_0xae9b('0x4d')]=function(_0x2284a5,_0x203e15){return db[_0xae9b('0x2c')]['find']({'where':{'id':_0x2284a5['params']['id']}})[_0xae9b('0x27')](handleEntityNotFound(_0x203e15,null))['then'](removeEntity(_0x203e15,null))['catch'](handleError(_0x203e15,null));}; \ No newline at end of file +var _0xd760=['rows','catch','show','options','find','create','body','params','eml-format','rimraf','moment','bluebird','util','path','ejs','fs-extra','lodash','squel','crypto','jsforce','to-csv','querystring','../../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','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll'];(function(_0x44770b,_0x292817){var _0x156812=function(_0x10a8d3){while(--_0x10a8d3){_0x44770b['push'](_0x44770b['shift']());}};_0x156812(++_0x292817);}(_0xd760,0x1c4));var _0x0d76=function(_0x576232,_0x121ff0){_0x576232=_0x576232-0x0;var _0x5c4dda=_0xd760[_0x576232];return _0x5c4dda;};'use strict';var emlformat=require(_0x0d76('0x0'));var rimraf=require(_0x0d76('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d76('0x2'));var BPromise=require(_0x0d76('0x3'));var Mustache=require('mustache');var util=require(_0x0d76('0x4'));var path=require(_0x0d76('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d76('0x6'));var fs=require('fs');var fs_extra=require(_0x0d76('0x7'));var _=require(_0x0d76('0x8'));var squel=require(_0x0d76('0x9'));var crypto=require(_0x0d76('0xa'));var jsforce=require(_0x0d76('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d76('0xc'));var querystring=require(_0x0d76('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0d76('0xe'));var qs=require(_0x0d76('0xf'));var as=require(_0x0d76('0x10'));var hardwareService=require(_0x0d76('0x11'));var logger=require(_0x0d76('0x12'))(_0x0d76('0x13'));var utils=require(_0x0d76('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x0d76('0x15'));var db=require(_0x0d76('0x16'))['db'];function respondWithStatusCode(_0x338e1e,_0x334f8b){_0x334f8b=_0x334f8b||0xcc;return function(_0x77774b){if(_0x77774b){return _0x338e1e[_0x0d76('0x17')](_0x334f8b);}return _0x338e1e['status'](_0x334f8b)['end']();};}function respondWithResult(_0x2f9414,_0x1c80a3){_0x1c80a3=_0x1c80a3||0xc8;return function(_0x1739d0){if(_0x1739d0){return _0x2f9414[_0x0d76('0x18')](_0x1c80a3)[_0x0d76('0x19')](_0x1739d0);}};}function respondWithFilteredResult(_0x3b0b5b,_0x724bde){return function(_0x4b4b30){if(_0x4b4b30){var _0x365cb8=typeof _0x724bde[_0x0d76('0x1a')]===_0x0d76('0x1b')&&typeof _0x724bde[_0x0d76('0x1c')]===_0x0d76('0x1b');var _0x24a663=_0x4b4b30[_0x0d76('0x1d')];var _0x4502b9=_0x365cb8?0x0:_0x724bde[_0x0d76('0x1a')];var _0x3d77c6=_0x365cb8?_0x4b4b30[_0x0d76('0x1d')]:_0x724bde[_0x0d76('0x1a')]+_0x724bde[_0x0d76('0x1c')];var _0x4663c0;if(_0x3d77c6>=_0x24a663){_0x3d77c6=_0x24a663;_0x4663c0=0xc8;}else{_0x4663c0=0xce;}_0x3b0b5b['status'](_0x4663c0);return _0x3b0b5b['set'](_0x0d76('0x1e'),_0x4502b9+'-'+_0x3d77c6+'/'+_0x24a663)['json'](_0x4b4b30);}return null;};}function patchUpdates(_0x4bf032){return function(_0x551572){try{jsonpatch[_0x0d76('0x1f')](_0x551572,_0x4bf032,!![]);}catch(_0x448822){return BPromise[_0x0d76('0x20')](_0x448822);}return _0x551572[_0x0d76('0x21')]();};}function saveUpdates(_0x193d06,_0x28db8d){return function(_0x1136ab){if(_0x1136ab){return _0x1136ab[_0x0d76('0x22')](_0x193d06)[_0x0d76('0x23')](function(_0x31c99a){return _0x31c99a;});}return null;};}function removeEntity(_0x5c95e7,_0xd0fbca){return function(_0x3a3eea){if(_0x3a3eea){return _0x3a3eea[_0x0d76('0x24')]()[_0x0d76('0x23')](function(){_0x5c95e7[_0x0d76('0x18')](0xcc)[_0x0d76('0x25')]();});}};}function handleEntityNotFound(_0x1056d8,_0x11b590){return function(_0x2eaa41){if(!_0x2eaa41){_0x1056d8[_0x0d76('0x17')](0x194);}return _0x2eaa41;};}function handleError(_0x2af306,_0x521606){_0x521606=_0x521606||0x1f4;return function(_0x569ac2){logger['error'](_0x569ac2[_0x0d76('0x26')]);if(_0x569ac2[_0x0d76('0x27')]){delete _0x569ac2[_0x0d76('0x27')];}_0x2af306[_0x0d76('0x18')](_0x521606)['send'](_0x569ac2);};}exports[_0x0d76('0x28')]=function(_0x4e69d5,_0x47569e){var _0x490fb5={},_0x12efb3={},_0x23bfda={'count':0x0,'rows':[]};var _0x1afce6=_[_0x0d76('0x29')](db[_0x0d76('0x2a')][_0x0d76('0x2b')],function(_0x2ec309){return{'name':_0x2ec309[_0x0d76('0x2c')],'type':_0x2ec309[_0x0d76('0x2d')][_0x0d76('0x2e')]};});_0x12efb3[_0x0d76('0x2f')]=_[_0x0d76('0x29')](_0x1afce6,_0x0d76('0x27'));_0x12efb3[_0x0d76('0x30')]=_[_0x0d76('0x31')](_0x4e69d5[_0x0d76('0x30')]);_0x12efb3[_0x0d76('0x32')]=_[_0x0d76('0x33')](_0x12efb3[_0x0d76('0x2f')],_0x12efb3[_0x0d76('0x30')]);_0x490fb5[_0x0d76('0x34')]=_[_0x0d76('0x33')](_0x12efb3[_0x0d76('0x2f')],qs[_0x0d76('0x35')](_0x4e69d5[_0x0d76('0x30')][_0x0d76('0x35')]));_0x490fb5[_0x0d76('0x34')]=_0x490fb5[_0x0d76('0x34')]['length']?_0x490fb5[_0x0d76('0x34')]:_0x12efb3[_0x0d76('0x2f')];if(!_0x4e69d5[_0x0d76('0x30')][_0x0d76('0x36')](_0x0d76('0x37'))){_0x490fb5['limit']=qs['limit'](_0x4e69d5['query']['limit']);_0x490fb5[_0x0d76('0x1a')]=qs[_0x0d76('0x1a')](_0x4e69d5['query'][_0x0d76('0x1a')]);}_0x490fb5[_0x0d76('0x38')]=qs[_0x0d76('0x39')](_0x4e69d5[_0x0d76('0x30')]['sort']);_0x490fb5[_0x0d76('0x3a')]=qs['filters'](_[_0x0d76('0x3b')](_0x4e69d5[_0x0d76('0x30')],_0x12efb3[_0x0d76('0x32')]),_0x1afce6);if(_0x4e69d5['query'][_0x0d76('0x3c')]){_0x490fb5['where']=_[_0x0d76('0x3d')](_0x490fb5[_0x0d76('0x3a')],{'$or':_[_0x0d76('0x29')](_0x1afce6,function(_0x508f0b){if(_0x508f0b[_0x0d76('0x2d')]!==_0x0d76('0x3e')){var _0x3e287f={};_0x3e287f[_0x508f0b[_0x0d76('0x27')]]={'$like':'%'+_0x4e69d5[_0x0d76('0x30')]['filter']+'%'};return _0x3e287f;}})});}_0x490fb5=_['merge']({},_0x490fb5,_0x4e69d5['options']);var _0x472ef2={'where':_0x490fb5[_0x0d76('0x3a')]};return db[_0x0d76('0x2a')][_0x0d76('0x1d')](_0x472ef2)[_0x0d76('0x23')](function(_0x1d35ac){_0x23bfda[_0x0d76('0x1d')]=_0x1d35ac;if(_0x4e69d5['query'][_0x0d76('0x3f')]){_0x490fb5[_0x0d76('0x40')]=[{'all':!![]}];}return db[_0x0d76('0x2a')][_0x0d76('0x41')](_0x490fb5);})[_0x0d76('0x23')](function(_0x9ec887){_0x23bfda[_0x0d76('0x42')]=_0x9ec887;return _0x23bfda;})[_0x0d76('0x23')](respondWithFilteredResult(_0x47569e,_0x490fb5))[_0x0d76('0x43')](handleError(_0x47569e,null));};exports[_0x0d76('0x44')]=function(_0x5539fb,_0x3e572c){var _0x50551d={'raw':!![],'where':{'id':_0x5539fb['params']['id']}},_0x5d77e3={};_0x5d77e3['model']=_[_0x0d76('0x31')](db[_0x0d76('0x2a')][_0x0d76('0x2b')]);_0x5d77e3[_0x0d76('0x30')]=_['keys'](_0x5539fb[_0x0d76('0x30')]);_0x5d77e3[_0x0d76('0x32')]=_[_0x0d76('0x33')](_0x5d77e3['model'],_0x5d77e3[_0x0d76('0x30')]);_0x50551d['attributes']=_['intersection'](_0x5d77e3[_0x0d76('0x2f')],qs[_0x0d76('0x35')](_0x5539fb[_0x0d76('0x30')]['fields']));_0x50551d[_0x0d76('0x34')]=_0x50551d[_0x0d76('0x34')]['length']?_0x50551d[_0x0d76('0x34')]:_0x5d77e3['model'];if(_0x5539fb['query'][_0x0d76('0x3f')]){_0x50551d[_0x0d76('0x40')]=[{'all':!![]}];}_0x50551d=_['merge']({},_0x50551d,_0x5539fb[_0x0d76('0x45')]);return db[_0x0d76('0x2a')][_0x0d76('0x46')](_0x50551d)['then'](handleEntityNotFound(_0x3e572c,null))[_0x0d76('0x23')](respondWithResult(_0x3e572c,null))['catch'](handleError(_0x3e572c,null));};exports['create']=function(_0x3c533e,_0x17c833){return db['FreshsalesField'][_0x0d76('0x47')](_0x3c533e['body'],{})[_0x0d76('0x23')](respondWithResult(_0x17c833,0xc9))[_0x0d76('0x43')](handleError(_0x17c833,null));};exports['update']=function(_0x215d11,_0x448ba5){if(_0x215d11[_0x0d76('0x48')]['id']){delete _0x215d11['body']['id'];}return db[_0x0d76('0x2a')][_0x0d76('0x46')]({'where':{'id':_0x215d11[_0x0d76('0x49')]['id']}})[_0x0d76('0x23')](handleEntityNotFound(_0x448ba5,null))[_0x0d76('0x23')](saveUpdates(_0x215d11[_0x0d76('0x48')],null))[_0x0d76('0x23')](respondWithResult(_0x448ba5,null))['catch'](handleError(_0x448ba5,null));};exports['destroy']=function(_0x3a73f5,_0x4bf4db){return db[_0x0d76('0x2a')][_0x0d76('0x46')]({'where':{'id':_0x3a73f5[_0x0d76('0x49')]['id']}})['then'](handleEntityNotFound(_0x4bf4db,null))[_0x0d76('0x23')](removeEntity(_0x4bf4db,null))[_0x0d76('0x43')](handleError(_0x4bf4db,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 5e54f7e..bf1387a 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 _0xaf60=['../../config/logger','bluebird','rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','int_freshsales_fields','freshsales_unique_index','FieldId','lodash','util'];(function(_0x60eef8,_0x50e9e1){var _0x353bea=function(_0x2eb4b9){while(--_0x2eb4b9){_0x60eef8['push'](_0x60eef8['shift']());}};_0x353bea(++_0x50e9e1);}(_0xaf60,0x82));var _0x0af6=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xaf60[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0x0af6('0x0'));var util=require(_0x0af6('0x1'));var logger=require(_0x0af6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0af6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0af6('0x4'));var config=require(_0x0af6('0x5'));var attributes=require(_0x0af6('0x6'));module[_0x0af6('0x7')]=function(_0x463023,_0x333ce1){return _0x463023[_0x0af6('0x8')]('FreshsalesField',attributes,{'tableName':_0x0af6('0x9'),'paranoid':![],'indexes':[{'name':_0x0af6('0xa'),'fields':['idField',_0x0af6('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x02ce=['rimraf','../../config/environment','./intFreshsalesField.attributes','exports','define','freshsales_unique_index','idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x26df9f,_0x129d1b){var _0x17c304=function(_0xc482b1){while(--_0xc482b1){_0x26df9f['push'](_0x26df9f['shift']());}};_0x17c304(++_0x129d1b);}(_0x02ce,0x1ac));var _0xe02c=function(_0x236268,_0x122002){_0x236268=_0x236268-0x0;var _0x4b79cf=_0x02ce[_0x236268];return _0x4b79cf;};'use strict';var _=require(_0xe02c('0x0'));var util=require(_0xe02c('0x1'));var logger=require(_0xe02c('0x2'))('api');var moment=require(_0xe02c('0x3'));var BPromise=require('bluebird');var rp=require(_0xe02c('0x4'));var fs=require('fs');var path=require(_0xe02c('0x5'));var rimraf=require(_0xe02c('0x6'));var config=require(_0xe02c('0x7'));var attributes=require(_0xe02c('0x8'));module[_0xe02c('0x9')]=function(_0x3f7436,_0x2b804f){return _0x3f7436[_0xe02c('0xa')]('FreshsalesField',attributes,{'tableName':'int_freshsales_fields','paranoid':![],'indexes':[{'name':_0xe02c('0xb'),'fields':[_0xe02c('0xc'),_0xe02c('0xd')],'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 580d1c6..bc4e9d7 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 _0xfcf0=['randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','FreshsalesField,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','lodash','util','bluebird'];(function(_0x5c1cdc,_0x322014){var _0x2e8317=function(_0x2e9dfa){while(--_0x2e9dfa){_0x5c1cdc['push'](_0x5c1cdc['shift']());}};_0x2e8317(++_0x322014);}(_0xfcf0,0x138));var _0x0fcf=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0xfcf0[_0x43d11d];return _0x38cd08;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});} \ No newline at end of file +var _0x2675=['../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','FreshsalesField,\x20%s,\x20%s','request\x20sent','FreshsalesField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','randomstring','ioredis'];(function(_0x435c54,_0x4f9410){var _0x8ecb74=function(_0x3801ce){while(--_0x3801ce){_0x435c54['push'](_0x435c54['shift']());}};_0x8ecb74(++_0x4f9410);}(_0x2675,0x75));var _0x5267=function(_0x4c3f91,_0x2d6d67){_0x4c3f91=_0x4c3f91-0x0;var _0x4451ad=_0x2675[_0x4c3f91];return _0x4451ad;};'use strict';var _=require(_0x5267('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x5267('0x1'));var fs=require('fs');var Redis=require(_0x5267('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x5267('0x3'));var logger=require(_0x5267('0x4'))('rpc');var config=require(_0x5267('0x5'));var jayson=require(_0x5267('0x6'));var client=jayson[_0x5267('0x7')][_0x5267('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20f065,_0xc56cd5,_0x527c16){return new BPromise(function(_0x9e0a27,_0x46bfdf){return client['request'](_0x20f065,_0x527c16)[_0x5267('0x9')](function(_0x5d6645){logger[_0x5267('0xa')](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));logger['debug'](_0x5267('0xd'),_0xc56cd5,'request\x20sent',JSON[_0x5267('0xe')](_0x5d6645));if(_0x5d6645['error']){if(_0x5d6645[_0x5267('0xf')][_0x5267('0x10')]===0x1f4){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x46bfdf(_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);}logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x5d6645[_0x5267('0xf')][_0x5267('0x11')]);return _0x9e0a27(_0x5d6645[_0x5267('0xf')]['message']);}else{logger['info'](_0x5267('0xb'),_0xc56cd5,_0x5267('0xc'));_0x9e0a27(_0x5d6645[_0x5267('0x12')][_0x5267('0x11')]);}})[_0x5267('0x13')](function(_0x27e5c6){logger[_0x5267('0xf')](_0x5267('0xb'),_0xc56cd5,_0x27e5c6);_0x46bfdf(_0x27e5c6);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index b2a4715..8b4bb5b 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x7f5044,_0x56a515){var _0xdc637b=function(_0x1491b3){while(--_0x1491b3){_0x7f5044['push'](_0x7f5044['shift']());}};_0xdc637b(++_0x56a515);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'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['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x163453,_0x317d0e){var _0x593329=function(_0x20e8ba){while(--_0x20e8ba){_0x163453['push'](_0x163453['shift']());}};_0x593329(++_0x317d0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0xa9e0[_0x3c4737];return _0x2bb926;};'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['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 114fb3f..a07907a 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 _0xd509=['STRING','ENUM','newTab'];(function(_0x4e2092,_0x24e000){var _0x2758b6=function(_0x343f93){while(--_0x343f93){_0x4e2092['push'](_0x4e2092['shift']());}};_0x2758b6(++_0x24e000);}(_0xd509,0xc9));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x9d50('0x0')]},'description':{'type':Sequelize[_0x9d50('0x0')]},'username':{'type':Sequelize[_0x9d50('0x0')],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize[_0x9d50('0x0')]},'clientId':{'type':Sequelize[_0x9d50('0x0')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x9d50('0x0')]},'serverUrl':{'type':Sequelize[_0x9d50('0x0')],'allowNull':![]},'type':{'type':Sequelize[_0x9d50('0x1')]('integrationTab',_0x9d50('0x2')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0xd506=['integrationTab','newTab','sequelize','STRING','ENUM'];(function(_0x227fe7,_0x392329){var _0x4b98be=function(_0xd90e58){while(--_0xd90e58){_0x227fe7['push'](_0x227fe7['shift']());}};_0x4b98be(++_0x392329);}(_0xd506,0x197));var _0x6d50=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd506[_0x17d9e3];return _0x14192d;};'use strict';var Sequelize=require(_0x6d50('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':'username'},'remoteUri':{'type':Sequelize['STRING']},'password':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0x6d50('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x6d50('0x2')](_0x6d50('0x3'),_0x6d50('0x4')),'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 39ca55e..a6f8706 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 _0xec0c=['merge','VIRTUAL','options','count','includeAll','include','show','params','filters','intersection','length','catch','create','body','find','getConfigurations','findOne','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','getDescriptions','channel','SalesforceConfiguration','SalesforceField','getFields','Task','remoteUri','clientId','clientSecret','password','securityToken','substring','lastIndexOf','Connection','login','concat','ticketType','sobject','describe','ActivityDate','IsReminderSet','Subject','string','int','picklist','boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SalesforceAccount','rawAttributes','fieldName','type','key','model','query','keys','attributes','fields','nolimit','order','sort','where','filter'];(function(_0x51a85c,_0x2660a3){var _0x55001f=function(_0x39ec46){while(--_0x39ec46){_0x51a85c['push'](_0x51a85c['shift']());}};_0x55001f(++_0x2660a3);}(_0xec0c,0xc2));var _0xcec0=function(_0x451186,_0x4f4e48){_0x451186=_0x451186-0x0;var _0x5b9421=_0xec0c[_0x451186];return _0x5b9421;};'use strict';var emlformat=require(_0xcec0('0x0'));var rimraf=require(_0xcec0('0x1'));var zipdir=require(_0xcec0('0x2'));var jsonpatch=require(_0xcec0('0x3'));var rp=require(_0xcec0('0x4'));var moment=require('moment');var BPromise=require(_0xcec0('0x5'));var Mustache=require('mustache');var util=require(_0xcec0('0x6'));var path=require(_0xcec0('0x7'));var sox=require(_0xcec0('0x8'));var csv=require(_0xcec0('0x9'));var ejs=require(_0xcec0('0xa'));var fs=require('fs');var fs_extra=require(_0xcec0('0xb'));var _=require(_0xcec0('0xc'));var squel=require(_0xcec0('0xd'));var crypto=require('crypto');var jsforce=require(_0xcec0('0xe'));var deskjs=require(_0xcec0('0xf'));var toCsv=require(_0xcec0('0x9'));var querystring=require(_0xcec0('0x10'));var Papa=require(_0xcec0('0x11'));var Redis=require(_0xcec0('0x12'));var authService=require(_0xcec0('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xcec0('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcec0('0x15'))(_0xcec0('0x16'));var utils=require(_0xcec0('0x17'));var config=require(_0xcec0('0x18'));var licenseUtil=require(_0xcec0('0x19'));var db=require(_0xcec0('0x1a'))['db'];var integrations=require(_0xcec0('0x1b'));function respondWithStatusCode(_0x1a9f43,_0xf630bc){_0xf630bc=_0xf630bc||0xcc;return function(_0x2d3fa8){if(_0x2d3fa8){return _0x1a9f43[_0xcec0('0x1c')](_0xf630bc);}return _0x1a9f43[_0xcec0('0x1d')](_0xf630bc)[_0xcec0('0x1e')]();};}function respondWithResult(_0x5a4f65,_0x5077a8){_0x5077a8=_0x5077a8||0xc8;return function(_0x32ecb8){if(_0x32ecb8){return _0x5a4f65[_0xcec0('0x1d')](_0x5077a8)[_0xcec0('0x1f')](_0x32ecb8);}};}function respondWithFilteredResult(_0x8aa190,_0x2cc381){return function(_0x11dd8f){if(_0x11dd8f){var _0x7a683c=typeof _0x2cc381[_0xcec0('0x20')]===_0xcec0('0x21')&&typeof _0x2cc381[_0xcec0('0x22')]===_0xcec0('0x21');var _0xc6e490=_0x11dd8f['count'];var _0x1b7cb8=_0x7a683c?0x0:_0x2cc381['offset'];var _0x4ca8a9=_0x7a683c?_0x11dd8f['count']:_0x2cc381[_0xcec0('0x20')]+_0x2cc381[_0xcec0('0x22')];var _0x3b6170;if(_0x4ca8a9>=_0xc6e490){_0x4ca8a9=_0xc6e490;_0x3b6170=0xc8;}else{_0x3b6170=0xce;}_0x8aa190[_0xcec0('0x1d')](_0x3b6170);return _0x8aa190['set']('Content-Range',_0x1b7cb8+'-'+_0x4ca8a9+'/'+_0xc6e490)[_0xcec0('0x1f')](_0x11dd8f);}return null;};}function patchUpdates(_0x392e11){return function(_0x553290){try{jsonpatch[_0xcec0('0x23')](_0x553290,_0x392e11,!![]);}catch(_0x4e9410){return BPromise[_0xcec0('0x24')](_0x4e9410);}return _0x553290[_0xcec0('0x25')]();};}function saveUpdates(_0x56d2f5,_0x22632f){return function(_0x572b4a){if(_0x572b4a){return _0x572b4a[_0xcec0('0x26')](_0x56d2f5)['then'](function(_0x24b099){return _0x24b099;});}return null;};}function removeEntity(_0x18317d,_0x158c4a){return function(_0x53875a){if(_0x53875a){return _0x53875a[_0xcec0('0x27')]()[_0xcec0('0x28')](function(){_0x18317d[_0xcec0('0x1d')](0xcc)[_0xcec0('0x1e')]();});}};}function handleEntityNotFound(_0x28659e,_0x203396){return function(_0x34c00f){if(!_0x34c00f){_0x28659e['sendStatus'](0x194);}return _0x34c00f;};}function handleError(_0x336f1f,_0x44a456){_0x44a456=_0x44a456||0x1f4;return function(_0x489db9){logger[_0xcec0('0x29')](_0x489db9[_0xcec0('0x2a')]);if(_0x489db9[_0xcec0('0x2b')]){delete _0x489db9[_0xcec0('0x2b')];}_0x336f1f[_0xcec0('0x1d')](_0x44a456)[_0xcec0('0x2c')](_0x489db9);};}exports[_0xcec0('0x2d')]=function(_0x1bb8d9,_0x49c97d){var _0x136ba5={},_0x46fade={},_0x1bb2c8={'count':0x0,'rows':[]};var _0x4aa525=_[_0xcec0('0x2e')](db[_0xcec0('0x2f')][_0xcec0('0x30')],function(_0x2a0c32){return{'name':_0x2a0c32[_0xcec0('0x31')],'type':_0x2a0c32[_0xcec0('0x32')][_0xcec0('0x33')]};});_0x46fade[_0xcec0('0x34')]=_['map'](_0x4aa525,_0xcec0('0x2b'));_0x46fade[_0xcec0('0x35')]=_[_0xcec0('0x36')](_0x1bb8d9[_0xcec0('0x35')]);_0x46fade['filters']=_['intersection'](_0x46fade[_0xcec0('0x34')],_0x46fade['query']);_0x136ba5[_0xcec0('0x37')]=_['intersection'](_0x46fade[_0xcec0('0x34')],qs[_0xcec0('0x38')](_0x1bb8d9['query']['fields']));_0x136ba5[_0xcec0('0x37')]=_0x136ba5[_0xcec0('0x37')]['length']?_0x136ba5[_0xcec0('0x37')]:_0x46fade['model'];if(!_0x1bb8d9[_0xcec0('0x35')]['hasOwnProperty'](_0xcec0('0x39'))){_0x136ba5['limit']=qs['limit'](_0x1bb8d9['query'][_0xcec0('0x22')]);_0x136ba5[_0xcec0('0x20')]=qs[_0xcec0('0x20')](_0x1bb8d9['query'][_0xcec0('0x20')]);}_0x136ba5[_0xcec0('0x3a')]=qs[_0xcec0('0x3b')](_0x1bb8d9['query']['sort']);_0x136ba5[_0xcec0('0x3c')]=qs['filters'](_['pick'](_0x1bb8d9['query'],_0x46fade['filters']),_0x4aa525);if(_0x1bb8d9['query'][_0xcec0('0x3d')]){_0x136ba5[_0xcec0('0x3c')]=_[_0xcec0('0x3e')](_0x136ba5[_0xcec0('0x3c')],{'$or':_[_0xcec0('0x2e')](_0x4aa525,function(_0x496bd6){if(_0x496bd6['type']!==_0xcec0('0x3f')){var _0x6a1f8a={};_0x6a1f8a[_0x496bd6[_0xcec0('0x2b')]]={'$like':'%'+_0x1bb8d9[_0xcec0('0x35')][_0xcec0('0x3d')]+'%'};return _0x6a1f8a;}})});}_0x136ba5=_[_0xcec0('0x3e')]({},_0x136ba5,_0x1bb8d9[_0xcec0('0x40')]);var _0x84901={'where':_0x136ba5['where']};return db[_0xcec0('0x2f')][_0xcec0('0x41')](_0x84901)[_0xcec0('0x28')](function(_0x561a8f){_0x1bb2c8[_0xcec0('0x41')]=_0x561a8f;if(_0x1bb8d9['query'][_0xcec0('0x42')]){_0x136ba5[_0xcec0('0x43')]=[{'all':!![]}];}return db[_0xcec0('0x2f')]['findAll'](_0x136ba5);})[_0xcec0('0x28')](function(_0x186870){_0x1bb2c8['rows']=_0x186870;return _0x1bb2c8;})[_0xcec0('0x28')](respondWithFilteredResult(_0x49c97d,_0x136ba5))['catch'](handleError(_0x49c97d,null));};exports[_0xcec0('0x44')]=function(_0x1ac5f2,_0x2dd5f0){var _0x3a709e={'raw':![],'where':{'id':_0x1ac5f2[_0xcec0('0x45')]['id']}},_0x2fe6f1={};_0x2fe6f1['model']=_[_0xcec0('0x36')](db[_0xcec0('0x2f')]['rawAttributes']);_0x2fe6f1['query']=_[_0xcec0('0x36')](_0x1ac5f2[_0xcec0('0x35')]);_0x2fe6f1[_0xcec0('0x46')]=_[_0xcec0('0x47')](_0x2fe6f1[_0xcec0('0x34')],_0x2fe6f1['query']);_0x3a709e[_0xcec0('0x37')]=_[_0xcec0('0x47')](_0x2fe6f1[_0xcec0('0x34')],qs[_0xcec0('0x38')](_0x1ac5f2['query'][_0xcec0('0x38')]));_0x3a709e[_0xcec0('0x37')]=_0x3a709e[_0xcec0('0x37')][_0xcec0('0x48')]?_0x3a709e[_0xcec0('0x37')]:_0x2fe6f1[_0xcec0('0x34')];if(_0x1ac5f2[_0xcec0('0x35')][_0xcec0('0x42')]){_0x3a709e[_0xcec0('0x43')]=[{'all':!![]}];}_0x3a709e=_[_0xcec0('0x3e')]({},_0x3a709e,_0x1ac5f2[_0xcec0('0x40')]);return db['SalesforceAccount']['find'](_0x3a709e)[_0xcec0('0x28')](handleEntityNotFound(_0x2dd5f0,null))[_0xcec0('0x28')](respondWithResult(_0x2dd5f0,null))[_0xcec0('0x49')](handleError(_0x2dd5f0,null));};exports[_0xcec0('0x4a')]=function(_0x1f47d0,_0x3884c4){return db['SalesforceAccount'][_0xcec0('0x4a')](_0x1f47d0[_0xcec0('0x4b')],{})[_0xcec0('0x28')](respondWithResult(_0x3884c4,0xc9))[_0xcec0('0x49')](handleError(_0x3884c4,null));};exports[_0xcec0('0x26')]=function(_0x1b79ab,_0x128fa6){if(_0x1b79ab['body']['id']){delete _0x1b79ab['body']['id'];}return db[_0xcec0('0x2f')]['find']({'where':{'id':_0x1b79ab[_0xcec0('0x45')]['id']}})[_0xcec0('0x28')](handleEntityNotFound(_0x128fa6,null))[_0xcec0('0x28')](saveUpdates(_0x1b79ab[_0xcec0('0x4b')],null))[_0xcec0('0x28')](respondWithResult(_0x128fa6,null))[_0xcec0('0x49')](handleError(_0x128fa6,null));};exports[_0xcec0('0x27')]=function(_0x56f746,_0x51c73f){return db[_0xcec0('0x2f')][_0xcec0('0x4c')]({'where':{'id':_0x56f746['params']['id']}})[_0xcec0('0x28')](handleEntityNotFound(_0x51c73f,null))[_0xcec0('0x28')](removeEntity(_0x51c73f,null))[_0xcec0('0x49')](handleError(_0x51c73f,null));};exports[_0xcec0('0x4d')]=function(_0x49f367,_0xc500cf,_0x1203d6){var _0x291e02={};var _0x338d37={};var _0x2717c7;var _0x180e46;return db['SalesforceAccount'][_0xcec0('0x4e')]({'where':{'id':_0x49f367[_0xcec0('0x45')]['id']}})[_0xcec0('0x28')](handleEntityNotFound(_0xc500cf,null))[_0xcec0('0x28')](function(_0x57366c){if(_0x57366c){_0x2717c7=_0x57366c;_0x338d37['model']=_[_0xcec0('0x36')](db['SalesforceConfiguration'][_0xcec0('0x30')]);_0x338d37['query']=_[_0xcec0('0x36')](_0x49f367[_0xcec0('0x35')]);_0x338d37['filters']=_[_0xcec0('0x47')](_0x338d37['model'],_0x338d37['query']);_0x291e02['attributes']=_[_0xcec0('0x47')](_0x338d37[_0xcec0('0x34')],qs['fields'](_0x49f367[_0xcec0('0x35')]['fields']));_0x291e02['attributes']=_0x291e02[_0xcec0('0x37')][_0xcec0('0x48')]?_0x291e02[_0xcec0('0x37')]:_0x338d37[_0xcec0('0x34')];_0x291e02[_0xcec0('0x3a')]=qs[_0xcec0('0x3b')](_0x49f367['query']['sort']);_0x291e02['where']=qs['filters'](_[_0xcec0('0x4f')](_0x49f367[_0xcec0('0x35')],_0x338d37['filters']));if(_0x49f367[_0xcec0('0x35')][_0xcec0('0x3d')]){_0x291e02[_0xcec0('0x3c')]=_[_0xcec0('0x3e')](_0x291e02[_0xcec0('0x3c')],{'$or':_[_0xcec0('0x2e')](_0x291e02[_0xcec0('0x37')],function(_0x151781){var _0x25be7e={};_0x25be7e[_0x151781]={'$like':'%'+_0x49f367['query'][_0xcec0('0x3d')]+'%'};return _0x25be7e;})});}_0x291e02=_['merge']({},_0x291e02,_0x49f367[_0xcec0('0x40')]);return _0x2717c7[_0xcec0('0x4d')](_0x291e02);}})[_0xcec0('0x28')](function(_0x495cf0){if(_0x495cf0){_0x180e46=_0x495cf0[_0xcec0('0x48')];if(!_0x49f367[_0xcec0('0x35')][_0xcec0('0x50')](_0xcec0('0x39'))){_0x291e02[_0xcec0('0x22')]=qs[_0xcec0('0x22')](_0x49f367[_0xcec0('0x35')]['limit']);_0x291e02[_0xcec0('0x20')]=qs[_0xcec0('0x20')](_0x49f367[_0xcec0('0x35')][_0xcec0('0x20')]);}return _0x2717c7[_0xcec0('0x4d')](_0x291e02);}})[_0xcec0('0x28')](function(_0x27373b){if(_0x27373b){return _0x27373b?{'count':_0x180e46,'rows':_0x27373b}:null;}})[_0xcec0('0x28')](respondWithResult(_0xc500cf,null))['catch'](handleError(_0xc500cf,null));};exports[_0xcec0('0x51')]=function(_0x3bf90e,_0x1801ae,_0x4038cc){if(_0x3bf90e['body']['id']){delete _0x3bf90e['body']['id'];}return db[_0xcec0('0x2f')]['findOne']({'where':{'id':_0x3bf90e[_0xcec0('0x45')]['id']}})[_0xcec0('0x28')](handleEntityNotFound(_0x1801ae,null))[_0xcec0('0x28')](function(_0x42b53e){if(_0x42b53e){_0x3bf90e[_0xcec0('0x4b')][_0xcec0('0x52')]=_0x42b53e['id'];_0x3bf90e[_0xcec0('0x4b')][_0xcec0('0x53')]=integrations[_0xcec0('0x54')](_0x3bf90e[_0xcec0('0x4b')]['channel'],_0x3bf90e[_0xcec0('0x4b')][_0xcec0('0x32')]);_0x3bf90e['body']['Descriptions']=integrations[_0xcec0('0x55')](_0x3bf90e[_0xcec0('0x4b')][_0xcec0('0x56')],_0x3bf90e[_0xcec0('0x4b')]['type']);return db[_0xcec0('0x57')][_0xcec0('0x4a')](_0x3bf90e[_0xcec0('0x4b')],{'include':[{'model':db[_0xcec0('0x58')],'as':_0xcec0('0x53')},{'model':db[_0xcec0('0x58')],'as':'Descriptions'}]});}return null;})[_0xcec0('0x28')](respondWithResult(_0x1801ae,null))[_0xcec0('0x49')](handleError(_0x1801ae,null));};exports[_0xcec0('0x59')]=function(_0x242129,_0x11dd8c,_0x406682){var _0x197a00;var _0x4c107f='';var _0x4af3e7=_0xcec0('0x5a');return db['SalesforceAccount']['findOne']({'where':{'id':_0x242129['params']['id']},'attributes':['id',_0xcec0('0x5b'),_0xcec0('0x5c'),_0xcec0('0x5d'),'username',_0xcec0('0x5e'),_0xcec0('0x5f')]})[_0xcec0('0x28')](handleEntityNotFound(_0x11dd8c,null))[_0xcec0('0x28')](function(_0x9d897a){if(_0x9d897a){_0x4c107f=_0x9d897a['remoteUri'];var _0x3ae2f=_0x4c107f['slice'](-0x1);if(_0x3ae2f==='/'){_0x4c107f=_0x4c107f[_0xcec0('0x60')](0x0,_0x4c107f[_0xcec0('0x61')](_0x3ae2f));}_0x197a00=new jsforce[(_0xcec0('0x62'))]({'oauth2':{'loginUrl':_0x4c107f,'clientId':_0x9d897a[_0xcec0('0x5c')],'clientSecret':_0x9d897a[_0xcec0('0x5d')]}});return _0x197a00[_0xcec0('0x63')](_0x9d897a['username'],_0x9d897a[_0xcec0('0x5e')][_0xcec0('0x64')](_0x9d897a[_0xcec0('0x5f')]));}})[_0xcec0('0x28')](function(_0x4eb7d9){if(_0x4eb7d9){if(!_['isNil'](_0x242129[_0xcec0('0x35')][_0xcec0('0x65')])){_0x4af3e7=_0x242129[_0xcec0('0x35')][_0xcec0('0x65')];}return _0x197a00[_0xcec0('0x66')](_0x4af3e7)[_0xcec0('0x67')]();}})['then'](function(_0x2b8d0e){var _0x5cd63e=['OwnerId',_0xcec0('0x68'),_0xcec0('0x69'),'IsRecurrence',_0xcec0('0x6a'),'Description'];var _0x502b01=[_0xcec0('0x6b'),_0xcec0('0x6c'),_0xcec0('0x6d'),_0xcec0('0x6e'),_0xcec0('0x6f'),_0xcec0('0x70'),_0xcec0('0x71')];if(_0x2b8d0e){_[_0xcec0('0x72')](_0x2b8d0e[_0xcec0('0x38')],function(_0x5c4a77){return _0x5cd63e[_0xcec0('0x73')](_0x5c4a77['name'])||!_0x502b01[_0xcec0('0x73')](_0x5c4a77['type']);});return{'count':_0x2b8d0e[_0xcec0('0x38')][_0xcec0('0x48')],'rows':_['map'](_0x2b8d0e[_0xcec0('0x38')],function(_0x466687){return{'id':_0x466687[_0xcec0('0x2b')],'name':_0x466687[_0xcec0('0x74')],'custom':_0x466687[_0xcec0('0x75')],'options':_0x466687[_0xcec0('0x76')][_0xcec0('0x48')]>0x0?_['map'](_0x466687[_0xcec0('0x76')],function(_0x30bbc8){return{'name':_0x30bbc8[_0xcec0('0x74')],'value':_0x30bbc8[_0xcec0('0x77')]};}):_0x466687[_0xcec0('0x32')]=='boolean'?[{'name':_0xcec0('0x78'),'value':_0xcec0('0x79')},{'name':_0xcec0('0x7a'),'value':_0xcec0('0x7b')}]:[]};})};}})[_0xcec0('0x28')](respondWithResult(_0x11dd8c,null))[_0xcec0('0x49')](function(_0x4dafab){var _0x108c11=_0x242129['query'][_0xcec0('0x7c')]?0x1f4:_0x4dafab[_0xcec0('0x7d')]||0x1f4;logger[_0xcec0('0x29')](_0xcec0('0x7e'),_0xcec0('0x59'),_0x108c11,JSON[_0xcec0('0x7f')](_0x4dafab));delete _0x4dafab['name'];if(_0x108c11===0x191){_0x108c11=0x190;}_0x11dd8c[_0xcec0('0x1d')](_0x108c11)['send'](_0x242129[_0xcec0('0x35')][_0xcec0('0x7c')]?{'message':'Wrong\x20credentials','statusCode':_0x4dafab['statusCode']}:_0x4dafab);});}; \ No newline at end of file +var _0x3ce9=['includes','label','picklistValues','value','boolean','true','False','false','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','then','destroy','error','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','SalesforceAccount','includeAll','include','findAll','catch','show','params','length','options','find','body','update','getConfigurations','findOne','SalesforceConfiguration','hasOwnProperty','AccountId','channel','Descriptions','getDescriptions','SalesforceField','Subjects','Task','remoteUri','clientId','clientSecret','username','password','securityToken','substring','lastIndexOf','login','concat','ticketType','sobject','describe','OwnerId','Subject','Description','string','int','picklist','email','textarea','remove'];(function(_0x1fa759,_0x4ecdce){var _0x2da9f4=function(_0x463e2a){while(--_0x463e2a){_0x1fa759['push'](_0x1fa759['shift']());}};_0x2da9f4(++_0x4ecdce);}(_0x3ce9,0xf8));var _0x93ce=function(_0x4adf3c,_0xf12756){_0x4adf3c=_0x4adf3c-0x0;var _0x3d0dd6=_0x3ce9[_0x4adf3c];return _0x3d0dd6;};'use strict';var emlformat=require(_0x93ce('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x93ce('0x1'));var jsonpatch=require(_0x93ce('0x2'));var rp=require(_0x93ce('0x3'));var moment=require(_0x93ce('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x93ce('0x5'));var util=require(_0x93ce('0x6'));var path=require('path');var sox=require(_0x93ce('0x7'));var csv=require('to-csv');var ejs=require(_0x93ce('0x8'));var fs=require('fs');var fs_extra=require(_0x93ce('0x9'));var _=require(_0x93ce('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x93ce('0xb'));var deskjs=require(_0x93ce('0xc'));var toCsv=require(_0x93ce('0xd'));var querystring=require(_0x93ce('0xe'));var Papa=require(_0x93ce('0xf'));var Redis=require(_0x93ce('0x10'));var authService=require(_0x93ce('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x93ce('0x12'));var hardwareService=require(_0x93ce('0x13'));var logger=require(_0x93ce('0x14'))('api');var utils=require(_0x93ce('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x93ce('0x16'));var db=require(_0x93ce('0x17'))['db'];var integrations=require(_0x93ce('0x18'));function respondWithStatusCode(_0x34611d,_0x3a03b6){_0x3a03b6=_0x3a03b6||0xcc;return function(_0x4f9df1){if(_0x4f9df1){return _0x34611d[_0x93ce('0x19')](_0x3a03b6);}return _0x34611d[_0x93ce('0x1a')](_0x3a03b6)[_0x93ce('0x1b')]();};}function respondWithResult(_0x43197f,_0x5f2374){_0x5f2374=_0x5f2374||0xc8;return function(_0x3e52f7){if(_0x3e52f7){return _0x43197f['status'](_0x5f2374)['json'](_0x3e52f7);}};}function respondWithFilteredResult(_0x27a670,_0x5c8beb){return function(_0x441ae9){if(_0x441ae9){var _0x2c1b46=typeof _0x5c8beb[_0x93ce('0x1c')]==='undefined'&&typeof _0x5c8beb[_0x93ce('0x1d')]===_0x93ce('0x1e');var _0x456ea1=_0x441ae9[_0x93ce('0x1f')];var _0x51cfb5=_0x2c1b46?0x0:_0x5c8beb[_0x93ce('0x1c')];var _0x36564f=_0x2c1b46?_0x441ae9[_0x93ce('0x1f')]:_0x5c8beb[_0x93ce('0x1c')]+_0x5c8beb['limit'];var _0x53db21;if(_0x36564f>=_0x456ea1){_0x36564f=_0x456ea1;_0x53db21=0xc8;}else{_0x53db21=0xce;}_0x27a670[_0x93ce('0x1a')](_0x53db21);return _0x27a670[_0x93ce('0x20')]('Content-Range',_0x51cfb5+'-'+_0x36564f+'/'+_0x456ea1)['json'](_0x441ae9);}return null;};}function patchUpdates(_0x4e8c7e){return function(_0x526542){try{jsonpatch[_0x93ce('0x21')](_0x526542,_0x4e8c7e,!![]);}catch(_0xb013e5){return BPromise[_0x93ce('0x22')](_0xb013e5);}return _0x526542[_0x93ce('0x23')]();};}function saveUpdates(_0x57cc5d,_0x26711e){return function(_0x8d24db){if(_0x8d24db){return _0x8d24db['update'](_0x57cc5d)[_0x93ce('0x24')](function(_0x4fbf9b){return _0x4fbf9b;});}return null;};}function removeEntity(_0x1bdc7a,_0x5aca14){return function(_0x1d9c22){if(_0x1d9c22){return _0x1d9c22[_0x93ce('0x25')]()[_0x93ce('0x24')](function(){_0x1bdc7a['status'](0xcc)[_0x93ce('0x1b')]();});}};}function handleEntityNotFound(_0x5e8b08,_0x25e862){return function(_0x223e8e){if(!_0x223e8e){_0x5e8b08[_0x93ce('0x19')](0x194);}return _0x223e8e;};}function handleError(_0x451b8d,_0x1030f5){_0x1030f5=_0x1030f5||0x1f4;return function(_0x3d7998){logger[_0x93ce('0x26')](_0x3d7998['stack']);if(_0x3d7998[_0x93ce('0x27')]){delete _0x3d7998[_0x93ce('0x27')];}_0x451b8d[_0x93ce('0x1a')](_0x1030f5)[_0x93ce('0x28')](_0x3d7998);};}exports['index']=function(_0x59055a,_0x5b618f){var _0x18bdeb={},_0xaeae6d={},_0x2526ec={'count':0x0,'rows':[]};var _0x1ded60=_[_0x93ce('0x29')](db['SalesforceAccount'][_0x93ce('0x2a')],function(_0x5c2d40){return{'name':_0x5c2d40[_0x93ce('0x2b')],'type':_0x5c2d40[_0x93ce('0x2c')][_0x93ce('0x2d')]};});_0xaeae6d[_0x93ce('0x2e')]=_['map'](_0x1ded60,'name');_0xaeae6d[_0x93ce('0x2f')]=_[_0x93ce('0x30')](_0x59055a[_0x93ce('0x2f')]);_0xaeae6d[_0x93ce('0x31')]=_[_0x93ce('0x32')](_0xaeae6d[_0x93ce('0x2e')],_0xaeae6d[_0x93ce('0x2f')]);_0x18bdeb[_0x93ce('0x33')]=_[_0x93ce('0x32')](_0xaeae6d[_0x93ce('0x2e')],qs['fields'](_0x59055a[_0x93ce('0x2f')][_0x93ce('0x34')]));_0x18bdeb[_0x93ce('0x33')]=_0x18bdeb['attributes']['length']?_0x18bdeb[_0x93ce('0x33')]:_0xaeae6d[_0x93ce('0x2e')];if(!_0x59055a['query']['hasOwnProperty'](_0x93ce('0x35'))){_0x18bdeb[_0x93ce('0x1d')]=qs['limit'](_0x59055a[_0x93ce('0x2f')][_0x93ce('0x1d')]);_0x18bdeb[_0x93ce('0x1c')]=qs[_0x93ce('0x1c')](_0x59055a[_0x93ce('0x2f')][_0x93ce('0x1c')]);}_0x18bdeb[_0x93ce('0x36')]=qs[_0x93ce('0x37')](_0x59055a[_0x93ce('0x2f')][_0x93ce('0x37')]);_0x18bdeb[_0x93ce('0x38')]=qs[_0x93ce('0x31')](_[_0x93ce('0x39')](_0x59055a['query'],_0xaeae6d[_0x93ce('0x31')]),_0x1ded60);if(_0x59055a['query'][_0x93ce('0x3a')]){_0x18bdeb['where']=_['merge'](_0x18bdeb[_0x93ce('0x38')],{'$or':_[_0x93ce('0x29')](_0x1ded60,function(_0x5d3ee9){if(_0x5d3ee9[_0x93ce('0x2c')]!==_0x93ce('0x3b')){var _0x21f079={};_0x21f079[_0x5d3ee9['name']]={'$like':'%'+_0x59055a[_0x93ce('0x2f')][_0x93ce('0x3a')]+'%'};return _0x21f079;}})});}_0x18bdeb=_[_0x93ce('0x3c')]({},_0x18bdeb,_0x59055a['options']);var _0x3ada32={'where':_0x18bdeb['where']};return db[_0x93ce('0x3d')]['count'](_0x3ada32)[_0x93ce('0x24')](function(_0x43224b){_0x2526ec[_0x93ce('0x1f')]=_0x43224b;if(_0x59055a['query'][_0x93ce('0x3e')]){_0x18bdeb[_0x93ce('0x3f')]=[{'all':!![]}];}return db[_0x93ce('0x3d')][_0x93ce('0x40')](_0x18bdeb);})[_0x93ce('0x24')](function(_0x3b34a9){_0x2526ec['rows']=_0x3b34a9;return _0x2526ec;})[_0x93ce('0x24')](respondWithFilteredResult(_0x5b618f,_0x18bdeb))[_0x93ce('0x41')](handleError(_0x5b618f,null));};exports[_0x93ce('0x42')]=function(_0x5249ba,_0x394af3){var _0x11470a={'raw':![],'where':{'id':_0x5249ba[_0x93ce('0x43')]['id']}},_0x39fa21={};_0x39fa21[_0x93ce('0x2e')]=_[_0x93ce('0x30')](db[_0x93ce('0x3d')]['rawAttributes']);_0x39fa21[_0x93ce('0x2f')]=_['keys'](_0x5249ba[_0x93ce('0x2f')]);_0x39fa21['filters']=_['intersection'](_0x39fa21[_0x93ce('0x2e')],_0x39fa21['query']);_0x11470a['attributes']=_['intersection'](_0x39fa21[_0x93ce('0x2e')],qs[_0x93ce('0x34')](_0x5249ba[_0x93ce('0x2f')][_0x93ce('0x34')]));_0x11470a[_0x93ce('0x33')]=_0x11470a[_0x93ce('0x33')][_0x93ce('0x44')]?_0x11470a[_0x93ce('0x33')]:_0x39fa21[_0x93ce('0x2e')];if(_0x5249ba[_0x93ce('0x2f')][_0x93ce('0x3e')]){_0x11470a['include']=[{'all':!![]}];}_0x11470a=_['merge']({},_0x11470a,_0x5249ba[_0x93ce('0x45')]);return db['SalesforceAccount'][_0x93ce('0x46')](_0x11470a)[_0x93ce('0x24')](handleEntityNotFound(_0x394af3,null))['then'](respondWithResult(_0x394af3,null))[_0x93ce('0x41')](handleError(_0x394af3,null));};exports['create']=function(_0x4e3b2e,_0x14388b){return db[_0x93ce('0x3d')]['create'](_0x4e3b2e[_0x93ce('0x47')],{})[_0x93ce('0x24')](respondWithResult(_0x14388b,0xc9))[_0x93ce('0x41')](handleError(_0x14388b,null));};exports[_0x93ce('0x48')]=function(_0x4b2ea3,_0x1e13df){if(_0x4b2ea3[_0x93ce('0x47')]['id']){delete _0x4b2ea3[_0x93ce('0x47')]['id'];}return db[_0x93ce('0x3d')][_0x93ce('0x46')]({'where':{'id':_0x4b2ea3[_0x93ce('0x43')]['id']}})[_0x93ce('0x24')](handleEntityNotFound(_0x1e13df,null))[_0x93ce('0x24')](saveUpdates(_0x4b2ea3['body'],null))['then'](respondWithResult(_0x1e13df,null))[_0x93ce('0x41')](handleError(_0x1e13df,null));};exports[_0x93ce('0x25')]=function(_0x32fedd,_0x3ef0f6){return db['SalesforceAccount'][_0x93ce('0x46')]({'where':{'id':_0x32fedd[_0x93ce('0x43')]['id']}})['then'](handleEntityNotFound(_0x3ef0f6,null))['then'](removeEntity(_0x3ef0f6,null))[_0x93ce('0x41')](handleError(_0x3ef0f6,null));};exports[_0x93ce('0x49')]=function(_0x408e9f,_0x3ac690,_0x4535ed){var _0x3cd531={};var _0x2a1f1c={};var _0x2bf5bb;var _0x3b1832;return db[_0x93ce('0x3d')][_0x93ce('0x4a')]({'where':{'id':_0x408e9f['params']['id']}})[_0x93ce('0x24')](handleEntityNotFound(_0x3ac690,null))[_0x93ce('0x24')](function(_0x5e9283){if(_0x5e9283){_0x2bf5bb=_0x5e9283;_0x2a1f1c[_0x93ce('0x2e')]=_[_0x93ce('0x30')](db[_0x93ce('0x4b')][_0x93ce('0x2a')]);_0x2a1f1c[_0x93ce('0x2f')]=_[_0x93ce('0x30')](_0x408e9f[_0x93ce('0x2f')]);_0x2a1f1c[_0x93ce('0x31')]=_[_0x93ce('0x32')](_0x2a1f1c[_0x93ce('0x2e')],_0x2a1f1c[_0x93ce('0x2f')]);_0x3cd531['attributes']=_['intersection'](_0x2a1f1c[_0x93ce('0x2e')],qs[_0x93ce('0x34')](_0x408e9f[_0x93ce('0x2f')][_0x93ce('0x34')]));_0x3cd531['attributes']=_0x3cd531[_0x93ce('0x33')][_0x93ce('0x44')]?_0x3cd531[_0x93ce('0x33')]:_0x2a1f1c[_0x93ce('0x2e')];_0x3cd531['order']=qs['sort'](_0x408e9f[_0x93ce('0x2f')][_0x93ce('0x37')]);_0x3cd531['where']=qs['filters'](_[_0x93ce('0x39')](_0x408e9f[_0x93ce('0x2f')],_0x2a1f1c[_0x93ce('0x31')]));if(_0x408e9f['query']['filter']){_0x3cd531['where']=_[_0x93ce('0x3c')](_0x3cd531[_0x93ce('0x38')],{'$or':_[_0x93ce('0x29')](_0x3cd531[_0x93ce('0x33')],function(_0x48ba89){var _0x4a7299={};_0x4a7299[_0x48ba89]={'$like':'%'+_0x408e9f[_0x93ce('0x2f')][_0x93ce('0x3a')]+'%'};return _0x4a7299;})});}_0x3cd531=_[_0x93ce('0x3c')]({},_0x3cd531,_0x408e9f['options']);return _0x2bf5bb[_0x93ce('0x49')](_0x3cd531);}})[_0x93ce('0x24')](function(_0x2c2da4){if(_0x2c2da4){_0x3b1832=_0x2c2da4['length'];if(!_0x408e9f[_0x93ce('0x2f')][_0x93ce('0x4c')](_0x93ce('0x35'))){_0x3cd531[_0x93ce('0x1d')]=qs['limit'](_0x408e9f[_0x93ce('0x2f')]['limit']);_0x3cd531[_0x93ce('0x1c')]=qs[_0x93ce('0x1c')](_0x408e9f['query']['offset']);}return _0x2bf5bb['getConfigurations'](_0x3cd531);}})['then'](function(_0x111a3){if(_0x111a3){return _0x111a3?{'count':_0x3b1832,'rows':_0x111a3}:null;}})[_0x93ce('0x24')](respondWithResult(_0x3ac690,null))[_0x93ce('0x41')](handleError(_0x3ac690,null));};exports['addConfiguration']=function(_0x47d2a3,_0x129230,_0x68faa3){if(_0x47d2a3[_0x93ce('0x47')]['id']){delete _0x47d2a3['body']['id'];}return db[_0x93ce('0x3d')][_0x93ce('0x4a')]({'where':{'id':_0x47d2a3[_0x93ce('0x43')]['id']}})[_0x93ce('0x24')](handleEntityNotFound(_0x129230,null))['then'](function(_0xed1a28){if(_0xed1a28){_0x47d2a3['body'][_0x93ce('0x4d')]=_0xed1a28['id'];_0x47d2a3['body']['Subjects']=integrations['getSubjects'](_0x47d2a3['body'][_0x93ce('0x4e')],_0x47d2a3['body'][_0x93ce('0x2c')]);_0x47d2a3[_0x93ce('0x47')][_0x93ce('0x4f')]=integrations[_0x93ce('0x50')](_0x47d2a3[_0x93ce('0x47')][_0x93ce('0x4e')],_0x47d2a3[_0x93ce('0x47')][_0x93ce('0x2c')]);return db[_0x93ce('0x4b')]['create'](_0x47d2a3[_0x93ce('0x47')],{'include':[{'model':db[_0x93ce('0x51')],'as':_0x93ce('0x52')},{'model':db[_0x93ce('0x51')],'as':_0x93ce('0x4f')}]});}return null;})[_0x93ce('0x24')](respondWithResult(_0x129230,null))[_0x93ce('0x41')](handleError(_0x129230,null));};exports['getFields']=function(_0x30d4fa,_0x392858,_0x1954f2){var _0x3c2758;var _0x475744='';var _0x36c7d7=_0x93ce('0x53');return db['SalesforceAccount'][_0x93ce('0x4a')]({'where':{'id':_0x30d4fa[_0x93ce('0x43')]['id']},'attributes':['id',_0x93ce('0x54'),_0x93ce('0x55'),_0x93ce('0x56'),_0x93ce('0x57'),_0x93ce('0x58'),_0x93ce('0x59')]})[_0x93ce('0x24')](handleEntityNotFound(_0x392858,null))[_0x93ce('0x24')](function(_0xee3efb){if(_0xee3efb){_0x475744=_0xee3efb[_0x93ce('0x54')];var _0x4bfd51=_0x475744['slice'](-0x1);if(_0x4bfd51==='/'){_0x475744=_0x475744[_0x93ce('0x5a')](0x0,_0x475744[_0x93ce('0x5b')](_0x4bfd51));}_0x3c2758=new jsforce['Connection']({'oauth2':{'loginUrl':_0x475744,'clientId':_0xee3efb['clientId'],'clientSecret':_0xee3efb['clientSecret']}});return _0x3c2758[_0x93ce('0x5c')](_0xee3efb[_0x93ce('0x57')],_0xee3efb[_0x93ce('0x58')][_0x93ce('0x5d')](_0xee3efb[_0x93ce('0x59')]));}})[_0x93ce('0x24')](function(_0x5c3745){if(_0x5c3745){if(!_['isNil'](_0x30d4fa[_0x93ce('0x2f')][_0x93ce('0x5e')])){_0x36c7d7=_0x30d4fa[_0x93ce('0x2f')][_0x93ce('0x5e')];}return _0x3c2758[_0x93ce('0x5f')](_0x36c7d7)[_0x93ce('0x60')]();}})[_0x93ce('0x24')](function(_0x2e3dea){var _0x44a9db=[_0x93ce('0x61'),'ActivityDate','IsReminderSet','IsRecurrence',_0x93ce('0x62'),_0x93ce('0x63')];var _0x4993fa=[_0x93ce('0x64'),_0x93ce('0x65'),_0x93ce('0x66'),'boolean',_0x93ce('0x67'),_0x93ce('0x68'),'phone'];if(_0x2e3dea){_[_0x93ce('0x69')](_0x2e3dea[_0x93ce('0x34')],function(_0x5da103){return _0x44a9db[_0x93ce('0x6a')](_0x5da103[_0x93ce('0x27')])||!_0x4993fa[_0x93ce('0x6a')](_0x5da103[_0x93ce('0x2c')]);});return{'count':_0x2e3dea[_0x93ce('0x34')][_0x93ce('0x44')],'rows':_[_0x93ce('0x29')](_0x2e3dea['fields'],function(_0x335dae){return{'id':_0x335dae[_0x93ce('0x27')],'name':_0x335dae[_0x93ce('0x6b')],'custom':_0x335dae['custom'],'options':_0x335dae[_0x93ce('0x6c')][_0x93ce('0x44')]>0x0?_['map'](_0x335dae[_0x93ce('0x6c')],function(_0x169175){return{'name':_0x169175[_0x93ce('0x6b')],'value':_0x169175[_0x93ce('0x6d')]};}):_0x335dae['type']==_0x93ce('0x6e')?[{'name':'True','value':_0x93ce('0x6f')},{'name':_0x93ce('0x70'),'value':_0x93ce('0x71')}]:[]};})};}})[_0x93ce('0x24')](respondWithResult(_0x392858,null))[_0x93ce('0x41')](function(_0x6cbe82){var _0x3f193a=_0x30d4fa[_0x93ce('0x2f')][_0x93ce('0x72')]?0x1f4:_0x6cbe82[_0x93ce('0x73')]||0x1f4;logger[_0x93ce('0x26')](_0x93ce('0x74'),'getFields',_0x3f193a,JSON['stringify'](_0x6cbe82));delete _0x6cbe82[_0x93ce('0x27')];if(_0x3f193a===0x191){_0x3f193a=0x190;}_0x392858[_0x93ce('0x1a')](_0x3f193a)[_0x93ce('0x28')](_0x30d4fa[_0x93ce('0x2f')][_0x93ce('0x72')]?{'message':_0x93ce('0x75'),'statusCode':_0x6cbe82['statusCode']}:_0x6cbe82);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index f67fd70..4799fc2 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 _0x16a6=['../../config/logger','api','moment','bluebird','path','../../config/environment','exports','define','SalesforceAccount','int_salesforce_accounts','lodash','util'];(function(_0x371694,_0x209a91){var _0x33eb9c=function(_0x28ea79){while(--_0x28ea79){_0x371694['push'](_0x371694['shift']());}};_0x33eb9c(++_0x209a91);}(_0x16a6,0x14e));var _0x616a=function(_0x2f1762,_0xab43df){_0x2f1762=_0x2f1762-0x0;var _0x8ab21=_0x16a6[_0x2f1762];return _0x8ab21;};'use strict';var _=require(_0x616a('0x0'));var util=require(_0x616a('0x1'));var logger=require(_0x616a('0x2'))(_0x616a('0x3'));var moment=require(_0x616a('0x4'));var BPromise=require(_0x616a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x616a('0x6'));var rimraf=require('rimraf');var config=require(_0x616a('0x7'));var attributes=require('./intSalesforceAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0x616a('0x8')]=function(_0x54ba7d,_0x39c8da){return _0x54ba7d[_0x616a('0x9')](_0x616a('0xa'),attributes,{'tableName':_0x616a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3149=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','SalesforceAccount','int_salesforce_accounts','lodash','util','../../config/logger'];(function(_0x4d0028,_0x2db589){var _0x17bc0e=function(_0x1d4fa9){while(--_0x1d4fa9){_0x4d0028['push'](_0x4d0028['shift']());}};_0x17bc0e(++_0x2db589);}(_0x3149,0x1b7));var _0x9314=function(_0x455438,_0x3efbe1){_0x455438=_0x455438-0x0;var _0x5a9bcd=_0x3149[_0x455438];return _0x5a9bcd;};'use strict';var _=require(_0x9314('0x0'));var util=require(_0x9314('0x1'));var logger=require(_0x9314('0x2'))(_0x9314('0x3'));var moment=require(_0x9314('0x4'));var BPromise=require(_0x9314('0x5'));var rp=require(_0x9314('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9314('0x7'));var config=require(_0x9314('0x8'));var attributes=require(_0x9314('0x9'));var integrations=require(_0x9314('0xa'));module['exports']=function(_0x3a3b1d,_0x32f5ce){return _0x3a3b1d['define'](_0x9314('0xb'),attributes,{'tableName':_0x9314('0xc'),'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 07a54a1..08a6dfa 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 _0x395e=['options','raw','attributes','limit','include','map','model','ShowSalesforceAccount','SalesforceAccount','find','where','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','SalesforceAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','GetSalesforceAccount','findAll'];(function(_0x2f21c6,_0x51de35){var _0x32cbd5=function(_0x651591){while(--_0x651591){_0x2f21c6['push'](_0x2f21c6['shift']());}};_0x32cbd5(++_0x51de35);}(_0x395e,0x1af));var _0xe395=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x395e[_0x1facfa];return _0x9ec701;};'use strict';var _=require('lodash');var util=require(_0xe395('0x0'));var moment=require(_0xe395('0x1'));var BPromise=require('bluebird');var rs=require(_0xe395('0x2'));var fs=require('fs');var Redis=require(_0xe395('0x3'));var db=require(_0xe395('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xe395('0x5'))(_0xe395('0x6'));var config=require(_0xe395('0x7'));var jayson=require(_0xe395('0x8'));var client=jayson[_0xe395('0x9')][_0xe395('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc4873f,_0x23e1e5,_0x2bbd3b){return new BPromise(function(_0x57ba02,_0x1bba34){return client['request'](_0xc4873f,_0x2bbd3b)[_0xe395('0xb')](function(_0x1c41b3){logger[_0xe395('0xc')](_0xe395('0xd'),_0x23e1e5,'request\x20sent');logger[_0xe395('0xe')]('SalesforceAccount,\x20%s,\x20%s,\x20%s',_0x23e1e5,_0xe395('0xf'),JSON[_0xe395('0x10')](_0x1c41b3));if(_0x1c41b3[_0xe395('0x11')]){if(_0x1c41b3[_0xe395('0x11')][_0xe395('0x12')]===0x1f4){logger[_0xe395('0x11')](_0xe395('0xd'),_0x23e1e5,_0x1c41b3[_0xe395('0x11')]['message']);return _0x1bba34(_0x1c41b3[_0xe395('0x11')]['message']);}logger['error'](_0xe395('0xd'),_0x23e1e5,_0x1c41b3[_0xe395('0x11')]['message']);return _0x57ba02(_0x1c41b3[_0xe395('0x11')][_0xe395('0x13')]);}else{logger['info'](_0xe395('0xd'),_0x23e1e5,_0xe395('0xf'));_0x57ba02(_0x1c41b3[_0xe395('0x14')][_0xe395('0x13')]);}})[_0xe395('0x15')](function(_0x4fac27){logger['error']('SalesforceAccount,\x20%s,\x20%s',_0x23e1e5,_0x4fac27);_0x1bba34(_0x4fac27);});});}exports[_0xe395('0x16')]=function(_0x513441){var _0x2b1c88=this;return new Promise(function(_0x11a196,_0x48d131){return db['SalesforceAccount'][_0xe395('0x17')]({'raw':_0x513441[_0xe395('0x18')]?_0x513441[_0xe395('0x18')][_0xe395('0x19')]===undefined?!![]:![]:!![],'where':_0x513441[_0xe395('0x18')]?_0x513441[_0xe395('0x18')]['where']||null:null,'attributes':_0x513441[_0xe395('0x18')]?_0x513441[_0xe395('0x18')][_0xe395('0x1a')]||null:null,'limit':_0x513441[_0xe395('0x18')]?_0x513441[_0xe395('0x18')][_0xe395('0x1b')]||null:null,'include':_0x513441[_0xe395('0x18')]?_0x513441[_0xe395('0x18')][_0xe395('0x1c')]?_[_0xe395('0x1d')](_0x513441[_0xe395('0x18')][_0xe395('0x1c')],function(_0x22cbf7){return{'model':db[_0x22cbf7[_0xe395('0x1e')]],'as':_0x22cbf7['as'],'attributes':_0x22cbf7[_0xe395('0x1a')],'include':_0x22cbf7[_0xe395('0x1c')]?_[_0xe395('0x1d')](_0x22cbf7['include'],function(_0x846c4a){return{'model':db[_0x846c4a[_0xe395('0x1e')]],'as':_0x846c4a['as'],'attributes':_0x846c4a[_0xe395('0x1a')],'include':_0x846c4a['include']?_[_0xe395('0x1d')](_0x846c4a[_0xe395('0x1c')],function(_0x12fc6b){return{'model':db[_0x12fc6b['model']],'as':_0x12fc6b['as'],'attributes':_0x12fc6b[_0xe395('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe395('0xb')](function(_0x5c9c8d){logger[_0xe395('0xc')](_0xe395('0x16'),_0x513441);logger[_0xe395('0xe')](_0xe395('0x16'),_0x513441,JSON[_0xe395('0x10')](_0x5c9c8d));_0x11a196(_0x5c9c8d);})[_0xe395('0x15')](function(_0x1bc610){logger[_0xe395('0x11')]('GetSalesforceAccount',_0x1bc610[_0xe395('0x13')],_0x513441);_0x48d131(_0x2b1c88['error'](0x1f4,_0x1bc610[_0xe395('0x13')]));});});};exports[_0xe395('0x1f')]=function(_0x89ad65){var _0x304208=this;return new Promise(function(_0x430149,_0x3c22e7){return db[_0xe395('0x20')][_0xe395('0x21')]({'raw':_0x89ad65[_0xe395('0x18')]?_0x89ad65[_0xe395('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x89ad65[_0xe395('0x18')]?_0x89ad65['options'][_0xe395('0x22')]||null:null,'attributes':_0x89ad65[_0xe395('0x18')]?_0x89ad65[_0xe395('0x18')][_0xe395('0x1a')]||null:null,'include':_0x89ad65[_0xe395('0x18')]?_0x89ad65[_0xe395('0x18')][_0xe395('0x1c')]?_['map'](_0x89ad65[_0xe395('0x18')][_0xe395('0x1c')],function(_0x455acd){return{'model':db[_0x455acd['model']],'as':_0x455acd['as'],'attributes':_0x455acd[_0xe395('0x1a')],'include':_0x455acd[_0xe395('0x1c')]?_[_0xe395('0x1d')](_0x455acd[_0xe395('0x1c')],function(_0x20fe92){return{'model':db[_0x20fe92[_0xe395('0x1e')]],'as':_0x20fe92['as'],'attributes':_0x20fe92[_0xe395('0x1a')],'include':_0x20fe92[_0xe395('0x1c')]?_[_0xe395('0x1d')](_0x20fe92[_0xe395('0x1c')],function(_0x8f458e){return{'model':db[_0x8f458e[_0xe395('0x1e')]],'as':_0x8f458e['as'],'attributes':_0x8f458e['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x27f2b0){logger[_0xe395('0xc')](_0xe395('0x1f'),_0x89ad65);logger['debug'](_0xe395('0x1f'),_0x89ad65,JSON['stringify'](_0x27f2b0));_0x430149(_0x27f2b0);})[_0xe395('0x15')](function(_0x5e870a){logger['error'](_0xe395('0x1f'),_0x5e870a[_0xe395('0x13')],_0x89ad65);_0x3c22e7(_0x304208['error'](0x1f4,_0x5e870a['message']));});});}; \ No newline at end of file +var _0x96cf=['request','then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','code','message','error','result','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','stringify','ShowSalesforceAccount','find','lodash','util','ioredis','../../config/utils','rpc','../../config/environment','client'];(function(_0x2bef29,_0x2070a8){var _0x38bba3=function(_0x323037){while(--_0x323037){_0x2bef29['push'](_0x2bef29['shift']());}};_0x38bba3(++_0x2070a8);}(_0x96cf,0x143));var _0xf96c=function(_0x4f1a3c,_0x5624d8){_0x4f1a3c=_0x4f1a3c-0x0;var _0x1f5ee8=_0x96cf[_0x4f1a3c];return _0x1f5ee8;};'use strict';var _=require(_0xf96c('0x0'));var util=require(_0xf96c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf96c('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0xf96c('0x3'));var logger=require('../../config/logger')(_0xf96c('0x4'));var config=require(_0xf96c('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf96c('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31a171,_0x3bd1e5,_0x3c0f15){return new BPromise(function(_0x3ba7e7,_0x15711d){return client[_0xf96c('0x7')](_0x31a171,_0x3c0f15)[_0xf96c('0x8')](function(_0x4a7a7e){logger[_0xf96c('0x9')](_0xf96c('0xa'),_0x3bd1e5,_0xf96c('0xb'));logger[_0xf96c('0xc')](_0xf96c('0xd'),_0x3bd1e5,_0xf96c('0xb'),JSON['stringify'](_0x4a7a7e));if(_0x4a7a7e['error']){if(_0x4a7a7e['error'][_0xf96c('0xe')]===0x1f4){logger['error'](_0xf96c('0xa'),_0x3bd1e5,_0x4a7a7e['error'][_0xf96c('0xf')]);return _0x15711d(_0x4a7a7e[_0xf96c('0x10')][_0xf96c('0xf')]);}logger[_0xf96c('0x10')](_0xf96c('0xa'),_0x3bd1e5,_0x4a7a7e['error']['message']);return _0x3ba7e7(_0x4a7a7e['error'][_0xf96c('0xf')]);}else{logger[_0xf96c('0x9')](_0xf96c('0xa'),_0x3bd1e5,_0xf96c('0xb'));_0x3ba7e7(_0x4a7a7e[_0xf96c('0x11')][_0xf96c('0xf')]);}})[_0xf96c('0x12')](function(_0x13a9f6){logger[_0xf96c('0x10')]('SalesforceAccount,\x20%s,\x20%s',_0x3bd1e5,_0x13a9f6);_0x15711d(_0x13a9f6);});});}exports[_0xf96c('0x13')]=function(_0x50f76e){var _0x553b5e=this;return new Promise(function(_0xfffcad,_0x10ab39){return db[_0xf96c('0x14')][_0xf96c('0x15')]({'raw':_0x50f76e['options']?_0x50f76e[_0xf96c('0x16')][_0xf96c('0x17')]===undefined?!![]:![]:!![],'where':_0x50f76e[_0xf96c('0x16')]?_0x50f76e[_0xf96c('0x16')][_0xf96c('0x18')]||null:null,'attributes':_0x50f76e['options']?_0x50f76e[_0xf96c('0x16')][_0xf96c('0x19')]||null:null,'limit':_0x50f76e[_0xf96c('0x16')]?_0x50f76e[_0xf96c('0x16')][_0xf96c('0x1a')]||null:null,'include':_0x50f76e[_0xf96c('0x16')]?_0x50f76e[_0xf96c('0x16')][_0xf96c('0x1b')]?_[_0xf96c('0x1c')](_0x50f76e[_0xf96c('0x16')][_0xf96c('0x1b')],function(_0x877ffe){return{'model':db[_0x877ffe['model']],'as':_0x877ffe['as'],'attributes':_0x877ffe[_0xf96c('0x19')],'include':_0x877ffe[_0xf96c('0x1b')]?_['map'](_0x877ffe[_0xf96c('0x1b')],function(_0x4c3533){return{'model':db[_0x4c3533[_0xf96c('0x1d')]],'as':_0x4c3533['as'],'attributes':_0x4c3533[_0xf96c('0x19')],'include':_0x4c3533['include']?_[_0xf96c('0x1c')](_0x4c3533[_0xf96c('0x1b')],function(_0x1d12b5){return{'model':db[_0x1d12b5['model']],'as':_0x1d12b5['as'],'attributes':_0x1d12b5[_0xf96c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xe22f5){logger[_0xf96c('0x9')]('GetSalesforceAccount',_0x50f76e);logger[_0xf96c('0xc')](_0xf96c('0x13'),_0x50f76e,JSON[_0xf96c('0x1e')](_0xe22f5));_0xfffcad(_0xe22f5);})[_0xf96c('0x12')](function(_0x49af6f){logger[_0xf96c('0x10')]('GetSalesforceAccount',_0x49af6f[_0xf96c('0xf')],_0x50f76e);_0x10ab39(_0x553b5e[_0xf96c('0x10')](0x1f4,_0x49af6f[_0xf96c('0xf')]));});});};exports[_0xf96c('0x1f')]=function(_0x2200c6){var _0x4c43a9=this;return new Promise(function(_0x274bb2,_0x13a000){return db[_0xf96c('0x14')][_0xf96c('0x20')]({'raw':_0x2200c6['options']?_0x2200c6['options'][_0xf96c('0x17')]===undefined?!![]:![]:!![],'where':_0x2200c6['options']?_0x2200c6[_0xf96c('0x16')][_0xf96c('0x18')]||null:null,'attributes':_0x2200c6['options']?_0x2200c6[_0xf96c('0x16')]['attributes']||null:null,'include':_0x2200c6[_0xf96c('0x16')]?_0x2200c6[_0xf96c('0x16')]['include']?_[_0xf96c('0x1c')](_0x2200c6['options'][_0xf96c('0x1b')],function(_0x928a8d){return{'model':db[_0x928a8d['model']],'as':_0x928a8d['as'],'attributes':_0x928a8d[_0xf96c('0x19')],'include':_0x928a8d[_0xf96c('0x1b')]?_[_0xf96c('0x1c')](_0x928a8d['include'],function(_0x3e8c4a){return{'model':db[_0x3e8c4a['model']],'as':_0x3e8c4a['as'],'attributes':_0x3e8c4a[_0xf96c('0x19')],'include':_0x3e8c4a['include']?_[_0xf96c('0x1c')](_0x3e8c4a[_0xf96c('0x1b')],function(_0x14d338){return{'model':db[_0x14d338[_0xf96c('0x1d')]],'as':_0x14d338['as'],'attributes':_0x14d338[_0xf96c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x93da29){logger['info'](_0xf96c('0x1f'),_0x2200c6);logger[_0xf96c('0xc')](_0xf96c('0x1f'),_0x2200c6,JSON['stringify'](_0x93da29));_0x274bb2(_0x93da29);})[_0xf96c('0x12')](function(_0x3dd9ea){logger[_0xf96c('0x10')](_0xf96c('0x1f'),_0x3dd9ea['message'],_0x2200c6);_0x13a000(_0x4c43a9[_0xf96c('0x10')](0x1f4,_0x3dd9ea[_0xf96c('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index f15665c..883d3ed 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 _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x22560d,_0x4a7cb9){var _0x4118be=function(_0x120091){while(--_0x120091){_0x22560d['push'](_0x22560d['shift']());}};_0x4118be(++_0x4a7cb9);}(_0xadb5,0xad));var _0x5adb=function(_0x56fa55,_0x15a9f5){_0x56fa55=_0x56fa55-0x0;var _0x9ca638=_0xadb5[_0x56fa55];return _0x9ca638;};'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('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file +var _0xadb5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','delete','destroy','exports','util','connect-timeout','express'];(function(_0x789e76,_0xb5ac06){var _0x34521f=function(_0x5bbef4){while(--_0x5bbef4){_0x789e76['push'](_0x789e76['shift']());}};_0x34521f(++_0xb5ac06);}(_0xadb5,0xad));var _0x5adb=function(_0x1d4c75,_0x427e70){_0x1d4c75=_0x1d4c75-0x0;var _0x280e29=_0xadb5[_0x1d4c75];return _0x280e29;};'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('./intSalesforceConfiguration.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0x7')](_0x5adb('0xe'),auth[_0x5adb('0x8')](),controller['getSubjects']);router['get'](_0x5adb('0xf'),auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router['post']('/',auth[_0x5adb('0x8')](),controller['create']);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x12')]);router[_0x5adb('0x13')]('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x14')]);module[_0x5adb('0x15')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 3c1e0fd..516277c 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 _0x030d=['contact','sequelize','exports','STRING','Task','Case','lead','account_contact_lead','account','contact_lead','ENUM','nothing'];(function(_0x12d951,_0x249808){var _0x44de17=function(_0x182fd9){while(--_0x182fd9){_0x12d951['push'](_0x12d951['shift']());}};_0x44de17(++_0x249808);}(_0x030d,0x1c9));var _0xd030=function(_0x1b5639,_0x2475dc){_0x1b5639=_0x1b5639-0x0;var _0x3f6bcf=_0x030d[_0x1b5639];return _0x3f6bcf;};'use strict';var Sequelize=require(_0xd030('0x0'));module[_0xd030('0x1')]={'name':{'type':Sequelize[_0xd030('0x2')]},'description':{'type':Sequelize[_0xd030('0x2')]},'ticketType':{'type':Sequelize['ENUM'](_0xd030('0x3'),_0xd030('0x4')),'defaultValue':_0xd030('0x3')},'moduleSearch':{'type':Sequelize['ENUM']('contact_lead','contact',_0xd030('0x5'),_0xd030('0x6'),_0xd030('0x7')),'defaultValue':_0xd030('0x8')},'moduleCreate':{'type':Sequelize[_0xd030('0x9')](_0xd030('0xa'),_0xd030('0xb'),_0xd030('0x5'),_0xd030('0x7')),'defaultValue':_0xd030('0x5')},'leadId':{'type':Sequelize['STRING']},'additionalSearchAccount':{'type':Sequelize[_0xd030('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xd030('0x2')]},'additionalSearchLead':{'type':Sequelize[_0xd030('0x2')]}}; \ No newline at end of file +var _0x8088=['ENUM','Task','Case','contact_lead','contact','lead','account_contact_lead','account','nothing','sequelize','exports','STRING'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x8088,0x8d));var _0x8808=function(_0x383df8,_0x4cfbeb){_0x383df8=_0x383df8-0x0;var _0x44ee06=_0x8088[_0x383df8];return _0x44ee06;};'use strict';var Sequelize=require(_0x8808('0x0'));module[_0x8808('0x1')]={'name':{'type':Sequelize[_0x8808('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x8808('0x3')](_0x8808('0x4'),_0x8808('0x5')),'defaultValue':'Task'},'moduleSearch':{'type':Sequelize['ENUM'](_0x8808('0x6'),_0x8808('0x7'),_0x8808('0x8'),_0x8808('0x9'),_0x8808('0xa')),'defaultValue':_0x8808('0x6')},'moduleCreate':{'type':Sequelize[_0x8808('0x3')](_0x8808('0xb'),_0x8808('0x7'),_0x8808('0x8'),_0x8808('0xa')),'defaultValue':_0x8808('0x8')},'leadId':{'type':Sequelize[_0x8808('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x8808('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x8808('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x8808('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 320ffae..b1cb5f3 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 _0x9335=['body','destroy','SalesforceField','order','getFields','length','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','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','../../mysqldb','sendStatus','end','status','offset','undefined','count','limit','set','Content-Range','json','save','error','name','send','map','SalesforceConfiguration','type','key','query','keys','filters','model','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','VIRTUAL','merge','include','findAll','then','rows','show','params','rawAttributes','includeAll','options','find','create','catch','update'];(function(_0x19d501,_0x364820){var _0x293e33=function(_0x2b4985){while(--_0x2b4985){_0x19d501['push'](_0x19d501['shift']());}};_0x293e33(++_0x364820);}(_0x9335,0xab));var _0x5933=function(_0x201946,_0x5a68ce){_0x201946=_0x201946-0x0;var _0xf328f4=_0x9335[_0x201946];return _0xf328f4;};'use strict';var emlformat=require(_0x5933('0x0'));var rimraf=require(_0x5933('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5933('0x2'));var rp=require(_0x5933('0x3'));var moment=require(_0x5933('0x4'));var BPromise=require(_0x5933('0x5'));var Mustache=require(_0x5933('0x6'));var util=require(_0x5933('0x7'));var path=require(_0x5933('0x8'));var sox=require('sox');var csv=require(_0x5933('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5933('0xa'));var squel=require(_0x5933('0xb'));var crypto=require(_0x5933('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x5933('0xd'));var toCsv=require(_0x5933('0x9'));var querystring=require(_0x5933('0xe'));var Papa=require(_0x5933('0xf'));var Redis=require(_0x5933('0x10'));var authService=require(_0x5933('0x11'));var qs=require(_0x5933('0x12'));var as=require(_0x5933('0x13'));var hardwareService=require(_0x5933('0x14'));var logger=require(_0x5933('0x15'))(_0x5933('0x16'));var utils=require(_0x5933('0x17'));var config=require(_0x5933('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x5933('0x19'))['db'];function respondWithStatusCode(_0x5af679,_0x8b6bad){_0x8b6bad=_0x8b6bad||0xcc;return function(_0x1b4428){if(_0x1b4428){return _0x5af679[_0x5933('0x1a')](_0x8b6bad);}return _0x5af679['status'](_0x8b6bad)[_0x5933('0x1b')]();};}function respondWithResult(_0x542448,_0x1ab3d0){_0x1ab3d0=_0x1ab3d0||0xc8;return function(_0x4fc51d){if(_0x4fc51d){return _0x542448[_0x5933('0x1c')](_0x1ab3d0)['json'](_0x4fc51d);}};}function respondWithFilteredResult(_0xf6321f,_0x5e91da){return function(_0x404555){if(_0x404555){var _0x34c035=typeof _0x5e91da[_0x5933('0x1d')]==='undefined'&&typeof _0x5e91da['limit']===_0x5933('0x1e');var _0x2a2532=_0x404555[_0x5933('0x1f')];var _0x51a525=_0x34c035?0x0:_0x5e91da['offset'];var _0x15263f=_0x34c035?_0x404555['count']:_0x5e91da[_0x5933('0x1d')]+_0x5e91da[_0x5933('0x20')];var _0x21b1d7;if(_0x15263f>=_0x2a2532){_0x15263f=_0x2a2532;_0x21b1d7=0xc8;}else{_0x21b1d7=0xce;}_0xf6321f['status'](_0x21b1d7);return _0xf6321f[_0x5933('0x21')](_0x5933('0x22'),_0x51a525+'-'+_0x15263f+'/'+_0x2a2532)[_0x5933('0x23')](_0x404555);}return null;};}function patchUpdates(_0x4d661c){return function(_0x59a2cd){try{jsonpatch['apply'](_0x59a2cd,_0x4d661c,!![]);}catch(_0x36d602){return BPromise['reject'](_0x36d602);}return _0x59a2cd[_0x5933('0x24')]();};}function saveUpdates(_0x4a5252,_0x2d0fb7){return function(_0x50026f){if(_0x50026f){return _0x50026f['update'](_0x4a5252)['then'](function(_0x4a1901){return _0x4a1901;});}return null;};}function removeEntity(_0x3d70ef,_0x5639c7){return function(_0x1a2f5d){if(_0x1a2f5d){return _0x1a2f5d['destroy']()['then'](function(){_0x3d70ef[_0x5933('0x1c')](0xcc)[_0x5933('0x1b')]();});}};}function handleEntityNotFound(_0x297b15,_0x56e8a9){return function(_0xd2320){if(!_0xd2320){_0x297b15[_0x5933('0x1a')](0x194);}return _0xd2320;};}function handleError(_0x2348bc,_0x5a0de4){_0x5a0de4=_0x5a0de4||0x1f4;return function(_0x1e24f6){logger[_0x5933('0x25')](_0x1e24f6['stack']);if(_0x1e24f6[_0x5933('0x26')]){delete _0x1e24f6[_0x5933('0x26')];}_0x2348bc['status'](_0x5a0de4)[_0x5933('0x27')](_0x1e24f6);};}exports['index']=function(_0x51dbae,_0x45039b){var _0x1af598={},_0x4adb80={},_0x255ed5={'count':0x0,'rows':[]};var _0x51e2d6=_[_0x5933('0x28')](db[_0x5933('0x29')]['rawAttributes'],function(_0x4fc086){return{'name':_0x4fc086['fieldName'],'type':_0x4fc086[_0x5933('0x2a')][_0x5933('0x2b')]};});_0x4adb80['model']=_[_0x5933('0x28')](_0x51e2d6,_0x5933('0x26'));_0x4adb80[_0x5933('0x2c')]=_[_0x5933('0x2d')](_0x51dbae['query']);_0x4adb80[_0x5933('0x2e')]=_['intersection'](_0x4adb80[_0x5933('0x2f')],_0x4adb80['query']);_0x1af598[_0x5933('0x30')]=_[_0x5933('0x31')](_0x4adb80[_0x5933('0x2f')],qs[_0x5933('0x32')](_0x51dbae['query'][_0x5933('0x32')]));_0x1af598[_0x5933('0x30')]=_0x1af598['attributes']['length']?_0x1af598[_0x5933('0x30')]:_0x4adb80['model'];if(!_0x51dbae['query'][_0x5933('0x33')](_0x5933('0x34'))){_0x1af598[_0x5933('0x20')]=qs[_0x5933('0x20')](_0x51dbae['query']['limit']);_0x1af598['offset']=qs['offset'](_0x51dbae[_0x5933('0x2c')]['offset']);}_0x1af598['order']=qs['sort'](_0x51dbae[_0x5933('0x2c')][_0x5933('0x35')]);_0x1af598[_0x5933('0x36')]=qs[_0x5933('0x2e')](_[_0x5933('0x37')](_0x51dbae[_0x5933('0x2c')],_0x4adb80[_0x5933('0x2e')]),_0x51e2d6);if(_0x51dbae[_0x5933('0x2c')][_0x5933('0x38')]){_0x1af598[_0x5933('0x36')]=_['merge'](_0x1af598[_0x5933('0x36')],{'$or':_[_0x5933('0x28')](_0x51e2d6,function(_0x6e2a66){if(_0x6e2a66[_0x5933('0x2a')]!==_0x5933('0x39')){var _0x2c1484={};_0x2c1484[_0x6e2a66[_0x5933('0x26')]]={'$like':'%'+_0x51dbae[_0x5933('0x2c')][_0x5933('0x38')]+'%'};return _0x2c1484;}})});}_0x1af598=_[_0x5933('0x3a')]({},_0x1af598,_0x51dbae['options']);var _0x5c2bd0={'where':_0x1af598[_0x5933('0x36')]};return db[_0x5933('0x29')][_0x5933('0x1f')](_0x5c2bd0)['then'](function(_0x5d07da){_0x255ed5[_0x5933('0x1f')]=_0x5d07da;if(_0x51dbae[_0x5933('0x2c')]['includeAll']){_0x1af598[_0x5933('0x3b')]=[{'all':!![]}];}return db[_0x5933('0x29')][_0x5933('0x3c')](_0x1af598);})[_0x5933('0x3d')](function(_0x192576){_0x255ed5[_0x5933('0x3e')]=_0x192576;return _0x255ed5;})['then'](respondWithFilteredResult(_0x45039b,_0x1af598))['catch'](handleError(_0x45039b,null));};exports[_0x5933('0x3f')]=function(_0x1aef52,_0x36d072){var _0x293845={'raw':![],'where':{'id':_0x1aef52[_0x5933('0x40')]['id']}},_0x247c65={};_0x247c65['model']=_[_0x5933('0x2d')](db[_0x5933('0x29')][_0x5933('0x41')]);_0x247c65['query']=_[_0x5933('0x2d')](_0x1aef52[_0x5933('0x2c')]);_0x247c65[_0x5933('0x2e')]=_[_0x5933('0x31')](_0x247c65[_0x5933('0x2f')],_0x247c65[_0x5933('0x2c')]);_0x293845[_0x5933('0x30')]=_[_0x5933('0x31')](_0x247c65[_0x5933('0x2f')],qs[_0x5933('0x32')](_0x1aef52['query'][_0x5933('0x32')]));_0x293845['attributes']=_0x293845['attributes']['length']?_0x293845[_0x5933('0x30')]:_0x247c65['model'];if(_0x1aef52['query'][_0x5933('0x42')]){_0x293845[_0x5933('0x3b')]=[{'all':!![]}];}_0x293845=_['merge']({},_0x293845,_0x1aef52[_0x5933('0x43')]);return db['SalesforceConfiguration'][_0x5933('0x44')](_0x293845)[_0x5933('0x3d')](handleEntityNotFound(_0x36d072,null))['then'](respondWithResult(_0x36d072,null))['catch'](handleError(_0x36d072,null));};exports[_0x5933('0x45')]=function(_0x4622bd,_0x38e713){return db[_0x5933('0x29')][_0x5933('0x45')](_0x4622bd['body'],{})[_0x5933('0x3d')](respondWithResult(_0x38e713,0xc9))[_0x5933('0x46')](handleError(_0x38e713,null));};exports[_0x5933('0x47')]=function(_0x4c2e69,_0x2d5fd4){if(_0x4c2e69[_0x5933('0x48')]['id']){delete _0x4c2e69[_0x5933('0x48')]['id'];}return db[_0x5933('0x29')]['find']({'where':{'id':_0x4c2e69[_0x5933('0x40')]['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x2d5fd4,null))[_0x5933('0x3d')](saveUpdates(_0x4c2e69[_0x5933('0x48')],null))['then'](respondWithResult(_0x2d5fd4,null))[_0x5933('0x46')](handleError(_0x2d5fd4,null));};exports[_0x5933('0x49')]=function(_0x41be67,_0x38f681){return db[_0x5933('0x29')][_0x5933('0x44')]({'where':{'id':_0x41be67[_0x5933('0x40')]['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x38f681,null))[_0x5933('0x3d')](removeEntity(_0x38f681,null))[_0x5933('0x46')](handleError(_0x38f681,null));};exports['getFields']=function(_0x3fdd78,_0x4d0bb8,_0x38ceb0){var _0x5d4a4c={};var _0x2e1ee9={};var _0x5e1029;var _0x1aabbc;return db[_0x5933('0x29')]['findOne']({'where':{'id':_0x3fdd78[_0x5933('0x40')]['id']}})['then'](handleEntityNotFound(_0x4d0bb8,null))[_0x5933('0x3d')](function(_0x22313e){if(_0x22313e){_0x5e1029=_0x22313e;_0x2e1ee9[_0x5933('0x2f')]=_[_0x5933('0x2d')](db[_0x5933('0x4a')][_0x5933('0x41')]);_0x2e1ee9['query']=_[_0x5933('0x2d')](_0x3fdd78[_0x5933('0x2c')]);_0x2e1ee9[_0x5933('0x2e')]=_['intersection'](_0x2e1ee9[_0x5933('0x2f')],_0x2e1ee9['query']);_0x5d4a4c[_0x5933('0x30')]=_['intersection'](_0x2e1ee9[_0x5933('0x2f')],qs[_0x5933('0x32')](_0x3fdd78[_0x5933('0x2c')][_0x5933('0x32')]));_0x5d4a4c['attributes']=_0x5d4a4c['attributes']['length']?_0x5d4a4c[_0x5933('0x30')]:_0x2e1ee9[_0x5933('0x2f')];_0x5d4a4c[_0x5933('0x4b')]=qs[_0x5933('0x35')](_0x3fdd78[_0x5933('0x2c')][_0x5933('0x35')]);_0x5d4a4c['where']=qs['filters'](_[_0x5933('0x37')](_0x3fdd78[_0x5933('0x2c')],_0x2e1ee9[_0x5933('0x2e')]));if(_0x3fdd78['query'][_0x5933('0x38')]){_0x5d4a4c[_0x5933('0x36')]=_[_0x5933('0x3a')](_0x5d4a4c[_0x5933('0x36')],{'$or':_[_0x5933('0x28')](_0x5d4a4c[_0x5933('0x30')],function(_0x2d0154){var _0x377d24={};_0x377d24[_0x2d0154]={'$like':'%'+_0x3fdd78[_0x5933('0x2c')][_0x5933('0x38')]+'%'};return _0x377d24;})});}_0x5d4a4c=_[_0x5933('0x3a')]({},_0x5d4a4c,_0x3fdd78[_0x5933('0x43')]);return _0x5e1029[_0x5933('0x4c')](_0x5d4a4c);}})['then'](function(_0x374c60){if(_0x374c60){_0x1aabbc=_0x374c60[_0x5933('0x4d')];if(!_0x3fdd78[_0x5933('0x2c')][_0x5933('0x33')](_0x5933('0x34'))){_0x5d4a4c[_0x5933('0x20')]=qs[_0x5933('0x20')](_0x3fdd78[_0x5933('0x2c')][_0x5933('0x20')]);_0x5d4a4c[_0x5933('0x1d')]=qs[_0x5933('0x1d')](_0x3fdd78[_0x5933('0x2c')][_0x5933('0x1d')]);}return _0x5e1029[_0x5933('0x4c')](_0x5d4a4c);}})[_0x5933('0x3d')](function(_0x104b72){if(_0x104b72){return _0x104b72?{'count':_0x1aabbc,'rows':_0x104b72}:null;}})['then'](respondWithResult(_0x4d0bb8,null))['catch'](handleError(_0x4d0bb8,null));};exports[_0x5933('0x4e')]=function(_0x36a7d0,_0x43998c,_0x1852df){var _0x23b6b9={};var _0x3e8896={};var _0x2f7c29;var _0x457b3b;return db[_0x5933('0x29')]['findOne']({'where':{'id':_0x36a7d0['params']['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x43998c,null))['then'](function(_0x19ad2a){if(_0x19ad2a){_0x2f7c29=_0x19ad2a;_0x3e8896['model']=_['keys'](db[_0x5933('0x4a')]['rawAttributes']);_0x3e8896['query']=_[_0x5933('0x2d')](_0x36a7d0[_0x5933('0x2c')]);_0x3e8896[_0x5933('0x2e')]=_[_0x5933('0x31')](_0x3e8896[_0x5933('0x2f')],_0x3e8896['query']);_0x23b6b9[_0x5933('0x30')]=_['intersection'](_0x3e8896[_0x5933('0x2f')],qs[_0x5933('0x32')](_0x36a7d0[_0x5933('0x2c')][_0x5933('0x32')]));_0x23b6b9[_0x5933('0x30')]=_0x23b6b9[_0x5933('0x30')][_0x5933('0x4d')]?_0x23b6b9[_0x5933('0x30')]:_0x3e8896[_0x5933('0x2f')];_0x23b6b9[_0x5933('0x4b')]=qs[_0x5933('0x35')](_0x36a7d0[_0x5933('0x2c')]['sort']);_0x23b6b9[_0x5933('0x36')]=qs[_0x5933('0x2e')](_[_0x5933('0x37')](_0x36a7d0['query'],_0x3e8896['filters']));if(_0x36a7d0[_0x5933('0x2c')][_0x5933('0x38')]){_0x23b6b9[_0x5933('0x36')]=_[_0x5933('0x3a')](_0x23b6b9[_0x5933('0x36')],{'$or':_[_0x5933('0x28')](_0x23b6b9[_0x5933('0x30')],function(_0x5a0a84){var _0x3502d0={};_0x3502d0[_0x5a0a84]={'$like':'%'+_0x36a7d0[_0x5933('0x2c')]['filter']+'%'};return _0x3502d0;})});}_0x23b6b9=_[_0x5933('0x3a')]({},_0x23b6b9,_0x36a7d0[_0x5933('0x43')]);return _0x2f7c29[_0x5933('0x4e')](_0x23b6b9);}})[_0x5933('0x3d')](function(_0x46ac1b){if(_0x46ac1b){_0x457b3b=_0x46ac1b[_0x5933('0x4d')];if(!_0x36a7d0[_0x5933('0x2c')][_0x5933('0x33')](_0x5933('0x34'))){_0x23b6b9['limit']=qs['limit'](_0x36a7d0['query']['limit']);_0x23b6b9[_0x5933('0x1d')]=qs[_0x5933('0x1d')](_0x36a7d0['query']['offset']);}return _0x2f7c29[_0x5933('0x4e')](_0x23b6b9);}})['then'](function(_0x1ab96c){if(_0x1ab96c){return _0x1ab96c?{'count':_0x457b3b,'rows':_0x1ab96c}:null;}})[_0x5933('0x3d')](respondWithResult(_0x43998c,null))[_0x5933('0x46')](handleError(_0x43998c,null));};exports['getDescriptions']=function(_0x35195f,_0x529b4b,_0xc0bef8){var _0xc52c42={};var _0x577129={};var _0x2849e0;var _0x3e64ba;return db[_0x5933('0x29')][_0x5933('0x4f')]({'where':{'id':_0x35195f['params']['id']}})[_0x5933('0x3d')](handleEntityNotFound(_0x529b4b,null))[_0x5933('0x3d')](function(_0x49138d){if(_0x49138d){_0x2849e0=_0x49138d;_0x577129[_0x5933('0x2f')]=_[_0x5933('0x2d')](db['SalesforceField']['rawAttributes']);_0x577129['query']=_[_0x5933('0x2d')](_0x35195f['query']);_0x577129[_0x5933('0x2e')]=_['intersection'](_0x577129[_0x5933('0x2f')],_0x577129[_0x5933('0x2c')]);_0xc52c42[_0x5933('0x30')]=_[_0x5933('0x31')](_0x577129['model'],qs[_0x5933('0x32')](_0x35195f[_0x5933('0x2c')][_0x5933('0x32')]));_0xc52c42[_0x5933('0x30')]=_0xc52c42[_0x5933('0x30')][_0x5933('0x4d')]?_0xc52c42['attributes']:_0x577129[_0x5933('0x2f')];_0xc52c42['order']=qs[_0x5933('0x35')](_0x35195f[_0x5933('0x2c')][_0x5933('0x35')]);_0xc52c42[_0x5933('0x36')]=qs[_0x5933('0x2e')](_[_0x5933('0x37')](_0x35195f['query'],_0x577129[_0x5933('0x2e')]));if(_0x35195f[_0x5933('0x2c')][_0x5933('0x38')]){_0xc52c42[_0x5933('0x36')]=_[_0x5933('0x3a')](_0xc52c42[_0x5933('0x36')],{'$or':_[_0x5933('0x28')](_0xc52c42[_0x5933('0x30')],function(_0x119ee8){var _0x242b61={};_0x242b61[_0x119ee8]={'$like':'%'+_0x35195f[_0x5933('0x2c')][_0x5933('0x38')]+'%'};return _0x242b61;})});}_0xc52c42=_[_0x5933('0x3a')]({},_0xc52c42,_0x35195f[_0x5933('0x43')]);return _0x2849e0[_0x5933('0x50')](_0xc52c42);}})[_0x5933('0x3d')](function(_0x22d503){if(_0x22d503){_0x3e64ba=_0x22d503[_0x5933('0x4d')];if(!_0x35195f[_0x5933('0x2c')]['hasOwnProperty']('nolimit')){_0xc52c42[_0x5933('0x20')]=qs[_0x5933('0x20')](_0x35195f[_0x5933('0x2c')][_0x5933('0x20')]);_0xc52c42[_0x5933('0x1d')]=qs[_0x5933('0x1d')](_0x35195f[_0x5933('0x2c')][_0x5933('0x1d')]);}return _0x2849e0['getDescriptions'](_0xc52c42);}})['then'](function(_0x47b7b4){if(_0x47b7b4){return _0x47b7b4?{'count':_0x3e64ba,'rows':_0x47b7b4}:null;}})['then'](respondWithResult(_0x529b4b,null))[_0x5933('0x46')](handleError(_0x529b4b,null));}; \ No newline at end of file +var _0x95bb=['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','end','json','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','map','SalesforceConfiguration','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','include','findAll','rows','show','options','find','catch','create','body','getFields','params','getSubjects','findOne','SalesforceField','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0x394018,_0x1d1cb1){var _0x104d06=function(_0x17543c){while(--_0x17543c){_0x394018['push'](_0x394018['shift']());}};_0x104d06(++_0x1d1cb1);}(_0x95bb,0xed));var _0xb95b=function(_0x25ef17,_0x1530f7){_0x25ef17=_0x25ef17-0x0;var _0x6472f7=_0x95bb[_0x25ef17];return _0x6472f7;};'use strict';var emlformat=require(_0xb95b('0x0'));var rimraf=require(_0xb95b('0x1'));var zipdir=require(_0xb95b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb95b('0x3'));var moment=require(_0xb95b('0x4'));var BPromise=require(_0xb95b('0x5'));var Mustache=require(_0xb95b('0x6'));var util=require('util');var path=require(_0xb95b('0x7'));var sox=require(_0xb95b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb95b('0x9'));var _=require(_0xb95b('0xa'));var squel=require(_0xb95b('0xb'));var crypto=require(_0xb95b('0xc'));var jsforce=require(_0xb95b('0xd'));var deskjs=require(_0xb95b('0xe'));var toCsv=require('to-csv');var querystring=require(_0xb95b('0xf'));var Papa=require(_0xb95b('0x10'));var Redis=require('ioredis');var authService=require(_0xb95b('0x11'));var qs=require(_0xb95b('0x12'));var as=require(_0xb95b('0x13'));var hardwareService=require(_0xb95b('0x14'));var logger=require(_0xb95b('0x15'))('api');var utils=require(_0xb95b('0x16'));var config=require(_0xb95b('0x17'));var licenseUtil=require(_0xb95b('0x18'));var db=require(_0xb95b('0x19'))['db'];function respondWithStatusCode(_0x59d95c,_0x37f087){_0x37f087=_0x37f087||0xcc;return function(_0x4c3926){if(_0x4c3926){return _0x59d95c[_0xb95b('0x1a')](_0x37f087);}return _0x59d95c[_0xb95b('0x1b')](_0x37f087)[_0xb95b('0x1c')]();};}function respondWithResult(_0x16fd9f,_0x405a98){_0x405a98=_0x405a98||0xc8;return function(_0x50e4a2){if(_0x50e4a2){return _0x16fd9f[_0xb95b('0x1b')](_0x405a98)[_0xb95b('0x1d')](_0x50e4a2);}};}function respondWithFilteredResult(_0x2bc3de,_0x4e365f){return function(_0x142f23){if(_0x142f23){var _0x5254da=typeof _0x4e365f['offset']===_0xb95b('0x1e')&&typeof _0x4e365f[_0xb95b('0x1f')]===_0xb95b('0x1e');var _0xa7ff6=_0x142f23['count'];var _0x36918d=_0x5254da?0x0:_0x4e365f['offset'];var _0x45dbdc=_0x5254da?_0x142f23[_0xb95b('0x20')]:_0x4e365f['offset']+_0x4e365f[_0xb95b('0x1f')];var _0x4f5aac;if(_0x45dbdc>=_0xa7ff6){_0x45dbdc=_0xa7ff6;_0x4f5aac=0xc8;}else{_0x4f5aac=0xce;}_0x2bc3de[_0xb95b('0x1b')](_0x4f5aac);return _0x2bc3de['set'](_0xb95b('0x21'),_0x36918d+'-'+_0x45dbdc+'/'+_0xa7ff6)[_0xb95b('0x1d')](_0x142f23);}return null;};}function patchUpdates(_0x2f7632){return function(_0x14a7a3){try{jsonpatch[_0xb95b('0x22')](_0x14a7a3,_0x2f7632,!![]);}catch(_0x11dfef){return BPromise[_0xb95b('0x23')](_0x11dfef);}return _0x14a7a3[_0xb95b('0x24')]();};}function saveUpdates(_0x2eb42f,_0x503235){return function(_0x16f5c6){if(_0x16f5c6){return _0x16f5c6[_0xb95b('0x25')](_0x2eb42f)[_0xb95b('0x26')](function(_0x10a5ef){return _0x10a5ef;});}return null;};}function removeEntity(_0x53b44c,_0x5ab585){return function(_0x78795){if(_0x78795){return _0x78795[_0xb95b('0x27')]()[_0xb95b('0x26')](function(){_0x53b44c[_0xb95b('0x1b')](0xcc)[_0xb95b('0x1c')]();});}};}function handleEntityNotFound(_0x329318,_0x3869a0){return function(_0x108f17){if(!_0x108f17){_0x329318[_0xb95b('0x1a')](0x194);}return _0x108f17;};}function handleError(_0x38b5b4,_0x4d14f0){_0x4d14f0=_0x4d14f0||0x1f4;return function(_0x5aac19){logger[_0xb95b('0x28')](_0x5aac19['stack']);if(_0x5aac19[_0xb95b('0x29')]){delete _0x5aac19[_0xb95b('0x29')];}_0x38b5b4[_0xb95b('0x1b')](_0x4d14f0)[_0xb95b('0x2a')](_0x5aac19);};}exports[_0xb95b('0x2b')]=function(_0x4bc66c,_0x1ce409){var _0xa0ec19={},_0x9b9159={},_0x5f3510={'count':0x0,'rows':[]};var _0x386c7e=_[_0xb95b('0x2c')](db[_0xb95b('0x2d')][_0xb95b('0x2e')],function(_0x563088){return{'name':_0x563088[_0xb95b('0x2f')],'type':_0x563088['type'][_0xb95b('0x30')]};});_0x9b9159[_0xb95b('0x31')]=_[_0xb95b('0x2c')](_0x386c7e,_0xb95b('0x29'));_0x9b9159[_0xb95b('0x32')]=_[_0xb95b('0x33')](_0x4bc66c[_0xb95b('0x32')]);_0x9b9159[_0xb95b('0x34')]=_[_0xb95b('0x35')](_0x9b9159[_0xb95b('0x31')],_0x9b9159[_0xb95b('0x32')]);_0xa0ec19[_0xb95b('0x36')]=_[_0xb95b('0x35')](_0x9b9159[_0xb95b('0x31')],qs[_0xb95b('0x37')](_0x4bc66c[_0xb95b('0x32')][_0xb95b('0x37')]));_0xa0ec19[_0xb95b('0x36')]=_0xa0ec19[_0xb95b('0x36')][_0xb95b('0x38')]?_0xa0ec19[_0xb95b('0x36')]:_0x9b9159[_0xb95b('0x31')];if(!_0x4bc66c[_0xb95b('0x32')][_0xb95b('0x39')](_0xb95b('0x3a'))){_0xa0ec19[_0xb95b('0x1f')]=qs[_0xb95b('0x1f')](_0x4bc66c[_0xb95b('0x32')][_0xb95b('0x1f')]);_0xa0ec19[_0xb95b('0x3b')]=qs[_0xb95b('0x3b')](_0x4bc66c['query'][_0xb95b('0x3b')]);}_0xa0ec19[_0xb95b('0x3c')]=qs[_0xb95b('0x3d')](_0x4bc66c[_0xb95b('0x32')][_0xb95b('0x3d')]);_0xa0ec19[_0xb95b('0x3e')]=qs[_0xb95b('0x34')](_[_0xb95b('0x3f')](_0x4bc66c[_0xb95b('0x32')],_0x9b9159['filters']),_0x386c7e);if(_0x4bc66c[_0xb95b('0x32')][_0xb95b('0x40')]){_0xa0ec19['where']=_[_0xb95b('0x41')](_0xa0ec19[_0xb95b('0x3e')],{'$or':_[_0xb95b('0x2c')](_0x386c7e,function(_0x10c51e){if(_0x10c51e[_0xb95b('0x42')]!==_0xb95b('0x43')){var _0x48a47d={};_0x48a47d[_0x10c51e[_0xb95b('0x29')]]={'$like':'%'+_0x4bc66c['query'][_0xb95b('0x40')]+'%'};return _0x48a47d;}})});}_0xa0ec19=_['merge']({},_0xa0ec19,_0x4bc66c['options']);var _0x5ea184={'where':_0xa0ec19[_0xb95b('0x3e')]};return db[_0xb95b('0x2d')][_0xb95b('0x20')](_0x5ea184)['then'](function(_0x419d28){_0x5f3510['count']=_0x419d28;if(_0x4bc66c[_0xb95b('0x32')][_0xb95b('0x44')]){_0xa0ec19[_0xb95b('0x45')]=[{'all':!![]}];}return db['SalesforceConfiguration'][_0xb95b('0x46')](_0xa0ec19);})[_0xb95b('0x26')](function(_0x1f9a9d){_0x5f3510[_0xb95b('0x47')]=_0x1f9a9d;return _0x5f3510;})[_0xb95b('0x26')](respondWithFilteredResult(_0x1ce409,_0xa0ec19))['catch'](handleError(_0x1ce409,null));};exports[_0xb95b('0x48')]=function(_0x4163f2,_0x58f3b5){var _0x183615={'raw':![],'where':{'id':_0x4163f2['params']['id']}},_0x54f71e={};_0x54f71e[_0xb95b('0x31')]=_[_0xb95b('0x33')](db[_0xb95b('0x2d')]['rawAttributes']);_0x54f71e['query']=_['keys'](_0x4163f2[_0xb95b('0x32')]);_0x54f71e[_0xb95b('0x34')]=_['intersection'](_0x54f71e[_0xb95b('0x31')],_0x54f71e[_0xb95b('0x32')]);_0x183615['attributes']=_[_0xb95b('0x35')](_0x54f71e[_0xb95b('0x31')],qs[_0xb95b('0x37')](_0x4163f2['query']['fields']));_0x183615[_0xb95b('0x36')]=_0x183615[_0xb95b('0x36')]['length']?_0x183615[_0xb95b('0x36')]:_0x54f71e[_0xb95b('0x31')];if(_0x4163f2['query'][_0xb95b('0x44')]){_0x183615[_0xb95b('0x45')]=[{'all':!![]}];}_0x183615=_[_0xb95b('0x41')]({},_0x183615,_0x4163f2[_0xb95b('0x49')]);return db[_0xb95b('0x2d')][_0xb95b('0x4a')](_0x183615)['then'](handleEntityNotFound(_0x58f3b5,null))[_0xb95b('0x26')](respondWithResult(_0x58f3b5,null))[_0xb95b('0x4b')](handleError(_0x58f3b5,null));};exports[_0xb95b('0x4c')]=function(_0x2d8f3b,_0x13ca15){return db[_0xb95b('0x2d')][_0xb95b('0x4c')](_0x2d8f3b[_0xb95b('0x4d')],{})['then'](respondWithResult(_0x13ca15,0xc9))[_0xb95b('0x4b')](handleError(_0x13ca15,null));};exports[_0xb95b('0x25')]=function(_0x263ed1,_0x5ce3fe){if(_0x263ed1['body']['id']){delete _0x263ed1[_0xb95b('0x4d')]['id'];}return db[_0xb95b('0x2d')]['find']({'where':{'id':_0x263ed1['params']['id']}})[_0xb95b('0x26')](handleEntityNotFound(_0x5ce3fe,null))['then'](saveUpdates(_0x263ed1[_0xb95b('0x4d')],null))[_0xb95b('0x26')](respondWithResult(_0x5ce3fe,null))[_0xb95b('0x4b')](handleError(_0x5ce3fe,null));};exports[_0xb95b('0x27')]=function(_0x5234f9,_0x194cc4){return db[_0xb95b('0x2d')][_0xb95b('0x4a')]({'where':{'id':_0x5234f9['params']['id']}})[_0xb95b('0x26')](handleEntityNotFound(_0x194cc4,null))[_0xb95b('0x26')](removeEntity(_0x194cc4,null))['catch'](handleError(_0x194cc4,null));};exports[_0xb95b('0x4e')]=function(_0x140f16,_0x72c6a8,_0x2c1b5e){var _0x40c84a={};var _0x5e7311={};var _0x290c3e;var _0x2669e0;return db[_0xb95b('0x2d')]['findOne']({'where':{'id':_0x140f16[_0xb95b('0x4f')]['id']}})[_0xb95b('0x26')](handleEntityNotFound(_0x72c6a8,null))[_0xb95b('0x26')](function(_0x2c65f3){if(_0x2c65f3){_0x290c3e=_0x2c65f3;_0x5e7311[_0xb95b('0x31')]=_[_0xb95b('0x33')](db['SalesforceField'][_0xb95b('0x2e')]);_0x5e7311['query']=_[_0xb95b('0x33')](_0x140f16[_0xb95b('0x32')]);_0x5e7311[_0xb95b('0x34')]=_[_0xb95b('0x35')](_0x5e7311[_0xb95b('0x31')],_0x5e7311['query']);_0x40c84a[_0xb95b('0x36')]=_[_0xb95b('0x35')](_0x5e7311[_0xb95b('0x31')],qs['fields'](_0x140f16[_0xb95b('0x32')]['fields']));_0x40c84a[_0xb95b('0x36')]=_0x40c84a[_0xb95b('0x36')][_0xb95b('0x38')]?_0x40c84a[_0xb95b('0x36')]:_0x5e7311[_0xb95b('0x31')];_0x40c84a[_0xb95b('0x3c')]=qs[_0xb95b('0x3d')](_0x140f16[_0xb95b('0x32')]['sort']);_0x40c84a[_0xb95b('0x3e')]=qs[_0xb95b('0x34')](_[_0xb95b('0x3f')](_0x140f16['query'],_0x5e7311[_0xb95b('0x34')]));if(_0x140f16[_0xb95b('0x32')][_0xb95b('0x40')]){_0x40c84a['where']=_[_0xb95b('0x41')](_0x40c84a[_0xb95b('0x3e')],{'$or':_[_0xb95b('0x2c')](_0x40c84a['attributes'],function(_0x1fe116){var _0x5a251f={};_0x5a251f[_0x1fe116]={'$like':'%'+_0x140f16[_0xb95b('0x32')][_0xb95b('0x40')]+'%'};return _0x5a251f;})});}_0x40c84a=_[_0xb95b('0x41')]({},_0x40c84a,_0x140f16[_0xb95b('0x49')]);return _0x290c3e[_0xb95b('0x4e')](_0x40c84a);}})[_0xb95b('0x26')](function(_0x3a2a5e){if(_0x3a2a5e){_0x2669e0=_0x3a2a5e[_0xb95b('0x38')];if(!_0x140f16['query'][_0xb95b('0x39')](_0xb95b('0x3a'))){_0x40c84a[_0xb95b('0x1f')]=qs[_0xb95b('0x1f')](_0x140f16[_0xb95b('0x32')][_0xb95b('0x1f')]);_0x40c84a[_0xb95b('0x3b')]=qs[_0xb95b('0x3b')](_0x140f16[_0xb95b('0x32')]['offset']);}return _0x290c3e[_0xb95b('0x4e')](_0x40c84a);}})[_0xb95b('0x26')](function(_0x26b3e9){if(_0x26b3e9){return _0x26b3e9?{'count':_0x2669e0,'rows':_0x26b3e9}:null;}})[_0xb95b('0x26')](respondWithResult(_0x72c6a8,null))[_0xb95b('0x4b')](handleError(_0x72c6a8,null));};exports[_0xb95b('0x50')]=function(_0x54be76,_0x2f28d1,_0x45cc2a){var _0x20239a={};var _0x43de66={};var _0x184206;var _0x4a6098;return db['SalesforceConfiguration'][_0xb95b('0x51')]({'where':{'id':_0x54be76['params']['id']}})['then'](handleEntityNotFound(_0x2f28d1,null))['then'](function(_0x4ad7e1){if(_0x4ad7e1){_0x184206=_0x4ad7e1;_0x43de66[_0xb95b('0x31')]=_['keys'](db[_0xb95b('0x52')][_0xb95b('0x2e')]);_0x43de66[_0xb95b('0x32')]=_[_0xb95b('0x33')](_0x54be76[_0xb95b('0x32')]);_0x43de66[_0xb95b('0x34')]=_['intersection'](_0x43de66['model'],_0x43de66[_0xb95b('0x32')]);_0x20239a[_0xb95b('0x36')]=_[_0xb95b('0x35')](_0x43de66[_0xb95b('0x31')],qs[_0xb95b('0x37')](_0x54be76[_0xb95b('0x32')]['fields']));_0x20239a[_0xb95b('0x36')]=_0x20239a[_0xb95b('0x36')]['length']?_0x20239a[_0xb95b('0x36')]:_0x43de66[_0xb95b('0x31')];_0x20239a[_0xb95b('0x3c')]=qs[_0xb95b('0x3d')](_0x54be76[_0xb95b('0x32')][_0xb95b('0x3d')]);_0x20239a[_0xb95b('0x3e')]=qs[_0xb95b('0x34')](_[_0xb95b('0x3f')](_0x54be76['query'],_0x43de66[_0xb95b('0x34')]));if(_0x54be76[_0xb95b('0x32')][_0xb95b('0x40')]){_0x20239a['where']=_[_0xb95b('0x41')](_0x20239a['where'],{'$or':_['map'](_0x20239a[_0xb95b('0x36')],function(_0x3f8dbf){var _0x3af274={};_0x3af274[_0x3f8dbf]={'$like':'%'+_0x54be76['query'][_0xb95b('0x40')]+'%'};return _0x3af274;})});}_0x20239a=_[_0xb95b('0x41')]({},_0x20239a,_0x54be76['options']);return _0x184206[_0xb95b('0x50')](_0x20239a);}})[_0xb95b('0x26')](function(_0x41479b){if(_0x41479b){_0x4a6098=_0x41479b[_0xb95b('0x38')];if(!_0x54be76[_0xb95b('0x32')][_0xb95b('0x39')](_0xb95b('0x3a'))){_0x20239a[_0xb95b('0x1f')]=qs['limit'](_0x54be76['query'][_0xb95b('0x1f')]);_0x20239a['offset']=qs[_0xb95b('0x3b')](_0x54be76[_0xb95b('0x32')][_0xb95b('0x3b')]);}return _0x184206[_0xb95b('0x50')](_0x20239a);}})['then'](function(_0x2f4100){if(_0x2f4100){return _0x2f4100?{'count':_0x4a6098,'rows':_0x2f4100}:null;}})[_0xb95b('0x26')](respondWithResult(_0x2f28d1,null))[_0xb95b('0x4b')](handleError(_0x2f28d1,null));};exports[_0xb95b('0x53')]=function(_0x538f42,_0xa28b6f,_0x28542e){var _0x46fa0f={};var _0x265217={};var _0x1e2011;var _0xb0c25e;return db[_0xb95b('0x2d')][_0xb95b('0x51')]({'where':{'id':_0x538f42['params']['id']}})[_0xb95b('0x26')](handleEntityNotFound(_0xa28b6f,null))['then'](function(_0x38ae58){if(_0x38ae58){_0x1e2011=_0x38ae58;_0x265217[_0xb95b('0x31')]=_[_0xb95b('0x33')](db['SalesforceField']['rawAttributes']);_0x265217[_0xb95b('0x32')]=_[_0xb95b('0x33')](_0x538f42['query']);_0x265217[_0xb95b('0x34')]=_[_0xb95b('0x35')](_0x265217[_0xb95b('0x31')],_0x265217[_0xb95b('0x32')]);_0x46fa0f['attributes']=_[_0xb95b('0x35')](_0x265217[_0xb95b('0x31')],qs[_0xb95b('0x37')](_0x538f42['query']['fields']));_0x46fa0f[_0xb95b('0x36')]=_0x46fa0f[_0xb95b('0x36')][_0xb95b('0x38')]?_0x46fa0f[_0xb95b('0x36')]:_0x265217[_0xb95b('0x31')];_0x46fa0f['order']=qs[_0xb95b('0x3d')](_0x538f42[_0xb95b('0x32')][_0xb95b('0x3d')]);_0x46fa0f[_0xb95b('0x3e')]=qs[_0xb95b('0x34')](_[_0xb95b('0x3f')](_0x538f42[_0xb95b('0x32')],_0x265217[_0xb95b('0x34')]));if(_0x538f42[_0xb95b('0x32')][_0xb95b('0x40')]){_0x46fa0f[_0xb95b('0x3e')]=_[_0xb95b('0x41')](_0x46fa0f[_0xb95b('0x3e')],{'$or':_['map'](_0x46fa0f['attributes'],function(_0x541871){var _0x14fb31={};_0x14fb31[_0x541871]={'$like':'%'+_0x538f42['query'][_0xb95b('0x40')]+'%'};return _0x14fb31;})});}_0x46fa0f=_[_0xb95b('0x41')]({},_0x46fa0f,_0x538f42[_0xb95b('0x49')]);return _0x1e2011['getDescriptions'](_0x46fa0f);}})[_0xb95b('0x26')](function(_0x133df7){if(_0x133df7){_0xb0c25e=_0x133df7[_0xb95b('0x38')];if(!_0x538f42[_0xb95b('0x32')][_0xb95b('0x39')](_0xb95b('0x3a'))){_0x46fa0f[_0xb95b('0x1f')]=qs[_0xb95b('0x1f')](_0x538f42[_0xb95b('0x32')][_0xb95b('0x1f')]);_0x46fa0f[_0xb95b('0x3b')]=qs['offset'](_0x538f42[_0xb95b('0x32')][_0xb95b('0x3b')]);}return _0x1e2011[_0xb95b('0x53')](_0x46fa0f);}})['then'](function(_0x3b8d58){if(_0x3b8d58){return _0x3b8d58?{'count':_0xb0c25e,'rows':_0x3b8d58}:null;}})['then'](respondWithResult(_0xa28b6f,null))[_0xb95b('0x4b')](handleError(_0xa28b6f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index 28eb1d9..f75dd47 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 _0x56df=['path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define','SalesforceConfiguration','int_salesforce_configurations','lodash','../../config/logger','api','moment','request-promise'];(function(_0x4d77d4,_0x372558){var _0x290fff=function(_0x1de62c){while(--_0x1de62c){_0x4d77d4['push'](_0x4d77d4['shift']());}};_0x290fff(++_0x372558);}(_0x56df,0x133));var _0xf56d=function(_0x11afdd,_0x585ffa){_0x11afdd=_0x11afdd-0x0;var _0x2b20a7=_0x56df[_0x11afdd];return _0x2b20a7;};'use strict';var _=require(_0xf56d('0x0'));var util=require('util');var logger=require(_0xf56d('0x1'))(_0xf56d('0x2'));var moment=require(_0xf56d('0x3'));var BPromise=require('bluebird');var rp=require(_0xf56d('0x4'));var fs=require('fs');var path=require(_0xf56d('0x5'));var rimraf=require(_0xf56d('0x6'));var config=require(_0xf56d('0x7'));var attributes=require(_0xf56d('0x8'));module['exports']=function(_0x286b4c,_0x345691){return _0x286b4c[_0xf56d('0x9')](_0xf56d('0xa'),attributes,{'tableName':_0xf56d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x002a=['bluebird','request-promise','path','rimraf','./intSalesforceConfiguration.attributes','exports','SalesforceConfiguration','api','moment'];(function(_0x16f8da,_0x11c03b){var _0x46bd0f=function(_0x36ecd5){while(--_0x36ecd5){_0x16f8da['push'](_0x16f8da['shift']());}};_0x46bd0f(++_0x11c03b);}(_0x002a,0x130));var _0xa002=function(_0x40e5af,_0x14e1fa){_0x40e5af=_0x40e5af-0x0;var _0x224591=_0x002a[_0x40e5af];return _0x224591;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xa002('0x0'));var moment=require(_0xa002('0x1'));var BPromise=require(_0xa002('0x2'));var rp=require(_0xa002('0x3'));var fs=require('fs');var path=require(_0xa002('0x4'));var rimraf=require(_0xa002('0x5'));var config=require('../../config/environment');var attributes=require(_0xa002('0x6'));module[_0xa002('0x7')]=function(_0x394186,_0x33fb77){return _0x394186['define'](_0xa002('0x8'),attributes,{'tableName':'int_salesforce_configurations','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 bc1fed1..eba03eb 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 _0x3601=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceConfiguration,\x20%s,\x20%s','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x51a8d0,_0x4a17c2){var _0x4930bd=function(_0xa2ae7e){while(--_0xa2ae7e){_0x51a8d0['push'](_0x51a8d0['shift']());}};_0x4930bd(++_0x4a17c2);}(_0x3601,0xf8));var _0x1360=function(_0x544584,_0x1a9ed5){_0x544584=_0x544584-0x0;var _0xdd09b7=_0x3601[_0x544584];return _0xdd09b7;};'use strict';var _=require(_0x1360('0x0'));var util=require(_0x1360('0x1'));var moment=require(_0x1360('0x2'));var BPromise=require(_0x1360('0x3'));var rs=require(_0x1360('0x4'));var fs=require('fs');var Redis=require(_0x1360('0x5'));var db=require(_0x1360('0x6'))['db'];var utils=require(_0x1360('0x7'));var logger=require(_0x1360('0x8'))(_0x1360('0x9'));var config=require(_0x1360('0xa'));var jayson=require(_0x1360('0xb'));var client=jayson[_0x1360('0xc')][_0x1360('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x1d4225,_0x591bb1,_0x41d799){return new BPromise(function(_0x200212,_0x53171d){return client[_0x1360('0xe')](_0x1d4225,_0x41d799)[_0x1360('0xf')](function(_0x3eb945){logger[_0x1360('0x10')](_0x1360('0x11'),_0x591bb1,'request\x20sent');logger[_0x1360('0x12')](_0x1360('0x13'),_0x591bb1,_0x1360('0x14'),JSON[_0x1360('0x15')](_0x3eb945));if(_0x3eb945[_0x1360('0x16')]){if(_0x3eb945[_0x1360('0x16')][_0x1360('0x17')]===0x1f4){logger[_0x1360('0x16')](_0x1360('0x11'),_0x591bb1,_0x3eb945[_0x1360('0x16')][_0x1360('0x18')]);return _0x53171d(_0x3eb945[_0x1360('0x16')]['message']);}logger[_0x1360('0x16')](_0x1360('0x11'),_0x591bb1,_0x3eb945[_0x1360('0x16')][_0x1360('0x18')]);return _0x200212(_0x3eb945['error'][_0x1360('0x18')]);}else{logger[_0x1360('0x10')](_0x1360('0x11'),_0x591bb1,_0x1360('0x14'));_0x200212(_0x3eb945[_0x1360('0x19')]['message']);}})[_0x1360('0x1a')](function(_0x5d86e8){logger[_0x1360('0x16')]('SalesforceConfiguration,\x20%s,\x20%s',_0x591bb1,_0x5d86e8);_0x53171d(_0x5d86e8);});});} \ No newline at end of file +var _0xb923=['SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then'];(function(_0x5a7618,_0x3f44c2){var _0x12dc65=function(_0x3cc4cd){while(--_0x3cc4cd){_0x5a7618['push'](_0x5a7618['shift']());}};_0x12dc65(++_0x3f44c2);}(_0xb923,0xa3));var _0x3b92=function(_0x15a5cc,_0x527bf8){_0x15a5cc=_0x15a5cc-0x0;var _0x422ef7=_0xb923[_0x15a5cc];return _0x422ef7;};'use strict';var _=require('lodash');var util=require(_0x3b92('0x0'));var moment=require(_0x3b92('0x1'));var BPromise=require(_0x3b92('0x2'));var rs=require(_0x3b92('0x3'));var fs=require('fs');var Redis=require(_0x3b92('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3b92('0x5'));var logger=require(_0x3b92('0x6'))(_0x3b92('0x7'));var config=require(_0x3b92('0x8'));var jayson=require(_0x3b92('0x9'));var client=jayson[_0x3b92('0xa')][_0x3b92('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2aa3a3,_0x1ad829,_0x3bbe4d){return new BPromise(function(_0x1b4e60,_0x231984){return client['request'](_0x2aa3a3,_0x3bbe4d)[_0x3b92('0xc')](function(_0x5e91cf){logger['info'](_0x3b92('0xd'),_0x1ad829,_0x3b92('0xe'));logger['debug']('SalesforceConfiguration,\x20%s,\x20%s,\x20%s',_0x1ad829,_0x3b92('0xe'),JSON[_0x3b92('0xf')](_0x5e91cf));if(_0x5e91cf['error']){if(_0x5e91cf[_0x3b92('0x10')][_0x3b92('0x11')]===0x1f4){logger[_0x3b92('0x10')](_0x3b92('0xd'),_0x1ad829,_0x5e91cf['error'][_0x3b92('0x12')]);return _0x231984(_0x5e91cf[_0x3b92('0x10')][_0x3b92('0x12')]);}logger['error'](_0x3b92('0xd'),_0x1ad829,_0x5e91cf['error']['message']);return _0x1b4e60(_0x5e91cf[_0x3b92('0x10')]['message']);}else{logger[_0x3b92('0x13')](_0x3b92('0xd'),_0x1ad829,_0x3b92('0xe'));_0x1b4e60(_0x5e91cf[_0x3b92('0x14')][_0x3b92('0x12')]);}})[_0x3b92('0x15')](function(_0x46ce21){logger[_0x3b92('0x10')](_0x3b92('0xd'),_0x1ad829,_0x46ce21);_0x231984(_0x46ce21);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 2e42c16..411b28b 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 _0x1ebc=['../../components/interaction/service','../../config/environment','./intSalesforceField.controller','get','isAuthenticated','index','post','create','put','/:id','update','delete','destroy','multer','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x888c1e,_0x386e0e){var _0x375229=function(_0x1b5cfc){while(--_0x1b5cfc){_0x888c1e['push'](_0x888c1e['shift']());}};_0x375229(++_0x386e0e);}(_0x1ebc,0x12d));var _0xc1eb=function(_0x4b670c,_0x153478){_0x4b670c=_0x4b670c-0x0;var _0x2200f8=_0x1ebc[_0x4b670c];return _0x2200f8;};'use strict';var multer=require(_0xc1eb('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc1eb('0x1'));var express=require(_0xc1eb('0x2'));var router=express['Router']();var fs_extra=require(_0xc1eb('0x3'));var auth=require(_0xc1eb('0x4'));var interaction=require(_0xc1eb('0x5'));var config=require(_0xc1eb('0x6'));var controller=require(_0xc1eb('0x7'));router[_0xc1eb('0x8')]('/',auth[_0xc1eb('0x9')](),controller[_0xc1eb('0xa')]);router[_0xc1eb('0x8')]('/:id',auth[_0xc1eb('0x9')](),controller['show']);router[_0xc1eb('0xb')]('/',auth[_0xc1eb('0x9')](),controller[_0xc1eb('0xc')]);router[_0xc1eb('0xd')](_0xc1eb('0xe'),auth[_0xc1eb('0x9')](),controller[_0xc1eb('0xf')]);router[_0xc1eb('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc1eb('0x11')]);module['exports']=router; \ No newline at end of file +var _0xfc92=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','update','/:id','exports','multer','util','path','express'];(function(_0x95675b,_0x88d868){var _0x2279e0=function(_0x155a3a){while(--_0x155a3a){_0x95675b['push'](_0x95675b['shift']());}};_0x2279e0(++_0x88d868);}(_0xfc92,0x84));var _0x2fc9=function(_0x213518,_0x51e022){_0x213518=_0x213518-0x0;var _0x1baf75=_0xfc92[_0x213518];return _0x1baf75;};'use strict';var multer=require(_0x2fc9('0x0'));var util=require(_0x2fc9('0x1'));var path=require(_0x2fc9('0x2'));var timeout=require('connect-timeout');var express=require(_0x2fc9('0x3'));var router=express[_0x2fc9('0x4')]();var fs_extra=require(_0x2fc9('0x5'));var auth=require(_0x2fc9('0x6'));var interaction=require(_0x2fc9('0x7'));var config=require(_0x2fc9('0x8'));var controller=require('./intSalesforceField.controller');router[_0x2fc9('0x9')]('/',auth[_0x2fc9('0xa')](),controller[_0x2fc9('0xb')]);router['get']('/:id',auth[_0x2fc9('0xa')](),controller[_0x2fc9('0xc')]);router[_0x2fc9('0xd')]('/',auth[_0x2fc9('0xa')](),controller['create']);router['put']('/:id',auth[_0x2fc9('0xa')](),controller[_0x2fc9('0xe')]);router['delete'](_0x2fc9('0xf'),auth[_0x2fc9('0xa')](),controller['destroy']);module[_0x2fc9('0x10')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index 6f92c78..d566aed 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 _0x3e8f=['string','variable','customVariable','keyValue','STRING','exports','ENUM'];(function(_0x26462c,_0xd20a35){var _0x509a42=function(_0x1b22c9){while(--_0x1b22c9){_0x26462c['push'](_0x26462c['shift']());}};_0x509a42(++_0xd20a35);}(_0x3e8f,0x67));var _0xf3e8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3e8f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module[_0xf3e8('0x0')]={'type':{'type':Sequelize[_0xf3e8('0x1')](_0xf3e8('0x2'),_0xf3e8('0x3'),_0xf3e8('0x4'),_0xf3e8('0x5'),'picklist'),'defaultValue':_0xf3e8('0x2')},'content':{'type':Sequelize[_0xf3e8('0x6')]},'key':{'type':Sequelize[_0xf3e8('0x6')]},'keyType':{'type':Sequelize[_0xf3e8('0x1')](_0xf3e8('0x2'),_0xf3e8('0x3'),_0xf3e8('0x4'))},'keyContent':{'type':Sequelize[_0xf3e8('0x6')]},'idField':{'type':Sequelize[_0xf3e8('0x6')]},'variableName':{'type':Sequelize[_0xf3e8('0x6')]}}; \ No newline at end of file +var _0x12be=['ENUM','exports','string','variable','keyValue','STRING'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0x12be,0x85));var _0xe12b=function(_0x592df4,_0x4e719b){_0x592df4=_0x592df4-0x0;var _0x3b4fe4=_0x12be[_0x592df4];return _0x3b4fe4;};'use strict';var Sequelize=require('sequelize');module[_0xe12b('0x0')]={'type':{'type':Sequelize['ENUM'](_0xe12b('0x1'),_0xe12b('0x2'),'customVariable',_0xe12b('0x3'),'picklist'),'defaultValue':_0xe12b('0x1')},'content':{'type':Sequelize[_0xe12b('0x4')]},'key':{'type':Sequelize[_0xe12b('0x4')]},'keyType':{'type':Sequelize[_0xe12b('0x5')](_0xe12b('0x1'),_0xe12b('0x2'),'customVariable')},'keyContent':{'type':Sequelize[_0xe12b('0x4')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index e0763a3..a789aa3 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 _0xd448=['sort','where','filter','merge','VIRTUAL','findAll','catch','show','params','keys','includeAll','include','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order'];(function(_0x5c4d44,_0xecfeb7){var _0x2a86ee=function(_0x3cabda){while(--_0x3cabda){_0x5c4d44['push'](_0x5c4d44['shift']());}};_0x2a86ee(++_0xecfeb7);}(_0xd448,0x172));var _0x8d44=function(_0x2fe69f,_0xd73fcb){_0x2fe69f=_0x2fe69f-0x0;var _0x4717c4=_0xd448[_0x2fe69f];return _0x4717c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8d44('0x0'));var zipdir=require(_0x8d44('0x1'));var jsonpatch=require(_0x8d44('0x2'));var rp=require(_0x8d44('0x3'));var moment=require(_0x8d44('0x4'));var BPromise=require(_0x8d44('0x5'));var Mustache=require(_0x8d44('0x6'));var util=require(_0x8d44('0x7'));var path=require(_0x8d44('0x8'));var sox=require(_0x8d44('0x9'));var csv=require('to-csv');var ejs=require(_0x8d44('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8d44('0xb'));var crypto=require(_0x8d44('0xc'));var jsforce=require(_0x8d44('0xd'));var deskjs=require(_0x8d44('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8d44('0xf'));var Papa=require(_0x8d44('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x8d44('0x11'));var as=require(_0x8d44('0x12'));var hardwareService=require(_0x8d44('0x13'));var logger=require('../../config/logger')(_0x8d44('0x14'));var utils=require(_0x8d44('0x15'));var config=require(_0x8d44('0x16'));var licenseUtil=require(_0x8d44('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x260f72,_0x67aeab){_0x67aeab=_0x67aeab||0xcc;return function(_0x1f73eb){if(_0x1f73eb){return _0x260f72[_0x8d44('0x18')](_0x67aeab);}return _0x260f72[_0x8d44('0x19')](_0x67aeab)['end']();};}function respondWithResult(_0x20f2cf,_0x41db66){_0x41db66=_0x41db66||0xc8;return function(_0x236a40){if(_0x236a40){return _0x20f2cf[_0x8d44('0x19')](_0x41db66)[_0x8d44('0x1a')](_0x236a40);}};}function respondWithFilteredResult(_0x59746c,_0x407d70){return function(_0x54aa00){if(_0x54aa00){var _0x35de0d=typeof _0x407d70[_0x8d44('0x1b')]===_0x8d44('0x1c')&&typeof _0x407d70[_0x8d44('0x1d')]===_0x8d44('0x1c');var _0x1f0e53=_0x54aa00[_0x8d44('0x1e')];var _0x1f29cb=_0x35de0d?0x0:_0x407d70['offset'];var _0x10d801=_0x35de0d?_0x54aa00[_0x8d44('0x1e')]:_0x407d70['offset']+_0x407d70[_0x8d44('0x1d')];var _0x12c37a;if(_0x10d801>=_0x1f0e53){_0x10d801=_0x1f0e53;_0x12c37a=0xc8;}else{_0x12c37a=0xce;}_0x59746c[_0x8d44('0x19')](_0x12c37a);return _0x59746c['set'](_0x8d44('0x1f'),_0x1f29cb+'-'+_0x10d801+'/'+_0x1f0e53)[_0x8d44('0x1a')](_0x54aa00);}return null;};}function patchUpdates(_0x2924e6){return function(_0xeaba9f){try{jsonpatch['apply'](_0xeaba9f,_0x2924e6,!![]);}catch(_0x31f991){return BPromise[_0x8d44('0x20')](_0x31f991);}return _0xeaba9f[_0x8d44('0x21')]();};}function saveUpdates(_0x4e39fe,_0x17b0eb){return function(_0x43c3fc){if(_0x43c3fc){return _0x43c3fc[_0x8d44('0x22')](_0x4e39fe)[_0x8d44('0x23')](function(_0x1f78c4){return _0x1f78c4;});}return null;};}function removeEntity(_0x4b5eb8,_0x45251a){return function(_0x2409ea){if(_0x2409ea){return _0x2409ea[_0x8d44('0x24')]()['then'](function(){_0x4b5eb8['status'](0xcc)[_0x8d44('0x25')]();});}};}function handleEntityNotFound(_0x105a12,_0x325a5a){return function(_0x22a9a7){if(!_0x22a9a7){_0x105a12[_0x8d44('0x18')](0x194);}return _0x22a9a7;};}function handleError(_0x288994,_0x2877d0){_0x2877d0=_0x2877d0||0x1f4;return function(_0x5f59ab){logger['error'](_0x5f59ab[_0x8d44('0x26')]);if(_0x5f59ab[_0x8d44('0x27')]){delete _0x5f59ab[_0x8d44('0x27')];}_0x288994[_0x8d44('0x19')](_0x2877d0)[_0x8d44('0x28')](_0x5f59ab);};}exports[_0x8d44('0x29')]=function(_0x41e47a,_0x4ce131){var _0x211834={},_0x5eb0c5={},_0x4bc6cb={'count':0x0,'rows':[]};var _0x35aa1e=_[_0x8d44('0x2a')](db[_0x8d44('0x2b')][_0x8d44('0x2c')],function(_0x42266e){return{'name':_0x42266e[_0x8d44('0x2d')],'type':_0x42266e[_0x8d44('0x2e')]['key']};});_0x5eb0c5[_0x8d44('0x2f')]=_['map'](_0x35aa1e,'name');_0x5eb0c5['query']=_['keys'](_0x41e47a[_0x8d44('0x30')]);_0x5eb0c5[_0x8d44('0x31')]=_[_0x8d44('0x32')](_0x5eb0c5[_0x8d44('0x2f')],_0x5eb0c5['query']);_0x211834[_0x8d44('0x33')]=_[_0x8d44('0x32')](_0x5eb0c5[_0x8d44('0x2f')],qs[_0x8d44('0x34')](_0x41e47a['query'][_0x8d44('0x34')]));_0x211834[_0x8d44('0x33')]=_0x211834[_0x8d44('0x33')][_0x8d44('0x35')]?_0x211834[_0x8d44('0x33')]:_0x5eb0c5[_0x8d44('0x2f')];if(!_0x41e47a['query'][_0x8d44('0x36')]('nolimit')){_0x211834[_0x8d44('0x1d')]=qs[_0x8d44('0x1d')](_0x41e47a[_0x8d44('0x30')][_0x8d44('0x1d')]);_0x211834[_0x8d44('0x1b')]=qs[_0x8d44('0x1b')](_0x41e47a[_0x8d44('0x30')][_0x8d44('0x1b')]);}_0x211834[_0x8d44('0x37')]=qs[_0x8d44('0x38')](_0x41e47a[_0x8d44('0x30')][_0x8d44('0x38')]);_0x211834[_0x8d44('0x39')]=qs[_0x8d44('0x31')](_['pick'](_0x41e47a['query'],_0x5eb0c5[_0x8d44('0x31')]),_0x35aa1e);if(_0x41e47a['query'][_0x8d44('0x3a')]){_0x211834[_0x8d44('0x39')]=_[_0x8d44('0x3b')](_0x211834[_0x8d44('0x39')],{'$or':_[_0x8d44('0x2a')](_0x35aa1e,function(_0x2ecba7){if(_0x2ecba7[_0x8d44('0x2e')]!==_0x8d44('0x3c')){var _0x397ae5={};_0x397ae5[_0x2ecba7[_0x8d44('0x27')]]={'$like':'%'+_0x41e47a['query'][_0x8d44('0x3a')]+'%'};return _0x397ae5;}})});}_0x211834=_[_0x8d44('0x3b')]({},_0x211834,_0x41e47a['options']);var _0x4d5fbd={'where':_0x211834[_0x8d44('0x39')]};return db[_0x8d44('0x2b')]['count'](_0x4d5fbd)[_0x8d44('0x23')](function(_0x30b744){_0x4bc6cb[_0x8d44('0x1e')]=_0x30b744;if(_0x41e47a[_0x8d44('0x30')]['includeAll']){_0x211834['include']=[{'all':!![]}];}return db['SalesforceField'][_0x8d44('0x3d')](_0x211834);})['then'](function(_0x6a6a44){_0x4bc6cb['rows']=_0x6a6a44;return _0x4bc6cb;})[_0x8d44('0x23')](respondWithFilteredResult(_0x4ce131,_0x211834))[_0x8d44('0x3e')](handleError(_0x4ce131,null));};exports[_0x8d44('0x3f')]=function(_0x6e99b3,_0x2117d2){var _0xd2f7d0={'raw':!![],'where':{'id':_0x6e99b3[_0x8d44('0x40')]['id']}},_0x5a6a7e={};_0x5a6a7e[_0x8d44('0x2f')]=_[_0x8d44('0x41')](db[_0x8d44('0x2b')][_0x8d44('0x2c')]);_0x5a6a7e[_0x8d44('0x30')]=_[_0x8d44('0x41')](_0x6e99b3[_0x8d44('0x30')]);_0x5a6a7e[_0x8d44('0x31')]=_[_0x8d44('0x32')](_0x5a6a7e['model'],_0x5a6a7e[_0x8d44('0x30')]);_0xd2f7d0[_0x8d44('0x33')]=_['intersection'](_0x5a6a7e['model'],qs[_0x8d44('0x34')](_0x6e99b3[_0x8d44('0x30')][_0x8d44('0x34')]));_0xd2f7d0[_0x8d44('0x33')]=_0xd2f7d0['attributes'][_0x8d44('0x35')]?_0xd2f7d0['attributes']:_0x5a6a7e[_0x8d44('0x2f')];if(_0x6e99b3[_0x8d44('0x30')][_0x8d44('0x42')]){_0xd2f7d0[_0x8d44('0x43')]=[{'all':!![]}];}_0xd2f7d0=_['merge']({},_0xd2f7d0,_0x6e99b3['options']);return db[_0x8d44('0x2b')][_0x8d44('0x44')](_0xd2f7d0)[_0x8d44('0x23')](handleEntityNotFound(_0x2117d2,null))[_0x8d44('0x23')](respondWithResult(_0x2117d2,null))[_0x8d44('0x3e')](handleError(_0x2117d2,null));};exports[_0x8d44('0x45')]=function(_0x44655a,_0x29b30f){return db['SalesforceField']['create'](_0x44655a[_0x8d44('0x46')],{})[_0x8d44('0x23')](respondWithResult(_0x29b30f,0xc9))[_0x8d44('0x3e')](handleError(_0x29b30f,null));};exports['update']=function(_0x3bf7f8,_0x44189f){if(_0x3bf7f8[_0x8d44('0x46')]['id']){delete _0x3bf7f8[_0x8d44('0x46')]['id'];}return db[_0x8d44('0x2b')][_0x8d44('0x44')]({'where':{'id':_0x3bf7f8['params']['id']}})['then'](handleEntityNotFound(_0x44189f,null))[_0x8d44('0x23')](saveUpdates(_0x3bf7f8[_0x8d44('0x46')],null))['then'](respondWithResult(_0x44189f,null))[_0x8d44('0x3e')](handleError(_0x44189f,null));};exports[_0x8d44('0x24')]=function(_0x583b12,_0x3c63c7){return db['SalesforceField'][_0x8d44('0x44')]({'where':{'id':_0x583b12[_0x8d44('0x40')]['id']}})[_0x8d44('0x23')](handleEntityNotFound(_0x3c63c7,null))[_0x8d44('0x23')](removeEntity(_0x3c63c7,null))['catch'](handleError(_0x3c63c7,null));}; \ No newline at end of file +var _0x991d=['VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','create','body','find','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../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','limit','count','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','SalesforceField','rawAttributes','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','filter','where','merge','type'];(function(_0x2d4516,_0x258709){var _0x2ad727=function(_0xdf94ca){while(--_0xdf94ca){_0x2d4516['push'](_0x2d4516['shift']());}};_0x2ad727(++_0x258709);}(_0x991d,0xfb));var _0xd991=function(_0x443604,_0x3a6707){_0x443604=_0x443604-0x0;var _0x49d943=_0x991d[_0x443604];return _0x49d943;};'use strict';var emlformat=require(_0xd991('0x0'));var rimraf=require(_0xd991('0x1'));var zipdir=require(_0xd991('0x2'));var jsonpatch=require(_0xd991('0x3'));var rp=require(_0xd991('0x4'));var moment=require(_0xd991('0x5'));var BPromise=require(_0xd991('0x6'));var Mustache=require(_0xd991('0x7'));var util=require(_0xd991('0x8'));var path=require(_0xd991('0x9'));var sox=require(_0xd991('0xa'));var csv=require(_0xd991('0xb'));var ejs=require(_0xd991('0xc'));var fs=require('fs');var fs_extra=require(_0xd991('0xd'));var _=require(_0xd991('0xe'));var squel=require(_0xd991('0xf'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd991('0x10'));var toCsv=require(_0xd991('0xb'));var querystring=require(_0xd991('0x11'));var Papa=require(_0xd991('0x12'));var Redis=require(_0xd991('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xd991('0x14'));var as=require(_0xd991('0x15'));var hardwareService=require(_0xd991('0x16'));var logger=require(_0xd991('0x17'))('api');var utils=require(_0xd991('0x18'));var config=require(_0xd991('0x19'));var licenseUtil=require(_0xd991('0x1a'));var db=require(_0xd991('0x1b'))['db'];function respondWithStatusCode(_0x5dceec,_0x5cafca){_0x5cafca=_0x5cafca||0xcc;return function(_0x1c0640){if(_0x1c0640){return _0x5dceec[_0xd991('0x1c')](_0x5cafca);}return _0x5dceec[_0xd991('0x1d')](_0x5cafca)[_0xd991('0x1e')]();};}function respondWithResult(_0x215039,_0x3b1d7e){_0x3b1d7e=_0x3b1d7e||0xc8;return function(_0x10839f){if(_0x10839f){return _0x215039['status'](_0x3b1d7e)[_0xd991('0x1f')](_0x10839f);}};}function respondWithFilteredResult(_0x46e654,_0x1206b6){return function(_0x34b47f){if(_0x34b47f){var _0x59065d=typeof _0x1206b6[_0xd991('0x20')]===_0xd991('0x21')&&typeof _0x1206b6[_0xd991('0x22')]===_0xd991('0x21');var _0x9edf32=_0x34b47f[_0xd991('0x23')];var _0x38a7c0=_0x59065d?0x0:_0x1206b6[_0xd991('0x20')];var _0x260592=_0x59065d?_0x34b47f[_0xd991('0x23')]:_0x1206b6[_0xd991('0x20')]+_0x1206b6[_0xd991('0x22')];var _0x22dfb4;if(_0x260592>=_0x9edf32){_0x260592=_0x9edf32;_0x22dfb4=0xc8;}else{_0x22dfb4=0xce;}_0x46e654[_0xd991('0x1d')](_0x22dfb4);return _0x46e654['set'](_0xd991('0x24'),_0x38a7c0+'-'+_0x260592+'/'+_0x9edf32)[_0xd991('0x1f')](_0x34b47f);}return null;};}function patchUpdates(_0x2ef449){return function(_0x45d717){try{jsonpatch[_0xd991('0x25')](_0x45d717,_0x2ef449,!![]);}catch(_0x5ba291){return BPromise[_0xd991('0x26')](_0x5ba291);}return _0x45d717[_0xd991('0x27')]();};}function saveUpdates(_0x39249c,_0x59aef8){return function(_0x48002c){if(_0x48002c){return _0x48002c[_0xd991('0x28')](_0x39249c)[_0xd991('0x29')](function(_0x23ddb8){return _0x23ddb8;});}return null;};}function removeEntity(_0x20c544,_0x192139){return function(_0x137a61){if(_0x137a61){return _0x137a61['destroy']()[_0xd991('0x29')](function(){_0x20c544[_0xd991('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1cddf5,_0x29a597){return function(_0x5a833e){if(!_0x5a833e){_0x1cddf5[_0xd991('0x1c')](0x194);}return _0x5a833e;};}function handleError(_0xc871c9,_0x2cc700){_0x2cc700=_0x2cc700||0x1f4;return function(_0x4a0a65){logger[_0xd991('0x2a')](_0x4a0a65[_0xd991('0x2b')]);if(_0x4a0a65[_0xd991('0x2c')]){delete _0x4a0a65[_0xd991('0x2c')];}_0xc871c9['status'](_0x2cc700)[_0xd991('0x2d')](_0x4a0a65);};}exports[_0xd991('0x2e')]=function(_0x2a21dd,_0x39572c){var _0x470432={},_0x4a05a2={},_0x18c20e={'count':0x0,'rows':[]};var _0x2e17f9=_[_0xd991('0x2f')](db[_0xd991('0x30')][_0xd991('0x31')],function(_0x3d4863){return{'name':_0x3d4863[_0xd991('0x32')],'type':_0x3d4863['type'][_0xd991('0x33')]};});_0x4a05a2[_0xd991('0x34')]=_['map'](_0x2e17f9,_0xd991('0x2c'));_0x4a05a2[_0xd991('0x35')]=_['keys'](_0x2a21dd['query']);_0x4a05a2[_0xd991('0x36')]=_[_0xd991('0x37')](_0x4a05a2[_0xd991('0x34')],_0x4a05a2[_0xd991('0x35')]);_0x470432['attributes']=_[_0xd991('0x37')](_0x4a05a2[_0xd991('0x34')],qs[_0xd991('0x38')](_0x2a21dd['query'][_0xd991('0x38')]));_0x470432[_0xd991('0x39')]=_0x470432['attributes'][_0xd991('0x3a')]?_0x470432['attributes']:_0x4a05a2[_0xd991('0x34')];if(!_0x2a21dd[_0xd991('0x35')][_0xd991('0x3b')]('nolimit')){_0x470432[_0xd991('0x22')]=qs[_0xd991('0x22')](_0x2a21dd[_0xd991('0x35')][_0xd991('0x22')]);_0x470432[_0xd991('0x20')]=qs['offset'](_0x2a21dd['query']['offset']);}_0x470432['order']=qs[_0xd991('0x3c')](_0x2a21dd[_0xd991('0x35')][_0xd991('0x3c')]);_0x470432['where']=qs[_0xd991('0x36')](_['pick'](_0x2a21dd[_0xd991('0x35')],_0x4a05a2['filters']),_0x2e17f9);if(_0x2a21dd[_0xd991('0x35')][_0xd991('0x3d')]){_0x470432[_0xd991('0x3e')]=_[_0xd991('0x3f')](_0x470432['where'],{'$or':_[_0xd991('0x2f')](_0x2e17f9,function(_0x2ad0cf){if(_0x2ad0cf[_0xd991('0x40')]!==_0xd991('0x41')){var _0x20b6ce={};_0x20b6ce[_0x2ad0cf[_0xd991('0x2c')]]={'$like':'%'+_0x2a21dd['query'][_0xd991('0x3d')]+'%'};return _0x20b6ce;}})});}_0x470432=_[_0xd991('0x3f')]({},_0x470432,_0x2a21dd[_0xd991('0x42')]);var _0x5688c5={'where':_0x470432[_0xd991('0x3e')]};return db[_0xd991('0x30')][_0xd991('0x23')](_0x5688c5)['then'](function(_0x2a8a36){_0x18c20e[_0xd991('0x23')]=_0x2a8a36;if(_0x2a21dd['query'][_0xd991('0x43')]){_0x470432[_0xd991('0x44')]=[{'all':!![]}];}return db[_0xd991('0x30')][_0xd991('0x45')](_0x470432);})[_0xd991('0x29')](function(_0x26c94f){_0x18c20e[_0xd991('0x46')]=_0x26c94f;return _0x18c20e;})['then'](respondWithFilteredResult(_0x39572c,_0x470432))[_0xd991('0x47')](handleError(_0x39572c,null));};exports[_0xd991('0x48')]=function(_0x1051de,_0x29fbf4){var _0x24e17={'raw':!![],'where':{'id':_0x1051de[_0xd991('0x49')]['id']}},_0x119126={};_0x119126[_0xd991('0x34')]=_[_0xd991('0x4a')](db[_0xd991('0x30')][_0xd991('0x31')]);_0x119126[_0xd991('0x35')]=_[_0xd991('0x4a')](_0x1051de[_0xd991('0x35')]);_0x119126[_0xd991('0x36')]=_[_0xd991('0x37')](_0x119126[_0xd991('0x34')],_0x119126['query']);_0x24e17[_0xd991('0x39')]=_['intersection'](_0x119126['model'],qs[_0xd991('0x38')](_0x1051de[_0xd991('0x35')][_0xd991('0x38')]));_0x24e17[_0xd991('0x39')]=_0x24e17[_0xd991('0x39')][_0xd991('0x3a')]?_0x24e17[_0xd991('0x39')]:_0x119126[_0xd991('0x34')];if(_0x1051de['query'][_0xd991('0x43')]){_0x24e17['include']=[{'all':!![]}];}_0x24e17=_[_0xd991('0x3f')]({},_0x24e17,_0x1051de[_0xd991('0x42')]);return db['SalesforceField']['find'](_0x24e17)[_0xd991('0x29')](handleEntityNotFound(_0x29fbf4,null))[_0xd991('0x29')](respondWithResult(_0x29fbf4,null))[_0xd991('0x47')](handleError(_0x29fbf4,null));};exports[_0xd991('0x4b')]=function(_0x5eb0ad,_0xf5836f){return db[_0xd991('0x30')]['create'](_0x5eb0ad[_0xd991('0x4c')],{})['then'](respondWithResult(_0xf5836f,0xc9))[_0xd991('0x47')](handleError(_0xf5836f,null));};exports[_0xd991('0x28')]=function(_0x4f6da9,_0x363e9c){if(_0x4f6da9[_0xd991('0x4c')]['id']){delete _0x4f6da9[_0xd991('0x4c')]['id'];}return db[_0xd991('0x30')][_0xd991('0x4d')]({'where':{'id':_0x4f6da9[_0xd991('0x49')]['id']}})['then'](handleEntityNotFound(_0x363e9c,null))[_0xd991('0x29')](saveUpdates(_0x4f6da9['body'],null))['then'](respondWithResult(_0x363e9c,null))['catch'](handleError(_0x363e9c,null));};exports[_0xd991('0x4e')]=function(_0x5df6e6,_0x26bb5f){return db[_0xd991('0x30')]['find']({'where':{'id':_0x5df6e6[_0xd991('0x49')]['id']}})[_0xd991('0x29')](handleEntityNotFound(_0x26bb5f,null))[_0xd991('0x29')](removeEntity(_0x26bb5f,null))[_0xd991('0x47')](handleError(_0x26bb5f,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index d24a3ce..1edbd20 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 _0xff11=['SalesforceField','int_salesforce_fields','salesforce_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSalesforceField.attributes','define'];(function(_0x4fe2b1,_0xd03d06){var _0x37ad4e=function(_0x5b4689){while(--_0x5b4689){_0x4fe2b1['push'](_0x4fe2b1['shift']());}};_0x37ad4e(++_0xd03d06);}(_0xff11,0x137));var _0x1ff1=function(_0x382bdd,_0x4e0534){_0x382bdd=_0x382bdd-0x0;var _0x1f29d8=_0xff11[_0x382bdd];return _0x1f29d8;};'use strict';var _=require(_0x1ff1('0x0'));var util=require(_0x1ff1('0x1'));var logger=require(_0x1ff1('0x2'))(_0x1ff1('0x3'));var moment=require(_0x1ff1('0x4'));var BPromise=require(_0x1ff1('0x5'));var rp=require(_0x1ff1('0x6'));var fs=require('fs');var path=require(_0x1ff1('0x7'));var rimraf=require(_0x1ff1('0x8'));var config=require(_0x1ff1('0x9'));var attributes=require(_0x1ff1('0xa'));module['exports']=function(_0x445e29,_0x56fc98){return _0x445e29[_0x1ff1('0xb')](_0x1ff1('0xc'),attributes,{'tableName':_0x1ff1('0xd'),'paranoid':![],'indexes':[{'name':_0x1ff1('0xe'),'fields':[_0x1ff1('0xf'),_0x1ff1('0x10')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5bf1=['./intSalesforceField.attributes','define','int_salesforce_fields','salesforce_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x2a2cdf,_0x3f2801){var _0x5e8e12=function(_0x3cc5ef){while(--_0x3cc5ef){_0x2a2cdf['push'](_0x2a2cdf['shift']());}};_0x5e8e12(++_0x3f2801);}(_0x5bf1,0x86));var _0x15bf=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5bf1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x15bf('0x0'));var util=require(_0x15bf('0x1'));var logger=require(_0x15bf('0x2'))(_0x15bf('0x3'));var moment=require(_0x15bf('0x4'));var BPromise=require(_0x15bf('0x5'));var rp=require(_0x15bf('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x15bf('0x7'));var config=require(_0x15bf('0x8'));var attributes=require(_0x15bf('0x9'));module['exports']=function(_0x5d406a,_0x33400b){return _0x5d406a[_0x15bf('0xa')]('SalesforceField',attributes,{'tableName':_0x15bf('0xb'),'paranoid':![],'indexes':[{'name':_0x15bf('0xc'),'fields':['idField','FieldId'],'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 c943ae2..db5410d 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 _0x05b5=['rpc','../../config/environment','jayson/promise','client','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','moment','../../mysqldb','../../config/utils'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0x05b5,0x195));var _0x505b=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x05b5[_0x432682];return _0x463d05;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x505b('0x0'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x505b('0x1'))['db'];var utils=require(_0x505b('0x2'));var logger=require('../../config/logger')(_0x505b('0x3'));var config=require(_0x505b('0x4'));var jayson=require(_0x505b('0x5'));var client=jayson[_0x505b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1951be,_0xac11d1,_0x56c425){return new BPromise(function(_0x13637a,_0x29dfc5){return client[_0x505b('0x7')](_0x1951be,_0x56c425)[_0x505b('0x8')](function(_0x5491fd){logger[_0x505b('0x9')](_0x505b('0xa'),_0xac11d1,_0x505b('0xb'));logger[_0x505b('0xc')]('SalesforceField,\x20%s,\x20%s,\x20%s',_0xac11d1,_0x505b('0xb'),JSON[_0x505b('0xd')](_0x5491fd));if(_0x5491fd['error']){if(_0x5491fd['error']['code']===0x1f4){logger['error'](_0x505b('0xa'),_0xac11d1,_0x5491fd[_0x505b('0xe')]['message']);return _0x29dfc5(_0x5491fd['error'][_0x505b('0xf')]);}logger[_0x505b('0xe')](_0x505b('0xa'),_0xac11d1,_0x5491fd[_0x505b('0xe')][_0x505b('0xf')]);return _0x13637a(_0x5491fd[_0x505b('0xe')][_0x505b('0xf')]);}else{logger['info'](_0x505b('0xa'),_0xac11d1,'request\x20sent');_0x13637a(_0x5491fd['result']['message']);}})[_0x505b('0x10')](function(_0x22128e){logger[_0x505b('0xe')]('SalesforceField,\x20%s,\x20%s',_0xac11d1,_0x22128e);_0x29dfc5(_0x22128e);});});} \ No newline at end of file +var _0x313a=['result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','SalesforceField,\x20%s,\x20%s','debug','SalesforceField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message'];(function(_0x988d9e,_0x143ccc){var _0x5ca535=function(_0x1f10be){while(--_0x1f10be){_0x988d9e['push'](_0x988d9e['shift']());}};_0x5ca535(++_0x143ccc);}(_0x313a,0x14c));var _0xa313=function(_0xc8a11,_0x347a33){_0xc8a11=_0xc8a11-0x0;var _0x55a500=_0x313a[_0xc8a11];return _0x55a500;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa313('0x0'));var BPromise=require(_0xa313('0x1'));var rs=require(_0xa313('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa313('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xa313('0x4'))(_0xa313('0x5'));var config=require(_0xa313('0x6'));var jayson=require(_0xa313('0x7'));var client=jayson['client'][_0xa313('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xdabb70,_0x3eafea,_0x39e958){return new BPromise(function(_0x5b70f3,_0x579210){return client[_0xa313('0x9')](_0xdabb70,_0x39e958)[_0xa313('0xa')](function(_0xd42e9c){logger[_0xa313('0xb')](_0xa313('0xc'),_0x3eafea,'request\x20sent');logger[_0xa313('0xd')](_0xa313('0xe'),_0x3eafea,_0xa313('0xf'),JSON[_0xa313('0x10')](_0xd42e9c));if(_0xd42e9c['error']){if(_0xd42e9c['error'][_0xa313('0x11')]===0x1f4){logger[_0xa313('0x12')](_0xa313('0xc'),_0x3eafea,_0xd42e9c['error'][_0xa313('0x13')]);return _0x579210(_0xd42e9c[_0xa313('0x12')]['message']);}logger[_0xa313('0x12')]('SalesforceField,\x20%s,\x20%s',_0x3eafea,_0xd42e9c[_0xa313('0x12')]['message']);return _0x5b70f3(_0xd42e9c['error']['message']);}else{logger[_0xa313('0xb')]('SalesforceField,\x20%s,\x20%s',_0x3eafea,'request\x20sent');_0x5b70f3(_0xd42e9c[_0xa313('0x14')]['message']);}})[_0xa313('0x15')](function(_0x55be28){logger['error']('SalesforceField,\x20%s,\x20%s',_0x3eafea,_0x55be28);_0x579210(_0x55be28);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index 524a4e6..bfa295d 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 _0xb32d=['util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./intServicenowAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer'];(function(_0x1aab9d,_0x503b9e){var _0x3840b2=function(_0x338c19){while(--_0x338c19){_0x1aab9d['push'](_0x1aab9d['shift']());}};_0x3840b2(++_0x503b9e);}(_0xb32d,0x1da));var _0xdb32=function(_0xf9a6cf,_0x11870e){_0xf9a6cf=_0xf9a6cf-0x0;var _0x59e2bc=_0xb32d[_0xf9a6cf];return _0x59e2bc;};'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('0x8')](_0xdb32('0xd'),auth[_0xdb32('0x9')](),controller[_0xdb32('0xe')]);router[_0xdb32('0x8')](_0xdb32('0xf'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x10')]);router[_0xdb32('0x11')]('/',auth[_0xdb32('0x9')](),controller[_0xdb32('0x12')]);router[_0xdb32('0x11')](_0xdb32('0xd'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x13')]);router[_0xdb32('0x14')](_0xdb32('0xb'),auth[_0xdb32('0x9')](),controller[_0xdb32('0x15')]);router[_0xdb32('0x16')]('/:id',auth[_0xdb32('0x9')](),controller[_0xdb32('0x17')]);module[_0xdb32('0x18')]=router; \ No newline at end of file +var _0x9164=['create','addConfiguration','update','delete','exports','multer','path','express','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9164,0x1cd));var _0x4916=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9164[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x4916('0x0'));var util=require('util');var path=require(_0x4916('0x1'));var timeout=require('connect-timeout');var express=require(_0x4916('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x4916('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x4916('0x4'));var controller=require('./intServicenowAccount.controller');router[_0x4916('0x5')]('/',auth[_0x4916('0x6')](),controller[_0x4916('0x7')]);router[_0x4916('0x5')](_0x4916('0x8'),auth[_0x4916('0x6')](),controller[_0x4916('0x9')]);router[_0x4916('0x5')](_0x4916('0xa'),auth[_0x4916('0x6')](),controller[_0x4916('0xb')]);router['get'](_0x4916('0xc'),auth['isAuthenticated'](),controller['getFields']);router[_0x4916('0xd')]('/',auth[_0x4916('0x6')](),controller[_0x4916('0xe')]);router[_0x4916('0xd')](_0x4916('0xa'),auth['isAuthenticated'](),controller[_0x4916('0xf')]);router['put']('/:id',auth[_0x4916('0x6')](),controller[_0x4916('0x10')]);router[_0x4916('0x11')](_0x4916('0x8'),auth[_0x4916('0x6')](),controller['destroy']);module[_0x4916('0x12')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index c37672c..b654455 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 _0xf3b6=['remoteUri','sequelize','exports','STRING'];(function(_0x1c5a4c,_0x15aca6){var _0x37acc7=function(_0x205db7){while(--_0x205db7){_0x1c5a4c['push'](_0x1c5a4c['shift']());}};_0x37acc7(++_0x15aca6);}(_0xf3b6,0x1b1));var _0x6f3b=function(_0x367425,_0x4579f6){_0x367425=_0x367425-0x0;var _0x1288a0=_0xf3b6[_0x367425];return _0x1288a0;};'use strict';var Sequelize=require(_0x6f3b('0x0'));module[_0x6f3b('0x1')]={'name':{'type':Sequelize[_0x6f3b('0x2')]},'description':{'type':Sequelize[_0x6f3b('0x2')]},'username':{'type':Sequelize['STRING'],'unique':'username'},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x6f3b('0x2')]},'remoteUri':{'type':Sequelize[_0x6f3b('0x2')],'unique':_0x6f3b('0x3')},'serverUrl':{'type':Sequelize[_0x6f3b('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x3b6d=['remoteUri','sequelize','STRING'];(function(_0x45d1c2,_0x345273){var _0x282cb8=function(_0x4f8c57){while(--_0x4f8c57){_0x45d1c2['push'](_0x45d1c2['shift']());}};_0x282cb8(++_0x345273);}(_0x3b6d,0x94));var _0xd3b6=function(_0x637756,_0x5048a8){_0x637756=_0x637756-0x0;var _0x162407=_0x3b6d[_0x637756];return _0x162407;};'use strict';var Sequelize=require(_0xd3b6('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xd3b6('0x1')]},'username':{'type':Sequelize[_0xd3b6('0x1')],'unique':'username'},'password':{'type':Sequelize[_0xd3b6('0x1')]},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xd3b6('0x1')],'unique':_0xd3b6('0x2')},'serverUrl':{'type':Sequelize[_0xd3b6('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.controller.js b/server/api/intServicenowAccount/intServicenowAccount.controller.js index b077e9d..61c43ed 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 _0xe8ad=['json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','error','stack','name','send','index','map','ServicenowAccount','rawAttributes','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','where','pick','filter','merge','type','options','then','findAll','rows','catch','show','includeAll','include','find','create','body','params','getConfigurations','findOne','ServicenowConfiguration','order','sort','nolimit','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','knowledge','close_code','notify','severity','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','hold_reason','approval_history','number','resolved_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','closed_at','delivery_plan','impact','business_service','priority','rfc','expected_start','opened_at','business_duration','work_end','reopened_time','resolved_at','approval_set','subcategory','work_notes','short_description','delivery_task','work_start','assignment_group','business_stc','additional_assignee_list','calendar_duration','sys_class_name','close_notes','closed_by','parent_incident','contact_type','reopened_by','incident_state','urgency','company','reassignment_count','activity_due','assigned_to','comments','approval','comments_and_work_notes','due_date','sys_mod_count','sys_tags','escalation','correlation_id','location','category','username','password','email','serverUrl','remoteUri','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','forEach','internalType','label','push','all','TCL:\x20_object','includes','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','test','statusCode','Wrong\x20credentials','boolean','True','true','False','false','sys_choice?sysparm_query=name=incident^element=','value','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end'];(function(_0x21db6f,_0x2c6e13){var _0x48667f=function(_0x293428){while(--_0x293428){_0x21db6f['push'](_0x21db6f['shift']());}};_0x48667f(++_0x2c6e13);}(_0xe8ad,0xa0));var _0xde8a=function(_0x19cb5a,_0x4700c1){_0x19cb5a=_0x19cb5a-0x0;var _0x4c99f2=_0xe8ad[_0x19cb5a];return _0x4c99f2;};'use strict';var emlformat=require(_0xde8a('0x0'));var rimraf=require(_0xde8a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xde8a('0x2'));var moment=require(_0xde8a('0x3'));var BPromise=require(_0xde8a('0x4'));var Mustache=require(_0xde8a('0x5'));var util=require(_0xde8a('0x6'));var path=require(_0xde8a('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xde8a('0x8'));var fs=require('fs');var fs_extra=require(_0xde8a('0x9'));var _=require(_0xde8a('0xa'));var squel=require('squel');var crypto=require(_0xde8a('0xb'));var jsforce=require(_0xde8a('0xc'));var deskjs=require(_0xde8a('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xde8a('0xe'));var authService=require(_0xde8a('0xf'));var qs=require(_0xde8a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xde8a('0x11'))('api');var utils=require('../../config/utils');var config=require(_0xde8a('0x12'));var licenseUtil=require(_0xde8a('0x13'));var db=require('../../mysqldb')['db'];var integrations=require(_0xde8a('0x14'));function respondWithStatusCode(_0x2c7c51,_0x366dd7){_0x366dd7=_0x366dd7||0xcc;return function(_0x2a3f25){if(_0x2a3f25){return _0x2c7c51[_0xde8a('0x15')](_0x366dd7);}return _0x2c7c51[_0xde8a('0x16')](_0x366dd7)[_0xde8a('0x17')]();};}function respondWithResult(_0x5db6fa,_0x1e280e){_0x1e280e=_0x1e280e||0xc8;return function(_0x36da46){if(_0x36da46){return _0x5db6fa[_0xde8a('0x16')](_0x1e280e)[_0xde8a('0x18')](_0x36da46);}};}function respondWithFilteredResult(_0x3a9de4,_0x4221a6){return function(_0x3faddd){if(_0x3faddd){var _0x4fcb8f=typeof _0x4221a6[_0xde8a('0x19')]===_0xde8a('0x1a')&&typeof _0x4221a6[_0xde8a('0x1b')]===_0xde8a('0x1a');var _0x126ce0=_0x3faddd[_0xde8a('0x1c')];var _0x55f5ae=_0x4fcb8f?0x0:_0x4221a6['offset'];var _0x2569ba=_0x4fcb8f?_0x3faddd[_0xde8a('0x1c')]:_0x4221a6['offset']+_0x4221a6[_0xde8a('0x1b')];var _0x5ba6be;if(_0x2569ba>=_0x126ce0){_0x2569ba=_0x126ce0;_0x5ba6be=0xc8;}else{_0x5ba6be=0xce;}_0x3a9de4['status'](_0x5ba6be);return _0x3a9de4['set'](_0xde8a('0x1d'),_0x55f5ae+'-'+_0x2569ba+'/'+_0x126ce0)[_0xde8a('0x18')](_0x3faddd);}return null;};}function patchUpdates(_0x1c1933){return function(_0x1add7c){try{jsonpatch[_0xde8a('0x1e')](_0x1add7c,_0x1c1933,!![]);}catch(_0x372aa6){return BPromise['reject'](_0x372aa6);}return _0x1add7c[_0xde8a('0x1f')]();};}function saveUpdates(_0x25bbda,_0x5dfa77){return function(_0x3f7600){if(_0x3f7600){return _0x3f7600[_0xde8a('0x20')](_0x25bbda)['then'](function(_0xeef1f1){return _0xeef1f1;});}return null;};}function removeEntity(_0x120ca6,_0x50a1a9){return function(_0x380a4d){if(_0x380a4d){return _0x380a4d[_0xde8a('0x21')]()['then'](function(){_0x120ca6[_0xde8a('0x16')](0xcc)[_0xde8a('0x17')]();});}};}function handleEntityNotFound(_0x3a8e18,_0xb1e7c0){return function(_0x247135){if(!_0x247135){_0x3a8e18[_0xde8a('0x15')](0x194);}return _0x247135;};}function handleError(_0xc2a984,_0x405432){_0x405432=_0x405432||0x1f4;return function(_0x1bcc9f){logger[_0xde8a('0x22')](_0x1bcc9f[_0xde8a('0x23')]);if(_0x1bcc9f[_0xde8a('0x24')]){delete _0x1bcc9f[_0xde8a('0x24')];}_0xc2a984[_0xde8a('0x16')](_0x405432)[_0xde8a('0x25')](_0x1bcc9f);};}exports[_0xde8a('0x26')]=function(_0x29f939,_0x11b1b0){var _0x58a5b8={},_0xf6bded={},_0x29b5f1={'count':0x0,'rows':[]};var _0x4dbd4d=_[_0xde8a('0x27')](db[_0xde8a('0x28')][_0xde8a('0x29')],function(_0x3c2a21){return{'name':_0x3c2a21['fieldName'],'type':_0x3c2a21['type'][_0xde8a('0x2a')]};});_0xf6bded[_0xde8a('0x2b')]=_[_0xde8a('0x27')](_0x4dbd4d,_0xde8a('0x24'));_0xf6bded[_0xde8a('0x2c')]=_[_0xde8a('0x2d')](_0x29f939[_0xde8a('0x2c')]);_0xf6bded[_0xde8a('0x2e')]=_['intersection'](_0xf6bded[_0xde8a('0x2b')],_0xf6bded[_0xde8a('0x2c')]);_0x58a5b8['attributes']=_[_0xde8a('0x2f')](_0xf6bded[_0xde8a('0x2b')],qs[_0xde8a('0x30')](_0x29f939[_0xde8a('0x2c')]['fields']));_0x58a5b8['attributes']=_0x58a5b8[_0xde8a('0x31')][_0xde8a('0x32')]?_0x58a5b8[_0xde8a('0x31')]:_0xf6bded[_0xde8a('0x2b')];if(!_0x29f939[_0xde8a('0x2c')][_0xde8a('0x33')]('nolimit')){_0x58a5b8['limit']=qs[_0xde8a('0x1b')](_0x29f939[_0xde8a('0x2c')][_0xde8a('0x1b')]);_0x58a5b8[_0xde8a('0x19')]=qs[_0xde8a('0x19')](_0x29f939[_0xde8a('0x2c')]['offset']);}_0x58a5b8['order']=qs['sort'](_0x29f939[_0xde8a('0x2c')]['sort']);_0x58a5b8[_0xde8a('0x34')]=qs[_0xde8a('0x2e')](_[_0xde8a('0x35')](_0x29f939['query'],_0xf6bded[_0xde8a('0x2e')]),_0x4dbd4d);if(_0x29f939[_0xde8a('0x2c')][_0xde8a('0x36')]){_0x58a5b8[_0xde8a('0x34')]=_[_0xde8a('0x37')](_0x58a5b8['where'],{'$or':_[_0xde8a('0x27')](_0x4dbd4d,function(_0x5b484b){if(_0x5b484b[_0xde8a('0x38')]!=='VIRTUAL'){var _0x45248d={};_0x45248d[_0x5b484b[_0xde8a('0x24')]]={'$like':'%'+_0x29f939['query'][_0xde8a('0x36')]+'%'};return _0x45248d;}})});}_0x58a5b8=_[_0xde8a('0x37')]({},_0x58a5b8,_0x29f939[_0xde8a('0x39')]);var _0x369a6e={'where':_0x58a5b8[_0xde8a('0x34')]};return db['ServicenowAccount'][_0xde8a('0x1c')](_0x369a6e)[_0xde8a('0x3a')](function(_0x86a8ff){_0x29b5f1[_0xde8a('0x1c')]=_0x86a8ff;if(_0x29f939[_0xde8a('0x2c')]['includeAll']){_0x58a5b8['include']=[{'all':!![]}];}return db[_0xde8a('0x28')][_0xde8a('0x3b')](_0x58a5b8);})[_0xde8a('0x3a')](function(_0x549f0c){_0x29b5f1[_0xde8a('0x3c')]=_0x549f0c;return _0x29b5f1;})[_0xde8a('0x3a')](respondWithFilteredResult(_0x11b1b0,_0x58a5b8))[_0xde8a('0x3d')](handleError(_0x11b1b0,null));};exports[_0xde8a('0x3e')]=function(_0x3161ee,_0x42e6b7){var _0x28f346={'raw':![],'where':{'id':_0x3161ee['params']['id']}},_0xad3145={};_0xad3145[_0xde8a('0x2b')]=_['keys'](db['ServicenowAccount']['rawAttributes']);_0xad3145['query']=_[_0xde8a('0x2d')](_0x3161ee['query']);_0xad3145[_0xde8a('0x2e')]=_[_0xde8a('0x2f')](_0xad3145[_0xde8a('0x2b')],_0xad3145['query']);_0x28f346[_0xde8a('0x31')]=_[_0xde8a('0x2f')](_0xad3145[_0xde8a('0x2b')],qs[_0xde8a('0x30')](_0x3161ee[_0xde8a('0x2c')]['fields']));_0x28f346[_0xde8a('0x31')]=_0x28f346['attributes']['length']?_0x28f346[_0xde8a('0x31')]:_0xad3145[_0xde8a('0x2b')];if(_0x3161ee[_0xde8a('0x2c')][_0xde8a('0x3f')]){_0x28f346[_0xde8a('0x40')]=[{'all':!![]}];}_0x28f346=_['merge']({},_0x28f346,_0x3161ee['options']);return db['ServicenowAccount'][_0xde8a('0x41')](_0x28f346)['then'](handleEntityNotFound(_0x42e6b7,null))[_0xde8a('0x3a')](respondWithResult(_0x42e6b7,null))[_0xde8a('0x3d')](handleError(_0x42e6b7,null));};exports[_0xde8a('0x42')]=function(_0x4031d6,_0x2192ec){return db['ServicenowAccount'][_0xde8a('0x42')](_0x4031d6['body'],{})['then'](respondWithResult(_0x2192ec,0xc9))[_0xde8a('0x3d')](handleError(_0x2192ec,null));};exports[_0xde8a('0x20')]=function(_0x170cb0,_0x5c80c7){if(_0x170cb0[_0xde8a('0x43')]['id']){delete _0x170cb0[_0xde8a('0x43')]['id'];}return db['ServicenowAccount'][_0xde8a('0x41')]({'where':{'id':_0x170cb0[_0xde8a('0x44')]['id']}})['then'](handleEntityNotFound(_0x5c80c7,null))['then'](saveUpdates(_0x170cb0[_0xde8a('0x43')],null))[_0xde8a('0x3a')](respondWithResult(_0x5c80c7,null))[_0xde8a('0x3d')](handleError(_0x5c80c7,null));};exports[_0xde8a('0x21')]=function(_0x4b66c6,_0x55622e){return db[_0xde8a('0x28')][_0xde8a('0x41')]({'where':{'id':_0x4b66c6[_0xde8a('0x44')]['id']}})[_0xde8a('0x3a')](handleEntityNotFound(_0x55622e,null))[_0xde8a('0x3a')](removeEntity(_0x55622e,null))['catch'](handleError(_0x55622e,null));};exports[_0xde8a('0x45')]=function(_0x4df7a1,_0xb1a125,_0x93892a){var _0x1e5d14={};var _0x4a3aca={};var _0x5f41b8;var _0x9abc9b;return db['ServicenowAccount'][_0xde8a('0x46')]({'where':{'id':_0x4df7a1[_0xde8a('0x44')]['id']}})['then'](handleEntityNotFound(_0xb1a125,null))[_0xde8a('0x3a')](function(_0x251ce0){if(_0x251ce0){_0x5f41b8=_0x251ce0;_0x4a3aca[_0xde8a('0x2b')]=_[_0xde8a('0x2d')](db[_0xde8a('0x47')]['rawAttributes']);_0x4a3aca['query']=_[_0xde8a('0x2d')](_0x4df7a1['query']);_0x4a3aca[_0xde8a('0x2e')]=_[_0xde8a('0x2f')](_0x4a3aca[_0xde8a('0x2b')],_0x4a3aca['query']);_0x1e5d14[_0xde8a('0x31')]=_[_0xde8a('0x2f')](_0x4a3aca[_0xde8a('0x2b')],qs['fields'](_0x4df7a1[_0xde8a('0x2c')][_0xde8a('0x30')]));_0x1e5d14[_0xde8a('0x31')]=_0x1e5d14['attributes']['length']?_0x1e5d14['attributes']:_0x4a3aca[_0xde8a('0x2b')];_0x1e5d14[_0xde8a('0x48')]=qs[_0xde8a('0x49')](_0x4df7a1[_0xde8a('0x2c')]['sort']);_0x1e5d14['where']=qs[_0xde8a('0x2e')](_['pick'](_0x4df7a1[_0xde8a('0x2c')],_0x4a3aca[_0xde8a('0x2e')]));if(_0x4df7a1[_0xde8a('0x2c')][_0xde8a('0x36')]){_0x1e5d14[_0xde8a('0x34')]=_[_0xde8a('0x37')](_0x1e5d14['where'],{'$or':_[_0xde8a('0x27')](_0x1e5d14['attributes'],function(_0x66fbf5){var _0x3d7ae2={};_0x3d7ae2[_0x66fbf5]={'$like':'%'+_0x4df7a1[_0xde8a('0x2c')]['filter']+'%'};return _0x3d7ae2;})});}_0x1e5d14=_[_0xde8a('0x37')]({},_0x1e5d14,_0x4df7a1['options']);return _0x5f41b8[_0xde8a('0x45')](_0x1e5d14);}})[_0xde8a('0x3a')](function(_0x51c934){if(_0x51c934){_0x9abc9b=_0x51c934['length'];if(!_0x4df7a1['query']['hasOwnProperty'](_0xde8a('0x4a'))){_0x1e5d14[_0xde8a('0x1b')]=qs[_0xde8a('0x1b')](_0x4df7a1[_0xde8a('0x2c')][_0xde8a('0x1b')]);_0x1e5d14['offset']=qs[_0xde8a('0x19')](_0x4df7a1[_0xde8a('0x2c')][_0xde8a('0x19')]);}return _0x5f41b8[_0xde8a('0x45')](_0x1e5d14);}})[_0xde8a('0x3a')](function(_0x430cb2){if(_0x430cb2){return _0x430cb2?{'count':_0x9abc9b,'rows':_0x430cb2}:null;}})['then'](respondWithResult(_0xb1a125,null))['catch'](handleError(_0xb1a125,null));};exports[_0xde8a('0x4b')]=function(_0x305c9f,_0x39815f,_0x4e3459){if(_0x305c9f[_0xde8a('0x43')]['id']){delete _0x305c9f[_0xde8a('0x43')]['id'];}return db[_0xde8a('0x28')][_0xde8a('0x46')]({'where':{'id':_0x305c9f['params']['id']}})[_0xde8a('0x3a')](handleEntityNotFound(_0x39815f,null))[_0xde8a('0x3a')](function(_0x325b51){if(_0x325b51){_0x305c9f[_0xde8a('0x43')][_0xde8a('0x4c')]=_0x325b51['id'];_0x305c9f[_0xde8a('0x43')][_0xde8a('0x4d')]=integrations[_0xde8a('0x4e')](_0x305c9f[_0xde8a('0x43')]['channel'],_0x305c9f['body'][_0xde8a('0x38')]);_0x305c9f[_0xde8a('0x43')][_0xde8a('0x4f')]=integrations[_0xde8a('0x50')](_0x305c9f[_0xde8a('0x43')][_0xde8a('0x51')],_0x305c9f[_0xde8a('0x43')][_0xde8a('0x38')]);return db['ServicenowConfiguration'][_0xde8a('0x42')](_0x305c9f['body'],{'include':[{'model':db['ServicenowField'],'as':_0xde8a('0x4d')},{'model':db[_0xde8a('0x52')],'as':_0xde8a('0x4f')}]});}return null;})[_0xde8a('0x3a')](respondWithResult(_0x39815f,null))[_0xde8a('0x3d')](handleError(_0x39815f,null));};exports[_0xde8a('0x53')]=function(_0x431f62,_0x30b384,_0x491383){var _0xb94fb5=[_0xde8a('0x54'),'hold_reason',_0xde8a('0x55'),'subcategory',_0xde8a('0x56'),_0xde8a('0x57'),'incident_state',_0xde8a('0x58'),'category'];var _0x4e02dd=[_0xde8a('0x59'),_0xde8a('0x54'),_0xde8a('0x5a'),_0xde8a('0x5b'),_0xde8a('0x5c'),_0xde8a('0x5d'),_0xde8a('0x5e'),_0xde8a('0x5f'),_0xde8a('0x60'),_0xde8a('0x61'),_0xde8a('0x62'),'sys_updated_by',_0xde8a('0x63'),_0xde8a('0x64'),_0xde8a('0x65'),_0xde8a('0x66'),_0xde8a('0x67'),_0xde8a('0x68'),_0xde8a('0x55'),_0xde8a('0x48'),'calendar_stc',_0xde8a('0x69'),'cmdb_ci',_0xde8a('0x6a'),_0xde8a('0x6b'),'active','work_notes_list',_0xde8a('0x6c'),_0xde8a('0x6d'),'sys_domain_path',_0xde8a('0x6e'),'time_worked',_0xde8a('0x6f'),_0xde8a('0x70'),_0xde8a('0x71'),'group_list',_0xde8a('0x72'),_0xde8a('0x73'),_0xde8a('0x74'),'caller_id',_0xde8a('0x75'),_0xde8a('0x76'),_0xde8a('0x77'),_0xde8a('0x78'),_0xde8a('0x56'),'correlation_display',_0xde8a('0x79'),_0xde8a('0x7a'),_0xde8a('0x7b'),_0xde8a('0x7c'),_0xde8a('0x7d'),'description',_0xde8a('0x7e'),'notify',_0xde8a('0x7f'),_0xde8a('0x80'),_0xde8a('0x81'),'follow_up',_0xde8a('0x82'),'sys_id',_0xde8a('0x83'),_0xde8a('0x84'),_0xde8a('0x85'),_0xde8a('0x86'),'problem_id',_0xde8a('0x87'),_0xde8a('0x88'),_0xde8a('0x89'),_0xde8a('0x8a'),_0xde8a('0x58'),_0xde8a('0x8b'),'sla_due',_0xde8a('0x8c'),_0xde8a('0x8d'),_0xde8a('0x8e'),_0xde8a('0x8f'),'reopen_count',_0xde8a('0x90'),_0xde8a('0x91'),'upon_approval',_0xde8a('0x92'),_0xde8a('0x93'),_0xde8a('0x94')];var _0x32ae92='';var _0x42259f='';var _0x3b5866=[];var _0x3f3c30='';var _0x5b969b='';var _0x354e6c=[];var _0x4e715b='';var _0x408c2b='';var _0xbfde2={};var _0x251cc6='';return db['ServicenowAccount'][_0xde8a('0x46')]({'where':{'id':_0x431f62[_0xde8a('0x44')]['id']},'attributes':['id',_0xde8a('0x95'),_0xde8a('0x96'),_0xde8a('0x97'),'remoteUri',_0xde8a('0x98')]})[_0xde8a('0x3a')](handleEntityNotFound(_0x30b384,null))['then'](function(_0x1cd492){if(_0x1cd492){_0x251cc6=_0x1cd492[_0xde8a('0x99')];var _0x3fc430=_0x251cc6['slice'](-0x1);if(_0x3fc430==='/'){_0x251cc6=_0x251cc6[_0xde8a('0x9a')](0x0,_0x251cc6[_0xde8a('0x9b')](_0x3fc430));}_0x408c2b=util['format'](_0xde8a('0x9c'),_0x251cc6);_0x4e715b=util[_0xde8a('0x9d')](_0xde8a('0x9e'),_0x251cc6);_0xbfde2={'user':_0x1cd492[_0xde8a('0x95')],'pass':_0x1cd492['password']};var _0x2e111a={'method':_0xde8a('0x9f'),'uri':_0x408c2b+_0xde8a('0xa0'),'auth':_0xbfde2,'json':!![]};return rp(_0x2e111a);}})[_0xde8a('0x3a')](function(_0xac9214){if(_0xac9214['result'][_0xde8a('0x32')]>0x0){_0x32ae92=_0xac9214[_0xde8a('0xa1')];}console[_0xde8a('0xa2')](_0xde8a('0xa3'),_0x32ae92);_0x354e6c=[];_0x42259f=Object[_0xde8a('0xa4')]([],_0x32ae92);_['remove'](_0x42259f,function(_0x5c3751){return!_0xb94fb5['includes'](_0x5c3751[_0xde8a('0x24')]);});_0x42259f[_0xde8a('0xa5')](function(_0x1410e5){var _0x5ab74e=createFieldObject(_0x4e715b,_0xbfde2,_0x1410e5[_0xde8a('0xa6')],_0x1410e5['name'],_0x1410e5[_0xde8a('0xa7')],![]);_0x354e6c[_0xde8a('0xa8')](_0x5ab74e);});return Promise[_0xde8a('0xa9')](_0x354e6c);})[_0xde8a('0x3a')](function(_0x520846){_0x3b5866=_0x520846;_0x3f3c30=Object[_0xde8a('0xa4')]([],_0x32ae92);console[_0xde8a('0xa2')](_0xde8a('0xaa'),_0x32ae92);_['remove'](_0x3f3c30,function(_0x439d4e){return _0x4e02dd[_0xde8a('0xab')](_0x439d4e[_0xde8a('0x24')]);});console['log'](_0xde8a('0xac'),_0x3f3c30);_0x354e6c=[];_0x3f3c30['forEach'](function(_0x4944db){var _0xbbe781=createFieldObject(_0x4e715b,_0xbfde2,_0x4944db[_0xde8a('0xa6')],_0x4944db[_0xde8a('0x24')],_0x4944db['label'],!![]);_0x354e6c['push'](_0xbbe781);});return Promise[_0xde8a('0xa9')](_0x354e6c);})[_0xde8a('0x3a')](function(_0x501e16){_0x5b969b=_0x501e16;var _0x16a92d=_0x3b5866[_0xde8a('0xad')](_0x5b969b);return{'count':_0x16a92d[_0xde8a('0x32')],'rows':_0x16a92d};})[_0xde8a('0x3a')](respondWithResult(_0x30b384,null))[_0xde8a('0x3d')](function(_0x225c07){console[_0xde8a('0xa2')]('ServiceNow\x20error:\x20'+_0x225c07);var _0x24314a=_0x431f62[_0xde8a('0x2c')][_0xde8a('0xae')]?0x1f4:_0x225c07[_0xde8a('0xaf')]||0x1f4;logger[_0xde8a('0x22')](_0x225c07[_0xde8a('0x23')]);delete _0x225c07['name'];if(_0x24314a===0x191){_0x24314a=0x190;}_0x30b384[_0xde8a('0x16')](_0x24314a)[_0xde8a('0x25')](_0x431f62['query']['test']?{'message':_0xde8a('0xb0'),'statusCode':_0x225c07['statusCode']}:_0x225c07);});};function createFieldObject(_0x219b7a,_0x27d624,_0x883757,_0x3cbe25,_0x2afd3b,_0x28dc7d){return new Promise(function(_0x1045ad,_0x1a6cad){var _0x1d798d={'id':_0x3cbe25,'name':_0x2afd3b,'custom':_0x28dc7d};if(_0x883757===_0xde8a('0xb1')){_0x1d798d[_0xde8a('0x39')]=[{'name':_0xde8a('0xb2'),'value':_0xde8a('0xb3')},{'name':_0xde8a('0xb4'),'value':_0xde8a('0xb5')}];_0x1045ad(_0x1d798d);}else{var _0x140124={'method':'GET','uri':_0x219b7a+_0xde8a('0xb6')+_0x3cbe25,'auth':_0x27d624,'json':!![]};return rp(_0x140124)[_0xde8a('0x3a')](function(_0x3feccb){var _0x33e914=[];if(_0x3feccb[_0xde8a('0xa1')][_0xde8a('0x32')]>0x0){_0x3feccb[_0xde8a('0xa1')][_0xde8a('0xa5')](function(_0x57f105){if(_0x57f105['inactive']===_0xde8a('0xb5')){var _0x14017e={'name':_0x57f105[_0xde8a('0xa7')],'value':_0x57f105[_0xde8a('0xb7')]};_0x33e914[_0xde8a('0xa8')](_0x14017e);}});}_0x1d798d[_0xde8a('0x39')]=_0x33e914;if(_0x1d798d['options'][_0xde8a('0x32')]>0x0){_0x1045ad(_0x1d798d);}else{if(_0x28dc7d==![]){_0x1045ad();}else{_0x1045ad(_0x1d798d);}}});}});} \ No newline at end of file +var _0x79b9=['rfc','time_worked','expected_start','business_duration','group_list','work_end','reopened_time','resolved_at','caller_id','approval_set','work_notes','short_description','correlation_display','delivery_task','assignment_group','business_stc','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','sys_id','contact_type','reopened_by','company','reassignment_count','assigned_to','comments','sla_due','comments_and_work_notes','sys_mod_count','reopen_count','sys_tags','correlation_id','location','category','username','password','email','serverUrl','remoteUri','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','forEach','internalType','label','push','all','TCL:\x20_object','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','concat','ServiceNow\x20error:\x20','test','statusCode','error','stack','Wrong\x20credentials','boolean','True','true','False','false','inactive','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set','apply','reject','save','then','destroy','name','send','index','map','ServicenowAccount','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','catch','create','body','getConfigurations','findOne','ServicenowConfiguration','addConfiguration','AccountId','Subjects','getSubjects','Descriptions','getDescriptions','channel','ServicenowField','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','parent','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','sys_updated_by','opened_by','sys_created_on','state','sys_created_by','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path'];(function(_0xee179f,_0x1e1c49){var _0x53b5f1=function(_0x2a4d29){while(--_0x2a4d29){_0xee179f['push'](_0xee179f['shift']());}};_0x53b5f1(++_0x1e1c49);}(_0x79b9,0x105));var _0x979b=function(_0xe5a818,_0x4c97b2){_0xe5a818=_0xe5a818-0x0;var _0x136863=_0x79b9[_0xe5a818];return _0x136863;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x979b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x979b('0x1'));var rp=require(_0x979b('0x2'));var moment=require(_0x979b('0x3'));var BPromise=require(_0x979b('0x4'));var Mustache=require(_0x979b('0x5'));var util=require(_0x979b('0x6'));var path=require(_0x979b('0x7'));var sox=require(_0x979b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x979b('0x9'));var squel=require('squel');var crypto=require(_0x979b('0xa'));var jsforce=require(_0x979b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x979b('0xc'));var querystring=require(_0x979b('0xd'));var Papa=require('papaparse');var Redis=require(_0x979b('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x979b('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x979b('0x10'));var logger=require('../../config/logger')(_0x979b('0x11'));var utils=require(_0x979b('0x12'));var config=require(_0x979b('0x13'));var licenseUtil=require(_0x979b('0x14'));var db=require(_0x979b('0x15'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5b1b22,_0x44c4ed){_0x44c4ed=_0x44c4ed||0xcc;return function(_0x30e960){if(_0x30e960){return _0x5b1b22[_0x979b('0x16')](_0x44c4ed);}return _0x5b1b22[_0x979b('0x17')](_0x44c4ed)[_0x979b('0x18')]();};}function respondWithResult(_0x2e18b5,_0x17a4ae){_0x17a4ae=_0x17a4ae||0xc8;return function(_0x591b7b){if(_0x591b7b){return _0x2e18b5[_0x979b('0x17')](_0x17a4ae)[_0x979b('0x19')](_0x591b7b);}};}function respondWithFilteredResult(_0xa19f5a,_0x30a007){return function(_0x40575d){if(_0x40575d){var _0x5146ec=typeof _0x30a007[_0x979b('0x1a')]===_0x979b('0x1b')&&typeof _0x30a007['limit']===_0x979b('0x1b');var _0xdd1e55=_0x40575d[_0x979b('0x1c')];var _0x35513c=_0x5146ec?0x0:_0x30a007[_0x979b('0x1a')];var _0x48f6da=_0x5146ec?_0x40575d[_0x979b('0x1c')]:_0x30a007[_0x979b('0x1a')]+_0x30a007['limit'];var _0x444eab;if(_0x48f6da>=_0xdd1e55){_0x48f6da=_0xdd1e55;_0x444eab=0xc8;}else{_0x444eab=0xce;}_0xa19f5a[_0x979b('0x17')](_0x444eab);return _0xa19f5a[_0x979b('0x1d')]('Content-Range',_0x35513c+'-'+_0x48f6da+'/'+_0xdd1e55)[_0x979b('0x19')](_0x40575d);}return null;};}function patchUpdates(_0x47f885){return function(_0x1e24ae){try{jsonpatch[_0x979b('0x1e')](_0x1e24ae,_0x47f885,!![]);}catch(_0x3924c4){return BPromise[_0x979b('0x1f')](_0x3924c4);}return _0x1e24ae[_0x979b('0x20')]();};}function saveUpdates(_0x1ef137,_0x3a8e8c){return function(_0x54e4f6){if(_0x54e4f6){return _0x54e4f6['update'](_0x1ef137)[_0x979b('0x21')](function(_0x5371e9){return _0x5371e9;});}return null;};}function removeEntity(_0x2cc59e,_0x52b105){return function(_0x2f4f59){if(_0x2f4f59){return _0x2f4f59[_0x979b('0x22')]()[_0x979b('0x21')](function(){_0x2cc59e[_0x979b('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5df6ea,_0x4e669e){return function(_0xa58633){if(!_0xa58633){_0x5df6ea[_0x979b('0x16')](0x194);}return _0xa58633;};}function handleError(_0x21d211,_0x1ffb24){_0x1ffb24=_0x1ffb24||0x1f4;return function(_0x23a523){logger['error'](_0x23a523['stack']);if(_0x23a523[_0x979b('0x23')]){delete _0x23a523[_0x979b('0x23')];}_0x21d211[_0x979b('0x17')](_0x1ffb24)[_0x979b('0x24')](_0x23a523);};}exports[_0x979b('0x25')]=function(_0x5d9cc4,_0x1a00f5){var _0x4aa0af={},_0x3dfce0={},_0x493d81={'count':0x0,'rows':[]};var _0x3bd0b2=_[_0x979b('0x26')](db[_0x979b('0x27')][_0x979b('0x28')],function(_0x6a647d){return{'name':_0x6a647d[_0x979b('0x29')],'type':_0x6a647d[_0x979b('0x2a')]['key']};});_0x3dfce0[_0x979b('0x2b')]=_[_0x979b('0x26')](_0x3bd0b2,_0x979b('0x23'));_0x3dfce0[_0x979b('0x2c')]=_[_0x979b('0x2d')](_0x5d9cc4[_0x979b('0x2c')]);_0x3dfce0[_0x979b('0x2e')]=_['intersection'](_0x3dfce0[_0x979b('0x2b')],_0x3dfce0[_0x979b('0x2c')]);_0x4aa0af[_0x979b('0x2f')]=_[_0x979b('0x30')](_0x3dfce0[_0x979b('0x2b')],qs[_0x979b('0x31')](_0x5d9cc4[_0x979b('0x2c')]['fields']));_0x4aa0af['attributes']=_0x4aa0af[_0x979b('0x2f')][_0x979b('0x32')]?_0x4aa0af['attributes']:_0x3dfce0[_0x979b('0x2b')];if(!_0x5d9cc4[_0x979b('0x2c')][_0x979b('0x33')](_0x979b('0x34'))){_0x4aa0af[_0x979b('0x35')]=qs[_0x979b('0x35')](_0x5d9cc4[_0x979b('0x2c')][_0x979b('0x35')]);_0x4aa0af['offset']=qs[_0x979b('0x1a')](_0x5d9cc4[_0x979b('0x2c')][_0x979b('0x1a')]);}_0x4aa0af[_0x979b('0x36')]=qs[_0x979b('0x37')](_0x5d9cc4[_0x979b('0x2c')][_0x979b('0x37')]);_0x4aa0af['where']=qs[_0x979b('0x2e')](_[_0x979b('0x38')](_0x5d9cc4[_0x979b('0x2c')],_0x3dfce0[_0x979b('0x2e')]),_0x3bd0b2);if(_0x5d9cc4['query'][_0x979b('0x39')]){_0x4aa0af[_0x979b('0x3a')]=_[_0x979b('0x3b')](_0x4aa0af[_0x979b('0x3a')],{'$or':_['map'](_0x3bd0b2,function(_0x31f6b1){if(_0x31f6b1['type']!==_0x979b('0x3c')){var _0x4b84e6={};_0x4b84e6[_0x31f6b1['name']]={'$like':'%'+_0x5d9cc4[_0x979b('0x2c')][_0x979b('0x39')]+'%'};return _0x4b84e6;}})});}_0x4aa0af=_[_0x979b('0x3b')]({},_0x4aa0af,_0x5d9cc4[_0x979b('0x3d')]);var _0x413f86={'where':_0x4aa0af[_0x979b('0x3a')]};return db[_0x979b('0x27')][_0x979b('0x1c')](_0x413f86)[_0x979b('0x21')](function(_0x4cf402){_0x493d81[_0x979b('0x1c')]=_0x4cf402;if(_0x5d9cc4[_0x979b('0x2c')][_0x979b('0x3e')]){_0x4aa0af[_0x979b('0x3f')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x979b('0x40')](_0x4aa0af);})[_0x979b('0x21')](function(_0x4a05ed){_0x493d81['rows']=_0x4a05ed;return _0x493d81;})[_0x979b('0x21')](respondWithFilteredResult(_0x1a00f5,_0x4aa0af))['catch'](handleError(_0x1a00f5,null));};exports[_0x979b('0x41')]=function(_0x4bae43,_0x106dea){var _0x3c7dc3={'raw':![],'where':{'id':_0x4bae43[_0x979b('0x42')]['id']}},_0x2655a3={};_0x2655a3[_0x979b('0x2b')]=_['keys'](db[_0x979b('0x27')][_0x979b('0x28')]);_0x2655a3[_0x979b('0x2c')]=_['keys'](_0x4bae43[_0x979b('0x2c')]);_0x2655a3[_0x979b('0x2e')]=_[_0x979b('0x30')](_0x2655a3[_0x979b('0x2b')],_0x2655a3[_0x979b('0x2c')]);_0x3c7dc3[_0x979b('0x2f')]=_[_0x979b('0x30')](_0x2655a3['model'],qs[_0x979b('0x31')](_0x4bae43[_0x979b('0x2c')][_0x979b('0x31')]));_0x3c7dc3['attributes']=_0x3c7dc3[_0x979b('0x2f')]['length']?_0x3c7dc3[_0x979b('0x2f')]:_0x2655a3[_0x979b('0x2b')];if(_0x4bae43[_0x979b('0x2c')]['includeAll']){_0x3c7dc3[_0x979b('0x3f')]=[{'all':!![]}];}_0x3c7dc3=_[_0x979b('0x3b')]({},_0x3c7dc3,_0x4bae43['options']);return db['ServicenowAccount'][_0x979b('0x43')](_0x3c7dc3)[_0x979b('0x21')](handleEntityNotFound(_0x106dea,null))[_0x979b('0x21')](respondWithResult(_0x106dea,null))[_0x979b('0x44')](handleError(_0x106dea,null));};exports[_0x979b('0x45')]=function(_0x176096,_0x4e92be){return db[_0x979b('0x27')][_0x979b('0x45')](_0x176096[_0x979b('0x46')],{})[_0x979b('0x21')](respondWithResult(_0x4e92be,0xc9))[_0x979b('0x44')](handleError(_0x4e92be,null));};exports['update']=function(_0x4e2ed6,_0x1303a2){if(_0x4e2ed6['body']['id']){delete _0x4e2ed6['body']['id'];}return db[_0x979b('0x27')][_0x979b('0x43')]({'where':{'id':_0x4e2ed6[_0x979b('0x42')]['id']}})[_0x979b('0x21')](handleEntityNotFound(_0x1303a2,null))[_0x979b('0x21')](saveUpdates(_0x4e2ed6[_0x979b('0x46')],null))['then'](respondWithResult(_0x1303a2,null))[_0x979b('0x44')](handleError(_0x1303a2,null));};exports[_0x979b('0x22')]=function(_0x18ec5b,_0x404236){return db['ServicenowAccount']['find']({'where':{'id':_0x18ec5b[_0x979b('0x42')]['id']}})[_0x979b('0x21')](handleEntityNotFound(_0x404236,null))[_0x979b('0x21')](removeEntity(_0x404236,null))[_0x979b('0x44')](handleError(_0x404236,null));};exports[_0x979b('0x47')]=function(_0x322840,_0x580b9b,_0x56018e){var _0x57d208={};var _0x28cbe6={};var _0x1df19c;var _0x4579a5;return db[_0x979b('0x27')][_0x979b('0x48')]({'where':{'id':_0x322840['params']['id']}})[_0x979b('0x21')](handleEntityNotFound(_0x580b9b,null))[_0x979b('0x21')](function(_0x29f417){if(_0x29f417){_0x1df19c=_0x29f417;_0x28cbe6[_0x979b('0x2b')]=_['keys'](db[_0x979b('0x49')]['rawAttributes']);_0x28cbe6[_0x979b('0x2c')]=_[_0x979b('0x2d')](_0x322840[_0x979b('0x2c')]);_0x28cbe6['filters']=_[_0x979b('0x30')](_0x28cbe6[_0x979b('0x2b')],_0x28cbe6['query']);_0x57d208[_0x979b('0x2f')]=_['intersection'](_0x28cbe6['model'],qs[_0x979b('0x31')](_0x322840[_0x979b('0x2c')][_0x979b('0x31')]));_0x57d208[_0x979b('0x2f')]=_0x57d208['attributes'][_0x979b('0x32')]?_0x57d208[_0x979b('0x2f')]:_0x28cbe6['model'];_0x57d208[_0x979b('0x36')]=qs[_0x979b('0x37')](_0x322840[_0x979b('0x2c')]['sort']);_0x57d208[_0x979b('0x3a')]=qs[_0x979b('0x2e')](_[_0x979b('0x38')](_0x322840[_0x979b('0x2c')],_0x28cbe6[_0x979b('0x2e')]));if(_0x322840['query'][_0x979b('0x39')]){_0x57d208[_0x979b('0x3a')]=_[_0x979b('0x3b')](_0x57d208[_0x979b('0x3a')],{'$or':_[_0x979b('0x26')](_0x57d208[_0x979b('0x2f')],function(_0x94905b){var _0x2eba82={};_0x2eba82[_0x94905b]={'$like':'%'+_0x322840['query'][_0x979b('0x39')]+'%'};return _0x2eba82;})});}_0x57d208=_[_0x979b('0x3b')]({},_0x57d208,_0x322840[_0x979b('0x3d')]);return _0x1df19c[_0x979b('0x47')](_0x57d208);}})[_0x979b('0x21')](function(_0x4aadaa){if(_0x4aadaa){_0x4579a5=_0x4aadaa['length'];if(!_0x322840[_0x979b('0x2c')]['hasOwnProperty'](_0x979b('0x34'))){_0x57d208[_0x979b('0x35')]=qs[_0x979b('0x35')](_0x322840[_0x979b('0x2c')][_0x979b('0x35')]);_0x57d208['offset']=qs[_0x979b('0x1a')](_0x322840[_0x979b('0x2c')][_0x979b('0x1a')]);}return _0x1df19c[_0x979b('0x47')](_0x57d208);}})['then'](function(_0x4918ef){if(_0x4918ef){return _0x4918ef?{'count':_0x4579a5,'rows':_0x4918ef}:null;}})['then'](respondWithResult(_0x580b9b,null))[_0x979b('0x44')](handleError(_0x580b9b,null));};exports[_0x979b('0x4a')]=function(_0x4ac3d9,_0xc98168,_0x25380a){if(_0x4ac3d9[_0x979b('0x46')]['id']){delete _0x4ac3d9['body']['id'];}return db[_0x979b('0x27')]['findOne']({'where':{'id':_0x4ac3d9['params']['id']}})[_0x979b('0x21')](handleEntityNotFound(_0xc98168,null))[_0x979b('0x21')](function(_0x9dde38){if(_0x9dde38){_0x4ac3d9[_0x979b('0x46')][_0x979b('0x4b')]=_0x9dde38['id'];_0x4ac3d9[_0x979b('0x46')][_0x979b('0x4c')]=integrations[_0x979b('0x4d')](_0x4ac3d9[_0x979b('0x46')]['channel'],_0x4ac3d9[_0x979b('0x46')][_0x979b('0x2a')]);_0x4ac3d9[_0x979b('0x46')][_0x979b('0x4e')]=integrations[_0x979b('0x4f')](_0x4ac3d9[_0x979b('0x46')][_0x979b('0x50')],_0x4ac3d9[_0x979b('0x46')]['type']);return db[_0x979b('0x49')][_0x979b('0x45')](_0x4ac3d9[_0x979b('0x46')],{'include':[{'model':db[_0x979b('0x51')],'as':'Subjects'},{'model':db['ServicenowField'],'as':_0x979b('0x4e')}]});}return null;})['then'](respondWithResult(_0xc98168,null))[_0x979b('0x44')](handleError(_0xc98168,null));};exports[_0x979b('0x52')]=function(_0x16e5b1,_0x362ee5,_0x358bf3){var _0x3babff=[_0x979b('0x53'),_0x979b('0x54'),_0x979b('0x55'),_0x979b('0x56'),_0x979b('0x57'),_0x979b('0x58'),_0x979b('0x59'),_0x979b('0x5a'),'category'];var _0x25891a=[_0x979b('0x5b'),'made_sla','caused_by',_0x979b('0x5c'),_0x979b('0x5d'),_0x979b('0x5e'),_0x979b('0x5f'),_0x979b('0x54'),_0x979b('0x60'),_0x979b('0x61'),'resolved_by',_0x979b('0x62'),_0x979b('0x63'),'user_input',_0x979b('0x64'),'sys_domain',_0x979b('0x65'),_0x979b('0x66'),_0x979b('0x55'),_0x979b('0x36'),'calendar_stc',_0x979b('0x67'),_0x979b('0x68'),_0x979b('0x69'),_0x979b('0x6a'),_0x979b('0x6b'),_0x979b('0x6c'),'business_service',_0x979b('0x6d'),_0x979b('0x6e'),_0x979b('0x6f'),_0x979b('0x70'),_0x979b('0x71'),'opened_at',_0x979b('0x72'),_0x979b('0x73'),_0x979b('0x74'),_0x979b('0x75'),_0x979b('0x76'),_0x979b('0x77'),_0x979b('0x78'),_0x979b('0x56'),_0x979b('0x79'),_0x979b('0x7a'),'close_code',_0x979b('0x7b'),_0x979b('0x7c'),'work_start',_0x979b('0x7d'),_0x979b('0x7e'),'additional_assignee_list',_0x979b('0x7f'),_0x979b('0x80'),_0x979b('0x58'),_0x979b('0x81'),_0x979b('0x82'),_0x979b('0x83'),_0x979b('0x84'),'parent_incident',_0x979b('0x85'),_0x979b('0x86'),_0x979b('0x87'),'incident_state','urgency','problem_id',_0x979b('0x88'),_0x979b('0x89'),'activity_due',_0x979b('0x8a'),_0x979b('0x5a'),_0x979b('0x8b'),_0x979b('0x8c'),'approval',_0x979b('0x8d'),'due_date',_0x979b('0x8e'),_0x979b('0x8f'),_0x979b('0x90'),'escalation','upon_approval',_0x979b('0x91'),_0x979b('0x92'),_0x979b('0x93')];var _0x424e40='';var _0x123042='';var _0x3ea3ab=[];var _0x5b160f='';var _0xefd6e7='';var _0x24999a=[];var _0x1fe5d2='';var _0x488bfe='';var _0xb91c44={};var _0x11c8a5='';return db[_0x979b('0x27')][_0x979b('0x48')]({'where':{'id':_0x16e5b1[_0x979b('0x42')]['id']},'attributes':['id',_0x979b('0x94'),_0x979b('0x95'),_0x979b('0x96'),'remoteUri',_0x979b('0x97')]})['then'](handleEntityNotFound(_0x362ee5,null))['then'](function(_0x57bafa){if(_0x57bafa){_0x11c8a5=_0x57bafa[_0x979b('0x98')];var _0x3995e7=_0x11c8a5[_0x979b('0x99')](-0x1);if(_0x3995e7==='/'){_0x11c8a5=_0x11c8a5[_0x979b('0x9a')](0x0,_0x11c8a5[_0x979b('0x9b')](_0x3995e7));}_0x488bfe=util[_0x979b('0x9c')](_0x979b('0x9d'),_0x11c8a5);_0x1fe5d2=util['format']('%s/api/now/table/',_0x11c8a5);_0xb91c44={'user':_0x57bafa[_0x979b('0x94')],'pass':_0x57bafa[_0x979b('0x95')]};var _0x51910b={'method':_0x979b('0x9e'),'uri':_0x488bfe+_0x979b('0x9f'),'auth':_0xb91c44,'json':!![]};return rp(_0x51910b);}})[_0x979b('0x21')](function(_0x29f583){if(_0x29f583[_0x979b('0xa0')][_0x979b('0x32')]>0x0){_0x424e40=_0x29f583[_0x979b('0xa0')];}console[_0x979b('0xa1')](_0x979b('0xa2'),_0x424e40);_0x24999a=[];_0x123042=Object[_0x979b('0xa3')]([],_0x424e40);_[_0x979b('0xa4')](_0x123042,function(_0x2649d3){return!_0x3babff[_0x979b('0xa5')](_0x2649d3[_0x979b('0x23')]);});_0x123042[_0x979b('0xa6')](function(_0x5cd46f){var _0x1b4478=createFieldObject(_0x1fe5d2,_0xb91c44,_0x5cd46f[_0x979b('0xa7')],_0x5cd46f[_0x979b('0x23')],_0x5cd46f[_0x979b('0xa8')],![]);_0x24999a[_0x979b('0xa9')](_0x1b4478);});return Promise[_0x979b('0xaa')](_0x24999a);})[_0x979b('0x21')](function(_0x348ef0){_0x3ea3ab=_0x348ef0;_0x5b160f=Object['assign']([],_0x424e40);console['log'](_0x979b('0xab'),_0x424e40);_[_0x979b('0xa4')](_0x5b160f,function(_0x5e6c28){return _0x25891a[_0x979b('0xa5')](_0x5e6c28[_0x979b('0x23')]);});console[_0x979b('0xa1')](_0x979b('0xac'),_0x5b160f);_0x24999a=[];_0x5b160f['forEach'](function(_0x41461a){var _0x31c279=createFieldObject(_0x1fe5d2,_0xb91c44,_0x41461a[_0x979b('0xa7')],_0x41461a[_0x979b('0x23')],_0x41461a[_0x979b('0xa8')],!![]);_0x24999a[_0x979b('0xa9')](_0x31c279);});return Promise[_0x979b('0xaa')](_0x24999a);})['then'](function(_0x33832c){_0xefd6e7=_0x33832c;var _0x378546=_0x3ea3ab[_0x979b('0xad')](_0xefd6e7);return{'count':_0x378546['length'],'rows':_0x378546};})[_0x979b('0x21')](respondWithResult(_0x362ee5,null))[_0x979b('0x44')](function(_0x1efe40){console['log'](_0x979b('0xae')+_0x1efe40);var _0xc63efe=_0x16e5b1[_0x979b('0x2c')][_0x979b('0xaf')]?0x1f4:_0x1efe40[_0x979b('0xb0')]||0x1f4;logger[_0x979b('0xb1')](_0x1efe40[_0x979b('0xb2')]);delete _0x1efe40['name'];if(_0xc63efe===0x191){_0xc63efe=0x190;}_0x362ee5[_0x979b('0x17')](_0xc63efe)['send'](_0x16e5b1[_0x979b('0x2c')]['test']?{'message':_0x979b('0xb3'),'statusCode':_0x1efe40[_0x979b('0xb0')]}:_0x1efe40);});};function createFieldObject(_0x23bc00,_0x43bcce,_0x1aad87,_0x4edf83,_0x5e4a3b,_0x3d5b51){return new Promise(function(_0x2f7a0a,_0x6adca9){var _0x55531e={'id':_0x4edf83,'name':_0x5e4a3b,'custom':_0x3d5b51};if(_0x1aad87===_0x979b('0xb4')){_0x55531e[_0x979b('0x3d')]=[{'name':_0x979b('0xb5'),'value':_0x979b('0xb6')},{'name':_0x979b('0xb7'),'value':_0x979b('0xb8')}];_0x2f7a0a(_0x55531e);}else{var _0x5953af={'method':'GET','uri':_0x23bc00+'sys_choice?sysparm_query=name=incident^element='+_0x4edf83,'auth':_0x43bcce,'json':!![]};return rp(_0x5953af)['then'](function(_0xa2af97){var _0xf232ae=[];if(_0xa2af97[_0x979b('0xa0')][_0x979b('0x32')]>0x0){_0xa2af97[_0x979b('0xa0')][_0x979b('0xa6')](function(_0x179896){if(_0x179896[_0x979b('0xb9')]===_0x979b('0xb8')){var _0x509600={'name':_0x179896[_0x979b('0xa8')],'value':_0x179896['value']};_0xf232ae[_0x979b('0xa9')](_0x509600);}});}_0x55531e['options']=_0xf232ae;if(_0x55531e[_0x979b('0x3d')][_0x979b('0x32')]>0x0){_0x2f7a0a(_0x55531e);}else{if(_0x3d5b51==![]){_0x2f7a0a();}else{_0x2f7a0a(_0x55531e);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index e31b50e..93bf164 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 _0x3f8a=['exports','define','ServicenowAccount','int_servicenow_accounts','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x3f8a,0x1d5));var _0xa3f8=function(_0x508167,_0x2a24ec){_0x508167=_0x508167-0x0;var _0x5e7a78=_0x3f8a[_0x508167];return _0x5e7a78;};'use strict';var _=require(_0xa3f8('0x0'));var util=require(_0xa3f8('0x1'));var logger=require(_0xa3f8('0x2'))(_0xa3f8('0x3'));var moment=require('moment');var BPromise=require(_0xa3f8('0x4'));var rp=require(_0xa3f8('0x5'));var fs=require('fs');var path=require(_0xa3f8('0x6'));var rimraf=require(_0xa3f8('0x7'));var config=require(_0xa3f8('0x8'));var attributes=require(_0xa3f8('0x9'));var integrations=require(_0xa3f8('0xa'));module[_0xa3f8('0xb')]=function(_0x1f160a,_0xf895d9){return _0x1f160a[_0xa3f8('0xc')](_0xa3f8('0xd'),attributes,{'tableName':_0xa3f8('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4819=['request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','exports','define','ServicenowAccount','int_servicenow_accounts','util','../../config/logger','api','moment','bluebird'];(function(_0x20a388,_0x24afc7){var _0x28e560=function(_0x54226a){while(--_0x54226a){_0x20a388['push'](_0x20a388['shift']());}};_0x28e560(++_0x24afc7);}(_0x4819,0xcd));var _0x9481=function(_0x4d11e3,_0x2c2fca){_0x4d11e3=_0x4d11e3-0x0;var _0x3efe71=_0x4819[_0x4d11e3];return _0x3efe71;};'use strict';var _=require('lodash');var util=require(_0x9481('0x0'));var logger=require(_0x9481('0x1'))(_0x9481('0x2'));var moment=require(_0x9481('0x3'));var BPromise=require(_0x9481('0x4'));var rp=require(_0x9481('0x5'));var fs=require('fs');var path=require(_0x9481('0x6'));var rimraf=require(_0x9481('0x7'));var config=require(_0x9481('0x8'));var attributes=require(_0x9481('0x9'));var integrations=require('../../components/integrations/configuration');module[_0x9481('0xa')]=function(_0x5def07,_0x54cc78){return _0x5def07[_0x9481('0xb')](_0x9481('0xc'),attributes,{'tableName':_0x9481('0xd'),'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 1f43a28..6a74456 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 _0x5e83=['ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','debug','ShowServicenowAccount','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetServicenowAccount'];(function(_0x5d6180,_0x42e0c0){var _0x5a17ad=function(_0xbd76cc){while(--_0xbd76cc){_0x5d6180['push'](_0x5d6180['shift']());}};_0x5a17ad(++_0x42e0c0);}(_0x5e83,0x199));var _0x35e8=function(_0x4b043b,_0x598b17){_0x4b043b=_0x4b043b-0x0;var _0x398f5a=_0x5e83[_0x4b043b];return _0x398f5a;};'use strict';var _=require(_0x35e8('0x0'));var util=require(_0x35e8('0x1'));var moment=require(_0x35e8('0x2'));var BPromise=require(_0x35e8('0x3'));var rs=require(_0x35e8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x35e8('0x5'))['db'];var utils=require(_0x35e8('0x6'));var logger=require(_0x35e8('0x7'))(_0x35e8('0x8'));var config=require(_0x35e8('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x35e8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x81435a,_0x3217ba,_0x268da7){return new BPromise(function(_0x810121,_0xd8be8e){return client[_0x35e8('0xb')](_0x81435a,_0x268da7)[_0x35e8('0xc')](function(_0x50d2a0){logger['info'](_0x35e8('0xd'),_0x3217ba,_0x35e8('0xe'));logger['debug'](_0x35e8('0xf'),_0x3217ba,_0x35e8('0xe'),JSON[_0x35e8('0x10')](_0x50d2a0));if(_0x50d2a0[_0x35e8('0x11')]){if(_0x50d2a0[_0x35e8('0x11')]['code']===0x1f4){logger[_0x35e8('0x11')](_0x35e8('0xd'),_0x3217ba,_0x50d2a0[_0x35e8('0x11')][_0x35e8('0x12')]);return _0xd8be8e(_0x50d2a0[_0x35e8('0x11')][_0x35e8('0x12')]);}logger[_0x35e8('0x11')](_0x35e8('0xd'),_0x3217ba,_0x50d2a0[_0x35e8('0x11')][_0x35e8('0x12')]);return _0x810121(_0x50d2a0[_0x35e8('0x11')][_0x35e8('0x12')]);}else{logger[_0x35e8('0x13')](_0x35e8('0xd'),_0x3217ba,_0x35e8('0xe'));_0x810121(_0x50d2a0[_0x35e8('0x14')][_0x35e8('0x12')]);}})[_0x35e8('0x15')](function(_0xcb6dad){logger[_0x35e8('0x11')](_0x35e8('0xd'),_0x3217ba,_0xcb6dad);_0xd8be8e(_0xcb6dad);});});}exports[_0x35e8('0x16')]=function(_0x59ff80){var _0x1125b9=this;return new Promise(function(_0x359281,_0x4da03d){return db[_0x35e8('0x17')][_0x35e8('0x18')]({'raw':_0x59ff80['options']?_0x59ff80[_0x35e8('0x19')][_0x35e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x59ff80[_0x35e8('0x19')]?_0x59ff80[_0x35e8('0x19')][_0x35e8('0x1b')]||null:null,'attributes':_0x59ff80['options']?_0x59ff80[_0x35e8('0x19')][_0x35e8('0x1c')]||null:null,'limit':_0x59ff80[_0x35e8('0x19')]?_0x59ff80[_0x35e8('0x19')][_0x35e8('0x1d')]||null:null,'include':_0x59ff80[_0x35e8('0x19')]?_0x59ff80[_0x35e8('0x19')][_0x35e8('0x1e')]?_[_0x35e8('0x1f')](_0x59ff80[_0x35e8('0x19')][_0x35e8('0x1e')],function(_0xfaccf7){return{'model':db[_0xfaccf7[_0x35e8('0x20')]],'as':_0xfaccf7['as'],'attributes':_0xfaccf7[_0x35e8('0x1c')],'include':_0xfaccf7['include']?_[_0x35e8('0x1f')](_0xfaccf7[_0x35e8('0x1e')],function(_0x34541c){return{'model':db[_0x34541c['model']],'as':_0x34541c['as'],'attributes':_0x34541c[_0x35e8('0x1c')],'include':_0x34541c[_0x35e8('0x1e')]?_['map'](_0x34541c['include'],function(_0x41522a){return{'model':db[_0x41522a[_0x35e8('0x20')]],'as':_0x41522a['as'],'attributes':_0x41522a[_0x35e8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x35e8('0xc')](function(_0x2a75dd){logger['info'](_0x35e8('0x16'),_0x59ff80);logger[_0x35e8('0x21')](_0x35e8('0x16'),_0x59ff80,JSON['stringify'](_0x2a75dd));_0x359281(_0x2a75dd);})[_0x35e8('0x15')](function(_0x17a579){logger[_0x35e8('0x11')](_0x35e8('0x16'),_0x17a579[_0x35e8('0x12')],_0x59ff80);_0x4da03d(_0x1125b9[_0x35e8('0x11')](0x1f4,_0x17a579[_0x35e8('0x12')]));});});};exports[_0x35e8('0x22')]=function(_0x514d8d){var _0x3338d9=this;return new Promise(function(_0x1ab7df,_0xb7f0e5){return db[_0x35e8('0x17')][_0x35e8('0x23')]({'raw':_0x514d8d[_0x35e8('0x19')]?_0x514d8d['options'][_0x35e8('0x1a')]===undefined?!![]:![]:!![],'where':_0x514d8d[_0x35e8('0x19')]?_0x514d8d[_0x35e8('0x19')]['where']||null:null,'attributes':_0x514d8d[_0x35e8('0x19')]?_0x514d8d['options'][_0x35e8('0x1c')]||null:null,'include':_0x514d8d['options']?_0x514d8d[_0x35e8('0x19')][_0x35e8('0x1e')]?_[_0x35e8('0x1f')](_0x514d8d[_0x35e8('0x19')][_0x35e8('0x1e')],function(_0x25ce9f){return{'model':db[_0x25ce9f[_0x35e8('0x20')]],'as':_0x25ce9f['as'],'attributes':_0x25ce9f[_0x35e8('0x1c')],'include':_0x25ce9f[_0x35e8('0x1e')]?_[_0x35e8('0x1f')](_0x25ce9f[_0x35e8('0x1e')],function(_0x2fc9ac){return{'model':db[_0x2fc9ac[_0x35e8('0x20')]],'as':_0x2fc9ac['as'],'attributes':_0x2fc9ac[_0x35e8('0x1c')],'include':_0x2fc9ac[_0x35e8('0x1e')]?_['map'](_0x2fc9ac[_0x35e8('0x1e')],function(_0x37c096){return{'model':db[_0x37c096[_0x35e8('0x20')]],'as':_0x37c096['as'],'attributes':_0x37c096['attributes']};}):[]};}):[]};}):[]:[]})[_0x35e8('0xc')](function(_0x5bd42d){logger[_0x35e8('0x13')](_0x35e8('0x22'),_0x514d8d);logger[_0x35e8('0x21')](_0x35e8('0x22'),_0x514d8d,JSON[_0x35e8('0x10')](_0x5bd42d));_0x1ab7df(_0x5bd42d);})[_0x35e8('0x15')](function(_0x12afac){logger[_0x35e8('0x11')](_0x35e8('0x22'),_0x12afac['message'],_0x514d8d);_0xb7f0e5(_0x3338d9[_0x35e8('0x11')](0x1f4,_0x12afac['message']));});});}; \ No newline at end of file +var _0x6072=['info','result','GetServicenowAccount','ServicenowAccount','findAll','options','raw','where','attributes','limit','include','map','model','catch','find','ShowServicenowAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','ServicenowAccount,\x20%s,\x20%s','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x13df74,_0x575c94){var _0x574996=function(_0x3294c8){while(--_0x3294c8){_0x13df74['push'](_0x13df74['shift']());}};_0x574996(++_0x575c94);}(_0x6072,0x138));var _0x2607=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x6072[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0x2607('0x0'));var util=require(_0x2607('0x1'));var moment=require(_0x2607('0x2'));var BPromise=require(_0x2607('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2607('0x4'))['db'];var utils=require(_0x2607('0x5'));var logger=require(_0x2607('0x6'))(_0x2607('0x7'));var config=require(_0x2607('0x8'));var jayson=require(_0x2607('0x9'));var client=jayson[_0x2607('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f1009,_0x23bb27,_0x3dafda){return new BPromise(function(_0x398b5c,_0x2278b6){return client[_0x2607('0xb')](_0x2f1009,_0x3dafda)[_0x2607('0xc')](function(_0x3223f3){logger['info'](_0x2607('0xd'),_0x23bb27,_0x2607('0xe'));logger[_0x2607('0xf')](_0x2607('0x10'),_0x23bb27,'request\x20sent',JSON[_0x2607('0x11')](_0x3223f3));if(_0x3223f3[_0x2607('0x12')]){if(_0x3223f3[_0x2607('0x12')][_0x2607('0x13')]===0x1f4){logger['error'](_0x2607('0xd'),_0x23bb27,_0x3223f3[_0x2607('0x12')]['message']);return _0x2278b6(_0x3223f3[_0x2607('0x12')][_0x2607('0x14')]);}logger[_0x2607('0x12')](_0x2607('0xd'),_0x23bb27,_0x3223f3[_0x2607('0x12')][_0x2607('0x14')]);return _0x398b5c(_0x3223f3[_0x2607('0x12')]['message']);}else{logger[_0x2607('0x15')](_0x2607('0xd'),_0x23bb27,_0x2607('0xe'));_0x398b5c(_0x3223f3[_0x2607('0x16')][_0x2607('0x14')]);}})['catch'](function(_0x554b81){logger[_0x2607('0x12')](_0x2607('0xd'),_0x23bb27,_0x554b81);_0x2278b6(_0x554b81);});});}exports[_0x2607('0x17')]=function(_0x190130){var _0x3bcde6=this;return new Promise(function(_0x26d90b,_0x5b004e){return db[_0x2607('0x18')][_0x2607('0x19')]({'raw':_0x190130[_0x2607('0x1a')]?_0x190130['options'][_0x2607('0x1b')]===undefined?!![]:![]:!![],'where':_0x190130['options']?_0x190130[_0x2607('0x1a')][_0x2607('0x1c')]||null:null,'attributes':_0x190130[_0x2607('0x1a')]?_0x190130['options'][_0x2607('0x1d')]||null:null,'limit':_0x190130['options']?_0x190130[_0x2607('0x1a')][_0x2607('0x1e')]||null:null,'include':_0x190130[_0x2607('0x1a')]?_0x190130[_0x2607('0x1a')][_0x2607('0x1f')]?_[_0x2607('0x20')](_0x190130['options'][_0x2607('0x1f')],function(_0x41932b){return{'model':db[_0x41932b[_0x2607('0x21')]],'as':_0x41932b['as'],'attributes':_0x41932b[_0x2607('0x1d')],'include':_0x41932b[_0x2607('0x1f')]?_['map'](_0x41932b[_0x2607('0x1f')],function(_0x2f3e43){return{'model':db[_0x2f3e43['model']],'as':_0x2f3e43['as'],'attributes':_0x2f3e43[_0x2607('0x1d')],'include':_0x2f3e43['include']?_[_0x2607('0x20')](_0x2f3e43[_0x2607('0x1f')],function(_0x397509){return{'model':db[_0x397509['model']],'as':_0x397509['as'],'attributes':_0x397509[_0x2607('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3b24a7){logger[_0x2607('0x15')](_0x2607('0x17'),_0x190130);logger[_0x2607('0xf')]('GetServicenowAccount',_0x190130,JSON[_0x2607('0x11')](_0x3b24a7));_0x26d90b(_0x3b24a7);})[_0x2607('0x22')](function(_0x560754){logger[_0x2607('0x12')](_0x2607('0x17'),_0x560754['message'],_0x190130);_0x5b004e(_0x3bcde6['error'](0x1f4,_0x560754[_0x2607('0x14')]));});});};exports['ShowServicenowAccount']=function(_0x2dc578){var _0x773a7d=this;return new Promise(function(_0x2b5ceb,_0x5d6757){return db[_0x2607('0x18')][_0x2607('0x23')]({'raw':_0x2dc578['options']?_0x2dc578[_0x2607('0x1a')][_0x2607('0x1b')]===undefined?!![]:![]:!![],'where':_0x2dc578['options']?_0x2dc578[_0x2607('0x1a')][_0x2607('0x1c')]||null:null,'attributes':_0x2dc578['options']?_0x2dc578[_0x2607('0x1a')][_0x2607('0x1d')]||null:null,'include':_0x2dc578['options']?_0x2dc578['options']['include']?_[_0x2607('0x20')](_0x2dc578[_0x2607('0x1a')]['include'],function(_0x25b78c){return{'model':db[_0x25b78c['model']],'as':_0x25b78c['as'],'attributes':_0x25b78c[_0x2607('0x1d')],'include':_0x25b78c['include']?_['map'](_0x25b78c[_0x2607('0x1f')],function(_0x2e3768){return{'model':db[_0x2e3768[_0x2607('0x21')]],'as':_0x2e3768['as'],'attributes':_0x2e3768[_0x2607('0x1d')],'include':_0x2e3768[_0x2607('0x1f')]?_[_0x2607('0x20')](_0x2e3768[_0x2607('0x1f')],function(_0x134e33){return{'model':db[_0x134e33[_0x2607('0x21')]],'as':_0x134e33['as'],'attributes':_0x134e33[_0x2607('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x2607('0xc')](function(_0x1954a1){logger[_0x2607('0x15')](_0x2607('0x24'),_0x2dc578);logger[_0x2607('0xf')]('ShowServicenowAccount',_0x2dc578,JSON[_0x2607('0x11')](_0x1954a1));_0x2b5ceb(_0x1954a1);})['catch'](function(_0x3274d7){logger[_0x2607('0x12')](_0x2607('0x24'),_0x3274d7[_0x2607('0x14')],_0x2dc578);_0x5d6757(_0x773a7d[_0x2607('0x12')](0x1f4,_0x3274d7['message']));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index f740c91..8d0977b 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 _0x0f4e=['../../config/environment','./intServicenowConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','create','put','update','delete','destroy','exports','connect-timeout','Router','fs-extra','../../components/interaction/service'];(function(_0x127bc4,_0x2993e3){var _0xdae71b=function(_0x59913f){while(--_0x59913f){_0x127bc4['push'](_0x127bc4['shift']());}};_0xdae71b(++_0x2993e3);}(_0x0f4e,0x127));var _0xe0f4=function(_0x433778,_0xf42c22){_0x433778=_0x433778-0x0;var _0x2f530f=_0x0f4e[_0x433778];return _0x2f530f;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe0f4('0x0'));var express=require('express');var router=express[_0xe0f4('0x1')]();var fs_extra=require(_0xe0f4('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0xe0f4('0x3'));var config=require(_0xe0f4('0x4'));var controller=require(_0xe0f4('0x5'));router[_0xe0f4('0x6')]('/',auth[_0xe0f4('0x7')](),controller[_0xe0f4('0x8')]);router[_0xe0f4('0x6')](_0xe0f4('0x9'),auth['isAuthenticated'](),controller[_0xe0f4('0xa')]);router[_0xe0f4('0x6')](_0xe0f4('0xb'),auth[_0xe0f4('0x7')](),controller[_0xe0f4('0xc')]);router[_0xe0f4('0x6')](_0xe0f4('0xd'),auth[_0xe0f4('0x7')](),controller[_0xe0f4('0xe')]);router[_0xe0f4('0x6')](_0xe0f4('0xf'),auth[_0xe0f4('0x7')](),controller[_0xe0f4('0x10')]);router['post']('/',auth[_0xe0f4('0x7')](),controller[_0xe0f4('0x11')]);router[_0xe0f4('0x12')](_0xe0f4('0x9'),auth['isAuthenticated'](),controller[_0xe0f4('0x13')]);router[_0xe0f4('0x14')](_0xe0f4('0x9'),auth['isAuthenticated'](),controller[_0xe0f4('0x15')]);module[_0xe0f4('0x16')]=router; \ No newline at end of file +var _0x5907=['getSubjects','/:id/descriptions','getDescriptions','post','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields'];(function(_0x9468e5,_0x453cbe){var _0xd698a7=function(_0x3b79a6){while(--_0x3b79a6){_0x9468e5['push'](_0x9468e5['shift']());}};_0xd698a7(++_0x453cbe);}(_0x5907,0x1e5));var _0x7590=function(_0x1c9bc7,_0x5a76d0){_0x1c9bc7=_0x1c9bc7-0x0;var _0x299b41=_0x5907[_0x1c9bc7];return _0x299b41;};'use strict';var multer=require(_0x7590('0x0'));var util=require(_0x7590('0x1'));var path=require(_0x7590('0x2'));var timeout=require('connect-timeout');var express=require(_0x7590('0x3'));var router=express[_0x7590('0x4')]();var fs_extra=require(_0x7590('0x5'));var auth=require(_0x7590('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7590('0x7'));var controller=require(_0x7590('0x8'));router[_0x7590('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x7590('0x9')](_0x7590('0xa'),auth[_0x7590('0xb')](),controller[_0x7590('0xc')]);router[_0x7590('0x9')](_0x7590('0xd'),auth[_0x7590('0xb')](),controller[_0x7590('0xe')]);router['get']('/:id/subjects',auth[_0x7590('0xb')](),controller[_0x7590('0xf')]);router[_0x7590('0x9')](_0x7590('0x10'),auth[_0x7590('0xb')](),controller[_0x7590('0x11')]);router[_0x7590('0x12')]('/',auth['isAuthenticated'](),controller[_0x7590('0x13')]);router[_0x7590('0x14')](_0x7590('0xa'),auth[_0x7590('0xb')](),controller[_0x7590('0x15')]);router[_0x7590('0x16')](_0x7590('0xa'),auth[_0x7590('0xb')](),controller[_0x7590('0x17')]);module[_0x7590('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index 2975c8a..b4d5f95 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 _0x0573=['STRING','sequelize','exports'];(function(_0x17e61a,_0x13d01b){var _0x50534d=function(_0x1ccc26){while(--_0x1ccc26){_0x17e61a['push'](_0x17e61a['shift']());}};_0x50534d(++_0x13d01b);}(_0x0573,0x145));var _0x3057=function(_0x61d8a8,_0x565807){_0x61d8a8=_0x61d8a8-0x0;var _0x26b40f=_0x0573[_0x61d8a8];return _0x26b40f;};'use strict';var Sequelize=require(_0x3057('0x0'));module[_0x3057('0x1')]={'name':{'type':Sequelize[_0x3057('0x2')]},'description':{'type':Sequelize[_0x3057('0x2')]}}; \ No newline at end of file +var _0x45ae=['STRING','sequelize'];(function(_0x52fe2a,_0x257a7f){var _0x1b7af5=function(_0x1e5707){while(--_0x1e5707){_0x52fe2a['push'](_0x52fe2a['shift']());}};_0x1b7af5(++_0x257a7f);}(_0x45ae,0x16f));var _0xe45a=function(_0x550c66,_0x41d2b0){_0x550c66=_0x550c66-0x0;var _0x2db8c1=_0x45ae[_0x550c66];return _0x2db8c1;};'use strict';var Sequelize=require(_0xe45a('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe45a('0x1')]}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index ab14f55..2a751d0 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 _0x9589=['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/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','save','update','then','destroy','error','stack','name','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','model','query','keys','filters','fields','length','attributes','hasOwnProperty','nolimit','sort','where','pick','merge','options','includeAll','include','findAll','rows','catch','params','intersection','find','create','body','getFields','findOne','order','filter','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','moment'];(function(_0x53a4a8,_0x2b7a12){var _0x204a6c=function(_0x3c64b6){while(--_0x3c64b6){_0x53a4a8['push'](_0x53a4a8['shift']());}};_0x204a6c(++_0x2b7a12);}(_0x9589,0x1a4));var _0x9958=function(_0x7d07e7,_0x3cb284){_0x7d07e7=_0x7d07e7-0x0;var _0x5501b4=_0x9589[_0x7d07e7];return _0x5501b4;};'use strict';var emlformat=require(_0x9958('0x0'));var rimraf=require(_0x9958('0x1'));var zipdir=require(_0x9958('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9958('0x3'));var moment=require(_0x9958('0x4'));var BPromise=require(_0x9958('0x5'));var Mustache=require(_0x9958('0x6'));var util=require(_0x9958('0x7'));var path=require(_0x9958('0x8'));var sox=require(_0x9958('0x9'));var csv=require(_0x9958('0xa'));var ejs=require(_0x9958('0xb'));var fs=require('fs');var fs_extra=require(_0x9958('0xc'));var _=require(_0x9958('0xd'));var squel=require(_0x9958('0xe'));var crypto=require(_0x9958('0xf'));var jsforce=require(_0x9958('0x10'));var deskjs=require(_0x9958('0x11'));var toCsv=require(_0x9958('0xa'));var querystring=require(_0x9958('0x12'));var Papa=require(_0x9958('0x13'));var Redis=require(_0x9958('0x14'));var authService=require(_0x9958('0x15'));var qs=require(_0x9958('0x16'));var as=require(_0x9958('0x17'));var hardwareService=require(_0x9958('0x18'));var logger=require(_0x9958('0x19'))(_0x9958('0x1a'));var utils=require('../../config/utils');var config=require(_0x9958('0x1b'));var licenseUtil=require(_0x9958('0x1c'));var db=require(_0x9958('0x1d'))['db'];function respondWithStatusCode(_0x46947f,_0x4374f0){_0x4374f0=_0x4374f0||0xcc;return function(_0x428dfe){if(_0x428dfe){return _0x46947f[_0x9958('0x1e')](_0x4374f0);}return _0x46947f['status'](_0x4374f0)[_0x9958('0x1f')]();};}function respondWithResult(_0x253695,_0x5a9306){_0x5a9306=_0x5a9306||0xc8;return function(_0x185f6a){if(_0x185f6a){return _0x253695[_0x9958('0x20')](_0x5a9306)[_0x9958('0x21')](_0x185f6a);}};}function respondWithFilteredResult(_0x5c6ea5,_0xb3db22){return function(_0x2417e3){if(_0x2417e3){var _0x2d9aa4=typeof _0xb3db22['offset']===_0x9958('0x22')&&typeof _0xb3db22[_0x9958('0x23')]===_0x9958('0x22');var _0x52495a=_0x2417e3[_0x9958('0x24')];var _0x530c67=_0x2d9aa4?0x0:_0xb3db22[_0x9958('0x25')];var _0x197f27=_0x2d9aa4?_0x2417e3[_0x9958('0x24')]:_0xb3db22['offset']+_0xb3db22[_0x9958('0x23')];var _0x595d99;if(_0x197f27>=_0x52495a){_0x197f27=_0x52495a;_0x595d99=0xc8;}else{_0x595d99=0xce;}_0x5c6ea5[_0x9958('0x20')](_0x595d99);return _0x5c6ea5['set']('Content-Range',_0x530c67+'-'+_0x197f27+'/'+_0x52495a)['json'](_0x2417e3);}return null;};}function patchUpdates(_0x4f431f){return function(_0x139798){try{jsonpatch[_0x9958('0x26')](_0x139798,_0x4f431f,!![]);}catch(_0x405c12){return BPromise[_0x9958('0x27')](_0x405c12);}return _0x139798[_0x9958('0x28')]();};}function saveUpdates(_0x143fd3,_0x12d65c){return function(_0x2fc359){if(_0x2fc359){return _0x2fc359[_0x9958('0x29')](_0x143fd3)[_0x9958('0x2a')](function(_0x1645a3){return _0x1645a3;});}return null;};}function removeEntity(_0x3db587,_0x4ed564){return function(_0x5c1f76){if(_0x5c1f76){return _0x5c1f76[_0x9958('0x2b')]()[_0x9958('0x2a')](function(){_0x3db587[_0x9958('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x355e78,_0x269ce5){return function(_0x18874e){if(!_0x18874e){_0x355e78[_0x9958('0x1e')](0x194);}return _0x18874e;};}function handleError(_0x1ad67e,_0x4761fd){_0x4761fd=_0x4761fd||0x1f4;return function(_0x2c9037){logger[_0x9958('0x2c')](_0x2c9037[_0x9958('0x2d')]);if(_0x2c9037[_0x9958('0x2e')]){delete _0x2c9037['name'];}_0x1ad67e[_0x9958('0x20')](_0x4761fd)['send'](_0x2c9037);};}exports[_0x9958('0x2f')]=function(_0x820b05,_0x513c5a){var _0x498093={},_0x598319={},_0x593f05={'count':0x0,'rows':[]};var _0x55b151=_[_0x9958('0x30')](db[_0x9958('0x31')][_0x9958('0x32')],function(_0x32c696){return{'name':_0x32c696[_0x9958('0x33')],'type':_0x32c696[_0x9958('0x34')][_0x9958('0x35')]};});_0x598319[_0x9958('0x36')]=_[_0x9958('0x30')](_0x55b151,_0x9958('0x2e'));_0x598319[_0x9958('0x37')]=_[_0x9958('0x38')](_0x820b05['query']);_0x598319[_0x9958('0x39')]=_['intersection'](_0x598319[_0x9958('0x36')],_0x598319[_0x9958('0x37')]);_0x498093['attributes']=_['intersection'](_0x598319[_0x9958('0x36')],qs[_0x9958('0x3a')](_0x820b05[_0x9958('0x37')]['fields']));_0x498093['attributes']=_0x498093['attributes'][_0x9958('0x3b')]?_0x498093[_0x9958('0x3c')]:_0x598319[_0x9958('0x36')];if(!_0x820b05[_0x9958('0x37')][_0x9958('0x3d')](_0x9958('0x3e'))){_0x498093['limit']=qs[_0x9958('0x23')](_0x820b05[_0x9958('0x37')]['limit']);_0x498093[_0x9958('0x25')]=qs[_0x9958('0x25')](_0x820b05[_0x9958('0x37')]['offset']);}_0x498093['order']=qs[_0x9958('0x3f')](_0x820b05[_0x9958('0x37')][_0x9958('0x3f')]);_0x498093[_0x9958('0x40')]=qs[_0x9958('0x39')](_[_0x9958('0x41')](_0x820b05[_0x9958('0x37')],_0x598319[_0x9958('0x39')]),_0x55b151);if(_0x820b05[_0x9958('0x37')]['filter']){_0x498093[_0x9958('0x40')]=_[_0x9958('0x42')](_0x498093[_0x9958('0x40')],{'$or':_[_0x9958('0x30')](_0x55b151,function(_0x236a0e){if(_0x236a0e[_0x9958('0x34')]!=='VIRTUAL'){var _0x5b9346={};_0x5b9346[_0x236a0e['name']]={'$like':'%'+_0x820b05[_0x9958('0x37')]['filter']+'%'};return _0x5b9346;}})});}_0x498093=_[_0x9958('0x42')]({},_0x498093,_0x820b05[_0x9958('0x43')]);var _0x50d5ee={'where':_0x498093[_0x9958('0x40')]};return db[_0x9958('0x31')][_0x9958('0x24')](_0x50d5ee)[_0x9958('0x2a')](function(_0x22a723){_0x593f05['count']=_0x22a723;if(_0x820b05[_0x9958('0x37')][_0x9958('0x44')]){_0x498093[_0x9958('0x45')]=[{'all':!![]}];}return db[_0x9958('0x31')][_0x9958('0x46')](_0x498093);})[_0x9958('0x2a')](function(_0x1ab5f8){_0x593f05[_0x9958('0x47')]=_0x1ab5f8;return _0x593f05;})[_0x9958('0x2a')](respondWithFilteredResult(_0x513c5a,_0x498093))[_0x9958('0x48')](handleError(_0x513c5a,null));};exports['show']=function(_0x50d7e4,_0x357564){var _0x3f4967={'raw':![],'where':{'id':_0x50d7e4[_0x9958('0x49')]['id']}},_0x552fc9={};_0x552fc9[_0x9958('0x36')]=_['keys'](db[_0x9958('0x31')][_0x9958('0x32')]);_0x552fc9[_0x9958('0x37')]=_[_0x9958('0x38')](_0x50d7e4[_0x9958('0x37')]);_0x552fc9[_0x9958('0x39')]=_['intersection'](_0x552fc9['model'],_0x552fc9['query']);_0x3f4967[_0x9958('0x3c')]=_[_0x9958('0x4a')](_0x552fc9['model'],qs[_0x9958('0x3a')](_0x50d7e4['query'][_0x9958('0x3a')]));_0x3f4967[_0x9958('0x3c')]=_0x3f4967[_0x9958('0x3c')][_0x9958('0x3b')]?_0x3f4967[_0x9958('0x3c')]:_0x552fc9[_0x9958('0x36')];if(_0x50d7e4[_0x9958('0x37')][_0x9958('0x44')]){_0x3f4967[_0x9958('0x45')]=[{'all':!![]}];}_0x3f4967=_[_0x9958('0x42')]({},_0x3f4967,_0x50d7e4[_0x9958('0x43')]);return db[_0x9958('0x31')][_0x9958('0x4b')](_0x3f4967)[_0x9958('0x2a')](handleEntityNotFound(_0x357564,null))[_0x9958('0x2a')](respondWithResult(_0x357564,null))['catch'](handleError(_0x357564,null));};exports[_0x9958('0x4c')]=function(_0x3fd2a8,_0x35f932){return db[_0x9958('0x31')][_0x9958('0x4c')](_0x3fd2a8['body'],{})['then'](respondWithResult(_0x35f932,0xc9))[_0x9958('0x48')](handleError(_0x35f932,null));};exports[_0x9958('0x29')]=function(_0x1fa399,_0x5dc0dd){if(_0x1fa399[_0x9958('0x4d')]['id']){delete _0x1fa399['body']['id'];}return db[_0x9958('0x31')]['find']({'where':{'id':_0x1fa399[_0x9958('0x49')]['id']}})[_0x9958('0x2a')](handleEntityNotFound(_0x5dc0dd,null))['then'](saveUpdates(_0x1fa399['body'],null))[_0x9958('0x2a')](respondWithResult(_0x5dc0dd,null))[_0x9958('0x48')](handleError(_0x5dc0dd,null));};exports['destroy']=function(_0x4f22a2,_0xf44187){return db[_0x9958('0x31')][_0x9958('0x4b')]({'where':{'id':_0x4f22a2[_0x9958('0x49')]['id']}})[_0x9958('0x2a')](handleEntityNotFound(_0xf44187,null))[_0x9958('0x2a')](removeEntity(_0xf44187,null))[_0x9958('0x48')](handleError(_0xf44187,null));};exports[_0x9958('0x4e')]=function(_0x259015,_0x56ecc8,_0x2bd2b4){var _0x4b924f={};var _0x1c0f8e={};var _0x5c08a2;var _0x4e49e9;return db['ServicenowConfiguration'][_0x9958('0x4f')]({'where':{'id':_0x259015[_0x9958('0x49')]['id']}})[_0x9958('0x2a')](handleEntityNotFound(_0x56ecc8,null))[_0x9958('0x2a')](function(_0x417528){if(_0x417528){_0x5c08a2=_0x417528;_0x1c0f8e['model']=_['keys'](db['ServicenowField'][_0x9958('0x32')]);_0x1c0f8e[_0x9958('0x37')]=_['keys'](_0x259015[_0x9958('0x37')]);_0x1c0f8e[_0x9958('0x39')]=_[_0x9958('0x4a')](_0x1c0f8e[_0x9958('0x36')],_0x1c0f8e[_0x9958('0x37')]);_0x4b924f[_0x9958('0x3c')]=_[_0x9958('0x4a')](_0x1c0f8e[_0x9958('0x36')],qs[_0x9958('0x3a')](_0x259015[_0x9958('0x37')][_0x9958('0x3a')]));_0x4b924f[_0x9958('0x3c')]=_0x4b924f[_0x9958('0x3c')][_0x9958('0x3b')]?_0x4b924f[_0x9958('0x3c')]:_0x1c0f8e[_0x9958('0x36')];_0x4b924f[_0x9958('0x50')]=qs[_0x9958('0x3f')](_0x259015[_0x9958('0x37')][_0x9958('0x3f')]);_0x4b924f[_0x9958('0x40')]=qs[_0x9958('0x39')](_[_0x9958('0x41')](_0x259015[_0x9958('0x37')],_0x1c0f8e[_0x9958('0x39')]));if(_0x259015[_0x9958('0x37')][_0x9958('0x51')]){_0x4b924f[_0x9958('0x40')]=_[_0x9958('0x42')](_0x4b924f[_0x9958('0x40')],{'$or':_[_0x9958('0x30')](_0x4b924f[_0x9958('0x3c')],function(_0x41cd9c){var _0x1c7720={};_0x1c7720[_0x41cd9c]={'$like':'%'+_0x259015[_0x9958('0x37')][_0x9958('0x51')]+'%'};return _0x1c7720;})});}_0x4b924f=_[_0x9958('0x42')]({},_0x4b924f,_0x259015['options']);return _0x5c08a2[_0x9958('0x4e')](_0x4b924f);}})[_0x9958('0x2a')](function(_0x25dbd7){if(_0x25dbd7){_0x4e49e9=_0x25dbd7[_0x9958('0x3b')];if(!_0x259015[_0x9958('0x37')][_0x9958('0x3d')](_0x9958('0x3e'))){_0x4b924f[_0x9958('0x23')]=qs[_0x9958('0x23')](_0x259015[_0x9958('0x37')][_0x9958('0x23')]);_0x4b924f[_0x9958('0x25')]=qs['offset'](_0x259015[_0x9958('0x37')][_0x9958('0x25')]);}return _0x5c08a2[_0x9958('0x4e')](_0x4b924f);}})['then'](function(_0x227c3e){if(_0x227c3e){return _0x227c3e?{'count':_0x4e49e9,'rows':_0x227c3e}:null;}})[_0x9958('0x2a')](respondWithResult(_0x56ecc8,null))[_0x9958('0x48')](handleError(_0x56ecc8,null));};exports['getSubjects']=function(_0xdb786d,_0x1c94ac,_0xba9995){var _0x452916={};var _0x11319b={};var _0x1e4467;var _0xf23320;return db['ServicenowConfiguration'][_0x9958('0x4f')]({'where':{'id':_0xdb786d['params']['id']}})[_0x9958('0x2a')](handleEntityNotFound(_0x1c94ac,null))[_0x9958('0x2a')](function(_0x2d2254){if(_0x2d2254){_0x1e4467=_0x2d2254;_0x11319b[_0x9958('0x36')]=_['keys'](db[_0x9958('0x52')][_0x9958('0x32')]);_0x11319b[_0x9958('0x37')]=_[_0x9958('0x38')](_0xdb786d[_0x9958('0x37')]);_0x11319b['filters']=_['intersection'](_0x11319b[_0x9958('0x36')],_0x11319b[_0x9958('0x37')]);_0x452916[_0x9958('0x3c')]=_[_0x9958('0x4a')](_0x11319b['model'],qs['fields'](_0xdb786d[_0x9958('0x37')][_0x9958('0x3a')]));_0x452916[_0x9958('0x3c')]=_0x452916[_0x9958('0x3c')]['length']?_0x452916[_0x9958('0x3c')]:_0x11319b[_0x9958('0x36')];_0x452916[_0x9958('0x50')]=qs[_0x9958('0x3f')](_0xdb786d['query'][_0x9958('0x3f')]);_0x452916[_0x9958('0x40')]=qs['filters'](_['pick'](_0xdb786d[_0x9958('0x37')],_0x11319b[_0x9958('0x39')]));if(_0xdb786d[_0x9958('0x37')][_0x9958('0x51')]){_0x452916[_0x9958('0x40')]=_[_0x9958('0x42')](_0x452916[_0x9958('0x40')],{'$or':_['map'](_0x452916[_0x9958('0x3c')],function(_0x2f9f38){var _0x296c7f={};_0x296c7f[_0x2f9f38]={'$like':'%'+_0xdb786d[_0x9958('0x37')]['filter']+'%'};return _0x296c7f;})});}_0x452916=_[_0x9958('0x42')]({},_0x452916,_0xdb786d['options']);return _0x1e4467[_0x9958('0x53')](_0x452916);}})[_0x9958('0x2a')](function(_0x1660e5){if(_0x1660e5){_0xf23320=_0x1660e5['length'];if(!_0xdb786d[_0x9958('0x37')]['hasOwnProperty'](_0x9958('0x3e'))){_0x452916[_0x9958('0x23')]=qs['limit'](_0xdb786d[_0x9958('0x37')][_0x9958('0x23')]);_0x452916[_0x9958('0x25')]=qs[_0x9958('0x25')](_0xdb786d[_0x9958('0x37')][_0x9958('0x25')]);}return _0x1e4467[_0x9958('0x53')](_0x452916);}})[_0x9958('0x2a')](function(_0x460599){if(_0x460599){return _0x460599?{'count':_0xf23320,'rows':_0x460599}:null;}})[_0x9958('0x2a')](respondWithResult(_0x1c94ac,null))[_0x9958('0x48')](handleError(_0x1c94ac,null));};exports[_0x9958('0x54')]=function(_0x1835fd,_0x22aba1,_0x1b4057){var _0x3b4fe6={};var _0x4143c0={};var _0x220bf2;var _0x2a1a5c;return db[_0x9958('0x31')][_0x9958('0x4f')]({'where':{'id':_0x1835fd['params']['id']}})[_0x9958('0x2a')](handleEntityNotFound(_0x22aba1,null))[_0x9958('0x2a')](function(_0x175be3){if(_0x175be3){_0x220bf2=_0x175be3;_0x4143c0[_0x9958('0x36')]=_[_0x9958('0x38')](db[_0x9958('0x52')][_0x9958('0x32')]);_0x4143c0[_0x9958('0x37')]=_['keys'](_0x1835fd[_0x9958('0x37')]);_0x4143c0[_0x9958('0x39')]=_[_0x9958('0x4a')](_0x4143c0[_0x9958('0x36')],_0x4143c0[_0x9958('0x37')]);_0x3b4fe6['attributes']=_[_0x9958('0x4a')](_0x4143c0[_0x9958('0x36')],qs[_0x9958('0x3a')](_0x1835fd[_0x9958('0x37')][_0x9958('0x3a')]));_0x3b4fe6[_0x9958('0x3c')]=_0x3b4fe6[_0x9958('0x3c')][_0x9958('0x3b')]?_0x3b4fe6[_0x9958('0x3c')]:_0x4143c0[_0x9958('0x36')];_0x3b4fe6[_0x9958('0x50')]=qs[_0x9958('0x3f')](_0x1835fd[_0x9958('0x37')][_0x9958('0x3f')]);_0x3b4fe6[_0x9958('0x40')]=qs[_0x9958('0x39')](_[_0x9958('0x41')](_0x1835fd[_0x9958('0x37')],_0x4143c0[_0x9958('0x39')]));if(_0x1835fd[_0x9958('0x37')][_0x9958('0x51')]){_0x3b4fe6[_0x9958('0x40')]=_[_0x9958('0x42')](_0x3b4fe6[_0x9958('0x40')],{'$or':_[_0x9958('0x30')](_0x3b4fe6['attributes'],function(_0x1195a8){var _0x4171d3={};_0x4171d3[_0x1195a8]={'$like':'%'+_0x1835fd[_0x9958('0x37')][_0x9958('0x51')]+'%'};return _0x4171d3;})});}_0x3b4fe6=_['merge']({},_0x3b4fe6,_0x1835fd[_0x9958('0x43')]);return _0x220bf2[_0x9958('0x54')](_0x3b4fe6);}})[_0x9958('0x2a')](function(_0x65cd2f){if(_0x65cd2f){_0x2a1a5c=_0x65cd2f[_0x9958('0x3b')];if(!_0x1835fd[_0x9958('0x37')][_0x9958('0x3d')](_0x9958('0x3e'))){_0x3b4fe6[_0x9958('0x23')]=qs['limit'](_0x1835fd[_0x9958('0x37')]['limit']);_0x3b4fe6[_0x9958('0x25')]=qs[_0x9958('0x25')](_0x1835fd[_0x9958('0x37')][_0x9958('0x25')]);}return _0x220bf2[_0x9958('0x54')](_0x3b4fe6);}})[_0x9958('0x2a')](function(_0x435bd7){if(_0x435bd7){return _0x435bd7?{'count':_0x2a1a5c,'rows':_0x435bd7}:null;}})['then'](respondWithResult(_0x22aba1,null))[_0x9958('0x48')](handleError(_0x22aba1,null));}; \ No newline at end of file +var _0x6c69=['send','index','ServicenowConfiguration','type','key','model','map','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filters','merge','filter','options','then','include','findAll','rows','catch','show','params','rawAttributes','includeAll','find','create','body','getFields','findOne','ServicenowField','length','order','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','error','name'];(function(_0x36a25a,_0x1a1439){var _0x5a9078=function(_0x36b362){while(--_0x36b362){_0x36a25a['push'](_0x36a25a['shift']());}};_0x5a9078(++_0x1a1439);}(_0x6c69,0x1b3));var _0x96c6=function(_0x33b627,_0xcd64e0){_0x33b627=_0x33b627-0x0;var _0x531df0=_0x6c69[_0x33b627];return _0x531df0;};'use strict';var emlformat=require(_0x96c6('0x0'));var rimraf=require(_0x96c6('0x1'));var zipdir=require(_0x96c6('0x2'));var jsonpatch=require(_0x96c6('0x3'));var rp=require('request-promise');var moment=require(_0x96c6('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x96c6('0x5'));var csv=require(_0x96c6('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x96c6('0x7'));var _=require(_0x96c6('0x8'));var squel=require(_0x96c6('0x9'));var crypto=require(_0x96c6('0xa'));var jsforce=require(_0x96c6('0xb'));var deskjs=require(_0x96c6('0xc'));var toCsv=require(_0x96c6('0x6'));var querystring=require('querystring');var Papa=require(_0x96c6('0xd'));var Redis=require(_0x96c6('0xe'));var authService=require(_0x96c6('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x96c6('0x10'));var hardwareService=require(_0x96c6('0x11'));var logger=require(_0x96c6('0x12'))(_0x96c6('0x13'));var utils=require(_0x96c6('0x14'));var config=require(_0x96c6('0x15'));var licenseUtil=require(_0x96c6('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xea110,_0x31d5fe){_0x31d5fe=_0x31d5fe||0xcc;return function(_0x2e29e8){if(_0x2e29e8){return _0xea110[_0x96c6('0x17')](_0x31d5fe);}return _0xea110[_0x96c6('0x18')](_0x31d5fe)[_0x96c6('0x19')]();};}function respondWithResult(_0x4fb6d9,_0x5577eb){_0x5577eb=_0x5577eb||0xc8;return function(_0x246524){if(_0x246524){return _0x4fb6d9[_0x96c6('0x18')](_0x5577eb)[_0x96c6('0x1a')](_0x246524);}};}function respondWithFilteredResult(_0x682f48,_0x128c91){return function(_0x4ae74e){if(_0x4ae74e){var _0x339a31=typeof _0x128c91[_0x96c6('0x1b')]===_0x96c6('0x1c')&&typeof _0x128c91[_0x96c6('0x1d')]==='undefined';var _0x58672f=_0x4ae74e[_0x96c6('0x1e')];var _0x12209a=_0x339a31?0x0:_0x128c91[_0x96c6('0x1b')];var _0x1fb6b1=_0x339a31?_0x4ae74e['count']:_0x128c91[_0x96c6('0x1b')]+_0x128c91[_0x96c6('0x1d')];var _0x44e0b1;if(_0x1fb6b1>=_0x58672f){_0x1fb6b1=_0x58672f;_0x44e0b1=0xc8;}else{_0x44e0b1=0xce;}_0x682f48[_0x96c6('0x18')](_0x44e0b1);return _0x682f48[_0x96c6('0x1f')]('Content-Range',_0x12209a+'-'+_0x1fb6b1+'/'+_0x58672f)[_0x96c6('0x1a')](_0x4ae74e);}return null;};}function patchUpdates(_0x1adc11){return function(_0x593c38){try{jsonpatch[_0x96c6('0x20')](_0x593c38,_0x1adc11,!![]);}catch(_0x54517b){return BPromise[_0x96c6('0x21')](_0x54517b);}return _0x593c38[_0x96c6('0x22')]();};}function saveUpdates(_0x29cf45,_0x54a3cd){return function(_0x350ae3){if(_0x350ae3){return _0x350ae3[_0x96c6('0x23')](_0x29cf45)['then'](function(_0x178919){return _0x178919;});}return null;};}function removeEntity(_0x2ad791,_0x13016e){return function(_0x48dd3b){if(_0x48dd3b){return _0x48dd3b[_0x96c6('0x24')]()['then'](function(){_0x2ad791[_0x96c6('0x18')](0xcc)[_0x96c6('0x19')]();});}};}function handleEntityNotFound(_0x3ef1b4,_0x3f07da){return function(_0x40b053){if(!_0x40b053){_0x3ef1b4[_0x96c6('0x17')](0x194);}return _0x40b053;};}function handleError(_0x126861,_0xc59d63){_0xc59d63=_0xc59d63||0x1f4;return function(_0x1aa4c7){logger[_0x96c6('0x25')](_0x1aa4c7['stack']);if(_0x1aa4c7[_0x96c6('0x26')]){delete _0x1aa4c7['name'];}_0x126861['status'](_0xc59d63)[_0x96c6('0x27')](_0x1aa4c7);};}exports[_0x96c6('0x28')]=function(_0x3faae6,_0x151bfd){var _0x1c8689={},_0x45f530={},_0x3c8252={'count':0x0,'rows':[]};var _0x49ffec=_['map'](db[_0x96c6('0x29')]['rawAttributes'],function(_0xfe743b){return{'name':_0xfe743b['fieldName'],'type':_0xfe743b[_0x96c6('0x2a')][_0x96c6('0x2b')]};});_0x45f530[_0x96c6('0x2c')]=_[_0x96c6('0x2d')](_0x49ffec,'name');_0x45f530[_0x96c6('0x2e')]=_[_0x96c6('0x2f')](_0x3faae6[_0x96c6('0x2e')]);_0x45f530['filters']=_['intersection'](_0x45f530[_0x96c6('0x2c')],_0x45f530['query']);_0x1c8689[_0x96c6('0x30')]=_[_0x96c6('0x31')](_0x45f530[_0x96c6('0x2c')],qs[_0x96c6('0x32')](_0x3faae6[_0x96c6('0x2e')]['fields']));_0x1c8689[_0x96c6('0x30')]=_0x1c8689[_0x96c6('0x30')]['length']?_0x1c8689[_0x96c6('0x30')]:_0x45f530['model'];if(!_0x3faae6[_0x96c6('0x2e')][_0x96c6('0x33')](_0x96c6('0x34'))){_0x1c8689['limit']=qs[_0x96c6('0x1d')](_0x3faae6[_0x96c6('0x2e')]['limit']);_0x1c8689[_0x96c6('0x1b')]=qs['offset'](_0x3faae6['query'][_0x96c6('0x1b')]);}_0x1c8689['order']=qs['sort'](_0x3faae6[_0x96c6('0x2e')][_0x96c6('0x35')]);_0x1c8689[_0x96c6('0x36')]=qs['filters'](_[_0x96c6('0x37')](_0x3faae6[_0x96c6('0x2e')],_0x45f530[_0x96c6('0x38')]),_0x49ffec);if(_0x3faae6[_0x96c6('0x2e')]['filter']){_0x1c8689[_0x96c6('0x36')]=_[_0x96c6('0x39')](_0x1c8689[_0x96c6('0x36')],{'$or':_[_0x96c6('0x2d')](_0x49ffec,function(_0x5f361c){if(_0x5f361c[_0x96c6('0x2a')]!=='VIRTUAL'){var _0x227f0b={};_0x227f0b[_0x5f361c[_0x96c6('0x26')]]={'$like':'%'+_0x3faae6[_0x96c6('0x2e')][_0x96c6('0x3a')]+'%'};return _0x227f0b;}})});}_0x1c8689=_['merge']({},_0x1c8689,_0x3faae6[_0x96c6('0x3b')]);var _0x479d78={'where':_0x1c8689[_0x96c6('0x36')]};return db[_0x96c6('0x29')][_0x96c6('0x1e')](_0x479d78)[_0x96c6('0x3c')](function(_0x1c4a73){_0x3c8252[_0x96c6('0x1e')]=_0x1c4a73;if(_0x3faae6['query']['includeAll']){_0x1c8689[_0x96c6('0x3d')]=[{'all':!![]}];}return db[_0x96c6('0x29')][_0x96c6('0x3e')](_0x1c8689);})[_0x96c6('0x3c')](function(_0x1f6042){_0x3c8252[_0x96c6('0x3f')]=_0x1f6042;return _0x3c8252;})['then'](respondWithFilteredResult(_0x151bfd,_0x1c8689))[_0x96c6('0x40')](handleError(_0x151bfd,null));};exports[_0x96c6('0x41')]=function(_0x4a96b8,_0x123f09){var _0x64d25b={'raw':![],'where':{'id':_0x4a96b8[_0x96c6('0x42')]['id']}},_0x2fffc2={};_0x2fffc2[_0x96c6('0x2c')]=_[_0x96c6('0x2f')](db[_0x96c6('0x29')][_0x96c6('0x43')]);_0x2fffc2[_0x96c6('0x2e')]=_[_0x96c6('0x2f')](_0x4a96b8['query']);_0x2fffc2[_0x96c6('0x38')]=_[_0x96c6('0x31')](_0x2fffc2['model'],_0x2fffc2[_0x96c6('0x2e')]);_0x64d25b[_0x96c6('0x30')]=_[_0x96c6('0x31')](_0x2fffc2['model'],qs[_0x96c6('0x32')](_0x4a96b8[_0x96c6('0x2e')][_0x96c6('0x32')]));_0x64d25b[_0x96c6('0x30')]=_0x64d25b[_0x96c6('0x30')]['length']?_0x64d25b[_0x96c6('0x30')]:_0x2fffc2[_0x96c6('0x2c')];if(_0x4a96b8[_0x96c6('0x2e')][_0x96c6('0x44')]){_0x64d25b[_0x96c6('0x3d')]=[{'all':!![]}];}_0x64d25b=_['merge']({},_0x64d25b,_0x4a96b8[_0x96c6('0x3b')]);return db[_0x96c6('0x29')][_0x96c6('0x45')](_0x64d25b)[_0x96c6('0x3c')](handleEntityNotFound(_0x123f09,null))['then'](respondWithResult(_0x123f09,null))[_0x96c6('0x40')](handleError(_0x123f09,null));};exports[_0x96c6('0x46')]=function(_0x10f98b,_0x42322d){return db[_0x96c6('0x29')][_0x96c6('0x46')](_0x10f98b[_0x96c6('0x47')],{})['then'](respondWithResult(_0x42322d,0xc9))[_0x96c6('0x40')](handleError(_0x42322d,null));};exports[_0x96c6('0x23')]=function(_0x5f37d9,_0x1a99b2){if(_0x5f37d9[_0x96c6('0x47')]['id']){delete _0x5f37d9['body']['id'];}return db[_0x96c6('0x29')][_0x96c6('0x45')]({'where':{'id':_0x5f37d9[_0x96c6('0x42')]['id']}})[_0x96c6('0x3c')](handleEntityNotFound(_0x1a99b2,null))[_0x96c6('0x3c')](saveUpdates(_0x5f37d9[_0x96c6('0x47')],null))['then'](respondWithResult(_0x1a99b2,null))['catch'](handleError(_0x1a99b2,null));};exports[_0x96c6('0x24')]=function(_0x5682ff,_0x56b111){return db[_0x96c6('0x29')]['find']({'where':{'id':_0x5682ff[_0x96c6('0x42')]['id']}})[_0x96c6('0x3c')](handleEntityNotFound(_0x56b111,null))['then'](removeEntity(_0x56b111,null))[_0x96c6('0x40')](handleError(_0x56b111,null));};exports[_0x96c6('0x48')]=function(_0x3010b3,_0x3bddab,_0x14a560){var _0x49216e={};var _0x12bba4={};var _0x4b41d6;var _0x43d00b;return db[_0x96c6('0x29')][_0x96c6('0x49')]({'where':{'id':_0x3010b3[_0x96c6('0x42')]['id']}})[_0x96c6('0x3c')](handleEntityNotFound(_0x3bddab,null))[_0x96c6('0x3c')](function(_0xd52758){if(_0xd52758){_0x4b41d6=_0xd52758;_0x12bba4[_0x96c6('0x2c')]=_[_0x96c6('0x2f')](db[_0x96c6('0x4a')][_0x96c6('0x43')]);_0x12bba4[_0x96c6('0x2e')]=_['keys'](_0x3010b3['query']);_0x12bba4['filters']=_[_0x96c6('0x31')](_0x12bba4[_0x96c6('0x2c')],_0x12bba4[_0x96c6('0x2e')]);_0x49216e[_0x96c6('0x30')]=_[_0x96c6('0x31')](_0x12bba4[_0x96c6('0x2c')],qs[_0x96c6('0x32')](_0x3010b3[_0x96c6('0x2e')][_0x96c6('0x32')]));_0x49216e[_0x96c6('0x30')]=_0x49216e[_0x96c6('0x30')][_0x96c6('0x4b')]?_0x49216e[_0x96c6('0x30')]:_0x12bba4[_0x96c6('0x2c')];_0x49216e[_0x96c6('0x4c')]=qs['sort'](_0x3010b3[_0x96c6('0x2e')]['sort']);_0x49216e[_0x96c6('0x36')]=qs[_0x96c6('0x38')](_[_0x96c6('0x37')](_0x3010b3[_0x96c6('0x2e')],_0x12bba4['filters']));if(_0x3010b3['query']['filter']){_0x49216e['where']=_[_0x96c6('0x39')](_0x49216e['where'],{'$or':_[_0x96c6('0x2d')](_0x49216e[_0x96c6('0x30')],function(_0xa6dc5e){var _0x457837={};_0x457837[_0xa6dc5e]={'$like':'%'+_0x3010b3[_0x96c6('0x2e')][_0x96c6('0x3a')]+'%'};return _0x457837;})});}_0x49216e=_['merge']({},_0x49216e,_0x3010b3[_0x96c6('0x3b')]);return _0x4b41d6[_0x96c6('0x48')](_0x49216e);}})[_0x96c6('0x3c')](function(_0x4680f6){if(_0x4680f6){_0x43d00b=_0x4680f6['length'];if(!_0x3010b3[_0x96c6('0x2e')][_0x96c6('0x33')](_0x96c6('0x34'))){_0x49216e[_0x96c6('0x1d')]=qs[_0x96c6('0x1d')](_0x3010b3[_0x96c6('0x2e')][_0x96c6('0x1d')]);_0x49216e['offset']=qs['offset'](_0x3010b3[_0x96c6('0x2e')][_0x96c6('0x1b')]);}return _0x4b41d6['getFields'](_0x49216e);}})[_0x96c6('0x3c')](function(_0x3bf214){if(_0x3bf214){return _0x3bf214?{'count':_0x43d00b,'rows':_0x3bf214}:null;}})[_0x96c6('0x3c')](respondWithResult(_0x3bddab,null))[_0x96c6('0x40')](handleError(_0x3bddab,null));};exports[_0x96c6('0x4d')]=function(_0x13151c,_0xb32a0a,_0xce585){var _0x3aacd9={};var _0x422123={};var _0xd0a0fe;var _0x244e37;return db[_0x96c6('0x29')]['findOne']({'where':{'id':_0x13151c[_0x96c6('0x42')]['id']}})[_0x96c6('0x3c')](handleEntityNotFound(_0xb32a0a,null))[_0x96c6('0x3c')](function(_0x1470b0){if(_0x1470b0){_0xd0a0fe=_0x1470b0;_0x422123[_0x96c6('0x2c')]=_[_0x96c6('0x2f')](db['ServicenowField']['rawAttributes']);_0x422123['query']=_[_0x96c6('0x2f')](_0x13151c[_0x96c6('0x2e')]);_0x422123['filters']=_['intersection'](_0x422123['model'],_0x422123[_0x96c6('0x2e')]);_0x3aacd9['attributes']=_['intersection'](_0x422123[_0x96c6('0x2c')],qs[_0x96c6('0x32')](_0x13151c[_0x96c6('0x2e')]['fields']));_0x3aacd9['attributes']=_0x3aacd9[_0x96c6('0x30')][_0x96c6('0x4b')]?_0x3aacd9['attributes']:_0x422123[_0x96c6('0x2c')];_0x3aacd9[_0x96c6('0x4c')]=qs[_0x96c6('0x35')](_0x13151c[_0x96c6('0x2e')]['sort']);_0x3aacd9[_0x96c6('0x36')]=qs[_0x96c6('0x38')](_[_0x96c6('0x37')](_0x13151c['query'],_0x422123[_0x96c6('0x38')]));if(_0x13151c[_0x96c6('0x2e')]['filter']){_0x3aacd9[_0x96c6('0x36')]=_[_0x96c6('0x39')](_0x3aacd9[_0x96c6('0x36')],{'$or':_[_0x96c6('0x2d')](_0x3aacd9[_0x96c6('0x30')],function(_0x85fb6a){var _0x44d834={};_0x44d834[_0x85fb6a]={'$like':'%'+_0x13151c[_0x96c6('0x2e')][_0x96c6('0x3a')]+'%'};return _0x44d834;})});}_0x3aacd9=_['merge']({},_0x3aacd9,_0x13151c[_0x96c6('0x3b')]);return _0xd0a0fe[_0x96c6('0x4d')](_0x3aacd9);}})[_0x96c6('0x3c')](function(_0x388864){if(_0x388864){_0x244e37=_0x388864[_0x96c6('0x4b')];if(!_0x13151c[_0x96c6('0x2e')][_0x96c6('0x33')]('nolimit')){_0x3aacd9[_0x96c6('0x1d')]=qs['limit'](_0x13151c[_0x96c6('0x2e')][_0x96c6('0x1d')]);_0x3aacd9[_0x96c6('0x1b')]=qs['offset'](_0x13151c[_0x96c6('0x2e')]['offset']);}return _0xd0a0fe[_0x96c6('0x4d')](_0x3aacd9);}})[_0x96c6('0x3c')](function(_0x12a011){if(_0x12a011){return _0x12a011?{'count':_0x244e37,'rows':_0x12a011}:null;}})[_0x96c6('0x3c')](respondWithResult(_0xb32a0a,null))['catch'](handleError(_0xb32a0a,null));};exports[_0x96c6('0x4e')]=function(_0xb45cff,_0x1b44a6,_0x46199e){var _0x8d6e4d={};var _0x1486e0={};var _0x25a012;var _0x25b346;return db[_0x96c6('0x29')][_0x96c6('0x49')]({'where':{'id':_0xb45cff[_0x96c6('0x42')]['id']}})[_0x96c6('0x3c')](handleEntityNotFound(_0x1b44a6,null))[_0x96c6('0x3c')](function(_0x587bfe){if(_0x587bfe){_0x25a012=_0x587bfe;_0x1486e0[_0x96c6('0x2c')]=_['keys'](db[_0x96c6('0x4a')][_0x96c6('0x43')]);_0x1486e0['query']=_[_0x96c6('0x2f')](_0xb45cff[_0x96c6('0x2e')]);_0x1486e0[_0x96c6('0x38')]=_[_0x96c6('0x31')](_0x1486e0[_0x96c6('0x2c')],_0x1486e0[_0x96c6('0x2e')]);_0x8d6e4d[_0x96c6('0x30')]=_[_0x96c6('0x31')](_0x1486e0['model'],qs[_0x96c6('0x32')](_0xb45cff[_0x96c6('0x2e')][_0x96c6('0x32')]));_0x8d6e4d[_0x96c6('0x30')]=_0x8d6e4d[_0x96c6('0x30')][_0x96c6('0x4b')]?_0x8d6e4d[_0x96c6('0x30')]:_0x1486e0[_0x96c6('0x2c')];_0x8d6e4d[_0x96c6('0x4c')]=qs[_0x96c6('0x35')](_0xb45cff[_0x96c6('0x2e')][_0x96c6('0x35')]);_0x8d6e4d['where']=qs['filters'](_[_0x96c6('0x37')](_0xb45cff[_0x96c6('0x2e')],_0x1486e0['filters']));if(_0xb45cff[_0x96c6('0x2e')][_0x96c6('0x3a')]){_0x8d6e4d[_0x96c6('0x36')]=_[_0x96c6('0x39')](_0x8d6e4d['where'],{'$or':_[_0x96c6('0x2d')](_0x8d6e4d[_0x96c6('0x30')],function(_0x4f27b6){var _0x3df365={};_0x3df365[_0x4f27b6]={'$like':'%'+_0xb45cff[_0x96c6('0x2e')][_0x96c6('0x3a')]+'%'};return _0x3df365;})});}_0x8d6e4d=_['merge']({},_0x8d6e4d,_0xb45cff[_0x96c6('0x3b')]);return _0x25a012['getDescriptions'](_0x8d6e4d);}})[_0x96c6('0x3c')](function(_0x3cba5c){if(_0x3cba5c){_0x25b346=_0x3cba5c['length'];if(!_0xb45cff[_0x96c6('0x2e')]['hasOwnProperty'](_0x96c6('0x34'))){_0x8d6e4d[_0x96c6('0x1d')]=qs[_0x96c6('0x1d')](_0xb45cff[_0x96c6('0x2e')][_0x96c6('0x1d')]);_0x8d6e4d['offset']=qs['offset'](_0xb45cff['query'][_0x96c6('0x1b')]);}return _0x25a012[_0x96c6('0x4e')](_0x8d6e4d);}})[_0x96c6('0x3c')](function(_0x6d8b4){if(_0x6d8b4){return _0x6d8b4?{'count':_0x25b346,'rows':_0x6d8b4}:null;}})[_0x96c6('0x3c')](respondWithResult(_0x1b44a6,null))[_0x96c6('0x40')](handleError(_0x1b44a6,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index 34f9af3..a3e9270 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 _0x17d1=['./intServicenowConfiguration.attributes','ServicenowConfiguration','int_servicenow_configurations','lodash','util','moment','bluebird','rimraf','../../config/environment'];(function(_0x3e059a,_0x338e47){var _0x10ab24=function(_0x3343ab){while(--_0x3343ab){_0x3e059a['push'](_0x3e059a['shift']());}};_0x10ab24(++_0x338e47);}(_0x17d1,0xc9));var _0x117d=function(_0x270db4,_0x1943db){_0x270db4=_0x270db4-0x0;var _0x112540=_0x17d1[_0x270db4];return _0x112540;};'use strict';var _=require(_0x117d('0x0'));var util=require(_0x117d('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x117d('0x2'));var BPromise=require(_0x117d('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x117d('0x4'));var config=require(_0x117d('0x5'));var attributes=require(_0x117d('0x6'));module['exports']=function(_0x5ecbc9,_0x336b5f){return _0x5ecbc9['define'](_0x117d('0x7'),attributes,{'tableName':_0x117d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1e24=['lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x1e24,0x82));var _0x41e2=function(_0x3de873,_0x174b5f){_0x3de873=_0x3de873-0x0;var _0x380b8c=_0x1e24[_0x3de873];return _0x380b8c;};'use strict';var _=require(_0x41e2('0x0'));var util=require(_0x41e2('0x1'));var logger=require(_0x41e2('0x2'))(_0x41e2('0x3'));var moment=require('moment');var BPromise=require(_0x41e2('0x4'));var rp=require(_0x41e2('0x5'));var fs=require('fs');var path=require(_0x41e2('0x6'));var rimraf=require(_0x41e2('0x7'));var config=require('../../config/environment');var attributes=require(_0x41e2('0x8'));module[_0x41e2('0x9')]=function(_0x2c07fb,_0x2bc3fe){return _0x2c07fb[_0x41e2('0xa')](_0x41e2('0xb'),attributes,{'tableName':_0x41e2('0xc'),'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 f2a42fd..5d1cad8 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 _0x914a=['moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','request','then','info','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','util'];(function(_0x53d789,_0x4d0c57){var _0x3d9a85=function(_0x6bf9f){while(--_0x6bf9f){_0x53d789['push'](_0x53d789['shift']());}};_0x3d9a85(++_0x4d0c57);}(_0x914a,0x18e));var _0xa914=function(_0x3fafb9,_0x5d6612){_0x3fafb9=_0x3fafb9-0x0;var _0xada4d4=_0x914a[_0x3fafb9];return _0xada4d4;};'use strict';var _=require('lodash');var util=require(_0xa914('0x0'));var moment=require(_0xa914('0x1'));var BPromise=require(_0xa914('0x2'));var rs=require(_0xa914('0x3'));var fs=require('fs');var Redis=require(_0xa914('0x4'));var db=require(_0xa914('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa914('0x6'));var config=require('../../config/environment');var jayson=require(_0xa914('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x53ba0d,_0x444665,_0x15ee83){return new BPromise(function(_0x59826b,_0x155a70){return client[_0xa914('0x8')](_0x53ba0d,_0x15ee83)[_0xa914('0x9')](function(_0x43b0c1){logger[_0xa914('0xa')]('ServicenowConfiguration,\x20%s,\x20%s',_0x444665,_0xa914('0xb'));logger[_0xa914('0xc')](_0xa914('0xd'),_0x444665,_0xa914('0xb'),JSON[_0xa914('0xe')](_0x43b0c1));if(_0x43b0c1[_0xa914('0xf')]){if(_0x43b0c1['error'][_0xa914('0x10')]===0x1f4){logger['error'](_0xa914('0x11'),_0x444665,_0x43b0c1[_0xa914('0xf')]['message']);return _0x155a70(_0x43b0c1[_0xa914('0xf')]['message']);}logger[_0xa914('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x444665,_0x43b0c1['error'][_0xa914('0x12')]);return _0x59826b(_0x43b0c1['error'][_0xa914('0x12')]);}else{logger['info'](_0xa914('0x11'),_0x444665,_0xa914('0xb'));_0x59826b(_0x43b0c1[_0xa914('0x13')][_0xa914('0x12')]);}})[_0xa914('0x14')](function(_0x17b1c9){logger[_0xa914('0xf')](_0xa914('0x11'),_0x444665,_0x17b1c9);_0x155a70(_0x17b1c9);});});} \ No newline at end of file +var _0xe51f=['request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ServicenowConfiguration,\x20%s,\x20%s'];(function(_0x323591,_0x518650){var _0x423982=function(_0x1b7a15){while(--_0x1b7a15){_0x323591['push'](_0x323591['shift']());}};_0x423982(++_0x518650);}(_0xe51f,0xaa));var _0xfe51=function(_0x301d7b,_0xecc77a){_0x301d7b=_0x301d7b-0x0;var _0x5347cd=_0xe51f[_0x301d7b];return _0x5347cd;};'use strict';var _=require(_0xfe51('0x0'));var util=require(_0xfe51('0x1'));var moment=require('moment');var BPromise=require(_0xfe51('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe51('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfe51('0x4'));var logger=require(_0xfe51('0x5'))(_0xfe51('0x6'));var config=require(_0xfe51('0x7'));var jayson=require(_0xfe51('0x8'));var client=jayson[_0xfe51('0x9')][_0xfe51('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x12091a,_0x10a4d1,_0x23a504){return new BPromise(function(_0x2e1ade,_0x5a03ef){return client[_0xfe51('0xb')](_0x12091a,_0x23a504)['then'](function(_0x26b536){logger[_0xfe51('0xc')](_0xfe51('0xd'),_0x10a4d1,_0xfe51('0xe'));logger[_0xfe51('0xf')](_0xfe51('0x10'),_0x10a4d1,'request\x20sent',JSON[_0xfe51('0x11')](_0x26b536));if(_0x26b536[_0xfe51('0x12')]){if(_0x26b536[_0xfe51('0x12')][_0xfe51('0x13')]===0x1f4){logger[_0xfe51('0x12')](_0xfe51('0xd'),_0x10a4d1,_0x26b536[_0xfe51('0x12')][_0xfe51('0x14')]);return _0x5a03ef(_0x26b536['error'][_0xfe51('0x14')]);}logger['error'](_0xfe51('0xd'),_0x10a4d1,_0x26b536[_0xfe51('0x12')][_0xfe51('0x14')]);return _0x2e1ade(_0x26b536[_0xfe51('0x12')][_0xfe51('0x14')]);}else{logger[_0xfe51('0xc')](_0xfe51('0xd'),_0x10a4d1,_0xfe51('0xe'));_0x2e1ade(_0x26b536[_0xfe51('0x15')][_0xfe51('0x14')]);}})[_0xfe51('0x16')](function(_0x172ac3){logger[_0xfe51('0x12')](_0xfe51('0xd'),_0x10a4d1,_0x172ac3);_0x5a03ef(_0x172ac3);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index e6810d5..76c3d21 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 _0x718b=['create','put','update','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','isAuthenticated','index','/:id','show','post'];(function(_0x4d6fcd,_0x31daf4){var _0x476220=function(_0x462c5a){while(--_0x462c5a){_0x4d6fcd['push'](_0x4d6fcd['shift']());}};_0x476220(++_0x31daf4);}(_0x718b,0xdd));var _0xb718=function(_0x17158c,_0x58cb92){_0x17158c=_0x17158c-0x0;var _0x734f31=_0x718b[_0x17158c];return _0x734f31;};'use strict';var multer=require(_0xb718('0x0'));var util=require(_0xb718('0x1'));var path=require('path');var timeout=require(_0xb718('0x2'));var express=require('express');var router=express[_0xb718('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb718('0x4'));var interaction=require(_0xb718('0x5'));var config=require(_0xb718('0x6'));var controller=require(_0xb718('0x7'));router['get']('/',auth[_0xb718('0x8')](),controller[_0xb718('0x9')]);router['get'](_0xb718('0xa'),auth[_0xb718('0x8')](),controller[_0xb718('0xb')]);router[_0xb718('0xc')]('/',auth[_0xb718('0x8')](),controller[_0xb718('0xd')]);router[_0xb718('0xe')](_0xb718('0xa'),auth[_0xb718('0x8')](),controller[_0xb718('0xf')]);router['delete'](_0xb718('0xa'),auth[_0xb718('0x8')](),controller[_0xb718('0x10')]);module[_0xb718('0x11')]=router; \ No newline at end of file +var _0x9b29=['/:id','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','show','post','put','delete'];(function(_0x21d7a2,_0x5aecda){var _0x1da981=function(_0x4c86f2){while(--_0x4c86f2){_0x21d7a2['push'](_0x21d7a2['shift']());}};_0x1da981(++_0x5aecda);}(_0x9b29,0x1f0));var _0x99b2=function(_0x408f8a,_0x56e30c){_0x408f8a=_0x408f8a-0x0;var _0x462f88=_0x9b29[_0x408f8a];return _0x462f88;};'use strict';var multer=require(_0x99b2('0x0'));var util=require(_0x99b2('0x1'));var path=require(_0x99b2('0x2'));var timeout=require(_0x99b2('0x3'));var express=require(_0x99b2('0x4'));var router=express[_0x99b2('0x5')]();var fs_extra=require(_0x99b2('0x6'));var auth=require(_0x99b2('0x7'));var interaction=require(_0x99b2('0x8'));var config=require(_0x99b2('0x9'));var controller=require(_0x99b2('0xa'));router[_0x99b2('0xb')]('/',auth[_0x99b2('0xc')](),controller['index']);router[_0x99b2('0xb')]('/:id',auth['isAuthenticated'](),controller[_0x99b2('0xd')]);router[_0x99b2('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x99b2('0xf')]('/:id',auth[_0x99b2('0xc')](),controller['update']);router[_0x99b2('0x10')](_0x99b2('0x11'),auth[_0x99b2('0xc')](),controller[_0x99b2('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 2ea6692..6b8f48c 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 _0x8c62=['exports','variable','customVariable','keyValue','string','STRING','ENUM','sequelize'];(function(_0x4208f3,_0x5a92d4){var _0x2744d2=function(_0x4f8fcf){while(--_0x4f8fcf){_0x4208f3['push'](_0x4208f3['shift']());}};_0x2744d2(++_0x5a92d4);}(_0x8c62,0x15f));var _0x28c6=function(_0x3e3fc2,_0x44d130){_0x3e3fc2=_0x3e3fc2-0x0;var _0x478f57=_0x8c62[_0x3e3fc2];return _0x478f57;};'use strict';var Sequelize=require(_0x28c6('0x0'));module[_0x28c6('0x1')]={'type':{'type':Sequelize['ENUM']('string',_0x28c6('0x2'),_0x28c6('0x3'),_0x28c6('0x4'),'picklist'),'defaultValue':_0x28c6('0x5')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x28c6('0x6')]},'keyType':{'type':Sequelize[_0x28c6('0x7')](_0x28c6('0x5'),_0x28c6('0x2'),_0x28c6('0x3'))},'keyContent':{'type':Sequelize[_0x28c6('0x6')]},'idField':{'type':Sequelize[_0x28c6('0x6')]},'nameField':{'type':Sequelize[_0x28c6('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x28c6('0x6')]}}; \ No newline at end of file +var _0xeee6=['exports','ENUM','variable','customVariable','keyValue','STRING','string','sequelize'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xeee6,0x107));var _0x6eee=function(_0x37dc97,_0x1e2915){_0x37dc97=_0x37dc97-0x0;var _0x12895f=_0xeee6[_0x37dc97];return _0x12895f;};'use strict';var Sequelize=require(_0x6eee('0x0'));module[_0x6eee('0x1')]={'type':{'type':Sequelize[_0x6eee('0x2')]('string',_0x6eee('0x3'),_0x6eee('0x4'),_0x6eee('0x5'),'picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0x6eee('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x6eee('0x2')](_0x6eee('0x7'),_0x6eee('0x3'),_0x6eee('0x4'))},'keyContent':{'type':Sequelize[_0x6eee('0x6')]},'idField':{'type':Sequelize[_0x6eee('0x6')]},'nameField':{'type':Sequelize[_0x6eee('0x6')]},'customField':{'type':Sequelize['BOOLEAN'],'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 8f882ca..37d9bf2 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 _0x6ad5=['order','where','pick','merge','VIRTUAL','filter','options','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','update','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','save','destroy','then','error','stack','name','send','index','ServicenowField','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit'];(function(_0x51009d,_0x2fdcdb){var _0x18f32d=function(_0x53122a){while(--_0x53122a){_0x51009d['push'](_0x51009d['shift']());}};_0x18f32d(++_0x2fdcdb);}(_0x6ad5,0x1a4));var _0x56ad=function(_0x425540,_0x97a491){_0x425540=_0x425540-0x0;var _0x117693=_0x6ad5[_0x425540];return _0x117693;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x56ad('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x56ad('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x56ad('0x2'));var Mustache=require(_0x56ad('0x3'));var util=require(_0x56ad('0x4'));var path=require(_0x56ad('0x5'));var sox=require(_0x56ad('0x6'));var csv=require(_0x56ad('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x56ad('0x8'));var _=require(_0x56ad('0x9'));var squel=require('squel');var crypto=require(_0x56ad('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x56ad('0xb'));var toCsv=require(_0x56ad('0x7'));var querystring=require(_0x56ad('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x56ad('0xd'));var qs=require('../../components/parsers/qs');var as=require(_0x56ad('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x56ad('0xf'));var config=require(_0x56ad('0x10'));var licenseUtil=require(_0x56ad('0x11'));var db=require(_0x56ad('0x12'))['db'];function respondWithStatusCode(_0x2b1b79,_0x2c5f75){_0x2c5f75=_0x2c5f75||0xcc;return function(_0xa0326b){if(_0xa0326b){return _0x2b1b79[_0x56ad('0x13')](_0x2c5f75);}return _0x2b1b79['status'](_0x2c5f75)[_0x56ad('0x14')]();};}function respondWithResult(_0x2773d4,_0x34de62){_0x34de62=_0x34de62||0xc8;return function(_0x317f4b){if(_0x317f4b){return _0x2773d4[_0x56ad('0x15')](_0x34de62)[_0x56ad('0x16')](_0x317f4b);}};}function respondWithFilteredResult(_0x567710,_0x5f2009){return function(_0x286213){if(_0x286213){var _0x37664f=typeof _0x5f2009[_0x56ad('0x17')]===_0x56ad('0x18')&&typeof _0x5f2009[_0x56ad('0x19')]==='undefined';var _0x28e904=_0x286213[_0x56ad('0x1a')];var _0x543b88=_0x37664f?0x0:_0x5f2009[_0x56ad('0x17')];var _0x5e8e3e=_0x37664f?_0x286213[_0x56ad('0x1a')]:_0x5f2009[_0x56ad('0x17')]+_0x5f2009[_0x56ad('0x19')];var _0x35d1e3;if(_0x5e8e3e>=_0x28e904){_0x5e8e3e=_0x28e904;_0x35d1e3=0xc8;}else{_0x35d1e3=0xce;}_0x567710[_0x56ad('0x15')](_0x35d1e3);return _0x567710[_0x56ad('0x1b')]('Content-Range',_0x543b88+'-'+_0x5e8e3e+'/'+_0x28e904)['json'](_0x286213);}return null;};}function patchUpdates(_0x756339){return function(_0x3344ae){try{jsonpatch[_0x56ad('0x1c')](_0x3344ae,_0x756339,!![]);}catch(_0x5587df){return BPromise['reject'](_0x5587df);}return _0x3344ae[_0x56ad('0x1d')]();};}function saveUpdates(_0x440a2c,_0xe67ad0){return function(_0x47e7d1){if(_0x47e7d1){return _0x47e7d1['update'](_0x440a2c)['then'](function(_0x55d75f){return _0x55d75f;});}return null;};}function removeEntity(_0x2d3fa9,_0x5177b3){return function(_0x740cbe){if(_0x740cbe){return _0x740cbe[_0x56ad('0x1e')]()[_0x56ad('0x1f')](function(){_0x2d3fa9[_0x56ad('0x15')](0xcc)[_0x56ad('0x14')]();});}};}function handleEntityNotFound(_0x16b47b,_0x19e968){return function(_0x3ad2f5){if(!_0x3ad2f5){_0x16b47b[_0x56ad('0x13')](0x194);}return _0x3ad2f5;};}function handleError(_0x3f3841,_0x3666bd){_0x3666bd=_0x3666bd||0x1f4;return function(_0x2f858a){logger[_0x56ad('0x20')](_0x2f858a[_0x56ad('0x21')]);if(_0x2f858a[_0x56ad('0x22')]){delete _0x2f858a[_0x56ad('0x22')];}_0x3f3841[_0x56ad('0x15')](_0x3666bd)[_0x56ad('0x23')](_0x2f858a);};}exports[_0x56ad('0x24')]=function(_0x331f43,_0x333523){var _0xd0d7b3={},_0x53718f={},_0x5a00f4={'count':0x0,'rows':[]};var _0x20d34c=_['map'](db[_0x56ad('0x25')]['rawAttributes'],function(_0x4c516e){return{'name':_0x4c516e['fieldName'],'type':_0x4c516e[_0x56ad('0x26')][_0x56ad('0x27')]};});_0x53718f[_0x56ad('0x28')]=_['map'](_0x20d34c,_0x56ad('0x22'));_0x53718f[_0x56ad('0x29')]=_[_0x56ad('0x2a')](_0x331f43[_0x56ad('0x29')]);_0x53718f[_0x56ad('0x2b')]=_[_0x56ad('0x2c')](_0x53718f['model'],_0x53718f[_0x56ad('0x29')]);_0xd0d7b3[_0x56ad('0x2d')]=_[_0x56ad('0x2c')](_0x53718f['model'],qs[_0x56ad('0x2e')](_0x331f43['query'][_0x56ad('0x2e')]));_0xd0d7b3[_0x56ad('0x2d')]=_0xd0d7b3[_0x56ad('0x2d')][_0x56ad('0x2f')]?_0xd0d7b3[_0x56ad('0x2d')]:_0x53718f[_0x56ad('0x28')];if(!_0x331f43[_0x56ad('0x29')]['hasOwnProperty'](_0x56ad('0x30'))){_0xd0d7b3[_0x56ad('0x19')]=qs[_0x56ad('0x19')](_0x331f43[_0x56ad('0x29')][_0x56ad('0x19')]);_0xd0d7b3[_0x56ad('0x17')]=qs[_0x56ad('0x17')](_0x331f43[_0x56ad('0x29')][_0x56ad('0x17')]);}_0xd0d7b3[_0x56ad('0x31')]=qs['sort'](_0x331f43['query']['sort']);_0xd0d7b3[_0x56ad('0x32')]=qs[_0x56ad('0x2b')](_[_0x56ad('0x33')](_0x331f43[_0x56ad('0x29')],_0x53718f[_0x56ad('0x2b')]),_0x20d34c);if(_0x331f43[_0x56ad('0x29')]['filter']){_0xd0d7b3[_0x56ad('0x32')]=_[_0x56ad('0x34')](_0xd0d7b3['where'],{'$or':_['map'](_0x20d34c,function(_0x4bb435){if(_0x4bb435[_0x56ad('0x26')]!==_0x56ad('0x35')){var _0x4b8726={};_0x4b8726[_0x4bb435[_0x56ad('0x22')]]={'$like':'%'+_0x331f43[_0x56ad('0x29')][_0x56ad('0x36')]+'%'};return _0x4b8726;}})});}_0xd0d7b3=_[_0x56ad('0x34')]({},_0xd0d7b3,_0x331f43[_0x56ad('0x37')]);var _0xb6632b={'where':_0xd0d7b3[_0x56ad('0x32')]};return db[_0x56ad('0x25')][_0x56ad('0x1a')](_0xb6632b)['then'](function(_0x2edfa2){_0x5a00f4['count']=_0x2edfa2;if(_0x331f43[_0x56ad('0x29')]['includeAll']){_0xd0d7b3[_0x56ad('0x38')]=[{'all':!![]}];}return db[_0x56ad('0x25')][_0x56ad('0x39')](_0xd0d7b3);})[_0x56ad('0x1f')](function(_0x48583d){_0x5a00f4[_0x56ad('0x3a')]=_0x48583d;return _0x5a00f4;})[_0x56ad('0x1f')](respondWithFilteredResult(_0x333523,_0xd0d7b3))[_0x56ad('0x3b')](handleError(_0x333523,null));};exports[_0x56ad('0x3c')]=function(_0x6b924e,_0x4ef9ac){var _0xadf268={'raw':!![],'where':{'id':_0x6b924e[_0x56ad('0x3d')]['id']}},_0x36de2f={};_0x36de2f[_0x56ad('0x28')]=_[_0x56ad('0x2a')](db[_0x56ad('0x25')][_0x56ad('0x3e')]);_0x36de2f[_0x56ad('0x29')]=_[_0x56ad('0x2a')](_0x6b924e[_0x56ad('0x29')]);_0x36de2f['filters']=_['intersection'](_0x36de2f[_0x56ad('0x28')],_0x36de2f[_0x56ad('0x29')]);_0xadf268[_0x56ad('0x2d')]=_[_0x56ad('0x2c')](_0x36de2f[_0x56ad('0x28')],qs[_0x56ad('0x2e')](_0x6b924e[_0x56ad('0x29')][_0x56ad('0x2e')]));_0xadf268['attributes']=_0xadf268['attributes'][_0x56ad('0x2f')]?_0xadf268[_0x56ad('0x2d')]:_0x36de2f[_0x56ad('0x28')];if(_0x6b924e[_0x56ad('0x29')]['includeAll']){_0xadf268[_0x56ad('0x38')]=[{'all':!![]}];}_0xadf268=_[_0x56ad('0x34')]({},_0xadf268,_0x6b924e[_0x56ad('0x37')]);return db[_0x56ad('0x25')][_0x56ad('0x3f')](_0xadf268)[_0x56ad('0x1f')](handleEntityNotFound(_0x4ef9ac,null))[_0x56ad('0x1f')](respondWithResult(_0x4ef9ac,null))[_0x56ad('0x3b')](handleError(_0x4ef9ac,null));};exports['create']=function(_0x2862e9,_0x1c46ca){return db[_0x56ad('0x25')][_0x56ad('0x40')](_0x2862e9[_0x56ad('0x41')],{})[_0x56ad('0x1f')](respondWithResult(_0x1c46ca,0xc9))['catch'](handleError(_0x1c46ca,null));};exports[_0x56ad('0x42')]=function(_0xc16f5,_0x328603){if(_0xc16f5[_0x56ad('0x41')]['id']){delete _0xc16f5[_0x56ad('0x41')]['id'];}return db['ServicenowField'][_0x56ad('0x3f')]({'where':{'id':_0xc16f5['params']['id']}})[_0x56ad('0x1f')](handleEntityNotFound(_0x328603,null))[_0x56ad('0x1f')](saveUpdates(_0xc16f5[_0x56ad('0x41')],null))['then'](respondWithResult(_0x328603,null))[_0x56ad('0x3b')](handleError(_0x328603,null));};exports['destroy']=function(_0x8503e6,_0x5fe2dd){return db[_0x56ad('0x25')][_0x56ad('0x3f')]({'where':{'id':_0x8503e6[_0x56ad('0x3d')]['id']}})['then'](handleEntityNotFound(_0x5fe2dd,null))['then'](removeEntity(_0x5fe2dd,null))[_0x56ad('0x3b')](handleError(_0x5fe2dd,null));}; \ No newline at end of file +var _0xfb88=['ServicenowField','rawAttributes','fieldName','type','key','model','keys','filters','attributes','intersection','fields','query','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','rows','show','params','length','include','options','find','catch','create','body','update','fast-json-patch','moment','bluebird','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/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','destroy','error','stack','name','send','map'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xfb88,0x1d7));var _0x8fb8=function(_0x33190c,_0x483589){_0x33190c=_0x33190c-0x0;var _0x465647=_0xfb88[_0x33190c];return _0x465647;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8fb8('0x0'));var rp=require('request-promise');var moment=require(_0x8fb8('0x1'));var BPromise=require(_0x8fb8('0x2'));var Mustache=require(_0x8fb8('0x3'));var util=require(_0x8fb8('0x4'));var path=require(_0x8fb8('0x5'));var sox=require(_0x8fb8('0x6'));var csv=require(_0x8fb8('0x7'));var ejs=require(_0x8fb8('0x8'));var fs=require('fs');var fs_extra=require(_0x8fb8('0x9'));var _=require('lodash');var squel=require(_0x8fb8('0xa'));var crypto=require('crypto');var jsforce=require(_0x8fb8('0xb'));var deskjs=require(_0x8fb8('0xc'));var toCsv=require(_0x8fb8('0x7'));var querystring=require(_0x8fb8('0xd'));var Papa=require(_0x8fb8('0xe'));var Redis=require(_0x8fb8('0xf'));var authService=require(_0x8fb8('0x10'));var qs=require(_0x8fb8('0x11'));var as=require(_0x8fb8('0x12'));var hardwareService=require(_0x8fb8('0x13'));var logger=require(_0x8fb8('0x14'))(_0x8fb8('0x15'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8fb8('0x16'));var db=require(_0x8fb8('0x17'))['db'];function respondWithStatusCode(_0x4892bc,_0x5b0eeb){_0x5b0eeb=_0x5b0eeb||0xcc;return function(_0x37d443){if(_0x37d443){return _0x4892bc[_0x8fb8('0x18')](_0x5b0eeb);}return _0x4892bc[_0x8fb8('0x19')](_0x5b0eeb)['end']();};}function respondWithResult(_0x2ba4c7,_0x3a018f){_0x3a018f=_0x3a018f||0xc8;return function(_0x484f67){if(_0x484f67){return _0x2ba4c7[_0x8fb8('0x19')](_0x3a018f)[_0x8fb8('0x1a')](_0x484f67);}};}function respondWithFilteredResult(_0x1277a4,_0x5c8320){return function(_0x34c749){if(_0x34c749){var _0x1b0f51=typeof _0x5c8320[_0x8fb8('0x1b')]===_0x8fb8('0x1c')&&typeof _0x5c8320[_0x8fb8('0x1d')]===_0x8fb8('0x1c');var _0x357d9b=_0x34c749[_0x8fb8('0x1e')];var _0x198b80=_0x1b0f51?0x0:_0x5c8320[_0x8fb8('0x1b')];var _0x28c79f=_0x1b0f51?_0x34c749[_0x8fb8('0x1e')]:_0x5c8320['offset']+_0x5c8320[_0x8fb8('0x1d')];var _0x2283ee;if(_0x28c79f>=_0x357d9b){_0x28c79f=_0x357d9b;_0x2283ee=0xc8;}else{_0x2283ee=0xce;}_0x1277a4['status'](_0x2283ee);return _0x1277a4[_0x8fb8('0x1f')]('Content-Range',_0x198b80+'-'+_0x28c79f+'/'+_0x357d9b)[_0x8fb8('0x1a')](_0x34c749);}return null;};}function patchUpdates(_0x1d9b06){return function(_0x2c1df0){try{jsonpatch[_0x8fb8('0x20')](_0x2c1df0,_0x1d9b06,!![]);}catch(_0x560b90){return BPromise['reject'](_0x560b90);}return _0x2c1df0['save']();};}function saveUpdates(_0x40bf33,_0x46f284){return function(_0x204e7a){if(_0x204e7a){return _0x204e7a['update'](_0x40bf33)[_0x8fb8('0x21')](function(_0x6c559c){return _0x6c559c;});}return null;};}function removeEntity(_0xe54a9b,_0x5420c0){return function(_0x2e51c9){if(_0x2e51c9){return _0x2e51c9[_0x8fb8('0x22')]()[_0x8fb8('0x21')](function(){_0xe54a9b[_0x8fb8('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4c066a,_0x5bb866){return function(_0x4ee00b){if(!_0x4ee00b){_0x4c066a[_0x8fb8('0x18')](0x194);}return _0x4ee00b;};}function handleError(_0x9eaa5d,_0x259f38){_0x259f38=_0x259f38||0x1f4;return function(_0x2c0237){logger[_0x8fb8('0x23')](_0x2c0237[_0x8fb8('0x24')]);if(_0x2c0237['name']){delete _0x2c0237[_0x8fb8('0x25')];}_0x9eaa5d[_0x8fb8('0x19')](_0x259f38)[_0x8fb8('0x26')](_0x2c0237);};}exports['index']=function(_0x66eb0b,_0x24e1d4){var _0x395185={},_0x4eda42={},_0x188083={'count':0x0,'rows':[]};var _0x2a071f=_[_0x8fb8('0x27')](db[_0x8fb8('0x28')][_0x8fb8('0x29')],function(_0x536867){return{'name':_0x536867[_0x8fb8('0x2a')],'type':_0x536867[_0x8fb8('0x2b')][_0x8fb8('0x2c')]};});_0x4eda42[_0x8fb8('0x2d')]=_[_0x8fb8('0x27')](_0x2a071f,_0x8fb8('0x25'));_0x4eda42['query']=_[_0x8fb8('0x2e')](_0x66eb0b['query']);_0x4eda42[_0x8fb8('0x2f')]=_['intersection'](_0x4eda42[_0x8fb8('0x2d')],_0x4eda42['query']);_0x395185[_0x8fb8('0x30')]=_[_0x8fb8('0x31')](_0x4eda42['model'],qs[_0x8fb8('0x32')](_0x66eb0b[_0x8fb8('0x33')]['fields']));_0x395185[_0x8fb8('0x30')]=_0x395185[_0x8fb8('0x30')]['length']?_0x395185[_0x8fb8('0x30')]:_0x4eda42[_0x8fb8('0x2d')];if(!_0x66eb0b[_0x8fb8('0x33')][_0x8fb8('0x34')](_0x8fb8('0x35'))){_0x395185[_0x8fb8('0x1d')]=qs[_0x8fb8('0x1d')](_0x66eb0b[_0x8fb8('0x33')][_0x8fb8('0x1d')]);_0x395185['offset']=qs['offset'](_0x66eb0b[_0x8fb8('0x33')][_0x8fb8('0x1b')]);}_0x395185[_0x8fb8('0x36')]=qs['sort'](_0x66eb0b[_0x8fb8('0x33')][_0x8fb8('0x37')]);_0x395185[_0x8fb8('0x38')]=qs[_0x8fb8('0x2f')](_[_0x8fb8('0x39')](_0x66eb0b[_0x8fb8('0x33')],_0x4eda42[_0x8fb8('0x2f')]),_0x2a071f);if(_0x66eb0b[_0x8fb8('0x33')][_0x8fb8('0x3a')]){_0x395185['where']=_['merge'](_0x395185['where'],{'$or':_[_0x8fb8('0x27')](_0x2a071f,function(_0x3be382){if(_0x3be382[_0x8fb8('0x2b')]!==_0x8fb8('0x3b')){var _0x2c251b={};_0x2c251b[_0x3be382[_0x8fb8('0x25')]]={'$like':'%'+_0x66eb0b[_0x8fb8('0x33')][_0x8fb8('0x3a')]+'%'};return _0x2c251b;}})});}_0x395185=_[_0x8fb8('0x3c')]({},_0x395185,_0x66eb0b['options']);var _0x3790c5={'where':_0x395185['where']};return db[_0x8fb8('0x28')][_0x8fb8('0x1e')](_0x3790c5)[_0x8fb8('0x21')](function(_0x12ec5c){_0x188083[_0x8fb8('0x1e')]=_0x12ec5c;if(_0x66eb0b[_0x8fb8('0x33')][_0x8fb8('0x3d')]){_0x395185['include']=[{'all':!![]}];}return db[_0x8fb8('0x28')]['findAll'](_0x395185);})['then'](function(_0x34bfb){_0x188083[_0x8fb8('0x3e')]=_0x34bfb;return _0x188083;})[_0x8fb8('0x21')](respondWithFilteredResult(_0x24e1d4,_0x395185))['catch'](handleError(_0x24e1d4,null));};exports[_0x8fb8('0x3f')]=function(_0x3644d7,_0x23afb0){var _0x2a59ea={'raw':!![],'where':{'id':_0x3644d7[_0x8fb8('0x40')]['id']}},_0x57f5e9={};_0x57f5e9[_0x8fb8('0x2d')]=_[_0x8fb8('0x2e')](db[_0x8fb8('0x28')][_0x8fb8('0x29')]);_0x57f5e9[_0x8fb8('0x33')]=_[_0x8fb8('0x2e')](_0x3644d7[_0x8fb8('0x33')]);_0x57f5e9[_0x8fb8('0x2f')]=_['intersection'](_0x57f5e9[_0x8fb8('0x2d')],_0x57f5e9[_0x8fb8('0x33')]);_0x2a59ea[_0x8fb8('0x30')]=_['intersection'](_0x57f5e9[_0x8fb8('0x2d')],qs[_0x8fb8('0x32')](_0x3644d7['query'][_0x8fb8('0x32')]));_0x2a59ea['attributes']=_0x2a59ea[_0x8fb8('0x30')][_0x8fb8('0x41')]?_0x2a59ea[_0x8fb8('0x30')]:_0x57f5e9[_0x8fb8('0x2d')];if(_0x3644d7['query'][_0x8fb8('0x3d')]){_0x2a59ea[_0x8fb8('0x42')]=[{'all':!![]}];}_0x2a59ea=_[_0x8fb8('0x3c')]({},_0x2a59ea,_0x3644d7[_0x8fb8('0x43')]);return db[_0x8fb8('0x28')][_0x8fb8('0x44')](_0x2a59ea)['then'](handleEntityNotFound(_0x23afb0,null))['then'](respondWithResult(_0x23afb0,null))[_0x8fb8('0x45')](handleError(_0x23afb0,null));};exports['create']=function(_0x2b3aa1,_0x6830c8){return db[_0x8fb8('0x28')][_0x8fb8('0x46')](_0x2b3aa1[_0x8fb8('0x47')],{})[_0x8fb8('0x21')](respondWithResult(_0x6830c8,0xc9))[_0x8fb8('0x45')](handleError(_0x6830c8,null));};exports[_0x8fb8('0x48')]=function(_0x18b50b,_0x423268){if(_0x18b50b[_0x8fb8('0x47')]['id']){delete _0x18b50b[_0x8fb8('0x47')]['id'];}return db[_0x8fb8('0x28')][_0x8fb8('0x44')]({'where':{'id':_0x18b50b[_0x8fb8('0x40')]['id']}})['then'](handleEntityNotFound(_0x423268,null))[_0x8fb8('0x21')](saveUpdates(_0x18b50b[_0x8fb8('0x47')],null))[_0x8fb8('0x21')](respondWithResult(_0x423268,null))[_0x8fb8('0x45')](handleError(_0x423268,null));};exports[_0x8fb8('0x22')]=function(_0x5abdc9,_0x4b561c){return db[_0x8fb8('0x28')][_0x8fb8('0x44')]({'where':{'id':_0x5abdc9[_0x8fb8('0x40')]['id']}})[_0x8fb8('0x21')](handleEntityNotFound(_0x4b561c,null))[_0x8fb8('0x21')](removeEntity(_0x4b561c,null))[_0x8fb8('0x45')](handleError(_0x4b561c,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index b9f2043..e727791 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 _0xbb90=['int_servicenow_fields','servicenow_unique_index','FieldId','lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./intServicenowField.attributes','exports','define','ServicenowField'];(function(_0xcea243,_0x21b226){var _0x5a2170=function(_0x53c5b8){while(--_0x53c5b8){_0xcea243['push'](_0xcea243['shift']());}};_0x5a2170(++_0x21b226);}(_0xbb90,0x17d));var _0x0bb9=function(_0x45be8a,_0xee0ad8){_0x45be8a=_0x45be8a-0x0;var _0x6c8449=_0xbb90[_0x45be8a];return _0x6c8449;};'use strict';var _=require(_0x0bb9('0x0'));var util=require(_0x0bb9('0x1'));var logger=require(_0x0bb9('0x2'))('api');var moment=require(_0x0bb9('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bb9('0x4'));var rimraf=require(_0x0bb9('0x5'));var config=require(_0x0bb9('0x6'));var attributes=require(_0x0bb9('0x7'));module[_0x0bb9('0x8')]=function(_0x3c93f3,_0x35b926){return _0x3c93f3[_0x0bb9('0x9')](_0x0bb9('0xa'),attributes,{'tableName':_0x0bb9('0xb'),'paranoid':![],'indexes':[{'name':_0x0bb9('0xc'),'fields':['idField',_0x0bb9('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd15d=['lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./intServicenowField.attributes','exports','define','ServicenowField','int_servicenow_fields','servicenow_unique_index','idField','FieldId'];(function(_0x18f510,_0x2b99d5){var _0x38ca71=function(_0x34ee9e){while(--_0x34ee9e){_0x18f510['push'](_0x18f510['shift']());}};_0x38ca71(++_0x2b99d5);}(_0xd15d,0xe0));var _0xdd15=function(_0xacde12,_0x328412){_0xacde12=_0xacde12-0x0;var _0x55e56e=_0xd15d[_0xacde12];return _0x55e56e;};'use strict';var _=require(_0xdd15('0x0'));var util=require(_0xdd15('0x1'));var logger=require(_0xdd15('0x2'))(_0xdd15('0x3'));var moment=require(_0xdd15('0x4'));var BPromise=require(_0xdd15('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd15('0x6'));var rimraf=require(_0xdd15('0x7'));var config=require('../../config/environment');var attributes=require(_0xdd15('0x8'));module[_0xdd15('0x9')]=function(_0x3f36f4,_0x28d7f3){return _0x3f36f4[_0xdd15('0xa')](_0xdd15('0xb'),attributes,{'tableName':_0xdd15('0xc'),'paranoid':![],'indexes':[{'name':_0xdd15('0xd'),'fields':[_0xdd15('0xe'),_0xdd15('0xf')],'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 9e84848..aaaacb1 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 _0xe706=['http','request','then','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\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(_0x18a399,_0x51603d){var _0x80d018=function(_0x51466d){while(--_0x51466d){_0x18a399['push'](_0x18a399['shift']());}};_0x80d018(++_0x51603d);}(_0xe706,0xa3));var _0x6e70=function(_0x5850c0,_0x3c2c){_0x5850c0=_0x5850c0-0x0;var _0x113882=_0xe706[_0x5850c0];return _0x113882;};'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']('ServicenowField,\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']('ServicenowField,\x20%s,\x20%s',_0x293ce7,_0x161f23);_0x3c4843(_0x161f23);});});} \ No newline at end of file +var _0xb43b=['rpc','../../config/environment','http','request','info','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','ServicenowField,\x20%s,\x20%s','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x211fee,_0x37e467){var _0x5a2c46=function(_0x26ce2a){while(--_0x26ce2a){_0x211fee['push'](_0x211fee['shift']());}};_0x5a2c46(++_0x37e467);}(_0xb43b,0x1b2));var _0xbb43=function(_0x34b7e1,_0x5ce076){_0x34b7e1=_0x34b7e1-0x0;var _0x2e8f57=_0xb43b[_0x34b7e1];return _0x2e8f57;};'use strict';var _=require(_0xbb43('0x0'));var util=require(_0xbb43('0x1'));var moment=require('moment');var BPromise=require(_0xbb43('0x2'));var rs=require(_0xbb43('0x3'));var fs=require('fs');var Redis=require(_0xbb43('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xbb43('0x5'));var logger=require(_0xbb43('0x6'))(_0xbb43('0x7'));var config=require(_0xbb43('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xbb43('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x553520,_0x80fe61,_0x1ccd49){return new BPromise(function(_0x2a2f11,_0x29ae1a){return client[_0xbb43('0xa')](_0x553520,_0x1ccd49)['then'](function(_0x208c2b){logger[_0xbb43('0xb')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0xbb43('0xc'));logger[_0xbb43('0xd')](_0xbb43('0xe'),_0x80fe61,_0xbb43('0xc'),JSON[_0xbb43('0xf')](_0x208c2b));if(_0x208c2b[_0xbb43('0x10')]){if(_0x208c2b['error'][_0xbb43('0x11')]===0x1f4){logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b['error'][_0xbb43('0x12')]);return _0x29ae1a(_0x208c2b['error']['message']);}logger[_0xbb43('0x10')]('ServicenowField,\x20%s,\x20%s',_0x80fe61,_0x208c2b[_0xbb43('0x10')][_0xbb43('0x12')]);return _0x2a2f11(_0x208c2b['error']['message']);}else{logger['info'](_0xbb43('0x13'),_0x80fe61,_0xbb43('0xc'));_0x2a2f11(_0x208c2b['result']['message']);}})[_0xbb43('0x14')](function(_0x563ce1){logger['error'](_0xbb43('0x13'),_0x80fe61,_0x563ce1);_0x29ae1a(_0x563ce1);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index bfaf069..330c7de 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 _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2f035b,_0x5e81ad){var _0x1990b3=function(_0x44fcd9){while(--_0x44fcd9){_0x2f035b['push'](_0x2f035b['shift']());}};_0x1990b3(++_0x5e81ad);}(_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')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSugarcrmAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x2f87c8,_0x558865){var _0x63f35f=function(_0x5afb1e){while(--_0x5afb1e){_0x2f87c8['push'](_0x2f87c8['shift']());}};_0x63f35f(++_0x558865);}(_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')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 91b47b8..6c4b514 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 _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x38a855,_0x55d661){var _0x80ded1=function(_0x3a3d12){while(--_0x3a3d12){_0x38a855['push'](_0x38a855['shift']());}};_0x80ded1(++_0x55d661);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b349a,_0x22222c){_0x1b349a=_0x1b349a-0x0;var _0x5d1f7c=_0xa9e0[_0x1b349a];return _0x5d1f7c;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x13db1d,_0x3f9846){var _0x12c79e=function(_0x5dd2c1){while(--_0x5dd2c1){_0x13db1d['push'](_0x13db1d['shift']());}};_0x12c79e(++_0x3f9846);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('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 c1baa56..fa49639 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 _0x6aa0=['map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','filter','VIRTUAL','merge','options','where','catch','show','params','include','find','create','body','destroy','SugarcrmConfiguration','getConfigurations','addConfiguration','findOne','getSubjects','channel','Descriptions','SugarcrmField','Subjects','assigned_user_id','created_by','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','remoteUri','slice','substring','lastIndexOf','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','PLAIN','Password\x20Expired','POST','get_module_fields','Calls','values','module_fields','remove','label','value','test','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','statusCode','rimraf','zip-dir','request-promise','bluebird','mustache','util','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/environment','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','end','error','stack','name','send','index','SugarcrmAccount','rawAttributes','fieldName','type','key','model'];(function(_0x1497b5,_0x4c72df){var _0x3080af=function(_0x2fdf75){while(--_0x2fdf75){_0x1497b5['push'](_0x1497b5['shift']());}};_0x3080af(++_0x4c72df);}(_0x6aa0,0xb8));var _0x06aa=function(_0x3e6d5d,_0x264c7a){_0x3e6d5d=_0x3e6d5d-0x0;var _0x238923=_0x6aa0[_0x3e6d5d];return _0x238923;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x06aa('0x0'));var zipdir=require(_0x06aa('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x06aa('0x2'));var moment=require('moment');var BPromise=require(_0x06aa('0x3'));var Mustache=require(_0x06aa('0x4'));var util=require(_0x06aa('0x5'));var path=require('path');var sox=require(_0x06aa('0x6'));var csv=require(_0x06aa('0x7'));var ejs=require(_0x06aa('0x8'));var fs=require('fs');var fs_extra=require(_0x06aa('0x9'));var _=require(_0x06aa('0xa'));var squel=require('squel');var crypto=require(_0x06aa('0xb'));var jsforce=require(_0x06aa('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x06aa('0x7'));var querystring=require(_0x06aa('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x06aa('0xe'));var qs=require(_0x06aa('0xf'));var as=require(_0x06aa('0x10'));var hardwareService=require(_0x06aa('0x11'));var logger=require(_0x06aa('0x12'))(_0x06aa('0x13'));var utils=require('../../config/utils');var config=require(_0x06aa('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x06aa('0x15'))['db'];var integrations=require(_0x06aa('0x16'));function respondWithStatusCode(_0x21e35a,_0x1011cd){_0x1011cd=_0x1011cd||0xcc;return function(_0x1f1a64){if(_0x1f1a64){return _0x21e35a[_0x06aa('0x17')](_0x1011cd);}return _0x21e35a[_0x06aa('0x18')](_0x1011cd)['end']();};}function respondWithResult(_0xb97b6,_0xc5b667){_0xc5b667=_0xc5b667||0xc8;return function(_0x771dd3){if(_0x771dd3){return _0xb97b6[_0x06aa('0x18')](_0xc5b667)[_0x06aa('0x19')](_0x771dd3);}};}function respondWithFilteredResult(_0x2ab497,_0x761e74){return function(_0xfdb299){if(_0xfdb299){var _0x2abce8=typeof _0x761e74[_0x06aa('0x1a')]==='undefined'&&typeof _0x761e74[_0x06aa('0x1b')]==='undefined';var _0x4ebfde=_0xfdb299[_0x06aa('0x1c')];var _0xd058f6=_0x2abce8?0x0:_0x761e74[_0x06aa('0x1a')];var _0x84fa7f=_0x2abce8?_0xfdb299[_0x06aa('0x1c')]:_0x761e74['offset']+_0x761e74['limit'];var _0x27f3bd;if(_0x84fa7f>=_0x4ebfde){_0x84fa7f=_0x4ebfde;_0x27f3bd=0xc8;}else{_0x27f3bd=0xce;}_0x2ab497[_0x06aa('0x18')](_0x27f3bd);return _0x2ab497[_0x06aa('0x1d')](_0x06aa('0x1e'),_0xd058f6+'-'+_0x84fa7f+'/'+_0x4ebfde)['json'](_0xfdb299);}return null;};}function patchUpdates(_0x263a43){return function(_0x511a69){try{jsonpatch[_0x06aa('0x1f')](_0x511a69,_0x263a43,!![]);}catch(_0x581462){return BPromise[_0x06aa('0x20')](_0x581462);}return _0x511a69[_0x06aa('0x21')]();};}function saveUpdates(_0x329fbf,_0x2aa78a){return function(_0x26f0b6){if(_0x26f0b6){return _0x26f0b6[_0x06aa('0x22')](_0x329fbf)['then'](function(_0x4ce369){return _0x4ce369;});}return null;};}function removeEntity(_0x268b85,_0x325cfd){return function(_0x420ae1){if(_0x420ae1){return _0x420ae1['destroy']()[_0x06aa('0x23')](function(){_0x268b85[_0x06aa('0x18')](0xcc)[_0x06aa('0x24')]();});}};}function handleEntityNotFound(_0x109cab,_0x9734ae){return function(_0x4a5081){if(!_0x4a5081){_0x109cab['sendStatus'](0x194);}return _0x4a5081;};}function handleError(_0x337fa4,_0x3a65a0){_0x3a65a0=_0x3a65a0||0x1f4;return function(_0x547c9d){logger[_0x06aa('0x25')](_0x547c9d[_0x06aa('0x26')]);if(_0x547c9d[_0x06aa('0x27')]){delete _0x547c9d[_0x06aa('0x27')];}_0x337fa4['status'](_0x3a65a0)[_0x06aa('0x28')](_0x547c9d);};}exports[_0x06aa('0x29')]=function(_0x421f06,_0x4b7312){var _0x2c21c7={},_0x2572a6={},_0x170b88={'count':0x0,'rows':[]};var _0x4fead2=_['map'](db[_0x06aa('0x2a')][_0x06aa('0x2b')],function(_0x1ba98f){return{'name':_0x1ba98f[_0x06aa('0x2c')],'type':_0x1ba98f[_0x06aa('0x2d')][_0x06aa('0x2e')]};});_0x2572a6[_0x06aa('0x2f')]=_[_0x06aa('0x30')](_0x4fead2,_0x06aa('0x27'));_0x2572a6[_0x06aa('0x31')]=_[_0x06aa('0x32')](_0x421f06[_0x06aa('0x31')]);_0x2572a6[_0x06aa('0x33')]=_[_0x06aa('0x34')](_0x2572a6[_0x06aa('0x2f')],_0x2572a6['query']);_0x2c21c7[_0x06aa('0x35')]=_['intersection'](_0x2572a6[_0x06aa('0x2f')],qs[_0x06aa('0x36')](_0x421f06[_0x06aa('0x31')][_0x06aa('0x36')]));_0x2c21c7['attributes']=_0x2c21c7[_0x06aa('0x35')][_0x06aa('0x37')]?_0x2c21c7[_0x06aa('0x35')]:_0x2572a6[_0x06aa('0x2f')];if(!_0x421f06[_0x06aa('0x31')]['hasOwnProperty'](_0x06aa('0x38'))){_0x2c21c7[_0x06aa('0x1b')]=qs[_0x06aa('0x1b')](_0x421f06[_0x06aa('0x31')][_0x06aa('0x1b')]);_0x2c21c7['offset']=qs['offset'](_0x421f06[_0x06aa('0x31')][_0x06aa('0x1a')]);}_0x2c21c7[_0x06aa('0x39')]=qs['sort'](_0x421f06[_0x06aa('0x31')][_0x06aa('0x3a')]);_0x2c21c7['where']=qs[_0x06aa('0x33')](_['pick'](_0x421f06['query'],_0x2572a6[_0x06aa('0x33')]),_0x4fead2);if(_0x421f06[_0x06aa('0x31')][_0x06aa('0x3b')]){_0x2c21c7['where']=_['merge'](_0x2c21c7['where'],{'$or':_[_0x06aa('0x30')](_0x4fead2,function(_0x3ec595){if(_0x3ec595[_0x06aa('0x2d')]!==_0x06aa('0x3c')){var _0x3787d7={};_0x3787d7[_0x3ec595[_0x06aa('0x27')]]={'$like':'%'+_0x421f06[_0x06aa('0x31')][_0x06aa('0x3b')]+'%'};return _0x3787d7;}})});}_0x2c21c7=_[_0x06aa('0x3d')]({},_0x2c21c7,_0x421f06[_0x06aa('0x3e')]);var _0x3c77db={'where':_0x2c21c7[_0x06aa('0x3f')]};return db[_0x06aa('0x2a')]['count'](_0x3c77db)[_0x06aa('0x23')](function(_0x30bd3f){_0x170b88[_0x06aa('0x1c')]=_0x30bd3f;if(_0x421f06[_0x06aa('0x31')]['includeAll']){_0x2c21c7['include']=[{'all':!![]}];}return db[_0x06aa('0x2a')]['findAll'](_0x2c21c7);})[_0x06aa('0x23')](function(_0x2b4105){_0x170b88['rows']=_0x2b4105;return _0x170b88;})['then'](respondWithFilteredResult(_0x4b7312,_0x2c21c7))[_0x06aa('0x40')](handleError(_0x4b7312,null));};exports[_0x06aa('0x41')]=function(_0xf2cf5a,_0x20a314){var _0x112eec={'raw':![],'where':{'id':_0xf2cf5a[_0x06aa('0x42')]['id']}},_0x40b999={};_0x40b999[_0x06aa('0x2f')]=_['keys'](db[_0x06aa('0x2a')][_0x06aa('0x2b')]);_0x40b999['query']=_[_0x06aa('0x32')](_0xf2cf5a[_0x06aa('0x31')]);_0x40b999[_0x06aa('0x33')]=_[_0x06aa('0x34')](_0x40b999[_0x06aa('0x2f')],_0x40b999[_0x06aa('0x31')]);_0x112eec[_0x06aa('0x35')]=_['intersection'](_0x40b999[_0x06aa('0x2f')],qs[_0x06aa('0x36')](_0xf2cf5a[_0x06aa('0x31')][_0x06aa('0x36')]));_0x112eec[_0x06aa('0x35')]=_0x112eec[_0x06aa('0x35')][_0x06aa('0x37')]?_0x112eec[_0x06aa('0x35')]:_0x40b999['model'];if(_0xf2cf5a[_0x06aa('0x31')]['includeAll']){_0x112eec[_0x06aa('0x43')]=[{'all':!![]}];}_0x112eec=_['merge']({},_0x112eec,_0xf2cf5a[_0x06aa('0x3e')]);return db[_0x06aa('0x2a')][_0x06aa('0x44')](_0x112eec)[_0x06aa('0x23')](handleEntityNotFound(_0x20a314,null))[_0x06aa('0x23')](respondWithResult(_0x20a314,null))[_0x06aa('0x40')](handleError(_0x20a314,null));};exports[_0x06aa('0x45')]=function(_0x5a4b9a,_0x20fb18){return db[_0x06aa('0x2a')][_0x06aa('0x45')](_0x5a4b9a['body'],{})['then'](respondWithResult(_0x20fb18,0xc9))['catch'](handleError(_0x20fb18,null));};exports[_0x06aa('0x22')]=function(_0x147931,_0x500d16){if(_0x147931[_0x06aa('0x46')]['id']){delete _0x147931['body']['id'];}return db[_0x06aa('0x2a')][_0x06aa('0x44')]({'where':{'id':_0x147931['params']['id']}})[_0x06aa('0x23')](handleEntityNotFound(_0x500d16,null))['then'](saveUpdates(_0x147931[_0x06aa('0x46')],null))['then'](respondWithResult(_0x500d16,null))[_0x06aa('0x40')](handleError(_0x500d16,null));};exports[_0x06aa('0x47')]=function(_0x58e843,_0xa6a422){return db[_0x06aa('0x2a')][_0x06aa('0x44')]({'where':{'id':_0x58e843[_0x06aa('0x42')]['id']}})['then'](handleEntityNotFound(_0xa6a422,null))[_0x06aa('0x23')](removeEntity(_0xa6a422,null))[_0x06aa('0x40')](handleError(_0xa6a422,null));};exports['getConfigurations']=function(_0x111ac6,_0x59df9e,_0xb645d5){var _0x4af68e={};var _0x4bdca3={};var _0x3dc32e;var _0x73b0a5;return db[_0x06aa('0x2a')]['findOne']({'where':{'id':_0x111ac6['params']['id']}})['then'](handleEntityNotFound(_0x59df9e,null))[_0x06aa('0x23')](function(_0x386c19){if(_0x386c19){_0x3dc32e=_0x386c19;_0x4bdca3[_0x06aa('0x2f')]=_[_0x06aa('0x32')](db[_0x06aa('0x48')]['rawAttributes']);_0x4bdca3['query']=_['keys'](_0x111ac6[_0x06aa('0x31')]);_0x4bdca3[_0x06aa('0x33')]=_[_0x06aa('0x34')](_0x4bdca3[_0x06aa('0x2f')],_0x4bdca3[_0x06aa('0x31')]);_0x4af68e[_0x06aa('0x35')]=_['intersection'](_0x4bdca3[_0x06aa('0x2f')],qs['fields'](_0x111ac6[_0x06aa('0x31')]['fields']));_0x4af68e[_0x06aa('0x35')]=_0x4af68e[_0x06aa('0x35')][_0x06aa('0x37')]?_0x4af68e[_0x06aa('0x35')]:_0x4bdca3[_0x06aa('0x2f')];_0x4af68e[_0x06aa('0x39')]=qs[_0x06aa('0x3a')](_0x111ac6[_0x06aa('0x31')][_0x06aa('0x3a')]);_0x4af68e[_0x06aa('0x3f')]=qs[_0x06aa('0x33')](_['pick'](_0x111ac6[_0x06aa('0x31')],_0x4bdca3[_0x06aa('0x33')]));if(_0x111ac6[_0x06aa('0x31')][_0x06aa('0x3b')]){_0x4af68e[_0x06aa('0x3f')]=_['merge'](_0x4af68e[_0x06aa('0x3f')],{'$or':_[_0x06aa('0x30')](_0x4af68e[_0x06aa('0x35')],function(_0x8731bc){var _0x44231c={};_0x44231c[_0x8731bc]={'$like':'%'+_0x111ac6[_0x06aa('0x31')]['filter']+'%'};return _0x44231c;})});}_0x4af68e=_['merge']({},_0x4af68e,_0x111ac6[_0x06aa('0x3e')]);return _0x3dc32e[_0x06aa('0x49')](_0x4af68e);}})[_0x06aa('0x23')](function(_0x1b2714){if(_0x1b2714){_0x73b0a5=_0x1b2714['length'];if(!_0x111ac6[_0x06aa('0x31')]['hasOwnProperty'](_0x06aa('0x38'))){_0x4af68e[_0x06aa('0x1b')]=qs[_0x06aa('0x1b')](_0x111ac6['query'][_0x06aa('0x1b')]);_0x4af68e[_0x06aa('0x1a')]=qs['offset'](_0x111ac6['query']['offset']);}return _0x3dc32e['getConfigurations'](_0x4af68e);}})[_0x06aa('0x23')](function(_0x382d4f){if(_0x382d4f){return _0x382d4f?{'count':_0x73b0a5,'rows':_0x382d4f}:null;}})[_0x06aa('0x23')](respondWithResult(_0x59df9e,null))['catch'](handleError(_0x59df9e,null));};exports[_0x06aa('0x4a')]=function(_0x17a7db,_0x5ae2e4,_0x2100ea){if(_0x17a7db[_0x06aa('0x46')]['id']){delete _0x17a7db[_0x06aa('0x46')]['id'];}return db['SugarcrmAccount'][_0x06aa('0x4b')]({'where':{'id':_0x17a7db[_0x06aa('0x42')]['id']}})['then'](handleEntityNotFound(_0x5ae2e4,null))[_0x06aa('0x23')](function(_0x26b172){if(_0x26b172){_0x17a7db[_0x06aa('0x46')]['AccountId']=_0x26b172['id'];_0x17a7db[_0x06aa('0x46')]['Subjects']=integrations[_0x06aa('0x4c')](_0x17a7db[_0x06aa('0x46')][_0x06aa('0x4d')],_0x17a7db[_0x06aa('0x46')][_0x06aa('0x2d')]);_0x17a7db['body'][_0x06aa('0x4e')]=integrations['getDescriptions'](_0x17a7db[_0x06aa('0x46')]['channel'],_0x17a7db[_0x06aa('0x46')][_0x06aa('0x2d')]);return db['SugarcrmConfiguration'][_0x06aa('0x45')](_0x17a7db[_0x06aa('0x46')],{'include':[{'model':db[_0x06aa('0x4f')],'as':_0x06aa('0x50')},{'model':db[_0x06aa('0x4f')],'as':_0x06aa('0x4e')}]});}return null;})['then'](respondWithResult(_0x5ae2e4,null))['catch'](handleError(_0x5ae2e4,null));};exports['getFields']=function(_0x4956c0,_0xba6c4f,_0x1aea1c){var _0x53a89d='';var _0x5e3c6a=['id',_0x06aa('0x27'),_0x06aa('0x51'),_0x06aa('0x52'),_0x06aa('0x53'),_0x06aa('0x54'),_0x06aa('0x55'),_0x06aa('0x56'),_0x06aa('0x57'),_0x06aa('0x58'),'parent_name',_0x06aa('0x59')];return db[_0x06aa('0x2a')][_0x06aa('0x4b')]({'where':{'id':_0x4956c0['params']['id']},'attributes':['id',_0x06aa('0x5a'),'password','remoteUri']})[_0x06aa('0x23')](handleEntityNotFound(_0xba6c4f,null))[_0x06aa('0x23')](function(_0x235b76){if(_0x235b76){_0x53a89d=_0x235b76[_0x06aa('0x5b')];var _0x11881f=_0x53a89d[_0x06aa('0x5c')](-0x1);if(_0x11881f==='/'){_0x53a89d=_0x53a89d[_0x06aa('0x5d')](0x0,_0x53a89d[_0x06aa('0x5e')](_0x11881f));}return rp({'method':'POST','uri':util['format'](_0x06aa('0x5f'),_0x53a89d,_0x06aa('0x60')),'json':!![],'form':{'method':_0x06aa('0x61'),'input_type':'JSON','response_type':_0x06aa('0x62'),'rest_data':JSON[_0x06aa('0x63')]({'user_auth':{'user_name':_0x235b76[_0x06aa('0x5a')],'password':_0x235b76[_0x06aa('0x64')],'encryption':_0x06aa('0x65')},'application':'xCALLY\x20Motion\x20Integration'})}});}})[_0x06aa('0x23')](function(_0x342933){if(_0x342933&&_0x342933['name']!=='Invalid\x20Login'&&_0x342933[_0x06aa('0x27')]!==_0x06aa('0x66')){return rp({'method':_0x06aa('0x67'),'uri':util['format'](_0x06aa('0x5f'),_0x53a89d,_0x06aa('0x60')),'json':!![],'form':{'method':_0x06aa('0x68'),'input_type':_0x06aa('0x62'),'response_type':_0x06aa('0x62'),'rest_data':JSON['stringify']({'session':_0x342933['id'],'module_name':_0x06aa('0x69')})}})[_0x06aa('0x23')](function(_0x4aacab){if(_0x4aacab){var _0x3a496e=_[_0x06aa('0x6a')](_0x4aacab[_0x06aa('0x6b')]);_[_0x06aa('0x6c')](_0x3a496e,function(_0x1c1da7){return _0x5e3c6a['includes'](_0x1c1da7[_0x06aa('0x27')]);});return{'count':_0x3a496e['length'],'rows':_[_0x06aa('0x30')](_0x3a496e,function(_0x4011f9){return{'id':_0x4011f9[_0x06aa('0x27')],'name':_0x4011f9[_0x06aa('0x6d')],'custom':_['endsWith'](_0x4011f9[_0x06aa('0x27')],'_c')?!![]:![],'options':_0x4011f9[_0x06aa('0x3e')]?_[_0x06aa('0x30')](_[_0x06aa('0x6a')](_0x4011f9[_0x06aa('0x3e')]),function(_0xb57fdc){return{'name':_0xb57fdc[_0x06aa('0x6e')],'value':_0xb57fdc[_0x06aa('0x27')]};}):[]};})};}})[_0x06aa('0x23')](respondWithResult(_0xba6c4f,null))[_0x06aa('0x40')](function(_0x1103c8){var _0x39f81a=_0x4956c0[_0x06aa('0x31')][_0x06aa('0x6f')]?0x1f4:_0x1103c8['statusCode']||0x1f4;logger[_0x06aa('0x25')](_0x06aa('0x70'),_0x06aa('0x71'),_0x39f81a,JSON[_0x06aa('0x63')](_0x1103c8));delete _0x1103c8[_0x06aa('0x27')];if(_0x39f81a===0x191){_0x39f81a=0x190;}_0xba6c4f[_0x06aa('0x18')](_0x39f81a)[_0x06aa('0x28')](_0x4956c0[_0x06aa('0x31')]['test']?{'message':_0x06aa('0x72'),'statusCode':_0x1103c8[_0x06aa('0x73')]}:_0x1103c8);});}else{var _0x11cdb1=0x1f4;_0xba6c4f[_0x06aa('0x18')](_0x11cdb1)[_0x06aa('0x28')]({'message':_0x06aa('0x72'),'statusCode':0x190});}});}; \ No newline at end of file +var _0xd38c=['parent_name','direction','username','password','remoteUri','lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','values','module_fields','includes','endsWith','test','statusCode','Wrong\x20credentials','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','SugarcrmAccount','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','options','include','findAll','catch','show','params','create','body','find','getConfigurations','findOne','addConfiguration','getSubjects','channel','getDescriptions','SugarcrmConfiguration','SugarcrmField','Subjects','Descriptions','getFields','created_by','description','date_start','duration_hours','duration_minutes','parent_id'];(function(_0x2d89ce,_0x24d58d){var _0x3fad10=function(_0xad0ec){while(--_0xad0ec){_0x2d89ce['push'](_0x2d89ce['shift']());}};_0x3fad10(++_0x24d58d);}(_0xd38c,0x174));var _0xcd38=function(_0x23ee14,_0xa142db){_0x23ee14=_0x23ee14-0x0;var _0x113137=_0xd38c[_0x23ee14];return _0x113137;};'use strict';var emlformat=require(_0xcd38('0x0'));var rimraf=require(_0xcd38('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd38('0x2'));var rp=require(_0xcd38('0x3'));var moment=require('moment');var BPromise=require(_0xcd38('0x4'));var Mustache=require(_0xcd38('0x5'));var util=require('util');var path=require(_0xcd38('0x6'));var sox=require(_0xcd38('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcd38('0x8'));var _=require('lodash');var squel=require(_0xcd38('0x9'));var crypto=require(_0xcd38('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xcd38('0xb'));var toCsv=require(_0xcd38('0xc'));var querystring=require(_0xcd38('0xd'));var Papa=require(_0xcd38('0xe'));var Redis=require(_0xcd38('0xf'));var authService=require(_0xcd38('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xcd38('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xcd38('0x12'))(_0xcd38('0x13'));var utils=require(_0xcd38('0x14'));var config=require(_0xcd38('0x15'));var licenseUtil=require(_0xcd38('0x16'));var db=require('../../mysqldb')['db'];var integrations=require(_0xcd38('0x17'));function respondWithStatusCode(_0x5d477e,_0x236224){_0x236224=_0x236224||0xcc;return function(_0xc3ed03){if(_0xc3ed03){return _0x5d477e['sendStatus'](_0x236224);}return _0x5d477e[_0xcd38('0x18')](_0x236224)[_0xcd38('0x19')]();};}function respondWithResult(_0x56e5a2,_0x11589b){_0x11589b=_0x11589b||0xc8;return function(_0xd3d69d){if(_0xd3d69d){return _0x56e5a2[_0xcd38('0x18')](_0x11589b)[_0xcd38('0x1a')](_0xd3d69d);}};}function respondWithFilteredResult(_0x4ff894,_0x3d160e){return function(_0x557505){if(_0x557505){var _0x143e4b=typeof _0x3d160e[_0xcd38('0x1b')]===_0xcd38('0x1c')&&typeof _0x3d160e[_0xcd38('0x1d')]===_0xcd38('0x1c');var _0x1a8e8e=_0x557505['count'];var _0x30e47c=_0x143e4b?0x0:_0x3d160e[_0xcd38('0x1b')];var _0x1462b9=_0x143e4b?_0x557505[_0xcd38('0x1e')]:_0x3d160e[_0xcd38('0x1b')]+_0x3d160e[_0xcd38('0x1d')];var _0x1b1026;if(_0x1462b9>=_0x1a8e8e){_0x1462b9=_0x1a8e8e;_0x1b1026=0xc8;}else{_0x1b1026=0xce;}_0x4ff894[_0xcd38('0x18')](_0x1b1026);return _0x4ff894['set'](_0xcd38('0x1f'),_0x30e47c+'-'+_0x1462b9+'/'+_0x1a8e8e)['json'](_0x557505);}return null;};}function patchUpdates(_0xa925e7){return function(_0x589418){try{jsonpatch[_0xcd38('0x20')](_0x589418,_0xa925e7,!![]);}catch(_0x476150){return BPromise[_0xcd38('0x21')](_0x476150);}return _0x589418['save']();};}function saveUpdates(_0x2ade6b,_0x3cc6d9){return function(_0xeba1d5){if(_0xeba1d5){return _0xeba1d5[_0xcd38('0x22')](_0x2ade6b)[_0xcd38('0x23')](function(_0x1ddf11){return _0x1ddf11;});}return null;};}function removeEntity(_0x3c07ad,_0x56f1e8){return function(_0x1721c6){if(_0x1721c6){return _0x1721c6[_0xcd38('0x24')]()['then'](function(){_0x3c07ad[_0xcd38('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x188fc3,_0x2de47b){return function(_0x5f061e){if(!_0x5f061e){_0x188fc3[_0xcd38('0x25')](0x194);}return _0x5f061e;};}function handleError(_0x2a258d,_0x58c780){_0x58c780=_0x58c780||0x1f4;return function(_0x2997ca){logger[_0xcd38('0x26')](_0x2997ca[_0xcd38('0x27')]);if(_0x2997ca[_0xcd38('0x28')]){delete _0x2997ca[_0xcd38('0x28')];}_0x2a258d[_0xcd38('0x18')](_0x58c780)[_0xcd38('0x29')](_0x2997ca);};}exports[_0xcd38('0x2a')]=function(_0x47c992,_0x3a2635){var _0x243761={},_0x161f74={},_0x2e7774={'count':0x0,'rows':[]};var _0x4de770=_[_0xcd38('0x2b')](db[_0xcd38('0x2c')][_0xcd38('0x2d')],function(_0xbdd66c){return{'name':_0xbdd66c[_0xcd38('0x2e')],'type':_0xbdd66c[_0xcd38('0x2f')][_0xcd38('0x30')]};});_0x161f74['model']=_[_0xcd38('0x2b')](_0x4de770,_0xcd38('0x28'));_0x161f74[_0xcd38('0x31')]=_[_0xcd38('0x32')](_0x47c992['query']);_0x161f74[_0xcd38('0x33')]=_[_0xcd38('0x34')](_0x161f74[_0xcd38('0x35')],_0x161f74['query']);_0x243761[_0xcd38('0x36')]=_[_0xcd38('0x34')](_0x161f74[_0xcd38('0x35')],qs[_0xcd38('0x37')](_0x47c992[_0xcd38('0x31')]['fields']));_0x243761[_0xcd38('0x36')]=_0x243761[_0xcd38('0x36')][_0xcd38('0x38')]?_0x243761['attributes']:_0x161f74[_0xcd38('0x35')];if(!_0x47c992[_0xcd38('0x31')][_0xcd38('0x39')](_0xcd38('0x3a'))){_0x243761[_0xcd38('0x1d')]=qs[_0xcd38('0x1d')](_0x47c992[_0xcd38('0x31')][_0xcd38('0x1d')]);_0x243761['offset']=qs[_0xcd38('0x1b')](_0x47c992[_0xcd38('0x31')][_0xcd38('0x1b')]);}_0x243761[_0xcd38('0x3b')]=qs['sort'](_0x47c992['query'][_0xcd38('0x3c')]);_0x243761[_0xcd38('0x3d')]=qs[_0xcd38('0x33')](_[_0xcd38('0x3e')](_0x47c992[_0xcd38('0x31')],_0x161f74[_0xcd38('0x33')]),_0x4de770);if(_0x47c992[_0xcd38('0x31')]['filter']){_0x243761['where']=_['merge'](_0x243761[_0xcd38('0x3d')],{'$or':_[_0xcd38('0x2b')](_0x4de770,function(_0x317803){if(_0x317803[_0xcd38('0x2f')]!==_0xcd38('0x3f')){var _0x2fc833={};_0x2fc833[_0x317803['name']]={'$like':'%'+_0x47c992[_0xcd38('0x31')][_0xcd38('0x40')]+'%'};return _0x2fc833;}})});}_0x243761=_[_0xcd38('0x41')]({},_0x243761,_0x47c992[_0xcd38('0x42')]);var _0x4b20a3={'where':_0x243761[_0xcd38('0x3d')]};return db[_0xcd38('0x2c')][_0xcd38('0x1e')](_0x4b20a3)[_0xcd38('0x23')](function(_0x3c7d42){_0x2e7774[_0xcd38('0x1e')]=_0x3c7d42;if(_0x47c992['query']['includeAll']){_0x243761[_0xcd38('0x43')]=[{'all':!![]}];}return db[_0xcd38('0x2c')][_0xcd38('0x44')](_0x243761);})[_0xcd38('0x23')](function(_0x236a2e){_0x2e7774['rows']=_0x236a2e;return _0x2e7774;})[_0xcd38('0x23')](respondWithFilteredResult(_0x3a2635,_0x243761))[_0xcd38('0x45')](handleError(_0x3a2635,null));};exports[_0xcd38('0x46')]=function(_0xc1d5c,_0x217627){var _0x353b78={'raw':![],'where':{'id':_0xc1d5c[_0xcd38('0x47')]['id']}},_0x44098e={};_0x44098e[_0xcd38('0x35')]=_['keys'](db[_0xcd38('0x2c')][_0xcd38('0x2d')]);_0x44098e[_0xcd38('0x31')]=_[_0xcd38('0x32')](_0xc1d5c[_0xcd38('0x31')]);_0x44098e[_0xcd38('0x33')]=_[_0xcd38('0x34')](_0x44098e[_0xcd38('0x35')],_0x44098e[_0xcd38('0x31')]);_0x353b78[_0xcd38('0x36')]=_[_0xcd38('0x34')](_0x44098e[_0xcd38('0x35')],qs['fields'](_0xc1d5c[_0xcd38('0x31')][_0xcd38('0x37')]));_0x353b78['attributes']=_0x353b78['attributes'][_0xcd38('0x38')]?_0x353b78[_0xcd38('0x36')]:_0x44098e[_0xcd38('0x35')];if(_0xc1d5c[_0xcd38('0x31')]['includeAll']){_0x353b78['include']=[{'all':!![]}];}_0x353b78=_[_0xcd38('0x41')]({},_0x353b78,_0xc1d5c[_0xcd38('0x42')]);return db[_0xcd38('0x2c')]['find'](_0x353b78)[_0xcd38('0x23')](handleEntityNotFound(_0x217627,null))['then'](respondWithResult(_0x217627,null))[_0xcd38('0x45')](handleError(_0x217627,null));};exports[_0xcd38('0x48')]=function(_0x5fb788,_0x1a1273){return db[_0xcd38('0x2c')][_0xcd38('0x48')](_0x5fb788[_0xcd38('0x49')],{})[_0xcd38('0x23')](respondWithResult(_0x1a1273,0xc9))[_0xcd38('0x45')](handleError(_0x1a1273,null));};exports[_0xcd38('0x22')]=function(_0x25e7cb,_0x18add6){if(_0x25e7cb[_0xcd38('0x49')]['id']){delete _0x25e7cb['body']['id'];}return db['SugarcrmAccount'][_0xcd38('0x4a')]({'where':{'id':_0x25e7cb[_0xcd38('0x47')]['id']}})['then'](handleEntityNotFound(_0x18add6,null))[_0xcd38('0x23')](saveUpdates(_0x25e7cb[_0xcd38('0x49')],null))['then'](respondWithResult(_0x18add6,null))['catch'](handleError(_0x18add6,null));};exports[_0xcd38('0x24')]=function(_0x5ad571,_0x567b46){return db[_0xcd38('0x2c')]['find']({'where':{'id':_0x5ad571[_0xcd38('0x47')]['id']}})[_0xcd38('0x23')](handleEntityNotFound(_0x567b46,null))[_0xcd38('0x23')](removeEntity(_0x567b46,null))[_0xcd38('0x45')](handleError(_0x567b46,null));};exports[_0xcd38('0x4b')]=function(_0x201bb7,_0x4ee843,_0xf63acf){var _0x18f80a={};var _0x105572={};var _0xec88e4;var _0x716901;return db['SugarcrmAccount'][_0xcd38('0x4c')]({'where':{'id':_0x201bb7[_0xcd38('0x47')]['id']}})[_0xcd38('0x23')](handleEntityNotFound(_0x4ee843,null))[_0xcd38('0x23')](function(_0x122fed){if(_0x122fed){_0xec88e4=_0x122fed;_0x105572[_0xcd38('0x35')]=_[_0xcd38('0x32')](db['SugarcrmConfiguration'][_0xcd38('0x2d')]);_0x105572[_0xcd38('0x31')]=_[_0xcd38('0x32')](_0x201bb7[_0xcd38('0x31')]);_0x105572[_0xcd38('0x33')]=_['intersection'](_0x105572[_0xcd38('0x35')],_0x105572['query']);_0x18f80a[_0xcd38('0x36')]=_[_0xcd38('0x34')](_0x105572[_0xcd38('0x35')],qs[_0xcd38('0x37')](_0x201bb7[_0xcd38('0x31')]['fields']));_0x18f80a[_0xcd38('0x36')]=_0x18f80a[_0xcd38('0x36')][_0xcd38('0x38')]?_0x18f80a['attributes']:_0x105572[_0xcd38('0x35')];_0x18f80a[_0xcd38('0x3b')]=qs[_0xcd38('0x3c')](_0x201bb7['query']['sort']);_0x18f80a['where']=qs['filters'](_['pick'](_0x201bb7['query'],_0x105572['filters']));if(_0x201bb7[_0xcd38('0x31')]['filter']){_0x18f80a['where']=_[_0xcd38('0x41')](_0x18f80a[_0xcd38('0x3d')],{'$or':_[_0xcd38('0x2b')](_0x18f80a[_0xcd38('0x36')],function(_0x55162b){var _0xff42cd={};_0xff42cd[_0x55162b]={'$like':'%'+_0x201bb7[_0xcd38('0x31')][_0xcd38('0x40')]+'%'};return _0xff42cd;})});}_0x18f80a=_['merge']({},_0x18f80a,_0x201bb7[_0xcd38('0x42')]);return _0xec88e4[_0xcd38('0x4b')](_0x18f80a);}})[_0xcd38('0x23')](function(_0x4a5ea3){if(_0x4a5ea3){_0x716901=_0x4a5ea3['length'];if(!_0x201bb7[_0xcd38('0x31')]['hasOwnProperty'](_0xcd38('0x3a'))){_0x18f80a[_0xcd38('0x1d')]=qs[_0xcd38('0x1d')](_0x201bb7[_0xcd38('0x31')][_0xcd38('0x1d')]);_0x18f80a[_0xcd38('0x1b')]=qs[_0xcd38('0x1b')](_0x201bb7[_0xcd38('0x31')][_0xcd38('0x1b')]);}return _0xec88e4[_0xcd38('0x4b')](_0x18f80a);}})[_0xcd38('0x23')](function(_0x56ffe9){if(_0x56ffe9){return _0x56ffe9?{'count':_0x716901,'rows':_0x56ffe9}:null;}})[_0xcd38('0x23')](respondWithResult(_0x4ee843,null))[_0xcd38('0x45')](handleError(_0x4ee843,null));};exports[_0xcd38('0x4d')]=function(_0x3688b9,_0x7710ae,_0x3914e2){if(_0x3688b9['body']['id']){delete _0x3688b9['body']['id'];}return db['SugarcrmAccount'][_0xcd38('0x4c')]({'where':{'id':_0x3688b9[_0xcd38('0x47')]['id']}})['then'](handleEntityNotFound(_0x7710ae,null))[_0xcd38('0x23')](function(_0x2089f3){if(_0x2089f3){_0x3688b9[_0xcd38('0x49')]['AccountId']=_0x2089f3['id'];_0x3688b9['body']['Subjects']=integrations[_0xcd38('0x4e')](_0x3688b9[_0xcd38('0x49')][_0xcd38('0x4f')],_0x3688b9[_0xcd38('0x49')][_0xcd38('0x2f')]);_0x3688b9['body']['Descriptions']=integrations[_0xcd38('0x50')](_0x3688b9[_0xcd38('0x49')][_0xcd38('0x4f')],_0x3688b9[_0xcd38('0x49')][_0xcd38('0x2f')]);return db[_0xcd38('0x51')][_0xcd38('0x48')](_0x3688b9['body'],{'include':[{'model':db[_0xcd38('0x52')],'as':_0xcd38('0x53')},{'model':db[_0xcd38('0x52')],'as':_0xcd38('0x54')}]});}return null;})[_0xcd38('0x23')](respondWithResult(_0x7710ae,null))['catch'](handleError(_0x7710ae,null));};exports[_0xcd38('0x55')]=function(_0x5ef441,_0x42dbb4,_0x2f35aa){var _0x4ebfe1='';var _0x118e58=['id',_0xcd38('0x28'),'assigned_user_id',_0xcd38('0x56'),_0xcd38('0x57'),_0xcd38('0x58'),_0xcd38('0x59'),_0xcd38('0x5a'),_0xcd38('0x5b'),'parent_type',_0xcd38('0x5c'),_0xcd38('0x5d')];return db[_0xcd38('0x2c')]['findOne']({'where':{'id':_0x5ef441['params']['id']},'attributes':['id',_0xcd38('0x5e'),_0xcd38('0x5f'),_0xcd38('0x60')]})['then'](handleEntityNotFound(_0x42dbb4,null))[_0xcd38('0x23')](function(_0xdde5fa){if(_0xdde5fa){_0x4ebfe1=_0xdde5fa[_0xcd38('0x60')];var _0x2c3ddc=_0x4ebfe1['slice'](-0x1);if(_0x2c3ddc==='/'){_0x4ebfe1=_0x4ebfe1['substring'](0x0,_0x4ebfe1[_0xcd38('0x61')](_0x2c3ddc));}return rp({'method':_0xcd38('0x62'),'uri':util[_0xcd38('0x63')](_0xcd38('0x64'),_0x4ebfe1,_0xcd38('0x65')),'json':!![],'form':{'method':_0xcd38('0x66'),'input_type':_0xcd38('0x67'),'response_type':'JSON','rest_data':JSON[_0xcd38('0x68')]({'user_auth':{'user_name':_0xdde5fa['username'],'password':_0xdde5fa[_0xcd38('0x5f')],'encryption':_0xcd38('0x69')},'application':_0xcd38('0x6a')})}});}})[_0xcd38('0x23')](function(_0x2631f3){if(_0x2631f3&&_0x2631f3['name']!==_0xcd38('0x6b')&&_0x2631f3[_0xcd38('0x28')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0xcd38('0x63')](_0xcd38('0x64'),_0x4ebfe1,_0xcd38('0x65')),'json':!![],'form':{'method':_0xcd38('0x6c'),'input_type':_0xcd38('0x67'),'response_type':_0xcd38('0x67'),'rest_data':JSON[_0xcd38('0x68')]({'session':_0x2631f3['id'],'module_name':'Calls'})}})[_0xcd38('0x23')](function(_0x1b66dd){if(_0x1b66dd){var _0x1377a9=_[_0xcd38('0x6d')](_0x1b66dd[_0xcd38('0x6e')]);_['remove'](_0x1377a9,function(_0x5a07ca){return _0x118e58[_0xcd38('0x6f')](_0x5a07ca[_0xcd38('0x28')]);});return{'count':_0x1377a9[_0xcd38('0x38')],'rows':_[_0xcd38('0x2b')](_0x1377a9,function(_0x17942e){return{'id':_0x17942e[_0xcd38('0x28')],'name':_0x17942e['label'],'custom':_[_0xcd38('0x70')](_0x17942e['name'],'_c')?!![]:![],'options':_0x17942e[_0xcd38('0x42')]?_['map'](_[_0xcd38('0x6d')](_0x17942e[_0xcd38('0x42')]),function(_0x10e276){return{'name':_0x10e276['value'],'value':_0x10e276[_0xcd38('0x28')]};}):[]};})};}})[_0xcd38('0x23')](respondWithResult(_0x42dbb4,null))[_0xcd38('0x45')](function(_0x5eb0a3){var _0x4c0f59=_0x5ef441[_0xcd38('0x31')][_0xcd38('0x71')]?0x1f4:_0x5eb0a3[_0xcd38('0x72')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0xcd38('0x55'),_0x4c0f59,JSON[_0xcd38('0x68')](_0x5eb0a3));delete _0x5eb0a3[_0xcd38('0x28')];if(_0x4c0f59===0x191){_0x4c0f59=0x190;}_0x42dbb4['status'](_0x4c0f59)['send'](_0x5ef441[_0xcd38('0x31')][_0xcd38('0x71')]?{'message':_0xcd38('0x73'),'statusCode':_0x5eb0a3[_0xcd38('0x72')]}:_0x5eb0a3);});}else{var _0x28e664=0x1f4;_0x42dbb4[_0xcd38('0x18')](_0x28e664)[_0xcd38('0x29')]({'message':_0xcd38('0x73'),'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 6c56ec9..8132dc9 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 _0x0e5b=['../../components/integrations/configuration','SugarcrmAccount','int_sugarcrm_accounts','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmAccount.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0e5b,0x9d));var _0xb0e5=function(_0x399a4b,_0x4d0350){_0x399a4b=_0x399a4b-0x0;var _0x58f942=_0x0e5b[_0x399a4b];return _0x58f942;};'use strict';var _=require('lodash');var util=require(_0xb0e5('0x0'));var logger=require(_0xb0e5('0x1'))(_0xb0e5('0x2'));var moment=require('moment');var BPromise=require(_0xb0e5('0x3'));var rp=require(_0xb0e5('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb0e5('0x5'));var config=require(_0xb0e5('0x6'));var attributes=require(_0xb0e5('0x7'));var integrations=require(_0xb0e5('0x8'));module['exports']=function(_0x206407,_0xc81aec){return _0x206407['define'](_0xb0e5('0x9'),attributes,{'tableName':_0xb0e5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4213=['rimraf','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports','define','SugarcrmAccount','int_sugarcrm_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x12d8ee,_0x34edb8){var _0x5bc140=function(_0x50a109){while(--_0x50a109){_0x12d8ee['push'](_0x12d8ee['shift']());}};_0x5bc140(++_0x34edb8);}(_0x4213,0x77));var _0x3421=function(_0x9caf41,_0x4b8001){_0x9caf41=_0x9caf41-0x0;var _0x13574b=_0x4213[_0x9caf41];return _0x13574b;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var logger=require(_0x3421('0x2'))(_0x3421('0x3'));var moment=require(_0x3421('0x4'));var BPromise=require(_0x3421('0x5'));var rp=require(_0x3421('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3421('0x7'));var config=require('../../config/environment');var attributes=require(_0x3421('0x8'));var integrations=require(_0x3421('0x9'));module[_0x3421('0xa')]=function(_0x2a04e0,_0x5469d8){return _0x2a04e0[_0x3421('0xb')](_0x3421('0xc'),attributes,{'tableName':_0x3421('0xd'),'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 d5dfcae..4e7677b 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 _0x1a3c=['info','request\x20sent','debug','error','code','SugarcrmAccount,\x20%s,\x20%s','message','catch','GetSugarcrmAccount','SugarcrmAccount','raw','options','attributes','map','model','include','stringify','find','where','ShowSugarcrmAccount','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x7eee7,_0x3779a1){var _0x469f62=function(_0x553717){while(--_0x553717){_0x7eee7['push'](_0x7eee7['shift']());}};_0x469f62(++_0x3779a1);}(_0x1a3c,0x7d));var _0xc1a3=function(_0x88bfdf,_0x1bda04){_0x88bfdf=_0x88bfdf-0x0;var _0x330c6e=_0x1a3c[_0x88bfdf];return _0x330c6e;};'use strict';var _=require(_0xc1a3('0x0'));var util=require(_0xc1a3('0x1'));var moment=require(_0xc1a3('0x2'));var BPromise=require('bluebird');var rs=require(_0xc1a3('0x3'));var fs=require('fs');var Redis=require(_0xc1a3('0x4'));var db=require(_0xc1a3('0x5'))['db'];var utils=require(_0xc1a3('0x6'));var logger=require(_0xc1a3('0x7'))(_0xc1a3('0x8'));var config=require(_0xc1a3('0x9'));var jayson=require(_0xc1a3('0xa'));var client=jayson[_0xc1a3('0xb')][_0xc1a3('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x43c242,_0x3210ad,_0x2b6f5f){return new BPromise(function(_0x280041,_0x5dbd39){return client[_0xc1a3('0xd')](_0x43c242,_0x2b6f5f)[_0xc1a3('0xe')](function(_0x4025b2){logger[_0xc1a3('0xf')]('SugarcrmAccount,\x20%s,\x20%s',_0x3210ad,_0xc1a3('0x10'));logger[_0xc1a3('0x11')]('SugarcrmAccount,\x20%s,\x20%s,\x20%s',_0x3210ad,_0xc1a3('0x10'),JSON['stringify'](_0x4025b2));if(_0x4025b2['error']){if(_0x4025b2[_0xc1a3('0x12')][_0xc1a3('0x13')]===0x1f4){logger[_0xc1a3('0x12')](_0xc1a3('0x14'),_0x3210ad,_0x4025b2[_0xc1a3('0x12')][_0xc1a3('0x15')]);return _0x5dbd39(_0x4025b2[_0xc1a3('0x12')]['message']);}logger['error'](_0xc1a3('0x14'),_0x3210ad,_0x4025b2[_0xc1a3('0x12')][_0xc1a3('0x15')]);return _0x280041(_0x4025b2[_0xc1a3('0x12')][_0xc1a3('0x15')]);}else{logger[_0xc1a3('0xf')](_0xc1a3('0x14'),_0x3210ad,_0xc1a3('0x10'));_0x280041(_0x4025b2['result'][_0xc1a3('0x15')]);}})[_0xc1a3('0x16')](function(_0x1cf9cb){logger['error'](_0xc1a3('0x14'),_0x3210ad,_0x1cf9cb);_0x5dbd39(_0x1cf9cb);});});}exports[_0xc1a3('0x17')]=function(_0x32a469){var _0x25310b=this;return new Promise(function(_0x2fa962,_0x78e09a){return db[_0xc1a3('0x18')]['findAll']({'raw':_0x32a469['options']?_0x32a469['options'][_0xc1a3('0x19')]===undefined?!![]:![]:!![],'where':_0x32a469[_0xc1a3('0x1a')]?_0x32a469[_0xc1a3('0x1a')]['where']||null:null,'attributes':_0x32a469[_0xc1a3('0x1a')]?_0x32a469[_0xc1a3('0x1a')][_0xc1a3('0x1b')]||null:null,'limit':_0x32a469[_0xc1a3('0x1a')]?_0x32a469[_0xc1a3('0x1a')]['limit']||null:null,'include':_0x32a469['options']?_0x32a469[_0xc1a3('0x1a')]['include']?_[_0xc1a3('0x1c')](_0x32a469['options']['include'],function(_0x3f09da){return{'model':db[_0x3f09da[_0xc1a3('0x1d')]],'as':_0x3f09da['as'],'attributes':_0x3f09da[_0xc1a3('0x1b')],'include':_0x3f09da[_0xc1a3('0x1e')]?_[_0xc1a3('0x1c')](_0x3f09da[_0xc1a3('0x1e')],function(_0x3d5df0){return{'model':db[_0x3d5df0[_0xc1a3('0x1d')]],'as':_0x3d5df0['as'],'attributes':_0x3d5df0[_0xc1a3('0x1b')],'include':_0x3d5df0[_0xc1a3('0x1e')]?_[_0xc1a3('0x1c')](_0x3d5df0[_0xc1a3('0x1e')],function(_0x19f6e1){return{'model':db[_0x19f6e1['model']],'as':_0x19f6e1['as'],'attributes':_0x19f6e1[_0xc1a3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xc1a3('0xe')](function(_0x5a806d){logger[_0xc1a3('0xf')](_0xc1a3('0x17'),_0x32a469);logger[_0xc1a3('0x11')](_0xc1a3('0x17'),_0x32a469,JSON[_0xc1a3('0x1f')](_0x5a806d));_0x2fa962(_0x5a806d);})[_0xc1a3('0x16')](function(_0x115f09){logger[_0xc1a3('0x12')](_0xc1a3('0x17'),_0x115f09['message'],_0x32a469);_0x78e09a(_0x25310b[_0xc1a3('0x12')](0x1f4,_0x115f09[_0xc1a3('0x15')]));});});};exports['ShowSugarcrmAccount']=function(_0x5bd7e1){var _0x518295=this;return new Promise(function(_0x417d5e,_0x147d87){return db['SugarcrmAccount'][_0xc1a3('0x20')]({'raw':_0x5bd7e1[_0xc1a3('0x1a')]?_0x5bd7e1['options'][_0xc1a3('0x19')]===undefined?!![]:![]:!![],'where':_0x5bd7e1[_0xc1a3('0x1a')]?_0x5bd7e1[_0xc1a3('0x1a')][_0xc1a3('0x21')]||null:null,'attributes':_0x5bd7e1[_0xc1a3('0x1a')]?_0x5bd7e1[_0xc1a3('0x1a')][_0xc1a3('0x1b')]||null:null,'include':_0x5bd7e1['options']?_0x5bd7e1['options']['include']?_[_0xc1a3('0x1c')](_0x5bd7e1[_0xc1a3('0x1a')][_0xc1a3('0x1e')],function(_0x56b44a){return{'model':db[_0x56b44a['model']],'as':_0x56b44a['as'],'attributes':_0x56b44a[_0xc1a3('0x1b')],'include':_0x56b44a[_0xc1a3('0x1e')]?_[_0xc1a3('0x1c')](_0x56b44a[_0xc1a3('0x1e')],function(_0x9859c7){return{'model':db[_0x9859c7['model']],'as':_0x9859c7['as'],'attributes':_0x9859c7[_0xc1a3('0x1b')],'include':_0x9859c7['include']?_[_0xc1a3('0x1c')](_0x9859c7['include'],function(_0x57ff5c){return{'model':db[_0x57ff5c[_0xc1a3('0x1d')]],'as':_0x57ff5c['as'],'attributes':_0x57ff5c['attributes']};}):[]};}):[]};}):[]:[]})[_0xc1a3('0xe')](function(_0x2e3a36){logger[_0xc1a3('0xf')](_0xc1a3('0x22'),_0x5bd7e1);logger[_0xc1a3('0x11')](_0xc1a3('0x22'),_0x5bd7e1,JSON[_0xc1a3('0x1f')](_0x2e3a36));_0x417d5e(_0x2e3a36);})[_0xc1a3('0x16')](function(_0x43a52b){logger['error']('ShowSugarcrmAccount',_0x43a52b['message'],_0x5bd7e1);_0x147d87(_0x518295[_0xc1a3('0x12')](0x1f4,_0x43a52b[_0xc1a3('0x15')]));});});}; \ No newline at end of file +var _0xef9b=['bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmAccount,\x20%s,\x20%s','message','info','result','GetSugarcrmAccount','SugarcrmAccount','findAll','options','raw','where','limit','include','model','attributes','map','catch','find','ShowSugarcrmAccount','lodash','util'];(function(_0x26f788,_0x37bae9){var _0xb1f893=function(_0x46fce6){while(--_0x46fce6){_0x26f788['push'](_0x26f788['shift']());}};_0xb1f893(++_0x37bae9);}(_0xef9b,0x18a));var _0xbef9=function(_0x1f41a3,_0x1f993b){_0x1f41a3=_0x1f41a3-0x0;var _0x231ab4=_0xef9b[_0x1f41a3];return _0x231ab4;};'use strict';var _=require(_0xbef9('0x0'));var util=require(_0xbef9('0x1'));var moment=require('moment');var BPromise=require(_0xbef9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbef9('0x3'));var db=require(_0xbef9('0x4'))['db'];var utils=require(_0xbef9('0x5'));var logger=require('../../config/logger')(_0xbef9('0x6'));var config=require(_0xbef9('0x7'));var jayson=require(_0xbef9('0x8'));var client=jayson['client'][_0xbef9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a5880,_0x3dc715,_0x38f208){return new BPromise(function(_0x4f339a,_0x3f271d){return client[_0xbef9('0xa')](_0x2a5880,_0x38f208)[_0xbef9('0xb')](function(_0x13a3e4){logger['info']('SugarcrmAccount,\x20%s,\x20%s',_0x3dc715,_0xbef9('0xc'));logger[_0xbef9('0xd')](_0xbef9('0xe'),_0x3dc715,'request\x20sent',JSON[_0xbef9('0xf')](_0x13a3e4));if(_0x13a3e4[_0xbef9('0x10')]){if(_0x13a3e4[_0xbef9('0x10')][_0xbef9('0x11')]===0x1f4){logger[_0xbef9('0x10')](_0xbef9('0x12'),_0x3dc715,_0x13a3e4['error'][_0xbef9('0x13')]);return _0x3f271d(_0x13a3e4[_0xbef9('0x10')][_0xbef9('0x13')]);}logger[_0xbef9('0x10')](_0xbef9('0x12'),_0x3dc715,_0x13a3e4[_0xbef9('0x10')][_0xbef9('0x13')]);return _0x4f339a(_0x13a3e4[_0xbef9('0x10')][_0xbef9('0x13')]);}else{logger[_0xbef9('0x14')]('SugarcrmAccount,\x20%s,\x20%s',_0x3dc715,_0xbef9('0xc'));_0x4f339a(_0x13a3e4[_0xbef9('0x15')][_0xbef9('0x13')]);}})['catch'](function(_0x483852){logger[_0xbef9('0x10')](_0xbef9('0x12'),_0x3dc715,_0x483852);_0x3f271d(_0x483852);});});}exports[_0xbef9('0x16')]=function(_0xbc9c46){var _0x3b859f=this;return new Promise(function(_0x4b1022,_0xe1bcda){return db[_0xbef9('0x17')][_0xbef9('0x18')]({'raw':_0xbc9c46['options']?_0xbc9c46[_0xbef9('0x19')][_0xbef9('0x1a')]===undefined?!![]:![]:!![],'where':_0xbc9c46[_0xbef9('0x19')]?_0xbc9c46[_0xbef9('0x19')][_0xbef9('0x1b')]||null:null,'attributes':_0xbc9c46[_0xbef9('0x19')]?_0xbc9c46[_0xbef9('0x19')]['attributes']||null:null,'limit':_0xbc9c46['options']?_0xbc9c46['options'][_0xbef9('0x1c')]||null:null,'include':_0xbc9c46[_0xbef9('0x19')]?_0xbc9c46[_0xbef9('0x19')][_0xbef9('0x1d')]?_['map'](_0xbc9c46[_0xbef9('0x19')][_0xbef9('0x1d')],function(_0x36083c){return{'model':db[_0x36083c[_0xbef9('0x1e')]],'as':_0x36083c['as'],'attributes':_0x36083c[_0xbef9('0x1f')],'include':_0x36083c[_0xbef9('0x1d')]?_[_0xbef9('0x20')](_0x36083c['include'],function(_0x4e84fe){return{'model':db[_0x4e84fe[_0xbef9('0x1e')]],'as':_0x4e84fe['as'],'attributes':_0x4e84fe['attributes'],'include':_0x4e84fe[_0xbef9('0x1d')]?_[_0xbef9('0x20')](_0x4e84fe[_0xbef9('0x1d')],function(_0xebda52){return{'model':db[_0xebda52[_0xbef9('0x1e')]],'as':_0xebda52['as'],'attributes':_0xebda52[_0xbef9('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x27b544){logger[_0xbef9('0x14')](_0xbef9('0x16'),_0xbc9c46);logger[_0xbef9('0xd')]('GetSugarcrmAccount',_0xbc9c46,JSON[_0xbef9('0xf')](_0x27b544));_0x4b1022(_0x27b544);})[_0xbef9('0x21')](function(_0x463a4b){logger[_0xbef9('0x10')]('GetSugarcrmAccount',_0x463a4b[_0xbef9('0x13')],_0xbc9c46);_0xe1bcda(_0x3b859f[_0xbef9('0x10')](0x1f4,_0x463a4b[_0xbef9('0x13')]));});});};exports['ShowSugarcrmAccount']=function(_0x4f0748){var _0x415ebc=this;return new Promise(function(_0x2c4139,_0x6e098f){return db[_0xbef9('0x17')][_0xbef9('0x22')]({'raw':_0x4f0748[_0xbef9('0x19')]?_0x4f0748[_0xbef9('0x19')][_0xbef9('0x1a')]===undefined?!![]:![]:!![],'where':_0x4f0748[_0xbef9('0x19')]?_0x4f0748[_0xbef9('0x19')]['where']||null:null,'attributes':_0x4f0748[_0xbef9('0x19')]?_0x4f0748[_0xbef9('0x19')]['attributes']||null:null,'include':_0x4f0748[_0xbef9('0x19')]?_0x4f0748['options']['include']?_[_0xbef9('0x20')](_0x4f0748['options']['include'],function(_0xcf60ef){return{'model':db[_0xcf60ef['model']],'as':_0xcf60ef['as'],'attributes':_0xcf60ef[_0xbef9('0x1f')],'include':_0xcf60ef['include']?_[_0xbef9('0x20')](_0xcf60ef[_0xbef9('0x1d')],function(_0x39a364){return{'model':db[_0x39a364[_0xbef9('0x1e')]],'as':_0x39a364['as'],'attributes':_0x39a364[_0xbef9('0x1f')],'include':_0x39a364['include']?_[_0xbef9('0x20')](_0x39a364[_0xbef9('0x1d')],function(_0x1b28b9){return{'model':db[_0x1b28b9[_0xbef9('0x1e')]],'as':_0x1b28b9['as'],'attributes':_0x1b28b9['attributes']};}):[]};}):[]};}):[]:[]})[_0xbef9('0xb')](function(_0xd94eb7){logger[_0xbef9('0x14')]('ShowSugarcrmAccount',_0x4f0748);logger[_0xbef9('0xd')](_0xbef9('0x23'),_0x4f0748,JSON['stringify'](_0xd94eb7));_0x2c4139(_0xd94eb7);})[_0xbef9('0x21')](function(_0x2e74ad){logger['error']('ShowSugarcrmAccount',_0x2e74ad[_0xbef9('0x13')],_0x4f0748);_0x6e098f(_0x415ebc[_0xbef9('0x10')](0x1f4,_0x2e74ad['message']));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 85cae42..07d9677 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 _0xc0d1=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','index','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','put','update','delete','destroy','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xc0d1,0x7d));var _0x1c0d=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0xc0d1[_0x4565bf];return _0x5610ba;};'use strict';var multer=require(_0x1c0d('0x0'));var util=require(_0x1c0d('0x1'));var path=require('path');var timeout=require(_0x1c0d('0x2'));var express=require(_0x1c0d('0x3'));var router=express[_0x1c0d('0x4')]();var fs_extra=require(_0x1c0d('0x5'));var auth=require(_0x1c0d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1c0d('0x7'));var controller=require(_0x1c0d('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x1c0d('0x9')]);router[_0x1c0d('0xa')](_0x1c0d('0xb'),auth[_0x1c0d('0xc')](),controller[_0x1c0d('0xd')]);router[_0x1c0d('0xa')](_0x1c0d('0xe'),auth[_0x1c0d('0xc')](),controller[_0x1c0d('0xf')]);router['get'](_0x1c0d('0x10'),auth[_0x1c0d('0xc')](),controller['getSubjects']);router[_0x1c0d('0xa')](_0x1c0d('0x11'),auth[_0x1c0d('0xc')](),controller[_0x1c0d('0x12')]);router[_0x1c0d('0x13')]('/',auth[_0x1c0d('0xc')](),controller['create']);router[_0x1c0d('0x14')](_0x1c0d('0xb'),auth[_0x1c0d('0xc')](),controller[_0x1c0d('0x15')]);router[_0x1c0d('0x16')]('/:id',auth[_0x1c0d('0xc')](),controller[_0x1c0d('0x17')]);module[_0x1c0d('0x18')]=router; \ No newline at end of file +var _0xbd3f=['exports','multer','util','path','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','getSubjects','getDescriptions','post','create','put','update','delete','destroy'];(function(_0x2081c0,_0x83729c){var _0x4c6828=function(_0x16b613){while(--_0x16b613){_0x2081c0['push'](_0x2081c0['shift']());}};_0x4c6828(++_0x83729c);}(_0xbd3f,0x1dc));var _0xfbd3=function(_0x4b505a,_0x1bffc6){_0x4b505a=_0x4b505a-0x0;var _0x4a09f7=_0xbd3f[_0x4b505a];return _0x4a09f7;};'use strict';var multer=require(_0xfbd3('0x0'));var util=require(_0xfbd3('0x1'));var path=require(_0xfbd3('0x2'));var timeout=require('connect-timeout');var express=require(_0xfbd3('0x3'));var router=express[_0xfbd3('0x4')]();var fs_extra=require(_0xfbd3('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xfbd3('0x6'));var config=require(_0xfbd3('0x7'));var controller=require(_0xfbd3('0x8'));router[_0xfbd3('0x9')]('/',auth[_0xfbd3('0xa')](),controller[_0xfbd3('0xb')]);router[_0xfbd3('0x9')](_0xfbd3('0xc'),auth['isAuthenticated'](),controller[_0xfbd3('0xd')]);router[_0xfbd3('0x9')](_0xfbd3('0xe'),auth[_0xfbd3('0xa')](),controller[_0xfbd3('0xf')]);router[_0xfbd3('0x9')]('/:id/subjects',auth[_0xfbd3('0xa')](),controller[_0xfbd3('0x10')]);router[_0xfbd3('0x9')]('/:id/descriptions',auth[_0xfbd3('0xa')](),controller[_0xfbd3('0x11')]);router[_0xfbd3('0x12')]('/',auth[_0xfbd3('0xa')](),controller[_0xfbd3('0x13')]);router[_0xfbd3('0x14')](_0xfbd3('0xc'),auth['isAuthenticated'](),controller[_0xfbd3('0x15')]);router[_0xfbd3('0x16')](_0xfbd3('0xc'),auth['isAuthenticated'](),controller[_0xfbd3('0x17')]);module[_0xfbd3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.attributes.js index 05693dc..22a09af 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 _0x327c=['sequelize','STRING'];(function(_0x2070da,_0x45e586){var _0x4f9fe1=function(_0x5b6f2a){while(--_0x5b6f2a){_0x2070da['push'](_0x2070da['shift']());}};_0x4f9fe1(++_0x45e586);}(_0x327c,0x18c));var _0xc327=function(_0x3edc0b,_0x5bdc05){_0x3edc0b=_0x3edc0b-0x0;var _0x117b48=_0x327c[_0x3edc0b];return _0x117b48;};'use strict';var Sequelize=require(_0xc327('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xc327('0x1')]}}; \ No newline at end of file +var _0x0acf=['STRING','sequelize','exports'];(function(_0x227c81,_0x12d514){var _0x280284=function(_0x151c7c){while(--_0x151c7c){_0x227c81['push'](_0x227c81['shift']());}};_0x280284(++_0x12d514);}(_0x0acf,0x1a5));var _0xf0ac=function(_0x4ec863,_0x85080a){_0x4ec863=_0x4ec863-0x0;var _0x2071fc=_0x0acf[_0x4ec863];return _0x2071fc;};'use strict';var Sequelize=require(_0xf0ac('0x0'));module[_0xf0ac('0x1')]={'name':{'type':Sequelize[_0xf0ac('0x2')]},'description':{'type':Sequelize[_0xf0ac('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index a70613c..1e67187 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 _0xe941=['then','error','name','send','map','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','SugarcrmConfiguration','includeAll','findAll','rows','show','params','rawAttributes','include','find','create','body','catch','getFields','getSubjects','findOne','SugarcrmField','order','pick','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','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','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','update','destroy'];(function(_0x349570,_0x418be4){var _0x5acb48=function(_0x4679f6){while(--_0x4679f6){_0x349570['push'](_0x349570['shift']());}};_0x5acb48(++_0x418be4);}(_0xe941,0x77));var _0x1e94=function(_0x164eca,_0x555e28){_0x164eca=_0x164eca-0x0;var _0x2ce562=_0xe941[_0x164eca];return _0x2ce562;};'use strict';var emlformat=require(_0x1e94('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e94('0x1'));var jsonpatch=require(_0x1e94('0x2'));var rp=require(_0x1e94('0x3'));var moment=require(_0x1e94('0x4'));var BPromise=require(_0x1e94('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1e94('0x6'));var sox=require(_0x1e94('0x7'));var csv=require(_0x1e94('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e94('0x9'));var _=require('lodash');var squel=require(_0x1e94('0xa'));var crypto=require('crypto');var jsforce=require(_0x1e94('0xb'));var deskjs=require(_0x1e94('0xc'));var toCsv=require(_0x1e94('0x8'));var querystring=require(_0x1e94('0xd'));var Papa=require(_0x1e94('0xe'));var Redis=require(_0x1e94('0xf'));var authService=require(_0x1e94('0x10'));var qs=require(_0x1e94('0x11'));var as=require(_0x1e94('0x12'));var hardwareService=require(_0x1e94('0x13'));var logger=require(_0x1e94('0x14'))(_0x1e94('0x15'));var utils=require(_0x1e94('0x16'));var config=require(_0x1e94('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1a5c27,_0x3aa6d8){_0x3aa6d8=_0x3aa6d8||0xcc;return function(_0x573e0b){if(_0x573e0b){return _0x1a5c27[_0x1e94('0x18')](_0x3aa6d8);}return _0x1a5c27[_0x1e94('0x19')](_0x3aa6d8)[_0x1e94('0x1a')]();};}function respondWithResult(_0x31a15f,_0x34b0cf){_0x34b0cf=_0x34b0cf||0xc8;return function(_0x16f211){if(_0x16f211){return _0x31a15f[_0x1e94('0x19')](_0x34b0cf)[_0x1e94('0x1b')](_0x16f211);}};}function respondWithFilteredResult(_0x4e2d36,_0x440014){return function(_0x458673){if(_0x458673){var _0x3b58f4=typeof _0x440014[_0x1e94('0x1c')]===_0x1e94('0x1d')&&typeof _0x440014[_0x1e94('0x1e')]===_0x1e94('0x1d');var _0x9b942e=_0x458673['count'];var _0x1160e3=_0x3b58f4?0x0:_0x440014[_0x1e94('0x1c')];var _0x391461=_0x3b58f4?_0x458673[_0x1e94('0x1f')]:_0x440014[_0x1e94('0x1c')]+_0x440014[_0x1e94('0x1e')];var _0x3a6e37;if(_0x391461>=_0x9b942e){_0x391461=_0x9b942e;_0x3a6e37=0xc8;}else{_0x3a6e37=0xce;}_0x4e2d36[_0x1e94('0x19')](_0x3a6e37);return _0x4e2d36[_0x1e94('0x20')]('Content-Range',_0x1160e3+'-'+_0x391461+'/'+_0x9b942e)[_0x1e94('0x1b')](_0x458673);}return null;};}function patchUpdates(_0x3a2af0){return function(_0x35d2ed){try{jsonpatch[_0x1e94('0x21')](_0x35d2ed,_0x3a2af0,!![]);}catch(_0x5cb402){return BPromise[_0x1e94('0x22')](_0x5cb402);}return _0x35d2ed['save']();};}function saveUpdates(_0x43876c,_0x52917a){return function(_0x1833ba){if(_0x1833ba){return _0x1833ba[_0x1e94('0x23')](_0x43876c)['then'](function(_0x18c070){return _0x18c070;});}return null;};}function removeEntity(_0x5f0423,_0x2f0daa){return function(_0x1ba21d){if(_0x1ba21d){return _0x1ba21d[_0x1e94('0x24')]()[_0x1e94('0x25')](function(){_0x5f0423['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x81f226,_0x2532f4){return function(_0x5db746){if(!_0x5db746){_0x81f226[_0x1e94('0x18')](0x194);}return _0x5db746;};}function handleError(_0x192c6d,_0x5de5d6){_0x5de5d6=_0x5de5d6||0x1f4;return function(_0x22945f){logger[_0x1e94('0x26')](_0x22945f['stack']);if(_0x22945f[_0x1e94('0x27')]){delete _0x22945f['name'];}_0x192c6d[_0x1e94('0x19')](_0x5de5d6)[_0x1e94('0x28')](_0x22945f);};}exports['index']=function(_0x2aea65,_0x5ec47c){var _0x2ac7ea={},_0x292542={},_0x4a4dc3={'count':0x0,'rows':[]};var _0xc13194=_[_0x1e94('0x29')](db['SugarcrmConfiguration']['rawAttributes'],function(_0x34359b){return{'name':_0x34359b[_0x1e94('0x2a')],'type':_0x34359b[_0x1e94('0x2b')]['key']};});_0x292542[_0x1e94('0x2c')]=_[_0x1e94('0x29')](_0xc13194,'name');_0x292542[_0x1e94('0x2d')]=_[_0x1e94('0x2e')](_0x2aea65['query']);_0x292542[_0x1e94('0x2f')]=_[_0x1e94('0x30')](_0x292542['model'],_0x292542[_0x1e94('0x2d')]);_0x2ac7ea[_0x1e94('0x31')]=_[_0x1e94('0x30')](_0x292542['model'],qs[_0x1e94('0x32')](_0x2aea65[_0x1e94('0x2d')]['fields']));_0x2ac7ea[_0x1e94('0x31')]=_0x2ac7ea[_0x1e94('0x31')][_0x1e94('0x33')]?_0x2ac7ea[_0x1e94('0x31')]:_0x292542[_0x1e94('0x2c')];if(!_0x2aea65[_0x1e94('0x2d')][_0x1e94('0x34')](_0x1e94('0x35'))){_0x2ac7ea[_0x1e94('0x1e')]=qs[_0x1e94('0x1e')](_0x2aea65['query'][_0x1e94('0x1e')]);_0x2ac7ea[_0x1e94('0x1c')]=qs[_0x1e94('0x1c')](_0x2aea65[_0x1e94('0x2d')][_0x1e94('0x1c')]);}_0x2ac7ea['order']=qs[_0x1e94('0x36')](_0x2aea65[_0x1e94('0x2d')][_0x1e94('0x36')]);_0x2ac7ea['where']=qs['filters'](_['pick'](_0x2aea65[_0x1e94('0x2d')],_0x292542['filters']),_0xc13194);if(_0x2aea65[_0x1e94('0x2d')][_0x1e94('0x37')]){_0x2ac7ea[_0x1e94('0x38')]=_[_0x1e94('0x39')](_0x2ac7ea['where'],{'$or':_[_0x1e94('0x29')](_0xc13194,function(_0x57867f){if(_0x57867f['type']!=='VIRTUAL'){var _0x1fc501={};_0x1fc501[_0x57867f[_0x1e94('0x27')]]={'$like':'%'+_0x2aea65['query'][_0x1e94('0x37')]+'%'};return _0x1fc501;}})});}_0x2ac7ea=_[_0x1e94('0x39')]({},_0x2ac7ea,_0x2aea65[_0x1e94('0x3a')]);var _0x941958={'where':_0x2ac7ea[_0x1e94('0x38')]};return db[_0x1e94('0x3b')][_0x1e94('0x1f')](_0x941958)[_0x1e94('0x25')](function(_0x512d60){_0x4a4dc3[_0x1e94('0x1f')]=_0x512d60;if(_0x2aea65['query'][_0x1e94('0x3c')]){_0x2ac7ea['include']=[{'all':!![]}];}return db[_0x1e94('0x3b')][_0x1e94('0x3d')](_0x2ac7ea);})[_0x1e94('0x25')](function(_0x4b2008){_0x4a4dc3[_0x1e94('0x3e')]=_0x4b2008;return _0x4a4dc3;})['then'](respondWithFilteredResult(_0x5ec47c,_0x2ac7ea))['catch'](handleError(_0x5ec47c,null));};exports[_0x1e94('0x3f')]=function(_0x51b898,_0x23e9ed){var _0x2c9afa={'raw':![],'where':{'id':_0x51b898[_0x1e94('0x40')]['id']}},_0x3f2a6={};_0x3f2a6[_0x1e94('0x2c')]=_['keys'](db[_0x1e94('0x3b')][_0x1e94('0x41')]);_0x3f2a6[_0x1e94('0x2d')]=_[_0x1e94('0x2e')](_0x51b898['query']);_0x3f2a6['filters']=_[_0x1e94('0x30')](_0x3f2a6['model'],_0x3f2a6[_0x1e94('0x2d')]);_0x2c9afa[_0x1e94('0x31')]=_[_0x1e94('0x30')](_0x3f2a6['model'],qs[_0x1e94('0x32')](_0x51b898['query'][_0x1e94('0x32')]));_0x2c9afa['attributes']=_0x2c9afa['attributes'][_0x1e94('0x33')]?_0x2c9afa['attributes']:_0x3f2a6[_0x1e94('0x2c')];if(_0x51b898['query'][_0x1e94('0x3c')]){_0x2c9afa[_0x1e94('0x42')]=[{'all':!![]}];}_0x2c9afa=_[_0x1e94('0x39')]({},_0x2c9afa,_0x51b898['options']);return db[_0x1e94('0x3b')][_0x1e94('0x43')](_0x2c9afa)[_0x1e94('0x25')](handleEntityNotFound(_0x23e9ed,null))[_0x1e94('0x25')](respondWithResult(_0x23e9ed,null))['catch'](handleError(_0x23e9ed,null));};exports[_0x1e94('0x44')]=function(_0x501b21,_0x35a3c3){return db['SugarcrmConfiguration'][_0x1e94('0x44')](_0x501b21[_0x1e94('0x45')],{})[_0x1e94('0x25')](respondWithResult(_0x35a3c3,0xc9))['catch'](handleError(_0x35a3c3,null));};exports[_0x1e94('0x23')]=function(_0x1ab172,_0x5153bd){if(_0x1ab172['body']['id']){delete _0x1ab172['body']['id'];}return db[_0x1e94('0x3b')][_0x1e94('0x43')]({'where':{'id':_0x1ab172['params']['id']}})['then'](handleEntityNotFound(_0x5153bd,null))['then'](saveUpdates(_0x1ab172[_0x1e94('0x45')],null))['then'](respondWithResult(_0x5153bd,null))['catch'](handleError(_0x5153bd,null));};exports['destroy']=function(_0x4775d1,_0x33506a){return db['SugarcrmConfiguration'][_0x1e94('0x43')]({'where':{'id':_0x4775d1['params']['id']}})[_0x1e94('0x25')](handleEntityNotFound(_0x33506a,null))[_0x1e94('0x25')](removeEntity(_0x33506a,null))[_0x1e94('0x46')](handleError(_0x33506a,null));};exports[_0x1e94('0x47')]=function(_0x59544e,_0x58f77f,_0x329126){var _0x4b70bb={};var _0x5ce4b7={};var _0x5cfcbe;var _0x578ebf;return db['SugarcrmConfiguration']['findOne']({'where':{'id':_0x59544e['params']['id']}})[_0x1e94('0x25')](handleEntityNotFound(_0x58f77f,null))['then'](function(_0x18c7ba){if(_0x18c7ba){_0x5cfcbe=_0x18c7ba;_0x5ce4b7[_0x1e94('0x2c')]=_[_0x1e94('0x2e')](db['SugarcrmField']['rawAttributes']);_0x5ce4b7[_0x1e94('0x2d')]=_[_0x1e94('0x2e')](_0x59544e[_0x1e94('0x2d')]);_0x5ce4b7[_0x1e94('0x2f')]=_[_0x1e94('0x30')](_0x5ce4b7[_0x1e94('0x2c')],_0x5ce4b7[_0x1e94('0x2d')]);_0x4b70bb[_0x1e94('0x31')]=_[_0x1e94('0x30')](_0x5ce4b7[_0x1e94('0x2c')],qs[_0x1e94('0x32')](_0x59544e[_0x1e94('0x2d')]['fields']));_0x4b70bb['attributes']=_0x4b70bb[_0x1e94('0x31')][_0x1e94('0x33')]?_0x4b70bb['attributes']:_0x5ce4b7[_0x1e94('0x2c')];_0x4b70bb['order']=qs[_0x1e94('0x36')](_0x59544e[_0x1e94('0x2d')]['sort']);_0x4b70bb[_0x1e94('0x38')]=qs['filters'](_['pick'](_0x59544e[_0x1e94('0x2d')],_0x5ce4b7[_0x1e94('0x2f')]));if(_0x59544e[_0x1e94('0x2d')]['filter']){_0x4b70bb[_0x1e94('0x38')]=_['merge'](_0x4b70bb['where'],{'$or':_[_0x1e94('0x29')](_0x4b70bb[_0x1e94('0x31')],function(_0x5d6a00){var _0x4b0220={};_0x4b0220[_0x5d6a00]={'$like':'%'+_0x59544e[_0x1e94('0x2d')][_0x1e94('0x37')]+'%'};return _0x4b0220;})});}_0x4b70bb=_[_0x1e94('0x39')]({},_0x4b70bb,_0x59544e[_0x1e94('0x3a')]);return _0x5cfcbe[_0x1e94('0x47')](_0x4b70bb);}})[_0x1e94('0x25')](function(_0x371ffa){if(_0x371ffa){_0x578ebf=_0x371ffa[_0x1e94('0x33')];if(!_0x59544e['query'][_0x1e94('0x34')](_0x1e94('0x35'))){_0x4b70bb[_0x1e94('0x1e')]=qs[_0x1e94('0x1e')](_0x59544e['query'][_0x1e94('0x1e')]);_0x4b70bb[_0x1e94('0x1c')]=qs[_0x1e94('0x1c')](_0x59544e[_0x1e94('0x2d')][_0x1e94('0x1c')]);}return _0x5cfcbe[_0x1e94('0x47')](_0x4b70bb);}})[_0x1e94('0x25')](function(_0x34fa9e){if(_0x34fa9e){return _0x34fa9e?{'count':_0x578ebf,'rows':_0x34fa9e}:null;}})[_0x1e94('0x25')](respondWithResult(_0x58f77f,null))['catch'](handleError(_0x58f77f,null));};exports[_0x1e94('0x48')]=function(_0x374681,_0x259257,_0x387cb3){var _0x3623a6={};var _0x67ef5={};var _0x3609b5;var _0x2efc5c;return db[_0x1e94('0x3b')][_0x1e94('0x49')]({'where':{'id':_0x374681[_0x1e94('0x40')]['id']}})[_0x1e94('0x25')](handleEntityNotFound(_0x259257,null))[_0x1e94('0x25')](function(_0x440d2a){if(_0x440d2a){_0x3609b5=_0x440d2a;_0x67ef5[_0x1e94('0x2c')]=_[_0x1e94('0x2e')](db[_0x1e94('0x4a')][_0x1e94('0x41')]);_0x67ef5[_0x1e94('0x2d')]=_['keys'](_0x374681[_0x1e94('0x2d')]);_0x67ef5[_0x1e94('0x2f')]=_[_0x1e94('0x30')](_0x67ef5['model'],_0x67ef5[_0x1e94('0x2d')]);_0x3623a6[_0x1e94('0x31')]=_[_0x1e94('0x30')](_0x67ef5[_0x1e94('0x2c')],qs[_0x1e94('0x32')](_0x374681[_0x1e94('0x2d')][_0x1e94('0x32')]));_0x3623a6[_0x1e94('0x31')]=_0x3623a6[_0x1e94('0x31')]['length']?_0x3623a6[_0x1e94('0x31')]:_0x67ef5[_0x1e94('0x2c')];_0x3623a6[_0x1e94('0x4b')]=qs[_0x1e94('0x36')](_0x374681['query']['sort']);_0x3623a6[_0x1e94('0x38')]=qs[_0x1e94('0x2f')](_[_0x1e94('0x4c')](_0x374681[_0x1e94('0x2d')],_0x67ef5[_0x1e94('0x2f')]));if(_0x374681[_0x1e94('0x2d')][_0x1e94('0x37')]){_0x3623a6[_0x1e94('0x38')]=_['merge'](_0x3623a6[_0x1e94('0x38')],{'$or':_[_0x1e94('0x29')](_0x3623a6[_0x1e94('0x31')],function(_0x2ab792){var _0x8440a={};_0x8440a[_0x2ab792]={'$like':'%'+_0x374681[_0x1e94('0x2d')][_0x1e94('0x37')]+'%'};return _0x8440a;})});}_0x3623a6=_['merge']({},_0x3623a6,_0x374681[_0x1e94('0x3a')]);return _0x3609b5[_0x1e94('0x48')](_0x3623a6);}})[_0x1e94('0x25')](function(_0x4b2f6f){if(_0x4b2f6f){_0x2efc5c=_0x4b2f6f[_0x1e94('0x33')];if(!_0x374681['query'][_0x1e94('0x34')]('nolimit')){_0x3623a6['limit']=qs['limit'](_0x374681[_0x1e94('0x2d')]['limit']);_0x3623a6[_0x1e94('0x1c')]=qs['offset'](_0x374681['query']['offset']);}return _0x3609b5['getSubjects'](_0x3623a6);}})[_0x1e94('0x25')](function(_0x27ad11){if(_0x27ad11){return _0x27ad11?{'count':_0x2efc5c,'rows':_0x27ad11}:null;}})[_0x1e94('0x25')](respondWithResult(_0x259257,null))[_0x1e94('0x46')](handleError(_0x259257,null));};exports[_0x1e94('0x4d')]=function(_0xe4e55,_0x42799b,_0x55089b){var _0x231087={};var _0x2992b2={};var _0xc9f511;var _0x519338;return db[_0x1e94('0x3b')][_0x1e94('0x49')]({'where':{'id':_0xe4e55[_0x1e94('0x40')]['id']}})[_0x1e94('0x25')](handleEntityNotFound(_0x42799b,null))['then'](function(_0x278ed2){if(_0x278ed2){_0xc9f511=_0x278ed2;_0x2992b2['model']=_['keys'](db['SugarcrmField'][_0x1e94('0x41')]);_0x2992b2[_0x1e94('0x2d')]=_['keys'](_0xe4e55[_0x1e94('0x2d')]);_0x2992b2[_0x1e94('0x2f')]=_['intersection'](_0x2992b2[_0x1e94('0x2c')],_0x2992b2['query']);_0x231087[_0x1e94('0x31')]=_[_0x1e94('0x30')](_0x2992b2[_0x1e94('0x2c')],qs[_0x1e94('0x32')](_0xe4e55['query'][_0x1e94('0x32')]));_0x231087[_0x1e94('0x31')]=_0x231087[_0x1e94('0x31')][_0x1e94('0x33')]?_0x231087['attributes']:_0x2992b2['model'];_0x231087[_0x1e94('0x4b')]=qs['sort'](_0xe4e55[_0x1e94('0x2d')]['sort']);_0x231087[_0x1e94('0x38')]=qs[_0x1e94('0x2f')](_['pick'](_0xe4e55[_0x1e94('0x2d')],_0x2992b2[_0x1e94('0x2f')]));if(_0xe4e55['query'][_0x1e94('0x37')]){_0x231087[_0x1e94('0x38')]=_[_0x1e94('0x39')](_0x231087[_0x1e94('0x38')],{'$or':_[_0x1e94('0x29')](_0x231087[_0x1e94('0x31')],function(_0x444597){var _0x46086c={};_0x46086c[_0x444597]={'$like':'%'+_0xe4e55[_0x1e94('0x2d')][_0x1e94('0x37')]+'%'};return _0x46086c;})});}_0x231087=_[_0x1e94('0x39')]({},_0x231087,_0xe4e55[_0x1e94('0x3a')]);return _0xc9f511[_0x1e94('0x4d')](_0x231087);}})[_0x1e94('0x25')](function(_0x29a6c3){if(_0x29a6c3){_0x519338=_0x29a6c3[_0x1e94('0x33')];if(!_0xe4e55[_0x1e94('0x2d')][_0x1e94('0x34')](_0x1e94('0x35'))){_0x231087[_0x1e94('0x1e')]=qs['limit'](_0xe4e55[_0x1e94('0x2d')][_0x1e94('0x1e')]);_0x231087[_0x1e94('0x1c')]=qs[_0x1e94('0x1c')](_0xe4e55[_0x1e94('0x2d')][_0x1e94('0x1c')]);}return _0xc9f511['getDescriptions'](_0x231087);}})[_0x1e94('0x25')](function(_0x4ff9d1){if(_0x4ff9d1){return _0x4ff9d1?{'count':_0x519338,'rows':_0x4ff9d1}:null;}})[_0x1e94('0x25')](respondWithResult(_0x42799b,null))[_0x1e94('0x46')](handleError(_0x42799b,null));}; \ No newline at end of file +var _0xeefb=['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','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','then','end','error','name','send','index','map','SugarcrmConfiguration','rawAttributes','type','model','query','keys','attributes','intersection','fields','length','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','getFields','SugarcrmField','order','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x55e1d9,_0x1d9592){var _0x552100=function(_0x574aa6){while(--_0x574aa6){_0x55e1d9['push'](_0x55e1d9['shift']());}};_0x552100(++_0x1d9592);}(_0xeefb,0xeb));var _0xbeef=function(_0x1da527,_0x2dc953){_0x1da527=_0x1da527-0x0;var _0x40fc7c=_0xeefb[_0x1da527];return _0x40fc7c;};'use strict';var emlformat=require(_0xbeef('0x0'));var rimraf=require(_0xbeef('0x1'));var zipdir=require(_0xbeef('0x2'));var jsonpatch=require(_0xbeef('0x3'));var rp=require('request-promise');var moment=require(_0xbeef('0x4'));var BPromise=require(_0xbeef('0x5'));var Mustache=require(_0xbeef('0x6'));var util=require(_0xbeef('0x7'));var path=require(_0xbeef('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xbeef('0x9'));var fs=require('fs');var fs_extra=require(_0xbeef('0xa'));var _=require('lodash');var squel=require(_0xbeef('0xb'));var crypto=require(_0xbeef('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xbeef('0xd'));var toCsv=require('to-csv');var querystring=require(_0xbeef('0xe'));var Papa=require(_0xbeef('0xf'));var Redis=require(_0xbeef('0x10'));var authService=require(_0xbeef('0x11'));var qs=require(_0xbeef('0x12'));var as=require(_0xbeef('0x13'));var hardwareService=require(_0xbeef('0x14'));var logger=require(_0xbeef('0x15'))(_0xbeef('0x16'));var utils=require(_0xbeef('0x17'));var config=require(_0xbeef('0x18'));var licenseUtil=require(_0xbeef('0x19'));var db=require(_0xbeef('0x1a'))['db'];function respondWithStatusCode(_0x57e97b,_0xd492d6){_0xd492d6=_0xd492d6||0xcc;return function(_0xd3632e){if(_0xd3632e){return _0x57e97b[_0xbeef('0x1b')](_0xd492d6);}return _0x57e97b[_0xbeef('0x1c')](_0xd492d6)['end']();};}function respondWithResult(_0x47b039,_0x572414){_0x572414=_0x572414||0xc8;return function(_0x291ab4){if(_0x291ab4){return _0x47b039[_0xbeef('0x1c')](_0x572414)[_0xbeef('0x1d')](_0x291ab4);}};}function respondWithFilteredResult(_0x22405e,_0x1ce727){return function(_0x56cbb1){if(_0x56cbb1){var _0x44d0e2=typeof _0x1ce727['offset']===_0xbeef('0x1e')&&typeof _0x1ce727[_0xbeef('0x1f')]===_0xbeef('0x1e');var _0x37ffbd=_0x56cbb1[_0xbeef('0x20')];var _0x1c9a97=_0x44d0e2?0x0:_0x1ce727[_0xbeef('0x21')];var _0x4cfd94=_0x44d0e2?_0x56cbb1['count']:_0x1ce727[_0xbeef('0x21')]+_0x1ce727['limit'];var _0x59e118;if(_0x4cfd94>=_0x37ffbd){_0x4cfd94=_0x37ffbd;_0x59e118=0xc8;}else{_0x59e118=0xce;}_0x22405e['status'](_0x59e118);return _0x22405e[_0xbeef('0x22')](_0xbeef('0x23'),_0x1c9a97+'-'+_0x4cfd94+'/'+_0x37ffbd)['json'](_0x56cbb1);}return null;};}function patchUpdates(_0x65e5e){return function(_0x253453){try{jsonpatch['apply'](_0x253453,_0x65e5e,!![]);}catch(_0x130f6f){return BPromise[_0xbeef('0x24')](_0x130f6f);}return _0x253453[_0xbeef('0x25')]();};}function saveUpdates(_0x3e5406,_0x1b36f4){return function(_0x310543){if(_0x310543){return _0x310543[_0xbeef('0x26')](_0x3e5406)[_0xbeef('0x27')](function(_0x5b2082){return _0x5b2082;});}return null;};}function removeEntity(_0x2b312d,_0x275528){return function(_0x371e5d){if(_0x371e5d){return _0x371e5d['destroy']()[_0xbeef('0x27')](function(){_0x2b312d[_0xbeef('0x1c')](0xcc)[_0xbeef('0x28')]();});}};}function handleEntityNotFound(_0x155ccc,_0x26a8cb){return function(_0x45255f){if(!_0x45255f){_0x155ccc[_0xbeef('0x1b')](0x194);}return _0x45255f;};}function handleError(_0x150a1e,_0x188c5c){_0x188c5c=_0x188c5c||0x1f4;return function(_0x16b8ec){logger[_0xbeef('0x29')](_0x16b8ec['stack']);if(_0x16b8ec[_0xbeef('0x2a')]){delete _0x16b8ec[_0xbeef('0x2a')];}_0x150a1e[_0xbeef('0x1c')](_0x188c5c)[_0xbeef('0x2b')](_0x16b8ec);};}exports[_0xbeef('0x2c')]=function(_0x268bca,_0x4245d2){var _0x1bc34c={},_0x285d80={},_0x2ab36b={'count':0x0,'rows':[]};var _0x553777=_[_0xbeef('0x2d')](db[_0xbeef('0x2e')][_0xbeef('0x2f')],function(_0x31c78b){return{'name':_0x31c78b['fieldName'],'type':_0x31c78b[_0xbeef('0x30')]['key']};});_0x285d80[_0xbeef('0x31')]=_[_0xbeef('0x2d')](_0x553777,_0xbeef('0x2a'));_0x285d80[_0xbeef('0x32')]=_[_0xbeef('0x33')](_0x268bca[_0xbeef('0x32')]);_0x285d80['filters']=_['intersection'](_0x285d80['model'],_0x285d80[_0xbeef('0x32')]);_0x1bc34c[_0xbeef('0x34')]=_[_0xbeef('0x35')](_0x285d80['model'],qs[_0xbeef('0x36')](_0x268bca['query']['fields']));_0x1bc34c[_0xbeef('0x34')]=_0x1bc34c[_0xbeef('0x34')][_0xbeef('0x37')]?_0x1bc34c['attributes']:_0x285d80['model'];if(!_0x268bca[_0xbeef('0x32')]['hasOwnProperty']('nolimit')){_0x1bc34c[_0xbeef('0x1f')]=qs[_0xbeef('0x1f')](_0x268bca['query'][_0xbeef('0x1f')]);_0x1bc34c[_0xbeef('0x21')]=qs[_0xbeef('0x21')](_0x268bca['query'][_0xbeef('0x21')]);}_0x1bc34c['order']=qs[_0xbeef('0x38')](_0x268bca['query'][_0xbeef('0x38')]);_0x1bc34c[_0xbeef('0x39')]=qs[_0xbeef('0x3a')](_[_0xbeef('0x3b')](_0x268bca[_0xbeef('0x32')],_0x285d80['filters']),_0x553777);if(_0x268bca['query'][_0xbeef('0x3c')]){_0x1bc34c[_0xbeef('0x39')]=_[_0xbeef('0x3d')](_0x1bc34c['where'],{'$or':_[_0xbeef('0x2d')](_0x553777,function(_0x710bd5){if(_0x710bd5[_0xbeef('0x30')]!==_0xbeef('0x3e')){var _0x32f4ae={};_0x32f4ae[_0x710bd5[_0xbeef('0x2a')]]={'$like':'%'+_0x268bca[_0xbeef('0x32')]['filter']+'%'};return _0x32f4ae;}})});}_0x1bc34c=_[_0xbeef('0x3d')]({},_0x1bc34c,_0x268bca[_0xbeef('0x3f')]);var _0x3ca14e={'where':_0x1bc34c['where']};return db[_0xbeef('0x2e')]['count'](_0x3ca14e)[_0xbeef('0x27')](function(_0x1efefc){_0x2ab36b[_0xbeef('0x20')]=_0x1efefc;if(_0x268bca[_0xbeef('0x32')][_0xbeef('0x40')]){_0x1bc34c['include']=[{'all':!![]}];}return db[_0xbeef('0x2e')][_0xbeef('0x41')](_0x1bc34c);})[_0xbeef('0x27')](function(_0x701921){_0x2ab36b[_0xbeef('0x42')]=_0x701921;return _0x2ab36b;})['then'](respondWithFilteredResult(_0x4245d2,_0x1bc34c))[_0xbeef('0x43')](handleError(_0x4245d2,null));};exports[_0xbeef('0x44')]=function(_0x3c2356,_0x5c966a){var _0x4fa0e1={'raw':![],'where':{'id':_0x3c2356[_0xbeef('0x45')]['id']}},_0x5e2918={};_0x5e2918[_0xbeef('0x31')]=_[_0xbeef('0x33')](db[_0xbeef('0x2e')][_0xbeef('0x2f')]);_0x5e2918[_0xbeef('0x32')]=_[_0xbeef('0x33')](_0x3c2356[_0xbeef('0x32')]);_0x5e2918[_0xbeef('0x3a')]=_[_0xbeef('0x35')](_0x5e2918[_0xbeef('0x31')],_0x5e2918['query']);_0x4fa0e1['attributes']=_[_0xbeef('0x35')](_0x5e2918[_0xbeef('0x31')],qs[_0xbeef('0x36')](_0x3c2356['query']['fields']));_0x4fa0e1[_0xbeef('0x34')]=_0x4fa0e1[_0xbeef('0x34')]['length']?_0x4fa0e1[_0xbeef('0x34')]:_0x5e2918[_0xbeef('0x31')];if(_0x3c2356[_0xbeef('0x32')]['includeAll']){_0x4fa0e1[_0xbeef('0x46')]=[{'all':!![]}];}_0x4fa0e1=_['merge']({},_0x4fa0e1,_0x3c2356[_0xbeef('0x3f')]);return db[_0xbeef('0x2e')][_0xbeef('0x47')](_0x4fa0e1)[_0xbeef('0x27')](handleEntityNotFound(_0x5c966a,null))['then'](respondWithResult(_0x5c966a,null))['catch'](handleError(_0x5c966a,null));};exports[_0xbeef('0x48')]=function(_0x535766,_0xe59fad){return db[_0xbeef('0x2e')][_0xbeef('0x48')](_0x535766[_0xbeef('0x49')],{})['then'](respondWithResult(_0xe59fad,0xc9))[_0xbeef('0x43')](handleError(_0xe59fad,null));};exports[_0xbeef('0x26')]=function(_0x289e3e,_0x51a284){if(_0x289e3e[_0xbeef('0x49')]['id']){delete _0x289e3e[_0xbeef('0x49')]['id'];}return db[_0xbeef('0x2e')]['find']({'where':{'id':_0x289e3e[_0xbeef('0x45')]['id']}})[_0xbeef('0x27')](handleEntityNotFound(_0x51a284,null))[_0xbeef('0x27')](saveUpdates(_0x289e3e[_0xbeef('0x49')],null))[_0xbeef('0x27')](respondWithResult(_0x51a284,null))[_0xbeef('0x43')](handleError(_0x51a284,null));};exports[_0xbeef('0x4a')]=function(_0x3021f9,_0x1f56ba){return db[_0xbeef('0x2e')][_0xbeef('0x47')]({'where':{'id':_0x3021f9['params']['id']}})[_0xbeef('0x27')](handleEntityNotFound(_0x1f56ba,null))[_0xbeef('0x27')](removeEntity(_0x1f56ba,null))[_0xbeef('0x43')](handleError(_0x1f56ba,null));};exports[_0xbeef('0x4b')]=function(_0x264bca,_0x322c4f,_0x1e01fa){var _0x3ced55={};var _0x32bfc4={};var _0x254624;var _0x366dd1;return db[_0xbeef('0x2e')]['findOne']({'where':{'id':_0x264bca[_0xbeef('0x45')]['id']}})[_0xbeef('0x27')](handleEntityNotFound(_0x322c4f,null))[_0xbeef('0x27')](function(_0x38cbb0){if(_0x38cbb0){_0x254624=_0x38cbb0;_0x32bfc4['model']=_['keys'](db[_0xbeef('0x4c')][_0xbeef('0x2f')]);_0x32bfc4[_0xbeef('0x32')]=_[_0xbeef('0x33')](_0x264bca[_0xbeef('0x32')]);_0x32bfc4[_0xbeef('0x3a')]=_[_0xbeef('0x35')](_0x32bfc4['model'],_0x32bfc4['query']);_0x3ced55[_0xbeef('0x34')]=_['intersection'](_0x32bfc4[_0xbeef('0x31')],qs[_0xbeef('0x36')](_0x264bca[_0xbeef('0x32')]['fields']));_0x3ced55[_0xbeef('0x34')]=_0x3ced55[_0xbeef('0x34')][_0xbeef('0x37')]?_0x3ced55['attributes']:_0x32bfc4['model'];_0x3ced55[_0xbeef('0x4d')]=qs[_0xbeef('0x38')](_0x264bca[_0xbeef('0x32')][_0xbeef('0x38')]);_0x3ced55[_0xbeef('0x39')]=qs[_0xbeef('0x3a')](_['pick'](_0x264bca[_0xbeef('0x32')],_0x32bfc4[_0xbeef('0x3a')]));if(_0x264bca[_0xbeef('0x32')][_0xbeef('0x3c')]){_0x3ced55[_0xbeef('0x39')]=_[_0xbeef('0x3d')](_0x3ced55['where'],{'$or':_[_0xbeef('0x2d')](_0x3ced55[_0xbeef('0x34')],function(_0x178e4d){var _0x266472={};_0x266472[_0x178e4d]={'$like':'%'+_0x264bca[_0xbeef('0x32')][_0xbeef('0x3c')]+'%'};return _0x266472;})});}_0x3ced55=_[_0xbeef('0x3d')]({},_0x3ced55,_0x264bca[_0xbeef('0x3f')]);return _0x254624[_0xbeef('0x4b')](_0x3ced55);}})[_0xbeef('0x27')](function(_0x5b9d31){if(_0x5b9d31){_0x366dd1=_0x5b9d31[_0xbeef('0x37')];if(!_0x264bca[_0xbeef('0x32')][_0xbeef('0x4e')](_0xbeef('0x4f'))){_0x3ced55[_0xbeef('0x1f')]=qs[_0xbeef('0x1f')](_0x264bca[_0xbeef('0x32')][_0xbeef('0x1f')]);_0x3ced55['offset']=qs[_0xbeef('0x21')](_0x264bca[_0xbeef('0x32')][_0xbeef('0x21')]);}return _0x254624[_0xbeef('0x4b')](_0x3ced55);}})['then'](function(_0x16e3d9){if(_0x16e3d9){return _0x16e3d9?{'count':_0x366dd1,'rows':_0x16e3d9}:null;}})['then'](respondWithResult(_0x322c4f,null))[_0xbeef('0x43')](handleError(_0x322c4f,null));};exports[_0xbeef('0x50')]=function(_0x3ab907,_0x1a49b7,_0x35d513){var _0x49b37d={};var _0x2b2667={};var _0x1faefe;var _0x239b26;return db['SugarcrmConfiguration'][_0xbeef('0x51')]({'where':{'id':_0x3ab907[_0xbeef('0x45')]['id']}})[_0xbeef('0x27')](handleEntityNotFound(_0x1a49b7,null))[_0xbeef('0x27')](function(_0x1bc826){if(_0x1bc826){_0x1faefe=_0x1bc826;_0x2b2667['model']=_[_0xbeef('0x33')](db[_0xbeef('0x4c')]['rawAttributes']);_0x2b2667['query']=_[_0xbeef('0x33')](_0x3ab907[_0xbeef('0x32')]);_0x2b2667[_0xbeef('0x3a')]=_['intersection'](_0x2b2667[_0xbeef('0x31')],_0x2b2667[_0xbeef('0x32')]);_0x49b37d[_0xbeef('0x34')]=_['intersection'](_0x2b2667[_0xbeef('0x31')],qs[_0xbeef('0x36')](_0x3ab907['query']['fields']));_0x49b37d[_0xbeef('0x34')]=_0x49b37d['attributes'][_0xbeef('0x37')]?_0x49b37d[_0xbeef('0x34')]:_0x2b2667[_0xbeef('0x31')];_0x49b37d[_0xbeef('0x4d')]=qs[_0xbeef('0x38')](_0x3ab907[_0xbeef('0x32')][_0xbeef('0x38')]);_0x49b37d[_0xbeef('0x39')]=qs[_0xbeef('0x3a')](_[_0xbeef('0x3b')](_0x3ab907[_0xbeef('0x32')],_0x2b2667[_0xbeef('0x3a')]));if(_0x3ab907[_0xbeef('0x32')]['filter']){_0x49b37d['where']=_[_0xbeef('0x3d')](_0x49b37d[_0xbeef('0x39')],{'$or':_[_0xbeef('0x2d')](_0x49b37d[_0xbeef('0x34')],function(_0x596b70){var _0x118dc9={};_0x118dc9[_0x596b70]={'$like':'%'+_0x3ab907[_0xbeef('0x32')][_0xbeef('0x3c')]+'%'};return _0x118dc9;})});}_0x49b37d=_[_0xbeef('0x3d')]({},_0x49b37d,_0x3ab907['options']);return _0x1faefe['getSubjects'](_0x49b37d);}})[_0xbeef('0x27')](function(_0x406e73){if(_0x406e73){_0x239b26=_0x406e73[_0xbeef('0x37')];if(!_0x3ab907[_0xbeef('0x32')][_0xbeef('0x4e')](_0xbeef('0x4f'))){_0x49b37d[_0xbeef('0x1f')]=qs[_0xbeef('0x1f')](_0x3ab907[_0xbeef('0x32')][_0xbeef('0x1f')]);_0x49b37d[_0xbeef('0x21')]=qs['offset'](_0x3ab907[_0xbeef('0x32')]['offset']);}return _0x1faefe[_0xbeef('0x50')](_0x49b37d);}})[_0xbeef('0x27')](function(_0x59a7b4){if(_0x59a7b4){return _0x59a7b4?{'count':_0x239b26,'rows':_0x59a7b4}:null;}})[_0xbeef('0x27')](respondWithResult(_0x1a49b7,null))[_0xbeef('0x43')](handleError(_0x1a49b7,null));};exports[_0xbeef('0x52')]=function(_0x391ce0,_0xbf66f2,_0x577ed2){var _0x7143d9={};var _0xcd7464={};var _0x42b103;var _0x3acfed;return db[_0xbeef('0x2e')][_0xbeef('0x51')]({'where':{'id':_0x391ce0[_0xbeef('0x45')]['id']}})[_0xbeef('0x27')](handleEntityNotFound(_0xbf66f2,null))[_0xbeef('0x27')](function(_0x2300c7){if(_0x2300c7){_0x42b103=_0x2300c7;_0xcd7464[_0xbeef('0x31')]=_['keys'](db[_0xbeef('0x4c')][_0xbeef('0x2f')]);_0xcd7464['query']=_['keys'](_0x391ce0[_0xbeef('0x32')]);_0xcd7464[_0xbeef('0x3a')]=_[_0xbeef('0x35')](_0xcd7464[_0xbeef('0x31')],_0xcd7464['query']);_0x7143d9[_0xbeef('0x34')]=_[_0xbeef('0x35')](_0xcd7464[_0xbeef('0x31')],qs['fields'](_0x391ce0['query'][_0xbeef('0x36')]));_0x7143d9[_0xbeef('0x34')]=_0x7143d9[_0xbeef('0x34')][_0xbeef('0x37')]?_0x7143d9['attributes']:_0xcd7464['model'];_0x7143d9[_0xbeef('0x4d')]=qs['sort'](_0x391ce0[_0xbeef('0x32')]['sort']);_0x7143d9['where']=qs[_0xbeef('0x3a')](_[_0xbeef('0x3b')](_0x391ce0[_0xbeef('0x32')],_0xcd7464[_0xbeef('0x3a')]));if(_0x391ce0['query'][_0xbeef('0x3c')]){_0x7143d9['where']=_[_0xbeef('0x3d')](_0x7143d9[_0xbeef('0x39')],{'$or':_[_0xbeef('0x2d')](_0x7143d9['attributes'],function(_0xc598c9){var _0x323f91={};_0x323f91[_0xc598c9]={'$like':'%'+_0x391ce0['query'][_0xbeef('0x3c')]+'%'};return _0x323f91;})});}_0x7143d9=_['merge']({},_0x7143d9,_0x391ce0['options']);return _0x42b103['getDescriptions'](_0x7143d9);}})[_0xbeef('0x27')](function(_0x2e5a1c){if(_0x2e5a1c){_0x3acfed=_0x2e5a1c[_0xbeef('0x37')];if(!_0x391ce0['query']['hasOwnProperty'](_0xbeef('0x4f'))){_0x7143d9['limit']=qs['limit'](_0x391ce0[_0xbeef('0x32')]['limit']);_0x7143d9[_0xbeef('0x21')]=qs[_0xbeef('0x21')](_0x391ce0[_0xbeef('0x32')]['offset']);}return _0x42b103[_0xbeef('0x52')](_0x7143d9);}})[_0xbeef('0x27')](function(_0x16504d){if(_0x16504d){return _0x16504d?{'count':_0x3acfed,'rows':_0x16504d}:null;}})['then'](respondWithResult(_0xbf66f2,null))['catch'](handleError(_0xbf66f2,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 8986bfc..886f383 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 _0x5e37=['bluebird','request-promise','path','rimraf','../../config/environment','exports','SugarcrmConfiguration','util','../../config/logger','api','moment'];(function(_0x2d8c86,_0x15d308){var _0x3b67ef=function(_0x142ba6){while(--_0x142ba6){_0x2d8c86['push'](_0x2d8c86['shift']());}};_0x3b67ef(++_0x15d308);}(_0x5e37,0x96));var _0x75e3=function(_0x564615,_0x51000c){_0x564615=_0x564615-0x0;var _0x3e5c3c=_0x5e37[_0x564615];return _0x3e5c3c;};'use strict';var _=require('lodash');var util=require(_0x75e3('0x0'));var logger=require(_0x75e3('0x1'))(_0x75e3('0x2'));var moment=require(_0x75e3('0x3'));var BPromise=require(_0x75e3('0x4'));var rp=require(_0x75e3('0x5'));var fs=require('fs');var path=require(_0x75e3('0x6'));var rimraf=require(_0x75e3('0x7'));var config=require(_0x75e3('0x8'));var attributes=require('./intSugarcrmConfiguration.attributes');module[_0x75e3('0x9')]=function(_0x436fdc,_0x2aad0a){return _0x436fdc['define'](_0x75e3('0xa'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71a7=['SugarcrmConfiguration','lodash','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./intSugarcrmConfiguration.attributes','exports'];(function(_0x1586be,_0x2bc85c){var _0x36a055=function(_0x33d058){while(--_0x33d058){_0x1586be['push'](_0x1586be['shift']());}};_0x36a055(++_0x2bc85c);}(_0x71a7,0x1c4));var _0x771a=function(_0x530a93,_0x41865a){_0x530a93=_0x530a93-0x0;var _0x35b269=_0x71a7[_0x530a93];return _0x35b269;};'use strict';var _=require(_0x771a('0x0'));var util=require('util');var logger=require(_0x771a('0x1'))(_0x771a('0x2'));var moment=require(_0x771a('0x3'));var BPromise=require(_0x771a('0x4'));var rp=require(_0x771a('0x5'));var fs=require('fs');var path=require(_0x771a('0x6'));var rimraf=require('rimraf');var config=require(_0x771a('0x7'));var attributes=require(_0x771a('0x8'));module[_0x771a('0x9')]=function(_0x176de1,_0x44a850){return _0x176de1['define'](_0x771a('0xa'),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 5d7c4d8..90cf25f 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 _0x052c=['client','request','then','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','info','result','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x303081,_0x29b633){var _0x1f5ee4=function(_0x21690f){while(--_0x21690f){_0x303081['push'](_0x303081['shift']());}};_0x1f5ee4(++_0x29b633);}(_0x052c,0x14c));var _0xc052=function(_0x4c6e12,_0x2bd63c){_0x4c6e12=_0x4c6e12-0x0;var _0x56ebf2=_0x052c[_0x4c6e12];return _0x56ebf2;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xc052('0x0'));var BPromise=require(_0xc052('0x1'));var rs=require(_0xc052('0x2'));var fs=require('fs');var Redis=require(_0xc052('0x3'));var db=require(_0xc052('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xc052('0x5'));var config=require(_0xc052('0x6'));var jayson=require(_0xc052('0x7'));var client=jayson[_0xc052('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x42dfc2,_0xa42e7e,_0x1448df){return new BPromise(function(_0xf37d21,_0x2af639){return client[_0xc052('0x9')](_0x42dfc2,_0x1448df)[_0xc052('0xa')](function(_0x521773){logger['info'](_0xc052('0xb'),_0xa42e7e,_0xc052('0xc'));logger[_0xc052('0xd')](_0xc052('0xe'),_0xa42e7e,'request\x20sent',JSON['stringify'](_0x521773));if(_0x521773['error']){if(_0x521773[_0xc052('0xf')][_0xc052('0x10')]===0x1f4){logger[_0xc052('0xf')](_0xc052('0xb'),_0xa42e7e,_0x521773[_0xc052('0xf')][_0xc052('0x11')]);return _0x2af639(_0x521773[_0xc052('0xf')][_0xc052('0x11')]);}logger['error']('SugarcrmConfiguration,\x20%s,\x20%s',_0xa42e7e,_0x521773[_0xc052('0xf')][_0xc052('0x11')]);return _0xf37d21(_0x521773['error'][_0xc052('0x11')]);}else{logger[_0xc052('0x12')]('SugarcrmConfiguration,\x20%s,\x20%s',_0xa42e7e,_0xc052('0xc'));_0xf37d21(_0x521773[_0xc052('0x13')][_0xc052('0x11')]);}})['catch'](function(_0x4f7872){logger[_0xc052('0xf')](_0xc052('0xb'),_0xa42e7e,_0x4f7872);_0x2af639(_0x4f7872);});});} \ No newline at end of file +var _0xbd5b=['../../config/utils','rpc','../../config/environment','client','http','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','SugarcrmConfiguration,\x20%s,\x20%s','message','info','catch','moment','bluebird','randomstring','../../mysqldb'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xbd5b,0xba));var _0xbbd5=function(_0x14490c,_0x50e8ab){_0x14490c=_0x14490c-0x0;var _0x2f6825=_0xbd5b[_0x14490c];return _0x2f6825;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xbbd5('0x0'));var BPromise=require(_0xbbd5('0x1'));var rs=require(_0xbbd5('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbd5('0x3'))['db'];var utils=require(_0xbbd5('0x4'));var logger=require('../../config/logger')(_0xbbd5('0x5'));var config=require(_0xbbd5('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbbd5('0x7')][_0xbbd5('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1609c0,_0x29d722,_0x2c7bde){return new BPromise(function(_0x15a9ca,_0x4109fc){return client['request'](_0x1609c0,_0x2c7bde)['then'](function(_0x5982e1){logger['info']('SugarcrmConfiguration,\x20%s,\x20%s',_0x29d722,_0xbbd5('0x9'));logger[_0xbbd5('0xa')](_0xbbd5('0xb'),_0x29d722,_0xbbd5('0x9'),JSON[_0xbbd5('0xc')](_0x5982e1));if(_0x5982e1[_0xbbd5('0xd')]){if(_0x5982e1[_0xbbd5('0xd')][_0xbbd5('0xe')]===0x1f4){logger[_0xbbd5('0xd')](_0xbbd5('0xf'),_0x29d722,_0x5982e1[_0xbbd5('0xd')]['message']);return _0x4109fc(_0x5982e1['error'][_0xbbd5('0x10')]);}logger['error'](_0xbbd5('0xf'),_0x29d722,_0x5982e1[_0xbbd5('0xd')][_0xbbd5('0x10')]);return _0x15a9ca(_0x5982e1['error'][_0xbbd5('0x10')]);}else{logger[_0xbbd5('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x29d722,'request\x20sent');_0x15a9ca(_0x5982e1['result'][_0xbbd5('0x10')]);}})[_0xbbd5('0x12')](function(_0x50ee84){logger[_0xbbd5('0xd')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x29d722,_0x50ee84);_0x4109fc(_0x50ee84);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index f7cbb45..87a6908 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 _0xf7d6=['update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','put','/:id'];(function(_0x4b7895,_0x3c4f5d){var _0x264180=function(_0xe0e861){while(--_0xe0e861){_0x4b7895['push'](_0x4b7895['shift']());}};_0x264180(++_0x3c4f5d);}(_0xf7d6,0x69));var _0x6f7d=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0xf7d6[_0xefd519];return _0x4bb882;};'use strict';var multer=require(_0x6f7d('0x0'));var util=require(_0x6f7d('0x1'));var path=require(_0x6f7d('0x2'));var timeout=require(_0x6f7d('0x3'));var express=require(_0x6f7d('0x4'));var router=express[_0x6f7d('0x5')]();var fs_extra=require(_0x6f7d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x6f7d('0x7'));var config=require(_0x6f7d('0x8'));var controller=require('./intSugarcrmField.controller');router[_0x6f7d('0x9')]('/',auth[_0x6f7d('0xa')](),controller[_0x6f7d('0xb')]);router[_0x6f7d('0x9')]('/:id',auth[_0x6f7d('0xa')](),controller['show']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x6f7d('0xc')](_0x6f7d('0xd'),auth[_0x6f7d('0xa')](),controller[_0x6f7d('0xe')]);router[_0x6f7d('0xf')](_0x6f7d('0xd'),auth[_0x6f7d('0xa')](),controller['destroy']);module[_0x6f7d('0x10')]=router; \ No newline at end of file +var _0x69fe=['destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intSugarcrmField.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x1c797d,_0x252464){var _0x1d76f8=function(_0x33ed49){while(--_0x33ed49){_0x1c797d['push'](_0x1c797d['shift']());}};_0x1d76f8(++_0x252464);}(_0x69fe,0x142));var _0xe69f=function(_0x21b9c6,_0x93de47){_0x21b9c6=_0x21b9c6-0x0;var _0x5c3902=_0x69fe[_0x21b9c6];return _0x5c3902;};'use strict';var multer=require(_0xe69f('0x0'));var util=require(_0xe69f('0x1'));var path=require(_0xe69f('0x2'));var timeout=require('connect-timeout');var express=require(_0xe69f('0x3'));var router=express[_0xe69f('0x4')]();var fs_extra=require(_0xe69f('0x5'));var auth=require(_0xe69f('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe69f('0x7'));var controller=require(_0xe69f('0x8'));router[_0xe69f('0x9')]('/',auth[_0xe69f('0xa')](),controller[_0xe69f('0xb')]);router[_0xe69f('0x9')](_0xe69f('0xc'),auth[_0xe69f('0xa')](),controller[_0xe69f('0xd')]);router[_0xe69f('0xe')]('/',auth[_0xe69f('0xa')](),controller['create']);router[_0xe69f('0xf')](_0xe69f('0xc'),auth[_0xe69f('0xa')](),controller[_0xe69f('0x10')]);router[_0xe69f('0x11')](_0xe69f('0xc'),auth['isAuthenticated'](),controller[_0xe69f('0x12')]);module[_0xe69f('0x13')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index f5c5058..43e3654 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 _0x9a59=['customVariable','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue','picklist','STRING'];(function(_0x1e4360,_0x930b9b){var _0x31e6b4=function(_0x49dd8e){while(--_0x49dd8e){_0x1e4360['push'](_0x1e4360['shift']());}};_0x31e6b4(++_0x930b9b);}(_0x9a59,0x106));var _0x99a5=function(_0x33ef19,_0x7d0c03){_0x33ef19=_0x33ef19-0x0;var _0x289d0c=_0x9a59[_0x33ef19];return _0x289d0c;};'use strict';var Sequelize=require(_0x99a5('0x0'));module[_0x99a5('0x1')]={'type':{'type':Sequelize[_0x99a5('0x2')](_0x99a5('0x3'),_0x99a5('0x4'),'customVariable',_0x99a5('0x5'),_0x99a5('0x6')),'defaultValue':_0x99a5('0x3')},'content':{'type':Sequelize[_0x99a5('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x99a5('0x2')](_0x99a5('0x3'),_0x99a5('0x4'),_0x99a5('0x8'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x99a5('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x99a5('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x99a5('0x7')]}}; \ No newline at end of file +var _0x7cba=['exports','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN'];(function(_0x489fe3,_0x5ebb81){var _0x592190=function(_0x1612a7){while(--_0x1612a7){_0x489fe3['push'](_0x489fe3['shift']());}};_0x592190(++_0x5ebb81);}(_0x7cba,0xf8));var _0xa7cb=function(_0x30aba0,_0x1062e2){_0x30aba0=_0x30aba0-0x0;var _0x3da385=_0x7cba[_0x30aba0];return _0x3da385;};'use strict';var Sequelize=require('sequelize');module[_0xa7cb('0x0')]={'type':{'type':Sequelize['ENUM'](_0xa7cb('0x1'),_0xa7cb('0x2'),_0xa7cb('0x3'),_0xa7cb('0x4'),_0xa7cb('0x5')),'defaultValue':_0xa7cb('0x1')},'content':{'type':Sequelize[_0xa7cb('0x6')]},'key':{'type':Sequelize[_0xa7cb('0x6')]},'keyType':{'type':Sequelize['ENUM']('string',_0xa7cb('0x2'),_0xa7cb('0x3'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xa7cb('0x6')]},'nameField':{'type':Sequelize[_0xa7cb('0x6')]},'customField':{'type':Sequelize[_0xa7cb('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xa7cb('0x6')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index e512407..b2049c2 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 _0x5136=['rows','catch','params','include','options','find','create','body','destroy','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','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/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','name','index','SugarcrmField','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','includeAll'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x5136,0x1a7));var _0x6513=function(_0xa6bdb8,_0x17b4d4){_0xa6bdb8=_0xa6bdb8-0x0;var _0x40b839=_0x5136[_0xa6bdb8];return _0x40b839;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6513('0x0'));var zipdir=require(_0x6513('0x1'));var jsonpatch=require(_0x6513('0x2'));var rp=require('request-promise');var moment=require(_0x6513('0x3'));var BPromise=require(_0x6513('0x4'));var Mustache=require(_0x6513('0x5'));var util=require('util');var path=require(_0x6513('0x6'));var sox=require('sox');var csv=require(_0x6513('0x7'));var ejs=require(_0x6513('0x8'));var fs=require('fs');var fs_extra=require(_0x6513('0x9'));var _=require(_0x6513('0xa'));var squel=require(_0x6513('0xb'));var crypto=require(_0x6513('0xc'));var jsforce=require(_0x6513('0xd'));var deskjs=require(_0x6513('0xe'));var toCsv=require(_0x6513('0x7'));var querystring=require(_0x6513('0xf'));var Papa=require(_0x6513('0x10'));var Redis=require(_0x6513('0x11'));var authService=require(_0x6513('0x12'));var qs=require(_0x6513('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6513('0x14'));var logger=require(_0x6513('0x15'))(_0x6513('0x16'));var utils=require(_0x6513('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6513('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b60d8,_0x322cac){_0x322cac=_0x322cac||0xcc;return function(_0x31b023){if(_0x31b023){return _0x2b60d8[_0x6513('0x19')](_0x322cac);}return _0x2b60d8[_0x6513('0x1a')](_0x322cac)[_0x6513('0x1b')]();};}function respondWithResult(_0x13b028,_0x335306){_0x335306=_0x335306||0xc8;return function(_0x373b23){if(_0x373b23){return _0x13b028['status'](_0x335306)[_0x6513('0x1c')](_0x373b23);}};}function respondWithFilteredResult(_0x70313f,_0x58b04e){return function(_0x308f70){if(_0x308f70){var _0x192760=typeof _0x58b04e[_0x6513('0x1d')]===_0x6513('0x1e')&&typeof _0x58b04e[_0x6513('0x1f')]===_0x6513('0x1e');var _0x425fcf=_0x308f70[_0x6513('0x20')];var _0x40311b=_0x192760?0x0:_0x58b04e[_0x6513('0x1d')];var _0x2639d5=_0x192760?_0x308f70['count']:_0x58b04e['offset']+_0x58b04e[_0x6513('0x1f')];var _0x13c50b;if(_0x2639d5>=_0x425fcf){_0x2639d5=_0x425fcf;_0x13c50b=0xc8;}else{_0x13c50b=0xce;}_0x70313f[_0x6513('0x1a')](_0x13c50b);return _0x70313f['set'](_0x6513('0x21'),_0x40311b+'-'+_0x2639d5+'/'+_0x425fcf)['json'](_0x308f70);}return null;};}function patchUpdates(_0x5d806d){return function(_0x3f0d84){try{jsonpatch['apply'](_0x3f0d84,_0x5d806d,!![]);}catch(_0x4ba2dd){return BPromise[_0x6513('0x22')](_0x4ba2dd);}return _0x3f0d84['save']();};}function saveUpdates(_0x5de897,_0x10945a){return function(_0x151177){if(_0x151177){return _0x151177[_0x6513('0x23')](_0x5de897)[_0x6513('0x24')](function(_0x54cc55){return _0x54cc55;});}return null;};}function removeEntity(_0x3b3984,_0x40405a){return function(_0x3592a4){if(_0x3592a4){return _0x3592a4['destroy']()[_0x6513('0x24')](function(){_0x3b3984[_0x6513('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x457d5e,_0x469a25){return function(_0x164325){if(!_0x164325){_0x457d5e[_0x6513('0x19')](0x194);}return _0x164325;};}function handleError(_0x373047,_0x5be19d){_0x5be19d=_0x5be19d||0x1f4;return function(_0x4af649){logger['error'](_0x4af649['stack']);if(_0x4af649[_0x6513('0x25')]){delete _0x4af649['name'];}_0x373047['status'](_0x5be19d)['send'](_0x4af649);};}exports[_0x6513('0x26')]=function(_0xab97ea,_0x5237b7){var _0x2fae79={},_0xae854d={},_0x14ea25={'count':0x0,'rows':[]};var _0x519954=_['map'](db[_0x6513('0x27')][_0x6513('0x28')],function(_0x581c9a){return{'name':_0x581c9a[_0x6513('0x29')],'type':_0x581c9a[_0x6513('0x2a')][_0x6513('0x2b')]};});_0xae854d[_0x6513('0x2c')]=_[_0x6513('0x2d')](_0x519954,_0x6513('0x25'));_0xae854d[_0x6513('0x2e')]=_[_0x6513('0x2f')](_0xab97ea[_0x6513('0x2e')]);_0xae854d[_0x6513('0x30')]=_['intersection'](_0xae854d[_0x6513('0x2c')],_0xae854d['query']);_0x2fae79[_0x6513('0x31')]=_[_0x6513('0x32')](_0xae854d[_0x6513('0x2c')],qs[_0x6513('0x33')](_0xab97ea[_0x6513('0x2e')]['fields']));_0x2fae79['attributes']=_0x2fae79[_0x6513('0x31')][_0x6513('0x34')]?_0x2fae79[_0x6513('0x31')]:_0xae854d[_0x6513('0x2c')];if(!_0xab97ea['query'][_0x6513('0x35')](_0x6513('0x36'))){_0x2fae79['limit']=qs[_0x6513('0x1f')](_0xab97ea[_0x6513('0x2e')][_0x6513('0x1f')]);_0x2fae79[_0x6513('0x1d')]=qs[_0x6513('0x1d')](_0xab97ea[_0x6513('0x2e')]['offset']);}_0x2fae79['order']=qs[_0x6513('0x37')](_0xab97ea[_0x6513('0x2e')]['sort']);_0x2fae79[_0x6513('0x38')]=qs[_0x6513('0x30')](_['pick'](_0xab97ea[_0x6513('0x2e')],_0xae854d[_0x6513('0x30')]),_0x519954);if(_0xab97ea[_0x6513('0x2e')][_0x6513('0x39')]){_0x2fae79[_0x6513('0x38')]=_[_0x6513('0x3a')](_0x2fae79['where'],{'$or':_[_0x6513('0x2d')](_0x519954,function(_0x3d081d){if(_0x3d081d[_0x6513('0x2a')]!=='VIRTUAL'){var _0x11ef54={};_0x11ef54[_0x3d081d[_0x6513('0x25')]]={'$like':'%'+_0xab97ea[_0x6513('0x2e')][_0x6513('0x39')]+'%'};return _0x11ef54;}})});}_0x2fae79=_[_0x6513('0x3a')]({},_0x2fae79,_0xab97ea['options']);var _0x1dab47={'where':_0x2fae79[_0x6513('0x38')]};return db['SugarcrmField'][_0x6513('0x20')](_0x1dab47)[_0x6513('0x24')](function(_0x1e3312){_0x14ea25[_0x6513('0x20')]=_0x1e3312;if(_0xab97ea['query'][_0x6513('0x3b')]){_0x2fae79['include']=[{'all':!![]}];}return db[_0x6513('0x27')]['findAll'](_0x2fae79);})[_0x6513('0x24')](function(_0x465d3e){_0x14ea25[_0x6513('0x3c')]=_0x465d3e;return _0x14ea25;})[_0x6513('0x24')](respondWithFilteredResult(_0x5237b7,_0x2fae79))[_0x6513('0x3d')](handleError(_0x5237b7,null));};exports['show']=function(_0x407af3,_0x92ee57){var _0xd60109={'raw':!![],'where':{'id':_0x407af3[_0x6513('0x3e')]['id']}},_0x29c57f={};_0x29c57f[_0x6513('0x2c')]=_[_0x6513('0x2f')](db[_0x6513('0x27')][_0x6513('0x28')]);_0x29c57f['query']=_[_0x6513('0x2f')](_0x407af3['query']);_0x29c57f['filters']=_[_0x6513('0x32')](_0x29c57f[_0x6513('0x2c')],_0x29c57f[_0x6513('0x2e')]);_0xd60109[_0x6513('0x31')]=_[_0x6513('0x32')](_0x29c57f['model'],qs['fields'](_0x407af3[_0x6513('0x2e')][_0x6513('0x33')]));_0xd60109[_0x6513('0x31')]=_0xd60109[_0x6513('0x31')]['length']?_0xd60109[_0x6513('0x31')]:_0x29c57f['model'];if(_0x407af3[_0x6513('0x2e')]['includeAll']){_0xd60109[_0x6513('0x3f')]=[{'all':!![]}];}_0xd60109=_[_0x6513('0x3a')]({},_0xd60109,_0x407af3[_0x6513('0x40')]);return db[_0x6513('0x27')][_0x6513('0x41')](_0xd60109)[_0x6513('0x24')](handleEntityNotFound(_0x92ee57,null))[_0x6513('0x24')](respondWithResult(_0x92ee57,null))[_0x6513('0x3d')](handleError(_0x92ee57,null));};exports[_0x6513('0x42')]=function(_0x2448dd,_0x225f2d){return db['SugarcrmField'][_0x6513('0x42')](_0x2448dd['body'],{})[_0x6513('0x24')](respondWithResult(_0x225f2d,0xc9))['catch'](handleError(_0x225f2d,null));};exports[_0x6513('0x23')]=function(_0x2e71e0,_0x2a789a){if(_0x2e71e0[_0x6513('0x43')]['id']){delete _0x2e71e0[_0x6513('0x43')]['id'];}return db[_0x6513('0x27')][_0x6513('0x41')]({'where':{'id':_0x2e71e0[_0x6513('0x3e')]['id']}})['then'](handleEntityNotFound(_0x2a789a,null))[_0x6513('0x24')](saveUpdates(_0x2e71e0[_0x6513('0x43')],null))['then'](respondWithResult(_0x2a789a,null))['catch'](handleError(_0x2a789a,null));};exports[_0x6513('0x44')]=function(_0x5c3c0f,_0x5d6133){return db[_0x6513('0x27')][_0x6513('0x41')]({'where':{'id':_0x5c3c0f['params']['id']}})[_0x6513('0x24')](handleEntityNotFound(_0x5d6133,null))[_0x6513('0x24')](removeEntity(_0x5d6133,null))[_0x6513('0x3d')](handleError(_0x5d6133,null));}; \ No newline at end of file +var _0x8250=['options','SugarcrmField','then','includeAll','include','rows','catch','show','params','fields','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x8250,0x1bd));var _0x0825=function(_0x544a43,_0x2d2753){_0x544a43=_0x544a43-0x0;var _0x2a24a8=_0x8250[_0x544a43];return _0x2a24a8;};'use strict';var emlformat=require(_0x0825('0x0'));var rimraf=require(_0x0825('0x1'));var zipdir=require(_0x0825('0x2'));var jsonpatch=require(_0x0825('0x3'));var rp=require('request-promise');var moment=require(_0x0825('0x4'));var BPromise=require(_0x0825('0x5'));var Mustache=require(_0x0825('0x6'));var util=require(_0x0825('0x7'));var path=require('path');var sox=require(_0x0825('0x8'));var csv=require(_0x0825('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0825('0xa'));var _=require('lodash');var squel=require(_0x0825('0xb'));var crypto=require(_0x0825('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0825('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0825('0xe'));var Redis=require(_0x0825('0xf'));var authService=require(_0x0825('0x10'));var qs=require(_0x0825('0x11'));var as=require(_0x0825('0x12'));var hardwareService=require(_0x0825('0x13'));var logger=require(_0x0825('0x14'))('api');var utils=require(_0x0825('0x15'));var config=require(_0x0825('0x16'));var licenseUtil=require(_0x0825('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x227cda,_0x5d1dce){_0x5d1dce=_0x5d1dce||0xcc;return function(_0x612988){if(_0x612988){return _0x227cda[_0x0825('0x18')](_0x5d1dce);}return _0x227cda[_0x0825('0x19')](_0x5d1dce)[_0x0825('0x1a')]();};}function respondWithResult(_0x1c1b4e,_0x36cbbb){_0x36cbbb=_0x36cbbb||0xc8;return function(_0x3c42c4){if(_0x3c42c4){return _0x1c1b4e[_0x0825('0x19')](_0x36cbbb)[_0x0825('0x1b')](_0x3c42c4);}};}function respondWithFilteredResult(_0x2fa31c,_0xea4080){return function(_0x50f799){if(_0x50f799){var _0x107c71=typeof _0xea4080[_0x0825('0x1c')]==='undefined'&&typeof _0xea4080[_0x0825('0x1d')]===_0x0825('0x1e');var _0x396ba3=_0x50f799['count'];var _0x1200c7=_0x107c71?0x0:_0xea4080[_0x0825('0x1c')];var _0x116e37=_0x107c71?_0x50f799[_0x0825('0x1f')]:_0xea4080[_0x0825('0x1c')]+_0xea4080[_0x0825('0x1d')];var _0x116c60;if(_0x116e37>=_0x396ba3){_0x116e37=_0x396ba3;_0x116c60=0xc8;}else{_0x116c60=0xce;}_0x2fa31c['status'](_0x116c60);return _0x2fa31c[_0x0825('0x20')](_0x0825('0x21'),_0x1200c7+'-'+_0x116e37+'/'+_0x396ba3)['json'](_0x50f799);}return null;};}function patchUpdates(_0x49870){return function(_0x17dc85){try{jsonpatch[_0x0825('0x22')](_0x17dc85,_0x49870,!![]);}catch(_0x460fe3){return BPromise[_0x0825('0x23')](_0x460fe3);}return _0x17dc85['save']();};}function saveUpdates(_0x50bc72,_0x417622){return function(_0x96bd7c){if(_0x96bd7c){return _0x96bd7c[_0x0825('0x24')](_0x50bc72)['then'](function(_0x5dc8c7){return _0x5dc8c7;});}return null;};}function removeEntity(_0x3239f6,_0x9fc90f){return function(_0x3c27ad){if(_0x3c27ad){return _0x3c27ad[_0x0825('0x25')]()['then'](function(){_0x3239f6[_0x0825('0x19')](0xcc)[_0x0825('0x1a')]();});}};}function handleEntityNotFound(_0xd4c3d,_0x3fac79){return function(_0x25cc76){if(!_0x25cc76){_0xd4c3d[_0x0825('0x18')](0x194);}return _0x25cc76;};}function handleError(_0x2746f5,_0x1dd022){_0x1dd022=_0x1dd022||0x1f4;return function(_0x3525ed){logger['error'](_0x3525ed[_0x0825('0x26')]);if(_0x3525ed[_0x0825('0x27')]){delete _0x3525ed[_0x0825('0x27')];}_0x2746f5['status'](_0x1dd022)[_0x0825('0x28')](_0x3525ed);};}exports[_0x0825('0x29')]=function(_0x19c94b,_0x1e4d48){var _0x4e00ac={},_0x1b6315={},_0x4de4db={'count':0x0,'rows':[]};var _0x40fbf7=_[_0x0825('0x2a')](db['SugarcrmField']['rawAttributes'],function(_0x48b597){return{'name':_0x48b597['fieldName'],'type':_0x48b597[_0x0825('0x2b')][_0x0825('0x2c')]};});_0x1b6315[_0x0825('0x2d')]=_['map'](_0x40fbf7,_0x0825('0x27'));_0x1b6315[_0x0825('0x2e')]=_[_0x0825('0x2f')](_0x19c94b['query']);_0x1b6315[_0x0825('0x30')]=_[_0x0825('0x31')](_0x1b6315[_0x0825('0x2d')],_0x1b6315[_0x0825('0x2e')]);_0x4e00ac[_0x0825('0x32')]=_[_0x0825('0x31')](_0x1b6315[_0x0825('0x2d')],qs['fields'](_0x19c94b[_0x0825('0x2e')]['fields']));_0x4e00ac['attributes']=_0x4e00ac[_0x0825('0x32')][_0x0825('0x33')]?_0x4e00ac[_0x0825('0x32')]:_0x1b6315['model'];if(!_0x19c94b[_0x0825('0x2e')]['hasOwnProperty']('nolimit')){_0x4e00ac[_0x0825('0x1d')]=qs['limit'](_0x19c94b['query'][_0x0825('0x1d')]);_0x4e00ac['offset']=qs[_0x0825('0x1c')](_0x19c94b[_0x0825('0x2e')][_0x0825('0x1c')]);}_0x4e00ac[_0x0825('0x34')]=qs[_0x0825('0x35')](_0x19c94b[_0x0825('0x2e')][_0x0825('0x35')]);_0x4e00ac[_0x0825('0x36')]=qs[_0x0825('0x30')](_[_0x0825('0x37')](_0x19c94b[_0x0825('0x2e')],_0x1b6315[_0x0825('0x30')]),_0x40fbf7);if(_0x19c94b[_0x0825('0x2e')][_0x0825('0x38')]){_0x4e00ac[_0x0825('0x36')]=_[_0x0825('0x39')](_0x4e00ac[_0x0825('0x36')],{'$or':_['map'](_0x40fbf7,function(_0x27d598){if(_0x27d598[_0x0825('0x2b')]!==_0x0825('0x3a')){var _0x5cbe34={};_0x5cbe34[_0x27d598[_0x0825('0x27')]]={'$like':'%'+_0x19c94b[_0x0825('0x2e')]['filter']+'%'};return _0x5cbe34;}})});}_0x4e00ac=_[_0x0825('0x39')]({},_0x4e00ac,_0x19c94b[_0x0825('0x3b')]);var _0x4dfdc0={'where':_0x4e00ac[_0x0825('0x36')]};return db[_0x0825('0x3c')][_0x0825('0x1f')](_0x4dfdc0)[_0x0825('0x3d')](function(_0x2dbc03){_0x4de4db[_0x0825('0x1f')]=_0x2dbc03;if(_0x19c94b[_0x0825('0x2e')][_0x0825('0x3e')]){_0x4e00ac[_0x0825('0x3f')]=[{'all':!![]}];}return db[_0x0825('0x3c')]['findAll'](_0x4e00ac);})[_0x0825('0x3d')](function(_0x119519){_0x4de4db[_0x0825('0x40')]=_0x119519;return _0x4de4db;})[_0x0825('0x3d')](respondWithFilteredResult(_0x1e4d48,_0x4e00ac))[_0x0825('0x41')](handleError(_0x1e4d48,null));};exports[_0x0825('0x42')]=function(_0x562918,_0x50aeaa){var _0x577e40={'raw':!![],'where':{'id':_0x562918[_0x0825('0x43')]['id']}},_0x414ee5={};_0x414ee5['model']=_[_0x0825('0x2f')](db[_0x0825('0x3c')]['rawAttributes']);_0x414ee5['query']=_['keys'](_0x562918[_0x0825('0x2e')]);_0x414ee5[_0x0825('0x30')]=_[_0x0825('0x31')](_0x414ee5['model'],_0x414ee5[_0x0825('0x2e')]);_0x577e40[_0x0825('0x32')]=_['intersection'](_0x414ee5[_0x0825('0x2d')],qs[_0x0825('0x44')](_0x562918[_0x0825('0x2e')]['fields']));_0x577e40['attributes']=_0x577e40[_0x0825('0x32')][_0x0825('0x33')]?_0x577e40[_0x0825('0x32')]:_0x414ee5[_0x0825('0x2d')];if(_0x562918[_0x0825('0x2e')][_0x0825('0x3e')]){_0x577e40[_0x0825('0x3f')]=[{'all':!![]}];}_0x577e40=_[_0x0825('0x39')]({},_0x577e40,_0x562918[_0x0825('0x3b')]);return db['SugarcrmField'][_0x0825('0x45')](_0x577e40)[_0x0825('0x3d')](handleEntityNotFound(_0x50aeaa,null))[_0x0825('0x3d')](respondWithResult(_0x50aeaa,null))['catch'](handleError(_0x50aeaa,null));};exports[_0x0825('0x46')]=function(_0x554592,_0x2527e1){return db[_0x0825('0x3c')]['create'](_0x554592[_0x0825('0x47')],{})[_0x0825('0x3d')](respondWithResult(_0x2527e1,0xc9))['catch'](handleError(_0x2527e1,null));};exports[_0x0825('0x24')]=function(_0x55018e,_0x498607){if(_0x55018e[_0x0825('0x47')]['id']){delete _0x55018e[_0x0825('0x47')]['id'];}return db[_0x0825('0x3c')][_0x0825('0x45')]({'where':{'id':_0x55018e['params']['id']}})[_0x0825('0x3d')](handleEntityNotFound(_0x498607,null))[_0x0825('0x3d')](saveUpdates(_0x55018e[_0x0825('0x47')],null))[_0x0825('0x3d')](respondWithResult(_0x498607,null))['catch'](handleError(_0x498607,null));};exports[_0x0825('0x25')]=function(_0x4fcd0a,_0x3c45b5){return db[_0x0825('0x3c')][_0x0825('0x45')]({'where':{'id':_0x4fcd0a[_0x0825('0x43')]['id']}})[_0x0825('0x3d')](handleEntityNotFound(_0x3c45b5,null))[_0x0825('0x3d')](removeEntity(_0x3c45b5,null))[_0x0825('0x41')](handleError(_0x3c45b5,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 816d097..cbdc87e 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 _0x85a5=['./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId','lodash','../../config/logger','api','moment','request-promise','rimraf','../../config/environment'];(function(_0x3da001,_0x256e26){var _0x2947e9=function(_0x4afdc0){while(--_0x4afdc0){_0x3da001['push'](_0x3da001['shift']());}};_0x2947e9(++_0x256e26);}(_0x85a5,0x107));var _0x585a=function(_0x4a7193,_0x556c6a){_0x4a7193=_0x4a7193-0x0;var _0xc33d94=_0x85a5[_0x4a7193];return _0xc33d94;};'use strict';var _=require(_0x585a('0x0'));var util=require('util');var logger=require(_0x585a('0x1'))(_0x585a('0x2'));var moment=require(_0x585a('0x3'));var BPromise=require('bluebird');var rp=require(_0x585a('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x585a('0x5'));var config=require(_0x585a('0x6'));var attributes=require(_0x585a('0x7'));module[_0x585a('0x8')]=function(_0x3ec879,_0x230c44){return _0x3ec879[_0x585a('0x9')](_0x585a('0xa'),attributes,{'tableName':_0x585a('0xb'),'paranoid':![],'indexes':[{'name':_0x585a('0xc'),'fields':[_0x585a('0xd'),_0x585a('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbc05=['exports','define','int_sugarcrm_fields','sugarcrm_unique_index','idField','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./intSugarcrmField.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbc05,0x83));var _0x5bc0=function(_0x43d2ae,_0x505159){_0x43d2ae=_0x43d2ae-0x0;var _0x3fe092=_0xbc05[_0x43d2ae];return _0x3fe092;};'use strict';var _=require('lodash');var util=require(_0x5bc0('0x0'));var logger=require(_0x5bc0('0x1'))(_0x5bc0('0x2'));var moment=require(_0x5bc0('0x3'));var BPromise=require(_0x5bc0('0x4'));var rp=require(_0x5bc0('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x5bc0('0x6'));var config=require(_0x5bc0('0x7'));var attributes=require(_0x5bc0('0x8'));module[_0x5bc0('0x9')]=function(_0x297c1f,_0x5728a2){return _0x297c1f[_0x5bc0('0xa')]('SugarcrmField',attributes,{'tableName':_0x5bc0('0xb'),'paranoid':![],'indexes':[{'name':_0x5bc0('0xc'),'fields':[_0x5bc0('0xd'),'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 2f694e2..7254546 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 _0x6674=['request\x20sent','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','info','SugarcrmField,\x20%s,\x20%s'];(function(_0x1c74db,_0x474b8a){var _0x47b019=function(_0x45a37c){while(--_0x45a37c){_0x1c74db['push'](_0x1c74db['shift']());}};_0x47b019(++_0x474b8a);}(_0x6674,0x157));var _0x4667=function(_0x2604f1,_0xf57f68){_0x2604f1=_0x2604f1-0x0;var _0x51e412=_0x6674[_0x2604f1];return _0x51e412;};'use strict';var _=require(_0x4667('0x0'));var util=require(_0x4667('0x1'));var moment=require(_0x4667('0x2'));var BPromise=require(_0x4667('0x3'));var rs=require(_0x4667('0x4'));var fs=require('fs');var Redis=require(_0x4667('0x5'));var db=require(_0x4667('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4667('0x7'))('rpc');var config=require(_0x4667('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4667('0x9')][_0x4667('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xb49377,_0x1cfdd0,_0x17a27a){return new BPromise(function(_0x83c334,_0x21914b){return client[_0x4667('0xb')](_0xb49377,_0x17a27a)['then'](function(_0x508d0c){logger[_0x4667('0xc')](_0x4667('0xd'),_0x1cfdd0,_0x4667('0xe'));logger[_0x4667('0xf')](_0x4667('0x10'),_0x1cfdd0,_0x4667('0xe'),JSON[_0x4667('0x11')](_0x508d0c));if(_0x508d0c[_0x4667('0x12')]){if(_0x508d0c['error']['code']===0x1f4){logger[_0x4667('0x12')](_0x4667('0xd'),_0x1cfdd0,_0x508d0c[_0x4667('0x12')]['message']);return _0x21914b(_0x508d0c[_0x4667('0x12')]['message']);}logger[_0x4667('0x12')](_0x4667('0xd'),_0x1cfdd0,_0x508d0c[_0x4667('0x12')][_0x4667('0x13')]);return _0x83c334(_0x508d0c['error'][_0x4667('0x13')]);}else{logger[_0x4667('0xc')]('SugarcrmField,\x20%s,\x20%s',_0x1cfdd0,_0x4667('0xe'));_0x83c334(_0x508d0c[_0x4667('0x14')][_0x4667('0x13')]);}})['catch'](function(_0x15acc6){logger['error'](_0x4667('0xd'),_0x1cfdd0,_0x15acc6);_0x21914b(_0x15acc6);});});} \ No newline at end of file +var _0x82f7=['client','request','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','request\x20sent','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0xa4c85,_0x2b52a7){var _0x172c1f=function(_0x149473){while(--_0x149473){_0xa4c85['push'](_0xa4c85['shift']());}};_0x172c1f(++_0x2b52a7);}(_0x82f7,0x173));var _0x782f=function(_0x3f5cae,_0x16b6b9){_0x3f5cae=_0x3f5cae-0x0;var _0x66b620=_0x82f7[_0x3f5cae];return _0x66b620;};'use strict';var _=require(_0x782f('0x0'));var util=require(_0x782f('0x1'));var moment=require(_0x782f('0x2'));var BPromise=require(_0x782f('0x3'));var rs=require(_0x782f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x782f('0x5'))['db'];var utils=require(_0x782f('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x782f('0x7'));var jayson=require(_0x782f('0x8'));var client=jayson[_0x782f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x394248,_0x2c7c4e,_0x3638ee){return new BPromise(function(_0x4bd50a,_0x3abaa6){return client[_0x782f('0xa')](_0x394248,_0x3638ee)['then'](function(_0x355c43){logger['info'](_0x782f('0xb'),_0x2c7c4e,'request\x20sent');logger['debug'](_0x782f('0xc'),_0x2c7c4e,'request\x20sent',JSON[_0x782f('0xd')](_0x355c43));if(_0x355c43[_0x782f('0xe')]){if(_0x355c43[_0x782f('0xe')]['code']===0x1f4){logger['error'](_0x782f('0xb'),_0x2c7c4e,_0x355c43[_0x782f('0xe')][_0x782f('0xf')]);return _0x3abaa6(_0x355c43[_0x782f('0xe')]['message']);}logger[_0x782f('0xe')](_0x782f('0xb'),_0x2c7c4e,_0x355c43['error'][_0x782f('0xf')]);return _0x4bd50a(_0x355c43[_0x782f('0xe')]['message']);}else{logger[_0x782f('0x10')]('SugarcrmField,\x20%s,\x20%s',_0x2c7c4e,_0x782f('0x11'));_0x4bd50a(_0x355c43['result']['message']);}})[_0x782f('0x12')](function(_0x1810da){logger[_0x782f('0xe')](_0x782f('0xb'),_0x2c7c4e,_0x1810da);_0x3abaa6(_0x1810da);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index 37b965e..0e828ac 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 _0x57cf=['create','post','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','isAuthenticated','/:id/configurations','/:id/fields','getFields'];(function(_0x1413c7,_0x338846){var _0x855596=function(_0x58a15a){while(--_0x58a15a){_0x1413c7['push'](_0x1413c7['shift']());}};_0x855596(++_0x338846);}(_0x57cf,0x11b));var _0xf57c=function(_0xff8595,_0x39341d){_0xff8595=_0xff8595-0x0;var _0x31e49e=_0x57cf[_0xff8595];return _0x31e49e;};'use strict';var multer=require(_0xf57c('0x0'));var util=require(_0xf57c('0x1'));var path=require(_0xf57c('0x2'));var timeout=require(_0xf57c('0x3'));var express=require(_0xf57c('0x4'));var router=express[_0xf57c('0x5')]();var fs_extra=require(_0xf57c('0x6'));var auth=require(_0xf57c('0x7'));var interaction=require(_0xf57c('0x8'));var config=require(_0xf57c('0x9'));var controller=require('./intVtigerAccount.controller');router[_0xf57c('0xa')]('/',auth['isAuthenticated'](),controller[_0xf57c('0xb')]);router['get']('/:id',auth[_0xf57c('0xc')](),controller['show']);router[_0xf57c('0xa')](_0xf57c('0xd'),auth['isAuthenticated'](),controller['getConfigurations']);router[_0xf57c('0xa')](_0xf57c('0xe'),auth[_0xf57c('0xc')](),controller[_0xf57c('0xf')]);router['post']('/',auth[_0xf57c('0xc')](),controller[_0xf57c('0x10')]);router[_0xf57c('0x11')]('/:id/configurations',auth[_0xf57c('0xc')](),controller['addConfiguration']);router[_0xf57c('0x12')](_0xf57c('0x13'),auth['isAuthenticated'](),controller[_0xf57c('0x14')]);router['delete'](_0xf57c('0x13'),auth['isAuthenticated'](),controller[_0xf57c('0x15')]);module[_0xf57c('0x16')]=router; \ No newline at end of file +var _0x28a1=['isAuthenticated','show','/:id/configurations','getConfigurations','/:id/fields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerAccount.controller','get','index','/:id'];(function(_0x296a7b,_0x48f68a){var _0xa469b0=function(_0x5349a1){while(--_0x5349a1){_0x296a7b['push'](_0x296a7b['shift']());}};_0xa469b0(++_0x48f68a);}(_0x28a1,0x145));var _0x128a=function(_0x264b9b,_0xa1181e){_0x264b9b=_0x264b9b-0x0;var _0x4c7a0e=_0x28a1[_0x264b9b];return _0x4c7a0e;};'use strict';var multer=require(_0x128a('0x0'));var util=require(_0x128a('0x1'));var path=require('path');var timeout=require(_0x128a('0x2'));var express=require(_0x128a('0x3'));var router=express[_0x128a('0x4')]();var fs_extra=require(_0x128a('0x5'));var auth=require(_0x128a('0x6'));var interaction=require(_0x128a('0x7'));var config=require(_0x128a('0x8'));var controller=require(_0x128a('0x9'));router[_0x128a('0xa')]('/',auth['isAuthenticated'](),controller[_0x128a('0xb')]);router[_0x128a('0xa')](_0x128a('0xc'),auth[_0x128a('0xd')](),controller[_0x128a('0xe')]);router[_0x128a('0xa')](_0x128a('0xf'),auth['isAuthenticated'](),controller[_0x128a('0x10')]);router[_0x128a('0xa')](_0x128a('0x11'),auth['isAuthenticated'](),controller['getFields']);router[_0x128a('0x12')]('/',auth[_0x128a('0xd')](),controller[_0x128a('0x13')]);router[_0x128a('0x12')](_0x128a('0xf'),auth[_0x128a('0xd')](),controller[_0x128a('0x14')]);router[_0x128a('0x15')]('/:id',auth['isAuthenticated'](),controller[_0x128a('0x16')]);router[_0x128a('0x17')](_0x128a('0xc'),auth[_0x128a('0xd')](),controller[_0x128a('0x18')]);module[_0x128a('0x19')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5f2135b..4991765 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 _0x9b46=['HelpDesk','sequelize','STRING'];(function(_0x158d8b,_0x46513a){var _0x410eba=function(_0x2018f6){while(--_0x2018f6){_0x158d8b['push'](_0x158d8b['shift']());}};_0x410eba(++_0x46513a);}(_0x9b46,0xd3));var _0x69b4=function(_0x3190b5,_0x182208){_0x3190b5=_0x3190b5-0x0;var _0x5cec54=_0x9b46[_0x3190b5];return _0x5cec54;};'use strict';var Sequelize=require(_0x69b4('0x0'));module['exports']={'name':{'type':Sequelize[_0x69b4('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x69b4('0x1')]},'username':{'type':Sequelize[_0x69b4('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x69b4('0x1')],'allowNull':![],'defaultValue':_0x69b4('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x69b4('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xbbd8=['STRING','HelpDesk','sequelize'];(function(_0x88f635,_0x560022){var _0x3ef161=function(_0x58e556){while(--_0x58e556){_0x88f635['push'](_0x88f635['shift']());}};_0x3ef161(++_0x560022);}(_0xbbd8,0x18e));var _0x8bbd=function(_0x52b328,_0x2bd5e3){_0x52b328=_0x52b328-0x0;var _0x395c72=_0xbbd8[_0x52b328];return _0x395c72;};'use strict';var Sequelize=require(_0x8bbd('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0x8bbd('0x1')]},'username':{'type':Sequelize[_0x8bbd('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0x8bbd('0x1')],'allowNull':![],'defaultValue':_0x8bbd('0x2')},'remoteUri':{'type':Sequelize['STRING'],'allowNull':![]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'accessKey':{'type':Sequelize[_0x8bbd('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.controller.js b/server/api/intVtigerAccount/intVtigerAccount.controller.js index 841405c..b6a31ef 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 _0x90fb=['catch','params','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','VtigerConfiguration','VtigerField','Descriptions','md5','getFields','username','description','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','POST','login','token','success','describe','result','autogenerated','reference','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','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','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','VtigerAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows'];(function(_0x218aa1,_0x439ef4){var _0x20d77a=function(_0x5e30c0){while(--_0x5e30c0){_0x218aa1['push'](_0x218aa1['shift']());}};_0x20d77a(++_0x439ef4);}(_0x90fb,0x132));var _0xb90f=function(_0x33f7e1,_0x48d209){_0x33f7e1=_0x33f7e1-0x0;var _0x23bab4=_0x90fb[_0x33f7e1];return _0x23bab4;};'use strict';var emlformat=require(_0xb90f('0x0'));var rimraf=require(_0xb90f('0x1'));var zipdir=require(_0xb90f('0x2'));var jsonpatch=require(_0xb90f('0x3'));var rp=require('request-promise');var moment=require(_0xb90f('0x4'));var BPromise=require(_0xb90f('0x5'));var Mustache=require('mustache');var util=require(_0xb90f('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xb90f('0x7'));var ejs=require(_0xb90f('0x8'));var fs=require('fs');var fs_extra=require(_0xb90f('0x9'));var _=require(_0xb90f('0xa'));var squel=require(_0xb90f('0xb'));var crypto=require(_0xb90f('0xc'));var jsforce=require(_0xb90f('0xd'));var deskjs=require(_0xb90f('0xe'));var toCsv=require(_0xb90f('0x7'));var querystring=require(_0xb90f('0xf'));var Papa=require('papaparse');var Redis=require(_0xb90f('0x10'));var authService=require(_0xb90f('0x11'));var qs=require(_0xb90f('0x12'));var as=require(_0xb90f('0x13'));var hardwareService=require(_0xb90f('0x14'));var logger=require('../../config/logger')(_0xb90f('0x15'));var utils=require(_0xb90f('0x16'));var config=require(_0xb90f('0x17'));var licenseUtil=require(_0xb90f('0x18'));var db=require(_0xb90f('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0xcd6896,_0x8d166){_0x8d166=_0x8d166||0xcc;return function(_0x37400c){if(_0x37400c){return _0xcd6896[_0xb90f('0x1a')](_0x8d166);}return _0xcd6896[_0xb90f('0x1b')](_0x8d166)[_0xb90f('0x1c')]();};}function respondWithResult(_0x41038b,_0x5af623){_0x5af623=_0x5af623||0xc8;return function(_0x395d67){if(_0x395d67){return _0x41038b[_0xb90f('0x1b')](_0x5af623)[_0xb90f('0x1d')](_0x395d67);}};}function respondWithFilteredResult(_0x2085b2,_0x34eb8c){return function(_0x5a31be){if(_0x5a31be){var _0x515c0c=typeof _0x34eb8c[_0xb90f('0x1e')]===_0xb90f('0x1f')&&typeof _0x34eb8c[_0xb90f('0x20')]===_0xb90f('0x1f');var _0x52499c=_0x5a31be[_0xb90f('0x21')];var _0x41467c=_0x515c0c?0x0:_0x34eb8c[_0xb90f('0x1e')];var _0x5f35a3=_0x515c0c?_0x5a31be[_0xb90f('0x21')]:_0x34eb8c[_0xb90f('0x1e')]+_0x34eb8c[_0xb90f('0x20')];var _0x3068fb;if(_0x5f35a3>=_0x52499c){_0x5f35a3=_0x52499c;_0x3068fb=0xc8;}else{_0x3068fb=0xce;}_0x2085b2['status'](_0x3068fb);return _0x2085b2[_0xb90f('0x22')](_0xb90f('0x23'),_0x41467c+'-'+_0x5f35a3+'/'+_0x52499c)[_0xb90f('0x1d')](_0x5a31be);}return null;};}function patchUpdates(_0x1dc58e){return function(_0x3f032a){try{jsonpatch[_0xb90f('0x24')](_0x3f032a,_0x1dc58e,!![]);}catch(_0x3b5087){return BPromise[_0xb90f('0x25')](_0x3b5087);}return _0x3f032a[_0xb90f('0x26')]();};}function saveUpdates(_0x16c65f,_0xdfb000){return function(_0x11fb59){if(_0x11fb59){return _0x11fb59[_0xb90f('0x27')](_0x16c65f)['then'](function(_0x21928e){return _0x21928e;});}return null;};}function removeEntity(_0x591c93,_0x1ffe78){return function(_0x3b97e9){if(_0x3b97e9){return _0x3b97e9['destroy']()[_0xb90f('0x28')](function(){_0x591c93[_0xb90f('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x13a361,_0x16fed7){return function(_0x37edd7){if(!_0x37edd7){_0x13a361['sendStatus'](0x194);}return _0x37edd7;};}function handleError(_0x1ffb9d,_0x2e98ab){_0x2e98ab=_0x2e98ab||0x1f4;return function(_0x4699ad){logger[_0xb90f('0x29')](_0x4699ad[_0xb90f('0x2a')]);if(_0x4699ad[_0xb90f('0x2b')]){delete _0x4699ad[_0xb90f('0x2b')];}_0x1ffb9d[_0xb90f('0x1b')](_0x2e98ab)['send'](_0x4699ad);};}exports[_0xb90f('0x2c')]=function(_0x4ec93b,_0x33309c){var _0x36545f={},_0x2df2a0={},_0x463b7d={'count':0x0,'rows':[]};var _0x172149=_[_0xb90f('0x2d')](db[_0xb90f('0x2e')][_0xb90f('0x2f')],function(_0x194a1a){return{'name':_0x194a1a[_0xb90f('0x30')],'type':_0x194a1a[_0xb90f('0x31')][_0xb90f('0x32')]};});_0x2df2a0[_0xb90f('0x33')]=_[_0xb90f('0x2d')](_0x172149,'name');_0x2df2a0[_0xb90f('0x34')]=_[_0xb90f('0x35')](_0x4ec93b[_0xb90f('0x34')]);_0x2df2a0[_0xb90f('0x36')]=_[_0xb90f('0x37')](_0x2df2a0[_0xb90f('0x33')],_0x2df2a0['query']);_0x36545f[_0xb90f('0x38')]=_[_0xb90f('0x37')](_0x2df2a0[_0xb90f('0x33')],qs[_0xb90f('0x39')](_0x4ec93b['query'][_0xb90f('0x39')]));_0x36545f[_0xb90f('0x38')]=_0x36545f[_0xb90f('0x38')][_0xb90f('0x3a')]?_0x36545f[_0xb90f('0x38')]:_0x2df2a0[_0xb90f('0x33')];if(!_0x4ec93b['query'][_0xb90f('0x3b')]('nolimit')){_0x36545f[_0xb90f('0x20')]=qs['limit'](_0x4ec93b['query'][_0xb90f('0x20')]);_0x36545f[_0xb90f('0x1e')]=qs[_0xb90f('0x1e')](_0x4ec93b[_0xb90f('0x34')][_0xb90f('0x1e')]);}_0x36545f[_0xb90f('0x3c')]=qs[_0xb90f('0x3d')](_0x4ec93b['query'][_0xb90f('0x3d')]);_0x36545f['where']=qs[_0xb90f('0x36')](_[_0xb90f('0x3e')](_0x4ec93b['query'],_0x2df2a0['filters']),_0x172149);if(_0x4ec93b[_0xb90f('0x34')][_0xb90f('0x3f')]){_0x36545f[_0xb90f('0x40')]=_['merge'](_0x36545f[_0xb90f('0x40')],{'$or':_[_0xb90f('0x2d')](_0x172149,function(_0x3e9a51){if(_0x3e9a51[_0xb90f('0x31')]!==_0xb90f('0x41')){var _0x392f49={};_0x392f49[_0x3e9a51[_0xb90f('0x2b')]]={'$like':'%'+_0x4ec93b[_0xb90f('0x34')][_0xb90f('0x3f')]+'%'};return _0x392f49;}})});}_0x36545f=_[_0xb90f('0x42')]({},_0x36545f,_0x4ec93b[_0xb90f('0x43')]);var _0x29a8cf={'where':_0x36545f['where']};return db[_0xb90f('0x2e')][_0xb90f('0x21')](_0x29a8cf)['then'](function(_0x2bfcbb){_0x463b7d[_0xb90f('0x21')]=_0x2bfcbb;if(_0x4ec93b[_0xb90f('0x34')][_0xb90f('0x44')]){_0x36545f[_0xb90f('0x45')]=[{'all':!![]}];}return db[_0xb90f('0x2e')][_0xb90f('0x46')](_0x36545f);})['then'](function(_0x1d336c){_0x463b7d[_0xb90f('0x47')]=_0x1d336c;return _0x463b7d;})[_0xb90f('0x28')](respondWithFilteredResult(_0x33309c,_0x36545f))[_0xb90f('0x48')](handleError(_0x33309c,null));};exports['show']=function(_0x171429,_0x3d6d4c){var _0x1861e1={'raw':![],'where':{'id':_0x171429[_0xb90f('0x49')]['id']}},_0x3213ec={};_0x3213ec[_0xb90f('0x33')]=_[_0xb90f('0x35')](db[_0xb90f('0x2e')][_0xb90f('0x2f')]);_0x3213ec[_0xb90f('0x34')]=_[_0xb90f('0x35')](_0x171429['query']);_0x3213ec[_0xb90f('0x36')]=_['intersection'](_0x3213ec[_0xb90f('0x33')],_0x3213ec[_0xb90f('0x34')]);_0x1861e1['attributes']=_[_0xb90f('0x37')](_0x3213ec[_0xb90f('0x33')],qs[_0xb90f('0x39')](_0x171429[_0xb90f('0x34')][_0xb90f('0x39')]));_0x1861e1[_0xb90f('0x38')]=_0x1861e1[_0xb90f('0x38')]['length']?_0x1861e1[_0xb90f('0x38')]:_0x3213ec[_0xb90f('0x33')];if(_0x171429['query']['includeAll']){_0x1861e1[_0xb90f('0x45')]=[{'all':!![]}];}_0x1861e1=_[_0xb90f('0x42')]({},_0x1861e1,_0x171429[_0xb90f('0x43')]);return db[_0xb90f('0x2e')][_0xb90f('0x4a')](_0x1861e1)[_0xb90f('0x28')](handleEntityNotFound(_0x3d6d4c,null))[_0xb90f('0x28')](respondWithResult(_0x3d6d4c,null))['catch'](handleError(_0x3d6d4c,null));};exports['create']=function(_0x50ca7b,_0x48d6a4){return db[_0xb90f('0x2e')][_0xb90f('0x4b')](_0x50ca7b[_0xb90f('0x4c')],{})[_0xb90f('0x28')](respondWithResult(_0x48d6a4,0xc9))[_0xb90f('0x48')](handleError(_0x48d6a4,null));};exports['update']=function(_0x7c10b7,_0x28c54d){if(_0x7c10b7['body']['id']){delete _0x7c10b7[_0xb90f('0x4c')]['id'];}return db[_0xb90f('0x2e')][_0xb90f('0x4a')]({'where':{'id':_0x7c10b7['params']['id']}})['then'](handleEntityNotFound(_0x28c54d,null))[_0xb90f('0x28')](saveUpdates(_0x7c10b7['body'],null))['then'](respondWithResult(_0x28c54d,null))[_0xb90f('0x48')](handleError(_0x28c54d,null));};exports['destroy']=function(_0x55b2b4,_0x489dc3){return db[_0xb90f('0x2e')][_0xb90f('0x4a')]({'where':{'id':_0x55b2b4['params']['id']}})['then'](handleEntityNotFound(_0x489dc3,null))[_0xb90f('0x28')](removeEntity(_0x489dc3,null))[_0xb90f('0x48')](handleError(_0x489dc3,null));};exports[_0xb90f('0x4d')]=function(_0x221434,_0x52e4ab,_0x3f24e){var _0x404c03={};var _0x3e9233={};var _0xc8cdff;var _0x450318;return db[_0xb90f('0x2e')][_0xb90f('0x4e')]({'where':{'id':_0x221434[_0xb90f('0x49')]['id']}})[_0xb90f('0x28')](handleEntityNotFound(_0x52e4ab,null))[_0xb90f('0x28')](function(_0x346e89){if(_0x346e89){_0xc8cdff=_0x346e89;_0x3e9233[_0xb90f('0x33')]=_[_0xb90f('0x35')](db['VtigerConfiguration'][_0xb90f('0x2f')]);_0x3e9233[_0xb90f('0x34')]=_['keys'](_0x221434[_0xb90f('0x34')]);_0x3e9233['filters']=_[_0xb90f('0x37')](_0x3e9233[_0xb90f('0x33')],_0x3e9233['query']);_0x404c03[_0xb90f('0x38')]=_[_0xb90f('0x37')](_0x3e9233['model'],qs[_0xb90f('0x39')](_0x221434[_0xb90f('0x34')][_0xb90f('0x39')]));_0x404c03[_0xb90f('0x38')]=_0x404c03[_0xb90f('0x38')][_0xb90f('0x3a')]?_0x404c03['attributes']:_0x3e9233[_0xb90f('0x33')];_0x404c03[_0xb90f('0x3c')]=qs[_0xb90f('0x3d')](_0x221434[_0xb90f('0x34')][_0xb90f('0x3d')]);_0x404c03[_0xb90f('0x40')]=qs['filters'](_['pick'](_0x221434[_0xb90f('0x34')],_0x3e9233['filters']));if(_0x221434[_0xb90f('0x34')][_0xb90f('0x3f')]){_0x404c03['where']=_[_0xb90f('0x42')](_0x404c03[_0xb90f('0x40')],{'$or':_[_0xb90f('0x2d')](_0x404c03[_0xb90f('0x38')],function(_0x2a44e4){var _0x536479={};_0x536479[_0x2a44e4]={'$like':'%'+_0x221434['query']['filter']+'%'};return _0x536479;})});}_0x404c03=_[_0xb90f('0x42')]({},_0x404c03,_0x221434[_0xb90f('0x43')]);return _0xc8cdff[_0xb90f('0x4d')](_0x404c03);}})[_0xb90f('0x28')](function(_0x15d8fa){if(_0x15d8fa){_0x450318=_0x15d8fa['length'];if(!_0x221434[_0xb90f('0x34')][_0xb90f('0x3b')]('nolimit')){_0x404c03[_0xb90f('0x20')]=qs['limit'](_0x221434['query'][_0xb90f('0x20')]);_0x404c03[_0xb90f('0x1e')]=qs[_0xb90f('0x1e')](_0x221434['query'][_0xb90f('0x1e')]);}return _0xc8cdff[_0xb90f('0x4d')](_0x404c03);}})[_0xb90f('0x28')](function(_0x2980cc){if(_0x2980cc){return _0x2980cc?{'count':_0x450318,'rows':_0x2980cc}:null;}})[_0xb90f('0x28')](respondWithResult(_0x52e4ab,null))[_0xb90f('0x48')](handleError(_0x52e4ab,null));};exports[_0xb90f('0x4f')]=function(_0x4aa6c4,_0x5d5839,_0x2d0968){if(_0x4aa6c4[_0xb90f('0x4c')]['id']){delete _0x4aa6c4[_0xb90f('0x4c')]['id'];}return db[_0xb90f('0x2e')][_0xb90f('0x4e')]({'where':{'id':_0x4aa6c4[_0xb90f('0x49')]['id']}})[_0xb90f('0x28')](handleEntityNotFound(_0x5d5839,null))['then'](function(_0x1b38ea){if(_0x1b38ea){_0x4aa6c4['body'][_0xb90f('0x50')]=_0x1b38ea['id'];_0x4aa6c4[_0xb90f('0x4c')][_0xb90f('0x51')]=integrations[_0xb90f('0x52')](_0x4aa6c4[_0xb90f('0x4c')][_0xb90f('0x53')],_0x4aa6c4[_0xb90f('0x4c')][_0xb90f('0x31')]);_0x4aa6c4[_0xb90f('0x4c')]['Descriptions']=integrations[_0xb90f('0x54')](_0x4aa6c4[_0xb90f('0x4c')]['channel'],_0x4aa6c4[_0xb90f('0x4c')][_0xb90f('0x31')]);return db[_0xb90f('0x55')]['create'](_0x4aa6c4[_0xb90f('0x4c')],{'include':[{'model':db[_0xb90f('0x56')],'as':_0xb90f('0x51')},{'model':db['VtigerField'],'as':_0xb90f('0x57')}]});}return null;})[_0xb90f('0x28')](respondWithResult(_0x5d5839,null))[_0xb90f('0x48')](handleError(_0x5d5839,null));};var md5=require(_0xb90f('0x58'));exports[_0xb90f('0x59')]=function(_0x5c4859,_0x23a6fa,_0x1765a0){var _0x783a9d=null;var _0x21262a=null;var _0xf7a0f4=null;var _0x1bb305=null;var _0x1583a9='';return db[_0xb90f('0x2e')][_0xb90f('0x4e')]({'where':{'id':_0x5c4859[_0xb90f('0x49')]['id']},'attributes':['id',_0xb90f('0x2b'),_0xb90f('0x5a'),_0xb90f('0x5b'),'moduleName',_0xb90f('0x5c'),_0xb90f('0x5d'),'accessKey']})[_0xb90f('0x28')](handleEntityNotFound(_0x23a6fa,null))[_0xb90f('0x28')](function(_0x38493b){if(_0x38493b){_0x783a9d=_0x38493b[_0xb90f('0x5a')];_0x21262a=_0x38493b[_0xb90f('0x5e')];_0xf7a0f4=_0x38493b['moduleName'];_0x1583a9=_0x38493b[_0xb90f('0x5c')];var _0x2e43b1=_0x1583a9[_0xb90f('0x5f')](-0x1);if(_0x2e43b1==='/'){_0x1583a9=_0x1583a9[_0xb90f('0x60')](0x0,_0x1583a9[_0xb90f('0x61')](_0x2e43b1));}_0x1bb305=util[_0xb90f('0x62')](_0xb90f('0x63'),_0x1583a9);var _0x4f1ecb={'method':_0xb90f('0x64'),'uri':_0x1bb305,'qs':{'operation':_0xb90f('0x65'),'username':_0x38493b[_0xb90f('0x5a')]},'json':!![]};return rp(_0x4f1ecb);}})[_0xb90f('0x28')](function(_0x4abb4e){if(_0x4abb4e['success']){var _0x44c36d={'method':_0xb90f('0x66'),'uri':_0x1bb305,'form':{'operation':_0xb90f('0x67'),'username':_0x783a9d,'accessKey':md5(_0x4abb4e['result'][_0xb90f('0x68')]+_0x21262a)},'json':!![]};return rp(_0x44c36d);}})['then'](function(_0x57a00f){if(_0x57a00f[_0xb90f('0x69')]){var _0x390ee9={'method':'GET','uri':_0x1bb305,'qs':{'operation':_0xb90f('0x6a'),'username':_0x783a9d,'sessionName':_0x57a00f[_0xb90f('0x6b')]['sessionName'],'elementType':_0xf7a0f4},'json':!![]};return rp(_0x390ee9);}})[_0xb90f('0x28')](function(_0x1f3142){if(_0x1f3142[_0xb90f('0x69')]){var _0x1d1bbc=[_0xb90f('0x6c'),_0xb90f('0x6d'),'owner'];_[_0xb90f('0x6e')](_0x1f3142['result'][_0xb90f('0x39')],function(_0x33d701){return _0x1d1bbc['includes'](_0x33d701[_0xb90f('0x31')]['name']);});_[_0xb90f('0x6e')](_0x1f3142['result']['fields'],function(_0xc6f51b){return _0xc6f51b[_0xb90f('0x6f')]===_0xb90f('0x70');});return{'count':_0x1f3142['result']['fields']['length'],'rows':_[_0xb90f('0x2d')](_0x1f3142[_0xb90f('0x6b')][_0xb90f('0x39')],function(_0x3a4aa7){return{'id':_0x3a4aa7[_0xb90f('0x2b')],'name':_0x3a4aa7[_0xb90f('0x71')],'custom':_[_0xb90f('0x72')](_0x3a4aa7[_0xb90f('0x2b')],_0xb90f('0x73'))?!![]:![],'options':_0x3a4aa7[_0xb90f('0x31')][_0xb90f('0x2b')]===_0xb90f('0x74')&&_0x3a4aa7[_0xb90f('0x31')][_0xb90f('0x75')][_0xb90f('0x3a')]>0x0?_[_0xb90f('0x2d')](_0x3a4aa7['type'][_0xb90f('0x75')],function(_0x34d066){return{'name':_0x34d066[_0xb90f('0x71')],'value':_0x34d066[_0xb90f('0x76')]};}):[]};})};}})[_0xb90f('0x28')](respondWithResult(_0x23a6fa,null))[_0xb90f('0x48')](function(_0x19a140){console[_0xb90f('0x77')](_0xb90f('0x78')+_0x19a140);var _0x88b24d=_0x5c4859[_0xb90f('0x34')][_0xb90f('0x79')]?0x1f4:_0x19a140[_0xb90f('0x7a')]||0x1f4;logger[_0xb90f('0x29')](_0xb90f('0x7b'),_0xb90f('0x59'),_0x88b24d,JSON[_0xb90f('0x7c')](_0x19a140));delete _0x19a140[_0xb90f('0x2b')];if(_0x88b24d===0x191){_0x88b24d=0x190;}_0x23a6fa[_0xb90f('0x1b')](_0x88b24d)['send'](_0x5c4859[_0xb90f('0x34')][_0xb90f('0x79')]?{'message':_0xb90f('0x7d'),'statusCode':_0x19a140[_0xb90f('0x7a')]}:_0x19a140);});}; \ No newline at end of file +var _0x6ef2=['squel','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','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','save','then','stack','name','send','index','VtigerAccount','fieldName','map','query','keys','filters','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','includeAll','findAll','catch','show','rawAttributes','intersection','include','find','create','body','params','destroy','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','md5','getFields','username','description','moduleName','remoteUri','serverUrl','accessKey','slice','substring','lastIndexOf','format','%s/webservice.php','GET','getchallenge','success','login','token','result','sessionName','owner','remove','editable','false','startsWith','picklist','picklistValues','label','value','vTiger\x20error:\x20','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','bluebird','mustache','sox','to-csv','ejs','lodash'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6ef2,0x1d3));var _0x26ef=function(_0x36dde0,_0xc4d208){_0x36dde0=_0x36dde0-0x0;var _0x276b3d=_0x6ef2[_0x36dde0];return _0x276b3d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x26ef('0x0'));var zipdir=require(_0x26ef('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x26ef('0x2'));var moment=require('moment');var BPromise=require(_0x26ef('0x3'));var Mustache=require(_0x26ef('0x4'));var util=require('util');var path=require('path');var sox=require(_0x26ef('0x5'));var csv=require(_0x26ef('0x6'));var ejs=require(_0x26ef('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x26ef('0x8'));var squel=require(_0x26ef('0x9'));var crypto=require(_0x26ef('0xa'));var jsforce=require(_0x26ef('0xb'));var deskjs=require(_0x26ef('0xc'));var toCsv=require('to-csv');var querystring=require(_0x26ef('0xd'));var Papa=require(_0x26ef('0xe'));var Redis=require(_0x26ef('0xf'));var authService=require(_0x26ef('0x10'));var qs=require(_0x26ef('0x11'));var as=require(_0x26ef('0x12'));var hardwareService=require(_0x26ef('0x13'));var logger=require(_0x26ef('0x14'))(_0x26ef('0x15'));var utils=require('../../config/utils');var config=require(_0x26ef('0x16'));var licenseUtil=require(_0x26ef('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x26ef('0x18'));function respondWithStatusCode(_0x4d89ce,_0x4c533b){_0x4c533b=_0x4c533b||0xcc;return function(_0x5a7474){if(_0x5a7474){return _0x4d89ce[_0x26ef('0x19')](_0x4c533b);}return _0x4d89ce[_0x26ef('0x1a')](_0x4c533b)[_0x26ef('0x1b')]();};}function respondWithResult(_0x498db7,_0x2d3942){_0x2d3942=_0x2d3942||0xc8;return function(_0x5510f4){if(_0x5510f4){return _0x498db7[_0x26ef('0x1a')](_0x2d3942)[_0x26ef('0x1c')](_0x5510f4);}};}function respondWithFilteredResult(_0xf2592e,_0x1f2b1f){return function(_0x2d0ae4){if(_0x2d0ae4){var _0x1f054d=typeof _0x1f2b1f[_0x26ef('0x1d')]===_0x26ef('0x1e')&&typeof _0x1f2b1f[_0x26ef('0x1f')]==='undefined';var _0x18db1d=_0x2d0ae4[_0x26ef('0x20')];var _0x35a451=_0x1f054d?0x0:_0x1f2b1f[_0x26ef('0x1d')];var _0x3d21d9=_0x1f054d?_0x2d0ae4[_0x26ef('0x20')]:_0x1f2b1f[_0x26ef('0x1d')]+_0x1f2b1f[_0x26ef('0x1f')];var _0x443816;if(_0x3d21d9>=_0x18db1d){_0x3d21d9=_0x18db1d;_0x443816=0xc8;}else{_0x443816=0xce;}_0xf2592e['status'](_0x443816);return _0xf2592e[_0x26ef('0x21')]('Content-Range',_0x35a451+'-'+_0x3d21d9+'/'+_0x18db1d)['json'](_0x2d0ae4);}return null;};}function patchUpdates(_0x22c35b){return function(_0xc87704){try{jsonpatch[_0x26ef('0x22')](_0xc87704,_0x22c35b,!![]);}catch(_0x14df8a){return BPromise['reject'](_0x14df8a);}return _0xc87704[_0x26ef('0x23')]();};}function saveUpdates(_0x484873,_0x5518cd){return function(_0x36f596){if(_0x36f596){return _0x36f596['update'](_0x484873)[_0x26ef('0x24')](function(_0xa504a9){return _0xa504a9;});}return null;};}function removeEntity(_0x4566f6,_0x166a71){return function(_0x530c99){if(_0x530c99){return _0x530c99['destroy']()[_0x26ef('0x24')](function(){_0x4566f6['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x227795,_0x1bc278){return function(_0x3b0ddf){if(!_0x3b0ddf){_0x227795[_0x26ef('0x19')](0x194);}return _0x3b0ddf;};}function handleError(_0x566c0a,_0x3e447d){_0x3e447d=_0x3e447d||0x1f4;return function(_0x16aa6f){logger['error'](_0x16aa6f[_0x26ef('0x25')]);if(_0x16aa6f[_0x26ef('0x26')]){delete _0x16aa6f[_0x26ef('0x26')];}_0x566c0a[_0x26ef('0x1a')](_0x3e447d)[_0x26ef('0x27')](_0x16aa6f);};}exports[_0x26ef('0x28')]=function(_0x477a5f,_0x55ef19){var _0x4856f1={},_0xf285f4={},_0x119c76={'count':0x0,'rows':[]};var _0x2805fe=_['map'](db[_0x26ef('0x29')]['rawAttributes'],function(_0xc0fd5f){return{'name':_0xc0fd5f[_0x26ef('0x2a')],'type':_0xc0fd5f['type']['key']};});_0xf285f4['model']=_[_0x26ef('0x2b')](_0x2805fe,_0x26ef('0x26'));_0xf285f4[_0x26ef('0x2c')]=_[_0x26ef('0x2d')](_0x477a5f[_0x26ef('0x2c')]);_0xf285f4[_0x26ef('0x2e')]=_['intersection'](_0xf285f4[_0x26ef('0x2f')],_0xf285f4[_0x26ef('0x2c')]);_0x4856f1['attributes']=_['intersection'](_0xf285f4['model'],qs[_0x26ef('0x30')](_0x477a5f[_0x26ef('0x2c')][_0x26ef('0x30')]));_0x4856f1[_0x26ef('0x31')]=_0x4856f1[_0x26ef('0x31')][_0x26ef('0x32')]?_0x4856f1[_0x26ef('0x31')]:_0xf285f4[_0x26ef('0x2f')];if(!_0x477a5f[_0x26ef('0x2c')][_0x26ef('0x33')](_0x26ef('0x34'))){_0x4856f1[_0x26ef('0x1f')]=qs['limit'](_0x477a5f['query'][_0x26ef('0x1f')]);_0x4856f1[_0x26ef('0x1d')]=qs[_0x26ef('0x1d')](_0x477a5f[_0x26ef('0x2c')][_0x26ef('0x1d')]);}_0x4856f1[_0x26ef('0x35')]=qs[_0x26ef('0x36')](_0x477a5f[_0x26ef('0x2c')][_0x26ef('0x36')]);_0x4856f1[_0x26ef('0x37')]=qs[_0x26ef('0x2e')](_[_0x26ef('0x38')](_0x477a5f[_0x26ef('0x2c')],_0xf285f4[_0x26ef('0x2e')]),_0x2805fe);if(_0x477a5f[_0x26ef('0x2c')][_0x26ef('0x39')]){_0x4856f1[_0x26ef('0x37')]=_['merge'](_0x4856f1['where'],{'$or':_[_0x26ef('0x2b')](_0x2805fe,function(_0x11eca3){if(_0x11eca3[_0x26ef('0x3a')]!==_0x26ef('0x3b')){var _0x3c059d={};_0x3c059d[_0x11eca3[_0x26ef('0x26')]]={'$like':'%'+_0x477a5f['query'][_0x26ef('0x39')]+'%'};return _0x3c059d;}})});}_0x4856f1=_[_0x26ef('0x3c')]({},_0x4856f1,_0x477a5f[_0x26ef('0x3d')]);var _0x5a861d={'where':_0x4856f1[_0x26ef('0x37')]};return db[_0x26ef('0x29')]['count'](_0x5a861d)[_0x26ef('0x24')](function(_0x671632){_0x119c76[_0x26ef('0x20')]=_0x671632;if(_0x477a5f[_0x26ef('0x2c')][_0x26ef('0x3e')]){_0x4856f1['include']=[{'all':!![]}];}return db[_0x26ef('0x29')][_0x26ef('0x3f')](_0x4856f1);})[_0x26ef('0x24')](function(_0x39a12f){_0x119c76['rows']=_0x39a12f;return _0x119c76;})[_0x26ef('0x24')](respondWithFilteredResult(_0x55ef19,_0x4856f1))[_0x26ef('0x40')](handleError(_0x55ef19,null));};exports[_0x26ef('0x41')]=function(_0x44a6fa,_0x20127c){var _0x5ecc8f={'raw':![],'where':{'id':_0x44a6fa['params']['id']}},_0xd5b450={};_0xd5b450[_0x26ef('0x2f')]=_[_0x26ef('0x2d')](db['VtigerAccount'][_0x26ef('0x42')]);_0xd5b450[_0x26ef('0x2c')]=_[_0x26ef('0x2d')](_0x44a6fa[_0x26ef('0x2c')]);_0xd5b450['filters']=_[_0x26ef('0x43')](_0xd5b450[_0x26ef('0x2f')],_0xd5b450[_0x26ef('0x2c')]);_0x5ecc8f[_0x26ef('0x31')]=_[_0x26ef('0x43')](_0xd5b450[_0x26ef('0x2f')],qs[_0x26ef('0x30')](_0x44a6fa[_0x26ef('0x2c')][_0x26ef('0x30')]));_0x5ecc8f[_0x26ef('0x31')]=_0x5ecc8f[_0x26ef('0x31')][_0x26ef('0x32')]?_0x5ecc8f[_0x26ef('0x31')]:_0xd5b450[_0x26ef('0x2f')];if(_0x44a6fa[_0x26ef('0x2c')][_0x26ef('0x3e')]){_0x5ecc8f[_0x26ef('0x44')]=[{'all':!![]}];}_0x5ecc8f=_[_0x26ef('0x3c')]({},_0x5ecc8f,_0x44a6fa[_0x26ef('0x3d')]);return db[_0x26ef('0x29')][_0x26ef('0x45')](_0x5ecc8f)[_0x26ef('0x24')](handleEntityNotFound(_0x20127c,null))[_0x26ef('0x24')](respondWithResult(_0x20127c,null))[_0x26ef('0x40')](handleError(_0x20127c,null));};exports[_0x26ef('0x46')]=function(_0x10f413,_0x30706a){return db['VtigerAccount'][_0x26ef('0x46')](_0x10f413[_0x26ef('0x47')],{})[_0x26ef('0x24')](respondWithResult(_0x30706a,0xc9))['catch'](handleError(_0x30706a,null));};exports['update']=function(_0x34301e,_0x214a96){if(_0x34301e['body']['id']){delete _0x34301e[_0x26ef('0x47')]['id'];}return db[_0x26ef('0x29')]['find']({'where':{'id':_0x34301e[_0x26ef('0x48')]['id']}})['then'](handleEntityNotFound(_0x214a96,null))['then'](saveUpdates(_0x34301e[_0x26ef('0x47')],null))[_0x26ef('0x24')](respondWithResult(_0x214a96,null))[_0x26ef('0x40')](handleError(_0x214a96,null));};exports[_0x26ef('0x49')]=function(_0x101f1d,_0x326a8b){return db[_0x26ef('0x29')][_0x26ef('0x45')]({'where':{'id':_0x101f1d['params']['id']}})[_0x26ef('0x24')](handleEntityNotFound(_0x326a8b,null))[_0x26ef('0x24')](removeEntity(_0x326a8b,null))['catch'](handleError(_0x326a8b,null));};exports[_0x26ef('0x4a')]=function(_0x428d05,_0x426875,_0x283690){var _0x15add6={};var _0x161e66={};var _0xdf00c4;var _0x25ef52;return db[_0x26ef('0x29')][_0x26ef('0x4b')]({'where':{'id':_0x428d05[_0x26ef('0x48')]['id']}})[_0x26ef('0x24')](handleEntityNotFound(_0x426875,null))[_0x26ef('0x24')](function(_0x5aa753){if(_0x5aa753){_0xdf00c4=_0x5aa753;_0x161e66[_0x26ef('0x2f')]=_[_0x26ef('0x2d')](db[_0x26ef('0x4c')][_0x26ef('0x42')]);_0x161e66[_0x26ef('0x2c')]=_[_0x26ef('0x2d')](_0x428d05[_0x26ef('0x2c')]);_0x161e66[_0x26ef('0x2e')]=_[_0x26ef('0x43')](_0x161e66[_0x26ef('0x2f')],_0x161e66[_0x26ef('0x2c')]);_0x15add6[_0x26ef('0x31')]=_[_0x26ef('0x43')](_0x161e66['model'],qs[_0x26ef('0x30')](_0x428d05[_0x26ef('0x2c')][_0x26ef('0x30')]));_0x15add6[_0x26ef('0x31')]=_0x15add6[_0x26ef('0x31')][_0x26ef('0x32')]?_0x15add6[_0x26ef('0x31')]:_0x161e66[_0x26ef('0x2f')];_0x15add6[_0x26ef('0x35')]=qs['sort'](_0x428d05['query']['sort']);_0x15add6[_0x26ef('0x37')]=qs[_0x26ef('0x2e')](_[_0x26ef('0x38')](_0x428d05[_0x26ef('0x2c')],_0x161e66[_0x26ef('0x2e')]));if(_0x428d05[_0x26ef('0x2c')][_0x26ef('0x39')]){_0x15add6['where']=_[_0x26ef('0x3c')](_0x15add6[_0x26ef('0x37')],{'$or':_[_0x26ef('0x2b')](_0x15add6['attributes'],function(_0x419e27){var _0x480634={};_0x480634[_0x419e27]={'$like':'%'+_0x428d05['query'][_0x26ef('0x39')]+'%'};return _0x480634;})});}_0x15add6=_[_0x26ef('0x3c')]({},_0x15add6,_0x428d05[_0x26ef('0x3d')]);return _0xdf00c4[_0x26ef('0x4a')](_0x15add6);}})[_0x26ef('0x24')](function(_0x36c0f7){if(_0x36c0f7){_0x25ef52=_0x36c0f7['length'];if(!_0x428d05[_0x26ef('0x2c')][_0x26ef('0x33')]('nolimit')){_0x15add6[_0x26ef('0x1f')]=qs[_0x26ef('0x1f')](_0x428d05[_0x26ef('0x2c')][_0x26ef('0x1f')]);_0x15add6[_0x26ef('0x1d')]=qs['offset'](_0x428d05[_0x26ef('0x2c')]['offset']);}return _0xdf00c4[_0x26ef('0x4a')](_0x15add6);}})[_0x26ef('0x24')](function(_0x2af4b3){if(_0x2af4b3){return _0x2af4b3?{'count':_0x25ef52,'rows':_0x2af4b3}:null;}})['then'](respondWithResult(_0x426875,null))[_0x26ef('0x40')](handleError(_0x426875,null));};exports['addConfiguration']=function(_0x34530f,_0xc02ed4,_0x5305b6){if(_0x34530f['body']['id']){delete _0x34530f['body']['id'];}return db[_0x26ef('0x29')][_0x26ef('0x4b')]({'where':{'id':_0x34530f[_0x26ef('0x48')]['id']}})[_0x26ef('0x24')](handleEntityNotFound(_0xc02ed4,null))[_0x26ef('0x24')](function(_0x41f8d7){if(_0x41f8d7){_0x34530f[_0x26ef('0x47')][_0x26ef('0x4d')]=_0x41f8d7['id'];_0x34530f[_0x26ef('0x47')][_0x26ef('0x4e')]=integrations[_0x26ef('0x4f')](_0x34530f[_0x26ef('0x47')][_0x26ef('0x50')],_0x34530f[_0x26ef('0x47')][_0x26ef('0x3a')]);_0x34530f[_0x26ef('0x47')][_0x26ef('0x51')]=integrations[_0x26ef('0x52')](_0x34530f[_0x26ef('0x47')][_0x26ef('0x50')],_0x34530f['body']['type']);return db[_0x26ef('0x4c')][_0x26ef('0x46')](_0x34530f['body'],{'include':[{'model':db['VtigerField'],'as':_0x26ef('0x4e')},{'model':db['VtigerField'],'as':_0x26ef('0x51')}]});}return null;})['then'](respondWithResult(_0xc02ed4,null))[_0x26ef('0x40')](handleError(_0xc02ed4,null));};var md5=require(_0x26ef('0x53'));exports[_0x26ef('0x54')]=function(_0x22f5ca,_0x537320,_0x4936a8){var _0x598f7a=null;var _0x4b492c=null;var _0x3213bd=null;var _0x2dfe4e=null;var _0x384aab='';return db[_0x26ef('0x29')]['findOne']({'where':{'id':_0x22f5ca[_0x26ef('0x48')]['id']},'attributes':['id','name',_0x26ef('0x55'),_0x26ef('0x56'),_0x26ef('0x57'),_0x26ef('0x58'),_0x26ef('0x59'),_0x26ef('0x5a')]})[_0x26ef('0x24')](handleEntityNotFound(_0x537320,null))['then'](function(_0x4cf3aa){if(_0x4cf3aa){_0x598f7a=_0x4cf3aa[_0x26ef('0x55')];_0x4b492c=_0x4cf3aa[_0x26ef('0x5a')];_0x3213bd=_0x4cf3aa[_0x26ef('0x57')];_0x384aab=_0x4cf3aa['remoteUri'];var _0x436841=_0x384aab[_0x26ef('0x5b')](-0x1);if(_0x436841==='/'){_0x384aab=_0x384aab[_0x26ef('0x5c')](0x0,_0x384aab[_0x26ef('0x5d')](_0x436841));}_0x2dfe4e=util[_0x26ef('0x5e')](_0x26ef('0x5f'),_0x384aab);var _0x5a8a5f={'method':_0x26ef('0x60'),'uri':_0x2dfe4e,'qs':{'operation':_0x26ef('0x61'),'username':_0x4cf3aa['username']},'json':!![]};return rp(_0x5a8a5f);}})[_0x26ef('0x24')](function(_0xeaa3a9){if(_0xeaa3a9[_0x26ef('0x62')]){var _0x1a447f={'method':'POST','uri':_0x2dfe4e,'form':{'operation':_0x26ef('0x63'),'username':_0x598f7a,'accessKey':md5(_0xeaa3a9['result'][_0x26ef('0x64')]+_0x4b492c)},'json':!![]};return rp(_0x1a447f);}})[_0x26ef('0x24')](function(_0x377a54){if(_0x377a54['success']){var _0x507ac2={'method':'GET','uri':_0x2dfe4e,'qs':{'operation':'describe','username':_0x598f7a,'sessionName':_0x377a54[_0x26ef('0x65')][_0x26ef('0x66')],'elementType':_0x3213bd},'json':!![]};return rp(_0x507ac2);}})[_0x26ef('0x24')](function(_0x1331d7){if(_0x1331d7[_0x26ef('0x62')]){var _0x5d70bf=['autogenerated','reference',_0x26ef('0x67')];_[_0x26ef('0x68')](_0x1331d7['result'][_0x26ef('0x30')],function(_0x137ed6){return _0x5d70bf['includes'](_0x137ed6[_0x26ef('0x3a')][_0x26ef('0x26')]);});_[_0x26ef('0x68')](_0x1331d7[_0x26ef('0x65')]['fields'],function(_0x57aedc){return _0x57aedc[_0x26ef('0x69')]===_0x26ef('0x6a');});return{'count':_0x1331d7[_0x26ef('0x65')][_0x26ef('0x30')][_0x26ef('0x32')],'rows':_[_0x26ef('0x2b')](_0x1331d7[_0x26ef('0x65')][_0x26ef('0x30')],function(_0x2a7619){return{'id':_0x2a7619['name'],'name':_0x2a7619['label'],'custom':_[_0x26ef('0x6b')](_0x2a7619[_0x26ef('0x26')],'cf_')?!![]:![],'options':_0x2a7619[_0x26ef('0x3a')][_0x26ef('0x26')]===_0x26ef('0x6c')&&_0x2a7619[_0x26ef('0x3a')][_0x26ef('0x6d')][_0x26ef('0x32')]>0x0?_[_0x26ef('0x2b')](_0x2a7619[_0x26ef('0x3a')]['picklistValues'],function(_0x31cf23){return{'name':_0x31cf23[_0x26ef('0x6e')],'value':_0x31cf23[_0x26ef('0x6f')]};}):[]};})};}})[_0x26ef('0x24')](respondWithResult(_0x537320,null))['catch'](function(_0x48d8f6){console['log'](_0x26ef('0x70')+_0x48d8f6);var _0x3546a5=_0x22f5ca['query'][_0x26ef('0x71')]?0x1f4:_0x48d8f6[_0x26ef('0x72')]||0x1f4;logger[_0x26ef('0x73')](_0x26ef('0x74'),_0x26ef('0x54'),_0x3546a5,JSON[_0x26ef('0x75')](_0x48d8f6));delete _0x48d8f6[_0x26ef('0x26')];if(_0x3546a5===0x191){_0x3546a5=0x190;}_0x537320[_0x26ef('0x1a')](_0x3546a5)['send'](_0x22f5ca[_0x26ef('0x2c')][_0x26ef('0x71')]?{'message':_0x26ef('0x76'),'statusCode':_0x48d8f6[_0x26ef('0x72')]}:_0x48d8f6);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index 096e6a5..64c4e99 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 _0xb856=['./intVtigerAccount.attributes','define','VtigerAccount','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0xb856,0xcf));var _0x6b85=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb856[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6b85('0x0'));var util=require('util');var logger=require(_0x6b85('0x1'))(_0x6b85('0x2'));var moment=require(_0x6b85('0x3'));var BPromise=require(_0x6b85('0x4'));var rp=require(_0x6b85('0x5'));var fs=require('fs');var path=require(_0x6b85('0x6'));var rimraf=require(_0x6b85('0x7'));var config=require(_0x6b85('0x8'));var attributes=require(_0x6b85('0x9'));var integrations=require('../../components/integrations/configuration');module['exports']=function(_0x4e6d21,_0x41bc2e){return _0x4e6d21[_0x6b85('0xa')](_0x6b85('0xb'),attributes,{'tableName':'int_vtiger_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x17c3=['rimraf','../../config/environment','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','VtigerAccount','int_vtiger_accounts','lodash','../../config/logger','api','moment','request-promise'];(function(_0x3766a2,_0x3f5516){var _0x5b299d=function(_0x5be97a){while(--_0x5be97a){_0x3766a2['push'](_0x3766a2['shift']());}};_0x5b299d(++_0x3f5516);}(_0x17c3,0x1f3));var _0x317c=function(_0x22cdfd,_0x50ed0a){_0x22cdfd=_0x22cdfd-0x0;var _0x578820=_0x17c3[_0x22cdfd];return _0x578820;};'use strict';var _=require(_0x317c('0x0'));var util=require('util');var logger=require(_0x317c('0x1'))(_0x317c('0x2'));var moment=require(_0x317c('0x3'));var BPromise=require('bluebird');var rp=require(_0x317c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x317c('0x5'));var config=require(_0x317c('0x6'));var attributes=require(_0x317c('0x7'));var integrations=require(_0x317c('0x8'));module[_0x317c('0x9')]=function(_0x55a32f,_0x28e98c){return _0x55a32f['define'](_0x317c('0xa'),attributes,{'tableName':_0x317c('0xb'),'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 14a5d85..d71c553 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 _0xee5b=['map','model','attributes','catch','ShowVtigerAccount','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','then','info','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','include'];(function(_0x2ffc5d,_0x564eba){var _0x57f0a=function(_0x44d8fb){while(--_0x44d8fb){_0x2ffc5d['push'](_0x2ffc5d['shift']());}};_0x57f0a(++_0x564eba);}(_0xee5b,0x1f4));var _0xbee5=function(_0x3669da,_0x33f658){_0x3669da=_0x3669da-0x0;var _0x529a69=_0xee5b[_0x3669da];return _0x529a69;};'use strict';var _=require(_0xbee5('0x0'));var util=require('util');var moment=require(_0xbee5('0x1'));var BPromise=require(_0xbee5('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbee5('0x3'));var db=require(_0xbee5('0x4'))['db'];var utils=require(_0xbee5('0x5'));var logger=require(_0xbee5('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0xbee5('0x7'));var client=jayson[_0xbee5('0x8')][_0xbee5('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x804ab8,_0x4f5065,_0x5505e3){return new BPromise(function(_0x53d5b9,_0x5baf5c){return client['request'](_0x804ab8,_0x5505e3)[_0xbee5('0xa')](function(_0x7dda04){logger[_0xbee5('0xb')](_0xbee5('0xc'),_0x4f5065,'request\x20sent');logger[_0xbee5('0xd')](_0xbee5('0xe'),_0x4f5065,_0xbee5('0xf'),JSON[_0xbee5('0x10')](_0x7dda04));if(_0x7dda04[_0xbee5('0x11')]){if(_0x7dda04[_0xbee5('0x11')][_0xbee5('0x12')]===0x1f4){logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error'][_0xbee5('0x13')]);return _0x5baf5c(_0x7dda04['error'][_0xbee5('0x13')]);}logger[_0xbee5('0x11')](_0xbee5('0xc'),_0x4f5065,_0x7dda04['error']['message']);return _0x53d5b9(_0x7dda04[_0xbee5('0x11')]['message']);}else{logger[_0xbee5('0xb')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0xbee5('0xf'));_0x53d5b9(_0x7dda04[_0xbee5('0x14')][_0xbee5('0x13')]);}})['catch'](function(_0x27e034){logger[_0xbee5('0x11')]('VtigerAccount,\x20%s,\x20%s',_0x4f5065,_0x27e034);_0x5baf5c(_0x27e034);});});}exports[_0xbee5('0x15')]=function(_0x538460){var _0x11b4a3=this;return new Promise(function(_0x3c3f4e,_0x35eb5c){return db[_0xbee5('0x16')][_0xbee5('0x17')]({'raw':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')]['attributes']||null:null,'limit':_0x538460['options']?_0x538460[_0xbee5('0x18')]['limit']||null:null,'include':_0x538460[_0xbee5('0x18')]?_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x538460[_0xbee5('0x18')][_0xbee5('0x1b')],function(_0x359ccf){return{'model':db[_0x359ccf[_0xbee5('0x1d')]],'as':_0x359ccf['as'],'attributes':_0x359ccf[_0xbee5('0x1e')],'include':_0x359ccf['include']?_['map'](_0x359ccf['include'],function(_0x519473){return{'model':db[_0x519473['model']],'as':_0x519473['as'],'attributes':_0x519473[_0xbee5('0x1e')],'include':_0x519473[_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x519473[_0xbee5('0x1b')],function(_0x169042){return{'model':db[_0x169042[_0xbee5('0x1d')]],'as':_0x169042['as'],'attributes':_0x169042[_0xbee5('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x36b50f){logger[_0xbee5('0xb')](_0xbee5('0x15'),_0x538460);logger[_0xbee5('0xd')](_0xbee5('0x15'),_0x538460,JSON['stringify'](_0x36b50f));_0x3c3f4e(_0x36b50f);})[_0xbee5('0x1f')](function(_0x15ffb1){logger[_0xbee5('0x11')](_0xbee5('0x15'),_0x15ffb1[_0xbee5('0x13')],_0x538460);_0x35eb5c(_0x11b4a3[_0xbee5('0x11')](0x1f4,_0x15ffb1[_0xbee5('0x13')]));});});};exports[_0xbee5('0x20')]=function(_0x2ccb91){var _0x59c2e4=this;return new Promise(function(_0x22df5f,_0x5b10a6){return db[_0xbee5('0x16')]['find']({'raw':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91['options'][_0xbee5('0x19')]===undefined?!![]:![]:!![],'where':_0x2ccb91['options']?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1a')]||null:null,'attributes':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')]['attributes']||null:null,'include':_0x2ccb91[_0xbee5('0x18')]?_0x2ccb91[_0xbee5('0x18')][_0xbee5('0x1b')]?_[_0xbee5('0x1c')](_0x2ccb91['options'][_0xbee5('0x1b')],function(_0x28f8e3){return{'model':db[_0x28f8e3[_0xbee5('0x1d')]],'as':_0x28f8e3['as'],'attributes':_0x28f8e3[_0xbee5('0x1e')],'include':_0x28f8e3['include']?_[_0xbee5('0x1c')](_0x28f8e3[_0xbee5('0x1b')],function(_0x3e854){return{'model':db[_0x3e854[_0xbee5('0x1d')]],'as':_0x3e854['as'],'attributes':_0x3e854['attributes'],'include':_0x3e854[_0xbee5('0x1b')]?_['map'](_0x3e854[_0xbee5('0x1b')],function(_0x58a2e3){return{'model':db[_0x58a2e3['model']],'as':_0x58a2e3['as'],'attributes':_0x58a2e3['attributes']};}):[]};}):[]};}):[]:[]})[_0xbee5('0xa')](function(_0x315523){logger[_0xbee5('0xb')](_0xbee5('0x20'),_0x2ccb91);logger[_0xbee5('0xd')](_0xbee5('0x20'),_0x2ccb91,JSON[_0xbee5('0x10')](_0x315523));_0x22df5f(_0x315523);})[_0xbee5('0x1f')](function(_0x58452a){logger[_0xbee5('0x11')]('ShowVtigerAccount',_0x58452a[_0xbee5('0x13')],_0x2ccb91);_0x5b10a6(_0x59c2e4[_0xbee5('0x11')](0x1f4,_0x58452a[_0xbee5('0x13')]));});});}; \ No newline at end of file +var _0x9c00=['lodash','util','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','where','attributes','limit','include','model','map','GetVtigerAccount','ShowVtigerAccount','VtigerAccount','raw'];(function(_0x47699a,_0x63064c){var _0x115781=function(_0x3e8b0b){while(--_0x3e8b0b){_0x47699a['push'](_0x47699a['shift']());}};_0x115781(++_0x63064c);}(_0x9c00,0x1a0));var _0x09c0=function(_0x32ab87,_0x5803d0){_0x32ab87=_0x32ab87-0x0;var _0x5ae2b0=_0x9c00[_0x32ab87];return _0x5ae2b0;};'use strict';var _=require(_0x09c0('0x0'));var util=require(_0x09c0('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x09c0('0x2'));var fs=require('fs');var Redis=require(_0x09c0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x09c0('0x4'));var logger=require(_0x09c0('0x5'))(_0x09c0('0x6'));var config=require(_0x09c0('0x7'));var jayson=require(_0x09c0('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x1f3d7e,_0x17d11f,_0x1b633b){return new BPromise(function(_0x3187aa,_0x17cd9d){return client['request'](_0x1f3d7e,_0x1b633b)[_0x09c0('0x9')](function(_0x1c1246){logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,_0x09c0('0xc'));logger[_0x09c0('0xd')](_0x09c0('0xe'),_0x17d11f,_0x09c0('0xc'),JSON[_0x09c0('0xf')](_0x1c1246));if(_0x1c1246[_0x09c0('0x10')]){if(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x11')]===0x1f4){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x17cd9d(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);return _0x3187aa(_0x1c1246[_0x09c0('0x10')][_0x09c0('0x12')]);}else{logger[_0x09c0('0xa')](_0x09c0('0xb'),_0x17d11f,'request\x20sent');_0x3187aa(_0x1c1246['result']['message']);}})[_0x09c0('0x13')](function(_0x11f4b2){logger[_0x09c0('0x10')](_0x09c0('0xb'),_0x17d11f,_0x11f4b2);_0x17cd9d(_0x11f4b2);});});}exports['GetVtigerAccount']=function(_0x2c4440){var _0x4aa8a5=this;return new Promise(function(_0x4c29a7,_0x2c12da){return db['VtigerAccount'][_0x09c0('0x14')]({'raw':_0x2c4440[_0x09c0('0x15')]?_0x2c4440[_0x09c0('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x2c4440[_0x09c0('0x15')]?_0x2c4440[_0x09c0('0x15')][_0x09c0('0x16')]||null:null,'attributes':_0x2c4440[_0x09c0('0x15')]?_0x2c4440[_0x09c0('0x15')][_0x09c0('0x17')]||null:null,'limit':_0x2c4440[_0x09c0('0x15')]?_0x2c4440['options'][_0x09c0('0x18')]||null:null,'include':_0x2c4440[_0x09c0('0x15')]?_0x2c4440[_0x09c0('0x15')][_0x09c0('0x19')]?_['map'](_0x2c4440['options'][_0x09c0('0x19')],function(_0x25fdb5){return{'model':db[_0x25fdb5[_0x09c0('0x1a')]],'as':_0x25fdb5['as'],'attributes':_0x25fdb5[_0x09c0('0x17')],'include':_0x25fdb5['include']?_[_0x09c0('0x1b')](_0x25fdb5[_0x09c0('0x19')],function(_0x56d883){return{'model':db[_0x56d883[_0x09c0('0x1a')]],'as':_0x56d883['as'],'attributes':_0x56d883[_0x09c0('0x17')],'include':_0x56d883[_0x09c0('0x19')]?_[_0x09c0('0x1b')](_0x56d883[_0x09c0('0x19')],function(_0x1d2d9d){return{'model':db[_0x1d2d9d[_0x09c0('0x1a')]],'as':_0x1d2d9d['as'],'attributes':_0x1d2d9d[_0x09c0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x09c0('0x9')](function(_0x1aa80e){logger[_0x09c0('0xa')]('GetVtigerAccount',_0x2c4440);logger[_0x09c0('0xd')](_0x09c0('0x1c'),_0x2c4440,JSON['stringify'](_0x1aa80e));_0x4c29a7(_0x1aa80e);})[_0x09c0('0x13')](function(_0x5aa0b9){logger[_0x09c0('0x10')]('GetVtigerAccount',_0x5aa0b9[_0x09c0('0x12')],_0x2c4440);_0x2c12da(_0x4aa8a5[_0x09c0('0x10')](0x1f4,_0x5aa0b9[_0x09c0('0x12')]));});});};exports[_0x09c0('0x1d')]=function(_0x4e999a){var _0x5478b7=this;return new Promise(function(_0x17c374,_0x38a315){return db[_0x09c0('0x1e')]['find']({'raw':_0x4e999a[_0x09c0('0x15')]?_0x4e999a['options'][_0x09c0('0x1f')]===undefined?!![]:![]:!![],'where':_0x4e999a[_0x09c0('0x15')]?_0x4e999a[_0x09c0('0x15')]['where']||null:null,'attributes':_0x4e999a[_0x09c0('0x15')]?_0x4e999a[_0x09c0('0x15')][_0x09c0('0x17')]||null:null,'include':_0x4e999a[_0x09c0('0x15')]?_0x4e999a[_0x09c0('0x15')][_0x09c0('0x19')]?_[_0x09c0('0x1b')](_0x4e999a['options'][_0x09c0('0x19')],function(_0x2c19be){return{'model':db[_0x2c19be[_0x09c0('0x1a')]],'as':_0x2c19be['as'],'attributes':_0x2c19be[_0x09c0('0x17')],'include':_0x2c19be[_0x09c0('0x19')]?_['map'](_0x2c19be[_0x09c0('0x19')],function(_0x20349e){return{'model':db[_0x20349e[_0x09c0('0x1a')]],'as':_0x20349e['as'],'attributes':_0x20349e[_0x09c0('0x17')],'include':_0x20349e[_0x09c0('0x19')]?_['map'](_0x20349e[_0x09c0('0x19')],function(_0x476537){return{'model':db[_0x476537[_0x09c0('0x1a')]],'as':_0x476537['as'],'attributes':_0x476537[_0x09c0('0x17')]};}):[]};}):[]};}):[]:[]})[_0x09c0('0x9')](function(_0x3e8b74){logger[_0x09c0('0xa')]('ShowVtigerAccount',_0x4e999a);logger[_0x09c0('0xd')](_0x09c0('0x1d'),_0x4e999a,JSON[_0x09c0('0xf')](_0x3e8b74));_0x17c374(_0x3e8b74);})[_0x09c0('0x13')](function(_0x453c23){logger['error']('ShowVtigerAccount',_0x453c23['message'],_0x4e999a);_0x38a315(_0x5478b7['error'](0x1f4,_0x453c23[_0x09c0('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index 193017b..592746a 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 _0x3ee2=['/:id/fields','getFields','/:id/subjects','/:id/descriptions','post','create','update','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../config/environment','./intVtigerConfiguration.controller','get','isAuthenticated','index','/:id','show'];(function(_0x34c18b,_0x1c37f0){var _0x36e91a=function(_0x550eda){while(--_0x550eda){_0x34c18b['push'](_0x34c18b['shift']());}};_0x36e91a(++_0x1c37f0);}(_0x3ee2,0x183));var _0x23ee=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3ee2[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0x23ee('0x0'));var util=require(_0x23ee('0x1'));var path=require(_0x23ee('0x2'));var timeout=require(_0x23ee('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x23ee('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x23ee('0x5'));var controller=require(_0x23ee('0x6'));router[_0x23ee('0x7')]('/',auth[_0x23ee('0x8')](),controller[_0x23ee('0x9')]);router['get'](_0x23ee('0xa'),auth[_0x23ee('0x8')](),controller[_0x23ee('0xb')]);router['get'](_0x23ee('0xc'),auth[_0x23ee('0x8')](),controller[_0x23ee('0xd')]);router[_0x23ee('0x7')](_0x23ee('0xe'),auth[_0x23ee('0x8')](),controller['getSubjects']);router[_0x23ee('0x7')](_0x23ee('0xf'),auth[_0x23ee('0x8')](),controller['getDescriptions']);router[_0x23ee('0x10')]('/',auth[_0x23ee('0x8')](),controller[_0x23ee('0x11')]);router['put'](_0x23ee('0xa'),auth[_0x23ee('0x8')](),controller[_0x23ee('0x12')]);router['delete'](_0x23ee('0xa'),auth[_0x23ee('0x8')](),controller[_0x23ee('0x13')]);module[_0x23ee('0x14')]=router; \ No newline at end of file +var _0x7798=['isAuthenticated','/:id/fields','/:id/subjects','getSubjects','getDescriptions','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intVtigerConfiguration.controller','get','index','/:id'];(function(_0x1efc35,_0x3b043e){var _0x30783d=function(_0x21a78d){while(--_0x21a78d){_0x1efc35['push'](_0x1efc35['shift']());}};_0x30783d(++_0x3b043e);}(_0x7798,0x1ee));var _0x8779=function(_0x2368ea,_0x25a53d){_0x2368ea=_0x2368ea-0x0;var _0x4f27d0=_0x7798[_0x2368ea];return _0x4f27d0;};'use strict';var multer=require(_0x8779('0x0'));var util=require(_0x8779('0x1'));var path=require(_0x8779('0x2'));var timeout=require(_0x8779('0x3'));var express=require('express');var router=express[_0x8779('0x4')]();var fs_extra=require(_0x8779('0x5'));var auth=require(_0x8779('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8779('0x7'));var controller=require(_0x8779('0x8'));router[_0x8779('0x9')]('/',auth['isAuthenticated'](),controller[_0x8779('0xa')]);router[_0x8779('0x9')](_0x8779('0xb'),auth[_0x8779('0xc')](),controller['show']);router['get'](_0x8779('0xd'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x8779('0xe'),auth[_0x8779('0xc')](),controller[_0x8779('0xf')]);router[_0x8779('0x9')]('/:id/descriptions',auth['isAuthenticated'](),controller[_0x8779('0x10')]);router[_0x8779('0x11')]('/',auth['isAuthenticated'](),controller[_0x8779('0x12')]);router['put'](_0x8779('0xb'),auth[_0x8779('0xc')](),controller[_0x8779('0x13')]);router[_0x8779('0x14')](_0x8779('0xb'),auth[_0x8779('0xc')](),controller[_0x8779('0x15')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index b0d754e..0bd8ebc 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 _0xcbd0=['exports','STRING','sequelize'];(function(_0x52b7b9,_0x43ed4b){var _0x5b5d30=function(_0x4a5b9c){while(--_0x4a5b9c){_0x52b7b9['push'](_0x52b7b9['shift']());}};_0x5b5d30(++_0x43ed4b);}(_0xcbd0,0x161));var _0x0cbd=function(_0x38f202,_0x218178){_0x38f202=_0x38f202-0x0;var _0x1af204=_0xcbd0[_0x38f202];return _0x1af204;};'use strict';var Sequelize=require(_0x0cbd('0x0'));module[_0x0cbd('0x1')]={'name':{'type':Sequelize[_0x0cbd('0x2')]},'description':{'type':Sequelize[_0x0cbd('0x2')]}}; \ No newline at end of file +var _0x58f5=['STRING','exports'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x58f5,0x191));var _0x558f=function(_0x517aba,_0x4814e5){_0x517aba=_0x517aba-0x0;var _0x246abe=_0x58f5[_0x517aba];return _0x246abe;};'use strict';var Sequelize=require('sequelize');module[_0x558f('0x0')]={'name':{'type':Sequelize[_0x558f('0x1')]},'description':{'type':Sequelize[_0x558f('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 374c1e3..6f414ae 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 _0x102f=['order','sort','where','pick','merge','type','filter','options','includeAll','findAll','rows','catch','show','params','create','body','find','getFields','findOne','VtigerField','keys','getDescriptions','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','../../mysqldb','json','offset','undefined','count','status','set','Content-Range','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','VtigerConfiguration','rawAttributes','fieldName','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x102f,0x1d2));var _0xf102=function(_0x52fc63,_0x5a2f5e){_0x52fc63=_0x52fc63-0x0;var _0x5183aa=_0x102f[_0x52fc63];return _0x5183aa;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf102('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf102('0x1'));var Mustache=require(_0xf102('0x2'));var util=require(_0xf102('0x3'));var path=require(_0xf102('0x4'));var sox=require('sox');var csv=require(_0xf102('0x5'));var ejs=require(_0xf102('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf102('0x7'));var squel=require(_0xf102('0x8'));var crypto=require(_0xf102('0x9'));var jsforce=require(_0xf102('0xa'));var deskjs=require(_0xf102('0xb'));var toCsv=require(_0xf102('0x5'));var querystring=require(_0xf102('0xc'));var Papa=require(_0xf102('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf102('0xe'));var hardwareService=require(_0xf102('0xf'));var logger=require('../../config/logger')(_0xf102('0x10'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xf102('0x11'));var db=require(_0xf102('0x12'))['db'];function respondWithStatusCode(_0x3b4764,_0x410bbe){_0x410bbe=_0x410bbe||0xcc;return function(_0x48b6a2){if(_0x48b6a2){return _0x3b4764['sendStatus'](_0x410bbe);}return _0x3b4764['status'](_0x410bbe)['end']();};}function respondWithResult(_0x91cc12,_0x4510b8){_0x4510b8=_0x4510b8||0xc8;return function(_0x2ad97e){if(_0x2ad97e){return _0x91cc12['status'](_0x4510b8)[_0xf102('0x13')](_0x2ad97e);}};}function respondWithFilteredResult(_0x439aec,_0x59d6c2){return function(_0xd749c4){if(_0xd749c4){var _0x64357a=typeof _0x59d6c2[_0xf102('0x14')]===_0xf102('0x15')&&typeof _0x59d6c2['limit']===_0xf102('0x15');var _0x1dccab=_0xd749c4[_0xf102('0x16')];var _0x200caa=_0x64357a?0x0:_0x59d6c2[_0xf102('0x14')];var _0x25468d=_0x64357a?_0xd749c4[_0xf102('0x16')]:_0x59d6c2['offset']+_0x59d6c2['limit'];var _0x5a7828;if(_0x25468d>=_0x1dccab){_0x25468d=_0x1dccab;_0x5a7828=0xc8;}else{_0x5a7828=0xce;}_0x439aec[_0xf102('0x17')](_0x5a7828);return _0x439aec[_0xf102('0x18')](_0xf102('0x19'),_0x200caa+'-'+_0x25468d+'/'+_0x1dccab)[_0xf102('0x13')](_0xd749c4);}return null;};}function patchUpdates(_0x4a5b69){return function(_0x2b6421){try{jsonpatch[_0xf102('0x1a')](_0x2b6421,_0x4a5b69,!![]);}catch(_0x4c8d42){return BPromise[_0xf102('0x1b')](_0x4c8d42);}return _0x2b6421['save']();};}function saveUpdates(_0x1373ec,_0x4dd595){return function(_0x395ba6){if(_0x395ba6){return _0x395ba6[_0xf102('0x1c')](_0x1373ec)[_0xf102('0x1d')](function(_0x353a30){return _0x353a30;});}return null;};}function removeEntity(_0x259dbd,_0x556ad0){return function(_0x26be98){if(_0x26be98){return _0x26be98[_0xf102('0x1e')]()[_0xf102('0x1d')](function(){_0x259dbd[_0xf102('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34ca5b,_0x4c745c){return function(_0x2d8116){if(!_0x2d8116){_0x34ca5b[_0xf102('0x1f')](0x194);}return _0x2d8116;};}function handleError(_0x5c7ae7,_0x37c55f){_0x37c55f=_0x37c55f||0x1f4;return function(_0x110d7a){logger[_0xf102('0x20')](_0x110d7a[_0xf102('0x21')]);if(_0x110d7a['name']){delete _0x110d7a[_0xf102('0x22')];}_0x5c7ae7[_0xf102('0x17')](_0x37c55f)[_0xf102('0x23')](_0x110d7a);};}exports[_0xf102('0x24')]=function(_0x29dbd1,_0xe8abfb){var _0x12f7a3={},_0xd6d521={},_0x43e67c={'count':0x0,'rows':[]};var _0x355ce3=_['map'](db[_0xf102('0x25')][_0xf102('0x26')],function(_0x334b2f){return{'name':_0x334b2f[_0xf102('0x27')],'type':_0x334b2f['type'][_0xf102('0x28')]};});_0xd6d521[_0xf102('0x29')]=_[_0xf102('0x2a')](_0x355ce3,_0xf102('0x22'));_0xd6d521[_0xf102('0x2b')]=_['keys'](_0x29dbd1['query']);_0xd6d521[_0xf102('0x2c')]=_[_0xf102('0x2d')](_0xd6d521[_0xf102('0x29')],_0xd6d521['query']);_0x12f7a3[_0xf102('0x2e')]=_['intersection'](_0xd6d521['model'],qs[_0xf102('0x2f')](_0x29dbd1[_0xf102('0x2b')][_0xf102('0x2f')]));_0x12f7a3[_0xf102('0x2e')]=_0x12f7a3['attributes'][_0xf102('0x30')]?_0x12f7a3[_0xf102('0x2e')]:_0xd6d521[_0xf102('0x29')];if(!_0x29dbd1['query'][_0xf102('0x31')](_0xf102('0x32'))){_0x12f7a3[_0xf102('0x33')]=qs['limit'](_0x29dbd1['query']['limit']);_0x12f7a3['offset']=qs[_0xf102('0x14')](_0x29dbd1[_0xf102('0x2b')][_0xf102('0x14')]);}_0x12f7a3[_0xf102('0x34')]=qs[_0xf102('0x35')](_0x29dbd1[_0xf102('0x2b')]['sort']);_0x12f7a3[_0xf102('0x36')]=qs[_0xf102('0x2c')](_[_0xf102('0x37')](_0x29dbd1[_0xf102('0x2b')],_0xd6d521[_0xf102('0x2c')]),_0x355ce3);if(_0x29dbd1['query']['filter']){_0x12f7a3[_0xf102('0x36')]=_[_0xf102('0x38')](_0x12f7a3[_0xf102('0x36')],{'$or':_[_0xf102('0x2a')](_0x355ce3,function(_0x53338b){if(_0x53338b[_0xf102('0x39')]!=='VIRTUAL'){var _0x14842c={};_0x14842c[_0x53338b[_0xf102('0x22')]]={'$like':'%'+_0x29dbd1[_0xf102('0x2b')][_0xf102('0x3a')]+'%'};return _0x14842c;}})});}_0x12f7a3=_[_0xf102('0x38')]({},_0x12f7a3,_0x29dbd1[_0xf102('0x3b')]);var _0x113181={'where':_0x12f7a3[_0xf102('0x36')]};return db[_0xf102('0x25')][_0xf102('0x16')](_0x113181)['then'](function(_0x5a3810){_0x43e67c[_0xf102('0x16')]=_0x5a3810;if(_0x29dbd1[_0xf102('0x2b')][_0xf102('0x3c')]){_0x12f7a3['include']=[{'all':!![]}];}return db['VtigerConfiguration'][_0xf102('0x3d')](_0x12f7a3);})[_0xf102('0x1d')](function(_0x2fdf6f){_0x43e67c[_0xf102('0x3e')]=_0x2fdf6f;return _0x43e67c;})['then'](respondWithFilteredResult(_0xe8abfb,_0x12f7a3))[_0xf102('0x3f')](handleError(_0xe8abfb,null));};exports[_0xf102('0x40')]=function(_0x475dac,_0x17f807){var _0x1857ee={'raw':![],'where':{'id':_0x475dac[_0xf102('0x41')]['id']}},_0x55bf12={};_0x55bf12[_0xf102('0x29')]=_['keys'](db['VtigerConfiguration'][_0xf102('0x26')]);_0x55bf12[_0xf102('0x2b')]=_['keys'](_0x475dac[_0xf102('0x2b')]);_0x55bf12['filters']=_[_0xf102('0x2d')](_0x55bf12['model'],_0x55bf12[_0xf102('0x2b')]);_0x1857ee['attributes']=_[_0xf102('0x2d')](_0x55bf12['model'],qs[_0xf102('0x2f')](_0x475dac[_0xf102('0x2b')]['fields']));_0x1857ee[_0xf102('0x2e')]=_0x1857ee['attributes']['length']?_0x1857ee['attributes']:_0x55bf12[_0xf102('0x29')];if(_0x475dac[_0xf102('0x2b')]['includeAll']){_0x1857ee['include']=[{'all':!![]}];}_0x1857ee=_[_0xf102('0x38')]({},_0x1857ee,_0x475dac[_0xf102('0x3b')]);return db['VtigerConfiguration']['find'](_0x1857ee)['then'](handleEntityNotFound(_0x17f807,null))[_0xf102('0x1d')](respondWithResult(_0x17f807,null))[_0xf102('0x3f')](handleError(_0x17f807,null));};exports['create']=function(_0x1e7f8c,_0x4e0329){return db['VtigerConfiguration'][_0xf102('0x42')](_0x1e7f8c[_0xf102('0x43')],{})[_0xf102('0x1d')](respondWithResult(_0x4e0329,0xc9))[_0xf102('0x3f')](handleError(_0x4e0329,null));};exports['update']=function(_0x147129,_0xb90bc8){if(_0x147129['body']['id']){delete _0x147129['body']['id'];}return db['VtigerConfiguration'][_0xf102('0x44')]({'where':{'id':_0x147129[_0xf102('0x41')]['id']}})[_0xf102('0x1d')](handleEntityNotFound(_0xb90bc8,null))[_0xf102('0x1d')](saveUpdates(_0x147129['body'],null))['then'](respondWithResult(_0xb90bc8,null))[_0xf102('0x3f')](handleError(_0xb90bc8,null));};exports[_0xf102('0x1e')]=function(_0x63b421,_0x350275){return db[_0xf102('0x25')]['find']({'where':{'id':_0x63b421[_0xf102('0x41')]['id']}})['then'](handleEntityNotFound(_0x350275,null))[_0xf102('0x1d')](removeEntity(_0x350275,null))['catch'](handleError(_0x350275,null));};exports[_0xf102('0x45')]=function(_0x12d518,_0x331eab,_0x1b2d10){var _0x4a804d={};var _0xade53e={};var _0x6c3c0c;var _0x3a31ba;return db[_0xf102('0x25')][_0xf102('0x46')]({'where':{'id':_0x12d518['params']['id']}})[_0xf102('0x1d')](handleEntityNotFound(_0x331eab,null))[_0xf102('0x1d')](function(_0x3161ae){if(_0x3161ae){_0x6c3c0c=_0x3161ae;_0xade53e[_0xf102('0x29')]=_['keys'](db[_0xf102('0x47')][_0xf102('0x26')]);_0xade53e[_0xf102('0x2b')]=_[_0xf102('0x48')](_0x12d518[_0xf102('0x2b')]);_0xade53e[_0xf102('0x2c')]=_['intersection'](_0xade53e[_0xf102('0x29')],_0xade53e[_0xf102('0x2b')]);_0x4a804d[_0xf102('0x2e')]=_[_0xf102('0x2d')](_0xade53e[_0xf102('0x29')],qs[_0xf102('0x2f')](_0x12d518[_0xf102('0x2b')][_0xf102('0x2f')]));_0x4a804d[_0xf102('0x2e')]=_0x4a804d[_0xf102('0x2e')][_0xf102('0x30')]?_0x4a804d['attributes']:_0xade53e[_0xf102('0x29')];_0x4a804d[_0xf102('0x34')]=qs[_0xf102('0x35')](_0x12d518[_0xf102('0x2b')][_0xf102('0x35')]);_0x4a804d[_0xf102('0x36')]=qs[_0xf102('0x2c')](_['pick'](_0x12d518[_0xf102('0x2b')],_0xade53e[_0xf102('0x2c')]));if(_0x12d518['query'][_0xf102('0x3a')]){_0x4a804d[_0xf102('0x36')]=_[_0xf102('0x38')](_0x4a804d[_0xf102('0x36')],{'$or':_[_0xf102('0x2a')](_0x4a804d['attributes'],function(_0x5a5dfd){var _0x4738b4={};_0x4738b4[_0x5a5dfd]={'$like':'%'+_0x12d518[_0xf102('0x2b')][_0xf102('0x3a')]+'%'};return _0x4738b4;})});}_0x4a804d=_[_0xf102('0x38')]({},_0x4a804d,_0x12d518[_0xf102('0x3b')]);return _0x6c3c0c['getFields'](_0x4a804d);}})[_0xf102('0x1d')](function(_0x597e5f){if(_0x597e5f){_0x3a31ba=_0x597e5f[_0xf102('0x30')];if(!_0x12d518[_0xf102('0x2b')]['hasOwnProperty'](_0xf102('0x32'))){_0x4a804d[_0xf102('0x33')]=qs['limit'](_0x12d518['query']['limit']);_0x4a804d[_0xf102('0x14')]=qs[_0xf102('0x14')](_0x12d518[_0xf102('0x2b')][_0xf102('0x14')]);}return _0x6c3c0c['getFields'](_0x4a804d);}})[_0xf102('0x1d')](function(_0x7c699a){if(_0x7c699a){return _0x7c699a?{'count':_0x3a31ba,'rows':_0x7c699a}:null;}})['then'](respondWithResult(_0x331eab,null))[_0xf102('0x3f')](handleError(_0x331eab,null));};exports['getSubjects']=function(_0x28ad9b,_0x53417a,_0x319a7a){var _0x43de11={};var _0x34a3b7={};var _0x53dda6;var _0x495678;return db[_0xf102('0x25')]['findOne']({'where':{'id':_0x28ad9b[_0xf102('0x41')]['id']}})[_0xf102('0x1d')](handleEntityNotFound(_0x53417a,null))[_0xf102('0x1d')](function(_0x2124bd){if(_0x2124bd){_0x53dda6=_0x2124bd;_0x34a3b7[_0xf102('0x29')]=_[_0xf102('0x48')](db['VtigerField'][_0xf102('0x26')]);_0x34a3b7[_0xf102('0x2b')]=_[_0xf102('0x48')](_0x28ad9b[_0xf102('0x2b')]);_0x34a3b7[_0xf102('0x2c')]=_[_0xf102('0x2d')](_0x34a3b7[_0xf102('0x29')],_0x34a3b7['query']);_0x43de11[_0xf102('0x2e')]=_[_0xf102('0x2d')](_0x34a3b7['model'],qs[_0xf102('0x2f')](_0x28ad9b[_0xf102('0x2b')]['fields']));_0x43de11[_0xf102('0x2e')]=_0x43de11[_0xf102('0x2e')]['length']?_0x43de11[_0xf102('0x2e')]:_0x34a3b7[_0xf102('0x29')];_0x43de11[_0xf102('0x34')]=qs[_0xf102('0x35')](_0x28ad9b[_0xf102('0x2b')][_0xf102('0x35')]);_0x43de11[_0xf102('0x36')]=qs[_0xf102('0x2c')](_[_0xf102('0x37')](_0x28ad9b['query'],_0x34a3b7[_0xf102('0x2c')]));if(_0x28ad9b[_0xf102('0x2b')][_0xf102('0x3a')]){_0x43de11['where']=_['merge'](_0x43de11[_0xf102('0x36')],{'$or':_[_0xf102('0x2a')](_0x43de11[_0xf102('0x2e')],function(_0x2b30a2){var _0x2c1576={};_0x2c1576[_0x2b30a2]={'$like':'%'+_0x28ad9b[_0xf102('0x2b')][_0xf102('0x3a')]+'%'};return _0x2c1576;})});}_0x43de11=_[_0xf102('0x38')]({},_0x43de11,_0x28ad9b[_0xf102('0x3b')]);return _0x53dda6['getSubjects'](_0x43de11);}})['then'](function(_0x1f7d8e){if(_0x1f7d8e){_0x495678=_0x1f7d8e[_0xf102('0x30')];if(!_0x28ad9b[_0xf102('0x2b')][_0xf102('0x31')](_0xf102('0x32'))){_0x43de11['limit']=qs[_0xf102('0x33')](_0x28ad9b[_0xf102('0x2b')]['limit']);_0x43de11[_0xf102('0x14')]=qs['offset'](_0x28ad9b[_0xf102('0x2b')][_0xf102('0x14')]);}return _0x53dda6['getSubjects'](_0x43de11);}})[_0xf102('0x1d')](function(_0x3eddc9){if(_0x3eddc9){return _0x3eddc9?{'count':_0x495678,'rows':_0x3eddc9}:null;}})['then'](respondWithResult(_0x53417a,null))['catch'](handleError(_0x53417a,null));};exports[_0xf102('0x49')]=function(_0x31f3f7,_0x191100,_0x4cce08){var _0x5142ab={};var _0x20c412={};var _0x6ff74b;var _0x371680;return db[_0xf102('0x25')][_0xf102('0x46')]({'where':{'id':_0x31f3f7[_0xf102('0x41')]['id']}})['then'](handleEntityNotFound(_0x191100,null))[_0xf102('0x1d')](function(_0x4440f9){if(_0x4440f9){_0x6ff74b=_0x4440f9;_0x20c412[_0xf102('0x29')]=_['keys'](db[_0xf102('0x47')][_0xf102('0x26')]);_0x20c412[_0xf102('0x2b')]=_[_0xf102('0x48')](_0x31f3f7[_0xf102('0x2b')]);_0x20c412[_0xf102('0x2c')]=_['intersection'](_0x20c412[_0xf102('0x29')],_0x20c412[_0xf102('0x2b')]);_0x5142ab[_0xf102('0x2e')]=_[_0xf102('0x2d')](_0x20c412[_0xf102('0x29')],qs['fields'](_0x31f3f7['query'][_0xf102('0x2f')]));_0x5142ab['attributes']=_0x5142ab[_0xf102('0x2e')][_0xf102('0x30')]?_0x5142ab['attributes']:_0x20c412[_0xf102('0x29')];_0x5142ab[_0xf102('0x34')]=qs[_0xf102('0x35')](_0x31f3f7[_0xf102('0x2b')][_0xf102('0x35')]);_0x5142ab[_0xf102('0x36')]=qs[_0xf102('0x2c')](_['pick'](_0x31f3f7[_0xf102('0x2b')],_0x20c412['filters']));if(_0x31f3f7[_0xf102('0x2b')]['filter']){_0x5142ab[_0xf102('0x36')]=_[_0xf102('0x38')](_0x5142ab['where'],{'$or':_[_0xf102('0x2a')](_0x5142ab[_0xf102('0x2e')],function(_0x46329a){var _0x2e205e={};_0x2e205e[_0x46329a]={'$like':'%'+_0x31f3f7[_0xf102('0x2b')][_0xf102('0x3a')]+'%'};return _0x2e205e;})});}_0x5142ab=_['merge']({},_0x5142ab,_0x31f3f7[_0xf102('0x3b')]);return _0x6ff74b[_0xf102('0x49')](_0x5142ab);}})[_0xf102('0x1d')](function(_0x2d19cd){if(_0x2d19cd){_0x371680=_0x2d19cd['length'];if(!_0x31f3f7[_0xf102('0x2b')][_0xf102('0x31')](_0xf102('0x32'))){_0x5142ab[_0xf102('0x33')]=qs['limit'](_0x31f3f7[_0xf102('0x2b')][_0xf102('0x33')]);_0x5142ab[_0xf102('0x14')]=qs[_0xf102('0x14')](_0x31f3f7[_0xf102('0x2b')]['offset']);}return _0x6ff74b[_0xf102('0x49')](_0x5142ab);}})[_0xf102('0x1d')](function(_0x55064e){if(_0x55064e){return _0x55064e?{'count':_0x371680,'rows':_0x55064e}:null;}})[_0xf102('0x1d')](respondWithResult(_0x191100,null))[_0xf102('0x3f')](handleError(_0x191100,null));}; \ No newline at end of file +var _0xf73a=['filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','VtigerConfiguration','VtigerField','getFields','getSubjects','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/logger','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','destroy','name','send','rawAttributes','fieldName','type','key','model','query','keys'];(function(_0x65218e,_0x590573){var _0x12b3d2=function(_0x5ef7c6){while(--_0x5ef7c6){_0x65218e['push'](_0x65218e['shift']());}};_0x12b3d2(++_0x590573);}(_0xf73a,0x115));var _0xaf73=function(_0x4248f2,_0x1ae75f){_0x4248f2=_0x4248f2-0x0;var _0x312227=_0xf73a[_0x4248f2];return _0x312227;};'use strict';var emlformat=require(_0xaf73('0x0'));var rimraf=require(_0xaf73('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xaf73('0x2'));var rp=require('request-promise');var moment=require(_0xaf73('0x3'));var BPromise=require(_0xaf73('0x4'));var Mustache=require(_0xaf73('0x5'));var util=require(_0xaf73('0x6'));var path=require(_0xaf73('0x7'));var sox=require(_0xaf73('0x8'));var csv=require(_0xaf73('0x9'));var ejs=require(_0xaf73('0xa'));var fs=require('fs');var fs_extra=require(_0xaf73('0xb'));var _=require(_0xaf73('0xc'));var squel=require(_0xaf73('0xd'));var crypto=require('crypto');var jsforce=require(_0xaf73('0xe'));var deskjs=require(_0xaf73('0xf'));var toCsv=require(_0xaf73('0x9'));var querystring=require(_0xaf73('0x10'));var Papa=require(_0xaf73('0x11'));var Redis=require('ioredis');var authService=require(_0xaf73('0x12'));var qs=require(_0xaf73('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaf73('0x14'))(_0xaf73('0x15'));var utils=require(_0xaf73('0x16'));var config=require(_0xaf73('0x17'));var licenseUtil=require(_0xaf73('0x18'));var db=require(_0xaf73('0x19'))['db'];function respondWithStatusCode(_0x5092af,_0x1c8050){_0x1c8050=_0x1c8050||0xcc;return function(_0xdbb9ec){if(_0xdbb9ec){return _0x5092af[_0xaf73('0x1a')](_0x1c8050);}return _0x5092af[_0xaf73('0x1b')](_0x1c8050)[_0xaf73('0x1c')]();};}function respondWithResult(_0x13e1f7,_0x4c1d8d){_0x4c1d8d=_0x4c1d8d||0xc8;return function(_0x3c1ca8){if(_0x3c1ca8){return _0x13e1f7[_0xaf73('0x1b')](_0x4c1d8d)[_0xaf73('0x1d')](_0x3c1ca8);}};}function respondWithFilteredResult(_0x2818ac,_0x38b8c0){return function(_0x18b01c){if(_0x18b01c){var _0x54fa0e=typeof _0x38b8c0[_0xaf73('0x1e')]===_0xaf73('0x1f')&&typeof _0x38b8c0[_0xaf73('0x20')]===_0xaf73('0x1f');var _0x48c7e7=_0x18b01c[_0xaf73('0x21')];var _0x503cb5=_0x54fa0e?0x0:_0x38b8c0[_0xaf73('0x1e')];var _0x2b04da=_0x54fa0e?_0x18b01c[_0xaf73('0x21')]:_0x38b8c0['offset']+_0x38b8c0[_0xaf73('0x20')];var _0x464792;if(_0x2b04da>=_0x48c7e7){_0x2b04da=_0x48c7e7;_0x464792=0xc8;}else{_0x464792=0xce;}_0x2818ac['status'](_0x464792);return _0x2818ac[_0xaf73('0x22')](_0xaf73('0x23'),_0x503cb5+'-'+_0x2b04da+'/'+_0x48c7e7)[_0xaf73('0x1d')](_0x18b01c);}return null;};}function patchUpdates(_0x2e4f19){return function(_0x4dc39a){try{jsonpatch[_0xaf73('0x24')](_0x4dc39a,_0x2e4f19,!![]);}catch(_0x296381){return BPromise[_0xaf73('0x25')](_0x296381);}return _0x4dc39a[_0xaf73('0x26')]();};}function saveUpdates(_0x5b1827,_0x511c78){return function(_0x5b7a5c){if(_0x5b7a5c){return _0x5b7a5c[_0xaf73('0x27')](_0x5b1827)[_0xaf73('0x28')](function(_0x3a43fe){return _0x3a43fe;});}return null;};}function removeEntity(_0x14d89a,_0x2e7699){return function(_0x3058d3){if(_0x3058d3){return _0x3058d3[_0xaf73('0x29')]()[_0xaf73('0x28')](function(){_0x14d89a[_0xaf73('0x1b')](0xcc)[_0xaf73('0x1c')]();});}};}function handleEntityNotFound(_0x2b82a3,_0x51a0c0){return function(_0x57c078){if(!_0x57c078){_0x2b82a3[_0xaf73('0x1a')](0x194);}return _0x57c078;};}function handleError(_0x687146,_0x53f5f4){_0x53f5f4=_0x53f5f4||0x1f4;return function(_0x124d11){logger['error'](_0x124d11['stack']);if(_0x124d11[_0xaf73('0x2a')]){delete _0x124d11['name'];}_0x687146[_0xaf73('0x1b')](_0x53f5f4)[_0xaf73('0x2b')](_0x124d11);};}exports['index']=function(_0x1216d9,_0x3885f8){var _0x57bfba={},_0x52731c={},_0x3330d3={'count':0x0,'rows':[]};var _0x46877f=_['map'](db['VtigerConfiguration'][_0xaf73('0x2c')],function(_0x16bb0f){return{'name':_0x16bb0f[_0xaf73('0x2d')],'type':_0x16bb0f[_0xaf73('0x2e')][_0xaf73('0x2f')]};});_0x52731c[_0xaf73('0x30')]=_['map'](_0x46877f,_0xaf73('0x2a'));_0x52731c[_0xaf73('0x31')]=_[_0xaf73('0x32')](_0x1216d9[_0xaf73('0x31')]);_0x52731c[_0xaf73('0x33')]=_[_0xaf73('0x34')](_0x52731c[_0xaf73('0x30')],_0x52731c[_0xaf73('0x31')]);_0x57bfba[_0xaf73('0x35')]=_[_0xaf73('0x34')](_0x52731c[_0xaf73('0x30')],qs[_0xaf73('0x36')](_0x1216d9[_0xaf73('0x31')][_0xaf73('0x36')]));_0x57bfba['attributes']=_0x57bfba[_0xaf73('0x35')][_0xaf73('0x37')]?_0x57bfba[_0xaf73('0x35')]:_0x52731c[_0xaf73('0x30')];if(!_0x1216d9[_0xaf73('0x31')][_0xaf73('0x38')](_0xaf73('0x39'))){_0x57bfba[_0xaf73('0x20')]=qs[_0xaf73('0x20')](_0x1216d9[_0xaf73('0x31')]['limit']);_0x57bfba[_0xaf73('0x1e')]=qs[_0xaf73('0x1e')](_0x1216d9[_0xaf73('0x31')][_0xaf73('0x1e')]);}_0x57bfba[_0xaf73('0x3a')]=qs[_0xaf73('0x3b')](_0x1216d9[_0xaf73('0x31')][_0xaf73('0x3b')]);_0x57bfba[_0xaf73('0x3c')]=qs['filters'](_[_0xaf73('0x3d')](_0x1216d9['query'],_0x52731c[_0xaf73('0x33')]),_0x46877f);if(_0x1216d9[_0xaf73('0x31')][_0xaf73('0x3e')]){_0x57bfba[_0xaf73('0x3c')]=_[_0xaf73('0x3f')](_0x57bfba['where'],{'$or':_[_0xaf73('0x40')](_0x46877f,function(_0x4716cb){if(_0x4716cb[_0xaf73('0x2e')]!==_0xaf73('0x41')){var _0x2c59d7={};_0x2c59d7[_0x4716cb['name']]={'$like':'%'+_0x1216d9[_0xaf73('0x31')]['filter']+'%'};return _0x2c59d7;}})});}_0x57bfba=_['merge']({},_0x57bfba,_0x1216d9['options']);var _0x4ad6ef={'where':_0x57bfba[_0xaf73('0x3c')]};return db['VtigerConfiguration']['count'](_0x4ad6ef)['then'](function(_0x525358){_0x3330d3[_0xaf73('0x21')]=_0x525358;if(_0x1216d9[_0xaf73('0x31')][_0xaf73('0x42')]){_0x57bfba[_0xaf73('0x43')]=[{'all':!![]}];}return db['VtigerConfiguration']['findAll'](_0x57bfba);})['then'](function(_0x4dfc04){_0x3330d3[_0xaf73('0x44')]=_0x4dfc04;return _0x3330d3;})[_0xaf73('0x28')](respondWithFilteredResult(_0x3885f8,_0x57bfba))[_0xaf73('0x45')](handleError(_0x3885f8,null));};exports[_0xaf73('0x46')]=function(_0x18da13,_0x5af381){var _0x378877={'raw':![],'where':{'id':_0x18da13[_0xaf73('0x47')]['id']}},_0x370806={};_0x370806[_0xaf73('0x30')]=_[_0xaf73('0x32')](db['VtigerConfiguration'][_0xaf73('0x2c')]);_0x370806[_0xaf73('0x31')]=_[_0xaf73('0x32')](_0x18da13[_0xaf73('0x31')]);_0x370806[_0xaf73('0x33')]=_['intersection'](_0x370806['model'],_0x370806['query']);_0x378877[_0xaf73('0x35')]=_[_0xaf73('0x34')](_0x370806[_0xaf73('0x30')],qs[_0xaf73('0x36')](_0x18da13[_0xaf73('0x31')]['fields']));_0x378877[_0xaf73('0x35')]=_0x378877[_0xaf73('0x35')]['length']?_0x378877['attributes']:_0x370806[_0xaf73('0x30')];if(_0x18da13[_0xaf73('0x31')][_0xaf73('0x42')]){_0x378877[_0xaf73('0x43')]=[{'all':!![]}];}_0x378877=_[_0xaf73('0x3f')]({},_0x378877,_0x18da13[_0xaf73('0x48')]);return db['VtigerConfiguration'][_0xaf73('0x49')](_0x378877)[_0xaf73('0x28')](handleEntityNotFound(_0x5af381,null))['then'](respondWithResult(_0x5af381,null))[_0xaf73('0x45')](handleError(_0x5af381,null));};exports[_0xaf73('0x4a')]=function(_0x58fb5f,_0x38e8bc){return db['VtigerConfiguration'][_0xaf73('0x4a')](_0x58fb5f[_0xaf73('0x4b')],{})['then'](respondWithResult(_0x38e8bc,0xc9))[_0xaf73('0x45')](handleError(_0x38e8bc,null));};exports[_0xaf73('0x27')]=function(_0x495b80,_0x2969c5){if(_0x495b80[_0xaf73('0x4b')]['id']){delete _0x495b80[_0xaf73('0x4b')]['id'];}return db[_0xaf73('0x4c')][_0xaf73('0x49')]({'where':{'id':_0x495b80[_0xaf73('0x47')]['id']}})[_0xaf73('0x28')](handleEntityNotFound(_0x2969c5,null))[_0xaf73('0x28')](saveUpdates(_0x495b80['body'],null))[_0xaf73('0x28')](respondWithResult(_0x2969c5,null))[_0xaf73('0x45')](handleError(_0x2969c5,null));};exports[_0xaf73('0x29')]=function(_0x17838c,_0x5ecc6c){return db[_0xaf73('0x4c')]['find']({'where':{'id':_0x17838c[_0xaf73('0x47')]['id']}})[_0xaf73('0x28')](handleEntityNotFound(_0x5ecc6c,null))[_0xaf73('0x28')](removeEntity(_0x5ecc6c,null))[_0xaf73('0x45')](handleError(_0x5ecc6c,null));};exports['getFields']=function(_0x1bd16a,_0x40be29,_0x129f76){var _0x573de1={};var _0x10b57f={};var _0x16e215;var _0x1d4d3f;return db[_0xaf73('0x4c')]['findOne']({'where':{'id':_0x1bd16a[_0xaf73('0x47')]['id']}})[_0xaf73('0x28')](handleEntityNotFound(_0x40be29,null))[_0xaf73('0x28')](function(_0x719354){if(_0x719354){_0x16e215=_0x719354;_0x10b57f['model']=_[_0xaf73('0x32')](db[_0xaf73('0x4d')][_0xaf73('0x2c')]);_0x10b57f[_0xaf73('0x31')]=_[_0xaf73('0x32')](_0x1bd16a[_0xaf73('0x31')]);_0x10b57f[_0xaf73('0x33')]=_[_0xaf73('0x34')](_0x10b57f[_0xaf73('0x30')],_0x10b57f[_0xaf73('0x31')]);_0x573de1[_0xaf73('0x35')]=_[_0xaf73('0x34')](_0x10b57f['model'],qs[_0xaf73('0x36')](_0x1bd16a[_0xaf73('0x31')][_0xaf73('0x36')]));_0x573de1[_0xaf73('0x35')]=_0x573de1[_0xaf73('0x35')]['length']?_0x573de1[_0xaf73('0x35')]:_0x10b57f[_0xaf73('0x30')];_0x573de1[_0xaf73('0x3a')]=qs[_0xaf73('0x3b')](_0x1bd16a[_0xaf73('0x31')][_0xaf73('0x3b')]);_0x573de1[_0xaf73('0x3c')]=qs[_0xaf73('0x33')](_[_0xaf73('0x3d')](_0x1bd16a[_0xaf73('0x31')],_0x10b57f[_0xaf73('0x33')]));if(_0x1bd16a[_0xaf73('0x31')][_0xaf73('0x3e')]){_0x573de1[_0xaf73('0x3c')]=_['merge'](_0x573de1[_0xaf73('0x3c')],{'$or':_['map'](_0x573de1[_0xaf73('0x35')],function(_0x17ee8b){var _0x318ce7={};_0x318ce7[_0x17ee8b]={'$like':'%'+_0x1bd16a[_0xaf73('0x31')]['filter']+'%'};return _0x318ce7;})});}_0x573de1=_[_0xaf73('0x3f')]({},_0x573de1,_0x1bd16a[_0xaf73('0x48')]);return _0x16e215[_0xaf73('0x4e')](_0x573de1);}})['then'](function(_0x401e6d){if(_0x401e6d){_0x1d4d3f=_0x401e6d[_0xaf73('0x37')];if(!_0x1bd16a['query']['hasOwnProperty'](_0xaf73('0x39'))){_0x573de1[_0xaf73('0x20')]=qs[_0xaf73('0x20')](_0x1bd16a[_0xaf73('0x31')]['limit']);_0x573de1[_0xaf73('0x1e')]=qs['offset'](_0x1bd16a[_0xaf73('0x31')][_0xaf73('0x1e')]);}return _0x16e215[_0xaf73('0x4e')](_0x573de1);}})[_0xaf73('0x28')](function(_0x4f253b){if(_0x4f253b){return _0x4f253b?{'count':_0x1d4d3f,'rows':_0x4f253b}:null;}})[_0xaf73('0x28')](respondWithResult(_0x40be29,null))[_0xaf73('0x45')](handleError(_0x40be29,null));};exports[_0xaf73('0x4f')]=function(_0x86877a,_0x5f6fbd,_0x15cbaa){var _0x3590e6={};var _0x171eaa={};var _0xb89f54;var _0xacd32b;return db['VtigerConfiguration'][_0xaf73('0x50')]({'where':{'id':_0x86877a[_0xaf73('0x47')]['id']}})['then'](handleEntityNotFound(_0x5f6fbd,null))[_0xaf73('0x28')](function(_0x279ad1){if(_0x279ad1){_0xb89f54=_0x279ad1;_0x171eaa[_0xaf73('0x30')]=_['keys'](db[_0xaf73('0x4d')]['rawAttributes']);_0x171eaa[_0xaf73('0x31')]=_['keys'](_0x86877a[_0xaf73('0x31')]);_0x171eaa[_0xaf73('0x33')]=_[_0xaf73('0x34')](_0x171eaa[_0xaf73('0x30')],_0x171eaa[_0xaf73('0x31')]);_0x3590e6[_0xaf73('0x35')]=_['intersection'](_0x171eaa[_0xaf73('0x30')],qs[_0xaf73('0x36')](_0x86877a[_0xaf73('0x31')][_0xaf73('0x36')]));_0x3590e6[_0xaf73('0x35')]=_0x3590e6['attributes'][_0xaf73('0x37')]?_0x3590e6['attributes']:_0x171eaa['model'];_0x3590e6[_0xaf73('0x3a')]=qs[_0xaf73('0x3b')](_0x86877a[_0xaf73('0x31')][_0xaf73('0x3b')]);_0x3590e6[_0xaf73('0x3c')]=qs[_0xaf73('0x33')](_['pick'](_0x86877a[_0xaf73('0x31')],_0x171eaa['filters']));if(_0x86877a['query']['filter']){_0x3590e6[_0xaf73('0x3c')]=_[_0xaf73('0x3f')](_0x3590e6[_0xaf73('0x3c')],{'$or':_[_0xaf73('0x40')](_0x3590e6[_0xaf73('0x35')],function(_0x2fb1bc){var _0x3dd373={};_0x3dd373[_0x2fb1bc]={'$like':'%'+_0x86877a[_0xaf73('0x31')]['filter']+'%'};return _0x3dd373;})});}_0x3590e6=_[_0xaf73('0x3f')]({},_0x3590e6,_0x86877a[_0xaf73('0x48')]);return _0xb89f54[_0xaf73('0x4f')](_0x3590e6);}})[_0xaf73('0x28')](function(_0x40d0e1){if(_0x40d0e1){_0xacd32b=_0x40d0e1['length'];if(!_0x86877a[_0xaf73('0x31')][_0xaf73('0x38')]('nolimit')){_0x3590e6['limit']=qs[_0xaf73('0x20')](_0x86877a[_0xaf73('0x31')][_0xaf73('0x20')]);_0x3590e6[_0xaf73('0x1e')]=qs[_0xaf73('0x1e')](_0x86877a[_0xaf73('0x31')][_0xaf73('0x1e')]);}return _0xb89f54['getSubjects'](_0x3590e6);}})[_0xaf73('0x28')](function(_0x25a3ec){if(_0x25a3ec){return _0x25a3ec?{'count':_0xacd32b,'rows':_0x25a3ec}:null;}})['then'](respondWithResult(_0x5f6fbd,null))['catch'](handleError(_0x5f6fbd,null));};exports[_0xaf73('0x51')]=function(_0x283352,_0xa301bd,_0x13b001){var _0x32637d={};var _0x1c4356={};var _0x344379;var _0x2548f3;return db[_0xaf73('0x4c')][_0xaf73('0x50')]({'where':{'id':_0x283352[_0xaf73('0x47')]['id']}})[_0xaf73('0x28')](handleEntityNotFound(_0xa301bd,null))['then'](function(_0x4e3737){if(_0x4e3737){_0x344379=_0x4e3737;_0x1c4356[_0xaf73('0x30')]=_[_0xaf73('0x32')](db[_0xaf73('0x4d')][_0xaf73('0x2c')]);_0x1c4356[_0xaf73('0x31')]=_[_0xaf73('0x32')](_0x283352[_0xaf73('0x31')]);_0x1c4356['filters']=_['intersection'](_0x1c4356['model'],_0x1c4356['query']);_0x32637d['attributes']=_[_0xaf73('0x34')](_0x1c4356['model'],qs['fields'](_0x283352[_0xaf73('0x31')]['fields']));_0x32637d[_0xaf73('0x35')]=_0x32637d[_0xaf73('0x35')][_0xaf73('0x37')]?_0x32637d[_0xaf73('0x35')]:_0x1c4356['model'];_0x32637d['order']=qs['sort'](_0x283352[_0xaf73('0x31')]['sort']);_0x32637d[_0xaf73('0x3c')]=qs[_0xaf73('0x33')](_[_0xaf73('0x3d')](_0x283352['query'],_0x1c4356[_0xaf73('0x33')]));if(_0x283352[_0xaf73('0x31')][_0xaf73('0x3e')]){_0x32637d['where']=_['merge'](_0x32637d['where'],{'$or':_[_0xaf73('0x40')](_0x32637d[_0xaf73('0x35')],function(_0x8e786a){var _0x1374ec={};_0x1374ec[_0x8e786a]={'$like':'%'+_0x283352[_0xaf73('0x31')][_0xaf73('0x3e')]+'%'};return _0x1374ec;})});}_0x32637d=_[_0xaf73('0x3f')]({},_0x32637d,_0x283352['options']);return _0x344379['getDescriptions'](_0x32637d);}})[_0xaf73('0x28')](function(_0x5b0cf8){if(_0x5b0cf8){_0x2548f3=_0x5b0cf8[_0xaf73('0x37')];if(!_0x283352[_0xaf73('0x31')]['hasOwnProperty']('nolimit')){_0x32637d[_0xaf73('0x20')]=qs[_0xaf73('0x20')](_0x283352[_0xaf73('0x31')]['limit']);_0x32637d[_0xaf73('0x1e')]=qs[_0xaf73('0x1e')](_0x283352[_0xaf73('0x31')][_0xaf73('0x1e')]);}return _0x344379[_0xaf73('0x51')](_0x32637d);}})[_0xaf73('0x28')](function(_0xaafc52){if(_0xaafc52){return _0xaafc52?{'count':_0x2548f3,'rows':_0xaafc52}:null;}})[_0xaf73('0x28')](respondWithResult(_0xa301bd,null))[_0xaf73('0x45')](handleError(_0xa301bd,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index d355968..345bbb0 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 _0xbe24=['../../config/environment','./intVtigerConfiguration.attributes','exports','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger','moment','request-promise','path','rimraf'];(function(_0x33d6b6,_0x1d086a){var _0x3b3251=function(_0x4c8665){while(--_0x4c8665){_0x33d6b6['push'](_0x33d6b6['shift']());}};_0x3b3251(++_0x1d086a);}(_0xbe24,0xd2));var _0x4be2=function(_0x5baf4a,_0x2796d6){_0x5baf4a=_0x5baf4a-0x0;var _0x278b21=_0xbe24[_0x5baf4a];return _0x278b21;};'use strict';var _=require('lodash');var util=require(_0x4be2('0x0'));var logger=require(_0x4be2('0x1'))('api');var moment=require(_0x4be2('0x2'));var BPromise=require('bluebird');var rp=require(_0x4be2('0x3'));var fs=require('fs');var path=require(_0x4be2('0x4'));var rimraf=require(_0x4be2('0x5'));var config=require(_0x4be2('0x6'));var attributes=require(_0x4be2('0x7'));module[_0x4be2('0x8')]=function(_0x39a1d2,_0x20f551){return _0x39a1d2[_0x4be2('0x9')](_0x4be2('0xa'),attributes,{'tableName':_0x4be2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb2ff=['define','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes','exports'];(function(_0x1faa6e,_0x423197){var _0x15fc1d=function(_0x4bd1ac){while(--_0x4bd1ac){_0x1faa6e['push'](_0x1faa6e['shift']());}};_0x15fc1d(++_0x423197);}(_0xb2ff,0x199));var _0xfb2f=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xb2ff[_0xfae23b];return _0x200640;};'use strict';var _=require(_0xfb2f('0x0'));var util=require(_0xfb2f('0x1'));var logger=require(_0xfb2f('0x2'))(_0xfb2f('0x3'));var moment=require('moment');var BPromise=require(_0xfb2f('0x4'));var rp=require(_0xfb2f('0x5'));var fs=require('fs');var path=require(_0xfb2f('0x6'));var rimraf=require(_0xfb2f('0x7'));var config=require(_0xfb2f('0x8'));var attributes=require(_0xfb2f('0x9'));module[_0xfb2f('0xa')]=function(_0x36c57,_0x5a2562){return _0x36c57[_0xfb2f('0xb')]('VtigerConfiguration',attributes,{'tableName':'int_vtiger_configurations','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 7c6b726..60156c1 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 _0xe315=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','VtigerConfiguration,\x20%s,\x20%s','debug','VtigerConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','catch','lodash','util','moment','randomstring'];(function(_0x12505f,_0x2aef5b){var _0x1ce347=function(_0xc3532f){while(--_0xc3532f){_0x12505f['push'](_0x12505f['shift']());}};_0x1ce347(++_0x2aef5b);}(_0xe315,0xe2));var _0x5e31=function(_0x3631a4,_0x1cd1d6){_0x3631a4=_0x3631a4-0x0;var _0x497cf7=_0xe315[_0x3631a4];return _0x497cf7;};'use strict';var _=require(_0x5e31('0x0'));var util=require(_0x5e31('0x1'));var moment=require(_0x5e31('0x2'));var BPromise=require('bluebird');var rs=require(_0x5e31('0x3'));var fs=require('fs');var Redis=require(_0x5e31('0x4'));var db=require(_0x5e31('0x5'))['db'];var utils=require(_0x5e31('0x6'));var logger=require('../../config/logger')(_0x5e31('0x7'));var config=require('../../config/environment');var jayson=require(_0x5e31('0x8'));var client=jayson[_0x5e31('0x9')][_0x5e31('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3dddc3,_0x4a0e1b,_0x1ec528){return new BPromise(function(_0x543703,_0xfd6d53){return client[_0x5e31('0xb')](_0x3dddc3,_0x1ec528)[_0x5e31('0xc')](function(_0x2d5379){logger['info'](_0x5e31('0xd'),_0x4a0e1b,'request\x20sent');logger[_0x5e31('0xe')](_0x5e31('0xf'),_0x4a0e1b,_0x5e31('0x10'),JSON[_0x5e31('0x11')](_0x2d5379));if(_0x2d5379[_0x5e31('0x12')]){if(_0x2d5379[_0x5e31('0x12')][_0x5e31('0x13')]===0x1f4){logger[_0x5e31('0x12')](_0x5e31('0xd'),_0x4a0e1b,_0x2d5379['error'][_0x5e31('0x14')]);return _0xfd6d53(_0x2d5379['error'][_0x5e31('0x14')]);}logger[_0x5e31('0x12')](_0x5e31('0xd'),_0x4a0e1b,_0x2d5379[_0x5e31('0x12')]['message']);return _0x543703(_0x2d5379['error']['message']);}else{logger[_0x5e31('0x15')](_0x5e31('0xd'),_0x4a0e1b,_0x5e31('0x10'));_0x543703(_0x2d5379['result'][_0x5e31('0x14')]);}})[_0x5e31('0x16')](function(_0x223bd8){logger['error'](_0x5e31('0xd'),_0x4a0e1b,_0x223bd8);_0xfd6d53(_0x223bd8);});});} \ No newline at end of file +var _0xaa3e=['debug','error','code','message','result','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x4f9a04,_0xab3315){var _0x4466d5=function(_0x49fcc4){while(--_0x49fcc4){_0x4f9a04['push'](_0x4f9a04['shift']());}};_0x4466d5(++_0xab3315);}(_0xaa3e,0xc2));var _0xeaa3=function(_0x5ddaac,_0x2697a8){_0x5ddaac=_0x5ddaac-0x0;var _0x2a9c58=_0xaa3e[_0x5ddaac];return _0x2a9c58;};'use strict';var _=require(_0xeaa3('0x0'));var util=require(_0xeaa3('0x1'));var moment=require('moment');var BPromise=require(_0xeaa3('0x2'));var rs=require(_0xeaa3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xeaa3('0x4'))['db'];var utils=require(_0xeaa3('0x5'));var logger=require(_0xeaa3('0x6'))(_0xeaa3('0x7'));var config=require(_0xeaa3('0x8'));var jayson=require(_0xeaa3('0x9'));var client=jayson[_0xeaa3('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4e4a47,_0x35ecf0,_0x4103b8){return new BPromise(function(_0x274fae,_0xdeb4ec){return client[_0xeaa3('0xb')](_0x4e4a47,_0x4103b8)[_0xeaa3('0xc')](function(_0x1f48d8){logger[_0xeaa3('0xd')](_0xeaa3('0xe'),_0x35ecf0,_0xeaa3('0xf'));logger[_0xeaa3('0x10')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x35ecf0,_0xeaa3('0xf'),JSON['stringify'](_0x1f48d8));if(_0x1f48d8[_0xeaa3('0x11')]){if(_0x1f48d8[_0xeaa3('0x11')][_0xeaa3('0x12')]===0x1f4){logger[_0xeaa3('0x11')](_0xeaa3('0xe'),_0x35ecf0,_0x1f48d8[_0xeaa3('0x11')][_0xeaa3('0x13')]);return _0xdeb4ec(_0x1f48d8[_0xeaa3('0x11')][_0xeaa3('0x13')]);}logger[_0xeaa3('0x11')](_0xeaa3('0xe'),_0x35ecf0,_0x1f48d8[_0xeaa3('0x11')][_0xeaa3('0x13')]);return _0x274fae(_0x1f48d8[_0xeaa3('0x11')][_0xeaa3('0x13')]);}else{logger[_0xeaa3('0xd')]('VtigerConfiguration,\x20%s,\x20%s',_0x35ecf0,_0xeaa3('0xf'));_0x274fae(_0x1f48d8[_0xeaa3('0x14')][_0xeaa3('0x13')]);}})['catch'](function(_0x5bf84c){logger[_0xeaa3('0x11')]('VtigerConfiguration,\x20%s,\x20%s',_0x35ecf0,_0x5bf84c);_0xdeb4ec(_0x5bf84c);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index 55ed9de..db161e0 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 _0x0119=['get','isAuthenticated','index','/:id','show','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intVtigerField.controller'];(function(_0x51587b,_0xede39e){var _0x57af20=function(_0x504b38){while(--_0x504b38){_0x51587b['push'](_0x51587b['shift']());}};_0x57af20(++_0xede39e);}(_0x0119,0xac));var _0x9011=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x0119[_0x4b055c];return _0x4b62bb;};'use strict';var multer=require('multer');var util=require(_0x9011('0x0'));var path=require(_0x9011('0x1'));var timeout=require(_0x9011('0x2'));var express=require(_0x9011('0x3'));var router=express[_0x9011('0x4')]();var fs_extra=require(_0x9011('0x5'));var auth=require(_0x9011('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9011('0x7'));router[_0x9011('0x8')]('/',auth[_0x9011('0x9')](),controller[_0x9011('0xa')]);router['get'](_0x9011('0xb'),auth[_0x9011('0x9')](),controller[_0x9011('0xc')]);router[_0x9011('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9011('0xe')]('/:id',auth[_0x9011('0x9')](),controller[_0x9011('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x9011('0x10')]);module[_0x9011('0x11')]=router; \ No newline at end of file +var _0xfcc9=['destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','./intVtigerField.controller','get','isAuthenticated','index','/:id','show','post','put','delete'];(function(_0x59a086,_0x57514c){var _0x588ac7=function(_0x122c4e){while(--_0x122c4e){_0x59a086['push'](_0x59a086['shift']());}};_0x588ac7(++_0x57514c);}(_0xfcc9,0x112));var _0x9fcc=function(_0x22c4d7,_0x519ab3){_0x22c4d7=_0x22c4d7-0x0;var _0x2345ec=_0xfcc9[_0x22c4d7];return _0x2345ec;};'use strict';var multer=require(_0x9fcc('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9fcc('0x1'));var express=require('express');var router=express[_0x9fcc('0x2')]();var fs_extra=require(_0x9fcc('0x3'));var auth=require(_0x9fcc('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9fcc('0x5'));router[_0x9fcc('0x6')]('/',auth[_0x9fcc('0x7')](),controller[_0x9fcc('0x8')]);router[_0x9fcc('0x6')](_0x9fcc('0x9'),auth[_0x9fcc('0x7')](),controller[_0x9fcc('0xa')]);router[_0x9fcc('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9fcc('0xc')](_0x9fcc('0x9'),auth['isAuthenticated'](),controller['update']);router[_0x9fcc('0xd')](_0x9fcc('0x9'),auth['isAuthenticated'](),controller[_0x9fcc('0xe')]);module[_0x9fcc('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index eaa08b4..9f6856b 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 _0x4705=['customVariable','BOOLEAN','sequelize','ENUM','variable','keyValue','string','STRING'];(function(_0x5ae8f7,_0x330d91){var _0x54c636=function(_0x173188){while(--_0x173188){_0x5ae8f7['push'](_0x5ae8f7['shift']());}};_0x54c636(++_0x330d91);}(_0x4705,0xf2));var _0x5470=function(_0x25da5,_0xa135f4){_0x25da5=_0x25da5-0x0;var _0x338fd1=_0x4705[_0x25da5];return _0x338fd1;};'use strict';var Sequelize=require(_0x5470('0x0'));module['exports']={'type':{'type':Sequelize[_0x5470('0x1')]('string',_0x5470('0x2'),'customVariable',_0x5470('0x3'),'picklist'),'defaultValue':_0x5470('0x4')},'content':{'type':Sequelize[_0x5470('0x5')]},'key':{'type':Sequelize[_0x5470('0x5')]},'keyType':{'type':Sequelize[_0x5470('0x1')](_0x5470('0x4'),'variable',_0x5470('0x6'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x5470('0x5')]},'nameField':{'type':Sequelize[_0x5470('0x5')]},'customField':{'type':Sequelize[_0x5470('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x454c=['exports','ENUM','variable','customVariable','keyValue','string','STRING','BOOLEAN','sequelize'];(function(_0x2fc98f,_0x4f6aca){var _0x20a4cb=function(_0x5a5271){while(--_0x5a5271){_0x2fc98f['push'](_0x2fc98f['shift']());}};_0x20a4cb(++_0x4f6aca);}(_0x454c,0x13a));var _0xc454=function(_0xe66cf2,_0x32ba5f){_0xe66cf2=_0xe66cf2-0x0;var _0x2d84e7=_0x454c[_0xe66cf2];return _0x2d84e7;};'use strict';var Sequelize=require(_0xc454('0x0'));module[_0xc454('0x1')]={'type':{'type':Sequelize[_0xc454('0x2')]('string',_0xc454('0x3'),_0xc454('0x4'),_0xc454('0x5'),'picklist'),'defaultValue':_0xc454('0x6')},'content':{'type':Sequelize[_0xc454('0x7')]},'key':{'type':Sequelize[_0xc454('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xc454('0x6'),'variable',_0xc454('0x4'))},'keyContent':{'type':Sequelize[_0xc454('0x7')]},'idField':{'type':Sequelize[_0xc454('0x7')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xc454('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc454('0x7')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index c200b35..254556b 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 _0x2d1b=['sort','where','pick','VIRTUAL','filter','merge','include','VtigerField','findAll','catch','show','includeAll','options','find','create','body','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','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','../../mysqldb','end','status','json','offset','undefined','count','limit','Content-Range','reject','save','update','then','destroy','sendStatus','name','send','index','map','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order'];(function(_0x211ae8,_0x3323f6){var _0x13a00a=function(_0xda1015){while(--_0xda1015){_0x211ae8['push'](_0x211ae8['shift']());}};_0x13a00a(++_0x3323f6);}(_0x2d1b,0x1c6));var _0xb2d1=function(_0x57f66e,_0x1d41a0){_0x57f66e=_0x57f66e-0x0;var _0x2c6ba0=_0x2d1b[_0x57f66e];return _0x2c6ba0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb2d1('0x0'));var zipdir=require(_0xb2d1('0x1'));var jsonpatch=require(_0xb2d1('0x2'));var rp=require(_0xb2d1('0x3'));var moment=require(_0xb2d1('0x4'));var BPromise=require(_0xb2d1('0x5'));var Mustache=require(_0xb2d1('0x6'));var util=require('util');var path=require(_0xb2d1('0x7'));var sox=require(_0xb2d1('0x8'));var csv=require(_0xb2d1('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb2d1('0xa'));var _=require('lodash');var squel=require(_0xb2d1('0xb'));var crypto=require('crypto');var jsforce=require(_0xb2d1('0xc'));var deskjs=require(_0xb2d1('0xd'));var toCsv=require(_0xb2d1('0x9'));var querystring=require(_0xb2d1('0xe'));var Papa=require(_0xb2d1('0xf'));var Redis=require(_0xb2d1('0x10'));var authService=require(_0xb2d1('0x11'));var qs=require(_0xb2d1('0x12'));var as=require(_0xb2d1('0x13'));var hardwareService=require(_0xb2d1('0x14'));var logger=require(_0xb2d1('0x15'))(_0xb2d1('0x16'));var utils=require(_0xb2d1('0x17'));var config=require(_0xb2d1('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xb2d1('0x19'))['db'];function respondWithStatusCode(_0x4aa4b8,_0x9d8bd7){_0x9d8bd7=_0x9d8bd7||0xcc;return function(_0x3e192f){if(_0x3e192f){return _0x4aa4b8['sendStatus'](_0x9d8bd7);}return _0x4aa4b8['status'](_0x9d8bd7)[_0xb2d1('0x1a')]();};}function respondWithResult(_0x3876ba,_0x23c6d5){_0x23c6d5=_0x23c6d5||0xc8;return function(_0x5c46db){if(_0x5c46db){return _0x3876ba[_0xb2d1('0x1b')](_0x23c6d5)[_0xb2d1('0x1c')](_0x5c46db);}};}function respondWithFilteredResult(_0x30d020,_0x3959e0){return function(_0x2d1269){if(_0x2d1269){var _0x363e7d=typeof _0x3959e0[_0xb2d1('0x1d')]===_0xb2d1('0x1e')&&typeof _0x3959e0['limit']==='undefined';var _0x307a99=_0x2d1269[_0xb2d1('0x1f')];var _0x238b97=_0x363e7d?0x0:_0x3959e0[_0xb2d1('0x1d')];var _0x236e39=_0x363e7d?_0x2d1269[_0xb2d1('0x1f')]:_0x3959e0[_0xb2d1('0x1d')]+_0x3959e0[_0xb2d1('0x20')];var _0x104fad;if(_0x236e39>=_0x307a99){_0x236e39=_0x307a99;_0x104fad=0xc8;}else{_0x104fad=0xce;}_0x30d020[_0xb2d1('0x1b')](_0x104fad);return _0x30d020['set'](_0xb2d1('0x21'),_0x238b97+'-'+_0x236e39+'/'+_0x307a99)[_0xb2d1('0x1c')](_0x2d1269);}return null;};}function patchUpdates(_0x3c39ba){return function(_0x3505b7){try{jsonpatch['apply'](_0x3505b7,_0x3c39ba,!![]);}catch(_0x5be6a4){return BPromise[_0xb2d1('0x22')](_0x5be6a4);}return _0x3505b7[_0xb2d1('0x23')]();};}function saveUpdates(_0x27ea16,_0xa67a68){return function(_0x5ee18e){if(_0x5ee18e){return _0x5ee18e[_0xb2d1('0x24')](_0x27ea16)[_0xb2d1('0x25')](function(_0x528017){return _0x528017;});}return null;};}function removeEntity(_0x1c0a5c,_0x3a3ee0){return function(_0x40d2df){if(_0x40d2df){return _0x40d2df[_0xb2d1('0x26')]()[_0xb2d1('0x25')](function(){_0x1c0a5c['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f4583,_0x285e34){return function(_0x5284f3){if(!_0x5284f3){_0x1f4583[_0xb2d1('0x27')](0x194);}return _0x5284f3;};}function handleError(_0x477271,_0x248c74){_0x248c74=_0x248c74||0x1f4;return function(_0x189d97){logger['error'](_0x189d97['stack']);if(_0x189d97[_0xb2d1('0x28')]){delete _0x189d97[_0xb2d1('0x28')];}_0x477271['status'](_0x248c74)[_0xb2d1('0x29')](_0x189d97);};}exports[_0xb2d1('0x2a')]=function(_0x4b948e,_0x3ab97a){var _0x5ab5d0={},_0x53fd59={},_0x22246d={'count':0x0,'rows':[]};var _0x115184=_[_0xb2d1('0x2b')](db['VtigerField'][_0xb2d1('0x2c')],function(_0x3db0ab){return{'name':_0x3db0ab['fieldName'],'type':_0x3db0ab[_0xb2d1('0x2d')][_0xb2d1('0x2e')]};});_0x53fd59[_0xb2d1('0x2f')]=_['map'](_0x115184,_0xb2d1('0x28'));_0x53fd59[_0xb2d1('0x30')]=_[_0xb2d1('0x31')](_0x4b948e[_0xb2d1('0x30')]);_0x53fd59[_0xb2d1('0x32')]=_['intersection'](_0x53fd59[_0xb2d1('0x2f')],_0x53fd59['query']);_0x5ab5d0[_0xb2d1('0x33')]=_[_0xb2d1('0x34')](_0x53fd59[_0xb2d1('0x2f')],qs[_0xb2d1('0x35')](_0x4b948e['query'][_0xb2d1('0x35')]));_0x5ab5d0[_0xb2d1('0x33')]=_0x5ab5d0[_0xb2d1('0x33')][_0xb2d1('0x36')]?_0x5ab5d0['attributes']:_0x53fd59[_0xb2d1('0x2f')];if(!_0x4b948e[_0xb2d1('0x30')][_0xb2d1('0x37')]('nolimit')){_0x5ab5d0[_0xb2d1('0x20')]=qs['limit'](_0x4b948e['query'][_0xb2d1('0x20')]);_0x5ab5d0[_0xb2d1('0x1d')]=qs[_0xb2d1('0x1d')](_0x4b948e[_0xb2d1('0x30')][_0xb2d1('0x1d')]);}_0x5ab5d0[_0xb2d1('0x38')]=qs[_0xb2d1('0x39')](_0x4b948e[_0xb2d1('0x30')][_0xb2d1('0x39')]);_0x5ab5d0[_0xb2d1('0x3a')]=qs[_0xb2d1('0x32')](_[_0xb2d1('0x3b')](_0x4b948e['query'],_0x53fd59[_0xb2d1('0x32')]),_0x115184);if(_0x4b948e[_0xb2d1('0x30')]['filter']){_0x5ab5d0[_0xb2d1('0x3a')]=_['merge'](_0x5ab5d0[_0xb2d1('0x3a')],{'$or':_['map'](_0x115184,function(_0x5363a4){if(_0x5363a4[_0xb2d1('0x2d')]!==_0xb2d1('0x3c')){var _0x1617fe={};_0x1617fe[_0x5363a4[_0xb2d1('0x28')]]={'$like':'%'+_0x4b948e[_0xb2d1('0x30')][_0xb2d1('0x3d')]+'%'};return _0x1617fe;}})});}_0x5ab5d0=_[_0xb2d1('0x3e')]({},_0x5ab5d0,_0x4b948e['options']);var _0x3baa57={'where':_0x5ab5d0[_0xb2d1('0x3a')]};return db['VtigerField'][_0xb2d1('0x1f')](_0x3baa57)[_0xb2d1('0x25')](function(_0x4e9443){_0x22246d[_0xb2d1('0x1f')]=_0x4e9443;if(_0x4b948e[_0xb2d1('0x30')]['includeAll']){_0x5ab5d0[_0xb2d1('0x3f')]=[{'all':!![]}];}return db[_0xb2d1('0x40')][_0xb2d1('0x41')](_0x5ab5d0);})[_0xb2d1('0x25')](function(_0x5263ef){_0x22246d['rows']=_0x5263ef;return _0x22246d;})[_0xb2d1('0x25')](respondWithFilteredResult(_0x3ab97a,_0x5ab5d0))[_0xb2d1('0x42')](handleError(_0x3ab97a,null));};exports[_0xb2d1('0x43')]=function(_0x82bbe6,_0x59c5cc){var _0x44f79f={'raw':!![],'where':{'id':_0x82bbe6['params']['id']}},_0x29a1ae={};_0x29a1ae[_0xb2d1('0x2f')]=_[_0xb2d1('0x31')](db[_0xb2d1('0x40')][_0xb2d1('0x2c')]);_0x29a1ae['query']=_[_0xb2d1('0x31')](_0x82bbe6[_0xb2d1('0x30')]);_0x29a1ae[_0xb2d1('0x32')]=_['intersection'](_0x29a1ae[_0xb2d1('0x2f')],_0x29a1ae[_0xb2d1('0x30')]);_0x44f79f[_0xb2d1('0x33')]=_[_0xb2d1('0x34')](_0x29a1ae['model'],qs[_0xb2d1('0x35')](_0x82bbe6[_0xb2d1('0x30')][_0xb2d1('0x35')]));_0x44f79f[_0xb2d1('0x33')]=_0x44f79f[_0xb2d1('0x33')]['length']?_0x44f79f['attributes']:_0x29a1ae[_0xb2d1('0x2f')];if(_0x82bbe6['query'][_0xb2d1('0x44')]){_0x44f79f[_0xb2d1('0x3f')]=[{'all':!![]}];}_0x44f79f=_[_0xb2d1('0x3e')]({},_0x44f79f,_0x82bbe6[_0xb2d1('0x45')]);return db['VtigerField'][_0xb2d1('0x46')](_0x44f79f)[_0xb2d1('0x25')](handleEntityNotFound(_0x59c5cc,null))['then'](respondWithResult(_0x59c5cc,null))[_0xb2d1('0x42')](handleError(_0x59c5cc,null));};exports[_0xb2d1('0x47')]=function(_0x1f73a2,_0x1d26f6){return db[_0xb2d1('0x40')]['create'](_0x1f73a2['body'],{})[_0xb2d1('0x25')](respondWithResult(_0x1d26f6,0xc9))[_0xb2d1('0x42')](handleError(_0x1d26f6,null));};exports[_0xb2d1('0x24')]=function(_0x531fc1,_0x36174a){if(_0x531fc1[_0xb2d1('0x48')]['id']){delete _0x531fc1[_0xb2d1('0x48')]['id'];}return db[_0xb2d1('0x40')]['find']({'where':{'id':_0x531fc1['params']['id']}})['then'](handleEntityNotFound(_0x36174a,null))[_0xb2d1('0x25')](saveUpdates(_0x531fc1[_0xb2d1('0x48')],null))[_0xb2d1('0x25')](respondWithResult(_0x36174a,null))[_0xb2d1('0x42')](handleError(_0x36174a,null));};exports[_0xb2d1('0x26')]=function(_0x11cb05,_0x5add6c){return db[_0xb2d1('0x40')][_0xb2d1('0x46')]({'where':{'id':_0x11cb05['params']['id']}})[_0xb2d1('0x25')](handleEntityNotFound(_0x5add6c,null))[_0xb2d1('0x25')](removeEntity(_0x5add6c,null))['catch'](handleError(_0x5add6c,null));}; \ No newline at end of file +var _0x36f4=['create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','json','offset','count','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','name','send','index','map','VtigerField','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','nolimit','limit','where','pick','filter','merge','VIRTUAL','options','findAll','show','filters','includeAll','include','catch'];(function(_0x35d8f7,_0x39b611){var _0x56c861=function(_0x51a264){while(--_0x51a264){_0x35d8f7['push'](_0x35d8f7['shift']());}};_0x56c861(++_0x39b611);}(_0x36f4,0x94));var _0x436f=function(_0x47755b,_0x5f0af3){_0x47755b=_0x47755b-0x0;var _0x4b3b91=_0x36f4[_0x47755b];return _0x4b3b91;};'use strict';var emlformat=require(_0x436f('0x0'));var rimraf=require(_0x436f('0x1'));var zipdir=require(_0x436f('0x2'));var jsonpatch=require(_0x436f('0x3'));var rp=require('request-promise');var moment=require(_0x436f('0x4'));var BPromise=require(_0x436f('0x5'));var Mustache=require(_0x436f('0x6'));var util=require('util');var path=require(_0x436f('0x7'));var sox=require(_0x436f('0x8'));var csv=require(_0x436f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x436f('0xa'));var squel=require(_0x436f('0xb'));var crypto=require(_0x436f('0xc'));var jsforce=require(_0x436f('0xd'));var deskjs=require(_0x436f('0xe'));var toCsv=require(_0x436f('0x9'));var querystring=require('querystring');var Papa=require(_0x436f('0xf'));var Redis=require(_0x436f('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x436f('0x11'));var as=require(_0x436f('0x12'));var hardwareService=require(_0x436f('0x13'));var logger=require(_0x436f('0x14'))(_0x436f('0x15'));var utils=require(_0x436f('0x16'));var config=require(_0x436f('0x17'));var licenseUtil=require(_0x436f('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x28c4eb,_0x1b9064){_0x1b9064=_0x1b9064||0xcc;return function(_0x182b24){if(_0x182b24){return _0x28c4eb['sendStatus'](_0x1b9064);}return _0x28c4eb['status'](_0x1b9064)['end']();};}function respondWithResult(_0x475356,_0x5befb5){_0x5befb5=_0x5befb5||0xc8;return function(_0x4ee12c){if(_0x4ee12c){return _0x475356[_0x436f('0x19')](_0x5befb5)[_0x436f('0x1a')](_0x4ee12c);}};}function respondWithFilteredResult(_0x57edc7,_0x9f4155){return function(_0x6dcdbe){if(_0x6dcdbe){var _0xdde6c8=typeof _0x9f4155[_0x436f('0x1b')]==='undefined'&&typeof _0x9f4155['limit']==='undefined';var _0x4b4475=_0x6dcdbe[_0x436f('0x1c')];var _0xbcf25d=_0xdde6c8?0x0:_0x9f4155[_0x436f('0x1b')];var _0x4c8925=_0xdde6c8?_0x6dcdbe[_0x436f('0x1c')]:_0x9f4155[_0x436f('0x1b')]+_0x9f4155['limit'];var _0x145f99;if(_0x4c8925>=_0x4b4475){_0x4c8925=_0x4b4475;_0x145f99=0xc8;}else{_0x145f99=0xce;}_0x57edc7['status'](_0x145f99);return _0x57edc7['set'](_0x436f('0x1d'),_0xbcf25d+'-'+_0x4c8925+'/'+_0x4b4475)[_0x436f('0x1a')](_0x6dcdbe);}return null;};}function patchUpdates(_0x18a430){return function(_0x6af82a){try{jsonpatch[_0x436f('0x1e')](_0x6af82a,_0x18a430,!![]);}catch(_0x2cfa67){return BPromise['reject'](_0x2cfa67);}return _0x6af82a[_0x436f('0x1f')]();};}function saveUpdates(_0x1af5a6,_0x22ea20){return function(_0x58570c){if(_0x58570c){return _0x58570c[_0x436f('0x20')](_0x1af5a6)[_0x436f('0x21')](function(_0x5da708){return _0x5da708;});}return null;};}function removeEntity(_0x2dcca1,_0x3c5be4){return function(_0x4245fc){if(_0x4245fc){return _0x4245fc[_0x436f('0x22')]()[_0x436f('0x21')](function(){_0x2dcca1['status'](0xcc)[_0x436f('0x23')]();});}};}function handleEntityNotFound(_0x510a7e,_0x1d430d){return function(_0x11d239){if(!_0x11d239){_0x510a7e[_0x436f('0x24')](0x194);}return _0x11d239;};}function handleError(_0x4283fe,_0x2e564e){_0x2e564e=_0x2e564e||0x1f4;return function(_0x190fb1){logger[_0x436f('0x25')](_0x190fb1['stack']);if(_0x190fb1[_0x436f('0x26')]){delete _0x190fb1[_0x436f('0x26')];}_0x4283fe[_0x436f('0x19')](_0x2e564e)[_0x436f('0x27')](_0x190fb1);};}exports[_0x436f('0x28')]=function(_0x2955d5,_0x5612fa){var _0x5bfcfd={},_0x140bde={},_0xfdae1e={'count':0x0,'rows':[]};var _0x243940=_[_0x436f('0x29')](db[_0x436f('0x2a')][_0x436f('0x2b')],function(_0x47e34d){return{'name':_0x47e34d[_0x436f('0x2c')],'type':_0x47e34d[_0x436f('0x2d')][_0x436f('0x2e')]};});_0x140bde[_0x436f('0x2f')]=_['map'](_0x243940,_0x436f('0x26'));_0x140bde[_0x436f('0x30')]=_[_0x436f('0x31')](_0x2955d5[_0x436f('0x30')]);_0x140bde['filters']=_[_0x436f('0x32')](_0x140bde[_0x436f('0x2f')],_0x140bde[_0x436f('0x30')]);_0x5bfcfd[_0x436f('0x33')]=_['intersection'](_0x140bde[_0x436f('0x2f')],qs[_0x436f('0x34')](_0x2955d5['query'][_0x436f('0x34')]));_0x5bfcfd[_0x436f('0x33')]=_0x5bfcfd[_0x436f('0x33')][_0x436f('0x35')]?_0x5bfcfd[_0x436f('0x33')]:_0x140bde[_0x436f('0x2f')];if(!_0x2955d5[_0x436f('0x30')]['hasOwnProperty'](_0x436f('0x36'))){_0x5bfcfd['limit']=qs[_0x436f('0x37')](_0x2955d5[_0x436f('0x30')]['limit']);_0x5bfcfd[_0x436f('0x1b')]=qs[_0x436f('0x1b')](_0x2955d5[_0x436f('0x30')][_0x436f('0x1b')]);}_0x5bfcfd['order']=qs['sort'](_0x2955d5[_0x436f('0x30')]['sort']);_0x5bfcfd[_0x436f('0x38')]=qs['filters'](_[_0x436f('0x39')](_0x2955d5[_0x436f('0x30')],_0x140bde['filters']),_0x243940);if(_0x2955d5[_0x436f('0x30')][_0x436f('0x3a')]){_0x5bfcfd[_0x436f('0x38')]=_[_0x436f('0x3b')](_0x5bfcfd[_0x436f('0x38')],{'$or':_[_0x436f('0x29')](_0x243940,function(_0x5b80cf){if(_0x5b80cf[_0x436f('0x2d')]!==_0x436f('0x3c')){var _0x40ecf8={};_0x40ecf8[_0x5b80cf[_0x436f('0x26')]]={'$like':'%'+_0x2955d5['query'][_0x436f('0x3a')]+'%'};return _0x40ecf8;}})});}_0x5bfcfd=_['merge']({},_0x5bfcfd,_0x2955d5[_0x436f('0x3d')]);var _0x207dec={'where':_0x5bfcfd[_0x436f('0x38')]};return db[_0x436f('0x2a')][_0x436f('0x1c')](_0x207dec)[_0x436f('0x21')](function(_0x478c25){_0xfdae1e['count']=_0x478c25;if(_0x2955d5[_0x436f('0x30')]['includeAll']){_0x5bfcfd['include']=[{'all':!![]}];}return db[_0x436f('0x2a')][_0x436f('0x3e')](_0x5bfcfd);})[_0x436f('0x21')](function(_0x41ac11){_0xfdae1e['rows']=_0x41ac11;return _0xfdae1e;})[_0x436f('0x21')](respondWithFilteredResult(_0x5612fa,_0x5bfcfd))['catch'](handleError(_0x5612fa,null));};exports[_0x436f('0x3f')]=function(_0x244cd5,_0x3ec9fa){var _0x36d7c5={'raw':!![],'where':{'id':_0x244cd5['params']['id']}},_0x152279={};_0x152279['model']=_[_0x436f('0x31')](db[_0x436f('0x2a')][_0x436f('0x2b')]);_0x152279[_0x436f('0x30')]=_[_0x436f('0x31')](_0x244cd5[_0x436f('0x30')]);_0x152279[_0x436f('0x40')]=_['intersection'](_0x152279[_0x436f('0x2f')],_0x152279[_0x436f('0x30')]);_0x36d7c5['attributes']=_[_0x436f('0x32')](_0x152279['model'],qs[_0x436f('0x34')](_0x244cd5[_0x436f('0x30')]['fields']));_0x36d7c5[_0x436f('0x33')]=_0x36d7c5[_0x436f('0x33')][_0x436f('0x35')]?_0x36d7c5['attributes']:_0x152279[_0x436f('0x2f')];if(_0x244cd5[_0x436f('0x30')][_0x436f('0x41')]){_0x36d7c5[_0x436f('0x42')]=[{'all':!![]}];}_0x36d7c5=_[_0x436f('0x3b')]({},_0x36d7c5,_0x244cd5[_0x436f('0x3d')]);return db[_0x436f('0x2a')]['find'](_0x36d7c5)[_0x436f('0x21')](handleEntityNotFound(_0x3ec9fa,null))[_0x436f('0x21')](respondWithResult(_0x3ec9fa,null))[_0x436f('0x43')](handleError(_0x3ec9fa,null));};exports[_0x436f('0x44')]=function(_0x5a0863,_0xcf0b99){return db['VtigerField'][_0x436f('0x44')](_0x5a0863['body'],{})[_0x436f('0x21')](respondWithResult(_0xcf0b99,0xc9))[_0x436f('0x43')](handleError(_0xcf0b99,null));};exports[_0x436f('0x20')]=function(_0xa6e616,_0x164707){if(_0xa6e616[_0x436f('0x45')]['id']){delete _0xa6e616[_0x436f('0x45')]['id'];}return db[_0x436f('0x2a')][_0x436f('0x46')]({'where':{'id':_0xa6e616[_0x436f('0x47')]['id']}})[_0x436f('0x21')](handleEntityNotFound(_0x164707,null))[_0x436f('0x21')](saveUpdates(_0xa6e616[_0x436f('0x45')],null))['then'](respondWithResult(_0x164707,null))[_0x436f('0x43')](handleError(_0x164707,null));};exports[_0x436f('0x22')]=function(_0x40b3e1,_0x3bd9a4){return db[_0x436f('0x2a')][_0x436f('0x46')]({'where':{'id':_0x40b3e1[_0x436f('0x47')]['id']}})['then'](handleEntityNotFound(_0x3bd9a4,null))[_0x436f('0x21')](removeEntity(_0x3bd9a4,null))[_0x436f('0x43')](handleError(_0x3bd9a4,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index aab2486..3eb438d 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 _0xc0ae=['rimraf','../../config/environment','./intVtigerField.attributes','define','VtigerField','int_vtiger_fields','vtiger_unique_index','idField','FieldId','util','../../config/logger','api','moment','path'];(function(_0xbd7925,_0x2d046b){var _0x213b72=function(_0x2c9784){while(--_0x2c9784){_0xbd7925['push'](_0xbd7925['shift']());}};_0x213b72(++_0x2d046b);}(_0xc0ae,0x79));var _0xec0a=function(_0x55a51c,_0x58b50e){_0x55a51c=_0x55a51c-0x0;var _0x58b552=_0xc0ae[_0x55a51c];return _0x58b552;};'use strict';var _=require('lodash');var util=require(_0xec0a('0x0'));var logger=require(_0xec0a('0x1'))(_0xec0a('0x2'));var moment=require(_0xec0a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xec0a('0x4'));var rimraf=require(_0xec0a('0x5'));var config=require(_0xec0a('0x6'));var attributes=require(_0xec0a('0x7'));module['exports']=function(_0x19a547,_0x7ef763){return _0x19a547[_0xec0a('0x8')](_0xec0a('0x9'),attributes,{'tableName':_0xec0a('0xa'),'paranoid':![],'indexes':[{'name':_0xec0a('0xb'),'fields':[_0xec0a('0xc'),_0xec0a('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb852=['request-promise','path','rimraf','exports','VtigerField','vtiger_unique_index','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x2d75b5,_0x4f2d0b){var _0x2a4fc1=function(_0x1375d4){while(--_0x1375d4){_0x2d75b5['push'](_0x2d75b5['shift']());}};_0x2a4fc1(++_0x4f2d0b);}(_0xb852,0x174));var _0x2b85=function(_0x4c00b1,_0x4e1c30){_0x4c00b1=_0x4c00b1-0x0;var _0x4ce3c0=_0xb852[_0x4c00b1];return _0x4ce3c0;};'use strict';var _=require(_0x2b85('0x0'));var util=require(_0x2b85('0x1'));var logger=require(_0x2b85('0x2'))(_0x2b85('0x3'));var moment=require(_0x2b85('0x4'));var BPromise=require(_0x2b85('0x5'));var rp=require(_0x2b85('0x6'));var fs=require('fs');var path=require(_0x2b85('0x7'));var rimraf=require(_0x2b85('0x8'));var config=require('../../config/environment');var attributes=require('./intVtigerField.attributes');module[_0x2b85('0x9')]=function(_0xbedb3e,_0xae2b50){return _0xbedb3e['define'](_0x2b85('0xa'),attributes,{'tableName':'int_vtiger_fields','paranoid':![],'indexes':[{'name':_0x2b85('0xb'),'fields':[_0x2b85('0xc'),_0x2b85('0xd')],'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 093474e..ef6f4b9 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 _0x3d98=['then','info','request\x20sent','debug','stringify','error','code','VtigerField,\x20%s,\x20%s','message','lodash','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x29587c,_0x5eca05){var _0x377092=function(_0x105812){while(--_0x105812){_0x29587c['push'](_0x29587c['shift']());}};_0x377092(++_0x5eca05);}(_0x3d98,0x149));var _0x83d9=function(_0x3aa6b3,_0x2510f5){_0x3aa6b3=_0x3aa6b3-0x0;var _0x140b00=_0x3d98[_0x3aa6b3];return _0x140b00;};'use strict';var _=require(_0x83d9('0x0'));var util=require('util');var moment=require(_0x83d9('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x83d9('0x2'));var db=require('../../mysqldb')['db'];var utils=require(_0x83d9('0x3'));var logger=require(_0x83d9('0x4'))(_0x83d9('0x5'));var config=require(_0x83d9('0x6'));var jayson=require(_0x83d9('0x7'));var client=jayson[_0x83d9('0x8')][_0x83d9('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x53997f,_0x36aa52,_0x2c79c5){return new BPromise(function(_0x5f4ce9,_0x2f3702){return client[_0x83d9('0xa')](_0x53997f,_0x2c79c5)[_0x83d9('0xb')](function(_0x3d7185){logger[_0x83d9('0xc')]('VtigerField,\x20%s,\x20%s',_0x36aa52,_0x83d9('0xd'));logger[_0x83d9('0xe')]('VtigerField,\x20%s,\x20%s,\x20%s',_0x36aa52,_0x83d9('0xd'),JSON[_0x83d9('0xf')](_0x3d7185));if(_0x3d7185['error']){if(_0x3d7185[_0x83d9('0x10')][_0x83d9('0x11')]===0x1f4){logger['error'](_0x83d9('0x12'),_0x36aa52,_0x3d7185['error'][_0x83d9('0x13')]);return _0x2f3702(_0x3d7185[_0x83d9('0x10')]['message']);}logger['error'](_0x83d9('0x12'),_0x36aa52,_0x3d7185['error']['message']);return _0x5f4ce9(_0x3d7185['error'][_0x83d9('0x13')]);}else{logger[_0x83d9('0xc')]('VtigerField,\x20%s,\x20%s',_0x36aa52,_0x83d9('0xd'));_0x5f4ce9(_0x3d7185['result'][_0x83d9('0x13')]);}})['catch'](function(_0xa8c8ee){logger['error'](_0x83d9('0x12'),_0x36aa52,_0xa8c8ee);_0x2f3702(_0xa8c8ee);});});} \ No newline at end of file +var _0xbb7e=['VtigerField,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent'];(function(_0x43359f,_0x415004){var _0x515e24=function(_0xfca97c){while(--_0xfca97c){_0x43359f['push'](_0x43359f['shift']());}};_0x515e24(++_0x415004);}(_0xbb7e,0x1be));var _0xebb7=function(_0x3467e4,_0x538832){_0x3467e4=_0x3467e4-0x0;var _0x32e1fb=_0xbb7e[_0x3467e4];return _0x32e1fb;};'use strict';var _=require(_0xebb7('0x0'));var util=require(_0xebb7('0x1'));var moment=require(_0xebb7('0x2'));var BPromise=require(_0xebb7('0x3'));var rs=require(_0xebb7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xebb7('0x5'))['db'];var utils=require(_0xebb7('0x6'));var logger=require('../../config/logger')(_0xebb7('0x7'));var config=require(_0xebb7('0x8'));var jayson=require(_0xebb7('0x9'));var client=jayson[_0xebb7('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x454ce5,_0x5920b3,_0x16e777){return new BPromise(function(_0xf02e76,_0x473c5a){return client[_0xebb7('0xb')](_0x454ce5,_0x16e777)[_0xebb7('0xc')](function(_0x3ef417){logger[_0xebb7('0xd')](_0xebb7('0xe'),_0x5920b3,_0xebb7('0xf'));logger['debug'](_0xebb7('0x10'),_0x5920b3,'request\x20sent',JSON['stringify'](_0x3ef417));if(_0x3ef417['error']){if(_0x3ef417['error'][_0xebb7('0x11')]===0x1f4){logger['error'](_0xebb7('0xe'),_0x5920b3,_0x3ef417[_0xebb7('0x12')][_0xebb7('0x13')]);return _0x473c5a(_0x3ef417[_0xebb7('0x12')][_0xebb7('0x13')]);}logger['error'](_0xebb7('0xe'),_0x5920b3,_0x3ef417[_0xebb7('0x12')][_0xebb7('0x13')]);return _0xf02e76(_0x3ef417['error'][_0xebb7('0x13')]);}else{logger['info'](_0xebb7('0xe'),_0x5920b3,'request\x20sent');_0xf02e76(_0x3ef417[_0xebb7('0x14')][_0xebb7('0x13')]);}})[_0xebb7('0x15')](function(_0x3847ee){logger['error']('VtigerField,\x20%s,\x20%s',_0x5920b3,_0x3847ee);_0x473c5a(_0x3847ee);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index 62e4643..738e13f 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 _0xad05=['multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','update','delete','destroy','exports'];(function(_0x370762,_0x2fb19b){var _0x4d1ee9=function(_0x2f62e9){while(--_0x2f62e9){_0x370762['push'](_0x370762['shift']());}};_0x4d1ee9(++_0x2fb19b);}(_0xad05,0x96));var _0x5ad0=function(_0xe896bf,_0x4f8e5e){_0xe896bf=_0xe896bf-0x0;var _0x4c7a8a=_0xad05[_0xe896bf];return _0x4c7a8a;};'use strict';var multer=require(_0x5ad0('0x0'));var util=require(_0x5ad0('0x1'));var path=require(_0x5ad0('0x2'));var timeout=require('connect-timeout');var express=require(_0x5ad0('0x3'));var router=express[_0x5ad0('0x4')]();var fs_extra=require(_0x5ad0('0x5'));var auth=require(_0x5ad0('0x6'));var interaction=require(_0x5ad0('0x7'));var config=require('../../config/environment');var controller=require(_0x5ad0('0x8'));router[_0x5ad0('0x9')]('/',auth[_0x5ad0('0xa')](),controller[_0x5ad0('0xb')]);router[_0x5ad0('0x9')](_0x5ad0('0xc'),auth[_0x5ad0('0xa')](),controller[_0x5ad0('0xd')]);router['get'](_0x5ad0('0xe'),auth['isAuthenticated'](),controller[_0x5ad0('0xf')]);router[_0x5ad0('0x9')](_0x5ad0('0x10'),auth['isAuthenticated'](),controller[_0x5ad0('0x11')]);router[_0x5ad0('0x12')]('/',auth[_0x5ad0('0xa')](),controller[_0x5ad0('0x13')]);router[_0x5ad0('0x12')](_0x5ad0('0xe'),auth[_0x5ad0('0xa')](),controller['addConfiguration']);router[_0x5ad0('0x14')](_0x5ad0('0xc'),auth[_0x5ad0('0xa')](),controller[_0x5ad0('0x15')]);router[_0x5ad0('0x16')](_0x5ad0('0xc'),auth[_0x5ad0('0xa')](),controller[_0x5ad0('0x17')]);module[_0x5ad0('0x18')]=router; \ No newline at end of file +var _0x4475=['/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x383d62,_0x439cdf){var _0x533de6=function(_0x34fa29){while(--_0x34fa29){_0x383d62['push'](_0x383d62['shift']());}};_0x533de6(++_0x439cdf);}(_0x4475,0x1ec));var _0x5447=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x4475[_0x432682];return _0x463d05;};'use strict';var multer=require(_0x5447('0x0'));var util=require(_0x5447('0x1'));var path=require(_0x5447('0x2'));var timeout=require(_0x5447('0x3'));var express=require(_0x5447('0x4'));var router=express[_0x5447('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5447('0x6'));var interaction=require(_0x5447('0x7'));var config=require(_0x5447('0x8'));var controller=require('./intZendeskAccount.controller');router[_0x5447('0x9')]('/',auth[_0x5447('0xa')](),controller[_0x5447('0xb')]);router[_0x5447('0x9')]('/:id',auth[_0x5447('0xa')](),controller['show']);router['get'](_0x5447('0xc'),auth[_0x5447('0xa')](),controller[_0x5447('0xd')]);router[_0x5447('0x9')](_0x5447('0xe'),auth[_0x5447('0xa')](),controller[_0x5447('0xf')]);router[_0x5447('0x10')]('/',auth[_0x5447('0xa')](),controller[_0x5447('0x11')]);router[_0x5447('0x10')](_0x5447('0xc'),auth[_0x5447('0xa')](),controller['addConfiguration']);router[_0x5447('0x12')](_0x5447('0x13'),auth[_0x5447('0xa')](),controller[_0x5447('0x14')]);router[_0x5447('0x15')](_0x5447('0x13'),auth['isAuthenticated'](),controller[_0x5447('0x16')]);module[_0x5447('0x17')]=router; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.attributes.js b/server/api/intZendeskAccount/intZendeskAccount.attributes.js index 4f074e3..2ec0e5c 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 _0x9fd4=['password','token','integrationTab','newTab','sequelize','exports','STRING','username'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x9fd4,0x16c));var _0x49fd=function(_0x5a9141,_0x2ccd7f){_0x5a9141=_0x5a9141-0x0;var _0x1a18a8=_0x9fd4[_0x5a9141];return _0x1a18a8;};'use strict';var Sequelize=require(_0x49fd('0x0'));module[_0x49fd('0x1')]={'name':{'type':Sequelize[_0x49fd('0x2')]},'description':{'type':Sequelize[_0x49fd('0x2')]},'username':{'type':Sequelize[_0x49fd('0x2')],'unique':_0x49fd('0x3')},'password':{'type':Sequelize[_0x49fd('0x2')]},'token':{'type':Sequelize[_0x49fd('0x2')]},'remoteUri':{'type':Sequelize[_0x49fd('0x2')],'unique':'remoteUri'},'authType':{'type':Sequelize['ENUM'](_0x49fd('0x4'),_0x49fd('0x5')),'defaultValue':_0x49fd('0x4')},'serverUrl':{'type':Sequelize[_0x49fd('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x49fd('0x6'),_0x49fd('0x7')),'defaultValue':_0x49fd('0x6')}}; \ No newline at end of file +var _0x7096=['username','remoteUri','ENUM','password','token','integrationTab','newTab','exports','STRING'];(function(_0x43a520,_0x518e22){var _0x1694da=function(_0x34f1da){while(--_0x34f1da){_0x43a520['push'](_0x43a520['shift']());}};_0x1694da(++_0x518e22);}(_0x7096,0x10c));var _0x6709=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x7096[_0x5c351c];return _0x26f3b3;};'use strict';var Sequelize=require('sequelize');module[_0x6709('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6709('0x1')]},'username':{'type':Sequelize['STRING'],'unique':_0x6709('0x2')},'password':{'type':Sequelize[_0x6709('0x1')]},'token':{'type':Sequelize[_0x6709('0x1')]},'remoteUri':{'type':Sequelize[_0x6709('0x1')],'unique':_0x6709('0x3')},'authType':{'type':Sequelize[_0x6709('0x4')](_0x6709('0x5'),_0x6709('0x6')),'defaultValue':_0x6709('0x5')},'serverUrl':{'type':Sequelize[_0x6709('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x6709('0x4')](_0x6709('0x7'),_0x6709('0x8')),'defaultValue':'integrationTab'}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 1727b87..7a70dc0 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 _0x373d=['ZendeskField','username','password','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','headers','Basic\x20%s','%s:%s','base64','toString','Sequelize','ValidationError','Unknown\x20authentication\x20type','description','remove','includes','position','title','system_field_options','custom_field_options','test','stringify','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','ZendeskAccount','rows','catch','show','keys','rawAttributes','find','create','body','params','findOne','options','getConfigurations','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions'];(function(_0x37cd56,_0x49d747){var _0x497e08=function(_0x2deb2d){while(--_0x2deb2d){_0x37cd56['push'](_0x37cd56['shift']());}};_0x497e08(++_0x49d747);}(_0x373d,0x1e2));var _0xd373=function(_0x4b7b81,_0x5da698){_0x4b7b81=_0x4b7b81-0x0;var _0x1e65de=_0x373d[_0x4b7b81];return _0x1e65de;};'use strict';var emlformat=require(_0xd373('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd373('0x1'));var jsonpatch=require(_0xd373('0x2'));var rp=require(_0xd373('0x3'));var moment=require(_0xd373('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd373('0x5'));var util=require(_0xd373('0x6'));var path=require(_0xd373('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xd373('0x8'));var fs=require('fs');var fs_extra=require(_0xd373('0x9'));var _=require(_0xd373('0xa'));var squel=require(_0xd373('0xb'));var crypto=require('crypto');var jsforce=require(_0xd373('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xd373('0xd'));var Redis=require(_0xd373('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd373('0xf'));var as=require(_0xd373('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd373('0x11'));var utils=require(_0xd373('0x12'));var config=require(_0xd373('0x13'));var licenseUtil=require(_0xd373('0x14'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x5ab89c,_0xcd9b8c){_0xcd9b8c=_0xcd9b8c||0xcc;return function(_0x14a0ee){if(_0x14a0ee){return _0x5ab89c['sendStatus'](_0xcd9b8c);}return _0x5ab89c[_0xd373('0x15')](_0xcd9b8c)[_0xd373('0x16')]();};}function respondWithResult(_0x27c161,_0x23ed86){_0x23ed86=_0x23ed86||0xc8;return function(_0x28b2bf){if(_0x28b2bf){return _0x27c161[_0xd373('0x15')](_0x23ed86)[_0xd373('0x17')](_0x28b2bf);}};}function respondWithFilteredResult(_0x2eacb1,_0x5a286a){return function(_0x2c5854){if(_0x2c5854){var _0x3a5316=typeof _0x5a286a[_0xd373('0x18')]===_0xd373('0x19')&&typeof _0x5a286a['limit']===_0xd373('0x19');var _0x5eab00=_0x2c5854[_0xd373('0x1a')];var _0x36d47a=_0x3a5316?0x0:_0x5a286a['offset'];var _0x1bbdbd=_0x3a5316?_0x2c5854['count']:_0x5a286a['offset']+_0x5a286a[_0xd373('0x1b')];var _0x186fdd;if(_0x1bbdbd>=_0x5eab00){_0x1bbdbd=_0x5eab00;_0x186fdd=0xc8;}else{_0x186fdd=0xce;}_0x2eacb1[_0xd373('0x15')](_0x186fdd);return _0x2eacb1[_0xd373('0x1c')](_0xd373('0x1d'),_0x36d47a+'-'+_0x1bbdbd+'/'+_0x5eab00)[_0xd373('0x17')](_0x2c5854);}return null;};}function patchUpdates(_0x4ba510){return function(_0x18b681){try{jsonpatch[_0xd373('0x1e')](_0x18b681,_0x4ba510,!![]);}catch(_0x1378a0){return BPromise[_0xd373('0x1f')](_0x1378a0);}return _0x18b681[_0xd373('0x20')]();};}function saveUpdates(_0x3aa1c5,_0x4f64bd){return function(_0x355fca){if(_0x355fca){return _0x355fca[_0xd373('0x21')](_0x3aa1c5)[_0xd373('0x22')](function(_0x209ca7){return _0x209ca7;});}return null;};}function removeEntity(_0x217ee7,_0x238ffd){return function(_0x466a03){if(_0x466a03){return _0x466a03[_0xd373('0x23')]()[_0xd373('0x22')](function(){_0x217ee7[_0xd373('0x15')](0xcc)[_0xd373('0x16')]();});}};}function handleEntityNotFound(_0x34f05a,_0x388182){return function(_0x420a30){if(!_0x420a30){_0x34f05a[_0xd373('0x24')](0x194);}return _0x420a30;};}function handleError(_0x38ba50,_0x50b987){_0x50b987=_0x50b987||0x1f4;return function(_0x13a012){logger[_0xd373('0x25')](_0x13a012[_0xd373('0x26')]);if(_0x13a012[_0xd373('0x27')]){delete _0x13a012[_0xd373('0x27')];}_0x38ba50[_0xd373('0x15')](_0x50b987)[_0xd373('0x28')](_0x13a012);};}exports[_0xd373('0x29')]=function(_0x2869e5,_0x158825){var _0xbc420b={},_0x2ee37c={},_0x7dad3e={'count':0x0,'rows':[]};var _0x5287e7=_[_0xd373('0x2a')](db['ZendeskAccount']['rawAttributes'],function(_0xedc8f3){return{'name':_0xedc8f3[_0xd373('0x2b')],'type':_0xedc8f3[_0xd373('0x2c')][_0xd373('0x2d')]};});_0x2ee37c[_0xd373('0x2e')]=_['map'](_0x5287e7,_0xd373('0x27'));_0x2ee37c[_0xd373('0x2f')]=_['keys'](_0x2869e5[_0xd373('0x2f')]);_0x2ee37c[_0xd373('0x30')]=_[_0xd373('0x31')](_0x2ee37c[_0xd373('0x2e')],_0x2ee37c[_0xd373('0x2f')]);_0xbc420b[_0xd373('0x32')]=_[_0xd373('0x31')](_0x2ee37c[_0xd373('0x2e')],qs[_0xd373('0x33')](_0x2869e5['query'][_0xd373('0x33')]));_0xbc420b[_0xd373('0x32')]=_0xbc420b[_0xd373('0x32')][_0xd373('0x34')]?_0xbc420b[_0xd373('0x32')]:_0x2ee37c[_0xd373('0x2e')];if(!_0x2869e5[_0xd373('0x2f')][_0xd373('0x35')](_0xd373('0x36'))){_0xbc420b[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0x2869e5[_0xd373('0x2f')][_0xd373('0x1b')]);_0xbc420b[_0xd373('0x18')]=qs[_0xd373('0x18')](_0x2869e5['query'][_0xd373('0x18')]);}_0xbc420b[_0xd373('0x37')]=qs[_0xd373('0x38')](_0x2869e5[_0xd373('0x2f')]['sort']);_0xbc420b[_0xd373('0x39')]=qs[_0xd373('0x30')](_[_0xd373('0x3a')](_0x2869e5[_0xd373('0x2f')],_0x2ee37c[_0xd373('0x30')]),_0x5287e7);if(_0x2869e5[_0xd373('0x2f')]['filter']){_0xbc420b['where']=_[_0xd373('0x3b')](_0xbc420b['where'],{'$or':_[_0xd373('0x2a')](_0x5287e7,function(_0xe19d5b){if(_0xe19d5b[_0xd373('0x2c')]!=='VIRTUAL'){var _0x287136={};_0x287136[_0xe19d5b[_0xd373('0x27')]]={'$like':'%'+_0x2869e5[_0xd373('0x2f')][_0xd373('0x3c')]+'%'};return _0x287136;}})});}_0xbc420b=_['merge']({},_0xbc420b,_0x2869e5['options']);var _0x5de74e={'where':_0xbc420b[_0xd373('0x39')]};return db['ZendeskAccount'][_0xd373('0x1a')](_0x5de74e)[_0xd373('0x22')](function(_0x4e5e80){_0x7dad3e['count']=_0x4e5e80;if(_0x2869e5['query'][_0xd373('0x3d')]){_0xbc420b[_0xd373('0x3e')]=[{'all':!![]}];}return db[_0xd373('0x3f')]['findAll'](_0xbc420b);})['then'](function(_0xb87e16){_0x7dad3e[_0xd373('0x40')]=_0xb87e16;return _0x7dad3e;})['then'](respondWithFilteredResult(_0x158825,_0xbc420b))[_0xd373('0x41')](handleError(_0x158825,null));};exports[_0xd373('0x42')]=function(_0x1e3de1,_0x9989e4){var _0x2d8c7d={'raw':![],'where':{'id':_0x1e3de1['params']['id']}},_0x4e8bc6={};_0x4e8bc6[_0xd373('0x2e')]=_[_0xd373('0x43')](db[_0xd373('0x3f')][_0xd373('0x44')]);_0x4e8bc6['query']=_[_0xd373('0x43')](_0x1e3de1['query']);_0x4e8bc6[_0xd373('0x30')]=_[_0xd373('0x31')](_0x4e8bc6[_0xd373('0x2e')],_0x4e8bc6[_0xd373('0x2f')]);_0x2d8c7d[_0xd373('0x32')]=_['intersection'](_0x4e8bc6[_0xd373('0x2e')],qs[_0xd373('0x33')](_0x1e3de1['query'][_0xd373('0x33')]));_0x2d8c7d[_0xd373('0x32')]=_0x2d8c7d[_0xd373('0x32')][_0xd373('0x34')]?_0x2d8c7d[_0xd373('0x32')]:_0x4e8bc6[_0xd373('0x2e')];if(_0x1e3de1[_0xd373('0x2f')][_0xd373('0x3d')]){_0x2d8c7d[_0xd373('0x3e')]=[{'all':!![]}];}_0x2d8c7d=_[_0xd373('0x3b')]({},_0x2d8c7d,_0x1e3de1['options']);return db['ZendeskAccount'][_0xd373('0x45')](_0x2d8c7d)['then'](handleEntityNotFound(_0x9989e4,null))[_0xd373('0x22')](respondWithResult(_0x9989e4,null))['catch'](handleError(_0x9989e4,null));};exports['create']=function(_0x5cbc16,_0x280598){return db[_0xd373('0x3f')][_0xd373('0x46')](_0x5cbc16[_0xd373('0x47')],{})[_0xd373('0x22')](respondWithResult(_0x280598,0xc9))[_0xd373('0x41')](handleError(_0x280598,null));};exports[_0xd373('0x21')]=function(_0x4d1088,_0x28ec3e){if(_0x4d1088['body']['id']){delete _0x4d1088[_0xd373('0x47')]['id'];}return db[_0xd373('0x3f')]['find']({'where':{'id':_0x4d1088[_0xd373('0x48')]['id']}})['then'](handleEntityNotFound(_0x28ec3e,null))[_0xd373('0x22')](saveUpdates(_0x4d1088[_0xd373('0x47')],null))[_0xd373('0x22')](respondWithResult(_0x28ec3e,null))[_0xd373('0x41')](handleError(_0x28ec3e,null));};exports[_0xd373('0x23')]=function(_0x4bc631,_0x4971a0){return db['ZendeskAccount'][_0xd373('0x45')]({'where':{'id':_0x4bc631[_0xd373('0x48')]['id']}})['then'](handleEntityNotFound(_0x4971a0,null))[_0xd373('0x22')](removeEntity(_0x4971a0,null))[_0xd373('0x41')](handleError(_0x4971a0,null));};exports['getConfigurations']=function(_0xae7067,_0xb6b583,_0x102101){var _0x473af2={};var _0x3b5e70={};var _0xa2758;var _0xc255ec;return db[_0xd373('0x3f')][_0xd373('0x49')]({'where':{'id':_0xae7067[_0xd373('0x48')]['id']}})[_0xd373('0x22')](handleEntityNotFound(_0xb6b583,null))['then'](function(_0x4b2645){if(_0x4b2645){_0xa2758=_0x4b2645;_0x3b5e70['model']=_['keys'](db['ZendeskConfiguration']['rawAttributes']);_0x3b5e70[_0xd373('0x2f')]=_[_0xd373('0x43')](_0xae7067['query']);_0x3b5e70['filters']=_['intersection'](_0x3b5e70[_0xd373('0x2e')],_0x3b5e70[_0xd373('0x2f')]);_0x473af2['attributes']=_['intersection'](_0x3b5e70[_0xd373('0x2e')],qs[_0xd373('0x33')](_0xae7067[_0xd373('0x2f')][_0xd373('0x33')]));_0x473af2[_0xd373('0x32')]=_0x473af2['attributes'][_0xd373('0x34')]?_0x473af2[_0xd373('0x32')]:_0x3b5e70[_0xd373('0x2e')];_0x473af2[_0xd373('0x37')]=qs[_0xd373('0x38')](_0xae7067[_0xd373('0x2f')][_0xd373('0x38')]);_0x473af2[_0xd373('0x39')]=qs[_0xd373('0x30')](_[_0xd373('0x3a')](_0xae7067[_0xd373('0x2f')],_0x3b5e70[_0xd373('0x30')]));if(_0xae7067[_0xd373('0x2f')][_0xd373('0x3c')]){_0x473af2[_0xd373('0x39')]=_['merge'](_0x473af2[_0xd373('0x39')],{'$or':_[_0xd373('0x2a')](_0x473af2[_0xd373('0x32')],function(_0x4dba1d){var _0x2bdadf={};_0x2bdadf[_0x4dba1d]={'$like':'%'+_0xae7067['query'][_0xd373('0x3c')]+'%'};return _0x2bdadf;})});}_0x473af2=_['merge']({},_0x473af2,_0xae7067[_0xd373('0x4a')]);return _0xa2758[_0xd373('0x4b')](_0x473af2);}})[_0xd373('0x22')](function(_0x19924a){if(_0x19924a){_0xc255ec=_0x19924a[_0xd373('0x34')];if(!_0xae7067[_0xd373('0x2f')][_0xd373('0x35')](_0xd373('0x36'))){_0x473af2[_0xd373('0x1b')]=qs[_0xd373('0x1b')](_0xae7067[_0xd373('0x2f')][_0xd373('0x1b')]);_0x473af2[_0xd373('0x18')]=qs[_0xd373('0x18')](_0xae7067[_0xd373('0x2f')][_0xd373('0x18')]);}return _0xa2758[_0xd373('0x4b')](_0x473af2);}})[_0xd373('0x22')](function(_0x209e76){if(_0x209e76){return _0x209e76?{'count':_0xc255ec,'rows':_0x209e76}:null;}})[_0xd373('0x22')](respondWithResult(_0xb6b583,null))[_0xd373('0x41')](handleError(_0xb6b583,null));};exports[_0xd373('0x4c')]=function(_0x296242,_0x5133,_0x2ada2f){if(_0x296242[_0xd373('0x47')]['id']){delete _0x296242['body']['id'];}return db[_0xd373('0x3f')][_0xd373('0x49')]({'where':{'id':_0x296242[_0xd373('0x48')]['id']}})['then'](handleEntityNotFound(_0x5133,null))[_0xd373('0x22')](function(_0x2d9019){if(_0x2d9019){_0x296242[_0xd373('0x47')][_0xd373('0x4d')]=_0x2d9019['id'];_0x296242[_0xd373('0x47')][_0xd373('0x4e')]=integrations[_0xd373('0x4f')](_0x296242['body'][_0xd373('0x50')],_0x296242[_0xd373('0x47')][_0xd373('0x2c')]);_0x296242[_0xd373('0x47')][_0xd373('0x51')]=integrations[_0xd373('0x52')](_0x296242[_0xd373('0x47')][_0xd373('0x50')],_0x296242['body'][_0xd373('0x2c')]);return db['ZendeskConfiguration'][_0xd373('0x46')](_0x296242[_0xd373('0x47')],{'include':[{'model':db[_0xd373('0x53')],'as':_0xd373('0x4e')},{'model':db[_0xd373('0x53')],'as':_0xd373('0x51')}]});}return null;})[_0xd373('0x22')](respondWithResult(_0x5133,null))[_0xd373('0x41')](handleError(_0x5133,null));};exports['getFields']=function(_0x237f15,_0x5c5855,_0x40f5ad){var _0x27fcbe='';return db[_0xd373('0x3f')][_0xd373('0x49')]({'where':{'id':_0x237f15[_0xd373('0x48')]['id']},'attributes':['id',_0xd373('0x54'),_0xd373('0x55'),'token',_0xd373('0x56'),_0xd373('0x57')]})[_0xd373('0x22')](handleEntityNotFound(_0x5c5855,null))['then'](function(_0x4035d4){if(_0x4035d4){_0x27fcbe=_0x4035d4[_0xd373('0x57')];var _0xaf9102=_0x27fcbe[_0xd373('0x58')](-0x1);if(_0xaf9102==='/'){_0x27fcbe=_0x27fcbe[_0xd373('0x59')](0x0,_0x27fcbe[_0xd373('0x5a')](_0xaf9102));}var _0x6c7c8d={'method':_0xd373('0x5b'),'uri':util[_0xd373('0x5c')](_0xd373('0x5d'),_0x27fcbe,_0xd373('0x5e')),'json':!![]};switch(_0x4035d4[_0xd373('0x56')]){case'password':_0x6c7c8d[_0xd373('0x5f')]={'Authorization':util[_0xd373('0x5c')](_0xd373('0x60'),new Buffer(util['format'](_0xd373('0x61'),_0x4035d4[_0xd373('0x54')],_0x4035d4[_0xd373('0x55')]))['toString'](_0xd373('0x62')))};break;case'token':_0x6c7c8d[_0xd373('0x5f')]={'Authorization':util[_0xd373('0x5c')](_0xd373('0x60'),new Buffer(util[_0xd373('0x5c')]('%s/token:%s',_0x4035d4[_0xd373('0x54')],_0x4035d4['token']))[_0xd373('0x63')](_0xd373('0x62')))};break;default:throw new db[(_0xd373('0x64'))][(_0xd373('0x65'))](_0xd373('0x66'));}return rp(_0x6c7c8d);}})[_0xd373('0x22')](function(_0x53c0a7){if(_0x53c0a7){var _0xb01a00=['subject',_0xd373('0x67'),'group','assignee'];_[_0xd373('0x68')](_0x53c0a7[_0xd373('0x5e')],function(_0x1cff58){return _0xb01a00[_0xd373('0x69')](_0x1cff58['type']);});return{'count':_0x53c0a7['ticket_fields'][_0xd373('0x34')],'rows':_[_0xd373('0x2a')](_0x53c0a7[_0xd373('0x5e')],function(_0x25bf55){return{'id':_0x25bf55['id'],'name':_0x25bf55[_0xd373('0x6a')]>0x7?_0x25bf55[_0xd373('0x6b')]:_0x25bf55[_0xd373('0x2c')],'custom':_0x25bf55[_0xd373('0x6a')]>0x7?!![]:![],'options':_0x25bf55[_0xd373('0x6c')]?_0x25bf55[_0xd373('0x6c')]:_0x25bf55['custom_field_options']?_0x25bf55[_0xd373('0x6d')]:[]};})};}})[_0xd373('0x22')](respondWithResult(_0x5c5855,null))[_0xd373('0x41')](function(_0xa77a42){var _0x9bdd39=_0x237f15[_0xd373('0x2f')][_0xd373('0x6e')]?0x1f4:_0xa77a42['statusCode']||0x1f4;logger[_0xd373('0x25')]('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x9bdd39,JSON[_0xd373('0x6f')](_0xa77a42));delete _0xa77a42[_0xd373('0x27')];if(_0x9bdd39===0x191){_0x9bdd39=0x190;}_0x5c5855[_0xd373('0x15')](_0x9bdd39)[_0xd373('0x28')](_0x237f15[_0xd373('0x2f')][_0xd373('0x6e')]?{'message':'Wrong\x20credentials','statusCode':_0xa77a42[_0xd373('0x70')]}:_0xa77a42);});}; \ No newline at end of file +var _0xeb74=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','status','json','offset','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','ZendeskAccount','rawAttributes','fieldName','type','key','model','map','keys','filters','intersection','attributes','fields','length','query','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','getConfigurations','findOne','ZendeskConfiguration','filter','AccountId','channel','Descriptions','ZendeskField','Subjects','getFields','username','token','authType','remoteUri','slice','substring','lastIndexOf','GET','format','%s/%s','ticket_fields','password','headers','%s:%s','toString','base64','Basic\x20%s','%s/token:%s','Sequelize','subject','description','group','assignee','remove','includes','position','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xeb74,0xe3));var _0x4eb7=function(_0x47972b,_0x4edbde){_0x47972b=_0x47972b-0x0;var _0x38d750=_0xeb74[_0x47972b];return _0x38d750;};'use strict';var emlformat=require(_0x4eb7('0x0'));var rimraf=require(_0x4eb7('0x1'));var zipdir=require(_0x4eb7('0x2'));var jsonpatch=require(_0x4eb7('0x3'));var rp=require(_0x4eb7('0x4'));var moment=require(_0x4eb7('0x5'));var BPromise=require(_0x4eb7('0x6'));var Mustache=require('mustache');var util=require(_0x4eb7('0x7'));var path=require(_0x4eb7('0x8'));var sox=require(_0x4eb7('0x9'));var csv=require(_0x4eb7('0xa'));var ejs=require(_0x4eb7('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4eb7('0xc'));var squel=require('squel');var crypto=require(_0x4eb7('0xd'));var jsforce=require(_0x4eb7('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x4eb7('0xf'));var Papa=require(_0x4eb7('0x10'));var Redis=require('ioredis');var authService=require(_0x4eb7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4eb7('0x12'));var hardwareService=require(_0x4eb7('0x13'));var logger=require(_0x4eb7('0x14'))('api');var utils=require(_0x4eb7('0x15'));var config=require(_0x4eb7('0x16'));var licenseUtil=require(_0x4eb7('0x17'));var db=require(_0x4eb7('0x18'))['db'];var integrations=require(_0x4eb7('0x19'));function respondWithStatusCode(_0x4194e1,_0x3c9f45){_0x3c9f45=_0x3c9f45||0xcc;return function(_0x4c27a4){if(_0x4c27a4){return _0x4194e1['sendStatus'](_0x3c9f45);}return _0x4194e1['status'](_0x3c9f45)[_0x4eb7('0x1a')]();};}function respondWithResult(_0x51f09d,_0x84c68b){_0x84c68b=_0x84c68b||0xc8;return function(_0x119afa){if(_0x119afa){return _0x51f09d[_0x4eb7('0x1b')](_0x84c68b)[_0x4eb7('0x1c')](_0x119afa);}};}function respondWithFilteredResult(_0x5d6d5,_0x21433d){return function(_0x11674f){if(_0x11674f){var _0x76988=typeof _0x21433d[_0x4eb7('0x1d')]===_0x4eb7('0x1e')&&typeof _0x21433d['limit']===_0x4eb7('0x1e');var _0x11ac9f=_0x11674f[_0x4eb7('0x1f')];var _0xf14478=_0x76988?0x0:_0x21433d[_0x4eb7('0x1d')];var _0x44f1b9=_0x76988?_0x11674f[_0x4eb7('0x1f')]:_0x21433d[_0x4eb7('0x1d')]+_0x21433d['limit'];var _0x3cf53a;if(_0x44f1b9>=_0x11ac9f){_0x44f1b9=_0x11ac9f;_0x3cf53a=0xc8;}else{_0x3cf53a=0xce;}_0x5d6d5[_0x4eb7('0x1b')](_0x3cf53a);return _0x5d6d5[_0x4eb7('0x20')](_0x4eb7('0x21'),_0xf14478+'-'+_0x44f1b9+'/'+_0x11ac9f)[_0x4eb7('0x1c')](_0x11674f);}return null;};}function patchUpdates(_0x2efd67){return function(_0x11fb0a){try{jsonpatch['apply'](_0x11fb0a,_0x2efd67,!![]);}catch(_0x214a28){return BPromise[_0x4eb7('0x22')](_0x214a28);}return _0x11fb0a[_0x4eb7('0x23')]();};}function saveUpdates(_0x164515,_0x14a7be){return function(_0x1b4640){if(_0x1b4640){return _0x1b4640[_0x4eb7('0x24')](_0x164515)[_0x4eb7('0x25')](function(_0x1a2b8b){return _0x1a2b8b;});}return null;};}function removeEntity(_0x13e871,_0x4de2d9){return function(_0x3e72cd){if(_0x3e72cd){return _0x3e72cd[_0x4eb7('0x26')]()[_0x4eb7('0x25')](function(){_0x13e871[_0x4eb7('0x1b')](0xcc)[_0x4eb7('0x1a')]();});}};}function handleEntityNotFound(_0x25eb74,_0x365060){return function(_0xe9db8){if(!_0xe9db8){_0x25eb74[_0x4eb7('0x27')](0x194);}return _0xe9db8;};}function handleError(_0x248759,_0xf83c11){_0xf83c11=_0xf83c11||0x1f4;return function(_0x2984b2){logger[_0x4eb7('0x28')](_0x2984b2[_0x4eb7('0x29')]);if(_0x2984b2[_0x4eb7('0x2a')]){delete _0x2984b2[_0x4eb7('0x2a')];}_0x248759[_0x4eb7('0x1b')](_0xf83c11)[_0x4eb7('0x2b')](_0x2984b2);};}exports[_0x4eb7('0x2c')]=function(_0x28fda8,_0x114c68){var _0x17030a={},_0x3ed224={},_0x50209d={'count':0x0,'rows':[]};var _0x34515c=_['map'](db[_0x4eb7('0x2d')][_0x4eb7('0x2e')],function(_0xc5aa21){return{'name':_0xc5aa21[_0x4eb7('0x2f')],'type':_0xc5aa21[_0x4eb7('0x30')][_0x4eb7('0x31')]};});_0x3ed224[_0x4eb7('0x32')]=_[_0x4eb7('0x33')](_0x34515c,_0x4eb7('0x2a'));_0x3ed224['query']=_[_0x4eb7('0x34')](_0x28fda8['query']);_0x3ed224[_0x4eb7('0x35')]=_[_0x4eb7('0x36')](_0x3ed224['model'],_0x3ed224['query']);_0x17030a[_0x4eb7('0x37')]=_[_0x4eb7('0x36')](_0x3ed224[_0x4eb7('0x32')],qs[_0x4eb7('0x38')](_0x28fda8['query'][_0x4eb7('0x38')]));_0x17030a[_0x4eb7('0x37')]=_0x17030a[_0x4eb7('0x37')][_0x4eb7('0x39')]?_0x17030a[_0x4eb7('0x37')]:_0x3ed224['model'];if(!_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x3b')](_0x4eb7('0x3c'))){_0x17030a['limit']=qs[_0x4eb7('0x3d')](_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x3d')]);_0x17030a['offset']=qs[_0x4eb7('0x1d')](_0x28fda8['query'][_0x4eb7('0x1d')]);}_0x17030a[_0x4eb7('0x3e')]=qs[_0x4eb7('0x3f')](_0x28fda8[_0x4eb7('0x3a')]['sort']);_0x17030a[_0x4eb7('0x40')]=qs[_0x4eb7('0x35')](_[_0x4eb7('0x41')](_0x28fda8[_0x4eb7('0x3a')],_0x3ed224['filters']),_0x34515c);if(_0x28fda8['query']['filter']){_0x17030a[_0x4eb7('0x40')]=_[_0x4eb7('0x42')](_0x17030a[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x33')](_0x34515c,function(_0x210c20){if(_0x210c20[_0x4eb7('0x30')]!==_0x4eb7('0x43')){var _0x20d2bc={};_0x20d2bc[_0x210c20[_0x4eb7('0x2a')]]={'$like':'%'+_0x28fda8[_0x4eb7('0x3a')]['filter']+'%'};return _0x20d2bc;}})});}_0x17030a=_[_0x4eb7('0x42')]({},_0x17030a,_0x28fda8[_0x4eb7('0x44')]);var _0xe04d76={'where':_0x17030a[_0x4eb7('0x40')]};return db[_0x4eb7('0x2d')][_0x4eb7('0x1f')](_0xe04d76)[_0x4eb7('0x25')](function(_0xef998f){_0x50209d[_0x4eb7('0x1f')]=_0xef998f;if(_0x28fda8[_0x4eb7('0x3a')][_0x4eb7('0x45')]){_0x17030a[_0x4eb7('0x46')]=[{'all':!![]}];}return db[_0x4eb7('0x2d')][_0x4eb7('0x47')](_0x17030a);})[_0x4eb7('0x25')](function(_0x5b819f){_0x50209d[_0x4eb7('0x48')]=_0x5b819f;return _0x50209d;})[_0x4eb7('0x25')](respondWithFilteredResult(_0x114c68,_0x17030a))[_0x4eb7('0x49')](handleError(_0x114c68,null));};exports[_0x4eb7('0x4a')]=function(_0x5eff9e,_0x2fd5c2){var _0x2df542={'raw':![],'where':{'id':_0x5eff9e[_0x4eb7('0x4b')]['id']}},_0x482357={};_0x482357[_0x4eb7('0x32')]=_[_0x4eb7('0x34')](db[_0x4eb7('0x2d')][_0x4eb7('0x2e')]);_0x482357[_0x4eb7('0x3a')]=_['keys'](_0x5eff9e[_0x4eb7('0x3a')]);_0x482357['filters']=_[_0x4eb7('0x36')](_0x482357[_0x4eb7('0x32')],_0x482357[_0x4eb7('0x3a')]);_0x2df542['attributes']=_[_0x4eb7('0x36')](_0x482357[_0x4eb7('0x32')],qs[_0x4eb7('0x38')](_0x5eff9e[_0x4eb7('0x3a')]['fields']));_0x2df542[_0x4eb7('0x37')]=_0x2df542['attributes'][_0x4eb7('0x39')]?_0x2df542[_0x4eb7('0x37')]:_0x482357[_0x4eb7('0x32')];if(_0x5eff9e[_0x4eb7('0x3a')][_0x4eb7('0x45')]){_0x2df542['include']=[{'all':!![]}];}_0x2df542=_['merge']({},_0x2df542,_0x5eff9e[_0x4eb7('0x44')]);return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')](_0x2df542)[_0x4eb7('0x25')](handleEntityNotFound(_0x2fd5c2,null))[_0x4eb7('0x25')](respondWithResult(_0x2fd5c2,null))['catch'](handleError(_0x2fd5c2,null));};exports[_0x4eb7('0x4d')]=function(_0x104284,_0x56609e){return db[_0x4eb7('0x2d')][_0x4eb7('0x4d')](_0x104284['body'],{})[_0x4eb7('0x25')](respondWithResult(_0x56609e,0xc9))[_0x4eb7('0x49')](handleError(_0x56609e,null));};exports[_0x4eb7('0x24')]=function(_0x5774d5,_0x130113){if(_0x5774d5['body']['id']){delete _0x5774d5['body']['id'];}return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')]({'where':{'id':_0x5774d5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x130113,null))[_0x4eb7('0x25')](saveUpdates(_0x5774d5[_0x4eb7('0x4e')],null))[_0x4eb7('0x25')](respondWithResult(_0x130113,null))[_0x4eb7('0x49')](handleError(_0x130113,null));};exports[_0x4eb7('0x26')]=function(_0x23c0d5,_0x42a1d9){return db[_0x4eb7('0x2d')][_0x4eb7('0x4c')]({'where':{'id':_0x23c0d5[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x42a1d9,null))[_0x4eb7('0x25')](removeEntity(_0x42a1d9,null))[_0x4eb7('0x49')](handleError(_0x42a1d9,null));};exports[_0x4eb7('0x4f')]=function(_0x1411c9,_0x11cc3d,_0x4cfba8){var _0x3f3d41={};var _0x550888={};var _0x4db5f7;var _0x3f3a5f;return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x1411c9[_0x4eb7('0x4b')]['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x11cc3d,null))['then'](function(_0x4e3163){if(_0x4e3163){_0x4db5f7=_0x4e3163;_0x550888[_0x4eb7('0x32')]=_['keys'](db[_0x4eb7('0x51')][_0x4eb7('0x2e')]);_0x550888[_0x4eb7('0x3a')]=_[_0x4eb7('0x34')](_0x1411c9['query']);_0x550888[_0x4eb7('0x35')]=_[_0x4eb7('0x36')](_0x550888[_0x4eb7('0x32')],_0x550888[_0x4eb7('0x3a')]);_0x3f3d41['attributes']=_[_0x4eb7('0x36')](_0x550888[_0x4eb7('0x32')],qs['fields'](_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x38')]));_0x3f3d41['attributes']=_0x3f3d41[_0x4eb7('0x37')]['length']?_0x3f3d41[_0x4eb7('0x37')]:_0x550888['model'];_0x3f3d41[_0x4eb7('0x3e')]=qs[_0x4eb7('0x3f')](_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x3f')]);_0x3f3d41[_0x4eb7('0x40')]=qs[_0x4eb7('0x35')](_['pick'](_0x1411c9['query'],_0x550888[_0x4eb7('0x35')]));if(_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x52')]){_0x3f3d41[_0x4eb7('0x40')]=_['merge'](_0x3f3d41[_0x4eb7('0x40')],{'$or':_[_0x4eb7('0x33')](_0x3f3d41['attributes'],function(_0x452f21){var _0xba9272={};_0xba9272[_0x452f21]={'$like':'%'+_0x1411c9[_0x4eb7('0x3a')][_0x4eb7('0x52')]+'%'};return _0xba9272;})});}_0x3f3d41=_[_0x4eb7('0x42')]({},_0x3f3d41,_0x1411c9[_0x4eb7('0x44')]);return _0x4db5f7[_0x4eb7('0x4f')](_0x3f3d41);}})['then'](function(_0x5839f1){if(_0x5839f1){_0x3f3a5f=_0x5839f1[_0x4eb7('0x39')];if(!_0x1411c9['query'][_0x4eb7('0x3b')]('nolimit')){_0x3f3d41[_0x4eb7('0x3d')]=qs['limit'](_0x1411c9['query'][_0x4eb7('0x3d')]);_0x3f3d41[_0x4eb7('0x1d')]=qs['offset'](_0x1411c9[_0x4eb7('0x3a')]['offset']);}return _0x4db5f7[_0x4eb7('0x4f')](_0x3f3d41);}})[_0x4eb7('0x25')](function(_0x4ab8e8){if(_0x4ab8e8){return _0x4ab8e8?{'count':_0x3f3a5f,'rows':_0x4ab8e8}:null;}})[_0x4eb7('0x25')](respondWithResult(_0x11cc3d,null))[_0x4eb7('0x49')](handleError(_0x11cc3d,null));};exports['addConfiguration']=function(_0x4b492a,_0x5c8d45,_0x59e2f2){if(_0x4b492a[_0x4eb7('0x4e')]['id']){delete _0x4b492a['body']['id'];}return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x4b492a['params']['id']}})[_0x4eb7('0x25')](handleEntityNotFound(_0x5c8d45,null))[_0x4eb7('0x25')](function(_0x463ab6){if(_0x463ab6){_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x53')]=_0x463ab6['id'];_0x4b492a[_0x4eb7('0x4e')]['Subjects']=integrations['getSubjects'](_0x4b492a['body'][_0x4eb7('0x54')],_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x30')]);_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x55')]=integrations['getDescriptions'](_0x4b492a['body'][_0x4eb7('0x54')],_0x4b492a[_0x4eb7('0x4e')][_0x4eb7('0x30')]);return db[_0x4eb7('0x51')][_0x4eb7('0x4d')](_0x4b492a['body'],{'include':[{'model':db[_0x4eb7('0x56')],'as':_0x4eb7('0x57')},{'model':db[_0x4eb7('0x56')],'as':_0x4eb7('0x55')}]});}return null;})['then'](respondWithResult(_0x5c8d45,null))['catch'](handleError(_0x5c8d45,null));};exports[_0x4eb7('0x58')]=function(_0x3883f3,_0x4e8125,_0x1911ad){var _0x4b698b='';return db[_0x4eb7('0x2d')][_0x4eb7('0x50')]({'where':{'id':_0x3883f3[_0x4eb7('0x4b')]['id']},'attributes':['id',_0x4eb7('0x59'),'password',_0x4eb7('0x5a'),_0x4eb7('0x5b'),_0x4eb7('0x5c')]})[_0x4eb7('0x25')](handleEntityNotFound(_0x4e8125,null))[_0x4eb7('0x25')](function(_0x3271d0){if(_0x3271d0){_0x4b698b=_0x3271d0[_0x4eb7('0x5c')];var _0x232242=_0x4b698b[_0x4eb7('0x5d')](-0x1);if(_0x232242==='/'){_0x4b698b=_0x4b698b[_0x4eb7('0x5e')](0x0,_0x4b698b[_0x4eb7('0x5f')](_0x232242));}var _0x713b0a={'method':_0x4eb7('0x60'),'uri':util[_0x4eb7('0x61')](_0x4eb7('0x62'),_0x4b698b,_0x4eb7('0x63')),'json':!![]};switch(_0x3271d0[_0x4eb7('0x5b')]){case _0x4eb7('0x64'):_0x713b0a[_0x4eb7('0x65')]={'Authorization':util['format']('Basic\x20%s',new Buffer(util[_0x4eb7('0x61')](_0x4eb7('0x66'),_0x3271d0[_0x4eb7('0x59')],_0x3271d0[_0x4eb7('0x64')]))[_0x4eb7('0x67')](_0x4eb7('0x68')))};break;case _0x4eb7('0x5a'):_0x713b0a[_0x4eb7('0x65')]={'Authorization':util['format'](_0x4eb7('0x69'),new Buffer(util[_0x4eb7('0x61')](_0x4eb7('0x6a'),_0x3271d0['username'],_0x3271d0['token']))[_0x4eb7('0x67')](_0x4eb7('0x68')))};break;default:throw new db[(_0x4eb7('0x6b'))]['ValidationError']('Unknown\x20authentication\x20type');}return rp(_0x713b0a);}})[_0x4eb7('0x25')](function(_0x1a1525){if(_0x1a1525){var _0x4778f9=[_0x4eb7('0x6c'),_0x4eb7('0x6d'),_0x4eb7('0x6e'),_0x4eb7('0x6f')];_[_0x4eb7('0x70')](_0x1a1525[_0x4eb7('0x63')],function(_0x2e531e){return _0x4778f9[_0x4eb7('0x71')](_0x2e531e[_0x4eb7('0x30')]);});return{'count':_0x1a1525['ticket_fields']['length'],'rows':_[_0x4eb7('0x33')](_0x1a1525[_0x4eb7('0x63')],function(_0x14648d){return{'id':_0x14648d['id'],'name':_0x14648d[_0x4eb7('0x72')]>0x7?_0x14648d[_0x4eb7('0x73')]:_0x14648d[_0x4eb7('0x30')],'custom':_0x14648d['position']>0x7?!![]:![],'options':_0x14648d['system_field_options']?_0x14648d[_0x4eb7('0x74')]:_0x14648d[_0x4eb7('0x75')]?_0x14648d[_0x4eb7('0x75')]:[]};})};}})[_0x4eb7('0x25')](respondWithResult(_0x4e8125,null))[_0x4eb7('0x49')](function(_0x2480ed){var _0x13f574=_0x3883f3[_0x4eb7('0x3a')][_0x4eb7('0x76')]?0x1f4:_0x2480ed[_0x4eb7('0x77')]||0x1f4;logger[_0x4eb7('0x28')](_0x4eb7('0x78'),_0x4eb7('0x58'),_0x13f574,JSON[_0x4eb7('0x79')](_0x2480ed));delete _0x2480ed['name'];if(_0x13f574===0x191){_0x13f574=0x190;}_0x4e8125[_0x4eb7('0x1b')](_0x13f574)[_0x4eb7('0x2b')](_0x3883f3[_0x4eb7('0x3a')][_0x4eb7('0x76')]?{'message':'Wrong\x20credentials','statusCode':_0x2480ed[_0x4eb7('0x77')]}:_0x2480ed);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 048f420..5bbbbf0 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 _0xba3d=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','ZendeskAccount','lodash','api','moment','bluebird','request-promise'];(function(_0x10593d,_0x281856){var _0x3e5132=function(_0x2c0f3c){while(--_0x2c0f3c){_0x10593d['push'](_0x10593d['shift']());}};_0x3e5132(++_0x281856);}(_0xba3d,0x19f));var _0xdba3=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0xba3d[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0xdba3('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xdba3('0x1'));var moment=require(_0xdba3('0x2'));var BPromise=require(_0xdba3('0x3'));var rp=require(_0xdba3('0x4'));var fs=require('fs');var path=require(_0xdba3('0x5'));var rimraf=require(_0xdba3('0x6'));var config=require(_0xdba3('0x7'));var attributes=require('./intZendeskAccount.attributes');var integrations=require(_0xdba3('0x8'));module[_0xdba3('0x9')]=function(_0x1205c1,_0x42d849){return _0x1205c1[_0xdba3('0xa')](_0xdba3('0xb'),attributes,{'tableName':'int_zendesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdbc7=['util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0xdbc7,0x178));var _0x7dbc=function(_0x46d0c9,_0x526bfa){_0x46d0c9=_0x46d0c9-0x0;var _0x174506=_0xdbc7[_0x46d0c9];return _0x174506;};'use strict';var _=require(_0x7dbc('0x0'));var util=require(_0x7dbc('0x1'));var logger=require(_0x7dbc('0x2'))('api');var moment=require(_0x7dbc('0x3'));var BPromise=require(_0x7dbc('0x4'));var rp=require(_0x7dbc('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7dbc('0x6'));var config=require(_0x7dbc('0x7'));var attributes=require(_0x7dbc('0x8'));var integrations=require(_0x7dbc('0x9'));module[_0x7dbc('0xa')]=function(_0x315f2c,_0x3921e3){return _0x315f2c['define'](_0x7dbc('0xb'),attributes,{'tableName':_0x7dbc('0xc'),'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 1181102..37a0ac6 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 _0x598f=['stringify','error','code','message','result','catch','GetZendeskAccount','findAll','options','raw','limit','include','map','model','attributes','then','ShowZendeskAccount','ZendeskAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s'];(function(_0x54c055,_0x1ccd25){var _0x46d0bb=function(_0x5449a6){while(--_0x5449a6){_0x54c055['push'](_0x54c055['shift']());}};_0x46d0bb(++_0x1ccd25);}(_0x598f,0x1cf));var _0xf598=function(_0x46f5c0,_0x13d3de){_0x46f5c0=_0x46f5c0-0x0;var _0x4042a9=_0x598f[_0x46f5c0];return _0x4042a9;};'use strict';var _=require(_0xf598('0x0'));var util=require(_0xf598('0x1'));var moment=require(_0xf598('0x2'));var BPromise=require(_0xf598('0x3'));var rs=require(_0xf598('0x4'));var fs=require('fs');var Redis=require(_0xf598('0x5'));var db=require(_0xf598('0x6'))['db'];var utils=require(_0xf598('0x7'));var logger=require(_0xf598('0x8'))(_0xf598('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf598('0xa')][_0xf598('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3583f1,_0x1ce068,_0x8141e){return new BPromise(function(_0x2eebae,_0x5ca40f){return client[_0xf598('0xc')](_0x3583f1,_0x8141e)['then'](function(_0x475ddf){logger[_0xf598('0xd')](_0xf598('0xe'),_0x1ce068,_0xf598('0xf'));logger[_0xf598('0x10')](_0xf598('0x11'),_0x1ce068,_0xf598('0xf'),JSON[_0xf598('0x12')](_0x475ddf));if(_0x475ddf['error']){if(_0x475ddf[_0xf598('0x13')][_0xf598('0x14')]===0x1f4){logger[_0xf598('0x13')](_0xf598('0xe'),_0x1ce068,_0x475ddf[_0xf598('0x13')]['message']);return _0x5ca40f(_0x475ddf['error'][_0xf598('0x15')]);}logger[_0xf598('0x13')](_0xf598('0xe'),_0x1ce068,_0x475ddf[_0xf598('0x13')][_0xf598('0x15')]);return _0x2eebae(_0x475ddf['error'][_0xf598('0x15')]);}else{logger[_0xf598('0xd')](_0xf598('0xe'),_0x1ce068,_0xf598('0xf'));_0x2eebae(_0x475ddf[_0xf598('0x16')]['message']);}})[_0xf598('0x17')](function(_0x23824d){logger[_0xf598('0x13')](_0xf598('0xe'),_0x1ce068,_0x23824d);_0x5ca40f(_0x23824d);});});}exports[_0xf598('0x18')]=function(_0x1f4759){var _0x40346f=this;return new Promise(function(_0x1bb2f7,_0x2bdbe4){return db['ZendeskAccount'][_0xf598('0x19')]({'raw':_0x1f4759[_0xf598('0x1a')]?_0x1f4759[_0xf598('0x1a')][_0xf598('0x1b')]===undefined?!![]:![]:!![],'where':_0x1f4759[_0xf598('0x1a')]?_0x1f4759[_0xf598('0x1a')]['where']||null:null,'attributes':_0x1f4759['options']?_0x1f4759[_0xf598('0x1a')]['attributes']||null:null,'limit':_0x1f4759[_0xf598('0x1a')]?_0x1f4759['options'][_0xf598('0x1c')]||null:null,'include':_0x1f4759['options']?_0x1f4759[_0xf598('0x1a')][_0xf598('0x1d')]?_[_0xf598('0x1e')](_0x1f4759[_0xf598('0x1a')][_0xf598('0x1d')],function(_0x19abec){return{'model':db[_0x19abec[_0xf598('0x1f')]],'as':_0x19abec['as'],'attributes':_0x19abec[_0xf598('0x20')],'include':_0x19abec[_0xf598('0x1d')]?_[_0xf598('0x1e')](_0x19abec[_0xf598('0x1d')],function(_0x423bcf){return{'model':db[_0x423bcf['model']],'as':_0x423bcf['as'],'attributes':_0x423bcf[_0xf598('0x20')],'include':_0x423bcf['include']?_[_0xf598('0x1e')](_0x423bcf[_0xf598('0x1d')],function(_0x85d756){return{'model':db[_0x85d756[_0xf598('0x1f')]],'as':_0x85d756['as'],'attributes':_0x85d756[_0xf598('0x20')]};}):[]};}):[]};}):[]:[]})[_0xf598('0x21')](function(_0x4cf222){logger[_0xf598('0xd')](_0xf598('0x18'),_0x1f4759);logger['debug'](_0xf598('0x18'),_0x1f4759,JSON[_0xf598('0x12')](_0x4cf222));_0x1bb2f7(_0x4cf222);})['catch'](function(_0x2d662d){logger[_0xf598('0x13')](_0xf598('0x18'),_0x2d662d[_0xf598('0x15')],_0x1f4759);_0x2bdbe4(_0x40346f['error'](0x1f4,_0x2d662d[_0xf598('0x15')]));});});};exports[_0xf598('0x22')]=function(_0x592506){var _0xf1a856=this;return new Promise(function(_0x353ae3,_0x1d4fdc){return db[_0xf598('0x23')]['find']({'raw':_0x592506[_0xf598('0x1a')]?_0x592506[_0xf598('0x1a')][_0xf598('0x1b')]===undefined?!![]:![]:!![],'where':_0x592506[_0xf598('0x1a')]?_0x592506[_0xf598('0x1a')][_0xf598('0x24')]||null:null,'attributes':_0x592506[_0xf598('0x1a')]?_0x592506['options'][_0xf598('0x20')]||null:null,'include':_0x592506[_0xf598('0x1a')]?_0x592506[_0xf598('0x1a')][_0xf598('0x1d')]?_[_0xf598('0x1e')](_0x592506['options'][_0xf598('0x1d')],function(_0x5e11cd){return{'model':db[_0x5e11cd[_0xf598('0x1f')]],'as':_0x5e11cd['as'],'attributes':_0x5e11cd['attributes'],'include':_0x5e11cd[_0xf598('0x1d')]?_[_0xf598('0x1e')](_0x5e11cd[_0xf598('0x1d')],function(_0x1ad8d4){return{'model':db[_0x1ad8d4['model']],'as':_0x1ad8d4['as'],'attributes':_0x1ad8d4[_0xf598('0x20')],'include':_0x1ad8d4['include']?_[_0xf598('0x1e')](_0x1ad8d4['include'],function(_0x49b9e6){return{'model':db[_0x49b9e6[_0xf598('0x1f')]],'as':_0x49b9e6['as'],'attributes':_0x49b9e6['attributes']};}):[]};}):[]};}):[]:[]})[_0xf598('0x21')](function(_0x34bb7b){logger[_0xf598('0xd')]('ShowZendeskAccount',_0x592506);logger[_0xf598('0x10')](_0xf598('0x22'),_0x592506,JSON[_0xf598('0x12')](_0x34bb7b));_0x353ae3(_0x34bb7b);})[_0xf598('0x17')](function(_0xa67f24){logger[_0xf598('0x13')](_0xf598('0x22'),_0xa67f24[_0xf598('0x15')],_0x592506);_0x1d4fdc(_0xf1a856[_0xf598('0x13')](0x1f4,_0xa67f24['message']));});});}; \ No newline at end of file +var _0xee34=['ZendeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','then','catch','ShowZendeskAccount','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetZendeskAccount'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee34,0x95));var _0x4ee3=function(_0x50cc6a,_0x25a4b6){_0x50cc6a=_0x50cc6a-0x0;var _0x5e0bb0=_0xee34[_0x50cc6a];return _0x5e0bb0;};'use strict';var _=require(_0x4ee3('0x0'));var util=require(_0x4ee3('0x1'));var moment=require(_0x4ee3('0x2'));var BPromise=require(_0x4ee3('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4ee3('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4ee3('0x5'))(_0x4ee3('0x6'));var config=require(_0x4ee3('0x7'));var jayson=require(_0x4ee3('0x8'));var client=jayson[_0x4ee3('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x19013e,_0x281c5a,_0x156252){return new BPromise(function(_0x26adfd,_0x5c42c9){return client[_0x4ee3('0xa')](_0x19013e,_0x156252)['then'](function(_0x305a8f){logger[_0x4ee3('0xb')](_0x4ee3('0xc'),_0x281c5a,_0x4ee3('0xd'));logger[_0x4ee3('0xe')]('ZendeskAccount,\x20%s,\x20%s,\x20%s',_0x281c5a,'request\x20sent',JSON[_0x4ee3('0xf')](_0x305a8f));if(_0x305a8f[_0x4ee3('0x10')]){if(_0x305a8f[_0x4ee3('0x10')][_0x4ee3('0x11')]===0x1f4){logger[_0x4ee3('0x10')](_0x4ee3('0xc'),_0x281c5a,_0x305a8f[_0x4ee3('0x10')]['message']);return _0x5c42c9(_0x305a8f[_0x4ee3('0x10')][_0x4ee3('0x12')]);}logger[_0x4ee3('0x10')](_0x4ee3('0xc'),_0x281c5a,_0x305a8f[_0x4ee3('0x10')]['message']);return _0x26adfd(_0x305a8f[_0x4ee3('0x10')][_0x4ee3('0x12')]);}else{logger[_0x4ee3('0xb')]('ZendeskAccount,\x20%s,\x20%s',_0x281c5a,_0x4ee3('0xd'));_0x26adfd(_0x305a8f[_0x4ee3('0x13')][_0x4ee3('0x12')]);}})['catch'](function(_0x37a47a){logger[_0x4ee3('0x10')](_0x4ee3('0xc'),_0x281c5a,_0x37a47a);_0x5c42c9(_0x37a47a);});});}exports[_0x4ee3('0x14')]=function(_0x1e4793){var _0xeb592e=this;return new Promise(function(_0x3005e4,_0x483d23){return db[_0x4ee3('0x15')][_0x4ee3('0x16')]({'raw':_0x1e4793['options']?_0x1e4793[_0x4ee3('0x17')][_0x4ee3('0x18')]===undefined?!![]:![]:!![],'where':_0x1e4793[_0x4ee3('0x17')]?_0x1e4793[_0x4ee3('0x17')][_0x4ee3('0x19')]||null:null,'attributes':_0x1e4793['options']?_0x1e4793['options']['attributes']||null:null,'limit':_0x1e4793[_0x4ee3('0x17')]?_0x1e4793[_0x4ee3('0x17')][_0x4ee3('0x1a')]||null:null,'include':_0x1e4793['options']?_0x1e4793['options'][_0x4ee3('0x1b')]?_[_0x4ee3('0x1c')](_0x1e4793[_0x4ee3('0x17')][_0x4ee3('0x1b')],function(_0x2b2220){return{'model':db[_0x2b2220[_0x4ee3('0x1d')]],'as':_0x2b2220['as'],'attributes':_0x2b2220[_0x4ee3('0x1e')],'include':_0x2b2220[_0x4ee3('0x1b')]?_[_0x4ee3('0x1c')](_0x2b2220[_0x4ee3('0x1b')],function(_0x2e2c88){return{'model':db[_0x2e2c88[_0x4ee3('0x1d')]],'as':_0x2e2c88['as'],'attributes':_0x2e2c88['attributes'],'include':_0x2e2c88[_0x4ee3('0x1b')]?_[_0x4ee3('0x1c')](_0x2e2c88['include'],function(_0x24f549){return{'model':db[_0x24f549[_0x4ee3('0x1d')]],'as':_0x24f549['as'],'attributes':_0x24f549[_0x4ee3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ee3('0x1f')](function(_0x5b37a3){logger[_0x4ee3('0xb')]('GetZendeskAccount',_0x1e4793);logger[_0x4ee3('0xe')]('GetZendeskAccount',_0x1e4793,JSON[_0x4ee3('0xf')](_0x5b37a3));_0x3005e4(_0x5b37a3);})[_0x4ee3('0x20')](function(_0x1a71f9){logger[_0x4ee3('0x10')](_0x4ee3('0x14'),_0x1a71f9[_0x4ee3('0x12')],_0x1e4793);_0x483d23(_0xeb592e[_0x4ee3('0x10')](0x1f4,_0x1a71f9[_0x4ee3('0x12')]));});});};exports[_0x4ee3('0x21')]=function(_0x5f4923){var _0x3c5d57=this;return new Promise(function(_0x3893b8,_0xedf9d0){return db['ZendeskAccount']['find']({'raw':_0x5f4923[_0x4ee3('0x17')]?_0x5f4923[_0x4ee3('0x17')][_0x4ee3('0x18')]===undefined?!![]:![]:!![],'where':_0x5f4923[_0x4ee3('0x17')]?_0x5f4923[_0x4ee3('0x17')][_0x4ee3('0x19')]||null:null,'attributes':_0x5f4923[_0x4ee3('0x17')]?_0x5f4923[_0x4ee3('0x17')][_0x4ee3('0x1e')]||null:null,'include':_0x5f4923[_0x4ee3('0x17')]?_0x5f4923['options'][_0x4ee3('0x1b')]?_['map'](_0x5f4923[_0x4ee3('0x17')]['include'],function(_0x395cd3){return{'model':db[_0x395cd3[_0x4ee3('0x1d')]],'as':_0x395cd3['as'],'attributes':_0x395cd3[_0x4ee3('0x1e')],'include':_0x395cd3['include']?_['map'](_0x395cd3[_0x4ee3('0x1b')],function(_0x334c67){return{'model':db[_0x334c67[_0x4ee3('0x1d')]],'as':_0x334c67['as'],'attributes':_0x334c67[_0x4ee3('0x1e')],'include':_0x334c67['include']?_[_0x4ee3('0x1c')](_0x334c67[_0x4ee3('0x1b')],function(_0x140f2e){return{'model':db[_0x140f2e[_0x4ee3('0x1d')]],'as':_0x140f2e['as'],'attributes':_0x140f2e[_0x4ee3('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x4ee3('0x1f')](function(_0x3dd3b2){logger[_0x4ee3('0xb')](_0x4ee3('0x21'),_0x5f4923);logger[_0x4ee3('0xe')](_0x4ee3('0x21'),_0x5f4923,JSON['stringify'](_0x3dd3b2));_0x3893b8(_0x3dd3b2);})[_0x4ee3('0x20')](function(_0x1fc3b3){logger[_0x4ee3('0x10')](_0x4ee3('0x21'),_0x1fc3b3['message'],_0x5f4923);_0xedf9d0(_0x3c5d57[_0x4ee3('0x10')](0x1f4,_0x1fc3b3[_0x4ee3('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6e3b34f..5b1f762 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 _0x4fc2=['get','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','/:id/tags','post','create','put','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./intZendeskConfiguration.controller','isAuthenticated','index','/:id','show'];(function(_0x4a3f83,_0x5f36cf){var _0x53b726=function(_0x303e1c){while(--_0x303e1c){_0x4a3f83['push'](_0x4a3f83['shift']());}};_0x53b726(++_0x5f36cf);}(_0x4fc2,0x111));var _0x24fc=function(_0x3b477d,_0x4495f9){_0x3b477d=_0x3b477d-0x0;var _0x45d4eb=_0x4fc2[_0x3b477d];return _0x45d4eb;};'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')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['getFields']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['get'](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['getTags']);router[_0x24fc('0x14')]('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x15')]);router[_0x24fc('0x14')](_0x24fc('0x13'),auth[_0x24fc('0x9')](),controller['setTags']);router[_0x24fc('0x16')](_0x24fc('0xb'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x17')]);router['delete'](_0x24fc('0xb'),auth['isAuthenticated'](),controller[_0x24fc('0x18')]);module[_0x24fc('0x19')]=router; \ No newline at end of file +var _0xb10b=['getFields','/:id/subjects','/:id/descriptions','getTags','post','create','setTags','put','/:id','update','delete','destroy','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','index','isAuthenticated','show','/:id/fields'];(function(_0x2a6657,_0x3419c7){var _0x2db384=function(_0x3f9427){while(--_0x3f9427){_0x2a6657['push'](_0x2a6657['shift']());}};_0x2db384(++_0x3419c7);}(_0xb10b,0x12a));var _0xbb10=function(_0x4f192e,_0x4d1756){_0x4f192e=_0x4f192e-0x0;var _0x49294d=_0xb10b[_0x4f192e];return _0x49294d;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getDescriptions']);router[_0xbb10('0x9')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x12')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router[_0xbb10('0x12')]('/:id/tags',auth[_0xbb10('0xb')](),controller[_0xbb10('0x14')]);router[_0xbb10('0x15')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x18')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 6d049e9..6dfee9b 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 _0xd322=['STRING','sequelize'];(function(_0x55ddae,_0x28a2c8){var _0x5669c3=function(_0x2a53b7){while(--_0x2a53b7){_0x55ddae['push'](_0x55ddae['shift']());}};_0x5669c3(++_0x28a2c8);}(_0xd322,0x141));var _0x2d32=function(_0x42f522,_0x594a2c){_0x42f522=_0x42f522-0x0;var _0x1a1377=_0xd322[_0x42f522];return _0x1a1377;};'use strict';var Sequelize=require(_0x2d32('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x2d32('0x1')]}}; \ No newline at end of file +var _0xd9bb=['STRING','sequelize','exports'];(function(_0x6b77d4,_0x2b5301){var _0x1b94ba=function(_0xfa68af){while(--_0xfa68af){_0x6b77d4['push'](_0x6b77d4['shift']());}};_0x1b94ba(++_0x2b5301);}(_0xd9bb,0x139));var _0xbd9b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd9bb[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xbd9b('0x0'));module[_0xbd9b('0x1')]={'name':{'type':Sequelize[_0xbd9b('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 963404d..4395dea 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 _0x80a8=['ids','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','save','update','destroy','error','stack','name','send','index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','then','includeAll','include','catch','params','find','create','body','getFields','ZendeskField','getSubjects','findOne','getDescriptions','getTags','setTags'];(function(_0x101937,_0x1c9126){var _0x33904f=function(_0x932507){while(--_0x932507){_0x101937['push'](_0x101937['shift']());}};_0x33904f(++_0x1c9126);}(_0x80a8,0xa3));var _0x880a=function(_0x311e77,_0x49a459){_0x311e77=_0x311e77-0x0;var _0x559c54=_0x80a8[_0x311e77];return _0x559c54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x880a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x880a('0x1'));var moment=require(_0x880a('0x2'));var BPromise=require(_0x880a('0x3'));var Mustache=require('mustache');var util=require(_0x880a('0x4'));var path=require(_0x880a('0x5'));var sox=require(_0x880a('0x6'));var csv=require(_0x880a('0x7'));var ejs=require(_0x880a('0x8'));var fs=require('fs');var fs_extra=require(_0x880a('0x9'));var _=require(_0x880a('0xa'));var squel=require(_0x880a('0xb'));var crypto=require(_0x880a('0xc'));var jsforce=require(_0x880a('0xd'));var deskjs=require(_0x880a('0xe'));var toCsv=require(_0x880a('0x7'));var querystring=require('querystring');var Papa=require(_0x880a('0xf'));var Redis=require(_0x880a('0x10'));var authService=require(_0x880a('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x880a('0x12'));var logger=require(_0x880a('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x880a('0x14'));var db=require(_0x880a('0x15'))['db'];function respondWithStatusCode(_0x28258d,_0x24ee5e){_0x24ee5e=_0x24ee5e||0xcc;return function(_0x5aca5c){if(_0x5aca5c){return _0x28258d[_0x880a('0x16')](_0x24ee5e);}return _0x28258d[_0x880a('0x17')](_0x24ee5e)[_0x880a('0x18')]();};}function respondWithResult(_0x4cdbfe,_0x5b138e){_0x5b138e=_0x5b138e||0xc8;return function(_0x3a3644){if(_0x3a3644){return _0x4cdbfe[_0x880a('0x17')](_0x5b138e)[_0x880a('0x19')](_0x3a3644);}};}function respondWithFilteredResult(_0x2b5130,_0x3cdaa1){return function(_0x20db83){if(_0x20db83){var _0x32faae=typeof _0x3cdaa1['offset']===_0x880a('0x1a')&&typeof _0x3cdaa1[_0x880a('0x1b')]===_0x880a('0x1a');var _0xee16ee=_0x20db83[_0x880a('0x1c')];var _0x1a14aa=_0x32faae?0x0:_0x3cdaa1[_0x880a('0x1d')];var _0x431606=_0x32faae?_0x20db83[_0x880a('0x1c')]:_0x3cdaa1[_0x880a('0x1d')]+_0x3cdaa1[_0x880a('0x1b')];var _0x5b471f;if(_0x431606>=_0xee16ee){_0x431606=_0xee16ee;_0x5b471f=0xc8;}else{_0x5b471f=0xce;}_0x2b5130[_0x880a('0x17')](_0x5b471f);return _0x2b5130[_0x880a('0x1e')](_0x880a('0x1f'),_0x1a14aa+'-'+_0x431606+'/'+_0xee16ee)['json'](_0x20db83);}return null;};}function patchUpdates(_0x529d0e){return function(_0x48dd83){try{jsonpatch['apply'](_0x48dd83,_0x529d0e,!![]);}catch(_0x480ee5){return BPromise[_0x880a('0x20')](_0x480ee5);}return _0x48dd83[_0x880a('0x21')]();};}function saveUpdates(_0x4f5086,_0x11dc36){return function(_0x2d85a2){if(_0x2d85a2){return _0x2d85a2[_0x880a('0x22')](_0x4f5086)['then'](function(_0x43a805){return _0x43a805;});}return null;};}function removeEntity(_0x3f6b50,_0xb2c73e){return function(_0x29d5f8){if(_0x29d5f8){return _0x29d5f8[_0x880a('0x23')]()['then'](function(){_0x3f6b50[_0x880a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x247876,_0x26851e){return function(_0x2ef404){if(!_0x2ef404){_0x247876['sendStatus'](0x194);}return _0x2ef404;};}function handleError(_0x1adaab,_0x54c299){_0x54c299=_0x54c299||0x1f4;return function(_0x5dc97f){logger[_0x880a('0x24')](_0x5dc97f[_0x880a('0x25')]);if(_0x5dc97f[_0x880a('0x26')]){delete _0x5dc97f[_0x880a('0x26')];}_0x1adaab['status'](_0x54c299)[_0x880a('0x27')](_0x5dc97f);};}exports[_0x880a('0x28')]=function(_0x271ad4,_0x31ca8e){var _0x4f3fe6={},_0x5c49c9={},_0x3c1beb={'count':0x0,'rows':[]};var _0x593a0b=_[_0x880a('0x29')](db[_0x880a('0x2a')][_0x880a('0x2b')],function(_0x1a5279){return{'name':_0x1a5279[_0x880a('0x2c')],'type':_0x1a5279[_0x880a('0x2d')][_0x880a('0x2e')]};});_0x5c49c9[_0x880a('0x2f')]=_['map'](_0x593a0b,'name');_0x5c49c9['query']=_[_0x880a('0x30')](_0x271ad4[_0x880a('0x31')]);_0x5c49c9[_0x880a('0x32')]=_[_0x880a('0x33')](_0x5c49c9[_0x880a('0x2f')],_0x5c49c9[_0x880a('0x31')]);_0x4f3fe6['attributes']=_[_0x880a('0x33')](_0x5c49c9[_0x880a('0x2f')],qs[_0x880a('0x34')](_0x271ad4['query'][_0x880a('0x34')]));_0x4f3fe6['attributes']=_0x4f3fe6[_0x880a('0x35')][_0x880a('0x36')]?_0x4f3fe6[_0x880a('0x35')]:_0x5c49c9['model'];if(!_0x271ad4[_0x880a('0x31')][_0x880a('0x37')](_0x880a('0x38'))){_0x4f3fe6[_0x880a('0x1b')]=qs[_0x880a('0x1b')](_0x271ad4[_0x880a('0x31')]['limit']);_0x4f3fe6[_0x880a('0x1d')]=qs[_0x880a('0x1d')](_0x271ad4[_0x880a('0x31')][_0x880a('0x1d')]);}_0x4f3fe6[_0x880a('0x39')]=qs[_0x880a('0x3a')](_0x271ad4[_0x880a('0x31')][_0x880a('0x3a')]);_0x4f3fe6[_0x880a('0x3b')]=qs[_0x880a('0x32')](_[_0x880a('0x3c')](_0x271ad4[_0x880a('0x31')],_0x5c49c9[_0x880a('0x32')]),_0x593a0b);if(_0x271ad4[_0x880a('0x31')][_0x880a('0x3d')]){_0x4f3fe6['where']=_[_0x880a('0x3e')](_0x4f3fe6[_0x880a('0x3b')],{'$or':_['map'](_0x593a0b,function(_0x37880e){if(_0x37880e[_0x880a('0x2d')]!==_0x880a('0x3f')){var _0x415db9={};_0x415db9[_0x37880e[_0x880a('0x26')]]={'$like':'%'+_0x271ad4[_0x880a('0x31')][_0x880a('0x3d')]+'%'};return _0x415db9;}})});}_0x4f3fe6=_['merge']({},_0x4f3fe6,_0x271ad4[_0x880a('0x40')]);var _0x45b718={'where':_0x4f3fe6[_0x880a('0x3b')]};return db[_0x880a('0x2a')][_0x880a('0x1c')](_0x45b718)[_0x880a('0x41')](function(_0x531fe8){_0x3c1beb[_0x880a('0x1c')]=_0x531fe8;if(_0x271ad4['query'][_0x880a('0x42')]){_0x4f3fe6[_0x880a('0x43')]=[{'all':!![]}];}return db[_0x880a('0x2a')]['findAll'](_0x4f3fe6);})[_0x880a('0x41')](function(_0x4f6da0){_0x3c1beb['rows']=_0x4f6da0;return _0x3c1beb;})['then'](respondWithFilteredResult(_0x31ca8e,_0x4f3fe6))[_0x880a('0x44')](handleError(_0x31ca8e,null));};exports['show']=function(_0x1fd0d8,_0x500139){var _0xac15d5={'raw':![],'where':{'id':_0x1fd0d8[_0x880a('0x45')]['id']}},_0x2e35c5={};_0x2e35c5[_0x880a('0x2f')]=_[_0x880a('0x30')](db[_0x880a('0x2a')][_0x880a('0x2b')]);_0x2e35c5[_0x880a('0x31')]=_[_0x880a('0x30')](_0x1fd0d8['query']);_0x2e35c5['filters']=_[_0x880a('0x33')](_0x2e35c5[_0x880a('0x2f')],_0x2e35c5['query']);_0xac15d5[_0x880a('0x35')]=_[_0x880a('0x33')](_0x2e35c5['model'],qs[_0x880a('0x34')](_0x1fd0d8[_0x880a('0x31')][_0x880a('0x34')]));_0xac15d5[_0x880a('0x35')]=_0xac15d5[_0x880a('0x35')]['length']?_0xac15d5[_0x880a('0x35')]:_0x2e35c5[_0x880a('0x2f')];if(_0x1fd0d8['query']['includeAll']){_0xac15d5[_0x880a('0x43')]=[{'all':!![]}];}_0xac15d5=_['merge']({},_0xac15d5,_0x1fd0d8['options']);return db[_0x880a('0x2a')][_0x880a('0x46')](_0xac15d5)[_0x880a('0x41')](handleEntityNotFound(_0x500139,null))[_0x880a('0x41')](respondWithResult(_0x500139,null))[_0x880a('0x44')](handleError(_0x500139,null));};exports[_0x880a('0x47')]=function(_0x43364d,_0x2fdb67){return db[_0x880a('0x2a')][_0x880a('0x47')](_0x43364d['body'],{})[_0x880a('0x41')](respondWithResult(_0x2fdb67,0xc9))[_0x880a('0x44')](handleError(_0x2fdb67,null));};exports['update']=function(_0x2ba6e3,_0x2d7f83){if(_0x2ba6e3[_0x880a('0x48')]['id']){delete _0x2ba6e3[_0x880a('0x48')]['id'];}return db[_0x880a('0x2a')][_0x880a('0x46')]({'where':{'id':_0x2ba6e3['params']['id']}})[_0x880a('0x41')](handleEntityNotFound(_0x2d7f83,null))[_0x880a('0x41')](saveUpdates(_0x2ba6e3['body'],null))[_0x880a('0x41')](respondWithResult(_0x2d7f83,null))[_0x880a('0x44')](handleError(_0x2d7f83,null));};exports['destroy']=function(_0x1b14e,_0x456a99){return db[_0x880a('0x2a')][_0x880a('0x46')]({'where':{'id':_0x1b14e['params']['id']}})[_0x880a('0x41')](handleEntityNotFound(_0x456a99,null))[_0x880a('0x41')](removeEntity(_0x456a99,null))[_0x880a('0x44')](handleError(_0x456a99,null));};exports[_0x880a('0x49')]=function(_0xe6fcce,_0x4aca27,_0x2074cd){var _0x53a758={};var _0x299e4f={};var _0x97ffed;var _0x5a508c;return db[_0x880a('0x2a')]['findOne']({'where':{'id':_0xe6fcce[_0x880a('0x45')]['id']}})[_0x880a('0x41')](handleEntityNotFound(_0x4aca27,null))[_0x880a('0x41')](function(_0x1d8c05){if(_0x1d8c05){_0x97ffed=_0x1d8c05;_0x299e4f[_0x880a('0x2f')]=_['keys'](db[_0x880a('0x4a')]['rawAttributes']);_0x299e4f[_0x880a('0x31')]=_['keys'](_0xe6fcce['query']);_0x299e4f['filters']=_[_0x880a('0x33')](_0x299e4f[_0x880a('0x2f')],_0x299e4f[_0x880a('0x31')]);_0x53a758[_0x880a('0x35')]=_[_0x880a('0x33')](_0x299e4f[_0x880a('0x2f')],qs[_0x880a('0x34')](_0xe6fcce[_0x880a('0x31')][_0x880a('0x34')]));_0x53a758['attributes']=_0x53a758[_0x880a('0x35')][_0x880a('0x36')]?_0x53a758['attributes']:_0x299e4f[_0x880a('0x2f')];_0x53a758[_0x880a('0x39')]=qs[_0x880a('0x3a')](_0xe6fcce[_0x880a('0x31')][_0x880a('0x3a')]);_0x53a758[_0x880a('0x3b')]=qs[_0x880a('0x32')](_[_0x880a('0x3c')](_0xe6fcce[_0x880a('0x31')],_0x299e4f[_0x880a('0x32')]));if(_0xe6fcce[_0x880a('0x31')][_0x880a('0x3d')]){_0x53a758[_0x880a('0x3b')]=_[_0x880a('0x3e')](_0x53a758[_0x880a('0x3b')],{'$or':_[_0x880a('0x29')](_0x53a758['attributes'],function(_0x1e7c8a){var _0x458023={};_0x458023[_0x1e7c8a]={'$like':'%'+_0xe6fcce['query']['filter']+'%'};return _0x458023;})});}_0x53a758=_[_0x880a('0x3e')]({},_0x53a758,_0xe6fcce['options']);return _0x97ffed['getFields'](_0x53a758);}})[_0x880a('0x41')](function(_0xcaeb4b){if(_0xcaeb4b){_0x5a508c=_0xcaeb4b[_0x880a('0x36')];if(!_0xe6fcce[_0x880a('0x31')]['hasOwnProperty'](_0x880a('0x38'))){_0x53a758[_0x880a('0x1b')]=qs['limit'](_0xe6fcce[_0x880a('0x31')][_0x880a('0x1b')]);_0x53a758[_0x880a('0x1d')]=qs[_0x880a('0x1d')](_0xe6fcce[_0x880a('0x31')]['offset']);}return _0x97ffed[_0x880a('0x49')](_0x53a758);}})['then'](function(_0x24be4d){if(_0x24be4d){return _0x24be4d?{'count':_0x5a508c,'rows':_0x24be4d}:null;}})['then'](respondWithResult(_0x4aca27,null))[_0x880a('0x44')](handleError(_0x4aca27,null));};exports[_0x880a('0x4b')]=function(_0x5e4aeb,_0x5afd35,_0x3222d0){var _0x1b7311={};var _0x3598b9={};var _0x2efe39;var _0x319506;return db[_0x880a('0x2a')][_0x880a('0x4c')]({'where':{'id':_0x5e4aeb[_0x880a('0x45')]['id']}})['then'](handleEntityNotFound(_0x5afd35,null))[_0x880a('0x41')](function(_0x1bdfaa){if(_0x1bdfaa){_0x2efe39=_0x1bdfaa;_0x3598b9['model']=_[_0x880a('0x30')](db['ZendeskField'][_0x880a('0x2b')]);_0x3598b9[_0x880a('0x31')]=_[_0x880a('0x30')](_0x5e4aeb[_0x880a('0x31')]);_0x3598b9['filters']=_['intersection'](_0x3598b9[_0x880a('0x2f')],_0x3598b9[_0x880a('0x31')]);_0x1b7311[_0x880a('0x35')]=_[_0x880a('0x33')](_0x3598b9[_0x880a('0x2f')],qs[_0x880a('0x34')](_0x5e4aeb['query'][_0x880a('0x34')]));_0x1b7311['attributes']=_0x1b7311[_0x880a('0x35')][_0x880a('0x36')]?_0x1b7311[_0x880a('0x35')]:_0x3598b9[_0x880a('0x2f')];_0x1b7311[_0x880a('0x39')]=qs[_0x880a('0x3a')](_0x5e4aeb[_0x880a('0x31')][_0x880a('0x3a')]);_0x1b7311[_0x880a('0x3b')]=qs['filters'](_[_0x880a('0x3c')](_0x5e4aeb[_0x880a('0x31')],_0x3598b9[_0x880a('0x32')]));if(_0x5e4aeb[_0x880a('0x31')]['filter']){_0x1b7311[_0x880a('0x3b')]=_[_0x880a('0x3e')](_0x1b7311[_0x880a('0x3b')],{'$or':_[_0x880a('0x29')](_0x1b7311[_0x880a('0x35')],function(_0x232896){var _0x316607={};_0x316607[_0x232896]={'$like':'%'+_0x5e4aeb[_0x880a('0x31')]['filter']+'%'};return _0x316607;})});}_0x1b7311=_[_0x880a('0x3e')]({},_0x1b7311,_0x5e4aeb[_0x880a('0x40')]);return _0x2efe39[_0x880a('0x4b')](_0x1b7311);}})['then'](function(_0x30279d){if(_0x30279d){_0x319506=_0x30279d[_0x880a('0x36')];if(!_0x5e4aeb[_0x880a('0x31')]['hasOwnProperty'](_0x880a('0x38'))){_0x1b7311[_0x880a('0x1b')]=qs[_0x880a('0x1b')](_0x5e4aeb[_0x880a('0x31')][_0x880a('0x1b')]);_0x1b7311[_0x880a('0x1d')]=qs[_0x880a('0x1d')](_0x5e4aeb['query']['offset']);}return _0x2efe39[_0x880a('0x4b')](_0x1b7311);}})[_0x880a('0x41')](function(_0xe63e17){if(_0xe63e17){return _0xe63e17?{'count':_0x319506,'rows':_0xe63e17}:null;}})[_0x880a('0x41')](respondWithResult(_0x5afd35,null))[_0x880a('0x44')](handleError(_0x5afd35,null));};exports[_0x880a('0x4d')]=function(_0x3de8d3,_0x2fc3ed,_0x3d5cce){var _0x4c52bd={};var _0x3df959={};var _0x5e9f9b;var _0x3a62d7;return db[_0x880a('0x2a')][_0x880a('0x4c')]({'where':{'id':_0x3de8d3[_0x880a('0x45')]['id']}})[_0x880a('0x41')](handleEntityNotFound(_0x2fc3ed,null))[_0x880a('0x41')](function(_0xfac385){if(_0xfac385){_0x5e9f9b=_0xfac385;_0x3df959[_0x880a('0x2f')]=_[_0x880a('0x30')](db['ZendeskField'][_0x880a('0x2b')]);_0x3df959[_0x880a('0x31')]=_['keys'](_0x3de8d3['query']);_0x3df959[_0x880a('0x32')]=_[_0x880a('0x33')](_0x3df959['model'],_0x3df959[_0x880a('0x31')]);_0x4c52bd[_0x880a('0x35')]=_[_0x880a('0x33')](_0x3df959[_0x880a('0x2f')],qs['fields'](_0x3de8d3['query'][_0x880a('0x34')]));_0x4c52bd[_0x880a('0x35')]=_0x4c52bd['attributes']['length']?_0x4c52bd['attributes']:_0x3df959[_0x880a('0x2f')];_0x4c52bd[_0x880a('0x39')]=qs[_0x880a('0x3a')](_0x3de8d3[_0x880a('0x31')][_0x880a('0x3a')]);_0x4c52bd[_0x880a('0x3b')]=qs[_0x880a('0x32')](_['pick'](_0x3de8d3[_0x880a('0x31')],_0x3df959['filters']));if(_0x3de8d3['query'][_0x880a('0x3d')]){_0x4c52bd[_0x880a('0x3b')]=_[_0x880a('0x3e')](_0x4c52bd[_0x880a('0x3b')],{'$or':_[_0x880a('0x29')](_0x4c52bd[_0x880a('0x35')],function(_0x49d4bd){var _0x62454={};_0x62454[_0x49d4bd]={'$like':'%'+_0x3de8d3['query'][_0x880a('0x3d')]+'%'};return _0x62454;})});}_0x4c52bd=_[_0x880a('0x3e')]({},_0x4c52bd,_0x3de8d3[_0x880a('0x40')]);return _0x5e9f9b[_0x880a('0x4d')](_0x4c52bd);}})[_0x880a('0x41')](function(_0x5031d2){if(_0x5031d2){_0x3a62d7=_0x5031d2[_0x880a('0x36')];if(!_0x3de8d3['query']['hasOwnProperty'](_0x880a('0x38'))){_0x4c52bd[_0x880a('0x1b')]=qs['limit'](_0x3de8d3[_0x880a('0x31')][_0x880a('0x1b')]);_0x4c52bd['offset']=qs[_0x880a('0x1d')](_0x3de8d3['query'][_0x880a('0x1d')]);}return _0x5e9f9b[_0x880a('0x4d')](_0x4c52bd);}})[_0x880a('0x41')](function(_0x453a06){if(_0x453a06){return _0x453a06?{'count':_0x3a62d7,'rows':_0x453a06}:null;}})[_0x880a('0x41')](respondWithResult(_0x2fc3ed,null))[_0x880a('0x44')](handleError(_0x2fc3ed,null));};exports[_0x880a('0x4e')]=function(_0x27c217,_0xa9cc78,_0x44f2cf){var _0x3608a6={};var _0x37a7e8={};var _0x999ea5;var _0x57aee4;return db['ZendeskConfiguration'][_0x880a('0x4c')]({'where':{'id':_0x27c217['params']['id']}})[_0x880a('0x41')](handleEntityNotFound(_0xa9cc78,null))[_0x880a('0x41')](function(_0x34f3ce){if(_0x34f3ce){_0x999ea5=_0x34f3ce;_0x37a7e8[_0x880a('0x2f')]=_[_0x880a('0x30')](db['Tag']['rawAttributes']);_0x37a7e8[_0x880a('0x31')]=_[_0x880a('0x30')](_0x27c217[_0x880a('0x31')]);_0x37a7e8[_0x880a('0x32')]=_[_0x880a('0x33')](_0x37a7e8[_0x880a('0x2f')],_0x37a7e8[_0x880a('0x31')]);_0x3608a6[_0x880a('0x35')]=_[_0x880a('0x33')](_0x37a7e8[_0x880a('0x2f')],qs[_0x880a('0x34')](_0x27c217['query'][_0x880a('0x34')]));_0x3608a6[_0x880a('0x35')]=_0x3608a6[_0x880a('0x35')]['length']?_0x3608a6[_0x880a('0x35')]:_0x37a7e8[_0x880a('0x2f')];_0x3608a6[_0x880a('0x39')]=qs['sort'](_0x27c217[_0x880a('0x31')][_0x880a('0x3a')]);_0x3608a6[_0x880a('0x3b')]=qs[_0x880a('0x32')](_[_0x880a('0x3c')](_0x27c217[_0x880a('0x31')],_0x37a7e8[_0x880a('0x32')]));if(_0x27c217[_0x880a('0x31')][_0x880a('0x3d')]){_0x3608a6[_0x880a('0x3b')]=_['merge'](_0x3608a6[_0x880a('0x3b')],{'$or':_[_0x880a('0x29')](_0x3608a6['attributes'],function(_0x748016){var _0x41c76a={};_0x41c76a[_0x748016]={'$like':'%'+_0x27c217[_0x880a('0x31')][_0x880a('0x3d')]+'%'};return _0x41c76a;})});}_0x3608a6=_[_0x880a('0x3e')]({},_0x3608a6,_0x27c217[_0x880a('0x40')]);return _0x999ea5[_0x880a('0x4e')](_0x3608a6);}})[_0x880a('0x41')](function(_0x34920a){if(_0x34920a){_0x57aee4=_0x34920a['length'];if(!_0x27c217[_0x880a('0x31')]['hasOwnProperty'](_0x880a('0x38'))){_0x3608a6[_0x880a('0x1b')]=qs['limit'](_0x27c217[_0x880a('0x31')][_0x880a('0x1b')]);_0x3608a6[_0x880a('0x1d')]=qs[_0x880a('0x1d')](_0x27c217[_0x880a('0x31')][_0x880a('0x1d')]);}return _0x999ea5[_0x880a('0x4e')](_0x3608a6);}})[_0x880a('0x41')](function(_0x58046b){if(_0x58046b){return _0x58046b?{'count':_0x57aee4,'rows':_0x58046b}:null;}})[_0x880a('0x41')](respondWithResult(_0xa9cc78,null))[_0x880a('0x44')](handleError(_0xa9cc78,null));};exports[_0x880a('0x4f')]=function(_0x2241a2,_0x5dad60,_0x3019fe){if(_0x2241a2['body']['id']){delete _0x2241a2[_0x880a('0x48')]['id'];}return db['ZendeskConfiguration'][_0x880a('0x4c')]({'where':{'id':_0x2241a2[_0x880a('0x45')]['id']}})[_0x880a('0x41')](handleEntityNotFound(_0x5dad60,null))[_0x880a('0x41')](function(_0x8e153){if(_0x8e153){return _0x8e153['setTags'](_0x2241a2[_0x880a('0x48')][_0x880a('0x50')]||[]);}return null;})['then'](respondWithResult(_0x5dad60,null))[_0x880a('0x44')](handleError(_0x5dad60,null));}; \ No newline at end of file +var _0x31bd=['desk.js','querystring','ioredis','../../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','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','name','send','index','fieldName','type','key','model','map','query','keys','intersection','fields','attributes','length','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','ZendeskConfiguration','rawAttributes','includeAll','include','find','create','body','getFields','findOne','hasOwnProperty','getSubjects','ZendeskField','nolimit','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce'];(function(_0x424e17,_0x3df4e2){var _0x367c4e=function(_0x4843e3){while(--_0x4843e3){_0x424e17['push'](_0x424e17['shift']());}};_0x367c4e(++_0x3df4e2);}(_0x31bd,0xf9));var _0xd31b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x31bd[_0x397e5f];return _0x5302b8;};'use strict';var emlformat=require(_0xd31b('0x0'));var rimraf=require(_0xd31b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd31b('0x2'));var rp=require(_0xd31b('0x3'));var moment=require(_0xd31b('0x4'));var BPromise=require(_0xd31b('0x5'));var Mustache=require(_0xd31b('0x6'));var util=require(_0xd31b('0x7'));var path=require(_0xd31b('0x8'));var sox=require(_0xd31b('0x9'));var csv=require(_0xd31b('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd31b('0xb'));var _=require('lodash');var squel=require(_0xd31b('0xc'));var crypto=require(_0xd31b('0xd'));var jsforce=require(_0xd31b('0xe'));var deskjs=require(_0xd31b('0xf'));var toCsv=require(_0xd31b('0xa'));var querystring=require(_0xd31b('0x10'));var Papa=require('papaparse');var Redis=require(_0xd31b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xd31b('0x12'));var as=require(_0xd31b('0x13'));var hardwareService=require(_0xd31b('0x14'));var logger=require(_0xd31b('0x15'))('api');var utils=require(_0xd31b('0x16'));var config=require(_0xd31b('0x17'));var licenseUtil=require(_0xd31b('0x18'));var db=require(_0xd31b('0x19'))['db'];function respondWithStatusCode(_0x962981,_0x20980d){_0x20980d=_0x20980d||0xcc;return function(_0x197c75){if(_0x197c75){return _0x962981[_0xd31b('0x1a')](_0x20980d);}return _0x962981[_0xd31b('0x1b')](_0x20980d)[_0xd31b('0x1c')]();};}function respondWithResult(_0x4ef2b0,_0x13b99d){_0x13b99d=_0x13b99d||0xc8;return function(_0xa38fa9){if(_0xa38fa9){return _0x4ef2b0['status'](_0x13b99d)[_0xd31b('0x1d')](_0xa38fa9);}};}function respondWithFilteredResult(_0x206fdb,_0x3305be){return function(_0x48e302){if(_0x48e302){var _0x1142a7=typeof _0x3305be[_0xd31b('0x1e')]===_0xd31b('0x1f')&&typeof _0x3305be[_0xd31b('0x20')]===_0xd31b('0x1f');var _0x41941c=_0x48e302['count'];var _0x215ffb=_0x1142a7?0x0:_0x3305be[_0xd31b('0x1e')];var _0x49d1d0=_0x1142a7?_0x48e302[_0xd31b('0x21')]:_0x3305be[_0xd31b('0x1e')]+_0x3305be[_0xd31b('0x20')];var _0xdcf86e;if(_0x49d1d0>=_0x41941c){_0x49d1d0=_0x41941c;_0xdcf86e=0xc8;}else{_0xdcf86e=0xce;}_0x206fdb[_0xd31b('0x1b')](_0xdcf86e);return _0x206fdb[_0xd31b('0x22')](_0xd31b('0x23'),_0x215ffb+'-'+_0x49d1d0+'/'+_0x41941c)[_0xd31b('0x1d')](_0x48e302);}return null;};}function patchUpdates(_0x5d8dd2){return function(_0x27dfea){try{jsonpatch[_0xd31b('0x24')](_0x27dfea,_0x5d8dd2,!![]);}catch(_0x4dd6aa){return BPromise[_0xd31b('0x25')](_0x4dd6aa);}return _0x27dfea[_0xd31b('0x26')]();};}function saveUpdates(_0x234d54,_0x2b82a9){return function(_0x2c190a){if(_0x2c190a){return _0x2c190a[_0xd31b('0x27')](_0x234d54)[_0xd31b('0x28')](function(_0x425621){return _0x425621;});}return null;};}function removeEntity(_0x332705,_0xf39869){return function(_0x2f0127){if(_0x2f0127){return _0x2f0127[_0xd31b('0x29')]()[_0xd31b('0x28')](function(){_0x332705['status'](0xcc)[_0xd31b('0x1c')]();});}};}function handleEntityNotFound(_0x4da96c,_0x5e37f2){return function(_0x242cb5){if(!_0x242cb5){_0x4da96c[_0xd31b('0x1a')](0x194);}return _0x242cb5;};}function handleError(_0x366b2e,_0x20b233){_0x20b233=_0x20b233||0x1f4;return function(_0x7d1303){logger[_0xd31b('0x2a')](_0x7d1303['stack']);if(_0x7d1303[_0xd31b('0x2b')]){delete _0x7d1303[_0xd31b('0x2b')];}_0x366b2e[_0xd31b('0x1b')](_0x20b233)[_0xd31b('0x2c')](_0x7d1303);};}exports[_0xd31b('0x2d')]=function(_0x1e5864,_0x33743a){var _0x23e177={},_0xcd7f4a={},_0x16eb6c={'count':0x0,'rows':[]};var _0x2f834f=_['map'](db['ZendeskConfiguration']['rawAttributes'],function(_0x3dca40){return{'name':_0x3dca40[_0xd31b('0x2e')],'type':_0x3dca40[_0xd31b('0x2f')][_0xd31b('0x30')]};});_0xcd7f4a[_0xd31b('0x31')]=_[_0xd31b('0x32')](_0x2f834f,_0xd31b('0x2b'));_0xcd7f4a[_0xd31b('0x33')]=_[_0xd31b('0x34')](_0x1e5864[_0xd31b('0x33')]);_0xcd7f4a['filters']=_[_0xd31b('0x35')](_0xcd7f4a['model'],_0xcd7f4a['query']);_0x23e177['attributes']=_[_0xd31b('0x35')](_0xcd7f4a[_0xd31b('0x31')],qs['fields'](_0x1e5864[_0xd31b('0x33')][_0xd31b('0x36')]));_0x23e177[_0xd31b('0x37')]=_0x23e177['attributes'][_0xd31b('0x38')]?_0x23e177[_0xd31b('0x37')]:_0xcd7f4a[_0xd31b('0x31')];if(!_0x1e5864[_0xd31b('0x33')]['hasOwnProperty']('nolimit')){_0x23e177[_0xd31b('0x20')]=qs['limit'](_0x1e5864[_0xd31b('0x33')]['limit']);_0x23e177['offset']=qs['offset'](_0x1e5864[_0xd31b('0x33')][_0xd31b('0x1e')]);}_0x23e177[_0xd31b('0x39')]=qs[_0xd31b('0x3a')](_0x1e5864['query']['sort']);_0x23e177[_0xd31b('0x3b')]=qs[_0xd31b('0x3c')](_[_0xd31b('0x3d')](_0x1e5864[_0xd31b('0x33')],_0xcd7f4a[_0xd31b('0x3c')]),_0x2f834f);if(_0x1e5864[_0xd31b('0x33')]['filter']){_0x23e177[_0xd31b('0x3b')]=_[_0xd31b('0x3e')](_0x23e177['where'],{'$or':_[_0xd31b('0x32')](_0x2f834f,function(_0x52891b){if(_0x52891b[_0xd31b('0x2f')]!==_0xd31b('0x3f')){var _0x113817={};_0x113817[_0x52891b['name']]={'$like':'%'+_0x1e5864['query'][_0xd31b('0x40')]+'%'};return _0x113817;}})});}_0x23e177=_[_0xd31b('0x3e')]({},_0x23e177,_0x1e5864[_0xd31b('0x41')]);var _0x41f7d2={'where':_0x23e177[_0xd31b('0x3b')]};return db['ZendeskConfiguration'][_0xd31b('0x21')](_0x41f7d2)[_0xd31b('0x28')](function(_0x567e50){_0x16eb6c[_0xd31b('0x21')]=_0x567e50;if(_0x1e5864['query']['includeAll']){_0x23e177['include']=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xd31b('0x42')](_0x23e177);})[_0xd31b('0x28')](function(_0x15f46e){_0x16eb6c[_0xd31b('0x43')]=_0x15f46e;return _0x16eb6c;})['then'](respondWithFilteredResult(_0x33743a,_0x23e177))[_0xd31b('0x44')](handleError(_0x33743a,null));};exports[_0xd31b('0x45')]=function(_0x25be94,_0xf8a03c){var _0x4b8226={'raw':![],'where':{'id':_0x25be94[_0xd31b('0x46')]['id']}},_0x516dc8={};_0x516dc8[_0xd31b('0x31')]=_[_0xd31b('0x34')](db[_0xd31b('0x47')][_0xd31b('0x48')]);_0x516dc8[_0xd31b('0x33')]=_[_0xd31b('0x34')](_0x25be94[_0xd31b('0x33')]);_0x516dc8['filters']=_[_0xd31b('0x35')](_0x516dc8[_0xd31b('0x31')],_0x516dc8['query']);_0x4b8226[_0xd31b('0x37')]=_[_0xd31b('0x35')](_0x516dc8['model'],qs[_0xd31b('0x36')](_0x25be94[_0xd31b('0x33')][_0xd31b('0x36')]));_0x4b8226[_0xd31b('0x37')]=_0x4b8226[_0xd31b('0x37')]['length']?_0x4b8226['attributes']:_0x516dc8[_0xd31b('0x31')];if(_0x25be94[_0xd31b('0x33')][_0xd31b('0x49')]){_0x4b8226[_0xd31b('0x4a')]=[{'all':!![]}];}_0x4b8226=_[_0xd31b('0x3e')]({},_0x4b8226,_0x25be94['options']);return db['ZendeskConfiguration'][_0xd31b('0x4b')](_0x4b8226)['then'](handleEntityNotFound(_0xf8a03c,null))[_0xd31b('0x28')](respondWithResult(_0xf8a03c,null))[_0xd31b('0x44')](handleError(_0xf8a03c,null));};exports[_0xd31b('0x4c')]=function(_0x24a8e8,_0x5df79){return db['ZendeskConfiguration'][_0xd31b('0x4c')](_0x24a8e8[_0xd31b('0x4d')],{})[_0xd31b('0x28')](respondWithResult(_0x5df79,0xc9))[_0xd31b('0x44')](handleError(_0x5df79,null));};exports[_0xd31b('0x27')]=function(_0x58bb18,_0x77141b){if(_0x58bb18[_0xd31b('0x4d')]['id']){delete _0x58bb18[_0xd31b('0x4d')]['id'];}return db[_0xd31b('0x47')][_0xd31b('0x4b')]({'where':{'id':_0x58bb18[_0xd31b('0x46')]['id']}})[_0xd31b('0x28')](handleEntityNotFound(_0x77141b,null))['then'](saveUpdates(_0x58bb18[_0xd31b('0x4d')],null))[_0xd31b('0x28')](respondWithResult(_0x77141b,null))['catch'](handleError(_0x77141b,null));};exports['destroy']=function(_0x33e953,_0x563dad){return db[_0xd31b('0x47')][_0xd31b('0x4b')]({'where':{'id':_0x33e953[_0xd31b('0x46')]['id']}})[_0xd31b('0x28')](handleEntityNotFound(_0x563dad,null))['then'](removeEntity(_0x563dad,null))['catch'](handleError(_0x563dad,null));};exports[_0xd31b('0x4e')]=function(_0x357b90,_0x4bd91c,_0x3141a9){var _0x4735a9={};var _0x266b41={};var _0x12f04d;var _0xae4def;return db[_0xd31b('0x47')][_0xd31b('0x4f')]({'where':{'id':_0x357b90[_0xd31b('0x46')]['id']}})['then'](handleEntityNotFound(_0x4bd91c,null))[_0xd31b('0x28')](function(_0x354dc4){if(_0x354dc4){_0x12f04d=_0x354dc4;_0x266b41['model']=_['keys'](db['ZendeskField'][_0xd31b('0x48')]);_0x266b41['query']=_['keys'](_0x357b90['query']);_0x266b41[_0xd31b('0x3c')]=_['intersection'](_0x266b41[_0xd31b('0x31')],_0x266b41[_0xd31b('0x33')]);_0x4735a9['attributes']=_[_0xd31b('0x35')](_0x266b41['model'],qs[_0xd31b('0x36')](_0x357b90[_0xd31b('0x33')][_0xd31b('0x36')]));_0x4735a9[_0xd31b('0x37')]=_0x4735a9[_0xd31b('0x37')]['length']?_0x4735a9['attributes']:_0x266b41[_0xd31b('0x31')];_0x4735a9[_0xd31b('0x39')]=qs[_0xd31b('0x3a')](_0x357b90[_0xd31b('0x33')]['sort']);_0x4735a9[_0xd31b('0x3b')]=qs['filters'](_[_0xd31b('0x3d')](_0x357b90['query'],_0x266b41['filters']));if(_0x357b90[_0xd31b('0x33')]['filter']){_0x4735a9['where']=_[_0xd31b('0x3e')](_0x4735a9[_0xd31b('0x3b')],{'$or':_['map'](_0x4735a9[_0xd31b('0x37')],function(_0x2d5d31){var _0x43920f={};_0x43920f[_0x2d5d31]={'$like':'%'+_0x357b90[_0xd31b('0x33')][_0xd31b('0x40')]+'%'};return _0x43920f;})});}_0x4735a9=_[_0xd31b('0x3e')]({},_0x4735a9,_0x357b90[_0xd31b('0x41')]);return _0x12f04d[_0xd31b('0x4e')](_0x4735a9);}})['then'](function(_0x2b6d15){if(_0x2b6d15){_0xae4def=_0x2b6d15[_0xd31b('0x38')];if(!_0x357b90[_0xd31b('0x33')][_0xd31b('0x50')]('nolimit')){_0x4735a9['limit']=qs[_0xd31b('0x20')](_0x357b90[_0xd31b('0x33')][_0xd31b('0x20')]);_0x4735a9['offset']=qs[_0xd31b('0x1e')](_0x357b90[_0xd31b('0x33')]['offset']);}return _0x12f04d[_0xd31b('0x4e')](_0x4735a9);}})[_0xd31b('0x28')](function(_0x169449){if(_0x169449){return _0x169449?{'count':_0xae4def,'rows':_0x169449}:null;}})[_0xd31b('0x28')](respondWithResult(_0x4bd91c,null))['catch'](handleError(_0x4bd91c,null));};exports[_0xd31b('0x51')]=function(_0x333249,_0x101fd6,_0x36e721){var _0x6430be={};var _0x4ff9a9={};var _0x99d4d4;var _0x53421a;return db[_0xd31b('0x47')]['findOne']({'where':{'id':_0x333249[_0xd31b('0x46')]['id']}})['then'](handleEntityNotFound(_0x101fd6,null))[_0xd31b('0x28')](function(_0x7f3216){if(_0x7f3216){_0x99d4d4=_0x7f3216;_0x4ff9a9[_0xd31b('0x31')]=_[_0xd31b('0x34')](db[_0xd31b('0x52')][_0xd31b('0x48')]);_0x4ff9a9[_0xd31b('0x33')]=_[_0xd31b('0x34')](_0x333249[_0xd31b('0x33')]);_0x4ff9a9['filters']=_['intersection'](_0x4ff9a9[_0xd31b('0x31')],_0x4ff9a9['query']);_0x6430be[_0xd31b('0x37')]=_[_0xd31b('0x35')](_0x4ff9a9[_0xd31b('0x31')],qs[_0xd31b('0x36')](_0x333249[_0xd31b('0x33')][_0xd31b('0x36')]));_0x6430be[_0xd31b('0x37')]=_0x6430be[_0xd31b('0x37')]['length']?_0x6430be['attributes']:_0x4ff9a9[_0xd31b('0x31')];_0x6430be[_0xd31b('0x39')]=qs[_0xd31b('0x3a')](_0x333249[_0xd31b('0x33')][_0xd31b('0x3a')]);_0x6430be[_0xd31b('0x3b')]=qs[_0xd31b('0x3c')](_[_0xd31b('0x3d')](_0x333249[_0xd31b('0x33')],_0x4ff9a9['filters']));if(_0x333249['query'][_0xd31b('0x40')]){_0x6430be[_0xd31b('0x3b')]=_['merge'](_0x6430be['where'],{'$or':_[_0xd31b('0x32')](_0x6430be[_0xd31b('0x37')],function(_0x4bda4a){var _0x209536={};_0x209536[_0x4bda4a]={'$like':'%'+_0x333249[_0xd31b('0x33')]['filter']+'%'};return _0x209536;})});}_0x6430be=_[_0xd31b('0x3e')]({},_0x6430be,_0x333249[_0xd31b('0x41')]);return _0x99d4d4[_0xd31b('0x51')](_0x6430be);}})[_0xd31b('0x28')](function(_0x10265d){if(_0x10265d){_0x53421a=_0x10265d[_0xd31b('0x38')];if(!_0x333249[_0xd31b('0x33')][_0xd31b('0x50')](_0xd31b('0x53'))){_0x6430be[_0xd31b('0x20')]=qs['limit'](_0x333249[_0xd31b('0x33')]['limit']);_0x6430be[_0xd31b('0x1e')]=qs[_0xd31b('0x1e')](_0x333249[_0xd31b('0x33')][_0xd31b('0x1e')]);}return _0x99d4d4[_0xd31b('0x51')](_0x6430be);}})['then'](function(_0x4efa5d){if(_0x4efa5d){return _0x4efa5d?{'count':_0x53421a,'rows':_0x4efa5d}:null;}})['then'](respondWithResult(_0x101fd6,null))[_0xd31b('0x44')](handleError(_0x101fd6,null));};exports[_0xd31b('0x54')]=function(_0x2c8ff3,_0xed3e67,_0x547316){var _0xc32670={};var _0x195bc0={};var _0x93bd6b;var _0x1ee6db;return db[_0xd31b('0x47')][_0xd31b('0x4f')]({'where':{'id':_0x2c8ff3['params']['id']}})[_0xd31b('0x28')](handleEntityNotFound(_0xed3e67,null))[_0xd31b('0x28')](function(_0x31c0cd){if(_0x31c0cd){_0x93bd6b=_0x31c0cd;_0x195bc0['model']=_[_0xd31b('0x34')](db['ZendeskField']['rawAttributes']);_0x195bc0[_0xd31b('0x33')]=_[_0xd31b('0x34')](_0x2c8ff3[_0xd31b('0x33')]);_0x195bc0[_0xd31b('0x3c')]=_[_0xd31b('0x35')](_0x195bc0[_0xd31b('0x31')],_0x195bc0[_0xd31b('0x33')]);_0xc32670['attributes']=_[_0xd31b('0x35')](_0x195bc0['model'],qs[_0xd31b('0x36')](_0x2c8ff3['query'][_0xd31b('0x36')]));_0xc32670[_0xd31b('0x37')]=_0xc32670[_0xd31b('0x37')]['length']?_0xc32670[_0xd31b('0x37')]:_0x195bc0[_0xd31b('0x31')];_0xc32670[_0xd31b('0x39')]=qs[_0xd31b('0x3a')](_0x2c8ff3[_0xd31b('0x33')][_0xd31b('0x3a')]);_0xc32670['where']=qs[_0xd31b('0x3c')](_['pick'](_0x2c8ff3[_0xd31b('0x33')],_0x195bc0['filters']));if(_0x2c8ff3['query']['filter']){_0xc32670[_0xd31b('0x3b')]=_[_0xd31b('0x3e')](_0xc32670[_0xd31b('0x3b')],{'$or':_[_0xd31b('0x32')](_0xc32670['attributes'],function(_0x51ae15){var _0x2bd36d={};_0x2bd36d[_0x51ae15]={'$like':'%'+_0x2c8ff3['query'][_0xd31b('0x40')]+'%'};return _0x2bd36d;})});}_0xc32670=_[_0xd31b('0x3e')]({},_0xc32670,_0x2c8ff3[_0xd31b('0x41')]);return _0x93bd6b[_0xd31b('0x54')](_0xc32670);}})[_0xd31b('0x28')](function(_0x25952b){if(_0x25952b){_0x1ee6db=_0x25952b[_0xd31b('0x38')];if(!_0x2c8ff3['query'][_0xd31b('0x50')]('nolimit')){_0xc32670[_0xd31b('0x20')]=qs['limit'](_0x2c8ff3[_0xd31b('0x33')]['limit']);_0xc32670['offset']=qs[_0xd31b('0x1e')](_0x2c8ff3['query'][_0xd31b('0x1e')]);}return _0x93bd6b[_0xd31b('0x54')](_0xc32670);}})[_0xd31b('0x28')](function(_0x3320fc){if(_0x3320fc){return _0x3320fc?{'count':_0x1ee6db,'rows':_0x3320fc}:null;}})['then'](respondWithResult(_0xed3e67,null))[_0xd31b('0x44')](handleError(_0xed3e67,null));};exports[_0xd31b('0x55')]=function(_0x35fec0,_0x2fe5ac,_0x4cc76d){var _0x3dbc68={};var _0x2a0b14={};var _0x4c824b;var _0xee3fee;return db[_0xd31b('0x47')][_0xd31b('0x4f')]({'where':{'id':_0x35fec0[_0xd31b('0x46')]['id']}})['then'](handleEntityNotFound(_0x2fe5ac,null))[_0xd31b('0x28')](function(_0x3788af){if(_0x3788af){_0x4c824b=_0x3788af;_0x2a0b14[_0xd31b('0x31')]=_['keys'](db['Tag'][_0xd31b('0x48')]);_0x2a0b14['query']=_[_0xd31b('0x34')](_0x35fec0[_0xd31b('0x33')]);_0x2a0b14[_0xd31b('0x3c')]=_[_0xd31b('0x35')](_0x2a0b14[_0xd31b('0x31')],_0x2a0b14[_0xd31b('0x33')]);_0x3dbc68[_0xd31b('0x37')]=_[_0xd31b('0x35')](_0x2a0b14[_0xd31b('0x31')],qs[_0xd31b('0x36')](_0x35fec0[_0xd31b('0x33')][_0xd31b('0x36')]));_0x3dbc68[_0xd31b('0x37')]=_0x3dbc68[_0xd31b('0x37')]['length']?_0x3dbc68[_0xd31b('0x37')]:_0x2a0b14[_0xd31b('0x31')];_0x3dbc68[_0xd31b('0x39')]=qs[_0xd31b('0x3a')](_0x35fec0[_0xd31b('0x33')][_0xd31b('0x3a')]);_0x3dbc68['where']=qs[_0xd31b('0x3c')](_[_0xd31b('0x3d')](_0x35fec0['query'],_0x2a0b14[_0xd31b('0x3c')]));if(_0x35fec0[_0xd31b('0x33')][_0xd31b('0x40')]){_0x3dbc68[_0xd31b('0x3b')]=_[_0xd31b('0x3e')](_0x3dbc68[_0xd31b('0x3b')],{'$or':_[_0xd31b('0x32')](_0x3dbc68[_0xd31b('0x37')],function(_0x3221b8){var _0xb5dd1d={};_0xb5dd1d[_0x3221b8]={'$like':'%'+_0x35fec0[_0xd31b('0x33')]['filter']+'%'};return _0xb5dd1d;})});}_0x3dbc68=_[_0xd31b('0x3e')]({},_0x3dbc68,_0x35fec0['options']);return _0x4c824b['getTags'](_0x3dbc68);}})[_0xd31b('0x28')](function(_0xbafdc8){if(_0xbafdc8){_0xee3fee=_0xbafdc8['length'];if(!_0x35fec0[_0xd31b('0x33')]['hasOwnProperty']('nolimit')){_0x3dbc68[_0xd31b('0x20')]=qs[_0xd31b('0x20')](_0x35fec0[_0xd31b('0x33')][_0xd31b('0x20')]);_0x3dbc68[_0xd31b('0x1e')]=qs[_0xd31b('0x1e')](_0x35fec0[_0xd31b('0x33')]['offset']);}return _0x4c824b[_0xd31b('0x55')](_0x3dbc68);}})['then'](function(_0x52e1d7){if(_0x52e1d7){return _0x52e1d7?{'count':_0xee3fee,'rows':_0x52e1d7}:null;}})[_0xd31b('0x28')](respondWithResult(_0x2fe5ac,null))[_0xd31b('0x44')](handleError(_0x2fe5ac,null));};exports[_0xd31b('0x56')]=function(_0x1bdcd5,_0x3cd303,_0x4161b1){if(_0x1bdcd5[_0xd31b('0x4d')]['id']){delete _0x1bdcd5['body']['id'];}return db['ZendeskConfiguration']['findOne']({'where':{'id':_0x1bdcd5[_0xd31b('0x46')]['id']}})['then'](handleEntityNotFound(_0x3cd303,null))[_0xd31b('0x28')](function(_0x5eb31b){if(_0x5eb31b){return _0x5eb31b[_0xd31b('0x56')](_0x1bdcd5['body'][_0xd31b('0x57')]||[]);}return null;})['then'](respondWithResult(_0x3cd303,null))[_0xd31b('0x44')](handleError(_0x3cd303,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index fea4159..503e30e 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 _0xf4f4=['util','api','moment','bluebird','request-promise','path','../../config/environment','exports','define','ZendeskConfiguration','int_zendesk_configurations','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf4f4,0xe3));var _0x4f4f=function(_0x4274ec,_0x34c2f3){_0x4274ec=_0x4274ec-0x0;var _0x5e73e7=_0xf4f4[_0x4274ec];return _0x5e73e7;};'use strict';var _=require(_0x4f4f('0x0'));var util=require(_0x4f4f('0x1'));var logger=require('../../config/logger')(_0x4f4f('0x2'));var moment=require(_0x4f4f('0x3'));var BPromise=require(_0x4f4f('0x4'));var rp=require(_0x4f4f('0x5'));var fs=require('fs');var path=require(_0x4f4f('0x6'));var rimraf=require('rimraf');var config=require(_0x4f4f('0x7'));var attributes=require('./intZendeskConfiguration.attributes');module[_0x4f4f('0x8')]=function(_0x132d5c,_0x20ee6e){return _0x132d5c[_0x4f4f('0x9')](_0x4f4f('0xa'),attributes,{'tableName':_0x4f4f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6e6c=['moment','path','../../config/environment','exports','define','ZendeskConfiguration','lodash','util','api'];(function(_0x3e82a5,_0x9fcb34){var _0x33eae5=function(_0x430c9c){while(--_0x430c9c){_0x3e82a5['push'](_0x3e82a5['shift']());}};_0x33eae5(++_0x9fcb34);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6e6c[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var logger=require('../../config/logger')(_0xc6e6('0x2'));var moment=require(_0xc6e6('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc6e6('0x4'));var rimraf=require('rimraf');var config=require(_0xc6e6('0x5'));var attributes=require('./intZendeskConfiguration.attributes');module[_0xc6e6('0x6')]=function(_0x1182c7,_0x4bf906){return _0x1182c7[_0xc6e6('0x7')](_0xc6e6('0x8'),attributes,{'tableName':'int_zendesk_configurations','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 7330781..cae452c 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 _0x345d=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info'];(function(_0x221d1c,_0x10bab8){var _0x798283=function(_0x1cdb1b){while(--_0x1cdb1b){_0x221d1c['push'](_0x221d1c['shift']());}};_0x798283(++_0x10bab8);}(_0x345d,0x1ec));var _0xd345=function(_0x5bdaa2,_0x1eb255){_0x5bdaa2=_0x5bdaa2-0x0;var _0x56acaf=_0x345d[_0x5bdaa2];return _0x56acaf;};'use strict';var _=require('lodash');var util=require(_0xd345('0x0'));var moment=require(_0xd345('0x1'));var BPromise=require('bluebird');var rs=require(_0xd345('0x2'));var fs=require('fs');var Redis=require(_0xd345('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd345('0x4'));var logger=require(_0xd345('0x5'))(_0xd345('0x6'));var config=require(_0xd345('0x7'));var jayson=require(_0xd345('0x8'));var client=jayson[_0xd345('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x179a77,_0xc1bb39,_0x587cc0){return new BPromise(function(_0x3da4ba,_0x51ea8d){return client['request'](_0x179a77,_0x587cc0)[_0xd345('0xa')](function(_0x4ffeac){logger[_0xd345('0xb')](_0xd345('0xc'),_0xc1bb39,_0xd345('0xd'));logger[_0xd345('0xe')](_0xd345('0xf'),_0xc1bb39,_0xd345('0xd'),JSON['stringify'](_0x4ffeac));if(_0x4ffeac['error']){if(_0x4ffeac[_0xd345('0x10')][_0xd345('0x11')]===0x1f4){logger[_0xd345('0x10')](_0xd345('0xc'),_0xc1bb39,_0x4ffeac[_0xd345('0x10')][_0xd345('0x12')]);return _0x51ea8d(_0x4ffeac[_0xd345('0x10')][_0xd345('0x12')]);}logger['error'](_0xd345('0xc'),_0xc1bb39,_0x4ffeac[_0xd345('0x10')][_0xd345('0x12')]);return _0x3da4ba(_0x4ffeac[_0xd345('0x10')][_0xd345('0x12')]);}else{logger[_0xd345('0xb')]('ZendeskConfiguration,\x20%s,\x20%s',_0xc1bb39,_0xd345('0xd'));_0x3da4ba(_0x4ffeac[_0xd345('0x13')]['message']);}})[_0xd345('0x14')](function(_0x415113){logger['error'](_0xd345('0xc'),_0xc1bb39,_0x415113);_0x51ea8d(_0x415113);});});} \ No newline at end of file +var _0x90ff=['http','request','then','info','request\x20sent','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','code','error','ZendeskConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4d9d48,_0x4acd03){var _0xc9a95b=function(_0x1f89f8){while(--_0x1f89f8){_0x4d9d48['push'](_0x4d9d48['shift']());}};_0xc9a95b(++_0x4acd03);}(_0x90ff,0xfe));var _0xf90f=function(_0x5149fe,_0x20776d){_0x5149fe=_0x5149fe-0x0;var _0xb27315=_0x90ff[_0x5149fe];return _0xb27315;};'use strict';var _=require(_0xf90f('0x0'));var util=require(_0xf90f('0x1'));var moment=require(_0xf90f('0x2'));var BPromise=require(_0xf90f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf90f('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf90f('0x5'));var logger=require(_0xf90f('0x6'))(_0xf90f('0x7'));var config=require(_0xf90f('0x8'));var jayson=require(_0xf90f('0x9'));var client=jayson['client'][_0xf90f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1c131b,_0x2dc09c,_0x2a7191){return new BPromise(function(_0x1425db,_0x493a39){return client[_0xf90f('0xb')](_0x1c131b,_0x2a7191)[_0xf90f('0xc')](function(_0x10fff5){logger[_0xf90f('0xd')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2dc09c,_0xf90f('0xe'));logger['debug'](_0xf90f('0xf'),_0x2dc09c,_0xf90f('0xe'),JSON['stringify'](_0x10fff5));if(_0x10fff5['error']){if(_0x10fff5['error'][_0xf90f('0x10')]===0x1f4){logger[_0xf90f('0x11')](_0xf90f('0x12'),_0x2dc09c,_0x10fff5['error']['message']);return _0x493a39(_0x10fff5[_0xf90f('0x11')][_0xf90f('0x13')]);}logger[_0xf90f('0x11')](_0xf90f('0x12'),_0x2dc09c,_0x10fff5[_0xf90f('0x11')][_0xf90f('0x13')]);return _0x1425db(_0x10fff5['error'][_0xf90f('0x13')]);}else{logger[_0xf90f('0xd')](_0xf90f('0x12'),_0x2dc09c,_0xf90f('0xe'));_0x1425db(_0x10fff5[_0xf90f('0x14')][_0xf90f('0x13')]);}})[_0xf90f('0x15')](function(_0x3312ca){logger['error'](_0xf90f('0x12'),_0x2dc09c,_0x3312ca);_0x493a39(_0x3312ca);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 5012ba2..fdf5395 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 _0x55c2=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','index','get','/:id','post','isAuthenticated','put','update','delete','destroy','multer','util','path','connect-timeout','fs-extra','../../components/auth/service'];(function(_0x65c50e,_0x1aa926){var _0x4573e7=function(_0x5bc049){while(--_0x5bc049){_0x65c50e['push'](_0x65c50e['shift']());}};_0x4573e7(++_0x1aa926);}(_0x55c2,0x1bc));var _0x255c=function(_0x3671d7,_0x586bbc){_0x3671d7=_0x3671d7-0x0;var _0xf9f6e6=_0x55c2[_0x3671d7];return _0xf9f6e6;};'use strict';var multer=require(_0x255c('0x0'));var util=require(_0x255c('0x1'));var path=require(_0x255c('0x2'));var timeout=require(_0x255c('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x255c('0x4'));var auth=require(_0x255c('0x5'));var interaction=require(_0x255c('0x6'));var config=require(_0x255c('0x7'));var controller=require(_0x255c('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x255c('0x9')]);router[_0x255c('0xa')](_0x255c('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x255c('0xc')]('/',auth[_0x255c('0xd')](),controller['create']);router[_0x255c('0xe')](_0x255c('0xb'),auth[_0x255c('0xd')](),controller[_0x255c('0xf')]);router[_0x255c('0x10')](_0x255c('0xb'),auth[_0x255c('0xd')](),controller[_0x255c('0x11')]);module['exports']=router; \ No newline at end of file +var _0xa184=['create','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post'];(function(_0x463071,_0xf916de){var _0x3106a0=function(_0x1d8074){while(--_0x1d8074){_0x463071['push'](_0x463071['shift']());}};_0x3106a0(++_0xf916de);}(_0xa184,0xb9));var _0x4a18=function(_0x47568e,_0x5ccdaf){_0x47568e=_0x47568e-0x0;var _0x33815b=_0xa184[_0x47568e];return _0x33815b;};'use strict';var multer=require(_0x4a18('0x0'));var util=require(_0x4a18('0x1'));var path=require(_0x4a18('0x2'));var timeout=require('connect-timeout');var express=require(_0x4a18('0x3'));var router=express[_0x4a18('0x4')]();var fs_extra=require(_0x4a18('0x5'));var auth=require(_0x4a18('0x6'));var interaction=require(_0x4a18('0x7'));var config=require(_0x4a18('0x8'));var controller=require('./intZendeskField.controller');router['get']('/',auth[_0x4a18('0x9')](),controller[_0x4a18('0xa')]);router[_0x4a18('0xb')](_0x4a18('0xc'),auth[_0x4a18('0x9')](),controller[_0x4a18('0xd')]);router[_0x4a18('0xe')]('/',auth['isAuthenticated'](),controller[_0x4a18('0xf')]);router['put'](_0x4a18('0xc'),auth['isAuthenticated'](),controller[_0x4a18('0x10')]);router[_0x4a18('0x11')](_0x4a18('0xc'),auth['isAuthenticated'](),controller[_0x4a18('0x12')]);module[_0x4a18('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index dc29fd0..6963600 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 _0xa223=['BOOLEAN','sequelize','exports','ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x22f8ab,_0x15d8ff){var _0x2a70e5=function(_0x5e6895){while(--_0x5e6895){_0x22f8ab['push'](_0x22f8ab['shift']());}};_0x2a70e5(++_0x15d8ff);}(_0xa223,0xe7));var _0x3a22=function(_0x4b6003,_0x1fe96f){_0x4b6003=_0x4b6003-0x0;var _0x15ec96=_0xa223[_0x4b6003];return _0x15ec96;};'use strict';var Sequelize=require(_0x3a22('0x0'));module[_0x3a22('0x1')]={'type':{'type':Sequelize[_0x3a22('0x2')](_0x3a22('0x3'),'variable',_0x3a22('0x4'),_0x3a22('0x5'),_0x3a22('0x6')),'defaultValue':_0x3a22('0x3')},'content':{'type':Sequelize[_0x3a22('0x7')]},'key':{'type':Sequelize[_0x3a22('0x7')]},'keyType':{'type':Sequelize[_0x3a22('0x2')]('string',_0x3a22('0x8'),_0x3a22('0x4'))},'keyContent':{'type':Sequelize[_0x3a22('0x7')]},'idField':{'type':Sequelize[_0x3a22('0x7')]},'nameField':{'type':Sequelize[_0x3a22('0x7')]},'customField':{'type':Sequelize[_0x3a22('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x1c7e=['STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x170f34,_0x212ed2){var _0x3630ab=function(_0x22523c){while(--_0x22523c){_0x170f34['push'](_0x170f34['shift']());}};_0x3630ab(++_0x212ed2);}(_0x1c7e,0x92));var _0xe1c7=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x1c7e[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xe1c7('0x0'));module[_0xe1c7('0x1')]={'type':{'type':Sequelize[_0xe1c7('0x2')](_0xe1c7('0x3'),_0xe1c7('0x4'),_0xe1c7('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xe1c7('0x6')]},'key':{'type':Sequelize[_0xe1c7('0x6')]},'keyType':{'type':Sequelize[_0xe1c7('0x2')](_0xe1c7('0x3'),'variable',_0xe1c7('0x5'))},'keyContent':{'type':Sequelize[_0xe1c7('0x6')]},'idField':{'type':Sequelize[_0xe1c7('0x6')]},'nameField':{'type':Sequelize[_0xe1c7('0x6')]},'customField':{'type':Sequelize[_0xe1c7('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xe1c7('0x6')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index d47ac67..8e9ecbc 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 _0x7b19=['body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','count','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','ZendeskField','includeAll','include','findAll','rows','catch','show','params','merge','find','create'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x7b19,0x1b7));var _0x97b1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7b19[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x97b1('0x0'));var zipdir=require(_0x97b1('0x1'));var jsonpatch=require(_0x97b1('0x2'));var rp=require('request-promise');var moment=require(_0x97b1('0x3'));var BPromise=require(_0x97b1('0x4'));var Mustache=require(_0x97b1('0x5'));var util=require(_0x97b1('0x6'));var path=require(_0x97b1('0x7'));var sox=require(_0x97b1('0x8'));var csv=require(_0x97b1('0x9'));var ejs=require(_0x97b1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x97b1('0xb'));var squel=require(_0x97b1('0xc'));var crypto=require(_0x97b1('0xd'));var jsforce=require(_0x97b1('0xe'));var deskjs=require(_0x97b1('0xf'));var toCsv=require(_0x97b1('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x97b1('0x10'));var authService=require(_0x97b1('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x97b1('0x12'));var hardwareService=require(_0x97b1('0x13'));var logger=require(_0x97b1('0x14'))(_0x97b1('0x15'));var utils=require(_0x97b1('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x97b1('0x17'));var db=require(_0x97b1('0x18'))['db'];function respondWithStatusCode(_0x5840bd,_0x563824){_0x563824=_0x563824||0xcc;return function(_0x3a149e){if(_0x3a149e){return _0x5840bd['sendStatus'](_0x563824);}return _0x5840bd[_0x97b1('0x19')](_0x563824)[_0x97b1('0x1a')]();};}function respondWithResult(_0x4619b2,_0xc78eb2){_0xc78eb2=_0xc78eb2||0xc8;return function(_0x2eb390){if(_0x2eb390){return _0x4619b2[_0x97b1('0x19')](_0xc78eb2)[_0x97b1('0x1b')](_0x2eb390);}};}function respondWithFilteredResult(_0x294643,_0x5d9dd3){return function(_0x1653b8){if(_0x1653b8){var _0x4ee206=typeof _0x5d9dd3[_0x97b1('0x1c')]==='undefined'&&typeof _0x5d9dd3[_0x97b1('0x1d')]==='undefined';var _0x250d8d=_0x1653b8[_0x97b1('0x1e')];var _0x2860c4=_0x4ee206?0x0:_0x5d9dd3[_0x97b1('0x1c')];var _0x36532c=_0x4ee206?_0x1653b8[_0x97b1('0x1e')]:_0x5d9dd3[_0x97b1('0x1c')]+_0x5d9dd3['limit'];var _0x56b0d3;if(_0x36532c>=_0x250d8d){_0x36532c=_0x250d8d;_0x56b0d3=0xc8;}else{_0x56b0d3=0xce;}_0x294643[_0x97b1('0x19')](_0x56b0d3);return _0x294643['set']('Content-Range',_0x2860c4+'-'+_0x36532c+'/'+_0x250d8d)['json'](_0x1653b8);}return null;};}function patchUpdates(_0x42ec53){return function(_0x5819c0){try{jsonpatch[_0x97b1('0x1f')](_0x5819c0,_0x42ec53,!![]);}catch(_0x4f0db9){return BPromise[_0x97b1('0x20')](_0x4f0db9);}return _0x5819c0[_0x97b1('0x21')]();};}function saveUpdates(_0x5cbcb2,_0x129eec){return function(_0x20b3ff){if(_0x20b3ff){return _0x20b3ff[_0x97b1('0x22')](_0x5cbcb2)[_0x97b1('0x23')](function(_0x1c5108){return _0x1c5108;});}return null;};}function removeEntity(_0x302405,_0xaa56fa){return function(_0x3028de){if(_0x3028de){return _0x3028de[_0x97b1('0x24')]()['then'](function(){_0x302405[_0x97b1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x569dee,_0x4bc351){return function(_0x5bd2dd){if(!_0x5bd2dd){_0x569dee[_0x97b1('0x25')](0x194);}return _0x5bd2dd;};}function handleError(_0x4a19c2,_0x3defcc){_0x3defcc=_0x3defcc||0x1f4;return function(_0x2b8b08){logger[_0x97b1('0x26')](_0x2b8b08[_0x97b1('0x27')]);if(_0x2b8b08[_0x97b1('0x28')]){delete _0x2b8b08['name'];}_0x4a19c2[_0x97b1('0x19')](_0x3defcc)[_0x97b1('0x29')](_0x2b8b08);};}exports[_0x97b1('0x2a')]=function(_0x21f810,_0x4d01b1){var _0x5b3d95={},_0x18fb67={},_0x200836={'count':0x0,'rows':[]};var _0x3b3093=_[_0x97b1('0x2b')](db['ZendeskField'][_0x97b1('0x2c')],function(_0x2fb7e1){return{'name':_0x2fb7e1['fieldName'],'type':_0x2fb7e1[_0x97b1('0x2d')][_0x97b1('0x2e')]};});_0x18fb67['model']=_[_0x97b1('0x2b')](_0x3b3093,_0x97b1('0x28'));_0x18fb67[_0x97b1('0x2f')]=_[_0x97b1('0x30')](_0x21f810[_0x97b1('0x2f')]);_0x18fb67[_0x97b1('0x31')]=_[_0x97b1('0x32')](_0x18fb67[_0x97b1('0x33')],_0x18fb67[_0x97b1('0x2f')]);_0x5b3d95[_0x97b1('0x34')]=_['intersection'](_0x18fb67['model'],qs[_0x97b1('0x35')](_0x21f810[_0x97b1('0x2f')][_0x97b1('0x35')]));_0x5b3d95[_0x97b1('0x34')]=_0x5b3d95[_0x97b1('0x34')][_0x97b1('0x36')]?_0x5b3d95[_0x97b1('0x34')]:_0x18fb67[_0x97b1('0x33')];if(!_0x21f810[_0x97b1('0x2f')]['hasOwnProperty'](_0x97b1('0x37'))){_0x5b3d95[_0x97b1('0x1d')]=qs[_0x97b1('0x1d')](_0x21f810[_0x97b1('0x2f')][_0x97b1('0x1d')]);_0x5b3d95[_0x97b1('0x1c')]=qs[_0x97b1('0x1c')](_0x21f810[_0x97b1('0x2f')]['offset']);}_0x5b3d95[_0x97b1('0x38')]=qs[_0x97b1('0x39')](_0x21f810['query'][_0x97b1('0x39')]);_0x5b3d95[_0x97b1('0x3a')]=qs[_0x97b1('0x31')](_[_0x97b1('0x3b')](_0x21f810[_0x97b1('0x2f')],_0x18fb67[_0x97b1('0x31')]),_0x3b3093);if(_0x21f810['query'][_0x97b1('0x3c')]){_0x5b3d95[_0x97b1('0x3a')]=_['merge'](_0x5b3d95[_0x97b1('0x3a')],{'$or':_[_0x97b1('0x2b')](_0x3b3093,function(_0x560ee7){if(_0x560ee7[_0x97b1('0x2d')]!=='VIRTUAL'){var _0x313b8d={};_0x313b8d[_0x560ee7[_0x97b1('0x28')]]={'$like':'%'+_0x21f810[_0x97b1('0x2f')][_0x97b1('0x3c')]+'%'};return _0x313b8d;}})});}_0x5b3d95=_['merge']({},_0x5b3d95,_0x21f810['options']);var _0x55c577={'where':_0x5b3d95['where']};return db[_0x97b1('0x3d')][_0x97b1('0x1e')](_0x55c577)[_0x97b1('0x23')](function(_0x10169b){_0x200836['count']=_0x10169b;if(_0x21f810['query'][_0x97b1('0x3e')]){_0x5b3d95[_0x97b1('0x3f')]=[{'all':!![]}];}return db[_0x97b1('0x3d')][_0x97b1('0x40')](_0x5b3d95);})[_0x97b1('0x23')](function(_0x27357d){_0x200836[_0x97b1('0x41')]=_0x27357d;return _0x200836;})['then'](respondWithFilteredResult(_0x4d01b1,_0x5b3d95))[_0x97b1('0x42')](handleError(_0x4d01b1,null));};exports[_0x97b1('0x43')]=function(_0x401128,_0x47fbd8){var _0x382a97={'raw':!![],'where':{'id':_0x401128[_0x97b1('0x44')]['id']}},_0x5e8ab0={};_0x5e8ab0[_0x97b1('0x33')]=_['keys'](db[_0x97b1('0x3d')][_0x97b1('0x2c')]);_0x5e8ab0['query']=_['keys'](_0x401128[_0x97b1('0x2f')]);_0x5e8ab0['filters']=_[_0x97b1('0x32')](_0x5e8ab0['model'],_0x5e8ab0[_0x97b1('0x2f')]);_0x382a97[_0x97b1('0x34')]=_[_0x97b1('0x32')](_0x5e8ab0[_0x97b1('0x33')],qs['fields'](_0x401128['query'][_0x97b1('0x35')]));_0x382a97[_0x97b1('0x34')]=_0x382a97[_0x97b1('0x34')][_0x97b1('0x36')]?_0x382a97[_0x97b1('0x34')]:_0x5e8ab0['model'];if(_0x401128[_0x97b1('0x2f')][_0x97b1('0x3e')]){_0x382a97[_0x97b1('0x3f')]=[{'all':!![]}];}_0x382a97=_[_0x97b1('0x45')]({},_0x382a97,_0x401128['options']);return db['ZendeskField'][_0x97b1('0x46')](_0x382a97)[_0x97b1('0x23')](handleEntityNotFound(_0x47fbd8,null))[_0x97b1('0x23')](respondWithResult(_0x47fbd8,null))[_0x97b1('0x42')](handleError(_0x47fbd8,null));};exports[_0x97b1('0x47')]=function(_0x43b1ed,_0xd8bfce){return db[_0x97b1('0x3d')][_0x97b1('0x47')](_0x43b1ed[_0x97b1('0x48')],{})[_0x97b1('0x23')](respondWithResult(_0xd8bfce,0xc9))[_0x97b1('0x42')](handleError(_0xd8bfce,null));};exports['update']=function(_0x3c7692,_0x1c29a9){if(_0x3c7692[_0x97b1('0x48')]['id']){delete _0x3c7692['body']['id'];}return db[_0x97b1('0x3d')]['find']({'where':{'id':_0x3c7692[_0x97b1('0x44')]['id']}})[_0x97b1('0x23')](handleEntityNotFound(_0x1c29a9,null))[_0x97b1('0x23')](saveUpdates(_0x3c7692['body'],null))[_0x97b1('0x23')](respondWithResult(_0x1c29a9,null))[_0x97b1('0x42')](handleError(_0x1c29a9,null));};exports['destroy']=function(_0x7042fd,_0x54f54f){return db['ZendeskField'][_0x97b1('0x46')]({'where':{'id':_0x7042fd[_0x97b1('0x44')]['id']}})[_0x97b1('0x23')](handleEntityNotFound(_0x54f54f,null))[_0x97b1('0x23')](removeEntity(_0x54f54f,null))[_0x97b1('0x42')](handleError(_0x54f54f,null));}; \ No newline at end of file +var _0xbea3=['filter','merge','type','VIRTUAL','options','includeAll','ZendeskField','findAll','catch','show','length','include','update','body','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','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/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','save','destroy','then','name','index','map','rawAttributes','fieldName','model','query','keys','attributes','intersection','fields','nolimit','order','sort','filters','pick'];(function(_0x212500,_0x390b63){var _0x365f9c=function(_0x52cb96){while(--_0x52cb96){_0x212500['push'](_0x212500['shift']());}};_0x365f9c(++_0x390b63);}(_0xbea3,0x137));var _0x3bea=function(_0x1558c6,_0x49c0ff){_0x1558c6=_0x1558c6-0x0;var _0x5a2557=_0xbea3[_0x1558c6];return _0x5a2557;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3bea('0x0'));var zipdir=require(_0x3bea('0x1'));var jsonpatch=require(_0x3bea('0x2'));var rp=require(_0x3bea('0x3'));var moment=require(_0x3bea('0x4'));var BPromise=require(_0x3bea('0x5'));var Mustache=require(_0x3bea('0x6'));var util=require(_0x3bea('0x7'));var path=require(_0x3bea('0x8'));var sox=require(_0x3bea('0x9'));var csv=require('to-csv');var ejs=require(_0x3bea('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3bea('0xb'));var squel=require(_0x3bea('0xc'));var crypto=require(_0x3bea('0xd'));var jsforce=require(_0x3bea('0xe'));var deskjs=require(_0x3bea('0xf'));var toCsv=require(_0x3bea('0x10'));var querystring=require(_0x3bea('0x11'));var Papa=require('papaparse');var Redis=require(_0x3bea('0x12'));var authService=require(_0x3bea('0x13'));var qs=require(_0x3bea('0x14'));var as=require(_0x3bea('0x15'));var hardwareService=require(_0x3bea('0x16'));var logger=require(_0x3bea('0x17'))(_0x3bea('0x18'));var utils=require(_0x3bea('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x3bea('0x1a'));var db=require(_0x3bea('0x1b'))['db'];function respondWithStatusCode(_0x4e9193,_0x5a639b){_0x5a639b=_0x5a639b||0xcc;return function(_0x2f9909){if(_0x2f9909){return _0x4e9193[_0x3bea('0x1c')](_0x5a639b);}return _0x4e9193[_0x3bea('0x1d')](_0x5a639b)[_0x3bea('0x1e')]();};}function respondWithResult(_0x186ecd,_0x13d15e){_0x13d15e=_0x13d15e||0xc8;return function(_0x4896c0){if(_0x4896c0){return _0x186ecd[_0x3bea('0x1d')](_0x13d15e)['json'](_0x4896c0);}};}function respondWithFilteredResult(_0x2b0715,_0x5176aa){return function(_0x39df74){if(_0x39df74){var _0x5e72e2=typeof _0x5176aa[_0x3bea('0x1f')]===_0x3bea('0x20')&&typeof _0x5176aa['limit']===_0x3bea('0x20');var _0x37afff=_0x39df74[_0x3bea('0x21')];var _0x5a3d84=_0x5e72e2?0x0:_0x5176aa['offset'];var _0x5b7a40=_0x5e72e2?_0x39df74[_0x3bea('0x21')]:_0x5176aa['offset']+_0x5176aa[_0x3bea('0x22')];var _0x3e78b9;if(_0x5b7a40>=_0x37afff){_0x5b7a40=_0x37afff;_0x3e78b9=0xc8;}else{_0x3e78b9=0xce;}_0x2b0715['status'](_0x3e78b9);return _0x2b0715[_0x3bea('0x23')](_0x3bea('0x24'),_0x5a3d84+'-'+_0x5b7a40+'/'+_0x37afff)[_0x3bea('0x25')](_0x39df74);}return null;};}function patchUpdates(_0x5a5268){return function(_0x2eb1cb){try{jsonpatch[_0x3bea('0x26')](_0x2eb1cb,_0x5a5268,!![]);}catch(_0x464bdb){return BPromise[_0x3bea('0x27')](_0x464bdb);}return _0x2eb1cb[_0x3bea('0x28')]();};}function saveUpdates(_0x314ddb,_0x491f21){return function(_0x5c6e34){if(_0x5c6e34){return _0x5c6e34['update'](_0x314ddb)['then'](function(_0xfcd882){return _0xfcd882;});}return null;};}function removeEntity(_0x3bccc5,_0x365df9){return function(_0x1c9096){if(_0x1c9096){return _0x1c9096[_0x3bea('0x29')]()[_0x3bea('0x2a')](function(){_0x3bccc5['status'](0xcc)[_0x3bea('0x1e')]();});}};}function handleEntityNotFound(_0x1fb741,_0x125779){return function(_0x5d176a){if(!_0x5d176a){_0x1fb741[_0x3bea('0x1c')](0x194);}return _0x5d176a;};}function handleError(_0x418b2b,_0x52a120){_0x52a120=_0x52a120||0x1f4;return function(_0x861e0b){logger['error'](_0x861e0b['stack']);if(_0x861e0b['name']){delete _0x861e0b[_0x3bea('0x2b')];}_0x418b2b[_0x3bea('0x1d')](_0x52a120)['send'](_0x861e0b);};}exports[_0x3bea('0x2c')]=function(_0x546a21,_0x5cdc6a){var _0x582eeb={},_0x411ac8={},_0xe7cb30={'count':0x0,'rows':[]};var _0x52e826=_[_0x3bea('0x2d')](db['ZendeskField'][_0x3bea('0x2e')],function(_0x25c2f0){return{'name':_0x25c2f0[_0x3bea('0x2f')],'type':_0x25c2f0['type']['key']};});_0x411ac8[_0x3bea('0x30')]=_['map'](_0x52e826,_0x3bea('0x2b'));_0x411ac8[_0x3bea('0x31')]=_[_0x3bea('0x32')](_0x546a21[_0x3bea('0x31')]);_0x411ac8['filters']=_['intersection'](_0x411ac8[_0x3bea('0x30')],_0x411ac8[_0x3bea('0x31')]);_0x582eeb[_0x3bea('0x33')]=_[_0x3bea('0x34')](_0x411ac8[_0x3bea('0x30')],qs[_0x3bea('0x35')](_0x546a21[_0x3bea('0x31')]['fields']));_0x582eeb[_0x3bea('0x33')]=_0x582eeb[_0x3bea('0x33')]['length']?_0x582eeb[_0x3bea('0x33')]:_0x411ac8[_0x3bea('0x30')];if(!_0x546a21['query']['hasOwnProperty'](_0x3bea('0x36'))){_0x582eeb[_0x3bea('0x22')]=qs[_0x3bea('0x22')](_0x546a21[_0x3bea('0x31')][_0x3bea('0x22')]);_0x582eeb[_0x3bea('0x1f')]=qs[_0x3bea('0x1f')](_0x546a21[_0x3bea('0x31')]['offset']);}_0x582eeb[_0x3bea('0x37')]=qs[_0x3bea('0x38')](_0x546a21[_0x3bea('0x31')][_0x3bea('0x38')]);_0x582eeb['where']=qs[_0x3bea('0x39')](_[_0x3bea('0x3a')](_0x546a21[_0x3bea('0x31')],_0x411ac8['filters']),_0x52e826);if(_0x546a21['query'][_0x3bea('0x3b')]){_0x582eeb['where']=_[_0x3bea('0x3c')](_0x582eeb['where'],{'$or':_[_0x3bea('0x2d')](_0x52e826,function(_0x535528){if(_0x535528[_0x3bea('0x3d')]!==_0x3bea('0x3e')){var _0x4e769d={};_0x4e769d[_0x535528['name']]={'$like':'%'+_0x546a21['query'][_0x3bea('0x3b')]+'%'};return _0x4e769d;}})});}_0x582eeb=_['merge']({},_0x582eeb,_0x546a21[_0x3bea('0x3f')]);var _0x5f067b={'where':_0x582eeb['where']};return db['ZendeskField'][_0x3bea('0x21')](_0x5f067b)[_0x3bea('0x2a')](function(_0x422acb){_0xe7cb30[_0x3bea('0x21')]=_0x422acb;if(_0x546a21[_0x3bea('0x31')][_0x3bea('0x40')]){_0x582eeb['include']=[{'all':!![]}];}return db[_0x3bea('0x41')][_0x3bea('0x42')](_0x582eeb);})[_0x3bea('0x2a')](function(_0x1feab2){_0xe7cb30['rows']=_0x1feab2;return _0xe7cb30;})['then'](respondWithFilteredResult(_0x5cdc6a,_0x582eeb))[_0x3bea('0x43')](handleError(_0x5cdc6a,null));};exports[_0x3bea('0x44')]=function(_0x260ca1,_0x4d68a8){var _0x429bd9={'raw':!![],'where':{'id':_0x260ca1['params']['id']}},_0xbcd84b={};_0xbcd84b[_0x3bea('0x30')]=_[_0x3bea('0x32')](db[_0x3bea('0x41')][_0x3bea('0x2e')]);_0xbcd84b[_0x3bea('0x31')]=_[_0x3bea('0x32')](_0x260ca1['query']);_0xbcd84b[_0x3bea('0x39')]=_['intersection'](_0xbcd84b[_0x3bea('0x30')],_0xbcd84b[_0x3bea('0x31')]);_0x429bd9[_0x3bea('0x33')]=_[_0x3bea('0x34')](_0xbcd84b[_0x3bea('0x30')],qs[_0x3bea('0x35')](_0x260ca1['query'][_0x3bea('0x35')]));_0x429bd9[_0x3bea('0x33')]=_0x429bd9[_0x3bea('0x33')][_0x3bea('0x45')]?_0x429bd9['attributes']:_0xbcd84b['model'];if(_0x260ca1[_0x3bea('0x31')][_0x3bea('0x40')]){_0x429bd9[_0x3bea('0x46')]=[{'all':!![]}];}_0x429bd9=_['merge']({},_0x429bd9,_0x260ca1[_0x3bea('0x3f')]);return db[_0x3bea('0x41')]['find'](_0x429bd9)[_0x3bea('0x2a')](handleEntityNotFound(_0x4d68a8,null))['then'](respondWithResult(_0x4d68a8,null))[_0x3bea('0x43')](handleError(_0x4d68a8,null));};exports['create']=function(_0x5e7b91,_0x5516a4){return db[_0x3bea('0x41')]['create'](_0x5e7b91['body'],{})['then'](respondWithResult(_0x5516a4,0xc9))['catch'](handleError(_0x5516a4,null));};exports[_0x3bea('0x47')]=function(_0x1e3111,_0x283a58){if(_0x1e3111[_0x3bea('0x48')]['id']){delete _0x1e3111[_0x3bea('0x48')]['id'];}return db[_0x3bea('0x41')]['find']({'where':{'id':_0x1e3111['params']['id']}})[_0x3bea('0x2a')](handleEntityNotFound(_0x283a58,null))[_0x3bea('0x2a')](saveUpdates(_0x1e3111[_0x3bea('0x48')],null))[_0x3bea('0x2a')](respondWithResult(_0x283a58,null))[_0x3bea('0x43')](handleError(_0x283a58,null));};exports[_0x3bea('0x29')]=function(_0x4d53be,_0x510f5d){return db[_0x3bea('0x41')][_0x3bea('0x49')]({'where':{'id':_0x4d53be['params']['id']}})[_0x3bea('0x2a')](handleEntityNotFound(_0x510f5d,null))['then'](removeEntity(_0x510f5d,null))[_0x3bea('0x43')](handleError(_0x510f5d,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index d5c7546..d50d429 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 _0x37f9=['FieldId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField'];(function(_0x551ffa,_0x732087){var _0x2665e1=function(_0x5e9675){while(--_0x5e9675){_0x551ffa['push'](_0x551ffa['shift']());}};_0x2665e1(++_0x732087);}(_0x37f9,0x143));var _0x937f=function(_0x4f9d8c,_0x178c6c){_0x4f9d8c=_0x4f9d8c-0x0;var _0x3715d7=_0x37f9[_0x4f9d8c];return _0x3715d7;};'use strict';var _=require(_0x937f('0x0'));var util=require(_0x937f('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x937f('0x2'));var BPromise=require(_0x937f('0x3'));var rp=require(_0x937f('0x4'));var fs=require('fs');var path=require(_0x937f('0x5'));var rimraf=require(_0x937f('0x6'));var config=require(_0x937f('0x7'));var attributes=require('./intZendeskField.attributes');module['exports']=function(_0x3fa3bc,_0x342c2e){return _0x3fa3bc[_0x937f('0x8')](_0x937f('0x9'),attributes,{'tableName':_0x937f('0xa'),'paranoid':![],'indexes':[{'name':_0x937f('0xb'),'fields':[_0x937f('0xc'),_0x937f('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2274=['rimraf','./intZendeskField.attributes','exports','zendesk_unique_index','idField','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x4a6b00,_0x508299){var _0xa7015a=function(_0x41d83e){while(--_0x41d83e){_0x4a6b00['push'](_0x4a6b00['shift']());}};_0xa7015a(++_0x508299);}(_0x2274,0x195));var _0x4227=function(_0x18fb2c,_0x1d8686){_0x18fb2c=_0x18fb2c-0x0;var _0x31deb0=_0x2274[_0x18fb2c];return _0x31deb0;};'use strict';var _=require(_0x4227('0x0'));var util=require(_0x4227('0x1'));var logger=require(_0x4227('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4227('0x3'));var rp=require(_0x4227('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4227('0x5'));var config=require('../../config/environment');var attributes=require(_0x4227('0x6'));module[_0x4227('0x7')]=function(_0x496dbe,_0x78ec6a){return _0x496dbe['define']('ZendeskField',attributes,{'tableName':'int_zendesk_fields','paranoid':![],'indexes':[{'name':_0x4227('0x8'),'fields':[_0x4227('0x9'),'FieldId'],'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 a3d0024..9a8ffe7 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 _0x3987=['ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x21e6f1,_0x4d5eb5){var _0x44a394=function(_0x2d0e0e){while(--_0x2d0e0e){_0x21e6f1['push'](_0x21e6f1['shift']());}};_0x44a394(++_0x4d5eb5);}(_0x3987,0x191));var _0x7398=function(_0x2556ca,_0x4bd1be){_0x2556ca=_0x2556ca-0x0;var _0xfe6171=_0x3987[_0x2556ca];return _0xfe6171;};'use strict';var _=require('lodash');var util=require(_0x7398('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7398('0x1'));var db=require(_0x7398('0x2'))['db'];var utils=require(_0x7398('0x3'));var logger=require(_0x7398('0x4'))(_0x7398('0x5'));var config=require(_0x7398('0x6'));var jayson=require(_0x7398('0x7'));var client=jayson[_0x7398('0x8')][_0x7398('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x44e3a2,_0x301ae4,_0x3a9f2b){return new BPromise(function(_0x2e0808,_0x5561f1){return client[_0x7398('0xa')](_0x44e3a2,_0x3a9f2b)[_0x7398('0xb')](function(_0x171ff4){logger[_0x7398('0xc')](_0x7398('0xd'),_0x301ae4,_0x7398('0xe'));logger[_0x7398('0xf')](_0x7398('0x10'),_0x301ae4,_0x7398('0xe'),JSON[_0x7398('0x11')](_0x171ff4));if(_0x171ff4[_0x7398('0x12')]){if(_0x171ff4[_0x7398('0x12')][_0x7398('0x13')]===0x1f4){logger[_0x7398('0x12')]('ZendeskField,\x20%s,\x20%s',_0x301ae4,_0x171ff4[_0x7398('0x12')][_0x7398('0x14')]);return _0x5561f1(_0x171ff4['error']['message']);}logger[_0x7398('0x12')](_0x7398('0xd'),_0x301ae4,_0x171ff4[_0x7398('0x12')][_0x7398('0x14')]);return _0x2e0808(_0x171ff4['error'][_0x7398('0x14')]);}else{logger[_0x7398('0xc')]('ZendeskField,\x20%s,\x20%s',_0x301ae4,_0x7398('0xe'));_0x2e0808(_0x171ff4[_0x7398('0x15')][_0x7398('0x14')]);}})[_0x7398('0x16')](function(_0x944f9){logger[_0x7398('0x12')](_0x7398('0xd'),_0x301ae4,_0x944f9);_0x5561f1(_0x944f9);});});} \ No newline at end of file +var _0x58bb=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','randomstring','../../mysqldb','../../config/utils'];(function(_0x53c256,_0x382a24){var _0x25feb6=function(_0x2652fd){while(--_0x2652fd){_0x53c256['push'](_0x53c256['shift']());}};_0x25feb6(++_0x382a24);}(_0x58bb,0x187));var _0xb58b=function(_0x32bc03,_0x503e77){_0x32bc03=_0x32bc03-0x0;var _0x56f85f=_0x58bb[_0x32bc03];return _0x56f85f;};'use strict';var _=require(_0xb58b('0x0'));var util=require(_0xb58b('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb58b('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb58b('0x3'))['db'];var utils=require(_0xb58b('0x4'));var logger=require(_0xb58b('0x5'))(_0xb58b('0x6'));var config=require(_0xb58b('0x7'));var jayson=require(_0xb58b('0x8'));var client=jayson['client'][_0xb58b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6a4b23,_0x48ab48,_0x44216b){return new BPromise(function(_0x93852b,_0x468e8c){return client[_0xb58b('0xa')](_0x6a4b23,_0x44216b)[_0xb58b('0xb')](function(_0x13be49){logger[_0xb58b('0xc')](_0xb58b('0xd'),_0x48ab48,_0xb58b('0xe'));logger[_0xb58b('0xf')](_0xb58b('0x10'),_0x48ab48,_0xb58b('0xe'),JSON[_0xb58b('0x11')](_0x13be49));if(_0x13be49[_0xb58b('0x12')]){if(_0x13be49[_0xb58b('0x12')][_0xb58b('0x13')]===0x1f4){logger[_0xb58b('0x12')]('ZendeskField,\x20%s,\x20%s',_0x48ab48,_0x13be49[_0xb58b('0x12')][_0xb58b('0x14')]);return _0x468e8c(_0x13be49['error'][_0xb58b('0x14')]);}logger[_0xb58b('0x12')](_0xb58b('0xd'),_0x48ab48,_0x13be49[_0xb58b('0x12')][_0xb58b('0x14')]);return _0x93852b(_0x13be49[_0xb58b('0x12')][_0xb58b('0x14')]);}else{logger[_0xb58b('0xc')](_0xb58b('0xd'),_0x48ab48,_0xb58b('0xe'));_0x93852b(_0x13be49[_0xb58b('0x15')][_0xb58b('0x14')]);}})['catch'](function(_0x169151){logger[_0xb58b('0x12')](_0xb58b('0xd'),_0x48ab48,_0x169151);_0x468e8c(_0x169151);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 47af5a1..93dd512 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 _0xcdff=['delete','multer','util','connect-timeout','Router','fs-extra','../../components/interaction/service','./intZohoAccount.controller','get','isAuthenticated','index','/:id','/:id/configurations','/:id/fields','getFields','create','post','addConfiguration','put','update'];(function(_0xb68695,_0x1881a4){var _0x15a817=function(_0x4d04d6){while(--_0x4d04d6){_0xb68695['push'](_0xb68695['shift']());}};_0x15a817(++_0x1881a4);}(_0xcdff,0xc9));var _0xfcdf=function(_0x411e53,_0xb88163){_0x411e53=_0x411e53-0x0;var _0x2d9285=_0xcdff[_0x411e53];return _0x2d9285;};'use strict';var multer=require(_0xfcdf('0x0'));var util=require(_0xfcdf('0x1'));var path=require('path');var timeout=require(_0xfcdf('0x2'));var express=require('express');var router=express[_0xfcdf('0x3')]();var fs_extra=require(_0xfcdf('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfcdf('0x5'));var config=require('../../config/environment');var controller=require(_0xfcdf('0x6'));router[_0xfcdf('0x7')]('/',auth[_0xfcdf('0x8')](),controller[_0xfcdf('0x9')]);router[_0xfcdf('0x7')](_0xfcdf('0xa'),auth[_0xfcdf('0x8')](),controller['show']);router[_0xfcdf('0x7')](_0xfcdf('0xb'),auth[_0xfcdf('0x8')](),controller['getConfigurations']);router[_0xfcdf('0x7')](_0xfcdf('0xc'),auth[_0xfcdf('0x8')](),controller[_0xfcdf('0xd')]);router['post']('/',auth[_0xfcdf('0x8')](),controller[_0xfcdf('0xe')]);router[_0xfcdf('0xf')](_0xfcdf('0xb'),auth[_0xfcdf('0x8')](),controller[_0xfcdf('0x10')]);router[_0xfcdf('0x11')](_0xfcdf('0xa'),auth[_0xfcdf('0x8')](),controller[_0xfcdf('0x12')]);router[_0xfcdf('0x13')](_0xfcdf('0xa'),auth[_0xfcdf('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x0b32=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','addConfiguration','put','delete','destroy'];(function(_0x22a33a,_0x4a7487){var _0x2d0a92=function(_0x4c27e2){while(--_0x4c27e2){_0x22a33a['push'](_0x22a33a['shift']());}};_0x2d0a92(++_0x4a7487);}(_0x0b32,0x1aa));var _0x20b3=function(_0x5f14a2,_0x17cb4b){_0x5f14a2=_0x5f14a2-0x0;var _0x27555f=_0x0b32[_0x5f14a2];return _0x27555f;};'use strict';var multer=require(_0x20b3('0x0'));var util=require(_0x20b3('0x1'));var path=require('path');var timeout=require(_0x20b3('0x2'));var express=require(_0x20b3('0x3'));var router=express[_0x20b3('0x4')]();var fs_extra=require(_0x20b3('0x5'));var auth=require(_0x20b3('0x6'));var interaction=require(_0x20b3('0x7'));var config=require(_0x20b3('0x8'));var controller=require(_0x20b3('0x9'));router[_0x20b3('0xa')]('/',auth[_0x20b3('0xb')](),controller[_0x20b3('0xc')]);router[_0x20b3('0xa')](_0x20b3('0xd'),auth[_0x20b3('0xb')](),controller[_0x20b3('0xe')]);router['get'](_0x20b3('0xf'),auth[_0x20b3('0xb')](),controller[_0x20b3('0x10')]);router['get'](_0x20b3('0x11'),auth[_0x20b3('0xb')](),controller[_0x20b3('0x12')]);router['post']('/',auth[_0x20b3('0xb')](),controller['create']);router[_0x20b3('0x13')](_0x20b3('0xf'),auth[_0x20b3('0xb')](),controller[_0x20b3('0x14')]);router[_0x20b3('0x15')]('/:id',auth[_0x20b3('0xb')](),controller['update']);router[_0x20b3('0x16')]('/:id',auth[_0x20b3('0xb')](),controller[_0x20b3('0x17')]);module[_0x20b3('0x18')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 4429262..81a400a 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 _0xee5b=['sequelize','STRING'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0xee5b,0x1f4));var _0xbee5=function(_0x268273,_0x43c099){_0x268273=_0x268273-0x0;var _0x32616d=_0xee5b[_0x268273];return _0x32616d;};'use strict';var Sequelize=require(_0xbee5('0x0'));module['exports']={'name':{'type':Sequelize[_0xbee5('0x1')]},'description':{'type':Sequelize[_0xbee5('0x1')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0xbee5('0x1')]},'clientId':{'type':Sequelize[_0xbee5('0x1')]},'clientSecret':{'type':Sequelize[_0xbee5('0x1')]},'serverUrl':{'type':Sequelize[_0xbee5('0x1')],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xb821=['STRING','exports'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0xb821,0xa7));var _0x1b82=function(_0x20c659,_0x56ab3b){_0x20c659=_0x20c659-0x0;var _0x2f2422=_0xb821[_0x20c659];return _0x2f2422;};'use strict';var Sequelize=require('sequelize');module[_0x1b82('0x0')]={'name':{'type':Sequelize[_0x1b82('0x1')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x1b82('0x1')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x1b82('0x1')],'allowNull':![]},'code':{'type':Sequelize[_0x1b82('0x1')]},'refreshToken':{'type':Sequelize[_0x1b82('0x1')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index d4b59b3..22d035f 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 _0x370b=['AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','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','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','host','serverUrl','code','zoho.eu','com','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','message','Subject','Description','WhoId','Call_Duration','Call_Type','includes','system_mandatory','push','data_type','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','test','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','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','Content-Range','json','apply','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','ZohoAccount','then','includeAll','include','rows','catch','show','find','create','body','params','findOne','ZohoConfiguration','getConfigurations'];(function(_0x618414,_0x1a7a60){var _0x21c19a=function(_0x507b17){while(--_0x507b17){_0x618414['push'](_0x618414['shift']());}};_0x21c19a(++_0x1a7a60);}(_0x370b,0x139));var _0xb370=function(_0x18e8db,_0x4807ec){_0x18e8db=_0x18e8db-0x0;var _0x73464c=_0x370b[_0x18e8db];return _0x73464c;};'use strict';var emlformat=require(_0xb370('0x0'));var rimraf=require(_0xb370('0x1'));var zipdir=require(_0xb370('0x2'));var jsonpatch=require(_0xb370('0x3'));var rp=require(_0xb370('0x4'));var moment=require('moment');var BPromise=require(_0xb370('0x5'));var Mustache=require(_0xb370('0x6'));var util=require('util');var path=require(_0xb370('0x7'));var sox=require(_0xb370('0x8'));var csv=require(_0xb370('0x9'));var ejs=require(_0xb370('0xa'));var fs=require('fs');var fs_extra=require(_0xb370('0xb'));var _=require('lodash');var squel=require(_0xb370('0xc'));var crypto=require(_0xb370('0xd'));var jsforce=require(_0xb370('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb370('0x9'));var querystring=require(_0xb370('0xf'));var Papa=require(_0xb370('0x10'));var Redis=require(_0xb370('0x11'));var authService=require(_0xb370('0x12'));var qs=require(_0xb370('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb370('0x14'));var logger=require(_0xb370('0x15'))(_0xb370('0x16'));var utils=require('../../config/utils');var config=require(_0xb370('0x17'));var licenseUtil=require(_0xb370('0x18'));var db=require('../../mysqldb')['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x14d932,_0x31a52a){_0x31a52a=_0x31a52a||0xcc;return function(_0x5b2785){if(_0x5b2785){return _0x14d932[_0xb370('0x19')](_0x31a52a);}return _0x14d932[_0xb370('0x1a')](_0x31a52a)[_0xb370('0x1b')]();};}function respondWithResult(_0xbd7faa,_0x24a757){_0x24a757=_0x24a757||0xc8;return function(_0x296d29){if(_0x296d29){return _0xbd7faa['status'](_0x24a757)['json'](_0x296d29);}};}function respondWithFilteredResult(_0x20edf7,_0x2ea924){return function(_0x3525bb){if(_0x3525bb){var _0x4631a3=typeof _0x2ea924[_0xb370('0x1c')]===_0xb370('0x1d')&&typeof _0x2ea924[_0xb370('0x1e')]==='undefined';var _0x360ece=_0x3525bb['count'];var _0x233def=_0x4631a3?0x0:_0x2ea924[_0xb370('0x1c')];var _0x4cf606=_0x4631a3?_0x3525bb[_0xb370('0x1f')]:_0x2ea924[_0xb370('0x1c')]+_0x2ea924[_0xb370('0x1e')];var _0x1228d6;if(_0x4cf606>=_0x360ece){_0x4cf606=_0x360ece;_0x1228d6=0xc8;}else{_0x1228d6=0xce;}_0x20edf7[_0xb370('0x1a')](_0x1228d6);return _0x20edf7[_0xb370('0x20')](_0xb370('0x21'),_0x233def+'-'+_0x4cf606+'/'+_0x360ece)[_0xb370('0x22')](_0x3525bb);}return null;};}function patchUpdates(_0x73c0ec){return function(_0x51d431){try{jsonpatch[_0xb370('0x23')](_0x51d431,_0x73c0ec,!![]);}catch(_0x5dcbcf){return BPromise[_0xb370('0x24')](_0x5dcbcf);}return _0x51d431[_0xb370('0x25')]();};}function saveUpdates(_0x21460e,_0x6de843){return function(_0x176603){if(_0x176603){return _0x176603[_0xb370('0x26')](_0x21460e)['then'](function(_0x41abfe){return _0x41abfe;});}return null;};}function removeEntity(_0x4b0964,_0x3cc7f9){return function(_0x312443){if(_0x312443){return _0x312443[_0xb370('0x27')]()['then'](function(){_0x4b0964[_0xb370('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5d5e07,_0x37e534){return function(_0x49cb9c){if(!_0x49cb9c){_0x5d5e07['sendStatus'](0x194);}return _0x49cb9c;};}function handleError(_0x244c49,_0x4479ae){_0x4479ae=_0x4479ae||0x1f4;return function(_0x1a433a){logger[_0xb370('0x28')](_0x1a433a[_0xb370('0x29')]);if(_0x1a433a[_0xb370('0x2a')]){delete _0x1a433a[_0xb370('0x2a')];}_0x244c49[_0xb370('0x1a')](_0x4479ae)[_0xb370('0x2b')](_0x1a433a);};}exports['index']=function(_0x5641dd,_0x1dba92){var _0xb0228e={},_0x283d19={},_0x55eae1={'count':0x0,'rows':[]};var _0x1e4873=_[_0xb370('0x2c')](db['ZohoAccount'][_0xb370('0x2d')],function(_0x56ec71){return{'name':_0x56ec71[_0xb370('0x2e')],'type':_0x56ec71['type'][_0xb370('0x2f')]};});_0x283d19[_0xb370('0x30')]=_[_0xb370('0x2c')](_0x1e4873,'name');_0x283d19[_0xb370('0x31')]=_[_0xb370('0x32')](_0x5641dd['query']);_0x283d19['filters']=_[_0xb370('0x33')](_0x283d19['model'],_0x283d19[_0xb370('0x31')]);_0xb0228e[_0xb370('0x34')]=_[_0xb370('0x33')](_0x283d19[_0xb370('0x30')],qs[_0xb370('0x35')](_0x5641dd[_0xb370('0x31')][_0xb370('0x35')]));_0xb0228e[_0xb370('0x34')]=_0xb0228e[_0xb370('0x34')][_0xb370('0x36')]?_0xb0228e[_0xb370('0x34')]:_0x283d19['model'];if(!_0x5641dd['query'][_0xb370('0x37')](_0xb370('0x38'))){_0xb0228e['limit']=qs[_0xb370('0x1e')](_0x5641dd[_0xb370('0x31')][_0xb370('0x1e')]);_0xb0228e[_0xb370('0x1c')]=qs[_0xb370('0x1c')](_0x5641dd[_0xb370('0x31')][_0xb370('0x1c')]);}_0xb0228e[_0xb370('0x39')]=qs[_0xb370('0x3a')](_0x5641dd[_0xb370('0x31')][_0xb370('0x3a')]);_0xb0228e[_0xb370('0x3b')]=qs[_0xb370('0x3c')](_['pick'](_0x5641dd[_0xb370('0x31')],_0x283d19[_0xb370('0x3c')]),_0x1e4873);if(_0x5641dd['query'][_0xb370('0x3d')]){_0xb0228e[_0xb370('0x3b')]=_[_0xb370('0x3e')](_0xb0228e[_0xb370('0x3b')],{'$or':_['map'](_0x1e4873,function(_0x3e222b){if(_0x3e222b[_0xb370('0x3f')]!==_0xb370('0x40')){var _0x7b6458={};_0x7b6458[_0x3e222b[_0xb370('0x2a')]]={'$like':'%'+_0x5641dd['query'][_0xb370('0x3d')]+'%'};return _0x7b6458;}})});}_0xb0228e=_[_0xb370('0x3e')]({},_0xb0228e,_0x5641dd[_0xb370('0x41')]);var _0x4fcae0={'where':_0xb0228e[_0xb370('0x3b')]};return db[_0xb370('0x42')][_0xb370('0x1f')](_0x4fcae0)[_0xb370('0x43')](function(_0x4a6cd7){_0x55eae1[_0xb370('0x1f')]=_0x4a6cd7;if(_0x5641dd[_0xb370('0x31')][_0xb370('0x44')]){_0xb0228e[_0xb370('0x45')]=[{'all':!![]}];}return db[_0xb370('0x42')]['findAll'](_0xb0228e);})[_0xb370('0x43')](function(_0xfffe3d){_0x55eae1[_0xb370('0x46')]=_0xfffe3d;return _0x55eae1;})[_0xb370('0x43')](respondWithFilteredResult(_0x1dba92,_0xb0228e))[_0xb370('0x47')](handleError(_0x1dba92,null));};exports[_0xb370('0x48')]=function(_0x5a6ac4,_0x2f9da7){var _0x54b0e7={'raw':![],'where':{'id':_0x5a6ac4['params']['id']}},_0x1aaa14={};_0x1aaa14[_0xb370('0x30')]=_[_0xb370('0x32')](db[_0xb370('0x42')]['rawAttributes']);_0x1aaa14[_0xb370('0x31')]=_[_0xb370('0x32')](_0x5a6ac4[_0xb370('0x31')]);_0x1aaa14['filters']=_[_0xb370('0x33')](_0x1aaa14['model'],_0x1aaa14[_0xb370('0x31')]);_0x54b0e7[_0xb370('0x34')]=_[_0xb370('0x33')](_0x1aaa14['model'],qs[_0xb370('0x35')](_0x5a6ac4['query'][_0xb370('0x35')]));_0x54b0e7[_0xb370('0x34')]=_0x54b0e7['attributes']['length']?_0x54b0e7['attributes']:_0x1aaa14[_0xb370('0x30')];if(_0x5a6ac4[_0xb370('0x31')][_0xb370('0x44')]){_0x54b0e7[_0xb370('0x45')]=[{'all':!![]}];}_0x54b0e7=_[_0xb370('0x3e')]({},_0x54b0e7,_0x5a6ac4[_0xb370('0x41')]);return db[_0xb370('0x42')][_0xb370('0x49')](_0x54b0e7)['then'](handleEntityNotFound(_0x2f9da7,null))[_0xb370('0x43')](respondWithResult(_0x2f9da7,null))[_0xb370('0x47')](handleError(_0x2f9da7,null));};exports[_0xb370('0x4a')]=function(_0x47e010,_0x45dc85){return db['ZohoAccount']['create'](_0x47e010['body'],{})[_0xb370('0x43')](respondWithResult(_0x45dc85,0xc9))[_0xb370('0x47')](handleError(_0x45dc85,null));};exports[_0xb370('0x26')]=function(_0x32fee4,_0x3bb016){if(_0x32fee4['body']['id']){delete _0x32fee4[_0xb370('0x4b')]['id'];}return db[_0xb370('0x42')]['find']({'where':{'id':_0x32fee4[_0xb370('0x4c')]['id']}})[_0xb370('0x43')](handleEntityNotFound(_0x3bb016,null))['then'](saveUpdates(_0x32fee4[_0xb370('0x4b')],null))[_0xb370('0x43')](respondWithResult(_0x3bb016,null))[_0xb370('0x47')](handleError(_0x3bb016,null));};exports[_0xb370('0x27')]=function(_0x5df5b9,_0x565951){return db['ZohoAccount'][_0xb370('0x49')]({'where':{'id':_0x5df5b9['params']['id']}})[_0xb370('0x43')](handleEntityNotFound(_0x565951,null))[_0xb370('0x43')](removeEntity(_0x565951,null))[_0xb370('0x47')](handleError(_0x565951,null));};exports['getConfigurations']=function(_0x44c2cd,_0x1e4c31,_0x3f9dfb){var _0xc51ed8={};var _0x39d1a6={};var _0x47258c;var _0x35e70e;return db[_0xb370('0x42')][_0xb370('0x4d')]({'where':{'id':_0x44c2cd['params']['id']}})['then'](handleEntityNotFound(_0x1e4c31,null))['then'](function(_0x2f2cef){if(_0x2f2cef){_0x47258c=_0x2f2cef;_0x39d1a6[_0xb370('0x30')]=_['keys'](db[_0xb370('0x4e')][_0xb370('0x2d')]);_0x39d1a6[_0xb370('0x31')]=_[_0xb370('0x32')](_0x44c2cd[_0xb370('0x31')]);_0x39d1a6[_0xb370('0x3c')]=_['intersection'](_0x39d1a6[_0xb370('0x30')],_0x39d1a6[_0xb370('0x31')]);_0xc51ed8['attributes']=_[_0xb370('0x33')](_0x39d1a6[_0xb370('0x30')],qs[_0xb370('0x35')](_0x44c2cd[_0xb370('0x31')]['fields']));_0xc51ed8[_0xb370('0x34')]=_0xc51ed8[_0xb370('0x34')][_0xb370('0x36')]?_0xc51ed8[_0xb370('0x34')]:_0x39d1a6['model'];_0xc51ed8[_0xb370('0x39')]=qs[_0xb370('0x3a')](_0x44c2cd[_0xb370('0x31')][_0xb370('0x3a')]);_0xc51ed8['where']=qs[_0xb370('0x3c')](_['pick'](_0x44c2cd[_0xb370('0x31')],_0x39d1a6[_0xb370('0x3c')]));if(_0x44c2cd['query'][_0xb370('0x3d')]){_0xc51ed8[_0xb370('0x3b')]=_[_0xb370('0x3e')](_0xc51ed8[_0xb370('0x3b')],{'$or':_[_0xb370('0x2c')](_0xc51ed8['attributes'],function(_0x354a66){var _0xad83a3={};_0xad83a3[_0x354a66]={'$like':'%'+_0x44c2cd[_0xb370('0x31')][_0xb370('0x3d')]+'%'};return _0xad83a3;})});}_0xc51ed8=_['merge']({},_0xc51ed8,_0x44c2cd[_0xb370('0x41')]);return _0x47258c['getConfigurations'](_0xc51ed8);}})[_0xb370('0x43')](function(_0x216ff5){if(_0x216ff5){_0x35e70e=_0x216ff5[_0xb370('0x36')];if(!_0x44c2cd[_0xb370('0x31')]['hasOwnProperty']('nolimit')){_0xc51ed8[_0xb370('0x1e')]=qs[_0xb370('0x1e')](_0x44c2cd[_0xb370('0x31')][_0xb370('0x1e')]);_0xc51ed8[_0xb370('0x1c')]=qs['offset'](_0x44c2cd[_0xb370('0x31')]['offset']);}return _0x47258c[_0xb370('0x4f')](_0xc51ed8);}})[_0xb370('0x43')](function(_0x5d4ad4){if(_0x5d4ad4){return _0x5d4ad4?{'count':_0x35e70e,'rows':_0x5d4ad4}:null;}})[_0xb370('0x43')](respondWithResult(_0x1e4c31,null))['catch'](handleError(_0x1e4c31,null));};exports['addConfiguration']=function(_0x1c6730,_0xd8ebba,_0x38ac8d){if(_0x1c6730[_0xb370('0x4b')]['id']){delete _0x1c6730[_0xb370('0x4b')]['id'];}return db['ZohoAccount'][_0xb370('0x4d')]({'where':{'id':_0x1c6730[_0xb370('0x4c')]['id']}})[_0xb370('0x43')](handleEntityNotFound(_0xd8ebba,null))[_0xb370('0x43')](function(_0xa4ac9){if(_0xa4ac9){_0x1c6730[_0xb370('0x4b')][_0xb370('0x50')]=_0xa4ac9['id'];_0x1c6730[_0xb370('0x4b')][_0xb370('0x51')]=integrations[_0xb370('0x52')](_0x1c6730[_0xb370('0x4b')][_0xb370('0x53')],_0x1c6730[_0xb370('0x4b')][_0xb370('0x3f')]);_0x1c6730[_0xb370('0x4b')][_0xb370('0x54')]=integrations[_0xb370('0x55')](_0x1c6730[_0xb370('0x4b')]['channel'],_0x1c6730[_0xb370('0x4b')][_0xb370('0x3f')]);return db[_0xb370('0x4e')][_0xb370('0x4a')](_0x1c6730['body'],{'include':[{'model':db['ZohoField'],'as':_0xb370('0x51')},{'model':db['ZohoField'],'as':_0xb370('0x54')}]});}return null;})['then'](respondWithResult(_0xd8ebba,null))['catch'](handleError(_0xd8ebba,null));};function getAccessToken(_0x38a33e){return new Promise(function(_0x4fa25e,_0x3ab73b){var _0x33fd8a;switch(_0x38a33e[_0xb370('0x56')]){case'US':_0x33fd8a=_0xb370('0x57');break;case'AU':_0x33fd8a=_0xb370('0x58');break;case'EU':_0x33fd8a=_0xb370('0x59');break;case'IN':_0x33fd8a=_0xb370('0x5a');break;case'CN':_0x33fd8a=_0xb370('0x5b');break;default:_0x33fd8a=_0xb370('0x59');break;}var _0x475dea={'method':_0xb370('0x5c'),'uri':_0x33fd8a+_0xb370('0x5d'),'qs':{'refresh_token':_0x38a33e[_0xb370('0x5e')],'client_id':_0x38a33e[_0xb370('0x5f')],'client_secret':_0x38a33e[_0xb370('0x60')],'grant_type':_0xb370('0x61')},'json':!![]};return rp(_0x475dea)[_0xb370('0x43')](function(_0x57fc2d){if(_0x57fc2d[_0xb370('0x62')]){_0x4fa25e(_0x57fc2d[_0xb370('0x62')]);}else{_0x3ab73b(_0xb370('0x63'));}})['catch'](function(_0x572114){_0x3ab73b(_0x572114);});});}exports['getFields']=function(_0x1494d7,_0x1238dd,_0x4c6b93){var _0x4eaef7,_0x5cf09d,_0x3439fc,_0x57ad97,_0x1e389c;return db['ZohoAccount'][_0xb370('0x4d')]({'where':{'id':_0x1494d7[_0xb370('0x4c')]['id']},'attributes':['id',_0xb370('0x64'),_0xb370('0x56'),_0xb370('0x5f'),_0xb370('0x60'),_0xb370('0x65'),_0xb370('0x66'),_0xb370('0x5e')]})[_0xb370('0x43')](handleEntityNotFound(_0x1238dd,null))[_0xb370('0x43')](function(_0x252558){_0x1e389c=_0x252558;_0x4eaef7=_0x1e389c[_0xb370('0x64')];_0x5cf09d=_0x4eaef7===_0xb370('0x67')?'eu':_0xb370('0x68');_0x3439fc=_0x1e389c[_0xb370('0x65')];var _0x541277=_0x3439fc[_0xb370('0x69')](-0x1);if(_0x541277==='/'||_0x541277==='\x5c'||_0x541277===':'){_0x3439fc=_0x3439fc[_0xb370('0x6a')](0x0,_0x3439fc[_0xb370('0x6b')](_0x541277));}if(!_0x1e389c[_0xb370('0x5e')]){throw new Error(_0xb370('0x6c'));}return getAccessToken(_0x1e389c);})[_0xb370('0x43')](function(_0xb2ba72){if(_0xb2ba72){return rp({'method':_0xb370('0x6d'),'uri':util[_0xb370('0x6e')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5cf09d),'qs':{'module':_0xb370('0x6f')},'headers':{'Authorization':_0xb370('0x70')+_0xb2ba72},'json':!![]});}})[_0xb370('0x43')](function(_0x2eec8d){if(_0x2eec8d){if(_0x2eec8d[_0xb370('0x71')]&&_0x2eec8d[_0xb370('0x71')][_0xb370('0x28')]){throw new Error(_0x2eec8d[_0xb370('0x71')][_0xb370('0x28')][_0xb370('0x72')]);}var _0x29cfd6=[];var _0x4adae4=[];var _0x28570f=['Owner',_0xb370('0x73'),_0xb370('0x74'),_0xb370('0x75'),_0xb370('0x76'),'Call_Result','Call_Start_Time',_0xb370('0x77')];_0x4adae4=_['remove'](_0x2eec8d[_0xb370('0x35')],function(_0xe1ac2b){return _0x28570f[_0xb370('0x78')](_0xe1ac2b['api_name']);});for(var _0x477cc3=0x0;_0x477cc3<_0x4adae4[_0xb370('0x36')];_0x477cc3++){if(_0x4adae4[_0x477cc3][_0xb370('0x79')]===![]){_0x29cfd6[_0xb370('0x7a')]({'id':_0x4adae4[_0x477cc3]['id'],'name':_0x4adae4[_0x477cc3]['display_label'],'custom':_0x4adae4[_0x477cc3]['custom_field'],'options':_0x4adae4[_0x477cc3][_0xb370('0x7b')]==='picklist'&&_0x4adae4[_0x477cc3][_0xb370('0x7c')][_0xb370('0x36')]>-0x1?_[_0xb370('0x2c')](_0x4adae4[_0x477cc3][_0xb370('0x7c')],function(_0x1621d3){return{'name':_0x1621d3,'value':_0x1621d3};}):[]});}}return{'count':_0x29cfd6['length'],'rows':_0x29cfd6};}else{return{'count':0x0,'rows':[]};}})[_0xb370('0x43')](respondWithResult(_0x1238dd,null))[_0xb370('0x47')](function(_0x60f60a){var _0x5dec71=_0x1494d7[_0xb370('0x31')]['test']?0x1f4:_0x60f60a[_0xb370('0x7d')]||0x1f4;logger['error'](_0xb370('0x7e'),_0xb370('0x7f'),_0x5dec71,JSON[_0xb370('0x80')](_0x60f60a));delete _0x60f60a['name'];if(_0x5dec71===0x191){_0x5dec71=0x190;}_0x1238dd[_0xb370('0x1a')](_0x5dec71)[_0xb370('0x2b')](_0x1494d7[_0xb370('0x31')][_0xb370('0x81')]?{'message':_0xb370('0x82'),'statusCode':_0x60f60a[_0xb370('0x7d')]}:_0x60f60a);});}; \ No newline at end of file +var _0xc04a=['https://accounts.zoho.eu','POST','/oauth/v2/token','refreshToken','clientSecret','access_token','getFields','host','code','com','serverUrl','slice','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','GET','format','Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','includes','api_name','system_mandatory','push','display_label','picklist','pick_list_values','statusCode','getFields,\x20%s,\x20%s,\x20%s','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','send','index','ZohoAccount','rawAttributes','fieldName','type','map','query','keys','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','includeAll','findAll','rows','show','params','include','find','catch','create','body','getConfigurations','findOne','ZohoConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ZohoField','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn'];(function(_0xb666cb,_0x274074){var _0x29a7a0=function(_0x762cb6){while(--_0x762cb6){_0xb666cb['push'](_0xb666cb['shift']());}};_0x29a7a0(++_0x274074);}(_0xc04a,0x132));var _0xac04=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc04a[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xac04('0x0'));var rimraf=require(_0xac04('0x1'));var zipdir=require(_0xac04('0x2'));var jsonpatch=require(_0xac04('0x3'));var rp=require(_0xac04('0x4'));var moment=require('moment');var BPromise=require(_0xac04('0x5'));var Mustache=require(_0xac04('0x6'));var util=require(_0xac04('0x7'));var path=require('path');var sox=require(_0xac04('0x8'));var csv=require(_0xac04('0x9'));var ejs=require(_0xac04('0xa'));var fs=require('fs');var fs_extra=require(_0xac04('0xb'));var _=require(_0xac04('0xc'));var squel=require(_0xac04('0xd'));var crypto=require(_0xac04('0xe'));var jsforce=require(_0xac04('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xac04('0x9'));var querystring=require(_0xac04('0x10'));var Papa=require(_0xac04('0x11'));var Redis=require(_0xac04('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xac04('0x13'));var as=require(_0xac04('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xac04('0x15'))(_0xac04('0x16'));var utils=require(_0xac04('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xac04('0x18'));var db=require(_0xac04('0x19'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x1199d0,_0x296fec){_0x296fec=_0x296fec||0xcc;return function(_0x411460){if(_0x411460){return _0x1199d0['sendStatus'](_0x296fec);}return _0x1199d0[_0xac04('0x1a')](_0x296fec)[_0xac04('0x1b')]();};}function respondWithResult(_0x48cb7f,_0x441055){_0x441055=_0x441055||0xc8;return function(_0x2b8859){if(_0x2b8859){return _0x48cb7f[_0xac04('0x1a')](_0x441055)[_0xac04('0x1c')](_0x2b8859);}};}function respondWithFilteredResult(_0x29c445,_0x17cd93){return function(_0x4b1515){if(_0x4b1515){var _0x44e82b=typeof _0x17cd93[_0xac04('0x1d')]==='undefined'&&typeof _0x17cd93[_0xac04('0x1e')]===_0xac04('0x1f');var _0x2f4a48=_0x4b1515['count'];var _0x4a1f92=_0x44e82b?0x0:_0x17cd93[_0xac04('0x1d')];var _0x51d379=_0x44e82b?_0x4b1515[_0xac04('0x20')]:_0x17cd93[_0xac04('0x1d')]+_0x17cd93['limit'];var _0x164bc6;if(_0x51d379>=_0x2f4a48){_0x51d379=_0x2f4a48;_0x164bc6=0xc8;}else{_0x164bc6=0xce;}_0x29c445['status'](_0x164bc6);return _0x29c445[_0xac04('0x21')](_0xac04('0x22'),_0x4a1f92+'-'+_0x51d379+'/'+_0x2f4a48)[_0xac04('0x1c')](_0x4b1515);}return null;};}function patchUpdates(_0x359fad){return function(_0x3633d9){try{jsonpatch['apply'](_0x3633d9,_0x359fad,!![]);}catch(_0x56451a){return BPromise[_0xac04('0x23')](_0x56451a);}return _0x3633d9[_0xac04('0x24')]();};}function saveUpdates(_0x648887,_0x413604){return function(_0x42ce6b){if(_0x42ce6b){return _0x42ce6b[_0xac04('0x25')](_0x648887)[_0xac04('0x26')](function(_0x3032ee){return _0x3032ee;});}return null;};}function removeEntity(_0x11c6a9,_0x46a39b){return function(_0x4fa9cb){if(_0x4fa9cb){return _0x4fa9cb[_0xac04('0x27')]()['then'](function(){_0x11c6a9[_0xac04('0x1a')](0xcc)[_0xac04('0x1b')]();});}};}function handleEntityNotFound(_0x4c311e,_0xae654c){return function(_0x30b859){if(!_0x30b859){_0x4c311e[_0xac04('0x28')](0x194);}return _0x30b859;};}function handleError(_0x4c3c18,_0x81fb60){_0x81fb60=_0x81fb60||0x1f4;return function(_0x1b03fb){logger['error'](_0x1b03fb[_0xac04('0x29')]);if(_0x1b03fb[_0xac04('0x2a')]){delete _0x1b03fb[_0xac04('0x2a')];}_0x4c3c18[_0xac04('0x1a')](_0x81fb60)[_0xac04('0x2b')](_0x1b03fb);};}exports[_0xac04('0x2c')]=function(_0x836ad5,_0x39c4cb){var _0xf2850f={},_0x10be0a={},_0x10d7f0={'count':0x0,'rows':[]};var _0x98f1f9=_['map'](db[_0xac04('0x2d')][_0xac04('0x2e')],function(_0x36cbe5){return{'name':_0x36cbe5[_0xac04('0x2f')],'type':_0x36cbe5[_0xac04('0x30')]['key']};});_0x10be0a['model']=_[_0xac04('0x31')](_0x98f1f9,_0xac04('0x2a'));_0x10be0a[_0xac04('0x32')]=_[_0xac04('0x33')](_0x836ad5[_0xac04('0x32')]);_0x10be0a['filters']=_[_0xac04('0x34')](_0x10be0a[_0xac04('0x35')],_0x10be0a[_0xac04('0x32')]);_0xf2850f['attributes']=_[_0xac04('0x34')](_0x10be0a['model'],qs['fields'](_0x836ad5[_0xac04('0x32')][_0xac04('0x36')]));_0xf2850f[_0xac04('0x37')]=_0xf2850f[_0xac04('0x37')][_0xac04('0x38')]?_0xf2850f[_0xac04('0x37')]:_0x10be0a[_0xac04('0x35')];if(!_0x836ad5[_0xac04('0x32')]['hasOwnProperty'](_0xac04('0x39'))){_0xf2850f[_0xac04('0x1e')]=qs[_0xac04('0x1e')](_0x836ad5[_0xac04('0x32')]['limit']);_0xf2850f[_0xac04('0x1d')]=qs[_0xac04('0x1d')](_0x836ad5[_0xac04('0x32')][_0xac04('0x1d')]);}_0xf2850f[_0xac04('0x3a')]=qs[_0xac04('0x3b')](_0x836ad5[_0xac04('0x32')][_0xac04('0x3b')]);_0xf2850f[_0xac04('0x3c')]=qs['filters'](_[_0xac04('0x3d')](_0x836ad5[_0xac04('0x32')],_0x10be0a[_0xac04('0x3e')]),_0x98f1f9);if(_0x836ad5[_0xac04('0x32')]['filter']){_0xf2850f[_0xac04('0x3c')]=_[_0xac04('0x3f')](_0xf2850f[_0xac04('0x3c')],{'$or':_[_0xac04('0x31')](_0x98f1f9,function(_0xc084ee){if(_0xc084ee['type']!==_0xac04('0x40')){var _0xfb753d={};_0xfb753d[_0xc084ee[_0xac04('0x2a')]]={'$like':'%'+_0x836ad5[_0xac04('0x32')][_0xac04('0x41')]+'%'};return _0xfb753d;}})});}_0xf2850f=_[_0xac04('0x3f')]({},_0xf2850f,_0x836ad5[_0xac04('0x42')]);var _0x4fc641={'where':_0xf2850f[_0xac04('0x3c')]};return db['ZohoAccount']['count'](_0x4fc641)[_0xac04('0x26')](function(_0x53f4eb){_0x10d7f0[_0xac04('0x20')]=_0x53f4eb;if(_0x836ad5[_0xac04('0x32')][_0xac04('0x43')]){_0xf2850f['include']=[{'all':!![]}];}return db[_0xac04('0x2d')][_0xac04('0x44')](_0xf2850f);})[_0xac04('0x26')](function(_0x18bfc1){_0x10d7f0[_0xac04('0x45')]=_0x18bfc1;return _0x10d7f0;})[_0xac04('0x26')](respondWithFilteredResult(_0x39c4cb,_0xf2850f))['catch'](handleError(_0x39c4cb,null));};exports[_0xac04('0x46')]=function(_0x528f85,_0x320a82){var _0x2b9aa0={'raw':![],'where':{'id':_0x528f85[_0xac04('0x47')]['id']}},_0xb7eeb6={};_0xb7eeb6[_0xac04('0x35')]=_['keys'](db[_0xac04('0x2d')][_0xac04('0x2e')]);_0xb7eeb6[_0xac04('0x32')]=_[_0xac04('0x33')](_0x528f85['query']);_0xb7eeb6['filters']=_['intersection'](_0xb7eeb6[_0xac04('0x35')],_0xb7eeb6['query']);_0x2b9aa0['attributes']=_[_0xac04('0x34')](_0xb7eeb6[_0xac04('0x35')],qs[_0xac04('0x36')](_0x528f85[_0xac04('0x32')][_0xac04('0x36')]));_0x2b9aa0[_0xac04('0x37')]=_0x2b9aa0[_0xac04('0x37')][_0xac04('0x38')]?_0x2b9aa0['attributes']:_0xb7eeb6[_0xac04('0x35')];if(_0x528f85[_0xac04('0x32')][_0xac04('0x43')]){_0x2b9aa0[_0xac04('0x48')]=[{'all':!![]}];}_0x2b9aa0=_[_0xac04('0x3f')]({},_0x2b9aa0,_0x528f85[_0xac04('0x42')]);return db[_0xac04('0x2d')][_0xac04('0x49')](_0x2b9aa0)['then'](handleEntityNotFound(_0x320a82,null))[_0xac04('0x26')](respondWithResult(_0x320a82,null))[_0xac04('0x4a')](handleError(_0x320a82,null));};exports['create']=function(_0x457da4,_0x1efcce){return db[_0xac04('0x2d')][_0xac04('0x4b')](_0x457da4[_0xac04('0x4c')],{})[_0xac04('0x26')](respondWithResult(_0x1efcce,0xc9))[_0xac04('0x4a')](handleError(_0x1efcce,null));};exports[_0xac04('0x25')]=function(_0xb11104,_0xa12e18){if(_0xb11104[_0xac04('0x4c')]['id']){delete _0xb11104[_0xac04('0x4c')]['id'];}return db['ZohoAccount']['find']({'where':{'id':_0xb11104[_0xac04('0x47')]['id']}})[_0xac04('0x26')](handleEntityNotFound(_0xa12e18,null))[_0xac04('0x26')](saveUpdates(_0xb11104[_0xac04('0x4c')],null))[_0xac04('0x26')](respondWithResult(_0xa12e18,null))['catch'](handleError(_0xa12e18,null));};exports[_0xac04('0x27')]=function(_0x1960ad,_0x334946){return db[_0xac04('0x2d')][_0xac04('0x49')]({'where':{'id':_0x1960ad[_0xac04('0x47')]['id']}})[_0xac04('0x26')](handleEntityNotFound(_0x334946,null))['then'](removeEntity(_0x334946,null))[_0xac04('0x4a')](handleError(_0x334946,null));};exports[_0xac04('0x4d')]=function(_0x4eed8d,_0x2789c3,_0x570453){var _0x914e83={};var _0x4e5c1a={};var _0x3c3c97;var _0x4030fb;return db[_0xac04('0x2d')][_0xac04('0x4e')]({'where':{'id':_0x4eed8d[_0xac04('0x47')]['id']}})[_0xac04('0x26')](handleEntityNotFound(_0x2789c3,null))[_0xac04('0x26')](function(_0x7cc8e8){if(_0x7cc8e8){_0x3c3c97=_0x7cc8e8;_0x4e5c1a[_0xac04('0x35')]=_[_0xac04('0x33')](db[_0xac04('0x4f')]['rawAttributes']);_0x4e5c1a['query']=_[_0xac04('0x33')](_0x4eed8d[_0xac04('0x32')]);_0x4e5c1a['filters']=_[_0xac04('0x34')](_0x4e5c1a[_0xac04('0x35')],_0x4e5c1a['query']);_0x914e83[_0xac04('0x37')]=_['intersection'](_0x4e5c1a[_0xac04('0x35')],qs[_0xac04('0x36')](_0x4eed8d[_0xac04('0x32')][_0xac04('0x36')]));_0x914e83[_0xac04('0x37')]=_0x914e83[_0xac04('0x37')][_0xac04('0x38')]?_0x914e83[_0xac04('0x37')]:_0x4e5c1a[_0xac04('0x35')];_0x914e83[_0xac04('0x3a')]=qs[_0xac04('0x3b')](_0x4eed8d[_0xac04('0x32')][_0xac04('0x3b')]);_0x914e83[_0xac04('0x3c')]=qs[_0xac04('0x3e')](_[_0xac04('0x3d')](_0x4eed8d[_0xac04('0x32')],_0x4e5c1a[_0xac04('0x3e')]));if(_0x4eed8d[_0xac04('0x32')][_0xac04('0x41')]){_0x914e83[_0xac04('0x3c')]=_[_0xac04('0x3f')](_0x914e83[_0xac04('0x3c')],{'$or':_[_0xac04('0x31')](_0x914e83[_0xac04('0x37')],function(_0x5c6409){var _0x16d501={};_0x16d501[_0x5c6409]={'$like':'%'+_0x4eed8d[_0xac04('0x32')][_0xac04('0x41')]+'%'};return _0x16d501;})});}_0x914e83=_['merge']({},_0x914e83,_0x4eed8d[_0xac04('0x42')]);return _0x3c3c97[_0xac04('0x4d')](_0x914e83);}})[_0xac04('0x26')](function(_0x23cd63){if(_0x23cd63){_0x4030fb=_0x23cd63['length'];if(!_0x4eed8d[_0xac04('0x32')]['hasOwnProperty'](_0xac04('0x39'))){_0x914e83[_0xac04('0x1e')]=qs[_0xac04('0x1e')](_0x4eed8d[_0xac04('0x32')][_0xac04('0x1e')]);_0x914e83[_0xac04('0x1d')]=qs[_0xac04('0x1d')](_0x4eed8d[_0xac04('0x32')][_0xac04('0x1d')]);}return _0x3c3c97['getConfigurations'](_0x914e83);}})[_0xac04('0x26')](function(_0x523568){if(_0x523568){return _0x523568?{'count':_0x4030fb,'rows':_0x523568}:null;}})['then'](respondWithResult(_0x2789c3,null))['catch'](handleError(_0x2789c3,null));};exports[_0xac04('0x50')]=function(_0x213e01,_0x106f85,_0x2ddebc){if(_0x213e01[_0xac04('0x4c')]['id']){delete _0x213e01[_0xac04('0x4c')]['id'];}return db[_0xac04('0x2d')][_0xac04('0x4e')]({'where':{'id':_0x213e01[_0xac04('0x47')]['id']}})[_0xac04('0x26')](handleEntityNotFound(_0x106f85,null))['then'](function(_0x4c4507){if(_0x4c4507){_0x213e01['body'][_0xac04('0x51')]=_0x4c4507['id'];_0x213e01['body'][_0xac04('0x52')]=integrations[_0xac04('0x53')](_0x213e01[_0xac04('0x4c')][_0xac04('0x54')],_0x213e01[_0xac04('0x4c')][_0xac04('0x30')]);_0x213e01[_0xac04('0x4c')][_0xac04('0x55')]=integrations[_0xac04('0x56')](_0x213e01['body'][_0xac04('0x54')],_0x213e01[_0xac04('0x4c')][_0xac04('0x30')]);return db[_0xac04('0x4f')][_0xac04('0x4b')](_0x213e01[_0xac04('0x4c')],{'include':[{'model':db[_0xac04('0x57')],'as':'Subjects'},{'model':db[_0xac04('0x57')],'as':_0xac04('0x55')}]});}return null;})[_0xac04('0x26')](respondWithResult(_0x106f85,null))[_0xac04('0x4a')](handleError(_0x106f85,null));};function getAccessToken(_0x220f68){return new Promise(function(_0x3501ef,_0x52bbd0){var _0x39dd86;switch(_0x220f68[_0xac04('0x58')]){case'US':_0x39dd86=_0xac04('0x59');break;case'AU':_0x39dd86=_0xac04('0x5a');break;case'EU':_0x39dd86='https://accounts.zoho.eu';break;case'IN':_0x39dd86=_0xac04('0x5b');break;case'CN':_0x39dd86=_0xac04('0x5c');break;default:_0x39dd86=_0xac04('0x5d');break;}var _0x55b3a9={'method':_0xac04('0x5e'),'uri':_0x39dd86+_0xac04('0x5f'),'qs':{'refresh_token':_0x220f68[_0xac04('0x60')],'client_id':_0x220f68['clientId'],'client_secret':_0x220f68[_0xac04('0x61')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x55b3a9)[_0xac04('0x26')](function(_0x420155){if(_0x420155[_0xac04('0x62')]){_0x3501ef(_0x420155[_0xac04('0x62')]);}else{_0x52bbd0('Unable\x20to\x20retrieve\x20the\x20access\x20token');}})[_0xac04('0x4a')](function(_0x2414ae){_0x52bbd0(_0x2414ae);});});}exports[_0xac04('0x63')]=function(_0x40cdff,_0x5c06a6,_0x33e0b7){var _0x1a3853,_0x4b3822,_0x3816bd,_0x59b277,_0x5d9d4c;return db['ZohoAccount']['findOne']({'where':{'id':_0x40cdff[_0xac04('0x47')]['id']},'attributes':['id',_0xac04('0x64'),'zone','clientId','clientSecret','serverUrl',_0xac04('0x65'),'refreshToken']})[_0xac04('0x26')](handleEntityNotFound(_0x5c06a6,null))[_0xac04('0x26')](function(_0x641bfb){_0x5d9d4c=_0x641bfb;_0x1a3853=_0x5d9d4c[_0xac04('0x64')];_0x4b3822=_0x1a3853==='zoho.eu'?'eu':_0xac04('0x66');_0x3816bd=_0x5d9d4c[_0xac04('0x67')];var _0x3e9582=_0x3816bd[_0xac04('0x68')](-0x1);if(_0x3e9582==='/'||_0x3e9582==='\x5c'||_0x3e9582===':'){_0x3816bd=_0x3816bd['substring'](0x0,_0x3816bd[_0xac04('0x69')](_0x3e9582));}if(!_0x5d9d4c[_0xac04('0x60')]){throw new Error(_0xac04('0x6a'));}return getAccessToken(_0x5d9d4c);})['then'](function(_0x2b4421){if(_0x2b4421){return rp({'method':_0xac04('0x6b'),'uri':util[_0xac04('0x6c')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x4b3822),'qs':{'module':_0xac04('0x6d')},'headers':{'Authorization':_0xac04('0x6e')+_0x2b4421},'json':!![]});}})[_0xac04('0x26')](function(_0x418b88){if(_0x418b88){if(_0x418b88[_0xac04('0x6f')]&&_0x418b88[_0xac04('0x6f')][_0xac04('0x70')]){throw new Error(_0x418b88[_0xac04('0x6f')][_0xac04('0x70')][_0xac04('0x71')]);}var _0x10ec04=[];var _0x117ee8=[];var _0xd5e32d=[_0xac04('0x72'),_0xac04('0x73'),_0xac04('0x74'),_0xac04('0x75'),_0xac04('0x76'),_0xac04('0x77'),_0xac04('0x78'),_0xac04('0x79')];_0x117ee8=_[_0xac04('0x7a')](_0x418b88[_0xac04('0x36')],function(_0x366f64){return _0xd5e32d[_0xac04('0x7b')](_0x366f64[_0xac04('0x7c')]);});for(var _0x107a25=0x0;_0x107a25<_0x117ee8[_0xac04('0x38')];_0x107a25++){if(_0x117ee8[_0x107a25][_0xac04('0x7d')]===![]){_0x10ec04[_0xac04('0x7e')]({'id':_0x117ee8[_0x107a25]['id'],'name':_0x117ee8[_0x107a25][_0xac04('0x7f')],'custom':_0x117ee8[_0x107a25]['custom_field'],'options':_0x117ee8[_0x107a25]['data_type']===_0xac04('0x80')&&_0x117ee8[_0x107a25][_0xac04('0x81')][_0xac04('0x38')]>-0x1?_['map'](_0x117ee8[_0x107a25]['pick_list_values'],function(_0x4602ef){return{'name':_0x4602ef,'value':_0x4602ef};}):[]});}}return{'count':_0x10ec04[_0xac04('0x38')],'rows':_0x10ec04};}else{return{'count':0x0,'rows':[]};}})[_0xac04('0x26')](respondWithResult(_0x5c06a6,null))['catch'](function(_0x2c930c){var _0x26d9a7=_0x40cdff[_0xac04('0x32')]['test']?0x1f4:_0x2c930c[_0xac04('0x82')]||0x1f4;logger[_0xac04('0x70')](_0xac04('0x83'),_0xac04('0x63'),_0x26d9a7,JSON['stringify'](_0x2c930c));delete _0x2c930c[_0xac04('0x2a')];if(_0x26d9a7===0x191){_0x26d9a7=0x190;}_0x5c06a6['status'](_0x26d9a7)[_0xac04('0x2b')](_0x40cdff[_0xac04('0x32')]['test']?{'message':_0xac04('0x84'),'statusCode':_0x2c930c[_0xac04('0x82')]}:_0x2c930c);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 1d71369..7df085f 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 _0x8452=['ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','code','slice','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','clientSecret','then','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','host','application/x-www-form-urlencoded','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','../../components/integrations/configuration','exports','define'];(function(_0x9fda0f,_0x3abc93){var _0x4ca9d2=function(_0x37b2e8){while(--_0x37b2e8){_0x9fda0f['push'](_0x9fda0f['shift']());}};_0x4ca9d2(++_0x3abc93);}(_0x8452,0x123));var _0x2845=function(_0x533d54,_0x29c8ab){_0x533d54=_0x533d54-0x0;var _0x4e03f5=_0x8452[_0x533d54];return _0x4e03f5;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2845('0x0'))(_0x2845('0x1'));var moment=require(_0x2845('0x2'));var BPromise=require(_0x2845('0x3'));var rp=require(_0x2845('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2845('0x5'));var config=require(_0x2845('0x6'));var attributes=require('./intZohoAccount.attributes');var integrations=require(_0x2845('0x7'));module[_0x2845('0x8')]=function(_0x22f5b9,_0x306c70){return _0x22f5b9[_0x2845('0x9')](_0x2845('0xa'),attributes,{'tableName':_0x2845('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2db6fa,_0x2b1ba8,_0x14f356){if(_0x2db6fa[_0x2845('0xc')](_0x2845('0xd'))||_0x2db6fa['changed'](_0x2845('0xe'))||_0x2db6fa['changed'](_0x2845('0xf'))||_0x2db6fa['changed']('clientSecret')||_0x2db6fa[_0x2845('0xc')](_0x2845('0x10'))||_0x2db6fa[_0x2845('0xc')]('host')){var _0x2ae25a,_0x2af7c7;_0x2ae25a=_0x2db6fa[_0x2845('0xe')];var _0x2ce3cd=_0x2ae25a[_0x2845('0x11')](-0x1);if(_0x2ce3cd==='/'||_0x2ce3cd==='\x5c'||_0x2ce3cd===':'){_0x2ae25a=_0x2ae25a[_0x2845('0x12')](0x0,_0x2ae25a[_0x2845('0x13')](_0x2ce3cd));}switch(_0x2db6fa[_0x2845('0xd')]){case'US':_0x2af7c7=_0x2845('0x14');break;case'AU':_0x2af7c7=_0x2845('0x15');break;case'IN':_0x2af7c7=_0x2845('0x16');break;case'CN':_0x2af7c7=_0x2845('0x17');break;default:_0x2af7c7=_0x2845('0x18');break;}var _0x49df0f={'method':_0x2845('0x19'),'uri':_0x2af7c7+_0x2845('0x1a'),'form':{'grant_type':_0x2845('0x1b'),'client_id':_0x2db6fa[_0x2845('0xf')],'client_secret':_0x2db6fa[_0x2845('0x1c')],'redirect_uri':_0x2db6fa['serverUrl'],'code':_0x2db6fa[_0x2845('0x10')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x49df0f)[_0x2845('0x1d')](function(_0x5dddf5){var _0x4a14ed=JSON[_0x2845('0x1e')](_0x5dddf5);if(_0x4a14ed[_0x2845('0x1f')]){_0x2db6fa[_0x2845('0x20')]=_0x4a14ed[_0x2845('0x1f')];logger[_0x2845('0x21')](util[_0x2845('0x22')](_0x2845('0x23'),_0x2db6fa[_0x2845('0x24')],_0x2db6fa['id']));}else{logger[_0x2845('0x25')](util[_0x2845('0x22')](_0x2845('0x26'),_0x2db6fa['name'],_0x2db6fa['id']),util[_0x2845('0x27')](_0x4a14ed,{'showHidden':![],'depth':null}));}return _0x14f356(null,_0x2b1ba8);})[_0x2845('0x28')](function(_0x597520){logger[_0x2845('0x25')](util[_0x2845('0x22')](_0x2845('0x26'),_0x2db6fa[_0x2845('0x24')],_0x2db6fa['id']),util[_0x2845('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x14f356(_0x597520);});}else{return _0x14f356(null,_0x2b1ba8);}},'beforeUpdate':function(_0xe0944c,_0x5edff6,_0x1ddf4b){if(_0xe0944c['changed']('zone')||_0xe0944c['changed']('serverUrl')||_0xe0944c[_0x2845('0xc')](_0x2845('0xf'))||_0xe0944c[_0x2845('0xc')]('clientSecret')||_0xe0944c[_0x2845('0xc')](_0x2845('0x10'))||_0xe0944c['changed'](_0x2845('0x29'))){var _0x2acfb6,_0x14bd19;_0x2acfb6=_0xe0944c[_0x2845('0xe')];var _0x339a29=_0x2acfb6[_0x2845('0x11')](-0x1);if(_0x339a29==='/'||_0x339a29==='\x5c'||_0x339a29===':'){_0x2acfb6=_0x2acfb6['substring'](0x0,_0x2acfb6['lastIndexOf'](_0x339a29));}switch(_0xe0944c[_0x2845('0xd')]){case'US':_0x14bd19=_0x2845('0x14');break;case'AU':_0x14bd19=_0x2845('0x15');break;case'IN':_0x14bd19=_0x2845('0x16');break;case'CN':_0x14bd19=_0x2845('0x17');break;default:_0x14bd19='https://accounts.zoho.eu';break;}var _0x5cd68d={'method':_0x2845('0x19'),'uri':_0x14bd19+_0x2845('0x1a'),'form':{'grant_type':_0x2845('0x1b'),'client_id':_0xe0944c[_0x2845('0xf')],'client_secret':_0xe0944c[_0x2845('0x1c')],'redirect_uri':_0xe0944c['serverUrl'],'code':_0xe0944c[_0x2845('0x10')]},'headers':{'Content-Type':_0x2845('0x2a')}};return rp(_0x5cd68d)['then'](function(_0x422626){var _0x51e8bb=JSON[_0x2845('0x1e')](_0x422626);if(_0x51e8bb['refresh_token']){_0xe0944c[_0x2845('0x20')]=_0x51e8bb[_0x2845('0x1f')];logger[_0x2845('0x21')](util[_0x2845('0x22')](_0x2845('0x23'),_0xe0944c['name'],_0xe0944c['id']));}else{logger[_0x2845('0x25')](util['format'](_0x2845('0x26'),_0xe0944c['name'],_0xe0944c['id']),util[_0x2845('0x27')](_0x51e8bb,{'showHidden':![],'depth':null}));}return _0x1ddf4b(null,_0x5edff6);})[_0x2845('0x28')](function(_0x3167f5){logger[_0x2845('0x25')](util['format'](_0x2845('0x26'),_0xe0944c[_0x2845('0x24')],_0xe0944c['id']),util[_0x2845('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0x1ddf4b(_0x3167f5);});}else{return _0x1ddf4b(null,_0x5edff6);}}}});}; \ No newline at end of file +var _0x3f97=['code','slice','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','clientSecret','then','parse','refresh_token','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','authorization_code','application/x-www-form-urlencoded','refreshToken','lodash','util','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','exports','define','ZohoAccount','changed','zone','serverUrl','clientId'];(function(_0x41dc96,_0x1d0a52){var _0x2208e6=function(_0x311582){while(--_0x311582){_0x41dc96['push'](_0x41dc96['shift']());}};_0x2208e6(++_0x1d0a52);}(_0x3f97,0x110));var _0x73f9=function(_0x3fc127,_0x51fec1){_0x3fc127=_0x3fc127-0x0;var _0xdaae7d=_0x3f97[_0x3fc127];return _0xdaae7d;};'use strict';var _=require(_0x73f9('0x0'));var util=require(_0x73f9('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x73f9('0x2'));var rp=require(_0x73f9('0x3'));var fs=require('fs');var path=require(_0x73f9('0x4'));var rimraf=require(_0x73f9('0x5'));var config=require('../../config/environment');var attributes=require(_0x73f9('0x6'));var integrations=require(_0x73f9('0x7'));module[_0x73f9('0x8')]=function(_0x4a9e9a,_0x1c9003){return _0x4a9e9a[_0x73f9('0x9')](_0x73f9('0xa'),attributes,{'tableName':'int_zoho_accounts','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x32cf50,_0x2a2787,_0x5469e6){if(_0x32cf50[_0x73f9('0xb')](_0x73f9('0xc'))||_0x32cf50[_0x73f9('0xb')](_0x73f9('0xd'))||_0x32cf50[_0x73f9('0xb')](_0x73f9('0xe'))||_0x32cf50[_0x73f9('0xb')]('clientSecret')||_0x32cf50['changed'](_0x73f9('0xf'))||_0x32cf50[_0x73f9('0xb')]('host')){var _0x57ccde,_0x105fec;_0x57ccde=_0x32cf50[_0x73f9('0xd')];var _0x2ef840=_0x57ccde[_0x73f9('0x10')](-0x1);if(_0x2ef840==='/'||_0x2ef840==='\x5c'||_0x2ef840===':'){_0x57ccde=_0x57ccde[_0x73f9('0x11')](0x0,_0x57ccde[_0x73f9('0x12')](_0x2ef840));}switch(_0x32cf50[_0x73f9('0xc')]){case'US':_0x105fec=_0x73f9('0x13');break;case'AU':_0x105fec=_0x73f9('0x14');break;case'IN':_0x105fec=_0x73f9('0x15');break;case'CN':_0x105fec=_0x73f9('0x16');break;default:_0x105fec=_0x73f9('0x17');break;}var _0x450947={'method':_0x73f9('0x18'),'uri':_0x105fec+_0x73f9('0x19'),'form':{'grant_type':'authorization_code','client_id':_0x32cf50[_0x73f9('0xe')],'client_secret':_0x32cf50[_0x73f9('0x1a')],'redirect_uri':_0x32cf50[_0x73f9('0xd')],'code':_0x32cf50[_0x73f9('0xf')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x450947)[_0x73f9('0x1b')](function(_0x1118e8){var _0x5d2d3e=JSON[_0x73f9('0x1c')](_0x1118e8);if(_0x5d2d3e[_0x73f9('0x1d')]){_0x32cf50['refreshToken']=_0x5d2d3e['refresh_token'];logger[_0x73f9('0x1e')](util[_0x73f9('0x1f')](_0x73f9('0x20'),_0x32cf50[_0x73f9('0x21')],_0x32cf50['id']));}else{logger[_0x73f9('0x22')](util[_0x73f9('0x1f')](_0x73f9('0x23'),_0x32cf50[_0x73f9('0x21')],_0x32cf50['id']),util[_0x73f9('0x24')](_0x5d2d3e,{'showHidden':![],'depth':null}));}return _0x5469e6(null,_0x2a2787);})[_0x73f9('0x25')](function(_0x2f8c64){logger[_0x73f9('0x22')](util[_0x73f9('0x1f')](_0x73f9('0x23'),_0x32cf50[_0x73f9('0x21')],_0x32cf50['id']),util[_0x73f9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x5469e6(_0x2f8c64);});}else{return _0x5469e6(null,_0x2a2787);}},'beforeUpdate':function(_0x4139f3,_0x4dd009,_0x43786c){if(_0x4139f3[_0x73f9('0xb')](_0x73f9('0xc'))||_0x4139f3[_0x73f9('0xb')](_0x73f9('0xd'))||_0x4139f3['changed'](_0x73f9('0xe'))||_0x4139f3['changed']('clientSecret')||_0x4139f3['changed'](_0x73f9('0xf'))||_0x4139f3[_0x73f9('0xb')]('host')){var _0x379cd3,_0x1012fe;_0x379cd3=_0x4139f3[_0x73f9('0xd')];var _0x5da5ba=_0x379cd3[_0x73f9('0x10')](-0x1);if(_0x5da5ba==='/'||_0x5da5ba==='\x5c'||_0x5da5ba===':'){_0x379cd3=_0x379cd3[_0x73f9('0x11')](0x0,_0x379cd3[_0x73f9('0x12')](_0x5da5ba));}switch(_0x4139f3[_0x73f9('0xc')]){case'US':_0x1012fe=_0x73f9('0x13');break;case'AU':_0x1012fe=_0x73f9('0x14');break;case'IN':_0x1012fe=_0x73f9('0x15');break;case'CN':_0x1012fe=_0x73f9('0x16');break;default:_0x1012fe=_0x73f9('0x17');break;}var _0xff4e20={'method':'POST','uri':_0x1012fe+_0x73f9('0x19'),'form':{'grant_type':_0x73f9('0x26'),'client_id':_0x4139f3[_0x73f9('0xe')],'client_secret':_0x4139f3[_0x73f9('0x1a')],'redirect_uri':_0x4139f3[_0x73f9('0xd')],'code':_0x4139f3[_0x73f9('0xf')]},'headers':{'Content-Type':_0x73f9('0x27')}};return rp(_0xff4e20)['then'](function(_0x2decb){var _0x41868d=JSON[_0x73f9('0x1c')](_0x2decb);if(_0x41868d[_0x73f9('0x1d')]){_0x4139f3[_0x73f9('0x28')]=_0x41868d['refresh_token'];logger[_0x73f9('0x1e')](util['format'](_0x73f9('0x20'),_0x4139f3[_0x73f9('0x21')],_0x4139f3['id']));}else{logger['error'](util[_0x73f9('0x1f')](_0x73f9('0x23'),_0x4139f3[_0x73f9('0x21')],_0x4139f3['id']),util['inspect'](_0x41868d,{'showHidden':![],'depth':null}));}return _0x43786c(null,_0x4dd009);})[_0x73f9('0x25')](function(_0x5eb2e4){logger[_0x73f9('0x22')](util[_0x73f9('0x1f')](_0x73f9('0x23'),_0x4139f3[_0x73f9('0x21')],_0x4139f3['id']),util[_0x73f9('0x24')](parsedResult,{'showHidden':![],'depth':null}));return _0x43786c(_0x5eb2e4);});}else{return _0x43786c(null,_0x4dd009);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 2b01f1d..f6a294e 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 _0xb78e=['raw','ShowZohoAccount','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetZohoAccount','ZohoAccount','options','where','attributes','limit','include','model','map','find'];(function(_0x33b62d,_0x507d01){var _0x215d79=function(_0x3b7c4f){while(--_0x3b7c4f){_0x33b62d['push'](_0x33b62d['shift']());}};_0x215d79(++_0x507d01);}(_0xb78e,0x1c9));var _0xeb78=function(_0x40b551,_0x129c88){_0x40b551=_0x40b551-0x0;var _0x452ea9=_0xb78e[_0x40b551];return _0x452ea9;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1ccc2f,_0x30c884,_0x2b7925){return new BPromise(function(_0x36963f,_0x5259aa){return client['request'](_0x1ccc2f,_0x2b7925)[_0xeb78('0xc')](function(_0x1c941d){logger[_0xeb78('0xd')](_0xeb78('0xe'),_0x30c884,_0xeb78('0xf'));logger[_0xeb78('0x10')](_0xeb78('0x11'),_0x30c884,_0xeb78('0xf'),JSON[_0xeb78('0x12')](_0x1c941d));if(_0x1c941d['error']){if(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x14')]===0x1f4){logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);return _0x5259aa(_0x1c941d[_0xeb78('0x13')][_0xeb78('0x15')]);}logger[_0xeb78('0x13')](_0xeb78('0xe'),_0x30c884,_0x1c941d['error'][_0xeb78('0x15')]);return _0x36963f(_0x1c941d[_0xeb78('0x13')]['message']);}else{logger['info']('ZohoAccount,\x20%s,\x20%s',_0x30c884,_0xeb78('0xf'));_0x36963f(_0x1c941d['result'][_0xeb78('0x15')]);}})[_0xeb78('0x16')](function(_0x49123d){logger[_0xeb78('0x13')]('ZohoAccount,\x20%s,\x20%s',_0x30c884,_0x49123d);_0x5259aa(_0x49123d);});});}exports[_0xeb78('0x17')]=function(_0x92e410){var _0x576802=this;return new Promise(function(_0x45176e,_0xb97756){return db[_0xeb78('0x18')]['findAll']({'raw':_0x92e410[_0xeb78('0x19')]?_0x92e410[_0xeb78('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x92e410['options']?_0x92e410[_0xeb78('0x19')][_0xeb78('0x1a')]||null:null,'attributes':_0x92e410[_0xeb78('0x19')]?_0x92e410[_0xeb78('0x19')][_0xeb78('0x1b')]||null:null,'limit':_0x92e410[_0xeb78('0x19')]?_0x92e410[_0xeb78('0x19')][_0xeb78('0x1c')]||null:null,'include':_0x92e410[_0xeb78('0x19')]?_0x92e410['options']['include']?_['map'](_0x92e410['options'][_0xeb78('0x1d')],function(_0x5b15d8){return{'model':db[_0x5b15d8[_0xeb78('0x1e')]],'as':_0x5b15d8['as'],'attributes':_0x5b15d8[_0xeb78('0x1b')],'include':_0x5b15d8['include']?_[_0xeb78('0x1f')](_0x5b15d8['include'],function(_0x9a00b){return{'model':db[_0x9a00b[_0xeb78('0x1e')]],'as':_0x9a00b['as'],'attributes':_0x9a00b[_0xeb78('0x1b')],'include':_0x9a00b[_0xeb78('0x1d')]?_['map'](_0x9a00b[_0xeb78('0x1d')],function(_0x515158){return{'model':db[_0x515158[_0xeb78('0x1e')]],'as':_0x515158['as'],'attributes':_0x515158[_0xeb78('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xeb78('0xc')](function(_0x5263fc){logger[_0xeb78('0xd')](_0xeb78('0x17'),_0x92e410);logger[_0xeb78('0x10')](_0xeb78('0x17'),_0x92e410,JSON[_0xeb78('0x12')](_0x5263fc));_0x45176e(_0x5263fc);})[_0xeb78('0x16')](function(_0x1131a9){logger[_0xeb78('0x13')](_0xeb78('0x17'),_0x1131a9[_0xeb78('0x15')],_0x92e410);_0xb97756(_0x576802[_0xeb78('0x13')](0x1f4,_0x1131a9['message']));});});};exports['ShowZohoAccount']=function(_0x4d12a3){var _0xb3a935=this;return new Promise(function(_0x4253ea,_0x15327f){return db['ZohoAccount'][_0xeb78('0x20')]({'raw':_0x4d12a3[_0xeb78('0x19')]?_0x4d12a3[_0xeb78('0x19')][_0xeb78('0x21')]===undefined?!![]:![]:!![],'where':_0x4d12a3[_0xeb78('0x19')]?_0x4d12a3[_0xeb78('0x19')][_0xeb78('0x1a')]||null:null,'attributes':_0x4d12a3[_0xeb78('0x19')]?_0x4d12a3[_0xeb78('0x19')]['attributes']||null:null,'include':_0x4d12a3[_0xeb78('0x19')]?_0x4d12a3['options'][_0xeb78('0x1d')]?_[_0xeb78('0x1f')](_0x4d12a3[_0xeb78('0x19')][_0xeb78('0x1d')],function(_0x2d1e1b){return{'model':db[_0x2d1e1b[_0xeb78('0x1e')]],'as':_0x2d1e1b['as'],'attributes':_0x2d1e1b['attributes'],'include':_0x2d1e1b['include']?_[_0xeb78('0x1f')](_0x2d1e1b[_0xeb78('0x1d')],function(_0x13dec8){return{'model':db[_0x13dec8[_0xeb78('0x1e')]],'as':_0x13dec8['as'],'attributes':_0x13dec8[_0xeb78('0x1b')],'include':_0x13dec8['include']?_[_0xeb78('0x1f')](_0x13dec8[_0xeb78('0x1d')],function(_0x286107){return{'model':db[_0x286107[_0xeb78('0x1e')]],'as':_0x286107['as'],'attributes':_0x286107[_0xeb78('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xeb78('0xc')](function(_0x55b3d4){logger['info']('ShowZohoAccount',_0x4d12a3);logger['debug'](_0xeb78('0x22'),_0x4d12a3,JSON[_0xeb78('0x12')](_0x55b3d4));_0x4253ea(_0x55b3d4);})[_0xeb78('0x16')](function(_0x58348b){logger[_0xeb78('0x13')](_0xeb78('0x22'),_0x58348b['message'],_0x4d12a3);_0x15327f(_0xb3a935['error'](0x1f4,_0x58348b['message']));});});}; \ No newline at end of file +var _0x6a95=['../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetZohoAccount','ZohoAccount','findAll','options','raw','attributes','include','map','model','then','ShowZohoAccount','find','where','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x255e42,_0x1b8f05){var _0x36151c=function(_0x342cdc){while(--_0x342cdc){_0x255e42['push'](_0x255e42['shift']());}};_0x36151c(++_0x1b8f05);}(_0x6a95,0x1db));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(_0x56a9('0x2'));var BPromise=require(_0x56a9('0x3'));var rs=require(_0x56a9('0x4'));var fs=require('fs');var Redis=require(_0x56a9('0x5'));var db=require(_0x56a9('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x56a9('0x7'));var config=require(_0x56a9('0x8'));var jayson=require(_0x56a9('0x9'));var client=jayson[_0x56a9('0xa')][_0x56a9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x365093,_0xd8aa7c,_0x5d3e80){return new BPromise(function(_0x5f0dcb,_0x3ac626){return client[_0x56a9('0xc')](_0x365093,_0x5d3e80)['then'](function(_0xe4b98c){logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));logger[_0x56a9('0x10')](_0x56a9('0x11'),_0xd8aa7c,_0x56a9('0xf'),JSON[_0x56a9('0x12')](_0xe4b98c));if(_0xe4b98c[_0x56a9('0x13')]){if(_0xe4b98c['error'][_0x56a9('0x14')]===0x1f4){logger['error'](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x3ac626(_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);}logger[_0x56a9('0x13')](_0x56a9('0xe'),_0xd8aa7c,_0xe4b98c[_0x56a9('0x13')][_0x56a9('0x15')]);return _0x5f0dcb(_0xe4b98c['error']['message']);}else{logger[_0x56a9('0xd')](_0x56a9('0xe'),_0xd8aa7c,_0x56a9('0xf'));_0x5f0dcb(_0xe4b98c[_0x56a9('0x16')]['message']);}})[_0x56a9('0x17')](function(_0x4853a3){logger['error']('ZohoAccount,\x20%s,\x20%s',_0xd8aa7c,_0x4853a3);_0x3ac626(_0x4853a3);});});}exports[_0x56a9('0x18')]=function(_0x576bdf){var _0x59c0ec=this;return new Promise(function(_0x105fe5,_0x459a87){return db[_0x56a9('0x19')][_0x56a9('0x1a')]({'raw':_0x576bdf[_0x56a9('0x1b')]?_0x576bdf[_0x56a9('0x1b')][_0x56a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x576bdf[_0x56a9('0x1b')]?_0x576bdf[_0x56a9('0x1b')]['where']||null:null,'attributes':_0x576bdf['options']?_0x576bdf[_0x56a9('0x1b')][_0x56a9('0x1d')]||null:null,'limit':_0x576bdf[_0x56a9('0x1b')]?_0x576bdf[_0x56a9('0x1b')]['limit']||null:null,'include':_0x576bdf[_0x56a9('0x1b')]?_0x576bdf[_0x56a9('0x1b')][_0x56a9('0x1e')]?_[_0x56a9('0x1f')](_0x576bdf['options'][_0x56a9('0x1e')],function(_0x32839b){return{'model':db[_0x32839b[_0x56a9('0x20')]],'as':_0x32839b['as'],'attributes':_0x32839b[_0x56a9('0x1d')],'include':_0x32839b[_0x56a9('0x1e')]?_['map'](_0x32839b[_0x56a9('0x1e')],function(_0x217bda){return{'model':db[_0x217bda[_0x56a9('0x20')]],'as':_0x217bda['as'],'attributes':_0x217bda['attributes'],'include':_0x217bda[_0x56a9('0x1e')]?_['map'](_0x217bda[_0x56a9('0x1e')],function(_0x8d41d6){return{'model':db[_0x8d41d6[_0x56a9('0x20')]],'as':_0x8d41d6['as'],'attributes':_0x8d41d6[_0x56a9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56a9('0x21')](function(_0x1afe8a){logger[_0x56a9('0xd')](_0x56a9('0x18'),_0x576bdf);logger['debug'](_0x56a9('0x18'),_0x576bdf,JSON[_0x56a9('0x12')](_0x1afe8a));_0x105fe5(_0x1afe8a);})['catch'](function(_0x4441ce){logger['error']('GetZohoAccount',_0x4441ce[_0x56a9('0x15')],_0x576bdf);_0x459a87(_0x59c0ec['error'](0x1f4,_0x4441ce[_0x56a9('0x15')]));});});};exports[_0x56a9('0x22')]=function(_0x2fbd5d){var _0x2c1c3d=this;return new Promise(function(_0x5879db,_0x332707){return db[_0x56a9('0x19')][_0x56a9('0x23')]({'raw':_0x2fbd5d[_0x56a9('0x1b')]?_0x2fbd5d[_0x56a9('0x1b')][_0x56a9('0x1c')]===undefined?!![]:![]:!![],'where':_0x2fbd5d[_0x56a9('0x1b')]?_0x2fbd5d[_0x56a9('0x1b')][_0x56a9('0x24')]||null:null,'attributes':_0x2fbd5d[_0x56a9('0x1b')]?_0x2fbd5d[_0x56a9('0x1b')][_0x56a9('0x1d')]||null:null,'include':_0x2fbd5d['options']?_0x2fbd5d[_0x56a9('0x1b')][_0x56a9('0x1e')]?_[_0x56a9('0x1f')](_0x2fbd5d['options'][_0x56a9('0x1e')],function(_0x51ce05){return{'model':db[_0x51ce05['model']],'as':_0x51ce05['as'],'attributes':_0x51ce05['attributes'],'include':_0x51ce05[_0x56a9('0x1e')]?_[_0x56a9('0x1f')](_0x51ce05['include'],function(_0x5473cb){return{'model':db[_0x5473cb[_0x56a9('0x20')]],'as':_0x5473cb['as'],'attributes':_0x5473cb[_0x56a9('0x1d')],'include':_0x5473cb[_0x56a9('0x1e')]?_[_0x56a9('0x1f')](_0x5473cb[_0x56a9('0x1e')],function(_0x239601){return{'model':db[_0x239601[_0x56a9('0x20')]],'as':_0x239601['as'],'attributes':_0x239601[_0x56a9('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x56a9('0x21')](function(_0x189f13){logger['info']('ShowZohoAccount',_0x2fbd5d);logger['debug']('ShowZohoAccount',_0x2fbd5d,JSON[_0x56a9('0x12')](_0x189f13));_0x5879db(_0x189f13);})[_0x56a9('0x17')](function(_0x55b295){logger[_0x56a9('0x13')](_0x56a9('0x22'),_0x55b295[_0x56a9('0x15')],_0x2fbd5d);_0x332707(_0x2c1c3d[_0x56a9('0x13')](0x1f4,_0x55b295[_0x56a9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 38a722b..2611ba7 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 _0xb956=['get','/:id','getFields','isAuthenticated','getSubjects','/:id/descriptions','getDescriptions','post','create','put','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intZohoConfiguration.controller'];(function(_0xe7db67,_0x23ff5b){var _0x41dd60=function(_0x487db1){while(--_0x487db1){_0xe7db67['push'](_0xe7db67['shift']());}};_0x41dd60(++_0x23ff5b);}(_0xb956,0x7b));var _0x6b95=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0xb956[_0x465028];return _0xb783d4;};'use strict';var multer=require(_0x6b95('0x0'));var util=require(_0x6b95('0x1'));var path=require('path');var timeout=require(_0x6b95('0x2'));var express=require(_0x6b95('0x3'));var router=express[_0x6b95('0x4')]();var fs_extra=require(_0x6b95('0x5'));var auth=require(_0x6b95('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x6b95('0x7'));var controller=require(_0x6b95('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x6b95('0x9')](_0x6b95('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x6b95('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x6b95('0xb')]);router[_0x6b95('0x9')]('/:id/subjects',auth[_0x6b95('0xc')](),controller[_0x6b95('0xd')]);router[_0x6b95('0x9')](_0x6b95('0xe'),auth[_0x6b95('0xc')](),controller[_0x6b95('0xf')]);router[_0x6b95('0x10')]('/',auth['isAuthenticated'](),controller[_0x6b95('0x11')]);router[_0x6b95('0x12')](_0x6b95('0xa'),auth['isAuthenticated'](),controller['update']);router[_0x6b95('0x13')]('/:id',auth[_0x6b95('0xc')](),controller[_0x6b95('0x14')]);module[_0x6b95('0x15')]=router; \ No newline at end of file +var _0x417a=['update','delete','destroy','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x417a,0x76));var _0xa417=function(_0xce9195,_0x1963e1){_0xce9195=_0xce9195-0x0;var _0x530fe6=_0x417a[_0xce9195];return _0x530fe6;};'use strict';var multer=require(_0xa417('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa417('0x1'));var express=require(_0xa417('0x2'));var router=express[_0xa417('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa417('0x4'));var interaction=require(_0xa417('0x5'));var config=require(_0xa417('0x6'));var controller=require('./intZohoConfiguration.controller');router[_0xa417('0x7')]('/',auth[_0xa417('0x8')](),controller[_0xa417('0x9')]);router[_0xa417('0x7')](_0xa417('0xa'),auth[_0xa417('0x8')](),controller[_0xa417('0xb')]);router[_0xa417('0x7')](_0xa417('0xc'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0xa417('0xd'),auth[_0xa417('0x8')](),controller[_0xa417('0xe')]);router[_0xa417('0x7')](_0xa417('0xf'),auth[_0xa417('0x8')](),controller[_0xa417('0x10')]);router[_0xa417('0x11')]('/',auth['isAuthenticated'](),controller[_0xa417('0x12')]);router[_0xa417('0x13')]('/:id',auth[_0xa417('0x8')](),controller[_0xa417('0x14')]);router[_0xa417('0x15')](_0xa417('0xa'),auth['isAuthenticated'](),controller[_0xa417('0x16')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index 5e19ba6..6c65943 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 _0x0bde=['STRING','ENUM','contact','nothing','lead','contact_lead','sequelize'];(function(_0x3f8743,_0x33973f){var _0x1f844c=function(_0x568841){while(--_0x568841){_0x3f8743['push'](_0x3f8743['shift']());}};_0x1f844c(++_0x33973f);}(_0x0bde,0x110));var _0xe0bd=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0bde[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require(_0xe0bd('0x0'));module['exports']={'name':{'type':Sequelize[_0xe0bd('0x1')]},'moduleCreate':{'type':Sequelize[_0xe0bd('0x2')]('lead',_0xe0bd('0x3'),_0xe0bd('0x4')),'defaultValue':_0xe0bd('0x5')},'moduleSearch':{'type':Sequelize['ENUM'](_0xe0bd('0x6'),_0xe0bd('0x3'),_0xe0bd('0x5')),'defaultValue':_0xe0bd('0x6')},'description':{'type':Sequelize[_0xe0bd('0x1')]}}; \ No newline at end of file +var _0x1239=['exports','STRING','ENUM','nothing','lead','contact_lead','sequelize'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x1239,0x19c));var _0x9123=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x1239[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require(_0x9123('0x0'));module[_0x9123('0x1')]={'name':{'type':Sequelize[_0x9123('0x2')]},'moduleCreate':{'type':Sequelize[_0x9123('0x3')]('lead','contact',_0x9123('0x4')),'defaultValue':_0x9123('0x5')},'moduleSearch':{'type':Sequelize[_0x9123('0x3')](_0x9123('0x6'),'contact',_0x9123('0x5')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0x9123('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 36f4233..f5054e2 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 _0xbb1b=['getFields','getSubjects','hasOwnProperty','findOne','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','json','apply','save','then','destroy','error','stack','name','send','index','ZohoConfiguration','rawAttributes','fieldName','type','model','map','query','keys','intersection','attributes','fields','nolimit','offset','order','sort','where','filters','merge','VIRTUAL','filter','options','include','catch','show','params','length','includeAll','find','create','update','body','ZohoField','pick'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xbb1b,0x13d));var _0xbbb1=function(_0x30bdd5,_0xe631d7){_0x30bdd5=_0x30bdd5-0x0;var _0x405c7c=_0xbb1b[_0x30bdd5];return _0x405c7c;};'use strict';var emlformat=require(_0xbbb1('0x0'));var rimraf=require(_0xbbb1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbbb1('0x2'));var rp=require(_0xbbb1('0x3'));var moment=require(_0xbbb1('0x4'));var BPromise=require(_0xbbb1('0x5'));var Mustache=require(_0xbbb1('0x6'));var util=require(_0xbbb1('0x7'));var path=require('path');var sox=require(_0xbbb1('0x8'));var csv=require('to-csv');var ejs=require(_0xbbb1('0x9'));var fs=require('fs');var fs_extra=require(_0xbbb1('0xa'));var _=require('lodash');var squel=require(_0xbbb1('0xb'));var crypto=require(_0xbbb1('0xc'));var jsforce=require(_0xbbb1('0xd'));var deskjs=require(_0xbbb1('0xe'));var toCsv=require(_0xbbb1('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xbbb1('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xbbb1('0x11'));var as=require(_0xbbb1('0x12'));var hardwareService=require(_0xbbb1('0x13'));var logger=require(_0xbbb1('0x14'))('api');var utils=require(_0xbbb1('0x15'));var config=require(_0xbbb1('0x16'));var licenseUtil=require(_0xbbb1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x30a4f5,_0x4ef70e){_0x4ef70e=_0x4ef70e||0xcc;return function(_0xf1d829){if(_0xf1d829){return _0x30a4f5[_0xbbb1('0x18')](_0x4ef70e);}return _0x30a4f5[_0xbbb1('0x19')](_0x4ef70e)[_0xbbb1('0x1a')]();};}function respondWithResult(_0x53d12d,_0x566b42){_0x566b42=_0x566b42||0xc8;return function(_0x5ede76){if(_0x5ede76){return _0x53d12d[_0xbbb1('0x19')](_0x566b42)['json'](_0x5ede76);}};}function respondWithFilteredResult(_0x5da42b,_0x4ff199){return function(_0x55b848){if(_0x55b848){var _0x2d3986=typeof _0x4ff199['offset']===_0xbbb1('0x1b')&&typeof _0x4ff199[_0xbbb1('0x1c')]===_0xbbb1('0x1b');var _0x351cc3=_0x55b848[_0xbbb1('0x1d')];var _0x180fb9=_0x2d3986?0x0:_0x4ff199['offset'];var _0x28ca5a=_0x2d3986?_0x55b848[_0xbbb1('0x1d')]:_0x4ff199['offset']+_0x4ff199[_0xbbb1('0x1c')];var _0x20eb1a;if(_0x28ca5a>=_0x351cc3){_0x28ca5a=_0x351cc3;_0x20eb1a=0xc8;}else{_0x20eb1a=0xce;}_0x5da42b[_0xbbb1('0x19')](_0x20eb1a);return _0x5da42b['set']('Content-Range',_0x180fb9+'-'+_0x28ca5a+'/'+_0x351cc3)[_0xbbb1('0x1e')](_0x55b848);}return null;};}function patchUpdates(_0x2337f8){return function(_0x3a9967){try{jsonpatch[_0xbbb1('0x1f')](_0x3a9967,_0x2337f8,!![]);}catch(_0x6303d5){return BPromise['reject'](_0x6303d5);}return _0x3a9967[_0xbbb1('0x20')]();};}function saveUpdates(_0x15cce3,_0x2cdf0d){return function(_0x233ca5){if(_0x233ca5){return _0x233ca5['update'](_0x15cce3)[_0xbbb1('0x21')](function(_0x39049b){return _0x39049b;});}return null;};}function removeEntity(_0x3f64be,_0xa3b016){return function(_0x5b835e){if(_0x5b835e){return _0x5b835e[_0xbbb1('0x22')]()['then'](function(){_0x3f64be[_0xbbb1('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6b8799,_0x20c4ee){return function(_0x50a0ac){if(!_0x50a0ac){_0x6b8799[_0xbbb1('0x18')](0x194);}return _0x50a0ac;};}function handleError(_0x585c71,_0x7f96b1){_0x7f96b1=_0x7f96b1||0x1f4;return function(_0x36d6d9){logger[_0xbbb1('0x23')](_0x36d6d9[_0xbbb1('0x24')]);if(_0x36d6d9[_0xbbb1('0x25')]){delete _0x36d6d9[_0xbbb1('0x25')];}_0x585c71['status'](_0x7f96b1)[_0xbbb1('0x26')](_0x36d6d9);};}exports[_0xbbb1('0x27')]=function(_0xbb6a7e,_0xb2e1d7){var _0x1c7fe1={},_0x2dcc30={},_0x412fe6={'count':0x0,'rows':[]};var _0xd559fe=_['map'](db[_0xbbb1('0x28')][_0xbbb1('0x29')],function(_0x54d056){return{'name':_0x54d056[_0xbbb1('0x2a')],'type':_0x54d056[_0xbbb1('0x2b')]['key']};});_0x2dcc30[_0xbbb1('0x2c')]=_[_0xbbb1('0x2d')](_0xd559fe,_0xbbb1('0x25'));_0x2dcc30[_0xbbb1('0x2e')]=_[_0xbbb1('0x2f')](_0xbb6a7e[_0xbbb1('0x2e')]);_0x2dcc30['filters']=_[_0xbbb1('0x30')](_0x2dcc30['model'],_0x2dcc30['query']);_0x1c7fe1[_0xbbb1('0x31')]=_[_0xbbb1('0x30')](_0x2dcc30[_0xbbb1('0x2c')],qs[_0xbbb1('0x32')](_0xbb6a7e['query'][_0xbbb1('0x32')]));_0x1c7fe1[_0xbbb1('0x31')]=_0x1c7fe1[_0xbbb1('0x31')]['length']?_0x1c7fe1[_0xbbb1('0x31')]:_0x2dcc30[_0xbbb1('0x2c')];if(!_0xbb6a7e['query']['hasOwnProperty'](_0xbbb1('0x33'))){_0x1c7fe1[_0xbbb1('0x1c')]=qs[_0xbbb1('0x1c')](_0xbb6a7e[_0xbbb1('0x2e')][_0xbbb1('0x1c')]);_0x1c7fe1[_0xbbb1('0x34')]=qs[_0xbbb1('0x34')](_0xbb6a7e[_0xbbb1('0x2e')]['offset']);}_0x1c7fe1[_0xbbb1('0x35')]=qs[_0xbbb1('0x36')](_0xbb6a7e[_0xbbb1('0x2e')][_0xbbb1('0x36')]);_0x1c7fe1[_0xbbb1('0x37')]=qs[_0xbbb1('0x38')](_['pick'](_0xbb6a7e[_0xbbb1('0x2e')],_0x2dcc30[_0xbbb1('0x38')]),_0xd559fe);if(_0xbb6a7e[_0xbbb1('0x2e')]['filter']){_0x1c7fe1[_0xbbb1('0x37')]=_[_0xbbb1('0x39')](_0x1c7fe1[_0xbbb1('0x37')],{'$or':_[_0xbbb1('0x2d')](_0xd559fe,function(_0x251609){if(_0x251609[_0xbbb1('0x2b')]!==_0xbbb1('0x3a')){var _0xe7a56c={};_0xe7a56c[_0x251609['name']]={'$like':'%'+_0xbb6a7e[_0xbbb1('0x2e')][_0xbbb1('0x3b')]+'%'};return _0xe7a56c;}})});}_0x1c7fe1=_[_0xbbb1('0x39')]({},_0x1c7fe1,_0xbb6a7e[_0xbbb1('0x3c')]);var _0x47df48={'where':_0x1c7fe1[_0xbbb1('0x37')]};return db[_0xbbb1('0x28')]['count'](_0x47df48)[_0xbbb1('0x21')](function(_0x3369e8){_0x412fe6[_0xbbb1('0x1d')]=_0x3369e8;if(_0xbb6a7e['query']['includeAll']){_0x1c7fe1[_0xbbb1('0x3d')]=[{'all':!![]}];}return db[_0xbbb1('0x28')]['findAll'](_0x1c7fe1);})['then'](function(_0x523472){_0x412fe6['rows']=_0x523472;return _0x412fe6;})[_0xbbb1('0x21')](respondWithFilteredResult(_0xb2e1d7,_0x1c7fe1))[_0xbbb1('0x3e')](handleError(_0xb2e1d7,null));};exports[_0xbbb1('0x3f')]=function(_0x531f74,_0x15a9a6){var _0x3f62b9={'raw':![],'where':{'id':_0x531f74[_0xbbb1('0x40')]['id']}},_0xe3bd9d={};_0xe3bd9d[_0xbbb1('0x2c')]=_['keys'](db[_0xbbb1('0x28')][_0xbbb1('0x29')]);_0xe3bd9d[_0xbbb1('0x2e')]=_['keys'](_0x531f74[_0xbbb1('0x2e')]);_0xe3bd9d[_0xbbb1('0x38')]=_['intersection'](_0xe3bd9d['model'],_0xe3bd9d[_0xbbb1('0x2e')]);_0x3f62b9[_0xbbb1('0x31')]=_[_0xbbb1('0x30')](_0xe3bd9d[_0xbbb1('0x2c')],qs[_0xbbb1('0x32')](_0x531f74[_0xbbb1('0x2e')][_0xbbb1('0x32')]));_0x3f62b9[_0xbbb1('0x31')]=_0x3f62b9['attributes'][_0xbbb1('0x41')]?_0x3f62b9[_0xbbb1('0x31')]:_0xe3bd9d['model'];if(_0x531f74[_0xbbb1('0x2e')][_0xbbb1('0x42')]){_0x3f62b9[_0xbbb1('0x3d')]=[{'all':!![]}];}_0x3f62b9=_['merge']({},_0x3f62b9,_0x531f74[_0xbbb1('0x3c')]);return db[_0xbbb1('0x28')][_0xbbb1('0x43')](_0x3f62b9)['then'](handleEntityNotFound(_0x15a9a6,null))[_0xbbb1('0x21')](respondWithResult(_0x15a9a6,null))[_0xbbb1('0x3e')](handleError(_0x15a9a6,null));};exports[_0xbbb1('0x44')]=function(_0x4fa359,_0x5871d2){return db[_0xbbb1('0x28')]['create'](_0x4fa359['body'],{})[_0xbbb1('0x21')](respondWithResult(_0x5871d2,0xc9))[_0xbbb1('0x3e')](handleError(_0x5871d2,null));};exports[_0xbbb1('0x45')]=function(_0x4ae25,_0xf0260f){if(_0x4ae25[_0xbbb1('0x46')]['id']){delete _0x4ae25[_0xbbb1('0x46')]['id'];}return db[_0xbbb1('0x28')]['find']({'where':{'id':_0x4ae25['params']['id']}})['then'](handleEntityNotFound(_0xf0260f,null))[_0xbbb1('0x21')](saveUpdates(_0x4ae25[_0xbbb1('0x46')],null))[_0xbbb1('0x21')](respondWithResult(_0xf0260f,null))[_0xbbb1('0x3e')](handleError(_0xf0260f,null));};exports[_0xbbb1('0x22')]=function(_0x724722,_0x4993db){return db[_0xbbb1('0x28')][_0xbbb1('0x43')]({'where':{'id':_0x724722[_0xbbb1('0x40')]['id']}})[_0xbbb1('0x21')](handleEntityNotFound(_0x4993db,null))['then'](removeEntity(_0x4993db,null))['catch'](handleError(_0x4993db,null));};exports['getFields']=function(_0x53d0f7,_0x4499a2,_0x27407a){var _0x8bd529={};var _0x306a1b={};var _0x3fecc0;var _0x51b466;return db[_0xbbb1('0x28')]['findOne']({'where':{'id':_0x53d0f7['params']['id']}})[_0xbbb1('0x21')](handleEntityNotFound(_0x4499a2,null))['then'](function(_0x38b37b){if(_0x38b37b){_0x3fecc0=_0x38b37b;_0x306a1b[_0xbbb1('0x2c')]=_[_0xbbb1('0x2f')](db[_0xbbb1('0x47')]['rawAttributes']);_0x306a1b[_0xbbb1('0x2e')]=_['keys'](_0x53d0f7['query']);_0x306a1b[_0xbbb1('0x38')]=_[_0xbbb1('0x30')](_0x306a1b[_0xbbb1('0x2c')],_0x306a1b[_0xbbb1('0x2e')]);_0x8bd529[_0xbbb1('0x31')]=_['intersection'](_0x306a1b[_0xbbb1('0x2c')],qs['fields'](_0x53d0f7['query'][_0xbbb1('0x32')]));_0x8bd529[_0xbbb1('0x31')]=_0x8bd529[_0xbbb1('0x31')][_0xbbb1('0x41')]?_0x8bd529[_0xbbb1('0x31')]:_0x306a1b[_0xbbb1('0x2c')];_0x8bd529[_0xbbb1('0x35')]=qs[_0xbbb1('0x36')](_0x53d0f7[_0xbbb1('0x2e')][_0xbbb1('0x36')]);_0x8bd529[_0xbbb1('0x37')]=qs[_0xbbb1('0x38')](_[_0xbbb1('0x48')](_0x53d0f7[_0xbbb1('0x2e')],_0x306a1b['filters']));if(_0x53d0f7['query'][_0xbbb1('0x3b')]){_0x8bd529[_0xbbb1('0x37')]=_[_0xbbb1('0x39')](_0x8bd529[_0xbbb1('0x37')],{'$or':_[_0xbbb1('0x2d')](_0x8bd529[_0xbbb1('0x31')],function(_0x357d29){var _0x4065f4={};_0x4065f4[_0x357d29]={'$like':'%'+_0x53d0f7[_0xbbb1('0x2e')][_0xbbb1('0x3b')]+'%'};return _0x4065f4;})});}_0x8bd529=_[_0xbbb1('0x39')]({},_0x8bd529,_0x53d0f7[_0xbbb1('0x3c')]);return _0x3fecc0[_0xbbb1('0x49')](_0x8bd529);}})[_0xbbb1('0x21')](function(_0x4622e2){if(_0x4622e2){_0x51b466=_0x4622e2[_0xbbb1('0x41')];if(!_0x53d0f7[_0xbbb1('0x2e')]['hasOwnProperty'](_0xbbb1('0x33'))){_0x8bd529[_0xbbb1('0x1c')]=qs['limit'](_0x53d0f7[_0xbbb1('0x2e')][_0xbbb1('0x1c')]);_0x8bd529[_0xbbb1('0x34')]=qs[_0xbbb1('0x34')](_0x53d0f7[_0xbbb1('0x2e')]['offset']);}return _0x3fecc0[_0xbbb1('0x49')](_0x8bd529);}})[_0xbbb1('0x21')](function(_0x5aa4dc){if(_0x5aa4dc){return _0x5aa4dc?{'count':_0x51b466,'rows':_0x5aa4dc}:null;}})[_0xbbb1('0x21')](respondWithResult(_0x4499a2,null))[_0xbbb1('0x3e')](handleError(_0x4499a2,null));};exports[_0xbbb1('0x4a')]=function(_0x71b042,_0x5da317,_0x420e72){var _0x3c4280={};var _0x1206f3={};var _0x443a38;var _0x28cab7;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x71b042['params']['id']}})[_0xbbb1('0x21')](handleEntityNotFound(_0x5da317,null))['then'](function(_0x2e201a){if(_0x2e201a){_0x443a38=_0x2e201a;_0x1206f3[_0xbbb1('0x2c')]=_['keys'](db[_0xbbb1('0x47')][_0xbbb1('0x29')]);_0x1206f3[_0xbbb1('0x2e')]=_['keys'](_0x71b042['query']);_0x1206f3[_0xbbb1('0x38')]=_[_0xbbb1('0x30')](_0x1206f3[_0xbbb1('0x2c')],_0x1206f3[_0xbbb1('0x2e')]);_0x3c4280[_0xbbb1('0x31')]=_[_0xbbb1('0x30')](_0x1206f3[_0xbbb1('0x2c')],qs['fields'](_0x71b042['query'][_0xbbb1('0x32')]));_0x3c4280[_0xbbb1('0x31')]=_0x3c4280[_0xbbb1('0x31')]['length']?_0x3c4280['attributes']:_0x1206f3[_0xbbb1('0x2c')];_0x3c4280[_0xbbb1('0x35')]=qs['sort'](_0x71b042[_0xbbb1('0x2e')][_0xbbb1('0x36')]);_0x3c4280[_0xbbb1('0x37')]=qs[_0xbbb1('0x38')](_[_0xbbb1('0x48')](_0x71b042[_0xbbb1('0x2e')],_0x1206f3[_0xbbb1('0x38')]));if(_0x71b042[_0xbbb1('0x2e')]['filter']){_0x3c4280['where']=_[_0xbbb1('0x39')](_0x3c4280[_0xbbb1('0x37')],{'$or':_[_0xbbb1('0x2d')](_0x3c4280[_0xbbb1('0x31')],function(_0x195da7){var _0x3ec021={};_0x3ec021[_0x195da7]={'$like':'%'+_0x71b042[_0xbbb1('0x2e')]['filter']+'%'};return _0x3ec021;})});}_0x3c4280=_[_0xbbb1('0x39')]({},_0x3c4280,_0x71b042[_0xbbb1('0x3c')]);return _0x443a38[_0xbbb1('0x4a')](_0x3c4280);}})[_0xbbb1('0x21')](function(_0xed10d3){if(_0xed10d3){_0x28cab7=_0xed10d3[_0xbbb1('0x41')];if(!_0x71b042['query'][_0xbbb1('0x4b')](_0xbbb1('0x33'))){_0x3c4280['limit']=qs['limit'](_0x71b042[_0xbbb1('0x2e')][_0xbbb1('0x1c')]);_0x3c4280[_0xbbb1('0x34')]=qs[_0xbbb1('0x34')](_0x71b042[_0xbbb1('0x2e')][_0xbbb1('0x34')]);}return _0x443a38[_0xbbb1('0x4a')](_0x3c4280);}})[_0xbbb1('0x21')](function(_0x510f48){if(_0x510f48){return _0x510f48?{'count':_0x28cab7,'rows':_0x510f48}:null;}})['then'](respondWithResult(_0x5da317,null))[_0xbbb1('0x3e')](handleError(_0x5da317,null));};exports['getDescriptions']=function(_0x3a87c9,_0x150cc3,_0x4dd90f){var _0x5040d4={};var _0x58ddb7={};var _0x8be26d;var _0x38ab1d;return db[_0xbbb1('0x28')][_0xbbb1('0x4c')]({'where':{'id':_0x3a87c9[_0xbbb1('0x40')]['id']}})[_0xbbb1('0x21')](handleEntityNotFound(_0x150cc3,null))['then'](function(_0x30dd1c){if(_0x30dd1c){_0x8be26d=_0x30dd1c;_0x58ddb7[_0xbbb1('0x2c')]=_['keys'](db['ZohoField'][_0xbbb1('0x29')]);_0x58ddb7['query']=_[_0xbbb1('0x2f')](_0x3a87c9[_0xbbb1('0x2e')]);_0x58ddb7[_0xbbb1('0x38')]=_[_0xbbb1('0x30')](_0x58ddb7[_0xbbb1('0x2c')],_0x58ddb7[_0xbbb1('0x2e')]);_0x5040d4['attributes']=_[_0xbbb1('0x30')](_0x58ddb7[_0xbbb1('0x2c')],qs[_0xbbb1('0x32')](_0x3a87c9['query']['fields']));_0x5040d4['attributes']=_0x5040d4[_0xbbb1('0x31')][_0xbbb1('0x41')]?_0x5040d4[_0xbbb1('0x31')]:_0x58ddb7[_0xbbb1('0x2c')];_0x5040d4[_0xbbb1('0x35')]=qs[_0xbbb1('0x36')](_0x3a87c9[_0xbbb1('0x2e')][_0xbbb1('0x36')]);_0x5040d4[_0xbbb1('0x37')]=qs['filters'](_[_0xbbb1('0x48')](_0x3a87c9[_0xbbb1('0x2e')],_0x58ddb7['filters']));if(_0x3a87c9['query'][_0xbbb1('0x3b')]){_0x5040d4['where']=_[_0xbbb1('0x39')](_0x5040d4[_0xbbb1('0x37')],{'$or':_['map'](_0x5040d4['attributes'],function(_0x369b17){var _0x4c320e={};_0x4c320e[_0x369b17]={'$like':'%'+_0x3a87c9[_0xbbb1('0x2e')][_0xbbb1('0x3b')]+'%'};return _0x4c320e;})});}_0x5040d4=_[_0xbbb1('0x39')]({},_0x5040d4,_0x3a87c9[_0xbbb1('0x3c')]);return _0x8be26d[_0xbbb1('0x4d')](_0x5040d4);}})[_0xbbb1('0x21')](function(_0x119fc2){if(_0x119fc2){_0x38ab1d=_0x119fc2[_0xbbb1('0x41')];if(!_0x3a87c9[_0xbbb1('0x2e')][_0xbbb1('0x4b')](_0xbbb1('0x33'))){_0x5040d4[_0xbbb1('0x1c')]=qs[_0xbbb1('0x1c')](_0x3a87c9['query'][_0xbbb1('0x1c')]);_0x5040d4['offset']=qs['offset'](_0x3a87c9[_0xbbb1('0x2e')][_0xbbb1('0x34')]);}return _0x8be26d[_0xbbb1('0x4d')](_0x5040d4);}})[_0xbbb1('0x21')](function(_0x3b8587){if(_0x3b8587){return _0x3b8587?{'count':_0x38ab1d,'rows':_0x3b8587}:null;}})[_0xbbb1('0x21')](respondWithResult(_0x150cc3,null))[_0xbbb1('0x3e')](handleError(_0x150cc3,null));}; \ No newline at end of file +var _0xfa50=['path','sox','lodash','squel','crypto','desk.js','to-csv','querystring','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','undefined','count','offset','Content-Range','reject','save','then','destroy','end','error','stack','ZohoConfiguration','rawAttributes','fieldName','type','query','keys','filters','intersection','attributes','model','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','name','filter','options','includeAll','rows','catch','show','params','create','body','update','find','getFields','ZohoField','map','getSubjects','getDescriptions','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfa50,0x1c0));var _0x0fa5=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xfa50[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x0fa5('0x0'));var rimraf=require(_0x0fa5('0x1'));var zipdir=require(_0x0fa5('0x2'));var jsonpatch=require(_0x0fa5('0x3'));var rp=require(_0x0fa5('0x4'));var moment=require(_0x0fa5('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x0fa5('0x6'));var util=require(_0x0fa5('0x7'));var path=require(_0x0fa5('0x8'));var sox=require(_0x0fa5('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0fa5('0xa'));var squel=require(_0x0fa5('0xb'));var crypto=require(_0x0fa5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x0fa5('0xd'));var toCsv=require(_0x0fa5('0xe'));var querystring=require(_0x0fa5('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x0fa5('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0fa5('0x11'));var logger=require(_0x0fa5('0x12'))(_0x0fa5('0x13'));var utils=require(_0x0fa5('0x14'));var config=require(_0x0fa5('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x0fa5('0x16'))['db'];function respondWithStatusCode(_0x250eea,_0x25a978){_0x25a978=_0x25a978||0xcc;return function(_0x26026c){if(_0x26026c){return _0x250eea[_0x0fa5('0x17')](_0x25a978);}return _0x250eea[_0x0fa5('0x18')](_0x25a978)['end']();};}function respondWithResult(_0x24e975,_0x159d47){_0x159d47=_0x159d47||0xc8;return function(_0x15c7b3){if(_0x15c7b3){return _0x24e975[_0x0fa5('0x18')](_0x159d47)[_0x0fa5('0x19')](_0x15c7b3);}};}function respondWithFilteredResult(_0x4f7f4c,_0x270f9a){return function(_0x5902b1){if(_0x5902b1){var _0x5a3a77=typeof _0x270f9a['offset']==='undefined'&&typeof _0x270f9a['limit']===_0x0fa5('0x1a');var _0x2a1b35=_0x5902b1[_0x0fa5('0x1b')];var _0x27971d=_0x5a3a77?0x0:_0x270f9a[_0x0fa5('0x1c')];var _0x54eeae=_0x5a3a77?_0x5902b1[_0x0fa5('0x1b')]:_0x270f9a[_0x0fa5('0x1c')]+_0x270f9a['limit'];var _0x2dbb66;if(_0x54eeae>=_0x2a1b35){_0x54eeae=_0x2a1b35;_0x2dbb66=0xc8;}else{_0x2dbb66=0xce;}_0x4f7f4c['status'](_0x2dbb66);return _0x4f7f4c['set'](_0x0fa5('0x1d'),_0x27971d+'-'+_0x54eeae+'/'+_0x2a1b35)['json'](_0x5902b1);}return null;};}function patchUpdates(_0x4e03bd){return function(_0x4911fa){try{jsonpatch['apply'](_0x4911fa,_0x4e03bd,!![]);}catch(_0xe909b9){return BPromise[_0x0fa5('0x1e')](_0xe909b9);}return _0x4911fa[_0x0fa5('0x1f')]();};}function saveUpdates(_0x21851b,_0x3f0227){return function(_0x181e6d){if(_0x181e6d){return _0x181e6d['update'](_0x21851b)[_0x0fa5('0x20')](function(_0x472ab2){return _0x472ab2;});}return null;};}function removeEntity(_0x1d015c,_0x2907cc){return function(_0x35d645){if(_0x35d645){return _0x35d645[_0x0fa5('0x21')]()['then'](function(){_0x1d015c['status'](0xcc)[_0x0fa5('0x22')]();});}};}function handleEntityNotFound(_0x1a19e1,_0x2e7f89){return function(_0x4937dd){if(!_0x4937dd){_0x1a19e1[_0x0fa5('0x17')](0x194);}return _0x4937dd;};}function handleError(_0x51505a,_0x1e44bb){_0x1e44bb=_0x1e44bb||0x1f4;return function(_0xc74595){logger[_0x0fa5('0x23')](_0xc74595[_0x0fa5('0x24')]);if(_0xc74595['name']){delete _0xc74595['name'];}_0x51505a[_0x0fa5('0x18')](_0x1e44bb)['send'](_0xc74595);};}exports['index']=function(_0xf13125,_0x272045){var _0x2fa4d3={},_0x47b0b4={},_0x2a9036={'count':0x0,'rows':[]};var _0x173bf3=_['map'](db[_0x0fa5('0x25')][_0x0fa5('0x26')],function(_0xf5bac){return{'name':_0xf5bac[_0x0fa5('0x27')],'type':_0xf5bac[_0x0fa5('0x28')]['key']};});_0x47b0b4['model']=_['map'](_0x173bf3,'name');_0x47b0b4[_0x0fa5('0x29')]=_[_0x0fa5('0x2a')](_0xf13125['query']);_0x47b0b4[_0x0fa5('0x2b')]=_[_0x0fa5('0x2c')](_0x47b0b4['model'],_0x47b0b4['query']);_0x2fa4d3[_0x0fa5('0x2d')]=_['intersection'](_0x47b0b4[_0x0fa5('0x2e')],qs[_0x0fa5('0x2f')](_0xf13125['query'][_0x0fa5('0x2f')]));_0x2fa4d3['attributes']=_0x2fa4d3['attributes'][_0x0fa5('0x30')]?_0x2fa4d3[_0x0fa5('0x2d')]:_0x47b0b4[_0x0fa5('0x2e')];if(!_0xf13125['query'][_0x0fa5('0x31')](_0x0fa5('0x32'))){_0x2fa4d3[_0x0fa5('0x33')]=qs[_0x0fa5('0x33')](_0xf13125['query'][_0x0fa5('0x33')]);_0x2fa4d3['offset']=qs[_0x0fa5('0x1c')](_0xf13125[_0x0fa5('0x29')][_0x0fa5('0x1c')]);}_0x2fa4d3[_0x0fa5('0x34')]=qs[_0x0fa5('0x35')](_0xf13125['query'][_0x0fa5('0x35')]);_0x2fa4d3[_0x0fa5('0x36')]=qs[_0x0fa5('0x2b')](_[_0x0fa5('0x37')](_0xf13125['query'],_0x47b0b4[_0x0fa5('0x2b')]),_0x173bf3);if(_0xf13125['query']['filter']){_0x2fa4d3[_0x0fa5('0x36')]=_[_0x0fa5('0x38')](_0x2fa4d3['where'],{'$or':_['map'](_0x173bf3,function(_0x10a4ca){if(_0x10a4ca['type']!==_0x0fa5('0x39')){var _0x3859bc={};_0x3859bc[_0x10a4ca[_0x0fa5('0x3a')]]={'$like':'%'+_0xf13125[_0x0fa5('0x29')][_0x0fa5('0x3b')]+'%'};return _0x3859bc;}})});}_0x2fa4d3=_['merge']({},_0x2fa4d3,_0xf13125[_0x0fa5('0x3c')]);var _0x28cece={'where':_0x2fa4d3[_0x0fa5('0x36')]};return db[_0x0fa5('0x25')]['count'](_0x28cece)['then'](function(_0x9d2e4b){_0x2a9036[_0x0fa5('0x1b')]=_0x9d2e4b;if(_0xf13125[_0x0fa5('0x29')][_0x0fa5('0x3d')]){_0x2fa4d3['include']=[{'all':!![]}];}return db[_0x0fa5('0x25')]['findAll'](_0x2fa4d3);})[_0x0fa5('0x20')](function(_0xb7a30e){_0x2a9036[_0x0fa5('0x3e')]=_0xb7a30e;return _0x2a9036;})[_0x0fa5('0x20')](respondWithFilteredResult(_0x272045,_0x2fa4d3))[_0x0fa5('0x3f')](handleError(_0x272045,null));};exports[_0x0fa5('0x40')]=function(_0x31ec02,_0x2925f2){var _0x40d90d={'raw':![],'where':{'id':_0x31ec02[_0x0fa5('0x41')]['id']}},_0x3e05a0={};_0x3e05a0['model']=_[_0x0fa5('0x2a')](db[_0x0fa5('0x25')][_0x0fa5('0x26')]);_0x3e05a0['query']=_[_0x0fa5('0x2a')](_0x31ec02['query']);_0x3e05a0['filters']=_[_0x0fa5('0x2c')](_0x3e05a0[_0x0fa5('0x2e')],_0x3e05a0[_0x0fa5('0x29')]);_0x40d90d[_0x0fa5('0x2d')]=_['intersection'](_0x3e05a0['model'],qs[_0x0fa5('0x2f')](_0x31ec02[_0x0fa5('0x29')]['fields']));_0x40d90d['attributes']=_0x40d90d['attributes'][_0x0fa5('0x30')]?_0x40d90d[_0x0fa5('0x2d')]:_0x3e05a0[_0x0fa5('0x2e')];if(_0x31ec02['query'][_0x0fa5('0x3d')]){_0x40d90d['include']=[{'all':!![]}];}_0x40d90d=_['merge']({},_0x40d90d,_0x31ec02[_0x0fa5('0x3c')]);return db[_0x0fa5('0x25')]['find'](_0x40d90d)['then'](handleEntityNotFound(_0x2925f2,null))[_0x0fa5('0x20')](respondWithResult(_0x2925f2,null))['catch'](handleError(_0x2925f2,null));};exports[_0x0fa5('0x42')]=function(_0x3d7eee,_0x5b64cf){return db[_0x0fa5('0x25')]['create'](_0x3d7eee[_0x0fa5('0x43')],{})[_0x0fa5('0x20')](respondWithResult(_0x5b64cf,0xc9))[_0x0fa5('0x3f')](handleError(_0x5b64cf,null));};exports[_0x0fa5('0x44')]=function(_0x212f37,_0x44aa82){if(_0x212f37[_0x0fa5('0x43')]['id']){delete _0x212f37[_0x0fa5('0x43')]['id'];}return db[_0x0fa5('0x25')]['find']({'where':{'id':_0x212f37[_0x0fa5('0x41')]['id']}})[_0x0fa5('0x20')](handleEntityNotFound(_0x44aa82,null))[_0x0fa5('0x20')](saveUpdates(_0x212f37[_0x0fa5('0x43')],null))[_0x0fa5('0x20')](respondWithResult(_0x44aa82,null))[_0x0fa5('0x3f')](handleError(_0x44aa82,null));};exports[_0x0fa5('0x21')]=function(_0x1f406c,_0x4d2e25){return db[_0x0fa5('0x25')][_0x0fa5('0x45')]({'where':{'id':_0x1f406c[_0x0fa5('0x41')]['id']}})[_0x0fa5('0x20')](handleEntityNotFound(_0x4d2e25,null))[_0x0fa5('0x20')](removeEntity(_0x4d2e25,null))[_0x0fa5('0x3f')](handleError(_0x4d2e25,null));};exports[_0x0fa5('0x46')]=function(_0x270a7a,_0x31c6df,_0x392cce){var _0x536c37={};var _0x357838={};var _0x4b2e1b;var _0x10d714;return db[_0x0fa5('0x25')]['findOne']({'where':{'id':_0x270a7a[_0x0fa5('0x41')]['id']}})['then'](handleEntityNotFound(_0x31c6df,null))[_0x0fa5('0x20')](function(_0x433273){if(_0x433273){_0x4b2e1b=_0x433273;_0x357838[_0x0fa5('0x2e')]=_[_0x0fa5('0x2a')](db[_0x0fa5('0x47')][_0x0fa5('0x26')]);_0x357838[_0x0fa5('0x29')]=_['keys'](_0x270a7a[_0x0fa5('0x29')]);_0x357838[_0x0fa5('0x2b')]=_['intersection'](_0x357838[_0x0fa5('0x2e')],_0x357838[_0x0fa5('0x29')]);_0x536c37['attributes']=_[_0x0fa5('0x2c')](_0x357838[_0x0fa5('0x2e')],qs['fields'](_0x270a7a[_0x0fa5('0x29')][_0x0fa5('0x2f')]));_0x536c37[_0x0fa5('0x2d')]=_0x536c37[_0x0fa5('0x2d')][_0x0fa5('0x30')]?_0x536c37[_0x0fa5('0x2d')]:_0x357838[_0x0fa5('0x2e')];_0x536c37[_0x0fa5('0x34')]=qs['sort'](_0x270a7a[_0x0fa5('0x29')][_0x0fa5('0x35')]);_0x536c37[_0x0fa5('0x36')]=qs[_0x0fa5('0x2b')](_[_0x0fa5('0x37')](_0x270a7a[_0x0fa5('0x29')],_0x357838[_0x0fa5('0x2b')]));if(_0x270a7a[_0x0fa5('0x29')]['filter']){_0x536c37['where']=_[_0x0fa5('0x38')](_0x536c37['where'],{'$or':_['map'](_0x536c37[_0x0fa5('0x2d')],function(_0x3bd5df){var _0x3c0ed4={};_0x3c0ed4[_0x3bd5df]={'$like':'%'+_0x270a7a[_0x0fa5('0x29')][_0x0fa5('0x3b')]+'%'};return _0x3c0ed4;})});}_0x536c37=_['merge']({},_0x536c37,_0x270a7a[_0x0fa5('0x3c')]);return _0x4b2e1b[_0x0fa5('0x46')](_0x536c37);}})[_0x0fa5('0x20')](function(_0x1ec5d0){if(_0x1ec5d0){_0x10d714=_0x1ec5d0[_0x0fa5('0x30')];if(!_0x270a7a['query'][_0x0fa5('0x31')]('nolimit')){_0x536c37['limit']=qs[_0x0fa5('0x33')](_0x270a7a[_0x0fa5('0x29')][_0x0fa5('0x33')]);_0x536c37[_0x0fa5('0x1c')]=qs[_0x0fa5('0x1c')](_0x270a7a[_0x0fa5('0x29')][_0x0fa5('0x1c')]);}return _0x4b2e1b[_0x0fa5('0x46')](_0x536c37);}})['then'](function(_0x3a7f33){if(_0x3a7f33){return _0x3a7f33?{'count':_0x10d714,'rows':_0x3a7f33}:null;}})[_0x0fa5('0x20')](respondWithResult(_0x31c6df,null))['catch'](handleError(_0x31c6df,null));};exports['getSubjects']=function(_0x514836,_0x136909,_0x4caf0a){var _0x4769ba={};var _0x5c36ff={};var _0x1b1c42;var _0x29924c;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x514836[_0x0fa5('0x41')]['id']}})[_0x0fa5('0x20')](handleEntityNotFound(_0x136909,null))['then'](function(_0x50e1c1){if(_0x50e1c1){_0x1b1c42=_0x50e1c1;_0x5c36ff[_0x0fa5('0x2e')]=_[_0x0fa5('0x2a')](db[_0x0fa5('0x47')][_0x0fa5('0x26')]);_0x5c36ff['query']=_[_0x0fa5('0x2a')](_0x514836[_0x0fa5('0x29')]);_0x5c36ff[_0x0fa5('0x2b')]=_[_0x0fa5('0x2c')](_0x5c36ff[_0x0fa5('0x2e')],_0x5c36ff[_0x0fa5('0x29')]);_0x4769ba[_0x0fa5('0x2d')]=_['intersection'](_0x5c36ff[_0x0fa5('0x2e')],qs[_0x0fa5('0x2f')](_0x514836['query'][_0x0fa5('0x2f')]));_0x4769ba[_0x0fa5('0x2d')]=_0x4769ba[_0x0fa5('0x2d')]['length']?_0x4769ba[_0x0fa5('0x2d')]:_0x5c36ff[_0x0fa5('0x2e')];_0x4769ba[_0x0fa5('0x34')]=qs[_0x0fa5('0x35')](_0x514836[_0x0fa5('0x29')][_0x0fa5('0x35')]);_0x4769ba[_0x0fa5('0x36')]=qs[_0x0fa5('0x2b')](_['pick'](_0x514836[_0x0fa5('0x29')],_0x5c36ff['filters']));if(_0x514836[_0x0fa5('0x29')]['filter']){_0x4769ba[_0x0fa5('0x36')]=_[_0x0fa5('0x38')](_0x4769ba[_0x0fa5('0x36')],{'$or':_[_0x0fa5('0x48')](_0x4769ba[_0x0fa5('0x2d')],function(_0x3e5163){var _0xe11817={};_0xe11817[_0x3e5163]={'$like':'%'+_0x514836[_0x0fa5('0x29')][_0x0fa5('0x3b')]+'%'};return _0xe11817;})});}_0x4769ba=_[_0x0fa5('0x38')]({},_0x4769ba,_0x514836[_0x0fa5('0x3c')]);return _0x1b1c42[_0x0fa5('0x49')](_0x4769ba);}})[_0x0fa5('0x20')](function(_0x5a67b3){if(_0x5a67b3){_0x29924c=_0x5a67b3[_0x0fa5('0x30')];if(!_0x514836[_0x0fa5('0x29')][_0x0fa5('0x31')](_0x0fa5('0x32'))){_0x4769ba['limit']=qs[_0x0fa5('0x33')](_0x514836[_0x0fa5('0x29')][_0x0fa5('0x33')]);_0x4769ba[_0x0fa5('0x1c')]=qs[_0x0fa5('0x1c')](_0x514836[_0x0fa5('0x29')]['offset']);}return _0x1b1c42[_0x0fa5('0x49')](_0x4769ba);}})[_0x0fa5('0x20')](function(_0x4a3960){if(_0x4a3960){return _0x4a3960?{'count':_0x29924c,'rows':_0x4a3960}:null;}})[_0x0fa5('0x20')](respondWithResult(_0x136909,null))[_0x0fa5('0x3f')](handleError(_0x136909,null));};exports[_0x0fa5('0x4a')]=function(_0x1ec3a2,_0x450b11,_0x40fdb2){var _0x325fbd={};var _0x272b50={};var _0xd5850;var _0x1d26c0;return db[_0x0fa5('0x25')][_0x0fa5('0x4b')]({'where':{'id':_0x1ec3a2['params']['id']}})[_0x0fa5('0x20')](handleEntityNotFound(_0x450b11,null))['then'](function(_0x3d8725){if(_0x3d8725){_0xd5850=_0x3d8725;_0x272b50['model']=_[_0x0fa5('0x2a')](db['ZohoField']['rawAttributes']);_0x272b50[_0x0fa5('0x29')]=_[_0x0fa5('0x2a')](_0x1ec3a2[_0x0fa5('0x29')]);_0x272b50[_0x0fa5('0x2b')]=_['intersection'](_0x272b50[_0x0fa5('0x2e')],_0x272b50[_0x0fa5('0x29')]);_0x325fbd['attributes']=_[_0x0fa5('0x2c')](_0x272b50[_0x0fa5('0x2e')],qs[_0x0fa5('0x2f')](_0x1ec3a2[_0x0fa5('0x29')]['fields']));_0x325fbd['attributes']=_0x325fbd[_0x0fa5('0x2d')][_0x0fa5('0x30')]?_0x325fbd['attributes']:_0x272b50['model'];_0x325fbd[_0x0fa5('0x34')]=qs[_0x0fa5('0x35')](_0x1ec3a2[_0x0fa5('0x29')][_0x0fa5('0x35')]);_0x325fbd[_0x0fa5('0x36')]=qs[_0x0fa5('0x2b')](_[_0x0fa5('0x37')](_0x1ec3a2[_0x0fa5('0x29')],_0x272b50[_0x0fa5('0x2b')]));if(_0x1ec3a2[_0x0fa5('0x29')][_0x0fa5('0x3b')]){_0x325fbd[_0x0fa5('0x36')]=_[_0x0fa5('0x38')](_0x325fbd['where'],{'$or':_[_0x0fa5('0x48')](_0x325fbd[_0x0fa5('0x2d')],function(_0x24930a){var _0x1beb33={};_0x1beb33[_0x24930a]={'$like':'%'+_0x1ec3a2[_0x0fa5('0x29')][_0x0fa5('0x3b')]+'%'};return _0x1beb33;})});}_0x325fbd=_[_0x0fa5('0x38')]({},_0x325fbd,_0x1ec3a2[_0x0fa5('0x3c')]);return _0xd5850['getDescriptions'](_0x325fbd);}})[_0x0fa5('0x20')](function(_0x3257f4){if(_0x3257f4){_0x1d26c0=_0x3257f4[_0x0fa5('0x30')];if(!_0x1ec3a2[_0x0fa5('0x29')][_0x0fa5('0x31')](_0x0fa5('0x32'))){_0x325fbd[_0x0fa5('0x33')]=qs[_0x0fa5('0x33')](_0x1ec3a2[_0x0fa5('0x29')][_0x0fa5('0x33')]);_0x325fbd[_0x0fa5('0x1c')]=qs[_0x0fa5('0x1c')](_0x1ec3a2[_0x0fa5('0x29')][_0x0fa5('0x1c')]);}return _0xd5850['getDescriptions'](_0x325fbd);}})[_0x0fa5('0x20')](function(_0x3498ba){if(_0x3498ba){return _0x3498ba?{'count':_0x1d26c0,'rows':_0x3498ba}:null;}})[_0x0fa5('0x20')](respondWithResult(_0x450b11,null))[_0x0fa5('0x3f')](handleError(_0x450b11,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index ace9cd5..d033e6c 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 _0xa38f=['moment','request-promise','path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','lodash','util','../../config/logger','api'];(function(_0x13e04d,_0x40a506){var _0x2b0a95=function(_0xfa0d96){while(--_0xfa0d96){_0x13e04d['push'](_0x13e04d['shift']());}};_0x2b0a95(++_0x40a506);}(_0xa38f,0x15b));var _0xfa38=function(_0x2f7b0f,_0x3d9c8e){_0x2f7b0f=_0x2f7b0f-0x0;var _0x22e31f=_0xa38f[_0x2f7b0f];return _0x22e31f;};'use strict';var _=require(_0xfa38('0x0'));var util=require(_0xfa38('0x1'));var logger=require(_0xfa38('0x2'))(_0xfa38('0x3'));var moment=require(_0xfa38('0x4'));var BPromise=require('bluebird');var rp=require(_0xfa38('0x5'));var fs=require('fs');var path=require(_0xfa38('0x6'));var rimraf=require(_0xfa38('0x7'));var config=require(_0xfa38('0x8'));var attributes=require(_0xfa38('0x9'));module[_0xfa38('0xa')]=function(_0x5d6ad5,_0x5e9221){return _0x5d6ad5[_0xfa38('0xb')](_0xfa38('0xc'),attributes,{'tableName':'int_zoho_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe004=['api','moment','bluebird','request-promise','path','../../config/environment','./intZohoConfiguration.attributes','exports','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger'];(function(_0x4a46ad,_0x5d0428){var _0x29ab8e=function(_0x40ba1e){while(--_0x40ba1e){_0x4a46ad['push'](_0x4a46ad['shift']());}};_0x29ab8e(++_0x5d0428);}(_0xe004,0x15c));var _0x4e00=function(_0x7880d2,_0x32e7d6){_0x7880d2=_0x7880d2-0x0;var _0x35ebbe=_0xe004[_0x7880d2];return _0x35ebbe;};'use strict';var _=require(_0x4e00('0x0'));var util=require(_0x4e00('0x1'));var logger=require(_0x4e00('0x2'))(_0x4e00('0x3'));var moment=require(_0x4e00('0x4'));var BPromise=require(_0x4e00('0x5'));var rp=require(_0x4e00('0x6'));var fs=require('fs');var path=require(_0x4e00('0x7'));var rimraf=require('rimraf');var config=require(_0x4e00('0x8'));var attributes=require(_0x4e00('0x9'));module[_0x4e00('0xa')]=function(_0x17b041,_0x4bd69c){return _0x17b041['define'](_0x4e00('0xb'),attributes,{'tableName':_0x4e00('0xc'),'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 a125737..00d0bd6 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 _0xe53d=['error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','stringify'];(function(_0x36ee74,_0xb607ad){var _0x2b2cb5=function(_0x48d1e4){while(--_0x48d1e4){_0x36ee74['push'](_0x36ee74['shift']());}};_0x2b2cb5(++_0xb607ad);}(_0xe53d,0xf6));var _0xde53=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0xe53d[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xde53('0x0'));var util=require(_0xde53('0x1'));var moment=require(_0xde53('0x2'));var BPromise=require('bluebird');var rs=require(_0xde53('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xde53('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xde53('0x5'))('rpc');var config=require(_0xde53('0x6'));var jayson=require(_0xde53('0x7'));var client=jayson[_0xde53('0x8')][_0xde53('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x338d37,_0x582205,_0x58c68c){return new BPromise(function(_0xe792e4,_0x494ea8){return client[_0xde53('0xa')](_0x338d37,_0x58c68c)['then'](function(_0x4f1d16){logger[_0xde53('0xb')]('ZohoConfiguration,\x20%s,\x20%s',_0x582205,'request\x20sent');logger['debug']('ZohoConfiguration,\x20%s,\x20%s,\x20%s',_0x582205,_0xde53('0xc'),JSON[_0xde53('0xd')](_0x4f1d16));if(_0x4f1d16[_0xde53('0xe')]){if(_0x4f1d16['error'][_0xde53('0xf')]===0x1f4){logger[_0xde53('0xe')](_0xde53('0x10'),_0x582205,_0x4f1d16[_0xde53('0xe')]['message']);return _0x494ea8(_0x4f1d16['error'][_0xde53('0x11')]);}logger[_0xde53('0xe')](_0xde53('0x10'),_0x582205,_0x4f1d16[_0xde53('0xe')][_0xde53('0x11')]);return _0xe792e4(_0x4f1d16[_0xde53('0xe')]['message']);}else{logger[_0xde53('0xb')](_0xde53('0x10'),_0x582205,_0xde53('0xc'));_0xe792e4(_0x4f1d16[_0xde53('0x12')][_0xde53('0x11')]);}})[_0xde53('0x13')](function(_0x331abe){logger['error'](_0xde53('0x10'),_0x582205,_0x331abe);_0x494ea8(_0x331abe);});});} \ No newline at end of file +var _0x928c=['request','then','info','ZohoConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x928c,0x139));var _0xc928=function(_0xae9b94,_0x1dc351){_0xae9b94=_0xae9b94-0x0;var _0xb56f45=_0x928c[_0xae9b94];return _0xb56f45;};'use strict';var _=require(_0xc928('0x0'));var util=require(_0xc928('0x1'));var moment=require(_0xc928('0x2'));var BPromise=require(_0xc928('0x3'));var rs=require(_0xc928('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc928('0x5'))['db'];var utils=require(_0xc928('0x6'));var logger=require(_0xc928('0x7'))(_0xc928('0x8'));var config=require(_0xc928('0x9'));var jayson=require(_0xc928('0xa'));var client=jayson[_0xc928('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cb5cf,_0x50ec5b,_0x5d1068){return new BPromise(function(_0x31439c,_0x40d3c8){return client[_0xc928('0xc')](_0x3cb5cf,_0x5d1068)[_0xc928('0xd')](function(_0x5edc9e){logger[_0xc928('0xe')](_0xc928('0xf'),_0x50ec5b,_0xc928('0x10'));logger[_0xc928('0x11')](_0xc928('0x12'),_0x50ec5b,_0xc928('0x10'),JSON[_0xc928('0x13')](_0x5edc9e));if(_0x5edc9e[_0xc928('0x14')]){if(_0x5edc9e[_0xc928('0x14')][_0xc928('0x15')]===0x1f4){logger[_0xc928('0x14')]('ZohoConfiguration,\x20%s,\x20%s',_0x50ec5b,_0x5edc9e[_0xc928('0x14')][_0xc928('0x16')]);return _0x40d3c8(_0x5edc9e[_0xc928('0x14')][_0xc928('0x16')]);}logger[_0xc928('0x14')](_0xc928('0xf'),_0x50ec5b,_0x5edc9e[_0xc928('0x14')]['message']);return _0x31439c(_0x5edc9e['error'][_0xc928('0x16')]);}else{logger['info'](_0xc928('0xf'),_0x50ec5b,_0xc928('0x10'));_0x31439c(_0x5edc9e[_0xc928('0x17')][_0xc928('0x16')]);}})[_0xc928('0x18')](function(_0x19bff8){logger[_0xc928('0x14')](_0xc928('0xf'),_0x50ec5b,_0x19bff8);_0x40d3c8(_0x19bff8);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index f18a2f5..70f50aa 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 _0x0a74=['post','create','update','delete','destroy','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','./intZohoField.controller','get','/:id','isAuthenticated'];(function(_0x592722,_0x14fe23){var _0x5d31a1=function(_0x39d868){while(--_0x39d868){_0x592722['push'](_0x592722['shift']());}};_0x5d31a1(++_0x14fe23);}(_0x0a74,0x14f));var _0x40a7=function(_0x320626,_0x3cc862){_0x320626=_0x320626-0x0;var _0x757d40=_0x0a74[_0x320626];return _0x757d40;};'use strict';var multer=require(_0x40a7('0x0'));var util=require(_0x40a7('0x1'));var path=require(_0x40a7('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x40a7('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x40a7('0x4'));var interaction=require(_0x40a7('0x5'));var config=require('../../config/environment');var controller=require(_0x40a7('0x6'));router[_0x40a7('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x40a7('0x8'),auth[_0x40a7('0x9')](),controller['show']);router[_0x40a7('0xa')]('/',auth['isAuthenticated'](),controller[_0x40a7('0xb')]);router['put']('/:id',auth[_0x40a7('0x9')](),controller[_0x40a7('0xc')]);router[_0x40a7('0xd')]('/:id',auth[_0x40a7('0x9')](),controller[_0x40a7('0xe')]);module['exports']=router; \ No newline at end of file +var _0x98d2=['fs-extra','../../components/auth/service','../../config/environment','get','/:id','isAuthenticated','show','create','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x1505dd,_0x5287f2){var _0x72a774=function(_0x5b5849){while(--_0x5b5849){_0x1505dd['push'](_0x1505dd['shift']());}};_0x72a774(++_0x5287f2);}(_0x98d2,0x128));var _0x298d=function(_0x1667df,_0x266940){_0x1667df=_0x1667df-0x0;var _0x341abf=_0x98d2[_0x1667df];return _0x341abf;};'use strict';var multer=require(_0x298d('0x0'));var util=require('util');var path=require(_0x298d('0x1'));var timeout=require(_0x298d('0x2'));var express=require('express');var router=express[_0x298d('0x3')]();var fs_extra=require(_0x298d('0x4'));var auth=require(_0x298d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x298d('0x6'));var controller=require('./intZohoField.controller');router[_0x298d('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x298d('0x7')](_0x298d('0x8'),auth[_0x298d('0x9')](),controller[_0x298d('0xa')]);router['post']('/',auth[_0x298d('0x9')](),controller[_0x298d('0xb')]);router['put']('/:id',auth[_0x298d('0x9')](),controller['update']);router[_0x298d('0xc')](_0x298d('0x8'),auth[_0x298d('0x9')](),controller[_0x298d('0xd')]);module[_0x298d('0xe')]=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index db634e5..7d9420d 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 _0xc188=['customVariable','keyValue','picklist','STRING','variable','BOOLEAN','exports','ENUM','string'];(function(_0x4142f9,_0xa05f51){var _0x50729c=function(_0x5d943e){while(--_0x5d943e){_0x4142f9['push'](_0x4142f9['shift']());}};_0x50729c(++_0xa05f51);}(_0xc188,0x96));var _0x8c18=function(_0x4d237c,_0x445600){_0x4d237c=_0x4d237c-0x0;var _0x44f5b4=_0xc188[_0x4d237c];return _0x44f5b4;};'use strict';var Sequelize=require('sequelize');module[_0x8c18('0x0')]={'type':{'type':Sequelize[_0x8c18('0x1')](_0x8c18('0x2'),'variable',_0x8c18('0x3'),_0x8c18('0x4'),_0x8c18('0x5')),'defaultValue':_0x8c18('0x2')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x8c18('0x6')]},'keyType':{'type':Sequelize[_0x8c18('0x1')](_0x8c18('0x2'),_0x8c18('0x7'),'customVariable')},'keyContent':{'type':Sequelize[_0x8c18('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x8c18('0x6')]},'customField':{'type':Sequelize[_0x8c18('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8c18('0x6')]}}; \ No newline at end of file +var _0x2723=['picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','keyValue'];(function(_0x440e51,_0x4fc63a){var _0x9be905=function(_0x3e685e){while(--_0x3e685e){_0x440e51['push'](_0x440e51['shift']());}};_0x9be905(++_0x4fc63a);}(_0x2723,0x147));var _0x3272=function(_0x1edb35,_0x44ef6c){_0x1edb35=_0x1edb35-0x0;var _0x276e8c=_0x2723[_0x1edb35];return _0x276e8c;};'use strict';var Sequelize=require(_0x3272('0x0'));module[_0x3272('0x1')]={'type':{'type':Sequelize[_0x3272('0x2')](_0x3272('0x3'),_0x3272('0x4'),'customVariable',_0x3272('0x5'),_0x3272('0x6')),'defaultValue':_0x3272('0x3')},'content':{'type':Sequelize[_0x3272('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x3272('0x2')](_0x3272('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x3272('0x7')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x3272('0x8')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3272('0x7')]}}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.controller.js b/server/api/intZohoField/intZohoField.controller.js index 7154a51..2b6962a 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 _0x82ad=['ZohoField','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','map','includeAll','findAll','rows','catch','show','params','include','find','create','body','destroy','rimraf','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','offset','limit','undefined','count','set','Content-Range','json','apply','save','then','error','name','index'];(function(_0x42dab6,_0x225396){var _0x2200df=function(_0x97db18){while(--_0x97db18){_0x42dab6['push'](_0x42dab6['shift']());}};_0x2200df(++_0x225396);}(_0x82ad,0xac));var _0xd82a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x82ad[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd82a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd82a('0x1'));var BPromise=require('bluebird');var Mustache=require(_0xd82a('0x2'));var util=require(_0xd82a('0x3'));var path=require(_0xd82a('0x4'));var sox=require(_0xd82a('0x5'));var csv=require(_0xd82a('0x6'));var ejs=require(_0xd82a('0x7'));var fs=require('fs');var fs_extra=require(_0xd82a('0x8'));var _=require(_0xd82a('0x9'));var squel=require(_0xd82a('0xa'));var crypto=require(_0xd82a('0xb'));var jsforce=require(_0xd82a('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd82a('0x6'));var querystring=require(_0xd82a('0xd'));var Papa=require(_0xd82a('0xe'));var Redis=require(_0xd82a('0xf'));var authService=require(_0xd82a('0x10'));var qs=require(_0xd82a('0x11'));var as=require(_0xd82a('0x12'));var hardwareService=require(_0xd82a('0x13'));var logger=require(_0xd82a('0x14'))(_0xd82a('0x15'));var utils=require(_0xd82a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0xd82a('0x17'));var db=require(_0xd82a('0x18'))['db'];function respondWithStatusCode(_0x22de82,_0x7882a0){_0x7882a0=_0x7882a0||0xcc;return function(_0x3e5964){if(_0x3e5964){return _0x22de82[_0xd82a('0x19')](_0x7882a0);}return _0x22de82[_0xd82a('0x1a')](_0x7882a0)[_0xd82a('0x1b')]();};}function respondWithResult(_0x558d6b,_0x5b278c){_0x5b278c=_0x5b278c||0xc8;return function(_0x4b3ac2){if(_0x4b3ac2){return _0x558d6b['status'](_0x5b278c)['json'](_0x4b3ac2);}};}function respondWithFilteredResult(_0x27605c,_0x1b1857){return function(_0x4d68a2){if(_0x4d68a2){var _0x34a043=typeof _0x1b1857[_0xd82a('0x1c')]==='undefined'&&typeof _0x1b1857[_0xd82a('0x1d')]===_0xd82a('0x1e');var _0x3b9f3d=_0x4d68a2[_0xd82a('0x1f')];var _0x402809=_0x34a043?0x0:_0x1b1857[_0xd82a('0x1c')];var _0x26c4c0=_0x34a043?_0x4d68a2['count']:_0x1b1857[_0xd82a('0x1c')]+_0x1b1857['limit'];var _0x3183f2;if(_0x26c4c0>=_0x3b9f3d){_0x26c4c0=_0x3b9f3d;_0x3183f2=0xc8;}else{_0x3183f2=0xce;}_0x27605c[_0xd82a('0x1a')](_0x3183f2);return _0x27605c[_0xd82a('0x20')](_0xd82a('0x21'),_0x402809+'-'+_0x26c4c0+'/'+_0x3b9f3d)[_0xd82a('0x22')](_0x4d68a2);}return null;};}function patchUpdates(_0x3b3ba3){return function(_0x4cec86){try{jsonpatch[_0xd82a('0x23')](_0x4cec86,_0x3b3ba3,!![]);}catch(_0x31679b){return BPromise['reject'](_0x31679b);}return _0x4cec86[_0xd82a('0x24')]();};}function saveUpdates(_0x46f30f,_0x2fa4b9){return function(_0x27cd56){if(_0x27cd56){return _0x27cd56['update'](_0x46f30f)[_0xd82a('0x25')](function(_0x5a50b4){return _0x5a50b4;});}return null;};}function removeEntity(_0x3f226f,_0x55d92e){return function(_0x718932){if(_0x718932){return _0x718932['destroy']()[_0xd82a('0x25')](function(){_0x3f226f[_0xd82a('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x62bbc,_0x7efd97){return function(_0x467959){if(!_0x467959){_0x62bbc['sendStatus'](0x194);}return _0x467959;};}function handleError(_0x59157e,_0x162205){_0x162205=_0x162205||0x1f4;return function(_0x386579){logger[_0xd82a('0x26')](_0x386579['stack']);if(_0x386579[_0xd82a('0x27')]){delete _0x386579[_0xd82a('0x27')];}_0x59157e[_0xd82a('0x1a')](_0x162205)['send'](_0x386579);};}exports[_0xd82a('0x28')]=function(_0x30e945,_0x3cb651){var _0x108f73={},_0x590c5e={},_0x5c4270={'count':0x0,'rows':[]};var _0x30dd51=_['map'](db[_0xd82a('0x29')][_0xd82a('0x2a')],function(_0x146e12){return{'name':_0x146e12['fieldName'],'type':_0x146e12['type'][_0xd82a('0x2b')]};});_0x590c5e[_0xd82a('0x2c')]=_['map'](_0x30dd51,'name');_0x590c5e[_0xd82a('0x2d')]=_[_0xd82a('0x2e')](_0x30e945[_0xd82a('0x2d')]);_0x590c5e[_0xd82a('0x2f')]=_[_0xd82a('0x30')](_0x590c5e['model'],_0x590c5e[_0xd82a('0x2d')]);_0x108f73[_0xd82a('0x31')]=_[_0xd82a('0x30')](_0x590c5e[_0xd82a('0x2c')],qs[_0xd82a('0x32')](_0x30e945[_0xd82a('0x2d')][_0xd82a('0x32')]));_0x108f73['attributes']=_0x108f73[_0xd82a('0x31')][_0xd82a('0x33')]?_0x108f73[_0xd82a('0x31')]:_0x590c5e['model'];if(!_0x30e945['query']['hasOwnProperty'](_0xd82a('0x34'))){_0x108f73[_0xd82a('0x1d')]=qs['limit'](_0x30e945[_0xd82a('0x2d')]['limit']);_0x108f73['offset']=qs[_0xd82a('0x1c')](_0x30e945['query'][_0xd82a('0x1c')]);}_0x108f73[_0xd82a('0x35')]=qs['sort'](_0x30e945['query'][_0xd82a('0x36')]);_0x108f73[_0xd82a('0x37')]=qs[_0xd82a('0x2f')](_[_0xd82a('0x38')](_0x30e945['query'],_0x590c5e[_0xd82a('0x2f')]),_0x30dd51);if(_0x30e945[_0xd82a('0x2d')][_0xd82a('0x39')]){_0x108f73['where']=_[_0xd82a('0x3a')](_0x108f73['where'],{'$or':_[_0xd82a('0x3b')](_0x30dd51,function(_0x395516){if(_0x395516['type']!=='VIRTUAL'){var _0x2496cb={};_0x2496cb[_0x395516[_0xd82a('0x27')]]={'$like':'%'+_0x30e945[_0xd82a('0x2d')][_0xd82a('0x39')]+'%'};return _0x2496cb;}})});}_0x108f73=_['merge']({},_0x108f73,_0x30e945['options']);var _0x5d0131={'where':_0x108f73['where']};return db[_0xd82a('0x29')][_0xd82a('0x1f')](_0x5d0131)[_0xd82a('0x25')](function(_0x1cbf4b){_0x5c4270[_0xd82a('0x1f')]=_0x1cbf4b;if(_0x30e945[_0xd82a('0x2d')][_0xd82a('0x3c')]){_0x108f73['include']=[{'all':!![]}];}return db[_0xd82a('0x29')][_0xd82a('0x3d')](_0x108f73);})['then'](function(_0x196a03){_0x5c4270[_0xd82a('0x3e')]=_0x196a03;return _0x5c4270;})[_0xd82a('0x25')](respondWithFilteredResult(_0x3cb651,_0x108f73))[_0xd82a('0x3f')](handleError(_0x3cb651,null));};exports[_0xd82a('0x40')]=function(_0x605a1a,_0x31e3f8){var _0x54109d={'raw':!![],'where':{'id':_0x605a1a[_0xd82a('0x41')]['id']}},_0x1bd2a0={};_0x1bd2a0['model']=_[_0xd82a('0x2e')](db['ZohoField']['rawAttributes']);_0x1bd2a0['query']=_[_0xd82a('0x2e')](_0x605a1a['query']);_0x1bd2a0[_0xd82a('0x2f')]=_['intersection'](_0x1bd2a0['model'],_0x1bd2a0['query']);_0x54109d[_0xd82a('0x31')]=_[_0xd82a('0x30')](_0x1bd2a0[_0xd82a('0x2c')],qs[_0xd82a('0x32')](_0x605a1a[_0xd82a('0x2d')][_0xd82a('0x32')]));_0x54109d[_0xd82a('0x31')]=_0x54109d[_0xd82a('0x31')][_0xd82a('0x33')]?_0x54109d[_0xd82a('0x31')]:_0x1bd2a0[_0xd82a('0x2c')];if(_0x605a1a[_0xd82a('0x2d')][_0xd82a('0x3c')]){_0x54109d[_0xd82a('0x42')]=[{'all':!![]}];}_0x54109d=_[_0xd82a('0x3a')]({},_0x54109d,_0x605a1a['options']);return db['ZohoField'][_0xd82a('0x43')](_0x54109d)[_0xd82a('0x25')](handleEntityNotFound(_0x31e3f8,null))[_0xd82a('0x25')](respondWithResult(_0x31e3f8,null))[_0xd82a('0x3f')](handleError(_0x31e3f8,null));};exports[_0xd82a('0x44')]=function(_0x4f5874,_0x5105cd){return db[_0xd82a('0x29')][_0xd82a('0x44')](_0x4f5874[_0xd82a('0x45')],{})[_0xd82a('0x25')](respondWithResult(_0x5105cd,0xc9))[_0xd82a('0x3f')](handleError(_0x5105cd,null));};exports['update']=function(_0x29d0a4,_0x196324){if(_0x29d0a4['body']['id']){delete _0x29d0a4['body']['id'];}return db[_0xd82a('0x29')][_0xd82a('0x43')]({'where':{'id':_0x29d0a4['params']['id']}})[_0xd82a('0x25')](handleEntityNotFound(_0x196324,null))[_0xd82a('0x25')](saveUpdates(_0x29d0a4[_0xd82a('0x45')],null))['then'](respondWithResult(_0x196324,null))[_0xd82a('0x3f')](handleError(_0x196324,null));};exports[_0xd82a('0x46')]=function(_0x15edcc,_0x5b50a3){return db['ZohoField'][_0xd82a('0x43')]({'where':{'id':_0x15edcc[_0xd82a('0x41')]['id']}})[_0xd82a('0x25')](handleEntityNotFound(_0x5b50a3,null))[_0xd82a('0x25')](removeEntity(_0x5b50a3,null))[_0xd82a('0x3f')](handleError(_0x5b50a3,null));}; \ No newline at end of file +var _0x5d07=['squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../mysqldb','end','status','json','undefined','offset','count','limit','set','Content-Range','apply','update','then','destroy','sendStatus','error','name','send','map','ZohoField','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash'];(function(_0x123859,_0x52eaca){var _0x501721=function(_0xf4bbcd){while(--_0xf4bbcd){_0x123859['push'](_0x123859['shift']());}};_0x501721(++_0x52eaca);}(_0x5d07,0x11f));var _0x75d0=function(_0x20785c,_0x22cd28){_0x20785c=_0x20785c-0x0;var _0x38dccd=_0x5d07[_0x20785c];return _0x38dccd;};'use strict';var emlformat=require(_0x75d0('0x0'));var rimraf=require(_0x75d0('0x1'));var zipdir=require(_0x75d0('0x2'));var jsonpatch=require(_0x75d0('0x3'));var rp=require(_0x75d0('0x4'));var moment=require(_0x75d0('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x75d0('0x6'));var util=require(_0x75d0('0x7'));var path=require(_0x75d0('0x8'));var sox=require(_0x75d0('0x9'));var csv=require(_0x75d0('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d0('0xb'));var _=require(_0x75d0('0xc'));var squel=require(_0x75d0('0xd'));var crypto=require(_0x75d0('0xe'));var jsforce=require(_0x75d0('0xf'));var deskjs=require(_0x75d0('0x10'));var toCsv=require(_0x75d0('0xa'));var querystring=require(_0x75d0('0x11'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x75d0('0x12'));var qs=require(_0x75d0('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x75d0('0x14'));var logger=require(_0x75d0('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x75d0('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x75d0('0x17'))['db'];function respondWithStatusCode(_0x43ca7e,_0x1971b0){_0x1971b0=_0x1971b0||0xcc;return function(_0x4aa81d){if(_0x4aa81d){return _0x43ca7e['sendStatus'](_0x1971b0);}return _0x43ca7e['status'](_0x1971b0)[_0x75d0('0x18')]();};}function respondWithResult(_0x34ef25,_0x104574){_0x104574=_0x104574||0xc8;return function(_0x146a0e){if(_0x146a0e){return _0x34ef25[_0x75d0('0x19')](_0x104574)[_0x75d0('0x1a')](_0x146a0e);}};}function respondWithFilteredResult(_0x2d744c,_0x4b6012){return function(_0x4d8599){if(_0x4d8599){var _0x47127c=typeof _0x4b6012['offset']===_0x75d0('0x1b')&&typeof _0x4b6012['limit']===_0x75d0('0x1b');var _0x1427d0=_0x4d8599['count'];var _0x4f9b7f=_0x47127c?0x0:_0x4b6012[_0x75d0('0x1c')];var _0x40c79e=_0x47127c?_0x4d8599[_0x75d0('0x1d')]:_0x4b6012['offset']+_0x4b6012[_0x75d0('0x1e')];var _0x267115;if(_0x40c79e>=_0x1427d0){_0x40c79e=_0x1427d0;_0x267115=0xc8;}else{_0x267115=0xce;}_0x2d744c[_0x75d0('0x19')](_0x267115);return _0x2d744c[_0x75d0('0x1f')](_0x75d0('0x20'),_0x4f9b7f+'-'+_0x40c79e+'/'+_0x1427d0)[_0x75d0('0x1a')](_0x4d8599);}return null;};}function patchUpdates(_0x38b8eb){return function(_0x39167c){try{jsonpatch[_0x75d0('0x21')](_0x39167c,_0x38b8eb,!![]);}catch(_0x5774a4){return BPromise['reject'](_0x5774a4);}return _0x39167c['save']();};}function saveUpdates(_0x2dcd1a,_0x8b3a21){return function(_0x5717a1){if(_0x5717a1){return _0x5717a1[_0x75d0('0x22')](_0x2dcd1a)[_0x75d0('0x23')](function(_0x2da462){return _0x2da462;});}return null;};}function removeEntity(_0x455646,_0x1df046){return function(_0x2c2cb4){if(_0x2c2cb4){return _0x2c2cb4[_0x75d0('0x24')]()[_0x75d0('0x23')](function(){_0x455646['status'](0xcc)[_0x75d0('0x18')]();});}};}function handleEntityNotFound(_0xe7e0a5,_0x3a912a){return function(_0x3382ea){if(!_0x3382ea){_0xe7e0a5[_0x75d0('0x25')](0x194);}return _0x3382ea;};}function handleError(_0x3d423a,_0x3110de){_0x3110de=_0x3110de||0x1f4;return function(_0x2fd76f){logger[_0x75d0('0x26')](_0x2fd76f['stack']);if(_0x2fd76f[_0x75d0('0x27')]){delete _0x2fd76f[_0x75d0('0x27')];}_0x3d423a[_0x75d0('0x19')](_0x3110de)[_0x75d0('0x28')](_0x2fd76f);};}exports['index']=function(_0x59fdb7,_0x5ac4c6){var _0x5c7783={},_0x4e12e2={},_0x8070ff={'count':0x0,'rows':[]};var _0x29e272=_[_0x75d0('0x29')](db[_0x75d0('0x2a')][_0x75d0('0x2b')],function(_0x483b2e){return{'name':_0x483b2e[_0x75d0('0x2c')],'type':_0x483b2e[_0x75d0('0x2d')][_0x75d0('0x2e')]};});_0x4e12e2['model']=_[_0x75d0('0x29')](_0x29e272,_0x75d0('0x27'));_0x4e12e2[_0x75d0('0x2f')]=_[_0x75d0('0x30')](_0x59fdb7[_0x75d0('0x2f')]);_0x4e12e2[_0x75d0('0x31')]=_[_0x75d0('0x32')](_0x4e12e2[_0x75d0('0x33')],_0x4e12e2[_0x75d0('0x2f')]);_0x5c7783[_0x75d0('0x34')]=_[_0x75d0('0x32')](_0x4e12e2[_0x75d0('0x33')],qs[_0x75d0('0x35')](_0x59fdb7[_0x75d0('0x2f')]['fields']));_0x5c7783[_0x75d0('0x34')]=_0x5c7783[_0x75d0('0x34')][_0x75d0('0x36')]?_0x5c7783[_0x75d0('0x34')]:_0x4e12e2[_0x75d0('0x33')];if(!_0x59fdb7[_0x75d0('0x2f')][_0x75d0('0x37')](_0x75d0('0x38'))){_0x5c7783['limit']=qs[_0x75d0('0x1e')](_0x59fdb7[_0x75d0('0x2f')]['limit']);_0x5c7783[_0x75d0('0x1c')]=qs[_0x75d0('0x1c')](_0x59fdb7[_0x75d0('0x2f')][_0x75d0('0x1c')]);}_0x5c7783[_0x75d0('0x39')]=qs[_0x75d0('0x3a')](_0x59fdb7['query'][_0x75d0('0x3a')]);_0x5c7783[_0x75d0('0x3b')]=qs['filters'](_[_0x75d0('0x3c')](_0x59fdb7['query'],_0x4e12e2[_0x75d0('0x31')]),_0x29e272);if(_0x59fdb7[_0x75d0('0x2f')][_0x75d0('0x3d')]){_0x5c7783[_0x75d0('0x3b')]=_[_0x75d0('0x3e')](_0x5c7783[_0x75d0('0x3b')],{'$or':_[_0x75d0('0x29')](_0x29e272,function(_0x33ed73){if(_0x33ed73[_0x75d0('0x2d')]!==_0x75d0('0x3f')){var _0x3391b7={};_0x3391b7[_0x33ed73[_0x75d0('0x27')]]={'$like':'%'+_0x59fdb7[_0x75d0('0x2f')][_0x75d0('0x3d')]+'%'};return _0x3391b7;}})});}_0x5c7783=_[_0x75d0('0x3e')]({},_0x5c7783,_0x59fdb7[_0x75d0('0x40')]);var _0x1b5541={'where':_0x5c7783['where']};return db[_0x75d0('0x2a')][_0x75d0('0x1d')](_0x1b5541)['then'](function(_0x525dc7){_0x8070ff[_0x75d0('0x1d')]=_0x525dc7;if(_0x59fdb7['query'][_0x75d0('0x41')]){_0x5c7783[_0x75d0('0x42')]=[{'all':!![]}];}return db[_0x75d0('0x2a')][_0x75d0('0x43')](_0x5c7783);})[_0x75d0('0x23')](function(_0x1c524f){_0x8070ff[_0x75d0('0x44')]=_0x1c524f;return _0x8070ff;})['then'](respondWithFilteredResult(_0x5ac4c6,_0x5c7783))['catch'](handleError(_0x5ac4c6,null));};exports[_0x75d0('0x45')]=function(_0x2bf1f2,_0x2de5ff){var _0x59262f={'raw':!![],'where':{'id':_0x2bf1f2['params']['id']}},_0x5e4f2a={};_0x5e4f2a[_0x75d0('0x33')]=_[_0x75d0('0x30')](db['ZohoField'][_0x75d0('0x2b')]);_0x5e4f2a[_0x75d0('0x2f')]=_['keys'](_0x2bf1f2[_0x75d0('0x2f')]);_0x5e4f2a[_0x75d0('0x31')]=_[_0x75d0('0x32')](_0x5e4f2a[_0x75d0('0x33')],_0x5e4f2a[_0x75d0('0x2f')]);_0x59262f['attributes']=_[_0x75d0('0x32')](_0x5e4f2a[_0x75d0('0x33')],qs[_0x75d0('0x35')](_0x2bf1f2[_0x75d0('0x2f')]['fields']));_0x59262f[_0x75d0('0x34')]=_0x59262f[_0x75d0('0x34')][_0x75d0('0x36')]?_0x59262f[_0x75d0('0x34')]:_0x5e4f2a['model'];if(_0x2bf1f2[_0x75d0('0x2f')][_0x75d0('0x41')]){_0x59262f[_0x75d0('0x42')]=[{'all':!![]}];}_0x59262f=_[_0x75d0('0x3e')]({},_0x59262f,_0x2bf1f2[_0x75d0('0x40')]);return db[_0x75d0('0x2a')][_0x75d0('0x46')](_0x59262f)[_0x75d0('0x23')](handleEntityNotFound(_0x2de5ff,null))[_0x75d0('0x23')](respondWithResult(_0x2de5ff,null))[_0x75d0('0x47')](handleError(_0x2de5ff,null));};exports[_0x75d0('0x48')]=function(_0x4cbe36,_0x18a997){return db[_0x75d0('0x2a')]['create'](_0x4cbe36[_0x75d0('0x49')],{})['then'](respondWithResult(_0x18a997,0xc9))[_0x75d0('0x47')](handleError(_0x18a997,null));};exports[_0x75d0('0x22')]=function(_0x98f9b8,_0x496d18){if(_0x98f9b8['body']['id']){delete _0x98f9b8[_0x75d0('0x49')]['id'];}return db['ZohoField'][_0x75d0('0x46')]({'where':{'id':_0x98f9b8[_0x75d0('0x4a')]['id']}})[_0x75d0('0x23')](handleEntityNotFound(_0x496d18,null))[_0x75d0('0x23')](saveUpdates(_0x98f9b8[_0x75d0('0x49')],null))[_0x75d0('0x23')](respondWithResult(_0x496d18,null))[_0x75d0('0x47')](handleError(_0x496d18,null));};exports[_0x75d0('0x24')]=function(_0x7e3e9c,_0x1bcbc2){return db[_0x75d0('0x2a')][_0x75d0('0x46')]({'where':{'id':_0x7e3e9c[_0x75d0('0x4a')]['id']}})[_0x75d0('0x23')](handleEntityNotFound(_0x1bcbc2,null))['then'](removeEntity(_0x1bcbc2,null))[_0x75d0('0x47')](handleError(_0x1bcbc2,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 9945eb0..4c7822d 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 _0x9f0e=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','int_zoho_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','path','rimraf'];(function(_0x57ca23,_0x4c1a18){var _0x36301b=function(_0x516cb2){while(--_0x516cb2){_0x57ca23['push'](_0x57ca23['shift']());}};_0x36301b(++_0x4c1a18);}(_0x9f0e,0x116));var _0xe9f0=function(_0x591960,_0x4ac998){_0x591960=_0x591960-0x0;var _0x154905=_0x9f0e[_0x591960];return _0x154905;};'use strict';var _=require(_0xe9f0('0x0'));var util=require(_0xe9f0('0x1'));var logger=require(_0xe9f0('0x2'))(_0xe9f0('0x3'));var moment=require(_0xe9f0('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe9f0('0x5'));var rimraf=require(_0xe9f0('0x6'));var config=require(_0xe9f0('0x7'));var attributes=require(_0xe9f0('0x8'));module[_0xe9f0('0x9')]=function(_0x50313d,_0x5b87c1){return _0x50313d[_0xe9f0('0xa')](_0xe9f0('0xb'),attributes,{'tableName':_0xe9f0('0xc'),'paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0xe9f0('0xd'),_0xe9f0('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5c3c=['path','rimraf','../../config/environment','./intZohoField.attributes','exports','zoho_unique_index','idField','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x3bbb7b,_0x232b7d){var _0x495aec=function(_0x3ced62){while(--_0x3ced62){_0x3bbb7b['push'](_0x3bbb7b['shift']());}};_0x495aec(++_0x232b7d);}(_0x5c3c,0x132));var _0xc5c3=function(_0x34bf97,_0xc60f9d){_0x34bf97=_0x34bf97-0x0;var _0x292719=_0x5c3c[_0x34bf97];return _0x292719;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var logger=require(_0xc5c3('0x2'))(_0xc5c3('0x3'));var moment=require('moment');var BPromise=require(_0xc5c3('0x4'));var rp=require(_0xc5c3('0x5'));var fs=require('fs');var path=require(_0xc5c3('0x6'));var rimraf=require(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var attributes=require(_0xc5c3('0x9'));module[_0xc5c3('0xa')]=function(_0x23a6b5,_0x28bdd9){return _0x23a6b5['define']('ZohoField',attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':_0xc5c3('0xb'),'fields':[_0xc5c3('0xc'),'FieldId'],'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 b175e43..7cafa79 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 _0xd16b=['http','request','ZohoField,\x20%s,\x20%s','request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x16af01,_0x9c623c){var _0x4d4b9a=function(_0x26019f){while(--_0x26019f){_0x16af01['push'](_0x16af01['shift']());}};_0x4d4b9a(++_0x9c623c);}(_0xd16b,0xe8));var _0xbd16=function(_0xb245ce,_0xc157e5){_0xb245ce=_0xb245ce-0x0;var _0x41a891=_0xd16b[_0xb245ce];return _0x41a891;};'use strict';var _=require('lodash');var util=require(_0xbd16('0x0'));var moment=require(_0xbd16('0x1'));var BPromise=require('bluebird');var rs=require(_0xbd16('0x2'));var fs=require('fs');var Redis=require(_0xbd16('0x3'));var db=require(_0xbd16('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xbd16('0x5'))(_0xbd16('0x6'));var config=require(_0xbd16('0x7'));var jayson=require(_0xbd16('0x8'));var client=jayson[_0xbd16('0x9')][_0xbd16('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x214f28,_0x35895e,_0x3bfbd9){return new BPromise(function(_0x4daa13,_0x484d3c){return client[_0xbd16('0xb')](_0x214f28,_0x3bfbd9)['then'](function(_0x9324c2){logger['info'](_0xbd16('0xc'),_0x35895e,_0xbd16('0xd'));logger['debug'](_0xbd16('0xe'),_0x35895e,'request\x20sent',JSON[_0xbd16('0xf')](_0x9324c2));if(_0x9324c2[_0xbd16('0x10')]){if(_0x9324c2['error'][_0xbd16('0x11')]===0x1f4){logger[_0xbd16('0x10')](_0xbd16('0xc'),_0x35895e,_0x9324c2[_0xbd16('0x10')]['message']);return _0x484d3c(_0x9324c2['error'][_0xbd16('0x12')]);}logger['error'](_0xbd16('0xc'),_0x35895e,_0x9324c2[_0xbd16('0x10')][_0xbd16('0x12')]);return _0x4daa13(_0x9324c2[_0xbd16('0x10')][_0xbd16('0x12')]);}else{logger[_0xbd16('0x13')](_0xbd16('0xc'),_0x35895e,_0xbd16('0xd'));_0x4daa13(_0x9324c2[_0xbd16('0x14')][_0xbd16('0x12')]);}})[_0xbd16('0x15')](function(_0x3720d6){logger[_0xbd16('0x10')](_0xbd16('0xc'),_0x35895e,_0x3720d6);_0x484d3c(_0x3720d6);});});} \ No newline at end of file +var _0x917a=['result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info'];(function(_0x1d93a2,_0x59919c){var _0x2b2534=function(_0x189bcd){while(--_0x189bcd){_0x1d93a2['push'](_0x1d93a2['shift']());}};_0x2b2534(++_0x59919c);}(_0x917a,0xc9));var _0xa917=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x917a[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0xa917('0x0'));var moment=require('moment');var BPromise=require(_0xa917('0x1'));var rs=require(_0xa917('0x2'));var fs=require('fs');var Redis=require(_0xa917('0x3'));var db=require(_0xa917('0x4'))['db'];var utils=require(_0xa917('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xa917('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa917('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x49ac16,_0x577294,_0x31eb49){return new BPromise(function(_0xdfad5d,_0x5888ed){return client[_0xa917('0x8')](_0x49ac16,_0x31eb49)[_0xa917('0x9')](function(_0x1b65d3){logger['info'](_0xa917('0xa'),_0x577294,_0xa917('0xb'));logger[_0xa917('0xc')](_0xa917('0xd'),_0x577294,_0xa917('0xb'),JSON[_0xa917('0xe')](_0x1b65d3));if(_0x1b65d3['error']){if(_0x1b65d3[_0xa917('0xf')][_0xa917('0x10')]===0x1f4){logger['error'](_0xa917('0xa'),_0x577294,_0x1b65d3[_0xa917('0xf')][_0xa917('0x11')]);return _0x5888ed(_0x1b65d3[_0xa917('0xf')][_0xa917('0x11')]);}logger[_0xa917('0xf')]('ZohoField,\x20%s,\x20%s',_0x577294,_0x1b65d3['error'][_0xa917('0x11')]);return _0xdfad5d(_0x1b65d3[_0xa917('0xf')][_0xa917('0x11')]);}else{logger[_0xa917('0x12')](_0xa917('0xa'),_0x577294,'request\x20sent');_0xdfad5d(_0x1b65d3[_0xa917('0x13')]['message']);}})['catch'](function(_0x187cc6){logger[_0xa917('0xf')]('ZohoField,\x20%s,\x20%s',_0x577294,_0x187cc6);_0x5888ed(_0x187cc6);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index 8979476..1094a89 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x21711d,_0x3639f4){var _0x45fe48=function(_0x4e5471){while(--_0x4e5471){_0x21711d['push'](_0x21711d['shift']());}};_0x45fe48(++_0x3639f4);}(_0xe706,0xa3));var _0x6e70=function(_0x21bdd1,_0x3f7cd8){_0x21bdd1=_0x21bdd1-0x0;var _0x30514e=_0xe706[_0x21bdd1];return _0x30514e;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x4eeb9a,_0x149571){var _0xa4697b=function(_0x1f59b2){while(--_0x1f59b2){_0x4eeb9a['push'](_0x4eeb9a['shift']());}};_0xa4697b(++_0x149571);}(_0xe706,0xa3));var _0x6e70=function(_0x48291a,_0x5a29dc){_0x48291a=_0x48291a-0x0;var _0xf76871=_0xe706[_0x48291a];return _0xf76871;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index ecbd78a..ce727dd 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 _0x4fd9=['state','sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN'];(function(_0xc18fc4,_0x17c13e){var _0x2c6838=function(_0x42240f){while(--_0x42240f){_0xc18fc4['push'](_0xc18fc4['shift']());}};_0x2c6838(++_0x17c13e);}(_0x4fd9,0xf1));var _0x94fd=function(_0x3e8cae,_0x19212c){_0x3e8cae=_0x3e8cae-0x0;var _0x22f6e9=_0x4fd9[_0x3e8cae];return _0x22f6e9;};'use strict';var Sequelize=require(_0x94fd('0x0'));module[_0x94fd('0x1')]={'name':{'type':Sequelize[_0x94fd('0x2')],'allowNull':![],'unique':_0x94fd('0x3')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x94fd('0x3')},'main':{'type':Sequelize[_0x94fd('0x2')],'defaultValue':_0x94fd('0x4')},'filename':{'type':Sequelize[_0x94fd('0x2')]},'path':{'type':Sequelize[_0x94fd('0x2')]},'type':{'type':Sequelize[_0x94fd('0x2')]},'size':{'type':Sequelize[_0x94fd('0x5')]},'active':{'type':Sequelize[_0x94fd('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0x94fd('0x2')]},'logo':{'type':Sequelize[_0x94fd('0x2')]},'state':{'type':Sequelize[_0x94fd('0x2')],'unique':_0x94fd('0x7')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x94fd('0x2')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file +var _0xddb8=['STRING','unique_name_and_version','app.js','exports'];(function(_0x5a5395,_0x5361f6){var _0x4da43d=function(_0x149941){while(--_0x149941){_0x5a5395['push'](_0x5a5395['shift']());}};_0x4da43d(++_0x5361f6);}(_0xddb8,0xd7));var _0x8ddb=function(_0xaf82f2,_0x5741ef){_0xaf82f2=_0xaf82f2-0x0;var _0x2c9a75=_0xddb8[_0xaf82f2];return _0x2c9a75;};'use strict';var Sequelize=require('sequelize');module[_0x8ddb('0x0')]={'name':{'type':Sequelize[_0x8ddb('0x1')],'allowNull':![],'unique':_0x8ddb('0x2')},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x8ddb('0x2')},'main':{'type':Sequelize[_0x8ddb('0x1')],'defaultValue':_0x8ddb('0x3')},'filename':{'type':Sequelize[_0x8ddb('0x1')]},'path':{'type':Sequelize[_0x8ddb('0x1')]},'type':{'type':Sequelize[_0x8ddb('0x1')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'author':{'type':Sequelize[_0x8ddb('0x1')]},'logo':{'type':Sequelize[_0x8ddb('0x1')]},'state':{'type':Sequelize['STRING'],'unique':'state'},'description':{'type':Sequelize[_0x8ddb('0x1')]},'title':{'type':Sequelize[_0x8ddb('0x1')]},'remoteUri':{'type':Sequelize[_0x8ddb('0x1')]},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 7ffd9af..d4d6bfd 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 _0x4819=['bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','set','Content-Range','apply','reject','update','then','destroy','stack','name','send','map','Integration','rawAttributes','type','key','model','query','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','count','includeAll','include','catch','show','keys','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x4819,0xcd));var _0x9481=function(_0x4bdf64,_0x3022b2){_0x4bdf64=_0x4bdf64-0x0;var _0x9a1a19=_0x4819[_0x4bdf64];return _0x9a1a19;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9481('0x0'));var zipdir=require(_0x9481('0x1'));var jsonpatch=require(_0x9481('0x2'));var rp=require(_0x9481('0x3'));var moment=require(_0x9481('0x4'));var BPromise=require(_0x9481('0x5'));var Mustache=require(_0x9481('0x6'));var util=require(_0x9481('0x7'));var path=require(_0x9481('0x8'));var sox=require(_0x9481('0x9'));var csv=require('to-csv');var ejs=require(_0x9481('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x9481('0xb'));var crypto=require(_0x9481('0xc'));var jsforce=require(_0x9481('0xd'));var deskjs=require(_0x9481('0xe'));var toCsv=require(_0x9481('0xf'));var querystring=require('querystring');var Papa=require(_0x9481('0x10'));var Redis=require('ioredis');var authService=require(_0x9481('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9481('0x12'));var hardwareService=require(_0x9481('0x13'));var logger=require(_0x9481('0x14'))(_0x9481('0x15'));var utils=require(_0x9481('0x16'));var config=require(_0x9481('0x17'));var licenseUtil=require(_0x9481('0x18'));var db=require(_0x9481('0x19'))['db'];function respondWithStatusCode(_0xed8e9,_0x499b87){_0x499b87=_0x499b87||0xcc;return function(_0x5aac02){if(_0x5aac02){return _0xed8e9[_0x9481('0x1a')](_0x499b87);}return _0xed8e9[_0x9481('0x1b')](_0x499b87)[_0x9481('0x1c')]();};}function respondWithResult(_0x28fcb6,_0x3d23c2){_0x3d23c2=_0x3d23c2||0xc8;return function(_0xc7a0b5){if(_0xc7a0b5){return _0x28fcb6[_0x9481('0x1b')](_0x3d23c2)['json'](_0xc7a0b5);}};}function respondWithFilteredResult(_0x4220f1,_0x7a7ee){return function(_0x5b1fe6){if(_0x5b1fe6){var _0x2266d5=typeof _0x7a7ee['offset']===_0x9481('0x1d')&&typeof _0x7a7ee[_0x9481('0x1e')]===_0x9481('0x1d');var _0x2bb2a4=_0x5b1fe6['count'];var _0x5eda66=_0x2266d5?0x0:_0x7a7ee[_0x9481('0x1f')];var _0x50a559=_0x2266d5?_0x5b1fe6['count']:_0x7a7ee[_0x9481('0x1f')]+_0x7a7ee[_0x9481('0x1e')];var _0x18c6f5;if(_0x50a559>=_0x2bb2a4){_0x50a559=_0x2bb2a4;_0x18c6f5=0xc8;}else{_0x18c6f5=0xce;}_0x4220f1[_0x9481('0x1b')](_0x18c6f5);return _0x4220f1[_0x9481('0x20')](_0x9481('0x21'),_0x5eda66+'-'+_0x50a559+'/'+_0x2bb2a4)['json'](_0x5b1fe6);}return null;};}function patchUpdates(_0x2cf1aa){return function(_0x272a84){try{jsonpatch[_0x9481('0x22')](_0x272a84,_0x2cf1aa,!![]);}catch(_0x615e02){return BPromise[_0x9481('0x23')](_0x615e02);}return _0x272a84['save']();};}function saveUpdates(_0x215dd7,_0x294908){return function(_0x572599){if(_0x572599){return _0x572599[_0x9481('0x24')](_0x215dd7)[_0x9481('0x25')](function(_0x352b3a){return _0x352b3a;});}return null;};}function removeEntity(_0x1809d2,_0x2dc02e){return function(_0x49ecfa){if(_0x49ecfa){return _0x49ecfa[_0x9481('0x26')]()[_0x9481('0x25')](function(){_0x1809d2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b0c3,_0x299e28){return function(_0x550fce){if(!_0x550fce){_0x12b0c3[_0x9481('0x1a')](0x194);}return _0x550fce;};}function handleError(_0x20ff9a,_0xeff0a5){_0xeff0a5=_0xeff0a5||0x1f4;return function(_0x28ae1b){logger['error'](_0x28ae1b[_0x9481('0x27')]);if(_0x28ae1b[_0x9481('0x28')]){delete _0x28ae1b[_0x9481('0x28')];}_0x20ff9a['status'](_0xeff0a5)[_0x9481('0x29')](_0x28ae1b);};}exports['index']=function(_0x2e1eff,_0xe153ab){var _0x22ab26={},_0x13ef93={},_0x2e5e63={'count':0x0,'rows':[]};var _0x53560d=_[_0x9481('0x2a')](db[_0x9481('0x2b')][_0x9481('0x2c')],function(_0x4895a0){return{'name':_0x4895a0['fieldName'],'type':_0x4895a0[_0x9481('0x2d')][_0x9481('0x2e')]};});_0x13ef93[_0x9481('0x2f')]=_[_0x9481('0x2a')](_0x53560d,'name');_0x13ef93['query']=_['keys'](_0x2e1eff[_0x9481('0x30')]);_0x13ef93['filters']=_[_0x9481('0x31')](_0x13ef93['model'],_0x13ef93[_0x9481('0x30')]);_0x22ab26[_0x9481('0x32')]=_[_0x9481('0x31')](_0x13ef93[_0x9481('0x2f')],qs[_0x9481('0x33')](_0x2e1eff['query'][_0x9481('0x33')]));_0x22ab26[_0x9481('0x32')]=_0x22ab26[_0x9481('0x32')]['length']?_0x22ab26[_0x9481('0x32')]:_0x13ef93[_0x9481('0x2f')];if(!_0x2e1eff[_0x9481('0x30')][_0x9481('0x34')](_0x9481('0x35'))){_0x22ab26[_0x9481('0x1e')]=qs['limit'](_0x2e1eff[_0x9481('0x30')]['limit']);_0x22ab26[_0x9481('0x1f')]=qs[_0x9481('0x1f')](_0x2e1eff[_0x9481('0x30')][_0x9481('0x1f')]);}_0x22ab26[_0x9481('0x36')]=qs[_0x9481('0x37')](_0x2e1eff['query'][_0x9481('0x37')]);_0x22ab26[_0x9481('0x38')]=qs['filters'](_['pick'](_0x2e1eff[_0x9481('0x30')],_0x13ef93['filters']),_0x53560d);if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]){_0x22ab26[_0x9481('0x38')]=_[_0x9481('0x3a')](_0x22ab26['where'],{'$or':_[_0x9481('0x2a')](_0x53560d,function(_0x590d50){if(_0x590d50[_0x9481('0x2d')]!=='VIRTUAL'){var _0x2ce972={};_0x2ce972[_0x590d50['name']]={'$like':'%'+_0x2e1eff[_0x9481('0x30')][_0x9481('0x39')]+'%'};return _0x2ce972;}})});}_0x22ab26=_[_0x9481('0x3a')]({},_0x22ab26,_0x2e1eff[_0x9481('0x3b')]);var _0x97dc3e={'where':_0x22ab26[_0x9481('0x38')]};return db[_0x9481('0x2b')]['count'](_0x97dc3e)[_0x9481('0x25')](function(_0x3857e8){_0x2e5e63[_0x9481('0x3c')]=_0x3857e8;if(_0x2e1eff[_0x9481('0x30')][_0x9481('0x3d')]){_0x22ab26[_0x9481('0x3e')]=[{'all':!![]}];}return db[_0x9481('0x2b')]['findAll'](_0x22ab26);})[_0x9481('0x25')](function(_0x1872ff){_0x2e5e63['rows']=_0x1872ff;return _0x2e5e63;})[_0x9481('0x25')](respondWithFilteredResult(_0xe153ab,_0x22ab26))[_0x9481('0x3f')](handleError(_0xe153ab,null));};exports[_0x9481('0x40')]=function(_0x3eb9ee,_0x29a8e9){var _0x5a8ffd={'raw':![],'where':{'id':_0x3eb9ee['params']['id']}},_0x304791={};_0x304791[_0x9481('0x2f')]=_[_0x9481('0x41')](db['Integration']['rawAttributes']);_0x304791[_0x9481('0x30')]=_[_0x9481('0x41')](_0x3eb9ee[_0x9481('0x30')]);_0x304791['filters']=_[_0x9481('0x31')](_0x304791[_0x9481('0x2f')],_0x304791['query']);_0x5a8ffd['attributes']=_[_0x9481('0x31')](_0x304791['model'],qs[_0x9481('0x33')](_0x3eb9ee[_0x9481('0x30')][_0x9481('0x33')]));_0x5a8ffd[_0x9481('0x32')]=_0x5a8ffd[_0x9481('0x32')]['length']?_0x5a8ffd[_0x9481('0x32')]:_0x304791[_0x9481('0x2f')];if(_0x3eb9ee['query'][_0x9481('0x3d')]){_0x5a8ffd[_0x9481('0x3e')]=[{'all':!![]}];}_0x5a8ffd=_[_0x9481('0x3a')]({},_0x5a8ffd,_0x3eb9ee[_0x9481('0x3b')]);return db[_0x9481('0x2b')][_0x9481('0x42')](_0x5a8ffd)[_0x9481('0x25')](handleEntityNotFound(_0x29a8e9,null))[_0x9481('0x25')](respondWithResult(_0x29a8e9,null))[_0x9481('0x3f')](handleError(_0x29a8e9,null));};exports['create']=function(_0xd36133,_0x5d3a06){return db['Integration'][_0x9481('0x43')](_0xd36133['body'],{})[_0x9481('0x25')](respondWithResult(_0x5d3a06,0xc9))[_0x9481('0x3f')](handleError(_0x5d3a06,null));};exports['update']=function(_0x277e2a,_0x1044a2){if(_0x277e2a[_0x9481('0x44')]['id']){delete _0x277e2a[_0x9481('0x44')]['id'];}return db[_0x9481('0x2b')][_0x9481('0x42')]({'where':{'id':_0x277e2a['params']['id']}})['then'](handleEntityNotFound(_0x1044a2,null))[_0x9481('0x25')](saveUpdates(_0x277e2a[_0x9481('0x44')],null))[_0x9481('0x25')](respondWithResult(_0x1044a2,null))[_0x9481('0x3f')](handleError(_0x1044a2,null));};exports[_0x9481('0x26')]=function(_0x353aab,_0x1c070c){return db[_0x9481('0x2b')]['find']({'where':{'id':_0x353aab[_0x9481('0x45')]['id']}})[_0x9481('0x25')](handleEntityNotFound(_0x1c070c,null))[_0x9481('0x25')](removeEntity(_0x1c070c,null))[_0x9481('0x3f')](handleError(_0x1c070c,null));}; \ No newline at end of file +var _0x0295=['params','intersection','include','find','create','body','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','Integration','includeAll','rows','catch','show'];(function(_0x43b9af,_0x2c8316){var _0x1df62e=function(_0x2b2e79){while(--_0x2b2e79){_0x43b9af['push'](_0x43b9af['shift']());}};_0x1df62e(++_0x2c8316);}(_0x0295,0x1f0));var _0x5029=function(_0x263204,_0x19286b){_0x263204=_0x263204-0x0;var _0xed3987=_0x0295[_0x263204];return _0xed3987;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];function respondWithStatusCode(_0x2442b2,_0x4cced9){_0x4cced9=_0x4cced9||0xcc;return function(_0x4fa22d){if(_0x4fa22d){return _0x2442b2['sendStatus'](_0x4cced9);}return _0x2442b2['status'](_0x4cced9)[_0x5029('0x15')]();};}function respondWithResult(_0x2e0369,_0x12c237){_0x12c237=_0x12c237||0xc8;return function(_0x434630){if(_0x434630){return _0x2e0369[_0x5029('0x16')](_0x12c237)[_0x5029('0x17')](_0x434630);}};}function respondWithFilteredResult(_0xe278b7,_0x317c20){return function(_0x10bf55){if(_0x10bf55){var _0x326923=typeof _0x317c20[_0x5029('0x18')]===_0x5029('0x19')&&typeof _0x317c20[_0x5029('0x1a')]===_0x5029('0x19');var _0x343918=_0x10bf55['count'];var _0x1ed567=_0x326923?0x0:_0x317c20[_0x5029('0x18')];var _0x35de81=_0x326923?_0x10bf55[_0x5029('0x1b')]:_0x317c20[_0x5029('0x18')]+_0x317c20[_0x5029('0x1a')];var _0xaba461;if(_0x35de81>=_0x343918){_0x35de81=_0x343918;_0xaba461=0xc8;}else{_0xaba461=0xce;}_0xe278b7['status'](_0xaba461);return _0xe278b7[_0x5029('0x1c')]('Content-Range',_0x1ed567+'-'+_0x35de81+'/'+_0x343918)[_0x5029('0x17')](_0x10bf55);}return null;};}function patchUpdates(_0x8a414c){return function(_0x2710aa){try{jsonpatch[_0x5029('0x1d')](_0x2710aa,_0x8a414c,!![]);}catch(_0x4b5854){return BPromise['reject'](_0x4b5854);}return _0x2710aa[_0x5029('0x1e')]();};}function saveUpdates(_0x4a49b6,_0x3f657d){return function(_0x853a34){if(_0x853a34){return _0x853a34[_0x5029('0x1f')](_0x4a49b6)[_0x5029('0x20')](function(_0x16bd22){return _0x16bd22;});}return null;};}function removeEntity(_0x3a3e52,_0x125c26){return function(_0x356dac){if(_0x356dac){return _0x356dac[_0x5029('0x21')]()['then'](function(){_0x3a3e52['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x588d90,_0x45666c){return function(_0x51093c){if(!_0x51093c){_0x588d90['sendStatus'](0x194);}return _0x51093c;};}function handleError(_0x181da0,_0x1e7e61){_0x1e7e61=_0x1e7e61||0x1f4;return function(_0x36d810){logger['error'](_0x36d810[_0x5029('0x22')]);if(_0x36d810[_0x5029('0x23')]){delete _0x36d810['name'];}_0x181da0[_0x5029('0x16')](_0x1e7e61)[_0x5029('0x24')](_0x36d810);};}exports[_0x5029('0x25')]=function(_0x4a24b9,_0x32da06){var _0x251f99={},_0xe5313e={},_0x4b6f92={'count':0x0,'rows':[]};var _0x2cedf6=_[_0x5029('0x26')](db['Integration'][_0x5029('0x27')],function(_0x25032b){return{'name':_0x25032b[_0x5029('0x28')],'type':_0x25032b[_0x5029('0x29')][_0x5029('0x2a')]};});_0xe5313e[_0x5029('0x2b')]=_[_0x5029('0x26')](_0x2cedf6,_0x5029('0x23'));_0xe5313e[_0x5029('0x2c')]=_[_0x5029('0x2d')](_0x4a24b9[_0x5029('0x2c')]);_0xe5313e[_0x5029('0x2e')]=_['intersection'](_0xe5313e[_0x5029('0x2b')],_0xe5313e['query']);_0x251f99[_0x5029('0x2f')]=_['intersection'](_0xe5313e['model'],qs[_0x5029('0x30')](_0x4a24b9[_0x5029('0x2c')][_0x5029('0x30')]));_0x251f99['attributes']=_0x251f99[_0x5029('0x2f')][_0x5029('0x31')]?_0x251f99[_0x5029('0x2f')]:_0xe5313e[_0x5029('0x2b')];if(!_0x4a24b9[_0x5029('0x2c')][_0x5029('0x32')](_0x5029('0x33'))){_0x251f99[_0x5029('0x1a')]=qs[_0x5029('0x1a')](_0x4a24b9['query'][_0x5029('0x1a')]);_0x251f99[_0x5029('0x18')]=qs[_0x5029('0x18')](_0x4a24b9[_0x5029('0x2c')]['offset']);}_0x251f99[_0x5029('0x34')]=qs[_0x5029('0x35')](_0x4a24b9[_0x5029('0x2c')]['sort']);_0x251f99['where']=qs[_0x5029('0x2e')](_[_0x5029('0x36')](_0x4a24b9['query'],_0xe5313e['filters']),_0x2cedf6);if(_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]){_0x251f99[_0x5029('0x38')]=_[_0x5029('0x39')](_0x251f99[_0x5029('0x38')],{'$or':_[_0x5029('0x26')](_0x2cedf6,function(_0x3cb84e){if(_0x3cb84e[_0x5029('0x29')]!==_0x5029('0x3a')){var _0x3effa4={};_0x3effa4[_0x3cb84e[_0x5029('0x23')]]={'$like':'%'+_0x4a24b9[_0x5029('0x2c')][_0x5029('0x37')]+'%'};return _0x3effa4;}})});}_0x251f99=_[_0x5029('0x39')]({},_0x251f99,_0x4a24b9['options']);var _0x57c2b5={'where':_0x251f99[_0x5029('0x38')]};return db[_0x5029('0x3b')][_0x5029('0x1b')](_0x57c2b5)['then'](function(_0x32d8a3){_0x4b6f92[_0x5029('0x1b')]=_0x32d8a3;if(_0x4a24b9['query'][_0x5029('0x3c')]){_0x251f99['include']=[{'all':!![]}];}return db[_0x5029('0x3b')]['findAll'](_0x251f99);})[_0x5029('0x20')](function(_0x359838){_0x4b6f92[_0x5029('0x3d')]=_0x359838;return _0x4b6f92;})[_0x5029('0x20')](respondWithFilteredResult(_0x32da06,_0x251f99))[_0x5029('0x3e')](handleError(_0x32da06,null));};exports[_0x5029('0x3f')]=function(_0x4b2219,_0x1021ea){var _0x2ae047={'raw':![],'where':{'id':_0x4b2219[_0x5029('0x40')]['id']}},_0x5a3e4d={};_0x5a3e4d[_0x5029('0x2b')]=_[_0x5029('0x2d')](db[_0x5029('0x3b')][_0x5029('0x27')]);_0x5a3e4d[_0x5029('0x2c')]=_['keys'](_0x4b2219[_0x5029('0x2c')]);_0x5a3e4d[_0x5029('0x2e')]=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],_0x5a3e4d[_0x5029('0x2c')]);_0x2ae047['attributes']=_[_0x5029('0x41')](_0x5a3e4d[_0x5029('0x2b')],qs[_0x5029('0x30')](_0x4b2219[_0x5029('0x2c')][_0x5029('0x30')]));_0x2ae047[_0x5029('0x2f')]=_0x2ae047[_0x5029('0x2f')][_0x5029('0x31')]?_0x2ae047[_0x5029('0x2f')]:_0x5a3e4d['model'];if(_0x4b2219[_0x5029('0x2c')][_0x5029('0x3c')]){_0x2ae047[_0x5029('0x42')]=[{'all':!![]}];}_0x2ae047=_[_0x5029('0x39')]({},_0x2ae047,_0x4b2219['options']);return db['Integration'][_0x5029('0x43')](_0x2ae047)[_0x5029('0x20')](handleEntityNotFound(_0x1021ea,null))[_0x5029('0x20')](respondWithResult(_0x1021ea,null))[_0x5029('0x3e')](handleError(_0x1021ea,null));};exports[_0x5029('0x44')]=function(_0x3dfc08,_0x2bb7fc){return db[_0x5029('0x3b')][_0x5029('0x44')](_0x3dfc08[_0x5029('0x45')],{})[_0x5029('0x20')](respondWithResult(_0x2bb7fc,0xc9))[_0x5029('0x3e')](handleError(_0x2bb7fc,null));};exports[_0x5029('0x1f')]=function(_0x18f1f5,_0x3168bd){if(_0x18f1f5[_0x5029('0x45')]['id']){delete _0x18f1f5[_0x5029('0x45')]['id'];}return db[_0x5029('0x3b')][_0x5029('0x43')]({'where':{'id':_0x18f1f5[_0x5029('0x40')]['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x3168bd,null))['then'](saveUpdates(_0x18f1f5[_0x5029('0x45')],null))['then'](respondWithResult(_0x3168bd,null))[_0x5029('0x3e')](handleError(_0x3168bd,null));};exports[_0x5029('0x21')]=function(_0x4d788a,_0x5343c6){return db[_0x5029('0x3b')]['find']({'where':{'id':_0x4d788a['params']['id']}})[_0x5029('0x20')](handleEntityNotFound(_0x5343c6,null))[_0x5029('0x20')](removeEntity(_0x5343c6,null))[_0x5029('0x3e')](handleError(_0x5343c6,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index 62ecdb3..c9ad9ee 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 _0xf412=['define','integrations','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./integration.attributes','exports'];(function(_0xc7c59d,_0x57c4c5){var _0x48a06e=function(_0x409e93){while(--_0x409e93){_0xc7c59d['push'](_0xc7c59d['shift']());}};_0x48a06e(++_0x57c4c5);}(_0xf412,0x178));var _0x2f41=function(_0x228a4a,_0x23d65e){_0x228a4a=_0x228a4a-0x0;var _0x3d3937=_0xf412[_0x228a4a];return _0x3d3937;};'use strict';var _=require(_0x2f41('0x0'));var util=require(_0x2f41('0x1'));var logger=require(_0x2f41('0x2'))(_0x2f41('0x3'));var moment=require(_0x2f41('0x4'));var BPromise=require(_0x2f41('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2f41('0x6'));var config=require('../../config/environment');var attributes=require(_0x2f41('0x7'));module[_0x2f41('0x8')]=function(_0x2755f2,_0xd4132d){return _0x2755f2[_0x2f41('0x9')]('Integration',attributes,{'tableName':_0x2f41('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe289=['lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','../../config/environment','./integration.attributes','define','Integration'];(function(_0x3c0fa2,_0x499afd){var _0x22c1e5=function(_0x1d42c9){while(--_0x1d42c9){_0x3c0fa2['push'](_0x3c0fa2['shift']());}};_0x22c1e5(++_0x499afd);}(_0xe289,0x13f));var _0x9e28=function(_0x1d4b04,_0x24d309){_0x1d4b04=_0x1d4b04-0x0;var _0x67d764=_0xe289[_0x1d4b04];return _0x67d764;};'use strict';var _=require(_0x9e28('0x0'));var util=require(_0x9e28('0x1'));var logger=require(_0x9e28('0x2'))('api');var moment=require(_0x9e28('0x3'));var BPromise=require(_0x9e28('0x4'));var rp=require(_0x9e28('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9e28('0x6'));var config=require(_0x9e28('0x7'));var attributes=require(_0x9e28('0x8'));module['exports']=function(_0x54fb94,_0x3eb08f){return _0x54fb94[_0x9e28('0x9')](_0x9e28('0xa'),attributes,{'tableName':'integrations','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 4092577..799660b 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 _0x955f=['Integration,\x20%s,\x20%s','request\x20sent','Integration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','jayson/promise','client','http','request','then','info'];(function(_0x45aa99,_0x1e72a3){var _0x42426a=function(_0x80dd3c){while(--_0x80dd3c){_0x45aa99['push'](_0x45aa99['shift']());}};_0x42426a(++_0x1e72a3);}(_0x955f,0x1eb));var _0xf955=function(_0x100896,_0x5d4587){_0x100896=_0x100896-0x0;var _0x3a9065=_0x955f[_0x100896];return _0x3a9065;};'use strict';var _=require(_0xf955('0x0'));var util=require(_0xf955('0x1'));var moment=require(_0xf955('0x2'));var BPromise=require(_0xf955('0x3'));var rs=require(_0xf955('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf955('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xf955('0x6'));var config=require('../../config/environment');var jayson=require(_0xf955('0x7'));var client=jayson[_0xf955('0x8')][_0xf955('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x59d5b3,_0x18432f,_0x20c096){return new BPromise(function(_0x4f58fb,_0x254b38){return client[_0xf955('0xa')](_0x59d5b3,_0x20c096)[_0xf955('0xb')](function(_0x38b190){logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,_0xf955('0xe'));logger['debug'](_0xf955('0xf'),_0x18432f,'request\x20sent',JSON[_0xf955('0x10')](_0x38b190));if(_0x38b190[_0xf955('0x11')]){if(_0x38b190[_0xf955('0x11')]['code']===0x1f4){logger[_0xf955('0x11')]('Integration,\x20%s,\x20%s',_0x18432f,_0x38b190[_0xf955('0x11')]['message']);return _0x254b38(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);return _0x4f58fb(_0x38b190[_0xf955('0x11')][_0xf955('0x12')]);}else{logger[_0xf955('0xc')](_0xf955('0xd'),_0x18432f,'request\x20sent');_0x4f58fb(_0x38b190[_0xf955('0x13')]['message']);}})[_0xf955('0x14')](function(_0x3a814f){logger[_0xf955('0x11')](_0xf955('0xd'),_0x18432f,_0x3a814f);_0x254b38(_0x3a814f);});});} \ No newline at end of file +var _0x66fa=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','then','info','Integration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Integration,\x20%s,\x20%s','message','catch','lodash'];(function(_0x1b1612,_0x4d2d0a){var _0x31b3ae=function(_0xcf9a65){while(--_0xcf9a65){_0x1b1612['push'](_0x1b1612['shift']());}};_0x31b3ae(++_0x4d2d0a);}(_0x66fa,0x117));var _0xa66f=function(_0x5a8968,_0x5826bc){_0x5a8968=_0x5a8968-0x0;var _0x2a1ea8=_0x66fa[_0x5a8968];return _0x2a1ea8;};'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')]('Integration,\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')]('Integration,\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);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index d561975..3ec35ef 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 _0xd943=['show','post','create','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x8a969d,_0x339d9f){var _0x1d8dc7=function(_0x283ec0){while(--_0x283ec0){_0x8a969d['push'](_0x8a969d['shift']());}};_0x1d8dc7(++_0x339d9f);}(_0xd943,0x15d));var _0x3d94=function(_0x4ac972,_0x415ee3){_0x4ac972=_0x4ac972-0x0;var _0x155ac9=_0xd943[_0x4ac972];return _0x155ac9;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/',auth['isAuthenticated'](),controller[_0x3d94('0xd')]);router['put'](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller['update']);router[_0x3d94('0xf')](_0x3d94('0xe'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);module[_0x3d94('0x11')]=router; \ No newline at end of file +var _0xadb5=['delete','exports','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update'];(function(_0x284b22,_0x1e0f2c){var _0x261e08=function(_0x167b12){while(--_0x167b12){_0x284b22['push'](_0x284b22['shift']());}};_0x261e08(++_0x1e0f2c);}(_0xadb5,0xad));var _0x5adb=function(_0x4755a4,_0x5ac9af){_0x4755a4=_0x4755a4-0x0;var _0x430cf3=_0xadb5[_0x4755a4];return _0x430cf3;};'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('./integrationReport.controller');router[_0x5adb('0x7')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0x9')]);router[_0x5adb('0x7')](_0x5adb('0xa'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xb')]);router[_0x5adb('0x7')](_0x5adb('0xc'),auth[_0x5adb('0x8')](),controller[_0x5adb('0xd')]);router[_0x5adb('0xe')]('/',auth[_0x5adb('0x8')](),controller[_0x5adb('0xf')]);router['put']('/:id',auth[_0x5adb('0x8')](),controller[_0x5adb('0x10')]);router[_0x5adb('0x11')]('/:id',auth[_0x5adb('0x8')](),controller['destroy']);module[_0x5adb('0x12')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1428330..8e5193d 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 _0x701b=['DATE','BOOLEAN','TEXT','ENUM','SENT','SENDING','sequelize','STRING','INTEGER'];(function(_0x577b05,_0x35ec50){var _0x56b309=function(_0x3b604d){while(--_0x3b604d){_0x577b05['push'](_0x577b05['shift']());}};_0x56b309(++_0x35ec50);}(_0x701b,0x138));var _0xb701=function(_0x1ae3f5,_0x188c40){_0x1ae3f5=_0x1ae3f5-0x0;var _0x108ebd=_0x701b[_0x1ae3f5];return _0x108ebd;};'use strict';var Sequelize=require(_0xb701('0x0'));module['exports']={'integration':{'type':Sequelize[_0xb701('0x1')]},'eventChannel':{'type':Sequelize[_0xb701('0x1')]},'exitStatus':{'type':Sequelize[_0xb701('0x1')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0xb701('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xb701('0x1')]},'calleridnum':{'type':Sequelize[_0xb701('0x1')]},'calleridname':{'type':Sequelize[_0xb701('0x1')]},'queue':{'type':Sequelize[_0xb701('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb701('0x1')]},'agentcalledAt':{'type':Sequelize[_0xb701('0x3')]},'agentconnectAt':{'type':Sequelize[_0xb701('0x3')]},'holdtime':{'type':Sequelize[_0xb701('0x2')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xb701('0x3')]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0xb701('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xb701('0x1')]},'agentringnoanswer':{'type':Sequelize[_0xb701('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xb701('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xb701('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb701('0x1')]},'channelstate':{'type':Sequelize[_0xb701('0x2')]},'channelstatedesc':{'type':Sequelize[_0xb701('0x1')]},'connectedlinenum':{'type':Sequelize[_0xb701('0x1')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xb701('0x1')]},'accountcode':{'type':Sequelize[_0xb701('0x1')]},'context':{'type':Sequelize[_0xb701('0x1')]},'exten':{'type':Sequelize[_0xb701('0x1')]},'priority':{'type':Sequelize[_0xb701('0x1')]},'destchannel':{'type':Sequelize['STRING']},'destchannelstate':{'type':Sequelize[_0xb701('0x2')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xb701('0x1')]},'destcalleridname':{'type':Sequelize[_0xb701('0x1')]},'destconnectedlinenum':{'type':Sequelize[_0xb701('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xb701('0x1')]},'destlanguage':{'type':Sequelize[_0xb701('0x1')]},'destaccountcode':{'type':Sequelize[_0xb701('0x1')]},'destcontext':{'type':Sequelize[_0xb701('0x1')]},'destexten':{'type':Sequelize[_0xb701('0x1')]},'destpriority':{'type':Sequelize[_0xb701('0x1')]},'destuniqueid':{'type':Sequelize[_0xb701('0x1')]},'messageId':{'type':Sequelize[_0xb701('0x1')]},'inReplyTo':{'type':Sequelize[_0xb701('0x1')]},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize[_0xb701('0x1')]},'to':{'type':Sequelize[_0xb701('0x1')]},'cc':{'type':Sequelize['STRING']},'attachment':{'type':Sequelize[_0xb701('0x5')]},'html':{'type':Sequelize[_0xb701('0x5')]},'text':{'type':Sequelize[_0xb701('0x5')]},'status':{'type':Sequelize[_0xb701('0x6')](_0xb701('0x7'),_0xb701('0x8'),'RECEIVED','FAILED')},'url':{'type':Sequelize[_0xb701('0x1')]},'app':{'type':Sequelize[_0xb701('0x1')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0xb701('0x2')]}}; \ No newline at end of file +var _0xe5c3=['RECEIVED','FAILED','sequelize','exports','STRING','INTEGER','DATE','BOOLEAN','TEXT','ENUM'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xe5c3,0x138));var _0x3e5c=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0xe5c3[_0x411add];return _0x238242;};'use strict';var Sequelize=require(_0x3e5c('0x0'));module[_0x3e5c('0x1')]={'integration':{'type':Sequelize[_0x3e5c('0x2')]},'eventChannel':{'type':Sequelize[_0x3e5c('0x2')]},'exitStatus':{'type':Sequelize[_0x3e5c('0x2')]},'ticketId':{'type':Sequelize['STRING']},'integrationId':{'type':Sequelize[_0x3e5c('0x3')]},'contacts':{'type':Sequelize[_0x3e5c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x3e5c('0x2')]},'interface':{'type':Sequelize[_0x3e5c('0x2')]},'membername':{'type':Sequelize[_0x3e5c('0x2')]},'agentcalledAt':{'type':Sequelize[_0x3e5c('0x4')]},'agentconnectAt':{'type':Sequelize[_0x3e5c('0x4')]},'holdtime':{'type':Sequelize[_0x3e5c('0x3')]},'agentcomplete':{'type':Sequelize[_0x3e5c('0x5')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0x3e5c('0x4')]},'talktime':{'type':Sequelize[_0x3e5c('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x3e5c('0x2')]},'agentringnoanswer':{'type':Sequelize[_0x3e5c('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0x3e5c('0x4')]},'agentdump':{'type':Sequelize[_0x3e5c('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0x3e5c('0x4')]},'lastevent':{'type':Sequelize[_0x3e5c('0x2')]},'channel':{'type':Sequelize[_0x3e5c('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x3e5c('0x2')]},'connectedlinenum':{'type':Sequelize[_0x3e5c('0x2')]},'connectedlinename':{'type':Sequelize[_0x3e5c('0x2')]},'language':{'type':Sequelize[_0x3e5c('0x2')]},'accountcode':{'type':Sequelize[_0x3e5c('0x2')]},'context':{'type':Sequelize[_0x3e5c('0x2')]},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0x3e5c('0x2')]},'destchannel':{'type':Sequelize[_0x3e5c('0x2')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize[_0x3e5c('0x2')]},'destcalleridnum':{'type':Sequelize[_0x3e5c('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x3e5c('0x2')]},'destaccountcode':{'type':Sequelize[_0x3e5c('0x2')]},'destcontext':{'type':Sequelize[_0x3e5c('0x2')]},'destexten':{'type':Sequelize[_0x3e5c('0x2')]},'destpriority':{'type':Sequelize[_0x3e5c('0x2')]},'destuniqueid':{'type':Sequelize[_0x3e5c('0x2')]},'messageId':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize[_0x3e5c('0x2')]},'from':{'type':Sequelize[_0x3e5c('0x2')]},'to':{'type':Sequelize[_0x3e5c('0x2')]},'cc':{'type':Sequelize[_0x3e5c('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0x3e5c('0x6')]},'text':{'type':Sequelize['TEXT']},'status':{'type':Sequelize[_0x3e5c('0x7')]('SENT','SENDING',_0x3e5c('0x8'),_0x3e5c('0x9'))},'url':{'type':Sequelize['STRING']},'app':{'type':Sequelize[_0x3e5c('0x2')]},'appdata':{'type':Sequelize['STRING']},'projectId':{'type':Sequelize[_0x3e5c('0x3')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index a1c0698..b929aa2 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 _0xabee=['ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','merge','type','VIRTUAL','filter','options','rows','show','params','includeAll','include','catch','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse'];(function(_0x37793a,_0xa99768){var _0x179714=function(_0x2f362c){while(--_0x2f362c){_0x37793a['push'](_0x37793a['shift']());}};_0x179714(++_0xa99768);}(_0xabee,0x11d));var _0xeabe=function(_0x3b5b3b,_0x9bfdca){_0x3b5b3b=_0x3b5b3b-0x0;var _0x196616=_0xabee[_0x3b5b3b];return _0x196616;};'use strict';var emlformat=require(_0xeabe('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xeabe('0x1'));var jsonpatch=require(_0xeabe('0x2'));var rp=require(_0xeabe('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xeabe('0x4'));var util=require(_0xeabe('0x5'));var path=require(_0xeabe('0x6'));var sox=require(_0xeabe('0x7'));var csv=require(_0xeabe('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xeabe('0x9'));var _=require('lodash');var squel=require(_0xeabe('0xa'));var crypto=require(_0xeabe('0xb'));var jsforce=require(_0xeabe('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xeabe('0x8'));var querystring=require(_0xeabe('0xd'));var Papa=require(_0xeabe('0xe'));var Redis=require(_0xeabe('0xf'));var authService=require(_0xeabe('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xeabe('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xeabe('0x12'))(_0xeabe('0x13'));var utils=require('../../config/utils');var config=require(_0xeabe('0x14'));var licenseUtil=require(_0xeabe('0x15'));var db=require(_0xeabe('0x16'))['db'];function respondWithStatusCode(_0x55d054,_0x74e34c){_0x74e34c=_0x74e34c||0xcc;return function(_0x116e1d){if(_0x116e1d){return _0x55d054['sendStatus'](_0x74e34c);}return _0x55d054[_0xeabe('0x17')](_0x74e34c)[_0xeabe('0x18')]();};}function respondWithResult(_0x2077e5,_0x1b858c){_0x1b858c=_0x1b858c||0xc8;return function(_0x53ebfc){if(_0x53ebfc){return _0x2077e5[_0xeabe('0x17')](_0x1b858c)[_0xeabe('0x19')](_0x53ebfc);}};}function respondWithFilteredResult(_0x3e5492,_0x8228f0){return function(_0x2e0761){if(_0x2e0761){var _0x46f4cf=typeof _0x8228f0['offset']==='undefined'&&typeof _0x8228f0[_0xeabe('0x1a')]===_0xeabe('0x1b');var _0x49a3b0=_0x2e0761[_0xeabe('0x1c')];var _0xf8080d=_0x46f4cf?0x0:_0x8228f0[_0xeabe('0x1d')];var _0x5bfa70=_0x46f4cf?_0x2e0761[_0xeabe('0x1c')]:_0x8228f0['offset']+_0x8228f0[_0xeabe('0x1a')];var _0x2d88dd;if(_0x5bfa70>=_0x49a3b0){_0x5bfa70=_0x49a3b0;_0x2d88dd=0xc8;}else{_0x2d88dd=0xce;}_0x3e5492['status'](_0x2d88dd);return _0x3e5492[_0xeabe('0x1e')](_0xeabe('0x1f'),_0xf8080d+'-'+_0x5bfa70+'/'+_0x49a3b0)[_0xeabe('0x19')](_0x2e0761);}return null;};}function patchUpdates(_0x1d9882){return function(_0x3073a4){try{jsonpatch[_0xeabe('0x20')](_0x3073a4,_0x1d9882,!![]);}catch(_0x11ab67){return BPromise[_0xeabe('0x21')](_0x11ab67);}return _0x3073a4[_0xeabe('0x22')]();};}function saveUpdates(_0x5c3094,_0x16b28d){return function(_0x2eb3d3){if(_0x2eb3d3){return _0x2eb3d3[_0xeabe('0x23')](_0x5c3094)[_0xeabe('0x24')](function(_0x54edbe){return _0x54edbe;});}return null;};}function removeEntity(_0x2a1b0b,_0x53ad3f){return function(_0x3afd04){if(_0x3afd04){return _0x3afd04[_0xeabe('0x25')]()['then'](function(){_0x2a1b0b[_0xeabe('0x17')](0xcc)[_0xeabe('0x18')]();});}};}function handleEntityNotFound(_0x12f354,_0x5d2ed3){return function(_0x37b47f){if(!_0x37b47f){_0x12f354[_0xeabe('0x26')](0x194);}return _0x37b47f;};}function handleError(_0x2fc0c6,_0x30193d){_0x30193d=_0x30193d||0x1f4;return function(_0x2eeeb9){logger['error'](_0x2eeeb9[_0xeabe('0x27')]);if(_0x2eeeb9[_0xeabe('0x28')]){delete _0x2eeeb9['name'];}_0x2fc0c6['status'](_0x30193d)[_0xeabe('0x29')](_0x2eeeb9);};}exports[_0xeabe('0x2a')]=function(_0x52625b,_0xb37931){var _0x5ab3c3={},_0x37f0a3={},_0x62c839={'count':0x0,'rows':[]};var _0x463b3d=_[_0xeabe('0x2b')](db[_0xeabe('0x2c')][_0xeabe('0x2d')],function(_0x180f9b){return{'name':_0x180f9b[_0xeabe('0x2e')],'type':_0x180f9b['type'][_0xeabe('0x2f')]};});_0x37f0a3[_0xeabe('0x30')]=_[_0xeabe('0x2b')](_0x463b3d,_0xeabe('0x28'));_0x37f0a3[_0xeabe('0x31')]=_[_0xeabe('0x32')](_0x52625b[_0xeabe('0x31')]);_0x37f0a3[_0xeabe('0x33')]=_[_0xeabe('0x34')](_0x37f0a3[_0xeabe('0x30')],_0x37f0a3[_0xeabe('0x31')]);_0x5ab3c3[_0xeabe('0x35')]=_[_0xeabe('0x34')](_0x37f0a3['model'],qs[_0xeabe('0x36')](_0x52625b[_0xeabe('0x31')]['fields']));_0x5ab3c3['attributes']=_0x5ab3c3['attributes'][_0xeabe('0x37')]?_0x5ab3c3[_0xeabe('0x35')]:_0x37f0a3[_0xeabe('0x30')];if(!_0x52625b[_0xeabe('0x31')][_0xeabe('0x38')](_0xeabe('0x39'))){_0x5ab3c3[_0xeabe('0x1a')]=qs[_0xeabe('0x1a')](_0x52625b[_0xeabe('0x31')][_0xeabe('0x1a')]);_0x5ab3c3[_0xeabe('0x1d')]=qs[_0xeabe('0x1d')](_0x52625b[_0xeabe('0x31')]['offset']);}_0x5ab3c3[_0xeabe('0x3a')]=qs['sort'](_0x52625b['query']['sort']);_0x5ab3c3[_0xeabe('0x3b')]=qs[_0xeabe('0x33')](_['pick'](_0x52625b[_0xeabe('0x31')],_0x37f0a3[_0xeabe('0x33')]),_0x463b3d);if(_0x52625b[_0xeabe('0x31')]['filter']){_0x5ab3c3[_0xeabe('0x3b')]=_[_0xeabe('0x3c')](_0x5ab3c3[_0xeabe('0x3b')],{'$or':_[_0xeabe('0x2b')](_0x463b3d,function(_0x365734){if(_0x365734[_0xeabe('0x3d')]!==_0xeabe('0x3e')){var _0x25fd69={};_0x25fd69[_0x365734[_0xeabe('0x28')]]={'$like':'%'+_0x52625b['query'][_0xeabe('0x3f')]+'%'};return _0x25fd69;}})});}_0x5ab3c3=_[_0xeabe('0x3c')]({},_0x5ab3c3,_0x52625b[_0xeabe('0x40')]);var _0x3c585a={'where':_0x5ab3c3[_0xeabe('0x3b')]};return db[_0xeabe('0x2c')][_0xeabe('0x1c')](_0x3c585a)[_0xeabe('0x24')](function(_0x4c323e){_0x62c839[_0xeabe('0x1c')]=_0x4c323e;if(_0x52625b[_0xeabe('0x31')]['includeAll']){_0x5ab3c3['include']=[{'all':!![]}];}return db['IntegrationReport']['findAll'](_0x5ab3c3);})[_0xeabe('0x24')](function(_0x4002d8){_0x62c839[_0xeabe('0x41')]=_0x4002d8;return _0x62c839;})[_0xeabe('0x24')](respondWithFilteredResult(_0xb37931,_0x5ab3c3))['catch'](handleError(_0xb37931,null));};exports[_0xeabe('0x42')]=function(_0x40903b,_0x485356){var _0x2acd25={'raw':![],'where':{'id':_0x40903b[_0xeabe('0x43')]['id']}},_0x2bf80f={};_0x2bf80f['model']=_['keys'](db[_0xeabe('0x2c')][_0xeabe('0x2d')]);_0x2bf80f['query']=_[_0xeabe('0x32')](_0x40903b[_0xeabe('0x31')]);_0x2bf80f[_0xeabe('0x33')]=_[_0xeabe('0x34')](_0x2bf80f[_0xeabe('0x30')],_0x2bf80f[_0xeabe('0x31')]);_0x2acd25[_0xeabe('0x35')]=_[_0xeabe('0x34')](_0x2bf80f[_0xeabe('0x30')],qs[_0xeabe('0x36')](_0x40903b['query'][_0xeabe('0x36')]));_0x2acd25['attributes']=_0x2acd25[_0xeabe('0x35')]['length']?_0x2acd25['attributes']:_0x2bf80f['model'];if(_0x40903b[_0xeabe('0x31')][_0xeabe('0x44')]){_0x2acd25[_0xeabe('0x45')]=[{'all':!![]}];}_0x2acd25=_['merge']({},_0x2acd25,_0x40903b[_0xeabe('0x40')]);return db['IntegrationReport']['find'](_0x2acd25)['then'](handleEntityNotFound(_0x485356,null))['then'](respondWithResult(_0x485356,null))[_0xeabe('0x46')](handleError(_0x485356,null));};exports[_0xeabe('0x47')]=function(_0x1f6fdd,_0x1ea379){return db['IntegrationReport']['create'](_0x1f6fdd[_0xeabe('0x48')],{})[_0xeabe('0x24')](respondWithResult(_0x1ea379,0xc9))[_0xeabe('0x46')](handleError(_0x1ea379,null));};exports[_0xeabe('0x23')]=function(_0xe7def0,_0x4eee3c){if(_0xe7def0[_0xeabe('0x48')]['id']){delete _0xe7def0[_0xeabe('0x48')]['id'];}return db[_0xeabe('0x2c')][_0xeabe('0x49')]({'where':{'id':_0xe7def0[_0xeabe('0x43')]['id']}})['then'](handleEntityNotFound(_0x4eee3c,null))[_0xeabe('0x24')](saveUpdates(_0xe7def0[_0xeabe('0x48')],null))[_0xeabe('0x24')](respondWithResult(_0x4eee3c,null))[_0xeabe('0x46')](handleError(_0x4eee3c,null));};exports[_0xeabe('0x25')]=function(_0x3191f5,_0x1298ce){return db[_0xeabe('0x2c')][_0xeabe('0x49')]({'where':{'id':_0x3191f5[_0xeabe('0x43')]['id']}})['then'](handleEntityNotFound(_0x1298ce,null))['then'](removeEntity(_0x1298ce,null))[_0xeabe('0x46')](handleError(_0x1298ce,null));};exports[_0xeabe('0x4a')]=function(_0x3746b4,_0x33d683){return db[_0xeabe('0x2c')]['describe']()['then'](respondWithResult(_0x33d683,null))['catch'](handleError(_0x33d683,null));}; \ No newline at end of file +var _0x1a49=['save','update','then','destroy','error','stack','name','send','index','map','IntegrationReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','include','findAll','catch','show','params','length','includeAll','find','create','body','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','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject'];(function(_0x305efe,_0x330908){var _0x9d93d=function(_0x26a38f){while(--_0x26a38f){_0x305efe['push'](_0x305efe['shift']());}};_0x9d93d(++_0x330908);}(_0x1a49,0xc5));var _0x91a4=function(_0x29ad8a,_0x332c09){_0x29ad8a=_0x29ad8a-0x0;var _0x25154c=_0x1a49[_0x29ad8a];return _0x25154c;};'use strict';var emlformat=require(_0x91a4('0x0'));var rimraf=require(_0x91a4('0x1'));var zipdir=require(_0x91a4('0x2'));var jsonpatch=require(_0x91a4('0x3'));var rp=require(_0x91a4('0x4'));var moment=require(_0x91a4('0x5'));var BPromise=require(_0x91a4('0x6'));var Mustache=require(_0x91a4('0x7'));var util=require(_0x91a4('0x8'));var path=require(_0x91a4('0x9'));var sox=require(_0x91a4('0xa'));var csv=require(_0x91a4('0xb'));var ejs=require(_0x91a4('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x91a4('0xd'));var crypto=require(_0x91a4('0xe'));var jsforce=require(_0x91a4('0xf'));var deskjs=require(_0x91a4('0x10'));var toCsv=require(_0x91a4('0xb'));var querystring=require(_0x91a4('0x11'));var Papa=require(_0x91a4('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x91a4('0x13'));var as=require(_0x91a4('0x14'));var hardwareService=require(_0x91a4('0x15'));var logger=require('../../config/logger')(_0x91a4('0x16'));var utils=require(_0x91a4('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x91a4('0x18'))['db'];function respondWithStatusCode(_0x5d755e,_0x43a6d2){_0x43a6d2=_0x43a6d2||0xcc;return function(_0x23888c){if(_0x23888c){return _0x5d755e[_0x91a4('0x19')](_0x43a6d2);}return _0x5d755e[_0x91a4('0x1a')](_0x43a6d2)[_0x91a4('0x1b')]();};}function respondWithResult(_0x520010,_0x5d269b){_0x5d269b=_0x5d269b||0xc8;return function(_0x2ccba4){if(_0x2ccba4){return _0x520010[_0x91a4('0x1a')](_0x5d269b)[_0x91a4('0x1c')](_0x2ccba4);}};}function respondWithFilteredResult(_0x5f78bb,_0x516acc){return function(_0x647da6){if(_0x647da6){var _0x3a09b1=typeof _0x516acc['offset']==='undefined'&&typeof _0x516acc['limit']===_0x91a4('0x1d');var _0xe945d2=_0x647da6[_0x91a4('0x1e')];var _0x194079=_0x3a09b1?0x0:_0x516acc[_0x91a4('0x1f')];var _0x15f34e=_0x3a09b1?_0x647da6[_0x91a4('0x1e')]:_0x516acc[_0x91a4('0x1f')]+_0x516acc[_0x91a4('0x20')];var _0x4ae4f0;if(_0x15f34e>=_0xe945d2){_0x15f34e=_0xe945d2;_0x4ae4f0=0xc8;}else{_0x4ae4f0=0xce;}_0x5f78bb[_0x91a4('0x1a')](_0x4ae4f0);return _0x5f78bb[_0x91a4('0x21')](_0x91a4('0x22'),_0x194079+'-'+_0x15f34e+'/'+_0xe945d2)[_0x91a4('0x1c')](_0x647da6);}return null;};}function patchUpdates(_0x1a68a5){return function(_0x9ab2f3){try{jsonpatch[_0x91a4('0x23')](_0x9ab2f3,_0x1a68a5,!![]);}catch(_0x1a02fe){return BPromise[_0x91a4('0x24')](_0x1a02fe);}return _0x9ab2f3[_0x91a4('0x25')]();};}function saveUpdates(_0xed51f6,_0x5035e4){return function(_0x39fbc3){if(_0x39fbc3){return _0x39fbc3[_0x91a4('0x26')](_0xed51f6)[_0x91a4('0x27')](function(_0x226c18){return _0x226c18;});}return null;};}function removeEntity(_0x42ffa8,_0x56e3f2){return function(_0x38f864){if(_0x38f864){return _0x38f864[_0x91a4('0x28')]()['then'](function(){_0x42ffa8[_0x91a4('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7ce91e,_0x2f5c1f){return function(_0x402aa0){if(!_0x402aa0){_0x7ce91e[_0x91a4('0x19')](0x194);}return _0x402aa0;};}function handleError(_0xf78d88,_0x10372f){_0x10372f=_0x10372f||0x1f4;return function(_0x221e7d){logger[_0x91a4('0x29')](_0x221e7d[_0x91a4('0x2a')]);if(_0x221e7d[_0x91a4('0x2b')]){delete _0x221e7d[_0x91a4('0x2b')];}_0xf78d88[_0x91a4('0x1a')](_0x10372f)[_0x91a4('0x2c')](_0x221e7d);};}exports[_0x91a4('0x2d')]=function(_0x532fc3,_0x190fb3){var _0x23b1ca={},_0x287165={},_0x23fca0={'count':0x0,'rows':[]};var _0x376c49=_[_0x91a4('0x2e')](db[_0x91a4('0x2f')][_0x91a4('0x30')],function(_0x3eb7ed){return{'name':_0x3eb7ed[_0x91a4('0x31')],'type':_0x3eb7ed[_0x91a4('0x32')][_0x91a4('0x33')]};});_0x287165[_0x91a4('0x34')]=_[_0x91a4('0x2e')](_0x376c49,_0x91a4('0x2b'));_0x287165[_0x91a4('0x35')]=_[_0x91a4('0x36')](_0x532fc3[_0x91a4('0x35')]);_0x287165[_0x91a4('0x37')]=_[_0x91a4('0x38')](_0x287165[_0x91a4('0x34')],_0x287165[_0x91a4('0x35')]);_0x23b1ca[_0x91a4('0x39')]=_[_0x91a4('0x38')](_0x287165['model'],qs[_0x91a4('0x3a')](_0x532fc3['query'][_0x91a4('0x3a')]));_0x23b1ca[_0x91a4('0x39')]=_0x23b1ca[_0x91a4('0x39')]['length']?_0x23b1ca[_0x91a4('0x39')]:_0x287165[_0x91a4('0x34')];if(!_0x532fc3[_0x91a4('0x35')][_0x91a4('0x3b')](_0x91a4('0x3c'))){_0x23b1ca['limit']=qs[_0x91a4('0x20')](_0x532fc3[_0x91a4('0x35')]['limit']);_0x23b1ca[_0x91a4('0x1f')]=qs[_0x91a4('0x1f')](_0x532fc3[_0x91a4('0x35')][_0x91a4('0x1f')]);}_0x23b1ca['order']=qs['sort'](_0x532fc3[_0x91a4('0x35')][_0x91a4('0x3d')]);_0x23b1ca[_0x91a4('0x3e')]=qs[_0x91a4('0x37')](_[_0x91a4('0x3f')](_0x532fc3[_0x91a4('0x35')],_0x287165[_0x91a4('0x37')]),_0x376c49);if(_0x532fc3['query']['filter']){_0x23b1ca[_0x91a4('0x3e')]=_['merge'](_0x23b1ca['where'],{'$or':_[_0x91a4('0x2e')](_0x376c49,function(_0x37b349){if(_0x37b349[_0x91a4('0x32')]!=='VIRTUAL'){var _0x297c05={};_0x297c05[_0x37b349[_0x91a4('0x2b')]]={'$like':'%'+_0x532fc3[_0x91a4('0x35')][_0x91a4('0x40')]+'%'};return _0x297c05;}})});}_0x23b1ca=_[_0x91a4('0x41')]({},_0x23b1ca,_0x532fc3[_0x91a4('0x42')]);var _0x499d12={'where':_0x23b1ca['where']};return db[_0x91a4('0x2f')][_0x91a4('0x1e')](_0x499d12)[_0x91a4('0x27')](function(_0x3047f4){_0x23fca0[_0x91a4('0x1e')]=_0x3047f4;if(_0x532fc3[_0x91a4('0x35')]['includeAll']){_0x23b1ca[_0x91a4('0x43')]=[{'all':!![]}];}return db[_0x91a4('0x2f')][_0x91a4('0x44')](_0x23b1ca);})[_0x91a4('0x27')](function(_0x19c721){_0x23fca0['rows']=_0x19c721;return _0x23fca0;})['then'](respondWithFilteredResult(_0x190fb3,_0x23b1ca))[_0x91a4('0x45')](handleError(_0x190fb3,null));};exports[_0x91a4('0x46')]=function(_0x2fc937,_0x5cea61){var _0x49fda0={'raw':![],'where':{'id':_0x2fc937[_0x91a4('0x47')]['id']}},_0x4ddfa0={};_0x4ddfa0[_0x91a4('0x34')]=_[_0x91a4('0x36')](db['IntegrationReport'][_0x91a4('0x30')]);_0x4ddfa0[_0x91a4('0x35')]=_[_0x91a4('0x36')](_0x2fc937['query']);_0x4ddfa0[_0x91a4('0x37')]=_[_0x91a4('0x38')](_0x4ddfa0['model'],_0x4ddfa0['query']);_0x49fda0['attributes']=_[_0x91a4('0x38')](_0x4ddfa0['model'],qs[_0x91a4('0x3a')](_0x2fc937[_0x91a4('0x35')][_0x91a4('0x3a')]));_0x49fda0[_0x91a4('0x39')]=_0x49fda0[_0x91a4('0x39')][_0x91a4('0x48')]?_0x49fda0[_0x91a4('0x39')]:_0x4ddfa0[_0x91a4('0x34')];if(_0x2fc937['query'][_0x91a4('0x49')]){_0x49fda0[_0x91a4('0x43')]=[{'all':!![]}];}_0x49fda0=_[_0x91a4('0x41')]({},_0x49fda0,_0x2fc937['options']);return db[_0x91a4('0x2f')][_0x91a4('0x4a')](_0x49fda0)[_0x91a4('0x27')](handleEntityNotFound(_0x5cea61,null))['then'](respondWithResult(_0x5cea61,null))[_0x91a4('0x45')](handleError(_0x5cea61,null));};exports['create']=function(_0xc6bc24,_0x24fdd4){return db[_0x91a4('0x2f')][_0x91a4('0x4b')](_0xc6bc24[_0x91a4('0x4c')],{})[_0x91a4('0x27')](respondWithResult(_0x24fdd4,0xc9))[_0x91a4('0x45')](handleError(_0x24fdd4,null));};exports[_0x91a4('0x26')]=function(_0xb0b4fe,_0x45a8d0){if(_0xb0b4fe[_0x91a4('0x4c')]['id']){delete _0xb0b4fe[_0x91a4('0x4c')]['id'];}return db[_0x91a4('0x2f')][_0x91a4('0x4a')]({'where':{'id':_0xb0b4fe[_0x91a4('0x47')]['id']}})[_0x91a4('0x27')](handleEntityNotFound(_0x45a8d0,null))[_0x91a4('0x27')](saveUpdates(_0xb0b4fe[_0x91a4('0x4c')],null))[_0x91a4('0x27')](respondWithResult(_0x45a8d0,null))[_0x91a4('0x45')](handleError(_0x45a8d0,null));};exports[_0x91a4('0x28')]=function(_0x52ca61,_0x4fc89b){return db[_0x91a4('0x2f')][_0x91a4('0x4a')]({'where':{'id':_0x52ca61[_0x91a4('0x47')]['id']}})[_0x91a4('0x27')](handleEntityNotFound(_0x4fc89b,null))['then'](removeEntity(_0x4fc89b,null))[_0x91a4('0x45')](handleError(_0x4fc89b,null));};exports[_0x91a4('0x4d')]=function(_0x313293,_0x240954){return db[_0x91a4('0x2f')][_0x91a4('0x4d')]()[_0x91a4('0x27')](respondWithResult(_0x240954,null))[_0x91a4('0x45')](handleError(_0x240954,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 7d1d98b..aaf8d9b 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 _0x8076=['./integrationReport.attributes','exports','define','IntegrationReport','report_integration','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x5d1044,_0x18f656){var _0x3cd90e=function(_0x3c40be){while(--_0x3c40be){_0x5d1044['push'](_0x5d1044['shift']());}};_0x3cd90e(++_0x18f656);}(_0x8076,0xae));var _0x6807=function(_0x2fafd4,_0x14d120){_0x2fafd4=_0x2fafd4-0x0;var _0x427e4a=_0x8076[_0x2fafd4];return _0x427e4a;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x6807('0x0'))(_0x6807('0x1'));var moment=require(_0x6807('0x2'));var BPromise=require(_0x6807('0x3'));var rp=require(_0x6807('0x4'));var fs=require('fs');var path=require(_0x6807('0x5'));var rimraf=require(_0x6807('0x6'));var config=require(_0x6807('0x7'));var attributes=require(_0x6807('0x8'));module[_0x6807('0x9')]=function(_0x3f9bbe,_0x39dd7e){return _0x3f9bbe[_0x6807('0xa')](_0x6807('0xb'),attributes,{'tableName':_0x6807('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1a08=['define','IntegrationReport','report_integration','util','api','moment','bluebird','path','rimraf','exports'];(function(_0x692857,_0x3aa85c){var _0x3a70b6=function(_0x3be7f1){while(--_0x3be7f1){_0x692857['push'](_0x692857['shift']());}};_0x3a70b6(++_0x3aa85c);}(_0x1a08,0x1a7));var _0x81a0=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0x1a08[_0x266618];return _0x54dbf5;};'use strict';var _=require('lodash');var util=require(_0x81a0('0x0'));var logger=require('../../config/logger')(_0x81a0('0x1'));var moment=require(_0x81a0('0x2'));var BPromise=require(_0x81a0('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x81a0('0x4'));var rimraf=require(_0x81a0('0x5'));var config=require('../../config/environment');var attributes=require('./integrationReport.attributes');module[_0x81a0('0x6')]=function(_0x90343,_0x4391cb){return _0x90343[_0x81a0('0x7')](_0x81a0('0x8'),attributes,{'tableName':_0x81a0('0x9'),'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 5037366..d17f364 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 _0x2542=['info','IntegrationReport,\x20%s,\x20%s','debug','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x1329a5,_0x149bf0){var _0xc2a7ad=function(_0x1b816d){while(--_0x1b816d){_0x1329a5['push'](_0x1329a5['shift']());}};_0xc2a7ad(++_0x149bf0);}(_0x2542,0x169));var _0x2254=function(_0x52dbd7,_0x3f3f61){_0x52dbd7=_0x52dbd7-0x0;var _0x422fe7=_0x2542[_0x52dbd7];return _0x422fe7;};'use strict';var _=require(_0x2254('0x0'));var util=require(_0x2254('0x1'));var moment=require(_0x2254('0x2'));var BPromise=require(_0x2254('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2254('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x2254('0x5'));var logger=require(_0x2254('0x6'))(_0x2254('0x7'));var config=require(_0x2254('0x8'));var jayson=require(_0x2254('0x9'));var client=jayson['client'][_0x2254('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xe8ca50,_0x2ee7ee,_0x3c45ec){return new BPromise(function(_0x1637ad,_0x477b47){return client[_0x2254('0xb')](_0xe8ca50,_0x3c45ec)[_0x2254('0xc')](function(_0xb395da){logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,'request\x20sent');logger[_0x2254('0xf')](_0x2254('0x10'),_0x2ee7ee,_0x2254('0x11'),JSON[_0x2254('0x12')](_0xb395da));if(_0xb395da['error']){if(_0xb395da['error'][_0x2254('0x13')]===0x1f4){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);return _0x477b47(_0xb395da[_0x2254('0x14')]['message']);}logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0xb395da['error'][_0x2254('0x15')]);return _0x1637ad(_0xb395da[_0x2254('0x14')][_0x2254('0x15')]);}else{logger[_0x2254('0xd')](_0x2254('0xe'),_0x2ee7ee,_0x2254('0x11'));_0x1637ad(_0xb395da['result'][_0x2254('0x15')]);}})['catch'](function(_0x327d6d){logger[_0x2254('0x14')](_0x2254('0xe'),_0x2ee7ee,_0x327d6d);_0x477b47(_0x327d6d);});});} \ No newline at end of file +var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','IntegrationReport,\x20%s,\x20%s','IntegrationReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x21b94c,_0xb98409){var _0x549792=function(_0x27de0){while(--_0x27de0){_0x21b94c['push'](_0x21b94c['shift']());}};_0x549792(++_0xb98409);}(_0x2ef3,0xba));var _0x32ef=function(_0x3c6af1,_0x46c884){_0x3c6af1=_0x3c6af1-0x0;var _0x5d4088=_0x2ef3[_0x3c6af1];return _0x5d4088;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('IntegrationReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 4cb5120..3ffe1be 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 _0xa1a9=['/:id','get','post','create','/:id/sub_intervals','/:id/sub_intervals/create_many','addIntervals','put','update','delete','exports','multer','connect-timeout','Router','fs-extra','./interval.controller','isAuthenticated','index'];(function(_0x2fa164,_0x489302){var _0x5e9ae5=function(_0x37aa75){while(--_0x37aa75){_0x2fa164['push'](_0x2fa164['shift']());}};_0x5e9ae5(++_0x489302);}(_0xa1a9,0x9b));var _0x9a1a=function(_0x3939da,_0x153b13){_0x3939da=_0x3939da-0x0;var _0x1393cd=_0xa1a9[_0x3939da];return _0x1393cd;};'use strict';var multer=require(_0x9a1a('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9a1a('0x1'));var express=require('express');var router=express[_0x9a1a('0x2')]();var fs_extra=require(_0x9a1a('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x9a1a('0x4'));router['get']('/',auth[_0x9a1a('0x5')](),controller[_0x9a1a('0x6')]);router['get'](_0x9a1a('0x7'),auth['isAuthenticated'](),controller['show']);router[_0x9a1a('0x8')]('/:id/sub_intervals',auth[_0x9a1a('0x5')](),controller['getIntervals']);router[_0x9a1a('0x9')]('/',auth[_0x9a1a('0x5')](),controller[_0x9a1a('0xa')]);router[_0x9a1a('0x9')](_0x9a1a('0xb'),auth[_0x9a1a('0x5')](),controller['addInterval']);router[_0x9a1a('0x9')](_0x9a1a('0xc'),auth[_0x9a1a('0x5')](),controller[_0x9a1a('0xd')]);router[_0x9a1a('0xe')](_0x9a1a('0x7'),auth[_0x9a1a('0x5')](),controller[_0x9a1a('0xf')]);router[_0x9a1a('0x10')](_0x9a1a('0x7'),auth[_0x9a1a('0x5')](),controller['destroy']);module[_0x9a1a('0x11')]=router; \ No newline at end of file +var _0x038b=['delete','destroy','exports','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./interval.controller','get','/:id','isAuthenticated','/:id/sub_intervals','create','addInterval','post','/:id/sub_intervals/create_many','addIntervals','put','update'];(function(_0x1b964a,_0x40fdc2){var _0x2559fa=function(_0x1afe3e){while(--_0x1afe3e){_0x1b964a['push'](_0x1b964a['shift']());}};_0x2559fa(++_0x40fdc2);}(_0x038b,0x114));var _0xb038=function(_0x46deb3,_0x5db3ea){_0x46deb3=_0x46deb3-0x0;var _0x10802c=_0x038b[_0x46deb3];return _0x10802c;};'use strict';var multer=require('multer');var util=require(_0xb038('0x0'));var path=require(_0xb038('0x1'));var timeout=require(_0xb038('0x2'));var express=require('express');var router=express[_0xb038('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb038('0x4'));var interaction=require(_0xb038('0x5'));var config=require('../../config/environment');var controller=require(_0xb038('0x6'));router[_0xb038('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xb038('0x7')](_0xb038('0x8'),auth[_0xb038('0x9')](),controller['show']);router['get'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller['getIntervals']);router['post']('/',auth[_0xb038('0x9')](),controller[_0xb038('0xb')]);router['post'](_0xb038('0xa'),auth[_0xb038('0x9')](),controller[_0xb038('0xc')]);router[_0xb038('0xd')](_0xb038('0xe'),auth[_0xb038('0x9')](),controller[_0xb038('0xf')]);router[_0xb038('0x10')](_0xb038('0x8'),auth[_0xb038('0x9')](),controller[_0xb038('0x11')]);router[_0xb038('0x12')](_0xb038('0x8'),auth[_0xb038('0x9')](),controller[_0xb038('0x13')]);module[_0xb038('0x14')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index f7bc27b..eb311eb 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 _0xfe9b=['sequelize','exports','STRING'];(function(_0x3ba732,_0x5cbd92){var _0x285bdc=function(_0x366832){while(--_0x366832){_0x3ba732['push'](_0x3ba732['shift']());}};_0x285bdc(++_0x5cbd92);}(_0xfe9b,0x17a));var _0xbfe9=function(_0xfab4ad,_0xecacc0){_0xfab4ad=_0xfab4ad-0x0;var _0x5672e8=_0xfe9b[_0xfab4ad];return _0x5672e8;};'use strict';var Sequelize=require(_0xbfe9('0x0'));module[_0xbfe9('0x1')]={'name':{'type':Sequelize[_0xbfe9('0x2')]},'description':{'type':Sequelize[_0xbfe9('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':!![]}}; \ No newline at end of file +var _0xf9cf=['exports','STRING','sequelize'];(function(_0x565c49,_0x54acd0){var _0x20ca34=function(_0x42f7e1){while(--_0x42f7e1){_0x565c49['push'](_0x565c49['shift']());}};_0x20ca34(++_0x54acd0);}(_0xf9cf,0x6b));var _0xff9c=function(_0x2d64a1,_0x72850f){_0x2d64a1=_0x2d64a1-0x0;var _0x10a4a3=_0xf9cf[_0x2d64a1];return _0x10a4a3;};'use strict';var Sequelize=require(_0xff9c('0x0'));module[_0xff9c('0x1')]={'name':{'type':Sequelize[_0xff9c('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 df6d6fb..25a684c 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 _0xb07e=['sequelize','IntervalId','bulkCreate','rimraf','zip-dir','request-promise','moment','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','sendStatus','error','stack','name','send','index','map','Interval','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','catch','show','params','length','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','addInterval','getIntervals','findOne','nolimit','addIntervals'];(function(_0x47a602,_0x25e810){var _0x1d5d32=function(_0x210c07){while(--_0x210c07){_0x47a602['push'](_0x47a602['shift']());}};_0x1d5d32(++_0x25e810);}(_0xb07e,0xaf));var _0xeb07=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0xb07e[_0x5608a3];return _0x1ed50a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb07('0x0'));var zipdir=require(_0xeb07('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeb07('0x2'));var moment=require(_0xeb07('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xeb07('0x4'));var sox=require(_0xeb07('0x5'));var csv=require(_0xeb07('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xeb07('0x7'));var squel=require(_0xeb07('0x8'));var crypto=require(_0xeb07('0x9'));var jsforce=require(_0xeb07('0xa'));var deskjs=require(_0xeb07('0xb'));var toCsv=require(_0xeb07('0x6'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeb07('0xc'));var authService=require(_0xeb07('0xd'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xeb07('0xe'));var logger=require('../../config/logger')(_0xeb07('0xf'));var utils=require(_0xeb07('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xeb07('0x11'));var db=require(_0xeb07('0x12'))['db'];var extensions=require(_0xeb07('0x13'));function respondWithStatusCode(_0x3b1388,_0x3b6ffb){_0x3b6ffb=_0x3b6ffb||0xcc;return function(_0x73508a){if(_0x73508a){return _0x3b1388['sendStatus'](_0x3b6ffb);}return _0x3b1388[_0xeb07('0x14')](_0x3b6ffb)['end']();};}function respondWithResult(_0x8878e3,_0x19d871){_0x19d871=_0x19d871||0xc8;return function(_0x449cb8){if(_0x449cb8){return _0x8878e3['status'](_0x19d871)[_0xeb07('0x15')](_0x449cb8);}};}function respondWithFilteredResult(_0x1de8d1,_0x5e96c4){return function(_0x4a6521){if(_0x4a6521){var _0xecc2bd=typeof _0x5e96c4['offset']===_0xeb07('0x16')&&typeof _0x5e96c4[_0xeb07('0x17')]===_0xeb07('0x16');var _0x4e2bd9=_0x4a6521[_0xeb07('0x18')];var _0x3c975d=_0xecc2bd?0x0:_0x5e96c4[_0xeb07('0x19')];var _0x48f854=_0xecc2bd?_0x4a6521['count']:_0x5e96c4[_0xeb07('0x19')]+_0x5e96c4['limit'];var _0x2ab7bc;if(_0x48f854>=_0x4e2bd9){_0x48f854=_0x4e2bd9;_0x2ab7bc=0xc8;}else{_0x2ab7bc=0xce;}_0x1de8d1['status'](_0x2ab7bc);return _0x1de8d1[_0xeb07('0x1a')](_0xeb07('0x1b'),_0x3c975d+'-'+_0x48f854+'/'+_0x4e2bd9)[_0xeb07('0x15')](_0x4a6521);}return null;};}function patchUpdates(_0x3ee644){return function(_0x4ab83a){try{jsonpatch[_0xeb07('0x1c')](_0x4ab83a,_0x3ee644,!![]);}catch(_0x2b6635){return BPromise[_0xeb07('0x1d')](_0x2b6635);}return _0x4ab83a[_0xeb07('0x1e')]();};}function saveUpdates(_0x3b89cc,_0x509b0c){return function(_0x32f276){if(_0x32f276){return _0x32f276[_0xeb07('0x1f')](_0x3b89cc)[_0xeb07('0x20')](function(_0x36605b){return _0x36605b;});}return null;};}function removeEntity(_0x48e610,_0x2e274c){return function(_0x5896fd){if(_0x5896fd){return _0x5896fd['destroy']()[_0xeb07('0x20')](function(){var _0x566c41=_0x5896fd[_0xeb07('0x21')]({'plain':!![]});var _0x206026=_0xeb07('0x22');return db[_0xeb07('0x23')]['destroy']({'where':{'type':_0x206026,'resourceId':_0x566c41['id']}})[_0xeb07('0x20')](function(){return _0x5896fd;});})['then'](function(){_0x48e610[_0xeb07('0x14')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2befe3,_0x2cbd1f){return function(_0x1c75ef){if(!_0x1c75ef){_0x2befe3[_0xeb07('0x24')](0x194);}return _0x1c75ef;};}function handleError(_0x570178,_0x512f0c){_0x512f0c=_0x512f0c||0x1f4;return function(_0x558fc2){logger[_0xeb07('0x25')](_0x558fc2[_0xeb07('0x26')]);if(_0x558fc2[_0xeb07('0x27')]){delete _0x558fc2[_0xeb07('0x27')];}_0x570178[_0xeb07('0x14')](_0x512f0c)[_0xeb07('0x28')](_0x558fc2);};}exports[_0xeb07('0x29')]=function(_0x41b86a,_0x1fc68f){var _0xd70ca9={},_0x1256c7={},_0x2deedf={'count':0x0,'rows':[]};var _0x274317=_[_0xeb07('0x2a')](db[_0xeb07('0x2b')][_0xeb07('0x2c')],function(_0x5bec66){return{'name':_0x5bec66[_0xeb07('0x2d')],'type':_0x5bec66['type'][_0xeb07('0x2e')]};});_0x1256c7[_0xeb07('0x2f')]=_[_0xeb07('0x2a')](_0x274317,_0xeb07('0x27'));_0x1256c7[_0xeb07('0x30')]=_[_0xeb07('0x31')](_0x41b86a[_0xeb07('0x30')]);_0x1256c7[_0xeb07('0x32')]=_[_0xeb07('0x33')](_0x1256c7[_0xeb07('0x2f')],_0x1256c7[_0xeb07('0x30')]);_0xd70ca9[_0xeb07('0x34')]=_['intersection'](_0x1256c7['model'],qs[_0xeb07('0x35')](_0x41b86a[_0xeb07('0x30')][_0xeb07('0x35')]));_0xd70ca9[_0xeb07('0x34')]=_0xd70ca9[_0xeb07('0x34')]['length']?_0xd70ca9[_0xeb07('0x34')]:_0x1256c7[_0xeb07('0x2f')];if(!_0x41b86a[_0xeb07('0x30')][_0xeb07('0x36')]('nolimit')){_0xd70ca9[_0xeb07('0x17')]=qs[_0xeb07('0x17')](_0x41b86a[_0xeb07('0x30')][_0xeb07('0x17')]);_0xd70ca9[_0xeb07('0x19')]=qs['offset'](_0x41b86a[_0xeb07('0x30')][_0xeb07('0x19')]);}_0xd70ca9[_0xeb07('0x37')]=qs[_0xeb07('0x38')](_0x41b86a[_0xeb07('0x30')]['sort']);_0xd70ca9[_0xeb07('0x39')]=qs[_0xeb07('0x32')](_[_0xeb07('0x3a')](_0x41b86a[_0xeb07('0x30')],_0x1256c7['filters']),_0x274317);if(_0x41b86a[_0xeb07('0x30')]['filter']){_0xd70ca9[_0xeb07('0x39')]=_[_0xeb07('0x3b')](_0xd70ca9[_0xeb07('0x39')],{'$or':_[_0xeb07('0x2a')](_0x274317,function(_0x111063){if(_0x111063['type']!==_0xeb07('0x3c')){var _0x510e24={};_0x510e24[_0x111063[_0xeb07('0x27')]]={'$like':'%'+_0x41b86a[_0xeb07('0x30')][_0xeb07('0x3d')]+'%'};return _0x510e24;}})});}_0xd70ca9=_[_0xeb07('0x3b')]({},_0xd70ca9,_0x41b86a['options']);var _0x1f72e0={'where':_0xd70ca9[_0xeb07('0x39')]};return db[_0xeb07('0x2b')][_0xeb07('0x18')](_0x1f72e0)[_0xeb07('0x20')](function(_0x3bd8b4){_0x2deedf['count']=_0x3bd8b4;if(_0x41b86a[_0xeb07('0x30')][_0xeb07('0x3e')]){_0xd70ca9[_0xeb07('0x3f')]=[{'all':!![]}];}return db[_0xeb07('0x2b')]['findAll'](_0xd70ca9);})[_0xeb07('0x20')](function(_0x1c133d){_0x2deedf['rows']=_0x1c133d;return _0x2deedf;})[_0xeb07('0x20')](respondWithFilteredResult(_0x1fc68f,_0xd70ca9))[_0xeb07('0x40')](handleError(_0x1fc68f,null));};exports[_0xeb07('0x41')]=function(_0x23be3e,_0x3340ee){var _0x38e0dd={'raw':!![],'where':{'id':_0x23be3e[_0xeb07('0x42')]['id']}},_0x2b3b2d={};_0x2b3b2d[_0xeb07('0x2f')]=_[_0xeb07('0x31')](db[_0xeb07('0x2b')][_0xeb07('0x2c')]);_0x2b3b2d[_0xeb07('0x30')]=_[_0xeb07('0x31')](_0x23be3e['query']);_0x2b3b2d[_0xeb07('0x32')]=_['intersection'](_0x2b3b2d[_0xeb07('0x2f')],_0x2b3b2d[_0xeb07('0x30')]);_0x38e0dd[_0xeb07('0x34')]=_[_0xeb07('0x33')](_0x2b3b2d[_0xeb07('0x2f')],qs[_0xeb07('0x35')](_0x23be3e[_0xeb07('0x30')][_0xeb07('0x35')]));_0x38e0dd['attributes']=_0x38e0dd[_0xeb07('0x34')][_0xeb07('0x43')]?_0x38e0dd[_0xeb07('0x34')]:_0x2b3b2d[_0xeb07('0x2f')];if(_0x23be3e[_0xeb07('0x30')][_0xeb07('0x3e')]){_0x38e0dd['include']=[{'all':!![]}];}_0x38e0dd=_[_0xeb07('0x3b')]({},_0x38e0dd,_0x23be3e[_0xeb07('0x44')]);return db[_0xeb07('0x2b')][_0xeb07('0x45')](_0x38e0dd)[_0xeb07('0x20')](handleEntityNotFound(_0x3340ee,null))[_0xeb07('0x20')](respondWithResult(_0x3340ee,null))[_0xeb07('0x40')](handleError(_0x3340ee,null));};exports[_0xeb07('0x46')]=function(_0x645122,_0x3e8772){return db[_0xeb07('0x2b')][_0xeb07('0x46')](_0x645122[_0xeb07('0x47')],{})[_0xeb07('0x20')](function(_0x4ae6cc){var _0x53ffd5=_0x645122[_0xeb07('0x48')]['get']({'plain':!![]});if(!_0x53ffd5)throw new Error(_0xeb07('0x49'));if(_0x53ffd5['role']==='user'){var _0x3832ae=_0x4ae6cc['get']({'plain':!![]});var _0x308a38=_0xeb07('0x22');return db[_0xeb07('0x4a')][_0xeb07('0x45')]({'where':{'name':_0x308a38,'userProfileId':_0x53ffd5[_0xeb07('0x4b')]},'raw':!![]})['then'](function(_0x5c2899){if(_0x5c2899&&_0x5c2899['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x3832ae[_0xeb07('0x27')],'resourceId':_0x3832ae['id'],'type':_0x5c2899[_0xeb07('0x27')],'sectionId':_0x5c2899['id']},{})[_0xeb07('0x20')](function(){return _0x4ae6cc;});}else{return _0x4ae6cc;}})[_0xeb07('0x40')](function(_0x2d3765){logger[_0xeb07('0x25')](_0xeb07('0x4c'),_0x2d3765);throw _0x2d3765;});}return _0x4ae6cc;})[_0xeb07('0x20')](respondWithResult(_0x3e8772,0xc9))[_0xeb07('0x40')](handleError(_0x3e8772,null));};exports[_0xeb07('0x1f')]=function(_0x45b60c,_0x2c52d5){if(_0x45b60c[_0xeb07('0x47')]['id']){delete _0x45b60c['body']['id'];}return db['Interval'][_0xeb07('0x45')]({'where':{'id':_0x45b60c[_0xeb07('0x42')]['id']}})[_0xeb07('0x20')](handleEntityNotFound(_0x2c52d5,null))[_0xeb07('0x20')](saveUpdates(_0x45b60c['body'],null))[_0xeb07('0x20')](respondWithResult(_0x2c52d5,null))['catch'](handleError(_0x2c52d5,null));};exports[_0xeb07('0x4d')]=function(_0x5236b6,_0x2c7a5a){return db['Interval']['find']({'where':{'id':_0x5236b6[_0xeb07('0x42')]['id']}})['then'](handleEntityNotFound(_0x2c7a5a,null))['then'](removeEntity(_0x2c7a5a,null))[_0xeb07('0x40')](handleError(_0x2c7a5a,null));};exports[_0xeb07('0x4e')]=function(_0x1d1215,_0x3cbfab,_0x22eab3){if(_0x1d1215[_0xeb07('0x47')]['id']){delete _0x1d1215[_0xeb07('0x47')]['id'];}return db[_0xeb07('0x2b')][_0xeb07('0x45')]({'where':{'id':_0x1d1215[_0xeb07('0x42')]['id']}})[_0xeb07('0x20')](handleEntityNotFound(_0x3cbfab,null))[_0xeb07('0x20')](function(_0xa150f6){if(_0xa150f6){_0x1d1215[_0xeb07('0x47')]['IntervalId']=_0xa150f6['id'];return db['Interval'][_0xeb07('0x46')](_0x1d1215['body']);}})[_0xeb07('0x20')](respondWithResult(_0x3cbfab,null))[_0xeb07('0x40')](handleError(_0x3cbfab,null));};exports[_0xeb07('0x4f')]=function(_0x491d00,_0x47dab5,_0x45e553){var _0x17396d={};var _0x3100a9={};var _0x24d3cc;var _0x44304b;return db[_0xeb07('0x2b')][_0xeb07('0x50')]({'where':{'id':_0x491d00[_0xeb07('0x42')]['id']}})[_0xeb07('0x20')](handleEntityNotFound(_0x47dab5,null))[_0xeb07('0x20')](function(_0x25a4f4){if(_0x25a4f4){_0x24d3cc=_0x25a4f4;_0x3100a9[_0xeb07('0x2f')]=_[_0xeb07('0x31')](db[_0xeb07('0x2b')][_0xeb07('0x2c')]);_0x3100a9[_0xeb07('0x30')]=_[_0xeb07('0x31')](_0x491d00['query']);_0x3100a9['filters']=_['intersection'](_0x3100a9[_0xeb07('0x2f')],_0x3100a9[_0xeb07('0x30')]);_0x17396d[_0xeb07('0x34')]=_['intersection'](_0x3100a9[_0xeb07('0x2f')],qs[_0xeb07('0x35')](_0x491d00[_0xeb07('0x30')][_0xeb07('0x35')]));_0x17396d[_0xeb07('0x34')]=_0x17396d[_0xeb07('0x34')][_0xeb07('0x43')]?_0x17396d[_0xeb07('0x34')]:_0x3100a9[_0xeb07('0x2f')];_0x17396d[_0xeb07('0x37')]=qs[_0xeb07('0x38')](_0x491d00['query']['sort']);_0x17396d['where']=qs['filters'](_['pick'](_0x491d00[_0xeb07('0x30')],_0x3100a9[_0xeb07('0x32')]));if(_0x491d00['query']['filter']){_0x17396d[_0xeb07('0x39')]=_['merge'](_0x17396d['where'],{'$or':_['map'](_0x17396d[_0xeb07('0x34')],function(_0x12b636){var _0x3bb659={};_0x3bb659[_0x12b636]={'$like':'%'+_0x491d00[_0xeb07('0x30')]['filter']+'%'};return _0x3bb659;})});}_0x17396d=_[_0xeb07('0x3b')]({},_0x17396d,_0x491d00[_0xeb07('0x44')]);return _0x24d3cc[_0xeb07('0x4f')](_0x17396d);}})[_0xeb07('0x20')](function(_0xaf0236){if(_0xaf0236){_0x44304b=_0xaf0236[_0xeb07('0x43')];if(!_0x491d00['query'][_0xeb07('0x36')](_0xeb07('0x51'))){_0x17396d['limit']=qs[_0xeb07('0x17')](_0x491d00['query'][_0xeb07('0x17')]);_0x17396d[_0xeb07('0x19')]=qs[_0xeb07('0x19')](_0x491d00[_0xeb07('0x30')][_0xeb07('0x19')]);}return _0x24d3cc['getIntervals'](_0x17396d);}})['then'](function(_0x4a488a){if(_0x4a488a){return _0x4a488a?{'count':_0x44304b,'rows':_0x4a488a}:null;}})[_0xeb07('0x20')](respondWithResult(_0x47dab5,null))[_0xeb07('0x40')](handleError(_0x47dab5,null));};exports[_0xeb07('0x52')]=function(_0x84462a,_0x3cf1cb,_0x32f072){return db[_0xeb07('0x2b')][_0xeb07('0x50')]({'where':{'id':_0x84462a[_0xeb07('0x42')]['id']}})['then'](handleEntityNotFound(_0x3cf1cb,null))['then'](function(_0x53d5b7){if(_0x53d5b7){return db[_0xeb07('0x53')]['transaction'](function(_0x1b4922){return db[_0xeb07('0x2b')][_0xeb07('0x4d')]({'where':{'IntervalId':_0x84462a['params']['id']},'transaction':_0x1b4922})[_0xeb07('0x20')](function(_0x4c45ac){var _0x357dc7=_[_0xeb07('0x2a')](_0x84462a[_0xeb07('0x47')],function(_0x39bc88){delete _0x39bc88['id'];_0x39bc88[_0xeb07('0x54')]=_0x84462a[_0xeb07('0x42')]['id'];return _0x39bc88;});return db[_0xeb07('0x2b')][_0xeb07('0x55')](_0x357dc7,{'transaction':_0x1b4922});});})['then'](function(){return db[_0xeb07('0x2b')]['findAll']({'where':{'IntervalId':_0x84462a['params']['id']}});});}})[_0xeb07('0x20')](respondWithResult(_0x3cf1cb,null))[_0xeb07('0x40')](handleError(_0x3cf1cb,null));}; \ No newline at end of file +var _0xdb01=['querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','Intervals','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','show','create','body','user','role','UserProfileSection','find','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','addInterval','getIntervals','findOne','hasOwnProperty','addIntervals','sequelize','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','squel','crypto','jsforce','desk.js'];(function(_0x15fc3c,_0x35665b){var _0x94c5c8=function(_0xbab268){while(--_0xbab268){_0x15fc3c['push'](_0x15fc3c['shift']());}};_0x94c5c8(++_0x35665b);}(_0xdb01,0x1bf));var _0x1db0=function(_0x1c4409,_0x3b2e8f){_0x1c4409=_0x1c4409-0x0;var _0x356d8f=_0xdb01[_0x1c4409];return _0x356d8f;};'use strict';var emlformat=require(_0x1db0('0x0'));var rimraf=require(_0x1db0('0x1'));var zipdir=require(_0x1db0('0x2'));var jsonpatch=require(_0x1db0('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1db0('0x4'));var Mustache=require(_0x1db0('0x5'));var util=require(_0x1db0('0x6'));var path=require(_0x1db0('0x7'));var sox=require('sox');var csv=require(_0x1db0('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x1db0('0x9'));var crypto=require(_0x1db0('0xa'));var jsforce=require(_0x1db0('0xb'));var deskjs=require(_0x1db0('0xc'));var toCsv=require('to-csv');var querystring=require(_0x1db0('0xd'));var Papa=require(_0x1db0('0xe'));var Redis=require(_0x1db0('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x1db0('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1db0('0x11'));var logger=require(_0x1db0('0x12'))(_0x1db0('0x13'));var utils=require(_0x1db0('0x14'));var config=require(_0x1db0('0x15'));var licenseUtil=require(_0x1db0('0x16'));var db=require(_0x1db0('0x17'))['db'];var extensions=require(_0x1db0('0x18'));function respondWithStatusCode(_0xfdfa41,_0x30353a){_0x30353a=_0x30353a||0xcc;return function(_0x2b8591){if(_0x2b8591){return _0xfdfa41[_0x1db0('0x19')](_0x30353a);}return _0xfdfa41['status'](_0x30353a)[_0x1db0('0x1a')]();};}function respondWithResult(_0x492317,_0x4278f0){_0x4278f0=_0x4278f0||0xc8;return function(_0x26f407){if(_0x26f407){return _0x492317[_0x1db0('0x1b')](_0x4278f0)[_0x1db0('0x1c')](_0x26f407);}};}function respondWithFilteredResult(_0x22d3d0,_0x56f14f){return function(_0xaa383){if(_0xaa383){var _0x5910c3=typeof _0x56f14f[_0x1db0('0x1d')]===_0x1db0('0x1e')&&typeof _0x56f14f[_0x1db0('0x1f')]===_0x1db0('0x1e');var _0x5edeca=_0xaa383[_0x1db0('0x20')];var _0x1e72ac=_0x5910c3?0x0:_0x56f14f['offset'];var _0x426ee7=_0x5910c3?_0xaa383[_0x1db0('0x20')]:_0x56f14f[_0x1db0('0x1d')]+_0x56f14f[_0x1db0('0x1f')];var _0x506949;if(_0x426ee7>=_0x5edeca){_0x426ee7=_0x5edeca;_0x506949=0xc8;}else{_0x506949=0xce;}_0x22d3d0[_0x1db0('0x1b')](_0x506949);return _0x22d3d0[_0x1db0('0x21')](_0x1db0('0x22'),_0x1e72ac+'-'+_0x426ee7+'/'+_0x5edeca)[_0x1db0('0x1c')](_0xaa383);}return null;};}function patchUpdates(_0x5e499d){return function(_0x1d75f){try{jsonpatch[_0x1db0('0x23')](_0x1d75f,_0x5e499d,!![]);}catch(_0x2c98e0){return BPromise[_0x1db0('0x24')](_0x2c98e0);}return _0x1d75f[_0x1db0('0x25')]();};}function saveUpdates(_0x7bde4,_0x3e6e26){return function(_0x29f65d){if(_0x29f65d){return _0x29f65d[_0x1db0('0x26')](_0x7bde4)[_0x1db0('0x27')](function(_0x452bf1){return _0x452bf1;});}return null;};}function removeEntity(_0x336623,_0x2d1c55){return function(_0x20be53){if(_0x20be53){return _0x20be53['destroy']()['then'](function(){var _0x7474c9=_0x20be53[_0x1db0('0x28')]({'plain':!![]});var _0x33c826=_0x1db0('0x29');return db[_0x1db0('0x2a')]['destroy']({'where':{'type':_0x33c826,'resourceId':_0x7474c9['id']}})[_0x1db0('0x27')](function(){return _0x20be53;});})[_0x1db0('0x27')](function(){_0x336623[_0x1db0('0x1b')](0xcc)[_0x1db0('0x1a')]();});}};}function handleEntityNotFound(_0x4afb6c,_0x3dd26a){return function(_0x2bb74d){if(!_0x2bb74d){_0x4afb6c[_0x1db0('0x19')](0x194);}return _0x2bb74d;};}function handleError(_0x34ca2a,_0x597358){_0x597358=_0x597358||0x1f4;return function(_0x26a985){logger['error'](_0x26a985[_0x1db0('0x2b')]);if(_0x26a985[_0x1db0('0x2c')]){delete _0x26a985[_0x1db0('0x2c')];}_0x34ca2a[_0x1db0('0x1b')](_0x597358)[_0x1db0('0x2d')](_0x26a985);};}exports[_0x1db0('0x2e')]=function(_0x1745d7,_0x52d99b){var _0x5a1e0a={},_0x31fd8c={},_0xbc821d={'count':0x0,'rows':[]};var _0x3dca11=_[_0x1db0('0x2f')](db[_0x1db0('0x30')][_0x1db0('0x31')],function(_0x22c91d){return{'name':_0x22c91d[_0x1db0('0x32')],'type':_0x22c91d[_0x1db0('0x33')]['key']};});_0x31fd8c[_0x1db0('0x34')]=_[_0x1db0('0x2f')](_0x3dca11,_0x1db0('0x2c'));_0x31fd8c[_0x1db0('0x35')]=_[_0x1db0('0x36')](_0x1745d7[_0x1db0('0x35')]);_0x31fd8c[_0x1db0('0x37')]=_[_0x1db0('0x38')](_0x31fd8c['model'],_0x31fd8c[_0x1db0('0x35')]);_0x5a1e0a[_0x1db0('0x39')]=_[_0x1db0('0x38')](_0x31fd8c['model'],qs[_0x1db0('0x3a')](_0x1745d7['query'][_0x1db0('0x3a')]));_0x5a1e0a[_0x1db0('0x39')]=_0x5a1e0a[_0x1db0('0x39')][_0x1db0('0x3b')]?_0x5a1e0a[_0x1db0('0x39')]:_0x31fd8c[_0x1db0('0x34')];if(!_0x1745d7[_0x1db0('0x35')]['hasOwnProperty'](_0x1db0('0x3c'))){_0x5a1e0a[_0x1db0('0x1f')]=qs[_0x1db0('0x1f')](_0x1745d7['query'][_0x1db0('0x1f')]);_0x5a1e0a[_0x1db0('0x1d')]=qs[_0x1db0('0x1d')](_0x1745d7[_0x1db0('0x35')][_0x1db0('0x1d')]);}_0x5a1e0a[_0x1db0('0x3d')]=qs[_0x1db0('0x3e')](_0x1745d7[_0x1db0('0x35')]['sort']);_0x5a1e0a[_0x1db0('0x3f')]=qs[_0x1db0('0x37')](_[_0x1db0('0x40')](_0x1745d7[_0x1db0('0x35')],_0x31fd8c[_0x1db0('0x37')]),_0x3dca11);if(_0x1745d7['query'][_0x1db0('0x41')]){_0x5a1e0a['where']=_[_0x1db0('0x42')](_0x5a1e0a[_0x1db0('0x3f')],{'$or':_[_0x1db0('0x2f')](_0x3dca11,function(_0x311a8f){if(_0x311a8f[_0x1db0('0x33')]!=='VIRTUAL'){var _0x5624fe={};_0x5624fe[_0x311a8f[_0x1db0('0x2c')]]={'$like':'%'+_0x1745d7[_0x1db0('0x35')]['filter']+'%'};return _0x5624fe;}})});}_0x5a1e0a=_[_0x1db0('0x42')]({},_0x5a1e0a,_0x1745d7[_0x1db0('0x43')]);var _0xa1413e={'where':_0x5a1e0a['where']};return db[_0x1db0('0x30')]['count'](_0xa1413e)[_0x1db0('0x27')](function(_0xeb7a93){_0xbc821d[_0x1db0('0x20')]=_0xeb7a93;if(_0x1745d7[_0x1db0('0x35')][_0x1db0('0x44')]){_0x5a1e0a[_0x1db0('0x45')]=[{'all':!![]}];}return db[_0x1db0('0x30')][_0x1db0('0x46')](_0x5a1e0a);})['then'](function(_0xe7ff42){_0xbc821d['rows']=_0xe7ff42;return _0xbc821d;})[_0x1db0('0x27')](respondWithFilteredResult(_0x52d99b,_0x5a1e0a))[_0x1db0('0x47')](handleError(_0x52d99b,null));};exports[_0x1db0('0x48')]=function(_0x19c2f3,_0x37f5c9){var _0xdd8f18={'raw':!![],'where':{'id':_0x19c2f3['params']['id']}},_0x40d752={};_0x40d752['model']=_[_0x1db0('0x36')](db[_0x1db0('0x30')][_0x1db0('0x31')]);_0x40d752['query']=_[_0x1db0('0x36')](_0x19c2f3[_0x1db0('0x35')]);_0x40d752[_0x1db0('0x37')]=_[_0x1db0('0x38')](_0x40d752[_0x1db0('0x34')],_0x40d752[_0x1db0('0x35')]);_0xdd8f18['attributes']=_[_0x1db0('0x38')](_0x40d752['model'],qs[_0x1db0('0x3a')](_0x19c2f3[_0x1db0('0x35')]['fields']));_0xdd8f18[_0x1db0('0x39')]=_0xdd8f18[_0x1db0('0x39')][_0x1db0('0x3b')]?_0xdd8f18['attributes']:_0x40d752['model'];if(_0x19c2f3[_0x1db0('0x35')][_0x1db0('0x44')]){_0xdd8f18[_0x1db0('0x45')]=[{'all':!![]}];}_0xdd8f18=_[_0x1db0('0x42')]({},_0xdd8f18,_0x19c2f3['options']);return db[_0x1db0('0x30')]['find'](_0xdd8f18)[_0x1db0('0x27')](handleEntityNotFound(_0x37f5c9,null))[_0x1db0('0x27')](respondWithResult(_0x37f5c9,null))[_0x1db0('0x47')](handleError(_0x37f5c9,null));};exports[_0x1db0('0x49')]=function(_0x3ed862,_0x2c617f){return db[_0x1db0('0x30')][_0x1db0('0x49')](_0x3ed862[_0x1db0('0x4a')],{})['then'](function(_0x20e1c9){var _0x35b042=_0x3ed862[_0x1db0('0x4b')]['get']({'plain':!![]});if(!_0x35b042)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x35b042[_0x1db0('0x4c')]==='user'){var _0x576adf=_0x20e1c9['get']({'plain':!![]});var _0xb3c859='Intervals';return db[_0x1db0('0x4d')][_0x1db0('0x4e')]({'where':{'name':_0xb3c859,'userProfileId':_0x35b042[_0x1db0('0x4f')]},'raw':!![]})['then'](function(_0x533f45){if(_0x533f45&&_0x533f45[_0x1db0('0x50')]===0x0){return db['UserProfileResource'][_0x1db0('0x49')]({'name':_0x576adf['name'],'resourceId':_0x576adf['id'],'type':_0x533f45[_0x1db0('0x2c')],'sectionId':_0x533f45['id']},{})[_0x1db0('0x27')](function(){return _0x20e1c9;});}else{return _0x20e1c9;}})['catch'](function(_0x25131d){logger[_0x1db0('0x51')](_0x1db0('0x52'),_0x25131d);throw _0x25131d;});}return _0x20e1c9;})[_0x1db0('0x27')](respondWithResult(_0x2c617f,0xc9))[_0x1db0('0x47')](handleError(_0x2c617f,null));};exports[_0x1db0('0x26')]=function(_0x26d897,_0x4a912a){if(_0x26d897['body']['id']){delete _0x26d897['body']['id'];}return db['Interval']['find']({'where':{'id':_0x26d897[_0x1db0('0x53')]['id']}})[_0x1db0('0x27')](handleEntityNotFound(_0x4a912a,null))[_0x1db0('0x27')](saveUpdates(_0x26d897[_0x1db0('0x4a')],null))[_0x1db0('0x27')](respondWithResult(_0x4a912a,null))[_0x1db0('0x47')](handleError(_0x4a912a,null));};exports[_0x1db0('0x54')]=function(_0xbe3bbb,_0x578c54){return db['Interval'][_0x1db0('0x4e')]({'where':{'id':_0xbe3bbb[_0x1db0('0x53')]['id']}})[_0x1db0('0x27')](handleEntityNotFound(_0x578c54,null))[_0x1db0('0x27')](removeEntity(_0x578c54,null))[_0x1db0('0x47')](handleError(_0x578c54,null));};exports[_0x1db0('0x55')]=function(_0x2c50bf,_0x2199a3,_0x42faab){if(_0x2c50bf[_0x1db0('0x4a')]['id']){delete _0x2c50bf['body']['id'];}return db[_0x1db0('0x30')][_0x1db0('0x4e')]({'where':{'id':_0x2c50bf['params']['id']}})[_0x1db0('0x27')](handleEntityNotFound(_0x2199a3,null))[_0x1db0('0x27')](function(_0x4bfd87){if(_0x4bfd87){_0x2c50bf[_0x1db0('0x4a')]['IntervalId']=_0x4bfd87['id'];return db[_0x1db0('0x30')][_0x1db0('0x49')](_0x2c50bf[_0x1db0('0x4a')]);}})[_0x1db0('0x27')](respondWithResult(_0x2199a3,null))[_0x1db0('0x47')](handleError(_0x2199a3,null));};exports[_0x1db0('0x56')]=function(_0x17bac8,_0x7fdae,_0x10bea1){var _0x31fa05={};var _0x5199b2={};var _0x52e3af;var _0x423688;return db[_0x1db0('0x30')][_0x1db0('0x57')]({'where':{'id':_0x17bac8[_0x1db0('0x53')]['id']}})[_0x1db0('0x27')](handleEntityNotFound(_0x7fdae,null))[_0x1db0('0x27')](function(_0x4bc0e6){if(_0x4bc0e6){_0x52e3af=_0x4bc0e6;_0x5199b2[_0x1db0('0x34')]=_['keys'](db['Interval'][_0x1db0('0x31')]);_0x5199b2[_0x1db0('0x35')]=_[_0x1db0('0x36')](_0x17bac8[_0x1db0('0x35')]);_0x5199b2[_0x1db0('0x37')]=_[_0x1db0('0x38')](_0x5199b2[_0x1db0('0x34')],_0x5199b2[_0x1db0('0x35')]);_0x31fa05[_0x1db0('0x39')]=_[_0x1db0('0x38')](_0x5199b2['model'],qs[_0x1db0('0x3a')](_0x17bac8['query'][_0x1db0('0x3a')]));_0x31fa05['attributes']=_0x31fa05[_0x1db0('0x39')][_0x1db0('0x3b')]?_0x31fa05[_0x1db0('0x39')]:_0x5199b2['model'];_0x31fa05[_0x1db0('0x3d')]=qs['sort'](_0x17bac8[_0x1db0('0x35')]['sort']);_0x31fa05['where']=qs[_0x1db0('0x37')](_[_0x1db0('0x40')](_0x17bac8['query'],_0x5199b2[_0x1db0('0x37')]));if(_0x17bac8[_0x1db0('0x35')][_0x1db0('0x41')]){_0x31fa05['where']=_[_0x1db0('0x42')](_0x31fa05[_0x1db0('0x3f')],{'$or':_['map'](_0x31fa05['attributes'],function(_0x3eb37d){var _0x280888={};_0x280888[_0x3eb37d]={'$like':'%'+_0x17bac8[_0x1db0('0x35')][_0x1db0('0x41')]+'%'};return _0x280888;})});}_0x31fa05=_[_0x1db0('0x42')]({},_0x31fa05,_0x17bac8[_0x1db0('0x43')]);return _0x52e3af['getIntervals'](_0x31fa05);}})[_0x1db0('0x27')](function(_0x43d08f){if(_0x43d08f){_0x423688=_0x43d08f[_0x1db0('0x3b')];if(!_0x17bac8[_0x1db0('0x35')][_0x1db0('0x58')](_0x1db0('0x3c'))){_0x31fa05[_0x1db0('0x1f')]=qs[_0x1db0('0x1f')](_0x17bac8[_0x1db0('0x35')][_0x1db0('0x1f')]);_0x31fa05[_0x1db0('0x1d')]=qs[_0x1db0('0x1d')](_0x17bac8[_0x1db0('0x35')]['offset']);}return _0x52e3af[_0x1db0('0x56')](_0x31fa05);}})['then'](function(_0x12d117){if(_0x12d117){return _0x12d117?{'count':_0x423688,'rows':_0x12d117}:null;}})[_0x1db0('0x27')](respondWithResult(_0x7fdae,null))[_0x1db0('0x47')](handleError(_0x7fdae,null));};exports[_0x1db0('0x59')]=function(_0x14e55f,_0x11a460,_0x56de23){return db[_0x1db0('0x30')][_0x1db0('0x57')]({'where':{'id':_0x14e55f['params']['id']}})[_0x1db0('0x27')](handleEntityNotFound(_0x11a460,null))['then'](function(_0xf706f4){if(_0xf706f4){return db[_0x1db0('0x5a')]['transaction'](function(_0x7795de){return db[_0x1db0('0x30')]['destroy']({'where':{'IntervalId':_0x14e55f['params']['id']},'transaction':_0x7795de})[_0x1db0('0x27')](function(_0x2c458a){var _0x1e5f51=_['map'](_0x14e55f[_0x1db0('0x4a')],function(_0x2372a1){delete _0x2372a1['id'];_0x2372a1['IntervalId']=_0x14e55f[_0x1db0('0x53')]['id'];return _0x2372a1;});return db[_0x1db0('0x30')][_0x1db0('0x5b')](_0x1e5f51,{'transaction':_0x7795de});});})[_0x1db0('0x27')](function(){return db[_0x1db0('0x30')][_0x1db0('0x46')]({'where':{'IntervalId':_0x14e55f[_0x1db0('0x53')]['id']}});});}})['then'](respondWithResult(_0x11a460,null))[_0x1db0('0x47')](handleError(_0x11a460,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 398744e..fa11b89 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 _0x8495=['./interval.attributes','../../components/extensions/rewrite','rewrite','util','api','moment','bluebird','path','rimraf','../../config/environment'];(function(_0x134f1e,_0x148a4d){var _0x2e73d1=function(_0x4ab69d){while(--_0x4ab69d){_0x134f1e['push'](_0x134f1e['shift']());}};_0x2e73d1(++_0x148a4d);}(_0x8495,0x8f));var _0x5849=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0x8495[_0x173d7e];return _0x2220d6;};'use strict';var _=require('lodash');var util=require(_0x5849('0x0'));var logger=require('../../config/logger')(_0x5849('0x1'));var moment=require(_0x5849('0x2'));var BPromise=require(_0x5849('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5849('0x4'));var rimraf=require(_0x5849('0x5'));var config=require(_0x5849('0x6'));var attributes=require(_0x5849('0x7'));var extensions=require(_0x5849('0x8'));module['exports']=function(_0x4df3a0,_0x262106){return _0x4df3a0['define']('Interval',attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x278281,_0x3c2903){extensions['rewrite'](_0x4df3a0,_0x278281);},'afterBulkCreate':function(_0x53000f,_0x43c926,_0x36878a){_0x36878a();extensions[_0x5849('0x9')](_0x4df3a0,_0x53000f[0x0]);},'afterUpdate':function(_0x2f6a3a,_0x56b58f){extensions[_0x5849('0x9')](_0x4df3a0,_0x2f6a3a);},'afterDestroy':function(_0x53383d,_0x1c9260){extensions['rewrite'](_0x4df3a0,_0x53383d);}}});}; \ No newline at end of file +var _0x32b6=['moment','path','rimraf','../../config/environment','./interval.attributes','../../components/extensions/rewrite','exports','define','Interval','rewrite','lodash','util','api'];(function(_0x49b7d3,_0x3c42e0){var _0x44a611=function(_0x351498){while(--_0x351498){_0x49b7d3['push'](_0x49b7d3['shift']());}};_0x44a611(++_0x3c42e0);}(_0x32b6,0x1d1));var _0x632b=function(_0x3fe113,_0x22e3c3){_0x3fe113=_0x3fe113-0x0;var _0xf60f42=_0x32b6[_0x3fe113];return _0xf60f42;};'use strict';var _=require(_0x632b('0x0'));var util=require(_0x632b('0x1'));var logger=require('../../config/logger')(_0x632b('0x2'));var moment=require(_0x632b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x632b('0x4'));var rimraf=require(_0x632b('0x5'));var config=require(_0x632b('0x6'));var attributes=require(_0x632b('0x7'));var extensions=require(_0x632b('0x8'));module[_0x632b('0x9')]=function(_0x24ceab,_0x10458a){return _0x24ceab[_0x632b('0xa')](_0x632b('0xb'),attributes,{'tableName':'tools_intervals','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x33d711,_0x173270){extensions[_0x632b('0xc')](_0x24ceab,_0x33d711);},'afterBulkCreate':function(_0x174201,_0x4961b1,_0x5904e8){_0x5904e8();extensions['rewrite'](_0x24ceab,_0x174201[0x0]);},'afterUpdate':function(_0x3ce569,_0x484b3a){extensions[_0x632b('0xc')](_0x24ceab,_0x3ce569);},'afterDestroy':function(_0x359d6e,_0x2eca51){extensions[_0x632b('0xc')](_0x24ceab,_0x359d6e);}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index a048467..50b64c2 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 _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x54b283,_0x5eb8a6){var _0x2462b3=function(_0x13fca7){while(--_0x13fca7){_0x54b283['push'](_0x54b283['shift']());}};_0x2462b3(++_0x5eb8a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'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['GetInterval']=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')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file +var _0xa9e0=['code','error','message','result','catch','Interval','findAll','options','raw','where','attributes','include','map','model','GetInterval','stringify','ShowInterval','find','then','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Interval,\x20%s,\x20%s','request\x20sent','debug','Interval,\x20%s,\x20%s,\x20%s'];(function(_0x4854d6,_0x2f1264){var _0x3885c0=function(_0x4d564d){while(--_0x4d564d){_0x4854d6['push'](_0x4854d6['shift']());}};_0x3885c0(++_0x2f1264);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'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['GetInterval']=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')]));});});};exports[_0x0a9e('0x1f')]=function(_0x2ec755){var _0x5c877d=this;return new Promise(function(_0x15b200,_0x40e7a3){return db[_0x0a9e('0x14')][_0x0a9e('0x20')]({'raw':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x17')]===undefined?!![]:![]:!![],'where':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')]['where']||null:null,'attributes':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755['options'][_0x0a9e('0x19')]||null:null,'include':_0x2ec755[_0x0a9e('0x16')]?_0x2ec755[_0x0a9e('0x16')][_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x2ec755['options'][_0x0a9e('0x1a')],function(_0x46f0a5){return{'model':db[_0x46f0a5[_0x0a9e('0x1c')]],'as':_0x46f0a5['as'],'attributes':_0x46f0a5[_0x0a9e('0x19')],'include':_0x46f0a5[_0x0a9e('0x1a')]?_[_0x0a9e('0x1b')](_0x46f0a5[_0x0a9e('0x1a')],function(_0x39e565){return{'model':db[_0x39e565['model']],'as':_0x39e565['as'],'attributes':_0x39e565[_0x0a9e('0x19')],'include':_0x39e565['include']?_[_0x0a9e('0x1b')](_0x39e565[_0x0a9e('0x1a')],function(_0x2b7e7f){return{'model':db[_0x2b7e7f[_0x0a9e('0x1c')]],'as':_0x2b7e7f['as'],'attributes':_0x2b7e7f['attributes']};}):[]};}):[]};}):[]:[]})[_0x0a9e('0x21')](function(_0xd1836d){logger[_0x0a9e('0xa')](_0x0a9e('0x1f'),_0x2ec755);logger['debug']('ShowInterval',_0x2ec755,JSON[_0x0a9e('0x1e')](_0xd1836d));_0x15b200(_0xd1836d);})['catch'](function(_0x24936a){logger[_0x0a9e('0x10')](_0x0a9e('0x1f'),_0x24936a[_0x0a9e('0x11')],_0x2ec755);_0x40e7a3(_0x5c877d['error'](0x1f4,_0x24936a[_0x0a9e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index 04f12a6..c1c9350 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 _0x5f66=['send','exports','Router','./jira.controller','post','isAuthenticated'];(function(_0x18d631,_0x4376d2){var _0x50d708=function(_0x3b6ab5){while(--_0x3b6ab5){_0x18d631['push'](_0x18d631['shift']());}};_0x50d708(++_0x4376d2);}(_0x5f66,0x1a0));var _0x65f6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x5f66[_0x126558];return _0x1f6d14;};'use strict';var express=require('express');var router=express[_0x65f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x65f6('0x1'));router[_0x65f6('0x2')]('/',auth[_0x65f6('0x3')](),controller[_0x65f6('0x4')]);module[_0x65f6('0x5')]=router; \ No newline at end of file +var _0x5f2f=['isAuthenticated','send','exports','express','Router','../../components/auth/service','./jira.controller','post'];(function(_0x4d2e81,_0x81fcd2){var _0x3c9ecd=function(_0x250d85){while(--_0x250d85){_0x4d2e81['push'](_0x4d2e81['shift']());}};_0x3c9ecd(++_0x81fcd2);}(_0x5f2f,0x73));var _0xf5f2=function(_0x8153ce,_0xcb6429){_0x8153ce=_0x8153ce-0x0;var _0x3294bc=_0x5f2f[_0x8153ce];return _0x3294bc;};'use strict';var express=require(_0xf5f2('0x0'));var router=express[_0xf5f2('0x1')]();var auth=require(_0xf5f2('0x2'));var controller=require(_0xf5f2('0x3'));router[_0xf5f2('0x4')]('/',auth[_0xf5f2('0x5')](),controller[_0xf5f2('0x6')]);module[_0xf5f2('0x7')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 0ea00f5..854910d 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 _0x344c=['newToken','name','reason','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','stringify','request','setEncoding','utf8','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','openIssue','send','body','headers','x-forwarded-for','connection','remoteAddress','socket','https','api','support','3eAmWpBVP0','key','MOTGUI','Report','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','customfield_11502'];(function(_0xfd21e2,_0x4578a5){var _0x495674=function(_0xeccffe){while(--_0xeccffe){_0xfd21e2['push'](_0xfd21e2['shift']());}};_0x495674(++_0x4578a5);}(_0x344c,0x161));var _0xc344=function(_0x4093aa,_0x2a109a){_0x4093aa=_0x4093aa-0x0;var _0x11f087=_0x344c[_0x4093aa];return _0x11f087;};'use strict';var BPromise=require('bluebird');var https=require(_0xc344('0x0'));var logger=require('../../config/logger')(_0xc344('0x1'));var USERNAME=_0xc344('0x2');var PASSWORD=_0xc344('0x3');function openIssue(_0xb0f5c1,_0x254291){var _0x371405={'fields':{'project':{'key':_0xb0f5c1[_0xc344('0x4')]||_0xc344('0x5')},'summary':(_0xb0f5c1['summary']||_0xc344('0x6'))+'\x20from\x20'+_0xb0f5c1['ip'],'description':_0xb0f5c1['description']||JSON['stringify'](_0xb0f5c1),'issuetype':{'name':_0xb0f5c1[_0xc344('0x7')]||_0xc344('0x8')}}};_0x371405[_0xc344('0x9')][_0xc344('0xa')]=_0xb0f5c1[_0xc344('0xb')];_0x371405[_0xc344('0x9')][_0xc344('0xc')]=_0xb0f5c1[_0xc344('0xd')];_0x371405[_0xc344('0x9')][_0xc344('0xe')]=_0xb0f5c1[_0xc344('0xf')];_0x371405[_0xc344('0x9')]['customfield_11503']=_0xb0f5c1[_0xc344('0x10')];_0x371405[_0xc344('0x9')]['customfield_11504']=_0xb0f5c1[_0xc344('0x11')];_0x371405['fields']['customfield_10102']=_0xb0f5c1['ip'];var _0x5c23ff={'host':_0xc344('0x12'),'port':0x1bb,'path':_0xc344('0x13'),'method':_0xc344('0x14'),'timeout':0x4e20,'headers':{'Content-Type':_0xc344('0x15'),'Authorization':_0xc344('0x16')+new Buffer(USERNAME+':'+PASSWORD)[_0xc344('0x17')](_0xc344('0x18'))}};var _0x595517=JSON[_0xc344('0x19')](_0x371405);var _0x5a7d20=https[_0xc344('0x1a')](_0x5c23ff,function(_0x24171f){_0x24171f[_0xc344('0x1b')](_0xc344('0x1c'));var _0x49159f='';_0x24171f['on'](_0xc344('0x1d'),function(_0x163a7a){_0x49159f+=_0x163a7a;});_0x24171f['on'](_0xc344('0x1e'),function(){if(_0x254291){return _0x254291[_0xc344('0x1f')](_0x24171f[_0xc344('0x20')])[_0xc344('0x21')](JSON[_0xc344('0x22')](_0x49159f));}});});_0x5a7d20['on']('error',function(_0x33f515){if(_0x254291){return _0x254291['status'](0x1f4)['json']({'errors':[{'message':_0xc344('0x23'),'type':_0xc344('0x24')}]});}});_0x5a7d20[_0xc344('0x25')](_0x595517);_0x5a7d20['end']();}exports[_0xc344('0x26')]=openIssue;exports[_0xc344('0x27')]=function(_0x25e15f,_0x38ee92){_0x25e15f[_0xc344('0x28')]['ip']=_0x25e15f[_0xc344('0x29')][_0xc344('0x2a')]||_0x25e15f[_0xc344('0x2b')][_0xc344('0x2c')]||_0x25e15f[_0xc344('0x2d')][_0xc344('0x2c')]||_0x25e15f[_0xc344('0x2b')]['socket']['remoteAddress'];return openIssue(_0x25e15f[_0xc344('0x28')],_0x38ee92);}; \ No newline at end of file +var _0xa23b=['reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','toString','base64','stringify','request','setEncoding','utf8','status','parse','error','json','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','body','x-forwarded-for','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','3eAmWpBVP0','MOTGUI','summary','Report','\x20from\x20','description','issuetype','Bug','fields','customfield_11500','email','customfield_11501','oldToken','newToken','customfield_11503','name','customfield_11504'];(function(_0x5a7dd3,_0x26b7cf){var _0x2f4d07=function(_0x280510){while(--_0x280510){_0x5a7dd3['push'](_0x5a7dd3['shift']());}};_0x2f4d07(++_0x26b7cf);}(_0xa23b,0x6e));var _0xba23=function(_0x1f6da2,_0x16cd49){_0x1f6da2=_0x1f6da2-0x0;var _0x3f17e2=_0xa23b[_0x1f6da2];return _0x3f17e2;};'use strict';var BPromise=require(_0xba23('0x0'));var https=require(_0xba23('0x1'));var logger=require(_0xba23('0x2'))(_0xba23('0x3'));var USERNAME=_0xba23('0x4');var PASSWORD=_0xba23('0x5');function openIssue(_0x51ae5a,_0x246d00){var _0x14ddc5={'fields':{'project':{'key':_0x51ae5a['key']||_0xba23('0x6')},'summary':(_0x51ae5a[_0xba23('0x7')]||_0xba23('0x8'))+_0xba23('0x9')+_0x51ae5a['ip'],'description':_0x51ae5a[_0xba23('0xa')]||JSON['stringify'](_0x51ae5a),'issuetype':{'name':_0x51ae5a[_0xba23('0xb')]||_0xba23('0xc')}}};_0x14ddc5[_0xba23('0xd')][_0xba23('0xe')]=_0x51ae5a[_0xba23('0xf')];_0x14ddc5['fields'][_0xba23('0x10')]=_0x51ae5a[_0xba23('0x11')];_0x14ddc5[_0xba23('0xd')]['customfield_11502']=_0x51ae5a[_0xba23('0x12')];_0x14ddc5['fields'][_0xba23('0x13')]=_0x51ae5a[_0xba23('0x14')];_0x14ddc5[_0xba23('0xd')][_0xba23('0x15')]=_0x51ae5a[_0xba23('0x16')];_0x14ddc5[_0xba23('0xd')][_0xba23('0x17')]=_0x51ae5a['ip'];var _0x3de45f={'host':_0xba23('0x18'),'port':0x1bb,'path':_0xba23('0x19'),'method':_0xba23('0x1a'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':'Basic\x20'+new Buffer(USERNAME+':'+PASSWORD)[_0xba23('0x1b')](_0xba23('0x1c'))}};var _0x3a97e6=JSON[_0xba23('0x1d')](_0x14ddc5);var _0xac2df3=https[_0xba23('0x1e')](_0x3de45f,function(_0xa309c){_0xa309c[_0xba23('0x1f')](_0xba23('0x20'));var _0x3fcc58='';_0xa309c['on']('data',function(_0x419037){_0x3fcc58+=_0x419037;});_0xa309c['on']('end',function(){if(_0x246d00){return _0x246d00[_0xba23('0x21')](_0xa309c['statusCode'])['json'](JSON[_0xba23('0x22')](_0x3fcc58));}});});_0xac2df3['on'](_0xba23('0x23'),function(_0x43f241){if(_0x246d00){return _0x246d00[_0xba23('0x21')](0x1f4)[_0xba23('0x24')]({'errors':[{'message':_0xba23('0x25'),'type':_0xba23('0x26')}]});}});_0xac2df3['write'](_0x3a97e6);_0xac2df3['end']();}exports['openIssue']=openIssue;exports['send']=function(_0x3ea5ba,_0x466b47){_0x3ea5ba[_0xba23('0x27')]['ip']=_0x3ea5ba['headers'][_0xba23('0x28')]||_0x3ea5ba[_0xba23('0x29')][_0xba23('0x2a')]||_0x3ea5ba[_0xba23('0x2b')][_0xba23('0x2a')]||_0x3ea5ba['connection']['socket'][_0xba23('0x2a')];return openIssue(_0x3ea5ba[_0xba23('0x27')],_0x466b47);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index a94b4b8..0f6e54c 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 _0xd2ea=['./jscriptyAnswerReport.controller','get','isAuthenticated','/describe','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x1d8d41,_0x165386){var _0x2e697f=function(_0x572015){while(--_0x572015){_0x1d8d41['push'](_0x1d8d41['shift']());}};_0x2e697f(++_0x165386);}(_0xd2ea,0x15f));var _0xad2e=function(_0xf3c385,_0x24d554){_0xf3c385=_0xf3c385-0x0;var _0xd72991=_0xd2ea[_0xf3c385];return _0xd72991;};'use strict';var multer=require(_0xad2e('0x0'));var util=require(_0xad2e('0x1'));var path=require(_0xad2e('0x2'));var timeout=require(_0xad2e('0x3'));var express=require(_0xad2e('0x4'));var router=express['Router']();var fs_extra=require(_0xad2e('0x5'));var auth=require(_0xad2e('0x6'));var interaction=require(_0xad2e('0x7'));var config=require(_0xad2e('0x8'));var controller=require(_0xad2e('0x9'));router[_0xad2e('0xa')]('/',auth[_0xad2e('0xb')](),controller['index']);router[_0xad2e('0xa')](_0xad2e('0xc'),auth[_0xad2e('0xb')](),controller['describe']);router[_0xad2e('0xa')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0xe')]);router['post']('/',auth[_0xad2e('0xb')](),controller[_0xad2e('0xf')]);router[_0xad2e('0x10')](_0xad2e('0xd'),auth['isAuthenticated'](),controller[_0xad2e('0x11')]);router['delete'](_0xad2e('0xd'),auth[_0xad2e('0xb')](),controller[_0xad2e('0x12')]);module[_0xad2e('0x13')]=router; \ No newline at end of file +var _0x70e0=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyAnswerReport.controller','isAuthenticated','describe','get','/:id','show','post','put','update','delete','destroy','exports','multer'];(function(_0x1b766e,_0x499ff2){var _0xc68019=function(_0x5c4b0e){while(--_0x5c4b0e){_0x1b766e['push'](_0x1b766e['shift']());}};_0xc68019(++_0x499ff2);}(_0x70e0,0x17b));var _0x070e=function(_0x29d50b,_0x22cd93){_0x29d50b=_0x29d50b-0x0;var _0x29268c=_0x70e0[_0x29d50b];return _0x29268c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');var controller=require(_0x070e('0x7'));router['get']('/',auth[_0x070e('0x8')](),controller['index']);router['get']('/describe',auth[_0x070e('0x8')](),controller[_0x070e('0x9')]);router[_0x070e('0xa')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xc')]);router[_0x070e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x070e('0xe')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0xf')]);router[_0x070e('0x10')](_0x070e('0xb'),auth[_0x070e('0x8')](),controller[_0x070e('0x11')]);module[_0x070e('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index c628fbe..e530bd0 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 _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x5acce1,_0x27fa70){_0x5acce1=_0x5acce1-0x0;var _0x35168e=_0x7a54[_0x5acce1];return _0x35168e;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0xa148b7,_0x2f3eb2){var _0x51efd3=function(_0x34bcec){while(--_0x34bcec){_0xa148b7['push'](_0xa148b7['shift']());}};_0x51efd3(++_0x2f3eb2);}(_0x7a54,0x106));var _0x47a5=function(_0x25d5aa,_0x5ea672){_0x25d5aa=_0x25d5aa-0x0;var _0x58c24b=_0x7a54[_0x25d5aa];return _0x58c24b;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 15c167f..f67f61e 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 _0x72a2=['json','undefined','count','offset','limit','status','set','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','fs-extra','lodash','squel','crypto','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end'];(function(_0x266ddc,_0x45aa52){var _0x39c1d7=function(_0x4cd07c){while(--_0x4cd07c){_0x266ddc['push'](_0x266ddc['shift']());}};_0x39c1d7(++_0x45aa52);}(_0x72a2,0x161));var _0x272a=function(_0x2c7111,_0x5542bf){_0x2c7111=_0x2c7111-0x0;var _0x4f6ec0=_0x72a2[_0x2c7111];return _0x4f6ec0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x272a('0x0'));var zipdir=require(_0x272a('0x1'));var jsonpatch=require(_0x272a('0x2'));var rp=require(_0x272a('0x3'));var moment=require(_0x272a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x272a('0x5'));var util=require('util');var path=require(_0x272a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x272a('0x7'));var _=require(_0x272a('0x8'));var squel=require(_0x272a('0x9'));var crypto=require(_0x272a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x272a('0xb'));var querystring=require('querystring');var Papa=require(_0x272a('0xc'));var Redis=require('ioredis');var authService=require(_0x272a('0xd'));var qs=require(_0x272a('0xe'));var as=require(_0x272a('0xf'));var hardwareService=require(_0x272a('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0x272a('0x11'));var config=require(_0x272a('0x12'));var licenseUtil=require('../../config/license/util');var db=require(_0x272a('0x13'))['db'];function respondWithStatusCode(_0x7cb1fe,_0x37ee7e){_0x37ee7e=_0x37ee7e||0xcc;return function(_0xa82788){if(_0xa82788){return _0x7cb1fe[_0x272a('0x14')](_0x37ee7e);}return _0x7cb1fe['status'](_0x37ee7e)[_0x272a('0x15')]();};}function respondWithResult(_0x2143a4,_0x43fce6){_0x43fce6=_0x43fce6||0xc8;return function(_0x167a72){if(_0x167a72){return _0x2143a4['status'](_0x43fce6)[_0x272a('0x16')](_0x167a72);}};}function respondWithFilteredResult(_0x9414d6,_0x5b615a){return function(_0x4e3661){if(_0x4e3661){var _0x4cfb67=typeof _0x5b615a['offset']==='undefined'&&typeof _0x5b615a['limit']===_0x272a('0x17');var _0x48bf3d=_0x4e3661[_0x272a('0x18')];var _0x327f68=_0x4cfb67?0x0:_0x5b615a[_0x272a('0x19')];var _0x3325b2=_0x4cfb67?_0x4e3661['count']:_0x5b615a[_0x272a('0x19')]+_0x5b615a[_0x272a('0x1a')];var _0x2675be;if(_0x3325b2>=_0x48bf3d){_0x3325b2=_0x48bf3d;_0x2675be=0xc8;}else{_0x2675be=0xce;}_0x9414d6[_0x272a('0x1b')](_0x2675be);return _0x9414d6[_0x272a('0x1c')](_0x272a('0x1d'),_0x327f68+'-'+_0x3325b2+'/'+_0x48bf3d)[_0x272a('0x16')](_0x4e3661);}return null;};}function patchUpdates(_0x5cc0d6){return function(_0x393e68){try{jsonpatch[_0x272a('0x1e')](_0x393e68,_0x5cc0d6,!![]);}catch(_0x12c1c3){return BPromise[_0x272a('0x1f')](_0x12c1c3);}return _0x393e68[_0x272a('0x20')]();};}function saveUpdates(_0x297562,_0x4ac0bb){return function(_0x1bfe85){if(_0x1bfe85){return _0x1bfe85['update'](_0x297562)[_0x272a('0x21')](function(_0x504868){return _0x504868;});}return null;};}function removeEntity(_0x3ec1c3,_0x5a7003){return function(_0x13081e){if(_0x13081e){return _0x13081e[_0x272a('0x22')]()[_0x272a('0x21')](function(){_0x3ec1c3[_0x272a('0x1b')](0xcc)[_0x272a('0x15')]();});}};}function handleEntityNotFound(_0x4554b1,_0x15d35c){return function(_0x8138e2){if(!_0x8138e2){_0x4554b1[_0x272a('0x14')](0x194);}return _0x8138e2;};}function handleError(_0x4d1293,_0xc743bc){_0xc743bc=_0xc743bc||0x1f4;return function(_0x6312d4){logger[_0x272a('0x23')](_0x6312d4[_0x272a('0x24')]);if(_0x6312d4[_0x272a('0x25')]){delete _0x6312d4['name'];}_0x4d1293['status'](_0xc743bc)[_0x272a('0x26')](_0x6312d4);};}exports[_0x272a('0x27')]=function(_0x654dc6,_0x1bce15){var _0x62a99c={},_0x73707b={},_0x10d03c={'count':0x0,'rows':[]};var _0x142f1=_[_0x272a('0x28')](db[_0x272a('0x29')][_0x272a('0x2a')],function(_0x5104f3){return{'name':_0x5104f3['fieldName'],'type':_0x5104f3['type'][_0x272a('0x2b')]};});_0x73707b['model']=_[_0x272a('0x28')](_0x142f1,_0x272a('0x25'));_0x73707b['query']=_[_0x272a('0x2c')](_0x654dc6[_0x272a('0x2d')]);_0x73707b[_0x272a('0x2e')]=_[_0x272a('0x2f')](_0x73707b[_0x272a('0x30')],_0x73707b[_0x272a('0x2d')]);_0x62a99c[_0x272a('0x31')]=_[_0x272a('0x2f')](_0x73707b['model'],qs[_0x272a('0x32')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x32')]));_0x62a99c['attributes']=_0x62a99c[_0x272a('0x31')]['length']?_0x62a99c['attributes']:_0x73707b[_0x272a('0x30')];if(!_0x654dc6['query'][_0x272a('0x33')](_0x272a('0x34'))){_0x62a99c[_0x272a('0x1a')]=qs[_0x272a('0x1a')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x1a')]);_0x62a99c['offset']=qs[_0x272a('0x19')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x19')]);}_0x62a99c[_0x272a('0x35')]=qs[_0x272a('0x36')](_0x654dc6[_0x272a('0x2d')][_0x272a('0x36')]);_0x62a99c['where']=qs[_0x272a('0x2e')](_[_0x272a('0x37')](_0x654dc6[_0x272a('0x2d')],_0x73707b[_0x272a('0x2e')]),_0x142f1);if(_0x654dc6[_0x272a('0x2d')][_0x272a('0x38')]){_0x62a99c['where']=_['merge'](_0x62a99c[_0x272a('0x39')],{'$or':_[_0x272a('0x28')](_0x142f1,function(_0x20e5b6){if(_0x20e5b6[_0x272a('0x3a')]!==_0x272a('0x3b')){var _0xf9b46={};_0xf9b46[_0x20e5b6[_0x272a('0x25')]]={'$like':'%'+_0x654dc6[_0x272a('0x2d')][_0x272a('0x38')]+'%'};return _0xf9b46;}})});}_0x62a99c=_[_0x272a('0x3c')]({},_0x62a99c,_0x654dc6[_0x272a('0x3d')]);var _0x46227e={'where':_0x62a99c[_0x272a('0x39')]};return db[_0x272a('0x29')][_0x272a('0x18')](_0x46227e)['then'](function(_0x33abdd){_0x10d03c[_0x272a('0x18')]=_0x33abdd;if(_0x654dc6['query'][_0x272a('0x3e')]){_0x62a99c[_0x272a('0x3f')]=[{'all':!![]}];}return db[_0x272a('0x29')][_0x272a('0x40')](_0x62a99c);})[_0x272a('0x21')](function(_0x357712){_0x10d03c[_0x272a('0x41')]=_0x357712;return _0x10d03c;})['then'](respondWithFilteredResult(_0x1bce15,_0x62a99c))[_0x272a('0x42')](handleError(_0x1bce15,null));};exports[_0x272a('0x43')]=function(_0x5a7a12,_0x48c7b0){var _0x35be0e={'raw':!![],'where':{'id':_0x5a7a12[_0x272a('0x44')]['id']}},_0x47fcbd={};_0x47fcbd[_0x272a('0x30')]=_[_0x272a('0x2c')](db[_0x272a('0x29')][_0x272a('0x2a')]);_0x47fcbd[_0x272a('0x2d')]=_['keys'](_0x5a7a12[_0x272a('0x2d')]);_0x47fcbd[_0x272a('0x2e')]=_['intersection'](_0x47fcbd[_0x272a('0x30')],_0x47fcbd[_0x272a('0x2d')]);_0x35be0e['attributes']=_[_0x272a('0x2f')](_0x47fcbd[_0x272a('0x30')],qs[_0x272a('0x32')](_0x5a7a12[_0x272a('0x2d')][_0x272a('0x32')]));_0x35be0e[_0x272a('0x31')]=_0x35be0e['attributes'][_0x272a('0x45')]?_0x35be0e[_0x272a('0x31')]:_0x47fcbd[_0x272a('0x30')];if(_0x5a7a12['query'][_0x272a('0x3e')]){_0x35be0e[_0x272a('0x3f')]=[{'all':!![]}];}_0x35be0e=_['merge']({},_0x35be0e,_0x5a7a12[_0x272a('0x3d')]);return db[_0x272a('0x29')][_0x272a('0x46')](_0x35be0e)[_0x272a('0x21')](handleEntityNotFound(_0x48c7b0,null))[_0x272a('0x21')](respondWithResult(_0x48c7b0,null))[_0x272a('0x42')](handleError(_0x48c7b0,null));};exports[_0x272a('0x47')]=function(_0x4d2f43,_0x53a627){return db['JscriptyAnswerReport']['create'](_0x4d2f43[_0x272a('0x48')],{})[_0x272a('0x21')](respondWithResult(_0x53a627,0xc9))[_0x272a('0x42')](handleError(_0x53a627,null));};exports[_0x272a('0x49')]=function(_0x4bb335,_0x96d803){if(_0x4bb335[_0x272a('0x48')]['id']){delete _0x4bb335['body']['id'];}return db[_0x272a('0x29')][_0x272a('0x46')]({'where':{'id':_0x4bb335[_0x272a('0x44')]['id']}})[_0x272a('0x21')](handleEntityNotFound(_0x96d803,null))[_0x272a('0x21')](saveUpdates(_0x4bb335[_0x272a('0x48')],null))[_0x272a('0x21')](respondWithResult(_0x96d803,null))[_0x272a('0x42')](handleError(_0x96d803,null));};exports[_0x272a('0x22')]=function(_0x961994,_0x313723){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x961994[_0x272a('0x44')]['id']}})['then'](handleEntityNotFound(_0x313723,null))[_0x272a('0x21')](removeEntity(_0x313723,null))[_0x272a('0x42')](handleError(_0x313723,null));};exports[_0x272a('0x4a')]=function(_0xc9e362,_0x40c86c){return db['JscriptyAnswerReport']['describe']()[_0x272a('0x21')](respondWithResult(_0x40c86c,null))['catch'](handleError(_0x40c86c,null));}; \ No newline at end of file +var _0x46ed=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','limit','undefined','set','Content-Range','json','apply','reject','update','then','stack','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0x46ed,0x168));var _0xd46e=function(_0x4e676e,_0x2a7c6d){_0x4e676e=_0x4e676e-0x0;var _0x336a3c=_0x46ed[_0x4e676e];return _0x336a3c;};'use strict';var emlformat=require(_0xd46e('0x0'));var rimraf=require(_0xd46e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd46e('0x2'));var rp=require(_0xd46e('0x3'));var moment=require(_0xd46e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd46e('0x5'));var util=require(_0xd46e('0x6'));var path=require('path');var sox=require(_0xd46e('0x7'));var csv=require(_0xd46e('0x8'));var ejs=require(_0xd46e('0x9'));var fs=require('fs');var fs_extra=require(_0xd46e('0xa'));var _=require(_0xd46e('0xb'));var squel=require(_0xd46e('0xc'));var crypto=require(_0xd46e('0xd'));var jsforce=require(_0xd46e('0xe'));var deskjs=require(_0xd46e('0xf'));var toCsv=require(_0xd46e('0x8'));var querystring=require(_0xd46e('0x10'));var Papa=require('papaparse');var Redis=require(_0xd46e('0x11'));var authService=require(_0xd46e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xd46e('0x13'));var hardwareService=require(_0xd46e('0x14'));var logger=require(_0xd46e('0x15'))(_0xd46e('0x16'));var utils=require(_0xd46e('0x17'));var config=require(_0xd46e('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xd46e('0x19'))['db'];function respondWithStatusCode(_0x5bc1da,_0x48550b){_0x48550b=_0x48550b||0xcc;return function(_0xf3048c){if(_0xf3048c){return _0x5bc1da[_0xd46e('0x1a')](_0x48550b);}return _0x5bc1da['status'](_0x48550b)['end']();};}function respondWithResult(_0xacd799,_0x4688ae){_0x4688ae=_0x4688ae||0xc8;return function(_0x1e9aae){if(_0x1e9aae){return _0xacd799[_0xd46e('0x1b')](_0x4688ae)['json'](_0x1e9aae);}};}function respondWithFilteredResult(_0x3b6d25,_0x44a620){return function(_0x417402){if(_0x417402){var _0x3d72ce=typeof _0x44a620[_0xd46e('0x1c')]==='undefined'&&typeof _0x44a620[_0xd46e('0x1d')]===_0xd46e('0x1e');var _0x3583a5=_0x417402['count'];var _0x5ddd04=_0x3d72ce?0x0:_0x44a620[_0xd46e('0x1c')];var _0x1bd574=_0x3d72ce?_0x417402['count']:_0x44a620['offset']+_0x44a620[_0xd46e('0x1d')];var _0x2f2571;if(_0x1bd574>=_0x3583a5){_0x1bd574=_0x3583a5;_0x2f2571=0xc8;}else{_0x2f2571=0xce;}_0x3b6d25[_0xd46e('0x1b')](_0x2f2571);return _0x3b6d25[_0xd46e('0x1f')](_0xd46e('0x20'),_0x5ddd04+'-'+_0x1bd574+'/'+_0x3583a5)[_0xd46e('0x21')](_0x417402);}return null;};}function patchUpdates(_0x3b5fa4){return function(_0x327b7e){try{jsonpatch[_0xd46e('0x22')](_0x327b7e,_0x3b5fa4,!![]);}catch(_0x3c7e91){return BPromise[_0xd46e('0x23')](_0x3c7e91);}return _0x327b7e['save']();};}function saveUpdates(_0x259072,_0x1c83fa){return function(_0x79aa51){if(_0x79aa51){return _0x79aa51[_0xd46e('0x24')](_0x259072)[_0xd46e('0x25')](function(_0xc1af7f){return _0xc1af7f;});}return null;};}function removeEntity(_0x33c2e0,_0x8a1be){return function(_0x62dea5){if(_0x62dea5){return _0x62dea5['destroy']()[_0xd46e('0x25')](function(){_0x33c2e0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x371054,_0x2a5271){return function(_0x21135f){if(!_0x21135f){_0x371054[_0xd46e('0x1a')](0x194);}return _0x21135f;};}function handleError(_0x247b9f,_0x180851){_0x180851=_0x180851||0x1f4;return function(_0x1740d1){logger['error'](_0x1740d1[_0xd46e('0x26')]);if(_0x1740d1[_0xd46e('0x27')]){delete _0x1740d1[_0xd46e('0x27')];}_0x247b9f[_0xd46e('0x1b')](_0x180851)[_0xd46e('0x28')](_0x1740d1);};}exports[_0xd46e('0x29')]=function(_0x58aeef,_0x465d54){var _0x3a1ced={},_0x2d1afe={},_0xa716ce={'count':0x0,'rows':[]};var _0x106edc=_[_0xd46e('0x2a')](db[_0xd46e('0x2b')][_0xd46e('0x2c')],function(_0x18f060){return{'name':_0x18f060[_0xd46e('0x2d')],'type':_0x18f060[_0xd46e('0x2e')][_0xd46e('0x2f')]};});_0x2d1afe[_0xd46e('0x30')]=_['map'](_0x106edc,_0xd46e('0x27'));_0x2d1afe[_0xd46e('0x31')]=_[_0xd46e('0x32')](_0x58aeef[_0xd46e('0x31')]);_0x2d1afe['filters']=_[_0xd46e('0x33')](_0x2d1afe[_0xd46e('0x30')],_0x2d1afe['query']);_0x3a1ced[_0xd46e('0x34')]=_[_0xd46e('0x33')](_0x2d1afe['model'],qs[_0xd46e('0x35')](_0x58aeef[_0xd46e('0x31')][_0xd46e('0x35')]));_0x3a1ced['attributes']=_0x3a1ced['attributes'][_0xd46e('0x36')]?_0x3a1ced[_0xd46e('0x34')]:_0x2d1afe[_0xd46e('0x30')];if(!_0x58aeef[_0xd46e('0x31')][_0xd46e('0x37')](_0xd46e('0x38'))){_0x3a1ced[_0xd46e('0x1d')]=qs[_0xd46e('0x1d')](_0x58aeef['query'][_0xd46e('0x1d')]);_0x3a1ced[_0xd46e('0x1c')]=qs[_0xd46e('0x1c')](_0x58aeef[_0xd46e('0x31')][_0xd46e('0x1c')]);}_0x3a1ced[_0xd46e('0x39')]=qs[_0xd46e('0x3a')](_0x58aeef['query'][_0xd46e('0x3a')]);_0x3a1ced[_0xd46e('0x3b')]=qs['filters'](_[_0xd46e('0x3c')](_0x58aeef[_0xd46e('0x31')],_0x2d1afe[_0xd46e('0x3d')]),_0x106edc);if(_0x58aeef[_0xd46e('0x31')]['filter']){_0x3a1ced[_0xd46e('0x3b')]=_[_0xd46e('0x3e')](_0x3a1ced[_0xd46e('0x3b')],{'$or':_[_0xd46e('0x2a')](_0x106edc,function(_0xefe5f4){if(_0xefe5f4[_0xd46e('0x2e')]!==_0xd46e('0x3f')){var _0x411318={};_0x411318[_0xefe5f4['name']]={'$like':'%'+_0x58aeef[_0xd46e('0x31')][_0xd46e('0x40')]+'%'};return _0x411318;}})});}_0x3a1ced=_[_0xd46e('0x3e')]({},_0x3a1ced,_0x58aeef[_0xd46e('0x41')]);var _0x165ce8={'where':_0x3a1ced['where']};return db[_0xd46e('0x2b')]['count'](_0x165ce8)['then'](function(_0x4c325f){_0xa716ce['count']=_0x4c325f;if(_0x58aeef[_0xd46e('0x31')]['includeAll']){_0x3a1ced[_0xd46e('0x42')]=[{'all':!![]}];}return db[_0xd46e('0x2b')]['findAll'](_0x3a1ced);})[_0xd46e('0x25')](function(_0x4114e6){_0xa716ce[_0xd46e('0x43')]=_0x4114e6;return _0xa716ce;})[_0xd46e('0x25')](respondWithFilteredResult(_0x465d54,_0x3a1ced))[_0xd46e('0x44')](handleError(_0x465d54,null));};exports[_0xd46e('0x45')]=function(_0x39ac57,_0xe75292){var _0x3a98e4={'raw':!![],'where':{'id':_0x39ac57[_0xd46e('0x46')]['id']}},_0xec367d={};_0xec367d['model']=_['keys'](db['JscriptyAnswerReport'][_0xd46e('0x2c')]);_0xec367d['query']=_[_0xd46e('0x32')](_0x39ac57[_0xd46e('0x31')]);_0xec367d[_0xd46e('0x3d')]=_[_0xd46e('0x33')](_0xec367d[_0xd46e('0x30')],_0xec367d[_0xd46e('0x31')]);_0x3a98e4[_0xd46e('0x34')]=_[_0xd46e('0x33')](_0xec367d['model'],qs[_0xd46e('0x35')](_0x39ac57['query'][_0xd46e('0x35')]));_0x3a98e4[_0xd46e('0x34')]=_0x3a98e4[_0xd46e('0x34')][_0xd46e('0x36')]?_0x3a98e4[_0xd46e('0x34')]:_0xec367d['model'];if(_0x39ac57[_0xd46e('0x31')][_0xd46e('0x47')]){_0x3a98e4[_0xd46e('0x42')]=[{'all':!![]}];}_0x3a98e4=_[_0xd46e('0x3e')]({},_0x3a98e4,_0x39ac57[_0xd46e('0x41')]);return db['JscriptyAnswerReport'][_0xd46e('0x48')](_0x3a98e4)[_0xd46e('0x25')](handleEntityNotFound(_0xe75292,null))[_0xd46e('0x25')](respondWithResult(_0xe75292,null))[_0xd46e('0x44')](handleError(_0xe75292,null));};exports[_0xd46e('0x49')]=function(_0x4a0d3a,_0x341d9f){return db[_0xd46e('0x2b')][_0xd46e('0x49')](_0x4a0d3a[_0xd46e('0x4a')],{})[_0xd46e('0x25')](respondWithResult(_0x341d9f,0xc9))[_0xd46e('0x44')](handleError(_0x341d9f,null));};exports[_0xd46e('0x24')]=function(_0x440dcc,_0x5188f6){if(_0x440dcc[_0xd46e('0x4a')]['id']){delete _0x440dcc[_0xd46e('0x4a')]['id'];}return db[_0xd46e('0x2b')][_0xd46e('0x48')]({'where':{'id':_0x440dcc[_0xd46e('0x46')]['id']}})['then'](handleEntityNotFound(_0x5188f6,null))['then'](saveUpdates(_0x440dcc[_0xd46e('0x4a')],null))[_0xd46e('0x25')](respondWithResult(_0x5188f6,null))[_0xd46e('0x44')](handleError(_0x5188f6,null));};exports['destroy']=function(_0x479711,_0x2ab5d8){return db[_0xd46e('0x2b')]['find']({'where':{'id':_0x479711[_0xd46e('0x46')]['id']}})[_0xd46e('0x25')](handleEntityNotFound(_0x2ab5d8,null))[_0xd46e('0x25')](removeEntity(_0x2ab5d8,null))[_0xd46e('0x44')](handleError(_0x2ab5d8,null));};exports[_0xd46e('0x4b')]=function(_0x34d4ca,_0x80ed51){return db[_0xd46e('0x2b')]['describe']()[_0xd46e('0x25')](respondWithResult(_0x80ed51,null))[_0xd46e('0x44')](handleError(_0x80ed51,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index ee0c240..62ac402 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 _0x3a73=['define','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes'];(function(_0x386d02,_0x55857f){var _0x4dff93=function(_0x5e621c){while(--_0x5e621c){_0x386d02['push'](_0x386d02['shift']());}};_0x4dff93(++_0x55857f);}(_0x3a73,0x93));var _0x33a7=function(_0x1a354e,_0x35a119){_0x1a354e=_0x1a354e-0x0;var _0xbb581c=_0x3a73[_0x1a354e];return _0xbb581c;};'use strict';var _=require(_0x33a7('0x0'));var util=require(_0x33a7('0x1'));var logger=require(_0x33a7('0x2'))(_0x33a7('0x3'));var moment=require(_0x33a7('0x4'));var BPromise=require('bluebird');var rp=require(_0x33a7('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x33a7('0x6'));var config=require(_0x33a7('0x7'));var attributes=require(_0x33a7('0x8'));module['exports']=function(_0xb7ab8a,_0x5f5dd6){return _0xb7ab8a[_0x33a7('0x9')](_0x33a7('0xa'),attributes,{'tableName':_0x33a7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7668=['../../config/environment','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','util','../../config/logger','request-promise','path','rimraf'];(function(_0x96f74c,_0xfc30a4){var _0x379222=function(_0x1bbde9){while(--_0x1bbde9){_0x96f74c['push'](_0x96f74c['shift']());}};_0x379222(++_0xfc30a4);}(_0x7668,0xea));var _0x8766=function(_0x337f9d,_0x361328){_0x337f9d=_0x337f9d-0x0;var _0x25c23a=_0x7668[_0x337f9d];return _0x25c23a;};'use strict';var _=require(_0x8766('0x0'));var util=require(_0x8766('0x1'));var logger=require(_0x8766('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x8766('0x3'));var fs=require('fs');var path=require(_0x8766('0x4'));var rimraf=require(_0x8766('0x5'));var config=require(_0x8766('0x6'));var attributes=require('./jscriptyAnswerReport.attributes');module[_0x8766('0x7')]=function(_0x4867df,_0x59d56f){return _0x4867df['define'](_0x8766('0x8'),attributes,{'tableName':_0x8766('0x9'),'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 3cd8b8f..933bd1f 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 _0xee39=['debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xee39,0x1b8));var _0x9ee3=function(_0x52c2aa,_0x24a6a7){_0x52c2aa=_0x52c2aa-0x0;var _0x48b74c=_0xee39[_0x52c2aa];return _0x48b74c;};'use strict';var _=require(_0x9ee3('0x0'));var util=require('util');var moment=require(_0x9ee3('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9ee3('0x2'));var db=require(_0x9ee3('0x3'))['db'];var utils=require(_0x9ee3('0x4'));var logger=require(_0x9ee3('0x5'))(_0x9ee3('0x6'));var config=require(_0x9ee3('0x7'));var jayson=require(_0x9ee3('0x8'));var client=jayson[_0x9ee3('0x9')][_0x9ee3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x414dcf,_0x4f8aa4,_0x47cfbc){return new BPromise(function(_0x1979d2,_0x56eae0){return client[_0x9ee3('0xb')](_0x414dcf,_0x47cfbc)[_0x9ee3('0xc')](function(_0x3674b3){logger[_0x9ee3('0xd')](_0x9ee3('0xe'),_0x4f8aa4,_0x9ee3('0xf'));logger[_0x9ee3('0x10')](_0x9ee3('0x11'),_0x4f8aa4,_0x9ee3('0xf'),JSON[_0x9ee3('0x12')](_0x3674b3));if(_0x3674b3[_0x9ee3('0x13')]){if(_0x3674b3[_0x9ee3('0x13')][_0x9ee3('0x14')]===0x1f4){logger[_0x9ee3('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f8aa4,_0x3674b3['error'][_0x9ee3('0x15')]);return _0x56eae0(_0x3674b3[_0x9ee3('0x13')]['message']);}logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f8aa4,_0x3674b3[_0x9ee3('0x13')]['message']);return _0x1979d2(_0x3674b3['error'][_0x9ee3('0x15')]);}else{logger[_0x9ee3('0xd')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x4f8aa4,_0x9ee3('0xf'));_0x1979d2(_0x3674b3[_0x9ee3('0x16')][_0x9ee3('0x15')]);}})[_0x9ee3('0x17')](function(_0x46e1c9){logger[_0x9ee3('0x13')](_0x9ee3('0xe'),_0x4f8aa4,_0x46e1c9);_0x56eae0(_0x46e1c9);});});} \ No newline at end of file +var _0x835a=['code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x386ff6,_0x3aaae3){var _0x1de35e=function(_0x31c264){while(--_0x31c264){_0x386ff6['push'](_0x386ff6['shift']());}};_0x1de35e(++_0x3aaae3);}(_0x835a,0x1b9));var _0xa835=function(_0x5f202c,_0x2410e4){_0x5f202c=_0x5f202c-0x0;var _0x47b94c=_0x835a[_0x5f202c];return _0x47b94c;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xa835('0x0'));var BPromise=require(_0xa835('0x1'));var rs=require(_0xa835('0x2'));var fs=require('fs');var Redis=require(_0xa835('0x3'));var db=require(_0xa835('0x4'))['db'];var utils=require(_0xa835('0x5'));var logger=require('../../config/logger')(_0xa835('0x6'));var config=require(_0xa835('0x7'));var jayson=require(_0xa835('0x8'));var client=jayson[_0xa835('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38fc67,_0x190ab5,_0x159a66){return new BPromise(function(_0x294602,_0x4c7218){return client[_0xa835('0xa')](_0x38fc67,_0x159a66)[_0xa835('0xb')](function(_0x464258){logger[_0xa835('0xc')](_0xa835('0xd'),_0x190ab5,'request\x20sent');logger[_0xa835('0xe')](_0xa835('0xf'),_0x190ab5,_0xa835('0x10'),JSON[_0xa835('0x11')](_0x464258));if(_0x464258[_0xa835('0x12')]){if(_0x464258[_0xa835('0x12')][_0xa835('0x13')]===0x1f4){logger['error'](_0xa835('0xd'),_0x190ab5,_0x464258[_0xa835('0x12')][_0xa835('0x14')]);return _0x4c7218(_0x464258['error'][_0xa835('0x14')]);}logger[_0xa835('0x12')](_0xa835('0xd'),_0x190ab5,_0x464258[_0xa835('0x12')][_0xa835('0x14')]);return _0x294602(_0x464258[_0xa835('0x12')][_0xa835('0x14')]);}else{logger[_0xa835('0xc')](_0xa835('0xd'),_0x190ab5,'request\x20sent');_0x294602(_0x464258[_0xa835('0x15')][_0xa835('0x14')]);}})[_0xa835('0x16')](function(_0x4a3b0e){logger['error']('JscriptyAnswerReport,\x20%s,\x20%s',_0x190ab5,_0x4a3b0e);_0x4c7218(_0x4a3b0e);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 0e00636..d62e524 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 _0xbecf=['/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','create','/:id/clone','put','update','delete','destroy','exports','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get'];(function(_0x49c2a7,_0x29abbb){var _0x48fd23=function(_0x57d7b1){while(--_0x57d7b1){_0x49c2a7['push'](_0x49c2a7['shift']());}};_0x48fd23(++_0x29abbb);}(_0xbecf,0x117));var _0xfbec=function(_0x240046,_0x51725b){_0x240046=_0x240046-0x0;var _0xabd9b7=_0xbecf[_0x240046];return _0xabd9b7;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfbec('0x0')]();var fs_extra=require(_0xfbec('0x1'));var auth=require(_0xfbec('0x2'));var interaction=require(_0xfbec('0x3'));var config=require(_0xfbec('0x4'));var controller=require(_0xfbec('0x5'));router['get']('/',auth[_0xfbec('0x6')](),controller[_0xfbec('0x7')]);router[_0xfbec('0x8')](_0xfbec('0x9'),auth['isAuthenticated'](),controller[_0xfbec('0xa')]);router[_0xfbec('0x8')](_0xfbec('0xb'),auth['isAuthenticated'](),controller[_0xfbec('0xc')]);router[_0xfbec('0x8')](_0xfbec('0xd'),auth['isAuthenticated'](),controller[_0xfbec('0xe')]);router[_0xfbec('0x8')](_0xfbec('0xf'),auth['isAuthenticated'](),timeout(_0xfbec('0x10')),controller['getSummary']);router['post']('/',auth[_0xfbec('0x6')](),controller[_0xfbec('0x11')]);router['post'](_0xfbec('0x12'),auth[_0xfbec('0x6')](),controller['clone']);router[_0xfbec('0x13')](_0xfbec('0x9'),auth['isAuthenticated'](),controller[_0xfbec('0x14')]);router[_0xfbec('0x15')](_0xfbec('0x9'),auth[_0xfbec('0x6')](),controller[_0xfbec('0x16')]);module[_0xfbec('0x17')]=router; \ No newline at end of file +var _0xb031=['/:id/sessions','/:id/answers','getAnswers','30s','getSummary','create','post','/:id/clone','clone','update','delete','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./jscriptyProject.controller','get','isAuthenticated','index','/:id','show'];(function(_0x56fd32,_0xb62583){var _0x33b787=function(_0x5ccde0){while(--_0x5ccde0){_0x56fd32['push'](_0x56fd32['shift']());}};_0x33b787(++_0xb62583);}(_0xb031,0x12b));var _0x1b03=function(_0x589aee,_0x140a03){_0x589aee=_0x589aee-0x0;var _0x2f5ed4=_0xb031[_0x589aee];return _0x2f5ed4;};'use strict';var multer=require(_0x1b03('0x0'));var util=require('util');var path=require(_0x1b03('0x1'));var timeout=require(_0x1b03('0x2'));var express=require('express');var router=express[_0x1b03('0x3')]();var fs_extra=require(_0x1b03('0x4'));var auth=require(_0x1b03('0x5'));var interaction=require(_0x1b03('0x6'));var config=require('../../config/environment');var controller=require(_0x1b03('0x7'));router[_0x1b03('0x8')]('/',auth[_0x1b03('0x9')](),controller[_0x1b03('0xa')]);router[_0x1b03('0x8')](_0x1b03('0xb'),auth[_0x1b03('0x9')](),controller[_0x1b03('0xc')]);router['get'](_0x1b03('0xd'),auth['isAuthenticated'](),controller['getSessions']);router[_0x1b03('0x8')](_0x1b03('0xe'),auth[_0x1b03('0x9')](),controller[_0x1b03('0xf')]);router['get']('/:id/summary',auth[_0x1b03('0x9')](),timeout(_0x1b03('0x10')),controller[_0x1b03('0x11')]);router['post']('/',auth[_0x1b03('0x9')](),controller[_0x1b03('0x12')]);router[_0x1b03('0x13')](_0x1b03('0x14'),auth['isAuthenticated'](),controller[_0x1b03('0x15')]);router['put']('/:id',auth[_0x1b03('0x9')](),controller[_0x1b03('0x16')]);router[_0x1b03('0x17')](_0x1b03('0xb'),auth[_0x1b03('0x9')](),controller[_0x1b03('0x18')]);module[_0x1b03('0x19')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index d19e4d5..96950b6 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 _0xee96=['isObjectLike','setDataValue','formData','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','BOOLEAN','sequelize','lodash','util','exports','STRING','name','TEXT','long'];(function(_0x58ded7,_0x3e3def){var _0x359cbc=function(_0x7bf528){while(--_0x7bf528){_0x58ded7['push'](_0x58ded7['shift']());}};_0x359cbc(++_0x3e3def);}(_0xee96,0x68));var _0x6ee9=function(_0x3b00bd,_0xae9a7d){_0x3b00bd=_0x3b00bd-0x0;var _0x19f50f=_0xee96[_0x3b00bd];return _0x19f50f;};'use strict';var Sequelize=require(_0x6ee9('0x0'));var _=require(_0x6ee9('0x1'));var util=require(_0x6ee9('0x2'));module[_0x6ee9('0x3')]={'name':{'type':Sequelize[_0x6ee9('0x4')],'unique':_0x6ee9('0x5')},'description':{'type':Sequelize[_0x6ee9('0x4')]},'formData':{'type':Sequelize[_0x6ee9('0x6')](_0x6ee9('0x7')),'set':function(_0xf19b2d){if(_[_0x6ee9('0x8')](_0xf19b2d)){this[_0x6ee9('0x9')](_0x6ee9('0xa'),JSON['stringify'](_0xf19b2d));}else if(_[_0x6ee9('0xb')](_0xf19b2d)){this[_0x6ee9('0x9')](_0x6ee9('0xa'),_0xf19b2d);}else{this['setDataValue'](_0x6ee9('0xa'),util[_0x6ee9('0xc')](_0x6ee9('0xd'),this[_0x6ee9('0xe')](_0x6ee9('0x5'))||'',this[_0x6ee9('0xe')]('description')||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x6ee9('0xf')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x6ee9('0xf')],'defaultValue':![]}}; \ No newline at end of file +var _0x18f6=['getDataValue','description','BOOLEAN','sequelize','lodash','util','STRING','long','isObjectLike','setDataValue','stringify','isString','formData','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}'];(function(_0x5d1594,_0x105585){var _0x5c4153=function(_0x19ea52){while(--_0x19ea52){_0x5d1594['push'](_0x5d1594['shift']());}};_0x5c4153(++_0x105585);}(_0x18f6,0xf1));var _0x618f=function(_0x3f2c85,_0x3651d0){_0x3f2c85=_0x3f2c85-0x0;var _0x1b7a0f=_0x18f6[_0x3f2c85];return _0x1b7a0f;};'use strict';var Sequelize=require(_0x618f('0x0'));var _=require(_0x618f('0x1'));var util=require(_0x618f('0x2'));module['exports']={'name':{'type':Sequelize[_0x618f('0x3')],'unique':'name'},'description':{'type':Sequelize[_0x618f('0x3')]},'formData':{'type':Sequelize['TEXT'](_0x618f('0x4')),'set':function(_0x24626e){if(_[_0x618f('0x5')](_0x24626e)){this[_0x618f('0x6')]('formData',JSON[_0x618f('0x7')](_0x24626e));}else if(_[_0x618f('0x8')](_0x24626e)){this['setDataValue'](_0x618f('0x9'),_0x24626e);}else{this[_0x618f('0x6')](_0x618f('0x9'),util['format'](_0x618f('0xa'),this[_0x618f('0xb')]('name')||'',this[_0x618f('0xb')](_0x618f('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x618f('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x618f('0xd')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e7d7410..1750807 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 _0x9ed4=['findAll','rows','show','length','include','find','create','role','user','UserProfileSection','userProfileId','autoAssociation','catch','clone','params','omit','createdAt','updatedAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','findOne','JscriptySessionReport','ProjectId','getAnswers','hasOwnProperty','JscriptyAnswerReport','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','-createdAt','questionId','question','format','SessionId','answer','push','isEmpty','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Content-type','/tmp/Jscripty_Project_%d_Summary_%s.csv','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','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','end','offset','undefined','limit','count','status','set','Content-Range','json','apply','save','update','then','destroy','get','Projects','UserProfileResource','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','JscriptyProject'];(function(_0x2053ea,_0x1ab2d4){var _0x2232c4=function(_0x4230df){while(--_0x4230df){_0x2053ea['push'](_0x2053ea['shift']());}};_0x2232c4(++_0x1ab2d4);}(_0x9ed4,0x1a7));var _0x49ed=function(_0x3c3d0c,_0x4acfbd){_0x3c3d0c=_0x3c3d0c-0x0;var _0x1fb2d0=_0x9ed4[_0x3c3d0c];return _0x1fb2d0;};'use strict';var emlformat=require(_0x49ed('0x0'));var rimraf=require(_0x49ed('0x1'));var zipdir=require(_0x49ed('0x2'));var jsonpatch=require(_0x49ed('0x3'));var rp=require(_0x49ed('0x4'));var moment=require(_0x49ed('0x5'));var BPromise=require(_0x49ed('0x6'));var Mustache=require(_0x49ed('0x7'));var util=require(_0x49ed('0x8'));var path=require(_0x49ed('0x9'));var sox=require(_0x49ed('0xa'));var csv=require('to-csv');var ejs=require(_0x49ed('0xb'));var fs=require('fs');var fs_extra=require(_0x49ed('0xc'));var _=require(_0x49ed('0xd'));var squel=require(_0x49ed('0xe'));var crypto=require(_0x49ed('0xf'));var jsforce=require(_0x49ed('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x49ed('0x11'));var Redis=require('ioredis');var authService=require(_0x49ed('0x12'));var qs=require(_0x49ed('0x13'));var as=require(_0x49ed('0x14'));var hardwareService=require(_0x49ed('0x15'));var logger=require(_0x49ed('0x16'))(_0x49ed('0x17'));var utils=require(_0x49ed('0x18'));var config=require(_0x49ed('0x19'));var licenseUtil=require(_0x49ed('0x1a'));var db=require(_0x49ed('0x1b'))['db'];function respondWithStatusCode(_0x45701a,_0xfa7166){_0xfa7166=_0xfa7166||0xcc;return function(_0xe3f11c){if(_0xe3f11c){return _0x45701a[_0x49ed('0x1c')](_0xfa7166);}return _0x45701a['status'](_0xfa7166)[_0x49ed('0x1d')]();};}function respondWithResult(_0x243361,_0x1f187b){_0x1f187b=_0x1f187b||0xc8;return function(_0x38c3f0){if(_0x38c3f0){return _0x243361['status'](_0x1f187b)['json'](_0x38c3f0);}};}function respondWithFilteredResult(_0xb263e1,_0x511674){return function(_0x5b8e91){if(_0x5b8e91){var _0x3b50aa=typeof _0x511674[_0x49ed('0x1e')]===_0x49ed('0x1f')&&typeof _0x511674[_0x49ed('0x20')]==='undefined';var _0x4c4220=_0x5b8e91[_0x49ed('0x21')];var _0x11f9b7=_0x3b50aa?0x0:_0x511674[_0x49ed('0x1e')];var _0x108a2b=_0x3b50aa?_0x5b8e91[_0x49ed('0x21')]:_0x511674[_0x49ed('0x1e')]+_0x511674[_0x49ed('0x20')];var _0x136340;if(_0x108a2b>=_0x4c4220){_0x108a2b=_0x4c4220;_0x136340=0xc8;}else{_0x136340=0xce;}_0xb263e1[_0x49ed('0x22')](_0x136340);return _0xb263e1[_0x49ed('0x23')](_0x49ed('0x24'),_0x11f9b7+'-'+_0x108a2b+'/'+_0x4c4220)[_0x49ed('0x25')](_0x5b8e91);}return null;};}function patchUpdates(_0x496661){return function(_0xd30fb1){try{jsonpatch[_0x49ed('0x26')](_0xd30fb1,_0x496661,!![]);}catch(_0x39623c){return BPromise['reject'](_0x39623c);}return _0xd30fb1[_0x49ed('0x27')]();};}function saveUpdates(_0x4c1268,_0x26809c){return function(_0x405b4a){if(_0x405b4a){return _0x405b4a[_0x49ed('0x28')](_0x4c1268)[_0x49ed('0x29')](function(_0x5a7140){return _0x5a7140;});}return null;};}function removeEntity(_0x1cb36f,_0x577c0a){return function(_0x42420f){if(_0x42420f){return _0x42420f[_0x49ed('0x2a')]()['then'](function(){var _0x34c176=_0x42420f[_0x49ed('0x2b')]({'plain':!![]});var _0x563c6e=_0x49ed('0x2c');return db[_0x49ed('0x2d')][_0x49ed('0x2a')]({'where':{'type':_0x563c6e,'resourceId':_0x34c176['id']}})[_0x49ed('0x29')](function(){return _0x42420f;});})[_0x49ed('0x29')](function(){_0x1cb36f[_0x49ed('0x22')](0xcc)['end']();});}};}function handleEntityNotFound(_0x44c3f0,_0x2cf518){return function(_0x1ed088){if(!_0x1ed088){_0x44c3f0[_0x49ed('0x1c')](0x194);}return _0x1ed088;};}function handleError(_0x5467fa,_0x16bf1d){_0x16bf1d=_0x16bf1d||0x1f4;return function(_0x27bf16){logger[_0x49ed('0x2e')](_0x27bf16[_0x49ed('0x2f')]);if(_0x27bf16['name']){delete _0x27bf16[_0x49ed('0x30')];}_0x5467fa[_0x49ed('0x22')](_0x16bf1d)[_0x49ed('0x31')](_0x27bf16);};}exports[_0x49ed('0x32')]=function(_0x17970c,_0x52e527){var _0x43ba82={},_0x10be5d={},_0x32bebf={'count':0x0,'rows':[]};var _0x3b2065=_[_0x49ed('0x33')](db['JscriptyProject'][_0x49ed('0x34')],function(_0x13e91d){return{'name':_0x13e91d[_0x49ed('0x35')],'type':_0x13e91d[_0x49ed('0x36')]['key']};});_0x10be5d[_0x49ed('0x37')]=_[_0x49ed('0x33')](_0x3b2065,_0x49ed('0x30'));_0x10be5d[_0x49ed('0x38')]=_[_0x49ed('0x39')](_0x17970c[_0x49ed('0x38')]);_0x10be5d[_0x49ed('0x3a')]=_['intersection'](_0x10be5d['model'],_0x10be5d[_0x49ed('0x38')]);_0x43ba82[_0x49ed('0x3b')]=_[_0x49ed('0x3c')](_0x10be5d[_0x49ed('0x37')],qs[_0x49ed('0x3d')](_0x17970c[_0x49ed('0x38')][_0x49ed('0x3d')]));_0x43ba82[_0x49ed('0x3b')]=_0x43ba82['attributes']['length']?_0x43ba82['attributes']:_0x10be5d[_0x49ed('0x37')];if(!_0x17970c[_0x49ed('0x38')]['hasOwnProperty'](_0x49ed('0x3e'))){_0x43ba82[_0x49ed('0x20')]=qs[_0x49ed('0x20')](_0x17970c['query']['limit']);_0x43ba82[_0x49ed('0x1e')]=qs[_0x49ed('0x1e')](_0x17970c[_0x49ed('0x38')]['offset']);}_0x43ba82[_0x49ed('0x3f')]=qs[_0x49ed('0x40')](_0x17970c['query'][_0x49ed('0x40')]);_0x43ba82['where']=qs[_0x49ed('0x3a')](_[_0x49ed('0x41')](_0x17970c[_0x49ed('0x38')],_0x10be5d[_0x49ed('0x3a')]),_0x3b2065);if(_0x17970c[_0x49ed('0x38')][_0x49ed('0x42')]){_0x43ba82[_0x49ed('0x43')]=_[_0x49ed('0x44')](_0x43ba82[_0x49ed('0x43')],{'$or':_[_0x49ed('0x33')](_0x3b2065,function(_0x11e5a4){if(_0x11e5a4[_0x49ed('0x36')]!==_0x49ed('0x45')){var _0xc7e52e={};_0xc7e52e[_0x11e5a4[_0x49ed('0x30')]]={'$like':'%'+_0x17970c['query'][_0x49ed('0x42')]+'%'};return _0xc7e52e;}})});}_0x43ba82=_['merge']({},_0x43ba82,_0x17970c[_0x49ed('0x46')]);var _0x9831dc={'where':_0x43ba82[_0x49ed('0x43')]};return db['JscriptyProject'][_0x49ed('0x21')](_0x9831dc)[_0x49ed('0x29')](function(_0xb020aa){_0x32bebf['count']=_0xb020aa;if(_0x17970c['query'][_0x49ed('0x47')]){_0x43ba82['include']=[{'all':!![]}];}return db[_0x49ed('0x48')][_0x49ed('0x49')](_0x43ba82);})[_0x49ed('0x29')](function(_0x156b8a){_0x32bebf[_0x49ed('0x4a')]=_0x156b8a;return _0x32bebf;})[_0x49ed('0x29')](respondWithFilteredResult(_0x52e527,_0x43ba82))['catch'](handleError(_0x52e527,null));};exports[_0x49ed('0x4b')]=function(_0x34b1c4,_0x51e657){var _0x18c788={'raw':![],'where':{'id':_0x34b1c4['params']['id']}},_0x2b459a={};_0x2b459a['model']=_[_0x49ed('0x39')](db[_0x49ed('0x48')][_0x49ed('0x34')]);_0x2b459a[_0x49ed('0x38')]=_['keys'](_0x34b1c4[_0x49ed('0x38')]);_0x2b459a[_0x49ed('0x3a')]=_['intersection'](_0x2b459a[_0x49ed('0x37')],_0x2b459a[_0x49ed('0x38')]);_0x18c788['attributes']=_[_0x49ed('0x3c')](_0x2b459a[_0x49ed('0x37')],qs[_0x49ed('0x3d')](_0x34b1c4[_0x49ed('0x38')][_0x49ed('0x3d')]));_0x18c788[_0x49ed('0x3b')]=_0x18c788[_0x49ed('0x3b')][_0x49ed('0x4c')]?_0x18c788[_0x49ed('0x3b')]:_0x2b459a['model'];if(_0x34b1c4[_0x49ed('0x38')][_0x49ed('0x47')]){_0x18c788[_0x49ed('0x4d')]=[{'all':!![]}];}_0x18c788=_[_0x49ed('0x44')]({},_0x18c788,_0x34b1c4[_0x49ed('0x46')]);return db[_0x49ed('0x48')][_0x49ed('0x4e')](_0x18c788)['then'](handleEntityNotFound(_0x51e657,null))[_0x49ed('0x29')](respondWithResult(_0x51e657,null))['catch'](handleError(_0x51e657,null));};exports['create']=function(_0x247c1a,_0x215cbe){return db[_0x49ed('0x48')][_0x49ed('0x4f')](_0x247c1a['body'],{})[_0x49ed('0x29')](function(_0x51086d){var _0x43ef2a=_0x247c1a['user'][_0x49ed('0x2b')]({'plain':!![]});if(!_0x43ef2a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x43ef2a[_0x49ed('0x50')]===_0x49ed('0x51')){var _0x3c7ff8=_0x51086d[_0x49ed('0x2b')]({'plain':!![]});var _0x22e070=_0x49ed('0x2c');return db[_0x49ed('0x52')][_0x49ed('0x4e')]({'where':{'name':_0x22e070,'userProfileId':_0x43ef2a[_0x49ed('0x53')]},'raw':!![]})[_0x49ed('0x29')](function(_0x41327c){if(_0x41327c&&_0x41327c[_0x49ed('0x54')]===0x0){return db[_0x49ed('0x2d')][_0x49ed('0x4f')]({'name':_0x3c7ff8[_0x49ed('0x30')],'resourceId':_0x3c7ff8['id'],'type':_0x41327c['name'],'sectionId':_0x41327c['id']},{})[_0x49ed('0x29')](function(){return _0x51086d;});}else{return _0x51086d;}})[_0x49ed('0x55')](function(_0xcf7fa1){logger[_0x49ed('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xcf7fa1);throw _0xcf7fa1;});}return _0x51086d;})[_0x49ed('0x29')](respondWithResult(_0x215cbe,0xc9))[_0x49ed('0x55')](handleError(_0x215cbe,null));};exports[_0x49ed('0x56')]=function(_0x4f055e,_0x1fb7e0){var _0x51c30a={'where':{'id':_0x4f055e[_0x49ed('0x57')]['id']}},_0x2a6222={};_0x2a6222[_0x49ed('0x37')]=_[_0x49ed('0x39')](db[_0x49ed('0x48')][_0x49ed('0x34')]);_0x51c30a[_0x49ed('0x3b')]=_[_0x49ed('0x3c')](_0x2a6222[_0x49ed('0x37')],qs[_0x49ed('0x3d')](_0x4f055e[_0x49ed('0x38')][_0x49ed('0x3d')]));_0x51c30a[_0x49ed('0x3b')]=_0x51c30a['attributes'][_0x49ed('0x4c')]?_0x51c30a[_0x49ed('0x3b')]:_0x2a6222[_0x49ed('0x37')];if(_0x4f055e[_0x49ed('0x38')][_0x49ed('0x47')]){_0x51c30a[_0x49ed('0x4d')]=[{'all':!![]}];}_0x51c30a=_[_0x49ed('0x44')]({},_0x51c30a,_0x4f055e[_0x49ed('0x46')]);return db['JscriptyProject']['find'](_0x51c30a)['then'](handleEntityNotFound(_0x1fb7e0,null))[_0x49ed('0x29')](function(_0x122a01){if(_0x122a01){var _0x2f57da=_0x122a01[_0x49ed('0x2b')]({'plain':!![]});_0x2f57da=qs[_0x49ed('0x58')](_0x2f57da,['id',_0x49ed('0x59'),_0x49ed('0x5a')]);_0x4f055e[_0x49ed('0x5b')]=_[_0x49ed('0x58')](_0x4f055e['body'],['id',_0x49ed('0x59'),'updatedAt']);return db[_0x49ed('0x48')][_0x49ed('0x4f')](_['merge'](_0x2f57da,_0x4f055e[_0x49ed('0x5b')]),{'include':_0x4f055e[_0x49ed('0x38')][_0x49ed('0x47')]?[{'all':!![]}]:undefined})[_0x49ed('0x29')](function(_0xfb847c){var _0x23b7c4=_0x4f055e[_0x49ed('0x51')]['get']({'plain':!![]});if(!_0x23b7c4)throw new Error(_0x49ed('0x5c'));if(_0x23b7c4['role']===_0x49ed('0x51')){var _0x5bd2ff=_0xfb847c[_0x49ed('0x2b')]({'plain':!![]});var _0x4b7072='Projects';return db[_0x49ed('0x52')][_0x49ed('0x4e')]({'where':{'name':_0x4b7072,'userProfileId':_0x23b7c4[_0x49ed('0x53')]},'raw':!![]})[_0x49ed('0x29')](function(_0x3fc330){if(_0x3fc330&&_0x3fc330[_0x49ed('0x54')]===0x0){return db[_0x49ed('0x2d')][_0x49ed('0x4f')]({'name':_0x5bd2ff[_0x49ed('0x30')],'resourceId':_0x5bd2ff['id'],'type':_0x3fc330['name'],'sectionId':_0x3fc330['id']},{})[_0x49ed('0x29')](function(){return _0xfb847c;});}else{return _0xfb847c;}})['catch'](function(_0x2273b7){logger[_0x49ed('0x2e')](_0x49ed('0x5d'),_0x2273b7);throw _0x2273b7;});}return _0xfb847c;});}})[_0x49ed('0x29')](respondWithResult(_0x1fb7e0,0xc9))[_0x49ed('0x55')](handleError(_0x1fb7e0,null));};exports[_0x49ed('0x28')]=function(_0x57bec3,_0x13f7bc){if(_0x57bec3[_0x49ed('0x5b')]['id']){delete _0x57bec3['body']['id'];}return db['JscriptyProject'][_0x49ed('0x4e')]({'where':{'id':_0x57bec3[_0x49ed('0x57')]['id']}})[_0x49ed('0x29')](handleEntityNotFound(_0x13f7bc,null))[_0x49ed('0x29')](saveUpdates(_0x57bec3[_0x49ed('0x5b')],null))[_0x49ed('0x29')](respondWithResult(_0x13f7bc,null))[_0x49ed('0x55')](handleError(_0x13f7bc,null));};exports['destroy']=function(_0x876fb,_0x6f962){return db[_0x49ed('0x48')]['find']({'where':{'id':_0x876fb[_0x49ed('0x57')]['id']}})[_0x49ed('0x29')](handleEntityNotFound(_0x6f962,null))['then'](removeEntity(_0x6f962,null))[_0x49ed('0x55')](handleError(_0x6f962,null));};exports[_0x49ed('0x5e')]=function(_0x2725b5,_0x355b6b,_0x135502){var _0x1dfbf8={'raw':!![],'where':{}};var _0x151955={};var _0x391ba7={'count':0x0,'rows':[]};return db[_0x49ed('0x48')][_0x49ed('0x5f')]({'where':{'id':_0x2725b5[_0x49ed('0x57')]['id']}})[_0x49ed('0x29')](handleEntityNotFound(_0x355b6b,null))[_0x49ed('0x29')](function(_0x3dd2bf){if(_0x3dd2bf){_0x151955['model']=_[_0x49ed('0x39')](db[_0x49ed('0x60')][_0x49ed('0x34')]);_0x151955['query']=_[_0x49ed('0x39')](_0x2725b5[_0x49ed('0x38')]);_0x151955['filters']=_['intersection'](_0x151955[_0x49ed('0x37')],_0x151955[_0x49ed('0x38')]);_0x1dfbf8[_0x49ed('0x3b')]=_['intersection'](_0x151955[_0x49ed('0x37')],qs[_0x49ed('0x3d')](_0x2725b5[_0x49ed('0x38')][_0x49ed('0x3d')]));_0x1dfbf8[_0x49ed('0x3b')]=_0x1dfbf8[_0x49ed('0x3b')][_0x49ed('0x4c')]?_0x1dfbf8[_0x49ed('0x3b')]:_0x151955[_0x49ed('0x37')];if(!_0x2725b5[_0x49ed('0x38')]['hasOwnProperty'](_0x49ed('0x3e'))){_0x1dfbf8[_0x49ed('0x20')]=qs['limit'](_0x2725b5[_0x49ed('0x38')][_0x49ed('0x20')]);_0x1dfbf8[_0x49ed('0x1e')]=qs[_0x49ed('0x1e')](_0x2725b5[_0x49ed('0x38')]['offset']);}_0x1dfbf8[_0x49ed('0x3f')]=qs['sort'](_0x2725b5['query'][_0x49ed('0x40')]);_0x1dfbf8[_0x49ed('0x43')]=qs[_0x49ed('0x3a')](_[_0x49ed('0x41')](_0x2725b5[_0x49ed('0x38')],_0x151955[_0x49ed('0x3a')]));_0x1dfbf8[_0x49ed('0x43')][_0x49ed('0x61')]=_0x3dd2bf['id'];if(_0x2725b5[_0x49ed('0x38')][_0x49ed('0x42')]){_0x1dfbf8[_0x49ed('0x43')]=_['merge'](_0x1dfbf8[_0x49ed('0x43')],{'$or':_[_0x49ed('0x33')](_0x1dfbf8[_0x49ed('0x3b')],function(_0x455f8b){var _0x3026f9={};_0x3026f9[_0x455f8b]={'$like':'%'+_0x2725b5['query'][_0x49ed('0x42')]+'%'};return _0x3026f9;})});}_0x1dfbf8=_[_0x49ed('0x44')]({},_0x1dfbf8,_0x2725b5[_0x49ed('0x46')]);return db[_0x49ed('0x60')][_0x49ed('0x21')]({'where':_0x1dfbf8[_0x49ed('0x43')]})['then'](function(_0xbdd3db){_0x391ba7[_0x49ed('0x21')]=_0xbdd3db;if(_0x2725b5[_0x49ed('0x38')]['includeAll']){_0x1dfbf8['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x49ed('0x49')](_0x1dfbf8);})[_0x49ed('0x29')](function(_0x5c3529){_0x391ba7[_0x49ed('0x4a')]=_0x5c3529;return _0x391ba7;});}})[_0x49ed('0x29')](respondWithFilteredResult(_0x355b6b,_0x1dfbf8))[_0x49ed('0x55')](handleError(_0x355b6b,null));};exports[_0x49ed('0x62')]=function(_0x5f148b,_0x4be2cb,_0x48a34c){var _0x1f97e9={'raw':!![],'where':{}};var _0x25a10e={};var _0x126ca0={'count':0x0,'rows':[]};return db['JscriptyProject'][_0x49ed('0x5f')]({'where':{'id':_0x5f148b[_0x49ed('0x57')]['id']}})[_0x49ed('0x29')](handleEntityNotFound(_0x4be2cb,null))[_0x49ed('0x29')](function(_0x39760a){if(_0x39760a){_0x25a10e[_0x49ed('0x37')]=_[_0x49ed('0x39')](db['JscriptyAnswerReport'][_0x49ed('0x34')]);_0x25a10e[_0x49ed('0x38')]=_[_0x49ed('0x39')](_0x5f148b[_0x49ed('0x38')]);_0x25a10e['filters']=_[_0x49ed('0x3c')](_0x25a10e[_0x49ed('0x37')],_0x25a10e[_0x49ed('0x38')]);_0x1f97e9[_0x49ed('0x3b')]=_['intersection'](_0x25a10e[_0x49ed('0x37')],qs['fields'](_0x5f148b[_0x49ed('0x38')]['fields']));_0x1f97e9[_0x49ed('0x3b')]=_0x1f97e9[_0x49ed('0x3b')][_0x49ed('0x4c')]?_0x1f97e9[_0x49ed('0x3b')]:_0x25a10e[_0x49ed('0x37')];if(!_0x5f148b[_0x49ed('0x38')][_0x49ed('0x63')](_0x49ed('0x3e'))){_0x1f97e9[_0x49ed('0x20')]=qs[_0x49ed('0x20')](_0x5f148b[_0x49ed('0x38')][_0x49ed('0x20')]);_0x1f97e9[_0x49ed('0x1e')]=qs[_0x49ed('0x1e')](_0x5f148b[_0x49ed('0x38')][_0x49ed('0x1e')]);}_0x1f97e9[_0x49ed('0x3f')]=qs[_0x49ed('0x40')](_0x5f148b['query'][_0x49ed('0x40')]);_0x1f97e9[_0x49ed('0x43')]=qs[_0x49ed('0x3a')](_[_0x49ed('0x41')](_0x5f148b[_0x49ed('0x38')],_0x25a10e[_0x49ed('0x3a')]));_0x1f97e9['where']['ProjectId']=_0x39760a['id'];if(_0x5f148b['query'][_0x49ed('0x42')]){_0x1f97e9[_0x49ed('0x43')]=_['merge'](_0x1f97e9['where'],{'$or':_[_0x49ed('0x33')](_0x1f97e9['attributes'],function(_0x2b078a){var _0xf7f226={};_0xf7f226[_0x2b078a]={'$like':'%'+_0x5f148b[_0x49ed('0x38')][_0x49ed('0x42')]+'%'};return _0xf7f226;})});}_0x1f97e9=_[_0x49ed('0x44')]({},_0x1f97e9,_0x5f148b[_0x49ed('0x46')]);return db['JscriptyAnswerReport']['count']({'where':_0x1f97e9[_0x49ed('0x43')]})[_0x49ed('0x29')](function(_0x1c5065){_0x126ca0[_0x49ed('0x21')]=_0x1c5065;if(_0x5f148b[_0x49ed('0x38')][_0x49ed('0x47')]){_0x1f97e9['include']=[{'all':!![]}];}return db[_0x49ed('0x64')][_0x49ed('0x49')](_0x1f97e9);})[_0x49ed('0x29')](function(_0x41a002){_0x126ca0['rows']=_0x41a002;return _0x126ca0;});}})[_0x49ed('0x29')](respondWithFilteredResult(_0x4be2cb,_0x1f97e9))[_0x49ed('0x55')](handleError(_0x4be2cb,null));};function char(_0x373604){return _0x49ed('0x65')===typeof _0x373604?String['fromCharCode'][_0x49ed('0x26')](null,arguments):_0x373604;}function needsEncapsulation(_0x1ef37e){return!!_0x1ef37e&&(_0x1ef37e[_0x49ed('0x66')]()[_0x49ed('0x67')](char(0xd))>=0x0||_0x1ef37e[_0x49ed('0x66')]()['indexOf'](char(0xa))>=0x0||_0x1ef37e[_0x49ed('0x66')]()[_0x49ed('0x67')](char(0x2c))>=0x0||_0x1ef37e[_0x49ed('0x66')]()[_0x49ed('0x67')](char(0x22))>=0x0);}function encapsulate(_0x206666){var _0x40be2b=char(0x22),_0x548125='\x5c'+char(0x22),_0x28160f=_0x206666[_0x49ed('0x66')]()[_0x49ed('0x68')](new RegExp(_0x40be2b,'g'),_0x548125);return _0x40be2b+_0x28160f+_0x40be2b;}exports[_0x49ed('0x69')]=function(_0x386974,_0x228bdb,_0x47cfa8){var _0x1b9ff6,_0x5c1058;var _0x29beed={'where':{'ProjectId':_0x386974[_0x49ed('0x57')]['id']}};if(_0x386974[_0x49ed('0x38')][_0x49ed('0x6a')]){_0x29beed[_0x49ed('0x43')][_0x49ed('0x6b')]=JSON[_0x49ed('0x6c')](_0x386974['query'][_0x49ed('0x6a')]);}return db[_0x49ed('0x60')][_0x49ed('0x49')](_0x29beed)[_0x49ed('0x29')](handleEntityNotFound(_0x228bdb,null))[_0x49ed('0x29')](function(_0x1c7723){if(_0x1c7723){_0x1b9ff6=_0x1c7723;return db['JscriptyQuestionReport'][_0x49ed('0x49')]({'where':{'SessionId':{'$in':_[_0x49ed('0x33')](_0x1b9ff6,'id')},'ProjectId':_0x386974[_0x49ed('0x57')]['id']},'order':_0x49ed('0x6d')});}})['then'](handleEntityNotFound(_0x228bdb,null))[_0x49ed('0x29')](function(_0x448465){if(_0x448465){_0x5c1058=_0x448465;var _0x3e8890={};for(var _0x9a8eed=0x0,_0x50b3ad=_0x5c1058[_0x49ed('0x4c')];_0x9a8eed<_0x50b3ad;_0x9a8eed++){if(!_0x3e8890['hasOwnProperty'](_0x5c1058[_0x9a8eed][_0x49ed('0x6e')])){_0x3e8890[_0x5c1058[_0x9a8eed][_0x49ed('0x6e')]]=needsEncapsulation(_0x5c1058[_0x9a8eed][_0x49ed('0x6f')])?encapsulate(_0x5c1058[_0x9a8eed]['question']):_0x5c1058[_0x9a8eed][_0x49ed('0x6f')];}}var _0x557027=[],_0x2688be={};for(var _0x1e3e63=0x0,_0x5e16ba=_0x1b9ff6[_0x49ed('0x4c')];_0x1e3e63<_0x5e16ba;_0x1e3e63++){_0x2688be={'ProjectId':_0x386974[_0x49ed('0x57')]['id'],'SessionId':_0x1b9ff6[_0x1e3e63]['id'],'StartTime':moment(_0x1b9ff6[_0x1e3e63]['starttime'])[_0x49ed('0x70')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x1d74fd=0x0,_0x2f902e=_0x5c1058['length'];_0x1d74fd<_0x2f902e;_0x1d74fd++){if(_0x5c1058[_0x1d74fd][_0x49ed('0x71')]==_0x1b9ff6[_0x1e3e63]['id']&&_0x3e8890['hasOwnProperty'](_0x5c1058[_0x1d74fd][_0x49ed('0x6e')])){_0x2688be[_0x3e8890[_0x5c1058[_0x1d74fd][_0x49ed('0x6e')]]]=_0x5c1058[_0x1d74fd][_0x49ed('0x72')];}}for(var _0x24e8df in _0x3e8890){if(!_0x2688be[_0x49ed('0x63')](_0x3e8890[_0x24e8df])){_0x2688be[_0x3e8890[_0x24e8df]]=null;}}_0x557027[_0x49ed('0x73')](_0x2688be);}return _0x557027;}})[_0x49ed('0x29')](function(_0x4fac9d){if(!_[_0x49ed('0x74')](_0x4fac9d)){var _0x50b9cf=toCsv(_0x4fac9d);var _0x117a9c=Date[_0x49ed('0x75')]();fs[_0x49ed('0x76')](util['format']('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x386974[_0x49ed('0x57')]['id'],_0x117a9c),_0x50b9cf);_0x228bdb[_0x49ed('0x77')](_0x49ed('0x78'),_0x49ed('0x79')+util['format']('Jscripty_Project_%d_Summary_%s.csv',_0x386974[_0x49ed('0x57')]['id'],_0x117a9c));_0x228bdb[_0x49ed('0x77')](_0x49ed('0x7a'),'text/csv');return _0x228bdb['download'](util[_0x49ed('0x70')](_0x49ed('0x7b'),_0x386974['params']['id'],_0x117a9c));}else{return _0x228bdb['sendStatus'](0xcc);}})[_0x49ed('0x55')](handleError(_0x228bdb,null));}; \ No newline at end of file +var _0x13ea=['nolimit','order','sort','pick','filter','where','merge','VIRTUAL','name','include','findAll','rows','catch','show','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','params','length','find','get','omit','updatedAt','createdAt','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getSessions','ProjectId','options','JscriptySessionReport','getAnswers','JscriptyAnswerReport','number','toString','indexOf','getSummary','startTime','-createdAt','questionId','question','starttime','format','SessionId','answer','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','update','then','Projects','UserProfileResource','destroy','sendStatus','error','stack','send','index','map','JscriptyProject','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x13ea,0xa9));var _0xa13e=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0x13ea[_0x288f5e];return _0x476cc9;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa13e('0x0'));var jsonpatch=require(_0xa13e('0x1'));var rp=require(_0xa13e('0x2'));var moment=require('moment');var BPromise=require(_0xa13e('0x3'));var Mustache=require('mustache');var util=require(_0xa13e('0x4'));var path=require('path');var sox=require(_0xa13e('0x5'));var csv=require(_0xa13e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0xa13e('0x7'));var jsforce=require(_0xa13e('0x8'));var deskjs=require(_0xa13e('0x9'));var toCsv=require('to-csv');var querystring=require(_0xa13e('0xa'));var Papa=require(_0xa13e('0xb'));var Redis=require(_0xa13e('0xc'));var authService=require(_0xa13e('0xd'));var qs=require(_0xa13e('0xe'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa13e('0xf'));var logger=require(_0xa13e('0x10'))(_0xa13e('0x11'));var utils=require(_0xa13e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xa13e('0x13'));var db=require(_0xa13e('0x14'))['db'];function respondWithStatusCode(_0x17a949,_0x39fa45){_0x39fa45=_0x39fa45||0xcc;return function(_0x423688){if(_0x423688){return _0x17a949['sendStatus'](_0x39fa45);}return _0x17a949[_0xa13e('0x15')](_0x39fa45)[_0xa13e('0x16')]();};}function respondWithResult(_0x57ec24,_0x493010){_0x493010=_0x493010||0xc8;return function(_0xd9c8a8){if(_0xd9c8a8){return _0x57ec24['status'](_0x493010)[_0xa13e('0x17')](_0xd9c8a8);}};}function respondWithFilteredResult(_0x513019,_0x112321){return function(_0x243ce5){if(_0x243ce5){var _0x1c5b14=typeof _0x112321[_0xa13e('0x18')]===_0xa13e('0x19')&&typeof _0x112321['limit']===_0xa13e('0x19');var _0x193d4a=_0x243ce5[_0xa13e('0x1a')];var _0x4f8af2=_0x1c5b14?0x0:_0x112321[_0xa13e('0x18')];var _0x36acb8=_0x1c5b14?_0x243ce5['count']:_0x112321[_0xa13e('0x18')]+_0x112321[_0xa13e('0x1b')];var _0x441df6;if(_0x36acb8>=_0x193d4a){_0x36acb8=_0x193d4a;_0x441df6=0xc8;}else{_0x441df6=0xce;}_0x513019[_0xa13e('0x15')](_0x441df6);return _0x513019['set'](_0xa13e('0x1c'),_0x4f8af2+'-'+_0x36acb8+'/'+_0x193d4a)[_0xa13e('0x17')](_0x243ce5);}return null;};}function patchUpdates(_0x24b13a){return function(_0x321cd3){try{jsonpatch[_0xa13e('0x1d')](_0x321cd3,_0x24b13a,!![]);}catch(_0x30f4e5){return BPromise['reject'](_0x30f4e5);}return _0x321cd3[_0xa13e('0x1e')]();};}function saveUpdates(_0x1eeacc,_0x498081){return function(_0x5136be){if(_0x5136be){return _0x5136be[_0xa13e('0x1f')](_0x1eeacc)[_0xa13e('0x20')](function(_0x359dd7){return _0x359dd7;});}return null;};}function removeEntity(_0x1932bd,_0x213000){return function(_0x2dc21b){if(_0x2dc21b){return _0x2dc21b['destroy']()[_0xa13e('0x20')](function(){var _0x364e70=_0x2dc21b['get']({'plain':!![]});var _0x1dd290=_0xa13e('0x21');return db[_0xa13e('0x22')][_0xa13e('0x23')]({'where':{'type':_0x1dd290,'resourceId':_0x364e70['id']}})[_0xa13e('0x20')](function(){return _0x2dc21b;});})[_0xa13e('0x20')](function(){_0x1932bd[_0xa13e('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21c2b6,_0x416433){return function(_0x380f6b){if(!_0x380f6b){_0x21c2b6[_0xa13e('0x24')](0x194);}return _0x380f6b;};}function handleError(_0x4e8405,_0x643ce7){_0x643ce7=_0x643ce7||0x1f4;return function(_0x30814a){logger[_0xa13e('0x25')](_0x30814a[_0xa13e('0x26')]);if(_0x30814a['name']){delete _0x30814a['name'];}_0x4e8405[_0xa13e('0x15')](_0x643ce7)[_0xa13e('0x27')](_0x30814a);};}exports[_0xa13e('0x28')]=function(_0x5af83d,_0x133694){var _0x2d1a4d={},_0x5b919d={},_0x1a61a8={'count':0x0,'rows':[]};var _0x11bf12=_[_0xa13e('0x29')](db[_0xa13e('0x2a')][_0xa13e('0x2b')],function(_0x2bfd0b){return{'name':_0x2bfd0b['fieldName'],'type':_0x2bfd0b[_0xa13e('0x2c')][_0xa13e('0x2d')]};});_0x5b919d[_0xa13e('0x2e')]=_['map'](_0x11bf12,'name');_0x5b919d[_0xa13e('0x2f')]=_['keys'](_0x5af83d['query']);_0x5b919d[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x5b919d['model'],_0x5b919d['query']);_0x2d1a4d[_0xa13e('0x32')]=_[_0xa13e('0x31')](_0x5b919d[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x5af83d['query']['fields']));_0x2d1a4d[_0xa13e('0x32')]=_0x2d1a4d['attributes']['length']?_0x2d1a4d[_0xa13e('0x32')]:_0x5b919d[_0xa13e('0x2e')];if(!_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x2d1a4d[_0xa13e('0x1b')]=qs['limit'](_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x1b')]);_0x2d1a4d['offset']=qs[_0xa13e('0x18')](_0x5af83d[_0xa13e('0x2f')]['offset']);}_0x2d1a4d[_0xa13e('0x36')]=qs[_0xa13e('0x37')](_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x37')]);_0x2d1a4d['where']=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x5af83d['query'],_0x5b919d[_0xa13e('0x30')]),_0x11bf12);if(_0x5af83d[_0xa13e('0x2f')][_0xa13e('0x39')]){_0x2d1a4d[_0xa13e('0x3a')]=_[_0xa13e('0x3b')](_0x2d1a4d['where'],{'$or':_[_0xa13e('0x29')](_0x11bf12,function(_0x1f41b1){if(_0x1f41b1['type']!==_0xa13e('0x3c')){var _0x2ed1eb={};_0x2ed1eb[_0x1f41b1[_0xa13e('0x3d')]]={'$like':'%'+_0x5af83d['query'][_0xa13e('0x39')]+'%'};return _0x2ed1eb;}})});}_0x2d1a4d=_[_0xa13e('0x3b')]({},_0x2d1a4d,_0x5af83d['options']);var _0x2b0834={'where':_0x2d1a4d[_0xa13e('0x3a')]};return db[_0xa13e('0x2a')][_0xa13e('0x1a')](_0x2b0834)[_0xa13e('0x20')](function(_0x1a66aa){_0x1a61a8[_0xa13e('0x1a')]=_0x1a66aa;if(_0x5af83d[_0xa13e('0x2f')]['includeAll']){_0x2d1a4d[_0xa13e('0x3e')]=[{'all':!![]}];}return db['JscriptyProject'][_0xa13e('0x3f')](_0x2d1a4d);})['then'](function(_0x4e23fc){_0x1a61a8[_0xa13e('0x40')]=_0x4e23fc;return _0x1a61a8;})[_0xa13e('0x20')](respondWithFilteredResult(_0x133694,_0x2d1a4d))[_0xa13e('0x41')](handleError(_0x133694,null));};exports[_0xa13e('0x42')]=function(_0xa5d7c5,_0x589051){var _0x3fc3d7={'raw':![],'where':{'id':_0xa5d7c5['params']['id']}},_0x19f127={};_0x19f127[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db['JscriptyProject'][_0xa13e('0x2b')]);_0x19f127[_0xa13e('0x2f')]=_[_0xa13e('0x43')](_0xa5d7c5[_0xa13e('0x2f')]);_0x19f127['filters']=_[_0xa13e('0x31')](_0x19f127[_0xa13e('0x2e')],_0x19f127['query']);_0x3fc3d7['attributes']=_[_0xa13e('0x31')](_0x19f127[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0xa5d7c5[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x3fc3d7[_0xa13e('0x32')]=_0x3fc3d7[_0xa13e('0x32')]['length']?_0x3fc3d7['attributes']:_0x19f127[_0xa13e('0x2e')];if(_0xa5d7c5[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x3fc3d7[_0xa13e('0x3e')]=[{'all':!![]}];}_0x3fc3d7=_[_0xa13e('0x3b')]({},_0x3fc3d7,_0xa5d7c5['options']);return db['JscriptyProject']['find'](_0x3fc3d7)['then'](handleEntityNotFound(_0x589051,null))[_0xa13e('0x20')](respondWithResult(_0x589051,null))[_0xa13e('0x41')](handleError(_0x589051,null));};exports[_0xa13e('0x45')]=function(_0x1522b6,_0x2762d4){return db[_0xa13e('0x2a')][_0xa13e('0x45')](_0x1522b6[_0xa13e('0x46')],{})['then'](function(_0x49ea7b){var _0x58c8cc=_0x1522b6[_0xa13e('0x47')]['get']({'plain':!![]});if(!_0x58c8cc)throw new Error(_0xa13e('0x48'));if(_0x58c8cc['role']===_0xa13e('0x47')){var _0x7f3666=_0x49ea7b['get']({'plain':!![]});var _0x4d11d5=_0xa13e('0x21');return db[_0xa13e('0x49')]['find']({'where':{'name':_0x4d11d5,'userProfileId':_0x58c8cc[_0xa13e('0x4a')]},'raw':!![]})[_0xa13e('0x20')](function(_0x33431f){if(_0x33431f&&_0x33431f['autoAssociation']===0x0){return db['UserProfileResource'][_0xa13e('0x45')]({'name':_0x7f3666['name'],'resourceId':_0x7f3666['id'],'type':_0x33431f[_0xa13e('0x3d')],'sectionId':_0x33431f['id']},{})[_0xa13e('0x20')](function(){return _0x49ea7b;});}else{return _0x49ea7b;}})[_0xa13e('0x41')](function(_0x1c2726){logger[_0xa13e('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1c2726);throw _0x1c2726;});}return _0x49ea7b;})[_0xa13e('0x20')](respondWithResult(_0x2762d4,0xc9))[_0xa13e('0x41')](handleError(_0x2762d4,null));};exports['clone']=function(_0x3d7f44,_0x437c68){var _0x4f5a6b={'where':{'id':_0x3d7f44[_0xa13e('0x4b')]['id']}},_0x255ba1={};_0x255ba1[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db[_0xa13e('0x2a')][_0xa13e('0x2b')]);_0x4f5a6b['attributes']=_[_0xa13e('0x31')](_0x255ba1[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x3d7f44[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x4f5a6b[_0xa13e('0x32')]=_0x4f5a6b[_0xa13e('0x32')][_0xa13e('0x4c')]?_0x4f5a6b[_0xa13e('0x32')]:_0x255ba1[_0xa13e('0x2e')];if(_0x3d7f44[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x4f5a6b['include']=[{'all':!![]}];}_0x4f5a6b=_[_0xa13e('0x3b')]({},_0x4f5a6b,_0x3d7f44['options']);return db[_0xa13e('0x2a')][_0xa13e('0x4d')](_0x4f5a6b)[_0xa13e('0x20')](handleEntityNotFound(_0x437c68,null))[_0xa13e('0x20')](function(_0x2b598d){if(_0x2b598d){var _0x47870e=_0x2b598d[_0xa13e('0x4e')]({'plain':!![]});_0x47870e=qs[_0xa13e('0x4f')](_0x47870e,['id','createdAt',_0xa13e('0x50')]);_0x3d7f44[_0xa13e('0x46')]=_[_0xa13e('0x4f')](_0x3d7f44[_0xa13e('0x46')],['id',_0xa13e('0x51'),'updatedAt']);return db[_0xa13e('0x2a')]['create'](_['merge'](_0x47870e,_0x3d7f44[_0xa13e('0x46')]),{'include':_0x3d7f44[_0xa13e('0x2f')][_0xa13e('0x44')]?[{'all':!![]}]:undefined})[_0xa13e('0x20')](function(_0x43e9fd){var _0x598a6a=_0x3d7f44[_0xa13e('0x47')][_0xa13e('0x4e')]({'plain':!![]});if(!_0x598a6a)throw new Error(_0xa13e('0x48'));if(_0x598a6a[_0xa13e('0x52')]===_0xa13e('0x47')){var _0x4cef03=_0x43e9fd['get']({'plain':!![]});var _0x2a291a=_0xa13e('0x21');return db['UserProfileSection'][_0xa13e('0x4d')]({'where':{'name':_0x2a291a,'userProfileId':_0x598a6a[_0xa13e('0x4a')]},'raw':!![]})[_0xa13e('0x20')](function(_0x18007a){if(_0x18007a&&_0x18007a[_0xa13e('0x53')]===0x0){return db['UserProfileResource'][_0xa13e('0x45')]({'name':_0x4cef03[_0xa13e('0x3d')],'resourceId':_0x4cef03['id'],'type':_0x18007a[_0xa13e('0x3d')],'sectionId':_0x18007a['id']},{})[_0xa13e('0x20')](function(){return _0x43e9fd;});}else{return _0x43e9fd;}})['catch'](function(_0xe918a){logger[_0xa13e('0x25')](_0xa13e('0x54'),_0xe918a);throw _0xe918a;});}return _0x43e9fd;});}})[_0xa13e('0x20')](respondWithResult(_0x437c68,0xc9))[_0xa13e('0x41')](handleError(_0x437c68,null));};exports[_0xa13e('0x1f')]=function(_0x249e41,_0x5df452){if(_0x249e41['body']['id']){delete _0x249e41[_0xa13e('0x46')]['id'];}return db['JscriptyProject'][_0xa13e('0x4d')]({'where':{'id':_0x249e41[_0xa13e('0x4b')]['id']}})['then'](handleEntityNotFound(_0x5df452,null))[_0xa13e('0x20')](saveUpdates(_0x249e41[_0xa13e('0x46')],null))[_0xa13e('0x20')](respondWithResult(_0x5df452,null))[_0xa13e('0x41')](handleError(_0x5df452,null));};exports[_0xa13e('0x23')]=function(_0x112cc2,_0x194ce4){return db[_0xa13e('0x2a')][_0xa13e('0x4d')]({'where':{'id':_0x112cc2['params']['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0x194ce4,null))[_0xa13e('0x20')](removeEntity(_0x194ce4,null))[_0xa13e('0x41')](handleError(_0x194ce4,null));};exports[_0xa13e('0x55')]=function(_0x35be12,_0xab3a3c,_0x134fad){var _0x194a4c={'raw':!![],'where':{}};var _0x16dee2={};var _0x58f985={'count':0x0,'rows':[]};return db['JscriptyProject']['findOne']({'where':{'id':_0x35be12[_0xa13e('0x4b')]['id']}})[_0xa13e('0x20')](handleEntityNotFound(_0xab3a3c,null))[_0xa13e('0x20')](function(_0x2f513e){if(_0x2f513e){_0x16dee2[_0xa13e('0x2e')]=_[_0xa13e('0x43')](db['JscriptySessionReport'][_0xa13e('0x2b')]);_0x16dee2['query']=_[_0xa13e('0x43')](_0x35be12[_0xa13e('0x2f')]);_0x16dee2[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x16dee2[_0xa13e('0x2e')],_0x16dee2[_0xa13e('0x2f')]);_0x194a4c['attributes']=_[_0xa13e('0x31')](_0x16dee2[_0xa13e('0x2e')],qs[_0xa13e('0x33')](_0x35be12[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x194a4c[_0xa13e('0x32')]=_0x194a4c['attributes'][_0xa13e('0x4c')]?_0x194a4c[_0xa13e('0x32')]:_0x16dee2['model'];if(!_0x35be12[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x194a4c['limit']=qs[_0xa13e('0x1b')](_0x35be12['query']['limit']);_0x194a4c[_0xa13e('0x18')]=qs[_0xa13e('0x18')](_0x35be12[_0xa13e('0x2f')][_0xa13e('0x18')]);}_0x194a4c[_0xa13e('0x36')]=qs[_0xa13e('0x37')](_0x35be12['query'][_0xa13e('0x37')]);_0x194a4c[_0xa13e('0x3a')]=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x35be12['query'],_0x16dee2[_0xa13e('0x30')]));_0x194a4c[_0xa13e('0x3a')][_0xa13e('0x56')]=_0x2f513e['id'];if(_0x35be12['query']['filter']){_0x194a4c['where']=_['merge'](_0x194a4c['where'],{'$or':_[_0xa13e('0x29')](_0x194a4c['attributes'],function(_0x1e29cb){var _0x3d68ac={};_0x3d68ac[_0x1e29cb]={'$like':'%'+_0x35be12[_0xa13e('0x2f')][_0xa13e('0x39')]+'%'};return _0x3d68ac;})});}_0x194a4c=_[_0xa13e('0x3b')]({},_0x194a4c,_0x35be12[_0xa13e('0x57')]);return db['JscriptySessionReport']['count']({'where':_0x194a4c['where']})[_0xa13e('0x20')](function(_0x31d4e){_0x58f985[_0xa13e('0x1a')]=_0x31d4e;if(_0x35be12[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x194a4c['include']=[{'all':!![]}];}return db[_0xa13e('0x58')]['findAll'](_0x194a4c);})[_0xa13e('0x20')](function(_0x212892){_0x58f985[_0xa13e('0x40')]=_0x212892;return _0x58f985;});}})[_0xa13e('0x20')](respondWithFilteredResult(_0xab3a3c,_0x194a4c))[_0xa13e('0x41')](handleError(_0xab3a3c,null));};exports[_0xa13e('0x59')]=function(_0x1c6d0a,_0x325492,_0x20d933){var _0x391356={'raw':!![],'where':{}};var _0x2633db={};var _0x5955c0={'count':0x0,'rows':[]};return db[_0xa13e('0x2a')]['findOne']({'where':{'id':_0x1c6d0a['params']['id']}})['then'](handleEntityNotFound(_0x325492,null))[_0xa13e('0x20')](function(_0x51636d){if(_0x51636d){_0x2633db[_0xa13e('0x2e')]=_['keys'](db[_0xa13e('0x5a')][_0xa13e('0x2b')]);_0x2633db[_0xa13e('0x2f')]=_['keys'](_0x1c6d0a['query']);_0x2633db[_0xa13e('0x30')]=_[_0xa13e('0x31')](_0x2633db[_0xa13e('0x2e')],_0x2633db['query']);_0x391356[_0xa13e('0x32')]=_[_0xa13e('0x31')](_0x2633db['model'],qs[_0xa13e('0x33')](_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x33')]));_0x391356[_0xa13e('0x32')]=_0x391356[_0xa13e('0x32')][_0xa13e('0x4c')]?_0x391356['attributes']:_0x2633db[_0xa13e('0x2e')];if(!_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x34')](_0xa13e('0x35'))){_0x391356[_0xa13e('0x1b')]=qs[_0xa13e('0x1b')](_0x1c6d0a['query'][_0xa13e('0x1b')]);_0x391356[_0xa13e('0x18')]=qs[_0xa13e('0x18')](_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x18')]);}_0x391356['order']=qs[_0xa13e('0x37')](_0x1c6d0a['query']['sort']);_0x391356[_0xa13e('0x3a')]=qs[_0xa13e('0x30')](_[_0xa13e('0x38')](_0x1c6d0a[_0xa13e('0x2f')],_0x2633db[_0xa13e('0x30')]));_0x391356[_0xa13e('0x3a')][_0xa13e('0x56')]=_0x51636d['id'];if(_0x1c6d0a[_0xa13e('0x2f')]['filter']){_0x391356[_0xa13e('0x3a')]=_[_0xa13e('0x3b')](_0x391356[_0xa13e('0x3a')],{'$or':_[_0xa13e('0x29')](_0x391356['attributes'],function(_0xc544c0){var _0xc1e082={};_0xc1e082[_0xc544c0]={'$like':'%'+_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x39')]+'%'};return _0xc1e082;})});}_0x391356=_[_0xa13e('0x3b')]({},_0x391356,_0x1c6d0a[_0xa13e('0x57')]);return db[_0xa13e('0x5a')]['count']({'where':_0x391356[_0xa13e('0x3a')]})[_0xa13e('0x20')](function(_0x536b50){_0x5955c0['count']=_0x536b50;if(_0x1c6d0a[_0xa13e('0x2f')][_0xa13e('0x44')]){_0x391356['include']=[{'all':!![]}];}return db[_0xa13e('0x5a')][_0xa13e('0x3f')](_0x391356);})[_0xa13e('0x20')](function(_0x4afca5){_0x5955c0['rows']=_0x4afca5;return _0x5955c0;});}})[_0xa13e('0x20')](respondWithFilteredResult(_0x325492,_0x391356))[_0xa13e('0x41')](handleError(_0x325492,null));};function char(_0x4070cf){return _0xa13e('0x5b')===typeof _0x4070cf?String['fromCharCode'][_0xa13e('0x1d')](null,arguments):_0x4070cf;}function needsEncapsulation(_0x4ce9b9){return!!_0x4ce9b9&&(_0x4ce9b9[_0xa13e('0x5c')]()[_0xa13e('0x5d')](char(0xd))>=0x0||_0x4ce9b9[_0xa13e('0x5c')]()['indexOf'](char(0xa))>=0x0||_0x4ce9b9[_0xa13e('0x5c')]()[_0xa13e('0x5d')](char(0x2c))>=0x0||_0x4ce9b9[_0xa13e('0x5c')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x509a45){var _0x2e89c7=char(0x22),_0x4e941c='\x5c'+char(0x22),_0x44f1fc=_0x509a45[_0xa13e('0x5c')]()['replace'](new RegExp(_0x2e89c7,'g'),_0x4e941c);return _0x2e89c7+_0x44f1fc+_0x2e89c7;}exports[_0xa13e('0x5e')]=function(_0x47a029,_0x50f0eb,_0x517239){var _0xa81cd5,_0x2c1a65;var _0x4b4537={'where':{'ProjectId':_0x47a029[_0xa13e('0x4b')]['id']}};if(_0x47a029[_0xa13e('0x2f')][_0xa13e('0x5f')]){_0x4b4537[_0xa13e('0x3a')]['starttime']=JSON['parse'](_0x47a029[_0xa13e('0x2f')][_0xa13e('0x5f')]);}return db[_0xa13e('0x58')]['findAll'](_0x4b4537)['then'](handleEntityNotFound(_0x50f0eb,null))[_0xa13e('0x20')](function(_0x48cae4){if(_0x48cae4){_0xa81cd5=_0x48cae4;return db['JscriptyQuestionReport'][_0xa13e('0x3f')]({'where':{'SessionId':{'$in':_['map'](_0xa81cd5,'id')},'ProjectId':_0x47a029['params']['id']},'order':_0xa13e('0x60')});}})[_0xa13e('0x20')](handleEntityNotFound(_0x50f0eb,null))['then'](function(_0xa91fd2){if(_0xa91fd2){_0x2c1a65=_0xa91fd2;var _0x5ccc0e={};for(var _0x57c309=0x0,_0x170ea1=_0x2c1a65[_0xa13e('0x4c')];_0x57c309<_0x170ea1;_0x57c309++){if(!_0x5ccc0e[_0xa13e('0x34')](_0x2c1a65[_0x57c309][_0xa13e('0x61')])){_0x5ccc0e[_0x2c1a65[_0x57c309]['questionId']]=needsEncapsulation(_0x2c1a65[_0x57c309][_0xa13e('0x62')])?encapsulate(_0x2c1a65[_0x57c309][_0xa13e('0x62')]):_0x2c1a65[_0x57c309][_0xa13e('0x62')];}}var _0x14625d=[],_0x5d276e={};for(var _0x2eb158=0x0,_0x16395a=_0xa81cd5[_0xa13e('0x4c')];_0x2eb158<_0x16395a;_0x2eb158++){_0x5d276e={'ProjectId':_0x47a029[_0xa13e('0x4b')]['id'],'SessionId':_0xa81cd5[_0x2eb158]['id'],'StartTime':moment(_0xa81cd5[_0x2eb158][_0xa13e('0x63')])[_0xa13e('0x64')]('YYYY-MM-DD\x20HH:mm:ss')};for(var _0x4cd192=0x0,_0x30d7a3=_0x2c1a65[_0xa13e('0x4c')];_0x4cd192<_0x30d7a3;_0x4cd192++){if(_0x2c1a65[_0x4cd192][_0xa13e('0x65')]==_0xa81cd5[_0x2eb158]['id']&&_0x5ccc0e['hasOwnProperty'](_0x2c1a65[_0x4cd192][_0xa13e('0x61')])){_0x5d276e[_0x5ccc0e[_0x2c1a65[_0x4cd192][_0xa13e('0x61')]]]=_0x2c1a65[_0x4cd192][_0xa13e('0x66')];}}for(var _0xfa6a95 in _0x5ccc0e){if(!_0x5d276e[_0xa13e('0x34')](_0x5ccc0e[_0xfa6a95])){_0x5d276e[_0x5ccc0e[_0xfa6a95]]=null;}}_0x14625d['push'](_0x5d276e);}return _0x14625d;}})[_0xa13e('0x20')](function(_0x5324e0){if(!_['isEmpty'](_0x5324e0)){var _0x1c351c=toCsv(_0x5324e0);var _0x2d55b5=Date[_0xa13e('0x67')]();fs[_0xa13e('0x68')](util[_0xa13e('0x64')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x47a029[_0xa13e('0x4b')]['id'],_0x2d55b5),_0x1c351c);_0x50f0eb[_0xa13e('0x69')](_0xa13e('0x6a'),_0xa13e('0x6b')+util[_0xa13e('0x64')](_0xa13e('0x6c'),_0x47a029['params']['id'],_0x2d55b5));_0x50f0eb[_0xa13e('0x69')]('Content-type',_0xa13e('0x6d'));return _0x50f0eb[_0xa13e('0x6e')](util[_0xa13e('0x64')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x47a029[_0xa13e('0x4b')]['id'],_0x2d55b5));}else{return _0x50f0eb[_0xa13e('0x24')](0xcc);}})[_0xa13e('0x41')](handleError(_0x50f0eb,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 77a6fcf..3c03d53 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 _0xe49a=['../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject','jscripty_projects','util'];(function(_0x4b1a01,_0x23e952){var _0xf301d7=function(_0x4efb27){while(--_0x4efb27){_0x4b1a01['push'](_0x4b1a01['shift']());}};_0xf301d7(++_0x23e952);}(_0xe49a,0xd7));var _0xae49=function(_0x546517,_0x462a20){_0x546517=_0x546517-0x0;var _0x4a5526=_0xe49a[_0x546517];return _0x4a5526;};'use strict';var _=require('lodash');var util=require(_0xae49('0x0'));var logger=require(_0xae49('0x1'))(_0xae49('0x2'));var moment=require(_0xae49('0x3'));var BPromise=require(_0xae49('0x4'));var rp=require(_0xae49('0x5'));var fs=require('fs');var path=require(_0xae49('0x6'));var rimraf=require('rimraf');var config=require(_0xae49('0x7'));var attributes=require(_0xae49('0x8'));module[_0xae49('0x9')]=function(_0x4845e0,_0x2fa671){return _0x4845e0['define'](_0xae49('0xa'),attributes,{'tableName':_0xae49('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xeb5d=['util','../../config/logger','api','moment','path','rimraf','./jscriptyProject.attributes','exports','define','JscriptyProject','jscripty_projects'];(function(_0x56b2da,_0x5ed769){var _0x15a933=function(_0x4ae466){while(--_0x4ae466){_0x56b2da['push'](_0x56b2da['shift']());}};_0x15a933(++_0x5ed769);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0xeb5d[_0x413feb];return _0x40ee88;};'use strict';var _=require('lodash');var util=require(_0xdeb5('0x0'));var logger=require(_0xdeb5('0x1'))(_0xdeb5('0x2'));var moment=require(_0xdeb5('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdeb5('0x4'));var rimraf=require(_0xdeb5('0x5'));var config=require('../../config/environment');var attributes=require(_0xdeb5('0x6'));module[_0xdeb5('0x7')]=function(_0x164ecb,_0x33af72){return _0x164ecb[_0xdeb5('0x8')](_0xdeb5('0x9'),attributes,{'tableName':_0xdeb5('0xa'),'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 a0120fb..e431e8b 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 _0xda3f=['rpc','jayson/promise','client','request','then','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','../../mysqldb','../../config/logger'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0xda3f,0xec));var _0xfda3=function(_0x3bbc81,_0xf936ae){_0x3bbc81=_0x3bbc81-0x0;var _0xd784ec=_0xda3f[_0x3bbc81];return _0xd784ec;};'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')]('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c[_0xfda3('0xf')]['message']);return _0x4018c0(_0x46655c[_0xfda3('0xf')][_0xfda3('0x11')]);}logger['error']('JscriptyProject,\x20%s,\x20%s',_0x316792,_0x46655c['error'][_0xfda3('0x11')]);return _0x125e2a(_0x46655c[_0xfda3('0xf')]['message']);}else{logger['info']('JscriptyProject,\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 _0xa9e0=['http','info','JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','JscriptyProject,\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(_0x576fbd,_0x4811ba){var _0x404361=function(_0x139309){while(--_0x139309){_0x576fbd['push'](_0x576fbd['shift']());}};_0x404361(++_0x4811ba);}(_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 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/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index abf496d..75b495f 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 _0x95fa=['./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','put','update','delete','exports','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x422318,_0x20de68){var _0x3973e2=function(_0x520379){while(--_0x520379){_0x422318['push'](_0x422318['shift']());}};_0x3973e2(++_0x20de68);}(_0x95fa,0x14d));var _0xa95f=function(_0x2fb83a,_0x82eae7){_0x2fb83a=_0x2fb83a-0x0;var _0x38516f=_0x95fa[_0x2fb83a];return _0x38516f;};'use strict';var multer=require('multer');var util=require(_0xa95f('0x0'));var path=require(_0xa95f('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xa95f('0x2')]();var fs_extra=require(_0xa95f('0x3'));var auth=require(_0xa95f('0x4'));var interaction=require(_0xa95f('0x5'));var config=require(_0xa95f('0x6'));var controller=require(_0xa95f('0x7'));router[_0xa95f('0x8')]('/',auth[_0xa95f('0x9')](),controller[_0xa95f('0xa')]);router[_0xa95f('0x8')](_0xa95f('0xb'),auth[_0xa95f('0x9')](),controller[_0xa95f('0xc')]);router[_0xa95f('0x8')](_0xa95f('0xd'),auth[_0xa95f('0x9')](),controller[_0xa95f('0xe')]);router[_0xa95f('0xf')]('/',auth[_0xa95f('0x9')](),controller['create']);router[_0xa95f('0x10')](_0xa95f('0xd'),auth[_0xa95f('0x9')](),controller[_0xa95f('0x11')]);router[_0xa95f('0x12')](_0xa95f('0xd'),auth[_0xa95f('0x9')](),controller['destroy']);module[_0xa95f('0x13')]=router; \ No newline at end of file +var _0xcb6c=['post','create','/:id','destroy','exports','multer','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','index','isAuthenticated','describe','show'];(function(_0x3b8da9,_0x760a71){var _0xfeeb7c=function(_0x3784ed){while(--_0x3784ed){_0x3b8da9['push'](_0x3b8da9['shift']());}};_0xfeeb7c(++_0x760a71);}(_0xcb6c,0x95));var _0xccb6=function(_0x1cc8fe,_0x105328){_0x1cc8fe=_0x1cc8fe-0x0;var _0x230054=_0xcb6c[_0x1cc8fe];return _0x230054;};'use strict';var multer=require(_0xccb6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xccb6('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xccb6('0x2'));var interaction=require(_0xccb6('0x3'));var config=require(_0xccb6('0x4'));var controller=require(_0xccb6('0x5'));router[_0xccb6('0x6')]('/',auth['isAuthenticated'](),controller[_0xccb6('0x7')]);router[_0xccb6('0x6')]('/describe',auth[_0xccb6('0x8')](),controller[_0xccb6('0x9')]);router[_0xccb6('0x6')]('/:id',auth[_0xccb6('0x8')](),controller[_0xccb6('0xa')]);router[_0xccb6('0xb')]('/',auth[_0xccb6('0x8')](),controller[_0xccb6('0xc')]);router['put'](_0xccb6('0xd'),auth[_0xccb6('0x8')](),controller['update']);router['delete'](_0xccb6('0xd'),auth['isAuthenticated'](),controller[_0xccb6('0xe')]);module[_0xccb6('0xf')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 37c267e..69f873a 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 _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x7a54,0x106));var _0x47a5=function(_0xb451f9,_0x512130){_0xb451f9=_0xb451f9-0x0;var _0x5d5dc0=_0x7a54[_0xb451f9];return _0x5d5dc0;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x7a54,0x106));var _0x47a5=function(_0x2f8895,_0x553ca6){_0x2f8895=_0x2f8895-0x0;var _0x3e473c=_0x7a54[_0x2f8895];return _0x3e473c;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index 308b3b6..c2e49c2 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 _0xb1ce=['fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','then','includeAll','include','findAll','catch','keys','find','create','body','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','save','update','destroy','stack','name','send','index','JscriptyQuestionReport','rawAttributes'];(function(_0x52fd45,_0x1d31cc){var _0x2f5d1f=function(_0x3aa495){while(--_0x3aa495){_0x52fd45['push'](_0x52fd45['shift']());}};_0x2f5d1f(++_0x1d31cc);}(_0xb1ce,0x190));var _0xeb1c=function(_0x779e96,_0x12508f){_0x779e96=_0x779e96-0x0;var _0x3ce41e=_0xb1ce[_0x779e96];return _0x3ce41e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xeb1c('0x0'));var zipdir=require(_0xeb1c('0x1'));var jsonpatch=require(_0xeb1c('0x2'));var rp=require(_0xeb1c('0x3'));var moment=require(_0xeb1c('0x4'));var BPromise=require(_0xeb1c('0x5'));var Mustache=require(_0xeb1c('0x6'));var util=require(_0xeb1c('0x7'));var path=require(_0xeb1c('0x8'));var sox=require('sox');var csv=require(_0xeb1c('0x9'));var ejs=require(_0xeb1c('0xa'));var fs=require('fs');var fs_extra=require(_0xeb1c('0xb'));var _=require('lodash');var squel=require(_0xeb1c('0xc'));var crypto=require(_0xeb1c('0xd'));var jsforce=require(_0xeb1c('0xe'));var deskjs=require(_0xeb1c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xeb1c('0x10'));var Papa=require(_0xeb1c('0x11'));var Redis=require(_0xeb1c('0x12'));var authService=require(_0xeb1c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xeb1c('0x14'));var hardwareService=require(_0xeb1c('0x15'));var logger=require(_0xeb1c('0x16'))('api');var utils=require(_0xeb1c('0x17'));var config=require(_0xeb1c('0x18'));var licenseUtil=require(_0xeb1c('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43475e,_0x344b09){_0x344b09=_0x344b09||0xcc;return function(_0x4649fb){if(_0x4649fb){return _0x43475e[_0xeb1c('0x1a')](_0x344b09);}return _0x43475e[_0xeb1c('0x1b')](_0x344b09)[_0xeb1c('0x1c')]();};}function respondWithResult(_0x2b9a00,_0x2a8bd7){_0x2a8bd7=_0x2a8bd7||0xc8;return function(_0x2b0580){if(_0x2b0580){return _0x2b9a00['status'](_0x2a8bd7)['json'](_0x2b0580);}};}function respondWithFilteredResult(_0x28285c,_0xa652a4){return function(_0x3b00b){if(_0x3b00b){var _0x185022=typeof _0xa652a4[_0xeb1c('0x1d')]==='undefined'&&typeof _0xa652a4[_0xeb1c('0x1e')]===_0xeb1c('0x1f');var _0x13d343=_0x3b00b[_0xeb1c('0x20')];var _0x28a5ac=_0x185022?0x0:_0xa652a4[_0xeb1c('0x1d')];var _0x142bb0=_0x185022?_0x3b00b[_0xeb1c('0x20')]:_0xa652a4[_0xeb1c('0x1d')]+_0xa652a4[_0xeb1c('0x1e')];var _0x3393c0;if(_0x142bb0>=_0x13d343){_0x142bb0=_0x13d343;_0x3393c0=0xc8;}else{_0x3393c0=0xce;}_0x28285c[_0xeb1c('0x1b')](_0x3393c0);return _0x28285c[_0xeb1c('0x21')](_0xeb1c('0x22'),_0x28a5ac+'-'+_0x142bb0+'/'+_0x13d343)['json'](_0x3b00b);}return null;};}function patchUpdates(_0x2d1aab){return function(_0x1184e1){try{jsonpatch['apply'](_0x1184e1,_0x2d1aab,!![]);}catch(_0x153a48){return BPromise['reject'](_0x153a48);}return _0x1184e1[_0xeb1c('0x23')]();};}function saveUpdates(_0x15a6ce,_0x3ceb78){return function(_0x1de9c8){if(_0x1de9c8){return _0x1de9c8[_0xeb1c('0x24')](_0x15a6ce)['then'](function(_0x4aeef1){return _0x4aeef1;});}return null;};}function removeEntity(_0x30f7e7,_0x2ccf06){return function(_0x467879){if(_0x467879){return _0x467879[_0xeb1c('0x25')]()['then'](function(){_0x30f7e7[_0xeb1c('0x1b')](0xcc)[_0xeb1c('0x1c')]();});}};}function handleEntityNotFound(_0x45b422,_0x5034d7){return function(_0x49868c){if(!_0x49868c){_0x45b422[_0xeb1c('0x1a')](0x194);}return _0x49868c;};}function handleError(_0x5d12b8,_0x3baaf9){_0x3baaf9=_0x3baaf9||0x1f4;return function(_0x220f1f){logger['error'](_0x220f1f[_0xeb1c('0x26')]);if(_0x220f1f[_0xeb1c('0x27')]){delete _0x220f1f[_0xeb1c('0x27')];}_0x5d12b8['status'](_0x3baaf9)[_0xeb1c('0x28')](_0x220f1f);};}exports[_0xeb1c('0x29')]=function(_0xa78603,_0x4a2b47){var _0x314b42={},_0x5da4fb={},_0x30ae5d={'count':0x0,'rows':[]};var _0x109260=_['map'](db[_0xeb1c('0x2a')][_0xeb1c('0x2b')],function(_0x1ebe52){return{'name':_0x1ebe52[_0xeb1c('0x2c')],'type':_0x1ebe52[_0xeb1c('0x2d')][_0xeb1c('0x2e')]};});_0x5da4fb[_0xeb1c('0x2f')]=_[_0xeb1c('0x30')](_0x109260,'name');_0x5da4fb[_0xeb1c('0x31')]=_['keys'](_0xa78603[_0xeb1c('0x31')]);_0x5da4fb[_0xeb1c('0x32')]=_['intersection'](_0x5da4fb[_0xeb1c('0x2f')],_0x5da4fb[_0xeb1c('0x31')]);_0x314b42[_0xeb1c('0x33')]=_[_0xeb1c('0x34')](_0x5da4fb[_0xeb1c('0x2f')],qs[_0xeb1c('0x35')](_0xa78603[_0xeb1c('0x31')][_0xeb1c('0x35')]));_0x314b42[_0xeb1c('0x33')]=_0x314b42[_0xeb1c('0x33')][_0xeb1c('0x36')]?_0x314b42[_0xeb1c('0x33')]:_0x5da4fb['model'];if(!_0xa78603[_0xeb1c('0x31')][_0xeb1c('0x37')](_0xeb1c('0x38'))){_0x314b42[_0xeb1c('0x1e')]=qs[_0xeb1c('0x1e')](_0xa78603['query'][_0xeb1c('0x1e')]);_0x314b42['offset']=qs[_0xeb1c('0x1d')](_0xa78603['query']['offset']);}_0x314b42[_0xeb1c('0x39')]=qs[_0xeb1c('0x3a')](_0xa78603[_0xeb1c('0x31')][_0xeb1c('0x3a')]);_0x314b42[_0xeb1c('0x3b')]=qs[_0xeb1c('0x32')](_[_0xeb1c('0x3c')](_0xa78603[_0xeb1c('0x31')],_0x5da4fb['filters']),_0x109260);if(_0xa78603[_0xeb1c('0x31')]['filter']){_0x314b42[_0xeb1c('0x3b')]=_['merge'](_0x314b42[_0xeb1c('0x3b')],{'$or':_['map'](_0x109260,function(_0x32093f){if(_0x32093f[_0xeb1c('0x2d')]!==_0xeb1c('0x3d')){var _0x29a393={};_0x29a393[_0x32093f[_0xeb1c('0x27')]]={'$like':'%'+_0xa78603[_0xeb1c('0x31')][_0xeb1c('0x3e')]+'%'};return _0x29a393;}})});}_0x314b42=_['merge']({},_0x314b42,_0xa78603['options']);var _0x5bace4={'where':_0x314b42['where']};return db[_0xeb1c('0x2a')][_0xeb1c('0x20')](_0x5bace4)[_0xeb1c('0x3f')](function(_0x18c335){_0x30ae5d[_0xeb1c('0x20')]=_0x18c335;if(_0xa78603[_0xeb1c('0x31')][_0xeb1c('0x40')]){_0x314b42[_0xeb1c('0x41')]=[{'all':!![]}];}return db[_0xeb1c('0x2a')][_0xeb1c('0x42')](_0x314b42);})[_0xeb1c('0x3f')](function(_0x31e120){_0x30ae5d['rows']=_0x31e120;return _0x30ae5d;})[_0xeb1c('0x3f')](respondWithFilteredResult(_0x4a2b47,_0x314b42))[_0xeb1c('0x43')](handleError(_0x4a2b47,null));};exports['show']=function(_0x148bf8,_0x381df3){var _0x181eaa={'raw':!![],'where':{'id':_0x148bf8['params']['id']}},_0x27c945={};_0x27c945[_0xeb1c('0x2f')]=_['keys'](db['JscriptyQuestionReport'][_0xeb1c('0x2b')]);_0x27c945[_0xeb1c('0x31')]=_[_0xeb1c('0x44')](_0x148bf8['query']);_0x27c945['filters']=_['intersection'](_0x27c945['model'],_0x27c945[_0xeb1c('0x31')]);_0x181eaa[_0xeb1c('0x33')]=_['intersection'](_0x27c945['model'],qs[_0xeb1c('0x35')](_0x148bf8['query'][_0xeb1c('0x35')]));_0x181eaa[_0xeb1c('0x33')]=_0x181eaa[_0xeb1c('0x33')][_0xeb1c('0x36')]?_0x181eaa[_0xeb1c('0x33')]:_0x27c945[_0xeb1c('0x2f')];if(_0x148bf8[_0xeb1c('0x31')][_0xeb1c('0x40')]){_0x181eaa[_0xeb1c('0x41')]=[{'all':!![]}];}_0x181eaa=_['merge']({},_0x181eaa,_0x148bf8['options']);return db[_0xeb1c('0x2a')][_0xeb1c('0x45')](_0x181eaa)[_0xeb1c('0x3f')](handleEntityNotFound(_0x381df3,null))[_0xeb1c('0x3f')](respondWithResult(_0x381df3,null))[_0xeb1c('0x43')](handleError(_0x381df3,null));};exports['create']=function(_0x25cee1,_0x149474){return db[_0xeb1c('0x2a')][_0xeb1c('0x46')](_0x25cee1['body'],{})[_0xeb1c('0x3f')](respondWithResult(_0x149474,0xc9))[_0xeb1c('0x43')](handleError(_0x149474,null));};exports['update']=function(_0x2ead50,_0x5612c0){if(_0x2ead50['body']['id']){delete _0x2ead50[_0xeb1c('0x47')]['id'];}return db['JscriptyQuestionReport'][_0xeb1c('0x45')]({'where':{'id':_0x2ead50[_0xeb1c('0x48')]['id']}})['then'](handleEntityNotFound(_0x5612c0,null))[_0xeb1c('0x3f')](saveUpdates(_0x2ead50[_0xeb1c('0x47')],null))[_0xeb1c('0x3f')](respondWithResult(_0x5612c0,null))['catch'](handleError(_0x5612c0,null));};exports[_0xeb1c('0x25')]=function(_0x13e103,_0x2929e7){return db['JscriptyQuestionReport']['find']({'where':{'id':_0x13e103[_0xeb1c('0x48')]['id']}})[_0xeb1c('0x3f')](handleEntityNotFound(_0x2929e7,null))[_0xeb1c('0x3f')](removeEntity(_0x2929e7,null))[_0xeb1c('0x43')](handleError(_0x2929e7,null));};exports[_0xeb1c('0x49')]=function(_0x190074,_0x518aa0){return db[_0xeb1c('0x2a')][_0xeb1c('0x49')]()['then'](respondWithResult(_0x518aa0,null))[_0xeb1c('0x43')](handleError(_0x518aa0,null));}; \ No newline at end of file +var _0xf375=['destroy','error','stack','name','send','index','rawAttributes','type','key','model','keys','filters','attributes','intersection','query','length','hasOwnProperty','order','sort','pick','filter','where','merge','map','VIRTUAL','options','JscriptyQuestionReport','includeAll','findAll','rows','catch','show','params','fields','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','update','then'];(function(_0x2959a4,_0x53fc5d){var _0x155179=function(_0x54dd4e){while(--_0x54dd4e){_0x2959a4['push'](_0x2959a4['shift']());}};_0x155179(++_0x53fc5d);}(_0xf375,0x71));var _0x5f37=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xf375[_0x432682];return _0x463d05;};'use strict';var emlformat=require(_0x5f37('0x0'));var rimraf=require(_0x5f37('0x1'));var zipdir=require(_0x5f37('0x2'));var jsonpatch=require(_0x5f37('0x3'));var rp=require(_0x5f37('0x4'));var moment=require('moment');var BPromise=require(_0x5f37('0x5'));var Mustache=require(_0x5f37('0x6'));var util=require(_0x5f37('0x7'));var path=require('path');var sox=require(_0x5f37('0x8'));var csv=require(_0x5f37('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5f37('0xa'));var _=require('lodash');var squel=require(_0x5f37('0xb'));var crypto=require(_0x5f37('0xc'));var jsforce=require(_0x5f37('0xd'));var deskjs=require(_0x5f37('0xe'));var toCsv=require(_0x5f37('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x5f37('0xf'));var authService=require(_0x5f37('0x10'));var qs=require(_0x5f37('0x11'));var as=require(_0x5f37('0x12'));var hardwareService=require(_0x5f37('0x13'));var logger=require(_0x5f37('0x14'))(_0x5f37('0x15'));var utils=require(_0x5f37('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x5f37('0x17'))['db'];function respondWithStatusCode(_0x54f240,_0x436fb4){_0x436fb4=_0x436fb4||0xcc;return function(_0x1966f6){if(_0x1966f6){return _0x54f240[_0x5f37('0x18')](_0x436fb4);}return _0x54f240[_0x5f37('0x19')](_0x436fb4)[_0x5f37('0x1a')]();};}function respondWithResult(_0x4a2dd9,_0xf8779a){_0xf8779a=_0xf8779a||0xc8;return function(_0x150062){if(_0x150062){return _0x4a2dd9[_0x5f37('0x19')](_0xf8779a)[_0x5f37('0x1b')](_0x150062);}};}function respondWithFilteredResult(_0x33bb83,_0x47dd43){return function(_0x38190e){if(_0x38190e){var _0x1c188d=typeof _0x47dd43[_0x5f37('0x1c')]===_0x5f37('0x1d')&&typeof _0x47dd43[_0x5f37('0x1e')]===_0x5f37('0x1d');var _0x4ea69a=_0x38190e[_0x5f37('0x1f')];var _0x245798=_0x1c188d?0x0:_0x47dd43[_0x5f37('0x1c')];var _0x351d6e=_0x1c188d?_0x38190e['count']:_0x47dd43[_0x5f37('0x1c')]+_0x47dd43[_0x5f37('0x1e')];var _0x9c7dbe;if(_0x351d6e>=_0x4ea69a){_0x351d6e=_0x4ea69a;_0x9c7dbe=0xc8;}else{_0x9c7dbe=0xce;}_0x33bb83[_0x5f37('0x19')](_0x9c7dbe);return _0x33bb83[_0x5f37('0x20')](_0x5f37('0x21'),_0x245798+'-'+_0x351d6e+'/'+_0x4ea69a)['json'](_0x38190e);}return null;};}function patchUpdates(_0xd50a39){return function(_0x5706f1){try{jsonpatch[_0x5f37('0x22')](_0x5706f1,_0xd50a39,!![]);}catch(_0x60e901){return BPromise['reject'](_0x60e901);}return _0x5706f1['save']();};}function saveUpdates(_0x44860f,_0x1cbf29){return function(_0x18399f){if(_0x18399f){return _0x18399f[_0x5f37('0x23')](_0x44860f)[_0x5f37('0x24')](function(_0x376090){return _0x376090;});}return null;};}function removeEntity(_0x398aae,_0x4a56e8){return function(_0x1591fb){if(_0x1591fb){return _0x1591fb[_0x5f37('0x25')]()['then'](function(){_0x398aae[_0x5f37('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2966af,_0x319799){return function(_0x265727){if(!_0x265727){_0x2966af[_0x5f37('0x18')](0x194);}return _0x265727;};}function handleError(_0x35c759,_0x5cf31d){_0x5cf31d=_0x5cf31d||0x1f4;return function(_0x1440b4){logger[_0x5f37('0x26')](_0x1440b4[_0x5f37('0x27')]);if(_0x1440b4[_0x5f37('0x28')]){delete _0x1440b4['name'];}_0x35c759[_0x5f37('0x19')](_0x5cf31d)[_0x5f37('0x29')](_0x1440b4);};}exports[_0x5f37('0x2a')]=function(_0x265949,_0x4e0f23){var _0x126c75={},_0x23ddf8={},_0x41cdfa={'count':0x0,'rows':[]};var _0x3d2a9e=_['map'](db['JscriptyQuestionReport'][_0x5f37('0x2b')],function(_0x58cb7b){return{'name':_0x58cb7b['fieldName'],'type':_0x58cb7b[_0x5f37('0x2c')][_0x5f37('0x2d')]};});_0x23ddf8[_0x5f37('0x2e')]=_['map'](_0x3d2a9e,_0x5f37('0x28'));_0x23ddf8['query']=_[_0x5f37('0x2f')](_0x265949['query']);_0x23ddf8[_0x5f37('0x30')]=_['intersection'](_0x23ddf8[_0x5f37('0x2e')],_0x23ddf8['query']);_0x126c75[_0x5f37('0x31')]=_[_0x5f37('0x32')](_0x23ddf8[_0x5f37('0x2e')],qs['fields'](_0x265949[_0x5f37('0x33')]['fields']));_0x126c75['attributes']=_0x126c75[_0x5f37('0x31')][_0x5f37('0x34')]?_0x126c75[_0x5f37('0x31')]:_0x23ddf8[_0x5f37('0x2e')];if(!_0x265949['query'][_0x5f37('0x35')]('nolimit')){_0x126c75['limit']=qs[_0x5f37('0x1e')](_0x265949[_0x5f37('0x33')][_0x5f37('0x1e')]);_0x126c75[_0x5f37('0x1c')]=qs[_0x5f37('0x1c')](_0x265949[_0x5f37('0x33')]['offset']);}_0x126c75[_0x5f37('0x36')]=qs[_0x5f37('0x37')](_0x265949['query'][_0x5f37('0x37')]);_0x126c75['where']=qs['filters'](_[_0x5f37('0x38')](_0x265949[_0x5f37('0x33')],_0x23ddf8[_0x5f37('0x30')]),_0x3d2a9e);if(_0x265949['query'][_0x5f37('0x39')]){_0x126c75[_0x5f37('0x3a')]=_[_0x5f37('0x3b')](_0x126c75[_0x5f37('0x3a')],{'$or':_[_0x5f37('0x3c')](_0x3d2a9e,function(_0x398169){if(_0x398169[_0x5f37('0x2c')]!==_0x5f37('0x3d')){var _0xe85e52={};_0xe85e52[_0x398169[_0x5f37('0x28')]]={'$like':'%'+_0x265949[_0x5f37('0x33')][_0x5f37('0x39')]+'%'};return _0xe85e52;}})});}_0x126c75=_['merge']({},_0x126c75,_0x265949[_0x5f37('0x3e')]);var _0x2951c3={'where':_0x126c75[_0x5f37('0x3a')]};return db[_0x5f37('0x3f')]['count'](_0x2951c3)['then'](function(_0x5687b7){_0x41cdfa[_0x5f37('0x1f')]=_0x5687b7;if(_0x265949[_0x5f37('0x33')][_0x5f37('0x40')]){_0x126c75['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x5f37('0x41')](_0x126c75);})[_0x5f37('0x24')](function(_0x3f1927){_0x41cdfa[_0x5f37('0x42')]=_0x3f1927;return _0x41cdfa;})['then'](respondWithFilteredResult(_0x4e0f23,_0x126c75))[_0x5f37('0x43')](handleError(_0x4e0f23,null));};exports[_0x5f37('0x44')]=function(_0x5c6968,_0x3ab5f8){var _0x520d70={'raw':!![],'where':{'id':_0x5c6968[_0x5f37('0x45')]['id']}},_0x3fabe2={};_0x3fabe2['model']=_['keys'](db['JscriptyQuestionReport'][_0x5f37('0x2b')]);_0x3fabe2['query']=_[_0x5f37('0x2f')](_0x5c6968[_0x5f37('0x33')]);_0x3fabe2['filters']=_[_0x5f37('0x32')](_0x3fabe2['model'],_0x3fabe2['query']);_0x520d70[_0x5f37('0x31')]=_['intersection'](_0x3fabe2[_0x5f37('0x2e')],qs[_0x5f37('0x46')](_0x5c6968[_0x5f37('0x33')]['fields']));_0x520d70[_0x5f37('0x31')]=_0x520d70[_0x5f37('0x31')][_0x5f37('0x34')]?_0x520d70[_0x5f37('0x31')]:_0x3fabe2[_0x5f37('0x2e')];if(_0x5c6968['query'][_0x5f37('0x40')]){_0x520d70['include']=[{'all':!![]}];}_0x520d70=_['merge']({},_0x520d70,_0x5c6968[_0x5f37('0x3e')]);return db[_0x5f37('0x3f')][_0x5f37('0x47')](_0x520d70)['then'](handleEntityNotFound(_0x3ab5f8,null))[_0x5f37('0x24')](respondWithResult(_0x3ab5f8,null))['catch'](handleError(_0x3ab5f8,null));};exports[_0x5f37('0x48')]=function(_0x2f0e98,_0x93ba6){return db[_0x5f37('0x3f')][_0x5f37('0x48')](_0x2f0e98['body'],{})['then'](respondWithResult(_0x93ba6,0xc9))[_0x5f37('0x43')](handleError(_0x93ba6,null));};exports[_0x5f37('0x23')]=function(_0xd0fab0,_0xa43cdb){if(_0xd0fab0[_0x5f37('0x49')]['id']){delete _0xd0fab0['body']['id'];}return db['JscriptyQuestionReport'][_0x5f37('0x47')]({'where':{'id':_0xd0fab0[_0x5f37('0x45')]['id']}})[_0x5f37('0x24')](handleEntityNotFound(_0xa43cdb,null))['then'](saveUpdates(_0xd0fab0[_0x5f37('0x49')],null))[_0x5f37('0x24')](respondWithResult(_0xa43cdb,null))[_0x5f37('0x43')](handleError(_0xa43cdb,null));};exports[_0x5f37('0x25')]=function(_0x22e191,_0x5cc20a){return db[_0x5f37('0x3f')][_0x5f37('0x47')]({'where':{'id':_0x22e191[_0x5f37('0x45')]['id']}})[_0x5f37('0x24')](handleEntityNotFound(_0x5cc20a,null))['then'](removeEntity(_0x5cc20a,null))['catch'](handleError(_0x5cc20a,null));};exports[_0x5f37('0x4a')]=function(_0x2f68e5,_0x524d57){return db['JscriptyQuestionReport']['describe']()[_0x5f37('0x24')](respondWithResult(_0x524d57,null))[_0x5f37('0x43')](handleError(_0x524d57,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index ca56d4f..a9a79f1 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 _0xc588=['./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37862d,_0x59a5f5){var _0x225adc=function(_0x4fde2e){while(--_0x4fde2e){_0x37862d['push'](_0x37862d['shift']());}};_0x225adc(++_0x59a5f5);}(_0xc588,0x183));var _0x8c58=function(_0x32bff9,_0x3f27d5){_0x32bff9=_0x32bff9-0x0;var _0xbab93=_0xc588[_0x32bff9];return _0xbab93;};'use strict';var _=require(_0x8c58('0x0'));var util=require(_0x8c58('0x1'));var logger=require(_0x8c58('0x2'))(_0x8c58('0x3'));var moment=require('moment');var BPromise=require(_0x8c58('0x4'));var rp=require(_0x8c58('0x5'));var fs=require('fs');var path=require(_0x8c58('0x6'));var rimraf=require(_0x8c58('0x7'));var config=require(_0x8c58('0x8'));var attributes=require(_0x8c58('0x9'));module[_0x8c58('0xa')]=function(_0x53005a,_0x318fcf){return _0x53005a['define'](_0x8c58('0xb'),attributes,{'tableName':'report_jscripty_questions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa838=['rimraf','./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x33080e,_0x1c600a){var _0x407395=function(_0x5b62fd){while(--_0x5b62fd){_0x33080e['push'](_0x33080e['shift']());}};_0x407395(++_0x1c600a);}(_0xa838,0xc5));var _0x8a83=function(_0xee5c2c,_0x132e81){_0xee5c2c=_0xee5c2c-0x0;var _0x26294d=_0xa838[_0xee5c2c];return _0x26294d;};'use strict';var _=require('lodash');var util=require(_0x8a83('0x0'));var logger=require(_0x8a83('0x1'))(_0x8a83('0x2'));var moment=require(_0x8a83('0x3'));var BPromise=require(_0x8a83('0x4'));var rp=require(_0x8a83('0x5'));var fs=require('fs');var path=require(_0x8a83('0x6'));var rimraf=require(_0x8a83('0x7'));var config=require('../../config/environment');var attributes=require(_0x8a83('0x8'));module[_0x8a83('0x9')]=function(_0x428977,_0x28f088){return _0x428977[_0x8a83('0xa')](_0x8a83('0xb'),attributes,{'tableName':'report_jscripty_questions','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 1dbadb0..c703cdc 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 _0x583a=['info','request\x20sent','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','error','code','JscriptyQuestionReport,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request'];(function(_0xf76aed,_0x1c49ed){var _0x415131=function(_0x2a0727){while(--_0x2a0727){_0xf76aed['push'](_0xf76aed['shift']());}};_0x415131(++_0x1c49ed);}(_0x583a,0xbd));var _0xa583=function(_0x5e42a7,_0x3eba35){_0x5e42a7=_0x5e42a7-0x0;var _0x36d21b=_0x583a[_0x5e42a7];return _0x36d21b;};'use strict';var _=require(_0xa583('0x0'));var util=require(_0xa583('0x1'));var moment=require('moment');var BPromise=require(_0xa583('0x2'));var rs=require(_0xa583('0x3'));var fs=require('fs');var Redis=require(_0xa583('0x4'));var db=require(_0xa583('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xa583('0x6'))('rpc');var config=require(_0xa583('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa583('0x8')][_0xa583('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x54bc7,_0x7f8e7d,_0x2b1282){return new BPromise(function(_0x3ff79b,_0x552186){return client[_0xa583('0xa')](_0x54bc7,_0x2b1282)['then'](function(_0x472573){logger[_0xa583('0xb')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x7f8e7d,_0xa583('0xc'));logger['debug'](_0xa583('0xd'),_0x7f8e7d,_0xa583('0xc'),JSON['stringify'](_0x472573));if(_0x472573[_0xa583('0xe')]){if(_0x472573['error'][_0xa583('0xf')]===0x1f4){logger[_0xa583('0xe')](_0xa583('0x10'),_0x7f8e7d,_0x472573['error'][_0xa583('0x11')]);return _0x552186(_0x472573['error'][_0xa583('0x11')]);}logger[_0xa583('0xe')](_0xa583('0x10'),_0x7f8e7d,_0x472573[_0xa583('0xe')][_0xa583('0x11')]);return _0x3ff79b(_0x472573['error']['message']);}else{logger['info'](_0xa583('0x10'),_0x7f8e7d,_0xa583('0xc'));_0x3ff79b(_0x472573[_0xa583('0x12')][_0xa583('0x11')]);}})[_0xa583('0x13')](function(_0x20388c){logger[_0xa583('0xe')](_0xa583('0x10'),_0x7f8e7d,_0x20388c);_0x552186(_0x20388c);});});} \ No newline at end of file +var _0x9541=['jayson/promise','client','http','request','then','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../config/logger','../../config/environment'];(function(_0x1b6cf0,_0x25f9cc){var _0x4712f4=function(_0x4f5380){while(--_0x4f5380){_0x1b6cf0['push'](_0x1b6cf0['shift']());}};_0x4712f4(++_0x25f9cc);}(_0x9541,0xc1));var _0x1954=function(_0x5c2010,_0x35319f){_0x5c2010=_0x5c2010-0x0;var _0x4c5a63=_0x9541[_0x5c2010];return _0x4c5a63;};'use strict';var _=require(_0x1954('0x0'));var util=require(_0x1954('0x1'));var moment=require(_0x1954('0x2'));var BPromise=require(_0x1954('0x3'));var rs=require(_0x1954('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1954('0x5'))('rpc');var config=require(_0x1954('0x6'));var jayson=require(_0x1954('0x7'));var client=jayson[_0x1954('0x8')][_0x1954('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a15a3,_0x34ba75,_0x5a5dea){return new BPromise(function(_0x23cd28,_0x186c58){return client[_0x1954('0xa')](_0x2a15a3,_0x5a5dea)[_0x1954('0xb')](function(_0x3e2464){logger[_0x1954('0xc')](_0x1954('0xd'),_0x34ba75,_0x1954('0xe'));logger[_0x1954('0xf')]('JscriptyQuestionReport,\x20%s,\x20%s,\x20%s',_0x34ba75,_0x1954('0xe'),JSON['stringify'](_0x3e2464));if(_0x3e2464[_0x1954('0x10')]){if(_0x3e2464['error'][_0x1954('0x11')]===0x1f4){logger[_0x1954('0x10')](_0x1954('0xd'),_0x34ba75,_0x3e2464['error']['message']);return _0x186c58(_0x3e2464['error'][_0x1954('0x12')]);}logger[_0x1954('0x10')](_0x1954('0xd'),_0x34ba75,_0x3e2464[_0x1954('0x10')][_0x1954('0x12')]);return _0x23cd28(_0x3e2464[_0x1954('0x10')][_0x1954('0x12')]);}else{logger[_0x1954('0xc')](_0x1954('0xd'),_0x34ba75,_0x1954('0xe'));_0x23cd28(_0x3e2464[_0x1954('0x13')]['message']);}})['catch'](function(_0x51d862){logger[_0x1954('0x10')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x34ba75,_0x51d862);_0x186c58(_0x51d862);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index 4bf7b01..5b0e02d 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 _0xb74f=['./jscriptySessionReport.controller','/describe','isAuthenticated','get','/:id','/:id/questions','getQuestions','create','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x424879,_0x1ac14b){var _0x20063b=function(_0x57a49a){while(--_0x57a49a){_0x424879['push'](_0x424879['shift']());}};_0x20063b(++_0x1ac14b);}(_0xb74f,0x13a));var _0xfb74=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xb74f[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xfb74('0x0'));var util=require(_0xfb74('0x1'));var path=require(_0xfb74('0x2'));var timeout=require(_0xfb74('0x3'));var express=require(_0xfb74('0x4'));var router=express[_0xfb74('0x5')]();var fs_extra=require(_0xfb74('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xfb74('0x7'));var config=require(_0xfb74('0x8'));var controller=require(_0xfb74('0x9'));router['get']('/',auth['isAuthenticated'](),controller['index']);router['get'](_0xfb74('0xa'),auth[_0xfb74('0xb')](),controller['describe']);router[_0xfb74('0xc')](_0xfb74('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xfb74('0xc')](_0xfb74('0xe'),auth[_0xfb74('0xb')](),controller[_0xfb74('0xf')]);router['post']('/',auth[_0xfb74('0xb')](),controller[_0xfb74('0x10')]);router['put'](_0xfb74('0xd'),auth[_0xfb74('0xb')](),controller['update']);router['delete'](_0xfb74('0xd'),auth[_0xfb74('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf027=['show','getQuestions','post','put','update','delete','exports','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id'];(function(_0x302150,_0x4ddbce){var _0x5ea595=function(_0x4f2d96){while(--_0x4f2d96){_0x302150['push'](_0x302150['shift']());}};_0x5ea595(++_0x4ddbce);}(_0xf027,0x183));var _0x7f02=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf027[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0x7f02('0x0'));var path=require(_0x7f02('0x1'));var timeout=require(_0x7f02('0x2'));var express=require(_0x7f02('0x3'));var router=express[_0x7f02('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7f02('0x5'));var config=require(_0x7f02('0x6'));var controller=require('./jscriptySessionReport.controller');router[_0x7f02('0x7')]('/',auth[_0x7f02('0x8')](),controller[_0x7f02('0x9')]);router[_0x7f02('0x7')](_0x7f02('0xa'),auth[_0x7f02('0x8')](),controller['describe']);router[_0x7f02('0x7')](_0x7f02('0xb'),auth[_0x7f02('0x8')](),controller[_0x7f02('0xc')]);router['get']('/:id/questions',auth[_0x7f02('0x8')](),controller[_0x7f02('0xd')]);router[_0x7f02('0xe')]('/',auth[_0x7f02('0x8')](),controller['create']);router[_0x7f02('0xf')]('/:id',auth[_0x7f02('0x8')](),controller[_0x7f02('0x10')]);router[_0x7f02('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7f02('0x12')]=router; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js b/server/api/jscriptySessionReport/jscriptySessionReport.attributes.js index 8b9eca4..40ad564 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 _0x2a33=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','moment','sequelize','DATE'];(function(_0x5186a4,_0xd4c61b){var _0x4091e4=function(_0x4684db){while(--_0x4684db){_0x5186a4['push'](_0x5186a4['shift']());}};_0x4091e4(++_0xd4c61b);}(_0x2a33,0x153));var _0x32a3=function(_0x33707f,_0x4b0c1a){_0x33707f=_0x33707f-0x0;var _0x353df4=_0x2a33[_0x33707f];return _0x353df4;};'use strict';var moment=require(_0x32a3('0x0'));var Sequelize=require(_0x32a3('0x1'));module['exports']={'starttime':{'type':Sequelize[_0x32a3('0x2')],'set':function(_0xece0f0){this[_0x32a3('0x3')](_0x32a3('0x4'),_0xece0f0);this[_0x32a3('0x3')](_0x32a3('0x5'),moment()[_0x32a3('0x6')](_0x32a3('0x7')));}},'endtime':{'type':Sequelize[_0x32a3('0x2')]},'membername':{'type':Sequelize[_0x32a3('0x8')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x32a3('0x8')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x32a3('0x8')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x78dc=['moment','exports','DATE','setDataValue','starttime','endtime','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x78dc,0x75));var _0xc78d=function(_0x134192,_0x36adc5){_0x134192=_0x134192-0x0;var _0x3cd080=_0x78dc[_0x134192];return _0x3cd080;};'use strict';var moment=require(_0xc78d('0x0'));var Sequelize=require('sequelize');module[_0xc78d('0x1')]={'starttime':{'type':Sequelize[_0xc78d('0x2')],'set':function(_0x2034bc){this[_0xc78d('0x3')](_0xc78d('0x4'),_0x2034bc);this[_0xc78d('0x3')](_0xc78d('0x5'),moment()['format'](_0xc78d('0x6')));}},'endtime':{'type':Sequelize[_0xc78d('0x2')]},'membername':{'type':Sequelize[_0xc78d('0x7')]},'projectname':{'type':Sequelize[_0xc78d('0x7')]},'queue':{'type':Sequelize[_0xc78d('0x7')]},'uniqueid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc78d('0x7')]},'calleridnum':{'type':Sequelize['STRING']},'completed':{'type':Sequelize[_0xc78d('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 785abd9..7653564 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 _0x8701=['to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','then','error','stack','name','index','JscriptySessionReport','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','merge','type','options','includeAll','include','rows','catch','show','params','rawAttributes','create','body','destroy','describe','getQuestions','findOne','JscriptyQuestionReport','order','pick','SessionId','findAll','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8701,0x1cc));var _0x1870=function(_0x5f6a8a,_0x45f474){_0x5f6a8a=_0x5f6a8a-0x0;var _0x2cce4d=_0x8701[_0x5f6a8a];return _0x2cce4d;};'use strict';var emlformat=require(_0x1870('0x0'));var rimraf=require(_0x1870('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x1870('0x2'));var rp=require(_0x1870('0x3'));var moment=require(_0x1870('0x4'));var BPromise=require(_0x1870('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1870('0x6'));var sox=require(_0x1870('0x7'));var csv=require('to-csv');var ejs=require(_0x1870('0x8'));var fs=require('fs');var fs_extra=require(_0x1870('0x9'));var _=require(_0x1870('0xa'));var squel=require('squel');var crypto=require(_0x1870('0xb'));var jsforce=require(_0x1870('0xc'));var deskjs=require(_0x1870('0xd'));var toCsv=require(_0x1870('0xe'));var querystring=require('querystring');var Papa=require(_0x1870('0xf'));var Redis=require(_0x1870('0x10'));var authService=require(_0x1870('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x1870('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1870('0x13'))('api');var utils=require(_0x1870('0x14'));var config=require(_0x1870('0x15'));var licenseUtil=require(_0x1870('0x16'));var db=require(_0x1870('0x17'))['db'];function respondWithStatusCode(_0x480700,_0x49c76a){_0x49c76a=_0x49c76a||0xcc;return function(_0x371a67){if(_0x371a67){return _0x480700[_0x1870('0x18')](_0x49c76a);}return _0x480700[_0x1870('0x19')](_0x49c76a)[_0x1870('0x1a')]();};}function respondWithResult(_0x179f4e,_0x3a86f8){_0x3a86f8=_0x3a86f8||0xc8;return function(_0x57ddeb){if(_0x57ddeb){return _0x179f4e[_0x1870('0x19')](_0x3a86f8)[_0x1870('0x1b')](_0x57ddeb);}};}function respondWithFilteredResult(_0x442d52,_0x112d94){return function(_0x2b7078){if(_0x2b7078){var _0x3872d3=typeof _0x112d94[_0x1870('0x1c')]===_0x1870('0x1d')&&typeof _0x112d94[_0x1870('0x1e')]===_0x1870('0x1d');var _0x41ed1b=_0x2b7078[_0x1870('0x1f')];var _0xc374ba=_0x3872d3?0x0:_0x112d94[_0x1870('0x1c')];var _0x5a13cb=_0x3872d3?_0x2b7078['count']:_0x112d94['offset']+_0x112d94[_0x1870('0x1e')];var _0x18ee31;if(_0x5a13cb>=_0x41ed1b){_0x5a13cb=_0x41ed1b;_0x18ee31=0xc8;}else{_0x18ee31=0xce;}_0x442d52[_0x1870('0x19')](_0x18ee31);return _0x442d52['set'](_0x1870('0x20'),_0xc374ba+'-'+_0x5a13cb+'/'+_0x41ed1b)[_0x1870('0x1b')](_0x2b7078);}return null;};}function patchUpdates(_0x314944){return function(_0xbf0c0d){try{jsonpatch[_0x1870('0x21')](_0xbf0c0d,_0x314944,!![]);}catch(_0x28300a){return BPromise[_0x1870('0x22')](_0x28300a);}return _0xbf0c0d[_0x1870('0x23')]();};}function saveUpdates(_0x5af09f,_0x52e4dd){return function(_0x38157c){if(_0x38157c){return _0x38157c['update'](_0x5af09f)[_0x1870('0x24')](function(_0x3b0a38){return _0x3b0a38;});}return null;};}function removeEntity(_0x57d316,_0x182533){return function(_0x5e7083){if(_0x5e7083){return _0x5e7083['destroy']()['then'](function(){_0x57d316[_0x1870('0x19')](0xcc)[_0x1870('0x1a')]();});}};}function handleEntityNotFound(_0x2ea749,_0x2bd158){return function(_0x45f50b){if(!_0x45f50b){_0x2ea749['sendStatus'](0x194);}return _0x45f50b;};}function handleError(_0x400572,_0xbb8634){_0xbb8634=_0xbb8634||0x1f4;return function(_0xd5b8cb){logger[_0x1870('0x25')](_0xd5b8cb[_0x1870('0x26')]);if(_0xd5b8cb['name']){delete _0xd5b8cb[_0x1870('0x27')];}_0x400572['status'](_0xbb8634)['send'](_0xd5b8cb);};}exports[_0x1870('0x28')]=function(_0x196b78,_0xa79aae){var _0xe1f3fb={},_0x5d2173={},_0x3badf8={'count':0x0,'rows':[]};var _0x20bae5=_['map'](db[_0x1870('0x29')]['rawAttributes'],function(_0x1da200){return{'name':_0x1da200[_0x1870('0x2a')],'type':_0x1da200['type'][_0x1870('0x2b')]};});_0x5d2173[_0x1870('0x2c')]=_[_0x1870('0x2d')](_0x20bae5,_0x1870('0x27'));_0x5d2173[_0x1870('0x2e')]=_[_0x1870('0x2f')](_0x196b78[_0x1870('0x2e')]);_0x5d2173[_0x1870('0x30')]=_[_0x1870('0x31')](_0x5d2173[_0x1870('0x2c')],_0x5d2173[_0x1870('0x2e')]);_0xe1f3fb[_0x1870('0x32')]=_[_0x1870('0x31')](_0x5d2173[_0x1870('0x2c')],qs[_0x1870('0x33')](_0x196b78['query']['fields']));_0xe1f3fb['attributes']=_0xe1f3fb[_0x1870('0x32')][_0x1870('0x34')]?_0xe1f3fb[_0x1870('0x32')]:_0x5d2173['model'];if(!_0x196b78[_0x1870('0x2e')][_0x1870('0x35')](_0x1870('0x36'))){_0xe1f3fb['limit']=qs[_0x1870('0x1e')](_0x196b78[_0x1870('0x2e')][_0x1870('0x1e')]);_0xe1f3fb[_0x1870('0x1c')]=qs[_0x1870('0x1c')](_0x196b78[_0x1870('0x2e')][_0x1870('0x1c')]);}_0xe1f3fb['order']=qs[_0x1870('0x37')](_0x196b78['query'][_0x1870('0x37')]);_0xe1f3fb['where']=qs[_0x1870('0x30')](_['pick'](_0x196b78[_0x1870('0x2e')],_0x5d2173['filters']),_0x20bae5);if(_0x196b78[_0x1870('0x2e')][_0x1870('0x38')]){_0xe1f3fb[_0x1870('0x39')]=_[_0x1870('0x3a')](_0xe1f3fb[_0x1870('0x39')],{'$or':_[_0x1870('0x2d')](_0x20bae5,function(_0x3dbf0f){if(_0x3dbf0f[_0x1870('0x3b')]!=='VIRTUAL'){var _0x24664d={};_0x24664d[_0x3dbf0f[_0x1870('0x27')]]={'$like':'%'+_0x196b78[_0x1870('0x2e')][_0x1870('0x38')]+'%'};return _0x24664d;}})});}_0xe1f3fb=_[_0x1870('0x3a')]({},_0xe1f3fb,_0x196b78[_0x1870('0x3c')]);var _0x1c0a60={'where':_0xe1f3fb['where']};return db['JscriptySessionReport'][_0x1870('0x1f')](_0x1c0a60)[_0x1870('0x24')](function(_0xa586b){_0x3badf8[_0x1870('0x1f')]=_0xa586b;if(_0x196b78['query'][_0x1870('0x3d')]){_0xe1f3fb[_0x1870('0x3e')]=[{'all':!![]}];}return db[_0x1870('0x29')]['findAll'](_0xe1f3fb);})[_0x1870('0x24')](function(_0x4a487e){_0x3badf8[_0x1870('0x3f')]=_0x4a487e;return _0x3badf8;})[_0x1870('0x24')](respondWithFilteredResult(_0xa79aae,_0xe1f3fb))[_0x1870('0x40')](handleError(_0xa79aae,null));};exports[_0x1870('0x41')]=function(_0x233bf5,_0x4da188){var _0x4e5e27={'raw':!![],'where':{'id':_0x233bf5[_0x1870('0x42')]['id']}},_0x1b136e={};_0x1b136e['model']=_['keys'](db['JscriptySessionReport'][_0x1870('0x43')]);_0x1b136e[_0x1870('0x2e')]=_['keys'](_0x233bf5['query']);_0x1b136e[_0x1870('0x30')]=_[_0x1870('0x31')](_0x1b136e[_0x1870('0x2c')],_0x1b136e[_0x1870('0x2e')]);_0x4e5e27['attributes']=_[_0x1870('0x31')](_0x1b136e[_0x1870('0x2c')],qs[_0x1870('0x33')](_0x233bf5[_0x1870('0x2e')][_0x1870('0x33')]));_0x4e5e27[_0x1870('0x32')]=_0x4e5e27[_0x1870('0x32')][_0x1870('0x34')]?_0x4e5e27[_0x1870('0x32')]:_0x1b136e['model'];if(_0x233bf5[_0x1870('0x2e')]['includeAll']){_0x4e5e27['include']=[{'all':!![]}];}_0x4e5e27=_['merge']({},_0x4e5e27,_0x233bf5[_0x1870('0x3c')]);return db[_0x1870('0x29')]['find'](_0x4e5e27)['then'](handleEntityNotFound(_0x4da188,null))['then'](respondWithResult(_0x4da188,null))[_0x1870('0x40')](handleError(_0x4da188,null));};exports[_0x1870('0x44')]=function(_0x4ec84c,_0x3aad9c){return db['JscriptySessionReport'][_0x1870('0x44')](_0x4ec84c[_0x1870('0x45')],{})[_0x1870('0x24')](respondWithResult(_0x3aad9c,0xc9))[_0x1870('0x40')](handleError(_0x3aad9c,null));};exports['update']=function(_0x2bba4b,_0x4eb3fb){if(_0x2bba4b[_0x1870('0x45')]['id']){delete _0x2bba4b[_0x1870('0x45')]['id'];}return db[_0x1870('0x29')]['find']({'where':{'id':_0x2bba4b['params']['id']}})[_0x1870('0x24')](handleEntityNotFound(_0x4eb3fb,null))[_0x1870('0x24')](saveUpdates(_0x2bba4b[_0x1870('0x45')],null))[_0x1870('0x24')](respondWithResult(_0x4eb3fb,null))[_0x1870('0x40')](handleError(_0x4eb3fb,null));};exports[_0x1870('0x46')]=function(_0x29b733,_0x2afcd3){return db[_0x1870('0x29')]['find']({'where':{'id':_0x29b733[_0x1870('0x42')]['id']}})[_0x1870('0x24')](handleEntityNotFound(_0x2afcd3,null))['then'](removeEntity(_0x2afcd3,null))[_0x1870('0x40')](handleError(_0x2afcd3,null));};exports[_0x1870('0x47')]=function(_0x383671,_0x1f46d6){return db[_0x1870('0x29')][_0x1870('0x47')]()[_0x1870('0x24')](respondWithResult(_0x1f46d6,null))[_0x1870('0x40')](handleError(_0x1f46d6,null));};exports[_0x1870('0x48')]=function(_0x2955eb,_0x6c69,_0x56c99e){var _0x1b30c9={'raw':!![],'where':{}};var _0xfe5f06={};var _0x1725dc={'count':0x0,'rows':[]};return db[_0x1870('0x29')][_0x1870('0x49')]({'where':{'id':_0x2955eb[_0x1870('0x42')]['id']}})[_0x1870('0x24')](handleEntityNotFound(_0x6c69,null))[_0x1870('0x24')](function(_0xc71213){if(_0xc71213){_0xfe5f06[_0x1870('0x2c')]=_['keys'](db[_0x1870('0x4a')]['rawAttributes']);_0xfe5f06['query']=_[_0x1870('0x2f')](_0x2955eb['query']);_0xfe5f06[_0x1870('0x30')]=_[_0x1870('0x31')](_0xfe5f06[_0x1870('0x2c')],_0xfe5f06[_0x1870('0x2e')]);_0x1b30c9['attributes']=_['intersection'](_0xfe5f06[_0x1870('0x2c')],qs[_0x1870('0x33')](_0x2955eb[_0x1870('0x2e')][_0x1870('0x33')]));_0x1b30c9[_0x1870('0x32')]=_0x1b30c9[_0x1870('0x32')][_0x1870('0x34')]?_0x1b30c9[_0x1870('0x32')]:_0xfe5f06['model'];if(!_0x2955eb[_0x1870('0x2e')][_0x1870('0x35')](_0x1870('0x36'))){_0x1b30c9[_0x1870('0x1e')]=qs[_0x1870('0x1e')](_0x2955eb[_0x1870('0x2e')][_0x1870('0x1e')]);_0x1b30c9[_0x1870('0x1c')]=qs['offset'](_0x2955eb[_0x1870('0x2e')][_0x1870('0x1c')]);}_0x1b30c9[_0x1870('0x4b')]=qs[_0x1870('0x37')](_0x2955eb[_0x1870('0x2e')][_0x1870('0x37')]);_0x1b30c9[_0x1870('0x39')]=qs[_0x1870('0x30')](_[_0x1870('0x4c')](_0x2955eb[_0x1870('0x2e')],_0xfe5f06[_0x1870('0x30')]));_0x1b30c9[_0x1870('0x39')][_0x1870('0x4d')]=_0xc71213['id'];if(_0x2955eb[_0x1870('0x2e')][_0x1870('0x38')]){_0x1b30c9[_0x1870('0x39')]=_['merge'](_0x1b30c9[_0x1870('0x39')],{'$or':_[_0x1870('0x2d')](_0x1b30c9['attributes'],function(_0x11cb75){var _0x1d9516={};_0x1d9516[_0x11cb75]={'$like':'%'+_0x2955eb['query'][_0x1870('0x38')]+'%'};return _0x1d9516;})});}_0x1b30c9=_[_0x1870('0x3a')]({},_0x1b30c9,_0x2955eb[_0x1870('0x3c')]);return db[_0x1870('0x4a')][_0x1870('0x1f')]({'where':_0x1b30c9[_0x1870('0x39')]})['then'](function(_0x250b67){_0x1725dc[_0x1870('0x1f')]=_0x250b67;if(_0x2955eb[_0x1870('0x2e')]['includeAll']){_0x1b30c9['include']=[{'all':!![]}];}return db['JscriptyQuestionReport'][_0x1870('0x4e')](_0x1b30c9);})[_0x1870('0x24')](function(_0x70b2a){_0x1725dc[_0x1870('0x3f')]=_0x70b2a;return _0x1725dc;});}})['then'](respondWithFilteredResult(_0x6c69,_0x1b30c9))[_0x1870('0x40')](handleError(_0x6c69,null));}; \ No newline at end of file +var _0x6c85=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','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','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','save','update','then','destroy','error','stack','name','send','index','JscriptySessionReport','rawAttributes','fieldName','type','model','map','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','catch','show','params','includeAll','include','find','create','body','describe','getQuestions','findOne','JscriptyQuestionReport'];(function(_0x385fc6,_0x28cfb8){var _0x539414=function(_0x5e0ca2){while(--_0x5e0ca2){_0x385fc6['push'](_0x385fc6['shift']());}};_0x539414(++_0x28cfb8);}(_0x6c85,0xa4));var _0x56c8=function(_0x327f66,_0x188d77){_0x327f66=_0x327f66-0x0;var _0x31f70a=_0x6c85[_0x327f66];return _0x31f70a;};'use strict';var emlformat=require(_0x56c8('0x0'));var rimraf=require(_0x56c8('0x1'));var zipdir=require(_0x56c8('0x2'));var jsonpatch=require(_0x56c8('0x3'));var rp=require('request-promise');var moment=require(_0x56c8('0x4'));var BPromise=require(_0x56c8('0x5'));var Mustache=require('mustache');var util=require(_0x56c8('0x6'));var path=require(_0x56c8('0x7'));var sox=require(_0x56c8('0x8'));var csv=require(_0x56c8('0x9'));var ejs=require(_0x56c8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x56c8('0xb'));var squel=require('squel');var crypto=require(_0x56c8('0xc'));var jsforce=require(_0x56c8('0xd'));var deskjs=require(_0x56c8('0xe'));var toCsv=require(_0x56c8('0x9'));var querystring=require(_0x56c8('0xf'));var Papa=require(_0x56c8('0x10'));var Redis=require(_0x56c8('0x11'));var authService=require(_0x56c8('0x12'));var qs=require(_0x56c8('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x56c8('0x14'));var logger=require(_0x56c8('0x15'))(_0x56c8('0x16'));var utils=require(_0x56c8('0x17'));var config=require(_0x56c8('0x18'));var licenseUtil=require(_0x56c8('0x19'));var db=require(_0x56c8('0x1a'))['db'];function respondWithStatusCode(_0x5accf9,_0x2f1b8e){_0x2f1b8e=_0x2f1b8e||0xcc;return function(_0x525bec){if(_0x525bec){return _0x5accf9['sendStatus'](_0x2f1b8e);}return _0x5accf9[_0x56c8('0x1b')](_0x2f1b8e)[_0x56c8('0x1c')]();};}function respondWithResult(_0x50f589,_0x580fd3){_0x580fd3=_0x580fd3||0xc8;return function(_0x23c4ff){if(_0x23c4ff){return _0x50f589[_0x56c8('0x1b')](_0x580fd3)['json'](_0x23c4ff);}};}function respondWithFilteredResult(_0x3f3cc6,_0x22f835){return function(_0x55338b){if(_0x55338b){var _0x17f00e=typeof _0x22f835['offset']===_0x56c8('0x1d')&&typeof _0x22f835[_0x56c8('0x1e')]===_0x56c8('0x1d');var _0x83261b=_0x55338b[_0x56c8('0x1f')];var _0x497897=_0x17f00e?0x0:_0x22f835[_0x56c8('0x20')];var _0x3a0e0e=_0x17f00e?_0x55338b[_0x56c8('0x1f')]:_0x22f835[_0x56c8('0x20')]+_0x22f835[_0x56c8('0x1e')];var _0x4ef0bf;if(_0x3a0e0e>=_0x83261b){_0x3a0e0e=_0x83261b;_0x4ef0bf=0xc8;}else{_0x4ef0bf=0xce;}_0x3f3cc6[_0x56c8('0x1b')](_0x4ef0bf);return _0x3f3cc6[_0x56c8('0x21')](_0x56c8('0x22'),_0x497897+'-'+_0x3a0e0e+'/'+_0x83261b)[_0x56c8('0x23')](_0x55338b);}return null;};}function patchUpdates(_0x56b062){return function(_0x1118bf){try{jsonpatch[_0x56c8('0x24')](_0x1118bf,_0x56b062,!![]);}catch(_0x50a5dd){return BPromise['reject'](_0x50a5dd);}return _0x1118bf[_0x56c8('0x25')]();};}function saveUpdates(_0x23b9c3,_0x11573b){return function(_0x4467bf){if(_0x4467bf){return _0x4467bf[_0x56c8('0x26')](_0x23b9c3)[_0x56c8('0x27')](function(_0x44756e){return _0x44756e;});}return null;};}function removeEntity(_0x1838cf,_0x1824a8){return function(_0x21ce24){if(_0x21ce24){return _0x21ce24[_0x56c8('0x28')]()[_0x56c8('0x27')](function(){_0x1838cf[_0x56c8('0x1b')](0xcc)[_0x56c8('0x1c')]();});}};}function handleEntityNotFound(_0x3d143e,_0x527e9c){return function(_0x867796){if(!_0x867796){_0x3d143e['sendStatus'](0x194);}return _0x867796;};}function handleError(_0x1d96d4,_0x293902){_0x293902=_0x293902||0x1f4;return function(_0x56a687){logger[_0x56c8('0x29')](_0x56a687[_0x56c8('0x2a')]);if(_0x56a687[_0x56c8('0x2b')]){delete _0x56a687[_0x56c8('0x2b')];}_0x1d96d4[_0x56c8('0x1b')](_0x293902)[_0x56c8('0x2c')](_0x56a687);};}exports[_0x56c8('0x2d')]=function(_0x3496cc,_0xf8af12){var _0x2c7673={},_0x6e2fa8={},_0x4183dd={'count':0x0,'rows':[]};var _0x31fb64=_['map'](db[_0x56c8('0x2e')][_0x56c8('0x2f')],function(_0x274964){return{'name':_0x274964[_0x56c8('0x30')],'type':_0x274964[_0x56c8('0x31')]['key']};});_0x6e2fa8[_0x56c8('0x32')]=_[_0x56c8('0x33')](_0x31fb64,_0x56c8('0x2b'));_0x6e2fa8['query']=_[_0x56c8('0x34')](_0x3496cc[_0x56c8('0x35')]);_0x6e2fa8[_0x56c8('0x36')]=_[_0x56c8('0x37')](_0x6e2fa8[_0x56c8('0x32')],_0x6e2fa8[_0x56c8('0x35')]);_0x2c7673['attributes']=_[_0x56c8('0x37')](_0x6e2fa8[_0x56c8('0x32')],qs['fields'](_0x3496cc['query'][_0x56c8('0x38')]));_0x2c7673[_0x56c8('0x39')]=_0x2c7673['attributes'][_0x56c8('0x3a')]?_0x2c7673[_0x56c8('0x39')]:_0x6e2fa8[_0x56c8('0x32')];if(!_0x3496cc[_0x56c8('0x35')][_0x56c8('0x3b')]('nolimit')){_0x2c7673[_0x56c8('0x1e')]=qs[_0x56c8('0x1e')](_0x3496cc[_0x56c8('0x35')]['limit']);_0x2c7673['offset']=qs[_0x56c8('0x20')](_0x3496cc[_0x56c8('0x35')]['offset']);}_0x2c7673[_0x56c8('0x3c')]=qs[_0x56c8('0x3d')](_0x3496cc[_0x56c8('0x35')][_0x56c8('0x3d')]);_0x2c7673['where']=qs[_0x56c8('0x36')](_[_0x56c8('0x3e')](_0x3496cc[_0x56c8('0x35')],_0x6e2fa8[_0x56c8('0x36')]),_0x31fb64);if(_0x3496cc[_0x56c8('0x35')][_0x56c8('0x3f')]){_0x2c7673[_0x56c8('0x40')]=_['merge'](_0x2c7673[_0x56c8('0x40')],{'$or':_[_0x56c8('0x33')](_0x31fb64,function(_0x289a3b){if(_0x289a3b['type']!==_0x56c8('0x41')){var _0x15f795={};_0x15f795[_0x289a3b['name']]={'$like':'%'+_0x3496cc['query'][_0x56c8('0x3f')]+'%'};return _0x15f795;}})});}_0x2c7673=_[_0x56c8('0x42')]({},_0x2c7673,_0x3496cc[_0x56c8('0x43')]);var _0x3e5f72={'where':_0x2c7673[_0x56c8('0x40')]};return db[_0x56c8('0x2e')][_0x56c8('0x1f')](_0x3e5f72)['then'](function(_0x29fb67){_0x4183dd[_0x56c8('0x1f')]=_0x29fb67;if(_0x3496cc[_0x56c8('0x35')]['includeAll']){_0x2c7673['include']=[{'all':!![]}];}return db[_0x56c8('0x2e')][_0x56c8('0x44')](_0x2c7673);})[_0x56c8('0x27')](function(_0x8529a2){_0x4183dd[_0x56c8('0x45')]=_0x8529a2;return _0x4183dd;})[_0x56c8('0x27')](respondWithFilteredResult(_0xf8af12,_0x2c7673))[_0x56c8('0x46')](handleError(_0xf8af12,null));};exports[_0x56c8('0x47')]=function(_0x330a30,_0x7cb456){var _0x4e76a9={'raw':!![],'where':{'id':_0x330a30[_0x56c8('0x48')]['id']}},_0x1b582a={};_0x1b582a[_0x56c8('0x32')]=_[_0x56c8('0x34')](db[_0x56c8('0x2e')][_0x56c8('0x2f')]);_0x1b582a[_0x56c8('0x35')]=_[_0x56c8('0x34')](_0x330a30[_0x56c8('0x35')]);_0x1b582a[_0x56c8('0x36')]=_[_0x56c8('0x37')](_0x1b582a[_0x56c8('0x32')],_0x1b582a['query']);_0x4e76a9[_0x56c8('0x39')]=_[_0x56c8('0x37')](_0x1b582a[_0x56c8('0x32')],qs[_0x56c8('0x38')](_0x330a30[_0x56c8('0x35')]['fields']));_0x4e76a9[_0x56c8('0x39')]=_0x4e76a9[_0x56c8('0x39')][_0x56c8('0x3a')]?_0x4e76a9[_0x56c8('0x39')]:_0x1b582a[_0x56c8('0x32')];if(_0x330a30[_0x56c8('0x35')][_0x56c8('0x49')]){_0x4e76a9[_0x56c8('0x4a')]=[{'all':!![]}];}_0x4e76a9=_['merge']({},_0x4e76a9,_0x330a30[_0x56c8('0x43')]);return db['JscriptySessionReport'][_0x56c8('0x4b')](_0x4e76a9)[_0x56c8('0x27')](handleEntityNotFound(_0x7cb456,null))[_0x56c8('0x27')](respondWithResult(_0x7cb456,null))[_0x56c8('0x46')](handleError(_0x7cb456,null));};exports[_0x56c8('0x4c')]=function(_0x585e31,_0x2fdc06){return db[_0x56c8('0x2e')][_0x56c8('0x4c')](_0x585e31[_0x56c8('0x4d')],{})[_0x56c8('0x27')](respondWithResult(_0x2fdc06,0xc9))[_0x56c8('0x46')](handleError(_0x2fdc06,null));};exports[_0x56c8('0x26')]=function(_0x469da3,_0x177309){if(_0x469da3[_0x56c8('0x4d')]['id']){delete _0x469da3[_0x56c8('0x4d')]['id'];}return db['JscriptySessionReport']['find']({'where':{'id':_0x469da3['params']['id']}})[_0x56c8('0x27')](handleEntityNotFound(_0x177309,null))[_0x56c8('0x27')](saveUpdates(_0x469da3[_0x56c8('0x4d')],null))[_0x56c8('0x27')](respondWithResult(_0x177309,null))[_0x56c8('0x46')](handleError(_0x177309,null));};exports[_0x56c8('0x28')]=function(_0x4af38a,_0x5c5820){return db[_0x56c8('0x2e')][_0x56c8('0x4b')]({'where':{'id':_0x4af38a[_0x56c8('0x48')]['id']}})[_0x56c8('0x27')](handleEntityNotFound(_0x5c5820,null))['then'](removeEntity(_0x5c5820,null))[_0x56c8('0x46')](handleError(_0x5c5820,null));};exports['describe']=function(_0x4c4a6a,_0x5dc8d0){return db[_0x56c8('0x2e')][_0x56c8('0x4e')]()['then'](respondWithResult(_0x5dc8d0,null))[_0x56c8('0x46')](handleError(_0x5dc8d0,null));};exports[_0x56c8('0x4f')]=function(_0x5ca429,_0xe5c0ff,_0x3cfa46){var _0x532d9a={'raw':!![],'where':{}};var _0x1a6878={};var _0x43e086={'count':0x0,'rows':[]};return db[_0x56c8('0x2e')][_0x56c8('0x50')]({'where':{'id':_0x5ca429['params']['id']}})[_0x56c8('0x27')](handleEntityNotFound(_0xe5c0ff,null))[_0x56c8('0x27')](function(_0x3b8cc0){if(_0x3b8cc0){_0x1a6878['model']=_[_0x56c8('0x34')](db[_0x56c8('0x51')]['rawAttributes']);_0x1a6878[_0x56c8('0x35')]=_[_0x56c8('0x34')](_0x5ca429[_0x56c8('0x35')]);_0x1a6878[_0x56c8('0x36')]=_[_0x56c8('0x37')](_0x1a6878[_0x56c8('0x32')],_0x1a6878[_0x56c8('0x35')]);_0x532d9a[_0x56c8('0x39')]=_['intersection'](_0x1a6878[_0x56c8('0x32')],qs[_0x56c8('0x38')](_0x5ca429[_0x56c8('0x35')][_0x56c8('0x38')]));_0x532d9a[_0x56c8('0x39')]=_0x532d9a[_0x56c8('0x39')]['length']?_0x532d9a[_0x56c8('0x39')]:_0x1a6878[_0x56c8('0x32')];if(!_0x5ca429[_0x56c8('0x35')][_0x56c8('0x3b')]('nolimit')){_0x532d9a[_0x56c8('0x1e')]=qs[_0x56c8('0x1e')](_0x5ca429[_0x56c8('0x35')][_0x56c8('0x1e')]);_0x532d9a[_0x56c8('0x20')]=qs[_0x56c8('0x20')](_0x5ca429[_0x56c8('0x35')]['offset']);}_0x532d9a['order']=qs[_0x56c8('0x3d')](_0x5ca429[_0x56c8('0x35')]['sort']);_0x532d9a[_0x56c8('0x40')]=qs['filters'](_['pick'](_0x5ca429['query'],_0x1a6878[_0x56c8('0x36')]));_0x532d9a[_0x56c8('0x40')]['SessionId']=_0x3b8cc0['id'];if(_0x5ca429[_0x56c8('0x35')][_0x56c8('0x3f')]){_0x532d9a[_0x56c8('0x40')]=_[_0x56c8('0x42')](_0x532d9a[_0x56c8('0x40')],{'$or':_[_0x56c8('0x33')](_0x532d9a[_0x56c8('0x39')],function(_0xeaec08){var _0x3d47ad={};_0x3d47ad[_0xeaec08]={'$like':'%'+_0x5ca429[_0x56c8('0x35')]['filter']+'%'};return _0x3d47ad;})});}_0x532d9a=_[_0x56c8('0x42')]({},_0x532d9a,_0x5ca429[_0x56c8('0x43')]);return db['JscriptyQuestionReport'][_0x56c8('0x1f')]({'where':_0x532d9a['where']})[_0x56c8('0x27')](function(_0x436595){_0x43e086['count']=_0x436595;if(_0x5ca429[_0x56c8('0x35')][_0x56c8('0x49')]){_0x532d9a[_0x56c8('0x4a')]=[{'all':!![]}];}return db[_0x56c8('0x51')]['findAll'](_0x532d9a);})[_0x56c8('0x27')](function(_0x33d01f){_0x43e086[_0x56c8('0x45')]=_0x33d01f;return _0x43e086;});}})[_0x56c8('0x27')](respondWithFilteredResult(_0xe5c0ff,_0x532d9a))[_0x56c8('0x46')](handleError(_0xe5c0ff,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index 4c33922..72604d8 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 _0x9a5a=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x9a5a,0x194));var _0xa9a5=function(_0x40f6bf,_0x2ac109){_0x40f6bf=_0x40f6bf-0x0;var _0x4fa7f7=_0x9a5a[_0x40f6bf];return _0x4fa7f7;};'use strict';var _=require(_0xa9a5('0x0'));var util=require(_0xa9a5('0x1'));var logger=require(_0xa9a5('0x2'))(_0xa9a5('0x3'));var moment=require(_0xa9a5('0x4'));var BPromise=require('bluebird');var rp=require(_0xa9a5('0x5'));var fs=require('fs');var path=require(_0xa9a5('0x6'));var rimraf=require(_0xa9a5('0x7'));var config=require(_0xa9a5('0x8'));var attributes=require(_0xa9a5('0x9'));module[_0xa9a5('0xa')]=function(_0x4a73f4,_0xb0ccd9){return _0x4a73f4[_0xa9a5('0xb')](_0xa9a5('0xc'),attributes,{'tableName':_0xa9a5('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1883=['../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x536380,_0x3f79d5){var _0xd2229d=function(_0x1daa83){while(--_0x1daa83){_0x536380['push'](_0x536380['shift']());}};_0xd2229d(++_0x3f79d5);}(_0x1883,0xab));var _0x3188=function(_0x3b8ab2,_0x32c7a3){_0x3b8ab2=_0x3b8ab2-0x0;var _0x43fd08=_0x1883[_0x3b8ab2];return _0x43fd08;};'use strict';var _=require(_0x3188('0x0'));var util=require(_0x3188('0x1'));var logger=require(_0x3188('0x2'))(_0x3188('0x3'));var moment=require(_0x3188('0x4'));var BPromise=require(_0x3188('0x5'));var rp=require(_0x3188('0x6'));var fs=require('fs');var path=require(_0x3188('0x7'));var rimraf=require(_0x3188('0x8'));var config=require(_0x3188('0x9'));var attributes=require(_0x3188('0xa'));module[_0x3188('0xb')]=function(_0x408ae0,_0x33b62d){return _0x408ae0[_0x3188('0xc')](_0x3188('0xd'),attributes,{'tableName':_0x3188('0xe'),'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 af49f7d..1ffb2e2 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 _0x7046=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x161821,_0x460ea1){var _0x21a6aa=function(_0x4c0e66){while(--_0x4c0e66){_0x161821['push'](_0x161821['shift']());}};_0x21a6aa(++_0x460ea1);}(_0x7046,0x144));var _0x6704=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x7046[_0x57b54c];return _0x59cc19;};'use strict';var _=require(_0x6704('0x0'));var util=require(_0x6704('0x1'));var moment=require(_0x6704('0x2'));var BPromise=require(_0x6704('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6704('0x4'));var db=require(_0x6704('0x5'))['db'];var utils=require(_0x6704('0x6'));var logger=require('../../config/logger')(_0x6704('0x7'));var config=require(_0x6704('0x8'));var jayson=require(_0x6704('0x9'));var client=jayson[_0x6704('0xa')][_0x6704('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4badf8,_0x5ced8,_0x49b8b6){return new BPromise(function(_0x56b1ff,_0x390ace){return client['request'](_0x4badf8,_0x49b8b6)['then'](function(_0x3ca599){logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,_0x6704('0xe'));logger[_0x6704('0xf')](_0x6704('0x10'),_0x5ced8,_0x6704('0xe'),JSON[_0x6704('0x11')](_0x3ca599));if(_0x3ca599['error']){if(_0x3ca599[_0x6704('0x12')][_0x6704('0x13')]===0x1f4){logger['error'](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x390ace(_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);}logger[_0x6704('0x12')](_0x6704('0xd'),_0x5ced8,_0x3ca599[_0x6704('0x12')][_0x6704('0x14')]);return _0x56b1ff(_0x3ca599['error'][_0x6704('0x14')]);}else{logger[_0x6704('0xc')](_0x6704('0xd'),_0x5ced8,'request\x20sent');_0x56b1ff(_0x3ca599[_0x6704('0x15')][_0x6704('0x14')]);}})[_0x6704('0x16')](function(_0x29fa46){logger[_0x6704('0x12')]('JscriptySessionReport,\x20%s,\x20%s',_0x5ced8,_0x29fa46);_0x390ace(_0x29fa46);});});} \ No newline at end of file +var _0x4137=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','JscriptySessionReport,\x20%s,\x20%s','message','lodash','util','moment','bluebird','randomstring'];(function(_0x479509,_0x1daf8a){var _0x382da8=function(_0x39d77c){while(--_0x39d77c){_0x479509['push'](_0x479509['shift']());}};_0x382da8(++_0x1daf8a);}(_0x4137,0xf8));var _0x7413=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4137[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('JscriptySessionReport,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 5f2f219..d4c1e11 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 _0xf95f=['../../components/interaction/service','./license.controller','index','/:id','isAuthenticated','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x16214e,_0x2213fa){var _0x132fc9=function(_0x74a983){while(--_0x74a983){_0x16214e['push'](_0x16214e['shift']());}};_0x132fc9(++_0x2213fa);}(_0xf95f,0x142));var _0xff95=function(_0x3b18e6,_0x35e310){_0x3b18e6=_0x3b18e6-0x0;var _0xaf05b7=_0xf95f[_0x3b18e6];return _0xaf05b7;};'use strict';var multer=require(_0xff95('0x0'));var util=require(_0xff95('0x1'));var path=require(_0xff95('0x2'));var timeout=require(_0xff95('0x3'));var express=require(_0xff95('0x4'));var router=express[_0xff95('0x5')]();var fs_extra=require(_0xff95('0x6'));var auth=require(_0xff95('0x7'));var interaction=require(_0xff95('0x8'));var config=require('../../config/environment');var controller=require(_0xff95('0x9'));router['get']('/',controller[_0xff95('0xa')]);router['put'](_0xff95('0xb'),auth[_0xff95('0xc')](),controller[_0xff95('0xd')]);module[_0xff95('0xe')]=router; \ No newline at end of file +var _0x6ec9=['put','exports','multer','path','express','fs-extra','../../components/interaction/service','../../config/environment','get','index'];(function(_0x4ea35e,_0x40bfcc){var _0x2771e0=function(_0x1af372){while(--_0x1af372){_0x4ea35e['push'](_0x4ea35e['shift']());}};_0x2771e0(++_0x40bfcc);}(_0x6ec9,0x174));var _0x96ec=function(_0x1a59b8,_0xd2508){_0x1a59b8=_0x1a59b8-0x0;var _0x412f17=_0x6ec9[_0x1a59b8];return _0x412f17;};'use strict';var multer=require(_0x96ec('0x0'));var util=require('util');var path=require(_0x96ec('0x1'));var timeout=require('connect-timeout');var express=require(_0x96ec('0x2'));var router=express['Router']();var fs_extra=require(_0x96ec('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x96ec('0x4'));var config=require(_0x96ec('0x5'));var controller=require('./license.controller');router[_0x96ec('0x6')]('/',controller[_0x96ec('0x7')]);router[_0x96ec('0x8')]('/:id',auth['isAuthenticated'](),controller['update']);module[_0x96ec('0x9')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index e8ddf15..629be92 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 _0xc878=['TEXT','STRING','INTEGER','sequelize','exports'];(function(_0x42d20e,_0x1d24d){var _0x2af1fd=function(_0xe9f167){while(--_0xe9f167){_0x42d20e['push'](_0x42d20e['shift']());}};_0x2af1fd(++_0x1d24d);}(_0xc878,0x17a));var _0x8c87=function(_0x97c6ea,_0x4cffce){_0x97c6ea=_0x97c6ea-0x0;var _0x2d7f50=_0xc878[_0x97c6ea];return _0x2d7f50;};'use strict';var Sequelize=require(_0x8c87('0x0'));module[_0x8c87('0x1')]={'license':{'type':Sequelize[_0x8c87('0x2')]},'data1':{'type':Sequelize[_0x8c87('0x3')]},'data2':{'type':Sequelize[_0x8c87('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x8c87('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0xe3d6=['INTEGER','TEXT','STRING'];(function(_0x1af6af,_0x179329){var _0x9596d1=function(_0x3d57d1){while(--_0x3d57d1){_0x1af6af['push'](_0x1af6af['shift']());}};_0x9596d1(++_0x179329);}(_0xe3d6,0x1e7));var _0x6e3d=function(_0x51db00,_0x292fa7){_0x51db00=_0x51db00-0x0;var _0x5bd1fe=_0xe3d6[_0x51db00];return _0x5bd1fe;};'use strict';var Sequelize=require('sequelize');module['exports']={'license':{'type':Sequelize[_0x6e3d('0x0')]},'data1':{'type':Sequelize[_0x6e3d('0x1')]},'data2':{'type':Sequelize[_0x6e3d('0x1')]},'chatLicenseExceeded':{'type':Sequelize[_0x6e3d('0x2')],'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 9b751e0..decabd3 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 _0x814b=['json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','model','keys','rawAttributes','intersection','query','attributes','fields','length','merge','options','getLicense','catch','body','License','params','get','key','demo','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','sendStatus','status','end'];(function(_0x55a06,_0x3424cc){var _0x1ba0ff=function(_0x35213c){while(--_0x35213c){_0x55a06['push'](_0x55a06['shift']());}};_0x1ba0ff(++_0x3424cc);}(_0x814b,0x1a2));var _0xb814=function(_0x4e0b8c,_0x443f31){_0x4e0b8c=_0x4e0b8c-0x0;var _0x633ecc=_0x814b[_0x4e0b8c];return _0x633ecc;};'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'];function respondWithStatusCode(_0x35b10d,_0x2cc46b){_0x2cc46b=_0x2cc46b||0xcc;return function(_0x2ce718){if(_0x2ce718){return _0x35b10d[_0xb814('0x1b')](_0x2cc46b);}return _0x35b10d[_0xb814('0x1c')](_0x2cc46b)[_0xb814('0x1d')]();};}function respondWithResult(_0xa0a2e5,_0x2ab627){_0x2ab627=_0x2ab627||0xc8;return function(_0x3f4881){if(_0x3f4881){return _0xa0a2e5[_0xb814('0x1c')](_0x2ab627)[_0xb814('0x1e')](_0x3f4881);}};}function respondWithFilteredResult(_0x39bfcf,_0x303aca){return function(_0x3a71d6){if(_0x3a71d6){var _0x45e0d0=typeof _0x303aca[_0xb814('0x1f')]===_0xb814('0x20')&&typeof _0x303aca[_0xb814('0x21')]===_0xb814('0x20');var _0x48c9df=_0x3a71d6[_0xb814('0x22')];var _0x55ba16=_0x45e0d0?0x0:_0x303aca[_0xb814('0x1f')];var _0xfac75b=_0x45e0d0?_0x3a71d6['count']:_0x303aca['offset']+_0x303aca['limit'];var _0x399b43;if(_0xfac75b>=_0x48c9df){_0xfac75b=_0x48c9df;_0x399b43=0xc8;}else{_0x399b43=0xce;}_0x39bfcf['status'](_0x399b43);return _0x39bfcf['set'](_0xb814('0x23'),_0x55ba16+'-'+_0xfac75b+'/'+_0x48c9df)[_0xb814('0x1e')](_0x3a71d6);}return null;};}function patchUpdates(_0x25b6b6){return function(_0x4e139e){try{jsonpatch[_0xb814('0x24')](_0x4e139e,_0x25b6b6,!![]);}catch(_0x531032){return BPromise[_0xb814('0x25')](_0x531032);}return _0x4e139e[_0xb814('0x26')]();};}function saveUpdates(_0x3b267e,_0x470e81){return function(_0x27352e){if(_0x27352e){return _0x27352e[_0xb814('0x27')](_0x3b267e)[_0xb814('0x28')](function(_0x594470){return _0x594470;});}return null;};}function removeEntity(_0x2ead86,_0x52b7a3){return function(_0x3f81d0){if(_0x3f81d0){return _0x3f81d0[_0xb814('0x29')]()[_0xb814('0x28')](function(){_0x2ead86[_0xb814('0x1c')](0xcc)[_0xb814('0x1d')]();});}};}function handleEntityNotFound(_0xb9e57d,_0x3d836c){return function(_0x5755ea){if(!_0x5755ea){_0xb9e57d[_0xb814('0x1b')](0x194);}return _0x5755ea;};}function handleError(_0xc0ef66,_0x1c2625){_0x1c2625=_0x1c2625||0x1f4;return function(_0x349394){logger[_0xb814('0x2a')](_0x349394[_0xb814('0x2b')]);if(_0x349394[_0xb814('0x2c')]){delete _0x349394[_0xb814('0x2c')];}_0xc0ef66['status'](_0x1c2625)[_0xb814('0x2d')](_0x349394);};}var utilLicense=require(_0xb814('0x19'));exports['index']=function(_0x9008b2,_0x37d24d){var _0x530744={'raw':!![],'where':{'id':0x1}},_0x499f22={};_0x499f22[_0xb814('0x2e')]=_[_0xb814('0x2f')](db['License'][_0xb814('0x30')]);_0x499f22['query']=_[_0xb814('0x2f')](_0x9008b2['query']);_0x499f22['filters']=_[_0xb814('0x31')](_0x499f22['model'],_0x499f22[_0xb814('0x32')]);_0x530744[_0xb814('0x33')]=_[_0xb814('0x31')](_0x499f22['model'],qs['fields'](_0x9008b2[_0xb814('0x32')][_0xb814('0x34')]));_0x530744['attributes']=_0x530744[_0xb814('0x33')][_0xb814('0x35')]?_0x530744[_0xb814('0x33')]:_0x499f22[_0xb814('0x2e')];_0x530744=_[_0xb814('0x36')]({},_0x530744,_0x9008b2[_0xb814('0x37')]);return utilLicense[_0xb814('0x38')](_0x530744)['then'](respondWithResult(_0x37d24d,null))[_0xb814('0x39')](handleError(_0x37d24d,null));};exports[_0xb814('0x27')]=function(_0x30de5a,_0x424e2b){if(_0x30de5a[_0xb814('0x3a')]['id']){delete _0x30de5a['body']['id'];}return db[_0xb814('0x3b')]['find']({'where':{'id':_0x30de5a[_0xb814('0x3c')]['id']}})[_0xb814('0x28')](handleEntityNotFound(_0x424e2b,null))[_0xb814('0x28')](function(_0x492d5e){var _0x40b885=_0x492d5e[_0xb814('0x3d')]({'plain':!![]});return utilLicense['checkLicense'](_0x40b885,_0x30de5a[_0xb814('0x3a')][_0xb814('0x3e')]);})[_0xb814('0x28')](function(_0x1f7cd8){if(!_0x1f7cd8[_0xb814('0x3f')]){return saveUpdates(_0x30de5a[_0xb814('0x3a')],null);}return _0x1f7cd8;})['then'](respondWithResult(_0x424e2b,null))[_0xb814('0x39')](handleError(_0x424e2b,null));}; \ No newline at end of file +var _0x326f=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','reject','save','update','destroy','then','stack','name','send','model','keys','rawAttributes','query','filters','intersection','attributes','fields','length','options','getLicense','catch','body','License','find','checkLicense','key','demo','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x326f,0xd1));var _0xf326=function(_0x173bb7,_0x4c3112){_0x173bb7=_0x173bb7-0x0;var _0x4683dc=_0x326f[_0x173bb7];return _0x4683dc;};'use strict';var emlformat=require(_0xf326('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf326('0x1'));var rp=require(_0xf326('0x2'));var moment=require(_0xf326('0x3'));var BPromise=require(_0xf326('0x4'));var Mustache=require(_0xf326('0x5'));var util=require(_0xf326('0x6'));var path=require(_0xf326('0x7'));var sox=require(_0xf326('0x8'));var csv=require(_0xf326('0x9'));var ejs=require(_0xf326('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf326('0xb'));var squel=require(_0xf326('0xc'));var crypto=require(_0xf326('0xd'));var jsforce=require(_0xf326('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf326('0xf'));var Redis=require(_0xf326('0x10'));var authService=require(_0xf326('0x11'));var qs=require(_0xf326('0x12'));var as=require(_0xf326('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf326('0x14'))('api');var utils=require(_0xf326('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf326('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3162f9,_0x9ed463){_0x9ed463=_0x9ed463||0xcc;return function(_0x4b3966){if(_0x4b3966){return _0x3162f9[_0xf326('0x17')](_0x9ed463);}return _0x3162f9[_0xf326('0x18')](_0x9ed463)[_0xf326('0x19')]();};}function respondWithResult(_0x17a098,_0x5c8483){_0x5c8483=_0x5c8483||0xc8;return function(_0x45c1b6){if(_0x45c1b6){return _0x17a098['status'](_0x5c8483)['json'](_0x45c1b6);}};}function respondWithFilteredResult(_0xdf21d9,_0x11f6d2){return function(_0x1f2e5a){if(_0x1f2e5a){var _0xa63d1a=typeof _0x11f6d2[_0xf326('0x1a')]===_0xf326('0x1b')&&typeof _0x11f6d2[_0xf326('0x1c')]===_0xf326('0x1b');var _0x5a682a=_0x1f2e5a[_0xf326('0x1d')];var _0x453100=_0xa63d1a?0x0:_0x11f6d2[_0xf326('0x1a')];var _0x31ffb9=_0xa63d1a?_0x1f2e5a[_0xf326('0x1d')]:_0x11f6d2[_0xf326('0x1a')]+_0x11f6d2['limit'];var _0x4a5b6c;if(_0x31ffb9>=_0x5a682a){_0x31ffb9=_0x5a682a;_0x4a5b6c=0xc8;}else{_0x4a5b6c=0xce;}_0xdf21d9['status'](_0x4a5b6c);return _0xdf21d9[_0xf326('0x1e')](_0xf326('0x1f'),_0x453100+'-'+_0x31ffb9+'/'+_0x5a682a)['json'](_0x1f2e5a);}return null;};}function patchUpdates(_0x4cabce){return function(_0x128c68){try{jsonpatch['apply'](_0x128c68,_0x4cabce,!![]);}catch(_0x5b6d3c){return BPromise[_0xf326('0x20')](_0x5b6d3c);}return _0x128c68[_0xf326('0x21')]();};}function saveUpdates(_0x549b46,_0x5aa184){return function(_0x19b8ba){if(_0x19b8ba){return _0x19b8ba[_0xf326('0x22')](_0x549b46)['then'](function(_0x337ed5){return _0x337ed5;});}return null;};}function removeEntity(_0x1b9039,_0x43c53e){return function(_0x295752){if(_0x295752){return _0x295752[_0xf326('0x23')]()[_0xf326('0x24')](function(){_0x1b9039['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4f31f6,_0x520d85){return function(_0x1a2c4e){if(!_0x1a2c4e){_0x4f31f6[_0xf326('0x17')](0x194);}return _0x1a2c4e;};}function handleError(_0x1ff2b5,_0x148953){_0x148953=_0x148953||0x1f4;return function(_0x410237){logger['error'](_0x410237[_0xf326('0x25')]);if(_0x410237[_0xf326('0x26')]){delete _0x410237[_0xf326('0x26')];}_0x1ff2b5['status'](_0x148953)[_0xf326('0x27')](_0x410237);};}var utilLicense=require('../../config/license/util');exports['index']=function(_0x6a8e89,_0x1ae23a){var _0x2fa28e={'raw':!![],'where':{'id':0x1}},_0x5dbe63={};_0x5dbe63[_0xf326('0x28')]=_[_0xf326('0x29')](db['License'][_0xf326('0x2a')]);_0x5dbe63[_0xf326('0x2b')]=_[_0xf326('0x29')](_0x6a8e89[_0xf326('0x2b')]);_0x5dbe63[_0xf326('0x2c')]=_[_0xf326('0x2d')](_0x5dbe63[_0xf326('0x28')],_0x5dbe63[_0xf326('0x2b')]);_0x2fa28e[_0xf326('0x2e')]=_[_0xf326('0x2d')](_0x5dbe63['model'],qs[_0xf326('0x2f')](_0x6a8e89[_0xf326('0x2b')][_0xf326('0x2f')]));_0x2fa28e['attributes']=_0x2fa28e[_0xf326('0x2e')][_0xf326('0x30')]?_0x2fa28e[_0xf326('0x2e')]:_0x5dbe63['model'];_0x2fa28e=_['merge']({},_0x2fa28e,_0x6a8e89[_0xf326('0x31')]);return utilLicense[_0xf326('0x32')](_0x2fa28e)[_0xf326('0x24')](respondWithResult(_0x1ae23a,null))[_0xf326('0x33')](handleError(_0x1ae23a,null));};exports[_0xf326('0x22')]=function(_0x2e8a64,_0x62585a){if(_0x2e8a64[_0xf326('0x34')]['id']){delete _0x2e8a64['body']['id'];}return db[_0xf326('0x35')][_0xf326('0x36')]({'where':{'id':_0x2e8a64['params']['id']}})[_0xf326('0x24')](handleEntityNotFound(_0x62585a,null))['then'](function(_0xce1cbb){var _0x481b64=_0xce1cbb['get']({'plain':!![]});return utilLicense[_0xf326('0x37')](_0x481b64,_0x2e8a64['body'][_0xf326('0x38')]);})['then'](function(_0x310dbb){if(!_0x310dbb[_0xf326('0x39')]){return saveUpdates(_0x2e8a64[_0xf326('0x34')],null);}return _0x310dbb;})['then'](respondWithResult(_0x62585a,null))[_0xf326('0x33')](handleError(_0x62585a,null));}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 0fd1835..c08823a 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 _0xacaf=['license','lodash','../../config/logger','api','path','rimraf','../../config/environment','exports','define','License'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0xacaf,0x155));var _0xfaca=function(_0x5c619e,_0x1bccdf){_0x5c619e=_0x5c619e-0x0;var _0x445cf8=_0xacaf[_0x5c619e];return _0x445cf8;};'use strict';var _=require(_0xfaca('0x0'));var util=require('util');var logger=require(_0xfaca('0x1'))(_0xfaca('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xfaca('0x3'));var rimraf=require(_0xfaca('0x4'));var config=require(_0xfaca('0x5'));var attributes=require('./license.attributes');module[_0xfaca('0x6')]=function(_0x399515,_0x4d432f){return _0x399515[_0xfaca('0x7')](_0xfaca('0x8'),attributes,{'tableName':_0xfaca('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8fb6=['api','moment','bluebird','request-promise','path','rimraf','define','license','lodash','../../config/logger'];(function(_0x32c7e4,_0x3e7c17){var _0xea0830=function(_0x1dd2d9){while(--_0x1dd2d9){_0x32c7e4['push'](_0x32c7e4['shift']());}};_0xea0830(++_0x3e7c17);}(_0x8fb6,0x1e8));var _0x68fb=function(_0x69e694,_0x1a47fe){_0x69e694=_0x69e694-0x0;var _0x2efc2d=_0x8fb6[_0x69e694];return _0x2efc2d;};'use strict';var _=require(_0x68fb('0x0'));var util=require('util');var logger=require(_0x68fb('0x1'))(_0x68fb('0x2'));var moment=require(_0x68fb('0x3'));var BPromise=require(_0x68fb('0x4'));var rp=require(_0x68fb('0x5'));var fs=require('fs');var path=require(_0x68fb('0x6'));var rimraf=require(_0x68fb('0x7'));var config=require('../../config/environment');var attributes=require('./license.attributes');module['exports']=function(_0x45bb0b,_0x22a052){return _0x45bb0b[_0x68fb('0x8')]('License',attributes,{'tableName':_0x68fb('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 8c799bc..d1a0fdb 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 _0x6966=['../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis'];(function(_0x5e0a47,_0x3fff48){var _0x4cada2=function(_0x421a84){while(--_0x421a84){_0x5e0a47['push'](_0x5e0a47['shift']());}};_0x4cada2(++_0x3fff48);}(_0x6966,0x1c9));var _0x6696=function(_0x684052,_0x31aa8d){_0x684052=_0x684052-0x0;var _0x124468=_0x6966[_0x684052];return _0x124468;};'use strict';var _=require(_0x6696('0x0'));var util=require(_0x6696('0x1'));var moment=require(_0x6696('0x2'));var BPromise=require(_0x6696('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6696('0x4'));var db=require(_0x6696('0x5'))['db'];var utils=require(_0x6696('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x6696('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6696('0x8')][_0x6696('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3398db,_0x28cd46,_0x1d8c76){return new BPromise(function(_0xac7977,_0x2e3b37){return client[_0x6696('0xa')](_0x3398db,_0x1d8c76)[_0x6696('0xb')](function(_0x1fff5d){logger[_0x6696('0xc')](_0x6696('0xd'),_0x28cd46,_0x6696('0xe'));logger['debug'](_0x6696('0xf'),_0x28cd46,'request\x20sent',JSON[_0x6696('0x10')](_0x1fff5d));if(_0x1fff5d[_0x6696('0x11')]){if(_0x1fff5d[_0x6696('0x11')][_0x6696('0x12')]===0x1f4){logger[_0x6696('0x11')](_0x6696('0xd'),_0x28cd46,_0x1fff5d[_0x6696('0x11')]['message']);return _0x2e3b37(_0x1fff5d['error'][_0x6696('0x13')]);}logger['error']('License,\x20%s,\x20%s',_0x28cd46,_0x1fff5d[_0x6696('0x11')][_0x6696('0x13')]);return _0xac7977(_0x1fff5d[_0x6696('0x11')][_0x6696('0x13')]);}else{logger['info']('License,\x20%s,\x20%s',_0x28cd46,_0x6696('0xe'));_0xac7977(_0x1fff5d[_0x6696('0x14')][_0x6696('0x13')]);}})['catch'](function(_0x5b8d1a){logger[_0x6696('0x11')](_0x6696('0xd'),_0x28cd46,_0x5b8d1a);_0x2e3b37(_0x5b8d1a);});});} \ No newline at end of file +var _0x39a6=['error','message','result','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','License,\x20%s,\x20%s','request\x20sent','License,\x20%s,\x20%s,\x20%s'];(function(_0x2898aa,_0x8e734a){var _0x322ec2=function(_0x942422){while(--_0x942422){_0x2898aa['push'](_0x2898aa['shift']());}};_0x322ec2(++_0x8e734a);}(_0x39a6,0x75));var _0x639a=function(_0x5ea5c9,_0x17fdfa){_0x5ea5c9=_0x5ea5c9-0x0;var _0x57147c=_0x39a6[_0x5ea5c9];return _0x57147c;};'use strict';var _=require(_0x639a('0x0'));var util=require('util');var moment=require(_0x639a('0x1'));var BPromise=require('bluebird');var rs=require(_0x639a('0x2'));var fs=require('fs');var Redis=require(_0x639a('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x639a('0x4'));var logger=require(_0x639a('0x5'))(_0x639a('0x6'));var config=require(_0x639a('0x7'));var jayson=require(_0x639a('0x8'));var client=jayson[_0x639a('0x9')][_0x639a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x35a31e,_0x49e27e,_0x5daa32){return new BPromise(function(_0xad1c11,_0xbd6804){return client[_0x639a('0xb')](_0x35a31e,_0x5daa32)['then'](function(_0x5a9e26){logger[_0x639a('0xc')](_0x639a('0xd'),_0x49e27e,_0x639a('0xe'));logger['debug'](_0x639a('0xf'),_0x49e27e,_0x639a('0xe'),JSON['stringify'](_0x5a9e26));if(_0x5a9e26[_0x639a('0x10')]){if(_0x5a9e26[_0x639a('0x10')]['code']===0x1f4){logger[_0x639a('0x10')]('License,\x20%s,\x20%s',_0x49e27e,_0x5a9e26['error'][_0x639a('0x11')]);return _0xbd6804(_0x5a9e26[_0x639a('0x10')]['message']);}logger[_0x639a('0x10')]('License,\x20%s,\x20%s',_0x49e27e,_0x5a9e26['error'][_0x639a('0x11')]);return _0xad1c11(_0x5a9e26[_0x639a('0x10')]['message']);}else{logger[_0x639a('0xc')](_0x639a('0xd'),_0x49e27e,'request\x20sent');_0xad1c11(_0x5a9e26[_0x639a('0x12')][_0x639a('0x11')]);}})['catch'](function(_0x5c1e2b){logger[_0x639a('0x10')](_0x639a('0xd'),_0x49e27e,_0x5c1e2b);_0xbd6804(_0x5c1e2b);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index 2fcbfff..801c227 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 _0x213c=['getInteractions','/:id/applications','getMessages','/:id/verify','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addImap','addInteraction','addApplications','/:id/send','send','addAgents','put','update','delete','removeDispositions','removeAnswers','removeSmtp','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','/describe','/:id','show','/:id/dispositions','getDispositions','/:id/in_servers','getImap','/:id/out_servers','getSmtp','/:id/interactions'];(function(_0x54f7c0,_0x27af83){var _0x245d03=function(_0x1ad6c4){while(--_0x1ad6c4){_0x54f7c0['push'](_0x54f7c0['shift']());}};_0x245d03(++_0x27af83);}(_0x213c,0x12c));var _0xc213=function(_0x577bf8,_0x4a4d4f){_0x577bf8=_0x577bf8-0x0;var _0x59315f=_0x213c[_0x577bf8];return _0x59315f;};'use strict';var multer=require(_0xc213('0x0'));var util=require(_0xc213('0x1'));var path=require(_0xc213('0x2'));var timeout=require(_0xc213('0x3'));var express=require(_0xc213('0x4'));var router=express[_0xc213('0x5')]();var fs_extra=require(_0xc213('0x6'));var auth=require(_0xc213('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc213('0x8'));var controller=require(_0xc213('0x9'));router[_0xc213('0xa')]('/',auth[_0xc213('0xb')](),controller['index']);router[_0xc213('0xa')](_0xc213('0xc'),auth[_0xc213('0xb')](),controller['describe']);router['get'](_0xc213('0xd'),auth['isAuthenticated'](),controller[_0xc213('0xe')]);router[_0xc213('0xa')](_0xc213('0xf'),auth[_0xc213('0xb')](),controller[_0xc213('0x10')]);router['get']('/:id/canned_answers',auth[_0xc213('0xb')](),controller['getAnswers']);router[_0xc213('0xa')](_0xc213('0x11'),auth['isAuthenticated'](),controller[_0xc213('0x12')]);router[_0xc213('0xa')](_0xc213('0x13'),auth[_0xc213('0xb')](),controller[_0xc213('0x14')]);router[_0xc213('0xa')](_0xc213('0x15'),auth[_0xc213('0xb')](),controller[_0xc213('0x16')]);router[_0xc213('0xa')](_0xc213('0x17'),auth[_0xc213('0xb')](),controller['getApplications']);router[_0xc213('0xa')]('/:id/messages',auth[_0xc213('0xb')](),controller[_0xc213('0x18')]);router[_0xc213('0xa')](_0xc213('0x19'),auth[_0xc213('0xb')](),controller['verifySmtp']);router[_0xc213('0xa')](_0xc213('0x1a'),auth['isAuthenticated'](),controller[_0xc213('0x1b')]);router[_0xc213('0x1c')](_0xc213('0xf'),auth[_0xc213('0xb')](),controller[_0xc213('0x1d')]);router[_0xc213('0x1c')](_0xc213('0x1e'),auth[_0xc213('0xb')](),controller[_0xc213('0x1f')]);router[_0xc213('0x1c')]('/',auth[_0xc213('0xb')](),controller['create']);router[_0xc213('0x1c')](_0xc213('0x11'),auth[_0xc213('0xb')](),controller[_0xc213('0x20')]);router[_0xc213('0x1c')](_0xc213('0x13'),auth['isAuthenticated'](),controller['addSmtp']);router[_0xc213('0x1c')](_0xc213('0x15'),auth['isAuthenticated'](),controller[_0xc213('0x21')]);router[_0xc213('0x1c')](_0xc213('0x17'),auth[_0xc213('0xb')](),controller[_0xc213('0x22')]);router['post'](_0xc213('0x23'),auth[_0xc213('0xb')](),controller[_0xc213('0x24')]);router[_0xc213('0x1c')]('/:id/users',auth['isAuthenticated'](),controller[_0xc213('0x25')]);router[_0xc213('0x26')](_0xc213('0xd'),auth[_0xc213('0xb')](),controller[_0xc213('0x27')]);router[_0xc213('0x28')]('/:id/dispositions',auth[_0xc213('0xb')](),controller[_0xc213('0x29')]);router[_0xc213('0x28')]('/:id/canned_answers',auth[_0xc213('0xb')](),controller[_0xc213('0x2a')]);router[_0xc213('0x28')]('/:id/in_servers',auth['isAuthenticated'](),controller['removeImap']);router[_0xc213('0x28')](_0xc213('0x13'),auth['isAuthenticated'](),controller[_0xc213('0x2b')]);router['delete'](_0xc213('0xd'),auth[_0xc213('0xb')](),controller['destroy']);router[_0xc213('0x28')]('/:id/users',auth[_0xc213('0xb')](),controller[_0xc213('0x2c')]);module[_0xc213('0x2d')]=router; \ No newline at end of file +var _0xddfb=['getAnswers','getImap','getSmtp','/:id/interactions','getInteractions','/:id/applications','getApplications','/:id/messages','/:id/verify','/:id/users','addDisposition','post','addAnswer','create','addImap','/:id/out_servers','addSmtp','addInteraction','/:id/send','send','addAgents','put','delete','removeDispositions','removeAnswers','removeSmtp','destroy','removeAgents','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/dispositions','/:id/canned_answers'];(function(_0x1da527,_0x2dc953){var _0x40fc7c=function(_0x9949f5){while(--_0x9949f5){_0x1da527['push'](_0x1da527['shift']());}};_0x40fc7c(++_0x2dc953);}(_0xddfb,0x18c));var _0xbddf=function(_0xca27b7,_0xd2380b){_0xca27b7=_0xca27b7-0x0;var _0x1fecfb=_0xddfb[_0xca27b7];return _0x1fecfb;};'use strict';var multer=require('multer');var util=require(_0xbddf('0x0'));var path=require(_0xbddf('0x1'));var timeout=require(_0xbddf('0x2'));var express=require(_0xbddf('0x3'));var router=express[_0xbddf('0x4')]();var fs_extra=require(_0xbddf('0x5'));var auth=require(_0xbddf('0x6'));var interaction=require(_0xbddf('0x7'));var config=require(_0xbddf('0x8'));var controller=require(_0xbddf('0x9'));router[_0xbddf('0xa')]('/',auth['isAuthenticated'](),controller[_0xbddf('0xb')]);router['get'](_0xbddf('0xc'),auth['isAuthenticated'](),controller['describe']);router['get'](_0xbddf('0xd'),auth[_0xbddf('0xe')](),controller[_0xbddf('0xf')]);router['get'](_0xbddf('0x10'),auth[_0xbddf('0xe')](),controller['getDispositions']);router[_0xbddf('0xa')](_0xbddf('0x11'),auth[_0xbddf('0xe')](),controller[_0xbddf('0x12')]);router[_0xbddf('0xa')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xbddf('0x13')]);router['get']('/:id/out_servers',auth[_0xbddf('0xe')](),controller[_0xbddf('0x14')]);router['get'](_0xbddf('0x15'),auth['isAuthenticated'](),controller[_0xbddf('0x16')]);router[_0xbddf('0xa')](_0xbddf('0x17'),auth[_0xbddf('0xe')](),controller[_0xbddf('0x18')]);router[_0xbddf('0xa')](_0xbddf('0x19'),auth['isAuthenticated'](),controller['getMessages']);router[_0xbddf('0xa')](_0xbddf('0x1a'),auth[_0xbddf('0xe')](),controller['verifySmtp']);router['get'](_0xbddf('0x1b'),auth[_0xbddf('0xe')](),controller['getAgents']);router['post'](_0xbddf('0x10'),auth['isAuthenticated'](),controller[_0xbddf('0x1c')]);router[_0xbddf('0x1d')]('/:id/canned_answers',auth[_0xbddf('0xe')](),controller[_0xbddf('0x1e')]);router[_0xbddf('0x1d')]('/',auth[_0xbddf('0xe')](),controller[_0xbddf('0x1f')]);router[_0xbddf('0x1d')]('/:id/in_servers',auth['isAuthenticated'](),controller[_0xbddf('0x20')]);router[_0xbddf('0x1d')](_0xbddf('0x21'),auth[_0xbddf('0xe')](),controller[_0xbddf('0x22')]);router[_0xbddf('0x1d')](_0xbddf('0x15'),auth[_0xbddf('0xe')](),controller[_0xbddf('0x23')]);router['post']('/:id/applications',auth[_0xbddf('0xe')](),controller['addApplications']);router['post'](_0xbddf('0x24'),auth[_0xbddf('0xe')](),controller[_0xbddf('0x25')]);router[_0xbddf('0x1d')](_0xbddf('0x1b'),auth[_0xbddf('0xe')](),controller[_0xbddf('0x26')]);router[_0xbddf('0x27')](_0xbddf('0xd'),auth[_0xbddf('0xe')](),controller['update']);router[_0xbddf('0x28')](_0xbddf('0x10'),auth[_0xbddf('0xe')](),controller[_0xbddf('0x29')]);router[_0xbddf('0x28')](_0xbddf('0x11'),auth['isAuthenticated'](),controller[_0xbddf('0x2a')]);router[_0xbddf('0x28')]('/:id/in_servers',auth[_0xbddf('0xe')](),controller['removeImap']);router['delete'](_0xbddf('0x21'),auth['isAuthenticated'](),controller[_0xbddf('0x2b')]);router[_0xbddf('0x28')](_0xbddf('0xd'),auth['isAuthenticated'](),controller[_0xbddf('0x2c')]);router['delete'](_0xbddf('0x1b'),auth[_0xbddf('0xe')](),controller[_0xbddf('0x2d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index 4f98093..b6e5944 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 _0xeec6=['sequelize','exports','STRING','BOOLEAN','TEXT','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x709602,_0x5797e2){var _0x5e5b0d=function(_0x1744e1){while(--_0x1744e1){_0x709602['push'](_0x709602['shift']());}};_0x5e5b0d(++_0x5797e2);}(_0xeec6,0x1c2));var _0x6eec=function(_0x37b3e5,_0x33b516){_0x37b3e5=_0x37b3e5-0x0;var _0x207f20=_0xeec6[_0x37b3e5];return _0x207f20;};'use strict';var Sequelize=require(_0x6eec('0x0'));module[_0x6eec('0x1')]={'description':{'type':Sequelize[_0x6eec('0x2')]},'name':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x6eec('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x6eec('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x6eec('0x4')]},'markAsUnread':{'type':Sequelize[_0x6eec('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x6eec('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x6eec('0x5')](0x2)[_0x6eec('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x6eec('0x7');}},'notificationSound':{'type':Sequelize[_0x6eec('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x6eec('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x6eec('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x6eec('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x6eec('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x6eec('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x6eec('0x8'),'set':function(_0xfbcfa1){if(!_0xfbcfa1)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x6eec('0x9')]('mandatoryDisposition',_0xfbcfa1);}}}; \ No newline at end of file +var _0xe644=['INTEGER','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','BOOLEAN','TEXT','Arial,Helvetica,sans-serif'];(function(_0x8b97b4,_0x382038){var _0x2ed10e=function(_0x21842e){while(--_0x21842e){_0x8b97b4['push'](_0x8b97b4['shift']());}};_0x2ed10e(++_0x382038);}(_0xe644,0x159));var _0x4e64=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe644[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x4e64('0x0'));module[_0x4e64('0x1')]={'description':{'type':Sequelize[_0x4e64('0x2')]},'name':{'type':Sequelize[_0x4e64('0x2')],'allowNull':![]},'service':{'type':Sequelize[_0x4e64('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0x4e64('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize[_0x4e64('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x4e64('0x4')]},'markAsUnread':{'type':Sequelize[_0x4e64('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x4e64('0x2')],'allowNull':![],'defaultValue':_0x4e64('0x5')},'fontSize':{'type':Sequelize[_0x4e64('0x6')](0x2)['UNSIGNED'],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x4e64('0x4')],'defaultValue':function(){return _0x4e64('0x7');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4e64('0x6')],'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[_0x4e64('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4e64('0x6')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4e64('0x6')],'allowNull':!![],'defaultValue':null,'comment':_0x4e64('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x4e64('0x3')],'defaultValue':![],'comment':_0x4e64('0x9'),'set':function(_0x4ae2b3){if(!_0x4ae2b3)this[_0x4e64('0xa')](_0x4e64('0xb'),null);this['setDataValue'](_0x4e64('0xc'),_0x4ae2b3);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index b12ec54..8402a5d 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 _0x6349=['userMailAccount:remove','getAgents','User','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','juice','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','jayson/promise','http','then','info','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','MailAccount,\x20%s,\x20%s','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','Content-Range','apply','reject','save','update','destroy','get','name','index','MailServerIn','Imap','MailServerOut','Smtp','Pause','map','MailAccount','fieldName','type','key','model','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show','params','mandatoryDispositionPause','rawAttributes','fields','find','body','describe','addDisposition','MailAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','create','getAnswers','removeAnswers','email','ListId','isNil','active','description','cservice','cauthentication','user','cuser','password','pass','authentication','port','host','service','cpassword','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','getImap','addImap','removeImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','MailInteraction','getInteractions','CmContact','Contact','internal','Tag','Tags','color','tag','sequelize','transaction','MailApplication','bulkCreate','findAndCountAll','getApplications','$gte','MailMessage','inlineCss','true','send','split','CmList','List','Contacts','updatedAt','from','%s\x20<%s>','attachments','join','root','server/files/attachments','auth','SendMail','sendMail','List\x20not\x20found','messageId','subject','attach','out','format','YYYY-MM-DD\x20HH:mm:ss','Interaction','secure','VerifySmtp','verifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','omit','spread','emit','userMailAccount:save','removeAgents','isArray'];(function(_0x43a39e,_0x250130){var _0x2b3531=function(_0x172331){while(--_0x172331){_0x43a39e['push'](_0x43a39e['shift']());}};_0x2b3531(++_0x250130);}(_0x6349,0x193));var _0x9634=function(_0x5c25b0,_0x3f2ff0){_0x5c25b0=_0x5c25b0-0x0;var _0x2f7784=_0x6349[_0x5c25b0];return _0x2f7784;};'use strict';var emlformat=require(_0x9634('0x0'));var rimraf=require(_0x9634('0x1'));var zipdir=require(_0x9634('0x2'));var jsonpatch=require(_0x9634('0x3'));var rp=require(_0x9634('0x4'));var moment=require('moment');var BPromise=require(_0x9634('0x5'));var Mustache=require(_0x9634('0x6'));var util=require('util');var path=require(_0x9634('0x7'));var sox=require(_0x9634('0x8'));var csv=require(_0x9634('0x9'));var ejs=require(_0x9634('0xa'));var fs=require('fs');var fs_extra=require(_0x9634('0xb'));var _=require(_0x9634('0xc'));var squel=require(_0x9634('0xd'));var crypto=require(_0x9634('0xe'));var jsforce=require(_0x9634('0xf'));var deskjs=require(_0x9634('0x10'));var toCsv=require(_0x9634('0x9'));var querystring=require(_0x9634('0x11'));var Papa=require('papaparse');var htmlToText=require('html-to-text');var juice=require(_0x9634('0x12'));var Redis=require('ioredis');var authService=require(_0x9634('0x13'));var qs=require(_0x9634('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9634('0x15'));var logger=require(_0x9634('0x16'))(_0x9634('0x17'));var utils=require(_0x9634('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x9634('0x19'));var db=require(_0x9634('0x1a'))['db'];config[_0x9634('0x1b')]=_[_0x9634('0x1c')](config['redis'],{'host':_0x9634('0x1d'),'port':0x18eb});var socket=require(_0x9634('0x1e'))(new Redis(config['redis']));require(_0x9634('0x1f'))[_0x9634('0x20')](socket);var jayson=require(_0x9634('0x21'));var client=jayson['client'][_0x9634('0x22')]({'port':0x232b});function respondWithRpcPromise(_0x31010f,_0x3fa445,_0x121a06,_0x289bc3){return new BPromise(function(_0x3273c8,_0x2c1634){var _0x3e44ec=_0x289bc3||client;return _0x3e44ec['request'](_0x31010f,_0x121a06)[_0x9634('0x23')](function(_0x54154a){logger[_0x9634('0x24')]('MailAccount,\x20%s,\x20%s',_0x3fa445,_0x9634('0x25'));logger['debug'](_0x9634('0x26'),_0x3fa445,_0x9634('0x25'),JSON[_0x9634('0x27')](_0x54154a));if(_0x54154a[_0x9634('0x28')]){if(_0x54154a['error'][_0x9634('0x29')]===0x1f4){logger[_0x9634('0x28')](_0x9634('0x2a'),_0x3fa445,_0x54154a[_0x9634('0x28')]['message']);return _0x2c1634(_0x54154a[_0x9634('0x28')][_0x9634('0x2b')]);}logger[_0x9634('0x28')](_0x9634('0x2a'),_0x3fa445,_0x54154a['error'][_0x9634('0x2b')]);return _0x3273c8(_0x54154a[_0x9634('0x28')][_0x9634('0x2b')]);}else{logger[_0x9634('0x24')](_0x9634('0x2a'),_0x3fa445,_0x9634('0x25'));_0x3273c8(_0x54154a[_0x9634('0x2c')][_0x9634('0x2b')]);}})[_0x9634('0x2d')](function(_0xc02809){logger[_0x9634('0x28')]('MailAccount,\x20%s,\x20%s',_0x3fa445,_0xc02809);_0x2c1634(_0xc02809);});});}function respondWithStatusCode(_0x318293,_0x4196f1){_0x4196f1=_0x4196f1||0xcc;return function(_0x59577f){if(_0x59577f){return _0x318293[_0x9634('0x2e')](_0x4196f1);}return _0x318293['status'](_0x4196f1)[_0x9634('0x2f')]();};}function respondWithResult(_0x267bb2,_0x4e6ab4){_0x4e6ab4=_0x4e6ab4||0xc8;return function(_0xc05ae7){if(_0xc05ae7){return _0x267bb2[_0x9634('0x30')](_0x4e6ab4)[_0x9634('0x31')](_0xc05ae7);}};}function respondWithFilteredResult(_0x2258a5,_0x4ca2a0){return function(_0x3a1308){if(_0x3a1308){var _0x183ac4=typeof _0x4ca2a0[_0x9634('0x32')]===_0x9634('0x33')&&typeof _0x4ca2a0[_0x9634('0x34')]===_0x9634('0x33');var _0x41eaf1=_0x3a1308['count'];var _0x575613=_0x183ac4?0x0:_0x4ca2a0['offset'];var _0x583d7c=_0x183ac4?_0x3a1308['count']:_0x4ca2a0[_0x9634('0x32')]+_0x4ca2a0['limit'];var _0x3c2dba;if(_0x583d7c>=_0x41eaf1){_0x583d7c=_0x41eaf1;_0x3c2dba=0xc8;}else{_0x3c2dba=0xce;}_0x2258a5[_0x9634('0x30')](_0x3c2dba);return _0x2258a5['set'](_0x9634('0x35'),_0x575613+'-'+_0x583d7c+'/'+_0x41eaf1)[_0x9634('0x31')](_0x3a1308);}return null;};}function patchUpdates(_0xbbbeea){return function(_0x96874d){try{jsonpatch[_0x9634('0x36')](_0x96874d,_0xbbbeea,!![]);}catch(_0x434d0b){return BPromise[_0x9634('0x37')](_0x434d0b);}return _0x96874d[_0x9634('0x38')]();};}function saveUpdates(_0x581430,_0x67a2d5){return function(_0x464634){if(_0x464634){return _0x464634[_0x9634('0x39')](_0x581430)[_0x9634('0x23')](function(_0x10db91){return _0x10db91;});}return null;};}function removeEntity(_0x4b7fd8,_0x5bbb43){return function(_0x14a531){if(_0x14a531){return _0x14a531[_0x9634('0x3a')]()[_0x9634('0x23')](function(){var _0x1e2053=_0x14a531[_0x9634('0x3b')]({'plain':!![]});var _0x3a91e3='MailAccounts';return db['UserProfileResource'][_0x9634('0x3a')]({'where':{'type':_0x3a91e3,'resourceId':_0x1e2053['id']}})[_0x9634('0x23')](function(){return _0x14a531;});})[_0x9634('0x23')](function(){_0x4b7fd8[_0x9634('0x30')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56b289,_0x366f43){return function(_0x15aa67){if(!_0x15aa67){_0x56b289[_0x9634('0x2e')](0x194);}return _0x15aa67;};}function handleError(_0x18626b,_0x2d3092){_0x2d3092=_0x2d3092||0x1f4;return function(_0x366b53){logger[_0x9634('0x28')](_0x366b53['stack']);if(_0x366b53[_0x9634('0x3c')]){delete _0x366b53[_0x9634('0x3c')];}_0x18626b['status'](_0x2d3092)['send'](_0x366b53);};}exports[_0x9634('0x3d')]=function(_0xd2c976,_0xc7b865){var _0x4c91fd={'include':[{'model':db[_0x9634('0x3e')],'as':_0x9634('0x3f')},{'model':db[_0x9634('0x40')],'as':_0x9634('0x41')},{'model':db[_0x9634('0x42')],'as':'mandatoryDispositionPause'}]},_0x178206={},_0x4d11fa={'count':0x0,'rows':[]};var _0xb440d5=_[_0x9634('0x43')](db[_0x9634('0x44')]['rawAttributes'],function(_0x257f23){return{'name':_0x257f23[_0x9634('0x45')],'type':_0x257f23[_0x9634('0x46')][_0x9634('0x47')]};});_0x178206[_0x9634('0x48')]=_[_0x9634('0x43')](_0xb440d5,_0x9634('0x3c'));_0x178206[_0x9634('0x49')]=_[_0x9634('0x4a')](_0xd2c976[_0x9634('0x49')]);_0x178206['filters']=_[_0x9634('0x4b')](_0x178206[_0x9634('0x48')],_0x178206[_0x9634('0x49')]);_0x4c91fd[_0x9634('0x4c')]=_['intersection'](_0x178206[_0x9634('0x48')],qs['fields'](_0xd2c976[_0x9634('0x49')]['fields']));_0x4c91fd[_0x9634('0x4c')]=_0x4c91fd[_0x9634('0x4c')][_0x9634('0x4d')]?_0x4c91fd[_0x9634('0x4c')]:_0x178206[_0x9634('0x48')];if(!_0xd2c976[_0x9634('0x49')][_0x9634('0x4e')](_0x9634('0x4f'))){_0x4c91fd[_0x9634('0x34')]=qs[_0x9634('0x34')](_0xd2c976[_0x9634('0x49')][_0x9634('0x34')]);_0x4c91fd[_0x9634('0x32')]=qs['offset'](_0xd2c976[_0x9634('0x49')][_0x9634('0x32')]);}_0x4c91fd[_0x9634('0x50')]=qs[_0x9634('0x51')](_0xd2c976[_0x9634('0x49')]['sort']);_0x4c91fd[_0x9634('0x52')]=qs[_0x9634('0x53')](_[_0x9634('0x54')](_0xd2c976[_0x9634('0x49')],_0x178206['filters']),_0xb440d5);if(_0xd2c976['query'][_0x9634('0x55')]){_0x4c91fd[_0x9634('0x52')]=_[_0x9634('0x56')](_0x4c91fd[_0x9634('0x52')],{'$or':_['map'](_0xb440d5,function(_0xfefd2a){if(_0xfefd2a[_0x9634('0x46')]!==_0x9634('0x57')){var _0x31d178={};_0x31d178[_0xfefd2a[_0x9634('0x3c')]]={'$like':'%'+_0xd2c976['query']['filter']+'%'};return _0x31d178;}})});}_0x4c91fd=_[_0x9634('0x56')]({},_0x4c91fd,_0xd2c976[_0x9634('0x58')]);var _0x5d9262={'where':_0x4c91fd[_0x9634('0x52')]};return db[_0x9634('0x44')][_0x9634('0x59')](_0x5d9262)[_0x9634('0x23')](function(_0x581059){_0x4d11fa[_0x9634('0x59')]=_0x581059;if(_0xd2c976[_0x9634('0x49')][_0x9634('0x5a')]){_0x4c91fd[_0x9634('0x5b')]=[{'all':!![]}];}return db['MailAccount'][_0x9634('0x5c')](_0x4c91fd);})['then'](function(_0x4f244a){_0x4d11fa[_0x9634('0x5d')]=_0x4f244a;return _0x4d11fa;})[_0x9634('0x23')](respondWithFilteredResult(_0xc7b865,_0x4c91fd))['catch'](handleError(_0xc7b865,null));};exports[_0x9634('0x5e')]=function(_0x3bc375,_0x30c1df){var _0x53c0e6={'raw':![],'where':{'id':_0x3bc375[_0x9634('0x5f')]['id']},'include':[{'model':db[_0x9634('0x3e')],'as':'Imap'},{'model':db[_0x9634('0x40')],'as':'Smtp'},{'model':db[_0x9634('0x42')],'as':_0x9634('0x60')}]},_0x465100={};_0x465100[_0x9634('0x48')]=_[_0x9634('0x4a')](db['MailAccount'][_0x9634('0x61')]);_0x465100[_0x9634('0x49')]=_[_0x9634('0x4a')](_0x3bc375[_0x9634('0x49')]);_0x465100[_0x9634('0x53')]=_[_0x9634('0x4b')](_0x465100['model'],_0x465100[_0x9634('0x49')]);_0x53c0e6['attributes']=_[_0x9634('0x4b')](_0x465100[_0x9634('0x48')],qs['fields'](_0x3bc375['query'][_0x9634('0x62')]));_0x53c0e6[_0x9634('0x4c')]=_0x53c0e6[_0x9634('0x4c')]['length']?_0x53c0e6[_0x9634('0x4c')]:_0x465100[_0x9634('0x48')];if(_0x3bc375[_0x9634('0x49')][_0x9634('0x5a')]){_0x53c0e6['include']=[{'all':!![]}];}_0x53c0e6=_['merge']({},_0x53c0e6,_0x3bc375['options']);return db[_0x9634('0x44')][_0x9634('0x63')](_0x53c0e6)[_0x9634('0x23')](handleEntityNotFound(_0x30c1df,null))[_0x9634('0x23')](respondWithResult(_0x30c1df,null))[_0x9634('0x2d')](handleError(_0x30c1df,null));};exports[_0x9634('0x39')]=function(_0x2f9ab1,_0x53a60d){if(_0x2f9ab1['body']['id']){delete _0x2f9ab1[_0x9634('0x64')]['id'];}return db[_0x9634('0x44')][_0x9634('0x63')]({'where':{'id':_0x2f9ab1[_0x9634('0x5f')]['id']},'include':[{'model':db[_0x9634('0x3e')],'as':_0x9634('0x3f')},{'model':db['MailServerOut'],'as':_0x9634('0x41')},{'model':db['Pause'],'as':_0x9634('0x60')}]})[_0x9634('0x23')](handleEntityNotFound(_0x53a60d,null))[_0x9634('0x23')](saveUpdates(_0x2f9ab1['body'],null))['then'](function(_0x5c52b5){if(_0x5c52b5&&_0x2f9ab1[_0x9634('0x64')][_0x9634('0x3f')]){return db[_0x9634('0x3e')][_0x9634('0x39')](_0x2f9ab1[_0x9634('0x64')][_0x9634('0x3f')],{'where':{'MailAccountId':_0x5c52b5['id']}})[_0x9634('0x23')](function(){return _0x5c52b5;});}return _0x5c52b5;})['then'](function(_0x440148){if(_0x440148&&_0x2f9ab1[_0x9634('0x64')]['Smtp']){return db[_0x9634('0x40')][_0x9634('0x39')](_0x2f9ab1[_0x9634('0x64')][_0x9634('0x41')],{'where':{'MailAccountId':_0x440148['id']}})[_0x9634('0x23')](function(){return _0x440148;});}return _0x440148;})[_0x9634('0x23')](respondWithResult(_0x53a60d,null))[_0x9634('0x2d')](handleError(_0x53a60d,null));};exports[_0x9634('0x65')]=function(_0x50f14c,_0x12ea06){return db[_0x9634('0x44')][_0x9634('0x65')]()[_0x9634('0x23')](respondWithResult(_0x12ea06,null))[_0x9634('0x2d')](handleError(_0x12ea06,null));};exports[_0x9634('0x66')]=function(_0x8cd234,_0x592709,_0x19ecc2){if(_0x8cd234['body']['id']){delete _0x8cd234[_0x9634('0x64')]['id'];}return db[_0x9634('0x44')][_0x9634('0x63')]({'where':{'id':_0x8cd234[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x592709,null))['then'](function(_0x526d61){if(_0x526d61){_0x8cd234[_0x9634('0x64')][_0x9634('0x67')]=_0x526d61['id'];return db['Disposition']['create'](_0x8cd234[_0x9634('0x64')]);}})[_0x9634('0x23')](respondWithResult(_0x592709,null))[_0x9634('0x2d')](handleError(_0x592709,null));};exports[_0x9634('0x68')]=function(_0x14c526,_0x59d5a7,_0x9fa57b){var _0x273329={'raw':![],'where':{}};var _0x4a06b6={};var _0x18e63f={'count':0x0,'rows':[]};return db[_0x9634('0x44')][_0x9634('0x69')]({'where':{'id':_0x14c526['params']['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x59d5a7,null))[_0x9634('0x23')](function(_0x3ed597){if(_0x3ed597){_0x4a06b6[_0x9634('0x48')]=_['keys'](db[_0x9634('0x6a')]['rawAttributes']);_0x4a06b6[_0x9634('0x49')]=_[_0x9634('0x4a')](_0x14c526[_0x9634('0x49')]);_0x4a06b6[_0x9634('0x53')]=_[_0x9634('0x4b')](_0x4a06b6['model'],_0x4a06b6['query']);_0x273329['attributes']=_[_0x9634('0x4b')](_0x4a06b6[_0x9634('0x48')],qs['fields'](_0x14c526['query'][_0x9634('0x62')]));_0x273329[_0x9634('0x4c')]=_0x273329[_0x9634('0x4c')][_0x9634('0x4d')]?_0x273329[_0x9634('0x4c')]:_0x4a06b6['model'];if(!_0x14c526[_0x9634('0x49')]['hasOwnProperty']('nolimit')){_0x273329[_0x9634('0x34')]=qs[_0x9634('0x34')](_0x14c526[_0x9634('0x49')]['limit']);_0x273329[_0x9634('0x32')]=qs[_0x9634('0x32')](_0x14c526['query'][_0x9634('0x32')]);}_0x273329[_0x9634('0x50')]=qs[_0x9634('0x51')](_0x14c526['query'][_0x9634('0x51')]);_0x273329[_0x9634('0x52')]=qs['filters'](_[_0x9634('0x54')](_0x14c526['query'],_0x4a06b6[_0x9634('0x53')]));_0x273329[_0x9634('0x52')]['MailAccountId']=_0x3ed597['id'];if(_0x14c526[_0x9634('0x49')]['filter']){_0x273329[_0x9634('0x52')]=_['merge'](_0x273329['where'],{'$or':_[_0x9634('0x43')](_0x273329[_0x9634('0x4c')],function(_0x11a0b2){var _0x19fa32={};_0x19fa32[_0x11a0b2]={'$like':'%'+_0x14c526[_0x9634('0x49')][_0x9634('0x55')]+'%'};return _0x19fa32;})});}_0x273329=_[_0x9634('0x56')]({},_0x273329,_0x14c526[_0x9634('0x58')]);return db[_0x9634('0x6a')][_0x9634('0x59')]({'where':_0x273329['where']})[_0x9634('0x23')](function(_0x14fc78){_0x18e63f[_0x9634('0x59')]=_0x14fc78;if(_0x14c526[_0x9634('0x49')][_0x9634('0x5a')]){_0x273329[_0x9634('0x5b')]=[{'all':!![]}];}return db[_0x9634('0x6a')][_0x9634('0x5c')](_0x273329);})[_0x9634('0x23')](function(_0x1625a5){_0x18e63f[_0x9634('0x5d')]=_0x1625a5;return _0x18e63f;});}})['then'](respondWithFilteredResult(_0x59d5a7,_0x273329))['catch'](handleError(_0x59d5a7,null));};exports[_0x9634('0x6b')]=function(_0x523cb2,_0x105b19,_0x4e366d){return db[_0x9634('0x44')]['find']({'where':{'id':_0x523cb2[_0x9634('0x5f')]['id']}})['then'](handleEntityNotFound(_0x105b19,null))[_0x9634('0x23')](function(_0x2d1a1f){if(_0x2d1a1f){return _0x2d1a1f[_0x9634('0x6b')](_0x523cb2[_0x9634('0x49')][_0x9634('0x6c')]);}})['then'](respondWithStatusCode(_0x105b19,null))[_0x9634('0x2d')](handleError(_0x105b19,null));};exports[_0x9634('0x6d')]=function(_0x216e3b,_0xc4336b,_0x3ada2b){if(_0x216e3b['body']['id']){delete _0x216e3b[_0x9634('0x64')]['id'];}return db[_0x9634('0x44')]['find']({'where':{'id':_0x216e3b[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0xc4336b,null))[_0x9634('0x23')](function(_0x544bc1){if(_0x544bc1){_0x216e3b[_0x9634('0x64')]['MailAccountId']=_0x544bc1['id'];return db[_0x9634('0x6e')][_0x9634('0x6f')](_0x216e3b[_0x9634('0x64')]);}})['then'](respondWithResult(_0xc4336b,null))[_0x9634('0x2d')](handleError(_0xc4336b,null));};exports[_0x9634('0x70')]=function(_0xcf666,_0x372eb3,_0x2d16f0){var _0x21f93f={'raw':![],'where':{}};var _0x3c1b7b={};var _0x2f44f8={'count':0x0,'rows':[]};return db[_0x9634('0x44')][_0x9634('0x69')]({'where':{'id':_0xcf666[_0x9634('0x5f')]['id']}})['then'](handleEntityNotFound(_0x372eb3,null))[_0x9634('0x23')](function(_0x280046){if(_0x280046){_0x3c1b7b[_0x9634('0x48')]=_[_0x9634('0x4a')](db[_0x9634('0x6e')][_0x9634('0x61')]);_0x3c1b7b[_0x9634('0x49')]=_['keys'](_0xcf666[_0x9634('0x49')]);_0x3c1b7b[_0x9634('0x53')]=_[_0x9634('0x4b')](_0x3c1b7b[_0x9634('0x48')],_0x3c1b7b[_0x9634('0x49')]);_0x21f93f[_0x9634('0x4c')]=_[_0x9634('0x4b')](_0x3c1b7b[_0x9634('0x48')],qs['fields'](_0xcf666[_0x9634('0x49')][_0x9634('0x62')]));_0x21f93f[_0x9634('0x4c')]=_0x21f93f[_0x9634('0x4c')][_0x9634('0x4d')]?_0x21f93f[_0x9634('0x4c')]:_0x3c1b7b['model'];if(!_0xcf666['query'][_0x9634('0x4e')](_0x9634('0x4f'))){_0x21f93f[_0x9634('0x34')]=qs[_0x9634('0x34')](_0xcf666[_0x9634('0x49')][_0x9634('0x34')]);_0x21f93f['offset']=qs[_0x9634('0x32')](_0xcf666['query'][_0x9634('0x32')]);}_0x21f93f['order']=qs[_0x9634('0x51')](_0xcf666['query']['sort']);_0x21f93f[_0x9634('0x52')]=qs[_0x9634('0x53')](_[_0x9634('0x54')](_0xcf666['query'],_0x3c1b7b['filters']));_0x21f93f[_0x9634('0x52')]['MailAccountId']=_0x280046['id'];if(_0xcf666[_0x9634('0x49')][_0x9634('0x55')]){_0x21f93f[_0x9634('0x52')]=_[_0x9634('0x56')](_0x21f93f[_0x9634('0x52')],{'$or':_['map'](_0x21f93f[_0x9634('0x4c')],function(_0x10499f){var _0x3441d5={};_0x3441d5[_0x10499f]={'$like':'%'+_0xcf666[_0x9634('0x49')][_0x9634('0x55')]+'%'};return _0x3441d5;})});}_0x21f93f=_[_0x9634('0x56')]({},_0x21f93f,_0xcf666[_0x9634('0x58')]);return db[_0x9634('0x6e')][_0x9634('0x59')]({'where':_0x21f93f[_0x9634('0x52')]})[_0x9634('0x23')](function(_0x1e9d73){_0x2f44f8[_0x9634('0x59')]=_0x1e9d73;if(_0xcf666['query']['includeAll']){_0x21f93f[_0x9634('0x5b')]=[{'all':!![]}];}return db[_0x9634('0x6e')][_0x9634('0x5c')](_0x21f93f);})['then'](function(_0xba553d){_0x2f44f8[_0x9634('0x5d')]=_0xba553d;return _0x2f44f8;});}})[_0x9634('0x23')](respondWithFilteredResult(_0x372eb3,_0x21f93f))[_0x9634('0x2d')](handleError(_0x372eb3,null));};exports[_0x9634('0x71')]=function(_0x229b01,_0x55a2d2,_0x4b20f6){return db[_0x9634('0x44')]['find']({'where':{'id':_0x229b01[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x55a2d2,null))[_0x9634('0x23')](function(_0x1ed819){if(_0x1ed819){return _0x1ed819[_0x9634('0x71')](_0x229b01[_0x9634('0x49')][_0x9634('0x6c')]);}})['then'](respondWithStatusCode(_0x55a2d2,null))['catch'](handleError(_0x55a2d2,null));};exports[_0x9634('0x6f')]=function(_0x2d36b7,_0x32c467){var _0x3e2213={'name':_0x2d36b7['body']['name'],'key':_0x2d36b7[_0x9634('0x64')][_0x9634('0x47')],'email':_0x2d36b7[_0x9634('0x64')][_0x9634('0x72')],'ListId':_0x2d36b7[_0x9634('0x64')][_0x9634('0x73')],'active':!_[_0x9634('0x74')](_0x2d36b7[_0x9634('0x64')][_0x9634('0x75')])?_0x2d36b7[_0x9634('0x64')][_0x9634('0x75')]:!![],'description':_0x2d36b7['body'][_0x9634('0x76')]||null,'Imap':{},'Smtp':{}};if(_[_0x9634('0x74')](_0x2d36b7[_0x9634('0x64')][_0x9634('0x77')])){if(_0x2d36b7[_0x9634('0x64')][_0x9634('0x78')]){_0x3e2213[_0x9634('0x3f')]['user']=_0x3e2213[_0x9634('0x41')][_0x9634('0x79')]=_0x2d36b7['body'][_0x9634('0x7a')];_0x3e2213[_0x9634('0x3f')][_0x9634('0x7b')]=_0x3e2213[_0x9634('0x41')][_0x9634('0x7c')]=_0x2d36b7[_0x9634('0x64')]['cpassword'];}else{_0x3e2213['Imap'][_0x9634('0x7d')]=_0x3e2213['Smtp'][_0x9634('0x7d')]=![];}_0x3e2213['Imap']['host']=_0x2d36b7[_0x9634('0x64')]['Imap']['host'];_0x3e2213[_0x9634('0x3f')][_0x9634('0x7e')]=_0x2d36b7[_0x9634('0x64')][_0x9634('0x3f')][_0x9634('0x7e')];_0x3e2213[_0x9634('0x41')][_0x9634('0x7f')]=_0x2d36b7['body'][_0x9634('0x41')][_0x9634('0x7f')];_0x3e2213[_0x9634('0x41')][_0x9634('0x7e')]=_0x2d36b7[_0x9634('0x64')][_0x9634('0x41')]['port'];}else{_0x3e2213[_0x9634('0x3f')][_0x9634('0x80')]=_0x3e2213[_0x9634('0x41')][_0x9634('0x80')]=_0x2d36b7[_0x9634('0x64')][_0x9634('0x77')];_0x3e2213['Imap'][_0x9634('0x79')]=_0x3e2213[_0x9634('0x41')][_0x9634('0x79')]=_0x2d36b7[_0x9634('0x64')][_0x9634('0x7a')];_0x3e2213[_0x9634('0x3f')][_0x9634('0x7b')]=_0x3e2213[_0x9634('0x41')][_0x9634('0x7c')]=_0x2d36b7[_0x9634('0x64')][_0x9634('0x81')];}return db[_0x9634('0x44')]['create'](_0x3e2213,{'include':[{'model':db[_0x9634('0x40')],'as':'Smtp'},{'model':db['MailServerIn'],'as':'Imap'}]})['then'](function(_0x1bf916){var _0x336c0a=_0x2d36b7[_0x9634('0x79')][_0x9634('0x3b')]({'plain':!![]});if(!_0x336c0a)throw new Error(_0x9634('0x82'));if(_0x336c0a['role']===_0x9634('0x79')){var _0x34a471=_0x1bf916[_0x9634('0x3b')]({'plain':!![]});return db[_0x9634('0x83')]['find']({'where':{'name':'MailAccounts','userProfileId':_0x336c0a[_0x9634('0x84')]},'raw':!![]})[_0x9634('0x23')](function(_0xe1aa21){if(_0xe1aa21&&_0xe1aa21[_0x9634('0x85')]===0x0){return db[_0x9634('0x86')][_0x9634('0x6f')]({'name':_0x34a471[_0x9634('0x3c')],'resourceId':_0x34a471['id'],'type':_0xe1aa21['name'],'sectionId':_0xe1aa21['id']},{})[_0x9634('0x23')](function(){return _0x1bf916;});}else{return _0x1bf916;}})[_0x9634('0x2d')](function(_0x1aea63){logger[_0x9634('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1aea63);throw _0x1aea63;});}return _0x1bf916;})[_0x9634('0x23')](respondWithResult(_0x32c467,0xc9))[_0x9634('0x2d')](handleError(_0x32c467,null));};exports[_0x9634('0x87')]=function(_0x29d553,_0xaa3f42,_0x32f66e){return db[_0x9634('0x44')][_0x9634('0x69')]({'where':{'id':_0x29d553[_0x9634('0x5f')]['id']}})['then'](handleEntityNotFound(_0xaa3f42,null))['then'](function(_0x1e266f){if(_0x1e266f){return _0x1e266f[_0x9634('0x87')]();}return null;})[_0x9634('0x23')](respondWithResult(_0xaa3f42,null))[_0x9634('0x2d')](handleError(_0xaa3f42,null));};exports[_0x9634('0x88')]=function(_0x1d9221,_0x3d5f1a,_0x57c811){if(_0x1d9221[_0x9634('0x64')]['id']){delete _0x1d9221['body']['id'];}return db['MailAccount']['find']({'where':{'id':_0x1d9221[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x3d5f1a,null))['then'](function(_0x182f43){if(_0x182f43){_0x1d9221[_0x9634('0x64')]['MailAccountId']=_0x182f43['id'];return db[_0x9634('0x3e')][_0x9634('0x6f')](_0x1d9221[_0x9634('0x64')]);}})[_0x9634('0x23')](respondWithResult(_0x3d5f1a,null))[_0x9634('0x2d')](handleError(_0x3d5f1a,null));};exports[_0x9634('0x89')]=function(_0x16214a,_0x36fb50,_0x4244a9){return db[_0x9634('0x44')]['findOne']({'where':{'id':_0x16214a[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x36fb50,null))[_0x9634('0x23')](function(_0x1e564a){if(_0x1e564a){return _0x1e564a[_0x9634('0x8a')](null);}return null;})[_0x9634('0x23')](respondWithStatusCode(_0x36fb50,null))[_0x9634('0x2d')](handleError(_0x36fb50,null));};exports[_0x9634('0x8b')]=function(_0x3bf6e2,_0x4a8367,_0x590bf0){return db[_0x9634('0x44')]['findOne']({'where':{'id':_0x3bf6e2[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x4a8367,null))[_0x9634('0x23')](function(_0x311eab){if(_0x311eab){return _0x311eab[_0x9634('0x8b')]();}return null;})[_0x9634('0x23')](respondWithResult(_0x4a8367,null))[_0x9634('0x2d')](handleError(_0x4a8367,null));};exports[_0x9634('0x8c')]=function(_0x62ff29,_0x26a389,_0x3ded75){if(_0x62ff29[_0x9634('0x64')]['id']){delete _0x62ff29[_0x9634('0x64')]['id'];}return db[_0x9634('0x44')][_0x9634('0x63')]({'where':{'id':_0x62ff29[_0x9634('0x5f')]['id']}})['then'](handleEntityNotFound(_0x26a389,null))[_0x9634('0x23')](function(_0x381047){if(_0x381047){_0x62ff29['body'][_0x9634('0x67')]=_0x381047['id'];return db[_0x9634('0x40')]['create'](_0x62ff29['body']);}})[_0x9634('0x23')](respondWithResult(_0x26a389,null))[_0x9634('0x2d')](handleError(_0x26a389,null));};exports[_0x9634('0x8d')]=function(_0x323e38,_0x465301,_0x3b273b){return db['MailAccount'][_0x9634('0x69')]({'where':{'id':_0x323e38[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x465301,null))['then'](function(_0x59ee58){if(_0x59ee58){return _0x59ee58[_0x9634('0x8e')](null);}return null;})['then'](respondWithStatusCode(_0x465301,null))[_0x9634('0x2d')](handleError(_0x465301,null));};exports['addInteraction']=function(_0x19e2e0,_0x2b1520,_0x23d2a9){return db[_0x9634('0x8f')][_0x9634('0x63')]({'where':{'id':_0x19e2e0[_0x9634('0x5f')]['id']}})['then'](handleEntityNotFound(_0x2b1520,null))[_0x9634('0x23')](function(_0x27380c){if(_0x27380c){return _0x27380c['addInteraction'](_0x19e2e0[_0x9634('0x64')]['ids'],_['omit'](_0x19e2e0['body'],[_0x9634('0x6c'),'id'])||{});}})[_0x9634('0x23')](respondWithResult(_0x2b1520,null))[_0x9634('0x2d')](handleError(_0x2b1520,null));};exports[_0x9634('0x90')]=function(_0x11c1f3,_0x3097c0,_0x12288d){var _0x38dffa={'raw':![],'where':{}};var _0x1d8620={};var _0x298653={'count':0x0,'rows':[]};return db[_0x9634('0x44')][_0x9634('0x69')]({'where':{'id':_0x11c1f3[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x3097c0,null))[_0x9634('0x23')](function(_0x409edf){if(_0x409edf){_0x1d8620[_0x9634('0x48')]=_[_0x9634('0x4a')](db[_0x9634('0x8f')]['rawAttributes']);_0x1d8620[_0x9634('0x49')]=_['keys'](_0x11c1f3['query']);_0x1d8620[_0x9634('0x53')]=_[_0x9634('0x4b')](_0x1d8620['model'],_0x1d8620[_0x9634('0x49')]);_0x38dffa[_0x9634('0x4c')]=_[_0x9634('0x4b')](_0x1d8620['model'],qs[_0x9634('0x62')](_0x11c1f3[_0x9634('0x49')][_0x9634('0x62')]));_0x38dffa[_0x9634('0x4c')]=_0x38dffa['attributes'][_0x9634('0x4d')]?_0x38dffa[_0x9634('0x4c')]:_0x1d8620[_0x9634('0x48')];if(!_0x11c1f3['query'][_0x9634('0x4e')](_0x9634('0x4f'))){_0x38dffa[_0x9634('0x34')]=qs[_0x9634('0x34')](_0x11c1f3[_0x9634('0x49')][_0x9634('0x34')]);_0x38dffa[_0x9634('0x32')]=qs[_0x9634('0x32')](_0x11c1f3[_0x9634('0x49')]['offset']);}_0x38dffa[_0x9634('0x50')]=qs[_0x9634('0x51')](_0x11c1f3[_0x9634('0x49')][_0x9634('0x51')]);_0x38dffa['where']=qs[_0x9634('0x53')](_[_0x9634('0x54')](_0x11c1f3['query'],_0x1d8620[_0x9634('0x53')]));_0x38dffa[_0x9634('0x52')][_0x9634('0x67')]=_0x409edf['id'];if(_0x11c1f3[_0x9634('0x49')]['filter']){_0x38dffa[_0x9634('0x52')]=_[_0x9634('0x56')](_0x38dffa[_0x9634('0x52')],{'$or':_[_0x9634('0x43')](_0x38dffa[_0x9634('0x4c')],function(_0x3c1853){var _0x4e209d={};_0x4e209d[_0x3c1853]={'$like':'%'+_0x11c1f3[_0x9634('0x49')][_0x9634('0x55')]+'%'};return _0x4e209d;})});}_0x38dffa=_[_0x9634('0x56')]({},_0x38dffa,_0x11c1f3['options']);return db[_0x9634('0x8f')][_0x9634('0x59')]({'where':_0x38dffa['where']})[_0x9634('0x23')](function(_0x1596e3){_0x298653['count']=_0x1596e3;if(_0x11c1f3['query'][_0x9634('0x5a')]){_0x38dffa[_0x9634('0x5b')]=[{'model':db[_0x9634('0x91')],'as':_0x9634('0x92'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x9634('0x3c'),'fullname',_0x9634('0x93')],'required':![]},{'model':db[_0x9634('0x94')],'as':_0x9634('0x95'),'attributes':['id',_0x9634('0x3c'),_0x9634('0x96')],'where':_0x11c1f3[_0x9634('0x49')]['tag']?{'id':_0x11c1f3[_0x9634('0x49')][_0x9634('0x97')]}:undefined,'required':_0x11c1f3[_0x9634('0x49')]['tag']?!![]:![]}];}return db[_0x9634('0x8f')][_0x9634('0x5c')](_0x38dffa);})[_0x9634('0x23')](function(_0x54d69a){_0x298653[_0x9634('0x5d')]=_0x54d69a;return _0x298653;});}})[_0x9634('0x23')](respondWithFilteredResult(_0x3097c0,_0x38dffa))[_0x9634('0x2d')](handleError(_0x3097c0,null));};exports['addApplications']=function(_0x19c225,_0x44a798,_0x12f90d){return db['MailAccount']['findOne']({'where':{'id':_0x19c225['params']['id']}})['then'](handleEntityNotFound(_0x44a798,null))[_0x9634('0x23')](function(_0xa92603){if(_0xa92603){return db[_0x9634('0x98')][_0x9634('0x99')](function(_0xb3ede3){return db[_0x9634('0x9a')][_0x9634('0x3a')]({'where':{'MailAccountId':_0x19c225[_0x9634('0x5f')]['id']},'transaction':_0xb3ede3})[_0x9634('0x23')](function(_0x1acd3d){var _0x5610c0=_[_0x9634('0x43')](_0x19c225[_0x9634('0x64')],function(_0x587810){_0x587810[_0x9634('0x67')]=_0x19c225['params']['id'];return _0x587810;});return db['MailApplication'][_0x9634('0x9b')](_0x5610c0,{'transaction':_0xb3ede3});});})[_0x9634('0x23')](function(){return db[_0x9634('0x9a')][_0x9634('0x9c')]({'where':{'MailAccountId':_0x19c225[_0x9634('0x5f')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x44a798,null))['catch'](handleError(_0x44a798,null));};exports[_0x9634('0x9d')]=function(_0x321cda,_0x59155b,_0x14c93e){var _0x2c7954={};var _0x29a534={};var _0xdfe30a;var _0x1fed28;return db[_0x9634('0x44')][_0x9634('0x69')]({'where':{'id':_0x321cda[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x59155b,null))[_0x9634('0x23')](function(_0x2fe520){if(_0x2fe520){_0xdfe30a=_0x2fe520;_0x29a534[_0x9634('0x48')]=_[_0x9634('0x4a')](db[_0x9634('0x9a')][_0x9634('0x61')]);_0x29a534[_0x9634('0x49')]=_[_0x9634('0x4a')](_0x321cda['query']);_0x29a534['filters']=_[_0x9634('0x4b')](_0x29a534[_0x9634('0x48')],_0x29a534['query']);_0x2c7954[_0x9634('0x4c')]=_['intersection'](_0x29a534['model'],qs['fields'](_0x321cda[_0x9634('0x49')][_0x9634('0x62')]));_0x2c7954[_0x9634('0x4c')]=_0x2c7954[_0x9634('0x4c')][_0x9634('0x4d')]?_0x2c7954[_0x9634('0x4c')]:_0x29a534['model'];_0x2c7954[_0x9634('0x50')]=qs[_0x9634('0x51')](_0x321cda[_0x9634('0x49')][_0x9634('0x51')]);_0x2c7954[_0x9634('0x52')]=qs['filters'](_[_0x9634('0x54')](_0x321cda[_0x9634('0x49')],_0x29a534[_0x9634('0x53')]));if(_0x321cda[_0x9634('0x49')]['filter']){_0x2c7954['where']=_['merge'](_0x2c7954[_0x9634('0x52')],{'$or':_[_0x9634('0x43')](_0x2c7954[_0x9634('0x4c')],function(_0x536460){var _0x490b14={};_0x490b14[_0x536460]={'$like':'%'+_0x321cda[_0x9634('0x49')][_0x9634('0x55')]+'%'};return _0x490b14;})});}_0x2c7954=_[_0x9634('0x56')]({},_0x2c7954,_0x321cda[_0x9634('0x58')]);return _0xdfe30a[_0x9634('0x9d')](_0x2c7954);}})[_0x9634('0x23')](function(_0x4d0ba4){if(_0x4d0ba4){_0x1fed28=_0x4d0ba4[_0x9634('0x4d')];if(!_0x321cda[_0x9634('0x49')][_0x9634('0x4e')](_0x9634('0x4f'))){_0x2c7954[_0x9634('0x34')]=qs[_0x9634('0x34')](_0x321cda[_0x9634('0x49')][_0x9634('0x34')]);_0x2c7954['offset']=qs[_0x9634('0x32')](_0x321cda['query']['offset']);}return _0xdfe30a['getApplications'](_0x2c7954);}})['then'](function(_0x4146aa){if(_0x4146aa){return _0x4146aa?{'count':_0x1fed28,'rows':_0x4146aa}:null;}})[_0x9634('0x23')](respondWithResult(_0x59155b,null))[_0x9634('0x2d')](handleError(_0x59155b,null));};exports['getMessages']=function(_0x530add,_0x3ed112,_0x28f3ca){var _0x303a24={'raw':!![],'where':{}};var _0x285cd5={};var _0x271777={'count':0x0,'rows':[]};return db[_0x9634('0x44')]['findOne']({'where':{'id':_0x530add[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x3ed112,null))[_0x9634('0x23')](function(_0x4b3d2c){if(_0x4b3d2c){_0x285cd5[_0x9634('0x48')]=_['keys'](db['MailMessage']['rawAttributes']);_0x285cd5['query']=_[_0x9634('0x4a')](_0x530add[_0x9634('0x49')]);_0x285cd5[_0x9634('0x53')]=_[_0x9634('0x4b')](_0x285cd5[_0x9634('0x48')],_0x285cd5[_0x9634('0x49')]);_0x303a24[_0x9634('0x4c')]=_[_0x9634('0x4b')](_0x285cd5[_0x9634('0x48')],qs['fields'](_0x530add[_0x9634('0x49')][_0x9634('0x62')]));_0x303a24[_0x9634('0x4c')]=_0x303a24[_0x9634('0x4c')][_0x9634('0x4d')]?_0x303a24[_0x9634('0x4c')]:_0x285cd5['model'];if(!_0x530add[_0x9634('0x49')]['hasOwnProperty'](_0x9634('0x4f'))){_0x303a24['limit']=qs[_0x9634('0x34')](_0x530add[_0x9634('0x49')][_0x9634('0x34')]);_0x303a24[_0x9634('0x32')]=qs['offset'](_0x530add['query'][_0x9634('0x32')]);}_0x303a24[_0x9634('0x50')]=qs[_0x9634('0x51')](_0x530add[_0x9634('0x49')][_0x9634('0x51')]);_0x303a24[_0x9634('0x52')]=qs[_0x9634('0x53')](_[_0x9634('0x54')](_0x530add[_0x9634('0x49')],_0x285cd5[_0x9634('0x53')]));_0x303a24[_0x9634('0x52')][_0x9634('0x67')]=_0x4b3d2c['id'];if(_0x530add[_0x9634('0x49')]['filter']){_0x303a24[_0x9634('0x52')]=_[_0x9634('0x56')](_0x303a24['where'],{'$or':_[_0x9634('0x43')](_0x303a24[_0x9634('0x4c')],function(_0x34141f){var _0x495a8c={};_0x495a8c[_0x34141f]={'$like':'%'+_0x530add[_0x9634('0x49')][_0x9634('0x55')]+'%'};return _0x495a8c;})});}if(_0x530add[_0x9634('0x49')]['$gte']){var _0x5690fe=_0x530add[_0x9634('0x49')][_0x9634('0x9e')]['split'](',');var _0x3d9175={};_0x3d9175[_0x5690fe[0x0]]={'$gte':moment(_0x5690fe[0x1])['format']('YYYY-MM-DD\x20HH:mm:ss')};_0x303a24[_0x9634('0x52')]=_[_0x9634('0x56')](_0x303a24['where'],_0x3d9175);}_0x303a24=_[_0x9634('0x56')]({},_0x303a24,_0x530add[_0x9634('0x58')]);return db[_0x9634('0x9f')][_0x9634('0x59')]({'where':_0x303a24[_0x9634('0x52')]})[_0x9634('0x23')](function(_0x3129ed){_0x271777[_0x9634('0x59')]=_0x3129ed;if(_0x530add[_0x9634('0x49')][_0x9634('0x5a')]){_0x303a24[_0x9634('0x5b')]=[{'all':!![]}];}return db[_0x9634('0x9f')][_0x9634('0x5c')](_0x303a24);})['then'](function(_0x29c06d){if(_0x530add[_0x9634('0x49')][_0x9634('0xa0')]===_0x9634('0xa1')){for(var _0x2b3f8b=0x0;_0x2b3f8b<_0x29c06d[_0x9634('0x4d')];_0x2b3f8b++){_0x29c06d[_0x2b3f8b]['body']=juice(_0x29c06d[_0x2b3f8b][_0x9634('0x64')]);}}_0x271777['rows']=_0x29c06d;return _0x271777;});}})[_0x9634('0x23')](respondWithFilteredResult(_0x3ed112,_0x303a24))['catch'](handleError(_0x3ed112,null));};exports[_0x9634('0xa2')]=function(_0x50585f,_0x5dec53,_0x4bf1b1){var _0xccc426,_0x45d24d={},_0x13f735;if(_0x50585f[_0x9634('0x64')]['to']){_0x13f735=_0x50585f[_0x9634('0x64')]['to'][_0x9634('0xa3')](',')[0x0];}return db[_0x9634('0x44')][_0x9634('0x63')]({'where':{'id':_0x50585f[_0x9634('0x5f')]['id']},'include':[{'model':db[_0x9634('0xa4')],'as':_0x9634('0xa5'),'include':[{'model':db[_0x9634('0x91')],'as':_0x9634('0xa6'),'where':{'email':_0x13f735},'limit':0x1,'order':[[_0x9634('0xa7'),'DESC']]}]},{'model':db[_0x9634('0x40')],'as':_0x9634('0x41'),'raw':!![]}]})[_0x9634('0x23')](handleEntityNotFound(_0x5dec53,null))[_0x9634('0x23')](function(_0x15bf21){if(_0x15bf21){_0xccc426=_0x15bf21;if(_0x15bf21[_0x9634('0x41')]){if(_[_0x9634('0x74')](_0x50585f[_0x9634('0x64')][_0x9634('0xa8')])){_0x50585f[_0x9634('0x64')][_0x9634('0xa8')]=util['format'](_0x9634('0xa9'),_0x15bf21[_0x9634('0x3c')],_0x15bf21[_0x9634('0x72')]||_0x15bf21[_0x9634('0x41')][_0x9634('0x79')]);}if(_0x50585f[_0x9634('0x64')][_0x9634('0xaa')]&&_0x50585f[_0x9634('0x64')]['attachments'][_0x9634('0x4d')]){for(var _0x31b33e=0x0;_0x31b33e<_0x50585f[_0x9634('0x64')][_0x9634('0xaa')][_0x9634('0x4d')];_0x31b33e+=0x1){_0x50585f[_0x9634('0x64')][_0x9634('0xaa')][_0x31b33e]={'filename':_0x50585f[_0x9634('0x64')][_0x9634('0xaa')][_0x31b33e][_0x9634('0x3c')],'path':path[_0x9634('0xab')](config[_0x9634('0xac')],_0x9634('0xad'),_0x50585f[_0x9634('0x64')][_0x9634('0xaa')][_0x31b33e]['basename'])};}}var _0x1d444c={'tls':{'rejectUnauthorized':![]}};if(_[_0x9634('0x74')](_0x15bf21[_0x9634('0x41')][_0x9634('0x80')])){if(_0x15bf21[_0x9634('0x41')][_0x9634('0x7d')]){_0x1d444c[_0x9634('0xae')]={'user':_0x15bf21[_0x9634('0x41')][_0x9634('0x79')],'pass':_0x15bf21['Smtp'][_0x9634('0x7c')]};}_0x1d444c[_0x9634('0x7f')]=_0x15bf21['Smtp'][_0x9634('0x7f')];_0x1d444c[_0x9634('0x7e')]=_0x15bf21[_0x9634('0x41')][_0x9634('0x7e')];_0x1d444c['secure']=_0x15bf21['Smtp']['secure'];}else{_0x1d444c[_0x9634('0x80')]=_0x15bf21['Smtp']['service'];_0x1d444c['auth']={'user':_0x15bf21['Smtp'][_0x9634('0x79')],'pass':_0x15bf21[_0x9634('0x41')][_0x9634('0x7c')]};}return respondWithRpcPromise(_0x9634('0xaf'),_0x9634('0xb0'),{'account':_0x1d444c,'message':_0x50585f['body']});}else{throw new Error(_0x9634('0xb1'));}}})[_0x9634('0x23')](function(_0x3fd40d){if(_0x3fd40d){_0x45d24d=_0x3fd40d;if(_0xccc426[_0x9634('0xa5')]){if(_0xccc426[_0x9634('0xa5')][_0x9634('0xa6')]['length']){return _0xccc426['List'][_0x9634('0xa6')][0x0];}else{return db[_0x9634('0x91')][_0x9634('0x6f')](_[_0x9634('0x1c')](_0x50585f[_0x9634('0x64')],{'firstName':_0x50585f[_0x9634('0x64')]['to'],'email':_0x50585f['body']['to'],'phone':_0x50585f[_0x9634('0x64')]['to'],'ListId':_0xccc426[_0x9634('0x73')]}));}}else{throw new Error(_0x9634('0xb1'));}}})['then'](function(_0x4af1b8){if(_0x4af1b8){var _0x103fe7={'UserId':_0x50585f[_0x9634('0x79')]['id'],'ContactId':_0x4af1b8['id'],'MailAccountId':_0xccc426['id'],'inReplyTo':_0x45d24d[_0x9634('0xb2')],'to':_0x50585f[_0x9634('0x64')]['from'],'cc':_0x50585f[_0x9634('0x64')]['cc'],'subject':_0x50585f[_0x9634('0x64')][_0x9634('0xb3')],'attach':_0x50585f['body'][_0x9634('0xb4')],'firstMsgDirection':_0x9634('0xb5'),'lastMsgAt':moment()[_0x9634('0xb6')](_0x9634('0xb7')),'lastMsgDirection':'out','Messages':[_[_0x9634('0x56')](_0x50585f[_0x9634('0x64')],{'messageId':_0x45d24d[_0x9634('0xb2')],'sentAt':moment()[_0x9634('0xb6')](_0x9634('0xb7')),'read':!![],'MailAccountId':_0xccc426['id'],'UserId':_0x50585f[_0x9634('0x79')]['id'],'ContactId':_0x4af1b8['id']})]};if(_0x50585f[_0x9634('0x64')][_0x9634('0xb8')]){_0x103fe7=_[_0x9634('0x56')](_0x103fe7,_0x50585f[_0x9634('0x64')]['Interaction']);}return db[_0x9634('0x8f')][_0x9634('0x6f')](_0x103fe7,{'include':[{'model':db['MailMessage'],'as':'Messages'}]});}})[_0x9634('0x23')](respondWithResult(_0x5dec53,null))['catch'](handleError(_0x5dec53,null));};exports['verifySmtp']=function(_0xa1f414,_0x3af66c,_0x45bc49){return db['MailAccount']['find']({'where':{'id':_0xa1f414[_0x9634('0x5f')]['id']},'include':[{'model':db['MailServerOut'],'as':'Smtp','raw':!![]}]})[_0x9634('0x23')](handleEntityNotFound(_0x3af66c,null))['then'](function(_0x4a7f81){if(_0x4a7f81&&_0x4a7f81['Smtp']){var _0x238b48={'id':_0x4a7f81['id'],'tls':{'rejectUnauthorized':![]}};if(_0x4a7f81[_0x9634('0x41')][_0x9634('0x80')]){_0x238b48[_0x9634('0x80')]=_0x4a7f81[_0x9634('0x41')][_0x9634('0x80')];}else{_0x238b48[_0x9634('0x7f')]=_0x4a7f81[_0x9634('0x41')][_0x9634('0x7f')];_0x238b48[_0x9634('0x7e')]=_0x4a7f81['Smtp']['port'];_0x238b48['secure']=_0x4a7f81['Smtp'][_0x9634('0xb9')];}if(_0x4a7f81[_0x9634('0x41')][_0x9634('0x7d')]){_0x238b48[_0x9634('0xae')]={'user':_0x4a7f81['Smtp'][_0x9634('0x79')],'pass':_0x4a7f81[_0x9634('0x41')]['pass']};}return respondWithRpcPromise(_0x9634('0xba'),_0x9634('0xbb'),{'account':_0x238b48});}})['then'](respondWithResult(_0x3af66c,null))[_0x9634('0x2d')](handleError(_0x3af66c,null));};exports[_0x9634('0x3a')]=function(_0x4437d0,_0x3689d8){return db[_0x9634('0x44')][_0x9634('0x63')]({'where':{'id':_0x4437d0[_0x9634('0x5f')]['id']}})['then'](handleEntityNotFound(_0x3689d8,null))[_0x9634('0x23')](function(_0xd4cdcd){if(_0xd4cdcd&&_0xd4cdcd[_0x9634('0x80')]){throw new db[(_0x9634('0xbc'))]['ValidationError'](_0x9634('0xbd'));}return _0xd4cdcd;})[_0x9634('0x23')](removeEntity(_0x3689d8,null))['catch'](handleError(_0x3689d8,null));};exports[_0x9634('0xbe')]=function(_0x17bab8,_0x280e43,_0xc459e7){return db['MailAccount'][_0x9634('0x63')]({'where':{'id':_0x17bab8[_0x9634('0x5f')]['id']}})[_0x9634('0x23')](handleEntityNotFound(_0x280e43,null))[_0x9634('0x23')](function(_0x3950bf){if(_0x3950bf){return _0x3950bf[_0x9634('0xbe')](_0x17bab8[_0x9634('0x64')]['ids'],_[_0x9634('0xbf')](_0x17bab8[_0x9634('0x64')],['ids','id'])||{})[_0x9634('0xc0')](function(_0x52be3b){for(var _0x56b90d=0x0;_0x56b90d<_0x17bab8[_0x9634('0x64')]['ids']['length'];_0x56b90d+=0x1){socket[_0x9634('0xc1')](_0x9634('0xc2'),{'UserId':Number(_0x17bab8[_0x9634('0x64')][_0x9634('0x6c')][_0x56b90d]),'MailAccountId':Number(_0x17bab8[_0x9634('0x5f')]['id'])});}return _0x52be3b;});}})[_0x9634('0x23')](respondWithResult(_0x280e43,null))[_0x9634('0x2d')](handleError(_0x280e43,null));};exports[_0x9634('0xc3')]=function(_0x124a5b,_0x4d0af1,_0x54e47b){return db['MailAccount'][_0x9634('0x63')]({'where':{'id':_0x124a5b['params']['id']}})['then'](handleEntityNotFound(_0x4d0af1,null))[_0x9634('0x23')](function(_0xff71dd){if(_0xff71dd){return _0xff71dd['removeAgents'](_0x124a5b[_0x9634('0x49')][_0x9634('0x6c')])[_0x9634('0x23')](function(){if(_[_0x9634('0xc4')](_0x124a5b['query'][_0x9634('0x6c')])){for(var _0x35b1c1=0x0;_0x35b1c1<_0x124a5b[_0x9634('0x49')][_0x9634('0x6c')][_0x9634('0x4d')];_0x35b1c1+=0x1){socket[_0x9634('0xc1')](_0x9634('0xc5'),{'UserId':Number(_0x124a5b[_0x9634('0x49')][_0x9634('0x6c')][_0x35b1c1]),'MailAccountId':Number(_0x124a5b[_0x9634('0x5f')]['id'])});}}else{socket['emit'](_0x9634('0xc5'),{'UserId':Number(_0x124a5b[_0x9634('0x49')][_0x9634('0x6c')]),'MailAccountId':Number(_0x124a5b[_0x9634('0x5f')]['id'])});}});}})['then'](respondWithStatusCode(_0x4d0af1,null))[_0x9634('0x2d')](handleError(_0x4d0af1,null));};exports[_0x9634('0xc6')]=function(_0x1a677f,_0x3f04df,_0x4f14f7){var _0x5196b2={};var _0x48a226={};var _0x53b148;var _0x207505;return db[_0x9634('0x44')][_0x9634('0x69')]({'where':{'id':_0x1a677f['params']['id']}})['then'](handleEntityNotFound(_0x3f04df,null))[_0x9634('0x23')](function(_0x20c84a){if(_0x20c84a){_0x53b148=_0x20c84a;_0x48a226['model']=_[_0x9634('0x4a')](db[_0x9634('0xc7')][_0x9634('0x61')]);_0x48a226[_0x9634('0x49')]=_[_0x9634('0x4a')](_0x1a677f[_0x9634('0x49')]);_0x48a226[_0x9634('0x53')]=_[_0x9634('0x4b')](_0x48a226['model'],_0x48a226[_0x9634('0x49')]);_0x5196b2[_0x9634('0x4c')]=_[_0x9634('0x4b')](_0x48a226[_0x9634('0x48')],qs[_0x9634('0x62')](_0x1a677f[_0x9634('0x49')]['fields']));_0x5196b2[_0x9634('0x4c')]=_0x5196b2[_0x9634('0x4c')][_0x9634('0x4d')]?_0x5196b2['attributes']:_0x48a226[_0x9634('0x48')];_0x5196b2[_0x9634('0x50')]=qs['sort'](_0x1a677f[_0x9634('0x49')][_0x9634('0x51')]);_0x5196b2[_0x9634('0x52')]=qs[_0x9634('0x53')](_[_0x9634('0x54')](_0x1a677f[_0x9634('0x49')],_0x48a226[_0x9634('0x53')]));if(_0x1a677f['query'][_0x9634('0x55')]){_0x5196b2[_0x9634('0x52')]=_['merge'](_0x5196b2['where'],{'$or':_['map'](_0x5196b2[_0x9634('0x4c')],function(_0x4e4860){var _0x192f39={};_0x192f39[_0x4e4860]={'$like':'%'+_0x1a677f[_0x9634('0x49')][_0x9634('0x55')]+'%'};return _0x192f39;})});}_0x5196b2=_[_0x9634('0x56')]({},_0x5196b2,_0x1a677f[_0x9634('0x58')]);return _0x53b148[_0x9634('0xc6')](_0x5196b2);}})[_0x9634('0x23')](function(_0x48c260){if(_0x48c260){_0x207505=_0x48c260['length'];if(!_0x1a677f[_0x9634('0x49')][_0x9634('0x4e')]('nolimit')){_0x5196b2['limit']=qs[_0x9634('0x34')](_0x1a677f[_0x9634('0x49')][_0x9634('0x34')]);_0x5196b2[_0x9634('0x32')]=qs[_0x9634('0x32')](_0x1a677f[_0x9634('0x49')][_0x9634('0x32')]);}return _0x53b148[_0x9634('0xc6')](_0x5196b2);}})[_0x9634('0x23')](function(_0x4de1f3){if(_0x4de1f3){return _0x4de1f3?{'count':_0x207505,'rows':_0x4de1f3}:null;}})[_0x9634('0x23')](respondWithResult(_0x3f04df,null))['catch'](handleError(_0x3f04df,null));}; \ No newline at end of file +var _0x79fe=['fullname','internal','Tag','Tags','color','tag','addApplications','transaction','MailApplication','bulkCreate','findAndCountAll','priority','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','split','Contacts','updatedAt','DESC','from','attachments','join','root','server/files/attachments','basename','auth','secure','SendMail','List\x20not\x20found','List','defaults','messageId','attach','out','Interaction','Messages','VerifySmtp','verifySmtp','Sequelize','ValidationError','addAgents','spread','userMailAccount:save','removeAgents','isArray','emit','userMailAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','juice','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./mailAccount.socket','jayson/promise','http','request','then','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','end','json','limit','undefined','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','MailAccounts','UserProfileResource','stack','name','send','index','Smtp','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','filter','options','MailAccount','includeAll','include','findAll','rows','show','params','MailServerIn','Imap','MailServerOut','Pause','find','body','mandatoryDispositionPause','describe','addDisposition','MailAccountId','Disposition','create','findOne','pick','ids','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','cservice','cauthentication','user','cuser','password','cpassword','authentication','host','port','service','pass','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','setImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','CmContact','Contact','User'];(function(_0x11462a,_0x1fbcf5){var _0x401696=function(_0x3acf7b){while(--_0x3acf7b){_0x11462a['push'](_0x11462a['shift']());}};_0x401696(++_0x1fbcf5);}(_0x79fe,0x1be));var _0xe79f=function(_0x1bf872,_0x38b491){_0x1bf872=_0x1bf872-0x0;var _0x2bc3c8=_0x79fe[_0x1bf872];return _0x2bc3c8;};'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(_0xe79f('0x4'));var moment=require(_0xe79f('0x5'));var BPromise=require(_0xe79f('0x6'));var Mustache=require(_0xe79f('0x7'));var util=require('util');var path=require('path');var sox=require(_0xe79f('0x8'));var csv=require('to-csv');var ejs=require(_0xe79f('0x9'));var fs=require('fs');var fs_extra=require(_0xe79f('0xa'));var _=require('lodash');var squel=require(_0xe79f('0xb'));var crypto=require('crypto');var jsforce=require(_0xe79f('0xc'));var deskjs=require(_0xe79f('0xd'));var toCsv=require(_0xe79f('0xe'));var querystring=require(_0xe79f('0xf'));var Papa=require(_0xe79f('0x10'));var htmlToText=require('html-to-text');var juice=require(_0xe79f('0x11'));var Redis=require(_0xe79f('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe79f('0x13'));var as=require(_0xe79f('0x14'));var hardwareService=require(_0xe79f('0x15'));var logger=require('../../config/logger')(_0xe79f('0x16'));var utils=require(_0xe79f('0x17'));var config=require(_0xe79f('0x18'));var licenseUtil=require(_0xe79f('0x19'));var db=require(_0xe79f('0x1a'))['db'];config[_0xe79f('0x1b')]=_['defaults'](config[_0xe79f('0x1b')],{'host':_0xe79f('0x1c'),'port':0x18eb});var socket=require(_0xe79f('0x1d'))(new Redis(config[_0xe79f('0x1b')]));require(_0xe79f('0x1e'))['register'](socket);var jayson=require(_0xe79f('0x1f'));var client=jayson['client'][_0xe79f('0x20')]({'port':0x232b});function respondWithRpcPromise(_0x5d060a,_0xf4a3e6,_0x4281c9,_0x410e03){return new BPromise(function(_0x444a53,_0xfa1335){var _0x203060=_0x410e03||client;return _0x203060[_0xe79f('0x21')](_0x5d060a,_0x4281c9)[_0xe79f('0x22')](function(_0x169044){logger['info'](_0xe79f('0x23'),_0xf4a3e6,_0xe79f('0x24'));logger[_0xe79f('0x25')](_0xe79f('0x26'),_0xf4a3e6,_0xe79f('0x24'),JSON['stringify'](_0x169044));if(_0x169044[_0xe79f('0x27')]){if(_0x169044[_0xe79f('0x27')]['code']===0x1f4){logger[_0xe79f('0x27')](_0xe79f('0x23'),_0xf4a3e6,_0x169044[_0xe79f('0x27')][_0xe79f('0x28')]);return _0xfa1335(_0x169044[_0xe79f('0x27')]['message']);}logger[_0xe79f('0x27')]('MailAccount,\x20%s,\x20%s',_0xf4a3e6,_0x169044['error'][_0xe79f('0x28')]);return _0x444a53(_0x169044[_0xe79f('0x27')]['message']);}else{logger[_0xe79f('0x29')](_0xe79f('0x23'),_0xf4a3e6,_0xe79f('0x24'));_0x444a53(_0x169044[_0xe79f('0x2a')]['message']);}})[_0xe79f('0x2b')](function(_0x2723bb){logger[_0xe79f('0x27')](_0xe79f('0x23'),_0xf4a3e6,_0x2723bb);_0xfa1335(_0x2723bb);});});}function respondWithStatusCode(_0x311715,_0x3fb452){_0x3fb452=_0x3fb452||0xcc;return function(_0x715600){if(_0x715600){return _0x311715[_0xe79f('0x2c')](_0x3fb452);}return _0x311715[_0xe79f('0x2d')](_0x3fb452)[_0xe79f('0x2e')]();};}function respondWithResult(_0x204967,_0x512afb){_0x512afb=_0x512afb||0xc8;return function(_0x281645){if(_0x281645){return _0x204967[_0xe79f('0x2d')](_0x512afb)[_0xe79f('0x2f')](_0x281645);}};}function respondWithFilteredResult(_0x4e3b36,_0x5a626c){return function(_0x1c7411){if(_0x1c7411){var _0x20fc37=typeof _0x5a626c['offset']==='undefined'&&typeof _0x5a626c[_0xe79f('0x30')]===_0xe79f('0x31');var _0x576ead=_0x1c7411[_0xe79f('0x32')];var _0x140b1c=_0x20fc37?0x0:_0x5a626c[_0xe79f('0x33')];var _0x6b4d78=_0x20fc37?_0x1c7411['count']:_0x5a626c[_0xe79f('0x33')]+_0x5a626c[_0xe79f('0x30')];var _0xa45204;if(_0x6b4d78>=_0x576ead){_0x6b4d78=_0x576ead;_0xa45204=0xc8;}else{_0xa45204=0xce;}_0x4e3b36[_0xe79f('0x2d')](_0xa45204);return _0x4e3b36[_0xe79f('0x34')](_0xe79f('0x35'),_0x140b1c+'-'+_0x6b4d78+'/'+_0x576ead)[_0xe79f('0x2f')](_0x1c7411);}return null;};}function patchUpdates(_0xf21647){return function(_0x145e51){try{jsonpatch[_0xe79f('0x36')](_0x145e51,_0xf21647,!![]);}catch(_0x4d6feb){return BPromise[_0xe79f('0x37')](_0x4d6feb);}return _0x145e51[_0xe79f('0x38')]();};}function saveUpdates(_0x4621e4,_0x577afd){return function(_0x24932f){if(_0x24932f){return _0x24932f[_0xe79f('0x39')](_0x4621e4)[_0xe79f('0x22')](function(_0x131a29){return _0x131a29;});}return null;};}function removeEntity(_0x297758,_0x8f3d07){return function(_0x1ccc33){if(_0x1ccc33){return _0x1ccc33[_0xe79f('0x3a')]()[_0xe79f('0x22')](function(){var _0x150cea=_0x1ccc33[_0xe79f('0x3b')]({'plain':!![]});var _0x59425e=_0xe79f('0x3c');return db[_0xe79f('0x3d')][_0xe79f('0x3a')]({'where':{'type':_0x59425e,'resourceId':_0x150cea['id']}})['then'](function(){return _0x1ccc33;});})[_0xe79f('0x22')](function(){_0x297758[_0xe79f('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10195c,_0x32a8ed){return function(_0x1de8d7){if(!_0x1de8d7){_0x10195c['sendStatus'](0x194);}return _0x1de8d7;};}function handleError(_0x4a9f9e,_0x35aa40){_0x35aa40=_0x35aa40||0x1f4;return function(_0x376944){logger['error'](_0x376944[_0xe79f('0x3e')]);if(_0x376944[_0xe79f('0x3f')]){delete _0x376944[_0xe79f('0x3f')];}_0x4a9f9e[_0xe79f('0x2d')](_0x35aa40)[_0xe79f('0x40')](_0x376944);};}exports[_0xe79f('0x41')]=function(_0x4cdb5e,_0x3d457f){var _0xead62c={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db['MailServerOut'],'as':_0xe79f('0x42')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x444fad={},_0x19a02b={'count':0x0,'rows':[]};var _0x5d3edf=_['map'](db['MailAccount'][_0xe79f('0x43')],function(_0x6e6ae8){return{'name':_0x6e6ae8[_0xe79f('0x44')],'type':_0x6e6ae8[_0xe79f('0x45')]['key']};});_0x444fad[_0xe79f('0x46')]=_[_0xe79f('0x47')](_0x5d3edf,_0xe79f('0x3f'));_0x444fad[_0xe79f('0x48')]=_[_0xe79f('0x49')](_0x4cdb5e[_0xe79f('0x48')]);_0x444fad[_0xe79f('0x4a')]=_[_0xe79f('0x4b')](_0x444fad['model'],_0x444fad[_0xe79f('0x48')]);_0xead62c[_0xe79f('0x4c')]=_[_0xe79f('0x4b')](_0x444fad['model'],qs[_0xe79f('0x4d')](_0x4cdb5e[_0xe79f('0x48')][_0xe79f('0x4d')]));_0xead62c['attributes']=_0xead62c[_0xe79f('0x4c')][_0xe79f('0x4e')]?_0xead62c[_0xe79f('0x4c')]:_0x444fad['model'];if(!_0x4cdb5e[_0xe79f('0x48')][_0xe79f('0x4f')](_0xe79f('0x50'))){_0xead62c[_0xe79f('0x30')]=qs[_0xe79f('0x30')](_0x4cdb5e[_0xe79f('0x48')][_0xe79f('0x30')]);_0xead62c['offset']=qs[_0xe79f('0x33')](_0x4cdb5e[_0xe79f('0x48')]['offset']);}_0xead62c[_0xe79f('0x51')]=qs[_0xe79f('0x52')](_0x4cdb5e[_0xe79f('0x48')][_0xe79f('0x52')]);_0xead62c[_0xe79f('0x53')]=qs[_0xe79f('0x4a')](_['pick'](_0x4cdb5e[_0xe79f('0x48')],_0x444fad[_0xe79f('0x4a')]),_0x5d3edf);if(_0x4cdb5e[_0xe79f('0x48')]['filter']){_0xead62c[_0xe79f('0x53')]=_[_0xe79f('0x54')](_0xead62c['where'],{'$or':_[_0xe79f('0x47')](_0x5d3edf,function(_0x74c443){if(_0x74c443[_0xe79f('0x45')]!=='VIRTUAL'){var _0x55cacf={};_0x55cacf[_0x74c443[_0xe79f('0x3f')]]={'$like':'%'+_0x4cdb5e[_0xe79f('0x48')][_0xe79f('0x55')]+'%'};return _0x55cacf;}})});}_0xead62c=_[_0xe79f('0x54')]({},_0xead62c,_0x4cdb5e[_0xe79f('0x56')]);var _0x2ce8b9={'where':_0xead62c[_0xe79f('0x53')]};return db[_0xe79f('0x57')][_0xe79f('0x32')](_0x2ce8b9)['then'](function(_0x41e8db){_0x19a02b['count']=_0x41e8db;if(_0x4cdb5e['query'][_0xe79f('0x58')]){_0xead62c[_0xe79f('0x59')]=[{'all':!![]}];}return db[_0xe79f('0x57')][_0xe79f('0x5a')](_0xead62c);})[_0xe79f('0x22')](function(_0x16174a){_0x19a02b[_0xe79f('0x5b')]=_0x16174a;return _0x19a02b;})[_0xe79f('0x22')](respondWithFilteredResult(_0x3d457f,_0xead62c))[_0xe79f('0x2b')](handleError(_0x3d457f,null));};exports[_0xe79f('0x5c')]=function(_0x3624ca,_0xe034d2){var _0x1c3e0d={'raw':![],'where':{'id':_0x3624ca[_0xe79f('0x5d')]['id']},'include':[{'model':db[_0xe79f('0x5e')],'as':_0xe79f('0x5f')},{'model':db[_0xe79f('0x60')],'as':_0xe79f('0x42')},{'model':db[_0xe79f('0x61')],'as':'mandatoryDispositionPause'}]},_0x3bfe5a={};_0x3bfe5a[_0xe79f('0x46')]=_[_0xe79f('0x49')](db['MailAccount'][_0xe79f('0x43')]);_0x3bfe5a['query']=_[_0xe79f('0x49')](_0x3624ca[_0xe79f('0x48')]);_0x3bfe5a[_0xe79f('0x4a')]=_[_0xe79f('0x4b')](_0x3bfe5a[_0xe79f('0x46')],_0x3bfe5a[_0xe79f('0x48')]);_0x1c3e0d[_0xe79f('0x4c')]=_[_0xe79f('0x4b')](_0x3bfe5a[_0xe79f('0x46')],qs['fields'](_0x3624ca[_0xe79f('0x48')][_0xe79f('0x4d')]));_0x1c3e0d[_0xe79f('0x4c')]=_0x1c3e0d['attributes'][_0xe79f('0x4e')]?_0x1c3e0d[_0xe79f('0x4c')]:_0x3bfe5a[_0xe79f('0x46')];if(_0x3624ca[_0xe79f('0x48')][_0xe79f('0x58')]){_0x1c3e0d[_0xe79f('0x59')]=[{'all':!![]}];}_0x1c3e0d=_[_0xe79f('0x54')]({},_0x1c3e0d,_0x3624ca[_0xe79f('0x56')]);return db[_0xe79f('0x57')][_0xe79f('0x62')](_0x1c3e0d)[_0xe79f('0x22')](handleEntityNotFound(_0xe034d2,null))[_0xe79f('0x22')](respondWithResult(_0xe034d2,null))['catch'](handleError(_0xe034d2,null));};exports[_0xe79f('0x39')]=function(_0x59da9d,_0x10ceb3){if(_0x59da9d[_0xe79f('0x63')]['id']){delete _0x59da9d[_0xe79f('0x63')]['id'];}return db[_0xe79f('0x57')][_0xe79f('0x62')]({'where':{'id':_0x59da9d[_0xe79f('0x5d')]['id']},'include':[{'model':db[_0xe79f('0x5e')],'as':_0xe79f('0x5f')},{'model':db[_0xe79f('0x60')],'as':_0xe79f('0x42')},{'model':db[_0xe79f('0x61')],'as':_0xe79f('0x64')}]})[_0xe79f('0x22')](handleEntityNotFound(_0x10ceb3,null))[_0xe79f('0x22')](saveUpdates(_0x59da9d['body'],null))[_0xe79f('0x22')](function(_0x371c86){if(_0x371c86&&_0x59da9d[_0xe79f('0x63')][_0xe79f('0x5f')]){return db['MailServerIn'][_0xe79f('0x39')](_0x59da9d['body'][_0xe79f('0x5f')],{'where':{'MailAccountId':_0x371c86['id']}})['then'](function(){return _0x371c86;});}return _0x371c86;})[_0xe79f('0x22')](function(_0x238fc4){if(_0x238fc4&&_0x59da9d[_0xe79f('0x63')][_0xe79f('0x42')]){return db[_0xe79f('0x60')][_0xe79f('0x39')](_0x59da9d['body'][_0xe79f('0x42')],{'where':{'MailAccountId':_0x238fc4['id']}})[_0xe79f('0x22')](function(){return _0x238fc4;});}return _0x238fc4;})[_0xe79f('0x22')](respondWithResult(_0x10ceb3,null))[_0xe79f('0x2b')](handleError(_0x10ceb3,null));};exports[_0xe79f('0x65')]=function(_0x1200b4,_0x20cc8b){return db[_0xe79f('0x57')]['describe']()['then'](respondWithResult(_0x20cc8b,null))['catch'](handleError(_0x20cc8b,null));};exports[_0xe79f('0x66')]=function(_0xb54de4,_0x571a09,_0x1bc303){if(_0xb54de4['body']['id']){delete _0xb54de4['body']['id'];}return db[_0xe79f('0x57')][_0xe79f('0x62')]({'where':{'id':_0xb54de4[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x571a09,null))[_0xe79f('0x22')](function(_0x42c9a4){if(_0x42c9a4){_0xb54de4[_0xe79f('0x63')][_0xe79f('0x67')]=_0x42c9a4['id'];return db[_0xe79f('0x68')][_0xe79f('0x69')](_0xb54de4['body']);}})[_0xe79f('0x22')](respondWithResult(_0x571a09,null))[_0xe79f('0x2b')](handleError(_0x571a09,null));};exports['getDispositions']=function(_0x544856,_0x10a30b,_0x42f463){var _0x2c3234={'raw':![],'where':{}};var _0x4d3477={};var _0x39d34e={'count':0x0,'rows':[]};return db[_0xe79f('0x57')][_0xe79f('0x6a')]({'where':{'id':_0x544856[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x10a30b,null))[_0xe79f('0x22')](function(_0xa6fbc7){if(_0xa6fbc7){_0x4d3477['model']=_[_0xe79f('0x49')](db[_0xe79f('0x68')][_0xe79f('0x43')]);_0x4d3477[_0xe79f('0x48')]=_[_0xe79f('0x49')](_0x544856[_0xe79f('0x48')]);_0x4d3477[_0xe79f('0x4a')]=_[_0xe79f('0x4b')](_0x4d3477[_0xe79f('0x46')],_0x4d3477['query']);_0x2c3234[_0xe79f('0x4c')]=_[_0xe79f('0x4b')](_0x4d3477['model'],qs[_0xe79f('0x4d')](_0x544856[_0xe79f('0x48')]['fields']));_0x2c3234['attributes']=_0x2c3234['attributes']['length']?_0x2c3234['attributes']:_0x4d3477[_0xe79f('0x46')];if(!_0x544856[_0xe79f('0x48')][_0xe79f('0x4f')](_0xe79f('0x50'))){_0x2c3234[_0xe79f('0x30')]=qs[_0xe79f('0x30')](_0x544856[_0xe79f('0x48')][_0xe79f('0x30')]);_0x2c3234[_0xe79f('0x33')]=qs[_0xe79f('0x33')](_0x544856[_0xe79f('0x48')]['offset']);}_0x2c3234[_0xe79f('0x51')]=qs['sort'](_0x544856[_0xe79f('0x48')]['sort']);_0x2c3234[_0xe79f('0x53')]=qs[_0xe79f('0x4a')](_[_0xe79f('0x6b')](_0x544856['query'],_0x4d3477['filters']));_0x2c3234[_0xe79f('0x53')][_0xe79f('0x67')]=_0xa6fbc7['id'];if(_0x544856[_0xe79f('0x48')][_0xe79f('0x55')]){_0x2c3234[_0xe79f('0x53')]=_[_0xe79f('0x54')](_0x2c3234[_0xe79f('0x53')],{'$or':_[_0xe79f('0x47')](_0x2c3234[_0xe79f('0x4c')],function(_0x5a8759){var _0x31d679={};_0x31d679[_0x5a8759]={'$like':'%'+_0x544856[_0xe79f('0x48')][_0xe79f('0x55')]+'%'};return _0x31d679;})});}_0x2c3234=_[_0xe79f('0x54')]({},_0x2c3234,_0x544856[_0xe79f('0x56')]);return db[_0xe79f('0x68')][_0xe79f('0x32')]({'where':_0x2c3234[_0xe79f('0x53')]})['then'](function(_0x1264b2){_0x39d34e['count']=_0x1264b2;if(_0x544856[_0xe79f('0x48')][_0xe79f('0x58')]){_0x2c3234[_0xe79f('0x59')]=[{'all':!![]}];}return db[_0xe79f('0x68')][_0xe79f('0x5a')](_0x2c3234);})[_0xe79f('0x22')](function(_0x3ba93c){_0x39d34e[_0xe79f('0x5b')]=_0x3ba93c;return _0x39d34e;});}})['then'](respondWithFilteredResult(_0x10a30b,_0x2c3234))[_0xe79f('0x2b')](handleError(_0x10a30b,null));};exports['removeDispositions']=function(_0x3f5bc2,_0x2bfb82,_0x208795){return db[_0xe79f('0x57')]['find']({'where':{'id':_0x3f5bc2[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x2bfb82,null))[_0xe79f('0x22')](function(_0x56daf8){if(_0x56daf8){return _0x56daf8['removeDispositions'](_0x3f5bc2[_0xe79f('0x48')][_0xe79f('0x6c')]);}})[_0xe79f('0x22')](respondWithStatusCode(_0x2bfb82,null))['catch'](handleError(_0x2bfb82,null));};exports['addAnswer']=function(_0x579354,_0x34fe6f,_0x2b8b0d){if(_0x579354[_0xe79f('0x63')]['id']){delete _0x579354['body']['id'];}return db[_0xe79f('0x57')][_0xe79f('0x62')]({'where':{'id':_0x579354[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x34fe6f,null))[_0xe79f('0x22')](function(_0x51c08a){if(_0x51c08a){_0x579354[_0xe79f('0x63')][_0xe79f('0x67')]=_0x51c08a['id'];return db[_0xe79f('0x6d')][_0xe79f('0x69')](_0x579354[_0xe79f('0x63')]);}})[_0xe79f('0x22')](respondWithResult(_0x34fe6f,null))[_0xe79f('0x2b')](handleError(_0x34fe6f,null));};exports[_0xe79f('0x6e')]=function(_0x11077f,_0xbdf18b,_0x26020b){var _0xc72110={'raw':![],'where':{}};var _0x7ca17d={};var _0x237835={'count':0x0,'rows':[]};return db[_0xe79f('0x57')][_0xe79f('0x6a')]({'where':{'id':_0x11077f[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0xbdf18b,null))[_0xe79f('0x22')](function(_0xaa4470){if(_0xaa4470){_0x7ca17d[_0xe79f('0x46')]=_[_0xe79f('0x49')](db[_0xe79f('0x6d')]['rawAttributes']);_0x7ca17d[_0xe79f('0x48')]=_[_0xe79f('0x49')](_0x11077f[_0xe79f('0x48')]);_0x7ca17d[_0xe79f('0x4a')]=_[_0xe79f('0x4b')](_0x7ca17d[_0xe79f('0x46')],_0x7ca17d[_0xe79f('0x48')]);_0xc72110[_0xe79f('0x4c')]=_[_0xe79f('0x4b')](_0x7ca17d[_0xe79f('0x46')],qs['fields'](_0x11077f['query'][_0xe79f('0x4d')]));_0xc72110['attributes']=_0xc72110['attributes'][_0xe79f('0x4e')]?_0xc72110[_0xe79f('0x4c')]:_0x7ca17d[_0xe79f('0x46')];if(!_0x11077f['query'][_0xe79f('0x4f')](_0xe79f('0x50'))){_0xc72110[_0xe79f('0x30')]=qs[_0xe79f('0x30')](_0x11077f[_0xe79f('0x48')][_0xe79f('0x30')]);_0xc72110[_0xe79f('0x33')]=qs[_0xe79f('0x33')](_0x11077f[_0xe79f('0x48')]['offset']);}_0xc72110[_0xe79f('0x51')]=qs[_0xe79f('0x52')](_0x11077f['query'][_0xe79f('0x52')]);_0xc72110[_0xe79f('0x53')]=qs['filters'](_['pick'](_0x11077f[_0xe79f('0x48')],_0x7ca17d[_0xe79f('0x4a')]));_0xc72110['where']['MailAccountId']=_0xaa4470['id'];if(_0x11077f['query'][_0xe79f('0x55')]){_0xc72110[_0xe79f('0x53')]=_['merge'](_0xc72110[_0xe79f('0x53')],{'$or':_[_0xe79f('0x47')](_0xc72110[_0xe79f('0x4c')],function(_0x1b690b){var _0x193a6a={};_0x193a6a[_0x1b690b]={'$like':'%'+_0x11077f[_0xe79f('0x48')][_0xe79f('0x55')]+'%'};return _0x193a6a;})});}_0xc72110=_[_0xe79f('0x54')]({},_0xc72110,_0x11077f['options']);return db[_0xe79f('0x6d')][_0xe79f('0x32')]({'where':_0xc72110[_0xe79f('0x53')]})['then'](function(_0x4e9045){_0x237835[_0xe79f('0x32')]=_0x4e9045;if(_0x11077f[_0xe79f('0x48')][_0xe79f('0x58')]){_0xc72110[_0xe79f('0x59')]=[{'all':!![]}];}return db[_0xe79f('0x6d')]['findAll'](_0xc72110);})[_0xe79f('0x22')](function(_0x11e87e){_0x237835[_0xe79f('0x5b')]=_0x11e87e;return _0x237835;});}})[_0xe79f('0x22')](respondWithFilteredResult(_0xbdf18b,_0xc72110))['catch'](handleError(_0xbdf18b,null));};exports['removeAnswers']=function(_0x312df0,_0x451b64,_0x2334b5){return db['MailAccount'][_0xe79f('0x62')]({'where':{'id':_0x312df0[_0xe79f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x451b64,null))[_0xe79f('0x22')](function(_0x4f185f){if(_0x4f185f){return _0x4f185f[_0xe79f('0x6f')](_0x312df0['query'][_0xe79f('0x6c')]);}})[_0xe79f('0x22')](respondWithStatusCode(_0x451b64,null))['catch'](handleError(_0x451b64,null));};exports[_0xe79f('0x69')]=function(_0x281997,_0x41a416){var _0x5254ca={'name':_0x281997[_0xe79f('0x63')][_0xe79f('0x3f')],'key':_0x281997[_0xe79f('0x63')][_0xe79f('0x70')],'email':_0x281997[_0xe79f('0x63')][_0xe79f('0x71')],'ListId':_0x281997[_0xe79f('0x63')][_0xe79f('0x72')],'active':!_[_0xe79f('0x73')](_0x281997[_0xe79f('0x63')][_0xe79f('0x74')])?_0x281997[_0xe79f('0x63')][_0xe79f('0x74')]:!![],'description':_0x281997['body']['description']||null,'Imap':{},'Smtp':{}};if(_[_0xe79f('0x73')](_0x281997[_0xe79f('0x63')][_0xe79f('0x75')])){if(_0x281997[_0xe79f('0x63')][_0xe79f('0x76')]){_0x5254ca[_0xe79f('0x5f')][_0xe79f('0x77')]=_0x5254ca['Smtp']['user']=_0x281997[_0xe79f('0x63')][_0xe79f('0x78')];_0x5254ca[_0xe79f('0x5f')][_0xe79f('0x79')]=_0x5254ca[_0xe79f('0x42')]['pass']=_0x281997[_0xe79f('0x63')][_0xe79f('0x7a')];}else{_0x5254ca[_0xe79f('0x5f')][_0xe79f('0x7b')]=_0x5254ca[_0xe79f('0x42')][_0xe79f('0x7b')]=![];}_0x5254ca[_0xe79f('0x5f')]['host']=_0x281997['body'][_0xe79f('0x5f')][_0xe79f('0x7c')];_0x5254ca['Imap'][_0xe79f('0x7d')]=_0x281997[_0xe79f('0x63')]['Imap']['port'];_0x5254ca[_0xe79f('0x42')]['host']=_0x281997[_0xe79f('0x63')][_0xe79f('0x42')][_0xe79f('0x7c')];_0x5254ca[_0xe79f('0x42')]['port']=_0x281997['body'][_0xe79f('0x42')][_0xe79f('0x7d')];}else{_0x5254ca[_0xe79f('0x5f')][_0xe79f('0x7e')]=_0x5254ca[_0xe79f('0x42')][_0xe79f('0x7e')]=_0x281997[_0xe79f('0x63')][_0xe79f('0x75')];_0x5254ca[_0xe79f('0x5f')]['user']=_0x5254ca[_0xe79f('0x42')][_0xe79f('0x77')]=_0x281997[_0xe79f('0x63')][_0xe79f('0x78')];_0x5254ca[_0xe79f('0x5f')][_0xe79f('0x79')]=_0x5254ca['Smtp'][_0xe79f('0x7f')]=_0x281997[_0xe79f('0x63')]['cpassword'];}return db['MailAccount'][_0xe79f('0x69')](_0x5254ca,{'include':[{'model':db[_0xe79f('0x60')],'as':_0xe79f('0x42')},{'model':db[_0xe79f('0x5e')],'as':'Imap'}]})[_0xe79f('0x22')](function(_0x1418b9){var _0x6bebba=_0x281997[_0xe79f('0x77')][_0xe79f('0x3b')]({'plain':!![]});if(!_0x6bebba)throw new Error(_0xe79f('0x80'));if(_0x6bebba[_0xe79f('0x81')]===_0xe79f('0x77')){var _0x30802e=_0x1418b9[_0xe79f('0x3b')]({'plain':!![]});return db['UserProfileSection'][_0xe79f('0x62')]({'where':{'name':_0xe79f('0x3c'),'userProfileId':_0x6bebba[_0xe79f('0x82')]},'raw':!![]})[_0xe79f('0x22')](function(_0x35fedd){if(_0x35fedd&&_0x35fedd[_0xe79f('0x83')]===0x0){return db[_0xe79f('0x3d')][_0xe79f('0x69')]({'name':_0x30802e[_0xe79f('0x3f')],'resourceId':_0x30802e['id'],'type':_0x35fedd[_0xe79f('0x3f')],'sectionId':_0x35fedd['id']},{})[_0xe79f('0x22')](function(){return _0x1418b9;});}else{return _0x1418b9;}})[_0xe79f('0x2b')](function(_0x4059e3){logger[_0xe79f('0x27')](_0xe79f('0x84'),_0x4059e3);throw _0x4059e3;});}return _0x1418b9;})[_0xe79f('0x22')](respondWithResult(_0x41a416,0xc9))[_0xe79f('0x2b')](handleError(_0x41a416,null));};exports['getImap']=function(_0x426b36,_0x29387b,_0x2d3211){return db['MailAccount'][_0xe79f('0x6a')]({'where':{'id':_0x426b36[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x29387b,null))['then'](function(_0x2ea487){if(_0x2ea487){return _0x2ea487[_0xe79f('0x85')]();}return null;})[_0xe79f('0x22')](respondWithResult(_0x29387b,null))[_0xe79f('0x2b')](handleError(_0x29387b,null));};exports['addImap']=function(_0x2c0ce7,_0x50ce28,_0x3fdd84){if(_0x2c0ce7[_0xe79f('0x63')]['id']){delete _0x2c0ce7[_0xe79f('0x63')]['id'];}return db[_0xe79f('0x57')]['find']({'where':{'id':_0x2c0ce7['params']['id']}})['then'](handleEntityNotFound(_0x50ce28,null))['then'](function(_0x3e40c5){if(_0x3e40c5){_0x2c0ce7[_0xe79f('0x63')][_0xe79f('0x67')]=_0x3e40c5['id'];return db[_0xe79f('0x5e')][_0xe79f('0x69')](_0x2c0ce7['body']);}})[_0xe79f('0x22')](respondWithResult(_0x50ce28,null))['catch'](handleError(_0x50ce28,null));};exports['removeImap']=function(_0x3c2339,_0x4d492b,_0x4e76df){return db['MailAccount'][_0xe79f('0x6a')]({'where':{'id':_0x3c2339[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x4d492b,null))[_0xe79f('0x22')](function(_0x4d018a){if(_0x4d018a){return _0x4d018a[_0xe79f('0x86')](null);}return null;})[_0xe79f('0x22')](respondWithStatusCode(_0x4d492b,null))['catch'](handleError(_0x4d492b,null));};exports['getSmtp']=function(_0x38850a,_0x188634,_0x354869){return db['MailAccount'][_0xe79f('0x6a')]({'where':{'id':_0x38850a[_0xe79f('0x5d')]['id']}})['then'](handleEntityNotFound(_0x188634,null))[_0xe79f('0x22')](function(_0x5a8775){if(_0x5a8775){return _0x5a8775[_0xe79f('0x87')]();}return null;})['then'](respondWithResult(_0x188634,null))['catch'](handleError(_0x188634,null));};exports[_0xe79f('0x88')]=function(_0x5900f8,_0x1ea553,_0x41febf){if(_0x5900f8[_0xe79f('0x63')]['id']){delete _0x5900f8[_0xe79f('0x63')]['id'];}return db[_0xe79f('0x57')][_0xe79f('0x62')]({'where':{'id':_0x5900f8['params']['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x1ea553,null))['then'](function(_0x1ee383){if(_0x1ee383){_0x5900f8[_0xe79f('0x63')]['MailAccountId']=_0x1ee383['id'];return db['MailServerOut'][_0xe79f('0x69')](_0x5900f8['body']);}})[_0xe79f('0x22')](respondWithResult(_0x1ea553,null))[_0xe79f('0x2b')](handleError(_0x1ea553,null));};exports[_0xe79f('0x89')]=function(_0xa884f1,_0x3b81c4,_0x153e96){return db[_0xe79f('0x57')][_0xe79f('0x6a')]({'where':{'id':_0xa884f1[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x3b81c4,null))[_0xe79f('0x22')](function(_0x33b8c6){if(_0x33b8c6){return _0x33b8c6[_0xe79f('0x8a')](null);}return null;})[_0xe79f('0x22')](respondWithStatusCode(_0x3b81c4,null))[_0xe79f('0x2b')](handleError(_0x3b81c4,null));};exports[_0xe79f('0x8b')]=function(_0x176e8d,_0xabf40,_0x426718){return db[_0xe79f('0x8c')][_0xe79f('0x62')]({'where':{'id':_0x176e8d['params']['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0xabf40,null))['then'](function(_0x4039b4){if(_0x4039b4){return _0x4039b4[_0xe79f('0x8b')](_0x176e8d[_0xe79f('0x63')][_0xe79f('0x6c')],_[_0xe79f('0x8d')](_0x176e8d['body'],[_0xe79f('0x6c'),'id'])||{});}})[_0xe79f('0x22')](respondWithResult(_0xabf40,null))[_0xe79f('0x2b')](handleError(_0xabf40,null));};exports['getInteractions']=function(_0x16d928,_0x545014,_0x1c445f){var _0x4de3ed={'raw':![],'where':{}};var _0x299d10={};var _0x5b710d={'count':0x0,'rows':[]};return db[_0xe79f('0x57')][_0xe79f('0x6a')]({'where':{'id':_0x16d928['params']['id']}})['then'](handleEntityNotFound(_0x545014,null))[_0xe79f('0x22')](function(_0x5b4c93){if(_0x5b4c93){_0x299d10[_0xe79f('0x46')]=_['keys'](db['MailInteraction']['rawAttributes']);_0x299d10['query']=_[_0xe79f('0x49')](_0x16d928['query']);_0x299d10[_0xe79f('0x4a')]=_[_0xe79f('0x4b')](_0x299d10[_0xe79f('0x46')],_0x299d10['query']);_0x4de3ed[_0xe79f('0x4c')]=_[_0xe79f('0x4b')](_0x299d10[_0xe79f('0x46')],qs[_0xe79f('0x4d')](_0x16d928[_0xe79f('0x48')][_0xe79f('0x4d')]));_0x4de3ed[_0xe79f('0x4c')]=_0x4de3ed[_0xe79f('0x4c')][_0xe79f('0x4e')]?_0x4de3ed[_0xe79f('0x4c')]:_0x299d10['model'];if(!_0x16d928[_0xe79f('0x48')]['hasOwnProperty']('nolimit')){_0x4de3ed[_0xe79f('0x30')]=qs[_0xe79f('0x30')](_0x16d928[_0xe79f('0x48')][_0xe79f('0x30')]);_0x4de3ed[_0xe79f('0x33')]=qs['offset'](_0x16d928[_0xe79f('0x48')][_0xe79f('0x33')]);}_0x4de3ed['order']=qs[_0xe79f('0x52')](_0x16d928[_0xe79f('0x48')][_0xe79f('0x52')]);_0x4de3ed[_0xe79f('0x53')]=qs[_0xe79f('0x4a')](_['pick'](_0x16d928[_0xe79f('0x48')],_0x299d10[_0xe79f('0x4a')]));_0x4de3ed[_0xe79f('0x53')]['MailAccountId']=_0x5b4c93['id'];if(_0x16d928[_0xe79f('0x48')]['filter']){_0x4de3ed[_0xe79f('0x53')]=_['merge'](_0x4de3ed['where'],{'$or':_[_0xe79f('0x47')](_0x4de3ed[_0xe79f('0x4c')],function(_0x1699c6){var _0x308a98={};_0x308a98[_0x1699c6]={'$like':'%'+_0x16d928[_0xe79f('0x48')][_0xe79f('0x55')]+'%'};return _0x308a98;})});}_0x4de3ed=_[_0xe79f('0x54')]({},_0x4de3ed,_0x16d928[_0xe79f('0x56')]);return db[_0xe79f('0x8c')][_0xe79f('0x32')]({'where':_0x4de3ed[_0xe79f('0x53')]})[_0xe79f('0x22')](function(_0x14dc76){_0x5b710d[_0xe79f('0x32')]=_0x14dc76;if(_0x16d928[_0xe79f('0x48')][_0xe79f('0x58')]){_0x4de3ed[_0xe79f('0x59')]=[{'model':db[_0xe79f('0x8e')],'as':_0xe79f('0x8f'),'required':![]},{'model':db[_0xe79f('0x90')],'as':'Owner','attributes':[_0xe79f('0x3f'),_0xe79f('0x91'),_0xe79f('0x92')],'required':![]},{'model':db[_0xe79f('0x93')],'as':_0xe79f('0x94'),'attributes':['id',_0xe79f('0x3f'),_0xe79f('0x95')],'where':_0x16d928['query'][_0xe79f('0x96')]?{'id':_0x16d928[_0xe79f('0x48')][_0xe79f('0x96')]}:undefined,'required':_0x16d928['query']['tag']?!![]:![]}];}return db[_0xe79f('0x8c')]['findAll'](_0x4de3ed);})[_0xe79f('0x22')](function(_0x58c1a2){_0x5b710d['rows']=_0x58c1a2;return _0x5b710d;});}})['then'](respondWithFilteredResult(_0x545014,_0x4de3ed))[_0xe79f('0x2b')](handleError(_0x545014,null));};exports[_0xe79f('0x97')]=function(_0x3bfec2,_0x24bc64,_0x36231a){return db[_0xe79f('0x57')][_0xe79f('0x6a')]({'where':{'id':_0x3bfec2[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x24bc64,null))['then'](function(_0x2effe2){if(_0x2effe2){return db['sequelize'][_0xe79f('0x98')](function(_0x35e560){return db[_0xe79f('0x99')][_0xe79f('0x3a')]({'where':{'MailAccountId':_0x3bfec2[_0xe79f('0x5d')]['id']},'transaction':_0x35e560})['then'](function(_0x238ce8){var _0x33f523=_[_0xe79f('0x47')](_0x3bfec2[_0xe79f('0x63')],function(_0x4d74a0){_0x4d74a0[_0xe79f('0x67')]=_0x3bfec2[_0xe79f('0x5d')]['id'];return _0x4d74a0;});return db[_0xe79f('0x99')][_0xe79f('0x9a')](_0x33f523,{'transaction':_0x35e560});});})[_0xe79f('0x22')](function(){return db['MailApplication'][_0xe79f('0x9b')]({'where':{'MailAccountId':_0x3bfec2[_0xe79f('0x5d')]['id']},'order':_0xe79f('0x9c')});});}})[_0xe79f('0x22')](respondWithResult(_0x24bc64,null))[_0xe79f('0x2b')](handleError(_0x24bc64,null));};exports['getApplications']=function(_0x2780fe,_0x150ff5,_0x49d629){var _0x5ed844={};var _0x2a5809={};var _0x1c1472;var _0x442d9b;return db[_0xe79f('0x57')][_0xe79f('0x6a')]({'where':{'id':_0x2780fe[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x150ff5,null))[_0xe79f('0x22')](function(_0x5d41ec){if(_0x5d41ec){_0x1c1472=_0x5d41ec;_0x2a5809[_0xe79f('0x46')]=_['keys'](db[_0xe79f('0x99')][_0xe79f('0x43')]);_0x2a5809[_0xe79f('0x48')]=_['keys'](_0x2780fe[_0xe79f('0x48')]);_0x2a5809[_0xe79f('0x4a')]=_[_0xe79f('0x4b')](_0x2a5809[_0xe79f('0x46')],_0x2a5809[_0xe79f('0x48')]);_0x5ed844[_0xe79f('0x4c')]=_[_0xe79f('0x4b')](_0x2a5809['model'],qs[_0xe79f('0x4d')](_0x2780fe[_0xe79f('0x48')][_0xe79f('0x4d')]));_0x5ed844['attributes']=_0x5ed844['attributes']['length']?_0x5ed844[_0xe79f('0x4c')]:_0x2a5809[_0xe79f('0x46')];_0x5ed844[_0xe79f('0x51')]=qs[_0xe79f('0x52')](_0x2780fe[_0xe79f('0x48')][_0xe79f('0x52')]);_0x5ed844['where']=qs[_0xe79f('0x4a')](_[_0xe79f('0x6b')](_0x2780fe[_0xe79f('0x48')],_0x2a5809['filters']));if(_0x2780fe['query'][_0xe79f('0x55')]){_0x5ed844[_0xe79f('0x53')]=_[_0xe79f('0x54')](_0x5ed844[_0xe79f('0x53')],{'$or':_[_0xe79f('0x47')](_0x5ed844['attributes'],function(_0x360257){var _0x5da7bd={};_0x5da7bd[_0x360257]={'$like':'%'+_0x2780fe[_0xe79f('0x48')][_0xe79f('0x55')]+'%'};return _0x5da7bd;})});}_0x5ed844=_['merge']({},_0x5ed844,_0x2780fe[_0xe79f('0x56')]);return _0x1c1472['getApplications'](_0x5ed844);}})['then'](function(_0x56a3f4){if(_0x56a3f4){_0x442d9b=_0x56a3f4[_0xe79f('0x4e')];if(!_0x2780fe['query'][_0xe79f('0x4f')]('nolimit')){_0x5ed844[_0xe79f('0x30')]=qs[_0xe79f('0x30')](_0x2780fe[_0xe79f('0x48')][_0xe79f('0x30')]);_0x5ed844[_0xe79f('0x33')]=qs['offset'](_0x2780fe['query'][_0xe79f('0x33')]);}return _0x1c1472[_0xe79f('0x9d')](_0x5ed844);}})[_0xe79f('0x22')](function(_0x513f2f){if(_0x513f2f){return _0x513f2f?{'count':_0x442d9b,'rows':_0x513f2f}:null;}})[_0xe79f('0x22')](respondWithResult(_0x150ff5,null))[_0xe79f('0x2b')](handleError(_0x150ff5,null));};exports[_0xe79f('0x9e')]=function(_0x2303f2,_0x1afba8,_0x507d73){var _0x5a5336={'raw':!![],'where':{}};var _0x1c493c={};var _0x4a4747={'count':0x0,'rows':[]};return db[_0xe79f('0x57')][_0xe79f('0x6a')]({'where':{'id':_0x2303f2[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x1afba8,null))[_0xe79f('0x22')](function(_0x116f2d){if(_0x116f2d){_0x1c493c['model']=_[_0xe79f('0x49')](db[_0xe79f('0x9f')][_0xe79f('0x43')]);_0x1c493c[_0xe79f('0x48')]=_['keys'](_0x2303f2[_0xe79f('0x48')]);_0x1c493c['filters']=_[_0xe79f('0x4b')](_0x1c493c[_0xe79f('0x46')],_0x1c493c['query']);_0x5a5336['attributes']=_[_0xe79f('0x4b')](_0x1c493c[_0xe79f('0x46')],qs[_0xe79f('0x4d')](_0x2303f2[_0xe79f('0x48')][_0xe79f('0x4d')]));_0x5a5336[_0xe79f('0x4c')]=_0x5a5336[_0xe79f('0x4c')][_0xe79f('0x4e')]?_0x5a5336[_0xe79f('0x4c')]:_0x1c493c['model'];if(!_0x2303f2[_0xe79f('0x48')][_0xe79f('0x4f')](_0xe79f('0x50'))){_0x5a5336[_0xe79f('0x30')]=qs['limit'](_0x2303f2[_0xe79f('0x48')]['limit']);_0x5a5336[_0xe79f('0x33')]=qs[_0xe79f('0x33')](_0x2303f2[_0xe79f('0x48')][_0xe79f('0x33')]);}_0x5a5336[_0xe79f('0x51')]=qs[_0xe79f('0x52')](_0x2303f2['query'][_0xe79f('0x52')]);_0x5a5336['where']=qs[_0xe79f('0x4a')](_[_0xe79f('0x6b')](_0x2303f2['query'],_0x1c493c['filters']));_0x5a5336[_0xe79f('0x53')][_0xe79f('0x67')]=_0x116f2d['id'];if(_0x2303f2['query'][_0xe79f('0x55')]){_0x5a5336[_0xe79f('0x53')]=_[_0xe79f('0x54')](_0x5a5336[_0xe79f('0x53')],{'$or':_[_0xe79f('0x47')](_0x5a5336['attributes'],function(_0x4d9915){var _0x154bbe={};_0x154bbe[_0x4d9915]={'$like':'%'+_0x2303f2[_0xe79f('0x48')]['filter']+'%'};return _0x154bbe;})});}if(_0x2303f2[_0xe79f('0x48')][_0xe79f('0xa0')]){var _0x2c924b=_0x2303f2[_0xe79f('0x48')]['$gte']['split'](',');var _0x382461={};_0x382461[_0x2c924b[0x0]]={'$gte':moment(_0x2c924b[0x1])[_0xe79f('0xa1')](_0xe79f('0xa2'))};_0x5a5336[_0xe79f('0x53')]=_[_0xe79f('0x54')](_0x5a5336[_0xe79f('0x53')],_0x382461);}_0x5a5336=_[_0xe79f('0x54')]({},_0x5a5336,_0x2303f2['options']);return db['MailMessage'][_0xe79f('0x32')]({'where':_0x5a5336[_0xe79f('0x53')]})['then'](function(_0x3c90a9){_0x4a4747['count']=_0x3c90a9;if(_0x2303f2['query'][_0xe79f('0x58')]){_0x5a5336[_0xe79f('0x59')]=[{'all':!![]}];}return db['MailMessage'][_0xe79f('0x5a')](_0x5a5336);})[_0xe79f('0x22')](function(_0x328150){if(_0x2303f2[_0xe79f('0x48')][_0xe79f('0xa3')]==='true'){for(var _0xa0b7f2=0x0;_0xa0b7f2<_0x328150[_0xe79f('0x4e')];_0xa0b7f2++){_0x328150[_0xa0b7f2][_0xe79f('0x63')]=juice(_0x328150[_0xa0b7f2]['body']);}}_0x4a4747['rows']=_0x328150;return _0x4a4747;});}})[_0xe79f('0x22')](respondWithFilteredResult(_0x1afba8,_0x5a5336))[_0xe79f('0x2b')](handleError(_0x1afba8,null));};exports['send']=function(_0x5cd23a,_0x5665fc,_0x394628){var _0x5eabb2,_0x79eb0a={},_0x241023;if(_0x5cd23a[_0xe79f('0x63')]['to']){_0x241023=_0x5cd23a[_0xe79f('0x63')]['to'][_0xe79f('0xa4')](',')[0x0];}return db['MailAccount'][_0xe79f('0x62')]({'where':{'id':_0x5cd23a[_0xe79f('0x5d')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xe79f('0xa5'),'where':{'email':_0x241023},'limit':0x1,'order':[[_0xe79f('0xa6'),_0xe79f('0xa7')]]}]},{'model':db[_0xe79f('0x60')],'as':_0xe79f('0x42'),'raw':!![]}]})['then'](handleEntityNotFound(_0x5665fc,null))['then'](function(_0x28bf0d){if(_0x28bf0d){_0x5eabb2=_0x28bf0d;if(_0x28bf0d['Smtp']){if(_['isNil'](_0x5cd23a[_0xe79f('0x63')][_0xe79f('0xa8')])){_0x5cd23a[_0xe79f('0x63')][_0xe79f('0xa8')]=util['format']('%s\x20<%s>',_0x28bf0d[_0xe79f('0x3f')],_0x28bf0d[_0xe79f('0x71')]||_0x28bf0d[_0xe79f('0x42')][_0xe79f('0x77')]);}if(_0x5cd23a[_0xe79f('0x63')]['attachments']&&_0x5cd23a['body'][_0xe79f('0xa9')][_0xe79f('0x4e')]){for(var _0x22f5bd=0x0;_0x22f5bd<_0x5cd23a[_0xe79f('0x63')]['attachments'][_0xe79f('0x4e')];_0x22f5bd+=0x1){_0x5cd23a[_0xe79f('0x63')][_0xe79f('0xa9')][_0x22f5bd]={'filename':_0x5cd23a[_0xe79f('0x63')][_0xe79f('0xa9')][_0x22f5bd][_0xe79f('0x3f')],'path':path[_0xe79f('0xaa')](config[_0xe79f('0xab')],_0xe79f('0xac'),_0x5cd23a[_0xe79f('0x63')][_0xe79f('0xa9')][_0x22f5bd][_0xe79f('0xad')])};}}var _0x34f7cc={'tls':{'rejectUnauthorized':![]}};if(_[_0xe79f('0x73')](_0x28bf0d[_0xe79f('0x42')][_0xe79f('0x7e')])){if(_0x28bf0d['Smtp'][_0xe79f('0x7b')]){_0x34f7cc[_0xe79f('0xae')]={'user':_0x28bf0d[_0xe79f('0x42')][_0xe79f('0x77')],'pass':_0x28bf0d[_0xe79f('0x42')][_0xe79f('0x7f')]};}_0x34f7cc[_0xe79f('0x7c')]=_0x28bf0d[_0xe79f('0x42')][_0xe79f('0x7c')];_0x34f7cc['port']=_0x28bf0d[_0xe79f('0x42')]['port'];_0x34f7cc[_0xe79f('0xaf')]=_0x28bf0d['Smtp'][_0xe79f('0xaf')];}else{_0x34f7cc[_0xe79f('0x7e')]=_0x28bf0d['Smtp'][_0xe79f('0x7e')];_0x34f7cc[_0xe79f('0xae')]={'user':_0x28bf0d[_0xe79f('0x42')][_0xe79f('0x77')],'pass':_0x28bf0d[_0xe79f('0x42')][_0xe79f('0x7f')]};}return respondWithRpcPromise(_0xe79f('0xb0'),'sendMail',{'account':_0x34f7cc,'message':_0x5cd23a['body']});}else{throw new Error(_0xe79f('0xb1'));}}})[_0xe79f('0x22')](function(_0x26c53f){if(_0x26c53f){_0x79eb0a=_0x26c53f;if(_0x5eabb2[_0xe79f('0xb2')]){if(_0x5eabb2[_0xe79f('0xb2')]['Contacts']['length']){return _0x5eabb2[_0xe79f('0xb2')][_0xe79f('0xa5')][0x0];}else{return db[_0xe79f('0x8e')]['create'](_[_0xe79f('0xb3')](_0x5cd23a[_0xe79f('0x63')],{'firstName':_0x5cd23a['body']['to'],'email':_0x5cd23a['body']['to'],'phone':_0x5cd23a['body']['to'],'ListId':_0x5eabb2['ListId']}));}}else{throw new Error('List\x20not\x20found');}}})[_0xe79f('0x22')](function(_0x31615e){if(_0x31615e){var _0x29d98a={'UserId':_0x5cd23a[_0xe79f('0x77')]['id'],'ContactId':_0x31615e['id'],'MailAccountId':_0x5eabb2['id'],'inReplyTo':_0x79eb0a[_0xe79f('0xb4')],'to':_0x5cd23a[_0xe79f('0x63')][_0xe79f('0xa8')],'cc':_0x5cd23a[_0xe79f('0x63')]['cc'],'subject':_0x5cd23a[_0xe79f('0x63')]['subject'],'attach':_0x5cd23a[_0xe79f('0x63')][_0xe79f('0xb5')],'firstMsgDirection':_0xe79f('0xb6'),'lastMsgAt':moment()[_0xe79f('0xa1')](_0xe79f('0xa2')),'lastMsgDirection':_0xe79f('0xb6'),'Messages':[_[_0xe79f('0x54')](_0x5cd23a[_0xe79f('0x63')],{'messageId':_0x79eb0a[_0xe79f('0xb4')],'sentAt':moment()[_0xe79f('0xa1')](_0xe79f('0xa2')),'read':!![],'MailAccountId':_0x5eabb2['id'],'UserId':_0x5cd23a[_0xe79f('0x77')]['id'],'ContactId':_0x31615e['id']})]};if(_0x5cd23a[_0xe79f('0x63')][_0xe79f('0xb7')]){_0x29d98a=_[_0xe79f('0x54')](_0x29d98a,_0x5cd23a['body']['Interaction']);}return db['MailInteraction'][_0xe79f('0x69')](_0x29d98a,{'include':[{'model':db[_0xe79f('0x9f')],'as':_0xe79f('0xb8')}]});}})['then'](respondWithResult(_0x5665fc,null))[_0xe79f('0x2b')](handleError(_0x5665fc,null));};exports['verifySmtp']=function(_0x7e8063,_0x34262c,_0x28e034){return db['MailAccount'][_0xe79f('0x62')]({'where':{'id':_0x7e8063['params']['id']},'include':[{'model':db['MailServerOut'],'as':_0xe79f('0x42'),'raw':!![]}]})[_0xe79f('0x22')](handleEntityNotFound(_0x34262c,null))[_0xe79f('0x22')](function(_0x40f337){if(_0x40f337&&_0x40f337[_0xe79f('0x42')]){var _0x8dcdfc={'id':_0x40f337['id'],'tls':{'rejectUnauthorized':![]}};if(_0x40f337[_0xe79f('0x42')]['service']){_0x8dcdfc[_0xe79f('0x7e')]=_0x40f337[_0xe79f('0x42')][_0xe79f('0x7e')];}else{_0x8dcdfc[_0xe79f('0x7c')]=_0x40f337[_0xe79f('0x42')][_0xe79f('0x7c')];_0x8dcdfc[_0xe79f('0x7d')]=_0x40f337['Smtp']['port'];_0x8dcdfc[_0xe79f('0xaf')]=_0x40f337[_0xe79f('0x42')]['secure'];}if(_0x40f337[_0xe79f('0x42')][_0xe79f('0x7b')]){_0x8dcdfc['auth']={'user':_0x40f337[_0xe79f('0x42')]['user'],'pass':_0x40f337[_0xe79f('0x42')][_0xe79f('0x7f')]};}return respondWithRpcPromise(_0xe79f('0xb9'),_0xe79f('0xba'),{'account':_0x8dcdfc});}})[_0xe79f('0x22')](respondWithResult(_0x34262c,null))[_0xe79f('0x2b')](handleError(_0x34262c,null));};exports['destroy']=function(_0x280f27,_0x3b8751){return db[_0xe79f('0x57')]['find']({'where':{'id':_0x280f27[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x3b8751,null))[_0xe79f('0x22')](function(_0x3d117e){if(_0x3d117e&&_0x3d117e['service']){throw new db[(_0xe79f('0xbb'))][(_0xe79f('0xbc'))]('You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account');}return _0x3d117e;})[_0xe79f('0x22')](removeEntity(_0x3b8751,null))['catch'](handleError(_0x3b8751,null));};exports[_0xe79f('0xbd')]=function(_0x379d2e,_0x7c687c,_0x599001){return db[_0xe79f('0x57')][_0xe79f('0x62')]({'where':{'id':_0x379d2e['params']['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x7c687c,null))[_0xe79f('0x22')](function(_0x1c7df1){if(_0x1c7df1){return _0x1c7df1[_0xe79f('0xbd')](_0x379d2e['body']['ids'],_[_0xe79f('0x8d')](_0x379d2e['body'],[_0xe79f('0x6c'),'id'])||{})[_0xe79f('0xbe')](function(_0x59fe4c){for(var _0x2140bb=0x0;_0x2140bb<_0x379d2e[_0xe79f('0x63')][_0xe79f('0x6c')][_0xe79f('0x4e')];_0x2140bb+=0x1){socket['emit'](_0xe79f('0xbf'),{'UserId':Number(_0x379d2e['body'][_0xe79f('0x6c')][_0x2140bb]),'MailAccountId':Number(_0x379d2e[_0xe79f('0x5d')]['id'])});}return _0x59fe4c;});}})[_0xe79f('0x22')](respondWithResult(_0x7c687c,null))['catch'](handleError(_0x7c687c,null));};exports[_0xe79f('0xc0')]=function(_0x19db47,_0x3771df,_0x1b8292){return db[_0xe79f('0x57')][_0xe79f('0x62')]({'where':{'id':_0x19db47[_0xe79f('0x5d')]['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x3771df,null))[_0xe79f('0x22')](function(_0x2ca2b3){if(_0x2ca2b3){return _0x2ca2b3['removeAgents'](_0x19db47[_0xe79f('0x48')][_0xe79f('0x6c')])[_0xe79f('0x22')](function(){if(_[_0xe79f('0xc1')](_0x19db47[_0xe79f('0x48')][_0xe79f('0x6c')])){for(var _0x262901=0x0;_0x262901<_0x19db47[_0xe79f('0x48')][_0xe79f('0x6c')]['length'];_0x262901+=0x1){socket[_0xe79f('0xc2')]('userMailAccount:remove',{'UserId':Number(_0x19db47[_0xe79f('0x48')][_0xe79f('0x6c')][_0x262901]),'MailAccountId':Number(_0x19db47[_0xe79f('0x5d')]['id'])});}}else{socket[_0xe79f('0xc2')](_0xe79f('0xc3'),{'UserId':Number(_0x19db47[_0xe79f('0x48')]['ids']),'MailAccountId':Number(_0x19db47[_0xe79f('0x5d')]['id'])});}});}})[_0xe79f('0x22')](respondWithStatusCode(_0x3771df,null))[_0xe79f('0x2b')](handleError(_0x3771df,null));};exports[_0xe79f('0xc4')]=function(_0x102173,_0x41d151,_0xcf5548){var _0x53a85c={};var _0x8618db={};var _0x41ac8f;var _0x418d72;return db['MailAccount'][_0xe79f('0x6a')]({'where':{'id':_0x102173['params']['id']}})[_0xe79f('0x22')](handleEntityNotFound(_0x41d151,null))[_0xe79f('0x22')](function(_0x19d40b){if(_0x19d40b){_0x41ac8f=_0x19d40b;_0x8618db[_0xe79f('0x46')]=_[_0xe79f('0x49')](db[_0xe79f('0x90')][_0xe79f('0x43')]);_0x8618db['query']=_[_0xe79f('0x49')](_0x102173['query']);_0x8618db[_0xe79f('0x4a')]=_[_0xe79f('0x4b')](_0x8618db[_0xe79f('0x46')],_0x8618db['query']);_0x53a85c[_0xe79f('0x4c')]=_[_0xe79f('0x4b')](_0x8618db['model'],qs[_0xe79f('0x4d')](_0x102173['query'][_0xe79f('0x4d')]));_0x53a85c[_0xe79f('0x4c')]=_0x53a85c[_0xe79f('0x4c')][_0xe79f('0x4e')]?_0x53a85c[_0xe79f('0x4c')]:_0x8618db['model'];_0x53a85c[_0xe79f('0x51')]=qs['sort'](_0x102173[_0xe79f('0x48')]['sort']);_0x53a85c[_0xe79f('0x53')]=qs[_0xe79f('0x4a')](_['pick'](_0x102173['query'],_0x8618db[_0xe79f('0x4a')]));if(_0x102173[_0xe79f('0x48')][_0xe79f('0x55')]){_0x53a85c['where']=_[_0xe79f('0x54')](_0x53a85c[_0xe79f('0x53')],{'$or':_[_0xe79f('0x47')](_0x53a85c['attributes'],function(_0x5b9ffe){var _0x4b1ac0={};_0x4b1ac0[_0x5b9ffe]={'$like':'%'+_0x102173[_0xe79f('0x48')][_0xe79f('0x55')]+'%'};return _0x4b1ac0;})});}_0x53a85c=_[_0xe79f('0x54')]({},_0x53a85c,_0x102173[_0xe79f('0x56')]);return _0x41ac8f[_0xe79f('0xc4')](_0x53a85c);}})['then'](function(_0x32eefe){if(_0x32eefe){_0x418d72=_0x32eefe['length'];if(!_0x102173[_0xe79f('0x48')]['hasOwnProperty'](_0xe79f('0x50'))){_0x53a85c[_0xe79f('0x30')]=qs[_0xe79f('0x30')](_0x102173[_0xe79f('0x48')][_0xe79f('0x30')]);_0x53a85c[_0xe79f('0x33')]=qs[_0xe79f('0x33')](_0x102173[_0xe79f('0x48')][_0xe79f('0x33')]);}return _0x41ac8f['getAgents'](_0x53a85c);}})[_0xe79f('0x22')](function(_0x4cd797){if(_0x4cd797){return _0x4cd797?{'count':_0x418d72,'rows':_0x4cd797}:null;}})[_0xe79f('0x22')](respondWithResult(_0x41d151,null))[_0xe79f('0x2b')](handleError(_0x41d151,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index c11fed2..ffeb5ba 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 _0x2cc4=['hook','events','../../mysqldb','MailAccount','setMaxListeners','update','remove','emit','hasOwnProperty'];(function(_0x1b25c1,_0x2c6ce6){var _0x1e4447=function(_0xaaafca){while(--_0xaaafca){_0x1b25c1['push'](_0x1b25c1['shift']());}};_0x1e4447(++_0x2c6ce6);}(_0x2cc4,0x1f0));var _0x42cc=function(_0x28a5ad,_0x520afa){_0x28a5ad=_0x28a5ad-0x0;var _0x176b8a=_0x2cc4[_0x28a5ad];return _0x176b8a;};'use strict';var EventEmitter=require(_0x42cc('0x0'));var MailAccount=require(_0x42cc('0x1'))['db'][_0x42cc('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x42cc('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x42cc('0x4'),'afterDestroy':_0x42cc('0x5')};function emitEvent(_0x507949){return function(_0x5a6c01,_0x4acd38,_0x91f014){MailAccountEvents[_0x42cc('0x6')](_0x507949+':'+_0x5a6c01['id'],_0x5a6c01);MailAccountEvents[_0x42cc('0x6')](_0x507949,_0x5a6c01);_0x91f014(null);};}for(var e in events){if(events[_0x42cc('0x7')](e)){var event=events[e];MailAccount[_0x42cc('0x8')](e,emitEvent(event));}}module['exports']=MailAccountEvents; \ No newline at end of file +var _0xc61d=['exports','events','../../mysqldb','MailAccount','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x2261e1,_0x1f9abd){var _0x138d3c=function(_0xa7f0f2){while(--_0xa7f0f2){_0x2261e1['push'](_0x2261e1['shift']());}};_0x138d3c(++_0x1f9abd);}(_0xc61d,0xfb));var _0xdc61=function(_0x1c67dc,_0x164063){_0x1c67dc=_0x1c67dc-0x0;var _0x456fff=_0xc61d[_0x1c67dc];return _0x456fff;};'use strict';var EventEmitter=require(_0xdc61('0x0'));var MailAccount=require(_0xdc61('0x1'))['db'][_0xdc61('0x2')];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0xdc61('0x3')](0x0);var events={'afterCreate':_0xdc61('0x4'),'afterUpdate':_0xdc61('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2125a2){return function(_0x237baa,_0x4ebd75,_0x2b94dd){MailAccountEvents[_0xdc61('0x6')](_0x2125a2+':'+_0x237baa['id'],_0x237baa);MailAccountEvents[_0xdc61('0x6')](_0x2125a2,_0x237baa);_0x2b94dd(null);};}for(var e in events){if(events[_0xdc61('0x7')](e)){var event=events[e];MailAccount[_0xdc61('0x8')](e,emitEvent(event));}}module[_0xdc61('0x9')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 74056ee..075afe8 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 _0x0dd1=['../../config/environment','mail_accounts','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x2788d8,_0x3d132b){var _0x5f2345=function(_0x4e73c7){while(--_0x4e73c7){_0x2788d8['push'](_0x2788d8['shift']());}};_0x5f2345(++_0x3d132b);}(_0x0dd1,0x124));var _0x10dd=function(_0x3cbc00,_0x563224){_0x3cbc00=_0x3cbc00-0x0;var _0x45dfd1=_0x0dd1[_0x3cbc00];return _0x45dfd1;};'use strict';var _=require(_0x10dd('0x0'));var util=require(_0x10dd('0x1'));var logger=require(_0x10dd('0x2'))(_0x10dd('0x3'));var moment=require(_0x10dd('0x4'));var BPromise=require(_0x10dd('0x5'));var rp=require(_0x10dd('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x10dd('0x7'));var config=require(_0x10dd('0x8'));var attributes=require('./mailAccount.attributes');module['exports']=function(_0x46919f,_0x2ead14){return _0x46919f['define']('MailAccount',attributes,{'tableName':_0x10dd('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9f6=['../../config/environment','./mailAccount.attributes','exports','define','MailAccount','mail_accounts','lodash','moment','request-promise','path','rimraf'];(function(_0x4bfac3,_0x58324d){var _0x15f0f2=function(_0xf0c511){while(--_0xf0c511){_0x4bfac3['push'](_0x4bfac3['shift']());}};_0x15f0f2(++_0x58324d);}(_0xa9f6,0xd7));var _0x6a9f=function(_0x14275b,_0x4f5abc){_0x14275b=_0x14275b-0x0;var _0x10f765=_0xa9f6[_0x14275b];return _0x10f765;};'use strict';var _=require(_0x6a9f('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x6a9f('0x1'));var BPromise=require('bluebird');var rp=require(_0x6a9f('0x2'));var fs=require('fs');var path=require(_0x6a9f('0x3'));var rimraf=require(_0x6a9f('0x4'));var config=require(_0x6a9f('0x5'));var attributes=require(_0x6a9f('0x6'));module[_0x6a9f('0x7')]=function(_0x4759a7,_0x152324){return _0x4759a7[_0x6a9f('0x8')](_0x6a9f('0x9'),attributes,{'tableName':_0x6a9f('0xa'),'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 7ff0ee2..97ab124 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 _0x649e=['Contacts','MailApplication','get','omit','applications','list','orderBy','priority','asc','autoclose','push','length','Applications','defaults','List\x20not\x20found','generate','subject','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','messageId','inReplyTo','create','Contact\x20not\x20found','spread','update','attach','interaction','created','contact','attachments','originTo','ChatWebsiteId','originChannel','ChatOfflineMessageId','Attachment','UserId','User','name','unshift','agent','waitForTheAssignedAgent','startRouting','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','socket.io-emitter','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','findAll','options','raw','where','attributes','limit','map','model','include','GetMailAccount','debug','MailAccount','find','ShowMailAccount','NotifyMailAccount','body','mail','keys','CmContact','createdAt','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','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','account','List'];(function(_0x35f3e9,_0x316eef){var _0x365c0b=function(_0x277301){while(--_0x277301){_0x35f3e9['push'](_0x35f3e9['shift']());}};_0x365c0b(++_0x316eef);}(_0x649e,0x15c));var _0xe649=function(_0x186394,_0x5bf731){_0x186394=_0x186394-0x0;var _0xabe054=_0x649e[_0x186394];return _0xabe054;};'use strict';var _=require('lodash');var util=require(_0xe649('0x0'));var moment=require('moment');var BPromise=require(_0xe649('0x1'));var rs=require(_0xe649('0x2'));var fs=require('fs');var Redis=require(_0xe649('0x3'));var db=require(_0xe649('0x4'))['db'];var utils=require(_0xe649('0x5'));var logger=require(_0xe649('0x6'))(_0xe649('0x7'));var config=require(_0xe649('0x8'));var jayson=require(_0xe649('0x9'));var client=jayson['client']['http']({'port':0x232c});config['redis']=_['defaults'](config[_0xe649('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xe649('0xb'))(new Redis(config[_0xe649('0xa')]));require('./mailAccount.socket')[_0xe649('0xc')](socket);function respondWithRpcPromise(_0x399eff,_0x454139,_0x2c0ab2){return new BPromise(function(_0x4bec40,_0xf1436e){return client[_0xe649('0xd')](_0x399eff,_0x2c0ab2)[_0xe649('0xe')](function(_0x10e377){logger[_0xe649('0xf')](_0xe649('0x10'),_0x454139,_0xe649('0x11'));logger['debug']('MailAccount,\x20%s,\x20%s,\x20%s',_0x454139,_0xe649('0x11'),JSON[_0xe649('0x12')](_0x10e377));if(_0x10e377[_0xe649('0x13')]){if(_0x10e377[_0xe649('0x13')]['code']===0x1f4){logger[_0xe649('0x13')]('MailAccount,\x20%s,\x20%s',_0x454139,_0x10e377[_0xe649('0x13')]['message']);return _0xf1436e(_0x10e377[_0xe649('0x13')]['message']);}logger[_0xe649('0x13')](_0xe649('0x10'),_0x454139,_0x10e377[_0xe649('0x13')][_0xe649('0x14')]);return _0x4bec40(_0x10e377[_0xe649('0x13')][_0xe649('0x14')]);}else{logger[_0xe649('0xf')](_0xe649('0x10'),_0x454139,_0xe649('0x11'));_0x4bec40(_0x10e377[_0xe649('0x15')][_0xe649('0x14')]);}})[_0xe649('0x16')](function(_0x5e6c5a){logger['error'](_0xe649('0x10'),_0x454139,_0x5e6c5a);_0xf1436e(_0x5e6c5a);});});}exports['GetMailAccount']=function(_0x516315){var _0x5661c9=this;return new Promise(function(_0x36e027,_0x3f5cc5){return db['MailAccount'][_0xe649('0x17')]({'raw':_0x516315['options']?_0x516315[_0xe649('0x18')][_0xe649('0x19')]===undefined?!![]:![]:!![],'where':_0x516315[_0xe649('0x18')]?_0x516315[_0xe649('0x18')][_0xe649('0x1a')]||null:null,'attributes':_0x516315[_0xe649('0x18')]?_0x516315[_0xe649('0x18')][_0xe649('0x1b')]||null:null,'limit':_0x516315[_0xe649('0x18')]?_0x516315[_0xe649('0x18')][_0xe649('0x1c')]||null:null,'include':_0x516315[_0xe649('0x18')]?_0x516315[_0xe649('0x18')]['include']?_[_0xe649('0x1d')](_0x516315[_0xe649('0x18')]['include'],function(_0x1fc0c6){return{'model':db[_0x1fc0c6[_0xe649('0x1e')]],'as':_0x1fc0c6['as'],'attributes':_0x1fc0c6[_0xe649('0x1b')],'include':_0x1fc0c6[_0xe649('0x1f')]?_[_0xe649('0x1d')](_0x1fc0c6[_0xe649('0x1f')],function(_0xc370a2){return{'model':db[_0xc370a2['model']],'as':_0xc370a2['as'],'attributes':_0xc370a2[_0xe649('0x1b')],'include':_0xc370a2['include']?_[_0xe649('0x1d')](_0xc370a2[_0xe649('0x1f')],function(_0x369de7){return{'model':db[_0x369de7[_0xe649('0x1e')]],'as':_0x369de7['as'],'attributes':_0x369de7[_0xe649('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe649('0xe')](function(_0x55da17){logger[_0xe649('0xf')](_0xe649('0x20'),_0x516315);logger[_0xe649('0x21')]('GetMailAccount',_0x516315,JSON[_0xe649('0x12')](_0x55da17));_0x36e027(_0x55da17);})[_0xe649('0x16')](function(_0x5ac193){logger[_0xe649('0x13')](_0xe649('0x20'),_0x5ac193[_0xe649('0x14')],_0x516315);_0x3f5cc5(_0x5661c9[_0xe649('0x13')](0x1f4,_0x5ac193[_0xe649('0x14')]));});});};exports['ShowMailAccount']=function(_0xc86a29){var _0x651b0=this;return new Promise(function(_0x2b3089,_0x1141f9){return db[_0xe649('0x22')][_0xe649('0x23')]({'raw':_0xc86a29[_0xe649('0x18')]?_0xc86a29[_0xe649('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0xc86a29['options']?_0xc86a29[_0xe649('0x18')][_0xe649('0x1a')]||null:null,'attributes':_0xc86a29['options']?_0xc86a29[_0xe649('0x18')][_0xe649('0x1b')]||null:null,'include':_0xc86a29[_0xe649('0x18')]?_0xc86a29[_0xe649('0x18')]['include']?_[_0xe649('0x1d')](_0xc86a29['options'][_0xe649('0x1f')],function(_0xb51b54){return{'model':db[_0xb51b54['model']],'as':_0xb51b54['as'],'attributes':_0xb51b54[_0xe649('0x1b')],'include':_0xb51b54['include']?_['map'](_0xb51b54['include'],function(_0x16d2d2){return{'model':db[_0x16d2d2['model']],'as':_0x16d2d2['as'],'attributes':_0x16d2d2[_0xe649('0x1b')],'include':_0x16d2d2[_0xe649('0x1f')]?_[_0xe649('0x1d')](_0x16d2d2[_0xe649('0x1f')],function(_0x26112f){return{'model':db[_0x26112f[_0xe649('0x1e')]],'as':_0x26112f['as'],'attributes':_0x26112f[_0xe649('0x1b')]};}):[]};}):[]};}):[]:[]})[_0xe649('0xe')](function(_0x33218f){logger[_0xe649('0xf')](_0xe649('0x24'),_0xc86a29);logger[_0xe649('0x21')](_0xe649('0x24'),_0xc86a29,JSON[_0xe649('0x12')](_0x33218f));_0x2b3089(_0x33218f);})[_0xe649('0x16')](function(_0x308af8){logger['error']('ShowMailAccount',_0x308af8[_0xe649('0x14')],_0xc86a29);_0x1141f9(_0x651b0[_0xe649('0x13')](0x1f4,_0x308af8['message']));});});};exports[_0xe649('0x25')]=function(_0x45e980){var _0x8c4186=this;return new Promise(function(_0x5d0820,_0x24bf0a){var _0x4b6303={'body':_0x45e980[_0xe649('0x26')],'channel':_0xe649('0x27')};var _0x24b6d7=_['difference'](_[_0xe649('0x28')](db[_0xe649('0x29')]['rawAttributes']),[_0xe649('0x2a'),_0xe649('0x2b'),_0xe649('0x2c'),_0xe649('0x2d')]);var _0x343931=![];if(_0x45e980['body']['id']){delete _0x45e980[_0xe649('0x26')]['id'];}if(_[_0xe649('0x2e')](_0x45e980['body'][_0xe649('0x2f')])){return _0x24bf0a(_0x8c4186[_0xe649('0x13')](0x1f4,_0xe649('0x30')));}if(_['isNil'](_0x45e980[_0xe649('0x26')][_0xe649('0x26')])||_0x45e980[_0xe649('0x26')][_0xe649('0x26')]===''){return _0x24bf0a(_0x8c4186[_0xe649('0x13')](0x1f4,_0xe649('0x31')));}if(_[_0xe649('0x2e')](_0x45e980[_0xe649('0x26')][_0xe649('0x32')])){return _0x24bf0a(_0x8c4186[_0xe649('0x13')](0x1f4,_0xe649('0x33')+_0x24b6d7));}if(!_[_0xe649('0x34')](_0x24b6d7,_0x45e980['body'][_0xe649('0x32')])){return _0x24bf0a(_0x8c4186[_0xe649('0x13')](0x1f4,_0xe649('0x35')+_0x24b6d7));}var _0x4712c4={};_0x4712c4[_0x45e980['body'][_0xe649('0x32')]]=_0x45e980['body']['from'];return db[_0xe649('0x22')][_0xe649('0x23')]({'where':{'id':_0x45e980[_0xe649('0x36')]['id']},'include':[{'model':db['CmList'],'as':_0xe649('0x37'),'include':[{'model':db[_0xe649('0x29')],'as':_0xe649('0x38'),'where':_0x4712c4,'limit':0x1,'order':[[_0xe649('0x2b'),'DESC']]}]},{'model':db[_0xe649('0x39')],'as':'Applications'},{'model':db['MailServerOut'],'as':'Smtp'}]})[_0xe649('0xe')](function(_0x27b0d6){if(_0x27b0d6&&_0x27b0d6[_0xe649('0x37')]){var _0x47606d=_0x27b0d6[_0xe649('0x3a')]({'plain':!![]});_0x4b6303[_0xe649('0x36')]=_[_0xe649('0x3b')](_0x47606d,['Applications','List']);_0x4b6303[_0xe649('0x3c')]=_0x47606d['Applications'];_0x4b6303[_0xe649('0x3d')]=_0x47606d[_0xe649('0x37')];_0x4b6303[_0xe649('0x3c')]=_[_0xe649('0x3e')](_0x4b6303['applications'],[_0xe649('0x3f')],[_0xe649('0x40')]);if(_0x4b6303[_0xe649('0x36')]&&_0x4b6303[_0xe649('0x36')][_0xe649('0x41')]){_0x4b6303['applications'][_0xe649('0x42')]({'id':0x0,'priority':_0x4b6303['applications'][_0xe649('0x43')]+0x1,'app':'close','appdata':_0xe649('0x41'),'interval':'*,*,*,*'});}if(_0x4b6303[_0xe649('0x36')][_0xe649('0x44')]){delete _0x4b6303[_0xe649('0x36')][_0xe649('0x44')];}if(_0x4b6303['account'][_0xe649('0x37')]){delete _0x4b6303['account'][_0xe649('0x37')];}if(_0x47606d['List'][_0xe649('0x38')][_0xe649('0x43')]){return _0x47606d[_0xe649('0x37')]['Contacts'][0x0];}var _0xea5e6=_[_0xe649('0x45')](_0x45e980[_0xe649('0x26')],{'firstName':_0x45e980[_0xe649('0x26')][_0xe649('0x2f')],'ListId':_0x47606d[_0xe649('0x2d')]});_0xea5e6[_0x45e980[_0xe649('0x26')][_0xe649('0x32')]]=_0x45e980[_0xe649('0x26')]['from'];return db[_0xe649('0x29')]['create'](_0xea5e6);}else{throw new Error(_0xe649('0x46'));}})[_0xe649('0xe')](function(_0x8bff13){_0x4b6303['contact']=_0x8bff13;if(_0x8bff13){if(!_0x45e980[_0xe649('0x26')][_0xe649('0x14')]['messageId']){_0x45e980[_0xe649('0x26')][_0xe649('0x14')]['messageId']=rs[_0xe649('0x47')]()+'\x20'+_0x45e980[_0xe649('0x26')]['message'][_0xe649('0x2f')];}var _0x4a821e={'ContactId':_0x8bff13['id'],'MailAccountId':_0x45e980['account']['id'],'inReplyTo':_0x45e980[_0xe649('0x26')]['message']['messageId'],'to':_0x45e980[_0xe649('0x26')][_0xe649('0x14')][_0xe649('0x2f')],'cc':_0x45e980[_0xe649('0x26')][_0xe649('0x14')]['cc'],'subject':_0x45e980[_0xe649('0x26')][_0xe649('0x14')][_0xe649('0x48')],'attach':_0x45e980[_0xe649('0x26')][_0xe649('0x14')]['attach'],'lastMsgAt':moment()[_0xe649('0x49')](_0xe649('0x4a')),'lastMsgDirection':'in'};return db[_0xe649('0x4b')][_0xe649('0x23')]({'where':{'closed':![],'MailAccountId':_0x45e980[_0xe649('0x36')]['id']},'include':[{'model':db[_0xe649('0x4c')],'as':_0xe649('0x4d'),'attributes':[_0xe649('0x4e')],'where':{'messageId':_0x45e980[_0xe649('0x26')][_0xe649('0x14')][_0xe649('0x4f')]}}]})[_0xe649('0xe')](function(_0x29dc7a){if(_0x29dc7a){return[_0x29dc7a,![]];}return db[_0xe649('0x4b')][_0xe649('0x50')](_0x4a821e)[_0xe649('0xe')](function(_0xa661ed){return[_0xa661ed,!![]];});});}else{throw new Error(_0xe649('0x51'));}})[_0xe649('0x52')](function(_0x299d62,_0x49dafc){if(_0x299d62){_0x343931=_0x49dafc;if(!_0x49dafc){return _0x299d62[_0xe649('0x53')]({'inReplyTo':_0x45e980['body']['message'][_0xe649('0x4e')],'to':_0x45e980['body'][_0xe649('0x14')][_0xe649('0x2f')],'cc':_0x45e980['body']['message']['cc'],'subject':_0x45e980[_0xe649('0x26')][_0xe649('0x14')][_0xe649('0x48')],'attach':_0x299d62[_0xe649('0x54')]?_0x299d62[_0xe649('0x54')]:_0x45e980[_0xe649('0x26')][_0xe649('0x14')][_0xe649('0x54')],'substatus':null,'substatusAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgAt':moment()['format'](_0xe649('0x4a')),'lastMsgDirection':'in'});}else{return _0x299d62;}}})[_0xe649('0xe')](function(_0x294590){_0x4b6303[_0xe649('0x55')]=_0x294590[_0xe649('0x3a')]({'plain':!![]});_0x4b6303[_0xe649('0x55')][_0xe649('0x56')]=_0x343931;return db[_0xe649('0x4c')][_0xe649('0x50')]({'body':_0x45e980[_0xe649('0x26')][_0xe649('0x26')],'MailAccountId':_0x45e980[_0xe649('0x36')]['id'],'MailInteractionId':_0x294590['id'],'direction':'in','ContactId':_0x4b6303[_0xe649('0x57')]['id'],'messageId':_0x45e980[_0xe649('0x26')][_0xe649('0x14')][_0xe649('0x4e')],'from':_0x45e980[_0xe649('0x26')][_0xe649('0x14')]['from'],'to':_0x45e980['body'][_0xe649('0x14')]['to'],'cc':_0x45e980[_0xe649('0x26')][_0xe649('0x14')]['cc'],'subject':_0x45e980[_0xe649('0x26')]['message'][_0xe649('0x48')],'attach':_0x45e980['body'][_0xe649('0x14')][_0xe649('0x54')],'Attachments':_0x45e980[_0xe649('0x26')][_0xe649('0x14')][_0xe649('0x58')],'originTo':_0x45e980[_0xe649('0x26')][_0xe649('0x14')][_0xe649('0x59')],'originCc':_0x45e980[_0xe649('0x26')][_0xe649('0x14')]['originCc'],'bcc':_0x45e980[_0xe649('0x26')][_0xe649('0x14')]['bcc'],'ChatWebsiteId':_0x45e980[_0xe649('0x26')]['message'][_0xe649('0x5a')]||null,'originChannel':_0x45e980[_0xe649('0x26')][_0xe649('0x14')][_0xe649('0x5b')]||'Email','ChatOfflineMessageId':_0x45e980['body'][_0xe649('0x14')][_0xe649('0x5c')]||null},{'include':[{'model':db[_0xe649('0x5d')],'as':'Attachments'}]});})[_0xe649('0xe')](function(_0x3a3465){_0x4b6303['message']=_0x3a3465;if(_0x4b6303[_0xe649('0x55')][_0xe649('0x5e')]){return db[_0xe649('0x5f')]['find']({'attributes':['id',_0xe649('0x60')],'where':{'id':_0x4b6303[_0xe649('0x55')][_0xe649('0x5e')]}})[_0xe649('0xe')](function(_0x236d9f){if(_0x236d9f){_0x4b6303['applications'][_0xe649('0x61')]({'id':0x0,'priority':0x0,'app':_0xe649('0x62'),'appdata':_0x236d9f[_0xe649('0x60')]+','+(_0x4b6303['account'][_0xe649('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise('Start',_0xe649('0x64'),_0x4b6303);});}return respondWithRpcPromise('Start',_0xe649('0x64'),_0x4b6303);})[_0xe649('0xe')](function(_0x4a4060){_0x5d0820(_0x4a4060);})[_0xe649('0x16')](function(_0x4334fc){_0x24bf0a(_0x8c4186[_0xe649('0x13')](0x1f4,_0x4334fc[_0xe649('0x14')]));});});}; \ No newline at end of file +var _0x95a9=['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','List','Contacts','DESC','MailApplication','Applications','Smtp','get','account','applications','list','orderBy','asc','autoclose','length','List\x20not\x20found','contact','messageId','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailInteraction','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','spread','interaction','created','attachments','originTo','originCc','Email','Attachments','UserId','User','name','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','MailAccount','options','where','limit','include','map','model','attributes','GetMailAccount','find','raw','ShowMailAccount','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','createdAt','updatedAt','ListId','isNil','from','from\x20is\x20mandatory'];(function(_0x194888,_0xef44a3){var _0x50f464=function(_0xeff804){while(--_0xeff804){_0x194888['push'](_0x194888['shift']());}};_0x50f464(++_0xef44a3);}(_0x95a9,0x96));var _0x995a=function(_0x832803,_0x2b918e){_0x832803=_0x832803-0x0;var _0x159e77=_0x95a9[_0x832803];return _0x159e77;};'use strict';var _=require(_0x995a('0x0'));var util=require(_0x995a('0x1'));var moment=require(_0x995a('0x2'));var BPromise=require(_0x995a('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x995a('0x4'));var db=require(_0x995a('0x5'))['db'];var utils=require(_0x995a('0x6'));var logger=require(_0x995a('0x7'))(_0x995a('0x8'));var config=require('../../config/environment');var jayson=require(_0x995a('0x9'));var client=jayson[_0x995a('0xa')]['http']({'port':0x232c});config[_0x995a('0xb')]=_[_0x995a('0xc')](config[_0x995a('0xb')],{'host':_0x995a('0xd'),'port':0x18eb});var socket=require(_0x995a('0xe'))(new Redis(config[_0x995a('0xb')]));require(_0x995a('0xf'))[_0x995a('0x10')](socket);function respondWithRpcPromise(_0x5f4456,_0x1c2e15,_0x45e837){return new BPromise(function(_0x32ae7a,_0x6ae944){return client[_0x995a('0x11')](_0x5f4456,_0x45e837)[_0x995a('0x12')](function(_0xe2a378){logger[_0x995a('0x13')](_0x995a('0x14'),_0x1c2e15,_0x995a('0x15'));logger[_0x995a('0x16')](_0x995a('0x17'),_0x1c2e15,'request\x20sent',JSON[_0x995a('0x18')](_0xe2a378));if(_0xe2a378[_0x995a('0x19')]){if(_0xe2a378[_0x995a('0x19')]['code']===0x1f4){logger[_0x995a('0x19')]('MailAccount,\x20%s,\x20%s',_0x1c2e15,_0xe2a378[_0x995a('0x19')][_0x995a('0x1a')]);return _0x6ae944(_0xe2a378['error']['message']);}logger[_0x995a('0x19')](_0x995a('0x14'),_0x1c2e15,_0xe2a378['error'][_0x995a('0x1a')]);return _0x32ae7a(_0xe2a378[_0x995a('0x19')][_0x995a('0x1a')]);}else{logger[_0x995a('0x13')](_0x995a('0x14'),_0x1c2e15,_0x995a('0x15'));_0x32ae7a(_0xe2a378[_0x995a('0x1b')]['message']);}})[_0x995a('0x1c')](function(_0x5b3ae8){logger['error'](_0x995a('0x14'),_0x1c2e15,_0x5b3ae8);_0x6ae944(_0x5b3ae8);});});}exports['GetMailAccount']=function(_0xd78a4c){var _0x15d62b=this;return new Promise(function(_0x3ec894,_0x14f0a1){return db[_0x995a('0x1d')]['findAll']({'raw':_0xd78a4c['options']?_0xd78a4c[_0x995a('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0xd78a4c[_0x995a('0x1e')]?_0xd78a4c[_0x995a('0x1e')][_0x995a('0x1f')]||null:null,'attributes':_0xd78a4c[_0x995a('0x1e')]?_0xd78a4c['options']['attributes']||null:null,'limit':_0xd78a4c[_0x995a('0x1e')]?_0xd78a4c[_0x995a('0x1e')][_0x995a('0x20')]||null:null,'include':_0xd78a4c[_0x995a('0x1e')]?_0xd78a4c[_0x995a('0x1e')][_0x995a('0x21')]?_[_0x995a('0x22')](_0xd78a4c[_0x995a('0x1e')]['include'],function(_0x2183ac){return{'model':db[_0x2183ac[_0x995a('0x23')]],'as':_0x2183ac['as'],'attributes':_0x2183ac[_0x995a('0x24')],'include':_0x2183ac[_0x995a('0x21')]?_[_0x995a('0x22')](_0x2183ac[_0x995a('0x21')],function(_0x208bd9){return{'model':db[_0x208bd9['model']],'as':_0x208bd9['as'],'attributes':_0x208bd9[_0x995a('0x24')],'include':_0x208bd9[_0x995a('0x21')]?_[_0x995a('0x22')](_0x208bd9['include'],function(_0x53fb60){return{'model':db[_0x53fb60['model']],'as':_0x53fb60['as'],'attributes':_0x53fb60[_0x995a('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2175b5){logger[_0x995a('0x13')](_0x995a('0x25'),_0xd78a4c);logger['debug'](_0x995a('0x25'),_0xd78a4c,JSON[_0x995a('0x18')](_0x2175b5));_0x3ec894(_0x2175b5);})[_0x995a('0x1c')](function(_0xae05da){logger[_0x995a('0x19')](_0x995a('0x25'),_0xae05da['message'],_0xd78a4c);_0x14f0a1(_0x15d62b[_0x995a('0x19')](0x1f4,_0xae05da[_0x995a('0x1a')]));});});};exports['ShowMailAccount']=function(_0x5d59e3){var _0x1b2b1d=this;return new Promise(function(_0xde9936,_0x58cd38){return db[_0x995a('0x1d')][_0x995a('0x26')]({'raw':_0x5d59e3[_0x995a('0x1e')]?_0x5d59e3[_0x995a('0x1e')][_0x995a('0x27')]===undefined?!![]:![]:!![],'where':_0x5d59e3[_0x995a('0x1e')]?_0x5d59e3[_0x995a('0x1e')][_0x995a('0x1f')]||null:null,'attributes':_0x5d59e3[_0x995a('0x1e')]?_0x5d59e3[_0x995a('0x1e')][_0x995a('0x24')]||null:null,'include':_0x5d59e3[_0x995a('0x1e')]?_0x5d59e3['options'][_0x995a('0x21')]?_[_0x995a('0x22')](_0x5d59e3[_0x995a('0x1e')][_0x995a('0x21')],function(_0x2571af){return{'model':db[_0x2571af['model']],'as':_0x2571af['as'],'attributes':_0x2571af[_0x995a('0x24')],'include':_0x2571af[_0x995a('0x21')]?_['map'](_0x2571af[_0x995a('0x21')],function(_0x5afe4a){return{'model':db[_0x5afe4a[_0x995a('0x23')]],'as':_0x5afe4a['as'],'attributes':_0x5afe4a['attributes'],'include':_0x5afe4a[_0x995a('0x21')]?_[_0x995a('0x22')](_0x5afe4a[_0x995a('0x21')],function(_0x23c728){return{'model':db[_0x23c728[_0x995a('0x23')]],'as':_0x23c728['as'],'attributes':_0x23c728[_0x995a('0x24')]};}):[]};}):[]};}):[]:[]})[_0x995a('0x12')](function(_0x34e731){logger[_0x995a('0x13')]('ShowMailAccount',_0x5d59e3);logger[_0x995a('0x16')](_0x995a('0x28'),_0x5d59e3,JSON[_0x995a('0x18')](_0x34e731));_0xde9936(_0x34e731);})[_0x995a('0x1c')](function(_0x3025c4){logger[_0x995a('0x19')]('ShowMailAccount',_0x3025c4['message'],_0x5d59e3);_0x58cd38(_0x1b2b1d[_0x995a('0x19')](0x1f4,_0x3025c4[_0x995a('0x1a')]));});});};exports[_0x995a('0x29')]=function(_0x1a5353){var _0x37648d=this;return new Promise(function(_0x5a93f3,_0x1699c2){var _0x55d554={'body':_0x1a5353[_0x995a('0x2a')],'channel':_0x995a('0x2b')};var _0x3e0da6=_[_0x995a('0x2c')](_[_0x995a('0x2d')](db[_0x995a('0x2e')][_0x995a('0x2f')]),[_0x995a('0x30'),_0x995a('0x31'),'CompanyId',_0x995a('0x32')]);var _0x4e2b0a=![];if(_0x1a5353[_0x995a('0x2a')]['id']){delete _0x1a5353['body']['id'];}if(_[_0x995a('0x33')](_0x1a5353[_0x995a('0x2a')][_0x995a('0x34')])){return _0x1699c2(_0x37648d[_0x995a('0x19')](0x1f4,_0x995a('0x35')));}if(_[_0x995a('0x33')](_0x1a5353[_0x995a('0x2a')]['body'])||_0x1a5353[_0x995a('0x2a')][_0x995a('0x2a')]===''){return _0x1699c2(_0x37648d['error'](0x1f4,_0x995a('0x36')));}if(_[_0x995a('0x33')](_0x1a5353[_0x995a('0x2a')][_0x995a('0x37')])){return _0x1699c2(_0x37648d['error'](0x1f4,_0x995a('0x38')+_0x3e0da6));}if(!_[_0x995a('0x39')](_0x3e0da6,_0x1a5353['body'][_0x995a('0x37')])){return _0x1699c2(_0x37648d[_0x995a('0x19')](0x1f4,_0x995a('0x3a')+_0x3e0da6));}var _0x2239b3={};_0x2239b3[_0x1a5353[_0x995a('0x2a')][_0x995a('0x37')]]=_0x1a5353[_0x995a('0x2a')][_0x995a('0x34')];return db['MailAccount'][_0x995a('0x26')]({'where':{'id':_0x1a5353['account']['id']},'include':[{'model':db[_0x995a('0x3b')],'as':_0x995a('0x3c'),'include':[{'model':db['CmContact'],'as':_0x995a('0x3d'),'where':_0x2239b3,'limit':0x1,'order':[[_0x995a('0x31'),_0x995a('0x3e')]]}]},{'model':db[_0x995a('0x3f')],'as':_0x995a('0x40')},{'model':db['MailServerOut'],'as':_0x995a('0x41')}]})['then'](function(_0x3fed58){if(_0x3fed58&&_0x3fed58[_0x995a('0x3c')]){var _0x29e3aa=_0x3fed58[_0x995a('0x42')]({'plain':!![]});_0x55d554[_0x995a('0x43')]=_['omit'](_0x29e3aa,[_0x995a('0x40'),_0x995a('0x3c')]);_0x55d554[_0x995a('0x44')]=_0x29e3aa[_0x995a('0x40')];_0x55d554[_0x995a('0x45')]=_0x29e3aa['List'];_0x55d554[_0x995a('0x44')]=_[_0x995a('0x46')](_0x55d554[_0x995a('0x44')],['priority'],[_0x995a('0x47')]);if(_0x55d554[_0x995a('0x43')]&&_0x55d554[_0x995a('0x43')][_0x995a('0x48')]){_0x55d554['applications']['push']({'id':0x0,'priority':_0x55d554['applications'][_0x995a('0x49')]+0x1,'app':'close','appdata':_0x995a('0x48'),'interval':'*,*,*,*'});}if(_0x55d554['account'][_0x995a('0x40')]){delete _0x55d554['account'][_0x995a('0x40')];}if(_0x55d554[_0x995a('0x43')][_0x995a('0x3c')]){delete _0x55d554[_0x995a('0x43')][_0x995a('0x3c')];}if(_0x29e3aa['List'][_0x995a('0x3d')]['length']){return _0x29e3aa['List'][_0x995a('0x3d')][0x0];}var _0x514dff=_['defaults'](_0x1a5353[_0x995a('0x2a')],{'firstName':_0x1a5353[_0x995a('0x2a')][_0x995a('0x34')],'ListId':_0x29e3aa[_0x995a('0x32')]});_0x514dff[_0x1a5353[_0x995a('0x2a')][_0x995a('0x37')]]=_0x1a5353['body'][_0x995a('0x34')];return db['CmContact']['create'](_0x514dff);}else{throw new Error(_0x995a('0x4a'));}})['then'](function(_0x342ab2){_0x55d554[_0x995a('0x4b')]=_0x342ab2;if(_0x342ab2){if(!_0x1a5353[_0x995a('0x2a')]['message'][_0x995a('0x4c')]){_0x1a5353[_0x995a('0x2a')]['message'][_0x995a('0x4c')]=rs['generate']()+'\x20'+_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x34')];}var _0x10f455={'ContactId':_0x342ab2['id'],'MailAccountId':_0x1a5353[_0x995a('0x43')]['id'],'inReplyTo':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x4c')],'to':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x34')],'cc':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')]['cc'],'subject':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x4d')],'attach':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x4e')],'lastMsgAt':moment()[_0x995a('0x4f')](_0x995a('0x50')),'lastMsgDirection':'in'};return db[_0x995a('0x51')][_0x995a('0x26')]({'where':{'closed':![],'MailAccountId':_0x1a5353[_0x995a('0x43')]['id']},'include':[{'model':db[_0x995a('0x52')],'as':_0x995a('0x53'),'attributes':[_0x995a('0x4c')],'where':{'messageId':_0x1a5353[_0x995a('0x2a')]['message'][_0x995a('0x54')]}}]})['then'](function(_0x2315bb){if(_0x2315bb){return[_0x2315bb,![]];}return db[_0x995a('0x51')][_0x995a('0x55')](_0x10f455)['then'](function(_0x2c6264){return[_0x2c6264,!![]];});});}else{throw new Error(_0x995a('0x56'));}})[_0x995a('0x57')](function(_0x11befd,_0xd9a52f){if(_0x11befd){_0x4e2b0a=_0xd9a52f;if(!_0xd9a52f){return _0x11befd['update']({'inReplyTo':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')]['messageId'],'to':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')]['from'],'cc':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')]['cc'],'subject':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x4d')],'attach':_0x11befd[_0x995a('0x4e')]?_0x11befd[_0x995a('0x4e')]:_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x4e')],'substatus':null,'substatusAt':moment()['format'](_0x995a('0x50')),'lastMsgAt':moment()[_0x995a('0x4f')](_0x995a('0x50')),'lastMsgDirection':'in'});}else{return _0x11befd;}}})[_0x995a('0x12')](function(_0x1399cb){_0x55d554[_0x995a('0x58')]=_0x1399cb[_0x995a('0x42')]({'plain':!![]});_0x55d554[_0x995a('0x58')][_0x995a('0x59')]=_0x4e2b0a;return db[_0x995a('0x52')][_0x995a('0x55')]({'body':_0x1a5353['body'][_0x995a('0x2a')],'MailAccountId':_0x1a5353['account']['id'],'MailInteractionId':_0x1399cb['id'],'direction':'in','ContactId':_0x55d554[_0x995a('0x4b')]['id'],'messageId':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')]['messageId'],'from':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x34')],'to':_0x1a5353['body']['message']['to'],'cc':_0x1a5353[_0x995a('0x2a')]['message']['cc'],'subject':_0x1a5353[_0x995a('0x2a')]['message']['subject'],'attach':_0x1a5353['body']['message'][_0x995a('0x4e')],'Attachments':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x5a')],'originTo':_0x1a5353['body'][_0x995a('0x1a')][_0x995a('0x5b')],'originCc':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')][_0x995a('0x5c')],'bcc':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')]['bcc'],'ChatWebsiteId':_0x1a5353[_0x995a('0x2a')][_0x995a('0x1a')]['ChatWebsiteId']||null,'originChannel':_0x1a5353['body'][_0x995a('0x1a')]['originChannel']||_0x995a('0x5d'),'ChatOfflineMessageId':_0x1a5353[_0x995a('0x2a')]['message']['ChatOfflineMessageId']||null},{'include':[{'model':db['Attachment'],'as':_0x995a('0x5e')}]});})['then'](function(_0x37429e){_0x55d554[_0x995a('0x1a')]=_0x37429e;if(_0x55d554[_0x995a('0x58')][_0x995a('0x5f')]){return db[_0x995a('0x60')][_0x995a('0x26')]({'attributes':['id',_0x995a('0x61')],'where':{'id':_0x55d554[_0x995a('0x58')][_0x995a('0x5f')]}})[_0x995a('0x12')](function(_0x5a2500){if(_0x5a2500){_0x55d554['applications']['unshift']({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x5a2500[_0x995a('0x61')]+','+(_0x55d554[_0x995a('0x43')][_0x995a('0x62')]||0xa),'interval':_0x995a('0x63')});}return respondWithRpcPromise(_0x995a('0x64'),_0x995a('0x65'),_0x55d554);});}return respondWithRpcPromise(_0x995a('0x64'),_0x995a('0x65'),_0x55d554);})['then'](function(_0x922dbc){_0x5a93f3(_0x922dbc);})[_0x995a('0x1c')](function(_0x1f1c81){_0x1699c2(_0x37648d[_0x995a('0x19')](0x1f4,_0x1f1c81['message']));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index df13ec6..50a8801 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 _0x3a6e=['removeListener','register','mailAccount:','save'];(function(_0x419238,_0x16d478){var _0x46d643=function(_0x2136f3){while(--_0x2136f3){_0x419238['push'](_0x419238['shift']());}};_0x46d643(++_0x16d478);}(_0x3a6e,0x143));var _0xe3a6=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x3a6e[_0x42cae2];return _0x5f256f;};'use strict';var MailAccountEvents=require('./mailAccount.events');var events=[_0xe3a6('0x0'),'remove','update'];function createListener(_0x247ea8,_0x34b5bd){return function(_0x2ed5a7){_0x34b5bd['emit'](_0x247ea8,_0x2ed5a7);};}function removeListener(_0x150eaa,_0x2607a3){return function(){MailAccountEvents[_0xe3a6('0x1')](_0x150eaa,_0x2607a3);};}exports[_0xe3a6('0x2')]=function(_0x2f0174){for(var _0x5bfce5=0x0,_0x4d4fc2=events['length'];_0x5bfce5<_0x4d4fc2;_0x5bfce5++){var _0x5ad041=events[_0x5bfce5];var _0x297523=createListener(_0xe3a6('0x3')+_0x5ad041,_0x2f0174);MailAccountEvents['on'](_0x5ad041,_0x297523);}}; \ No newline at end of file +var _0x0e3e=['register','length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x2af9f4,_0x3121c0){var _0xc69f8=function(_0x4695df){while(--_0x4695df){_0x2af9f4['push'](_0x2af9f4['shift']());}};_0xc69f8(++_0x3121c0);}(_0x0e3e,0x143));var _0xe0e3=function(_0xcb2a4d,_0x78ac9b){_0xcb2a4d=_0xcb2a4d-0x0;var _0x31e81d=_0x0e3e[_0xcb2a4d];return _0x31e81d;};'use strict';var MailAccountEvents=require(_0xe0e3('0x0'));var events=[_0xe0e3('0x1'),_0xe0e3('0x2'),_0xe0e3('0x3')];function createListener(_0x309679,_0x21a124){return function(_0x3c4d9d){_0x21a124[_0xe0e3('0x4')](_0x309679,_0x3c4d9d);};}function removeListener(_0x50ba69,_0x366996){return function(){MailAccountEvents['removeListener'](_0x50ba69,_0x366996);};}exports[_0xe0e3('0x5')]=function(_0x2c2f0e){for(var _0x1011fb=0x0,_0x911c8b=events[_0xe0e3('0x6')];_0x1011fb<_0x911c8b;_0x1011fb++){var _0x3405c6=events[_0x1011fb];var _0x40972e=createListener(_0xe0e3('0x7')+_0x3405c6,_0x2c2f0e);MailAccountEvents['on'](_0x3405c6,_0x40972e);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index 37254e9..1a2421e 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 _0x87c4=['show','update','delete','destroy','multer','util','connect-timeout','express','../../components/auth/service','../../components/interaction/service','get','/:id','isAuthenticated'];(function(_0x27d539,_0x134021){var _0x179170=function(_0x7bfcba){while(--_0x7bfcba){_0x27d539['push'](_0x27d539['shift']());}};_0x179170(++_0x134021);}(_0x87c4,0x1a4));var _0x487c=function(_0x4f3ee8,_0xd8ce1a){_0x4f3ee8=_0x4f3ee8-0x0;var _0x3b5508=_0x87c4[_0x4f3ee8];return _0x3b5508;};'use strict';var multer=require(_0x487c('0x0'));var util=require(_0x487c('0x1'));var path=require('path');var timeout=require(_0x487c('0x2'));var express=require(_0x487c('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x487c('0x4'));var interaction=require(_0x487c('0x5'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router[_0x487c('0x6')](_0x487c('0x7'),auth[_0x487c('0x8')](),controller[_0x487c('0x9')]);router['put'](_0x487c('0x7'),auth['isAuthenticated'](),controller[_0x487c('0xa')]);router[_0x487c('0xb')]('/:id',auth[_0x487c('0x8')](),controller[_0x487c('0xc')]);module['exports']=router; \ No newline at end of file +var _0x0576=['util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','/:id','show','put','update','delete','isAuthenticated','destroy','exports'];(function(_0x42a64e,_0x1abef5){var _0x3d0f2b=function(_0x32d544){while(--_0x32d544){_0x42a64e['push'](_0x42a64e['shift']());}};_0x3d0f2b(++_0x1abef5);}(_0x0576,0x1ef));var _0x6057=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x0576[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x6057('0x0'));var path=require('path');var timeout=require(_0x6057('0x1'));var express=require(_0x6057('0x2'));var router=express[_0x6057('0x3')]();var fs_extra=require(_0x6057('0x4'));var auth=require(_0x6057('0x5'));var interaction=require(_0x6057('0x6'));var config=require('../../config/environment');var controller=require('./mailApplication.controller');router['get'](_0x6057('0x7'),auth['isAuthenticated'](),controller[_0x6057('0x8')]);router[_0x6057('0x9')](_0x6057('0x7'),auth['isAuthenticated'](),controller[_0x6057('0xa')]);router[_0x6057('0xb')](_0x6057('0x7'),auth[_0x6057('0xc')](),controller[_0x6057('0xd')]);module[_0x6057('0xe')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 7417cb5..19f5b97 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 _0x5658=['STRING','noop','TEXT','exports','INTEGER'];(function(_0x61c7ca,_0x7d345e){var _0xc75428=function(_0x3e9e80){while(--_0x3e9e80){_0x61c7ca['push'](_0x61c7ca['shift']());}};_0xc75428(++_0x7d345e);}(_0x5658,0x1ca));var _0x8565=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5658[_0x122ef9];return _0x42fba0;};'use strict';var Sequelize=require('sequelize');module[_0x8565('0x0')]={'priority':{'type':Sequelize[_0x8565('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x8565('0x2')],'allowNull':![],'defaultValue':_0x8565('0x3')},'appdata':{'type':Sequelize[_0x8565('0x4')]()},'description':{'type':Sequelize[_0x8565('0x2')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x2aef=['noop','*,*,*,*','sequelize','INTEGER','STRING'];(function(_0x5670f4,_0x2c2c31){var _0x2afcf1=function(_0x279fe4){while(--_0x279fe4){_0x5670f4['push'](_0x5670f4['shift']());}};_0x2afcf1(++_0x2c2c31);}(_0x2aef,0x1f1));var _0xf2ae=function(_0x12fe86,_0x57ec8d){_0x12fe86=_0x12fe86-0x0;var _0x3c528b=_0x2aef[_0x12fe86];return _0x3c528b;};'use strict';var Sequelize=require(_0xf2ae('0x0'));module['exports']={'priority':{'type':Sequelize[_0xf2ae('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0xf2ae('0x2')],'allowNull':![],'defaultValue':_0xf2ae('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0xf2ae('0x2')]},'interval':{'type':Sequelize[_0xf2ae('0x2')],'defaultValue':_0xf2ae('0x4')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 3fd2d02..ed933f7 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 _0x54ef=['api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','update','then','destroy','error','name','show','params','model','rawAttributes','query','keys','filters','intersection','attributes','fields','length','merge','options','MailApplication','find','body','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger'];(function(_0x12b0d0,_0x4681b1){var _0x24e13e=function(_0x47fc87){while(--_0x47fc87){_0x12b0d0['push'](_0x12b0d0['shift']());}};_0x24e13e(++_0x4681b1);}(_0x54ef,0x112));var _0xf54e=function(_0x4043c8,_0x29d1fb){_0x4043c8=_0x4043c8-0x0;var _0x24d750=_0x54ef[_0x4043c8];return _0x24d750;};'use strict';var emlformat=require(_0xf54e('0x0'));var rimraf=require(_0xf54e('0x1'));var zipdir=require(_0xf54e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf54e('0x3'));var moment=require(_0xf54e('0x4'));var BPromise=require(_0xf54e('0x5'));var Mustache=require(_0xf54e('0x6'));var util=require(_0xf54e('0x7'));var path=require(_0xf54e('0x8'));var sox=require(_0xf54e('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf54e('0xa'));var _=require(_0xf54e('0xb'));var squel=require(_0xf54e('0xc'));var crypto=require('crypto');var jsforce=require(_0xf54e('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf54e('0xe'));var querystring=require(_0xf54e('0xf'));var Papa=require('papaparse');var Redis=require(_0xf54e('0x10'));var authService=require(_0xf54e('0x11'));var qs=require(_0xf54e('0x12'));var as=require(_0xf54e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf54e('0x14'))(_0xf54e('0x15'));var utils=require(_0xf54e('0x16'));var config=require(_0xf54e('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf54e('0x18'))['db'];function respondWithStatusCode(_0x4b0ee1,_0x4bd828){_0x4bd828=_0x4bd828||0xcc;return function(_0x15a9d4){if(_0x15a9d4){return _0x4b0ee1[_0xf54e('0x19')](_0x4bd828);}return _0x4b0ee1[_0xf54e('0x1a')](_0x4bd828)[_0xf54e('0x1b')]();};}function respondWithResult(_0x5644aa,_0x331732){_0x331732=_0x331732||0xc8;return function(_0x1bbeaa){if(_0x1bbeaa){return _0x5644aa[_0xf54e('0x1a')](_0x331732)[_0xf54e('0x1c')](_0x1bbeaa);}};}function respondWithFilteredResult(_0x56828e,_0x2366ee){return function(_0x389abc){if(_0x389abc){var _0x3eb415=typeof _0x2366ee['offset']==='undefined'&&typeof _0x2366ee[_0xf54e('0x1d')]===_0xf54e('0x1e');var _0x1c02e7=_0x389abc[_0xf54e('0x1f')];var _0x15cc48=_0x3eb415?0x0:_0x2366ee[_0xf54e('0x20')];var _0x2e27b6=_0x3eb415?_0x389abc[_0xf54e('0x1f')]:_0x2366ee[_0xf54e('0x20')]+_0x2366ee[_0xf54e('0x1d')];var _0x226c96;if(_0x2e27b6>=_0x1c02e7){_0x2e27b6=_0x1c02e7;_0x226c96=0xc8;}else{_0x226c96=0xce;}_0x56828e['status'](_0x226c96);return _0x56828e['set'](_0xf54e('0x21'),_0x15cc48+'-'+_0x2e27b6+'/'+_0x1c02e7)['json'](_0x389abc);}return null;};}function patchUpdates(_0x3e1556){return function(_0x1bfe99){try{jsonpatch[_0xf54e('0x22')](_0x1bfe99,_0x3e1556,!![]);}catch(_0x9903fc){return BPromise[_0xf54e('0x23')](_0x9903fc);}return _0x1bfe99[_0xf54e('0x24')]();};}function saveUpdates(_0x388aa0,_0x11985e){return function(_0x3c0169){if(_0x3c0169){return _0x3c0169[_0xf54e('0x25')](_0x388aa0)[_0xf54e('0x26')](function(_0x5b83df){return _0x5b83df;});}return null;};}function removeEntity(_0x6f6d29,_0x54f914){return function(_0x264a8f){if(_0x264a8f){return _0x264a8f[_0xf54e('0x27')]()[_0xf54e('0x26')](function(){_0x6f6d29[_0xf54e('0x1a')](0xcc)[_0xf54e('0x1b')]();});}};}function handleEntityNotFound(_0x160160,_0x1e08d1){return function(_0x43488d){if(!_0x43488d){_0x160160[_0xf54e('0x19')](0x194);}return _0x43488d;};}function handleError(_0x33457f,_0xf6cdd7){_0xf6cdd7=_0xf6cdd7||0x1f4;return function(_0x39c0ae){logger[_0xf54e('0x28')](_0x39c0ae['stack']);if(_0x39c0ae[_0xf54e('0x29')]){delete _0x39c0ae['name'];}_0x33457f[_0xf54e('0x1a')](_0xf6cdd7)['send'](_0x39c0ae);};}exports[_0xf54e('0x2a')]=function(_0x269f47,_0x21ba00){var _0xa13cd0={'raw':!![],'where':{'id':_0x269f47[_0xf54e('0x2b')]['id']}},_0x25b643={};_0x25b643[_0xf54e('0x2c')]=_['keys'](db['MailApplication'][_0xf54e('0x2d')]);_0x25b643[_0xf54e('0x2e')]=_[_0xf54e('0x2f')](_0x269f47[_0xf54e('0x2e')]);_0x25b643[_0xf54e('0x30')]=_[_0xf54e('0x31')](_0x25b643[_0xf54e('0x2c')],_0x25b643[_0xf54e('0x2e')]);_0xa13cd0[_0xf54e('0x32')]=_[_0xf54e('0x31')](_0x25b643['model'],qs['fields'](_0x269f47[_0xf54e('0x2e')][_0xf54e('0x33')]));_0xa13cd0['attributes']=_0xa13cd0[_0xf54e('0x32')][_0xf54e('0x34')]?_0xa13cd0[_0xf54e('0x32')]:_0x25b643[_0xf54e('0x2c')];if(_0x269f47['query']['includeAll']){_0xa13cd0['include']=[{'all':!![]}];}_0xa13cd0=_[_0xf54e('0x35')]({},_0xa13cd0,_0x269f47[_0xf54e('0x36')]);return db[_0xf54e('0x37')][_0xf54e('0x38')](_0xa13cd0)[_0xf54e('0x26')](handleEntityNotFound(_0x21ba00,null))[_0xf54e('0x26')](respondWithResult(_0x21ba00,null))['catch'](handleError(_0x21ba00,null));};exports['update']=function(_0x530cee,_0xc04e04){if(_0x530cee[_0xf54e('0x39')]['id']){delete _0x530cee['body']['id'];}return db['MailApplication'][_0xf54e('0x38')]({'where':{'id':_0x530cee[_0xf54e('0x2b')]['id']}})[_0xf54e('0x26')](handleEntityNotFound(_0xc04e04,null))['then'](saveUpdates(_0x530cee[_0xf54e('0x39')],null))[_0xf54e('0x26')](respondWithResult(_0xc04e04,null))['catch'](handleError(_0xc04e04,null));};exports[_0xf54e('0x27')]=function(_0x6e5bdf,_0x5af03){return db[_0xf54e('0x37')][_0xf54e('0x38')]({'where':{'id':_0x6e5bdf[_0xf54e('0x2b')]['id']}})['then'](handleEntityNotFound(_0x5af03,null))['then'](removeEntity(_0x5af03,null))[_0xf54e('0x3a')](handleError(_0x5af03,null));}; \ No newline at end of file +var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x10082f,_0x473489){var _0x48820b=function(_0x29b667){while(--_0x29b667){_0x10082f['push'](_0x10082f['shift']());}};_0x48820b(++_0x473489);}(_0xac4a,0x13f));var _0xaac4=function(_0x1331b9,_0x574ddf){_0x1331b9=_0x1331b9-0x0;var _0x19e217=_0xac4a[_0x1331b9];return _0x19e217;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index 1532148..2d8811b 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 _0xa1cc=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','mail_applications','utf8mb4_unicode_ci'];(function(_0x295dad,_0x17621a){var _0xe81b3a=function(_0x421844){while(--_0x421844){_0x295dad['push'](_0x295dad['shift']());}};_0xe81b3a(++_0x17621a);}(_0xa1cc,0x108));var _0xca1c=function(_0x1a5a66,_0x5140c0){_0x1a5a66=_0x1a5a66-0x0;var _0x355a5a=_0xa1cc[_0x1a5a66];return _0x355a5a;};'use strict';var _=require('lodash');var util=require(_0xca1c('0x0'));var logger=require('../../config/logger')(_0xca1c('0x1'));var moment=require(_0xca1c('0x2'));var BPromise=require(_0xca1c('0x3'));var rp=require(_0xca1c('0x4'));var fs=require('fs');var path=require(_0xca1c('0x5'));var rimraf=require(_0xca1c('0x6'));var config=require(_0xca1c('0x7'));var attributes=require('./mailApplication.attributes');module[_0xca1c('0x8')]=function(_0x42c796,_0x5622e9){return _0x42c796[_0xca1c('0x9')]('MailApplication',attributes,{'tableName':_0xca1c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xca1c('0xb')});}; \ No newline at end of file +var _0x3998=['api','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','define','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x5eec8d,_0x2d3a63){var _0x2ef767=function(_0x96ee9b){while(--_0x96ee9b){_0x5eec8d['push'](_0x5eec8d['shift']());}};_0x2ef767(++_0x2d3a63);}(_0x3998,0x129));var _0x8399=function(_0x4a8b40,_0x1e8e57){_0x4a8b40=_0x4a8b40-0x0;var _0x57fb6f=_0x3998[_0x4a8b40];return _0x57fb6f;};'use strict';var _=require(_0x8399('0x0'));var util=require(_0x8399('0x1'));var logger=require(_0x8399('0x2'))(_0x8399('0x3'));var moment=require('moment');var BPromise=require(_0x8399('0x4'));var rp=require(_0x8399('0x5'));var fs=require('fs');var path=require(_0x8399('0x6'));var rimraf=require(_0x8399('0x7'));var config=require(_0x8399('0x8'));var attributes=require(_0x8399('0x9'));module['exports']=function(_0x465c1f,_0x2123a8){return _0x465c1f[_0x8399('0xa')]('MailApplication',attributes,{'tableName':'mail_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x8399('0xb')});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 617ea14..de97197 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 _0x26fb=['http','request','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','MailApplication','update','body','options','where','limit','then','UpdateMailApplication','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client'];(function(_0xf3c3f8,_0x275cec){var _0x38c047=function(_0x12266c){while(--_0x12266c){_0xf3c3f8['push'](_0xf3c3f8['shift']());}};_0x38c047(++_0x275cec);}(_0x26fb,0x1f4));var _0xb26f=function(_0x9ca21f,_0x437553){_0x9ca21f=_0x9ca21f-0x0;var _0x9ef54b=_0x26fb[_0x9ca21f];return _0x9ef54b;};'use strict';var _=require(_0xb26f('0x0'));var util=require(_0xb26f('0x1'));var moment=require(_0xb26f('0x2'));var BPromise=require(_0xb26f('0x3'));var rs=require(_0xb26f('0x4'));var fs=require('fs');var Redis=require(_0xb26f('0x5'));var db=require(_0xb26f('0x6'))['db'];var utils=require(_0xb26f('0x7'));var logger=require('../../config/logger')(_0xb26f('0x8'));var config=require(_0xb26f('0x9'));var jayson=require(_0xb26f('0xa'));var client=jayson[_0xb26f('0xb')][_0xb26f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x580710,_0x3f5bdd,_0x21f94b){return new BPromise(function(_0x41c278,_0x51277f){return client[_0xb26f('0xd')](_0x580710,_0x21f94b)['then'](function(_0x11f0d9){logger[_0xb26f('0xe')](_0xb26f('0xf'),_0x3f5bdd,_0xb26f('0x10'));logger[_0xb26f('0x11')](_0xb26f('0x12'),_0x3f5bdd,_0xb26f('0x10'),JSON[_0xb26f('0x13')](_0x11f0d9));if(_0x11f0d9[_0xb26f('0x14')]){if(_0x11f0d9[_0xb26f('0x14')][_0xb26f('0x15')]===0x1f4){logger[_0xb26f('0x14')](_0xb26f('0xf'),_0x3f5bdd,_0x11f0d9[_0xb26f('0x14')]['message']);return _0x51277f(_0x11f0d9[_0xb26f('0x14')][_0xb26f('0x16')]);}logger[_0xb26f('0x14')](_0xb26f('0xf'),_0x3f5bdd,_0x11f0d9[_0xb26f('0x14')][_0xb26f('0x16')]);return _0x41c278(_0x11f0d9[_0xb26f('0x14')]['message']);}else{logger['info'](_0xb26f('0xf'),_0x3f5bdd,_0xb26f('0x10'));_0x41c278(_0x11f0d9[_0xb26f('0x17')][_0xb26f('0x16')]);}})['catch'](function(_0x449149){logger[_0xb26f('0x14')]('MailApplication,\x20%s,\x20%s',_0x3f5bdd,_0x449149);_0x51277f(_0x449149);});});}exports['UpdateMailApplication']=function(_0x233344){var _0x229434=this;return new Promise(function(_0x50fd0b,_0x325f3f){return db[_0xb26f('0x18')][_0xb26f('0x19')](_0x233344[_0xb26f('0x1a')],{'raw':_0x233344['options']?_0x233344[_0xb26f('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x233344[_0xb26f('0x1b')]?_0x233344[_0xb26f('0x1b')][_0xb26f('0x1c')]||null:null,'attributes':_0x233344['options']?_0x233344[_0xb26f('0x1b')]['attributes']||null:null,'limit':_0x233344[_0xb26f('0x1b')]?_0x233344['options'][_0xb26f('0x1d')]||null:null})[_0xb26f('0x1e')](function(_0xe5a5a4){logger['info'](_0xb26f('0x1f'),_0x233344);logger[_0xb26f('0x11')](_0xb26f('0x1f'),_0x233344,JSON[_0xb26f('0x13')](_0xe5a5a4));_0x50fd0b(_0xe5a5a4);})['catch'](function(_0x2d2ec7){logger[_0xb26f('0x14')](_0xb26f('0x1f'),_0x2d2ec7[_0xb26f('0x16')],_0x233344);_0x325f3f(_0x229434[_0xb26f('0x14')](0x1f4,_0x2d2ec7['message']));});});}; \ No newline at end of file +var _0x0774=['result','catch','options','raw','limit','UpdateMailApplication','lodash','moment','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','MailApplication,\x20%s,\x20%s','message','info'];(function(_0x10ade5,_0x5411c0){var _0x29f42f=function(_0x573c58){while(--_0x573c58){_0x10ade5['push'](_0x10ade5['shift']());}};_0x29f42f(++_0x5411c0);}(_0x0774,0x126));var _0x4077=function(_0x776a8a,_0x28eee0){_0x776a8a=_0x776a8a-0x0;var _0x3f2882=_0x0774[_0x776a8a];return _0x3f2882;};'use strict';var _=require(_0x4077('0x0'));var util=require('util');var moment=require(_0x4077('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4077('0x2'))['db'];var utils=require(_0x4077('0x3'));var logger=require('../../config/logger')(_0x4077('0x4'));var config=require('../../config/environment');var jayson=require(_0x4077('0x5'));var client=jayson[_0x4077('0x6')][_0x4077('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37416f,_0x480ea5,_0x48b363){return new BPromise(function(_0xbbd8c3,_0x364103){return client['request'](_0x37416f,_0x48b363)[_0x4077('0x8')](function(_0x3e6784){logger['info']('MailApplication,\x20%s,\x20%s',_0x480ea5,_0x4077('0x9'));logger[_0x4077('0xa')](_0x4077('0xb'),_0x480ea5,'request\x20sent',JSON[_0x4077('0xc')](_0x3e6784));if(_0x3e6784[_0x4077('0xd')]){if(_0x3e6784['error'][_0x4077('0xe')]===0x1f4){logger['error'](_0x4077('0xf'),_0x480ea5,_0x3e6784[_0x4077('0xd')]['message']);return _0x364103(_0x3e6784[_0x4077('0xd')][_0x4077('0x10')]);}logger['error'](_0x4077('0xf'),_0x480ea5,_0x3e6784[_0x4077('0xd')][_0x4077('0x10')]);return _0xbbd8c3(_0x3e6784['error'][_0x4077('0x10')]);}else{logger[_0x4077('0x11')]('MailApplication,\x20%s,\x20%s',_0x480ea5,_0x4077('0x9'));_0xbbd8c3(_0x3e6784[_0x4077('0x12')][_0x4077('0x10')]);}})[_0x4077('0x13')](function(_0x1c4753){logger[_0x4077('0xd')](_0x4077('0xf'),_0x480ea5,_0x1c4753);_0x364103(_0x1c4753);});});}exports['UpdateMailApplication']=function(_0x2b88ac){var _0x374afa=this;return new Promise(function(_0x5e1526,_0x2a55f4){return db['MailApplication']['update'](_0x2b88ac['body'],{'raw':_0x2b88ac[_0x4077('0x14')]?_0x2b88ac[_0x4077('0x14')][_0x4077('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b88ac[_0x4077('0x14')]?_0x2b88ac[_0x4077('0x14')]['where']||null:null,'attributes':_0x2b88ac[_0x4077('0x14')]?_0x2b88ac[_0x4077('0x14')]['attributes']||null:null,'limit':_0x2b88ac[_0x4077('0x14')]?_0x2b88ac[_0x4077('0x14')][_0x4077('0x16')]||null:null})[_0x4077('0x8')](function(_0x1afbf4){logger[_0x4077('0x11')]('UpdateMailApplication',_0x2b88ac);logger[_0x4077('0xa')](_0x4077('0x17'),_0x2b88ac,JSON['stringify'](_0x1afbf4));_0x5e1526(_0x1afbf4);})[_0x4077('0x13')](function(_0xf583ca){logger['error']('UpdateMailApplication',_0xf583ca[_0x4077('0x10')],_0x2b88ac);_0x2a55f4(_0x374afa[_0x4077('0xd')](0x1f4,_0xf583ca[_0x4077('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index a30db88..ace5760 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 _0xdfad=['/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','post','/:id/tags','tracked','mail','addTags','put','mailinteraction:update','update','delete','destroy','removeTags','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailInteraction.controller','get','isAuthenticated','index'];(function(_0x1c1987,_0x24441a){var _0x1dbef5=function(_0x3cb10a){while(--_0x3cb10a){_0x1c1987['push'](_0x1c1987['shift']());}};_0x1dbef5(++_0x24441a);}(_0xdfad,0xd3));var _0xddfa=function(_0x29d2d2,_0x3344){_0x29d2d2=_0x29d2d2-0x0;var _0x3f6476=_0xdfad[_0x29d2d2];return _0x3f6476;};'use strict';var multer=require('multer');var util=require(_0xddfa('0x0'));var path=require(_0xddfa('0x1'));var timeout=require(_0xddfa('0x2'));var express=require(_0xddfa('0x3'));var router=express[_0xddfa('0x4')]();var fs_extra=require(_0xddfa('0x5'));var auth=require(_0xddfa('0x6'));var interaction=require(_0xddfa('0x7'));var config=require(_0xddfa('0x8'));var controller=require(_0xddfa('0x9'));router[_0xddfa('0xa')]('/',auth[_0xddfa('0xb')](),controller[_0xddfa('0xc')]);router[_0xddfa('0xa')](_0xddfa('0xd'),auth[_0xddfa('0xb')](),controller[_0xddfa('0xe')]);router[_0xddfa('0xa')](_0xddfa('0xf'),auth[_0xddfa('0xb')](),controller[_0xddfa('0x10')]);router[_0xddfa('0xa')](_0xddfa('0x11'),auth['isAuthenticated'](),controller[_0xddfa('0x12')]);router['get'](_0xddfa('0x13'),auth[_0xddfa('0xb')](),controller['download']);router[_0xddfa('0x14')]('/',auth[_0xddfa('0xb')](),controller['create']);router[_0xddfa('0x14')]('/:id/messages',auth[_0xddfa('0xb')](),controller['addMessage']);router[_0xddfa('0x14')](_0xddfa('0x15'),auth[_0xddfa('0xb')](),interaction[_0xddfa('0x16')](_0xddfa('0x17'),'mailinteraction:addtags'),controller[_0xddfa('0x18')]);router[_0xddfa('0x19')](_0xddfa('0xf'),auth['isAuthenticated'](),interaction[_0xddfa('0x16')](_0xddfa('0x17'),_0xddfa('0x1a')),controller[_0xddfa('0x1b')]);router[_0xddfa('0x1c')]('/:id',auth[_0xddfa('0xb')](),interaction[_0xddfa('0x16')]('mail','mailinteraction:destroy'),controller[_0xddfa('0x1d')]);router[_0xddfa('0x1c')]('/:id/tags',auth['isAuthenticated'](),controller[_0xddfa('0x1e')]);module[_0xddfa('0x1f')]=router; \ No newline at end of file +var _0x7eea=['isAuthenticated','index','get','/describe','describe','/:id','show','/:id/messages','getMessages','/:id/download','create','post','/:id/tags','tracked','mail','mailinteraction:addtags','addTags','put','update','delete','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./mailInteraction.controller'];(function(_0x27d899,_0x5b6dfb){var _0x53e638=function(_0x25531e){while(--_0x25531e){_0x27d899['push'](_0x27d899['shift']());}};_0x53e638(++_0x5b6dfb);}(_0x7eea,0x9b));var _0xa7ee=function(_0x32626b,_0x19d9af){_0x32626b=_0x32626b-0x0;var _0x5d0258=_0x7eea[_0x32626b];return _0x5d0258;};'use strict';var multer=require(_0xa7ee('0x0'));var util=require(_0xa7ee('0x1'));var path=require(_0xa7ee('0x2'));var timeout=require(_0xa7ee('0x3'));var express=require(_0xa7ee('0x4'));var router=express[_0xa7ee('0x5')]();var fs_extra=require(_0xa7ee('0x6'));var auth=require(_0xa7ee('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa7ee('0x8'));var controller=require(_0xa7ee('0x9'));router['get']('/',auth[_0xa7ee('0xa')](),controller[_0xa7ee('0xb')]);router[_0xa7ee('0xc')](_0xa7ee('0xd'),auth[_0xa7ee('0xa')](),controller[_0xa7ee('0xe')]);router[_0xa7ee('0xc')](_0xa7ee('0xf'),auth[_0xa7ee('0xa')](),controller[_0xa7ee('0x10')]);router[_0xa7ee('0xc')](_0xa7ee('0x11'),auth[_0xa7ee('0xa')](),controller[_0xa7ee('0x12')]);router[_0xa7ee('0xc')](_0xa7ee('0x13'),auth[_0xa7ee('0xa')](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller[_0xa7ee('0x14')]);router['post'](_0xa7ee('0x11'),auth[_0xa7ee('0xa')](),controller['addMessage']);router[_0xa7ee('0x15')](_0xa7ee('0x16'),auth[_0xa7ee('0xa')](),interaction[_0xa7ee('0x17')](_0xa7ee('0x18'),_0xa7ee('0x19')),controller[_0xa7ee('0x1a')]);router[_0xa7ee('0x1b')](_0xa7ee('0xf'),auth[_0xa7ee('0xa')](),interaction['tracked']('mail','mailinteraction:update'),controller[_0xa7ee('0x1c')]);router[_0xa7ee('0x1d')](_0xa7ee('0xf'),auth['isAuthenticated'](),interaction[_0xa7ee('0x17')](_0xa7ee('0x18'),'mailinteraction:destroy'),controller[_0xa7ee('0x1e')]);router[_0xa7ee('0x1d')](_0xa7ee('0x16'),auth[_0xa7ee('0xa')](),controller[_0xa7ee('0x1f')]);module[_0xa7ee('0x20')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index 0f5b276..2f458b3 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 _0xa215=['BOOLEAN','STRING','long','TEXT','DATE','ENUM','out','sequelize','exports'];(function(_0x2732cf,_0x588a4d){var _0x5436a0=function(_0x57b36f){while(--_0x57b36f){_0x2732cf['push'](_0x2732cf['shift']());}};_0x5436a0(++_0x588a4d);}(_0xa215,0x142));var _0x5a21=function(_0x1c2d01,_0x55590b){_0x1c2d01=_0x1c2d01-0x0;var _0x2fe07e=_0xa215[_0x1c2d01];return _0x2fe07e;};'use strict';var Sequelize=require(_0x5a21('0x0'));var iconv=require('iconv');module[_0x5a21('0x1')]={'closed':{'type':Sequelize[_0x5a21('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x5a21('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x5a21('0x3')]},'note':{'type':Sequelize[_0x5a21('0x3')]},'inReplyTo':{'type':Sequelize[_0x5a21('0x3')](0x1fe)},'to':{'type':Sequelize[_0x5a21('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x5a21('0x4'))},'subject':{'type':Sequelize[_0x5a21('0x5')]()},'attach':{'type':Sequelize[_0x5a21('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0x5a21('0x6')]},'substatus':{'type':Sequelize[_0x5a21('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x5a21('0x6')]},'firstMsgDirection':{'type':Sequelize[_0x5a21('0x7')]('in',_0x5a21('0x8')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x5a21('0x7')]('in',_0x5a21('0x8')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x5a21('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x97db=['BOOLEAN','DATE','STRING','TEXT','ENUM','out','iconv','exports'];(function(_0x218bee,_0x39b858){var _0x4797b0=function(_0x5bc1df){while(--_0x5bc1df){_0x218bee['push'](_0x218bee['shift']());}};_0x4797b0(++_0x39b858);}(_0x97db,0x8e));var _0xb97d=function(_0x3d5619,_0x2449f1){_0x3d5619=_0x3d5619-0x0;var _0x5c0f1d=_0x97db[_0x3d5619];return _0x5c0f1d;};'use strict';var Sequelize=require('sequelize');var iconv=require(_0xb97d('0x0'));module[_0xb97d('0x1')]={'closed':{'type':Sequelize[_0xb97d('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb97d('0x3')]},'disposition':{'type':Sequelize[_0xb97d('0x4')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize[_0xb97d('0x4')](0x1fe)},'to':{'type':Sequelize[_0xb97d('0x4')]},'cc':{'type':Sequelize[_0xb97d('0x5')]('long')},'subject':{'type':Sequelize['TEXT']()},'attach':{'type':Sequelize[_0xb97d('0x2')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb97d('0x3')]},'substatus':{'type':Sequelize[_0xb97d('0x4')](0x3c)},'substatusAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xb97d('0x6')]('in',_0xb97d('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb97d('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xb97d('0x6')]('in',_0xb97d('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb97d('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 530d6f5..0b78f93 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 _0x4904=['i.MailAccountId','i.UserId','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','Setting','findOne','enableEmailPreview','all','includeAll','include','options','create','body','update','params','describe','addMessage','MailMessage','ids','omit','getMessages','hasOwnProperty','$gte','format','YYYY-MM-DD\x20HH:mm:ss','findAll','inlineCss','rows','addTags','setTags','emit','mailInteractionTags:save','removeTags','download','join','root','server','tmp','files','transcript-%d-%s.zip','attachments','Attachments','Messages','get','each','subject','bcc','headers','Bcc','writeFileSync','message%d.eml','log','err','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','html-to-text','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','defaults','localhost','redis','./mailInteraction.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','destroy','error','stack','name','send','Users','map','fullname','Tags','TagIds','forEach','push','out','plainBody','-id','lastMsgText','catch','index','MailInteraction','rawAttributes','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','left_join','users','u.id\x20=\x20ui.UserId','o.id\x20=\x20i.UserId','mail_accounts','mail_messages','me.MailInteractionId\x20=\x20i.id','it.MailInteractionId\x20=\x20i.id','expr','search','conditions','unreadMessages','having','`\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)','value','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','find','ContactId','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','buildExpression','text','some','compact','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','createdAt','parse','$lte','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','group','i.id','Sequelize','SELECT','clone','contactName','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','getMailAccounts','i.MailAccountId\x20IS\x20NULL','sequelize','toString','keyBy','merge','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','a.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','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.subject','i.thirdDisposition','i.substatus','i.ContactId'];(function(_0xc50839,_0x288cfd){var _0x260005=function(_0x49f983){while(--_0x49f983){_0xc50839['push'](_0xc50839['shift']());}};_0x260005(++_0x288cfd);}(_0x4904,0x130));var _0x4490=function(_0x48babe,_0x339725){_0x48babe=_0x48babe-0x0;var _0x385f3d=_0x4904[_0x48babe];return _0x385f3d;};'use strict';var emlformat=require(_0x4490('0x0'));var rimraf=require(_0x4490('0x1'));var zipdir=require(_0x4490('0x2'));var jsonpatch=require(_0x4490('0x3'));var rp=require(_0x4490('0x4'));var moment=require(_0x4490('0x5'));var BPromise=require(_0x4490('0x6'));var Mustache=require('mustache');var util=require(_0x4490('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4490('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4490('0x9'));var squel=require(_0x4490('0xa'));var crypto=require(_0x4490('0xb'));var jsforce=require(_0x4490('0xc'));var deskjs=require(_0x4490('0xd'));var toCsv=require(_0x4490('0x8'));var querystring=require(_0x4490('0xe'));var Papa=require(_0x4490('0xf'));var htmlToText=require(_0x4490('0x10'));var juice=require('juice');var Redis=require(_0x4490('0x11'));var authService=require(_0x4490('0x12'));var qs=require(_0x4490('0x13'));var as=require(_0x4490('0x14'));var hardwareService=require(_0x4490('0x15'));var logger=require(_0x4490('0x16'))(_0x4490('0x17'));var utils=require('../../config/utils');var config=require(_0x4490('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x4490('0x19'))['db'];config['redis']=_[_0x4490('0x1a')](config['redis'],{'host':_0x4490('0x1b'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4490('0x1c')]));require(_0x4490('0x1d'))[_0x4490('0x1e')](socket);function respondWithStatusCode(_0x1c79e1,_0x3f5a9a){_0x3f5a9a=_0x3f5a9a||0xcc;return function(_0x4c2bf2){if(_0x4c2bf2){return _0x1c79e1[_0x4490('0x1f')](_0x3f5a9a);}return _0x1c79e1[_0x4490('0x20')](_0x3f5a9a)[_0x4490('0x21')]();};}function respondWithResult(_0xe7f161,_0x28113d){_0x28113d=_0x28113d||0xc8;return function(_0x37fa77){if(_0x37fa77){return _0xe7f161[_0x4490('0x20')](_0x28113d)[_0x4490('0x22')](_0x37fa77);}};}function respondWithFilteredResult(_0x2a9986,_0xa9dff7){return function(_0x47d8fb){if(_0x47d8fb){var _0x2683ba=typeof _0xa9dff7['offset']===_0x4490('0x23')&&typeof _0xa9dff7['limit']===_0x4490('0x23');var _0x1e8e13=_0x47d8fb[_0x4490('0x24')];var _0xb3158d=_0x2683ba?0x0:_0xa9dff7[_0x4490('0x25')];var _0x503b35=_0x2683ba?_0x47d8fb[_0x4490('0x24')]:_0xa9dff7[_0x4490('0x25')]+_0xa9dff7[_0x4490('0x26')];var _0x33cd30;if(_0x503b35>=_0x1e8e13){_0x503b35=_0x1e8e13;_0x33cd30=0xc8;}else{_0x33cd30=0xce;}_0x2a9986[_0x4490('0x20')](_0x33cd30);return _0x2a9986[_0x4490('0x27')]('Content-Range',_0xb3158d+'-'+_0x503b35+'/'+_0x1e8e13)[_0x4490('0x22')](_0x47d8fb);}return null;};}function patchUpdates(_0x4707f1){return function(_0x4f62be){try{jsonpatch[_0x4490('0x28')](_0x4f62be,_0x4707f1,!![]);}catch(_0x5c8216){return BPromise[_0x4490('0x29')](_0x5c8216);}return _0x4f62be[_0x4490('0x2a')]();};}function saveUpdates(_0x342b81,_0x1d476a){return function(_0x26e934){if(_0x26e934){return _0x26e934['update'](_0x342b81)[_0x4490('0x2b')](function(_0x1a4489){return _0x1a4489;});}return null;};}function removeEntity(_0x5b9974,_0x17891c){return function(_0x77deb7){if(_0x77deb7){return _0x77deb7[_0x4490('0x2c')]()['then'](function(){_0x5b9974[_0x4490('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ff9de,_0xb9969d){return function(_0x573e9e){if(!_0x573e9e){_0x4ff9de[_0x4490('0x1f')](0x194);}return _0x573e9e;};}function handleError(_0x5327c1,_0x4eeda4){_0x4eeda4=_0x4eeda4||0x1f4;return function(_0x12c768){logger[_0x4490('0x2d')](_0x12c768[_0x4490('0x2e')]);if(_0x12c768[_0x4490('0x2f')]){delete _0x12c768[_0x4490('0x2f')];}_0x5327c1[_0x4490('0x20')](_0x4eeda4)[_0x4490('0x30')](_0x12c768);};}function getInteractionUsers(_0x35995e,_0x4f9a04){return new BPromise(function(_0x42446c,_0x2408b7){try{if(_0x4f9a04[_0x35995e['id']]){_0x35995e[_0x4490('0x31')]=_[_0x4490('0x32')](_0x4f9a04[_0x35995e['id']],function(_0x2c1670){return{'id':_0x2c1670['id'],'fullname':_0x2c1670[_0x4490('0x33')]};});}}catch(_0x3ca372){_0x2408b7(_0x3ca372);}_0x42446c(_0x35995e);});}function getInteractionTags(_0x55e70a,_0xb70b63){return new BPromise(function(_0x501c3f,_0x20bf20){try{if(_0x55e70a['TagIds']){_0x55e70a[_0x4490('0x34')]=[];_0x55e70a[_0x4490('0x35')]['split'](',')[_0x4490('0x36')](function(_0x77de4c){_0x55e70a[_0x4490('0x34')][_0x4490('0x37')](_0xb70b63[_0x77de4c]);});}delete _0x55e70a[_0x4490('0x35')];}catch(_0x1c4fa6){_0x20bf20(_0x1c4fa6);}_0x501c3f(_0x55e70a);});}function getLastMessageText(_0x1f544c){return new BPromise(function(_0x3de4c3,_0x2ee343){return db['MailMessage']['findOne']({'where':{'$and':[{'MailInteractionId':_0x1f544c['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x4490('0x38')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x4490('0x39')],'order':_0x4490('0x3a'),'raw':!![]})[_0x4490('0x2b')](function(_0x3447db){if(_0x3447db&&_0x3447db[_0x4490('0x39')]){_0x1f544c[_0x4490('0x3b')]=_['trimStart'](_0x3447db[_0x4490('0x39')]);}_0x3de4c3(_0x1f544c);})[_0x4490('0x3c')](function(_0x4b40c3){_0x2ee343(_0x4b40c3);});});}function updateMailInteraction(_0x223877,_0x18bc6b,_0x10ecd3,_0x5a3b4a){return new BPromise(function(_0x305b7a,_0x47bc0b){return getInteractionUsers(_0x223877,_0x10ecd3)['then'](function(_0x14b811){return getInteractionTags(_0x14b811,_0x18bc6b);})[_0x4490('0x2b')](function(_0x38df24){if(_0x5a3b4a){_0x305b7a(getLastMessageText(_0x38df24));}else{_0x305b7a(_0x38df24);}})[_0x4490('0x3c')](function(_0x2101db){_0x47bc0b(_0x2101db);});});}exports[_0x4490('0x3d')]=function(_0x27648e,_0x4d5d27){var _0x1216f2={},_0x333c86={},_0x517d5c={'count':0x0,'rows':[]};var _0x40a464=_['map'](db[_0x4490('0x3e')][_0x4490('0x3f')],function(_0xccc20d){return{'name':_0xccc20d['fieldName'],'type':_0xccc20d[_0x4490('0x40')][_0x4490('0x41')]};});_0x333c86['model']=_['map'](_0x40a464,_0x4490('0x2f'));_0x333c86[_0x4490('0x42')]=_[_0x4490('0x43')](_0x27648e[_0x4490('0x42')]);_0x333c86[_0x4490('0x44')]=_[_0x4490('0x45')](_0x333c86[_0x4490('0x46')],_0x333c86['query']);_0x1216f2[_0x4490('0x47')]=_[_0x4490('0x45')](_0x333c86[_0x4490('0x46')],qs[_0x4490('0x48')](_0x27648e['query'][_0x4490('0x48')]));_0x1216f2[_0x4490('0x47')]=_0x1216f2[_0x4490('0x47')][_0x4490('0x49')]?_0x1216f2[_0x4490('0x47')]:_0x333c86[_0x4490('0x46')];if(!_0x27648e[_0x4490('0x42')]['hasOwnProperty'](_0x4490('0x4a'))){_0x1216f2[_0x4490('0x26')]=qs[_0x4490('0x26')](_0x27648e[_0x4490('0x42')]['limit']);_0x1216f2[_0x4490('0x25')]=qs[_0x4490('0x25')](_0x27648e[_0x4490('0x42')][_0x4490('0x25')]);}_0x1216f2[_0x4490('0x4b')]=qs[_0x4490('0x4c')](_0x27648e[_0x4490('0x42')][_0x4490('0x4c')]);_0x1216f2[_0x4490('0x4d')]=qs[_0x4490('0x44')](_[_0x4490('0x4e')](_0x27648e[_0x4490('0x42')],_0x333c86[_0x4490('0x44')]),_0x40a464);var _0x3adcb5=[];var _0x428bc5=squel[_0x4490('0x4f')]()[_0x4490('0x50')]('id')[_0x4490('0x50')]('name')[_0x4490('0x50')](_0x4490('0x51'))[_0x4490('0x52')](_0x4490('0x53'));var _0x579f12=squel['select']()['field'](_0x4490('0x54'))[_0x4490('0x50')](_0x4490('0x55'))[_0x4490('0x50')]('ui.MailInteractionId')['from'](_0x4490('0x56'),'ui')[_0x4490('0x57')](_0x4490('0x58'),'u',_0x4490('0x59'));var _0x4bfb07=squel[_0x4490('0x4f')]()['from']('mail_interactions','i')[_0x4490('0x57')]('cm_contacts','c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x4490('0x57')]('users','o',_0x4490('0x5a'))[_0x4490('0x57')](_0x4490('0x5b'),'a','a.id\x20=\x20i.MailAccountId')[_0x4490('0x57')](_0x4490('0x5c'),'me',_0x4490('0x5d'))[_0x4490('0x57')]('mail_interaction_has_tags','it',_0x4490('0x5e'))[_0x4490('0x57')](_0x4490('0x53'),'t','t.id\x20=\x20it.TagId');var _0x26114b=squel[_0x4490('0x5f')]();var _0x4f69a8=[];var _0x3d7139=squel[_0x4490('0x5f')]();var _0x9cf974;if(_0x27648e[_0x4490('0x42')][_0x4490('0x60')]){_0x9cf974=as['parseSearch'](_0x27648e[_0x4490('0x42')][_0x4490('0x60')]);var _0x2f4c3e=_0x9cf974['sqlOperator'];for(var _0x1d5186=0x0;_0x1d5186<_0x9cf974[_0x4490('0x61')][_0x4490('0x49')];_0x1d5186++){var _0x46d2d4=_0x9cf974[_0x4490('0x61')][_0x1d5186];var _0x4cac3f='i';var _0x29289d=_['find'](_0x40a464,[_0x4490('0x2f'),_0x46d2d4[_0x4490('0x50')]]);if(!_0x29289d){switch(_0x46d2d4[_0x4490('0x50')]){case _0x4490('0x62'):if(_0x46d2d4['value']==0x1){_0x4bfb07[_0x4490('0x63')]('`'+_0x46d2d4['field']+_0x4490('0x64'));}else{_0x4bfb07[_0x4490('0x63')]('`'+_0x46d2d4['field']+'`\x20>\x200');}break;case _0x4490('0x65'):if(_0x46d2d4[_0x4490('0x66')]===_0x4490('0x67')){if(_0x46d2d4['value'][_0x4490('0x68')]('\x20')[_0x4490('0x49')]>0x1){_0x26114b[_0x2f4c3e](_0x4490('0x69'),qs['getFullTextValue'](_0x46d2d4[_0x4490('0x6a')]),null);}else{var _0x5441c1='%'+_0x46d2d4[_0x4490('0x6a')]+'%';_0x26114b[_0x2f4c3e](_0x4490('0x6b'),_0x5441c1,_0x5441c1,_0x5441c1);}}else{_0x29289d=_[_0x4490('0x6c')](_0x40a464,[_0x4490('0x2f'),_0x4490('0x6d')]);_0x46d2d4['field']=_0x4490('0x6d');_0x1dae9b=as['buildExpression'](_0x4cac3f,_0x29289d[_0x4490('0x40')],_0x46d2d4);_0x26114b[_0x2f4c3e](_0x1dae9b['text'],_0x1dae9b['value'][_0x4490('0x6e')],_0x1dae9b[_0x4490('0x6a')][_0x4490('0x21')]);}break;case _0x4490('0x6f'):var _0x452d86=_0x46d2d4[_0x4490('0x6a')]['split'](',')[_0x4490('0x32')](function(_0x1b72e6){return Number(_0x1b72e6);});_0x452d86['forEach'](function(_0x5dfac6){_0x3d7139['or'](_0x4490('0x70'),'%,'+_0x5dfac6+',%');});_0x4f69a8=_[_0x4490('0x71')](_0x4f69a8,_0x452d86);break;case'User':if(_0x46d2d4[_0x4490('0x66')]===_0x4490('0x67')){_0x26114b[_0x2f4c3e](_0x4490('0x72'),'%'+_0x46d2d4[_0x4490('0x6a')]+'%',null);}else{_0x29289d=_[_0x4490('0x6c')](_0x40a464,['name',_0x4490('0x73')]);_0x46d2d4[_0x4490('0x50')]=_0x4490('0x73');_0x1dae9b=as[_0x4490('0x74')](_0x4cac3f,_0x29289d[_0x4490('0x40')],_0x46d2d4);_0x26114b[_0x2f4c3e](_0x1dae9b['text'],_0x1dae9b[_0x4490('0x6a')]['start'],_0x1dae9b[_0x4490('0x6a')]['end']);}break;case'plainBody':_0x1dae9b=as['buildExpression']('me',null,_0x46d2d4);_0x26114b[_0x2f4c3e](_0x1dae9b['text'],_0x1dae9b[_0x4490('0x6a')][_0x4490('0x6e')],_0x1dae9b['value'][_0x4490('0x21')]);break;}}else{var _0x1dae9b=as[_0x4490('0x74')](_0x4cac3f,_0x29289d[_0x4490('0x40')],_0x46d2d4);_0x26114b[_0x2f4c3e](_0x1dae9b[_0x4490('0x75')],_0x1dae9b[_0x4490('0x6a')][_0x4490('0x6e')],_0x1dae9b['value']['end']);}}}else{var _0x9a9f79=_(_0x27648e[_0x4490('0x42')])[_0x4490('0x43')]()[_0x4490('0x32')](function(_0x482ded){return _[_0x4490('0x76')](_0x40a464,[_0x4490('0x2f'),_0x482ded])?_0x482ded:undefined;})[_0x4490('0x77')]()[_0x4490('0x6a')]();if(!_[_0x4490('0x78')](_0x9a9f79)){_0x9a9f79[_0x4490('0x36')](function(_0x4e3482){if(_0x4e3482===_0x4490('0x79')){_0x4bfb07[_0x4490('0x4d')](_0x4490('0x7a'),[]['concat'](_0x27648e[_0x4490('0x42')][_0x4e3482]));}else if(_0x4e3482===_0x4490('0x7b')){var _0x8a9a06=JSON[_0x4490('0x7c')](_0x27648e[_0x4490('0x42')][_0x4e3482])['$gte'];var _0x4e71e0=JSON['parse'](_0x27648e[_0x4490('0x42')][_0x4e3482])[_0x4490('0x7d')];_0x4bfb07[_0x4490('0x4d')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x8a9a06,_0x4e71e0);}else{if(_0x27648e[_0x4490('0x42')][_0x4e3482]==='null'){_0x4bfb07['where']('i.'+_0x4e3482+_0x4490('0x7e'));}else{_0x4bfb07[_0x4490('0x4d')]('i.'+_0x4e3482+_0x4490('0x7f'),_0x27648e[_0x4490('0x42')][_0x4e3482]);}}});}if(_0x27648e[_0x4490('0x42')][_0x4490('0x80')]){if(_0x27648e[_0x4490('0x42')][_0x4490('0x80')]==0x1){_0x4bfb07[_0x4490('0x63')](_0x4490('0x81'));}else{_0x4bfb07[_0x4490('0x63')](_0x4490('0x82'));}}if(_0x27648e['query']['tag']){_0x4f69a8=_['isArray'](_0x27648e[_0x4490('0x42')][_0x4490('0x83')])?_0x27648e[_0x4490('0x42')][_0x4490('0x83')]:new Array(_0x27648e['query'][_0x4490('0x83')]);_0x4f69a8[_0x4490('0x36')](function(_0x2c33e6){_0x3d7139['or'](_0x4490('0x70'),'%,'+_0x2c33e6+',%');});}if(_0x27648e[_0x4490('0x42')][_0x4490('0x84')]){var _0x51b9cb=_0x27648e['query'][_0x4490('0x84')][_0x4490('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs['isNumeric'](_0x51b9cb)){_0x26114b['or']('i.id\x20LIKE\x20?',_0x51b9cb+'%');}else if(qs[_0x4490('0x86')](_0x51b9cb)){_0x26114b['or'](_0x4490('0x87'),_0x51b9cb+'%');}else{_0x26114b['or'](_0x4490('0x88'),qs[_0x4490('0x89')](_0x51b9cb))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x4490('0x89')](_0x51b9cb));}}}_0x4bfb07[_0x4490('0x4d')](_0x26114b);_0x4bfb07[_0x4490('0x8a')](_0x4490('0x8b'));var _0x56a151={'type':db[_0x4490('0x8c')]['QueryTypes'][_0x4490('0x8d')],'raw':!![]};var _0x127da8=_0x4bfb07[_0x4490('0x8e')]();_0x127da8['field']('i.id');_0x127da8['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x4490('0x62'));if(_0x1216f2['order']){_0x1216f2[_0x4490('0x4b')][_0x4490('0x36')](function(_0x5e65b2){var _0xe612f5=_0x5e65b2[0x0]===_0x4490('0x8f')?_0x5e65b2[0x0]:'i.'+_0x5e65b2[0x0];_0x4bfb07[_0x4490('0x4b')](_0xe612f5,_0x5e65b2[0x1]==='DESC'?![]:!![]);});}if(!_[_0x4490('0x78')](_0x4f69a8)){_0x4bfb07[_0x4490('0x63')](_0x3d7139);_0x127da8[_0x4490('0x4d')]('t.id\x20IN\x20?',_0x4f69a8);}BPromise['resolve']()[_0x4490('0x2b')](function(){if(!_0x9cf974){if(_0x27648e[_0x4490('0x42')][_0x4490('0x79')])return;_0x127da8[_0x4490('0x4d')]('i.MailAccountId\x20IS\x20NOT\x20NULL');_0x4bfb07[_0x4490('0x4d')](_0x4490('0x90'));return;}if(_0x27648e[_0x4490('0x91')][_0x4490('0x92')]!==_0x4490('0x93'))return;return _0x27648e[_0x4490('0x91')][_0x4490('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x22ab0d){if(_[_0x4490('0x78')](_0x22ab0d)){_0x127da8[_0x4490('0x4d')]('i.MailAccountId\x20IS\x20NULL');_0x4bfb07[_0x4490('0x4d')](_0x4490('0x95'));}else{_0x127da8[_0x4490('0x4d')](_0x4490('0x7a'),_[_0x4490('0x32')](_0x22ab0d,'id'));_0x4bfb07[_0x4490('0x4d')](_0x4490('0x7a'),_[_0x4490('0x32')](_0x22ab0d,'id'));}});})[_0x4490('0x2b')](function(){if(_0x27648e[_0x4490('0x91')]['role']===_0x4490('0x93')&&!_0x9cf974&&!_0x27648e['query'][_0x4490('0x79')])return[];return db[_0x4490('0x96')][_0x4490('0x42')](_0x127da8[_0x4490('0x97')](),_0x56a151);})['then'](function(_0x4eca71){_0x517d5c[_0x4490('0x24')]=_0x4eca71[_0x4490('0x49')];if(_0x517d5c[_0x4490('0x24')]===0x0)return[];return db[_0x4490('0x96')][_0x4490('0x42')](_0x428bc5[_0x4490('0x97')](),_0x56a151)[_0x4490('0x2b')](function(_0x2d291e){_0x3adcb5=_[_0x4490('0x98')](_0x2d291e,'id');_0x56a151=_[_0x4490('0x99')](_0x56a151,{'model':db['MailInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x27648e[_0x4490('0x42')][_0x4490('0x48')]){_0x1216f2[_0x4490('0x47')][_0x4490('0x36')](function(_0x381b8b){_0x4bfb07[_0x4490('0x50')]('i.'+_0x381b8b);});}else{_0x4bfb07[_0x4490('0x50')](_0x4490('0x9a'),_0x4490('0x62'));_0x4bfb07['field'](_0x4490('0x9b'),'Account.key');_0x4bfb07[_0x4490('0x50')](_0x4490('0x9c'),_0x4490('0x9d'));_0x4bfb07[_0x4490('0x50')](_0x4490('0x9e'),_0x4490('0x8f'));_0x4bfb07[_0x4490('0x50')](_0x4490('0x8b'));_0x4bfb07['field'](_0x4490('0x9f'));_0x4bfb07[_0x4490('0x50')]('i.updatedAt');_0x4bfb07[_0x4490('0x50')](_0x4490('0xa0'));_0x4bfb07[_0x4490('0x50')](_0x4490('0xa1'));_0x4bfb07[_0x4490('0x50')](_0x4490('0xa2'));_0x4bfb07[_0x4490('0x50')](_0x4490('0xa3'));_0x4bfb07[_0x4490('0x50')]('i.lastMsgDirection');_0x4bfb07[_0x4490('0x50')](_0x4490('0xa4'));_0x4bfb07[_0x4490('0x50')]('i.disposition');_0x4bfb07[_0x4490('0x50')]('i.secondDisposition');_0x4bfb07[_0x4490('0x50')](_0x4490('0xa5'));_0x4bfb07[_0x4490('0x50')](_0x4490('0xa6'));_0x4bfb07[_0x4490('0x50')]('i.to');_0x4bfb07[_0x4490('0x50')](_0x4490('0xa7'));_0x4bfb07[_0x4490('0x50')](_0x4490('0xa8'));_0x4bfb07[_0x4490('0x50')](_0x4490('0xa9'));_0x4bfb07[_0x4490('0x50')](_0x4490('0xaa'),_0x4490('0xab'));_0x4bfb07['field'](_0x4490('0xac'),_0x4490('0xad'));_0x4bfb07['field'](_0x4490('0xae'),'Contact.email');_0x4bfb07[_0x4490('0x50')](_0x4490('0xaf'),_0x4490('0xb0'));_0x4bfb07[_0x4490('0x50')](_0x4490('0xb1'),_0x4490('0xb2'));_0x4bfb07['field'](_0x4490('0xb3'),_0x4490('0xb4'));_0x4bfb07['field'](_0x4490('0xb5'),_0x4490('0xb6'));_0x4bfb07[_0x4490('0x50')](_0x4490('0xb7'),'Owner.internal');_0x4bfb07['field']('GROUP_CONCAT(DISTINCT\x20t.id)',_0x4490('0x35'));}if(_0x1216f2[_0x4490('0x26')])_0x4bfb07['limit'](_0x1216f2[_0x4490('0x26')]);if(_0x1216f2['offset'])_0x4bfb07[_0x4490('0x25')](_0x1216f2[_0x4490('0x25')]);return db['sequelize'][_0x4490('0x42')](_0x4bfb07[_0x4490('0x97')](),_0x56a151);})[_0x4490('0x2b')](function(_0x294960){if(_0x294960[_0x4490('0x49')]>0x0)_0x579f12[_0x4490('0x4d')](_0x4490('0xb8'),_[_0x4490('0x32')](_0x294960,'id'));return db[_0x4490('0x96')]['query'](_0x579f12[_0x4490('0x97')](),_0x56a151)['then'](function(_0x100324){var _0x1aa0ed=_[_0x4490('0xb9')](_0x100324,_0x4490('0xba'));var _0x520794=[];return db[_0x4490('0xbb')][_0x4490('0xbc')]({'attributes':[_0x4490('0xbd')],'raw':!![]})[_0x4490('0x2b')](function(_0x3da803){var _0x40b94d=_0x3da803['enableEmailPreview'];_0x294960[_0x4490('0x36')](function(_0x1958a7){_0x520794['push'](updateMailInteraction(_0x1958a7,_0x3adcb5,_0x1aa0ed,_0x40b94d));});return BPromise[_0x4490('0xbe')](_0x520794);});});});})['then'](function(_0x38bf3a){_0x517d5c['rows']=_0x38bf3a;return _0x517d5c;})[_0x4490('0x2b')](respondWithFilteredResult(_0x4d5d27,_0x1216f2))['catch'](handleError(_0x4d5d27,null));};exports['show']=function(_0x3ccb47,_0xc3b61d){var _0x337552={'raw':![],'where':{'id':_0x3ccb47['params']['id']}},_0x1db60f={};_0x1db60f[_0x4490('0x46')]=_['keys'](db[_0x4490('0x3e')][_0x4490('0x3f')]);_0x1db60f[_0x4490('0x42')]=_['keys'](_0x3ccb47[_0x4490('0x42')]);_0x1db60f[_0x4490('0x44')]=_[_0x4490('0x45')](_0x1db60f[_0x4490('0x46')],_0x1db60f[_0x4490('0x42')]);_0x337552[_0x4490('0x47')]=_[_0x4490('0x45')](_0x1db60f[_0x4490('0x46')],qs[_0x4490('0x48')](_0x3ccb47['query'][_0x4490('0x48')]));_0x337552[_0x4490('0x47')]=_0x337552[_0x4490('0x47')][_0x4490('0x49')]?_0x337552['attributes']:_0x1db60f[_0x4490('0x46')];if(_0x3ccb47['query'][_0x4490('0xbf')]){_0x337552[_0x4490('0xc0')]=[{'all':!![]}];}_0x337552=_[_0x4490('0x99')]({},_0x337552,_0x3ccb47[_0x4490('0xc1')]);return db[_0x4490('0x3e')][_0x4490('0x6c')](_0x337552)[_0x4490('0x2b')](handleEntityNotFound(_0xc3b61d,null))[_0x4490('0x2b')](respondWithResult(_0xc3b61d,null))[_0x4490('0x3c')](handleError(_0xc3b61d,null));};exports['create']=function(_0x34e4eb,_0x3ef45d){return db[_0x4490('0x3e')][_0x4490('0xc2')](_0x34e4eb[_0x4490('0xc3')],{})['then'](respondWithResult(_0x3ef45d,0xc9))[_0x4490('0x3c')](handleError(_0x3ef45d,null));};exports[_0x4490('0xc4')]=function(_0xab1d5a,_0x4949f7){if(_0xab1d5a['body']['id']){delete _0xab1d5a['body']['id'];}return db[_0x4490('0x3e')][_0x4490('0x6c')]({'where':{'id':_0xab1d5a[_0x4490('0xc5')]['id']}})[_0x4490('0x2b')](handleEntityNotFound(_0x4949f7,null))[_0x4490('0x2b')](saveUpdates(_0xab1d5a[_0x4490('0xc3')],null))[_0x4490('0x2b')](respondWithResult(_0x4949f7,null))[_0x4490('0x3c')](handleError(_0x4949f7,null));};exports[_0x4490('0x2c')]=function(_0x12610a,_0x4803c7){return db[_0x4490('0x3e')][_0x4490('0x6c')]({'where':{'id':_0x12610a[_0x4490('0xc5')]['id']}})[_0x4490('0x2b')](handleEntityNotFound(_0x4803c7,null))[_0x4490('0x2b')](removeEntity(_0x4803c7,null))['catch'](handleError(_0x4803c7,null));};exports[_0x4490('0xc6')]=function(_0x4645e2,_0x2864c8){return db['MailInteraction'][_0x4490('0xc6')]()[_0x4490('0x2b')](respondWithResult(_0x2864c8,null))[_0x4490('0x3c')](handleError(_0x2864c8,null));};exports[_0x4490('0xc7')]=function(_0x5827a5,_0x33ff61,_0x22d04e){return db[_0x4490('0xc8')][_0x4490('0x6c')]({'where':{'id':_0x5827a5[_0x4490('0xc5')]['id']}})[_0x4490('0x2b')](handleEntityNotFound(_0x33ff61,null))[_0x4490('0x2b')](function(_0x4d5b8d){if(_0x4d5b8d){return _0x4d5b8d[_0x4490('0xc7')](_0x5827a5[_0x4490('0xc3')][_0x4490('0xc9')],_[_0x4490('0xca')](_0x5827a5[_0x4490('0xc3')],[_0x4490('0xc9'),'id'])||{});}})[_0x4490('0x2b')](respondWithResult(_0x33ff61,null))[_0x4490('0x3c')](handleError(_0x33ff61,null));};exports[_0x4490('0xcb')]=function(_0x1360f8,_0x179ce7,_0x51aa6c){var _0x12dc7f={'raw':![],'where':{}};var _0xac14b6={};var _0x5ebadc={'count':0x0,'rows':[]};return db['MailInteraction']['findOne']({'where':{'id':_0x1360f8[_0x4490('0xc5')]['id']}})[_0x4490('0x2b')](handleEntityNotFound(_0x179ce7,null))[_0x4490('0x2b')](function(_0xe95614){if(_0xe95614){_0xac14b6['model']=_[_0x4490('0x43')](db[_0x4490('0xc8')][_0x4490('0x3f')]);_0xac14b6[_0x4490('0x42')]=_[_0x4490('0x43')](_0x1360f8[_0x4490('0x42')]);_0xac14b6['filters']=_[_0x4490('0x45')](_0xac14b6['model'],_0xac14b6[_0x4490('0x42')]);_0x12dc7f[_0x4490('0x47')]=_[_0x4490('0x45')](_0xac14b6['model'],qs['fields'](_0x1360f8[_0x4490('0x42')][_0x4490('0x48')]));_0x12dc7f[_0x4490('0x47')]=_0x12dc7f[_0x4490('0x47')][_0x4490('0x49')]?_0x12dc7f[_0x4490('0x47')]:_0xac14b6[_0x4490('0x46')];if(!_0x1360f8[_0x4490('0x42')][_0x4490('0xcc')](_0x4490('0x4a'))){_0x12dc7f[_0x4490('0x26')]=qs[_0x4490('0x26')](_0x1360f8[_0x4490('0x42')][_0x4490('0x26')]);_0x12dc7f[_0x4490('0x25')]=qs[_0x4490('0x25')](_0x1360f8[_0x4490('0x42')]['offset']);}_0x12dc7f[_0x4490('0x4b')]=qs[_0x4490('0x4c')](_0x1360f8[_0x4490('0x42')]['sort']);_0x12dc7f[_0x4490('0x4d')]=qs['filters'](_['pick'](_0x1360f8[_0x4490('0x42')],_0xac14b6[_0x4490('0x44')]));_0x12dc7f[_0x4490('0x4d')]['MailInteractionId']=_0xe95614['id'];if(_0x1360f8[_0x4490('0x42')]['filter']){_0x12dc7f[_0x4490('0x4d')]=_['merge'](_0x12dc7f[_0x4490('0x4d')],{'$or':_['map'](_0x12dc7f['attributes'],function(_0x3d781b){var _0x5e750d={};_0x5e750d[_0x3d781b]={'$like':'%'+_0x1360f8[_0x4490('0x42')][_0x4490('0x84')]+'%'};return _0x5e750d;})});}if(_0x1360f8[_0x4490('0x42')][_0x4490('0xcd')]){var _0x2defce=_0x1360f8['query'][_0x4490('0xcd')][_0x4490('0x68')](',');var _0x3a13df={};_0x3a13df[_0x2defce[0x0]]={'$gte':moment(_0x2defce[0x1])[_0x4490('0xce')](_0x4490('0xcf'))};_0x12dc7f[_0x4490('0x4d')]=_[_0x4490('0x99')](_0x12dc7f[_0x4490('0x4d')],_0x3a13df);}_0x12dc7f=_['merge']({},_0x12dc7f,_0x1360f8[_0x4490('0xc1')]);return db[_0x4490('0xc8')][_0x4490('0x24')]({'where':_0x12dc7f[_0x4490('0x4d')]})[_0x4490('0x2b')](function(_0x26ba52){_0x5ebadc[_0x4490('0x24')]=_0x26ba52;if(_0x1360f8[_0x4490('0x42')][_0x4490('0xbf')]){_0x12dc7f[_0x4490('0xc0')]=[{'all':!![]}];}return db[_0x4490('0xc8')][_0x4490('0xd0')](_0x12dc7f);})[_0x4490('0x2b')](function(_0x571891){if(_0x1360f8[_0x4490('0x42')][_0x4490('0xd1')]==='true'){for(var _0x37b4c6=0x0;_0x37b4c6<_0x571891['length'];_0x37b4c6++){_0x571891[_0x37b4c6]['body']=juice(_0x571891[_0x37b4c6]['body']);}}_0x5ebadc[_0x4490('0xd2')]=_0x571891;return _0x5ebadc;});}})[_0x4490('0x2b')](respondWithFilteredResult(_0x179ce7,_0x12dc7f))['catch'](handleError(_0x179ce7,null));};exports[_0x4490('0xd3')]=function(_0x591199,_0x55629b,_0x570e39){return db['MailInteraction'][_0x4490('0x6c')]({'where':{'id':_0x591199[_0x4490('0xc5')]['id']}})[_0x4490('0x2b')](handleEntityNotFound(_0x55629b,null))[_0x4490('0x2b')](function(_0xdf52df){if(_0xdf52df){return _0xdf52df[_0x4490('0xd4')](_0x591199[_0x4490('0xc3')][_0x4490('0xc9')],_['omit'](_0x591199[_0x4490('0xc3')],[_0x4490('0xc9'),'id'])||{})['spread'](function(){return db[_0x4490('0x6f')][_0x4490('0xd0')]({'attributes':['id',_0x4490('0x2f'),'color'],'where':{'id':_0x591199[_0x4490('0xc3')][_0x4490('0xc9')]}});})['then'](function(_0x38e816){socket[_0x4490('0xd5')](_0x4490('0xd6'),{'id':Number(_0x591199[_0x4490('0xc5')]['id']),'tags':_0x38e816||[]});return{'id':Number(_0x591199[_0x4490('0xc5')]['id']),'tags':_0x38e816||[]};});}})['then'](respondWithResult(_0x55629b,null))['catch'](handleError(_0x55629b,null));};exports[_0x4490('0xd7')]=function(_0x14e703,_0x3d4d23,_0x2f359a){return db[_0x4490('0x3e')]['find']({'where':{'id':_0x14e703[_0x4490('0xc5')]['id']}})[_0x4490('0x2b')](handleEntityNotFound(_0x3d4d23,null))[_0x4490('0x2b')](function(_0x322f64){if(_0x322f64){return _0x322f64['removeTags'](_0x14e703['query'][_0x4490('0xc9')]);}})[_0x4490('0x2b')](respondWithStatusCode(_0x3d4d23,null))[_0x4490('0x3c')](handleError(_0x3d4d23,null));};exports[_0x4490('0xd8')]=function(_0x4e3ebb,_0x497829){var _0x369723=moment()['unix']()[_0x4490('0x97')]();var _0x1e960e=path[_0x4490('0xd9')](config[_0x4490('0xda')],_0x4490('0xdb'),'files',_0x4490('0xdc'));var _0x473def=path[_0x4490('0xd9')](config['root'],_0x4490('0xdb'),_0x4490('0xdd'),'attachments');var _0x152eb7=path[_0x4490('0xd9')](_0x1e960e,_0x369723);var _0x268eb9=util['format'](_0x4490('0xde'),_0x4e3ebb['params']['id'],_0x369723);var _0x175e57=path[_0x4490('0xd9')](_0x1e960e,_0x268eb9);var _0x595967=[];if(_0x4e3ebb[_0x4490('0x42')][_0x4490('0xdf')]){_0x595967[_0x4490('0x37')]({'model':db['Attachment'],'as':_0x4490('0xe0'),'raw':!![]});}var _0x113247=[{'model':db['MailMessage'],'as':'Messages','attributes':['id',_0x4490('0xc3'),_0x4490('0x52'),'to','cc','bcc','subject','createdAt'],'where':{'secret':![]},'order':qs[_0x4490('0x4c')]('id'),'include':_0x595967}];return db[_0x4490('0x3e')][_0x4490('0x6c')]({'where':{'id':_0x4e3ebb[_0x4490('0xc5')]['id']},'include':_0x113247})[_0x4490('0x2b')](handleEntityNotFound(_0x497829,null))[_0x4490('0x2b')](function(_0x3376ba){if(_0x3376ba&&_0x3376ba[_0x4490('0xe1')]){var _0x549163=_0x3376ba[_0x4490('0xe2')]({'plain':!![]});fs['mkdirSync'](_0x152eb7);return BPromise[_0x4490('0xe3')](_0x549163[_0x4490('0xe1')],function(_0x113c15,_0x4bb1d4){var _0x1c8ebe={'from':_0x113c15[_0x4490('0x52')],'to':_0x113c15['to'],'subject':_0x113c15[_0x4490('0xe4')],'html':_0x113c15[_0x4490('0xc3')],'headers':{'Date':moment(_0x113c15[_0x4490('0x7b')])[_0x4490('0xce')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x113c15['cc']){_0x1c8ebe['headers']['Cc']=_0x113c15['cc'];}if(_0x113c15[_0x4490('0xe5')]){_0x1c8ebe[_0x4490('0xe6')][_0x4490('0xe7')]=_0x113c15['bcc'];}return new BPromise(function(_0x1ff611,_0x43bd65){if(_0x113c15[_0x4490('0xe0')]){for(var _0x91c545=0x0;_0x91c545<_0x113c15[_0x4490('0xe0')][_0x4490('0x49')];_0x91c545++){var _0x596a64=_0x113c15[_0x4490('0xe0')][_0x91c545];var _0x4dbbed=path[_0x4490('0xd9')](_0x473def,_0x596a64['basename']);if(fs['existsSync'](_0x4dbbed)){_0x1c8ebe[_0x4490('0xdf')][_0x4490('0x37')]({'name':_0x596a64[_0x4490('0x2f')],'contentType':_0x596a64[_0x4490('0x40')],'data':fs['readFileSync'](_0x4dbbed)});}}}emlformat['build'](_0x1c8ebe,function(_0x50da0d,_0x30b22f){if(_0x50da0d)return _0x43bd65(_0x50da0d);fs[_0x4490('0xe8')](path[_0x4490('0xd9')](_0x152eb7,util[_0x4490('0xce')](_0x4490('0xe9'),_0x4bb1d4)),_0x30b22f);return _0x1ff611(_0x30b22f);});});})[_0x4490('0x2b')](function(){return new BPromise(function(_0x563b74,_0x3ee8ed){zipdir(_0x152eb7,{'saveTo':_0x175e57},function(_0x307bd8,_0x2d4eac){if(_0x307bd8)return _0x3ee8ed(_0x307bd8);return _0x563b74(_0x2d4eac);});})['then'](function(){return new BPromise(function(_0x3d6365,_0x1e9a90){rimraf(_0x152eb7,function(_0x460b0c){if(_0x460b0c)_0x1e9a90(_0x460b0c);return _0x3d6365();});});})['then'](function(){return _0x497829['download'](_0x175e57,_0x268eb9,function(_0x80fe30){if(_0x80fe30){console[_0x4490('0xea')](_0x4490('0xeb'),_0x80fe30);}else{fs['unlinkSync'](_0x175e57);}});});});}else{return _0x497829[_0x4490('0x1f')](0xc8);}})['catch'](handleError(_0x497829,null));}; \ No newline at end of file +var _0x285c=['-id','plainBody','lastMsgText','trimStart','catch','MailInteraction','type','key','keys','filters','intersection','model','query','attributes','fields','length','sort','select','field','color','from','tools_tags','u.id','u.fullname','user_has_mail_interactions','users','u.id\x20=\x20ui.UserId','mail_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','mail_accounts','a.id\x20=\x20i.MailAccountId','mail_messages','mail_interaction_has_tags','it.MailInteractionId\x20=\x20i.id','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','value','having','`\x20=\x200','Contact','$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','text','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','operator','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','find','UserId','buildExpression','some','isEmpty','MailAccountId','i.MailAccountId\x20IN\x20?','$gte','parse','$lte','null','where','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','tag','isArray','filter','replace','isNumeric','i.id\x20LIKE\x20?','isEmail','c.email\x20LIKE\x20?','MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','i.id','Sequelize','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.MailAccountId\x20IS\x20NOT\x20NULL','user','role','agent','sequelize','toString','keyBy','merge','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','i.createdAt','i.updatedAt','i.closed','i.closedAt','i.attach','i.lastMsgDirection','i.subject','i.disposition','i.thirdDisposition','i.to','i.UserId','c.firstName','c.lastName','c.phone','Contact.phone','c.mobile','Contact.mobile','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.MailInteractionId\x20IN\x20?','groupBy','MailInteractionId','enableEmailPreview','push','all','rows','params','rawAttributes','includeAll','include','options','create','body','update','describe','addMessage','ids','omit','pick','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','setTags','findAll','emit','mailInteractionTags:save','removeTags','download','unix','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachment','Attachments','Messages','bcc','subject','createdAt','get','mkdirSync','each','headers','Bcc','basename','readFileSync','build','writeFileSync','message%d.eml','log','err','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','juice','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','reject','then','destroy','error','stack','name','send','Users','map','fullname','split','forEach','Tags','TagIds','MailMessage','findOne'];(function(_0x28cd05,_0x16ef0e){var _0xbe377c=function(_0x50685d){while(--_0x50685d){_0x28cd05['push'](_0x28cd05['shift']());}};_0xbe377c(++_0x16ef0e);}(_0x285c,0xb9));var _0xc285=function(_0x23be2b,_0x521494){_0x23be2b=_0x23be2b-0x0;var _0x8082d2=_0x285c[_0x23be2b];return _0x8082d2;};'use strict';var emlformat=require(_0xc285('0x0'));var rimraf=require(_0xc285('0x1'));var zipdir=require(_0xc285('0x2'));var jsonpatch=require(_0xc285('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc285('0x4'));var Mustache=require(_0xc285('0x5'));var util=require(_0xc285('0x6'));var path=require('path');var sox=require(_0xc285('0x7'));var csv=require('to-csv');var ejs=require(_0xc285('0x8'));var fs=require('fs');var fs_extra=require(_0xc285('0x9'));var _=require('lodash');var squel=require(_0xc285('0xa'));var crypto=require(_0xc285('0xb'));var jsforce=require(_0xc285('0xc'));var deskjs=require(_0xc285('0xd'));var toCsv=require(_0xc285('0xe'));var querystring=require(_0xc285('0xf'));var Papa=require('papaparse');var htmlToText=require('html-to-text');var juice=require(_0xc285('0x10'));var Redis=require(_0xc285('0x11'));var authService=require(_0xc285('0x12'));var qs=require(_0xc285('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc285('0x14'));var logger=require(_0xc285('0x15'))(_0xc285('0x16'));var utils=require(_0xc285('0x17'));var config=require(_0xc285('0x18'));var licenseUtil=require(_0xc285('0x19'));var db=require('../../mysqldb')['db'];config[_0xc285('0x1a')]=_[_0xc285('0x1b')](config[_0xc285('0x1a')],{'host':_0xc285('0x1c'),'port':0x18eb});var socket=require(_0xc285('0x1d'))(new Redis(config[_0xc285('0x1a')]));require(_0xc285('0x1e'))[_0xc285('0x1f')](socket);function respondWithStatusCode(_0x3c06cb,_0x3a2b0c){_0x3a2b0c=_0x3a2b0c||0xcc;return function(_0x4d3e91){if(_0x4d3e91){return _0x3c06cb['sendStatus'](_0x3a2b0c);}return _0x3c06cb[_0xc285('0x20')](_0x3a2b0c)[_0xc285('0x21')]();};}function respondWithResult(_0x1bda85,_0x472fc4){_0x472fc4=_0x472fc4||0xc8;return function(_0x20ec22){if(_0x20ec22){return _0x1bda85[_0xc285('0x20')](_0x472fc4)['json'](_0x20ec22);}};}function respondWithFilteredResult(_0x1d284a,_0x572176){return function(_0xebe435){if(_0xebe435){var _0x409c1a=typeof _0x572176[_0xc285('0x22')]===_0xc285('0x23')&&typeof _0x572176[_0xc285('0x24')]===_0xc285('0x23');var _0x40be30=_0xebe435[_0xc285('0x25')];var _0x3494f5=_0x409c1a?0x0:_0x572176[_0xc285('0x22')];var _0x387de7=_0x409c1a?_0xebe435[_0xc285('0x25')]:_0x572176['offset']+_0x572176[_0xc285('0x24')];var _0x416bc2;if(_0x387de7>=_0x40be30){_0x387de7=_0x40be30;_0x416bc2=0xc8;}else{_0x416bc2=0xce;}_0x1d284a['status'](_0x416bc2);return _0x1d284a[_0xc285('0x26')](_0xc285('0x27'),_0x3494f5+'-'+_0x387de7+'/'+_0x40be30)['json'](_0xebe435);}return null;};}function patchUpdates(_0x362c41){return function(_0xeae241){try{jsonpatch['apply'](_0xeae241,_0x362c41,!![]);}catch(_0x4c80f9){return BPromise[_0xc285('0x28')](_0x4c80f9);}return _0xeae241['save']();};}function saveUpdates(_0x486172,_0x826b87){return function(_0x58937b){if(_0x58937b){return _0x58937b['update'](_0x486172)[_0xc285('0x29')](function(_0x414f99){return _0x414f99;});}return null;};}function removeEntity(_0x1b5f9f,_0x1b7e06){return function(_0x106e67){if(_0x106e67){return _0x106e67[_0xc285('0x2a')]()['then'](function(){_0x1b5f9f[_0xc285('0x20')](0xcc)[_0xc285('0x21')]();});}};}function handleEntityNotFound(_0x2d4e7c,_0x14dd68){return function(_0xd0516){if(!_0xd0516){_0x2d4e7c['sendStatus'](0x194);}return _0xd0516;};}function handleError(_0x4d4006,_0x14534e){_0x14534e=_0x14534e||0x1f4;return function(_0x1cba2f){logger[_0xc285('0x2b')](_0x1cba2f[_0xc285('0x2c')]);if(_0x1cba2f[_0xc285('0x2d')]){delete _0x1cba2f['name'];}_0x4d4006[_0xc285('0x20')](_0x14534e)[_0xc285('0x2e')](_0x1cba2f);};}function getInteractionUsers(_0x2d44b3,_0x4140b5){return new BPromise(function(_0x7f1483,_0x2b7b0e){try{if(_0x4140b5[_0x2d44b3['id']]){_0x2d44b3[_0xc285('0x2f')]=_[_0xc285('0x30')](_0x4140b5[_0x2d44b3['id']],function(_0x4b8019){return{'id':_0x4b8019['id'],'fullname':_0x4b8019[_0xc285('0x31')]};});}}catch(_0x25c044){_0x2b7b0e(_0x25c044);}_0x7f1483(_0x2d44b3);});}function getInteractionTags(_0x3825b3,_0x23a243){return new BPromise(function(_0x2a0ac9,_0x54e506){try{if(_0x3825b3['TagIds']){_0x3825b3['Tags']=[];_0x3825b3['TagIds'][_0xc285('0x32')](',')[_0xc285('0x33')](function(_0x3e8bf0){_0x3825b3[_0xc285('0x34')]['push'](_0x23a243[_0x3e8bf0]);});}delete _0x3825b3[_0xc285('0x35')];}catch(_0x2e4601){_0x54e506(_0x2e4601);}_0x2a0ac9(_0x3825b3);});}function getLastMessageText(_0x448958){return new BPromise(function(_0x5177b1,_0x122dda){return db[_0xc285('0x36')][_0xc285('0x37')]({'where':{'$and':[{'MailInteractionId':_0x448958['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':'out'},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':['plainBody'],'order':_0xc285('0x38'),'raw':!![]})['then'](function(_0x316071){if(_0x316071&&_0x316071[_0xc285('0x39')]){_0x448958[_0xc285('0x3a')]=_[_0xc285('0x3b')](_0x316071[_0xc285('0x39')]);}_0x5177b1(_0x448958);})[_0xc285('0x3c')](function(_0x597292){_0x122dda(_0x597292);});});}function updateMailInteraction(_0x31212e,_0x342650,_0x24887a,_0x1c5da3){return new BPromise(function(_0x414bd7,_0x30f7e0){return getInteractionUsers(_0x31212e,_0x24887a)[_0xc285('0x29')](function(_0x5bbb61){return getInteractionTags(_0x5bbb61,_0x342650);})['then'](function(_0x5575e9){if(_0x1c5da3){_0x414bd7(getLastMessageText(_0x5575e9));}else{_0x414bd7(_0x5575e9);}})[_0xc285('0x3c')](function(_0x52abd0){_0x30f7e0(_0x52abd0);});});}exports['index']=function(_0x3bd8ed,_0x10d890){var _0xb612df={},_0xe32534={},_0x2b443c={'count':0x0,'rows':[]};var _0x11aee8=_['map'](db[_0xc285('0x3d')]['rawAttributes'],function(_0x431f33){return{'name':_0x431f33['fieldName'],'type':_0x431f33[_0xc285('0x3e')][_0xc285('0x3f')]};});_0xe32534['model']=_['map'](_0x11aee8,_0xc285('0x2d'));_0xe32534['query']=_[_0xc285('0x40')](_0x3bd8ed['query']);_0xe32534[_0xc285('0x41')]=_[_0xc285('0x42')](_0xe32534[_0xc285('0x43')],_0xe32534[_0xc285('0x44')]);_0xb612df[_0xc285('0x45')]=_['intersection'](_0xe32534['model'],qs[_0xc285('0x46')](_0x3bd8ed[_0xc285('0x44')]['fields']));_0xb612df['attributes']=_0xb612df[_0xc285('0x45')][_0xc285('0x47')]?_0xb612df[_0xc285('0x45')]:_0xe32534[_0xc285('0x43')];if(!_0x3bd8ed[_0xc285('0x44')]['hasOwnProperty']('nolimit')){_0xb612df['limit']=qs[_0xc285('0x24')](_0x3bd8ed[_0xc285('0x44')][_0xc285('0x24')]);_0xb612df[_0xc285('0x22')]=qs[_0xc285('0x22')](_0x3bd8ed['query'][_0xc285('0x22')]);}_0xb612df['order']=qs['sort'](_0x3bd8ed[_0xc285('0x44')][_0xc285('0x48')]);_0xb612df['where']=qs[_0xc285('0x41')](_['pick'](_0x3bd8ed[_0xc285('0x44')],_0xe32534['filters']),_0x11aee8);var _0x1a27d2=[];var _0x330193=squel[_0xc285('0x49')]()['field']('id')[_0xc285('0x4a')]('name')[_0xc285('0x4a')](_0xc285('0x4b'))[_0xc285('0x4c')](_0xc285('0x4d'));var _0x514a39=squel[_0xc285('0x49')]()[_0xc285('0x4a')](_0xc285('0x4e'))[_0xc285('0x4a')](_0xc285('0x4f'))[_0xc285('0x4a')]('ui.MailInteractionId')[_0xc285('0x4c')](_0xc285('0x50'),'ui')['left_join'](_0xc285('0x51'),'u',_0xc285('0x52'));var _0x3d365b=squel[_0xc285('0x49')]()[_0xc285('0x4c')](_0xc285('0x53'),'i')['left_join']('cm_contacts','c',_0xc285('0x54'))[_0xc285('0x55')](_0xc285('0x51'),'o',_0xc285('0x56'))[_0xc285('0x55')](_0xc285('0x57'),'a',_0xc285('0x58'))[_0xc285('0x55')](_0xc285('0x59'),'me','me.MailInteractionId\x20=\x20i.id')[_0xc285('0x55')](_0xc285('0x5a'),'it',_0xc285('0x5b'))[_0xc285('0x55')](_0xc285('0x4d'),'t',_0xc285('0x5c'));var _0x5253f5=squel[_0xc285('0x5d')]();var _0xfc6c2f=[];var _0x256560=squel[_0xc285('0x5d')]();var _0x32ab5b;if(_0x3bd8ed['query'][_0xc285('0x5e')]){_0x32ab5b=as['parseSearch'](_0x3bd8ed['query']['search']);var _0x18f53b=_0x32ab5b[_0xc285('0x5f')];for(var _0x63464f=0x0;_0x63464f<_0x32ab5b[_0xc285('0x60')]['length'];_0x63464f++){var _0x46447d=_0x32ab5b['conditions'][_0x63464f];var _0x4aa0a5='i';var _0x4ca70d=_['find'](_0x11aee8,['name',_0x46447d['field']]);if(!_0x4ca70d){switch(_0x46447d['field']){case'unreadMessages':if(_0x46447d[_0xc285('0x61')]==0x1){_0x3d365b[_0xc285('0x62')]('`'+_0x46447d[_0xc285('0x4a')]+_0xc285('0x63'));}else{_0x3d365b['having']('`'+_0x46447d[_0xc285('0x4a')]+'`\x20>\x200');}break;case _0xc285('0x64'):if(_0x46447d['operator']===_0xc285('0x65')){if(_0x46447d['value'][_0xc285('0x32')]('\x20')[_0xc285('0x47')]>0x1){_0x5253f5[_0x18f53b](_0xc285('0x66'),qs[_0xc285('0x67')](_0x46447d[_0xc285('0x61')]),null);}else{var _0x523b47='%'+_0x46447d[_0xc285('0x61')]+'%';_0x5253f5[_0x18f53b](_0xc285('0x68'),_0x523b47,_0x523b47,_0x523b47);}}else{_0x4ca70d=_['find'](_0x11aee8,[_0xc285('0x2d'),'ContactId']);_0x46447d[_0xc285('0x4a')]=_0xc285('0x69');_0x3973ad=as['buildExpression'](_0x4aa0a5,_0x4ca70d['type'],_0x46447d);_0x5253f5[_0x18f53b](_0x3973ad[_0xc285('0x6a')],_0x3973ad[_0xc285('0x61')][_0xc285('0x6b')],_0x3973ad[_0xc285('0x61')][_0xc285('0x21')]);}break;case _0xc285('0x6c'):var _0x5f0988=_0x46447d[_0xc285('0x61')][_0xc285('0x32')](',')[_0xc285('0x30')](function(_0x215c6d){return Number(_0x215c6d);});_0x5f0988['forEach'](function(_0xb2cf70){_0x256560['or'](_0xc285('0x6d'),'%,'+_0xb2cf70+',%');});_0xfc6c2f=_[_0xc285('0x6e')](_0xfc6c2f,_0x5f0988);break;case _0xc285('0x6f'):if(_0x46447d[_0xc285('0x70')]===_0xc285('0x65')){_0x5253f5[_0x18f53b](_0xc285('0x71'),'%'+_0x46447d[_0xc285('0x61')]+'%',null);}else{_0x4ca70d=_[_0xc285('0x72')](_0x11aee8,[_0xc285('0x2d'),_0xc285('0x73')]);_0x46447d[_0xc285('0x4a')]=_0xc285('0x73');_0x3973ad=as[_0xc285('0x74')](_0x4aa0a5,_0x4ca70d['type'],_0x46447d);_0x5253f5[_0x18f53b](_0x3973ad[_0xc285('0x6a')],_0x3973ad[_0xc285('0x61')][_0xc285('0x6b')],_0x3973ad['value'][_0xc285('0x21')]);}break;case _0xc285('0x39'):_0x3973ad=as[_0xc285('0x74')]('me',null,_0x46447d);_0x5253f5[_0x18f53b](_0x3973ad['text'],_0x3973ad[_0xc285('0x61')]['start'],_0x3973ad['value']['end']);break;}}else{var _0x3973ad=as[_0xc285('0x74')](_0x4aa0a5,_0x4ca70d[_0xc285('0x3e')],_0x46447d);_0x5253f5[_0x18f53b](_0x3973ad[_0xc285('0x6a')],_0x3973ad[_0xc285('0x61')][_0xc285('0x6b')],_0x3973ad[_0xc285('0x61')][_0xc285('0x21')]);}}}else{var _0x25bd77=_(_0x3bd8ed['query'])[_0xc285('0x40')]()[_0xc285('0x30')](function(_0x1d8d54){return _[_0xc285('0x75')](_0x11aee8,[_0xc285('0x2d'),_0x1d8d54])?_0x1d8d54:undefined;})['compact']()[_0xc285('0x61')]();if(!_[_0xc285('0x76')](_0x25bd77)){_0x25bd77['forEach'](function(_0x4caafe){if(_0x4caafe===_0xc285('0x77')){_0x3d365b['where'](_0xc285('0x78'),[]['concat'](_0x3bd8ed['query'][_0x4caafe]));}else if(_0x4caafe==='createdAt'){var _0x1152cd=JSON['parse'](_0x3bd8ed[_0xc285('0x44')][_0x4caafe])[_0xc285('0x79')];var _0x14063d=JSON[_0xc285('0x7a')](_0x3bd8ed[_0xc285('0x44')][_0x4caafe])[_0xc285('0x7b')];_0x3d365b['where']('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x1152cd,_0x14063d);}else{if(_0x3bd8ed['query'][_0x4caafe]===_0xc285('0x7c')){_0x3d365b[_0xc285('0x7d')]('i.'+_0x4caafe+_0xc285('0x7e'));}else{_0x3d365b[_0xc285('0x7d')]('i.'+_0x4caafe+_0xc285('0x7f'),_0x3bd8ed[_0xc285('0x44')][_0x4caafe]);}}});}if(_0x3bd8ed['query'][_0xc285('0x80')]){if(_0x3bd8ed[_0xc285('0x44')][_0xc285('0x80')]==0x1){_0x3d365b[_0xc285('0x62')](_0xc285('0x81'));}else{_0x3d365b[_0xc285('0x62')]('`unreadMessages`\x20>\x200');}}if(_0x3bd8ed[_0xc285('0x44')][_0xc285('0x82')]){_0xfc6c2f=_[_0xc285('0x83')](_0x3bd8ed[_0xc285('0x44')][_0xc285('0x82')])?_0x3bd8ed[_0xc285('0x44')][_0xc285('0x82')]:new Array(_0x3bd8ed[_0xc285('0x44')][_0xc285('0x82')]);_0xfc6c2f['forEach'](function(_0x158ff3){_0x256560['or'](_0xc285('0x6d'),'%,'+_0x158ff3+',%');});}if(_0x3bd8ed['query'][_0xc285('0x84')]){var _0x171c9a=_0x3bd8ed[_0xc285('0x44')][_0xc285('0x84')][_0xc285('0x85')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(qs[_0xc285('0x86')](_0x171c9a)){_0x5253f5['or'](_0xc285('0x87'),_0x171c9a+'%');}else if(qs[_0xc285('0x88')](_0x171c9a)){_0x5253f5['or'](_0xc285('0x89'),_0x171c9a+'%');}else{_0x5253f5['or'](_0xc285('0x8a'),qs[_0xc285('0x67')](_0x171c9a))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0xc285('0x67')](_0x171c9a));}}}_0x3d365b['where'](_0x5253f5);_0x3d365b['group'](_0xc285('0x8b'));var _0x15d8b1={'type':db[_0xc285('0x8c')]['QueryTypes'][_0xc285('0x8d')],'raw':!![]};var _0x190e24=_0x3d365b[_0xc285('0x8e')]();_0x190e24['field'](_0xc285('0x8b'));_0x190e24[_0xc285('0x4a')](_0xc285('0x8f'),'unreadMessages');if(_0xb612df[_0xc285('0x90')]){_0xb612df[_0xc285('0x90')][_0xc285('0x33')](function(_0x5df23a){var _0x558eee=_0x5df23a[0x0]===_0xc285('0x91')?_0x5df23a[0x0]:'i.'+_0x5df23a[0x0];_0x3d365b[_0xc285('0x90')](_0x558eee,_0x5df23a[0x1]===_0xc285('0x92')?![]:!![]);});}if(!_[_0xc285('0x76')](_0xfc6c2f)){_0x3d365b[_0xc285('0x62')](_0x256560);_0x190e24[_0xc285('0x7d')](_0xc285('0x93'),_0xfc6c2f);}BPromise[_0xc285('0x94')]()[_0xc285('0x29')](function(){if(!_0x32ab5b){if(_0x3bd8ed[_0xc285('0x44')]['MailAccountId'])return;_0x190e24[_0xc285('0x7d')](_0xc285('0x95'));_0x3d365b[_0xc285('0x7d')](_0xc285('0x95'));return;}if(_0x3bd8ed[_0xc285('0x96')][_0xc285('0x97')]!==_0xc285('0x98'))return;return _0x3bd8ed[_0xc285('0x96')]['getMailAccounts']({'attributes':['id'],'raw':!![]})[_0xc285('0x29')](function(_0xfa70c6){if(_['isEmpty'](_0xfa70c6)){_0x190e24[_0xc285('0x7d')]('i.MailAccountId\x20IS\x20NULL');_0x3d365b[_0xc285('0x7d')]('i.MailAccountId\x20IS\x20NULL');}else{_0x190e24[_0xc285('0x7d')](_0xc285('0x78'),_[_0xc285('0x30')](_0xfa70c6,'id'));_0x3d365b[_0xc285('0x7d')](_0xc285('0x78'),_['map'](_0xfa70c6,'id'));}});})[_0xc285('0x29')](function(){if(_0x3bd8ed[_0xc285('0x96')][_0xc285('0x97')]===_0xc285('0x98')&&!_0x32ab5b&&!_0x3bd8ed[_0xc285('0x44')]['MailAccountId'])return[];return db['sequelize'][_0xc285('0x44')](_0x190e24['toString'](),_0x15d8b1);})[_0xc285('0x29')](function(_0x2c7f79){_0x2b443c['count']=_0x2c7f79[_0xc285('0x47')];if(_0x2b443c[_0xc285('0x25')]===0x0)return[];return db[_0xc285('0x99')][_0xc285('0x44')](_0x330193[_0xc285('0x9a')](),_0x15d8b1)[_0xc285('0x29')](function(_0x5c5dfb){_0x1a27d2=_[_0xc285('0x9b')](_0x5c5dfb,'id');_0x15d8b1=_[_0xc285('0x9c')](_0x15d8b1,{'model':db[_0xc285('0x3d')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3bd8ed[_0xc285('0x44')]['fields']){_0xb612df[_0xc285('0x45')]['forEach'](function(_0x138cda){_0x3d365b[_0xc285('0x4a')]('i.'+_0x138cda);});}else{_0x3d365b[_0xc285('0x4a')](_0xc285('0x8f'),'unreadMessages');_0x3d365b[_0xc285('0x4a')](_0xc285('0x9d'),_0xc285('0x9e'));_0x3d365b[_0xc285('0x4a')](_0xc285('0x9f'),_0xc285('0xa0'));_0x3d365b[_0xc285('0x4a')](_0xc285('0xa1'),'contactName');_0x3d365b['field'](_0xc285('0x8b'));_0x3d365b[_0xc285('0x4a')](_0xc285('0xa2'));_0x3d365b[_0xc285('0x4a')](_0xc285('0xa3'));_0x3d365b['field'](_0xc285('0xa4'));_0x3d365b[_0xc285('0x4a')](_0xc285('0xa5'));_0x3d365b['field'](_0xc285('0xa6'));_0x3d365b[_0xc285('0x4a')]('i.lastMsgAt');_0x3d365b['field'](_0xc285('0xa7'));_0x3d365b[_0xc285('0x4a')](_0xc285('0xa8'));_0x3d365b[_0xc285('0x4a')](_0xc285('0xa9'));_0x3d365b[_0xc285('0x4a')]('i.secondDisposition');_0x3d365b[_0xc285('0x4a')](_0xc285('0xaa'));_0x3d365b[_0xc285('0x4a')]('i.substatus');_0x3d365b['field'](_0xc285('0xab'));_0x3d365b['field']('i.ContactId');_0x3d365b['field']('i.MailAccountId');_0x3d365b['field'](_0xc285('0xac'));_0x3d365b['field'](_0xc285('0xad'),'Contact.firstName');_0x3d365b[_0xc285('0x4a')](_0xc285('0xae'),'Contact.lastName');_0x3d365b[_0xc285('0x4a')]('c.email','Contact.email');_0x3d365b[_0xc285('0x4a')](_0xc285('0xaf'),_0xc285('0xb0'));_0x3d365b['field'](_0xc285('0xb1'),_0xc285('0xb2'));_0x3d365b[_0xc285('0x4a')]('c.fax','Contact.fax');_0x3d365b[_0xc285('0x4a')](_0xc285('0xb3'),_0xc285('0xb4'));_0x3d365b[_0xc285('0x4a')](_0xc285('0xb5'),'Owner.internal');_0x3d365b[_0xc285('0x4a')](_0xc285('0xb6'),'TagIds');}if(_0xb612df[_0xc285('0x24')])_0x3d365b[_0xc285('0x24')](_0xb612df[_0xc285('0x24')]);if(_0xb612df[_0xc285('0x22')])_0x3d365b['offset'](_0xb612df[_0xc285('0x22')]);return db[_0xc285('0x99')][_0xc285('0x44')](_0x3d365b[_0xc285('0x9a')](),_0x15d8b1);})[_0xc285('0x29')](function(_0x1e05f4){if(_0x1e05f4[_0xc285('0x47')]>0x0)_0x514a39['where'](_0xc285('0xb7'),_[_0xc285('0x30')](_0x1e05f4,'id'));return db['sequelize'][_0xc285('0x44')](_0x514a39[_0xc285('0x9a')](),_0x15d8b1)[_0xc285('0x29')](function(_0x117add){var _0x3eb05f=_[_0xc285('0xb8')](_0x117add,_0xc285('0xb9'));var _0x2c3e33=[];return db['Setting'][_0xc285('0x37')]({'attributes':[_0xc285('0xba')],'raw':!![]})[_0xc285('0x29')](function(_0xceec30){var _0x5f522f=_0xceec30[_0xc285('0xba')];_0x1e05f4[_0xc285('0x33')](function(_0x134f5c){_0x2c3e33[_0xc285('0xbb')](updateMailInteraction(_0x134f5c,_0x1a27d2,_0x3eb05f,_0x5f522f));});return BPromise[_0xc285('0xbc')](_0x2c3e33);});});});})[_0xc285('0x29')](function(_0x3fac56){_0x2b443c[_0xc285('0xbd')]=_0x3fac56;return _0x2b443c;})[_0xc285('0x29')](respondWithFilteredResult(_0x10d890,_0xb612df))[_0xc285('0x3c')](handleError(_0x10d890,null));};exports['show']=function(_0x2ece4d,_0x579d3d){var _0xa4388d={'raw':![],'where':{'id':_0x2ece4d[_0xc285('0xbe')]['id']}},_0x2101d4={};_0x2101d4['model']=_[_0xc285('0x40')](db[_0xc285('0x3d')][_0xc285('0xbf')]);_0x2101d4[_0xc285('0x44')]=_[_0xc285('0x40')](_0x2ece4d[_0xc285('0x44')]);_0x2101d4[_0xc285('0x41')]=_[_0xc285('0x42')](_0x2101d4[_0xc285('0x43')],_0x2101d4[_0xc285('0x44')]);_0xa4388d['attributes']=_[_0xc285('0x42')](_0x2101d4['model'],qs[_0xc285('0x46')](_0x2ece4d[_0xc285('0x44')]['fields']));_0xa4388d[_0xc285('0x45')]=_0xa4388d[_0xc285('0x45')][_0xc285('0x47')]?_0xa4388d[_0xc285('0x45')]:_0x2101d4[_0xc285('0x43')];if(_0x2ece4d[_0xc285('0x44')][_0xc285('0xc0')]){_0xa4388d[_0xc285('0xc1')]=[{'all':!![]}];}_0xa4388d=_[_0xc285('0x9c')]({},_0xa4388d,_0x2ece4d[_0xc285('0xc2')]);return db[_0xc285('0x3d')][_0xc285('0x72')](_0xa4388d)['then'](handleEntityNotFound(_0x579d3d,null))[_0xc285('0x29')](respondWithResult(_0x579d3d,null))[_0xc285('0x3c')](handleError(_0x579d3d,null));};exports['create']=function(_0x2107bc,_0xf38ad7){return db['MailInteraction'][_0xc285('0xc3')](_0x2107bc[_0xc285('0xc4')],{})[_0xc285('0x29')](respondWithResult(_0xf38ad7,0xc9))[_0xc285('0x3c')](handleError(_0xf38ad7,null));};exports[_0xc285('0xc5')]=function(_0x33a09c,_0x736a36){if(_0x33a09c[_0xc285('0xc4')]['id']){delete _0x33a09c['body']['id'];}return db['MailInteraction'][_0xc285('0x72')]({'where':{'id':_0x33a09c[_0xc285('0xbe')]['id']}})['then'](handleEntityNotFound(_0x736a36,null))['then'](saveUpdates(_0x33a09c[_0xc285('0xc4')],null))[_0xc285('0x29')](respondWithResult(_0x736a36,null))[_0xc285('0x3c')](handleError(_0x736a36,null));};exports[_0xc285('0x2a')]=function(_0x83cb18,_0x19a9da){return db[_0xc285('0x3d')][_0xc285('0x72')]({'where':{'id':_0x83cb18[_0xc285('0xbe')]['id']}})[_0xc285('0x29')](handleEntityNotFound(_0x19a9da,null))[_0xc285('0x29')](removeEntity(_0x19a9da,null))[_0xc285('0x3c')](handleError(_0x19a9da,null));};exports[_0xc285('0xc6')]=function(_0x32f1ca,_0x2cb5c5){return db['MailInteraction'][_0xc285('0xc6')]()[_0xc285('0x29')](respondWithResult(_0x2cb5c5,null))[_0xc285('0x3c')](handleError(_0x2cb5c5,null));};exports['addMessage']=function(_0x11eeae,_0x8a9941,_0x3aa2d9){return db[_0xc285('0x36')][_0xc285('0x72')]({'where':{'id':_0x11eeae[_0xc285('0xbe')]['id']}})[_0xc285('0x29')](handleEntityNotFound(_0x8a9941,null))['then'](function(_0xc47349){if(_0xc47349){return _0xc47349[_0xc285('0xc7')](_0x11eeae[_0xc285('0xc4')][_0xc285('0xc8')],_[_0xc285('0xc9')](_0x11eeae[_0xc285('0xc4')],[_0xc285('0xc8'),'id'])||{});}})[_0xc285('0x29')](respondWithResult(_0x8a9941,null))[_0xc285('0x3c')](handleError(_0x8a9941,null));};exports['getMessages']=function(_0x371eab,_0x14e359,_0xd9e3aa){var _0x41ffcc={'raw':![],'where':{}};var _0x3e74e4={};var _0x12e126={'count':0x0,'rows':[]};return db[_0xc285('0x3d')][_0xc285('0x37')]({'where':{'id':_0x371eab[_0xc285('0xbe')]['id']}})['then'](handleEntityNotFound(_0x14e359,null))[_0xc285('0x29')](function(_0x2bdb66){if(_0x2bdb66){_0x3e74e4['model']=_[_0xc285('0x40')](db[_0xc285('0x36')][_0xc285('0xbf')]);_0x3e74e4[_0xc285('0x44')]=_[_0xc285('0x40')](_0x371eab[_0xc285('0x44')]);_0x3e74e4[_0xc285('0x41')]=_[_0xc285('0x42')](_0x3e74e4[_0xc285('0x43')],_0x3e74e4[_0xc285('0x44')]);_0x41ffcc[_0xc285('0x45')]=_[_0xc285('0x42')](_0x3e74e4['model'],qs[_0xc285('0x46')](_0x371eab[_0xc285('0x44')][_0xc285('0x46')]));_0x41ffcc[_0xc285('0x45')]=_0x41ffcc['attributes']['length']?_0x41ffcc['attributes']:_0x3e74e4[_0xc285('0x43')];if(!_0x371eab[_0xc285('0x44')]['hasOwnProperty']('nolimit')){_0x41ffcc['limit']=qs[_0xc285('0x24')](_0x371eab[_0xc285('0x44')][_0xc285('0x24')]);_0x41ffcc[_0xc285('0x22')]=qs['offset'](_0x371eab[_0xc285('0x44')][_0xc285('0x22')]);}_0x41ffcc['order']=qs[_0xc285('0x48')](_0x371eab['query'][_0xc285('0x48')]);_0x41ffcc[_0xc285('0x7d')]=qs[_0xc285('0x41')](_[_0xc285('0xca')](_0x371eab['query'],_0x3e74e4['filters']));_0x41ffcc['where'][_0xc285('0xb9')]=_0x2bdb66['id'];if(_0x371eab[_0xc285('0x44')][_0xc285('0x84')]){_0x41ffcc['where']=_['merge'](_0x41ffcc[_0xc285('0x7d')],{'$or':_['map'](_0x41ffcc[_0xc285('0x45')],function(_0x394b71){var _0x51a905={};_0x51a905[_0x394b71]={'$like':'%'+_0x371eab['query'][_0xc285('0x84')]+'%'};return _0x51a905;})});}if(_0x371eab[_0xc285('0x44')][_0xc285('0x79')]){var _0x3b9244=_0x371eab[_0xc285('0x44')]['$gte']['split'](',');var _0x2e0974={};_0x2e0974[_0x3b9244[0x0]]={'$gte':moment(_0x3b9244[0x1])[_0xc285('0xcb')](_0xc285('0xcc'))};_0x41ffcc[_0xc285('0x7d')]=_[_0xc285('0x9c')](_0x41ffcc[_0xc285('0x7d')],_0x2e0974);}_0x41ffcc=_[_0xc285('0x9c')]({},_0x41ffcc,_0x371eab['options']);return db['MailMessage']['count']({'where':_0x41ffcc[_0xc285('0x7d')]})[_0xc285('0x29')](function(_0x39de27){_0x12e126[_0xc285('0x25')]=_0x39de27;if(_0x371eab[_0xc285('0x44')][_0xc285('0xc0')]){_0x41ffcc[_0xc285('0xc1')]=[{'all':!![]}];}return db[_0xc285('0x36')]['findAll'](_0x41ffcc);})[_0xc285('0x29')](function(_0x1876a7){if(_0x371eab['query'][_0xc285('0xcd')]===_0xc285('0xce')){for(var _0x469e27=0x0;_0x469e27<_0x1876a7[_0xc285('0x47')];_0x469e27++){_0x1876a7[_0x469e27]['body']=juice(_0x1876a7[_0x469e27][_0xc285('0xc4')]);}}_0x12e126['rows']=_0x1876a7;return _0x12e126;});}})[_0xc285('0x29')](respondWithFilteredResult(_0x14e359,_0x41ffcc))[_0xc285('0x3c')](handleError(_0x14e359,null));};exports['addTags']=function(_0x48b8a5,_0xec52f1,_0x21ac17){return db['MailInteraction']['find']({'where':{'id':_0x48b8a5['params']['id']}})[_0xc285('0x29')](handleEntityNotFound(_0xec52f1,null))[_0xc285('0x29')](function(_0x4b2596){if(_0x4b2596){return _0x4b2596[_0xc285('0xcf')](_0x48b8a5[_0xc285('0xc4')][_0xc285('0xc8')],_[_0xc285('0xc9')](_0x48b8a5['body'],[_0xc285('0xc8'),'id'])||{})['spread'](function(){return db[_0xc285('0x6c')][_0xc285('0xd0')]({'attributes':['id',_0xc285('0x2d'),'color'],'where':{'id':_0x48b8a5['body'][_0xc285('0xc8')]}});})[_0xc285('0x29')](function(_0x26cf70){socket[_0xc285('0xd1')](_0xc285('0xd2'),{'id':Number(_0x48b8a5[_0xc285('0xbe')]['id']),'tags':_0x26cf70||[]});return{'id':Number(_0x48b8a5[_0xc285('0xbe')]['id']),'tags':_0x26cf70||[]};});}})[_0xc285('0x29')](respondWithResult(_0xec52f1,null))[_0xc285('0x3c')](handleError(_0xec52f1,null));};exports[_0xc285('0xd3')]=function(_0x17ec5a,_0x31c77c,_0xe1ab3f){return db[_0xc285('0x3d')][_0xc285('0x72')]({'where':{'id':_0x17ec5a[_0xc285('0xbe')]['id']}})['then'](handleEntityNotFound(_0x31c77c,null))['then'](function(_0x1f1e52){if(_0x1f1e52){return _0x1f1e52['removeTags'](_0x17ec5a[_0xc285('0x44')][_0xc285('0xc8')]);}})[_0xc285('0x29')](respondWithStatusCode(_0x31c77c,null))[_0xc285('0x3c')](handleError(_0x31c77c,null));};exports[_0xc285('0xd4')]=function(_0x39b62f,_0x10a70d){var _0x4a2719=moment()[_0xc285('0xd5')]()[_0xc285('0x9a')]();var _0x37c00e=path[_0xc285('0xd6')](config[_0xc285('0xd7')],_0xc285('0xd8'),'files',_0xc285('0xd9'));var _0x22f26e=path[_0xc285('0xd6')](config[_0xc285('0xd7')],_0xc285('0xd8'),_0xc285('0xda'),_0xc285('0xdb'));var _0x5be246=path[_0xc285('0xd6')](_0x37c00e,_0x4a2719);var _0x1940b2=util[_0xc285('0xcb')](_0xc285('0xdc'),_0x39b62f[_0xc285('0xbe')]['id'],_0x4a2719);var _0x58d0ad=path[_0xc285('0xd6')](_0x37c00e,_0x1940b2);var _0x274a90=[];if(_0x39b62f[_0xc285('0x44')][_0xc285('0xdb')]){_0x274a90[_0xc285('0xbb')]({'model':db[_0xc285('0xdd')],'as':_0xc285('0xde'),'raw':!![]});}var _0x177bbc=[{'model':db[_0xc285('0x36')],'as':_0xc285('0xdf'),'attributes':['id',_0xc285('0xc4'),_0xc285('0x4c'),'to','cc',_0xc285('0xe0'),_0xc285('0xe1'),_0xc285('0xe2')],'where':{'secret':![]},'order':qs[_0xc285('0x48')]('id'),'include':_0x274a90}];return db['MailInteraction']['find']({'where':{'id':_0x39b62f[_0xc285('0xbe')]['id']},'include':_0x177bbc})['then'](handleEntityNotFound(_0x10a70d,null))['then'](function(_0x2f525e){if(_0x2f525e&&_0x2f525e[_0xc285('0xdf')]){var _0x3ca65e=_0x2f525e[_0xc285('0xe3')]({'plain':!![]});fs[_0xc285('0xe4')](_0x5be246);return BPromise[_0xc285('0xe5')](_0x3ca65e['Messages'],function(_0x236dae,_0x272e31){var _0x2a4271={'from':_0x236dae[_0xc285('0x4c')],'to':_0x236dae['to'],'subject':_0x236dae[_0xc285('0xe1')],'html':_0x236dae['body'],'headers':{'Date':moment(_0x236dae['createdAt'])[_0xc285('0xcb')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x236dae['cc']){_0x2a4271[_0xc285('0xe6')]['Cc']=_0x236dae['cc'];}if(_0x236dae[_0xc285('0xe0')]){_0x2a4271[_0xc285('0xe6')][_0xc285('0xe7')]=_0x236dae[_0xc285('0xe0')];}return new BPromise(function(_0x446984,_0x5d65e1){if(_0x236dae[_0xc285('0xde')]){for(var _0x1d777f=0x0;_0x1d777f<_0x236dae[_0xc285('0xde')][_0xc285('0x47')];_0x1d777f++){var _0x16dece=_0x236dae[_0xc285('0xde')][_0x1d777f];var _0x473dbd=path['join'](_0x22f26e,_0x16dece[_0xc285('0xe8')]);if(fs['existsSync'](_0x473dbd)){_0x2a4271[_0xc285('0xdb')][_0xc285('0xbb')]({'name':_0x16dece[_0xc285('0x2d')],'contentType':_0x16dece[_0xc285('0x3e')],'data':fs[_0xc285('0xe9')](_0x473dbd)});}}}emlformat[_0xc285('0xea')](_0x2a4271,function(_0x150e62,_0xa80253){if(_0x150e62)return _0x5d65e1(_0x150e62);fs[_0xc285('0xeb')](path[_0xc285('0xd6')](_0x5be246,util[_0xc285('0xcb')](_0xc285('0xec'),_0x272e31)),_0xa80253);return _0x446984(_0xa80253);});});})[_0xc285('0x29')](function(){return new BPromise(function(_0x363c52,_0x2faf6c){zipdir(_0x5be246,{'saveTo':_0x58d0ad},function(_0x4d0682,_0x53fed2){if(_0x4d0682)return _0x2faf6c(_0x4d0682);return _0x363c52(_0x53fed2);});})[_0xc285('0x29')](function(){return new BPromise(function(_0x1fccdc,_0x3c736b){rimraf(_0x5be246,function(_0x56e25f){if(_0x56e25f)_0x3c736b(_0x56e25f);return _0x1fccdc();});});})[_0xc285('0x29')](function(){return _0x10a70d['download'](_0x58d0ad,_0x1940b2,function(_0x1dc3a0){if(_0x1dc3a0){console[_0xc285('0xed')](_0xc285('0xee'),_0x1dc3a0);}else{fs[_0xc285('0xef')](_0x58d0ad);}});});});}else{return _0x10a70d[_0xc285('0xf0')](0xc8);}})['catch'](handleError(_0x10a70d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index cfa6262..a211b8a 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 _0xf4c6=['map','findAll','then','setDataValue','unreadMessages','length','emit','hook','exports','events','../../mysqldb','MailInteraction','MailMessage','setMaxListeners','update','remove','Users'];(function(_0x4ae671,_0x17f444){var _0x2c7bcb=function(_0x27af31){while(--_0x27af31){_0x4ae671['push'](_0x4ae671['shift']());}};_0x2c7bcb(++_0x17f444);}(_0xf4c6,0x1b2));var _0x6f4c=function(_0x7cb10c,_0x2fcc3a){_0x7cb10c=_0x7cb10c-0x0;var _0x11df59=_0xf4c6[_0x7cb10c];return _0x11df59;};'use strict';var EventEmitter=require(_0x6f4c('0x0'));var MailInteraction=require(_0x6f4c('0x1'))['db'][_0x6f4c('0x2')];var MailMessage=require(_0x6f4c('0x1'))['db'][_0x6f4c('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x6f4c('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x6f4c('0x5'),'afterDestroy':_0x6f4c('0x6')};function emitEvent(_0x24948e){return function(_0x3a2599,_0x4262a9,_0x1e5bfb){_0x3a2599['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3f9e2a){_0x3a2599['setDataValue'](_0x6f4c('0x7'),_0x3f9e2a[_0x6f4c('0x8')](function(_0x151749){return{'id':_0x151749['id']};}));return MailMessage[_0x6f4c('0x9')]({'where':{'MailInteractionId':_0x3a2599['id'],'direction':'in','read':![]},'raw':!![]});})[_0x6f4c('0xa')](function(_0x4cb5cf){_0x3a2599[_0x6f4c('0xb')](_0x6f4c('0xc'),_0x4cb5cf[_0x6f4c('0xd')]);MailInteractionEvents['emit'](_0x24948e+':'+_0x3a2599['id'],_0x3a2599);MailInteractionEvents[_0x6f4c('0xe')](_0x24948e,_0x3a2599);_0x1e5bfb(null);})['catch'](_0x1e5bfb(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x6f4c('0xf')](e,emitEvent(event));}}module[_0x6f4c('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xb623=['update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','hasOwnProperty','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners','save'];(function(_0x4c7935,_0x4a53fb){var _0x30651d=function(_0x12f35f){while(--_0x12f35f){_0x4c7935['push'](_0x4c7935['shift']());}};_0x30651d(++_0x4a53fb);}(_0xb623,0x1e7));var _0x3b62=function(_0xa914c4,_0x104186){_0xa914c4=_0xa914c4-0x0;var _0x447703=_0xb623[_0xa914c4];return _0x447703;};'use strict';var EventEmitter=require(_0x3b62('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x3b62('0x1')];var MailMessage=require(_0x3b62('0x2'))['db'][_0x3b62('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x3b62('0x4')](0x0);var events={'afterCreate':_0x3b62('0x5'),'afterUpdate':_0x3b62('0x6'),'afterDestroy':_0x3b62('0x7')};function emitEvent(_0x5848b6){return function(_0x318167,_0x4651aa,_0x367d4d){_0x318167[_0x3b62('0x8')]({'attributes':['id'],'raw':!![]})[_0x3b62('0x9')](function(_0x7f2ec9){_0x318167[_0x3b62('0xa')](_0x3b62('0xb'),_0x7f2ec9[_0x3b62('0xc')](function(_0x1e4a00){return{'id':_0x1e4a00['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x318167['id'],'direction':'in','read':![]},'raw':!![]});})[_0x3b62('0x9')](function(_0x9d27fc){_0x318167[_0x3b62('0xa')](_0x3b62('0xd'),_0x9d27fc['length']);MailInteractionEvents['emit'](_0x5848b6+':'+_0x318167['id'],_0x318167);MailInteractionEvents['emit'](_0x5848b6,_0x318167);_0x367d4d(null);})['catch'](_0x367d4d(null));};}for(var e in events){if(events[_0x3b62('0xe')](e)){var event=events[e];MailInteraction[_0x3b62('0xf')](e,emitEvent(event));}}module[_0x3b62('0x10')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index 0e30e76..cdc2d30 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 _0x4fbf=['catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','subject','FULLTEXT','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','substatus','changed','models','MailMessage','update','then'];(function(_0x1ddd3e,_0x128886){var _0x33d056=function(_0x4b5619){while(--_0x4b5619){_0x1ddd3e['push'](_0x1ddd3e['shift']());}};_0x33d056(++_0x128886);}(_0x4fbf,0x1a7));var _0xf4fb=function(_0x1edee5,_0x30ea9d){_0x1edee5=_0x1edee5-0x0;var _0x4f0db7=_0x4fbf[_0x1edee5];return _0x4f0db7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf4fb('0x0'))(_0xf4fb('0x1'));var moment=require(_0xf4fb('0x2'));var BPromise=require('bluebird');var rp=require(_0xf4fb('0x3'));var fs=require('fs');var path=require(_0xf4fb('0x4'));var rimraf=require(_0xf4fb('0x5'));var config=require(_0xf4fb('0x6'));var attributes=require(_0xf4fb('0x7'));module[_0xf4fb('0x8')]=function(_0x55c53f,_0x368f93){return _0x55c53f[_0xf4fb('0x9')](_0xf4fb('0xa'),attributes,{'tableName':_0xf4fb('0xb'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0xf4fb('0xc'),'to'],'type':_0xf4fb('0xd')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x59f56c,_0x334a45,_0x1d88ae){if(_0x59f56c['substatus']){_0x59f56c[_0xf4fb('0xe')]=moment()[_0xf4fb('0xf')](_0xf4fb('0x10'));}if(_0x59f56c[_0xf4fb('0x11')]){_0x59f56c[_0xf4fb('0x12')]=moment()['format'](_0xf4fb('0x10'));}_0x1d88ae(null,_0x334a45);},'beforeUpdate':function(_0x1308f5,_0x5ae3e6,_0x38d6ba){if(_0x1308f5['changed'](_0xf4fb('0x13'))){_0x1308f5[_0xf4fb('0xe')]=_0x1308f5[_0xf4fb('0x13')]?moment()[_0xf4fb('0xf')](_0xf4fb('0x10')):null;}if(_0x1308f5[_0xf4fb('0x14')](_0xf4fb('0x11'))){_0x1308f5[_0xf4fb('0x12')]=moment()[_0xf4fb('0xf')](_0xf4fb('0x10'));_0x1308f5[_0xf4fb('0x13')]=null;_0x1308f5['substatusAt']=null;}_0x38d6ba(null,_0x1308f5);},'afterUpdate':function(_0x2425fd,_0x17069e,_0x3c95ae){var _0x1be788=_0x55c53f[_0xf4fb('0x15')];var _0x104e04=_0x2425fd['get']({'plain':!![]});if(_0x104e04[_0xf4fb('0x11')]){return _0x1be788[_0xf4fb('0x16')][_0xf4fb('0x17')]({'read':!![]},{'where':{'MailInteractionId':_0x104e04['id']}})[_0xf4fb('0x18')](function(){_0x3c95ae();})[_0xf4fb('0x19')](function(_0x576eb1){_0x3c95ae(_0x576eb1);});}else{_0x3c95ae();}}},'charset':_0xf4fb('0x1a'),'collate':_0xf4fb('0x1b')});}; \ No newline at end of file +var _0x81a7=['update','catch','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','subject','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','closed','changed','closedAt','MailMessage'];(function(_0x3fb03d,_0x42fc5){var _0x580fc4=function(_0x380dc9){while(--_0x380dc9){_0x3fb03d['push'](_0x3fb03d['shift']());}};_0x580fc4(++_0x42fc5);}(_0x81a7,0x11c));var _0x781a=function(_0x224ef3,_0x3284d9){_0x224ef3=_0x224ef3-0x0;var _0x185f12=_0x81a7[_0x224ef3];return _0x185f12;};'use strict';var _=require(_0x781a('0x0'));var util=require(_0x781a('0x1'));var logger=require(_0x781a('0x2'))(_0x781a('0x3'));var moment=require('moment');var BPromise=require(_0x781a('0x4'));var rp=require(_0x781a('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x781a('0x6'));var config=require(_0x781a('0x7'));var attributes=require(_0x781a('0x8'));module[_0x781a('0x9')]=function(_0x39f569,_0x37ab5f){return _0x39f569[_0x781a('0xa')](_0x781a('0xb'),attributes,{'tableName':_0x781a('0xc'),'paranoid':![],'indexes':[{'name':_0x781a('0xd'),'fields':[_0x781a('0xe'),'to'],'type':_0x781a('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x47a791,_0x53f806,_0x3a5890){if(_0x47a791[_0x781a('0x10')]){_0x47a791[_0x781a('0x11')]=moment()[_0x781a('0x12')](_0x781a('0x13'));}if(_0x47a791[_0x781a('0x14')]){_0x47a791['closedAt']=moment()[_0x781a('0x12')](_0x781a('0x13'));}_0x3a5890(null,_0x53f806);},'beforeUpdate':function(_0x376afa,_0x24692c,_0x414964){if(_0x376afa['changed'](_0x781a('0x10'))){_0x376afa[_0x781a('0x11')]=_0x376afa[_0x781a('0x10')]?moment()[_0x781a('0x12')](_0x781a('0x13')):null;}if(_0x376afa[_0x781a('0x15')](_0x781a('0x14'))){_0x376afa[_0x781a('0x16')]=moment()[_0x781a('0x12')]('YYYY-MM-DD\x20HH:mm:ss');_0x376afa[_0x781a('0x10')]=null;_0x376afa[_0x781a('0x11')]=null;}_0x414964(null,_0x376afa);},'afterUpdate':function(_0x56154d,_0xf103fb,_0x49f000){var _0x3527f9=_0x39f569['models'];var _0x3bf6b3=_0x56154d['get']({'plain':!![]});if(_0x3bf6b3[_0x781a('0x14')]){return _0x3527f9[_0x781a('0x17')][_0x781a('0x18')]({'read':!![]},{'where':{'MailInteractionId':_0x3bf6b3['id']}})['then'](function(){_0x49f000();})[_0x781a('0x19')](function(_0x546a48){_0x49f000(_0x546a48);});}else{_0x49f000();}}},'charset':_0x781a('0x1a'),'collate':_0x781a('0x1b')});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 3553077..403978b 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 _0xba6e=['result','catch','UpdateMailInteraction','MailInteraction','update','body','raw','options','where','attributes','limit','AddTagsToMailInteraction','find','ids','spread','AddTags','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','./mailInteraction.socket','register','request','then','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message'];(function(_0x1654d7,_0x300d34){var _0x5ad534=function(_0xd3e0fe){while(--_0xd3e0fe){_0x1654d7['push'](_0x1654d7['shift']());}};_0x5ad534(++_0x300d34);}(_0xba6e,0x168));var _0xeba6=function(_0x1c324d,_0x2daa7c){_0x1c324d=_0x1c324d-0x0;var _0x33347f=_0xba6e[_0x1c324d];return _0x33347f;};'use strict';var _=require(_0xeba6('0x0'));var util=require(_0xeba6('0x1'));var moment=require('moment');var BPromise=require(_0xeba6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeba6('0x3'));var db=require(_0xeba6('0x4'))['db'];var utils=require(_0xeba6('0x5'));var logger=require(_0xeba6('0x6'))(_0xeba6('0x7'));var config=require(_0xeba6('0x8'));var jayson=require(_0xeba6('0x9'));var client=jayson[_0xeba6('0xa')][_0xeba6('0xb')]({'port':0x232a});config[_0xeba6('0xc')]=_[_0xeba6('0xd')](config[_0xeba6('0xc')],{'host':_0xeba6('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xeba6('0xc')]));require(_0xeba6('0xf'))[_0xeba6('0x10')](socket);function respondWithRpcPromise(_0x1a1010,_0x18e626,_0x229f9a){return new BPromise(function(_0x59c0b8,_0x3b713e){return client[_0xeba6('0x11')](_0x1a1010,_0x229f9a)[_0xeba6('0x12')](function(_0x39b3b){logger[_0xeba6('0x13')]('MailInteraction,\x20%s,\x20%s',_0x18e626,_0xeba6('0x14'));logger[_0xeba6('0x15')](_0xeba6('0x16'),_0x18e626,_0xeba6('0x14'),JSON[_0xeba6('0x17')](_0x39b3b));if(_0x39b3b['error']){if(_0x39b3b[_0xeba6('0x18')]['code']===0x1f4){logger[_0xeba6('0x18')](_0xeba6('0x19'),_0x18e626,_0x39b3b[_0xeba6('0x18')][_0xeba6('0x1a')]);return _0x3b713e(_0x39b3b[_0xeba6('0x18')][_0xeba6('0x1a')]);}logger[_0xeba6('0x18')]('MailInteraction,\x20%s,\x20%s',_0x18e626,_0x39b3b[_0xeba6('0x18')][_0xeba6('0x1a')]);return _0x59c0b8(_0x39b3b['error'][_0xeba6('0x1a')]);}else{logger[_0xeba6('0x13')](_0xeba6('0x19'),_0x18e626,_0xeba6('0x14'));_0x59c0b8(_0x39b3b[_0xeba6('0x1b')][_0xeba6('0x1a')]);}})[_0xeba6('0x1c')](function(_0x1157a5){logger[_0xeba6('0x18')](_0xeba6('0x19'),_0x18e626,_0x1157a5);_0x3b713e(_0x1157a5);});});}exports[_0xeba6('0x1d')]=function(_0x45186b){var _0x131b0d=this;return new Promise(function(_0x13ba08,_0x5a7c69){return db[_0xeba6('0x1e')][_0xeba6('0x1f')](_0x45186b[_0xeba6('0x20')],{'raw':_0x45186b['options']?_0x45186b['options'][_0xeba6('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x45186b[_0xeba6('0x22')]?_0x45186b[_0xeba6('0x22')][_0xeba6('0x23')]||null:null,'attributes':_0x45186b[_0xeba6('0x22')]?_0x45186b[_0xeba6('0x22')][_0xeba6('0x24')]||null:null,'limit':_0x45186b['options']?_0x45186b[_0xeba6('0x22')][_0xeba6('0x25')]||null:null})[_0xeba6('0x12')](function(_0x57d141){logger[_0xeba6('0x13')](_0xeba6('0x1d'),_0x45186b);logger[_0xeba6('0x15')](_0xeba6('0x1d'),_0x45186b,JSON[_0xeba6('0x17')](_0x57d141));_0x13ba08(_0x57d141);})[_0xeba6('0x1c')](function(_0x53a140){logger[_0xeba6('0x18')](_0xeba6('0x1d'),_0x53a140[_0xeba6('0x1a')],_0x45186b);_0x5a7c69(_0x131b0d[_0xeba6('0x18')](0x1f4,_0x53a140['message']));});});};exports[_0xeba6('0x26')]=function(_0x555d74){return new Promise(function(_0x4e09d9,_0x288a08){return db['MailInteraction'][_0xeba6('0x27')]({'where':_0x555d74[_0xeba6('0x22')]?_0x555d74['options']['where']||null:null})[_0xeba6('0x12')](function(_0x4ac185){if(_0x4ac185){return _0x4ac185['addTags'](_0x555d74[_0xeba6('0x20')][_0xeba6('0x28')],_['omit'](_0x555d74[_0xeba6('0x20')],['ids','id'])||{});}})[_0xeba6('0x29')](function(_0x1b8d06){logger[_0xeba6('0x13')]('AddTags',_0x555d74);logger[_0xeba6('0x15')]('AddTags',_0x555d74,JSON[_0xeba6('0x17')](_0x1b8d06));_0x4e09d9(_0x1b8d06);})[_0xeba6('0x1c')](function(_0x50dad8){logger[_0xeba6('0x18')](_0xeba6('0x2a'),_0x50dad8[_0xeba6('0x1a')],_0x555d74);_0x288a08(_this[_0xeba6('0x18')](0x1f4,_0x50dad8[_0xeba6('0x1a')]));});});}; \ No newline at end of file +var _0xe74c=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','info','request\x20sent','debug','MailInteraction,\x20%s,\x20%s,\x20%s','error','MailInteraction,\x20%s,\x20%s','message','catch','UpdateMailInteraction','update','raw','options','where','attributes','then','stringify','find','body','ids','omit','spread','AddTags','lodash'];(function(_0x2920dd,_0x19d049){var _0x5d4e52=function(_0x46c751){while(--_0x46c751){_0x2920dd['push'](_0x2920dd['shift']());}};_0x5d4e52(++_0x19d049);}(_0xe74c,0x1d3));var _0xce74=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xe74c[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xce74('0x0'));var util=require(_0xce74('0x1'));var moment=require(_0xce74('0x2'));var BPromise=require(_0xce74('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xce74('0x4'));var db=require(_0xce74('0x5'))['db'];var utils=require(_0xce74('0x6'));var logger=require(_0xce74('0x7'))(_0xce74('0x8'));var config=require(_0xce74('0x9'));var jayson=require(_0xce74('0xa'));var client=jayson[_0xce74('0xb')]['http']({'port':0x232a});config[_0xce74('0xc')]=_[_0xce74('0xd')](config['redis'],{'host':_0xce74('0xe'),'port':0x18eb});var socket=require(_0xce74('0xf'))(new Redis(config['redis']));require('./mailInteraction.socket')[_0xce74('0x10')](socket);function respondWithRpcPromise(_0xd05e7f,_0x3390ae,_0x516f9d){return new BPromise(function(_0x255e07,_0x342ab4){return client['request'](_0xd05e7f,_0x516f9d)['then'](function(_0x460631){logger[_0xce74('0x11')]('MailInteraction,\x20%s,\x20%s',_0x3390ae,_0xce74('0x12'));logger[_0xce74('0x13')](_0xce74('0x14'),_0x3390ae,_0xce74('0x12'),JSON['stringify'](_0x460631));if(_0x460631[_0xce74('0x15')]){if(_0x460631[_0xce74('0x15')]['code']===0x1f4){logger[_0xce74('0x15')](_0xce74('0x16'),_0x3390ae,_0x460631[_0xce74('0x15')][_0xce74('0x17')]);return _0x342ab4(_0x460631['error'][_0xce74('0x17')]);}logger[_0xce74('0x15')](_0xce74('0x16'),_0x3390ae,_0x460631[_0xce74('0x15')][_0xce74('0x17')]);return _0x255e07(_0x460631[_0xce74('0x15')]['message']);}else{logger[_0xce74('0x11')](_0xce74('0x16'),_0x3390ae,_0xce74('0x12'));_0x255e07(_0x460631['result'][_0xce74('0x17')]);}})[_0xce74('0x18')](function(_0x39fd05){logger['error'](_0xce74('0x16'),_0x3390ae,_0x39fd05);_0x342ab4(_0x39fd05);});});}exports[_0xce74('0x19')]=function(_0x28e3ca){var _0x1a3c8a=this;return new Promise(function(_0x2dc064,_0x21fd52){return db['MailInteraction'][_0xce74('0x1a')](_0x28e3ca['body'],{'raw':_0x28e3ca['options']?_0x28e3ca['options'][_0xce74('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x28e3ca[_0xce74('0x1c')]?_0x28e3ca[_0xce74('0x1c')][_0xce74('0x1d')]||null:null,'attributes':_0x28e3ca['options']?_0x28e3ca['options'][_0xce74('0x1e')]||null:null,'limit':_0x28e3ca[_0xce74('0x1c')]?_0x28e3ca['options']['limit']||null:null})[_0xce74('0x1f')](function(_0x3997c2){logger[_0xce74('0x11')]('UpdateMailInteraction',_0x28e3ca);logger[_0xce74('0x13')](_0xce74('0x19'),_0x28e3ca,JSON[_0xce74('0x20')](_0x3997c2));_0x2dc064(_0x3997c2);})[_0xce74('0x18')](function(_0x16b24b){logger[_0xce74('0x15')](_0xce74('0x19'),_0x16b24b[_0xce74('0x17')],_0x28e3ca);_0x21fd52(_0x1a3c8a[_0xce74('0x15')](0x1f4,_0x16b24b['message']));});});};exports['AddTagsToMailInteraction']=function(_0x4a2160){return new Promise(function(_0xd503f,_0x41fa12){return db['MailInteraction'][_0xce74('0x21')]({'where':_0x4a2160[_0xce74('0x1c')]?_0x4a2160['options']['where']||null:null})['then'](function(_0x48c303){if(_0x48c303){return _0x48c303['addTags'](_0x4a2160[_0xce74('0x22')][_0xce74('0x23')],_[_0xce74('0x24')](_0x4a2160[_0xce74('0x22')],[_0xce74('0x23'),'id'])||{});}})[_0xce74('0x25')](function(_0x559615){logger['info'](_0xce74('0x26'),_0x4a2160);logger[_0xce74('0x13')]('AddTags',_0x4a2160,JSON[_0xce74('0x20')](_0x559615));_0xd503f(_0x559615);})[_0xce74('0x18')](function(_0x139ada){logger[_0xce74('0x15')](_0xce74('0x26'),_0x139ada['message'],_0x4a2160);_0x41fa12(_this[_0xce74('0x15')](0x1f4,_0x139ada[_0xce74('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index 2df9b79..57bd931 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 _0x1a89=['register','length','mailInteraction:','./mailInteraction.events','remove','update','emit'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1a89,0x73));var _0x91a8=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x1a89[_0x53ccf2];return _0x5a2964;};'use strict';var MailInteractionEvents=require(_0x91a8('0x0'));var events=['save',_0x91a8('0x1'),_0x91a8('0x2')];function createListener(_0xa1a64a,_0x546ed1){return function(_0x5c7051){_0x546ed1[_0x91a8('0x3')](_0xa1a64a,_0x5c7051);};}function removeListener(_0x1d53d5,_0x93b3ae){return function(){MailInteractionEvents['removeListener'](_0x1d53d5,_0x93b3ae);};}exports[_0x91a8('0x4')]=function(_0x246810){for(var _0x13d38a=0x0,_0x1d7e7b=events[_0x91a8('0x5')];_0x13d38a<_0x1d7e7b;_0x13d38a++){var _0x2eb846=events[_0x13d38a];var _0x2835e8=createListener(_0x91a8('0x6')+_0x2eb846,_0x246810);MailInteractionEvents['on'](_0x2eb846,_0x2835e8);}}; \ No newline at end of file +var _0x63d0=['./mailInteraction.events','save','remove','emit','removeListener','mailInteraction:'];(function(_0x36f284,_0x24cbd1){var _0x4ea099=function(_0xea729e){while(--_0xea729e){_0x36f284['push'](_0x36f284['shift']());}};_0x4ea099(++_0x24cbd1);}(_0x63d0,0x1ec));var _0x063d=function(_0x4de52e,_0x24bd0e){_0x4de52e=_0x4de52e-0x0;var _0x3cec00=_0x63d0[_0x4de52e];return _0x3cec00;};'use strict';var MailInteractionEvents=require(_0x063d('0x0'));var events=[_0x063d('0x1'),_0x063d('0x2'),'update'];function createListener(_0x53fdc0,_0x1e34cf){return function(_0x2b8d6a){_0x1e34cf[_0x063d('0x3')](_0x53fdc0,_0x2b8d6a);};}function removeListener(_0x214a10,_0x2b5097){return function(){MailInteractionEvents[_0x063d('0x4')](_0x214a10,_0x2b5097);};}exports['register']=function(_0x13f603){for(var _0x15c64c=0x0,_0x152712=events['length'];_0x15c64c<_0x152712;_0x15c64c++){var _0x47ca64=events[_0x15c64c];var _0x4ad742=createListener(_0x063d('0x5')+_0x47ca64,_0x13f603);MailInteractionEvents['on'](_0x47ca64,_0x4ad742);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index 28a99f4..0cbfd63 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 _0xd110=['../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','index','/describe','/:id','isAuthenticated','post','tracked','mail','create','put','update','accept','/:id/reject','reject','delete','exports','multer','util','path','express','Router','fs-extra'];(function(_0x11d5a9,_0x30cdfe){var _0x2a326c=function(_0x14fadb){while(--_0x14fadb){_0x11d5a9['push'](_0x11d5a9['shift']());}};_0x2a326c(++_0x30cdfe);}(_0xd110,0x1e8));var _0x0d11=function(_0x2d40ae,_0x402abe){_0x2d40ae=_0x2d40ae-0x0;var _0x2646dd=_0xd110[_0x2d40ae];return _0x2646dd;};'use strict';var multer=require(_0x0d11('0x0'));var util=require(_0x0d11('0x1'));var path=require(_0x0d11('0x2'));var timeout=require('connect-timeout');var express=require(_0x0d11('0x3'));var router=express[_0x0d11('0x4')]();var fs_extra=require(_0x0d11('0x5'));var auth=require(_0x0d11('0x6'));var interaction=require(_0x0d11('0x7'));var config=require(_0x0d11('0x8'));var controller=require(_0x0d11('0x9'));router[_0x0d11('0xa')]('/',auth['isAuthenticated'](),controller[_0x0d11('0xb')]);router['get'](_0x0d11('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x0d11('0xa')](_0x0d11('0xd'),auth[_0x0d11('0xe')](),controller['show']);router[_0x0d11('0xa')]('/:id/download',auth[_0x0d11('0xe')](),controller['download']);router[_0x0d11('0xf')]('/',auth[_0x0d11('0xe')](),interaction[_0x0d11('0x10')](_0x0d11('0x11'),'mailmessage:create'),controller[_0x0d11('0x12')]);router[_0x0d11('0x13')]('/:id',auth[_0x0d11('0xe')](),controller[_0x0d11('0x14')]);router[_0x0d11('0x13')]('/:id/accept',auth[_0x0d11('0xe')](),controller[_0x0d11('0x15')]);router['put'](_0x0d11('0x16'),auth[_0x0d11('0xe')](),controller[_0x0d11('0x17')]);router[_0x0d11('0x18')](_0x0d11('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x0d11('0x19')]=router; \ No newline at end of file +var _0x74a1=['/:id/accept','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post','tracked','mail','mailmessage:create','create','update','put'];(function(_0x228641,_0x25d636){var _0x5d5d78=function(_0x4d5c6c){while(--_0x4d5c6c){_0x228641['push'](_0x228641['shift']());}};_0x5d5d78(++_0x25d636);}(_0x74a1,0xff));var _0x174a=function(_0x1cfc39,_0x15adef){_0x1cfc39=_0x1cfc39-0x0;var _0x1ae59b=_0x74a1[_0x1cfc39];return _0x1ae59b;};'use strict';var multer=require(_0x174a('0x0'));var util=require(_0x174a('0x1'));var path=require('path');var timeout=require(_0x174a('0x2'));var express=require('express');var router=express[_0x174a('0x3')]();var fs_extra=require(_0x174a('0x4'));var auth=require(_0x174a('0x5'));var interaction=require(_0x174a('0x6'));var config=require(_0x174a('0x7'));var controller=require(_0x174a('0x8'));router[_0x174a('0x9')]('/',auth[_0x174a('0xa')](),controller[_0x174a('0xb')]);router[_0x174a('0x9')](_0x174a('0xc'),auth[_0x174a('0xa')](),controller[_0x174a('0xd')]);router[_0x174a('0x9')](_0x174a('0xe'),auth[_0x174a('0xa')](),controller[_0x174a('0xf')]);router[_0x174a('0x9')](_0x174a('0x10'),auth[_0x174a('0xa')](),controller[_0x174a('0x11')]);router[_0x174a('0x12')]('/',auth[_0x174a('0xa')](),interaction[_0x174a('0x13')](_0x174a('0x14'),_0x174a('0x15')),controller[_0x174a('0x16')]);router['put'](_0x174a('0xe'),auth[_0x174a('0xa')](),controller[_0x174a('0x17')]);router[_0x174a('0x18')](_0x174a('0x19'),auth[_0x174a('0xa')](),controller['accept']);router[_0x174a('0x18')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router['delete'](_0x174a('0xe'),auth[_0x174a('0xa')](),controller[_0x174a('0x1a')]);module[_0x174a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 4f81fab..4587a47 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 _0x3ebc=['STRING','long','DATE','INTEGER','Email','Chat','sequelize','exports','TEXT','medium','ENUM','out'];(function(_0x5b8175,_0x47fdc7){var _0x4a4c21=function(_0xf4dab0){while(--_0xf4dab0){_0x5b8175['push'](_0x5b8175['shift']());}};_0x4a4c21(++_0x47fdc7);}(_0x3ebc,0x96));var _0xc3eb=function(_0x1ae95f,_0x132b81){_0x1ae95f=_0x1ae95f-0x0;var _0x18dbfa=_0x3ebc[_0x1ae95f];return _0x18dbfa;};'use strict';var Sequelize=require(_0xc3eb('0x0'));var _=require('lodash');module[_0xc3eb('0x1')]={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xc3eb('0x2')](_0xc3eb('0x3'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0xc3eb('0x4')]('in',_0xc3eb('0x5')),'defaultValue':_0xc3eb('0x5'),'allowNull':![]},'messageId':{'type':Sequelize[_0xc3eb('0x6')](0x1fe)},'from':{'type':Sequelize[_0xc3eb('0x6')]},'to':{'type':Sequelize[_0xc3eb('0x2')](_0xc3eb('0x7'))},'cc':{'type':Sequelize[_0xc3eb('0x2')](_0xc3eb('0x7'))},'bcc':{'type':Sequelize[_0xc3eb('0x2')](_0xc3eb('0x7'))},'subject':{'type':Sequelize[_0xc3eb('0x2')]},'sentAt':{'type':Sequelize[_0xc3eb('0x8')]},'attach':{'type':Sequelize[_0xc3eb('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize[_0xc3eb('0x8')]},'originTo':{'type':Sequelize[_0xc3eb('0x2')](_0xc3eb('0x7'))},'originCc':{'type':Sequelize['TEXT'](_0xc3eb('0x7'))},'originChannel':{'type':Sequelize[_0xc3eb('0x4')](_0xc3eb('0xa'),_0xc3eb('0xb')),'defaultValue':'Email','allowNull':![]}}; \ No newline at end of file +var _0xb26d=['TEXT','medium','BOOLEAN','ENUM','out','STRING','long','DATE','INTEGER','Email','sequelize','lodash'];(function(_0x1a595a,_0x263824){var _0x33f008=function(_0x1e2f9c){while(--_0x1e2f9c){_0x1a595a['push'](_0x1a595a['shift']());}};_0x33f008(++_0x263824);}(_0xb26d,0x8e));var _0xdb26=function(_0x1ba60b,_0x5a59a8){_0x1ba60b=_0x1ba60b-0x0;var _0x3ac92a=_0xb26d[_0x1ba60b];return _0x3ac92a;};'use strict';var Sequelize=require(_0xdb26('0x0'));var _=require(_0xdb26('0x1'));module['exports']={'body':{'type':Sequelize['TEXT']('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0xdb26('0x2')](_0xdb26('0x3'))},'read':{'type':Sequelize[_0xdb26('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdb26('0x5')]('in',_0xdb26('0x6')),'defaultValue':_0xdb26('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0xdb26('0x7')](0x1fe)},'from':{'type':Sequelize[_0xdb26('0x7')]},'to':{'type':Sequelize[_0xdb26('0x2')](_0xdb26('0x8'))},'cc':{'type':Sequelize[_0xdb26('0x2')](_0xdb26('0x8'))},'bcc':{'type':Sequelize[_0xdb26('0x2')](_0xdb26('0x8'))},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0xdb26('0x9')]},'attach':{'type':Sequelize[_0xdb26('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize[_0xdb26('0x4')],'defaultValue':![]},'readAt':{'type':Sequelize[_0xdb26('0x9')]},'originTo':{'type':Sequelize[_0xdb26('0x2')]('long')},'originCc':{'type':Sequelize[_0xdb26('0x2')]('long')},'originChannel':{'type':Sequelize['ENUM'](_0xdb26('0xb'),'Chat'),'defaultValue':_0xdb26('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 9b905a6..af29889 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 _0x82ac=['request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','status','end','json','limit','undefined','offset','count','Content-Range','apply','reject','save','destroy','stack','name','send','map','MailMessage','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','fields','length','find','body','describe','create','out','secret','MailAccount','findOne','CmList','List','CmContact','Contacts','updatedAt','DESC','Smtp','isNil','service','host','port','secure','auth','pass','user','attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','stringify','../../config/logger','mail-interactions','accept','mail','read','readAt','UserId','get','MailInteraction','update','read1stAt','info','[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','interaction','null','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','fromString','EventManager','acceptmessage','agent','MailInteractionId','role','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','rejectmessage','unix','toString','join','root','server','files','tmp','from','bcc','Attachment','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','Attachments','existsSync','push','readFileSync','build','writeFileSync','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','then','MailMessage,\x20%s,\x20%s'];(function(_0x350aeb,_0x3d265a){var _0x3c5273=function(_0x32b417){while(--_0x32b417){_0x350aeb['push'](_0x350aeb['shift']());}};_0x3c5273(++_0x3d265a);}(_0x82ac,0x1f0));var _0xc82a=function(_0x23da9d,_0xeec9c7){_0x23da9d=_0x23da9d-0x0;var _0x3f65b1=_0x82ac[_0x23da9d];return _0x3f65b1;};'use strict';var emlformat=require(_0xc82a('0x0'));var rimraf=require(_0xc82a('0x1'));var zipdir=require(_0xc82a('0x2'));var jsonpatch=require(_0xc82a('0x3'));var rp=require(_0xc82a('0x4'));var moment=require(_0xc82a('0x5'));var BPromise=require(_0xc82a('0x6'));var Mustache=require(_0xc82a('0x7'));var util=require('util');var path=require(_0xc82a('0x8'));var sox=require('sox');var csv=require(_0xc82a('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc82a('0xa'));var squel=require(_0xc82a('0xb'));var crypto=require(_0xc82a('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xc82a('0x9'));var querystring=require(_0xc82a('0xd'));var Papa=require('papaparse');var Redis=require(_0xc82a('0xe'));var authService=require(_0xc82a('0xf'));var qs=require(_0xc82a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc82a('0x11'));var logger=require('../../config/logger')('api');var utils=require(_0xc82a('0x12'));var config=require(_0xc82a('0x13'));var licenseUtil=require('../../config/license/util');var htmlToText=require('html-to-text');var db=require(_0xc82a('0x14'))['db'];config[_0xc82a('0x15')]=_[_0xc82a('0x16')](config[_0xc82a('0x15')],{'host':_0xc82a('0x17'),'port':0x18eb});var socket=require(_0xc82a('0x18'))(new Redis(config[_0xc82a('0x15')]));require('./mailMessage.socket')[_0xc82a('0x19')](socket);var jayson=require(_0xc82a('0x1a'));var client=jayson[_0xc82a('0x1b')][_0xc82a('0x1c')]({'port':0x232c});var client9003=jayson['client'][_0xc82a('0x1c')]({'port':0x232b});var client9002=jayson['client'][_0xc82a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xcab298,_0x30ec26,_0x44aee3,_0x62786b){return new BPromise(function(_0x58a28e,_0x37bcc0){var _0x5f1350=_0x62786b||client;return _0x5f1350[_0xc82a('0x1d')](_0xcab298,_0x44aee3)[_0xc82a('0x1e')](function(_0x5022f9){logger['info'](_0xc82a('0x1f'),_0x30ec26,_0xc82a('0x20'));logger[_0xc82a('0x21')](_0xc82a('0x22'),_0x30ec26,_0xc82a('0x20'),JSON['stringify'](_0x5022f9));if(_0x5022f9['error']){if(_0x5022f9[_0xc82a('0x23')][_0xc82a('0x24')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x30ec26,_0x5022f9['error'][_0xc82a('0x25')]);return _0x37bcc0(_0x5022f9['error']['message']);}logger[_0xc82a('0x23')](_0xc82a('0x1f'),_0x30ec26,_0x5022f9['error'][_0xc82a('0x25')]);return _0x58a28e(_0x5022f9[_0xc82a('0x23')][_0xc82a('0x25')]);}else{logger['info'](_0xc82a('0x1f'),_0x30ec26,_0xc82a('0x20'));_0x58a28e(_0x5022f9[_0xc82a('0x26')][_0xc82a('0x25')]);}})[_0xc82a('0x27')](function(_0x1a28ec){logger[_0xc82a('0x23')](_0xc82a('0x1f'),_0x30ec26,_0x1a28ec);_0x37bcc0(_0x1a28ec);});});}function respondWithStatusCode(_0xd29d9d,_0xb18e7f){_0xb18e7f=_0xb18e7f||0xcc;return function(_0x16237b){if(_0x16237b){return _0xd29d9d[_0xc82a('0x28')](_0xb18e7f);}return _0xd29d9d[_0xc82a('0x29')](_0xb18e7f)[_0xc82a('0x2a')]();};}function respondWithResult(_0x25b490,_0x49a6ba){_0x49a6ba=_0x49a6ba||0xc8;return function(_0x5565f6){if(_0x5565f6){return _0x25b490[_0xc82a('0x29')](_0x49a6ba)[_0xc82a('0x2b')](_0x5565f6);}};}function respondWithFilteredResult(_0x468258,_0x58b20c){return function(_0x409bff){if(_0x409bff){var _0x20a529=typeof _0x58b20c['offset']==='undefined'&&typeof _0x58b20c[_0xc82a('0x2c')]===_0xc82a('0x2d');var _0x3d6448=_0x409bff['count'];var _0x20511c=_0x20a529?0x0:_0x58b20c[_0xc82a('0x2e')];var _0x393619=_0x20a529?_0x409bff[_0xc82a('0x2f')]:_0x58b20c['offset']+_0x58b20c['limit'];var _0x4b2515;if(_0x393619>=_0x3d6448){_0x393619=_0x3d6448;_0x4b2515=0xc8;}else{_0x4b2515=0xce;}_0x468258['status'](_0x4b2515);return _0x468258['set'](_0xc82a('0x30'),_0x20511c+'-'+_0x393619+'/'+_0x3d6448)[_0xc82a('0x2b')](_0x409bff);}return null;};}function patchUpdates(_0x1a7f93){return function(_0x1cac9e){try{jsonpatch[_0xc82a('0x31')](_0x1cac9e,_0x1a7f93,!![]);}catch(_0x38af07){return BPromise[_0xc82a('0x32')](_0x38af07);}return _0x1cac9e[_0xc82a('0x33')]();};}function saveUpdates(_0x586629,_0x2460b6){return function(_0x5e54a7){if(_0x5e54a7){return _0x5e54a7['update'](_0x586629)[_0xc82a('0x1e')](function(_0x383744){return _0x383744;});}return null;};}function removeEntity(_0x16542d,_0x4fa413){return function(_0x142e30){if(_0x142e30){return _0x142e30[_0xc82a('0x34')]()[_0xc82a('0x1e')](function(){_0x16542d[_0xc82a('0x29')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c2f40,_0x3fd640){return function(_0x49d424){if(!_0x49d424){_0x1c2f40[_0xc82a('0x28')](0x194);}return _0x49d424;};}function handleError(_0x177ca4,_0x4e3cf0){_0x4e3cf0=_0x4e3cf0||0x1f4;return function(_0x555294){logger[_0xc82a('0x23')](_0x555294[_0xc82a('0x35')]);if(_0x555294[_0xc82a('0x36')]){delete _0x555294[_0xc82a('0x36')];}_0x177ca4['status'](_0x4e3cf0)[_0xc82a('0x37')](_0x555294);};}exports['index']=function(_0x54e00c,_0x1df9bd){var _0x4e2e96={},_0x318a2c={},_0x1f99a3={'count':0x0,'rows':[]};var _0xbb5ef2=_[_0xc82a('0x38')](db[_0xc82a('0x39')][_0xc82a('0x3a')],function(_0x22142a){return{'name':_0x22142a['fieldName'],'type':_0x22142a[_0xc82a('0x3b')][_0xc82a('0x3c')]};});_0x318a2c['model']=_['map'](_0xbb5ef2,'name');_0x318a2c['query']=_[_0xc82a('0x3d')](_0x54e00c[_0xc82a('0x3e')]);_0x318a2c[_0xc82a('0x3f')]=_[_0xc82a('0x40')](_0x318a2c[_0xc82a('0x41')],_0x318a2c['query']);_0x4e2e96[_0xc82a('0x42')]=_['intersection'](_0x318a2c[_0xc82a('0x41')],qs['fields'](_0x54e00c[_0xc82a('0x3e')]['fields']));_0x4e2e96['attributes']=_0x4e2e96[_0xc82a('0x42')]['length']?_0x4e2e96[_0xc82a('0x42')]:_0x318a2c[_0xc82a('0x41')];if(!_0x54e00c[_0xc82a('0x3e')][_0xc82a('0x43')]('nolimit')){_0x4e2e96[_0xc82a('0x2c')]=qs['limit'](_0x54e00c[_0xc82a('0x3e')]['limit']);_0x4e2e96[_0xc82a('0x2e')]=qs[_0xc82a('0x2e')](_0x54e00c[_0xc82a('0x3e')][_0xc82a('0x2e')]);}_0x4e2e96[_0xc82a('0x44')]=qs[_0xc82a('0x45')](_0x54e00c['query'][_0xc82a('0x45')]);_0x4e2e96[_0xc82a('0x46')]=qs[_0xc82a('0x3f')](_[_0xc82a('0x47')](_0x54e00c[_0xc82a('0x3e')],_0x318a2c[_0xc82a('0x3f')]),_0xbb5ef2);if(_0x54e00c[_0xc82a('0x3e')][_0xc82a('0x48')]){_0x4e2e96[_0xc82a('0x46')]=_['merge'](_0x4e2e96['where'],{'$or':_[_0xc82a('0x38')](_0xbb5ef2,function(_0x34002d){if(_0x34002d[_0xc82a('0x3b')]!==_0xc82a('0x49')){var _0x14569b={};_0x14569b[_0x34002d[_0xc82a('0x36')]]={'$like':'%'+_0x54e00c[_0xc82a('0x3e')][_0xc82a('0x48')]+'%'};return _0x14569b;}})});}_0x4e2e96=_[_0xc82a('0x4a')]({},_0x4e2e96,_0x54e00c[_0xc82a('0x4b')]);var _0x3f62ae={'where':_0x4e2e96[_0xc82a('0x46')]};return db[_0xc82a('0x39')][_0xc82a('0x2f')](_0x3f62ae)['then'](function(_0xd839dc){_0x1f99a3[_0xc82a('0x2f')]=_0xd839dc;if(_0x54e00c[_0xc82a('0x3e')][_0xc82a('0x4c')]){_0x4e2e96[_0xc82a('0x4d')]=[{'all':!![]}];}return db[_0xc82a('0x39')][_0xc82a('0x4e')](_0x4e2e96);})[_0xc82a('0x1e')](function(_0x462c7f){_0x1f99a3[_0xc82a('0x4f')]=_0x462c7f;return _0x1f99a3;})[_0xc82a('0x1e')](respondWithFilteredResult(_0x1df9bd,_0x4e2e96))[_0xc82a('0x27')](handleError(_0x1df9bd,null));};exports[_0xc82a('0x50')]=function(_0x259f5c,_0x1c6585){var _0x51b725={'raw':!![],'where':{'id':_0x259f5c[_0xc82a('0x51')]['id']}},_0x2f7314={};_0x2f7314[_0xc82a('0x41')]=_[_0xc82a('0x3d')](db['MailMessage'][_0xc82a('0x3a')]);_0x2f7314[_0xc82a('0x3e')]=_['keys'](_0x259f5c[_0xc82a('0x3e')]);_0x2f7314[_0xc82a('0x3f')]=_[_0xc82a('0x40')](_0x2f7314[_0xc82a('0x41')],_0x2f7314[_0xc82a('0x3e')]);_0x51b725[_0xc82a('0x42')]=_['intersection'](_0x2f7314[_0xc82a('0x41')],qs[_0xc82a('0x52')](_0x259f5c[_0xc82a('0x3e')][_0xc82a('0x52')]));_0x51b725['attributes']=_0x51b725[_0xc82a('0x42')][_0xc82a('0x53')]?_0x51b725[_0xc82a('0x42')]:_0x2f7314[_0xc82a('0x41')];if(_0x259f5c[_0xc82a('0x3e')][_0xc82a('0x4c')]){_0x51b725[_0xc82a('0x4d')]=[{'all':!![]}];}_0x51b725=_['merge']({},_0x51b725,_0x259f5c[_0xc82a('0x4b')]);return db[_0xc82a('0x39')][_0xc82a('0x54')](_0x51b725)[_0xc82a('0x1e')](handleEntityNotFound(_0x1c6585,null))[_0xc82a('0x1e')](respondWithResult(_0x1c6585,null))[_0xc82a('0x27')](handleError(_0x1c6585,null));};exports['update']=function(_0x2efa55,_0x3fdc1f){if(_0x2efa55[_0xc82a('0x55')]['id']){delete _0x2efa55['body']['id'];}return db[_0xc82a('0x39')][_0xc82a('0x54')]({'where':{'id':_0x2efa55[_0xc82a('0x51')]['id']}})[_0xc82a('0x1e')](handleEntityNotFound(_0x3fdc1f,null))[_0xc82a('0x1e')](saveUpdates(_0x2efa55['body'],null))[_0xc82a('0x1e')](respondWithResult(_0x3fdc1f,null))[_0xc82a('0x27')](handleError(_0x3fdc1f,null));};exports[_0xc82a('0x34')]=function(_0x521742,_0x57a404){return db['MailMessage']['find']({'where':{'id':_0x521742['params']['id']}})['then'](handleEntityNotFound(_0x57a404,null))[_0xc82a('0x1e')](removeEntity(_0x57a404,null))[_0xc82a('0x27')](handleError(_0x57a404,null));};exports[_0xc82a('0x56')]=function(_0x2ab6eb,_0x15253f){return db[_0xc82a('0x39')][_0xc82a('0x56')]()[_0xc82a('0x1e')](respondWithResult(_0x15253f,null))['catch'](handleError(_0x15253f,null));};exports[_0xc82a('0x57')]=function(_0xf4f6f0,_0x225a9a){return db[_0xc82a('0x39')]['create'](_0xf4f6f0[_0xc82a('0x55')])['then'](function(_0x142a9b){if(_0x142a9b){if(_0x142a9b['direction']===_0xc82a('0x58')&&!_0x142a9b[_0xc82a('0x59')]){var _0x376cd1,_0x59bd0b,_0x2530af;if(_0xf4f6f0[_0xc82a('0x55')]['to']){_0x59bd0b=_0xf4f6f0[_0xc82a('0x55')]['to']['split'](',')[0x0];}return db[_0xc82a('0x5a')][_0xc82a('0x5b')]({'where':{'id':_0x142a9b['MailAccountId']},'include':[{'model':db[_0xc82a('0x5c')],'as':_0xc82a('0x5d'),'include':[{'model':db[_0xc82a('0x5e')],'as':_0xc82a('0x5f'),'where':{'email':_0x59bd0b},'limit':0x1,'order':[[_0xc82a('0x60'),_0xc82a('0x61')]]}]},{'model':db['MailServerOut'],'as':_0xc82a('0x62'),'raw':!![]}]})[_0xc82a('0x1e')](function(_0x425b3f){_0x376cd1=_0x425b3f;if(_0x376cd1&&_0x376cd1[_0xc82a('0x62')]){var _0xbb6753={'tls':{'rejectUnauthorized':![]}};if(_[_0xc82a('0x63')](_0x376cd1['Smtp'][_0xc82a('0x64')])){_0xbb6753[_0xc82a('0x65')]=_0x376cd1[_0xc82a('0x62')]['host'];_0xbb6753[_0xc82a('0x66')]=_0x376cd1[_0xc82a('0x62')][_0xc82a('0x66')];_0xbb6753[_0xc82a('0x67')]=_0x376cd1[_0xc82a('0x62')][_0xc82a('0x67')];if(_0x376cd1[_0xc82a('0x62')]['authentication']){_0xbb6753[_0xc82a('0x68')]={'user':_0x376cd1[_0xc82a('0x62')]['user'],'pass':_0x376cd1[_0xc82a('0x62')][_0xc82a('0x69')]};}}else{_0xbb6753[_0xc82a('0x64')]=_0x376cd1[_0xc82a('0x62')][_0xc82a('0x64')];_0xbb6753[_0xc82a('0x68')]={'user':_0x376cd1[_0xc82a('0x62')][_0xc82a('0x6a')],'pass':_0x376cd1[_0xc82a('0x62')][_0xc82a('0x69')]};_0xbb6753[_0xc82a('0x67')]=_0x376cd1[_0xc82a('0x62')]['secure'];}if(_0xf4f6f0[_0xc82a('0x55')][_0xc82a('0x6b')]&&_0xf4f6f0['body']['attachments'][_0xc82a('0x53')]){for(var _0x2c6c1c=0x0;_0x2c6c1c<_0xf4f6f0[_0xc82a('0x55')][_0xc82a('0x6b')][_0xc82a('0x53')];_0x2c6c1c+=0x1){_0xf4f6f0[_0xc82a('0x55')]['attachments'][_0x2c6c1c]={'filename':_0xf4f6f0[_0xc82a('0x55')][_0xc82a('0x6b')][_0x2c6c1c][_0xc82a('0x36')],'path':path['join'](config['root'],'server/files/attachments',_0xf4f6f0['body']['attachments'][_0x2c6c1c][_0xc82a('0x6c')])};}}_0x2530af={'account':_0xbb6753,'message':_0xf4f6f0[_0xc82a('0x55')]};return;}})[_0xc82a('0x1e')](function(){if(_0x376cd1[_0xc82a('0x5d')]){if(_0x376cd1[_0xc82a('0x5d')]['Contacts'][_0xc82a('0x53')]){return _0x376cd1['List'][_0xc82a('0x5f')][0x0];}else{return db[_0xc82a('0x5e')]['create'](_[_0xc82a('0x16')](_0xf4f6f0[_0xc82a('0x55')],{'firstName':_0xf4f6f0[_0xc82a('0x55')]['to'],'email':_0xf4f6f0['body']['to'],'phone':_0xf4f6f0[_0xc82a('0x55')]['to'],'ListId':_0x376cd1[_0xc82a('0x6d')]}));}}else{throw new Error(_0xc82a('0x6e'));}})[_0xc82a('0x1e')](function(){if(_0x2530af){return respondWithRpcPromise(_0xc82a('0x6f'),_0xc82a('0x70'),_0x2530af,client9003)['then'](function(_0x323444){return _0x142a9b['update']({'read':!![],'messageId':_0x323444[_0xc82a('0x71')],'sentAt':moment()[_0xc82a('0x72')](_0xc82a('0x73'))});})['catch'](function(_0x56b3e4){logger[_0xc82a('0x23')]('%s',JSON[_0xc82a('0x74')](_0x56b3e4));return _0x142a9b;});}return _0x142a9b;});}return _0x142a9b;}})[_0xc82a('0x1e')](respondWithResult(_0x225a9a,0xc9))[_0xc82a('0x27')](handleError(_0x225a9a,null));};var interaction_log=require(_0xc82a('0x75'))(_0xc82a('0x76'));exports[_0xc82a('0x77')]=function(_0x32d4ff,_0x51c15e,_0x2db8fd){var _0x30969a={'agent':{},'channel':_0xc82a('0x78')};if(_0x32d4ff['body']['id']){delete _0x32d4ff['body']['id'];}_0x32d4ff[_0xc82a('0x55')][_0xc82a('0x79')]=!![];_0x32d4ff[_0xc82a('0x55')][_0xc82a('0x7a')]=moment()[_0xc82a('0x72')](_0xc82a('0x73'));_0x32d4ff['body'][_0xc82a('0x7b')]=_0x32d4ff['body'][_0xc82a('0x7b')]||_0x32d4ff[_0xc82a('0x6a')]['id'];_0x30969a['agent']['id']=_0x32d4ff[_0xc82a('0x55')][_0xc82a('0x7b')];return db['MailMessage'][_0xc82a('0x54')]({'where':{'id':_0x32d4ff['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x51c15e,null))[_0xc82a('0x1e')](saveUpdates(_0x32d4ff[_0xc82a('0x55')],null))['then'](function(_0x4cc4d7){if(_0x4cc4d7){_0x30969a[_0xc82a('0x25')]=_0x4cc4d7[_0xc82a('0x7c')]({'plain':!![]});return db[_0xc82a('0x7d')][_0xc82a('0x54')]({'where':{'id':_0x4cc4d7['MailInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x51c15e,null))[_0xc82a('0x1e')](function(_0x1c708c){if(_0x1c708c){return _0x1c708c[_0xc82a('0x7e')]({'UserId':_0x32d4ff[_0xc82a('0x55')][_0xc82a('0x7b')],'read1stAt':_[_0xc82a('0x63')](_0x1c708c[_0xc82a('0x7f')])?moment()['format'](_0xc82a('0x73')):undefined});}return null;})[_0xc82a('0x1e')](function(_0x5afd32){if(_0x5afd32){_0x30969a['interaction']=_0x5afd32[_0xc82a('0x7c')]({'plain':!![]});interaction_log[_0xc82a('0x80')](_0xc82a('0x81'),_0x32d4ff['user']['id'],_0x32d4ff['user'][_0xc82a('0x36')],_0x32d4ff[_0xc82a('0x6a')]['role'],_0x30969a[_0xc82a('0x82')]['id'],_0x32d4ff['body']?JSON['stringify'](_0x32d4ff[_0xc82a('0x55')]):_0xc82a('0x83'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x30969a);}return null;})[_0xc82a('0x1e')](function(_0x28c9d1){var _0x266e84='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x28c9d1['message']['ContactId'];return db[_0xc82a('0x84')][_0xc82a('0x3e')](_0x266e84,{'type':db['Sequelize'][_0xc82a('0x85')][_0xc82a('0x86')],'raw':!![]})[_0xc82a('0x1e')](function(_0x4b2107){return _0x4b2107;});})[_0xc82a('0x1e')](function(_0x5543de){if(_0x5543de){_0x30969a['message'][_0xc82a('0x87')]=_0x5543de[0x0];if(!_0x32d4ff['body'][_0xc82a('0x7b')])return;return db[_0xc82a('0x88')][_0xc82a('0x54')]({'where':{'id':_0x32d4ff['body'][_0xc82a('0x7b')],'role':'agent'},'attributes':['id',_0xc82a('0x36'),_0xc82a('0x89'),_0xc82a('0x8a'),_0xc82a('0x8b')],'raw':!![]});}return null;})[_0xc82a('0x1e')](function(_0xb164c2){if(!_0xb164c2)return null;_0x30969a[_0xc82a('0x25')]['agent']=_0xb164c2;return _0x30969a;})['then'](function(_0x3bd82f){if(_0x3bd82f){if(_0x32d4ff[_0xc82a('0x55')][_0xc82a('0x8c')]){_0x30969a['message'][_0xc82a('0x8d')]=util[_0xc82a('0x72')](_0xc82a('0x8e'),_0x32d4ff[_0xc82a('0x6a')]['name']);_0x30969a[_0xc82a('0x25')][_0xc82a('0x8f')]=_0x30969a[_0xc82a('0x8f')];_0x30969a[_0xc82a('0x25')]['event']=_0xc82a('0x77');_0x30969a[_0xc82a('0x25')][_0xc82a('0x55')]=htmlToText[_0xc82a('0x90')](_0x30969a[_0xc82a('0x25')][_0xc82a('0x55')]);return respondWithRpcPromise(_0xc82a('0x91'),'EventManager',{'event':_0xc82a('0x92'),'message':_0x30969a[_0xc82a('0x25')]},client9002)[_0xc82a('0x1e')](function(){return _0x30969a;});}return _0x30969a;}return null;})['then'](respondWithResult(_0x51c15e,null))[_0xc82a('0x27')](handleError(_0x51c15e,null));};var interaction_log=require(_0xc82a('0x75'))('mail-interactions');exports[_0xc82a('0x32')]=function(_0x54450f,_0x35760a,_0xb0798b){var _0x2c14a7={'agent':{},'channel':'mail'};if(_0x54450f[_0xc82a('0x55')]['id']){delete _0x54450f[_0xc82a('0x55')]['id'];}_0x54450f[_0xc82a('0x55')][_0xc82a('0x7b')]=_0x54450f['body'][_0xc82a('0x7b')]||_0x54450f[_0xc82a('0x6a')]['id'];_0x2c14a7[_0xc82a('0x93')]['id']=_0x54450f[_0xc82a('0x55')][_0xc82a('0x7b')];return db[_0xc82a('0x39')][_0xc82a('0x54')]({'where':{'id':_0x54450f['params']['id'],'UserId':null}})[_0xc82a('0x1e')](handleEntityNotFound(_0x35760a,null))['then'](function(_0x3514b7){if(_0x3514b7){_0x2c14a7[_0xc82a('0x25')]=_0x3514b7[_0xc82a('0x7c')]({'plain':!![]});return db['MailInteraction'][_0xc82a('0x54')]({'where':{'id':_0x3514b7[_0xc82a('0x94')]}});}return null;})[_0xc82a('0x1e')](handleEntityNotFound(_0x35760a,null))[_0xc82a('0x1e')](function(_0x510e9b){if(_0x510e9b){_0x2c14a7[_0xc82a('0x82')]=_0x510e9b['get']({'plain':!![]});interaction_log['info']('[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x54450f[_0xc82a('0x6a')]['id'],_0x54450f['user'][_0xc82a('0x36')],_0x54450f[_0xc82a('0x6a')][_0xc82a('0x95')],_0x2c14a7[_0xc82a('0x82')]['id'],_0x54450f['body']?JSON[_0xc82a('0x74')](_0x54450f[_0xc82a('0x55')]):_0xc82a('0x83'));return respondWithRpcPromise('RejectMessage',_0xc82a('0x96'),_0x2c14a7);}return null;})[_0xc82a('0x1e')](function(_0x252b1a){var _0x12b65e=_0xc82a('0x97')+_0x252b1a[_0xc82a('0x25')][_0xc82a('0x98')];return db[_0xc82a('0x84')][_0xc82a('0x3e')](_0x12b65e,{'type':db['Sequelize'][_0xc82a('0x85')][_0xc82a('0x86')],'raw':!![]})[_0xc82a('0x1e')](function(_0x16a6d3){return _0x16a6d3;});})[_0xc82a('0x1e')](function(_0x564fcc){if(_0x564fcc){_0x2c14a7[_0xc82a('0x25')][_0xc82a('0x87')]=_0x564fcc[0x0];if(!_0x54450f[_0xc82a('0x55')][_0xc82a('0x7b')])return;return db[_0xc82a('0x88')]['find']({'where':{'id':_0x54450f[_0xc82a('0x55')][_0xc82a('0x7b')],'role':_0xc82a('0x93')},'attributes':['id','name',_0xc82a('0x89'),_0xc82a('0x8a'),_0xc82a('0x8b')],'raw':!![]});}return null;})['then'](function(_0x374759){if(!_0x374759)return null;_0x2c14a7['message'][_0xc82a('0x93')]=_0x374759;return _0x2c14a7;})['then'](function(_0x1ea388){if(_0x1ea388){_0x1ea388[_0xc82a('0x25')]['interface']=util['format'](_0xc82a('0x8e'),_0x54450f[_0xc82a('0x6a')][_0xc82a('0x36')]);_0x1ea388[_0xc82a('0x25')][_0xc82a('0x8f')]=_0x2c14a7[_0xc82a('0x8f')];_0x1ea388['message']['event']=_0xc82a('0x32');_0x1ea388[_0xc82a('0x25')][_0xc82a('0x55')]=htmlToText['fromString'](_0x2c14a7[_0xc82a('0x25')][_0xc82a('0x55')]);respondWithRpcPromise(_0xc82a('0x91'),'EventManager',{'event':_0xc82a('0x99'),'message':_0x1ea388['message']},client9002);return _0x2c14a7;}return null;})[_0xc82a('0x1e')](respondWithResult(_0x35760a,null))[_0xc82a('0x27')](handleError(_0x35760a,null));};exports['download']=function(_0x5e6b22,_0x4b57d0){var _0xe3603f=moment()[_0xc82a('0x9a')]()[_0xc82a('0x9b')]();var _0xb4b466=path[_0xc82a('0x9c')](config[_0xc82a('0x9d')],_0xc82a('0x9e'),_0xc82a('0x9f'),_0xc82a('0xa0'));var _0x1e424e=path[_0xc82a('0x9c')](config['root'],_0xc82a('0x9e'),_0xc82a('0x9f'),'attachments');var _0x5b56b7=util['format']('message-%s.eml',_0xe3603f);return db[_0xc82a('0x39')][_0xc82a('0x54')]({'where':{'id':_0x5e6b22['params']['id']},'attributes':['id',_0xc82a('0x55'),_0xc82a('0xa1'),'to','cc',_0xc82a('0xa2'),'subject','createdAt'],'include':_0x5e6b22[_0xc82a('0x3e')][_0xc82a('0x6b')]?[{'model':db[_0xc82a('0xa3')],'as':'Attachments'}]:undefined})['then'](handleEntityNotFound(_0x4b57d0,null))[_0xc82a('0x1e')](function(_0x53ee61){if(_0x53ee61){var _0x1960ec=_0x53ee61;var _0x55bafd={'from':_0x1960ec[_0xc82a('0xa1')],'to':_0x1960ec['to'],'subject':_0x1960ec['subject'],'html':_0x1960ec[_0xc82a('0x55')],'headers':{'Date':moment(_0x1960ec[_0xc82a('0xa4')])[_0xc82a('0x72')](_0xc82a('0xa5'))},'attachments':[]};if(_0x53ee61['cc']){_0x55bafd[_0xc82a('0xa6')]['Cc']=_0x53ee61['cc'];}if(_0x53ee61[_0xc82a('0xa2')]){_0x55bafd['headers'][_0xc82a('0xa7')]=_0x53ee61[_0xc82a('0xa2')];}return new BPromise(function(_0xc6f193,_0x1d0e6b){if(_0x53ee61[_0xc82a('0xa8')]){for(var _0x39178c=0x0;_0x39178c<_0x53ee61[_0xc82a('0xa8')]['length'];_0x39178c++){var _0x12f4ea=_0x53ee61['Attachments'][_0x39178c];var _0x53a144=path[_0xc82a('0x9c')](_0x1e424e,_0x12f4ea['basename']);if(fs[_0xc82a('0xa9')](_0x53a144)){_0x55bafd['attachments'][_0xc82a('0xaa')]({'name':_0x12f4ea[_0xc82a('0x36')],'contentType':_0x12f4ea['type'],'data':fs[_0xc82a('0xab')](_0x53a144)});}}}emlformat[_0xc82a('0xac')](_0x55bafd,function(_0x6e3dc7,_0x9304f5){if(_0x6e3dc7)return _0x1d0e6b(_0x6e3dc7);fs[_0xc82a('0xad')](path[_0xc82a('0x9c')](_0xb4b466,_0x5b56b7),_0x9304f5);return _0xc6f193(_0x9304f5);});});}})[_0xc82a('0x1e')](function(_0xa37c88){if(_0xa37c88){return _0x4b57d0['download'](path['join'](_0xb4b466,_0x5b56b7),_0x5b56b7,function(_0x5cfb76){if(_0x5cfb76){console['log'](_0xc82a('0xae'),_0x5cfb76);}else{fs[_0xc82a('0xaf')](path[_0xc82a('0x9c')](_0xb4b466,_0x5b56b7));}});}})[_0xc82a('0x27')](handleError(_0x4b57d0,null));}; \ No newline at end of file +var _0xe0a6=['event','fromString','download','unix','join','files','tmp','server','from','bcc','subject','Attachment','Attachments','headers','Bcc','existsSync','push','err','unlinkSync','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','html-to-text','redis','defaults','localhost','./mailMessage.socket','register','jayson/promise','http','client','info','MailMessage,\x20%s,\x20%s','debug','MailMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','name','send','index','map','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','MailMessage','includeAll','include','rows','show','params','rawAttributes','options','body','find','describe','create','direction','out','split','MailAccount','findOne','CmContact','Contacts','updatedAt','Smtp','isNil','service','host','port','secure','authentication','user','pass','auth','attachments','root','server/files/attachments','basename','List','ListId','List\x20not\x20found','SendMail','sendMail','format','YYYY-MM-DD\x20HH:mm:ss','../../config/logger','mail-interactions','accept','mail','read','readAt','UserId','get','MailInteractionId','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','agent','manual','interface','channel','EventManager','acceptmessage','MailInteraction','interaction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','email','internal','SIP/%s'];(function(_0x2f0e5a,_0x41b8cc){var _0x295698=function(_0x487ca7){while(--_0x487ca7){_0x2f0e5a['push'](_0x2f0e5a['shift']());}};_0x295698(++_0x41b8cc);}(_0xe0a6,0xc0));var _0x6e0a=function(_0x52a219,_0x2f89f6){_0x52a219=_0x52a219-0x0;var _0x543a9c=_0xe0a6[_0x52a219];return _0x543a9c;};'use strict';var emlformat=require(_0x6e0a('0x0'));var rimraf=require(_0x6e0a('0x1'));var zipdir=require(_0x6e0a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6e0a('0x3'));var moment=require(_0x6e0a('0x4'));var BPromise=require(_0x6e0a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6e0a('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6e0a('0x7'));var _=require(_0x6e0a('0x8'));var squel=require(_0x6e0a('0x9'));var crypto=require(_0x6e0a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6e0a('0xb'));var querystring=require(_0x6e0a('0xc'));var Papa=require('papaparse');var Redis=require(_0x6e0a('0xd'));var authService=require(_0x6e0a('0xe'));var qs=require(_0x6e0a('0xf'));var as=require(_0x6e0a('0x10'));var hardwareService=require(_0x6e0a('0x11'));var logger=require('../../config/logger')(_0x6e0a('0x12'));var utils=require(_0x6e0a('0x13'));var config=require(_0x6e0a('0x14'));var licenseUtil=require(_0x6e0a('0x15'));var htmlToText=require(_0x6e0a('0x16'));var db=require('../../mysqldb')['db'];config[_0x6e0a('0x17')]=_[_0x6e0a('0x18')](config['redis'],{'host':_0x6e0a('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6e0a('0x1a'))[_0x6e0a('0x1b')](socket);var jayson=require(_0x6e0a('0x1c'));var client=jayson['client']['http']({'port':0x232c});var client9003=jayson['client'][_0x6e0a('0x1d')]({'port':0x232b});var client9002=jayson[_0x6e0a('0x1e')][_0x6e0a('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x5075ca,_0x5969eb,_0x589793,_0x5e16fe){return new BPromise(function(_0x32ea93,_0x2cb150){var _0x140cfa=_0x5e16fe||client;return _0x140cfa['request'](_0x5075ca,_0x589793)['then'](function(_0xcaaf63){logger[_0x6e0a('0x1f')](_0x6e0a('0x20'),_0x5969eb,'request\x20sent');logger[_0x6e0a('0x21')](_0x6e0a('0x22'),_0x5969eb,_0x6e0a('0x23'),JSON[_0x6e0a('0x24')](_0xcaaf63));if(_0xcaaf63['error']){if(_0xcaaf63[_0x6e0a('0x25')]['code']===0x1f4){logger[_0x6e0a('0x25')](_0x6e0a('0x20'),_0x5969eb,_0xcaaf63[_0x6e0a('0x25')][_0x6e0a('0x26')]);return _0x2cb150(_0xcaaf63[_0x6e0a('0x25')][_0x6e0a('0x26')]);}logger['error'](_0x6e0a('0x20'),_0x5969eb,_0xcaaf63[_0x6e0a('0x25')][_0x6e0a('0x26')]);return _0x32ea93(_0xcaaf63[_0x6e0a('0x25')][_0x6e0a('0x26')]);}else{logger[_0x6e0a('0x1f')](_0x6e0a('0x20'),_0x5969eb,_0x6e0a('0x23'));_0x32ea93(_0xcaaf63[_0x6e0a('0x27')]['message']);}})[_0x6e0a('0x28')](function(_0x4b3bef){logger['error']('MailMessage,\x20%s,\x20%s',_0x5969eb,_0x4b3bef);_0x2cb150(_0x4b3bef);});});}function respondWithStatusCode(_0x5ba1c8,_0x5a629c){_0x5a629c=_0x5a629c||0xcc;return function(_0x528e01){if(_0x528e01){return _0x5ba1c8[_0x6e0a('0x29')](_0x5a629c);}return _0x5ba1c8[_0x6e0a('0x2a')](_0x5a629c)[_0x6e0a('0x2b')]();};}function respondWithResult(_0x73281d,_0x53b7b8){_0x53b7b8=_0x53b7b8||0xc8;return function(_0x487f68){if(_0x487f68){return _0x73281d[_0x6e0a('0x2a')](_0x53b7b8)[_0x6e0a('0x2c')](_0x487f68);}};}function respondWithFilteredResult(_0x4ea91c,_0x389ccd){return function(_0x4e9f29){if(_0x4e9f29){var _0x436031=typeof _0x389ccd[_0x6e0a('0x2d')]===_0x6e0a('0x2e')&&typeof _0x389ccd[_0x6e0a('0x2f')]===_0x6e0a('0x2e');var _0x13498f=_0x4e9f29['count'];var _0x4b9a02=_0x436031?0x0:_0x389ccd[_0x6e0a('0x2d')];var _0x21342d=_0x436031?_0x4e9f29[_0x6e0a('0x30')]:_0x389ccd['offset']+_0x389ccd[_0x6e0a('0x2f')];var _0x1281eb;if(_0x21342d>=_0x13498f){_0x21342d=_0x13498f;_0x1281eb=0xc8;}else{_0x1281eb=0xce;}_0x4ea91c[_0x6e0a('0x2a')](_0x1281eb);return _0x4ea91c[_0x6e0a('0x31')]('Content-Range',_0x4b9a02+'-'+_0x21342d+'/'+_0x13498f)[_0x6e0a('0x2c')](_0x4e9f29);}return null;};}function patchUpdates(_0x23d64a){return function(_0x40ccc7){try{jsonpatch[_0x6e0a('0x32')](_0x40ccc7,_0x23d64a,!![]);}catch(_0x1f3f8c){return BPromise[_0x6e0a('0x33')](_0x1f3f8c);}return _0x40ccc7[_0x6e0a('0x34')]();};}function saveUpdates(_0x5b4842,_0x2351ff){return function(_0x2b6954){if(_0x2b6954){return _0x2b6954[_0x6e0a('0x35')](_0x5b4842)[_0x6e0a('0x36')](function(_0x549820){return _0x549820;});}return null;};}function removeEntity(_0xf73d52,_0x466e1b){return function(_0xc547b1){if(_0xc547b1){return _0xc547b1[_0x6e0a('0x37')]()[_0x6e0a('0x36')](function(){_0xf73d52[_0x6e0a('0x2a')](0xcc)[_0x6e0a('0x2b')]();});}};}function handleEntityNotFound(_0x4e7c7b,_0xe6fca2){return function(_0x402b77){if(!_0x402b77){_0x4e7c7b['sendStatus'](0x194);}return _0x402b77;};}function handleError(_0x4dc5b4,_0x8fe5a9){_0x8fe5a9=_0x8fe5a9||0x1f4;return function(_0x218332){logger[_0x6e0a('0x25')](_0x218332['stack']);if(_0x218332[_0x6e0a('0x38')]){delete _0x218332[_0x6e0a('0x38')];}_0x4dc5b4['status'](_0x8fe5a9)[_0x6e0a('0x39')](_0x218332);};}exports[_0x6e0a('0x3a')]=function(_0x5bc855,_0x465155){var _0x5eac57={},_0x1ebe39={},_0xa00a11={'count':0x0,'rows':[]};var _0x1b0ac1=_[_0x6e0a('0x3b')](db['MailMessage']['rawAttributes'],function(_0x491f0e){return{'name':_0x491f0e['fieldName'],'type':_0x491f0e[_0x6e0a('0x3c')][_0x6e0a('0x3d')]};});_0x1ebe39[_0x6e0a('0x3e')]=_[_0x6e0a('0x3b')](_0x1b0ac1,_0x6e0a('0x38'));_0x1ebe39[_0x6e0a('0x3f')]=_[_0x6e0a('0x40')](_0x5bc855[_0x6e0a('0x3f')]);_0x1ebe39[_0x6e0a('0x41')]=_[_0x6e0a('0x42')](_0x1ebe39[_0x6e0a('0x3e')],_0x1ebe39[_0x6e0a('0x3f')]);_0x5eac57[_0x6e0a('0x43')]=_[_0x6e0a('0x42')](_0x1ebe39[_0x6e0a('0x3e')],qs[_0x6e0a('0x44')](_0x5bc855[_0x6e0a('0x3f')][_0x6e0a('0x44')]));_0x5eac57[_0x6e0a('0x43')]=_0x5eac57[_0x6e0a('0x43')][_0x6e0a('0x45')]?_0x5eac57[_0x6e0a('0x43')]:_0x1ebe39['model'];if(!_0x5bc855[_0x6e0a('0x3f')][_0x6e0a('0x46')]('nolimit')){_0x5eac57[_0x6e0a('0x2f')]=qs[_0x6e0a('0x2f')](_0x5bc855['query'][_0x6e0a('0x2f')]);_0x5eac57[_0x6e0a('0x2d')]=qs[_0x6e0a('0x2d')](_0x5bc855[_0x6e0a('0x3f')][_0x6e0a('0x2d')]);}_0x5eac57[_0x6e0a('0x47')]=qs[_0x6e0a('0x48')](_0x5bc855[_0x6e0a('0x3f')][_0x6e0a('0x48')]);_0x5eac57[_0x6e0a('0x49')]=qs[_0x6e0a('0x41')](_[_0x6e0a('0x4a')](_0x5bc855[_0x6e0a('0x3f')],_0x1ebe39[_0x6e0a('0x41')]),_0x1b0ac1);if(_0x5bc855[_0x6e0a('0x3f')][_0x6e0a('0x4b')]){_0x5eac57[_0x6e0a('0x49')]=_[_0x6e0a('0x4c')](_0x5eac57[_0x6e0a('0x49')],{'$or':_['map'](_0x1b0ac1,function(_0x5216e9){if(_0x5216e9['type']!==_0x6e0a('0x4d')){var _0x108fc4={};_0x108fc4[_0x5216e9[_0x6e0a('0x38')]]={'$like':'%'+_0x5bc855[_0x6e0a('0x3f')][_0x6e0a('0x4b')]+'%'};return _0x108fc4;}})});}_0x5eac57=_['merge']({},_0x5eac57,_0x5bc855['options']);var _0x467c13={'where':_0x5eac57[_0x6e0a('0x49')]};return db[_0x6e0a('0x4e')][_0x6e0a('0x30')](_0x467c13)[_0x6e0a('0x36')](function(_0x5cb081){_0xa00a11[_0x6e0a('0x30')]=_0x5cb081;if(_0x5bc855[_0x6e0a('0x3f')][_0x6e0a('0x4f')]){_0x5eac57[_0x6e0a('0x50')]=[{'all':!![]}];}return db[_0x6e0a('0x4e')]['findAll'](_0x5eac57);})[_0x6e0a('0x36')](function(_0x1fb1b6){_0xa00a11[_0x6e0a('0x51')]=_0x1fb1b6;return _0xa00a11;})[_0x6e0a('0x36')](respondWithFilteredResult(_0x465155,_0x5eac57))[_0x6e0a('0x28')](handleError(_0x465155,null));};exports[_0x6e0a('0x52')]=function(_0x326cd0,_0x19361b){var _0x540689={'raw':!![],'where':{'id':_0x326cd0[_0x6e0a('0x53')]['id']}},_0x191746={};_0x191746[_0x6e0a('0x3e')]=_[_0x6e0a('0x40')](db[_0x6e0a('0x4e')][_0x6e0a('0x54')]);_0x191746[_0x6e0a('0x3f')]=_[_0x6e0a('0x40')](_0x326cd0[_0x6e0a('0x3f')]);_0x191746[_0x6e0a('0x41')]=_[_0x6e0a('0x42')](_0x191746[_0x6e0a('0x3e')],_0x191746[_0x6e0a('0x3f')]);_0x540689[_0x6e0a('0x43')]=_[_0x6e0a('0x42')](_0x191746[_0x6e0a('0x3e')],qs['fields'](_0x326cd0[_0x6e0a('0x3f')]['fields']));_0x540689['attributes']=_0x540689[_0x6e0a('0x43')][_0x6e0a('0x45')]?_0x540689[_0x6e0a('0x43')]:_0x191746[_0x6e0a('0x3e')];if(_0x326cd0['query'][_0x6e0a('0x4f')]){_0x540689[_0x6e0a('0x50')]=[{'all':!![]}];}_0x540689=_['merge']({},_0x540689,_0x326cd0[_0x6e0a('0x55')]);return db['MailMessage']['find'](_0x540689)['then'](handleEntityNotFound(_0x19361b,null))['then'](respondWithResult(_0x19361b,null))[_0x6e0a('0x28')](handleError(_0x19361b,null));};exports['update']=function(_0x2e5f63,_0x115b4e){if(_0x2e5f63[_0x6e0a('0x56')]['id']){delete _0x2e5f63['body']['id'];}return db[_0x6e0a('0x4e')][_0x6e0a('0x57')]({'where':{'id':_0x2e5f63['params']['id']}})[_0x6e0a('0x36')](handleEntityNotFound(_0x115b4e,null))['then'](saveUpdates(_0x2e5f63[_0x6e0a('0x56')],null))[_0x6e0a('0x36')](respondWithResult(_0x115b4e,null))['catch'](handleError(_0x115b4e,null));};exports[_0x6e0a('0x37')]=function(_0x27444e,_0x454d11){return db['MailMessage'][_0x6e0a('0x57')]({'where':{'id':_0x27444e['params']['id']}})['then'](handleEntityNotFound(_0x454d11,null))[_0x6e0a('0x36')](removeEntity(_0x454d11,null))[_0x6e0a('0x28')](handleError(_0x454d11,null));};exports[_0x6e0a('0x58')]=function(_0x1eb069,_0x267ec3){return db['MailMessage'][_0x6e0a('0x58')]()[_0x6e0a('0x36')](respondWithResult(_0x267ec3,null))[_0x6e0a('0x28')](handleError(_0x267ec3,null));};exports[_0x6e0a('0x59')]=function(_0x2565b8,_0x3a7abd){return db[_0x6e0a('0x4e')][_0x6e0a('0x59')](_0x2565b8['body'])['then'](function(_0x18b02a){if(_0x18b02a){if(_0x18b02a[_0x6e0a('0x5a')]===_0x6e0a('0x5b')&&!_0x18b02a['secret']){var _0x4e131e,_0x53ce11,_0x3122d0;if(_0x2565b8['body']['to']){_0x53ce11=_0x2565b8['body']['to'][_0x6e0a('0x5c')](',')[0x0];}return db[_0x6e0a('0x5d')][_0x6e0a('0x5e')]({'where':{'id':_0x18b02a['MailAccountId']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db[_0x6e0a('0x5f')],'as':_0x6e0a('0x60'),'where':{'email':_0x53ce11},'limit':0x1,'order':[[_0x6e0a('0x61'),'DESC']]}]},{'model':db['MailServerOut'],'as':_0x6e0a('0x62'),'raw':!![]}]})['then'](function(_0x5f2407){_0x4e131e=_0x5f2407;if(_0x4e131e&&_0x4e131e[_0x6e0a('0x62')]){var _0x2f3210={'tls':{'rejectUnauthorized':![]}};if(_[_0x6e0a('0x63')](_0x4e131e[_0x6e0a('0x62')][_0x6e0a('0x64')])){_0x2f3210[_0x6e0a('0x65')]=_0x4e131e[_0x6e0a('0x62')][_0x6e0a('0x65')];_0x2f3210['port']=_0x4e131e[_0x6e0a('0x62')][_0x6e0a('0x66')];_0x2f3210[_0x6e0a('0x67')]=_0x4e131e[_0x6e0a('0x62')][_0x6e0a('0x67')];if(_0x4e131e[_0x6e0a('0x62')][_0x6e0a('0x68')]){_0x2f3210['auth']={'user':_0x4e131e[_0x6e0a('0x62')][_0x6e0a('0x69')],'pass':_0x4e131e['Smtp'][_0x6e0a('0x6a')]};}}else{_0x2f3210[_0x6e0a('0x64')]=_0x4e131e[_0x6e0a('0x62')][_0x6e0a('0x64')];_0x2f3210[_0x6e0a('0x6b')]={'user':_0x4e131e[_0x6e0a('0x62')][_0x6e0a('0x69')],'pass':_0x4e131e['Smtp'][_0x6e0a('0x6a')]};_0x2f3210[_0x6e0a('0x67')]=_0x4e131e['Smtp'][_0x6e0a('0x67')];}if(_0x2565b8['body']['attachments']&&_0x2565b8[_0x6e0a('0x56')][_0x6e0a('0x6c')][_0x6e0a('0x45')]){for(var _0x1de739=0x0;_0x1de739<_0x2565b8[_0x6e0a('0x56')][_0x6e0a('0x6c')][_0x6e0a('0x45')];_0x1de739+=0x1){_0x2565b8[_0x6e0a('0x56')][_0x6e0a('0x6c')][_0x1de739]={'filename':_0x2565b8['body'][_0x6e0a('0x6c')][_0x1de739]['name'],'path':path['join'](config[_0x6e0a('0x6d')],_0x6e0a('0x6e'),_0x2565b8[_0x6e0a('0x56')]['attachments'][_0x1de739][_0x6e0a('0x6f')])};}}_0x3122d0={'account':_0x2f3210,'message':_0x2565b8[_0x6e0a('0x56')]};return;}})[_0x6e0a('0x36')](function(){if(_0x4e131e[_0x6e0a('0x70')]){if(_0x4e131e['List'][_0x6e0a('0x60')][_0x6e0a('0x45')]){return _0x4e131e[_0x6e0a('0x70')][_0x6e0a('0x60')][0x0];}else{return db[_0x6e0a('0x5f')][_0x6e0a('0x59')](_[_0x6e0a('0x18')](_0x2565b8[_0x6e0a('0x56')],{'firstName':_0x2565b8[_0x6e0a('0x56')]['to'],'email':_0x2565b8[_0x6e0a('0x56')]['to'],'phone':_0x2565b8[_0x6e0a('0x56')]['to'],'ListId':_0x4e131e[_0x6e0a('0x71')]}));}}else{throw new Error(_0x6e0a('0x72'));}})[_0x6e0a('0x36')](function(){if(_0x3122d0){return respondWithRpcPromise(_0x6e0a('0x73'),_0x6e0a('0x74'),_0x3122d0,client9003)['then'](function(_0x57a1c3){return _0x18b02a[_0x6e0a('0x35')]({'read':!![],'messageId':_0x57a1c3['messageId'],'sentAt':moment()[_0x6e0a('0x75')](_0x6e0a('0x76'))});})[_0x6e0a('0x28')](function(_0x5e692f){logger[_0x6e0a('0x25')]('%s',JSON['stringify'](_0x5e692f));return _0x18b02a;});}return _0x18b02a;});}return _0x18b02a;}})['then'](respondWithResult(_0x3a7abd,0xc9))[_0x6e0a('0x28')](handleError(_0x3a7abd,null));};var interaction_log=require(_0x6e0a('0x77'))(_0x6e0a('0x78'));exports[_0x6e0a('0x79')]=function(_0x1ef995,_0x27ca94,_0x4193f9){var _0x520a75={'agent':{},'channel':_0x6e0a('0x7a')};if(_0x1ef995['body']['id']){delete _0x1ef995[_0x6e0a('0x56')]['id'];}_0x1ef995['body'][_0x6e0a('0x7b')]=!![];_0x1ef995['body'][_0x6e0a('0x7c')]=moment()[_0x6e0a('0x75')](_0x6e0a('0x76'));_0x1ef995['body'][_0x6e0a('0x7d')]=_0x1ef995[_0x6e0a('0x56')][_0x6e0a('0x7d')]||_0x1ef995[_0x6e0a('0x69')]['id'];_0x520a75['agent']['id']=_0x1ef995['body'][_0x6e0a('0x7d')];return db[_0x6e0a('0x4e')][_0x6e0a('0x57')]({'where':{'id':_0x1ef995[_0x6e0a('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x27ca94,null))[_0x6e0a('0x36')](saveUpdates(_0x1ef995['body'],null))[_0x6e0a('0x36')](function(_0x4d59d4){if(_0x4d59d4){_0x520a75['message']=_0x4d59d4[_0x6e0a('0x7e')]({'plain':!![]});return db['MailInteraction'][_0x6e0a('0x57')]({'where':{'id':_0x4d59d4[_0x6e0a('0x7f')]}});}return null;})['then'](handleEntityNotFound(_0x27ca94,null))[_0x6e0a('0x36')](function(_0x3c8fe5){if(_0x3c8fe5){return _0x3c8fe5[_0x6e0a('0x35')]({'UserId':_0x1ef995[_0x6e0a('0x56')][_0x6e0a('0x7d')],'read1stAt':_[_0x6e0a('0x63')](_0x3c8fe5['read1stAt'])?moment()[_0x6e0a('0x75')](_0x6e0a('0x76')):undefined});}return null;})[_0x6e0a('0x36')](function(_0x564361){if(_0x564361){_0x520a75['interaction']=_0x564361[_0x6e0a('0x7e')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x1ef995[_0x6e0a('0x69')]['id'],_0x1ef995[_0x6e0a('0x69')][_0x6e0a('0x38')],_0x1ef995['user'][_0x6e0a('0x80')],_0x520a75['interaction']['id'],_0x1ef995[_0x6e0a('0x56')]?JSON[_0x6e0a('0x24')](_0x1ef995[_0x6e0a('0x56')]):_0x6e0a('0x81'));return respondWithRpcPromise(_0x6e0a('0x82'),_0x6e0a('0x83'),_0x520a75);}return null;})[_0x6e0a('0x36')](function(_0x39b1b2){var _0x283caf=_0x6e0a('0x84')+_0x39b1b2[_0x6e0a('0x26')][_0x6e0a('0x85')];return db[_0x6e0a('0x86')]['query'](_0x283caf,{'type':db[_0x6e0a('0x87')][_0x6e0a('0x88')][_0x6e0a('0x89')],'raw':!![]})[_0x6e0a('0x36')](function(_0x387abd){return _0x387abd;});})[_0x6e0a('0x36')](function(_0x322e2b){if(_0x322e2b){_0x520a75[_0x6e0a('0x26')][_0x6e0a('0x8a')]=_0x322e2b[0x0];if(!_0x1ef995[_0x6e0a('0x56')][_0x6e0a('0x7d')])return;return db[_0x6e0a('0x8b')][_0x6e0a('0x57')]({'where':{'id':_0x1ef995['body']['UserId'],'role':'agent'},'attributes':['id','name',_0x6e0a('0x8c'),'email','internal'],'raw':!![]});}return null;})[_0x6e0a('0x36')](function(_0x557863){if(!_0x557863)return null;_0x520a75[_0x6e0a('0x26')][_0x6e0a('0x8d')]=_0x557863;return _0x520a75;})[_0x6e0a('0x36')](function(_0x5cb1a5){if(_0x5cb1a5){if(_0x1ef995[_0x6e0a('0x56')][_0x6e0a('0x8e')]){_0x520a75['message'][_0x6e0a('0x8f')]=util[_0x6e0a('0x75')]('SIP/%s',_0x1ef995['user']['name']);_0x520a75[_0x6e0a('0x26')][_0x6e0a('0x90')]=_0x520a75[_0x6e0a('0x90')];_0x520a75[_0x6e0a('0x26')]['event']='accept';_0x520a75[_0x6e0a('0x26')][_0x6e0a('0x56')]=htmlToText['fromString'](_0x520a75[_0x6e0a('0x26')][_0x6e0a('0x56')]);return respondWithRpcPromise(_0x6e0a('0x91'),_0x6e0a('0x91'),{'event':_0x6e0a('0x92'),'message':_0x520a75['message']},client9002)[_0x6e0a('0x36')](function(){return _0x520a75;});}return _0x520a75;}return null;})[_0x6e0a('0x36')](respondWithResult(_0x27ca94,null))[_0x6e0a('0x28')](handleError(_0x27ca94,null));};var interaction_log=require(_0x6e0a('0x77'))(_0x6e0a('0x78'));exports[_0x6e0a('0x33')]=function(_0x174f66,_0x5b3611,_0x44a481){var _0x44781a={'agent':{},'channel':_0x6e0a('0x7a')};if(_0x174f66[_0x6e0a('0x56')]['id']){delete _0x174f66[_0x6e0a('0x56')]['id'];}_0x174f66[_0x6e0a('0x56')][_0x6e0a('0x7d')]=_0x174f66[_0x6e0a('0x56')]['UserId']||_0x174f66[_0x6e0a('0x69')]['id'];_0x44781a['agent']['id']=_0x174f66[_0x6e0a('0x56')][_0x6e0a('0x7d')];return db[_0x6e0a('0x4e')][_0x6e0a('0x57')]({'where':{'id':_0x174f66[_0x6e0a('0x53')]['id'],'UserId':null}})[_0x6e0a('0x36')](handleEntityNotFound(_0x5b3611,null))[_0x6e0a('0x36')](function(_0x3a1e2){if(_0x3a1e2){_0x44781a[_0x6e0a('0x26')]=_0x3a1e2[_0x6e0a('0x7e')]({'plain':!![]});return db[_0x6e0a('0x93')][_0x6e0a('0x57')]({'where':{'id':_0x3a1e2[_0x6e0a('0x7f')]}});}return null;})[_0x6e0a('0x36')](handleEntityNotFound(_0x5b3611,null))[_0x6e0a('0x36')](function(_0x5aa1f3){if(_0x5aa1f3){_0x44781a[_0x6e0a('0x94')]=_0x5aa1f3[_0x6e0a('0x7e')]({'plain':!![]});interaction_log[_0x6e0a('0x1f')](_0x6e0a('0x95'),_0x174f66[_0x6e0a('0x69')]['id'],_0x174f66[_0x6e0a('0x69')][_0x6e0a('0x38')],_0x174f66['user'][_0x6e0a('0x80')],_0x44781a[_0x6e0a('0x94')]['id'],_0x174f66['body']?JSON[_0x6e0a('0x24')](_0x174f66[_0x6e0a('0x56')]):_0x6e0a('0x81'));return respondWithRpcPromise(_0x6e0a('0x96'),'rejectMessage',_0x44781a);}return null;})[_0x6e0a('0x36')](function(_0x5f5542){var _0x134567='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5f5542['message'][_0x6e0a('0x85')];return db[_0x6e0a('0x86')][_0x6e0a('0x3f')](_0x134567,{'type':db[_0x6e0a('0x87')][_0x6e0a('0x88')][_0x6e0a('0x89')],'raw':!![]})[_0x6e0a('0x36')](function(_0x544a5a){return _0x544a5a;});})['then'](function(_0x4c55b8){if(_0x4c55b8){_0x44781a[_0x6e0a('0x26')][_0x6e0a('0x8a')]=_0x4c55b8[0x0];if(!_0x174f66[_0x6e0a('0x56')]['UserId'])return;return db[_0x6e0a('0x8b')][_0x6e0a('0x57')]({'where':{'id':_0x174f66['body'][_0x6e0a('0x7d')],'role':_0x6e0a('0x8d')},'attributes':['id',_0x6e0a('0x38'),'fullname',_0x6e0a('0x97'),_0x6e0a('0x98')],'raw':!![]});}return null;})[_0x6e0a('0x36')](function(_0x38a033){if(!_0x38a033)return null;_0x44781a[_0x6e0a('0x26')]['agent']=_0x38a033;return _0x44781a;})[_0x6e0a('0x36')](function(_0x5e12fd){if(_0x5e12fd){_0x5e12fd[_0x6e0a('0x26')]['interface']=util[_0x6e0a('0x75')](_0x6e0a('0x99'),_0x174f66[_0x6e0a('0x69')][_0x6e0a('0x38')]);_0x5e12fd[_0x6e0a('0x26')][_0x6e0a('0x90')]=_0x44781a[_0x6e0a('0x90')];_0x5e12fd[_0x6e0a('0x26')][_0x6e0a('0x9a')]=_0x6e0a('0x33');_0x5e12fd[_0x6e0a('0x26')][_0x6e0a('0x56')]=htmlToText[_0x6e0a('0x9b')](_0x44781a[_0x6e0a('0x26')][_0x6e0a('0x56')]);respondWithRpcPromise(_0x6e0a('0x91'),_0x6e0a('0x91'),{'event':'rejectmessage','message':_0x5e12fd[_0x6e0a('0x26')]},client9002);return _0x44781a;}return null;})[_0x6e0a('0x36')](respondWithResult(_0x5b3611,null))['catch'](handleError(_0x5b3611,null));};exports[_0x6e0a('0x9c')]=function(_0x1cbe68,_0x2e4ada){var _0xa6aa6f=moment()[_0x6e0a('0x9d')]()['toString']();var _0x51f131=path[_0x6e0a('0x9e')](config[_0x6e0a('0x6d')],'server',_0x6e0a('0x9f'),_0x6e0a('0xa0'));var _0x51e48e=path[_0x6e0a('0x9e')](config[_0x6e0a('0x6d')],_0x6e0a('0xa1'),_0x6e0a('0x9f'),_0x6e0a('0x6c'));var _0x3cf16c=util['format']('message-%s.eml',_0xa6aa6f);return db['MailMessage'][_0x6e0a('0x57')]({'where':{'id':_0x1cbe68[_0x6e0a('0x53')]['id']},'attributes':['id',_0x6e0a('0x56'),_0x6e0a('0xa2'),'to','cc',_0x6e0a('0xa3'),_0x6e0a('0xa4'),'createdAt'],'include':_0x1cbe68[_0x6e0a('0x3f')][_0x6e0a('0x6c')]?[{'model':db[_0x6e0a('0xa5')],'as':_0x6e0a('0xa6')}]:undefined})[_0x6e0a('0x36')](handleEntityNotFound(_0x2e4ada,null))[_0x6e0a('0x36')](function(_0x3fe6ab){if(_0x3fe6ab){var _0x4d976d=_0x3fe6ab;var _0x19071f={'from':_0x4d976d[_0x6e0a('0xa2')],'to':_0x4d976d['to'],'subject':_0x4d976d[_0x6e0a('0xa4')],'html':_0x4d976d[_0x6e0a('0x56')],'headers':{'Date':moment(_0x4d976d['createdAt'])[_0x6e0a('0x75')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x3fe6ab['cc']){_0x19071f[_0x6e0a('0xa7')]['Cc']=_0x3fe6ab['cc'];}if(_0x3fe6ab[_0x6e0a('0xa3')]){_0x19071f[_0x6e0a('0xa7')][_0x6e0a('0xa8')]=_0x3fe6ab['bcc'];}return new BPromise(function(_0x3394ee,_0x1e2079){if(_0x3fe6ab[_0x6e0a('0xa6')]){for(var _0x3b2fc5=0x0;_0x3b2fc5<_0x3fe6ab['Attachments'][_0x6e0a('0x45')];_0x3b2fc5++){var _0x2b4ab1=_0x3fe6ab[_0x6e0a('0xa6')][_0x3b2fc5];var _0x548a5c=path[_0x6e0a('0x9e')](_0x51e48e,_0x2b4ab1[_0x6e0a('0x6f')]);if(fs[_0x6e0a('0xa9')](_0x548a5c)){_0x19071f[_0x6e0a('0x6c')][_0x6e0a('0xaa')]({'name':_0x2b4ab1[_0x6e0a('0x38')],'contentType':_0x2b4ab1[_0x6e0a('0x3c')],'data':fs['readFileSync'](_0x548a5c)});}}}emlformat['build'](_0x19071f,function(_0x8a47e9,_0x3deee6){if(_0x8a47e9)return _0x1e2079(_0x8a47e9);fs['writeFileSync'](path[_0x6e0a('0x9e')](_0x51f131,_0x3cf16c),_0x3deee6);return _0x3394ee(_0x3deee6);});});}})[_0x6e0a('0x36')](function(_0x1225ab){if(_0x1225ab){return _0x2e4ada['download'](path[_0x6e0a('0x9e')](_0x51f131,_0x3cf16c),_0x3cf16c,function(_0x5d0017){if(_0x5d0017){console['log'](_0x6e0a('0xab'),_0x5d0017);}else{fs[_0x6e0a('0xac')](path[_0x6e0a('0x9e')](_0x51f131,_0x3cf16c));}});}})[_0x6e0a('0x28')](handleError(_0x2e4ada,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index 34a115c..3390dda 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 _0x097a=['../../mysqldb','setMaxListeners','emit','events'];(function(_0x5b8dea,_0x289a9e){var _0x88c89=function(_0x4ade6e){while(--_0x4ade6e){_0x5b8dea['push'](_0x5b8dea['shift']());}};_0x88c89(++_0x289a9e);}(_0x097a,0x1a7));var _0xa097=function(_0x31ae68,_0x2b9d2b){_0x31ae68=_0x31ae68-0x0;var _0x137156=_0x097a[_0x31ae68];return _0x137156;};'use strict';var EventEmitter=require(_0xa097('0x0'));var MailMessage=require(_0xa097('0x1'))['db']['MailMessage'];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0xa097('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x3ecff5){return function(_0x5467ec,_0x926b0d,_0x16e54b){MailMessageEvents[_0xa097('0x3')](_0x3ecff5+':'+_0x5467ec['id'],_0x5467ec);MailMessageEvents['emit'](_0x3ecff5,_0x5467ec);_0x16e54b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module['exports']=MailMessageEvents; \ No newline at end of file +var _0xb7b2=['update','remove','emit','hook','exports','MailMessage','setMaxListeners','save'];(function(_0x15624a,_0x62a80b){var _0x42b811=function(_0x5470eb){while(--_0x5470eb){_0x15624a['push'](_0x15624a['shift']());}};_0x42b811(++_0x62a80b);}(_0xb7b2,0x75));var _0x2b7b=function(_0xda22c4,_0x9e17df){_0xda22c4=_0xda22c4-0x0;var _0x5dd763=_0xb7b2[_0xda22c4];return _0x5dd763;};'use strict';var EventEmitter=require('events');var MailMessage=require('../../mysqldb')['db'][_0x2b7b('0x0')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x2b7b('0x1')](0x0);var events={'afterCreate':_0x2b7b('0x2'),'afterUpdate':_0x2b7b('0x3'),'afterDestroy':_0x2b7b('0x4')};function emitEvent(_0x3efcce){return function(_0x48fe98,_0x3ca4ef,_0x364296){MailMessageEvents[_0x2b7b('0x5')](_0x3efcce+':'+_0x48fe98['id'],_0x48fe98);MailMessageEvents['emit'](_0x3efcce,_0x48fe98);_0x364296(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailMessage[_0x2b7b('0x6')](e,emitEvent(event));}}module[_0x2b7b('0x7')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index fd7c831..f948d32 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 _0xa9df=['define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','get','toLowerCase','direction','out','secret','MailInteraction','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports'];(function(_0x3bfa57,_0x15cb18){var _0x36c355=function(_0x5c4884){while(--_0x5c4884){_0x3bfa57['push'](_0x3bfa57['shift']());}};_0x36c355(++_0x15cb18);}(_0xa9df,0x180));var _0xfa9d=function(_0x5f1bf6,_0x3561a1){_0x5f1bf6=_0x5f1bf6-0x0;var _0x3e56a9=_0xa9df[_0x5f1bf6];return _0x3e56a9;};'use strict';var _=require(_0xfa9d('0x0'));var util=require(_0xfa9d('0x1'));var logger=require(_0xfa9d('0x2'))(_0xfa9d('0x3'));var moment=require(_0xfa9d('0x4'));var BPromise=require(_0xfa9d('0x5'));var rp=require(_0xfa9d('0x6'));var htmlToText=require(_0xfa9d('0x7'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfa9d('0x8'));var config=require(_0xfa9d('0x9'));var attributes=require(_0xfa9d('0xa'));module[_0xfa9d('0xb')]=function(_0x2a9567,_0x5a4c98){return _0x2a9567[_0xfa9d('0xc')](_0xfa9d('0xd'),attributes,{'tableName':_0xfa9d('0xe'),'paranoid':![],'indexes':[{'name':_0xfa9d('0xf'),'fields':[_0xfa9d('0xf')]},{'name':_0xfa9d('0x10'),'fields':[_0xfa9d('0x11'),_0xfa9d('0x12')],'type':_0xfa9d('0x13')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x2633a1,_0x58e649,_0x489c8f){if(_0x2633a1[_0xfa9d('0x14')]){_0x2633a1['plainBody']=htmlToText[_0xfa9d('0x15')](_0x2633a1['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x489c8f(null,_0x58e649);},'afterCreate':function(_0x2a01eb,_0x288f1f,_0x3eeab0){var _0x270d5f=_0x2a9567[_0xfa9d('0x16')];var _0x1c82f5=_0x2a01eb[_0xfa9d('0x17')]({'plain':!![]});if(_0x1c82f5['direction'][_0xfa9d('0x18')]()==='in'||_0x1c82f5[_0xfa9d('0x19')][_0xfa9d('0x18')]()===_0xfa9d('0x1a')&&!_0x1c82f5[_0xfa9d('0x1b')]&&!_['isNil'](_0x1c82f5['UserId'])){_0x270d5f[_0xfa9d('0x1c')]['findOne']({'where':{'id':_0x1c82f5[_0xfa9d('0x1d')]}})[_0xfa9d('0x1e')](function(_0x41d919){if(_0x41d919){_0x41d919[_0xfa9d('0x1f')]({'lastMsgAt':_0x1c82f5[_0xfa9d('0x20')],'lastMsgDirection':_0x1c82f5[_0xfa9d('0x19')][_0xfa9d('0x18')]()});}})[_0xfa9d('0x21')](function(_0x203ea6){console[_0xfa9d('0x22')](_0x203ea6);});}_0x3eeab0();}},'charset':_0xfa9d('0x23'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x63ea=['isNil','UserId','MailInteraction','findOne','MailInteractionId','then','update','createdAt','catch','error','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','html-to-text','path','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','models','get','direction','toLowerCase','out'];(function(_0x2853dd,_0x32a80e){var _0x176766=function(_0x343c86){while(--_0x343c86){_0x2853dd['push'](_0x2853dd['shift']());}};_0x176766(++_0x32a80e);}(_0x63ea,0xf6));var _0xa63e=function(_0x4c3b5,_0x1b5db7){_0x4c3b5=_0x4c3b5-0x0;var _0xe7ddd=_0x63ea[_0x4c3b5];return _0xe7ddd;};'use strict';var _=require(_0xa63e('0x0'));var util=require(_0xa63e('0x1'));var logger=require(_0xa63e('0x2'))(_0xa63e('0x3'));var moment=require(_0xa63e('0x4'));var BPromise=require(_0xa63e('0x5'));var rp=require(_0xa63e('0x6'));var htmlToText=require(_0xa63e('0x7'));var fs=require('fs');var path=require(_0xa63e('0x8'));var rimraf=require(_0xa63e('0x9'));var config=require(_0xa63e('0xa'));var attributes=require(_0xa63e('0xb'));module[_0xa63e('0xc')]=function(_0x4ea250,_0x30d557){return _0x4ea250[_0xa63e('0xd')](_0xa63e('0xe'),attributes,{'tableName':_0xa63e('0xf'),'paranoid':![],'indexes':[{'name':'messageId','fields':[_0xa63e('0x10')]},{'name':_0xa63e('0x11'),'fields':[_0xa63e('0x12'),_0xa63e('0x13')],'type':_0xa63e('0x14')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x4503a2,_0xf1cdaa,_0x38fed4){if(_0x4503a2[_0xa63e('0x15')]){_0x4503a2[_0xa63e('0x12')]=htmlToText['fromString'](_0x4503a2[_0xa63e('0x15')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x38fed4(null,_0xf1cdaa);},'afterCreate':function(_0x1b2670,_0x1a7587,_0x19d135){var _0x5310e6=_0x4ea250[_0xa63e('0x16')];var _0x443145=_0x1b2670[_0xa63e('0x17')]({'plain':!![]});if(_0x443145[_0xa63e('0x18')][_0xa63e('0x19')]()==='in'||_0x443145[_0xa63e('0x18')][_0xa63e('0x19')]()===_0xa63e('0x1a')&&!_0x443145['secret']&&!_[_0xa63e('0x1b')](_0x443145[_0xa63e('0x1c')])){_0x5310e6[_0xa63e('0x1d')][_0xa63e('0x1e')]({'where':{'id':_0x443145[_0xa63e('0x1f')]}})[_0xa63e('0x20')](function(_0x3d8308){if(_0x3d8308){_0x3d8308[_0xa63e('0x21')]({'lastMsgAt':_0x443145[_0xa63e('0x22')],'lastMsgDirection':_0x443145['direction'][_0xa63e('0x19')]()});}})[_0xa63e('0x23')](function(_0x52af7d){console[_0xa63e('0x24')](_0x52af7d);});}_0x19d135();}},'charset':_0xa63e('0x25'),'collate':_0xa63e('0x26')});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index bf41afd..5a70a57 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 _0xb03e=['raw','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateMailMessage','MailMessage','create','body','options'];(function(_0x27b96d,_0x531d23){var _0xe1a73a=function(_0x202dac){while(--_0x202dac){_0x27b96d['push'](_0x27b96d['shift']());}};_0xe1a73a(++_0x531d23);}(_0xb03e,0x1eb));var _0xeb03=function(_0x50fbba,_0x1787f1){_0x50fbba=_0x50fbba-0x0;var _0x372914=_0xb03e[_0x50fbba];return _0x372914;};'use strict';var _=require('lodash');var util=require(_0xeb03('0x0'));var moment=require(_0xeb03('0x1'));var BPromise=require(_0xeb03('0x2'));var rs=require(_0xeb03('0x3'));var fs=require('fs');var Redis=require(_0xeb03('0x4'));var db=require(_0xeb03('0x5'))['db'];var utils=require(_0xeb03('0x6'));var logger=require(_0xeb03('0x7'))(_0xeb03('0x8'));var config=require(_0xeb03('0x9'));var jayson=require(_0xeb03('0xa'));var client=jayson[_0xeb03('0xb')]['http']({'port':0x232a});config[_0xeb03('0xc')]=_[_0xeb03('0xd')](config[_0xeb03('0xc')],{'host':_0xeb03('0xe'),'port':0x18eb});var socket=require(_0xeb03('0xf'))(new Redis(config[_0xeb03('0xc')]));require('./mailMessage.socket')[_0xeb03('0x10')](socket);function respondWithRpcPromise(_0x99f4e2,_0x14cfa0,_0x4f5013){return new BPromise(function(_0x31af2c,_0x48af4f){return client[_0xeb03('0x11')](_0x99f4e2,_0x4f5013)[_0xeb03('0x12')](function(_0x3de728){logger[_0xeb03('0x13')](_0xeb03('0x14'),_0x14cfa0,_0xeb03('0x15'));logger[_0xeb03('0x16')](_0xeb03('0x17'),_0x14cfa0,_0xeb03('0x15'),JSON[_0xeb03('0x18')](_0x3de728));if(_0x3de728[_0xeb03('0x19')]){if(_0x3de728[_0xeb03('0x19')]['code']===0x1f4){logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x3de728[_0xeb03('0x19')][_0xeb03('0x1a')]);return _0x48af4f(_0x3de728['error'][_0xeb03('0x1a')]);}logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x3de728['error'][_0xeb03('0x1a')]);return _0x31af2c(_0x3de728[_0xeb03('0x19')][_0xeb03('0x1a')]);}else{logger[_0xeb03('0x13')](_0xeb03('0x14'),_0x14cfa0,_0xeb03('0x15'));_0x31af2c(_0x3de728[_0xeb03('0x1b')][_0xeb03('0x1a')]);}})[_0xeb03('0x1c')](function(_0x469d25){logger[_0xeb03('0x19')](_0xeb03('0x14'),_0x14cfa0,_0x469d25);_0x48af4f(_0x469d25);});});}exports[_0xeb03('0x1d')]=function(_0x19bddf){var _0x4d307c=this;return new Promise(function(_0x1bea3f,_0x3855dd){return db[_0xeb03('0x1e')][_0xeb03('0x1f')](_0x19bddf[_0xeb03('0x20')],{'raw':_0x19bddf[_0xeb03('0x21')]?_0x19bddf[_0xeb03('0x21')][_0xeb03('0x22')]===undefined?!![]:![]:!![]})[_0xeb03('0x12')](function(_0x5a704b){logger[_0xeb03('0x13')](_0xeb03('0x1d'),_0x19bddf);logger[_0xeb03('0x16')](_0xeb03('0x1d'),_0x19bddf,JSON[_0xeb03('0x18')](_0x5a704b));_0x1bea3f(_0x5a704b);})['catch'](function(_0x638353){logger[_0xeb03('0x19')](_0xeb03('0x1d'),_0x638353[_0xeb03('0x1a')],_0x19bddf);_0x3855dd(_0x4d307c[_0xeb03('0x19')](0x1f4,_0x638353[_0xeb03('0x1a')]));});});}; \ No newline at end of file +var _0x4213=['request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateMailMessage','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','register'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x4213,0x77));var _0x3421=function(_0x3108c8,_0x34259a){_0x3108c8=_0x3108c8-0x0;var _0x405ff3=_0x4213[_0x3108c8];return _0x405ff3;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var moment=require(_0x3421('0x2'));var BPromise=require(_0x3421('0x3'));var rs=require(_0x3421('0x4'));var fs=require('fs');var Redis=require(_0x3421('0x5'));var db=require(_0x3421('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x3421('0x7'))('rpc');var config=require(_0x3421('0x8'));var jayson=require(_0x3421('0x9'));var client=jayson[_0x3421('0xa')][_0x3421('0xb')]({'port':0x232a});config['redis']=_[_0x3421('0xc')](config[_0x3421('0xd')],{'host':_0x3421('0xe'),'port':0x18eb});var socket=require(_0x3421('0xf'))(new Redis(config[_0x3421('0xd')]));require('./mailMessage.socket')[_0x3421('0x10')](socket);function respondWithRpcPromise(_0x58d511,_0x4ff986,_0x12eee0){return new BPromise(function(_0x4b9d24,_0x2d8676){return client[_0x3421('0x11')](_0x58d511,_0x12eee0)[_0x3421('0x12')](function(_0x38b521){logger[_0x3421('0x13')](_0x3421('0x14'),_0x4ff986,_0x3421('0x15'));logger['debug'](_0x3421('0x16'),_0x4ff986,_0x3421('0x15'),JSON[_0x3421('0x17')](_0x38b521));if(_0x38b521[_0x3421('0x18')]){if(_0x38b521[_0x3421('0x18')][_0x3421('0x19')]===0x1f4){logger[_0x3421('0x18')]('MailMessage,\x20%s,\x20%s',_0x4ff986,_0x38b521[_0x3421('0x18')]['message']);return _0x2d8676(_0x38b521[_0x3421('0x18')][_0x3421('0x1a')]);}logger['error'](_0x3421('0x14'),_0x4ff986,_0x38b521['error'][_0x3421('0x1a')]);return _0x4b9d24(_0x38b521[_0x3421('0x18')]['message']);}else{logger[_0x3421('0x13')](_0x3421('0x14'),_0x4ff986,_0x3421('0x15'));_0x4b9d24(_0x38b521[_0x3421('0x1b')][_0x3421('0x1a')]);}})[_0x3421('0x1c')](function(_0x3f1b1d){logger[_0x3421('0x18')](_0x3421('0x14'),_0x4ff986,_0x3f1b1d);_0x2d8676(_0x3f1b1d);});});}exports[_0x3421('0x1d')]=function(_0x538a8b){var _0x50d9a5=this;return new Promise(function(_0x420114,_0x4b59a5){return db['MailMessage']['create'](_0x538a8b[_0x3421('0x1e')],{'raw':_0x538a8b[_0x3421('0x1f')]?_0x538a8b[_0x3421('0x1f')][_0x3421('0x20')]===undefined?!![]:![]:!![]})[_0x3421('0x12')](function(_0x39bed4){logger[_0x3421('0x13')](_0x3421('0x1d'),_0x538a8b);logger[_0x3421('0x21')](_0x3421('0x1d'),_0x538a8b,JSON['stringify'](_0x39bed4));_0x420114(_0x39bed4);})['catch'](function(_0x494423){logger[_0x3421('0x18')](_0x3421('0x1d'),_0x494423[_0x3421('0x1a')],_0x538a8b);_0x4b59a5(_0x50d9a5['error'](0x1f4,_0x494423['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index da2b527..c40d737 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 _0x1b9c=['removeListener','length','mailMessage:','./mailMessage.events','save','update'];(function(_0x289132,_0x3cde44){var _0x45d1f0=function(_0xec591d){while(--_0xec591d){_0x289132['push'](_0x289132['shift']());}};_0x45d1f0(++_0x3cde44);}(_0x1b9c,0x1ad));var _0xc1b9=function(_0x4f80bd,_0x2b2d1e){_0x4f80bd=_0x4f80bd-0x0;var _0x1a798a=_0x1b9c[_0x4f80bd];return _0x1a798a;};'use strict';var MailMessageEvents=require(_0xc1b9('0x0'));var events=[_0xc1b9('0x1'),'remove',_0xc1b9('0x2')];function createListener(_0xe4413e,_0x5551a4){return function(_0x8d93c4){_0x5551a4['emit'](_0xe4413e,_0x8d93c4);};}function removeListener(_0x90b4e4,_0x5593de){return function(){MailMessageEvents[_0xc1b9('0x3')](_0x90b4e4,_0x5593de);};}exports['register']=function(_0x21e501){for(var _0x56a1f5=0x0,_0x52ac80=events[_0xc1b9('0x4')];_0x56a1f5<_0x52ac80;_0x56a1f5++){var _0x1b9fe7=events[_0x56a1f5];var _0x584782=createListener(_0xc1b9('0x5')+_0x1b9fe7,_0x21e501);MailMessageEvents['on'](_0x1b9fe7,_0x584782);}}; \ No newline at end of file +var _0xd5d3=['length','mailMessage:','./mailMessage.events','save','remove','emit','register'];(function(_0x24f61b,_0x399b18){var _0x21571c=function(_0x5336a0){while(--_0x5336a0){_0x24f61b['push'](_0x24f61b['shift']());}};_0x21571c(++_0x399b18);}(_0xd5d3,0x113));var _0x3d5d=function(_0x51b614,_0x12172f){_0x51b614=_0x51b614-0x0;var _0xf6c317=_0xd5d3[_0x51b614];return _0xf6c317;};'use strict';var MailMessageEvents=require(_0x3d5d('0x0'));var events=[_0x3d5d('0x1'),_0x3d5d('0x2'),'update'];function createListener(_0x93d41e,_0x182703){return function(_0x2eba56){_0x182703[_0x3d5d('0x3')](_0x93d41e,_0x2eba56);};}function removeListener(_0x470f0f,_0x24d06f){return function(){MailMessageEvents['removeListener'](_0x470f0f,_0x24d06f);};}exports[_0x3d5d('0x4')]=function(_0x1f69df){for(var _0x1e6997=0x0,_0x9a80f=events[_0x3d5d('0x5')];_0x1e6997<_0x9a80f;_0x1e6997++){var _0x372d5c=events[_0x1e6997];var _0x211934=createListener(_0x3d5d('0x6')+_0x372d5c,_0x1f69df);MailMessageEvents['on'](_0x372d5c,_0x211934);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 29dab89..31e320d 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 _0x0bfb=['/:id','show','/:id/members','getMembers','/:id/teams','/:id/users','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0bfb,0x1be));var _0xb0bf=function(_0x373e09,_0x59e23b){_0x373e09=_0x373e09-0x0;var _0x3269c8=_0x0bfb[_0x373e09];return _0x3269c8;};'use strict';var multer=require(_0xb0bf('0x0'));var util=require(_0xb0bf('0x1'));var path=require('path');var timeout=require(_0xb0bf('0x2'));var express=require(_0xb0bf('0x3'));var router=express[_0xb0bf('0x4')]();var fs_extra=require(_0xb0bf('0x5'));var auth=require(_0xb0bf('0x6'));var interaction=require(_0xb0bf('0x7'));var config=require(_0xb0bf('0x8'));var controller=require('./mailQueue.controller');router[_0xb0bf('0x9')]('/',auth[_0xb0bf('0xa')](),controller[_0xb0bf('0xb')]);router[_0xb0bf('0x9')]('/describe',auth[_0xb0bf('0xa')](),controller[_0xb0bf('0xc')]);router[_0xb0bf('0x9')](_0xb0bf('0xd'),auth[_0xb0bf('0xa')](),controller[_0xb0bf('0xe')]);router['get'](_0xb0bf('0xf'),auth[_0xb0bf('0xa')](),controller[_0xb0bf('0x10')]);router[_0xb0bf('0x9')](_0xb0bf('0x11'),auth['isAuthenticated'](),controller['getTeams']);router[_0xb0bf('0x9')](_0xb0bf('0x12'),auth[_0xb0bf('0xa')](),controller['getAgents']);router[_0xb0bf('0x13')]('/',auth[_0xb0bf('0xa')](),controller['create']);router[_0xb0bf('0x13')](_0xb0bf('0x11'),auth['isAuthenticated'](),controller[_0xb0bf('0x14')]);router[_0xb0bf('0x13')](_0xb0bf('0x12'),auth[_0xb0bf('0xa')](),controller[_0xb0bf('0x15')]);router[_0xb0bf('0x16')](_0xb0bf('0xd'),auth['isAuthenticated'](),controller[_0xb0bf('0x17')]);router[_0xb0bf('0x18')](_0xb0bf('0xd'),auth[_0xb0bf('0xa')](),controller[_0xb0bf('0x19')]);router[_0xb0bf('0x18')](_0xb0bf('0x11'),auth[_0xb0bf('0xa')](),controller[_0xb0bf('0x1a')]);router[_0xb0bf('0x18')](_0xb0bf('0x12'),auth[_0xb0bf('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x85e6=['getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members'];(function(_0x594ece,_0x2a1f27){var _0x471bc4=function(_0x31941c){while(--_0x31941c){_0x594ece['push'](_0x594ece['shift']());}};_0x471bc4(++_0x2a1f27);}(_0x85e6,0x128));var _0x685e=function(_0x1d0999,_0x45f2e8){_0x1d0999=_0x1d0999-0x0;var _0x2333b8=_0x85e6[_0x1d0999];return _0x2333b8;};'use strict';var multer=require(_0x685e('0x0'));var util=require(_0x685e('0x1'));var path=require(_0x685e('0x2'));var timeout=require(_0x685e('0x3'));var express=require(_0x685e('0x4'));var router=express[_0x685e('0x5')]();var fs_extra=require(_0x685e('0x6'));var auth=require(_0x685e('0x7'));var interaction=require(_0x685e('0x8'));var config=require(_0x685e('0x9'));var controller=require(_0x685e('0xa'));router[_0x685e('0xb')]('/',auth[_0x685e('0xc')](),controller[_0x685e('0xd')]);router[_0x685e('0xb')](_0x685e('0xe'),auth[_0x685e('0xc')](),controller[_0x685e('0xf')]);router[_0x685e('0xb')](_0x685e('0x10'),auth[_0x685e('0xc')](),controller[_0x685e('0x11')]);router['get'](_0x685e('0x12'),auth[_0x685e('0xc')](),controller[_0x685e('0x13')]);router['get'](_0x685e('0x14'),auth[_0x685e('0xc')](),controller[_0x685e('0x15')]);router[_0x685e('0xb')](_0x685e('0x16'),auth[_0x685e('0xc')](),controller[_0x685e('0x17')]);router['post']('/',auth['isAuthenticated'](),controller[_0x685e('0x18')]);router[_0x685e('0x19')](_0x685e('0x14'),auth[_0x685e('0xc')](),controller[_0x685e('0x1a')]);router[_0x685e('0x19')](_0x685e('0x16'),auth[_0x685e('0xc')](),controller[_0x685e('0x1b')]);router[_0x685e('0x1c')](_0x685e('0x10'),auth[_0x685e('0xc')](),controller[_0x685e('0x1d')]);router[_0x685e('0x1e')](_0x685e('0x10'),auth[_0x685e('0xc')](),controller[_0x685e('0x1f')]);router[_0x685e('0x1e')](_0x685e('0x14'),auth['isAuthenticated'](),controller[_0x685e('0x20')]);router[_0x685e('0x1e')](_0x685e('0x16'),auth[_0x685e('0xc')](),controller[_0x685e('0x21')]);module[_0x685e('0x22')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 4db050e..9efc009 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 _0x3a2e=['sequelize','STRING','rrmemory','beepall','roundrobin'];(function(_0x12aaee,_0x5bf50c){var _0x37c350=function(_0x182775){while(--_0x182775){_0x12aaee['push'](_0x12aaee['shift']());}};_0x37c350(++_0x5bf50c);}(_0x3a2e,0x9b));var _0xe3a2=function(_0x5348cd,_0x34d4a6){_0x5348cd=_0x5348cd-0x0;var _0x22db3d=_0x3a2e[_0x5348cd];return _0x22db3d;};'use strict';var Sequelize=require(_0xe3a2('0x0'));module['exports']={'name':{'type':Sequelize[_0xe3a2('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xe3a2('0x2'),_0xe3a2('0x3'),_0xe3a2('0x4'))}}; \ No newline at end of file +var _0x895e=['beepall','sequelize','STRING','name','INTEGER','ENUM','rrmemory'];(function(_0x5a260a,_0x3687ec){var _0x55ddf5=function(_0x17199f){while(--_0x17199f){_0x5a260a['push'](_0x5a260a['shift']());}};_0x55ddf5(++_0x3687ec);}(_0x895e,0x71));var _0xe895=function(_0x11cfe4,_0x1a33df){_0x11cfe4=_0x11cfe4-0x0;var _0x4569cf=_0x895e[_0x11cfe4];return _0x4569cf;};'use strict';var Sequelize=require(_0xe895('0x0'));module['exports']={'name':{'type':Sequelize[_0xe895('0x1')],'unique':_0xe895('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xe895('0x1')]},'timeout':{'type':Sequelize[_0xe895('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xe895('0x4')](_0xe895('0x5'),_0xe895('0x6'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index 7cd4b9a..d7cf3ec 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 _0xf996=['localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','json','offset','undefined','count','set','apply','reject','save','update','then','destroy','MailQueues','end','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserMailQueue','hasOwnProperty','MailQueueId','User','findAndCountAll','updatedAt','format','%s/%s','SIP','createdAt','getTeams','findOne','Team','addTeams','ids','online','voicePause','flatMap','Agents','sequelize','transaction','each','forEach','userMailQueue:save','removeTeams','select','field','from','user_has_teams','MailQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','includes','all','union','compact','value','isEmpty','removeAgents','emit','addAgents','omit','userMailQueue:remove','getAgents','eml-format','rimraf','zip-dir','request-promise','mustache','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/environment','defaults','redis'];(function(_0x53d3b0,_0x62aa42){var _0x44f608=function(_0x47f276){while(--_0x47f276){_0x53d3b0['push'](_0x53d3b0['shift']());}};_0x44f608(++_0x62aa42);}(_0xf996,0x74));var _0x6f99=function(_0x43186d,_0x4b40ec){_0x43186d=_0x43186d-0x0;var _0x5f562c=_0xf996[_0x43186d];return _0x5f562c;};'use strict';var emlformat=require(_0x6f99('0x0'));var rimraf=require(_0x6f99('0x1'));var zipdir=require(_0x6f99('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6f99('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x6f99('0x4'));var util=require(_0x6f99('0x5'));var path=require(_0x6f99('0x6'));var sox=require(_0x6f99('0x7'));var csv=require(_0x6f99('0x8'));var ejs=require(_0x6f99('0x9'));var fs=require('fs');var fs_extra=require(_0x6f99('0xa'));var _=require(_0x6f99('0xb'));var squel=require(_0x6f99('0xc'));var crypto=require(_0x6f99('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6f99('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6f99('0xf'));var Papa=require(_0x6f99('0x10'));var Redis=require(_0x6f99('0x11'));var authService=require(_0x6f99('0x12'));var qs=require(_0x6f99('0x13'));var as=require(_0x6f99('0x14'));var hardwareService=require(_0x6f99('0x15'));var logger=require(_0x6f99('0x16'))(_0x6f99('0x17'));var utils=require('../../config/utils');var config=require(_0x6f99('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config['redis']=_[_0x6f99('0x19')](config[_0x6f99('0x1a')],{'host':_0x6f99('0x1b'),'port':0x18eb});var socket=require(_0x6f99('0x1c'))(new Redis(config[_0x6f99('0x1a')]));require(_0x6f99('0x1d'))[_0x6f99('0x1e')](socket);function respondWithStatusCode(_0xb9874a,_0x362142){_0x362142=_0x362142||0xcc;return function(_0x10e233){if(_0x10e233){return _0xb9874a[_0x6f99('0x1f')](_0x362142);}return _0xb9874a[_0x6f99('0x20')](_0x362142)['end']();};}function respondWithResult(_0x293937,_0x2256a9){_0x2256a9=_0x2256a9||0xc8;return function(_0x4a7520){if(_0x4a7520){return _0x293937['status'](_0x2256a9)[_0x6f99('0x21')](_0x4a7520);}};}function respondWithFilteredResult(_0x5b3638,_0x1d01b7){return function(_0x210360){if(_0x210360){var _0x3bed8d=typeof _0x1d01b7[_0x6f99('0x22')]===_0x6f99('0x23')&&typeof _0x1d01b7['limit']===_0x6f99('0x23');var _0x5377cb=_0x210360[_0x6f99('0x24')];var _0x286edb=_0x3bed8d?0x0:_0x1d01b7[_0x6f99('0x22')];var _0x26cd36=_0x3bed8d?_0x210360[_0x6f99('0x24')]:_0x1d01b7[_0x6f99('0x22')]+_0x1d01b7['limit'];var _0x4c4d00;if(_0x26cd36>=_0x5377cb){_0x26cd36=_0x5377cb;_0x4c4d00=0xc8;}else{_0x4c4d00=0xce;}_0x5b3638[_0x6f99('0x20')](_0x4c4d00);return _0x5b3638[_0x6f99('0x25')]('Content-Range',_0x286edb+'-'+_0x26cd36+'/'+_0x5377cb)['json'](_0x210360);}return null;};}function patchUpdates(_0x1d4dc3){return function(_0x41c7b8){try{jsonpatch[_0x6f99('0x26')](_0x41c7b8,_0x1d4dc3,!![]);}catch(_0xe3e6ab){return BPromise[_0x6f99('0x27')](_0xe3e6ab);}return _0x41c7b8[_0x6f99('0x28')]();};}function saveUpdates(_0x2e7b94,_0x12ec63){return function(_0x438fd6){if(_0x438fd6){return _0x438fd6[_0x6f99('0x29')](_0x2e7b94)[_0x6f99('0x2a')](function(_0x1f8078){return _0x1f8078;});}return null;};}function removeEntity(_0x21a5c8,_0x381e92){return function(_0x568ecd){if(_0x568ecd){return _0x568ecd[_0x6f99('0x2b')]()[_0x6f99('0x2a')](function(){var _0x4c9572=_0x568ecd['get']({'plain':!![]});var _0x7eef41=_0x6f99('0x2c');return db['UserProfileResource'][_0x6f99('0x2b')]({'where':{'type':_0x7eef41,'resourceId':_0x4c9572['id']}})[_0x6f99('0x2a')](function(){return _0x568ecd;});})['then'](function(){_0x21a5c8[_0x6f99('0x20')](0xcc)[_0x6f99('0x2d')]();});}};}function handleEntityNotFound(_0x513519,_0x21eb46){return function(_0x3ef6c5){if(!_0x3ef6c5){_0x513519[_0x6f99('0x1f')](0x194);}return _0x3ef6c5;};}function handleError(_0x459601,_0x292a29){_0x292a29=_0x292a29||0x1f4;return function(_0x106292){logger['error'](_0x106292[_0x6f99('0x2e')]);if(_0x106292[_0x6f99('0x2f')]){delete _0x106292['name'];}_0x459601['status'](_0x292a29)[_0x6f99('0x30')](_0x106292);};}exports[_0x6f99('0x31')]=function(_0x10a88d,_0x2d99cf){var _0x1dea2c={},_0x184bbe={},_0x47d721={'count':0x0,'rows':[]};var _0x499926=_[_0x6f99('0x32')](db[_0x6f99('0x33')][_0x6f99('0x34')],function(_0x38658d){return{'name':_0x38658d[_0x6f99('0x35')],'type':_0x38658d[_0x6f99('0x36')][_0x6f99('0x37')]};});_0x184bbe[_0x6f99('0x38')]=_[_0x6f99('0x32')](_0x499926,_0x6f99('0x2f'));_0x184bbe[_0x6f99('0x39')]=_['keys'](_0x10a88d[_0x6f99('0x39')]);_0x184bbe[_0x6f99('0x3a')]=_[_0x6f99('0x3b')](_0x184bbe[_0x6f99('0x38')],_0x184bbe[_0x6f99('0x39')]);_0x1dea2c['attributes']=_[_0x6f99('0x3b')](_0x184bbe[_0x6f99('0x38')],qs['fields'](_0x10a88d[_0x6f99('0x39')][_0x6f99('0x3c')]));_0x1dea2c[_0x6f99('0x3d')]=_0x1dea2c[_0x6f99('0x3d')][_0x6f99('0x3e')]?_0x1dea2c[_0x6f99('0x3d')]:_0x184bbe[_0x6f99('0x38')];if(!_0x10a88d[_0x6f99('0x39')]['hasOwnProperty'](_0x6f99('0x3f'))){_0x1dea2c['limit']=qs[_0x6f99('0x40')](_0x10a88d[_0x6f99('0x39')][_0x6f99('0x40')]);_0x1dea2c[_0x6f99('0x22')]=qs['offset'](_0x10a88d[_0x6f99('0x39')]['offset']);}_0x1dea2c[_0x6f99('0x41')]=qs[_0x6f99('0x42')](_0x10a88d[_0x6f99('0x39')][_0x6f99('0x42')]);_0x1dea2c[_0x6f99('0x43')]=qs[_0x6f99('0x3a')](_[_0x6f99('0x44')](_0x10a88d['query'],_0x184bbe[_0x6f99('0x3a')]),_0x499926);if(_0x10a88d[_0x6f99('0x39')][_0x6f99('0x45')]){_0x1dea2c['where']=_[_0x6f99('0x46')](_0x1dea2c[_0x6f99('0x43')],{'$or':_[_0x6f99('0x32')](_0x499926,function(_0x341f3f){if(_0x341f3f[_0x6f99('0x36')]!==_0x6f99('0x47')){var _0x421327={};_0x421327[_0x341f3f[_0x6f99('0x2f')]]={'$like':'%'+_0x10a88d['query'][_0x6f99('0x45')]+'%'};return _0x421327;}})});}_0x1dea2c=_['merge']({},_0x1dea2c,_0x10a88d[_0x6f99('0x48')]);var _0x11f13c={'where':_0x1dea2c['where']};return db[_0x6f99('0x33')][_0x6f99('0x24')](_0x11f13c)[_0x6f99('0x2a')](function(_0x1fd388){_0x47d721['count']=_0x1fd388;if(_0x10a88d[_0x6f99('0x39')][_0x6f99('0x49')]){_0x1dea2c[_0x6f99('0x4a')]=[{'all':!![]}];}return db['MailQueue'][_0x6f99('0x4b')](_0x1dea2c);})[_0x6f99('0x2a')](function(_0x10f883){_0x47d721[_0x6f99('0x4c')]=_0x10f883;return _0x47d721;})[_0x6f99('0x2a')](respondWithFilteredResult(_0x2d99cf,_0x1dea2c))[_0x6f99('0x4d')](handleError(_0x2d99cf,null));};exports[_0x6f99('0x4e')]=function(_0x301bf9,_0x591ac5){var _0x360713={'raw':!![],'where':{'id':_0x301bf9[_0x6f99('0x4f')]['id']}},_0x5204a2={};_0x5204a2['model']=_[_0x6f99('0x50')](db[_0x6f99('0x33')][_0x6f99('0x34')]);_0x5204a2[_0x6f99('0x39')]=_[_0x6f99('0x50')](_0x301bf9[_0x6f99('0x39')]);_0x5204a2[_0x6f99('0x3a')]=_['intersection'](_0x5204a2[_0x6f99('0x38')],_0x5204a2[_0x6f99('0x39')]);_0x360713['attributes']=_[_0x6f99('0x3b')](_0x5204a2[_0x6f99('0x38')],qs[_0x6f99('0x3c')](_0x301bf9[_0x6f99('0x39')][_0x6f99('0x3c')]));_0x360713['attributes']=_0x360713[_0x6f99('0x3d')][_0x6f99('0x3e')]?_0x360713[_0x6f99('0x3d')]:_0x5204a2[_0x6f99('0x38')];if(_0x301bf9[_0x6f99('0x39')][_0x6f99('0x49')]){_0x360713[_0x6f99('0x4a')]=[{'all':!![]}];}_0x360713=_[_0x6f99('0x46')]({},_0x360713,_0x301bf9[_0x6f99('0x48')]);return db[_0x6f99('0x33')][_0x6f99('0x51')](_0x360713)[_0x6f99('0x2a')](handleEntityNotFound(_0x591ac5,null))['then'](respondWithResult(_0x591ac5,null))[_0x6f99('0x4d')](handleError(_0x591ac5,null));};exports[_0x6f99('0x52')]=function(_0x1732c6,_0x2011bd){return db[_0x6f99('0x33')][_0x6f99('0x52')](_0x1732c6['body'],{})[_0x6f99('0x2a')](function(_0x2ee25e){var _0x5b5486=_0x1732c6[_0x6f99('0x53')][_0x6f99('0x54')]({'plain':!![]});if(!_0x5b5486)throw new Error(_0x6f99('0x55'));if(_0x5b5486[_0x6f99('0x56')]===_0x6f99('0x53')){var _0x5502fa=_0x2ee25e['get']({'plain':!![]});var _0x3d82c4='MailQueues';return db[_0x6f99('0x57')][_0x6f99('0x51')]({'where':{'name':_0x3d82c4,'userProfileId':_0x5b5486[_0x6f99('0x58')]},'raw':!![]})[_0x6f99('0x2a')](function(_0xbd1caf){if(_0xbd1caf&&_0xbd1caf['autoAssociation']===0x0){return db[_0x6f99('0x59')][_0x6f99('0x52')]({'name':_0x5502fa[_0x6f99('0x2f')],'resourceId':_0x5502fa['id'],'type':_0xbd1caf[_0x6f99('0x2f')],'sectionId':_0xbd1caf['id']},{})['then'](function(){return _0x2ee25e;});}else{return _0x2ee25e;}})[_0x6f99('0x4d')](function(_0x38c34d){logger[_0x6f99('0x5a')](_0x6f99('0x5b'),_0x38c34d);throw _0x38c34d;});}return _0x2ee25e;})[_0x6f99('0x2a')](respondWithResult(_0x2011bd,0xc9))[_0x6f99('0x4d')](handleError(_0x2011bd,null));};exports[_0x6f99('0x29')]=function(_0x273624,_0x5e024a){if(_0x273624[_0x6f99('0x5c')]['id']){delete _0x273624[_0x6f99('0x5c')]['id'];}return db[_0x6f99('0x33')]['find']({'where':{'id':_0x273624['params']['id']}})[_0x6f99('0x2a')](handleEntityNotFound(_0x5e024a,null))['then'](saveUpdates(_0x273624[_0x6f99('0x5c')],null))['then'](respondWithResult(_0x5e024a,null))[_0x6f99('0x4d')](handleError(_0x5e024a,null));};exports[_0x6f99('0x2b')]=function(_0xe89e83,_0x4e12c7){return db[_0x6f99('0x33')][_0x6f99('0x51')]({'where':{'id':_0xe89e83[_0x6f99('0x4f')]['id']}})[_0x6f99('0x2a')](handleEntityNotFound(_0x4e12c7,null))['then'](removeEntity(_0x4e12c7,null))[_0x6f99('0x4d')](handleError(_0x4e12c7,null));};exports['describe']=function(_0x134e63,_0x258750){return db[_0x6f99('0x33')][_0x6f99('0x5d')]()[_0x6f99('0x2a')](respondWithResult(_0x258750,null))['catch'](handleError(_0x258750,null));};exports[_0x6f99('0x5e')]=function(_0x464a0f,_0x4ccd0f,_0x243a5f){var _0x559340={'raw':!![],'where':{}},_0x3b1f50={},_0x273d97;return db[_0x6f99('0x33')]['findOne']({'where':{'id':_0x464a0f[_0x6f99('0x4f')]['id']}})['then'](handleEntityNotFound(_0x4ccd0f,null))[_0x6f99('0x2a')](function(_0x1423f1){if(_0x1423f1){_0x273d97=_0x1423f1[_0x6f99('0x54')]({'plain':!![]});_0x3b1f50[_0x6f99('0x38')]=_['keys'](db[_0x6f99('0x5f')]['rawAttributes']);_0x3b1f50[_0x6f99('0x39')]=_[_0x6f99('0x50')](_0x464a0f[_0x6f99('0x39')]);_0x3b1f50[_0x6f99('0x3a')]=_[_0x6f99('0x3b')](_0x3b1f50[_0x6f99('0x38')],_0x3b1f50[_0x6f99('0x39')]);_0x559340[_0x6f99('0x3d')]=_['intersection'](_0x3b1f50[_0x6f99('0x38')],qs[_0x6f99('0x3c')](_0x464a0f[_0x6f99('0x39')][_0x6f99('0x3c')]));_0x559340[_0x6f99('0x3d')]=_0x559340['attributes'][_0x6f99('0x3e')]?_0x559340[_0x6f99('0x3d')]:_0x3b1f50[_0x6f99('0x38')];if(!_0x464a0f['query'][_0x6f99('0x60')](_0x6f99('0x3f'))){_0x559340[_0x6f99('0x40')]=qs['limit'](_0x464a0f['query'][_0x6f99('0x40')]);_0x559340[_0x6f99('0x22')]=qs['offset'](_0x464a0f['query'][_0x6f99('0x22')]);}_0x559340['order']=qs[_0x6f99('0x42')](_0x464a0f['query'][_0x6f99('0x42')]);_0x559340[_0x6f99('0x43')]=qs[_0x6f99('0x3a')](_[_0x6f99('0x44')](_0x464a0f[_0x6f99('0x39')],_0x3b1f50[_0x6f99('0x3a')]));_0x559340[_0x6f99('0x43')][_0x6f99('0x61')]=_0x1423f1['id'];if(_0x464a0f[_0x6f99('0x39')]['filter']){_0x559340[_0x6f99('0x43')]=_[_0x6f99('0x46')](_0x559340['where'],{'$or':_[_0x6f99('0x32')](_0x559340[_0x6f99('0x3d')],function(_0x6c766f){var _0x1e087b={};_0x1e087b[_0x6c766f]={'$like':'%'+_0x464a0f['query']['filter']+'%'};return _0x1e087b;})});}_0x559340=_[_0x6f99('0x46')]({},_0x559340,_0x464a0f[_0x6f99('0x48')]);return db[_0x6f99('0x5f')]['findAll'](_0x559340);}})['then'](function(_0x229b76){if(_0x229b76){return db[_0x6f99('0x62')][_0x6f99('0x63')]({'where':{'id':_[_0x6f99('0x32')](_0x229b76,'UserId'),'role':'agent'},'attributes':['id',_0x6f99('0x2f'),'mailPause',_0x6f99('0x64'),'createdAt']});}})['then'](function(_0x1728b4){if(_0x1728b4){return{'count':_0x1728b4[_0x6f99('0x24')],'rows':_[_0x6f99('0x32')](_0x1728b4[_0x6f99('0x4c')],function(_0x6d31eb){return{'membername':_0x6d31eb['name'],'UserId':_0x6d31eb['id'],'queue_name':_0x273d97[_0x6f99('0x2f')],'MailQueueId':_0x273d97['id'],'interface':util[_0x6f99('0x65')](_0x6f99('0x66'),_0x6f99('0x67'),_0x6d31eb[_0x6f99('0x2f')]),'penalty':0x0,'paused':_0x6d31eb['mailPause'],'createdAt':_0x6d31eb[_0x6f99('0x68')],'updatedAt':_0x6d31eb['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4ccd0f,_0x559340))[_0x6f99('0x4d')](handleError(_0x4ccd0f,null));};exports[_0x6f99('0x69')]=function(_0x5138fa,_0x364b45,_0x1a226d){var _0x415541={};var _0xd151f5={};var _0x1937f9;var _0x3f9aa2;return db[_0x6f99('0x33')][_0x6f99('0x6a')]({'where':{'id':_0x5138fa['params']['id']}})[_0x6f99('0x2a')](handleEntityNotFound(_0x364b45,null))[_0x6f99('0x2a')](function(_0x43e792){if(_0x43e792){_0x1937f9=_0x43e792;_0xd151f5[_0x6f99('0x38')]=_[_0x6f99('0x50')](db[_0x6f99('0x6b')]['rawAttributes']);_0xd151f5['query']=_['keys'](_0x5138fa['query']);_0xd151f5[_0x6f99('0x3a')]=_[_0x6f99('0x3b')](_0xd151f5[_0x6f99('0x38')],_0xd151f5[_0x6f99('0x39')]);_0x415541[_0x6f99('0x3d')]=_[_0x6f99('0x3b')](_0xd151f5[_0x6f99('0x38')],qs[_0x6f99('0x3c')](_0x5138fa[_0x6f99('0x39')][_0x6f99('0x3c')]));_0x415541['attributes']=_0x415541[_0x6f99('0x3d')][_0x6f99('0x3e')]?_0x415541[_0x6f99('0x3d')]:_0xd151f5['model'];_0x415541[_0x6f99('0x41')]=qs[_0x6f99('0x42')](_0x5138fa[_0x6f99('0x39')][_0x6f99('0x42')]);_0x415541['where']=qs[_0x6f99('0x3a')](_[_0x6f99('0x44')](_0x5138fa[_0x6f99('0x39')],_0xd151f5[_0x6f99('0x3a')]));if(_0x5138fa[_0x6f99('0x39')][_0x6f99('0x45')]){_0x415541[_0x6f99('0x43')]=_[_0x6f99('0x46')](_0x415541[_0x6f99('0x43')],{'$or':_['map'](_0x415541[_0x6f99('0x3d')],function(_0x4c9da7){var _0x185a9e={};_0x185a9e[_0x4c9da7]={'$like':'%'+_0x5138fa['query'][_0x6f99('0x45')]+'%'};return _0x185a9e;})});}_0x415541=_[_0x6f99('0x46')]({},_0x415541,_0x5138fa['options']);return _0x1937f9[_0x6f99('0x69')](_0x415541);}})['then'](function(_0x3b578a){if(_0x3b578a){_0x3f9aa2=_0x3b578a[_0x6f99('0x3e')];if(!_0x5138fa[_0x6f99('0x39')][_0x6f99('0x60')](_0x6f99('0x3f'))){_0x415541[_0x6f99('0x40')]=qs[_0x6f99('0x40')](_0x5138fa[_0x6f99('0x39')][_0x6f99('0x40')]);_0x415541[_0x6f99('0x22')]=qs['offset'](_0x5138fa[_0x6f99('0x39')][_0x6f99('0x22')]);}return _0x1937f9[_0x6f99('0x69')](_0x415541);}})[_0x6f99('0x2a')](function(_0x504aec){if(_0x504aec){return _0x504aec?{'count':_0x3f9aa2,'rows':_0x504aec}:null;}})['then'](respondWithResult(_0x364b45,null))['catch'](handleError(_0x364b45,null));};exports[_0x6f99('0x6c')]=function(_0x3ebc7b,_0x3ca8ad,_0x222a93){var _0x1f5529=_0x3ebc7b[_0x6f99('0x5c')][_0x6f99('0x6d')];return db[_0x6f99('0x6b')]['findAll']({'where':{'id':_0x1f5529},'attributes':['id'],'include':[{'model':db[_0x6f99('0x62')],'as':'Agents','attributes':['id',_0x6f99('0x2f'),_0x6f99('0x6e'),_0x6f99('0x6f'),'interface'],'raw':!![]}]})['then'](function(_0x296ff8){if(_0x296ff8){var _0x3c7d91=_[_0x6f99('0x70')](_0x296ff8,function(_0x4b9fa1){var _0x58c5ae=_0x4b9fa1[_0x6f99('0x54')]({'plain':!![]});return _0x58c5ae[_0x6f99('0x71')];});return db[_0x6f99('0x33')][_0x6f99('0x51')]({'where':{'id':_0x3ebc7b[_0x6f99('0x4f')]['id']}})['then'](function(_0x189c1e){return db[_0x6f99('0x72')][_0x6f99('0x73')](function(_0x59dc9a){return _0x189c1e[_0x6f99('0x6c')](_0x1f5529,{'transaction':_0x59dc9a})[_0x6f99('0x2a')](function(){return BPromise[_0x6f99('0x74')](_0x3c7d91,function(_0x450313){return db[_0x6f99('0x5f')]['findOrCreate']({'where':{'UserId':_0x450313['id'],'MailQueueId':_0x3ebc7b[_0x6f99('0x4f')]['id']},'transaction':_0x59dc9a});});})[_0x6f99('0x2a')](function(){_0x3c7d91[_0x6f99('0x75')](function(_0x39e78d){socket['emit'](_0x6f99('0x76'),{'UserId':_0x39e78d['id'],'MailQueueId':_0x189c1e['id']});});});});});}})[_0x6f99('0x2a')](respondWithStatusCode(_0x3ca8ad,null))[_0x6f99('0x4d')](handleError(_0x3ca8ad,null));};exports[_0x6f99('0x77')]=function(_0x2567b2,_0x900bc9,_0x1d8da5){return db['Team'][_0x6f99('0x4b')]({'where':{'id':_0x2567b2['query']['ids']},'attributes':['id'],'include':[{'model':db['User'],'as':_0x6f99('0x71'),'attributes':['id'],'raw':!![]}]})[_0x6f99('0x2a')](handleEntityNotFound(_0x900bc9,null))['then'](function(_0xa79ca9){var _0x5f1c56=_[_0x6f99('0x32')](_0xa79ca9,'id');var _0xd85365=[];var _0x2a0d54=[];var _0x25ced4=squel[_0x6f99('0x78')]();_0x25ced4[_0x6f99('0x79')]('tq.TeamId')[_0x6f99('0x7a')]('team_has_mail_queues','tq')['join'](_0x6f99('0x7b'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x6f99('0x43')](_0x6f99('0x7c'),_0x2567b2[_0x6f99('0x4f')]['id']);for(var _0x6bf709=0x0;_0x6bf709<_0xa79ca9[_0x6f99('0x3e')];_0x6bf709+=0x1){let _0xf8f2c=_0xa79ca9[_0x6bf709];for(var _0x3ed67d=0x0;_0x3ed67d<_0xf8f2c['Agents'][_0x6f99('0x3e')];_0x3ed67d+=0x1){let _0x2cbc36=_0xf8f2c[_0x6f99('0x71')][_0x3ed67d];var _0x1ef6a5=_0x25ced4[_0x6f99('0x7d')]();_0x1ef6a5[_0x6f99('0x43')](_0x6f99('0x7e'),_0x2cbc36['id']);_0x2a0d54[_0x6f99('0x7f')](db[_0x6f99('0x72')][_0x6f99('0x39')](_0x1ef6a5[_0x6f99('0x80')](),{'type':db['sequelize'][_0x6f99('0x81')][_0x6f99('0x82')]})[_0x6f99('0x2a')](function(_0x35b7ce){if(_0x35b7ce['length']===0x1){return _0x2cbc36['id'];}else{var _0x28786c=_['every'](_['map'](_0x35b7ce,'TeamId'),function(_0x15feee){return _[_0x6f99('0x83')](_0x5f1c56,_0x15feee);});if(_0x28786c){return _0x2cbc36['id'];}}}));}}return BPromise[_0x6f99('0x84')](_0x2a0d54)[_0x6f99('0x2a')](function(_0x326c38){_0xd85365=_(_0xd85365)[_0x6f99('0x85')](_0x326c38)[_0x6f99('0x86')]()[_0x6f99('0x87')]();return db['MailQueue'][_0x6f99('0x51')]({'where':{'id':_0x2567b2['params']['id']}})[_0x6f99('0x2a')](function(_0x13f748){return db[_0x6f99('0x72')]['transaction'](function(_0x3dada1){return _0x13f748[_0x6f99('0x77')](_0x2567b2[_0x6f99('0x39')][_0x6f99('0x6d')],{'transaction':_0x3dada1})[_0x6f99('0x2a')](function(){if(!_[_0x6f99('0x88')](_0xd85365)){return _0x13f748[_0x6f99('0x89')](_0xd85365,{'transaction':_0x3dada1});}})[_0x6f99('0x2a')](function(){_0xd85365[_0x6f99('0x75')](function(_0x3f7c87){socket[_0x6f99('0x8a')]('userMailQueue:remove',{'UserId':_0x3f7c87,'MailQueueId':_0x13f748['id']});});});});});});})['then'](respondWithStatusCode(_0x900bc9,null))[_0x6f99('0x4d')](handleError(_0x900bc9,null));};exports[_0x6f99('0x8b')]=function(_0x1e3cf1,_0x4acbcd,_0x43f3f9){return db['MailQueue'][_0x6f99('0x51')]({'where':{'id':_0x1e3cf1[_0x6f99('0x4f')]['id']}})[_0x6f99('0x2a')](handleEntityNotFound(_0x4acbcd,null))[_0x6f99('0x2a')](function(_0x16b15e){if(_0x16b15e){return _0x16b15e[_0x6f99('0x8b')](_0x1e3cf1[_0x6f99('0x5c')]['ids'],_[_0x6f99('0x8c')](_0x1e3cf1[_0x6f99('0x5c')],['ids','id'])||{})['spread'](function(_0x1f0998){for(var _0x3490f3=0x0;_0x3490f3<_0x1e3cf1[_0x6f99('0x5c')]['ids'][_0x6f99('0x3e')];_0x3490f3+=0x1){socket[_0x6f99('0x8a')]('userMailQueue:save',{'UserId':Number(_0x1e3cf1[_0x6f99('0x5c')][_0x6f99('0x6d')][_0x3490f3]),'MailQueueId':Number(_0x1e3cf1[_0x6f99('0x4f')]['id'])});}return _0x1f0998;});}})[_0x6f99('0x2a')](respondWithResult(_0x4acbcd,null))['catch'](handleError(_0x4acbcd,null));};exports['removeAgents']=function(_0x2ec896,_0x8dc72b,_0x492d99){return db[_0x6f99('0x33')][_0x6f99('0x51')]({'where':{'id':_0x2ec896[_0x6f99('0x4f')]['id']}})['then'](handleEntityNotFound(_0x8dc72b,null))[_0x6f99('0x2a')](function(_0x185acc){if(_0x185acc){return _0x185acc['removeAgents'](_0x2ec896[_0x6f99('0x39')]['ids'])[_0x6f99('0x2a')](function(){if(_['isArray'](_0x2ec896['query'][_0x6f99('0x6d')])){for(var _0x4bb642=0x0;_0x4bb642<_0x2ec896[_0x6f99('0x39')]['ids'][_0x6f99('0x3e')];_0x4bb642+=0x1){socket[_0x6f99('0x8a')](_0x6f99('0x8d'),{'UserId':Number(_0x2ec896[_0x6f99('0x39')][_0x6f99('0x6d')][_0x4bb642]),'MailQueueId':Number(_0x2ec896[_0x6f99('0x4f')]['id'])});}}else{socket[_0x6f99('0x8a')](_0x6f99('0x8d'),{'UserId':Number(_0x2ec896[_0x6f99('0x39')][_0x6f99('0x6d')]),'MailQueueId':Number(_0x2ec896[_0x6f99('0x4f')]['id'])});}});}})[_0x6f99('0x2a')](respondWithStatusCode(_0x8dc72b,null))[_0x6f99('0x4d')](handleError(_0x8dc72b,null));};exports['getAgents']=function(_0x4306ee,_0x22aa7e,_0x5cfd77){var _0x250f25={};var _0xe8d2f5={};var _0x1e991b;var _0x51953b;return db[_0x6f99('0x33')][_0x6f99('0x6a')]({'where':{'id':_0x4306ee[_0x6f99('0x4f')]['id']}})[_0x6f99('0x2a')](handleEntityNotFound(_0x22aa7e,null))[_0x6f99('0x2a')](function(_0x31ee92){if(_0x31ee92){_0x1e991b=_0x31ee92;_0xe8d2f5[_0x6f99('0x38')]=_[_0x6f99('0x50')](db[_0x6f99('0x62')][_0x6f99('0x34')]);_0xe8d2f5[_0x6f99('0x39')]=_[_0x6f99('0x50')](_0x4306ee[_0x6f99('0x39')]);_0xe8d2f5[_0x6f99('0x3a')]=_['intersection'](_0xe8d2f5['model'],_0xe8d2f5[_0x6f99('0x39')]);_0x250f25['attributes']=_[_0x6f99('0x3b')](_0xe8d2f5['model'],qs[_0x6f99('0x3c')](_0x4306ee['query'][_0x6f99('0x3c')]));_0x250f25[_0x6f99('0x3d')]=_0x250f25[_0x6f99('0x3d')]['length']?_0x250f25[_0x6f99('0x3d')]:_0xe8d2f5[_0x6f99('0x38')];_0x250f25[_0x6f99('0x41')]=qs[_0x6f99('0x42')](_0x4306ee[_0x6f99('0x39')][_0x6f99('0x42')]);_0x250f25[_0x6f99('0x43')]=qs[_0x6f99('0x3a')](_[_0x6f99('0x44')](_0x4306ee[_0x6f99('0x39')],_0xe8d2f5['filters']));if(_0x4306ee['query'][_0x6f99('0x45')]){_0x250f25['where']=_[_0x6f99('0x46')](_0x250f25[_0x6f99('0x43')],{'$or':_[_0x6f99('0x32')](_0x250f25[_0x6f99('0x3d')],function(_0x277684){var _0x2a8b43={};_0x2a8b43[_0x277684]={'$like':'%'+_0x4306ee[_0x6f99('0x39')]['filter']+'%'};return _0x2a8b43;})});}_0x250f25=_[_0x6f99('0x46')]({},_0x250f25,_0x4306ee['options']);return _0x1e991b[_0x6f99('0x8e')](_0x250f25);}})[_0x6f99('0x2a')](function(_0x46672a){if(_0x46672a){_0x51953b=_0x46672a[_0x6f99('0x3e')];if(!_0x4306ee[_0x6f99('0x39')][_0x6f99('0x60')]('nolimit')){_0x250f25[_0x6f99('0x40')]=qs['limit'](_0x4306ee[_0x6f99('0x39')]['limit']);_0x250f25[_0x6f99('0x22')]=qs[_0x6f99('0x22')](_0x4306ee[_0x6f99('0x39')][_0x6f99('0x22')]);}return _0x1e991b[_0x6f99('0x8e')](_0x250f25);}})[_0x6f99('0x2a')](function(_0x11fe4a){if(_0x11fe4a){return _0x11fe4a?{'count':_0x51953b,'rows':_0x11fe4a}:null;}})[_0x6f99('0x2a')](respondWithResult(_0x22aa7e,null))[_0x6f99('0x4d')](handleError(_0x22aa7e,null));}; \ No newline at end of file +var _0x188e=['createdAt','%s/%s','SIP','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','sequelize','each','findOrCreate','forEach','emit','userMailQueue:save','removeTeams','tq.TeamId','team_has_mail_queues','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','SELECT','every','TeamId','includes','all','compact','value','removeAgents','omit','spread','isArray','userMailQueue:remove','getAgents','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','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/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','get','MailQueues','UserProfileResource','error','stack','name','send','index','map','MailQueue','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','fields','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','destroy','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','UserId','agent','mailPause','updatedAt'];(function(_0xabbfc7,_0x33d449){var _0x2a2a62=function(_0x58e774){while(--_0x58e774){_0xabbfc7['push'](_0xabbfc7['shift']());}};_0x2a2a62(++_0x33d449);}(_0x188e,0x1cf));var _0xe188=function(_0x50f8a7,_0x5a17ec){_0x50f8a7=_0x50f8a7-0x0;var _0x25e227=_0x188e[_0x50f8a7];return _0x25e227;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe188('0x0'));var zipdir=require(_0xe188('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe188('0x2'));var moment=require(_0xe188('0x3'));var BPromise=require(_0xe188('0x4'));var Mustache=require(_0xe188('0x5'));var util=require(_0xe188('0x6'));var path=require(_0xe188('0x7'));var sox=require(_0xe188('0x8'));var csv=require('to-csv');var ejs=require(_0xe188('0x9'));var fs=require('fs');var fs_extra=require(_0xe188('0xa'));var _=require(_0xe188('0xb'));var squel=require(_0xe188('0xc'));var crypto=require(_0xe188('0xd'));var jsforce=require(_0xe188('0xe'));var deskjs=require(_0xe188('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe188('0x10'));var Papa=require(_0xe188('0x11'));var Redis=require(_0xe188('0x12'));var authService=require(_0xe188('0x13'));var qs=require(_0xe188('0x14'));var as=require(_0xe188('0x15'));var hardwareService=require(_0xe188('0x16'));var logger=require('../../config/logger')(_0xe188('0x17'));var utils=require(_0xe188('0x18'));var config=require(_0xe188('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe188('0x1a'))['db'];config[_0xe188('0x1b')]=_[_0xe188('0x1c')](config[_0xe188('0x1b')],{'host':_0xe188('0x1d'),'port':0x18eb});var socket=require(_0xe188('0x1e'))(new Redis(config['redis']));require(_0xe188('0x1f'))[_0xe188('0x20')](socket);function respondWithStatusCode(_0x2c190a,_0x432f4b){_0x432f4b=_0x432f4b||0xcc;return function(_0x19b34f){if(_0x19b34f){return _0x2c190a[_0xe188('0x21')](_0x432f4b);}return _0x2c190a['status'](_0x432f4b)[_0xe188('0x22')]();};}function respondWithResult(_0x1ff120,_0x4231ad){_0x4231ad=_0x4231ad||0xc8;return function(_0x50952a){if(_0x50952a){return _0x1ff120[_0xe188('0x23')](_0x4231ad)[_0xe188('0x24')](_0x50952a);}};}function respondWithFilteredResult(_0x140c51,_0x28ec69){return function(_0x2f1ea2){if(_0x2f1ea2){var _0x1d65d8=typeof _0x28ec69[_0xe188('0x25')]===_0xe188('0x26')&&typeof _0x28ec69[_0xe188('0x27')]==='undefined';var _0x3e86fa=_0x2f1ea2['count'];var _0x32f812=_0x1d65d8?0x0:_0x28ec69[_0xe188('0x25')];var _0x78a3cb=_0x1d65d8?_0x2f1ea2[_0xe188('0x28')]:_0x28ec69[_0xe188('0x25')]+_0x28ec69['limit'];var _0x30cb90;if(_0x78a3cb>=_0x3e86fa){_0x78a3cb=_0x3e86fa;_0x30cb90=0xc8;}else{_0x30cb90=0xce;}_0x140c51['status'](_0x30cb90);return _0x140c51[_0xe188('0x29')](_0xe188('0x2a'),_0x32f812+'-'+_0x78a3cb+'/'+_0x3e86fa)['json'](_0x2f1ea2);}return null;};}function patchUpdates(_0x10c55f){return function(_0x508156){try{jsonpatch[_0xe188('0x2b')](_0x508156,_0x10c55f,!![]);}catch(_0x3260c6){return BPromise['reject'](_0x3260c6);}return _0x508156['save']();};}function saveUpdates(_0x3e7640,_0x487906){return function(_0x3782e3){if(_0x3782e3){return _0x3782e3[_0xe188('0x2c')](_0x3e7640)[_0xe188('0x2d')](function(_0x207160){return _0x207160;});}return null;};}function removeEntity(_0x2f47fc,_0x40bc4b){return function(_0x3370b5){if(_0x3370b5){return _0x3370b5['destroy']()['then'](function(){var _0x5ea084=_0x3370b5[_0xe188('0x2e')]({'plain':!![]});var _0x5a8508=_0xe188('0x2f');return db[_0xe188('0x30')]['destroy']({'where':{'type':_0x5a8508,'resourceId':_0x5ea084['id']}})['then'](function(){return _0x3370b5;});})[_0xe188('0x2d')](function(){_0x2f47fc[_0xe188('0x23')](0xcc)[_0xe188('0x22')]();});}};}function handleEntityNotFound(_0x38916d,_0x3f1075){return function(_0x1db293){if(!_0x1db293){_0x38916d[_0xe188('0x21')](0x194);}return _0x1db293;};}function handleError(_0x5d6af6,_0x543059){_0x543059=_0x543059||0x1f4;return function(_0x50a1f5){logger[_0xe188('0x31')](_0x50a1f5[_0xe188('0x32')]);if(_0x50a1f5[_0xe188('0x33')]){delete _0x50a1f5[_0xe188('0x33')];}_0x5d6af6['status'](_0x543059)[_0xe188('0x34')](_0x50a1f5);};}exports[_0xe188('0x35')]=function(_0x534689,_0x61b1d6){var _0x541074={},_0x2d7337={},_0x3c401d={'count':0x0,'rows':[]};var _0x386002=_[_0xe188('0x36')](db[_0xe188('0x37')][_0xe188('0x38')],function(_0x25b3a1){return{'name':_0x25b3a1['fieldName'],'type':_0x25b3a1[_0xe188('0x39')][_0xe188('0x3a')]};});_0x2d7337[_0xe188('0x3b')]=_[_0xe188('0x36')](_0x386002,_0xe188('0x33'));_0x2d7337['query']=_[_0xe188('0x3c')](_0x534689[_0xe188('0x3d')]);_0x2d7337[_0xe188('0x3e')]=_[_0xe188('0x3f')](_0x2d7337[_0xe188('0x3b')],_0x2d7337[_0xe188('0x3d')]);_0x541074[_0xe188('0x40')]=_[_0xe188('0x3f')](_0x2d7337[_0xe188('0x3b')],qs['fields'](_0x534689[_0xe188('0x3d')]['fields']));_0x541074[_0xe188('0x40')]=_0x541074['attributes'][_0xe188('0x41')]?_0x541074[_0xe188('0x40')]:_0x2d7337[_0xe188('0x3b')];if(!_0x534689[_0xe188('0x3d')][_0xe188('0x42')](_0xe188('0x43'))){_0x541074['limit']=qs[_0xe188('0x27')](_0x534689[_0xe188('0x3d')][_0xe188('0x27')]);_0x541074[_0xe188('0x25')]=qs[_0xe188('0x25')](_0x534689['query']['offset']);}_0x541074[_0xe188('0x44')]=qs[_0xe188('0x45')](_0x534689[_0xe188('0x3d')][_0xe188('0x45')]);_0x541074[_0xe188('0x46')]=qs[_0xe188('0x3e')](_[_0xe188('0x47')](_0x534689['query'],_0x2d7337[_0xe188('0x3e')]),_0x386002);if(_0x534689[_0xe188('0x3d')]['filter']){_0x541074[_0xe188('0x46')]=_[_0xe188('0x48')](_0x541074['where'],{'$or':_[_0xe188('0x36')](_0x386002,function(_0x37dc12){if(_0x37dc12['type']!==_0xe188('0x49')){var _0x41c7e0={};_0x41c7e0[_0x37dc12[_0xe188('0x33')]]={'$like':'%'+_0x534689[_0xe188('0x3d')][_0xe188('0x4a')]+'%'};return _0x41c7e0;}})});}_0x541074=_[_0xe188('0x48')]({},_0x541074,_0x534689[_0xe188('0x4b')]);var _0x96130d={'where':_0x541074['where']};return db[_0xe188('0x37')][_0xe188('0x28')](_0x96130d)[_0xe188('0x2d')](function(_0x50fa28){_0x3c401d[_0xe188('0x28')]=_0x50fa28;if(_0x534689[_0xe188('0x3d')][_0xe188('0x4c')]){_0x541074[_0xe188('0x4d')]=[{'all':!![]}];}return db[_0xe188('0x37')][_0xe188('0x4e')](_0x541074);})[_0xe188('0x2d')](function(_0x26e08e){_0x3c401d[_0xe188('0x4f')]=_0x26e08e;return _0x3c401d;})['then'](respondWithFilteredResult(_0x61b1d6,_0x541074))[_0xe188('0x50')](handleError(_0x61b1d6,null));};exports[_0xe188('0x51')]=function(_0x4acc8c,_0x28a64d){var _0x5dbea5={'raw':!![],'where':{'id':_0x4acc8c[_0xe188('0x52')]['id']}},_0x43badc={};_0x43badc[_0xe188('0x3b')]=_[_0xe188('0x3c')](db[_0xe188('0x37')]['rawAttributes']);_0x43badc[_0xe188('0x3d')]=_[_0xe188('0x3c')](_0x4acc8c[_0xe188('0x3d')]);_0x43badc[_0xe188('0x3e')]=_[_0xe188('0x3f')](_0x43badc[_0xe188('0x3b')],_0x43badc['query']);_0x5dbea5['attributes']=_[_0xe188('0x3f')](_0x43badc[_0xe188('0x3b')],qs[_0xe188('0x53')](_0x4acc8c['query'][_0xe188('0x53')]));_0x5dbea5[_0xe188('0x40')]=_0x5dbea5['attributes'][_0xe188('0x41')]?_0x5dbea5[_0xe188('0x40')]:_0x43badc[_0xe188('0x3b')];if(_0x4acc8c['query'][_0xe188('0x4c')]){_0x5dbea5[_0xe188('0x4d')]=[{'all':!![]}];}_0x5dbea5=_['merge']({},_0x5dbea5,_0x4acc8c[_0xe188('0x4b')]);return db['MailQueue'][_0xe188('0x54')](_0x5dbea5)['then'](handleEntityNotFound(_0x28a64d,null))['then'](respondWithResult(_0x28a64d,null))['catch'](handleError(_0x28a64d,null));};exports[_0xe188('0x55')]=function(_0x3868bc,_0x256e12){return db['MailQueue']['create'](_0x3868bc[_0xe188('0x56')],{})[_0xe188('0x2d')](function(_0x48631d){var _0x276d74=_0x3868bc[_0xe188('0x57')][_0xe188('0x2e')]({'plain':!![]});if(!_0x276d74)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x276d74[_0xe188('0x58')]===_0xe188('0x57')){var _0x29cf83=_0x48631d['get']({'plain':!![]});var _0x187e64=_0xe188('0x2f');return db[_0xe188('0x59')]['find']({'where':{'name':_0x187e64,'userProfileId':_0x276d74[_0xe188('0x5a')]},'raw':!![]})[_0xe188('0x2d')](function(_0x47947b){if(_0x47947b&&_0x47947b[_0xe188('0x5b')]===0x0){return db[_0xe188('0x30')][_0xe188('0x55')]({'name':_0x29cf83[_0xe188('0x33')],'resourceId':_0x29cf83['id'],'type':_0x47947b['name'],'sectionId':_0x47947b['id']},{})['then'](function(){return _0x48631d;});}else{return _0x48631d;}})[_0xe188('0x50')](function(_0xcf6092){logger[_0xe188('0x31')](_0xe188('0x5c'),_0xcf6092);throw _0xcf6092;});}return _0x48631d;})[_0xe188('0x2d')](respondWithResult(_0x256e12,0xc9))['catch'](handleError(_0x256e12,null));};exports[_0xe188('0x2c')]=function(_0x177dc2,_0x29bf46){if(_0x177dc2['body']['id']){delete _0x177dc2['body']['id'];}return db[_0xe188('0x37')][_0xe188('0x54')]({'where':{'id':_0x177dc2['params']['id']}})[_0xe188('0x2d')](handleEntityNotFound(_0x29bf46,null))['then'](saveUpdates(_0x177dc2[_0xe188('0x56')],null))[_0xe188('0x2d')](respondWithResult(_0x29bf46,null))[_0xe188('0x50')](handleError(_0x29bf46,null));};exports[_0xe188('0x5d')]=function(_0x40c998,_0x2cf6b7){return db[_0xe188('0x37')][_0xe188('0x54')]({'where':{'id':_0x40c998['params']['id']}})['then'](handleEntityNotFound(_0x2cf6b7,null))[_0xe188('0x2d')](removeEntity(_0x2cf6b7,null))[_0xe188('0x50')](handleError(_0x2cf6b7,null));};exports[_0xe188('0x5e')]=function(_0x43e994,_0x200d68){return db[_0xe188('0x37')]['describe']()[_0xe188('0x2d')](respondWithResult(_0x200d68,null))[_0xe188('0x50')](handleError(_0x200d68,null));};exports[_0xe188('0x5f')]=function(_0x26634d,_0x5e97b3,_0x27f158){var _0x5aae60={'raw':!![],'where':{}},_0x43ebb0={},_0x4b9df3;return db[_0xe188('0x37')][_0xe188('0x60')]({'where':{'id':_0x26634d[_0xe188('0x52')]['id']}})[_0xe188('0x2d')](handleEntityNotFound(_0x5e97b3,null))['then'](function(_0x67f5cf){if(_0x67f5cf){_0x4b9df3=_0x67f5cf[_0xe188('0x2e')]({'plain':!![]});_0x43ebb0[_0xe188('0x3b')]=_[_0xe188('0x3c')](db[_0xe188('0x61')][_0xe188('0x38')]);_0x43ebb0[_0xe188('0x3d')]=_[_0xe188('0x3c')](_0x26634d[_0xe188('0x3d')]);_0x43ebb0[_0xe188('0x3e')]=_[_0xe188('0x3f')](_0x43ebb0['model'],_0x43ebb0[_0xe188('0x3d')]);_0x5aae60[_0xe188('0x40')]=_[_0xe188('0x3f')](_0x43ebb0[_0xe188('0x3b')],qs[_0xe188('0x53')](_0x26634d[_0xe188('0x3d')][_0xe188('0x53')]));_0x5aae60[_0xe188('0x40')]=_0x5aae60[_0xe188('0x40')][_0xe188('0x41')]?_0x5aae60['attributes']:_0x43ebb0[_0xe188('0x3b')];if(!_0x26634d[_0xe188('0x3d')]['hasOwnProperty'](_0xe188('0x43'))){_0x5aae60[_0xe188('0x27')]=qs[_0xe188('0x27')](_0x26634d[_0xe188('0x3d')][_0xe188('0x27')]);_0x5aae60[_0xe188('0x25')]=qs['offset'](_0x26634d['query'][_0xe188('0x25')]);}_0x5aae60[_0xe188('0x44')]=qs[_0xe188('0x45')](_0x26634d[_0xe188('0x3d')]['sort']);_0x5aae60[_0xe188('0x46')]=qs[_0xe188('0x3e')](_[_0xe188('0x47')](_0x26634d[_0xe188('0x3d')],_0x43ebb0[_0xe188('0x3e')]));_0x5aae60['where'][_0xe188('0x62')]=_0x67f5cf['id'];if(_0x26634d[_0xe188('0x3d')][_0xe188('0x4a')]){_0x5aae60[_0xe188('0x46')]=_['merge'](_0x5aae60[_0xe188('0x46')],{'$or':_[_0xe188('0x36')](_0x5aae60[_0xe188('0x40')],function(_0x15adec){var _0x79efdc={};_0x79efdc[_0x15adec]={'$like':'%'+_0x26634d[_0xe188('0x3d')][_0xe188('0x4a')]+'%'};return _0x79efdc;})});}_0x5aae60=_[_0xe188('0x48')]({},_0x5aae60,_0x26634d[_0xe188('0x4b')]);return db[_0xe188('0x61')][_0xe188('0x4e')](_0x5aae60);}})['then'](function(_0x97c32d){if(_0x97c32d){return db[_0xe188('0x63')][_0xe188('0x64')]({'where':{'id':_[_0xe188('0x36')](_0x97c32d,_0xe188('0x65')),'role':_0xe188('0x66')},'attributes':['id',_0xe188('0x33'),_0xe188('0x67'),_0xe188('0x68'),_0xe188('0x69')]});}})[_0xe188('0x2d')](function(_0x17ccc5){if(_0x17ccc5){return{'count':_0x17ccc5[_0xe188('0x28')],'rows':_[_0xe188('0x36')](_0x17ccc5['rows'],function(_0x265076){return{'membername':_0x265076[_0xe188('0x33')],'UserId':_0x265076['id'],'queue_name':_0x4b9df3[_0xe188('0x33')],'MailQueueId':_0x4b9df3['id'],'interface':util['format'](_0xe188('0x6a'),_0xe188('0x6b'),_0x265076['name']),'penalty':0x0,'paused':_0x265076[_0xe188('0x67')],'createdAt':_0x265076[_0xe188('0x69')],'updatedAt':_0x265076[_0xe188('0x68')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x5e97b3,_0x5aae60))[_0xe188('0x50')](handleError(_0x5e97b3,null));};exports[_0xe188('0x6c')]=function(_0x1be908,_0x34deb4,_0x1fb2a5){var _0x49b0b3={};var _0x16ac46={};var _0x4e6517;var _0x16f899;return db['MailQueue']['findOne']({'where':{'id':_0x1be908[_0xe188('0x52')]['id']}})['then'](handleEntityNotFound(_0x34deb4,null))[_0xe188('0x2d')](function(_0x23a2c8){if(_0x23a2c8){_0x4e6517=_0x23a2c8;_0x16ac46['model']=_['keys'](db[_0xe188('0x6d')][_0xe188('0x38')]);_0x16ac46[_0xe188('0x3d')]=_[_0xe188('0x3c')](_0x1be908[_0xe188('0x3d')]);_0x16ac46[_0xe188('0x3e')]=_[_0xe188('0x3f')](_0x16ac46['model'],_0x16ac46[_0xe188('0x3d')]);_0x49b0b3['attributes']=_[_0xe188('0x3f')](_0x16ac46[_0xe188('0x3b')],qs[_0xe188('0x53')](_0x1be908[_0xe188('0x3d')][_0xe188('0x53')]));_0x49b0b3['attributes']=_0x49b0b3['attributes'][_0xe188('0x41')]?_0x49b0b3['attributes']:_0x16ac46[_0xe188('0x3b')];_0x49b0b3['order']=qs[_0xe188('0x45')](_0x1be908['query'][_0xe188('0x45')]);_0x49b0b3[_0xe188('0x46')]=qs['filters'](_['pick'](_0x1be908['query'],_0x16ac46[_0xe188('0x3e')]));if(_0x1be908[_0xe188('0x3d')][_0xe188('0x4a')]){_0x49b0b3['where']=_['merge'](_0x49b0b3[_0xe188('0x46')],{'$or':_['map'](_0x49b0b3[_0xe188('0x40')],function(_0x3ffc71){var _0x1e9cfd={};_0x1e9cfd[_0x3ffc71]={'$like':'%'+_0x1be908[_0xe188('0x3d')][_0xe188('0x4a')]+'%'};return _0x1e9cfd;})});}_0x49b0b3=_[_0xe188('0x48')]({},_0x49b0b3,_0x1be908[_0xe188('0x4b')]);return _0x4e6517[_0xe188('0x6c')](_0x49b0b3);}})[_0xe188('0x2d')](function(_0x92e651){if(_0x92e651){_0x16f899=_0x92e651[_0xe188('0x41')];if(!_0x1be908[_0xe188('0x3d')][_0xe188('0x42')](_0xe188('0x43'))){_0x49b0b3[_0xe188('0x27')]=qs[_0xe188('0x27')](_0x1be908['query'][_0xe188('0x27')]);_0x49b0b3[_0xe188('0x25')]=qs[_0xe188('0x25')](_0x1be908[_0xe188('0x3d')][_0xe188('0x25')]);}return _0x4e6517[_0xe188('0x6c')](_0x49b0b3);}})[_0xe188('0x2d')](function(_0x5058fe){if(_0x5058fe){return _0x5058fe?{'count':_0x16f899,'rows':_0x5058fe}:null;}})[_0xe188('0x2d')](respondWithResult(_0x34deb4,null))[_0xe188('0x50')](handleError(_0x34deb4,null));};exports[_0xe188('0x6e')]=function(_0x4f3d52,_0x563ed0,_0x3bf3ab){var _0x132fbb=_0x4f3d52[_0xe188('0x56')][_0xe188('0x6f')];return db[_0xe188('0x6d')][_0xe188('0x4e')]({'where':{'id':_0x132fbb},'attributes':['id'],'include':[{'model':db[_0xe188('0x63')],'as':_0xe188('0x70'),'attributes':['id',_0xe188('0x33'),_0xe188('0x71'),'voicePause',_0xe188('0x72')],'raw':!![]}]})['then'](function(_0x32dd6d){if(_0x32dd6d){var _0x4604b2=_[_0xe188('0x73')](_0x32dd6d,function(_0x45b976){var _0x5d00fc=_0x45b976[_0xe188('0x2e')]({'plain':!![]});return _0x5d00fc['Agents'];});return db[_0xe188('0x37')][_0xe188('0x54')]({'where':{'id':_0x4f3d52[_0xe188('0x52')]['id']}})['then'](function(_0x75c97d){return db[_0xe188('0x74')]['transaction'](function(_0x36341f){return _0x75c97d['addTeams'](_0x132fbb,{'transaction':_0x36341f})['then'](function(){return BPromise[_0xe188('0x75')](_0x4604b2,function(_0xcf5e0a){return db[_0xe188('0x61')][_0xe188('0x76')]({'where':{'UserId':_0xcf5e0a['id'],'MailQueueId':_0x4f3d52['params']['id']},'transaction':_0x36341f});});})[_0xe188('0x2d')](function(){_0x4604b2[_0xe188('0x77')](function(_0x57d5d8){socket[_0xe188('0x78')](_0xe188('0x79'),{'UserId':_0x57d5d8['id'],'MailQueueId':_0x75c97d['id']});});});});});}})[_0xe188('0x2d')](respondWithStatusCode(_0x563ed0,null))['catch'](handleError(_0x563ed0,null));};exports[_0xe188('0x7a')]=function(_0x470e97,_0x5c14a6,_0x10c51e){return db[_0xe188('0x6d')][_0xe188('0x4e')]({'where':{'id':_0x470e97['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xe188('0x63')],'as':_0xe188('0x70'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5c14a6,null))[_0xe188('0x2d')](function(_0x59fc69){var _0x4fb7d2=_[_0xe188('0x36')](_0x59fc69,'id');var _0x225643=[];var _0x120690=[];var _0x20eefb=squel['select']();_0x20eefb['field'](_0xe188('0x7b'))['from'](_0xe188('0x7c'),'tq')['join']('user_has_teams','ut',_0xe188('0x7d'))[_0xe188('0x46')]('MailQueueId\x20=\x20?',_0x470e97['params']['id']);for(var _0x12bfaf=0x0;_0x12bfaf<_0x59fc69[_0xe188('0x41')];_0x12bfaf+=0x1){let _0x5858ce=_0x59fc69[_0x12bfaf];for(var _0x3bad8f=0x0;_0x3bad8f<_0x5858ce['Agents'][_0xe188('0x41')];_0x3bad8f+=0x1){let _0x2db646=_0x5858ce[_0xe188('0x70')][_0x3bad8f];var _0x3d77bb=_0x20eefb[_0xe188('0x7e')]();_0x3d77bb[_0xe188('0x46')](_0xe188('0x7f'),_0x2db646['id']);_0x120690['push'](db[_0xe188('0x74')][_0xe188('0x3d')](_0x3d77bb[_0xe188('0x80')](),{'type':db[_0xe188('0x74')]['QueryTypes'][_0xe188('0x81')]})[_0xe188('0x2d')](function(_0x555322){if(_0x555322[_0xe188('0x41')]===0x1){return _0x2db646['id'];}else{var _0x2f51ac=_[_0xe188('0x82')](_[_0xe188('0x36')](_0x555322,_0xe188('0x83')),function(_0x3f0e3a){return _[_0xe188('0x84')](_0x4fb7d2,_0x3f0e3a);});if(_0x2f51ac){return _0x2db646['id'];}}}));}}return BPromise[_0xe188('0x85')](_0x120690)[_0xe188('0x2d')](function(_0x530747){_0x225643=_(_0x225643)['union'](_0x530747)[_0xe188('0x86')]()[_0xe188('0x87')]();return db[_0xe188('0x37')][_0xe188('0x54')]({'where':{'id':_0x470e97[_0xe188('0x52')]['id']}})[_0xe188('0x2d')](function(_0x2eafff){return db[_0xe188('0x74')]['transaction'](function(_0x42e0a8){return _0x2eafff[_0xe188('0x7a')](_0x470e97['query']['ids'],{'transaction':_0x42e0a8})[_0xe188('0x2d')](function(){if(!_['isEmpty'](_0x225643)){return _0x2eafff[_0xe188('0x88')](_0x225643,{'transaction':_0x42e0a8});}})[_0xe188('0x2d')](function(){_0x225643[_0xe188('0x77')](function(_0x147b77){socket['emit']('userMailQueue:remove',{'UserId':_0x147b77,'MailQueueId':_0x2eafff['id']});});});});});});})[_0xe188('0x2d')](respondWithStatusCode(_0x5c14a6,null))[_0xe188('0x50')](handleError(_0x5c14a6,null));};exports['addAgents']=function(_0x224b4d,_0x3a355d,_0x11491d){return db[_0xe188('0x37')][_0xe188('0x54')]({'where':{'id':_0x224b4d[_0xe188('0x52')]['id']}})['then'](handleEntityNotFound(_0x3a355d,null))[_0xe188('0x2d')](function(_0x11c74c){if(_0x11c74c){return _0x11c74c['addAgents'](_0x224b4d[_0xe188('0x56')][_0xe188('0x6f')],_[_0xe188('0x89')](_0x224b4d[_0xe188('0x56')],[_0xe188('0x6f'),'id'])||{})[_0xe188('0x8a')](function(_0x27f46c){for(var _0x1d782b=0x0;_0x1d782b<_0x224b4d['body']['ids']['length'];_0x1d782b+=0x1){socket[_0xe188('0x78')](_0xe188('0x79'),{'UserId':Number(_0x224b4d['body'][_0xe188('0x6f')][_0x1d782b]),'MailQueueId':Number(_0x224b4d[_0xe188('0x52')]['id'])});}return _0x27f46c;});}})['then'](respondWithResult(_0x3a355d,null))['catch'](handleError(_0x3a355d,null));};exports[_0xe188('0x88')]=function(_0x53909c,_0x2c473a,_0x35559f){return db[_0xe188('0x37')][_0xe188('0x54')]({'where':{'id':_0x53909c[_0xe188('0x52')]['id']}})[_0xe188('0x2d')](handleEntityNotFound(_0x2c473a,null))[_0xe188('0x2d')](function(_0x4750cf){if(_0x4750cf){return _0x4750cf[_0xe188('0x88')](_0x53909c['query'][_0xe188('0x6f')])[_0xe188('0x2d')](function(){if(_[_0xe188('0x8b')](_0x53909c[_0xe188('0x3d')]['ids'])){for(var _0x576af8=0x0;_0x576af8<_0x53909c['query']['ids'][_0xe188('0x41')];_0x576af8+=0x1){socket[_0xe188('0x78')](_0xe188('0x8c'),{'UserId':Number(_0x53909c[_0xe188('0x3d')][_0xe188('0x6f')][_0x576af8]),'MailQueueId':Number(_0x53909c[_0xe188('0x52')]['id'])});}}else{socket['emit'](_0xe188('0x8c'),{'UserId':Number(_0x53909c['query']['ids']),'MailQueueId':Number(_0x53909c[_0xe188('0x52')]['id'])});}});}})[_0xe188('0x2d')](respondWithStatusCode(_0x2c473a,null))[_0xe188('0x50')](handleError(_0x2c473a,null));};exports[_0xe188('0x8d')]=function(_0x170c2a,_0x1aea69,_0x345f48){var _0x599c71={};var _0x517da2={};var _0x5ea163;var _0x5c9073;return db[_0xe188('0x37')][_0xe188('0x60')]({'where':{'id':_0x170c2a[_0xe188('0x52')]['id']}})[_0xe188('0x2d')](handleEntityNotFound(_0x1aea69,null))[_0xe188('0x2d')](function(_0xc5fccb){if(_0xc5fccb){_0x5ea163=_0xc5fccb;_0x517da2['model']=_['keys'](db['User']['rawAttributes']);_0x517da2['query']=_[_0xe188('0x3c')](_0x170c2a[_0xe188('0x3d')]);_0x517da2[_0xe188('0x3e')]=_[_0xe188('0x3f')](_0x517da2[_0xe188('0x3b')],_0x517da2['query']);_0x599c71[_0xe188('0x40')]=_['intersection'](_0x517da2[_0xe188('0x3b')],qs['fields'](_0x170c2a[_0xe188('0x3d')][_0xe188('0x53')]));_0x599c71[_0xe188('0x40')]=_0x599c71[_0xe188('0x40')][_0xe188('0x41')]?_0x599c71[_0xe188('0x40')]:_0x517da2[_0xe188('0x3b')];_0x599c71['order']=qs[_0xe188('0x45')](_0x170c2a[_0xe188('0x3d')][_0xe188('0x45')]);_0x599c71[_0xe188('0x46')]=qs['filters'](_['pick'](_0x170c2a[_0xe188('0x3d')],_0x517da2[_0xe188('0x3e')]));if(_0x170c2a[_0xe188('0x3d')][_0xe188('0x4a')]){_0x599c71[_0xe188('0x46')]=_[_0xe188('0x48')](_0x599c71[_0xe188('0x46')],{'$or':_[_0xe188('0x36')](_0x599c71['attributes'],function(_0x3a20ea){var _0x588bc9={};_0x588bc9[_0x3a20ea]={'$like':'%'+_0x170c2a[_0xe188('0x3d')][_0xe188('0x4a')]+'%'};return _0x588bc9;})});}_0x599c71=_['merge']({},_0x599c71,_0x170c2a[_0xe188('0x4b')]);return _0x5ea163[_0xe188('0x8d')](_0x599c71);}})[_0xe188('0x2d')](function(_0x584def){if(_0x584def){_0x5c9073=_0x584def[_0xe188('0x41')];if(!_0x170c2a[_0xe188('0x3d')][_0xe188('0x42')](_0xe188('0x43'))){_0x599c71[_0xe188('0x27')]=qs[_0xe188('0x27')](_0x170c2a[_0xe188('0x3d')][_0xe188('0x27')]);_0x599c71['offset']=qs[_0xe188('0x25')](_0x170c2a[_0xe188('0x3d')][_0xe188('0x25')]);}return _0x5ea163['getAgents'](_0x599c71);}})[_0xe188('0x2d')](function(_0x2efcfb){if(_0x2efcfb){return _0x2efcfb?{'count':_0x5c9073,'rows':_0x2efcfb}:null;}})['then'](respondWithResult(_0x1aea69,null))[_0xe188('0x50')](handleError(_0x1aea69,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 18b2d8a..4e81a71 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 _0x6ae9=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','update'];(function(_0x412d9c,_0x3b6900){var _0x328881=function(_0x4dea28){while(--_0x4dea28){_0x412d9c['push'](_0x412d9c['shift']());}};_0x328881(++_0x3b6900);}(_0x6ae9,0x68));var _0x96ae=function(_0x18b71b,_0x57dcbd){_0x18b71b=_0x18b71b-0x0;var _0x49826a=_0x6ae9[_0x18b71b];return _0x49826a;};'use strict';var EventEmitter=require(_0x96ae('0x0'));var MailQueue=require(_0x96ae('0x1'))['db'][_0x96ae('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x96ae('0x3'),'afterDestroy':_0x96ae('0x4')};function emitEvent(_0x1d8dd6){return function(_0x18582c,_0x257dd4,_0x580e2c){MailQueueEvents['emit'](_0x1d8dd6+':'+_0x18582c['id'],_0x18582c);MailQueueEvents[_0x96ae('0x5')](_0x1d8dd6,_0x18582c);_0x580e2c(null);};}for(var e in events){if(events[_0x96ae('0x6')](e)){var event=events[e];MailQueue[_0x96ae('0x7')](e,emitEvent(event));}}module[_0x96ae('0x8')]=MailQueueEvents; \ No newline at end of file +var _0x6f4a=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','MailQueue','save'];(function(_0x33fbd2,_0x200c32){var _0x546b57=function(_0x111160){while(--_0x111160){_0x33fbd2['push'](_0x33fbd2['shift']());}};_0x546b57(++_0x200c32);}(_0x6f4a,0xf6));var _0xa6f4=function(_0xefe112,_0x1d9c84){_0xefe112=_0xefe112-0x0;var _0x5d393d=_0x6f4a[_0xefe112];return _0x5d393d;};'use strict';var EventEmitter=require(_0xa6f4('0x0'));var MailQueue=require(_0xa6f4('0x1'))['db'][_0xa6f4('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa6f4('0x3'),'afterUpdate':_0xa6f4('0x4'),'afterDestroy':_0xa6f4('0x5')};function emitEvent(_0x2a8cbb){return function(_0x4c585a,_0x4f3b6f,_0xb2bd7a){MailQueueEvents[_0xa6f4('0x6')](_0x2a8cbb+':'+_0x4c585a['id'],_0x4c585a);MailQueueEvents['emit'](_0x2a8cbb,_0x4c585a);_0xb2bd7a(null);};}for(var e in events){if(events[_0xa6f4('0x7')](e)){var event=events[e];MailQueue[_0xa6f4('0x8')](e,emitEvent(event));}}module[_0xa6f4('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 6932f9b..fafc201 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 _0x8cac=['mail_queues','lodash','api','moment','bluebird','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x144fc9,_0x1c5fb5){var _0x35d11a=function(_0x3b2e7c){while(--_0x3b2e7c){_0x144fc9['push'](_0x144fc9['shift']());}};_0x35d11a(++_0x1c5fb5);}(_0x8cac,0x1c4));var _0xc8ca=function(_0x279d37,_0x14de3f){_0x279d37=_0x279d37-0x0;var _0x530173=_0x8cac[_0x279d37];return _0x530173;};'use strict';var _=require(_0xc8ca('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc8ca('0x1'));var moment=require(_0xc8ca('0x2'));var BPromise=require(_0xc8ca('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc8ca('0x4'));var rimraf=require('rimraf');var config=require(_0xc8ca('0x5'));var attributes=require(_0xc8ca('0x6'));module[_0xc8ca('0x7')]=function(_0x5a69d0,_0x5165c3){return _0x5a69d0[_0xc8ca('0x8')](_0xc8ca('0x9'),attributes,{'tableName':_0xc8ca('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5d76=['../../config/logger','api','moment','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue','mail_queues','util'];(function(_0x3c0dcc,_0x18c419){var _0x1a224c=function(_0x238ae7){while(--_0x238ae7){_0x3c0dcc['push'](_0x3c0dcc['shift']());}};_0x1a224c(++_0x18c419);}(_0x5d76,0x1a3));var _0x65d7=function(_0x5680f6,_0x51543d){_0x5680f6=_0x5680f6-0x0;var _0x27e0a4=_0x5d76[_0x5680f6];return _0x27e0a4;};'use strict';var _=require('lodash');var util=require(_0x65d7('0x0'));var logger=require(_0x65d7('0x1'))(_0x65d7('0x2'));var moment=require(_0x65d7('0x3'));var BPromise=require('bluebird');var rp=require(_0x65d7('0x4'));var fs=require('fs');var path=require(_0x65d7('0x5'));var rimraf=require('rimraf');var config=require(_0x65d7('0x6'));var attributes=require(_0x65d7('0x7'));module[_0x65d7('0x8')]=function(_0x50981e,_0x5379b9){return _0x50981e[_0x65d7('0x9')](_0x65d7('0xa'),attributes,{'tableName':_0x65d7('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 6f81cac..bb46caa 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 _0xd827=['findAll','options','where','limit','include','model','attributes','map','catch','then','ShowMailQueue','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','socket.io-emitter','redis','register','request','info','MailQueue,\x20%s,\x20%s','debug','MailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','GetMailQueue','MailQueue'];(function(_0x51b8a4,_0x2908e8){var _0x134219=function(_0x18b884){while(--_0x18b884){_0x51b8a4['push'](_0x51b8a4['shift']());}};_0x134219(++_0x2908e8);}(_0xd827,0x115));var _0x7d82=function(_0x2a3cb2,_0x55280a){_0x2a3cb2=_0x2a3cb2-0x0;var _0x4120af=_0xd827[_0x2a3cb2];return _0x4120af;};'use strict';var _=require(_0x7d82('0x0'));var util=require(_0x7d82('0x1'));var moment=require(_0x7d82('0x2'));var BPromise=require(_0x7d82('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7d82('0x4'));var db=require(_0x7d82('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7d82('0x6'));var config=require(_0x7d82('0x7'));var jayson=require(_0x7d82('0x8'));var client=jayson[_0x7d82('0x9')][_0x7d82('0xa')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x7d82('0xb'))(new Redis(config[_0x7d82('0xc')]));require('./mailQueue.socket')[_0x7d82('0xd')](socket);function respondWithRpcPromise(_0x129fed,_0x4639af,_0x4caa31){return new BPromise(function(_0x2824c4,_0x17ee50){return client[_0x7d82('0xe')](_0x129fed,_0x4caa31)['then'](function(_0x24ceb0){logger[_0x7d82('0xf')](_0x7d82('0x10'),_0x4639af,'request\x20sent');logger[_0x7d82('0x11')](_0x7d82('0x12'),_0x4639af,_0x7d82('0x13'),JSON[_0x7d82('0x14')](_0x24ceb0));if(_0x24ceb0[_0x7d82('0x15')]){if(_0x24ceb0['error'][_0x7d82('0x16')]===0x1f4){logger['error'](_0x7d82('0x10'),_0x4639af,_0x24ceb0[_0x7d82('0x15')][_0x7d82('0x17')]);return _0x17ee50(_0x24ceb0['error']['message']);}logger[_0x7d82('0x15')](_0x7d82('0x10'),_0x4639af,_0x24ceb0['error']['message']);return _0x2824c4(_0x24ceb0['error']['message']);}else{logger['info']('MailQueue,\x20%s,\x20%s',_0x4639af,_0x7d82('0x13'));_0x2824c4(_0x24ceb0[_0x7d82('0x18')][_0x7d82('0x17')]);}})['catch'](function(_0x1b00ac){logger[_0x7d82('0x15')](_0x7d82('0x10'),_0x4639af,_0x1b00ac);_0x17ee50(_0x1b00ac);});});}exports[_0x7d82('0x19')]=function(_0xeca8fc){var _0xcbf1c6=this;return new Promise(function(_0x30af77,_0xeba1d0){return db[_0x7d82('0x1a')][_0x7d82('0x1b')]({'raw':_0xeca8fc['options']?_0xeca8fc[_0x7d82('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0xeca8fc['options']?_0xeca8fc[_0x7d82('0x1c')][_0x7d82('0x1d')]||null:null,'attributes':_0xeca8fc[_0x7d82('0x1c')]?_0xeca8fc[_0x7d82('0x1c')]['attributes']||null:null,'limit':_0xeca8fc[_0x7d82('0x1c')]?_0xeca8fc[_0x7d82('0x1c')][_0x7d82('0x1e')]||null:null,'include':_0xeca8fc[_0x7d82('0x1c')]?_0xeca8fc['options'][_0x7d82('0x1f')]?_['map'](_0xeca8fc['options'][_0x7d82('0x1f')],function(_0x3e97cf){return{'model':db[_0x3e97cf[_0x7d82('0x20')]],'as':_0x3e97cf['as'],'attributes':_0x3e97cf[_0x7d82('0x21')],'include':_0x3e97cf['include']?_[_0x7d82('0x22')](_0x3e97cf[_0x7d82('0x1f')],function(_0x5db31){return{'model':db[_0x5db31[_0x7d82('0x20')]],'as':_0x5db31['as'],'attributes':_0x5db31[_0x7d82('0x21')],'include':_0x5db31[_0x7d82('0x1f')]?_[_0x7d82('0x22')](_0x5db31[_0x7d82('0x1f')],function(_0xa7c89a){return{'model':db[_0xa7c89a[_0x7d82('0x20')]],'as':_0xa7c89a['as'],'attributes':_0xa7c89a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1bfd0f){logger[_0x7d82('0xf')]('GetMailQueue',_0xeca8fc);logger[_0x7d82('0x11')](_0x7d82('0x19'),_0xeca8fc,JSON[_0x7d82('0x14')](_0x1bfd0f));_0x30af77(_0x1bfd0f);})[_0x7d82('0x23')](function(_0x36dcce){logger['error'](_0x7d82('0x19'),_0x36dcce[_0x7d82('0x17')],_0xeca8fc);_0xeba1d0(_0xcbf1c6[_0x7d82('0x15')](0x1f4,_0x36dcce[_0x7d82('0x17')]));});});};exports['ShowMailQueue']=function(_0x2b984c){var _0x2fdbe6=this;return new Promise(function(_0x23589e,_0x2f9b49){return db['MailQueue']['find']({'raw':_0x2b984c[_0x7d82('0x1c')]?_0x2b984c[_0x7d82('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x2b984c[_0x7d82('0x1c')]?_0x2b984c[_0x7d82('0x1c')][_0x7d82('0x1d')]||null:null,'attributes':_0x2b984c[_0x7d82('0x1c')]?_0x2b984c['options']['attributes']||null:null,'include':_0x2b984c['options']?_0x2b984c[_0x7d82('0x1c')][_0x7d82('0x1f')]?_[_0x7d82('0x22')](_0x2b984c['options'][_0x7d82('0x1f')],function(_0x43efce){return{'model':db[_0x43efce[_0x7d82('0x20')]],'as':_0x43efce['as'],'attributes':_0x43efce['attributes'],'include':_0x43efce[_0x7d82('0x1f')]?_[_0x7d82('0x22')](_0x43efce[_0x7d82('0x1f')],function(_0x476b77){return{'model':db[_0x476b77[_0x7d82('0x20')]],'as':_0x476b77['as'],'attributes':_0x476b77[_0x7d82('0x21')],'include':_0x476b77['include']?_['map'](_0x476b77['include'],function(_0x27efdd){return{'model':db[_0x27efdd[_0x7d82('0x20')]],'as':_0x27efdd['as'],'attributes':_0x27efdd[_0x7d82('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7d82('0x24')](function(_0x368d0d){logger[_0x7d82('0xf')](_0x7d82('0x25'),_0x2b984c);logger[_0x7d82('0x11')](_0x7d82('0x25'),_0x2b984c,JSON[_0x7d82('0x14')](_0x368d0d));_0x23589e(_0x368d0d);})[_0x7d82('0x23')](function(_0x4fdbcb){logger[_0x7d82('0x15')](_0x7d82('0x25'),_0x4fdbcb[_0x7d82('0x17')],_0x2b984c);_0x2f9b49(_0x2fdbe6[_0x7d82('0x15')](0x1f4,_0x4fdbcb[_0x7d82('0x17')]));});});}; \ No newline at end of file +var _0x9eb4=['request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetMailQueue','MailQueue','findAll','options','raw','where','attributes','include','map','model','catch','find','ShowMailQueue','util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','request','then','info','MailQueue,\x20%s,\x20%s'];(function(_0x38a8eb,_0x4b59ba){var _0x6c3807=function(_0x3aeec7){while(--_0x3aeec7){_0x38a8eb['push'](_0x38a8eb['shift']());}};_0x6c3807(++_0x4b59ba);}(_0x9eb4,0x126));var _0x49eb=function(_0x31b9cf,_0x1a809b){_0x31b9cf=_0x31b9cf-0x0;var _0x357b8a=_0x9eb4[_0x31b9cf];return _0x357b8a;};'use strict';var _=require('lodash');var util=require(_0x49eb('0x0'));var moment=require(_0x49eb('0x1'));var BPromise=require(_0x49eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x49eb('0x3'))['db'];var utils=require(_0x49eb('0x4'));var logger=require(_0x49eb('0x5'))(_0x49eb('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x49eb('0x7')]['http']({'port':0x232a});config[_0x49eb('0x8')]=_[_0x49eb('0x9')](config[_0x49eb('0x8')],{'host':_0x49eb('0xa'),'port':0x18eb});var socket=require(_0x49eb('0xb'))(new Redis(config['redis']));require(_0x49eb('0xc'))[_0x49eb('0xd')](socket);function respondWithRpcPromise(_0x387dac,_0x3fe5ff,_0x3714b3){return new BPromise(function(_0x410d0e,_0x251b96){return client[_0x49eb('0xe')](_0x387dac,_0x3714b3)[_0x49eb('0xf')](function(_0x1f037f){logger[_0x49eb('0x10')](_0x49eb('0x11'),_0x3fe5ff,_0x49eb('0x12'));logger[_0x49eb('0x13')](_0x49eb('0x14'),_0x3fe5ff,_0x49eb('0x12'),JSON[_0x49eb('0x15')](_0x1f037f));if(_0x1f037f[_0x49eb('0x16')]){if(_0x1f037f['error'][_0x49eb('0x17')]===0x1f4){logger[_0x49eb('0x16')](_0x49eb('0x11'),_0x3fe5ff,_0x1f037f[_0x49eb('0x16')][_0x49eb('0x18')]);return _0x251b96(_0x1f037f[_0x49eb('0x16')][_0x49eb('0x18')]);}logger[_0x49eb('0x16')](_0x49eb('0x11'),_0x3fe5ff,_0x1f037f['error']['message']);return _0x410d0e(_0x1f037f[_0x49eb('0x16')][_0x49eb('0x18')]);}else{logger[_0x49eb('0x10')](_0x49eb('0x11'),_0x3fe5ff,_0x49eb('0x12'));_0x410d0e(_0x1f037f[_0x49eb('0x19')][_0x49eb('0x18')]);}})['catch'](function(_0x234ad1){logger[_0x49eb('0x16')](_0x49eb('0x11'),_0x3fe5ff,_0x234ad1);_0x251b96(_0x234ad1);});});}exports[_0x49eb('0x1a')]=function(_0x390d9d){var _0x10ec4e=this;return new Promise(function(_0x1f3b6e,_0x50bdf8){return db[_0x49eb('0x1b')][_0x49eb('0x1c')]({'raw':_0x390d9d[_0x49eb('0x1d')]?_0x390d9d['options'][_0x49eb('0x1e')]===undefined?!![]:![]:!![],'where':_0x390d9d[_0x49eb('0x1d')]?_0x390d9d[_0x49eb('0x1d')][_0x49eb('0x1f')]||null:null,'attributes':_0x390d9d['options']?_0x390d9d[_0x49eb('0x1d')][_0x49eb('0x20')]||null:null,'limit':_0x390d9d[_0x49eb('0x1d')]?_0x390d9d[_0x49eb('0x1d')]['limit']||null:null,'include':_0x390d9d['options']?_0x390d9d[_0x49eb('0x1d')][_0x49eb('0x21')]?_[_0x49eb('0x22')](_0x390d9d[_0x49eb('0x1d')][_0x49eb('0x21')],function(_0x3f2b5d){return{'model':db[_0x3f2b5d['model']],'as':_0x3f2b5d['as'],'attributes':_0x3f2b5d[_0x49eb('0x20')],'include':_0x3f2b5d['include']?_[_0x49eb('0x22')](_0x3f2b5d[_0x49eb('0x21')],function(_0x2bda90){return{'model':db[_0x2bda90[_0x49eb('0x23')]],'as':_0x2bda90['as'],'attributes':_0x2bda90['attributes'],'include':_0x2bda90['include']?_[_0x49eb('0x22')](_0x2bda90[_0x49eb('0x21')],function(_0x14b4ef){return{'model':db[_0x14b4ef[_0x49eb('0x23')]],'as':_0x14b4ef['as'],'attributes':_0x14b4ef[_0x49eb('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2c0e4f){logger[_0x49eb('0x10')](_0x49eb('0x1a'),_0x390d9d);logger[_0x49eb('0x13')](_0x49eb('0x1a'),_0x390d9d,JSON[_0x49eb('0x15')](_0x2c0e4f));_0x1f3b6e(_0x2c0e4f);})[_0x49eb('0x24')](function(_0x470ca7){logger[_0x49eb('0x16')](_0x49eb('0x1a'),_0x470ca7['message'],_0x390d9d);_0x50bdf8(_0x10ec4e[_0x49eb('0x16')](0x1f4,_0x470ca7[_0x49eb('0x18')]));});});};exports['ShowMailQueue']=function(_0x53a557){var _0x5b3ef1=this;return new Promise(function(_0x281b98,_0x1f5392){return db[_0x49eb('0x1b')][_0x49eb('0x25')]({'raw':_0x53a557[_0x49eb('0x1d')]?_0x53a557[_0x49eb('0x1d')][_0x49eb('0x1e')]===undefined?!![]:![]:!![],'where':_0x53a557[_0x49eb('0x1d')]?_0x53a557['options'][_0x49eb('0x1f')]||null:null,'attributes':_0x53a557['options']?_0x53a557[_0x49eb('0x1d')][_0x49eb('0x20')]||null:null,'include':_0x53a557[_0x49eb('0x1d')]?_0x53a557[_0x49eb('0x1d')][_0x49eb('0x21')]?_[_0x49eb('0x22')](_0x53a557[_0x49eb('0x1d')][_0x49eb('0x21')],function(_0x211fa9){return{'model':db[_0x211fa9['model']],'as':_0x211fa9['as'],'attributes':_0x211fa9[_0x49eb('0x20')],'include':_0x211fa9[_0x49eb('0x21')]?_['map'](_0x211fa9[_0x49eb('0x21')],function(_0x4345ed){return{'model':db[_0x4345ed[_0x49eb('0x23')]],'as':_0x4345ed['as'],'attributes':_0x4345ed[_0x49eb('0x20')],'include':_0x4345ed[_0x49eb('0x21')]?_['map'](_0x4345ed[_0x49eb('0x21')],function(_0x351c1f){return{'model':db[_0x351c1f['model']],'as':_0x351c1f['as'],'attributes':_0x351c1f[_0x49eb('0x20')]};}):[]};}):[]};}):[]:[]})[_0x49eb('0xf')](function(_0x291c02){logger[_0x49eb('0x10')](_0x49eb('0x26'),_0x53a557);logger[_0x49eb('0x13')](_0x49eb('0x26'),_0x53a557,JSON[_0x49eb('0x15')](_0x291c02));_0x281b98(_0x291c02);})[_0x49eb('0x24')](function(_0x5e0caf){logger[_0x49eb('0x16')]('ShowMailQueue',_0x5e0caf[_0x49eb('0x18')],_0x53a557);_0x1f5392(_0x5b3ef1[_0x49eb('0x16')](0x1f4,_0x5e0caf[_0x49eb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index b671bba..9e5eb18 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 _0x838f=['emit','removeListener','register','length','mailQueue:','./mailQueue.events','save','remove','update'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x838f,0x101));var _0xf838=function(_0x27d1be,_0x405f01){_0x27d1be=_0x27d1be-0x0;var _0x4195c7=_0x838f[_0x27d1be];return _0x4195c7;};'use strict';var MailQueueEvents=require(_0xf838('0x0'));var events=[_0xf838('0x1'),_0xf838('0x2'),_0xf838('0x3')];function createListener(_0x3569ac,_0xe3172f){return function(_0x110530){_0xe3172f[_0xf838('0x4')](_0x3569ac,_0x110530);};}function removeListener(_0x397247,_0x285cb4){return function(){MailQueueEvents[_0xf838('0x5')](_0x397247,_0x285cb4);};}exports[_0xf838('0x6')]=function(_0x5e1437){for(var _0x4a556f=0x0,_0x3c2c80=events[_0xf838('0x7')];_0x4a556f<_0x3c2c80;_0x4a556f++){var _0x31688b=events[_0x4a556f];var _0x5c534a=createListener(_0xf838('0x8')+_0x31688b,_0x5e1437);MailQueueEvents['on'](_0x31688b,_0x5c534a);}}; \ No newline at end of file +var _0x7e7b=['save','update','emit','removeListener','register','length','./mailQueue.events'];(function(_0x32defa,_0x5d25d8){var _0x4b2598=function(_0x228070){while(--_0x228070){_0x32defa['push'](_0x32defa['shift']());}};_0x4b2598(++_0x5d25d8);}(_0x7e7b,0x133));var _0xb7e7=function(_0x49fe93,_0x56eb06){_0x49fe93=_0x49fe93-0x0;var _0x3c0829=_0x7e7b[_0x49fe93];return _0x3c0829;};'use strict';var MailQueueEvents=require(_0xb7e7('0x0'));var events=[_0xb7e7('0x1'),'remove',_0xb7e7('0x2')];function createListener(_0x3c2af0,_0xd5f959){return function(_0x177dd4){_0xd5f959[_0xb7e7('0x3')](_0x3c2af0,_0x177dd4);};}function removeListener(_0x253534,_0x32ee0c){return function(){MailQueueEvents[_0xb7e7('0x4')](_0x253534,_0x32ee0c);};}exports[_0xb7e7('0x5')]=function(_0x4d4fa8){for(var _0x4c1ca6=0x0,_0x2c95f8=events[_0xb7e7('0x6')];_0x4c1ca6<_0x2c95f8;_0x4c1ca6++){var _0x15aee9=events[_0x4c1ca6];var _0x5b23b0=createListener('mailQueue:'+_0x15aee9,_0x4d4fa8);MailQueueEvents['on'](_0x15aee9,_0x5b23b0);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 06f26c6..a2dcfb9 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 _0xf044=['fs-extra','../../components/auth/service','../../components/interaction/service','./mailQueueReport.controller','get','describe','isAuthenticated','post','put','update','delete','multer','path','connect-timeout','express','Router'];(function(_0x23cd34,_0xe7e8f7){var _0x1e1e48=function(_0x820992){while(--_0x820992){_0x23cd34['push'](_0x23cd34['shift']());}};_0x1e1e48(++_0xe7e8f7);}(_0xf044,0xfb));var _0x4f04=function(_0x5c60c4,_0x5af476){_0x5c60c4=_0x5c60c4-0x0;var _0x4c804a=_0xf044[_0x5c60c4];return _0x4c804a;};'use strict';var multer=require(_0x4f04('0x0'));var util=require('util');var path=require(_0x4f04('0x1'));var timeout=require(_0x4f04('0x2'));var express=require(_0x4f04('0x3'));var router=express[_0x4f04('0x4')]();var fs_extra=require(_0x4f04('0x5'));var auth=require(_0x4f04('0x6'));var interaction=require(_0x4f04('0x7'));var config=require('../../config/environment');var controller=require(_0x4f04('0x8'));router[_0x4f04('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4f04('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x4f04('0xa')]);router[_0x4f04('0x9')]('/:id',auth[_0x4f04('0xb')](),controller['show']);router[_0x4f04('0xc')]('/',auth[_0x4f04('0xb')](),controller['create']);router[_0x4f04('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x4f04('0xe')]);router[_0x4f04('0xf')]('/:id',auth[_0x4f04('0xb')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xd2d1=['../../config/environment','get','isAuthenticated','index','describe','/:id','post','delete','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x1476e1,_0x5b336f){var _0x179065=function(_0x3a1ce2){while(--_0x3a1ce2){_0x1476e1['push'](_0x1476e1['shift']());}};_0x179065(++_0x5b336f);}(_0xd2d1,0x1c9));var _0x1d2d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd2d1[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x1d2d('0x0'));var util=require(_0x1d2d('0x1'));var path=require(_0x1d2d('0x2'));var timeout=require(_0x1d2d('0x3'));var express=require('express');var router=express[_0x1d2d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x1d2d('0x5'));var interaction=require(_0x1d2d('0x6'));var config=require(_0x1d2d('0x7'));var controller=require('./mailQueueReport.controller');router[_0x1d2d('0x8')]('/',auth[_0x1d2d('0x9')](),controller[_0x1d2d('0xa')]);router[_0x1d2d('0x8')]('/describe',auth[_0x1d2d('0x9')](),controller[_0x1d2d('0xb')]);router[_0x1d2d('0x8')](_0x1d2d('0xc'),auth[_0x1d2d('0x9')](),controller['show']);router[_0x1d2d('0xd')]('/',auth[_0x1d2d('0x9')](),controller['create']);router['put'](_0x1d2d('0xc'),auth[_0x1d2d('0x9')](),controller['update']);router[_0x1d2d('0xe')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x1d2d('0xf')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 19e7e19..68c28b7 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 _0xe7e4=['STRING','DATE','moment','exports'];(function(_0x30f8cb,_0x13648b){var _0x2f6f50=function(_0x1e794f){while(--_0x1e794f){_0x30f8cb['push'](_0x30f8cb['shift']());}};_0x2f6f50(++_0x13648b);}(_0xe7e4,0x1be));var _0x4e7e=function(_0x1bc972,_0x45fdff){_0x1bc972=_0x1bc972-0x0;var _0x1a1c70=_0xe7e4[_0x1bc972];return _0x1a1c70;};'use strict';var moment=require(_0x4e7e('0x0'));var Sequelize=require('sequelize');module[_0x4e7e('0x1')]={'uniqueid':{'type':Sequelize[_0x4e7e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x4e7e('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4e7e('0x3')]},'acceptAt':{'type':Sequelize[_0x4e7e('0x3')]},'exitAt':{'type':Sequelize[_0x4e7e('0x3')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdcd4=['moment','sequelize','exports','STRING','DATE'];(function(_0x427420,_0x49c42a){var _0x1dc96a=function(_0x814ec){while(--_0x814ec){_0x427420['push'](_0x427420['shift']());}};_0x1dc96a(++_0x49c42a);}(_0xdcd4,0x1b3));var _0x4dcd=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xdcd4[_0x3947c9];return _0x2e7871;};'use strict';var moment=require(_0x4dcd('0x0'));var Sequelize=require(_0x4dcd('0x1'));module[_0x4dcd('0x2')]={'uniqueid':{'type':Sequelize[_0x4dcd('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x4dcd('0x3')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x4dcd('0x4')]},'acceptAt':{'type':Sequelize[_0x4dcd('0x4')]},'exitAt':{'type':Sequelize[_0x4dcd('0x4')]},'reason':{'type':Sequelize[_0x4dcd('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index db13804..945f549 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 _0xc2c7=['merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','keys','find','params','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','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','limit','count','set','Content-Range','reject','save','update','destroy','then','error','name','send','index','map','MailQueueReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','where'];(function(_0x43a710,_0x482f5b){var _0x47e675=function(_0x5b49d0){while(--_0x5b49d0){_0x43a710['push'](_0x43a710['shift']());}};_0x47e675(++_0x482f5b);}(_0xc2c7,0x134));var _0x7c2c=function(_0x471c2d,_0x3d49c0){_0x471c2d=_0x471c2d-0x0;var _0x37e602=_0xc2c7[_0x471c2d];return _0x37e602;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7c2c('0x0'));var zipdir=require(_0x7c2c('0x1'));var jsonpatch=require(_0x7c2c('0x2'));var rp=require(_0x7c2c('0x3'));var moment=require(_0x7c2c('0x4'));var BPromise=require(_0x7c2c('0x5'));var Mustache=require(_0x7c2c('0x6'));var util=require(_0x7c2c('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x7c2c('0x8'));var ejs=require(_0x7c2c('0x9'));var fs=require('fs');var fs_extra=require(_0x7c2c('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x7c2c('0xb'));var deskjs=require(_0x7c2c('0xc'));var toCsv=require(_0x7c2c('0x8'));var querystring=require(_0x7c2c('0xd'));var Papa=require(_0x7c2c('0xe'));var Redis=require('ioredis');var authService=require(_0x7c2c('0xf'));var qs=require(_0x7c2c('0x10'));var as=require(_0x7c2c('0x11'));var hardwareService=require(_0x7c2c('0x12'));var logger=require(_0x7c2c('0x13'))(_0x7c2c('0x14'));var utils=require(_0x7c2c('0x15'));var config=require(_0x7c2c('0x16'));var licenseUtil=require(_0x7c2c('0x17'));var db=require(_0x7c2c('0x18'))['db'];function respondWithStatusCode(_0xae8441,_0x45847d){_0x45847d=_0x45847d||0xcc;return function(_0x68398a){if(_0x68398a){return _0xae8441[_0x7c2c('0x19')](_0x45847d);}return _0xae8441[_0x7c2c('0x1a')](_0x45847d)[_0x7c2c('0x1b')]();};}function respondWithResult(_0x4c4aaf,_0x5b5729){_0x5b5729=_0x5b5729||0xc8;return function(_0x102778){if(_0x102778){return _0x4c4aaf[_0x7c2c('0x1a')](_0x5b5729)[_0x7c2c('0x1c')](_0x102778);}};}function respondWithFilteredResult(_0x5ae94f,_0x11424c){return function(_0x206ecd){if(_0x206ecd){var _0x5e55e0=typeof _0x11424c[_0x7c2c('0x1d')]==='undefined'&&typeof _0x11424c[_0x7c2c('0x1e')]==='undefined';var _0x342ea2=_0x206ecd[_0x7c2c('0x1f')];var _0x14453f=_0x5e55e0?0x0:_0x11424c[_0x7c2c('0x1d')];var _0x17df4a=_0x5e55e0?_0x206ecd[_0x7c2c('0x1f')]:_0x11424c[_0x7c2c('0x1d')]+_0x11424c[_0x7c2c('0x1e')];var _0x2d356e;if(_0x17df4a>=_0x342ea2){_0x17df4a=_0x342ea2;_0x2d356e=0xc8;}else{_0x2d356e=0xce;}_0x5ae94f[_0x7c2c('0x1a')](_0x2d356e);return _0x5ae94f[_0x7c2c('0x20')](_0x7c2c('0x21'),_0x14453f+'-'+_0x17df4a+'/'+_0x342ea2)['json'](_0x206ecd);}return null;};}function patchUpdates(_0x1c5491){return function(_0x4adb62){try{jsonpatch['apply'](_0x4adb62,_0x1c5491,!![]);}catch(_0x15ae33){return BPromise[_0x7c2c('0x22')](_0x15ae33);}return _0x4adb62[_0x7c2c('0x23')]();};}function saveUpdates(_0x38ae30,_0x41552f){return function(_0x1883b5){if(_0x1883b5){return _0x1883b5[_0x7c2c('0x24')](_0x38ae30)['then'](function(_0x10c356){return _0x10c356;});}return null;};}function removeEntity(_0x4dedd8,_0x302c93){return function(_0x57f510){if(_0x57f510){return _0x57f510[_0x7c2c('0x25')]()[_0x7c2c('0x26')](function(){_0x4dedd8[_0x7c2c('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d6ec7,_0x31a50c){return function(_0x30c53e){if(!_0x30c53e){_0x4d6ec7[_0x7c2c('0x19')](0x194);}return _0x30c53e;};}function handleError(_0x150690,_0x31d8f3){_0x31d8f3=_0x31d8f3||0x1f4;return function(_0xa8e145){logger[_0x7c2c('0x27')](_0xa8e145['stack']);if(_0xa8e145[_0x7c2c('0x28')]){delete _0xa8e145[_0x7c2c('0x28')];}_0x150690[_0x7c2c('0x1a')](_0x31d8f3)[_0x7c2c('0x29')](_0xa8e145);};}exports[_0x7c2c('0x2a')]=function(_0x1f8846,_0xf2bfd1){var _0x26f472={},_0xa040ff={},_0x5769ec={'count':0x0,'rows':[]};var _0x465ad6=_[_0x7c2c('0x2b')](db[_0x7c2c('0x2c')][_0x7c2c('0x2d')],function(_0x53ad23){return{'name':_0x53ad23[_0x7c2c('0x2e')],'type':_0x53ad23[_0x7c2c('0x2f')][_0x7c2c('0x30')]};});_0xa040ff[_0x7c2c('0x31')]=_[_0x7c2c('0x2b')](_0x465ad6,_0x7c2c('0x28'));_0xa040ff[_0x7c2c('0x32')]=_['keys'](_0x1f8846[_0x7c2c('0x32')]);_0xa040ff[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0xa040ff[_0x7c2c('0x31')],_0xa040ff[_0x7c2c('0x32')]);_0x26f472['attributes']=_['intersection'](_0xa040ff[_0x7c2c('0x31')],qs['fields'](_0x1f8846['query'][_0x7c2c('0x35')]));_0x26f472[_0x7c2c('0x36')]=_0x26f472[_0x7c2c('0x36')][_0x7c2c('0x37')]?_0x26f472['attributes']:_0xa040ff[_0x7c2c('0x31')];if(!_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x38')](_0x7c2c('0x39'))){_0x26f472[_0x7c2c('0x1e')]=qs[_0x7c2c('0x1e')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1e')]);_0x26f472[_0x7c2c('0x1d')]=qs[_0x7c2c('0x1d')](_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x1d')]);}_0x26f472[_0x7c2c('0x3a')]=qs['sort'](_0x1f8846['query'][_0x7c2c('0x3b')]);_0x26f472['where']=qs['filters'](_['pick'](_0x1f8846[_0x7c2c('0x32')],_0xa040ff[_0x7c2c('0x33')]),_0x465ad6);if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]){_0x26f472[_0x7c2c('0x3d')]=_[_0x7c2c('0x3e')](_0x26f472[_0x7c2c('0x3d')],{'$or':_[_0x7c2c('0x2b')](_0x465ad6,function(_0x2b6520){if(_0x2b6520[_0x7c2c('0x2f')]!==_0x7c2c('0x3f')){var _0x58696a={};_0x58696a[_0x2b6520['name']]={'$like':'%'+_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x3c')]+'%'};return _0x58696a;}})});}_0x26f472=_[_0x7c2c('0x3e')]({},_0x26f472,_0x1f8846[_0x7c2c('0x40')]);var _0x5e8c96={'where':_0x26f472[_0x7c2c('0x3d')]};return db[_0x7c2c('0x2c')][_0x7c2c('0x1f')](_0x5e8c96)[_0x7c2c('0x26')](function(_0x18e288){_0x5769ec[_0x7c2c('0x1f')]=_0x18e288;if(_0x1f8846[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x26f472[_0x7c2c('0x42')]=[{'all':!![]}];}return db['MailQueueReport'][_0x7c2c('0x43')](_0x26f472);})['then'](function(_0x2c3f40){_0x5769ec[_0x7c2c('0x44')]=_0x2c3f40;return _0x5769ec;})['then'](respondWithFilteredResult(_0xf2bfd1,_0x26f472))[_0x7c2c('0x45')](handleError(_0xf2bfd1,null));};exports['show']=function(_0x3014fb,_0x33b2be){var _0x9b9813={'raw':!![],'where':{'id':_0x3014fb['params']['id']}},_0x26351e={};_0x26351e[_0x7c2c('0x31')]=_['keys'](db['MailQueueReport'][_0x7c2c('0x2d')]);_0x26351e[_0x7c2c('0x32')]=_[_0x7c2c('0x46')](_0x3014fb['query']);_0x26351e[_0x7c2c('0x33')]=_[_0x7c2c('0x34')](_0x26351e['model'],_0x26351e[_0x7c2c('0x32')]);_0x9b9813['attributes']=_[_0x7c2c('0x34')](_0x26351e[_0x7c2c('0x31')],qs['fields'](_0x3014fb['query'][_0x7c2c('0x35')]));_0x9b9813[_0x7c2c('0x36')]=_0x9b9813['attributes'][_0x7c2c('0x37')]?_0x9b9813['attributes']:_0x26351e['model'];if(_0x3014fb[_0x7c2c('0x32')][_0x7c2c('0x41')]){_0x9b9813[_0x7c2c('0x42')]=[{'all':!![]}];}_0x9b9813=_[_0x7c2c('0x3e')]({},_0x9b9813,_0x3014fb[_0x7c2c('0x40')]);return db[_0x7c2c('0x2c')][_0x7c2c('0x47')](_0x9b9813)[_0x7c2c('0x26')](handleEntityNotFound(_0x33b2be,null))[_0x7c2c('0x26')](respondWithResult(_0x33b2be,null))['catch'](handleError(_0x33b2be,null));};exports['create']=function(_0xeb067b,_0x3091bd){return db[_0x7c2c('0x2c')]['create'](_0xeb067b['body'],{})[_0x7c2c('0x26')](respondWithResult(_0x3091bd,0xc9))[_0x7c2c('0x45')](handleError(_0x3091bd,null));};exports[_0x7c2c('0x24')]=function(_0x2b79d5,_0x5f3de8){if(_0x2b79d5['body']['id']){delete _0x2b79d5['body']['id'];}return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x2b79d5[_0x7c2c('0x48')]['id']}})[_0x7c2c('0x26')](handleEntityNotFound(_0x5f3de8,null))[_0x7c2c('0x26')](saveUpdates(_0x2b79d5['body'],null))[_0x7c2c('0x26')](respondWithResult(_0x5f3de8,null))[_0x7c2c('0x45')](handleError(_0x5f3de8,null));};exports['destroy']=function(_0x19621a,_0x56e09d){return db[_0x7c2c('0x2c')][_0x7c2c('0x47')]({'where':{'id':_0x19621a[_0x7c2c('0x48')]['id']}})['then'](handleEntityNotFound(_0x56e09d,null))['then'](removeEntity(_0x56e09d,null))[_0x7c2c('0x45')](handleError(_0x56e09d,null));};exports['describe']=function(_0x13e0bf,_0x11d337){return db['MailQueueReport'][_0x7c2c('0x49')]()[_0x7c2c('0x26')](respondWithResult(_0x11d337,null))['catch'](handleError(_0x11d337,null));}; \ No newline at end of file +var _0xd4a2=['describe','eml-format','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','squel','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','end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','map','MailQueueReport','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','findAll','rows','catch','show','params','includeAll','include','find','create','body'];(function(_0x4e9a18,_0x1c5cab){var _0x435fd5=function(_0x284ec1){while(--_0x284ec1){_0x4e9a18['push'](_0x4e9a18['shift']());}};_0x435fd5(++_0x1c5cab);}(_0xd4a2,0x173));var _0x2d4a=function(_0x339dca,_0x2162dc){_0x339dca=_0x339dca-0x0;var _0x3f8047=_0xd4a2[_0x339dca];return _0x3f8047;};'use strict';var emlformat=require(_0x2d4a('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2d4a('0x1'));var rp=require('request-promise');var moment=require(_0x2d4a('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2d4a('0x3'));var util=require('util');var path=require(_0x2d4a('0x4'));var sox=require(_0x2d4a('0x5'));var csv=require(_0x2d4a('0x6'));var ejs=require(_0x2d4a('0x7'));var fs=require('fs');var fs_extra=require(_0x2d4a('0x8'));var _=require('lodash');var squel=require(_0x2d4a('0x9'));var crypto=require(_0x2d4a('0xa'));var jsforce=require(_0x2d4a('0xb'));var deskjs=require(_0x2d4a('0xc'));var toCsv=require(_0x2d4a('0x6'));var querystring=require(_0x2d4a('0xd'));var Papa=require(_0x2d4a('0xe'));var Redis=require(_0x2d4a('0xf'));var authService=require(_0x2d4a('0x10'));var qs=require(_0x2d4a('0x11'));var as=require(_0x2d4a('0x12'));var hardwareService=require(_0x2d4a('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x2d4a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x2d4a('0x15'));var db=require(_0x2d4a('0x16'))['db'];function respondWithStatusCode(_0x45b9fb,_0x5ac803){_0x5ac803=_0x5ac803||0xcc;return function(_0x2f785f){if(_0x2f785f){return _0x45b9fb[_0x2d4a('0x17')](_0x5ac803);}return _0x45b9fb[_0x2d4a('0x18')](_0x5ac803)[_0x2d4a('0x19')]();};}function respondWithResult(_0x544622,_0x4be8b4){_0x4be8b4=_0x4be8b4||0xc8;return function(_0x2a1d0f){if(_0x2a1d0f){return _0x544622['status'](_0x4be8b4)[_0x2d4a('0x1a')](_0x2a1d0f);}};}function respondWithFilteredResult(_0x175bda,_0x11896d){return function(_0x3a3156){if(_0x3a3156){var _0x4c5287=typeof _0x11896d[_0x2d4a('0x1b')]==='undefined'&&typeof _0x11896d[_0x2d4a('0x1c')]==='undefined';var _0x435687=_0x3a3156[_0x2d4a('0x1d')];var _0x2188b2=_0x4c5287?0x0:_0x11896d[_0x2d4a('0x1b')];var _0x498956=_0x4c5287?_0x3a3156['count']:_0x11896d['offset']+_0x11896d[_0x2d4a('0x1c')];var _0x1966d1;if(_0x498956>=_0x435687){_0x498956=_0x435687;_0x1966d1=0xc8;}else{_0x1966d1=0xce;}_0x175bda[_0x2d4a('0x18')](_0x1966d1);return _0x175bda[_0x2d4a('0x1e')](_0x2d4a('0x1f'),_0x2188b2+'-'+_0x498956+'/'+_0x435687)[_0x2d4a('0x1a')](_0x3a3156);}return null;};}function patchUpdates(_0x56445a){return function(_0x49f378){try{jsonpatch[_0x2d4a('0x20')](_0x49f378,_0x56445a,!![]);}catch(_0x1f3e17){return BPromise[_0x2d4a('0x21')](_0x1f3e17);}return _0x49f378[_0x2d4a('0x22')]();};}function saveUpdates(_0x1a2d20,_0x2e7736){return function(_0x22dd0b){if(_0x22dd0b){return _0x22dd0b[_0x2d4a('0x23')](_0x1a2d20)['then'](function(_0x26e7b8){return _0x26e7b8;});}return null;};}function removeEntity(_0x3240a2,_0x2c3799){return function(_0x42d813){if(_0x42d813){return _0x42d813[_0x2d4a('0x24')]()[_0x2d4a('0x25')](function(){_0x3240a2[_0x2d4a('0x18')](0xcc)[_0x2d4a('0x19')]();});}};}function handleEntityNotFound(_0x54c910,_0x544b9b){return function(_0x5cc7d8){if(!_0x5cc7d8){_0x54c910[_0x2d4a('0x17')](0x194);}return _0x5cc7d8;};}function handleError(_0x5029f3,_0x410f7d){_0x410f7d=_0x410f7d||0x1f4;return function(_0x3a2fd3){logger[_0x2d4a('0x26')](_0x3a2fd3[_0x2d4a('0x27')]);if(_0x3a2fd3[_0x2d4a('0x28')]){delete _0x3a2fd3[_0x2d4a('0x28')];}_0x5029f3[_0x2d4a('0x18')](_0x410f7d)[_0x2d4a('0x29')](_0x3a2fd3);};}exports['index']=function(_0x436f53,_0x5ce262){var _0x221602={},_0x9bac28={},_0xc497ce={'count':0x0,'rows':[]};var _0x20b87d=_[_0x2d4a('0x2a')](db[_0x2d4a('0x2b')][_0x2d4a('0x2c')],function(_0x2e8063){return{'name':_0x2e8063['fieldName'],'type':_0x2e8063[_0x2d4a('0x2d')][_0x2d4a('0x2e')]};});_0x9bac28[_0x2d4a('0x2f')]=_[_0x2d4a('0x2a')](_0x20b87d,_0x2d4a('0x28'));_0x9bac28['query']=_[_0x2d4a('0x30')](_0x436f53[_0x2d4a('0x31')]);_0x9bac28[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],_0x9bac28['query']);_0x221602[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x9bac28[_0x2d4a('0x2f')],qs[_0x2d4a('0x35')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x35')]));_0x221602['attributes']=_0x221602[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x221602[_0x2d4a('0x34')]:_0x9bac28[_0x2d4a('0x2f')];if(!_0x436f53[_0x2d4a('0x31')]['hasOwnProperty'](_0x2d4a('0x37'))){_0x221602[_0x2d4a('0x1c')]=qs['limit'](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1c')]);_0x221602[_0x2d4a('0x1b')]=qs[_0x2d4a('0x1b')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x1b')]);}_0x221602['order']=qs[_0x2d4a('0x38')](_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x38')]);_0x221602[_0x2d4a('0x39')]=qs[_0x2d4a('0x32')](_[_0x2d4a('0x3a')](_0x436f53['query'],_0x9bac28['filters']),_0x20b87d);if(_0x436f53[_0x2d4a('0x31')]['filter']){_0x221602[_0x2d4a('0x39')]=_[_0x2d4a('0x3b')](_0x221602['where'],{'$or':_[_0x2d4a('0x2a')](_0x20b87d,function(_0x275598){if(_0x275598[_0x2d4a('0x2d')]!==_0x2d4a('0x3c')){var _0x67bce3={};_0x67bce3[_0x275598[_0x2d4a('0x28')]]={'$like':'%'+_0x436f53[_0x2d4a('0x31')][_0x2d4a('0x3d')]+'%'};return _0x67bce3;}})});}_0x221602=_[_0x2d4a('0x3b')]({},_0x221602,_0x436f53[_0x2d4a('0x3e')]);var _0x3bb0cc={'where':_0x221602['where']};return db[_0x2d4a('0x2b')][_0x2d4a('0x1d')](_0x3bb0cc)[_0x2d4a('0x25')](function(_0x2f1635){_0xc497ce[_0x2d4a('0x1d')]=_0x2f1635;if(_0x436f53['query']['includeAll']){_0x221602['include']=[{'all':!![]}];}return db['MailQueueReport'][_0x2d4a('0x3f')](_0x221602);})[_0x2d4a('0x25')](function(_0xf39020){_0xc497ce[_0x2d4a('0x40')]=_0xf39020;return _0xc497ce;})['then'](respondWithFilteredResult(_0x5ce262,_0x221602))[_0x2d4a('0x41')](handleError(_0x5ce262,null));};exports[_0x2d4a('0x42')]=function(_0x5e9704,_0x189d2a){var _0x13b0f0={'raw':!![],'where':{'id':_0x5e9704[_0x2d4a('0x43')]['id']}},_0x8a9375={};_0x8a9375[_0x2d4a('0x2f')]=_[_0x2d4a('0x30')](db['MailQueueReport'][_0x2d4a('0x2c')]);_0x8a9375[_0x2d4a('0x31')]=_[_0x2d4a('0x30')](_0x5e9704[_0x2d4a('0x31')]);_0x8a9375[_0x2d4a('0x32')]=_[_0x2d4a('0x33')](_0x8a9375['model'],_0x8a9375[_0x2d4a('0x31')]);_0x13b0f0[_0x2d4a('0x34')]=_[_0x2d4a('0x33')](_0x8a9375['model'],qs[_0x2d4a('0x35')](_0x5e9704['query'][_0x2d4a('0x35')]));_0x13b0f0[_0x2d4a('0x34')]=_0x13b0f0[_0x2d4a('0x34')][_0x2d4a('0x36')]?_0x13b0f0[_0x2d4a('0x34')]:_0x8a9375['model'];if(_0x5e9704['query'][_0x2d4a('0x44')]){_0x13b0f0[_0x2d4a('0x45')]=[{'all':!![]}];}_0x13b0f0=_['merge']({},_0x13b0f0,_0x5e9704[_0x2d4a('0x3e')]);return db['MailQueueReport'][_0x2d4a('0x46')](_0x13b0f0)[_0x2d4a('0x25')](handleEntityNotFound(_0x189d2a,null))[_0x2d4a('0x25')](respondWithResult(_0x189d2a,null))['catch'](handleError(_0x189d2a,null));};exports[_0x2d4a('0x47')]=function(_0x541b93,_0x3806b8){return db[_0x2d4a('0x2b')][_0x2d4a('0x47')](_0x541b93[_0x2d4a('0x48')],{})[_0x2d4a('0x25')](respondWithResult(_0x3806b8,0xc9))[_0x2d4a('0x41')](handleError(_0x3806b8,null));};exports[_0x2d4a('0x23')]=function(_0x2b2f4b,_0x1ffb96){if(_0x2b2f4b[_0x2d4a('0x48')]['id']){delete _0x2b2f4b[_0x2d4a('0x48')]['id'];}return db['MailQueueReport'][_0x2d4a('0x46')]({'where':{'id':_0x2b2f4b[_0x2d4a('0x43')]['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x1ffb96,null))[_0x2d4a('0x25')](saveUpdates(_0x2b2f4b[_0x2d4a('0x48')],null))['then'](respondWithResult(_0x1ffb96,null))[_0x2d4a('0x41')](handleError(_0x1ffb96,null));};exports[_0x2d4a('0x24')]=function(_0x2123e8,_0x440625){return db[_0x2d4a('0x2b')]['find']({'where':{'id':_0x2123e8['params']['id']}})[_0x2d4a('0x25')](handleEntityNotFound(_0x440625,null))[_0x2d4a('0x25')](removeEntity(_0x440625,null))['catch'](handleError(_0x440625,null));};exports[_0x2d4a('0x49')]=function(_0x33f413,_0x7f0807){return db[_0x2d4a('0x2b')]['describe']()[_0x2d4a('0x25')](respondWithResult(_0x7f0807,null))['catch'](handleError(_0x7f0807,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index 43a7fda..38a0f70 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 _0x97a1=['bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes','exports','define','report_mail_queue','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x15fbb1,_0x7e3c8c){var _0x34f2f3=function(_0x1474bb){while(--_0x1474bb){_0x15fbb1['push'](_0x15fbb1['shift']());}};_0x34f2f3(++_0x7e3c8c);}(_0x97a1,0x1e6));var _0x197a=function(_0x120ba8,_0x3b935d){_0x120ba8=_0x120ba8-0x0;var _0x561489=_0x97a1[_0x120ba8];return _0x561489;};'use strict';var _=require(_0x197a('0x0'));var util=require('util');var logger=require(_0x197a('0x1'))(_0x197a('0x2'));var moment=require(_0x197a('0x3'));var BPromise=require(_0x197a('0x4'));var rp=require(_0x197a('0x5'));var fs=require('fs');var path=require(_0x197a('0x6'));var rimraf=require(_0x197a('0x7'));var config=require(_0x197a('0x8'));var attributes=require(_0x197a('0x9'));module[_0x197a('0xa')]=function(_0x5a2eb7,_0x2c2e84){return _0x5a2eb7[_0x197a('0xb')]('MailQueueReport',attributes,{'tableName':_0x197a('0xc'),'paranoid':![],'indexes':[{'name':_0x197a('0xd'),'fields':[_0x197a('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdca4=['request-promise','path','rimraf','../../config/environment','exports','MailQueueReport','uniqueid','lodash','util','../../config/logger','api','moment'];(function(_0x28019c,_0x67743){var _0x48ca39=function(_0x4c161e){while(--_0x4c161e){_0x28019c['push'](_0x28019c['shift']());}};_0x48ca39(++_0x67743);}(_0xdca4,0x157));var _0x4dca=function(_0xb032f2,_0xd1c4b5){_0xb032f2=_0xb032f2-0x0;var _0xd8b418=_0xdca4[_0xb032f2];return _0xd8b418;};'use strict';var _=require(_0x4dca('0x0'));var util=require(_0x4dca('0x1'));var logger=require(_0x4dca('0x2'))(_0x4dca('0x3'));var moment=require(_0x4dca('0x4'));var BPromise=require('bluebird');var rp=require(_0x4dca('0x5'));var fs=require('fs');var path=require(_0x4dca('0x6'));var rimraf=require(_0x4dca('0x7'));var config=require(_0x4dca('0x8'));var attributes=require('./mailQueueReport.attributes');module[_0x4dca('0x9')]=function(_0x45e9d7,_0x4cb53d){return _0x45e9d7['define'](_0x4dca('0xa'),attributes,{'tableName':'report_mail_queue','paranoid':![],'indexes':[{'name':_0x4dca('0xb'),'fields':[_0x4dca('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index 92a9bb4..314187d 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 _0xc4aa=['create','body','options','raw','update','where','attributes','limit','UpdateMailQueueReport','stringify','lodash','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','CreateMailQueueReport','MailQueueReport'];(function(_0xa9fc09,_0x28b096){var _0x462b0a=function(_0x22d8a2){while(--_0x22d8a2){_0xa9fc09['push'](_0xa9fc09['shift']());}};_0x462b0a(++_0x28b096);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc4aa[_0x2641f9];return _0x585741;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});}exports[_0xac4a('0x15')]=function(_0x28e304){var _0x44ec59=this;return new Promise(function(_0x546c5d,_0x5ac21e){return db[_0xac4a('0x16')][_0xac4a('0x17')](_0x28e304[_0xac4a('0x18')],{'raw':_0x28e304['options']?_0x28e304[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![]})[_0xac4a('0xc')](function(_0x3a3cdb){logger[_0xac4a('0x13')](_0xac4a('0x15'),_0x28e304);logger[_0xac4a('0xf')](_0xac4a('0x15'),_0x28e304,JSON['stringify'](_0x3a3cdb));_0x546c5d(_0x3a3cdb);})[_0xac4a('0x14')](function(_0x3204ad){logger['error'](_0xac4a('0x15'),_0x3204ad[_0xac4a('0x12')],_0x28e304);_0x5ac21e(_0x44ec59[_0xac4a('0x10')](0x1f4,_0x3204ad[_0xac4a('0x12')]));});});};exports['UpdateMailQueueReport']=function(_0x1b7998){var _0x2503d8=this;return new Promise(function(_0x15435c,_0x412494){return db[_0xac4a('0x16')][_0xac4a('0x1b')](_0x1b7998[_0xac4a('0x18')],{'raw':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1c')]||null:null,'attributes':_0x1b7998[_0xac4a('0x19')]?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1d')]||null:null,'limit':_0x1b7998['options']?_0x1b7998[_0xac4a('0x19')][_0xac4a('0x1e')]||null:null})[_0xac4a('0xc')](function(_0x2772fe){logger[_0xac4a('0x13')]('UpdateMailQueueReport',_0x1b7998);logger['debug'](_0xac4a('0x1f'),_0x1b7998,JSON[_0xac4a('0x20')](_0x2772fe));_0x15435c(_0x2772fe);})[_0xac4a('0x14')](function(_0x546b65){logger['error'](_0xac4a('0x1f'),_0x546b65[_0xac4a('0x12')],_0x1b7998);_0x412494(_0x2503d8[_0xac4a('0x10')](0x1f4,_0x546b65[_0xac4a('0x12')]));});});}; \ No newline at end of file +var _0xdb28=['UpdateMailQueueReport','MailQueueReport','update','raw','where','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','MailQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','CreateMailQueueReport','create','body','options'];(function(_0x4834c7,_0x320620){var _0x597940=function(_0x58ece4){while(--_0x58ece4){_0x4834c7['push'](_0x4834c7['shift']());}};_0x597940(++_0x320620);}(_0xdb28,0x106));var _0x8db2=function(_0x4b28e2,_0x35cb78){_0x4b28e2=_0x4b28e2-0x0;var _0x40e1d8=_0xdb28[_0x4b28e2];return _0x40e1d8;};'use strict';var _=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));var BPromise=require(_0x8db2('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8db2('0x4'));var db=require(_0x8db2('0x5'))['db'];var utils=require(_0x8db2('0x6'));var logger=require(_0x8db2('0x7'))(_0x8db2('0x8'));var config=require('../../config/environment');var jayson=require(_0x8db2('0x9'));var client=jayson[_0x8db2('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x494b40,_0x477f50,_0x46932f){return new BPromise(function(_0x131537,_0x29f698){return client[_0x8db2('0xb')](_0x494b40,_0x46932f)[_0x8db2('0xc')](function(_0x126c78){logger['info'](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));logger[_0x8db2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x477f50,_0x8db2('0xe'),JSON[_0x8db2('0x10')](_0x126c78));if(_0x126c78['error']){if(_0x126c78[_0x8db2('0x11')][_0x8db2('0x12')]===0x1f4){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')]['message']);return _0x29f698(_0x126c78['error'][_0x8db2('0x13')]);}logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);return _0x131537(_0x126c78[_0x8db2('0x11')][_0x8db2('0x13')]);}else{logger[_0x8db2('0x14')](_0x8db2('0xd'),_0x477f50,_0x8db2('0xe'));_0x131537(_0x126c78['result'][_0x8db2('0x13')]);}})[_0x8db2('0x15')](function(_0x48101e){logger[_0x8db2('0x11')](_0x8db2('0xd'),_0x477f50,_0x48101e);_0x29f698(_0x48101e);});});}exports[_0x8db2('0x16')]=function(_0x3fddc2){var _0x2efd06=this;return new Promise(function(_0x46ce14,_0x51d60d){return db['MailQueueReport'][_0x8db2('0x17')](_0x3fddc2[_0x8db2('0x18')],{'raw':_0x3fddc2[_0x8db2('0x19')]?_0x3fddc2[_0x8db2('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x8db2('0xc')](function(_0x36a9ff){logger[_0x8db2('0x14')](_0x8db2('0x16'),_0x3fddc2);logger[_0x8db2('0xf')]('CreateMailQueueReport',_0x3fddc2,JSON[_0x8db2('0x10')](_0x36a9ff));_0x46ce14(_0x36a9ff);})[_0x8db2('0x15')](function(_0x18f69c){logger[_0x8db2('0x11')](_0x8db2('0x16'),_0x18f69c[_0x8db2('0x13')],_0x3fddc2);_0x51d60d(_0x2efd06[_0x8db2('0x11')](0x1f4,_0x18f69c['message']));});});};exports[_0x8db2('0x1a')]=function(_0x4f6516){var _0x5725f0=this;return new Promise(function(_0x52a9ca,_0x4d923c){return db[_0x8db2('0x1b')][_0x8db2('0x1c')](_0x4f6516[_0x8db2('0x18')],{'raw':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4f6516['options']?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1e')]||null:null,'attributes':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')]['attributes']||null:null,'limit':_0x4f6516[_0x8db2('0x19')]?_0x4f6516[_0x8db2('0x19')][_0x8db2('0x1f')]||null:null})[_0x8db2('0xc')](function(_0xbe5ece){logger[_0x8db2('0x14')](_0x8db2('0x1a'),_0x4f6516);logger[_0x8db2('0xf')](_0x8db2('0x1a'),_0x4f6516,JSON['stringify'](_0xbe5ece));_0x52a9ca(_0xbe5ece);})[_0x8db2('0x15')](function(_0x50b28d){logger['error'](_0x8db2('0x1a'),_0x50b28d[_0x8db2('0x13')],_0x4f6516);_0x4d923c(_0x5725f0[_0x8db2('0x11')](0x1f4,_0x50b28d['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index f664f5e..7287e98 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x514719,_0x1e7f0b){var _0x3a28c0=function(_0x2c6eda){while(--_0x2c6eda){_0x514719['push'](_0x514719['shift']());}};_0x3a28c0(++_0x1e7f0b);}(_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'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x392ef1,_0x214a1b){var _0x32de3c=function(_0x4bbd3b){while(--_0x4bbd3b){_0x392ef1['push'](_0x392ef1['shift']());}};_0x32de3c(++_0x214a1b);}(_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'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 4ab5367..f97004b 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 _0xde2c=['INBOX','sequelize','exports','STRING','BOOLEAN','INTEGER'];(function(_0x185f7f,_0x42aa8b){var _0x15d436=function(_0x581235){while(--_0x581235){_0x185f7f['push'](_0x185f7f['shift']());}};_0x15d436(++_0x42aa8b);}(_0xde2c,0x7f));var _0xcde2=function(_0x3430aa,_0x57cd92){_0x3430aa=_0x3430aa-0x0;var _0x2ac5c=_0xde2c[_0x3430aa];return _0x2ac5c;};'use strict';var Sequelize=require(_0xcde2('0x0'));module[_0xcde2('0x1')]={'description':{'type':Sequelize[_0xcde2('0x2')]},'host':{'type':Sequelize[_0xcde2('0x2')]},'authentication':{'type':Sequelize[_0xcde2('0x3')],'defaultValue':!![]},'user':{'type':Sequelize[_0xcde2('0x2')]},'password':{'type':Sequelize[_0xcde2('0x2')]},'port':{'type':Sequelize[_0xcde2('0x4')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xcde2('0x2')],'defaultValue':_0xcde2('0x5')},'connTimeout':{'type':Sequelize[_0xcde2('0x4')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xcde2('0x4')],'defaultValue':0x5},'service':{'type':Sequelize[_0xcde2('0x2')]}}; \ No newline at end of file +var _0x3f8c=['BOOLEAN','INTEGER','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x3f8c,0x104));var _0xc3f8=function(_0x5577b4,_0x542555){_0x5577b4=_0x5577b4-0x0;var _0x5325c9=_0x3f8c[_0x5577b4];return _0x5325c9;};'use strict';var Sequelize=require('sequelize');module['exports']={'description':{'type':Sequelize[_0xc3f8('0x0')]},'host':{'type':Sequelize[_0xc3f8('0x0')]},'authentication':{'type':Sequelize[_0xc3f8('0x1')],'defaultValue':!![]},'user':{'type':Sequelize[_0xc3f8('0x0')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize['INTEGER']},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0xc3f8('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xc3f8('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xc3f8('0x0')]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 00c87a2..55607ba 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 _0x9596=['mail_servers_in','lodash','util','../../config/logger','moment','bluebird','request-promise','rimraf','./mailServerIn.attributes','exports','define','MailServerIn'];(function(_0x498c71,_0x36155d){var _0x5cf10e=function(_0x23b726){while(--_0x23b726){_0x498c71['push'](_0x498c71['shift']());}};_0x5cf10e(++_0x36155d);}(_0x9596,0xe5));var _0x6959=function(_0x2f6541,_0x363cba){_0x2f6541=_0x2f6541-0x0;var _0x4d76d8=_0x9596[_0x2f6541];return _0x4d76d8;};'use strict';var _=require(_0x6959('0x0'));var util=require(_0x6959('0x1'));var logger=require(_0x6959('0x2'))('api');var moment=require(_0x6959('0x3'));var BPromise=require(_0x6959('0x4'));var rp=require(_0x6959('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6959('0x6'));var config=require('../../config/environment');var attributes=require(_0x6959('0x7'));module[_0x6959('0x8')]=function(_0x5c7dfb,_0x52d082){return _0x5c7dfb[_0x6959('0x9')](_0x6959('0xa'),attributes,{'tableName':_0x6959('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd2ff=['path','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x346e59,_0x151c35){var _0x19a8d4=function(_0x5d8b29){while(--_0x5d8b29){_0x346e59['push'](_0x346e59['shift']());}};_0x19a8d4(++_0x151c35);}(_0xd2ff,0xf5));var _0xfd2f=function(_0x479b7f,_0xea0473){_0x479b7f=_0x479b7f-0x0;var _0x426910=_0xd2ff[_0x479b7f];return _0x426910;};'use strict';var _=require(_0xfd2f('0x0'));var util=require('util');var logger=require(_0xfd2f('0x1'))(_0xfd2f('0x2'));var moment=require('moment');var BPromise=require(_0xfd2f('0x3'));var rp=require(_0xfd2f('0x4'));var fs=require('fs');var path=require(_0xfd2f('0x5'));var rimraf=require('rimraf');var config=require(_0xfd2f('0x6'));var attributes=require(_0xfd2f('0x7'));module['exports']=function(_0x3cf6c6,_0x301290){return _0x3cf6c6['define'](_0xfd2f('0x8'),attributes,{'tableName':_0xfd2f('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 76ee94c..52885cd 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 _0xc437=['MailServerIn,\x20%s,\x20%s','message','result','GetMailServerIn','findAll','options','where','attributes','limit','include','model','map','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','then','info','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x670fe3,_0x5cdf81){var _0x35a043=function(_0x90ec7){while(--_0x90ec7){_0x670fe3['push'](_0x670fe3['shift']());}};_0x35a043(++_0x5cdf81);}(_0xc437,0xca));var _0x7c43=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xc437[_0x2641f9];return _0x585741;};'use strict';var _=require(_0x7c43('0x0'));var util=require('util');var moment=require(_0x7c43('0x1'));var BPromise=require(_0x7c43('0x2'));var rs=require(_0x7c43('0x3'));var fs=require('fs');var Redis=require(_0x7c43('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x7c43('0x5'))('rpc');var config=require(_0x7c43('0x6'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x15b778,_0x2f3d10,_0xafcb6c){return new BPromise(function(_0x711476,_0x3a6257){return client['request'](_0x15b778,_0xafcb6c)[_0x7c43('0x7')](function(_0x41f79b){logger[_0x7c43('0x8')]('MailServerIn,\x20%s,\x20%s',_0x2f3d10,'request\x20sent');logger[_0x7c43('0x9')](_0x7c43('0xa'),_0x2f3d10,_0x7c43('0xb'),JSON[_0x7c43('0xc')](_0x41f79b));if(_0x41f79b[_0x7c43('0xd')]){if(_0x41f79b[_0x7c43('0xd')]['code']===0x1f4){logger[_0x7c43('0xd')](_0x7c43('0xe'),_0x2f3d10,_0x41f79b[_0x7c43('0xd')][_0x7c43('0xf')]);return _0x3a6257(_0x41f79b['error'][_0x7c43('0xf')]);}logger[_0x7c43('0xd')](_0x7c43('0xe'),_0x2f3d10,_0x41f79b[_0x7c43('0xd')][_0x7c43('0xf')]);return _0x711476(_0x41f79b['error']['message']);}else{logger['info']('MailServerIn,\x20%s,\x20%s',_0x2f3d10,_0x7c43('0xb'));_0x711476(_0x41f79b[_0x7c43('0x10')][_0x7c43('0xf')]);}})['catch'](function(_0x384986){logger['error']('MailServerIn,\x20%s,\x20%s',_0x2f3d10,_0x384986);_0x3a6257(_0x384986);});});}exports[_0x7c43('0x11')]=function(_0x556084){var _0xc8cff=this;return new Promise(function(_0x2c0312,_0x5ab8cf){return db['MailServerIn'][_0x7c43('0x12')]({'raw':_0x556084[_0x7c43('0x13')]?_0x556084[_0x7c43('0x13')]['raw']===undefined?!![]:![]:!![],'where':_0x556084[_0x7c43('0x13')]?_0x556084[_0x7c43('0x13')][_0x7c43('0x14')]||null:null,'attributes':_0x556084[_0x7c43('0x13')]?_0x556084['options'][_0x7c43('0x15')]||null:null,'limit':_0x556084[_0x7c43('0x13')]?_0x556084[_0x7c43('0x13')][_0x7c43('0x16')]||null:null,'include':_0x556084[_0x7c43('0x13')]?_0x556084[_0x7c43('0x13')][_0x7c43('0x17')]?_['map'](_0x556084[_0x7c43('0x13')][_0x7c43('0x17')],function(_0x1cec4d){return{'model':db[_0x1cec4d[_0x7c43('0x18')]],'as':_0x1cec4d['as'],'attributes':_0x1cec4d['attributes'],'include':_0x1cec4d[_0x7c43('0x17')]?_['map'](_0x1cec4d[_0x7c43('0x17')],function(_0xa08b52){return{'model':db[_0xa08b52[_0x7c43('0x18')]],'as':_0xa08b52['as'],'attributes':_0xa08b52[_0x7c43('0x15')],'include':_0xa08b52[_0x7c43('0x17')]?_[_0x7c43('0x19')](_0xa08b52[_0x7c43('0x17')],function(_0x33cd38){return{'model':db[_0x33cd38[_0x7c43('0x18')]],'as':_0x33cd38['as'],'attributes':_0x33cd38[_0x7c43('0x15')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x15f9d3){logger[_0x7c43('0x8')](_0x7c43('0x11'),_0x556084);logger[_0x7c43('0x9')]('GetMailServerIn',_0x556084,JSON[_0x7c43('0xc')](_0x15f9d3));_0x2c0312(_0x15f9d3);})[_0x7c43('0x1a')](function(_0x546b80){logger[_0x7c43('0xd')](_0x7c43('0x11'),_0x546b80[_0x7c43('0xf')],_0x556084);_0x5ab8cf(_0xc8cff[_0x7c43('0xd')](0x1f4,_0x546b80[_0x7c43('0xf')]));});});}; \ No newline at end of file +var _0x3066=['model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','MailServerIn,\x20%s,\x20%s','request\x20sent','MailServerIn,\x20%s,\x20%s,\x20%s','error','code','message','catch','GetMailServerIn','findAll','options','where','attributes','limit','include','map'];(function(_0x3445e2,_0x2392a1){var _0x47d317=function(_0x1321a6){while(--_0x1321a6){_0x3445e2['push'](_0x3445e2['shift']());}};_0x47d317(++_0x2392a1);}(_0x3066,0x156));var _0x6306=function(_0x536bcd,_0x56e238){_0x536bcd=_0x536bcd-0x0;var _0x5bc588=_0x3066[_0x536bcd];return _0x5bc588;};'use strict';var _=require(_0x6306('0x0'));var util=require(_0x6306('0x1'));var moment=require(_0x6306('0x2'));var BPromise=require(_0x6306('0x3'));var rs=require(_0x6306('0x4'));var fs=require('fs');var Redis=require(_0x6306('0x5'));var db=require(_0x6306('0x6'))['db'];var utils=require(_0x6306('0x7'));var logger=require(_0x6306('0x8'))(_0x6306('0x9'));var config=require(_0x6306('0xa'));var jayson=require(_0x6306('0xb'));var client=jayson[_0x6306('0xc')][_0x6306('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x395702,_0xf664c5,_0x1c7f3e){return new BPromise(function(_0x5ea79d,_0x1e07a2){return client[_0x6306('0xe')](_0x395702,_0x1c7f3e)[_0x6306('0xf')](function(_0x24f586){logger[_0x6306('0x10')](_0x6306('0x11'),_0xf664c5,_0x6306('0x12'));logger['debug'](_0x6306('0x13'),_0xf664c5,_0x6306('0x12'),JSON['stringify'](_0x24f586));if(_0x24f586[_0x6306('0x14')]){if(_0x24f586[_0x6306('0x14')][_0x6306('0x15')]===0x1f4){logger[_0x6306('0x14')](_0x6306('0x11'),_0xf664c5,_0x24f586[_0x6306('0x14')][_0x6306('0x16')]);return _0x1e07a2(_0x24f586[_0x6306('0x14')][_0x6306('0x16')]);}logger['error'](_0x6306('0x11'),_0xf664c5,_0x24f586['error'][_0x6306('0x16')]);return _0x5ea79d(_0x24f586[_0x6306('0x14')][_0x6306('0x16')]);}else{logger[_0x6306('0x10')](_0x6306('0x11'),_0xf664c5,_0x6306('0x12'));_0x5ea79d(_0x24f586['result'][_0x6306('0x16')]);}})[_0x6306('0x17')](function(_0x43e88a){logger[_0x6306('0x14')]('MailServerIn,\x20%s,\x20%s',_0xf664c5,_0x43e88a);_0x1e07a2(_0x43e88a);});});}exports[_0x6306('0x18')]=function(_0x11a3bd){var _0x125f05=this;return new Promise(function(_0x1246dd,_0x43b775){return db['MailServerIn'][_0x6306('0x19')]({'raw':_0x11a3bd[_0x6306('0x1a')]?_0x11a3bd['options']['raw']===undefined?!![]:![]:!![],'where':_0x11a3bd[_0x6306('0x1a')]?_0x11a3bd[_0x6306('0x1a')][_0x6306('0x1b')]||null:null,'attributes':_0x11a3bd[_0x6306('0x1a')]?_0x11a3bd[_0x6306('0x1a')][_0x6306('0x1c')]||null:null,'limit':_0x11a3bd[_0x6306('0x1a')]?_0x11a3bd['options'][_0x6306('0x1d')]||null:null,'include':_0x11a3bd['options']?_0x11a3bd[_0x6306('0x1a')][_0x6306('0x1e')]?_['map'](_0x11a3bd[_0x6306('0x1a')]['include'],function(_0x47236a){return{'model':db[_0x47236a['model']],'as':_0x47236a['as'],'attributes':_0x47236a[_0x6306('0x1c')],'include':_0x47236a[_0x6306('0x1e')]?_[_0x6306('0x1f')](_0x47236a[_0x6306('0x1e')],function(_0x341abe){return{'model':db[_0x341abe[_0x6306('0x20')]],'as':_0x341abe['as'],'attributes':_0x341abe['attributes'],'include':_0x341abe[_0x6306('0x1e')]?_[_0x6306('0x1f')](_0x341abe[_0x6306('0x1e')],function(_0x54f524){return{'model':db[_0x54f524['model']],'as':_0x54f524['as'],'attributes':_0x54f524[_0x6306('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4144b9){logger[_0x6306('0x10')](_0x6306('0x18'),_0x11a3bd);logger[_0x6306('0x21')](_0x6306('0x18'),_0x11a3bd,JSON['stringify'](_0x4144b9));_0x1246dd(_0x4144b9);})[_0x6306('0x17')](function(_0xbd8fcd){logger[_0x6306('0x14')](_0x6306('0x18'),_0xbd8fcd[_0x6306('0x16')],_0x11a3bd);_0x43b775(_0x125f05['error'](0x1f4,_0xbd8fcd['message']));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index e99f8a5..a5766c4 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 _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x7a54,0x106));var _0x47a5=function(_0x1de4f8,_0x372cc6){_0x1de4f8=_0x1de4f8-0x0;var _0x3f1695=_0x7a54[_0x1de4f8];return _0x3f1695;};'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 _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailServerOut.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x550d12,_0x5384bd){var _0x12103d=function(_0x2a9834){while(--_0x2a9834){_0x550d12['push'](_0x550d12['shift']());}};_0x12103d(++_0x5384bd);}(_0x9957,0x93));var _0x7995=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x9957[_0x1facfa];return _0x9ec701;};'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')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 429451b..3c182ce 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 _0x8fc3=['BOOLEAN','sequelize','exports','STRING','INTEGER'];(function(_0x9e0acd,_0x360233){var _0x49c678=function(_0xfa7895){while(--_0xfa7895){_0x9e0acd['push'](_0x9e0acd['shift']());}};_0x49c678(++_0x360233);}(_0x8fc3,0xc4));var _0x38fc=function(_0x39d39d,_0x5586bd){_0x39d39d=_0x39d39d-0x0;var _0x577ac3=_0x8fc3[_0x39d39d];return _0x577ac3;};'use strict';var Sequelize=require(_0x38fc('0x0'));module[_0x38fc('0x1')]={'description':{'type':Sequelize[_0x38fc('0x2')]},'host':{'type':Sequelize[_0x38fc('0x2')]},'user':{'type':Sequelize[_0x38fc('0x2')]},'pass':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x38fc('0x3')]},'secure':{'type':Sequelize[_0x38fc('0x4')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file +var _0x5ff4=['STRING','INTEGER','BOOLEAN','sequelize','exports'];(function(_0x267218,_0x14e2b6){var _0x4bad68=function(_0x36af4f){while(--_0x36af4f){_0x267218['push'](_0x267218['shift']());}};_0x4bad68(++_0x14e2b6);}(_0x5ff4,0x125));var _0x45ff=function(_0xaa1b3e,_0x47d976){_0xaa1b3e=_0xaa1b3e-0x0;var _0x454d7d=_0x5ff4[_0xaa1b3e];return _0x454d7d;};'use strict';var Sequelize=require(_0x45ff('0x0'));module[_0x45ff('0x1')]={'description':{'type':Sequelize[_0x45ff('0x2')]},'host':{'type':Sequelize['STRING']},'user':{'type':Sequelize[_0x45ff('0x2')]},'pass':{'type':Sequelize[_0x45ff('0x2')]},'port':{'type':Sequelize[_0x45ff('0x3')]},'secure':{'type':Sequelize[_0x45ff('0x4')],'defaultValue':![]},'service':{'type':Sequelize[_0x45ff('0x2')]},'authentication':{'type':Sequelize[_0x45ff('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 26c5eb2..959ea6e 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 _0xf702=['params','includeAll','create','body','find','eml-format','fast-json-patch','moment','mustache','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','end','status','json','offset','undefined','limit','count','reject','save','update','then','destroy','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailServerOut','include','findAll','rows','catch','show'];(function(_0x283c87,_0x545688){var _0xde4143=function(_0x187b8d){while(--_0x187b8d){_0x283c87['push'](_0x283c87['shift']());}};_0xde4143(++_0x545688);}(_0xf702,0xdd));var _0x2f70=function(_0x51dd6b,_0x4c85c2){_0x51dd6b=_0x51dd6b-0x0;var _0x5aedb8=_0xf702[_0x51dd6b];return _0x5aedb8;};'use strict';var emlformat=require(_0x2f70('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2f70('0x1'));var rp=require('request-promise');var moment=require(_0x2f70('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x2f70('0x3'));var util=require('util');var path=require(_0x2f70('0x4'));var sox=require(_0x2f70('0x5'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f70('0x6'));var _=require(_0x2f70('0x7'));var squel=require(_0x2f70('0x8'));var crypto=require(_0x2f70('0x9'));var jsforce=require(_0x2f70('0xa'));var deskjs=require(_0x2f70('0xb'));var toCsv=require(_0x2f70('0xc'));var querystring=require(_0x2f70('0xd'));var Papa=require(_0x2f70('0xe'));var Redis=require('ioredis');var authService=require(_0x2f70('0xf'));var qs=require(_0x2f70('0x10'));var as=require(_0x2f70('0x11'));var hardwareService=require(_0x2f70('0x12'));var logger=require('../../config/logger')(_0x2f70('0x13'));var utils=require(_0x2f70('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2f70('0x15'))['db'];function respondWithStatusCode(_0x47df11,_0x421669){_0x421669=_0x421669||0xcc;return function(_0x8924c4){if(_0x8924c4){return _0x47df11['sendStatus'](_0x421669);}return _0x47df11['status'](_0x421669)[_0x2f70('0x16')]();};}function respondWithResult(_0x14ac42,_0x1fe071){_0x1fe071=_0x1fe071||0xc8;return function(_0x1b88a4){if(_0x1b88a4){return _0x14ac42[_0x2f70('0x17')](_0x1fe071)[_0x2f70('0x18')](_0x1b88a4);}};}function respondWithFilteredResult(_0x5eeb93,_0x2677d0){return function(_0xb3e6bd){if(_0xb3e6bd){var _0x5ebab1=typeof _0x2677d0[_0x2f70('0x19')]===_0x2f70('0x1a')&&typeof _0x2677d0[_0x2f70('0x1b')]===_0x2f70('0x1a');var _0x3e07f8=_0xb3e6bd['count'];var _0x21ce46=_0x5ebab1?0x0:_0x2677d0[_0x2f70('0x19')];var _0x1284ac=_0x5ebab1?_0xb3e6bd[_0x2f70('0x1c')]:_0x2677d0[_0x2f70('0x19')]+_0x2677d0['limit'];var _0x5c2f38;if(_0x1284ac>=_0x3e07f8){_0x1284ac=_0x3e07f8;_0x5c2f38=0xc8;}else{_0x5c2f38=0xce;}_0x5eeb93[_0x2f70('0x17')](_0x5c2f38);return _0x5eeb93['set']('Content-Range',_0x21ce46+'-'+_0x1284ac+'/'+_0x3e07f8)[_0x2f70('0x18')](_0xb3e6bd);}return null;};}function patchUpdates(_0x568126){return function(_0x27cb38){try{jsonpatch['apply'](_0x27cb38,_0x568126,!![]);}catch(_0x1d1ed5){return BPromise[_0x2f70('0x1d')](_0x1d1ed5);}return _0x27cb38[_0x2f70('0x1e')]();};}function saveUpdates(_0x306a36,_0x5ad22b){return function(_0x476b09){if(_0x476b09){return _0x476b09[_0x2f70('0x1f')](_0x306a36)[_0x2f70('0x20')](function(_0x8dfbfe){return _0x8dfbfe;});}return null;};}function removeEntity(_0x2bec17,_0x52b4bf){return function(_0x577d65){if(_0x577d65){return _0x577d65[_0x2f70('0x21')]()[_0x2f70('0x20')](function(){_0x2bec17['status'](0xcc)[_0x2f70('0x16')]();});}};}function handleEntityNotFound(_0x1f996f,_0x4292a1){return function(_0x55eeed){if(!_0x55eeed){_0x1f996f[_0x2f70('0x22')](0x194);}return _0x55eeed;};}function handleError(_0x4a0d79,_0x3dbf89){_0x3dbf89=_0x3dbf89||0x1f4;return function(_0x2caa32){logger['error'](_0x2caa32[_0x2f70('0x23')]);if(_0x2caa32[_0x2f70('0x24')]){delete _0x2caa32[_0x2f70('0x24')];}_0x4a0d79['status'](_0x3dbf89)[_0x2f70('0x25')](_0x2caa32);};}exports[_0x2f70('0x26')]=function(_0x397f7b,_0x818a0d){var _0x311954={},_0x519dc0={},_0x153654={'count':0x0,'rows':[]};var _0x51e2b7=_[_0x2f70('0x27')](db['MailServerOut'][_0x2f70('0x28')],function(_0x2b195a){return{'name':_0x2b195a[_0x2f70('0x29')],'type':_0x2b195a[_0x2f70('0x2a')][_0x2f70('0x2b')]};});_0x519dc0[_0x2f70('0x2c')]=_['map'](_0x51e2b7,_0x2f70('0x24'));_0x519dc0['query']=_[_0x2f70('0x2d')](_0x397f7b['query']);_0x519dc0['filters']=_[_0x2f70('0x2e')](_0x519dc0[_0x2f70('0x2c')],_0x519dc0[_0x2f70('0x2f')]);_0x311954[_0x2f70('0x30')]=_['intersection'](_0x519dc0['model'],qs['fields'](_0x397f7b['query'][_0x2f70('0x31')]));_0x311954[_0x2f70('0x30')]=_0x311954[_0x2f70('0x30')][_0x2f70('0x32')]?_0x311954[_0x2f70('0x30')]:_0x519dc0[_0x2f70('0x2c')];if(!_0x397f7b['query'][_0x2f70('0x33')](_0x2f70('0x34'))){_0x311954[_0x2f70('0x1b')]=qs['limit'](_0x397f7b[_0x2f70('0x2f')][_0x2f70('0x1b')]);_0x311954[_0x2f70('0x19')]=qs[_0x2f70('0x19')](_0x397f7b[_0x2f70('0x2f')][_0x2f70('0x19')]);}_0x311954['order']=qs[_0x2f70('0x35')](_0x397f7b[_0x2f70('0x2f')][_0x2f70('0x35')]);_0x311954[_0x2f70('0x36')]=qs[_0x2f70('0x37')](_[_0x2f70('0x38')](_0x397f7b[_0x2f70('0x2f')],_0x519dc0[_0x2f70('0x37')]),_0x51e2b7);if(_0x397f7b[_0x2f70('0x2f')][_0x2f70('0x39')]){_0x311954[_0x2f70('0x36')]=_[_0x2f70('0x3a')](_0x311954[_0x2f70('0x36')],{'$or':_['map'](_0x51e2b7,function(_0x199044){if(_0x199044[_0x2f70('0x2a')]!==_0x2f70('0x3b')){var _0x5cc7d2={};_0x5cc7d2[_0x199044[_0x2f70('0x24')]]={'$like':'%'+_0x397f7b[_0x2f70('0x2f')][_0x2f70('0x39')]+'%'};return _0x5cc7d2;}})});}_0x311954=_[_0x2f70('0x3a')]({},_0x311954,_0x397f7b[_0x2f70('0x3c')]);var _0x2d7359={'where':_0x311954[_0x2f70('0x36')]};return db[_0x2f70('0x3d')][_0x2f70('0x1c')](_0x2d7359)[_0x2f70('0x20')](function(_0x214bc9){_0x153654[_0x2f70('0x1c')]=_0x214bc9;if(_0x397f7b[_0x2f70('0x2f')]['includeAll']){_0x311954[_0x2f70('0x3e')]=[{'all':!![]}];}return db['MailServerOut'][_0x2f70('0x3f')](_0x311954);})[_0x2f70('0x20')](function(_0x2db033){_0x153654[_0x2f70('0x40')]=_0x2db033;return _0x153654;})[_0x2f70('0x20')](respondWithFilteredResult(_0x818a0d,_0x311954))[_0x2f70('0x41')](handleError(_0x818a0d,null));};exports[_0x2f70('0x42')]=function(_0x1ef978,_0x5b5c25){var _0x2641c1={'raw':!![],'where':{'id':_0x1ef978[_0x2f70('0x43')]['id']}},_0x8ae9a6={};_0x8ae9a6[_0x2f70('0x2c')]=_[_0x2f70('0x2d')](db[_0x2f70('0x3d')][_0x2f70('0x28')]);_0x8ae9a6[_0x2f70('0x2f')]=_[_0x2f70('0x2d')](_0x1ef978[_0x2f70('0x2f')]);_0x8ae9a6['filters']=_[_0x2f70('0x2e')](_0x8ae9a6[_0x2f70('0x2c')],_0x8ae9a6[_0x2f70('0x2f')]);_0x2641c1[_0x2f70('0x30')]=_['intersection'](_0x8ae9a6[_0x2f70('0x2c')],qs[_0x2f70('0x31')](_0x1ef978[_0x2f70('0x2f')][_0x2f70('0x31')]));_0x2641c1[_0x2f70('0x30')]=_0x2641c1[_0x2f70('0x30')]['length']?_0x2641c1[_0x2f70('0x30')]:_0x8ae9a6[_0x2f70('0x2c')];if(_0x1ef978['query'][_0x2f70('0x44')]){_0x2641c1[_0x2f70('0x3e')]=[{'all':!![]}];}_0x2641c1=_[_0x2f70('0x3a')]({},_0x2641c1,_0x1ef978[_0x2f70('0x3c')]);return db[_0x2f70('0x3d')]['find'](_0x2641c1)['then'](handleEntityNotFound(_0x5b5c25,null))[_0x2f70('0x20')](respondWithResult(_0x5b5c25,null))[_0x2f70('0x41')](handleError(_0x5b5c25,null));};exports[_0x2f70('0x45')]=function(_0x368454,_0xdac27c){return db[_0x2f70('0x3d')][_0x2f70('0x45')](_0x368454[_0x2f70('0x46')],{})[_0x2f70('0x20')](respondWithResult(_0xdac27c,0xc9))[_0x2f70('0x41')](handleError(_0xdac27c,null));};exports['update']=function(_0x54fe7a,_0xcd34be){if(_0x54fe7a['body']['id']){delete _0x54fe7a['body']['id'];}return db[_0x2f70('0x3d')]['find']({'where':{'id':_0x54fe7a[_0x2f70('0x43')]['id']}})[_0x2f70('0x20')](handleEntityNotFound(_0xcd34be,null))[_0x2f70('0x20')](saveUpdates(_0x54fe7a[_0x2f70('0x46')],null))[_0x2f70('0x20')](respondWithResult(_0xcd34be,null))[_0x2f70('0x41')](handleError(_0xcd34be,null));};exports[_0x2f70('0x21')]=function(_0x42c68c,_0x1b530f){return db[_0x2f70('0x3d')][_0x2f70('0x47')]({'where':{'id':_0x42c68c[_0x2f70('0x43')]['id']}})['then'](handleEntityNotFound(_0x1b530f,null))[_0x2f70('0x20')](removeEntity(_0x1b530f,null))[_0x2f70('0x41')](handleError(_0x1b530f,null));}; \ No newline at end of file +var _0xafbc=['set','Content-Range','apply','then','destroy','error','stack','name','index','map','MailServerOut','rawAttributes','fieldName','key','model','query','keys','filters','attributes','fields','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','intersection','length','includeAll','find','create','body','update','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','path','to-csv','ejs','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count'];(function(_0x264abe,_0x44a9da){var _0x47a810=function(_0x2ff221){while(--_0x2ff221){_0x264abe['push'](_0x264abe['shift']());}};_0x47a810(++_0x44a9da);}(_0xafbc,0x18d));var _0xcafb=function(_0x39abce,_0x196cef){_0x39abce=_0x39abce-0x0;var _0x5e04d7=_0xafbc[_0x39abce];return _0x5e04d7;};'use strict';var emlformat=require(_0xcafb('0x0'));var rimraf=require(_0xcafb('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcafb('0x2'));var rp=require(_0xcafb('0x3'));var moment=require(_0xcafb('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xcafb('0x5'));var path=require(_0xcafb('0x6'));var sox=require('sox');var csv=require(_0xcafb('0x7'));var ejs=require(_0xcafb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xcafb('0x9'));var crypto=require(_0xcafb('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcafb('0x7'));var querystring=require(_0xcafb('0xb'));var Papa=require(_0xcafb('0xc'));var Redis=require(_0xcafb('0xd'));var authService=require(_0xcafb('0xe'));var qs=require(_0xcafb('0xf'));var as=require(_0xcafb('0x10'));var hardwareService=require(_0xcafb('0x11'));var logger=require('../../config/logger')(_0xcafb('0x12'));var utils=require(_0xcafb('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xcafb('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1d7644,_0x592eb7){_0x592eb7=_0x592eb7||0xcc;return function(_0x290ce6){if(_0x290ce6){return _0x1d7644[_0xcafb('0x15')](_0x592eb7);}return _0x1d7644[_0xcafb('0x16')](_0x592eb7)[_0xcafb('0x17')]();};}function respondWithResult(_0xd602f3,_0x5667d0){_0x5667d0=_0x5667d0||0xc8;return function(_0x5d3c91){if(_0x5d3c91){return _0xd602f3[_0xcafb('0x16')](_0x5667d0)[_0xcafb('0x18')](_0x5d3c91);}};}function respondWithFilteredResult(_0x194215,_0x5812da){return function(_0x565a24){if(_0x565a24){var _0x596790=typeof _0x5812da[_0xcafb('0x19')]===_0xcafb('0x1a')&&typeof _0x5812da[_0xcafb('0x1b')]==='undefined';var _0x10a35f=_0x565a24[_0xcafb('0x1c')];var _0x9f070b=_0x596790?0x0:_0x5812da[_0xcafb('0x19')];var _0x47f7ef=_0x596790?_0x565a24[_0xcafb('0x1c')]:_0x5812da['offset']+_0x5812da[_0xcafb('0x1b')];var _0x200330;if(_0x47f7ef>=_0x10a35f){_0x47f7ef=_0x10a35f;_0x200330=0xc8;}else{_0x200330=0xce;}_0x194215[_0xcafb('0x16')](_0x200330);return _0x194215[_0xcafb('0x1d')](_0xcafb('0x1e'),_0x9f070b+'-'+_0x47f7ef+'/'+_0x10a35f)[_0xcafb('0x18')](_0x565a24);}return null;};}function patchUpdates(_0x2259ba){return function(_0x4e0f1b){try{jsonpatch[_0xcafb('0x1f')](_0x4e0f1b,_0x2259ba,!![]);}catch(_0x40d76a){return BPromise['reject'](_0x40d76a);}return _0x4e0f1b['save']();};}function saveUpdates(_0x487e7b,_0xafdcfb){return function(_0x3f34c2){if(_0x3f34c2){return _0x3f34c2['update'](_0x487e7b)[_0xcafb('0x20')](function(_0x1e524d){return _0x1e524d;});}return null;};}function removeEntity(_0xcab2eb,_0x30b81e){return function(_0x227ba3){if(_0x227ba3){return _0x227ba3[_0xcafb('0x21')]()['then'](function(){_0xcab2eb[_0xcafb('0x16')](0xcc)[_0xcafb('0x17')]();});}};}function handleEntityNotFound(_0x2f12c3,_0x4ce4ee){return function(_0x3e98df){if(!_0x3e98df){_0x2f12c3[_0xcafb('0x15')](0x194);}return _0x3e98df;};}function handleError(_0x120971,_0x501e08){_0x501e08=_0x501e08||0x1f4;return function(_0x525473){logger[_0xcafb('0x22')](_0x525473[_0xcafb('0x23')]);if(_0x525473[_0xcafb('0x24')]){delete _0x525473['name'];}_0x120971['status'](_0x501e08)['send'](_0x525473);};}exports[_0xcafb('0x25')]=function(_0x44b898,_0x5d8980){var _0x15e7c7={},_0xab150d={},_0x3626a0={'count':0x0,'rows':[]};var _0x5e3bfb=_[_0xcafb('0x26')](db[_0xcafb('0x27')][_0xcafb('0x28')],function(_0xfd87fc){return{'name':_0xfd87fc[_0xcafb('0x29')],'type':_0xfd87fc['type'][_0xcafb('0x2a')]};});_0xab150d[_0xcafb('0x2b')]=_[_0xcafb('0x26')](_0x5e3bfb,_0xcafb('0x24'));_0xab150d[_0xcafb('0x2c')]=_[_0xcafb('0x2d')](_0x44b898[_0xcafb('0x2c')]);_0xab150d[_0xcafb('0x2e')]=_['intersection'](_0xab150d[_0xcafb('0x2b')],_0xab150d['query']);_0x15e7c7[_0xcafb('0x2f')]=_['intersection'](_0xab150d[_0xcafb('0x2b')],qs[_0xcafb('0x30')](_0x44b898[_0xcafb('0x2c')][_0xcafb('0x30')]));_0x15e7c7[_0xcafb('0x2f')]=_0x15e7c7[_0xcafb('0x2f')]['length']?_0x15e7c7[_0xcafb('0x2f')]:_0xab150d['model'];if(!_0x44b898['query']['hasOwnProperty']('nolimit')){_0x15e7c7['limit']=qs[_0xcafb('0x1b')](_0x44b898[_0xcafb('0x2c')][_0xcafb('0x1b')]);_0x15e7c7[_0xcafb('0x19')]=qs[_0xcafb('0x19')](_0x44b898[_0xcafb('0x2c')][_0xcafb('0x19')]);}_0x15e7c7[_0xcafb('0x31')]=qs[_0xcafb('0x32')](_0x44b898[_0xcafb('0x2c')][_0xcafb('0x32')]);_0x15e7c7[_0xcafb('0x33')]=qs['filters'](_[_0xcafb('0x34')](_0x44b898[_0xcafb('0x2c')],_0xab150d[_0xcafb('0x2e')]),_0x5e3bfb);if(_0x44b898['query'][_0xcafb('0x35')]){_0x15e7c7['where']=_[_0xcafb('0x36')](_0x15e7c7[_0xcafb('0x33')],{'$or':_[_0xcafb('0x26')](_0x5e3bfb,function(_0x59cf8b){if(_0x59cf8b[_0xcafb('0x37')]!==_0xcafb('0x38')){var _0x574399={};_0x574399[_0x59cf8b[_0xcafb('0x24')]]={'$like':'%'+_0x44b898['query']['filter']+'%'};return _0x574399;}})});}_0x15e7c7=_['merge']({},_0x15e7c7,_0x44b898[_0xcafb('0x39')]);var _0x4d6aec={'where':_0x15e7c7['where']};return db[_0xcafb('0x27')]['count'](_0x4d6aec)[_0xcafb('0x20')](function(_0x9fb222){_0x3626a0[_0xcafb('0x1c')]=_0x9fb222;if(_0x44b898[_0xcafb('0x2c')]['includeAll']){_0x15e7c7[_0xcafb('0x3a')]=[{'all':!![]}];}return db[_0xcafb('0x27')][_0xcafb('0x3b')](_0x15e7c7);})[_0xcafb('0x20')](function(_0xc69cbd){_0x3626a0[_0xcafb('0x3c')]=_0xc69cbd;return _0x3626a0;})[_0xcafb('0x20')](respondWithFilteredResult(_0x5d8980,_0x15e7c7))[_0xcafb('0x3d')](handleError(_0x5d8980,null));};exports[_0xcafb('0x3e')]=function(_0x4be796,_0x43e31f){var _0x3b85e6={'raw':!![],'where':{'id':_0x4be796['params']['id']}},_0x347b35={};_0x347b35[_0xcafb('0x2b')]=_['keys'](db[_0xcafb('0x27')]['rawAttributes']);_0x347b35[_0xcafb('0x2c')]=_[_0xcafb('0x2d')](_0x4be796[_0xcafb('0x2c')]);_0x347b35['filters']=_[_0xcafb('0x3f')](_0x347b35['model'],_0x347b35['query']);_0x3b85e6['attributes']=_[_0xcafb('0x3f')](_0x347b35[_0xcafb('0x2b')],qs['fields'](_0x4be796[_0xcafb('0x2c')][_0xcafb('0x30')]));_0x3b85e6[_0xcafb('0x2f')]=_0x3b85e6[_0xcafb('0x2f')][_0xcafb('0x40')]?_0x3b85e6[_0xcafb('0x2f')]:_0x347b35[_0xcafb('0x2b')];if(_0x4be796['query'][_0xcafb('0x41')]){_0x3b85e6[_0xcafb('0x3a')]=[{'all':!![]}];}_0x3b85e6=_['merge']({},_0x3b85e6,_0x4be796[_0xcafb('0x39')]);return db[_0xcafb('0x27')][_0xcafb('0x42')](_0x3b85e6)[_0xcafb('0x20')](handleEntityNotFound(_0x43e31f,null))[_0xcafb('0x20')](respondWithResult(_0x43e31f,null))[_0xcafb('0x3d')](handleError(_0x43e31f,null));};exports[_0xcafb('0x43')]=function(_0x146009,_0x486d57){return db[_0xcafb('0x27')][_0xcafb('0x43')](_0x146009[_0xcafb('0x44')],{})[_0xcafb('0x20')](respondWithResult(_0x486d57,0xc9))[_0xcafb('0x3d')](handleError(_0x486d57,null));};exports[_0xcafb('0x45')]=function(_0x5bbe9d,_0x2cfaf7){if(_0x5bbe9d[_0xcafb('0x44')]['id']){delete _0x5bbe9d[_0xcafb('0x44')]['id'];}return db[_0xcafb('0x27')][_0xcafb('0x42')]({'where':{'id':_0x5bbe9d[_0xcafb('0x46')]['id']}})['then'](handleEntityNotFound(_0x2cfaf7,null))[_0xcafb('0x20')](saveUpdates(_0x5bbe9d[_0xcafb('0x44')],null))[_0xcafb('0x20')](respondWithResult(_0x2cfaf7,null))[_0xcafb('0x3d')](handleError(_0x2cfaf7,null));};exports['destroy']=function(_0x135a52,_0x2f66e7){return db['MailServerOut'][_0xcafb('0x42')]({'where':{'id':_0x135a52[_0xcafb('0x46')]['id']}})[_0xcafb('0x20')](handleEntityNotFound(_0x2f66e7,null))[_0xcafb('0x20')](removeEntity(_0x2f66e7,null))[_0xcafb('0x3d')](handleError(_0x2f66e7,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 1a847de..78faf60 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 _0x639b=['bluebird','request-promise','path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','util','../../config/logger'];(function(_0x3df34b,_0x4f02c7){var _0x2e98ec=function(_0x2480d7){while(--_0x2480d7){_0x3df34b['push'](_0x3df34b['shift']());}};_0x2e98ec(++_0x4f02c7);}(_0x639b,0x1e2));var _0xb639=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x639b[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0xb639('0x0'));var logger=require(_0xb639('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb639('0x2'));var rp=require(_0xb639('0x3'));var fs=require('fs');var path=require(_0xb639('0x4'));var rimraf=require(_0xb639('0x5'));var config=require(_0xb639('0x6'));var attributes=require(_0xb639('0x7'));module[_0xb639('0x8')]=function(_0x3656ef,_0x2ff5b0){return _0x3656ef[_0xb639('0x9')](_0xb639('0xa'),attributes,{'tableName':'mail_servers_out','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1c8a=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerOut','mail_servers_out','lodash'];(function(_0x2f41e6,_0x1e8023){var _0xfc39c0=function(_0x240151){while(--_0x240151){_0x2f41e6['push'](_0x2f41e6['shift']());}};_0xfc39c0(++_0x1e8023);}(_0x1c8a,0x1d3));var _0xa1c8=function(_0x50bdcd,_0x2fa2d5){_0x50bdcd=_0x50bdcd-0x0;var _0x4221a7=_0x1c8a[_0x50bdcd];return _0x4221a7;};'use strict';var _=require(_0xa1c8('0x0'));var util=require(_0xa1c8('0x1'));var logger=require('../../config/logger')(_0xa1c8('0x2'));var moment=require(_0xa1c8('0x3'));var BPromise=require(_0xa1c8('0x4'));var rp=require(_0xa1c8('0x5'));var fs=require('fs');var path=require(_0xa1c8('0x6'));var rimraf=require(_0xa1c8('0x7'));var config=require(_0xa1c8('0x8'));var attributes=require('./mailServerOut.attributes');module[_0xa1c8('0x9')]=function(_0x440ba8,_0x3f9bdd){return _0x440ba8[_0xa1c8('0xa')](_0xa1c8('0xb'),attributes,{'tableName':_0xa1c8('0xc'),'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 b0191ea..9764c51 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 _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x49a68c,_0x41eb52){var _0x21a081=function(_0x432b7b){while(--_0x432b7b){_0x49a68c['push'](_0x49a68c['shift']());}};_0x21a081(++_0x41eb52);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x589059,_0xb34829){var _0x57caf0=function(_0x12ff33){while(--_0x12ff33){_0x589059['push'](_0x589059['shift']());}};_0x57caf0(++_0xb34829);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x342baa,_0x4a110f){_0x342baa=_0x342baa-0x0;var _0x1208f3=_0xc4aa[_0x342baa];return _0x1208f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 38a413b..32855aa 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 _0x2566=['exports','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','post','create','put','/:id','update','delete'];(function(_0x438577,_0x7ac843){var _0x4d0e4d=function(_0x20d906){while(--_0x20d906){_0x438577['push'](_0x438577['shift']());}};_0x4d0e4d(++_0x7ac843);}(_0x2566,0xa1));var _0x6256=function(_0x29e27f,_0x2d4f86){_0x29e27f=_0x29e27f-0x0;var _0x4b56ca=_0x2566[_0x29e27f];return _0x4b56ca;};'use strict';var multer=require(_0x6256('0x0'));var util=require(_0x6256('0x1'));var path=require(_0x6256('0x2'));var timeout=require(_0x6256('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6256('0x4'));var interaction=require(_0x6256('0x5'));var config=require(_0x6256('0x6'));var controller=require(_0x6256('0x7'));router[_0x6256('0x8')]('/',auth[_0x6256('0x9')](),controller[_0x6256('0xa')]);router['get'](_0x6256('0xb'),auth[_0x6256('0x9')](),controller[_0x6256('0xc')]);router[_0x6256('0x8')]('/:id',auth[_0x6256('0x9')](),controller['show']);router[_0x6256('0xd')]('/',auth[_0x6256('0x9')](),controller[_0x6256('0xe')]);router[_0x6256('0xf')](_0x6256('0x10'),auth[_0x6256('0x9')](),controller[_0x6256('0x11')]);router[_0x6256('0x12')]('/:id',auth[_0x6256('0x9')](),controller['destroy']);module[_0x6256('0x13')]=router; \ No newline at end of file +var _0x6c17=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailSubstatus.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','update','exports','multer','util','path','connect-timeout'];(function(_0x2f5ac5,_0x1ee939){var _0x37c9a8=function(_0x15031f){while(--_0x15031f){_0x2f5ac5['push'](_0x2f5ac5['shift']());}};_0x37c9a8(++_0x1ee939);}(_0x6c17,0x1ca));var _0x76c1=function(_0x3eb2ae,_0x486f83){_0x3eb2ae=_0x3eb2ae-0x0;var _0x346b2f=_0x6c17[_0x3eb2ae];return _0x346b2f;};'use strict';var multer=require(_0x76c1('0x0'));var util=require(_0x76c1('0x1'));var path=require(_0x76c1('0x2'));var timeout=require(_0x76c1('0x3'));var express=require('express');var router=express[_0x76c1('0x4')]();var fs_extra=require(_0x76c1('0x5'));var auth=require(_0x76c1('0x6'));var interaction=require(_0x76c1('0x7'));var config=require(_0x76c1('0x8'));var controller=require(_0x76c1('0x9'));router[_0x76c1('0xa')]('/',auth[_0x76c1('0xb')](),controller[_0x76c1('0xc')]);router['get'](_0x76c1('0xd'),auth[_0x76c1('0xb')](),controller[_0x76c1('0xe')]);router[_0x76c1('0xa')](_0x76c1('0xf'),auth['isAuthenticated'](),controller[_0x76c1('0x10')]);router[_0x76c1('0x11')]('/',auth[_0x76c1('0xb')](),controller[_0x76c1('0x12')]);router['put']('/:id',auth[_0x76c1('0xb')](),controller[_0x76c1('0x13')]);router['delete'](_0x76c1('0xf'),auth[_0x76c1('0xb')](),controller['destroy']);module[_0x76c1('0x14')]=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index f3a1bc7..d6474a2 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 _0x4300=['sequelize'];(function(_0x100739,_0x2fbbcb){var _0x2a572e=function(_0x2be2b0){while(--_0x2be2b0){_0x100739['push'](_0x100739['shift']());}};_0x2a572e(++_0x2fbbcb);}(_0x4300,0x1a6));var _0x0430=function(_0x14757b,_0x142769){_0x14757b=_0x14757b-0x0;var _0x36efaf=_0x4300[_0x14757b];return _0x36efaf;};'use strict';var Sequelize=require(_0x0430('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xe0ae=['name','STRING'];(function(_0x39efb1,_0x37e556){var _0x4e9ecd=function(_0x346e7d){while(--_0x346e7d){_0x39efb1['push'](_0x39efb1['shift']());}};_0x4e9ecd(++_0x37e556);}(_0xe0ae,0xa1));var _0xee0a=function(_0x40aaa4,_0x3b22f4){_0x40aaa4=_0x40aaa4-0x0;var _0x4e21e5=_0xe0ae[_0x40aaa4];return _0x4e21e5;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xee0a('0x0')],'unique':_0xee0a('0x1'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 050f660..b6967d3 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 _0x6476=['name','send','index','map','rawAttributes','fieldName','type','key','query','filters','model','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','include','MailSubstatus','findAll','rows','params','keys','includeAll','find','create','catch','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack'];(function(_0x586cf3,_0x1ff484){var _0x1259bd=function(_0x1c9c54){while(--_0x1c9c54){_0x586cf3['push'](_0x586cf3['shift']());}};_0x1259bd(++_0x1ff484);}(_0x6476,0x14f));var _0x6647=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0x6476[_0x47a7d0];return _0xb9bd08;};'use strict';var emlformat=require(_0x6647('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6647('0x1'));var jsonpatch=require(_0x6647('0x2'));var rp=require(_0x6647('0x3'));var moment=require(_0x6647('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6647('0x5'));var util=require(_0x6647('0x6'));var path=require(_0x6647('0x7'));var sox=require(_0x6647('0x8'));var csv=require(_0x6647('0x9'));var ejs=require(_0x6647('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x6647('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x6647('0x9'));var querystring=require(_0x6647('0xc'));var Papa=require(_0x6647('0xd'));var Redis=require('ioredis');var authService=require(_0x6647('0xe'));var qs=require(_0x6647('0xf'));var as=require(_0x6647('0x10'));var hardwareService=require(_0x6647('0x11'));var logger=require(_0x6647('0x12'))(_0x6647('0x13'));var utils=require('../../config/utils');var config=require(_0x6647('0x14'));var licenseUtil=require(_0x6647('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x412d79,_0x3aef60){_0x3aef60=_0x3aef60||0xcc;return function(_0x5674ef){if(_0x5674ef){return _0x412d79[_0x6647('0x16')](_0x3aef60);}return _0x412d79['status'](_0x3aef60)[_0x6647('0x17')]();};}function respondWithResult(_0x2f5f12,_0x1c26eb){_0x1c26eb=_0x1c26eb||0xc8;return function(_0x55ae8d){if(_0x55ae8d){return _0x2f5f12['status'](_0x1c26eb)[_0x6647('0x18')](_0x55ae8d);}};}function respondWithFilteredResult(_0x133faf,_0x1aae23){return function(_0x3c3425){if(_0x3c3425){var _0xfbd481=typeof _0x1aae23[_0x6647('0x19')]===_0x6647('0x1a')&&typeof _0x1aae23['limit']==='undefined';var _0x1ba75d=_0x3c3425[_0x6647('0x1b')];var _0x150179=_0xfbd481?0x0:_0x1aae23[_0x6647('0x19')];var _0x14fe4e=_0xfbd481?_0x3c3425[_0x6647('0x1b')]:_0x1aae23[_0x6647('0x19')]+_0x1aae23[_0x6647('0x1c')];var _0x3767fa;if(_0x14fe4e>=_0x1ba75d){_0x14fe4e=_0x1ba75d;_0x3767fa=0xc8;}else{_0x3767fa=0xce;}_0x133faf[_0x6647('0x1d')](_0x3767fa);return _0x133faf[_0x6647('0x1e')](_0x6647('0x1f'),_0x150179+'-'+_0x14fe4e+'/'+_0x1ba75d)['json'](_0x3c3425);}return null;};}function patchUpdates(_0x39e3a0){return function(_0x545f6d){try{jsonpatch[_0x6647('0x20')](_0x545f6d,_0x39e3a0,!![]);}catch(_0x4bd1ac){return BPromise[_0x6647('0x21')](_0x4bd1ac);}return _0x545f6d[_0x6647('0x22')]();};}function saveUpdates(_0x32f4f0,_0x4bbd77){return function(_0x41866d){if(_0x41866d){return _0x41866d[_0x6647('0x23')](_0x32f4f0)[_0x6647('0x24')](function(_0x2f7824){return _0x2f7824;});}return null;};}function removeEntity(_0x454df8,_0x1cdede){return function(_0x393ccd){if(_0x393ccd){return _0x393ccd[_0x6647('0x25')]()[_0x6647('0x24')](function(){_0x454df8['status'](0xcc)[_0x6647('0x17')]();});}};}function handleEntityNotFound(_0x2dae42,_0x4a0448){return function(_0x2c3fd6){if(!_0x2c3fd6){_0x2dae42[_0x6647('0x16')](0x194);}return _0x2c3fd6;};}function handleError(_0x4e1fa0,_0x2a0117){_0x2a0117=_0x2a0117||0x1f4;return function(_0x2645c8){logger[_0x6647('0x26')](_0x2645c8[_0x6647('0x27')]);if(_0x2645c8[_0x6647('0x28')]){delete _0x2645c8[_0x6647('0x28')];}_0x4e1fa0[_0x6647('0x1d')](_0x2a0117)[_0x6647('0x29')](_0x2645c8);};}exports[_0x6647('0x2a')]=function(_0x29d552,_0x4401c2){var _0x31abd7={},_0x2359cc={},_0x4ca4c7={'count':0x0,'rows':[]};var _0x406fcc=_[_0x6647('0x2b')](db['MailSubstatus'][_0x6647('0x2c')],function(_0x5b06c6){return{'name':_0x5b06c6[_0x6647('0x2d')],'type':_0x5b06c6[_0x6647('0x2e')][_0x6647('0x2f')]};});_0x2359cc['model']=_[_0x6647('0x2b')](_0x406fcc,_0x6647('0x28'));_0x2359cc[_0x6647('0x30')]=_['keys'](_0x29d552['query']);_0x2359cc[_0x6647('0x31')]=_['intersection'](_0x2359cc[_0x6647('0x32')],_0x2359cc[_0x6647('0x30')]);_0x31abd7['attributes']=_[_0x6647('0x33')](_0x2359cc['model'],qs[_0x6647('0x34')](_0x29d552[_0x6647('0x30')][_0x6647('0x34')]));_0x31abd7[_0x6647('0x35')]=_0x31abd7[_0x6647('0x35')][_0x6647('0x36')]?_0x31abd7[_0x6647('0x35')]:_0x2359cc[_0x6647('0x32')];if(!_0x29d552[_0x6647('0x30')]['hasOwnProperty'](_0x6647('0x37'))){_0x31abd7['limit']=qs[_0x6647('0x1c')](_0x29d552['query'][_0x6647('0x1c')]);_0x31abd7[_0x6647('0x19')]=qs[_0x6647('0x19')](_0x29d552[_0x6647('0x30')][_0x6647('0x19')]);}_0x31abd7[_0x6647('0x38')]=qs['sort'](_0x29d552[_0x6647('0x30')][_0x6647('0x39')]);_0x31abd7[_0x6647('0x3a')]=qs[_0x6647('0x31')](_[_0x6647('0x3b')](_0x29d552[_0x6647('0x30')],_0x2359cc[_0x6647('0x31')]),_0x406fcc);if(_0x29d552[_0x6647('0x30')][_0x6647('0x3c')]){_0x31abd7[_0x6647('0x3a')]=_['merge'](_0x31abd7['where'],{'$or':_[_0x6647('0x2b')](_0x406fcc,function(_0x404cec){if(_0x404cec['type']!==_0x6647('0x3d')){var _0x4f8810={};_0x4f8810[_0x404cec[_0x6647('0x28')]]={'$like':'%'+_0x29d552['query'][_0x6647('0x3c')]+'%'};return _0x4f8810;}})});}_0x31abd7=_[_0x6647('0x3e')]({},_0x31abd7,_0x29d552['options']);var _0x365df4={'where':_0x31abd7[_0x6647('0x3a')]};return db['MailSubstatus'][_0x6647('0x1b')](_0x365df4)[_0x6647('0x24')](function(_0x453710){_0x4ca4c7[_0x6647('0x1b')]=_0x453710;if(_0x29d552['query']['includeAll']){_0x31abd7[_0x6647('0x3f')]=[{'all':!![]}];}return db[_0x6647('0x40')][_0x6647('0x41')](_0x31abd7);})[_0x6647('0x24')](function(_0x51b475){_0x4ca4c7[_0x6647('0x42')]=_0x51b475;return _0x4ca4c7;})[_0x6647('0x24')](respondWithFilteredResult(_0x4401c2,_0x31abd7))['catch'](handleError(_0x4401c2,null));};exports['show']=function(_0x748730,_0x44af3d){var _0x5bfcdd={'raw':!![],'where':{'id':_0x748730[_0x6647('0x43')]['id']}},_0x2939c8={};_0x2939c8['model']=_['keys'](db[_0x6647('0x40')]['rawAttributes']);_0x2939c8['query']=_[_0x6647('0x44')](_0x748730['query']);_0x2939c8[_0x6647('0x31')]=_['intersection'](_0x2939c8['model'],_0x2939c8[_0x6647('0x30')]);_0x5bfcdd[_0x6647('0x35')]=_['intersection'](_0x2939c8[_0x6647('0x32')],qs[_0x6647('0x34')](_0x748730[_0x6647('0x30')]['fields']));_0x5bfcdd['attributes']=_0x5bfcdd['attributes'][_0x6647('0x36')]?_0x5bfcdd['attributes']:_0x2939c8[_0x6647('0x32')];if(_0x748730[_0x6647('0x30')][_0x6647('0x45')]){_0x5bfcdd['include']=[{'all':!![]}];}_0x5bfcdd=_[_0x6647('0x3e')]({},_0x5bfcdd,_0x748730['options']);return db[_0x6647('0x40')][_0x6647('0x46')](_0x5bfcdd)[_0x6647('0x24')](handleEntityNotFound(_0x44af3d,null))[_0x6647('0x24')](respondWithResult(_0x44af3d,null))['catch'](handleError(_0x44af3d,null));};exports['create']=function(_0x3b9aec,_0x3bddd2){return db[_0x6647('0x40')][_0x6647('0x47')](_0x3b9aec['body'],{})['then'](respondWithResult(_0x3bddd2,0xc9))[_0x6647('0x48')](handleError(_0x3bddd2,null));};exports[_0x6647('0x23')]=function(_0x48ff78,_0x107eb6){if(_0x48ff78['body']['id']){delete _0x48ff78[_0x6647('0x49')]['id'];}return db[_0x6647('0x40')][_0x6647('0x46')]({'where':{'id':_0x48ff78['params']['id']}})['then'](handleEntityNotFound(_0x107eb6,null))[_0x6647('0x24')](saveUpdates(_0x48ff78[_0x6647('0x49')],null))[_0x6647('0x24')](respondWithResult(_0x107eb6,null))[_0x6647('0x48')](handleError(_0x107eb6,null));};exports[_0x6647('0x25')]=function(_0x5b7546,_0x52a0f4){return db['MailSubstatus']['find']({'where':{'id':_0x5b7546[_0x6647('0x43')]['id']}})[_0x6647('0x24')](handleEntityNotFound(_0x52a0f4,null))[_0x6647('0x24')](removeEntity(_0x52a0f4,null))['catch'](handleError(_0x52a0f4,null));};exports[_0x6647('0x4a')]=function(_0x23b674,_0x4859fa){return db[_0x6647('0x40')][_0x6647('0x4a')]()['then'](respondWithResult(_0x4859fa,null))[_0x6647('0x48')](handleError(_0x4859fa,null));}; \ No newline at end of file +var _0x0acf=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','error','stack','name','index','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','MailSubstatus','includeAll','include','findAll','catch','show','params','keys','create','body','update','find','describe','eml-format','bluebird','mustache','to-csv','fs-extra','squel','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0xb318b2,_0xdd60aa){var _0x1e9506=function(_0x3b0106){while(--_0x3b0106){_0xb318b2['push'](_0xb318b2['shift']());}};_0x1e9506(++_0xdd60aa);}(_0x0acf,0x18d));var _0xf0ac=function(_0x31c796,_0x2e3c7f){_0x31c796=_0x31c796-0x0;var _0x128356=_0x0acf[_0x31c796];return _0x128356;};'use strict';var emlformat=require(_0xf0ac('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(_0xf0ac('0x1'));var Mustache=require(_0xf0ac('0x2'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xf0ac('0x3'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf0ac('0x4'));var _=require('lodash');var squel=require(_0xf0ac('0x5'));var crypto=require('crypto');var jsforce=require(_0xf0ac('0x6'));var deskjs=require(_0xf0ac('0x7'));var toCsv=require(_0xf0ac('0x3'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xf0ac('0x8'));var authService=require('../../components/auth/service');var qs=require(_0xf0ac('0x9'));var as=require(_0xf0ac('0xa'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xf0ac('0xb'))(_0xf0ac('0xc'));var utils=require(_0xf0ac('0xd'));var config=require(_0xf0ac('0xe'));var licenseUtil=require(_0xf0ac('0xf'));var db=require(_0xf0ac('0x10'))['db'];function respondWithStatusCode(_0x306ee5,_0x4fa65f){_0x4fa65f=_0x4fa65f||0xcc;return function(_0xb4764f){if(_0xb4764f){return _0x306ee5[_0xf0ac('0x11')](_0x4fa65f);}return _0x306ee5[_0xf0ac('0x12')](_0x4fa65f)[_0xf0ac('0x13')]();};}function respondWithResult(_0x1b88cc,_0x382098){_0x382098=_0x382098||0xc8;return function(_0x1e9023){if(_0x1e9023){return _0x1b88cc[_0xf0ac('0x12')](_0x382098)[_0xf0ac('0x14')](_0x1e9023);}};}function respondWithFilteredResult(_0x28e20a,_0x4c7608){return function(_0x2b9622){if(_0x2b9622){var _0x404010=typeof _0x4c7608[_0xf0ac('0x15')]===_0xf0ac('0x16')&&typeof _0x4c7608[_0xf0ac('0x17')]===_0xf0ac('0x16');var _0x13e2dc=_0x2b9622[_0xf0ac('0x18')];var _0x4ae74d=_0x404010?0x0:_0x4c7608['offset'];var _0x2bf3b9=_0x404010?_0x2b9622[_0xf0ac('0x18')]:_0x4c7608[_0xf0ac('0x15')]+_0x4c7608[_0xf0ac('0x17')];var _0x44902b;if(_0x2bf3b9>=_0x13e2dc){_0x2bf3b9=_0x13e2dc;_0x44902b=0xc8;}else{_0x44902b=0xce;}_0x28e20a[_0xf0ac('0x12')](_0x44902b);return _0x28e20a[_0xf0ac('0x19')](_0xf0ac('0x1a'),_0x4ae74d+'-'+_0x2bf3b9+'/'+_0x13e2dc)[_0xf0ac('0x14')](_0x2b9622);}return null;};}function patchUpdates(_0x432e66){return function(_0x2d835f){try{jsonpatch[_0xf0ac('0x1b')](_0x2d835f,_0x432e66,!![]);}catch(_0x4cae5f){return BPromise[_0xf0ac('0x1c')](_0x4cae5f);}return _0x2d835f[_0xf0ac('0x1d')]();};}function saveUpdates(_0x5c2b42,_0x4a670c){return function(_0x4dc741){if(_0x4dc741){return _0x4dc741['update'](_0x5c2b42)[_0xf0ac('0x1e')](function(_0x39a6da){return _0x39a6da;});}return null;};}function removeEntity(_0x260f42,_0x11b27b){return function(_0x486f63){if(_0x486f63){return _0x486f63['destroy']()['then'](function(){_0x260f42[_0xf0ac('0x12')](0xcc)['end']();});}};}function handleEntityNotFound(_0x313b81,_0x16f096){return function(_0x3f291b){if(!_0x3f291b){_0x313b81[_0xf0ac('0x11')](0x194);}return _0x3f291b;};}function handleError(_0x2c54f1,_0x594923){_0x594923=_0x594923||0x1f4;return function(_0x51f408){logger[_0xf0ac('0x1f')](_0x51f408[_0xf0ac('0x20')]);if(_0x51f408[_0xf0ac('0x21')]){delete _0x51f408[_0xf0ac('0x21')];}_0x2c54f1[_0xf0ac('0x12')](_0x594923)['send'](_0x51f408);};}exports[_0xf0ac('0x22')]=function(_0x707d5b,_0x3e7286){var _0x3508e3={},_0x2f1c64={},_0x183d15={'count':0x0,'rows':[]};var _0x28caea=_[_0xf0ac('0x23')](db['MailSubstatus'][_0xf0ac('0x24')],function(_0x5526ee){return{'name':_0x5526ee[_0xf0ac('0x25')],'type':_0x5526ee['type'][_0xf0ac('0x26')]};});_0x2f1c64[_0xf0ac('0x27')]=_[_0xf0ac('0x23')](_0x28caea,_0xf0ac('0x21'));_0x2f1c64['query']=_['keys'](_0x707d5b[_0xf0ac('0x28')]);_0x2f1c64[_0xf0ac('0x29')]=_[_0xf0ac('0x2a')](_0x2f1c64[_0xf0ac('0x27')],_0x2f1c64[_0xf0ac('0x28')]);_0x3508e3[_0xf0ac('0x2b')]=_[_0xf0ac('0x2a')](_0x2f1c64[_0xf0ac('0x27')],qs[_0xf0ac('0x2c')](_0x707d5b[_0xf0ac('0x28')][_0xf0ac('0x2c')]));_0x3508e3[_0xf0ac('0x2b')]=_0x3508e3['attributes'][_0xf0ac('0x2d')]?_0x3508e3[_0xf0ac('0x2b')]:_0x2f1c64[_0xf0ac('0x27')];if(!_0x707d5b['query']['hasOwnProperty'](_0xf0ac('0x2e'))){_0x3508e3[_0xf0ac('0x17')]=qs['limit'](_0x707d5b[_0xf0ac('0x28')][_0xf0ac('0x17')]);_0x3508e3[_0xf0ac('0x15')]=qs['offset'](_0x707d5b[_0xf0ac('0x28')][_0xf0ac('0x15')]);}_0x3508e3[_0xf0ac('0x2f')]=qs[_0xf0ac('0x30')](_0x707d5b[_0xf0ac('0x28')]['sort']);_0x3508e3[_0xf0ac('0x31')]=qs[_0xf0ac('0x29')](_[_0xf0ac('0x32')](_0x707d5b[_0xf0ac('0x28')],_0x2f1c64['filters']),_0x28caea);if(_0x707d5b[_0xf0ac('0x28')][_0xf0ac('0x33')]){_0x3508e3['where']=_[_0xf0ac('0x34')](_0x3508e3[_0xf0ac('0x31')],{'$or':_[_0xf0ac('0x23')](_0x28caea,function(_0x502569){if(_0x502569['type']!==_0xf0ac('0x35')){var _0x2a67cf={};_0x2a67cf[_0x502569[_0xf0ac('0x21')]]={'$like':'%'+_0x707d5b[_0xf0ac('0x28')]['filter']+'%'};return _0x2a67cf;}})});}_0x3508e3=_['merge']({},_0x3508e3,_0x707d5b[_0xf0ac('0x36')]);var _0x52c06f={'where':_0x3508e3[_0xf0ac('0x31')]};return db[_0xf0ac('0x37')][_0xf0ac('0x18')](_0x52c06f)['then'](function(_0x536c20){_0x183d15[_0xf0ac('0x18')]=_0x536c20;if(_0x707d5b[_0xf0ac('0x28')][_0xf0ac('0x38')]){_0x3508e3[_0xf0ac('0x39')]=[{'all':!![]}];}return db[_0xf0ac('0x37')][_0xf0ac('0x3a')](_0x3508e3);})[_0xf0ac('0x1e')](function(_0x76b5a){_0x183d15['rows']=_0x76b5a;return _0x183d15;})[_0xf0ac('0x1e')](respondWithFilteredResult(_0x3e7286,_0x3508e3))[_0xf0ac('0x3b')](handleError(_0x3e7286,null));};exports[_0xf0ac('0x3c')]=function(_0x57dc65,_0x2e995f){var _0x1a7bfa={'raw':!![],'where':{'id':_0x57dc65[_0xf0ac('0x3d')]['id']}},_0x128de0={};_0x128de0['model']=_[_0xf0ac('0x3e')](db[_0xf0ac('0x37')][_0xf0ac('0x24')]);_0x128de0[_0xf0ac('0x28')]=_['keys'](_0x57dc65[_0xf0ac('0x28')]);_0x128de0['filters']=_[_0xf0ac('0x2a')](_0x128de0[_0xf0ac('0x27')],_0x128de0[_0xf0ac('0x28')]);_0x1a7bfa[_0xf0ac('0x2b')]=_[_0xf0ac('0x2a')](_0x128de0[_0xf0ac('0x27')],qs[_0xf0ac('0x2c')](_0x57dc65['query']['fields']));_0x1a7bfa[_0xf0ac('0x2b')]=_0x1a7bfa[_0xf0ac('0x2b')][_0xf0ac('0x2d')]?_0x1a7bfa['attributes']:_0x128de0[_0xf0ac('0x27')];if(_0x57dc65['query']['includeAll']){_0x1a7bfa[_0xf0ac('0x39')]=[{'all':!![]}];}_0x1a7bfa=_[_0xf0ac('0x34')]({},_0x1a7bfa,_0x57dc65['options']);return db[_0xf0ac('0x37')]['find'](_0x1a7bfa)['then'](handleEntityNotFound(_0x2e995f,null))[_0xf0ac('0x1e')](respondWithResult(_0x2e995f,null))[_0xf0ac('0x3b')](handleError(_0x2e995f,null));};exports[_0xf0ac('0x3f')]=function(_0x2d77eb,_0x1f5146){return db['MailSubstatus']['create'](_0x2d77eb[_0xf0ac('0x40')],{})[_0xf0ac('0x1e')](respondWithResult(_0x1f5146,0xc9))[_0xf0ac('0x3b')](handleError(_0x1f5146,null));};exports[_0xf0ac('0x41')]=function(_0x3dde36,_0x1efc9e){if(_0x3dde36[_0xf0ac('0x40')]['id']){delete _0x3dde36[_0xf0ac('0x40')]['id'];}return db[_0xf0ac('0x37')][_0xf0ac('0x42')]({'where':{'id':_0x3dde36[_0xf0ac('0x3d')]['id']}})[_0xf0ac('0x1e')](handleEntityNotFound(_0x1efc9e,null))['then'](saveUpdates(_0x3dde36['body'],null))[_0xf0ac('0x1e')](respondWithResult(_0x1efc9e,null))['catch'](handleError(_0x1efc9e,null));};exports['destroy']=function(_0x16252d,_0x4bd6ac){return db['MailSubstatus'][_0xf0ac('0x42')]({'where':{'id':_0x16252d['params']['id']}})['then'](handleEntityNotFound(_0x4bd6ac,null))[_0xf0ac('0x1e')](removeEntity(_0x4bd6ac,null))[_0xf0ac('0x3b')](handleError(_0x4bd6ac,null));};exports[_0xf0ac('0x43')]=function(_0x14849c,_0x1bd77e){return db[_0xf0ac('0x37')][_0xf0ac('0x43')]()[_0xf0ac('0x1e')](respondWithResult(_0x1bd77e,null))[_0xf0ac('0x3b')](handleError(_0x1bd77e,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index 134e3d5..c2692f6 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 _0x6aeb=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./mailSubstatus.attributes','exports','MailSubstatus','mail_substatuses','lodash','util'];(function(_0xeb31d6,_0x36dda8){var _0x2f7189=function(_0x5dd436){while(--_0x5dd436){_0xeb31d6['push'](_0xeb31d6['shift']());}};_0x2f7189(++_0x36dda8);}(_0x6aeb,0x10f));var _0xb6ae=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x6aeb[_0x409deb];return _0x15a4f7;};'use strict';var _=require(_0xb6ae('0x0'));var util=require(_0xb6ae('0x1'));var logger=require(_0xb6ae('0x2'))(_0xb6ae('0x3'));var moment=require('moment');var BPromise=require(_0xb6ae('0x4'));var rp=require(_0xb6ae('0x5'));var fs=require('fs');var path=require(_0xb6ae('0x6'));var rimraf=require(_0xb6ae('0x7'));var config=require(_0xb6ae('0x8'));var attributes=require(_0xb6ae('0x9'));module[_0xb6ae('0xa')]=function(_0x3657ec,_0x1d3465){return _0x3657ec['define'](_0xb6ae('0xb'),attributes,{'tableName':_0xb6ae('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x423d=['path','rimraf','exports','define','MailSubstatus','mail_substatuses','util','../../config/logger','api','request-promise'];(function(_0x5e11ff,_0x247853){var _0x38498e=function(_0x410d6e){while(--_0x410d6e){_0x5e11ff['push'](_0x5e11ff['shift']());}};_0x38498e(++_0x247853);}(_0x423d,0x74));var _0xd423=function(_0x9224b5,_0x2617be){_0x9224b5=_0x9224b5-0x0;var _0x189042=_0x423d[_0x9224b5];return _0x189042;};'use strict';var _=require('lodash');var util=require(_0xd423('0x0'));var logger=require(_0xd423('0x1'))(_0xd423('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd423('0x3'));var fs=require('fs');var path=require(_0xd423('0x4'));var rimraf=require(_0xd423('0x5'));var config=require('../../config/environment');var attributes=require('./mailSubstatus.attributes');module[_0xd423('0x6')]=function(_0x21720d,_0xb489d5){return _0x21720d[_0xd423('0x7')](_0xd423('0x8'),attributes,{'tableName':_0xd423('0x9'),'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 9e5c9e9..677e482 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 _0x143b=['../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','stringify','error','code','message','MailSubstatus,\x20%s,\x20%s','catch','lodash','util','moment','bluebird','randomstring','ioredis'];(function(_0x55dce1,_0x5dd91e){var _0x431f64=function(_0x5aa8f6){while(--_0x5aa8f6){_0x55dce1['push'](_0x55dce1['shift']());}};_0x431f64(++_0x5dd91e);}(_0x143b,0x118));var _0xb143=function(_0x42a82b,_0x456c7b){_0x42a82b=_0x42a82b-0x0;var _0x3c7443=_0x143b[_0x42a82b];return _0x3c7443;};'use strict';var _=require(_0xb143('0x0'));var util=require(_0xb143('0x1'));var moment=require(_0xb143('0x2'));var BPromise=require(_0xb143('0x3'));var rs=require(_0xb143('0x4'));var fs=require('fs');var Redis=require(_0xb143('0x5'));var db=require(_0xb143('0x6'))['db'];var utils=require(_0xb143('0x7'));var logger=require(_0xb143('0x8'))('rpc');var config=require(_0xb143('0x9'));var jayson=require(_0xb143('0xa'));var client=jayson['client'][_0xb143('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1481a5,_0x5fd80c,_0x5ce53e){return new BPromise(function(_0x194ee9,_0x387029){return client[_0xb143('0xc')](_0x1481a5,_0x5ce53e)[_0xb143('0xd')](function(_0x127a1f){logger[_0xb143('0xe')]('MailSubstatus,\x20%s,\x20%s',_0x5fd80c,_0xb143('0xf'));logger['debug']('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x5fd80c,_0xb143('0xf'),JSON[_0xb143('0x10')](_0x127a1f));if(_0x127a1f[_0xb143('0x11')]){if(_0x127a1f['error'][_0xb143('0x12')]===0x1f4){logger[_0xb143('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x5fd80c,_0x127a1f[_0xb143('0x11')][_0xb143('0x13')]);return _0x387029(_0x127a1f[_0xb143('0x11')][_0xb143('0x13')]);}logger[_0xb143('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x5fd80c,_0x127a1f[_0xb143('0x11')]['message']);return _0x194ee9(_0x127a1f[_0xb143('0x11')]['message']);}else{logger[_0xb143('0xe')](_0xb143('0x14'),_0x5fd80c,_0xb143('0xf'));_0x194ee9(_0x127a1f['result']['message']);}})[_0xb143('0x15')](function(_0x8255b7){logger[_0xb143('0x11')]('MailSubstatus,\x20%s,\x20%s',_0x5fd80c,_0x8255b7);_0x387029(_0x8255b7);});});} \ No newline at end of file +var _0xceae=['MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0xceae,0x122));var _0xecea=function(_0x2f421,_0x5144c4){_0x2f421=_0x2f421-0x0;var _0x27b4af=_0xceae[_0x2f421];return _0x27b4af;};'use strict';var _=require(_0xecea('0x0'));var util=require(_0xecea('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecea('0x2'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xecea('0x3'))(_0xecea('0x4'));var config=require(_0xecea('0x5'));var jayson=require(_0xecea('0x6'));var client=jayson[_0xecea('0x7')][_0xecea('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a3f5b,_0x242ea0,_0x1663e2){return new BPromise(function(_0x46bb33,_0x4b973b){return client[_0xecea('0x9')](_0x2a3f5b,_0x1663e2)['then'](function(_0x379b2c){logger[_0xecea('0xa')](_0xecea('0xb'),_0x242ea0,_0xecea('0xc'));logger[_0xecea('0xd')](_0xecea('0xe'),_0x242ea0,_0xecea('0xc'),JSON[_0xecea('0xf')](_0x379b2c));if(_0x379b2c[_0xecea('0x10')]){if(_0x379b2c[_0xecea('0x10')][_0xecea('0x11')]===0x1f4){logger['error']('MailSubstatus,\x20%s,\x20%s',_0x242ea0,_0x379b2c['error'][_0xecea('0x12')]);return _0x4b973b(_0x379b2c['error'][_0xecea('0x12')]);}logger[_0xecea('0x10')](_0xecea('0xb'),_0x242ea0,_0x379b2c[_0xecea('0x10')][_0xecea('0x12')]);return _0x46bb33(_0x379b2c[_0xecea('0x10')]['message']);}else{logger[_0xecea('0xa')](_0xecea('0xb'),_0x242ea0,_0xecea('0xc'));_0x46bb33(_0x379b2c['result'][_0xecea('0x12')]);}})['catch'](function(_0x308efc){logger['error'](_0xecea('0xb'),_0x242ea0,_0x308efc);_0x4b973b(_0x308efc);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 938b18c..b3a955f 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 _0x789b=['../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','exports','multer','util','connect-timeout','express','Router'];(function(_0x5df5fe,_0x1c5c4b){var _0xba5526=function(_0x370b04){while(--_0x370b04){_0x5df5fe['push'](_0x5df5fe['shift']());}};_0xba5526(++_0x1c5c4b);}(_0x789b,0x118));var _0xb789=function(_0x5acb0a,_0x491735){_0x5acb0a=_0x5acb0a-0x0;var _0xfab89b=_0x789b[_0x5acb0a];return _0xfab89b;};'use strict';var multer=require(_0xb789('0x0'));var util=require(_0xb789('0x1'));var path=require('path');var timeout=require(_0xb789('0x2'));var express=require(_0xb789('0x3'));var router=express[_0xb789('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb789('0x5'));var interaction=require(_0xb789('0x6'));var config=require(_0xb789('0x7'));var controller=require('./mailTransferReport.controller');router[_0xb789('0x8')]('/',auth[_0xb789('0x9')](),controller['index']);router[_0xb789('0x8')](_0xb789('0xa'),auth[_0xb789('0x9')](),controller[_0xb789('0xb')]);router[_0xb789('0x8')](_0xb789('0xc'),auth[_0xb789('0x9')](),controller[_0xb789('0xd')]);router[_0xb789('0xe')]('/',auth[_0xb789('0x9')](),controller[_0xb789('0xf')]);router[_0xb789('0x10')]('/:id',auth[_0xb789('0x9')](),controller[_0xb789('0x11')]);router['delete'](_0xb789('0xc'),auth[_0xb789('0x9')](),controller['destroy']);module[_0xb789('0x12')]=router; \ No newline at end of file +var _0xe43d=['path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','update','destroy','exports','multer','util'];(function(_0x43a24f,_0x57c165){var _0x7156fe=function(_0x1be968){while(--_0x1be968){_0x43a24f['push'](_0x43a24f['shift']());}};_0x7156fe(++_0x57c165);}(_0xe43d,0x18d));var _0xde43=function(_0x5c06fe,_0x12193a){_0x5c06fe=_0x5c06fe-0x0;var _0xf8ec9a=_0xe43d[_0x5c06fe];return _0xf8ec9a;};'use strict';var multer=require(_0xde43('0x0'));var util=require(_0xde43('0x1'));var path=require(_0xde43('0x2'));var timeout=require('connect-timeout');var express=require(_0xde43('0x3'));var router=express[_0xde43('0x4')]();var fs_extra=require(_0xde43('0x5'));var auth=require(_0xde43('0x6'));var interaction=require(_0xde43('0x7'));var config=require(_0xde43('0x8'));var controller=require(_0xde43('0x9'));router[_0xde43('0xa')]('/',auth[_0xde43('0xb')](),controller['index']);router[_0xde43('0xa')](_0xde43('0xc'),auth[_0xde43('0xb')](),controller[_0xde43('0xd')]);router[_0xde43('0xa')](_0xde43('0xe'),auth[_0xde43('0xb')](),controller[_0xde43('0xf')]);router['post']('/',auth[_0xde43('0xb')](),controller['create']);router['put'](_0xde43('0xe'),auth[_0xde43('0xb')](),controller[_0xde43('0x10')]);router['delete'](_0xde43('0xe'),auth[_0xde43('0xb')](),controller[_0xde43('0x11')]);module[_0xde43('0x12')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 362c597..1d1d407 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 _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x466451,_0x5c195e){var _0x10b5ba=function(_0xf7a131){while(--_0xf7a131){_0x466451['push'](_0x466451['shift']());}};_0x10b5ba(++_0x5c195e);}(_0xaa88,0x137));var _0x8aa8=function(_0x12d6c2,_0x409bc8){_0x12d6c2=_0x12d6c2-0x0;var _0x1c9825=_0xaa88[_0x12d6c2];return _0x1c9825;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file +var _0x54ef=['agent','queue','DATE','NOW','moment','sequelize','exports','ENUM','account'];(function(_0x511d17,_0x9ad3ba){var _0x4f42e3=function(_0x5cc40f){while(--_0x5cc40f){_0x511d17['push'](_0x511d17['shift']());}};_0x4f42e3(++_0x9ad3ba);}(_0x54ef,0x112));var _0xf54e=function(_0xb07fa6,_0x51a4b8){_0xb07fa6=_0xb07fa6-0x0;var _0x3599d9=_0x54ef[_0xb07fa6];return _0x3599d9;};'use strict';var moment=require(_0xf54e('0x0'));var Sequelize=require(_0xf54e('0x1'));module[_0xf54e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xf54e('0x3')](_0xf54e('0x4'),_0xf54e('0x5'),_0xf54e('0x6')),'allowNull':![],'defaultValue':_0xf54e('0x6')},'transferredAt':{'type':Sequelize[_0xf54e('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xf54e('0x8')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 7301137..8096f69 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 _0xe674=['order','sort','where','filters','pick','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','params','rawAttributes','keys','merge','create','body','find','describe','eml-format','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailTransferReport','fieldName','type','model','query','attributes','intersection','fields','length','nolimit'];(function(_0x2f75ce,_0x229bf4){var _0x5f1f2d=function(_0x4d4b96){while(--_0x4d4b96){_0x2f75ce['push'](_0x2f75ce['shift']());}};_0x5f1f2d(++_0x229bf4);}(_0xe674,0x1e3));var _0x4e67=function(_0x565c54,_0xb4f4ad){_0x565c54=_0x565c54-0x0;var _0x17092f=_0xe674[_0x565c54];return _0x17092f;};'use strict';var emlformat=require(_0x4e67('0x0'));var rimraf=require(_0x4e67('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4e67('0x2'));var rp=require('request-promise');var moment=require(_0x4e67('0x3'));var BPromise=require(_0x4e67('0x4'));var Mustache=require('mustache');var util=require(_0x4e67('0x5'));var path=require(_0x4e67('0x6'));var sox=require(_0x4e67('0x7'));var csv=require(_0x4e67('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e67('0x9'));var _=require(_0x4e67('0xa'));var squel=require(_0x4e67('0xb'));var crypto=require(_0x4e67('0xc'));var jsforce=require(_0x4e67('0xd'));var deskjs=require(_0x4e67('0xe'));var toCsv=require('to-csv');var querystring=require(_0x4e67('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x4e67('0x10'));var qs=require(_0x4e67('0x11'));var as=require(_0x4e67('0x12'));var hardwareService=require(_0x4e67('0x13'));var logger=require(_0x4e67('0x14'))(_0x4e67('0x15'));var utils=require('../../config/utils');var config=require(_0x4e67('0x16'));var licenseUtil=require(_0x4e67('0x17'));var db=require(_0x4e67('0x18'))['db'];function respondWithStatusCode(_0x10a968,_0x2d8884){_0x2d8884=_0x2d8884||0xcc;return function(_0x111aaf){if(_0x111aaf){return _0x10a968[_0x4e67('0x19')](_0x2d8884);}return _0x10a968[_0x4e67('0x1a')](_0x2d8884)[_0x4e67('0x1b')]();};}function respondWithResult(_0x593d78,_0x1b5e08){_0x1b5e08=_0x1b5e08||0xc8;return function(_0x25b9e4){if(_0x25b9e4){return _0x593d78[_0x4e67('0x1a')](_0x1b5e08)[_0x4e67('0x1c')](_0x25b9e4);}};}function respondWithFilteredResult(_0x480105,_0x2b1ecd){return function(_0x46c171){if(_0x46c171){var _0x476d6f=typeof _0x2b1ecd[_0x4e67('0x1d')]===_0x4e67('0x1e')&&typeof _0x2b1ecd[_0x4e67('0x1f')]==='undefined';var _0x2ff6a7=_0x46c171['count'];var _0x193306=_0x476d6f?0x0:_0x2b1ecd[_0x4e67('0x1d')];var _0x548f02=_0x476d6f?_0x46c171[_0x4e67('0x20')]:_0x2b1ecd[_0x4e67('0x1d')]+_0x2b1ecd[_0x4e67('0x1f')];var _0x369d82;if(_0x548f02>=_0x2ff6a7){_0x548f02=_0x2ff6a7;_0x369d82=0xc8;}else{_0x369d82=0xce;}_0x480105[_0x4e67('0x1a')](_0x369d82);return _0x480105[_0x4e67('0x21')]('Content-Range',_0x193306+'-'+_0x548f02+'/'+_0x2ff6a7)[_0x4e67('0x1c')](_0x46c171);}return null;};}function patchUpdates(_0x39f0d9){return function(_0x338c00){try{jsonpatch[_0x4e67('0x22')](_0x338c00,_0x39f0d9,!![]);}catch(_0x4daad2){return BPromise[_0x4e67('0x23')](_0x4daad2);}return _0x338c00[_0x4e67('0x24')]();};}function saveUpdates(_0x49806b,_0xae6213){return function(_0x1378f0){if(_0x1378f0){return _0x1378f0[_0x4e67('0x25')](_0x49806b)[_0x4e67('0x26')](function(_0x57304e){return _0x57304e;});}return null;};}function removeEntity(_0x4b6c84,_0x58491b){return function(_0x333106){if(_0x333106){return _0x333106[_0x4e67('0x27')]()[_0x4e67('0x26')](function(){_0x4b6c84[_0x4e67('0x1a')](0xcc)[_0x4e67('0x1b')]();});}};}function handleEntityNotFound(_0x363957,_0x286f8b){return function(_0x3fae2d){if(!_0x3fae2d){_0x363957[_0x4e67('0x19')](0x194);}return _0x3fae2d;};}function handleError(_0x270b84,_0xa2559a){_0xa2559a=_0xa2559a||0x1f4;return function(_0x3670a0){logger[_0x4e67('0x28')](_0x3670a0[_0x4e67('0x29')]);if(_0x3670a0['name']){delete _0x3670a0[_0x4e67('0x2a')];}_0x270b84['status'](_0xa2559a)[_0x4e67('0x2b')](_0x3670a0);};}exports[_0x4e67('0x2c')]=function(_0x1b4aca,_0x1df06e){var _0x1b518c={},_0x106233={},_0x3915fe={'count':0x0,'rows':[]};var _0x42ad25=_[_0x4e67('0x2d')](db[_0x4e67('0x2e')]['rawAttributes'],function(_0x206830){return{'name':_0x206830[_0x4e67('0x2f')],'type':_0x206830[_0x4e67('0x30')]['key']};});_0x106233[_0x4e67('0x31')]=_['map'](_0x42ad25,'name');_0x106233['query']=_['keys'](_0x1b4aca['query']);_0x106233['filters']=_['intersection'](_0x106233[_0x4e67('0x31')],_0x106233[_0x4e67('0x32')]);_0x1b518c[_0x4e67('0x33')]=_[_0x4e67('0x34')](_0x106233[_0x4e67('0x31')],qs[_0x4e67('0x35')](_0x1b4aca[_0x4e67('0x32')]['fields']));_0x1b518c[_0x4e67('0x33')]=_0x1b518c[_0x4e67('0x33')][_0x4e67('0x36')]?_0x1b518c[_0x4e67('0x33')]:_0x106233[_0x4e67('0x31')];if(!_0x1b4aca[_0x4e67('0x32')]['hasOwnProperty'](_0x4e67('0x37'))){_0x1b518c[_0x4e67('0x1f')]=qs['limit'](_0x1b4aca['query'][_0x4e67('0x1f')]);_0x1b518c['offset']=qs['offset'](_0x1b4aca['query'][_0x4e67('0x1d')]);}_0x1b518c[_0x4e67('0x38')]=qs[_0x4e67('0x39')](_0x1b4aca[_0x4e67('0x32')][_0x4e67('0x39')]);_0x1b518c[_0x4e67('0x3a')]=qs[_0x4e67('0x3b')](_[_0x4e67('0x3c')](_0x1b4aca['query'],_0x106233[_0x4e67('0x3b')]),_0x42ad25);if(_0x1b4aca[_0x4e67('0x32')]['filter']){_0x1b518c['where']=_['merge'](_0x1b518c['where'],{'$or':_[_0x4e67('0x2d')](_0x42ad25,function(_0x4e3018){if(_0x4e3018['type']!==_0x4e67('0x3d')){var _0x252aa3={};_0x252aa3[_0x4e3018[_0x4e67('0x2a')]]={'$like':'%'+_0x1b4aca[_0x4e67('0x32')][_0x4e67('0x3e')]+'%'};return _0x252aa3;}})});}_0x1b518c=_['merge']({},_0x1b518c,_0x1b4aca[_0x4e67('0x3f')]);var _0x412ab1={'where':_0x1b518c['where']};return db[_0x4e67('0x2e')][_0x4e67('0x20')](_0x412ab1)['then'](function(_0x5e8488){_0x3915fe[_0x4e67('0x20')]=_0x5e8488;if(_0x1b4aca[_0x4e67('0x32')][_0x4e67('0x40')]){_0x1b518c[_0x4e67('0x41')]=[{'all':!![]}];}return db['MailTransferReport'][_0x4e67('0x42')](_0x1b518c);})[_0x4e67('0x26')](function(_0x3d2da1){_0x3915fe[_0x4e67('0x43')]=_0x3d2da1;return _0x3915fe;})[_0x4e67('0x26')](respondWithFilteredResult(_0x1df06e,_0x1b518c))[_0x4e67('0x44')](handleError(_0x1df06e,null));};exports['show']=function(_0x355e93,_0x38537d){var _0x5a15e8={'raw':!![],'where':{'id':_0x355e93[_0x4e67('0x45')]['id']}},_0x5b060a={};_0x5b060a[_0x4e67('0x31')]=_['keys'](db[_0x4e67('0x2e')][_0x4e67('0x46')]);_0x5b060a[_0x4e67('0x32')]=_[_0x4e67('0x47')](_0x355e93['query']);_0x5b060a[_0x4e67('0x3b')]=_[_0x4e67('0x34')](_0x5b060a[_0x4e67('0x31')],_0x5b060a[_0x4e67('0x32')]);_0x5a15e8[_0x4e67('0x33')]=_[_0x4e67('0x34')](_0x5b060a[_0x4e67('0x31')],qs[_0x4e67('0x35')](_0x355e93[_0x4e67('0x32')][_0x4e67('0x35')]));_0x5a15e8[_0x4e67('0x33')]=_0x5a15e8['attributes']['length']?_0x5a15e8['attributes']:_0x5b060a['model'];if(_0x355e93[_0x4e67('0x32')][_0x4e67('0x40')]){_0x5a15e8[_0x4e67('0x41')]=[{'all':!![]}];}_0x5a15e8=_[_0x4e67('0x48')]({},_0x5a15e8,_0x355e93[_0x4e67('0x3f')]);return db[_0x4e67('0x2e')]['find'](_0x5a15e8)[_0x4e67('0x26')](handleEntityNotFound(_0x38537d,null))['then'](respondWithResult(_0x38537d,null))['catch'](handleError(_0x38537d,null));};exports[_0x4e67('0x49')]=function(_0x4c2731,_0x22184e){return db['MailTransferReport'][_0x4e67('0x49')](_0x4c2731[_0x4e67('0x4a')],{})[_0x4e67('0x26')](respondWithResult(_0x22184e,0xc9))[_0x4e67('0x44')](handleError(_0x22184e,null));};exports[_0x4e67('0x25')]=function(_0x4f782b,_0x3c9376){if(_0x4f782b[_0x4e67('0x4a')]['id']){delete _0x4f782b[_0x4e67('0x4a')]['id'];}return db[_0x4e67('0x2e')][_0x4e67('0x4b')]({'where':{'id':_0x4f782b[_0x4e67('0x45')]['id']}})[_0x4e67('0x26')](handleEntityNotFound(_0x3c9376,null))['then'](saveUpdates(_0x4f782b[_0x4e67('0x4a')],null))[_0x4e67('0x26')](respondWithResult(_0x3c9376,null))[_0x4e67('0x44')](handleError(_0x3c9376,null));};exports[_0x4e67('0x27')]=function(_0x1523a8,_0x5de233){return db[_0x4e67('0x2e')]['find']({'where':{'id':_0x1523a8['params']['id']}})[_0x4e67('0x26')](handleEntityNotFound(_0x5de233,null))[_0x4e67('0x26')](removeEntity(_0x5de233,null))[_0x4e67('0x44')](handleError(_0x5de233,null));};exports[_0x4e67('0x4c')]=function(_0x12aca7,_0x16766e){return db[_0x4e67('0x2e')][_0x4e67('0x4c')]()[_0x4e67('0x26')](respondWithResult(_0x16766e,null))[_0x4e67('0x44')](handleError(_0x16766e,null));}; \ No newline at end of file +var _0x8369=['update','then','name','send','index','map','rawAttributes','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','MailTransferReport','includeAll','findAll','rows','catch','params','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save'];(function(_0x2d743c,_0x490451){var _0x32c6af=function(_0x26fa96){while(--_0x26fa96){_0x2d743c['push'](_0x2d743c['shift']());}};_0x32c6af(++_0x490451);}(_0x8369,0x151));var _0x9836=function(_0x298636,_0x1affab){_0x298636=_0x298636-0x0;var _0x1f9e79=_0x8369[_0x298636];return _0x1f9e79;};'use strict';var emlformat=require(_0x9836('0x0'));var rimraf=require(_0x9836('0x1'));var zipdir=require(_0x9836('0x2'));var jsonpatch=require(_0x9836('0x3'));var rp=require(_0x9836('0x4'));var moment=require('moment');var BPromise=require(_0x9836('0x5'));var Mustache=require('mustache');var util=require(_0x9836('0x6'));var path=require('path');var sox=require(_0x9836('0x7'));var csv=require(_0x9836('0x8'));var ejs=require(_0x9836('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9836('0xa'));var squel=require(_0x9836('0xb'));var crypto=require(_0x9836('0xc'));var jsforce=require(_0x9836('0xd'));var deskjs=require(_0x9836('0xe'));var toCsv=require(_0x9836('0x8'));var querystring=require(_0x9836('0xf'));var Papa=require(_0x9836('0x10'));var Redis=require(_0x9836('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x9836('0x12'));var as=require(_0x9836('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9836('0x14'))(_0x9836('0x15'));var utils=require(_0x9836('0x16'));var config=require(_0x9836('0x17'));var licenseUtil=require(_0x9836('0x18'));var db=require(_0x9836('0x19'))['db'];function respondWithStatusCode(_0x1fecdf,_0x13081a){_0x13081a=_0x13081a||0xcc;return function(_0x10f155){if(_0x10f155){return _0x1fecdf[_0x9836('0x1a')](_0x13081a);}return _0x1fecdf[_0x9836('0x1b')](_0x13081a)[_0x9836('0x1c')]();};}function respondWithResult(_0x3777bd,_0x363308){_0x363308=_0x363308||0xc8;return function(_0x31401a){if(_0x31401a){return _0x3777bd[_0x9836('0x1b')](_0x363308)[_0x9836('0x1d')](_0x31401a);}};}function respondWithFilteredResult(_0x8cb6fd,_0x4fffb6){return function(_0x3041bb){if(_0x3041bb){var _0x37cbe7=typeof _0x4fffb6[_0x9836('0x1e')]==='undefined'&&typeof _0x4fffb6[_0x9836('0x1f')]==='undefined';var _0x583381=_0x3041bb[_0x9836('0x20')];var _0x130e13=_0x37cbe7?0x0:_0x4fffb6[_0x9836('0x1e')];var _0x14cab7=_0x37cbe7?_0x3041bb['count']:_0x4fffb6[_0x9836('0x1e')]+_0x4fffb6[_0x9836('0x1f')];var _0x4d1ed4;if(_0x14cab7>=_0x583381){_0x14cab7=_0x583381;_0x4d1ed4=0xc8;}else{_0x4d1ed4=0xce;}_0x8cb6fd['status'](_0x4d1ed4);return _0x8cb6fd[_0x9836('0x21')](_0x9836('0x22'),_0x130e13+'-'+_0x14cab7+'/'+_0x583381)[_0x9836('0x1d')](_0x3041bb);}return null;};}function patchUpdates(_0x4a73a1){return function(_0x4fb4c8){try{jsonpatch[_0x9836('0x23')](_0x4fb4c8,_0x4a73a1,!![]);}catch(_0x12a8d7){return BPromise[_0x9836('0x24')](_0x12a8d7);}return _0x4fb4c8[_0x9836('0x25')]();};}function saveUpdates(_0x46886b,_0x356768){return function(_0x2606af){if(_0x2606af){return _0x2606af[_0x9836('0x26')](_0x46886b)[_0x9836('0x27')](function(_0x4dcf44){return _0x4dcf44;});}return null;};}function removeEntity(_0x4c32f5,_0x5e9ab8){return function(_0x131772){if(_0x131772){return _0x131772['destroy']()[_0x9836('0x27')](function(){_0x4c32f5[_0x9836('0x1b')](0xcc)[_0x9836('0x1c')]();});}};}function handleEntityNotFound(_0x2adf38,_0x33a59e){return function(_0x31545e){if(!_0x31545e){_0x2adf38['sendStatus'](0x194);}return _0x31545e;};}function handleError(_0x2f3c1e,_0xf9e915){_0xf9e915=_0xf9e915||0x1f4;return function(_0x255848){logger['error'](_0x255848['stack']);if(_0x255848[_0x9836('0x28')]){delete _0x255848[_0x9836('0x28')];}_0x2f3c1e['status'](_0xf9e915)[_0x9836('0x29')](_0x255848);};}exports[_0x9836('0x2a')]=function(_0x11ccd5,_0x34167b){var _0x217e19={},_0x9fceb={},_0x672c79={'count':0x0,'rows':[]};var _0x2a19f2=_[_0x9836('0x2b')](db['MailTransferReport'][_0x9836('0x2c')],function(_0x4f546b){return{'name':_0x4f546b['fieldName'],'type':_0x4f546b[_0x9836('0x2d')][_0x9836('0x2e')]};});_0x9fceb['model']=_[_0x9836('0x2b')](_0x2a19f2,_0x9836('0x28'));_0x9fceb[_0x9836('0x2f')]=_[_0x9836('0x30')](_0x11ccd5[_0x9836('0x2f')]);_0x9fceb[_0x9836('0x31')]=_[_0x9836('0x32')](_0x9fceb['model'],_0x9fceb[_0x9836('0x2f')]);_0x217e19['attributes']=_[_0x9836('0x32')](_0x9fceb['model'],qs['fields'](_0x11ccd5[_0x9836('0x2f')][_0x9836('0x33')]));_0x217e19[_0x9836('0x34')]=_0x217e19[_0x9836('0x34')][_0x9836('0x35')]?_0x217e19['attributes']:_0x9fceb[_0x9836('0x36')];if(!_0x11ccd5[_0x9836('0x2f')][_0x9836('0x37')](_0x9836('0x38'))){_0x217e19[_0x9836('0x1f')]=qs[_0x9836('0x1f')](_0x11ccd5[_0x9836('0x2f')]['limit']);_0x217e19['offset']=qs['offset'](_0x11ccd5[_0x9836('0x2f')][_0x9836('0x1e')]);}_0x217e19[_0x9836('0x39')]=qs[_0x9836('0x3a')](_0x11ccd5[_0x9836('0x2f')][_0x9836('0x3a')]);_0x217e19[_0x9836('0x3b')]=qs[_0x9836('0x31')](_[_0x9836('0x3c')](_0x11ccd5[_0x9836('0x2f')],_0x9fceb[_0x9836('0x31')]),_0x2a19f2);if(_0x11ccd5[_0x9836('0x2f')][_0x9836('0x3d')]){_0x217e19['where']=_[_0x9836('0x3e')](_0x217e19[_0x9836('0x3b')],{'$or':_[_0x9836('0x2b')](_0x2a19f2,function(_0x8e13cb){if(_0x8e13cb[_0x9836('0x2d')]!==_0x9836('0x3f')){var _0x479868={};_0x479868[_0x8e13cb[_0x9836('0x28')]]={'$like':'%'+_0x11ccd5[_0x9836('0x2f')][_0x9836('0x3d')]+'%'};return _0x479868;}})});}_0x217e19=_[_0x9836('0x3e')]({},_0x217e19,_0x11ccd5['options']);var _0x18bc1d={'where':_0x217e19['where']};return db[_0x9836('0x40')][_0x9836('0x20')](_0x18bc1d)[_0x9836('0x27')](function(_0x5a17ed){_0x672c79[_0x9836('0x20')]=_0x5a17ed;if(_0x11ccd5[_0x9836('0x2f')][_0x9836('0x41')]){_0x217e19['include']=[{'all':!![]}];}return db[_0x9836('0x40')][_0x9836('0x42')](_0x217e19);})[_0x9836('0x27')](function(_0x3cafd8){_0x672c79[_0x9836('0x43')]=_0x3cafd8;return _0x672c79;})[_0x9836('0x27')](respondWithFilteredResult(_0x34167b,_0x217e19))[_0x9836('0x44')](handleError(_0x34167b,null));};exports['show']=function(_0x46b11e,_0x569ace){var _0x43ee2f={'raw':!![],'where':{'id':_0x46b11e[_0x9836('0x45')]['id']}},_0x35e9c8={};_0x35e9c8[_0x9836('0x36')]=_['keys'](db[_0x9836('0x40')][_0x9836('0x2c')]);_0x35e9c8['query']=_[_0x9836('0x30')](_0x46b11e[_0x9836('0x2f')]);_0x35e9c8['filters']=_['intersection'](_0x35e9c8[_0x9836('0x36')],_0x35e9c8[_0x9836('0x2f')]);_0x43ee2f[_0x9836('0x34')]=_[_0x9836('0x32')](_0x35e9c8[_0x9836('0x36')],qs[_0x9836('0x33')](_0x46b11e['query'][_0x9836('0x33')]));_0x43ee2f[_0x9836('0x34')]=_0x43ee2f[_0x9836('0x34')][_0x9836('0x35')]?_0x43ee2f[_0x9836('0x34')]:_0x35e9c8[_0x9836('0x36')];if(_0x46b11e['query'][_0x9836('0x41')]){_0x43ee2f['include']=[{'all':!![]}];}_0x43ee2f=_[_0x9836('0x3e')]({},_0x43ee2f,_0x46b11e['options']);return db[_0x9836('0x40')][_0x9836('0x46')](_0x43ee2f)[_0x9836('0x27')](handleEntityNotFound(_0x569ace,null))[_0x9836('0x27')](respondWithResult(_0x569ace,null))[_0x9836('0x44')](handleError(_0x569ace,null));};exports[_0x9836('0x47')]=function(_0x2a716e,_0xc9ee49){return db['MailTransferReport'][_0x9836('0x47')](_0x2a716e[_0x9836('0x48')],{})['then'](respondWithResult(_0xc9ee49,0xc9))[_0x9836('0x44')](handleError(_0xc9ee49,null));};exports[_0x9836('0x26')]=function(_0x257dea,_0x18c851){if(_0x257dea['body']['id']){delete _0x257dea[_0x9836('0x48')]['id'];}return db['MailTransferReport']['find']({'where':{'id':_0x257dea['params']['id']}})[_0x9836('0x27')](handleEntityNotFound(_0x18c851,null))['then'](saveUpdates(_0x257dea[_0x9836('0x48')],null))[_0x9836('0x27')](respondWithResult(_0x18c851,null))['catch'](handleError(_0x18c851,null));};exports[_0x9836('0x49')]=function(_0x5662ab,_0x54fbd4){return db['MailTransferReport'][_0x9836('0x46')]({'where':{'id':_0x5662ab['params']['id']}})[_0x9836('0x27')](handleEntityNotFound(_0x54fbd4,null))['then'](removeEntity(_0x54fbd4,null))['catch'](handleError(_0x54fbd4,null));};exports[_0x9836('0x4a')]=function(_0x1a5997,_0x26e459){return db[_0x9836('0x40')][_0x9836('0x4a')]()[_0x9836('0x27')](respondWithResult(_0x26e459,null))['catch'](handleError(_0x26e459,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index 78a4e50..f7744d3 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 _0x55ca=['request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','exports','define','report_mail_transfer','uniqueid','lodash','util','bluebird'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x55ca,0x126));var _0xa55c=function(_0x326d35,_0x4f65b3){_0x326d35=_0x326d35-0x0;var _0xd3f8f3=_0x55ca[_0x326d35];return _0xd3f8f3;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('MailTransferReport',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[{'name':_0xa55c('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x649b=['request-promise','rimraf','../../config/environment','./mailTransferReport.attributes','define','uniqueid','../../config/logger','api'];(function(_0x2f6f50,_0x1d21a7){var _0x2cf365=function(_0x1c40a7){while(--_0x1c40a7){_0x2f6f50['push'](_0x2f6f50['shift']());}};_0x2cf365(++_0x1d21a7);}(_0x649b,0x166));var _0xb649=function(_0x18d2c1,_0x5a23c4){_0x18d2c1=_0x18d2c1-0x0;var _0x4529d7=_0x649b[_0x18d2c1];return _0x4529d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb649('0x0'))(_0xb649('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb649('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb649('0x3'));var config=require(_0xb649('0x4'));var attributes=require(_0xb649('0x5'));module['exports']=function(_0x2e0402,_0x1d0a04){return _0x2e0402[_0xb649('0x6')]('MailTransferReport',attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xb649('0x7'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index 9e141a7..89bc759 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 _0x45fe=['message','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','MailTransferReport,\x20%s,\x20%s'];(function(_0x5831e3,_0x4b733b){var _0xa219c=function(_0x2d8eb9){while(--_0x2d8eb9){_0x5831e3['push'](_0x5831e3['shift']());}};_0xa219c(++_0x4b733b);}(_0x45fe,0x1cd));var _0xe45f=function(_0x5df25b,_0x1bc928){_0x5df25b=_0x5df25b-0x0;var _0x19f252=_0x45fe[_0x5df25b];return _0x19f252;};'use strict';var _=require(_0xe45f('0x0'));var util=require('util');var moment=require(_0xe45f('0x1'));var BPromise=require(_0xe45f('0x2'));var rs=require(_0xe45f('0x3'));var fs=require('fs');var Redis=require(_0xe45f('0x4'));var db=require(_0xe45f('0x5'))['db'];var utils=require(_0xe45f('0x6'));var logger=require(_0xe45f('0x7'))(_0xe45f('0x8'));var config=require(_0xe45f('0x9'));var jayson=require(_0xe45f('0xa'));var client=jayson[_0xe45f('0xb')][_0xe45f('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2d8d0f,_0x26e9b6,_0x24c48a){return new BPromise(function(_0x5319fd,_0x33914a){return client[_0xe45f('0xd')](_0x2d8d0f,_0x24c48a)['then'](function(_0x34bb90){logger[_0xe45f('0xe')]('MailTransferReport,\x20%s,\x20%s',_0x26e9b6,_0xe45f('0xf'));logger[_0xe45f('0x10')](_0xe45f('0x11'),_0x26e9b6,_0xe45f('0xf'),JSON[_0xe45f('0x12')](_0x34bb90));if(_0x34bb90[_0xe45f('0x13')]){if(_0x34bb90['error'][_0xe45f('0x14')]===0x1f4){logger[_0xe45f('0x13')](_0xe45f('0x15'),_0x26e9b6,_0x34bb90[_0xe45f('0x13')]['message']);return _0x33914a(_0x34bb90['error'][_0xe45f('0x16')]);}logger['error'](_0xe45f('0x15'),_0x26e9b6,_0x34bb90['error']['message']);return _0x5319fd(_0x34bb90[_0xe45f('0x13')]['message']);}else{logger[_0xe45f('0xe')](_0xe45f('0x15'),_0x26e9b6,_0xe45f('0xf'));_0x5319fd(_0x34bb90['result'][_0xe45f('0x16')]);}})['catch'](function(_0x1bb5e6){logger[_0xe45f('0x13')](_0xe45f('0x15'),_0x26e9b6,_0x1bb5e6);_0x33914a(_0x1bb5e6);});});} \ No newline at end of file +var _0x4d1e=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash'];(function(_0x142020,_0x1f7233){var _0x40da8f=function(_0x17f0a3){while(--_0x17f0a3){_0x142020['push'](_0x142020['shift']());}};_0x40da8f(++_0x1f7233);}(_0x4d1e,0x18e));var _0xe4d1=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0x4d1e[_0x263a74];return _0x2aa86c;};'use strict';var _=require(_0xe4d1('0x0'));var util=require(_0xe4d1('0x1'));var moment=require('moment');var BPromise=require(_0xe4d1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d1('0x3'));var db=require(_0xe4d1('0x4'))['db'];var utils=require(_0xe4d1('0x5'));var logger=require(_0xe4d1('0x6'))(_0xe4d1('0x7'));var config=require(_0xe4d1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe4d1('0x9')][_0xe4d1('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4ab0da,_0x2093b4,_0x58c3e1){return new BPromise(function(_0x341d08,_0x3971ed){return client['request'](_0x4ab0da,_0x58c3e1)[_0xe4d1('0xb')](function(_0xae43e0){logger['info'](_0xe4d1('0xc'),_0x2093b4,_0xe4d1('0xd'));logger[_0xe4d1('0xe')](_0xe4d1('0xf'),_0x2093b4,'request\x20sent',JSON[_0xe4d1('0x10')](_0xae43e0));if(_0xae43e0[_0xe4d1('0x11')]){if(_0xae43e0[_0xe4d1('0x11')][_0xe4d1('0x12')]===0x1f4){logger[_0xe4d1('0x11')](_0xe4d1('0xc'),_0x2093b4,_0xae43e0['error'][_0xe4d1('0x13')]);return _0x3971ed(_0xae43e0['error'][_0xe4d1('0x13')]);}logger[_0xe4d1('0x11')](_0xe4d1('0xc'),_0x2093b4,_0xae43e0[_0xe4d1('0x11')][_0xe4d1('0x13')]);return _0x341d08(_0xae43e0[_0xe4d1('0x11')]['message']);}else{logger['info'](_0xe4d1('0xc'),_0x2093b4,'request\x20sent');_0x341d08(_0xae43e0['result'][_0xe4d1('0x13')]);}})[_0xe4d1('0x14')](function(_0x208dc4){logger[_0xe4d1('0x11')](_0xe4d1('0xc'),_0x2093b4,_0x208dc4);_0x3971ed(_0x208dc4);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 654ded9..2c70207 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 _0x8334=['get','isAuthenticated','index','/describe','/:id','create','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./memberReport.controller'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x8334,0x192));var _0x4833=function(_0x2ff384,_0x17c7a0){_0x2ff384=_0x2ff384-0x0;var _0x29de15=_0x8334[_0x2ff384];return _0x29de15;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x4833('0x0'));var express=require(_0x4833('0x1'));var router=express[_0x4833('0x2')]();var fs_extra=require(_0x4833('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x4833('0x4'));var config=require('../../config/environment');var controller=require(_0x4833('0x5'));router[_0x4833('0x6')]('/',auth[_0x4833('0x7')](),controller[_0x4833('0x8')]);router[_0x4833('0x6')](_0x4833('0x9'),auth[_0x4833('0x7')](),controller['describe']);router[_0x4833('0x6')](_0x4833('0xa'),auth[_0x4833('0x7')](),controller['show']);router['post']('/',auth[_0x4833('0x7')](),controller[_0x4833('0xb')]);router[_0x4833('0xc')](_0x4833('0xa'),auth[_0x4833('0x7')](),controller[_0x4833('0xd')]);router[_0x4833('0xe')](_0x4833('0xa'),auth[_0x4833('0x7')](),controller[_0x4833('0xf')]);module[_0x4833('0x10')]=router; \ No newline at end of file +var _0xb143=['show','create','put','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb143,0xf5));var _0x3b14=function(_0x3a186f,_0x1fd391){_0x3a186f=_0x3a186f-0x0;var _0xcd4e18=_0xb143[_0x3a186f];return _0xcd4e18;};'use strict';var multer=require(_0x3b14('0x0'));var util=require(_0x3b14('0x1'));var path=require(_0x3b14('0x2'));var timeout=require(_0x3b14('0x3'));var express=require(_0x3b14('0x4'));var router=express[_0x3b14('0x5')]();var fs_extra=require(_0x3b14('0x6'));var auth=require(_0x3b14('0x7'));var interaction=require(_0x3b14('0x8'));var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x3b14('0x9')]('/',auth[_0x3b14('0xa')](),controller[_0x3b14('0xb')]);router[_0x3b14('0x9')](_0x3b14('0xc'),auth['isAuthenticated'](),controller[_0x3b14('0xd')]);router[_0x3b14('0x9')](_0x3b14('0xe'),auth['isAuthenticated'](),controller[_0x3b14('0xf')]);router['post']('/',auth[_0x3b14('0xa')](),controller[_0x3b14('0x10')]);router[_0x3b14('0x11')](_0x3b14('0xe'),auth[_0x3b14('0xa')](),controller['update']);router['delete']('/:id',auth[_0x3b14('0xa')](),controller[_0x3b14('0x12')]);module[_0x3b14('0x13')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index ab4c6ed..dbaf2cf 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 _0x2bdb=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[destination]','talk:[dial\x20string]','talk:[queue]','sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','enterAt','diff','seconds','setDataValue','exitAt'];(function(_0x11a7b5,_0x85d52e){var _0x57a0af=function(_0x2cf3d3){while(--_0x2cf3d3){_0x11a7b5['push'](_0x11a7b5['shift']());}};_0x57a0af(++_0x85d52e);}(_0x2bdb,0x105));var _0xb2bd=function(_0x1a387c,_0x3a66cc){_0x1a387c=_0x1a387c-0x0;var _0x2b8089=_0x2bdb[_0x1a387c];return _0x2b8089;};'use strict';var Sequelize=require(_0xb2bd('0x0'));var moment=require('moment');module[_0xb2bd('0x1')]={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xb2bd('0x2')]},'interface':{'type':Sequelize[_0xb2bd('0x2')]},'type':{'type':Sequelize[_0xb2bd('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xb2bd('0x3')},'duration':{'type':Sequelize[_0xb2bd('0x4')]},'enterAt':{'type':Sequelize[_0xb2bd('0x5')]},'exitAt':{'type':Sequelize[_0xb2bd('0x5')],'set':function(_0x461137){var _0x2ef40b=moment(_0x461137);var _0x3bff5b=moment(this['getDataValue'](_0xb2bd('0x6')));var _0x4d9d3f=_0x2ef40b[_0xb2bd('0x7')](_0x3bff5b,_0xb2bd('0x8'));this[_0xb2bd('0x9')](_0xb2bd('0xa'),_0x461137);this[_0xb2bd('0x9')](_0xb2bd('0xb'),_0x4d9d3f||null);}},'data1':{'type':Sequelize[_0xb2bd('0x2')],'comment':_0xb2bd('0xc')},'data2':{'type':Sequelize[_0xb2bd('0x2')],'comment':'talk:[start]'},'data3':{'type':Sequelize[_0xb2bd('0x2')],'comment':_0xb2bd('0xd')},'data4':{'type':Sequelize[_0xb2bd('0x2')],'comment':_0xb2bd('0xe')},'data5':{'type':Sequelize[_0xb2bd('0x2')],'comment':_0xb2bd('0xf')},'role':{'type':Sequelize[_0xb2bd('0x2')]},'internal':{'type':Sequelize[_0xb2bd('0x4')]},'uniqueid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x7868=['sequelize','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','diff','seconds','setDataValue','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0x2e92e1,_0x130341){var _0x59593c=function(_0x58e7f7){while(--_0x58e7f7){_0x2e92e1['push'](_0x2e92e1['shift']());}};_0x59593c(++_0x130341);}(_0x7868,0x1c0));var _0x8786=function(_0x5269de,_0x38e931){_0x5269de=_0x5269de-0x0;var _0x1cd8df=_0x7868[_0x5269de];return _0x1cd8df;};'use strict';var Sequelize=require(_0x8786('0x0'));var moment=require('moment');module[_0x8786('0x1')]={'channel':{'type':Sequelize[_0x8786('0x2')]},'membername':{'type':Sequelize[_0x8786('0x2')]},'interface':{'type':Sequelize[_0x8786('0x2')]},'type':{'type':Sequelize[_0x8786('0x2')],'defaultValue':'DEFAULT\x20PAUSE','comment':_0x8786('0x3')},'duration':{'type':Sequelize[_0x8786('0x4')]},'enterAt':{'type':Sequelize[_0x8786('0x5')]},'exitAt':{'type':Sequelize[_0x8786('0x5')],'set':function(_0x121ac4){var _0x2c786d=moment(_0x121ac4);var _0x251045=moment(this[_0x8786('0x6')](_0x8786('0x7')));var _0xe9a88d=_0x2c786d[_0x8786('0x8')](_0x251045,_0x8786('0x9'));this['setDataValue']('exitAt',_0x121ac4);this[_0x8786('0xa')](_0x8786('0xb'),_0xe9a88d||null);}},'data1':{'type':Sequelize[_0x8786('0x2')],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize['STRING'],'comment':_0x8786('0xc')},'data3':{'type':Sequelize['STRING'],'comment':_0x8786('0xd')},'data4':{'type':Sequelize[_0x8786('0x2')],'comment':_0x8786('0xe')},'data5':{'type':Sequelize[_0x8786('0x2')],'comment':_0x8786('0xf')},'role':{'type':Sequelize[_0x8786('0x2')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0x8786('0x2')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 14e70b1..20ce041 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 _0xedd9=['keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','find','create','body','update','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','apply','then','end','error','stack','send','index','map','MemberReport','rawAttributes','fieldName','type','key','model','name','query'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0xedd9,0xfc));var _0x9edd=function(_0x4de6f9,_0x241006){_0x4de6f9=_0x4de6f9-0x0;var _0x31edc3=_0xedd9[_0x4de6f9];return _0x31edc3;};'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 Redis=require(_0x9edd('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x9edd('0x11'));var as=require(_0x9edd('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9edd('0x13'))(_0x9edd('0x14'));var utils=require('../../config/utils');var config=require(_0x9edd('0x15'));var licenseUtil=require(_0x9edd('0x16'));var db=require(_0x9edd('0x17'))['db'];function respondWithStatusCode(_0xfd544a,_0x287ddd){_0x287ddd=_0x287ddd||0xcc;return function(_0x3a7b84){if(_0x3a7b84){return _0xfd544a[_0x9edd('0x18')](_0x287ddd);}return _0xfd544a[_0x9edd('0x19')](_0x287ddd)['end']();};}function respondWithResult(_0x176bfa,_0x44fc7c){_0x44fc7c=_0x44fc7c||0xc8;return function(_0x891832){if(_0x891832){return _0x176bfa[_0x9edd('0x19')](_0x44fc7c)[_0x9edd('0x1a')](_0x891832);}};}function respondWithFilteredResult(_0x338f3c,_0x1042aa){return function(_0x75a4ab){if(_0x75a4ab){var _0x4ea60f=typeof _0x1042aa[_0x9edd('0x1b')]===_0x9edd('0x1c')&&typeof _0x1042aa[_0x9edd('0x1d')]==='undefined';var _0x1b54c0=_0x75a4ab[_0x9edd('0x1e')];var _0x40ba32=_0x4ea60f?0x0:_0x1042aa['offset'];var _0x43dc70=_0x4ea60f?_0x75a4ab['count']:_0x1042aa[_0x9edd('0x1b')]+_0x1042aa[_0x9edd('0x1d')];var _0x4bdb88;if(_0x43dc70>=_0x1b54c0){_0x43dc70=_0x1b54c0;_0x4bdb88=0xc8;}else{_0x4bdb88=0xce;}_0x338f3c['status'](_0x4bdb88);return _0x338f3c[_0x9edd('0x1f')]('Content-Range',_0x40ba32+'-'+_0x43dc70+'/'+_0x1b54c0)[_0x9edd('0x1a')](_0x75a4ab);}return null;};}function patchUpdates(_0x54a03f){return function(_0x535f37){try{jsonpatch[_0x9edd('0x20')](_0x535f37,_0x54a03f,!![]);}catch(_0x1c46a8){return BPromise['reject'](_0x1c46a8);}return _0x535f37['save']();};}function saveUpdates(_0x341d67,_0x186186){return function(_0x477878){if(_0x477878){return _0x477878['update'](_0x341d67)[_0x9edd('0x21')](function(_0x1dca43){return _0x1dca43;});}return null;};}function removeEntity(_0x44a6c1,_0x2ca65f){return function(_0x339a0d){if(_0x339a0d){return _0x339a0d['destroy']()[_0x9edd('0x21')](function(){_0x44a6c1[_0x9edd('0x19')](0xcc)[_0x9edd('0x22')]();});}};}function handleEntityNotFound(_0x2f9f86,_0x310a4d){return function(_0x4d507f){if(!_0x4d507f){_0x2f9f86['sendStatus'](0x194);}return _0x4d507f;};}function handleError(_0x3276ee,_0xfeca7b){_0xfeca7b=_0xfeca7b||0x1f4;return function(_0x8d67aa){logger[_0x9edd('0x23')](_0x8d67aa[_0x9edd('0x24')]);if(_0x8d67aa['name']){delete _0x8d67aa['name'];}_0x3276ee[_0x9edd('0x19')](_0xfeca7b)[_0x9edd('0x25')](_0x8d67aa);};}exports[_0x9edd('0x26')]=function(_0x52746a,_0x238b22){var _0x28cfae={},_0x2ae8dd={},_0x41af53={'count':0x0,'rows':[]};var _0x5eccfb=_[_0x9edd('0x27')](db[_0x9edd('0x28')][_0x9edd('0x29')],function(_0x12c1bc){return{'name':_0x12c1bc[_0x9edd('0x2a')],'type':_0x12c1bc[_0x9edd('0x2b')][_0x9edd('0x2c')]};});_0x2ae8dd[_0x9edd('0x2d')]=_[_0x9edd('0x27')](_0x5eccfb,_0x9edd('0x2e'));_0x2ae8dd[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x52746a[_0x9edd('0x2f')]);_0x2ae8dd[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],_0x2ae8dd[_0x9edd('0x2f')]);_0x28cfae[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x2ae8dd['model'],qs[_0x9edd('0x34')](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x28cfae[_0x9edd('0x33')]=_0x28cfae[_0x9edd('0x33')][_0x9edd('0x35')]?_0x28cfae[_0x9edd('0x33')]:_0x2ae8dd[_0x9edd('0x2d')];if(!_0x52746a[_0x9edd('0x2f')][_0x9edd('0x36')](_0x9edd('0x37'))){_0x28cfae[_0x9edd('0x1d')]=qs[_0x9edd('0x1d')](_0x52746a[_0x9edd('0x2f')]['limit']);_0x28cfae[_0x9edd('0x1b')]=qs['offset'](_0x52746a[_0x9edd('0x2f')][_0x9edd('0x1b')]);}_0x28cfae[_0x9edd('0x38')]=qs[_0x9edd('0x39')](_0x52746a[_0x9edd('0x2f')]['sort']);_0x28cfae[_0x9edd('0x3a')]=qs[_0x9edd('0x31')](_[_0x9edd('0x3b')](_0x52746a[_0x9edd('0x2f')],_0x2ae8dd[_0x9edd('0x31')]),_0x5eccfb);if(_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]){_0x28cfae[_0x9edd('0x3a')]=_[_0x9edd('0x3d')](_0x28cfae[_0x9edd('0x3a')],{'$or':_['map'](_0x5eccfb,function(_0x231604){if(_0x231604['type']!==_0x9edd('0x3e')){var _0x5658d6={};_0x5658d6[_0x231604[_0x9edd('0x2e')]]={'$like':'%'+_0x52746a[_0x9edd('0x2f')][_0x9edd('0x3c')]+'%'};return _0x5658d6;}})});}_0x28cfae=_['merge']({},_0x28cfae,_0x52746a[_0x9edd('0x3f')]);var _0xcbd0ef={'where':_0x28cfae[_0x9edd('0x3a')]};return db['MemberReport'][_0x9edd('0x1e')](_0xcbd0ef)['then'](function(_0x1fc4fb){_0x41af53[_0x9edd('0x1e')]=_0x1fc4fb;if(_0x52746a['query'][_0x9edd('0x40')]){_0x28cfae[_0x9edd('0x41')]=[{'all':!![]}];}return db[_0x9edd('0x28')][_0x9edd('0x42')](_0x28cfae);})['then'](function(_0x449f01){_0x41af53['rows']=_0x449f01;return _0x41af53;})[_0x9edd('0x21')](respondWithFilteredResult(_0x238b22,_0x28cfae))[_0x9edd('0x43')](handleError(_0x238b22,null));};exports['show']=function(_0x318757,_0x49a128){var _0x548299={'raw':!![],'where':{'id':_0x318757[_0x9edd('0x44')]['id']}},_0x369b69={};_0x369b69[_0x9edd('0x2d')]=_[_0x9edd('0x30')](db[_0x9edd('0x28')][_0x9edd('0x29')]);_0x369b69[_0x9edd('0x2f')]=_[_0x9edd('0x30')](_0x318757[_0x9edd('0x2f')]);_0x369b69[_0x9edd('0x31')]=_[_0x9edd('0x32')](_0x369b69[_0x9edd('0x2d')],_0x369b69[_0x9edd('0x2f')]);_0x548299[_0x9edd('0x33')]=_[_0x9edd('0x32')](_0x369b69['model'],qs[_0x9edd('0x34')](_0x318757[_0x9edd('0x2f')][_0x9edd('0x34')]));_0x548299[_0x9edd('0x33')]=_0x548299[_0x9edd('0x33')][_0x9edd('0x35')]?_0x548299[_0x9edd('0x33')]:_0x369b69['model'];if(_0x318757['query']['includeAll']){_0x548299[_0x9edd('0x41')]=[{'all':!![]}];}_0x548299=_['merge']({},_0x548299,_0x318757[_0x9edd('0x3f')]);return db[_0x9edd('0x28')][_0x9edd('0x45')](_0x548299)[_0x9edd('0x21')](handleEntityNotFound(_0x49a128,null))[_0x9edd('0x21')](respondWithResult(_0x49a128,null))['catch'](handleError(_0x49a128,null));};exports[_0x9edd('0x46')]=function(_0x35e63c,_0x40e33d){return db['MemberReport'][_0x9edd('0x46')](_0x35e63c[_0x9edd('0x47')],{})[_0x9edd('0x21')](respondWithResult(_0x40e33d,0xc9))[_0x9edd('0x43')](handleError(_0x40e33d,null));};exports[_0x9edd('0x48')]=function(_0x35bdec,_0x4d4f33){if(_0x35bdec[_0x9edd('0x47')]['id']){delete _0x35bdec[_0x9edd('0x47')]['id'];}return db['MemberReport'][_0x9edd('0x45')]({'where':{'id':_0x35bdec[_0x9edd('0x44')]['id']}})['then'](handleEntityNotFound(_0x4d4f33,null))[_0x9edd('0x21')](saveUpdates(_0x35bdec[_0x9edd('0x47')],null))[_0x9edd('0x21')](respondWithResult(_0x4d4f33,null))['catch'](handleError(_0x4d4f33,null));};exports[_0x9edd('0x49')]=function(_0x151157,_0x317a60){return db[_0x9edd('0x28')]['find']({'where':{'id':_0x151157[_0x9edd('0x44')]['id']}})[_0x9edd('0x21')](handleEntityNotFound(_0x317a60,null))[_0x9edd('0x21')](removeEntity(_0x317a60,null))['catch'](handleError(_0x317a60,null));};exports[_0x9edd('0x4a')]=function(_0x21f6ce,_0x57db43){return db[_0x9edd('0x28')]['describe']()[_0x9edd('0x21')](respondWithResult(_0x57db43,null))[_0x9edd('0x43')](handleError(_0x57db43,null));}; \ No newline at end of file +var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','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','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0x55ca,0x126));var _0xa55c=function(_0x2a6fd5,_0x3d6deb){_0x2a6fd5=_0x2a6fd5-0x0;var _0x43c6a4=_0x55ca[_0x2a6fd5];return _0x43c6a4;};'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'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 7512f02..6d2b4fe 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 _0x8f13=['api','bluebird','request-promise','path','../../config/environment','./memberReport.attributes','exports','define','MemberReport','membername_interface','membername','interface','lodash','util','../../config/logger'];(function(_0xe5b349,_0x5f06e4){var _0x26b0ad=function(_0x1a97f1){while(--_0x1a97f1){_0xe5b349['push'](_0xe5b349['shift']());}};_0x26b0ad(++_0x5f06e4);}(_0x8f13,0x1b0));var _0x38f1=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x8f13[_0x3c4737];return _0x2bb926;};'use strict';var _=require(_0x38f1('0x0'));var util=require(_0x38f1('0x1'));var logger=require(_0x38f1('0x2'))(_0x38f1('0x3'));var moment=require('moment');var BPromise=require(_0x38f1('0x4'));var rp=require(_0x38f1('0x5'));var fs=require('fs');var path=require(_0x38f1('0x6'));var rimraf=require('rimraf');var config=require(_0x38f1('0x7'));var attributes=require(_0x38f1('0x8'));module[_0x38f1('0x9')]=function(_0x1de0b7,_0xb7f8a9){return _0x1de0b7[_0x38f1('0xa')](_0x38f1('0xb'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x38f1('0xc'),'fields':[_0x38f1('0xd'),_0x38f1('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x28ce=['./memberReport.attributes','exports','define','MemberReport','report_member','membername_interface','membername','interface','lodash','../../config/logger','moment','request-promise','../../config/environment'];(function(_0x3f77de,_0x5a5e5e){var _0x5b9158=function(_0x559e60){while(--_0x559e60){_0x3f77de['push'](_0x3f77de['shift']());}};_0x5b9158(++_0x5a5e5e);}(_0x28ce,0xf2));var _0xe28c=function(_0x216917,_0x377800){_0x216917=_0x216917-0x0;var _0x6a8b70=_0x28ce[_0x216917];return _0x6a8b70;};'use strict';var _=require(_0xe28c('0x0'));var util=require('util');var logger=require(_0xe28c('0x1'))('api');var moment=require(_0xe28c('0x2'));var BPromise=require('bluebird');var rp=require(_0xe28c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xe28c('0x4'));var attributes=require(_0xe28c('0x5'));module[_0xe28c('0x6')]=function(_0x1eea9a,_0x5e1e10){return _0x1eea9a[_0xe28c('0x7')](_0xe28c('0x8'),attributes,{'tableName':_0xe28c('0x9'),'paranoid':![],'indexes':[{'name':_0xe28c('0xa'),'fields':[_0xe28c('0xb'),_0xe28c('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index 940e742..5a290fc 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 _0x0689=['where','attributes','map','include','model','create','body','CreateMemberReport','UpdateMemberReport','update','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0x36fe31,_0x26e51){var _0x2f9504=function(_0xaec555){while(--_0xaec555){_0x36fe31['push'](_0x36fe31['shift']());}};_0x2f9504(++_0x26e51);}(_0x0689,0x161));var _0x9068=function(_0x59bd6a,_0x540db8){_0x59bd6a=_0x59bd6a-0x0;var _0x54ffd0=_0x0689[_0x59bd6a];return _0x54ffd0;};'use strict';var _=require('lodash');var util=require(_0x9068('0x0'));var moment=require('moment');var BPromise=require(_0x9068('0x1'));var rs=require(_0x9068('0x2'));var fs=require('fs');var Redis=require(_0x9068('0x3'));var db=require(_0x9068('0x4'))['db'];var utils=require(_0x9068('0x5'));var logger=require(_0x9068('0x6'))(_0x9068('0x7'));var config=require(_0x9068('0x8'));var jayson=require(_0x9068('0x9'));var client=jayson[_0x9068('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x34cb67,_0x5c833f,_0x4bdd1b){return new BPromise(function(_0x17bc63,_0x184746){return client[_0x9068('0xb')](_0x34cb67,_0x4bdd1b)[_0x9068('0xc')](function(_0x1c63d2){logger[_0x9068('0xd')](_0x9068('0xe'),_0x5c833f,_0x9068('0xf'));logger[_0x9068('0x10')]('MemberReport,\x20%s,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'),JSON[_0x9068('0x11')](_0x1c63d2));if(_0x1c63d2[_0x9068('0x12')]){if(_0x1c63d2[_0x9068('0x12')]['code']===0x1f4){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x1c63d2[_0x9068('0x12')]['message']);return _0x184746(_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);}logger[_0x9068('0x12')]('MemberReport,\x20%s,\x20%s',_0x5c833f,_0x1c63d2[_0x9068('0x12')][_0x9068('0x13')]);return _0x17bc63(_0x1c63d2['error'][_0x9068('0x13')]);}else{logger[_0x9068('0xd')]('MemberReport,\x20%s,\x20%s',_0x5c833f,_0x9068('0xf'));_0x17bc63(_0x1c63d2[_0x9068('0x14')][_0x9068('0x13')]);}})[_0x9068('0x15')](function(_0x576b34){logger[_0x9068('0x12')](_0x9068('0xe'),_0x5c833f,_0x576b34);_0x184746(_0x576b34);});});}exports[_0x9068('0x16')]=function(_0x36d591){var _0x3e3a1c=this;return new Promise(function(_0x1d09bf,_0xebe833){return db[_0x9068('0x17')][_0x9068('0x18')]({'raw':_0x36d591['options']?_0x36d591[_0x9068('0x19')][_0x9068('0x1a')]===undefined?!![]:![]:!![],'where':_0x36d591[_0x9068('0x19')]?_0x36d591[_0x9068('0x19')][_0x9068('0x1b')]||null:null,'attributes':_0x36d591[_0x9068('0x19')]?_0x36d591[_0x9068('0x19')][_0x9068('0x1c')]||null:null,'limit':_0x36d591['options']?_0x36d591['options']['limit']||null:null,'include':_0x36d591[_0x9068('0x19')]?_0x36d591['options']['include']?_[_0x9068('0x1d')](_0x36d591[_0x9068('0x19')][_0x9068('0x1e')],function(_0x3673b9){return{'model':db[_0x3673b9['model']],'as':_0x3673b9['as'],'attributes':_0x3673b9[_0x9068('0x1c')],'include':_0x3673b9[_0x9068('0x1e')]?_[_0x9068('0x1d')](_0x3673b9[_0x9068('0x1e')],function(_0x12f17f){return{'model':db[_0x12f17f[_0x9068('0x1f')]],'as':_0x12f17f['as'],'attributes':_0x12f17f['attributes'],'include':_0x12f17f[_0x9068('0x1e')]?_[_0x9068('0x1d')](_0x12f17f['include'],function(_0x12369a){return{'model':db[_0x12369a[_0x9068('0x1f')]],'as':_0x12369a['as'],'attributes':_0x12369a['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x23b31d){logger['info'](_0x9068('0x16'),_0x36d591);logger[_0x9068('0x10')](_0x9068('0x16'),_0x36d591,JSON[_0x9068('0x11')](_0x23b31d));_0x1d09bf(_0x23b31d);})[_0x9068('0x15')](function(_0x4fd2e2){logger[_0x9068('0x12')](_0x9068('0x16'),_0x4fd2e2[_0x9068('0x13')],_0x36d591);_0xebe833(_0x3e3a1c[_0x9068('0x12')](0x1f4,_0x4fd2e2['message']));});});};exports['CreateMemberReport']=function(_0x19262a){var _0x318964=this;return new Promise(function(_0xb58f9,_0x22e718){return db[_0x9068('0x17')][_0x9068('0x20')](_0x19262a[_0x9068('0x21')],{'raw':_0x19262a[_0x9068('0x19')]?_0x19262a[_0x9068('0x19')][_0x9068('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0xe94cb5){logger[_0x9068('0xd')](_0x9068('0x22'),_0x19262a);logger['debug'](_0x9068('0x22'),_0x19262a,JSON[_0x9068('0x11')](_0xe94cb5));_0xb58f9(_0xe94cb5);})[_0x9068('0x15')](function(_0x1a8026){logger['error'](_0x9068('0x22'),_0x1a8026['message'],_0x19262a);_0x22e718(_0x318964[_0x9068('0x12')](0x1f4,_0x1a8026['message']));});});};exports[_0x9068('0x23')]=function(_0xe64fb4){var _0x124086=this;return new Promise(function(_0x526c3a,_0x9f33d4){return db['MemberReport'][_0x9068('0x24')](_0xe64fb4[_0x9068('0x21')],{'raw':_0xe64fb4[_0x9068('0x19')]?_0xe64fb4[_0x9068('0x19')][_0x9068('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xe64fb4[_0x9068('0x19')]?_0xe64fb4[_0x9068('0x19')][_0x9068('0x1b')]||null:null,'attributes':_0xe64fb4[_0x9068('0x19')]?_0xe64fb4['options'][_0x9068('0x1c')]||null:null,'limit':_0xe64fb4[_0x9068('0x19')]?_0xe64fb4[_0x9068('0x19')][_0x9068('0x25')]||null:null})['then'](function(_0x5d0dab){logger[_0x9068('0xd')](_0x9068('0x23'),_0xe64fb4);logger[_0x9068('0x10')](_0x9068('0x23'),_0xe64fb4,JSON[_0x9068('0x11')](_0x5d0dab));_0x526c3a(_0x5d0dab);})[_0x9068('0x15')](function(_0x1b552f){logger[_0x9068('0x12')](_0x9068('0x23'),_0x1b552f[_0x9068('0x13')],_0xe64fb4);_0x9f33d4(_0x124086[_0x9068('0x12')](0x1f4,_0x1b552f[_0x9068('0x13')]));});});}; \ No newline at end of file +var _0x3f27=['CreateMemberReport','create','update','body','limit','UpdateMemberReport','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','http','request','then','info','MemberReport,\x20%s,\x20%s','debug','MemberReport,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','result','catch','GetMemberReport','MemberReport','findAll','options','where','attributes','include','map','model','stringify'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x3f27,0x1f4));var _0x73f2=function(_0x84a18d,_0x1f63e8){_0x84a18d=_0x84a18d-0x0;var _0x52d253=_0x3f27[_0x84a18d];return _0x52d253;};'use strict';var _=require(_0x73f2('0x0'));var util=require(_0x73f2('0x1'));var moment=require(_0x73f2('0x2'));var BPromise=require(_0x73f2('0x3'));var rs=require(_0x73f2('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73f2('0x5'))['db'];var utils=require(_0x73f2('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x73f2('0x7'));var client=jayson[_0x73f2('0x8')][_0x73f2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4aa8ec,_0x10af7a,_0x5efe60){return new BPromise(function(_0x521fc9,_0xa2ea48){return client[_0x73f2('0xa')](_0x4aa8ec,_0x5efe60)[_0x73f2('0xb')](function(_0x3bf117){logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,'request\x20sent');logger[_0x73f2('0xe')](_0x73f2('0xf'),_0x10af7a,_0x73f2('0x10'),JSON['stringify'](_0x3bf117));if(_0x3bf117['error']){if(_0x3bf117['error'][_0x73f2('0x11')]===0x1f4){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0xa2ea48(_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);}logger['error']('MemberReport,\x20%s,\x20%s',_0x10af7a,_0x3bf117[_0x73f2('0x12')][_0x73f2('0x13')]);return _0x521fc9(_0x3bf117['error']['message']);}else{logger[_0x73f2('0xc')](_0x73f2('0xd'),_0x10af7a,_0x73f2('0x10'));_0x521fc9(_0x3bf117[_0x73f2('0x14')][_0x73f2('0x13')]);}})[_0x73f2('0x15')](function(_0x32e9c6){logger[_0x73f2('0x12')](_0x73f2('0xd'),_0x10af7a,_0x32e9c6);_0xa2ea48(_0x32e9c6);});});}exports[_0x73f2('0x16')]=function(_0x1dee61){var _0x16183f=this;return new Promise(function(_0x2546a0,_0x52370b){return db[_0x73f2('0x17')][_0x73f2('0x18')]({'raw':_0x1dee61[_0x73f2('0x19')]?_0x1dee61[_0x73f2('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x1dee61[_0x73f2('0x19')]?_0x1dee61[_0x73f2('0x19')][_0x73f2('0x1a')]||null:null,'attributes':_0x1dee61[_0x73f2('0x19')]?_0x1dee61['options'][_0x73f2('0x1b')]||null:null,'limit':_0x1dee61[_0x73f2('0x19')]?_0x1dee61[_0x73f2('0x19')]['limit']||null:null,'include':_0x1dee61['options']?_0x1dee61[_0x73f2('0x19')][_0x73f2('0x1c')]?_[_0x73f2('0x1d')](_0x1dee61['options']['include'],function(_0x11a5da){return{'model':db[_0x11a5da[_0x73f2('0x1e')]],'as':_0x11a5da['as'],'attributes':_0x11a5da['attributes'],'include':_0x11a5da[_0x73f2('0x1c')]?_[_0x73f2('0x1d')](_0x11a5da[_0x73f2('0x1c')],function(_0x4ecdc7){return{'model':db[_0x4ecdc7[_0x73f2('0x1e')]],'as':_0x4ecdc7['as'],'attributes':_0x4ecdc7[_0x73f2('0x1b')],'include':_0x4ecdc7[_0x73f2('0x1c')]?_['map'](_0x4ecdc7['include'],function(_0x5c52e3){return{'model':db[_0x5c52e3[_0x73f2('0x1e')]],'as':_0x5c52e3['as'],'attributes':_0x5c52e3[_0x73f2('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x73f2('0xb')](function(_0x444efc){logger[_0x73f2('0xc')](_0x73f2('0x16'),_0x1dee61);logger['debug'](_0x73f2('0x16'),_0x1dee61,JSON[_0x73f2('0x1f')](_0x444efc));_0x2546a0(_0x444efc);})['catch'](function(_0x21b18){logger[_0x73f2('0x12')](_0x73f2('0x16'),_0x21b18[_0x73f2('0x13')],_0x1dee61);_0x52370b(_0x16183f[_0x73f2('0x12')](0x1f4,_0x21b18['message']));});});};exports[_0x73f2('0x20')]=function(_0x1caacd){var _0x4fc6ff=this;return new Promise(function(_0x5ea8d6,_0x3a255f){return db[_0x73f2('0x17')][_0x73f2('0x21')](_0x1caacd['body'],{'raw':_0x1caacd['options']?_0x1caacd['options']['raw']===undefined?!![]:![]:!![]})[_0x73f2('0xb')](function(_0x47c190){logger[_0x73f2('0xc')](_0x73f2('0x20'),_0x1caacd);logger[_0x73f2('0xe')](_0x73f2('0x20'),_0x1caacd,JSON['stringify'](_0x47c190));_0x5ea8d6(_0x47c190);})[_0x73f2('0x15')](function(_0x3cc984){logger[_0x73f2('0x12')]('CreateMemberReport',_0x3cc984[_0x73f2('0x13')],_0x1caacd);_0x3a255f(_0x4fc6ff[_0x73f2('0x12')](0x1f4,_0x3cc984[_0x73f2('0x13')]));});});};exports['UpdateMemberReport']=function(_0x406f9b){var _0x1d68f7=this;return new Promise(function(_0x941e49,_0x2ba1ec){return db[_0x73f2('0x17')][_0x73f2('0x22')](_0x406f9b[_0x73f2('0x23')],{'raw':_0x406f9b[_0x73f2('0x19')]?_0x406f9b[_0x73f2('0x19')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x406f9b['options']?_0x406f9b['options'][_0x73f2('0x1a')]||null:null,'attributes':_0x406f9b[_0x73f2('0x19')]?_0x406f9b[_0x73f2('0x19')]['attributes']||null:null,'limit':_0x406f9b[_0x73f2('0x19')]?_0x406f9b[_0x73f2('0x19')][_0x73f2('0x24')]||null:null})[_0x73f2('0xb')](function(_0x3a2f56){logger['info'](_0x73f2('0x25'),_0x406f9b);logger[_0x73f2('0xe')](_0x73f2('0x25'),_0x406f9b,JSON[_0x73f2('0x1f')](_0x3a2f56));_0x941e49(_0x3a2f56);})[_0x73f2('0x15')](function(_0x471829){logger['error'](_0x73f2('0x25'),_0x471829['message'],_0x406f9b);_0x2ba1ec(_0x1d68f7[_0x73f2('0x12')](0x1f4,_0x471829[_0x73f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 7541189..b9ccab3 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 _0xd9d9=['fs-extra','../../components/auth/service','../../components/interaction/service','get','exports','util','path','connect-timeout','express','Router'];(function(_0x40cd92,_0x407c17){var _0x31e0af=function(_0x47a631){while(--_0x47a631){_0x40cd92['push'](_0x40cd92['shift']());}};_0x31e0af(++_0x407c17);}(_0xd9d9,0x11d));var _0x9d9d=function(_0x366195,_0x50da84){_0x366195=_0x366195-0x0;var _0xf37646=_0xd9d9[_0x366195];return _0xf37646;};'use strict';var multer=require('multer');var util=require(_0x9d9d('0x0'));var path=require(_0x9d9d('0x1'));var timeout=require(_0x9d9d('0x2'));var express=require(_0x9d9d('0x3'));var router=express[_0x9d9d('0x4')]();var fs_extra=require(_0x9d9d('0x5'));var auth=require(_0x9d9d('0x6'));var interaction=require(_0x9d9d('0x7'));var config=require('../../config/environment');var controller=require('./migration.controller');router[_0x9d9d('0x8')]('/',controller['index']);module[_0x9d9d('0x9')]=router; \ No newline at end of file +var _0x6618=['Router','../../components/auth/service','multer','util','path','connect-timeout','express'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6618,0xb8));var _0x8661=function(_0x37cba2,_0x1e29a3){_0x37cba2=_0x37cba2-0x0;var _0x26c1b5=_0x6618[_0x37cba2];return _0x26c1b5;};'use strict';var multer=require(_0x8661('0x0'));var util=require(_0x8661('0x1'));var path=require(_0x8661('0x2'));var timeout=require(_0x8661('0x3'));var express=require(_0x8661('0x4'));var router=express[_0x8661('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x8661('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./migration.controller');router['get']('/',controller['index']);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 52a8849..2314483 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 _0xadba=['exports','STRING','version','sequelize'];(function(_0x260fab,_0x38fef6){var _0x462621=function(_0x28501a){while(--_0x28501a){_0x260fab['push'](_0x260fab['shift']());}};_0x462621(++_0x38fef6);}(_0xadba,0x123));var _0xaadb=function(_0x3647aa,_0x3fb38b){_0x3647aa=_0x3647aa-0x0;var _0x20c613=_0xadba[_0x3647aa];return _0x20c613;};'use strict';var Sequelize=require(_0xaadb('0x0'));module[_0xaadb('0x1')]={'version':{'type':Sequelize[_0xaadb('0x2')],'unique':_0xaadb('0x3')}}; \ No newline at end of file +var _0x64b1=['STRING','version','sequelize','exports'];(function(_0x2e1ef0,_0x15c4fb){var _0x1146b2=function(_0x4e2f97){while(--_0x4e2f97){_0x2e1ef0['push'](_0x2e1ef0['shift']());}};_0x1146b2(++_0x15c4fb);}(_0x64b1,0x156));var _0x164b=function(_0x38004b,_0x28add1){_0x38004b=_0x38004b-0x0;var _0x1c96df=_0x64b1[_0x38004b];return _0x1c96df;};'use strict';var Sequelize=require(_0x164b('0x0'));module[_0x164b('0x1')]={'version':{'type':Sequelize[_0x164b('0x2')],'unique':_0x164b('0x3')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index 23ffbfd..66d55fc 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 _0x2993=['intersection','attributes','fields','length','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','update','then','destroy','sendStatus','error','name','index','map','Migration','type','key','model','query','keys','filters'];(function(_0x5783f4,_0x4a9e0a){var _0x28e380=function(_0x1ffc49){while(--_0x1ffc49){_0x5783f4['push'](_0x5783f4['shift']());}};_0x28e380(++_0x4a9e0a);}(_0x2993,0x1c9));var _0x3299=function(_0x10ef02,_0x14de7d){_0x10ef02=_0x10ef02-0x0;var _0x5c624e=_0x2993[_0x10ef02];return _0x5c624e;};'use strict';var emlformat=require(_0x3299('0x0'));var rimraf=require(_0x3299('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3299('0x2'));var rp=require(_0x3299('0x3'));var moment=require(_0x3299('0x4'));var BPromise=require(_0x3299('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3299('0x6'));var sox=require('sox');var csv=require(_0x3299('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3299('0x8'));var _=require('lodash');var squel=require(_0x3299('0x9'));var crypto=require(_0x3299('0xa'));var jsforce=require(_0x3299('0xb'));var deskjs=require(_0x3299('0xc'));var toCsv=require(_0x3299('0x7'));var querystring=require('querystring');var Papa=require(_0x3299('0xd'));var Redis=require('ioredis');var authService=require(_0x3299('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x3299('0xf'));var hardwareService=require(_0x3299('0x10'));var logger=require(_0x3299('0x11'))(_0x3299('0x12'));var utils=require(_0x3299('0x13'));var config=require(_0x3299('0x14'));var licenseUtil=require(_0x3299('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1e3376,_0x54c9f6){_0x54c9f6=_0x54c9f6||0xcc;return function(_0x1b5cb1){if(_0x1b5cb1){return _0x1e3376['sendStatus'](_0x54c9f6);}return _0x1e3376[_0x3299('0x16')](_0x54c9f6)[_0x3299('0x17')]();};}function respondWithResult(_0x466f9e,_0xbff85c){_0xbff85c=_0xbff85c||0xc8;return function(_0x3976c3){if(_0x3976c3){return _0x466f9e[_0x3299('0x16')](_0xbff85c)[_0x3299('0x18')](_0x3976c3);}};}function respondWithFilteredResult(_0x502182,_0x42c507){return function(_0x5c99d2){if(_0x5c99d2){var _0x8daddd=typeof _0x42c507[_0x3299('0x19')]==='undefined'&&typeof _0x42c507['limit']===_0x3299('0x1a');var _0x3a9179=_0x5c99d2['count'];var _0x576970=_0x8daddd?0x0:_0x42c507[_0x3299('0x19')];var _0x530e7d=_0x8daddd?_0x5c99d2[_0x3299('0x1b')]:_0x42c507[_0x3299('0x19')]+_0x42c507[_0x3299('0x1c')];var _0x1a2d5c;if(_0x530e7d>=_0x3a9179){_0x530e7d=_0x3a9179;_0x1a2d5c=0xc8;}else{_0x1a2d5c=0xce;}_0x502182[_0x3299('0x16')](_0x1a2d5c);return _0x502182[_0x3299('0x1d')](_0x3299('0x1e'),_0x576970+'-'+_0x530e7d+'/'+_0x3a9179)[_0x3299('0x18')](_0x5c99d2);}return null;};}function patchUpdates(_0x5463fe){return function(_0x540b60){try{jsonpatch['apply'](_0x540b60,_0x5463fe,!![]);}catch(_0x32e349){return BPromise[_0x3299('0x1f')](_0x32e349);}return _0x540b60['save']();};}function saveUpdates(_0x563e28,_0x2d587f){return function(_0x5d54b4){if(_0x5d54b4){return _0x5d54b4[_0x3299('0x20')](_0x563e28)[_0x3299('0x21')](function(_0x35a5ae){return _0x35a5ae;});}return null;};}function removeEntity(_0x2561dc,_0xccd2d0){return function(_0x2210ea){if(_0x2210ea){return _0x2210ea[_0x3299('0x22')]()[_0x3299('0x21')](function(){_0x2561dc[_0x3299('0x16')](0xcc)[_0x3299('0x17')]();});}};}function handleEntityNotFound(_0x21fc4c,_0x293fe2){return function(_0x10a426){if(!_0x10a426){_0x21fc4c[_0x3299('0x23')](0x194);}return _0x10a426;};}function handleError(_0x785cf3,_0x166514){_0x166514=_0x166514||0x1f4;return function(_0x43424f){logger[_0x3299('0x24')](_0x43424f['stack']);if(_0x43424f['name']){delete _0x43424f[_0x3299('0x25')];}_0x785cf3[_0x3299('0x16')](_0x166514)['send'](_0x43424f);};}exports[_0x3299('0x26')]=function(_0x31c24d,_0xf6679){var _0x40844c={},_0x1f56f5={},_0x1b4d32={'count':0x0,'rows':[]};var _0x47b800=_[_0x3299('0x27')](db[_0x3299('0x28')]['rawAttributes'],function(_0x326cd1){return{'name':_0x326cd1['fieldName'],'type':_0x326cd1[_0x3299('0x29')][_0x3299('0x2a')]};});_0x1f56f5[_0x3299('0x2b')]=_[_0x3299('0x27')](_0x47b800,_0x3299('0x25'));_0x1f56f5[_0x3299('0x2c')]=_[_0x3299('0x2d')](_0x31c24d['query']);_0x1f56f5[_0x3299('0x2e')]=_[_0x3299('0x2f')](_0x1f56f5[_0x3299('0x2b')],_0x1f56f5[_0x3299('0x2c')]);_0x40844c[_0x3299('0x30')]=_[_0x3299('0x2f')](_0x1f56f5[_0x3299('0x2b')],qs[_0x3299('0x31')](_0x31c24d[_0x3299('0x2c')][_0x3299('0x31')]));_0x40844c['attributes']=_0x40844c[_0x3299('0x30')][_0x3299('0x32')]?_0x40844c[_0x3299('0x30')]:_0x1f56f5[_0x3299('0x2b')];if(!_0x31c24d[_0x3299('0x2c')]['hasOwnProperty'](_0x3299('0x33'))){_0x40844c[_0x3299('0x1c')]=qs[_0x3299('0x1c')](_0x31c24d[_0x3299('0x2c')]['limit']);_0x40844c[_0x3299('0x19')]=qs['offset'](_0x31c24d[_0x3299('0x2c')]['offset']);}_0x40844c[_0x3299('0x34')]=qs[_0x3299('0x35')](_0x31c24d[_0x3299('0x2c')]['sort']);_0x40844c['where']=qs['filters'](_['pick'](_0x31c24d['query'],_0x1f56f5[_0x3299('0x2e')]),_0x47b800);if(_0x31c24d['query'][_0x3299('0x36')]){_0x40844c[_0x3299('0x37')]=_[_0x3299('0x38')](_0x40844c[_0x3299('0x37')],{'$or':_['map'](_0x47b800,function(_0x3aa182){if(_0x3aa182[_0x3299('0x29')]!==_0x3299('0x39')){var _0x540547={};_0x540547[_0x3aa182[_0x3299('0x25')]]={'$like':'%'+_0x31c24d[_0x3299('0x2c')][_0x3299('0x36')]+'%'};return _0x540547;}})});}_0x40844c=_[_0x3299('0x38')]({},_0x40844c,_0x31c24d[_0x3299('0x3a')]);var _0x438979={'where':_0x40844c[_0x3299('0x37')]};return db[_0x3299('0x28')][_0x3299('0x1b')](_0x438979)[_0x3299('0x21')](function(_0xbbc080){_0x1b4d32[_0x3299('0x1b')]=_0xbbc080;if(_0x31c24d[_0x3299('0x2c')][_0x3299('0x3b')]){_0x40844c[_0x3299('0x3c')]=[{'all':!![]}];}return db[_0x3299('0x28')][_0x3299('0x3d')](_0x40844c);})[_0x3299('0x21')](function(_0x987181){_0x1b4d32['rows']=_0x987181;return _0x1b4d32;})[_0x3299('0x21')](respondWithFilteredResult(_0xf6679,_0x40844c))[_0x3299('0x3e')](handleError(_0xf6679,null));}; \ No newline at end of file +var _0x7040=['status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','map','Migration','rawAttributes','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0xfac0b2,_0x1d3fbb){var _0x3e4ef3=function(_0x162663){while(--_0x162663){_0xfac0b2['push'](_0xfac0b2['shift']());}};_0x3e4ef3(++_0x1d3fbb);}(_0x7040,0xf6));var _0x0704=function(_0x11fde4,_0x4d4377){_0x11fde4=_0x11fde4-0x0;var _0x19ee54=_0x7040[_0x11fde4];return _0x19ee54;};'use strict';var emlformat=require(_0x0704('0x0'));var rimraf=require(_0x0704('0x1'));var zipdir=require(_0x0704('0x2'));var jsonpatch=require(_0x0704('0x3'));var rp=require('request-promise');var moment=require(_0x0704('0x4'));var BPromise=require(_0x0704('0x5'));var Mustache=require(_0x0704('0x6'));var util=require(_0x0704('0x7'));var path=require(_0x0704('0x8'));var sox=require(_0x0704('0x9'));var csv=require(_0x0704('0xa'));var ejs=require(_0x0704('0xb'));var fs=require('fs');var fs_extra=require(_0x0704('0xc'));var _=require(_0x0704('0xd'));var squel=require(_0x0704('0xe'));var crypto=require(_0x0704('0xf'));var jsforce=require(_0x0704('0x10'));var deskjs=require(_0x0704('0x11'));var toCsv=require(_0x0704('0xa'));var querystring=require(_0x0704('0x12'));var Papa=require(_0x0704('0x13'));var Redis=require('ioredis');var authService=require(_0x0704('0x14'));var qs=require(_0x0704('0x15'));var as=require(_0x0704('0x16'));var hardwareService=require(_0x0704('0x17'));var logger=require(_0x0704('0x18'))(_0x0704('0x19'));var utils=require('../../config/utils');var config=require(_0x0704('0x1a'));var licenseUtil=require(_0x0704('0x1b'));var db=require(_0x0704('0x1c'))['db'];function respondWithStatusCode(_0x5249e6,_0x394a93){_0x394a93=_0x394a93||0xcc;return function(_0x20e327){if(_0x20e327){return _0x5249e6[_0x0704('0x1d')](_0x394a93);}return _0x5249e6[_0x0704('0x1e')](_0x394a93)[_0x0704('0x1f')]();};}function respondWithResult(_0x259668,_0x53d39a){_0x53d39a=_0x53d39a||0xc8;return function(_0x1d85cf){if(_0x1d85cf){return _0x259668[_0x0704('0x1e')](_0x53d39a)[_0x0704('0x20')](_0x1d85cf);}};}function respondWithFilteredResult(_0x300b3f,_0x5bdaa7){return function(_0x3c2483){if(_0x3c2483){var _0x154948=typeof _0x5bdaa7['offset']==='undefined'&&typeof _0x5bdaa7[_0x0704('0x21')]===_0x0704('0x22');var _0x4ff3ca=_0x3c2483[_0x0704('0x23')];var _0xe1936e=_0x154948?0x0:_0x5bdaa7[_0x0704('0x24')];var _0x1dfa32=_0x154948?_0x3c2483['count']:_0x5bdaa7[_0x0704('0x24')]+_0x5bdaa7[_0x0704('0x21')];var _0x3f41a5;if(_0x1dfa32>=_0x4ff3ca){_0x1dfa32=_0x4ff3ca;_0x3f41a5=0xc8;}else{_0x3f41a5=0xce;}_0x300b3f['status'](_0x3f41a5);return _0x300b3f['set'](_0x0704('0x25'),_0xe1936e+'-'+_0x1dfa32+'/'+_0x4ff3ca)['json'](_0x3c2483);}return null;};}function patchUpdates(_0x50d602){return function(_0x3cdaba){try{jsonpatch['apply'](_0x3cdaba,_0x50d602,!![]);}catch(_0x3009a9){return BPromise[_0x0704('0x26')](_0x3009a9);}return _0x3cdaba[_0x0704('0x27')]();};}function saveUpdates(_0x14d03f,_0x254f16){return function(_0x527148){if(_0x527148){return _0x527148[_0x0704('0x28')](_0x14d03f)[_0x0704('0x29')](function(_0x4d5e6a){return _0x4d5e6a;});}return null;};}function removeEntity(_0x19464a,_0x2f090a){return function(_0x494173){if(_0x494173){return _0x494173[_0x0704('0x2a')]()[_0x0704('0x29')](function(){_0x19464a[_0x0704('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x472709,_0x43cb90){return function(_0x4b0875){if(!_0x4b0875){_0x472709[_0x0704('0x1d')](0x194);}return _0x4b0875;};}function handleError(_0x9d7cfb,_0x47812f){_0x47812f=_0x47812f||0x1f4;return function(_0x2fa51e){logger[_0x0704('0x2b')](_0x2fa51e[_0x0704('0x2c')]);if(_0x2fa51e[_0x0704('0x2d')]){delete _0x2fa51e[_0x0704('0x2d')];}_0x9d7cfb[_0x0704('0x1e')](_0x47812f)[_0x0704('0x2e')](_0x2fa51e);};}exports[_0x0704('0x2f')]=function(_0x11efdc,_0x22ea3f){var _0x7b0f4b={},_0x48488c={},_0x7d2627={'count':0x0,'rows':[]};var _0x2270fd=_[_0x0704('0x30')](db[_0x0704('0x31')][_0x0704('0x32')],function(_0x3c2964){return{'name':_0x3c2964['fieldName'],'type':_0x3c2964['type'][_0x0704('0x33')]};});_0x48488c[_0x0704('0x34')]=_[_0x0704('0x30')](_0x2270fd,'name');_0x48488c['query']=_[_0x0704('0x35')](_0x11efdc[_0x0704('0x36')]);_0x48488c[_0x0704('0x37')]=_[_0x0704('0x38')](_0x48488c[_0x0704('0x34')],_0x48488c[_0x0704('0x36')]);_0x7b0f4b[_0x0704('0x39')]=_[_0x0704('0x38')](_0x48488c[_0x0704('0x34')],qs['fields'](_0x11efdc[_0x0704('0x36')][_0x0704('0x3a')]));_0x7b0f4b[_0x0704('0x39')]=_0x7b0f4b[_0x0704('0x39')]['length']?_0x7b0f4b[_0x0704('0x39')]:_0x48488c[_0x0704('0x34')];if(!_0x11efdc[_0x0704('0x36')][_0x0704('0x3b')](_0x0704('0x3c'))){_0x7b0f4b[_0x0704('0x21')]=qs[_0x0704('0x21')](_0x11efdc[_0x0704('0x36')]['limit']);_0x7b0f4b['offset']=qs[_0x0704('0x24')](_0x11efdc[_0x0704('0x36')]['offset']);}_0x7b0f4b[_0x0704('0x3d')]=qs[_0x0704('0x3e')](_0x11efdc[_0x0704('0x36')]['sort']);_0x7b0f4b[_0x0704('0x3f')]=qs[_0x0704('0x37')](_[_0x0704('0x40')](_0x11efdc[_0x0704('0x36')],_0x48488c[_0x0704('0x37')]),_0x2270fd);if(_0x11efdc[_0x0704('0x36')][_0x0704('0x41')]){_0x7b0f4b['where']=_[_0x0704('0x42')](_0x7b0f4b[_0x0704('0x3f')],{'$or':_[_0x0704('0x30')](_0x2270fd,function(_0x39d13f){if(_0x39d13f[_0x0704('0x43')]!=='VIRTUAL'){var _0x8613a0={};_0x8613a0[_0x39d13f[_0x0704('0x2d')]]={'$like':'%'+_0x11efdc[_0x0704('0x36')][_0x0704('0x41')]+'%'};return _0x8613a0;}})});}_0x7b0f4b=_[_0x0704('0x42')]({},_0x7b0f4b,_0x11efdc[_0x0704('0x44')]);var _0x176ead={'where':_0x7b0f4b[_0x0704('0x3f')]};return db[_0x0704('0x31')]['count'](_0x176ead)[_0x0704('0x29')](function(_0x1ed935){_0x7d2627[_0x0704('0x23')]=_0x1ed935;if(_0x11efdc[_0x0704('0x36')]['includeAll']){_0x7b0f4b['include']=[{'all':!![]}];}return db[_0x0704('0x31')]['findAll'](_0x7b0f4b);})['then'](function(_0x4c9b44){_0x7d2627['rows']=_0x4c9b44;return _0x7d2627;})[_0x0704('0x29')](respondWithFilteredResult(_0x22ea3f,_0x7b0f4b))['catch'](handleError(_0x22ea3f,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index f04cd91..c4cb127 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 _0x849a=['../../config/logger','api','moment','bluebird','path','../../config/environment','./migration.attributes','exports','Migration','lodash','util'];(function(_0x45d55e,_0x2fede3){var _0x29812a=function(_0x3c6830){while(--_0x3c6830){_0x45d55e['push'](_0x45d55e['shift']());}};_0x29812a(++_0x2fede3);}(_0x849a,0xda));var _0xa849=function(_0x4d6472,_0x4bc15e){_0x4d6472=_0x4d6472-0x0;var _0x571e35=_0x849a[_0x4d6472];return _0x571e35;};'use strict';var _=require(_0xa849('0x0'));var util=require(_0xa849('0x1'));var logger=require(_0xa849('0x2'))(_0xa849('0x3'));var moment=require(_0xa849('0x4'));var BPromise=require(_0xa849('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa849('0x6'));var rimraf=require('rimraf');var config=require(_0xa849('0x7'));var attributes=require(_0xa849('0x8'));module[_0xa849('0x9')]=function(_0xbcdf40,_0x2029e3){return _0xbcdf40['define'](_0xa849('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc13=['request-promise','path','rimraf','./migration.attributes','exports','define','Migration','util','../../config/logger','api','bluebird'];(function(_0x2793f2,_0x45d8c5){var _0x949555=function(_0x4b64bc){while(--_0x4b64bc){_0x2793f2['push'](_0x2793f2['shift']());}};_0x949555(++_0x45d8c5);}(_0xfc13,0xe3));var _0x3fc1=function(_0x4e58b0,_0x4219b4){_0x4e58b0=_0x4e58b0-0x0;var _0x595880=_0xfc13[_0x4e58b0];return _0x595880;};'use strict';var _=require('lodash');var util=require(_0x3fc1('0x0'));var logger=require(_0x3fc1('0x1'))(_0x3fc1('0x2'));var moment=require('moment');var BPromise=require(_0x3fc1('0x3'));var rp=require(_0x3fc1('0x4'));var fs=require('fs');var path=require(_0x3fc1('0x5'));var rimraf=require(_0x3fc1('0x6'));var config=require('../../config/environment');var attributes=require(_0x3fc1('0x7'));module[_0x3fc1('0x8')]=function(_0x3d4673,_0x2cdccf){return _0x3d4673[_0x3fc1('0x9')](_0x3fc1('0xa'),attributes,{'tableName':'migrations','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 416e344..df7086c 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 _0xfb3f=['debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','info','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Migration,\x20%s,\x20%s','request\x20sent'];(function(_0x54e217,_0x243297){var _0x590ead=function(_0x2f1d78){while(--_0x2f1d78){_0x54e217['push'](_0x54e217['shift']());}};_0x590ead(++_0x243297);}(_0xfb3f,0xd9));var _0xffb3=function(_0x2439fe,_0x5e4e13){_0x2439fe=_0x2439fe-0x0;var _0x14a5e1=_0xfb3f[_0x2439fe];return _0x14a5e1;};'use strict';var _=require(_0xffb3('0x0'));var util=require(_0xffb3('0x1'));var moment=require('moment');var BPromise=require(_0xffb3('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xffb3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xffb3('0x4'))(_0xffb3('0x5'));var config=require(_0xffb3('0x6'));var jayson=require(_0xffb3('0x7'));var client=jayson[_0xffb3('0x8')][_0xffb3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3868a6,_0x146133,_0x5177aa){return new BPromise(function(_0x2e9697,_0x250f0f){return client[_0xffb3('0xa')](_0x3868a6,_0x5177aa)[_0xffb3('0xb')](function(_0x39c7eb){logger['info'](_0xffb3('0xc'),_0x146133,_0xffb3('0xd'));logger[_0xffb3('0xe')](_0xffb3('0xf'),_0x146133,_0xffb3('0xd'),JSON[_0xffb3('0x10')](_0x39c7eb));if(_0x39c7eb[_0xffb3('0x11')]){if(_0x39c7eb[_0xffb3('0x11')]['code']===0x1f4){logger[_0xffb3('0x11')](_0xffb3('0xc'),_0x146133,_0x39c7eb['error'][_0xffb3('0x12')]);return _0x250f0f(_0x39c7eb[_0xffb3('0x11')][_0xffb3('0x12')]);}logger[_0xffb3('0x11')](_0xffb3('0xc'),_0x146133,_0x39c7eb[_0xffb3('0x11')][_0xffb3('0x12')]);return _0x2e9697(_0x39c7eb[_0xffb3('0x11')][_0xffb3('0x12')]);}else{logger[_0xffb3('0x13')](_0xffb3('0xc'),_0x146133,_0xffb3('0xd'));_0x2e9697(_0x39c7eb['result'][_0xffb3('0x12')]);}})[_0xffb3('0x14')](function(_0x42b807){logger['error']('Migration,\x20%s,\x20%s',_0x146133,_0x42b807);_0x250f0f(_0x42b807);});});} \ No newline at end of file +var _0xd403=['info','request\x20sent','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Migration,\x20%s,\x20%s','result','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x283127,_0x54d4d5){var _0x43da5d=function(_0x10947f){while(--_0x10947f){_0x283127['push'](_0x283127['shift']());}};_0x43da5d(++_0x54d4d5);}(_0xd403,0x1d5));var _0x3d40=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xd403[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require(_0x3d40('0x0'));var util=require(_0x3d40('0x1'));var moment=require(_0x3d40('0x2'));var BPromise=require(_0x3d40('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3d40('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x3d40('0x5'));var logger=require(_0x3d40('0x6'))(_0x3d40('0x7'));var config=require(_0x3d40('0x8'));var jayson=require(_0x3d40('0x9'));var client=jayson[_0x3d40('0xa')][_0x3d40('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xfd5569,_0x14dc5b,_0x1f488d){return new BPromise(function(_0x210104,_0x266868){return client[_0x3d40('0xc')](_0xfd5569,_0x1f488d)[_0x3d40('0xd')](function(_0xd96d5e){logger[_0x3d40('0xe')]('Migration,\x20%s,\x20%s',_0x14dc5b,_0x3d40('0xf'));logger['debug'](_0x3d40('0x10'),_0x14dc5b,_0x3d40('0xf'),JSON[_0x3d40('0x11')](_0xd96d5e));if(_0xd96d5e['error']){if(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x13')]===0x1f4){logger[_0x3d40('0x12')]('Migration,\x20%s,\x20%s',_0x14dc5b,_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);return _0x266868(_0xd96d5e['error']['message']);}logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0xd96d5e[_0x3d40('0x12')]['message']);return _0x210104(_0xd96d5e[_0x3d40('0x12')][_0x3d40('0x14')]);}else{logger[_0x3d40('0xe')](_0x3d40('0x15'),_0x14dc5b,_0x3d40('0xf'));_0x210104(_0xd96d5e[_0x3d40('0x16')][_0x3d40('0x14')]);}})['catch'](function(_0x496dfd){logger[_0x3d40('0x12')](_0x3d40('0x15'),_0x14dc5b,_0x496dfd);_0x266868(_0x496dfd);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 581e39c..26aba02 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 _0xbcba=['multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./network.controller','get','isAuthenticated','/:id','show','post','put','delete','destroy','exports'];(function(_0x3f3a5e,_0x5619a2){var _0xb321d9=function(_0x5d3549){while(--_0x5d3549){_0x3f3a5e['push'](_0x3f3a5e['shift']());}};_0xb321d9(++_0x5619a2);}(_0xbcba,0x198));var _0xabcb=function(_0x2e9927,_0x592810){_0x2e9927=_0x2e9927-0x0;var _0x456cf6=_0xbcba[_0x2e9927];return _0x456cf6;};'use strict';var multer=require(_0xabcb('0x0'));var util=require(_0xabcb('0x1'));var path=require(_0xabcb('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xabcb('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xabcb('0x4'));var interaction=require(_0xabcb('0x5'));var config=require(_0xabcb('0x6'));var controller=require(_0xabcb('0x7'));router[_0xabcb('0x8')]('/',auth[_0xabcb('0x9')](),controller['index']);router['get'](_0xabcb('0xa'),auth[_0xabcb('0x9')](),controller[_0xabcb('0xb')]);router[_0xabcb('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0xabcb('0xd')](_0xabcb('0xa'),auth[_0xabcb('0x9')](),controller['update']);router[_0xabcb('0xe')]('/:id',auth[_0xabcb('0x9')](),controller[_0xabcb('0xf')]);module[_0xabcb('0x10')]=router; \ No newline at end of file +var _0xc3ed=['show','post','create','put','update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x5f002d,_0x1b9dc8){var _0x544598=function(_0x929264){while(--_0x929264){_0x5f002d['push'](_0x5f002d['shift']());}};_0x544598(++_0x1b9dc8);}(_0xc3ed,0x111));var _0xdc3e=function(_0x70459,_0x11f2ff){_0x70459=_0x70459-0x0;var _0x4f16b5=_0xc3ed[_0x70459];return _0x4f16b5;};'use strict';var multer=require(_0xdc3e('0x0'));var util=require(_0xdc3e('0x1'));var path=require('path');var timeout=require(_0xdc3e('0x2'));var express=require(_0xdc3e('0x3'));var router=express[_0xdc3e('0x4')]();var fs_extra=require(_0xdc3e('0x5'));var auth=require(_0xdc3e('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdc3e('0x7'));var controller=require('./network.controller');router[_0xdc3e('0x8')]('/',auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xa')]);router[_0xdc3e('0x8')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xc')]);router[_0xdc3e('0xd')]('/',auth[_0xdc3e('0x9')](),controller[_0xdc3e('0xe')]);router[_0xdc3e('0xf')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller[_0xdc3e('0x10')]);router[_0xdc3e('0x11')](_0xdc3e('0xb'),auth[_0xdc3e('0x9')](),controller['destroy']);module[_0xdc3e('0x12')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index a6c89aa..c728fbe 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 _0x5be0=['localnet','externip','turn','STRING','sequelize','exports'];(function(_0x45596d,_0x187d34){var _0x2e80f1=function(_0x16b9ea){while(--_0x16b9ea){_0x45596d['push'](_0x45596d['shift']());}};_0x2e80f1(++_0x187d34);}(_0x5be0,0xb2));var _0x05be=function(_0x505e42,_0x27afb9){_0x505e42=_0x505e42-0x0;var _0xc12a34=_0x5be0[_0x505e42];return _0xc12a34;};'use strict';var Sequelize=require(_0x05be('0x0'));module[_0x05be('0x1')]={'type':{'type':Sequelize['ENUM'](_0x05be('0x2'),_0x05be('0x3'),'stun',_0x05be('0x4'))},'value':{'type':Sequelize[_0x05be('0x5')]},'username':{'type':Sequelize[_0x05be('0x5')]},'password':{'type':Sequelize[_0x05be('0x5')]}}; \ No newline at end of file +var _0x30de=['turn','STRING','sequelize','exports','ENUM','localnet','externip','stun'];(function(_0x1953d1,_0x153e18){var _0x4e2d18=function(_0x52ea41){while(--_0x52ea41){_0x1953d1['push'](_0x1953d1['shift']());}};_0x4e2d18(++_0x153e18);}(_0x30de,0x16a));var _0xe30d=function(_0x485f0c,_0x42c7fe){_0x485f0c=_0x485f0c-0x0;var _0x3bf2d3=_0x30de[_0x485f0c];return _0x3bf2d3;};'use strict';var Sequelize=require(_0xe30d('0x0'));module[_0xe30d('0x1')]={'type':{'type':Sequelize[_0xe30d('0x2')](_0xe30d('0x3'),_0xe30d('0x4'),_0xe30d('0x5'),_0xe30d('0x6'))},'value':{'type':Sequelize[_0xe30d('0x7')]},'username':{'type':Sequelize[_0xe30d('0x7')]},'password':{'type':Sequelize[_0xe30d('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index b47a166..6fd3eef 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 _0x403d=['json','undefined','limit','count','apply','reject','save','update','stack','map','rawAttributes','fieldName','type','key','model','name','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','offset','sort','where','pick','filter','merge','VIRTUAL','Network','includeAll','include','findAll','rows','catch','params','keys','options','find','sequelize','transaction','body','STUN','join','root','server/files/templates/stun_multiple.ejs','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','create','res_stun_monitor.so','toUpperCase','TURN','readFileSync','server/files/templates/turn_multiple.ejs','render','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','toLowerCase','format','/etc/asterisk/sip_xcally_%s.conf','chan_sip.so','destroy','eml-format','rimraf','fast-json-patch','moment','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','client','http','then','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','sendStatus','status','end'];(function(_0x1778e1,_0x3e1727){var _0x2bc4c6=function(_0x359c65){while(--_0x359c65){_0x1778e1['push'](_0x1778e1['shift']());}};_0x2bc4c6(++_0x3e1727);}(_0x403d,0x111));var _0xd403=function(_0x552fc5,_0x54972e){_0x552fc5=_0x552fc5-0x0;var _0x3ae584=_0x403d[_0x552fc5];return _0x3ae584;};'use strict';var emlformat=require(_0xd403('0x0'));var rimraf=require(_0xd403('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd403('0x2'));var rp=require('request-promise');var moment=require(_0xd403('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xd403('0x4'));var sox=require(_0xd403('0x5'));var csv=require(_0xd403('0x6'));var ejs=require(_0xd403('0x7'));var fs=require('fs');var fs_extra=require(_0xd403('0x8'));var _=require(_0xd403('0x9'));var squel=require(_0xd403('0xa'));var crypto=require(_0xd403('0xb'));var jsforce=require(_0xd403('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xd403('0x6'));var querystring=require(_0xd403('0xd'));var Papa=require(_0xd403('0xe'));var Redis=require(_0xd403('0xf'));var authService=require(_0xd403('0x10'));var qs=require(_0xd403('0x11'));var as=require(_0xd403('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xd403('0x13'));var utils=require(_0xd403('0x14'));var config=require(_0xd403('0x15'));var licenseUtil=require(_0xd403('0x16'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0xd403('0x17')][_0xd403('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x3c2831,_0x3b84a0,_0x3f958c,_0x16e145){return new BPromise(function(_0x174804,_0x415c1c){var _0x1038db=_0x16e145||client;return _0x1038db['request'](_0x3c2831,_0x3f958c)[_0xd403('0x19')](function(_0x1bf172){logger['info'](_0xd403('0x1a'),_0x3b84a0,'request\x20sent');logger[_0xd403('0x1b')](_0xd403('0x1c'),_0x3b84a0,_0xd403('0x1d'),JSON[_0xd403('0x1e')](_0x1bf172));if(_0x1bf172[_0xd403('0x1f')]){if(_0x1bf172[_0xd403('0x1f')][_0xd403('0x20')]===0x1f4){logger[_0xd403('0x1f')](_0xd403('0x1a'),_0x3b84a0,_0x1bf172[_0xd403('0x1f')][_0xd403('0x21')]);return _0x415c1c(_0x1bf172[_0xd403('0x1f')][_0xd403('0x21')]);}logger['error'](_0xd403('0x1a'),_0x3b84a0,_0x1bf172[_0xd403('0x1f')][_0xd403('0x21')]);return _0x174804(_0x1bf172['error'][_0xd403('0x21')]);}else{logger[_0xd403('0x22')]('Network,\x20%s,\x20%s',_0x3b84a0,_0xd403('0x1d'));_0x174804(_0x1bf172[_0xd403('0x23')][_0xd403('0x21')]);}})['catch'](function(_0x564ca8){logger[_0xd403('0x1f')](_0xd403('0x1a'),_0x3b84a0,_0x564ca8);_0x415c1c(_0x564ca8);});});}function respondWithStatusCode(_0x5bdf4f,_0x515c74){_0x515c74=_0x515c74||0xcc;return function(_0x1f28cc){if(_0x1f28cc){return _0x5bdf4f[_0xd403('0x24')](_0x515c74);}return _0x5bdf4f[_0xd403('0x25')](_0x515c74)[_0xd403('0x26')]();};}function respondWithResult(_0x5e9b99,_0x51ffdc){_0x51ffdc=_0x51ffdc||0xc8;return function(_0x280fe6){if(_0x280fe6){return _0x5e9b99[_0xd403('0x25')](_0x51ffdc)[_0xd403('0x27')](_0x280fe6);}};}function respondWithFilteredResult(_0x2c25b0,_0x4b0d60){return function(_0x6a776){if(_0x6a776){var _0x397062=typeof _0x4b0d60['offset']===_0xd403('0x28')&&typeof _0x4b0d60[_0xd403('0x29')]===_0xd403('0x28');var _0x41e545=_0x6a776[_0xd403('0x2a')];var _0x3f5484=_0x397062?0x0:_0x4b0d60['offset'];var _0x7d17f8=_0x397062?_0x6a776[_0xd403('0x2a')]:_0x4b0d60['offset']+_0x4b0d60['limit'];var _0x10de2f;if(_0x7d17f8>=_0x41e545){_0x7d17f8=_0x41e545;_0x10de2f=0xc8;}else{_0x10de2f=0xce;}_0x2c25b0[_0xd403('0x25')](_0x10de2f);return _0x2c25b0['set']('Content-Range',_0x3f5484+'-'+_0x7d17f8+'/'+_0x41e545)[_0xd403('0x27')](_0x6a776);}return null;};}function patchUpdates(_0x5971fe){return function(_0x21cbc5){try{jsonpatch[_0xd403('0x2b')](_0x21cbc5,_0x5971fe,!![]);}catch(_0x496475){return BPromise[_0xd403('0x2c')](_0x496475);}return _0x21cbc5[_0xd403('0x2d')]();};}function saveUpdates(_0x44eb90,_0x15388a){return function(_0x3444ed){if(_0x3444ed){return _0x3444ed[_0xd403('0x2e')](_0x44eb90)[_0xd403('0x19')](function(_0x1a6f83){return _0x1a6f83;});}return null;};}function removeEntity(_0x4f196e,_0x2e9d59){return function(_0x2a31e8){if(_0x2a31e8){return _0x2a31e8['destroy']()['then'](function(){_0x4f196e[_0xd403('0x25')](0xcc)[_0xd403('0x26')]();});}};}function handleEntityNotFound(_0x5a2f8c,_0x5bb680){return function(_0x549323){if(!_0x549323){_0x5a2f8c[_0xd403('0x24')](0x194);}return _0x549323;};}function handleError(_0x48548d,_0x79c9da){_0x79c9da=_0x79c9da||0x1f4;return function(_0x482780){logger[_0xd403('0x1f')](_0x482780[_0xd403('0x2f')]);if(_0x482780['name']){delete _0x482780['name'];}_0x48548d[_0xd403('0x25')](_0x79c9da)['send'](_0x482780);};}exports['index']=function(_0xf3c6d3,_0xfa0be5){var _0x39d6c9={},_0x417961={},_0x26726d={'count':0x0,'rows':[]};var _0x1b00a7=_[_0xd403('0x30')](db['Network'][_0xd403('0x31')],function(_0x5b643a){return{'name':_0x5b643a[_0xd403('0x32')],'type':_0x5b643a[_0xd403('0x33')][_0xd403('0x34')]};});_0x417961[_0xd403('0x35')]=_[_0xd403('0x30')](_0x1b00a7,_0xd403('0x36'));_0x417961[_0xd403('0x37')]=_['keys'](_0xf3c6d3[_0xd403('0x37')]);_0x417961[_0xd403('0x38')]=_[_0xd403('0x39')](_0x417961['model'],_0x417961['query']);_0x39d6c9[_0xd403('0x3a')]=_[_0xd403('0x39')](_0x417961[_0xd403('0x35')],qs[_0xd403('0x3b')](_0xf3c6d3[_0xd403('0x37')][_0xd403('0x3b')]));_0x39d6c9[_0xd403('0x3a')]=_0x39d6c9[_0xd403('0x3a')]['length']?_0x39d6c9[_0xd403('0x3a')]:_0x417961[_0xd403('0x35')];if(!_0xf3c6d3['query'][_0xd403('0x3c')](_0xd403('0x3d'))){_0x39d6c9['limit']=qs[_0xd403('0x29')](_0xf3c6d3[_0xd403('0x37')]['limit']);_0x39d6c9[_0xd403('0x3e')]=qs[_0xd403('0x3e')](_0xf3c6d3[_0xd403('0x37')][_0xd403('0x3e')]);}_0x39d6c9['order']=qs[_0xd403('0x3f')](_0xf3c6d3[_0xd403('0x37')][_0xd403('0x3f')]);_0x39d6c9[_0xd403('0x40')]=qs[_0xd403('0x38')](_[_0xd403('0x41')](_0xf3c6d3[_0xd403('0x37')],_0x417961[_0xd403('0x38')]),_0x1b00a7);if(_0xf3c6d3[_0xd403('0x37')][_0xd403('0x42')]){_0x39d6c9['where']=_[_0xd403('0x43')](_0x39d6c9['where'],{'$or':_[_0xd403('0x30')](_0x1b00a7,function(_0x26631d){if(_0x26631d[_0xd403('0x33')]!==_0xd403('0x44')){var _0x58cf24={};_0x58cf24[_0x26631d[_0xd403('0x36')]]={'$like':'%'+_0xf3c6d3['query']['filter']+'%'};return _0x58cf24;}})});}_0x39d6c9=_[_0xd403('0x43')]({},_0x39d6c9,_0xf3c6d3['options']);var _0x183b9c={'where':_0x39d6c9['where']};return db[_0xd403('0x45')][_0xd403('0x2a')](_0x183b9c)[_0xd403('0x19')](function(_0x50f028){_0x26726d['count']=_0x50f028;if(_0xf3c6d3[_0xd403('0x37')][_0xd403('0x46')]){_0x39d6c9[_0xd403('0x47')]=[{'all':!![]}];}return db[_0xd403('0x45')][_0xd403('0x48')](_0x39d6c9);})['then'](function(_0x4ead97){_0x26726d[_0xd403('0x49')]=_0x4ead97;return _0x26726d;})[_0xd403('0x19')](respondWithFilteredResult(_0xfa0be5,_0x39d6c9))[_0xd403('0x4a')](handleError(_0xfa0be5,null));};exports['show']=function(_0x32bb05,_0x3962d8){var _0x19a817={'raw':!![],'where':{'id':_0x32bb05[_0xd403('0x4b')]['id']}},_0x15e5b4={};_0x15e5b4[_0xd403('0x35')]=_[_0xd403('0x4c')](db[_0xd403('0x45')][_0xd403('0x31')]);_0x15e5b4[_0xd403('0x37')]=_[_0xd403('0x4c')](_0x32bb05[_0xd403('0x37')]);_0x15e5b4['filters']=_[_0xd403('0x39')](_0x15e5b4[_0xd403('0x35')],_0x15e5b4[_0xd403('0x37')]);_0x19a817['attributes']=_['intersection'](_0x15e5b4['model'],qs[_0xd403('0x3b')](_0x32bb05[_0xd403('0x37')][_0xd403('0x3b')]));_0x19a817[_0xd403('0x3a')]=_0x19a817[_0xd403('0x3a')]['length']?_0x19a817[_0xd403('0x3a')]:_0x15e5b4[_0xd403('0x35')];if(_0x32bb05[_0xd403('0x37')][_0xd403('0x46')]){_0x19a817['include']=[{'all':!![]}];}_0x19a817=_['merge']({},_0x19a817,_0x32bb05[_0xd403('0x4d')]);return db[_0xd403('0x45')][_0xd403('0x4e')](_0x19a817)[_0xd403('0x19')](handleEntityNotFound(_0x3962d8,null))[_0xd403('0x19')](respondWithResult(_0x3962d8,null))[_0xd403('0x4a')](handleError(_0x3962d8,null));};exports['create']=function(_0x4eb714,_0x5079e7,_0x56d0b8){var _0x38fc46;return db[_0xd403('0x4f')][_0xd403('0x50')](function(_0x2522b7){return db[_0xd403('0x45')]['create'](_0x4eb714[_0xd403('0x51')],{'raw':!![]})['then'](function(_0x486ee4){_0x38fc46=_0x486ee4;return db[_0xd403('0x45')][_0xd403('0x48')]({'where':{'type':_0x4eb714[_0xd403('0x51')][_0xd403('0x33')]},'raw':!![]});})[_0xd403('0x19')](function(_0x563c0f){if(_0x38fc46[_0xd403('0x33')]['toUpperCase']()==_0xd403('0x52')){var _0x4507d8=fs['readFileSync'](path[_0xd403('0x53')](config[_0xd403('0x54')],_0xd403('0x55')),_0xd403('0x56'));var _0x5d4582=ejs['render'](_0x4507d8,{'networks':_0x563c0f||[]});fs[_0xd403('0x57')](_0xd403('0x58'),_0x5d4582);return respondWithRpcPromise(_0xd403('0x59'),_0xd403('0x5a'),{'module':_0xd403('0x5b')});}else if(_0x38fc46[_0xd403('0x33')][_0xd403('0x5c')]()==_0xd403('0x5d')){var _0x465b4c=fs[_0xd403('0x5e')](path[_0xd403('0x53')](config['root'],_0xd403('0x5f')),'utf8');var _0x48a3c2=ejs[_0xd403('0x60')](_0x465b4c,{'networks':_0x563c0f||[]});fs[_0xd403('0x57')](_0xd403('0x61'),_0x48a3c2);return respondWithRpcPromise(_0xd403('0x59'),_0xd403('0x5a'),{'module':'res_stun_monitor.so'});}else{var _0x58edf1=fs[_0xd403('0x5e')](path['join'](config['root'],_0xd403('0x62')),_0xd403('0x56'));var _0x16bee9=ejs['render'](_0x58edf1,{'networks':_0x563c0f||[]});fs[_0xd403('0x57')](util['format']('/etc/asterisk/sip_xcally_%s.conf',_0x4eb714[_0xd403('0x51')][_0xd403('0x33')][_0xd403('0x63')]()),_0x16bee9);return respondWithRpcPromise(_0xd403('0x59'),_0xd403('0x5a'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x38fc46;});})['then'](respondWithResult(_0x5079e7,0xc9))['catch'](handleError(_0x5079e7,null));};exports[_0xd403('0x2e')]=function(_0x3627a7,_0x4a266a,_0x2875b7){var _0x12e03f;return db['sequelize'][_0xd403('0x50')](function(_0x5e2375){return db['Network'][_0xd403('0x4e')]({'where':{'id':_0x3627a7[_0xd403('0x4b')]['id']}})[_0xd403('0x19')](handleEntityNotFound(_0x4a266a,null))['then'](saveUpdates(_0x3627a7[_0xd403('0x51')],null))['then'](function(_0x5de100){if(_0x5de100){_0x12e03f=_0x5de100;return db[_0xd403('0x45')][_0xd403('0x48')]({'where':{'type':_0x12e03f[_0xd403('0x33')]},'raw':!![]});}return null;})[_0xd403('0x19')](function(_0x4659ce){if(_0x12e03f[_0xd403('0x33')][_0xd403('0x5c')]()==_0xd403('0x52')){var _0x456641=fs[_0xd403('0x5e')](path['join'](config[_0xd403('0x54')],_0xd403('0x55')),'utf8');var _0x3f5914=ejs[_0xd403('0x60')](_0x456641,{'networks':_0x4659ce||[]});fs[_0xd403('0x57')](_0xd403('0x58'),_0x3f5914);return respondWithRpcPromise(_0xd403('0x59'),'update',{'module':_0xd403('0x5b')});}else if(_0x12e03f['type'][_0xd403('0x5c')]()==_0xd403('0x5d')){var _0x32c9ec=fs['readFileSync'](path['join'](config[_0xd403('0x54')],'server/files/templates/turn_multiple.ejs'),_0xd403('0x56'));var _0x56d27b=ejs[_0xd403('0x60')](_0x32c9ec,{'networks':_0x4659ce||[]});fs[_0xd403('0x57')](_0xd403('0x61'),_0x56d27b);return respondWithRpcPromise('Reload','update',{'module':_0xd403('0x5b')});}else{var _0x3cf169=fs[_0xd403('0x5e')](path[_0xd403('0x53')](config[_0xd403('0x54')],_0xd403('0x62')),'utf8');var _0x22c798=ejs[_0xd403('0x60')](_0x3cf169,{'networks':_0x4659ce||[]});fs[_0xd403('0x57')](util[_0xd403('0x64')](_0xd403('0x65'),_0x3627a7['body'][_0xd403('0x33')][_0xd403('0x63')]()),_0x22c798);return respondWithRpcPromise('Reload',_0xd403('0x2e'),{'module':_0xd403('0x66')});}return null;})[_0xd403('0x19')](function(_0x1994be){if(_0x1994be){return _0x12e03f;}return null;});})[_0xd403('0x19')](respondWithResult(_0x4a266a,null))[_0xd403('0x4a')](handleError(_0x4a266a,null));};exports[_0xd403('0x67')]=function(_0x11b92d,_0x30cc09,_0x80aa4c){var _0x2174ca;return db[_0xd403('0x45')][_0xd403('0x4e')]({'where':{'id':_0x11b92d[_0xd403('0x4b')]['id']}})[_0xd403('0x19')](function(_0x2fb233){_0x2174ca=_0x2fb233;return _0x2fb233;})['then'](handleEntityNotFound(_0x30cc09,null))[_0xd403('0x19')](removeEntity(_0x30cc09,null))[_0xd403('0x19')](function(){if(_0x2174ca){return db[_0xd403('0x45')][_0xd403('0x48')]({'where':{'type':_0x2174ca[_0xd403('0x33')]},'raw':!![]});}})[_0xd403('0x19')](function(_0x31d101){if(_0x2174ca[_0xd403('0x33')][_0xd403('0x5c')]()==_0xd403('0x52')){var _0x14d939=fs[_0xd403('0x5e')](path[_0xd403('0x53')](config[_0xd403('0x54')],_0xd403('0x55')),'utf8');var _0x269ef7=ejs[_0xd403('0x60')](_0x14d939,{'networks':_0x31d101||[]});fs[_0xd403('0x57')]('/etc/asterisk/stun_xcally.conf',_0x269ef7);return respondWithRpcPromise(_0xd403('0x59'),'destroy',{'module':_0xd403('0x5b')});}else if(_0x2174ca[_0xd403('0x33')][_0xd403('0x5c')]()==_0xd403('0x5d')){var _0x3c0b82=fs[_0xd403('0x5e')](path[_0xd403('0x53')](config['root'],'server/files/templates/turn_multiple.ejs'),_0xd403('0x56'));var _0x26d988=ejs[_0xd403('0x60')](_0x3c0b82,{'networks':_0x31d101||[]});fs[_0xd403('0x57')]('/etc/asterisk/turn_xcally.conf',_0x26d988);return respondWithRpcPromise('Reload',_0xd403('0x67'),{'module':_0xd403('0x5b')});}else{var _0x3f4008=fs[_0xd403('0x5e')](path[_0xd403('0x53')](config[_0xd403('0x54')],'server/files/templates/network.ejs'),_0xd403('0x56'));var _0x383299=ejs[_0xd403('0x60')](_0x3f4008,{'networks':_0x31d101||[]});fs[_0xd403('0x57')](util[_0xd403('0x64')](_0xd403('0x65'),_0x11b92d[_0xd403('0x51')][_0xd403('0x33')][_0xd403('0x63')]()),_0x383299);return respondWithRpcPromise(_0xd403('0x59'),_0xd403('0x67'),{'module':_0xd403('0x66')});}return null;})[_0xd403('0x4a')](handleError(_0x30cc09,null));}; \ No newline at end of file +var _0xb91a=['save','destroy','name','map','Network','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','fields','includeAll','find','create','sequelize','transaction','body','toUpperCase','STUN','readFileSync','join','root','utf8','render','writeFileSync','/etc/asterisk/stun_xcally.conf','Reload','res_stun_monitor.so','TURN','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','update','server/files/templates/turn_multiple.ejs','server/files/templates/stun_multiple.ejs','chan_sip.so','eml-format','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','jayson/promise','client','http','request','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject'];(function(_0x3d9b04,_0x1e851a){var _0x557936=function(_0x3bf3ae){while(--_0x3bf3ae){_0x3d9b04['push'](_0x3d9b04['shift']());}};_0x557936(++_0x1e851a);}(_0xb91a,0x112));var _0xab91=function(_0x38e1cd,_0x1f5f5d){_0x38e1cd=_0x38e1cd-0x0;var _0x55c62e=_0xb91a[_0x38e1cd];return _0x55c62e;};'use strict';var emlformat=require(_0xab91('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xab91('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xab91('0x2'));var moment=require('moment');var BPromise=require(_0xab91('0x3'));var Mustache=require(_0xab91('0x4'));var util=require(_0xab91('0x5'));var path=require(_0xab91('0x6'));var sox=require(_0xab91('0x7'));var csv=require(_0xab91('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xab91('0x9'));var squel=require('squel');var crypto=require(_0xab91('0xa'));var jsforce=require(_0xab91('0xb'));var deskjs=require(_0xab91('0xc'));var toCsv=require(_0xab91('0x8'));var querystring=require(_0xab91('0xd'));var Papa=require(_0xab91('0xe'));var Redis=require(_0xab91('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xab91('0x10'));var as=require(_0xab91('0x11'));var hardwareService=require(_0xab91('0x12'));var logger=require(_0xab91('0x13'))(_0xab91('0x14'));var utils=require(_0xab91('0x15'));var config=require(_0xab91('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0xab91('0x17'));var client=jayson[_0xab91('0x18')][_0xab91('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x1f631a,_0x1c9121,_0x38f730,_0x493d86){return new BPromise(function(_0x451f76,_0x55275d){var _0x29a899=_0x493d86||client;return _0x29a899[_0xab91('0x1a')](_0x1f631a,_0x38f730)[_0xab91('0x1b')](function(_0x2a73dc){logger[_0xab91('0x1c')](_0xab91('0x1d'),_0x1c9121,'request\x20sent');logger[_0xab91('0x1e')](_0xab91('0x1f'),_0x1c9121,_0xab91('0x20'),JSON[_0xab91('0x21')](_0x2a73dc));if(_0x2a73dc[_0xab91('0x22')]){if(_0x2a73dc['error'][_0xab91('0x23')]===0x1f4){logger[_0xab91('0x22')](_0xab91('0x1d'),_0x1c9121,_0x2a73dc[_0xab91('0x22')]['message']);return _0x55275d(_0x2a73dc[_0xab91('0x22')][_0xab91('0x24')]);}logger['error'](_0xab91('0x1d'),_0x1c9121,_0x2a73dc[_0xab91('0x22')]['message']);return _0x451f76(_0x2a73dc[_0xab91('0x22')][_0xab91('0x24')]);}else{logger[_0xab91('0x1c')](_0xab91('0x1d'),_0x1c9121,_0xab91('0x20'));_0x451f76(_0x2a73dc[_0xab91('0x25')]['message']);}})['catch'](function(_0x4657c6){logger[_0xab91('0x22')]('Network,\x20%s,\x20%s',_0x1c9121,_0x4657c6);_0x55275d(_0x4657c6);});});}function respondWithStatusCode(_0x506062,_0x1a170e){_0x1a170e=_0x1a170e||0xcc;return function(_0x357b3f){if(_0x357b3f){return _0x506062[_0xab91('0x26')](_0x1a170e);}return _0x506062['status'](_0x1a170e)[_0xab91('0x27')]();};}function respondWithResult(_0x2f8e34,_0x159e3a){_0x159e3a=_0x159e3a||0xc8;return function(_0x383218){if(_0x383218){return _0x2f8e34[_0xab91('0x28')](_0x159e3a)[_0xab91('0x29')](_0x383218);}};}function respondWithFilteredResult(_0x2caeb0,_0x5ba44e){return function(_0x4a93e0){if(_0x4a93e0){var _0xba049=typeof _0x5ba44e[_0xab91('0x2a')]===_0xab91('0x2b')&&typeof _0x5ba44e[_0xab91('0x2c')]===_0xab91('0x2b');var _0x13e2f4=_0x4a93e0[_0xab91('0x2d')];var _0x5247b0=_0xba049?0x0:_0x5ba44e['offset'];var _0x87634e=_0xba049?_0x4a93e0['count']:_0x5ba44e[_0xab91('0x2a')]+_0x5ba44e[_0xab91('0x2c')];var _0x151e11;if(_0x87634e>=_0x13e2f4){_0x87634e=_0x13e2f4;_0x151e11=0xc8;}else{_0x151e11=0xce;}_0x2caeb0[_0xab91('0x28')](_0x151e11);return _0x2caeb0[_0xab91('0x2e')](_0xab91('0x2f'),_0x5247b0+'-'+_0x87634e+'/'+_0x13e2f4)['json'](_0x4a93e0);}return null;};}function patchUpdates(_0xfc5a6b){return function(_0x484a87){try{jsonpatch[_0xab91('0x30')](_0x484a87,_0xfc5a6b,!![]);}catch(_0x2d8cd1){return BPromise[_0xab91('0x31')](_0x2d8cd1);}return _0x484a87[_0xab91('0x32')]();};}function saveUpdates(_0x4eede8,_0x3f40d6){return function(_0x535c9f){if(_0x535c9f){return _0x535c9f['update'](_0x4eede8)[_0xab91('0x1b')](function(_0x1d028f){return _0x1d028f;});}return null;};}function removeEntity(_0x14fb78,_0x11a3ba){return function(_0x30713c){if(_0x30713c){return _0x30713c[_0xab91('0x33')]()[_0xab91('0x1b')](function(){_0x14fb78[_0xab91('0x28')](0xcc)[_0xab91('0x27')]();});}};}function handleEntityNotFound(_0x1fd348,_0x2cc7c9){return function(_0x41ae6e){if(!_0x41ae6e){_0x1fd348[_0xab91('0x26')](0x194);}return _0x41ae6e;};}function handleError(_0x37f8d6,_0x286aba){_0x286aba=_0x286aba||0x1f4;return function(_0x18fd32){logger[_0xab91('0x22')](_0x18fd32['stack']);if(_0x18fd32['name']){delete _0x18fd32[_0xab91('0x34')];}_0x37f8d6['status'](_0x286aba)['send'](_0x18fd32);};}exports['index']=function(_0x1780cd,_0x1d6e38){var _0x3a1cf3={},_0x56e1c9={},_0x11a97f={'count':0x0,'rows':[]};var _0x522053=_[_0xab91('0x35')](db[_0xab91('0x36')][_0xab91('0x37')],function(_0x51a7ea){return{'name':_0x51a7ea[_0xab91('0x38')],'type':_0x51a7ea[_0xab91('0x39')][_0xab91('0x3a')]};});_0x56e1c9['model']=_['map'](_0x522053,'name');_0x56e1c9[_0xab91('0x3b')]=_[_0xab91('0x3c')](_0x1780cd['query']);_0x56e1c9[_0xab91('0x3d')]=_[_0xab91('0x3e')](_0x56e1c9[_0xab91('0x3f')],_0x56e1c9[_0xab91('0x3b')]);_0x3a1cf3[_0xab91('0x40')]=_['intersection'](_0x56e1c9['model'],qs['fields'](_0x1780cd[_0xab91('0x3b')]['fields']));_0x3a1cf3['attributes']=_0x3a1cf3[_0xab91('0x40')][_0xab91('0x41')]?_0x3a1cf3[_0xab91('0x40')]:_0x56e1c9[_0xab91('0x3f')];if(!_0x1780cd[_0xab91('0x3b')][_0xab91('0x42')](_0xab91('0x43'))){_0x3a1cf3[_0xab91('0x2c')]=qs[_0xab91('0x2c')](_0x1780cd[_0xab91('0x3b')][_0xab91('0x2c')]);_0x3a1cf3[_0xab91('0x2a')]=qs['offset'](_0x1780cd['query'][_0xab91('0x2a')]);}_0x3a1cf3['order']=qs[_0xab91('0x44')](_0x1780cd[_0xab91('0x3b')]['sort']);_0x3a1cf3[_0xab91('0x45')]=qs[_0xab91('0x3d')](_['pick'](_0x1780cd[_0xab91('0x3b')],_0x56e1c9[_0xab91('0x3d')]),_0x522053);if(_0x1780cd[_0xab91('0x3b')][_0xab91('0x46')]){_0x3a1cf3['where']=_[_0xab91('0x47')](_0x3a1cf3['where'],{'$or':_[_0xab91('0x35')](_0x522053,function(_0x1143e1){if(_0x1143e1[_0xab91('0x39')]!==_0xab91('0x48')){var _0x183896={};_0x183896[_0x1143e1[_0xab91('0x34')]]={'$like':'%'+_0x1780cd[_0xab91('0x3b')][_0xab91('0x46')]+'%'};return _0x183896;}})});}_0x3a1cf3=_[_0xab91('0x47')]({},_0x3a1cf3,_0x1780cd[_0xab91('0x49')]);var _0x250d91={'where':_0x3a1cf3[_0xab91('0x45')]};return db[_0xab91('0x36')]['count'](_0x250d91)['then'](function(_0x26856a){_0x11a97f[_0xab91('0x2d')]=_0x26856a;if(_0x1780cd[_0xab91('0x3b')]['includeAll']){_0x3a1cf3[_0xab91('0x4a')]=[{'all':!![]}];}return db[_0xab91('0x36')][_0xab91('0x4b')](_0x3a1cf3);})[_0xab91('0x1b')](function(_0x5714fc){_0x11a97f[_0xab91('0x4c')]=_0x5714fc;return _0x11a97f;})['then'](respondWithFilteredResult(_0x1d6e38,_0x3a1cf3))[_0xab91('0x4d')](handleError(_0x1d6e38,null));};exports[_0xab91('0x4e')]=function(_0xb53c7b,_0x591e5c){var _0x4b3fbe={'raw':!![],'where':{'id':_0xb53c7b[_0xab91('0x4f')]['id']}},_0x1a6398={};_0x1a6398[_0xab91('0x3f')]=_['keys'](db['Network']['rawAttributes']);_0x1a6398[_0xab91('0x3b')]=_[_0xab91('0x3c')](_0xb53c7b[_0xab91('0x3b')]);_0x1a6398['filters']=_[_0xab91('0x3e')](_0x1a6398['model'],_0x1a6398[_0xab91('0x3b')]);_0x4b3fbe[_0xab91('0x40')]=_[_0xab91('0x3e')](_0x1a6398[_0xab91('0x3f')],qs[_0xab91('0x50')](_0xb53c7b[_0xab91('0x3b')][_0xab91('0x50')]));_0x4b3fbe[_0xab91('0x40')]=_0x4b3fbe[_0xab91('0x40')][_0xab91('0x41')]?_0x4b3fbe['attributes']:_0x1a6398['model'];if(_0xb53c7b[_0xab91('0x3b')][_0xab91('0x51')]){_0x4b3fbe[_0xab91('0x4a')]=[{'all':!![]}];}_0x4b3fbe=_[_0xab91('0x47')]({},_0x4b3fbe,_0xb53c7b['options']);return db[_0xab91('0x36')][_0xab91('0x52')](_0x4b3fbe)['then'](handleEntityNotFound(_0x591e5c,null))[_0xab91('0x1b')](respondWithResult(_0x591e5c,null))[_0xab91('0x4d')](handleError(_0x591e5c,null));};exports[_0xab91('0x53')]=function(_0x11ee33,_0x1bf0e9,_0x460a0f){var _0x521cb7;return db[_0xab91('0x54')][_0xab91('0x55')](function(_0x1996aa){return db[_0xab91('0x36')][_0xab91('0x53')](_0x11ee33[_0xab91('0x56')],{'raw':!![]})[_0xab91('0x1b')](function(_0xa0bc63){_0x521cb7=_0xa0bc63;return db[_0xab91('0x36')][_0xab91('0x4b')]({'where':{'type':_0x11ee33['body'][_0xab91('0x39')]},'raw':!![]});})[_0xab91('0x1b')](function(_0x303815){if(_0x521cb7[_0xab91('0x39')][_0xab91('0x57')]()==_0xab91('0x58')){var _0x221d09=fs[_0xab91('0x59')](path[_0xab91('0x5a')](config[_0xab91('0x5b')],'server/files/templates/stun_multiple.ejs'),_0xab91('0x5c'));var _0x4e8164=ejs[_0xab91('0x5d')](_0x221d09,{'networks':_0x303815||[]});fs[_0xab91('0x5e')](_0xab91('0x5f'),_0x4e8164);return respondWithRpcPromise(_0xab91('0x60'),_0xab91('0x53'),{'module':_0xab91('0x61')});}else if(_0x521cb7[_0xab91('0x39')]['toUpperCase']()==_0xab91('0x62')){var _0x262699=fs['readFileSync'](path[_0xab91('0x5a')](config[_0xab91('0x5b')],'server/files/templates/turn_multiple.ejs'),'utf8');var _0x39a395=ejs[_0xab91('0x5d')](_0x262699,{'networks':_0x303815||[]});fs[_0xab91('0x5e')](_0xab91('0x63'),_0x39a395);return respondWithRpcPromise(_0xab91('0x60'),_0xab91('0x53'),{'module':_0xab91('0x61')});}else{var _0x5c1f95=fs[_0xab91('0x59')](path[_0xab91('0x5a')](config[_0xab91('0x5b')],_0xab91('0x64')),_0xab91('0x5c'));var _0x795741=ejs[_0xab91('0x5d')](_0x5c1f95,{'networks':_0x303815||[]});fs[_0xab91('0x5e')](util[_0xab91('0x65')](_0xab91('0x66'),_0x11ee33[_0xab91('0x56')][_0xab91('0x39')][_0xab91('0x67')]()),_0x795741);return respondWithRpcPromise(_0xab91('0x60'),_0xab91('0x53'),{'module':'chan_sip.so'});}return null;})['then'](function(){return _0x521cb7;});})[_0xab91('0x1b')](respondWithResult(_0x1bf0e9,0xc9))[_0xab91('0x4d')](handleError(_0x1bf0e9,null));};exports[_0xab91('0x68')]=function(_0x191f99,_0x5aacca,_0x345b92){var _0x5552c0;return db[_0xab91('0x54')][_0xab91('0x55')](function(_0x3536ba){return db[_0xab91('0x36')][_0xab91('0x52')]({'where':{'id':_0x191f99['params']['id']}})[_0xab91('0x1b')](handleEntityNotFound(_0x5aacca,null))[_0xab91('0x1b')](saveUpdates(_0x191f99[_0xab91('0x56')],null))['then'](function(_0x196c2d){if(_0x196c2d){_0x5552c0=_0x196c2d;return db[_0xab91('0x36')][_0xab91('0x4b')]({'where':{'type':_0x5552c0['type']},'raw':!![]});}return null;})[_0xab91('0x1b')](function(_0x328bb0){if(_0x5552c0['type'][_0xab91('0x57')]()==_0xab91('0x58')){var _0x16127f=fs[_0xab91('0x59')](path[_0xab91('0x5a')](config[_0xab91('0x5b')],'server/files/templates/stun_multiple.ejs'),_0xab91('0x5c'));var _0x38b9db=ejs[_0xab91('0x5d')](_0x16127f,{'networks':_0x328bb0||[]});fs[_0xab91('0x5e')](_0xab91('0x5f'),_0x38b9db);return respondWithRpcPromise('Reload',_0xab91('0x68'),{'module':_0xab91('0x61')});}else if(_0x5552c0[_0xab91('0x39')][_0xab91('0x57')]()==_0xab91('0x62')){var _0x86bfd3=fs[_0xab91('0x59')](path[_0xab91('0x5a')](config[_0xab91('0x5b')],_0xab91('0x69')),_0xab91('0x5c'));var _0x1a8519=ejs[_0xab91('0x5d')](_0x86bfd3,{'networks':_0x328bb0||[]});fs[_0xab91('0x5e')](_0xab91('0x63'),_0x1a8519);return respondWithRpcPromise(_0xab91('0x60'),_0xab91('0x68'),{'module':_0xab91('0x61')});}else{var _0x321b5d=fs['readFileSync'](path[_0xab91('0x5a')](config[_0xab91('0x5b')],'server/files/templates/network.ejs'),_0xab91('0x5c'));var _0x154cd7=ejs[_0xab91('0x5d')](_0x321b5d,{'networks':_0x328bb0||[]});fs[_0xab91('0x5e')](util[_0xab91('0x65')]('/etc/asterisk/sip_xcally_%s.conf',_0x191f99[_0xab91('0x56')][_0xab91('0x39')]['toLowerCase']()),_0x154cd7);return respondWithRpcPromise(_0xab91('0x60'),_0xab91('0x68'),{'module':'chan_sip.so'});}return null;})[_0xab91('0x1b')](function(_0x4b8f18){if(_0x4b8f18){return _0x5552c0;}return null;});})[_0xab91('0x1b')](respondWithResult(_0x5aacca,null))['catch'](handleError(_0x5aacca,null));};exports[_0xab91('0x33')]=function(_0x40bfdf,_0x49b6ef,_0x5e0e3c){var _0x308b2f;return db[_0xab91('0x36')]['find']({'where':{'id':_0x40bfdf[_0xab91('0x4f')]['id']}})['then'](function(_0x3714bf){_0x308b2f=_0x3714bf;return _0x3714bf;})[_0xab91('0x1b')](handleEntityNotFound(_0x49b6ef,null))[_0xab91('0x1b')](removeEntity(_0x49b6ef,null))[_0xab91('0x1b')](function(){if(_0x308b2f){return db[_0xab91('0x36')][_0xab91('0x4b')]({'where':{'type':_0x308b2f[_0xab91('0x39')]},'raw':!![]});}})[_0xab91('0x1b')](function(_0xc00f2d){if(_0x308b2f[_0xab91('0x39')][_0xab91('0x57')]()==_0xab91('0x58')){var _0x1ee21b=fs['readFileSync'](path[_0xab91('0x5a')](config[_0xab91('0x5b')],_0xab91('0x6a')),'utf8');var _0x2a276e=ejs[_0xab91('0x5d')](_0x1ee21b,{'networks':_0xc00f2d||[]});fs['writeFileSync'](_0xab91('0x5f'),_0x2a276e);return respondWithRpcPromise(_0xab91('0x60'),'destroy',{'module':_0xab91('0x61')});}else if(_0x308b2f[_0xab91('0x39')]['toUpperCase']()==_0xab91('0x62')){var _0x501019=fs['readFileSync'](path[_0xab91('0x5a')](config[_0xab91('0x5b')],'server/files/templates/turn_multiple.ejs'),_0xab91('0x5c'));var _0x36160c=ejs['render'](_0x501019,{'networks':_0xc00f2d||[]});fs[_0xab91('0x5e')](_0xab91('0x63'),_0x36160c);return respondWithRpcPromise(_0xab91('0x60'),_0xab91('0x33'),{'module':_0xab91('0x61')});}else{var _0x1c4217=fs[_0xab91('0x59')](path[_0xab91('0x5a')](config[_0xab91('0x5b')],_0xab91('0x64')),'utf8');var _0x50c194=ejs['render'](_0x1c4217,{'networks':_0xc00f2d||[]});fs[_0xab91('0x5e')](util[_0xab91('0x65')](_0xab91('0x66'),_0x40bfdf[_0xab91('0x56')][_0xab91('0x39')]['toLowerCase']()),_0x50c194);return respondWithRpcPromise(_0xab91('0x60'),'destroy',{'module':_0xab91('0x6b')});}return null;})[_0xab91('0x4d')](handleError(_0x49b6ef,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index b09c805..0483642 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 _0x54ef=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./network.attributes','define','Network','lodash','util'];(function(_0x2d054e,_0x3d335d){var _0x25060e=function(_0x2d5af6){while(--_0x2d5af6){_0x2d054e['push'](_0x2d054e['shift']());}};_0x25060e(++_0x3d335d);}(_0x54ef,0x112));var _0xf54e=function(_0x1f80d8,_0x541dba){_0x1f80d8=_0x1f80d8-0x0;var _0xe46fb3=_0x54ef[_0x1f80d8];return _0xe46fb3;};'use strict';var _=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var logger=require(_0xf54e('0x2'))('api');var moment=require(_0xf54e('0x3'));var BPromise=require(_0xf54e('0x4'));var rp=require(_0xf54e('0x5'));var fs=require('fs');var path=require(_0xf54e('0x6'));var rimraf=require(_0xf54e('0x7'));var config=require(_0xf54e('0x8'));var attributes=require(_0xf54e('0x9'));module['exports']=function(_0x55e611,_0x18e84e){return _0x55e611[_0xf54e('0xa')](_0xf54e('0xb'),attributes,{'tableName':'network','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb821=['rimraf','../../config/environment','./network.attributes','exports','define','Network','network','util','../../config/logger','bluebird'];(function(_0x130a93,_0x258798){var _0x3eb1ca=function(_0x2a920f){while(--_0x2a920f){_0x130a93['push'](_0x130a93['shift']());}};_0x3eb1ca(++_0x258798);}(_0xb821,0xa7));var _0x1b82=function(_0x12697e,_0x5cbe2f){_0x12697e=_0x12697e-0x0;var _0x2cdc60=_0xb821[_0x12697e];return _0x2cdc60;};'use strict';var _=require('lodash');var util=require(_0x1b82('0x0'));var logger=require(_0x1b82('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1b82('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var attributes=require(_0x1b82('0x5'));module[_0x1b82('0x6')]=function(_0x597ca7,_0x3e27c4){return _0x597ca7[_0x1b82('0x7')](_0x1b82('0x8'),attributes,{'tableName':_0x1b82('0x9'),'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 c3e3c8a..a4b735f 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 _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x7a54,0x106));var _0x47a5=function(_0x26fdbe,_0x56209a){_0x26fdbe=_0x26fdbe-0x0;var _0xf7d6e0=_0x7a54[_0x26fdbe];return _0xf7d6e0;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x7a54,0x106));var _0x47a5=function(_0x529ceb,_0x561f00){_0x529ceb=_0x529ceb-0x0;var _0x4bfef1=_0x7a54[_0x529ceb];return _0x4bfef1;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 1fd619f..7ecedfd 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 _0xf6f1=['send','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','express','Router','../../components/interaction/service','../../config/environment','./openchannelAccount.controller','index','get','/describe','isAuthenticated','describe','/:id','show','getDispositions','getAnswers','getApplications','/:id/interactions','getInteractions','/:id/users','getAgents','post','create','/:id/dispositions','/:id/canned_answers','addAnswer','/:id/notify','notify','addAgents'];(function(_0x6a15c1,_0x4d5619){var _0x1612bd=function(_0x203366){while(--_0x203366){_0x6a15c1['push'](_0x6a15c1['shift']());}};_0x1612bd(++_0x4d5619);}(_0xf6f1,0x127));var _0x1f6f=function(_0x102bf5,_0x182d89){_0x102bf5=_0x102bf5-0x0;var _0x5404d8=_0xf6f1[_0x102bf5];return _0x5404d8;};'use strict';var multer=require(_0x1f6f('0x0'));var util=require('util');var path=require(_0x1f6f('0x1'));var timeout=require('connect-timeout');var express=require(_0x1f6f('0x2'));var router=express[_0x1f6f('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1f6f('0x4'));var config=require(_0x1f6f('0x5'));var controller=require(_0x1f6f('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1f6f('0x7')]);router[_0x1f6f('0x8')](_0x1f6f('0x9'),auth[_0x1f6f('0xa')](),controller[_0x1f6f('0xb')]);router['get'](_0x1f6f('0xc'),auth[_0x1f6f('0xa')](),controller[_0x1f6f('0xd')]);router[_0x1f6f('0x8')]('/:id/dispositions',auth[_0x1f6f('0xa')](),controller[_0x1f6f('0xe')]);router[_0x1f6f('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller[_0x1f6f('0xf')]);router[_0x1f6f('0x8')]('/:id/applications',auth[_0x1f6f('0xa')](),controller[_0x1f6f('0x10')]);router['get'](_0x1f6f('0x11'),auth['isAuthenticated'](),controller[_0x1f6f('0x12')]);router['get'](_0x1f6f('0x13'),auth[_0x1f6f('0xa')](),controller[_0x1f6f('0x14')]);router[_0x1f6f('0x15')]('/',auth[_0x1f6f('0xa')](),controller[_0x1f6f('0x16')]);router[_0x1f6f('0x15')](_0x1f6f('0x17'),auth[_0x1f6f('0xa')](),controller['addDisposition']);router[_0x1f6f('0x15')](_0x1f6f('0x18'),auth[_0x1f6f('0xa')](),controller[_0x1f6f('0x19')]);router[_0x1f6f('0x15')](_0x1f6f('0x1a'),controller[_0x1f6f('0x1b')]);router[_0x1f6f('0x15')]('/:id/applications',auth[_0x1f6f('0xa')](),controller['addApplications']);router[_0x1f6f('0x15')](_0x1f6f('0x13'),auth[_0x1f6f('0xa')](),controller[_0x1f6f('0x1c')]);router['post']('/:id/send',auth[_0x1f6f('0xa')](),controller[_0x1f6f('0x1d')]);router['put'](_0x1f6f('0xc'),auth[_0x1f6f('0xa')](),controller['update']);router[_0x1f6f('0x1e')](_0x1f6f('0xc'),auth['isAuthenticated'](),controller[_0x1f6f('0x1f')]);router[_0x1f6f('0x1e')](_0x1f6f('0x17'),auth['isAuthenticated'](),controller[_0x1f6f('0x20')]);router['delete'](_0x1f6f('0x18'),auth[_0x1f6f('0xa')](),controller[_0x1f6f('0x21')]);router[_0x1f6f('0x1e')](_0x1f6f('0x13'),auth['isAuthenticated'](),controller[_0x1f6f('0x22')]);module[_0x1f6f('0x23')]=router; \ No newline at end of file +var _0x6042=['/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','/:id/users','send','put','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','/:id/dispositions','getDispositions'];(function(_0xe5e3fb,_0x2fa636){var _0xdc5834=function(_0x5960b7){while(--_0x5960b7){_0xe5e3fb['push'](_0xe5e3fb['shift']());}};_0xdc5834(++_0x2fa636);}(_0x6042,0x1de));var _0x2604=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x6042[_0x17d9e3];return _0x14192d;};'use strict';var multer=require(_0x2604('0x0'));var util=require(_0x2604('0x1'));var path=require(_0x2604('0x2'));var timeout=require(_0x2604('0x3'));var express=require(_0x2604('0x4'));var router=express[_0x2604('0x5')]();var fs_extra=require(_0x2604('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x2604('0x7'));var config=require(_0x2604('0x8'));var controller=require('./openchannelAccount.controller');router[_0x2604('0x9')]('/',auth[_0x2604('0xa')](),controller['index']);router[_0x2604('0x9')](_0x2604('0xb'),auth['isAuthenticated'](),controller[_0x2604('0xc')]);router[_0x2604('0x9')](_0x2604('0xd'),auth[_0x2604('0xa')](),controller['show']);router['get'](_0x2604('0xe'),auth['isAuthenticated'](),controller[_0x2604('0xf')]);router[_0x2604('0x9')](_0x2604('0x10'),auth[_0x2604('0xa')](),controller[_0x2604('0x11')]);router[_0x2604('0x9')](_0x2604('0x12'),auth[_0x2604('0xa')](),controller[_0x2604('0x13')]);router[_0x2604('0x9')](_0x2604('0x14'),auth[_0x2604('0xa')](),controller['getInteractions']);router[_0x2604('0x9')]('/:id/users',auth[_0x2604('0xa')](),controller[_0x2604('0x15')]);router[_0x2604('0x16')]('/',auth[_0x2604('0xa')](),controller[_0x2604('0x17')]);router[_0x2604('0x16')](_0x2604('0xe'),auth[_0x2604('0xa')](),controller[_0x2604('0x18')]);router[_0x2604('0x16')](_0x2604('0x10'),auth['isAuthenticated'](),controller[_0x2604('0x19')]);router['post'](_0x2604('0x1a'),controller[_0x2604('0x1b')]);router[_0x2604('0x16')](_0x2604('0x12'),auth[_0x2604('0xa')](),controller[_0x2604('0x1c')]);router[_0x2604('0x16')](_0x2604('0x1d'),auth[_0x2604('0xa')](),controller['addAgents']);router[_0x2604('0x16')]('/:id/send',auth[_0x2604('0xa')](),controller[_0x2604('0x1e')]);router[_0x2604('0x1f')](_0x2604('0xd'),auth[_0x2604('0xa')](),controller['update']);router['delete'](_0x2604('0xd'),auth[_0x2604('0xa')](),controller[_0x2604('0x20')]);router[_0x2604('0x21')](_0x2604('0xe'),auth['isAuthenticated'](),controller[_0x2604('0x22')]);router['delete']('/:id/canned_answers',auth[_0x2604('0xa')](),controller[_0x2604('0x23')]);router[_0x2604('0x21')](_0x2604('0x1d'),auth['isAuthenticated'](),controller[_0x2604('0x24')]);module[_0x2604('0x25')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index a5ba749..3737b05 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 _0xfb9a=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','STRING','name','generate','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x5b1074,_0x596b61){var _0x4ed74d=function(_0x32bd78){while(--_0x32bd78){_0x5b1074['push'](_0x5b1074['shift']());}};_0x4ed74d(++_0x596b61);}(_0xfb9a,0x13b));var _0xafb9=function(_0x3fc25b,_0x4cc871){_0x3fc25b=_0x3fc25b-0x0;var _0x34e5ca=_0xfb9a[_0x3fc25b];return _0x34e5ca;};'use strict';var Sequelize=require(_0xafb9('0x0'));var rs=require(_0xafb9('0x1'));module['exports']={'name':{'type':Sequelize[_0xafb9('0x2')],'unique':_0xafb9('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0xafb9('0x2')]},'token':{'type':Sequelize[_0xafb9('0x2')],'defaultValue':function(){return rs[_0xafb9('0x4')]();}},'replyUri':{'type':Sequelize[_0xafb9('0x2')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xafb9('0x5');}},'notificationSound':{'type':Sequelize[_0xafb9('0x6')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xafb9('0x6')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize['STRING']},'queueTransfer':{'type':Sequelize[_0xafb9('0x6')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xafb9('0x6')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xafb9('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xafb9('0x7')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0xafb9('0x6')],'defaultValue':![],'comment':_0xafb9('0x8'),'set':function(_0x483e7a){if(!_0x483e7a)this[_0xafb9('0x9')](_0xafb9('0xa'),null);this[_0xafb9('0x9')](_0xafb9('0xb'),_0x483e7a);}}}; \ No newline at end of file +var _0xdc62=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x26aa46,_0x48fe73){var _0x318d4c=function(_0x206cb2){while(--_0x206cb2){_0x26aa46['push'](_0x26aa46['shift']());}};_0x318d4c(++_0x48fe73);}(_0xdc62,0xfd));var _0x2dc6=function(_0x3723eb,_0x4ef6ad){_0x3723eb=_0x3723eb-0x0;var _0x30b1e2=_0xdc62[_0x3723eb];return _0x30b1e2;};'use strict';var Sequelize=require(_0x2dc6('0x0'));var rs=require(_0x2dc6('0x1'));module[_0x2dc6('0x2')]={'name':{'type':Sequelize[_0x2dc6('0x3')],'unique':_0x2dc6('0x4'),'allowNull':![]},'description':{'type':Sequelize[_0x2dc6('0x3')]},'token':{'type':Sequelize[_0x2dc6('0x3')],'defaultValue':function(){return rs['generate']();}},'replyUri':{'type':Sequelize[_0x2dc6('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0x2dc6('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x2dc6('0x5')],'defaultValue':function(){return _0x2dc6('0x6');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2dc6('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2dc6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x2dc6('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2dc6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x2dc6('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2dc6('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2dc6('0x8')],'allowNull':!![],'defaultValue':null,'comment':_0x2dc6('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x2dc6('0x7')],'defaultValue':![],'comment':_0x2dc6('0xa'),'set':function(_0x2f71dd){if(!_0x2f71dd)this['setDataValue']('mandatoryDispositionPauseId',null);this['setDataValue'](_0x2dc6('0xb'),_0x2f71dd);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index dee07b7..480a4c8 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 _0x499c=['error','code','OpenchannelAccount,\x20%s,\x20%s','message','catch','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','save','update','then','OpenchannelAccounts','UserProfileResource','destroy','stack','name','send','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','show','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','OpenchannelAccountId','Disposition','rawAttributes','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','ids','notify','openchannel','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','List','Contacts','DESC','OpenchannelApplication','Applications','list','orderBy','account','contact','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','spread','firstName','messageId','interaction','created','autoclose','push','applications','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','Start','startRouting','EventManager','addApplications','sequelize','bulkCreate','findAndCountAll','priority','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','CmList','out','Messages','dataValues','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x499c,0x15a));var _0xc499=function(_0x31a073,_0x39cf7e){_0x31a073=_0x31a073-0x0;var _0x1c9a57=_0x499c[_0x31a073];return _0x1c9a57;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc499('0x0'));var zipdir=require(_0xc499('0x1'));var jsonpatch=require(_0xc499('0x2'));var rp=require(_0xc499('0x3'));var moment=require('moment');var BPromise=require(_0xc499('0x4'));var Mustache=require(_0xc499('0x5'));var util=require(_0xc499('0x6'));var path=require('path');var sox=require(_0xc499('0x7'));var csv=require(_0xc499('0x8'));var ejs=require(_0xc499('0x9'));var fs=require('fs');var fs_extra=require(_0xc499('0xa'));var _=require(_0xc499('0xb'));var squel=require(_0xc499('0xc'));var crypto=require(_0xc499('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xc499('0xe'));var toCsv=require(_0xc499('0x8'));var querystring=require(_0xc499('0xf'));var Papa=require(_0xc499('0x10'));var Redis=require(_0xc499('0x11'));var authService=require(_0xc499('0x12'));var qs=require(_0xc499('0x13'));var as=require(_0xc499('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc499('0x15'))(_0xc499('0x16'));var utils=require('../../config/utils');var config=require(_0xc499('0x17'));var licenseUtil=require(_0xc499('0x18'));var db=require('../../mysqldb')['db'];config[_0xc499('0x19')]=_[_0xc499('0x1a')](config[_0xc499('0x19')],{'host':_0xc499('0x1b'),'port':0x18eb});var socket=require(_0xc499('0x1c'))(new Redis(config[_0xc499('0x19')]));require(_0xc499('0x1d'))[_0xc499('0x1e')](socket);var jayson=require(_0xc499('0x1f'));var client=jayson[_0xc499('0x20')][_0xc499('0x21')]({'port':0x232c});var client9002=jayson[_0xc499('0x20')][_0xc499('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x2d3287,_0x2f1851,_0x2a66cd,_0x18fa10){return new BPromise(function(_0x329765,_0x4e8ceb){var _0x264141=_0x18fa10||client;return _0x264141[_0xc499('0x22')](_0x2d3287,_0x2a66cd)['then'](function(_0x13c6a2){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x2f1851,_0xc499('0x23'));logger['debug'](_0xc499('0x24'),_0x2f1851,_0xc499('0x23'),JSON[_0xc499('0x25')](_0x13c6a2));if(_0x13c6a2[_0xc499('0x26')]){if(_0x13c6a2[_0xc499('0x26')][_0xc499('0x27')]===0x1f4){logger[_0xc499('0x26')](_0xc499('0x28'),_0x2f1851,_0x13c6a2[_0xc499('0x26')][_0xc499('0x29')]);return _0x4e8ceb(_0x13c6a2[_0xc499('0x26')][_0xc499('0x29')]);}logger['error'](_0xc499('0x28'),_0x2f1851,_0x13c6a2[_0xc499('0x26')][_0xc499('0x29')]);return _0x329765(_0x13c6a2[_0xc499('0x26')][_0xc499('0x29')]);}else{logger['info'](_0xc499('0x28'),_0x2f1851,'request\x20sent');_0x329765(_0x13c6a2['result']['message']);}})[_0xc499('0x2a')](function(_0x3a806e){logger[_0xc499('0x26')]('OpenchannelAccount,\x20%s,\x20%s',_0x2f1851,_0x3a806e);_0x4e8ceb(_0x3a806e);});});}function respondWithStatusCode(_0x580e81,_0x4a7885){_0x4a7885=_0x4a7885||0xcc;return function(_0x3916d0){if(_0x3916d0){return _0x580e81[_0xc499('0x2b')](_0x4a7885);}return _0x580e81[_0xc499('0x2c')](_0x4a7885)[_0xc499('0x2d')]();};}function respondWithResult(_0x32c494,_0x2f7bbf){_0x2f7bbf=_0x2f7bbf||0xc8;return function(_0x5a5c22){if(_0x5a5c22){return _0x32c494[_0xc499('0x2c')](_0x2f7bbf)[_0xc499('0x2e')](_0x5a5c22);}};}function respondWithFilteredResult(_0x1aff59,_0x4a8765){return function(_0xec8a29){if(_0xec8a29){var _0x58f30c=typeof _0x4a8765['offset']==='undefined'&&typeof _0x4a8765['limit']===_0xc499('0x2f');var _0x13bd2a=_0xec8a29[_0xc499('0x30')];var _0x2dc9d8=_0x58f30c?0x0:_0x4a8765['offset'];var _0x521b97=_0x58f30c?_0xec8a29[_0xc499('0x30')]:_0x4a8765[_0xc499('0x31')]+_0x4a8765[_0xc499('0x32')];var _0x9cdc70;if(_0x521b97>=_0x13bd2a){_0x521b97=_0x13bd2a;_0x9cdc70=0xc8;}else{_0x9cdc70=0xce;}_0x1aff59[_0xc499('0x2c')](_0x9cdc70);return _0x1aff59[_0xc499('0x33')](_0xc499('0x34'),_0x2dc9d8+'-'+_0x521b97+'/'+_0x13bd2a)['json'](_0xec8a29);}return null;};}function patchUpdates(_0x1cc272){return function(_0x441cbb){try{jsonpatch[_0xc499('0x35')](_0x441cbb,_0x1cc272,!![]);}catch(_0x32034d){return BPromise['reject'](_0x32034d);}return _0x441cbb[_0xc499('0x36')]();};}function saveUpdates(_0x248b6e,_0x571db9){return function(_0x29a217){if(_0x29a217){return _0x29a217[_0xc499('0x37')](_0x248b6e)[_0xc499('0x38')](function(_0x40969e){return _0x40969e;});}return null;};}function removeEntity(_0x4489db,_0x4834f3){return function(_0x4acb87){if(_0x4acb87){return _0x4acb87['destroy']()['then'](function(){var _0x1eaf30=_0x4acb87['get']({'plain':!![]});var _0x3cfab9=_0xc499('0x39');return db[_0xc499('0x3a')][_0xc499('0x3b')]({'where':{'type':_0x3cfab9,'resourceId':_0x1eaf30['id']}})[_0xc499('0x38')](function(){return _0x4acb87;});})['then'](function(){_0x4489db['status'](0xcc)[_0xc499('0x2d')]();});}};}function handleEntityNotFound(_0x4df21b,_0x3616e6){return function(_0xc7e300){if(!_0xc7e300){_0x4df21b[_0xc499('0x2b')](0x194);}return _0xc7e300;};}function handleError(_0xeec34,_0x5a938f){_0x5a938f=_0x5a938f||0x1f4;return function(_0x4e2b7e){logger[_0xc499('0x26')](_0x4e2b7e[_0xc499('0x3c')]);if(_0x4e2b7e['name']){delete _0x4e2b7e[_0xc499('0x3d')];}_0xeec34['status'](_0x5a938f)[_0xc499('0x3e')](_0x4e2b7e);};}exports['index']=function(_0x84c758,_0x2d69fe){var _0x573200={'include':[{'model':db[_0xc499('0x3f')],'as':_0xc499('0x40')}]},_0x4f6b0b={},_0x247e05={'count':0x0,'rows':[]};var _0x2409f1=_[_0xc499('0x41')](db[_0xc499('0x42')]['rawAttributes'],function(_0x206b4e){return{'name':_0x206b4e[_0xc499('0x43')],'type':_0x206b4e['type'][_0xc499('0x44')]};});_0x4f6b0b[_0xc499('0x45')]=_['map'](_0x2409f1,_0xc499('0x3d'));_0x4f6b0b['query']=_[_0xc499('0x46')](_0x84c758[_0xc499('0x47')]);_0x4f6b0b[_0xc499('0x48')]=_[_0xc499('0x49')](_0x4f6b0b[_0xc499('0x45')],_0x4f6b0b[_0xc499('0x47')]);_0x573200['attributes']=_[_0xc499('0x49')](_0x4f6b0b[_0xc499('0x45')],qs[_0xc499('0x4a')](_0x84c758[_0xc499('0x47')][_0xc499('0x4a')]));_0x573200['attributes']=_0x573200[_0xc499('0x4b')][_0xc499('0x4c')]?_0x573200[_0xc499('0x4b')]:_0x4f6b0b[_0xc499('0x45')];if(!_0x84c758[_0xc499('0x47')][_0xc499('0x4d')](_0xc499('0x4e'))){_0x573200[_0xc499('0x32')]=qs['limit'](_0x84c758[_0xc499('0x47')][_0xc499('0x32')]);_0x573200['offset']=qs['offset'](_0x84c758[_0xc499('0x47')][_0xc499('0x31')]);}_0x573200[_0xc499('0x4f')]=qs[_0xc499('0x50')](_0x84c758['query'][_0xc499('0x50')]);_0x573200[_0xc499('0x51')]=qs[_0xc499('0x48')](_[_0xc499('0x52')](_0x84c758['query'],_0x4f6b0b[_0xc499('0x48')]),_0x2409f1);if(_0x84c758[_0xc499('0x47')][_0xc499('0x53')]){_0x573200['where']=_[_0xc499('0x54')](_0x573200['where'],{'$or':_[_0xc499('0x41')](_0x2409f1,function(_0x21e188){if(_0x21e188['type']!==_0xc499('0x55')){var _0x3b17b3={};_0x3b17b3[_0x21e188[_0xc499('0x3d')]]={'$like':'%'+_0x84c758[_0xc499('0x47')]['filter']+'%'};return _0x3b17b3;}})});}_0x573200=_[_0xc499('0x54')]({},_0x573200,_0x84c758[_0xc499('0x56')]);var _0x378069={'where':_0x573200[_0xc499('0x51')]};return db[_0xc499('0x42')][_0xc499('0x30')](_0x378069)[_0xc499('0x38')](function(_0x17b040){_0x247e05[_0xc499('0x30')]=_0x17b040;if(_0x84c758['query'][_0xc499('0x57')]){_0x573200[_0xc499('0x58')]=[{'all':!![]}];}return db['OpenchannelAccount'][_0xc499('0x59')](_0x573200);})['then'](function(_0x17900d){_0x247e05['rows']=_0x17900d;return _0x247e05;})[_0xc499('0x38')](respondWithFilteredResult(_0x2d69fe,_0x573200))[_0xc499('0x2a')](handleError(_0x2d69fe,null));};exports[_0xc499('0x5a')]=function(_0x20e0a4,_0x3dc4f1){var _0x1f2e6c={'raw':![],'where':{'id':_0x20e0a4[_0xc499('0x5b')]['id']},'include':[{'model':db[_0xc499('0x3f')],'as':_0xc499('0x40')}]},_0x429951={};_0x429951[_0xc499('0x45')]=_[_0xc499('0x46')](db[_0xc499('0x42')]['rawAttributes']);_0x429951[_0xc499('0x47')]=_[_0xc499('0x46')](_0x20e0a4[_0xc499('0x47')]);_0x429951[_0xc499('0x48')]=_[_0xc499('0x49')](_0x429951['model'],_0x429951[_0xc499('0x47')]);_0x1f2e6c['attributes']=_['intersection'](_0x429951[_0xc499('0x45')],qs['fields'](_0x20e0a4[_0xc499('0x47')]['fields']));_0x1f2e6c[_0xc499('0x4b')]=_0x1f2e6c['attributes'][_0xc499('0x4c')]?_0x1f2e6c['attributes']:_0x429951[_0xc499('0x45')];if(_0x20e0a4[_0xc499('0x47')]['includeAll']){_0x1f2e6c[_0xc499('0x58')]=[{'all':!![]}];}_0x1f2e6c=_[_0xc499('0x54')]({},_0x1f2e6c,_0x20e0a4[_0xc499('0x56')]);return db[_0xc499('0x42')][_0xc499('0x5c')](_0x1f2e6c)[_0xc499('0x38')](handleEntityNotFound(_0x3dc4f1,null))[_0xc499('0x38')](respondWithResult(_0x3dc4f1,null))[_0xc499('0x2a')](handleError(_0x3dc4f1,null));};exports[_0xc499('0x5d')]=function(_0x2f3d62,_0x5e52ba){return db['OpenchannelAccount']['create'](_0x2f3d62[_0xc499('0x5e')],{})[_0xc499('0x38')](function(_0x82b14d){var _0x1cc5dd=_0x2f3d62['user'][_0xc499('0x5f')]({'plain':!![]});if(!_0x1cc5dd)throw new Error(_0xc499('0x60'));if(_0x1cc5dd[_0xc499('0x61')]===_0xc499('0x62')){var _0x40f9ce=_0x82b14d['get']({'plain':!![]});var _0x5bb948=_0xc499('0x39');return db[_0xc499('0x63')][_0xc499('0x5c')]({'where':{'name':_0x5bb948,'userProfileId':_0x1cc5dd[_0xc499('0x64')]},'raw':!![]})[_0xc499('0x38')](function(_0x3e847f){if(_0x3e847f&&_0x3e847f[_0xc499('0x65')]===0x0){return db[_0xc499('0x3a')]['create']({'name':_0x40f9ce[_0xc499('0x3d')],'resourceId':_0x40f9ce['id'],'type':_0x3e847f[_0xc499('0x3d')],'sectionId':_0x3e847f['id']},{})[_0xc499('0x38')](function(){return _0x82b14d;});}else{return _0x82b14d;}})['catch'](function(_0x37699e){logger[_0xc499('0x26')](_0xc499('0x66'),_0x37699e);throw _0x37699e;});}return _0x82b14d;})[_0xc499('0x38')](respondWithResult(_0x5e52ba,0xc9))['catch'](handleError(_0x5e52ba,null));};exports[_0xc499('0x37')]=function(_0x2e36ad,_0x3828ca){if(_0x2e36ad['body']['id']){delete _0x2e36ad[_0xc499('0x5e')]['id'];}return db['OpenchannelAccount'][_0xc499('0x5c')]({'where':{'id':_0x2e36ad['params']['id']},'include':[{'model':db[_0xc499('0x3f')],'as':_0xc499('0x40')}]})[_0xc499('0x38')](handleEntityNotFound(_0x3828ca,null))['then'](saveUpdates(_0x2e36ad[_0xc499('0x5e')],null))[_0xc499('0x38')](respondWithResult(_0x3828ca,null))[_0xc499('0x2a')](handleError(_0x3828ca,null));};exports[_0xc499('0x3b')]=function(_0x40fa55,_0xdff25c){return db[_0xc499('0x42')][_0xc499('0x5c')]({'where':{'id':_0x40fa55['params']['id']}})[_0xc499('0x38')](handleEntityNotFound(_0xdff25c,null))[_0xc499('0x38')](removeEntity(_0xdff25c,null))['catch'](handleError(_0xdff25c,null));};exports[_0xc499('0x67')]=function(_0x2c5410,_0x1af0e3){return db['OpenchannelAccount'][_0xc499('0x67')]()[_0xc499('0x38')](respondWithResult(_0x1af0e3,null))['catch'](handleError(_0x1af0e3,null));};exports[_0xc499('0x68')]=function(_0x1f50de,_0x25bb0b,_0x53ccef){if(_0x1f50de['body']['id']){delete _0x1f50de[_0xc499('0x5e')]['id'];}return db[_0xc499('0x42')][_0xc499('0x5c')]({'where':{'id':_0x1f50de[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x25bb0b,null))[_0xc499('0x38')](function(_0x39bd77){if(_0x39bd77){_0x1f50de[_0xc499('0x5e')][_0xc499('0x69')]=_0x39bd77['id'];return db['Disposition'][_0xc499('0x5d')](_0x1f50de[_0xc499('0x5e')]);}})['then'](respondWithResult(_0x25bb0b,null))[_0xc499('0x2a')](handleError(_0x25bb0b,null));};exports['getDispositions']=function(_0x390b1d,_0x32297b,_0x54cb4f){var _0x4a1adb={'raw':![],'where':{}};var _0x5df5a8={};var _0x15eec2={'count':0x0,'rows':[]};return db[_0xc499('0x42')]['findOne']({'where':{'id':_0x390b1d['params']['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x32297b,null))[_0xc499('0x38')](function(_0x3994a1){if(_0x3994a1){_0x5df5a8[_0xc499('0x45')]=_[_0xc499('0x46')](db[_0xc499('0x6a')][_0xc499('0x6b')]);_0x5df5a8['query']=_[_0xc499('0x46')](_0x390b1d['query']);_0x5df5a8[_0xc499('0x48')]=_[_0xc499('0x49')](_0x5df5a8[_0xc499('0x45')],_0x5df5a8[_0xc499('0x47')]);_0x4a1adb[_0xc499('0x4b')]=_[_0xc499('0x49')](_0x5df5a8[_0xc499('0x45')],qs[_0xc499('0x4a')](_0x390b1d[_0xc499('0x47')][_0xc499('0x4a')]));_0x4a1adb[_0xc499('0x4b')]=_0x4a1adb[_0xc499('0x4b')][_0xc499('0x4c')]?_0x4a1adb[_0xc499('0x4b')]:_0x5df5a8['model'];if(!_0x390b1d[_0xc499('0x47')][_0xc499('0x4d')](_0xc499('0x4e'))){_0x4a1adb[_0xc499('0x32')]=qs[_0xc499('0x32')](_0x390b1d[_0xc499('0x47')][_0xc499('0x32')]);_0x4a1adb['offset']=qs[_0xc499('0x31')](_0x390b1d['query']['offset']);}_0x4a1adb[_0xc499('0x4f')]=qs[_0xc499('0x50')](_0x390b1d[_0xc499('0x47')]['sort']);_0x4a1adb[_0xc499('0x51')]=qs[_0xc499('0x48')](_[_0xc499('0x52')](_0x390b1d[_0xc499('0x47')],_0x5df5a8[_0xc499('0x48')]));_0x4a1adb[_0xc499('0x51')][_0xc499('0x69')]=_0x3994a1['id'];if(_0x390b1d[_0xc499('0x47')][_0xc499('0x53')]){_0x4a1adb[_0xc499('0x51')]=_[_0xc499('0x54')](_0x4a1adb['where'],{'$or':_[_0xc499('0x41')](_0x4a1adb[_0xc499('0x4b')],function(_0x460684){var _0x3bea18={};_0x3bea18[_0x460684]={'$like':'%'+_0x390b1d[_0xc499('0x47')]['filter']+'%'};return _0x3bea18;})});}_0x4a1adb=_['merge']({},_0x4a1adb,_0x390b1d[_0xc499('0x56')]);return db[_0xc499('0x6a')][_0xc499('0x30')]({'where':_0x4a1adb[_0xc499('0x51')]})[_0xc499('0x38')](function(_0xd37745){_0x15eec2[_0xc499('0x30')]=_0xd37745;if(_0x390b1d[_0xc499('0x47')][_0xc499('0x57')]){_0x4a1adb[_0xc499('0x58')]=[{'all':!![]}];}return db[_0xc499('0x6a')][_0xc499('0x59')](_0x4a1adb);})[_0xc499('0x38')](function(_0x96f414){_0x15eec2['rows']=_0x96f414;return _0x15eec2;});}})['then'](respondWithFilteredResult(_0x32297b,_0x4a1adb))['catch'](handleError(_0x32297b,null));};exports[_0xc499('0x6c')]=function(_0x4d5fbb,_0x38f5fd,_0x5b34fe){return db[_0xc499('0x42')]['find']({'where':{'id':_0x4d5fbb[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x38f5fd,null))[_0xc499('0x38')](function(_0x4bddc5){if(_0x4bddc5){return _0x4bddc5[_0xc499('0x6c')](_0x4d5fbb['query']['ids']);}})[_0xc499('0x38')](respondWithStatusCode(_0x38f5fd,null))[_0xc499('0x2a')](handleError(_0x38f5fd,null));};exports[_0xc499('0x6d')]=function(_0x136cef,_0x4d2fc1,_0x433aca){if(_0x136cef['body']['id']){delete _0x136cef[_0xc499('0x5e')]['id'];}return db[_0xc499('0x42')][_0xc499('0x5c')]({'where':{'id':_0x136cef[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x4d2fc1,null))[_0xc499('0x38')](function(_0x9fa3e9){if(_0x9fa3e9){_0x136cef[_0xc499('0x5e')][_0xc499('0x69')]=_0x9fa3e9['id'];return db[_0xc499('0x6e')][_0xc499('0x5d')](_0x136cef[_0xc499('0x5e')]);}})[_0xc499('0x38')](respondWithResult(_0x4d2fc1,null))[_0xc499('0x2a')](handleError(_0x4d2fc1,null));};exports[_0xc499('0x6f')]=function(_0x103656,_0x1dc31b,_0x5b2f40){var _0x2f4141={'raw':![],'where':{}};var _0x1dd14c={};var _0x48f09e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0xc499('0x70')]({'where':{'id':_0x103656[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x1dc31b,null))[_0xc499('0x38')](function(_0x474ef3){if(_0x474ef3){_0x1dd14c[_0xc499('0x45')]=_['keys'](db[_0xc499('0x6e')][_0xc499('0x6b')]);_0x1dd14c[_0xc499('0x47')]=_[_0xc499('0x46')](_0x103656[_0xc499('0x47')]);_0x1dd14c['filters']=_['intersection'](_0x1dd14c[_0xc499('0x45')],_0x1dd14c['query']);_0x2f4141[_0xc499('0x4b')]=_[_0xc499('0x49')](_0x1dd14c[_0xc499('0x45')],qs[_0xc499('0x4a')](_0x103656[_0xc499('0x47')][_0xc499('0x4a')]));_0x2f4141[_0xc499('0x4b')]=_0x2f4141[_0xc499('0x4b')]['length']?_0x2f4141['attributes']:_0x1dd14c[_0xc499('0x45')];if(!_0x103656['query'][_0xc499('0x4d')](_0xc499('0x4e'))){_0x2f4141[_0xc499('0x32')]=qs[_0xc499('0x32')](_0x103656[_0xc499('0x47')][_0xc499('0x32')]);_0x2f4141[_0xc499('0x31')]=qs[_0xc499('0x31')](_0x103656[_0xc499('0x47')][_0xc499('0x31')]);}_0x2f4141[_0xc499('0x4f')]=qs['sort'](_0x103656[_0xc499('0x47')][_0xc499('0x50')]);_0x2f4141[_0xc499('0x51')]=qs[_0xc499('0x48')](_['pick'](_0x103656[_0xc499('0x47')],_0x1dd14c[_0xc499('0x48')]));_0x2f4141[_0xc499('0x51')]['OpenchannelAccountId']=_0x474ef3['id'];if(_0x103656[_0xc499('0x47')][_0xc499('0x53')]){_0x2f4141['where']=_[_0xc499('0x54')](_0x2f4141[_0xc499('0x51')],{'$or':_['map'](_0x2f4141[_0xc499('0x4b')],function(_0x1bc198){var _0x331447={};_0x331447[_0x1bc198]={'$like':'%'+_0x103656[_0xc499('0x47')]['filter']+'%'};return _0x331447;})});}_0x2f4141=_[_0xc499('0x54')]({},_0x2f4141,_0x103656[_0xc499('0x56')]);return db[_0xc499('0x6e')][_0xc499('0x30')]({'where':_0x2f4141['where']})[_0xc499('0x38')](function(_0x4c03cb){_0x48f09e[_0xc499('0x30')]=_0x4c03cb;if(_0x103656[_0xc499('0x47')][_0xc499('0x57')]){_0x2f4141[_0xc499('0x58')]=[{'all':!![]}];}return db[_0xc499('0x6e')]['findAll'](_0x2f4141);})[_0xc499('0x38')](function(_0x11b44a){_0x48f09e['rows']=_0x11b44a;return _0x48f09e;});}})[_0xc499('0x38')](respondWithFilteredResult(_0x1dc31b,_0x2f4141))[_0xc499('0x2a')](handleError(_0x1dc31b,null));};exports['removeAnswers']=function(_0x1b2aa0,_0x156007,_0x2c5546){return db[_0xc499('0x42')][_0xc499('0x5c')]({'where':{'id':_0x1b2aa0[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x156007,null))[_0xc499('0x38')](function(_0x4e1771){if(_0x4e1771){return _0x4e1771[_0xc499('0x71')](_0x1b2aa0[_0xc499('0x47')][_0xc499('0x72')]);}})[_0xc499('0x38')](respondWithStatusCode(_0x156007,null))['catch'](handleError(_0x156007,null));};exports[_0xc499('0x73')]=function(_0x11cb04,_0x32b8ec,_0x3b0a74){var _0x529793={'body':_0x11cb04[_0xc499('0x5e')],'channel':_0xc499('0x74')};var _0x1a1417=[];var _0x5c414d=[];var _0xf8d8ad={};var _0x320404=![];return db[_0xc499('0x75')]['describe']()[_0xc499('0x38')](function(_0x2191a2){if(!_0x2191a2){throw new db[(_0xc499('0x76'))][(_0xc499('0x77'))](_0xc499('0x78'));}_0x1a1417=_[_0xc499('0x79')](_['keys'](_0x2191a2),[_0xc499('0x7a'),_0xc499('0x7b')]);_0x5c414d=_[_0xc499('0x79')](_[_0xc499('0x46')](_0x2191a2),['createdAt',_0xc499('0x7b'),_0xc499('0x7c'),_0xc499('0x7d')]);if(_0x11cb04['body']['id']){delete _0x11cb04[_0xc499('0x5e')]['id'];}if(_[_0xc499('0x7e')](_0x11cb04[_0xc499('0x5e')]['from'])){throw new db['Sequelize']['ValidationError'](_0xc499('0x7f'));}if(_[_0xc499('0x7e')](_0x11cb04['body'][_0xc499('0x5e')])||_0x11cb04[_0xc499('0x5e')][_0xc499('0x5e')]===''){throw new db['Sequelize'][(_0xc499('0x77'))](_0xc499('0x80'));}if(_[_0xc499('0x7e')](_0x11cb04[_0xc499('0x5e')][_0xc499('0x81')])){throw new db[(_0xc499('0x76'))][(_0xc499('0x77'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x5c414d);}if(!_['includes'](_0x5c414d,_0x11cb04[_0xc499('0x5e')][_0xc499('0x81')])){throw new db[(_0xc499('0x76'))][(_0xc499('0x77'))](_0xc499('0x82')+_0x5c414d);}_0xf8d8ad[_0x11cb04[_0xc499('0x5e')][_0xc499('0x81')]]=_0x11cb04['body'][_0xc499('0x83')];})[_0xc499('0x38')](function(){return db['OpenchannelAccount'][_0xc499('0x5c')]({'where':{'id':_0x11cb04[_0xc499('0x5b')]['id']},'include':[{'model':db['CmList'],'as':_0xc499('0x84'),'include':[{'model':db[_0xc499('0x75')],'as':_0xc499('0x85'),'where':_0xf8d8ad,'limit':0x1,'order':[[_0xc499('0x7b'),_0xc499('0x86')]]}]},{'model':db[_0xc499('0x87')],'as':_0xc499('0x88')}]});})[_0xc499('0x38')](handleEntityNotFound(_0x32b8ec,null))[_0xc499('0x38')](function(_0x7e41db){if(_0x7e41db&&_0x7e41db['List']){_0x529793['account']=_0x7e41db;_0x529793['applications']=_0x7e41db['Applications'];_0x529793[_0xc499('0x89')]=_0x7e41db['List'];_0x529793['applications']=_[_0xc499('0x8a')](_0x529793['applications'],['priority'],['asc']);if(_0x529793[_0xc499('0x8b')][_0xc499('0x88')]){delete _0x529793[_0xc499('0x8b')][_0xc499('0x88')];}if(_0x529793[_0xc499('0x8b')][_0xc499('0x84')]&&_0x529793[_0xc499('0x8b')][_0xc499('0x84')][_0xc499('0x85')][_0xc499('0x4c')]){return _0x529793[_0xc499('0x8b')][_0xc499('0x84')][_0xc499('0x85')][0x0];}var _0x1b467b=_['defaults'](_0x11cb04['body'],{'firstName':_0x11cb04['body']['from'],'ListId':_0x7e41db['ListId']});_0x1b467b[_0x11cb04[_0xc499('0x5e')][_0xc499('0x81')]]=_0x11cb04[_0xc499('0x5e')][_0xc499('0x83')];return db[_0xc499('0x75')][_0xc499('0x5d')](_0x1b467b,{'fields':_0x1a1417,'raw':!![]});}})[_0xc499('0x38')](handleEntityNotFound(_0x32b8ec,null))[_0xc499('0x38')](function(_0x1df1e1){_0x529793[_0xc499('0x8c')]=_0x1df1e1;if(_0x1df1e1){var _0x115544={'ContactId':_0x1df1e1['id'],'OpenchannelAccountId':_0x11cb04['params']['id'],'from':(_0x1df1e1['firstName']||'')+'\x20'+(_0x1df1e1[_0xc499('0x8d')]||'')};var _0x3c4d0e={'OpenchannelAccountId':_0x11cb04[_0xc499('0x5b')]['id'],'closed':![]};if(_0x11cb04[_0xc499('0x5e')]['threadId']){_0x3c4d0e[_0xc499('0x8e')]=_0x11cb04[_0xc499('0x5e')][_0xc499('0x8e')];return db[_0xc499('0x8f')][_0xc499('0x5c')]({'where':_0x3c4d0e})[_0xc499('0x38')](function(_0x2e5de9){if(_0x2e5de9){return[_0x2e5de9,![]];}_0x115544[_0xc499('0x8e')]=_0x11cb04[_0xc499('0x5e')][_0xc499('0x8e')];_0x115544[_0xc499('0x90')]=_0x11cb04[_0xc499('0x5e')][_0xc499('0x90')];return db['OpenchannelInteraction'][_0xc499('0x5d')](_0x115544)[_0xc499('0x38')](function(_0x1e5ff0){return[_0x1e5ff0,!![]];});});}else{_0x3c4d0e[_0xc499('0x8e')]=null;}_0x3c4d0e[_0xc499('0x91')]=_0x1df1e1['id'];return db[_0xc499('0x8f')][_0xc499('0x5c')]({'where':_0x3c4d0e})[_0xc499('0x38')](function(_0x19a446){if(_0x19a446){return[_0x19a446,![]];}return db[_0xc499('0x8f')][_0xc499('0x5d')](_0x115544)[_0xc499('0x38')](function(_0x14fec0){return[_0x14fec0,!![]];});});}})[_0xc499('0x92')](function(_0x5856e1,_0x2fae56){if(_0x5856e1){_0x320404=_0x2fae56;if(!_0x2fae56){var _0x4fda10={'from':(_0x529793[_0xc499('0x8c')][_0xc499('0x93')]||'')+'\x20'+(_0x529793[_0xc499('0x8c')][_0xc499('0x8d')]||'')};if(_0x11cb04[_0xc499('0x5e')][_0xc499('0x8e')]&&_0x11cb04[_0xc499('0x5e')][_0xc499('0x94')]&&_0x11cb04['body']['threadId']!=_0x11cb04[_0xc499('0x5e')]['messageId']){_0x4fda10[_0xc499('0x8e')]=_0x11cb04[_0xc499('0x5e')][_0xc499('0x94')];}return _0x5856e1['update'](_0x4fda10);}else{return _0x5856e1;}}})[_0xc499('0x38')](function(_0x5b7f25){_0x529793[_0xc499('0x95')]=_0x5b7f25[_0xc499('0x5f')]({'plain':!![]});_0x529793[_0xc499('0x95')][_0xc499('0x96')]=_0x320404;if(_0x529793[_0xc499('0x95')]['created']){if(_0x529793[_0xc499('0x8b')][_0xc499('0x97')]){_0x529793['applications'][_0xc499('0x98')]({'id':0x0,'priority':_0x529793[_0xc499('0x99')][_0xc499('0x4c')]+0x1,'app':'close','appdata':_0xc499('0x9a'),'interval':_0xc499('0x9b')});}}return db[_0xc499('0x9c')]['create']({'body':_0x11cb04[_0xc499('0x5e')][_0xc499('0x5e')],'OpenchannelAccountId':_0x11cb04['params']['id'],'OpenchannelInteractionId':_0x5b7f25['id'],'direction':'in','ContactId':_0x529793[_0xc499('0x8c')]['id'],'AttachmentId':_0x11cb04['body'][_0xc499('0x9d')]});})[_0xc499('0x38')](function(_0x30729e){_0x529793[_0xc499('0x29')]=_0x30729e;if(_0x529793[_0xc499('0x95')][_0xc499('0x9e')]){return db['User']['find']({'attributes':['id',_0xc499('0x3d')],'where':{'id':_0x529793['interaction'][_0xc499('0x9e')]}})[_0xc499('0x38')](function(_0x51943a){if(_0x51943a){_0x529793[_0xc499('0x99')][_0xc499('0x9f')]({'id':0x0,'priority':0x0,'app':_0xc499('0xa0'),'appdata':_0x51943a['name']+','+(_0x529793[_0xc499('0x8b')][_0xc499('0xa1')]||0xa),'interval':_0xc499('0x9b')});_0x529793[_0xc499('0xa2')]=![];}return respondWithRpcPromise(_0xc499('0xa3'),_0xc499('0xa4'),_0x529793);});}return respondWithRpcPromise('Start','startRouting',_0x529793);})[_0xc499('0x38')](function(_0x3971df){respondWithRpcPromise(_0xc499('0xa5'),_0xc499('0xa5'),{'event':_0xc499('0x73'),'message':_0x3971df},client9002);return _0x3971df;})[_0xc499('0x38')](respondWithResult(_0x32b8ec,null))[_0xc499('0x2a')](handleError(_0x32b8ec,null));};exports[_0xc499('0xa6')]=function(_0x412c06,_0x12c7c5,_0x1f31cb){return db[_0xc499('0x42')][_0xc499('0x70')]({'where':{'id':_0x412c06[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x12c7c5,null))[_0xc499('0x38')](function(_0x3eb882){if(_0x3eb882){return db[_0xc499('0xa7')]['transaction'](function(_0x5d84c6){return db[_0xc499('0x87')]['destroy']({'where':{'OpenchannelAccountId':_0x412c06[_0xc499('0x5b')]['id']},'transaction':_0x5d84c6})[_0xc499('0x38')](function(_0x4b49e9){var _0x5645a3=_[_0xc499('0x41')](_0x412c06[_0xc499('0x5e')],function(_0x57f079){_0x57f079[_0xc499('0x69')]=_0x412c06[_0xc499('0x5b')]['id'];return _0x57f079;});return db['OpenchannelApplication'][_0xc499('0xa8')](_0x5645a3,{'transaction':_0x5d84c6});});})[_0xc499('0x38')](function(){return db[_0xc499('0x87')][_0xc499('0xa9')]({'where':{'OpenchannelAccountId':_0x412c06[_0xc499('0x5b')]['id']},'order':_0xc499('0xaa')});});}})[_0xc499('0x38')](respondWithResult(_0x12c7c5,null))[_0xc499('0x2a')](handleError(_0x12c7c5,null));};exports[_0xc499('0xab')]=function(_0x444417,_0x1a3c0e,_0x441101){var _0x4ea2dd={};var _0x4095ce={};var _0xd2cf22;var _0x4dae88;return db['OpenchannelAccount'][_0xc499('0x70')]({'where':{'id':_0x444417['params']['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x1a3c0e,null))['then'](function(_0x2f4f3e){if(_0x2f4f3e){_0xd2cf22=_0x2f4f3e;_0x4095ce[_0xc499('0x45')]=_['keys'](db[_0xc499('0x87')]['rawAttributes']);_0x4095ce[_0xc499('0x47')]=_[_0xc499('0x46')](_0x444417[_0xc499('0x47')]);_0x4095ce[_0xc499('0x48')]=_[_0xc499('0x49')](_0x4095ce[_0xc499('0x45')],_0x4095ce[_0xc499('0x47')]);_0x4ea2dd[_0xc499('0x4b')]=_[_0xc499('0x49')](_0x4095ce[_0xc499('0x45')],qs['fields'](_0x444417[_0xc499('0x47')][_0xc499('0x4a')]));_0x4ea2dd[_0xc499('0x4b')]=_0x4ea2dd[_0xc499('0x4b')][_0xc499('0x4c')]?_0x4ea2dd['attributes']:_0x4095ce[_0xc499('0x45')];_0x4ea2dd['order']=qs[_0xc499('0x50')](_0x444417[_0xc499('0x47')][_0xc499('0x50')]);_0x4ea2dd[_0xc499('0x51')]=qs[_0xc499('0x48')](_[_0xc499('0x52')](_0x444417[_0xc499('0x47')],_0x4095ce[_0xc499('0x48')]));if(_0x444417[_0xc499('0x47')][_0xc499('0x53')]){_0x4ea2dd['where']=_[_0xc499('0x54')](_0x4ea2dd['where'],{'$or':_['map'](_0x4ea2dd[_0xc499('0x4b')],function(_0x4a1699){var _0x2eb90a={};_0x2eb90a[_0x4a1699]={'$like':'%'+_0x444417[_0xc499('0x47')]['filter']+'%'};return _0x2eb90a;})});}_0x4ea2dd=_['merge']({},_0x4ea2dd,_0x444417[_0xc499('0x56')]);return _0xd2cf22[_0xc499('0xab')](_0x4ea2dd);}})[_0xc499('0x38')](function(_0x99a49b){if(_0x99a49b){_0x4dae88=_0x99a49b[_0xc499('0x4c')];if(!_0x444417['query'][_0xc499('0x4d')]('nolimit')){_0x4ea2dd[_0xc499('0x32')]=qs['limit'](_0x444417[_0xc499('0x47')]['limit']);_0x4ea2dd[_0xc499('0x31')]=qs[_0xc499('0x31')](_0x444417[_0xc499('0x47')][_0xc499('0x31')]);}return _0xd2cf22[_0xc499('0xab')](_0x4ea2dd);}})[_0xc499('0x38')](function(_0x4d9952){if(_0x4d9952){return _0x4d9952?{'count':_0x4dae88,'rows':_0x4d9952}:null;}})[_0xc499('0x38')](respondWithResult(_0x1a3c0e,null))[_0xc499('0x2a')](handleError(_0x1a3c0e,null));};exports[_0xc499('0xac')]=function(_0x2499dd,_0x3db223,_0x39571a){var _0x5cedfd={'raw':![],'where':{}};var _0x2ed25f={};var _0x32d1f9={'count':0x0,'rows':[]};return db[_0xc499('0x42')][_0xc499('0x70')]({'where':{'id':_0x2499dd[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x3db223,null))[_0xc499('0x38')](function(_0x178dfc){if(_0x178dfc){_0x2ed25f[_0xc499('0x45')]=_[_0xc499('0x46')](db[_0xc499('0x8f')][_0xc499('0x6b')]);_0x2ed25f['query']=_[_0xc499('0x46')](_0x2499dd['query']);_0x2ed25f[_0xc499('0x48')]=_[_0xc499('0x49')](_0x2ed25f[_0xc499('0x45')],_0x2ed25f['query']);_0x5cedfd[_0xc499('0x4b')]=_[_0xc499('0x49')](_0x2ed25f[_0xc499('0x45')],qs[_0xc499('0x4a')](_0x2499dd[_0xc499('0x47')][_0xc499('0x4a')]));_0x5cedfd[_0xc499('0x4b')]=_0x5cedfd[_0xc499('0x4b')]['length']?_0x5cedfd[_0xc499('0x4b')]:_0x2ed25f['model'];if(!_0x2499dd[_0xc499('0x47')][_0xc499('0x4d')](_0xc499('0x4e'))){_0x5cedfd[_0xc499('0x32')]=qs[_0xc499('0x32')](_0x2499dd[_0xc499('0x47')][_0xc499('0x32')]);_0x5cedfd[_0xc499('0x31')]=qs['offset'](_0x2499dd['query']['offset']);}_0x5cedfd['order']=qs[_0xc499('0x50')](_0x2499dd[_0xc499('0x47')][_0xc499('0x50')]);_0x5cedfd[_0xc499('0x51')]=qs[_0xc499('0x48')](_[_0xc499('0x52')](_0x2499dd[_0xc499('0x47')],_0x2ed25f[_0xc499('0x48')]));_0x5cedfd['where']['OpenchannelAccountId']=_0x178dfc['id'];if(_0x2499dd[_0xc499('0x47')][_0xc499('0x53')]){_0x5cedfd[_0xc499('0x51')]=_[_0xc499('0x54')](_0x5cedfd[_0xc499('0x51')],{'$or':_[_0xc499('0x41')](_0x5cedfd[_0xc499('0x4b')],function(_0x1c482b){var _0x588c10={};_0x588c10[_0x1c482b]={'$like':'%'+_0x2499dd[_0xc499('0x47')][_0xc499('0x53')]+'%'};return _0x588c10;})});}_0x5cedfd=_[_0xc499('0x54')]({},_0x5cedfd,_0x2499dd[_0xc499('0x56')]);return db[_0xc499('0x8f')][_0xc499('0x30')]({'where':_0x5cedfd[_0xc499('0x51')]})[_0xc499('0x38')](function(_0x53b1ad){_0x32d1f9[_0xc499('0x30')]=_0x53b1ad;if(_0x2499dd[_0xc499('0x47')]['includeAll']){_0x5cedfd['include']=[{'model':db[_0xc499('0x75')],'as':_0xc499('0xad'),'required':![]},{'model':db[_0xc499('0xae')],'as':_0xc499('0xaf'),'attributes':['name',_0xc499('0xb0'),_0xc499('0xb1')],'required':![]},{'model':db['Tag'],'as':_0xc499('0xb2'),'attributes':['id',_0xc499('0x3d'),_0xc499('0xb3')],'where':_0x2499dd['query'][_0xc499('0xb4')]?{'id':_0x2499dd['query'][_0xc499('0xb4')]}:undefined,'required':_0x2499dd['query'][_0xc499('0xb4')]?!![]:![]}];}return db[_0xc499('0x8f')][_0xc499('0x59')](_0x5cedfd);})[_0xc499('0x38')](function(_0x363005){_0x32d1f9['rows']=_0x363005;return _0x32d1f9;});}})[_0xc499('0x38')](respondWithFilteredResult(_0x3db223,_0x5cedfd))[_0xc499('0x2a')](handleError(_0x3db223,null));};exports[_0xc499('0xb5')]=function(_0x1a4d15,_0x24571f,_0x5156bf){return db[_0xc499('0x42')][_0xc499('0x5c')]({'where':{'id':_0x1a4d15[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x24571f,null))[_0xc499('0x38')](function(_0x397132){if(_0x397132){return _0x397132[_0xc499('0xb5')](_0x1a4d15[_0xc499('0x5e')][_0xc499('0x72')],_['omit'](_0x1a4d15[_0xc499('0x5e')],[_0xc499('0x72'),'id'])||{})[_0xc499('0x92')](function(_0x1b89e7){for(var _0x6da82c=0x0;_0x6da82c<_0x1a4d15['body']['ids']['length'];_0x6da82c+=0x1){socket['emit'](_0xc499('0xb6'),{'UserId':Number(_0x1a4d15[_0xc499('0x5e')][_0xc499('0x72')][_0x6da82c]),'OpenchannelAccountId':Number(_0x1a4d15[_0xc499('0x5b')]['id'])});}return _0x1b89e7;});}})[_0xc499('0x38')](respondWithResult(_0x24571f,null))['catch'](handleError(_0x24571f,null));};exports[_0xc499('0xb7')]=function(_0x159166,_0x59ad5d,_0x13f92a){return db['OpenchannelAccount'][_0xc499('0x5c')]({'where':{'id':_0x159166[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x59ad5d,null))[_0xc499('0x38')](function(_0x2f3763){if(_0x2f3763){return _0x2f3763[_0xc499('0xb7')](_0x159166[_0xc499('0x47')][_0xc499('0x72')])[_0xc499('0x38')](function(){if(_[_0xc499('0xb8')](_0x159166[_0xc499('0x47')][_0xc499('0x72')])){for(var _0x6d5bef=0x0;_0x6d5bef<_0x159166[_0xc499('0x47')][_0xc499('0x72')][_0xc499('0x4c')];_0x6d5bef+=0x1){socket[_0xc499('0xb9')](_0xc499('0xba'),{'UserId':Number(_0x159166['query']['ids'][_0x6d5bef]),'OpenchannelAccountId':Number(_0x159166[_0xc499('0x5b')]['id'])});}}else{socket['emit'](_0xc499('0xba'),{'UserId':Number(_0x159166['query'][_0xc499('0x72')]),'OpenchannelAccountId':Number(_0x159166[_0xc499('0x5b')]['id'])});}});}})[_0xc499('0x38')](respondWithStatusCode(_0x59ad5d,null))[_0xc499('0x2a')](handleError(_0x59ad5d,null));};exports[_0xc499('0xbb')]=function(_0x40ac3b,_0x1d00db,_0x3ce819){var _0x5639f9={};var _0x412a51={};var _0x525f7b;var _0x5ab756;return db['OpenchannelAccount'][_0xc499('0x70')]({'where':{'id':_0x40ac3b[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x1d00db,null))[_0xc499('0x38')](function(_0x8b8cf8){if(_0x8b8cf8){_0x525f7b=_0x8b8cf8;_0x412a51[_0xc499('0x45')]=_[_0xc499('0x46')](db['User'][_0xc499('0x6b')]);_0x412a51[_0xc499('0x47')]=_[_0xc499('0x46')](_0x40ac3b['query']);_0x412a51[_0xc499('0x48')]=_['intersection'](_0x412a51['model'],_0x412a51[_0xc499('0x47')]);_0x5639f9['attributes']=_[_0xc499('0x49')](_0x412a51[_0xc499('0x45')],qs[_0xc499('0x4a')](_0x40ac3b[_0xc499('0x47')][_0xc499('0x4a')]));_0x5639f9[_0xc499('0x4b')]=_0x5639f9['attributes'][_0xc499('0x4c')]?_0x5639f9[_0xc499('0x4b')]:_0x412a51[_0xc499('0x45')];_0x5639f9[_0xc499('0x4f')]=qs['sort'](_0x40ac3b[_0xc499('0x47')]['sort']);_0x5639f9['where']=qs[_0xc499('0x48')](_[_0xc499('0x52')](_0x40ac3b['query'],_0x412a51[_0xc499('0x48')]));if(_0x40ac3b[_0xc499('0x47')][_0xc499('0x53')]){_0x5639f9['where']=_[_0xc499('0x54')](_0x5639f9[_0xc499('0x51')],{'$or':_[_0xc499('0x41')](_0x5639f9['attributes'],function(_0x297da3){var _0x2d7727={};_0x2d7727[_0x297da3]={'$like':'%'+_0x40ac3b[_0xc499('0x47')]['filter']+'%'};return _0x2d7727;})});}_0x5639f9=_['merge']({},_0x5639f9,_0x40ac3b[_0xc499('0x56')]);return _0x525f7b[_0xc499('0xbb')](_0x5639f9);}})[_0xc499('0x38')](function(_0xc88cf1){if(_0xc88cf1){_0x5ab756=_0xc88cf1[_0xc499('0x4c')];if(!_0x40ac3b[_0xc499('0x47')][_0xc499('0x4d')](_0xc499('0x4e'))){_0x5639f9[_0xc499('0x32')]=qs[_0xc499('0x32')](_0x40ac3b[_0xc499('0x47')]['limit']);_0x5639f9[_0xc499('0x31')]=qs['offset'](_0x40ac3b[_0xc499('0x47')][_0xc499('0x31')]);}return _0x525f7b[_0xc499('0xbb')](_0x5639f9);}})['then'](function(_0x206f6b){if(_0x206f6b){return _0x206f6b?{'count':_0x5ab756,'rows':_0x206f6b}:null;}})[_0xc499('0x38')](respondWithResult(_0x1d00db,null))['catch'](handleError(_0x1d00db,null));};exports['send']=function(_0x154bd0,_0x37f02f,_0x60718f){var _0x2745a2,_0x4acd97,_0x5287c9;if(_[_0xc499('0x7e')](_0x154bd0[_0xc499('0x5e')][_0xc499('0x5e')])||_0x154bd0[_0xc499('0x5e')][_0xc499('0x5e')]===''){throw new db['Sequelize'][(_0xc499('0x77'))](_0xc499('0x80'));}if(_[_0xc499('0x7e')](_0x154bd0[_0xc499('0x5e')]['to'])){}_0x2745a2=_0x154bd0[_0xc499('0x5e')]['to'];return db['OpenchannelAccount']['findOne']({'where':{'id':_0x154bd0[_0xc499('0x5b')]['id']}})[_0xc499('0x38')](handleEntityNotFound(_0x37f02f,null))['then'](function(_0x217346){if(_0x217346){return db[_0xc499('0x42')][_0xc499('0x5c')]({'where':{'id':_0x217346['id']},'include':[{'model':db[_0xc499('0xbc')],'as':'List','include':[{'model':db['CmContact'],'as':_0xc499('0x85'),'where':{[_0x217346[_0xc499('0x81')]]:_0x2745a2},'limit':0x1,'order':[[_0xc499('0x7b'),_0xc499('0x86')]]}]}]})[_0xc499('0x38')](handleEntityNotFound(_0x37f02f,null))[_0xc499('0x38')](function(_0xc9ac9){if(_0xc9ac9&&_0xc9ac9[_0xc499('0x84')]){_0x4acd97=_0xc9ac9[_0xc499('0x5f')]({'plain':!![]});if(_0x4acd97['List']&&_0x4acd97['List'][_0xc499('0x85')][_0xc499('0x4c')]){return _0x4acd97['List'][_0xc499('0x85')][0x0];}return db[_0xc499('0x75')]['create'](_['defaults'](_0x154bd0[_0xc499('0x5e')],{'firstName':_0x2745a2,[_0xc9ac9[_0xc499('0x81')]]:_0x2745a2,'phone':_0x2745a2,'ListId':_0x4acd97[_0xc499('0x7d')]}));}})['then'](handleEntityNotFound(_0x37f02f,null))[_0xc499('0x38')](function(_0x1dcb3f){if(_0x1dcb3f){_0x5287c9=_0x1dcb3f;return db[_0xc499('0x8f')][_0xc499('0x5c')]({'where':{'ContactId':_0x5287c9['id'],'closed':![],'OpenchannelAccountId':_0x4acd97['id']}})[_0xc499('0x38')](function(_0x121c82){if(_0x121c82){return[_0x121c82,![]];}return db[_0xc499('0x8f')][_0xc499('0x5d')]({'UserId':_0x154bd0[_0xc499('0x62')]['id'],'ContactId':_0x5287c9['id'],'OpenchannelAccountId':_0x4acd97['id'],'lastMsgDirection':_0xc499('0xbd'),'Messages':[_[_0xc499('0x54')](_0x154bd0[_0xc499('0x5e')],{'read':![],'body':_0x154bd0[_0xc499('0x5e')][_0xc499('0x5e')],'OpenchannelAccountId':_0x4acd97['id'],'UserId':_0x154bd0[_0xc499('0x62')]['id'],'ContactId':_0x5287c9['id']})]},{'include':[{'model':db['OpenchannelMessage'],'as':_0xc499('0xbe')}]})[_0xc499('0x38')](function(_0x4787df){return[_0x4787df,!![]];});});}})['spread'](function(_0x2c9250,_0x92ae37){if(_0x92ae37){return _0x2c9250;}return db[_0xc499('0x9c')]['create'](_[_0xc499('0x54')](_0x154bd0[_0xc499('0x5e')],{'read':![],'body':_0x154bd0[_0xc499('0x5e')][_0xc499('0x5e')],'OpenchannelAccountId':_0x4acd97['id'],'OpenchannelInteractionId':_0x2c9250['id'],'UserId':_0x154bd0[_0xc499('0x62')]['id'],'ContactId':_0x5287c9['id']}))[_0xc499('0x38')](function(_0x753f9c){_0x2c9250['dataValues'][_0xc499('0xbe')]=[];_0x2c9250['dataValues'][_0xc499('0xbe')]['push'](_0x753f9c[_0xc499('0xbf')]);return _0x2c9250;});});}})[_0xc499('0x38')](respondWithResult(_0x37f02f,null))['catch'](handleError(_0x37f02f,null));}; \ No newline at end of file +var _0xad38=['papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','http','client','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','message','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','destroy','get','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','OpenchannelAccount','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','addAnswer','CannedAnswer','getAnswers','pick','removeAnswers','ids','openchannel','CmContact','Sequelize','ValidationError','difference','createdAt','updatedAt','ListId','from\x20is\x20mandatory','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','OpenchannelApplication','Applications','account','applications','list','orderBy','priority','asc','Contacts','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','close','*,*,*,*','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','startRouting','EventManager','notify','sequelize','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','User','Owner','fullname','Tag','Tags','color','tag','addAgents','userOpenchannelAccount:save','removeAgents','isArray','emit','userOpenchannelAccount:remove','getAgents','body\x20is\x20mandatory\x20and\x20not\x20empty','out','OpenchannelMessage','Messages','spread','dataValues','zip-dir','request-promise','moment','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js'];(function(_0xb6e2ea,_0x3b26e9){var _0x2a57bb=function(_0x2a1ac9){while(--_0x2a1ac9){_0xb6e2ea['push'](_0xb6e2ea['shift']());}};_0x2a57bb(++_0x3b26e9);}(_0xad38,0xa8));var _0x8ad3=function(_0x1bd068,_0x56e659){_0x1bd068=_0x1bd068-0x0;var _0x4007be=_0xad38[_0x1bd068];return _0x4007be;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x8ad3('0x0'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8ad3('0x1'));var moment=require(_0x8ad3('0x2'));var BPromise=require(_0x8ad3('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x8ad3('0x4'));var sox=require(_0x8ad3('0x5'));var csv=require(_0x8ad3('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8ad3('0x7'));var _=require(_0x8ad3('0x8'));var squel=require(_0x8ad3('0x9'));var crypto=require(_0x8ad3('0xa'));var jsforce=require(_0x8ad3('0xb'));var deskjs=require(_0x8ad3('0xc'));var toCsv=require(_0x8ad3('0x6'));var querystring=require('querystring');var Papa=require(_0x8ad3('0xd'));var Redis=require('ioredis');var authService=require(_0x8ad3('0xe'));var qs=require(_0x8ad3('0xf'));var as=require(_0x8ad3('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ad3('0x11'))(_0x8ad3('0x12'));var utils=require(_0x8ad3('0x13'));var config=require(_0x8ad3('0x14'));var licenseUtil=require(_0x8ad3('0x15'));var db=require('../../mysqldb')['db'];config[_0x8ad3('0x16')]=_[_0x8ad3('0x17')](config['redis'],{'host':_0x8ad3('0x18'),'port':0x18eb});var socket=require(_0x8ad3('0x19'))(new Redis(config['redis']));require(_0x8ad3('0x1a'))[_0x8ad3('0x1b')](socket);var jayson=require(_0x8ad3('0x1c'));var client=jayson['client'][_0x8ad3('0x1d')]({'port':0x232c});var client9002=jayson[_0x8ad3('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x67c9ec,_0x4e9e59,_0x134e1f,_0x3e16b5){return new BPromise(function(_0x440c18,_0x197258){var _0x5ac148=_0x3e16b5||client;return _0x5ac148['request'](_0x67c9ec,_0x134e1f)[_0x8ad3('0x1f')](function(_0x47827f){logger[_0x8ad3('0x20')](_0x8ad3('0x21'),_0x4e9e59,_0x8ad3('0x22'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x4e9e59,'request\x20sent',JSON[_0x8ad3('0x23')](_0x47827f));if(_0x47827f[_0x8ad3('0x24')]){if(_0x47827f[_0x8ad3('0x24')]['code']===0x1f4){logger[_0x8ad3('0x24')](_0x8ad3('0x21'),_0x4e9e59,_0x47827f[_0x8ad3('0x24')][_0x8ad3('0x25')]);return _0x197258(_0x47827f['error'][_0x8ad3('0x25')]);}logger[_0x8ad3('0x24')](_0x8ad3('0x21'),_0x4e9e59,_0x47827f[_0x8ad3('0x24')]['message']);return _0x440c18(_0x47827f['error']['message']);}else{logger[_0x8ad3('0x20')]('OpenchannelAccount,\x20%s,\x20%s',_0x4e9e59,_0x8ad3('0x22'));_0x440c18(_0x47827f['result'][_0x8ad3('0x25')]);}})['catch'](function(_0x548488){logger[_0x8ad3('0x24')](_0x8ad3('0x21'),_0x4e9e59,_0x548488);_0x197258(_0x548488);});});}function respondWithStatusCode(_0x1fe72d,_0x4e73d6){_0x4e73d6=_0x4e73d6||0xcc;return function(_0x416e12){if(_0x416e12){return _0x1fe72d[_0x8ad3('0x26')](_0x4e73d6);}return _0x1fe72d[_0x8ad3('0x27')](_0x4e73d6)['end']();};}function respondWithResult(_0x3157de,_0x8affe1){_0x8affe1=_0x8affe1||0xc8;return function(_0x1b86b8){if(_0x1b86b8){return _0x3157de[_0x8ad3('0x27')](_0x8affe1)[_0x8ad3('0x28')](_0x1b86b8);}};}function respondWithFilteredResult(_0x228107,_0x360738){return function(_0x3ce7e2){if(_0x3ce7e2){var _0x356ccd=typeof _0x360738[_0x8ad3('0x29')]==='undefined'&&typeof _0x360738['limit']===_0x8ad3('0x2a');var _0x182999=_0x3ce7e2['count'];var _0x1bc150=_0x356ccd?0x0:_0x360738[_0x8ad3('0x29')];var _0xfc9566=_0x356ccd?_0x3ce7e2[_0x8ad3('0x2b')]:_0x360738[_0x8ad3('0x29')]+_0x360738[_0x8ad3('0x2c')];var _0x2451ad;if(_0xfc9566>=_0x182999){_0xfc9566=_0x182999;_0x2451ad=0xc8;}else{_0x2451ad=0xce;}_0x228107['status'](_0x2451ad);return _0x228107[_0x8ad3('0x2d')](_0x8ad3('0x2e'),_0x1bc150+'-'+_0xfc9566+'/'+_0x182999)[_0x8ad3('0x28')](_0x3ce7e2);}return null;};}function patchUpdates(_0x56323c){return function(_0x64d3ce){try{jsonpatch[_0x8ad3('0x2f')](_0x64d3ce,_0x56323c,!![]);}catch(_0x2220a4){return BPromise['reject'](_0x2220a4);}return _0x64d3ce[_0x8ad3('0x30')]();};}function saveUpdates(_0x5e495d,_0x2f01dc){return function(_0x2a1663){if(_0x2a1663){return _0x2a1663[_0x8ad3('0x31')](_0x5e495d)['then'](function(_0x446a35){return _0x446a35;});}return null;};}function removeEntity(_0xffd48b,_0xedee18){return function(_0x55bb4f){if(_0x55bb4f){return _0x55bb4f[_0x8ad3('0x32')]()['then'](function(){var _0x5a9da5=_0x55bb4f[_0x8ad3('0x33')]({'plain':!![]});var _0x49fd3f='OpenchannelAccounts';return db[_0x8ad3('0x34')][_0x8ad3('0x32')]({'where':{'type':_0x49fd3f,'resourceId':_0x5a9da5['id']}})['then'](function(){return _0x55bb4f;});})[_0x8ad3('0x1f')](function(){_0xffd48b[_0x8ad3('0x27')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4acf3a,_0x39be1e){return function(_0x597fbc){if(!_0x597fbc){_0x4acf3a[_0x8ad3('0x26')](0x194);}return _0x597fbc;};}function handleError(_0x51c195,_0x39b69f){_0x39b69f=_0x39b69f||0x1f4;return function(_0x14ee94){logger['error'](_0x14ee94[_0x8ad3('0x35')]);if(_0x14ee94[_0x8ad3('0x36')]){delete _0x14ee94[_0x8ad3('0x36')];}_0x51c195[_0x8ad3('0x27')](_0x39b69f)[_0x8ad3('0x37')](_0x14ee94);};}exports[_0x8ad3('0x38')]=function(_0x4d5b48,_0x38d5d4){var _0x5d2221={'include':[{'model':db[_0x8ad3('0x39')],'as':_0x8ad3('0x3a')}]},_0x4cfdbb={},_0x4d293f={'count':0x0,'rows':[]};var _0x5de028=_[_0x8ad3('0x3b')](db[_0x8ad3('0x3c')]['rawAttributes'],function(_0x403866){return{'name':_0x403866[_0x8ad3('0x3d')],'type':_0x403866[_0x8ad3('0x3e')]['key']};});_0x4cfdbb[_0x8ad3('0x3f')]=_['map'](_0x5de028,_0x8ad3('0x36'));_0x4cfdbb[_0x8ad3('0x40')]=_[_0x8ad3('0x41')](_0x4d5b48[_0x8ad3('0x40')]);_0x4cfdbb[_0x8ad3('0x42')]=_['intersection'](_0x4cfdbb[_0x8ad3('0x3f')],_0x4cfdbb[_0x8ad3('0x40')]);_0x5d2221[_0x8ad3('0x43')]=_[_0x8ad3('0x44')](_0x4cfdbb[_0x8ad3('0x3f')],qs['fields'](_0x4d5b48[_0x8ad3('0x40')][_0x8ad3('0x45')]));_0x5d2221[_0x8ad3('0x43')]=_0x5d2221[_0x8ad3('0x43')][_0x8ad3('0x46')]?_0x5d2221[_0x8ad3('0x43')]:_0x4cfdbb[_0x8ad3('0x3f')];if(!_0x4d5b48['query'][_0x8ad3('0x47')]('nolimit')){_0x5d2221['limit']=qs[_0x8ad3('0x2c')](_0x4d5b48[_0x8ad3('0x40')][_0x8ad3('0x2c')]);_0x5d2221[_0x8ad3('0x29')]=qs[_0x8ad3('0x29')](_0x4d5b48['query']['offset']);}_0x5d2221[_0x8ad3('0x48')]=qs['sort'](_0x4d5b48[_0x8ad3('0x40')][_0x8ad3('0x49')]);_0x5d2221[_0x8ad3('0x4a')]=qs['filters'](_['pick'](_0x4d5b48['query'],_0x4cfdbb[_0x8ad3('0x42')]),_0x5de028);if(_0x4d5b48[_0x8ad3('0x40')][_0x8ad3('0x4b')]){_0x5d2221['where']=_[_0x8ad3('0x4c')](_0x5d2221[_0x8ad3('0x4a')],{'$or':_[_0x8ad3('0x3b')](_0x5de028,function(_0x5d9a1c){if(_0x5d9a1c[_0x8ad3('0x3e')]!==_0x8ad3('0x4d')){var _0x2a9ab9={};_0x2a9ab9[_0x5d9a1c[_0x8ad3('0x36')]]={'$like':'%'+_0x4d5b48[_0x8ad3('0x40')][_0x8ad3('0x4b')]+'%'};return _0x2a9ab9;}})});}_0x5d2221=_[_0x8ad3('0x4c')]({},_0x5d2221,_0x4d5b48[_0x8ad3('0x4e')]);var _0x2e0d0e={'where':_0x5d2221[_0x8ad3('0x4a')]};return db[_0x8ad3('0x3c')][_0x8ad3('0x2b')](_0x2e0d0e)['then'](function(_0x37c141){_0x4d293f['count']=_0x37c141;if(_0x4d5b48[_0x8ad3('0x40')][_0x8ad3('0x4f')]){_0x5d2221[_0x8ad3('0x50')]=[{'all':!![]}];}return db[_0x8ad3('0x3c')][_0x8ad3('0x51')](_0x5d2221);})[_0x8ad3('0x1f')](function(_0x470fd8){_0x4d293f[_0x8ad3('0x52')]=_0x470fd8;return _0x4d293f;})[_0x8ad3('0x1f')](respondWithFilteredResult(_0x38d5d4,_0x5d2221))[_0x8ad3('0x53')](handleError(_0x38d5d4,null));};exports['show']=function(_0xb8e790,_0x436510){var _0x13fcb8={'raw':![],'where':{'id':_0xb8e790[_0x8ad3('0x54')]['id']},'include':[{'model':db[_0x8ad3('0x39')],'as':_0x8ad3('0x3a')}]},_0x4b4f11={};_0x4b4f11[_0x8ad3('0x3f')]=_[_0x8ad3('0x41')](db['OpenchannelAccount'][_0x8ad3('0x55')]);_0x4b4f11['query']=_[_0x8ad3('0x41')](_0xb8e790[_0x8ad3('0x40')]);_0x4b4f11['filters']=_[_0x8ad3('0x44')](_0x4b4f11[_0x8ad3('0x3f')],_0x4b4f11[_0x8ad3('0x40')]);_0x13fcb8[_0x8ad3('0x43')]=_[_0x8ad3('0x44')](_0x4b4f11[_0x8ad3('0x3f')],qs[_0x8ad3('0x45')](_0xb8e790[_0x8ad3('0x40')][_0x8ad3('0x45')]));_0x13fcb8[_0x8ad3('0x43')]=_0x13fcb8[_0x8ad3('0x43')][_0x8ad3('0x46')]?_0x13fcb8[_0x8ad3('0x43')]:_0x4b4f11[_0x8ad3('0x3f')];if(_0xb8e790[_0x8ad3('0x40')][_0x8ad3('0x4f')]){_0x13fcb8[_0x8ad3('0x50')]=[{'all':!![]}];}_0x13fcb8=_['merge']({},_0x13fcb8,_0xb8e790['options']);return db[_0x8ad3('0x3c')]['find'](_0x13fcb8)['then'](handleEntityNotFound(_0x436510,null))['then'](respondWithResult(_0x436510,null))[_0x8ad3('0x53')](handleError(_0x436510,null));};exports[_0x8ad3('0x56')]=function(_0x34fe8a,_0x17fea2){return db[_0x8ad3('0x3c')][_0x8ad3('0x56')](_0x34fe8a[_0x8ad3('0x57')],{})[_0x8ad3('0x1f')](function(_0xb64b2e){var _0x45681e=_0x34fe8a['user'][_0x8ad3('0x33')]({'plain':!![]});if(!_0x45681e)throw new Error(_0x8ad3('0x58'));if(_0x45681e[_0x8ad3('0x59')]===_0x8ad3('0x5a')){var _0x49ccef=_0xb64b2e[_0x8ad3('0x33')]({'plain':!![]});var _0x3d3fbe='OpenchannelAccounts';return db['UserProfileSection'][_0x8ad3('0x5b')]({'where':{'name':_0x3d3fbe,'userProfileId':_0x45681e['userProfileId']},'raw':!![]})[_0x8ad3('0x1f')](function(_0x4e3e81){if(_0x4e3e81&&_0x4e3e81[_0x8ad3('0x5c')]===0x0){return db[_0x8ad3('0x34')][_0x8ad3('0x56')]({'name':_0x49ccef[_0x8ad3('0x36')],'resourceId':_0x49ccef['id'],'type':_0x4e3e81[_0x8ad3('0x36')],'sectionId':_0x4e3e81['id']},{})[_0x8ad3('0x1f')](function(){return _0xb64b2e;});}else{return _0xb64b2e;}})['catch'](function(_0x44ec54){logger['error'](_0x8ad3('0x5d'),_0x44ec54);throw _0x44ec54;});}return _0xb64b2e;})[_0x8ad3('0x1f')](respondWithResult(_0x17fea2,0xc9))['catch'](handleError(_0x17fea2,null));};exports[_0x8ad3('0x31')]=function(_0x1a6487,_0xe01ecf){if(_0x1a6487['body']['id']){delete _0x1a6487[_0x8ad3('0x57')]['id'];}return db[_0x8ad3('0x3c')]['find']({'where':{'id':_0x1a6487['params']['id']},'include':[{'model':db[_0x8ad3('0x39')],'as':_0x8ad3('0x3a')}]})[_0x8ad3('0x1f')](handleEntityNotFound(_0xe01ecf,null))[_0x8ad3('0x1f')](saveUpdates(_0x1a6487[_0x8ad3('0x57')],null))[_0x8ad3('0x1f')](respondWithResult(_0xe01ecf,null))[_0x8ad3('0x53')](handleError(_0xe01ecf,null));};exports[_0x8ad3('0x32')]=function(_0x53b0bc,_0x5ab487){return db[_0x8ad3('0x3c')][_0x8ad3('0x5b')]({'where':{'id':_0x53b0bc['params']['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x5ab487,null))[_0x8ad3('0x1f')](removeEntity(_0x5ab487,null))['catch'](handleError(_0x5ab487,null));};exports[_0x8ad3('0x5e')]=function(_0x430930,_0x3f1099){return db[_0x8ad3('0x3c')]['describe']()[_0x8ad3('0x1f')](respondWithResult(_0x3f1099,null))[_0x8ad3('0x53')](handleError(_0x3f1099,null));};exports['addDisposition']=function(_0x3c2491,_0x2aa9f1,_0x3f67bf){if(_0x3c2491[_0x8ad3('0x57')]['id']){delete _0x3c2491[_0x8ad3('0x57')]['id'];}return db[_0x8ad3('0x3c')][_0x8ad3('0x5b')]({'where':{'id':_0x3c2491[_0x8ad3('0x54')]['id']}})['then'](handleEntityNotFound(_0x2aa9f1,null))[_0x8ad3('0x1f')](function(_0x16abba){if(_0x16abba){_0x3c2491[_0x8ad3('0x57')][_0x8ad3('0x5f')]=_0x16abba['id'];return db[_0x8ad3('0x60')][_0x8ad3('0x56')](_0x3c2491['body']);}})[_0x8ad3('0x1f')](respondWithResult(_0x2aa9f1,null))[_0x8ad3('0x53')](handleError(_0x2aa9f1,null));};exports[_0x8ad3('0x61')]=function(_0x27a50b,_0x3d1a90,_0x4cf20b){var _0x20b375={'raw':![],'where':{}};var _0x2d0fe7={};var _0x58c154={'count':0x0,'rows':[]};return db[_0x8ad3('0x3c')][_0x8ad3('0x62')]({'where':{'id':_0x27a50b[_0x8ad3('0x54')]['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x3d1a90,null))[_0x8ad3('0x1f')](function(_0x1c80b2){if(_0x1c80b2){_0x2d0fe7[_0x8ad3('0x3f')]=_['keys'](db['Disposition'][_0x8ad3('0x55')]);_0x2d0fe7[_0x8ad3('0x40')]=_['keys'](_0x27a50b[_0x8ad3('0x40')]);_0x2d0fe7['filters']=_[_0x8ad3('0x44')](_0x2d0fe7['model'],_0x2d0fe7[_0x8ad3('0x40')]);_0x20b375['attributes']=_[_0x8ad3('0x44')](_0x2d0fe7['model'],qs[_0x8ad3('0x45')](_0x27a50b[_0x8ad3('0x40')][_0x8ad3('0x45')]));_0x20b375[_0x8ad3('0x43')]=_0x20b375[_0x8ad3('0x43')][_0x8ad3('0x46')]?_0x20b375['attributes']:_0x2d0fe7[_0x8ad3('0x3f')];if(!_0x27a50b['query']['hasOwnProperty'](_0x8ad3('0x63'))){_0x20b375[_0x8ad3('0x2c')]=qs[_0x8ad3('0x2c')](_0x27a50b[_0x8ad3('0x40')][_0x8ad3('0x2c')]);_0x20b375[_0x8ad3('0x29')]=qs[_0x8ad3('0x29')](_0x27a50b[_0x8ad3('0x40')][_0x8ad3('0x29')]);}_0x20b375[_0x8ad3('0x48')]=qs['sort'](_0x27a50b[_0x8ad3('0x40')][_0x8ad3('0x49')]);_0x20b375[_0x8ad3('0x4a')]=qs[_0x8ad3('0x42')](_['pick'](_0x27a50b[_0x8ad3('0x40')],_0x2d0fe7[_0x8ad3('0x42')]));_0x20b375['where'][_0x8ad3('0x5f')]=_0x1c80b2['id'];if(_0x27a50b[_0x8ad3('0x40')][_0x8ad3('0x4b')]){_0x20b375[_0x8ad3('0x4a')]=_[_0x8ad3('0x4c')](_0x20b375[_0x8ad3('0x4a')],{'$or':_[_0x8ad3('0x3b')](_0x20b375[_0x8ad3('0x43')],function(_0x1ad11d){var _0x28bcb7={};_0x28bcb7[_0x1ad11d]={'$like':'%'+_0x27a50b[_0x8ad3('0x40')]['filter']+'%'};return _0x28bcb7;})});}_0x20b375=_[_0x8ad3('0x4c')]({},_0x20b375,_0x27a50b[_0x8ad3('0x4e')]);return db[_0x8ad3('0x60')][_0x8ad3('0x2b')]({'where':_0x20b375[_0x8ad3('0x4a')]})[_0x8ad3('0x1f')](function(_0x860a1d){_0x58c154[_0x8ad3('0x2b')]=_0x860a1d;if(_0x27a50b[_0x8ad3('0x40')][_0x8ad3('0x4f')]){_0x20b375['include']=[{'all':!![]}];}return db[_0x8ad3('0x60')][_0x8ad3('0x51')](_0x20b375);})['then'](function(_0x3f76c5){_0x58c154[_0x8ad3('0x52')]=_0x3f76c5;return _0x58c154;});}})[_0x8ad3('0x1f')](respondWithFilteredResult(_0x3d1a90,_0x20b375))[_0x8ad3('0x53')](handleError(_0x3d1a90,null));};exports[_0x8ad3('0x64')]=function(_0xfeb739,_0x2d5d9c,_0x4fdbb6){return db[_0x8ad3('0x3c')]['find']({'where':{'id':_0xfeb739[_0x8ad3('0x54')]['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x2d5d9c,null))[_0x8ad3('0x1f')](function(_0x506109){if(_0x506109){return _0x506109['removeDispositions'](_0xfeb739[_0x8ad3('0x40')]['ids']);}})['then'](respondWithStatusCode(_0x2d5d9c,null))['catch'](handleError(_0x2d5d9c,null));};exports[_0x8ad3('0x65')]=function(_0x5817d3,_0x5efe34,_0x4ef97d){if(_0x5817d3[_0x8ad3('0x57')]['id']){delete _0x5817d3['body']['id'];}return db[_0x8ad3('0x3c')]['find']({'where':{'id':_0x5817d3[_0x8ad3('0x54')]['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x5efe34,null))[_0x8ad3('0x1f')](function(_0x8533f6){if(_0x8533f6){_0x5817d3[_0x8ad3('0x57')][_0x8ad3('0x5f')]=_0x8533f6['id'];return db[_0x8ad3('0x66')][_0x8ad3('0x56')](_0x5817d3[_0x8ad3('0x57')]);}})[_0x8ad3('0x1f')](respondWithResult(_0x5efe34,null))[_0x8ad3('0x53')](handleError(_0x5efe34,null));};exports[_0x8ad3('0x67')]=function(_0x17b901,_0x279699,_0x5b1fec){var _0x3532aa={'raw':![],'where':{}};var _0x381e3a={};var _0x2a7376={'count':0x0,'rows':[]};return db[_0x8ad3('0x3c')][_0x8ad3('0x62')]({'where':{'id':_0x17b901[_0x8ad3('0x54')]['id']}})['then'](handleEntityNotFound(_0x279699,null))[_0x8ad3('0x1f')](function(_0x339935){if(_0x339935){_0x381e3a[_0x8ad3('0x3f')]=_[_0x8ad3('0x41')](db[_0x8ad3('0x66')]['rawAttributes']);_0x381e3a[_0x8ad3('0x40')]=_[_0x8ad3('0x41')](_0x17b901[_0x8ad3('0x40')]);_0x381e3a[_0x8ad3('0x42')]=_['intersection'](_0x381e3a['model'],_0x381e3a[_0x8ad3('0x40')]);_0x3532aa['attributes']=_[_0x8ad3('0x44')](_0x381e3a['model'],qs['fields'](_0x17b901[_0x8ad3('0x40')][_0x8ad3('0x45')]));_0x3532aa['attributes']=_0x3532aa[_0x8ad3('0x43')][_0x8ad3('0x46')]?_0x3532aa[_0x8ad3('0x43')]:_0x381e3a['model'];if(!_0x17b901[_0x8ad3('0x40')][_0x8ad3('0x47')](_0x8ad3('0x63'))){_0x3532aa['limit']=qs['limit'](_0x17b901['query'][_0x8ad3('0x2c')]);_0x3532aa['offset']=qs['offset'](_0x17b901['query'][_0x8ad3('0x29')]);}_0x3532aa['order']=qs[_0x8ad3('0x49')](_0x17b901[_0x8ad3('0x40')][_0x8ad3('0x49')]);_0x3532aa[_0x8ad3('0x4a')]=qs[_0x8ad3('0x42')](_[_0x8ad3('0x68')](_0x17b901['query'],_0x381e3a[_0x8ad3('0x42')]));_0x3532aa['where'][_0x8ad3('0x5f')]=_0x339935['id'];if(_0x17b901[_0x8ad3('0x40')]['filter']){_0x3532aa[_0x8ad3('0x4a')]=_[_0x8ad3('0x4c')](_0x3532aa['where'],{'$or':_[_0x8ad3('0x3b')](_0x3532aa['attributes'],function(_0x18bbaf){var _0x210fe3={};_0x210fe3[_0x18bbaf]={'$like':'%'+_0x17b901['query']['filter']+'%'};return _0x210fe3;})});}_0x3532aa=_['merge']({},_0x3532aa,_0x17b901[_0x8ad3('0x4e')]);return db[_0x8ad3('0x66')][_0x8ad3('0x2b')]({'where':_0x3532aa[_0x8ad3('0x4a')]})[_0x8ad3('0x1f')](function(_0x538a04){_0x2a7376['count']=_0x538a04;if(_0x17b901[_0x8ad3('0x40')][_0x8ad3('0x4f')]){_0x3532aa[_0x8ad3('0x50')]=[{'all':!![]}];}return db[_0x8ad3('0x66')]['findAll'](_0x3532aa);})['then'](function(_0x5a2b01){_0x2a7376['rows']=_0x5a2b01;return _0x2a7376;});}})[_0x8ad3('0x1f')](respondWithFilteredResult(_0x279699,_0x3532aa))[_0x8ad3('0x53')](handleError(_0x279699,null));};exports[_0x8ad3('0x69')]=function(_0x39c3c2,_0x49d072,_0xbaec0b){return db[_0x8ad3('0x3c')][_0x8ad3('0x5b')]({'where':{'id':_0x39c3c2[_0x8ad3('0x54')]['id']}})['then'](handleEntityNotFound(_0x49d072,null))['then'](function(_0x8e59a8){if(_0x8e59a8){return _0x8e59a8['removeAnswers'](_0x39c3c2[_0x8ad3('0x40')][_0x8ad3('0x6a')]);}})['then'](respondWithStatusCode(_0x49d072,null))[_0x8ad3('0x53')](handleError(_0x49d072,null));};exports['notify']=function(_0x5889d3,_0x13029f,_0x5903f1){var _0x4bfe75={'body':_0x5889d3['body'],'channel':_0x8ad3('0x6b')};var _0x35f5b7=[];var _0x2f5f26=[];var _0x2ef3c4={};var _0x4eb7ff=![];return db[_0x8ad3('0x6c')]['describe']()[_0x8ad3('0x1f')](function(_0x5da338){if(!_0x5da338){throw new db[(_0x8ad3('0x6d'))][(_0x8ad3('0x6e'))]('no\x20available\x20attributes');}_0x35f5b7=_[_0x8ad3('0x6f')](_[_0x8ad3('0x41')](_0x5da338),[_0x8ad3('0x70'),_0x8ad3('0x71')]);_0x2f5f26=_[_0x8ad3('0x6f')](_[_0x8ad3('0x41')](_0x5da338),[_0x8ad3('0x70'),_0x8ad3('0x71'),'CompanyId',_0x8ad3('0x72')]);if(_0x5889d3[_0x8ad3('0x57')]['id']){delete _0x5889d3[_0x8ad3('0x57')]['id'];}if(_['isNil'](_0x5889d3[_0x8ad3('0x57')]['from'])){throw new db[(_0x8ad3('0x6d'))][(_0x8ad3('0x6e'))](_0x8ad3('0x73'));}if(_[_0x8ad3('0x74')](_0x5889d3[_0x8ad3('0x57')]['body'])||_0x5889d3['body']['body']===''){throw new db[(_0x8ad3('0x6d'))][(_0x8ad3('0x6e'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x8ad3('0x74')](_0x5889d3[_0x8ad3('0x57')][_0x8ad3('0x75')])){throw new db[(_0x8ad3('0x6d'))][(_0x8ad3('0x6e'))](_0x8ad3('0x76')+_0x2f5f26);}if(!_[_0x8ad3('0x77')](_0x2f5f26,_0x5889d3[_0x8ad3('0x57')]['mapKey'])){throw new db[(_0x8ad3('0x6d'))][(_0x8ad3('0x6e'))](_0x8ad3('0x78')+_0x2f5f26);}_0x2ef3c4[_0x5889d3[_0x8ad3('0x57')]['mapKey']]=_0x5889d3[_0x8ad3('0x57')]['from'];})[_0x8ad3('0x1f')](function(){return db[_0x8ad3('0x3c')][_0x8ad3('0x5b')]({'where':{'id':_0x5889d3[_0x8ad3('0x54')]['id']},'include':[{'model':db[_0x8ad3('0x79')],'as':_0x8ad3('0x7a'),'include':[{'model':db[_0x8ad3('0x6c')],'as':'Contacts','where':_0x2ef3c4,'limit':0x1,'order':[['updatedAt','DESC']]}]},{'model':db[_0x8ad3('0x7b')],'as':_0x8ad3('0x7c')}]});})[_0x8ad3('0x1f')](handleEntityNotFound(_0x13029f,null))[_0x8ad3('0x1f')](function(_0x30b80a){if(_0x30b80a&&_0x30b80a[_0x8ad3('0x7a')]){_0x4bfe75[_0x8ad3('0x7d')]=_0x30b80a;_0x4bfe75[_0x8ad3('0x7e')]=_0x30b80a[_0x8ad3('0x7c')];_0x4bfe75[_0x8ad3('0x7f')]=_0x30b80a[_0x8ad3('0x7a')];_0x4bfe75[_0x8ad3('0x7e')]=_[_0x8ad3('0x80')](_0x4bfe75['applications'],[_0x8ad3('0x81')],[_0x8ad3('0x82')]);if(_0x4bfe75[_0x8ad3('0x7d')][_0x8ad3('0x7c')]){delete _0x4bfe75[_0x8ad3('0x7d')]['Applications'];}if(_0x4bfe75[_0x8ad3('0x7d')][_0x8ad3('0x7a')]&&_0x4bfe75[_0x8ad3('0x7d')][_0x8ad3('0x7a')][_0x8ad3('0x83')]['length']){return _0x4bfe75[_0x8ad3('0x7d')][_0x8ad3('0x7a')][_0x8ad3('0x83')][0x0];}var _0x379df3=_[_0x8ad3('0x17')](_0x5889d3[_0x8ad3('0x57')],{'firstName':_0x5889d3[_0x8ad3('0x57')]['from'],'ListId':_0x30b80a['ListId']});_0x379df3[_0x5889d3[_0x8ad3('0x57')]['mapKey']]=_0x5889d3['body']['from'];return db[_0x8ad3('0x6c')][_0x8ad3('0x56')](_0x379df3,{'fields':_0x35f5b7,'raw':!![]});}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x13029f,null))[_0x8ad3('0x1f')](function(_0x40bcf1){_0x4bfe75[_0x8ad3('0x84')]=_0x40bcf1;if(_0x40bcf1){var _0x2861a5={'ContactId':_0x40bcf1['id'],'OpenchannelAccountId':_0x5889d3['params']['id'],'from':(_0x40bcf1[_0x8ad3('0x85')]||'')+'\x20'+(_0x40bcf1[_0x8ad3('0x86')]||'')};var _0x2baf85={'OpenchannelAccountId':_0x5889d3[_0x8ad3('0x54')]['id'],'closed':![]};if(_0x5889d3[_0x8ad3('0x57')][_0x8ad3('0x87')]){_0x2baf85[_0x8ad3('0x87')]=_0x5889d3['body'][_0x8ad3('0x87')];return db[_0x8ad3('0x88')][_0x8ad3('0x5b')]({'where':_0x2baf85})[_0x8ad3('0x1f')](function(_0x675baf){if(_0x675baf){return[_0x675baf,![]];}_0x2861a5['threadId']=_0x5889d3[_0x8ad3('0x57')][_0x8ad3('0x87')];_0x2861a5[_0x8ad3('0x89')]=_0x5889d3[_0x8ad3('0x57')][_0x8ad3('0x89')];return db['OpenchannelInteraction'][_0x8ad3('0x56')](_0x2861a5)[_0x8ad3('0x1f')](function(_0x12d73e){return[_0x12d73e,!![]];});});}else{_0x2baf85[_0x8ad3('0x87')]=null;}_0x2baf85[_0x8ad3('0x8a')]=_0x40bcf1['id'];return db[_0x8ad3('0x88')]['find']({'where':_0x2baf85})['then'](function(_0x1de69b){if(_0x1de69b){return[_0x1de69b,![]];}return db[_0x8ad3('0x88')][_0x8ad3('0x56')](_0x2861a5)[_0x8ad3('0x1f')](function(_0x23b989){return[_0x23b989,!![]];});});}})['spread'](function(_0x188e02,_0x1c937a){if(_0x188e02){_0x4eb7ff=_0x1c937a;if(!_0x1c937a){var _0x43b3d2={'from':(_0x4bfe75[_0x8ad3('0x84')][_0x8ad3('0x85')]||'')+'\x20'+(_0x4bfe75[_0x8ad3('0x84')][_0x8ad3('0x86')]||'')};if(_0x5889d3[_0x8ad3('0x57')][_0x8ad3('0x87')]&&_0x5889d3[_0x8ad3('0x57')][_0x8ad3('0x8b')]&&_0x5889d3[_0x8ad3('0x57')][_0x8ad3('0x87')]!=_0x5889d3[_0x8ad3('0x57')][_0x8ad3('0x8b')]){_0x43b3d2[_0x8ad3('0x87')]=_0x5889d3['body'][_0x8ad3('0x8b')];}return _0x188e02['update'](_0x43b3d2);}else{return _0x188e02;}}})[_0x8ad3('0x1f')](function(_0x4fe05e){_0x4bfe75[_0x8ad3('0x8c')]=_0x4fe05e[_0x8ad3('0x33')]({'plain':!![]});_0x4bfe75[_0x8ad3('0x8c')][_0x8ad3('0x8d')]=_0x4eb7ff;if(_0x4bfe75['interaction'][_0x8ad3('0x8d')]){if(_0x4bfe75[_0x8ad3('0x7d')][_0x8ad3('0x8e')]){_0x4bfe75[_0x8ad3('0x7e')][_0x8ad3('0x8f')]({'id':0x0,'priority':_0x4bfe75[_0x8ad3('0x7e')][_0x8ad3('0x46')]+0x1,'app':_0x8ad3('0x90'),'appdata':'unmanaged','interval':_0x8ad3('0x91')});}}return db['OpenchannelMessage'][_0x8ad3('0x56')]({'body':_0x5889d3['body'][_0x8ad3('0x57')],'OpenchannelAccountId':_0x5889d3[_0x8ad3('0x54')]['id'],'OpenchannelInteractionId':_0x4fe05e['id'],'direction':'in','ContactId':_0x4bfe75[_0x8ad3('0x84')]['id'],'AttachmentId':_0x5889d3['body'][_0x8ad3('0x92')]});})[_0x8ad3('0x1f')](function(_0x729bad){_0x4bfe75['message']=_0x729bad;if(_0x4bfe75[_0x8ad3('0x8c')][_0x8ad3('0x93')]){return db['User'][_0x8ad3('0x5b')]({'attributes':['id',_0x8ad3('0x36')],'where':{'id':_0x4bfe75['interaction'][_0x8ad3('0x93')]}})[_0x8ad3('0x1f')](function(_0x2a4a55){if(_0x2a4a55){_0x4bfe75[_0x8ad3('0x7e')][_0x8ad3('0x94')]({'id':0x0,'priority':0x0,'app':_0x8ad3('0x95'),'appdata':_0x2a4a55[_0x8ad3('0x36')]+','+(_0x4bfe75['account'][_0x8ad3('0x96')]||0xa),'interval':'*,*,*,*'});_0x4bfe75['forcedOwnership']=![];}return respondWithRpcPromise(_0x8ad3('0x97'),_0x8ad3('0x98'),_0x4bfe75);});}return respondWithRpcPromise(_0x8ad3('0x97'),'startRouting',_0x4bfe75);})[_0x8ad3('0x1f')](function(_0x2cd742){respondWithRpcPromise(_0x8ad3('0x99'),_0x8ad3('0x99'),{'event':_0x8ad3('0x9a'),'message':_0x2cd742},client9002);return _0x2cd742;})[_0x8ad3('0x1f')](respondWithResult(_0x13029f,null))[_0x8ad3('0x53')](handleError(_0x13029f,null));};exports['addApplications']=function(_0x316e6e,_0xed78fb,_0x21130c){return db[_0x8ad3('0x3c')][_0x8ad3('0x62')]({'where':{'id':_0x316e6e[_0x8ad3('0x54')]['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0xed78fb,null))[_0x8ad3('0x1f')](function(_0x1875d9){if(_0x1875d9){return db[_0x8ad3('0x9b')]['transaction'](function(_0x24de7d){return db[_0x8ad3('0x7b')][_0x8ad3('0x32')]({'where':{'OpenchannelAccountId':_0x316e6e[_0x8ad3('0x54')]['id']},'transaction':_0x24de7d})[_0x8ad3('0x1f')](function(_0x8aed82){var _0x1490b7=_[_0x8ad3('0x3b')](_0x316e6e['body'],function(_0x21715b){_0x21715b[_0x8ad3('0x5f')]=_0x316e6e[_0x8ad3('0x54')]['id'];return _0x21715b;});return db[_0x8ad3('0x7b')][_0x8ad3('0x9c')](_0x1490b7,{'transaction':_0x24de7d});});})[_0x8ad3('0x1f')](function(){return db[_0x8ad3('0x7b')][_0x8ad3('0x9d')]({'where':{'OpenchannelAccountId':_0x316e6e[_0x8ad3('0x54')]['id']},'order':_0x8ad3('0x81')});});}})[_0x8ad3('0x1f')](respondWithResult(_0xed78fb,null))[_0x8ad3('0x53')](handleError(_0xed78fb,null));};exports['getApplications']=function(_0x40c424,_0x509d1e,_0x4cc32a){var _0x3c3421={};var _0x53f665={};var _0x59ac54;var _0x3b2434;return db[_0x8ad3('0x3c')]['findOne']({'where':{'id':_0x40c424[_0x8ad3('0x54')]['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x509d1e,null))['then'](function(_0xe0fed4){if(_0xe0fed4){_0x59ac54=_0xe0fed4;_0x53f665[_0x8ad3('0x3f')]=_[_0x8ad3('0x41')](db[_0x8ad3('0x7b')][_0x8ad3('0x55')]);_0x53f665['query']=_[_0x8ad3('0x41')](_0x40c424['query']);_0x53f665[_0x8ad3('0x42')]=_['intersection'](_0x53f665['model'],_0x53f665['query']);_0x3c3421[_0x8ad3('0x43')]=_[_0x8ad3('0x44')](_0x53f665[_0x8ad3('0x3f')],qs[_0x8ad3('0x45')](_0x40c424[_0x8ad3('0x40')][_0x8ad3('0x45')]));_0x3c3421[_0x8ad3('0x43')]=_0x3c3421[_0x8ad3('0x43')][_0x8ad3('0x46')]?_0x3c3421[_0x8ad3('0x43')]:_0x53f665[_0x8ad3('0x3f')];_0x3c3421['order']=qs[_0x8ad3('0x49')](_0x40c424[_0x8ad3('0x40')]['sort']);_0x3c3421[_0x8ad3('0x4a')]=qs[_0x8ad3('0x42')](_[_0x8ad3('0x68')](_0x40c424[_0x8ad3('0x40')],_0x53f665[_0x8ad3('0x42')]));if(_0x40c424[_0x8ad3('0x40')][_0x8ad3('0x4b')]){_0x3c3421['where']=_[_0x8ad3('0x4c')](_0x3c3421[_0x8ad3('0x4a')],{'$or':_[_0x8ad3('0x3b')](_0x3c3421[_0x8ad3('0x43')],function(_0x27e7fb){var _0x19fe2f={};_0x19fe2f[_0x27e7fb]={'$like':'%'+_0x40c424['query'][_0x8ad3('0x4b')]+'%'};return _0x19fe2f;})});}_0x3c3421=_['merge']({},_0x3c3421,_0x40c424['options']);return _0x59ac54[_0x8ad3('0x9e')](_0x3c3421);}})['then'](function(_0x2994cc){if(_0x2994cc){_0x3b2434=_0x2994cc[_0x8ad3('0x46')];if(!_0x40c424[_0x8ad3('0x40')][_0x8ad3('0x47')](_0x8ad3('0x63'))){_0x3c3421[_0x8ad3('0x2c')]=qs[_0x8ad3('0x2c')](_0x40c424[_0x8ad3('0x40')][_0x8ad3('0x2c')]);_0x3c3421['offset']=qs[_0x8ad3('0x29')](_0x40c424[_0x8ad3('0x40')][_0x8ad3('0x29')]);}return _0x59ac54[_0x8ad3('0x9e')](_0x3c3421);}})['then'](function(_0x6e7f6){if(_0x6e7f6){return _0x6e7f6?{'count':_0x3b2434,'rows':_0x6e7f6}:null;}})[_0x8ad3('0x1f')](respondWithResult(_0x509d1e,null))[_0x8ad3('0x53')](handleError(_0x509d1e,null));};exports[_0x8ad3('0x9f')]=function(_0x1afca2,_0x703b,_0x2abc84){var _0x41f258={'raw':![],'where':{}};var _0x1e6b3b={};var _0x4682bf={'count':0x0,'rows':[]};return db[_0x8ad3('0x3c')]['findOne']({'where':{'id':_0x1afca2[_0x8ad3('0x54')]['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x703b,null))[_0x8ad3('0x1f')](function(_0x45cbac){if(_0x45cbac){_0x1e6b3b[_0x8ad3('0x3f')]=_[_0x8ad3('0x41')](db[_0x8ad3('0x88')][_0x8ad3('0x55')]);_0x1e6b3b[_0x8ad3('0x40')]=_['keys'](_0x1afca2[_0x8ad3('0x40')]);_0x1e6b3b['filters']=_['intersection'](_0x1e6b3b['model'],_0x1e6b3b[_0x8ad3('0x40')]);_0x41f258['attributes']=_[_0x8ad3('0x44')](_0x1e6b3b[_0x8ad3('0x3f')],qs[_0x8ad3('0x45')](_0x1afca2['query']['fields']));_0x41f258[_0x8ad3('0x43')]=_0x41f258['attributes'][_0x8ad3('0x46')]?_0x41f258[_0x8ad3('0x43')]:_0x1e6b3b[_0x8ad3('0x3f')];if(!_0x1afca2[_0x8ad3('0x40')]['hasOwnProperty'](_0x8ad3('0x63'))){_0x41f258[_0x8ad3('0x2c')]=qs[_0x8ad3('0x2c')](_0x1afca2['query'][_0x8ad3('0x2c')]);_0x41f258[_0x8ad3('0x29')]=qs[_0x8ad3('0x29')](_0x1afca2[_0x8ad3('0x40')][_0x8ad3('0x29')]);}_0x41f258[_0x8ad3('0x48')]=qs[_0x8ad3('0x49')](_0x1afca2[_0x8ad3('0x40')][_0x8ad3('0x49')]);_0x41f258[_0x8ad3('0x4a')]=qs['filters'](_[_0x8ad3('0x68')](_0x1afca2[_0x8ad3('0x40')],_0x1e6b3b[_0x8ad3('0x42')]));_0x41f258[_0x8ad3('0x4a')][_0x8ad3('0x5f')]=_0x45cbac['id'];if(_0x1afca2['query'][_0x8ad3('0x4b')]){_0x41f258[_0x8ad3('0x4a')]=_[_0x8ad3('0x4c')](_0x41f258[_0x8ad3('0x4a')],{'$or':_['map'](_0x41f258[_0x8ad3('0x43')],function(_0x180d64){var _0x2772a3={};_0x2772a3[_0x180d64]={'$like':'%'+_0x1afca2[_0x8ad3('0x40')][_0x8ad3('0x4b')]+'%'};return _0x2772a3;})});}_0x41f258=_[_0x8ad3('0x4c')]({},_0x41f258,_0x1afca2[_0x8ad3('0x4e')]);return db[_0x8ad3('0x88')][_0x8ad3('0x2b')]({'where':_0x41f258[_0x8ad3('0x4a')]})[_0x8ad3('0x1f')](function(_0x2b938a){_0x4682bf[_0x8ad3('0x2b')]=_0x2b938a;if(_0x1afca2[_0x8ad3('0x40')][_0x8ad3('0x4f')]){_0x41f258[_0x8ad3('0x50')]=[{'model':db['CmContact'],'as':_0x8ad3('0xa0'),'required':![]},{'model':db[_0x8ad3('0xa1')],'as':_0x8ad3('0xa2'),'attributes':['name',_0x8ad3('0xa3'),'internal'],'required':![]},{'model':db[_0x8ad3('0xa4')],'as':_0x8ad3('0xa5'),'attributes':['id',_0x8ad3('0x36'),_0x8ad3('0xa6')],'where':_0x1afca2[_0x8ad3('0x40')][_0x8ad3('0xa7')]?{'id':_0x1afca2['query'][_0x8ad3('0xa7')]}:undefined,'required':_0x1afca2[_0x8ad3('0x40')][_0x8ad3('0xa7')]?!![]:![]}];}return db[_0x8ad3('0x88')]['findAll'](_0x41f258);})[_0x8ad3('0x1f')](function(_0x12c068){_0x4682bf[_0x8ad3('0x52')]=_0x12c068;return _0x4682bf;});}})['then'](respondWithFilteredResult(_0x703b,_0x41f258))[_0x8ad3('0x53')](handleError(_0x703b,null));};exports[_0x8ad3('0xa8')]=function(_0x4ba420,_0x1c4819,_0x27e30c){return db[_0x8ad3('0x3c')]['find']({'where':{'id':_0x4ba420[_0x8ad3('0x54')]['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x1c4819,null))[_0x8ad3('0x1f')](function(_0x271a6b){if(_0x271a6b){return _0x271a6b[_0x8ad3('0xa8')](_0x4ba420['body'][_0x8ad3('0x6a')],_['omit'](_0x4ba420['body'],['ids','id'])||{})['spread'](function(_0x4ed1a2){for(var _0xbf4ac5=0x0;_0xbf4ac5<_0x4ba420[_0x8ad3('0x57')][_0x8ad3('0x6a')][_0x8ad3('0x46')];_0xbf4ac5+=0x1){socket['emit'](_0x8ad3('0xa9'),{'UserId':Number(_0x4ba420['body'][_0x8ad3('0x6a')][_0xbf4ac5]),'OpenchannelAccountId':Number(_0x4ba420[_0x8ad3('0x54')]['id'])});}return _0x4ed1a2;});}})[_0x8ad3('0x1f')](respondWithResult(_0x1c4819,null))[_0x8ad3('0x53')](handleError(_0x1c4819,null));};exports[_0x8ad3('0xaa')]=function(_0x268a1e,_0x2e1f64,_0x3ec618){return db[_0x8ad3('0x3c')][_0x8ad3('0x5b')]({'where':{'id':_0x268a1e[_0x8ad3('0x54')]['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x2e1f64,null))['then'](function(_0x552b32){if(_0x552b32){return _0x552b32[_0x8ad3('0xaa')](_0x268a1e[_0x8ad3('0x40')]['ids'])[_0x8ad3('0x1f')](function(){if(_[_0x8ad3('0xab')](_0x268a1e[_0x8ad3('0x40')][_0x8ad3('0x6a')])){for(var _0x11b08d=0x0;_0x11b08d<_0x268a1e[_0x8ad3('0x40')][_0x8ad3('0x6a')][_0x8ad3('0x46')];_0x11b08d+=0x1){socket[_0x8ad3('0xac')](_0x8ad3('0xad'),{'UserId':Number(_0x268a1e[_0x8ad3('0x40')][_0x8ad3('0x6a')][_0x11b08d]),'OpenchannelAccountId':Number(_0x268a1e['params']['id'])});}}else{socket[_0x8ad3('0xac')](_0x8ad3('0xad'),{'UserId':Number(_0x268a1e[_0x8ad3('0x40')]['ids']),'OpenchannelAccountId':Number(_0x268a1e[_0x8ad3('0x54')]['id'])});}});}})[_0x8ad3('0x1f')](respondWithStatusCode(_0x2e1f64,null))[_0x8ad3('0x53')](handleError(_0x2e1f64,null));};exports[_0x8ad3('0xae')]=function(_0x4b3a0d,_0x552096,_0x3e4d01){var _0x2a7c1f={};var _0x4375a8={};var _0x356276;var _0x332454;return db[_0x8ad3('0x3c')][_0x8ad3('0x62')]({'where':{'id':_0x4b3a0d[_0x8ad3('0x54')]['id']}})['then'](handleEntityNotFound(_0x552096,null))['then'](function(_0x12c9e2){if(_0x12c9e2){_0x356276=_0x12c9e2;_0x4375a8['model']=_[_0x8ad3('0x41')](db[_0x8ad3('0xa1')][_0x8ad3('0x55')]);_0x4375a8['query']=_[_0x8ad3('0x41')](_0x4b3a0d[_0x8ad3('0x40')]);_0x4375a8['filters']=_[_0x8ad3('0x44')](_0x4375a8[_0x8ad3('0x3f')],_0x4375a8[_0x8ad3('0x40')]);_0x2a7c1f[_0x8ad3('0x43')]=_[_0x8ad3('0x44')](_0x4375a8['model'],qs['fields'](_0x4b3a0d[_0x8ad3('0x40')]['fields']));_0x2a7c1f[_0x8ad3('0x43')]=_0x2a7c1f[_0x8ad3('0x43')][_0x8ad3('0x46')]?_0x2a7c1f[_0x8ad3('0x43')]:_0x4375a8[_0x8ad3('0x3f')];_0x2a7c1f[_0x8ad3('0x48')]=qs[_0x8ad3('0x49')](_0x4b3a0d[_0x8ad3('0x40')][_0x8ad3('0x49')]);_0x2a7c1f[_0x8ad3('0x4a')]=qs[_0x8ad3('0x42')](_[_0x8ad3('0x68')](_0x4b3a0d['query'],_0x4375a8['filters']));if(_0x4b3a0d[_0x8ad3('0x40')][_0x8ad3('0x4b')]){_0x2a7c1f[_0x8ad3('0x4a')]=_['merge'](_0x2a7c1f['where'],{'$or':_['map'](_0x2a7c1f[_0x8ad3('0x43')],function(_0x1d367c){var _0x2a34f3={};_0x2a34f3[_0x1d367c]={'$like':'%'+_0x4b3a0d['query']['filter']+'%'};return _0x2a34f3;})});}_0x2a7c1f=_['merge']({},_0x2a7c1f,_0x4b3a0d[_0x8ad3('0x4e')]);return _0x356276['getAgents'](_0x2a7c1f);}})['then'](function(_0x3462df){if(_0x3462df){_0x332454=_0x3462df['length'];if(!_0x4b3a0d[_0x8ad3('0x40')][_0x8ad3('0x47')]('nolimit')){_0x2a7c1f[_0x8ad3('0x2c')]=qs['limit'](_0x4b3a0d[_0x8ad3('0x40')][_0x8ad3('0x2c')]);_0x2a7c1f['offset']=qs[_0x8ad3('0x29')](_0x4b3a0d[_0x8ad3('0x40')]['offset']);}return _0x356276[_0x8ad3('0xae')](_0x2a7c1f);}})[_0x8ad3('0x1f')](function(_0x5d73b5){if(_0x5d73b5){return _0x5d73b5?{'count':_0x332454,'rows':_0x5d73b5}:null;}})['then'](respondWithResult(_0x552096,null))[_0x8ad3('0x53')](handleError(_0x552096,null));};exports['send']=function(_0x3b3641,_0x35da57,_0x3b0084){var _0x1add0f,_0x2a7db8,_0x249ba8;if(_[_0x8ad3('0x74')](_0x3b3641[_0x8ad3('0x57')][_0x8ad3('0x57')])||_0x3b3641[_0x8ad3('0x57')][_0x8ad3('0x57')]===''){throw new db['Sequelize'][(_0x8ad3('0x6e'))](_0x8ad3('0xaf'));}if(_[_0x8ad3('0x74')](_0x3b3641[_0x8ad3('0x57')]['to'])){}_0x1add0f=_0x3b3641[_0x8ad3('0x57')]['to'];return db[_0x8ad3('0x3c')]['findOne']({'where':{'id':_0x3b3641[_0x8ad3('0x54')]['id']}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x35da57,null))[_0x8ad3('0x1f')](function(_0x504679){if(_0x504679){return db[_0x8ad3('0x3c')][_0x8ad3('0x5b')]({'where':{'id':_0x504679['id']},'include':[{'model':db['CmList'],'as':_0x8ad3('0x7a'),'include':[{'model':db[_0x8ad3('0x6c')],'as':_0x8ad3('0x83'),'where':{[_0x504679[_0x8ad3('0x75')]]:_0x1add0f},'limit':0x1,'order':[[_0x8ad3('0x71'),'DESC']]}]}]})[_0x8ad3('0x1f')](handleEntityNotFound(_0x35da57,null))[_0x8ad3('0x1f')](function(_0x4636b2){if(_0x4636b2&&_0x4636b2[_0x8ad3('0x7a')]){_0x2a7db8=_0x4636b2[_0x8ad3('0x33')]({'plain':!![]});if(_0x2a7db8[_0x8ad3('0x7a')]&&_0x2a7db8[_0x8ad3('0x7a')][_0x8ad3('0x83')][_0x8ad3('0x46')]){return _0x2a7db8[_0x8ad3('0x7a')][_0x8ad3('0x83')][0x0];}return db[_0x8ad3('0x6c')][_0x8ad3('0x56')](_['defaults'](_0x3b3641[_0x8ad3('0x57')],{'firstName':_0x1add0f,[_0x4636b2[_0x8ad3('0x75')]]:_0x1add0f,'phone':_0x1add0f,'ListId':_0x2a7db8['ListId']}));}})[_0x8ad3('0x1f')](handleEntityNotFound(_0x35da57,null))[_0x8ad3('0x1f')](function(_0x21f31c){if(_0x21f31c){_0x249ba8=_0x21f31c;return db[_0x8ad3('0x88')]['find']({'where':{'ContactId':_0x249ba8['id'],'closed':![],'OpenchannelAccountId':_0x2a7db8['id']}})['then'](function(_0x545fc6){if(_0x545fc6){return[_0x545fc6,![]];}return db[_0x8ad3('0x88')][_0x8ad3('0x56')]({'UserId':_0x3b3641[_0x8ad3('0x5a')]['id'],'ContactId':_0x249ba8['id'],'OpenchannelAccountId':_0x2a7db8['id'],'lastMsgDirection':_0x8ad3('0xb0'),'Messages':[_[_0x8ad3('0x4c')](_0x3b3641[_0x8ad3('0x57')],{'read':![],'body':_0x3b3641[_0x8ad3('0x57')][_0x8ad3('0x57')],'OpenchannelAccountId':_0x2a7db8['id'],'UserId':_0x3b3641[_0x8ad3('0x5a')]['id'],'ContactId':_0x249ba8['id']})]},{'include':[{'model':db[_0x8ad3('0xb1')],'as':_0x8ad3('0xb2')}]})[_0x8ad3('0x1f')](function(_0x128909){return[_0x128909,!![]];});});}})[_0x8ad3('0xb3')](function(_0x11074b,_0x5526c8){if(_0x5526c8){return _0x11074b;}return db[_0x8ad3('0xb1')][_0x8ad3('0x56')](_[_0x8ad3('0x4c')](_0x3b3641[_0x8ad3('0x57')],{'read':![],'body':_0x3b3641['body'][_0x8ad3('0x57')],'OpenchannelAccountId':_0x2a7db8['id'],'OpenchannelInteractionId':_0x11074b['id'],'UserId':_0x3b3641[_0x8ad3('0x5a')]['id'],'ContactId':_0x249ba8['id']}))[_0x8ad3('0x1f')](function(_0x212ff6){_0x11074b[_0x8ad3('0xb4')][_0x8ad3('0xb2')]=[];_0x11074b['dataValues'][_0x8ad3('0xb2')][_0x8ad3('0x8f')](_0x212ff6[_0x8ad3('0xb4')]);return _0x11074b;});});}})['then'](respondWithResult(_0x35da57,null))[_0x8ad3('0x53')](handleError(_0x35da57,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index 809ab9f..3fef84b 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 _0x668b=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x49aa7d,_0x5d46d8){var _0xdd0d26=function(_0x159df7){while(--_0x159df7){_0x49aa7d['push'](_0x49aa7d['shift']());}};_0xdd0d26(++_0x5d46d8);}(_0x668b,0x140));var _0xb668=function(_0x1a0600,_0x41feef){_0x1a0600=_0x1a0600-0x0;var _0x734670=_0x668b[_0x1a0600];return _0x734670;};'use strict';var EventEmitter=require(_0xb668('0x0'));var OpenchannelAccount=require(_0xb668('0x1'))['db']['OpenchannelAccount'];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xb668('0x2')](0x0);var events={'afterCreate':_0xb668('0x3'),'afterUpdate':'update','afterDestroy':_0xb668('0x4')};function emitEvent(_0x5e2e83){return function(_0x2fab11,_0x4092a6,_0x2960f5){OpenchannelAccountEvents['emit'](_0x5e2e83+':'+_0x2fab11['id'],_0x2fab11);OpenchannelAccountEvents[_0xb668('0x5')](_0x5e2e83,_0x2fab11);_0x2960f5(null);};}for(var e in events){if(events[_0xb668('0x6')](e)){var event=events[e];OpenchannelAccount[_0xb668('0x7')](e,emitEvent(event));}}module[_0xb668('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x9348=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events'];(function(_0x3adcaf,_0x5495fe){var _0x2d2656=function(_0x2ecdd1){while(--_0x2ecdd1){_0x3adcaf['push'](_0x3adcaf['shift']());}};_0x2d2656(++_0x5495fe);}(_0x9348,0x10d));var _0x8934=function(_0x3c7bd9,_0x5c82a9){_0x3c7bd9=_0x3c7bd9-0x0;var _0x5811b1=_0x9348[_0x3c7bd9];return _0x5811b1;};'use strict';var EventEmitter=require(_0x8934('0x0'));var OpenchannelAccount=require(_0x8934('0x1'))['db'][_0x8934('0x2')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8934('0x3')](0x0);var events={'afterCreate':_0x8934('0x4'),'afterUpdate':'update','afterDestroy':_0x8934('0x5')};function emitEvent(_0x35da0b){return function(_0x5f34d7,_0x34f94c,_0x923aa3){OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b+':'+_0x5f34d7['id'],_0x5f34d7);OpenchannelAccountEvents[_0x8934('0x6')](_0x35da0b,_0x5f34d7);_0x923aa3(null);};}for(var e in events){if(events[_0x8934('0x7')](e)){var event=events[e];OpenchannelAccount[_0x8934('0x8')](e,emitEvent(event));}}module['exports']=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 17de56f..b1e4b3d 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 _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x37d7de,_0x4dbe12){var _0x3ba165=function(_0x267522){while(--_0x267522){_0x37d7de['push'](_0x37d7de['shift']());}};_0x3ba165(++_0x4dbe12);}(_0xa9e0,0x123));var _0x0a9e=function(_0x491a7f,_0x28bb80){_0x491a7f=_0x491a7f-0x0;var _0x3d8f44=_0xa9e0[_0x491a7f];return _0x3d8f44;};'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':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2b3454,_0x1117d6){var _0x268de1=function(_0x105cfa){while(--_0x105cfa){_0x2b3454['push'](_0x2b3454['shift']());}};_0x268de1(++_0x1117d6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'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':'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 e3ee0cb..35bfd5f 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 _0x4746=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','register','request','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','lodash','util'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x4746,0xc6));var _0x6474=function(_0x685283,_0x15f195){_0x685283=_0x685283-0x0;var _0x81da18=_0x4746[_0x685283];return _0x81da18;};'use strict';var _=require(_0x6474('0x0'));var util=require(_0x6474('0x1'));var moment=require('moment');var BPromise=require(_0x6474('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6474('0x3'));var db=require(_0x6474('0x4'))['db'];var utils=require(_0x6474('0x5'));var logger=require(_0x6474('0x6'))(_0x6474('0x7'));var config=require('../../config/environment');var jayson=require(_0x6474('0x8'));var client=jayson[_0x6474('0x9')]['http']({'port':0x232a});config[_0x6474('0xa')]=_[_0x6474('0xb')](config[_0x6474('0xa')],{'host':_0x6474('0xc'),'port':0x18eb});var socket=require(_0x6474('0xd'))(new Redis(config[_0x6474('0xa')]));require('./openchannelAccount.socket')[_0x6474('0xe')](socket);function respondWithRpcPromise(_0x5bbee1,_0x5335ac,_0x347697){return new BPromise(function(_0x1a202c,_0x4c970d){return client[_0x6474('0xf')](_0x5bbee1,_0x347697)['then'](function(_0x212cda){logger['info'](_0x6474('0x10'),_0x5335ac,_0x6474('0x11'));logger['debug']('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x5335ac,'request\x20sent',JSON[_0x6474('0x12')](_0x212cda));if(_0x212cda[_0x6474('0x13')]){if(_0x212cda[_0x6474('0x13')][_0x6474('0x14')]===0x1f4){logger[_0x6474('0x13')](_0x6474('0x10'),_0x5335ac,_0x212cda[_0x6474('0x13')][_0x6474('0x15')]);return _0x4c970d(_0x212cda[_0x6474('0x13')]['message']);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5335ac,_0x212cda[_0x6474('0x13')][_0x6474('0x15')]);return _0x1a202c(_0x212cda[_0x6474('0x13')][_0x6474('0x15')]);}else{logger[_0x6474('0x16')]('OpenchannelAccount,\x20%s,\x20%s',_0x5335ac,_0x6474('0x11'));_0x1a202c(_0x212cda[_0x6474('0x17')][_0x6474('0x15')]);}})[_0x6474('0x18')](function(_0x17a086){logger[_0x6474('0x13')](_0x6474('0x10'),_0x5335ac,_0x17a086);_0x4c970d(_0x17a086);});});} \ No newline at end of file +var _0xaaa2=['request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','register','request','then','OpenchannelAccount,\x20%s,\x20%s'];(function(_0x1d967d,_0x52c38b){var _0x3036b3=function(_0x18edb9){while(--_0x18edb9){_0x1d967d['push'](_0x1d967d['shift']());}};_0x3036b3(++_0x52c38b);}(_0xaaa2,0xac));var _0x2aaa=function(_0x4c3cd5,_0x58dc0d){_0x4c3cd5=_0x4c3cd5-0x0;var _0x15b781=_0xaaa2[_0x4c3cd5];return _0x15b781;};'use strict';var _=require(_0x2aaa('0x0'));var util=require(_0x2aaa('0x1'));var moment=require(_0x2aaa('0x2'));var BPromise=require(_0x2aaa('0x3'));var rs=require(_0x2aaa('0x4'));var fs=require('fs');var Redis=require(_0x2aaa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x2aaa('0x6'));var logger=require('../../config/logger')(_0x2aaa('0x7'));var config=require(_0x2aaa('0x8'));var jayson=require(_0x2aaa('0x9'));var client=jayson[_0x2aaa('0xa')][_0x2aaa('0xb')]({'port':0x232a});config[_0x2aaa('0xc')]=_['defaults'](config[_0x2aaa('0xc')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2aaa('0xc')]));require('./openchannelAccount.socket')[_0x2aaa('0xd')](socket);function respondWithRpcPromise(_0x491279,_0x4f1343,_0x250a7e){return new BPromise(function(_0x438f88,_0x5e1347){return client[_0x2aaa('0xe')](_0x491279,_0x250a7e)[_0x2aaa('0xf')](function(_0x2e3bd2){logger['info'](_0x2aaa('0x10'),_0x4f1343,_0x2aaa('0x11'));logger[_0x2aaa('0x12')](_0x2aaa('0x13'),_0x4f1343,_0x2aaa('0x11'),JSON[_0x2aaa('0x14')](_0x2e3bd2));if(_0x2e3bd2[_0x2aaa('0x15')]){if(_0x2e3bd2[_0x2aaa('0x15')][_0x2aaa('0x16')]===0x1f4){logger[_0x2aaa('0x15')](_0x2aaa('0x10'),_0x4f1343,_0x2e3bd2[_0x2aaa('0x15')]['message']);return _0x5e1347(_0x2e3bd2[_0x2aaa('0x15')]['message']);}logger[_0x2aaa('0x15')](_0x2aaa('0x10'),_0x4f1343,_0x2e3bd2['error']['message']);return _0x438f88(_0x2e3bd2['error'][_0x2aaa('0x17')]);}else{logger[_0x2aaa('0x18')](_0x2aaa('0x10'),_0x4f1343,_0x2aaa('0x11'));_0x438f88(_0x2e3bd2[_0x2aaa('0x19')][_0x2aaa('0x17')]);}})[_0x2aaa('0x1a')](function(_0x503ef9){logger[_0x2aaa('0x15')](_0x2aaa('0x10'),_0x4f1343,_0x503ef9);_0x5e1347(_0x503ef9);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index af25650..5c67027 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 _0x138d=['./openchannelAccount.events','save','update','emit','removeListener','register','length'];(function(_0x51dc25,_0x3824ab){var _0x2efbc4=function(_0x4454dd){while(--_0x4454dd){_0x51dc25['push'](_0x51dc25['shift']());}};_0x2efbc4(++_0x3824ab);}(_0x138d,0x1ab));var _0xd138=function(_0x49ed67,_0x290989){_0x49ed67=_0x49ed67-0x0;var _0x1523d5=_0x138d[_0x49ed67];return _0x1523d5;};'use strict';var OpenchannelAccountEvents=require(_0xd138('0x0'));var events=[_0xd138('0x1'),'remove',_0xd138('0x2')];function createListener(_0x34325b,_0x427b74){return function(_0x1882b8){_0x427b74[_0xd138('0x3')](_0x34325b,_0x1882b8);};}function removeListener(_0x2d49a0,_0x53042d){return function(){OpenchannelAccountEvents[_0xd138('0x4')](_0x2d49a0,_0x53042d);};}exports[_0xd138('0x5')]=function(_0x343962){for(var _0x54f02e=0x0,_0x19869d=events[_0xd138('0x6')];_0x54f02e<_0x19869d;_0x54f02e++){var _0x117c23=events[_0x54f02e];var _0x5790ff=createListener('openchannelAccount:'+_0x117c23,_0x343962);OpenchannelAccountEvents['on'](_0x117c23,_0x5790ff);}}; \ No newline at end of file +var _0xccdc=['removeListener','register','length','openchannelAccount:','./openchannelAccount.events','save','emit'];(function(_0x158f01,_0x12af3e){var _0x5ef74e=function(_0x5e7adc){while(--_0x5e7adc){_0x158f01['push'](_0x158f01['shift']());}};_0x5ef74e(++_0x12af3e);}(_0xccdc,0x1c4));var _0xcccd=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0xccdc[_0x1694f5];return _0x5b4321;};'use strict';var OpenchannelAccountEvents=require(_0xcccd('0x0'));var events=[_0xcccd('0x1'),'remove','update'];function createListener(_0x3d1898,_0x37483c){return function(_0x1d2186){_0x37483c[_0xcccd('0x2')](_0x3d1898,_0x1d2186);};}function removeListener(_0x41cab2,_0x2ec68c){return function(){OpenchannelAccountEvents[_0xcccd('0x3')](_0x41cab2,_0x2ec68c);};}exports[_0xcccd('0x4')]=function(_0x2da46a){for(var _0x18365a=0x0,_0x5bd55e=events[_0xcccd('0x5')];_0x18365a<_0x5bd55e;_0x18365a++){var _0x270368=events[_0x18365a];var _0x1b8c05=createListener(_0xcccd('0x6')+_0x270368,_0x2da46a);OpenchannelAccountEvents['on'](_0x270368,_0x1b8c05);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index 02efa86..60f2027 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 _0xc6ab=['get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','./openchannelApplication.controller'];(function(_0x18ab2a,_0x4debcd){var _0x16dcee=function(_0x10107a){while(--_0x10107a){_0x18ab2a['push'](_0x18ab2a['shift']());}};_0x16dcee(++_0x4debcd);}(_0xc6ab,0x14c));var _0xbc6a=function(_0x5e05d0,_0x2ac88b){_0x5e05d0=_0x5e05d0-0x0;var _0x2601d3=_0xc6ab[_0x5e05d0];return _0x2601d3;};'use strict';var multer=require(_0xbc6a('0x0'));var util=require(_0xbc6a('0x1'));var path=require(_0xbc6a('0x2'));var timeout=require(_0xbc6a('0x3'));var express=require(_0xbc6a('0x4'));var router=express[_0xbc6a('0x5')]();var fs_extra=require(_0xbc6a('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbc6a('0x7'));router[_0xbc6a('0x8')]('/',auth[_0xbc6a('0x9')](),controller[_0xbc6a('0xa')]);router[_0xbc6a('0x8')]('/:id',auth[_0xbc6a('0x9')](),controller[_0xbc6a('0xb')]);router[_0xbc6a('0xc')]('/',auth[_0xbc6a('0x9')](),controller[_0xbc6a('0xd')]);router[_0xbc6a('0xe')](_0xbc6a('0xf'),auth['isAuthenticated'](),controller[_0xbc6a('0x10')]);router[_0xbc6a('0x11')](_0xbc6a('0xf'),auth[_0xbc6a('0x9')](),controller[_0xbc6a('0x12')]);module[_0xbc6a('0x13')]=router; \ No newline at end of file +var _0xd14f=['isAuthenticated','index','/:id','post','create','put','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0xd14f,0x14c));var _0xfd14=function(_0x3f4909,_0x5508d5){_0x3f4909=_0x3f4909-0x0;var _0x44ca0e=_0xd14f[_0x3f4909];return _0x44ca0e;};'use strict';var multer=require(_0xfd14('0x0'));var util=require(_0xfd14('0x1'));var path=require(_0xfd14('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xfd14('0x3')]();var fs_extra=require(_0xfd14('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xfd14('0x5'));var config=require(_0xfd14('0x6'));var controller=require('./openchannelApplication.controller');router[_0xfd14('0x7')]('/',auth[_0xfd14('0x8')](),controller[_0xfd14('0x9')]);router[_0xfd14('0x7')](_0xfd14('0xa'),auth['isAuthenticated'](),controller['show']);router[_0xfd14('0xb')]('/',auth[_0xfd14('0x8')](),controller[_0xfd14('0xc')]);router[_0xfd14('0xd')](_0xfd14('0xa'),auth[_0xfd14('0x8')](),controller['update']);router[_0xfd14('0xe')](_0xfd14('0xa'),auth['isAuthenticated'](),controller[_0xfd14('0xf')]);module[_0xfd14('0x10')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index a4a34c6..6ef30a5 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 _0x8590=['TEXT','*,*,*,*','STRING','noop'];(function(_0x49636a,_0xb928ac){var _0x485833=function(_0x4c5118){while(--_0x4c5118){_0x49636a['push'](_0x49636a['shift']());}};_0x485833(++_0xb928ac);}(_0x8590,0xd2));var _0x0859=function(_0x4365d1,_0x24d815){_0x4365d1=_0x4365d1-0x0;var _0x5bc480=_0x8590[_0x4365d1];return _0x5bc480;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0x0859('0x0')],'allowNull':![],'defaultValue':_0x0859('0x1')},'appdata':{'type':Sequelize[_0x0859('0x2')]()},'description':{'type':Sequelize[_0x0859('0x0')]},'interval':{'type':Sequelize[_0x0859('0x0')],'defaultValue':_0x0859('0x3')}}; \ No newline at end of file +var _0x3dc7=['TEXT','STRING','*,*,*,*','sequelize','exports','INTEGER','noop'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x3dc7,0x65));var _0x73dc=function(_0x5af99c,_0x706638){_0x5af99c=_0x5af99c-0x0;var _0x5bc378=_0x3dc7[_0x5af99c];return _0x5bc378;};'use strict';var Sequelize=require(_0x73dc('0x0'));module[_0x73dc('0x1')]={'priority':{'type':Sequelize[_0x73dc('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x73dc('0x3')},'appdata':{'type':Sequelize[_0x73dc('0x4')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x73dc('0x5')],'defaultValue':_0x73dc('0x6')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index c7ee2ad..785d168 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 _0xd269=['keys','filters','attributes','intersection','fields','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','length','options','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','path','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','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','OpenchannelApplication','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x299a41,_0x4d1aab){var _0x12a677=function(_0x5b3d88){while(--_0x5b3d88){_0x299a41['push'](_0x299a41['shift']());}};_0x12a677(++_0x4d1aab);}(_0xd269,0x19e));var _0x9d26=function(_0xd4be1,_0x59e826){_0xd4be1=_0xd4be1-0x0;var _0x286656=_0xd269[_0xd4be1];return _0x286656;};'use strict';var emlformat=require(_0x9d26('0x0'));var rimraf=require(_0x9d26('0x1'));var zipdir=require(_0x9d26('0x2'));var jsonpatch=require(_0x9d26('0x3'));var rp=require(_0x9d26('0x4'));var moment=require('moment');var BPromise=require(_0x9d26('0x5'));var Mustache=require('mustache');var util=require(_0x9d26('0x6'));var path=require(_0x9d26('0x7'));var sox=require('sox');var csv=require(_0x9d26('0x8'));var ejs=require(_0x9d26('0x9'));var fs=require('fs');var fs_extra=require(_0x9d26('0xa'));var _=require(_0x9d26('0xb'));var squel=require(_0x9d26('0xc'));var crypto=require(_0x9d26('0xd'));var jsforce=require(_0x9d26('0xe'));var deskjs=require(_0x9d26('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9d26('0x10'));var Redis=require(_0x9d26('0x11'));var authService=require(_0x9d26('0x12'));var qs=require(_0x9d26('0x13'));var as=require(_0x9d26('0x14'));var hardwareService=require(_0x9d26('0x15'));var logger=require(_0x9d26('0x16'))('api');var utils=require(_0x9d26('0x17'));var config=require(_0x9d26('0x18'));var licenseUtil=require(_0x9d26('0x19'));var db=require(_0x9d26('0x1a'))['db'];function respondWithStatusCode(_0x865f57,_0x460de9){_0x460de9=_0x460de9||0xcc;return function(_0x201bc7){if(_0x201bc7){return _0x865f57[_0x9d26('0x1b')](_0x460de9);}return _0x865f57[_0x9d26('0x1c')](_0x460de9)[_0x9d26('0x1d')]();};}function respondWithResult(_0x59a91b,_0x2d1599){_0x2d1599=_0x2d1599||0xc8;return function(_0x4efa63){if(_0x4efa63){return _0x59a91b[_0x9d26('0x1c')](_0x2d1599)[_0x9d26('0x1e')](_0x4efa63);}};}function respondWithFilteredResult(_0x536195,_0x444345){return function(_0x47de46){if(_0x47de46){var _0x27ffd6=typeof _0x444345[_0x9d26('0x1f')]===_0x9d26('0x20')&&typeof _0x444345[_0x9d26('0x21')]==='undefined';var _0x4d4314=_0x47de46[_0x9d26('0x22')];var _0x57ab58=_0x27ffd6?0x0:_0x444345[_0x9d26('0x1f')];var _0x7b8229=_0x27ffd6?_0x47de46[_0x9d26('0x22')]:_0x444345[_0x9d26('0x1f')]+_0x444345[_0x9d26('0x21')];var _0x299c24;if(_0x7b8229>=_0x4d4314){_0x7b8229=_0x4d4314;_0x299c24=0xc8;}else{_0x299c24=0xce;}_0x536195['status'](_0x299c24);return _0x536195[_0x9d26('0x23')](_0x9d26('0x24'),_0x57ab58+'-'+_0x7b8229+'/'+_0x4d4314)[_0x9d26('0x1e')](_0x47de46);}return null;};}function patchUpdates(_0x49ef8c){return function(_0x46fe33){try{jsonpatch[_0x9d26('0x25')](_0x46fe33,_0x49ef8c,!![]);}catch(_0x12147f){return BPromise[_0x9d26('0x26')](_0x12147f);}return _0x46fe33[_0x9d26('0x27')]();};}function saveUpdates(_0x122f27,_0xa76550){return function(_0x75c9bf){if(_0x75c9bf){return _0x75c9bf[_0x9d26('0x28')](_0x122f27)[_0x9d26('0x29')](function(_0x5689c8){return _0x5689c8;});}return null;};}function removeEntity(_0x3fdd8f,_0xc357b2){return function(_0xecc518){if(_0xecc518){return _0xecc518[_0x9d26('0x2a')]()[_0x9d26('0x29')](function(){_0x3fdd8f[_0x9d26('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d89f4,_0x15a118){return function(_0x5cc71d){if(!_0x5cc71d){_0x4d89f4[_0x9d26('0x1b')](0x194);}return _0x5cc71d;};}function handleError(_0x522466,_0x4bd725){_0x4bd725=_0x4bd725||0x1f4;return function(_0x2c8f66){logger[_0x9d26('0x2b')](_0x2c8f66[_0x9d26('0x2c')]);if(_0x2c8f66[_0x9d26('0x2d')]){delete _0x2c8f66[_0x9d26('0x2d')];}_0x522466[_0x9d26('0x1c')](_0x4bd725)['send'](_0x2c8f66);};}exports['index']=function(_0x5dc7de,_0x2a2b03){var _0x591a51={},_0x198c2a={},_0x565395={'count':0x0,'rows':[]};var _0x22cf81=_['map'](db[_0x9d26('0x2e')][_0x9d26('0x2f')],function(_0xcb47b1){return{'name':_0xcb47b1[_0x9d26('0x30')],'type':_0xcb47b1[_0x9d26('0x31')][_0x9d26('0x32')]};});_0x198c2a[_0x9d26('0x33')]=_[_0x9d26('0x34')](_0x22cf81,_0x9d26('0x2d'));_0x198c2a[_0x9d26('0x35')]=_[_0x9d26('0x36')](_0x5dc7de[_0x9d26('0x35')]);_0x198c2a[_0x9d26('0x37')]=_['intersection'](_0x198c2a['model'],_0x198c2a['query']);_0x591a51[_0x9d26('0x38')]=_[_0x9d26('0x39')](_0x198c2a[_0x9d26('0x33')],qs[_0x9d26('0x3a')](_0x5dc7de[_0x9d26('0x35')]['fields']));_0x591a51[_0x9d26('0x38')]=_0x591a51[_0x9d26('0x38')]['length']?_0x591a51[_0x9d26('0x38')]:_0x198c2a['model'];if(!_0x5dc7de[_0x9d26('0x35')]['hasOwnProperty'](_0x9d26('0x3b'))){_0x591a51['limit']=qs['limit'](_0x5dc7de[_0x9d26('0x35')][_0x9d26('0x21')]);_0x591a51[_0x9d26('0x1f')]=qs[_0x9d26('0x1f')](_0x5dc7de[_0x9d26('0x35')]['offset']);}_0x591a51[_0x9d26('0x3c')]=qs[_0x9d26('0x3d')](_0x5dc7de[_0x9d26('0x35')][_0x9d26('0x3d')]);_0x591a51[_0x9d26('0x3e')]=qs[_0x9d26('0x37')](_['pick'](_0x5dc7de[_0x9d26('0x35')],_0x198c2a[_0x9d26('0x37')]),_0x22cf81);if(_0x5dc7de[_0x9d26('0x35')][_0x9d26('0x3f')]){_0x591a51[_0x9d26('0x3e')]=_['merge'](_0x591a51[_0x9d26('0x3e')],{'$or':_[_0x9d26('0x34')](_0x22cf81,function(_0x3e1bdb){if(_0x3e1bdb[_0x9d26('0x31')]!==_0x9d26('0x40')){var _0x32fa02={};_0x32fa02[_0x3e1bdb[_0x9d26('0x2d')]]={'$like':'%'+_0x5dc7de['query'][_0x9d26('0x3f')]+'%'};return _0x32fa02;}})});}_0x591a51=_[_0x9d26('0x41')]({},_0x591a51,_0x5dc7de['options']);var _0x395a43={'where':_0x591a51['where']};return db['OpenchannelApplication'][_0x9d26('0x22')](_0x395a43)['then'](function(_0x59001d){_0x565395[_0x9d26('0x22')]=_0x59001d;if(_0x5dc7de[_0x9d26('0x35')][_0x9d26('0x42')]){_0x591a51[_0x9d26('0x43')]=[{'all':!![]}];}return db[_0x9d26('0x2e')][_0x9d26('0x44')](_0x591a51);})[_0x9d26('0x29')](function(_0x3a5618){_0x565395[_0x9d26('0x45')]=_0x3a5618;return _0x565395;})[_0x9d26('0x29')](respondWithFilteredResult(_0x2a2b03,_0x591a51))[_0x9d26('0x46')](handleError(_0x2a2b03,null));};exports[_0x9d26('0x47')]=function(_0x4cd3b9,_0x28d4e7){var _0x5ce73e={'raw':!![],'where':{'id':_0x4cd3b9['params']['id']}},_0x14b1e8={};_0x14b1e8[_0x9d26('0x33')]=_[_0x9d26('0x36')](db[_0x9d26('0x2e')]['rawAttributes']);_0x14b1e8[_0x9d26('0x35')]=_[_0x9d26('0x36')](_0x4cd3b9['query']);_0x14b1e8[_0x9d26('0x37')]=_[_0x9d26('0x39')](_0x14b1e8[_0x9d26('0x33')],_0x14b1e8[_0x9d26('0x35')]);_0x5ce73e[_0x9d26('0x38')]=_[_0x9d26('0x39')](_0x14b1e8['model'],qs['fields'](_0x4cd3b9['query'][_0x9d26('0x3a')]));_0x5ce73e[_0x9d26('0x38')]=_0x5ce73e[_0x9d26('0x38')][_0x9d26('0x48')]?_0x5ce73e[_0x9d26('0x38')]:_0x14b1e8[_0x9d26('0x33')];if(_0x4cd3b9[_0x9d26('0x35')]['includeAll']){_0x5ce73e[_0x9d26('0x43')]=[{'all':!![]}];}_0x5ce73e=_[_0x9d26('0x41')]({},_0x5ce73e,_0x4cd3b9[_0x9d26('0x49')]);return db[_0x9d26('0x2e')]['find'](_0x5ce73e)['then'](handleEntityNotFound(_0x28d4e7,null))[_0x9d26('0x29')](respondWithResult(_0x28d4e7,null))[_0x9d26('0x46')](handleError(_0x28d4e7,null));};exports[_0x9d26('0x4a')]=function(_0x2c72ec,_0x278d94){return db[_0x9d26('0x2e')][_0x9d26('0x4a')](_0x2c72ec[_0x9d26('0x4b')],{})[_0x9d26('0x29')](respondWithResult(_0x278d94,0xc9))[_0x9d26('0x46')](handleError(_0x278d94,null));};exports[_0x9d26('0x28')]=function(_0x197f0b,_0x44d790){if(_0x197f0b[_0x9d26('0x4b')]['id']){delete _0x197f0b[_0x9d26('0x4b')]['id'];}return db['OpenchannelApplication']['find']({'where':{'id':_0x197f0b['params']['id']}})['then'](handleEntityNotFound(_0x44d790,null))[_0x9d26('0x29')](saveUpdates(_0x197f0b[_0x9d26('0x4b')],null))[_0x9d26('0x29')](respondWithResult(_0x44d790,null))[_0x9d26('0x46')](handleError(_0x44d790,null));};exports[_0x9d26('0x2a')]=function(_0x27aeb7,_0x3f42c9){return db[_0x9d26('0x2e')][_0x9d26('0x4c')]({'where':{'id':_0x27aeb7[_0x9d26('0x4d')]['id']}})[_0x9d26('0x29')](handleEntityNotFound(_0x3f42c9,null))[_0x9d26('0x29')](removeEntity(_0x3f42c9,null))[_0x9d26('0x46')](handleError(_0x3f42c9,null));}; \ No newline at end of file +var _0xa035=['fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','keys','length','find','create','body','params','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','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','apply','reject','save','update','then','error','stack','name','send','map','OpenchannelApplication','rawAttributes','type','model','query','filters','intersection','attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa035,0x1ef));var _0x5a03=function(_0x44745f,_0x4ca026){_0x44745f=_0x44745f-0x0;var _0x38efd4=_0xa035[_0x44745f];return _0x38efd4;};'use strict';var emlformat=require(_0x5a03('0x0'));var rimraf=require(_0x5a03('0x1'));var zipdir=require(_0x5a03('0x2'));var jsonpatch=require(_0x5a03('0x3'));var rp=require(_0x5a03('0x4'));var moment=require(_0x5a03('0x5'));var BPromise=require(_0x5a03('0x6'));var Mustache=require(_0x5a03('0x7'));var util=require(_0x5a03('0x8'));var path=require(_0x5a03('0x9'));var sox=require(_0x5a03('0xa'));var csv=require(_0x5a03('0xb'));var ejs=require(_0x5a03('0xc'));var fs=require('fs');var fs_extra=require(_0x5a03('0xd'));var _=require(_0x5a03('0xe'));var squel=require(_0x5a03('0xf'));var crypto=require(_0x5a03('0x10'));var jsforce=require(_0x5a03('0x11'));var deskjs=require(_0x5a03('0x12'));var toCsv=require(_0x5a03('0xb'));var querystring=require(_0x5a03('0x13'));var Papa=require(_0x5a03('0x14'));var Redis=require(_0x5a03('0x15'));var authService=require(_0x5a03('0x16'));var qs=require(_0x5a03('0x17'));var as=require(_0x5a03('0x18'));var hardwareService=require(_0x5a03('0x19'));var logger=require(_0x5a03('0x1a'))(_0x5a03('0x1b'));var utils=require(_0x5a03('0x1c'));var config=require(_0x5a03('0x1d'));var licenseUtil=require(_0x5a03('0x1e'));var db=require(_0x5a03('0x1f'))['db'];function respondWithStatusCode(_0x1320b9,_0x51dbc3){_0x51dbc3=_0x51dbc3||0xcc;return function(_0x25f29a){if(_0x25f29a){return _0x1320b9[_0x5a03('0x20')](_0x51dbc3);}return _0x1320b9[_0x5a03('0x21')](_0x51dbc3)[_0x5a03('0x22')]();};}function respondWithResult(_0x3c5ec3,_0x40789){_0x40789=_0x40789||0xc8;return function(_0x38fb92){if(_0x38fb92){return _0x3c5ec3['status'](_0x40789)[_0x5a03('0x23')](_0x38fb92);}};}function respondWithFilteredResult(_0x3a524e,_0x23b081){return function(_0x1119e0){if(_0x1119e0){var _0x2f47ef=typeof _0x23b081['offset']==='undefined'&&typeof _0x23b081[_0x5a03('0x24')]===_0x5a03('0x25');var _0x2d6a7f=_0x1119e0[_0x5a03('0x26')];var _0x18a0e9=_0x2f47ef?0x0:_0x23b081['offset'];var _0x2b5f5b=_0x2f47ef?_0x1119e0[_0x5a03('0x26')]:_0x23b081[_0x5a03('0x27')]+_0x23b081['limit'];var _0x280310;if(_0x2b5f5b>=_0x2d6a7f){_0x2b5f5b=_0x2d6a7f;_0x280310=0xc8;}else{_0x280310=0xce;}_0x3a524e[_0x5a03('0x21')](_0x280310);return _0x3a524e['set']('Content-Range',_0x18a0e9+'-'+_0x2b5f5b+'/'+_0x2d6a7f)[_0x5a03('0x23')](_0x1119e0);}return null;};}function patchUpdates(_0x23ca65){return function(_0x3a5d6b){try{jsonpatch[_0x5a03('0x28')](_0x3a5d6b,_0x23ca65,!![]);}catch(_0x4abaf4){return BPromise[_0x5a03('0x29')](_0x4abaf4);}return _0x3a5d6b[_0x5a03('0x2a')]();};}function saveUpdates(_0x4d840e,_0x13994a){return function(_0x24aaf8){if(_0x24aaf8){return _0x24aaf8[_0x5a03('0x2b')](_0x4d840e)[_0x5a03('0x2c')](function(_0x547f7a){return _0x547f7a;});}return null;};}function removeEntity(_0x473b4f,_0xe4958b){return function(_0x20dffd){if(_0x20dffd){return _0x20dffd['destroy']()[_0x5a03('0x2c')](function(){_0x473b4f[_0x5a03('0x21')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3973fa,_0x1fc749){return function(_0x2d8013){if(!_0x2d8013){_0x3973fa[_0x5a03('0x20')](0x194);}return _0x2d8013;};}function handleError(_0x1039c3,_0xc83385){_0xc83385=_0xc83385||0x1f4;return function(_0x1a87b6){logger[_0x5a03('0x2d')](_0x1a87b6[_0x5a03('0x2e')]);if(_0x1a87b6[_0x5a03('0x2f')]){delete _0x1a87b6[_0x5a03('0x2f')];}_0x1039c3[_0x5a03('0x21')](_0xc83385)[_0x5a03('0x30')](_0x1a87b6);};}exports['index']=function(_0x4a5a45,_0x25be83){var _0x464827={},_0x14e741={},_0x1b496e={'count':0x0,'rows':[]};var _0x392ebf=_[_0x5a03('0x31')](db[_0x5a03('0x32')][_0x5a03('0x33')],function(_0x4747e7){return{'name':_0x4747e7['fieldName'],'type':_0x4747e7[_0x5a03('0x34')]['key']};});_0x14e741[_0x5a03('0x35')]=_[_0x5a03('0x31')](_0x392ebf,_0x5a03('0x2f'));_0x14e741['query']=_['keys'](_0x4a5a45[_0x5a03('0x36')]);_0x14e741[_0x5a03('0x37')]=_[_0x5a03('0x38')](_0x14e741['model'],_0x14e741[_0x5a03('0x36')]);_0x464827[_0x5a03('0x39')]=_[_0x5a03('0x38')](_0x14e741[_0x5a03('0x35')],qs[_0x5a03('0x3a')](_0x4a5a45[_0x5a03('0x36')]['fields']));_0x464827['attributes']=_0x464827[_0x5a03('0x39')]['length']?_0x464827['attributes']:_0x14e741[_0x5a03('0x35')];if(!_0x4a5a45[_0x5a03('0x36')][_0x5a03('0x3b')](_0x5a03('0x3c'))){_0x464827[_0x5a03('0x24')]=qs[_0x5a03('0x24')](_0x4a5a45[_0x5a03('0x36')][_0x5a03('0x24')]);_0x464827[_0x5a03('0x27')]=qs[_0x5a03('0x27')](_0x4a5a45[_0x5a03('0x36')][_0x5a03('0x27')]);}_0x464827['order']=qs[_0x5a03('0x3d')](_0x4a5a45['query'][_0x5a03('0x3d')]);_0x464827[_0x5a03('0x3e')]=qs[_0x5a03('0x37')](_[_0x5a03('0x3f')](_0x4a5a45['query'],_0x14e741['filters']),_0x392ebf);if(_0x4a5a45[_0x5a03('0x36')][_0x5a03('0x40')]){_0x464827[_0x5a03('0x3e')]=_[_0x5a03('0x41')](_0x464827[_0x5a03('0x3e')],{'$or':_[_0x5a03('0x31')](_0x392ebf,function(_0x122594){if(_0x122594[_0x5a03('0x34')]!=='VIRTUAL'){var _0x29fdb2={};_0x29fdb2[_0x122594[_0x5a03('0x2f')]]={'$like':'%'+_0x4a5a45[_0x5a03('0x36')][_0x5a03('0x40')]+'%'};return _0x29fdb2;}})});}_0x464827=_[_0x5a03('0x41')]({},_0x464827,_0x4a5a45[_0x5a03('0x42')]);var _0x3035f3={'where':_0x464827[_0x5a03('0x3e')]};return db[_0x5a03('0x32')]['count'](_0x3035f3)[_0x5a03('0x2c')](function(_0x28429d){_0x1b496e[_0x5a03('0x26')]=_0x28429d;if(_0x4a5a45['query'][_0x5a03('0x43')]){_0x464827[_0x5a03('0x44')]=[{'all':!![]}];}return db[_0x5a03('0x32')][_0x5a03('0x45')](_0x464827);})[_0x5a03('0x2c')](function(_0x26dbeb){_0x1b496e[_0x5a03('0x46')]=_0x26dbeb;return _0x1b496e;})[_0x5a03('0x2c')](respondWithFilteredResult(_0x25be83,_0x464827))[_0x5a03('0x47')](handleError(_0x25be83,null));};exports[_0x5a03('0x48')]=function(_0x4fa82c,_0x7791ea){var _0x53346c={'raw':!![],'where':{'id':_0x4fa82c['params']['id']}},_0x40f807={};_0x40f807[_0x5a03('0x35')]=_[_0x5a03('0x49')](db[_0x5a03('0x32')][_0x5a03('0x33')]);_0x40f807[_0x5a03('0x36')]=_[_0x5a03('0x49')](_0x4fa82c[_0x5a03('0x36')]);_0x40f807[_0x5a03('0x37')]=_[_0x5a03('0x38')](_0x40f807[_0x5a03('0x35')],_0x40f807[_0x5a03('0x36')]);_0x53346c[_0x5a03('0x39')]=_[_0x5a03('0x38')](_0x40f807[_0x5a03('0x35')],qs['fields'](_0x4fa82c[_0x5a03('0x36')][_0x5a03('0x3a')]));_0x53346c[_0x5a03('0x39')]=_0x53346c[_0x5a03('0x39')][_0x5a03('0x4a')]?_0x53346c[_0x5a03('0x39')]:_0x40f807[_0x5a03('0x35')];if(_0x4fa82c[_0x5a03('0x36')][_0x5a03('0x43')]){_0x53346c[_0x5a03('0x44')]=[{'all':!![]}];}_0x53346c=_[_0x5a03('0x41')]({},_0x53346c,_0x4fa82c[_0x5a03('0x42')]);return db[_0x5a03('0x32')][_0x5a03('0x4b')](_0x53346c)[_0x5a03('0x2c')](handleEntityNotFound(_0x7791ea,null))['then'](respondWithResult(_0x7791ea,null))[_0x5a03('0x47')](handleError(_0x7791ea,null));};exports[_0x5a03('0x4c')]=function(_0x5380f1,_0x1d21c3){return db[_0x5a03('0x32')][_0x5a03('0x4c')](_0x5380f1[_0x5a03('0x4d')],{})[_0x5a03('0x2c')](respondWithResult(_0x1d21c3,0xc9))[_0x5a03('0x47')](handleError(_0x1d21c3,null));};exports[_0x5a03('0x2b')]=function(_0x2bd166,_0x578458){if(_0x2bd166[_0x5a03('0x4d')]['id']){delete _0x2bd166[_0x5a03('0x4d')]['id'];}return db[_0x5a03('0x32')]['find']({'where':{'id':_0x2bd166['params']['id']}})[_0x5a03('0x2c')](handleEntityNotFound(_0x578458,null))[_0x5a03('0x2c')](saveUpdates(_0x2bd166[_0x5a03('0x4d')],null))[_0x5a03('0x2c')](respondWithResult(_0x578458,null))[_0x5a03('0x47')](handleError(_0x578458,null));};exports['destroy']=function(_0xc90c65,_0x9396c2){return db['OpenchannelApplication'][_0x5a03('0x4b')]({'where':{'id':_0xc90c65[_0x5a03('0x4e')]['id']}})[_0x5a03('0x2c')](handleEntityNotFound(_0x9396c2,null))[_0x5a03('0x2c')](removeEntity(_0x9396c2,null))[_0x5a03('0x47')](handleError(_0x9396c2,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index 04214f6..228804a 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 _0xd6d6=['exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','api','moment','rimraf','./openchannelApplication.attributes'];(function(_0xde7abb,_0x972074){var _0x6bca6=function(_0x4315c8){while(--_0x4315c8){_0xde7abb['push'](_0xde7abb['shift']());}};_0x6bca6(++_0x972074);}(_0xd6d6,0xf7));var _0x6d6d=function(_0x501274,_0x15d45c){_0x501274=_0x501274-0x0;var _0xcdb9e8=_0xd6d6[_0x501274];return _0xcdb9e8;};'use strict';var _=require('lodash');var util=require(_0x6d6d('0x0'));var logger=require(_0x6d6d('0x1'))(_0x6d6d('0x2'));var moment=require(_0x6d6d('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x6d6d('0x4'));var config=require('../../config/environment');var attributes=require(_0x6d6d('0x5'));module[_0x6d6d('0x6')]=function(_0x42082e,_0x39926a){return _0x42082e[_0x6d6d('0x7')]('OpenchannelApplication',attributes,{'tableName':_0x6d6d('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6d6d('0x9'),'collate':_0x6d6d('0xa')});}; \ No newline at end of file +var _0x5703=['./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x615893,_0x1038b3){var _0x436929=function(_0x4e6ce0){while(--_0x4e6ce0){_0x615893['push'](_0x615893['shift']());}};_0x436929(++_0x1038b3);}(_0x5703,0x1a6));var _0x3570=function(_0x1f9e17,_0x127015){_0x1f9e17=_0x1f9e17-0x0;var _0x4fda50=_0x5703[_0x1f9e17];return _0x4fda50;};'use strict';var _=require(_0x3570('0x0'));var util=require(_0x3570('0x1'));var logger=require(_0x3570('0x2'))(_0x3570('0x3'));var moment=require(_0x3570('0x4'));var BPromise=require(_0x3570('0x5'));var rp=require(_0x3570('0x6'));var fs=require('fs');var path=require(_0x3570('0x7'));var rimraf=require(_0x3570('0x8'));var config=require(_0x3570('0x9'));var attributes=require(_0x3570('0xa'));module[_0x3570('0xb')]=function(_0x4d0b12,_0x346fee){return _0x4d0b12[_0x3570('0xc')](_0x3570('0xd'),attributes,{'tableName':_0x3570('0xe'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x3570('0xf')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index 149dc0f..6f912f4 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 _0x6eb1=['UpdateOpenchannelApplication','stringify','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','error','code','message','catch','OpenchannelApplication','update','body','options','raw','where','attributes','limit'];(function(_0x1fd675,_0x165dfe){var _0x16b554=function(_0x5761ff){while(--_0x5761ff){_0x1fd675['push'](_0x1fd675['shift']());}};_0x16b554(++_0x165dfe);}(_0x6eb1,0x119));var _0x16eb=function(_0x34325b,_0x5e5afe){_0x34325b=_0x34325b-0x0;var _0x3da348=_0x6eb1[_0x34325b];return _0x3da348;};'use strict';var _=require(_0x16eb('0x0'));var util=require(_0x16eb('0x1'));var moment=require(_0x16eb('0x2'));var BPromise=require('bluebird');var rs=require(_0x16eb('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x16eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x16eb('0x5'))(_0x16eb('0x6'));var config=require(_0x16eb('0x7'));var jayson=require(_0x16eb('0x8'));var client=jayson[_0x16eb('0x9')][_0x16eb('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a6ae0,_0x5f31bc,_0x56a6a6){return new BPromise(function(_0x4554ca,_0x4748b2){return client[_0x16eb('0xb')](_0x5a6ae0,_0x56a6a6)[_0x16eb('0xc')](function(_0x10b574){logger[_0x16eb('0xd')](_0x16eb('0xe'),_0x5f31bc,_0x16eb('0xf'));logger[_0x16eb('0x10')]('OpenchannelApplication,\x20%s,\x20%s,\x20%s',_0x5f31bc,'request\x20sent',JSON['stringify'](_0x10b574));if(_0x10b574[_0x16eb('0x11')]){if(_0x10b574[_0x16eb('0x11')][_0x16eb('0x12')]===0x1f4){logger['error']('OpenchannelApplication,\x20%s,\x20%s',_0x5f31bc,_0x10b574[_0x16eb('0x11')][_0x16eb('0x13')]);return _0x4748b2(_0x10b574['error'][_0x16eb('0x13')]);}logger['error'](_0x16eb('0xe'),_0x5f31bc,_0x10b574[_0x16eb('0x11')][_0x16eb('0x13')]);return _0x4554ca(_0x10b574['error']['message']);}else{logger[_0x16eb('0xd')](_0x16eb('0xe'),_0x5f31bc,_0x16eb('0xf'));_0x4554ca(_0x10b574['result'][_0x16eb('0x13')]);}})[_0x16eb('0x14')](function(_0x33bc01){logger[_0x16eb('0x11')](_0x16eb('0xe'),_0x5f31bc,_0x33bc01);_0x4748b2(_0x33bc01);});});}exports['UpdateOpenchannelApplication']=function(_0x1e5a46){var _0x211290=this;return new Promise(function(_0x170cf7,_0x4fb777){return db[_0x16eb('0x15')][_0x16eb('0x16')](_0x1e5a46[_0x16eb('0x17')],{'raw':_0x1e5a46[_0x16eb('0x18')]?_0x1e5a46[_0x16eb('0x18')][_0x16eb('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e5a46[_0x16eb('0x18')]?_0x1e5a46[_0x16eb('0x18')][_0x16eb('0x1a')]||null:null,'attributes':_0x1e5a46[_0x16eb('0x18')]?_0x1e5a46['options'][_0x16eb('0x1b')]||null:null,'limit':_0x1e5a46[_0x16eb('0x18')]?_0x1e5a46[_0x16eb('0x18')][_0x16eb('0x1c')]||null:null})[_0x16eb('0xc')](function(_0x1b690f){logger['info'](_0x16eb('0x1d'),_0x1e5a46);logger[_0x16eb('0x10')](_0x16eb('0x1d'),_0x1e5a46,JSON[_0x16eb('0x1e')](_0x1b690f));_0x170cf7(_0x1b690f);})['catch'](function(_0x258e72){logger[_0x16eb('0x11')]('UpdateOpenchannelApplication',_0x258e72[_0x16eb('0x13')],_0x1e5a46);_0x4fb777(_0x211290[_0x16eb('0x11')](0x1f4,_0x258e72[_0x16eb('0x13')]));});});}; \ No newline at end of file +var _0xeb83=['lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelApplication,\x20%s,\x20%s','message','result','catch','OpenchannelApplication','options','raw','where','attributes','limit','UpdateOpenchannelApplication'];(function(_0x4b6045,_0x4e4663){var _0xda0fbc=function(_0x528f25){while(--_0x528f25){_0x4b6045['push'](_0x4b6045['shift']());}};_0xda0fbc(++_0x4e4663);}(_0xeb83,0x1b2));var _0x3eb8=function(_0x2a372a,_0x18004d){_0x2a372a=_0x2a372a-0x0;var _0x5de9a5=_0xeb83[_0x2a372a];return _0x5de9a5;};'use strict';var _=require(_0x3eb8('0x0'));var util=require('util');var moment=require(_0x3eb8('0x1'));var BPromise=require('bluebird');var rs=require(_0x3eb8('0x2'));var fs=require('fs');var Redis=require(_0x3eb8('0x3'));var db=require(_0x3eb8('0x4'))['db'];var utils=require(_0x3eb8('0x5'));var logger=require(_0x3eb8('0x6'))(_0x3eb8('0x7'));var config=require('../../config/environment');var jayson=require(_0x3eb8('0x8'));var client=jayson[_0x3eb8('0x9')][_0x3eb8('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2223ed,_0x5a19fb,_0x18fd5f){return new BPromise(function(_0x5a2aa5,_0xa789f2){return client[_0x3eb8('0xb')](_0x2223ed,_0x18fd5f)[_0x3eb8('0xc')](function(_0x375db6){logger[_0x3eb8('0xd')]('OpenchannelApplication,\x20%s,\x20%s',_0x5a19fb,_0x3eb8('0xe'));logger[_0x3eb8('0xf')](_0x3eb8('0x10'),_0x5a19fb,_0x3eb8('0xe'),JSON[_0x3eb8('0x11')](_0x375db6));if(_0x375db6[_0x3eb8('0x12')]){if(_0x375db6[_0x3eb8('0x12')][_0x3eb8('0x13')]===0x1f4){logger['error'](_0x3eb8('0x14'),_0x5a19fb,_0x375db6['error'][_0x3eb8('0x15')]);return _0xa789f2(_0x375db6[_0x3eb8('0x12')][_0x3eb8('0x15')]);}logger[_0x3eb8('0x12')](_0x3eb8('0x14'),_0x5a19fb,_0x375db6[_0x3eb8('0x12')][_0x3eb8('0x15')]);return _0x5a2aa5(_0x375db6['error'][_0x3eb8('0x15')]);}else{logger['info'](_0x3eb8('0x14'),_0x5a19fb,'request\x20sent');_0x5a2aa5(_0x375db6[_0x3eb8('0x16')][_0x3eb8('0x15')]);}})[_0x3eb8('0x17')](function(_0x3753e7){logger[_0x3eb8('0x12')](_0x3eb8('0x14'),_0x5a19fb,_0x3753e7);_0xa789f2(_0x3753e7);});});}exports['UpdateOpenchannelApplication']=function(_0x21af57){var _0x2ff9f7=this;return new Promise(function(_0x498c2b,_0x3359ac){return db[_0x3eb8('0x18')]['update'](_0x21af57['body'],{'raw':_0x21af57[_0x3eb8('0x19')]?_0x21af57[_0x3eb8('0x19')][_0x3eb8('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x21af57['options']?_0x21af57[_0x3eb8('0x19')][_0x3eb8('0x1b')]||null:null,'attributes':_0x21af57[_0x3eb8('0x19')]?_0x21af57[_0x3eb8('0x19')][_0x3eb8('0x1c')]||null:null,'limit':_0x21af57[_0x3eb8('0x19')]?_0x21af57[_0x3eb8('0x19')][_0x3eb8('0x1d')]||null:null})[_0x3eb8('0xc')](function(_0x4115c6){logger['info']('UpdateOpenchannelApplication',_0x21af57);logger[_0x3eb8('0xf')]('UpdateOpenchannelApplication',_0x21af57,JSON[_0x3eb8('0x11')](_0x4115c6));_0x498c2b(_0x4115c6);})['catch'](function(_0x4172c0){logger[_0x3eb8('0x12')](_0x3eb8('0x1e'),_0x4172c0[_0x3eb8('0x15')],_0x21af57);_0x3359ac(_0x2ff9f7[_0x3eb8('0x12')](0x1f4,_0x4172c0[_0x3eb8('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index b266aa1..0a3dbbf 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 _0xe5db=['put','update','delete','openchannelinteraction:destroy','removeTags','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','index','get','isAuthenticated','/:id','/:id/messages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe5db,0x8c));var _0xbe5d=function(_0x3fc3ce,_0xfd143b){_0x3fc3ce=_0x3fc3ce-0x0;var _0x1f2843=_0xe5db[_0x3fc3ce];return _0x1f2843;};'use strict';var multer=require(_0xbe5d('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe5d('0x1'));var router=express['Router']();var fs_extra=require(_0xbe5d('0x2'));var auth=require(_0xbe5d('0x3'));var interaction=require(_0xbe5d('0x4'));var config=require(_0xbe5d('0x5'));var controller=require(_0xbe5d('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xbe5d('0x7')]);router[_0xbe5d('0x8')]('/describe',auth[_0xbe5d('0x9')](),controller['describe']);router['get'](_0xbe5d('0xa'),auth[_0xbe5d('0x9')](),controller['show']);router[_0xbe5d('0x8')](_0xbe5d('0xb'),auth[_0xbe5d('0x9')](),controller['getMessages']);router[_0xbe5d('0x8')](_0xbe5d('0xc'),auth[_0xbe5d('0x9')](),controller[_0xbe5d('0xd')]);router[_0xbe5d('0xe')]('/',auth['isAuthenticated'](),controller[_0xbe5d('0xf')]);router['post'](_0xbe5d('0xb'),auth['isAuthenticated'](),controller[_0xbe5d('0x10')]);router[_0xbe5d('0xe')](_0xbe5d('0x11'),auth['isAuthenticated'](),interaction[_0xbe5d('0x12')](_0xbe5d('0x13'),_0xbe5d('0x14')),controller[_0xbe5d('0x15')]);router[_0xbe5d('0x16')](_0xbe5d('0xa'),auth[_0xbe5d('0x9')](),interaction['tracked']('openchannel','openchannelinteraction:update'),controller[_0xbe5d('0x17')]);router[_0xbe5d('0x18')](_0xbe5d('0xa'),auth[_0xbe5d('0x9')](),interaction[_0xbe5d('0x12')](_0xbe5d('0x13'),_0xbe5d('0x19')),controller['destroy']);router[_0xbe5d('0x18')](_0xbe5d('0x11'),auth['isAuthenticated'](),controller[_0xbe5d('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xb2f9=['addTags','put','openchannelinteraction:update','update','delete','openchannelinteraction:destroy','destroy','exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelInteraction.controller','get','/describe','isAuthenticated','/:id','show','/:id/download','download','post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags'];(function(_0x47e716,_0x2b1ad4){var _0x21aa76=function(_0x5845c9){while(--_0x5845c9){_0x47e716['push'](_0x47e716['shift']());}};_0x21aa76(++_0x2b1ad4);}(_0xb2f9,0xa3));var _0x9b2f=function(_0x424805,_0x13ad70){_0x424805=_0x424805-0x0;var _0x590e19=_0xb2f9[_0x424805];return _0x590e19;};'use strict';var multer=require(_0x9b2f('0x0'));var util=require(_0x9b2f('0x1'));var path=require(_0x9b2f('0x2'));var timeout=require(_0x9b2f('0x3'));var express=require('express');var router=express[_0x9b2f('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x9b2f('0x5'));var interaction=require(_0x9b2f('0x6'));var config=require(_0x9b2f('0x7'));var controller=require(_0x9b2f('0x8'));router[_0x9b2f('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x9b2f('0x9')](_0x9b2f('0xa'),auth[_0x9b2f('0xb')](),controller['describe']);router[_0x9b2f('0x9')](_0x9b2f('0xc'),auth[_0x9b2f('0xb')](),controller[_0x9b2f('0xd')]);router[_0x9b2f('0x9')]('/:id/messages',auth[_0x9b2f('0xb')](),controller['getMessages']);router[_0x9b2f('0x9')](_0x9b2f('0xe'),auth[_0x9b2f('0xb')](),controller[_0x9b2f('0xf')]);router[_0x9b2f('0x10')]('/',auth[_0x9b2f('0xb')](),controller['create']);router[_0x9b2f('0x10')](_0x9b2f('0x11'),auth[_0x9b2f('0xb')](),controller[_0x9b2f('0x12')]);router[_0x9b2f('0x10')](_0x9b2f('0x13'),auth[_0x9b2f('0xb')](),interaction[_0x9b2f('0x14')](_0x9b2f('0x15'),_0x9b2f('0x16')),controller[_0x9b2f('0x17')]);router[_0x9b2f('0x18')](_0x9b2f('0xc'),auth['isAuthenticated'](),interaction[_0x9b2f('0x14')]('openchannel',_0x9b2f('0x19')),controller[_0x9b2f('0x1a')]);router[_0x9b2f('0x1b')](_0x9b2f('0xc'),auth[_0x9b2f('0xb')](),interaction[_0x9b2f('0x14')]('openchannel',_0x9b2f('0x1c')),controller[_0x9b2f('0x1d')]);router['delete'](_0x9b2f('0x13'),auth[_0x9b2f('0xb')](),controller['removeTags']);module[_0x9b2f('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 029e2b3..1d2f094 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 _0x56a4=['DATE','STRING','out','sequelize','exports'];(function(_0x2f2f79,_0x346cdb){var _0x4b5713=function(_0x3492e2){while(--_0x3492e2){_0x2f2f79['push'](_0x2f2f79['shift']());}};_0x4b5713(++_0x346cdb);}(_0x56a4,0x11b));var _0x456a=function(_0x2b9cf5,_0x2a7804){_0x2b9cf5=_0x2b9cf5-0x0;var _0xd0cf15=_0x56a4[_0x2b9cf5];return _0xd0cf15;};'use strict';var Sequelize=require(_0x456a('0x0'));module[_0x456a('0x1')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x456a('0x2')]},'disposition':{'type':Sequelize[_0x456a('0x3')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x456a('0x3')]},'read1stAt':{'type':Sequelize[_0x456a('0x2')]},'threadId':{'type':Sequelize[_0x456a('0x3')]},'externalUrl':{'type':Sequelize[_0x456a('0x3')]},'lastMsgAt':{'type':Sequelize[_0x456a('0x2')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0x456a('0x4')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x8bc3=['STRING','DATE','ENUM','out','sequelize','BOOLEAN'];(function(_0x1e08e0,_0x1c7e1c){var _0x15ce0e=function(_0x3a41ca){while(--_0x3a41ca){_0x1e08e0['push'](_0x1e08e0['shift']());}};_0x15ce0e(++_0x1c7e1c);}(_0x8bc3,0x82));var _0x38bc=function(_0x4684e9,_0x418964){_0x4684e9=_0x4684e9-0x0;var _0x118227=_0x8bc3[_0x4684e9];return _0x118227;};'use strict';var Sequelize=require(_0x38bc('0x0'));module['exports']={'closed':{'type':Sequelize[_0x38bc('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x38bc('0x2')]},'secondDisposition':{'type':Sequelize[_0x38bc('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x38bc('0x2')]},'read1stAt':{'type':Sequelize[_0x38bc('0x3')]},'threadId':{'type':Sequelize[_0x38bc('0x2')]},'externalUrl':{'type':Sequelize[_0x38bc('0x2')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x38bc('0x4')]('in',_0x38bc('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0x38bc('0x2')]},'autoreplyExecuted':{'type':Sequelize[_0x38bc('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 6302759..0dcbb0b 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 _0xb6a7=['User','UserId','keys','some','compact','isEmpty','OpenchannelAccountId','createdAt','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','tag','isArray','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','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)','order','contactName','DESC','t.id\x20IN\x20?','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','agent','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','i.OpenchannelAccountId\x20IN\x20?','role','sequelize','toString','keyBy','merge','OpenchannelInteraction','a.key','Account.key','Account.mandatoryDisposition','i.*','c.firstName','c.lastName','Contact.lastName','Contact.email','c.mobile','Contact.mobile','c.fax','Contact.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','catch','show','params','options','create','body','update','describe','addMessage','OpenchannelMessage','ids','omit','findOne','sort','pick','$gte','format','YYYY-MM-DD\x20HH:mm:ss','include','findAll','rows','addTags','setTags','emit','openchannelInteractionTags:save','removeTags','download','join','root','server','files','transcript-%d-%s.zip','CmContact','Contact','firstName','lastName','attachments','Attachment','Messages','secret','OpenchannelAccount','Account','Owner','get','mkdirSync','Openchannel','N.A.','closed','closedAt','disposition','threadId','Private','basename','createReadStream','pipe','createWriteStream','direction','out','System','read','renderFile','views','downloadInteraction.ejs','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelInteraction.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','end','sendStatus','error','stack','name','send','Users','fullname','TagIds','Tags','forEach','push','index','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','nolimit','where','field','color','from','tools_tags','select','u.id','u.fullname','user_has_openchannel_interactions','left_join','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','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','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20=\x200','$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?','buildExpression','text','start','Tag','split','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xb6a7,0x171));var _0x7b6a=function(_0x35885a,_0x42fed7){_0x35885a=_0x35885a-0x0;var _0xe86249=_0xb6a7[_0x35885a];return _0xe86249;};'use strict';var emlformat=require(_0x7b6a('0x0'));var rimraf=require(_0x7b6a('0x1'));var zipdir=require(_0x7b6a('0x2'));var jsonpatch=require(_0x7b6a('0x3'));var rp=require('request-promise');var moment=require(_0x7b6a('0x4'));var BPromise=require(_0x7b6a('0x5'));var Mustache=require(_0x7b6a('0x6'));var util=require('util');var path=require(_0x7b6a('0x7'));var sox=require(_0x7b6a('0x8'));var csv=require(_0x7b6a('0x9'));var ejs=require(_0x7b6a('0xa'));var fs=require('fs');var fs_extra=require(_0x7b6a('0xb'));var _=require(_0x7b6a('0xc'));var squel=require(_0x7b6a('0xd'));var crypto=require('crypto');var jsforce=require(_0x7b6a('0xe'));var deskjs=require(_0x7b6a('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7b6a('0x10'));var Papa=require(_0x7b6a('0x11'));var Redis=require(_0x7b6a('0x12'));var authService=require(_0x7b6a('0x13'));var qs=require(_0x7b6a('0x14'));var as=require(_0x7b6a('0x15'));var pdf=require(_0x7b6a('0x16'));var hardwareService=require(_0x7b6a('0x17'));var logger=require(_0x7b6a('0x18'))(_0x7b6a('0x19'));var utils=require('../../config/utils');var config=require(_0x7b6a('0x1a'));var licenseUtil=require(_0x7b6a('0x1b'));var db=require(_0x7b6a('0x1c'))['db'];config['redis']=_['defaults'](config[_0x7b6a('0x1d')],{'host':_0x7b6a('0x1e'),'port':0x18eb});var socket=require(_0x7b6a('0x1f'))(new Redis(config[_0x7b6a('0x1d')]));require(_0x7b6a('0x20'))[_0x7b6a('0x21')](socket);function respondWithStatusCode(_0x5b0193,_0x1cd46e){_0x1cd46e=_0x1cd46e||0xcc;return function(_0x21ab2e){if(_0x21ab2e){return _0x5b0193['sendStatus'](_0x1cd46e);}return _0x5b0193[_0x7b6a('0x22')](_0x1cd46e)['end']();};}function respondWithResult(_0x3ca39b,_0x26204a){_0x26204a=_0x26204a||0xc8;return function(_0x5c965d){if(_0x5c965d){return _0x3ca39b['status'](_0x26204a)[_0x7b6a('0x23')](_0x5c965d);}};}function respondWithFilteredResult(_0x343f27,_0x430698){return function(_0x3d8d56){if(_0x3d8d56){var _0x9327e0=typeof _0x430698[_0x7b6a('0x24')]===_0x7b6a('0x25')&&typeof _0x430698['limit']===_0x7b6a('0x25');var _0x3143c3=_0x3d8d56[_0x7b6a('0x26')];var _0x3cf6f8=_0x9327e0?0x0:_0x430698['offset'];var _0x69b98=_0x9327e0?_0x3d8d56[_0x7b6a('0x26')]:_0x430698['offset']+_0x430698[_0x7b6a('0x27')];var _0x31b493;if(_0x69b98>=_0x3143c3){_0x69b98=_0x3143c3;_0x31b493=0xc8;}else{_0x31b493=0xce;}_0x343f27[_0x7b6a('0x22')](_0x31b493);return _0x343f27[_0x7b6a('0x28')](_0x7b6a('0x29'),_0x3cf6f8+'-'+_0x69b98+'/'+_0x3143c3)['json'](_0x3d8d56);}return null;};}function patchUpdates(_0x28f2b5){return function(_0x2f2b69){try{jsonpatch[_0x7b6a('0x2a')](_0x2f2b69,_0x28f2b5,!![]);}catch(_0xabfabb){return BPromise['reject'](_0xabfabb);}return _0x2f2b69[_0x7b6a('0x2b')]();};}function saveUpdates(_0x18cd90,_0xce913){return function(_0x2edb30){if(_0x2edb30){return _0x2edb30['update'](_0x18cd90)[_0x7b6a('0x2c')](function(_0x5a2046){return _0x5a2046;});}return null;};}function removeEntity(_0x5b50c8,_0x6aa641){return function(_0x466e7c){if(_0x466e7c){return _0x466e7c['destroy']()['then'](function(){_0x5b50c8[_0x7b6a('0x22')](0xcc)[_0x7b6a('0x2d')]();});}};}function handleEntityNotFound(_0x4652d0,_0x50b1f5){return function(_0x1cb8ab){if(!_0x1cb8ab){_0x4652d0[_0x7b6a('0x2e')](0x194);}return _0x1cb8ab;};}function handleError(_0x574c34,_0x2e2d1d){_0x2e2d1d=_0x2e2d1d||0x1f4;return function(_0x521516){logger[_0x7b6a('0x2f')](_0x521516[_0x7b6a('0x30')]);if(_0x521516[_0x7b6a('0x31')]){delete _0x521516[_0x7b6a('0x31')];}_0x574c34[_0x7b6a('0x22')](_0x2e2d1d)[_0x7b6a('0x32')](_0x521516);};}function getInteractionUsers(_0x4fd06f,_0x29b83d){return new BPromise(function(_0x57550d,_0xee3e90){try{if(_0x29b83d[_0x4fd06f['id']]){_0x4fd06f[_0x7b6a('0x33')]=_['map'](_0x29b83d[_0x4fd06f['id']],function(_0x388ab8){return{'id':_0x388ab8['id'],'fullname':_0x388ab8[_0x7b6a('0x34')]};});}}catch(_0x42490c){_0xee3e90(_0x42490c);}_0x57550d(_0x4fd06f);});}function getInteractionTags(_0x541cd0,_0x121cdf){return new BPromise(function(_0x193679,_0x5e9368){try{if(_0x541cd0[_0x7b6a('0x35')]){_0x541cd0[_0x7b6a('0x36')]=[];_0x541cd0[_0x7b6a('0x35')]['split'](',')[_0x7b6a('0x37')](function(_0x1653e6){_0x541cd0['Tags'][_0x7b6a('0x38')](_0x121cdf[_0x1653e6]);});}delete _0x541cd0[_0x7b6a('0x35')];}catch(_0x1278a4){_0x5e9368(_0x1278a4);}_0x193679(_0x541cd0);});}function updateOpenchannelInteraction(_0x2979b4,_0x33d317,_0x1ae1a6){return new BPromise(function(_0x45c306,_0x5a0355){return getInteractionUsers(_0x2979b4,_0x1ae1a6)[_0x7b6a('0x2c')](function(_0x586ce0){return getInteractionTags(_0x586ce0,_0x33d317);})[_0x7b6a('0x2c')](function(_0x5a2026){_0x45c306(_0x5a2026);})['catch'](function(_0x330556){_0x5a0355(_0x330556);});});}exports[_0x7b6a('0x39')]=function(_0x487916,_0x5905b2){var _0x4c24ca={},_0x1da28b={},_0x363b33={'count':0x0,'rows':[]};var _0x2dd561=_['map'](db['OpenchannelInteraction']['rawAttributes'],function(_0x38c442){return{'name':_0x38c442[_0x7b6a('0x3a')],'type':_0x38c442[_0x7b6a('0x3b')][_0x7b6a('0x3c')]};});_0x1da28b[_0x7b6a('0x3d')]=_[_0x7b6a('0x3e')](_0x2dd561,_0x7b6a('0x31'));_0x1da28b[_0x7b6a('0x3f')]=_['keys'](_0x487916[_0x7b6a('0x3f')]);_0x1da28b[_0x7b6a('0x40')]=_[_0x7b6a('0x41')](_0x1da28b[_0x7b6a('0x3d')],_0x1da28b['query']);_0x4c24ca[_0x7b6a('0x42')]=_[_0x7b6a('0x41')](_0x1da28b[_0x7b6a('0x3d')],qs['fields'](_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x43')]));_0x4c24ca[_0x7b6a('0x42')]=_0x4c24ca[_0x7b6a('0x42')][_0x7b6a('0x44')]?_0x4c24ca[_0x7b6a('0x42')]:_0x1da28b['model'];if(!_0x487916['query']['hasOwnProperty'](_0x7b6a('0x45'))){_0x4c24ca[_0x7b6a('0x27')]=qs[_0x7b6a('0x27')](_0x487916['query'][_0x7b6a('0x27')]);_0x4c24ca[_0x7b6a('0x24')]=qs['offset'](_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x24')]);}_0x4c24ca['order']=qs['sort'](_0x487916[_0x7b6a('0x3f')]['sort']);_0x4c24ca[_0x7b6a('0x46')]=qs['filters'](_['pick'](_0x487916[_0x7b6a('0x3f')],_0x1da28b[_0x7b6a('0x40')]),_0x2dd561);var _0x32d3bc=[];var _0x14c5a4=squel['select']()['field']('id')[_0x7b6a('0x47')]('name')[_0x7b6a('0x47')](_0x7b6a('0x48'))[_0x7b6a('0x49')](_0x7b6a('0x4a'));var _0x3e80c3=squel[_0x7b6a('0x4b')]()['field'](_0x7b6a('0x4c'))[_0x7b6a('0x47')](_0x7b6a('0x4d'))[_0x7b6a('0x47')]('ui.OpenchannelInteractionId')[_0x7b6a('0x49')](_0x7b6a('0x4e'),'ui')[_0x7b6a('0x4f')]('users','u',_0x7b6a('0x50'));var _0x2891da=squel[_0x7b6a('0x4b')]()[_0x7b6a('0x49')](_0x7b6a('0x51'),'i')[_0x7b6a('0x4f')](_0x7b6a('0x52'),'c',_0x7b6a('0x53'))['left_join'](_0x7b6a('0x54'),'o',_0x7b6a('0x55'))[_0x7b6a('0x4f')](_0x7b6a('0x56'),'a',_0x7b6a('0x57'))[_0x7b6a('0x4f')](_0x7b6a('0x58'),'me',_0x7b6a('0x59'))['left_join'](_0x7b6a('0x5a'),'it',_0x7b6a('0x5b'))['left_join'](_0x7b6a('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x58aa9c=squel['expr']();var _0x3bee5f=[];var _0x2f6f36=squel[_0x7b6a('0x5c')]();var _0x16d7b4;if(_0x487916[_0x7b6a('0x3f')]['search']){_0x16d7b4=as[_0x7b6a('0x5d')](_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x5e')]);var _0x411971=_0x16d7b4[_0x7b6a('0x5f')];for(var _0x3e8a66=0x0;_0x3e8a66<_0x16d7b4[_0x7b6a('0x60')][_0x7b6a('0x44')];_0x3e8a66++){var _0x38cd29=_0x16d7b4[_0x7b6a('0x60')][_0x3e8a66];var _0x4ecfe5='i';var _0x1f35c3=_[_0x7b6a('0x61')](_0x2dd561,['name',_0x38cd29[_0x7b6a('0x47')]]);if(!_0x1f35c3){switch(_0x38cd29[_0x7b6a('0x47')]){case _0x7b6a('0x62'):if(_0x38cd29[_0x7b6a('0x63')]==0x1){_0x2891da[_0x7b6a('0x64')]('`'+_0x38cd29[_0x7b6a('0x47')]+_0x7b6a('0x65'));}else{_0x2891da[_0x7b6a('0x64')]('`'+_0x38cd29['field']+'`\x20>\x200');}break;case'Contact':if(_0x38cd29['operator']===_0x7b6a('0x66')){if(_0x38cd29[_0x7b6a('0x63')]['split']('\x20')[_0x7b6a('0x44')]>0x1){_0x58aa9c[_0x411971](_0x7b6a('0x67'),qs[_0x7b6a('0x68')](_0x38cd29[_0x7b6a('0x63')]),null);}else{var _0x30f57f='%'+_0x38cd29[_0x7b6a('0x63')]+'%';_0x58aa9c[_0x411971](_0x7b6a('0x69'),_0x30f57f,_0x30f57f,_0x30f57f);}}else{_0x1f35c3=_[_0x7b6a('0x61')](_0x2dd561,[_0x7b6a('0x31'),'ContactId']);_0x38cd29[_0x7b6a('0x47')]='ContactId';_0x4d2594=as[_0x7b6a('0x6a')](_0x4ecfe5,_0x1f35c3['type'],_0x38cd29);_0x58aa9c[_0x411971](_0x4d2594[_0x7b6a('0x6b')],_0x4d2594['value'][_0x7b6a('0x6c')],_0x4d2594[_0x7b6a('0x63')][_0x7b6a('0x2d')]);}break;case _0x7b6a('0x6d'):var _0x1161c9=_0x38cd29['value'][_0x7b6a('0x6e')](',')[_0x7b6a('0x3e')](function(_0x503029){return Number(_0x503029);});_0x1161c9['forEach'](function(_0x3e7465){_0x2f6f36['or'](_0x7b6a('0x6f'),'%,'+_0x3e7465+',%');});_0x3bee5f=_[_0x7b6a('0x70')](_0x3bee5f,_0x1161c9);break;case _0x7b6a('0x71'):if(_0x38cd29['operator']===_0x7b6a('0x66')){_0x58aa9c[_0x411971]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x38cd29[_0x7b6a('0x63')]+'%',null);}else{_0x1f35c3=_[_0x7b6a('0x61')](_0x2dd561,[_0x7b6a('0x31'),_0x7b6a('0x72')]);_0x38cd29['field']='UserId';_0x4d2594=as[_0x7b6a('0x6a')](_0x4ecfe5,_0x1f35c3[_0x7b6a('0x3b')],_0x38cd29);_0x58aa9c[_0x411971](_0x4d2594[_0x7b6a('0x6b')],_0x4d2594[_0x7b6a('0x63')][_0x7b6a('0x6c')],_0x4d2594[_0x7b6a('0x63')][_0x7b6a('0x2d')]);}break;case'body':_0x4d2594=as['buildExpression']('me',null,_0x38cd29);_0x58aa9c[_0x411971](_0x4d2594[_0x7b6a('0x6b')],_0x4d2594['value'][_0x7b6a('0x6c')],_0x4d2594[_0x7b6a('0x63')][_0x7b6a('0x2d')]);break;}}else{var _0x4d2594=as[_0x7b6a('0x6a')](_0x4ecfe5,_0x1f35c3[_0x7b6a('0x3b')],_0x38cd29);_0x58aa9c[_0x411971](_0x4d2594[_0x7b6a('0x6b')],_0x4d2594['value'][_0x7b6a('0x6c')],_0x4d2594['value'][_0x7b6a('0x2d')]);}}}else{var _0x4090ba=_(_0x487916['query'])[_0x7b6a('0x73')]()['map'](function(_0x10e2db){return _[_0x7b6a('0x74')](_0x2dd561,[_0x7b6a('0x31'),_0x10e2db])?_0x10e2db:undefined;})[_0x7b6a('0x75')]()[_0x7b6a('0x63')]();if(!_[_0x7b6a('0x76')](_0x4090ba)){_0x4090ba['forEach'](function(_0x2a39eb){if(_0x2a39eb===_0x7b6a('0x77')){_0x2891da['where']('i.OpenchannelAccountId\x20IN\x20?',[]['concat'](_0x487916[_0x7b6a('0x3f')][_0x2a39eb]));}else if(_0x2a39eb===_0x7b6a('0x78')){var _0x107393=JSON[_0x7b6a('0x79')](_0x487916['query'][_0x2a39eb])['$gte'];var _0x4608bb=JSON[_0x7b6a('0x79')](_0x487916[_0x7b6a('0x3f')][_0x2a39eb])[_0x7b6a('0x7a')];_0x2891da[_0x7b6a('0x46')](_0x7b6a('0x7b'),_0x107393,_0x4608bb);}else{if(_0x487916[_0x7b6a('0x3f')][_0x2a39eb]===_0x7b6a('0x7c')){_0x2891da['where']('i.'+_0x2a39eb+_0x7b6a('0x7d'));}else{_0x2891da[_0x7b6a('0x46')]('i.'+_0x2a39eb+'\x20=\x20?',_0x487916[_0x7b6a('0x3f')][_0x2a39eb]);}}});}if(_0x487916['query']['read']){if(_0x487916[_0x7b6a('0x3f')]['read']==0x1){_0x2891da[_0x7b6a('0x64')]('`unreadMessages`\x20=\x200');}else{_0x2891da['having']('`unreadMessages`\x20>\x200');}}if(_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x7e')]){_0x3bee5f=_[_0x7b6a('0x7f')](_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x7e')])?_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x7e')]:new Array(_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x7e')]);_0x3bee5f['forEach'](function(_0x27b8c5){_0x2f6f36['or'](_0x7b6a('0x6f'),'%,'+_0x27b8c5+',%');});}if(_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x80')]){var _0x510409=_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x80')]['replace']('\x5c','\x5c\x5c')[_0x7b6a('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x510409)){_0x58aa9c['or'](_0x7b6a('0x82'),_0x510409+'%');}else{_0x58aa9c['or'](_0x7b6a('0x83'),qs[_0x7b6a('0x68')](_0x510409))['or'](_0x7b6a('0x84'),_0x510409+'%')['or'](_0x7b6a('0x85'),_0x510409+'%');}}}_0x2891da['where'](_0x58aa9c);_0x2891da[_0x7b6a('0x86')](_0x7b6a('0x87'));var _0x3fd7f6={'type':db[_0x7b6a('0x88')]['QueryTypes'][_0x7b6a('0x89')],'raw':!![]};var _0x404197=_0x2891da[_0x7b6a('0x8a')]();_0x404197[_0x7b6a('0x47')]('i.id');_0x404197[_0x7b6a('0x47')](_0x7b6a('0x8b'),_0x7b6a('0x62'));if(_0x4c24ca[_0x7b6a('0x8c')]){_0x4c24ca[_0x7b6a('0x8c')][_0x7b6a('0x37')](function(_0x4cabc9){var _0x484f26=_0x4cabc9[0x0]===_0x7b6a('0x8d')?_0x4cabc9[0x0]:'i.'+_0x4cabc9[0x0];_0x2891da[_0x7b6a('0x8c')](_0x484f26,_0x4cabc9[0x1]===_0x7b6a('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x3bee5f)){_0x2891da[_0x7b6a('0x64')](_0x2f6f36);_0x404197['where'](_0x7b6a('0x8f'),_0x3bee5f);}BPromise['resolve']()[_0x7b6a('0x2c')](function(){if(!_0x16d7b4){if(_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x77')])return;_0x404197[_0x7b6a('0x46')]('i.OpenchannelAccountId\x20IS\x20NOT\x20NULL');_0x2891da[_0x7b6a('0x46')](_0x7b6a('0x90'));return;}if(_0x487916[_0x7b6a('0x91')]['role']!==_0x7b6a('0x92'))return;return _0x487916['user'][_0x7b6a('0x93')]({'attributes':['id'],'raw':!![]})['then'](function(_0x2b2a8c){if(_[_0x7b6a('0x76')](_0x2b2a8c)){_0x404197[_0x7b6a('0x46')](_0x7b6a('0x94'));_0x2891da[_0x7b6a('0x46')](_0x7b6a('0x94'));}else{_0x404197['where'](_0x7b6a('0x95'),_['map'](_0x2b2a8c,'id'));_0x2891da[_0x7b6a('0x46')](_0x7b6a('0x95'),_['map'](_0x2b2a8c,'id'));}});})['then'](function(){if(_0x487916[_0x7b6a('0x91')][_0x7b6a('0x96')]===_0x7b6a('0x92')&&!_0x16d7b4&&!_0x487916[_0x7b6a('0x3f')][_0x7b6a('0x77')])return[];return db[_0x7b6a('0x97')][_0x7b6a('0x3f')](_0x404197[_0x7b6a('0x98')](),_0x3fd7f6);})['then'](function(_0x2c91f4){_0x363b33[_0x7b6a('0x26')]=_0x2c91f4[_0x7b6a('0x44')];if(_0x363b33[_0x7b6a('0x26')]===0x0)return[];return db['sequelize'][_0x7b6a('0x3f')](_0x14c5a4[_0x7b6a('0x98')](),_0x3fd7f6)[_0x7b6a('0x2c')](function(_0x572388){_0x32d3bc=_[_0x7b6a('0x99')](_0x572388,'id');_0x3fd7f6=_[_0x7b6a('0x9a')](_0x3fd7f6,{'model':db[_0x7b6a('0x9b')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x487916[_0x7b6a('0x3f')]['fields']){_0x4c24ca[_0x7b6a('0x42')]['forEach'](function(_0x42f745){_0x2891da['field']('i.'+_0x42f745);});}else{_0x2891da['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages');_0x2891da['field'](_0x7b6a('0x9c'),_0x7b6a('0x9d'));_0x2891da['field']('a.mandatoryDisposition',_0x7b6a('0x9e'));_0x2891da[_0x7b6a('0x47')]('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',_0x7b6a('0x8d'));_0x2891da[_0x7b6a('0x47')](_0x7b6a('0x9f'));_0x2891da[_0x7b6a('0x47')](_0x7b6a('0xa0'),'Contact.firstName');_0x2891da[_0x7b6a('0x47')](_0x7b6a('0xa1'),_0x7b6a('0xa2'));_0x2891da['field']('c.email',_0x7b6a('0xa3'));_0x2891da[_0x7b6a('0x47')]('c.phone','Contact.phone');_0x2891da[_0x7b6a('0x47')](_0x7b6a('0xa4'),_0x7b6a('0xa5'));_0x2891da[_0x7b6a('0x47')](_0x7b6a('0xa6'),_0x7b6a('0xa7'));_0x2891da[_0x7b6a('0x47')]('o.fullname','Owner.fullname');_0x2891da[_0x7b6a('0x47')]('o.internal',_0x7b6a('0xa8'));_0x2891da[_0x7b6a('0x47')](_0x7b6a('0xa9'),_0x7b6a('0x35'));}if(_0x4c24ca[_0x7b6a('0x27')])_0x2891da[_0x7b6a('0x27')](_0x4c24ca[_0x7b6a('0x27')]);if(_0x4c24ca['offset'])_0x2891da[_0x7b6a('0x24')](_0x4c24ca[_0x7b6a('0x24')]);return db[_0x7b6a('0x97')][_0x7b6a('0x3f')](_0x2891da[_0x7b6a('0x98')](),_0x3fd7f6);})[_0x7b6a('0x2c')](function(_0x95d770){if(_0x95d770[_0x7b6a('0x44')]>0x0)_0x3e80c3[_0x7b6a('0x46')](_0x7b6a('0xaa'),_['map'](_0x95d770,'id'));return db[_0x7b6a('0x97')]['query'](_0x3e80c3[_0x7b6a('0x98')](),_0x3fd7f6)['then'](function(_0x236202){var _0x9aecb2=_[_0x7b6a('0xab')](_0x236202,_0x7b6a('0xac'));var _0x5eedcf=[];_0x95d770[_0x7b6a('0x37')](function(_0x4c6983){_0x5eedcf[_0x7b6a('0x38')](updateOpenchannelInteraction(_0x4c6983,_0x32d3bc,_0x9aecb2));});return BPromise[_0x7b6a('0xad')](_0x5eedcf);});});})[_0x7b6a('0x2c')](function(_0x55ba8a){_0x363b33['rows']=_0x55ba8a;return _0x363b33;})['then'](respondWithFilteredResult(_0x5905b2,_0x4c24ca))[_0x7b6a('0xae')](handleError(_0x5905b2,null));};exports[_0x7b6a('0xaf')]=function(_0x498890,_0x3d9089){var _0x10be00={};if(_0x498890[_0x7b6a('0x3f')][_0x7b6a('0x3b')]&&_0x498890['query']['type']==='from'){_0x10be00[_0x7b6a('0x49')]=_0x498890[_0x7b6a('0xb0')]['id'];}else{_0x10be00['id']=_0x498890[_0x7b6a('0xb0')]['id'];}var _0x1c61d3={'raw':![],'where':_0x10be00},_0x4255a5={};_0x4255a5[_0x7b6a('0x3d')]=_['keys'](db[_0x7b6a('0x9b')]['rawAttributes']);_0x4255a5['query']=_[_0x7b6a('0x73')](_0x498890[_0x7b6a('0x3f')]);_0x4255a5[_0x7b6a('0x40')]=_[_0x7b6a('0x41')](_0x4255a5[_0x7b6a('0x3d')],_0x4255a5[_0x7b6a('0x3f')]);_0x1c61d3[_0x7b6a('0x42')]=_['intersection'](_0x4255a5[_0x7b6a('0x3d')],qs[_0x7b6a('0x43')](_0x498890[_0x7b6a('0x3f')]['fields']));_0x1c61d3[_0x7b6a('0x42')]=_0x1c61d3[_0x7b6a('0x42')][_0x7b6a('0x44')]?_0x1c61d3['attributes']:_0x4255a5[_0x7b6a('0x3d')];if(_0x498890[_0x7b6a('0x3f')]['includeAll']){_0x1c61d3['include']=[{'all':!![]}];}_0x1c61d3=_[_0x7b6a('0x9a')]({},_0x1c61d3,_0x498890[_0x7b6a('0xb1')]);return db[_0x7b6a('0x9b')][_0x7b6a('0x61')](_0x1c61d3)[_0x7b6a('0x2c')](handleEntityNotFound(_0x3d9089,null))[_0x7b6a('0x2c')](respondWithResult(_0x3d9089,null))[_0x7b6a('0xae')](handleError(_0x3d9089,null));};exports[_0x7b6a('0xb2')]=function(_0x2d5a08,_0x2c4312){return db[_0x7b6a('0x9b')][_0x7b6a('0xb2')](_0x2d5a08[_0x7b6a('0xb3')],{})['then'](respondWithResult(_0x2c4312,0xc9))[_0x7b6a('0xae')](handleError(_0x2c4312,null));};exports[_0x7b6a('0xb4')]=function(_0x3f7fb2,_0x1c36eb){if(_0x3f7fb2[_0x7b6a('0xb3')]['id']){delete _0x3f7fb2[_0x7b6a('0xb3')]['id'];}return db[_0x7b6a('0x9b')][_0x7b6a('0x61')]({'where':{'id':_0x3f7fb2[_0x7b6a('0xb0')]['id']}})[_0x7b6a('0x2c')](handleEntityNotFound(_0x1c36eb,null))['then'](saveUpdates(_0x3f7fb2[_0x7b6a('0xb3')],null))['then'](respondWithResult(_0x1c36eb,null))[_0x7b6a('0xae')](handleError(_0x1c36eb,null));};exports['destroy']=function(_0xa1e6de,_0x52e37f){return db[_0x7b6a('0x9b')][_0x7b6a('0x61')]({'where':{'id':_0xa1e6de['params']['id']}})['then'](handleEntityNotFound(_0x52e37f,null))[_0x7b6a('0x2c')](removeEntity(_0x52e37f,null))[_0x7b6a('0xae')](handleError(_0x52e37f,null));};exports[_0x7b6a('0xb5')]=function(_0x3f2820,_0x19fc95){return db['OpenchannelInteraction']['describe']()[_0x7b6a('0x2c')](respondWithResult(_0x19fc95,null))[_0x7b6a('0xae')](handleError(_0x19fc95,null));};exports[_0x7b6a('0xb6')]=function(_0xf59b97,_0x2552bd,_0x44f3ee){return db[_0x7b6a('0xb7')][_0x7b6a('0x61')]({'where':{'id':_0xf59b97[_0x7b6a('0xb0')]['id']}})[_0x7b6a('0x2c')](handleEntityNotFound(_0x2552bd,null))[_0x7b6a('0x2c')](function(_0x439e80){if(_0x439e80){return _0x439e80[_0x7b6a('0xb6')](_0xf59b97[_0x7b6a('0xb3')][_0x7b6a('0xb8')],_[_0x7b6a('0xb9')](_0xf59b97[_0x7b6a('0xb3')],[_0x7b6a('0xb8'),'id'])||{});}})[_0x7b6a('0x2c')](respondWithResult(_0x2552bd,null))[_0x7b6a('0xae')](handleError(_0x2552bd,null));};exports['getMessages']=function(_0x14dbbf,_0x2c49bb,_0x1c48ee){var _0x3d63f6={'raw':![],'where':{}};var _0xb0704e={};var _0x5ec805={'count':0x0,'rows':[]};return db[_0x7b6a('0x9b')][_0x7b6a('0xba')]({'where':{'id':_0x14dbbf[_0x7b6a('0xb0')]['id']}})['then'](handleEntityNotFound(_0x2c49bb,null))[_0x7b6a('0x2c')](function(_0x4559b6){if(_0x4559b6){_0xb0704e[_0x7b6a('0x3d')]=_['keys'](db[_0x7b6a('0xb7')]['rawAttributes']);_0xb0704e[_0x7b6a('0x3f')]=_['keys'](_0x14dbbf['query']);_0xb0704e[_0x7b6a('0x40')]=_[_0x7b6a('0x41')](_0xb0704e[_0x7b6a('0x3d')],_0xb0704e[_0x7b6a('0x3f')]);_0x3d63f6[_0x7b6a('0x42')]=_[_0x7b6a('0x41')](_0xb0704e[_0x7b6a('0x3d')],qs['fields'](_0x14dbbf[_0x7b6a('0x3f')][_0x7b6a('0x43')]));_0x3d63f6[_0x7b6a('0x42')]=_0x3d63f6[_0x7b6a('0x42')][_0x7b6a('0x44')]?_0x3d63f6[_0x7b6a('0x42')]:_0xb0704e[_0x7b6a('0x3d')];if(!_0x14dbbf['query']['hasOwnProperty']('nolimit')){_0x3d63f6[_0x7b6a('0x27')]=qs[_0x7b6a('0x27')](_0x14dbbf[_0x7b6a('0x3f')]['limit']);_0x3d63f6[_0x7b6a('0x24')]=qs[_0x7b6a('0x24')](_0x14dbbf['query'][_0x7b6a('0x24')]);}_0x3d63f6[_0x7b6a('0x8c')]=qs[_0x7b6a('0xbb')](_0x14dbbf[_0x7b6a('0x3f')][_0x7b6a('0xbb')]);_0x3d63f6[_0x7b6a('0x46')]=qs[_0x7b6a('0x40')](_[_0x7b6a('0xbc')](_0x14dbbf[_0x7b6a('0x3f')],_0xb0704e[_0x7b6a('0x40')]));_0x3d63f6['where']['OpenchannelInteractionId']=_0x4559b6['id'];if(_0x14dbbf[_0x7b6a('0x3f')][_0x7b6a('0x80')]){_0x3d63f6['where']=_[_0x7b6a('0x9a')](_0x3d63f6[_0x7b6a('0x46')],{'$or':_[_0x7b6a('0x3e')](_0x3d63f6['attributes'],function(_0x3742a5){var _0x51dbaa={};_0x51dbaa[_0x3742a5]={'$like':'%'+_0x14dbbf[_0x7b6a('0x3f')][_0x7b6a('0x80')]+'%'};return _0x51dbaa;})});}if(_0x14dbbf[_0x7b6a('0x3f')][_0x7b6a('0xbd')]){var _0x408f68=_0x14dbbf[_0x7b6a('0x3f')][_0x7b6a('0xbd')][_0x7b6a('0x6e')](',');var _0x567cde={};_0x567cde[_0x408f68[0x0]]={'$gte':moment(_0x408f68[0x1])[_0x7b6a('0xbe')](_0x7b6a('0xbf'))};_0x3d63f6['where']=_[_0x7b6a('0x9a')](_0x3d63f6[_0x7b6a('0x46')],_0x567cde);}_0x3d63f6=_['merge']({},_0x3d63f6,_0x14dbbf[_0x7b6a('0xb1')]);return db[_0x7b6a('0xb7')]['count']({'where':_0x3d63f6[_0x7b6a('0x46')]})['then'](function(_0x32466e){_0x5ec805[_0x7b6a('0x26')]=_0x32466e;if(_0x14dbbf[_0x7b6a('0x3f')]['includeAll']){_0x3d63f6[_0x7b6a('0xc0')]=[{'all':!![]}];}return db[_0x7b6a('0xb7')][_0x7b6a('0xc1')](_0x3d63f6);})[_0x7b6a('0x2c')](function(_0x41ecdc){_0x5ec805[_0x7b6a('0xc2')]=_0x41ecdc;return _0x5ec805;});}})[_0x7b6a('0x2c')](respondWithFilteredResult(_0x2c49bb,_0x3d63f6))[_0x7b6a('0xae')](handleError(_0x2c49bb,null));};exports[_0x7b6a('0xc3')]=function(_0x117675,_0x415b77,_0x4d7676){return db['OpenchannelInteraction'][_0x7b6a('0x61')]({'where':{'id':_0x117675[_0x7b6a('0xb0')]['id']}})['then'](handleEntityNotFound(_0x415b77,null))[_0x7b6a('0x2c')](function(_0x262276){if(_0x262276){return _0x262276[_0x7b6a('0xc4')](_0x117675[_0x7b6a('0xb3')][_0x7b6a('0xb8')],_['omit'](_0x117675['body'],['ids','id'])||{})['spread'](function(){return db[_0x7b6a('0x6d')][_0x7b6a('0xc1')]({'attributes':['id',_0x7b6a('0x31'),_0x7b6a('0x48')],'where':{'id':_0x117675[_0x7b6a('0xb3')][_0x7b6a('0xb8')]}});})['then'](function(_0x13cd07){socket[_0x7b6a('0xc5')](_0x7b6a('0xc6'),{'id':Number(_0x117675['params']['id']),'tags':_0x13cd07||[]});return{'id':Number(_0x117675[_0x7b6a('0xb0')]['id']),'tags':_0x13cd07||[]};});}})[_0x7b6a('0x2c')](respondWithResult(_0x415b77,null))[_0x7b6a('0xae')](handleError(_0x415b77,null));};exports[_0x7b6a('0xc7')]=function(_0x232848,_0x47468d,_0x567a7f){return db[_0x7b6a('0x9b')][_0x7b6a('0x61')]({'where':{'id':_0x232848[_0x7b6a('0xb0')]['id']}})[_0x7b6a('0x2c')](handleEntityNotFound(_0x47468d,null))['then'](function(_0x351977){if(_0x351977){return _0x351977['removeTags'](_0x232848[_0x7b6a('0x3f')][_0x7b6a('0xb8')]);}})[_0x7b6a('0x2c')](respondWithStatusCode(_0x47468d,null))['catch'](handleError(_0x47468d,null));};exports[_0x7b6a('0xc8')]=function(_0x12e5e3,_0x12e615){var _0x5f49f6=moment()['unix']()[_0x7b6a('0x98')]();var _0x23118a=path[_0x7b6a('0xc9')](config[_0x7b6a('0xca')],_0x7b6a('0xcb'),'files','tmp');var _0x3e000d=path[_0x7b6a('0xc9')](config[_0x7b6a('0xca')],'server',_0x7b6a('0xcc'),'attachments');var _0x1eb4a9=path[_0x7b6a('0xc9')](_0x23118a,_0x5f49f6);var _0x3f40a6=util[_0x7b6a('0xbe')](_0x7b6a('0xcd'),_0x12e5e3[_0x7b6a('0xb0')]['id'],_0x5f49f6);var _0x12aba8=path[_0x7b6a('0xc9')](_0x23118a,_0x3f40a6);var _0x498d65=[];_0x498d65[_0x7b6a('0x38')]({'model':db[_0x7b6a('0x71')],'as':'User','attributes':['id',_0x7b6a('0x34')],'raw':!![]});_0x498d65[_0x7b6a('0x38')]({'model':db[_0x7b6a('0xce')],'as':_0x7b6a('0xcf'),'attributes':['id',_0x7b6a('0xd0'),_0x7b6a('0xd1')],'raw':!![]});if(_0x12e5e3['query'][_0x7b6a('0xd2')]){_0x498d65[_0x7b6a('0x38')]({'model':db[_0x7b6a('0xd3')],'as':'Attachment','raw':!![]});}var _0x3da955=[{'model':db[_0x7b6a('0xb7')],'as':_0x7b6a('0xd4'),'attributes':['id',_0x7b6a('0xb3'),_0x7b6a('0x78'),'direction',_0x7b6a('0xd5'),'read'],'include':_0x498d65}];_0x3da955[_0x7b6a('0x38')]({'model':db[_0x7b6a('0xd6')],'as':_0x7b6a('0xd7'),'attributes':['id',_0x7b6a('0x31')]});_0x3da955['push']({'model':db[_0x7b6a('0x71')],'as':_0x7b6a('0xd8'),'attributes':['id',_0x7b6a('0x34')]});return db[_0x7b6a('0x9b')]['find']({'where':{'id':_0x12e5e3[_0x7b6a('0xb0')]['id']},'include':_0x3da955})[_0x7b6a('0x2c')](handleEntityNotFound(_0x12e615,null))[_0x7b6a('0x2c')](function(_0x433925){if(_0x433925){var _0x1ed689=_0x433925[_0x7b6a('0xd9')]({'plain':!![]});fs[_0x7b6a('0xda')](_0x1eb4a9);var _0x3e9fce={'channel':_0x7b6a('0xdb'),'account':_0x1ed689['Account'][_0x7b6a('0x31')],'agent':_0x1ed689['Owner']?_0x1ed689[_0x7b6a('0xd8')][_0x7b6a('0x34')]:_0x7b6a('0xdc'),'createdAt':moment(_0x1ed689[_0x7b6a('0x78')])['format'](_0x7b6a('0xbf'))[_0x7b6a('0x98')](),'closedAt':_0x1ed689[_0x7b6a('0xdd')]?moment(_0x1ed689[_0x7b6a('0xde')])[_0x7b6a('0xbe')](_0x7b6a('0xbf'))[_0x7b6a('0x98')]():'','disposition':_0x1ed689[_0x7b6a('0xdf')],'visibility':_0x1ed689[_0x7b6a('0xe0')]?'Public':_0x7b6a('0xe1'),'messages':_(_0x1ed689[_0x7b6a('0xd4')])[_0x7b6a('0x80')]({'secret':![]})[_0x7b6a('0x3e')](function(_0x107e82){if(_0x107e82[_0x7b6a('0xd3')]){var _0x137a4e=path[_0x7b6a('0xc9')](_0x3e000d,_0x107e82[_0x7b6a('0xd3')][_0x7b6a('0xe2')]);if(fs['existsSync'](_0x137a4e)){fs[_0x7b6a('0xe3')](_0x137a4e)[_0x7b6a('0xe4')](fs[_0x7b6a('0xe5')](path[_0x7b6a('0xc9')](_0x1eb4a9,_0x107e82[_0x7b6a('0xd3')][_0x7b6a('0xe2')])));}}return{'date':moment(_0x107e82[_0x7b6a('0x78')])[_0x7b6a('0xbe')](_0x7b6a('0xbf'))['toString'](),'sender':_0x107e82[_0x7b6a('0xe6')]===_0x7b6a('0xe7')?_0x107e82[_0x7b6a('0x71')]?_0x107e82[_0x7b6a('0x71')][_0x7b6a('0x34')]:_0x7b6a('0xe8'):_0x107e82[_0x7b6a('0xcf')][_0x7b6a('0xd0')]+(_0x107e82['Contact']['lastName']?'\x20'+_0x107e82[_0x7b6a('0xcf')]['lastName']:''),'body':_0x107e82['Attachment']?_0x107e82[_0x7b6a('0xd3')][_0x7b6a('0xe2')]:_0x107e82[_0x7b6a('0xb3')],'direction':_0x107e82['direction']===_0x7b6a('0xe7')?'A':'C','secret':_0x107e82[_0x7b6a('0xd5')],'read':_0x107e82[_0x7b6a('0xe9')],'attachment':_0x107e82[_0x7b6a('0xd3')]};})[_0x7b6a('0x63')]()};return ejs[_0x7b6a('0xea')](path[_0x7b6a('0xc9')](config[_0x7b6a('0xca')],'server',_0x7b6a('0xeb'),_0x7b6a('0xec')),{'interaction':_0x3e9fce})[_0x7b6a('0x2c')](function(_0x1a36b2){var _0x90bd35=path['join'](_0x1eb4a9,'transcript-'+_0x1ed689['id']+'-'+_0x5f49f6+_0x7b6a('0xed'));var _0x127a4c={'path':_0x90bd35,'channel':'Openchannel','interactionId':_0x1ed689['id']};return pdf[_0x7b6a('0xee')](_0x1a36b2,_0x127a4c);})[_0x7b6a('0x2c')](function(){return new BPromise(function(_0x3d48e6,_0x1e6254){zipdir(_0x1eb4a9,{'saveTo':_0x12aba8},function(_0x1aa602,_0x289563){if(_0x1aa602)return _0x1e6254(_0x1aa602);return _0x3d48e6(_0x289563);});})[_0x7b6a('0x2c')](function(){return new BPromise(function(_0x580d99,_0xc835bc){rimraf(_0x1eb4a9,function(_0x1758fb){if(_0x1758fb)_0xc835bc(_0x1758fb);return _0x580d99();});});})[_0x7b6a('0x2c')](function(){return _0x12e615[_0x7b6a('0xc8')](_0x12aba8,_0x3f40a6,function(_0x30bbd8){if(_0x30bbd8){console[_0x7b6a('0xef')]('err',_0x30bbd8);}else{fs[_0x7b6a('0xf0')](_0x12aba8);}});});});}else{return _0x12e615[_0x7b6a('0x2e')](0xc8);}})[_0x7b6a('0xae')](handleError(_0x12e615,null));}; \ No newline at end of file +var _0xa420=['fields','length','hasOwnProperty','nolimit','offset','sort','where','pick','select','field','color','from','u.id','ui.OpenchannelInteractionId','user_has_openchannel_interactions','left_join','users','u.id\x20=\x20ui.UserId','openchannel_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','a.id\x20=\x20i.OpenchannelAccountId','openchannel_messages','me.OpenchannelInteractionId\x20=\x20i.id','openchannel_interaction_has_tags','it.OpenchannelInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','parseSearch','sqlOperator','conditions','find','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)','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','text','start','Tag','union','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','compact','isEmpty','i.OpenchannelAccountId\x20IN\x20?','concat','parse','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','filter','replace','i.id\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','group','Sequelize','QueryTypes','SELECT','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','order','contactName','DESC','i.OpenchannelAccountId\x20IS\x20NOT\x20NULL','user','role','getOpenchannelAccounts','i.OpenchannelAccountId\x20IS\x20NULL','agent','toString','sequelize','keyBy','merge','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','c.email','Contact.email','Contact.mobile','c.fax','o.fullname','Owner.fullname','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.OpenchannelInteractionId\x20IN\x20?','groupBy','OpenchannelInteractionId','all','rows','show','params','include','options','create','update','describe','addMessage','OpenchannelMessage','ids','getMessages','findOne','$gte','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','addTags','setTags','omit','spread','findAll','emit','openchannelInteractionTags:save','removeTags','unix','join','root','server','files','attachments','transcript-%d-%s.zip','User','CmContact','lastName','Attachment','Messages','direction','OpenchannelAccount','Account','get','mkdirSync','Openchannel','Owner','N.A.','createdAt','closed','closedAt','disposition','threadId','Public','Private','createReadStream','pipe','out','System','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','socket.io-emitter','register','status','end','json','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','Users','map','fullname','TagIds','Tags','forEach','push','catch','OpenchannelInteraction','rawAttributes','type','key','model','keys','query','filters','intersection','attributes'];(function(_0x220dbb,_0x99328d){var _0x2b77de=function(_0x15e966){while(--_0x15e966){_0x220dbb['push'](_0x220dbb['shift']());}};_0x2b77de(++_0x99328d);}(_0xa420,0xb0));var _0x0a42=function(_0x215078,_0x9d7ec9){_0x215078=_0x215078-0x0;var _0x42465c=_0xa420[_0x215078];return _0x42465c;};'use strict';var emlformat=require(_0x0a42('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0a42('0x1'));var rp=require(_0x0a42('0x2'));var moment=require(_0x0a42('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a42('0x4'));var util=require('util');var path=require(_0x0a42('0x5'));var sox=require(_0x0a42('0x6'));var csv=require(_0x0a42('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a42('0x8'));var _=require(_0x0a42('0x9'));var squel=require(_0x0a42('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a42('0xb'));var toCsv=require('to-csv');var querystring=require(_0x0a42('0xc'));var Papa=require('papaparse');var Redis=require(_0x0a42('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x0a42('0xe'));var as=require('../../components/parsers/advancedSearch');var pdf=require('../../components/export/pdf');var hardwareService=require(_0x0a42('0xf'));var logger=require(_0x0a42('0x10'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a42('0x11'));var db=require(_0x0a42('0x12'))['db'];config['redis']=_['defaults'](config[_0x0a42('0x13')],{'host':'localhost','port':0x18eb});var socket=require(_0x0a42('0x14'))(new Redis(config[_0x0a42('0x13')]));require('./openchannelInteraction.socket')[_0x0a42('0x15')](socket);function respondWithStatusCode(_0x5ac562,_0x90f89e){_0x90f89e=_0x90f89e||0xcc;return function(_0x3c7ef4){if(_0x3c7ef4){return _0x5ac562['sendStatus'](_0x90f89e);}return _0x5ac562[_0x0a42('0x16')](_0x90f89e)[_0x0a42('0x17')]();};}function respondWithResult(_0x16972f,_0x4a9bea){_0x4a9bea=_0x4a9bea||0xc8;return function(_0x189b17){if(_0x189b17){return _0x16972f[_0x0a42('0x16')](_0x4a9bea)[_0x0a42('0x18')](_0x189b17);}};}function respondWithFilteredResult(_0xa115da,_0x2bcd52){return function(_0x5124b1){if(_0x5124b1){var _0x2c226e=typeof _0x2bcd52['offset']===_0x0a42('0x19')&&typeof _0x2bcd52[_0x0a42('0x1a')]===_0x0a42('0x19');var _0x35e6f8=_0x5124b1[_0x0a42('0x1b')];var _0x1d1866=_0x2c226e?0x0:_0x2bcd52['offset'];var _0x17cfd7=_0x2c226e?_0x5124b1[_0x0a42('0x1b')]:_0x2bcd52['offset']+_0x2bcd52[_0x0a42('0x1a')];var _0x859051;if(_0x17cfd7>=_0x35e6f8){_0x17cfd7=_0x35e6f8;_0x859051=0xc8;}else{_0x859051=0xce;}_0xa115da[_0x0a42('0x16')](_0x859051);return _0xa115da['set'](_0x0a42('0x1c'),_0x1d1866+'-'+_0x17cfd7+'/'+_0x35e6f8)[_0x0a42('0x18')](_0x5124b1);}return null;};}function patchUpdates(_0x323621){return function(_0x1b9793){try{jsonpatch[_0x0a42('0x1d')](_0x1b9793,_0x323621,!![]);}catch(_0x3305b1){return BPromise[_0x0a42('0x1e')](_0x3305b1);}return _0x1b9793[_0x0a42('0x1f')]();};}function saveUpdates(_0x2fb06c,_0x313a76){return function(_0x13a5f2){if(_0x13a5f2){return _0x13a5f2['update'](_0x2fb06c)[_0x0a42('0x20')](function(_0x54c980){return _0x54c980;});}return null;};}function removeEntity(_0x5e5b8d,_0x5812de){return function(_0x558222){if(_0x558222){return _0x558222[_0x0a42('0x21')]()['then'](function(){_0x5e5b8d[_0x0a42('0x16')](0xcc)[_0x0a42('0x17')]();});}};}function handleEntityNotFound(_0x1c38ab,_0x55e9b5){return function(_0x254e62){if(!_0x254e62){_0x1c38ab[_0x0a42('0x22')](0x194);}return _0x254e62;};}function handleError(_0x44087b,_0x18630a){_0x18630a=_0x18630a||0x1f4;return function(_0x551b6d){logger[_0x0a42('0x23')](_0x551b6d[_0x0a42('0x24')]);if(_0x551b6d[_0x0a42('0x25')]){delete _0x551b6d[_0x0a42('0x25')];}_0x44087b[_0x0a42('0x16')](_0x18630a)['send'](_0x551b6d);};}function getInteractionUsers(_0x27277b,_0x5770ed){return new BPromise(function(_0x2dd962,_0xc16b97){try{if(_0x5770ed[_0x27277b['id']]){_0x27277b[_0x0a42('0x26')]=_[_0x0a42('0x27')](_0x5770ed[_0x27277b['id']],function(_0x179248){return{'id':_0x179248['id'],'fullname':_0x179248[_0x0a42('0x28')]};});}}catch(_0x5cfec9){_0xc16b97(_0x5cfec9);}_0x2dd962(_0x27277b);});}function getInteractionTags(_0x2f6f6d,_0x288390){return new BPromise(function(_0x537753,_0x20fa86){try{if(_0x2f6f6d[_0x0a42('0x29')]){_0x2f6f6d[_0x0a42('0x2a')]=[];_0x2f6f6d[_0x0a42('0x29')]['split'](',')[_0x0a42('0x2b')](function(_0x5c80fe){_0x2f6f6d['Tags'][_0x0a42('0x2c')](_0x288390[_0x5c80fe]);});}delete _0x2f6f6d[_0x0a42('0x29')];}catch(_0x1166d2){_0x20fa86(_0x1166d2);}_0x537753(_0x2f6f6d);});}function updateOpenchannelInteraction(_0x435436,_0xa49040,_0x5c6669){return new BPromise(function(_0x38577f,_0x1ebab0){return getInteractionUsers(_0x435436,_0x5c6669)['then'](function(_0x6d2d88){return getInteractionTags(_0x6d2d88,_0xa49040);})[_0x0a42('0x20')](function(_0x54c88f){_0x38577f(_0x54c88f);})[_0x0a42('0x2d')](function(_0xebc7dc){_0x1ebab0(_0xebc7dc);});});}exports['index']=function(_0x357374,_0x59cabd){var _0x47af8f={},_0x5e8c5b={},_0x3b8edb={'count':0x0,'rows':[]};var _0x8f2688=_[_0x0a42('0x27')](db[_0x0a42('0x2e')][_0x0a42('0x2f')],function(_0x1879e7){return{'name':_0x1879e7['fieldName'],'type':_0x1879e7[_0x0a42('0x30')][_0x0a42('0x31')]};});_0x5e8c5b[_0x0a42('0x32')]=_[_0x0a42('0x27')](_0x8f2688,_0x0a42('0x25'));_0x5e8c5b['query']=_[_0x0a42('0x33')](_0x357374[_0x0a42('0x34')]);_0x5e8c5b[_0x0a42('0x35')]=_[_0x0a42('0x36')](_0x5e8c5b['model'],_0x5e8c5b[_0x0a42('0x34')]);_0x47af8f[_0x0a42('0x37')]=_[_0x0a42('0x36')](_0x5e8c5b[_0x0a42('0x32')],qs[_0x0a42('0x38')](_0x357374[_0x0a42('0x34')][_0x0a42('0x38')]));_0x47af8f[_0x0a42('0x37')]=_0x47af8f[_0x0a42('0x37')][_0x0a42('0x39')]?_0x47af8f['attributes']:_0x5e8c5b[_0x0a42('0x32')];if(!_0x357374['query'][_0x0a42('0x3a')](_0x0a42('0x3b'))){_0x47af8f[_0x0a42('0x1a')]=qs['limit'](_0x357374[_0x0a42('0x34')]['limit']);_0x47af8f['offset']=qs[_0x0a42('0x3c')](_0x357374[_0x0a42('0x34')]['offset']);}_0x47af8f['order']=qs['sort'](_0x357374[_0x0a42('0x34')][_0x0a42('0x3d')]);_0x47af8f[_0x0a42('0x3e')]=qs[_0x0a42('0x35')](_[_0x0a42('0x3f')](_0x357374['query'],_0x5e8c5b[_0x0a42('0x35')]),_0x8f2688);var _0x1596c5=[];var _0x4c50c1=squel[_0x0a42('0x40')]()[_0x0a42('0x41')]('id')['field'](_0x0a42('0x25'))['field'](_0x0a42('0x42'))[_0x0a42('0x43')]('tools_tags');var _0x4381ad=squel[_0x0a42('0x40')]()[_0x0a42('0x41')](_0x0a42('0x44'))[_0x0a42('0x41')]('u.fullname')['field'](_0x0a42('0x45'))[_0x0a42('0x43')](_0x0a42('0x46'),'ui')[_0x0a42('0x47')](_0x0a42('0x48'),'u',_0x0a42('0x49'));var _0x483162=squel[_0x0a42('0x40')]()[_0x0a42('0x43')](_0x0a42('0x4a'),'i')[_0x0a42('0x47')](_0x0a42('0x4b'),'c',_0x0a42('0x4c'))[_0x0a42('0x47')](_0x0a42('0x48'),'o','o.id\x20=\x20i.UserId')[_0x0a42('0x47')]('openchannel_accounts','a',_0x0a42('0x4d'))['left_join'](_0x0a42('0x4e'),'me',_0x0a42('0x4f'))[_0x0a42('0x47')](_0x0a42('0x50'),'it',_0x0a42('0x51'))['left_join'](_0x0a42('0x52'),'t',_0x0a42('0x53'));var _0x46757c=squel[_0x0a42('0x54')]();var _0x2146df=[];var _0x57c40b=squel[_0x0a42('0x54')]();var _0x779725;if(_0x357374[_0x0a42('0x34')][_0x0a42('0x55')]){_0x779725=as[_0x0a42('0x56')](_0x357374[_0x0a42('0x34')]['search']);var _0x389ef4=_0x779725[_0x0a42('0x57')];for(var _0x1bb038=0x0;_0x1bb038<_0x779725[_0x0a42('0x58')]['length'];_0x1bb038++){var _0x3099bd=_0x779725[_0x0a42('0x58')][_0x1bb038];var _0x3f8cd6='i';var _0x12cd36=_[_0x0a42('0x59')](_0x8f2688,[_0x0a42('0x25'),_0x3099bd[_0x0a42('0x41')]]);if(!_0x12cd36){switch(_0x3099bd[_0x0a42('0x41')]){case'unreadMessages':if(_0x3099bd[_0x0a42('0x5a')]==0x1){_0x483162[_0x0a42('0x5b')]('`'+_0x3099bd[_0x0a42('0x41')]+_0x0a42('0x5c'));}else{_0x483162[_0x0a42('0x5b')]('`'+_0x3099bd['field']+_0x0a42('0x5d'));}break;case _0x0a42('0x5e'):if(_0x3099bd[_0x0a42('0x5f')]===_0x0a42('0x60')){if(_0x3099bd[_0x0a42('0x5a')][_0x0a42('0x61')]('\x20')['length']>0x1){_0x46757c[_0x389ef4](_0x0a42('0x62'),qs[_0x0a42('0x63')](_0x3099bd[_0x0a42('0x5a')]),null);}else{var _0x527551='%'+_0x3099bd['value']+'%';_0x46757c[_0x389ef4](_0x0a42('0x64'),_0x527551,_0x527551,_0x527551);}}else{_0x12cd36=_[_0x0a42('0x59')](_0x8f2688,[_0x0a42('0x25'),_0x0a42('0x65')]);_0x3099bd[_0x0a42('0x41')]='ContactId';_0x498de0=as['buildExpression'](_0x3f8cd6,_0x12cd36[_0x0a42('0x30')],_0x3099bd);_0x46757c[_0x389ef4](_0x498de0[_0x0a42('0x66')],_0x498de0[_0x0a42('0x5a')][_0x0a42('0x67')],_0x498de0[_0x0a42('0x5a')]['end']);}break;case _0x0a42('0x68'):var _0x374d5a=_0x3099bd[_0x0a42('0x5a')][_0x0a42('0x61')](',')[_0x0a42('0x27')](function(_0x557ad3){return Number(_0x557ad3);});_0x374d5a[_0x0a42('0x2b')](function(_0x555a02){_0x57c40b['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x555a02+',%');});_0x2146df=_[_0x0a42('0x69')](_0x2146df,_0x374d5a);break;case'User':if(_0x3099bd[_0x0a42('0x5f')]===_0x0a42('0x60')){_0x46757c[_0x389ef4](_0x0a42('0x6a'),'%'+_0x3099bd['value']+'%',null);}else{_0x12cd36=_[_0x0a42('0x59')](_0x8f2688,[_0x0a42('0x25'),'UserId']);_0x3099bd[_0x0a42('0x41')]=_0x0a42('0x6b');_0x498de0=as['buildExpression'](_0x3f8cd6,_0x12cd36[_0x0a42('0x30')],_0x3099bd);_0x46757c[_0x389ef4](_0x498de0[_0x0a42('0x66')],_0x498de0['value'][_0x0a42('0x67')],_0x498de0[_0x0a42('0x5a')]['end']);}break;case _0x0a42('0x6c'):_0x498de0=as['buildExpression']('me',null,_0x3099bd);_0x46757c[_0x389ef4](_0x498de0[_0x0a42('0x66')],_0x498de0['value'][_0x0a42('0x67')],_0x498de0[_0x0a42('0x5a')][_0x0a42('0x17')]);break;}}else{var _0x498de0=as['buildExpression'](_0x3f8cd6,_0x12cd36[_0x0a42('0x30')],_0x3099bd);_0x46757c[_0x389ef4](_0x498de0[_0x0a42('0x66')],_0x498de0[_0x0a42('0x5a')][_0x0a42('0x67')],_0x498de0[_0x0a42('0x5a')]['end']);}}}else{var _0x20cdf6=_(_0x357374['query'])[_0x0a42('0x33')]()[_0x0a42('0x27')](function(_0x5693e5){return _['some'](_0x8f2688,[_0x0a42('0x25'),_0x5693e5])?_0x5693e5:undefined;})[_0x0a42('0x6d')]()[_0x0a42('0x5a')]();if(!_[_0x0a42('0x6e')](_0x20cdf6)){_0x20cdf6[_0x0a42('0x2b')](function(_0x575d65){if(_0x575d65==='OpenchannelAccountId'){_0x483162[_0x0a42('0x3e')](_0x0a42('0x6f'),[][_0x0a42('0x70')](_0x357374[_0x0a42('0x34')][_0x575d65]));}else if(_0x575d65==='createdAt'){var _0x18137b=JSON['parse'](_0x357374['query'][_0x575d65])['$gte'];var _0x5f4248=JSON[_0x0a42('0x71')](_0x357374[_0x0a42('0x34')][_0x575d65])[_0x0a42('0x72')];_0x483162[_0x0a42('0x3e')](_0x0a42('0x73'),_0x18137b,_0x5f4248);}else{if(_0x357374[_0x0a42('0x34')][_0x575d65]===_0x0a42('0x74')){_0x483162[_0x0a42('0x3e')]('i.'+_0x575d65+_0x0a42('0x75'));}else{_0x483162[_0x0a42('0x3e')]('i.'+_0x575d65+'\x20=\x20?',_0x357374[_0x0a42('0x34')][_0x575d65]);}}});}if(_0x357374[_0x0a42('0x34')][_0x0a42('0x76')]){if(_0x357374[_0x0a42('0x34')]['read']==0x1){_0x483162[_0x0a42('0x5b')](_0x0a42('0x77'));}else{_0x483162[_0x0a42('0x5b')](_0x0a42('0x78'));}}if(_0x357374['query'][_0x0a42('0x79')]){_0x2146df=_[_0x0a42('0x7a')](_0x357374[_0x0a42('0x34')]['tag'])?_0x357374[_0x0a42('0x34')][_0x0a42('0x79')]:new Array(_0x357374[_0x0a42('0x34')]['tag']);_0x2146df['forEach'](function(_0x416d13){_0x57c40b['or'](_0x0a42('0x7b'),'%,'+_0x416d13+',%');});}if(_0x357374[_0x0a42('0x34')][_0x0a42('0x7c')]){var _0x22fb17=_0x357374['query'][_0x0a42('0x7c')][_0x0a42('0x7d')]('\x5c','\x5c\x5c')[_0x0a42('0x7d')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x22fb17)){_0x46757c['or'](_0x0a42('0x7e'),_0x22fb17+'%');}else{_0x46757c['or'](_0x0a42('0x7f'),qs['getFullTextValue'](_0x22fb17))['or']('i.from\x20LIKE\x20?',_0x22fb17+'%')['or']('CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?',_0x22fb17+'%');}}}_0x483162[_0x0a42('0x3e')](_0x46757c);_0x483162[_0x0a42('0x80')]('i.id');var _0x1125a9={'type':db[_0x0a42('0x81')][_0x0a42('0x82')][_0x0a42('0x83')],'raw':!![]};var _0x55072b=_0x483162['clone']();_0x55072b[_0x0a42('0x41')](_0x0a42('0x84'));_0x55072b[_0x0a42('0x41')](_0x0a42('0x85'),_0x0a42('0x86'));if(_0x47af8f[_0x0a42('0x87')]){_0x47af8f[_0x0a42('0x87')]['forEach'](function(_0x44710d){var _0x15361a=_0x44710d[0x0]===_0x0a42('0x88')?_0x44710d[0x0]:'i.'+_0x44710d[0x0];_0x483162[_0x0a42('0x87')](_0x15361a,_0x44710d[0x1]===_0x0a42('0x89')?![]:!![]);});}if(!_[_0x0a42('0x6e')](_0x2146df)){_0x483162['having'](_0x57c40b);_0x55072b[_0x0a42('0x3e')]('t.id\x20IN\x20?',_0x2146df);}BPromise['resolve']()[_0x0a42('0x20')](function(){if(!_0x779725){if(_0x357374[_0x0a42('0x34')]['OpenchannelAccountId'])return;_0x55072b[_0x0a42('0x3e')](_0x0a42('0x8a'));_0x483162[_0x0a42('0x3e')](_0x0a42('0x8a'));return;}if(_0x357374[_0x0a42('0x8b')][_0x0a42('0x8c')]!=='agent')return;return _0x357374[_0x0a42('0x8b')][_0x0a42('0x8d')]({'attributes':['id'],'raw':!![]})[_0x0a42('0x20')](function(_0x1a337d){if(_[_0x0a42('0x6e')](_0x1a337d)){_0x55072b[_0x0a42('0x3e')](_0x0a42('0x8e'));_0x483162[_0x0a42('0x3e')](_0x0a42('0x8e'));}else{_0x55072b[_0x0a42('0x3e')]('i.OpenchannelAccountId\x20IN\x20?',_['map'](_0x1a337d,'id'));_0x483162['where'](_0x0a42('0x6f'),_[_0x0a42('0x27')](_0x1a337d,'id'));}});})['then'](function(){if(_0x357374[_0x0a42('0x8b')][_0x0a42('0x8c')]===_0x0a42('0x8f')&&!_0x779725&&!_0x357374[_0x0a42('0x34')]['OpenchannelAccountId'])return[];return db['sequelize'][_0x0a42('0x34')](_0x55072b[_0x0a42('0x90')](),_0x1125a9);})[_0x0a42('0x20')](function(_0x36de27){_0x3b8edb[_0x0a42('0x1b')]=_0x36de27[_0x0a42('0x39')];if(_0x3b8edb[_0x0a42('0x1b')]===0x0)return[];return db[_0x0a42('0x91')][_0x0a42('0x34')](_0x4c50c1[_0x0a42('0x90')](),_0x1125a9)['then'](function(_0xcc9b5e){_0x1596c5=_[_0x0a42('0x92')](_0xcc9b5e,'id');_0x1125a9=_[_0x0a42('0x93')](_0x1125a9,{'model':db[_0x0a42('0x2e')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x357374['query'][_0x0a42('0x38')]){_0x47af8f[_0x0a42('0x37')][_0x0a42('0x2b')](function(_0x4818c6){_0x483162[_0x0a42('0x41')]('i.'+_0x4818c6);});}else{_0x483162[_0x0a42('0x41')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x0a42('0x86'));_0x483162['field'](_0x0a42('0x94'),_0x0a42('0x95'));_0x483162[_0x0a42('0x41')](_0x0a42('0x96'),'Account.mandatoryDisposition');_0x483162[_0x0a42('0x41')](_0x0a42('0x97'),_0x0a42('0x88'));_0x483162[_0x0a42('0x41')](_0x0a42('0x98'));_0x483162['field'](_0x0a42('0x99'),_0x0a42('0x9a'));_0x483162[_0x0a42('0x41')](_0x0a42('0x9b'),_0x0a42('0x9c'));_0x483162[_0x0a42('0x41')](_0x0a42('0x9d'),_0x0a42('0x9e'));_0x483162['field']('c.phone','Contact.phone');_0x483162['field']('c.mobile',_0x0a42('0x9f'));_0x483162[_0x0a42('0x41')](_0x0a42('0xa0'),'Contact.fax');_0x483162[_0x0a42('0x41')](_0x0a42('0xa1'),_0x0a42('0xa2'));_0x483162[_0x0a42('0x41')]('o.internal',_0x0a42('0xa3'));_0x483162[_0x0a42('0x41')](_0x0a42('0xa4'),'TagIds');}if(_0x47af8f[_0x0a42('0x1a')])_0x483162['limit'](_0x47af8f[_0x0a42('0x1a')]);if(_0x47af8f['offset'])_0x483162[_0x0a42('0x3c')](_0x47af8f[_0x0a42('0x3c')]);return db[_0x0a42('0x91')][_0x0a42('0x34')](_0x483162[_0x0a42('0x90')](),_0x1125a9);})[_0x0a42('0x20')](function(_0x198199){if(_0x198199[_0x0a42('0x39')]>0x0)_0x4381ad[_0x0a42('0x3e')](_0x0a42('0xa5'),_[_0x0a42('0x27')](_0x198199,'id'));return db[_0x0a42('0x91')][_0x0a42('0x34')](_0x4381ad['toString'](),_0x1125a9)[_0x0a42('0x20')](function(_0x19bd58){var _0x16c6a2=_[_0x0a42('0xa6')](_0x19bd58,_0x0a42('0xa7'));var _0x2857d3=[];_0x198199['forEach'](function(_0x526dcf){_0x2857d3['push'](updateOpenchannelInteraction(_0x526dcf,_0x1596c5,_0x16c6a2));});return BPromise[_0x0a42('0xa8')](_0x2857d3);});});})['then'](function(_0x3d293a){_0x3b8edb[_0x0a42('0xa9')]=_0x3d293a;return _0x3b8edb;})['then'](respondWithFilteredResult(_0x59cabd,_0x47af8f))[_0x0a42('0x2d')](handleError(_0x59cabd,null));};exports[_0x0a42('0xaa')]=function(_0x32be55,_0x309d34){var _0x53beb6={};if(_0x32be55['query'][_0x0a42('0x30')]&&_0x32be55[_0x0a42('0x34')]['type']==='from'){_0x53beb6[_0x0a42('0x43')]=_0x32be55[_0x0a42('0xab')]['id'];}else{_0x53beb6['id']=_0x32be55[_0x0a42('0xab')]['id'];}var _0x45a730={'raw':![],'where':_0x53beb6},_0x5114fe={};_0x5114fe['model']=_['keys'](db[_0x0a42('0x2e')][_0x0a42('0x2f')]);_0x5114fe[_0x0a42('0x34')]=_[_0x0a42('0x33')](_0x32be55['query']);_0x5114fe['filters']=_[_0x0a42('0x36')](_0x5114fe[_0x0a42('0x32')],_0x5114fe[_0x0a42('0x34')]);_0x45a730[_0x0a42('0x37')]=_['intersection'](_0x5114fe[_0x0a42('0x32')],qs[_0x0a42('0x38')](_0x32be55[_0x0a42('0x34')][_0x0a42('0x38')]));_0x45a730[_0x0a42('0x37')]=_0x45a730[_0x0a42('0x37')][_0x0a42('0x39')]?_0x45a730['attributes']:_0x5114fe[_0x0a42('0x32')];if(_0x32be55[_0x0a42('0x34')]['includeAll']){_0x45a730[_0x0a42('0xac')]=[{'all':!![]}];}_0x45a730=_[_0x0a42('0x93')]({},_0x45a730,_0x32be55[_0x0a42('0xad')]);return db[_0x0a42('0x2e')]['find'](_0x45a730)['then'](handleEntityNotFound(_0x309d34,null))[_0x0a42('0x20')](respondWithResult(_0x309d34,null))[_0x0a42('0x2d')](handleError(_0x309d34,null));};exports[_0x0a42('0xae')]=function(_0x524dfe,_0x4d621b){return db[_0x0a42('0x2e')][_0x0a42('0xae')](_0x524dfe[_0x0a42('0x6c')],{})['then'](respondWithResult(_0x4d621b,0xc9))[_0x0a42('0x2d')](handleError(_0x4d621b,null));};exports[_0x0a42('0xaf')]=function(_0x4695e1,_0x224c3d){if(_0x4695e1[_0x0a42('0x6c')]['id']){delete _0x4695e1[_0x0a42('0x6c')]['id'];}return db[_0x0a42('0x2e')]['find']({'where':{'id':_0x4695e1['params']['id']}})['then'](handleEntityNotFound(_0x224c3d,null))[_0x0a42('0x20')](saveUpdates(_0x4695e1[_0x0a42('0x6c')],null))[_0x0a42('0x20')](respondWithResult(_0x224c3d,null))[_0x0a42('0x2d')](handleError(_0x224c3d,null));};exports['destroy']=function(_0x52c7ed,_0x3acd62){return db[_0x0a42('0x2e')][_0x0a42('0x59')]({'where':{'id':_0x52c7ed['params']['id']}})[_0x0a42('0x20')](handleEntityNotFound(_0x3acd62,null))['then'](removeEntity(_0x3acd62,null))[_0x0a42('0x2d')](handleError(_0x3acd62,null));};exports[_0x0a42('0xb0')]=function(_0x5dbc1b,_0x5c351d){return db[_0x0a42('0x2e')][_0x0a42('0xb0')]()['then'](respondWithResult(_0x5c351d,null))[_0x0a42('0x2d')](handleError(_0x5c351d,null));};exports[_0x0a42('0xb1')]=function(_0x4d1091,_0x2cc2a9,_0x4a7e43){return db[_0x0a42('0xb2')]['find']({'where':{'id':_0x4d1091['params']['id']}})[_0x0a42('0x20')](handleEntityNotFound(_0x2cc2a9,null))[_0x0a42('0x20')](function(_0x2cb187){if(_0x2cb187){return _0x2cb187[_0x0a42('0xb1')](_0x4d1091[_0x0a42('0x6c')][_0x0a42('0xb3')],_['omit'](_0x4d1091['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x2cc2a9,null))[_0x0a42('0x2d')](handleError(_0x2cc2a9,null));};exports[_0x0a42('0xb4')]=function(_0x1c8f4e,_0x4b9cc2,_0x4db7b){var _0x181fc6={'raw':![],'where':{}};var _0x401d38={};var _0x5e6493={'count':0x0,'rows':[]};return db[_0x0a42('0x2e')][_0x0a42('0xb5')]({'where':{'id':_0x1c8f4e[_0x0a42('0xab')]['id']}})['then'](handleEntityNotFound(_0x4b9cc2,null))['then'](function(_0x20bc4e){if(_0x20bc4e){_0x401d38[_0x0a42('0x32')]=_[_0x0a42('0x33')](db['OpenchannelMessage'][_0x0a42('0x2f')]);_0x401d38['query']=_[_0x0a42('0x33')](_0x1c8f4e['query']);_0x401d38[_0x0a42('0x35')]=_['intersection'](_0x401d38[_0x0a42('0x32')],_0x401d38['query']);_0x181fc6[_0x0a42('0x37')]=_[_0x0a42('0x36')](_0x401d38[_0x0a42('0x32')],qs[_0x0a42('0x38')](_0x1c8f4e[_0x0a42('0x34')][_0x0a42('0x38')]));_0x181fc6[_0x0a42('0x37')]=_0x181fc6['attributes']['length']?_0x181fc6[_0x0a42('0x37')]:_0x401d38[_0x0a42('0x32')];if(!_0x1c8f4e['query'][_0x0a42('0x3a')](_0x0a42('0x3b'))){_0x181fc6[_0x0a42('0x1a')]=qs['limit'](_0x1c8f4e[_0x0a42('0x34')][_0x0a42('0x1a')]);_0x181fc6['offset']=qs[_0x0a42('0x3c')](_0x1c8f4e[_0x0a42('0x34')]['offset']);}_0x181fc6[_0x0a42('0x87')]=qs[_0x0a42('0x3d')](_0x1c8f4e[_0x0a42('0x34')][_0x0a42('0x3d')]);_0x181fc6[_0x0a42('0x3e')]=qs[_0x0a42('0x35')](_[_0x0a42('0x3f')](_0x1c8f4e[_0x0a42('0x34')],_0x401d38[_0x0a42('0x35')]));_0x181fc6[_0x0a42('0x3e')]['OpenchannelInteractionId']=_0x20bc4e['id'];if(_0x1c8f4e[_0x0a42('0x34')]['filter']){_0x181fc6[_0x0a42('0x3e')]=_['merge'](_0x181fc6[_0x0a42('0x3e')],{'$or':_[_0x0a42('0x27')](_0x181fc6['attributes'],function(_0x3ae477){var _0xa046e5={};_0xa046e5[_0x3ae477]={'$like':'%'+_0x1c8f4e['query'][_0x0a42('0x7c')]+'%'};return _0xa046e5;})});}if(_0x1c8f4e[_0x0a42('0x34')][_0x0a42('0xb6')]){var _0x1ccdbd=_0x1c8f4e['query']['$gte'][_0x0a42('0x61')](',');var _0x180a5a={};_0x180a5a[_0x1ccdbd[0x0]]={'$gte':moment(_0x1ccdbd[0x1])[_0x0a42('0xb7')](_0x0a42('0xb8'))};_0x181fc6[_0x0a42('0x3e')]=_[_0x0a42('0x93')](_0x181fc6['where'],_0x180a5a);}_0x181fc6=_['merge']({},_0x181fc6,_0x1c8f4e[_0x0a42('0xad')]);return db['OpenchannelMessage'][_0x0a42('0x1b')]({'where':_0x181fc6['where']})[_0x0a42('0x20')](function(_0x79d41b){_0x5e6493[_0x0a42('0x1b')]=_0x79d41b;if(_0x1c8f4e['query'][_0x0a42('0xb9')]){_0x181fc6[_0x0a42('0xac')]=[{'all':!![]}];}return db['OpenchannelMessage']['findAll'](_0x181fc6);})[_0x0a42('0x20')](function(_0x5a2911){_0x5e6493['rows']=_0x5a2911;return _0x5e6493;});}})[_0x0a42('0x20')](respondWithFilteredResult(_0x4b9cc2,_0x181fc6))[_0x0a42('0x2d')](handleError(_0x4b9cc2,null));};exports[_0x0a42('0xba')]=function(_0x2adebc,_0xc6d3fd,_0x5c0627){return db['OpenchannelInteraction'][_0x0a42('0x59')]({'where':{'id':_0x2adebc[_0x0a42('0xab')]['id']}})[_0x0a42('0x20')](handleEntityNotFound(_0xc6d3fd,null))['then'](function(_0x450ee6){if(_0x450ee6){return _0x450ee6[_0x0a42('0xbb')](_0x2adebc[_0x0a42('0x6c')][_0x0a42('0xb3')],_[_0x0a42('0xbc')](_0x2adebc['body'],[_0x0a42('0xb3'),'id'])||{})[_0x0a42('0xbd')](function(){return db[_0x0a42('0x68')][_0x0a42('0xbe')]({'attributes':['id','name',_0x0a42('0x42')],'where':{'id':_0x2adebc[_0x0a42('0x6c')]['ids']}});})[_0x0a42('0x20')](function(_0x450912){socket[_0x0a42('0xbf')](_0x0a42('0xc0'),{'id':Number(_0x2adebc[_0x0a42('0xab')]['id']),'tags':_0x450912||[]});return{'id':Number(_0x2adebc[_0x0a42('0xab')]['id']),'tags':_0x450912||[]};});}})[_0x0a42('0x20')](respondWithResult(_0xc6d3fd,null))[_0x0a42('0x2d')](handleError(_0xc6d3fd,null));};exports[_0x0a42('0xc1')]=function(_0x3cbf3e,_0x5eac8a,_0x3f7787){return db['OpenchannelInteraction']['find']({'where':{'id':_0x3cbf3e[_0x0a42('0xab')]['id']}})[_0x0a42('0x20')](handleEntityNotFound(_0x5eac8a,null))[_0x0a42('0x20')](function(_0x560e9c){if(_0x560e9c){return _0x560e9c[_0x0a42('0xc1')](_0x3cbf3e[_0x0a42('0x34')][_0x0a42('0xb3')]);}})[_0x0a42('0x20')](respondWithStatusCode(_0x5eac8a,null))['catch'](handleError(_0x5eac8a,null));};exports['download']=function(_0x1a0667,_0x56daa0){var _0x49b399=moment()[_0x0a42('0xc2')]()['toString']();var _0x5dc037=path[_0x0a42('0xc3')](config[_0x0a42('0xc4')],_0x0a42('0xc5'),_0x0a42('0xc6'),'tmp');var _0x29b524=path['join'](config[_0x0a42('0xc4')],'server',_0x0a42('0xc6'),_0x0a42('0xc7'));var _0xb7cfce=path[_0x0a42('0xc3')](_0x5dc037,_0x49b399);var _0x1f7487=util[_0x0a42('0xb7')](_0x0a42('0xc8'),_0x1a0667[_0x0a42('0xab')]['id'],_0x49b399);var _0x44e208=path[_0x0a42('0xc3')](_0x5dc037,_0x1f7487);var _0x51cd7d=[];_0x51cd7d['push']({'model':db[_0x0a42('0xc9')],'as':_0x0a42('0xc9'),'attributes':['id',_0x0a42('0x28')],'raw':!![]});_0x51cd7d[_0x0a42('0x2c')]({'model':db[_0x0a42('0xca')],'as':'Contact','attributes':['id','firstName',_0x0a42('0xcb')],'raw':!![]});if(_0x1a0667[_0x0a42('0x34')]['attachments']){_0x51cd7d[_0x0a42('0x2c')]({'model':db[_0x0a42('0xcc')],'as':_0x0a42('0xcc'),'raw':!![]});}var _0x19eabd=[{'model':db[_0x0a42('0xb2')],'as':_0x0a42('0xcd'),'attributes':['id',_0x0a42('0x6c'),'createdAt',_0x0a42('0xce'),'secret',_0x0a42('0x76')],'include':_0x51cd7d}];_0x19eabd[_0x0a42('0x2c')]({'model':db[_0x0a42('0xcf')],'as':_0x0a42('0xd0'),'attributes':['id',_0x0a42('0x25')]});_0x19eabd[_0x0a42('0x2c')]({'model':db[_0x0a42('0xc9')],'as':'Owner','attributes':['id','fullname']});return db['OpenchannelInteraction']['find']({'where':{'id':_0x1a0667[_0x0a42('0xab')]['id']},'include':_0x19eabd})[_0x0a42('0x20')](handleEntityNotFound(_0x56daa0,null))[_0x0a42('0x20')](function(_0x1f082e){if(_0x1f082e){var _0x5b9d8c=_0x1f082e[_0x0a42('0xd1')]({'plain':!![]});fs[_0x0a42('0xd2')](_0xb7cfce);var _0x267633={'channel':_0x0a42('0xd3'),'account':_0x5b9d8c['Account']['name'],'agent':_0x5b9d8c[_0x0a42('0xd4')]?_0x5b9d8c[_0x0a42('0xd4')][_0x0a42('0x28')]:_0x0a42('0xd5'),'createdAt':moment(_0x5b9d8c[_0x0a42('0xd6')])[_0x0a42('0xb7')](_0x0a42('0xb8'))[_0x0a42('0x90')](),'closedAt':_0x5b9d8c[_0x0a42('0xd7')]?moment(_0x5b9d8c[_0x0a42('0xd8')])[_0x0a42('0xb7')](_0x0a42('0xb8'))[_0x0a42('0x90')]():'','disposition':_0x5b9d8c[_0x0a42('0xd9')],'visibility':_0x5b9d8c[_0x0a42('0xda')]?_0x0a42('0xdb'):_0x0a42('0xdc'),'messages':_(_0x5b9d8c[_0x0a42('0xcd')])[_0x0a42('0x7c')]({'secret':![]})[_0x0a42('0x27')](function(_0x7501e9){if(_0x7501e9['Attachment']){var _0x182628=path[_0x0a42('0xc3')](_0x29b524,_0x7501e9[_0x0a42('0xcc')]['basename']);if(fs['existsSync'](_0x182628)){fs[_0x0a42('0xdd')](_0x182628)[_0x0a42('0xde')](fs['createWriteStream'](path[_0x0a42('0xc3')](_0xb7cfce,_0x7501e9[_0x0a42('0xcc')]['basename'])));}}return{'date':moment(_0x7501e9[_0x0a42('0xd6')])[_0x0a42('0xb7')](_0x0a42('0xb8'))[_0x0a42('0x90')](),'sender':_0x7501e9['direction']===_0x0a42('0xdf')?_0x7501e9[_0x0a42('0xc9')]?_0x7501e9[_0x0a42('0xc9')][_0x0a42('0x28')]:_0x0a42('0xe0'):_0x7501e9['Contact']['firstName']+(_0x7501e9[_0x0a42('0x5e')]['lastName']?'\x20'+_0x7501e9[_0x0a42('0x5e')][_0x0a42('0xcb')]:''),'body':_0x7501e9[_0x0a42('0xcc')]?_0x7501e9[_0x0a42('0xcc')]['basename']:_0x7501e9[_0x0a42('0x6c')],'direction':_0x7501e9['direction']===_0x0a42('0xdf')?'A':'C','secret':_0x7501e9['secret'],'read':_0x7501e9['read'],'attachment':_0x7501e9[_0x0a42('0xcc')]};})[_0x0a42('0x5a')]()};return ejs[_0x0a42('0xe1')](path[_0x0a42('0xc3')](config[_0x0a42('0xc4')],_0x0a42('0xc5'),'views',_0x0a42('0xe2')),{'interaction':_0x267633})[_0x0a42('0x20')](function(_0x108b14){var _0x3716e2=path['join'](_0xb7cfce,_0x0a42('0xe3')+_0x5b9d8c['id']+'-'+_0x49b399+_0x0a42('0xe4'));var _0x4ef3ba={'path':_0x3716e2,'channel':_0x0a42('0xd3'),'interactionId':_0x5b9d8c['id']};return pdf[_0x0a42('0xe5')](_0x108b14,_0x4ef3ba);})[_0x0a42('0x20')](function(){return new BPromise(function(_0x159c8a,_0x215fae){zipdir(_0xb7cfce,{'saveTo':_0x44e208},function(_0x41ee48,_0x536491){if(_0x41ee48)return _0x215fae(_0x41ee48);return _0x159c8a(_0x536491);});})[_0x0a42('0x20')](function(){return new BPromise(function(_0x1f711e,_0x1ea7b0){rimraf(_0xb7cfce,function(_0x17874f){if(_0x17874f)_0x1ea7b0(_0x17874f);return _0x1f711e();});});})[_0x0a42('0x20')](function(){return _0x56daa0['download'](_0x44e208,_0x1f7487,function(_0x135703){if(_0x135703){console[_0x0a42('0xe6')]('err',_0x135703);}else{fs[_0x0a42('0xe7')](_0x44e208);}});});});}else{return _0x56daa0[_0x0a42('0x22')](0xc8);}})[_0x0a42('0x2d')](handleError(_0x56daa0,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index feefffd..82485c4 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 _0xb04c=['OpenchannelInteraction','setMaxListeners','update','remove','getUsers','then','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x128281,_0x138d68){var _0x24abee=function(_0x56ac62){while(--_0x56ac62){_0x128281['push'](_0x128281['shift']());}};_0x24abee(++_0x138d68);}(_0xb04c,0xbe));var _0xcb04=function(_0x77e100,_0x1874a2){_0x77e100=_0x77e100-0x0;var _0x17b380=_0xb04c[_0x77e100];return _0x17b380;};'use strict';var EventEmitter=require(_0xcb04('0x0'));var OpenchannelInteraction=require(_0xcb04('0x1'))['db'][_0xcb04('0x2')];var OpenchannelMessage=require('../../mysqldb')['db']['OpenchannelMessage'];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xcb04('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xcb04('0x4'),'afterDestroy':_0xcb04('0x5')};function emitEvent(_0x2994cd){return function(_0x4b98d2,_0x4fa2d5,_0x47ff9e){_0x4b98d2[_0xcb04('0x6')]({'attributes':['id'],'raw':!![]})[_0xcb04('0x7')](function(_0x8f9548){_0x4b98d2['setDataValue']('Users',_0x8f9548['map'](function(_0x328062){return{'id':_0x328062['id']};}));return OpenchannelMessage[_0xcb04('0x8')]({'where':{'OpenchannelInteractionId':_0x4b98d2['id'],'direction':'in','read':![]},'raw':!![]});})[_0xcb04('0x7')](function(_0x1cc806){_0x4b98d2['setDataValue'](_0xcb04('0x9'),_0x1cc806[_0xcb04('0xa')]);OpenchannelInteractionEvents[_0xcb04('0xb')](_0x2994cd+':'+_0x4b98d2['id'],_0x4b98d2);OpenchannelInteractionEvents[_0xcb04('0xb')](_0x2994cd,_0x4b98d2);_0x47ff9e(null);})[_0xcb04('0xc')](_0x47ff9e(null));};}for(var e in events){if(events[_0xcb04('0xd')](e)){var event=events[e];OpenchannelInteraction[_0xcb04('0xe')](e,emitEvent(event));}}module[_0xcb04('0xf')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xc81a=['unreadMessages','length','emit','catch','hook','events','../../mysqldb','OpenchannelMessage','setMaxListeners','update','remove','then','setDataValue'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xc81a,0x1e6));var _0xac81=function(_0x5d5211,_0xcf5b58){_0x5d5211=_0x5d5211-0x0;var _0x4abe9c=_0xc81a[_0x5d5211];return _0x4abe9c;};'use strict';var EventEmitter=require(_0xac81('0x0'));var OpenchannelInteraction=require(_0xac81('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xac81('0x1'))['db'][_0xac81('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xac81('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xac81('0x4'),'afterDestroy':_0xac81('0x5')};function emitEvent(_0x961735){return function(_0x407d81,_0x577004,_0x50e281){_0x407d81['getUsers']({'attributes':['id'],'raw':!![]})[_0xac81('0x6')](function(_0xf59d82){_0x407d81['setDataValue']('Users',_0xf59d82['map'](function(_0x4763c2){return{'id':_0x4763c2['id']};}));return OpenchannelMessage['findAll']({'where':{'OpenchannelInteractionId':_0x407d81['id'],'direction':'in','read':![]},'raw':!![]});})[_0xac81('0x6')](function(_0x1ad4b9){_0x407d81[_0xac81('0x7')](_0xac81('0x8'),_0x1ad4b9[_0xac81('0x9')]);OpenchannelInteractionEvents[_0xac81('0xa')](_0x961735+':'+_0x407d81['id'],_0x407d81);OpenchannelInteractionEvents[_0xac81('0xa')](_0x961735,_0x407d81);_0x50e281(null);})[_0xac81('0xb')](_0x50e281(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelInteraction[_0xac81('0xc')](e,emitEvent(event));}}module['exports']=OpenchannelInteractionEvents; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.model.js b/server/api/openchannelInteraction/openchannelInteraction.model.js index 63b1836..3e41e8d 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 _0x3ee2=['path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','define','openchannel_interactions','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x3ee2,0x18a));var _0x23ee=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x3ee2[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x23ee('0x0'));var util=require(_0x23ee('0x1'));var logger=require(_0x23ee('0x2'))(_0x23ee('0x3'));var moment=require(_0x23ee('0x4'));var BPromise=require(_0x23ee('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x23ee('0x6'));var rimraf=require(_0x23ee('0x7'));var config=require(_0x23ee('0x8'));var attributes=require(_0x23ee('0x9'));module[_0x23ee('0xa')]=function(_0x3909b5,_0x87e51e){return _0x3909b5[_0x23ee('0xb')]('OpenchannelInteraction',attributes,{'tableName':_0x23ee('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x20f8f0,_0x567c17,_0x969c1e){if(_0x20f8f0['changed'](_0x23ee('0xd'))){_0x20f8f0['closedAt']=moment()[_0x23ee('0xe')](_0x23ee('0xf'));}_0x969c1e(null,_0x20f8f0);}}});}; \ No newline at end of file +var _0xe866=['../../config/logger','api','moment','bluebird','request-promise','./openchannelInteraction.attributes','exports','OpenchannelInteraction','openchannel_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','util'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xe866,0x7d));var _0x6e86=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xe866[_0x2641f9];return _0x585741;};'use strict';var _=require('lodash');var util=require(_0x6e86('0x0'));var logger=require(_0x6e86('0x1'))(_0x6e86('0x2'));var moment=require(_0x6e86('0x3'));var BPromise=require(_0x6e86('0x4'));var rp=require(_0x6e86('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6e86('0x6'));module[_0x6e86('0x7')]=function(_0x2dc8a5,_0x3de1a1){return _0x2dc8a5['define'](_0x6e86('0x8'),attributes,{'tableName':_0x6e86('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xaba8de,_0x4ce143,_0x203e3f){if(_0xaba8de[_0x6e86('0xa')](_0x6e86('0xb'))){_0xaba8de['closedAt']=moment()[_0x6e86('0xc')](_0x6e86('0xd'));}_0x203e3f(null,_0xaba8de);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 3b09c46..5bae390 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 _0xc919=['info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','update','options','raw','attributes','limit','debug','AddTagsToOpenchannelInteraction','find','where','body','ids','omit','spread','AddTags','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','redis','localhost','./openchannelInteraction.socket','register','then'];(function(_0x588455,_0x8b06b6){var _0x5ab868=function(_0x13fe5d){while(--_0x13fe5d){_0x588455['push'](_0x588455['shift']());}};_0x5ab868(++_0x8b06b6);}(_0xc919,0xb5));var _0x9c91=function(_0x27b9b4,_0xd7f873){_0x27b9b4=_0x27b9b4-0x0;var _0xbb486=_0xc919[_0x27b9b4];return _0xbb486;};'use strict';var _=require(_0x9c91('0x0'));var util=require('util');var moment=require(_0x9c91('0x1'));var BPromise=require(_0x9c91('0x2'));var rs=require(_0x9c91('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9c91('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x9c91('0x5'))(_0x9c91('0x6'));var config=require(_0x9c91('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x9c91('0x8')]['http']({'port':0x232a});config[_0x9c91('0x9')]=_['defaults'](config[_0x9c91('0x9')],{'host':_0x9c91('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9c91('0x9')]));require(_0x9c91('0xb'))[_0x9c91('0xc')](socket);function respondWithRpcPromise(_0x5270f9,_0x2628b0,_0x3d6488){return new BPromise(function(_0x56dbe4,_0x308092){return client['request'](_0x5270f9,_0x3d6488)[_0x9c91('0xd')](function(_0x323fe5){logger[_0x9c91('0xe')](_0x9c91('0xf'),_0x2628b0,_0x9c91('0x10'));logger['debug'](_0x9c91('0x11'),_0x2628b0,'request\x20sent',JSON[_0x9c91('0x12')](_0x323fe5));if(_0x323fe5['error']){if(_0x323fe5[_0x9c91('0x13')][_0x9c91('0x14')]===0x1f4){logger[_0x9c91('0x13')](_0x9c91('0xf'),_0x2628b0,_0x323fe5[_0x9c91('0x13')][_0x9c91('0x15')]);return _0x308092(_0x323fe5['error'][_0x9c91('0x15')]);}logger[_0x9c91('0x13')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2628b0,_0x323fe5[_0x9c91('0x13')][_0x9c91('0x15')]);return _0x56dbe4(_0x323fe5[_0x9c91('0x13')][_0x9c91('0x15')]);}else{logger[_0x9c91('0xe')](_0x9c91('0xf'),_0x2628b0,_0x9c91('0x10'));_0x56dbe4(_0x323fe5['result'][_0x9c91('0x15')]);}})[_0x9c91('0x16')](function(_0x5021be){logger[_0x9c91('0x13')](_0x9c91('0xf'),_0x2628b0,_0x5021be);_0x308092(_0x5021be);});});}exports[_0x9c91('0x17')]=function(_0x455f37){var _0x1e6e81=this;return new Promise(function(_0xbb2293,_0x592c64){return db[_0x9c91('0x18')][_0x9c91('0x19')](_0x455f37['body'],{'raw':_0x455f37[_0x9c91('0x1a')]?_0x455f37['options'][_0x9c91('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x455f37[_0x9c91('0x1a')]?_0x455f37[_0x9c91('0x1a')]['where']||null:null,'attributes':_0x455f37['options']?_0x455f37[_0x9c91('0x1a')][_0x9c91('0x1c')]||null:null,'limit':_0x455f37[_0x9c91('0x1a')]?_0x455f37[_0x9c91('0x1a')][_0x9c91('0x1d')]||null:null})[_0x9c91('0xd')](function(_0xbc3e3f){logger[_0x9c91('0xe')](_0x9c91('0x17'),_0x455f37);logger[_0x9c91('0x1e')](_0x9c91('0x17'),_0x455f37,JSON[_0x9c91('0x12')](_0xbc3e3f));_0xbb2293(_0xbc3e3f);})['catch'](function(_0x2ddbc9){logger['error']('UpdateOpenchannelInteraction',_0x2ddbc9[_0x9c91('0x15')],_0x455f37);_0x592c64(_0x1e6e81[_0x9c91('0x13')](0x1f4,_0x2ddbc9[_0x9c91('0x15')]));});});};exports[_0x9c91('0x1f')]=function(_0x3a5bc0){return new Promise(function(_0x8baf37,_0x11091f){return db[_0x9c91('0x18')][_0x9c91('0x20')]({'where':_0x3a5bc0['options']?_0x3a5bc0['options'][_0x9c91('0x21')]||null:null})['then'](function(_0x24dabc){if(_0x24dabc){return _0x24dabc['addTags'](_0x3a5bc0[_0x9c91('0x22')][_0x9c91('0x23')],_[_0x9c91('0x24')](_0x3a5bc0[_0x9c91('0x22')],[_0x9c91('0x23'),'id'])||{});}})[_0x9c91('0x25')](function(_0x213f8b){logger[_0x9c91('0xe')](_0x9c91('0x26'),_0x3a5bc0);logger['debug'](_0x9c91('0x26'),_0x3a5bc0,JSON[_0x9c91('0x12')](_0x213f8b));_0x8baf37(_0x213f8b);})[_0x9c91('0x16')](function(_0x41bd3d){logger[_0x9c91('0x13')](_0x9c91('0x26'),_0x41bd3d[_0x9c91('0x15')],_0x3a5bc0);_0x11091f(_this[_0x9c91('0x13')](0x1f4,_0x41bd3d['message']));});});}; \ No newline at end of file +var _0x4d16=['omit','AddTags','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','OpenchannelInteraction','options','raw','where','limit','then','UpdateOpenchannelInteraction','AddTagsToOpenchannelInteraction','find','addTags','body','ids'];(function(_0x4d6663,_0x3747ec){var _0x1a8fd0=function(_0x4de9db){while(--_0x4de9db){_0x4d6663['push'](_0x4d6663['shift']());}};_0x1a8fd0(++_0x3747ec);}(_0x4d16,0x9a));var _0x64d1=function(_0x17af72,_0x549718){_0x17af72=_0x17af72-0x0;var _0x535afe=_0x4d16[_0x17af72];return _0x535afe;};'use strict';var _=require(_0x64d1('0x0'));var util=require(_0x64d1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x64d1('0x2'));var fs=require('fs');var Redis=require(_0x64d1('0x3'));var db=require(_0x64d1('0x4'))['db'];var utils=require(_0x64d1('0x5'));var logger=require(_0x64d1('0x6'))(_0x64d1('0x7'));var config=require(_0x64d1('0x8'));var jayson=require(_0x64d1('0x9'));var client=jayson['client'][_0x64d1('0xa')]({'port':0x232a});config[_0x64d1('0xb')]=_[_0x64d1('0xc')](config[_0x64d1('0xb')],{'host':_0x64d1('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x64d1('0xb')]));require('./openchannelInteraction.socket')[_0x64d1('0xe')](socket);function respondWithRpcPromise(_0x3ea72b,_0x2134ea,_0x14a602){return new BPromise(function(_0x5b3e43,_0x1446ea){return client['request'](_0x3ea72b,_0x14a602)['then'](function(_0x297e6e){logger[_0x64d1('0xf')](_0x64d1('0x10'),_0x2134ea,'request\x20sent');logger[_0x64d1('0x11')](_0x64d1('0x12'),_0x2134ea,'request\x20sent',JSON[_0x64d1('0x13')](_0x297e6e));if(_0x297e6e[_0x64d1('0x14')]){if(_0x297e6e[_0x64d1('0x14')][_0x64d1('0x15')]===0x1f4){logger[_0x64d1('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x2134ea,_0x297e6e[_0x64d1('0x14')][_0x64d1('0x16')]);return _0x1446ea(_0x297e6e[_0x64d1('0x14')][_0x64d1('0x16')]);}logger['error'](_0x64d1('0x10'),_0x2134ea,_0x297e6e[_0x64d1('0x14')]['message']);return _0x5b3e43(_0x297e6e[_0x64d1('0x14')][_0x64d1('0x16')]);}else{logger[_0x64d1('0xf')](_0x64d1('0x10'),_0x2134ea,'request\x20sent');_0x5b3e43(_0x297e6e[_0x64d1('0x17')][_0x64d1('0x16')]);}})['catch'](function(_0x42eb50){logger[_0x64d1('0x14')](_0x64d1('0x10'),_0x2134ea,_0x42eb50);_0x1446ea(_0x42eb50);});});}exports['UpdateOpenchannelInteraction']=function(_0x35d51b){var _0x8b85ad=this;return new Promise(function(_0x18885b,_0x237073){return db[_0x64d1('0x18')]['update'](_0x35d51b['body'],{'raw':_0x35d51b[_0x64d1('0x19')]?_0x35d51b[_0x64d1('0x19')][_0x64d1('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x35d51b[_0x64d1('0x19')]?_0x35d51b[_0x64d1('0x19')][_0x64d1('0x1b')]||null:null,'attributes':_0x35d51b[_0x64d1('0x19')]?_0x35d51b['options']['attributes']||null:null,'limit':_0x35d51b[_0x64d1('0x19')]?_0x35d51b['options'][_0x64d1('0x1c')]||null:null})[_0x64d1('0x1d')](function(_0x3c3785){logger[_0x64d1('0xf')](_0x64d1('0x1e'),_0x35d51b);logger[_0x64d1('0x11')](_0x64d1('0x1e'),_0x35d51b,JSON[_0x64d1('0x13')](_0x3c3785));_0x18885b(_0x3c3785);})['catch'](function(_0x1768e3){logger[_0x64d1('0x14')](_0x64d1('0x1e'),_0x1768e3[_0x64d1('0x16')],_0x35d51b);_0x237073(_0x8b85ad[_0x64d1('0x14')](0x1f4,_0x1768e3[_0x64d1('0x16')]));});});};exports[_0x64d1('0x1f')]=function(_0x268085){return new Promise(function(_0x5c5bf8,_0x2b9311){return db[_0x64d1('0x18')][_0x64d1('0x20')]({'where':_0x268085['options']?_0x268085['options'][_0x64d1('0x1b')]||null:null})['then'](function(_0x213605){if(_0x213605){return _0x213605[_0x64d1('0x21')](_0x268085[_0x64d1('0x22')][_0x64d1('0x23')],_[_0x64d1('0x24')](_0x268085[_0x64d1('0x22')],['ids','id'])||{});}})['spread'](function(_0x2a9d7d){logger[_0x64d1('0xf')](_0x64d1('0x25'),_0x268085);logger[_0x64d1('0x11')](_0x64d1('0x25'),_0x268085,JSON[_0x64d1('0x13')](_0x2a9d7d));_0x5c5bf8(_0x2a9d7d);})['catch'](function(_0x4c0cd3){logger[_0x64d1('0x14')](_0x64d1('0x25'),_0x4c0cd3['message'],_0x268085);_0x2b9311(_this['error'](0x1f4,_0x4c0cd3[_0x64d1('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 69d37fd..6ac0435 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 _0xee49=['register','length','./openchannelInteraction.events','save','remove','update'];(function(_0x1e9ac0,_0x554574){var _0x40ce36=function(_0x286fcf){while(--_0x286fcf){_0x1e9ac0['push'](_0x1e9ac0['shift']());}};_0x40ce36(++_0x554574);}(_0xee49,0x6e));var _0x9ee4=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xee49[_0x4bfac3];return _0x15f0f2;};'use strict';var OpenchannelInteractionEvents=require(_0x9ee4('0x0'));var events=[_0x9ee4('0x1'),_0x9ee4('0x2'),_0x9ee4('0x3')];function createListener(_0x238cc3,_0xa195bc){return function(_0xf791dc){_0xa195bc['emit'](_0x238cc3,_0xf791dc);};}function removeListener(_0x49b3d6,_0x5b48f2){return function(){OpenchannelInteractionEvents['removeListener'](_0x49b3d6,_0x5b48f2);};}exports[_0x9ee4('0x4')]=function(_0x46e4e9){for(var _0x45fa98=0x0,_0x323f7c=events[_0x9ee4('0x5')];_0x45fa98<_0x323f7c;_0x45fa98++){var _0x3d55bb=events[_0x45fa98];var _0x163aac=createListener('openchannelInteraction:'+_0x3d55bb,_0x46e4e9);OpenchannelInteractionEvents['on'](_0x3d55bb,_0x163aac);}}; \ No newline at end of file +var _0x3d9b=['removeListener','length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','emit'];(function(_0x293866,_0x33ab3e){var _0x4b33c8=function(_0x26a041){while(--_0x26a041){_0x293866['push'](_0x293866['shift']());}};_0x4b33c8(++_0x33ab3e);}(_0x3d9b,0xe3));var _0xb3d9=function(_0x167ab2,_0x45b8ab){_0x167ab2=_0x167ab2-0x0;var _0x408a5d=_0x3d9b[_0x167ab2];return _0x408a5d;};'use strict';var OpenchannelInteractionEvents=require(_0xb3d9('0x0'));var events=[_0xb3d9('0x1'),_0xb3d9('0x2'),_0xb3d9('0x3')];function createListener(_0x168db4,_0xa46ce3){return function(_0x4012e6){_0xa46ce3[_0xb3d9('0x4')](_0x168db4,_0x4012e6);};}function removeListener(_0x1335c2,_0x2541fc){return function(){OpenchannelInteractionEvents[_0xb3d9('0x5')](_0x1335c2,_0x2541fc);};}exports['register']=function(_0xbf6a5a){for(var _0x148bfe=0x0,_0x8fe717=events[_0xb3d9('0x6')];_0x148bfe<_0x8fe717;_0x148bfe++){var _0xa27f90=events[_0x148bfe];var _0x4f2592=createListener(_0xb3d9('0x7')+_0xa27f90,_0xbf6a5a);OpenchannelInteractionEvents['on'](_0xa27f90,_0x4f2592);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 188c55b..e62284f 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x428521,_0x331516){var _0x1215e3=function(_0x266759){while(--_0x266759){_0x428521['push'](_0x428521['shift']());}};_0x1215e3(++_0x331516);}(_0xe706,0xa3));var _0x6e70=function(_0x2831cf,_0x24babf){_0x2831cf=_0x2831cf-0x0;var _0x5ec206=_0xe706[_0x2831cf];return _0x5ec206;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x190328,_0x49ad87){var _0x58394f=function(_0x418b0a){while(--_0x418b0a){_0x190328['push'](_0x190328['shift']());}};_0x58394f(++_0x49ad87);}(_0xe706,0xa3));var _0x6e70=function(_0x2b559d,_0x1b3307){_0x2b559d=_0x2b559d-0x0;var _0x25d03a=_0xe706[_0x2b559d];return _0x25d03a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 21fca1e..0532d0c 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 _0xa7fa=['out','DATE','STRING','TEXT','sequelize','medium','BOOLEAN','ENUM'];(function(_0x4cb32a,_0x20b9a1){var _0x5c9d47=function(_0x19ffdf){while(--_0x19ffdf){_0x4cb32a['push'](_0x4cb32a['shift']());}};_0x5c9d47(++_0x20b9a1);}(_0xa7fa,0xfc));var _0xaa7f=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xa7fa[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0xaa7f('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0xaa7f('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0xaa7f('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0xaa7f('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0xaa7f('0x3')]('in','out'),'defaultValue':_0xaa7f('0x4'),'allowNull':![]},'readAt':{'type':Sequelize[_0xaa7f('0x5')]},'providerName':{'type':Sequelize[_0xaa7f('0x6')]},'providerResponse':{'type':Sequelize[_0xaa7f('0x7')]}}; \ No newline at end of file +var _0xb4f4=['STRING','TEXT','sequelize','exports','medium','BOOLEAN','ENUM','out','DATE'];(function(_0x14697a,_0x3a9a32){var _0x107920=function(_0x30f746){while(--_0x30f746){_0x14697a['push'](_0x14697a['shift']());}};_0x107920(++_0x3a9a32);}(_0xb4f4,0xda));var _0x4b4f=function(_0x4dc7b9,_0x319d5a){_0x4dc7b9=_0x4dc7b9-0x0;var _0x3ab114=_0xb4f4[_0x4dc7b9];return _0x3ab114;};'use strict';var Sequelize=require(_0x4b4f('0x0'));module[_0x4b4f('0x1')]={'body':{'type':Sequelize['TEXT'](_0x4b4f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x4b4f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x4b4f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x4b4f('0x4')]('in','out'),'defaultValue':_0x4b4f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize[_0x4b4f('0x6')]},'providerName':{'type':Sequelize[_0x4b4f('0x7')]},'providerResponse':{'type':Sequelize[_0x4b4f('0x8')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 397bd64..d68222e 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 _0xe24c=['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','register','jayson/promise','http','then','info','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','status','json','offset','limit','count','set','Content-Range','apply','reject','update','end','sendStatus','stack','name','send','map','OpenchannelMessage','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','options','find','create','body','params','destroy','openchannel-interactions','accept','read','readAt','format','UserId','user','agent','get','isNil','YYYY-MM-DD\x20HH:mm:ss','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','interaction','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','User','internal','manual','interface','channel','event','EventManager','acceptmessage','openchannel','OpenchannelInteraction','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','QueryTypes','SELECT','fullname','email','SIP/%s','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring'];(function(_0x32b220,_0x555514){var _0x1bc67c=function(_0x585b73){while(--_0x585b73){_0x32b220['push'](_0x32b220['shift']());}};_0x1bc67c(++_0x555514);}(_0xe24c,0x70));var _0xce24=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xe24c[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0xce24('0x0'));var rimraf=require(_0xce24('0x1'));var zipdir=require(_0xce24('0x2'));var jsonpatch=require(_0xce24('0x3'));var rp=require(_0xce24('0x4'));var moment=require(_0xce24('0x5'));var BPromise=require(_0xce24('0x6'));var Mustache=require(_0xce24('0x7'));var util=require(_0xce24('0x8'));var path=require(_0xce24('0x9'));var sox=require('sox');var csv=require(_0xce24('0xa'));var ejs=require(_0xce24('0xb'));var fs=require('fs');var fs_extra=require(_0xce24('0xc'));var _=require(_0xce24('0xd'));var squel=require(_0xce24('0xe'));var crypto=require('crypto');var jsforce=require(_0xce24('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xce24('0xa'));var querystring=require(_0xce24('0x10'));var Papa=require('papaparse');var Redis=require(_0xce24('0x11'));var authService=require(_0xce24('0x12'));var qs=require(_0xce24('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xce24('0x14'));var logger=require(_0xce24('0x15'))(_0xce24('0x16'));var utils=require(_0xce24('0x17'));var config=require(_0xce24('0x18'));var licenseUtil=require(_0xce24('0x19'));var db=require(_0xce24('0x1a'))['db'];config['redis']=_[_0xce24('0x1b')](config[_0xce24('0x1c')],{'host':_0xce24('0x1d'),'port':0x18eb});var socket=require(_0xce24('0x1e'))(new Redis(config[_0xce24('0x1c')]));require('./openchannelMessage.socket')[_0xce24('0x1f')](socket);var jayson=require(_0xce24('0x20'));var client=jayson['client'][_0xce24('0x21')]({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2abe90,_0x471dc3,_0x2f4768,_0x4dbc92){return new BPromise(function(_0x10ccfd,_0x28679f){var _0x386e0a=_0x4dbc92||client;return _0x386e0a['request'](_0x2abe90,_0x2f4768)[_0xce24('0x22')](function(_0x4dd685){logger[_0xce24('0x23')](_0xce24('0x24'),_0x471dc3,_0xce24('0x25'));logger[_0xce24('0x26')](_0xce24('0x27'),_0x471dc3,_0xce24('0x25'),JSON[_0xce24('0x28')](_0x4dd685));if(_0x4dd685[_0xce24('0x29')]){if(_0x4dd685['error'][_0xce24('0x2a')]===0x1f4){logger[_0xce24('0x29')](_0xce24('0x24'),_0x471dc3,_0x4dd685[_0xce24('0x29')][_0xce24('0x2b')]);return _0x28679f(_0x4dd685[_0xce24('0x29')][_0xce24('0x2b')]);}logger[_0xce24('0x29')](_0xce24('0x24'),_0x471dc3,_0x4dd685[_0xce24('0x29')][_0xce24('0x2b')]);return _0x10ccfd(_0x4dd685[_0xce24('0x29')][_0xce24('0x2b')]);}else{logger[_0xce24('0x23')](_0xce24('0x24'),_0x471dc3,_0xce24('0x25'));_0x10ccfd(_0x4dd685['result']['message']);}})[_0xce24('0x2c')](function(_0x1073a7){logger[_0xce24('0x29')](_0xce24('0x24'),_0x471dc3,_0x1073a7);_0x28679f(_0x1073a7);});});}function respondWithStatusCode(_0x47a398,_0x1d713f){_0x1d713f=_0x1d713f||0xcc;return function(_0x11da20){if(_0x11da20){return _0x47a398['sendStatus'](_0x1d713f);}return _0x47a398[_0xce24('0x2d')](_0x1d713f)['end']();};}function respondWithResult(_0xf31605,_0x371a62){_0x371a62=_0x371a62||0xc8;return function(_0x11d88c){if(_0x11d88c){return _0xf31605[_0xce24('0x2d')](_0x371a62)[_0xce24('0x2e')](_0x11d88c);}};}function respondWithFilteredResult(_0x727c44,_0x2e2ace){return function(_0x28e79b){if(_0x28e79b){var _0x4fa86b=typeof _0x2e2ace[_0xce24('0x2f')]==='undefined'&&typeof _0x2e2ace[_0xce24('0x30')]==='undefined';var _0x282680=_0x28e79b['count'];var _0x2592a1=_0x4fa86b?0x0:_0x2e2ace['offset'];var _0x34bc5c=_0x4fa86b?_0x28e79b[_0xce24('0x31')]:_0x2e2ace['offset']+_0x2e2ace[_0xce24('0x30')];var _0x1dfdb4;if(_0x34bc5c>=_0x282680){_0x34bc5c=_0x282680;_0x1dfdb4=0xc8;}else{_0x1dfdb4=0xce;}_0x727c44['status'](_0x1dfdb4);return _0x727c44[_0xce24('0x32')](_0xce24('0x33'),_0x2592a1+'-'+_0x34bc5c+'/'+_0x282680)[_0xce24('0x2e')](_0x28e79b);}return null;};}function patchUpdates(_0x24631e){return function(_0x3a060c){try{jsonpatch[_0xce24('0x34')](_0x3a060c,_0x24631e,!![]);}catch(_0x4ab48b){return BPromise[_0xce24('0x35')](_0x4ab48b);}return _0x3a060c['save']();};}function saveUpdates(_0x409222,_0x5978a5){return function(_0x39f18d){if(_0x39f18d){return _0x39f18d[_0xce24('0x36')](_0x409222)['then'](function(_0x5544ac){return _0x5544ac;});}return null;};}function removeEntity(_0x117cf2,_0xafa666){return function(_0x23373a){if(_0x23373a){return _0x23373a['destroy']()[_0xce24('0x22')](function(){_0x117cf2[_0xce24('0x2d')](0xcc)[_0xce24('0x37')]();});}};}function handleEntityNotFound(_0x25304f,_0x2e8986){return function(_0x51db84){if(!_0x51db84){_0x25304f[_0xce24('0x38')](0x194);}return _0x51db84;};}function handleError(_0x13de57,_0x1b8a06){_0x1b8a06=_0x1b8a06||0x1f4;return function(_0x2ed709){logger[_0xce24('0x29')](_0x2ed709[_0xce24('0x39')]);if(_0x2ed709[_0xce24('0x3a')]){delete _0x2ed709['name'];}_0x13de57[_0xce24('0x2d')](_0x1b8a06)[_0xce24('0x3b')](_0x2ed709);};}exports['index']=function(_0x2d3b1d,_0x4439fd){var _0x50f41c={},_0x1bff8c={},_0x3289ed={'count':0x0,'rows':[]};var _0x1435e2=_[_0xce24('0x3c')](db[_0xce24('0x3d')][_0xce24('0x3e')],function(_0x5e0244){return{'name':_0x5e0244['fieldName'],'type':_0x5e0244[_0xce24('0x3f')][_0xce24('0x40')]};});_0x1bff8c[_0xce24('0x41')]=_['map'](_0x1435e2,_0xce24('0x3a'));_0x1bff8c[_0xce24('0x42')]=_[_0xce24('0x43')](_0x2d3b1d[_0xce24('0x42')]);_0x1bff8c[_0xce24('0x44')]=_['intersection'](_0x1bff8c[_0xce24('0x41')],_0x1bff8c[_0xce24('0x42')]);_0x50f41c[_0xce24('0x45')]=_[_0xce24('0x46')](_0x1bff8c[_0xce24('0x41')],qs['fields'](_0x2d3b1d[_0xce24('0x42')][_0xce24('0x47')]));_0x50f41c[_0xce24('0x45')]=_0x50f41c[_0xce24('0x45')][_0xce24('0x48')]?_0x50f41c[_0xce24('0x45')]:_0x1bff8c[_0xce24('0x41')];if(!_0x2d3b1d['query'][_0xce24('0x49')](_0xce24('0x4a'))){_0x50f41c[_0xce24('0x30')]=qs['limit'](_0x2d3b1d[_0xce24('0x42')]['limit']);_0x50f41c[_0xce24('0x2f')]=qs['offset'](_0x2d3b1d['query'][_0xce24('0x2f')]);}_0x50f41c['order']=qs['sort'](_0x2d3b1d['query']['sort']);_0x50f41c[_0xce24('0x4b')]=qs[_0xce24('0x44')](_[_0xce24('0x4c')](_0x2d3b1d[_0xce24('0x42')],_0x1bff8c['filters']),_0x1435e2);if(_0x2d3b1d[_0xce24('0x42')][_0xce24('0x4d')]){_0x50f41c[_0xce24('0x4b')]=_['merge'](_0x50f41c[_0xce24('0x4b')],{'$or':_['map'](_0x1435e2,function(_0x2e5b6c){if(_0x2e5b6c['type']!==_0xce24('0x4e')){var _0x13eb34={};_0x13eb34[_0x2e5b6c[_0xce24('0x3a')]]={'$like':'%'+_0x2d3b1d[_0xce24('0x42')][_0xce24('0x4d')]+'%'};return _0x13eb34;}})});}_0x50f41c=_[_0xce24('0x4f')]({},_0x50f41c,_0x2d3b1d['options']);var _0x2ab6a9={'where':_0x50f41c[_0xce24('0x4b')]};return db[_0xce24('0x3d')][_0xce24('0x31')](_0x2ab6a9)[_0xce24('0x22')](function(_0x5cb14f){_0x3289ed[_0xce24('0x31')]=_0x5cb14f;if(_0x2d3b1d[_0xce24('0x42')][_0xce24('0x50')]){_0x50f41c[_0xce24('0x51')]=[{'all':!![]}];}return db[_0xce24('0x3d')][_0xce24('0x52')](_0x50f41c);})['then'](function(_0x5dc0b1){_0x3289ed[_0xce24('0x53')]=_0x5dc0b1;return _0x3289ed;})[_0xce24('0x22')](respondWithFilteredResult(_0x4439fd,_0x50f41c))[_0xce24('0x2c')](handleError(_0x4439fd,null));};exports['show']=function(_0x145360,_0x37856d){var _0x444a70={'raw':!![],'where':{'id':_0x145360['params']['id']}},_0x5e032e={};_0x5e032e[_0xce24('0x41')]=_[_0xce24('0x43')](db[_0xce24('0x3d')][_0xce24('0x3e')]);_0x5e032e[_0xce24('0x42')]=_[_0xce24('0x43')](_0x145360[_0xce24('0x42')]);_0x5e032e[_0xce24('0x44')]=_[_0xce24('0x46')](_0x5e032e[_0xce24('0x41')],_0x5e032e['query']);_0x444a70[_0xce24('0x45')]=_['intersection'](_0x5e032e[_0xce24('0x41')],qs['fields'](_0x145360[_0xce24('0x42')][_0xce24('0x47')]));_0x444a70[_0xce24('0x45')]=_0x444a70[_0xce24('0x45')]['length']?_0x444a70['attributes']:_0x5e032e[_0xce24('0x41')];if(_0x145360['query'][_0xce24('0x50')]){_0x444a70[_0xce24('0x51')]=[{'all':!![]}];}_0x444a70=_[_0xce24('0x4f')]({},_0x444a70,_0x145360[_0xce24('0x54')]);return db['OpenchannelMessage'][_0xce24('0x55')](_0x444a70)[_0xce24('0x22')](handleEntityNotFound(_0x37856d,null))[_0xce24('0x22')](respondWithResult(_0x37856d,null))[_0xce24('0x2c')](handleError(_0x37856d,null));};exports[_0xce24('0x56')]=function(_0x217e0f,_0x174203){return db[_0xce24('0x3d')]['create'](_0x217e0f[_0xce24('0x57')],{})[_0xce24('0x22')](respondWithResult(_0x174203,0xc9))['catch'](handleError(_0x174203,null));};exports['update']=function(_0x5a2e35,_0x3dfae3){if(_0x5a2e35[_0xce24('0x57')]['id']){delete _0x5a2e35[_0xce24('0x57')]['id'];}return db[_0xce24('0x3d')]['find']({'where':{'id':_0x5a2e35[_0xce24('0x58')]['id']}})[_0xce24('0x22')](handleEntityNotFound(_0x3dfae3,null))[_0xce24('0x22')](saveUpdates(_0x5a2e35[_0xce24('0x57')],null))[_0xce24('0x22')](respondWithResult(_0x3dfae3,null))[_0xce24('0x2c')](handleError(_0x3dfae3,null));};exports[_0xce24('0x59')]=function(_0x4861f2,_0x3b2f93){return db[_0xce24('0x3d')][_0xce24('0x55')]({'where':{'id':_0x4861f2['params']['id']}})[_0xce24('0x22')](handleEntityNotFound(_0x3b2f93,null))[_0xce24('0x22')](removeEntity(_0x3b2f93,null))[_0xce24('0x2c')](handleError(_0x3b2f93,null));};exports['describe']=function(_0x4fe6bb,_0x1815b0){return db['OpenchannelMessage']['describe']()['then'](respondWithResult(_0x1815b0,null))['catch'](handleError(_0x1815b0,null));};var interaction_log=require(_0xce24('0x15'))(_0xce24('0x5a'));exports[_0xce24('0x5b')]=function(_0x58fbe8,_0x46b54d,_0x27bea8){var _0x3be808={'agent':{},'channel':'openchannel'};if(_0x58fbe8['body']['id']){delete _0x58fbe8[_0xce24('0x57')]['id'];}_0x58fbe8[_0xce24('0x57')][_0xce24('0x5c')]=!![];_0x58fbe8[_0xce24('0x57')][_0xce24('0x5d')]=moment()[_0xce24('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x58fbe8[_0xce24('0x57')]['UserId']=_0x58fbe8[_0xce24('0x57')][_0xce24('0x5f')]||_0x58fbe8[_0xce24('0x60')]['id'];_0x3be808[_0xce24('0x61')]['id']=_0x58fbe8[_0xce24('0x57')]['UserId'];return db[_0xce24('0x3d')][_0xce24('0x55')]({'where':{'id':_0x58fbe8['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x46b54d,null))[_0xce24('0x22')](saveUpdates(_0x58fbe8[_0xce24('0x57')],null))[_0xce24('0x22')](function(_0x55fb1a){if(_0x55fb1a){_0x3be808[_0xce24('0x2b')]=_0x55fb1a[_0xce24('0x62')]({'plain':!![]});return db['OpenchannelInteraction'][_0xce24('0x55')]({'where':{'id':_0x55fb1a['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x46b54d,null))['then'](function(_0x28f930){if(_0x28f930){return _0x28f930['update']({'UserId':_0x58fbe8[_0xce24('0x57')][_0xce24('0x5f')],'read1stAt':_[_0xce24('0x63')](_0x28f930['read1stAt'])?moment()[_0xce24('0x5e')](_0xce24('0x64')):undefined});}return null;})[_0xce24('0x22')](function(_0x25248a){if(_0x25248a){_0x3be808['interaction']=_0x25248a['get']({'plain':!![]});interaction_log[_0xce24('0x23')](_0xce24('0x65'),_0x58fbe8[_0xce24('0x60')]['id'],_0x58fbe8[_0xce24('0x60')][_0xce24('0x3a')],_0x58fbe8[_0xce24('0x60')][_0xce24('0x66')],_0x3be808[_0xce24('0x67')]['id'],_0x58fbe8[_0xce24('0x57')]?JSON['stringify'](_0x58fbe8[_0xce24('0x57')]):_0xce24('0x68'));return respondWithRpcPromise('AcceptMessage',_0xce24('0x69'),_0x3be808);}return null;})['then'](function(_0x11bd18){var _0x2aae47=_0xce24('0x6a')+_0x11bd18[_0xce24('0x2b')][_0xce24('0x6b')];return db[_0xce24('0x6c')][_0xce24('0x42')](_0x2aae47,{'type':db[_0xce24('0x6d')]['QueryTypes']['SELECT'],'raw':!![]})[_0xce24('0x22')](function(_0xfce9f5){return _0xfce9f5;});})[_0xce24('0x22')](function(_0x441a9b){if(_0x441a9b){_0x3be808['message']['contact']=_0x441a9b[0x0];if(!_0x58fbe8[_0xce24('0x57')][_0xce24('0x5f')])return;return db[_0xce24('0x6e')]['find']({'where':{'id':_0x58fbe8[_0xce24('0x57')]['UserId'],'role':_0xce24('0x61')},'attributes':['id',_0xce24('0x3a'),'fullname','email',_0xce24('0x6f')],'raw':!![]});}return null;})[_0xce24('0x22')](function(_0x347dcf){if(!_0x347dcf)return null;_0x3be808[_0xce24('0x2b')]['agent']=_0x347dcf;return _0x3be808;})[_0xce24('0x22')](function(_0x1d5035){if(_0x1d5035){if(_0x58fbe8[_0xce24('0x57')][_0xce24('0x70')]){_0x3be808[_0xce24('0x2b')][_0xce24('0x71')]=util[_0xce24('0x5e')]('SIP/%s',_0x58fbe8[_0xce24('0x60')][_0xce24('0x3a')]);_0x3be808['message'][_0xce24('0x72')]=_0x3be808[_0xce24('0x72')];_0x3be808[_0xce24('0x2b')][_0xce24('0x73')]=_0xce24('0x5b');return respondWithRpcPromise(_0xce24('0x74'),_0xce24('0x74'),{'event':_0xce24('0x75'),'message':_0x3be808[_0xce24('0x2b')]},client9002)[_0xce24('0x22')](function(){return _0x3be808;});}return _0x3be808;}return null;})[_0xce24('0x22')](respondWithResult(_0x46b54d,null))[_0xce24('0x2c')](handleError(_0x46b54d,null));};var interaction_log=require(_0xce24('0x15'))(_0xce24('0x5a'));exports['reject']=function(_0xc1b079,_0x425e64,_0x9b39a2){var _0x2ad089={'agent':{},'channel':_0xce24('0x76')};if(_0xc1b079[_0xce24('0x57')]['id']){delete _0xc1b079[_0xce24('0x57')]['id'];}_0xc1b079[_0xce24('0x57')][_0xce24('0x5f')]=_0xc1b079[_0xce24('0x57')][_0xce24('0x5f')]||_0xc1b079[_0xce24('0x60')]['id'];_0x2ad089['agent']['id']=_0xc1b079[_0xce24('0x57')][_0xce24('0x5f')];return db['OpenchannelMessage']['find']({'where':{'id':_0xc1b079[_0xce24('0x58')]['id'],'UserId':null}})[_0xce24('0x22')](handleEntityNotFound(_0x425e64,null))['then'](function(_0x23b0f2){if(_0x23b0f2){_0x2ad089[_0xce24('0x2b')]=_0x23b0f2[_0xce24('0x62')]({'plain':!![]});return db[_0xce24('0x77')][_0xce24('0x55')]({'where':{'id':_0x23b0f2['OpenchannelInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x425e64,null))['then'](function(_0x34843a){if(_0x34843a){_0x2ad089[_0xce24('0x67')]=_0x34843a[_0xce24('0x62')]({'plain':!![]});interaction_log[_0xce24('0x23')](_0xce24('0x78'),_0xc1b079[_0xce24('0x60')]['id'],_0xc1b079[_0xce24('0x60')][_0xce24('0x3a')],_0xc1b079[_0xce24('0x60')][_0xce24('0x66')],_0x2ad089[_0xce24('0x67')]['id'],_0xc1b079[_0xce24('0x57')]?JSON[_0xce24('0x28')](_0xc1b079['body']):'null');return respondWithRpcPromise(_0xce24('0x79'),_0xce24('0x7a'),_0x2ad089);}return null;})[_0xce24('0x22')](function(_0x38b19d){var _0x1abea1=_0xce24('0x6a')+_0x38b19d[_0xce24('0x2b')][_0xce24('0x6b')];return db[_0xce24('0x6c')][_0xce24('0x42')](_0x1abea1,{'type':db[_0xce24('0x6d')][_0xce24('0x7b')][_0xce24('0x7c')],'raw':!![]})['then'](function(_0x4b3583){return _0x4b3583;});})[_0xce24('0x22')](function(_0x481469){if(_0x481469){_0x2ad089[_0xce24('0x2b')]['contact']=_0x481469[0x0];if(!_0xc1b079[_0xce24('0x57')][_0xce24('0x5f')])return;return db[_0xce24('0x6e')][_0xce24('0x55')]({'where':{'id':_0xc1b079[_0xce24('0x57')][_0xce24('0x5f')],'role':_0xce24('0x61')},'attributes':['id','name',_0xce24('0x7d'),_0xce24('0x7e'),_0xce24('0x6f')],'raw':!![]});}return null;})[_0xce24('0x22')](function(_0x5a15d0){if(!_0x5a15d0)return null;_0x2ad089[_0xce24('0x2b')][_0xce24('0x61')]=_0x5a15d0;return _0x2ad089;})[_0xce24('0x22')](function(_0x16a9af){if(_0x16a9af){_0x16a9af[_0xce24('0x2b')][_0xce24('0x71')]=util['format'](_0xce24('0x7f'),_0xc1b079[_0xce24('0x60')]['name']);_0x16a9af[_0xce24('0x2b')][_0xce24('0x72')]=_0x2ad089[_0xce24('0x72')];_0x16a9af[_0xce24('0x2b')][_0xce24('0x73')]=_0xce24('0x35');respondWithRpcPromise(_0xce24('0x74'),_0xce24('0x74'),{'event':_0xce24('0x80'),'message':_0x16a9af[_0xce24('0x2b')]},client9002);return _0x2ad089;}return null;})[_0xce24('0x22')](respondWithResult(_0x425e64,null))[_0xce24('0x2c')](handleError(_0x425e64,null));}; \ No newline at end of file +var _0x062b=['error','code','message','result','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','destroy','stack','name','send','index','map','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','options','OpenchannelMessage','includeAll','include','rows','catch','params','rawAttributes','keys','find','create','body','describe','../../config/logger','openchannel-interactions','openchannel','format','UserId','user','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','YYYY-MM-DD\x20HH:mm:ss','interaction','info','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','User','agent','fullname','email','internal','manual','interface','SIP/%s','channel','event','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','contact','reject','EventManager','eml-format','rimraf','zip-dir','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/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x062b,0xe3));var _0xb062=function(_0x3f13f6,_0x261f65){_0x3f13f6=_0x3f13f6-0x0;var _0x341322=_0x062b[_0x3f13f6];return _0x341322;};'use strict';var emlformat=require(_0xb062('0x0'));var rimraf=require(_0xb062('0x1'));var zipdir=require(_0xb062('0x2'));var jsonpatch=require(_0xb062('0x3'));var rp=require(_0xb062('0x4'));var moment=require(_0xb062('0x5'));var BPromise=require(_0xb062('0x6'));var Mustache=require(_0xb062('0x7'));var util=require(_0xb062('0x8'));var path=require(_0xb062('0x9'));var sox=require('sox');var csv=require(_0xb062('0xa'));var ejs=require(_0xb062('0xb'));var fs=require('fs');var fs_extra=require(_0xb062('0xc'));var _=require(_0xb062('0xd'));var squel=require(_0xb062('0xe'));var crypto=require(_0xb062('0xf'));var jsforce=require(_0xb062('0x10'));var deskjs=require(_0xb062('0x11'));var toCsv=require(_0xb062('0xa'));var querystring=require(_0xb062('0x12'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xb062('0x13'));var qs=require(_0xb062('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb062('0x15'));var logger=require('../../config/logger')(_0xb062('0x16'));var utils=require(_0xb062('0x17'));var config=require(_0xb062('0x18'));var licenseUtil=require(_0xb062('0x19'));var db=require(_0xb062('0x1a'))['db'];config[_0xb062('0x1b')]=_['defaults'](config[_0xb062('0x1b')],{'host':_0xb062('0x1c'),'port':0x18eb});var socket=require(_0xb062('0x1d'))(new Redis(config['redis']));require(_0xb062('0x1e'))[_0xb062('0x1f')](socket);var jayson=require(_0xb062('0x20'));var client=jayson[_0xb062('0x21')][_0xb062('0x22')]({'port':0x232c});var client9002=jayson[_0xb062('0x21')][_0xb062('0x22')]({'port':0x232a});function respondWithRpcPromise(_0x25507b,_0x472b90,_0x24ce72,_0x53e6ff){return new BPromise(function(_0x5e53eb,_0x590629){var _0x280364=_0x53e6ff||client;return _0x280364[_0xb062('0x23')](_0x25507b,_0x24ce72)[_0xb062('0x24')](function(_0x2b9ca4){logger['info'](_0xb062('0x25'),_0x472b90,_0xb062('0x26'));logger['debug'](_0xb062('0x27'),_0x472b90,'request\x20sent',JSON[_0xb062('0x28')](_0x2b9ca4));if(_0x2b9ca4['error']){if(_0x2b9ca4[_0xb062('0x29')][_0xb062('0x2a')]===0x1f4){logger['error'](_0xb062('0x25'),_0x472b90,_0x2b9ca4[_0xb062('0x29')]['message']);return _0x590629(_0x2b9ca4[_0xb062('0x29')][_0xb062('0x2b')]);}logger[_0xb062('0x29')](_0xb062('0x25'),_0x472b90,_0x2b9ca4[_0xb062('0x29')][_0xb062('0x2b')]);return _0x5e53eb(_0x2b9ca4[_0xb062('0x29')][_0xb062('0x2b')]);}else{logger['info'](_0xb062('0x25'),_0x472b90,_0xb062('0x26'));_0x5e53eb(_0x2b9ca4[_0xb062('0x2c')][_0xb062('0x2b')]);}})['catch'](function(_0x1cb494){logger['error']('OpenchannelMessage,\x20%s,\x20%s',_0x472b90,_0x1cb494);_0x590629(_0x1cb494);});});}function respondWithStatusCode(_0x17af76,_0x59be99){_0x59be99=_0x59be99||0xcc;return function(_0x4e8b25){if(_0x4e8b25){return _0x17af76[_0xb062('0x2d')](_0x59be99);}return _0x17af76[_0xb062('0x2e')](_0x59be99)[_0xb062('0x2f')]();};}function respondWithResult(_0xa9cdc1,_0x3afbef){_0x3afbef=_0x3afbef||0xc8;return function(_0x2af083){if(_0x2af083){return _0xa9cdc1[_0xb062('0x2e')](_0x3afbef)[_0xb062('0x30')](_0x2af083);}};}function respondWithFilteredResult(_0x287e22,_0x47a545){return function(_0x243f32){if(_0x243f32){var _0x24ebaf=typeof _0x47a545[_0xb062('0x31')]==='undefined'&&typeof _0x47a545[_0xb062('0x32')]===_0xb062('0x33');var _0x7b39c7=_0x243f32[_0xb062('0x34')];var _0x4fb3f5=_0x24ebaf?0x0:_0x47a545[_0xb062('0x31')];var _0x3c4b9e=_0x24ebaf?_0x243f32[_0xb062('0x34')]:_0x47a545[_0xb062('0x31')]+_0x47a545[_0xb062('0x32')];var _0x4ba2d7;if(_0x3c4b9e>=_0x7b39c7){_0x3c4b9e=_0x7b39c7;_0x4ba2d7=0xc8;}else{_0x4ba2d7=0xce;}_0x287e22[_0xb062('0x2e')](_0x4ba2d7);return _0x287e22[_0xb062('0x35')](_0xb062('0x36'),_0x4fb3f5+'-'+_0x3c4b9e+'/'+_0x7b39c7)[_0xb062('0x30')](_0x243f32);}return null;};}function patchUpdates(_0x2bd995){return function(_0x257eb0){try{jsonpatch[_0xb062('0x37')](_0x257eb0,_0x2bd995,!![]);}catch(_0x5c719a){return BPromise['reject'](_0x5c719a);}return _0x257eb0[_0xb062('0x38')]();};}function saveUpdates(_0x3c16d3,_0x248183){return function(_0x370b74){if(_0x370b74){return _0x370b74[_0xb062('0x39')](_0x3c16d3)[_0xb062('0x24')](function(_0x46bc21){return _0x46bc21;});}return null;};}function removeEntity(_0x43f378,_0x452c5d){return function(_0x6f53ab){if(_0x6f53ab){return _0x6f53ab[_0xb062('0x3a')]()['then'](function(){_0x43f378['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ba227,_0x2fb023){return function(_0x4d905e){if(!_0x4d905e){_0x4ba227[_0xb062('0x2d')](0x194);}return _0x4d905e;};}function handleError(_0x3a9705,_0x2f1059){_0x2f1059=_0x2f1059||0x1f4;return function(_0x4ffc70){logger[_0xb062('0x29')](_0x4ffc70[_0xb062('0x3b')]);if(_0x4ffc70[_0xb062('0x3c')]){delete _0x4ffc70[_0xb062('0x3c')];}_0x3a9705[_0xb062('0x2e')](_0x2f1059)[_0xb062('0x3d')](_0x4ffc70);};}exports[_0xb062('0x3e')]=function(_0x5a70e4,_0x1344d7){var _0x177cbe={},_0x59828f={},_0x5fad6c={'count':0x0,'rows':[]};var _0x5266f7=_[_0xb062('0x3f')](db['OpenchannelMessage']['rawAttributes'],function(_0x4f4b73){return{'name':_0x4f4b73[_0xb062('0x40')],'type':_0x4f4b73['type'][_0xb062('0x41')]};});_0x59828f[_0xb062('0x42')]=_[_0xb062('0x3f')](_0x5266f7,'name');_0x59828f[_0xb062('0x43')]=_['keys'](_0x5a70e4[_0xb062('0x43')]);_0x59828f[_0xb062('0x44')]=_['intersection'](_0x59828f[_0xb062('0x42')],_0x59828f[_0xb062('0x43')]);_0x177cbe['attributes']=_[_0xb062('0x45')](_0x59828f[_0xb062('0x42')],qs['fields'](_0x5a70e4['query'][_0xb062('0x46')]));_0x177cbe[_0xb062('0x47')]=_0x177cbe['attributes'][_0xb062('0x48')]?_0x177cbe[_0xb062('0x47')]:_0x59828f[_0xb062('0x42')];if(!_0x5a70e4[_0xb062('0x43')][_0xb062('0x49')](_0xb062('0x4a'))){_0x177cbe['limit']=qs['limit'](_0x5a70e4[_0xb062('0x43')][_0xb062('0x32')]);_0x177cbe[_0xb062('0x31')]=qs[_0xb062('0x31')](_0x5a70e4[_0xb062('0x43')][_0xb062('0x31')]);}_0x177cbe[_0xb062('0x4b')]=qs[_0xb062('0x4c')](_0x5a70e4[_0xb062('0x43')][_0xb062('0x4c')]);_0x177cbe['where']=qs['filters'](_[_0xb062('0x4d')](_0x5a70e4[_0xb062('0x43')],_0x59828f[_0xb062('0x44')]),_0x5266f7);if(_0x5a70e4[_0xb062('0x43')]['filter']){_0x177cbe[_0xb062('0x4e')]=_['merge'](_0x177cbe[_0xb062('0x4e')],{'$or':_['map'](_0x5266f7,function(_0x3d48b2){if(_0x3d48b2[_0xb062('0x4f')]!==_0xb062('0x50')){var _0x25d591={};_0x25d591[_0x3d48b2[_0xb062('0x3c')]]={'$like':'%'+_0x5a70e4['query'][_0xb062('0x51')]+'%'};return _0x25d591;}})});}_0x177cbe=_['merge']({},_0x177cbe,_0x5a70e4[_0xb062('0x52')]);var _0x547bba={'where':_0x177cbe['where']};return db[_0xb062('0x53')]['count'](_0x547bba)[_0xb062('0x24')](function(_0x14e7a0){_0x5fad6c[_0xb062('0x34')]=_0x14e7a0;if(_0x5a70e4[_0xb062('0x43')][_0xb062('0x54')]){_0x177cbe[_0xb062('0x55')]=[{'all':!![]}];}return db[_0xb062('0x53')]['findAll'](_0x177cbe);})[_0xb062('0x24')](function(_0xa40179){_0x5fad6c[_0xb062('0x56')]=_0xa40179;return _0x5fad6c;})[_0xb062('0x24')](respondWithFilteredResult(_0x1344d7,_0x177cbe))[_0xb062('0x57')](handleError(_0x1344d7,null));};exports['show']=function(_0xdb8ad0,_0x4ca727){var _0x2d25da={'raw':!![],'where':{'id':_0xdb8ad0[_0xb062('0x58')]['id']}},_0x2124b7={};_0x2124b7['model']=_['keys'](db['OpenchannelMessage'][_0xb062('0x59')]);_0x2124b7[_0xb062('0x43')]=_[_0xb062('0x5a')](_0xdb8ad0[_0xb062('0x43')]);_0x2124b7['filters']=_[_0xb062('0x45')](_0x2124b7[_0xb062('0x42')],_0x2124b7[_0xb062('0x43')]);_0x2d25da[_0xb062('0x47')]=_[_0xb062('0x45')](_0x2124b7[_0xb062('0x42')],qs[_0xb062('0x46')](_0xdb8ad0[_0xb062('0x43')][_0xb062('0x46')]));_0x2d25da[_0xb062('0x47')]=_0x2d25da[_0xb062('0x47')][_0xb062('0x48')]?_0x2d25da[_0xb062('0x47')]:_0x2124b7[_0xb062('0x42')];if(_0xdb8ad0[_0xb062('0x43')]['includeAll']){_0x2d25da[_0xb062('0x55')]=[{'all':!![]}];}_0x2d25da=_['merge']({},_0x2d25da,_0xdb8ad0[_0xb062('0x52')]);return db[_0xb062('0x53')][_0xb062('0x5b')](_0x2d25da)[_0xb062('0x24')](handleEntityNotFound(_0x4ca727,null))[_0xb062('0x24')](respondWithResult(_0x4ca727,null))['catch'](handleError(_0x4ca727,null));};exports[_0xb062('0x5c')]=function(_0x262bfb,_0x2cffb1){return db[_0xb062('0x53')][_0xb062('0x5c')](_0x262bfb['body'],{})[_0xb062('0x24')](respondWithResult(_0x2cffb1,0xc9))[_0xb062('0x57')](handleError(_0x2cffb1,null));};exports[_0xb062('0x39')]=function(_0x368def,_0x1b6534){if(_0x368def[_0xb062('0x5d')]['id']){delete _0x368def[_0xb062('0x5d')]['id'];}return db['OpenchannelMessage'][_0xb062('0x5b')]({'where':{'id':_0x368def['params']['id']}})[_0xb062('0x24')](handleEntityNotFound(_0x1b6534,null))['then'](saveUpdates(_0x368def['body'],null))['then'](respondWithResult(_0x1b6534,null))[_0xb062('0x57')](handleError(_0x1b6534,null));};exports[_0xb062('0x3a')]=function(_0x4565d7,_0x3ba4bc){return db[_0xb062('0x53')][_0xb062('0x5b')]({'where':{'id':_0x4565d7[_0xb062('0x58')]['id']}})[_0xb062('0x24')](handleEntityNotFound(_0x3ba4bc,null))[_0xb062('0x24')](removeEntity(_0x3ba4bc,null))[_0xb062('0x57')](handleError(_0x3ba4bc,null));};exports[_0xb062('0x5e')]=function(_0x17c6ad,_0x442fcf){return db[_0xb062('0x53')][_0xb062('0x5e')]()[_0xb062('0x24')](respondWithResult(_0x442fcf,null))[_0xb062('0x57')](handleError(_0x442fcf,null));};var interaction_log=require(_0xb062('0x5f'))(_0xb062('0x60'));exports['accept']=function(_0x141ce2,_0x4426b5,_0x436d66){var _0xa0718f={'agent':{},'channel':_0xb062('0x61')};if(_0x141ce2[_0xb062('0x5d')]['id']){delete _0x141ce2[_0xb062('0x5d')]['id'];}_0x141ce2[_0xb062('0x5d')]['read']=!![];_0x141ce2['body']['readAt']=moment()[_0xb062('0x62')]('YYYY-MM-DD\x20HH:mm:ss');_0x141ce2[_0xb062('0x5d')]['UserId']=_0x141ce2['body'][_0xb062('0x63')]||_0x141ce2[_0xb062('0x64')]['id'];_0xa0718f['agent']['id']=_0x141ce2['body'][_0xb062('0x63')];return db[_0xb062('0x53')]['find']({'where':{'id':_0x141ce2['params']['id'],'UserId':null}})[_0xb062('0x24')](handleEntityNotFound(_0x4426b5,null))['then'](saveUpdates(_0x141ce2[_0xb062('0x5d')],null))['then'](function(_0x209164){if(_0x209164){_0xa0718f[_0xb062('0x2b')]=_0x209164[_0xb062('0x65')]({'plain':!![]});return db[_0xb062('0x66')][_0xb062('0x5b')]({'where':{'id':_0x209164[_0xb062('0x67')]}});}return null;})['then'](handleEntityNotFound(_0x4426b5,null))['then'](function(_0x56377d){if(_0x56377d){return _0x56377d[_0xb062('0x39')]({'UserId':_0x141ce2[_0xb062('0x5d')][_0xb062('0x63')],'read1stAt':_[_0xb062('0x68')](_0x56377d[_0xb062('0x69')])?moment()['format'](_0xb062('0x6a')):undefined});}return null;})['then'](function(_0xfe3958){if(_0xfe3958){_0xa0718f[_0xb062('0x6b')]=_0xfe3958['get']({'plain':!![]});interaction_log[_0xb062('0x6c')]('[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x141ce2[_0xb062('0x64')]['id'],_0x141ce2[_0xb062('0x64')][_0xb062('0x3c')],_0x141ce2[_0xb062('0x64')][_0xb062('0x6d')],_0xa0718f[_0xb062('0x6b')]['id'],_0x141ce2[_0xb062('0x5d')]?JSON[_0xb062('0x28')](_0x141ce2[_0xb062('0x5d')]):_0xb062('0x6e'));return respondWithRpcPromise(_0xb062('0x6f'),_0xb062('0x70'),_0xa0718f);}return null;})[_0xb062('0x24')](function(_0x1bcdbd){var _0xe3b74f=_0xb062('0x71')+_0x1bcdbd[_0xb062('0x2b')][_0xb062('0x72')];return db[_0xb062('0x73')][_0xb062('0x43')](_0xe3b74f,{'type':db[_0xb062('0x74')][_0xb062('0x75')][_0xb062('0x76')],'raw':!![]})[_0xb062('0x24')](function(_0x1fe4f4){return _0x1fe4f4;});})[_0xb062('0x24')](function(_0x2fc310){if(_0x2fc310){_0xa0718f['message']['contact']=_0x2fc310[0x0];if(!_0x141ce2['body'][_0xb062('0x63')])return;return db[_0xb062('0x77')][_0xb062('0x5b')]({'where':{'id':_0x141ce2[_0xb062('0x5d')][_0xb062('0x63')],'role':_0xb062('0x78')},'attributes':['id',_0xb062('0x3c'),_0xb062('0x79'),_0xb062('0x7a'),_0xb062('0x7b')],'raw':!![]});}return null;})[_0xb062('0x24')](function(_0xde476d){if(!_0xde476d)return null;_0xa0718f['message']['agent']=_0xde476d;return _0xa0718f;})[_0xb062('0x24')](function(_0x5eef5a){if(_0x5eef5a){if(_0x141ce2['body'][_0xb062('0x7c')]){_0xa0718f['message'][_0xb062('0x7d')]=util[_0xb062('0x62')](_0xb062('0x7e'),_0x141ce2[_0xb062('0x64')][_0xb062('0x3c')]);_0xa0718f['message'][_0xb062('0x7f')]=_0xa0718f[_0xb062('0x7f')];_0xa0718f[_0xb062('0x2b')][_0xb062('0x80')]='accept';return respondWithRpcPromise('EventManager','EventManager',{'event':'acceptmessage','message':_0xa0718f['message']},client9002)[_0xb062('0x24')](function(){return _0xa0718f;});}return _0xa0718f;}return null;})['then'](respondWithResult(_0x4426b5,null))[_0xb062('0x57')](handleError(_0x4426b5,null));};var interaction_log=require(_0xb062('0x5f'))('openchannel-interactions');exports['reject']=function(_0x477418,_0x1d98c9,_0x22a1fe){var _0x25def0={'agent':{},'channel':_0xb062('0x61')};if(_0x477418['body']['id']){delete _0x477418[_0xb062('0x5d')]['id'];}_0x477418[_0xb062('0x5d')][_0xb062('0x63')]=_0x477418[_0xb062('0x5d')]['UserId']||_0x477418['user']['id'];_0x25def0['agent']['id']=_0x477418[_0xb062('0x5d')][_0xb062('0x63')];return db[_0xb062('0x53')][_0xb062('0x5b')]({'where':{'id':_0x477418[_0xb062('0x58')]['id'],'UserId':null}})[_0xb062('0x24')](handleEntityNotFound(_0x1d98c9,null))['then'](function(_0x464d14){if(_0x464d14){_0x25def0['message']=_0x464d14[_0xb062('0x65')]({'plain':!![]});return db[_0xb062('0x66')][_0xb062('0x5b')]({'where':{'id':_0x464d14[_0xb062('0x67')]}});}return null;})[_0xb062('0x24')](handleEntityNotFound(_0x1d98c9,null))[_0xb062('0x24')](function(_0x9fb0a9){if(_0x9fb0a9){_0x25def0[_0xb062('0x6b')]=_0x9fb0a9['get']({'plain':!![]});interaction_log[_0xb062('0x6c')](_0xb062('0x81'),_0x477418[_0xb062('0x64')]['id'],_0x477418['user'][_0xb062('0x3c')],_0x477418['user']['role'],_0x25def0[_0xb062('0x6b')]['id'],_0x477418['body']?JSON[_0xb062('0x28')](_0x477418[_0xb062('0x5d')]):'null');return respondWithRpcPromise('RejectMessage',_0xb062('0x82'),_0x25def0);}return null;})[_0xb062('0x24')](function(_0xd86518){var _0x2d9626='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0xd86518['message'][_0xb062('0x72')];return db[_0xb062('0x73')][_0xb062('0x43')](_0x2d9626,{'type':db[_0xb062('0x74')][_0xb062('0x75')][_0xb062('0x76')],'raw':!![]})[_0xb062('0x24')](function(_0x1ffece){return _0x1ffece;});})[_0xb062('0x24')](function(_0x1bfd2b){if(_0x1bfd2b){_0x25def0[_0xb062('0x2b')][_0xb062('0x83')]=_0x1bfd2b[0x0];if(!_0x477418['body'][_0xb062('0x63')])return;return db[_0xb062('0x77')]['find']({'where':{'id':_0x477418['body'][_0xb062('0x63')],'role':_0xb062('0x78')},'attributes':['id',_0xb062('0x3c'),_0xb062('0x79'),'email',_0xb062('0x7b')],'raw':!![]});}return null;})[_0xb062('0x24')](function(_0x11d4a8){if(!_0x11d4a8)return null;_0x25def0[_0xb062('0x2b')][_0xb062('0x78')]=_0x11d4a8;return _0x25def0;})[_0xb062('0x24')](function(_0x57b696){if(_0x57b696){_0x57b696[_0xb062('0x2b')][_0xb062('0x7d')]=util[_0xb062('0x62')](_0xb062('0x7e'),_0x477418[_0xb062('0x64')][_0xb062('0x3c')]);_0x57b696[_0xb062('0x2b')][_0xb062('0x7f')]=_0x25def0[_0xb062('0x7f')];_0x57b696[_0xb062('0x2b')]['event']=_0xb062('0x84');respondWithRpcPromise(_0xb062('0x85'),_0xb062('0x85'),{'event':'rejectmessage','message':_0x57b696[_0xb062('0x2b')]},client9002);return _0x25def0;}return null;})[_0xb062('0x24')](respondWithResult(_0x1d98c9,null))[_0xb062('0x57')](handleError(_0x1d98c9,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 25236d3..5964aad 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 _0x0bec=['emit','hook','exports','events','../../mysqldb','OpenchannelMessage','update'];(function(_0x2d5927,_0x269e43){var _0x2b9b98=function(_0x4c173a){while(--_0x4c173a){_0x2d5927['push'](_0x2d5927['shift']());}};_0x2b9b98(++_0x269e43);}(_0x0bec,0xea));var _0xc0be=function(_0x57c23a,_0x542061){_0x57c23a=_0x57c23a-0x0;var _0xf05953=_0x0bec[_0x57c23a];return _0xf05953;};'use strict';var EventEmitter=require(_0xc0be('0x0'));var OpenchannelMessage=require(_0xc0be('0x1'))['db'][_0xc0be('0x2')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc0be('0x3'),'afterDestroy':'remove'};function emitEvent(_0x16b2a5){return function(_0x41772d,_0x20415a,_0x74362){OpenchannelMessageEvents[_0xc0be('0x4')](_0x16b2a5+':'+_0x41772d['id'],_0x41772d);OpenchannelMessageEvents[_0xc0be('0x4')](_0x16b2a5,_0x41772d);_0x74362(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0xc0be('0x5')](e,emitEvent(event));}}module[_0xc0be('0x6')]=OpenchannelMessageEvents; \ No newline at end of file +var _0x0328=['OpenchannelMessage','remove','emit','hasOwnProperty','hook','exports','../../mysqldb'];(function(_0x19ce8c,_0x304c5e){var _0x589fce=function(_0x21800e){while(--_0x21800e){_0x19ce8c['push'](_0x19ce8c['shift']());}};_0x589fce(++_0x304c5e);}(_0x0328,0x1e2));var _0x8032=function(_0x29a1b7,_0xad66fe){_0x29a1b7=_0x29a1b7-0x0;var _0x1a01bc=_0x0328[_0x29a1b7];return _0x1a01bc;};'use strict';var EventEmitter=require('events');var OpenchannelMessage=require(_0x8032('0x0'))['db'][_0x8032('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x8032('0x2')};function emitEvent(_0xbb3a65){return function(_0x2620b2,_0x2cd100,_0x527233){OpenchannelMessageEvents['emit'](_0xbb3a65+':'+_0x2620b2['id'],_0x2620b2);OpenchannelMessageEvents[_0x8032('0x3')](_0xbb3a65,_0x2620b2);_0x527233(null);};}for(var e in events){if(events[_0x8032('0x4')](e)){var event=events[e];OpenchannelMessage[_0x8032('0x5')](e,emitEvent(event));}}module[_0x8032('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 194b375..1a486fa 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 _0x7916=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelMessage.attributes','OpenchannelMessage','fti_openchannel_messages','models','direction','toLowerCase','out','secret','isNil','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','update','catch','describe','then','OpenchannelAccount','OpenchannelAccountId','Interactions','CmContact','Contact','keys','get','info','OpenchannelMessage,\x20%s,\x20%s','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','method','GET','POST','body','threadId','error','afterCreate','inspect','finally'];(function(_0x13ae89,_0x832c38){var _0x1744a0=function(_0x4c406a){while(--_0x4c406a){_0x13ae89['push'](_0x13ae89['shift']());}};_0x1744a0(++_0x832c38);}(_0x7916,0x128));var _0x6791=function(_0x44f0b8,_0x17ee1f){_0x44f0b8=_0x44f0b8-0x0;var _0x3e7880=_0x7916[_0x44f0b8];return _0x3e7880;};'use strict';var _=require(_0x6791('0x0'));var util=require('util');var logger=require(_0x6791('0x1'))(_0x6791('0x2'));var moment=require('moment');var BPromise=require(_0x6791('0x3'));var rp=require(_0x6791('0x4'));var fs=require('fs');var path=require(_0x6791('0x5'));var rimraf=require(_0x6791('0x6'));var config=require('../../config/environment');var attributes=require(_0x6791('0x7'));module['exports']=function(_0x3ca328,_0x3277a8){return _0x3ca328['define'](_0x6791('0x8'),attributes,{'tableName':'openchannel_messages','paranoid':![],'indexes':[{'name':_0x6791('0x9'),'fields':['body'],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a9915,_0x198a64,_0x579950){var _0xbc3bc6=_0x3ca328[_0x6791('0xa')];var _0x2aeae9=_0x2a9915['get']({'plain':!![]});if(_0x2aeae9[_0x6791('0xb')][_0x6791('0xc')]()==='in'||_0x2aeae9[_0x6791('0xb')][_0x6791('0xc')]()===_0x6791('0xd')&&!_0x2aeae9[_0x6791('0xe')]&&!_[_0x6791('0xf')](_0x2aeae9[_0x6791('0x10')])){_0xbc3bc6[_0x6791('0x11')][_0x6791('0x12')]({'where':{'id':_0x2aeae9[_0x6791('0x13')]}})['then'](function(_0x4b1719){if(_0x4b1719){_0x4b1719[_0x6791('0x14')]({'lastMsgAt':_0x2aeae9['createdAt'],'lastMsgDirection':_0x2aeae9[_0x6791('0xb')]['toLowerCase']()});}})[_0x6791('0x15')](function(_0x163898){console['error'](_0x163898);});}if(_0x2aeae9[_0x6791('0xb')]==='out'&&!_0x2aeae9[_0x6791('0xe')]){var _0x150d1f;_0xbc3bc6['CmContact'][_0x6791('0x16')]()[_0x6791('0x17')](function(_0x5bec14){return _0xbc3bc6[_0x6791('0x18')]['find']({'where':{'id':_0x2aeae9[_0x6791('0x19')]},'include':[{'model':_0xbc3bc6[_0x6791('0x11')],'as':_0x6791('0x1a'),'where':{'id':_0x2aeae9[_0x6791('0x13')]},'limit':0x1,'include':[{'model':_0xbc3bc6[_0x6791('0x1b')],'as':_0x6791('0x1c'),'attributes':_[_0x6791('0x1d')](_0x5bec14)}]}]});})['then'](function(_0x4a2922){_0x150d1f=_0x4a2922[_0x6791('0x1e')]({'plain':!![]});if(_0x150d1f&&_0x150d1f['replyUri']){logger[_0x6791('0x1f')](_0x6791('0x20'),'afterCreate',util[_0x6791('0x21')](_0x6791('0x22'),_0x2aeae9['id'],_0x150d1f[_0x6791('0x23')]));if(_0x150d1f[_0x6791('0x1a')]&&_0x150d1f['Interactions'][_0x6791('0x24')]){_0x2aeae9[_0x6791('0x25')]=_['omit'](_0x150d1f['Interactions'][0x0],'Contact');_0x2aeae9[_0x6791('0x1c')]=_0x150d1f['Interactions'][0x0][_0x6791('0x1c')];}var _0x198a64={'method':'POST','uri':encodeURI(_0x150d1f['replyUri']),'json':!![],'resolveWithFullResponse':!![]};switch(_0x198a64[_0x6791('0x26')]){case _0x6791('0x27'):_0x198a64['qs']=_0x2aeae9;break;case _0x6791('0x28'):_0x198a64['body']=_0x2aeae9;break;}return rp(_0x198a64)[_0x6791('0x17')](function(_0x30cc17){logger['info'](_0x6791('0x20'),'afterCreate',util[_0x6791('0x21')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x2aeae9['id'],_0x150d1f['replyUri']));if(_0x30cc17[_0x6791('0x29')]['threadId']&&_0x30cc17[_0x6791('0x29')][_0x6791('0x2a')]!=_0x2aeae9['Interaction'][_0x6791('0x2a')]){return _0xbc3bc6[_0x6791('0x11')][_0x6791('0x14')]({'threadId':_0x30cc17[_0x6791('0x29')]['threadId']},{'logging':!![],'where':{'id':_0x2aeae9['Interaction']['id']}});}else{return;}})[_0x6791('0x17')](function(){return _0x2a9915['update']({'read':!![]});})[_0x6791('0x15')](function(_0x338d09){logger[_0x6791('0x2b')](_0x6791('0x20'),_0x6791('0x2c'),util[_0x6791('0x2d')](_0x338d09,{'showHidden':![],'depth':null}));_0x579950();});}else{_0x579950();}})[_0x6791('0x2e')](function(){_0x579950();});}else{_0x579950();}}},'charset':_0x6791('0x2f'),'collate':_0x6791('0x30')});}; \ No newline at end of file +var _0x4213=['describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','CmContact','Contact','info','OpenchannelMessage,\x20%s,\x20%s','afterCreate','format','Forwarding\x20message\x20%d\x20to\x20%s','replyUri','length','Interaction','GET','threadId','inspect','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./openchannelMessage.attributes','exports','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','UserId','OpenchannelInteraction','findOne','OpenchannelInteractionId','then','update','catch'];(function(_0x532054,_0x32fe3d){var _0x25446a=function(_0x96b09){while(--_0x96b09){_0x532054['push'](_0x532054['shift']());}};_0x25446a(++_0x32fe3d);}(_0x4213,0x77));var _0x3421=function(_0x3d9914,_0x268b4e){_0x3d9914=_0x3d9914-0x0;var _0x299080=_0x4213[_0x3d9914];return _0x299080;};'use strict';var _=require(_0x3421('0x0'));var util=require(_0x3421('0x1'));var logger=require(_0x3421('0x2'))(_0x3421('0x3'));var moment=require(_0x3421('0x4'));var BPromise=require(_0x3421('0x5'));var rp=require(_0x3421('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3421('0x7'));var config=require('../../config/environment');var attributes=require(_0x3421('0x8'));module[_0x3421('0x9')]=function(_0x2155f8,_0x2a04e0){return _0x2155f8['define'](_0x3421('0xa'),attributes,{'tableName':_0x3421('0xb'),'paranoid':![],'indexes':[{'name':_0x3421('0xc'),'fields':[_0x3421('0xd')],'type':_0x3421('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4ddfce,_0x1f20cf,_0x58d511){var _0x4ff986=_0x2155f8[_0x3421('0xf')];var _0x4b9d24=_0x4ddfce[_0x3421('0x10')]({'plain':!![]});if(_0x4b9d24[_0x3421('0x11')][_0x3421('0x12')]()==='in'||_0x4b9d24[_0x3421('0x11')][_0x3421('0x12')]()===_0x3421('0x13')&&!_0x4b9d24[_0x3421('0x14')]&&!_['isNil'](_0x4b9d24[_0x3421('0x15')])){_0x4ff986[_0x3421('0x16')][_0x3421('0x17')]({'where':{'id':_0x4b9d24[_0x3421('0x18')]}})[_0x3421('0x19')](function(_0x3f4672){if(_0x3f4672){_0x3f4672[_0x3421('0x1a')]({'lastMsgAt':_0x4b9d24['createdAt'],'lastMsgDirection':_0x4b9d24[_0x3421('0x11')]['toLowerCase']()});}})[_0x3421('0x1b')](function(_0x5257ad){console['error'](_0x5257ad);});}if(_0x4b9d24[_0x3421('0x11')]==='out'&&!_0x4b9d24[_0x3421('0x14')]){var _0x23694b;_0x4ff986['CmContact'][_0x3421('0x1c')]()[_0x3421('0x19')](function(_0x130d3c){return _0x4ff986[_0x3421('0x1d')][_0x3421('0x1e')]({'where':{'id':_0x4b9d24[_0x3421('0x1f')]},'include':[{'model':_0x4ff986[_0x3421('0x16')],'as':_0x3421('0x20'),'where':{'id':_0x4b9d24[_0x3421('0x18')]},'limit':0x1,'include':[{'model':_0x4ff986[_0x3421('0x21')],'as':_0x3421('0x22'),'attributes':_['keys'](_0x130d3c)}]}]});})[_0x3421('0x19')](function(_0x4b59a5){_0x23694b=_0x4b59a5['get']({'plain':!![]});if(_0x23694b&&_0x23694b['replyUri']){logger[_0x3421('0x23')](_0x3421('0x24'),_0x3421('0x25'),util[_0x3421('0x26')](_0x3421('0x27'),_0x4b9d24['id'],_0x23694b[_0x3421('0x28')]));if(_0x23694b[_0x3421('0x20')]&&_0x23694b[_0x3421('0x20')][_0x3421('0x29')]){_0x4b9d24[_0x3421('0x2a')]=_['omit'](_0x23694b['Interactions'][0x0],'Contact');_0x4b9d24[_0x3421('0x22')]=_0x23694b[_0x3421('0x20')][0x0][_0x3421('0x22')];}var _0x1f20cf={'method':'POST','uri':encodeURI(_0x23694b[_0x3421('0x28')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x1f20cf['method']){case _0x3421('0x2b'):_0x1f20cf['qs']=_0x4b9d24;break;case'POST':_0x1f20cf[_0x3421('0xd')]=_0x4b9d24;break;}return rp(_0x1f20cf)[_0x3421('0x19')](function(_0x36d75f){logger[_0x3421('0x23')](_0x3421('0x24'),'afterCreate',util[_0x3421('0x26')]('Message\x20%d\x20forwarded\x20to\x20%s',_0x4b9d24['id'],_0x23694b['replyUri']));if(_0x36d75f[_0x3421('0xd')]['threadId']&&_0x36d75f['body'][_0x3421('0x2c')]!=_0x4b9d24['Interaction'][_0x3421('0x2c')]){return _0x4ff986['OpenchannelInteraction'][_0x3421('0x1a')]({'threadId':_0x36d75f[_0x3421('0xd')]['threadId']},{'logging':!![],'where':{'id':_0x4b9d24[_0x3421('0x2a')]['id']}});}else{return;}})[_0x3421('0x19')](function(){return _0x4ddfce[_0x3421('0x1a')]({'read':!![]});})['catch'](function(_0x3a89b6){logger['error'](_0x3421('0x24'),_0x3421('0x25'),util[_0x3421('0x2d')](_0x3a89b6,{'showHidden':![],'depth':null}));_0x58d511();});}else{_0x58d511();}})[_0x3421('0x2e')](function(){_0x58d511();});}else{_0x58d511();}}},'charset':_0x3421('0x2f'),'collate':_0x3421('0x30')});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 8d916bf..8122e7d 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 _0x1261=['../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','OpenchannelMessage,\x20%s,\x20%s','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','OpenchannelMessage','options','raw','then','CreateOpenchannelMessage','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x25d440,_0x4e1e58){var _0x528682=function(_0x3b6c69){while(--_0x3b6c69){_0x25d440['push'](_0x25d440['shift']());}};_0x528682(++_0x4e1e58);}(_0x1261,0x144));var _0x1126=function(_0x5d99bb,_0x10e04b){_0x5d99bb=_0x5d99bb-0x0;var _0xdfe846=_0x1261[_0x5d99bb];return _0xdfe846;};'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']('OpenchannelMessage,\x20%s,\x20%s',_0x18dbe6,_0x15c071[_0x1126('0x14')][_0x1126('0x16')]);return _0x34571c(_0x15c071[_0x1126('0x14')]['message']);}logger[_0x1126('0x14')]('OpenchannelMessage,\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);});});}exports['CreateOpenchannelMessage']=function(_0x22ed37){var _0x1d6d19=this;return new Promise(function(_0x2f70ac,_0x54400a){return db[_0x1126('0x19')]['create'](_0x22ed37['body'],{'raw':_0x22ed37[_0x1126('0x1a')]?_0x22ed37[_0x1126('0x1a')][_0x1126('0x1b')]===undefined?!![]:![]:!![]})[_0x1126('0x1c')](function(_0x526ca1){logger[_0x1126('0x17')](_0x1126('0x1d'),_0x22ed37);logger['debug'](_0x1126('0x1d'),_0x22ed37,JSON['stringify'](_0x526ca1));_0x2f70ac(_0x526ca1);})['catch'](function(_0x4b57ab){logger[_0x1126('0x14')](_0x1126('0x1d'),_0x4b57ab[_0x1126('0x16')],_0x22ed37);_0x54400a(_0x1d6d19[_0x1126('0x14')](0x1f4,_0x4b57ab[_0x1126('0x16')]));});});}; \ No newline at end of file +var _0x5f66=['stringify','error','code','message','info','result','OpenchannelMessage','create','body','options','raw','CreateOpenchannelMessage','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x389d77,_0x6852cf){var _0x4f985b=function(_0x532a47){while(--_0x532a47){_0x389d77['push'](_0x389d77['shift']());}};_0x4f985b(++_0x6852cf);}(_0x5f66,0x1a0));var _0x65f6=function(_0x278e3c,_0x1c9cfd){_0x278e3c=_0x278e3c-0x0;var _0x3e2d9b=_0x5f66[_0x278e3c];return _0x3e2d9b;};'use strict';var _=require('lodash');var util=require(_0x65f6('0x0'));var moment=require('moment');var BPromise=require(_0x65f6('0x1'));var rs=require(_0x65f6('0x2'));var fs=require('fs');var Redis=require(_0x65f6('0x3'));var db=require(_0x65f6('0x4'))['db'];var utils=require(_0x65f6('0x5'));var logger=require('../../config/logger')(_0x65f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x65f6('0x7'));var client=jayson[_0x65f6('0x8')]['http']({'port':0x232a});config['redis']=_[_0x65f6('0x9')](config[_0x65f6('0xa')],{'host':_0x65f6('0xb'),'port':0x18eb});var socket=require(_0x65f6('0xc'))(new Redis(config[_0x65f6('0xa')]));require(_0x65f6('0xd'))['register'](socket);function respondWithRpcPromise(_0x5123ee,_0x18fea1,_0x2f6d5b){return new BPromise(function(_0x264647,_0x25c416){return client['request'](_0x5123ee,_0x2f6d5b)[_0x65f6('0xe')](function(_0x571436){logger['info'](_0x65f6('0xf'),_0x18fea1,'request\x20sent');logger[_0x65f6('0x10')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x18fea1,_0x65f6('0x11'),JSON[_0x65f6('0x12')](_0x571436));if(_0x571436[_0x65f6('0x13')]){if(_0x571436[_0x65f6('0x13')][_0x65f6('0x14')]===0x1f4){logger[_0x65f6('0x13')](_0x65f6('0xf'),_0x18fea1,_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);return _0x25c416(_0x571436[_0x65f6('0x13')]['message']);}logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x571436['error'][_0x65f6('0x15')]);return _0x264647(_0x571436[_0x65f6('0x13')][_0x65f6('0x15')]);}else{logger[_0x65f6('0x16')](_0x65f6('0xf'),_0x18fea1,_0x65f6('0x11'));_0x264647(_0x571436[_0x65f6('0x17')][_0x65f6('0x15')]);}})['catch'](function(_0x4d79a1){logger[_0x65f6('0x13')]('OpenchannelMessage,\x20%s,\x20%s',_0x18fea1,_0x4d79a1);_0x25c416(_0x4d79a1);});});}exports['CreateOpenchannelMessage']=function(_0x5c5b91){var _0x365159=this;return new Promise(function(_0x21ea88,_0x5114a4){return db[_0x65f6('0x18')][_0x65f6('0x19')](_0x5c5b91[_0x65f6('0x1a')],{'raw':_0x5c5b91[_0x65f6('0x1b')]?_0x5c5b91[_0x65f6('0x1b')][_0x65f6('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x197a49){logger['info']('CreateOpenchannelMessage',_0x5c5b91);logger[_0x65f6('0x10')](_0x65f6('0x1d'),_0x5c5b91,JSON['stringify'](_0x197a49));_0x21ea88(_0x197a49);})[_0x65f6('0x1e')](function(_0x471a33){logger[_0x65f6('0x13')](_0x65f6('0x1d'),_0x471a33['message'],_0x5c5b91);_0x5114a4(_0x365159[_0x65f6('0x13')](0x1f4,_0x471a33[_0x65f6('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index 0a1394f..ddb387d 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 _0xde02=['emit','removeListener','register','length','openchannelMessage:','./openchannelMessage.events','save','remove'];(function(_0xf8c5e5,_0x58390e){var _0x1e2946=function(_0x1a1ce5){while(--_0x1a1ce5){_0xf8c5e5['push'](_0xf8c5e5['shift']());}};_0x1e2946(++_0x58390e);}(_0xde02,0xd5));var _0x2de0=function(_0x5ab6a9,_0x495ba9){_0x5ab6a9=_0x5ab6a9-0x0;var _0x4e0751=_0xde02[_0x5ab6a9];return _0x4e0751;};'use strict';var OpenchannelMessageEvents=require(_0x2de0('0x0'));var events=[_0x2de0('0x1'),_0x2de0('0x2'),'update'];function createListener(_0x57cfa6,_0x376fa7){return function(_0x14f298){_0x376fa7[_0x2de0('0x3')](_0x57cfa6,_0x14f298);};}function removeListener(_0x5987bd,_0xe2c452){return function(){OpenchannelMessageEvents[_0x2de0('0x4')](_0x5987bd,_0xe2c452);};}exports[_0x2de0('0x5')]=function(_0x313e40){for(var _0x42b19a=0x0,_0x4a7cc5=events[_0x2de0('0x6')];_0x42b19a<_0x4a7cc5;_0x42b19a++){var _0x182b39=events[_0x42b19a];var _0x15be24=createListener(_0x2de0('0x7')+_0x182b39,_0x313e40);OpenchannelMessageEvents['on'](_0x182b39,_0x15be24);}}; \ No newline at end of file +var _0x0a9f=['save','remove','emit','length','openchannelMessage:'];(function(_0x3c1ac7,_0x13d339){var _0x2c6a6e=function(_0x32db57){while(--_0x32db57){_0x3c1ac7['push'](_0x3c1ac7['shift']());}};_0x2c6a6e(++_0x13d339);}(_0x0a9f,0x64));var _0xf0a9=function(_0x542e14,_0x5dfd4b){_0x542e14=_0x542e14-0x0;var _0xe3bbb=_0x0a9f[_0x542e14];return _0xe3bbb;};'use strict';var OpenchannelMessageEvents=require('./openchannelMessage.events');var events=[_0xf0a9('0x0'),_0xf0a9('0x1'),'update'];function createListener(_0x5ed2ce,_0x1f8e8e){return function(_0x48e2ea){_0x1f8e8e[_0xf0a9('0x2')](_0x5ed2ce,_0x48e2ea);};}function removeListener(_0x5db4cc,_0x5f203f){return function(){OpenchannelMessageEvents['removeListener'](_0x5db4cc,_0x5f203f);};}exports['register']=function(_0x5343c2){for(var _0x2502a2=0x0,_0x4e9fa6=events[_0xf0a9('0x3')];_0x2502a2<_0x4e9fa6;_0x2502a2++){var _0x4d14e0=events[_0x2502a2];var _0x798586=createListener(_0xf0a9('0x4')+_0x4d14e0,_0x5343c2);OpenchannelMessageEvents['on'](_0x4d14e0,_0x798586);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 15be8cd..7cba997 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 _0x94a0=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','index','describe','/:id','/:id/members','/:id/teams','getTeams','/:id/users','post','create','update','delete','removeTeams','exports','multer','util','path','connect-timeout'];(function(_0x473463,_0x21da73){var _0x42f406=function(_0x34a5be){while(--_0x34a5be){_0x473463['push'](_0x473463['shift']());}};_0x42f406(++_0x21da73);}(_0x94a0,0xec));var _0x094a=function(_0x1b3f63,_0x5578c9){_0x1b3f63=_0x1b3f63-0x0;var _0x39005d=_0x94a0[_0x1b3f63];return _0x39005d;};'use strict';var multer=require(_0x094a('0x0'));var util=require(_0x094a('0x1'));var path=require(_0x094a('0x2'));var timeout=require(_0x094a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x094a('0x4'));var auth=require(_0x094a('0x5'));var interaction=require(_0x094a('0x6'));var config=require(_0x094a('0x7'));var controller=require(_0x094a('0x8'));router[_0x094a('0x9')]('/',auth[_0x094a('0xa')](),controller[_0x094a('0xb')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x094a('0xc')]);router[_0x094a('0x9')](_0x094a('0xd'),auth[_0x094a('0xa')](),controller['show']);router[_0x094a('0x9')](_0x094a('0xe'),auth[_0x094a('0xa')](),controller['getMembers']);router['get'](_0x094a('0xf'),auth[_0x094a('0xa')](),controller[_0x094a('0x10')]);router[_0x094a('0x9')](_0x094a('0x11'),auth[_0x094a('0xa')](),controller['getAgents']);router[_0x094a('0x12')]('/',auth[_0x094a('0xa')](),controller[_0x094a('0x13')]);router['post'](_0x094a('0xf'),auth[_0x094a('0xa')](),controller['addTeams']);router[_0x094a('0x12')]('/:id/users',auth[_0x094a('0xa')](),controller['addAgents']);router['put'](_0x094a('0xd'),auth['isAuthenticated'](),controller[_0x094a('0x14')]);router[_0x094a('0x15')](_0x094a('0xd'),auth[_0x094a('0xa')](),controller['destroy']);router[_0x094a('0x15')]('/:id/teams',auth[_0x094a('0xa')](),controller[_0x094a('0x16')]);router[_0x094a('0x15')](_0x094a('0x11'),auth[_0x094a('0xa')](),controller['removeAgents']);module[_0x094a('0x17')]=router; \ No newline at end of file +var _0x066a=['post','create','addTeams','addAgents','put','/:id','update','delete','destroy','removeTeams','removeAgents','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller','get','isAuthenticated','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents'];(function(_0x11086d,_0x5207a1){var _0x23a14c=function(_0x524dc8){while(--_0x524dc8){_0x11086d['push'](_0x11086d['shift']());}};_0x23a14c(++_0x5207a1);}(_0x066a,0x1dc));var _0xa066=function(_0x173488,_0x200a8d){_0x173488=_0x173488-0x0;var _0x2b9f38=_0x066a[_0x173488];return _0x2b9f38;};'use strict';var multer=require(_0xa066('0x0'));var util=require(_0xa066('0x1'));var path=require(_0xa066('0x2'));var timeout=require(_0xa066('0x3'));var express=require(_0xa066('0x4'));var router=express[_0xa066('0x5')]();var fs_extra=require(_0xa066('0x6'));var auth=require(_0xa066('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xa066('0x8'));var controller=require(_0xa066('0x9'));router[_0xa066('0xa')]('/',auth['isAuthenticated'](),controller['index']);router['get']('/describe',auth[_0xa066('0xb')](),controller[_0xa066('0xc')]);router[_0xa066('0xa')]('/:id',auth[_0xa066('0xb')](),controller[_0xa066('0xd')]);router[_0xa066('0xa')](_0xa066('0xe'),auth[_0xa066('0xb')](),controller[_0xa066('0xf')]);router[_0xa066('0xa')](_0xa066('0x10'),auth[_0xa066('0xb')](),controller[_0xa066('0x11')]);router['get'](_0xa066('0x12'),auth[_0xa066('0xb')](),controller[_0xa066('0x13')]);router[_0xa066('0x14')]('/',auth['isAuthenticated'](),controller[_0xa066('0x15')]);router['post'](_0xa066('0x10'),auth[_0xa066('0xb')](),controller[_0xa066('0x16')]);router['post']('/:id/users',auth[_0xa066('0xb')](),controller[_0xa066('0x17')]);router[_0xa066('0x18')](_0xa066('0x19'),auth['isAuthenticated'](),controller[_0xa066('0x1a')]);router[_0xa066('0x1b')](_0xa066('0x19'),auth[_0xa066('0xb')](),controller[_0xa066('0x1c')]);router[_0xa066('0x1b')](_0xa066('0x10'),auth[_0xa066('0xb')](),controller[_0xa066('0x1d')]);router['delete']('/:id/users',auth[_0xa066('0xb')](),controller[_0xa066('0x1e')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index de65b7d..75b982e 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 _0x33bf=['sequelize','exports','STRING','INTEGER','ENUM','beepall','roundrobin'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0x33bf,0xa8));var _0xf33b=function(_0x8a7e38,_0x473a5d){_0x8a7e38=_0x8a7e38-0x0;var _0x228609=_0x33bf[_0x8a7e38];return _0x228609;};'use strict';var Sequelize=require(_0xf33b('0x0'));module[_0xf33b('0x1')]={'name':{'type':Sequelize[_0xf33b('0x2')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xf33b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf33b('0x4')]('rrmemory',_0xf33b('0x5'),_0xf33b('0x6'))}}; \ No newline at end of file +var _0x8b06=['name','ENUM','rrmemory','roundrobin','sequelize','exports','STRING'];(function(_0x3c6c1b,_0x82a1e4){var _0x15170e=function(_0x388a43){while(--_0x388a43){_0x3c6c1b['push'](_0x3c6c1b['shift']());}};_0x15170e(++_0x82a1e4);}(_0x8b06,0x138));var _0x68b0=function(_0x2c82bf,_0x7b8a8e){_0x2c82bf=_0x2c82bf-0x0;var _0x1898d0=_0x8b06[_0x2c82bf];return _0x1898d0;};'use strict';var Sequelize=require(_0x68b0('0x0'));module[_0x68b0('0x1')]={'name':{'type':Sequelize[_0x68b0('0x2')],'unique':_0x68b0('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x68b0('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x68b0('0x4')](_0x68b0('0x5'),'beepall',_0x68b0('0x6'))}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.controller.js b/server/api/openchannelQueue/openchannelQueue.controller.js index 2433952..2bda61e 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 _0x35eb=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','OpenchannelQueues','UserProfileResource','end','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','includeAll','findAll','rows','catch','show','params','include','options','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserOpenchannelQueue','order','OpenchannelQueueId','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','%s/%s','SIP','getTeams','Team','pick','addTeams','ids','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_openchannel_queues','ut.TeamId\x20=\x20tq.TeamId','Agents','clone','push','QueryTypes','every','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x35eb,0x1ad));var _0xb35e=function(_0x403fc7,_0x32931a){_0x403fc7=_0x403fc7-0x0;var _0x5d0827=_0x35eb[_0x403fc7];return _0x5d0827;};'use strict';var emlformat=require(_0xb35e('0x0'));var rimraf=require(_0xb35e('0x1'));var zipdir=require(_0xb35e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb35e('0x3'));var moment=require(_0xb35e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xb35e('0x5'));var util=require('util');var path=require(_0xb35e('0x6'));var sox=require(_0xb35e('0x7'));var csv=require(_0xb35e('0x8'));var ejs=require(_0xb35e('0x9'));var fs=require('fs');var fs_extra=require(_0xb35e('0xa'));var _=require(_0xb35e('0xb'));var squel=require(_0xb35e('0xc'));var crypto=require(_0xb35e('0xd'));var jsforce=require(_0xb35e('0xe'));var deskjs=require(_0xb35e('0xf'));var toCsv=require(_0xb35e('0x8'));var querystring=require(_0xb35e('0x10'));var Papa=require('papaparse');var Redis=require(_0xb35e('0x11'));var authService=require(_0xb35e('0x12'));var qs=require(_0xb35e('0x13'));var as=require(_0xb35e('0x14'));var hardwareService=require(_0xb35e('0x15'));var logger=require(_0xb35e('0x16'))(_0xb35e('0x17'));var utils=require(_0xb35e('0x18'));var config=require(_0xb35e('0x19'));var licenseUtil=require(_0xb35e('0x1a'));var db=require('../../mysqldb')['db'];config['redis']=_['defaults'](config[_0xb35e('0x1b')],{'host':_0xb35e('0x1c'),'port':0x18eb});var socket=require(_0xb35e('0x1d'))(new Redis(config[_0xb35e('0x1b')]));require(_0xb35e('0x1e'))[_0xb35e('0x1f')](socket);function respondWithStatusCode(_0x1afa71,_0x357873){_0x357873=_0x357873||0xcc;return function(_0x3b09d2){if(_0x3b09d2){return _0x1afa71['sendStatus'](_0x357873);}return _0x1afa71[_0xb35e('0x20')](_0x357873)['end']();};}function respondWithResult(_0x294a44,_0x14111e){_0x14111e=_0x14111e||0xc8;return function(_0x30c345){if(_0x30c345){return _0x294a44['status'](_0x14111e)[_0xb35e('0x21')](_0x30c345);}};}function respondWithFilteredResult(_0x44f024,_0x1badaa){return function(_0x316572){if(_0x316572){var _0x3caf7f=typeof _0x1badaa[_0xb35e('0x22')]===_0xb35e('0x23')&&typeof _0x1badaa['limit']===_0xb35e('0x23');var _0xd41eea=_0x316572[_0xb35e('0x24')];var _0x377f4c=_0x3caf7f?0x0:_0x1badaa['offset'];var _0x4db63a=_0x3caf7f?_0x316572[_0xb35e('0x24')]:_0x1badaa[_0xb35e('0x22')]+_0x1badaa[_0xb35e('0x25')];var _0x44128c;if(_0x4db63a>=_0xd41eea){_0x4db63a=_0xd41eea;_0x44128c=0xc8;}else{_0x44128c=0xce;}_0x44f024['status'](_0x44128c);return _0x44f024[_0xb35e('0x26')](_0xb35e('0x27'),_0x377f4c+'-'+_0x4db63a+'/'+_0xd41eea)['json'](_0x316572);}return null;};}function patchUpdates(_0x28a111){return function(_0x143b75){try{jsonpatch[_0xb35e('0x28')](_0x143b75,_0x28a111,!![]);}catch(_0xf6ffc3){return BPromise[_0xb35e('0x29')](_0xf6ffc3);}return _0x143b75[_0xb35e('0x2a')]();};}function saveUpdates(_0xd1978b,_0x4585d6){return function(_0xa53adb){if(_0xa53adb){return _0xa53adb[_0xb35e('0x2b')](_0xd1978b)[_0xb35e('0x2c')](function(_0x4f2a99){return _0x4f2a99;});}return null;};}function removeEntity(_0x1cc662,_0x146900){return function(_0x3bebe3){if(_0x3bebe3){return _0x3bebe3[_0xb35e('0x2d')]()[_0xb35e('0x2c')](function(){var _0x17763a=_0x3bebe3[_0xb35e('0x2e')]({'plain':!![]});var _0x2e3d0c=_0xb35e('0x2f');return db[_0xb35e('0x30')]['destroy']({'where':{'type':_0x2e3d0c,'resourceId':_0x17763a['id']}})[_0xb35e('0x2c')](function(){return _0x3bebe3;});})[_0xb35e('0x2c')](function(){_0x1cc662[_0xb35e('0x20')](0xcc)[_0xb35e('0x31')]();});}};}function handleEntityNotFound(_0x29b10b,_0x3adafd){return function(_0x48dda2){if(!_0x48dda2){_0x29b10b[_0xb35e('0x32')](0x194);}return _0x48dda2;};}function handleError(_0x3fb066,_0x261d59){_0x261d59=_0x261d59||0x1f4;return function(_0x143f6d){logger[_0xb35e('0x33')](_0x143f6d[_0xb35e('0x34')]);if(_0x143f6d[_0xb35e('0x35')]){delete _0x143f6d[_0xb35e('0x35')];}_0x3fb066[_0xb35e('0x20')](_0x261d59)[_0xb35e('0x36')](_0x143f6d);};}exports[_0xb35e('0x37')]=function(_0x4bf620,_0x2a8c61){var _0x226e54={},_0x5ef18e={},_0xf6b9fa={'count':0x0,'rows':[]};var _0x599591=_[_0xb35e('0x38')](db[_0xb35e('0x39')][_0xb35e('0x3a')],function(_0x11b8d8){return{'name':_0x11b8d8[_0xb35e('0x3b')],'type':_0x11b8d8[_0xb35e('0x3c')][_0xb35e('0x3d')]};});_0x5ef18e['model']=_[_0xb35e('0x38')](_0x599591,_0xb35e('0x35'));_0x5ef18e[_0xb35e('0x3e')]=_[_0xb35e('0x3f')](_0x4bf620['query']);_0x5ef18e[_0xb35e('0x40')]=_[_0xb35e('0x41')](_0x5ef18e[_0xb35e('0x42')],_0x5ef18e[_0xb35e('0x3e')]);_0x226e54[_0xb35e('0x43')]=_['intersection'](_0x5ef18e[_0xb35e('0x42')],qs[_0xb35e('0x44')](_0x4bf620[_0xb35e('0x3e')]['fields']));_0x226e54[_0xb35e('0x43')]=_0x226e54[_0xb35e('0x43')][_0xb35e('0x45')]?_0x226e54['attributes']:_0x5ef18e[_0xb35e('0x42')];if(!_0x4bf620[_0xb35e('0x3e')][_0xb35e('0x46')](_0xb35e('0x47'))){_0x226e54[_0xb35e('0x25')]=qs[_0xb35e('0x25')](_0x4bf620['query'][_0xb35e('0x25')]);_0x226e54[_0xb35e('0x22')]=qs['offset'](_0x4bf620[_0xb35e('0x3e')][_0xb35e('0x22')]);}_0x226e54['order']=qs[_0xb35e('0x48')](_0x4bf620[_0xb35e('0x3e')]['sort']);_0x226e54[_0xb35e('0x49')]=qs['filters'](_['pick'](_0x4bf620[_0xb35e('0x3e')],_0x5ef18e[_0xb35e('0x40')]),_0x599591);if(_0x4bf620[_0xb35e('0x3e')][_0xb35e('0x4a')]){_0x226e54['where']=_['merge'](_0x226e54['where'],{'$or':_[_0xb35e('0x38')](_0x599591,function(_0x1efe7b){if(_0x1efe7b['type']!==_0xb35e('0x4b')){var _0xc09ddf={};_0xc09ddf[_0x1efe7b['name']]={'$like':'%'+_0x4bf620[_0xb35e('0x3e')][_0xb35e('0x4a')]+'%'};return _0xc09ddf;}})});}_0x226e54=_[_0xb35e('0x4c')]({},_0x226e54,_0x4bf620['options']);var _0x35a7d2={'where':_0x226e54[_0xb35e('0x49')]};return db[_0xb35e('0x39')]['count'](_0x35a7d2)[_0xb35e('0x2c')](function(_0x312865){_0xf6b9fa[_0xb35e('0x24')]=_0x312865;if(_0x4bf620['query'][_0xb35e('0x4d')]){_0x226e54['include']=[{'all':!![]}];}return db['OpenchannelQueue'][_0xb35e('0x4e')](_0x226e54);})[_0xb35e('0x2c')](function(_0x4c008f){_0xf6b9fa[_0xb35e('0x4f')]=_0x4c008f;return _0xf6b9fa;})['then'](respondWithFilteredResult(_0x2a8c61,_0x226e54))[_0xb35e('0x50')](handleError(_0x2a8c61,null));};exports[_0xb35e('0x51')]=function(_0x6d96ee,_0x2295c4){var _0x2fedbc={'raw':!![],'where':{'id':_0x6d96ee[_0xb35e('0x52')]['id']}},_0x5b2b82={};_0x5b2b82[_0xb35e('0x42')]=_[_0xb35e('0x3f')](db[_0xb35e('0x39')][_0xb35e('0x3a')]);_0x5b2b82[_0xb35e('0x3e')]=_['keys'](_0x6d96ee[_0xb35e('0x3e')]);_0x5b2b82['filters']=_[_0xb35e('0x41')](_0x5b2b82[_0xb35e('0x42')],_0x5b2b82[_0xb35e('0x3e')]);_0x2fedbc[_0xb35e('0x43')]=_[_0xb35e('0x41')](_0x5b2b82['model'],qs['fields'](_0x6d96ee[_0xb35e('0x3e')][_0xb35e('0x44')]));_0x2fedbc['attributes']=_0x2fedbc[_0xb35e('0x43')][_0xb35e('0x45')]?_0x2fedbc[_0xb35e('0x43')]:_0x5b2b82['model'];if(_0x6d96ee[_0xb35e('0x3e')][_0xb35e('0x4d')]){_0x2fedbc[_0xb35e('0x53')]=[{'all':!![]}];}_0x2fedbc=_[_0xb35e('0x4c')]({},_0x2fedbc,_0x6d96ee[_0xb35e('0x54')]);return db['OpenchannelQueue'][_0xb35e('0x55')](_0x2fedbc)[_0xb35e('0x2c')](handleEntityNotFound(_0x2295c4,null))['then'](respondWithResult(_0x2295c4,null))[_0xb35e('0x50')](handleError(_0x2295c4,null));};exports[_0xb35e('0x56')]=function(_0x4afee0,_0x2a3068){return db[_0xb35e('0x39')][_0xb35e('0x56')](_0x4afee0[_0xb35e('0x57')],{})[_0xb35e('0x2c')](function(_0x2b153c){var _0x1641da=_0x4afee0[_0xb35e('0x58')][_0xb35e('0x2e')]({'plain':!![]});if(!_0x1641da)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1641da[_0xb35e('0x59')]===_0xb35e('0x58')){var _0x152d3d=_0x2b153c[_0xb35e('0x2e')]({'plain':!![]});var _0x211597=_0xb35e('0x2f');return db[_0xb35e('0x5a')][_0xb35e('0x55')]({'where':{'name':_0x211597,'userProfileId':_0x1641da[_0xb35e('0x5b')]},'raw':!![]})[_0xb35e('0x2c')](function(_0x2732c0){if(_0x2732c0&&_0x2732c0[_0xb35e('0x5c')]===0x0){return db[_0xb35e('0x30')][_0xb35e('0x56')]({'name':_0x152d3d[_0xb35e('0x35')],'resourceId':_0x152d3d['id'],'type':_0x2732c0['name'],'sectionId':_0x2732c0['id']},{})[_0xb35e('0x2c')](function(){return _0x2b153c;});}else{return _0x2b153c;}})[_0xb35e('0x50')](function(_0x45ef17){logger[_0xb35e('0x33')](_0xb35e('0x5d'),_0x45ef17);throw _0x45ef17;});}return _0x2b153c;})[_0xb35e('0x2c')](respondWithResult(_0x2a3068,0xc9))['catch'](handleError(_0x2a3068,null));};exports[_0xb35e('0x2b')]=function(_0x5ca33a,_0x47202f){if(_0x5ca33a[_0xb35e('0x57')]['id']){delete _0x5ca33a[_0xb35e('0x57')]['id'];}return db[_0xb35e('0x39')][_0xb35e('0x55')]({'where':{'id':_0x5ca33a[_0xb35e('0x52')]['id']}})[_0xb35e('0x2c')](handleEntityNotFound(_0x47202f,null))[_0xb35e('0x2c')](saveUpdates(_0x5ca33a[_0xb35e('0x57')],null))[_0xb35e('0x2c')](respondWithResult(_0x47202f,null))[_0xb35e('0x50')](handleError(_0x47202f,null));};exports['destroy']=function(_0x5a9193,_0x1314d9){return db[_0xb35e('0x39')][_0xb35e('0x55')]({'where':{'id':_0x5a9193[_0xb35e('0x52')]['id']}})[_0xb35e('0x2c')](handleEntityNotFound(_0x1314d9,null))[_0xb35e('0x2c')](removeEntity(_0x1314d9,null))[_0xb35e('0x50')](handleError(_0x1314d9,null));};exports['describe']=function(_0x538998,_0xf61923){return db[_0xb35e('0x39')][_0xb35e('0x5e')]()[_0xb35e('0x2c')](respondWithResult(_0xf61923,null))['catch'](handleError(_0xf61923,null));};exports[_0xb35e('0x5f')]=function(_0x4dedcc,_0x8381f,_0x3abb7c){var _0x4a828e={'raw':!![],'where':{}},_0x40ae01={},_0x1ece4d;return db[_0xb35e('0x39')][_0xb35e('0x60')]({'where':{'id':_0x4dedcc[_0xb35e('0x52')]['id']}})[_0xb35e('0x2c')](handleEntityNotFound(_0x8381f,null))[_0xb35e('0x2c')](function(_0x2f33ea){if(_0x2f33ea){_0x1ece4d=_0x2f33ea['get']({'plain':!![]});_0x40ae01['model']=_[_0xb35e('0x3f')](db[_0xb35e('0x61')][_0xb35e('0x3a')]);_0x40ae01[_0xb35e('0x3e')]=_['keys'](_0x4dedcc['query']);_0x40ae01[_0xb35e('0x40')]=_[_0xb35e('0x41')](_0x40ae01['model'],_0x40ae01['query']);_0x4a828e['attributes']=_[_0xb35e('0x41')](_0x40ae01[_0xb35e('0x42')],qs['fields'](_0x4dedcc[_0xb35e('0x3e')][_0xb35e('0x44')]));_0x4a828e['attributes']=_0x4a828e[_0xb35e('0x43')]['length']?_0x4a828e[_0xb35e('0x43')]:_0x40ae01[_0xb35e('0x42')];if(!_0x4dedcc[_0xb35e('0x3e')][_0xb35e('0x46')](_0xb35e('0x47'))){_0x4a828e[_0xb35e('0x25')]=qs[_0xb35e('0x25')](_0x4dedcc[_0xb35e('0x3e')]['limit']);_0x4a828e[_0xb35e('0x22')]=qs[_0xb35e('0x22')](_0x4dedcc['query'][_0xb35e('0x22')]);}_0x4a828e[_0xb35e('0x62')]=qs[_0xb35e('0x48')](_0x4dedcc[_0xb35e('0x3e')][_0xb35e('0x48')]);_0x4a828e['where']=qs['filters'](_['pick'](_0x4dedcc[_0xb35e('0x3e')],_0x40ae01['filters']));_0x4a828e['where'][_0xb35e('0x63')]=_0x2f33ea['id'];if(_0x4dedcc[_0xb35e('0x3e')][_0xb35e('0x4a')]){_0x4a828e[_0xb35e('0x49')]=_[_0xb35e('0x4c')](_0x4a828e['where'],{'$or':_[_0xb35e('0x38')](_0x4a828e['attributes'],function(_0xeaa128){var _0x322e49={};_0x322e49[_0xeaa128]={'$like':'%'+_0x4dedcc[_0xb35e('0x3e')]['filter']+'%'};return _0x322e49;})});}_0x4a828e=_[_0xb35e('0x4c')]({},_0x4a828e,_0x4dedcc[_0xb35e('0x54')]);return db[_0xb35e('0x61')][_0xb35e('0x4e')](_0x4a828e);}})[_0xb35e('0x2c')](function(_0xfeea4d){if(_0xfeea4d){return db[_0xb35e('0x64')][_0xb35e('0x65')]({'where':{'id':_[_0xb35e('0x38')](_0xfeea4d,_0xb35e('0x66')),'role':_0xb35e('0x67')},'attributes':['id',_0xb35e('0x35'),_0xb35e('0x68'),_0xb35e('0x69'),_0xb35e('0x6a')]});}})[_0xb35e('0x2c')](function(_0x59a4ca){if(_0x59a4ca){return{'count':_0x59a4ca[_0xb35e('0x24')],'rows':_['map'](_0x59a4ca['rows'],function(_0xd6c19f){return{'membername':_0xd6c19f['name'],'UserId':_0xd6c19f['id'],'queue_name':_0x1ece4d['name'],'OpenchannelQueueId':_0x1ece4d['id'],'interface':util['format'](_0xb35e('0x6b'),_0xb35e('0x6c'),_0xd6c19f[_0xb35e('0x35')]),'penalty':0x0,'paused':_0xd6c19f[_0xb35e('0x68')],'createdAt':_0xd6c19f[_0xb35e('0x6a')],'updatedAt':_0xd6c19f[_0xb35e('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xb35e('0x2c')](respondWithFilteredResult(_0x8381f,_0x4a828e))[_0xb35e('0x50')](handleError(_0x8381f,null));};exports[_0xb35e('0x6d')]=function(_0xf82bb7,_0x28dc6a,_0x293434){var _0x5ca8e9={};var _0x29ca9f={};var _0x1864a6;var _0x300469;return db[_0xb35e('0x39')][_0xb35e('0x60')]({'where':{'id':_0xf82bb7['params']['id']}})['then'](handleEntityNotFound(_0x28dc6a,null))[_0xb35e('0x2c')](function(_0x519f89){if(_0x519f89){_0x1864a6=_0x519f89;_0x29ca9f[_0xb35e('0x42')]=_[_0xb35e('0x3f')](db[_0xb35e('0x6e')]['rawAttributes']);_0x29ca9f[_0xb35e('0x3e')]=_[_0xb35e('0x3f')](_0xf82bb7[_0xb35e('0x3e')]);_0x29ca9f[_0xb35e('0x40')]=_[_0xb35e('0x41')](_0x29ca9f[_0xb35e('0x42')],_0x29ca9f[_0xb35e('0x3e')]);_0x5ca8e9[_0xb35e('0x43')]=_[_0xb35e('0x41')](_0x29ca9f[_0xb35e('0x42')],qs[_0xb35e('0x44')](_0xf82bb7[_0xb35e('0x3e')][_0xb35e('0x44')]));_0x5ca8e9[_0xb35e('0x43')]=_0x5ca8e9[_0xb35e('0x43')][_0xb35e('0x45')]?_0x5ca8e9[_0xb35e('0x43')]:_0x29ca9f[_0xb35e('0x42')];_0x5ca8e9['order']=qs[_0xb35e('0x48')](_0xf82bb7['query'][_0xb35e('0x48')]);_0x5ca8e9[_0xb35e('0x49')]=qs[_0xb35e('0x40')](_[_0xb35e('0x6f')](_0xf82bb7[_0xb35e('0x3e')],_0x29ca9f[_0xb35e('0x40')]));if(_0xf82bb7[_0xb35e('0x3e')]['filter']){_0x5ca8e9[_0xb35e('0x49')]=_[_0xb35e('0x4c')](_0x5ca8e9[_0xb35e('0x49')],{'$or':_[_0xb35e('0x38')](_0x5ca8e9[_0xb35e('0x43')],function(_0x599be1){var _0x18ee40={};_0x18ee40[_0x599be1]={'$like':'%'+_0xf82bb7['query'][_0xb35e('0x4a')]+'%'};return _0x18ee40;})});}_0x5ca8e9=_['merge']({},_0x5ca8e9,_0xf82bb7[_0xb35e('0x54')]);return _0x1864a6[_0xb35e('0x6d')](_0x5ca8e9);}})[_0xb35e('0x2c')](function(_0x1015b){if(_0x1015b){_0x300469=_0x1015b[_0xb35e('0x45')];if(!_0xf82bb7[_0xb35e('0x3e')][_0xb35e('0x46')](_0xb35e('0x47'))){_0x5ca8e9[_0xb35e('0x25')]=qs[_0xb35e('0x25')](_0xf82bb7[_0xb35e('0x3e')][_0xb35e('0x25')]);_0x5ca8e9[_0xb35e('0x22')]=qs['offset'](_0xf82bb7[_0xb35e('0x3e')][_0xb35e('0x22')]);}return _0x1864a6[_0xb35e('0x6d')](_0x5ca8e9);}})['then'](function(_0x5c273f){if(_0x5c273f){return _0x5c273f?{'count':_0x300469,'rows':_0x5c273f}:null;}})[_0xb35e('0x2c')](respondWithResult(_0x28dc6a,null))['catch'](handleError(_0x28dc6a,null));};exports[_0xb35e('0x70')]=function(_0x5647af,_0x2ff6c8,_0x59e8d3){var _0x5d5b6c=_0x5647af[_0xb35e('0x57')][_0xb35e('0x71')];return db[_0xb35e('0x6e')][_0xb35e('0x4e')]({'where':{'id':_0x5d5b6c},'attributes':['id'],'include':[{'model':db[_0xb35e('0x64')],'as':'Agents','attributes':['id',_0xb35e('0x35'),_0xb35e('0x72'),_0xb35e('0x73'),_0xb35e('0x74')],'raw':!![]}]})[_0xb35e('0x2c')](function(_0x21ce90){if(_0x21ce90){var _0x1c83d4=_[_0xb35e('0x75')](_0x21ce90,function(_0x398e13){var _0x20532c=_0x398e13['get']({'plain':!![]});return _0x20532c['Agents'];});return db[_0xb35e('0x39')][_0xb35e('0x55')]({'where':{'id':_0x5647af['params']['id']}})['then'](function(_0x1d059f){return db[_0xb35e('0x76')][_0xb35e('0x77')](function(_0x259a44){return _0x1d059f[_0xb35e('0x70')](_0x5d5b6c,{'transaction':_0x259a44})[_0xb35e('0x2c')](function(){return BPromise[_0xb35e('0x78')](_0x1c83d4,function(_0x487f1f){return db[_0xb35e('0x61')]['findOrCreate']({'where':{'UserId':_0x487f1f['id'],'OpenchannelQueueId':_0x5647af[_0xb35e('0x52')]['id']},'transaction':_0x259a44});});})[_0xb35e('0x2c')](function(){_0x1c83d4['forEach'](function(_0x8ce821){socket[_0xb35e('0x79')](_0xb35e('0x7a'),{'UserId':_0x8ce821['id'],'OpenchannelQueueId':_0x1d059f['id']});});});});});}})['then'](respondWithStatusCode(_0x2ff6c8,null))[_0xb35e('0x50')](handleError(_0x2ff6c8,null));};exports[_0xb35e('0x7b')]=function(_0x4bc693,_0x15c297,_0x147029){return db[_0xb35e('0x6e')][_0xb35e('0x4e')]({'where':{'id':_0x4bc693['query']['ids']},'attributes':['id'],'include':[{'model':db[_0xb35e('0x64')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xb35e('0x2c')](handleEntityNotFound(_0x15c297,null))['then'](function(_0x121c37){var _0x168fac=_[_0xb35e('0x38')](_0x121c37,'id');var _0x43981e=[];var _0x2eb2b2=[];var _0x3d92d8=squel[_0xb35e('0x7c')]();_0x3d92d8[_0xb35e('0x7d')](_0xb35e('0x7e'))[_0xb35e('0x7f')](_0xb35e('0x80'),'tq')['join']('user_has_teams','ut',_0xb35e('0x81'))[_0xb35e('0x49')]('OpenchannelQueueId\x20=\x20?',_0x4bc693[_0xb35e('0x52')]['id']);for(var _0x4915f2=0x0;_0x4915f2<_0x121c37[_0xb35e('0x45')];_0x4915f2+=0x1){let _0x3be613=_0x121c37[_0x4915f2];for(var _0x400a6d=0x0;_0x400a6d<_0x3be613[_0xb35e('0x82')][_0xb35e('0x45')];_0x400a6d+=0x1){let _0x3cff84=_0x3be613[_0xb35e('0x82')][_0x400a6d];var _0xa22276=_0x3d92d8[_0xb35e('0x83')]();_0xa22276[_0xb35e('0x49')]('ut.UserId\x20=\x20?',_0x3cff84['id']);_0x2eb2b2[_0xb35e('0x84')](db['sequelize']['query'](_0xa22276['toString'](),{'type':db[_0xb35e('0x76')][_0xb35e('0x85')]['SELECT']})['then'](function(_0x53e6c1){if(_0x53e6c1[_0xb35e('0x45')]===0x1){return _0x3cff84['id'];}else{var _0x70d42d=_[_0xb35e('0x86')](_[_0xb35e('0x38')](_0x53e6c1,'TeamId'),function(_0x553ebb){return _[_0xb35e('0x87')](_0x168fac,_0x553ebb);});if(_0x70d42d){return _0x3cff84['id'];}}}));}}return BPromise[_0xb35e('0x88')](_0x2eb2b2)[_0xb35e('0x2c')](function(_0x476905){_0x43981e=_(_0x43981e)[_0xb35e('0x89')](_0x476905)[_0xb35e('0x8a')]()[_0xb35e('0x8b')]();return db[_0xb35e('0x39')][_0xb35e('0x55')]({'where':{'id':_0x4bc693[_0xb35e('0x52')]['id']}})[_0xb35e('0x2c')](function(_0x22eefa){return db[_0xb35e('0x76')][_0xb35e('0x77')](function(_0x261279){return _0x22eefa[_0xb35e('0x7b')](_0x4bc693[_0xb35e('0x3e')][_0xb35e('0x71')],{'transaction':_0x261279})['then'](function(){if(!_[_0xb35e('0x8c')](_0x43981e)){return _0x22eefa[_0xb35e('0x8d')](_0x43981e,{'transaction':_0x261279});}})[_0xb35e('0x2c')](function(){_0x43981e[_0xb35e('0x8e')](function(_0xc04abf){socket[_0xb35e('0x79')](_0xb35e('0x8f'),{'UserId':_0xc04abf,'OpenchannelQueueId':_0x22eefa['id']});});});});});});})['then'](respondWithStatusCode(_0x15c297,null))[_0xb35e('0x50')](handleError(_0x15c297,null));};exports[_0xb35e('0x90')]=function(_0xa89f53,_0x2602a3,_0x54b39e){return db['OpenchannelQueue']['find']({'where':{'id':_0xa89f53[_0xb35e('0x52')]['id']}})['then'](handleEntityNotFound(_0x2602a3,null))[_0xb35e('0x2c')](function(_0x11f666){if(_0x11f666){return _0x11f666[_0xb35e('0x90')](_0xa89f53[_0xb35e('0x57')][_0xb35e('0x71')],_[_0xb35e('0x91')](_0xa89f53[_0xb35e('0x57')],[_0xb35e('0x71'),'id'])||{})[_0xb35e('0x92')](function(_0x5e799d){for(var _0x3ac98c=0x0;_0x3ac98c<_0xa89f53['body'][_0xb35e('0x71')]['length'];_0x3ac98c+=0x1){socket[_0xb35e('0x79')](_0xb35e('0x7a'),{'UserId':Number(_0xa89f53[_0xb35e('0x57')]['ids'][_0x3ac98c]),'OpenchannelQueueId':Number(_0xa89f53[_0xb35e('0x52')]['id'])});}return _0x5e799d;});}})[_0xb35e('0x2c')](respondWithResult(_0x2602a3,null))[_0xb35e('0x50')](handleError(_0x2602a3,null));};exports['removeAgents']=function(_0x4f6e4b,_0x60d212,_0x52c2ec){return db['OpenchannelQueue']['find']({'where':{'id':_0x4f6e4b[_0xb35e('0x52')]['id']}})['then'](handleEntityNotFound(_0x60d212,null))['then'](function(_0x5431ea){if(_0x5431ea){return _0x5431ea[_0xb35e('0x8d')](_0x4f6e4b[_0xb35e('0x3e')]['ids'])[_0xb35e('0x2c')](function(){if(_[_0xb35e('0x93')](_0x4f6e4b[_0xb35e('0x3e')][_0xb35e('0x71')])){for(var _0x2b1aa2=0x0;_0x2b1aa2<_0x4f6e4b[_0xb35e('0x3e')]['ids'][_0xb35e('0x45')];_0x2b1aa2+=0x1){socket[_0xb35e('0x79')](_0xb35e('0x8f'),{'UserId':Number(_0x4f6e4b[_0xb35e('0x3e')][_0xb35e('0x71')][_0x2b1aa2]),'OpenchannelQueueId':Number(_0x4f6e4b['params']['id'])});}}else{socket[_0xb35e('0x79')](_0xb35e('0x8f'),{'UserId':Number(_0x4f6e4b[_0xb35e('0x3e')][_0xb35e('0x71')]),'OpenchannelQueueId':Number(_0x4f6e4b[_0xb35e('0x52')]['id'])});}});}})[_0xb35e('0x2c')](respondWithStatusCode(_0x60d212,null))[_0xb35e('0x50')](handleError(_0x60d212,null));};exports[_0xb35e('0x94')]=function(_0x3c7e39,_0x36b13c,_0x38b1d5){var _0x1861e2={};var _0x16a6ea={};var _0x85a807;var _0x189762;return db[_0xb35e('0x39')][_0xb35e('0x60')]({'where':{'id':_0x3c7e39[_0xb35e('0x52')]['id']}})['then'](handleEntityNotFound(_0x36b13c,null))[_0xb35e('0x2c')](function(_0x432966){if(_0x432966){_0x85a807=_0x432966;_0x16a6ea[_0xb35e('0x42')]=_['keys'](db[_0xb35e('0x64')][_0xb35e('0x3a')]);_0x16a6ea['query']=_[_0xb35e('0x3f')](_0x3c7e39[_0xb35e('0x3e')]);_0x16a6ea['filters']=_[_0xb35e('0x41')](_0x16a6ea[_0xb35e('0x42')],_0x16a6ea[_0xb35e('0x3e')]);_0x1861e2[_0xb35e('0x43')]=_[_0xb35e('0x41')](_0x16a6ea[_0xb35e('0x42')],qs['fields'](_0x3c7e39['query']['fields']));_0x1861e2[_0xb35e('0x43')]=_0x1861e2[_0xb35e('0x43')][_0xb35e('0x45')]?_0x1861e2[_0xb35e('0x43')]:_0x16a6ea[_0xb35e('0x42')];_0x1861e2[_0xb35e('0x62')]=qs[_0xb35e('0x48')](_0x3c7e39[_0xb35e('0x3e')]['sort']);_0x1861e2[_0xb35e('0x49')]=qs[_0xb35e('0x40')](_[_0xb35e('0x6f')](_0x3c7e39[_0xb35e('0x3e')],_0x16a6ea[_0xb35e('0x40')]));if(_0x3c7e39['query'][_0xb35e('0x4a')]){_0x1861e2[_0xb35e('0x49')]=_['merge'](_0x1861e2[_0xb35e('0x49')],{'$or':_[_0xb35e('0x38')](_0x1861e2['attributes'],function(_0x2629ed){var _0x2c6520={};_0x2c6520[_0x2629ed]={'$like':'%'+_0x3c7e39[_0xb35e('0x3e')][_0xb35e('0x4a')]+'%'};return _0x2c6520;})});}_0x1861e2=_[_0xb35e('0x4c')]({},_0x1861e2,_0x3c7e39['options']);return _0x85a807[_0xb35e('0x94')](_0x1861e2);}})[_0xb35e('0x2c')](function(_0x288730){if(_0x288730){_0x189762=_0x288730[_0xb35e('0x45')];if(!_0x3c7e39['query'][_0xb35e('0x46')]('nolimit')){_0x1861e2[_0xb35e('0x25')]=qs['limit'](_0x3c7e39[_0xb35e('0x3e')][_0xb35e('0x25')]);_0x1861e2[_0xb35e('0x22')]=qs[_0xb35e('0x22')](_0x3c7e39[_0xb35e('0x3e')][_0xb35e('0x22')]);}return _0x85a807[_0xb35e('0x94')](_0x1861e2);}})[_0xb35e('0x2c')](function(_0x3691b0){if(_0x3691b0){return _0x3691b0?{'count':_0x189762,'rows':_0x3691b0}:null;}})[_0xb35e('0x2c')](respondWithResult(_0x36b13c,null))[_0xb35e('0x50')](handleError(_0x36b13c,null));}; \ No newline at end of file +var _0xed82=['forEach','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','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','all','union','compact','value','removeAgents','addAgents','omit','spread','userOpenchannelQueue:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','end','status','json','offset','undefined','count','limit','set','apply','save','then','get','OpenchannelQueues','UserProfileResource','destroy','sendStatus','stack','name','send','index','rawAttributes','type','key','map','query','keys','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options','includeAll','include','OpenchannelQueue','catch','show','params','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','findAndCountAll','UserId','agent','openchannelPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','addTeams','ids','Agents','interface','flatMap','sequelize','transaction','each','findOrCreate'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0xed82,0xae));var _0x2ed8=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xed82[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x2ed8('0x0'));var rimraf=require(_0x2ed8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2ed8('0x2'));var rp=require(_0x2ed8('0x3'));var moment=require(_0x2ed8('0x4'));var BPromise=require(_0x2ed8('0x5'));var Mustache=require(_0x2ed8('0x6'));var util=require('util');var path=require('path');var sox=require(_0x2ed8('0x7'));var csv=require(_0x2ed8('0x8'));var ejs=require(_0x2ed8('0x9'));var fs=require('fs');var fs_extra=require(_0x2ed8('0xa'));var _=require(_0x2ed8('0xb'));var squel=require(_0x2ed8('0xc'));var crypto=require('crypto');var jsforce=require(_0x2ed8('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x2ed8('0x8'));var querystring=require('querystring');var Papa=require(_0x2ed8('0xe'));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(_0x2ed8('0xf'));var logger=require(_0x2ed8('0x10'))(_0x2ed8('0x11'));var utils=require(_0x2ed8('0x12'));var config=require(_0x2ed8('0x13'));var licenseUtil=require(_0x2ed8('0x14'));var db=require(_0x2ed8('0x15'))['db'];config[_0x2ed8('0x16')]=_['defaults'](config[_0x2ed8('0x16')],{'host':_0x2ed8('0x17'),'port':0x18eb});var socket=require(_0x2ed8('0x18'))(new Redis(config[_0x2ed8('0x16')]));require(_0x2ed8('0x19'))[_0x2ed8('0x1a')](socket);function respondWithStatusCode(_0x5452f7,_0x547eb9){_0x547eb9=_0x547eb9||0xcc;return function(_0x363827){if(_0x363827){return _0x5452f7['sendStatus'](_0x547eb9);}return _0x5452f7['status'](_0x547eb9)[_0x2ed8('0x1b')]();};}function respondWithResult(_0x1ef8c5,_0x43d268){_0x43d268=_0x43d268||0xc8;return function(_0x3c329c){if(_0x3c329c){return _0x1ef8c5[_0x2ed8('0x1c')](_0x43d268)[_0x2ed8('0x1d')](_0x3c329c);}};}function respondWithFilteredResult(_0x87d236,_0x46ff81){return function(_0x1f3890){if(_0x1f3890){var _0x85cf1=typeof _0x46ff81[_0x2ed8('0x1e')]===_0x2ed8('0x1f')&&typeof _0x46ff81['limit']===_0x2ed8('0x1f');var _0x561843=_0x1f3890[_0x2ed8('0x20')];var _0xeddc10=_0x85cf1?0x0:_0x46ff81['offset'];var _0x3fdddd=_0x85cf1?_0x1f3890['count']:_0x46ff81['offset']+_0x46ff81[_0x2ed8('0x21')];var _0x133660;if(_0x3fdddd>=_0x561843){_0x3fdddd=_0x561843;_0x133660=0xc8;}else{_0x133660=0xce;}_0x87d236[_0x2ed8('0x1c')](_0x133660);return _0x87d236[_0x2ed8('0x22')]('Content-Range',_0xeddc10+'-'+_0x3fdddd+'/'+_0x561843)[_0x2ed8('0x1d')](_0x1f3890);}return null;};}function patchUpdates(_0x906e8b){return function(_0x5e98e0){try{jsonpatch[_0x2ed8('0x23')](_0x5e98e0,_0x906e8b,!![]);}catch(_0x2e390c){return BPromise['reject'](_0x2e390c);}return _0x5e98e0[_0x2ed8('0x24')]();};}function saveUpdates(_0x3efe5b,_0x1a272c){return function(_0x5be8ae){if(_0x5be8ae){return _0x5be8ae['update'](_0x3efe5b)[_0x2ed8('0x25')](function(_0x52f007){return _0x52f007;});}return null;};}function removeEntity(_0x1172c5,_0x3516b6){return function(_0x2ffd4b){if(_0x2ffd4b){return _0x2ffd4b['destroy']()['then'](function(){var _0xe7eba9=_0x2ffd4b[_0x2ed8('0x26')]({'plain':!![]});var _0x2e32b1=_0x2ed8('0x27');return db[_0x2ed8('0x28')][_0x2ed8('0x29')]({'where':{'type':_0x2e32b1,'resourceId':_0xe7eba9['id']}})[_0x2ed8('0x25')](function(){return _0x2ffd4b;});})['then'](function(){_0x1172c5['status'](0xcc)[_0x2ed8('0x1b')]();});}};}function handleEntityNotFound(_0x13240f,_0xc186bd){return function(_0x40f95b){if(!_0x40f95b){_0x13240f[_0x2ed8('0x2a')](0x194);}return _0x40f95b;};}function handleError(_0x3da91e,_0x32d123){_0x32d123=_0x32d123||0x1f4;return function(_0x2b7a8c){logger['error'](_0x2b7a8c[_0x2ed8('0x2b')]);if(_0x2b7a8c[_0x2ed8('0x2c')]){delete _0x2b7a8c[_0x2ed8('0x2c')];}_0x3da91e[_0x2ed8('0x1c')](_0x32d123)[_0x2ed8('0x2d')](_0x2b7a8c);};}exports[_0x2ed8('0x2e')]=function(_0x110fa1,_0x31f2bc){var _0x143cc4={},_0x237a29={},_0x2c719b={'count':0x0,'rows':[]};var _0x1e8235=_['map'](db['OpenchannelQueue'][_0x2ed8('0x2f')],function(_0x14c074){return{'name':_0x14c074['fieldName'],'type':_0x14c074[_0x2ed8('0x30')][_0x2ed8('0x31')]};});_0x237a29['model']=_[_0x2ed8('0x32')](_0x1e8235,'name');_0x237a29[_0x2ed8('0x33')]=_[_0x2ed8('0x34')](_0x110fa1[_0x2ed8('0x33')]);_0x237a29['filters']=_[_0x2ed8('0x35')](_0x237a29[_0x2ed8('0x36')],_0x237a29[_0x2ed8('0x33')]);_0x143cc4[_0x2ed8('0x37')]=_[_0x2ed8('0x35')](_0x237a29[_0x2ed8('0x36')],qs[_0x2ed8('0x38')](_0x110fa1['query']['fields']));_0x143cc4[_0x2ed8('0x37')]=_0x143cc4[_0x2ed8('0x37')][_0x2ed8('0x39')]?_0x143cc4[_0x2ed8('0x37')]:_0x237a29[_0x2ed8('0x36')];if(!_0x110fa1[_0x2ed8('0x33')][_0x2ed8('0x3a')](_0x2ed8('0x3b'))){_0x143cc4[_0x2ed8('0x21')]=qs[_0x2ed8('0x21')](_0x110fa1[_0x2ed8('0x33')][_0x2ed8('0x21')]);_0x143cc4['offset']=qs[_0x2ed8('0x1e')](_0x110fa1[_0x2ed8('0x33')][_0x2ed8('0x1e')]);}_0x143cc4[_0x2ed8('0x3c')]=qs[_0x2ed8('0x3d')](_0x110fa1['query'][_0x2ed8('0x3d')]);_0x143cc4[_0x2ed8('0x3e')]=qs[_0x2ed8('0x3f')](_[_0x2ed8('0x40')](_0x110fa1[_0x2ed8('0x33')],_0x237a29[_0x2ed8('0x3f')]),_0x1e8235);if(_0x110fa1[_0x2ed8('0x33')]['filter']){_0x143cc4['where']=_[_0x2ed8('0x41')](_0x143cc4[_0x2ed8('0x3e')],{'$or':_[_0x2ed8('0x32')](_0x1e8235,function(_0x301991){if(_0x301991[_0x2ed8('0x30')]!=='VIRTUAL'){var _0x9d99b7={};_0x9d99b7[_0x301991[_0x2ed8('0x2c')]]={'$like':'%'+_0x110fa1[_0x2ed8('0x33')][_0x2ed8('0x42')]+'%'};return _0x9d99b7;}})});}_0x143cc4=_[_0x2ed8('0x41')]({},_0x143cc4,_0x110fa1[_0x2ed8('0x43')]);var _0x2958a6={'where':_0x143cc4[_0x2ed8('0x3e')]};return db['OpenchannelQueue'][_0x2ed8('0x20')](_0x2958a6)[_0x2ed8('0x25')](function(_0x577d64){_0x2c719b[_0x2ed8('0x20')]=_0x577d64;if(_0x110fa1[_0x2ed8('0x33')][_0x2ed8('0x44')]){_0x143cc4[_0x2ed8('0x45')]=[{'all':!![]}];}return db[_0x2ed8('0x46')]['findAll'](_0x143cc4);})[_0x2ed8('0x25')](function(_0x23cef4){_0x2c719b['rows']=_0x23cef4;return _0x2c719b;})[_0x2ed8('0x25')](respondWithFilteredResult(_0x31f2bc,_0x143cc4))[_0x2ed8('0x47')](handleError(_0x31f2bc,null));};exports[_0x2ed8('0x48')]=function(_0x657447,_0x71b823){var _0x3c29a7={'raw':!![],'where':{'id':_0x657447[_0x2ed8('0x49')]['id']}},_0x350ebb={};_0x350ebb[_0x2ed8('0x36')]=_[_0x2ed8('0x34')](db[_0x2ed8('0x46')]['rawAttributes']);_0x350ebb[_0x2ed8('0x33')]=_[_0x2ed8('0x34')](_0x657447['query']);_0x350ebb[_0x2ed8('0x3f')]=_['intersection'](_0x350ebb[_0x2ed8('0x36')],_0x350ebb[_0x2ed8('0x33')]);_0x3c29a7[_0x2ed8('0x37')]=_['intersection'](_0x350ebb['model'],qs['fields'](_0x657447[_0x2ed8('0x33')][_0x2ed8('0x38')]));_0x3c29a7['attributes']=_0x3c29a7['attributes'][_0x2ed8('0x39')]?_0x3c29a7['attributes']:_0x350ebb[_0x2ed8('0x36')];if(_0x657447[_0x2ed8('0x33')][_0x2ed8('0x44')]){_0x3c29a7[_0x2ed8('0x45')]=[{'all':!![]}];}_0x3c29a7=_[_0x2ed8('0x41')]({},_0x3c29a7,_0x657447['options']);return db[_0x2ed8('0x46')][_0x2ed8('0x4a')](_0x3c29a7)[_0x2ed8('0x25')](handleEntityNotFound(_0x71b823,null))[_0x2ed8('0x25')](respondWithResult(_0x71b823,null))[_0x2ed8('0x47')](handleError(_0x71b823,null));};exports[_0x2ed8('0x4b')]=function(_0x4feb92,_0x12e8c1){return db['OpenchannelQueue'][_0x2ed8('0x4b')](_0x4feb92[_0x2ed8('0x4c')],{})[_0x2ed8('0x25')](function(_0xef03db){var _0x60e4a5=_0x4feb92['user'][_0x2ed8('0x26')]({'plain':!![]});if(!_0x60e4a5)throw new Error(_0x2ed8('0x4d'));if(_0x60e4a5[_0x2ed8('0x4e')]===_0x2ed8('0x4f')){var _0x2d89db=_0xef03db[_0x2ed8('0x26')]({'plain':!![]});var _0x285b82='OpenchannelQueues';return db[_0x2ed8('0x50')]['find']({'where':{'name':_0x285b82,'userProfileId':_0x60e4a5[_0x2ed8('0x51')]},'raw':!![]})[_0x2ed8('0x25')](function(_0x465491){if(_0x465491&&_0x465491[_0x2ed8('0x52')]===0x0){return db[_0x2ed8('0x28')][_0x2ed8('0x4b')]({'name':_0x2d89db[_0x2ed8('0x2c')],'resourceId':_0x2d89db['id'],'type':_0x465491[_0x2ed8('0x2c')],'sectionId':_0x465491['id']},{})[_0x2ed8('0x25')](function(){return _0xef03db;});}else{return _0xef03db;}})[_0x2ed8('0x47')](function(_0x46c1f3){logger['error'](_0x2ed8('0x53'),_0x46c1f3);throw _0x46c1f3;});}return _0xef03db;})[_0x2ed8('0x25')](respondWithResult(_0x12e8c1,0xc9))[_0x2ed8('0x47')](handleError(_0x12e8c1,null));};exports[_0x2ed8('0x54')]=function(_0x4683b3,_0x4cd99d){if(_0x4683b3[_0x2ed8('0x4c')]['id']){delete _0x4683b3[_0x2ed8('0x4c')]['id'];}return db[_0x2ed8('0x46')][_0x2ed8('0x4a')]({'where':{'id':_0x4683b3[_0x2ed8('0x49')]['id']}})[_0x2ed8('0x25')](handleEntityNotFound(_0x4cd99d,null))[_0x2ed8('0x25')](saveUpdates(_0x4683b3['body'],null))[_0x2ed8('0x25')](respondWithResult(_0x4cd99d,null))[_0x2ed8('0x47')](handleError(_0x4cd99d,null));};exports[_0x2ed8('0x29')]=function(_0x37ea35,_0x25252e){return db[_0x2ed8('0x46')][_0x2ed8('0x4a')]({'where':{'id':_0x37ea35[_0x2ed8('0x49')]['id']}})[_0x2ed8('0x25')](handleEntityNotFound(_0x25252e,null))[_0x2ed8('0x25')](removeEntity(_0x25252e,null))[_0x2ed8('0x47')](handleError(_0x25252e,null));};exports[_0x2ed8('0x55')]=function(_0x113325,_0xfbae7f){return db[_0x2ed8('0x46')]['describe']()[_0x2ed8('0x25')](respondWithResult(_0xfbae7f,null))['catch'](handleError(_0xfbae7f,null));};exports['getMembers']=function(_0x4ad4dc,_0x32f6fe,_0x3730cc){var _0x536d08={'raw':!![],'where':{}},_0x5c5361={},_0x45c02a;return db[_0x2ed8('0x46')][_0x2ed8('0x56')]({'where':{'id':_0x4ad4dc[_0x2ed8('0x49')]['id']}})['then'](handleEntityNotFound(_0x32f6fe,null))[_0x2ed8('0x25')](function(_0x1a9463){if(_0x1a9463){_0x45c02a=_0x1a9463[_0x2ed8('0x26')]({'plain':!![]});_0x5c5361['model']=_[_0x2ed8('0x34')](db[_0x2ed8('0x57')]['rawAttributes']);_0x5c5361['query']=_[_0x2ed8('0x34')](_0x4ad4dc[_0x2ed8('0x33')]);_0x5c5361['filters']=_['intersection'](_0x5c5361['model'],_0x5c5361[_0x2ed8('0x33')]);_0x536d08[_0x2ed8('0x37')]=_[_0x2ed8('0x35')](_0x5c5361['model'],qs['fields'](_0x4ad4dc[_0x2ed8('0x33')][_0x2ed8('0x38')]));_0x536d08['attributes']=_0x536d08[_0x2ed8('0x37')][_0x2ed8('0x39')]?_0x536d08['attributes']:_0x5c5361[_0x2ed8('0x36')];if(!_0x4ad4dc[_0x2ed8('0x33')][_0x2ed8('0x3a')](_0x2ed8('0x3b'))){_0x536d08[_0x2ed8('0x21')]=qs[_0x2ed8('0x21')](_0x4ad4dc['query'][_0x2ed8('0x21')]);_0x536d08[_0x2ed8('0x1e')]=qs[_0x2ed8('0x1e')](_0x4ad4dc[_0x2ed8('0x33')][_0x2ed8('0x1e')]);}_0x536d08['order']=qs[_0x2ed8('0x3d')](_0x4ad4dc[_0x2ed8('0x33')][_0x2ed8('0x3d')]);_0x536d08[_0x2ed8('0x3e')]=qs[_0x2ed8('0x3f')](_['pick'](_0x4ad4dc[_0x2ed8('0x33')],_0x5c5361[_0x2ed8('0x3f')]));_0x536d08[_0x2ed8('0x3e')][_0x2ed8('0x58')]=_0x1a9463['id'];if(_0x4ad4dc[_0x2ed8('0x33')][_0x2ed8('0x42')]){_0x536d08[_0x2ed8('0x3e')]=_[_0x2ed8('0x41')](_0x536d08[_0x2ed8('0x3e')],{'$or':_['map'](_0x536d08['attributes'],function(_0x3faae6){var _0x3cf72e={};_0x3cf72e[_0x3faae6]={'$like':'%'+_0x4ad4dc[_0x2ed8('0x33')]['filter']+'%'};return _0x3cf72e;})});}_0x536d08=_['merge']({},_0x536d08,_0x4ad4dc['options']);return db['UserOpenchannelQueue'][_0x2ed8('0x59')](_0x536d08);}})[_0x2ed8('0x25')](function(_0x274496){if(_0x274496){return db[_0x2ed8('0x5a')][_0x2ed8('0x5b')]({'where':{'id':_[_0x2ed8('0x32')](_0x274496,_0x2ed8('0x5c')),'role':_0x2ed8('0x5d')},'attributes':['id',_0x2ed8('0x2c'),_0x2ed8('0x5e'),_0x2ed8('0x5f'),_0x2ed8('0x60')]});}})['then'](function(_0x302990){if(_0x302990){return{'count':_0x302990[_0x2ed8('0x20')],'rows':_['map'](_0x302990[_0x2ed8('0x61')],function(_0x4d9d05){return{'membername':_0x4d9d05[_0x2ed8('0x2c')],'UserId':_0x4d9d05['id'],'queue_name':_0x45c02a[_0x2ed8('0x2c')],'OpenchannelQueueId':_0x45c02a['id'],'interface':util[_0x2ed8('0x62')](_0x2ed8('0x63'),_0x2ed8('0x64'),_0x4d9d05[_0x2ed8('0x2c')]),'penalty':0x0,'paused':_0x4d9d05[_0x2ed8('0x5e')],'createdAt':_0x4d9d05[_0x2ed8('0x60')],'updatedAt':_0x4d9d05[_0x2ed8('0x5f')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x32f6fe,_0x536d08))[_0x2ed8('0x47')](handleError(_0x32f6fe,null));};exports['getTeams']=function(_0x37a96b,_0x26bf9f,_0x3314d3){var _0x121211={};var _0xf76f07={};var _0x5bcea1;var _0xfff685;return db[_0x2ed8('0x46')][_0x2ed8('0x56')]({'where':{'id':_0x37a96b[_0x2ed8('0x49')]['id']}})[_0x2ed8('0x25')](handleEntityNotFound(_0x26bf9f,null))[_0x2ed8('0x25')](function(_0x1c1950){if(_0x1c1950){_0x5bcea1=_0x1c1950;_0xf76f07[_0x2ed8('0x36')]=_[_0x2ed8('0x34')](db[_0x2ed8('0x65')][_0x2ed8('0x2f')]);_0xf76f07[_0x2ed8('0x33')]=_[_0x2ed8('0x34')](_0x37a96b[_0x2ed8('0x33')]);_0xf76f07[_0x2ed8('0x3f')]=_[_0x2ed8('0x35')](_0xf76f07[_0x2ed8('0x36')],_0xf76f07['query']);_0x121211[_0x2ed8('0x37')]=_[_0x2ed8('0x35')](_0xf76f07['model'],qs[_0x2ed8('0x38')](_0x37a96b[_0x2ed8('0x33')][_0x2ed8('0x38')]));_0x121211[_0x2ed8('0x37')]=_0x121211['attributes'][_0x2ed8('0x39')]?_0x121211[_0x2ed8('0x37')]:_0xf76f07['model'];_0x121211['order']=qs[_0x2ed8('0x3d')](_0x37a96b[_0x2ed8('0x33')][_0x2ed8('0x3d')]);_0x121211[_0x2ed8('0x3e')]=qs['filters'](_[_0x2ed8('0x40')](_0x37a96b[_0x2ed8('0x33')],_0xf76f07['filters']));if(_0x37a96b[_0x2ed8('0x33')][_0x2ed8('0x42')]){_0x121211['where']=_[_0x2ed8('0x41')](_0x121211[_0x2ed8('0x3e')],{'$or':_['map'](_0x121211[_0x2ed8('0x37')],function(_0x58dd83){var _0x227578={};_0x227578[_0x58dd83]={'$like':'%'+_0x37a96b['query'][_0x2ed8('0x42')]+'%'};return _0x227578;})});}_0x121211=_[_0x2ed8('0x41')]({},_0x121211,_0x37a96b[_0x2ed8('0x43')]);return _0x5bcea1[_0x2ed8('0x66')](_0x121211);}})['then'](function(_0x28b561){if(_0x28b561){_0xfff685=_0x28b561[_0x2ed8('0x39')];if(!_0x37a96b[_0x2ed8('0x33')][_0x2ed8('0x3a')](_0x2ed8('0x3b'))){_0x121211[_0x2ed8('0x21')]=qs[_0x2ed8('0x21')](_0x37a96b['query'][_0x2ed8('0x21')]);_0x121211['offset']=qs[_0x2ed8('0x1e')](_0x37a96b[_0x2ed8('0x33')][_0x2ed8('0x1e')]);}return _0x5bcea1[_0x2ed8('0x66')](_0x121211);}})[_0x2ed8('0x25')](function(_0x2fe4c4){if(_0x2fe4c4){return _0x2fe4c4?{'count':_0xfff685,'rows':_0x2fe4c4}:null;}})['then'](respondWithResult(_0x26bf9f,null))[_0x2ed8('0x47')](handleError(_0x26bf9f,null));};exports[_0x2ed8('0x67')]=function(_0x1ea7e9,_0x23e972,_0x368d15){var _0x4e8e6d=_0x1ea7e9[_0x2ed8('0x4c')][_0x2ed8('0x68')];return db[_0x2ed8('0x65')]['findAll']({'where':{'id':_0x4e8e6d},'attributes':['id'],'include':[{'model':db[_0x2ed8('0x5a')],'as':_0x2ed8('0x69'),'attributes':['id',_0x2ed8('0x2c'),'online','voicePause',_0x2ed8('0x6a')],'raw':!![]}]})[_0x2ed8('0x25')](function(_0x472abe){if(_0x472abe){var _0x1d951d=_[_0x2ed8('0x6b')](_0x472abe,function(_0x5d608f){var _0x5aba62=_0x5d608f['get']({'plain':!![]});return _0x5aba62[_0x2ed8('0x69')];});return db[_0x2ed8('0x46')][_0x2ed8('0x4a')]({'where':{'id':_0x1ea7e9[_0x2ed8('0x49')]['id']}})[_0x2ed8('0x25')](function(_0x485ace){return db[_0x2ed8('0x6c')][_0x2ed8('0x6d')](function(_0x329142){return _0x485ace[_0x2ed8('0x67')](_0x4e8e6d,{'transaction':_0x329142})['then'](function(){return BPromise[_0x2ed8('0x6e')](_0x1d951d,function(_0x39679f){return db['UserOpenchannelQueue'][_0x2ed8('0x6f')]({'where':{'UserId':_0x39679f['id'],'OpenchannelQueueId':_0x1ea7e9[_0x2ed8('0x49')]['id']},'transaction':_0x329142});});})[_0x2ed8('0x25')](function(){_0x1d951d[_0x2ed8('0x70')](function(_0x1f2e82){socket[_0x2ed8('0x71')](_0x2ed8('0x72'),{'UserId':_0x1f2e82['id'],'OpenchannelQueueId':_0x485ace['id']});});});});});}})[_0x2ed8('0x25')](respondWithStatusCode(_0x23e972,null))[_0x2ed8('0x47')](handleError(_0x23e972,null));};exports[_0x2ed8('0x73')]=function(_0x50b22a,_0x490032,_0x1c94d8){return db[_0x2ed8('0x65')]['findAll']({'where':{'id':_0x50b22a[_0x2ed8('0x33')][_0x2ed8('0x68')]},'attributes':['id'],'include':[{'model':db[_0x2ed8('0x5a')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0x2ed8('0x25')](handleEntityNotFound(_0x490032,null))[_0x2ed8('0x25')](function(_0x2ed8a2){var _0x3106ac=_[_0x2ed8('0x32')](_0x2ed8a2,'id');var _0xb72973=[];var _0xb4107a=[];var _0x2be8a5=squel[_0x2ed8('0x74')]();_0x2be8a5[_0x2ed8('0x75')](_0x2ed8('0x76'))[_0x2ed8('0x77')](_0x2ed8('0x78'),'tq')[_0x2ed8('0x79')](_0x2ed8('0x7a'),'ut',_0x2ed8('0x7b'))[_0x2ed8('0x3e')](_0x2ed8('0x7c'),_0x50b22a[_0x2ed8('0x49')]['id']);for(var _0x4634c4=0x0;_0x4634c4<_0x2ed8a2[_0x2ed8('0x39')];_0x4634c4+=0x1){let _0x38e788=_0x2ed8a2[_0x4634c4];for(var _0x10b76d=0x0;_0x10b76d<_0x38e788[_0x2ed8('0x69')][_0x2ed8('0x39')];_0x10b76d+=0x1){let _0xe9bbcf=_0x38e788[_0x2ed8('0x69')][_0x10b76d];var _0x22ce5d=_0x2be8a5[_0x2ed8('0x7d')]();_0x22ce5d['where'](_0x2ed8('0x7e'),_0xe9bbcf['id']);_0xb4107a['push'](db['sequelize']['query'](_0x22ce5d[_0x2ed8('0x7f')](),{'type':db[_0x2ed8('0x6c')][_0x2ed8('0x80')][_0x2ed8('0x81')]})['then'](function(_0x102e7c){if(_0x102e7c[_0x2ed8('0x39')]===0x1){return _0xe9bbcf['id'];}else{var _0x3a6fac=_[_0x2ed8('0x82')](_[_0x2ed8('0x32')](_0x102e7c,_0x2ed8('0x83')),function(_0xb96949){return _[_0x2ed8('0x84')](_0x3106ac,_0xb96949);});if(_0x3a6fac){return _0xe9bbcf['id'];}}}));}}return BPromise[_0x2ed8('0x85')](_0xb4107a)[_0x2ed8('0x25')](function(_0x22a6d1){_0xb72973=_(_0xb72973)[_0x2ed8('0x86')](_0x22a6d1)[_0x2ed8('0x87')]()[_0x2ed8('0x88')]();return db[_0x2ed8('0x46')]['find']({'where':{'id':_0x50b22a[_0x2ed8('0x49')]['id']}})[_0x2ed8('0x25')](function(_0x51d272){return db['sequelize'][_0x2ed8('0x6d')](function(_0x49f057){return _0x51d272[_0x2ed8('0x73')](_0x50b22a[_0x2ed8('0x33')][_0x2ed8('0x68')],{'transaction':_0x49f057})[_0x2ed8('0x25')](function(){if(!_['isEmpty'](_0xb72973)){return _0x51d272[_0x2ed8('0x89')](_0xb72973,{'transaction':_0x49f057});}})[_0x2ed8('0x25')](function(){_0xb72973['forEach'](function(_0xf1d99c){socket[_0x2ed8('0x71')]('userOpenchannelQueue:remove',{'UserId':_0xf1d99c,'OpenchannelQueueId':_0x51d272['id']});});});});});});})['then'](respondWithStatusCode(_0x490032,null))['catch'](handleError(_0x490032,null));};exports[_0x2ed8('0x8a')]=function(_0x412605,_0x2de2cb,_0x25844d){return db[_0x2ed8('0x46')]['find']({'where':{'id':_0x412605['params']['id']}})[_0x2ed8('0x25')](handleEntityNotFound(_0x2de2cb,null))[_0x2ed8('0x25')](function(_0x4bae5e){if(_0x4bae5e){return _0x4bae5e[_0x2ed8('0x8a')](_0x412605[_0x2ed8('0x4c')][_0x2ed8('0x68')],_[_0x2ed8('0x8b')](_0x412605[_0x2ed8('0x4c')],['ids','id'])||{})[_0x2ed8('0x8c')](function(_0xdb60ea){for(var _0xc3d1b0=0x0;_0xc3d1b0<_0x412605[_0x2ed8('0x4c')][_0x2ed8('0x68')][_0x2ed8('0x39')];_0xc3d1b0+=0x1){socket[_0x2ed8('0x71')](_0x2ed8('0x72'),{'UserId':Number(_0x412605[_0x2ed8('0x4c')][_0x2ed8('0x68')][_0xc3d1b0]),'OpenchannelQueueId':Number(_0x412605[_0x2ed8('0x49')]['id'])});}return _0xdb60ea;});}})[_0x2ed8('0x25')](respondWithResult(_0x2de2cb,null))[_0x2ed8('0x47')](handleError(_0x2de2cb,null));};exports[_0x2ed8('0x89')]=function(_0x353e28,_0x299fa7,_0x5f29ef){return db[_0x2ed8('0x46')][_0x2ed8('0x4a')]({'where':{'id':_0x353e28[_0x2ed8('0x49')]['id']}})[_0x2ed8('0x25')](handleEntityNotFound(_0x299fa7,null))[_0x2ed8('0x25')](function(_0x55fd46){if(_0x55fd46){return _0x55fd46['removeAgents'](_0x353e28['query'][_0x2ed8('0x68')])[_0x2ed8('0x25')](function(){if(_['isArray'](_0x353e28['query'][_0x2ed8('0x68')])){for(var _0xfc1cb3=0x0;_0xfc1cb3<_0x353e28[_0x2ed8('0x33')]['ids']['length'];_0xfc1cb3+=0x1){socket[_0x2ed8('0x71')](_0x2ed8('0x8d'),{'UserId':Number(_0x353e28['query']['ids'][_0xfc1cb3]),'OpenchannelQueueId':Number(_0x353e28[_0x2ed8('0x49')]['id'])});}}else{socket[_0x2ed8('0x71')](_0x2ed8('0x8d'),{'UserId':Number(_0x353e28[_0x2ed8('0x33')][_0x2ed8('0x68')]),'OpenchannelQueueId':Number(_0x353e28[_0x2ed8('0x49')]['id'])});}});}})[_0x2ed8('0x25')](respondWithStatusCode(_0x299fa7,null))[_0x2ed8('0x47')](handleError(_0x299fa7,null));};exports[_0x2ed8('0x8e')]=function(_0x4282cf,_0x3efa2f,_0x409acf){var _0x62ac92={};var _0x440d54={};var _0x3d3c87;var _0x3ef8c4;return db[_0x2ed8('0x46')][_0x2ed8('0x56')]({'where':{'id':_0x4282cf['params']['id']}})[_0x2ed8('0x25')](handleEntityNotFound(_0x3efa2f,null))[_0x2ed8('0x25')](function(_0xcfc0ab){if(_0xcfc0ab){_0x3d3c87=_0xcfc0ab;_0x440d54[_0x2ed8('0x36')]=_['keys'](db[_0x2ed8('0x5a')]['rawAttributes']);_0x440d54[_0x2ed8('0x33')]=_[_0x2ed8('0x34')](_0x4282cf[_0x2ed8('0x33')]);_0x440d54[_0x2ed8('0x3f')]=_[_0x2ed8('0x35')](_0x440d54[_0x2ed8('0x36')],_0x440d54[_0x2ed8('0x33')]);_0x62ac92[_0x2ed8('0x37')]=_['intersection'](_0x440d54[_0x2ed8('0x36')],qs['fields'](_0x4282cf[_0x2ed8('0x33')][_0x2ed8('0x38')]));_0x62ac92['attributes']=_0x62ac92[_0x2ed8('0x37')][_0x2ed8('0x39')]?_0x62ac92[_0x2ed8('0x37')]:_0x440d54[_0x2ed8('0x36')];_0x62ac92['order']=qs[_0x2ed8('0x3d')](_0x4282cf[_0x2ed8('0x33')]['sort']);_0x62ac92[_0x2ed8('0x3e')]=qs['filters'](_[_0x2ed8('0x40')](_0x4282cf[_0x2ed8('0x33')],_0x440d54[_0x2ed8('0x3f')]));if(_0x4282cf[_0x2ed8('0x33')][_0x2ed8('0x42')]){_0x62ac92['where']=_[_0x2ed8('0x41')](_0x62ac92['where'],{'$or':_[_0x2ed8('0x32')](_0x62ac92[_0x2ed8('0x37')],function(_0x235d81){var _0x133566={};_0x133566[_0x235d81]={'$like':'%'+_0x4282cf['query']['filter']+'%'};return _0x133566;})});}_0x62ac92=_[_0x2ed8('0x41')]({},_0x62ac92,_0x4282cf[_0x2ed8('0x43')]);return _0x3d3c87[_0x2ed8('0x8e')](_0x62ac92);}})[_0x2ed8('0x25')](function(_0x18320a){if(_0x18320a){_0x3ef8c4=_0x18320a[_0x2ed8('0x39')];if(!_0x4282cf[_0x2ed8('0x33')][_0x2ed8('0x3a')]('nolimit')){_0x62ac92[_0x2ed8('0x21')]=qs[_0x2ed8('0x21')](_0x4282cf[_0x2ed8('0x33')]['limit']);_0x62ac92[_0x2ed8('0x1e')]=qs[_0x2ed8('0x1e')](_0x4282cf[_0x2ed8('0x33')][_0x2ed8('0x1e')]);}return _0x3d3c87[_0x2ed8('0x8e')](_0x62ac92);}})[_0x2ed8('0x25')](function(_0x1983b3){if(_0x1983b3){return _0x1983b3?{'count':_0x3ef8c4,'rows':_0x1983b3}:null;}})[_0x2ed8('0x25')](respondWithResult(_0x3efa2f,null))[_0x2ed8('0x47')](handleError(_0x3efa2f,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 0b1cb5a..c82e311 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 _0x02f9=['hook','exports','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x02f9,0x1db));var _0x902f=function(_0x255194,_0x19e1c9){_0x255194=_0x255194-0x0;var _0x100caf=_0x02f9[_0x255194];return _0x100caf;};'use strict';var EventEmitter=require(_0x902f('0x0'));var OpenchannelQueue=require(_0x902f('0x1'))['db'][_0x902f('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x902f('0x3')](0x0);var events={'afterCreate':_0x902f('0x4'),'afterUpdate':_0x902f('0x5'),'afterDestroy':_0x902f('0x6')};function emitEvent(_0x4a971b){return function(_0x39d48d,_0x1f9dfc,_0x12c145){OpenchannelQueueEvents[_0x902f('0x7')](_0x4a971b+':'+_0x39d48d['id'],_0x39d48d);OpenchannelQueueEvents['emit'](_0x4a971b,_0x39d48d);_0x12c145(null);};}for(var e in events){if(events[_0x902f('0x8')](e)){var event=events[e];OpenchannelQueue[_0x902f('0x9')](e,emitEvent(event));}}module[_0x902f('0xa')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x6a19=['emit','hasOwnProperty','events','../../mysqldb','OpenchannelQueue','setMaxListeners','save','update','remove'];(function(_0x4a69c2,_0x236f07){var _0x85dc49=function(_0x15cc73){while(--_0x15cc73){_0x4a69c2['push'](_0x4a69c2['shift']());}};_0x85dc49(++_0x236f07);}(_0x6a19,0x1bb));var _0x96a1=function(_0x133c58,_0x5d85f2){_0x133c58=_0x133c58-0x0;var _0x5937d5=_0x6a19[_0x133c58];return _0x5937d5;};'use strict';var EventEmitter=require(_0x96a1('0x0'));var OpenchannelQueue=require(_0x96a1('0x1'))['db'][_0x96a1('0x2')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x96a1('0x3')](0x0);var events={'afterCreate':_0x96a1('0x4'),'afterUpdate':_0x96a1('0x5'),'afterDestroy':_0x96a1('0x6')};function emitEvent(_0x804999){return function(_0xb5264a,_0x46509e,_0x276412){OpenchannelQueueEvents[_0x96a1('0x7')](_0x804999+':'+_0xb5264a['id'],_0xb5264a);OpenchannelQueueEvents['emit'](_0x804999,_0xb5264a);_0x276412(null);};}for(var e in events){if(events[_0x96a1('0x8')](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 67a2bff..4d26aa9 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 _0x65cb=['bluebird','request-promise','rimraf','../../config/environment','./openchannelQueue.attributes','define','OpenchannelQueue','openchannel_queues','lodash','util','api'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0x65cb,0x1e1));var _0xb65c=function(_0x1f179f,_0x2bd526){_0x1f179f=_0x1f179f-0x0;var _0x4b77b2=_0x65cb[_0x1f179f];return _0x4b77b2;};'use strict';var _=require(_0xb65c('0x0'));var util=require(_0xb65c('0x1'));var logger=require('../../config/logger')(_0xb65c('0x2'));var moment=require('moment');var BPromise=require(_0xb65c('0x3'));var rp=require(_0xb65c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb65c('0x5'));var config=require(_0xb65c('0x6'));var attributes=require(_0xb65c('0x7'));module['exports']=function(_0x7d4467,_0xe257eb){return _0x7d4467[_0xb65c('0x8')](_0xb65c('0x9'),attributes,{'tableName':_0xb65c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8085=['OpenchannelQueue','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./openchannelQueue.attributes','exports'];(function(_0x1ac595,_0x5d2081){var _0x455fff=function(_0x3043ee){while(--_0x3043ee){_0x1ac595['push'](_0x1ac595['shift']());}};_0x455fff(++_0x5d2081);}(_0x8085,0x12d));var _0x5808=function(_0x67f95e,_0x3ca797){_0x67f95e=_0x67f95e-0x0;var _0x538f5a=_0x8085[_0x67f95e];return _0x538f5a;};'use strict';var _=require(_0x5808('0x0'));var util=require(_0x5808('0x1'));var logger=require(_0x5808('0x2'))(_0x5808('0x3'));var moment=require(_0x5808('0x4'));var BPromise=require('bluebird');var rp=require(_0x5808('0x5'));var fs=require('fs');var path=require(_0x5808('0x6'));var rimraf=require(_0x5808('0x7'));var config=require(_0x5808('0x8'));var attributes=require(_0x5808('0x9'));module[_0x5808('0xa')]=function(_0xfa5f1e,_0x378a47){return _0xfa5f1e['define'](_0x5808('0xb'),attributes,{'tableName':'openchannel_queues','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 6f5d581..6475a5b 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 _0xb700=['options','raw','where','attributes','include','map','model','then','debug','OpenchannelQueue','find','catch','ShowOpenchannelQueue','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','http','redis','defaults','localhost','socket.io-emitter','./openchannelQueue.socket','register','request','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','GetOpenchannelQueue','findAll'];(function(_0x2ac209,_0x3946ae){var _0x366442=function(_0x190e6e){while(--_0x190e6e){_0x2ac209['push'](_0x2ac209['shift']());}};_0x366442(++_0x3946ae);}(_0xb700,0x12c));var _0x0b70=function(_0x3299d1,_0x545733){_0x3299d1=_0x3299d1-0x0;var _0x44356e=_0xb700[_0x3299d1];return _0x44356e;};'use strict';var _=require(_0x0b70('0x0'));var util=require(_0x0b70('0x1'));var moment=require('moment');var BPromise=require(_0x0b70('0x2'));var rs=require(_0x0b70('0x3'));var fs=require('fs');var Redis=require(_0x0b70('0x4'));var db=require(_0x0b70('0x5'))['db'];var utils=require(_0x0b70('0x6'));var logger=require(_0x0b70('0x7'))(_0x0b70('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0b70('0x9')]({'port':0x232a});config[_0x0b70('0xa')]=_[_0x0b70('0xb')](config['redis'],{'host':_0x0b70('0xc'),'port':0x18eb});var socket=require(_0x0b70('0xd'))(new Redis(config[_0x0b70('0xa')]));require(_0x0b70('0xe'))[_0x0b70('0xf')](socket);function respondWithRpcPromise(_0x423110,_0x4e55f6,_0x491344){return new BPromise(function(_0x3787e8,_0x3d6295){return client[_0x0b70('0x10')](_0x423110,_0x491344)['then'](function(_0x23680d){logger['info'](_0x0b70('0x11'),_0x4e55f6,_0x0b70('0x12'));logger['debug'](_0x0b70('0x13'),_0x4e55f6,'request\x20sent',JSON[_0x0b70('0x14')](_0x23680d));if(_0x23680d[_0x0b70('0x15')]){if(_0x23680d[_0x0b70('0x15')][_0x0b70('0x16')]===0x1f4){logger['error'](_0x0b70('0x11'),_0x4e55f6,_0x23680d[_0x0b70('0x15')][_0x0b70('0x17')]);return _0x3d6295(_0x23680d[_0x0b70('0x15')][_0x0b70('0x17')]);}logger[_0x0b70('0x15')](_0x0b70('0x11'),_0x4e55f6,_0x23680d['error'][_0x0b70('0x17')]);return _0x3787e8(_0x23680d['error'][_0x0b70('0x17')]);}else{logger[_0x0b70('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x4e55f6,'request\x20sent');_0x3787e8(_0x23680d[_0x0b70('0x19')][_0x0b70('0x17')]);}})['catch'](function(_0x8cc3e4){logger[_0x0b70('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x4e55f6,_0x8cc3e4);_0x3d6295(_0x8cc3e4);});});}exports[_0x0b70('0x1a')]=function(_0xcdf96a){var _0x8a8531=this;return new Promise(function(_0x30f279,_0x4a39b1){return db['OpenchannelQueue'][_0x0b70('0x1b')]({'raw':_0xcdf96a['options']?_0xcdf96a[_0x0b70('0x1c')][_0x0b70('0x1d')]===undefined?!![]:![]:!![],'where':_0xcdf96a[_0x0b70('0x1c')]?_0xcdf96a[_0x0b70('0x1c')][_0x0b70('0x1e')]||null:null,'attributes':_0xcdf96a[_0x0b70('0x1c')]?_0xcdf96a[_0x0b70('0x1c')][_0x0b70('0x1f')]||null:null,'limit':_0xcdf96a['options']?_0xcdf96a[_0x0b70('0x1c')]['limit']||null:null,'include':_0xcdf96a[_0x0b70('0x1c')]?_0xcdf96a[_0x0b70('0x1c')][_0x0b70('0x20')]?_[_0x0b70('0x21')](_0xcdf96a[_0x0b70('0x1c')]['include'],function(_0x167a16){return{'model':db[_0x167a16['model']],'as':_0x167a16['as'],'attributes':_0x167a16[_0x0b70('0x1f')],'include':_0x167a16['include']?_[_0x0b70('0x21')](_0x167a16[_0x0b70('0x20')],function(_0x7c8a6a){return{'model':db[_0x7c8a6a[_0x0b70('0x22')]],'as':_0x7c8a6a['as'],'attributes':_0x7c8a6a[_0x0b70('0x1f')],'include':_0x7c8a6a['include']?_[_0x0b70('0x21')](_0x7c8a6a['include'],function(_0x2ca8e0){return{'model':db[_0x2ca8e0[_0x0b70('0x22')]],'as':_0x2ca8e0['as'],'attributes':_0x2ca8e0[_0x0b70('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0b70('0x23')](function(_0x1a506b){logger[_0x0b70('0x18')](_0x0b70('0x1a'),_0xcdf96a);logger[_0x0b70('0x24')](_0x0b70('0x1a'),_0xcdf96a,JSON[_0x0b70('0x14')](_0x1a506b));_0x30f279(_0x1a506b);})['catch'](function(_0x1bff37){logger['error']('GetOpenchannelQueue',_0x1bff37[_0x0b70('0x17')],_0xcdf96a);_0x4a39b1(_0x8a8531['error'](0x1f4,_0x1bff37[_0x0b70('0x17')]));});});};exports['ShowOpenchannelQueue']=function(_0xfe58a5){var _0x16566c=this;return new Promise(function(_0x31306d,_0x573ca7){return db[_0x0b70('0x25')][_0x0b70('0x26')]({'raw':_0xfe58a5['options']?_0xfe58a5['options'][_0x0b70('0x1d')]===undefined?!![]:![]:!![],'where':_0xfe58a5[_0x0b70('0x1c')]?_0xfe58a5[_0x0b70('0x1c')][_0x0b70('0x1e')]||null:null,'attributes':_0xfe58a5[_0x0b70('0x1c')]?_0xfe58a5[_0x0b70('0x1c')][_0x0b70('0x1f')]||null:null,'include':_0xfe58a5[_0x0b70('0x1c')]?_0xfe58a5[_0x0b70('0x1c')][_0x0b70('0x20')]?_[_0x0b70('0x21')](_0xfe58a5['options']['include'],function(_0x5c1f16){return{'model':db[_0x5c1f16[_0x0b70('0x22')]],'as':_0x5c1f16['as'],'attributes':_0x5c1f16[_0x0b70('0x1f')],'include':_0x5c1f16['include']?_[_0x0b70('0x21')](_0x5c1f16[_0x0b70('0x20')],function(_0x47b1ef){return{'model':db[_0x47b1ef[_0x0b70('0x22')]],'as':_0x47b1ef['as'],'attributes':_0x47b1ef['attributes'],'include':_0x47b1ef[_0x0b70('0x20')]?_[_0x0b70('0x21')](_0x47b1ef[_0x0b70('0x20')],function(_0x309516){return{'model':db[_0x309516[_0x0b70('0x22')]],'as':_0x309516['as'],'attributes':_0x309516[_0x0b70('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x0b70('0x23')](function(_0x36ce9a){logger[_0x0b70('0x18')]('ShowOpenchannelQueue',_0xfe58a5);logger[_0x0b70('0x24')]('ShowOpenchannelQueue',_0xfe58a5,JSON[_0x0b70('0x14')](_0x36ce9a));_0x31306d(_0x36ce9a);})[_0x0b70('0x27')](function(_0x1e9591){logger[_0x0b70('0x15')](_0x0b70('0x28'),_0x1e9591[_0x0b70('0x17')],_0xfe58a5);_0x573ca7(_0x16566c[_0x0b70('0x15')](0x1f4,_0x1e9591[_0x0b70('0x17')]));});});}; \ No newline at end of file +var _0x1084=['model','debug','catch','ShowOpenchannelQueue','find','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','socket.io-emitter','./openchannelQueue.socket','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','GetOpenchannelQueue','OpenchannelQueue','findAll','options','raw','attributes','limit','map','include'];(function(_0x563e52,_0x28a5d1){var _0x194b5f=function(_0x57ae59){while(--_0x57ae59){_0x563e52['push'](_0x563e52['shift']());}};_0x194b5f(++_0x28a5d1);}(_0x1084,0xae));var _0x4108=function(_0x873ab6,_0x2fd0c9){_0x873ab6=_0x873ab6-0x0;var _0x378292=_0x1084[_0x873ab6];return _0x378292;};'use strict';var _=require(_0x4108('0x0'));var util=require(_0x4108('0x1'));var moment=require(_0x4108('0x2'));var BPromise=require(_0x4108('0x3'));var rs=require(_0x4108('0x4'));var fs=require('fs');var Redis=require(_0x4108('0x5'));var db=require(_0x4108('0x6'))['db'];var utils=require(_0x4108('0x7'));var logger=require(_0x4108('0x8'))(_0x4108('0x9'));var config=require(_0x4108('0xa'));var jayson=require(_0x4108('0xb'));var client=jayson[_0x4108('0xc')]['http']({'port':0x232a});config[_0x4108('0xd')]=_[_0x4108('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4108('0xf'))(new Redis(config['redis']));require(_0x4108('0x10'))['register'](socket);function respondWithRpcPromise(_0x28c237,_0x303602,_0x4943da){return new BPromise(function(_0x37d571,_0x2aa891){return client[_0x4108('0x11')](_0x28c237,_0x4943da)[_0x4108('0x12')](function(_0x4c295f){logger[_0x4108('0x13')](_0x4108('0x14'),_0x303602,_0x4108('0x15'));logger['debug'](_0x4108('0x16'),_0x303602,_0x4108('0x15'),JSON[_0x4108('0x17')](_0x4c295f));if(_0x4c295f[_0x4108('0x18')]){if(_0x4c295f['error'][_0x4108('0x19')]===0x1f4){logger[_0x4108('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x303602,_0x4c295f['error'][_0x4108('0x1a')]);return _0x2aa891(_0x4c295f['error'][_0x4108('0x1a')]);}logger[_0x4108('0x18')]('OpenchannelQueue,\x20%s,\x20%s',_0x303602,_0x4c295f[_0x4108('0x18')][_0x4108('0x1a')]);return _0x37d571(_0x4c295f['error'][_0x4108('0x1a')]);}else{logger[_0x4108('0x13')](_0x4108('0x14'),_0x303602,_0x4108('0x15'));_0x37d571(_0x4c295f['result'][_0x4108('0x1a')]);}})['catch'](function(_0x27a7ee){logger['error']('OpenchannelQueue,\x20%s,\x20%s',_0x303602,_0x27a7ee);_0x2aa891(_0x27a7ee);});});}exports[_0x4108('0x1b')]=function(_0x2540d9){var _0x35a1d7=this;return new Promise(function(_0xd5733b,_0x262737){return db[_0x4108('0x1c')][_0x4108('0x1d')]({'raw':_0x2540d9[_0x4108('0x1e')]?_0x2540d9['options'][_0x4108('0x1f')]===undefined?!![]:![]:!![],'where':_0x2540d9['options']?_0x2540d9[_0x4108('0x1e')]['where']||null:null,'attributes':_0x2540d9[_0x4108('0x1e')]?_0x2540d9[_0x4108('0x1e')][_0x4108('0x20')]||null:null,'limit':_0x2540d9['options']?_0x2540d9[_0x4108('0x1e')][_0x4108('0x21')]||null:null,'include':_0x2540d9['options']?_0x2540d9[_0x4108('0x1e')]['include']?_[_0x4108('0x22')](_0x2540d9[_0x4108('0x1e')][_0x4108('0x23')],function(_0x4f9125){return{'model':db[_0x4f9125[_0x4108('0x24')]],'as':_0x4f9125['as'],'attributes':_0x4f9125[_0x4108('0x20')],'include':_0x4f9125[_0x4108('0x23')]?_[_0x4108('0x22')](_0x4f9125[_0x4108('0x23')],function(_0x233739){return{'model':db[_0x233739[_0x4108('0x24')]],'as':_0x233739['as'],'attributes':_0x233739[_0x4108('0x20')],'include':_0x233739[_0x4108('0x23')]?_[_0x4108('0x22')](_0x233739[_0x4108('0x23')],function(_0x35a0ae){return{'model':db[_0x35a0ae[_0x4108('0x24')]],'as':_0x35a0ae['as'],'attributes':_0x35a0ae[_0x4108('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4108('0x12')](function(_0x1c13ff){logger[_0x4108('0x13')](_0x4108('0x1b'),_0x2540d9);logger[_0x4108('0x25')](_0x4108('0x1b'),_0x2540d9,JSON['stringify'](_0x1c13ff));_0xd5733b(_0x1c13ff);})[_0x4108('0x26')](function(_0x57193d){logger[_0x4108('0x18')]('GetOpenchannelQueue',_0x57193d[_0x4108('0x1a')],_0x2540d9);_0x262737(_0x35a1d7[_0x4108('0x18')](0x1f4,_0x57193d[_0x4108('0x1a')]));});});};exports[_0x4108('0x27')]=function(_0x368843){var _0x34452a=this;return new Promise(function(_0x460393,_0x1fe229){return db[_0x4108('0x1c')][_0x4108('0x28')]({'raw':_0x368843[_0x4108('0x1e')]?_0x368843[_0x4108('0x1e')][_0x4108('0x1f')]===undefined?!![]:![]:!![],'where':_0x368843['options']?_0x368843[_0x4108('0x1e')][_0x4108('0x29')]||null:null,'attributes':_0x368843[_0x4108('0x1e')]?_0x368843['options'][_0x4108('0x20')]||null:null,'include':_0x368843[_0x4108('0x1e')]?_0x368843[_0x4108('0x1e')][_0x4108('0x23')]?_[_0x4108('0x22')](_0x368843['options']['include'],function(_0x1b73bd){return{'model':db[_0x1b73bd[_0x4108('0x24')]],'as':_0x1b73bd['as'],'attributes':_0x1b73bd['attributes'],'include':_0x1b73bd['include']?_['map'](_0x1b73bd[_0x4108('0x23')],function(_0x13d421){return{'model':db[_0x13d421[_0x4108('0x24')]],'as':_0x13d421['as'],'attributes':_0x13d421[_0x4108('0x20')],'include':_0x13d421[_0x4108('0x23')]?_[_0x4108('0x22')](_0x13d421[_0x4108('0x23')],function(_0x25995c){return{'model':db[_0x25995c[_0x4108('0x24')]],'as':_0x25995c['as'],'attributes':_0x25995c[_0x4108('0x20')]};}):[]};}):[]};}):[]:[]})[_0x4108('0x12')](function(_0x7bb470){logger[_0x4108('0x13')]('ShowOpenchannelQueue',_0x368843);logger[_0x4108('0x25')]('ShowOpenchannelQueue',_0x368843,JSON['stringify'](_0x7bb470));_0x460393(_0x7bb470);})['catch'](function(_0x49ef57){logger[_0x4108('0x18')](_0x4108('0x27'),_0x49ef57[_0x4108('0x1a')],_0x368843);_0x1fe229(_0x34452a[_0x4108('0x18')](0x1f4,_0x49ef57[_0x4108('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index a6f9e50..a33d99e 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 _0xdcdf=['update','emit','removeListener','length','openchannelQueue:','save','remove'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xdcdf,0x1d3));var _0xfdcd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdcdf[_0x3dd15e];return _0x231fd0;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xfdcd('0x0'),_0xfdcd('0x1'),_0xfdcd('0x2')];function createListener(_0x5cdf37,_0x4473d0){return function(_0x46afa8){_0x4473d0[_0xfdcd('0x3')](_0x5cdf37,_0x46afa8);};}function removeListener(_0x4b00aa,_0x18d7fc){return function(){OpenchannelQueueEvents[_0xfdcd('0x4')](_0x4b00aa,_0x18d7fc);};}exports['register']=function(_0x60e028){for(var _0x5773c1=0x0,_0x5640b6=events[_0xfdcd('0x5')];_0x5773c1<_0x5640b6;_0x5773c1++){var _0x47c7a6=events[_0x5773c1];var _0x46f5b1=createListener(_0xfdcd('0x6')+_0x47c7a6,_0x60e028);OpenchannelQueueEvents['on'](_0x47c7a6,_0x46f5b1);}}; \ No newline at end of file +var _0xf2d5=['removeListener','register','length','openchannelQueue:','./openchannelQueue.events','save','remove','update','emit'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xf2d5,0x151));var _0x5f2d=function(_0x4afa52,_0x167126){_0x4afa52=_0x4afa52-0x0;var _0x1185b3=_0xf2d5[_0x4afa52];return _0x1185b3;};'use strict';var OpenchannelQueueEvents=require(_0x5f2d('0x0'));var events=[_0x5f2d('0x1'),_0x5f2d('0x2'),_0x5f2d('0x3')];function createListener(_0x129b03,_0x21cb18){return function(_0x2033b1){_0x21cb18[_0x5f2d('0x4')](_0x129b03,_0x2033b1);};}function removeListener(_0x14aa3b,_0x2c446c){return function(){OpenchannelQueueEvents[_0x5f2d('0x5')](_0x14aa3b,_0x2c446c);};}exports[_0x5f2d('0x6')]=function(_0x27a027){for(var _0x497a16=0x0,_0x45bc0e=events[_0x5f2d('0x7')];_0x497a16<_0x45bc0e;_0x497a16++){var _0x43a8dd=events[_0x497a16];var _0x4a177=createListener(_0x5f2d('0x8')+_0x43a8dd,_0x27a027);OpenchannelQueueEvents['on'](_0x43a8dd,_0x4a177);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index 2149929..7294ad2 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 _0x4aec=['get','isAuthenticated','/describe','describe','/:id','post','create','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueueReport.controller'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x4aec,0x128));var _0xc4ae=function(_0x2e3768,_0x2acc7d){_0x2e3768=_0x2e3768-0x0;var _0x280878=_0x4aec[_0x2e3768];return _0x280878;};'use strict';var multer=require('multer');var util=require(_0xc4ae('0x0'));var path=require(_0xc4ae('0x1'));var timeout=require(_0xc4ae('0x2'));var express=require(_0xc4ae('0x3'));var router=express[_0xc4ae('0x4')]();var fs_extra=require(_0xc4ae('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc4ae('0x6'));var controller=require(_0xc4ae('0x7'));router[_0xc4ae('0x8')]('/',auth[_0xc4ae('0x9')](),controller['index']);router[_0xc4ae('0x8')](_0xc4ae('0xa'),auth['isAuthenticated'](),controller[_0xc4ae('0xb')]);router[_0xc4ae('0x8')](_0xc4ae('0xc'),auth['isAuthenticated'](),controller['show']);router[_0xc4ae('0xd')]('/',auth[_0xc4ae('0x9')](),controller[_0xc4ae('0xe')]);router[_0xc4ae('0xf')](_0xc4ae('0xc'),auth[_0xc4ae('0x9')](),controller[_0xc4ae('0x10')]);router['delete'](_0xc4ae('0xc'),auth[_0xc4ae('0x9')](),controller[_0xc4ae('0x11')]);module[_0xc4ae('0x12')]=router; \ No newline at end of file +var _0x9715=['put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create'];(function(_0x5ad866,_0x63f8b0){var _0x231923=function(_0x3d15ad){while(--_0x3d15ad){_0x5ad866['push'](_0x5ad866['shift']());}};_0x231923(++_0x63f8b0);}(_0x9715,0x193));var _0x5971=function(_0x17e2e7,_0xe9e1d0){_0x17e2e7=_0x17e2e7-0x0;var _0x2ed751=_0x9715[_0x17e2e7];return _0x2ed751;};'use strict';var multer=require(_0x5971('0x0'));var util=require(_0x5971('0x1'));var path=require(_0x5971('0x2'));var timeout=require(_0x5971('0x3'));var express=require(_0x5971('0x4'));var router=express[_0x5971('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x5971('0x6'));var interaction=require(_0x5971('0x7'));var config=require(_0x5971('0x8'));var controller=require('./openchannelQueueReport.controller');router[_0x5971('0x9')]('/',auth[_0x5971('0xa')](),controller[_0x5971('0xb')]);router['get'](_0x5971('0xc'),auth[_0x5971('0xa')](),controller[_0x5971('0xd')]);router['get'](_0x5971('0xe'),auth['isAuthenticated'](),controller['show']);router[_0x5971('0xf')]('/',auth[_0x5971('0xa')](),controller[_0x5971('0x10')]);router[_0x5971('0x11')]('/:id',auth[_0x5971('0xa')](),controller['update']);router[_0x5971('0x12')](_0x5971('0xe'),auth[_0x5971('0xa')](),controller[_0x5971('0x13')]);module[_0x5971('0x14')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index c6fa0b7..f620242 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 _0x3ad5=['DATE','moment','exports','STRING'];(function(_0x3c2e4a,_0x5f4d6f){var _0x5ce412=function(_0x9db43b){while(--_0x9db43b){_0x3c2e4a['push'](_0x3c2e4a['shift']());}};_0x5ce412(++_0x5f4d6f);}(_0x3ad5,0xe9));var _0x53ad=function(_0x31b212,_0x517c48){_0x31b212=_0x31b212-0x0;var _0x4ae848=_0x3ad5[_0x31b212];return _0x4ae848;};'use strict';var moment=require(_0x53ad('0x0'));var Sequelize=require('sequelize');module[_0x53ad('0x1')]={'uniqueid':{'type':Sequelize[_0x53ad('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x53ad('0x2')]},'joinAt':{'type':Sequelize[_0x53ad('0x3')]},'leaveAt':{'type':Sequelize[_0x53ad('0x3')]},'acceptAt':{'type':Sequelize[_0x53ad('0x3')]},'exitAt':{'type':Sequelize[_0x53ad('0x3')]},'reason':{'type':Sequelize[_0x53ad('0x2')]}}; \ No newline at end of file +var _0x75b8=['exports','STRING','DATE','moment','sequelize'];(function(_0xe8c161,_0x45b25c){var _0x5d90e6=function(_0x1fa083){while(--_0x1fa083){_0xe8c161['push'](_0xe8c161['shift']());}};_0x5d90e6(++_0x45b25c);}(_0x75b8,0x1e8));var _0x875b=function(_0x217c2e,_0x358f06){_0x217c2e=_0x217c2e-0x0;var _0x22b7d8=_0x75b8[_0x217c2e];return _0x22b7d8;};'use strict';var moment=require(_0x875b('0x0'));var Sequelize=require(_0x875b('0x1'));module[_0x875b('0x2')]={'uniqueid':{'type':Sequelize[_0x875b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x875b('0x3')]},'joinAt':{'type':Sequelize[_0x875b('0x4')]},'leaveAt':{'type':Sequelize[_0x875b('0x4')]},'acceptAt':{'type':Sequelize[_0x875b('0x4')]},'exitAt':{'type':Sequelize[_0x875b('0x4')]},'reason':{'type':Sequelize[_0x875b('0x3')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index d0a5e91..b212bab 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 _0xce3f=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','offset','count','set','reject','update','error','stack','name','status','send','index','map','OpenchannelQueueReport','rawAttributes','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','then','includeAll','include','rows','catch','params','find','create','body','destroy','describe','eml-format','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'];(function(_0x114926,_0xdaab78){var _0x25d903=function(_0x23a307){while(--_0x23a307){_0x114926['push'](_0x114926['shift']());}};_0x25d903(++_0xdaab78);}(_0xce3f,0x10f));var _0xfce3=function(_0x55f8b4,_0x43f30d){_0x55f8b4=_0x55f8b4-0x0;var _0x2475f9=_0xce3f[_0x55f8b4];return _0x2475f9;};'use strict';var emlformat=require(_0xfce3('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xfce3('0x1'));var rp=require(_0xfce3('0x2'));var moment=require(_0xfce3('0x3'));var BPromise=require(_0xfce3('0x4'));var Mustache=require(_0xfce3('0x5'));var util=require(_0xfce3('0x6'));var path=require(_0xfce3('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfce3('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfce3('0x9'));var squel=require(_0xfce3('0xa'));var crypto=require('crypto');var jsforce=require(_0xfce3('0xb'));var deskjs=require(_0xfce3('0xc'));var toCsv=require(_0xfce3('0xd'));var querystring=require(_0xfce3('0xe'));var Papa=require(_0xfce3('0xf'));var Redis=require(_0xfce3('0x10'));var authService=require(_0xfce3('0x11'));var qs=require(_0xfce3('0x12'));var as=require(_0xfce3('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfce3('0x14'))('api');var utils=require(_0xfce3('0x15'));var config=require(_0xfce3('0x16'));var licenseUtil=require(_0xfce3('0x17'));var db=require(_0xfce3('0x18'))['db'];function respondWithStatusCode(_0x1d6668,_0x576b43){_0x576b43=_0x576b43||0xcc;return function(_0x5e8ec5){if(_0x5e8ec5){return _0x1d6668[_0xfce3('0x19')](_0x576b43);}return _0x1d6668['status'](_0x576b43)[_0xfce3('0x1a')]();};}function respondWithResult(_0x3c5b0f,_0x50de49){_0x50de49=_0x50de49||0xc8;return function(_0x482e34){if(_0x482e34){return _0x3c5b0f['status'](_0x50de49)[_0xfce3('0x1b')](_0x482e34);}};}function respondWithFilteredResult(_0x7fb9ad,_0x54758a){return function(_0x2ba0e0){if(_0x2ba0e0){var _0x4d50f0=typeof _0x54758a['offset']===_0xfce3('0x1c')&&typeof _0x54758a[_0xfce3('0x1d')]===_0xfce3('0x1c');var _0x34b923=_0x2ba0e0['count'];var _0x584812=_0x4d50f0?0x0:_0x54758a[_0xfce3('0x1e')];var _0x45f1ab=_0x4d50f0?_0x2ba0e0[_0xfce3('0x1f')]:_0x54758a[_0xfce3('0x1e')]+_0x54758a[_0xfce3('0x1d')];var _0x49b8b2;if(_0x45f1ab>=_0x34b923){_0x45f1ab=_0x34b923;_0x49b8b2=0xc8;}else{_0x49b8b2=0xce;}_0x7fb9ad['status'](_0x49b8b2);return _0x7fb9ad[_0xfce3('0x20')]('Content-Range',_0x584812+'-'+_0x45f1ab+'/'+_0x34b923)[_0xfce3('0x1b')](_0x2ba0e0);}return null;};}function patchUpdates(_0x39d292){return function(_0x4185b4){try{jsonpatch['apply'](_0x4185b4,_0x39d292,!![]);}catch(_0x502e86){return BPromise[_0xfce3('0x21')](_0x502e86);}return _0x4185b4['save']();};}function saveUpdates(_0x27afe5,_0x58a72d){return function(_0x4aa297){if(_0x4aa297){return _0x4aa297[_0xfce3('0x22')](_0x27afe5)['then'](function(_0x560612){return _0x560612;});}return null;};}function removeEntity(_0x527ed4,_0x1a8aec){return function(_0x2ac340){if(_0x2ac340){return _0x2ac340['destroy']()['then'](function(){_0x527ed4['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x10ef5b,_0x2811a6){return function(_0x3e0b07){if(!_0x3e0b07){_0x10ef5b[_0xfce3('0x19')](0x194);}return _0x3e0b07;};}function handleError(_0x3392e,_0x57411c){_0x57411c=_0x57411c||0x1f4;return function(_0x3dfd49){logger[_0xfce3('0x23')](_0x3dfd49[_0xfce3('0x24')]);if(_0x3dfd49[_0xfce3('0x25')]){delete _0x3dfd49[_0xfce3('0x25')];}_0x3392e[_0xfce3('0x26')](_0x57411c)[_0xfce3('0x27')](_0x3dfd49);};}exports[_0xfce3('0x28')]=function(_0xd1047f,_0x46f6d4){var _0x12ebc8={},_0x13c73c={},_0xe4cd74={'count':0x0,'rows':[]};var _0x432255=_[_0xfce3('0x29')](db[_0xfce3('0x2a')][_0xfce3('0x2b')],function(_0x360b37){return{'name':_0x360b37['fieldName'],'type':_0x360b37[_0xfce3('0x2c')][_0xfce3('0x2d')]};});_0x13c73c[_0xfce3('0x2e')]=_[_0xfce3('0x29')](_0x432255,_0xfce3('0x25'));_0x13c73c[_0xfce3('0x2f')]=_[_0xfce3('0x30')](_0xd1047f[_0xfce3('0x2f')]);_0x13c73c[_0xfce3('0x31')]=_['intersection'](_0x13c73c[_0xfce3('0x2e')],_0x13c73c[_0xfce3('0x2f')]);_0x12ebc8[_0xfce3('0x32')]=_[_0xfce3('0x33')](_0x13c73c['model'],qs[_0xfce3('0x34')](_0xd1047f['query']['fields']));_0x12ebc8['attributes']=_0x12ebc8[_0xfce3('0x32')][_0xfce3('0x35')]?_0x12ebc8[_0xfce3('0x32')]:_0x13c73c[_0xfce3('0x2e')];if(!_0xd1047f[_0xfce3('0x2f')][_0xfce3('0x36')](_0xfce3('0x37'))){_0x12ebc8[_0xfce3('0x1d')]=qs['limit'](_0xd1047f[_0xfce3('0x2f')][_0xfce3('0x1d')]);_0x12ebc8[_0xfce3('0x1e')]=qs[_0xfce3('0x1e')](_0xd1047f[_0xfce3('0x2f')][_0xfce3('0x1e')]);}_0x12ebc8[_0xfce3('0x38')]=qs['sort'](_0xd1047f[_0xfce3('0x2f')][_0xfce3('0x39')]);_0x12ebc8['where']=qs[_0xfce3('0x31')](_[_0xfce3('0x3a')](_0xd1047f['query'],_0x13c73c[_0xfce3('0x31')]),_0x432255);if(_0xd1047f[_0xfce3('0x2f')]['filter']){_0x12ebc8[_0xfce3('0x3b')]=_[_0xfce3('0x3c')](_0x12ebc8[_0xfce3('0x3b')],{'$or':_[_0xfce3('0x29')](_0x432255,function(_0x830fcf){if(_0x830fcf[_0xfce3('0x2c')]!==_0xfce3('0x3d')){var _0x44ed69={};_0x44ed69[_0x830fcf[_0xfce3('0x25')]]={'$like':'%'+_0xd1047f[_0xfce3('0x2f')]['filter']+'%'};return _0x44ed69;}})});}_0x12ebc8=_[_0xfce3('0x3c')]({},_0x12ebc8,_0xd1047f['options']);var _0x2a99b3={'where':_0x12ebc8[_0xfce3('0x3b')]};return db[_0xfce3('0x2a')][_0xfce3('0x1f')](_0x2a99b3)[_0xfce3('0x3e')](function(_0x3dd8ab){_0xe4cd74[_0xfce3('0x1f')]=_0x3dd8ab;if(_0xd1047f['query'][_0xfce3('0x3f')]){_0x12ebc8[_0xfce3('0x40')]=[{'all':!![]}];}return db[_0xfce3('0x2a')]['findAll'](_0x12ebc8);})[_0xfce3('0x3e')](function(_0x4fdb88){_0xe4cd74[_0xfce3('0x41')]=_0x4fdb88;return _0xe4cd74;})[_0xfce3('0x3e')](respondWithFilteredResult(_0x46f6d4,_0x12ebc8))[_0xfce3('0x42')](handleError(_0x46f6d4,null));};exports['show']=function(_0x3241fa,_0x468949){var _0x34b46e={'raw':!![],'where':{'id':_0x3241fa[_0xfce3('0x43')]['id']}},_0x3521f7={};_0x3521f7[_0xfce3('0x2e')]=_[_0xfce3('0x30')](db[_0xfce3('0x2a')][_0xfce3('0x2b')]);_0x3521f7[_0xfce3('0x2f')]=_['keys'](_0x3241fa['query']);_0x3521f7[_0xfce3('0x31')]=_[_0xfce3('0x33')](_0x3521f7[_0xfce3('0x2e')],_0x3521f7[_0xfce3('0x2f')]);_0x34b46e[_0xfce3('0x32')]=_[_0xfce3('0x33')](_0x3521f7['model'],qs[_0xfce3('0x34')](_0x3241fa[_0xfce3('0x2f')][_0xfce3('0x34')]));_0x34b46e[_0xfce3('0x32')]=_0x34b46e[_0xfce3('0x32')][_0xfce3('0x35')]?_0x34b46e['attributes']:_0x3521f7[_0xfce3('0x2e')];if(_0x3241fa['query'][_0xfce3('0x3f')]){_0x34b46e['include']=[{'all':!![]}];}_0x34b46e=_[_0xfce3('0x3c')]({},_0x34b46e,_0x3241fa['options']);return db['OpenchannelQueueReport'][_0xfce3('0x44')](_0x34b46e)['then'](handleEntityNotFound(_0x468949,null))['then'](respondWithResult(_0x468949,null))[_0xfce3('0x42')](handleError(_0x468949,null));};exports[_0xfce3('0x45')]=function(_0x367f08,_0x3bfadc){return db[_0xfce3('0x2a')][_0xfce3('0x45')](_0x367f08[_0xfce3('0x46')],{})[_0xfce3('0x3e')](respondWithResult(_0x3bfadc,0xc9))[_0xfce3('0x42')](handleError(_0x3bfadc,null));};exports['update']=function(_0x363dd7,_0x44f484){if(_0x363dd7['body']['id']){delete _0x363dd7['body']['id'];}return db[_0xfce3('0x2a')][_0xfce3('0x44')]({'where':{'id':_0x363dd7[_0xfce3('0x43')]['id']}})[_0xfce3('0x3e')](handleEntityNotFound(_0x44f484,null))[_0xfce3('0x3e')](saveUpdates(_0x363dd7['body'],null))[_0xfce3('0x3e')](respondWithResult(_0x44f484,null))['catch'](handleError(_0x44f484,null));};exports[_0xfce3('0x47')]=function(_0x4fce5d,_0xba1110){return db['OpenchannelQueueReport'][_0xfce3('0x44')]({'where':{'id':_0x4fce5d['params']['id']}})[_0xfce3('0x3e')](handleEntityNotFound(_0xba1110,null))[_0xfce3('0x3e')](removeEntity(_0xba1110,null))[_0xfce3('0x42')](handleError(_0xba1110,null));};exports[_0xfce3('0x48')]=function(_0x635d52,_0x221651){return db[_0xfce3('0x2a')]['describe']()[_0xfce3('0x3e')](respondWithResult(_0x221651,null))['catch'](handleError(_0x221651,null));}; \ No newline at end of file +var _0x4029=['attributes','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','includeAll','findAll','catch','params','rawAttributes','include','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','json','undefined','offset','count','limit','set','apply','reject','save','update','then','destroy','error','stack','name','index','OpenchannelQueueReport','fieldName','type','key','map','query','keys','filters','intersection','model','fields'];(function(_0x2b4795,_0x163d31){var _0x4f638b=function(_0x46ded6){while(--_0x46ded6){_0x2b4795['push'](_0x2b4795['shift']());}};_0x4f638b(++_0x163d31);}(_0x4029,0x1be));var _0x9402=function(_0x59881a,_0x5ef668){_0x59881a=_0x59881a-0x0;var _0x33a221=_0x4029[_0x59881a];return _0x33a221;};'use strict';var emlformat=require(_0x9402('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9402('0x1'));var jsonpatch=require(_0x9402('0x2'));var rp=require('request-promise');var moment=require(_0x9402('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x9402('0x4'));var util=require('util');var path=require(_0x9402('0x5'));var sox=require(_0x9402('0x6'));var csv=require(_0x9402('0x7'));var ejs=require(_0x9402('0x8'));var fs=require('fs');var fs_extra=require(_0x9402('0x9'));var _=require(_0x9402('0xa'));var squel=require('squel');var crypto=require(_0x9402('0xb'));var jsforce=require(_0x9402('0xc'));var deskjs=require(_0x9402('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x9402('0xe'));var authService=require(_0x9402('0xf'));var qs=require(_0x9402('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9402('0x11'));var logger=require(_0x9402('0x12'))('api');var utils=require(_0x9402('0x13'));var config=require(_0x9402('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7fd4dd,_0x5ae1df){_0x5ae1df=_0x5ae1df||0xcc;return function(_0x550f3b){if(_0x550f3b){return _0x7fd4dd[_0x9402('0x15')](_0x5ae1df);}return _0x7fd4dd[_0x9402('0x16')](_0x5ae1df)[_0x9402('0x17')]();};}function respondWithResult(_0x3e1f66,_0x55173f){_0x55173f=_0x55173f||0xc8;return function(_0x2ce1f3){if(_0x2ce1f3){return _0x3e1f66[_0x9402('0x16')](_0x55173f)[_0x9402('0x18')](_0x2ce1f3);}};}function respondWithFilteredResult(_0x49b46a,_0xdbdc67){return function(_0x33dcda){if(_0x33dcda){var _0x5cb516=typeof _0xdbdc67['offset']===_0x9402('0x19')&&typeof _0xdbdc67['limit']===_0x9402('0x19');var _0xa40c1a=_0x33dcda['count'];var _0x5b0312=_0x5cb516?0x0:_0xdbdc67[_0x9402('0x1a')];var _0x1cad69=_0x5cb516?_0x33dcda[_0x9402('0x1b')]:_0xdbdc67['offset']+_0xdbdc67[_0x9402('0x1c')];var _0x40e065;if(_0x1cad69>=_0xa40c1a){_0x1cad69=_0xa40c1a;_0x40e065=0xc8;}else{_0x40e065=0xce;}_0x49b46a[_0x9402('0x16')](_0x40e065);return _0x49b46a[_0x9402('0x1d')]('Content-Range',_0x5b0312+'-'+_0x1cad69+'/'+_0xa40c1a)[_0x9402('0x18')](_0x33dcda);}return null;};}function patchUpdates(_0x19c839){return function(_0x4735a5){try{jsonpatch[_0x9402('0x1e')](_0x4735a5,_0x19c839,!![]);}catch(_0x26959f){return BPromise[_0x9402('0x1f')](_0x26959f);}return _0x4735a5[_0x9402('0x20')]();};}function saveUpdates(_0x40e776,_0x5dfeeb){return function(_0x2f6d58){if(_0x2f6d58){return _0x2f6d58[_0x9402('0x21')](_0x40e776)[_0x9402('0x22')](function(_0xd1dc3){return _0xd1dc3;});}return null;};}function removeEntity(_0x320998,_0x3ee761){return function(_0x22e5b5){if(_0x22e5b5){return _0x22e5b5[_0x9402('0x23')]()[_0x9402('0x22')](function(){_0x320998[_0x9402('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573384,_0xa0fe85){return function(_0x429429){if(!_0x429429){_0x573384['sendStatus'](0x194);}return _0x429429;};}function handleError(_0x14e7fc,_0x62acbe){_0x62acbe=_0x62acbe||0x1f4;return function(_0x1d687b){logger[_0x9402('0x24')](_0x1d687b[_0x9402('0x25')]);if(_0x1d687b['name']){delete _0x1d687b[_0x9402('0x26')];}_0x14e7fc[_0x9402('0x16')](_0x62acbe)['send'](_0x1d687b);};}exports[_0x9402('0x27')]=function(_0x3fbcb4,_0x534ef2){var _0x4f2402={},_0x3a9a7f={},_0x3499b2={'count':0x0,'rows':[]};var _0x114e03=_['map'](db[_0x9402('0x28')]['rawAttributes'],function(_0x2b2da7){return{'name':_0x2b2da7[_0x9402('0x29')],'type':_0x2b2da7[_0x9402('0x2a')][_0x9402('0x2b')]};});_0x3a9a7f['model']=_[_0x9402('0x2c')](_0x114e03,'name');_0x3a9a7f[_0x9402('0x2d')]=_[_0x9402('0x2e')](_0x3fbcb4[_0x9402('0x2d')]);_0x3a9a7f[_0x9402('0x2f')]=_[_0x9402('0x30')](_0x3a9a7f[_0x9402('0x31')],_0x3a9a7f['query']);_0x4f2402['attributes']=_[_0x9402('0x30')](_0x3a9a7f[_0x9402('0x31')],qs[_0x9402('0x32')](_0x3fbcb4['query'][_0x9402('0x32')]));_0x4f2402['attributes']=_0x4f2402[_0x9402('0x33')][_0x9402('0x34')]?_0x4f2402['attributes']:_0x3a9a7f[_0x9402('0x31')];if(!_0x3fbcb4[_0x9402('0x2d')][_0x9402('0x35')]('nolimit')){_0x4f2402['limit']=qs['limit'](_0x3fbcb4[_0x9402('0x2d')][_0x9402('0x1c')]);_0x4f2402[_0x9402('0x1a')]=qs[_0x9402('0x1a')](_0x3fbcb4[_0x9402('0x2d')][_0x9402('0x1a')]);}_0x4f2402[_0x9402('0x36')]=qs[_0x9402('0x37')](_0x3fbcb4[_0x9402('0x2d')][_0x9402('0x37')]);_0x4f2402[_0x9402('0x38')]=qs[_0x9402('0x2f')](_['pick'](_0x3fbcb4['query'],_0x3a9a7f['filters']),_0x114e03);if(_0x3fbcb4[_0x9402('0x2d')][_0x9402('0x39')]){_0x4f2402['where']=_[_0x9402('0x3a')](_0x4f2402[_0x9402('0x38')],{'$or':_[_0x9402('0x2c')](_0x114e03,function(_0x533a8c){if(_0x533a8c[_0x9402('0x2a')]!==_0x9402('0x3b')){var _0x246556={};_0x246556[_0x533a8c[_0x9402('0x26')]]={'$like':'%'+_0x3fbcb4[_0x9402('0x2d')][_0x9402('0x39')]+'%'};return _0x246556;}})});}_0x4f2402=_[_0x9402('0x3a')]({},_0x4f2402,_0x3fbcb4[_0x9402('0x3c')]);var _0x1fc1f7={'where':_0x4f2402['where']};return db[_0x9402('0x28')][_0x9402('0x1b')](_0x1fc1f7)[_0x9402('0x22')](function(_0x563c3a){_0x3499b2[_0x9402('0x1b')]=_0x563c3a;if(_0x3fbcb4['query'][_0x9402('0x3d')]){_0x4f2402['include']=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0x9402('0x3e')](_0x4f2402);})[_0x9402('0x22')](function(_0x18978b){_0x3499b2['rows']=_0x18978b;return _0x3499b2;})['then'](respondWithFilteredResult(_0x534ef2,_0x4f2402))[_0x9402('0x3f')](handleError(_0x534ef2,null));};exports['show']=function(_0x12d022,_0x3e3e53){var _0x3ae2fb={'raw':!![],'where':{'id':_0x12d022[_0x9402('0x40')]['id']}},_0x1c645c={};_0x1c645c[_0x9402('0x31')]=_['keys'](db[_0x9402('0x28')][_0x9402('0x41')]);_0x1c645c[_0x9402('0x2d')]=_['keys'](_0x12d022[_0x9402('0x2d')]);_0x1c645c[_0x9402('0x2f')]=_[_0x9402('0x30')](_0x1c645c[_0x9402('0x31')],_0x1c645c[_0x9402('0x2d')]);_0x3ae2fb[_0x9402('0x33')]=_[_0x9402('0x30')](_0x1c645c[_0x9402('0x31')],qs[_0x9402('0x32')](_0x12d022[_0x9402('0x2d')][_0x9402('0x32')]));_0x3ae2fb[_0x9402('0x33')]=_0x3ae2fb[_0x9402('0x33')][_0x9402('0x34')]?_0x3ae2fb[_0x9402('0x33')]:_0x1c645c[_0x9402('0x31')];if(_0x12d022[_0x9402('0x2d')][_0x9402('0x3d')]){_0x3ae2fb[_0x9402('0x42')]=[{'all':!![]}];}_0x3ae2fb=_[_0x9402('0x3a')]({},_0x3ae2fb,_0x12d022[_0x9402('0x3c')]);return db[_0x9402('0x28')][_0x9402('0x43')](_0x3ae2fb)[_0x9402('0x22')](handleEntityNotFound(_0x3e3e53,null))['then'](respondWithResult(_0x3e3e53,null))[_0x9402('0x3f')](handleError(_0x3e3e53,null));};exports['create']=function(_0x3eddb6,_0x164ed3){return db[_0x9402('0x28')][_0x9402('0x44')](_0x3eddb6[_0x9402('0x45')],{})['then'](respondWithResult(_0x164ed3,0xc9))[_0x9402('0x3f')](handleError(_0x164ed3,null));};exports[_0x9402('0x21')]=function(_0x103d81,_0x55c322){if(_0x103d81[_0x9402('0x45')]['id']){delete _0x103d81[_0x9402('0x45')]['id'];}return db[_0x9402('0x28')][_0x9402('0x43')]({'where':{'id':_0x103d81['params']['id']}})[_0x9402('0x22')](handleEntityNotFound(_0x55c322,null))['then'](saveUpdates(_0x103d81[_0x9402('0x45')],null))[_0x9402('0x22')](respondWithResult(_0x55c322,null))['catch'](handleError(_0x55c322,null));};exports['destroy']=function(_0x3d1a4b,_0x4a0d15){return db['OpenchannelQueueReport'][_0x9402('0x43')]({'where':{'id':_0x3d1a4b[_0x9402('0x40')]['id']}})[_0x9402('0x22')](handleEntityNotFound(_0x4a0d15,null))['then'](removeEntity(_0x4a0d15,null))[_0x9402('0x3f')](handleError(_0x4a0d15,null));};exports[_0x9402('0x46')]=function(_0x311459,_0x5bd317){return db[_0x9402('0x28')][_0x9402('0x46')]()[_0x9402('0x22')](respondWithResult(_0x5bd317,null))[_0x9402('0x3f')](handleError(_0x5bd317,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index dee755b..9adb582 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 _0x2ef3=['define','OpenchannelQueueReport','report_openchannel_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','./openchannelQueueReport.attributes','exports'];(function(_0x4a177c,_0x2bd612){var _0x54dd37=function(_0x58b775){while(--_0x58b775){_0x4a177c['push'](_0x4a177c['shift']());}};_0x54dd37(++_0x2bd612);}(_0x2ef3,0xba));var _0x32ef=function(_0x3099a5,_0x4443cb){_0x3099a5=_0x3099a5-0x0;var _0x507384=_0x2ef3[_0x3099a5];return _0x507384;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var logger=require(_0x32ef('0x2'))(_0x32ef('0x3'));var moment=require(_0x32ef('0x4'));var BPromise=require(_0x32ef('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x32ef('0x6'));var rimraf=require(_0x32ef('0x7'));var config=require('../../config/environment');var attributes=require(_0x32ef('0x8'));module[_0x32ef('0x9')]=function(_0x4c8104,_0x5dfa09){return _0x4c8104[_0x32ef('0xa')](_0x32ef('0xb'),attributes,{'tableName':_0x32ef('0xc'),'paranoid':![],'indexes':[{'name':_0x32ef('0xd'),'fields':[_0x32ef('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5fc3=['util','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueueReport.attributes','exports','define','report_openchannel_queue','uniqueid','lodash'];(function(_0x41ea43,_0x33b2b9){var _0x1de9f5=function(_0x25d32a){while(--_0x25d32a){_0x41ea43['push'](_0x41ea43['shift']());}};_0x1de9f5(++_0x33b2b9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5fc3[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var logger=require('../../config/logger')(_0x35fc('0x2'));var moment=require(_0x35fc('0x3'));var BPromise=require(_0x35fc('0x4'));var rp=require(_0x35fc('0x5'));var fs=require('fs');var path=require(_0x35fc('0x6'));var rimraf=require('rimraf');var config=require(_0x35fc('0x7'));var attributes=require(_0x35fc('0x8'));module[_0x35fc('0x9')]=function(_0x5b85ad,_0x5754be){return _0x5b85ad[_0x35fc('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x35fc('0xb'),'paranoid':![],'indexes':[{'name':_0x35fc('0xc'),'fields':[_0x35fc('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 3eccae9..68109e7 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 _0xfef3=['lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','catch','UpdateOpenchannelQueueReport','update'];(function(_0x53b37c,_0x1e3dae){var _0x912a5=function(_0x3e0a92){while(--_0x3e0a92){_0x53b37c['push'](_0x53b37c['shift']());}};_0x912a5(++_0x1e3dae);}(_0xfef3,0x118));var _0x3fef=function(_0x1138c4,_0x841d33){_0x1138c4=_0x1138c4-0x0;var _0x200cc1=_0xfef3[_0x1138c4];return _0x200cc1;};'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')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x800850,_0x31c30f[_0x3fef('0x11')][_0x3fef('0x12')]);return _0x41960c(_0x31c30f[_0x3fef('0x11')]['message']);}logger[_0x3fef('0x11')]('OpenchannelQueueReport,\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);});});}exports[_0x3fef('0x14')]=function(_0x1613ad){var _0xaa0ae3=this;return new Promise(function(_0x53d993,_0x36669d){return db[_0x3fef('0x15')]['create'](_0x1613ad[_0x3fef('0x16')],{'raw':_0x1613ad[_0x3fef('0x17')]?_0x1613ad[_0x3fef('0x17')][_0x3fef('0x18')]===undefined?!![]:![]:!![]})[_0x3fef('0xa')](function(_0x2b5226){logger[_0x3fef('0xb')](_0x3fef('0x14'),_0x1613ad);logger[_0x3fef('0xe')](_0x3fef('0x14'),_0x1613ad,JSON[_0x3fef('0x10')](_0x2b5226));_0x53d993(_0x2b5226);})[_0x3fef('0x19')](function(_0x2eb578){logger[_0x3fef('0x11')](_0x3fef('0x14'),_0x2eb578['message'],_0x1613ad);_0x36669d(_0xaa0ae3['error'](0x1f4,_0x2eb578['message']));});});};exports[_0x3fef('0x1a')]=function(_0x3ba38d){var _0xa16dc=this;return new Promise(function(_0x5f047c,_0x4d462c){return db['OpenchannelQueueReport'][_0x3fef('0x1b')](_0x3ba38d[_0x3fef('0x16')],{'raw':_0x3ba38d[_0x3fef('0x17')]?_0x3ba38d[_0x3fef('0x17')][_0x3fef('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3ba38d['options']?_0x3ba38d['options']['where']||null:null,'attributes':_0x3ba38d[_0x3fef('0x17')]?_0x3ba38d[_0x3fef('0x17')]['attributes']||null:null,'limit':_0x3ba38d[_0x3fef('0x17')]?_0x3ba38d[_0x3fef('0x17')]['limit']||null:null})[_0x3fef('0xa')](function(_0x3bdf03){logger[_0x3fef('0xb')](_0x3fef('0x1a'),_0x3ba38d);logger[_0x3fef('0xe')](_0x3fef('0x1a'),_0x3ba38d,JSON[_0x3fef('0x10')](_0x3bdf03));_0x5f047c(_0x3bdf03);})['catch'](function(_0x34576a){logger[_0x3fef('0x11')](_0x3fef('0x1a'),_0x34576a[_0x3fef('0x12')],_0x3ba38d);_0x4d462c(_0xa16dc['error'](0x1f4,_0x34576a[_0x3fef('0x12')]));});});}; \ No newline at end of file +var _0x68a5=['UpdateOpenchannelQueueReport','update','where','limit','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','then','info','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelQueueReport,\x20%s,\x20%s','message','request\x20sent','CreateOpenchannelQueueReport','OpenchannelQueueReport','body','options','raw','catch'];(function(_0x1ea13b,_0x43b75b){var _0x38e437=function(_0x26d786){while(--_0x26d786){_0x1ea13b['push'](_0x1ea13b['shift']());}};_0x38e437(++_0x43b75b);}(_0x68a5,0xfc));var _0x568a=function(_0x448c8c,_0xfb6935){_0x448c8c=_0x448c8c-0x0;var _0x3bcc06=_0x68a5[_0x448c8c];return _0x3bcc06;};'use strict';var _=require(_0x568a('0x0'));var util=require('util');var moment=require(_0x568a('0x1'));var BPromise=require(_0x568a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x568a('0x3'));var db=require(_0x568a('0x4'))['db'];var utils=require(_0x568a('0x5'));var logger=require(_0x568a('0x6'))('rpc');var config=require(_0x568a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x568a('0x8')][_0x568a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2d36ec,_0x3a7a9c,_0x4cda9a){return new BPromise(function(_0x172efd,_0x56deb6){return client[_0x568a('0xa')](_0x2d36ec,_0x4cda9a)[_0x568a('0xb')](function(_0x335ecd){logger[_0x568a('0xc')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a7a9c,'request\x20sent');logger[_0x568a('0xd')](_0x568a('0xe'),_0x3a7a9c,'request\x20sent',JSON[_0x568a('0xf')](_0x335ecd));if(_0x335ecd['error']){if(_0x335ecd[_0x568a('0x10')][_0x568a('0x11')]===0x1f4){logger[_0x568a('0x10')](_0x568a('0x12'),_0x3a7a9c,_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);return _0x56deb6(_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);}logger[_0x568a('0x10')](_0x568a('0x12'),_0x3a7a9c,_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);return _0x172efd(_0x335ecd[_0x568a('0x10')][_0x568a('0x13')]);}else{logger[_0x568a('0xc')](_0x568a('0x12'),_0x3a7a9c,_0x568a('0x14'));_0x172efd(_0x335ecd['result'][_0x568a('0x13')]);}})['catch'](function(_0xa77de8){logger[_0x568a('0x10')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x3a7a9c,_0xa77de8);_0x56deb6(_0xa77de8);});});}exports[_0x568a('0x15')]=function(_0x561ae1){var _0x40d4a1=this;return new Promise(function(_0x1c8e3a,_0x9b4670){return db[_0x568a('0x16')]['create'](_0x561ae1[_0x568a('0x17')],{'raw':_0x561ae1['options']?_0x561ae1[_0x568a('0x18')][_0x568a('0x19')]===undefined?!![]:![]:!![]})[_0x568a('0xb')](function(_0x3b9968){logger[_0x568a('0xc')](_0x568a('0x15'),_0x561ae1);logger[_0x568a('0xd')](_0x568a('0x15'),_0x561ae1,JSON['stringify'](_0x3b9968));_0x1c8e3a(_0x3b9968);})[_0x568a('0x1a')](function(_0x1f12b5){logger['error'](_0x568a('0x15'),_0x1f12b5[_0x568a('0x13')],_0x561ae1);_0x9b4670(_0x40d4a1[_0x568a('0x10')](0x1f4,_0x1f12b5['message']));});});};exports[_0x568a('0x1b')]=function(_0x378f0e){var _0x1d5329=this;return new Promise(function(_0x1df7ab,_0xdb83a1){return db[_0x568a('0x16')][_0x568a('0x1c')](_0x378f0e[_0x568a('0x17')],{'raw':_0x378f0e[_0x568a('0x18')]?_0x378f0e['options'][_0x568a('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x378f0e[_0x568a('0x18')]?_0x378f0e[_0x568a('0x18')][_0x568a('0x1d')]||null:null,'attributes':_0x378f0e[_0x568a('0x18')]?_0x378f0e[_0x568a('0x18')]['attributes']||null:null,'limit':_0x378f0e[_0x568a('0x18')]?_0x378f0e[_0x568a('0x18')][_0x568a('0x1e')]||null:null})[_0x568a('0xb')](function(_0x20498b){logger['info'](_0x568a('0x1b'),_0x378f0e);logger[_0x568a('0xd')](_0x568a('0x1b'),_0x378f0e,JSON[_0x568a('0xf')](_0x20498b));_0x1df7ab(_0x20498b);})[_0x568a('0x1a')](function(_0x153e1a){logger[_0x568a('0x10')](_0x568a('0x1b'),_0x153e1a[_0x568a('0x13')],_0x378f0e);_0xdb83a1(_0x1d5329[_0x568a('0x10')](0x1f4,_0x153e1a['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index c4ae474..3e8e53d 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 _0xd41e=['describe','/:id','show','put','update','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x5ad3f2,_0x6efe96){var _0x2f6f8a=function(_0x3c741f){while(--_0x3c741f){_0x5ad3f2['push'](_0x5ad3f2['shift']());}};_0x2f6f8a(++_0x6efe96);}(_0xd41e,0x75));var _0xed41=function(_0x5a79e2,_0x319b1a){_0x5a79e2=_0x5a79e2-0x0;var _0x266c45=_0xd41e[_0x5a79e2];return _0x266c45;};'use strict';var multer=require('multer');var util=require(_0xed41('0x0'));var path=require(_0xed41('0x1'));var timeout=require('connect-timeout');var express=require(_0xed41('0x2'));var router=express['Router']();var fs_extra=require(_0xed41('0x3'));var auth=require(_0xed41('0x4'));var interaction=require(_0xed41('0x5'));var config=require('../../config/environment');var controller=require(_0xed41('0x6'));router[_0xed41('0x7')]('/',auth[_0xed41('0x8')](),controller[_0xed41('0x9')]);router[_0xed41('0x7')](_0xed41('0xa'),auth[_0xed41('0x8')](),controller[_0xed41('0xb')]);router[_0xed41('0x7')](_0xed41('0xc'),auth[_0xed41('0x8')](),controller[_0xed41('0xd')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0xed41('0xe')]('/:id',auth[_0xed41('0x8')](),controller[_0xed41('0xf')]);router['delete']('/:id',auth[_0xed41('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x1efa=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelTransferReport.controller','isAuthenticated','index','get','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','util','path','express'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0x1efa,0x162));var _0xa1ef=function(_0x30fc3c,_0x27bf3d){_0x30fc3c=_0x30fc3c-0x0;var _0x55afe8=_0x1efa[_0x30fc3c];return _0x55afe8;};'use strict';var multer=require('multer');var util=require(_0xa1ef('0x0'));var path=require(_0xa1ef('0x1'));var timeout=require('connect-timeout');var express=require(_0xa1ef('0x2'));var router=express[_0xa1ef('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xa1ef('0x4'));var interaction=require(_0xa1ef('0x5'));var config=require(_0xa1ef('0x6'));var controller=require(_0xa1ef('0x7'));router['get']('/',auth[_0xa1ef('0x8')](),controller[_0xa1ef('0x9')]);router[_0xa1ef('0xa')](_0xa1ef('0xb'),auth[_0xa1ef('0x8')](),controller[_0xa1ef('0xc')]);router[_0xa1ef('0xa')](_0xa1ef('0xd'),auth['isAuthenticated'](),controller['show']);router[_0xa1ef('0xe')]('/',auth[_0xa1ef('0x8')](),controller[_0xa1ef('0xf')]);router[_0xa1ef('0x10')](_0xa1ef('0xd'),auth[_0xa1ef('0x8')](),controller[_0xa1ef('0x11')]);router[_0xa1ef('0x12')](_0xa1ef('0xd'),auth[_0xa1ef('0x8')](),controller[_0xa1ef('0x13')]);module[_0xa1ef('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 f79cd56..e28c1b3 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x292423,_0x1759b7){var _0x2801cb=function(_0x23c821){while(--_0x23c821){_0x292423['push'](_0x292423['shift']());}};_0x2801cb(++_0x1759b7);}(_0xb43b,0x1b2));var _0xbb43=function(_0x3070d4,_0x1bec58){_0x3070d4=_0x3070d4-0x0;var _0x1d1056=_0xb43b[_0x3070d4];return _0x1d1056;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0xcb91=['STRING','ENUM','account','queue','NOW','exports'];(function(_0x49e000,_0x120233){var _0x128c05=function(_0x4ce535){while(--_0x4ce535){_0x49e000['push'](_0x49e000['shift']());}};_0x128c05(++_0x120233);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x5d30b4,_0x199248){_0x5d30b4=_0x5d30b4-0x0;var _0x1acfb8=_0xcb91[_0x5d30b4];return _0x1acfb8;};'use strict';var moment=require('moment');var Sequelize=require('sequelize');module[_0x1cb9('0x0')]={'uniqueid':{'type':Sequelize[_0x1cb9('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x1cb9('0x2')](_0x1cb9('0x3'),'agent',_0x1cb9('0x4')),'allowNull':![],'defaultValue':_0x1cb9('0x4')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x1cb9('0x5')]}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 33d3d90..93e18a6 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 _0xf4f4=['fields','length','hasOwnProperty','sort','where','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','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','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','save','update','destroy','then','name','send','index','map','OpenchannelTransferReport','fieldName','key','model','query','keys','filters','intersection','attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xf4f4,0x13e));var _0x4f4f=function(_0x1d3366,_0x335df9){_0x1d3366=_0x1d3366-0x0;var _0x4ed3a0=_0xf4f4[_0x1d3366];return _0x4ed3a0;};'use strict';var emlformat=require(_0x4f4f('0x0'));var rimraf=require(_0x4f4f('0x1'));var zipdir=require(_0x4f4f('0x2'));var jsonpatch=require(_0x4f4f('0x3'));var rp=require('request-promise');var moment=require(_0x4f4f('0x4'));var BPromise=require(_0x4f4f('0x5'));var Mustache=require(_0x4f4f('0x6'));var util=require(_0x4f4f('0x7'));var path=require(_0x4f4f('0x8'));var sox=require('sox');var csv=require(_0x4f4f('0x9'));var ejs=require(_0x4f4f('0xa'));var fs=require('fs');var fs_extra=require(_0x4f4f('0xb'));var _=require(_0x4f4f('0xc'));var squel=require(_0x4f4f('0xd'));var crypto=require(_0x4f4f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x4f4f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4f4f('0x10'));var Papa=require(_0x4f4f('0x11'));var Redis=require(_0x4f4f('0x12'));var authService=require(_0x4f4f('0x13'));var qs=require(_0x4f4f('0x14'));var as=require(_0x4f4f('0x15'));var hardwareService=require(_0x4f4f('0x16'));var logger=require(_0x4f4f('0x17'))('api');var utils=require('../../config/utils');var config=require(_0x4f4f('0x18'));var licenseUtil=require(_0x4f4f('0x19'));var db=require(_0x4f4f('0x1a'))['db'];function respondWithStatusCode(_0x3af537,_0x1f1caf){_0x1f1caf=_0x1f1caf||0xcc;return function(_0x7b2626){if(_0x7b2626){return _0x3af537[_0x4f4f('0x1b')](_0x1f1caf);}return _0x3af537[_0x4f4f('0x1c')](_0x1f1caf)[_0x4f4f('0x1d')]();};}function respondWithResult(_0x1bc0b8,_0x5010d4){_0x5010d4=_0x5010d4||0xc8;return function(_0x4708c7){if(_0x4708c7){return _0x1bc0b8['status'](_0x5010d4)['json'](_0x4708c7);}};}function respondWithFilteredResult(_0x1eebfb,_0x4829bd){return function(_0x5d51b8){if(_0x5d51b8){var _0x3bbdce=typeof _0x4829bd[_0x4f4f('0x1e')]===_0x4f4f('0x1f')&&typeof _0x4829bd[_0x4f4f('0x20')]===_0x4f4f('0x1f');var _0x2a1803=_0x5d51b8[_0x4f4f('0x21')];var _0x8086f4=_0x3bbdce?0x0:_0x4829bd[_0x4f4f('0x1e')];var _0x2dd87f=_0x3bbdce?_0x5d51b8[_0x4f4f('0x21')]:_0x4829bd['offset']+_0x4829bd['limit'];var _0x2191b7;if(_0x2dd87f>=_0x2a1803){_0x2dd87f=_0x2a1803;_0x2191b7=0xc8;}else{_0x2191b7=0xce;}_0x1eebfb[_0x4f4f('0x1c')](_0x2191b7);return _0x1eebfb['set'](_0x4f4f('0x22'),_0x8086f4+'-'+_0x2dd87f+'/'+_0x2a1803)['json'](_0x5d51b8);}return null;};}function patchUpdates(_0xa7a17c){return function(_0x4c74eb){try{jsonpatch['apply'](_0x4c74eb,_0xa7a17c,!![]);}catch(_0x510248){return BPromise['reject'](_0x510248);}return _0x4c74eb[_0x4f4f('0x23')]();};}function saveUpdates(_0x13270a,_0x65d035){return function(_0x19345c){if(_0x19345c){return _0x19345c[_0x4f4f('0x24')](_0x13270a)['then'](function(_0x4d5c8a){return _0x4d5c8a;});}return null;};}function removeEntity(_0x4030ee,_0x2176a8){return function(_0x213da1){if(_0x213da1){return _0x213da1[_0x4f4f('0x25')]()[_0x4f4f('0x26')](function(){_0x4030ee[_0x4f4f('0x1c')](0xcc)[_0x4f4f('0x1d')]();});}};}function handleEntityNotFound(_0x387cb4,_0x5c7e53){return function(_0x17be40){if(!_0x17be40){_0x387cb4['sendStatus'](0x194);}return _0x17be40;};}function handleError(_0x5e86c0,_0x3133ce){_0x3133ce=_0x3133ce||0x1f4;return function(_0x3821a7){logger['error'](_0x3821a7['stack']);if(_0x3821a7[_0x4f4f('0x27')]){delete _0x3821a7[_0x4f4f('0x27')];}_0x5e86c0[_0x4f4f('0x1c')](_0x3133ce)[_0x4f4f('0x28')](_0x3821a7);};}exports[_0x4f4f('0x29')]=function(_0x55c355,_0x466788){var _0x12b7c2={},_0x52ac55={},_0x44e1ba={'count':0x0,'rows':[]};var _0x5740a9=_[_0x4f4f('0x2a')](db[_0x4f4f('0x2b')]['rawAttributes'],function(_0x414288){return{'name':_0x414288[_0x4f4f('0x2c')],'type':_0x414288['type'][_0x4f4f('0x2d')]};});_0x52ac55[_0x4f4f('0x2e')]=_[_0x4f4f('0x2a')](_0x5740a9,'name');_0x52ac55[_0x4f4f('0x2f')]=_[_0x4f4f('0x30')](_0x55c355['query']);_0x52ac55[_0x4f4f('0x31')]=_[_0x4f4f('0x32')](_0x52ac55['model'],_0x52ac55[_0x4f4f('0x2f')]);_0x12b7c2[_0x4f4f('0x33')]=_[_0x4f4f('0x32')](_0x52ac55[_0x4f4f('0x2e')],qs[_0x4f4f('0x34')](_0x55c355['query'][_0x4f4f('0x34')]));_0x12b7c2[_0x4f4f('0x33')]=_0x12b7c2[_0x4f4f('0x33')][_0x4f4f('0x35')]?_0x12b7c2[_0x4f4f('0x33')]:_0x52ac55['model'];if(!_0x55c355['query'][_0x4f4f('0x36')]('nolimit')){_0x12b7c2['limit']=qs['limit'](_0x55c355[_0x4f4f('0x2f')][_0x4f4f('0x20')]);_0x12b7c2['offset']=qs[_0x4f4f('0x1e')](_0x55c355[_0x4f4f('0x2f')]['offset']);}_0x12b7c2['order']=qs[_0x4f4f('0x37')](_0x55c355[_0x4f4f('0x2f')]['sort']);_0x12b7c2[_0x4f4f('0x38')]=qs[_0x4f4f('0x31')](_['pick'](_0x55c355[_0x4f4f('0x2f')],_0x52ac55[_0x4f4f('0x31')]),_0x5740a9);if(_0x55c355[_0x4f4f('0x2f')][_0x4f4f('0x39')]){_0x12b7c2[_0x4f4f('0x38')]=_[_0x4f4f('0x3a')](_0x12b7c2[_0x4f4f('0x38')],{'$or':_[_0x4f4f('0x2a')](_0x5740a9,function(_0x491892){if(_0x491892[_0x4f4f('0x3b')]!==_0x4f4f('0x3c')){var _0x2a0e1b={};_0x2a0e1b[_0x491892[_0x4f4f('0x27')]]={'$like':'%'+_0x55c355[_0x4f4f('0x2f')][_0x4f4f('0x39')]+'%'};return _0x2a0e1b;}})});}_0x12b7c2=_[_0x4f4f('0x3a')]({},_0x12b7c2,_0x55c355[_0x4f4f('0x3d')]);var _0x59b2db={'where':_0x12b7c2[_0x4f4f('0x38')]};return db['OpenchannelTransferReport']['count'](_0x59b2db)[_0x4f4f('0x26')](function(_0x18cc87){_0x44e1ba[_0x4f4f('0x21')]=_0x18cc87;if(_0x55c355[_0x4f4f('0x2f')][_0x4f4f('0x3e')]){_0x12b7c2[_0x4f4f('0x3f')]=[{'all':!![]}];}return db[_0x4f4f('0x2b')][_0x4f4f('0x40')](_0x12b7c2);})[_0x4f4f('0x26')](function(_0x37c778){_0x44e1ba[_0x4f4f('0x41')]=_0x37c778;return _0x44e1ba;})['then'](respondWithFilteredResult(_0x466788,_0x12b7c2))[_0x4f4f('0x42')](handleError(_0x466788,null));};exports[_0x4f4f('0x43')]=function(_0x7b3cfe,_0x368b21){var _0x44da59={'raw':!![],'where':{'id':_0x7b3cfe[_0x4f4f('0x44')]['id']}},_0x44cfba={};_0x44cfba['model']=_[_0x4f4f('0x30')](db[_0x4f4f('0x2b')][_0x4f4f('0x45')]);_0x44cfba['query']=_[_0x4f4f('0x30')](_0x7b3cfe[_0x4f4f('0x2f')]);_0x44cfba[_0x4f4f('0x31')]=_[_0x4f4f('0x32')](_0x44cfba[_0x4f4f('0x2e')],_0x44cfba[_0x4f4f('0x2f')]);_0x44da59[_0x4f4f('0x33')]=_[_0x4f4f('0x32')](_0x44cfba[_0x4f4f('0x2e')],qs['fields'](_0x7b3cfe[_0x4f4f('0x2f')][_0x4f4f('0x34')]));_0x44da59['attributes']=_0x44da59['attributes']['length']?_0x44da59[_0x4f4f('0x33')]:_0x44cfba[_0x4f4f('0x2e')];if(_0x7b3cfe[_0x4f4f('0x2f')][_0x4f4f('0x3e')]){_0x44da59['include']=[{'all':!![]}];}_0x44da59=_[_0x4f4f('0x3a')]({},_0x44da59,_0x7b3cfe['options']);return db['OpenchannelTransferReport'][_0x4f4f('0x46')](_0x44da59)[_0x4f4f('0x26')](handleEntityNotFound(_0x368b21,null))[_0x4f4f('0x26')](respondWithResult(_0x368b21,null))['catch'](handleError(_0x368b21,null));};exports[_0x4f4f('0x47')]=function(_0x5fb8c0,_0x40c5ed){return db['OpenchannelTransferReport'][_0x4f4f('0x47')](_0x5fb8c0[_0x4f4f('0x48')],{})[_0x4f4f('0x26')](respondWithResult(_0x40c5ed,0xc9))['catch'](handleError(_0x40c5ed,null));};exports[_0x4f4f('0x24')]=function(_0x1bf430,_0x2827d9){if(_0x1bf430[_0x4f4f('0x48')]['id']){delete _0x1bf430[_0x4f4f('0x48')]['id'];}return db[_0x4f4f('0x2b')]['find']({'where':{'id':_0x1bf430[_0x4f4f('0x44')]['id']}})['then'](handleEntityNotFound(_0x2827d9,null))[_0x4f4f('0x26')](saveUpdates(_0x1bf430[_0x4f4f('0x48')],null))[_0x4f4f('0x26')](respondWithResult(_0x2827d9,null))[_0x4f4f('0x42')](handleError(_0x2827d9,null));};exports[_0x4f4f('0x25')]=function(_0x33eb65,_0x3399bb){return db[_0x4f4f('0x2b')][_0x4f4f('0x46')]({'where':{'id':_0x33eb65[_0x4f4f('0x44')]['id']}})[_0x4f4f('0x26')](handleEntityNotFound(_0x3399bb,null))[_0x4f4f('0x26')](removeEntity(_0x3399bb,null))[_0x4f4f('0x42')](handleError(_0x3399bb,null));};exports[_0x4f4f('0x49')]=function(_0x2f2d02,_0x328dd8){return db[_0x4f4f('0x2b')][_0x4f4f('0x49')]()[_0x4f4f('0x26')](respondWithResult(_0x328dd8,null))[_0x4f4f('0x42')](handleError(_0x328dd8,null));}; \ No newline at end of file +var _0xa258=['type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','fs-extra','squel','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','limit','undefined','offset','count','set','apply','reject','destroy','then','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','query','keys','filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge'];(function(_0x50d9cc,_0x494768){var _0x3ec19d=function(_0x1ef4e6){while(--_0x1ef4e6){_0x50d9cc['push'](_0x50d9cc['shift']());}};_0x3ec19d(++_0x494768);}(_0xa258,0xa3));var _0x8a25=function(_0x5e35fe,_0x2427ab){_0x5e35fe=_0x5e35fe-0x0;var _0xad7e84=_0xa258[_0x5e35fe];return _0xad7e84;};'use strict';var emlformat=require(_0x8a25('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a25('0x1'));var jsonpatch=require(_0x8a25('0x2'));var rp=require('request-promise');var moment=require(_0x8a25('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x8a25('0x4'));var util=require(_0x8a25('0x5'));var path=require('path');var sox=require(_0x8a25('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8a25('0x7'));var _=require('lodash');var squel=require(_0x8a25('0x8'));var crypto=require(_0x8a25('0x9'));var jsforce=require(_0x8a25('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x8a25('0xb'));var querystring=require('querystring');var Papa=require(_0x8a25('0xc'));var Redis=require(_0x8a25('0xd'));var authService=require(_0x8a25('0xe'));var qs=require(_0x8a25('0xf'));var as=require(_0x8a25('0x10'));var hardwareService=require(_0x8a25('0x11'));var logger=require(_0x8a25('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x8a25('0x13'));var licenseUtil=require(_0x8a25('0x14'));var db=require(_0x8a25('0x15'))['db'];function respondWithStatusCode(_0x28b80c,_0x81132d){_0x81132d=_0x81132d||0xcc;return function(_0x37dc2c){if(_0x37dc2c){return _0x28b80c[_0x8a25('0x16')](_0x81132d);}return _0x28b80c['status'](_0x81132d)[_0x8a25('0x17')]();};}function respondWithResult(_0x564ffb,_0x4c0b7a){_0x4c0b7a=_0x4c0b7a||0xc8;return function(_0x186943){if(_0x186943){return _0x564ffb[_0x8a25('0x18')](_0x4c0b7a)[_0x8a25('0x19')](_0x186943);}};}function respondWithFilteredResult(_0xf6513c,_0x4db5c8){return function(_0x433967){if(_0x433967){var _0x5cefb9=typeof _0x4db5c8['offset']==='undefined'&&typeof _0x4db5c8[_0x8a25('0x1a')]===_0x8a25('0x1b');var _0xe51196=_0x433967['count'];var _0x535ec6=_0x5cefb9?0x0:_0x4db5c8[_0x8a25('0x1c')];var _0x5d2ed2=_0x5cefb9?_0x433967[_0x8a25('0x1d')]:_0x4db5c8[_0x8a25('0x1c')]+_0x4db5c8[_0x8a25('0x1a')];var _0x1aff80;if(_0x5d2ed2>=_0xe51196){_0x5d2ed2=_0xe51196;_0x1aff80=0xc8;}else{_0x1aff80=0xce;}_0xf6513c[_0x8a25('0x18')](_0x1aff80);return _0xf6513c[_0x8a25('0x1e')]('Content-Range',_0x535ec6+'-'+_0x5d2ed2+'/'+_0xe51196)[_0x8a25('0x19')](_0x433967);}return null;};}function patchUpdates(_0x5872b2){return function(_0x58b128){try{jsonpatch[_0x8a25('0x1f')](_0x58b128,_0x5872b2,!![]);}catch(_0xb2f9ad){return BPromise[_0x8a25('0x20')](_0xb2f9ad);}return _0x58b128['save']();};}function saveUpdates(_0x17b20e,_0x5dc34e){return function(_0x3dc64f){if(_0x3dc64f){return _0x3dc64f['update'](_0x17b20e)['then'](function(_0x7a8126){return _0x7a8126;});}return null;};}function removeEntity(_0x5c80fc,_0x25c126){return function(_0x27e97e){if(_0x27e97e){return _0x27e97e[_0x8a25('0x21')]()[_0x8a25('0x22')](function(){_0x5c80fc[_0x8a25('0x18')](0xcc)[_0x8a25('0x17')]();});}};}function handleEntityNotFound(_0xd374f9,_0x22979a){return function(_0x40fe9f){if(!_0x40fe9f){_0xd374f9[_0x8a25('0x16')](0x194);}return _0x40fe9f;};}function handleError(_0x6efa68,_0x305759){_0x305759=_0x305759||0x1f4;return function(_0x16b35e){logger[_0x8a25('0x23')](_0x16b35e[_0x8a25('0x24')]);if(_0x16b35e['name']){delete _0x16b35e[_0x8a25('0x25')];}_0x6efa68[_0x8a25('0x18')](_0x305759)[_0x8a25('0x26')](_0x16b35e);};}exports[_0x8a25('0x27')]=function(_0x586854,_0x52e784){var _0x4bcb45={},_0x8bd20b={},_0x11a207={'count':0x0,'rows':[]};var _0x4fd2dc=_[_0x8a25('0x28')](db[_0x8a25('0x29')][_0x8a25('0x2a')],function(_0x2beb69){return{'name':_0x2beb69['fieldName'],'type':_0x2beb69['type'][_0x8a25('0x2b')]};});_0x8bd20b['model']=_[_0x8a25('0x28')](_0x4fd2dc,_0x8a25('0x25'));_0x8bd20b[_0x8a25('0x2c')]=_[_0x8a25('0x2d')](_0x586854['query']);_0x8bd20b[_0x8a25('0x2e')]=_[_0x8a25('0x2f')](_0x8bd20b['model'],_0x8bd20b[_0x8a25('0x2c')]);_0x4bcb45[_0x8a25('0x30')]=_[_0x8a25('0x2f')](_0x8bd20b[_0x8a25('0x31')],qs['fields'](_0x586854['query'][_0x8a25('0x32')]));_0x4bcb45[_0x8a25('0x30')]=_0x4bcb45['attributes']['length']?_0x4bcb45[_0x8a25('0x30')]:_0x8bd20b[_0x8a25('0x31')];if(!_0x586854[_0x8a25('0x2c')][_0x8a25('0x33')](_0x8a25('0x34'))){_0x4bcb45[_0x8a25('0x1a')]=qs[_0x8a25('0x1a')](_0x586854[_0x8a25('0x2c')]['limit']);_0x4bcb45['offset']=qs[_0x8a25('0x1c')](_0x586854[_0x8a25('0x2c')][_0x8a25('0x1c')]);}_0x4bcb45[_0x8a25('0x35')]=qs[_0x8a25('0x36')](_0x586854[_0x8a25('0x2c')]['sort']);_0x4bcb45[_0x8a25('0x37')]=qs[_0x8a25('0x2e')](_[_0x8a25('0x38')](_0x586854[_0x8a25('0x2c')],_0x8bd20b['filters']),_0x4fd2dc);if(_0x586854[_0x8a25('0x2c')][_0x8a25('0x39')]){_0x4bcb45['where']=_[_0x8a25('0x3a')](_0x4bcb45[_0x8a25('0x37')],{'$or':_[_0x8a25('0x28')](_0x4fd2dc,function(_0x1d4507){if(_0x1d4507[_0x8a25('0x3b')]!=='VIRTUAL'){var _0x433fdb={};_0x433fdb[_0x1d4507['name']]={'$like':'%'+_0x586854[_0x8a25('0x2c')][_0x8a25('0x39')]+'%'};return _0x433fdb;}})});}_0x4bcb45=_[_0x8a25('0x3a')]({},_0x4bcb45,_0x586854[_0x8a25('0x3c')]);var _0x201848={'where':_0x4bcb45[_0x8a25('0x37')]};return db[_0x8a25('0x29')][_0x8a25('0x1d')](_0x201848)[_0x8a25('0x22')](function(_0x2633ef){_0x11a207['count']=_0x2633ef;if(_0x586854[_0x8a25('0x2c')][_0x8a25('0x3d')]){_0x4bcb45[_0x8a25('0x3e')]=[{'all':!![]}];}return db[_0x8a25('0x29')][_0x8a25('0x3f')](_0x4bcb45);})[_0x8a25('0x22')](function(_0x3e5b05){_0x11a207[_0x8a25('0x40')]=_0x3e5b05;return _0x11a207;})[_0x8a25('0x22')](respondWithFilteredResult(_0x52e784,_0x4bcb45))[_0x8a25('0x41')](handleError(_0x52e784,null));};exports[_0x8a25('0x42')]=function(_0x3639a3,_0x200e72){var _0x4d2474={'raw':!![],'where':{'id':_0x3639a3[_0x8a25('0x43')]['id']}},_0x504a9d={};_0x504a9d[_0x8a25('0x31')]=_[_0x8a25('0x2d')](db[_0x8a25('0x29')]['rawAttributes']);_0x504a9d[_0x8a25('0x2c')]=_[_0x8a25('0x2d')](_0x3639a3['query']);_0x504a9d[_0x8a25('0x2e')]=_[_0x8a25('0x2f')](_0x504a9d[_0x8a25('0x31')],_0x504a9d[_0x8a25('0x2c')]);_0x4d2474[_0x8a25('0x30')]=_['intersection'](_0x504a9d[_0x8a25('0x31')],qs[_0x8a25('0x32')](_0x3639a3[_0x8a25('0x2c')][_0x8a25('0x32')]));_0x4d2474[_0x8a25('0x30')]=_0x4d2474[_0x8a25('0x30')][_0x8a25('0x44')]?_0x4d2474['attributes']:_0x504a9d['model'];if(_0x3639a3[_0x8a25('0x2c')][_0x8a25('0x3d')]){_0x4d2474['include']=[{'all':!![]}];}_0x4d2474=_['merge']({},_0x4d2474,_0x3639a3[_0x8a25('0x3c')]);return db['OpenchannelTransferReport'][_0x8a25('0x45')](_0x4d2474)['then'](handleEntityNotFound(_0x200e72,null))[_0x8a25('0x22')](respondWithResult(_0x200e72,null))['catch'](handleError(_0x200e72,null));};exports['create']=function(_0x22a919,_0x51d4aa){return db[_0x8a25('0x29')][_0x8a25('0x46')](_0x22a919[_0x8a25('0x47')],{})['then'](respondWithResult(_0x51d4aa,0xc9))[_0x8a25('0x41')](handleError(_0x51d4aa,null));};exports[_0x8a25('0x48')]=function(_0x14d4c2,_0x49f0d1){if(_0x14d4c2[_0x8a25('0x47')]['id']){delete _0x14d4c2['body']['id'];}return db[_0x8a25('0x29')][_0x8a25('0x45')]({'where':{'id':_0x14d4c2[_0x8a25('0x43')]['id']}})[_0x8a25('0x22')](handleEntityNotFound(_0x49f0d1,null))[_0x8a25('0x22')](saveUpdates(_0x14d4c2[_0x8a25('0x47')],null))['then'](respondWithResult(_0x49f0d1,null))[_0x8a25('0x41')](handleError(_0x49f0d1,null));};exports[_0x8a25('0x21')]=function(_0x5c9058,_0x44418d){return db[_0x8a25('0x29')][_0x8a25('0x45')]({'where':{'id':_0x5c9058[_0x8a25('0x43')]['id']}})[_0x8a25('0x22')](handleEntityNotFound(_0x44418d,null))['then'](removeEntity(_0x44418d,null))[_0x8a25('0x41')](handleError(_0x44418d,null));};exports[_0x8a25('0x49')]=function(_0x144561,_0x3d8028){return db[_0x8a25('0x29')][_0x8a25('0x49')]()[_0x8a25('0x22')](respondWithResult(_0x3d8028,null))['catch'](handleError(_0x3d8028,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index ff0b896..e0828a0 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 _0x283a=['define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelTransferReport.attributes'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x283a,0x170));var _0xa283=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x283a[_0x4e9628];return _0x27bc8c;};'use strict';var _=require(_0xa283('0x0'));var util=require('util');var logger=require(_0xa283('0x1'))('api');var moment=require(_0xa283('0x2'));var BPromise=require(_0xa283('0x3'));var rp=require(_0xa283('0x4'));var fs=require('fs');var path=require(_0xa283('0x5'));var rimraf=require(_0xa283('0x6'));var config=require(_0xa283('0x7'));var attributes=require(_0xa283('0x8'));module['exports']=function(_0x973440,_0x5e0456){return _0x973440[_0xa283('0x9')](_0xa283('0xa'),attributes,{'tableName':_0xa283('0xb'),'paranoid':![],'indexes':[{'name':_0xa283('0xc'),'fields':[_0xa283('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x91ff=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','OpenchannelTransferReport','report_openchannel_transfer','uniqueid','util'];(function(_0x114d53,_0xea4578){var _0x13df8d=function(_0x2b1d5d){while(--_0x2b1d5d){_0x114d53['push'](_0x114d53['shift']());}};_0x13df8d(++_0xea4578);}(_0x91ff,0xcf));var _0xf91f=function(_0x174ef5,_0x256e8e){_0x174ef5=_0x174ef5-0x0;var _0x1cc379=_0x91ff[_0x174ef5];return _0x1cc379;};'use strict';var _=require('lodash');var util=require(_0xf91f('0x0'));var logger=require(_0xf91f('0x1'))(_0xf91f('0x2'));var moment=require('moment');var BPromise=require(_0xf91f('0x3'));var rp=require(_0xf91f('0x4'));var fs=require('fs');var path=require(_0xf91f('0x5'));var rimraf=require(_0xf91f('0x6'));var config=require(_0xf91f('0x7'));var attributes=require('./openchannelTransferReport.attributes');module[_0xf91f('0x8')]=function(_0x5073eb,_0x410637){return _0x5073eb[_0xf91f('0x9')](_0xf91f('0xa'),attributes,{'tableName':_0xf91f('0xb'),'paranoid':![],'indexes':[{'name':_0xf91f('0xc'),'fields':[_0xf91f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index 8a6cff4..b4be8b5 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 _0x1b20=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','result','util','moment','ioredis'];(function(_0xad57ee,_0x2823a6){var _0x3eaea9=function(_0x185650){while(--_0x185650){_0xad57ee['push'](_0xad57ee['shift']());}};_0x3eaea9(++_0x2823a6);}(_0x1b20,0x66));var _0x01b2=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1b20[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var util=require(_0x01b2('0x0'));var moment=require(_0x01b2('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x01b2('0x2'));var db=require(_0x01b2('0x3'))['db'];var utils=require(_0x01b2('0x4'));var logger=require(_0x01b2('0x5'))(_0x01b2('0x6'));var config=require(_0x01b2('0x7'));var jayson=require(_0x01b2('0x8'));var client=jayson[_0x01b2('0x9')][_0x01b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xa64ad1,_0x43d561,_0x323470){return new BPromise(function(_0x508add,_0x132a08){return client['request'](_0xa64ad1,_0x323470)[_0x01b2('0xb')](function(_0x157fb6){logger[_0x01b2('0xc')](_0x01b2('0xd'),_0x43d561,_0x01b2('0xe'));logger[_0x01b2('0xf')](_0x01b2('0x10'),_0x43d561,_0x01b2('0xe'),JSON['stringify'](_0x157fb6));if(_0x157fb6[_0x01b2('0x11')]){if(_0x157fb6['error'][_0x01b2('0x12')]===0x1f4){logger['error'](_0x01b2('0xd'),_0x43d561,_0x157fb6[_0x01b2('0x11')][_0x01b2('0x13')]);return _0x132a08(_0x157fb6[_0x01b2('0x11')]['message']);}logger[_0x01b2('0x11')](_0x01b2('0xd'),_0x43d561,_0x157fb6[_0x01b2('0x11')][_0x01b2('0x13')]);return _0x508add(_0x157fb6[_0x01b2('0x11')]['message']);}else{logger[_0x01b2('0xc')](_0x01b2('0xd'),_0x43d561,_0x01b2('0xe'));_0x508add(_0x157fb6[_0x01b2('0x14')]['message']);}})['catch'](function(_0x2a8458){logger[_0x01b2('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x43d561,_0x2a8458);_0x132a08(_0x2a8458);});});} \ No newline at end of file +var _0x72a2=['info','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','http','request','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5d798c,_0x137af6){var _0x3944c9=function(_0x48aa52){while(--_0x48aa52){_0x5d798c['push'](_0x5d798c['shift']());}};_0x3944c9(++_0x137af6);}(_0x72a2,0x161));var _0x272a=function(_0x2f7aa0,_0x399bb4){_0x2f7aa0=_0x2f7aa0-0x0;var _0x25fc0f=_0x72a2[_0x2f7aa0];return _0x25fc0f;};'use strict';var _=require('lodash');var util=require(_0x272a('0x0'));var moment=require(_0x272a('0x1'));var BPromise=require(_0x272a('0x2'));var rs=require(_0x272a('0x3'));var fs=require('fs');var Redis=require(_0x272a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x272a('0x5'));var logger=require('../../config/logger')(_0x272a('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x272a('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x43d188,_0x220b90,_0x283070){return new BPromise(function(_0x54dbfb,_0x484f88){return client[_0x272a('0x8')](_0x43d188,_0x283070)['then'](function(_0x830fb6){logger['info'](_0x272a('0x9'),_0x220b90,_0x272a('0xa'));logger[_0x272a('0xb')](_0x272a('0xc'),_0x220b90,'request\x20sent',JSON['stringify'](_0x830fb6));if(_0x830fb6[_0x272a('0xd')]){if(_0x830fb6[_0x272a('0xd')]['code']===0x1f4){logger[_0x272a('0xd')](_0x272a('0x9'),_0x220b90,_0x830fb6[_0x272a('0xd')][_0x272a('0xe')]);return _0x484f88(_0x830fb6[_0x272a('0xd')]['message']);}logger[_0x272a('0xd')](_0x272a('0x9'),_0x220b90,_0x830fb6[_0x272a('0xd')][_0x272a('0xe')]);return _0x54dbfb(_0x830fb6['error'][_0x272a('0xe')]);}else{logger[_0x272a('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x220b90,'request\x20sent');_0x54dbfb(_0x830fb6['result']['message']);}})['catch'](function(_0x567955){logger[_0x272a('0xd')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x220b90,_0x567955);_0x484f88(_0x567955);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index ec48f9d..f4d0361 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 _0xd66e=['get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service'];(function(_0x12ec53,_0xa806f4){var _0x355ca2=function(_0x1d62a5){while(--_0x1d62a5){_0x12ec53['push'](_0x12ec53['shift']());}};_0x355ca2(++_0xa806f4);}(_0xd66e,0x1ce));var _0xed66=function(_0x5df2ff,_0x48300e){_0x5df2ff=_0x5df2ff-0x0;var _0x594f25=_0xd66e[_0x5df2ff];return _0x594f25;};'use strict';var multer=require('multer');var util=require(_0xed66('0x0'));var path=require(_0xed66('0x1'));var timeout=require(_0xed66('0x2'));var express=require(_0xed66('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xed66('0x4'));var interaction=require(_0xed66('0x5'));var config=require('../../config/environment');var controller=require('./pause.controller');router[_0xed66('0x6')]('/',auth[_0xed66('0x7')](),controller[_0xed66('0x8')]);router[_0xed66('0x6')](_0xed66('0x9'),auth[_0xed66('0x7')](),controller[_0xed66('0xa')]);router[_0xed66('0xb')]('/',auth[_0xed66('0x7')](),controller[_0xed66('0xc')]);router[_0xed66('0xd')]('/:id',auth['isAuthenticated'](),controller[_0xed66('0xe')]);router[_0xed66('0xf')]('/:id',auth[_0xed66('0x7')](),controller[_0xed66('0x10')]);module[_0xed66('0x11')]=router; \ No newline at end of file +var _0x1d89=['multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./pause.controller','isAuthenticated','get','show','post','create','put','/:id','update','destroy','exports'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1d89,0x156));var _0x91d8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d89[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x91d8('0x0'));var util=require(_0x91d8('0x1'));var path=require('path');var timeout=require(_0x91d8('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x91d8('0x3'));var auth=require(_0x91d8('0x4'));var interaction=require(_0x91d8('0x5'));var config=require(_0x91d8('0x6'));var controller=require(_0x91d8('0x7'));router['get']('/',auth[_0x91d8('0x8')](),controller['index']);router[_0x91d8('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x91d8('0xa')]);router[_0x91d8('0xb')]('/',auth[_0x91d8('0x8')](),controller[_0x91d8('0xc')]);router[_0x91d8('0xd')](_0x91d8('0xe'),auth['isAuthenticated'](),controller[_0x91d8('0xf')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x91d8('0x10')]);module[_0x91d8('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 399510b..583e0de 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 _0x2d7c=['STRING','sequelize','name'];(function(_0x1e1d0d,_0x47e3fa){var _0xc367b8=function(_0x4ebace){while(--_0x4ebace){_0x1e1d0d['push'](_0x1e1d0d['shift']());}};_0xc367b8(++_0x47e3fa);}(_0x2d7c,0xe5));var _0xc2d7=function(_0x17f397,_0x5bf1eb){_0x17f397=_0x17f397-0x0;var _0x65aa26=_0x2d7c[_0x17f397];return _0x65aa26;};'use strict';var Sequelize=require(_0xc2d7('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xc2d7('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0xc2d7('0x2')]}}; \ No newline at end of file +var _0xdfbe=['name','sequelize','STRING'];(function(_0x3de17f,_0x283eeb){var _0x1f79b6=function(_0x483f80){while(--_0x483f80){_0x3de17f['push'](_0x3de17f['shift']());}};_0x1f79b6(++_0x283eeb);}(_0xdfbe,0xc7));var _0xedfb=function(_0x147431,_0x487d8e){_0x147431=_0x147431-0x0;var _0x254e96=_0xdfbe[_0x147431];return _0x254e96;};'use strict';var Sequelize=require(_0xedfb('0x0'));module['exports']={'name':{'type':Sequelize[_0xedfb('0x1')],'unique':_0xedfb('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0xedfb('0x1')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 2bd9b37..0c2f298 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 _0xb788=['Pauses','destroy','error','stack','name','send','index','Pause','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','keys','fields','length','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','ejs','fs-extra','squel','jsforce','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','get'];(function(_0x43ab16,_0x95ec0){var _0x20b578=function(_0x4803a4){while(--_0x4803a4){_0x43ab16['push'](_0x43ab16['shift']());}};_0x20b578(++_0x95ec0);}(_0xb788,0x7a));var _0x8b78=function(_0x516ffb,_0x5b5b42){_0x516ffb=_0x516ffb-0x0;var _0x319667=_0xb788[_0x516ffb];return _0x319667;};'use strict';var emlformat=require(_0x8b78('0x0'));var rimraf=require(_0x8b78('0x1'));var zipdir=require(_0x8b78('0x2'));var jsonpatch=require(_0x8b78('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8b78('0x4'));var Mustache=require(_0x8b78('0x5'));var util=require(_0x8b78('0x6'));var path=require(_0x8b78('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8b78('0x8'));var fs=require('fs');var fs_extra=require(_0x8b78('0x9'));var _=require('lodash');var squel=require(_0x8b78('0xa'));var crypto=require('crypto');var jsforce=require(_0x8b78('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8b78('0xc'));var querystring=require(_0x8b78('0xd'));var Papa=require('papaparse');var Redis=require(_0x8b78('0xe'));var authService=require(_0x8b78('0xf'));var qs=require(_0x8b78('0x10'));var as=require(_0x8b78('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8b78('0x12'))('api');var utils=require(_0x8b78('0x13'));var config=require(_0x8b78('0x14'));var licenseUtil=require(_0x8b78('0x15'));var db=require(_0x8b78('0x16'))['db'];function respondWithStatusCode(_0xf4172f,_0x47704d){_0x47704d=_0x47704d||0xcc;return function(_0x317d12){if(_0x317d12){return _0xf4172f[_0x8b78('0x17')](_0x47704d);}return _0xf4172f[_0x8b78('0x18')](_0x47704d)[_0x8b78('0x19')]();};}function respondWithResult(_0x1af40f,_0x2c1272){_0x2c1272=_0x2c1272||0xc8;return function(_0x1c0400){if(_0x1c0400){return _0x1af40f['status'](_0x2c1272)[_0x8b78('0x1a')](_0x1c0400);}};}function respondWithFilteredResult(_0x26539d,_0x5a35c5){return function(_0x3913c8){if(_0x3913c8){var _0x378cdf=typeof _0x5a35c5[_0x8b78('0x1b')]===_0x8b78('0x1c')&&typeof _0x5a35c5[_0x8b78('0x1d')]===_0x8b78('0x1c');var _0x590524=_0x3913c8[_0x8b78('0x1e')];var _0x25f089=_0x378cdf?0x0:_0x5a35c5[_0x8b78('0x1b')];var _0x23c76c=_0x378cdf?_0x3913c8[_0x8b78('0x1e')]:_0x5a35c5[_0x8b78('0x1b')]+_0x5a35c5[_0x8b78('0x1d')];var _0x1c3c45;if(_0x23c76c>=_0x590524){_0x23c76c=_0x590524;_0x1c3c45=0xc8;}else{_0x1c3c45=0xce;}_0x26539d[_0x8b78('0x18')](_0x1c3c45);return _0x26539d[_0x8b78('0x1f')](_0x8b78('0x20'),_0x25f089+'-'+_0x23c76c+'/'+_0x590524)[_0x8b78('0x1a')](_0x3913c8);}return null;};}function patchUpdates(_0x4d187b){return function(_0x5c4cf5){try{jsonpatch[_0x8b78('0x21')](_0x5c4cf5,_0x4d187b,!![]);}catch(_0x4ff6c8){return BPromise['reject'](_0x4ff6c8);}return _0x5c4cf5[_0x8b78('0x22')]();};}function saveUpdates(_0x4a0cf8,_0x4c0559){return function(_0x1fd981){if(_0x1fd981){return _0x1fd981[_0x8b78('0x23')](_0x4a0cf8)['then'](function(_0x220a9e){return _0x220a9e;});}return null;};}function removeEntity(_0xa5ee6c,_0x22611f){return function(_0x5df86f){if(_0x5df86f){return _0x5df86f['destroy']()[_0x8b78('0x24')](function(){var _0x65431d=_0x5df86f[_0x8b78('0x25')]({'plain':!![]});var _0x438cf5=_0x8b78('0x26');return db['UserProfileResource'][_0x8b78('0x27')]({'where':{'type':_0x438cf5,'resourceId':_0x65431d['id']}})[_0x8b78('0x24')](function(){return _0x5df86f;});})[_0x8b78('0x24')](function(){_0xa5ee6c['status'](0xcc)[_0x8b78('0x19')]();});}};}function handleEntityNotFound(_0x32e0e9,_0x1ce710){return function(_0x1083f5){if(!_0x1083f5){_0x32e0e9[_0x8b78('0x17')](0x194);}return _0x1083f5;};}function handleError(_0x39d9d8,_0x244780){_0x244780=_0x244780||0x1f4;return function(_0x445423){logger[_0x8b78('0x28')](_0x445423[_0x8b78('0x29')]);if(_0x445423[_0x8b78('0x2a')]){delete _0x445423[_0x8b78('0x2a')];}_0x39d9d8[_0x8b78('0x18')](_0x244780)[_0x8b78('0x2b')](_0x445423);};}exports[_0x8b78('0x2c')]=function(_0x153d90,_0x428643){var _0x448892={},_0x2dd883={},_0x49d43b={'count':0x0,'rows':[]};var _0x140ffe=_['map'](db[_0x8b78('0x2d')][_0x8b78('0x2e')],function(_0x185c24){return{'name':_0x185c24[_0x8b78('0x2f')],'type':_0x185c24[_0x8b78('0x30')][_0x8b78('0x31')]};});_0x2dd883[_0x8b78('0x32')]=_[_0x8b78('0x33')](_0x140ffe,_0x8b78('0x2a'));_0x2dd883[_0x8b78('0x34')]=_['keys'](_0x153d90[_0x8b78('0x34')]);_0x2dd883[_0x8b78('0x35')]=_[_0x8b78('0x36')](_0x2dd883[_0x8b78('0x32')],_0x2dd883['query']);_0x448892[_0x8b78('0x37')]=_[_0x8b78('0x36')](_0x2dd883[_0x8b78('0x32')],qs['fields'](_0x153d90['query']['fields']));_0x448892['attributes']=_0x448892[_0x8b78('0x37')]['length']?_0x448892[_0x8b78('0x37')]:_0x2dd883[_0x8b78('0x32')];if(!_0x153d90['query']['hasOwnProperty'](_0x8b78('0x38'))){_0x448892[_0x8b78('0x1d')]=qs['limit'](_0x153d90[_0x8b78('0x34')]['limit']);_0x448892['offset']=qs[_0x8b78('0x1b')](_0x153d90['query'][_0x8b78('0x1b')]);}_0x448892[_0x8b78('0x39')]=qs[_0x8b78('0x3a')](_0x153d90[_0x8b78('0x34')]['sort']);_0x448892[_0x8b78('0x3b')]=qs[_0x8b78('0x35')](_['pick'](_0x153d90[_0x8b78('0x34')],_0x2dd883['filters']),_0x140ffe);if(_0x153d90[_0x8b78('0x34')][_0x8b78('0x3c')]){_0x448892['where']=_[_0x8b78('0x3d')](_0x448892[_0x8b78('0x3b')],{'$or':_[_0x8b78('0x33')](_0x140ffe,function(_0x52af85){if(_0x52af85[_0x8b78('0x30')]!==_0x8b78('0x3e')){var _0x2f15b9={};_0x2f15b9[_0x52af85[_0x8b78('0x2a')]]={'$like':'%'+_0x153d90[_0x8b78('0x34')][_0x8b78('0x3c')]+'%'};return _0x2f15b9;}})});}_0x448892=_[_0x8b78('0x3d')]({},_0x448892,_0x153d90['options']);var _0x4ed153={'where':_0x448892[_0x8b78('0x3b')]};return db[_0x8b78('0x2d')]['count'](_0x4ed153)[_0x8b78('0x24')](function(_0x24cf0f){_0x49d43b['count']=_0x24cf0f;if(_0x153d90[_0x8b78('0x34')][_0x8b78('0x3f')]){_0x448892[_0x8b78('0x40')]=[{'all':!![]}];}return db['Pause'][_0x8b78('0x41')](_0x448892);})[_0x8b78('0x24')](function(_0x4c1a4a){_0x49d43b[_0x8b78('0x42')]=_0x4c1a4a;return _0x49d43b;})[_0x8b78('0x24')](respondWithFilteredResult(_0x428643,_0x448892))['catch'](handleError(_0x428643,null));};exports['show']=function(_0x30c466,_0x2bdaf1){var _0x454763={'raw':!![],'where':{'id':_0x30c466['params']['id']}},_0x1e42f9={};_0x1e42f9[_0x8b78('0x32')]=_[_0x8b78('0x43')](db['Pause'][_0x8b78('0x2e')]);_0x1e42f9['query']=_[_0x8b78('0x43')](_0x30c466['query']);_0x1e42f9[_0x8b78('0x35')]=_[_0x8b78('0x36')](_0x1e42f9[_0x8b78('0x32')],_0x1e42f9[_0x8b78('0x34')]);_0x454763[_0x8b78('0x37')]=_[_0x8b78('0x36')](_0x1e42f9[_0x8b78('0x32')],qs[_0x8b78('0x44')](_0x30c466['query']['fields']));_0x454763['attributes']=_0x454763[_0x8b78('0x37')][_0x8b78('0x45')]?_0x454763[_0x8b78('0x37')]:_0x1e42f9[_0x8b78('0x32')];if(_0x30c466[_0x8b78('0x34')][_0x8b78('0x3f')]){_0x454763[_0x8b78('0x40')]=[{'all':!![]}];}_0x454763=_[_0x8b78('0x3d')]({},_0x454763,_0x30c466['options']);return db[_0x8b78('0x2d')][_0x8b78('0x46')](_0x454763)['then'](handleEntityNotFound(_0x2bdaf1,null))[_0x8b78('0x24')](respondWithResult(_0x2bdaf1,null))[_0x8b78('0x47')](handleError(_0x2bdaf1,null));};exports[_0x8b78('0x48')]=function(_0x5ea920,_0x1ff683){return db['Pause'][_0x8b78('0x48')](_0x5ea920[_0x8b78('0x49')],{})[_0x8b78('0x24')](function(_0x51181f){var _0x2db2dd=_0x5ea920['user']['get']({'plain':!![]});if(!_0x2db2dd)throw new Error(_0x8b78('0x4a'));if(_0x2db2dd[_0x8b78('0x4b')]===_0x8b78('0x4c')){var _0x9180a0=_0x51181f['get']({'plain':!![]});var _0x8914fb='Pauses';return db['UserProfileSection'][_0x8b78('0x46')]({'where':{'name':_0x8914fb,'userProfileId':_0x2db2dd['userProfileId']},'raw':!![]})[_0x8b78('0x24')](function(_0x538d9e){if(_0x538d9e&&_0x538d9e[_0x8b78('0x4d')]===0x0){return db['UserProfileResource'][_0x8b78('0x48')]({'name':_0x9180a0['name'],'resourceId':_0x9180a0['id'],'type':_0x538d9e['name'],'sectionId':_0x538d9e['id']},{})[_0x8b78('0x24')](function(){return _0x51181f;});}else{return _0x51181f;}})[_0x8b78('0x47')](function(_0x39f4a6){logger['error'](_0x8b78('0x4e'),_0x39f4a6);throw _0x39f4a6;});}return _0x51181f;})[_0x8b78('0x24')](respondWithResult(_0x1ff683,0xc9))['catch'](handleError(_0x1ff683,null));};exports[_0x8b78('0x23')]=function(_0x44d4dc,_0x5f0c13){if(_0x44d4dc[_0x8b78('0x49')]['id']){delete _0x44d4dc['body']['id'];}return db['Pause']['find']({'where':{'id':_0x44d4dc[_0x8b78('0x4f')]['id']}})[_0x8b78('0x24')](handleEntityNotFound(_0x5f0c13,null))[_0x8b78('0x24')](saveUpdates(_0x44d4dc['body'],null))[_0x8b78('0x24')](respondWithResult(_0x5f0c13,null))[_0x8b78('0x47')](handleError(_0x5f0c13,null));};exports[_0x8b78('0x27')]=function(_0x1f3177,_0x146b36){return db[_0x8b78('0x2d')][_0x8b78('0x46')]({'where':{'id':_0x1f3177[_0x8b78('0x4f')]['id']}})[_0x8b78('0x24')](handleEntityNotFound(_0x146b36,null))[_0x8b78('0x24')](removeEntity(_0x146b36,null))['catch'](handleError(_0x146b36,null));}; \ No newline at end of file +var _0x5470=['rawAttributes','key','model','query','intersection','fields','attributes','length','nolimit','order','sort','where','filters','pick','filter','merge','options','Pause','count','include','findAll','catch','params','keys','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Pauses','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','Content-Range','reject','save','update','destroy','get','UserProfileResource','then','sendStatus','error','stack','name','send','index','map'];(function(_0x293815,_0x1af5b1){var _0xc64fe9=function(_0x4c6f57){while(--_0x4c6f57){_0x293815['push'](_0x293815['shift']());}};_0xc64fe9(++_0x1af5b1);}(_0x5470,0x74));var _0x0547=function(_0x391507,_0x2be912){_0x391507=_0x391507-0x0;var _0x5af690=_0x5470[_0x391507];return _0x5af690;};'use strict';var emlformat=require(_0x0547('0x0'));var rimraf=require(_0x0547('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0547('0x2'));var rp=require(_0x0547('0x3'));var moment=require(_0x0547('0x4'));var BPromise=require(_0x0547('0x5'));var Mustache=require(_0x0547('0x6'));var util=require(_0x0547('0x7'));var path=require(_0x0547('0x8'));var sox=require(_0x0547('0x9'));var csv=require('to-csv');var ejs=require(_0x0547('0xa'));var fs=require('fs');var fs_extra=require(_0x0547('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x0547('0xc'));var jsforce=require(_0x0547('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x0547('0xe'));var Papa=require(_0x0547('0xf'));var Redis=require(_0x0547('0x10'));var authService=require(_0x0547('0x11'));var qs=require(_0x0547('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0547('0x13'));var logger=require(_0x0547('0x14'))(_0x0547('0x15'));var utils=require(_0x0547('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x0547('0x17'));var db=require(_0x0547('0x18'))['db'];function respondWithStatusCode(_0x31706c,_0x425fcd){_0x425fcd=_0x425fcd||0xcc;return function(_0x1e37b6){if(_0x1e37b6){return _0x31706c['sendStatus'](_0x425fcd);}return _0x31706c[_0x0547('0x19')](_0x425fcd)[_0x0547('0x1a')]();};}function respondWithResult(_0xf46e25,_0x48c6d3){_0x48c6d3=_0x48c6d3||0xc8;return function(_0xdbac92){if(_0xdbac92){return _0xf46e25[_0x0547('0x19')](_0x48c6d3)[_0x0547('0x1b')](_0xdbac92);}};}function respondWithFilteredResult(_0x204976,_0x50c4ea){return function(_0x5c4338){if(_0x5c4338){var _0x1a0955=typeof _0x50c4ea[_0x0547('0x1c')]===_0x0547('0x1d')&&typeof _0x50c4ea[_0x0547('0x1e')]===_0x0547('0x1d');var _0x559c75=_0x5c4338['count'];var _0x533e05=_0x1a0955?0x0:_0x50c4ea[_0x0547('0x1c')];var _0x11c767=_0x1a0955?_0x5c4338['count']:_0x50c4ea[_0x0547('0x1c')]+_0x50c4ea[_0x0547('0x1e')];var _0x2ce089;if(_0x11c767>=_0x559c75){_0x11c767=_0x559c75;_0x2ce089=0xc8;}else{_0x2ce089=0xce;}_0x204976[_0x0547('0x19')](_0x2ce089);return _0x204976['set'](_0x0547('0x1f'),_0x533e05+'-'+_0x11c767+'/'+_0x559c75)[_0x0547('0x1b')](_0x5c4338);}return null;};}function patchUpdates(_0x15a454){return function(_0x323f1d){try{jsonpatch['apply'](_0x323f1d,_0x15a454,!![]);}catch(_0x3c3467){return BPromise[_0x0547('0x20')](_0x3c3467);}return _0x323f1d[_0x0547('0x21')]();};}function saveUpdates(_0x4e1f7b,_0x403b13){return function(_0x4e46ad){if(_0x4e46ad){return _0x4e46ad[_0x0547('0x22')](_0x4e1f7b)['then'](function(_0x350c47){return _0x350c47;});}return null;};}function removeEntity(_0x380b46,_0x264788){return function(_0x27b09d){if(_0x27b09d){return _0x27b09d[_0x0547('0x23')]()['then'](function(){var _0x40318f=_0x27b09d[_0x0547('0x24')]({'plain':!![]});var _0x24ccc8='Pauses';return db[_0x0547('0x25')][_0x0547('0x23')]({'where':{'type':_0x24ccc8,'resourceId':_0x40318f['id']}})['then'](function(){return _0x27b09d;});})[_0x0547('0x26')](function(){_0x380b46[_0x0547('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x22fbaf,_0x185b39){return function(_0x47b1d2){if(!_0x47b1d2){_0x22fbaf[_0x0547('0x27')](0x194);}return _0x47b1d2;};}function handleError(_0x254018,_0x5ce05d){_0x5ce05d=_0x5ce05d||0x1f4;return function(_0xd86d3){logger[_0x0547('0x28')](_0xd86d3[_0x0547('0x29')]);if(_0xd86d3['name']){delete _0xd86d3[_0x0547('0x2a')];}_0x254018[_0x0547('0x19')](_0x5ce05d)[_0x0547('0x2b')](_0xd86d3);};}exports[_0x0547('0x2c')]=function(_0x1f4184,_0x439dfd){var _0x541032={},_0x4fca28={},_0x4679e8={'count':0x0,'rows':[]};var _0x4e2c70=_[_0x0547('0x2d')](db['Pause'][_0x0547('0x2e')],function(_0x50fb83){return{'name':_0x50fb83['fieldName'],'type':_0x50fb83['type'][_0x0547('0x2f')]};});_0x4fca28[_0x0547('0x30')]=_[_0x0547('0x2d')](_0x4e2c70,_0x0547('0x2a'));_0x4fca28[_0x0547('0x31')]=_['keys'](_0x1f4184[_0x0547('0x31')]);_0x4fca28['filters']=_[_0x0547('0x32')](_0x4fca28['model'],_0x4fca28[_0x0547('0x31')]);_0x541032['attributes']=_['intersection'](_0x4fca28[_0x0547('0x30')],qs['fields'](_0x1f4184['query'][_0x0547('0x33')]));_0x541032[_0x0547('0x34')]=_0x541032[_0x0547('0x34')][_0x0547('0x35')]?_0x541032['attributes']:_0x4fca28[_0x0547('0x30')];if(!_0x1f4184[_0x0547('0x31')]['hasOwnProperty'](_0x0547('0x36'))){_0x541032[_0x0547('0x1e')]=qs[_0x0547('0x1e')](_0x1f4184[_0x0547('0x31')][_0x0547('0x1e')]);_0x541032[_0x0547('0x1c')]=qs[_0x0547('0x1c')](_0x1f4184[_0x0547('0x31')][_0x0547('0x1c')]);}_0x541032[_0x0547('0x37')]=qs[_0x0547('0x38')](_0x1f4184[_0x0547('0x31')][_0x0547('0x38')]);_0x541032[_0x0547('0x39')]=qs[_0x0547('0x3a')](_[_0x0547('0x3b')](_0x1f4184['query'],_0x4fca28[_0x0547('0x3a')]),_0x4e2c70);if(_0x1f4184[_0x0547('0x31')][_0x0547('0x3c')]){_0x541032[_0x0547('0x39')]=_['merge'](_0x541032[_0x0547('0x39')],{'$or':_['map'](_0x4e2c70,function(_0xa58864){if(_0xa58864['type']!=='VIRTUAL'){var _0x5e462c={};_0x5e462c[_0xa58864[_0x0547('0x2a')]]={'$like':'%'+_0x1f4184[_0x0547('0x31')][_0x0547('0x3c')]+'%'};return _0x5e462c;}})});}_0x541032=_[_0x0547('0x3d')]({},_0x541032,_0x1f4184[_0x0547('0x3e')]);var _0x139776={'where':_0x541032[_0x0547('0x39')]};return db[_0x0547('0x3f')][_0x0547('0x40')](_0x139776)[_0x0547('0x26')](function(_0x5aa6d9){_0x4679e8[_0x0547('0x40')]=_0x5aa6d9;if(_0x1f4184[_0x0547('0x31')]['includeAll']){_0x541032[_0x0547('0x41')]=[{'all':!![]}];}return db['Pause'][_0x0547('0x42')](_0x541032);})[_0x0547('0x26')](function(_0x2dc189){_0x4679e8['rows']=_0x2dc189;return _0x4679e8;})['then'](respondWithFilteredResult(_0x439dfd,_0x541032))[_0x0547('0x43')](handleError(_0x439dfd,null));};exports['show']=function(_0x35380b,_0x47ebf8){var _0x2c9753={'raw':!![],'where':{'id':_0x35380b[_0x0547('0x44')]['id']}},_0x2a9464={};_0x2a9464['model']=_['keys'](db['Pause']['rawAttributes']);_0x2a9464[_0x0547('0x31')]=_[_0x0547('0x45')](_0x35380b[_0x0547('0x31')]);_0x2a9464[_0x0547('0x3a')]=_['intersection'](_0x2a9464[_0x0547('0x30')],_0x2a9464[_0x0547('0x31')]);_0x2c9753[_0x0547('0x34')]=_[_0x0547('0x32')](_0x2a9464[_0x0547('0x30')],qs['fields'](_0x35380b['query'][_0x0547('0x33')]));_0x2c9753[_0x0547('0x34')]=_0x2c9753[_0x0547('0x34')][_0x0547('0x35')]?_0x2c9753[_0x0547('0x34')]:_0x2a9464['model'];if(_0x35380b['query'][_0x0547('0x46')]){_0x2c9753['include']=[{'all':!![]}];}_0x2c9753=_[_0x0547('0x3d')]({},_0x2c9753,_0x35380b[_0x0547('0x3e')]);return db['Pause']['find'](_0x2c9753)[_0x0547('0x26')](handleEntityNotFound(_0x47ebf8,null))[_0x0547('0x26')](respondWithResult(_0x47ebf8,null))[_0x0547('0x43')](handleError(_0x47ebf8,null));};exports['create']=function(_0x54f0a7,_0x4d3132){return db[_0x0547('0x3f')][_0x0547('0x47')](_0x54f0a7[_0x0547('0x48')],{})[_0x0547('0x26')](function(_0x2c0961){var _0xa5aed3=_0x54f0a7[_0x0547('0x49')]['get']({'plain':!![]});if(!_0xa5aed3)throw new Error(_0x0547('0x4a'));if(_0xa5aed3[_0x0547('0x4b')]===_0x0547('0x49')){var _0x574767=_0x2c0961[_0x0547('0x24')]({'plain':!![]});var _0x3b454f=_0x0547('0x4c');return db['UserProfileSection']['find']({'where':{'name':_0x3b454f,'userProfileId':_0xa5aed3[_0x0547('0x4d')]},'raw':!![]})[_0x0547('0x26')](function(_0x37fbb9){if(_0x37fbb9&&_0x37fbb9[_0x0547('0x4e')]===0x0){return db['UserProfileResource'][_0x0547('0x47')]({'name':_0x574767[_0x0547('0x2a')],'resourceId':_0x574767['id'],'type':_0x37fbb9['name'],'sectionId':_0x37fbb9['id']},{})['then'](function(){return _0x2c0961;});}else{return _0x2c0961;}})['catch'](function(_0x611c9a){logger[_0x0547('0x28')](_0x0547('0x4f'),_0x611c9a);throw _0x611c9a;});}return _0x2c0961;})['then'](respondWithResult(_0x4d3132,0xc9))['catch'](handleError(_0x4d3132,null));};exports[_0x0547('0x22')]=function(_0x1063e4,_0x1818d8){if(_0x1063e4[_0x0547('0x48')]['id']){delete _0x1063e4[_0x0547('0x48')]['id'];}return db[_0x0547('0x3f')][_0x0547('0x50')]({'where':{'id':_0x1063e4[_0x0547('0x44')]['id']}})['then'](handleEntityNotFound(_0x1818d8,null))['then'](saveUpdates(_0x1063e4[_0x0547('0x48')],null))[_0x0547('0x26')](respondWithResult(_0x1818d8,null))[_0x0547('0x43')](handleError(_0x1818d8,null));};exports[_0x0547('0x23')]=function(_0x134751,_0xbe2ae7){return db[_0x0547('0x3f')][_0x0547('0x50')]({'where':{'id':_0x134751[_0x0547('0x44')]['id']}})['then'](handleEntityNotFound(_0xbe2ae7,null))[_0x0547('0x26')](removeEntity(_0xbe2ae7,null))[_0x0547('0x43')](handleError(_0xbe2ae7,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index 2b0d091..25410f0 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 _0x9957=['exports','define','Pause','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./pause.attributes'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'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':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1cb9=['./pause.attributes','exports','define','Pause','lodash','../../config/logger','api','moment','bluebird','path','rimraf'];(function(_0x22f675,_0x45b1b8){var _0x7ebb2c=function(_0x420f36){while(--_0x420f36){_0x22f675['push'](_0x22f675['shift']());}};_0x7ebb2c(++_0x45b1b8);}(_0x1cb9,0x14e));var _0x91cb=function(_0x1267ed,_0x2c95f3){_0x1267ed=_0x1267ed-0x0;var _0x1da765=_0x1cb9[_0x1267ed];return _0x1da765;};'use strict';var _=require(_0x91cb('0x0'));var util=require('util');var logger=require(_0x91cb('0x1'))(_0x91cb('0x2'));var moment=require(_0x91cb('0x3'));var BPromise=require(_0x91cb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x91cb('0x5'));var rimraf=require(_0x91cb('0x6'));var config=require('../../config/environment');var attributes=require(_0x91cb('0x7'));module[_0x91cb('0x8')]=function(_0x186dc3,_0x28543e){return _0x186dc3[_0x91cb('0x9')](_0x91cb('0xa'),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 059fe77..1b79b69 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 _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0xe38fa3,_0x17ff7b){var _0x5ac639=function(_0x43540b){while(--_0x43540b){_0xe38fa3['push'](_0xe38fa3['shift']());}};_0x5ac639(++_0x17ff7b);}(_0xb10b,0x12a));var _0xbb10=function(_0xdfc87d,_0x28e1a5){_0xdfc87d=_0xdfc87d-0x0;var _0x4e2a5e=_0xb10b[_0xdfc87d];return _0x4e2a5e;};'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')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x5007d9,_0x1fa4b1){var _0x5539f0=function(_0x4f4db9){while(--_0x4f4db9){_0x5007d9['push'](_0x5007d9['shift']());}};_0x5539f0(++_0x1fa4b1);}(_0x7a54,0x106));var _0x47a5=function(_0x5df264,_0x7f78ed){_0x5df264=_0x5df264-0x0;var _0x226b9e=_0x7a54[_0x5df264];return _0x226b9e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 86ba698..ca8f38e 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 _0x57d4=['../../config/environment','./plugin.controller','get','isAuthenticated','index','/webhook','webhookGet','show','diskStorage','join','root','server/files/plugins','originalname','%s-%s%s','basename','extname','now','single','file','upload','webhookPost','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4f84c3,_0x6d094d){var _0x460f9f=function(_0x5af5bd){while(--_0x5af5bd){_0x4f84c3['push'](_0x4f84c3['shift']());}};_0x460f9f(++_0x6d094d);}(_0x57d4,0x78));var _0x457d=function(_0x59a23b,_0x4bdad5){_0x59a23b=_0x59a23b-0x0;var _0x3be80c=_0x57d4[_0x59a23b];return _0x3be80c;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var fs_extra=require(_0x457d('0x5'));var auth=require(_0x457d('0x6'));var interaction=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var controller=require(_0x457d('0x9'));router[_0x457d('0xa')]('/',auth[_0x457d('0xb')](),controller[_0x457d('0xc')]);router['get'](_0x457d('0xd'),controller[_0x457d('0xe')]);router['get']('/:id',auth[_0x457d('0xb')](),controller[_0x457d('0xf')]);router[_0x457d('0xa')]('/:id/download',auth['isAuthenticated'](),controller['download']);var upload=multer({'storage':multer[_0x457d('0x10')]({'destination':function(_0x38ec93,_0x449f48,_0x128e09){_0x128e09(null,path[_0x457d('0x11')](config[_0x457d('0x12')],_0x457d('0x13')));},'filename':function(_0x24cf65,_0xe7d200,_0x5abf49){_0xe7d200[_0x457d('0x14')]=_0xe7d200[_0x457d('0x14')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5abf49(null,util['format'](_0x457d('0x15'),path[_0x457d('0x16')](_0xe7d200[_0x457d('0x14')],path[_0x457d('0x17')](_0xe7d200[_0x457d('0x14')])),Date[_0x457d('0x18')](),path[_0x457d('0x17')](_0xe7d200[_0x457d('0x14')])));}})});router['post']('/',upload[_0x457d('0x19')](_0x457d('0x1a')),controller[_0x457d('0x1b')]);router['post']('/webhook',controller[_0x457d('0x1c')]);router['put'](_0x457d('0x1d'),auth[_0x457d('0xb')](),controller['update']);router[_0x457d('0x1e')]('/:id',auth['isAuthenticated'](),controller[_0x457d('0x1e')]);module[_0x457d('0x1f')]=router; \ No newline at end of file +var _0xbb53=['exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/webhook','webhookGet','show','/:id/download','download','root','originalname','replace','%s-%s%s','basename','extname','post','single','upload','webhookPost','/:id','update','delete'];(function(_0x4a8227,_0x27ab19){var _0x403b2c=function(_0x6e793d){while(--_0x6e793d){_0x4a8227['push'](_0x4a8227['shift']());}};_0x403b2c(++_0x27ab19);}(_0xbb53,0x121));var _0x3bb5=function(_0x142a3b,_0x25e150){_0x142a3b=_0x142a3b-0x0;var _0x40ca69=_0xbb53[_0x142a3b];return _0x40ca69;};'use strict';var multer=require(_0x3bb5('0x0'));var util=require(_0x3bb5('0x1'));var path=require(_0x3bb5('0x2'));var timeout=require(_0x3bb5('0x3'));var express=require(_0x3bb5('0x4'));var router=express[_0x3bb5('0x5')]();var fs_extra=require(_0x3bb5('0x6'));var auth=require(_0x3bb5('0x7'));var interaction=require(_0x3bb5('0x8'));var config=require(_0x3bb5('0x9'));var controller=require('./plugin.controller');router['get']('/',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0xb')]);router[_0x3bb5('0xc')](_0x3bb5('0xd'),controller[_0x3bb5('0xe')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x3bb5('0xf')]);router[_0x3bb5('0xc')](_0x3bb5('0x10'),auth['isAuthenticated'](),controller[_0x3bb5('0x11')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x53af18,_0xd8d9bf,_0x2b915a){_0x2b915a(null,path['join'](config[_0x3bb5('0x12')],'server/files/plugins'));},'filename':function(_0x69f59a,_0x511bd8,_0x526bf0){_0x511bd8[_0x3bb5('0x13')]=_0x511bd8[_0x3bb5('0x13')][_0x3bb5('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x526bf0(null,util['format'](_0x3bb5('0x15'),path[_0x3bb5('0x16')](_0x511bd8['originalname'],path[_0x3bb5('0x17')](_0x511bd8[_0x3bb5('0x13')])),Date['now'](),path['extname'](_0x511bd8['originalname'])));}})});router[_0x3bb5('0x18')]('/',upload[_0x3bb5('0x19')]('file'),controller[_0x3bb5('0x1a')]);router[_0x3bb5('0x18')](_0x3bb5('0xd'),controller[_0x3bb5('0x1b')]);router['put'](_0x3bb5('0x1c'),auth[_0x3bb5('0xa')](),controller[_0x3bb5('0x1d')]);router['delete']('/:id',auth[_0x3bb5('0xa')](),controller[_0x3bb5('0x1e')]);module[_0x3bb5('0x1f')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index b9658e2..9b4a384 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 _0x2f41=['Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.','sequelize','exports','ENUM','html','script','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','never','always'];(function(_0x303f95,_0x4d87dc){var _0x3a741b=function(_0x208c0b){while(--_0x208c0b){_0x303f95['push'](_0x303f95['shift']());}};_0x3a741b(++_0x4d87dc);}(_0x2f41,0x71));var _0x12f4=function(_0x4429e0,_0xee6f1f){_0x4429e0=_0x4429e0-0x0;var _0x51a5b3=_0x2f41[_0x4429e0];return _0x51a5b3;};'use strict';var Sequelize=require(_0x12f4('0x0'));module[_0x12f4('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x12f4('0x2')](_0x12f4('0x3'),_0x12f4('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x12f4('0x5')],'comment':_0x12f4('0x6')},'active':{'type':Sequelize[_0x12f4('0x7')],'defaultValue':0x0,'comment':_0x12f4('0x8')},'sidebar':{'type':Sequelize['ENUM'](_0x12f4('0x9'),_0x12f4('0xa'),'always',_0x12f4('0xb')),'defaultValue':_0x12f4('0xc'),'comment':_0x12f4('0xd')},'icon':{'type':Sequelize['STRING']},'adminUrl':{'type':Sequelize['STRING']},'agentUrl':{'type':Sequelize[_0x12f4('0x5')]},'scriptName':{'type':Sequelize[_0x12f4('0x5')]},'scriptPath':{'type':Sequelize[_0x12f4('0x5')]}}; \ No newline at end of file +var _0x0405=['script','TEXT','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','BOOLEAN','adminOnly','always','never','sequelize','STRING','ENUM','html'];(function(_0x4a321c,_0x3ab7d5){var _0x108e52=function(_0x3e5e3b){while(--_0x3e5e3b){_0x4a321c['push'](_0x4a321c['shift']());}};_0x108e52(++_0x3ab7d5);}(_0x0405,0x75));var _0x5040=function(_0x3fcfe5,_0x41f86b){_0x3fcfe5=_0x3fcfe5-0x0;var _0x5a0637=_0x0405[_0x3fcfe5];return _0x5a0637;};'use strict';var Sequelize=require(_0x5040('0x0'));module['exports']={'name':{'type':Sequelize[_0x5040('0x1')]},'type':{'type':Sequelize[_0x5040('0x2')](_0x5040('0x3'),_0x5040('0x4'))},'description':{'type':Sequelize[_0x5040('0x5')]},'version':{'type':Sequelize[_0x5040('0x5')]},'path':{'type':Sequelize[_0x5040('0x1')],'comment':_0x5040('0x6')},'active':{'type':Sequelize[_0x5040('0x7')],'defaultValue':0x0,'comment':'Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.'},'sidebar':{'type':Sequelize[_0x5040('0x2')](_0x5040('0x8'),'agentOnly',_0x5040('0x9'),_0x5040('0xa')),'defaultValue':_0x5040('0x9'),'comment':'Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'},'icon':{'type':Sequelize[_0x5040('0x1')]},'adminUrl':{'type':Sequelize[_0x5040('0x1')]},'agentUrl':{'type':Sequelize[_0x5040('0x1')]},'scriptName':{'type':Sequelize[_0x5040('0x1')]},'scriptPath':{'type':Sequelize[_0x5040('0x1')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index d6976ee..f3d2920 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 _0xc75f=['html','views','Invalid\x20manifest:\x20views\x20missing','agent','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','icon-apps','admin','plugins','test','Warning:\x20agent\x20view\x20not\x20specified','script','create','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Zip\x20archive\x20removed','delete','\x27PATH\x27\x20parameter\x20not\x20specified','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','resolve','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','extract-zip','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','redis','localhost','./plugin.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','save','update','then','destroy','get','Plugins','UserProfileResource','error','stack','name','send','index','map','Plugin','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','download','join','server/files/plugins','format','%s.zip','basename','createWriteStream','zip','warning','code','ENOENT','Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','root','node_modules/**/*','attachments/**/*','Plugin\x20not\x20found','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','upload','filename','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','length','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','version','parameters','Invalid\x20manifest:\x20parameters\x20missing'];(function(_0x295537,_0x199890){var _0x111384=function(_0x2ec573){while(--_0x2ec573){_0x295537['push'](_0x295537['shift']());}};_0x111384(++_0x199890);}(_0xc75f,0x17d));var _0xfc75=function(_0x31a03f,_0x2579ec){_0x31a03f=_0x31a03f-0x0;var _0x268bfb=_0xc75f[_0x31a03f];return _0x268bfb;};'use strict';var emlformat=require(_0xfc75('0x0'));var rimraf=require(_0xfc75('0x1'));var zipdir=require(_0xfc75('0x2'));var jsonpatch=require(_0xfc75('0x3'));var rp=require('request-promise');var moment=require(_0xfc75('0x4'));var BPromise=require(_0xfc75('0x5'));var Mustache=require(_0xfc75('0x6'));var util=require('util');var path=require(_0xfc75('0x7'));var sox=require(_0xfc75('0x8'));var csv=require(_0xfc75('0x9'));var ejs=require(_0xfc75('0xa'));var fs=require('fs');var fs_extra=require(_0xfc75('0xb'));var _=require(_0xfc75('0xc'));var squel=require('squel');var crypto=require(_0xfc75('0xd'));var jsforce=require(_0xfc75('0xe'));var deskjs=require(_0xfc75('0xf'));var toCsv=require(_0xfc75('0x9'));var querystring=require(_0xfc75('0x10'));var Papa=require(_0xfc75('0x11'));var extract=require(_0xfc75('0x12'));var rimraf=require(_0xfc75('0x1'));var archiver=require('archiver');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfc75('0x13'));var as=require(_0xfc75('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xfc75('0x15'))(_0xfc75('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xfc75('0x17'));var db=require('../../mysqldb')['db'];config[_0xfc75('0x18')]=_['defaults'](config[_0xfc75('0x18')],{'host':_0xfc75('0x19'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfc75('0x18')]));require(_0xfc75('0x1a'))[_0xfc75('0x1b')](socket);function respondWithStatusCode(_0x361621,_0x2fee7a){_0x2fee7a=_0x2fee7a||0xcc;return function(_0x4f0e52){if(_0x4f0e52){return _0x361621[_0xfc75('0x1c')](_0x2fee7a);}return _0x361621[_0xfc75('0x1d')](_0x2fee7a)[_0xfc75('0x1e')]();};}function respondWithResult(_0x4dd837,_0x487b9b){_0x487b9b=_0x487b9b||0xc8;return function(_0x2c5ba6){if(_0x2c5ba6){return _0x4dd837[_0xfc75('0x1d')](_0x487b9b)[_0xfc75('0x1f')](_0x2c5ba6);}};}function respondWithFilteredResult(_0x2e2558,_0x5b9df3){return function(_0x1ea05c){if(_0x1ea05c){var _0x3c5316=typeof _0x5b9df3[_0xfc75('0x20')]==='undefined'&&typeof _0x5b9df3['limit']===_0xfc75('0x21');var _0x52fce9=_0x1ea05c[_0xfc75('0x22')];var _0x1ddd23=_0x3c5316?0x0:_0x5b9df3[_0xfc75('0x20')];var _0x48417d=_0x3c5316?_0x1ea05c[_0xfc75('0x22')]:_0x5b9df3['offset']+_0x5b9df3[_0xfc75('0x23')];var _0x30187a;if(_0x48417d>=_0x52fce9){_0x48417d=_0x52fce9;_0x30187a=0xc8;}else{_0x30187a=0xce;}_0x2e2558['status'](_0x30187a);return _0x2e2558[_0xfc75('0x24')](_0xfc75('0x25'),_0x1ddd23+'-'+_0x48417d+'/'+_0x52fce9)['json'](_0x1ea05c);}return null;};}function patchUpdates(_0x211ecb){return function(_0x22e5dd){try{jsonpatch[_0xfc75('0x26')](_0x22e5dd,_0x211ecb,!![]);}catch(_0x10cebb){return BPromise['reject'](_0x10cebb);}return _0x22e5dd[_0xfc75('0x27')]();};}function saveUpdates(_0x8205e5,_0x50be65){return function(_0x4beb5d){if(_0x4beb5d){return _0x4beb5d[_0xfc75('0x28')](_0x8205e5)[_0xfc75('0x29')](function(_0x575a11){return _0x575a11;});}return null;};}function removeEntity(_0x567781,_0x210281){return function(_0x47aaab){if(_0x47aaab){return _0x47aaab[_0xfc75('0x2a')]()['then'](function(){var _0x129c9f=_0x47aaab[_0xfc75('0x2b')]({'plain':!![]});var _0x4e4585=_0xfc75('0x2c');return db[_0xfc75('0x2d')][_0xfc75('0x2a')]({'where':{'type':_0x4e4585,'resourceId':_0x129c9f['id']}})['then'](function(){return _0x47aaab;});})['then'](function(){_0x567781[_0xfc75('0x1d')](0xcc)[_0xfc75('0x1e')]();});}};}function handleEntityNotFound(_0x48f475,_0x3a79d4){return function(_0x1824a6){if(!_0x1824a6){_0x48f475['sendStatus'](0x194);}return _0x1824a6;};}function handleError(_0x5887c2,_0x40d0e8){_0x40d0e8=_0x40d0e8||0x1f4;return function(_0x55ea5f){logger[_0xfc75('0x2e')](_0x55ea5f[_0xfc75('0x2f')]);if(_0x55ea5f[_0xfc75('0x30')]){delete _0x55ea5f['name'];}_0x5887c2[_0xfc75('0x1d')](_0x40d0e8)[_0xfc75('0x31')](_0x55ea5f);};}exports[_0xfc75('0x32')]=function(_0x1f1e1c,_0x12456c){var _0x171b5a={},_0x21619e={},_0x5c8c8d={'count':0x0,'rows':[]};var _0xd2ba7a=_[_0xfc75('0x33')](db[_0xfc75('0x34')][_0xfc75('0x35')],function(_0x259a79){return{'name':_0x259a79[_0xfc75('0x36')],'type':_0x259a79[_0xfc75('0x37')][_0xfc75('0x38')]};});_0x21619e[_0xfc75('0x39')]=_[_0xfc75('0x33')](_0xd2ba7a,_0xfc75('0x30'));_0x21619e[_0xfc75('0x3a')]=_['keys'](_0x1f1e1c[_0xfc75('0x3a')]);_0x21619e[_0xfc75('0x3b')]=_[_0xfc75('0x3c')](_0x21619e['model'],_0x21619e[_0xfc75('0x3a')]);_0x171b5a[_0xfc75('0x3d')]=_['intersection'](_0x21619e['model'],qs[_0xfc75('0x3e')](_0x1f1e1c[_0xfc75('0x3a')][_0xfc75('0x3e')]));_0x171b5a[_0xfc75('0x3d')]=_0x171b5a[_0xfc75('0x3d')]['length']?_0x171b5a['attributes']:_0x21619e['model'];if(!_0x1f1e1c[_0xfc75('0x3a')][_0xfc75('0x3f')](_0xfc75('0x40'))){_0x171b5a[_0xfc75('0x23')]=qs['limit'](_0x1f1e1c[_0xfc75('0x3a')]['limit']);_0x171b5a['offset']=qs['offset'](_0x1f1e1c[_0xfc75('0x3a')][_0xfc75('0x20')]);}_0x171b5a['order']=qs[_0xfc75('0x41')](_0x1f1e1c['query'][_0xfc75('0x41')]);_0x171b5a['where']=qs[_0xfc75('0x3b')](_[_0xfc75('0x42')](_0x1f1e1c[_0xfc75('0x3a')],_0x21619e['filters']),_0xd2ba7a);if(_0x1f1e1c[_0xfc75('0x3a')][_0xfc75('0x43')]){_0x171b5a[_0xfc75('0x44')]=_['merge'](_0x171b5a[_0xfc75('0x44')],{'$or':_[_0xfc75('0x33')](_0xd2ba7a,function(_0x470697){if(_0x470697[_0xfc75('0x37')]!==_0xfc75('0x45')){var _0x52b3a1={};_0x52b3a1[_0x470697[_0xfc75('0x30')]]={'$like':'%'+_0x1f1e1c['query']['filter']+'%'};return _0x52b3a1;}})});}_0x171b5a=_[_0xfc75('0x46')]({},_0x171b5a,_0x1f1e1c[_0xfc75('0x47')]);var _0x334ada={'where':_0x171b5a[_0xfc75('0x44')]};return db['Plugin'][_0xfc75('0x22')](_0x334ada)[_0xfc75('0x29')](function(_0xf3b078){_0x5c8c8d[_0xfc75('0x22')]=_0xf3b078;if(_0x1f1e1c[_0xfc75('0x3a')][_0xfc75('0x48')]){_0x171b5a[_0xfc75('0x49')]=[{'all':!![]}];}return db['Plugin'][_0xfc75('0x4a')](_0x171b5a);})['then'](function(_0x2a3a34){_0x5c8c8d[_0xfc75('0x4b')]=_0x2a3a34;return _0x5c8c8d;})[_0xfc75('0x29')](respondWithFilteredResult(_0x12456c,_0x171b5a))[_0xfc75('0x4c')](handleError(_0x12456c,null));};exports[_0xfc75('0x4d')]=function(_0x36540b,_0x2fbc2b){var _0x10bd38={'raw':!![],'where':{'id':_0x36540b[_0xfc75('0x4e')]['id']}},_0x153ee6={};_0x153ee6['model']=_[_0xfc75('0x4f')](db[_0xfc75('0x34')][_0xfc75('0x35')]);_0x153ee6[_0xfc75('0x3a')]=_[_0xfc75('0x4f')](_0x36540b['query']);_0x153ee6['filters']=_['intersection'](_0x153ee6['model'],_0x153ee6[_0xfc75('0x3a')]);_0x10bd38['attributes']=_[_0xfc75('0x3c')](_0x153ee6[_0xfc75('0x39')],qs['fields'](_0x36540b[_0xfc75('0x3a')][_0xfc75('0x3e')]));_0x10bd38[_0xfc75('0x3d')]=_0x10bd38[_0xfc75('0x3d')]['length']?_0x10bd38[_0xfc75('0x3d')]:_0x153ee6[_0xfc75('0x39')];if(_0x36540b[_0xfc75('0x3a')]['includeAll']){_0x10bd38[_0xfc75('0x49')]=[{'all':!![]}];}_0x10bd38=_[_0xfc75('0x46')]({},_0x10bd38,_0x36540b['options']);return db['Plugin'][_0xfc75('0x50')](_0x10bd38)[_0xfc75('0x29')](handleEntityNotFound(_0x2fbc2b,null))[_0xfc75('0x29')](respondWithResult(_0x2fbc2b,null))[_0xfc75('0x4c')](handleError(_0x2fbc2b,null));};exports[_0xfc75('0x51')]=function(_0x155288,_0xeb0a8d,_0x5a92cc){return db[_0xfc75('0x34')]['find']({'where':{'id':_0x155288[_0xfc75('0x4e')]['id']},'attributes':[_0xfc75('0x30'),'path'],'raw':!![]})[_0xfc75('0x29')](handleEntityNotFound(_0xeb0a8d,null))[_0xfc75('0x29')](function(_0x525020){if(_0x525020){var _0x5e83fb=path[_0xfc75('0x52')](config['root'],_0xfc75('0x53'),util[_0xfc75('0x54')](_0xfc75('0x55'),path[_0xfc75('0x56')](_0x525020[_0xfc75('0x7')])));var _0x148a0e=fs[_0xfc75('0x57')](_0x5e83fb);var _0x53fbab=archiver(_0xfc75('0x58'),{'zlib':{'level':0x9}});_0x53fbab['on'](_0xfc75('0x59'),function(_0xc08714){if(_0xc08714[_0xfc75('0x5a')]===_0xfc75('0x5b')){logger[_0xfc75('0x2e')](_0xc08714);}else{throw new db[(_0xfc75('0x5c'))][(_0xfc75('0x5d'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x53fbab['on'](_0xfc75('0x2e'),function(_0x2838b0){throw new db[(_0xfc75('0x5c'))][(_0xfc75('0x5d'))](_0xfc75('0x5e'));});_0x53fbab[_0xfc75('0x5f')](_0x148a0e);_0x53fbab['glob'](_0xfc75('0x60'),{'cwd':path['join'](config[_0xfc75('0x61')],_0xfc75('0x53'),path['dirname'](_0x525020[_0xfc75('0x7')])),'ignore':[path[_0xfc75('0x52')](path[_0xfc75('0x56')](_0x525020[_0xfc75('0x7')]),_0xfc75('0x62')),path[_0xfc75('0x52')](path['basename'](_0x525020['path']),_0xfc75('0x63'))],'nodir':!![]})['finalize']();_0x148a0e['on']('close',function(){if(!fs['existsSync'](_0x5e83fb)){throw new db[(_0xfc75('0x5c'))]['Error'](_0xfc75('0x64'));}return _0xeb0a8d['download'](_0x5e83fb,util[_0xfc75('0x54')](_0xfc75('0x55'),path[_0xfc75('0x56')](_0x525020['path'])),function(_0x4e9f27){if(_0x4e9f27){throw new db[(_0xfc75('0x5c'))][(_0xfc75('0x5d'))](_0xfc75('0x65'));}fs[_0xfc75('0x66')](_0x5e83fb);logger[_0xfc75('0x67')](_0xfc75('0x68'));logger[_0xfc75('0x67')]('Temporary\x20file\x20removed');});});}return null;})[_0xfc75('0x4c')](handleError(_0xeb0a8d,null));};exports[_0xfc75('0x69')]=function(_0x277a8a,_0x172242,_0x4dd24a){var _0x10b74d=path[_0xfc75('0x56')](_0x277a8a['file'][_0xfc75('0x6a')],path['extname'](_0x277a8a['file']['filename']));var _0x468dbe=path[_0xfc75('0x52')](config['root'],_0xfc75('0x53'),_0x277a8a['file'][_0xfc75('0x6a')]);var _0x286809=path['join'](config['root'],_0xfc75('0x53'),_0x10b74d);logger[_0xfc75('0x67')]('Plugin\x20upload\x20filepath:\x20%s',_0x468dbe);logger[_0xfc75('0x67')]('Plugin\x20upload\x20destination:\x20%s',_0x286809);try{fs[_0xfc75('0x6b')](_0x468dbe,parseInt(_0xfc75('0x6c'),0x8));extract(_0x468dbe,{'dir':_0x286809},function(_0x4b5867){if(_0x4b5867){logger['error'](_0x4b5867);handleError(_0x4b5867,!![]);};var _0x2e2581=fs['readdirSync'](_0x286809);if(_0x2e2581['length']>0x1){removeReferences(_0x468dbe,_0x286809);logger['error']('Invalid\x20plugin\x20structure');return _0x4dd24a(new Error(_0xfc75('0x6d')));}var _0xfd7256=fs['lstatSync'](path[_0xfc75('0x52')](_0x286809,_0x2e2581[0x0]));if(_0xfd7256[_0xfc75('0x6e')]()){removeReferences(_0x468dbe,_0x286809);logger[_0xfc75('0x2e')]('Invalid\x20plugin\x20structure');return _0x4dd24a(new Error(_0xfc75('0x6d')));}if(_0xfd7256[_0xfc75('0x6f')]()){var _0x593bf5=fs[_0xfc75('0x70')](path[_0xfc75('0x52')](_0x286809,_0x2e2581[0x0]));if(_0x593bf5[_0xfc75('0x71')]===0x0){removeReferences(_0x468dbe,_0x286809);logger['error']('Invalid\x20plugin\x20structure');return _0x4dd24a(new Error(_0xfc75('0x6d')));}var _0x53f4ec=_0x593bf5[_0xfc75('0x72')](function(_0x2eda9e){return _0x2eda9e===_0xfc75('0x73');});if(!_0x53f4ec){return _0x4dd24a(new Error(_0xfc75('0x74')));}var _0x20ebac=fs[_0xfc75('0x75')](path[_0xfc75('0x52')](_0x286809,_0x2e2581[0x0],_0xfc75('0x73')));var _0x320b35=JSON[_0xfc75('0x76')](_0x20ebac);if(_0xfc75('0x21')==typeof _0x320b35[_0xfc75('0x30')]){return _0x4dd24a(new Error(_0xfc75('0x77')));}if(_0xfc75('0x21')==typeof _0x320b35[_0xfc75('0x37')]){return _0x4dd24a(new Error('Invalid\x20manifest:\x20type\x20missing'));}if(_0xfc75('0x21')==typeof _0x320b35[_0xfc75('0x78')]){return _0x4dd24a(new Error('Invalid\x20manifest:\x20version\x20not\x20specified'));}if(_0xfc75('0x21')==typeof _0x320b35[_0xfc75('0x79')]){return _0x4dd24a(new Error(_0xfc75('0x7a')));}if(_0x320b35[_0xfc75('0x37')]===_0xfc75('0x7b')){if(_0xfc75('0x21')==typeof _0x320b35[_0xfc75('0x79')][_0xfc75('0x7c')]){return _0x4dd24a(new Error(_0xfc75('0x7d')));}if(_0xfc75('0x21')==typeof _0x320b35[_0xfc75('0x79')][_0xfc75('0x7c')]['admin']&&_0xfc75('0x21')==typeof _0x320b35['parameters']['views'][_0xfc75('0x7e')]){return _0x4dd24a(new Error(_0xfc75('0x7f')));}}else if(_0x320b35['type']==='script'){if('undefined'==typeof _0x320b35[_0xfc75('0x79')][_0xfc75('0x80')]){return _0x4dd24a(new Error('Invalid\x20manifest:\x20script\x20name\x20missing'));}if(_0xfc75('0x21')==typeof _0x320b35[_0xfc75('0x79')][_0xfc75('0x81')]){return _0x4dd24a(new Error(_0xfc75('0x82')));}}else{return _0x4dd24a(new Error(_0xfc75('0x83')));}var _0x30cd78=_0x320b35[_0xfc75('0x30')];var _0x5a9197=_0x320b35[_0xfc75('0x84')];var _0x3c46fa=_0x320b35['type'];var _0xae7081=_0x320b35['sidebar']?_0x320b35[_0xfc75('0x85')]:_0xfc75('0x86');var _0x46d444=_0x320b35['icon']?_0x320b35[_0xfc75('0x87')]:_0xfc75('0x88');var _0x37fba7='';var _0x33e899='';var _0x5bbd87='';var _0x58c8fc='';var _0xbf6690=_0x320b35[_0xfc75('0x78')];if(_0x3c46fa===_0xfc75('0x7b')){if(_0xfc75('0x21')!=typeof _0x320b35[_0xfc75('0x79')][_0xfc75('0x7c')][_0xfc75('0x89')]){var _0x17e179=_0x320b35['parameters']['views'][_0xfc75('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x17e179)){_0x37fba7=path['join'](_0xfc75('0x8a'),_0x10b74d,_0x2e2581[0x0],_0x17e179);}else{_0x37fba7=_0x17e179;}}else{logger[_0xfc75('0x67')]('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x320b35['parameters'][_0xfc75('0x7c')][_0xfc75('0x7e')]){var _0x3038a4=_0x320b35[_0xfc75('0x79')][_0xfc75('0x7c')][_0xfc75('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xfc75('0x8b')](_0x3038a4)){_0x33e899=path[_0xfc75('0x52')]('plugins',_0x10b74d,_0x2e2581[0x0],_0x3038a4);}else{_0x33e899=_0x3038a4;}}else{logger[_0xfc75('0x67')](_0xfc75('0x8c'));}}else if(_0x3c46fa===_0xfc75('0x8d')){_0x5bbd87=_0x320b35['parameters']['scriptName'];_0x58c8fc=_0x320b35[_0xfc75('0x79')][_0xfc75('0x81')];if('undefined'!=typeof _0x320b35[_0xfc75('0x79')][_0xfc75('0x7c')]){if('undefined'!=typeof _0x320b35[_0xfc75('0x79')][_0xfc75('0x7c')][_0xfc75('0x89')]){var _0x17e179=_0x320b35[_0xfc75('0x79')][_0xfc75('0x7c')][_0xfc75('0x89')];if(!/^(f|ht)tps?:\/\//i['test'](_0x17e179)){_0x37fba7=path[_0xfc75('0x52')](_0xfc75('0x8a'),_0x10b74d,_0x2e2581[0x0],_0x17e179);}else{_0x37fba7=_0x17e179;}}if(_0xfc75('0x21')!=typeof _0x320b35[_0xfc75('0x79')]['views'][_0xfc75('0x7e')]){var _0x3038a4=_0x320b35[_0xfc75('0x79')]['views'][_0xfc75('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xfc75('0x8b')](_0x3038a4)){_0x33e899=path[_0xfc75('0x52')](_0xfc75('0x8a'),_0x10b74d,_0x2e2581[0x0],_0x3038a4);}else{_0x33e899=_0x3038a4;}}}}var _0x5222f2={'name':_0x30cd78,'description':_0x5a9197,'path':path[_0xfc75('0x52')](_0x10b74d,_0x2e2581[0x0]),'type':_0x3c46fa,'sidebar':_0xae7081,'icon':_0x46d444,'adminUrl':_0x37fba7,'agentUrl':_0x33e899,'scriptName':_0x5bbd87,'scriptPath':_0x58c8fc,'version':_0xbf6690};removeReferences(_0x468dbe,null);return db[_0xfc75('0x34')][_0xfc75('0x8e')](_0x5222f2)['then'](function(_0x5ee724){var _0x5af3dc={'role':_0x277a8a[_0xfc75('0x8f')][_0xfc75('0x90')],'userProfileId':_0x277a8a[_0xfc75('0x8f')][_0xfc75('0x91')]};if(!_0x5af3dc)throw new Error(_0xfc75('0x92'));if(_0x5af3dc[_0xfc75('0x90')]===_0xfc75('0x93')){var _0x28a3d3=_0x5ee724[_0xfc75('0x2b')]({'plain':!![]});return db[_0xfc75('0x94')][_0xfc75('0x50')]({'where':{'name':_0xfc75('0x2c'),'userProfileId':_0x5af3dc[_0xfc75('0x91')]},'raw':!![]})[_0xfc75('0x29')](function(_0x3b9301){if(_0x3b9301&&_0x3b9301[_0xfc75('0x95')]===0x0){return db[_0xfc75('0x2d')][_0xfc75('0x8e')]({'name':_0x28a3d3['name'],'resourceId':_0x28a3d3['id'],'type':_0x3b9301['name'],'sectionId':_0x3b9301['id']},{})[_0xfc75('0x29')](function(){return _0x5ee724;});}else{return _0x5ee724;}})[_0xfc75('0x4c')](function(_0x20f5fd){logger[_0xfc75('0x2e')](_0xfc75('0x96'),_0x20f5fd);throw _0x20f5fd;});}return _0x5ee724;})['then'](respondWithResult(_0x172242,null))[_0xfc75('0x4c')](handleError(_0x172242,null));}});}catch(_0x599f2a){_0x172242[_0xfc75('0x1d')](0x1f4)[_0xfc75('0x31')](_0x599f2a);}};function removeReferences(_0x2e5f1e,_0x136f6e){try{if(_0x2e5f1e){fs[_0xfc75('0x66')](_0x2e5f1e);logger[_0xfc75('0x67')](_0xfc75('0x97'));}if(_0x136f6e){rimraf(_0x136f6e,function(){});logger[_0xfc75('0x67')]('Extracted\x20folder\x20removed');}}catch(_0x413cb9){logger[_0xfc75('0x2e')](_0x413cb9);}}exports[_0xfc75('0x28')]=function(_0x52584d,_0x459248,_0x1d5c38){return db[_0xfc75('0x34')]['find']({'where':{'id':_0x52584d[_0xfc75('0x4e')]['id']}})[_0xfc75('0x29')](handleEntityNotFound(_0x459248,null))[_0xfc75('0x29')](saveUpdates(_0x52584d[_0xfc75('0x8f')],null))['then'](respondWithResult(_0x459248,null))[_0xfc75('0x4c')](handleError(_0x459248,null));};exports[_0xfc75('0x98')]=function(_0x2a2c02,_0x4c9312,_0x314d90){return db[_0xfc75('0x34')][_0xfc75('0x50')]({'where':{'id':_0x2a2c02[_0xfc75('0x4e')]['id']}})[_0xfc75('0x29')](function(_0x6750ac){if(_0x6750ac){return _0x6750ac[_0xfc75('0x2a')]();}})[_0xfc75('0x29')](function(_0x4e51a5){rimraf(path['join'](config[_0xfc75('0x61')],'server/files/plugins',path['dirname'](_0x4e51a5['path'])),function(){});return _0x4e51a5;})[_0xfc75('0x29')](handleEntityNotFound(_0x4c9312,null))['then'](respondWithStatusCode(_0x4c9312,null))[_0xfc75('0x4c')](handleError(_0x4c9312,null));};exports['webhookGet']=function(_0x4d9dc0,_0xe99404,_0x2ac794){return BPromise['resolve']()[_0xfc75('0x29')](function(){if(!_0x4d9dc0[_0xfc75('0x3a')][_0xfc75('0x7')]){throw new Error(_0xfc75('0x99'));}if(!_0x4d9dc0['query'][_0xfc75('0x9a')]){throw new Error(_0xfc75('0x9b'));}var _0x5c41d2=_0x4d9dc0[_0xfc75('0x3a')][_0xfc75('0x9c')]?_0x4d9dc0[_0xfc75('0x3a')][_0xfc75('0x9c')]+':'+_0x4d9dc0[_0xfc75('0x3a')][_0xfc75('0x9a')]:_0xfc75('0x9d')+_0x4d9dc0[_0xfc75('0x3a')][_0xfc75('0x9a')];var _0x204e3f=_0x4d9dc0['query'][_0xfc75('0x1f')]?_0x4d9dc0[_0xfc75('0x3a')]['json']:!![];var _0x19d8fa=_0x4d9dc0[_0xfc75('0x3a')][_0xfc75('0x9e')]?_0x4d9dc0[_0xfc75('0x3a')][_0xfc75('0x9e')]:null;var _0x16ad6b={'method':_0x4d9dc0[_0xfc75('0x9f')],'uri':util['format'](_0xfc75('0xa0'),_0x5c41d2,_0x4d9dc0['query']['path']),'json':_0x204e3f,'resolveWithFullResponse':!![],'encoding':_0x19d8fa,'qs':_0x4d9dc0['query']};if(_0x4d9dc0[_0xfc75('0xa1')]){_0x16ad6b[_0xfc75('0xa1')]=_0x4d9dc0[_0xfc75('0xa1')];if(_0x16ad6b['headers']['content-length']){delete _0x16ad6b['headers'][_0xfc75('0xa2')];}}if(_0x16ad6b['headers'][_0xfc75('0xa3')]){delete _0x16ad6b[_0xfc75('0xa1')][_0xfc75('0xa3')];}return rp(_0x16ad6b);})[_0xfc75('0x29')](function(_0x4dc446){if(_0x4dc446){_0xe99404['set'](_0x4dc446[_0xfc75('0xa1')]);logger[_0xfc75('0x67')](_0x4dc446['body']);if(_[_0xfc75('0xa4')](_0x4d9dc0[_0xfc75('0x3a')]['path'],_0xfc75('0x51'))&&_0x4dc446[_0xfc75('0xa5')]==0x1f4){return _0xe99404[_0xfc75('0x1c')](_0x4dc446[_0xfc75('0xa5')]);}else{return _0xe99404[_0xfc75('0x1d')](_0x4dc446['statusCode'])[_0xfc75('0x31')](_0x4dc446[_0xfc75('0x8f')]);}}else{return _0xe99404['sendStatus'](0xc8);}})[_0xfc75('0x4c')](handleError(_0xe99404,null));};exports[_0xfc75('0xa6')]=function(_0x586d95,_0xf1977b,_0x346926){return BPromise[_0xfc75('0xa7')]()['then'](function(){if(!_0x586d95['query'][_0xfc75('0x7')]){throw new Error(_0xfc75('0x99'));}if(!_0x586d95[_0xfc75('0x3a')]['port']){throw new Error(_0xfc75('0x9b'));}var _0x35e285=_0x586d95[_0xfc75('0x3a')][_0xfc75('0x9c')]?_0x586d95[_0xfc75('0x3a')][_0xfc75('0x9c')]+':'+_0x586d95['query'][_0xfc75('0x9a')]:_0xfc75('0x9d')+_0x586d95[_0xfc75('0x3a')][_0xfc75('0x9a')];var _0x546256=_0x586d95[_0xfc75('0x3a')]['json']?_0x586d95[_0xfc75('0x3a')]['json']:!![];var _0x430307=_0x586d95['query']['encoding']?_0x586d95[_0xfc75('0x3a')][_0xfc75('0x9e')]:null;var _0x3b514d={'method':_0x586d95[_0xfc75('0x9f')],'uri':util[_0xfc75('0x54')](_0xfc75('0xa0'),_0x35e285,_0x586d95['query']['path']),'json':_0x546256,'resolveWithFullResponse':!![],'encoding':_0x430307,'body':_0x586d95['body']};if(_0x586d95[_0xfc75('0xa1')]){_0x3b514d[_0xfc75('0xa1')]=_0x586d95[_0xfc75('0xa1')];if(_0x3b514d['headers']['content-length']){delete _0x3b514d[_0xfc75('0xa1')][_0xfc75('0xa2')];}}if(_0x3b514d[_0xfc75('0xa1')][_0xfc75('0xa3')]){delete _0x3b514d['headers'][_0xfc75('0xa3')];}return rp(_0x3b514d);})[_0xfc75('0x29')](function(_0x3cc158){if(_0x3cc158){_0xf1977b[_0xfc75('0x24')](_0x3cc158[_0xfc75('0xa1')]);logger[_0xfc75('0x67')](_0x3cc158[_0xfc75('0x8f')]);return _0xf1977b['status'](_0x3cc158[_0xfc75('0xa5')])[_0xfc75('0x31')](_0x3cc158[_0xfc75('0x8f')]);}else{return _0xf1977b[_0xfc75('0x1c')](0xc8);}})[_0xfc75('0x4c')](handleError(_0xf1977b,null));}; \ No newline at end of file +var _0x8612=['register','sendStatus','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','get','UserProfileResource','destroy','end','stack','name','send','index','map','Plugin','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','rows','catch','show','params','find','download','join','server/files/plugins','format','%s.zip','basename','zip','code','ENOENT','error','Error\x20while\x20generating\x20the\x20zip\x20archive','Sequelize','Error','glob','root','dirname','node_modules/**/*','attachments/**/*','finalize','existsSync','Plugin\x20not\x20found','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20destination:\x20%s','0777','readdirSync','lstatSync','isFile','Invalid\x20plugin\x20structure','isDirectory','some','Plugin\x20manifest\x20missing','manifest.json','parse','Invalid\x20manifest:\x20type\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','scriptPath','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','icon','icon-apps','test','plugins','Warning:\x20admin\x20view\x20not\x20specified','agent','Warning:\x20agent\x20view\x20not\x20specified','create','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','unlinkSync','Zip\x20archive\x20removed','port','\x27PORT\x27\x20parameter\x20not\x20specified','hostname','http://localhost:','encoding','method','%s%s','headers','content-length','content-type','statusCode','webhookPost','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','extract-zip','archiver','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../mysqldb','redis','defaults','socket.io-emitter','./plugin.socket'];(function(_0x3850fd,_0x2fdbda){var _0x2afd90=function(_0x5ee9d1){while(--_0x5ee9d1){_0x3850fd['push'](_0x3850fd['shift']());}};_0x2afd90(++_0x2fdbda);}(_0x8612,0x12f));var _0x2861=function(_0x464a49,_0x398d15){_0x464a49=_0x464a49-0x0;var _0x5d0823=_0x8612[_0x464a49];return _0x5d0823;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2861('0x0'));var zipdir=require(_0x2861('0x1'));var jsonpatch=require(_0x2861('0x2'));var rp=require(_0x2861('0x3'));var moment=require(_0x2861('0x4'));var BPromise=require(_0x2861('0x5'));var Mustache=require(_0x2861('0x6'));var util=require(_0x2861('0x7'));var path=require(_0x2861('0x8'));var sox=require(_0x2861('0x9'));var csv=require('to-csv');var ejs=require(_0x2861('0xa'));var fs=require('fs');var fs_extra=require(_0x2861('0xb'));var _=require(_0x2861('0xc'));var squel=require(_0x2861('0xd'));var crypto=require(_0x2861('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x2861('0xf'));var Papa=require(_0x2861('0x10'));var extract=require(_0x2861('0x11'));var rimraf=require(_0x2861('0x0'));var archiver=require(_0x2861('0x12'));var Redis=require(_0x2861('0x13'));var authService=require(_0x2861('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2861('0x15'));var logger=require(_0x2861('0x16'))(_0x2861('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2861('0x18'))['db'];config[_0x2861('0x19')]=_[_0x2861('0x1a')](config[_0x2861('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0x2861('0x1b'))(new Redis(config[_0x2861('0x19')]));require(_0x2861('0x1c'))[_0x2861('0x1d')](socket);function respondWithStatusCode(_0x29fab7,_0x58f3b3){_0x58f3b3=_0x58f3b3||0xcc;return function(_0x4bac0e){if(_0x4bac0e){return _0x29fab7[_0x2861('0x1e')](_0x58f3b3);}return _0x29fab7['status'](_0x58f3b3)['end']();};}function respondWithResult(_0x37b683,_0x2eeccd){_0x2eeccd=_0x2eeccd||0xc8;return function(_0x4a3e6b){if(_0x4a3e6b){return _0x37b683['status'](_0x2eeccd)[_0x2861('0x1f')](_0x4a3e6b);}};}function respondWithFilteredResult(_0x2982ee,_0xdbe67b){return function(_0x597156){if(_0x597156){var _0x137dba=typeof _0xdbe67b[_0x2861('0x20')]===_0x2861('0x21')&&typeof _0xdbe67b[_0x2861('0x22')]===_0x2861('0x21');var _0x4be13d=_0x597156[_0x2861('0x23')];var _0x769c62=_0x137dba?0x0:_0xdbe67b[_0x2861('0x20')];var _0x17a3a0=_0x137dba?_0x597156[_0x2861('0x23')]:_0xdbe67b[_0x2861('0x20')]+_0xdbe67b[_0x2861('0x22')];var _0x37c883;if(_0x17a3a0>=_0x4be13d){_0x17a3a0=_0x4be13d;_0x37c883=0xc8;}else{_0x37c883=0xce;}_0x2982ee[_0x2861('0x24')](_0x37c883);return _0x2982ee[_0x2861('0x25')](_0x2861('0x26'),_0x769c62+'-'+_0x17a3a0+'/'+_0x4be13d)['json'](_0x597156);}return null;};}function patchUpdates(_0x4863f1){return function(_0x1846e9){try{jsonpatch['apply'](_0x1846e9,_0x4863f1,!![]);}catch(_0x1655b8){return BPromise[_0x2861('0x27')](_0x1655b8);}return _0x1846e9[_0x2861('0x28')]();};}function saveUpdates(_0x39eb8b,_0x368d59){return function(_0xeb7ded){if(_0xeb7ded){return _0xeb7ded[_0x2861('0x29')](_0x39eb8b)[_0x2861('0x2a')](function(_0xbbd31c){return _0xbbd31c;});}return null;};}function removeEntity(_0x5f124e,_0x30b824){return function(_0x8eee80){if(_0x8eee80){return _0x8eee80['destroy']()[_0x2861('0x2a')](function(){var _0x59ec89=_0x8eee80[_0x2861('0x2b')]({'plain':!![]});var _0xcf3c13='Plugins';return db[_0x2861('0x2c')][_0x2861('0x2d')]({'where':{'type':_0xcf3c13,'resourceId':_0x59ec89['id']}})[_0x2861('0x2a')](function(){return _0x8eee80;});})[_0x2861('0x2a')](function(){_0x5f124e[_0x2861('0x24')](0xcc)[_0x2861('0x2e')]();});}};}function handleEntityNotFound(_0x5e16a1,_0x3390f0){return function(_0x526c06){if(!_0x526c06){_0x5e16a1[_0x2861('0x1e')](0x194);}return _0x526c06;};}function handleError(_0x69da4f,_0x416b30){_0x416b30=_0x416b30||0x1f4;return function(_0x593f8){logger['error'](_0x593f8[_0x2861('0x2f')]);if(_0x593f8[_0x2861('0x30')]){delete _0x593f8[_0x2861('0x30')];}_0x69da4f[_0x2861('0x24')](_0x416b30)[_0x2861('0x31')](_0x593f8);};}exports[_0x2861('0x32')]=function(_0x412c3f,_0x5c7881){var _0x187e8b={},_0x4017cb={},_0x56517a={'count':0x0,'rows':[]};var _0x1eea47=_[_0x2861('0x33')](db[_0x2861('0x34')][_0x2861('0x35')],function(_0x3ab23e){return{'name':_0x3ab23e['fieldName'],'type':_0x3ab23e[_0x2861('0x36')][_0x2861('0x37')]};});_0x4017cb[_0x2861('0x38')]=_['map'](_0x1eea47,'name');_0x4017cb[_0x2861('0x39')]=_[_0x2861('0x3a')](_0x412c3f[_0x2861('0x39')]);_0x4017cb[_0x2861('0x3b')]=_[_0x2861('0x3c')](_0x4017cb[_0x2861('0x38')],_0x4017cb[_0x2861('0x39')]);_0x187e8b[_0x2861('0x3d')]=_[_0x2861('0x3c')](_0x4017cb[_0x2861('0x38')],qs[_0x2861('0x3e')](_0x412c3f[_0x2861('0x39')]['fields']));_0x187e8b[_0x2861('0x3d')]=_0x187e8b[_0x2861('0x3d')][_0x2861('0x3f')]?_0x187e8b[_0x2861('0x3d')]:_0x4017cb[_0x2861('0x38')];if(!_0x412c3f[_0x2861('0x39')][_0x2861('0x40')](_0x2861('0x41'))){_0x187e8b[_0x2861('0x22')]=qs[_0x2861('0x22')](_0x412c3f[_0x2861('0x39')][_0x2861('0x22')]);_0x187e8b[_0x2861('0x20')]=qs[_0x2861('0x20')](_0x412c3f['query'][_0x2861('0x20')]);}_0x187e8b[_0x2861('0x42')]=qs['sort'](_0x412c3f[_0x2861('0x39')][_0x2861('0x43')]);_0x187e8b['where']=qs[_0x2861('0x3b')](_[_0x2861('0x44')](_0x412c3f[_0x2861('0x39')],_0x4017cb['filters']),_0x1eea47);if(_0x412c3f[_0x2861('0x39')][_0x2861('0x45')]){_0x187e8b['where']=_[_0x2861('0x46')](_0x187e8b[_0x2861('0x47')],{'$or':_[_0x2861('0x33')](_0x1eea47,function(_0x39ce67){if(_0x39ce67[_0x2861('0x36')]!==_0x2861('0x48')){var _0x1c861b={};_0x1c861b[_0x39ce67[_0x2861('0x30')]]={'$like':'%'+_0x412c3f[_0x2861('0x39')][_0x2861('0x45')]+'%'};return _0x1c861b;}})});}_0x187e8b=_[_0x2861('0x46')]({},_0x187e8b,_0x412c3f[_0x2861('0x49')]);var _0x2af1d3={'where':_0x187e8b[_0x2861('0x47')]};return db['Plugin']['count'](_0x2af1d3)[_0x2861('0x2a')](function(_0x3781ab){_0x56517a[_0x2861('0x23')]=_0x3781ab;if(_0x412c3f[_0x2861('0x39')]['includeAll']){_0x187e8b[_0x2861('0x4a')]=[{'all':!![]}];}return db['Plugin']['findAll'](_0x187e8b);})['then'](function(_0x54d835){_0x56517a[_0x2861('0x4b')]=_0x54d835;return _0x56517a;})[_0x2861('0x2a')](respondWithFilteredResult(_0x5c7881,_0x187e8b))[_0x2861('0x4c')](handleError(_0x5c7881,null));};exports[_0x2861('0x4d')]=function(_0x4312a1,_0x5d98e6){var _0x541315={'raw':!![],'where':{'id':_0x4312a1[_0x2861('0x4e')]['id']}},_0x3d7a33={};_0x3d7a33[_0x2861('0x38')]=_[_0x2861('0x3a')](db[_0x2861('0x34')]['rawAttributes']);_0x3d7a33['query']=_[_0x2861('0x3a')](_0x4312a1[_0x2861('0x39')]);_0x3d7a33[_0x2861('0x3b')]=_[_0x2861('0x3c')](_0x3d7a33[_0x2861('0x38')],_0x3d7a33['query']);_0x541315['attributes']=_[_0x2861('0x3c')](_0x3d7a33[_0x2861('0x38')],qs['fields'](_0x4312a1[_0x2861('0x39')][_0x2861('0x3e')]));_0x541315['attributes']=_0x541315[_0x2861('0x3d')][_0x2861('0x3f')]?_0x541315[_0x2861('0x3d')]:_0x3d7a33['model'];if(_0x4312a1[_0x2861('0x39')]['includeAll']){_0x541315['include']=[{'all':!![]}];}_0x541315=_[_0x2861('0x46')]({},_0x541315,_0x4312a1[_0x2861('0x49')]);return db[_0x2861('0x34')][_0x2861('0x4f')](_0x541315)[_0x2861('0x2a')](handleEntityNotFound(_0x5d98e6,null))[_0x2861('0x2a')](respondWithResult(_0x5d98e6,null))[_0x2861('0x4c')](handleError(_0x5d98e6,null));};exports[_0x2861('0x50')]=function(_0x1a97e3,_0x4a27c9,_0x5ea6fb){return db[_0x2861('0x34')][_0x2861('0x4f')]({'where':{'id':_0x1a97e3[_0x2861('0x4e')]['id']},'attributes':['name','path'],'raw':!![]})[_0x2861('0x2a')](handleEntityNotFound(_0x4a27c9,null))[_0x2861('0x2a')](function(_0x4e7d33){if(_0x4e7d33){var _0x39103a=path[_0x2861('0x51')](config['root'],_0x2861('0x52'),util[_0x2861('0x53')](_0x2861('0x54'),path[_0x2861('0x55')](_0x4e7d33[_0x2861('0x8')])));var _0x13a2e0=fs['createWriteStream'](_0x39103a);var _0x5cbf22=archiver(_0x2861('0x56'),{'zlib':{'level':0x9}});_0x5cbf22['on']('warning',function(_0xc463f5){if(_0xc463f5[_0x2861('0x57')]===_0x2861('0x58')){logger[_0x2861('0x59')](_0xc463f5);}else{throw new db['Sequelize']['Error'](_0x2861('0x5a'));}});_0x5cbf22['on']('error',function(_0x403af1){throw new db[(_0x2861('0x5b'))][(_0x2861('0x5c'))](_0x2861('0x5a'));});_0x5cbf22['pipe'](_0x13a2e0);_0x5cbf22[_0x2861('0x5d')]('**/*',{'cwd':path[_0x2861('0x51')](config[_0x2861('0x5e')],'server/files/plugins',path[_0x2861('0x5f')](_0x4e7d33['path'])),'ignore':[path['join'](path[_0x2861('0x55')](_0x4e7d33['path']),_0x2861('0x60')),path[_0x2861('0x51')](path[_0x2861('0x55')](_0x4e7d33['path']),_0x2861('0x61'))],'nodir':!![]})[_0x2861('0x62')]();_0x13a2e0['on']('close',function(){if(!fs[_0x2861('0x63')](_0x39103a)){throw new db['Sequelize'][(_0x2861('0x5c'))](_0x2861('0x64'));}return _0x4a27c9['download'](_0x39103a,util[_0x2861('0x53')](_0x2861('0x54'),path[_0x2861('0x55')](_0x4e7d33[_0x2861('0x8')])),function(_0x209c58){if(_0x209c58){throw new db[(_0x2861('0x5b'))][(_0x2861('0x5c'))]('Error\x20while\x20downloading\x20the\x20plugin');}fs['unlinkSync'](_0x39103a);logger[_0x2861('0x65')](_0x2861('0x66'));logger[_0x2861('0x65')](_0x2861('0x67'));});});}return null;})[_0x2861('0x4c')](handleError(_0x4a27c9,null));};exports[_0x2861('0x68')]=function(_0x48fb8d,_0x166fef,_0x3d8d1f){var _0x3f86aa=path[_0x2861('0x55')](_0x48fb8d[_0x2861('0x69')][_0x2861('0x6a')],path[_0x2861('0x6b')](_0x48fb8d[_0x2861('0x69')][_0x2861('0x6a')]));var _0x346014=path[_0x2861('0x51')](config[_0x2861('0x5e')],_0x2861('0x52'),_0x48fb8d['file'][_0x2861('0x6a')]);var _0x3db960=path[_0x2861('0x51')](config[_0x2861('0x5e')],_0x2861('0x52'),_0x3f86aa);logger[_0x2861('0x65')]('Plugin\x20upload\x20filepath:\x20%s',_0x346014);logger[_0x2861('0x65')](_0x2861('0x6c'),_0x3db960);try{fs['chmodSync'](_0x346014,parseInt(_0x2861('0x6d'),0x8));extract(_0x346014,{'dir':_0x3db960},function(_0x5e5878){if(_0x5e5878){logger[_0x2861('0x59')](_0x5e5878);handleError(_0x5e5878,!![]);};var _0x42e2d2=fs[_0x2861('0x6e')](_0x3db960);if(_0x42e2d2[_0x2861('0x3f')]>0x1){removeReferences(_0x346014,_0x3db960);logger[_0x2861('0x59')]('Invalid\x20plugin\x20structure');return _0x3d8d1f(new Error('Invalid\x20plugin\x20structure'));}var _0x83b2d=fs[_0x2861('0x6f')](path[_0x2861('0x51')](_0x3db960,_0x42e2d2[0x0]));if(_0x83b2d[_0x2861('0x70')]()){removeReferences(_0x346014,_0x3db960);logger[_0x2861('0x59')](_0x2861('0x71'));return _0x3d8d1f(new Error(_0x2861('0x71')));}if(_0x83b2d[_0x2861('0x72')]()){var _0x3d74a8=fs[_0x2861('0x6e')](path['join'](_0x3db960,_0x42e2d2[0x0]));if(_0x3d74a8['length']===0x0){removeReferences(_0x346014,_0x3db960);logger[_0x2861('0x59')]('Invalid\x20plugin\x20structure');return _0x3d8d1f(new Error('Invalid\x20plugin\x20structure'));}var _0x2d2836=_0x3d74a8[_0x2861('0x73')](function(_0x2e900c){return _0x2e900c==='manifest.json';});if(!_0x2d2836){return _0x3d8d1f(new Error(_0x2861('0x74')));}var _0x43cbc6=fs['readFileSync'](path[_0x2861('0x51')](_0x3db960,_0x42e2d2[0x0],_0x2861('0x75')));var _0x44c70f=JSON[_0x2861('0x76')](_0x43cbc6);if(_0x2861('0x21')==typeof _0x44c70f[_0x2861('0x30')]){return _0x3d8d1f(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0x2861('0x21')==typeof _0x44c70f[_0x2861('0x36')]){return _0x3d8d1f(new Error(_0x2861('0x77')));}if(_0x2861('0x21')==typeof _0x44c70f[_0x2861('0x78')]){return _0x3d8d1f(new Error(_0x2861('0x79')));}if(_0x2861('0x21')==typeof _0x44c70f[_0x2861('0x7a')]){return _0x3d8d1f(new Error(_0x2861('0x7b')));}if(_0x44c70f[_0x2861('0x36')]===_0x2861('0x7c')){if(_0x2861('0x21')==typeof _0x44c70f['parameters'][_0x2861('0x7d')]){return _0x3d8d1f(new Error(_0x2861('0x7e')));}if(_0x2861('0x21')==typeof _0x44c70f['parameters'][_0x2861('0x7d')][_0x2861('0x7f')]&&_0x2861('0x21')==typeof _0x44c70f[_0x2861('0x7a')][_0x2861('0x7d')]['agent']){return _0x3d8d1f(new Error(_0x2861('0x80')));}}else if(_0x44c70f[_0x2861('0x36')]===_0x2861('0x81')){if(_0x2861('0x21')==typeof _0x44c70f['parameters'][_0x2861('0x82')]){return _0x3d8d1f(new Error(_0x2861('0x83')));}if('undefined'==typeof _0x44c70f[_0x2861('0x7a')][_0x2861('0x84')]){return _0x3d8d1f(new Error(_0x2861('0x85')));}}else{return _0x3d8d1f(new Error(_0x2861('0x86')));}var _0x37b7ea=_0x44c70f['name'];var _0x26c1c8=_0x44c70f['description'];var _0x4222cb=_0x44c70f['type'];var _0x534c44=_0x44c70f['sidebar']?_0x44c70f['sidebar']:'always';var _0x4a9dae=_0x44c70f[_0x2861('0x87')]?_0x44c70f[_0x2861('0x87')]:_0x2861('0x88');var _0x3d813a='';var _0x334d12='';var _0x4326cd='';var _0x319bf8='';var _0x51e180=_0x44c70f[_0x2861('0x78')];if(_0x4222cb===_0x2861('0x7c')){if('undefined'!=typeof _0x44c70f['parameters']['views'][_0x2861('0x7f')]){var _0x946b59=_0x44c70f[_0x2861('0x7a')][_0x2861('0x7d')][_0x2861('0x7f')];if(!/^(f|ht)tps?:\/\//i[_0x2861('0x89')](_0x946b59)){_0x3d813a=path[_0x2861('0x51')](_0x2861('0x8a'),_0x3f86aa,_0x42e2d2[0x0],_0x946b59);}else{_0x3d813a=_0x946b59;}}else{logger['info'](_0x2861('0x8b'));}if(_0x2861('0x21')!=typeof _0x44c70f[_0x2861('0x7a')][_0x2861('0x7d')][_0x2861('0x8c')]){var _0x3b920c=_0x44c70f[_0x2861('0x7a')][_0x2861('0x7d')][_0x2861('0x8c')];if(!/^(f|ht)tps?:\/\//i[_0x2861('0x89')](_0x3b920c)){_0x334d12=path[_0x2861('0x51')](_0x2861('0x8a'),_0x3f86aa,_0x42e2d2[0x0],_0x3b920c);}else{_0x334d12=_0x3b920c;}}else{logger['info'](_0x2861('0x8d'));}}else if(_0x4222cb==='script'){_0x4326cd=_0x44c70f[_0x2861('0x7a')][_0x2861('0x82')];_0x319bf8=_0x44c70f[_0x2861('0x7a')][_0x2861('0x84')];if(_0x2861('0x21')!=typeof _0x44c70f[_0x2861('0x7a')][_0x2861('0x7d')]){if('undefined'!=typeof _0x44c70f['parameters'][_0x2861('0x7d')][_0x2861('0x7f')]){var _0x946b59=_0x44c70f[_0x2861('0x7a')][_0x2861('0x7d')]['admin'];if(!/^(f|ht)tps?:\/\//i['test'](_0x946b59)){_0x3d813a=path[_0x2861('0x51')](_0x2861('0x8a'),_0x3f86aa,_0x42e2d2[0x0],_0x946b59);}else{_0x3d813a=_0x946b59;}}if(_0x2861('0x21')!=typeof _0x44c70f['parameters'][_0x2861('0x7d')]['agent']){var _0x3b920c=_0x44c70f[_0x2861('0x7a')][_0x2861('0x7d')][_0x2861('0x8c')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3b920c)){_0x334d12=path['join'](_0x2861('0x8a'),_0x3f86aa,_0x42e2d2[0x0],_0x3b920c);}else{_0x334d12=_0x3b920c;}}}}var _0x242a85={'name':_0x37b7ea,'description':_0x26c1c8,'path':path[_0x2861('0x51')](_0x3f86aa,_0x42e2d2[0x0]),'type':_0x4222cb,'sidebar':_0x534c44,'icon':_0x4a9dae,'adminUrl':_0x3d813a,'agentUrl':_0x334d12,'scriptName':_0x4326cd,'scriptPath':_0x319bf8,'version':_0x51e180};removeReferences(_0x346014,null);return db[_0x2861('0x34')][_0x2861('0x8e')](_0x242a85)[_0x2861('0x2a')](function(_0x5788f8){var _0x239f3e={'role':_0x48fb8d['body'][_0x2861('0x8f')],'userProfileId':_0x48fb8d[_0x2861('0x90')][_0x2861('0x91')]};if(!_0x239f3e)throw new Error(_0x2861('0x92'));if(_0x239f3e[_0x2861('0x8f')]===_0x2861('0x93')){var _0x3d720f=_0x5788f8[_0x2861('0x2b')]({'plain':!![]});return db[_0x2861('0x94')][_0x2861('0x4f')]({'where':{'name':'Plugins','userProfileId':_0x239f3e['userProfileId']},'raw':!![]})[_0x2861('0x2a')](function(_0xdbf45a){if(_0xdbf45a&&_0xdbf45a['autoAssociation']===0x0){return db[_0x2861('0x2c')][_0x2861('0x8e')]({'name':_0x3d720f['name'],'resourceId':_0x3d720f['id'],'type':_0xdbf45a[_0x2861('0x30')],'sectionId':_0xdbf45a['id']},{})[_0x2861('0x2a')](function(){return _0x5788f8;});}else{return _0x5788f8;}})[_0x2861('0x4c')](function(_0x20da1d){logger[_0x2861('0x59')](_0x2861('0x95'),_0x20da1d);throw _0x20da1d;});}return _0x5788f8;})[_0x2861('0x2a')](respondWithResult(_0x166fef,null))[_0x2861('0x4c')](handleError(_0x166fef,null));}});}catch(_0x53af70){_0x166fef[_0x2861('0x24')](0x1f4)[_0x2861('0x31')](_0x53af70);}};function removeReferences(_0x1bcf29,_0x5938ce){try{if(_0x1bcf29){fs[_0x2861('0x96')](_0x1bcf29);logger[_0x2861('0x65')](_0x2861('0x97'));}if(_0x5938ce){rimraf(_0x5938ce,function(){});logger[_0x2861('0x65')]('Extracted\x20folder\x20removed');}}catch(_0x329b07){logger['error'](_0x329b07);}}exports[_0x2861('0x29')]=function(_0x2130cf,_0x480159,_0x37ac08){return db[_0x2861('0x34')][_0x2861('0x4f')]({'where':{'id':_0x2130cf[_0x2861('0x4e')]['id']}})['then'](handleEntityNotFound(_0x480159,null))[_0x2861('0x2a')](saveUpdates(_0x2130cf[_0x2861('0x90')],null))[_0x2861('0x2a')](respondWithResult(_0x480159,null))[_0x2861('0x4c')](handleError(_0x480159,null));};exports['delete']=function(_0x8cf8ce,_0x36c510,_0x3d3a7f){return db[_0x2861('0x34')][_0x2861('0x4f')]({'where':{'id':_0x8cf8ce['params']['id']}})['then'](function(_0x18c5b3){if(_0x18c5b3){return _0x18c5b3['destroy']();}})[_0x2861('0x2a')](function(_0x2c527e){rimraf(path[_0x2861('0x51')](config[_0x2861('0x5e')],_0x2861('0x52'),path['dirname'](_0x2c527e[_0x2861('0x8')])),function(){});return _0x2c527e;})[_0x2861('0x2a')](handleEntityNotFound(_0x36c510,null))[_0x2861('0x2a')](respondWithStatusCode(_0x36c510,null))[_0x2861('0x4c')](handleError(_0x36c510,null));};exports['webhookGet']=function(_0x2dd556,_0x1a7efb,_0x31a46c){return BPromise['resolve']()[_0x2861('0x2a')](function(){if(!_0x2dd556['query']['path']){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x2dd556[_0x2861('0x39')][_0x2861('0x98')]){throw new Error(_0x2861('0x99'));}var _0x902ae5=_0x2dd556[_0x2861('0x39')][_0x2861('0x9a')]?_0x2dd556[_0x2861('0x39')][_0x2861('0x9a')]+':'+_0x2dd556[_0x2861('0x39')][_0x2861('0x98')]:_0x2861('0x9b')+_0x2dd556[_0x2861('0x39')][_0x2861('0x98')];var _0x1a2dd3=_0x2dd556[_0x2861('0x39')]['json']?_0x2dd556[_0x2861('0x39')]['json']:!![];var _0x26c03c=_0x2dd556[_0x2861('0x39')][_0x2861('0x9c')]?_0x2dd556['query'][_0x2861('0x9c')]:null;var _0x382495={'method':_0x2dd556[_0x2861('0x9d')],'uri':util['format'](_0x2861('0x9e'),_0x902ae5,_0x2dd556[_0x2861('0x39')][_0x2861('0x8')]),'json':_0x1a2dd3,'resolveWithFullResponse':!![],'encoding':_0x26c03c,'qs':_0x2dd556['query']};if(_0x2dd556[_0x2861('0x9f')]){_0x382495[_0x2861('0x9f')]=_0x2dd556[_0x2861('0x9f')];if(_0x382495[_0x2861('0x9f')][_0x2861('0xa0')]){delete _0x382495['headers'][_0x2861('0xa0')];}}if(_0x382495[_0x2861('0x9f')][_0x2861('0xa1')]){delete _0x382495['headers'][_0x2861('0xa1')];}return rp(_0x382495);})[_0x2861('0x2a')](function(_0x55c250){if(_0x55c250){_0x1a7efb['set'](_0x55c250['headers']);logger[_0x2861('0x65')](_0x55c250['body']);if(_['endsWith'](_0x2dd556[_0x2861('0x39')]['path'],_0x2861('0x50'))&&_0x55c250[_0x2861('0xa2')]==0x1f4){return _0x1a7efb[_0x2861('0x1e')](_0x55c250['statusCode']);}else{return _0x1a7efb[_0x2861('0x24')](_0x55c250['statusCode'])[_0x2861('0x31')](_0x55c250[_0x2861('0x90')]);}}else{return _0x1a7efb['sendStatus'](0xc8);}})['catch'](handleError(_0x1a7efb,null));};exports[_0x2861('0xa3')]=function(_0x2f89ea,_0x31cecb,_0x551fbb){return BPromise[_0x2861('0xa4')]()[_0x2861('0x2a')](function(){if(!_0x2f89ea[_0x2861('0x39')][_0x2861('0x8')]){throw new Error(_0x2861('0xa5'));}if(!_0x2f89ea[_0x2861('0x39')][_0x2861('0x98')]){throw new Error(_0x2861('0x99'));}var _0x3f1f7c=_0x2f89ea[_0x2861('0x39')][_0x2861('0x9a')]?_0x2f89ea['query']['hostname']+':'+_0x2f89ea['query'][_0x2861('0x98')]:_0x2861('0x9b')+_0x2f89ea[_0x2861('0x39')][_0x2861('0x98')];var _0x39f80f=_0x2f89ea[_0x2861('0x39')][_0x2861('0x1f')]?_0x2f89ea['query'][_0x2861('0x1f')]:!![];var _0x5befd7=_0x2f89ea[_0x2861('0x39')][_0x2861('0x9c')]?_0x2f89ea[_0x2861('0x39')][_0x2861('0x9c')]:null;var _0x271923={'method':_0x2f89ea[_0x2861('0x9d')],'uri':util[_0x2861('0x53')](_0x2861('0x9e'),_0x3f1f7c,_0x2f89ea[_0x2861('0x39')][_0x2861('0x8')]),'json':_0x39f80f,'resolveWithFullResponse':!![],'encoding':_0x5befd7,'body':_0x2f89ea[_0x2861('0x90')]};if(_0x2f89ea[_0x2861('0x9f')]){_0x271923['headers']=_0x2f89ea[_0x2861('0x9f')];if(_0x271923['headers'][_0x2861('0xa0')]){delete _0x271923[_0x2861('0x9f')][_0x2861('0xa0')];}}if(_0x271923[_0x2861('0x9f')][_0x2861('0xa1')]){delete _0x271923[_0x2861('0x9f')][_0x2861('0xa1')];}return rp(_0x271923);})[_0x2861('0x2a')](function(_0x3a82d1){if(_0x3a82d1){_0x31cecb[_0x2861('0x25')](_0x3a82d1[_0x2861('0x9f')]);logger['info'](_0x3a82d1[_0x2861('0x90')]);return _0x31cecb[_0x2861('0x24')](_0x3a82d1['statusCode'])[_0x2861('0x31')](_0x3a82d1['body']);}else{return _0x31cecb[_0x2861('0x1e')](0xc8);}})[_0x2861('0x4c')](handleError(_0x31cecb,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 3bb0313..f16b1cf 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 _0x7c1a=['update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','Plugin','setMaxListeners','save'];(function(_0x5ac284,_0x5f1f99){var _0x28f516=function(_0x1e0e97){while(--_0x1e0e97){_0x5ac284['push'](_0x5ac284['shift']());}};_0x28f516(++_0x5f1f99);}(_0x7c1a,0x159));var _0xa7c1=function(_0x1d6024,_0x197dff){_0x1d6024=_0x1d6024-0x0;var _0x2c5310=_0x7c1a[_0x1d6024];return _0x2c5310;};'use strict';var EventEmitter=require(_0xa7c1('0x0'));var Plugin=require(_0xa7c1('0x1'))['db'][_0xa7c1('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xa7c1('0x3')](0x0);var events={'afterCreate':_0xa7c1('0x4'),'afterUpdate':_0xa7c1('0x5'),'afterDestroy':'remove'};function emitEvent(_0xd434f){return function(_0x132b08,_0x506858,_0x135ae7){PluginEvents['emit'](_0xd434f+':'+_0x132b08['id'],_0x132b08);PluginEvents[_0xa7c1('0x6')](_0xd434f,_0x132b08);_0x135ae7(null);};}for(var e in events){if(events[_0xa7c1('0x7')](e)){var event=events[e];Plugin[_0xa7c1('0x8')](e,emitEvent(event));}}module[_0xa7c1('0x9')]=PluginEvents; \ No newline at end of file +var _0xd991=['Plugin','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x3346a3,_0x15f076){var _0x2c2b01=function(_0x2240d9){while(--_0x2240d9){_0x3346a3['push'](_0x3346a3['shift']());}};_0x2c2b01(++_0x15f076);}(_0xd991,0x115));var _0x1d99=function(_0x5986f0,_0x183e68){_0x5986f0=_0x5986f0-0x0;var _0xbd271d=_0xd991[_0x5986f0];return _0xbd271d;};'use strict';var EventEmitter=require(_0x1d99('0x0'));var Plugin=require(_0x1d99('0x1'))['db'][_0x1d99('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0x1d99('0x3')](0x0);var events={'afterCreate':_0x1d99('0x4'),'afterUpdate':'update','afterDestroy':_0x1d99('0x5')};function emitEvent(_0xe9aefb){return function(_0xf03459,_0x1f6da3,_0x300c32){PluginEvents[_0x1d99('0x6')](_0xe9aefb+':'+_0xf03459['id'],_0xf03459);PluginEvents['emit'](_0xe9aefb,_0xf03459);_0x300c32(null);};}for(var e in events){if(events[_0x1d99('0x7')](e)){var event=events[e];Plugin[_0x1d99('0x8')](e,emitEvent(event));}}module['exports']=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4a64a7b..0fcf5e3 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 _0x4ba1=['define','util','api','request-promise','path','rimraf','./plugin.attributes','exports'];(function(_0x2cb766,_0x1096f1){var _0x3edc14=function(_0x309e2f){while(--_0x309e2f){_0x2cb766['push'](_0x2cb766['shift']());}};_0x3edc14(++_0x1096f1);}(_0x4ba1,0x79));var _0x14ba=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x4ba1[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var util=require(_0x14ba('0x0'));var logger=require('../../config/logger')(_0x14ba('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x14ba('0x2'));var fs=require('fs');var path=require(_0x14ba('0x3'));var rimraf=require(_0x14ba('0x4'));var config=require('../../config/environment');var attributes=require(_0x14ba('0x5'));module[_0x14ba('0x6')]=function(_0x1ef1f1,_0x467bb3){return _0x1ef1f1[_0x14ba('0x7')]('Plugin',attributes,{'tableName':'plugins','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfafb=['request-promise','path','rimraf','../../config/environment','./plugin.attributes','exports','define','plugins','lodash','../../config/logger','api','moment','bluebird'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0xfafb,0xf2));var _0xbfaf=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xfafb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbfaf('0x0'));var util=require('util');var logger=require(_0xbfaf('0x1'))(_0xbfaf('0x2'));var moment=require(_0xbfaf('0x3'));var BPromise=require(_0xbfaf('0x4'));var rp=require(_0xbfaf('0x5'));var fs=require('fs');var path=require(_0xbfaf('0x6'));var rimraf=require(_0xbfaf('0x7'));var config=require(_0xbfaf('0x8'));var attributes=require(_0xbfaf('0x9'));module[_0xbfaf('0xa')]=function(_0x2a1938,_0x48b48c){return _0x2a1938[_0xbfaf('0xb')]('Plugin',attributes,{'tableName':_0xbfaf('0xc'),'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 0b7c26d..052f47d 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 _0x8dca=['stringify','code','error','message','result','CreatePlugin','Plugin','create','body','options','raw','debug','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','Plugin,\x20%s,\x20%s','request\x20sent'];(function(_0x4f8f3b,_0x43281b){var _0x4c250c=function(_0x19a7ff){while(--_0x19a7ff){_0x4f8f3b['push'](_0x4f8f3b['shift']());}};_0x4c250c(++_0x43281b);}(_0x8dca,0xb1));var _0xa8dc=function(_0xd7d47e,_0xdcee49){_0xd7d47e=_0xd7d47e-0x0;var _0x4fc941=_0x8dca[_0xd7d47e];return _0x4fc941;};'use strict';var _=require(_0xa8dc('0x0'));var util=require(_0xa8dc('0x1'));var moment=require('moment');var BPromise=require(_0xa8dc('0x2'));var rs=require(_0xa8dc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa8dc('0x4'))['db'];var utils=require(_0xa8dc('0x5'));var logger=require(_0xa8dc('0x6'))(_0xa8dc('0x7'));var config=require(_0xa8dc('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xa8dc('0x9')][_0xa8dc('0xa')]({'port':0x232a});config[_0xa8dc('0xb')]=_[_0xa8dc('0xc')](config[_0xa8dc('0xb')],{'host':_0xa8dc('0xd'),'port':0x18eb});var socket=require(_0xa8dc('0xe'))(new Redis(config[_0xa8dc('0xb')]));require('./plugin.socket')[_0xa8dc('0xf')](socket);function respondWithRpcPromise(_0x4e8f06,_0x246fff,_0x4cce9a){return new BPromise(function(_0x42cbfb,_0x26e3ff){return client[_0xa8dc('0x10')](_0x4e8f06,_0x4cce9a)[_0xa8dc('0x11')](function(_0x588e1f){logger[_0xa8dc('0x12')](_0xa8dc('0x13'),_0x246fff,_0xa8dc('0x14'));logger['debug']('Plugin,\x20%s,\x20%s,\x20%s',_0x246fff,_0xa8dc('0x14'),JSON[_0xa8dc('0x15')](_0x588e1f));if(_0x588e1f['error']){if(_0x588e1f['error'][_0xa8dc('0x16')]===0x1f4){logger[_0xa8dc('0x17')](_0xa8dc('0x13'),_0x246fff,_0x588e1f['error'][_0xa8dc('0x18')]);return _0x26e3ff(_0x588e1f[_0xa8dc('0x17')][_0xa8dc('0x18')]);}logger['error'](_0xa8dc('0x13'),_0x246fff,_0x588e1f[_0xa8dc('0x17')][_0xa8dc('0x18')]);return _0x42cbfb(_0x588e1f['error']['message']);}else{logger[_0xa8dc('0x12')]('Plugin,\x20%s,\x20%s',_0x246fff,'request\x20sent');_0x42cbfb(_0x588e1f[_0xa8dc('0x19')][_0xa8dc('0x18')]);}})['catch'](function(_0x1c9b03){logger[_0xa8dc('0x17')](_0xa8dc('0x13'),_0x246fff,_0x1c9b03);_0x26e3ff(_0x1c9b03);});});}exports[_0xa8dc('0x1a')]=function(_0x574252){var _0x4f669f=this;return new Promise(function(_0x53759a,_0x31c5e5){return db[_0xa8dc('0x1b')][_0xa8dc('0x1c')](_0x574252[_0xa8dc('0x1d')],{'raw':_0x574252[_0xa8dc('0x1e')]?_0x574252['options'][_0xa8dc('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x2a0df4){logger[_0xa8dc('0x12')](_0xa8dc('0x1a'),_0x574252);logger[_0xa8dc('0x20')]('CreatePlugin',_0x574252,JSON['stringify'](_0x2a0df4));_0x53759a(_0x2a0df4);})['catch'](function(_0x246132){logger[_0xa8dc('0x17')](_0xa8dc('0x1a'),_0x246132[_0xa8dc('0x18')],_0x574252);_0x31c5e5(_0x4f669f[_0xa8dc('0x17')](0x1f4,_0x246132[_0xa8dc('0x18')]));});});}; \ No newline at end of file +var _0x48b1=['./plugin.socket','then','info','Plugin,\x20%s,\x20%s','request\x20sent','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreatePlugin','Plugin','create','body','options','raw','debug','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter'];(function(_0x19aa84,_0x549537){var _0x536146=function(_0x5da480){while(--_0x5da480){_0x19aa84['push'](_0x19aa84['shift']());}};_0x536146(++_0x549537);}(_0x48b1,0x197));var _0x148b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x48b1[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x148b('0x0'));var rs=require(_0x148b('0x1'));var fs=require('fs');var Redis=require(_0x148b('0x2'));var db=require(_0x148b('0x3'))['db'];var utils=require(_0x148b('0x4'));var logger=require(_0x148b('0x5'))(_0x148b('0x6'));var config=require(_0x148b('0x7'));var jayson=require(_0x148b('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x148b('0x9')]=_[_0x148b('0xa')](config[_0x148b('0x9')],{'host':_0x148b('0xb'),'port':0x18eb});var socket=require(_0x148b('0xc'))(new Redis(config['redis']));require(_0x148b('0xd'))['register'](socket);function respondWithRpcPromise(_0x3f2644,_0x2efea4,_0x4ae708){return new BPromise(function(_0x1abfe4,_0x497783){return client['request'](_0x3f2644,_0x4ae708)[_0x148b('0xe')](function(_0x2e8197){logger[_0x148b('0xf')](_0x148b('0x10'),_0x2efea4,_0x148b('0x11'));logger['debug'](_0x148b('0x12'),_0x2efea4,_0x148b('0x11'),JSON[_0x148b('0x13')](_0x2e8197));if(_0x2e8197[_0x148b('0x14')]){if(_0x2e8197[_0x148b('0x14')]['code']===0x1f4){logger[_0x148b('0x14')](_0x148b('0x10'),_0x2efea4,_0x2e8197[_0x148b('0x14')][_0x148b('0x15')]);return _0x497783(_0x2e8197[_0x148b('0x14')][_0x148b('0x15')]);}logger[_0x148b('0x14')](_0x148b('0x10'),_0x2efea4,_0x2e8197[_0x148b('0x14')]['message']);return _0x1abfe4(_0x2e8197[_0x148b('0x14')][_0x148b('0x15')]);}else{logger['info'](_0x148b('0x10'),_0x2efea4,'request\x20sent');_0x1abfe4(_0x2e8197['result']['message']);}})[_0x148b('0x16')](function(_0x2caa90){logger['error'](_0x148b('0x10'),_0x2efea4,_0x2caa90);_0x497783(_0x2caa90);});});}exports[_0x148b('0x17')]=function(_0x4babe4){var _0x58a9ec=this;return new Promise(function(_0x46209a,_0x1781f0){return db[_0x148b('0x18')][_0x148b('0x19')](_0x4babe4[_0x148b('0x1a')],{'raw':_0x4babe4[_0x148b('0x1b')]?_0x4babe4[_0x148b('0x1b')][_0x148b('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x466dc0){logger['info'](_0x148b('0x17'),_0x4babe4);logger[_0x148b('0x1d')]('CreatePlugin',_0x4babe4,JSON[_0x148b('0x13')](_0x466dc0));_0x46209a(_0x466dc0);})[_0x148b('0x16')](function(_0x3253ef){logger[_0x148b('0x14')](_0x148b('0x17'),_0x3253ef[_0x148b('0x15')],_0x4babe4);_0x1781f0(_0x58a9ec['error'](0x1f4,_0x3253ef[_0x148b('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 2ff0dc0..c09b863 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 _0x2dce=['./plugin.events','save','remove','update','emit','removeListener','register','length','plugin:'];(function(_0x2b61b7,_0x11945f){var _0x5ac7b2=function(_0x2fe0cf){while(--_0x2fe0cf){_0x2b61b7['push'](_0x2b61b7['shift']());}};_0x5ac7b2(++_0x11945f);}(_0x2dce,0xe1));var _0xe2dc=function(_0x1ee76c,_0x4e4590){_0x1ee76c=_0x1ee76c-0x0;var _0x4a051e=_0x2dce[_0x1ee76c];return _0x4a051e;};'use strict';var PluginEvents=require(_0xe2dc('0x0'));var events=[_0xe2dc('0x1'),_0xe2dc('0x2'),_0xe2dc('0x3')];function createListener(_0x5cdc82,_0x7b653c){return function(_0x89c35){_0x7b653c[_0xe2dc('0x4')](_0x5cdc82,_0x89c35);};}function removeListener(_0x1afb67,_0x270a28){return function(){PluginEvents[_0xe2dc('0x5')](_0x1afb67,_0x270a28);};}exports[_0xe2dc('0x6')]=function(_0x25a23f){for(var _0x127b9a=0x0,_0x47a3d3=events[_0xe2dc('0x7')];_0x127b9a<_0x47a3d3;_0x127b9a++){var _0x337423=events[_0x127b9a];var _0x30d186=createListener(_0xe2dc('0x8')+_0x337423,_0x25a23f);PluginEvents['on'](_0x337423,_0x30d186);}}; \ No newline at end of file +var _0xf0d4=['removeListener','register','length','plugin:','save','remove','update','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf0d4,0xf4));var _0x4f0d=function(_0xfc53fc,_0x4204d6){_0xfc53fc=_0xfc53fc-0x0;var _0x423828=_0xf0d4[_0xfc53fc];return _0x423828;};'use strict';var PluginEvents=require('./plugin.events');var events=[_0x4f0d('0x0'),_0x4f0d('0x1'),_0x4f0d('0x2')];function createListener(_0x27718a,_0x35b355){return function(_0x2486e4){_0x35b355[_0x4f0d('0x3')](_0x27718a,_0x2486e4);};}function removeListener(_0x5789f7,_0x93b851){return function(){PluginEvents[_0x4f0d('0x4')](_0x5789f7,_0x93b851);};}exports[_0x4f0d('0x5')]=function(_0x502815){for(var _0x10cbcb=0x0,_0x4e56c6=events[_0x4f0d('0x6')];_0x10cbcb<_0x4e56c6;_0x10cbcb++){var _0x290648=events[_0x10cbcb];var _0x5a9605=createListener(_0x4f0d('0x7')+_0x290648,_0x502815);PluginEvents['on'](_0x290648,_0x5a9605);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 90f9bbc..6b35e31 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 _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x492c19,_0x323efe){var _0x498a29=function(_0x5a4aff){while(--_0x5a4aff){_0x492c19['push'](_0x492c19['shift']());}};_0x498a29(++_0x323efe);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x3a3a0b,_0x5d656b){var _0x417aec=function(_0x937a1d){while(--_0x937a1d){_0x3a3a0b['push'](_0x3a3a0b['shift']());}};_0x417aec(++_0x5d656b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xa9e0[_0x31e29a];return _0x32d892;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 15a6fec..ce37f9b 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 _0x2750=['exec','bluebird','sendStatus','status','json','error','name','send','npm\x20install','info','list','then','motion2','catch','body','script','../../files/plugins','cwd','dirname','chdir','dump','Missing\x20name\x20and/or\x20path','stop','hasOwnProperty','params','Unknown\x20status','destroy','lodash','../../config/logger','api','path','child_process'];(function(_0x1989fa,_0x837a68){var _0x2d937f=function(_0xabfbd7){while(--_0xabfbd7){_0x1989fa['push'](_0x1989fa['shift']());}};_0x2d937f(++_0x837a68);}(_0x2750,0x13b));var _0x0275=function(_0x370e1d,_0x2cd92b){_0x370e1d=_0x370e1d-0x0;var _0x413d7a=_0x2750[_0x370e1d];return _0x413d7a;};'use strict';var _=require(_0x0275('0x0'));var pm2=require('../../config/pm2');var logger=require(_0x0275('0x1'))(_0x0275('0x2'));var path=require(_0x0275('0x3'));var exec=require(_0x0275('0x4'))[_0x0275('0x5')];var BPromise=require(_0x0275('0x6'));function handleEntityNotFound(_0x20273d,_0x4960){return function(_0x3d0c9c){if(!_0x3d0c9c){_0x20273d[_0x0275('0x7')](0x194);;}return _0x3d0c9c;};}function respondWithResult(_0x5953f9,_0x3f645f){_0x3f645f=_0x3f645f||0xc8;return function(_0x2421fd){if(_0x2421fd){return _0x5953f9[_0x0275('0x8')](_0x3f645f)[_0x0275('0x9')](_0x2421fd);}return null;};}function handleError(_0x4dffd1,_0x1f7c4a){_0x1f7c4a=_0x1f7c4a||0x1f4;return function(_0x30632d){logger[_0x0275('0xa')](_0x30632d['stack']);if(_0x30632d['name']){delete _0x30632d[_0x0275('0xb')];}_0x4dffd1['status'](_0x1f7c4a)[_0x0275('0xc')](_0x30632d);};}function execChildProcess(){return new BPromise(function(_0x377087,_0x14f68c){exec(_0x0275('0xd'),function(_0x14bc3e,_0x5ae208,_0x2e8723){logger[_0x0275('0xe')](_0x5ae208);logger[_0x0275('0xe')](_0x2e8723);if(_0x14bc3e){logger['error'](_0x14bc3e);return _0x14f68c(_0x14bc3e);}return _0x377087(_0x5ae208);});});}exports['index']=function(_0x292f93,_0x395398){return pm2[_0x0275('0xf')]()[_0x0275('0x10')](function(_0x28827b){if(_0x28827b){var _0x36921c=_['reject'](_0x28827b,function(_0x3e0791){return _0x3e0791[_0x0275('0xb')]==='express'||_0x3e0791[_0x0275('0xb')]===_0x0275('0x11');});return{'rows':_0x36921c,'count':_0x36921c['length']};}return null;})[_0x0275('0x10')](respondWithResult(_0x395398,null))[_0x0275('0x12')](handleError(_0x395398,null));};exports['show']=function(_0x5e7466,_0x56e719){return pm2['describe'](_0x5e7466['params']['id'])[_0x0275('0x10')](respondWithResult(_0x56e719,null))[_0x0275('0x10')](handleEntityNotFound(_0x56e719,null))[_0x0275('0x12')](handleError(_0x56e719,null));};exports['create']=function(_0x7075c9,_0x30730a){if(_0x7075c9[_0x0275('0x13')]['name']&&_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]){var _0x575786=path['join'](__dirname,_0x0275('0x15'),_0x7075c9[_0x0275('0x13')][_0x0275('0x14')]);var _0x592a53=process[_0x0275('0x16')]();process['chdir'](path[_0x0275('0x17')](_0x575786));return execChildProcess()['then'](function(_0x26f2c2){process[_0x0275('0x18')](_0x592a53);return pm2['start']({'name':_0x7075c9[_0x0275('0x13')][_0x0275('0xb')],'script':_0x575786});})[_0x0275('0x10')](function(_0x52946b){pm2[_0x0275('0x19')]();return _0x52946b[0x0];})[_0x0275('0x10')](respondWithResult(_0x30730a,0xc9))[_0x0275('0x12')](handleError(_0x30730a,null));}else{return _0x30730a[_0x0275('0x8')](0x1f4)[_0x0275('0xc')]({'message':_0x0275('0x1a')});}};exports['update']=function(_0x35343c,_0x14d7d8){if(_0x35343c[_0x0275('0x13')]['id']){delete _0x35343c[_0x0275('0x13')]['id'];}var _0x4689a3={'online':'restart','stopped':_0x0275('0x1b')};if(_0x4689a3[_0x0275('0x1c')](_0x35343c[_0x0275('0x13')][_0x0275('0x8')])){return pm2[_0x4689a3[_0x35343c[_0x0275('0x13')]['status']]](_0x35343c[_0x0275('0x1d')]['id'])[_0x0275('0x10')](respondWithResult(_0x14d7d8,0xc8))[_0x0275('0x12')](handleError(_0x14d7d8,null));}else{return _0x14d7d8['status'](0x1f4)['send']({'message':_0x0275('0x1e')});}};exports[_0x0275('0x1f')]=function(_0x5dc2bc,_0x7eff96){if(_0x5dc2bc[_0x0275('0x13')]['id']){delete _0x5dc2bc[_0x0275('0x13')]['id'];}if(_0x5dc2bc[_0x0275('0x1d')]['id']){return pm2['delete'](_0x5dc2bc[_0x0275('0x1d')]['id'])[_0x0275('0x10')](function(_0x3bba47){pm2[_0x0275('0x19')]();return _0x3bba47[0x0];})['then'](respondWithResult(_0x7eff96,null))[_0x0275('0x12')](handleError(_0x7eff96,null));}else{return _0x7eff96['status'](0x1f4)[_0x0275('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file +var _0x2dae=['stack','name','send','npm\x20install','info','index','list','then','reject','express','motion2','catch','show','describe','params','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','update','restart','stop','Unknown\x20status','destroy','delete','Unknown\x20id','lodash','../../config/logger','api','path','child_process','exec','sendStatus','status','json','error'];(function(_0x71a70,_0x4e1cdd){var _0x3a2b22=function(_0x17d53f){while(--_0x17d53f){_0x71a70['push'](_0x71a70['shift']());}};_0x3a2b22(++_0x4e1cdd);}(_0x2dae,0xc3));var _0xe2da=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x2dae[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0xe2da('0x0'));var pm2=require('../../config/pm2');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var path=require(_0xe2da('0x3'));var exec=require(_0xe2da('0x4'))[_0xe2da('0x5')];var BPromise=require('bluebird');function handleEntityNotFound(_0x25b9f2,_0x439b5d){return function(_0x77e45e){if(!_0x77e45e){_0x25b9f2[_0xe2da('0x6')](0x194);;}return _0x77e45e;};}function respondWithResult(_0x523c60,_0x3e3e25){_0x3e3e25=_0x3e3e25||0xc8;return function(_0x89c70b){if(_0x89c70b){return _0x523c60[_0xe2da('0x7')](_0x3e3e25)[_0xe2da('0x8')](_0x89c70b);}return null;};}function handleError(_0x238da3,_0x1c71ea){_0x1c71ea=_0x1c71ea||0x1f4;return function(_0x29960a){logger[_0xe2da('0x9')](_0x29960a[_0xe2da('0xa')]);if(_0x29960a['name']){delete _0x29960a[_0xe2da('0xb')];}_0x238da3[_0xe2da('0x7')](_0x1c71ea)[_0xe2da('0xc')](_0x29960a);};}function execChildProcess(){return new BPromise(function(_0x17086c,_0x3c1309){exec(_0xe2da('0xd'),function(_0x1a29b9,_0x173244,_0x5aab71){logger[_0xe2da('0xe')](_0x173244);logger['info'](_0x5aab71);if(_0x1a29b9){logger[_0xe2da('0x9')](_0x1a29b9);return _0x3c1309(_0x1a29b9);}return _0x17086c(_0x173244);});});}exports[_0xe2da('0xf')]=function(_0x37064e,_0x411b9f){return pm2[_0xe2da('0x10')]()[_0xe2da('0x11')](function(_0x295a86){if(_0x295a86){var _0x48584b=_[_0xe2da('0x12')](_0x295a86,function(_0x5e1702){return _0x5e1702['name']===_0xe2da('0x13')||_0x5e1702[_0xe2da('0xb')]===_0xe2da('0x14');});return{'rows':_0x48584b,'count':_0x48584b['length']};}return null;})[_0xe2da('0x11')](respondWithResult(_0x411b9f,null))[_0xe2da('0x15')](handleError(_0x411b9f,null));};exports[_0xe2da('0x16')]=function(_0x33568f,_0x4e1623){return pm2[_0xe2da('0x17')](_0x33568f[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x4e1623,null))[_0xe2da('0x11')](handleEntityNotFound(_0x4e1623,null))[_0xe2da('0x15')](handleError(_0x4e1623,null));};exports['create']=function(_0x56eeb1,_0x2e16b2){if(_0x56eeb1['body'][_0xe2da('0xb')]&&_0x56eeb1[_0xe2da('0x19')][_0xe2da('0x1a')]){var _0x203d36=path[_0xe2da('0x1b')](__dirname,_0xe2da('0x1c'),_0x56eeb1['body'][_0xe2da('0x1a')]);var _0x53cc4e=process[_0xe2da('0x1d')]();process[_0xe2da('0x1e')](path[_0xe2da('0x1f')](_0x203d36));return execChildProcess()[_0xe2da('0x11')](function(_0x30dea4){process[_0xe2da('0x1e')](_0x53cc4e);return pm2[_0xe2da('0x20')]({'name':_0x56eeb1[_0xe2da('0x19')]['name'],'script':_0x203d36});})[_0xe2da('0x11')](function(_0x357bff){pm2[_0xe2da('0x21')]();return _0x357bff[0x0];})[_0xe2da('0x11')](respondWithResult(_0x2e16b2,0xc9))[_0xe2da('0x15')](handleError(_0x2e16b2,null));}else{return _0x2e16b2[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':'Missing\x20name\x20and/or\x20path'});}};exports[_0xe2da('0x22')]=function(_0x3e23d7,_0x1dc228){if(_0x3e23d7[_0xe2da('0x19')]['id']){delete _0x3e23d7[_0xe2da('0x19')]['id'];}var _0x2b6c9e={'online':_0xe2da('0x23'),'stopped':_0xe2da('0x24')};if(_0x2b6c9e['hasOwnProperty'](_0x3e23d7['body']['status'])){return pm2[_0x2b6c9e[_0x3e23d7[_0xe2da('0x19')][_0xe2da('0x7')]]](_0x3e23d7[_0xe2da('0x18')]['id'])[_0xe2da('0x11')](respondWithResult(_0x1dc228,0xc8))['catch'](handleError(_0x1dc228,null));}else{return _0x1dc228['status'](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x25')});}};exports[_0xe2da('0x26')]=function(_0x39f983,_0x7ab5ee){if(_0x39f983[_0xe2da('0x19')]['id']){delete _0x39f983[_0xe2da('0x19')]['id'];}if(_0x39f983[_0xe2da('0x18')]['id']){return pm2[_0xe2da('0x27')](_0x39f983['params']['id'])['then'](function(_0x672767){pm2[_0xe2da('0x21')]();return _0x672767[0x0];})[_0xe2da('0x11')](respondWithResult(_0x7ab5ee,null))[_0xe2da('0x15')](handleError(_0x7ab5ee,null));}else{return _0x7ab5ee[_0xe2da('0x7')](0x1f4)[_0xe2da('0xc')]({'message':_0xe2da('0x28')});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index 482c459..52aeed4 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0b63=['/queues','isAuthenticated','exports','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./realtime.controller','get'];(function(_0x33a2d2,_0x2661f2){var _0x3f9d79=function(_0x1cce70){while(--_0x1cce70){_0x33a2d2['push'](_0x33a2d2['shift']());}};_0x3f9d79(++_0x2661f2);}(_0x0b63,0xe7));var _0x30b6=function(_0x41515f,_0x3870af){_0x41515f=_0x41515f-0x0;var _0x2f9c51=_0x0b63[_0x41515f];return _0x2f9c51;};'use strict';var multer=require(_0x30b6('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x30b6('0x1'));var express=require(_0x30b6('0x2'));var router=express[_0x30b6('0x3')]();var fs_extra=require(_0x30b6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x30b6('0x5'));var config=require(_0x30b6('0x6'));var controller=require(_0x30b6('0x7'));router[_0x30b6('0x8')](_0x30b6('0x9'),auth[_0x30b6('0xa')](),controller['getQueues']);module[_0x30b6('0xb')]=router; \ No newline at end of file +var _0xf363=['./realtime.controller','get','/queues','isAuthenticated','getQueues','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x143565,_0x54d887){var _0x4dc1d9=function(_0x5e8838){while(--_0x5e8838){_0x143565['push'](_0x143565['shift']());}};_0x4dc1d9(++_0x54d887);}(_0xf363,0x9c));var _0x3f36=function(_0x300da1,_0x150c7e){_0x300da1=_0x300da1-0x0;var _0x2d07db=_0xf363[_0x300da1];return _0x2d07db;};'use strict';var multer=require(_0x3f36('0x0'));var util=require(_0x3f36('0x1'));var path=require(_0x3f36('0x2'));var timeout=require(_0x3f36('0x3'));var express=require(_0x3f36('0x4'));var router=express[_0x3f36('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x3f36('0x6'));var interaction=require(_0x3f36('0x7'));var config=require(_0x3f36('0x8'));var controller=require(_0x3f36('0x9'));router[_0x3f36('0xa')](_0x3f36('0xb'),auth[_0x3f36('0xc')](),controller[_0x3f36('0xd')]);module[_0x3f36('0xe')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index 1d4cf32..c4f7d67 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3864=['count','offset','Content-Range','json','apply','reject','update','then','destroy','stack','name','getQueues','mail','chat','sms','openchannel','whatsapp','voice','resolve','query','channel','includes','Invalid\x20channel','map','fieldName','type','key','getOptions','user','userProfileId','outbound','QueueCampaigns','startCase','Queues','filter','UserProfile','getResources','findAndCountAll','format','talking','push','pTalking','originated','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','rows','get','paused','loggedInDb','loggedIn','available','agents','find','merge','pick','getAgents','online','getMembers','User','Queue','QueueId','Pause','findAll','agent','length','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','Realtime,\x20%s,\x20%s','request\x20sent','debug','Realtime,\x20%s,\x20%s,\x20%s','code','error','message','info','result','catch','sendStatus','status','end','undefined','limit'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x3864,0xca));var _0x4386=function(_0x158339,_0x395fc1){_0x158339=_0x158339-0x0;var _0x45d62c=_0x3864[_0x158339];return _0x45d62c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4386('0x0'));var zipdir=require(_0x4386('0x1'));var jsonpatch=require(_0x4386('0x2'));var rp=require(_0x4386('0x3'));var moment=require(_0x4386('0x4'));var BPromise=require(_0x4386('0x5'));var Mustache=require(_0x4386('0x6'));var util=require(_0x4386('0x7'));var path=require('path');var sox=require(_0x4386('0x8'));var csv=require(_0x4386('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4386('0xa'));var squel=require('squel');var crypto=require(_0x4386('0xb'));var jsforce=require(_0x4386('0xc'));var deskjs=require(_0x4386('0xd'));var toCsv=require(_0x4386('0x9'));var querystring=require(_0x4386('0xe'));var Papa=require('papaparse');var Redis=require(_0x4386('0xf'));var authService=require(_0x4386('0x10'));var qs=require(_0x4386('0x11'));var as=require(_0x4386('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4386('0x13'))(_0x4386('0x14'));var utils=require(_0x4386('0x15'));var config=require(_0x4386('0x16'));var licenseUtil=require(_0x4386('0x17'));var db=require(_0x4386('0x18'))['db'];var jayson=require(_0x4386('0x19'));var client=jayson['client']['http']({'port':0x232a});var routingClient=jayson[_0x4386('0x1a')][_0x4386('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x121f64,_0x5140d0,_0x5783b9,_0x19b1de){return new BPromise(function(_0x1c7e8d,_0xb23aa2){var _0x524f80=_0x19b1de||client;return _0x524f80[_0x4386('0x1c')](_0x121f64,_0x5783b9)['then'](function(_0x517b42){logger['info'](_0x4386('0x1d'),_0x5140d0,_0x4386('0x1e'));logger[_0x4386('0x1f')](_0x4386('0x20'),_0x5140d0,_0x4386('0x1e'),JSON['stringify'](_0x517b42));if(_0x517b42['error']){if(_0x517b42['error'][_0x4386('0x21')]===0x1f4){logger[_0x4386('0x22')](_0x4386('0x1d'),_0x5140d0,_0x517b42[_0x4386('0x22')]['message']);return _0xb23aa2(_0x517b42[_0x4386('0x22')]['message']);}logger[_0x4386('0x22')]('Realtime,\x20%s,\x20%s',_0x5140d0,_0x517b42[_0x4386('0x22')][_0x4386('0x23')]);return _0x1c7e8d(_0x517b42[_0x4386('0x22')]['message']);}else{logger[_0x4386('0x24')](_0x4386('0x1d'),_0x5140d0,_0x4386('0x1e'));_0x1c7e8d(_0x517b42[_0x4386('0x25')][_0x4386('0x23')]);}})[_0x4386('0x26')](function(_0x1de2e2){logger[_0x4386('0x22')](_0x4386('0x1d'),_0x5140d0,_0x1de2e2);_0xb23aa2(_0x1de2e2);});});}function respondWithStatusCode(_0x3bf4cc,_0x576a15){_0x576a15=_0x576a15||0xcc;return function(_0x1c8924){if(_0x1c8924){return _0x3bf4cc[_0x4386('0x27')](_0x576a15);}return _0x3bf4cc[_0x4386('0x28')](_0x576a15)[_0x4386('0x29')]();};}function respondWithResult(_0x47a53b,_0x50fbf4){_0x50fbf4=_0x50fbf4||0xc8;return function(_0x424d64){if(_0x424d64){return _0x47a53b[_0x4386('0x28')](_0x50fbf4)['json'](_0x424d64);}};}function respondWithFilteredResult(_0x1c63d3,_0xe324c6){return function(_0x168140){if(_0x168140){var _0x46b666=typeof _0xe324c6['offset']===_0x4386('0x2a')&&typeof _0xe324c6[_0x4386('0x2b')]==='undefined';var _0x41242f=_0x168140[_0x4386('0x2c')];var _0x4328ea=_0x46b666?0x0:_0xe324c6[_0x4386('0x2d')];var _0x5970af=_0x46b666?_0x168140[_0x4386('0x2c')]:_0xe324c6[_0x4386('0x2d')]+_0xe324c6[_0x4386('0x2b')];var _0x10cd19;if(_0x5970af>=_0x41242f){_0x5970af=_0x41242f;_0x10cd19=0xc8;}else{_0x10cd19=0xce;}_0x1c63d3['status'](_0x10cd19);return _0x1c63d3['set'](_0x4386('0x2e'),_0x4328ea+'-'+_0x5970af+'/'+_0x41242f)[_0x4386('0x2f')](_0x168140);}return null;};}function patchUpdates(_0x4e72f9){return function(_0x4812a8){try{jsonpatch[_0x4386('0x30')](_0x4812a8,_0x4e72f9,!![]);}catch(_0x2170db){return BPromise[_0x4386('0x31')](_0x2170db);}return _0x4812a8['save']();};}function saveUpdates(_0x1115c2,_0x48f988){return function(_0x52bb77){if(_0x52bb77){return _0x52bb77[_0x4386('0x32')](_0x1115c2)[_0x4386('0x33')](function(_0x229ad6){return _0x229ad6;});}return null;};}function removeEntity(_0x40dfee,_0x2f2781){return function(_0x1c7a18){if(_0x1c7a18){return _0x1c7a18[_0x4386('0x34')]()['then'](function(){_0x40dfee[_0x4386('0x28')](0xcc)[_0x4386('0x29')]();});}};}function handleEntityNotFound(_0x1625f2,_0x38d07a){return function(_0x3c811d){if(!_0x3c811d){_0x1625f2[_0x4386('0x27')](0x194);}return _0x3c811d;};}function handleError(_0x1761e0,_0x58fc93){_0x58fc93=_0x58fc93||0x1f4;return function(_0x16baeb){logger[_0x4386('0x22')](_0x16baeb[_0x4386('0x35')]);if(_0x16baeb['name']){delete _0x16baeb[_0x4386('0x36')];}_0x1761e0[_0x4386('0x28')](_0x58fc93)['send'](_0x16baeb);};}exports[_0x4386('0x37')]=function(_0x22b15c,_0x49a49f){var _0xb7dcb3=[_0x4386('0x38'),_0x4386('0x39'),_0x4386('0x3a'),_0x4386('0x3b'),'fax',_0x4386('0x3c'),_0x4386('0x3d')];var _0x6bd215={'count':0x0,'rows':[]},_0x3a4ddf={},_0x355f24;Promise[_0x4386('0x3e')]()['then'](function(){if(_0x22b15c[_0x4386('0x3f')][_0x4386('0x40')]){if(!_[_0x4386('0x41')](_0xb7dcb3,_0x22b15c[_0x4386('0x3f')]['channel']['toLowerCase']()))throw new Error(_0x4386('0x42'));_0x355f24=_0x22b15c[_0x4386('0x3f')][_0x4386('0x40')]['toLowerCase']();}var _0x2f3ec0=_['startCase'](_0x355f24)+'Queue';var _0x88536b=_[_0x4386('0x43')](db[_0x2f3ec0]['rawAttributes'],function(_0xd98af5){return{'name':_0xd98af5[_0x4386('0x44')],'type':_0xd98af5[_0x4386('0x45')][_0x4386('0x46')]};});_0x3a4ddf=qs[_0x4386('0x47')](_0x88536b,_0x22b15c);if(_0x22b15c['user']['role']===_0x4386('0x48')){var _0x96959a={'params':{'id':_0x22b15c[_0x4386('0x48')][_0x4386('0x49')]},'query':{'section':_0x355f24==='voice'&&_0x22b15c['query'][_0x4386('0x45')]===_0x4386('0x4a')?_0x4386('0x4b'):_[_0x4386('0x4c')](_0x355f24)+_0x4386('0x4d'),'type':_0x22b15c[_0x4386('0x3f')][_0x4386('0x45')],'nolimit':!![],'sort':_0x4386('0x36'),'filter':_0x22b15c[_0x4386('0x3f')][_0x4386('0x4e')]}};return db[_0x4386('0x4f')][_0x4386('0x50')](_0x96959a);}return db[_0x2f3ec0][_0x4386('0x51')](_0x3a4ddf);})[_0x4386('0x33')](function(_0xacda52){_0x6bd215[_0x4386('0x2c')]=_0xacda52[_0x4386('0x2c')];var _0x4af945=_0x355f24===_0x4386('0x3d')?client:routingClient;return _0x4af945[_0x4386('0x1c')](_[_0x4386('0x4c')](_0x355f24)+_0x4386('0x4d'),_0x22b15c)[_0x4386('0x33')](function(_0x9e53f7){if(_0x9e53f7[_0x4386('0x22')])throw new Error(util[_0x4386('0x52')]('Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues',_0x355f24));var _0x1d33d0=_0x9e53f7[_0x4386('0x25')];var _0xd2d473=['loggedIn','available','waiting',_0x4386('0x53'),'paused'];if(_0x355f24===_0x4386('0x3d')&&_0x22b15c[_0x4386('0x3f')][_0x4386('0x45')]===_0x4386('0x4a')){_0xd2d473[_0x4386('0x54')](_0x4386('0x55'),_0x4386('0x56'),'message',_0x4386('0x57'),_0x4386('0x58'),_0x4386('0x59'),_0x4386('0x5a'),_0x4386('0x5b'),_0x4386('0x5c'),_0x4386('0x5d'),'erlangAbandonmentRate',_0x4386('0x5e'),_0x4386('0x5f'),_0x4386('0x60'),_0x4386('0x61'),_0x4386('0x62'),_0x4386('0x63'),'predictiveIntervalAnsweredCalls',_0x4386('0x64'),_0x4386('0x65'),'predictiveIntervalAvgHoldtime',_0x4386('0x66'));}var _0x1bf0d9=_0xacda52[_0x4386('0x67')][_0x4386('0x43')](function(_0x443146){var _0x33927d=_0x443146[_0x4386('0x68')]({'plain':!![]});_0x33927d[_0x4386('0x69')]=0x0;_0x33927d[_0x4386('0x6a')]=0x0;_0x33927d[_0x4386('0x6b')]=0x0;_0x33927d[_0x4386('0x6c')]=0x0;_0x33927d[_0x4386('0x69')]=0x0;_0x33927d['waiting']=0x0;if(_0x355f24===_0x4386('0x3d')){_0x33927d['talking']=0x0;if(_0x22b15c[_0x4386('0x3f')]['type']==='outbound'){_0x33927d['pTalking']=0x0;_0x33927d[_0x4386('0x56')]=0x0;}}_0x33927d[_0x4386('0x6d')]=[];var _0x36beb0=_[_0x4386('0x6e')](_0x1d33d0[_0x4386('0x67')],['id',_0x33927d['id']]);if(_0x36beb0)_[_0x4386('0x6f')](_0x33927d,_[_0x4386('0x70')](_0x36beb0,_0xd2d473));if(_0x355f24===_0x4386('0x3d')){return _0x443146[_0x4386('0x71')]({'attributes':['id',_0x4386('0x36'),_0x4386('0x72')],'joinTableAttributes':[],'raw':!![]})[_0x4386('0x33')](function(_0x208936){return _0x443146[_0x4386('0x73')]({'raw':!![]})[_0x4386('0x33')](function(_0x3232c5){for(var _0x4e1988=0x0;_0x4e1988<_0x208936['length'];_0x4e1988++){var _0x3dc45c=_['find'](_0x3232c5,['UserId',_0x208936[_0x4e1988]['id']]);var _0x3eeec3={'id':_0x208936[_0x4e1988]['id'],'name':_0x208936[_0x4e1988]['name'],'online':Boolean(_0x208936[_0x4e1988][_0x4386('0x72')]),'paused':_0x3dc45c?Boolean(_0x3dc45c[_0x4386('0x69')]):![]};if(_0x3eeec3['online'])_0x33927d[_0x4386('0x6a')]++;if(_0x3eeec3[_0x4386('0x69')])_0x33927d[_0x4386('0x69')]++;_0x33927d[_0x4386('0x6d')][_0x4386('0x54')](_0x3eeec3);}return _0x33927d;});});}else{var _0x569b1d=_0x4386('0x74')+_['startCase'](_0x355f24)+_0x4386('0x75');var _0x56a663=_[_0x4386('0x4c')](_0x355f24)+_0x4386('0x76');var _0x5ee207=_0x355f24+_0x4386('0x77');return db[_0x569b1d][_0x4386('0x78')]({'where':{['userQueueKey']:_0x443146['id']},'raw':!![]})[_0x4386('0x33')](function(_0xefbda9){return db[_0x4386('0x74')][_0x4386('0x78')]({'attributes':['id',_0x4386('0x36'),'online',_0x5ee207],'where':{'id':_['map'](_0xefbda9,'UserId'),'role':_0x4386('0x79')},'raw':!![]});})[_0x4386('0x33')](function(_0x4d2f90){for(var _0x2813b1=0x0;_0x2813b1<_0x4d2f90[_0x4386('0x7a')];_0x2813b1++){var _0x2dbff1={'id':_0x4d2f90[_0x2813b1]['id'],'name':_0x4d2f90[_0x2813b1][_0x4386('0x36')],'online':Boolean(_0x4d2f90[_0x2813b1][_0x4386('0x72')]),'paused':Boolean(_0x4d2f90[_0x2813b1][_0x5ee207])};if(_0x2dbff1[_0x4386('0x72')])_0x33927d[_0x4386('0x6a')]++;if(_0x2dbff1[_0x4386('0x69')])_0x33927d['paused']++;_0x33927d[_0x4386('0x6d')][_0x4386('0x54')](_0x2dbff1);}return _0x33927d;});}});return Promise['all'](_0x1bf0d9);});})[_0x4386('0x33')](function(_0x404560){_0x6bd215[_0x4386('0x67')]=_0x404560;return _0x6bd215;})[_0x4386('0x33')](respondWithFilteredResult(_0x49a49f,_0x3a4ddf))['catch'](handleError(_0x49a49f,null));}; \ No newline at end of file +var _0xce65=['code','error','message','result','catch','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','update','sendStatus','name','send','getQueues','sms','openchannel','fax','whatsapp','voice','resolve','channel','query','toLowerCase','Queue','map','rawAttributes','fieldName','key','getOptions','user','role','type','outbound','QueueCampaigns','Queues','filter','getResources','findAndCountAll','request','startCase','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','available','waiting','talking','push','pTalking','originated','dialMethod','Trunk','startProgressive','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','get','paused','loggedIn','find','rows','pick','online','length','loggedInDb','QueueId','Pause','findAll','UserId','agent','agents','all','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','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','../../mysqldb','jayson/promise','client','http','then','info','Realtime,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x4ae21f,_0x39e5b2){var _0x443e10=function(_0x368c40){while(--_0x368c40){_0x4ae21f['push'](_0x4ae21f['shift']());}};_0x443e10(++_0x39e5b2);}(_0xce65,0x1b5));var _0x5ce6=function(_0x28ff7f,_0x3257e7){_0x28ff7f=_0x28ff7f-0x0;var _0x16761c=_0xce65[_0x28ff7f];return _0x16761c;};'use strict';var emlformat=require(_0x5ce6('0x0'));var rimraf=require(_0x5ce6('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x5ce6('0x2'));var BPromise=require(_0x5ce6('0x3'));var Mustache=require(_0x5ce6('0x4'));var util=require(_0x5ce6('0x5'));var path=require(_0x5ce6('0x6'));var sox=require(_0x5ce6('0x7'));var csv=require(_0x5ce6('0x8'));var ejs=require(_0x5ce6('0x9'));var fs=require('fs');var fs_extra=require(_0x5ce6('0xa'));var _=require(_0x5ce6('0xb'));var squel=require(_0x5ce6('0xc'));var crypto=require('crypto');var jsforce=require(_0x5ce6('0xd'));var deskjs=require(_0x5ce6('0xe'));var toCsv=require(_0x5ce6('0x8'));var querystring=require(_0x5ce6('0xf'));var Papa=require(_0x5ce6('0x10'));var Redis=require(_0x5ce6('0x11'));var authService=require(_0x5ce6('0x12'));var qs=require(_0x5ce6('0x13'));var as=require(_0x5ce6('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5ce6('0x15'))(_0x5ce6('0x16'));var utils=require(_0x5ce6('0x17'));var config=require(_0x5ce6('0x18'));var licenseUtil=require(_0x5ce6('0x19'));var db=require(_0x5ce6('0x1a'))['db'];var jayson=require(_0x5ce6('0x1b'));var client=jayson[_0x5ce6('0x1c')][_0x5ce6('0x1d')]({'port':0x232a});var routingClient=jayson[_0x5ce6('0x1c')][_0x5ce6('0x1d')]({'port':0x232c});function respondWithRpcPromise(_0x43c7da,_0x3402c2,_0x189f79,_0x49e3c4){return new BPromise(function(_0xce77ec,_0x457240){var _0x1748ed=_0x49e3c4||client;return _0x1748ed['request'](_0x43c7da,_0x189f79)[_0x5ce6('0x1e')](function(_0x5861ac){logger[_0x5ce6('0x1f')](_0x5ce6('0x20'),_0x3402c2,_0x5ce6('0x21'));logger['debug']('Realtime,\x20%s,\x20%s,\x20%s',_0x3402c2,_0x5ce6('0x21'),JSON[_0x5ce6('0x22')](_0x5861ac));if(_0x5861ac['error']){if(_0x5861ac['error'][_0x5ce6('0x23')]===0x1f4){logger[_0x5ce6('0x24')](_0x5ce6('0x20'),_0x3402c2,_0x5861ac[_0x5ce6('0x24')][_0x5ce6('0x25')]);return _0x457240(_0x5861ac[_0x5ce6('0x24')]['message']);}logger['error'](_0x5ce6('0x20'),_0x3402c2,_0x5861ac[_0x5ce6('0x24')][_0x5ce6('0x25')]);return _0xce77ec(_0x5861ac['error'][_0x5ce6('0x25')]);}else{logger[_0x5ce6('0x1f')](_0x5ce6('0x20'),_0x3402c2,'request\x20sent');_0xce77ec(_0x5861ac[_0x5ce6('0x26')][_0x5ce6('0x25')]);}})[_0x5ce6('0x27')](function(_0x5ad074){logger[_0x5ce6('0x24')](_0x5ce6('0x20'),_0x3402c2,_0x5ad074);_0x457240(_0x5ad074);});});}function respondWithStatusCode(_0x1ec4f4,_0x21285a){_0x21285a=_0x21285a||0xcc;return function(_0x52a87a){if(_0x52a87a){return _0x1ec4f4['sendStatus'](_0x21285a);}return _0x1ec4f4['status'](_0x21285a)[_0x5ce6('0x28')]();};}function respondWithResult(_0x30c845,_0x20405f){_0x20405f=_0x20405f||0xc8;return function(_0x4dd2c1){if(_0x4dd2c1){return _0x30c845[_0x5ce6('0x29')](_0x20405f)[_0x5ce6('0x2a')](_0x4dd2c1);}};}function respondWithFilteredResult(_0x53f4c0,_0x26472e){return function(_0xfcd60c){if(_0xfcd60c){var _0x6db52f=typeof _0x26472e[_0x5ce6('0x2b')]==='undefined'&&typeof _0x26472e['limit']===_0x5ce6('0x2c');var _0x22b134=_0xfcd60c[_0x5ce6('0x2d')];var _0x5a6226=_0x6db52f?0x0:_0x26472e[_0x5ce6('0x2b')];var _0x5405d4=_0x6db52f?_0xfcd60c[_0x5ce6('0x2d')]:_0x26472e[_0x5ce6('0x2b')]+_0x26472e[_0x5ce6('0x2e')];var _0x39fc95;if(_0x5405d4>=_0x22b134){_0x5405d4=_0x22b134;_0x39fc95=0xc8;}else{_0x39fc95=0xce;}_0x53f4c0[_0x5ce6('0x29')](_0x39fc95);return _0x53f4c0[_0x5ce6('0x2f')](_0x5ce6('0x30'),_0x5a6226+'-'+_0x5405d4+'/'+_0x22b134)['json'](_0xfcd60c);}return null;};}function patchUpdates(_0x1e95c7){return function(_0x4182ad){try{jsonpatch[_0x5ce6('0x31')](_0x4182ad,_0x1e95c7,!![]);}catch(_0x559041){return BPromise[_0x5ce6('0x32')](_0x559041);}return _0x4182ad['save']();};}function saveUpdates(_0xe0aa59,_0x18742a){return function(_0x1efc24){if(_0x1efc24){return _0x1efc24[_0x5ce6('0x33')](_0xe0aa59)[_0x5ce6('0x1e')](function(_0x4185bf){return _0x4185bf;});}return null;};}function removeEntity(_0x18cc13,_0xa1e702){return function(_0x41a095){if(_0x41a095){return _0x41a095['destroy']()[_0x5ce6('0x1e')](function(){_0x18cc13[_0x5ce6('0x29')](0xcc)[_0x5ce6('0x28')]();});}};}function handleEntityNotFound(_0x463efc,_0x12d5d5){return function(_0xc2b9c1){if(!_0xc2b9c1){_0x463efc[_0x5ce6('0x34')](0x194);}return _0xc2b9c1;};}function handleError(_0x46e337,_0x58d37e){_0x58d37e=_0x58d37e||0x1f4;return function(_0x27a7c9){logger['error'](_0x27a7c9['stack']);if(_0x27a7c9[_0x5ce6('0x35')]){delete _0x27a7c9[_0x5ce6('0x35')];}_0x46e337[_0x5ce6('0x29')](_0x58d37e)[_0x5ce6('0x36')](_0x27a7c9);};}exports[_0x5ce6('0x37')]=function(_0xe40fd5,_0x43389f){var _0x44a781=['mail','chat',_0x5ce6('0x38'),_0x5ce6('0x39'),_0x5ce6('0x3a'),_0x5ce6('0x3b'),_0x5ce6('0x3c')];var _0x4800ed={'count':0x0,'rows':[]},_0x323432={},_0x396ed7;Promise[_0x5ce6('0x3d')]()[_0x5ce6('0x1e')](function(){if(_0xe40fd5['query'][_0x5ce6('0x3e')]){if(!_['includes'](_0x44a781,_0xe40fd5[_0x5ce6('0x3f')][_0x5ce6('0x3e')][_0x5ce6('0x40')]()))throw new Error('Invalid\x20channel');_0x396ed7=_0xe40fd5[_0x5ce6('0x3f')][_0x5ce6('0x3e')][_0x5ce6('0x40')]();}var _0x25d379=_['startCase'](_0x396ed7)+_0x5ce6('0x41');var _0x2cc587=_[_0x5ce6('0x42')](db[_0x25d379][_0x5ce6('0x43')],function(_0x3297f7){return{'name':_0x3297f7[_0x5ce6('0x44')],'type':_0x3297f7['type'][_0x5ce6('0x45')]};});_0x323432=qs[_0x5ce6('0x46')](_0x2cc587,_0xe40fd5);if(_0xe40fd5[_0x5ce6('0x47')][_0x5ce6('0x48')]===_0x5ce6('0x47')){var _0x5dce2b={'params':{'id':_0xe40fd5[_0x5ce6('0x47')]['userProfileId']},'query':{'section':_0x396ed7===_0x5ce6('0x3c')&&_0xe40fd5[_0x5ce6('0x3f')][_0x5ce6('0x49')]===_0x5ce6('0x4a')?_0x5ce6('0x4b'):_['startCase'](_0x396ed7)+_0x5ce6('0x4c'),'type':_0xe40fd5[_0x5ce6('0x3f')][_0x5ce6('0x49')],'nolimit':!![],'sort':_0x5ce6('0x35'),'filter':_0xe40fd5[_0x5ce6('0x3f')][_0x5ce6('0x4d')]}};return db['UserProfile'][_0x5ce6('0x4e')](_0x5dce2b);}return db[_0x25d379][_0x5ce6('0x4f')](_0x323432);})[_0x5ce6('0x1e')](function(_0x4d3196){_0x4800ed[_0x5ce6('0x2d')]=_0x4d3196[_0x5ce6('0x2d')];var _0x119e3b=_0x396ed7===_0x5ce6('0x3c')?client:routingClient;return _0x119e3b[_0x5ce6('0x50')](_[_0x5ce6('0x51')](_0x396ed7)+_0x5ce6('0x4c'),_0xe40fd5)[_0x5ce6('0x1e')](function(_0xcd3219){if(_0xcd3219[_0x5ce6('0x24')])throw new Error(util['format'](_0x5ce6('0x52'),_0x396ed7));var _0x29aa94=_0xcd3219[_0x5ce6('0x26')];var _0x43daf4=['loggedIn',_0x5ce6('0x53'),_0x5ce6('0x54'),_0x5ce6('0x55'),'paused'];if(_0x396ed7===_0x5ce6('0x3c')&&_0xe40fd5[_0x5ce6('0x3f')][_0x5ce6('0x49')]===_0x5ce6('0x4a')){_0x43daf4[_0x5ce6('0x56')](_0x5ce6('0x57'),_0x5ce6('0x58'),_0x5ce6('0x25'),'dialActive',_0x5ce6('0x59'),_0x5ce6('0x5a'),'startPredictive',_0x5ce6('0x5b'),_0x5ce6('0x5c'),_0x5ce6('0x5d'),'erlangAbandonmentRate',_0x5ce6('0x5e'),_0x5ce6('0x5f'),_0x5ce6('0x60'),'dialPredictiveIntervalMinThreshold',_0x5ce6('0x61'),_0x5ce6('0x62'),_0x5ce6('0x63'),_0x5ce6('0x64'),'predictiveIntervalDroppedCallsCallersExit',_0x5ce6('0x65'),'predictiveIntervalAvgTalktime');}var _0x4f4f2d=_0x4d3196['rows'][_0x5ce6('0x42')](function(_0x3124d0){var _0x319938=_0x3124d0[_0x5ce6('0x66')]({'plain':!![]});_0x319938[_0x5ce6('0x67')]=0x0;_0x319938['loggedInDb']=0x0;_0x319938[_0x5ce6('0x68')]=0x0;_0x319938[_0x5ce6('0x53')]=0x0;_0x319938[_0x5ce6('0x67')]=0x0;_0x319938[_0x5ce6('0x54')]=0x0;if(_0x396ed7===_0x5ce6('0x3c')){_0x319938[_0x5ce6('0x55')]=0x0;if(_0xe40fd5[_0x5ce6('0x3f')][_0x5ce6('0x49')]===_0x5ce6('0x4a')){_0x319938[_0x5ce6('0x57')]=0x0;_0x319938[_0x5ce6('0x58')]=0x0;}}_0x319938['agents']=[];var _0x3fb598=_[_0x5ce6('0x69')](_0x29aa94[_0x5ce6('0x6a')],['id',_0x319938['id']]);if(_0x3fb598)_['merge'](_0x319938,_[_0x5ce6('0x6b')](_0x3fb598,_0x43daf4));if(_0x396ed7===_0x5ce6('0x3c')){return _0x3124d0['getAgents']({'attributes':['id',_0x5ce6('0x35'),_0x5ce6('0x6c')],'joinTableAttributes':[],'raw':!![]})['then'](function(_0x444672){return _0x3124d0['getMembers']({'raw':!![]})['then'](function(_0x30eaf7){for(var _0x15a70a=0x0;_0x15a70a<_0x444672[_0x5ce6('0x6d')];_0x15a70a++){var _0x24669a=_['find'](_0x30eaf7,['UserId',_0x444672[_0x15a70a]['id']]);var _0x26be06={'id':_0x444672[_0x15a70a]['id'],'name':_0x444672[_0x15a70a][_0x5ce6('0x35')],'online':Boolean(_0x444672[_0x15a70a][_0x5ce6('0x6c')]),'paused':_0x24669a?Boolean(_0x24669a['paused']):![]};if(_0x26be06[_0x5ce6('0x6c')])_0x319938[_0x5ce6('0x6e')]++;if(_0x26be06['paused'])_0x319938[_0x5ce6('0x67')]++;_0x319938['agents']['push'](_0x26be06);}return _0x319938;});});}else{var _0x5b060c='User'+_[_0x5ce6('0x51')](_0x396ed7)+_0x5ce6('0x41');var _0x4b2860=_[_0x5ce6('0x51')](_0x396ed7)+_0x5ce6('0x6f');var _0x1f93df=_0x396ed7+_0x5ce6('0x70');return db[_0x5b060c][_0x5ce6('0x71')]({'where':{['userQueueKey']:_0x3124d0['id']},'raw':!![]})[_0x5ce6('0x1e')](function(_0x1b1fba){return db['User'][_0x5ce6('0x71')]({'attributes':['id',_0x5ce6('0x35'),'online',_0x1f93df],'where':{'id':_['map'](_0x1b1fba,_0x5ce6('0x72')),'role':_0x5ce6('0x73')},'raw':!![]});})[_0x5ce6('0x1e')](function(_0x1b02b2){for(var _0x465721=0x0;_0x465721<_0x1b02b2['length'];_0x465721++){var _0x3eacf9={'id':_0x1b02b2[_0x465721]['id'],'name':_0x1b02b2[_0x465721][_0x5ce6('0x35')],'online':Boolean(_0x1b02b2[_0x465721][_0x5ce6('0x6c')]),'paused':Boolean(_0x1b02b2[_0x465721][_0x1f93df])};if(_0x3eacf9[_0x5ce6('0x6c')])_0x319938['loggedInDb']++;if(_0x3eacf9[_0x5ce6('0x67')])_0x319938['paused']++;_0x319938[_0x5ce6('0x74')][_0x5ce6('0x56')](_0x3eacf9);}return _0x319938;});}});return Promise[_0x5ce6('0x75')](_0x4f4f2d);});})[_0x5ce6('0x1e')](function(_0x366cd6){_0x4800ed['rows']=_0x366cd6;return _0x4800ed;})[_0x5ce6('0x1e')](respondWithFilteredResult(_0x43389f,_0x323432))['catch'](handleError(_0x43389f,null));}; \ No newline at end of file diff --git a/server/api/realtime/realtime.model.js b/server/api/realtime/realtime.model.js index ffe6d44..00e730f 100644 --- a/server/api/realtime/realtime.model.js +++ b/server/api/realtime/realtime.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9758=['../../config/environment','define','Realtime','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf'];(function(_0x4baeaf,_0x135773){var _0x386cb8=function(_0x52b3bf){while(--_0x52b3bf){_0x4baeaf['push'](_0x4baeaf['shift']());}};_0x386cb8(++_0x135773);}(_0x9758,0x1e7));var _0x8975=function(_0x49fa03,_0x3c3b9f){_0x49fa03=_0x49fa03-0x0;var _0x20eb85=_0x9758[_0x49fa03];return _0x20eb85;};'use strict';var _=require(_0x8975('0x0'));var util=require(_0x8975('0x1'));var logger=require(_0x8975('0x2'))(_0x8975('0x3'));var moment=require('moment');var BPromise=require(_0x8975('0x4'));var rp=require(_0x8975('0x5'));var fs=require('fs');var path=require(_0x8975('0x6'));var rimraf=require(_0x8975('0x7'));var config=require(_0x8975('0x8'));;module['exports']=function(_0x5361a4,_0x608632){return _0x5361a4[_0x8975('0x9')](_0x8975('0xa'),[],{});}; \ No newline at end of file +var _0xfdf0=['util','../../config/logger','api','moment','path','rimraf','../../config/environment','lodash'];(function(_0x2d2949,_0x24c559){var _0x4bb11f=function(_0x2a75d7){while(--_0x2a75d7){_0x2d2949['push'](_0x2d2949['shift']());}};_0x4bb11f(++_0x24c559);}(_0xfdf0,0xc7));var _0x0fdf=function(_0xfcbcb8,_0x35bf6b){_0xfcbcb8=_0xfcbcb8-0x0;var _0x1b1f97=_0xfdf0[_0xfcbcb8];return _0x1b1f97;};'use strict';var _=require(_0x0fdf('0x0'));var util=require(_0x0fdf('0x1'));var logger=require(_0x0fdf('0x2'))(_0x0fdf('0x3'));var moment=require(_0x0fdf('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0fdf('0x5'));var rimraf=require(_0x0fdf('0x6'));var config=require(_0x0fdf('0x7'));;module['exports']=function(_0x213b92,_0x134f31){return _0x213b92['define']('Realtime',[],{});}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index 0fdb788..49d1f43 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x2ec3d1,_0x2d82b2){var _0x2551e2=function(_0x5a638b){while(--_0x5a638b){_0x2ec3d1['push'](_0x2ec3d1['shift']());}};_0x2551e2(++_0x2d82b2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x34bc30,_0x177cb0){_0x34bc30=_0x34bc30-0x0;var _0x5706de=_0xa9e0[_0x34bc30];return _0x5706de;};'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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x5da9c2,_0x46df7b){var _0x218b70=function(_0x3c89c0){while(--_0x3c89c0){_0x5da9c2['push'](_0x5da9c2['shift']());}};_0x218b70(++_0x46df7b);}(_0xedd9,0xfc));var _0x9edd=function(_0x35ce19,_0x1a5011){_0x35ce19=_0x35ce19-0x0;var _0x59bcf4=_0xedd9[_0x35ce19];return _0x59bcf4;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 6a99a9a..0152983 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 _0xdcf6=['STRING','DATE','exports','INTEGER'];(function(_0x28551c,_0x2623f2){var _0x240140=function(_0x2896f2){while(--_0x2896f2){_0x28551c['push'](_0x28551c['shift']());}};_0x240140(++_0x2623f2);}(_0xdcf6,0x1b6));var _0x6dcf=function(_0x3c957d,_0x40d8f3){_0x3c957d=_0x3c957d-0x0;var _0x46ab64=_0xdcf6[_0x3c957d];return _0x46ab64;};'use strict';var Sequelize=require('sequelize');module[_0x6dcf('0x0')]={'state':{'type':Sequelize[_0x6dcf('0x1')](0x2)},'statedesc':{'type':Sequelize[_0x6dcf('0x2')]},'scheduledat':{'type':Sequelize[_0x6dcf('0x3')]},'uniqueid':{'type':Sequelize[_0x6dcf('0x2')]},'starttime':{'type':Sequelize[_0x6dcf('0x3')]},'responsetime':{'type':Sequelize[_0x6dcf('0x3')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0x6dcf('0x2')]},'campaigntype':{'type':Sequelize[_0x6dcf('0x2')]},'membername':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x79bf=['STRING','DATE','INTEGER','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79bf,0x1df));var _0xf79b=function(_0x148bd2,_0x3338c6){_0x148bd2=_0x148bd2-0x0;var _0x38c56f=_0x79bf[_0x148bd2];return _0x38c56f;};'use strict';var Sequelize=require('sequelize');module[_0xf79b('0x0')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0xf79b('0x1')]},'scheduledat':{'type':Sequelize['DATE']},'uniqueid':{'type':Sequelize[_0xf79b('0x1')]},'starttime':{'type':Sequelize[_0xf79b('0x2')]},'responsetime':{'type':Sequelize[_0xf79b('0x2')]},'ringtime':{'type':Sequelize[_0xf79b('0x3')],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf79b('0x1')]},'campaigntype':{'type':Sequelize[_0xf79b('0x1')]},'membername':{'type':Sequelize[_0xf79b('0x1')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 547112b..1840c2d 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 _0xa5cf=['bluebird','path','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','util','../../config/logger','moment'];(function(_0x17b359,_0x2fd6aa){var _0x503202=function(_0x5d9fcd){while(--_0x5d9fcd){_0x17b359['push'](_0x17b359['shift']());}};_0x503202(++_0x2fd6aa);}(_0xa5cf,0xc2));var _0xfa5c=function(_0x2d9563,_0xec2b58){_0x2d9563=_0x2d9563-0x0;var _0x12ffa3=_0xa5cf[_0x2d9563];return _0x12ffa3;};'use strict';var _=require(_0xfa5c('0x0'));var util=require(_0xfa5c('0x1'));var logger=require(_0xfa5c('0x2'))('api');var moment=require(_0xfa5c('0x3'));var BPromise=require(_0xfa5c('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfa5c('0x5'));var rimraf=require('rimraf');var config=require(_0xfa5c('0x6'));var attributes=require(_0xfa5c('0x7'));module[_0xfa5c('0x8')]=function(_0x195a86,_0x1976b5){return _0x195a86[_0xfa5c('0x9')](_0xfa5c('0xa'),attributes,{'tableName':'report_agent_preview','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedfc=['./reportAgentPreview.attributes','exports','define','ReportAgentPreview','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment'];(function(_0x1a89a1,_0x56d889){var _0x3d5b46=function(_0x56debf){while(--_0x56debf){_0x1a89a1['push'](_0x1a89a1['shift']());}};_0x3d5b46(++_0x56d889);}(_0xedfc,0x1f3));var _0xcedf=function(_0x6e962f,_0x3788e4){_0x6e962f=_0x6e962f-0x0;var _0x3bfa21=_0xedfc[_0x6e962f];return _0x3bfa21;};'use strict';var _=require(_0xcedf('0x0'));var util=require('util');var logger=require(_0xcedf('0x1'))(_0xcedf('0x2'));var moment=require(_0xcedf('0x3'));var BPromise=require(_0xcedf('0x4'));var rp=require(_0xcedf('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xcedf('0x6'));var attributes=require(_0xcedf('0x7'));module[_0xcedf('0x8')]=function(_0x19e3bb,_0x3653d2){return _0x19e3bb[_0xcedf('0x9')](_0xcedf('0xa'),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 1f7ba3c..59e13ea 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 _0xf2d8=['options','lodash','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','request','then','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','catch','CreateReportAgentPreview','create','body'];(function(_0x24ce21,_0x69233d){var _0x38e731=function(_0x1c7457){while(--_0x1c7457){_0x24ce21['push'](_0x24ce21['shift']());}};_0x38e731(++_0x69233d);}(_0xf2d8,0xa2));var _0x8f2d=function(_0x32eb8b,_0x5ac0b5){_0x32eb8b=_0x32eb8b-0x0;var _0x5bc68b=_0xf2d8[_0x32eb8b];return _0x5bc68b;};'use strict';var _=require(_0x8f2d('0x0'));var util=require('util');var moment=require(_0x8f2d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8f2d('0x2'));var fs=require('fs');var Redis=require(_0x8f2d('0x3'));var db=require(_0x8f2d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8f2d('0x5'));var config=require('../../config/environment');var jayson=require(_0x8f2d('0x6'));var client=jayson[_0x8f2d('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2ce44a,_0xc980d6,_0x36939a){return new BPromise(function(_0x245fd7,_0x4f2a05){return client[_0x8f2d('0x8')](_0x2ce44a,_0x36939a)[_0x8f2d('0x9')](function(_0xf5e48){logger['info'](_0x8f2d('0xa'),_0xc980d6,_0x8f2d('0xb'));logger[_0x8f2d('0xc')]('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0xc980d6,_0x8f2d('0xb'),JSON[_0x8f2d('0xd')](_0xf5e48));if(_0xf5e48[_0x8f2d('0xe')]){if(_0xf5e48[_0x8f2d('0xe')]['code']===0x1f4){logger[_0x8f2d('0xe')](_0x8f2d('0xa'),_0xc980d6,_0xf5e48[_0x8f2d('0xe')][_0x8f2d('0xf')]);return _0x4f2a05(_0xf5e48[_0x8f2d('0xe')][_0x8f2d('0xf')]);}logger['error']('ReportAgentPreview,\x20%s,\x20%s',_0xc980d6,_0xf5e48[_0x8f2d('0xe')][_0x8f2d('0xf')]);return _0x245fd7(_0xf5e48[_0x8f2d('0xe')][_0x8f2d('0xf')]);}else{logger[_0x8f2d('0x10')](_0x8f2d('0xa'),_0xc980d6,'request\x20sent');_0x245fd7(_0xf5e48[_0x8f2d('0x11')][_0x8f2d('0xf')]);}})[_0x8f2d('0x12')](function(_0x30b38c){logger[_0x8f2d('0xe')](_0x8f2d('0xa'),_0xc980d6,_0x30b38c);_0x4f2a05(_0x30b38c);});});}exports[_0x8f2d('0x13')]=function(_0x42ce8e){var _0x43987e=this;return new Promise(function(_0x26737e,_0x182c03){return db['ReportAgentPreview'][_0x8f2d('0x14')](_0x42ce8e[_0x8f2d('0x15')],{'raw':_0x42ce8e[_0x8f2d('0x16')]?_0x42ce8e[_0x8f2d('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x61cae){logger[_0x8f2d('0x10')](_0x8f2d('0x13'),_0x42ce8e);logger[_0x8f2d('0xc')](_0x8f2d('0x13'),_0x42ce8e,JSON[_0x8f2d('0xd')](_0x61cae));_0x26737e(_0x61cae);})[_0x8f2d('0x12')](function(_0x273abf){logger[_0x8f2d('0xe')]('CreateReportAgentPreview',_0x273abf[_0x8f2d('0xf')],_0x42ce8e);_0x182c03(_0x43987e[_0x8f2d('0xe')](0x1f4,_0x273abf[_0x8f2d('0xf')]));});});}; \ No newline at end of file +var _0xaa96=['debug','ReportAgentPreview,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateReportAgentPreview','ReportAgentPreview','create','body','options','raw','then','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent'];(function(_0x577b5c,_0xc5bd6){var _0x22f056=function(_0x516dae){while(--_0x516dae){_0x577b5c['push'](_0x577b5c['shift']());}};_0x22f056(++_0xc5bd6);}(_0xaa96,0x145));var _0x6aa9=function(_0x283238,_0x1ea70b){_0x283238=_0x283238-0x0;var _0x24bd2c=_0xaa96[_0x283238];return _0x24bd2c;};'use strict';var _=require('lodash');var util=require(_0x6aa9('0x0'));var moment=require(_0x6aa9('0x1'));var BPromise=require(_0x6aa9('0x2'));var rs=require(_0x6aa9('0x3'));var fs=require('fs');var Redis=require(_0x6aa9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6aa9('0x5'));var logger=require(_0x6aa9('0x6'))(_0x6aa9('0x7'));var config=require(_0x6aa9('0x8'));var jayson=require(_0x6aa9('0x9'));var client=jayson[_0x6aa9('0xa')][_0x6aa9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x922843,_0x38ea05,_0x542cbd){return new BPromise(function(_0x5d2a68,_0x13cc3d){return client[_0x6aa9('0xc')](_0x922843,_0x542cbd)['then'](function(_0x108f37){logger[_0x6aa9('0xd')](_0x6aa9('0xe'),_0x38ea05,_0x6aa9('0xf'));logger[_0x6aa9('0x10')](_0x6aa9('0x11'),_0x38ea05,_0x6aa9('0xf'),JSON[_0x6aa9('0x12')](_0x108f37));if(_0x108f37[_0x6aa9('0x13')]){if(_0x108f37[_0x6aa9('0x13')][_0x6aa9('0x14')]===0x1f4){logger[_0x6aa9('0x13')](_0x6aa9('0xe'),_0x38ea05,_0x108f37[_0x6aa9('0x13')][_0x6aa9('0x15')]);return _0x13cc3d(_0x108f37[_0x6aa9('0x13')][_0x6aa9('0x15')]);}logger['error'](_0x6aa9('0xe'),_0x38ea05,_0x108f37[_0x6aa9('0x13')][_0x6aa9('0x15')]);return _0x5d2a68(_0x108f37['error'][_0x6aa9('0x15')]);}else{logger[_0x6aa9('0xd')](_0x6aa9('0xe'),_0x38ea05,'request\x20sent');_0x5d2a68(_0x108f37[_0x6aa9('0x16')][_0x6aa9('0x15')]);}})[_0x6aa9('0x17')](function(_0x4d9682){logger[_0x6aa9('0x13')](_0x6aa9('0xe'),_0x38ea05,_0x4d9682);_0x13cc3d(_0x4d9682);});});}exports[_0x6aa9('0x18')]=function(_0x364978){var _0x17ecc9=this;return new Promise(function(_0x58586f,_0x1c24b4){return db[_0x6aa9('0x19')][_0x6aa9('0x1a')](_0x364978[_0x6aa9('0x1b')],{'raw':_0x364978[_0x6aa9('0x1c')]?_0x364978['options'][_0x6aa9('0x1d')]===undefined?!![]:![]:!![]})[_0x6aa9('0x1e')](function(_0x4eb25d){logger[_0x6aa9('0xd')](_0x6aa9('0x18'),_0x364978);logger[_0x6aa9('0x10')](_0x6aa9('0x18'),_0x364978,JSON[_0x6aa9('0x12')](_0x4eb25d));_0x58586f(_0x4eb25d);})['catch'](function(_0x402908){logger[_0x6aa9('0x13')](_0x6aa9('0x18'),_0x402908[_0x6aa9('0x15')],_0x364978);_0x1c24b4(_0x17ecc9[_0x6aa9('0x13')](0x1f4,_0x402908[_0x6aa9('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index a7c2927..60c1fd1 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 _0xd7e9=['showVoiceQueues','updateVoiceQueue','/outbound','outboundChannels','/agents','agents','/telephones','telephones','trunks','/campaigns','/fax/accounts','faxAccounts','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','/sms/queues/waitinginteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','/mail/queues/:id','showMailQueues','showChatQueues','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','/openchannel/queues/:id/notify','openchannel','/openchannel/queues/:id','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','agentNotify','exports','multer','util','path','express','Router','../../components/auth/service','./rpc.controller','get','isAuthenticated','voiceChannels','/voice/channels/:uniqueid/mixmonitor','/voice/channels/:uniqueid/stopmixmonitor','/chat/queues','chatQueues','mailQueues','/mail/accounts','mailAccounts','/openchannel/queues','openchannelQueues','smsQueues','whatsappQueues','/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'];(function(_0x513aa5,_0x1fba79){var _0x1a1a7c=function(_0x240e3f){while(--_0x240e3f){_0x513aa5['push'](_0x513aa5['shift']());}};_0x1a1a7c(++_0x1fba79);}(_0xd7e9,0x1d8));var _0x9d7e=function(_0x158ba6,_0x50f1b5){_0x158ba6=_0x158ba6-0x0;var _0x412e34=_0xd7e9[_0x158ba6];return _0x412e34;};'use strict';var multer=require(_0x9d7e('0x0'));var util=require(_0x9d7e('0x1'));var path=require(_0x9d7e('0x2'));var express=require(_0x9d7e('0x3'));var router=express[_0x9d7e('0x4')]();var auth=require(_0x9d7e('0x5'));var controller=require(_0x9d7e('0x6'));router[_0x9d7e('0x7')]('/voice/channels',auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x9')]);router[_0x9d7e('0x7')](_0x9d7e('0xa'),auth[_0x9d7e('0x8')](),controller['voiceChannelMixMonitor']);router[_0x9d7e('0x7')](_0x9d7e('0xb'),auth[_0x9d7e('0x8')](),controller['voiceChannelStopMixMonitor']);router[_0x9d7e('0x7')]('/voice/queues',auth[_0x9d7e('0x8')](),controller['voiceQueues']);router['get'](_0x9d7e('0xc'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0xd')]);router[_0x9d7e('0x7')]('/mail/queues',auth[_0x9d7e('0x8')](),controller[_0x9d7e('0xe')]);router[_0x9d7e('0x7')](_0x9d7e('0xf'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x10')]);router[_0x9d7e('0x7')](_0x9d7e('0x11'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x12')]);router['get']('/sms/queues',auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x13')]);router[_0x9d7e('0x7')]('/whatsapp/queues',auth['isAuthenticated'](),controller[_0x9d7e('0x14')]);router[_0x9d7e('0x7')]('/fax/queues',auth['isAuthenticated'](),controller['faxQueues']);router[_0x9d7e('0x7')](_0x9d7e('0x15'),auth['isAuthenticated'](),controller[_0x9d7e('0x16')]);router['get'](_0x9d7e('0x17'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x18')]);router[_0x9d7e('0x7')](_0x9d7e('0x19'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x1a')]);router[_0x9d7e('0x7')](_0x9d7e('0x1b'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x1c')]);router[_0x9d7e('0x7')](_0x9d7e('0x1d'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x1e')]);router[_0x9d7e('0x7')](_0x9d7e('0x1f'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x20')]);router['put'](_0x9d7e('0x1f'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x21')]);router['get'](_0x9d7e('0x22'),auth['isAuthenticated'](),controller['outbound']);router[_0x9d7e('0x7')]('/outbound/channels',auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x23')]);router[_0x9d7e('0x7')](_0x9d7e('0x24'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x25')]);router['put']('/agents/:id/capacity',auth[_0x9d7e('0x8')](),controller['agentCapacity']);router['get'](_0x9d7e('0x26'),auth['isAuthenticated'](),controller[_0x9d7e('0x27')]);router['get']('/trunks',auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x28')]);router[_0x9d7e('0x7')](_0x9d7e('0x29'),auth[_0x9d7e('0x8')](),controller['campaigns']);router['get'](_0x9d7e('0x2a'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x2b')]);router[_0x9d7e('0x7')]('/chat/queues/waitinginteractions',auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x2c')]);router[_0x9d7e('0x7')](_0x9d7e('0x2d'),auth['isAuthenticated'](),controller['mailQueuesWaitingInteractions']);router[_0x9d7e('0x7')](_0x9d7e('0x2e'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x2f')]);router[_0x9d7e('0x7')]('/openchannel/queues/:id/waitinginteractions',auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x30')]);router[_0x9d7e('0x7')](_0x9d7e('0x31'),auth[_0x9d7e('0x8')](),controller['smsQueuesWaitingInteractions']);router[_0x9d7e('0x7')](_0x9d7e('0x32'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x33')]);router[_0x9d7e('0x7')]('/fax/queues/waitinginteractions',auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x34')]);router[_0x9d7e('0x35')](_0x9d7e('0x36'),auth['isAuthenticated'](),controller[_0x9d7e('0x37')]('mail'));router[_0x9d7e('0x7')](_0x9d7e('0x38'),auth['isAuthenticated'](),controller[_0x9d7e('0x39')]);router['post']('/chat/queues/:id/notify',auth['isAuthenticated'](),controller[_0x9d7e('0x37')]('chat'));router['get']('/chat/queues/:id',auth['isAuthenticated'](),controller[_0x9d7e('0x3a')]);router[_0x9d7e('0x35')](_0x9d7e('0x3b'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x37')]('fax'));router[_0x9d7e('0x7')](_0x9d7e('0x3c'),auth['isAuthenticated'](),controller[_0x9d7e('0x3d')]);router[_0x9d7e('0x35')](_0x9d7e('0x3e'),auth[_0x9d7e('0x8')](),controller['queueNotify'](_0x9d7e('0x3f')));router['get'](_0x9d7e('0x40'),auth[_0x9d7e('0x8')](),controller['showOpenchannelQueues']);router['post'](_0x9d7e('0x41'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x37')]('sms'));router[_0x9d7e('0x35')](_0x9d7e('0x42'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x37')]('whatsapp'));router[_0x9d7e('0x7')](_0x9d7e('0x43'),auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x44')]);router[_0x9d7e('0x7')](_0x9d7e('0x45'),auth[_0x9d7e('0x8')](),controller['showWhatsappQueues']);router[_0x9d7e('0x35')]('/agents/:id/notify',auth[_0x9d7e('0x8')](),controller[_0x9d7e('0x46')]);module[_0x9d7e('0x47')]=router; \ No newline at end of file +var _0xdcda=['/chat/queues/:id','/fax/queues/:id/notify','/fax/queues/:id','showFaxQueues','openchannel','/openchannel/queues/:id','showOpenchannelQueues','/sms/queues/:id/notify','sms','/whatsapp/queues/:id/notify','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','exports','multer','util','path','get','/voice/channels','voiceChannels','/voice/channels/:uniqueid/mixmonitor','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','chatQueues','mailQueues','mailAccounts','/openchannel/queues','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','/voice/queues/:id','showVoiceQueues','put','updateVoiceQueue','/outbound','outbound','outboundChannels','/agents/:id/capacity','agentCapacity','telephones','/trunks','trunks','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','/mail/queues/waitinginteractions','mailQueuesWaitingInteractions','/openchannel/queues/waitinginteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','/sms/queues/waitinginteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','queueNotify','chat'];(function(_0x2dea9b,_0x6f3b03){var _0x6fcafd=function(_0x2cfd63){while(--_0x2cfd63){_0x2dea9b['push'](_0x2dea9b['shift']());}};_0x6fcafd(++_0x6f3b03);}(_0xdcda,0x18b));var _0xadcd=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xdcda[_0x4b369d];return _0x571a98;};'use strict';var multer=require(_0xadcd('0x0'));var util=require(_0xadcd('0x1'));var path=require(_0xadcd('0x2'));var express=require('express');var router=express['Router']();var auth=require('../../components/auth/service');var controller=require('./rpc.controller');router[_0xadcd('0x3')](_0xadcd('0x4'),auth['isAuthenticated'](),controller[_0xadcd('0x5')]);router[_0xadcd('0x3')](_0xadcd('0x6'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x8')]);router['get']('/voice/channels/:uniqueid/stopmixmonitor',auth[_0xadcd('0x7')](),controller[_0xadcd('0x9')]);router['get']('/voice/queues',auth[_0xadcd('0x7')](),controller[_0xadcd('0xa')]);router[_0xadcd('0x3')](_0xadcd('0xb'),auth[_0xadcd('0x7')](),controller[_0xadcd('0xc')]);router[_0xadcd('0x3')]('/mail/queues',auth[_0xadcd('0x7')](),controller[_0xadcd('0xd')]);router['get']('/mail/accounts',auth[_0xadcd('0x7')](),controller[_0xadcd('0xe')]);router[_0xadcd('0x3')](_0xadcd('0xf'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x10')]);router[_0xadcd('0x3')](_0xadcd('0x11'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x12')]);router[_0xadcd('0x3')](_0xadcd('0x13'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x14')]);router[_0xadcd('0x3')](_0xadcd('0x15'),auth[_0xadcd('0x7')](),controller['faxQueues']);router['get'](_0xadcd('0x16'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x17')]);router[_0xadcd('0x3')](_0xadcd('0x18'),auth['isAuthenticated'](),controller[_0xadcd('0x19')]);router[_0xadcd('0x3')](_0xadcd('0x1a'),auth['isAuthenticated'](),controller[_0xadcd('0x1b')]);router['get'](_0xadcd('0x1c'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x1d')]);router[_0xadcd('0x3')]('/voice/queues/channels/:uniqueid/redirect/:exten',auth[_0xadcd('0x7')](),controller[_0xadcd('0x1e')]);router['get'](_0xadcd('0x1f'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x20')]);router[_0xadcd('0x21')](_0xadcd('0x1f'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x22')]);router[_0xadcd('0x3')](_0xadcd('0x23'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x24')]);router[_0xadcd('0x3')]('/outbound/channels',auth[_0xadcd('0x7')](),controller[_0xadcd('0x25')]);router['get']('/agents',auth[_0xadcd('0x7')](),controller['agents']);router[_0xadcd('0x21')](_0xadcd('0x26'),auth['isAuthenticated'](),controller[_0xadcd('0x27')]);router['get']('/telephones',auth[_0xadcd('0x7')](),controller[_0xadcd('0x28')]);router['get'](_0xadcd('0x29'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x2a')]);router[_0xadcd('0x3')]('/campaigns',auth[_0xadcd('0x7')](),controller['campaigns']);router['get']('/fax/accounts',auth['isAuthenticated'](),controller['faxAccounts']);router[_0xadcd('0x3')](_0xadcd('0x2b'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x2c')]);router[_0xadcd('0x3')](_0xadcd('0x2d'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x2e')]);router[_0xadcd('0x3')](_0xadcd('0x2f'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x30')]);router[_0xadcd('0x3')](_0xadcd('0x31'),auth[_0xadcd('0x7')](),controller['openchannelQueuesIdWaitingInteractions']);router[_0xadcd('0x3')](_0xadcd('0x32'),auth['isAuthenticated'](),controller[_0xadcd('0x33')]);router['get'](_0xadcd('0x34'),auth['isAuthenticated'](),controller[_0xadcd('0x35')]);router[_0xadcd('0x3')]('/fax/queues/waitinginteractions',auth[_0xadcd('0x7')](),controller['faxQueuesWaitingInteractions']);router[_0xadcd('0x36')]('/mail/queues/:id/notify',auth['isAuthenticated'](),controller['queueNotify'](_0xadcd('0x37')));router[_0xadcd('0x3')](_0xadcd('0x38'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x39')]);router[_0xadcd('0x36')](_0xadcd('0x3a'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x3b')](_0xadcd('0x3c')));router[_0xadcd('0x3')](_0xadcd('0x3d'),auth[_0xadcd('0x7')](),controller['showChatQueues']);router[_0xadcd('0x36')](_0xadcd('0x3e'),auth['isAuthenticated'](),controller[_0xadcd('0x3b')]('fax'));router[_0xadcd('0x3')](_0xadcd('0x3f'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x40')]);router[_0xadcd('0x36')]('/openchannel/queues/:id/notify',auth[_0xadcd('0x7')](),controller[_0xadcd('0x3b')](_0xadcd('0x41')));router[_0xadcd('0x3')](_0xadcd('0x42'),auth['isAuthenticated'](),controller[_0xadcd('0x43')]);router[_0xadcd('0x36')](_0xadcd('0x44'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x3b')](_0xadcd('0x45')));router[_0xadcd('0x36')](_0xadcd('0x46'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x3b')]('whatsapp'));router['get']('/sms/queues/:id',auth[_0xadcd('0x7')](),controller[_0xadcd('0x47')]);router['get'](_0xadcd('0x48'),auth[_0xadcd('0x7')](),controller[_0xadcd('0x49')]);router['post'](_0xadcd('0x4a'),auth['isAuthenticated'](),controller['agentNotify']);module[_0xadcd('0x4b')]=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 054a79d..e9e8fe1 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 _0x7fbe=['VoiceQueuesPreview','voiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','voiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','Agents','agentCapacity','interaction','MemberReport','findAll','INTERACTION','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','SIP/%s','user','interface','agent','internal','AgentCapacity','telephones','Telephones','trunks','Campaigns','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','showOpenchannelQueues','OpenchannelQueues','smsQueues','showSmsQueues','SmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','showFaxQueues','FaxQueues','faxAccounts','FaxAccounts','ChatQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','rows','filter','map','queue_id','uniq','value','indexOf','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','create','queueTransferTimeout','agentNotify','channel','Channel\x20field\x20is\x20mandatory','capitalize','Website','User','Agent\x20not\x20found','From','TransferReport','Start','agentTransferTimeout','*,*,*,*','lodash','util','../../mysqldb','../../config/logger','api','jayson/promise','client','http','request','error','code','message','result','catch','status','json','stack','name','send','isNil','find','voiceChannels','query','VoiceChannelMixMonitor','merge','params','then','voiceQueues','showVoiceQueues','VoiceQueues','UpdateVoiceQueue','body'];(function(_0x2a8841,_0x355633){var _0x164f64=function(_0x5f29e2){while(--_0x5f29e2){_0x2a8841['push'](_0x2a8841['shift']());}};_0x164f64(++_0x355633);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x129479,_0x256c7e){_0x129479=_0x129479-0x0;var _0x3fa0ce=_0x7fbe[_0x129479];return _0x3fa0ce;};'use strict';var BPromise=require('bluebird');var moment=require('moment');var _=require(_0xe7fb('0x0'));var util=require(_0xe7fb('0x1'));var db=require(_0xe7fb('0x2'))['db'];var logger=require(_0xe7fb('0x3'))(_0xe7fb('0x4'));var jayson=require(_0xe7fb('0x5'));var amiClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232a});var mailClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232b});var routingClient=jayson[_0xe7fb('0x6')][_0xe7fb('0x7')]({'port':0x232c});function respondWithRpcPromise(_0x24cd67,_0x1f943f,_0x5ad75b){return new BPromise(function(_0x213ebc,_0x228f6b){var _0x1d0741=_0x5ad75b?_0x5ad75b:amiClient;return _0x1d0741[_0xe7fb('0x8')](_0x24cd67,_0x1f943f)['then'](function(_0x558857){if(_0x558857[_0xe7fb('0x9')]){if(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xa')]===0x1f4){return _0x228f6b(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xb')]);}return _0x213ebc(_0x558857[_0xe7fb('0x9')][_0xe7fb('0xb')]);}else{_0x213ebc(_0x558857[_0xe7fb('0xc')]);}})[_0xe7fb('0xd')](function(_0x2fe8ab){_0x228f6b(_0x2fe8ab);});});}function respondWithResult(_0x2437d4,_0x188e1d){_0x188e1d=_0x188e1d||0xc8;return function(_0xdf9760){if(_0xdf9760){return _0x2437d4[_0xe7fb('0xe')](_0x188e1d)[_0xe7fb('0xf')](_0xdf9760);}return _0x2437d4['sendStatus'](0x194);};}function handleError(_0x278b75,_0x2225e5){_0x2225e5=_0x2225e5||0x1f4;return function(_0x5573ab){logger[_0xe7fb('0x9')](_0x5573ab[_0xe7fb('0x10')]);if(_0x5573ab['name']){delete _0x5573ab[_0xe7fb('0x11')];}_0x278b75['status'](_0x2225e5)[_0xe7fb('0x12')](_0x5573ab);};}function findById(_0x18d23c){return function(_0x12603d){if(!_[_0xe7fb('0x13')](_0x18d23c)&&!_['isNil'](_0x12603d)&&!_[_0xe7fb('0x13')](_0x12603d['rows'])){return _[_0xe7fb('0x14')](_0x12603d['rows'],function(_0x1e77fd){return _0x1e77fd['id']==_0x18d23c;});}return null;};}exports[_0xe7fb('0x15')]=function(_0x3f96a7,_0x182269){return respondWithRpcPromise('VoiceChannels',_0x3f96a7[_0xe7fb('0x16')])['then'](respondWithResult(_0x182269,null))[_0xe7fb('0xd')](handleError(_0x182269,null));};exports['voiceChannelMixMonitor']=function(_0x15f7a4,_0x4ea664){return respondWithRpcPromise(_0xe7fb('0x17'),_[_0xe7fb('0x18')](_0x15f7a4['query'],_0x15f7a4[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x4ea664,null))[_0xe7fb('0xd')](handleError(_0x4ea664,null));};exports['voiceChannelStopMixMonitor']=function(_0x469d50,_0x469ead){return respondWithRpcPromise('VoiceChannelStopMixMonitor',_['merge'](_0x469d50['query'],_0x469d50[_0xe7fb('0x19')]))['then'](respondWithResult(_0x469ead,null))['catch'](handleError(_0x469ead,null));};exports[_0xe7fb('0x1b')]=function(_0x32e8b2,_0x2996ae){return respondWithRpcPromise('VoiceQueues',_0x32e8b2[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x2996ae,null))[_0xe7fb('0xd')](handleError(_0x2996ae,null));};exports[_0xe7fb('0x1c')]=function(_0x392d75,_0x16237a){return respondWithRpcPromise(_0xe7fb('0x1d'),_0x392d75['query'])['then'](findById(_0x392d75[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x16237a,null))[_0xe7fb('0xd')](handleError(_0x16237a,null));};exports['updateVoiceQueue']=function(_0xb1f2f4,_0x251807){return respondWithRpcPromise(_0xe7fb('0x1e'),_[_0xe7fb('0x18')](_0xb1f2f4[_0xe7fb('0x1f')],_0xb1f2f4[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x251807,null))[_0xe7fb('0xd')](handleError(_0x251807,null));};exports['voiceQueuesPreview']=function(_0x3d1fb5,_0x1742f3){return respondWithRpcPromise(_0xe7fb('0x20'),_['merge'](_0x3d1fb5['query'],_0x3d1fb5[_0xe7fb('0x19')]))['then'](respondWithResult(_0x1742f3,null))[_0xe7fb('0xd')](handleError(_0x1742f3,null));};exports[_0xe7fb('0x21')]=function(_0xe49053,_0x2a4745){return respondWithRpcPromise('VoiceQueuesChannels',_0xe49053[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x2a4745,null))[_0xe7fb('0xd')](handleError(_0x2a4745,null));};exports[_0xe7fb('0x22')]=function(_0x2d650d,_0x480819){return respondWithRpcPromise(_0xe7fb('0x23'),_[_0xe7fb('0x18')](_0x2d650d[_0xe7fb('0x16')],_0x2d650d[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x480819,null))[_0xe7fb('0xd')](handleError(_0x480819,null));};exports[_0xe7fb('0x24')]=function(_0x147eb1,_0x389903){return respondWithRpcPromise('VoiceQueuesChannelHangup',_[_0xe7fb('0x18')](_0x147eb1[_0xe7fb('0x16')],_0x147eb1[_0xe7fb('0x19')]))['then'](respondWithResult(_0x389903,null))[_0xe7fb('0xd')](handleError(_0x389903,null));};exports[_0xe7fb('0x25')]=function(_0x4218bc,_0x1530b1){return respondWithRpcPromise(_0xe7fb('0x26'),_[_0xe7fb('0x18')](_0x4218bc[_0xe7fb('0x16')],_0x4218bc[_0xe7fb('0x19')]))[_0xe7fb('0x1a')](respondWithResult(_0x1530b1,null))[_0xe7fb('0xd')](handleError(_0x1530b1,null));};exports[_0xe7fb('0x27')]=function(_0x3c4f4b,_0x1544f2){return respondWithRpcPromise(_0xe7fb('0x28'),_0x3c4f4b[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x1544f2,null))[_0xe7fb('0xd')](handleError(_0x1544f2,null));};exports[_0xe7fb('0x29')]=function(_0x21e35c,_0x4d6fe6){return respondWithRpcPromise(_0xe7fb('0x2a'),_0x21e35c[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x4d6fe6,null))[_0xe7fb('0xd')](handleError(_0x4d6fe6,null));};exports['agents']=function(_0x3426a9,_0x186418){var _0xd472d;return respondWithRpcPromise(_0xe7fb('0x2b'),_0x3426a9['query'])[_0xe7fb('0x1a')](function(_0x451a6c){_0xd472d=_0x451a6c;return respondWithRpcPromise(_0xe7fb('0x2b'),_0x3426a9[_0xe7fb('0x16')],routingClient);})[_0xe7fb('0x1a')](function(_0xb729fc){return _['merge']({},_0xb729fc,_0xd472d);})[_0xe7fb('0x1a')](respondWithResult(_0x186418,null))[_0xe7fb('0xd')](handleError(_0x186418,null));};exports[_0xe7fb('0x2c')]=function(_0x4b263d,_0x36a341){if(_0x4b263d[_0xe7fb('0x1f')]&&_0x4b263d['body']['interaction']&&_0x4b263d['user']&&_0x4b263d['user']['name']){for(var _0x900d67 in _0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')]){if(_0x4b263d['body'][_0xe7fb('0x2d')]['hasOwnProperty'](_0x900d67)){db[_0xe7fb('0x2e')][_0xe7fb('0x2f')]({'where':{'channel':_0x900d67,'membername':_0x4b263d['user'][_0xe7fb('0x11')],'type':_0xe7fb('0x30'),'exitAt':null,'uniqueid':_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67]&&_0x4b263d['body'][_0xe7fb('0x2d')][_0x900d67][_0xe7fb('0x31')]?{'$notIn':_0x4b263d[_0xe7fb('0x1f')]['interaction'][_0x900d67]}:{'$ne':null}}})[_0xe7fb('0x1a')](function(_0x6eb1ab){var _0x13b17f=moment()[_0xe7fb('0x32')](_0xe7fb('0x33'));for(var _0x5a1ce1=0x0,_0x2eb999=_0x6eb1ab['length'];_0x5a1ce1<_0x2eb999;_0x5a1ce1+=0x1){_0x6eb1ab[_0x5a1ce1][_0xe7fb('0x34')]({'exitAt':_0x13b17f});}});for(var _0x468c62=0x0;_0x468c62<_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67][_0xe7fb('0x31')];_0x468c62+=0x1){db['MemberReport'][_0xe7fb('0x35')]({'where':{'channel':_0x900d67,'membername':_0x4b263d['user']['name'],'type':_0xe7fb('0x30'),'uniqueid':_0x4b263d[_0xe7fb('0x1f')][_0xe7fb('0x2d')][_0x900d67][_0x468c62],'exitAt':null},'defaults':{'channel':_0x900d67,'membername':_0x4b263d['user'][_0xe7fb('0x11')],'interface':_[_0xe7fb('0x13')](_0x4b263d['user']['interface'])?util[_0xe7fb('0x32')](_0xe7fb('0x36'),_0x4b263d[_0xe7fb('0x37')][_0xe7fb('0x11')]):_0x4b263d[_0xe7fb('0x37')][_0xe7fb('0x38')],'type':_0xe7fb('0x30'),'enterAt':moment()[_0xe7fb('0x32')]('YYYY-MM-DD\x20HH:mm:ss'),'role':_0xe7fb('0x39'),'internal':_0x4b263d['user'][_0xe7fb('0x3a')],'uniqueid':_0x4b263d[_0xe7fb('0x1f')]['interaction'][_0x900d67][_0x468c62]}});}}}}return respondWithRpcPromise(_0xe7fb('0x3b'),{'id':_0x4b263d['params']['id'],'capacity':_0x4b263d[_0xe7fb('0x1f')]['capacity']},routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x36a341,null))['catch'](handleError(_0x36a341,null));};exports[_0xe7fb('0x3c')]=function(_0x59158c,_0x1fff6c){return respondWithRpcPromise(_0xe7fb('0x3d'),_0x59158c[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x1fff6c,null))[_0xe7fb('0xd')](handleError(_0x1fff6c,null));};exports[_0xe7fb('0x3e')]=function(_0x2f4760,_0x582a4a){return respondWithRpcPromise('Trunks',_0x2f4760[_0xe7fb('0x16')])['then'](respondWithResult(_0x582a4a,null))['catch'](handleError(_0x582a4a,null));};exports['campaigns']=function(_0x50b8df,_0x539252){return respondWithRpcPromise(_0xe7fb('0x3f'),_0x50b8df[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0x539252,null))[_0xe7fb('0xd')](handleError(_0x539252,null));};exports['chatQueues']=function(_0x37af37,_0x236b35){return respondWithRpcPromise(_0xe7fb('0x40'),_0x37af37['query'],routingClient)['then'](respondWithResult(_0x236b35,null))[_0xe7fb('0xd')](handleError(_0x236b35,null));};exports[_0xe7fb('0x41')]=function(_0x300b8e,_0x4f4ba3){return respondWithRpcPromise(_0xe7fb('0x40'),_0x300b8e[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x300b8e[_0xe7fb('0x19')]['id']))['then'](respondWithResult(_0x4f4ba3,null))['catch'](handleError(_0x4f4ba3,null));};exports[_0xe7fb('0x42')]=function(_0x3104c2,_0x1f16b2){return respondWithRpcPromise(_0xe7fb('0x43'),_0x3104c2[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0x1f16b2,null))[_0xe7fb('0xd')](handleError(_0x1f16b2,null));};exports[_0xe7fb('0x44')]=function(_0x23755b,_0x590d7a){return respondWithRpcPromise('MailQueues',_0x23755b[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x23755b[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x590d7a,null))[_0xe7fb('0xd')](handleError(_0x590d7a,null));};exports[_0xe7fb('0x45')]=function(_0x585b7c,_0x1e21e4){return respondWithRpcPromise(_0xe7fb('0x46'),_0x585b7c[_0xe7fb('0x16')],mailClient)[_0xe7fb('0x1a')](respondWithResult(_0x1e21e4,null))[_0xe7fb('0xd')](handleError(_0x1e21e4,null));};exports[_0xe7fb('0x47')]=function(_0x554092,_0x2e457c){return respondWithRpcPromise('OpenchannelQueues',_0x554092[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x2e457c,null))[_0xe7fb('0xd')](handleError(_0x2e457c,null));};exports[_0xe7fb('0x48')]=function(_0x5925e6,_0x47ac92){return respondWithRpcPromise(_0xe7fb('0x49'),_0x5925e6[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x5925e6[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x47ac92,null))['catch'](handleError(_0x47ac92,null));};exports[_0xe7fb('0x4a')]=function(_0x58d4ec,_0x127b0e){return respondWithRpcPromise('SmsQueues',_0x58d4ec['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x127b0e,null))[_0xe7fb('0xd')](handleError(_0x127b0e,null));};exports[_0xe7fb('0x4b')]=function(_0x5da884,_0x475716){return respondWithRpcPromise(_0xe7fb('0x4c'),_0x5da884[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x5da884[_0xe7fb('0x19')]['id']))['then'](respondWithResult(_0x475716,null))[_0xe7fb('0xd')](handleError(_0x475716,null));};exports[_0xe7fb('0x4d')]=function(_0x5151ec,_0x4136ae){return respondWithRpcPromise(_0xe7fb('0x4e'),_0x5151ec['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x4136ae,null))['catch'](handleError(_0x4136ae,null));};exports[_0xe7fb('0x4f')]=function(_0x1dc9c1,_0xa93f35){return respondWithRpcPromise('WhatsappQueues',_0x1dc9c1[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x1dc9c1[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0xa93f35,null))[_0xe7fb('0xd')](handleError(_0xa93f35,null));};exports[_0xe7fb('0x50')]=function(_0xcdc72e,_0x187040){return respondWithRpcPromise('FaxQueues',_0xcdc72e['query'],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x187040,null))[_0xe7fb('0xd')](handleError(_0x187040,null));};exports[_0xe7fb('0x51')]=function(_0x50c705,_0x519c5f){return respondWithRpcPromise(_0xe7fb('0x52'),_0x50c705[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](findById(_0x50c705[_0xe7fb('0x19')]['id']))[_0xe7fb('0x1a')](respondWithResult(_0x519c5f,null))[_0xe7fb('0xd')](handleError(_0x519c5f,null));};exports[_0xe7fb('0x53')]=function(_0x3f11f1,_0xb06693){return respondWithRpcPromise(_0xe7fb('0x54'),_0x3f11f1[_0xe7fb('0x16')])[_0xe7fb('0x1a')](respondWithResult(_0xb06693,null))[_0xe7fb('0xd')](handleError(_0xb06693,null));};exports['chatQueuesWaitingInteractions']=function(_0x4fa142,_0x125427){return respondWithRpcPromise(_0xe7fb('0x55'),_0x4fa142[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x125427,null))[_0xe7fb('0xd')](handleError(_0x125427,null));};exports['mailQueuesWaitingInteractions']=function(_0x43f14b,_0x1beb13){return respondWithRpcPromise(_0xe7fb('0x56'),_0x43f14b[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x1beb13,null))[_0xe7fb('0xd')](handleError(_0x1beb13,null));};exports[_0xe7fb('0x57')]=function(_0x1e6256,_0xa7fa61){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x1e6256[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0xa7fa61,null))[_0xe7fb('0xd')](handleError(_0xa7fa61,null));};exports[_0xe7fb('0x58')]=function(_0x2a2079,_0x31c159){return respondWithRpcPromise(_0xe7fb('0x59'),_0x2a2079['query'],routingClient)[_0xe7fb('0x1a')](function(_0x38e66a){if(_0x2a2079[_0xe7fb('0x16')][_0xe7fb('0x5a')]!==undefined){var _0x15d881=_(_0x38e66a[_0xe7fb('0x5b')])[_0xe7fb('0x5c')]([_0x2a2079[_0xe7fb('0x16')][_0xe7fb('0x5a')],_0x2a2079[_0xe7fb('0x19')]['id']])[_0xe7fb('0x5d')](_0xe7fb('0x5e'))[_0xe7fb('0x5f')]()[_0xe7fb('0x60')]();return _0x38e66a['rows']['filter'](function(_0x48a015){return _0x15d881[_0xe7fb('0x61')](_0x48a015[_0xe7fb('0x5e')])>-0x1;});}else{return _0x38e66a[_0xe7fb('0x5b')][_0xe7fb('0x5c')](function(_0x535e8b){return _0x535e8b[_0xe7fb('0x5e')]===parseInt(_0x2a2079[_0xe7fb('0x19')]['id']);});}})[_0xe7fb('0x1a')](respondWithResult(_0x31c159,null))[_0xe7fb('0xd')](handleError(_0x31c159,null));};exports['smsQueuesWaitingInteractions']=function(_0x2f7fa6,_0x5650c6){return respondWithRpcPromise(_0xe7fb('0x62'),_0x2f7fa6[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x5650c6,null))[_0xe7fb('0xd')](handleError(_0x5650c6,null));};exports[_0xe7fb('0x63')]=function(_0x4ab541,_0x3ffd6c){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0x4ab541[_0xe7fb('0x16')],routingClient)['then'](respondWithResult(_0x3ffd6c,null))[_0xe7fb('0xd')](handleError(_0x3ffd6c,null));};exports[_0xe7fb('0x64')]=function(_0x4c37cd,_0x2b6d69){return respondWithRpcPromise(_0xe7fb('0x65'),_0x4c37cd[_0xe7fb('0x16')],routingClient)[_0xe7fb('0x1a')](respondWithResult(_0x2b6d69,null))['catch'](handleError(_0x2b6d69,null));};exports[_0xe7fb('0x66')]=function(_0x277335){return function(_0x1412e2,_0x4d0eed){var _0x11d5b6,_0x4b2cc4;var _0x5b1e28=_['capitalize'](_0x277335);var _0x3c99e7=_0x277335===_0xe7fb('0x67')?'Website':_0xe7fb('0x68');return db[_0x5b1e28+_0xe7fb('0x69')][_0xe7fb('0x6a')]({'raw':!![],'where':{'id':_0x1412e2[_0xe7fb('0x19')]['id']}})[_0xe7fb('0x1a')](function(_0x1cc21d){if(_[_0xe7fb('0x13')](_0x1cc21d)){throw new Error(_0x5b1e28+_0xe7fb('0x6b'));}_0x11d5b6=_0x1cc21d;return db[_0x5b1e28+_0xe7fb('0x6c')][_0xe7fb('0x6a')]({'where':{'id':_0x1412e2[_0xe7fb('0x1f')][_0xe7fb('0x6d')]},'include':[{'model':db[_0x5b1e28+_0xe7fb('0x6e')],'as':_0xe7fb('0x6e')},{'model':db[_0x5b1e28+_0x3c99e7],'as':_0xe7fb('0x68')}]});})[_0xe7fb('0x1a')](function(_0x3c5bd9){if(_[_0xe7fb('0x13')](_0x3c5bd9)){throw new Error(_0x5b1e28+_0xe7fb('0x6f'));}_0x4b2cc4=_0x3c5bd9;return _0x3c5bd9[_0xe7fb('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x47568c={'uniqueid':_0x277335+'.'+_0x4b2cc4['id']+'.'+_0x4b2cc4[_0xe7fb('0x6e')]['id'],'FromUserId':_0x1412e2[_0xe7fb('0x37')]['id'],'type':_0xe7fb('0x71')};_0x47568c[_0x5b1e28+_0xe7fb('0x72')]=_0x4b2cc4['id'];_0x47568c[_0x5b1e28+_0xe7fb('0x73')]=_0x4b2cc4[_0xe7fb('0x6e')]['id'];_0x47568c['From'+_0x5b1e28+_0x3c99e7+'Id']=_0x4b2cc4['Account']['id'];_0x47568c['To'+_0x5b1e28+_0xe7fb('0x74')]=_0x11d5b6['id'];return db[_0x5b1e28+'TransferReport'][_0xe7fb('0x75')](_0x47568c);})[_0xe7fb('0x1a')](function(){return respondWithRpcPromise('Start',{'channel':_0x277335,'interaction':_0x4b2cc4[_0xe7fb('0x6e')],'message':_0x4b2cc4,'account':_0x4b2cc4[_0xe7fb('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7fb('0x71'),'appdata':_0x11d5b6[_0xe7fb('0x11')]+','+(_0x4b2cc4[_0xe7fb('0x68')][_0xe7fb('0x76')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0xe7fb('0x1a')](respondWithResult(_0x4d0eed,null))[_0xe7fb('0xd')](handleError(_0x4d0eed,null));};};exports[_0xe7fb('0x77')]=function(_0xae9441,_0x276c28){var _0xd5a417,_0x48de0c;if(_['isNil'](_0xae9441['body'][_0xe7fb('0x78')])){throw new Error(_0xe7fb('0x79'));}var _0x2b0600=_0xae9441['body'][_0xe7fb('0x78')];var _0x57ee3b=_[_0xe7fb('0x7a')](_0x2b0600);var _0x278a6c=_0x2b0600===_0xe7fb('0x67')?_0xe7fb('0x7b'):'Account';return db[_0xe7fb('0x7c')][_0xe7fb('0x6a')]({'raw':!![],'where':{'id':_0xae9441[_0xe7fb('0x19')]['id'],'role':_0xe7fb('0x39')}})[_0xe7fb('0x1a')](function(_0x33262f){if(_[_0xe7fb('0x13')](_0x33262f)){throw new Error(_0xe7fb('0x7d'));}_0xd5a417=_0x33262f;return db[_0x57ee3b+'Message']['findOne']({'where':{'id':_0xae9441[_0xe7fb('0x1f')]['messageId']},'include':[{'model':db[_0x57ee3b+_0xe7fb('0x6e')],'as':_0xe7fb('0x6e')},{'model':db[_0x57ee3b+_0x278a6c],'as':_0xe7fb('0x68')}]});})[_0xe7fb('0x1a')](function(_0x58352d){if(_['isNil'](_0x58352d)){throw new Error(_0x57ee3b+_0xe7fb('0x6f'));}_0x48de0c=_0x58352d;return _0x58352d[_0xe7fb('0x70')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x21cb12={'uniqueid':_0x2b0600+'.'+_0x48de0c['id']+'.'+_0x48de0c[_0xe7fb('0x6e')]['id'],'FromUserId':_0xae9441[_0xe7fb('0x37')]['id'],'type':_0xe7fb('0x71'),'ToUserId':_0xd5a417['id']};_0x21cb12[_0x57ee3b+_0xe7fb('0x72')]=_0x48de0c['id'];_0x21cb12[_0x57ee3b+_0xe7fb('0x73')]=_0x48de0c['Interaction']['id'];_0x21cb12[_0xe7fb('0x7e')+_0x57ee3b+_0x278a6c+'Id']=_0x48de0c[_0xe7fb('0x68')]['id'];return db[_0x57ee3b+_0xe7fb('0x7f')][_0xe7fb('0x75')](_0x21cb12);})[_0xe7fb('0x1a')](function(){return respondWithRpcPromise(_0xe7fb('0x80'),{'channel':_0x2b0600,'interaction':_0x48de0c[_0xe7fb('0x6e')],'message':_0x48de0c,'account':_0x48de0c[_0xe7fb('0x68')],'applications':[{'id':0x0,'priority':0x1,'app':_0xe7fb('0x39'),'appdata':_0xd5a417[_0xe7fb('0x11')]+','+(_0x48de0c[_0xe7fb('0x68')][_0xe7fb('0x81')]||0x12c),'interval':_0xe7fb('0x82')}]},routingClient);})[_0xe7fb('0x1a')](respondWithResult(_0x276c28,null))[_0xe7fb('0xd')](handleError(_0x276c28,null));}; \ No newline at end of file +var _0xb138=['telephones','Telephones','campaigns','Campaigns','chatQueues','ChatQueues','showChatQueues','mailQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues','showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','showWhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','filter','map','queue_id','uniq','value','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','messageId','Interaction','update','queue','MessageId','InteractionId','From','QueueId','create','Start','queueTransferTimeout','*,*,*,*','Channel\x20field\x20is\x20mandatory','channel','capitalize','User','agent','Agent\x20not\x20found','Message','\x20Message\x20not\x20found','agentTransferTimeout','bluebird','moment','lodash','util','../../mysqldb','../../config/logger','api','client','http','request','error','code','message','result','catch','json','sendStatus','stack','name','status','isNil','rows','find','VoiceChannels','query','then','VoiceChannelMixMonitor','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','VoiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','VoiceQueuesChannel','voiceQueuesChannelHangup','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','Agents','interaction','user','hasOwnProperty','MemberReport','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','findOrCreate','INTERACTION','SIP/%s','interface','internal','AgentCapacity','capacity'];(function(_0x8ea25d,_0x3c7c32){var _0xbb429e=function(_0x4c0056){while(--_0x4c0056){_0x8ea25d['push'](_0x8ea25d['shift']());}};_0xbb429e(++_0x3c7c32);}(_0xb138,0x1dd));var _0x8b13=function(_0x597883,_0x5e547){_0x597883=_0x597883-0x0;var _0x108601=_0xb138[_0x597883];return _0x108601;};'use strict';var BPromise=require(_0x8b13('0x0'));var moment=require(_0x8b13('0x1'));var _=require(_0x8b13('0x2'));var util=require(_0x8b13('0x3'));var db=require(_0x8b13('0x4'))['db'];var logger=require(_0x8b13('0x5'))(_0x8b13('0x6'));var jayson=require('jayson/promise');var amiClient=jayson[_0x8b13('0x7')][_0x8b13('0x8')]({'port':0x232a});var mailClient=jayson[_0x8b13('0x7')]['http']({'port':0x232b});var routingClient=jayson[_0x8b13('0x7')][_0x8b13('0x8')]({'port':0x232c});function respondWithRpcPromise(_0x5d51b1,_0x3fdf4d,_0x33d1a7){return new BPromise(function(_0x22e157,_0x498832){var _0x8570b0=_0x33d1a7?_0x33d1a7:amiClient;return _0x8570b0[_0x8b13('0x9')](_0x5d51b1,_0x3fdf4d)['then'](function(_0x53ae50){if(_0x53ae50[_0x8b13('0xa')]){if(_0x53ae50[_0x8b13('0xa')][_0x8b13('0xb')]===0x1f4){return _0x498832(_0x53ae50[_0x8b13('0xa')][_0x8b13('0xc')]);}return _0x22e157(_0x53ae50['error'][_0x8b13('0xc')]);}else{_0x22e157(_0x53ae50[_0x8b13('0xd')]);}})[_0x8b13('0xe')](function(_0x3f79d5){_0x498832(_0x3f79d5);});});}function respondWithResult(_0xb227e0,_0x1893b1){_0x1893b1=_0x1893b1||0xc8;return function(_0x58f97e){if(_0x58f97e){return _0xb227e0['status'](_0x1893b1)[_0x8b13('0xf')](_0x58f97e);}return _0xb227e0[_0x8b13('0x10')](0x194);};}function handleError(_0x5f12b5,_0x51a935){_0x51a935=_0x51a935||0x1f4;return function(_0x479773){logger[_0x8b13('0xa')](_0x479773[_0x8b13('0x11')]);if(_0x479773[_0x8b13('0x12')]){delete _0x479773[_0x8b13('0x12')];}_0x5f12b5[_0x8b13('0x13')](_0x51a935)['send'](_0x479773);};}function findById(_0x1c6c99){return function(_0xea7881){if(!_[_0x8b13('0x14')](_0x1c6c99)&&!_[_0x8b13('0x14')](_0xea7881)&&!_[_0x8b13('0x14')](_0xea7881[_0x8b13('0x15')])){return _[_0x8b13('0x16')](_0xea7881[_0x8b13('0x15')],function(_0x4989d3){return _0x4989d3['id']==_0x1c6c99;});}return null;};}exports['voiceChannels']=function(_0xae4966,_0x335709){return respondWithRpcPromise(_0x8b13('0x17'),_0xae4966[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x335709,null))[_0x8b13('0xe')](handleError(_0x335709,null));};exports['voiceChannelMixMonitor']=function(_0x1e8a48,_0x3c4d4f){return respondWithRpcPromise(_0x8b13('0x1a'),_['merge'](_0x1e8a48['query'],_0x1e8a48[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x3c4d4f,null))['catch'](handleError(_0x3c4d4f,null));};exports[_0x8b13('0x1c')]=function(_0x2c3afb,_0x37ca5f){return respondWithRpcPromise(_0x8b13('0x1d'),_[_0x8b13('0x1e')](_0x2c3afb['query'],_0x2c3afb[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x37ca5f,null))['catch'](handleError(_0x37ca5f,null));};exports[_0x8b13('0x1f')]=function(_0x4fdd1c,_0x420772){return respondWithRpcPromise(_0x8b13('0x20'),_0x4fdd1c['query'])[_0x8b13('0x19')](respondWithResult(_0x420772,null))[_0x8b13('0xe')](handleError(_0x420772,null));};exports['showVoiceQueues']=function(_0x134c5e,_0x14a739){return respondWithRpcPromise(_0x8b13('0x20'),_0x134c5e[_0x8b13('0x18')])[_0x8b13('0x19')](findById(_0x134c5e['params']['id']))[_0x8b13('0x19')](respondWithResult(_0x14a739,null))[_0x8b13('0xe')](handleError(_0x14a739,null));};exports[_0x8b13('0x21')]=function(_0x1511bf,_0x114b01){return respondWithRpcPromise(_0x8b13('0x22'),_['merge'](_0x1511bf[_0x8b13('0x23')],_0x1511bf[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x114b01,null))[_0x8b13('0xe')](handleError(_0x114b01,null));};exports[_0x8b13('0x24')]=function(_0x29946e,_0x3304bd){return respondWithRpcPromise(_0x8b13('0x25'),_[_0x8b13('0x1e')](_0x29946e['query'],_0x29946e[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x3304bd,null))[_0x8b13('0xe')](handleError(_0x3304bd,null));};exports[_0x8b13('0x26')]=function(_0x51a334,_0x4f7d91){return respondWithRpcPromise(_0x8b13('0x27'),_0x51a334['query'])['then'](respondWithResult(_0x4f7d91,null))[_0x8b13('0xe')](handleError(_0x4f7d91,null));};exports['voiceQueuesChannel']=function(_0x2ec1ab,_0x408626){return respondWithRpcPromise(_0x8b13('0x28'),_[_0x8b13('0x1e')](_0x2ec1ab[_0x8b13('0x18')],_0x2ec1ab[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x408626,null))[_0x8b13('0xe')](handleError(_0x408626,null));};exports[_0x8b13('0x29')]=function(_0x1b313d,_0x4d45bc){return respondWithRpcPromise(_0x8b13('0x2a'),_[_0x8b13('0x1e')](_0x1b313d[_0x8b13('0x18')],_0x1b313d[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x4d45bc,null))[_0x8b13('0xe')](handleError(_0x4d45bc,null));};exports[_0x8b13('0x2b')]=function(_0x241687,_0x5c67b1){return respondWithRpcPromise(_0x8b13('0x2c'),_['merge'](_0x241687[_0x8b13('0x18')],_0x241687[_0x8b13('0x1b')]))[_0x8b13('0x19')](respondWithResult(_0x5c67b1,null))[_0x8b13('0xe')](handleError(_0x5c67b1,null));};exports[_0x8b13('0x2d')]=function(_0x327eb1,_0x4ec1a5){return respondWithRpcPromise('Outbound',_0x327eb1[_0x8b13('0x18')])['then'](respondWithResult(_0x4ec1a5,null))[_0x8b13('0xe')](handleError(_0x4ec1a5,null));};exports['outboundChannels']=function(_0x590a23,_0x3a8e06){return respondWithRpcPromise(_0x8b13('0x2e'),_0x590a23[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x3a8e06,null))['catch'](handleError(_0x3a8e06,null));};exports['agents']=function(_0x230a8c,_0x595d8d){var _0x6ba2f3;return respondWithRpcPromise(_0x8b13('0x2f'),_0x230a8c['query'])[_0x8b13('0x19')](function(_0x41d710){_0x6ba2f3=_0x41d710;return respondWithRpcPromise(_0x8b13('0x2f'),_0x230a8c[_0x8b13('0x18')],routingClient);})[_0x8b13('0x19')](function(_0x38ec75){return _[_0x8b13('0x1e')]({},_0x38ec75,_0x6ba2f3);})['then'](respondWithResult(_0x595d8d,null))['catch'](handleError(_0x595d8d,null));};exports['agentCapacity']=function(_0x3eb3c5,_0x16ec3){if(_0x3eb3c5[_0x8b13('0x23')]&&_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')]&&_0x3eb3c5[_0x8b13('0x31')]&&_0x3eb3c5['user'][_0x8b13('0x12')]){for(var _0x50e535 in _0x3eb3c5[_0x8b13('0x23')]['interaction']){if(_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x8b13('0x32')](_0x50e535)){db[_0x8b13('0x33')][_0x8b13('0x34')]({'where':{'channel':_0x50e535,'membername':_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x12')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x3eb3c5['body']['interaction'][_0x50e535]&&_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x50e535][_0x8b13('0x35')]?{'$notIn':_0x3eb3c5[_0x8b13('0x23')]['interaction'][_0x50e535]}:{'$ne':null}}})['then'](function(_0x3f420d){var _0x54d19d=moment()[_0x8b13('0x36')](_0x8b13('0x37'));for(var _0x20c363=0x0,_0x28ae75=_0x3f420d[_0x8b13('0x35')];_0x20c363<_0x28ae75;_0x20c363+=0x1){_0x3f420d[_0x20c363]['updateAttributes']({'exitAt':_0x54d19d});}});for(var _0x2df766=0x0;_0x2df766<_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x50e535][_0x8b13('0x35')];_0x2df766+=0x1){db[_0x8b13('0x33')][_0x8b13('0x38')]({'where':{'channel':_0x50e535,'membername':_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x12')],'type':_0x8b13('0x39'),'uniqueid':_0x3eb3c5['body'][_0x8b13('0x30')][_0x50e535][_0x2df766],'exitAt':null},'defaults':{'channel':_0x50e535,'membername':_0x3eb3c5['user'][_0x8b13('0x12')],'interface':_[_0x8b13('0x14')](_0x3eb3c5[_0x8b13('0x31')]['interface'])?util[_0x8b13('0x36')](_0x8b13('0x3a'),_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x12')]):_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x3b')],'type':_0x8b13('0x39'),'enterAt':moment()['format'](_0x8b13('0x37')),'role':'agent','internal':_0x3eb3c5[_0x8b13('0x31')][_0x8b13('0x3c')],'uniqueid':_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x30')][_0x50e535][_0x2df766]}});}}}}return respondWithRpcPromise(_0x8b13('0x3d'),{'id':_0x3eb3c5[_0x8b13('0x1b')]['id'],'capacity':_0x3eb3c5[_0x8b13('0x23')][_0x8b13('0x3e')]},routingClient)[_0x8b13('0x19')](respondWithResult(_0x16ec3,null))[_0x8b13('0xe')](handleError(_0x16ec3,null));};exports[_0x8b13('0x3f')]=function(_0xddac8e,_0xd55f3b){return respondWithRpcPromise(_0x8b13('0x40'),_0xddac8e[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0xd55f3b,null))[_0x8b13('0xe')](handleError(_0xd55f3b,null));};exports['trunks']=function(_0x1699c6,_0x20e89c){return respondWithRpcPromise('Trunks',_0x1699c6[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x20e89c,null))[_0x8b13('0xe')](handleError(_0x20e89c,null));};exports[_0x8b13('0x41')]=function(_0x25cb45,_0x12549b){return respondWithRpcPromise(_0x8b13('0x42'),_0x25cb45[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x12549b,null))[_0x8b13('0xe')](handleError(_0x12549b,null));};exports[_0x8b13('0x43')]=function(_0x450b47,_0x137e8c){return respondWithRpcPromise(_0x8b13('0x44'),_0x450b47[_0x8b13('0x18')],routingClient)['then'](respondWithResult(_0x137e8c,null))[_0x8b13('0xe')](handleError(_0x137e8c,null));};exports[_0x8b13('0x45')]=function(_0x47a3fa,_0x11e8af){return respondWithRpcPromise(_0x8b13('0x44'),_0x47a3fa[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](findById(_0x47a3fa[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x11e8af,null))[_0x8b13('0xe')](handleError(_0x11e8af,null));};exports[_0x8b13('0x46')]=function(_0x46850a,_0x52e2a6){return respondWithRpcPromise(_0x8b13('0x47'),_0x46850a[_0x8b13('0x18')],routingClient)['then'](respondWithResult(_0x52e2a6,null))[_0x8b13('0xe')](handleError(_0x52e2a6,null));};exports[_0x8b13('0x48')]=function(_0x475c8d,_0xd29067){return respondWithRpcPromise('MailQueues',_0x475c8d[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](findById(_0x475c8d['params']['id']))[_0x8b13('0x19')](respondWithResult(_0xd29067,null))[_0x8b13('0xe')](handleError(_0xd29067,null));};exports[_0x8b13('0x49')]=function(_0x23a63c,_0x5d05cb){return respondWithRpcPromise(_0x8b13('0x4a'),_0x23a63c[_0x8b13('0x18')],mailClient)[_0x8b13('0x19')](respondWithResult(_0x5d05cb,null))[_0x8b13('0xe')](handleError(_0x5d05cb,null));};exports[_0x8b13('0x4b')]=function(_0x2fff4e,_0x571e89){return respondWithRpcPromise(_0x8b13('0x4c'),_0x2fff4e[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x571e89,null))['catch'](handleError(_0x571e89,null));};exports[_0x8b13('0x4d')]=function(_0x576c91,_0x122ea2){return respondWithRpcPromise(_0x8b13('0x4c'),_0x576c91['query'],routingClient)['then'](findById(_0x576c91['params']['id']))['then'](respondWithResult(_0x122ea2,null))['catch'](handleError(_0x122ea2,null));};exports[_0x8b13('0x4e')]=function(_0x1bc936,_0x574f98){return respondWithRpcPromise(_0x8b13('0x4f'),_0x1bc936['query'],routingClient)[_0x8b13('0x19')](respondWithResult(_0x574f98,null))[_0x8b13('0xe')](handleError(_0x574f98,null));};exports[_0x8b13('0x50')]=function(_0x22c4d4,_0x43f12a){return respondWithRpcPromise(_0x8b13('0x4f'),_0x22c4d4[_0x8b13('0x18')],routingClient)['then'](findById(_0x22c4d4[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x43f12a,null))[_0x8b13('0xe')](handleError(_0x43f12a,null));};exports[_0x8b13('0x51')]=function(_0x207a54,_0x11a4ba){return respondWithRpcPromise(_0x8b13('0x52'),_0x207a54[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x11a4ba,null))['catch'](handleError(_0x11a4ba,null));};exports[_0x8b13('0x53')]=function(_0x5d1174,_0x2b109c){return respondWithRpcPromise(_0x8b13('0x52'),_0x5d1174[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](findById(_0x5d1174[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x2b109c,null))['catch'](handleError(_0x2b109c,null));};exports[_0x8b13('0x54')]=function(_0x37a243,_0x5ccf4e){return respondWithRpcPromise(_0x8b13('0x55'),_0x37a243[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x5ccf4e,null))['catch'](handleError(_0x5ccf4e,null));};exports[_0x8b13('0x56')]=function(_0x215a8a,_0x15ce51){return respondWithRpcPromise(_0x8b13('0x55'),_0x215a8a['query'],routingClient)[_0x8b13('0x19')](findById(_0x215a8a[_0x8b13('0x1b')]['id']))['then'](respondWithResult(_0x15ce51,null))[_0x8b13('0xe')](handleError(_0x15ce51,null));};exports[_0x8b13('0x57')]=function(_0x69e237,_0x3734e7){return respondWithRpcPromise(_0x8b13('0x58'),_0x69e237[_0x8b13('0x18')])[_0x8b13('0x19')](respondWithResult(_0x3734e7,null))[_0x8b13('0xe')](handleError(_0x3734e7,null));};exports[_0x8b13('0x59')]=function(_0x2cace0,_0x2f2bc5){return respondWithRpcPromise(_0x8b13('0x5a'),_0x2cace0[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x2f2bc5,null))['catch'](handleError(_0x2f2bc5,null));};exports[_0x8b13('0x5b')]=function(_0x578469,_0x14dee4){return respondWithRpcPromise(_0x8b13('0x5c'),_0x578469[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x14dee4,null))['catch'](handleError(_0x14dee4,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x27ad64,_0x2236b5){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x27ad64[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x2236b5,null))[_0x8b13('0xe')](handleError(_0x2236b5,null));};exports[_0x8b13('0x5d')]=function(_0x7499cb,_0x12aa48){return respondWithRpcPromise(_0x8b13('0x5e'),_0x7499cb[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](function(_0x24211c){if(_0x7499cb['query'][_0x8b13('0x5f')]!==undefined){var _0x2e7477=_(_0x24211c['rows'])[_0x8b13('0x60')]([_0x7499cb[_0x8b13('0x18')]['type'],_0x7499cb[_0x8b13('0x1b')]['id']])[_0x8b13('0x61')](_0x8b13('0x62'))[_0x8b13('0x63')]()[_0x8b13('0x64')]();return _0x24211c[_0x8b13('0x15')][_0x8b13('0x60')](function(_0x1fde8b){return _0x2e7477['indexOf'](_0x1fde8b[_0x8b13('0x62')])>-0x1;});}else{return _0x24211c[_0x8b13('0x15')][_0x8b13('0x60')](function(_0x5e2b4c){return _0x5e2b4c[_0x8b13('0x62')]===parseInt(_0x7499cb['params']['id']);});}})[_0x8b13('0x19')](respondWithResult(_0x12aa48,null))[_0x8b13('0xe')](handleError(_0x12aa48,null));};exports[_0x8b13('0x65')]=function(_0x40fefa,_0xc74525){return respondWithRpcPromise(_0x8b13('0x66'),_0x40fefa[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0xc74525,null))[_0x8b13('0xe')](handleError(_0xc74525,null));};exports[_0x8b13('0x67')]=function(_0x595f45,_0x3dc732){return respondWithRpcPromise(_0x8b13('0x68'),_0x595f45[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x3dc732,null))[_0x8b13('0xe')](handleError(_0x3dc732,null));};exports[_0x8b13('0x69')]=function(_0x2c69f5,_0x9173d){return respondWithRpcPromise(_0x8b13('0x6a'),_0x2c69f5[_0x8b13('0x18')],routingClient)[_0x8b13('0x19')](respondWithResult(_0x9173d,null))[_0x8b13('0xe')](handleError(_0x9173d,null));};exports[_0x8b13('0x6b')]=function(_0x4bb71a){return function(_0x491bf8,_0x3870a9){var _0x512f30,_0x22e10a;var _0x38a1de=_['capitalize'](_0x4bb71a);var _0x5319a1=_0x4bb71a===_0x8b13('0x6c')?_0x8b13('0x6d'):_0x8b13('0x6e');return db[_0x38a1de+_0x8b13('0x6f')][_0x8b13('0x70')]({'raw':!![],'where':{'id':_0x491bf8['params']['id']}})[_0x8b13('0x19')](function(_0x5152d0){if(_[_0x8b13('0x14')](_0x5152d0)){throw new Error(_0x38a1de+_0x8b13('0x71'));}_0x512f30=_0x5152d0;return db[_0x38a1de+'Message'][_0x8b13('0x70')]({'where':{'id':_0x491bf8[_0x8b13('0x23')][_0x8b13('0x72')]},'include':[{'model':db[_0x38a1de+_0x8b13('0x73')],'as':_0x8b13('0x73')},{'model':db[_0x38a1de+_0x5319a1],'as':'Account'}]});})[_0x8b13('0x19')](function(_0x202c12){if(_[_0x8b13('0x14')](_0x202c12)){throw new Error(_0x38a1de+'\x20Message\x20not\x20found');}_0x22e10a=_0x202c12;return _0x202c12[_0x8b13('0x74')]({'read':0x0,'readAt':null,'UserId':null});})['then'](function(){var _0x3bfb06={'uniqueid':_0x4bb71a+'.'+_0x22e10a['id']+'.'+_0x22e10a[_0x8b13('0x73')]['id'],'FromUserId':_0x491bf8[_0x8b13('0x31')]['id'],'type':_0x8b13('0x75')};_0x3bfb06[_0x38a1de+_0x8b13('0x76')]=_0x22e10a['id'];_0x3bfb06[_0x38a1de+_0x8b13('0x77')]=_0x22e10a[_0x8b13('0x73')]['id'];_0x3bfb06[_0x8b13('0x78')+_0x38a1de+_0x5319a1+'Id']=_0x22e10a[_0x8b13('0x6e')]['id'];_0x3bfb06['To'+_0x38a1de+_0x8b13('0x79')]=_0x512f30['id'];return db[_0x38a1de+'TransferReport'][_0x8b13('0x7a')](_0x3bfb06);})[_0x8b13('0x19')](function(){return respondWithRpcPromise(_0x8b13('0x7b'),{'channel':_0x4bb71a,'interaction':_0x22e10a[_0x8b13('0x73')],'message':_0x22e10a,'account':_0x22e10a[_0x8b13('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x512f30[_0x8b13('0x12')]+','+(_0x22e10a[_0x8b13('0x6e')][_0x8b13('0x7c')]||0x12c),'interval':_0x8b13('0x7d')}]},routingClient);})[_0x8b13('0x19')](respondWithResult(_0x3870a9,null))[_0x8b13('0xe')](handleError(_0x3870a9,null));};};exports['agentNotify']=function(_0x24005e,_0xd2b08b){var _0x556a92,_0x1b3a1b;if(_['isNil'](_0x24005e[_0x8b13('0x23')]['channel'])){throw new Error(_0x8b13('0x7e'));}var _0x291a30=_0x24005e[_0x8b13('0x23')][_0x8b13('0x7f')];var _0x13a7ea=_[_0x8b13('0x80')](_0x291a30);var _0x165813=_0x291a30===_0x8b13('0x6c')?'Website':_0x8b13('0x6e');return db[_0x8b13('0x81')]['findOne']({'raw':!![],'where':{'id':_0x24005e[_0x8b13('0x1b')]['id'],'role':_0x8b13('0x82')}})['then'](function(_0xa97f27){if(_[_0x8b13('0x14')](_0xa97f27)){throw new Error(_0x8b13('0x83'));}_0x556a92=_0xa97f27;return db[_0x13a7ea+_0x8b13('0x84')][_0x8b13('0x70')]({'where':{'id':_0x24005e['body']['messageId']},'include':[{'model':db[_0x13a7ea+_0x8b13('0x73')],'as':_0x8b13('0x73')},{'model':db[_0x13a7ea+_0x165813],'as':_0x8b13('0x6e')}]});})[_0x8b13('0x19')](function(_0xcafeff){if(_[_0x8b13('0x14')](_0xcafeff)){throw new Error(_0x13a7ea+_0x8b13('0x85'));}_0x1b3a1b=_0xcafeff;return _0xcafeff[_0x8b13('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0x8b13('0x19')](function(){var _0xfac180={'uniqueid':_0x291a30+'.'+_0x1b3a1b['id']+'.'+_0x1b3a1b[_0x8b13('0x73')]['id'],'FromUserId':_0x24005e[_0x8b13('0x31')]['id'],'type':_0x8b13('0x75'),'ToUserId':_0x556a92['id']};_0xfac180[_0x13a7ea+_0x8b13('0x76')]=_0x1b3a1b['id'];_0xfac180[_0x13a7ea+_0x8b13('0x77')]=_0x1b3a1b[_0x8b13('0x73')]['id'];_0xfac180['From'+_0x13a7ea+_0x165813+'Id']=_0x1b3a1b[_0x8b13('0x6e')]['id'];return db[_0x13a7ea+'TransferReport'][_0x8b13('0x7a')](_0xfac180);})[_0x8b13('0x19')](function(){return respondWithRpcPromise(_0x8b13('0x7b'),{'channel':_0x291a30,'interaction':_0x1b3a1b[_0x8b13('0x73')],'message':_0x1b3a1b,'account':_0x1b3a1b[_0x8b13('0x6e')],'applications':[{'id':0x0,'priority':0x1,'app':_0x8b13('0x82'),'appdata':_0x556a92[_0x8b13('0x12')]+','+(_0x1b3a1b['Account'][_0x8b13('0x86')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x8b13('0x19')](respondWithResult(_0xd2b08b,null))[_0x8b13('0xe')](handleError(_0xd2b08b,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 13ddf5c..c831604 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 _0xf382=['create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./schedule.controller','get','index','/:id','isAuthenticated','show','/:id/run','run'];(function(_0x416ae3,_0x2f468e){var _0x1dd03b=function(_0x5337d0){while(--_0x5337d0){_0x416ae3['push'](_0x416ae3['shift']());}};_0x1dd03b(++_0x2f468e);}(_0xf382,0xe1));var _0x2f38=function(_0x534725,_0x309ea9){_0x534725=_0x534725-0x0;var _0x537a74=_0xf382[_0x534725];return _0x537a74;};'use strict';var multer=require(_0x2f38('0x0'));var util=require(_0x2f38('0x1'));var path=require(_0x2f38('0x2'));var timeout=require(_0x2f38('0x3'));var express=require('express');var router=express[_0x2f38('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2f38('0x5'));var config=require(_0x2f38('0x6'));var controller=require(_0x2f38('0x7'));router[_0x2f38('0x8')]('/',auth['isAuthenticated'](),controller[_0x2f38('0x9')]);router[_0x2f38('0x8')](_0x2f38('0xa'),auth[_0x2f38('0xb')](),controller[_0x2f38('0xc')]);router[_0x2f38('0x8')](_0x2f38('0xd'),auth[_0x2f38('0xb')](),controller[_0x2f38('0xe')]);router['post']('/',auth[_0x2f38('0xb')](),controller[_0x2f38('0xf')]);router[_0x2f38('0x10')](_0x2f38('0xa'),auth['isAuthenticated'](),controller[_0x2f38('0x11')]);router[_0x2f38('0x12')](_0x2f38('0xa'),auth[_0x2f38('0xb')](),controller[_0x2f38('0x13')]);module['exports']=router; \ No newline at end of file +var _0xcb7e=['/:id','isAuthenticated','show','get','/:id/run','run','post','create','put','update','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./schedule.controller','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xcb7e,0xa6));var _0xecb7=function(_0x41746f,_0x1076e6){_0x41746f=_0x41746f-0x0;var _0x1b590b=_0xcb7e[_0x41746f];return _0x1b590b;};'use strict';var multer=require(_0xecb7('0x0'));var util=require(_0xecb7('0x1'));var path=require(_0xecb7('0x2'));var timeout=require(_0xecb7('0x3'));var express=require(_0xecb7('0x4'));var router=express['Router']();var fs_extra=require(_0xecb7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xecb7('0x6'));var config=require(_0xecb7('0x7'));var controller=require(_0xecb7('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xecb7('0x9')]);router['get'](_0xecb7('0xa'),auth[_0xecb7('0xb')](),controller[_0xecb7('0xc')]);router[_0xecb7('0xd')](_0xecb7('0xe'),auth[_0xecb7('0xb')](),controller[_0xecb7('0xf')]);router[_0xecb7('0x10')]('/',auth[_0xecb7('0xb')](),controller[_0xecb7('0x11')]);router[_0xecb7('0x12')](_0xecb7('0xa'),auth[_0xecb7('0xb')](),controller[_0xecb7('0x13')]);router[_0xecb7('0x14')](_0xecb7('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0xecb7('0x15')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index 7c07306..671fa2e 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 _0x5f0e=['pdf','xlsx','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','weeks','days','csv'];(function(_0x307978,_0x5b0f33){var _0x5765ad=function(_0x13bc23){while(--_0x13bc23){_0x307978['push'](_0x307978['shift']());}};_0x5765ad(++_0x5b0f33);}(_0x5f0e,0x104));var _0xe5f0=function(_0x5a8d98,_0x42b10e){_0x5a8d98=_0x5a8d98-0x0;var _0x511624=_0x5f0e[_0x5a8d98];return _0x511624;};'use strict';var Sequelize=require(_0xe5f0('0x0'));module[_0xe5f0('0x1')]={'name':{'type':Sequelize[_0xe5f0('0x2')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xe5f0('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xe5f0('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0xe5f0('0x4')],'allowNull':![]},'endAt':{'type':Sequelize[_0xe5f0('0x4')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xe5f0('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xe5f0('0x6')](_0xe5f0('0x7'),_0xe5f0('0x8'),'months',_0xe5f0('0x9'),'days','hours','minutes'),'allowNull':![],'defaultValue':_0xe5f0('0xa')},'output':{'type':Sequelize[_0xe5f0('0x6')](_0xe5f0('0xb'),_0xe5f0('0xc'),_0xe5f0('0xd')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0xe5f0('0x6')](_0xe5f0('0xe'),'default'),'allowNull':![],'defaultValue':_0xe5f0('0xe')},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0xe5f0('0x2')]},'cc':{'type':Sequelize[_0xe5f0('0xf')]},'bcc':{'type':Sequelize[_0xe5f0('0xf')]},'sendIfEmpty':{'type':Sequelize[_0xe5f0('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf3c4=['pdf','xlsx','default','custom','TEXT','sequelize','exports','STRING','BOOLEAN','DATE','INTEGER','ENUM','years','quarters','months','weeks','days','minutes','csv'];(function(_0x22491d,_0x3bad40){var _0x431173=function(_0x4fba3f){while(--_0x4fba3f){_0x22491d['push'](_0x22491d['shift']());}};_0x431173(++_0x3bad40);}(_0xf3c4,0xc3));var _0x4f3c=function(_0x22c04e,_0x386b68){_0x22c04e=_0x22c04e-0x0;var _0x537116=_0xf3c4[_0x22c04e];return _0x537116;};'use strict';var Sequelize=require(_0x4f3c('0x0'));module[_0x4f3c('0x1')]={'name':{'type':Sequelize[_0x4f3c('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x4f3c('0x2')]},'active':{'type':Sequelize[_0x4f3c('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x4f3c('0x2')],'allowNull':![],'defaultValue':'0\x200\x20*\x20*\x20*'},'startAt':{'type':Sequelize[_0x4f3c('0x4')],'allowNull':![]},'endAt':{'type':Sequelize['DATE'],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x4f3c('0x5')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x4f3c('0x6')](_0x4f3c('0x7'),_0x4f3c('0x8'),_0x4f3c('0x9'),_0x4f3c('0xa'),_0x4f3c('0xb'),'hours',_0x4f3c('0xc')),'allowNull':![],'defaultValue':_0x4f3c('0xb')},'output':{'type':Sequelize[_0x4f3c('0x6')](_0x4f3c('0xd'),_0x4f3c('0xe'),_0x4f3c('0xf')),'allowNull':![],'defaultValue':'csv'},'type':{'type':Sequelize[_0x4f3c('0x6')]('custom',_0x4f3c('0x10')),'allowNull':![],'defaultValue':_0x4f3c('0x11')},'sendMail':{'type':Sequelize[_0x4f3c('0x3')],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0x4f3c('0x12')]},'bcc':{'type':Sequelize[_0x4f3c('0x12')]},'sendIfEmpty':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 863f8a9..0c2f584 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 _0x1231=['get','Scheduler','destroy','error','stack','name','send','index','Schedule','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','rawAttributes','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','UserProfileResource','update','body','run','../../config/schedule','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','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','apply','reject','then'];(function(_0x5141ca,_0x30dbec){var _0xa9b321=function(_0x10614f){while(--_0x10614f){_0x5141ca['push'](_0x5141ca['shift']());}};_0xa9b321(++_0x30dbec);}(_0x1231,0x18d));var _0x1123=function(_0x376508,_0x4c9a92){_0x376508=_0x376508-0x0;var _0xbc0e54=_0x1231[_0x376508];return _0xbc0e54;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1123('0x0'));var zipdir=require(_0x1123('0x1'));var jsonpatch=require(_0x1123('0x2'));var rp=require(_0x1123('0x3'));var moment=require(_0x1123('0x4'));var BPromise=require(_0x1123('0x5'));var Mustache=require(_0x1123('0x6'));var util=require(_0x1123('0x7'));var path=require(_0x1123('0x8'));var sox=require(_0x1123('0x9'));var csv=require(_0x1123('0xa'));var ejs=require(_0x1123('0xb'));var fs=require('fs');var fs_extra=require(_0x1123('0xc'));var _=require(_0x1123('0xd'));var squel=require('squel');var crypto=require(_0x1123('0xe'));var jsforce=require(_0x1123('0xf'));var deskjs=require(_0x1123('0x10'));var toCsv=require('to-csv');var querystring=require(_0x1123('0x11'));var Papa=require(_0x1123('0x12'));var Redis=require('ioredis');var authService=require(_0x1123('0x13'));var qs=require(_0x1123('0x14'));var as=require(_0x1123('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1123('0x16'))(_0x1123('0x17'));var utils=require(_0x1123('0x18'));var config=require(_0x1123('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x1123('0x1a'))['db'];function respondWithStatusCode(_0x3f2e3a,_0x2a6f27){_0x2a6f27=_0x2a6f27||0xcc;return function(_0x3f4523){if(_0x3f4523){return _0x3f2e3a[_0x1123('0x1b')](_0x2a6f27);}return _0x3f2e3a['status'](_0x2a6f27)[_0x1123('0x1c')]();};}function respondWithResult(_0x17a07,_0x5d0a10){_0x5d0a10=_0x5d0a10||0xc8;return function(_0x455ee3){if(_0x455ee3){return _0x17a07[_0x1123('0x1d')](_0x5d0a10)[_0x1123('0x1e')](_0x455ee3);}};}function respondWithFilteredResult(_0x58ff7f,_0x47f2b9){return function(_0x5169a0){if(_0x5169a0){var _0x3aa8eb=typeof _0x47f2b9['offset']===_0x1123('0x1f')&&typeof _0x47f2b9[_0x1123('0x20')]===_0x1123('0x1f');var _0x2ba867=_0x5169a0[_0x1123('0x21')];var _0x16e072=_0x3aa8eb?0x0:_0x47f2b9[_0x1123('0x22')];var _0x4e1b27=_0x3aa8eb?_0x5169a0[_0x1123('0x21')]:_0x47f2b9[_0x1123('0x22')]+_0x47f2b9[_0x1123('0x20')];var _0x12ea85;if(_0x4e1b27>=_0x2ba867){_0x4e1b27=_0x2ba867;_0x12ea85=0xc8;}else{_0x12ea85=0xce;}_0x58ff7f['status'](_0x12ea85);return _0x58ff7f['set']('Content-Range',_0x16e072+'-'+_0x4e1b27+'/'+_0x2ba867)['json'](_0x5169a0);}return null;};}function patchUpdates(_0x46c2ce){return function(_0x3854df){try{jsonpatch[_0x1123('0x23')](_0x3854df,_0x46c2ce,!![]);}catch(_0x4bfda4){return BPromise[_0x1123('0x24')](_0x4bfda4);}return _0x3854df['save']();};}function saveUpdates(_0x44b0c7,_0x2eae77){return function(_0x3f6055){if(_0x3f6055){return _0x3f6055['update'](_0x44b0c7)[_0x1123('0x25')](function(_0x1c7f99){return _0x1c7f99;});}return null;};}function removeEntity(_0x379aa1,_0x570cb3){return function(_0x3916f9){if(_0x3916f9){return _0x3916f9['destroy']()[_0x1123('0x25')](function(){var _0x3571f7=_0x3916f9[_0x1123('0x26')]({'plain':!![]});var _0x2589a0=_0x1123('0x27');return db['UserProfileResource'][_0x1123('0x28')]({'where':{'type':_0x2589a0,'resourceId':_0x3571f7['id']}})[_0x1123('0x25')](function(){return _0x3916f9;});})[_0x1123('0x25')](function(){_0x379aa1['status'](0xcc)[_0x1123('0x1c')]();});}};}function handleEntityNotFound(_0xd74184,_0x5e879e){return function(_0x541b5e){if(!_0x541b5e){_0xd74184[_0x1123('0x1b')](0x194);}return _0x541b5e;};}function handleError(_0x218e85,_0x19e5b3){_0x19e5b3=_0x19e5b3||0x1f4;return function(_0x552209){logger[_0x1123('0x29')](_0x552209[_0x1123('0x2a')]);if(_0x552209[_0x1123('0x2b')]){delete _0x552209['name'];}_0x218e85[_0x1123('0x1d')](_0x19e5b3)[_0x1123('0x2c')](_0x552209);};}exports[_0x1123('0x2d')]=function(_0x349e9d,_0x479ab1){var _0x12303c={},_0x3f2c37={},_0x19e867={'count':0x0,'rows':[]};var _0x2b6229=_['map'](db[_0x1123('0x2e')]['rawAttributes'],function(_0x34d14a){return{'name':_0x34d14a[_0x1123('0x2f')],'type':_0x34d14a[_0x1123('0x30')][_0x1123('0x31')]};});_0x3f2c37[_0x1123('0x32')]=_[_0x1123('0x33')](_0x2b6229,_0x1123('0x2b'));_0x3f2c37['query']=_[_0x1123('0x34')](_0x349e9d[_0x1123('0x35')]);_0x3f2c37[_0x1123('0x36')]=_[_0x1123('0x37')](_0x3f2c37[_0x1123('0x32')],_0x3f2c37[_0x1123('0x35')]);_0x12303c[_0x1123('0x38')]=_['intersection'](_0x3f2c37[_0x1123('0x32')],qs[_0x1123('0x39')](_0x349e9d[_0x1123('0x35')][_0x1123('0x39')]));_0x12303c[_0x1123('0x38')]=_0x12303c[_0x1123('0x38')][_0x1123('0x3a')]?_0x12303c[_0x1123('0x38')]:_0x3f2c37[_0x1123('0x32')];if(!_0x349e9d[_0x1123('0x35')][_0x1123('0x3b')]('nolimit')){_0x12303c[_0x1123('0x20')]=qs[_0x1123('0x20')](_0x349e9d[_0x1123('0x35')]['limit']);_0x12303c[_0x1123('0x22')]=qs[_0x1123('0x22')](_0x349e9d[_0x1123('0x35')]['offset']);}_0x12303c[_0x1123('0x3c')]=qs[_0x1123('0x3d')](_0x349e9d[_0x1123('0x35')][_0x1123('0x3d')]);_0x12303c[_0x1123('0x3e')]=qs['filters'](_['pick'](_0x349e9d[_0x1123('0x35')],_0x3f2c37[_0x1123('0x36')]),_0x2b6229);if(_0x349e9d['query'][_0x1123('0x3f')]){_0x12303c['where']=_[_0x1123('0x40')](_0x12303c['where'],{'$or':_[_0x1123('0x33')](_0x2b6229,function(_0x31dd31){if(_0x31dd31[_0x1123('0x30')]!==_0x1123('0x41')){var _0x214cdb={};_0x214cdb[_0x31dd31[_0x1123('0x2b')]]={'$like':'%'+_0x349e9d[_0x1123('0x35')]['filter']+'%'};return _0x214cdb;}})});}_0x12303c=_[_0x1123('0x40')]({},_0x12303c,_0x349e9d['options']);var _0x4045e1={'where':_0x12303c[_0x1123('0x3e')]};return db[_0x1123('0x2e')][_0x1123('0x21')](_0x4045e1)['then'](function(_0x45a835){_0x19e867[_0x1123('0x21')]=_0x45a835;if(_0x349e9d['query'][_0x1123('0x42')]){_0x12303c[_0x1123('0x43')]=[{'all':!![]}];}return db[_0x1123('0x2e')][_0x1123('0x44')](_0x12303c);})[_0x1123('0x25')](function(_0x512c5b){_0x19e867[_0x1123('0x45')]=_0x512c5b;return _0x19e867;})['then'](respondWithFilteredResult(_0x479ab1,_0x12303c))[_0x1123('0x46')](handleError(_0x479ab1,null));};exports[_0x1123('0x47')]=function(_0xe7ce05,_0x30456f){var _0x291e6f={'raw':![],'where':{'id':_0xe7ce05[_0x1123('0x48')]['id']}},_0x2762bd={};_0x2762bd[_0x1123('0x32')]=_[_0x1123('0x34')](db[_0x1123('0x2e')][_0x1123('0x49')]);_0x2762bd[_0x1123('0x35')]=_[_0x1123('0x34')](_0xe7ce05[_0x1123('0x35')]);_0x2762bd[_0x1123('0x36')]=_[_0x1123('0x37')](_0x2762bd[_0x1123('0x32')],_0x2762bd[_0x1123('0x35')]);_0x291e6f[_0x1123('0x38')]=_[_0x1123('0x37')](_0x2762bd['model'],qs[_0x1123('0x39')](_0xe7ce05['query'][_0x1123('0x39')]));_0x291e6f[_0x1123('0x38')]=_0x291e6f['attributes']['length']?_0x291e6f[_0x1123('0x38')]:_0x2762bd['model'];if(_0xe7ce05[_0x1123('0x35')]['includeAll']){_0x291e6f['include']=[{'all':!![]}];}_0x291e6f=_[_0x1123('0x40')]({},_0x291e6f,_0xe7ce05[_0x1123('0x4a')]);return db['Schedule'][_0x1123('0x4b')](_0x291e6f)[_0x1123('0x25')](handleEntityNotFound(_0x30456f,null))[_0x1123('0x25')](respondWithResult(_0x30456f,null))[_0x1123('0x46')](handleError(_0x30456f,null));};exports[_0x1123('0x4c')]=function(_0x103329,_0x360f69){return db[_0x1123('0x2e')][_0x1123('0x4c')](_0x103329['body'],{})[_0x1123('0x25')](function(_0x5b1fb0){var _0x323c44=_0x103329[_0x1123('0x4d')]['get']({'plain':!![]});if(!_0x323c44)throw new Error(_0x1123('0x4e'));if(_0x323c44[_0x1123('0x4f')]===_0x1123('0x4d')){var _0x3bba61=_0x5b1fb0[_0x1123('0x26')]({'plain':!![]});var _0x26ae6e=_0x1123('0x27');return db['UserProfileSection'][_0x1123('0x4b')]({'where':{'name':_0x26ae6e,'userProfileId':_0x323c44[_0x1123('0x50')]},'raw':!![]})[_0x1123('0x25')](function(_0x8344f8){if(_0x8344f8&&_0x8344f8[_0x1123('0x51')]===0x0){return db[_0x1123('0x52')][_0x1123('0x4c')]({'name':_0x3bba61[_0x1123('0x2b')],'resourceId':_0x3bba61['id'],'type':_0x8344f8[_0x1123('0x2b')],'sectionId':_0x8344f8['id']},{})[_0x1123('0x25')](function(){return _0x5b1fb0;});}else{return _0x5b1fb0;}})[_0x1123('0x46')](function(_0x1b0b4e){logger[_0x1123('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1b0b4e);throw _0x1b0b4e;});}return _0x5b1fb0;})[_0x1123('0x25')](respondWithResult(_0x360f69,0xc9))['catch'](handleError(_0x360f69,null));};exports[_0x1123('0x53')]=function(_0x12f06a,_0x2e10be){if(_0x12f06a[_0x1123('0x54')]['id']){delete _0x12f06a[_0x1123('0x54')]['id'];}return db[_0x1123('0x2e')]['find']({'where':{'id':_0x12f06a[_0x1123('0x48')]['id']}})[_0x1123('0x25')](handleEntityNotFound(_0x2e10be,null))[_0x1123('0x25')](saveUpdates(_0x12f06a['body'],null))[_0x1123('0x25')](respondWithResult(_0x2e10be,null))[_0x1123('0x46')](handleError(_0x2e10be,null));};exports[_0x1123('0x28')]=function(_0x42f2dd,_0x23dc71){return db[_0x1123('0x2e')]['find']({'where':{'id':_0x42f2dd[_0x1123('0x48')]['id']}})[_0x1123('0x25')](handleEntityNotFound(_0x23dc71,null))[_0x1123('0x25')](removeEntity(_0x23dc71,null))[_0x1123('0x46')](handleError(_0x23dc71,null));};exports[_0x1123('0x55')]=function(_0x537b80,_0x12d493,_0x2e5c11){var _0x40a953=require(_0x1123('0x56'));return db[_0x1123('0x2e')]['find']({'where':{'id':_0x537b80[_0x1123('0x48')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x12d493,null))[_0x1123('0x25')](function(){_0x40a953[_0x1123('0x55')](_0x537b80[_0x1123('0x48')]['id']);})[_0x1123('0x25')](respondWithStatusCode(_0x12d493,null))['catch'](handleError(_0x12d493,null));}; \ No newline at end of file +var _0x3b2d=['status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','get','Scheduler','UserProfileResource','index','Schedule','rawAttributes','type','key','map','name','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','show','params','find','create','user','role','UserProfileSection','catch','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','../../config/schedule','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','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','sendStatus'];(function(_0xb91f14,_0x1795cb){var _0xa826f0=function(_0x16733d){while(--_0x16733d){_0xb91f14['push'](_0xb91f14['shift']());}};_0xa826f0(++_0x1795cb);}(_0x3b2d,0x1c1));var _0xd3b2=function(_0x114114,_0x58d964){_0x114114=_0x114114-0x0;var _0xcbe1cd=_0x3b2d[_0x114114];return _0xcbe1cd;};'use strict';var emlformat=require(_0xd3b2('0x0'));var rimraf=require(_0xd3b2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xd3b2('0x2'));var BPromise=require(_0xd3b2('0x3'));var Mustache=require('mustache');var util=require(_0xd3b2('0x4'));var path=require(_0xd3b2('0x5'));var sox=require(_0xd3b2('0x6'));var csv=require(_0xd3b2('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd3b2('0x8'));var squel=require(_0xd3b2('0x9'));var crypto=require(_0xd3b2('0xa'));var jsforce=require(_0xd3b2('0xb'));var deskjs=require(_0xd3b2('0xc'));var toCsv=require(_0xd3b2('0x7'));var querystring=require(_0xd3b2('0xd'));var Papa=require(_0xd3b2('0xe'));var Redis=require(_0xd3b2('0xf'));var authService=require(_0xd3b2('0x10'));var qs=require(_0xd3b2('0x11'));var as=require(_0xd3b2('0x12'));var hardwareService=require(_0xd3b2('0x13'));var logger=require(_0xd3b2('0x14'))('api');var utils=require(_0xd3b2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd3b2('0x16'));var db=require(_0xd3b2('0x17'))['db'];function respondWithStatusCode(_0x1ca3b2,_0x107535){_0x107535=_0x107535||0xcc;return function(_0x3f5449){if(_0x3f5449){return _0x1ca3b2[_0xd3b2('0x18')](_0x107535);}return _0x1ca3b2[_0xd3b2('0x19')](_0x107535)[_0xd3b2('0x1a')]();};}function respondWithResult(_0x3ba0b8,_0x31231b){_0x31231b=_0x31231b||0xc8;return function(_0x46d6a0){if(_0x46d6a0){return _0x3ba0b8['status'](_0x31231b)[_0xd3b2('0x1b')](_0x46d6a0);}};}function respondWithFilteredResult(_0x491099,_0xc658d1){return function(_0x13e758){if(_0x13e758){var _0x4b3903=typeof _0xc658d1[_0xd3b2('0x1c')]==='undefined'&&typeof _0xc658d1[_0xd3b2('0x1d')]===_0xd3b2('0x1e');var _0x5448dc=_0x13e758[_0xd3b2('0x1f')];var _0x1229c9=_0x4b3903?0x0:_0xc658d1[_0xd3b2('0x1c')];var _0x87c365=_0x4b3903?_0x13e758['count']:_0xc658d1[_0xd3b2('0x1c')]+_0xc658d1['limit'];var _0x31ca68;if(_0x87c365>=_0x5448dc){_0x87c365=_0x5448dc;_0x31ca68=0xc8;}else{_0x31ca68=0xce;}_0x491099['status'](_0x31ca68);return _0x491099[_0xd3b2('0x20')](_0xd3b2('0x21'),_0x1229c9+'-'+_0x87c365+'/'+_0x5448dc)[_0xd3b2('0x1b')](_0x13e758);}return null;};}function patchUpdates(_0x13e000){return function(_0x4d3e5b){try{jsonpatch[_0xd3b2('0x22')](_0x4d3e5b,_0x13e000,!![]);}catch(_0x30af8e){return BPromise[_0xd3b2('0x23')](_0x30af8e);}return _0x4d3e5b[_0xd3b2('0x24')]();};}function saveUpdates(_0x4f8002,_0x4c5c5f){return function(_0x13828c){if(_0x13828c){return _0x13828c[_0xd3b2('0x25')](_0x4f8002)[_0xd3b2('0x26')](function(_0x4df601){return _0x4df601;});}return null;};}function removeEntity(_0x5c8ec9,_0x54c0bf){return function(_0x5ef09f){if(_0x5ef09f){return _0x5ef09f['destroy']()['then'](function(){var _0x5507e7=_0x5ef09f[_0xd3b2('0x27')]({'plain':!![]});var _0x5f1e93=_0xd3b2('0x28');return db[_0xd3b2('0x29')]['destroy']({'where':{'type':_0x5f1e93,'resourceId':_0x5507e7['id']}})['then'](function(){return _0x5ef09f;});})['then'](function(){_0x5c8ec9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x49f646,_0x40bd08){return function(_0x50ecb7){if(!_0x50ecb7){_0x49f646[_0xd3b2('0x18')](0x194);}return _0x50ecb7;};}function handleError(_0x4e33f9,_0x3d4b52){_0x3d4b52=_0x3d4b52||0x1f4;return function(_0x4e61cd){logger['error'](_0x4e61cd['stack']);if(_0x4e61cd['name']){delete _0x4e61cd['name'];}_0x4e33f9[_0xd3b2('0x19')](_0x3d4b52)['send'](_0x4e61cd);};}exports[_0xd3b2('0x2a')]=function(_0x40b973,_0xf178e6){var _0x12ab1f={},_0x53dd19={},_0x53c6ff={'count':0x0,'rows':[]};var _0x2d7bf4=_['map'](db[_0xd3b2('0x2b')][_0xd3b2('0x2c')],function(_0x1a288d){return{'name':_0x1a288d['fieldName'],'type':_0x1a288d[_0xd3b2('0x2d')][_0xd3b2('0x2e')]};});_0x53dd19['model']=_[_0xd3b2('0x2f')](_0x2d7bf4,_0xd3b2('0x30'));_0x53dd19[_0xd3b2('0x31')]=_[_0xd3b2('0x32')](_0x40b973[_0xd3b2('0x31')]);_0x53dd19[_0xd3b2('0x33')]=_[_0xd3b2('0x34')](_0x53dd19[_0xd3b2('0x35')],_0x53dd19[_0xd3b2('0x31')]);_0x12ab1f[_0xd3b2('0x36')]=_[_0xd3b2('0x34')](_0x53dd19[_0xd3b2('0x35')],qs['fields'](_0x40b973[_0xd3b2('0x31')][_0xd3b2('0x37')]));_0x12ab1f[_0xd3b2('0x36')]=_0x12ab1f['attributes']['length']?_0x12ab1f[_0xd3b2('0x36')]:_0x53dd19[_0xd3b2('0x35')];if(!_0x40b973['query'][_0xd3b2('0x38')](_0xd3b2('0x39'))){_0x12ab1f['limit']=qs[_0xd3b2('0x1d')](_0x40b973[_0xd3b2('0x31')][_0xd3b2('0x1d')]);_0x12ab1f['offset']=qs[_0xd3b2('0x1c')](_0x40b973['query'][_0xd3b2('0x1c')]);}_0x12ab1f['order']=qs[_0xd3b2('0x3a')](_0x40b973[_0xd3b2('0x31')]['sort']);_0x12ab1f[_0xd3b2('0x3b')]=qs[_0xd3b2('0x33')](_[_0xd3b2('0x3c')](_0x40b973[_0xd3b2('0x31')],_0x53dd19[_0xd3b2('0x33')]),_0x2d7bf4);if(_0x40b973[_0xd3b2('0x31')][_0xd3b2('0x3d')]){_0x12ab1f[_0xd3b2('0x3b')]=_[_0xd3b2('0x3e')](_0x12ab1f[_0xd3b2('0x3b')],{'$or':_[_0xd3b2('0x2f')](_0x2d7bf4,function(_0x141bde){if(_0x141bde[_0xd3b2('0x2d')]!==_0xd3b2('0x3f')){var _0x37de5c={};_0x37de5c[_0x141bde['name']]={'$like':'%'+_0x40b973[_0xd3b2('0x31')]['filter']+'%'};return _0x37de5c;}})});}_0x12ab1f=_[_0xd3b2('0x3e')]({},_0x12ab1f,_0x40b973[_0xd3b2('0x40')]);var _0x2fd2d9={'where':_0x12ab1f[_0xd3b2('0x3b')]};return db[_0xd3b2('0x2b')][_0xd3b2('0x1f')](_0x2fd2d9)['then'](function(_0x2322ac){_0x53c6ff['count']=_0x2322ac;if(_0x40b973[_0xd3b2('0x31')][_0xd3b2('0x41')]){_0x12ab1f[_0xd3b2('0x42')]=[{'all':!![]}];}return db[_0xd3b2('0x2b')]['findAll'](_0x12ab1f);})[_0xd3b2('0x26')](function(_0x280102){_0x53c6ff['rows']=_0x280102;return _0x53c6ff;})['then'](respondWithFilteredResult(_0xf178e6,_0x12ab1f))['catch'](handleError(_0xf178e6,null));};exports[_0xd3b2('0x43')]=function(_0x319a79,_0x67efe0){var _0x1d0a7d={'raw':![],'where':{'id':_0x319a79[_0xd3b2('0x44')]['id']}},_0x324990={};_0x324990[_0xd3b2('0x35')]=_[_0xd3b2('0x32')](db['Schedule']['rawAttributes']);_0x324990[_0xd3b2('0x31')]=_[_0xd3b2('0x32')](_0x319a79['query']);_0x324990['filters']=_['intersection'](_0x324990[_0xd3b2('0x35')],_0x324990['query']);_0x1d0a7d['attributes']=_['intersection'](_0x324990[_0xd3b2('0x35')],qs[_0xd3b2('0x37')](_0x319a79[_0xd3b2('0x31')][_0xd3b2('0x37')]));_0x1d0a7d['attributes']=_0x1d0a7d[_0xd3b2('0x36')]['length']?_0x1d0a7d[_0xd3b2('0x36')]:_0x324990[_0xd3b2('0x35')];if(_0x319a79[_0xd3b2('0x31')][_0xd3b2('0x41')]){_0x1d0a7d[_0xd3b2('0x42')]=[{'all':!![]}];}_0x1d0a7d=_[_0xd3b2('0x3e')]({},_0x1d0a7d,_0x319a79[_0xd3b2('0x40')]);return db[_0xd3b2('0x2b')][_0xd3b2('0x45')](_0x1d0a7d)[_0xd3b2('0x26')](handleEntityNotFound(_0x67efe0,null))[_0xd3b2('0x26')](respondWithResult(_0x67efe0,null))['catch'](handleError(_0x67efe0,null));};exports[_0xd3b2('0x46')]=function(_0x12c96a,_0xb7f181){return db['Schedule'][_0xd3b2('0x46')](_0x12c96a['body'],{})[_0xd3b2('0x26')](function(_0xe09dc4){var _0x115e42=_0x12c96a[_0xd3b2('0x47')][_0xd3b2('0x27')]({'plain':!![]});if(!_0x115e42)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x115e42[_0xd3b2('0x48')]===_0xd3b2('0x47')){var _0xe3a4c5=_0xe09dc4[_0xd3b2('0x27')]({'plain':!![]});var _0x124a4e='Scheduler';return db[_0xd3b2('0x49')][_0xd3b2('0x45')]({'where':{'name':_0x124a4e,'userProfileId':_0x115e42['userProfileId']},'raw':!![]})[_0xd3b2('0x26')](function(_0x232489){if(_0x232489&&_0x232489['autoAssociation']===0x0){return db[_0xd3b2('0x29')][_0xd3b2('0x46')]({'name':_0xe3a4c5[_0xd3b2('0x30')],'resourceId':_0xe3a4c5['id'],'type':_0x232489[_0xd3b2('0x30')],'sectionId':_0x232489['id']},{})[_0xd3b2('0x26')](function(){return _0xe09dc4;});}else{return _0xe09dc4;}})[_0xd3b2('0x4a')](function(_0x304b05){logger[_0xd3b2('0x4b')](_0xd3b2('0x4c'),_0x304b05);throw _0x304b05;});}return _0xe09dc4;})[_0xd3b2('0x26')](respondWithResult(_0xb7f181,0xc9))[_0xd3b2('0x4a')](handleError(_0xb7f181,null));};exports[_0xd3b2('0x25')]=function(_0x3409fc,_0x128f0f){if(_0x3409fc[_0xd3b2('0x4d')]['id']){delete _0x3409fc[_0xd3b2('0x4d')]['id'];}return db[_0xd3b2('0x2b')][_0xd3b2('0x45')]({'where':{'id':_0x3409fc[_0xd3b2('0x44')]['id']}})[_0xd3b2('0x26')](handleEntityNotFound(_0x128f0f,null))[_0xd3b2('0x26')](saveUpdates(_0x3409fc[_0xd3b2('0x4d')],null))[_0xd3b2('0x26')](respondWithResult(_0x128f0f,null))[_0xd3b2('0x4a')](handleError(_0x128f0f,null));};exports['destroy']=function(_0x318614,_0xb2be55){return db['Schedule'][_0xd3b2('0x45')]({'where':{'id':_0x318614[_0xd3b2('0x44')]['id']}})[_0xd3b2('0x26')](handleEntityNotFound(_0xb2be55,null))[_0xd3b2('0x26')](removeEntity(_0xb2be55,null))[_0xd3b2('0x4a')](handleError(_0xb2be55,null));};exports['run']=function(_0x563876,_0x4a198e,_0x1198b1){var _0x4be5f1=require(_0xd3b2('0x4e'));return db['Schedule'][_0xd3b2('0x45')]({'where':{'id':_0x563876[_0xd3b2('0x44')]['id']},'raw':!![]})[_0xd3b2('0x26')](handleEntityNotFound(_0x4a198e,null))['then'](function(){_0x4be5f1['run'](_0x563876[_0xd3b2('0x44')]['id']);})[_0xd3b2('0x26')](respondWithStatusCode(_0x4a198e,null))['catch'](handleError(_0x4a198e,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 4895bbe..a8a42bd 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 _0x0883=['request-promise','rimraf','../../config/environment','./schedule.attributes','exports','Schedule','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x1c8cf9,_0x26fdc3){var _0x129cc9=function(_0x31c661){while(--_0x31c661){_0x1c8cf9['push'](_0x1c8cf9['shift']());}};_0x129cc9(++_0x26fdc3);}(_0x0883,0x14a));var _0x3088=function(_0x2c5255,_0x4340c3){_0x2c5255=_0x2c5255-0x0;var _0x30d0ea=_0x0883[_0x2c5255];return _0x30d0ea;};'use strict';var _=require(_0x3088('0x0'));var util=require(_0x3088('0x1'));var logger=require(_0x3088('0x2'))(_0x3088('0x3'));var moment=require(_0x3088('0x4'));var BPromise=require(_0x3088('0x5'));var rp=require(_0x3088('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3088('0x7'));var config=require(_0x3088('0x8'));var attributes=require(_0x3088('0x9'));module[_0x3088('0xa')]=function(_0x474d00,_0x251691){return _0x474d00['define'](_0x3088('0xb'),attributes,{'tableName':'tools_schedules','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdb62=['util','../../config/logger','moment','bluebird','request-promise','path','exports','define','Schedule','tools_schedules','lodash'];(function(_0x26e295,_0x1c9114){var _0x40d384=function(_0x53216b){while(--_0x53216b){_0x26e295['push'](_0x26e295['shift']());}};_0x40d384(++_0x1c9114);}(_0xdb62,0x18b));var _0x2db6=function(_0x4a93bb,_0x495404){_0x4a93bb=_0x4a93bb-0x0;var _0x208468=_0xdb62[_0x4a93bb];return _0x208468;};'use strict';var _=require(_0x2db6('0x0'));var util=require(_0x2db6('0x1'));var logger=require(_0x2db6('0x2'))('api');var moment=require(_0x2db6('0x3'));var BPromise=require(_0x2db6('0x4'));var rp=require(_0x2db6('0x5'));var fs=require('fs');var path=require(_0x2db6('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./schedule.attributes');module[_0x2db6('0x7')]=function(_0x1cee21,_0x54b323){return _0x1cee21[_0x2db6('0x8')](_0x2db6('0x9'),attributes,{'tableName':_0x2db6('0xa'),'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 41fa759..083d7d4 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 _0x10ba=['jayson/promise','client','http','request','then','info','Schedule,\x20%s,\x20%s','debug','Schedule,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x3b2cf5,_0x9942b7){var _0x5a8cab=function(_0x44b4da){while(--_0x44b4da){_0x3b2cf5['push'](_0x3b2cf5['shift']());}};_0x5a8cab(++_0x9942b7);}(_0x10ba,0x114));var _0xa10b=function(_0x377a6e,_0x59b99d){_0x377a6e=_0x377a6e-0x0;var _0x37f751=_0x10ba[_0x377a6e];return _0x37f751;};'use strict';var _=require(_0xa10b('0x0'));var util=require(_0xa10b('0x1'));var moment=require(_0xa10b('0x2'));var BPromise=require('bluebird');var rs=require(_0xa10b('0x3'));var fs=require('fs');var Redis=require(_0xa10b('0x4'));var db=require(_0xa10b('0x5'))['db'];var utils=require(_0xa10b('0x6'));var logger=require(_0xa10b('0x7'))(_0xa10b('0x8'));var config=require(_0xa10b('0x9'));var jayson=require(_0xa10b('0xa'));var client=jayson[_0xa10b('0xb')][_0xa10b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x302f37,_0x381740,_0x4cdc0e){return new BPromise(function(_0x1b2ae7,_0x5ed94d){return client[_0xa10b('0xd')](_0x302f37,_0x4cdc0e)[_0xa10b('0xe')](function(_0x188fdc){logger[_0xa10b('0xf')](_0xa10b('0x10'),_0x381740,'request\x20sent');logger[_0xa10b('0x11')](_0xa10b('0x12'),_0x381740,_0xa10b('0x13'),JSON[_0xa10b('0x14')](_0x188fdc));if(_0x188fdc[_0xa10b('0x15')]){if(_0x188fdc[_0xa10b('0x15')][_0xa10b('0x16')]===0x1f4){logger[_0xa10b('0x15')](_0xa10b('0x10'),_0x381740,_0x188fdc[_0xa10b('0x15')][_0xa10b('0x17')]);return _0x5ed94d(_0x188fdc[_0xa10b('0x15')][_0xa10b('0x17')]);}logger[_0xa10b('0x15')](_0xa10b('0x10'),_0x381740,_0x188fdc['error']['message']);return _0x1b2ae7(_0x188fdc[_0xa10b('0x15')][_0xa10b('0x17')]);}else{logger[_0xa10b('0xf')](_0xa10b('0x10'),_0x381740,_0xa10b('0x13'));_0x1b2ae7(_0x188fdc[_0xa10b('0x18')][_0xa10b('0x17')]);}})[_0xa10b('0x19')](function(_0x4424b0){logger['error']('Schedule,\x20%s,\x20%s',_0x381740,_0x4424b0);_0x5ed94d(_0x4424b0);});});} \ No newline at end of file +var _0x17d9=['code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','Schedule,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x62a9c1,_0x1e5f1e){var _0x30e7f1=function(_0x4929f5){while(--_0x4929f5){_0x62a9c1['push'](_0x62a9c1['shift']());}};_0x30e7f1(++_0x1e5f1e);}(_0x17d9,0x71));var _0x917d=function(_0x75ce5b,_0x3b582f){_0x75ce5b=_0x75ce5b-0x0;var _0x22195e=_0x17d9[_0x75ce5b];return _0x22195e;};'use strict';var _=require(_0x917d('0x0'));var util=require(_0x917d('0x1'));var moment=require(_0x917d('0x2'));var BPromise=require(_0x917d('0x3'));var rs=require(_0x917d('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x917d('0x5'))['db'];var utils=require(_0x917d('0x6'));var logger=require(_0x917d('0x7'))(_0x917d('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x917d('0x9')][_0x917d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a735b,_0x2d249c,_0x7f9df1){return new BPromise(function(_0x13058c,_0x1861bc){return client[_0x917d('0xb')](_0x2a735b,_0x7f9df1)[_0x917d('0xc')](function(_0xe52daa){logger[_0x917d('0xd')](_0x917d('0xe'),_0x2d249c,_0x917d('0xf'));logger['debug'](_0x917d('0x10'),_0x2d249c,_0x917d('0xf'),JSON[_0x917d('0x11')](_0xe52daa));if(_0xe52daa[_0x917d('0x12')]){if(_0xe52daa[_0x917d('0x12')][_0x917d('0x13')]===0x1f4){logger[_0x917d('0x12')](_0x917d('0xe'),_0x2d249c,_0xe52daa['error'][_0x917d('0x14')]);return _0x1861bc(_0xe52daa['error'][_0x917d('0x14')]);}logger[_0x917d('0x12')](_0x917d('0xe'),_0x2d249c,_0xe52daa['error']['message']);return _0x13058c(_0xe52daa[_0x917d('0x12')]['message']);}else{logger['info'](_0x917d('0xe'),_0x2d249c,'request\x20sent');_0x13058c(_0xe52daa[_0x917d('0x15')][_0x917d('0x14')]);}})['catch'](function(_0x3046c5){logger[_0x917d('0x12')](_0x917d('0xe'),_0x2d249c,_0x3046c5);_0x1861bc(_0x3046c5);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 35a2fb1..caf250f 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 _0x240e=['./screenRecording.controller','get','index','/describe','describe','/:id','isAuthenticated','show','/:id/download','download','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0x240e,0xe0));var _0xe240=function(_0x1abb09,_0x18ee91){_0x1abb09=_0x1abb09-0x0;var _0xea1c07=_0x240e[_0x1abb09];return _0xea1c07;};'use strict';var multer=require(_0xe240('0x0'));var util=require(_0xe240('0x1'));var path=require(_0xe240('0x2'));var timeout=require(_0xe240('0x3'));var express=require(_0xe240('0x4'));var router=express[_0xe240('0x5')]();var fs_extra=require(_0xe240('0x6'));var auth=require(_0xe240('0x7'));var interaction=require(_0xe240('0x8'));var config=require(_0xe240('0x9'));var controller=require(_0xe240('0xa'));router[_0xe240('0xb')]('/',auth['isAuthenticated'](),controller[_0xe240('0xc')]);router[_0xe240('0xb')](_0xe240('0xd'),auth['isAuthenticated'](),controller[_0xe240('0xe')]);router['get'](_0xe240('0xf'),auth[_0xe240('0x10')](),controller[_0xe240('0x11')]);router[_0xe240('0xb')](_0xe240('0x12'),auth['isAuthenticated'](),controller[_0xe240('0x13')]);router[_0xe240('0x14')]('/',auth[_0xe240('0x10')](),controller[_0xe240('0x15')]);router['put'](_0xe240('0xf'),auth['isAuthenticated'](),controller[_0xe240('0x16')]);router[_0xe240('0x17')]('/:id',auth[_0xe240('0x10')](),controller[_0xe240('0x18')]);module[_0xe240('0x19')]=router; \ No newline at end of file +var _0xc4fa=['download','create','put','update','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','/:id/download'];(function(_0x34f545,_0x2bd2ee){var _0x1ff6b8=function(_0x582e3b){while(--_0x582e3b){_0x34f545['push'](_0x34f545['shift']());}};_0x1ff6b8(++_0x2bd2ee);}(_0xc4fa,0x1e6));var _0xac4f=function(_0x4cb8ae,_0x521060){_0x4cb8ae=_0x4cb8ae-0x0;var _0x40649e=_0xc4fa[_0x4cb8ae];return _0x40649e;};'use strict';var multer=require(_0xac4f('0x0'));var util=require(_0xac4f('0x1'));var path=require(_0xac4f('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0xac4f('0x3'));var auth=require(_0xac4f('0x4'));var interaction=require(_0xac4f('0x5'));var config=require(_0xac4f('0x6'));var controller=require('./screenRecording.controller');router[_0xac4f('0x7')]('/',auth[_0xac4f('0x8')](),controller[_0xac4f('0x9')]);router['get']('/describe',auth[_0xac4f('0x8')](),controller[_0xac4f('0xa')]);router['get'](_0xac4f('0xb'),auth[_0xac4f('0x8')](),controller[_0xac4f('0xc')]);router[_0xac4f('0x7')](_0xac4f('0xd'),auth[_0xac4f('0x8')](),controller[_0xac4f('0xe')]);router['post']('/',auth['isAuthenticated'](),controller[_0xac4f('0xf')]);router[_0xac4f('0x10')](_0xac4f('0xb'),auth[_0xac4f('0x8')](),controller[_0xac4f('0x11')]);router['delete'](_0xac4f('0xb'),auth[_0xac4f('0x8')](),controller[_0xac4f('0x12')]);module[_0xac4f('0x13')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 4cc3752..a92e710 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 _0xaec5=['getDataValue','replace','setDataValue','INTEGER','startedAt','subtract','closedAt','duration','format','MM-DD-YYYY\x20HH:mm','toString','DATE','createdAt','updatedAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','value','extname'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xaec5,0x92));var _0x5aec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaec5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5aec('0x0'));var moment=require(_0x5aec('0x1'));var path=require(_0x5aec('0x2'));var config=require(_0x5aec('0x3'));module[_0x5aec('0x4')]={'format':{'type':Sequelize[_0x5aec('0x5')],'get':function(){return this['getDataValue'](_0x5aec('0x6'))?path[_0x5aec('0x7')](this[_0x5aec('0x8')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize['STRING'],'set':function(_0x476951){var _0x3dae8d=_0x476951[_0x5aec('0x9')](/\\/g,'/');this[_0x5aec('0xa')]('value',_0x3dae8d);}},'rating':{'type':Sequelize[_0x5aec('0xb')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x5aec('0xb')],'set':function(_0x5b5bb3){this[_0x5aec('0xa')](_0x5aec('0xc'),moment()[_0x5aec('0xd')](_0x5b5bb3,'ms'));this[_0x5aec('0xa')](_0x5aec('0xe'),moment());this[_0x5aec('0xa')](_0x5aec('0xf'),_0x5b5bb3);}},'startedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this['getDataValue'](_0x5aec('0xc')))[_0x5aec('0x10')](_0x5aec('0x11'))[_0x5aec('0x12')]();}},'closedAt':{'type':Sequelize[_0x5aec('0x13')],'get':function(){return moment(this[_0x5aec('0x8')](_0x5aec('0xe')))[_0x5aec('0x10')](_0x5aec('0x11'))[_0x5aec('0x12')]();}},'createdAt':{'type':Sequelize[_0x5aec('0x13')],'get':function(){return moment(this['getDataValue'](_0x5aec('0x14')))[_0x5aec('0x10')]('MM-DD-YYYY\x20HH:mm')[_0x5aec('0x12')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x5aec('0x8')](_0x5aec('0x15')))[_0x5aec('0x10')](_0x5aec('0x11'))['toString']();}}}; \ No newline at end of file +var _0xa5c9=['moment','path','../../config/environment','getDataValue','value','STRING','replace','INTEGER','setDataValue','startedAt','closedAt','duration','DATE','format','MM-DD-YYYY\x20HH:mm','toString','createdAt','sequelize'];(function(_0x2fc06d,_0x541b18){var _0x4a413d=function(_0x5b1781){while(--_0x5b1781){_0x2fc06d['push'](_0x2fc06d['shift']());}};_0x4a413d(++_0x541b18);}(_0xa5c9,0x143));var _0x9a5c=function(_0x5f1391,_0x19c132){_0x5f1391=_0x5f1391-0x0;var _0x50ebe3=_0xa5c9[_0x5f1391];return _0x50ebe3;};'use strict';var Sequelize=require(_0x9a5c('0x0'));var moment=require(_0x9a5c('0x1'));var path=require(_0x9a5c('0x2'));var config=require(_0x9a5c('0x3'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x9a5c('0x4')](_0x9a5c('0x5'))?path['extname'](this['getDataValue']('value')):undefined;}},'interactionid':{'type':Sequelize[_0x9a5c('0x6')]},'channel':{'type':Sequelize[_0x9a5c('0x6')]},'value':{'type':Sequelize[_0x9a5c('0x6')],'set':function(_0x3bb6f2){var _0x594e67=_0x3bb6f2[_0x9a5c('0x7')](/\\/g,'/');this['setDataValue'](_0x9a5c('0x5'),_0x594e67);}},'rating':{'type':Sequelize[_0x9a5c('0x8')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize['INTEGER'],'set':function(_0x127932){this[_0x9a5c('0x9')](_0x9a5c('0xa'),moment()['subtract'](_0x127932,'ms'));this['setDataValue'](_0x9a5c('0xb'),moment());this[_0x9a5c('0x9')](_0x9a5c('0xc'),_0x127932);}},'startedAt':{'type':Sequelize[_0x9a5c('0xd')],'get':function(){return moment(this[_0x9a5c('0x4')](_0x9a5c('0xa')))[_0x9a5c('0xe')](_0x9a5c('0xf'))[_0x9a5c('0x10')]();}},'closedAt':{'type':Sequelize[_0x9a5c('0xd')],'get':function(){return moment(this[_0x9a5c('0x4')](_0x9a5c('0xb')))['format'](_0x9a5c('0xf'))[_0x9a5c('0x10')]();}},'createdAt':{'type':Sequelize[_0x9a5c('0xd')],'get':function(){return moment(this['getDataValue'](_0x9a5c('0x11')))[_0x9a5c('0xe')]('MM-DD-YYYY\x20HH:mm')[_0x9a5c('0x10')]();}},'updatedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x9a5c('0x4')]('updatedAt'))[_0x9a5c('0xe')](_0x9a5c('0xf'))['toString']();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index 1346844..cd051cd 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 _0x00bb=['json','undefined','limit','offset','apply','reject','update','destroy','end','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','ScreenRecording','count','then','includeAll','include','rows','catch','show','params','length','options','find','body','createdAt','closedAt','value','describe','download','uniqueid','join','root','format','%s.cypher','existsSync','decryptFile','secrets','recording','server/files/screen_recordings','Sequelize','ScreenRecording\x20not\x20found','filename','unlink','message','Not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','isNil','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','File:\x20\x22','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','path','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../mysqldb','sendStatus','status'];(function(_0xd66d05,_0x924f94){var _0x14f0d4=function(_0x16027d){while(--_0x16027d){_0xd66d05['push'](_0xd66d05['shift']());}};_0x14f0d4(++_0x924f94);}(_0x00bb,0x1d8));var _0xb00b=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x00bb[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xb00b('0x0'));var rimraf=require(_0xb00b('0x1'));var zipdir=require(_0xb00b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb00b('0x3'));var moment=require('moment');var BPromise=require(_0xb00b('0x4'));var Mustache=require(_0xb00b('0x5'));var util=require('util');var path=require(_0xb00b('0x6'));var sox=require(_0xb00b('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb00b('0x8'));var squel=require(_0xb00b('0x9'));var crypto=require(_0xb00b('0xa'));var jsforce=require(_0xb00b('0xb'));var deskjs=require(_0xb00b('0xc'));var toCsv=require(_0xb00b('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb00b('0xe'));var authService=require(_0xb00b('0xf'));var qs=require(_0xb00b('0x10'));var as=require(_0xb00b('0x11'));var hardwareService=require(_0xb00b('0x12'));var logger=require('../../config/logger')(_0xb00b('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xb00b('0x14'))['db'];function respondWithStatusCode(_0x2d8ddf,_0x1be8aa){_0x1be8aa=_0x1be8aa||0xcc;return function(_0x466b9b){if(_0x466b9b){return _0x2d8ddf[_0xb00b('0x15')](_0x1be8aa);}return _0x2d8ddf[_0xb00b('0x16')](_0x1be8aa)['end']();};}function respondWithResult(_0x218de2,_0xb0d42e){_0xb0d42e=_0xb0d42e||0xc8;return function(_0x482fe6){if(_0x482fe6){return _0x218de2[_0xb00b('0x16')](_0xb0d42e)[_0xb00b('0x17')](_0x482fe6);}};}function respondWithFilteredResult(_0x540b79,_0x5da36b){return function(_0x9b471e){if(_0x9b471e){var _0x4dcd45=typeof _0x5da36b['offset']===_0xb00b('0x18')&&typeof _0x5da36b[_0xb00b('0x19')]===_0xb00b('0x18');var _0xbb72fc=_0x9b471e['count'];var _0x2a7231=_0x4dcd45?0x0:_0x5da36b['offset'];var _0x415f91=_0x4dcd45?_0x9b471e['count']:_0x5da36b[_0xb00b('0x1a')]+_0x5da36b['limit'];var _0xb26ebb;if(_0x415f91>=_0xbb72fc){_0x415f91=_0xbb72fc;_0xb26ebb=0xc8;}else{_0xb26ebb=0xce;}_0x540b79[_0xb00b('0x16')](_0xb26ebb);return _0x540b79['set']('Content-Range',_0x2a7231+'-'+_0x415f91+'/'+_0xbb72fc)[_0xb00b('0x17')](_0x9b471e);}return null;};}function patchUpdates(_0x4a334b){return function(_0x1344c4){try{jsonpatch[_0xb00b('0x1b')](_0x1344c4,_0x4a334b,!![]);}catch(_0x2fe48d){return BPromise[_0xb00b('0x1c')](_0x2fe48d);}return _0x1344c4['save']();};}function saveUpdates(_0x362ee0,_0x4df284){return function(_0x25a973){if(_0x25a973){return _0x25a973[_0xb00b('0x1d')](_0x362ee0)['then'](function(_0x231293){return _0x231293;});}return null;};}function removeEntity(_0x2896d1,_0x520444){return function(_0x3ab3cc){if(_0x3ab3cc){return _0x3ab3cc[_0xb00b('0x1e')]()['then'](function(){_0x2896d1[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();});}};}function handleEntityNotFound(_0x3c9500,_0x8caadf){return function(_0x520e55){if(!_0x520e55){_0x3c9500['sendStatus'](0x194);}return _0x520e55;};}function handleError(_0x3785e9,_0x490380){_0x490380=_0x490380||0x1f4;return function(_0x550587){logger['error'](_0x550587[_0xb00b('0x20')]);if(_0x550587[_0xb00b('0x21')]){delete _0x550587[_0xb00b('0x21')];}_0x3785e9[_0xb00b('0x16')](_0x490380)[_0xb00b('0x22')](_0x550587);};}exports[_0xb00b('0x23')]=function(_0x15d3b9,_0x4a8d2b){var _0x22c22d={},_0x503c9c={},_0x450129={'count':0x0,'rows':[]};var _0x348165=_[_0xb00b('0x24')](db['ScreenRecording'][_0xb00b('0x25')],function(_0x280ed3){return{'name':_0x280ed3[_0xb00b('0x26')],'type':_0x280ed3[_0xb00b('0x27')][_0xb00b('0x28')]};});_0x503c9c[_0xb00b('0x29')]=_[_0xb00b('0x2a')](_[_0xb00b('0x24')](_0x348165,_0xb00b('0x21')),['format']);_0x503c9c[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x15d3b9['query']);_0x503c9c[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x503c9c['model'],_0x503c9c[_0xb00b('0x2b')]);_0x22c22d['attributes']=_[_0xb00b('0x2e')](_0x503c9c[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x22c22d[_0xb00b('0x30')]=_0x22c22d[_0xb00b('0x30')]['length']?_0x22c22d['attributes']:_0x503c9c['model'];if(!_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x31')](_0xb00b('0x32'))){_0x22c22d[_0xb00b('0x19')]=qs['limit'](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x19')]);_0x22c22d[_0xb00b('0x1a')]=qs[_0xb00b('0x1a')](_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x1a')]);}_0x22c22d[_0xb00b('0x33')]=qs[_0xb00b('0x34')](_0x15d3b9['query']['sort']);_0x22c22d[_0xb00b('0x35')]=qs['filters'](_[_0xb00b('0x36')](_0x15d3b9[_0xb00b('0x2b')],_0x503c9c[_0xb00b('0x2d')]),_0x348165);if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x37')]){_0x22c22d[_0xb00b('0x35')]=_[_0xb00b('0x38')](_0x22c22d['where'],{'$or':_[_0xb00b('0x24')](_0x348165,function(_0x25578e){if(_0x25578e[_0xb00b('0x27')]!==_0xb00b('0x39')){var _0x2496e2={};_0x2496e2[_0x25578e[_0xb00b('0x21')]]={'$like':'%'+_0x15d3b9['query'][_0xb00b('0x37')]+'%'};return _0x2496e2;}})});}_0x22c22d=_[_0xb00b('0x38')]({},_0x22c22d,_0x15d3b9['options']);var _0x17ff34={'where':_0x22c22d[_0xb00b('0x35')]};return db[_0xb00b('0x3a')][_0xb00b('0x3b')](_0x17ff34)[_0xb00b('0x3c')](function(_0x5636b1){_0x450129[_0xb00b('0x3b')]=_0x5636b1;if(_0x15d3b9[_0xb00b('0x2b')][_0xb00b('0x3d')]){_0x22c22d[_0xb00b('0x3e')]=[{'all':!![]}];}return db['ScreenRecording']['findAll'](_0x22c22d);})[_0xb00b('0x3c')](function(_0xf6ae0c){_0x450129[_0xb00b('0x3f')]=_0xf6ae0c;return _0x450129;})[_0xb00b('0x3c')](respondWithFilteredResult(_0x4a8d2b,_0x22c22d))[_0xb00b('0x40')](handleError(_0x4a8d2b,null));};exports[_0xb00b('0x41')]=function(_0x275664,_0x493841){var _0x36200d={'raw':![],'where':{'id':_0x275664[_0xb00b('0x42')]['id']}},_0x3b72c4={};_0x3b72c4[_0xb00b('0x29')]=_[_0xb00b('0x2c')](db[_0xb00b('0x3a')][_0xb00b('0x25')]);_0x3b72c4[_0xb00b('0x2b')]=_[_0xb00b('0x2c')](_0x275664[_0xb00b('0x2b')]);_0x3b72c4[_0xb00b('0x2d')]=_[_0xb00b('0x2e')](_0x3b72c4['model'],_0x3b72c4[_0xb00b('0x2b')]);_0x36200d[_0xb00b('0x30')]=_[_0xb00b('0x2e')](_0x3b72c4[_0xb00b('0x29')],qs[_0xb00b('0x2f')](_0x275664[_0xb00b('0x2b')][_0xb00b('0x2f')]));_0x36200d[_0xb00b('0x30')]=_0x36200d[_0xb00b('0x30')][_0xb00b('0x43')]?_0x36200d[_0xb00b('0x30')]:_0x3b72c4[_0xb00b('0x29')];if(_0x275664['query']['includeAll']){_0x36200d['include']=[{'all':!![]}];}_0x36200d=_[_0xb00b('0x38')]({},_0x36200d,_0x275664[_0xb00b('0x44')]);return db['ScreenRecording'][_0xb00b('0x45')](_0x36200d)[_0xb00b('0x3c')](handleEntityNotFound(_0x493841,null))[_0xb00b('0x3c')](respondWithResult(_0x493841,null))[_0xb00b('0x40')](handleError(_0x493841,null));};exports['create']=function(_0x58e9cb,_0x172729){return db[_0xb00b('0x3a')]['create'](_0x58e9cb['body'],{})[_0xb00b('0x3c')](respondWithResult(_0x172729,0xc9))[_0xb00b('0x40')](handleError(_0x172729,null));};exports['update']=function(_0x2228e9,_0x47a814){if(_0x2228e9['body']['id']){delete _0x2228e9['body']['id'];}delete _0x2228e9[_0xb00b('0x46')]['duration'];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x47')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x48')];delete _0x2228e9[_0xb00b('0x46')][_0xb00b('0x49')];return db['ScreenRecording']['find']({'where':{'id':_0x2228e9[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](handleEntityNotFound(_0x47a814,null))['then'](saveUpdates(_0x2228e9[_0xb00b('0x46')],null))[_0xb00b('0x3c')](respondWithResult(_0x47a814,null))['catch'](handleError(_0x47a814,null));};exports[_0xb00b('0x4a')]=function(_0x10e066,_0x3b5d82){return db['ScreenRecording']['describe']()[_0xb00b('0x3c')](respondWithResult(_0x3b5d82,null))[_0xb00b('0x40')](handleError(_0x3b5d82,null));};exports[_0xb00b('0x4b')]=function(_0xde3cc1,_0x489b49,_0x380acb){var _0x3f31e5=require('../../components/encryptor');var _0x4cd9fd=![];var _0x160965={};if(_0xde3cc1['query'][_0xb00b('0x27')]&&_0xde3cc1[_0xb00b('0x2b')][_0xb00b('0x27')]===_0xb00b('0x4c')){_0x160965[_0xb00b('0x4c')]=_0xde3cc1[_0xb00b('0x42')]['id'];}else{_0x160965['id']=_0xde3cc1['params']['id'];}return db[_0xb00b('0x3a')]['find']({'where':_0x160965,'attributes':['id',_0xb00b('0x49')],'raw':!![]})[_0xb00b('0x3c')](handleEntityNotFound(_0x489b49,null))[_0xb00b('0x3c')](function(_0x5ac79e){if(_0x5ac79e){var _0x248335=path[_0xb00b('0x4d')](config[_0xb00b('0x4e')],'server/files/screen_recordings',_0x5ac79e[_0xb00b('0x49')]);var _0x309ae6=util[_0xb00b('0x4f')](_0xb00b('0x50'),_0x248335);if(fs[_0xb00b('0x51')](_0x309ae6)){_0x4cd9fd=!![];return _0x3f31e5[_0xb00b('0x52')](_0x309ae6,_0x248335,config[_0xb00b('0x53')][_0xb00b('0x54')])['then'](function(){return _0x5ac79e;});}return _0x5ac79e;}})[_0xb00b('0x3c')](function(_0x2cbe80){if(_0x2cbe80){var _0x1b4860=path['join'](config[_0xb00b('0x4e')],_0xb00b('0x55'),_0x2cbe80[_0xb00b('0x49')]);if(!fs[_0xb00b('0x51')](_0x1b4860)){throw new db[(_0xb00b('0x56'))]['ValidationError'](_0xb00b('0x57'));}if(_0x2cbe80[_0xb00b('0x58')]){return _0x489b49[_0xb00b('0x4b')](_0x1b4860,_0x2cbe80[_0xb00b('0x58')]+path['extname'](_0x1b4860),function(){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}else{return _0x489b49[_0xb00b('0x4b')](_0x1b4860,function(_0x2c93db){if(_0x4cd9fd){fs[_0xb00b('0x59')](_0x1b4860);}});}}})[_0xb00b('0x40')](function(_0x1e5ed8){if(_0x1e5ed8[_0xb00b('0x5a')]==='ScreenRecording\x20not\x20found'){_0x489b49[_0xb00b('0x16')](0x194)['send'](_0xb00b('0x5b'));}else{return handleError(_0x489b49,null);}});};exports['destroy']=function(_0x3b3272,_0x530d4a){return db[_0xb00b('0x3a')]['find']({'where':{'id':_0x3b3272[_0xb00b('0x42')]['id']}})[_0xb00b('0x3c')](function(_0x3bae02){if(_['isNil'](_0x3bae02)){throw new ReferenceError('Entity\x20not\x20found');}return _0x3bae02;})['then'](function(_0x21a53d){var _0x3126be=path[_0xb00b('0x4d')](config['root'],_0xb00b('0x55'),_0x21a53d[_0xb00b('0x49')]);logger[_0xb00b('0x5c')](_0xb00b('0x5d'),_0x3126be);if(!_[_0xb00b('0x5e')](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')]('File:\x20\x22'+_0x3126be+_0xb00b('0x5f'));fs[_0xb00b('0x60')](_0x3126be);}_0x3126be=_0x3126be+_0xb00b('0x61');if(!_['isNil'](_0x21a53d['value'])&&fs[_0xb00b('0x51')](_0x3126be)){logger[_0xb00b('0x5c')](_0xb00b('0x62')+_0x3126be+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x3126be);}return _0x21a53d;})['then'](function(_0x5e9677){if(!_0x5e9677)throw new InternalError();return _0x5e9677[_0xb00b('0x1e')]();})['then'](function(){_0x530d4a[_0xb00b('0x16')](0xcc)[_0xb00b('0x1f')]();})['catch'](handleError(_0x530d4a,null));}; \ No newline at end of file +var _0x7217=['path','sox','to-csv','ejs','fs-extra','lodash','squel','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','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','sendStatus','stack','send','index','map','ScreenRecording','fieldName','type','model','differenceBy','format','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','name','options','includeAll','rows','catch','params','rawAttributes','intersection','find','create','body','duration','createdAt','closedAt','value','describe','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','decryptFile','ValidationError','filename','extname','unlink','message','ScreenRecording\x20not\x20found','Not\x20found','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','existsSync','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird'];(function(_0x4c93ff,_0x1e4710){var _0x4ce46d=function(_0x2f8c9a){while(--_0x2f8c9a){_0x4c93ff['push'](_0x4c93ff['shift']());}};_0x4ce46d(++_0x1e4710);}(_0x7217,0x19e));var _0x7721=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x7217[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7721('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7721('0x1'));var jsonpatch=require(_0x7721('0x2'));var rp=require(_0x7721('0x3'));var moment=require(_0x7721('0x4'));var BPromise=require(_0x7721('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x7721('0x6'));var sox=require(_0x7721('0x7'));var csv=require(_0x7721('0x8'));var ejs=require(_0x7721('0x9'));var fs=require('fs');var fs_extra=require(_0x7721('0xa'));var _=require(_0x7721('0xb'));var squel=require(_0x7721('0xc'));var crypto=require(_0x7721('0xd'));var jsforce=require(_0x7721('0xe'));var deskjs=require(_0x7721('0xf'));var toCsv=require(_0x7721('0x8'));var querystring=require(_0x7721('0x10'));var Papa=require(_0x7721('0x11'));var Redis=require(_0x7721('0x12'));var authService=require(_0x7721('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7721('0x14'));var hardwareService=require(_0x7721('0x15'));var logger=require(_0x7721('0x16'))(_0x7721('0x17'));var utils=require(_0x7721('0x18'));var config=require(_0x7721('0x19'));var licenseUtil=require(_0x7721('0x1a'));var db=require(_0x7721('0x1b'))['db'];function respondWithStatusCode(_0x55b4ca,_0x2911ec){_0x2911ec=_0x2911ec||0xcc;return function(_0x199930){if(_0x199930){return _0x55b4ca['sendStatus'](_0x2911ec);}return _0x55b4ca[_0x7721('0x1c')](_0x2911ec)[_0x7721('0x1d')]();};}function respondWithResult(_0x3f01c5,_0x2e9752){_0x2e9752=_0x2e9752||0xc8;return function(_0x5069da){if(_0x5069da){return _0x3f01c5[_0x7721('0x1c')](_0x2e9752)[_0x7721('0x1e')](_0x5069da);}};}function respondWithFilteredResult(_0x534f1b,_0x4e199a){return function(_0x4b183e){if(_0x4b183e){var _0x5ed54=typeof _0x4e199a[_0x7721('0x1f')]===_0x7721('0x20')&&typeof _0x4e199a[_0x7721('0x21')]==='undefined';var _0x20f669=_0x4b183e['count'];var _0x3fc09e=_0x5ed54?0x0:_0x4e199a['offset'];var _0xfec626=_0x5ed54?_0x4b183e[_0x7721('0x22')]:_0x4e199a[_0x7721('0x1f')]+_0x4e199a[_0x7721('0x21')];var _0x2286e5;if(_0xfec626>=_0x20f669){_0xfec626=_0x20f669;_0x2286e5=0xc8;}else{_0x2286e5=0xce;}_0x534f1b[_0x7721('0x1c')](_0x2286e5);return _0x534f1b[_0x7721('0x23')](_0x7721('0x24'),_0x3fc09e+'-'+_0xfec626+'/'+_0x20f669)[_0x7721('0x1e')](_0x4b183e);}return null;};}function patchUpdates(_0xaeccc4){return function(_0x4ce1db){try{jsonpatch[_0x7721('0x25')](_0x4ce1db,_0xaeccc4,!![]);}catch(_0x2c1583){return BPromise[_0x7721('0x26')](_0x2c1583);}return _0x4ce1db[_0x7721('0x27')]();};}function saveUpdates(_0x57140c,_0x28f5a6){return function(_0x512f31){if(_0x512f31){return _0x512f31[_0x7721('0x28')](_0x57140c)[_0x7721('0x29')](function(_0x3e8a4e){return _0x3e8a4e;});}return null;};}function removeEntity(_0x1caad8,_0x121cc4){return function(_0x395b15){if(_0x395b15){return _0x395b15[_0x7721('0x2a')]()['then'](function(){_0x1caad8[_0x7721('0x1c')](0xcc)[_0x7721('0x1d')]();});}};}function handleEntityNotFound(_0x125564,_0x1f67c7){return function(_0x40d550){if(!_0x40d550){_0x125564[_0x7721('0x2b')](0x194);}return _0x40d550;};}function handleError(_0x424e05,_0xf753f1){_0xf753f1=_0xf753f1||0x1f4;return function(_0x40f367){logger['error'](_0x40f367[_0x7721('0x2c')]);if(_0x40f367['name']){delete _0x40f367['name'];}_0x424e05[_0x7721('0x1c')](_0xf753f1)[_0x7721('0x2d')](_0x40f367);};}exports[_0x7721('0x2e')]=function(_0x158d98,_0x1ea4d){var _0x37b9f0={},_0xd7d703={},_0x1da2d8={'count':0x0,'rows':[]};var _0x5c54f0=_[_0x7721('0x2f')](db[_0x7721('0x30')]['rawAttributes'],function(_0x4a25c9){return{'name':_0x4a25c9[_0x7721('0x31')],'type':_0x4a25c9[_0x7721('0x32')]['key']};});_0xd7d703[_0x7721('0x33')]=_[_0x7721('0x34')](_[_0x7721('0x2f')](_0x5c54f0,'name'),[_0x7721('0x35')]);_0xd7d703[_0x7721('0x36')]=_[_0x7721('0x37')](_0x158d98[_0x7721('0x36')]);_0xd7d703[_0x7721('0x38')]=_['intersection'](_0xd7d703[_0x7721('0x33')],_0xd7d703[_0x7721('0x36')]);_0x37b9f0[_0x7721('0x39')]=_['intersection'](_0xd7d703[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x158d98['query'][_0x7721('0x3a')]));_0x37b9f0['attributes']=_0x37b9f0[_0x7721('0x39')][_0x7721('0x3b')]?_0x37b9f0[_0x7721('0x39')]:_0xd7d703[_0x7721('0x33')];if(!_0x158d98[_0x7721('0x36')][_0x7721('0x3c')](_0x7721('0x3d'))){_0x37b9f0[_0x7721('0x21')]=qs[_0x7721('0x21')](_0x158d98[_0x7721('0x36')][_0x7721('0x21')]);_0x37b9f0['offset']=qs[_0x7721('0x1f')](_0x158d98['query'][_0x7721('0x1f')]);}_0x37b9f0[_0x7721('0x3e')]=qs[_0x7721('0x3f')](_0x158d98[_0x7721('0x36')][_0x7721('0x3f')]);_0x37b9f0[_0x7721('0x40')]=qs['filters'](_['pick'](_0x158d98['query'],_0xd7d703['filters']),_0x5c54f0);if(_0x158d98[_0x7721('0x36')][_0x7721('0x41')]){_0x37b9f0[_0x7721('0x40')]=_[_0x7721('0x42')](_0x37b9f0['where'],{'$or':_[_0x7721('0x2f')](_0x5c54f0,function(_0x4cf659){if(_0x4cf659[_0x7721('0x32')]!==_0x7721('0x43')){var _0x5a278e={};_0x5a278e[_0x4cf659[_0x7721('0x44')]]={'$like':'%'+_0x158d98[_0x7721('0x36')]['filter']+'%'};return _0x5a278e;}})});}_0x37b9f0=_['merge']({},_0x37b9f0,_0x158d98[_0x7721('0x45')]);var _0xfc4dc4={'where':_0x37b9f0[_0x7721('0x40')]};return db[_0x7721('0x30')]['count'](_0xfc4dc4)[_0x7721('0x29')](function(_0x120de9){_0x1da2d8[_0x7721('0x22')]=_0x120de9;if(_0x158d98[_0x7721('0x36')][_0x7721('0x46')]){_0x37b9f0['include']=[{'all':!![]}];}return db[_0x7721('0x30')]['findAll'](_0x37b9f0);})[_0x7721('0x29')](function(_0x4a5b59){_0x1da2d8[_0x7721('0x47')]=_0x4a5b59;return _0x1da2d8;})[_0x7721('0x29')](respondWithFilteredResult(_0x1ea4d,_0x37b9f0))[_0x7721('0x48')](handleError(_0x1ea4d,null));};exports['show']=function(_0x1453d4,_0x11d853){var _0x1ad315={'raw':![],'where':{'id':_0x1453d4[_0x7721('0x49')]['id']}},_0x481fa8={};_0x481fa8[_0x7721('0x33')]=_[_0x7721('0x37')](db[_0x7721('0x30')][_0x7721('0x4a')]);_0x481fa8[_0x7721('0x36')]=_[_0x7721('0x37')](_0x1453d4['query']);_0x481fa8['filters']=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],_0x481fa8[_0x7721('0x36')]);_0x1ad315[_0x7721('0x39')]=_[_0x7721('0x4b')](_0x481fa8[_0x7721('0x33')],qs[_0x7721('0x3a')](_0x1453d4[_0x7721('0x36')][_0x7721('0x3a')]));_0x1ad315[_0x7721('0x39')]=_0x1ad315['attributes']['length']?_0x1ad315[_0x7721('0x39')]:_0x481fa8[_0x7721('0x33')];if(_0x1453d4[_0x7721('0x36')][_0x7721('0x46')]){_0x1ad315['include']=[{'all':!![]}];}_0x1ad315=_[_0x7721('0x42')]({},_0x1ad315,_0x1453d4[_0x7721('0x45')]);return db['ScreenRecording'][_0x7721('0x4c')](_0x1ad315)['then'](handleEntityNotFound(_0x11d853,null))[_0x7721('0x29')](respondWithResult(_0x11d853,null))['catch'](handleError(_0x11d853,null));};exports[_0x7721('0x4d')]=function(_0x196be4,_0xf17c40){return db['ScreenRecording'][_0x7721('0x4d')](_0x196be4[_0x7721('0x4e')],{})['then'](respondWithResult(_0xf17c40,0xc9))[_0x7721('0x48')](handleError(_0xf17c40,null));};exports[_0x7721('0x28')]=function(_0xf88e8c,_0x5c4078){if(_0xf88e8c[_0x7721('0x4e')]['id']){delete _0xf88e8c['body']['id'];}delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x4f')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x50')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x51')];delete _0xf88e8c[_0x7721('0x4e')][_0x7721('0x52')];return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0xf88e8c[_0x7721('0x49')]['id']}})[_0x7721('0x29')](handleEntityNotFound(_0x5c4078,null))[_0x7721('0x29')](saveUpdates(_0xf88e8c[_0x7721('0x4e')],null))[_0x7721('0x29')](respondWithResult(_0x5c4078,null))['catch'](handleError(_0x5c4078,null));};exports[_0x7721('0x53')]=function(_0x2f6f30,_0x8e1214){return db[_0x7721('0x30')][_0x7721('0x53')]()[_0x7721('0x29')](respondWithResult(_0x8e1214,null))[_0x7721('0x48')](handleError(_0x8e1214,null));};exports['download']=function(_0x234bee,_0x17036e,_0x134908){var _0x3b7382=require(_0x7721('0x54'));var _0x9c0d4=![];var _0x7fbd6c={};if(_0x234bee[_0x7721('0x36')][_0x7721('0x32')]&&_0x234bee[_0x7721('0x36')][_0x7721('0x32')]==='uniqueid'){_0x7fbd6c[_0x7721('0x55')]=_0x234bee[_0x7721('0x49')]['id'];}else{_0x7fbd6c['id']=_0x234bee[_0x7721('0x49')]['id'];}return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':_0x7fbd6c,'attributes':['id',_0x7721('0x52')],'raw':!![]})[_0x7721('0x29')](handleEntityNotFound(_0x17036e,null))[_0x7721('0x29')](function(_0x360882){if(_0x360882){var _0x287452=path[_0x7721('0x56')](config[_0x7721('0x57')],_0x7721('0x58'),_0x360882[_0x7721('0x52')]);var _0x300ea4=util['format']('%s.cypher',_0x287452);if(fs['existsSync'](_0x300ea4)){_0x9c0d4=!![];return _0x3b7382[_0x7721('0x59')](_0x300ea4,_0x287452,config['secrets']['recording'])['then'](function(){return _0x360882;});}return _0x360882;}})['then'](function(_0x47925a){if(_0x47925a){var _0x219181=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x47925a['value']);if(!fs['existsSync'](_0x219181)){throw new db['Sequelize'][(_0x7721('0x5a'))]('ScreenRecording\x20not\x20found');}if(_0x47925a['filename']){return _0x17036e['download'](_0x219181,_0x47925a[_0x7721('0x5b')]+path[_0x7721('0x5c')](_0x219181),function(){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}else{return _0x17036e['download'](_0x219181,function(_0x2a025c){if(_0x9c0d4){fs[_0x7721('0x5d')](_0x219181);}});}}})[_0x7721('0x48')](function(_0x168343){if(_0x168343[_0x7721('0x5e')]===_0x7721('0x5f')){_0x17036e[_0x7721('0x1c')](0x194)[_0x7721('0x2d')](_0x7721('0x60'));}else{return handleError(_0x17036e,null);}});};exports[_0x7721('0x2a')]=function(_0x3b03cf,_0x10666e){return db[_0x7721('0x30')][_0x7721('0x4c')]({'where':{'id':_0x3b03cf[_0x7721('0x49')]['id']}})['then'](function(_0x233e5d){if(_[_0x7721('0x61')](_0x233e5d)){throw new ReferenceError(_0x7721('0x62'));}return _0x233e5d;})[_0x7721('0x29')](function(_0x542e30){var _0x103009=path[_0x7721('0x56')](config['root'],_0x7721('0x58'),_0x542e30['value']);logger[_0x7721('0x63')](_0x7721('0x64'),_0x103009);if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}_0x103009=_0x103009+'.cypher';if(!_[_0x7721('0x61')](_0x542e30[_0x7721('0x52')])&&fs[_0x7721('0x65')](_0x103009)){logger[_0x7721('0x63')](_0x7721('0x66')+_0x103009+_0x7721('0x67'));fs[_0x7721('0x68')](_0x103009);}return _0x542e30;})['then'](function(_0xb6f2f2){if(!_0xb6f2f2)throw new InternalError();return _0xb6f2f2[_0x7721('0x2a')]();})['then'](function(){_0x10666e[_0x7721('0x1c')](0xcc)['end']();})[_0x7721('0x48')](handleError(_0x10666e,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index b45a518..51aeea1 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 _0x6520=['api','moment','bluebird','request-promise','path','rimraf','./screenRecording.attributes','define','ScreenRecording','screen_recordings','interactionid','lodash','util','../../config/logger'];(function(_0x3170cc,_0x20b403){var _0x194e67=function(_0x4d6cf0){while(--_0x4d6cf0){_0x3170cc['push'](_0x3170cc['shift']());}};_0x194e67(++_0x20b403);}(_0x6520,0xc1));var _0x0652=function(_0xeb5d0d,_0x4ca941){_0xeb5d0d=_0xeb5d0d-0x0;var _0x5a36f8=_0x6520[_0xeb5d0d];return _0x5a36f8;};'use strict';var _=require(_0x0652('0x0'));var util=require(_0x0652('0x1'));var logger=require(_0x0652('0x2'))(_0x0652('0x3'));var moment=require(_0x0652('0x4'));var BPromise=require(_0x0652('0x5'));var rp=require(_0x0652('0x6'));var fs=require('fs');var path=require(_0x0652('0x7'));var rimraf=require(_0x0652('0x8'));var config=require('../../config/environment');var attributes=require(_0x0652('0x9'));module['exports']=function(_0x8f53ef,_0x36d062){return _0x8f53ef[_0x0652('0xa')](_0x0652('0xb'),attributes,{'tableName':_0x0652('0xc'),'paranoid':![],'indexes':[{'name':'interactionid','fields':[_0x0652('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x90e6=['path','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','api','moment','bluebird','request-promise'];(function(_0x3b41b5,_0x36da8b){var _0xc30195=function(_0x2f663e){while(--_0x2f663e){_0x3b41b5['push'](_0x3b41b5['shift']());}};_0xc30195(++_0x36da8b);}(_0x90e6,0x19f));var _0x690e=function(_0x1269c6,_0x1c8942){_0x1269c6=_0x1269c6-0x0;var _0x4868c7=_0x90e6[_0x1269c6];return _0x4868c7;};'use strict';var _=require(_0x690e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x690e('0x1'));var moment=require(_0x690e('0x2'));var BPromise=require(_0x690e('0x3'));var rp=require(_0x690e('0x4'));var fs=require('fs');var path=require(_0x690e('0x5'));var rimraf=require('rimraf');var config=require(_0x690e('0x6'));var attributes=require('./screenRecording.attributes');module[_0x690e('0x7')]=function(_0x5b9905,_0x2a4be1){return _0x5b9905[_0x690e('0x8')](_0x690e('0x9'),attributes,{'tableName':_0x690e('0xa'),'paranoid':![],'indexes':[{'name':_0x690e('0xb'),'fields':[_0x690e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 89ba38c..2f7f669 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 _0xb6a1=['catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','result'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xb6a1,0x1ba));var _0x1b6a=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0xb6a1[_0x580576];return _0x3f55a0;};'use strict';var _=require(_0x1b6a('0x0'));var util=require('util');var moment=require(_0x1b6a('0x1'));var BPromise=require(_0x1b6a('0x2'));var rs=require(_0x1b6a('0x3'));var fs=require('fs');var Redis=require(_0x1b6a('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1b6a('0x5'));var logger=require(_0x1b6a('0x6'))(_0x1b6a('0x7'));var config=require(_0x1b6a('0x8'));var jayson=require(_0x1b6a('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x58edc0,_0x4aed97,_0x5b8425){return new BPromise(function(_0x1d79f3,_0x28fe17){return client['request'](_0x58edc0,_0x5b8425)[_0x1b6a('0xa')](function(_0x2a3081){logger[_0x1b6a('0xb')](_0x1b6a('0xc'),_0x4aed97,_0x1b6a('0xd'));logger[_0x1b6a('0xe')](_0x1b6a('0xf'),_0x4aed97,'request\x20sent',JSON[_0x1b6a('0x10')](_0x2a3081));if(_0x2a3081[_0x1b6a('0x11')]){if(_0x2a3081['error']['code']===0x1f4){logger['error'](_0x1b6a('0xc'),_0x4aed97,_0x2a3081['error'][_0x1b6a('0x12')]);return _0x28fe17(_0x2a3081[_0x1b6a('0x11')][_0x1b6a('0x12')]);}logger[_0x1b6a('0x11')](_0x1b6a('0xc'),_0x4aed97,_0x2a3081['error'][_0x1b6a('0x12')]);return _0x1d79f3(_0x2a3081[_0x1b6a('0x11')][_0x1b6a('0x12')]);}else{logger[_0x1b6a('0xb')](_0x1b6a('0xc'),_0x4aed97,_0x1b6a('0xd'));_0x1d79f3(_0x2a3081[_0x1b6a('0x13')][_0x1b6a('0x12')]);}})[_0x1b6a('0x14')](function(_0x557c44){logger[_0x1b6a('0x11')](_0x1b6a('0xc'),_0x4aed97,_0x557c44);_0x28fe17(_0x557c44);});});} \ No newline at end of file +var _0x7a9a=['http','request','then','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../config/utils','rpc','../../config/environment'];(function(_0x8b8564,_0x162976){var _0x360c61=function(_0x164cc9){while(--_0x164cc9){_0x8b8564['push'](_0x8b8564['shift']());}};_0x360c61(++_0x162976);}(_0x7a9a,0x187));var _0xa7a9=function(_0x3c1f87,_0x1a56be){_0x3c1f87=_0x3c1f87-0x0;var _0x5d154b=_0x7a9a[_0x3c1f87];return _0x5d154b;};'use strict';var _=require(_0xa7a9('0x0'));var util=require(_0xa7a9('0x1'));var moment=require(_0xa7a9('0x2'));var BPromise=require(_0xa7a9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa7a9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa7a9('0x5'));var logger=require('../../config/logger')(_0xa7a9('0x6'));var config=require(_0xa7a9('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xa7a9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x29ffa4,_0x5950ce,_0xe71f0a){return new BPromise(function(_0xa0090a,_0x50de1e){return client[_0xa7a9('0x9')](_0x29ffa4,_0xe71f0a)[_0xa7a9('0xa')](function(_0x1087ea){logger[_0xa7a9('0xb')](_0xa7a9('0xc'),_0x5950ce,_0xa7a9('0xd'));logger['debug']('ScreenRecording,\x20%s,\x20%s,\x20%s',_0x5950ce,_0xa7a9('0xd'),JSON[_0xa7a9('0xe')](_0x1087ea));if(_0x1087ea[_0xa7a9('0xf')]){if(_0x1087ea[_0xa7a9('0xf')][_0xa7a9('0x10')]===0x1f4){logger[_0xa7a9('0xf')](_0xa7a9('0xc'),_0x5950ce,_0x1087ea[_0xa7a9('0xf')][_0xa7a9('0x11')]);return _0x50de1e(_0x1087ea['error'][_0xa7a9('0x11')]);}logger[_0xa7a9('0xf')]('ScreenRecording,\x20%s,\x20%s',_0x5950ce,_0x1087ea[_0xa7a9('0xf')]['message']);return _0xa0090a(_0x1087ea[_0xa7a9('0xf')][_0xa7a9('0x11')]);}else{logger[_0xa7a9('0xb')](_0xa7a9('0xc'),_0x5950ce,_0xa7a9('0xd'));_0xa0090a(_0x1087ea['result']['message']);}})[_0xa7a9('0x12')](function(_0x1d6675){logger['error']('ScreenRecording,\x20%s,\x20%s',_0x5950ce,_0x1d6675);_0x50de1e(_0x1d6675);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 7783d9a..ad1c2c0 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 _0xd4cc=['extname','post','single','addLogoLogin','root','addPreferred','favicon','put','update','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/now','getDate','/:id','/:id/logo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','/:id/preferred','getPreferred','/:id/favicon','getFavicon','diskStorage','join','server/files/images/logos/','format','logo','originalname','file','addLogo','%s%s','logologin'];(function(_0x4c3b7a,_0x114233){var _0x2e97ac=function(_0x3429e7){while(--_0x3429e7){_0x4c3b7a['push'](_0x4c3b7a['shift']());}};_0x2e97ac(++_0x114233);}(_0xd4cc,0x162));var _0xcd4c=function(_0x782f6f,_0x69cd82){_0x782f6f=_0x782f6f-0x0;var _0x2e3a78=_0xd4cc[_0x782f6f];return _0x2e3a78;};'use strict';var multer=require(_0xcd4c('0x0'));var util=require('util');var path=require(_0xcd4c('0x1'));var timeout=require(_0xcd4c('0x2'));var express=require(_0xcd4c('0x3'));var router=express[_0xcd4c('0x4')]();var fs_extra=require(_0xcd4c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xcd4c('0x6'));var config=require(_0xcd4c('0x7'));var controller=require('./setting.controller');router[_0xcd4c('0x8')]('/',auth[_0xcd4c('0x9')](),controller[_0xcd4c('0xa')]);router['get'](_0xcd4c('0xb'),controller[_0xcd4c('0xc')]);router[_0xcd4c('0x8')](_0xcd4c('0xd'),controller['show']);router['get'](_0xcd4c('0xe'),controller['getLogo']);router['get'](_0xcd4c('0xf'),controller[_0xcd4c('0x10')]);router[_0xcd4c('0x8')](_0xcd4c('0x11'),controller[_0xcd4c('0x12')]);router['get'](_0xcd4c('0x13'),controller[_0xcd4c('0x14')]);router[_0xcd4c('0x8')](_0xcd4c('0x15'),controller[_0xcd4c('0x16')]);var upload=multer({'storage':multer[_0xcd4c('0x17')]({'destination':function(_0x526e30,_0x3a2ac9,_0x3b1fe0){_0x3b1fe0(null,path[_0xcd4c('0x18')](config['root'],_0xcd4c('0x19')));},'filename':function(_0x572d90,_0x5ca2bd,_0x23eca1){_0x23eca1(null,util[_0xcd4c('0x1a')]('%s%s',_0xcd4c('0x1b'),path['extname'](_0x5ca2bd[_0xcd4c('0x1c')])));}})});router['post'](_0xcd4c('0xe'),upload['single'](_0xcd4c('0x1d')),controller[_0xcd4c('0x1e')]);var upload=multer({'storage':multer[_0xcd4c('0x17')]({'destination':function(_0x16b3ce,_0x17b5be,_0x34da37){_0x34da37(null,path[_0xcd4c('0x18')](config['root'],_0xcd4c('0x19')));},'filename':function(_0x45be29,_0x3d2a6b,_0x4a19a5){_0x4a19a5(null,util['format'](_0xcd4c('0x1f'),_0xcd4c('0x20'),path[_0xcd4c('0x21')](_0x3d2a6b[_0xcd4c('0x1c')])));}})});router[_0xcd4c('0x22')](_0xcd4c('0xf'),upload[_0xcd4c('0x23')](_0xcd4c('0x1d')),controller[_0xcd4c('0x24')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x343947,_0x2821b3,_0xa55e32){_0xa55e32(null,path['join'](config[_0xcd4c('0x25')],_0xcd4c('0x19')));},'filename':function(_0x989ba1,_0x165f24,_0x508d9a){_0x508d9a(null,util[_0xcd4c('0x1a')](_0xcd4c('0x1f'),'preferred',path[_0xcd4c('0x21')](_0x165f24[_0xcd4c('0x1c')])));}})});router[_0xcd4c('0x22')](_0xcd4c('0x13'),upload['single'](_0xcd4c('0x1d')),controller[_0xcd4c('0x26')]);var upload=multer({'storage':multer[_0xcd4c('0x17')]({'destination':function(_0x277306,_0x40a084,_0x4c13c9){_0x4c13c9(null,path[_0xcd4c('0x18')](config[_0xcd4c('0x25')],_0xcd4c('0x19')));},'filename':function(_0x5f3864,_0x179fa7,_0x5f1c7c){_0x5f1c7c(null,util['format'](_0xcd4c('0x1f'),_0xcd4c('0x27'),path['extname'](_0x179fa7['originalname'])));}})});router[_0xcd4c('0x22')]('/:id/favicon',upload['single'](_0xcd4c('0x1d')),controller['addFavicon']);router[_0xcd4c('0x28')]('/:id',auth[_0xcd4c('0x9')](),controller[_0xcd4c('0x29')]);module[_0xcd4c('0x2a')]=router; \ No newline at end of file +var _0xb43a=['diskStorage','format','extname','post','addLogoLogin','preferred','favicon','/:id/favicon','addFavicon','/:id','isAuthenticated','update','exports','multer','util','path','express','fs-extra','../../components/interaction/service','../../config/environment','./setting.controller','get','index','/now','getDate','show','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','/:id/preferred','getPreferred','getFavicon','join','root','server/files/images/logos/','%s%s','logo','originalname','/:id/logo','single','file','addLogo'];(function(_0x23ae90,_0x543359){var _0xad9e57=function(_0x2023dd){while(--_0x2023dd){_0x23ae90['push'](_0x23ae90['shift']());}};_0xad9e57(++_0x543359);}(_0xb43a,0x10f));var _0xab43=function(_0x3e182f,_0x380ec7){_0x3e182f=_0x3e182f-0x0;var _0x23edc9=_0xb43a[_0x3e182f];return _0x23edc9;};'use strict';var multer=require(_0xab43('0x0'));var util=require(_0xab43('0x1'));var path=require(_0xab43('0x2'));var timeout=require('connect-timeout');var express=require(_0xab43('0x3'));var router=express['Router']();var fs_extra=require(_0xab43('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xab43('0x5'));var config=require(_0xab43('0x6'));var controller=require(_0xab43('0x7'));router[_0xab43('0x8')]('/',auth['isAuthenticated'](),controller[_0xab43('0x9')]);router[_0xab43('0x8')](_0xab43('0xa'),controller[_0xab43('0xb')]);router[_0xab43('0x8')]('/:id',controller[_0xab43('0xc')]);router[_0xab43('0x8')]('/:id/logo',controller[_0xab43('0xd')]);router[_0xab43('0x8')](_0xab43('0xe'),controller[_0xab43('0xf')]);router[_0xab43('0x8')](_0xab43('0x10'),controller['gdpr']);router[_0xab43('0x8')](_0xab43('0x11'),controller[_0xab43('0x12')]);router[_0xab43('0x8')]('/:id/favicon',controller[_0xab43('0x13')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x5b9893,_0x24b4dd,_0x774661){_0x774661(null,path[_0xab43('0x14')](config[_0xab43('0x15')],_0xab43('0x16')));},'filename':function(_0x207414,_0x401405,_0xe077ad){_0xe077ad(null,util['format'](_0xab43('0x17'),_0xab43('0x18'),path['extname'](_0x401405[_0xab43('0x19')])));}})});router['post'](_0xab43('0x1a'),upload[_0xab43('0x1b')](_0xab43('0x1c')),controller[_0xab43('0x1d')]);var upload=multer({'storage':multer[_0xab43('0x1e')]({'destination':function(_0x4a1951,_0x1b5ff7,_0x55654b){_0x55654b(null,path[_0xab43('0x14')](config[_0xab43('0x15')],_0xab43('0x16')));},'filename':function(_0x50371f,_0x463fe3,_0x34916b){_0x34916b(null,util[_0xab43('0x1f')](_0xab43('0x17'),'logologin',path[_0xab43('0x20')](_0x463fe3[_0xab43('0x19')])));}})});router[_0xab43('0x21')]('/:id/logo_login',upload['single'](_0xab43('0x1c')),controller[_0xab43('0x22')]);var upload=multer({'storage':multer[_0xab43('0x1e')]({'destination':function(_0x33f932,_0x4847f5,_0x512fc4){_0x512fc4(null,path['join'](config[_0xab43('0x15')],_0xab43('0x16')));},'filename':function(_0x2dc288,_0x1754eb,_0x54ddfc){_0x54ddfc(null,util['format'](_0xab43('0x17'),_0xab43('0x23'),path[_0xab43('0x20')](_0x1754eb[_0xab43('0x19')])));}})});router['post'](_0xab43('0x11'),upload[_0xab43('0x1b')]('file'),controller['addPreferred']);var upload=multer({'storage':multer[_0xab43('0x1e')]({'destination':function(_0x4ffc0f,_0x79b4aa,_0x3394eb){_0x3394eb(null,path[_0xab43('0x14')](config[_0xab43('0x15')],_0xab43('0x16')));},'filename':function(_0x3a4374,_0x428363,_0x49891f){_0x49891f(null,util[_0xab43('0x1f')](_0xab43('0x17'),_0xab43('0x24'),path[_0xab43('0x20')](_0x428363[_0xab43('0x19')])));}})});router[_0xab43('0x21')](_0xab43('0x25'),upload[_0xab43('0x1b')](_0xab43('0x1c')),controller[_0xab43('0x26')]);router['put'](_0xab43('0x27'),auth[_0xab43('0x28')](),controller[_0xab43('0x29')]);module[_0xab43('0x2a')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index a94ab81..52d9cc5 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 _0x0b0e=['INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate','UNSIGNED','sequelize'];(function(_0x26c176,_0x5e157b){var _0x425bc3=function(_0x3cd1bd){while(--_0x3cd1bd){_0x26c176['push'](_0x26c176['shift']());}};_0x425bc3(++_0x5e157b);}(_0x0b0e,0x187));var _0xe0b0=function(_0x39106e,_0x586f3d){_0x39106e=_0x39106e-0x0;var _0x892aec=_0x0b0e[_0x39106e];return _0x892aec;};'use strict';var Sequelize=require(_0xe0b0('0x0'));module['exports']={'min_internal':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0xe0b0('0x1')](0xb),'unique':_0xe0b0('0x2'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize[_0xe0b0('0x1')](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x4')},'logo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0xe0b0('0x3')]},'defaultLoginLogo':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0xe0b0('0x3')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'securePassword':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnaddr':{'type':Sequelize[_0xe0b0('0x3')]},'turnusername':{'type':Sequelize[_0xe0b0('0x3')]},'turnpassword':{'type':Sequelize[_0xe0b0('0x3')]},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'split':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0xe0b0('0x3')],'defaultValue':_0xe0b0('0x6')},'chatTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0xe0b0('0x3')]},'allowedLoginAttempts':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0xa},'favicon':{'type':Sequelize['STRING']},'defaultFavicon':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize['INTEGER'],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0xe0b0('0x3')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0xe0b0('0x1')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0xe0b0('0x3')]},'googleSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize['INTEGER'](0x2)[_0xe0b0('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize['INTEGER'](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0xe0b0('0x1')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0xe0b0('0x5')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0xe0b0('0x1')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x7a54=['UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted','BOOLEAN','alternate'];(function(_0x28b35e,_0x349a93){var _0x400acb=function(_0x426192){while(--_0x426192){_0x28b35e['push'](_0x28b35e['shift']());}};_0x400acb(++_0x349a93);}(_0x7a54,0x106));var _0x47a5=function(_0x559bb6,_0x2aec03){_0x559bb6=_0x559bb6-0x0;var _0x247ccd=_0x7a54[_0x559bb6];return _0x247ccd;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'min_internal':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize[_0x47a5('0x2')](0xb),'unique':_0x47a5('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x5')},'logo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLogo':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x47a5('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x47a5('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x47a5('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize['STRING']},'defaultPageTitle':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize['STRING'],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'split':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x47a5('0x4')],'defaultValue':_0x47a5('0x7')},'chatTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize[_0x47a5('0x4')]},'defaultPreferred':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x47a5('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x47a5('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize[_0x47a5('0x2')]},'transcribeRegion':{'type':Sequelize[_0x47a5('0x4')]},'sentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x47a5('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize['STRING']},'bucket':{'type':Sequelize[_0x47a5('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x47a5('0x2')](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize['INTEGER'](0x2)[_0x47a5('0x8')],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize[_0x47a5('0x2')],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x47a5('0x6')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index bbf3965..11ad215 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 _0x402b=['filter','merge','VIRTUAL','options','rows','show','includeAll','include','find','body','params','addLogo','file','filename','addLogoLogin','loginLogo','getLogo','server/files/images/logos','getLicense','logo','preferred','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','toLower','join','root','default_logo.svg','default','custom','existsSync','Sequelize','ValidationError','upperFirst','\x20not\x20found','download','getLogoLogin','default_loginLogo.svg','securePassword','default_preferred.png','getFavicon','default_favicon.ico','getDate','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','send','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','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','jayson/promise','client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','sendStatus','stack','name','index','map','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick'];(function(_0x10a80a,_0x1b85ff){var _0x50dce4=function(_0x49aaad){while(--_0x49aaad){_0x10a80a['push'](_0x10a80a['shift']());}};_0x50dce4(++_0x1b85ff);}(_0x402b,0x1bb));var _0xb402=function(_0x1a333d,_0x483830){_0x1a333d=_0x1a333d-0x0;var _0x147e89=_0x402b[_0x1a333d];return _0x147e89;};'use strict';var emlformat=require(_0xb402('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb402('0x1'));var jsonpatch=require(_0xb402('0x2'));var rp=require(_0xb402('0x3'));var moment=require('moment');var BPromise=require(_0xb402('0x4'));var Mustache=require(_0xb402('0x5'));var util=require('util');var path=require(_0xb402('0x6'));var sox=require(_0xb402('0x7'));var csv=require(_0xb402('0x8'));var ejs=require(_0xb402('0x9'));var fs=require('fs');var fs_extra=require(_0xb402('0xa'));var _=require(_0xb402('0xb'));var squel=require(_0xb402('0xc'));var crypto=require(_0xb402('0xd'));var jsforce=require(_0xb402('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xb402('0x8'));var querystring=require(_0xb402('0xf'));var Papa=require(_0xb402('0x10'));var Redis=require(_0xb402('0x11'));var authService=require(_0xb402('0x12'));var qs=require(_0xb402('0x13'));var as=require(_0xb402('0x14'));var hardwareService=require(_0xb402('0x15'));var logger=require(_0xb402('0x16'))(_0xb402('0x17'));var utils=require(_0xb402('0x18'));var config=require(_0xb402('0x19'));var licenseUtil=require(_0xb402('0x1a'));var db=require(_0xb402('0x1b'))['db'];var jayson=require(_0xb402('0x1c'));var client=jayson[_0xb402('0x1d')][_0xb402('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3dc434,_0x444585,_0x4102d3,_0x5992c3){return new BPromise(function(_0x109a33,_0x47c637){var _0x46fe7a=_0x5992c3||client;return _0x46fe7a['request'](_0x3dc434,_0x4102d3)[_0xb402('0x1f')](function(_0x15765b){logger[_0xb402('0x20')](_0xb402('0x21'),_0x444585,_0xb402('0x22'));logger[_0xb402('0x23')](_0xb402('0x24'),_0x444585,_0xb402('0x22'),JSON[_0xb402('0x25')](_0x15765b));if(_0x15765b[_0xb402('0x26')]){if(_0x15765b[_0xb402('0x26')][_0xb402('0x27')]===0x1f4){logger[_0xb402('0x26')](_0xb402('0x21'),_0x444585,_0x15765b[_0xb402('0x26')][_0xb402('0x28')]);return _0x47c637(_0x15765b['error'][_0xb402('0x28')]);}logger[_0xb402('0x26')]('Setting,\x20%s,\x20%s',_0x444585,_0x15765b[_0xb402('0x26')][_0xb402('0x28')]);return _0x109a33(_0x15765b['error'][_0xb402('0x28')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x444585,_0xb402('0x22'));_0x109a33(_0x15765b[_0xb402('0x29')]['message']);}})[_0xb402('0x2a')](function(_0x1f29cc){logger['error'](_0xb402('0x21'),_0x444585,_0x1f29cc);_0x47c637(_0x1f29cc);});});}function respondWithStatusCode(_0x272872,_0x4fecbc){_0x4fecbc=_0x4fecbc||0xcc;return function(_0x27aa2f){if(_0x27aa2f){return _0x272872['sendStatus'](_0x4fecbc);}return _0x272872[_0xb402('0x2b')](_0x4fecbc)[_0xb402('0x2c')]();};}function respondWithResult(_0xd4a1c,_0x1a822c){_0x1a822c=_0x1a822c||0xc8;return function(_0x20f4c8){if(_0x20f4c8){return _0xd4a1c[_0xb402('0x2b')](_0x1a822c)['json'](_0x20f4c8);}};}function respondWithFilteredResult(_0x22e593,_0x3d1a0d){return function(_0x185221){if(_0x185221){var _0x221fcd=typeof _0x3d1a0d[_0xb402('0x2d')]===_0xb402('0x2e')&&typeof _0x3d1a0d[_0xb402('0x2f')]===_0xb402('0x2e');var _0x2770f3=_0x185221['count'];var _0x1aa202=_0x221fcd?0x0:_0x3d1a0d['offset'];var _0x3b9095=_0x221fcd?_0x185221[_0xb402('0x30')]:_0x3d1a0d[_0xb402('0x2d')]+_0x3d1a0d['limit'];var _0x41abff;if(_0x3b9095>=_0x2770f3){_0x3b9095=_0x2770f3;_0x41abff=0xc8;}else{_0x41abff=0xce;}_0x22e593[_0xb402('0x2b')](_0x41abff);return _0x22e593[_0xb402('0x31')](_0xb402('0x32'),_0x1aa202+'-'+_0x3b9095+'/'+_0x2770f3)[_0xb402('0x33')](_0x185221);}return null;};}function patchUpdates(_0x41eff4){return function(_0x457a7a){try{jsonpatch[_0xb402('0x34')](_0x457a7a,_0x41eff4,!![]);}catch(_0x1cfb98){return BPromise[_0xb402('0x35')](_0x1cfb98);}return _0x457a7a[_0xb402('0x36')]();};}function saveUpdates(_0x3eb2ea,_0x3db058){return function(_0x53dfb4){if(_0x53dfb4){return _0x53dfb4[_0xb402('0x37')](_0x3eb2ea)[_0xb402('0x1f')](function(_0x48d795){return _0x48d795;});}return null;};}function removeEntity(_0x21ce2b,_0x34fb54){return function(_0x387e15){if(_0x387e15){return _0x387e15[_0xb402('0x38')]()[_0xb402('0x1f')](function(){_0x21ce2b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dc88c,_0x1a0963){return function(_0x1e8a40){if(!_0x1e8a40){_0x5dc88c[_0xb402('0x39')](0x194);}return _0x1e8a40;};}function handleError(_0x5dba42,_0x5bf1a0){_0x5bf1a0=_0x5bf1a0||0x1f4;return function(_0x11a938){logger['error'](_0x11a938[_0xb402('0x3a')]);if(_0x11a938[_0xb402('0x3b')]){delete _0x11a938[_0xb402('0x3b')];}_0x5dba42[_0xb402('0x2b')](_0x5bf1a0)['send'](_0x11a938);};}exports[_0xb402('0x3c')]=function(_0x1fc8cd,_0x24b7b8){var _0x328df0={},_0x3c28f4={},_0x24a9e6={'count':0x0,'rows':[]};var _0x29bb28=_[_0xb402('0x3d')](db[_0xb402('0x3e')][_0xb402('0x3f')],function(_0x561aea){return{'name':_0x561aea[_0xb402('0x40')],'type':_0x561aea[_0xb402('0x41')][_0xb402('0x42')]};});_0x3c28f4[_0xb402('0x43')]=_[_0xb402('0x3d')](_0x29bb28,'name');_0x3c28f4[_0xb402('0x44')]=_[_0xb402('0x45')](_0x1fc8cd[_0xb402('0x44')]);_0x3c28f4[_0xb402('0x46')]=_[_0xb402('0x47')](_0x3c28f4[_0xb402('0x43')],_0x3c28f4[_0xb402('0x44')]);_0x328df0['attributes']=_[_0xb402('0x47')](_0x3c28f4['model'],qs[_0xb402('0x48')](_0x1fc8cd[_0xb402('0x44')][_0xb402('0x48')]));_0x328df0[_0xb402('0x49')]=_0x328df0[_0xb402('0x49')][_0xb402('0x4a')]?_0x328df0[_0xb402('0x49')]:_0x3c28f4[_0xb402('0x43')];if(!_0x1fc8cd['query'][_0xb402('0x4b')](_0xb402('0x4c'))){_0x328df0['limit']=qs[_0xb402('0x2f')](_0x1fc8cd[_0xb402('0x44')][_0xb402('0x2f')]);_0x328df0[_0xb402('0x2d')]=qs[_0xb402('0x2d')](_0x1fc8cd['query'][_0xb402('0x2d')]);}_0x328df0[_0xb402('0x4d')]=qs[_0xb402('0x4e')](_0x1fc8cd[_0xb402('0x44')]['sort']);_0x328df0[_0xb402('0x4f')]=qs['filters'](_[_0xb402('0x50')](_0x1fc8cd[_0xb402('0x44')],_0x3c28f4[_0xb402('0x46')]),_0x29bb28);if(_0x1fc8cd[_0xb402('0x44')][_0xb402('0x51')]){_0x328df0[_0xb402('0x4f')]=_[_0xb402('0x52')](_0x328df0[_0xb402('0x4f')],{'$or':_['map'](_0x29bb28,function(_0x21176d){if(_0x21176d[_0xb402('0x41')]!==_0xb402('0x53')){var _0x2de10b={};_0x2de10b[_0x21176d['name']]={'$like':'%'+_0x1fc8cd['query'][_0xb402('0x51')]+'%'};return _0x2de10b;}})});}_0x328df0=_[_0xb402('0x52')]({},_0x328df0,_0x1fc8cd[_0xb402('0x54')]);var _0x5528a3={'where':_0x328df0[_0xb402('0x4f')]};return db['Setting'][_0xb402('0x30')](_0x5528a3)['then'](function(_0x97e03a){_0x24a9e6['count']=_0x97e03a;if(_0x1fc8cd[_0xb402('0x44')]['includeAll']){_0x328df0['include']=[{'all':!![]}];}return db['Setting']['findAll'](_0x328df0);})[_0xb402('0x1f')](function(_0x1aa2a9){_0x24a9e6[_0xb402('0x55')]=_0x1aa2a9;return _0x24a9e6;})[_0xb402('0x1f')](respondWithFilteredResult(_0x24b7b8,_0x328df0))[_0xb402('0x2a')](handleError(_0x24b7b8,null));};exports[_0xb402('0x56')]=function(_0x5e1682,_0x2a8fc9){var _0x3b24a7={'raw':![],'where':{'id':_0x5e1682['params']['id']}},_0x27b36e={};_0x27b36e[_0xb402('0x43')]=_[_0xb402('0x45')](db[_0xb402('0x3e')]['rawAttributes']);_0x27b36e[_0xb402('0x44')]=_[_0xb402('0x45')](_0x5e1682[_0xb402('0x44')]);_0x27b36e['filters']=_[_0xb402('0x47')](_0x27b36e[_0xb402('0x43')],_0x27b36e[_0xb402('0x44')]);_0x3b24a7[_0xb402('0x49')]=_['intersection'](_0x27b36e[_0xb402('0x43')],qs['fields'](_0x5e1682[_0xb402('0x44')][_0xb402('0x48')]));_0x3b24a7['attributes']=_0x3b24a7['attributes'][_0xb402('0x4a')]?_0x3b24a7[_0xb402('0x49')]:_0x27b36e[_0xb402('0x43')];if(_0x5e1682[_0xb402('0x44')][_0xb402('0x57')]){_0x3b24a7[_0xb402('0x58')]=[{'all':!![]}];}_0x3b24a7=_[_0xb402('0x52')]({},_0x3b24a7,_0x5e1682[_0xb402('0x54')]);return db['Setting'][_0xb402('0x59')](_0x3b24a7)[_0xb402('0x1f')](handleEntityNotFound(_0x2a8fc9,null))[_0xb402('0x1f')](respondWithResult(_0x2a8fc9,null))[_0xb402('0x2a')](handleError(_0x2a8fc9,null));};exports['update']=function(_0x1d8d2c,_0x4ad498){if(_0x1d8d2c['body']['id']){delete _0x1d8d2c[_0xb402('0x5a')]['id'];}return db[_0xb402('0x3e')][_0xb402('0x59')]({'where':{'id':_0x1d8d2c[_0xb402('0x5b')]['id']}})[_0xb402('0x1f')](handleEntityNotFound(_0x4ad498,null))[_0xb402('0x1f')](saveUpdates(_0x1d8d2c['body'],null))[_0xb402('0x1f')](respondWithResult(_0x4ad498,null))[_0xb402('0x2a')](handleError(_0x4ad498,null));};exports[_0xb402('0x5c')]=function(_0x3b4292,_0x21ab50,_0xba8387){if(_0x3b4292['file']&&_0x3b4292[_0xb402('0x5d')][_0xb402('0x5e')]){_0x3b4292[_0xb402('0x5a')]['logo']=_0x3b4292['file'][_0xb402('0x5e')];}return db['Setting'][_0xb402('0x59')]({'where':{'id':_0x3b4292[_0xb402('0x5b')]['id']}})[_0xb402('0x1f')](handleEntityNotFound(_0x21ab50,null))[_0xb402('0x1f')](saveUpdates(_0x3b4292['body'],null))[_0xb402('0x1f')](respondWithResult(_0x21ab50,null))['catch'](handleError(_0x21ab50,null));};exports[_0xb402('0x5f')]=function(_0x4db1fa,_0x48b566,_0x4fbfff){if(_0x4db1fa['file']&&_0x4db1fa[_0xb402('0x5d')][_0xb402('0x5e')]){_0x4db1fa[_0xb402('0x5a')][_0xb402('0x60')]=_0x4db1fa['file'][_0xb402('0x5e')];}return db[_0xb402('0x3e')]['find']({'where':{'id':_0x4db1fa[_0xb402('0x5b')]['id']}})[_0xb402('0x1f')](handleEntityNotFound(_0x48b566,null))[_0xb402('0x1f')](saveUpdates(_0x4db1fa[_0xb402('0x5a')],null))[_0xb402('0x1f')](respondWithResult(_0x48b566,null))[_0xb402('0x2a')](handleError(_0x48b566,null));};var utilLicense=require(_0xb402('0x1a'));exports[_0xb402('0x61')]=function(_0x58a432,_0x46971a,_0x1888ef){var _0x38a31c=_0xb402('0x62');var _0x2d9b3c={'custom':![]};return utilLicense[_0xb402('0x63')]()['then'](function(_0x47394a){if(_0x47394a){_0x2d9b3c=_0x47394a;}return db['Setting']['find']({'where':{'id':_0x58a432[_0xb402('0x5b')]['id']},'attributes':[_0xb402('0x64'),'loginLogo',_0xb402('0x65'),_0xb402('0x66'),_0xb402('0x67'),_0xb402('0x68'),_0xb402('0x69'),_0xb402('0x6a')],'raw':!![]});})[_0xb402('0x1f')](handleEntityNotFound(_0x46971a,null))[_0xb402('0x1f')](function(_0x6f339b){if(_0x6f339b){var _0x537240=_0x6f339b[_0xb402('0x64')]&&fs['existsSync'](path['join'](config['root'],_0x38a31c,_[_0xb402('0x6b')](_0x6f339b[_0xb402('0x64')])))?path[_0xb402('0x6c')](config[_0xb402('0x6d')],_0x38a31c,_['toLower'](_0x6f339b[_0xb402('0x64')])):path[_0xb402('0x6c')](config['root'],_0x38a31c,_[_0xb402('0x6b')](_0xb402('0x6e')));var _0x5c6409=_0xb402('0x6f')+_['upperFirst'](_0xb402('0x64'));if(_0x6f339b[_0x5c6409]||!_0x2d9b3c[_0xb402('0x70')]){_0x537240=path['join'](config[_0xb402('0x6d')],_0x38a31c,_[_0xb402('0x6b')]('default_logo.svg'));}if(!fs[_0xb402('0x71')](_0x537240)){throw new db[(_0xb402('0x72'))][(_0xb402('0x73'))](_[_0xb402('0x74')]('logo')+_0xb402('0x75'));}return _0x46971a[_0xb402('0x76')](_0x537240);}})[_0xb402('0x2a')](handleError(_0x46971a,null));};var utilLicense=require(_0xb402('0x1a'));exports[_0xb402('0x77')]=function(_0xf8a5e7,_0x4ec0a4,_0x4fb71a){var _0x3eb921=_0xb402('0x62');var _0x275612={'custom':![]};return utilLicense['getLicense']()[_0xb402('0x1f')](function(_0x5d6b98){if(_0x5d6b98){_0x275612=_0x5d6b98;}return db[_0xb402('0x3e')]['find']({'where':{'id':_0xf8a5e7[_0xb402('0x5b')]['id']},'attributes':[_0xb402('0x64'),_0xb402('0x60'),_0xb402('0x65'),'favicon',_0xb402('0x67'),_0xb402('0x68'),_0xb402('0x69'),_0xb402('0x6a')],'raw':!![]});})[_0xb402('0x1f')](handleEntityNotFound(_0x4ec0a4,null))[_0xb402('0x1f')](function(_0x467178){if(_0x467178){var _0xba3f9d=_0x467178[_0xb402('0x60')]&&fs['existsSync'](path[_0xb402('0x6c')](config[_0xb402('0x6d')],_0x3eb921,_['toLower'](_0x467178[_0xb402('0x60')])))?path[_0xb402('0x6c')](config['root'],_0x3eb921,_[_0xb402('0x6b')](_0x467178[_0xb402('0x60')])):path[_0xb402('0x6c')](config[_0xb402('0x6d')],_0x3eb921,_['toLower'](_0xb402('0x78')));var _0x5f0e28='default'+_['upperFirst'](_0xb402('0x60'));if(_0x467178[_0x5f0e28]||!_0x275612['custom']){_0xba3f9d=path[_0xb402('0x6c')](config[_0xb402('0x6d')],_0x3eb921,_[_0xb402('0x6b')](_0xb402('0x78')));}if(!fs[_0xb402('0x71')](_0xba3f9d)){throw new db[(_0xb402('0x72'))][(_0xb402('0x73'))](_['upperFirst'](_0xb402('0x60'))+_0xb402('0x75'));}return _0x4ec0a4[_0xb402('0x76')](_0xba3f9d);}})[_0xb402('0x2a')](handleError(_0x4ec0a4,null));};exports['gdpr']=function(_0x5c1954,_0x1496eb){return db['Setting'][_0xb402('0x59')]({'where':{'id':_0x5c1954[_0xb402('0x5b')]['id']},'attributes':[_0xb402('0x79')]})['then'](respondWithResult(_0x1496eb,null))[_0xb402('0x2a')](handleError(_0x1496eb,null));};exports['addPreferred']=function(_0x26cd71,_0x270fcd,_0x3ba42f){if(_0x26cd71['file']&&_0x26cd71[_0xb402('0x5d')][_0xb402('0x5e')]){_0x26cd71[_0xb402('0x5a')][_0xb402('0x65')]=_0x26cd71[_0xb402('0x5d')][_0xb402('0x5e')];}return db[_0xb402('0x3e')][_0xb402('0x59')]({'where':{'id':_0x26cd71[_0xb402('0x5b')]['id']}})[_0xb402('0x1f')](handleEntityNotFound(_0x270fcd,null))[_0xb402('0x1f')](saveUpdates(_0x26cd71[_0xb402('0x5a')],null))['then'](respondWithResult(_0x270fcd,null))['catch'](handleError(_0x270fcd,null));};var utilLicense=require('../../config/license/util');exports['getPreferred']=function(_0x26a8c2,_0x2a2ae1,_0x15be17){var _0x5a11da=_0xb402('0x62');var _0x5e6eb4={'custom':![]};return utilLicense['getLicense']()[_0xb402('0x1f')](function(_0x3fdb79){if(_0x3fdb79){_0x5e6eb4=_0x3fdb79;}return db[_0xb402('0x3e')][_0xb402('0x59')]({'where':{'id':_0x26a8c2[_0xb402('0x5b')]['id']},'attributes':['logo',_0xb402('0x60'),'preferred',_0xb402('0x66'),_0xb402('0x67'),_0xb402('0x68'),_0xb402('0x69'),_0xb402('0x6a')],'raw':!![]});})[_0xb402('0x1f')](handleEntityNotFound(_0x2a2ae1,null))['then'](function(_0x265268){if(_0x265268){var _0x4c80d7=_0x265268[_0xb402('0x65')]&&fs[_0xb402('0x71')](path[_0xb402('0x6c')](config['root'],_0x5a11da,_[_0xb402('0x6b')](_0x265268[_0xb402('0x65')])))?path[_0xb402('0x6c')](config[_0xb402('0x6d')],_0x5a11da,_['toLower'](_0x265268[_0xb402('0x65')])):path[_0xb402('0x6c')](config[_0xb402('0x6d')],_0x5a11da,_['toLower'](_0xb402('0x7a')));var _0x397ed4=_0xb402('0x6f')+_[_0xb402('0x74')](_0xb402('0x65'));if(_0x265268[_0x397ed4]||!_0x5e6eb4[_0xb402('0x70')]||!_0x5e6eb4['preferred']){_0x4c80d7=path[_0xb402('0x6c')](config[_0xb402('0x6d')],_0x5a11da,_[_0xb402('0x6b')]('default_preferred.png'));}if(!fs[_0xb402('0x71')](_0x4c80d7)){throw new db[(_0xb402('0x72'))]['ValidationError'](_[_0xb402('0x74')](_0xb402('0x65'))+'\x20not\x20found');}return _0x2a2ae1[_0xb402('0x76')](_0x4c80d7);}})[_0xb402('0x2a')](handleError(_0x2a2ae1,null));};exports['addFavicon']=function(_0x4b4d19,_0x35608a,_0xe3dd7e){if(_0x4b4d19[_0xb402('0x5d')]&&_0x4b4d19[_0xb402('0x5d')][_0xb402('0x5e')]){_0x4b4d19[_0xb402('0x5a')][_0xb402('0x66')]=_0x4b4d19[_0xb402('0x5d')][_0xb402('0x5e')];}return db['Setting'][_0xb402('0x59')]({'where':{'id':_0x4b4d19[_0xb402('0x5b')]['id']}})[_0xb402('0x1f')](handleEntityNotFound(_0x35608a,null))[_0xb402('0x1f')](saveUpdates(_0x4b4d19[_0xb402('0x5a')],null))['then'](respondWithResult(_0x35608a,null))[_0xb402('0x2a')](handleError(_0x35608a,null));};var utilLicense=require('../../config/license/util');exports[_0xb402('0x7b')]=function(_0x30ad9,_0x32df7c,_0x323af1){var _0x304e81=_0xb402('0x62');var _0x13d2b2={'custom':![]};return utilLicense['getLicense']()[_0xb402('0x1f')](function(_0x36e18e){if(_0x36e18e){_0x13d2b2=_0x36e18e;}return db[_0xb402('0x3e')]['find']({'where':{'id':_0x30ad9[_0xb402('0x5b')]['id']},'attributes':['logo',_0xb402('0x60'),_0xb402('0x65'),'favicon',_0xb402('0x67'),_0xb402('0x68'),'defaultPreferred',_0xb402('0x6a')],'raw':!![]});})[_0xb402('0x1f')](handleEntityNotFound(_0x32df7c,null))['then'](function(_0x373abb){if(_0x373abb){var _0x242cfb=_0x373abb[_0xb402('0x66')]&&fs[_0xb402('0x71')](path[_0xb402('0x6c')](config['root'],_0x304e81,_[_0xb402('0x6b')](_0x373abb[_0xb402('0x66')])))?path[_0xb402('0x6c')](config['root'],_0x304e81,_['toLower'](_0x373abb['favicon'])):path[_0xb402('0x6c')](config['root'],_0x304e81,_[_0xb402('0x6b')]('default_favicon.ico'));var _0x3dd1c8=_0xb402('0x6f')+_[_0xb402('0x74')](_0xb402('0x66'));if(_0x373abb[_0x3dd1c8]||!_0x13d2b2['custom']){_0x242cfb=path['join'](config[_0xb402('0x6d')],_0x304e81,_[_0xb402('0x6b')](_0xb402('0x7c')));}if(!fs[_0xb402('0x71')](_0x242cfb)){throw new db[(_0xb402('0x72'))][(_0xb402('0x73'))](_[_0xb402('0x74')](_0xb402('0x66'))+'\x20not\x20found');}return _0x32df7c[_0xb402('0x76')](_0x242cfb);}})[_0xb402('0x2a')](handleError(_0x32df7c,null));};exports[_0xb402('0x7d')]=function(_0x8210e7,_0x4d3d0e){var _0x54c38f={'offset':moment()[_0xb402('0x7e')]()};_0x54c38f[_0xb402('0x7f')]=moment()[_0xb402('0x7e')](_0x54c38f['offset'])[_0xb402('0x80')](_0xb402('0x81'));return _0x4d3d0e[_0xb402('0x2b')](0xc8)[_0xb402('0x82')](_0x54c38f);}; \ No newline at end of file +var _0xa249=['custom','default_logo.svg','Sequelize','ValidationError','\x20not\x20found','getLogoLogin','getLicense','preferred','defaultFavicon','default_loginLogo.svg','gdpr','securePassword','getPreferred','favicon','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','download','utcOffset','now','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','jayson/promise','client','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','sendStatus','end','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','Setting','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','sort','where','pick','filter','merge','map','VIRTUAL','count','findAll','rows','params','includeAll','options','body','addLogo','file','filename','logo','addLogoLogin','loginLogo','find','../../config/license/util','getLogo','server/files/images/logos','defaultLogo','defaultLoginLogo','defaultPreferred','existsSync','toLower','join','root','default','upperFirst'];(function(_0x4148c2,_0x4d86a6){var _0x5a81f6=function(_0x24e3ad){while(--_0x24e3ad){_0x4148c2['push'](_0x4148c2['shift']());}};_0x5a81f6(++_0x4d86a6);}(_0xa249,0x109));var _0x9a24=function(_0x2d5746,_0xdd79ac){_0x2d5746=_0x2d5746-0x0;var _0xc2281b=_0xa249[_0x2d5746];return _0xc2281b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9a24('0x0'));var zipdir=require(_0x9a24('0x1'));var jsonpatch=require(_0x9a24('0x2'));var rp=require('request-promise');var moment=require(_0x9a24('0x3'));var BPromise=require(_0x9a24('0x4'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x9a24('0x5'));var ejs=require(_0x9a24('0x6'));var fs=require('fs');var fs_extra=require(_0x9a24('0x7'));var _=require(_0x9a24('0x8'));var squel=require(_0x9a24('0x9'));var crypto=require('crypto');var jsforce=require(_0x9a24('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x9a24('0x5'));var querystring=require(_0x9a24('0xb'));var Papa=require(_0x9a24('0xc'));var Redis=require(_0x9a24('0xd'));var authService=require(_0x9a24('0xe'));var qs=require(_0x9a24('0xf'));var as=require(_0x9a24('0x10'));var hardwareService=require(_0x9a24('0x11'));var logger=require(_0x9a24('0x12'))(_0x9a24('0x13'));var utils=require(_0x9a24('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var jayson=require(_0x9a24('0x15'));var client=jayson[_0x9a24('0x16')][_0x9a24('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x231d54,_0x2d6d0b,_0x492d75,_0x3fb374){return new BPromise(function(_0x2c0892,_0x105177){var _0x46b7f6=_0x3fb374||client;return _0x46b7f6[_0x9a24('0x18')](_0x231d54,_0x492d75)[_0x9a24('0x19')](function(_0x441c5a){logger[_0x9a24('0x1a')](_0x9a24('0x1b'),_0x2d6d0b,_0x9a24('0x1c'));logger['debug'](_0x9a24('0x1d'),_0x2d6d0b,_0x9a24('0x1c'),JSON['stringify'](_0x441c5a));if(_0x441c5a['error']){if(_0x441c5a[_0x9a24('0x1e')][_0x9a24('0x1f')]===0x1f4){logger[_0x9a24('0x1e')](_0x9a24('0x1b'),_0x2d6d0b,_0x441c5a[_0x9a24('0x1e')][_0x9a24('0x20')]);return _0x105177(_0x441c5a['error'][_0x9a24('0x20')]);}logger[_0x9a24('0x1e')](_0x9a24('0x1b'),_0x2d6d0b,_0x441c5a[_0x9a24('0x1e')][_0x9a24('0x20')]);return _0x2c0892(_0x441c5a[_0x9a24('0x1e')][_0x9a24('0x20')]);}else{logger[_0x9a24('0x1a')]('Setting,\x20%s,\x20%s',_0x2d6d0b,_0x9a24('0x1c'));_0x2c0892(_0x441c5a[_0x9a24('0x21')][_0x9a24('0x20')]);}})[_0x9a24('0x22')](function(_0x4c73ae){logger[_0x9a24('0x1e')](_0x9a24('0x1b'),_0x2d6d0b,_0x4c73ae);_0x105177(_0x4c73ae);});});}function respondWithStatusCode(_0x30a2fc,_0x22713b){_0x22713b=_0x22713b||0xcc;return function(_0x58d1f6){if(_0x58d1f6){return _0x30a2fc[_0x9a24('0x23')](_0x22713b);}return _0x30a2fc['status'](_0x22713b)[_0x9a24('0x24')]();};}function respondWithResult(_0x928899,_0x1bd020){_0x1bd020=_0x1bd020||0xc8;return function(_0x53267e){if(_0x53267e){return _0x928899[_0x9a24('0x25')](_0x1bd020)[_0x9a24('0x26')](_0x53267e);}};}function respondWithFilteredResult(_0x3ca8b4,_0x130369){return function(_0x35c6e5){if(_0x35c6e5){var _0x456bae=typeof _0x130369[_0x9a24('0x27')]===_0x9a24('0x28')&&typeof _0x130369[_0x9a24('0x29')]===_0x9a24('0x28');var _0x3ce054=_0x35c6e5['count'];var _0x36eb18=_0x456bae?0x0:_0x130369['offset'];var _0x220bd0=_0x456bae?_0x35c6e5['count']:_0x130369[_0x9a24('0x27')]+_0x130369[_0x9a24('0x29')];var _0x186581;if(_0x220bd0>=_0x3ce054){_0x220bd0=_0x3ce054;_0x186581=0xc8;}else{_0x186581=0xce;}_0x3ca8b4[_0x9a24('0x25')](_0x186581);return _0x3ca8b4[_0x9a24('0x2a')](_0x9a24('0x2b'),_0x36eb18+'-'+_0x220bd0+'/'+_0x3ce054)[_0x9a24('0x26')](_0x35c6e5);}return null;};}function patchUpdates(_0x4a0b89){return function(_0x3da858){try{jsonpatch[_0x9a24('0x2c')](_0x3da858,_0x4a0b89,!![]);}catch(_0x5c72a5){return BPromise[_0x9a24('0x2d')](_0x5c72a5);}return _0x3da858['save']();};}function saveUpdates(_0x4e2224,_0xbf25a4){return function(_0x1f48bc){if(_0x1f48bc){return _0x1f48bc[_0x9a24('0x2e')](_0x4e2224)[_0x9a24('0x19')](function(_0x58e64e){return _0x58e64e;});}return null;};}function removeEntity(_0x21d4bb,_0x58067a){return function(_0x1b4205){if(_0x1b4205){return _0x1b4205[_0x9a24('0x2f')]()[_0x9a24('0x19')](function(){_0x21d4bb['status'](0xcc)[_0x9a24('0x24')]();});}};}function handleEntityNotFound(_0x59fe0f,_0x2ba0dd){return function(_0x586aa4){if(!_0x586aa4){_0x59fe0f[_0x9a24('0x23')](0x194);}return _0x586aa4;};}function handleError(_0x6dc3a8,_0x1d1aae){_0x1d1aae=_0x1d1aae||0x1f4;return function(_0x4eaece){logger[_0x9a24('0x1e')](_0x4eaece[_0x9a24('0x30')]);if(_0x4eaece[_0x9a24('0x31')]){delete _0x4eaece[_0x9a24('0x31')];}_0x6dc3a8[_0x9a24('0x25')](_0x1d1aae)[_0x9a24('0x32')](_0x4eaece);};}exports[_0x9a24('0x33')]=function(_0x38e267,_0xb1308f){var _0x519ae1={},_0x191e0b={},_0x2b4a58={'count':0x0,'rows':[]};var _0xaeba=_['map'](db[_0x9a24('0x34')][_0x9a24('0x35')],function(_0x1ee88f){return{'name':_0x1ee88f[_0x9a24('0x36')],'type':_0x1ee88f[_0x9a24('0x37')][_0x9a24('0x38')]};});_0x191e0b[_0x9a24('0x39')]=_['map'](_0xaeba,_0x9a24('0x31'));_0x191e0b[_0x9a24('0x3a')]=_[_0x9a24('0x3b')](_0x38e267[_0x9a24('0x3a')]);_0x191e0b[_0x9a24('0x3c')]=_[_0x9a24('0x3d')](_0x191e0b[_0x9a24('0x39')],_0x191e0b['query']);_0x519ae1['attributes']=_[_0x9a24('0x3d')](_0x191e0b[_0x9a24('0x39')],qs[_0x9a24('0x3e')](_0x38e267[_0x9a24('0x3a')]['fields']));_0x519ae1['attributes']=_0x519ae1[_0x9a24('0x3f')][_0x9a24('0x40')]?_0x519ae1[_0x9a24('0x3f')]:_0x191e0b['model'];if(!_0x38e267[_0x9a24('0x3a')]['hasOwnProperty']('nolimit')){_0x519ae1['limit']=qs['limit'](_0x38e267[_0x9a24('0x3a')][_0x9a24('0x29')]);_0x519ae1[_0x9a24('0x27')]=qs[_0x9a24('0x27')](_0x38e267[_0x9a24('0x3a')][_0x9a24('0x27')]);}_0x519ae1['order']=qs[_0x9a24('0x41')](_0x38e267[_0x9a24('0x3a')][_0x9a24('0x41')]);_0x519ae1[_0x9a24('0x42')]=qs['filters'](_[_0x9a24('0x43')](_0x38e267['query'],_0x191e0b[_0x9a24('0x3c')]),_0xaeba);if(_0x38e267['query'][_0x9a24('0x44')]){_0x519ae1[_0x9a24('0x42')]=_[_0x9a24('0x45')](_0x519ae1[_0x9a24('0x42')],{'$or':_[_0x9a24('0x46')](_0xaeba,function(_0x4fd3dc){if(_0x4fd3dc[_0x9a24('0x37')]!==_0x9a24('0x47')){var _0x24ed1a={};_0x24ed1a[_0x4fd3dc[_0x9a24('0x31')]]={'$like':'%'+_0x38e267[_0x9a24('0x3a')][_0x9a24('0x44')]+'%'};return _0x24ed1a;}})});}_0x519ae1=_[_0x9a24('0x45')]({},_0x519ae1,_0x38e267['options']);var _0x1711b8={'where':_0x519ae1[_0x9a24('0x42')]};return db[_0x9a24('0x34')][_0x9a24('0x48')](_0x1711b8)['then'](function(_0x6097a3){_0x2b4a58['count']=_0x6097a3;if(_0x38e267[_0x9a24('0x3a')]['includeAll']){_0x519ae1['include']=[{'all':!![]}];}return db['Setting'][_0x9a24('0x49')](_0x519ae1);})['then'](function(_0x57f114){_0x2b4a58[_0x9a24('0x4a')]=_0x57f114;return _0x2b4a58;})['then'](respondWithFilteredResult(_0xb1308f,_0x519ae1))[_0x9a24('0x22')](handleError(_0xb1308f,null));};exports['show']=function(_0x153d93,_0x32aa36){var _0x2dbb2a={'raw':![],'where':{'id':_0x153d93[_0x9a24('0x4b')]['id']}},_0x73b502={};_0x73b502[_0x9a24('0x39')]=_[_0x9a24('0x3b')](db[_0x9a24('0x34')]['rawAttributes']);_0x73b502['query']=_['keys'](_0x153d93[_0x9a24('0x3a')]);_0x73b502[_0x9a24('0x3c')]=_[_0x9a24('0x3d')](_0x73b502[_0x9a24('0x39')],_0x73b502[_0x9a24('0x3a')]);_0x2dbb2a[_0x9a24('0x3f')]=_[_0x9a24('0x3d')](_0x73b502['model'],qs[_0x9a24('0x3e')](_0x153d93['query']['fields']));_0x2dbb2a[_0x9a24('0x3f')]=_0x2dbb2a[_0x9a24('0x3f')]['length']?_0x2dbb2a['attributes']:_0x73b502['model'];if(_0x153d93[_0x9a24('0x3a')][_0x9a24('0x4c')]){_0x2dbb2a['include']=[{'all':!![]}];}_0x2dbb2a=_[_0x9a24('0x45')]({},_0x2dbb2a,_0x153d93[_0x9a24('0x4d')]);return db[_0x9a24('0x34')]['find'](_0x2dbb2a)[_0x9a24('0x19')](handleEntityNotFound(_0x32aa36,null))[_0x9a24('0x19')](respondWithResult(_0x32aa36,null))[_0x9a24('0x22')](handleError(_0x32aa36,null));};exports[_0x9a24('0x2e')]=function(_0x4e5f2f,_0x273319){if(_0x4e5f2f[_0x9a24('0x4e')]['id']){delete _0x4e5f2f['body']['id'];}return db[_0x9a24('0x34')]['find']({'where':{'id':_0x4e5f2f[_0x9a24('0x4b')]['id']}})[_0x9a24('0x19')](handleEntityNotFound(_0x273319,null))[_0x9a24('0x19')](saveUpdates(_0x4e5f2f[_0x9a24('0x4e')],null))[_0x9a24('0x19')](respondWithResult(_0x273319,null))['catch'](handleError(_0x273319,null));};exports[_0x9a24('0x4f')]=function(_0x4c889d,_0x6aefb0,_0xfb3dad){if(_0x4c889d[_0x9a24('0x50')]&&_0x4c889d[_0x9a24('0x50')][_0x9a24('0x51')]){_0x4c889d[_0x9a24('0x4e')][_0x9a24('0x52')]=_0x4c889d[_0x9a24('0x50')]['filename'];}return db[_0x9a24('0x34')]['find']({'where':{'id':_0x4c889d[_0x9a24('0x4b')]['id']}})['then'](handleEntityNotFound(_0x6aefb0,null))[_0x9a24('0x19')](saveUpdates(_0x4c889d[_0x9a24('0x4e')],null))[_0x9a24('0x19')](respondWithResult(_0x6aefb0,null))[_0x9a24('0x22')](handleError(_0x6aefb0,null));};exports[_0x9a24('0x53')]=function(_0x133721,_0x387504,_0x58a582){if(_0x133721[_0x9a24('0x50')]&&_0x133721[_0x9a24('0x50')][_0x9a24('0x51')]){_0x133721[_0x9a24('0x4e')][_0x9a24('0x54')]=_0x133721[_0x9a24('0x50')][_0x9a24('0x51')];}return db['Setting'][_0x9a24('0x55')]({'where':{'id':_0x133721['params']['id']}})[_0x9a24('0x19')](handleEntityNotFound(_0x387504,null))[_0x9a24('0x19')](saveUpdates(_0x133721['body'],null))[_0x9a24('0x19')](respondWithResult(_0x387504,null))['catch'](handleError(_0x387504,null));};var utilLicense=require(_0x9a24('0x56'));exports[_0x9a24('0x57')]=function(_0x22a482,_0x251a7d,_0x1325bd){var _0x40553c=_0x9a24('0x58');var _0x22bc21={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x1c3764){if(_0x1c3764){_0x22bc21=_0x1c3764;}return db[_0x9a24('0x34')][_0x9a24('0x55')]({'where':{'id':_0x22a482['params']['id']},'attributes':[_0x9a24('0x52'),'loginLogo','preferred','favicon',_0x9a24('0x59'),_0x9a24('0x5a'),_0x9a24('0x5b'),'defaultFavicon'],'raw':!![]});})[_0x9a24('0x19')](handleEntityNotFound(_0x251a7d,null))[_0x9a24('0x19')](function(_0x53cd8a){if(_0x53cd8a){var _0xeb5629=_0x53cd8a['logo']&&fs[_0x9a24('0x5c')](path['join'](config['root'],_0x40553c,_[_0x9a24('0x5d')](_0x53cd8a[_0x9a24('0x52')])))?path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x40553c,_[_0x9a24('0x5d')](_0x53cd8a[_0x9a24('0x52')])):path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x40553c,_[_0x9a24('0x5d')]('default_logo.svg'));var _0x3d0a6f=_0x9a24('0x60')+_[_0x9a24('0x61')](_0x9a24('0x52'));if(_0x53cd8a[_0x3d0a6f]||!_0x22bc21[_0x9a24('0x62')]){_0xeb5629=path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x40553c,_[_0x9a24('0x5d')](_0x9a24('0x63')));}if(!fs['existsSync'](_0xeb5629)){throw new db[(_0x9a24('0x64'))][(_0x9a24('0x65'))](_[_0x9a24('0x61')](_0x9a24('0x52'))+_0x9a24('0x66'));}return _0x251a7d['download'](_0xeb5629);}})[_0x9a24('0x22')](handleError(_0x251a7d,null));};var utilLicense=require('../../config/license/util');exports[_0x9a24('0x67')]=function(_0x5eff9a,_0x4122fc,_0x37fd07){var _0x36ab20=_0x9a24('0x58');var _0x2e1f7b={'custom':![]};return utilLicense[_0x9a24('0x68')]()[_0x9a24('0x19')](function(_0x28ea79){if(_0x28ea79){_0x2e1f7b=_0x28ea79;}return db[_0x9a24('0x34')]['find']({'where':{'id':_0x5eff9a['params']['id']},'attributes':[_0x9a24('0x52'),_0x9a24('0x54'),_0x9a24('0x69'),'favicon',_0x9a24('0x59'),'defaultLoginLogo',_0x9a24('0x5b'),_0x9a24('0x6a')],'raw':!![]});})[_0x9a24('0x19')](handleEntityNotFound(_0x4122fc,null))['then'](function(_0x1636ed){if(_0x1636ed){var _0x893db7=_0x1636ed[_0x9a24('0x54')]&&fs[_0x9a24('0x5c')](path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x36ab20,_[_0x9a24('0x5d')](_0x1636ed[_0x9a24('0x54')])))?path[_0x9a24('0x5e')](config['root'],_0x36ab20,_[_0x9a24('0x5d')](_0x1636ed[_0x9a24('0x54')])):path[_0x9a24('0x5e')](config['root'],_0x36ab20,_['toLower'](_0x9a24('0x6b')));var _0x5511eb=_0x9a24('0x60')+_[_0x9a24('0x61')](_0x9a24('0x54'));if(_0x1636ed[_0x5511eb]||!_0x2e1f7b[_0x9a24('0x62')]){_0x893db7=path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x36ab20,_[_0x9a24('0x5d')](_0x9a24('0x6b')));}if(!fs[_0x9a24('0x5c')](_0x893db7)){throw new db[(_0x9a24('0x64'))]['ValidationError'](_['upperFirst']('loginLogo')+_0x9a24('0x66'));}return _0x4122fc['download'](_0x893db7);}})['catch'](handleError(_0x4122fc,null));};exports[_0x9a24('0x6c')]=function(_0x1964ce,_0x13e1ec){return db[_0x9a24('0x34')][_0x9a24('0x55')]({'where':{'id':_0x1964ce[_0x9a24('0x4b')]['id']},'attributes':[_0x9a24('0x6d')]})[_0x9a24('0x19')](respondWithResult(_0x13e1ec,null))[_0x9a24('0x22')](handleError(_0x13e1ec,null));};exports['addPreferred']=function(_0x238fb3,_0x2dd38a,_0x11ed3d){if(_0x238fb3[_0x9a24('0x50')]&&_0x238fb3[_0x9a24('0x50')][_0x9a24('0x51')]){_0x238fb3[_0x9a24('0x4e')][_0x9a24('0x69')]=_0x238fb3[_0x9a24('0x50')][_0x9a24('0x51')];}return db[_0x9a24('0x34')][_0x9a24('0x55')]({'where':{'id':_0x238fb3[_0x9a24('0x4b')]['id']}})[_0x9a24('0x19')](handleEntityNotFound(_0x2dd38a,null))[_0x9a24('0x19')](saveUpdates(_0x238fb3[_0x9a24('0x4e')],null))[_0x9a24('0x19')](respondWithResult(_0x2dd38a,null))[_0x9a24('0x22')](handleError(_0x2dd38a,null));};var utilLicense=require(_0x9a24('0x56'));exports[_0x9a24('0x6e')]=function(_0x3e3dab,_0x54d276,_0x53e7d7){var _0x2755d5=_0x9a24('0x58');var _0x15655b={'custom':![]};return utilLicense[_0x9a24('0x68')]()[_0x9a24('0x19')](function(_0x3f7f00){if(_0x3f7f00){_0x15655b=_0x3f7f00;}return db[_0x9a24('0x34')]['find']({'where':{'id':_0x3e3dab[_0x9a24('0x4b')]['id']},'attributes':[_0x9a24('0x52'),_0x9a24('0x54'),_0x9a24('0x69'),_0x9a24('0x6f'),_0x9a24('0x59'),'defaultLoginLogo',_0x9a24('0x5b'),_0x9a24('0x6a')],'raw':!![]});})[_0x9a24('0x19')](handleEntityNotFound(_0x54d276,null))[_0x9a24('0x19')](function(_0x43f2a2){if(_0x43f2a2){var _0x1eae4d=_0x43f2a2[_0x9a24('0x69')]&&fs['existsSync'](path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x2755d5,_[_0x9a24('0x5d')](_0x43f2a2['preferred'])))?path['join'](config[_0x9a24('0x5f')],_0x2755d5,_[_0x9a24('0x5d')](_0x43f2a2[_0x9a24('0x69')])):path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x2755d5,_[_0x9a24('0x5d')](_0x9a24('0x70')));var _0x18444a=_0x9a24('0x60')+_['upperFirst']('preferred');if(_0x43f2a2[_0x18444a]||!_0x15655b['custom']||!_0x15655b['preferred']){_0x1eae4d=path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x2755d5,_[_0x9a24('0x5d')]('default_preferred.png'));}if(!fs[_0x9a24('0x5c')](_0x1eae4d)){throw new db[(_0x9a24('0x64'))][(_0x9a24('0x65'))](_[_0x9a24('0x61')]('preferred')+_0x9a24('0x66'));}return _0x54d276['download'](_0x1eae4d);}})[_0x9a24('0x22')](handleError(_0x54d276,null));};exports[_0x9a24('0x71')]=function(_0x4173d4,_0x34aaec,_0x4f2855){if(_0x4173d4[_0x9a24('0x50')]&&_0x4173d4[_0x9a24('0x50')]['filename']){_0x4173d4[_0x9a24('0x4e')][_0x9a24('0x6f')]=_0x4173d4[_0x9a24('0x50')][_0x9a24('0x51')];}return db[_0x9a24('0x34')]['find']({'where':{'id':_0x4173d4[_0x9a24('0x4b')]['id']}})[_0x9a24('0x19')](handleEntityNotFound(_0x34aaec,null))[_0x9a24('0x19')](saveUpdates(_0x4173d4[_0x9a24('0x4e')],null))[_0x9a24('0x19')](respondWithResult(_0x34aaec,null))[_0x9a24('0x22')](handleError(_0x34aaec,null));};var utilLicense=require(_0x9a24('0x56'));exports[_0x9a24('0x72')]=function(_0x285e05,_0x3f9739,_0x363ac4){var _0x15be33=_0x9a24('0x58');var _0x54ab51={'custom':![]};return utilLicense[_0x9a24('0x68')]()[_0x9a24('0x19')](function(_0x3238a0){if(_0x3238a0){_0x54ab51=_0x3238a0;}return db[_0x9a24('0x34')]['find']({'where':{'id':_0x285e05[_0x9a24('0x4b')]['id']},'attributes':[_0x9a24('0x52'),_0x9a24('0x54'),_0x9a24('0x69'),_0x9a24('0x6f'),'defaultLogo',_0x9a24('0x5a'),_0x9a24('0x5b'),_0x9a24('0x6a')],'raw':!![]});})[_0x9a24('0x19')](handleEntityNotFound(_0x3f9739,null))[_0x9a24('0x19')](function(_0x34ecef){if(_0x34ecef){var _0x31a9ba=_0x34ecef[_0x9a24('0x6f')]&&fs['existsSync'](path['join'](config[_0x9a24('0x5f')],_0x15be33,_[_0x9a24('0x5d')](_0x34ecef[_0x9a24('0x6f')])))?path[_0x9a24('0x5e')](config['root'],_0x15be33,_[_0x9a24('0x5d')](_0x34ecef[_0x9a24('0x6f')])):path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x15be33,_[_0x9a24('0x5d')](_0x9a24('0x73')));var _0x56628b=_0x9a24('0x60')+_['upperFirst'](_0x9a24('0x6f'));if(_0x34ecef[_0x56628b]||!_0x54ab51['custom']){_0x31a9ba=path[_0x9a24('0x5e')](config[_0x9a24('0x5f')],_0x15be33,_['toLower'](_0x9a24('0x73')));}if(!fs[_0x9a24('0x5c')](_0x31a9ba)){throw new db[(_0x9a24('0x64'))][(_0x9a24('0x65'))](_[_0x9a24('0x61')](_0x9a24('0x6f'))+_0x9a24('0x66'));}return _0x3f9739[_0x9a24('0x74')](_0x31a9ba);}})[_0x9a24('0x22')](handleError(_0x3f9739,null));};exports['getDate']=function(_0x5b3510,_0x49479b){var _0x32d529={'offset':moment()[_0x9a24('0x75')]()};_0x32d529[_0x9a24('0x76')]=moment()[_0x9a24('0x75')](_0x32d529[_0x9a24('0x27')])[_0x9a24('0x77')](_0x9a24('0x78'));return _0x49479b['status'](0xc8)[_0x9a24('0x32')](_0x32d529);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index fa158ef..b88f547 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3fb030,_0x12aebe){var _0xd6899b=function(_0x327646){while(--_0x327646){_0x3fb030['push'](_0x3fb030['shift']());}};_0xd6899b(++_0x12aebe);}(_0x7217,0x19e));var _0x7721=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x7217[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./setting.attributes','exports','Setting','util'];(function(_0x177351,_0x200311){var _0x2c4ba4=function(_0x10b62b){while(--_0x10b62b){_0x177351['push'](_0x177351['shift']());}};_0x2c4ba4(++_0x200311);}(_0xedd9,0xfc));var _0x9edd=function(_0x3261db,_0x5ca0a){_0x3261db=_0x3261db-0x0;var _0x8c0bf3=_0xedd9[_0x3261db];return _0x8c0bf3;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'settings','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 e6ccaee..e329c22 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 _0x536a=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','Setting,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','map','model','debug','lodash','util','moment','bluebird','ioredis'];(function(_0x40d749,_0x3e47ad){var _0x500b3c=function(_0x173ae8){while(--_0x173ae8){_0x40d749['push'](_0x40d749['shift']());}};_0x500b3c(++_0x3e47ad);}(_0x536a,0x11b));var _0xa536=function(_0x3ced2c,_0x121ed8){_0x3ced2c=_0x3ced2c-0x0;var _0x31dff6=_0x536a[_0x3ced2c];return _0x31dff6;};'use strict';var _=require(_0xa536('0x0'));var util=require(_0xa536('0x1'));var moment=require(_0xa536('0x2'));var BPromise=require(_0xa536('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xa536('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xa536('0x5'));var logger=require(_0xa536('0x6'))(_0xa536('0x7'));var config=require(_0xa536('0x8'));var jayson=require(_0xa536('0x9'));var client=jayson[_0xa536('0xa')][_0xa536('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11871c,_0x25aa65,_0x1c1e44){return new BPromise(function(_0x4801f5,_0x3bc1be){return client['request'](_0x11871c,_0x1c1e44)['then'](function(_0x494b00){logger[_0xa536('0xc')](_0xa536('0xd'),_0x25aa65,_0xa536('0xe'));logger['debug']('Setting,\x20%s,\x20%s,\x20%s',_0x25aa65,'request\x20sent',JSON[_0xa536('0xf')](_0x494b00));if(_0x494b00[_0xa536('0x10')]){if(_0x494b00[_0xa536('0x10')][_0xa536('0x11')]===0x1f4){logger[_0xa536('0x10')](_0xa536('0xd'),_0x25aa65,_0x494b00[_0xa536('0x10')][_0xa536('0x12')]);return _0x3bc1be(_0x494b00[_0xa536('0x10')][_0xa536('0x12')]);}logger[_0xa536('0x10')]('Setting,\x20%s,\x20%s',_0x25aa65,_0x494b00['error'][_0xa536('0x12')]);return _0x4801f5(_0x494b00['error']['message']);}else{logger[_0xa536('0xc')]('Setting,\x20%s,\x20%s',_0x25aa65,_0xa536('0xe'));_0x4801f5(_0x494b00[_0xa536('0x13')][_0xa536('0x12')]);}})[_0xa536('0x14')](function(_0x119748){logger[_0xa536('0x10')](_0xa536('0xd'),_0x25aa65,_0x119748);_0x3bc1be(_0x119748);});});}exports[_0xa536('0x15')]=function(_0x14a261){var _0x4c33d4=this;return new Promise(function(_0x4cfbd0,_0x3475d1){return db[_0xa536('0x16')][_0xa536('0x17')]({'raw':_0x14a261[_0xa536('0x18')]?_0x14a261[_0xa536('0x18')][_0xa536('0x19')]===undefined?!![]:![]:!![],'where':_0x14a261[_0xa536('0x18')]?_0x14a261[_0xa536('0x18')][_0xa536('0x1a')]||null:null,'attributes':_0x14a261[_0xa536('0x18')]?_0x14a261[_0xa536('0x18')][_0xa536('0x1b')]||null:null,'include':_0x14a261[_0xa536('0x18')]?_0x14a261[_0xa536('0x18')][_0xa536('0x1c')]?_[_0xa536('0x1d')](_0x14a261['options'][_0xa536('0x1c')],function(_0x423061){return{'model':db[_0x423061[_0xa536('0x1e')]],'as':_0x423061['as'],'attributes':_0x423061[_0xa536('0x1b')],'include':_0x423061[_0xa536('0x1c')]?_['map'](_0x423061[_0xa536('0x1c')],function(_0x3eaa79){return{'model':db[_0x3eaa79[_0xa536('0x1e')]],'as':_0x3eaa79['as'],'attributes':_0x3eaa79[_0xa536('0x1b')],'include':_0x3eaa79[_0xa536('0x1c')]?_[_0xa536('0x1d')](_0x3eaa79['include'],function(_0x3c28f1){return{'model':db[_0x3c28f1['model']],'as':_0x3c28f1['as'],'attributes':_0x3c28f1[_0xa536('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x104938){logger[_0xa536('0xc')](_0xa536('0x15'),_0x14a261);logger[_0xa536('0x1f')](_0xa536('0x15'),_0x14a261,JSON[_0xa536('0xf')](_0x104938));_0x4cfbd0(_0x104938);})[_0xa536('0x14')](function(_0x1e94d0){logger[_0xa536('0x10')](_0xa536('0x15'),_0x1e94d0[_0xa536('0x12')],_0x14a261);_0x3475d1(_0x4c33d4['error'](0x1f4,_0x1e94d0[_0xa536('0x12')]));});});}; \ No newline at end of file +var _0x1ef3=['model','debug','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSetting','find','options','include','map','attributes'];(function(_0x1af469,_0x584d95){var _0x336171=function(_0x574e25){while(--_0x574e25){_0x1af469['push'](_0x1af469['shift']());}};_0x336171(++_0x584d95);}(_0x1ef3,0x11a));var _0x31ef=function(_0x593c15,_0xd7b721){_0x593c15=_0x593c15-0x0;var _0x535781=_0x1ef3[_0x593c15];return _0x535781;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x31ef('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x31ef('0x1'));var db=require(_0x31ef('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x31ef('0x3'));var config=require(_0x31ef('0x4'));var jayson=require(_0x31ef('0x5'));var client=jayson[_0x31ef('0x6')][_0x31ef('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x546fee,_0x311602,_0x4fd2c3){return new BPromise(function(_0x10ab68,_0x3255a9){return client[_0x31ef('0x8')](_0x546fee,_0x4fd2c3)[_0x31ef('0x9')](function(_0x5c9012){logger['info'](_0x31ef('0xa'),_0x311602,_0x31ef('0xb'));logger['debug'](_0x31ef('0xc'),_0x311602,_0x31ef('0xb'),JSON[_0x31ef('0xd')](_0x5c9012));if(_0x5c9012[_0x31ef('0xe')]){if(_0x5c9012[_0x31ef('0xe')][_0x31ef('0xf')]===0x1f4){logger[_0x31ef('0xe')]('Setting,\x20%s,\x20%s',_0x311602,_0x5c9012['error'][_0x31ef('0x10')]);return _0x3255a9(_0x5c9012[_0x31ef('0xe')][_0x31ef('0x10')]);}logger[_0x31ef('0xe')](_0x31ef('0xa'),_0x311602,_0x5c9012[_0x31ef('0xe')]['message']);return _0x10ab68(_0x5c9012['error'][_0x31ef('0x10')]);}else{logger[_0x31ef('0x11')](_0x31ef('0xa'),_0x311602,_0x31ef('0xb'));_0x10ab68(_0x5c9012[_0x31ef('0x12')][_0x31ef('0x10')]);}})[_0x31ef('0x13')](function(_0x2706e5){logger[_0x31ef('0xe')](_0x31ef('0xa'),_0x311602,_0x2706e5);_0x3255a9(_0x2706e5);});});}exports[_0x31ef('0x14')]=function(_0x1a1b5e){var _0x268464=this;return new Promise(function(_0x1e86fa,_0x1b10c9){return db['Setting'][_0x31ef('0x15')]({'raw':_0x1a1b5e['options']?_0x1a1b5e[_0x31ef('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x1a1b5e['options']?_0x1a1b5e[_0x31ef('0x16')]['where']||null:null,'attributes':_0x1a1b5e[_0x31ef('0x16')]?_0x1a1b5e[_0x31ef('0x16')]['attributes']||null:null,'include':_0x1a1b5e[_0x31ef('0x16')]?_0x1a1b5e[_0x31ef('0x16')][_0x31ef('0x17')]?_[_0x31ef('0x18')](_0x1a1b5e[_0x31ef('0x16')][_0x31ef('0x17')],function(_0x5238f3){return{'model':db[_0x5238f3['model']],'as':_0x5238f3['as'],'attributes':_0x5238f3[_0x31ef('0x19')],'include':_0x5238f3[_0x31ef('0x17')]?_['map'](_0x5238f3[_0x31ef('0x17')],function(_0x6a215){return{'model':db[_0x6a215[_0x31ef('0x1a')]],'as':_0x6a215['as'],'attributes':_0x6a215['attributes'],'include':_0x6a215[_0x31ef('0x17')]?_[_0x31ef('0x18')](_0x6a215[_0x31ef('0x17')],function(_0x18a6cf){return{'model':db[_0x18a6cf[_0x31ef('0x1a')]],'as':_0x18a6cf['as'],'attributes':_0x18a6cf['attributes']};}):[]};}):[]};}):[]:[]})[_0x31ef('0x9')](function(_0x445a55){logger[_0x31ef('0x11')](_0x31ef('0x14'),_0x1a1b5e);logger[_0x31ef('0x1b')](_0x31ef('0x14'),_0x1a1b5e,JSON['stringify'](_0x445a55));_0x1e86fa(_0x445a55);})[_0x31ef('0x13')](function(_0x3ad0e3){logger['error'](_0x31ef('0x14'),_0x3ad0e3[_0x31ef('0x10')],_0x1a1b5e);_0x1b10c9(_0x268464[_0x31ef('0xe')](0x1f4,_0x3ad0e3['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index 6c884e6..090a320 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 _0x7217=['/:id/send','status','put','update','delete','removeDispositions','removeAnswers','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./smsAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','/:id/interactions','getInteractions','/:id/status','statusGet','/:id/users','create','post','/:id/notify','notify','addApplications'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x7217,0x19e));var _0x7721=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x7217[_0x49ca18];return _0x145d54;};'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('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getApplications']);router[_0x7721('0x8')](_0x7721('0x14'),auth['isAuthenticated'](),controller[_0x7721('0x15')]);router[_0x7721('0x8')](_0x7721('0x16'),controller[_0x7721('0x17')]);router['get'](_0x7721('0x18'),auth[_0x7721('0x9')](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x7721('0x19')]);router[_0x7721('0x1a')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller['addDisposition']);router[_0x7721('0x1a')]('/:id/canned_answers',auth[_0x7721('0x9')](),controller['addAnswer']);router[_0x7721('0x1a')](_0x7721('0x1b'),controller[_0x7721('0x1c')]);router[_0x7721('0x1a')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x1d')]);router[_0x7721('0x1a')](_0x7721('0x1e'),auth[_0x7721('0x9')](),controller['send']);router[_0x7721('0x1a')](_0x7721('0x16'),controller[_0x7721('0x1f')]);router[_0x7721('0x1a')]('/:id/users',auth[_0x7721('0x9')](),controller['addAgents']);router[_0x7721('0x20')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0x21')]);router[_0x7721('0x22')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller['destroy']);router[_0x7721('0x22')](_0x7721('0xf'),auth[_0x7721('0x9')](),controller[_0x7721('0x23')]);router[_0x7721('0x22')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x24')]);router[_0x7721('0x22')]('/:id/users',auth[_0x7721('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x1b8012,_0x564501){var _0x33f1b2=function(_0x50b542){while(--_0x50b542){_0x1b8012['push'](_0x1b8012['shift']());}};_0x33f1b2(++_0x564501);}(_0x6aa7,0x178));var _0x76aa=function(_0x5d1c79,_0x503a79){_0x5d1c79=_0x5d1c79-0x0;var _0x4e8627=_0x6aa7[_0x5d1c79];return _0x4e8627;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index c431d1f..f87e9ab 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 _0xf39d=['connectel','clicksend','plivo','clickatell','bandwidth','csc','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','sequelize','exports','name','STRING','generate','ENUM','twilio','skebby'];(function(_0x29ae80,_0x3579f1){var _0x5d6d71=function(_0xfaffe2){while(--_0xfaffe2){_0x29ae80['push'](_0x29ae80['shift']());}};_0x5d6d71(++_0x3579f1);}(_0xf39d,0x116));var _0xdf39=function(_0x1a8bbc,_0x17a086){_0x1a8bbc=_0x1a8bbc-0x0;var _0x212fc2=_0xf39d[_0x1a8bbc];return _0x212fc2;};'use strict';var Sequelize=require(_0xdf39('0x0'));var rs=require('randomstring');module[_0xdf39('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xdf39('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0xdf39('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xdf39('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xdf39('0x3')],'defaultValue':function(){return rs[_0xdf39('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xdf39('0x5')](_0xdf39('0x6'),_0xdf39('0x7'),_0xdf39('0x8'),_0xdf39('0x9'),_0xdf39('0xa'),_0xdf39('0xb'),_0xdf39('0xc'),_0xdf39('0xd'),'infobip',_0xdf39('0xe'))},'accountSid':{'type':Sequelize[_0xdf39('0x3')]},'authId':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0xdf39('0x3')]},'smsMethod':{'type':Sequelize[_0xdf39('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0xdf39('0x3')]},'password':{'type':Sequelize[_0xdf39('0x3')]},'apiKey':{'type':Sequelize[_0xdf39('0x3')]},'applicationId':{'type':Sequelize[_0xdf39('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize['STRING']},'deliveryReport':{'type':Sequelize[_0xdf39('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0xdf39('0x3')]},'notificationTemplate':{'type':Sequelize[_0xdf39('0x10')],'defaultValue':function(){return _0xdf39('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xdf39('0xf')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xdf39('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xdf39('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xdf39('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0xdf39('0x12')],'comment':_0xdf39('0x13')},'mandatoryDisposition':{'type':Sequelize[_0xdf39('0xf')],'defaultValue':![],'comment':_0xdf39('0x14'),'set':function(_0x44036b){if(!_0x44036b)this[_0xdf39('0x15')]('mandatoryDispositionPauseId',null);this[_0xdf39('0x15')]('mandatoryDisposition',_0x44036b);}}}; \ No newline at end of file +var _0x8e0c=['BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','ENUM','twilio','skebby','connectel','clicksend','plivo','clickatell','bandwidth','csc','infobip'];(function(_0x14094d,_0x7ee233){var _0x18038e=function(_0xad17e7){while(--_0xad17e7){_0x14094d['push'](_0x14094d['shift']());}};_0x18038e(++_0x7ee233);}(_0x8e0c,0x199));var _0xc8e0=function(_0x1b68f6,_0x520a9f){_0x1b68f6=_0x1b68f6-0x0;var _0x3dea3a=_0x8e0c[_0x1b68f6];return _0x3dea3a;};'use strict';var Sequelize=require(_0xc8e0('0x0'));var rs=require(_0xc8e0('0x1'));module[_0xc8e0('0x2')]={'name':{'type':Sequelize[_0xc8e0('0x3')],'unique':_0xc8e0('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xc8e0('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xc8e0('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0xc8e0('0x3')],'defaultValue':function(){return rs[_0xc8e0('0x5')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xc8e0('0x6')](_0xc8e0('0x7'),_0xc8e0('0x8'),_0xc8e0('0x9'),_0xc8e0('0xa'),_0xc8e0('0xb'),_0xc8e0('0xc'),_0xc8e0('0xd'),_0xc8e0('0xe'),_0xc8e0('0xf'),'intelepeer')},'accountSid':{'type':Sequelize[_0xc8e0('0x3')]},'authId':{'type':Sequelize[_0xc8e0('0x3')]},'authToken':{'type':Sequelize[_0xc8e0('0x3')]},'smsMethod':{'type':Sequelize[_0xc8e0('0x6')]('SI','TI','GP')},'username':{'type':Sequelize[_0xc8e0('0x3')]},'password':{'type':Sequelize[_0xc8e0('0x3')]},'apiKey':{'type':Sequelize[_0xc8e0('0x3')]},'applicationId':{'type':Sequelize[_0xc8e0('0x3')]},'accountId':{'type':Sequelize[_0xc8e0('0x3')]},'senderString':{'type':Sequelize[_0xc8e0('0x3')]},'deliveryReport':{'type':Sequelize[_0xc8e0('0x10')],'defaultValue':![]},'description':{'type':Sequelize[_0xc8e0('0x3')]},'notificationTemplate':{'type':Sequelize[_0xc8e0('0x11')],'defaultValue':function(){return _0xc8e0('0x12');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xc8e0('0x10')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xc8e0('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xc8e0('0x10')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xc8e0('0x10')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xc8e0('0x13')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0xc8e0('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0xc8e0('0x13')],'comment':_0xc8e0('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xc8e0('0x10')],'defaultValue':![],'comment':_0xc8e0('0x15'),'set':function(_0x3acc3b){if(!_0x3acc3b)this[_0xc8e0('0x16')](_0xc8e0('0x17'),null);this[_0xc8e0('0x16')](_0xc8e0('0x18'),_0x3acc3b);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index d6b2c69..33a8055 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 _0xb654=['priority','asc','Sequelize','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','connectel','message_id','plivo','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','replyMessageId','intelepeer','refid','isNil','ValidationError','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','list','omit','CmContact','contact','SmsInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','ContactId','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','text/xml','send','\x0a','addApplications','transaction','bulkCreate','findAndCountAll','getApplications','getInteractions','Contact','Owner','internal','Tags','tag','to\x20is\x20mandatory','List','SmsMessage','Messages','dataValues','received\x20delivery\x20report\x20from','inspect','skebby','skebby_dispatch_id','statusInt','clicksend','status_code','groupName','DELIVERED','clickatell','redif','error_code','bandwidth','DELIVRD','ACCEPTD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','userSmsAccount:remove','getAgents','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','SmsAccount,\x20%s,\x20%s','result','catch','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','destroy','stack','index','Pause','mandatoryDispositionPause','map','rawAttributes','type','key','name','query','model','attributes','intersection','fields','length','nolimit','order','sort','filters','pick','filter','merge','VIRTUAL','options','where','includeAll','include','show','params','keys','SmsAccount','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','hasOwnProperty','findAll','rows','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','findOne','removeAnswers','sms','SmsApplication','account','applications','Applications'];(function(_0x5275fd,_0xd1ca40){var _0x3c2fed=function(_0x45103e){while(--_0x45103e){_0x5275fd['push'](_0x5275fd['shift']());}};_0x3c2fed(++_0xd1ca40);}(_0xb654,0x6b));var _0x4b65=function(_0x408522,_0x5ecaca){_0x408522=_0x408522-0x0;var _0x4b5113=_0xb654[_0x408522];return _0x4b5113;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4b65('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4b65('0x1'));var rp=require(_0x4b65('0x2'));var moment=require(_0x4b65('0x3'));var BPromise=require(_0x4b65('0x4'));var Mustache=require('mustache');var util=require(_0x4b65('0x5'));var path=require(_0x4b65('0x6'));var sox=require(_0x4b65('0x7'));var csv=require(_0x4b65('0x8'));var ejs=require(_0x4b65('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x4b65('0xa'));var crypto=require(_0x4b65('0xb'));var jsforce=require(_0x4b65('0xc'));var deskjs=require(_0x4b65('0xd'));var toCsv=require(_0x4b65('0x8'));var querystring=require('querystring');var Papa=require(_0x4b65('0xe'));var Redis=require('ioredis');var authService=require(_0x4b65('0xf'));var qs=require(_0x4b65('0x10'));var as=require(_0x4b65('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b65('0x12'))(_0x4b65('0x13'));var utils=require(_0x4b65('0x14'));var config=require(_0x4b65('0x15'));var licenseUtil=require(_0x4b65('0x16'));var db=require('../../mysqldb')['db'];config[_0x4b65('0x17')]=_[_0x4b65('0x18')](config['redis'],{'host':_0x4b65('0x19'),'port':0x18eb});var socket=require(_0x4b65('0x1a'))(new Redis(config['redis']));require(_0x4b65('0x1b'))[_0x4b65('0x1c')](socket);var jayson=require(_0x4b65('0x1d'));var client=jayson[_0x4b65('0x1e')][_0x4b65('0x1f')]({'port':0x232c});function respondWithRpcPromise(_0x429bc5,_0x532da8,_0x62e7c6,_0x21c2ed){return new BPromise(function(_0x55cf4d,_0x566326){var _0x35a2b6=_0x21c2ed||client;return _0x35a2b6[_0x4b65('0x20')](_0x429bc5,_0x62e7c6)[_0x4b65('0x21')](function(_0x1c90ce){logger[_0x4b65('0x22')]('SmsAccount,\x20%s,\x20%s',_0x532da8,'request\x20sent');logger[_0x4b65('0x23')](_0x4b65('0x24'),_0x532da8,_0x4b65('0x25'),JSON[_0x4b65('0x26')](_0x1c90ce));if(_0x1c90ce[_0x4b65('0x27')]){if(_0x1c90ce[_0x4b65('0x27')][_0x4b65('0x28')]===0x1f4){logger[_0x4b65('0x27')]('SmsAccount,\x20%s,\x20%s',_0x532da8,_0x1c90ce[_0x4b65('0x27')][_0x4b65('0x29')]);return _0x566326(_0x1c90ce[_0x4b65('0x27')][_0x4b65('0x29')]);}logger['error'](_0x4b65('0x2a'),_0x532da8,_0x1c90ce[_0x4b65('0x27')]['message']);return _0x55cf4d(_0x1c90ce[_0x4b65('0x27')]['message']);}else{logger['info'](_0x4b65('0x2a'),_0x532da8,_0x4b65('0x25'));_0x55cf4d(_0x1c90ce[_0x4b65('0x2b')][_0x4b65('0x29')]);}})[_0x4b65('0x2c')](function(_0x327dd4){logger[_0x4b65('0x27')](_0x4b65('0x2a'),_0x532da8,_0x327dd4);_0x566326(_0x327dd4);});});}function respondWithStatusCode(_0x4249f6,_0x162a3b){_0x162a3b=_0x162a3b||0xcc;return function(_0xa83ff){if(_0xa83ff){return _0x4249f6[_0x4b65('0x2d')](_0x162a3b);}return _0x4249f6['status'](_0x162a3b)[_0x4b65('0x2e')]();};}function respondWithResult(_0x2b8e78,_0x5e031f){_0x5e031f=_0x5e031f||0xc8;return function(_0x3ff091){if(_0x3ff091){return _0x2b8e78[_0x4b65('0x2f')](_0x5e031f)[_0x4b65('0x30')](_0x3ff091);}};}function respondWithFilteredResult(_0x48f29b,_0x1e74ba){return function(_0x4c743d){if(_0x4c743d){var _0x237e6f=typeof _0x1e74ba[_0x4b65('0x31')]===_0x4b65('0x32')&&typeof _0x1e74ba[_0x4b65('0x33')]===_0x4b65('0x32');var _0x43d9c7=_0x4c743d[_0x4b65('0x34')];var _0x5f4ec5=_0x237e6f?0x0:_0x1e74ba[_0x4b65('0x31')];var _0x404418=_0x237e6f?_0x4c743d[_0x4b65('0x34')]:_0x1e74ba[_0x4b65('0x31')]+_0x1e74ba[_0x4b65('0x33')];var _0x10fd5b;if(_0x404418>=_0x43d9c7){_0x404418=_0x43d9c7;_0x10fd5b=0xc8;}else{_0x10fd5b=0xce;}_0x48f29b['status'](_0x10fd5b);return _0x48f29b[_0x4b65('0x35')](_0x4b65('0x36'),_0x5f4ec5+'-'+_0x404418+'/'+_0x43d9c7)[_0x4b65('0x30')](_0x4c743d);}return null;};}function patchUpdates(_0x24a7b6){return function(_0xe90210){try{jsonpatch[_0x4b65('0x37')](_0xe90210,_0x24a7b6,!![]);}catch(_0x590797){return BPromise[_0x4b65('0x38')](_0x590797);}return _0xe90210['save']();};}function saveUpdates(_0x46921f,_0x313b00){return function(_0x2ed324){if(_0x2ed324){return _0x2ed324[_0x4b65('0x39')](_0x46921f)[_0x4b65('0x21')](function(_0x537316){return _0x537316;});}return null;};}function removeEntity(_0x4cabeb,_0x5837b4){return function(_0x2fa46c){if(_0x2fa46c){return _0x2fa46c['destroy']()[_0x4b65('0x21')](function(){var _0x353149=_0x2fa46c['get']({'plain':!![]});var _0x340cf9='SmsAccounts';return db['UserProfileResource'][_0x4b65('0x3a')]({'where':{'type':_0x340cf9,'resourceId':_0x353149['id']}})[_0x4b65('0x21')](function(){return _0x2fa46c;});})[_0x4b65('0x21')](function(){_0x4cabeb[_0x4b65('0x2f')](0xcc)[_0x4b65('0x2e')]();});}};}function handleEntityNotFound(_0x38a966,_0x13bc5e){return function(_0x5b8fc4){if(!_0x5b8fc4){_0x38a966[_0x4b65('0x2d')](0x194);}return _0x5b8fc4;};}function handleError(_0x19828e,_0x193b58){_0x193b58=_0x193b58||0x1f4;return function(_0x4dd991){logger[_0x4b65('0x27')](_0x4dd991[_0x4b65('0x3b')]);if(_0x4dd991['name']){delete _0x4dd991['name'];}_0x19828e['status'](_0x193b58)['send'](_0x4dd991);};}exports[_0x4b65('0x3c')]=function(_0x3aa655,_0xa56ee7){var _0x5bedbe={'include':[{'model':db[_0x4b65('0x3d')],'as':_0x4b65('0x3e')}]},_0xf2126f={},_0x574871={'count':0x0,'rows':[]};var _0x1991b6=_[_0x4b65('0x3f')](db['SmsAccount'][_0x4b65('0x40')],function(_0x1d3496){return{'name':_0x1d3496['fieldName'],'type':_0x1d3496[_0x4b65('0x41')][_0x4b65('0x42')]};});_0xf2126f['model']=_[_0x4b65('0x3f')](_0x1991b6,_0x4b65('0x43'));_0xf2126f[_0x4b65('0x44')]=_['keys'](_0x3aa655['query']);_0xf2126f['filters']=_['intersection'](_0xf2126f[_0x4b65('0x45')],_0xf2126f[_0x4b65('0x44')]);_0x5bedbe[_0x4b65('0x46')]=_[_0x4b65('0x47')](_0xf2126f[_0x4b65('0x45')],qs[_0x4b65('0x48')](_0x3aa655[_0x4b65('0x44')][_0x4b65('0x48')]));_0x5bedbe['attributes']=_0x5bedbe[_0x4b65('0x46')][_0x4b65('0x49')]?_0x5bedbe[_0x4b65('0x46')]:_0xf2126f['model'];if(!_0x3aa655[_0x4b65('0x44')]['hasOwnProperty'](_0x4b65('0x4a'))){_0x5bedbe['limit']=qs['limit'](_0x3aa655[_0x4b65('0x44')][_0x4b65('0x33')]);_0x5bedbe['offset']=qs['offset'](_0x3aa655[_0x4b65('0x44')]['offset']);}_0x5bedbe[_0x4b65('0x4b')]=qs[_0x4b65('0x4c')](_0x3aa655[_0x4b65('0x44')]['sort']);_0x5bedbe['where']=qs[_0x4b65('0x4d')](_[_0x4b65('0x4e')](_0x3aa655[_0x4b65('0x44')],_0xf2126f[_0x4b65('0x4d')]),_0x1991b6);if(_0x3aa655[_0x4b65('0x44')][_0x4b65('0x4f')]){_0x5bedbe['where']=_[_0x4b65('0x50')](_0x5bedbe['where'],{'$or':_[_0x4b65('0x3f')](_0x1991b6,function(_0x4d8e17){if(_0x4d8e17[_0x4b65('0x41')]!==_0x4b65('0x51')){var _0x41b7d6={};_0x41b7d6[_0x4d8e17[_0x4b65('0x43')]]={'$like':'%'+_0x3aa655[_0x4b65('0x44')][_0x4b65('0x4f')]+'%'};return _0x41b7d6;}})});}_0x5bedbe=_[_0x4b65('0x50')]({},_0x5bedbe,_0x3aa655[_0x4b65('0x52')]);var _0x4e23f6={'where':_0x5bedbe[_0x4b65('0x53')]};return db['SmsAccount'][_0x4b65('0x34')](_0x4e23f6)[_0x4b65('0x21')](function(_0x2e4b16){_0x574871[_0x4b65('0x34')]=_0x2e4b16;if(_0x3aa655['query'][_0x4b65('0x54')]){_0x5bedbe[_0x4b65('0x55')]=[{'all':!![]}];}return db['SmsAccount']['findAll'](_0x5bedbe);})[_0x4b65('0x21')](function(_0x260142){_0x574871['rows']=_0x260142;return _0x574871;})['then'](respondWithFilteredResult(_0xa56ee7,_0x5bedbe))[_0x4b65('0x2c')](handleError(_0xa56ee7,null));};exports[_0x4b65('0x56')]=function(_0x56c098,_0x2e7ce5){var _0x41eee5={'raw':![],'where':{'id':_0x56c098[_0x4b65('0x57')]['id']},'include':[{'model':db[_0x4b65('0x3d')],'as':'mandatoryDispositionPause'}]},_0x447506={};_0x447506[_0x4b65('0x45')]=_[_0x4b65('0x58')](db[_0x4b65('0x59')][_0x4b65('0x40')]);_0x447506[_0x4b65('0x44')]=_[_0x4b65('0x58')](_0x56c098[_0x4b65('0x44')]);_0x447506[_0x4b65('0x4d')]=_[_0x4b65('0x47')](_0x447506[_0x4b65('0x45')],_0x447506['query']);_0x41eee5['attributes']=_['intersection'](_0x447506['model'],qs['fields'](_0x56c098[_0x4b65('0x44')][_0x4b65('0x48')]));_0x41eee5[_0x4b65('0x46')]=_0x41eee5[_0x4b65('0x46')]['length']?_0x41eee5[_0x4b65('0x46')]:_0x447506[_0x4b65('0x45')];if(_0x56c098[_0x4b65('0x44')][_0x4b65('0x54')]){_0x41eee5[_0x4b65('0x55')]=[{'all':!![]}];}_0x41eee5=_[_0x4b65('0x50')]({},_0x41eee5,_0x56c098[_0x4b65('0x52')]);return db[_0x4b65('0x59')][_0x4b65('0x5a')](_0x41eee5)[_0x4b65('0x21')](handleEntityNotFound(_0x2e7ce5,null))[_0x4b65('0x21')](respondWithResult(_0x2e7ce5,null))[_0x4b65('0x2c')](handleError(_0x2e7ce5,null));};exports['create']=function(_0x1ba345,_0x2b7218){return db[_0x4b65('0x59')][_0x4b65('0x5b')](_0x1ba345[_0x4b65('0x5c')],{})['then'](function(_0x6b0bcd){var _0x1f824d=_0x1ba345[_0x4b65('0x5d')][_0x4b65('0x5e')]({'plain':!![]});if(!_0x1f824d)throw new Error(_0x4b65('0x5f'));if(_0x1f824d[_0x4b65('0x60')]===_0x4b65('0x5d')){var _0x482539=_0x6b0bcd[_0x4b65('0x5e')]({'plain':!![]});var _0xf9feb0='SmsAccounts';return db[_0x4b65('0x61')][_0x4b65('0x5a')]({'where':{'name':_0xf9feb0,'userProfileId':_0x1f824d[_0x4b65('0x62')]},'raw':!![]})[_0x4b65('0x21')](function(_0x19d168){if(_0x19d168&&_0x19d168['autoAssociation']===0x0){return db[_0x4b65('0x63')][_0x4b65('0x5b')]({'name':_0x482539[_0x4b65('0x43')],'resourceId':_0x482539['id'],'type':_0x19d168[_0x4b65('0x43')],'sectionId':_0x19d168['id']},{})[_0x4b65('0x21')](function(){return _0x6b0bcd;});}else{return _0x6b0bcd;}})[_0x4b65('0x2c')](function(_0x455b3b){logger[_0x4b65('0x27')](_0x4b65('0x64'),_0x455b3b);throw _0x455b3b;});}return _0x6b0bcd;})[_0x4b65('0x21')](respondWithResult(_0x2b7218,0xc9))[_0x4b65('0x2c')](handleError(_0x2b7218,null));};exports[_0x4b65('0x39')]=function(_0x5a6187,_0x386749){if(_0x5a6187['body']['id']){delete _0x5a6187[_0x4b65('0x5c')]['id'];}return db[_0x4b65('0x59')][_0x4b65('0x5a')]({'where':{'id':_0x5a6187[_0x4b65('0x57')]['id']},'include':[{'model':db[_0x4b65('0x3d')],'as':_0x4b65('0x3e')}]})[_0x4b65('0x21')](handleEntityNotFound(_0x386749,null))['then'](saveUpdates(_0x5a6187[_0x4b65('0x5c')],null))[_0x4b65('0x21')](respondWithResult(_0x386749,null))['catch'](handleError(_0x386749,null));};exports[_0x4b65('0x3a')]=function(_0xc23f8,_0xc9ec0b){return db['SmsAccount'][_0x4b65('0x5a')]({'where':{'id':_0xc23f8['params']['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0xc9ec0b,null))[_0x4b65('0x21')](removeEntity(_0xc9ec0b,null))['catch'](handleError(_0xc9ec0b,null));};exports[_0x4b65('0x65')]=function(_0x2337fd,_0x3e01c8){return db[_0x4b65('0x59')]['describe']()[_0x4b65('0x21')](respondWithResult(_0x3e01c8,null))[_0x4b65('0x2c')](handleError(_0x3e01c8,null));};exports[_0x4b65('0x66')]=function(_0x20a01b,_0x21329d,_0xf579ba){if(_0x20a01b[_0x4b65('0x5c')]['id']){delete _0x20a01b[_0x4b65('0x5c')]['id'];}return db[_0x4b65('0x59')][_0x4b65('0x5a')]({'where':{'id':_0x20a01b[_0x4b65('0x57')]['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0x21329d,null))[_0x4b65('0x21')](function(_0x2fa4f3){if(_0x2fa4f3){_0x20a01b[_0x4b65('0x5c')][_0x4b65('0x67')]=_0x2fa4f3['id'];return db[_0x4b65('0x68')][_0x4b65('0x5b')](_0x20a01b[_0x4b65('0x5c')]);}})[_0x4b65('0x21')](respondWithResult(_0x21329d,null))[_0x4b65('0x2c')](handleError(_0x21329d,null));};exports['getDispositions']=function(_0xb4e75d,_0x3029df,_0x56cf0e){var _0x4498ed={'raw':![],'where':{}};var _0x2f9a3d={};var _0x510915={'count':0x0,'rows':[]};return db[_0x4b65('0x59')]['findOne']({'where':{'id':_0xb4e75d[_0x4b65('0x57')]['id']}})['then'](handleEntityNotFound(_0x3029df,null))[_0x4b65('0x21')](function(_0x1bdfac){if(_0x1bdfac){_0x2f9a3d[_0x4b65('0x45')]=_[_0x4b65('0x58')](db[_0x4b65('0x68')][_0x4b65('0x40')]);_0x2f9a3d['query']=_[_0x4b65('0x58')](_0xb4e75d[_0x4b65('0x44')]);_0x2f9a3d[_0x4b65('0x4d')]=_[_0x4b65('0x47')](_0x2f9a3d[_0x4b65('0x45')],_0x2f9a3d[_0x4b65('0x44')]);_0x4498ed[_0x4b65('0x46')]=_[_0x4b65('0x47')](_0x2f9a3d[_0x4b65('0x45')],qs[_0x4b65('0x48')](_0xb4e75d['query'][_0x4b65('0x48')]));_0x4498ed[_0x4b65('0x46')]=_0x4498ed[_0x4b65('0x46')][_0x4b65('0x49')]?_0x4498ed[_0x4b65('0x46')]:_0x2f9a3d[_0x4b65('0x45')];if(!_0xb4e75d[_0x4b65('0x44')][_0x4b65('0x69')]('nolimit')){_0x4498ed[_0x4b65('0x33')]=qs[_0x4b65('0x33')](_0xb4e75d[_0x4b65('0x44')]['limit']);_0x4498ed['offset']=qs[_0x4b65('0x31')](_0xb4e75d['query'][_0x4b65('0x31')]);}_0x4498ed[_0x4b65('0x4b')]=qs[_0x4b65('0x4c')](_0xb4e75d[_0x4b65('0x44')][_0x4b65('0x4c')]);_0x4498ed[_0x4b65('0x53')]=qs[_0x4b65('0x4d')](_[_0x4b65('0x4e')](_0xb4e75d[_0x4b65('0x44')],_0x2f9a3d[_0x4b65('0x4d')]));_0x4498ed[_0x4b65('0x53')]['SmsAccountId']=_0x1bdfac['id'];if(_0xb4e75d[_0x4b65('0x44')][_0x4b65('0x4f')]){_0x4498ed['where']=_[_0x4b65('0x50')](_0x4498ed['where'],{'$or':_[_0x4b65('0x3f')](_0x4498ed[_0x4b65('0x46')],function(_0x178b23){var _0x59da63={};_0x59da63[_0x178b23]={'$like':'%'+_0xb4e75d[_0x4b65('0x44')][_0x4b65('0x4f')]+'%'};return _0x59da63;})});}_0x4498ed=_[_0x4b65('0x50')]({},_0x4498ed,_0xb4e75d[_0x4b65('0x52')]);return db[_0x4b65('0x68')][_0x4b65('0x34')]({'where':_0x4498ed['where']})[_0x4b65('0x21')](function(_0x2f3bd2){_0x510915[_0x4b65('0x34')]=_0x2f3bd2;if(_0xb4e75d[_0x4b65('0x44')]['includeAll']){_0x4498ed[_0x4b65('0x55')]=[{'all':!![]}];}return db[_0x4b65('0x68')][_0x4b65('0x6a')](_0x4498ed);})[_0x4b65('0x21')](function(_0x449bec){_0x510915[_0x4b65('0x6b')]=_0x449bec;return _0x510915;});}})['then'](respondWithFilteredResult(_0x3029df,_0x4498ed))[_0x4b65('0x2c')](handleError(_0x3029df,null));};exports[_0x4b65('0x6c')]=function(_0x1d607c,_0x4e7db7,_0x4f1778){return db['SmsAccount']['find']({'where':{'id':_0x1d607c[_0x4b65('0x57')]['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0x4e7db7,null))[_0x4b65('0x21')](function(_0x5db860){if(_0x5db860){return _0x5db860['removeDispositions'](_0x1d607c[_0x4b65('0x44')][_0x4b65('0x6d')]);}})[_0x4b65('0x21')](respondWithStatusCode(_0x4e7db7,null))[_0x4b65('0x2c')](handleError(_0x4e7db7,null));};exports[_0x4b65('0x6e')]=function(_0x206e0d,_0xf61a07,_0x3a60c7){if(_0x206e0d[_0x4b65('0x5c')]['id']){delete _0x206e0d[_0x4b65('0x5c')]['id'];}return db[_0x4b65('0x59')][_0x4b65('0x5a')]({'where':{'id':_0x206e0d[_0x4b65('0x57')]['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0xf61a07,null))['then'](function(_0x4f8029){if(_0x4f8029){_0x206e0d['body']['SmsAccountId']=_0x4f8029['id'];return db[_0x4b65('0x6f')][_0x4b65('0x5b')](_0x206e0d[_0x4b65('0x5c')]);}})['then'](respondWithResult(_0xf61a07,null))[_0x4b65('0x2c')](handleError(_0xf61a07,null));};exports[_0x4b65('0x70')]=function(_0x4a6771,_0x44610f,_0x89ce60){var _0x238504={'raw':![],'where':{}};var _0x5191e2={};var _0x1c9bd7={'count':0x0,'rows':[]};return db['SmsAccount'][_0x4b65('0x71')]({'where':{'id':_0x4a6771[_0x4b65('0x57')]['id']}})['then'](handleEntityNotFound(_0x44610f,null))['then'](function(_0x50b084){if(_0x50b084){_0x5191e2[_0x4b65('0x45')]=_[_0x4b65('0x58')](db[_0x4b65('0x6f')][_0x4b65('0x40')]);_0x5191e2[_0x4b65('0x44')]=_[_0x4b65('0x58')](_0x4a6771['query']);_0x5191e2[_0x4b65('0x4d')]=_[_0x4b65('0x47')](_0x5191e2[_0x4b65('0x45')],_0x5191e2[_0x4b65('0x44')]);_0x238504['attributes']=_[_0x4b65('0x47')](_0x5191e2['model'],qs[_0x4b65('0x48')](_0x4a6771[_0x4b65('0x44')][_0x4b65('0x48')]));_0x238504[_0x4b65('0x46')]=_0x238504['attributes'][_0x4b65('0x49')]?_0x238504[_0x4b65('0x46')]:_0x5191e2[_0x4b65('0x45')];if(!_0x4a6771[_0x4b65('0x44')][_0x4b65('0x69')](_0x4b65('0x4a'))){_0x238504['limit']=qs[_0x4b65('0x33')](_0x4a6771[_0x4b65('0x44')]['limit']);_0x238504[_0x4b65('0x31')]=qs['offset'](_0x4a6771['query'][_0x4b65('0x31')]);}_0x238504['order']=qs['sort'](_0x4a6771[_0x4b65('0x44')][_0x4b65('0x4c')]);_0x238504[_0x4b65('0x53')]=qs[_0x4b65('0x4d')](_[_0x4b65('0x4e')](_0x4a6771[_0x4b65('0x44')],_0x5191e2['filters']));_0x238504[_0x4b65('0x53')]['SmsAccountId']=_0x50b084['id'];if(_0x4a6771[_0x4b65('0x44')][_0x4b65('0x4f')]){_0x238504[_0x4b65('0x53')]=_[_0x4b65('0x50')](_0x238504[_0x4b65('0x53')],{'$or':_['map'](_0x238504[_0x4b65('0x46')],function(_0x49c8ee){var _0xfa6642={};_0xfa6642[_0x49c8ee]={'$like':'%'+_0x4a6771[_0x4b65('0x44')][_0x4b65('0x4f')]+'%'};return _0xfa6642;})});}_0x238504=_[_0x4b65('0x50')]({},_0x238504,_0x4a6771[_0x4b65('0x52')]);return db['CannedAnswer']['count']({'where':_0x238504['where']})[_0x4b65('0x21')](function(_0x50ed6a){_0x1c9bd7[_0x4b65('0x34')]=_0x50ed6a;if(_0x4a6771[_0x4b65('0x44')][_0x4b65('0x54')]){_0x238504[_0x4b65('0x55')]=[{'all':!![]}];}return db[_0x4b65('0x6f')][_0x4b65('0x6a')](_0x238504);})['then'](function(_0x5deed4){_0x1c9bd7[_0x4b65('0x6b')]=_0x5deed4;return _0x1c9bd7;});}})[_0x4b65('0x21')](respondWithFilteredResult(_0x44610f,_0x238504))['catch'](handleError(_0x44610f,null));};exports[_0x4b65('0x72')]=function(_0x3e363f,_0x2c9938,_0x45b6e8){return db['SmsAccount'][_0x4b65('0x5a')]({'where':{'id':_0x3e363f[_0x4b65('0x57')]['id']}})['then'](handleEntityNotFound(_0x2c9938,null))['then'](function(_0x2b3784){if(_0x2b3784){return _0x2b3784[_0x4b65('0x72')](_0x3e363f[_0x4b65('0x44')][_0x4b65('0x6d')]);}})[_0x4b65('0x21')](respondWithStatusCode(_0x2c9938,null))[_0x4b65('0x2c')](handleError(_0x2c9938,null));};exports['notify']=function(_0x44eff9,_0x281af5,_0x24596b){var _0x18a713={'channel':_0x4b65('0x73')};var _0x5a27f8=[];var _0x1165ad=[];var _0x181808={};return db['SmsAccount']['find']({'where':{'id':_0x44eff9[_0x4b65('0x57')]['id']},'include':[{'model':db[_0x4b65('0x74')],'as':'Applications'}]})[_0x4b65('0x21')](handleEntityNotFound(_0x281af5,null))['then'](function(_0x38051c){_0x18a713[_0x4b65('0x75')]=_0x38051c;_0x18a713[_0x4b65('0x76')]=_['orderBy'](_0x38051c[_0x4b65('0x77')],[_0x4b65('0x78')],[_0x4b65('0x79')]);if(_0x18a713[_0x4b65('0x75')][_0x4b65('0x77')]){delete _0x18a713[_0x4b65('0x75')][_0x4b65('0x77')];}return db['CmContact'][_0x4b65('0x65')]();})[_0x4b65('0x21')](function(_0x48328c){if(!_0x48328c){throw new db[(_0x4b65('0x7a'))]['ValidationError'](_0x4b65('0x7b'));}_0x5a27f8=_[_0x4b65('0x7c')](_[_0x4b65('0x58')](_0x48328c),[_0x4b65('0x7d'),_0x4b65('0x7e')]);_0x1165ad=_[_0x4b65('0x7c')](_[_0x4b65('0x58')](_0x48328c),[_0x4b65('0x7d'),'updatedAt',_0x4b65('0x7f'),_0x4b65('0x80')]);_0x18a713['body']={'mapKey':_0x4b65('0x81')};if(_0x18a713[_0x4b65('0x75')][_0x4b65('0x41')]){switch(_0x18a713[_0x4b65('0x75')][_0x4b65('0x41')]){case _0x4b65('0x82'):_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x84')];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x5c')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x85')];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x86')]=_0x44eff9['body'][_0x4b65('0x87')];break;case'skebby':_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')]='+'+_0x44eff9['body'][_0x4b65('0x88')];_0x18a713['body'][_0x4b65('0x5c')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x89')];break;case _0x4b65('0x8a'):_0x18a713['body'][_0x4b65('0x83')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x83')];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x5c')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x29')];break;case'clicksend':_0x18a713['body'][_0x4b65('0x83')]=_0x44eff9[_0x4b65('0x5c')]['from'];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x5c')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x5c')];_0x18a713[_0x4b65('0x5c')]['messageId']=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x8b')];break;case _0x4b65('0x8c'):_0x18a713[_0x4b65('0x5c')]['from']=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x84')];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x5c')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x8d')];_0x18a713['body'][_0x4b65('0x86')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x8e')];break;case _0x4b65('0x8f'):_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')]='+'+_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x90')][0x0][_0x4b65('0x83')];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x5c')]=_0x44eff9[_0x4b65('0x5c')]['results'][0x0]['text'];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x86')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x90')][0x0]['messageId'];break;case _0x4b65('0x91'):_0x18a713['body'][_0x4b65('0x83')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x92')];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x5c')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x93')]['message'];break;case'clickatell':_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')]=_0x44eff9[_0x4b65('0x5c')]['fromNumber'];_0x18a713[_0x4b65('0x5c')]['body']=_0x44eff9[_0x4b65('0x5c')]['text'];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x86')]=_0x44eff9['body'][_0x4b65('0x94')];break;case'bandwidth':_0x18a713[_0x4b65('0x5c')][_0x4b65('0x86')]=_0x44eff9[_0x4b65('0x5c')][0x0][_0x4b65('0x29')]['id'];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')]=_0x44eff9[_0x4b65('0x5c')][0x0][_0x4b65('0x29')]['from'];_0x18a713['body'][_0x4b65('0x5c')]=_0x44eff9[_0x4b65('0x5c')][0x0][_0x4b65('0x29')][_0x4b65('0x89')];break;case _0x4b65('0x95'):_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x83')];_0x18a713[_0x4b65('0x5c')]['body']=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x29')];_0x18a713[_0x4b65('0x5c')][_0x4b65('0x86')]=_0x44eff9[_0x4b65('0x5c')][_0x4b65('0x96')];break;}}if(_0x18a713[_0x4b65('0x5c')]['id']){delete _0x18a713[_0x4b65('0x5c')]['id'];}if(_[_0x4b65('0x97')](_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')])){throw new db[(_0x4b65('0x7a'))][(_0x4b65('0x98'))](_0x4b65('0x99'));}if(_[_0x4b65('0x97')](_0x18a713['body'][_0x4b65('0x5c')])||_0x18a713['body'][_0x4b65('0x5c')]===''){throw new db[(_0x4b65('0x7a'))][(_0x4b65('0x98'))](_0x4b65('0x9a'));}if(_[_0x4b65('0x97')](_0x18a713[_0x4b65('0x5c')][_0x4b65('0x9b')])){throw new db[(_0x4b65('0x7a'))][(_0x4b65('0x98'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1165ad);}if(!_[_0x4b65('0x9c')](_0x1165ad,_0x18a713['body'][_0x4b65('0x9b')])){throw new db['Sequelize']['ValidationError'](_0x4b65('0x9d')+_0x1165ad);}_0x181808[_0x18a713[_0x4b65('0x5c')]['mapKey']]=_0x18a713[_0x4b65('0x5c')]['from'];return db[_0x4b65('0x9e')][_0x4b65('0x5a')]({'where':{'id':_0x18a713[_0x4b65('0x75')]['ListId']},'include':[{'model':db['CmContact'],'as':_0x4b65('0x9f'),'where':_0x181808,'limit':0x1,'order':[[_0x4b65('0x7e'),_0x4b65('0xa0')]]}]});})[_0x4b65('0x21')](handleEntityNotFound(_0x281af5,null))[_0x4b65('0x21')](function(_0x4eb2ec){if(_0x4eb2ec){_0x18a713[_0x4b65('0xa1')]=_[_0x4b65('0xa2')](_0x4eb2ec,[_0x4b65('0x9f')]);if(_0x4eb2ec[_0x4b65('0x9f')][_0x4b65('0x49')]){return _0x4eb2ec[_0x4b65('0x9f')][0x0];}var _0x30716b=_[_0x4b65('0x18')](_0x18a713[_0x4b65('0x5c')],{'firstName':_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')],'ListId':_0x4eb2ec['id']});_0x30716b[_0x18a713['body']['mapKey']]=_0x18a713['body']['from'];return db[_0x4b65('0xa3')][_0x4b65('0x5b')](_0x30716b,{'fields':_0x5a27f8,'raw':!![]});}})[_0x4b65('0x21')](handleEntityNotFound(_0x281af5,null))[_0x4b65('0x21')](function(_0x51188e){if(_0x51188e){_0x18a713[_0x4b65('0xa4')]=_0x51188e;var _0x3748a4={'ContactId':_0x51188e['id'],'phone':_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')],'SmsAccountId':_0x44eff9[_0x4b65('0x57')]['id']};var _0x25bc76={'ContactId':_0x51188e['id'],'SmsAccountId':_0x44eff9[_0x4b65('0x57')]['id'],'closed':![]};return db[_0x4b65('0xa5')][_0x4b65('0x5a')]({'where':_0x25bc76})[_0x4b65('0x21')](function(_0x4f3d5e){if(_0x4f3d5e){return[_0x4f3d5e,![]];}return db['SmsInteraction'][_0x4b65('0x5b')](_0x3748a4)['then'](function(_0x412b51){return[_0x412b51,!![]];});});}})[_0x4b65('0xa6')](function(_0x23a3fe,_0x321933){_0x18a713[_0x4b65('0xa7')]=_0x23a3fe[_0x4b65('0x5e')]({'plain':!![]});_0x18a713[_0x4b65('0xa7')][_0x4b65('0xa8')]=![];if(_0x321933){if(_0x18a713[_0x4b65('0x75')][_0x4b65('0xa9')]){_0x18a713['applications'][_0x4b65('0xaa')]({'id':0x0,'priority':_0x18a713['applications'][_0x4b65('0x49')]+0x1,'app':_0x4b65('0xab'),'appdata':'unmanaged','interval':_0x4b65('0xac')});}_0x18a713['interaction'][_0x4b65('0xa8')]=!![];}return db['SmsMessage'][_0x4b65('0x5b')]({'phone':_0x18a713[_0x4b65('0x5c')][_0x4b65('0x83')],'messageId':_0x18a713[_0x4b65('0x5c')][_0x4b65('0x86')],'body':_0x18a713[_0x4b65('0x5c')]['body'],'SmsAccountId':_0x44eff9['params']['id'],'SmsInteractionId':_0x23a3fe['id'],'direction':'in','ContactId':_0x23a3fe[_0x4b65('0xad')],'AttachmentId':_0x18a713['body'][_0x4b65('0xae')]});})[_0x4b65('0x21')](function(_0x479b1e){_0x18a713['message']=_0x479b1e;if(_0x18a713['interaction'][_0x4b65('0xaf')]){return db[_0x4b65('0xb0')][_0x4b65('0x5a')]({'attributes':['id',_0x4b65('0x43')],'where':{'id':_0x18a713[_0x4b65('0xa7')]['UserId']}})['then'](function(_0x346617){if(_0x346617){_0x18a713[_0x4b65('0x76')][_0x4b65('0xb1')]({'id':0x0,'priority':0x0,'app':_0x4b65('0xb2'),'appdata':_0x346617[_0x4b65('0x43')]+','+(_0x18a713[_0x4b65('0x75')][_0x4b65('0xb3')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x4b65('0xb4'),_0x4b65('0xb5'),_0x18a713);});}return respondWithRpcPromise('Start','startRouting',_0x18a713);})['then'](function(_0x492a60){if(_0x492a60){var _0x13a2bd=0xc8;var _0x58cc17=_0x4b65('0xb6');logger[_0x4b65('0x22')](_0x4b65('0x24'),_0x58cc17,_0x13a2bd,_0x4b65('0xb7'));logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x58cc17,_0x13a2bd,'entity\x20found',JSON[_0x4b65('0x26')](_0x492a60));if(_0x18a713[_0x4b65('0x75')]['type']===_0x4b65('0x82')){return _0x281af5[_0x4b65('0x2f')](_0x13a2bd)[_0x4b65('0x35')]('Content-Type',_0x4b65('0xb8'))[_0x4b65('0xb9')](_0x4b65('0xba'));}else{return _0x281af5[_0x4b65('0x2f')](_0x13a2bd)[_0x4b65('0x30')](_0x492a60);}}})[_0x4b65('0x2c')](handleError(_0x281af5,null));};exports[_0x4b65('0xbb')]=function(_0x37509c,_0x1d7c88,_0x2a2997){return db[_0x4b65('0x59')][_0x4b65('0x71')]({'where':{'id':_0x37509c[_0x4b65('0x57')]['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0x1d7c88,null))[_0x4b65('0x21')](function(_0x582ca8){if(_0x582ca8){return db['sequelize'][_0x4b65('0xbc')](function(_0x7c4530){return db[_0x4b65('0x74')][_0x4b65('0x3a')]({'where':{'SmsAccountId':_0x37509c[_0x4b65('0x57')]['id']},'transaction':_0x7c4530})[_0x4b65('0x21')](function(_0x4f3711){var _0x71a150=_[_0x4b65('0x3f')](_0x37509c[_0x4b65('0x5c')],function(_0x244408){_0x244408['SmsAccountId']=_0x37509c['params']['id'];return _0x244408;});return db[_0x4b65('0x74')][_0x4b65('0xbd')](_0x71a150,{'transaction':_0x7c4530});});})[_0x4b65('0x21')](function(){return db[_0x4b65('0x74')][_0x4b65('0xbe')]({'where':{'SmsAccountId':_0x37509c['params']['id']},'order':_0x4b65('0x78')});});}})[_0x4b65('0x21')](respondWithResult(_0x1d7c88,null))['catch'](handleError(_0x1d7c88,null));};exports[_0x4b65('0xbf')]=function(_0x3cf794,_0x14a5de,_0x5d9ada){var _0x1927b8={};var _0x35b87d={};var _0x30a235;var _0x1b2907;return db[_0x4b65('0x59')][_0x4b65('0x71')]({'where':{'id':_0x3cf794[_0x4b65('0x57')]['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0x14a5de,null))[_0x4b65('0x21')](function(_0x2453cf){if(_0x2453cf){_0x30a235=_0x2453cf;_0x35b87d[_0x4b65('0x45')]=_[_0x4b65('0x58')](db['SmsApplication'][_0x4b65('0x40')]);_0x35b87d[_0x4b65('0x44')]=_[_0x4b65('0x58')](_0x3cf794[_0x4b65('0x44')]);_0x35b87d['filters']=_[_0x4b65('0x47')](_0x35b87d[_0x4b65('0x45')],_0x35b87d[_0x4b65('0x44')]);_0x1927b8[_0x4b65('0x46')]=_[_0x4b65('0x47')](_0x35b87d[_0x4b65('0x45')],qs['fields'](_0x3cf794[_0x4b65('0x44')][_0x4b65('0x48')]));_0x1927b8[_0x4b65('0x46')]=_0x1927b8[_0x4b65('0x46')][_0x4b65('0x49')]?_0x1927b8[_0x4b65('0x46')]:_0x35b87d[_0x4b65('0x45')];_0x1927b8[_0x4b65('0x4b')]=qs[_0x4b65('0x4c')](_0x3cf794[_0x4b65('0x44')][_0x4b65('0x4c')]);_0x1927b8[_0x4b65('0x53')]=qs[_0x4b65('0x4d')](_[_0x4b65('0x4e')](_0x3cf794[_0x4b65('0x44')],_0x35b87d[_0x4b65('0x4d')]));if(_0x3cf794[_0x4b65('0x44')][_0x4b65('0x4f')]){_0x1927b8[_0x4b65('0x53')]=_['merge'](_0x1927b8[_0x4b65('0x53')],{'$or':_[_0x4b65('0x3f')](_0x1927b8[_0x4b65('0x46')],function(_0x10494c){var _0x1d51c9={};_0x1d51c9[_0x10494c]={'$like':'%'+_0x3cf794[_0x4b65('0x44')][_0x4b65('0x4f')]+'%'};return _0x1d51c9;})});}_0x1927b8=_[_0x4b65('0x50')]({},_0x1927b8,_0x3cf794[_0x4b65('0x52')]);return _0x30a235[_0x4b65('0xbf')](_0x1927b8);}})[_0x4b65('0x21')](function(_0x500556){if(_0x500556){_0x1b2907=_0x500556[_0x4b65('0x49')];if(!_0x3cf794[_0x4b65('0x44')]['hasOwnProperty'](_0x4b65('0x4a'))){_0x1927b8[_0x4b65('0x33')]=qs[_0x4b65('0x33')](_0x3cf794[_0x4b65('0x44')][_0x4b65('0x33')]);_0x1927b8[_0x4b65('0x31')]=qs['offset'](_0x3cf794['query'][_0x4b65('0x31')]);}return _0x30a235[_0x4b65('0xbf')](_0x1927b8);}})[_0x4b65('0x21')](function(_0x43f341){if(_0x43f341){return _0x43f341?{'count':_0x1b2907,'rows':_0x43f341}:null;}})[_0x4b65('0x21')](respondWithResult(_0x14a5de,null))[_0x4b65('0x2c')](handleError(_0x14a5de,null));};exports[_0x4b65('0xc0')]=function(_0x545a73,_0x1ca83c,_0x8642e5){var _0x15204c={'raw':![],'where':{}};var _0x38be54={};var _0x308951={'count':0x0,'rows':[]};return db[_0x4b65('0x59')][_0x4b65('0x71')]({'where':{'id':_0x545a73[_0x4b65('0x57')]['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0x1ca83c,null))[_0x4b65('0x21')](function(_0x30b364){if(_0x30b364){_0x38be54[_0x4b65('0x45')]=_[_0x4b65('0x58')](db[_0x4b65('0xa5')][_0x4b65('0x40')]);_0x38be54[_0x4b65('0x44')]=_[_0x4b65('0x58')](_0x545a73[_0x4b65('0x44')]);_0x38be54[_0x4b65('0x4d')]=_[_0x4b65('0x47')](_0x38be54[_0x4b65('0x45')],_0x38be54[_0x4b65('0x44')]);_0x15204c[_0x4b65('0x46')]=_[_0x4b65('0x47')](_0x38be54[_0x4b65('0x45')],qs[_0x4b65('0x48')](_0x545a73[_0x4b65('0x44')][_0x4b65('0x48')]));_0x15204c[_0x4b65('0x46')]=_0x15204c['attributes']['length']?_0x15204c[_0x4b65('0x46')]:_0x38be54[_0x4b65('0x45')];if(!_0x545a73[_0x4b65('0x44')]['hasOwnProperty']('nolimit')){_0x15204c[_0x4b65('0x33')]=qs['limit'](_0x545a73['query'][_0x4b65('0x33')]);_0x15204c[_0x4b65('0x31')]=qs[_0x4b65('0x31')](_0x545a73[_0x4b65('0x44')][_0x4b65('0x31')]);}_0x15204c[_0x4b65('0x4b')]=qs[_0x4b65('0x4c')](_0x545a73[_0x4b65('0x44')]['sort']);_0x15204c[_0x4b65('0x53')]=qs[_0x4b65('0x4d')](_[_0x4b65('0x4e')](_0x545a73[_0x4b65('0x44')],_0x38be54[_0x4b65('0x4d')]));_0x15204c[_0x4b65('0x53')]['SmsAccountId']=_0x30b364['id'];if(_0x545a73[_0x4b65('0x44')][_0x4b65('0x4f')]){_0x15204c[_0x4b65('0x53')]=_[_0x4b65('0x50')](_0x15204c['where'],{'$or':_['map'](_0x15204c['attributes'],function(_0x3c6199){var _0x19e8cf={};_0x19e8cf[_0x3c6199]={'$like':'%'+_0x545a73[_0x4b65('0x44')][_0x4b65('0x4f')]+'%'};return _0x19e8cf;})});}_0x15204c=_[_0x4b65('0x50')]({},_0x15204c,_0x545a73[_0x4b65('0x52')]);return db[_0x4b65('0xa5')]['count']({'where':_0x15204c[_0x4b65('0x53')]})['then'](function(_0x22c032){_0x308951[_0x4b65('0x34')]=_0x22c032;if(_0x545a73[_0x4b65('0x44')][_0x4b65('0x54')]){_0x15204c[_0x4b65('0x55')]=[{'model':db[_0x4b65('0xa3')],'as':_0x4b65('0xc1'),'required':![]},{'model':db[_0x4b65('0xb0')],'as':_0x4b65('0xc2'),'attributes':['name','fullname',_0x4b65('0xc3')],'required':![]},{'model':db['Tag'],'as':_0x4b65('0xc4'),'attributes':['id','name','color'],'where':_0x545a73['query'][_0x4b65('0xc5')]?{'id':_0x545a73['query']['tag']}:undefined,'required':_0x545a73[_0x4b65('0x44')][_0x4b65('0xc5')]?!![]:![]}];}return db[_0x4b65('0xa5')][_0x4b65('0x6a')](_0x15204c);})['then'](function(_0x100e73){_0x308951['rows']=_0x100e73;return _0x308951;});}})['then'](respondWithFilteredResult(_0x1ca83c,_0x15204c))['catch'](handleError(_0x1ca83c,null));};exports['send']=function(_0x3b765c,_0x107fbd,_0x54a10b){var _0x154cdc,_0x4f2712,_0x5aada3;if(_['isNil'](_0x3b765c[_0x4b65('0x5c')][_0x4b65('0x5c')])||_0x3b765c[_0x4b65('0x5c')][_0x4b65('0x5c')]===''){throw new db[(_0x4b65('0x7a'))]['ValidationError'](_0x4b65('0x9a'));}if(_[_0x4b65('0x97')](_0x3b765c['body']['to'])){throw new db[(_0x4b65('0x7a'))][(_0x4b65('0x98'))](_0x4b65('0xc6'));}_0x154cdc=_0x3b765c[_0x4b65('0x5c')]['to'];return db[_0x4b65('0x59')][_0x4b65('0x5a')]({'where':{'id':_0x3b765c[_0x4b65('0x57')]['id']},'include':[{'model':db[_0x4b65('0x9e')],'as':_0x4b65('0xc7'),'include':[{'model':db[_0x4b65('0xa3')],'as':_0x4b65('0x9f'),'where':{'mobile':_0x154cdc},'limit':0x1,'order':[['updatedAt','DESC']]}]}]})[_0x4b65('0x21')](handleEntityNotFound(_0x107fbd,null))[_0x4b65('0x21')](function(_0x635712){if(_0x635712&&_0x635712[_0x4b65('0xc7')]){_0x4f2712=_0x635712[_0x4b65('0x5e')]({'plain':!![]});if(_0x4f2712['List']&&_0x4f2712[_0x4b65('0xc7')][_0x4b65('0x9f')][_0x4b65('0x49')]){return _0x4f2712['List'][_0x4b65('0x9f')][0x0];}return db[_0x4b65('0xa3')]['create'](_[_0x4b65('0x18')](_0x3b765c[_0x4b65('0x5c')],{'firstName':_0x154cdc,'mobile':_0x154cdc,'phone':_0x154cdc,'ListId':_0x4f2712['ListId']}));}})[_0x4b65('0x21')](handleEntityNotFound(_0x107fbd,null))[_0x4b65('0x21')](function(_0x54e3a7){if(_0x54e3a7){_0x5aada3=_0x54e3a7;return db[_0x4b65('0xa5')][_0x4b65('0x5a')]({'where':{'ContactId':_0x5aada3['id'],'closed':![],'SmsAccountId':_0x4f2712['id']}})['then'](function(_0x538ed5){if(_0x538ed5){return[_0x538ed5,![]];}return db[_0x4b65('0xa5')][_0x4b65('0x5b')]({'UserId':_0x3b765c[_0x4b65('0x5d')]['id'],'ContactId':_0x5aada3['id'],'SmsAccountId':_0x4f2712['id'],'phone':_0x154cdc,'firstMsgDirection':'out','Messages':[_[_0x4b65('0x50')](_0x3b765c[_0x4b65('0x5c')],{'read':![],'body':_0x3b765c[_0x4b65('0x5c')][_0x4b65('0x5c')],'phone':_0x154cdc,'SmsAccountId':_0x4f2712['id'],'UserId':_0x3b765c[_0x4b65('0x5d')]['id'],'ContactId':_0x5aada3['id']})]},{'include':[{'model':db[_0x4b65('0xc8')],'as':_0x4b65('0xc9')}]})['then'](function(_0x567427){return[_0x567427,!![]];});});}})['spread'](function(_0x401bc7,_0x4b3f54){if(_0x4b3f54){return _0x401bc7;}return db[_0x4b65('0xc8')][_0x4b65('0x5b')](_['merge'](_0x3b765c[_0x4b65('0x5c')],{'read':![],'body':_0x3b765c[_0x4b65('0x5c')]['body'],'phone':_0x154cdc,'SmsAccountId':_0x4f2712['id'],'SmsInteractionId':_0x401bc7['id'],'UserId':_0x3b765c[_0x4b65('0x5d')]['id'],'ContactId':_0x5aada3['id']}))['then'](function(_0x3acb9d){_0x401bc7[_0x4b65('0xca')][_0x4b65('0xc9')]=[];_0x401bc7[_0x4b65('0xca')][_0x4b65('0xc9')][_0x4b65('0xaa')](_0x3acb9d[_0x4b65('0xca')]);return _0x401bc7;});})[_0x4b65('0x21')](respondWithResult(_0x107fbd,null))['catch'](handleError(_0x107fbd,null));};exports['status']=function(_0x2fe81e,_0xbec0b,_0x54e1a1){if(_0x2fe81e[_0x4b65('0x5c')]['id']){delete _0x2fe81e[_0x4b65('0x5c')]['id'];}var _0xecd799,_0xa286d3,_0xbcfcff;return db[_0x4b65('0x59')]['find']({'where':{'id':_0x2fe81e['params']['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0xbec0b,null))[_0x4b65('0x21')](function(_0x4a0944){if(_0x4a0944){_0xbcfcff=_0x4a0944;logger[_0x4b65('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b65('0x2f'),_0x4b65('0xcb'),_0x4a0944[_0x4b65('0x41')],util[_0x4b65('0xcc')](_0x2fe81e[_0x4b65('0x5c')],{'showHidden':![],'depth':null}));switch(_0x4a0944[_0x4b65('0x41')]){case _0x4b65('0xcd'):if(_0x2fe81e['body'][_0x4b65('0xce')]&&_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0x2f')]){_0xa286d3=_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0x2f')];return db['SmsMessage'][_0x4b65('0x5a')]({'where':{'messageId':_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0xce')]}});}break;case _0x4b65('0x8a'):if(_0x2fe81e['body']['requestid']&&_0x2fe81e['body'][_0x4b65('0xcf')]){_0xa286d3=_0x2fe81e['body'][_0x4b65('0xcf')];return db[_0x4b65('0xc8')][_0x4b65('0x5a')]({'where':{'messageId':_0x2fe81e['body']['requestid']}});}break;case _0x4b65('0xd0'):if(_0x2fe81e[_0x4b65('0x5c')]['message_id']&&_0x2fe81e['body'][_0x4b65('0xd1')]){_0xa286d3=_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0xd1')];return db['SmsMessage'][_0x4b65('0x5a')]({'where':{'messageId':_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0x8b')]}});}break;case _0x4b65('0x8f'):var _0x49ca07=_0x2fe81e[_0x4b65('0x5c')]['results'][0x0];if(_0x49ca07[_0x4b65('0x86')]&&_0x49ca07[_0x4b65('0x2f')][_0x4b65('0xd2')]===_0x4b65('0xd3')){_0xa286d3=_0x49ca07[_0x4b65('0x2f')]['groupName'];return db[_0x4b65('0xc8')]['find']({'where':{'messageId':_0x49ca07[_0x4b65('0x86')]}});}break;case _0x4b65('0xd4'):if(_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0x86')]&&_0x2fe81e[_0x4b65('0x5c')]['status']){_0xa286d3=_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0x2f')];return db[_0x4b65('0xc8')][_0x4b65('0x5a')]({'where':{'messageId':_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0x86')]}});}break;case'bandwidth':if(_0x2fe81e['body'][0x0][_0x4b65('0x29')]['id']){_0xa286d3=_0x2fe81e[_0x4b65('0x5c')][0x0]['type'];return db[_0x4b65('0xc8')][_0x4b65('0x5a')]({'where':{'messageId':_0x2fe81e[_0x4b65('0x5c')][0x0][_0x4b65('0x29')]['id']}});}break;case _0x4b65('0x95'):if(_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0xd5')]&&_0x2fe81e[_0x4b65('0x5c')]['status']){_0xa286d3=_0x2fe81e['body'][_0x4b65('0x2f')];return db[_0x4b65('0xc8')][_0x4b65('0x5a')]({'where':{'messageId':_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0xd5')]}});}break;}}})[_0x4b65('0x21')](handleEntityNotFound(_0xbec0b,null))['then'](function(_0x234571){if(_0x234571){_0xecd799=_0x234571;switch(_0xbcfcff[_0x4b65('0x41')]){case'skebby':if(_0xa286d3===_0x4b65('0xd3')){return _0xecd799[_0x4b65('0x39')]({'read':!![]});}else{logger[_0x4b65('0x27')](_0x4b65('0x24'),_0x4b65('0x2f'),_0x4b65('0xcd'),util[_0x4b65('0xcc')](_0x2fe81e[_0x4b65('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4b65('0x8a'):if(_0xa286d3==='1'){return _0xecd799[_0x4b65('0x39')]({'read':!![]});}else{logger[_0x4b65('0x27')](_0x4b65('0x24'),'status',_0x4b65('0xcd'),util[_0x4b65('0xcc')](_0x2fe81e[_0x4b65('0x5c')],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x2fe81e[_0x4b65('0x5c')][_0x4b65('0xd6')]&&_0xa286d3>=0xc8&&_0xa286d3<=0xce){return _0xecd799['update']({'read':!![]});}else{logger['error'](_0x4b65('0x24'),'status',_0x4b65('0xd0'),util[_0x4b65('0xcc')](_0x2fe81e[_0x4b65('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4b65('0x8f'):var _0x407063=_0x2fe81e['body']['results'][0x0];if(_0x407063[_0x4b65('0x2f')][_0x4b65('0xd2')]===_0x4b65('0xd3')){return _0xecd799[_0x4b65('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x4b65('0x2f'),_0x4b65('0x8f'),util[_0x4b65('0xcc')](_0x2fe81e[_0x4b65('0x5c')],{'showHidden':![],'depth':null}));}break;case'clickatell':if(_0xa286d3=='DELIVERED_TO_GATEWAY'||_0xa286d3=='RECEIVED_BY_RECIPIENT'){return _0xecd799[_0x4b65('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4b65('0xd4'),util[_0x4b65('0xcc')](_0x2fe81e['body'],{'showHidden':![],'depth':null}));}break;case _0x4b65('0xd7'):if(_0xa286d3=='message-delivered'){return _0xecd799['update']({'read':!![]});}else{logger[_0x4b65('0x27')](_0x4b65('0x24'),_0x4b65('0x2f'),'bandwidth',util[_0x4b65('0xcc')](_0x2fe81e[_0x4b65('0x5c')],{'showHidden':![],'depth':null}));}break;case _0x4b65('0x95'):if(_0xa286d3===_0x4b65('0xd8')||_0xa286d3===_0x4b65('0xd9')){return _0xecd799[_0x4b65('0x39')]({'read':!![]});}else{logger[_0x4b65('0x27')](_0x4b65('0x24'),'status','intelepeer',util['inspect'](_0x2fe81e['body'],{'showHidden':![],'depth':null}));}break;}return _0xecd799;}})[_0x4b65('0x21')](respondWithResult(_0xbec0b,null))[_0x4b65('0x2c')](handleError(_0xbec0b,null));};exports[_0x4b65('0xda')]=function(_0x426bb8,_0x55e9db,_0xce3230){var _0x49ab02,_0x24b989,_0x1ab85d;return db[_0x4b65('0x59')][_0x4b65('0x5a')]({'where':{'id':_0x426bb8[_0x4b65('0x57')]['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0x55e9db,null))[_0x4b65('0x21')](function(_0x189559){if(_0x189559){_0x1ab85d=_0x189559;logger[_0x4b65('0x23')](_0x4b65('0x24'),'status',_0x4b65('0xcb'),_0x189559[_0x4b65('0x41')],util['inspect'](_0x426bb8[_0x4b65('0x44')],{'showHidden':![],'depth':null}));switch(_0x189559[_0x4b65('0x41')]){case _0x4b65('0x91'):if(_0x426bb8[_0x4b65('0x44')][_0x4b65('0xdb')]&&_0x426bb8[_0x4b65('0x44')][_0x4b65('0xdc')]){_0x24b989=_0x426bb8[_0x4b65('0x44')][_0x4b65('0xdc')];return db[_0x4b65('0xc8')][_0x4b65('0x5a')]({'where':{'messageId':_0x426bb8[_0x4b65('0x44')][_0x4b65('0xdb')]}});}break;}}})[_0x4b65('0x21')](handleEntityNotFound(_0x55e9db,null))[_0x4b65('0x21')](function(_0x5a929c){if(_0x5a929c){_0x49ab02=_0x5a929c;switch(_0x1ab85d[_0x4b65('0x41')]){case'csc':if(_0x24b989==='2'||_0x24b989==='6'){return _0x49ab02[_0x4b65('0x39')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x4b65('0x91'),util['inspect'](_0x426bb8[_0x4b65('0x44')],{'showHidden':![],'depth':null}));};break;}return _0x49ab02;}})[_0x4b65('0x21')](respondWithResult(_0x55e9db,null))[_0x4b65('0x2c')](handleError(_0x55e9db,null));};exports['addAgents']=function(_0x1e7a8f,_0x557df9,_0x5b4c82){return db[_0x4b65('0x59')]['find']({'where':{'id':_0x1e7a8f[_0x4b65('0x57')]['id']}})[_0x4b65('0x21')](handleEntityNotFound(_0x557df9,null))[_0x4b65('0x21')](function(_0x5ec2ee){if(_0x5ec2ee){return _0x5ec2ee[_0x4b65('0xdd')](_0x1e7a8f['body'][_0x4b65('0x6d')],_[_0x4b65('0xa2')](_0x1e7a8f['body'],['ids','id'])||{})[_0x4b65('0xa6')](function(_0x3bfe0e){for(var _0x4bf18e=0x0;_0x4bf18e<_0x1e7a8f['body'][_0x4b65('0x6d')][_0x4b65('0x49')];_0x4bf18e+=0x1){socket[_0x4b65('0xde')](_0x4b65('0xdf'),{'UserId':Number(_0x1e7a8f[_0x4b65('0x5c')]['ids'][_0x4bf18e]),'SmsAccountId':Number(_0x1e7a8f[_0x4b65('0x57')]['id'])});}return _0x3bfe0e;});}})[_0x4b65('0x21')](respondWithResult(_0x557df9,null))[_0x4b65('0x2c')](handleError(_0x557df9,null));};exports[_0x4b65('0xe0')]=function(_0x42b2be,_0x52dcb9,_0x4fc163){return db['SmsAccount'][_0x4b65('0x5a')]({'where':{'id':_0x42b2be[_0x4b65('0x57')]['id']}})['then'](handleEntityNotFound(_0x52dcb9,null))[_0x4b65('0x21')](function(_0xa405fe){if(_0xa405fe){return _0xa405fe[_0x4b65('0xe0')](_0x42b2be[_0x4b65('0x44')][_0x4b65('0x6d')])['then'](function(){if(_['isArray'](_0x42b2be[_0x4b65('0x44')]['ids'])){for(var _0x14e0e9=0x0;_0x14e0e9<_0x42b2be[_0x4b65('0x44')]['ids'][_0x4b65('0x49')];_0x14e0e9+=0x1){socket[_0x4b65('0xde')](_0x4b65('0xe1'),{'UserId':Number(_0x42b2be['query'][_0x4b65('0x6d')][_0x14e0e9]),'SmsAccountId':Number(_0x42b2be[_0x4b65('0x57')]['id'])});}}else{socket[_0x4b65('0xde')](_0x4b65('0xe1'),{'UserId':Number(_0x42b2be[_0x4b65('0x44')][_0x4b65('0x6d')]),'SmsAccountId':Number(_0x42b2be['params']['id'])});}});}})[_0x4b65('0x21')](respondWithStatusCode(_0x52dcb9,null))[_0x4b65('0x2c')](handleError(_0x52dcb9,null));};exports[_0x4b65('0xe2')]=function(_0x39b5f7,_0x4729bd,_0x1fb130){var _0xbcfec2={};var _0x1118a2={};var _0x1e0c30;var _0x36e5ea;return db[_0x4b65('0x59')][_0x4b65('0x71')]({'where':{'id':_0x39b5f7[_0x4b65('0x57')]['id']}})['then'](handleEntityNotFound(_0x4729bd,null))['then'](function(_0x563e8b){if(_0x563e8b){_0x1e0c30=_0x563e8b;_0x1118a2[_0x4b65('0x45')]=_['keys'](db[_0x4b65('0xb0')][_0x4b65('0x40')]);_0x1118a2['query']=_[_0x4b65('0x58')](_0x39b5f7[_0x4b65('0x44')]);_0x1118a2[_0x4b65('0x4d')]=_[_0x4b65('0x47')](_0x1118a2['model'],_0x1118a2[_0x4b65('0x44')]);_0xbcfec2[_0x4b65('0x46')]=_['intersection'](_0x1118a2['model'],qs['fields'](_0x39b5f7[_0x4b65('0x44')][_0x4b65('0x48')]));_0xbcfec2['attributes']=_0xbcfec2[_0x4b65('0x46')][_0x4b65('0x49')]?_0xbcfec2[_0x4b65('0x46')]:_0x1118a2['model'];_0xbcfec2[_0x4b65('0x4b')]=qs['sort'](_0x39b5f7[_0x4b65('0x44')][_0x4b65('0x4c')]);_0xbcfec2[_0x4b65('0x53')]=qs[_0x4b65('0x4d')](_[_0x4b65('0x4e')](_0x39b5f7['query'],_0x1118a2['filters']));if(_0x39b5f7[_0x4b65('0x44')][_0x4b65('0x4f')]){_0xbcfec2[_0x4b65('0x53')]=_[_0x4b65('0x50')](_0xbcfec2[_0x4b65('0x53')],{'$or':_[_0x4b65('0x3f')](_0xbcfec2[_0x4b65('0x46')],function(_0x21e3a7){var _0x1d2118={};_0x1d2118[_0x21e3a7]={'$like':'%'+_0x39b5f7[_0x4b65('0x44')][_0x4b65('0x4f')]+'%'};return _0x1d2118;})});}_0xbcfec2=_['merge']({},_0xbcfec2,_0x39b5f7[_0x4b65('0x52')]);return _0x1e0c30[_0x4b65('0xe2')](_0xbcfec2);}})['then'](function(_0xbee2e){if(_0xbee2e){_0x36e5ea=_0xbee2e[_0x4b65('0x49')];if(!_0x39b5f7[_0x4b65('0x44')][_0x4b65('0x69')](_0x4b65('0x4a'))){_0xbcfec2[_0x4b65('0x33')]=qs['limit'](_0x39b5f7[_0x4b65('0x44')]['limit']);_0xbcfec2[_0x4b65('0x31')]=qs[_0x4b65('0x31')](_0x39b5f7[_0x4b65('0x44')][_0x4b65('0x31')]);}return _0x1e0c30['getAgents'](_0xbcfec2);}})[_0x4b65('0x21')](function(_0x244d29){if(_0x244d29){return _0x244d29?{'count':_0x36e5ea,'rows':_0x244d29}:null;}})[_0x4b65('0x21')](respondWithResult(_0x4729bd,null))[_0x4b65('0x2c')](handleError(_0x4729bd,null));}; \ No newline at end of file +var _0xaaa6=['message','result','sendStatus','end','status','json','offset','limit','count','Content-Range','apply','reject','save','destroy','get','SmsAccounts','UserProfileResource','stack','name','index','mandatoryDispositionPause','map','SmsAccount','rawAttributes','fieldName','type','key','keys','filters','intersection','model','query','fields','attributes','length','hasOwnProperty','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','Pause','describe','addDisposition','SmsAccountId','Disposition','findOne','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','nolimit','order','removeAnswers','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','createdAt','updatedAt','difference','ListId','mobile','twilio','from','From','Body','skebby','text','messageId','message_id','Text','MessageUUID','infobip','results','csc','originatingAddress','fromNumber','replyMessageId','bandwidth','refid','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','Contacts','list','omit','contact','SmsInteraction','interaction','push','close','unmanaged','created','SmsMessage','AttachmentId','User','UserId','unshift','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','debug','set','Content-Type','text/xml','\x0a','transaction','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tag','color','tag','send','to\x20is\x20mandatory','List','out','Messages','spread','dataValues','received\x20delivery\x20report\x20from','skebby_dispatch_id','requestid','statusInt','clicksend','groupName','DELIVERED','clickatell','redif','inspect','error_code','RECEIVED_BY_RECIPIENT','message-delivered','intelepeer','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','socket.io-emitter','./smsAccount.socket','register','jayson/promise','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x468481,_0x3d8b88){var _0x363252=function(_0x32e2a9){while(--_0x32e2a9){_0x468481['push'](_0x468481['shift']());}};_0x363252(++_0x3d8b88);}(_0xaaa6,0x193));var _0x6aaa=function(_0x529472,_0x1ab233){_0x529472=_0x529472-0x0;var _0x5704df=_0xaaa6[_0x529472];return _0x5704df;};'use strict';var emlformat=require(_0x6aaa('0x0'));var rimraf=require(_0x6aaa('0x1'));var zipdir=require(_0x6aaa('0x2'));var jsonpatch=require(_0x6aaa('0x3'));var rp=require('request-promise');var moment=require(_0x6aaa('0x4'));var BPromise=require(_0x6aaa('0x5'));var Mustache=require('mustache');var util=require(_0x6aaa('0x6'));var path=require(_0x6aaa('0x7'));var sox=require('sox');var csv=require(_0x6aaa('0x8'));var ejs=require(_0x6aaa('0x9'));var fs=require('fs');var fs_extra=require(_0x6aaa('0xa'));var _=require(_0x6aaa('0xb'));var squel=require(_0x6aaa('0xc'));var crypto=require(_0x6aaa('0xd'));var jsforce=require(_0x6aaa('0xe'));var deskjs=require(_0x6aaa('0xf'));var toCsv=require(_0x6aaa('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x6aaa('0x10'));var authService=require(_0x6aaa('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6aaa('0x12'));var logger=require(_0x6aaa('0x13'))(_0x6aaa('0x14'));var utils=require(_0x6aaa('0x15'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x6aaa('0x16'))['db'];config[_0x6aaa('0x17')]=_[_0x6aaa('0x18')](config[_0x6aaa('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x6aaa('0x19'))(new Redis(config['redis']));require(_0x6aaa('0x1a'))[_0x6aaa('0x1b')](socket);var jayson=require(_0x6aaa('0x1c'));var client=jayson[_0x6aaa('0x1d')][_0x6aaa('0x1e')]({'port':0x232c});function respondWithRpcPromise(_0x293bb1,_0x331aa1,_0xfabc89,_0x2e01fd){return new BPromise(function(_0x4f9c63,_0x14c168){var _0x301260=_0x2e01fd||client;return _0x301260[_0x6aaa('0x1f')](_0x293bb1,_0xfabc89)[_0x6aaa('0x20')](function(_0xdf33e3){logger[_0x6aaa('0x21')](_0x6aaa('0x22'),_0x331aa1,_0x6aaa('0x23'));logger['debug'](_0x6aaa('0x24'),_0x331aa1,'request\x20sent',JSON[_0x6aaa('0x25')](_0xdf33e3));if(_0xdf33e3[_0x6aaa('0x26')]){if(_0xdf33e3['error']['code']===0x1f4){logger['error'](_0x6aaa('0x22'),_0x331aa1,_0xdf33e3[_0x6aaa('0x26')]['message']);return _0x14c168(_0xdf33e3[_0x6aaa('0x26')][_0x6aaa('0x27')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x331aa1,_0xdf33e3[_0x6aaa('0x26')][_0x6aaa('0x27')]);return _0x4f9c63(_0xdf33e3[_0x6aaa('0x26')][_0x6aaa('0x27')]);}else{logger['info'](_0x6aaa('0x22'),_0x331aa1,_0x6aaa('0x23'));_0x4f9c63(_0xdf33e3[_0x6aaa('0x28')]['message']);}})['catch'](function(_0x2dd873){logger[_0x6aaa('0x26')](_0x6aaa('0x22'),_0x331aa1,_0x2dd873);_0x14c168(_0x2dd873);});});}function respondWithStatusCode(_0x13cfd1,_0x39a534){_0x39a534=_0x39a534||0xcc;return function(_0x491639){if(_0x491639){return _0x13cfd1[_0x6aaa('0x29')](_0x39a534);}return _0x13cfd1['status'](_0x39a534)[_0x6aaa('0x2a')]();};}function respondWithResult(_0x3f7c1a,_0x32e0fd){_0x32e0fd=_0x32e0fd||0xc8;return function(_0x4c2537){if(_0x4c2537){return _0x3f7c1a[_0x6aaa('0x2b')](_0x32e0fd)[_0x6aaa('0x2c')](_0x4c2537);}};}function respondWithFilteredResult(_0x2822ff,_0x3b99c6){return function(_0x5969f3){if(_0x5969f3){var _0x552bac=typeof _0x3b99c6[_0x6aaa('0x2d')]==='undefined'&&typeof _0x3b99c6[_0x6aaa('0x2e')]==='undefined';var _0x316390=_0x5969f3[_0x6aaa('0x2f')];var _0x5f5435=_0x552bac?0x0:_0x3b99c6[_0x6aaa('0x2d')];var _0x350d83=_0x552bac?_0x5969f3['count']:_0x3b99c6[_0x6aaa('0x2d')]+_0x3b99c6['limit'];var _0x325a92;if(_0x350d83>=_0x316390){_0x350d83=_0x316390;_0x325a92=0xc8;}else{_0x325a92=0xce;}_0x2822ff[_0x6aaa('0x2b')](_0x325a92);return _0x2822ff['set'](_0x6aaa('0x30'),_0x5f5435+'-'+_0x350d83+'/'+_0x316390)[_0x6aaa('0x2c')](_0x5969f3);}return null;};}function patchUpdates(_0x525a38){return function(_0x18f1bb){try{jsonpatch[_0x6aaa('0x31')](_0x18f1bb,_0x525a38,!![]);}catch(_0x352569){return BPromise[_0x6aaa('0x32')](_0x352569);}return _0x18f1bb[_0x6aaa('0x33')]();};}function saveUpdates(_0x5ddaea,_0xb9f39c){return function(_0x22df7c){if(_0x22df7c){return _0x22df7c['update'](_0x5ddaea)['then'](function(_0x28ef13){return _0x28ef13;});}return null;};}function removeEntity(_0x3c15e7,_0x25d252){return function(_0x2780de){if(_0x2780de){return _0x2780de[_0x6aaa('0x34')]()[_0x6aaa('0x20')](function(){var _0x230799=_0x2780de[_0x6aaa('0x35')]({'plain':!![]});var _0x192cf3=_0x6aaa('0x36');return db[_0x6aaa('0x37')][_0x6aaa('0x34')]({'where':{'type':_0x192cf3,'resourceId':_0x230799['id']}})[_0x6aaa('0x20')](function(){return _0x2780de;});})[_0x6aaa('0x20')](function(){_0x3c15e7['status'](0xcc)[_0x6aaa('0x2a')]();});}};}function handleEntityNotFound(_0x243d8a,_0x177f9f){return function(_0xac846){if(!_0xac846){_0x243d8a[_0x6aaa('0x29')](0x194);}return _0xac846;};}function handleError(_0x3b718a,_0x255dc7){_0x255dc7=_0x255dc7||0x1f4;return function(_0x13a40a){logger[_0x6aaa('0x26')](_0x13a40a[_0x6aaa('0x38')]);if(_0x13a40a[_0x6aaa('0x39')]){delete _0x13a40a['name'];}_0x3b718a[_0x6aaa('0x2b')](_0x255dc7)['send'](_0x13a40a);};}exports[_0x6aaa('0x3a')]=function(_0x9e8182,_0x5684d9){var _0xd5110d={'include':[{'model':db['Pause'],'as':_0x6aaa('0x3b')}]},_0x238c64={},_0x5b8d19={'count':0x0,'rows':[]};var _0x21967=_[_0x6aaa('0x3c')](db[_0x6aaa('0x3d')][_0x6aaa('0x3e')],function(_0x55c2dc){return{'name':_0x55c2dc[_0x6aaa('0x3f')],'type':_0x55c2dc[_0x6aaa('0x40')][_0x6aaa('0x41')]};});_0x238c64['model']=_[_0x6aaa('0x3c')](_0x21967,_0x6aaa('0x39'));_0x238c64['query']=_[_0x6aaa('0x42')](_0x9e8182['query']);_0x238c64[_0x6aaa('0x43')]=_[_0x6aaa('0x44')](_0x238c64[_0x6aaa('0x45')],_0x238c64[_0x6aaa('0x46')]);_0xd5110d['attributes']=_[_0x6aaa('0x44')](_0x238c64[_0x6aaa('0x45')],qs[_0x6aaa('0x47')](_0x9e8182[_0x6aaa('0x46')][_0x6aaa('0x47')]));_0xd5110d[_0x6aaa('0x48')]=_0xd5110d[_0x6aaa('0x48')][_0x6aaa('0x49')]?_0xd5110d[_0x6aaa('0x48')]:_0x238c64[_0x6aaa('0x45')];if(!_0x9e8182[_0x6aaa('0x46')][_0x6aaa('0x4a')]('nolimit')){_0xd5110d[_0x6aaa('0x2e')]=qs[_0x6aaa('0x2e')](_0x9e8182[_0x6aaa('0x46')][_0x6aaa('0x2e')]);_0xd5110d[_0x6aaa('0x2d')]=qs[_0x6aaa('0x2d')](_0x9e8182[_0x6aaa('0x46')]['offset']);}_0xd5110d['order']=qs['sort'](_0x9e8182['query'][_0x6aaa('0x4b')]);_0xd5110d[_0x6aaa('0x4c')]=qs[_0x6aaa('0x43')](_[_0x6aaa('0x4d')](_0x9e8182[_0x6aaa('0x46')],_0x238c64[_0x6aaa('0x43')]),_0x21967);if(_0x9e8182['query'][_0x6aaa('0x4e')]){_0xd5110d[_0x6aaa('0x4c')]=_[_0x6aaa('0x4f')](_0xd5110d[_0x6aaa('0x4c')],{'$or':_[_0x6aaa('0x3c')](_0x21967,function(_0x48eaf0){if(_0x48eaf0[_0x6aaa('0x40')]!==_0x6aaa('0x50')){var _0x261b6e={};_0x261b6e[_0x48eaf0['name']]={'$like':'%'+_0x9e8182['query']['filter']+'%'};return _0x261b6e;}})});}_0xd5110d=_['merge']({},_0xd5110d,_0x9e8182['options']);var _0x4b1a36={'where':_0xd5110d[_0x6aaa('0x4c')]};return db[_0x6aaa('0x3d')][_0x6aaa('0x2f')](_0x4b1a36)[_0x6aaa('0x20')](function(_0x400f15){_0x5b8d19[_0x6aaa('0x2f')]=_0x400f15;if(_0x9e8182[_0x6aaa('0x46')][_0x6aaa('0x51')]){_0xd5110d[_0x6aaa('0x52')]=[{'all':!![]}];}return db[_0x6aaa('0x3d')][_0x6aaa('0x53')](_0xd5110d);})[_0x6aaa('0x20')](function(_0x28d1e5){_0x5b8d19[_0x6aaa('0x54')]=_0x28d1e5;return _0x5b8d19;})[_0x6aaa('0x20')](respondWithFilteredResult(_0x5684d9,_0xd5110d))['catch'](handleError(_0x5684d9,null));};exports[_0x6aaa('0x55')]=function(_0x1d7d2c,_0x400718){var _0x2e71b4={'raw':![],'where':{'id':_0x1d7d2c[_0x6aaa('0x56')]['id']},'include':[{'model':db['Pause'],'as':_0x6aaa('0x3b')}]},_0x11316a={};_0x11316a[_0x6aaa('0x45')]=_[_0x6aaa('0x42')](db[_0x6aaa('0x3d')][_0x6aaa('0x3e')]);_0x11316a['query']=_[_0x6aaa('0x42')](_0x1d7d2c[_0x6aaa('0x46')]);_0x11316a[_0x6aaa('0x43')]=_['intersection'](_0x11316a[_0x6aaa('0x45')],_0x11316a[_0x6aaa('0x46')]);_0x2e71b4['attributes']=_[_0x6aaa('0x44')](_0x11316a[_0x6aaa('0x45')],qs[_0x6aaa('0x47')](_0x1d7d2c[_0x6aaa('0x46')][_0x6aaa('0x47')]));_0x2e71b4['attributes']=_0x2e71b4[_0x6aaa('0x48')][_0x6aaa('0x49')]?_0x2e71b4[_0x6aaa('0x48')]:_0x11316a[_0x6aaa('0x45')];if(_0x1d7d2c[_0x6aaa('0x46')][_0x6aaa('0x51')]){_0x2e71b4[_0x6aaa('0x52')]=[{'all':!![]}];}_0x2e71b4=_[_0x6aaa('0x4f')]({},_0x2e71b4,_0x1d7d2c[_0x6aaa('0x57')]);return db[_0x6aaa('0x3d')][_0x6aaa('0x58')](_0x2e71b4)[_0x6aaa('0x20')](handleEntityNotFound(_0x400718,null))[_0x6aaa('0x20')](respondWithResult(_0x400718,null))['catch'](handleError(_0x400718,null));};exports['create']=function(_0x250cd4,_0x5ee93b){return db[_0x6aaa('0x3d')][_0x6aaa('0x59')](_0x250cd4[_0x6aaa('0x5a')],{})[_0x6aaa('0x20')](function(_0x9f0c84){var _0x31e8e9=_0x250cd4[_0x6aaa('0x5b')][_0x6aaa('0x35')]({'plain':!![]});if(!_0x31e8e9)throw new Error(_0x6aaa('0x5c'));if(_0x31e8e9[_0x6aaa('0x5d')]===_0x6aaa('0x5b')){var _0xbb272=_0x9f0c84[_0x6aaa('0x35')]({'plain':!![]});var _0x4af2d4=_0x6aaa('0x36');return db[_0x6aaa('0x5e')][_0x6aaa('0x58')]({'where':{'name':_0x4af2d4,'userProfileId':_0x31e8e9[_0x6aaa('0x5f')]},'raw':!![]})[_0x6aaa('0x20')](function(_0x2505f2){if(_0x2505f2&&_0x2505f2[_0x6aaa('0x60')]===0x0){return db[_0x6aaa('0x37')][_0x6aaa('0x59')]({'name':_0xbb272[_0x6aaa('0x39')],'resourceId':_0xbb272['id'],'type':_0x2505f2[_0x6aaa('0x39')],'sectionId':_0x2505f2['id']},{})[_0x6aaa('0x20')](function(){return _0x9f0c84;});}else{return _0x9f0c84;}})[_0x6aaa('0x61')](function(_0x8f96a7){logger[_0x6aaa('0x26')](_0x6aaa('0x62'),_0x8f96a7);throw _0x8f96a7;});}return _0x9f0c84;})[_0x6aaa('0x20')](respondWithResult(_0x5ee93b,0xc9))[_0x6aaa('0x61')](handleError(_0x5ee93b,null));};exports[_0x6aaa('0x63')]=function(_0x47adc1,_0x109ebb){if(_0x47adc1[_0x6aaa('0x5a')]['id']){delete _0x47adc1['body']['id'];}return db['SmsAccount'][_0x6aaa('0x58')]({'where':{'id':_0x47adc1['params']['id']},'include':[{'model':db[_0x6aaa('0x64')],'as':_0x6aaa('0x3b')}]})['then'](handleEntityNotFound(_0x109ebb,null))[_0x6aaa('0x20')](saveUpdates(_0x47adc1[_0x6aaa('0x5a')],null))[_0x6aaa('0x20')](respondWithResult(_0x109ebb,null))['catch'](handleError(_0x109ebb,null));};exports[_0x6aaa('0x34')]=function(_0x5ad234,_0x30c5de){return db[_0x6aaa('0x3d')]['find']({'where':{'id':_0x5ad234['params']['id']}})['then'](handleEntityNotFound(_0x30c5de,null))[_0x6aaa('0x20')](removeEntity(_0x30c5de,null))['catch'](handleError(_0x30c5de,null));};exports[_0x6aaa('0x65')]=function(_0x5ded99,_0x22c008){return db[_0x6aaa('0x3d')][_0x6aaa('0x65')]()[_0x6aaa('0x20')](respondWithResult(_0x22c008,null))[_0x6aaa('0x61')](handleError(_0x22c008,null));};exports[_0x6aaa('0x66')]=function(_0x20cb65,_0x1fa146,_0x27d11a){if(_0x20cb65[_0x6aaa('0x5a')]['id']){delete _0x20cb65[_0x6aaa('0x5a')]['id'];}return db['SmsAccount'][_0x6aaa('0x58')]({'where':{'id':_0x20cb65[_0x6aaa('0x56')]['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x1fa146,null))[_0x6aaa('0x20')](function(_0x264fdd){if(_0x264fdd){_0x20cb65[_0x6aaa('0x5a')][_0x6aaa('0x67')]=_0x264fdd['id'];return db[_0x6aaa('0x68')][_0x6aaa('0x59')](_0x20cb65['body']);}})[_0x6aaa('0x20')](respondWithResult(_0x1fa146,null))[_0x6aaa('0x61')](handleError(_0x1fa146,null));};exports['getDispositions']=function(_0x3ed47c,_0x394e11,_0x56581c){var _0x4aded5={'raw':![],'where':{}};var _0x138c4a={};var _0x1a4d6b={'count':0x0,'rows':[]};return db[_0x6aaa('0x3d')][_0x6aaa('0x69')]({'where':{'id':_0x3ed47c['params']['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x394e11,null))[_0x6aaa('0x20')](function(_0x1b0c6c){if(_0x1b0c6c){_0x138c4a[_0x6aaa('0x45')]=_[_0x6aaa('0x42')](db[_0x6aaa('0x68')][_0x6aaa('0x3e')]);_0x138c4a[_0x6aaa('0x46')]=_[_0x6aaa('0x42')](_0x3ed47c[_0x6aaa('0x46')]);_0x138c4a[_0x6aaa('0x43')]=_[_0x6aaa('0x44')](_0x138c4a[_0x6aaa('0x45')],_0x138c4a[_0x6aaa('0x46')]);_0x4aded5[_0x6aaa('0x48')]=_[_0x6aaa('0x44')](_0x138c4a[_0x6aaa('0x45')],qs['fields'](_0x3ed47c[_0x6aaa('0x46')]['fields']));_0x4aded5[_0x6aaa('0x48')]=_0x4aded5[_0x6aaa('0x48')][_0x6aaa('0x49')]?_0x4aded5[_0x6aaa('0x48')]:_0x138c4a[_0x6aaa('0x45')];if(!_0x3ed47c[_0x6aaa('0x46')][_0x6aaa('0x4a')]('nolimit')){_0x4aded5[_0x6aaa('0x2e')]=qs['limit'](_0x3ed47c[_0x6aaa('0x46')]['limit']);_0x4aded5[_0x6aaa('0x2d')]=qs[_0x6aaa('0x2d')](_0x3ed47c[_0x6aaa('0x46')][_0x6aaa('0x2d')]);}_0x4aded5['order']=qs['sort'](_0x3ed47c[_0x6aaa('0x46')][_0x6aaa('0x4b')]);_0x4aded5[_0x6aaa('0x4c')]=qs[_0x6aaa('0x43')](_[_0x6aaa('0x4d')](_0x3ed47c[_0x6aaa('0x46')],_0x138c4a[_0x6aaa('0x43')]));_0x4aded5[_0x6aaa('0x4c')][_0x6aaa('0x67')]=_0x1b0c6c['id'];if(_0x3ed47c[_0x6aaa('0x46')][_0x6aaa('0x4e')]){_0x4aded5['where']=_['merge'](_0x4aded5['where'],{'$or':_[_0x6aaa('0x3c')](_0x4aded5[_0x6aaa('0x48')],function(_0x1c1d5e){var _0x28e047={};_0x28e047[_0x1c1d5e]={'$like':'%'+_0x3ed47c[_0x6aaa('0x46')][_0x6aaa('0x4e')]+'%'};return _0x28e047;})});}_0x4aded5=_['merge']({},_0x4aded5,_0x3ed47c[_0x6aaa('0x57')]);return db[_0x6aaa('0x68')][_0x6aaa('0x2f')]({'where':_0x4aded5[_0x6aaa('0x4c')]})[_0x6aaa('0x20')](function(_0x567959){_0x1a4d6b[_0x6aaa('0x2f')]=_0x567959;if(_0x3ed47c[_0x6aaa('0x46')][_0x6aaa('0x51')]){_0x4aded5[_0x6aaa('0x52')]=[{'all':!![]}];}return db['Disposition'][_0x6aaa('0x53')](_0x4aded5);})[_0x6aaa('0x20')](function(_0xc03470){_0x1a4d6b[_0x6aaa('0x54')]=_0xc03470;return _0x1a4d6b;});}})[_0x6aaa('0x20')](respondWithFilteredResult(_0x394e11,_0x4aded5))[_0x6aaa('0x61')](handleError(_0x394e11,null));};exports[_0x6aaa('0x6a')]=function(_0x281f1f,_0x44cf81,_0x14faae){return db[_0x6aaa('0x3d')][_0x6aaa('0x58')]({'where':{'id':_0x281f1f[_0x6aaa('0x56')]['id']}})['then'](handleEntityNotFound(_0x44cf81,null))['then'](function(_0x401b57){if(_0x401b57){return _0x401b57[_0x6aaa('0x6a')](_0x281f1f[_0x6aaa('0x46')][_0x6aaa('0x6b')]);}})[_0x6aaa('0x20')](respondWithStatusCode(_0x44cf81,null))[_0x6aaa('0x61')](handleError(_0x44cf81,null));};exports[_0x6aaa('0x6c')]=function(_0x3d67b9,_0x53f458,_0x281d74){if(_0x3d67b9['body']['id']){delete _0x3d67b9[_0x6aaa('0x5a')]['id'];}return db['SmsAccount'][_0x6aaa('0x58')]({'where':{'id':_0x3d67b9['params']['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x53f458,null))[_0x6aaa('0x20')](function(_0xe6f588){if(_0xe6f588){_0x3d67b9['body']['SmsAccountId']=_0xe6f588['id'];return db[_0x6aaa('0x6d')][_0x6aaa('0x59')](_0x3d67b9[_0x6aaa('0x5a')]);}})['then'](respondWithResult(_0x53f458,null))[_0x6aaa('0x61')](handleError(_0x53f458,null));};exports[_0x6aaa('0x6e')]=function(_0x58eb43,_0x34a8f7,_0x1a05d0){var _0x2e3c3c={'raw':![],'where':{}};var _0x45ccf4={};var _0x46343f={'count':0x0,'rows':[]};return db[_0x6aaa('0x3d')][_0x6aaa('0x69')]({'where':{'id':_0x58eb43[_0x6aaa('0x56')]['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x34a8f7,null))[_0x6aaa('0x20')](function(_0xcf2fa9){if(_0xcf2fa9){_0x45ccf4['model']=_[_0x6aaa('0x42')](db[_0x6aaa('0x6d')]['rawAttributes']);_0x45ccf4[_0x6aaa('0x46')]=_[_0x6aaa('0x42')](_0x58eb43[_0x6aaa('0x46')]);_0x45ccf4[_0x6aaa('0x43')]=_['intersection'](_0x45ccf4[_0x6aaa('0x45')],_0x45ccf4['query']);_0x2e3c3c[_0x6aaa('0x48')]=_[_0x6aaa('0x44')](_0x45ccf4[_0x6aaa('0x45')],qs[_0x6aaa('0x47')](_0x58eb43[_0x6aaa('0x46')][_0x6aaa('0x47')]));_0x2e3c3c[_0x6aaa('0x48')]=_0x2e3c3c[_0x6aaa('0x48')]['length']?_0x2e3c3c[_0x6aaa('0x48')]:_0x45ccf4[_0x6aaa('0x45')];if(!_0x58eb43[_0x6aaa('0x46')][_0x6aaa('0x4a')](_0x6aaa('0x6f'))){_0x2e3c3c[_0x6aaa('0x2e')]=qs['limit'](_0x58eb43[_0x6aaa('0x46')][_0x6aaa('0x2e')]);_0x2e3c3c[_0x6aaa('0x2d')]=qs[_0x6aaa('0x2d')](_0x58eb43[_0x6aaa('0x46')][_0x6aaa('0x2d')]);}_0x2e3c3c[_0x6aaa('0x70')]=qs[_0x6aaa('0x4b')](_0x58eb43[_0x6aaa('0x46')]['sort']);_0x2e3c3c['where']=qs[_0x6aaa('0x43')](_[_0x6aaa('0x4d')](_0x58eb43[_0x6aaa('0x46')],_0x45ccf4[_0x6aaa('0x43')]));_0x2e3c3c['where'][_0x6aaa('0x67')]=_0xcf2fa9['id'];if(_0x58eb43[_0x6aaa('0x46')][_0x6aaa('0x4e')]){_0x2e3c3c[_0x6aaa('0x4c')]=_[_0x6aaa('0x4f')](_0x2e3c3c[_0x6aaa('0x4c')],{'$or':_[_0x6aaa('0x3c')](_0x2e3c3c[_0x6aaa('0x48')],function(_0x49b994){var _0x4f0923={};_0x4f0923[_0x49b994]={'$like':'%'+_0x58eb43[_0x6aaa('0x46')][_0x6aaa('0x4e')]+'%'};return _0x4f0923;})});}_0x2e3c3c=_[_0x6aaa('0x4f')]({},_0x2e3c3c,_0x58eb43['options']);return db[_0x6aaa('0x6d')]['count']({'where':_0x2e3c3c['where']})[_0x6aaa('0x20')](function(_0x536b2f){_0x46343f[_0x6aaa('0x2f')]=_0x536b2f;if(_0x58eb43[_0x6aaa('0x46')][_0x6aaa('0x51')]){_0x2e3c3c[_0x6aaa('0x52')]=[{'all':!![]}];}return db[_0x6aaa('0x6d')][_0x6aaa('0x53')](_0x2e3c3c);})[_0x6aaa('0x20')](function(_0x1abaca){_0x46343f['rows']=_0x1abaca;return _0x46343f;});}})[_0x6aaa('0x20')](respondWithFilteredResult(_0x34a8f7,_0x2e3c3c))[_0x6aaa('0x61')](handleError(_0x34a8f7,null));};exports[_0x6aaa('0x71')]=function(_0x339923,_0x151d7e,_0x30d7c8){return db[_0x6aaa('0x3d')][_0x6aaa('0x58')]({'where':{'id':_0x339923[_0x6aaa('0x56')]['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x151d7e,null))[_0x6aaa('0x20')](function(_0x3aa67e){if(_0x3aa67e){return _0x3aa67e[_0x6aaa('0x71')](_0x339923[_0x6aaa('0x46')]['ids']);}})[_0x6aaa('0x20')](respondWithStatusCode(_0x151d7e,null))['catch'](handleError(_0x151d7e,null));};exports['notify']=function(_0x2c63ff,_0x5eaeaf,_0x2dff95){var _0x5daae0={'channel':'sms'};var _0x418c6c=[];var _0x59848a=[];var _0xc4f3a={};return db[_0x6aaa('0x3d')][_0x6aaa('0x58')]({'where':{'id':_0x2c63ff[_0x6aaa('0x56')]['id']},'include':[{'model':db[_0x6aaa('0x72')],'as':_0x6aaa('0x73')}]})['then'](handleEntityNotFound(_0x5eaeaf,null))['then'](function(_0x3043ca){_0x5daae0[_0x6aaa('0x74')]=_0x3043ca;_0x5daae0[_0x6aaa('0x75')]=_[_0x6aaa('0x76')](_0x3043ca[_0x6aaa('0x73')],[_0x6aaa('0x77')],[_0x6aaa('0x78')]);if(_0x5daae0[_0x6aaa('0x74')][_0x6aaa('0x73')]){delete _0x5daae0[_0x6aaa('0x74')][_0x6aaa('0x73')];}return db[_0x6aaa('0x79')][_0x6aaa('0x65')]();})[_0x6aaa('0x20')](function(_0x54d6dc){if(!_0x54d6dc){throw new db[(_0x6aaa('0x7a'))][(_0x6aaa('0x7b'))]('no\x20available\x20attributes');}_0x418c6c=_['difference'](_[_0x6aaa('0x42')](_0x54d6dc),[_0x6aaa('0x7c'),_0x6aaa('0x7d')]);_0x59848a=_[_0x6aaa('0x7e')](_['keys'](_0x54d6dc),[_0x6aaa('0x7c'),'updatedAt','CompanyId',_0x6aaa('0x7f')]);_0x5daae0[_0x6aaa('0x5a')]={'mapKey':_0x6aaa('0x80')};if(_0x5daae0[_0x6aaa('0x74')][_0x6aaa('0x40')]){switch(_0x5daae0[_0x6aaa('0x74')][_0x6aaa('0x40')]){case _0x6aaa('0x81'):_0x5daae0['body'][_0x6aaa('0x82')]=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x83')];_0x5daae0[_0x6aaa('0x5a')]['body']=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x84')];_0x5daae0[_0x6aaa('0x5a')]['messageId']=_0x2c63ff['body']['MessageSid'];break;case _0x6aaa('0x85'):_0x5daae0[_0x6aaa('0x5a')]['from']='+'+_0x2c63ff['body']['sender'];_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x5a')]=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x86')];break;case'connectel':_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x82')]=_0x2c63ff['body'][_0x6aaa('0x82')];_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x5a')]=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x27')];break;case'clicksend':_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x82')]=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x82')];_0x5daae0[_0x6aaa('0x5a')]['body']=_0x2c63ff[_0x6aaa('0x5a')]['body'];_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x87')]=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x88')];break;case'plivo':_0x5daae0['body'][_0x6aaa('0x82')]=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x83')];_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x5a')]=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x89')];_0x5daae0[_0x6aaa('0x5a')]['messageId']=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x8a')];break;case _0x6aaa('0x8b'):_0x5daae0['body'][_0x6aaa('0x82')]='+'+_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x8c')][0x0][_0x6aaa('0x82')];_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x5a')]=_0x2c63ff['body']['results'][0x0]['text'];_0x5daae0['body']['messageId']=_0x2c63ff['body'][_0x6aaa('0x8c')][0x0][_0x6aaa('0x87')];break;case _0x6aaa('0x8d'):_0x5daae0[_0x6aaa('0x5a')]['from']=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x8e')];_0x5daae0['body'][_0x6aaa('0x5a')]=_0x2c63ff[_0x6aaa('0x5a')]['segmentedMessage'][_0x6aaa('0x27')];break;case'clickatell':_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x82')]=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x8f')];_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x5a')]=_0x2c63ff[_0x6aaa('0x5a')]['text'];_0x5daae0[_0x6aaa('0x5a')]['messageId']=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x90')];break;case _0x6aaa('0x91'):_0x5daae0['body'][_0x6aaa('0x87')]=_0x2c63ff[_0x6aaa('0x5a')][0x0]['message']['id'];_0x5daae0[_0x6aaa('0x5a')]['from']=_0x2c63ff[_0x6aaa('0x5a')][0x0][_0x6aaa('0x27')][_0x6aaa('0x82')];_0x5daae0[_0x6aaa('0x5a')]['body']=_0x2c63ff[_0x6aaa('0x5a')][0x0][_0x6aaa('0x27')]['text'];break;case'intelepeer':_0x5daae0['body'][_0x6aaa('0x82')]=_0x2c63ff[_0x6aaa('0x5a')]['from'];_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x5a')]=_0x2c63ff['body'][_0x6aaa('0x27')];_0x5daae0[_0x6aaa('0x5a')]['messageId']=_0x2c63ff[_0x6aaa('0x5a')][_0x6aaa('0x92')];break;}}if(_0x5daae0[_0x6aaa('0x5a')]['id']){delete _0x5daae0[_0x6aaa('0x5a')]['id'];}if(_[_0x6aaa('0x93')](_0x5daae0['body'][_0x6aaa('0x82')])){throw new db[(_0x6aaa('0x7a'))][(_0x6aaa('0x7b'))](_0x6aaa('0x94'));}if(_[_0x6aaa('0x93')](_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x5a')])||_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x5a')]===''){throw new db[(_0x6aaa('0x7a'))][(_0x6aaa('0x7b'))](_0x6aaa('0x95'));}if(_[_0x6aaa('0x93')](_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x96')])){throw new db['Sequelize'][(_0x6aaa('0x7b'))](_0x6aaa('0x97')+_0x59848a);}if(!_[_0x6aaa('0x98')](_0x59848a,_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x96')])){throw new db['Sequelize'][(_0x6aaa('0x7b'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x59848a);}_0xc4f3a[_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x96')]]=_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x82')];return db[_0x6aaa('0x99')][_0x6aaa('0x58')]({'where':{'id':_0x5daae0[_0x6aaa('0x74')][_0x6aaa('0x7f')]},'include':[{'model':db[_0x6aaa('0x79')],'as':_0x6aaa('0x9a'),'where':_0xc4f3a,'limit':0x1,'order':[['updatedAt','DESC']]}]});})[_0x6aaa('0x20')](handleEntityNotFound(_0x5eaeaf,null))[_0x6aaa('0x20')](function(_0x4acc96){if(_0x4acc96){_0x5daae0[_0x6aaa('0x9b')]=_[_0x6aaa('0x9c')](_0x4acc96,[_0x6aaa('0x9a')]);if(_0x4acc96[_0x6aaa('0x9a')][_0x6aaa('0x49')]){return _0x4acc96[_0x6aaa('0x9a')][0x0];}var _0x7257df=_[_0x6aaa('0x18')](_0x5daae0['body'],{'firstName':_0x5daae0['body'][_0x6aaa('0x82')],'ListId':_0x4acc96['id']});_0x7257df[_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x96')]]=_0x5daae0[_0x6aaa('0x5a')]['from'];return db['CmContact'][_0x6aaa('0x59')](_0x7257df,{'fields':_0x418c6c,'raw':!![]});}})[_0x6aaa('0x20')](handleEntityNotFound(_0x5eaeaf,null))['then'](function(_0x193d35){if(_0x193d35){_0x5daae0[_0x6aaa('0x9d')]=_0x193d35;var _0xcb64d2={'ContactId':_0x193d35['id'],'phone':_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x82')],'SmsAccountId':_0x2c63ff[_0x6aaa('0x56')]['id']};var _0x235426={'ContactId':_0x193d35['id'],'SmsAccountId':_0x2c63ff[_0x6aaa('0x56')]['id'],'closed':![]};return db['SmsInteraction'][_0x6aaa('0x58')]({'where':_0x235426})[_0x6aaa('0x20')](function(_0x15a3b4){if(_0x15a3b4){return[_0x15a3b4,![]];}return db[_0x6aaa('0x9e')][_0x6aaa('0x59')](_0xcb64d2)[_0x6aaa('0x20')](function(_0x554368){return[_0x554368,!![]];});});}})['spread'](function(_0x18ebbe,_0x1fb872){_0x5daae0[_0x6aaa('0x9f')]=_0x18ebbe[_0x6aaa('0x35')]({'plain':!![]});_0x5daae0[_0x6aaa('0x9f')]['created']=![];if(_0x1fb872){if(_0x5daae0['account']['autoclose']){_0x5daae0[_0x6aaa('0x75')][_0x6aaa('0xa0')]({'id':0x0,'priority':_0x5daae0[_0x6aaa('0x75')][_0x6aaa('0x49')]+0x1,'app':_0x6aaa('0xa1'),'appdata':_0x6aaa('0xa2'),'interval':'*,*,*,*'});}_0x5daae0[_0x6aaa('0x9f')][_0x6aaa('0xa3')]=!![];}return db[_0x6aaa('0xa4')][_0x6aaa('0x59')]({'phone':_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x82')],'messageId':_0x5daae0['body'][_0x6aaa('0x87')],'body':_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0x5a')],'SmsAccountId':_0x2c63ff['params']['id'],'SmsInteractionId':_0x18ebbe['id'],'direction':'in','ContactId':_0x18ebbe['ContactId'],'AttachmentId':_0x5daae0[_0x6aaa('0x5a')][_0x6aaa('0xa5')]});})[_0x6aaa('0x20')](function(_0x27bb5e){_0x5daae0['message']=_0x27bb5e;if(_0x5daae0[_0x6aaa('0x9f')]['UserId']){return db[_0x6aaa('0xa6')][_0x6aaa('0x58')]({'attributes':['id',_0x6aaa('0x39')],'where':{'id':_0x5daae0[_0x6aaa('0x9f')][_0x6aaa('0xa7')]}})['then'](function(_0xa8613){if(_0xa8613){_0x5daae0[_0x6aaa('0x75')][_0x6aaa('0xa8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0xa8613[_0x6aaa('0x39')]+','+(_0x5daae0[_0x6aaa('0x74')][_0x6aaa('0xa9')]||0xa),'interval':_0x6aaa('0xaa')});}return respondWithRpcPromise('Start','startRouting',_0x5daae0);});}return respondWithRpcPromise(_0x6aaa('0xab'),_0x6aaa('0xac'),_0x5daae0);})[_0x6aaa('0x20')](function(_0xf9fb1a){if(_0xf9fb1a){var _0x2b90b9=0xc8;var _0x2f2f43=_0x6aaa('0xad');logger[_0x6aaa('0x21')](_0x6aaa('0x24'),_0x2f2f43,_0x2b90b9,'entity\x20found');logger[_0x6aaa('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x2f2f43,_0x2b90b9,'entity\x20found',JSON['stringify'](_0xf9fb1a));if(_0x5daae0[_0x6aaa('0x74')][_0x6aaa('0x40')]===_0x6aaa('0x81')){return _0x5eaeaf[_0x6aaa('0x2b')](_0x2b90b9)[_0x6aaa('0xaf')](_0x6aaa('0xb0'),_0x6aaa('0xb1'))['send'](_0x6aaa('0xb2'));}else{return _0x5eaeaf[_0x6aaa('0x2b')](_0x2b90b9)[_0x6aaa('0x2c')](_0xf9fb1a);}}})[_0x6aaa('0x61')](handleError(_0x5eaeaf,null));};exports['addApplications']=function(_0x271191,_0x322c6b,_0x44c8d7){return db[_0x6aaa('0x3d')]['findOne']({'where':{'id':_0x271191['params']['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x322c6b,null))[_0x6aaa('0x20')](function(_0x40f322){if(_0x40f322){return db['sequelize'][_0x6aaa('0xb3')](function(_0x204904){return db[_0x6aaa('0x72')][_0x6aaa('0x34')]({'where':{'SmsAccountId':_0x271191['params']['id']},'transaction':_0x204904})[_0x6aaa('0x20')](function(_0x1dd1f7){var _0x8fe70a=_[_0x6aaa('0x3c')](_0x271191[_0x6aaa('0x5a')],function(_0x553176){_0x553176[_0x6aaa('0x67')]=_0x271191[_0x6aaa('0x56')]['id'];return _0x553176;});return db[_0x6aaa('0x72')][_0x6aaa('0xb4')](_0x8fe70a,{'transaction':_0x204904});});})[_0x6aaa('0x20')](function(){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x271191['params']['id']},'order':_0x6aaa('0x77')});});}})[_0x6aaa('0x20')](respondWithResult(_0x322c6b,null))[_0x6aaa('0x61')](handleError(_0x322c6b,null));};exports['getApplications']=function(_0x17822a,_0x25b4ac,_0x6025f0){var _0x49d6bc={};var _0x46f987={};var _0x9140c8;var _0x4e2e93;return db[_0x6aaa('0x3d')][_0x6aaa('0x69')]({'where':{'id':_0x17822a['params']['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x25b4ac,null))[_0x6aaa('0x20')](function(_0x4f65dd){if(_0x4f65dd){_0x9140c8=_0x4f65dd;_0x46f987[_0x6aaa('0x45')]=_[_0x6aaa('0x42')](db['SmsApplication'][_0x6aaa('0x3e')]);_0x46f987[_0x6aaa('0x46')]=_[_0x6aaa('0x42')](_0x17822a[_0x6aaa('0x46')]);_0x46f987[_0x6aaa('0x43')]=_['intersection'](_0x46f987[_0x6aaa('0x45')],_0x46f987[_0x6aaa('0x46')]);_0x49d6bc[_0x6aaa('0x48')]=_['intersection'](_0x46f987['model'],qs[_0x6aaa('0x47')](_0x17822a[_0x6aaa('0x46')][_0x6aaa('0x47')]));_0x49d6bc['attributes']=_0x49d6bc[_0x6aaa('0x48')][_0x6aaa('0x49')]?_0x49d6bc[_0x6aaa('0x48')]:_0x46f987['model'];_0x49d6bc[_0x6aaa('0x70')]=qs[_0x6aaa('0x4b')](_0x17822a['query'][_0x6aaa('0x4b')]);_0x49d6bc[_0x6aaa('0x4c')]=qs[_0x6aaa('0x43')](_[_0x6aaa('0x4d')](_0x17822a[_0x6aaa('0x46')],_0x46f987[_0x6aaa('0x43')]));if(_0x17822a[_0x6aaa('0x46')][_0x6aaa('0x4e')]){_0x49d6bc[_0x6aaa('0x4c')]=_['merge'](_0x49d6bc['where'],{'$or':_[_0x6aaa('0x3c')](_0x49d6bc[_0x6aaa('0x48')],function(_0x3d212c){var _0x4325ca={};_0x4325ca[_0x3d212c]={'$like':'%'+_0x17822a['query']['filter']+'%'};return _0x4325ca;})});}_0x49d6bc=_['merge']({},_0x49d6bc,_0x17822a['options']);return _0x9140c8['getApplications'](_0x49d6bc);}})[_0x6aaa('0x20')](function(_0x52527a){if(_0x52527a){_0x4e2e93=_0x52527a[_0x6aaa('0x49')];if(!_0x17822a[_0x6aaa('0x46')]['hasOwnProperty'](_0x6aaa('0x6f'))){_0x49d6bc[_0x6aaa('0x2e')]=qs[_0x6aaa('0x2e')](_0x17822a[_0x6aaa('0x46')]['limit']);_0x49d6bc[_0x6aaa('0x2d')]=qs[_0x6aaa('0x2d')](_0x17822a['query'][_0x6aaa('0x2d')]);}return _0x9140c8[_0x6aaa('0xb5')](_0x49d6bc);}})['then'](function(_0x401393){if(_0x401393){return _0x401393?{'count':_0x4e2e93,'rows':_0x401393}:null;}})[_0x6aaa('0x20')](respondWithResult(_0x25b4ac,null))[_0x6aaa('0x61')](handleError(_0x25b4ac,null));};exports['getInteractions']=function(_0x2a0f8b,_0x4f218d,_0x7ad592){var _0x15d149={'raw':![],'where':{}};var _0x41655a={};var _0x531a43={'count':0x0,'rows':[]};return db[_0x6aaa('0x3d')][_0x6aaa('0x69')]({'where':{'id':_0x2a0f8b[_0x6aaa('0x56')]['id']}})['then'](handleEntityNotFound(_0x4f218d,null))[_0x6aaa('0x20')](function(_0x2d81dc){if(_0x2d81dc){_0x41655a['model']=_[_0x6aaa('0x42')](db[_0x6aaa('0x9e')][_0x6aaa('0x3e')]);_0x41655a['query']=_[_0x6aaa('0x42')](_0x2a0f8b[_0x6aaa('0x46')]);_0x41655a[_0x6aaa('0x43')]=_[_0x6aaa('0x44')](_0x41655a[_0x6aaa('0x45')],_0x41655a['query']);_0x15d149['attributes']=_[_0x6aaa('0x44')](_0x41655a['model'],qs[_0x6aaa('0x47')](_0x2a0f8b[_0x6aaa('0x46')]['fields']));_0x15d149[_0x6aaa('0x48')]=_0x15d149['attributes'][_0x6aaa('0x49')]?_0x15d149['attributes']:_0x41655a[_0x6aaa('0x45')];if(!_0x2a0f8b[_0x6aaa('0x46')][_0x6aaa('0x4a')]('nolimit')){_0x15d149[_0x6aaa('0x2e')]=qs[_0x6aaa('0x2e')](_0x2a0f8b[_0x6aaa('0x46')]['limit']);_0x15d149[_0x6aaa('0x2d')]=qs[_0x6aaa('0x2d')](_0x2a0f8b[_0x6aaa('0x46')]['offset']);}_0x15d149[_0x6aaa('0x70')]=qs[_0x6aaa('0x4b')](_0x2a0f8b[_0x6aaa('0x46')][_0x6aaa('0x4b')]);_0x15d149[_0x6aaa('0x4c')]=qs['filters'](_[_0x6aaa('0x4d')](_0x2a0f8b[_0x6aaa('0x46')],_0x41655a['filters']));_0x15d149[_0x6aaa('0x4c')]['SmsAccountId']=_0x2d81dc['id'];if(_0x2a0f8b['query'][_0x6aaa('0x4e')]){_0x15d149[_0x6aaa('0x4c')]=_['merge'](_0x15d149[_0x6aaa('0x4c')],{'$or':_['map'](_0x15d149['attributes'],function(_0x11945c){var _0x1f3502={};_0x1f3502[_0x11945c]={'$like':'%'+_0x2a0f8b[_0x6aaa('0x46')]['filter']+'%'};return _0x1f3502;})});}_0x15d149=_[_0x6aaa('0x4f')]({},_0x15d149,_0x2a0f8b[_0x6aaa('0x57')]);return db[_0x6aaa('0x9e')][_0x6aaa('0x2f')]({'where':_0x15d149[_0x6aaa('0x4c')]})['then'](function(_0x393c1a){_0x531a43['count']=_0x393c1a;if(_0x2a0f8b['query'][_0x6aaa('0x51')]){_0x15d149[_0x6aaa('0x52')]=[{'model':db['CmContact'],'as':_0x6aaa('0xb6'),'required':![]},{'model':db[_0x6aaa('0xa6')],'as':_0x6aaa('0xb7'),'attributes':['name',_0x6aaa('0xb8'),_0x6aaa('0xb9')],'required':![]},{'model':db[_0x6aaa('0xba')],'as':'Tags','attributes':['id',_0x6aaa('0x39'),_0x6aaa('0xbb')],'where':_0x2a0f8b[_0x6aaa('0x46')][_0x6aaa('0xbc')]?{'id':_0x2a0f8b[_0x6aaa('0x46')]['tag']}:undefined,'required':_0x2a0f8b['query'][_0x6aaa('0xbc')]?!![]:![]}];}return db[_0x6aaa('0x9e')][_0x6aaa('0x53')](_0x15d149);})[_0x6aaa('0x20')](function(_0x3eb96c){_0x531a43[_0x6aaa('0x54')]=_0x3eb96c;return _0x531a43;});}})[_0x6aaa('0x20')](respondWithFilteredResult(_0x4f218d,_0x15d149))[_0x6aaa('0x61')](handleError(_0x4f218d,null));};exports[_0x6aaa('0xbd')]=function(_0x3fcbdd,_0xbb8320,_0x339fef){var _0x252cd0,_0x5dc6ca,_0x416c71;if(_[_0x6aaa('0x93')](_0x3fcbdd[_0x6aaa('0x5a')][_0x6aaa('0x5a')])||_0x3fcbdd[_0x6aaa('0x5a')][_0x6aaa('0x5a')]===''){throw new db[(_0x6aaa('0x7a'))][(_0x6aaa('0x7b'))](_0x6aaa('0x95'));}if(_['isNil'](_0x3fcbdd['body']['to'])){throw new db[(_0x6aaa('0x7a'))][(_0x6aaa('0x7b'))](_0x6aaa('0xbe'));}_0x252cd0=_0x3fcbdd[_0x6aaa('0x5a')]['to'];return db[_0x6aaa('0x3d')][_0x6aaa('0x58')]({'where':{'id':_0x3fcbdd['params']['id']},'include':[{'model':db[_0x6aaa('0x99')],'as':_0x6aaa('0xbf'),'include':[{'model':db[_0x6aaa('0x79')],'as':_0x6aaa('0x9a'),'where':{'mobile':_0x252cd0},'limit':0x1,'order':[[_0x6aaa('0x7d'),'DESC']]}]}]})[_0x6aaa('0x20')](handleEntityNotFound(_0xbb8320,null))[_0x6aaa('0x20')](function(_0x3eb083){if(_0x3eb083&&_0x3eb083[_0x6aaa('0xbf')]){_0x5dc6ca=_0x3eb083[_0x6aaa('0x35')]({'plain':!![]});if(_0x5dc6ca[_0x6aaa('0xbf')]&&_0x5dc6ca[_0x6aaa('0xbf')]['Contacts']['length']){return _0x5dc6ca[_0x6aaa('0xbf')][_0x6aaa('0x9a')][0x0];}return db[_0x6aaa('0x79')][_0x6aaa('0x59')](_[_0x6aaa('0x18')](_0x3fcbdd[_0x6aaa('0x5a')],{'firstName':_0x252cd0,'mobile':_0x252cd0,'phone':_0x252cd0,'ListId':_0x5dc6ca[_0x6aaa('0x7f')]}));}})['then'](handleEntityNotFound(_0xbb8320,null))[_0x6aaa('0x20')](function(_0x173d30){if(_0x173d30){_0x416c71=_0x173d30;return db['SmsInteraction'][_0x6aaa('0x58')]({'where':{'ContactId':_0x416c71['id'],'closed':![],'SmsAccountId':_0x5dc6ca['id']}})['then'](function(_0x102e30){if(_0x102e30){return[_0x102e30,![]];}return db[_0x6aaa('0x9e')][_0x6aaa('0x59')]({'UserId':_0x3fcbdd[_0x6aaa('0x5b')]['id'],'ContactId':_0x416c71['id'],'SmsAccountId':_0x5dc6ca['id'],'phone':_0x252cd0,'firstMsgDirection':_0x6aaa('0xc0'),'Messages':[_['merge'](_0x3fcbdd[_0x6aaa('0x5a')],{'read':![],'body':_0x3fcbdd[_0x6aaa('0x5a')]['body'],'phone':_0x252cd0,'SmsAccountId':_0x5dc6ca['id'],'UserId':_0x3fcbdd[_0x6aaa('0x5b')]['id'],'ContactId':_0x416c71['id']})]},{'include':[{'model':db[_0x6aaa('0xa4')],'as':_0x6aaa('0xc1')}]})['then'](function(_0x105a0c){return[_0x105a0c,!![]];});});}})[_0x6aaa('0xc2')](function(_0x5d55bc,_0x4b512a){if(_0x4b512a){return _0x5d55bc;}return db[_0x6aaa('0xa4')][_0x6aaa('0x59')](_[_0x6aaa('0x4f')](_0x3fcbdd['body'],{'read':![],'body':_0x3fcbdd[_0x6aaa('0x5a')][_0x6aaa('0x5a')],'phone':_0x252cd0,'SmsAccountId':_0x5dc6ca['id'],'SmsInteractionId':_0x5d55bc['id'],'UserId':_0x3fcbdd['user']['id'],'ContactId':_0x416c71['id']}))[_0x6aaa('0x20')](function(_0x59815b){_0x5d55bc[_0x6aaa('0xc3')][_0x6aaa('0xc1')]=[];_0x5d55bc[_0x6aaa('0xc3')][_0x6aaa('0xc1')][_0x6aaa('0xa0')](_0x59815b[_0x6aaa('0xc3')]);return _0x5d55bc;});})[_0x6aaa('0x20')](respondWithResult(_0xbb8320,null))[_0x6aaa('0x61')](handleError(_0xbb8320,null));};exports[_0x6aaa('0x2b')]=function(_0x403663,_0x2c93a4,_0x995d2){if(_0x403663[_0x6aaa('0x5a')]['id']){delete _0x403663[_0x6aaa('0x5a')]['id'];}var _0x1bc645,_0x34a1d5,_0x2e2235;return db['SmsAccount'][_0x6aaa('0x58')]({'where':{'id':_0x403663[_0x6aaa('0x56')]['id']}})['then'](handleEntityNotFound(_0x2c93a4,null))[_0x6aaa('0x20')](function(_0x185f5d){if(_0x185f5d){_0x2e2235=_0x185f5d;logger[_0x6aaa('0xae')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6aaa('0x2b'),_0x6aaa('0xc4'),_0x185f5d[_0x6aaa('0x40')],util['inspect'](_0x403663[_0x6aaa('0x5a')],{'showHidden':![],'depth':null}));switch(_0x185f5d[_0x6aaa('0x40')]){case'skebby':if(_0x403663[_0x6aaa('0x5a')]['skebby_dispatch_id']&&_0x403663['body'][_0x6aaa('0x2b')]){_0x34a1d5=_0x403663['body']['status'];return db[_0x6aaa('0xa4')][_0x6aaa('0x58')]({'where':{'messageId':_0x403663['body'][_0x6aaa('0xc5')]}});}break;case'connectel':if(_0x403663[_0x6aaa('0x5a')][_0x6aaa('0xc6')]&&_0x403663[_0x6aaa('0x5a')][_0x6aaa('0xc7')]){_0x34a1d5=_0x403663[_0x6aaa('0x5a')][_0x6aaa('0xc7')];return db[_0x6aaa('0xa4')][_0x6aaa('0x58')]({'where':{'messageId':_0x403663[_0x6aaa('0x5a')]['requestid']}});}break;case _0x6aaa('0xc8'):if(_0x403663[_0x6aaa('0x5a')][_0x6aaa('0x88')]&&_0x403663['body']['status_code']){_0x34a1d5=_0x403663[_0x6aaa('0x5a')]['status_code'];return db[_0x6aaa('0xa4')][_0x6aaa('0x58')]({'where':{'messageId':_0x403663[_0x6aaa('0x5a')][_0x6aaa('0x88')]}});}break;case _0x6aaa('0x8b'):var _0x16d927=_0x403663[_0x6aaa('0x5a')]['results'][0x0];if(_0x16d927[_0x6aaa('0x87')]&&_0x16d927['status'][_0x6aaa('0xc9')]===_0x6aaa('0xca')){_0x34a1d5=_0x16d927[_0x6aaa('0x2b')][_0x6aaa('0xc9')];return db[_0x6aaa('0xa4')][_0x6aaa('0x58')]({'where':{'messageId':_0x16d927['messageId']}});}break;case _0x6aaa('0xcb'):if(_0x403663[_0x6aaa('0x5a')][_0x6aaa('0x87')]&&_0x403663[_0x6aaa('0x5a')][_0x6aaa('0x2b')]){_0x34a1d5=_0x403663[_0x6aaa('0x5a')]['status'];return db[_0x6aaa('0xa4')][_0x6aaa('0x58')]({'where':{'messageId':_0x403663[_0x6aaa('0x5a')][_0x6aaa('0x87')]}});}break;case _0x6aaa('0x91'):if(_0x403663[_0x6aaa('0x5a')][0x0][_0x6aaa('0x27')]['id']){_0x34a1d5=_0x403663['body'][0x0][_0x6aaa('0x40')];return db[_0x6aaa('0xa4')][_0x6aaa('0x58')]({'where':{'messageId':_0x403663[_0x6aaa('0x5a')][0x0][_0x6aaa('0x27')]['id']}});}break;case'intelepeer':if(_0x403663['body'][_0x6aaa('0xcc')]&&_0x403663[_0x6aaa('0x5a')][_0x6aaa('0x2b')]){_0x34a1d5=_0x403663[_0x6aaa('0x5a')]['status'];return db[_0x6aaa('0xa4')]['find']({'where':{'messageId':_0x403663[_0x6aaa('0x5a')]['redif']}});}break;}}})['then'](handleEntityNotFound(_0x2c93a4,null))[_0x6aaa('0x20')](function(_0x16aa10){if(_0x16aa10){_0x1bc645=_0x16aa10;switch(_0x2e2235['type']){case _0x6aaa('0x85'):if(_0x34a1d5===_0x6aaa('0xca')){return _0x1bc645[_0x6aaa('0x63')]({'read':!![]});}else{logger[_0x6aaa('0x26')](_0x6aaa('0x24'),_0x6aaa('0x2b'),'skebby',util['inspect'](_0x403663[_0x6aaa('0x5a')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x34a1d5==='1'){return _0x1bc645[_0x6aaa('0x63')]({'read':!![]});}else{logger[_0x6aaa('0x26')](_0x6aaa('0x24'),_0x6aaa('0x2b'),_0x6aaa('0x85'),util[_0x6aaa('0xcd')](_0x403663['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x403663[_0x6aaa('0x5a')][_0x6aaa('0xce')]&&_0x34a1d5>=0xc8&&_0x34a1d5<=0xce){return _0x1bc645[_0x6aaa('0x63')]({'read':!![]});}else{logger[_0x6aaa('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x6aaa('0xc8'),util[_0x6aaa('0xcd')](_0x403663[_0x6aaa('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x1e1e6d=_0x403663[_0x6aaa('0x5a')]['results'][0x0];if(_0x1e1e6d[_0x6aaa('0x2b')][_0x6aaa('0xc9')]===_0x6aaa('0xca')){return _0x1bc645['update']({'read':!![]});}else{logger['error'](_0x6aaa('0x24'),_0x6aaa('0x2b'),_0x6aaa('0x8b'),util[_0x6aaa('0xcd')](_0x403663[_0x6aaa('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6aaa('0xcb'):if(_0x34a1d5=='DELIVERED_TO_GATEWAY'||_0x34a1d5==_0x6aaa('0xcf')){return _0x1bc645[_0x6aaa('0x63')]({'read':!![]});}else{logger[_0x6aaa('0x26')](_0x6aaa('0x24'),'status','clickatell',util[_0x6aaa('0xcd')](_0x403663[_0x6aaa('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6aaa('0x91'):if(_0x34a1d5==_0x6aaa('0xd0')){return _0x1bc645[_0x6aaa('0x63')]({'read':!![]});}else{logger[_0x6aaa('0x26')](_0x6aaa('0x24'),_0x6aaa('0x2b'),_0x6aaa('0x91'),util['inspect'](_0x403663[_0x6aaa('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x6aaa('0xd1'):if(_0x34a1d5===_0x6aaa('0xd2')||_0x34a1d5===_0x6aaa('0xd3')){return _0x1bc645[_0x6aaa('0x63')]({'read':!![]});}else{logger[_0x6aaa('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x6aaa('0x2b'),_0x6aaa('0xd1'),util[_0x6aaa('0xcd')](_0x403663['body'],{'showHidden':![],'depth':null}));}break;}return _0x1bc645;}})[_0x6aaa('0x20')](respondWithResult(_0x2c93a4,null))[_0x6aaa('0x61')](handleError(_0x2c93a4,null));};exports['statusGet']=function(_0x28e617,_0x15d972,_0x57149b){var _0x3c9065,_0x204f26,_0x1221a8;return db[_0x6aaa('0x3d')]['find']({'where':{'id':_0x28e617[_0x6aaa('0x56')]['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x15d972,null))['then'](function(_0xffd3f4){if(_0xffd3f4){_0x1221a8=_0xffd3f4;logger['debug']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x6aaa('0xc4'),_0xffd3f4[_0x6aaa('0x40')],util[_0x6aaa('0xcd')](_0x28e617[_0x6aaa('0x46')],{'showHidden':![],'depth':null}));switch(_0xffd3f4['type']){case _0x6aaa('0x8d'):if(_0x28e617[_0x6aaa('0x46')][_0x6aaa('0xd4')]&&_0x28e617[_0x6aaa('0x46')]['state']){_0x204f26=_0x28e617[_0x6aaa('0x46')][_0x6aaa('0xd5')];return db[_0x6aaa('0xa4')][_0x6aaa('0x58')]({'where':{'messageId':_0x28e617[_0x6aaa('0x46')][_0x6aaa('0xd4')]}});}break;}}})[_0x6aaa('0x20')](handleEntityNotFound(_0x15d972,null))['then'](function(_0x5b2a99){if(_0x5b2a99){_0x3c9065=_0x5b2a99;switch(_0x1221a8[_0x6aaa('0x40')]){case'csc':if(_0x204f26==='2'||_0x204f26==='6'){return _0x3c9065[_0x6aaa('0x63')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status','csc',util[_0x6aaa('0xcd')](_0x28e617[_0x6aaa('0x46')],{'showHidden':![],'depth':null}));};break;}return _0x3c9065;}})[_0x6aaa('0x20')](respondWithResult(_0x15d972,null))['catch'](handleError(_0x15d972,null));};exports[_0x6aaa('0xd6')]=function(_0x29467b,_0xb293ba,_0x4e5b2d){return db[_0x6aaa('0x3d')][_0x6aaa('0x58')]({'where':{'id':_0x29467b['params']['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0xb293ba,null))[_0x6aaa('0x20')](function(_0x4e5239){if(_0x4e5239){return _0x4e5239[_0x6aaa('0xd6')](_0x29467b['body'][_0x6aaa('0x6b')],_[_0x6aaa('0x9c')](_0x29467b[_0x6aaa('0x5a')],[_0x6aaa('0x6b'),'id'])||{})[_0x6aaa('0xc2')](function(_0x54dbc9){for(var _0x5bb48f=0x0;_0x5bb48f<_0x29467b[_0x6aaa('0x5a')][_0x6aaa('0x6b')][_0x6aaa('0x49')];_0x5bb48f+=0x1){socket[_0x6aaa('0xd7')](_0x6aaa('0xd8'),{'UserId':Number(_0x29467b[_0x6aaa('0x5a')][_0x6aaa('0x6b')][_0x5bb48f]),'SmsAccountId':Number(_0x29467b[_0x6aaa('0x56')]['id'])});}return _0x54dbc9;});}})[_0x6aaa('0x20')](respondWithResult(_0xb293ba,null))['catch'](handleError(_0xb293ba,null));};exports[_0x6aaa('0xd9')]=function(_0x3bdc52,_0x1da845,_0x21f017){return db[_0x6aaa('0x3d')]['find']({'where':{'id':_0x3bdc52[_0x6aaa('0x56')]['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x1da845,null))[_0x6aaa('0x20')](function(_0x1000bf){if(_0x1000bf){return _0x1000bf[_0x6aaa('0xd9')](_0x3bdc52['query'][_0x6aaa('0x6b')])['then'](function(){if(_[_0x6aaa('0xda')](_0x3bdc52['query'][_0x6aaa('0x6b')])){for(var _0x36f89b=0x0;_0x36f89b<_0x3bdc52[_0x6aaa('0x46')]['ids'][_0x6aaa('0x49')];_0x36f89b+=0x1){socket['emit'](_0x6aaa('0xdb'),{'UserId':Number(_0x3bdc52['query'][_0x6aaa('0x6b')][_0x36f89b]),'SmsAccountId':Number(_0x3bdc52[_0x6aaa('0x56')]['id'])});}}else{socket[_0x6aaa('0xd7')](_0x6aaa('0xdb'),{'UserId':Number(_0x3bdc52['query'][_0x6aaa('0x6b')]),'SmsAccountId':Number(_0x3bdc52['params']['id'])});}});}})[_0x6aaa('0x20')](respondWithStatusCode(_0x1da845,null))['catch'](handleError(_0x1da845,null));};exports[_0x6aaa('0xdc')]=function(_0x3673d3,_0x5894e4,_0x10aa00){var _0xc5c808={};var _0x597061={};var _0x4c0f9c;var _0x383726;return db[_0x6aaa('0x3d')][_0x6aaa('0x69')]({'where':{'id':_0x3673d3['params']['id']}})[_0x6aaa('0x20')](handleEntityNotFound(_0x5894e4,null))[_0x6aaa('0x20')](function(_0xf8589a){if(_0xf8589a){_0x4c0f9c=_0xf8589a;_0x597061[_0x6aaa('0x45')]=_['keys'](db['User']['rawAttributes']);_0x597061[_0x6aaa('0x46')]=_['keys'](_0x3673d3['query']);_0x597061[_0x6aaa('0x43')]=_['intersection'](_0x597061[_0x6aaa('0x45')],_0x597061['query']);_0xc5c808['attributes']=_['intersection'](_0x597061[_0x6aaa('0x45')],qs[_0x6aaa('0x47')](_0x3673d3[_0x6aaa('0x46')]['fields']));_0xc5c808[_0x6aaa('0x48')]=_0xc5c808[_0x6aaa('0x48')][_0x6aaa('0x49')]?_0xc5c808[_0x6aaa('0x48')]:_0x597061[_0x6aaa('0x45')];_0xc5c808[_0x6aaa('0x70')]=qs['sort'](_0x3673d3[_0x6aaa('0x46')][_0x6aaa('0x4b')]);_0xc5c808[_0x6aaa('0x4c')]=qs[_0x6aaa('0x43')](_['pick'](_0x3673d3[_0x6aaa('0x46')],_0x597061[_0x6aaa('0x43')]));if(_0x3673d3['query'][_0x6aaa('0x4e')]){_0xc5c808['where']=_[_0x6aaa('0x4f')](_0xc5c808['where'],{'$or':_[_0x6aaa('0x3c')](_0xc5c808['attributes'],function(_0x592178){var _0x4aa33e={};_0x4aa33e[_0x592178]={'$like':'%'+_0x3673d3[_0x6aaa('0x46')][_0x6aaa('0x4e')]+'%'};return _0x4aa33e;})});}_0xc5c808=_[_0x6aaa('0x4f')]({},_0xc5c808,_0x3673d3[_0x6aaa('0x57')]);return _0x4c0f9c[_0x6aaa('0xdc')](_0xc5c808);}})[_0x6aaa('0x20')](function(_0x3d74b5){if(_0x3d74b5){_0x383726=_0x3d74b5['length'];if(!_0x3673d3['query']['hasOwnProperty'](_0x6aaa('0x6f'))){_0xc5c808[_0x6aaa('0x2e')]=qs[_0x6aaa('0x2e')](_0x3673d3[_0x6aaa('0x46')]['limit']);_0xc5c808[_0x6aaa('0x2d')]=qs['offset'](_0x3673d3[_0x6aaa('0x46')][_0x6aaa('0x2d')]);}return _0x4c0f9c[_0x6aaa('0xdc')](_0xc5c808);}})[_0x6aaa('0x20')](function(_0x34881f){if(_0x34881f){return _0x34881f?{'count':_0x383726,'rows':_0x34881f}:null;}})[_0x6aaa('0x20')](respondWithResult(_0x5894e4,null))['catch'](handleError(_0x5894e4,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 975256e..b88a5b0 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 _0x6127=['setMaxListeners','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x7185f7,_0x37065){var _0x182e45=function(_0x519e0d){while(--_0x519e0d){_0x7185f7['push'](_0x7185f7['shift']());}};_0x182e45(++_0x37065);}(_0x6127,0x82));var _0x7612=function(_0x2f880a,_0x4551fb){_0x2f880a=_0x2f880a-0x0;var _0x5bef2a=_0x6127[_0x2f880a];return _0x5bef2a;};'use strict';var EventEmitter=require(_0x7612('0x0'));var SmsAccount=require(_0x7612('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x7612('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1d8e58){return function(_0xfc92f8,_0x176d71,_0x599d12){SmsAccountEvents[_0x7612('0x3')](_0x1d8e58+':'+_0xfc92f8['id'],_0xfc92f8);SmsAccountEvents[_0x7612('0x3')](_0x1d8e58,_0xfc92f8);_0x599d12(null);};}for(var e in events){if(events[_0x7612('0x4')](e)){var event=events[e];SmsAccount['hook'](e,emitEvent(event));}}module[_0x7612('0x5')]=SmsAccountEvents; \ No newline at end of file +var _0xe67a=['emit','hook','exports','events','setMaxListeners','save','update'];(function(_0x401fbb,_0x44407f){var _0x4cb93f=function(_0x5c79c6){while(--_0x5c79c6){_0x401fbb['push'](_0x401fbb['shift']());}};_0x4cb93f(++_0x44407f);}(_0xe67a,0x13e));var _0xae67=function(_0xa0579d,_0x371e90){_0xa0579d=_0xa0579d-0x0;var _0x4362df=_0xe67a[_0xa0579d];return _0x4362df;};'use strict';var EventEmitter=require(_0xae67('0x0'));var SmsAccount=require('../../mysqldb')['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0xae67('0x1')](0x0);var events={'afterCreate':_0xae67('0x2'),'afterUpdate':_0xae67('0x3'),'afterDestroy':'remove'};function emitEvent(_0x226755){return function(_0x248dc2,_0x256ff7,_0x478ea2){SmsAccountEvents[_0xae67('0x4')](_0x226755+':'+_0x248dc2['id'],_0x248dc2);SmsAccountEvents['emit'](_0x226755,_0x248dc2);_0x478ea2(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsAccount[_0xae67('0x5')](e,emitEvent(event));}}module[_0xae67('0x6')]=SmsAccountEvents; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.model.js b/server/api/smsAccount/smsAccount.model.js index ca6bc94..211e11e 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 _0x17ff=['rimraf','./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','util','api','moment','bluebird','path'];(function(_0x197d5c,_0x1936b0){var _0x13dc71=function(_0x332d07){while(--_0x332d07){_0x197d5c['push'](_0x197d5c['shift']());}};_0x13dc71(++_0x1936b0);}(_0x17ff,0x96));var _0xf17f=function(_0x4abb47,_0x1af6ca){_0x4abb47=_0x4abb47-0x0;var _0x486d7a=_0x17ff[_0x4abb47];return _0x486d7a;};'use strict';var _=require(_0xf17f('0x0'));var util=require(_0xf17f('0x1'));var logger=require('../../config/logger')(_0xf17f('0x2'));var moment=require(_0xf17f('0x3'));var BPromise=require(_0xf17f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf17f('0x5'));var rimraf=require(_0xf17f('0x6'));var config=require('../../config/environment');var attributes=require(_0xf17f('0x7'));module[_0xf17f('0x8')]=function(_0x44bbb7,_0x1ca999){return _0x44bbb7[_0xf17f('0x9')](_0xf17f('0xa'),attributes,{'tableName':_0xf17f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe154=['./smsAccount.attributes','exports','define','SmsAccount','sms_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x3249a1,_0x1b6086){var _0x2aa7c9=function(_0x33fba5){while(--_0x33fba5){_0x3249a1['push'](_0x3249a1['shift']());}};_0x2aa7c9(++_0x1b6086);}(_0xe154,0xe2));var _0x4e15=function(_0x35d8af,_0x14fd75){_0x35d8af=_0x35d8af-0x0;var _0x1d08b0=_0xe154[_0x35d8af];return _0x1d08b0;};'use strict';var _=require(_0x4e15('0x0'));var util=require('util');var logger=require(_0x4e15('0x1'))(_0x4e15('0x2'));var moment=require(_0x4e15('0x3'));var BPromise=require(_0x4e15('0x4'));var rp=require(_0x4e15('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4e15('0x6'));var config=require(_0x4e15('0x7'));var attributes=require(_0x4e15('0x8'));module[_0x4e15('0x9')]=function(_0xc4e16f,_0xcdd6ad){return _0xc4e16f[_0x4e15('0xa')](_0x4e15('0xb'),attributes,{'tableName':_0x4e15('0xc'),'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 01d135c..a0c7d0e 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 _0x7c00=['error','code','SmsAccount,\x20%s,\x20%s','message','info','result','catch','ShowSmsAccount','options','raw','where','attributes','include','model','map','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','redis','defaults','localhost','./smsAccount.socket','register','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x8da427,_0x5dc2b2){var _0x23fa81=function(_0x513940){while(--_0x513940){_0x8da427['push'](_0x8da427['shift']());}};_0x23fa81(++_0x5dc2b2);}(_0x7c00,0xba));var _0x07c0=function(_0x40240a,_0x25f72f){_0x40240a=_0x40240a-0x0;var _0xc49eb2=_0x7c00[_0x40240a];return _0xc49eb2;};'use strict';var _=require(_0x07c0('0x0'));var util=require(_0x07c0('0x1'));var moment=require(_0x07c0('0x2'));var BPromise=require('bluebird');var rs=require(_0x07c0('0x3'));var fs=require('fs');var Redis=require(_0x07c0('0x4'));var db=require(_0x07c0('0x5'))['db'];var utils=require(_0x07c0('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x07c0('0x7'));var jayson=require(_0x07c0('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0x07c0('0x9')]=_[_0x07c0('0xa')](config[_0x07c0('0x9')],{'host':_0x07c0('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x07c0('0x9')]));require(_0x07c0('0xc'))[_0x07c0('0xd')](socket);function respondWithRpcPromise(_0x5f5d78,_0x56584c,_0x1e1384){return new BPromise(function(_0xff0db8,_0x1268ad){return client['request'](_0x5f5d78,_0x1e1384)['then'](function(_0x3656bf){logger['info']('SmsAccount,\x20%s,\x20%s',_0x56584c,_0x07c0('0xe'));logger[_0x07c0('0xf')](_0x07c0('0x10'),_0x56584c,_0x07c0('0xe'),JSON[_0x07c0('0x11')](_0x3656bf));if(_0x3656bf[_0x07c0('0x12')]){if(_0x3656bf[_0x07c0('0x12')][_0x07c0('0x13')]===0x1f4){logger[_0x07c0('0x12')](_0x07c0('0x14'),_0x56584c,_0x3656bf[_0x07c0('0x12')][_0x07c0('0x15')]);return _0x1268ad(_0x3656bf[_0x07c0('0x12')][_0x07c0('0x15')]);}logger[_0x07c0('0x12')](_0x07c0('0x14'),_0x56584c,_0x3656bf[_0x07c0('0x12')]['message']);return _0xff0db8(_0x3656bf['error'][_0x07c0('0x15')]);}else{logger[_0x07c0('0x16')](_0x07c0('0x14'),_0x56584c,_0x07c0('0xe'));_0xff0db8(_0x3656bf[_0x07c0('0x17')][_0x07c0('0x15')]);}})[_0x07c0('0x18')](function(_0x4f1130){logger[_0x07c0('0x12')]('SmsAccount,\x20%s,\x20%s',_0x56584c,_0x4f1130);_0x1268ad(_0x4f1130);});});}exports[_0x07c0('0x19')]=function(_0x5a848a){var _0x4f321b=this;return new Promise(function(_0x59ba02,_0x14ee80){return db['SmsAccount']['find']({'raw':_0x5a848a[_0x07c0('0x1a')]?_0x5a848a[_0x07c0('0x1a')][_0x07c0('0x1b')]===undefined?!![]:![]:!![],'where':_0x5a848a[_0x07c0('0x1a')]?_0x5a848a[_0x07c0('0x1a')][_0x07c0('0x1c')]||null:null,'attributes':_0x5a848a[_0x07c0('0x1a')]?_0x5a848a[_0x07c0('0x1a')][_0x07c0('0x1d')]||null:null,'include':_0x5a848a[_0x07c0('0x1a')]?_0x5a848a['options'][_0x07c0('0x1e')]?_['map'](_0x5a848a[_0x07c0('0x1a')][_0x07c0('0x1e')],function(_0x3e917a){return{'model':db[_0x3e917a[_0x07c0('0x1f')]],'as':_0x3e917a['as'],'attributes':_0x3e917a[_0x07c0('0x1d')],'include':_0x3e917a[_0x07c0('0x1e')]?_['map'](_0x3e917a[_0x07c0('0x1e')],function(_0x113d4a){return{'model':db[_0x113d4a['model']],'as':_0x113d4a['as'],'attributes':_0x113d4a[_0x07c0('0x1d')],'include':_0x113d4a[_0x07c0('0x1e')]?_[_0x07c0('0x20')](_0x113d4a['include'],function(_0x55dcde){return{'model':db[_0x55dcde[_0x07c0('0x1f')]],'as':_0x55dcde['as'],'attributes':_0x55dcde[_0x07c0('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x07c0('0x21')](function(_0x2b924c){logger['info'](_0x07c0('0x19'),_0x5a848a);logger[_0x07c0('0xf')](_0x07c0('0x19'),_0x5a848a,JSON[_0x07c0('0x11')](_0x2b924c));_0x59ba02(_0x2b924c);})['catch'](function(_0x100201){logger['error']('ShowSmsAccount',_0x100201[_0x07c0('0x15')],_0x5a848a);_0x14ee80(_0x4f321b['error'](0x1f4,_0x100201[_0x07c0('0x15')]));});});}; \ No newline at end of file +var _0x528f=['client','http','redis','defaults','localhost','register','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','SmsAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','include','model','attributes','map','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x29e86e,_0x3c9a31){var _0x470d53=function(_0x41dd54){while(--_0x41dd54){_0x29e86e['push'](_0x29e86e['shift']());}};_0x470d53(++_0x3c9a31);}(_0x528f,0x1bd));var _0xf528=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x528f[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xf528('0x0'));var util=require(_0xf528('0x1'));var moment=require(_0xf528('0x2'));var BPromise=require(_0xf528('0x3'));var rs=require(_0xf528('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf528('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf528('0x6'))(_0xf528('0x7'));var config=require(_0xf528('0x8'));var jayson=require(_0xf528('0x9'));var client=jayson[_0xf528('0xa')][_0xf528('0xb')]({'port':0x232a});config[_0xf528('0xc')]=_[_0xf528('0xd')](config[_0xf528('0xc')],{'host':_0xf528('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xf528('0xc')]));require('./smsAccount.socket')[_0xf528('0xf')](socket);function respondWithRpcPromise(_0x3fecb0,_0x13680e,_0x5f06c3){return new BPromise(function(_0x537f50,_0x4a8b2d){return client['request'](_0x3fecb0,_0x5f06c3)[_0xf528('0x10')](function(_0x315393){logger[_0xf528('0x11')](_0xf528('0x12'),_0x13680e,_0xf528('0x13'));logger[_0xf528('0x14')](_0xf528('0x15'),_0x13680e,_0xf528('0x13'),JSON[_0xf528('0x16')](_0x315393));if(_0x315393['error']){if(_0x315393[_0xf528('0x17')]['code']===0x1f4){logger['error'](_0xf528('0x12'),_0x13680e,_0x315393[_0xf528('0x17')][_0xf528('0x18')]);return _0x4a8b2d(_0x315393[_0xf528('0x17')][_0xf528('0x18')]);}logger[_0xf528('0x17')](_0xf528('0x12'),_0x13680e,_0x315393[_0xf528('0x17')][_0xf528('0x18')]);return _0x537f50(_0x315393[_0xf528('0x17')][_0xf528('0x18')]);}else{logger[_0xf528('0x11')]('SmsAccount,\x20%s,\x20%s',_0x13680e,_0xf528('0x13'));_0x537f50(_0x315393['result'][_0xf528('0x18')]);}})[_0xf528('0x19')](function(_0x16631a){logger[_0xf528('0x17')]('SmsAccount,\x20%s,\x20%s',_0x13680e,_0x16631a);_0x4a8b2d(_0x16631a);});});}exports[_0xf528('0x1a')]=function(_0x54a0a6){var _0x137f16=this;return new Promise(function(_0x174e28,_0x3236fa){return db[_0xf528('0x1b')][_0xf528('0x1c')]({'raw':_0x54a0a6[_0xf528('0x1d')]?_0x54a0a6['options'][_0xf528('0x1e')]===undefined?!![]:![]:!![],'where':_0x54a0a6['options']?_0x54a0a6[_0xf528('0x1d')]['where']||null:null,'attributes':_0x54a0a6[_0xf528('0x1d')]?_0x54a0a6[_0xf528('0x1d')]['attributes']||null:null,'include':_0x54a0a6[_0xf528('0x1d')]?_0x54a0a6[_0xf528('0x1d')][_0xf528('0x1f')]?_['map'](_0x54a0a6[_0xf528('0x1d')]['include'],function(_0x1f7d88){return{'model':db[_0x1f7d88[_0xf528('0x20')]],'as':_0x1f7d88['as'],'attributes':_0x1f7d88[_0xf528('0x21')],'include':_0x1f7d88[_0xf528('0x1f')]?_['map'](_0x1f7d88['include'],function(_0x1bdfc9){return{'model':db[_0x1bdfc9[_0xf528('0x20')]],'as':_0x1bdfc9['as'],'attributes':_0x1bdfc9[_0xf528('0x21')],'include':_0x1bdfc9['include']?_[_0xf528('0x22')](_0x1bdfc9['include'],function(_0x1085f1){return{'model':db[_0x1085f1[_0xf528('0x20')]],'as':_0x1085f1['as'],'attributes':_0x1085f1[_0xf528('0x21')]};}):[]};}):[]};}):[]:[]})[_0xf528('0x10')](function(_0x183df4){logger[_0xf528('0x11')](_0xf528('0x1a'),_0x54a0a6);logger[_0xf528('0x14')](_0xf528('0x1a'),_0x54a0a6,JSON[_0xf528('0x16')](_0x183df4));_0x174e28(_0x183df4);})[_0xf528('0x19')](function(_0x2f5ee2){logger[_0xf528('0x17')](_0xf528('0x1a'),_0x2f5ee2['message'],_0x54a0a6);_0x3236fa(_0x137f16['error'](0x1f4,_0x2f5ee2[_0xf528('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 40243ea..bacc9b2 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 _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var SmsAccountEvents=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(){SmsAccountEvents[_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);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2f3848,_0x48564d){_0x2f3848=_0x2f3848-0x0;var _0x102668=_0xa9e0[_0x2f3848];return _0x102668;};'use strict';var SmsAccountEvents=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(){SmsAccountEvents[_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);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index fb7fcc1..4ecf4ee 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 _0x008c=['exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','post','put','/:id'];(function(_0x264149,_0x1df678){var _0x19807c=function(_0x3e69e8){while(--_0x3e69e8){_0x264149['push'](_0x264149['shift']());}};_0x19807c(++_0x1df678);}(_0x008c,0x188));var _0xc008=function(_0x22ea49,_0x4a785c){_0x22ea49=_0x22ea49-0x0;var _0x580ac8=_0x008c[_0x22ea49];return _0x580ac8;};'use strict';var multer=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var path=require(_0xc008('0x2'));var timeout=require(_0xc008('0x3'));var express=require(_0xc008('0x4'));var router=express['Router']();var fs_extra=require(_0xc008('0x5'));var auth=require(_0xc008('0x6'));var interaction=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var controller=require(_0xc008('0x9'));router[_0xc008('0xa')]('/',auth[_0xc008('0xb')](),controller[_0xc008('0xc')]);router[_0xc008('0xa')]('/:id',auth[_0xc008('0xb')](),controller['show']);router[_0xc008('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc008('0xe')](_0xc008('0xf'),auth['isAuthenticated'](),controller['update']);router['delete'](_0xc008('0xf'),auth[_0xc008('0xb')](),controller['destroy']);module[_0xc008('0x10')]=router; \ No newline at end of file +var _0xedd9=['post','create','update','delete','destroy','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5adb9d,_0x13ad6d){var _0x58d6df=function(_0x13cbac){while(--_0x13cbac){_0x5adb9d['push'](_0x5adb9d['shift']());}};_0x58d6df(++_0x13ad6d);}(_0xedd9,0xfc));var _0x9edd=function(_0xc2e985,_0x558d74){_0xc2e985=_0xc2e985-0x0;var _0x3c0f57=_0xedd9[_0xc2e985];return _0x3c0f57;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');var controller=require(_0x9edd('0x8'));router[_0x9edd('0x9')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xb')]);router['get'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0xd')]);router[_0x9edd('0xe')]('/',auth[_0x9edd('0xa')](),controller[_0x9edd('0xf')]);router['put'](_0x9edd('0xc'),auth['isAuthenticated'](),controller[_0x9edd('0x10')]);router[_0x9edd('0x11')]('/:id',auth[_0x9edd('0xa')](),controller[_0x9edd('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index bb181a8..9acd2fe 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 _0x8f48=['*,*,*,*','sequelize','INTEGER','noop','TEXT','STRING'];(function(_0x20d282,_0xf94e62){var _0xbd9750=function(_0xabfb65){while(--_0xabfb65){_0x20d282['push'](_0x20d282['shift']());}};_0xbd9750(++_0xf94e62);}(_0x8f48,0xc1));var _0x88f4=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0x8f48[_0x4a7843];return _0x2c57fe;};'use strict';var Sequelize=require(_0x88f4('0x0'));module['exports']={'priority':{'type':Sequelize[_0x88f4('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x88f4('0x2')},'appdata':{'type':Sequelize[_0x88f4('0x3')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x88f4('0x4')],'defaultValue':_0x88f4('0x5')}}; \ No newline at end of file +var _0x79cc=['TEXT','*,*,*,*','sequelize','exports','STRING','noop'];(function(_0x539d7b,_0x5f2eba){var _0x31953c=function(_0x2c792a){while(--_0x2c792a){_0x539d7b['push'](_0x539d7b['shift']());}};_0x31953c(++_0x5f2eba);}(_0x79cc,0x19a));var _0xc79c=function(_0x3f7881,_0x4950d7){_0x3f7881=_0x3f7881-0x0;var _0xf5484a=_0x79cc[_0x3f7881];return _0xf5484a;};'use strict';var Sequelize=require(_0xc79c('0x0'));module[_0xc79c('0x1')]={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc79c('0x2')],'allowNull':![],'defaultValue':_0xc79c('0x3')},'appdata':{'type':Sequelize[_0xc79c('0x4')]()},'description':{'type':Sequelize[_0xc79c('0x2')]},'interval':{'type':Sequelize[_0xc79c('0x2')],'defaultValue':_0xc79c('0x5')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index 764fcba..ce96b87 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 _0xf85d=['undefined','count','limit','set','Content-Range','json','apply','reject','save','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','type','VIRTUAL','includeAll','include','findAll','show','find','catch','create','body','update','destroy','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset'];(function(_0x2b9324,_0x32f260){var _0x5063a4=function(_0x5abd1e){while(--_0x5abd1e){_0x2b9324['push'](_0x2b9324['shift']());}};_0x5063a4(++_0x32f260);}(_0xf85d,0x7d));var _0xdf85=function(_0x2a7812,_0x1ce83a){_0x2a7812=_0x2a7812-0x0;var _0x3e1342=_0xf85d[_0x2a7812];return _0x3e1342;};'use strict';var emlformat=require(_0xdf85('0x0'));var rimraf=require(_0xdf85('0x1'));var zipdir=require(_0xdf85('0x2'));var jsonpatch=require(_0xdf85('0x3'));var rp=require(_0xdf85('0x4'));var moment=require(_0xdf85('0x5'));var BPromise=require(_0xdf85('0x6'));var Mustache=require(_0xdf85('0x7'));var util=require('util');var path=require(_0xdf85('0x8'));var sox=require(_0xdf85('0x9'));var csv=require(_0xdf85('0xa'));var ejs=require(_0xdf85('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdf85('0xc'));var squel=require(_0xdf85('0xd'));var crypto=require(_0xdf85('0xe'));var jsforce=require(_0xdf85('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xdf85('0xa'));var querystring=require(_0xdf85('0x10'));var Papa=require(_0xdf85('0x11'));var Redis=require(_0xdf85('0x12'));var authService=require(_0xdf85('0x13'));var qs=require(_0xdf85('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xdf85('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xdf85('0x16'));var licenseUtil=require(_0xdf85('0x17'));var db=require(_0xdf85('0x18'))['db'];function respondWithStatusCode(_0x87b4e2,_0x57cf2e){_0x57cf2e=_0x57cf2e||0xcc;return function(_0x5a0e4e){if(_0x5a0e4e){return _0x87b4e2[_0xdf85('0x19')](_0x57cf2e);}return _0x87b4e2[_0xdf85('0x1a')](_0x57cf2e)[_0xdf85('0x1b')]();};}function respondWithResult(_0x146100,_0x5d37dc){_0x5d37dc=_0x5d37dc||0xc8;return function(_0x3143ca){if(_0x3143ca){return _0x146100[_0xdf85('0x1a')](_0x5d37dc)['json'](_0x3143ca);}};}function respondWithFilteredResult(_0x193eec,_0x42df70){return function(_0x4887ba){if(_0x4887ba){var _0x31935b=typeof _0x42df70[_0xdf85('0x1c')]===_0xdf85('0x1d')&&typeof _0x42df70['limit']===_0xdf85('0x1d');var _0x582edc=_0x4887ba[_0xdf85('0x1e')];var _0x4a2d13=_0x31935b?0x0:_0x42df70[_0xdf85('0x1c')];var _0x7633a4=_0x31935b?_0x4887ba[_0xdf85('0x1e')]:_0x42df70['offset']+_0x42df70[_0xdf85('0x1f')];var _0xa91329;if(_0x7633a4>=_0x582edc){_0x7633a4=_0x582edc;_0xa91329=0xc8;}else{_0xa91329=0xce;}_0x193eec[_0xdf85('0x1a')](_0xa91329);return _0x193eec[_0xdf85('0x20')](_0xdf85('0x21'),_0x4a2d13+'-'+_0x7633a4+'/'+_0x582edc)[_0xdf85('0x22')](_0x4887ba);}return null;};}function patchUpdates(_0x55c654){return function(_0xbd4add){try{jsonpatch[_0xdf85('0x23')](_0xbd4add,_0x55c654,!![]);}catch(_0x42206f){return BPromise[_0xdf85('0x24')](_0x42206f);}return _0xbd4add[_0xdf85('0x25')]();};}function saveUpdates(_0x188048,_0x46d31c){return function(_0x1b5df0){if(_0x1b5df0){return _0x1b5df0['update'](_0x188048)[_0xdf85('0x26')](function(_0x3550bd){return _0x3550bd;});}return null;};}function removeEntity(_0x57a962,_0x1dbf79){return function(_0x3b2d52){if(_0x3b2d52){return _0x3b2d52['destroy']()[_0xdf85('0x26')](function(){_0x57a962[_0xdf85('0x1a')](0xcc)[_0xdf85('0x1b')]();});}};}function handleEntityNotFound(_0x14af66,_0x30aa46){return function(_0x2a96c3){if(!_0x2a96c3){_0x14af66['sendStatus'](0x194);}return _0x2a96c3;};}function handleError(_0xd08edd,_0x353bad){_0x353bad=_0x353bad||0x1f4;return function(_0x36470b){logger[_0xdf85('0x27')](_0x36470b[_0xdf85('0x28')]);if(_0x36470b['name']){delete _0x36470b[_0xdf85('0x29')];}_0xd08edd[_0xdf85('0x1a')](_0x353bad)[_0xdf85('0x2a')](_0x36470b);};}exports[_0xdf85('0x2b')]=function(_0x4d26be,_0x4344cf){var _0x41502d={},_0x1515ea={},_0xdd419e={'count':0x0,'rows':[]};var _0xe5db96=_[_0xdf85('0x2c')](db[_0xdf85('0x2d')][_0xdf85('0x2e')],function(_0x13090f){return{'name':_0x13090f[_0xdf85('0x2f')],'type':_0x13090f['type'][_0xdf85('0x30')]};});_0x1515ea[_0xdf85('0x31')]=_[_0xdf85('0x2c')](_0xe5db96,_0xdf85('0x29'));_0x1515ea[_0xdf85('0x32')]=_[_0xdf85('0x33')](_0x4d26be['query']);_0x1515ea[_0xdf85('0x34')]=_[_0xdf85('0x35')](_0x1515ea[_0xdf85('0x31')],_0x1515ea['query']);_0x41502d[_0xdf85('0x36')]=_[_0xdf85('0x35')](_0x1515ea[_0xdf85('0x31')],qs[_0xdf85('0x37')](_0x4d26be['query'][_0xdf85('0x37')]));_0x41502d['attributes']=_0x41502d['attributes'][_0xdf85('0x38')]?_0x41502d[_0xdf85('0x36')]:_0x1515ea[_0xdf85('0x31')];if(!_0x4d26be[_0xdf85('0x32')][_0xdf85('0x39')](_0xdf85('0x3a'))){_0x41502d['limit']=qs[_0xdf85('0x1f')](_0x4d26be[_0xdf85('0x32')]['limit']);_0x41502d[_0xdf85('0x1c')]=qs[_0xdf85('0x1c')](_0x4d26be[_0xdf85('0x32')]['offset']);}_0x41502d[_0xdf85('0x3b')]=qs['sort'](_0x4d26be[_0xdf85('0x32')][_0xdf85('0x3c')]);_0x41502d[_0xdf85('0x3d')]=qs[_0xdf85('0x34')](_['pick'](_0x4d26be[_0xdf85('0x32')],_0x1515ea[_0xdf85('0x34')]),_0xe5db96);if(_0x4d26be[_0xdf85('0x32')][_0xdf85('0x3e')]){_0x41502d[_0xdf85('0x3d')]=_[_0xdf85('0x3f')](_0x41502d['where'],{'$or':_['map'](_0xe5db96,function(_0xe49fa6){if(_0xe49fa6[_0xdf85('0x40')]!==_0xdf85('0x41')){var _0x534766={};_0x534766[_0xe49fa6[_0xdf85('0x29')]]={'$like':'%'+_0x4d26be[_0xdf85('0x32')]['filter']+'%'};return _0x534766;}})});}_0x41502d=_['merge']({},_0x41502d,_0x4d26be['options']);var _0x29045b={'where':_0x41502d['where']};return db[_0xdf85('0x2d')][_0xdf85('0x1e')](_0x29045b)['then'](function(_0x241cfa){_0xdd419e[_0xdf85('0x1e')]=_0x241cfa;if(_0x4d26be[_0xdf85('0x32')][_0xdf85('0x42')]){_0x41502d[_0xdf85('0x43')]=[{'all':!![]}];}return db[_0xdf85('0x2d')][_0xdf85('0x44')](_0x41502d);})['then'](function(_0x574e8e){_0xdd419e['rows']=_0x574e8e;return _0xdd419e;})[_0xdf85('0x26')](respondWithFilteredResult(_0x4344cf,_0x41502d))['catch'](handleError(_0x4344cf,null));};exports[_0xdf85('0x45')]=function(_0x1595f5,_0x1f8369){var _0x26961f={'raw':!![],'where':{'id':_0x1595f5['params']['id']}},_0x5c5d4b={};_0x5c5d4b['model']=_[_0xdf85('0x33')](db[_0xdf85('0x2d')]['rawAttributes']);_0x5c5d4b[_0xdf85('0x32')]=_[_0xdf85('0x33')](_0x1595f5[_0xdf85('0x32')]);_0x5c5d4b[_0xdf85('0x34')]=_[_0xdf85('0x35')](_0x5c5d4b['model'],_0x5c5d4b[_0xdf85('0x32')]);_0x26961f[_0xdf85('0x36')]=_[_0xdf85('0x35')](_0x5c5d4b[_0xdf85('0x31')],qs[_0xdf85('0x37')](_0x1595f5[_0xdf85('0x32')][_0xdf85('0x37')]));_0x26961f['attributes']=_0x26961f[_0xdf85('0x36')][_0xdf85('0x38')]?_0x26961f[_0xdf85('0x36')]:_0x5c5d4b[_0xdf85('0x31')];if(_0x1595f5[_0xdf85('0x32')][_0xdf85('0x42')]){_0x26961f['include']=[{'all':!![]}];}_0x26961f=_[_0xdf85('0x3f')]({},_0x26961f,_0x1595f5['options']);return db['SmsApplication'][_0xdf85('0x46')](_0x26961f)['then'](handleEntityNotFound(_0x1f8369,null))[_0xdf85('0x26')](respondWithResult(_0x1f8369,null))[_0xdf85('0x47')](handleError(_0x1f8369,null));};exports[_0xdf85('0x48')]=function(_0x20e6ac,_0x50c1d1){return db[_0xdf85('0x2d')][_0xdf85('0x48')](_0x20e6ac[_0xdf85('0x49')],{})[_0xdf85('0x26')](respondWithResult(_0x50c1d1,0xc9))[_0xdf85('0x47')](handleError(_0x50c1d1,null));};exports[_0xdf85('0x4a')]=function(_0x3fab,_0x3382b9){if(_0x3fab[_0xdf85('0x49')]['id']){delete _0x3fab[_0xdf85('0x49')]['id'];}return db[_0xdf85('0x2d')][_0xdf85('0x46')]({'where':{'id':_0x3fab['params']['id']}})[_0xdf85('0x26')](handleEntityNotFound(_0x3382b9,null))[_0xdf85('0x26')](saveUpdates(_0x3fab[_0xdf85('0x49')],null))[_0xdf85('0x26')](respondWithResult(_0x3382b9,null))[_0xdf85('0x47')](handleError(_0x3382b9,null));};exports[_0xdf85('0x4b')]=function(_0x1a22ad,_0x2a4368){return db[_0xdf85('0x2d')][_0xdf85('0x46')]({'where':{'id':_0x1a22ad[_0xdf85('0x4c')]['id']}})[_0xdf85('0x26')](handleEntityNotFound(_0x2a4368,null))[_0xdf85('0x26')](removeEntity(_0x2a4368,null))[_0xdf85('0x47')](handleError(_0x2a4368,null));}; \ No newline at end of file +var _0x08ef=['to-csv','ejs','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','limit','Content-Range','apply','update','then','destroy','stack','name','send','index','SmsApplication','fieldName','model','map','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','count','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox'];(function(_0x4ab32c,_0x44ab5e){var _0x2b9644=function(_0x498479){while(--_0x498479){_0x4ab32c['push'](_0x4ab32c['shift']());}};_0x2b9644(++_0x44ab5e);}(_0x08ef,0x164));var _0xf08e=function(_0xb996b6,_0x5aec79){_0xb996b6=_0xb996b6-0x0;var _0x2a23f6=_0x08ef[_0xb996b6];return _0x2a23f6;};'use strict';var emlformat=require(_0xf08e('0x0'));var rimraf=require(_0xf08e('0x1'));var zipdir=require(_0xf08e('0x2'));var jsonpatch=require(_0xf08e('0x3'));var rp=require(_0xf08e('0x4'));var moment=require(_0xf08e('0x5'));var BPromise=require(_0xf08e('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf08e('0x7'));var sox=require(_0xf08e('0x8'));var csv=require(_0xf08e('0x9'));var ejs=require(_0xf08e('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf08e('0xb'));var squel=require(_0xf08e('0xc'));var crypto=require(_0xf08e('0xd'));var jsforce=require(_0xf08e('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xf08e('0x9'));var querystring=require(_0xf08e('0xf'));var Papa=require(_0xf08e('0x10'));var Redis=require(_0xf08e('0x11'));var authService=require(_0xf08e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf08e('0x13'));var hardwareService=require(_0xf08e('0x14'));var logger=require(_0xf08e('0x15'))(_0xf08e('0x16'));var utils=require(_0xf08e('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xf08e('0x18'))['db'];function respondWithStatusCode(_0x25bd95,_0xbe911d){_0xbe911d=_0xbe911d||0xcc;return function(_0x4dee44){if(_0x4dee44){return _0x25bd95[_0xf08e('0x19')](_0xbe911d);}return _0x25bd95[_0xf08e('0x1a')](_0xbe911d)['end']();};}function respondWithResult(_0x214af3,_0x7d99eb){_0x7d99eb=_0x7d99eb||0xc8;return function(_0x27e13c){if(_0x27e13c){return _0x214af3[_0xf08e('0x1a')](_0x7d99eb)[_0xf08e('0x1b')](_0x27e13c);}};}function respondWithFilteredResult(_0x114d8b,_0x346bfa){return function(_0x4b55f6){if(_0x4b55f6){var _0x535c4b=typeof _0x346bfa[_0xf08e('0x1c')]==='undefined'&&typeof _0x346bfa[_0xf08e('0x1d')]==='undefined';var _0x51650e=_0x4b55f6['count'];var _0x2d75d6=_0x535c4b?0x0:_0x346bfa[_0xf08e('0x1c')];var _0x34c2cb=_0x535c4b?_0x4b55f6['count']:_0x346bfa[_0xf08e('0x1c')]+_0x346bfa[_0xf08e('0x1d')];var _0x4fa7dc;if(_0x34c2cb>=_0x51650e){_0x34c2cb=_0x51650e;_0x4fa7dc=0xc8;}else{_0x4fa7dc=0xce;}_0x114d8b['status'](_0x4fa7dc);return _0x114d8b['set'](_0xf08e('0x1e'),_0x2d75d6+'-'+_0x34c2cb+'/'+_0x51650e)['json'](_0x4b55f6);}return null;};}function patchUpdates(_0xef4c39){return function(_0xa24249){try{jsonpatch[_0xf08e('0x1f')](_0xa24249,_0xef4c39,!![]);}catch(_0x432ed8){return BPromise['reject'](_0x432ed8);}return _0xa24249['save']();};}function saveUpdates(_0x40dd1b,_0x4837b7){return function(_0x5ab616){if(_0x5ab616){return _0x5ab616[_0xf08e('0x20')](_0x40dd1b)[_0xf08e('0x21')](function(_0x2bc7b0){return _0x2bc7b0;});}return null;};}function removeEntity(_0x150171,_0x539ba7){return function(_0x495885){if(_0x495885){return _0x495885[_0xf08e('0x22')]()[_0xf08e('0x21')](function(){_0x150171[_0xf08e('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x26fb53,_0x36fa63){return function(_0x87a453){if(!_0x87a453){_0x26fb53['sendStatus'](0x194);}return _0x87a453;};}function handleError(_0x181451,_0x39cef1){_0x39cef1=_0x39cef1||0x1f4;return function(_0x5dd318){logger['error'](_0x5dd318[_0xf08e('0x23')]);if(_0x5dd318[_0xf08e('0x24')]){delete _0x5dd318[_0xf08e('0x24')];}_0x181451[_0xf08e('0x1a')](_0x39cef1)[_0xf08e('0x25')](_0x5dd318);};}exports[_0xf08e('0x26')]=function(_0x130f57,_0x5050c6){var _0x339fa7={},_0x2c9487={},_0x2ec9a9={'count':0x0,'rows':[]};var _0x3cdf93=_['map'](db[_0xf08e('0x27')]['rawAttributes'],function(_0x3b900c){return{'name':_0x3b900c[_0xf08e('0x28')],'type':_0x3b900c['type']['key']};});_0x2c9487[_0xf08e('0x29')]=_[_0xf08e('0x2a')](_0x3cdf93,_0xf08e('0x24'));_0x2c9487[_0xf08e('0x2b')]=_[_0xf08e('0x2c')](_0x130f57[_0xf08e('0x2b')]);_0x2c9487[_0xf08e('0x2d')]=_['intersection'](_0x2c9487[_0xf08e('0x29')],_0x2c9487[_0xf08e('0x2b')]);_0x339fa7[_0xf08e('0x2e')]=_[_0xf08e('0x2f')](_0x2c9487[_0xf08e('0x29')],qs[_0xf08e('0x30')](_0x130f57[_0xf08e('0x2b')][_0xf08e('0x30')]));_0x339fa7[_0xf08e('0x2e')]=_0x339fa7[_0xf08e('0x2e')][_0xf08e('0x31')]?_0x339fa7[_0xf08e('0x2e')]:_0x2c9487[_0xf08e('0x29')];if(!_0x130f57[_0xf08e('0x2b')][_0xf08e('0x32')](_0xf08e('0x33'))){_0x339fa7[_0xf08e('0x1d')]=qs[_0xf08e('0x1d')](_0x130f57['query'][_0xf08e('0x1d')]);_0x339fa7[_0xf08e('0x1c')]=qs[_0xf08e('0x1c')](_0x130f57[_0xf08e('0x2b')][_0xf08e('0x1c')]);}_0x339fa7[_0xf08e('0x34')]=qs['sort'](_0x130f57[_0xf08e('0x2b')][_0xf08e('0x35')]);_0x339fa7[_0xf08e('0x36')]=qs[_0xf08e('0x2d')](_[_0xf08e('0x37')](_0x130f57[_0xf08e('0x2b')],_0x2c9487[_0xf08e('0x2d')]),_0x3cdf93);if(_0x130f57[_0xf08e('0x2b')]['filter']){_0x339fa7[_0xf08e('0x36')]=_[_0xf08e('0x38')](_0x339fa7[_0xf08e('0x36')],{'$or':_[_0xf08e('0x2a')](_0x3cdf93,function(_0x4c162e){if(_0x4c162e[_0xf08e('0x39')]!==_0xf08e('0x3a')){var _0x2b2823={};_0x2b2823[_0x4c162e['name']]={'$like':'%'+_0x130f57['query'][_0xf08e('0x3b')]+'%'};return _0x2b2823;}})});}_0x339fa7=_['merge']({},_0x339fa7,_0x130f57[_0xf08e('0x3c')]);var _0x423681={'where':_0x339fa7[_0xf08e('0x36')]};return db['SmsApplication'][_0xf08e('0x3d')](_0x423681)[_0xf08e('0x21')](function(_0x2ff473){_0x2ec9a9['count']=_0x2ff473;if(_0x130f57['query'][_0xf08e('0x3e')]){_0x339fa7[_0xf08e('0x3f')]=[{'all':!![]}];}return db[_0xf08e('0x27')][_0xf08e('0x40')](_0x339fa7);})[_0xf08e('0x21')](function(_0x189a11){_0x2ec9a9[_0xf08e('0x41')]=_0x189a11;return _0x2ec9a9;})[_0xf08e('0x21')](respondWithFilteredResult(_0x5050c6,_0x339fa7))[_0xf08e('0x42')](handleError(_0x5050c6,null));};exports[_0xf08e('0x43')]=function(_0x1d3744,_0x13f1e6){var _0xd5c973={'raw':!![],'where':{'id':_0x1d3744[_0xf08e('0x44')]['id']}},_0x271565={};_0x271565[_0xf08e('0x29')]=_[_0xf08e('0x2c')](db[_0xf08e('0x27')][_0xf08e('0x45')]);_0x271565[_0xf08e('0x2b')]=_['keys'](_0x1d3744['query']);_0x271565[_0xf08e('0x2d')]=_[_0xf08e('0x2f')](_0x271565[_0xf08e('0x29')],_0x271565[_0xf08e('0x2b')]);_0xd5c973[_0xf08e('0x2e')]=_['intersection'](_0x271565[_0xf08e('0x29')],qs[_0xf08e('0x30')](_0x1d3744[_0xf08e('0x2b')]['fields']));_0xd5c973[_0xf08e('0x2e')]=_0xd5c973[_0xf08e('0x2e')][_0xf08e('0x31')]?_0xd5c973[_0xf08e('0x2e')]:_0x271565[_0xf08e('0x29')];if(_0x1d3744['query']['includeAll']){_0xd5c973[_0xf08e('0x3f')]=[{'all':!![]}];}_0xd5c973=_[_0xf08e('0x38')]({},_0xd5c973,_0x1d3744[_0xf08e('0x3c')]);return db['SmsApplication'][_0xf08e('0x46')](_0xd5c973)['then'](handleEntityNotFound(_0x13f1e6,null))['then'](respondWithResult(_0x13f1e6,null))[_0xf08e('0x42')](handleError(_0x13f1e6,null));};exports['create']=function(_0x56db01,_0x1e9156){return db[_0xf08e('0x27')][_0xf08e('0x47')](_0x56db01['body'],{})['then'](respondWithResult(_0x1e9156,0xc9))[_0xf08e('0x42')](handleError(_0x1e9156,null));};exports['update']=function(_0x1d1591,_0x4bc2c1){if(_0x1d1591[_0xf08e('0x48')]['id']){delete _0x1d1591['body']['id'];}return db['SmsApplication'][_0xf08e('0x46')]({'where':{'id':_0x1d1591[_0xf08e('0x44')]['id']}})['then'](handleEntityNotFound(_0x4bc2c1,null))[_0xf08e('0x21')](saveUpdates(_0x1d1591['body'],null))['then'](respondWithResult(_0x4bc2c1,null))[_0xf08e('0x42')](handleError(_0x4bc2c1,null));};exports[_0xf08e('0x22')]=function(_0x2a7045,_0x490fff){return db[_0xf08e('0x27')][_0xf08e('0x46')]({'where':{'id':_0x2a7045[_0xf08e('0x44')]['id']}})['then'](handleEntityNotFound(_0x490fff,null))['then'](removeEntity(_0x490fff,null))[_0xf08e('0x42')](handleError(_0x490fff,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 979dda2..2f5c802 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 _0x09d9=['rimraf','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x452ff6,_0x902f4e){var _0x3af338=function(_0x18b6a5){while(--_0x18b6a5){_0x452ff6['push'](_0x452ff6['shift']());}};_0x3af338(++_0x902f4e);}(_0x09d9,0xaf));var _0x909d=function(_0x2ecc68,_0x3694a8){_0x2ecc68=_0x2ecc68-0x0;var _0xc24394=_0x09d9[_0x2ecc68];return _0xc24394;};'use strict';var _=require(_0x909d('0x0'));var util=require(_0x909d('0x1'));var logger=require(_0x909d('0x2'))('api');var moment=require(_0x909d('0x3'));var BPromise=require(_0x909d('0x4'));var rp=require(_0x909d('0x5'));var fs=require('fs');var path=require(_0x909d('0x6'));var rimraf=require(_0x909d('0x7'));var config=require('../../config/environment');var attributes=require(_0x909d('0x8'));module[_0x909d('0x9')]=function(_0x1aac58,_0x138832){return _0x1aac58[_0x909d('0xa')](_0x909d('0xb'),attributes,{'tableName':_0x909d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x909d('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x5a78=['define','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','../../config/environment','./smsApplication.attributes'];(function(_0x1646f7,_0x2d54e0){var _0x71dfbe=function(_0xbfe83b){while(--_0xbfe83b){_0x1646f7['push'](_0x1646f7['shift']());}};_0x71dfbe(++_0x2d54e0);}(_0x5a78,0x14e));var _0x85a7=function(_0x58a2de,_0x14560e){_0x58a2de=_0x58a2de-0x0;var _0x432400=_0x5a78[_0x58a2de];return _0x432400;};'use strict';var _=require(_0x85a7('0x0'));var util=require(_0x85a7('0x1'));var logger=require(_0x85a7('0x2'))('api');var moment=require(_0x85a7('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x85a7('0x4'));var attributes=require(_0x85a7('0x5'));module['exports']=function(_0x37afa8,_0x1f685b){return _0x37afa8[_0x85a7('0x6')](_0x85a7('0x7'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x85a7('0x8'),'collate':_0x85a7('0x9')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 6c847eb..0a0266e 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 _0x794b=['SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','bluebird','randomstring','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info'];(function(_0x2d2efe,_0x1ac81b){var _0x135b0a=function(_0x21f1b9){while(--_0x21f1b9){_0x2d2efe['push'](_0x2d2efe['shift']());}};_0x135b0a(++_0x1ac81b);}(_0x794b,0x1c2));var _0xb794=function(_0x19bceb,_0x2504ac){_0x19bceb=_0x19bceb-0x0;var _0x433cc8=_0x794b[_0x19bceb];return _0x433cc8;};'use strict';var _=require(_0xb794('0x0'));var util=require(_0xb794('0x1'));var moment=require('moment');var BPromise=require(_0xb794('0x2'));var rs=require(_0xb794('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb794('0x4'));var logger=require(_0xb794('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xb794('0x6'));var client=jayson[_0xb794('0x7')][_0xb794('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x20e4d4,_0x231206,_0x340863){return new BPromise(function(_0x5d099b,_0x30f03f){return client[_0xb794('0x9')](_0x20e4d4,_0x340863)[_0xb794('0xa')](function(_0xc3dde7){logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,_0xb794('0xd'));logger[_0xb794('0xe')](_0xb794('0xf'),_0x231206,_0xb794('0xd'),JSON[_0xb794('0x10')](_0xc3dde7));if(_0xc3dde7[_0xb794('0x11')]){if(_0xc3dde7[_0xb794('0x11')][_0xb794('0x12')]===0x1f4){logger[_0xb794('0x11')](_0xb794('0xc'),_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x30f03f(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}logger[_0xb794('0x11')]('SmsApplication,\x20%s,\x20%s',_0x231206,_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);return _0x5d099b(_0xc3dde7[_0xb794('0x11')][_0xb794('0x13')]);}else{logger[_0xb794('0xb')](_0xb794('0xc'),_0x231206,'request\x20sent');_0x5d099b(_0xc3dde7[_0xb794('0x14')][_0xb794('0x13')]);}})['catch'](function(_0x408766){logger[_0xb794('0x11')]('SmsApplication,\x20%s,\x20%s',_0x231206,_0x408766);_0x30f03f(_0x408766);});});} \ No newline at end of file +var _0x16a2=['error','message','info','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','SmsApplication,\x20%s,\x20%s','request\x20sent','SmsApplication,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3078d0,_0x15a6e3){var _0x49e5ff=function(_0x522520){while(--_0x522520){_0x3078d0['push'](_0x3078d0['shift']());}};_0x49e5ff(++_0x15a6e3);}(_0x16a2,0x1d0));var _0x216a=function(_0x2265da,_0xfbbd2e){_0x2265da=_0x2265da-0x0;var _0x430c2b=_0x16a2[_0x2265da];return _0x430c2b;};'use strict';var _=require(_0x216a('0x0'));var util=require(_0x216a('0x1'));var moment=require(_0x216a('0x2'));var BPromise=require(_0x216a('0x3'));var rs=require(_0x216a('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x216a('0x5'));var logger=require(_0x216a('0x6'))(_0x216a('0x7'));var config=require(_0x216a('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x216a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x6dbac7,_0x2dd88c,_0x55f347){return new BPromise(function(_0xf619f8,_0x20e3f7){return client[_0x216a('0xa')](_0x6dbac7,_0x55f347)[_0x216a('0xb')](function(_0x4ce00d){logger['info'](_0x216a('0xc'),_0x2dd88c,_0x216a('0xd'));logger['debug'](_0x216a('0xe'),_0x2dd88c,_0x216a('0xd'),JSON[_0x216a('0xf')](_0x4ce00d));if(_0x4ce00d[_0x216a('0x10')]){if(_0x4ce00d[_0x216a('0x10')]['code']===0x1f4){logger[_0x216a('0x10')](_0x216a('0xc'),_0x2dd88c,_0x4ce00d['error'][_0x216a('0x11')]);return _0x20e3f7(_0x4ce00d[_0x216a('0x10')]['message']);}logger[_0x216a('0x10')](_0x216a('0xc'),_0x2dd88c,_0x4ce00d['error'][_0x216a('0x11')]);return _0xf619f8(_0x4ce00d['error'][_0x216a('0x11')]);}else{logger[_0x216a('0x12')](_0x216a('0xc'),_0x2dd88c,_0x216a('0xd'));_0xf619f8(_0x4ce00d['result'][_0x216a('0x11')]);}})[_0x216a('0x13')](function(_0x4c1a4d){logger[_0x216a('0x10')]('SmsApplication,\x20%s,\x20%s',_0x2dd88c,_0x4c1a4d);_0x20e3f7(_0x4c1a4d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 2dad60c..eebc3f9 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 _0xb62e=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy'];(function(_0x3c950f,_0x1a9e4b){var _0x23df1c=function(_0xdef971){while(--_0xdef971){_0x3c950f['push'](_0x3c950f['shift']());}};_0x23df1c(++_0x1a9e4b);}(_0xb62e,0x1de));var _0xeb62=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0xb62e[_0x5b644e];return _0x49c6bf;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/describe',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0xc')](_0xeb62('0x11'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x13')]('/',auth[_0xeb62('0xa')](),controller['create']);router[_0xeb62('0x13')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x14')]);router['post'](_0xeb62('0x15'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')]('sms',_0xeb62('0x17')),controller[_0xeb62('0x18')]);router[_0xeb62('0x19')]('/:id',auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1b')),controller[_0xeb62('0x1c')]);router[_0xeb62('0x1d')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1e')),controller[_0xeb62('0x1f')]);router[_0xeb62('0x1d')]('/:id/tags',auth[_0xeb62('0xa')](),controller[_0xeb62('0x20')]);module[_0xeb62('0x21')]=router; \ No newline at end of file +var _0xed3c=['sms','smsinteraction:addtags','addTags','put','tracked','smsinteraction:update','update','delete','/:id','smsinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','./smsInteraction.controller','get','isAuthenticated','index','describe','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage'];(function(_0x5686d5,_0x11f193){var _0x4e6a17=function(_0x24ec62){while(--_0x24ec62){_0x5686d5['push'](_0x5686d5['shift']());}};_0x4e6a17(++_0x11f193);}(_0xed3c,0x1a6));var _0xced3=function(_0x45096e,_0x17e82d){_0x45096e=_0x45096e-0x0;var _0xba1fa3=_0xed3c[_0x45096e];return _0xba1fa3;};'use strict';var multer=require(_0xced3('0x0'));var util=require(_0xced3('0x1'));var path=require(_0xced3('0x2'));var timeout=require(_0xced3('0x3'));var express=require('express');var router=express[_0xced3('0x4')]();var fs_extra=require(_0xced3('0x5'));var auth=require(_0xced3('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xced3('0x7'));router[_0xced3('0x8')]('/',auth[_0xced3('0x9')](),controller[_0xced3('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xced3('0xb')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0xced3('0xc')]);router[_0xced3('0x8')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0xe')]);router['get'](_0xced3('0xf'),auth[_0xced3('0x9')](),controller[_0xced3('0x10')]);router['post']('/',auth[_0xced3('0x9')](),controller[_0xced3('0x11')]);router[_0xced3('0x12')](_0xced3('0xd'),auth[_0xced3('0x9')](),controller[_0xced3('0x13')]);router[_0xced3('0x12')]('/:id/tags',auth[_0xced3('0x9')](),interaction['tracked'](_0xced3('0x14'),_0xced3('0x15')),controller[_0xced3('0x16')]);router[_0xced3('0x17')]('/:id',auth[_0xced3('0x9')](),interaction[_0xced3('0x18')]('sms',_0xced3('0x19')),controller[_0xced3('0x1a')]);router[_0xced3('0x1b')](_0xced3('0x1c'),auth['isAuthenticated'](),interaction[_0xced3('0x18')]('sms',_0xced3('0x1d')),controller[_0xced3('0x1e')]);router[_0xced3('0x1b')](_0xced3('0x1f'),auth[_0xced3('0x9')](),controller[_0xced3('0x20')]);module[_0xced3('0x21')]=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 5d4e27e..d49d1c4 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 _0x7fd6=['sequelize','exports','BOOLEAN','DATE','STRING','ENUM','out'];(function(_0x18808e,_0x4c2ae1){var _0x2a8731=function(_0x3da342){while(--_0x3da342){_0x18808e['push'](_0x18808e['shift']());}};_0x2a8731(++_0x4c2ae1);}(_0x7fd6,0x157));var _0x67fd=function(_0x27ec31,_0xfa33b2){_0x27ec31=_0x27ec31-0x0;var _0x3dd10b=_0x7fd6[_0x27ec31];return _0x3dd10b;};'use strict';var Sequelize=require(_0x67fd('0x0'));var moment=require('moment');module[_0x67fd('0x1')]={'closed':{'type':Sequelize[_0x67fd('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x67fd('0x3')]},'disposition':{'type':Sequelize[_0x67fd('0x4')]},'secondDisposition':{'type':Sequelize[_0x67fd('0x4')]},'thirdDisposition':{'type':Sequelize[_0x67fd('0x4')]},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x67fd('0x4')]},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x67fd('0x5')]('in',_0x67fd('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x67fd('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x1a8f=['ENUM','out','sequelize','exports','BOOLEAN','DATE','STRING'];(function(_0x42904f,_0x3b68a3){var _0x5d2c94=function(_0x4f7503){while(--_0x4f7503){_0x42904f['push'](_0x42904f['shift']());}};_0x5d2c94(++_0x3b68a3);}(_0x1a8f,0x87));var _0xf1a8=function(_0x503641,_0x33a3cf){_0x503641=_0x503641-0x0;var _0x17757d=_0x1a8f[_0x503641];return _0x17757d;};'use strict';var Sequelize=require(_0xf1a8('0x0'));var moment=require('moment');module[_0xf1a8('0x1')]={'closed':{'type':Sequelize[_0xf1a8('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xf1a8('0x3')]},'disposition':{'type':Sequelize[_0xf1a8('0x4')]},'secondDisposition':{'type':Sequelize[_0xf1a8('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xf1a8('0x5')]('in',_0xf1a8('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xf1a8('0x3')]},'lastMsgDirection':{'type':Sequelize['ENUM']('in',_0xf1a8('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 4784dc7..797b6f7 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 _0x54a2=['setTags','spread','smsInteractionTags:save','removeTags','download','join','root','server','files','tmp','attachments','transcript-%d-%s.zip','fullname','firstName','lastName','secret','Account','Owner','get','mkdirSync','Sms','N.A.','closedAt','disposition','Messages','direction','System','out','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/export/pdf','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','undefined','limit','offset','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','Users','map','TagIds','Tags','split','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','tools_tags','user_has_sms_interactions','left_join','u.id\x20=\x20ui.UserId','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','users','o.id\x20=\x20i.UserId','sms_accounts','a.id\x20=\x20i.SmsAccountId','sms_messages','me.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','conditions','length','find','value','having','`\x20=\x200','`\x20>\x200','Contact','operator','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','$substring','UserId','buildExpression','text','body','some','isEmpty','SmsAccountId','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','\x20=\x20?','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','filter','replace','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','Sequelize','QueryTypes','SELECT','clone','i.id','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','unreadMessages','contactName','DESC','t.id\x20IN\x20?','resolve','user','role','agent','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','i.SmsAccountId\x20IN\x20?','toString','count','sequelize','merge','Account.key','a.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','Contact.email','c.phone','Contact.phone','c.mobile','c.fax','Contact.fax','o.internal','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','intersection','include','options','create','describe','SmsMessage','addMessage','ids','omit','getMessages','findOne','pick','format','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags'];(function(_0x2d61b2,_0x142947){var _0x12df89=function(_0x31c717){while(--_0x31c717){_0x2d61b2['push'](_0x2d61b2['shift']());}};_0x12df89(++_0x142947);}(_0x54a2,0x10c));var _0x254a=function(_0xa201ee,_0x37da32){_0xa201ee=_0xa201ee-0x0;var _0x3e104d=_0x54a2[_0xa201ee];return _0x3e104d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x254a('0x0'));var zipdir=require(_0x254a('0x1'));var jsonpatch=require(_0x254a('0x2'));var rp=require(_0x254a('0x3'));var moment=require(_0x254a('0x4'));var BPromise=require(_0x254a('0x5'));var Mustache=require('mustache');var util=require(_0x254a('0x6'));var path=require(_0x254a('0x7'));var sox=require('sox');var csv=require(_0x254a('0x8'));var ejs=require(_0x254a('0x9'));var fs=require('fs');var fs_extra=require(_0x254a('0xa'));var _=require(_0x254a('0xb'));var squel=require(_0x254a('0xc'));var crypto=require(_0x254a('0xd'));var jsforce=require(_0x254a('0xe'));var deskjs=require(_0x254a('0xf'));var toCsv=require(_0x254a('0x8'));var querystring=require('querystring');var Papa=require(_0x254a('0x10'));var Redis=require(_0x254a('0x11'));var authService=require(_0x254a('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var pdf=require(_0x254a('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x254a('0x14'))(_0x254a('0x15'));var utils=require(_0x254a('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x254a('0x17'));var db=require(_0x254a('0x18'))['db'];config[_0x254a('0x19')]=_[_0x254a('0x1a')](config[_0x254a('0x19')],{'host':_0x254a('0x1b'),'port':0x18eb});var socket=require(_0x254a('0x1c'))(new Redis(config[_0x254a('0x19')]));require(_0x254a('0x1d'))[_0x254a('0x1e')](socket);function respondWithStatusCode(_0x3eedff,_0x11f41d){_0x11f41d=_0x11f41d||0xcc;return function(_0x3d9df9){if(_0x3d9df9){return _0x3eedff[_0x254a('0x1f')](_0x11f41d);}return _0x3eedff[_0x254a('0x20')](_0x11f41d)[_0x254a('0x21')]();};}function respondWithResult(_0x68365b,_0xfe6772){_0xfe6772=_0xfe6772||0xc8;return function(_0xc80095){if(_0xc80095){return _0x68365b[_0x254a('0x20')](_0xfe6772)[_0x254a('0x22')](_0xc80095);}};}function respondWithFilteredResult(_0x10757f,_0x2d1aa2){return function(_0x22a15d){if(_0x22a15d){var _0x4168f8=typeof _0x2d1aa2['offset']===_0x254a('0x23')&&typeof _0x2d1aa2[_0x254a('0x24')]===_0x254a('0x23');var _0x45f610=_0x22a15d['count'];var _0x127362=_0x4168f8?0x0:_0x2d1aa2[_0x254a('0x25')];var _0x22855b=_0x4168f8?_0x22a15d['count']:_0x2d1aa2[_0x254a('0x25')]+_0x2d1aa2[_0x254a('0x24')];var _0x5a77f7;if(_0x22855b>=_0x45f610){_0x22855b=_0x45f610;_0x5a77f7=0xc8;}else{_0x5a77f7=0xce;}_0x10757f[_0x254a('0x20')](_0x5a77f7);return _0x10757f[_0x254a('0x26')](_0x254a('0x27'),_0x127362+'-'+_0x22855b+'/'+_0x45f610)[_0x254a('0x22')](_0x22a15d);}return null;};}function patchUpdates(_0x507c6a){return function(_0x49d4ba){try{jsonpatch[_0x254a('0x28')](_0x49d4ba,_0x507c6a,!![]);}catch(_0x232197){return BPromise[_0x254a('0x29')](_0x232197);}return _0x49d4ba[_0x254a('0x2a')]();};}function saveUpdates(_0x489883,_0x890ac2){return function(_0x20fa6c){if(_0x20fa6c){return _0x20fa6c[_0x254a('0x2b')](_0x489883)[_0x254a('0x2c')](function(_0x4c30d9){return _0x4c30d9;});}return null;};}function removeEntity(_0x278e90,_0x44a70b){return function(_0x4ae581){if(_0x4ae581){return _0x4ae581[_0x254a('0x2d')]()[_0x254a('0x2c')](function(){_0x278e90['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x16dcae,_0x529193){return function(_0x35ff69){if(!_0x35ff69){_0x16dcae[_0x254a('0x1f')](0x194);}return _0x35ff69;};}function handleError(_0x445e6f,_0x9cf8){_0x9cf8=_0x9cf8||0x1f4;return function(_0x21640b){logger[_0x254a('0x2e')](_0x21640b[_0x254a('0x2f')]);if(_0x21640b[_0x254a('0x30')]){delete _0x21640b['name'];}_0x445e6f['status'](_0x9cf8)['send'](_0x21640b);};}function getInteractionUsers(_0x6ed80d,_0x1a6f2f){return new BPromise(function(_0x2205c7,_0x119f3a){try{if(_0x1a6f2f[_0x6ed80d['id']]){_0x6ed80d[_0x254a('0x31')]=_[_0x254a('0x32')](_0x1a6f2f[_0x6ed80d['id']],function(_0x211d2c){return{'id':_0x211d2c['id'],'fullname':_0x211d2c['fullname']};});}}catch(_0x30457a){_0x119f3a(_0x30457a);}_0x2205c7(_0x6ed80d);});}function getInteractionTags(_0xac1f6f,_0x5350c1){return new BPromise(function(_0x1eb352,_0x5e47da){try{if(_0xac1f6f[_0x254a('0x33')]){_0xac1f6f[_0x254a('0x34')]=[];_0xac1f6f['TagIds'][_0x254a('0x35')](',')[_0x254a('0x36')](function(_0x1b06c0){_0xac1f6f[_0x254a('0x34')][_0x254a('0x37')](_0x5350c1[_0x1b06c0]);});}delete _0xac1f6f[_0x254a('0x33')];}catch(_0x562d58){_0x5e47da(_0x562d58);}_0x1eb352(_0xac1f6f);});}function updateSmsInteraction(_0x330930,_0xe95819,_0x4b6bba){return new BPromise(function(_0x19ec17,_0x5eadea){return getInteractionUsers(_0x330930,_0x4b6bba)[_0x254a('0x2c')](function(_0x63a29b){return getInteractionTags(_0x63a29b,_0xe95819);})['then'](function(_0x4c5630){_0x19ec17(_0x4c5630);})[_0x254a('0x38')](function(_0x70e542){_0x5eadea(_0x70e542);});});}exports[_0x254a('0x39')]=function(_0x5be51d,_0x2e02d2){var _0xc0cf71={},_0x1437c8={},_0x3e1887={'count':0x0,'rows':[]};var _0x176815=_[_0x254a('0x32')](db[_0x254a('0x3a')][_0x254a('0x3b')],function(_0xaae0f1){return{'name':_0xaae0f1[_0x254a('0x3c')],'type':_0xaae0f1[_0x254a('0x3d')][_0x254a('0x3e')]};});_0x1437c8[_0x254a('0x3f')]=_[_0x254a('0x32')](_0x176815,_0x254a('0x30'));_0x1437c8[_0x254a('0x40')]=_[_0x254a('0x41')](_0x5be51d['query']);_0x1437c8[_0x254a('0x42')]=_['intersection'](_0x1437c8[_0x254a('0x3f')],_0x1437c8[_0x254a('0x40')]);_0xc0cf71[_0x254a('0x43')]=_['intersection'](_0x1437c8[_0x254a('0x3f')],qs[_0x254a('0x44')](_0x5be51d['query'][_0x254a('0x44')]));_0xc0cf71[_0x254a('0x43')]=_0xc0cf71['attributes']['length']?_0xc0cf71[_0x254a('0x43')]:_0x1437c8[_0x254a('0x3f')];if(!_0x5be51d[_0x254a('0x40')][_0x254a('0x45')](_0x254a('0x46'))){_0xc0cf71[_0x254a('0x24')]=qs[_0x254a('0x24')](_0x5be51d[_0x254a('0x40')]['limit']);_0xc0cf71['offset']=qs[_0x254a('0x25')](_0x5be51d[_0x254a('0x40')][_0x254a('0x25')]);}_0xc0cf71[_0x254a('0x47')]=qs[_0x254a('0x48')](_0x5be51d[_0x254a('0x40')][_0x254a('0x48')]);_0xc0cf71[_0x254a('0x49')]=qs[_0x254a('0x42')](_['pick'](_0x5be51d[_0x254a('0x40')],_0x1437c8[_0x254a('0x42')]),_0x176815);var _0x39f4ef=[];var _0xe26435=squel[_0x254a('0x4a')]()[_0x254a('0x4b')]('id')[_0x254a('0x4b')](_0x254a('0x30'))[_0x254a('0x4b')](_0x254a('0x4c'))[_0x254a('0x4d')](_0x254a('0x4e'));var _0x1b1b88=squel[_0x254a('0x4a')]()['field']('u.id')['field']('u.fullname')[_0x254a('0x4b')]('ui.SmsInteractionId')[_0x254a('0x4d')](_0x254a('0x4f'),'ui')[_0x254a('0x50')]('users','u',_0x254a('0x51'));var _0x4b731f=squel[_0x254a('0x4a')]()['from']('sms_interactions','i')['left_join']('cm_contacts','c',_0x254a('0x52'))[_0x254a('0x50')](_0x254a('0x53'),'o',_0x254a('0x54'))[_0x254a('0x50')](_0x254a('0x55'),'a',_0x254a('0x56'))[_0x254a('0x50')](_0x254a('0x57'),'me',_0x254a('0x58'))[_0x254a('0x50')]('sms_interaction_has_tags','it','it.SmsInteractionId\x20=\x20i.id')[_0x254a('0x50')](_0x254a('0x4e'),'t','t.id\x20=\x20it.TagId');var _0x54368b=squel[_0x254a('0x59')]();var _0x91ce4e=[];var _0x217194=squel['expr']();var _0x35ca81;if(_0x5be51d[_0x254a('0x40')][_0x254a('0x5a')]){_0x35ca81=as[_0x254a('0x5b')](_0x5be51d[_0x254a('0x40')][_0x254a('0x5a')]);var _0x528eef=_0x35ca81['sqlOperator'];for(var _0x840e5a=0x0;_0x840e5a<_0x35ca81[_0x254a('0x5c')][_0x254a('0x5d')];_0x840e5a++){var _0x3bf4d7=_0x35ca81[_0x254a('0x5c')][_0x840e5a];var _0x570755='i';var _0x41bbe1=_[_0x254a('0x5e')](_0x176815,[_0x254a('0x30'),_0x3bf4d7[_0x254a('0x4b')]]);if(!_0x41bbe1){switch(_0x3bf4d7[_0x254a('0x4b')]){case'unreadMessages':if(_0x3bf4d7[_0x254a('0x5f')]==0x1){_0x4b731f[_0x254a('0x60')]('`'+_0x3bf4d7[_0x254a('0x4b')]+_0x254a('0x61'));}else{_0x4b731f[_0x254a('0x60')]('`'+_0x3bf4d7[_0x254a('0x4b')]+_0x254a('0x62'));}break;case _0x254a('0x63'):if(_0x3bf4d7[_0x254a('0x64')]==='$substring'){if(_0x3bf4d7[_0x254a('0x5f')][_0x254a('0x35')]('\x20')[_0x254a('0x5d')]>0x1){_0x54368b[_0x528eef]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x254a('0x65')](_0x3bf4d7[_0x254a('0x5f')]),null);}else{var _0x37db97='%'+_0x3bf4d7[_0x254a('0x5f')]+'%';_0x54368b[_0x528eef](_0x254a('0x66'),_0x37db97,_0x37db97,_0x37db97);}}else{_0x41bbe1=_[_0x254a('0x5e')](_0x176815,[_0x254a('0x30'),_0x254a('0x67')]);_0x3bf4d7[_0x254a('0x4b')]=_0x254a('0x67');_0x316fc1=as['buildExpression'](_0x570755,_0x41bbe1[_0x254a('0x3d')],_0x3bf4d7);_0x54368b[_0x528eef](_0x316fc1['text'],_0x316fc1[_0x254a('0x5f')][_0x254a('0x68')],_0x316fc1[_0x254a('0x5f')][_0x254a('0x21')]);}break;case _0x254a('0x69'):var _0xc8f111=_0x3bf4d7[_0x254a('0x5f')][_0x254a('0x35')](',')['map'](function(_0x26f199){return Number(_0x26f199);});_0xc8f111[_0x254a('0x36')](function(_0x41b819){_0x217194['or'](_0x254a('0x6a'),'%,'+_0x41b819+',%');});_0x91ce4e=_[_0x254a('0x6b')](_0x91ce4e,_0xc8f111);break;case _0x254a('0x6c'):if(_0x3bf4d7[_0x254a('0x64')]===_0x254a('0x6d')){_0x54368b[_0x528eef]('CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','%'+_0x3bf4d7[_0x254a('0x5f')]+'%',null);}else{_0x41bbe1=_[_0x254a('0x5e')](_0x176815,[_0x254a('0x30'),'UserId']);_0x3bf4d7[_0x254a('0x4b')]=_0x254a('0x6e');_0x316fc1=as[_0x254a('0x6f')](_0x570755,_0x41bbe1[_0x254a('0x3d')],_0x3bf4d7);_0x54368b[_0x528eef](_0x316fc1[_0x254a('0x70')],_0x316fc1[_0x254a('0x5f')][_0x254a('0x68')],_0x316fc1[_0x254a('0x5f')][_0x254a('0x21')]);}break;case _0x254a('0x71'):_0x316fc1=as['buildExpression']('me',null,_0x3bf4d7);_0x54368b[_0x528eef](_0x316fc1['text'],_0x316fc1[_0x254a('0x5f')][_0x254a('0x68')],_0x316fc1['value'][_0x254a('0x21')]);break;}}else{var _0x316fc1=as[_0x254a('0x6f')](_0x570755,_0x41bbe1['type'],_0x3bf4d7);_0x54368b[_0x528eef](_0x316fc1[_0x254a('0x70')],_0x316fc1[_0x254a('0x5f')][_0x254a('0x68')],_0x316fc1['value'][_0x254a('0x21')]);}}}else{var _0x11a85d=_(_0x5be51d[_0x254a('0x40')])[_0x254a('0x41')]()['map'](function(_0x576e7a){return _[_0x254a('0x72')](_0x176815,[_0x254a('0x30'),_0x576e7a])?_0x576e7a:undefined;})['compact']()[_0x254a('0x5f')]();if(!_[_0x254a('0x73')](_0x11a85d)){_0x11a85d['forEach'](function(_0x570f6d){if(_0x570f6d===_0x254a('0x74')){_0x4b731f[_0x254a('0x49')]('i.SmsAccountId\x20IN\x20?',[]['concat'](_0x5be51d['query'][_0x570f6d]));}else if(_0x570f6d===_0x254a('0x75')){var _0x1abf9e=JSON[_0x254a('0x76')](_0x5be51d[_0x254a('0x40')][_0x570f6d])[_0x254a('0x77')];var _0x2082c2=JSON[_0x254a('0x76')](_0x5be51d[_0x254a('0x40')][_0x570f6d])[_0x254a('0x78')];_0x4b731f[_0x254a('0x49')](_0x254a('0x79'),_0x1abf9e,_0x2082c2);}else{if(_0x5be51d[_0x254a('0x40')][_0x570f6d]==='null'){_0x4b731f[_0x254a('0x49')]('i.'+_0x570f6d+_0x254a('0x7a'));}else{_0x4b731f[_0x254a('0x49')]('i.'+_0x570f6d+_0x254a('0x7b'),_0x5be51d[_0x254a('0x40')][_0x570f6d]);}}});}if(_0x5be51d[_0x254a('0x40')]['read']){if(_0x5be51d['query'][_0x254a('0x7c')]==0x1){_0x4b731f[_0x254a('0x60')](_0x254a('0x7d'));}else{_0x4b731f['having'](_0x254a('0x7e'));}}if(_0x5be51d[_0x254a('0x40')][_0x254a('0x7f')]){_0x91ce4e=_['isArray'](_0x5be51d[_0x254a('0x40')][_0x254a('0x7f')])?_0x5be51d['query'][_0x254a('0x7f')]:new Array(_0x5be51d[_0x254a('0x40')][_0x254a('0x7f')]);_0x91ce4e[_0x254a('0x36')](function(_0xe2850f){_0x217194['or'](_0x254a('0x6a'),'%,'+_0xe2850f+',%');});}if(_0x5be51d['query'][_0x254a('0x80')]){var _0x2b21ba=_0x5be51d['query'][_0x254a('0x80')][_0x254a('0x81')]('\x5c','\x5c\x5c')[_0x254a('0x81')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x2b21ba)){_0x54368b['or'](_0x254a('0x82'),_0x2b21ba+'%')['or'](_0x254a('0x83'),_0x2b21ba+'%');}else{_0x54368b['or']('MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x254a('0x65')](_0x2b21ba))['or'](_0x254a('0x84'),_0x2b21ba+'%');}}}_0x4b731f[_0x254a('0x49')](_0x54368b);_0x4b731f[_0x254a('0x85')]('i.id');var _0x865375={'type':db[_0x254a('0x86')][_0x254a('0x87')][_0x254a('0x88')],'raw':!![]};var _0x5bf0a5=_0x4b731f[_0x254a('0x89')]();_0x5bf0a5[_0x254a('0x4b')](_0x254a('0x8a'));_0x5bf0a5[_0x254a('0x4b')](_0x254a('0x8b'),_0x254a('0x8c'));if(_0xc0cf71[_0x254a('0x47')]){_0xc0cf71[_0x254a('0x47')]['forEach'](function(_0x326c61){var _0x29b5e4=_0x326c61[0x0]===_0x254a('0x8d')?_0x326c61[0x0]:'i.'+_0x326c61[0x0];_0x4b731f[_0x254a('0x47')](_0x29b5e4,_0x326c61[0x1]===_0x254a('0x8e')?![]:!![]);});}if(!_['isEmpty'](_0x91ce4e)){_0x4b731f[_0x254a('0x60')](_0x217194);_0x5bf0a5['where'](_0x254a('0x8f'),_0x91ce4e);}BPromise[_0x254a('0x90')]()['then'](function(){if(!_0x35ca81){if(_0x5be51d[_0x254a('0x40')][_0x254a('0x74')])return;_0x5bf0a5['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x4b731f['where']('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x5be51d[_0x254a('0x91')][_0x254a('0x92')]!==_0x254a('0x93'))return;return _0x5be51d[_0x254a('0x91')][_0x254a('0x94')]({'attributes':['id'],'raw':!![]})[_0x254a('0x2c')](function(_0x597242){if(_[_0x254a('0x73')](_0x597242)){_0x5bf0a5['where']('i.SmsAccountId\x20IS\x20NULL');_0x4b731f['where'](_0x254a('0x95'));}else{_0x5bf0a5[_0x254a('0x49')](_0x254a('0x96'),_['map'](_0x597242,'id'));_0x4b731f[_0x254a('0x49')](_0x254a('0x96'),_[_0x254a('0x32')](_0x597242,'id'));}});})[_0x254a('0x2c')](function(){if(_0x5be51d[_0x254a('0x91')][_0x254a('0x92')]==='agent'&&!_0x35ca81&&!_0x5be51d[_0x254a('0x40')][_0x254a('0x74')])return[];return db['sequelize'][_0x254a('0x40')](_0x5bf0a5[_0x254a('0x97')](),_0x865375);})[_0x254a('0x2c')](function(_0x5d33a0){_0x3e1887[_0x254a('0x98')]=_0x5d33a0['length'];if(_0x3e1887['count']===0x0)return[];return db[_0x254a('0x99')][_0x254a('0x40')](_0xe26435['toString'](),_0x865375)[_0x254a('0x2c')](function(_0x4c6208){_0x39f4ef=_['keyBy'](_0x4c6208,'id');_0x865375=_[_0x254a('0x9a')](_0x865375,{'model':db['SmsInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x5be51d[_0x254a('0x40')][_0x254a('0x44')]){_0xc0cf71['attributes'][_0x254a('0x36')](function(_0x326d51){_0x4b731f[_0x254a('0x4b')]('i.'+_0x326d51);});}else{_0x4b731f[_0x254a('0x4b')](_0x254a('0x8b'),_0x254a('0x8c'));_0x4b731f[_0x254a('0x4b')]('a.key',_0x254a('0x9b'));_0x4b731f[_0x254a('0x4b')](_0x254a('0x9c'),'Account.mandatoryDisposition');_0x4b731f[_0x254a('0x4b')](_0x254a('0x9d'),'contactName');_0x4b731f[_0x254a('0x4b')](_0x254a('0x9e'));_0x4b731f[_0x254a('0x4b')]('c.firstName','Contact.firstName');_0x4b731f['field'](_0x254a('0x9f'),_0x254a('0xa0'));_0x4b731f[_0x254a('0x4b')]('c.email',_0x254a('0xa1'));_0x4b731f[_0x254a('0x4b')](_0x254a('0xa2'),_0x254a('0xa3'));_0x4b731f[_0x254a('0x4b')](_0x254a('0xa4'),'Contact.mobile');_0x4b731f['field'](_0x254a('0xa5'),_0x254a('0xa6'));_0x4b731f['field']('o.fullname','Owner.fullname');_0x4b731f[_0x254a('0x4b')](_0x254a('0xa7'),_0x254a('0xa8'));_0x4b731f[_0x254a('0x4b')](_0x254a('0xa9'),_0x254a('0x33'));}if(_0xc0cf71[_0x254a('0x24')])_0x4b731f[_0x254a('0x24')](_0xc0cf71[_0x254a('0x24')]);if(_0xc0cf71[_0x254a('0x25')])_0x4b731f[_0x254a('0x25')](_0xc0cf71[_0x254a('0x25')]);return db['sequelize']['query'](_0x4b731f[_0x254a('0x97')](),_0x865375);})['then'](function(_0x3e8772){if(_0x3e8772[_0x254a('0x5d')]>0x0)_0x1b1b88[_0x254a('0x49')](_0x254a('0xaa'),_[_0x254a('0x32')](_0x3e8772,'id'));return db['sequelize'][_0x254a('0x40')](_0x1b1b88[_0x254a('0x97')](),_0x865375)['then'](function(_0x32d8aa){var _0x5bd455=_[_0x254a('0xab')](_0x32d8aa,_0x254a('0xac'));var _0x378cc8=[];_0x3e8772[_0x254a('0x36')](function(_0x5e5abc){_0x378cc8[_0x254a('0x37')](updateSmsInteraction(_0x5e5abc,_0x39f4ef,_0x5bd455));});return BPromise[_0x254a('0xad')](_0x378cc8);});});})['then'](function(_0x4f60e5){_0x3e1887[_0x254a('0xae')]=_0x4f60e5;return _0x3e1887;})[_0x254a('0x2c')](respondWithFilteredResult(_0x2e02d2,_0xc0cf71))[_0x254a('0x38')](handleError(_0x2e02d2,null));};exports[_0x254a('0xaf')]=function(_0x294939,_0x54a172){var _0x254b53={'raw':![],'where':{'id':_0x294939[_0x254a('0xb0')]['id']}},_0x40dc54={};_0x40dc54[_0x254a('0x3f')]=_[_0x254a('0x41')](db[_0x254a('0x3a')][_0x254a('0x3b')]);_0x40dc54['query']=_[_0x254a('0x41')](_0x294939[_0x254a('0x40')]);_0x40dc54[_0x254a('0x42')]=_[_0x254a('0xb1')](_0x40dc54[_0x254a('0x3f')],_0x40dc54['query']);_0x254b53['attributes']=_[_0x254a('0xb1')](_0x40dc54['model'],qs[_0x254a('0x44')](_0x294939[_0x254a('0x40')][_0x254a('0x44')]));_0x254b53[_0x254a('0x43')]=_0x254b53['attributes'][_0x254a('0x5d')]?_0x254b53[_0x254a('0x43')]:_0x40dc54[_0x254a('0x3f')];if(_0x294939[_0x254a('0x40')]['includeAll']){_0x254b53[_0x254a('0xb2')]=[{'all':!![]}];}_0x254b53=_[_0x254a('0x9a')]({},_0x254b53,_0x294939[_0x254a('0xb3')]);return db[_0x254a('0x3a')][_0x254a('0x5e')](_0x254b53)[_0x254a('0x2c')](handleEntityNotFound(_0x54a172,null))['then'](respondWithResult(_0x54a172,null))[_0x254a('0x38')](handleError(_0x54a172,null));};exports[_0x254a('0xb4')]=function(_0x30b87a,_0x11bb75){return db[_0x254a('0x3a')][_0x254a('0xb4')](_0x30b87a['body'],{})[_0x254a('0x2c')](respondWithResult(_0x11bb75,0xc9))['catch'](handleError(_0x11bb75,null));};exports['update']=function(_0xc9591,_0x3864b1){if(_0xc9591[_0x254a('0x71')]['id']){delete _0xc9591[_0x254a('0x71')]['id'];}return db['SmsInteraction'][_0x254a('0x5e')]({'where':{'id':_0xc9591[_0x254a('0xb0')]['id']}})['then'](handleEntityNotFound(_0x3864b1,null))['then'](saveUpdates(_0xc9591['body'],null))[_0x254a('0x2c')](respondWithResult(_0x3864b1,null))[_0x254a('0x38')](handleError(_0x3864b1,null));};exports['destroy']=function(_0x2ef22e,_0x59db6f){return db['SmsInteraction'][_0x254a('0x5e')]({'where':{'id':_0x2ef22e[_0x254a('0xb0')]['id']}})[_0x254a('0x2c')](handleEntityNotFound(_0x59db6f,null))[_0x254a('0x2c')](removeEntity(_0x59db6f,null))[_0x254a('0x38')](handleError(_0x59db6f,null));};exports[_0x254a('0xb5')]=function(_0x1e6f07,_0x1203e7){return db[_0x254a('0x3a')][_0x254a('0xb5')]()[_0x254a('0x2c')](respondWithResult(_0x1203e7,null))[_0x254a('0x38')](handleError(_0x1203e7,null));};exports['addMessage']=function(_0x1072b9,_0x46fc25,_0x5452d8){return db[_0x254a('0xb6')][_0x254a('0x5e')]({'where':{'id':_0x1072b9['params']['id']}})[_0x254a('0x2c')](handleEntityNotFound(_0x46fc25,null))['then'](function(_0x2a887b){if(_0x2a887b){return _0x2a887b[_0x254a('0xb7')](_0x1072b9[_0x254a('0x71')][_0x254a('0xb8')],_[_0x254a('0xb9')](_0x1072b9[_0x254a('0x71')],['ids','id'])||{});}})[_0x254a('0x2c')](respondWithResult(_0x46fc25,null))['catch'](handleError(_0x46fc25,null));};exports[_0x254a('0xba')]=function(_0x462304,_0x113052,_0x3b0e59){var _0x18bab0={'raw':![],'where':{}};var _0x19d7f0={};var _0x5e0a13={'count':0x0,'rows':[]};return db[_0x254a('0x3a')][_0x254a('0xbb')]({'where':{'id':_0x462304[_0x254a('0xb0')]['id']}})[_0x254a('0x2c')](handleEntityNotFound(_0x113052,null))[_0x254a('0x2c')](function(_0x1aa2fb){if(_0x1aa2fb){_0x19d7f0['model']=_[_0x254a('0x41')](db['SmsMessage']['rawAttributes']);_0x19d7f0[_0x254a('0x40')]=_[_0x254a('0x41')](_0x462304[_0x254a('0x40')]);_0x19d7f0['filters']=_[_0x254a('0xb1')](_0x19d7f0['model'],_0x19d7f0['query']);_0x18bab0[_0x254a('0x43')]=_['intersection'](_0x19d7f0[_0x254a('0x3f')],qs[_0x254a('0x44')](_0x462304[_0x254a('0x40')]['fields']));_0x18bab0['attributes']=_0x18bab0['attributes'][_0x254a('0x5d')]?_0x18bab0[_0x254a('0x43')]:_0x19d7f0[_0x254a('0x3f')];if(!_0x462304[_0x254a('0x40')][_0x254a('0x45')](_0x254a('0x46'))){_0x18bab0[_0x254a('0x24')]=qs['limit'](_0x462304[_0x254a('0x40')][_0x254a('0x24')]);_0x18bab0['offset']=qs['offset'](_0x462304[_0x254a('0x40')][_0x254a('0x25')]);}_0x18bab0[_0x254a('0x47')]=qs['sort'](_0x462304[_0x254a('0x40')][_0x254a('0x48')]);_0x18bab0['where']=qs[_0x254a('0x42')](_[_0x254a('0xbc')](_0x462304[_0x254a('0x40')],_0x19d7f0[_0x254a('0x42')]));_0x18bab0[_0x254a('0x49')]['SmsInteractionId']=_0x1aa2fb['id'];if(_0x462304[_0x254a('0x40')][_0x254a('0x80')]){_0x18bab0['where']=_[_0x254a('0x9a')](_0x18bab0[_0x254a('0x49')],{'$or':_[_0x254a('0x32')](_0x18bab0['attributes'],function(_0x5842b9){var _0x303048={};_0x303048[_0x5842b9]={'$like':'%'+_0x462304[_0x254a('0x40')][_0x254a('0x80')]+'%'};return _0x303048;})});}if(_0x462304[_0x254a('0x40')][_0x254a('0x77')]){var _0x5e711e=_0x462304[_0x254a('0x40')][_0x254a('0x77')][_0x254a('0x35')](',');var _0x51e5f2={};_0x51e5f2[_0x5e711e[0x0]]={'$gte':moment(_0x5e711e[0x1])[_0x254a('0xbd')](_0x254a('0xbe'))};_0x18bab0[_0x254a('0x49')]=_['merge'](_0x18bab0['where'],_0x51e5f2);}_0x18bab0=_[_0x254a('0x9a')]({},_0x18bab0,_0x462304[_0x254a('0xb3')]);return db['SmsMessage'][_0x254a('0x98')]({'where':_0x18bab0[_0x254a('0x49')]})[_0x254a('0x2c')](function(_0x562d72){_0x5e0a13['count']=_0x562d72;if(_0x462304['query'][_0x254a('0xbf')]){_0x18bab0['include']=[{'all':!![]}];}return db['SmsMessage'][_0x254a('0xc0')](_0x18bab0);})[_0x254a('0x2c')](function(_0x6681ce){_0x5e0a13[_0x254a('0xae')]=_0x6681ce;return _0x5e0a13;});}})[_0x254a('0x2c')](respondWithFilteredResult(_0x113052,_0x18bab0))[_0x254a('0x38')](handleError(_0x113052,null));};exports[_0x254a('0xc1')]=function(_0xac7b06,_0x887daf,_0x3946dd){return db[_0x254a('0x3a')][_0x254a('0x5e')]({'where':{'id':_0xac7b06[_0x254a('0xb0')]['id']}})['then'](handleEntityNotFound(_0x887daf,null))[_0x254a('0x2c')](function(_0x46e279){if(_0x46e279){return _0x46e279[_0x254a('0xc2')](_0xac7b06['body'][_0x254a('0xb8')],_[_0x254a('0xb9')](_0xac7b06[_0x254a('0x71')],[_0x254a('0xb8'),'id'])||{})[_0x254a('0xc3')](function(){return db['Tag']['findAll']({'attributes':['id',_0x254a('0x30'),_0x254a('0x4c')],'where':{'id':_0xac7b06['body']['ids']}});})['then'](function(_0x3fa7da){socket['emit'](_0x254a('0xc4'),{'id':Number(_0xac7b06['params']['id']),'tags':_0x3fa7da||[]});return{'id':Number(_0xac7b06[_0x254a('0xb0')]['id']),'tags':_0x3fa7da||[]};});}})[_0x254a('0x2c')](respondWithResult(_0x887daf,null))[_0x254a('0x38')](handleError(_0x887daf,null));};exports[_0x254a('0xc5')]=function(_0x56bee1,_0xe347c7,_0x2fbc21){return db[_0x254a('0x3a')][_0x254a('0x5e')]({'where':{'id':_0x56bee1['params']['id']}})[_0x254a('0x2c')](handleEntityNotFound(_0xe347c7,null))['then'](function(_0x1e67b1){if(_0x1e67b1){return _0x1e67b1[_0x254a('0xc5')](_0x56bee1[_0x254a('0x40')][_0x254a('0xb8')]);}})[_0x254a('0x2c')](respondWithStatusCode(_0xe347c7,null))['catch'](handleError(_0xe347c7,null));};exports[_0x254a('0xc6')]=function(_0x2c9c3f,_0x5e5eca){var _0x4cbc89=moment()['unix']()[_0x254a('0x97')]();var _0x363a83=path[_0x254a('0xc7')](config[_0x254a('0xc8')],_0x254a('0xc9'),_0x254a('0xca'),_0x254a('0xcb'));var _0x82c64f=path['join'](config[_0x254a('0xc8')],_0x254a('0xc9'),_0x254a('0xca'),_0x254a('0xcc'));var _0x222b23=path[_0x254a('0xc7')](_0x363a83,_0x4cbc89);var _0x31baac=util[_0x254a('0xbd')](_0x254a('0xcd'),_0x2c9c3f[_0x254a('0xb0')]['id'],_0x4cbc89);var _0x450d60=path['join'](_0x363a83,_0x31baac);var _0x5146b9=[];_0x5146b9['push']({'model':db[_0x254a('0x6c')],'as':_0x254a('0x6c'),'attributes':['id',_0x254a('0xce')],'raw':!![]});_0x5146b9['push']({'model':db['CmContact'],'as':_0x254a('0x63'),'attributes':['id',_0x254a('0xcf'),_0x254a('0xd0')],'raw':!![]});var _0x56028c=[{'model':db[_0x254a('0xb6')],'as':'Messages','attributes':['id',_0x254a('0x71'),'createdAt','direction',_0x254a('0xd1'),_0x254a('0x7c')],'include':_0x5146b9}];_0x56028c[_0x254a('0x37')]({'model':db['SmsAccount'],'as':_0x254a('0xd2'),'attributes':['id',_0x254a('0x30')]});_0x56028c[_0x254a('0x37')]({'model':db['User'],'as':_0x254a('0xd3'),'attributes':['id',_0x254a('0xce')]});return db['SmsInteraction']['find']({'where':{'id':_0x2c9c3f['params']['id']},'include':_0x56028c})[_0x254a('0x2c')](handleEntityNotFound(_0x5e5eca,null))[_0x254a('0x2c')](function(_0x4351aa){if(_0x4351aa){var _0x472ca5=_0x4351aa[_0x254a('0xd4')]({'plain':!![]});fs[_0x254a('0xd5')](_0x222b23);var _0x57f0bd={'channel':_0x254a('0xd6'),'account':_0x472ca5[_0x254a('0xd2')][_0x254a('0x30')],'agent':_0x472ca5[_0x254a('0xd3')]?_0x472ca5[_0x254a('0xd3')][_0x254a('0xce')]:_0x254a('0xd7'),'createdAt':moment(_0x472ca5[_0x254a('0x75')])[_0x254a('0xbd')](_0x254a('0xbe'))[_0x254a('0x97')](),'closedAt':_0x472ca5['closed']?moment(_0x472ca5[_0x254a('0xd8')])[_0x254a('0xbd')](_0x254a('0xbe'))[_0x254a('0x97')]():'','disposition':_0x472ca5[_0x254a('0xd9')],'messages':_(_0x472ca5[_0x254a('0xda')])[_0x254a('0x80')]({'secret':![]})[_0x254a('0x32')](function(_0x5ebc6b){return{'date':moment(_0x5ebc6b[_0x254a('0x75')])[_0x254a('0xbd')](_0x254a('0xbe'))['toString'](),'sender':_0x5ebc6b[_0x254a('0xdb')]==='out'?_0x5ebc6b[_0x254a('0x6c')]?_0x5ebc6b[_0x254a('0x6c')][_0x254a('0xce')]:_0x254a('0xdc'):_0x5ebc6b['Contact'][_0x254a('0xcf')]+(_0x5ebc6b[_0x254a('0x63')]['lastName']?'\x20'+_0x5ebc6b[_0x254a('0x63')][_0x254a('0xd0')]:''),'body':_0x5ebc6b[_0x254a('0x71')],'direction':_0x5ebc6b[_0x254a('0xdb')]===_0x254a('0xdd')?'A':'C','secret':_0x5ebc6b[_0x254a('0xd1')],'read':_0x5ebc6b[_0x254a('0x7c')]};})[_0x254a('0x5f')]()};return ejs[_0x254a('0xde')](path['join'](config['root'],_0x254a('0xc9'),_0x254a('0xdf'),_0x254a('0xe0')),{'interaction':_0x57f0bd})[_0x254a('0x2c')](function(_0x30f430){var _0x2cb1fb=path[_0x254a('0xc7')](_0x222b23,_0x254a('0xe1')+_0x472ca5['id']+'-'+_0x4cbc89+_0x254a('0xe2'));var _0x2ea4f5={'path':_0x2cb1fb,'channel':_0x254a('0xd6'),'interactionId':_0x472ca5['id']};return pdf[_0x254a('0xe3')](_0x30f430,_0x2ea4f5);})[_0x254a('0x2c')](function(){return new BPromise(function(_0x2446d3,_0x1b0598){zipdir(_0x222b23,{'saveTo':_0x450d60},function(_0x3d00db,_0x1766d4){if(_0x3d00db)return _0x1b0598(_0x3d00db);return _0x2446d3(_0x1766d4);});})['then'](function(){return new BPromise(function(_0x6c48b2,_0x298ed7){rimraf(_0x222b23,function(_0x3e70f4){if(_0x3e70f4)_0x298ed7(_0x3e70f4);return _0x6c48b2();});});})[_0x254a('0x2c')](function(){return _0x5e5eca[_0x254a('0xc6')](_0x450d60,_0x31baac,function(_0x1d13cf){if(_0x1d13cf){console[_0x254a('0xe4')](_0x254a('0xe5'),_0x1d13cf);}else{fs[_0x254a('0xe6')](_0x450d60);}});});});}else{return _0x5e5eca[_0x254a('0x1f')](0xc8);}})['catch'](handleError(_0x5e5eca,null));}; \ No newline at end of file +var _0x29a6=['../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','error','stack','name','send','Users','map','TagIds','Tags','forEach','push','catch','index','SmsInteraction','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','select','field','color','from','tools_tags','u.fullname','ui.SmsInteractionId','user_has_sms_interactions','left_join','users','u.id\x20=\x20ui.UserId','sms_interactions','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','it.SmsInteractionId\x20=\x20i.id','expr','search','parseSearch','sqlOperator','conditions','unreadMessages','value','having','`\x20=\x200','`\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?','find','ContactId','buildExpression','start','Tag','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','union','User','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','text','some','compact','isEmpty','SmsAccountId','where','i.SmsAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','\x20IS\x20NULL','read','`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)','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','order','t.id\x20IN\x20?','resolve','user','role','getSmsAccounts','i.SmsAccountId\x20IS\x20NULL','agent','sequelize','toString','merge','a.key','Account.key','a.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.*','Contact.firstName','Contact.email','c.phone','Contact.phone','Contact.mobile','c.fax','Owner.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.SmsInteractionId\x20IN\x20?','groupBy','SmsInteractionId','all','rows','show','params','include','options','create','body','update','destroy','describe','SmsMessage','addMessage','ids','getMessages','findOne','pick','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','findAll','addTags','setTags','spread','emit','smsInteractionTags:save','removeTags','download','unix','join','server','files','tmp','root','attachments','transcript-%d-%s.zip','CmContact','firstName','lastName','Messages','secret','SmsAccount','Owner','fullname','get','mkdirSync','Sms','Account','N.A.','format','closed','closedAt','direction','System','out','views','transcript-','.pdf','createPdfFromHTML','log','unlinkSync','eml-format','zip-dir','moment','bluebird','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis'];(function(_0x508c10,_0x5a15f0){var _0x3108b5=function(_0x4bccaa){while(--_0x4bccaa){_0x508c10['push'](_0x508c10['shift']());}};_0x3108b5(++_0x5a15f0);}(_0x29a6,0xd9));var _0x629a=function(_0x12d19,_0x49eeda){_0x12d19=_0x12d19-0x0;var _0x3f8e49=_0x29a6[_0x12d19];return _0x3f8e49;};'use strict';var emlformat=require(_0x629a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x629a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x629a('0x2'));var BPromise=require(_0x629a('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x629a('0x4'));var csv=require(_0x629a('0x5'));var ejs=require(_0x629a('0x6'));var fs=require('fs');var fs_extra=require(_0x629a('0x7'));var _=require(_0x629a('0x8'));var squel=require('squel');var crypto=require(_0x629a('0x9'));var jsforce=require(_0x629a('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x629a('0x5'));var querystring=require(_0x629a('0xb'));var Papa=require(_0x629a('0xc'));var Redis=require(_0x629a('0xd'));var authService=require(_0x629a('0xe'));var qs=require(_0x629a('0xf'));var as=require(_0x629a('0x10'));var pdf=require(_0x629a('0x11'));var hardwareService=require(_0x629a('0x12'));var logger=require(_0x629a('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x629a('0x14'));var licenseUtil=require(_0x629a('0x15'));var db=require(_0x629a('0x16'))['db'];config[_0x629a('0x17')]=_['defaults'](config[_0x629a('0x17')],{'host':_0x629a('0x18'),'port':0x18eb});var socket=require(_0x629a('0x19'))(new Redis(config[_0x629a('0x17')]));require(_0x629a('0x1a'))[_0x629a('0x1b')](socket);function respondWithStatusCode(_0x122398,_0x328a93){_0x328a93=_0x328a93||0xcc;return function(_0x562cb2){if(_0x562cb2){return _0x122398[_0x629a('0x1c')](_0x328a93);}return _0x122398[_0x629a('0x1d')](_0x328a93)[_0x629a('0x1e')]();};}function respondWithResult(_0x47403b,_0x278401){_0x278401=_0x278401||0xc8;return function(_0x2d905f){if(_0x2d905f){return _0x47403b[_0x629a('0x1d')](_0x278401)[_0x629a('0x1f')](_0x2d905f);}};}function respondWithFilteredResult(_0x56e12c,_0x1501ad){return function(_0x5a3cd8){if(_0x5a3cd8){var _0x175b69=typeof _0x1501ad[_0x629a('0x20')]==='undefined'&&typeof _0x1501ad['limit']===_0x629a('0x21');var _0x3d2016=_0x5a3cd8[_0x629a('0x22')];var _0x528864=_0x175b69?0x0:_0x1501ad[_0x629a('0x20')];var _0x2e3cee=_0x175b69?_0x5a3cd8[_0x629a('0x22')]:_0x1501ad[_0x629a('0x20')]+_0x1501ad[_0x629a('0x23')];var _0x13d9eb;if(_0x2e3cee>=_0x3d2016){_0x2e3cee=_0x3d2016;_0x13d9eb=0xc8;}else{_0x13d9eb=0xce;}_0x56e12c['status'](_0x13d9eb);return _0x56e12c[_0x629a('0x24')](_0x629a('0x25'),_0x528864+'-'+_0x2e3cee+'/'+_0x3d2016)[_0x629a('0x1f')](_0x5a3cd8);}return null;};}function patchUpdates(_0x5566c2){return function(_0x110019){try{jsonpatch[_0x629a('0x26')](_0x110019,_0x5566c2,!![]);}catch(_0x178df9){return BPromise[_0x629a('0x27')](_0x178df9);}return _0x110019[_0x629a('0x28')]();};}function saveUpdates(_0x15f772,_0x16327b){return function(_0x51cc1c){if(_0x51cc1c){return _0x51cc1c['update'](_0x15f772)['then'](function(_0x345c72){return _0x345c72;});}return null;};}function removeEntity(_0x2383b8,_0x5b13e1){return function(_0x5edc23){if(_0x5edc23){return _0x5edc23['destroy']()[_0x629a('0x29')](function(){_0x2383b8[_0x629a('0x1d')](0xcc)[_0x629a('0x1e')]();});}};}function handleEntityNotFound(_0x575883,_0x297c19){return function(_0x447724){if(!_0x447724){_0x575883[_0x629a('0x1c')](0x194);}return _0x447724;};}function handleError(_0x2436ef,_0x16a501){_0x16a501=_0x16a501||0x1f4;return function(_0xae5a91){logger[_0x629a('0x2a')](_0xae5a91[_0x629a('0x2b')]);if(_0xae5a91['name']){delete _0xae5a91[_0x629a('0x2c')];}_0x2436ef[_0x629a('0x1d')](_0x16a501)[_0x629a('0x2d')](_0xae5a91);};}function getInteractionUsers(_0x472d77,_0x513f6e){return new BPromise(function(_0x70aa24,_0x34a606){try{if(_0x513f6e[_0x472d77['id']]){_0x472d77[_0x629a('0x2e')]=_[_0x629a('0x2f')](_0x513f6e[_0x472d77['id']],function(_0x3f56d7){return{'id':_0x3f56d7['id'],'fullname':_0x3f56d7['fullname']};});}}catch(_0x18529a){_0x34a606(_0x18529a);}_0x70aa24(_0x472d77);});}function getInteractionTags(_0xdb4db1,_0x4e1191){return new BPromise(function(_0x302d43,_0x184b5d){try{if(_0xdb4db1[_0x629a('0x30')]){_0xdb4db1[_0x629a('0x31')]=[];_0xdb4db1[_0x629a('0x30')]['split'](',')[_0x629a('0x32')](function(_0x1ad99d){_0xdb4db1[_0x629a('0x31')][_0x629a('0x33')](_0x4e1191[_0x1ad99d]);});}delete _0xdb4db1['TagIds'];}catch(_0x2f7ccc){_0x184b5d(_0x2f7ccc);}_0x302d43(_0xdb4db1);});}function updateSmsInteraction(_0x44f1a9,_0x259977,_0x5efd5f){return new BPromise(function(_0x1a5a1a,_0x271868){return getInteractionUsers(_0x44f1a9,_0x5efd5f)['then'](function(_0x109b0e){return getInteractionTags(_0x109b0e,_0x259977);})['then'](function(_0xc1ace5){_0x1a5a1a(_0xc1ace5);})[_0x629a('0x34')](function(_0x2cabc2){_0x271868(_0x2cabc2);});});}exports[_0x629a('0x35')]=function(_0x56ef06,_0x8f280e){var _0x3dd24e={},_0x10407a={},_0xef0054={'count':0x0,'rows':[]};var _0xa999a6=_[_0x629a('0x2f')](db[_0x629a('0x36')][_0x629a('0x37')],function(_0x3fb966){return{'name':_0x3fb966[_0x629a('0x38')],'type':_0x3fb966[_0x629a('0x39')][_0x629a('0x3a')]};});_0x10407a[_0x629a('0x3b')]=_[_0x629a('0x2f')](_0xa999a6,_0x629a('0x2c'));_0x10407a[_0x629a('0x3c')]=_[_0x629a('0x3d')](_0x56ef06[_0x629a('0x3c')]);_0x10407a[_0x629a('0x3e')]=_[_0x629a('0x3f')](_0x10407a['model'],_0x10407a[_0x629a('0x3c')]);_0x3dd24e[_0x629a('0x40')]=_[_0x629a('0x3f')](_0x10407a[_0x629a('0x3b')],qs[_0x629a('0x41')](_0x56ef06[_0x629a('0x3c')][_0x629a('0x41')]));_0x3dd24e[_0x629a('0x40')]=_0x3dd24e[_0x629a('0x40')][_0x629a('0x42')]?_0x3dd24e['attributes']:_0x10407a[_0x629a('0x3b')];if(!_0x56ef06[_0x629a('0x3c')][_0x629a('0x43')](_0x629a('0x44'))){_0x3dd24e[_0x629a('0x23')]=qs[_0x629a('0x23')](_0x56ef06[_0x629a('0x3c')][_0x629a('0x23')]);_0x3dd24e[_0x629a('0x20')]=qs['offset'](_0x56ef06[_0x629a('0x3c')][_0x629a('0x20')]);}_0x3dd24e['order']=qs['sort'](_0x56ef06[_0x629a('0x3c')][_0x629a('0x45')]);_0x3dd24e['where']=qs[_0x629a('0x3e')](_['pick'](_0x56ef06[_0x629a('0x3c')],_0x10407a[_0x629a('0x3e')]),_0xa999a6);var _0x52b535=[];var _0x5a3db9=squel[_0x629a('0x46')]()['field']('id')[_0x629a('0x47')]('name')[_0x629a('0x47')](_0x629a('0x48'))[_0x629a('0x49')](_0x629a('0x4a'));var _0x2924b4=squel['select']()[_0x629a('0x47')]('u.id')[_0x629a('0x47')](_0x629a('0x4b'))[_0x629a('0x47')](_0x629a('0x4c'))[_0x629a('0x49')](_0x629a('0x4d'),'ui')[_0x629a('0x4e')](_0x629a('0x4f'),'u',_0x629a('0x50'));var _0x1728eb=squel[_0x629a('0x46')]()[_0x629a('0x49')](_0x629a('0x51'),'i')['left_join'](_0x629a('0x52'),'c',_0x629a('0x53'))['left_join'](_0x629a('0x4f'),'o',_0x629a('0x54'))['left_join']('sms_accounts','a','a.id\x20=\x20i.SmsAccountId')[_0x629a('0x4e')]('sms_messages','me','me.SmsInteractionId\x20=\x20i.id')[_0x629a('0x4e')]('sms_interaction_has_tags','it',_0x629a('0x55'))[_0x629a('0x4e')](_0x629a('0x4a'),'t','t.id\x20=\x20it.TagId');var _0x3c30b9=squel[_0x629a('0x56')]();var _0x5a8613=[];var _0x454a10=squel[_0x629a('0x56')]();var _0x5bdbaa;if(_0x56ef06['query'][_0x629a('0x57')]){_0x5bdbaa=as[_0x629a('0x58')](_0x56ef06['query'][_0x629a('0x57')]);var _0x5c0bae=_0x5bdbaa[_0x629a('0x59')];for(var _0x20ac4b=0x0;_0x20ac4b<_0x5bdbaa[_0x629a('0x5a')]['length'];_0x20ac4b++){var _0x380bf0=_0x5bdbaa[_0x629a('0x5a')][_0x20ac4b];var _0x180a83='i';var _0x333c8a=_['find'](_0xa999a6,[_0x629a('0x2c'),_0x380bf0[_0x629a('0x47')]]);if(!_0x333c8a){switch(_0x380bf0[_0x629a('0x47')]){case _0x629a('0x5b'):if(_0x380bf0[_0x629a('0x5c')]==0x1){_0x1728eb[_0x629a('0x5d')]('`'+_0x380bf0['field']+_0x629a('0x5e'));}else{_0x1728eb[_0x629a('0x5d')]('`'+_0x380bf0[_0x629a('0x47')]+_0x629a('0x5f'));}break;case _0x629a('0x60'):if(_0x380bf0[_0x629a('0x61')]===_0x629a('0x62')){if(_0x380bf0[_0x629a('0x5c')]['split']('\x20')['length']>0x1){_0x3c30b9[_0x5c0bae](_0x629a('0x63'),qs[_0x629a('0x64')](_0x380bf0[_0x629a('0x5c')]),null);}else{var _0xfae26f='%'+_0x380bf0['value']+'%';_0x3c30b9[_0x5c0bae](_0x629a('0x65'),_0xfae26f,_0xfae26f,_0xfae26f);}}else{_0x333c8a=_[_0x629a('0x66')](_0xa999a6,[_0x629a('0x2c'),'ContactId']);_0x380bf0[_0x629a('0x47')]=_0x629a('0x67');_0x3ab4f0=as[_0x629a('0x68')](_0x180a83,_0x333c8a[_0x629a('0x39')],_0x380bf0);_0x3c30b9[_0x5c0bae](_0x3ab4f0['text'],_0x3ab4f0['value'][_0x629a('0x69')],_0x3ab4f0[_0x629a('0x5c')][_0x629a('0x1e')]);}break;case _0x629a('0x6a'):var _0x1dde37=_0x380bf0[_0x629a('0x5c')]['split'](',')['map'](function(_0x583b71){return Number(_0x583b71);});_0x1dde37[_0x629a('0x32')](function(_0x3e5f84){_0x454a10['or'](_0x629a('0x6b'),'%,'+_0x3e5f84+',%');});_0x5a8613=_[_0x629a('0x6c')](_0x5a8613,_0x1dde37);break;case _0x629a('0x6d'):if(_0x380bf0[_0x629a('0x61')]==='$substring'){_0x3c30b9[_0x5c0bae](_0x629a('0x6e'),'%'+_0x380bf0[_0x629a('0x5c')]+'%',null);}else{_0x333c8a=_[_0x629a('0x66')](_0xa999a6,[_0x629a('0x2c'),'UserId']);_0x380bf0[_0x629a('0x47')]='UserId';_0x3ab4f0=as[_0x629a('0x68')](_0x180a83,_0x333c8a[_0x629a('0x39')],_0x380bf0);_0x3c30b9[_0x5c0bae](_0x3ab4f0[_0x629a('0x6f')],_0x3ab4f0[_0x629a('0x5c')]['start'],_0x3ab4f0[_0x629a('0x5c')]['end']);}break;case'body':_0x3ab4f0=as[_0x629a('0x68')]('me',null,_0x380bf0);_0x3c30b9[_0x5c0bae](_0x3ab4f0['text'],_0x3ab4f0[_0x629a('0x5c')]['start'],_0x3ab4f0[_0x629a('0x5c')][_0x629a('0x1e')]);break;}}else{var _0x3ab4f0=as[_0x629a('0x68')](_0x180a83,_0x333c8a['type'],_0x380bf0);_0x3c30b9[_0x5c0bae](_0x3ab4f0[_0x629a('0x6f')],_0x3ab4f0[_0x629a('0x5c')][_0x629a('0x69')],_0x3ab4f0[_0x629a('0x5c')]['end']);}}}else{var _0x20e679=_(_0x56ef06[_0x629a('0x3c')])['keys']()[_0x629a('0x2f')](function(_0x5f2020){return _[_0x629a('0x70')](_0xa999a6,[_0x629a('0x2c'),_0x5f2020])?_0x5f2020:undefined;})[_0x629a('0x71')]()[_0x629a('0x5c')]();if(!_[_0x629a('0x72')](_0x20e679)){_0x20e679[_0x629a('0x32')](function(_0x2881f5){if(_0x2881f5===_0x629a('0x73')){_0x1728eb[_0x629a('0x74')](_0x629a('0x75'),[][_0x629a('0x76')](_0x56ef06['query'][_0x2881f5]));}else if(_0x2881f5===_0x629a('0x77')){var _0x295146=JSON[_0x629a('0x78')](_0x56ef06['query'][_0x2881f5])[_0x629a('0x79')];var _0xfa8841=JSON[_0x629a('0x78')](_0x56ef06[_0x629a('0x3c')][_0x2881f5])[_0x629a('0x7a')];_0x1728eb['where'](_0x629a('0x7b'),_0x295146,_0xfa8841);}else{if(_0x56ef06[_0x629a('0x3c')][_0x2881f5]==='null'){_0x1728eb[_0x629a('0x74')]('i.'+_0x2881f5+_0x629a('0x7c'));}else{_0x1728eb[_0x629a('0x74')]('i.'+_0x2881f5+'\x20=\x20?',_0x56ef06[_0x629a('0x3c')][_0x2881f5]);}}});}if(_0x56ef06[_0x629a('0x3c')][_0x629a('0x7d')]){if(_0x56ef06[_0x629a('0x3c')][_0x629a('0x7d')]==0x1){_0x1728eb[_0x629a('0x5d')](_0x629a('0x7e'));}else{_0x1728eb[_0x629a('0x5d')](_0x629a('0x7f'));}}if(_0x56ef06[_0x629a('0x3c')][_0x629a('0x80')]){_0x5a8613=_[_0x629a('0x81')](_0x56ef06['query'][_0x629a('0x80')])?_0x56ef06[_0x629a('0x3c')][_0x629a('0x80')]:new Array(_0x56ef06[_0x629a('0x3c')][_0x629a('0x80')]);_0x5a8613[_0x629a('0x32')](function(_0xe53f98){_0x454a10['or'](_0x629a('0x6b'),'%,'+_0xe53f98+',%');});}if(_0x56ef06[_0x629a('0x3c')][_0x629a('0x82')]){var _0x3fea80=_0x56ef06[_0x629a('0x3c')][_0x629a('0x82')][_0x629a('0x83')]('\x5c','\x5c\x5c')[_0x629a('0x83')](/'/g,'\x27\x27');if(qs['isNumeric'](_0x3fea80)){_0x3c30b9['or'](_0x629a('0x84'),_0x3fea80+'%')['or'](_0x629a('0x85'),_0x3fea80+'%');}else{_0x3c30b9['or'](_0x629a('0x86'),qs[_0x629a('0x64')](_0x3fea80))['or'](_0x629a('0x87'),_0x3fea80+'%');}}}_0x1728eb['where'](_0x3c30b9);_0x1728eb[_0x629a('0x88')](_0x629a('0x89'));var _0x4aac0f={'type':db[_0x629a('0x8a')]['QueryTypes'][_0x629a('0x8b')],'raw':!![]};var _0xd1cec=_0x1728eb[_0x629a('0x8c')]();_0xd1cec['field'](_0x629a('0x89'));_0xd1cec[_0x629a('0x47')](_0x629a('0x8d'),_0x629a('0x5b'));if(_0x3dd24e['order']){_0x3dd24e['order'][_0x629a('0x32')](function(_0x5868dc){var _0x2175a0=_0x5868dc[0x0]===_0x629a('0x8e')?_0x5868dc[0x0]:'i.'+_0x5868dc[0x0];_0x1728eb[_0x629a('0x8f')](_0x2175a0,_0x5868dc[0x1]==='DESC'?![]:!![]);});}if(!_[_0x629a('0x72')](_0x5a8613)){_0x1728eb[_0x629a('0x5d')](_0x454a10);_0xd1cec[_0x629a('0x74')](_0x629a('0x90'),_0x5a8613);}BPromise[_0x629a('0x91')]()[_0x629a('0x29')](function(){if(!_0x5bdbaa){if(_0x56ef06[_0x629a('0x3c')][_0x629a('0x73')])return;_0xd1cec[_0x629a('0x74')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');_0x1728eb[_0x629a('0x74')]('i.SmsAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x56ef06[_0x629a('0x92')][_0x629a('0x93')]!=='agent')return;return _0x56ef06['user'][_0x629a('0x94')]({'attributes':['id'],'raw':!![]})['then'](function(_0x4ef968){if(_[_0x629a('0x72')](_0x4ef968)){_0xd1cec[_0x629a('0x74')](_0x629a('0x95'));_0x1728eb['where']('i.SmsAccountId\x20IS\x20NULL');}else{_0xd1cec[_0x629a('0x74')](_0x629a('0x75'),_[_0x629a('0x2f')](_0x4ef968,'id'));_0x1728eb['where'](_0x629a('0x75'),_[_0x629a('0x2f')](_0x4ef968,'id'));}});})[_0x629a('0x29')](function(){if(_0x56ef06[_0x629a('0x92')][_0x629a('0x93')]===_0x629a('0x96')&&!_0x5bdbaa&&!_0x56ef06[_0x629a('0x3c')][_0x629a('0x73')])return[];return db[_0x629a('0x97')][_0x629a('0x3c')](_0xd1cec[_0x629a('0x98')](),_0x4aac0f);})[_0x629a('0x29')](function(_0x37913a){_0xef0054['count']=_0x37913a[_0x629a('0x42')];if(_0xef0054[_0x629a('0x22')]===0x0)return[];return db['sequelize']['query'](_0x5a3db9[_0x629a('0x98')](),_0x4aac0f)[_0x629a('0x29')](function(_0x5629c3){_0x52b535=_['keyBy'](_0x5629c3,'id');_0x4aac0f=_[_0x629a('0x99')](_0x4aac0f,{'model':db[_0x629a('0x36')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x56ef06[_0x629a('0x3c')][_0x629a('0x41')]){_0x3dd24e['attributes'][_0x629a('0x32')](function(_0x5b1727){_0x1728eb['field']('i.'+_0x5b1727);});}else{_0x1728eb[_0x629a('0x47')](_0x629a('0x8d'),_0x629a('0x5b'));_0x1728eb['field'](_0x629a('0x9a'),_0x629a('0x9b'));_0x1728eb[_0x629a('0x47')](_0x629a('0x9c'),'Account.mandatoryDisposition');_0x1728eb['field'](_0x629a('0x9d'),_0x629a('0x8e'));_0x1728eb[_0x629a('0x47')](_0x629a('0x9e'));_0x1728eb['field']('c.firstName',_0x629a('0x9f'));_0x1728eb[_0x629a('0x47')]('c.lastName','Contact.lastName');_0x1728eb[_0x629a('0x47')]('c.email',_0x629a('0xa0'));_0x1728eb[_0x629a('0x47')](_0x629a('0xa1'),_0x629a('0xa2'));_0x1728eb['field']('c.mobile',_0x629a('0xa3'));_0x1728eb['field'](_0x629a('0xa4'),'Contact.fax');_0x1728eb[_0x629a('0x47')]('o.fullname','Owner.fullname');_0x1728eb[_0x629a('0x47')]('o.internal',_0x629a('0xa5'));_0x1728eb[_0x629a('0x47')](_0x629a('0xa6'),_0x629a('0x30'));}if(_0x3dd24e[_0x629a('0x23')])_0x1728eb[_0x629a('0x23')](_0x3dd24e[_0x629a('0x23')]);if(_0x3dd24e[_0x629a('0x20')])_0x1728eb[_0x629a('0x20')](_0x3dd24e[_0x629a('0x20')]);return db['sequelize'][_0x629a('0x3c')](_0x1728eb[_0x629a('0x98')](),_0x4aac0f);})[_0x629a('0x29')](function(_0x5a0ab8){if(_0x5a0ab8[_0x629a('0x42')]>0x0)_0x2924b4[_0x629a('0x74')](_0x629a('0xa7'),_[_0x629a('0x2f')](_0x5a0ab8,'id'));return db[_0x629a('0x97')][_0x629a('0x3c')](_0x2924b4[_0x629a('0x98')](),_0x4aac0f)[_0x629a('0x29')](function(_0x56c753){var _0x4b96be=_[_0x629a('0xa8')](_0x56c753,_0x629a('0xa9'));var _0x25ccd7=[];_0x5a0ab8['forEach'](function(_0x5d1c67){_0x25ccd7[_0x629a('0x33')](updateSmsInteraction(_0x5d1c67,_0x52b535,_0x4b96be));});return BPromise[_0x629a('0xaa')](_0x25ccd7);});});})[_0x629a('0x29')](function(_0xd3d8f1){_0xef0054[_0x629a('0xab')]=_0xd3d8f1;return _0xef0054;})[_0x629a('0x29')](respondWithFilteredResult(_0x8f280e,_0x3dd24e))['catch'](handleError(_0x8f280e,null));};exports[_0x629a('0xac')]=function(_0x4f2a10,_0x284455){var _0x189a47={'raw':![],'where':{'id':_0x4f2a10[_0x629a('0xad')]['id']}},_0xc2c8fc={};_0xc2c8fc[_0x629a('0x3b')]=_[_0x629a('0x3d')](db[_0x629a('0x36')][_0x629a('0x37')]);_0xc2c8fc[_0x629a('0x3c')]=_['keys'](_0x4f2a10[_0x629a('0x3c')]);_0xc2c8fc['filters']=_[_0x629a('0x3f')](_0xc2c8fc[_0x629a('0x3b')],_0xc2c8fc[_0x629a('0x3c')]);_0x189a47['attributes']=_[_0x629a('0x3f')](_0xc2c8fc[_0x629a('0x3b')],qs[_0x629a('0x41')](_0x4f2a10[_0x629a('0x3c')][_0x629a('0x41')]));_0x189a47[_0x629a('0x40')]=_0x189a47['attributes'][_0x629a('0x42')]?_0x189a47[_0x629a('0x40')]:_0xc2c8fc[_0x629a('0x3b')];if(_0x4f2a10[_0x629a('0x3c')]['includeAll']){_0x189a47[_0x629a('0xae')]=[{'all':!![]}];}_0x189a47=_[_0x629a('0x99')]({},_0x189a47,_0x4f2a10[_0x629a('0xaf')]);return db[_0x629a('0x36')]['find'](_0x189a47)[_0x629a('0x29')](handleEntityNotFound(_0x284455,null))[_0x629a('0x29')](respondWithResult(_0x284455,null))[_0x629a('0x34')](handleError(_0x284455,null));};exports[_0x629a('0xb0')]=function(_0x49b251,_0x1f7c05){return db[_0x629a('0x36')][_0x629a('0xb0')](_0x49b251[_0x629a('0xb1')],{})['then'](respondWithResult(_0x1f7c05,0xc9))['catch'](handleError(_0x1f7c05,null));};exports[_0x629a('0xb2')]=function(_0x348bd4,_0x22e40b){if(_0x348bd4[_0x629a('0xb1')]['id']){delete _0x348bd4[_0x629a('0xb1')]['id'];}return db[_0x629a('0x36')][_0x629a('0x66')]({'where':{'id':_0x348bd4['params']['id']}})[_0x629a('0x29')](handleEntityNotFound(_0x22e40b,null))['then'](saveUpdates(_0x348bd4['body'],null))[_0x629a('0x29')](respondWithResult(_0x22e40b,null))[_0x629a('0x34')](handleError(_0x22e40b,null));};exports[_0x629a('0xb3')]=function(_0x56d036,_0x1a18eb){return db[_0x629a('0x36')][_0x629a('0x66')]({'where':{'id':_0x56d036['params']['id']}})[_0x629a('0x29')](handleEntityNotFound(_0x1a18eb,null))[_0x629a('0x29')](removeEntity(_0x1a18eb,null))[_0x629a('0x34')](handleError(_0x1a18eb,null));};exports['describe']=function(_0x5912dd,_0x36c67f){return db[_0x629a('0x36')][_0x629a('0xb4')]()[_0x629a('0x29')](respondWithResult(_0x36c67f,null))[_0x629a('0x34')](handleError(_0x36c67f,null));};exports['addMessage']=function(_0x32c912,_0x5ab028,_0x4a0276){return db[_0x629a('0xb5')][_0x629a('0x66')]({'where':{'id':_0x32c912['params']['id']}})[_0x629a('0x29')](handleEntityNotFound(_0x5ab028,null))[_0x629a('0x29')](function(_0x8c3c5d){if(_0x8c3c5d){return _0x8c3c5d[_0x629a('0xb6')](_0x32c912[_0x629a('0xb1')][_0x629a('0xb7')],_['omit'](_0x32c912[_0x629a('0xb1')],['ids','id'])||{});}})['then'](respondWithResult(_0x5ab028,null))[_0x629a('0x34')](handleError(_0x5ab028,null));};exports[_0x629a('0xb8')]=function(_0x2930eb,_0xdf901c,_0x388935){var _0x5e3163={'raw':![],'where':{}};var _0x1ef1f1={};var _0x2fb199={'count':0x0,'rows':[]};return db[_0x629a('0x36')][_0x629a('0xb9')]({'where':{'id':_0x2930eb[_0x629a('0xad')]['id']}})[_0x629a('0x29')](handleEntityNotFound(_0xdf901c,null))[_0x629a('0x29')](function(_0x5cbaed){if(_0x5cbaed){_0x1ef1f1[_0x629a('0x3b')]=_['keys'](db[_0x629a('0xb5')]['rawAttributes']);_0x1ef1f1[_0x629a('0x3c')]=_['keys'](_0x2930eb['query']);_0x1ef1f1[_0x629a('0x3e')]=_[_0x629a('0x3f')](_0x1ef1f1['model'],_0x1ef1f1[_0x629a('0x3c')]);_0x5e3163[_0x629a('0x40')]=_['intersection'](_0x1ef1f1[_0x629a('0x3b')],qs[_0x629a('0x41')](_0x2930eb[_0x629a('0x3c')]['fields']));_0x5e3163[_0x629a('0x40')]=_0x5e3163[_0x629a('0x40')][_0x629a('0x42')]?_0x5e3163[_0x629a('0x40')]:_0x1ef1f1[_0x629a('0x3b')];if(!_0x2930eb[_0x629a('0x3c')][_0x629a('0x43')]('nolimit')){_0x5e3163[_0x629a('0x23')]=qs[_0x629a('0x23')](_0x2930eb[_0x629a('0x3c')][_0x629a('0x23')]);_0x5e3163[_0x629a('0x20')]=qs[_0x629a('0x20')](_0x2930eb[_0x629a('0x3c')]['offset']);}_0x5e3163[_0x629a('0x8f')]=qs[_0x629a('0x45')](_0x2930eb[_0x629a('0x3c')][_0x629a('0x45')]);_0x5e3163[_0x629a('0x74')]=qs[_0x629a('0x3e')](_[_0x629a('0xba')](_0x2930eb[_0x629a('0x3c')],_0x1ef1f1[_0x629a('0x3e')]));_0x5e3163[_0x629a('0x74')][_0x629a('0xa9')]=_0x5cbaed['id'];if(_0x2930eb['query'][_0x629a('0x82')]){_0x5e3163[_0x629a('0x74')]=_[_0x629a('0x99')](_0x5e3163['where'],{'$or':_[_0x629a('0x2f')](_0x5e3163[_0x629a('0x40')],function(_0x1c6c5d){var _0x13a609={};_0x13a609[_0x1c6c5d]={'$like':'%'+_0x2930eb[_0x629a('0x3c')][_0x629a('0x82')]+'%'};return _0x13a609;})});}if(_0x2930eb[_0x629a('0x3c')][_0x629a('0x79')]){var _0x1467e9=_0x2930eb[_0x629a('0x3c')][_0x629a('0x79')][_0x629a('0xbb')](',');var _0x1222f0={};_0x1222f0[_0x1467e9[0x0]]={'$gte':moment(_0x1467e9[0x1])['format'](_0x629a('0xbc'))};_0x5e3163[_0x629a('0x74')]=_[_0x629a('0x99')](_0x5e3163[_0x629a('0x74')],_0x1222f0);}_0x5e3163=_[_0x629a('0x99')]({},_0x5e3163,_0x2930eb[_0x629a('0xaf')]);return db[_0x629a('0xb5')][_0x629a('0x22')]({'where':_0x5e3163[_0x629a('0x74')]})[_0x629a('0x29')](function(_0x38054a){_0x2fb199[_0x629a('0x22')]=_0x38054a;if(_0x2930eb[_0x629a('0x3c')][_0x629a('0xbd')]){_0x5e3163['include']=[{'all':!![]}];}return db[_0x629a('0xb5')][_0x629a('0xbe')](_0x5e3163);})[_0x629a('0x29')](function(_0x5385b3){_0x2fb199['rows']=_0x5385b3;return _0x2fb199;});}})[_0x629a('0x29')](respondWithFilteredResult(_0xdf901c,_0x5e3163))[_0x629a('0x34')](handleError(_0xdf901c,null));};exports[_0x629a('0xbf')]=function(_0x1177d0,_0x4dd4ff,_0x12a89b){return db[_0x629a('0x36')]['find']({'where':{'id':_0x1177d0[_0x629a('0xad')]['id']}})[_0x629a('0x29')](handleEntityNotFound(_0x4dd4ff,null))[_0x629a('0x29')](function(_0xa8569a){if(_0xa8569a){return _0xa8569a[_0x629a('0xc0')](_0x1177d0['body'][_0x629a('0xb7')],_['omit'](_0x1177d0[_0x629a('0xb1')],[_0x629a('0xb7'),'id'])||{})[_0x629a('0xc1')](function(){return db[_0x629a('0x6a')]['findAll']({'attributes':['id','name',_0x629a('0x48')],'where':{'id':_0x1177d0[_0x629a('0xb1')]['ids']}});})[_0x629a('0x29')](function(_0x42a99f){socket[_0x629a('0xc2')](_0x629a('0xc3'),{'id':Number(_0x1177d0[_0x629a('0xad')]['id']),'tags':_0x42a99f||[]});return{'id':Number(_0x1177d0[_0x629a('0xad')]['id']),'tags':_0x42a99f||[]};});}})['then'](respondWithResult(_0x4dd4ff,null))['catch'](handleError(_0x4dd4ff,null));};exports['removeTags']=function(_0x3a8d99,_0x55f13,_0x39073b){return db['SmsInteraction']['find']({'where':{'id':_0x3a8d99[_0x629a('0xad')]['id']}})['then'](handleEntityNotFound(_0x55f13,null))[_0x629a('0x29')](function(_0x3a486d){if(_0x3a486d){return _0x3a486d[_0x629a('0xc4')](_0x3a8d99[_0x629a('0x3c')][_0x629a('0xb7')]);}})['then'](respondWithStatusCode(_0x55f13,null))[_0x629a('0x34')](handleError(_0x55f13,null));};exports[_0x629a('0xc5')]=function(_0x1e9c62,_0x22982a){var _0x549792=moment()[_0x629a('0xc6')]()[_0x629a('0x98')]();var _0x298a93=path[_0x629a('0xc7')](config['root'],_0x629a('0xc8'),_0x629a('0xc9'),_0x629a('0xca'));var _0x36982e=path[_0x629a('0xc7')](config[_0x629a('0xcb')],_0x629a('0xc8'),'files',_0x629a('0xcc'));var _0x14f990=path[_0x629a('0xc7')](_0x298a93,_0x549792);var _0x281c27=util['format'](_0x629a('0xcd'),_0x1e9c62[_0x629a('0xad')]['id'],_0x549792);var _0x42bbed=path['join'](_0x298a93,_0x281c27);var _0x17eb4b=[];_0x17eb4b[_0x629a('0x33')]({'model':db['User'],'as':_0x629a('0x6d'),'attributes':['id','fullname'],'raw':!![]});_0x17eb4b['push']({'model':db[_0x629a('0xce')],'as':_0x629a('0x60'),'attributes':['id',_0x629a('0xcf'),_0x629a('0xd0')],'raw':!![]});var _0x94f5b5=[{'model':db[_0x629a('0xb5')],'as':_0x629a('0xd1'),'attributes':['id',_0x629a('0xb1'),_0x629a('0x77'),'direction',_0x629a('0xd2'),_0x629a('0x7d')],'include':_0x17eb4b}];_0x94f5b5['push']({'model':db[_0x629a('0xd3')],'as':'Account','attributes':['id','name']});_0x94f5b5[_0x629a('0x33')]({'model':db[_0x629a('0x6d')],'as':_0x629a('0xd4'),'attributes':['id',_0x629a('0xd5')]});return db[_0x629a('0x36')][_0x629a('0x66')]({'where':{'id':_0x1e9c62['params']['id']},'include':_0x94f5b5})[_0x629a('0x29')](handleEntityNotFound(_0x22982a,null))['then'](function(_0x206c1f){if(_0x206c1f){var _0x22e06c=_0x206c1f[_0x629a('0xd6')]({'plain':!![]});fs[_0x629a('0xd7')](_0x14f990);var _0x561440={'channel':_0x629a('0xd8'),'account':_0x22e06c[_0x629a('0xd9')][_0x629a('0x2c')],'agent':_0x22e06c[_0x629a('0xd4')]?_0x22e06c['Owner'][_0x629a('0xd5')]:_0x629a('0xda'),'createdAt':moment(_0x22e06c[_0x629a('0x77')])[_0x629a('0xdb')]('YYYY-MM-DD\x20HH:mm:ss')[_0x629a('0x98')](),'closedAt':_0x22e06c[_0x629a('0xdc')]?moment(_0x22e06c[_0x629a('0xdd')])['format'](_0x629a('0xbc'))[_0x629a('0x98')]():'','disposition':_0x22e06c['disposition'],'messages':_(_0x22e06c['Messages'])[_0x629a('0x82')]({'secret':![]})['map'](function(_0x31b9b7){return{'date':moment(_0x31b9b7['createdAt'])[_0x629a('0xdb')](_0x629a('0xbc'))['toString'](),'sender':_0x31b9b7[_0x629a('0xde')]==='out'?_0x31b9b7[_0x629a('0x6d')]?_0x31b9b7[_0x629a('0x6d')][_0x629a('0xd5')]:_0x629a('0xdf'):_0x31b9b7[_0x629a('0x60')]['firstName']+(_0x31b9b7[_0x629a('0x60')][_0x629a('0xd0')]?'\x20'+_0x31b9b7[_0x629a('0x60')]['lastName']:''),'body':_0x31b9b7[_0x629a('0xb1')],'direction':_0x31b9b7[_0x629a('0xde')]===_0x629a('0xe0')?'A':'C','secret':_0x31b9b7[_0x629a('0xd2')],'read':_0x31b9b7[_0x629a('0x7d')]};})[_0x629a('0x5c')]()};return ejs['renderFile'](path[_0x629a('0xc7')](config[_0x629a('0xcb')],'server',_0x629a('0xe1'),'downloadInteraction.ejs'),{'interaction':_0x561440})[_0x629a('0x29')](function(_0x38e1ab){var _0x1d515f=path[_0x629a('0xc7')](_0x14f990,_0x629a('0xe2')+_0x22e06c['id']+'-'+_0x549792+_0x629a('0xe3'));var _0x67826d={'path':_0x1d515f,'channel':'Sms','interactionId':_0x22e06c['id']};return pdf[_0x629a('0xe4')](_0x38e1ab,_0x67826d);})[_0x629a('0x29')](function(){return new BPromise(function(_0x325710,_0x450d4a){zipdir(_0x14f990,{'saveTo':_0x42bbed},function(_0x32b43e,_0x2d7276){if(_0x32b43e)return _0x450d4a(_0x32b43e);return _0x325710(_0x2d7276);});})[_0x629a('0x29')](function(){return new BPromise(function(_0x42a41b,_0xccc5e4){rimraf(_0x14f990,function(_0x516167){if(_0x516167)_0xccc5e4(_0x516167);return _0x42a41b();});});})[_0x629a('0x29')](function(){return _0x22982a[_0x629a('0xc5')](_0x42bbed,_0x281c27,function(_0x5779fa){if(_0x5779fa){console[_0x629a('0xe5')]('err',_0x5779fa);}else{fs[_0x629a('0xe6')](_0x42bbed);}});});});}else{return _0x22982a[_0x629a('0x1c')](0xc8);}})['catch'](handleError(_0x22982a,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 1e31a9e..deec93c 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 _0x6cb4=['../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','then','setDataValue','Users','map','unreadMessages','length','emit','catch','events'];(function(_0x4a3f77,_0x1ba133){var _0x2869bc=function(_0x3ebf32){while(--_0x3ebf32){_0x4a3f77['push'](_0x4a3f77['shift']());}};_0x2869bc(++_0x1ba133);}(_0x6cb4,0xff));var _0x46cb=function(_0xbf8a85,_0x5ca338){_0xbf8a85=_0xbf8a85-0x0;var _0x40b99b=_0x6cb4[_0xbf8a85];return _0x40b99b;};'use strict';var EventEmitter=require(_0x46cb('0x0'));var SmsInteraction=require(_0x46cb('0x1'))['db'][_0x46cb('0x2')];var SmsMessage=require(_0x46cb('0x1'))['db'][_0x46cb('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x46cb('0x4')](0x0);var events={'afterCreate':_0x46cb('0x5'),'afterUpdate':_0x46cb('0x6'),'afterDestroy':_0x46cb('0x7')};function emitEvent(_0x5032a4){return function(_0x1a3fe4,_0x5cb9a4,_0x3d9d3c){_0x1a3fe4['getUsers']({'attributes':['id'],'raw':!![]})[_0x46cb('0x8')](function(_0x148d0f){_0x1a3fe4[_0x46cb('0x9')](_0x46cb('0xa'),_0x148d0f[_0x46cb('0xb')](function(_0x196a93){return{'id':_0x196a93['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x1a3fe4['id'],'direction':'in','read':![]},'raw':!![]});})[_0x46cb('0x8')](function(_0x34f9e9){_0x1a3fe4['setDataValue'](_0x46cb('0xc'),_0x34f9e9[_0x46cb('0xd')]);SmsInteractionEvents['emit'](_0x5032a4+':'+_0x1a3fe4['id'],_0x1a3fe4);SmsInteractionEvents[_0x46cb('0xe')](_0x5032a4,_0x1a3fe4);_0x3d9d3c(null);})[_0x46cb('0xf')](_0x3d9d3c(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file +var _0x757a=['update','remove','getUsers','then','setDataValue','Users','map','findAll','unreadMessages','length','emit','catch','../../mysqldb','SmsInteraction','save'];(function(_0xd299c3,_0x4ba0f1){var _0x376574=function(_0xc585f){while(--_0xc585f){_0xd299c3['push'](_0xd299c3['shift']());}};_0x376574(++_0x4ba0f1);}(_0x757a,0xde));var _0xa757=function(_0x3e8bbc,_0x4921b4){_0x3e8bbc=_0x3e8bbc-0x0;var _0x1d7288=_0x757a[_0x3e8bbc];return _0x1d7288;};'use strict';var EventEmitter=require('events');var SmsInteraction=require(_0xa757('0x0'))['db'][_0xa757('0x1')];var SmsMessage=require('../../mysqldb')['db']['SmsMessage'];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa757('0x2'),'afterUpdate':_0xa757('0x3'),'afterDestroy':_0xa757('0x4')};function emitEvent(_0x453d07){return function(_0x32630d,_0x3caeb0,_0x5edca8){_0x32630d[_0xa757('0x5')]({'attributes':['id'],'raw':!![]})[_0xa757('0x6')](function(_0x53be0e){_0x32630d[_0xa757('0x7')](_0xa757('0x8'),_0x53be0e[_0xa757('0x9')](function(_0x1a95ee){return{'id':_0x1a95ee['id']};}));return SmsMessage[_0xa757('0xa')]({'where':{'SmsInteractionId':_0x32630d['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x89c630){_0x32630d[_0xa757('0x7')](_0xa757('0xb'),_0x89c630[_0xa757('0xc')]);SmsInteractionEvents[_0xa757('0xd')](_0x453d07+':'+_0x32630d['id'],_0x32630d);SmsInteractionEvents[_0xa757('0xd')](_0x453d07,_0x32630d);_0x5edca8(null);})[_0xa757('0xe')](_0x5edca8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module['exports']=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 1d07e0a..fd1d9e9 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 _0x5eaa=['sms_interactions','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util','moment','request-promise','rimraf','exports','define','SmsInteraction'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x5eaa,0x178));var _0xa5ea=function(_0xe91358,_0x2a32d4){_0xe91358=_0xe91358-0x0;var _0x72ca7f=_0x5eaa[_0xe91358];return _0x72ca7f;};'use strict';var _=require(_0xa5ea('0x0'));var util=require(_0xa5ea('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xa5ea('0x2'));var BPromise=require('bluebird');var rp=require(_0xa5ea('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa5ea('0x4'));var config=require('../../config/environment');var attributes=require('./smsInteraction.attributes');module[_0xa5ea('0x5')]=function(_0x560869,_0x1db2db){return _0x560869[_0xa5ea('0x6')](_0xa5ea('0x7'),attributes,{'tableName':_0xa5ea('0x8'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x2cd340,_0x135d69,_0x476b59){if(_0x2cd340['changed'](_0xa5ea('0x9'))){_0x2cd340[_0xa5ea('0xa')]=moment()['format'](_0xa5ea('0xb'));}_0x476b59(null,_0x2cd340);}}});}; \ No newline at end of file +var _0x9f36=['rimraf','./smsInteraction.attributes','exports','define','SmsInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3af17b,_0x25f119){var _0x6e8bf5=function(_0x112bd6){while(--_0x112bd6){_0x3af17b['push'](_0x3af17b['shift']());}};_0x6e8bf5(++_0x25f119);}(_0x9f36,0x1a1));var _0x69f3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9f36[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x69f3('0x0'));var util=require(_0x69f3('0x1'));var logger=require(_0x69f3('0x2'))(_0x69f3('0x3'));var moment=require(_0x69f3('0x4'));var BPromise=require(_0x69f3('0x5'));var rp=require(_0x69f3('0x6'));var fs=require('fs');var path=require(_0x69f3('0x7'));var rimraf=require(_0x69f3('0x8'));var config=require('../../config/environment');var attributes=require(_0x69f3('0x9'));module[_0x69f3('0xa')]=function(_0x52b40c,_0x5e4588){return _0x52b40c[_0x69f3('0xb')](_0x69f3('0xc'),attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a661d,_0x137deb,_0x2a1b79){if(_0x1a661d['changed'](_0x69f3('0xd'))){_0x1a661d[_0x69f3('0xe')]=moment()[_0x69f3('0xf')](_0x69f3('0x10'));}_0x2a1b79(null,_0x1a661d);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index 84ed6d1..371156d 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 _0x1db9=['AddTagsToSmsInteraction','find','addTags','ids','spread','AddTags','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','SmsInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','UpdateSmsInteraction','SmsInteraction','update','body','raw','options','where','attributes','limit','debug'];(function(_0x147f87,_0x71513e){var _0x442ace=function(_0x366453){while(--_0x366453){_0x147f87['push'](_0x147f87['shift']());}};_0x442ace(++_0x71513e);}(_0x1db9,0x78));var _0x91db=function(_0x46c886,_0x1468fa){_0x46c886=_0x46c886-0x0;var _0x2ad954=_0x1db9[_0x46c886];return _0x2ad954;};'use strict';var _=require('lodash');var util=require(_0x91db('0x0'));var moment=require('moment');var BPromise=require(_0x91db('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x91db('0x2'));var db=require(_0x91db('0x3'))['db'];var utils=require(_0x91db('0x4'));var logger=require(_0x91db('0x5'))('rpc');var config=require(_0x91db('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x91db('0x7')][_0x91db('0x8')]({'port':0x232a});config[_0x91db('0x9')]=_[_0x91db('0xa')](config[_0x91db('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x91db('0x9')]));require('./smsInteraction.socket')['register'](socket);function respondWithRpcPromise(_0x298c72,_0xb08610,_0x1cb7c6){return new BPromise(function(_0x4d48b8,_0x2e070f){return client[_0x91db('0xb')](_0x298c72,_0x1cb7c6)[_0x91db('0xc')](function(_0x1abe9f){logger['info'](_0x91db('0xd'),_0xb08610,_0x91db('0xe'));logger['debug'](_0x91db('0xf'),_0xb08610,'request\x20sent',JSON[_0x91db('0x10')](_0x1abe9f));if(_0x1abe9f['error']){if(_0x1abe9f[_0x91db('0x11')][_0x91db('0x12')]===0x1f4){logger[_0x91db('0x11')](_0x91db('0xd'),_0xb08610,_0x1abe9f[_0x91db('0x11')][_0x91db('0x13')]);return _0x2e070f(_0x1abe9f[_0x91db('0x11')][_0x91db('0x13')]);}logger[_0x91db('0x11')]('SmsInteraction,\x20%s,\x20%s',_0xb08610,_0x1abe9f['error'][_0x91db('0x13')]);return _0x4d48b8(_0x1abe9f['error']['message']);}else{logger[_0x91db('0x14')]('SmsInteraction,\x20%s,\x20%s',_0xb08610,_0x91db('0xe'));_0x4d48b8(_0x1abe9f['result'][_0x91db('0x13')]);}})[_0x91db('0x15')](function(_0x45a93f){logger[_0x91db('0x11')](_0x91db('0xd'),_0xb08610,_0x45a93f);_0x2e070f(_0x45a93f);});});}exports[_0x91db('0x16')]=function(_0x1569e7){var _0x1fbd82=this;return new Promise(function(_0x2ac8d6,_0x3e4c84){return db[_0x91db('0x17')][_0x91db('0x18')](_0x1569e7[_0x91db('0x19')],{'raw':_0x1569e7['options']?_0x1569e7['options'][_0x91db('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1569e7[_0x91db('0x1b')]?_0x1569e7[_0x91db('0x1b')][_0x91db('0x1c')]||null:null,'attributes':_0x1569e7[_0x91db('0x1b')]?_0x1569e7[_0x91db('0x1b')][_0x91db('0x1d')]||null:null,'limit':_0x1569e7[_0x91db('0x1b')]?_0x1569e7['options'][_0x91db('0x1e')]||null:null})[_0x91db('0xc')](function(_0x2d96e7){logger['info'](_0x91db('0x16'),_0x1569e7);logger[_0x91db('0x1f')](_0x91db('0x16'),_0x1569e7,JSON[_0x91db('0x10')](_0x2d96e7));_0x2ac8d6(_0x2d96e7);})['catch'](function(_0x1a2608){logger[_0x91db('0x11')]('UpdateSmsInteraction',_0x1a2608[_0x91db('0x13')],_0x1569e7);_0x3e4c84(_0x1fbd82[_0x91db('0x11')](0x1f4,_0x1a2608['message']));});});};exports[_0x91db('0x20')]=function(_0x521523){return new Promise(function(_0x24fe47,_0x534273){return db['SmsInteraction'][_0x91db('0x21')]({'where':_0x521523[_0x91db('0x1b')]?_0x521523[_0x91db('0x1b')][_0x91db('0x1c')]||null:null})[_0x91db('0xc')](function(_0x39ce63){if(_0x39ce63){return _0x39ce63[_0x91db('0x22')](_0x521523[_0x91db('0x19')][_0x91db('0x23')],_['omit'](_0x521523[_0x91db('0x19')],[_0x91db('0x23'),'id'])||{});}})[_0x91db('0x24')](function(_0x59a520){logger['info']('AddTags',_0x521523);logger[_0x91db('0x1f')](_0x91db('0x25'),_0x521523,JSON[_0x91db('0x10')](_0x59a520));_0x24fe47(_0x59a520);})[_0x91db('0x15')](function(_0x3975be){logger[_0x91db('0x11')](_0x91db('0x25'),_0x3975be[_0x91db('0x13')],_0x521523);_0x534273(_this[_0x91db('0x11')](0x1f4,_0x3975be['message']));});});}; \ No newline at end of file +var _0x81f7=['lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./smsInteraction.socket','register','request','then','info','SmsInteraction,\x20%s,\x20%s','request\x20sent','debug','SmsInteraction,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','SmsInteraction','update','body','raw','options','UpdateSmsInteraction','stringify','AddTagsToSmsInteraction','ids','omit','spread','AddTags'];(function(_0x4e1ef7,_0x349fa5){var _0x20f191=function(_0x2db9e3){while(--_0x2db9e3){_0x4e1ef7['push'](_0x4e1ef7['shift']());}};_0x20f191(++_0x349fa5);}(_0x81f7,0x1e0));var _0x781f=function(_0x32dfdf,_0x56492f){_0x32dfdf=_0x32dfdf-0x0;var _0x5ddb9b=_0x81f7[_0x32dfdf];return _0x5ddb9b;};'use strict';var _=require(_0x781f('0x0'));var util=require('util');var moment=require(_0x781f('0x1'));var BPromise=require('bluebird');var rs=require(_0x781f('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x781f('0x3'))['db'];var utils=require(_0x781f('0x4'));var logger=require(_0x781f('0x5'))(_0x781f('0x6'));var config=require('../../config/environment');var jayson=require(_0x781f('0x7'));var client=jayson[_0x781f('0x8')][_0x781f('0x9')]({'port':0x232a});config[_0x781f('0xa')]=_[_0x781f('0xb')](config[_0x781f('0xa')],{'host':_0x781f('0xc'),'port':0x18eb});var socket=require(_0x781f('0xd'))(new Redis(config[_0x781f('0xa')]));require(_0x781f('0xe'))[_0x781f('0xf')](socket);function respondWithRpcPromise(_0xfa901f,_0x310a30,_0x1df8d6){return new BPromise(function(_0x55f096,_0x3b165d){return client[_0x781f('0x10')](_0xfa901f,_0x1df8d6)[_0x781f('0x11')](function(_0x329500){logger[_0x781f('0x12')](_0x781f('0x13'),_0x310a30,_0x781f('0x14'));logger[_0x781f('0x15')](_0x781f('0x16'),_0x310a30,_0x781f('0x14'),JSON['stringify'](_0x329500));if(_0x329500[_0x781f('0x17')]){if(_0x329500[_0x781f('0x17')][_0x781f('0x18')]===0x1f4){logger[_0x781f('0x17')](_0x781f('0x13'),_0x310a30,_0x329500[_0x781f('0x17')]['message']);return _0x3b165d(_0x329500[_0x781f('0x17')]['message']);}logger[_0x781f('0x17')](_0x781f('0x13'),_0x310a30,_0x329500['error'][_0x781f('0x19')]);return _0x55f096(_0x329500['error'][_0x781f('0x19')]);}else{logger['info'](_0x781f('0x13'),_0x310a30,_0x781f('0x14'));_0x55f096(_0x329500[_0x781f('0x1a')]['message']);}})[_0x781f('0x1b')](function(_0x40e53a){logger[_0x781f('0x17')](_0x781f('0x13'),_0x310a30,_0x40e53a);_0x3b165d(_0x40e53a);});});}exports['UpdateSmsInteraction']=function(_0x5d39f0){var _0x42dac9=this;return new Promise(function(_0x5e82cd,_0x11e34c){return db[_0x781f('0x1c')][_0x781f('0x1d')](_0x5d39f0[_0x781f('0x1e')],{'raw':_0x5d39f0['options']?_0x5d39f0['options'][_0x781f('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5d39f0['options']?_0x5d39f0[_0x781f('0x20')]['where']||null:null,'attributes':_0x5d39f0[_0x781f('0x20')]?_0x5d39f0[_0x781f('0x20')]['attributes']||null:null,'limit':_0x5d39f0[_0x781f('0x20')]?_0x5d39f0[_0x781f('0x20')]['limit']||null:null})[_0x781f('0x11')](function(_0x5d54bd){logger[_0x781f('0x12')]('UpdateSmsInteraction',_0x5d39f0);logger[_0x781f('0x15')](_0x781f('0x21'),_0x5d39f0,JSON[_0x781f('0x22')](_0x5d54bd));_0x5e82cd(_0x5d54bd);})['catch'](function(_0x2edc7b){logger[_0x781f('0x17')](_0x781f('0x21'),_0x2edc7b[_0x781f('0x19')],_0x5d39f0);_0x11e34c(_0x42dac9['error'](0x1f4,_0x2edc7b[_0x781f('0x19')]));});});};exports[_0x781f('0x23')]=function(_0x52d058){return new Promise(function(_0x3c9be5,_0x504400){return db['SmsInteraction']['find']({'where':_0x52d058[_0x781f('0x20')]?_0x52d058[_0x781f('0x20')]['where']||null:null})[_0x781f('0x11')](function(_0x79d0a0){if(_0x79d0a0){return _0x79d0a0['addTags'](_0x52d058[_0x781f('0x1e')][_0x781f('0x24')],_[_0x781f('0x25')](_0x52d058[_0x781f('0x1e')],[_0x781f('0x24'),'id'])||{});}})[_0x781f('0x26')](function(_0x525697){logger['info'](_0x781f('0x27'),_0x52d058);logger['debug'](_0x781f('0x27'),_0x52d058,JSON['stringify'](_0x525697));_0x3c9be5(_0x525697);})[_0x781f('0x1b')](function(_0x3cc02e){logger[_0x781f('0x17')](_0x781f('0x27'),_0x3cc02e[_0x781f('0x19')],_0x52d058);_0x504400(_this['error'](0x1f4,_0x3cc02e[_0x781f('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 4e8bd7b..4b91f3d 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 _0x73b7=['removeListener','length','./smsInteraction.events','save','update','emit'];(function(_0x272745,_0xdbc3af){var _0x4db262=function(_0x15aad7){while(--_0x15aad7){_0x272745['push'](_0x272745['shift']());}};_0x4db262(++_0xdbc3af);}(_0x73b7,0x8c));var _0x773b=function(_0x558e2f,_0x228d05){_0x558e2f=_0x558e2f-0x0;var _0xdc8996=_0x73b7[_0x558e2f];return _0xdc8996;};'use strict';var SmsInteractionEvents=require(_0x773b('0x0'));var events=[_0x773b('0x1'),'remove',_0x773b('0x2')];function createListener(_0x3ae3d0,_0x5b14b3){return function(_0x49002d){_0x5b14b3[_0x773b('0x3')](_0x3ae3d0,_0x49002d);};}function removeListener(_0x1f3b82,_0x1af7ac){return function(){SmsInteractionEvents[_0x773b('0x4')](_0x1f3b82,_0x1af7ac);};}exports['register']=function(_0x16b8ba){for(var _0x4c994a=0x0,_0xfcfb1a=events[_0x773b('0x5')];_0x4c994a<_0xfcfb1a;_0x4c994a++){var _0x40812c=events[_0x4c994a];var _0x5aca99=createListener('smsInteraction:'+_0x40812c,_0x16b8ba);SmsInteractionEvents['on'](_0x40812c,_0x5aca99);}}; \ No newline at end of file +var _0x0904=['save','update','emit','register','smsInteraction:','./smsInteraction.events'];(function(_0x1137e4,_0x365fab){var _0x2465a6=function(_0x33e38d){while(--_0x33e38d){_0x1137e4['push'](_0x1137e4['shift']());}};_0x2465a6(++_0x365fab);}(_0x0904,0x65));var _0x4090=function(_0x366e99,_0x15d82d){_0x366e99=_0x366e99-0x0;var _0x180bbe=_0x0904[_0x366e99];return _0x180bbe;};'use strict';var SmsInteractionEvents=require(_0x4090('0x0'));var events=[_0x4090('0x1'),'remove',_0x4090('0x2')];function createListener(_0x1179c9,_0x1be91a){return function(_0x8d9f60){_0x1be91a[_0x4090('0x3')](_0x1179c9,_0x8d9f60);};}function removeListener(_0x47efd9,_0x4ae929){return function(){SmsInteractionEvents['removeListener'](_0x47efd9,_0x4ae929);};}exports[_0x4090('0x4')]=function(_0x32777b){for(var _0x42b5c3=0x0,_0x40b1ff=events['length'];_0x42b5c3<_0x40b1ff;_0x42b5c3++){var _0x2513a5=events[_0x42b5c3];var _0x8e133c=createListener(_0x4090('0x5')+_0x2513a5,_0x32777b);SmsInteractionEvents['on'](_0x2513a5,_0x8e133c);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index 348eb52..69680a0 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 _0x9cc0=['isAuthenticated','index','describe','/:id','show','smsmessage:create','create','post','/:id/status','put','update','/:id/accept','accept','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get'];(function(_0x50f5e6,_0x58a348){var _0x56420b=function(_0x22ec46){while(--_0x22ec46){_0x50f5e6['push'](_0x50f5e6['shift']());}};_0x56420b(++_0x58a348);}(_0x9cc0,0x81));var _0x09cc=function(_0x3a0ebd,_0x47f368){_0x3a0ebd=_0x3a0ebd-0x0;var _0x51a660=_0x9cc0[_0x3a0ebd];return _0x51a660;};'use strict';var multer=require(_0x09cc('0x0'));var util=require(_0x09cc('0x1'));var path=require(_0x09cc('0x2'));var timeout=require(_0x09cc('0x3'));var express=require(_0x09cc('0x4'));var router=express[_0x09cc('0x5')]();var fs_extra=require(_0x09cc('0x6'));var auth=require(_0x09cc('0x7'));var interaction=require(_0x09cc('0x8'));var config=require('../../config/environment');var controller=require(_0x09cc('0x9'));router[_0x09cc('0xa')]('/',auth[_0x09cc('0xb')](),controller[_0x09cc('0xc')]);router['get']('/describe',auth[_0x09cc('0xb')](),controller[_0x09cc('0xd')]);router[_0x09cc('0xa')](_0x09cc('0xe'),auth[_0x09cc('0xb')](),controller[_0x09cc('0xf')]);router['post']('/',auth[_0x09cc('0xb')](),interaction['tracked']('sms',_0x09cc('0x10')),controller[_0x09cc('0x11')]);router[_0x09cc('0x12')](_0x09cc('0x13'),controller['status']);router[_0x09cc('0x14')]('/:id',auth['isAuthenticated'](),controller[_0x09cc('0x15')]);router[_0x09cc('0x14')](_0x09cc('0x16'),auth[_0x09cc('0xb')](),controller[_0x09cc('0x17')]);router[_0x09cc('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0x09cc('0x18')]);router[_0x09cc('0x19')](_0x09cc('0xe'),auth[_0x09cc('0xb')](),controller[_0x09cc('0x1a')]);module[_0x09cc('0x1b')]=router; \ No newline at end of file +var _0xc909=['create','post','/:id/status','status','put','/:id/reject','reject','delete','destroy','exports','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./smsMessage.controller','get','isAuthenticated','/describe','describe','/:id','show','tracked','sms','smsmessage:create'];(function(_0x5ebce8,_0x48fdfc){var _0x205646=function(_0x1fe96c){while(--_0x1fe96c){_0x5ebce8['push'](_0x5ebce8['shift']());}};_0x205646(++_0x48fdfc);}(_0xc909,0xda));var _0x9c90=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0xc909[_0x9cd4c3];return _0x4c9025;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x9c90('0x0'));var timeout=require(_0x9c90('0x1'));var express=require(_0x9c90('0x2'));var router=express['Router']();var fs_extra=require(_0x9c90('0x3'));var auth=require(_0x9c90('0x4'));var interaction=require(_0x9c90('0x5'));var config=require('../../config/environment');var controller=require(_0x9c90('0x6'));router[_0x9c90('0x7')]('/',auth[_0x9c90('0x8')](),controller['index']);router[_0x9c90('0x7')](_0x9c90('0x9'),auth['isAuthenticated'](),controller[_0x9c90('0xa')]);router['get'](_0x9c90('0xb'),auth[_0x9c90('0x8')](),controller[_0x9c90('0xc')]);router['post']('/',auth[_0x9c90('0x8')](),interaction[_0x9c90('0xd')](_0x9c90('0xe'),_0x9c90('0xf')),controller[_0x9c90('0x10')]);router[_0x9c90('0x11')](_0x9c90('0x12'),controller[_0x9c90('0x13')]);router[_0x9c90('0x14')](_0x9c90('0xb'),auth[_0x9c90('0x8')](),controller['update']);router['put']('/:id/accept',auth[_0x9c90('0x8')](),controller['accept']);router[_0x9c90('0x14')](_0x9c90('0x15'),auth['isAuthenticated'](),controller[_0x9c90('0x16')]);router[_0x9c90('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x9c90('0x18')]);module[_0x9c90('0x19')]=router; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.attributes.js b/server/api/smsMessage/smsMessage.attributes.js index 83647a8..0470f0d 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 _0xac9d=['medium','BOOLEAN','ENUM','out','STRING','sequelize','exports','TEXT'];(function(_0x2330fd,_0x56e9c7){var _0x5c1eba=function(_0x517719){while(--_0x517719){_0x2330fd['push'](_0x2330fd['shift']());}};_0x5c1eba(++_0x56e9c7);}(_0xac9d,0x14d));var _0xdac9=function(_0x3ea8b8,_0x508efb){_0x3ea8b8=_0x3ea8b8-0x0;var _0x7d213f=_0xac9d[_0x3ea8b8];return _0x7d213f;};'use strict';var Sequelize=require(_0xdac9('0x0'));module[_0xdac9('0x1')]={'body':{'type':Sequelize[_0xdac9('0x2')](_0xdac9('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xdac9('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdac9('0x5')]('in',_0xdac9('0x6')),'defaultValue':_0xdac9('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xdac9('0x7')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xdac9('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xdac9('0x7')]},'providerResponse':{'type':Sequelize[_0xdac9('0x2')]}}; \ No newline at end of file +var _0xd338=['sequelize','TEXT','ENUM','out','STRING'];(function(_0x5867dc,_0x3f6ee1){var _0xf6f1e0=function(_0x915d70){while(--_0x915d70){_0x5867dc['push'](_0x5867dc['shift']());}};_0xf6f1e0(++_0x3f6ee1);}(_0xd338,0x1f4));var _0x8d33=function(_0x557fd2,_0x2c0a7a){_0x557fd2=_0x557fd2-0x0;var _0x1b54a2=_0xd338[_0x557fd2];return _0x1b54a2;};'use strict';var Sequelize=require(_0x8d33('0x0'));module['exports']={'body':{'type':Sequelize[_0x8d33('0x1')]('medium'),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x8d33('0x2')]('in',_0x8d33('0x3')),'defaultValue':_0x8d33('0x3'),'allowNull':![]},'messageId':{'type':Sequelize[_0x8d33('0x4')](0xbe)},'phone':{'type':Sequelize[_0x8d33('0x4')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x8d33('0x4')]},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index e98e3b6..fde48a4 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 _0x21a9=['request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','request','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','SmsMessage,\x20%s,\x20%s','result','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','json','apply','update','name','send','index','map','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','VIRTUAL','options','includeAll','SmsMessage','findAll','rows','catch','show','include','create','body','find','params','destroy','describe','sms-interactions','accept','sms','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','SmsInteractionId','isNil','read1stAt','format','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','fullname','manual','SIP/%s','channel','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','Sequelize','User','email','interface','event','rejectmessage','SmsAccountId','received\x20delivery\x20report\x20from','inspect','twilio','MessageSid','plivo','MessageUUID','indexOf','delivered','Status','plivio','results','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','infobip','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x21a9,0x126));var _0x921a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x21a9[_0x4a9fb1];return _0x348672;};'use strict';var emlformat=require(_0x921a('0x0'));var rimraf=require(_0x921a('0x1'));var zipdir=require(_0x921a('0x2'));var jsonpatch=require(_0x921a('0x3'));var rp=require(_0x921a('0x4'));var moment=require('moment');var BPromise=require(_0x921a('0x5'));var Mustache=require(_0x921a('0x6'));var util=require(_0x921a('0x7'));var path=require(_0x921a('0x8'));var sox=require(_0x921a('0x9'));var csv=require(_0x921a('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x921a('0xb'));var _=require(_0x921a('0xc'));var squel=require(_0x921a('0xd'));var crypto=require(_0x921a('0xe'));var jsforce=require(_0x921a('0xf'));var deskjs=require(_0x921a('0x10'));var toCsv=require(_0x921a('0xa'));var querystring=require(_0x921a('0x11'));var Papa=require('papaparse');var Redis=require(_0x921a('0x12'));var authService=require(_0x921a('0x13'));var qs=require(_0x921a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x921a('0x15'));var logger=require(_0x921a('0x16'))(_0x921a('0x17'));var utils=require('../../config/utils');var config=require(_0x921a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x921a('0x19'))['db'];config[_0x921a('0x1a')]=_['defaults'](config[_0x921a('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x921a('0x1b'))(new Redis(config[_0x921a('0x1a')]));require(_0x921a('0x1c'))[_0x921a('0x1d')](socket);var jayson=require(_0x921a('0x1e'));var client=jayson['client'][_0x921a('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x921a('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x35e55e,_0x138632,_0x186a5f,_0x4a73f1){return new BPromise(function(_0x22b32c,_0x197052){var _0x52eb69=_0x4a73f1||client;return _0x52eb69[_0x921a('0x20')](_0x35e55e,_0x186a5f)[_0x921a('0x21')](function(_0x2daf8d){logger[_0x921a('0x22')]('SmsMessage,\x20%s,\x20%s',_0x138632,_0x921a('0x23'));logger[_0x921a('0x24')](_0x921a('0x25'),_0x138632,'request\x20sent',JSON[_0x921a('0x26')](_0x2daf8d));if(_0x2daf8d[_0x921a('0x27')]){if(_0x2daf8d[_0x921a('0x27')][_0x921a('0x28')]===0x1f4){logger[_0x921a('0x27')]('SmsMessage,\x20%s,\x20%s',_0x138632,_0x2daf8d[_0x921a('0x27')][_0x921a('0x29')]);return _0x197052(_0x2daf8d[_0x921a('0x27')][_0x921a('0x29')]);}logger[_0x921a('0x27')](_0x921a('0x2a'),_0x138632,_0x2daf8d[_0x921a('0x27')][_0x921a('0x29')]);return _0x22b32c(_0x2daf8d['error'][_0x921a('0x29')]);}else{logger[_0x921a('0x22')]('SmsMessage,\x20%s,\x20%s',_0x138632,_0x921a('0x23'));_0x22b32c(_0x2daf8d[_0x921a('0x2b')][_0x921a('0x29')]);}})['catch'](function(_0x54e055){logger[_0x921a('0x27')](_0x921a('0x2a'),_0x138632,_0x54e055);_0x197052(_0x54e055);});});}function respondWithStatusCode(_0x26a357,_0x44bd5e){_0x44bd5e=_0x44bd5e||0xcc;return function(_0x189d25){if(_0x189d25){return _0x26a357[_0x921a('0x2c')](_0x44bd5e);}return _0x26a357[_0x921a('0x2d')](_0x44bd5e)[_0x921a('0x2e')]();};}function respondWithResult(_0x2bd154,_0x5c4c9b){_0x5c4c9b=_0x5c4c9b||0xc8;return function(_0x3ef372){if(_0x3ef372){return _0x2bd154[_0x921a('0x2d')](_0x5c4c9b)['json'](_0x3ef372);}};}function respondWithFilteredResult(_0x57e720,_0x2de4b4){return function(_0x4794ec){if(_0x4794ec){var _0x28fd84=typeof _0x2de4b4[_0x921a('0x2f')]==='undefined'&&typeof _0x2de4b4[_0x921a('0x30')]===_0x921a('0x31');var _0x517869=_0x4794ec[_0x921a('0x32')];var _0x470840=_0x28fd84?0x0:_0x2de4b4['offset'];var _0x4c303c=_0x28fd84?_0x4794ec['count']:_0x2de4b4[_0x921a('0x2f')]+_0x2de4b4[_0x921a('0x30')];var _0x25b2b1;if(_0x4c303c>=_0x517869){_0x4c303c=_0x517869;_0x25b2b1=0xc8;}else{_0x25b2b1=0xce;}_0x57e720[_0x921a('0x2d')](_0x25b2b1);return _0x57e720[_0x921a('0x33')](_0x921a('0x34'),_0x470840+'-'+_0x4c303c+'/'+_0x517869)[_0x921a('0x35')](_0x4794ec);}return null;};}function patchUpdates(_0x405a4f){return function(_0x3b5b98){try{jsonpatch[_0x921a('0x36')](_0x3b5b98,_0x405a4f,!![]);}catch(_0x575074){return BPromise['reject'](_0x575074);}return _0x3b5b98['save']();};}function saveUpdates(_0x128170,_0xdc557e){return function(_0x39a447){if(_0x39a447){return _0x39a447[_0x921a('0x37')](_0x128170)['then'](function(_0x2c0898){return _0x2c0898;});}return null;};}function removeEntity(_0x14db58,_0x1937e4){return function(_0x4c91d0){if(_0x4c91d0){return _0x4c91d0['destroy']()['then'](function(){_0x14db58['status'](0xcc)[_0x921a('0x2e')]();});}};}function handleEntityNotFound(_0x154f93,_0x130ce7){return function(_0x58a06c){if(!_0x58a06c){_0x154f93[_0x921a('0x2c')](0x194);}return _0x58a06c;};}function handleError(_0x6df59a,_0x2800df){_0x2800df=_0x2800df||0x1f4;return function(_0x4a5ef5){logger[_0x921a('0x27')](_0x4a5ef5['stack']);if(_0x4a5ef5[_0x921a('0x38')]){delete _0x4a5ef5[_0x921a('0x38')];}_0x6df59a[_0x921a('0x2d')](_0x2800df)[_0x921a('0x39')](_0x4a5ef5);};}exports[_0x921a('0x3a')]=function(_0x6a2a88,_0x3df32a){var _0x27d8d2={},_0x51a126={},_0x2058f5={'count':0x0,'rows':[]};var _0x271507=_[_0x921a('0x3b')](db['SmsMessage'][_0x921a('0x3c')],function(_0x5a7f53){return{'name':_0x5a7f53[_0x921a('0x3d')],'type':_0x5a7f53['type'][_0x921a('0x3e')]};});_0x51a126[_0x921a('0x3f')]=_[_0x921a('0x3b')](_0x271507,_0x921a('0x38'));_0x51a126[_0x921a('0x40')]=_[_0x921a('0x41')](_0x6a2a88[_0x921a('0x40')]);_0x51a126[_0x921a('0x42')]=_[_0x921a('0x43')](_0x51a126[_0x921a('0x3f')],_0x51a126[_0x921a('0x40')]);_0x27d8d2[_0x921a('0x44')]=_[_0x921a('0x43')](_0x51a126[_0x921a('0x3f')],qs['fields'](_0x6a2a88[_0x921a('0x40')][_0x921a('0x45')]));_0x27d8d2['attributes']=_0x27d8d2[_0x921a('0x44')][_0x921a('0x46')]?_0x27d8d2[_0x921a('0x44')]:_0x51a126[_0x921a('0x3f')];if(!_0x6a2a88['query'][_0x921a('0x47')](_0x921a('0x48'))){_0x27d8d2[_0x921a('0x30')]=qs[_0x921a('0x30')](_0x6a2a88['query']['limit']);_0x27d8d2[_0x921a('0x2f')]=qs[_0x921a('0x2f')](_0x6a2a88[_0x921a('0x40')][_0x921a('0x2f')]);}_0x27d8d2[_0x921a('0x49')]=qs[_0x921a('0x4a')](_0x6a2a88['query']['sort']);_0x27d8d2['where']=qs[_0x921a('0x42')](_[_0x921a('0x4b')](_0x6a2a88[_0x921a('0x40')],_0x51a126[_0x921a('0x42')]),_0x271507);if(_0x6a2a88['query'][_0x921a('0x4c')]){_0x27d8d2[_0x921a('0x4d')]=_[_0x921a('0x4e')](_0x27d8d2[_0x921a('0x4d')],{'$or':_[_0x921a('0x3b')](_0x271507,function(_0x40cfaa){if(_0x40cfaa[_0x921a('0x4f')]!==_0x921a('0x50')){var _0x10e37f={};_0x10e37f[_0x40cfaa[_0x921a('0x38')]]={'$like':'%'+_0x6a2a88['query'][_0x921a('0x4c')]+'%'};return _0x10e37f;}})});}_0x27d8d2=_[_0x921a('0x4e')]({},_0x27d8d2,_0x6a2a88[_0x921a('0x51')]);var _0x50aefd={'where':_0x27d8d2['where']};return db['SmsMessage']['count'](_0x50aefd)[_0x921a('0x21')](function(_0x489d4f){_0x2058f5[_0x921a('0x32')]=_0x489d4f;if(_0x6a2a88[_0x921a('0x40')][_0x921a('0x52')]){_0x27d8d2['include']=[{'all':!![]}];}return db[_0x921a('0x53')][_0x921a('0x54')](_0x27d8d2);})[_0x921a('0x21')](function(_0x15caef){_0x2058f5[_0x921a('0x55')]=_0x15caef;return _0x2058f5;})[_0x921a('0x21')](respondWithFilteredResult(_0x3df32a,_0x27d8d2))[_0x921a('0x56')](handleError(_0x3df32a,null));};exports[_0x921a('0x57')]=function(_0x21298a,_0x46c1e4){var _0x26f45b={'raw':!![],'where':{'id':_0x21298a['params']['id']}},_0x1ba7ea={};_0x1ba7ea[_0x921a('0x3f')]=_['keys'](db[_0x921a('0x53')][_0x921a('0x3c')]);_0x1ba7ea[_0x921a('0x40')]=_[_0x921a('0x41')](_0x21298a[_0x921a('0x40')]);_0x1ba7ea[_0x921a('0x42')]=_['intersection'](_0x1ba7ea['model'],_0x1ba7ea[_0x921a('0x40')]);_0x26f45b[_0x921a('0x44')]=_[_0x921a('0x43')](_0x1ba7ea['model'],qs[_0x921a('0x45')](_0x21298a[_0x921a('0x40')][_0x921a('0x45')]));_0x26f45b[_0x921a('0x44')]=_0x26f45b['attributes'][_0x921a('0x46')]?_0x26f45b[_0x921a('0x44')]:_0x1ba7ea['model'];if(_0x21298a[_0x921a('0x40')][_0x921a('0x52')]){_0x26f45b[_0x921a('0x58')]=[{'all':!![]}];}_0x26f45b=_['merge']({},_0x26f45b,_0x21298a[_0x921a('0x51')]);return db[_0x921a('0x53')]['find'](_0x26f45b)[_0x921a('0x21')](handleEntityNotFound(_0x46c1e4,null))[_0x921a('0x21')](respondWithResult(_0x46c1e4,null))['catch'](handleError(_0x46c1e4,null));};exports[_0x921a('0x59')]=function(_0x4abc6c,_0x62bc5d){return db[_0x921a('0x53')][_0x921a('0x59')](_0x4abc6c[_0x921a('0x5a')],{})['then'](respondWithResult(_0x62bc5d,0xc9))['catch'](handleError(_0x62bc5d,null));};exports[_0x921a('0x37')]=function(_0x164fb1,_0x10aac3){if(_0x164fb1['body']['id']){delete _0x164fb1['body']['id'];}return db[_0x921a('0x53')][_0x921a('0x5b')]({'where':{'id':_0x164fb1[_0x921a('0x5c')]['id']}})[_0x921a('0x21')](handleEntityNotFound(_0x10aac3,null))[_0x921a('0x21')](saveUpdates(_0x164fb1[_0x921a('0x5a')],null))['then'](respondWithResult(_0x10aac3,null))[_0x921a('0x56')](handleError(_0x10aac3,null));};exports[_0x921a('0x5d')]=function(_0xab0cd5,_0x317f03){return db['SmsMessage'][_0x921a('0x5b')]({'where':{'id':_0xab0cd5[_0x921a('0x5c')]['id']}})[_0x921a('0x21')](handleEntityNotFound(_0x317f03,null))[_0x921a('0x21')](removeEntity(_0x317f03,null))[_0x921a('0x56')](handleError(_0x317f03,null));};exports[_0x921a('0x5e')]=function(_0x368e1c,_0x58d27c){return db[_0x921a('0x53')][_0x921a('0x5e')]()[_0x921a('0x21')](respondWithResult(_0x58d27c,null))[_0x921a('0x56')](handleError(_0x58d27c,null));};var interaction_log=require(_0x921a('0x16'))(_0x921a('0x5f'));exports[_0x921a('0x60')]=function(_0x3df845,_0x1fe3ac,_0x21dcf7){var _0x5db63d={'agent':{},'channel':_0x921a('0x61')};if(_0x3df845[_0x921a('0x5a')]['id']){delete _0x3df845[_0x921a('0x5a')]['id'];}_0x3df845[_0x921a('0x5a')]['read']=!![];_0x3df845[_0x921a('0x5a')]['readAt']=moment()['format'](_0x921a('0x62'));_0x3df845[_0x921a('0x5a')][_0x921a('0x63')]=_0x3df845[_0x921a('0x5a')]['UserId']||_0x3df845[_0x921a('0x64')]['id'];_0x5db63d[_0x921a('0x65')]['id']=_0x3df845[_0x921a('0x5a')][_0x921a('0x63')];return db[_0x921a('0x53')][_0x921a('0x5b')]({'where':{'id':_0x3df845[_0x921a('0x5c')]['id'],'UserId':null}})[_0x921a('0x21')](handleEntityNotFound(_0x1fe3ac,null))[_0x921a('0x21')](saveUpdates(_0x3df845['body'],null))[_0x921a('0x21')](function(_0x36c0ca){if(_0x36c0ca){_0x5db63d[_0x921a('0x29')]=_0x36c0ca[_0x921a('0x66')]({'plain':!![]});return db[_0x921a('0x67')][_0x921a('0x5b')]({'where':{'id':_0x36c0ca[_0x921a('0x68')]}});}return null;})['then'](handleEntityNotFound(_0x1fe3ac,null))[_0x921a('0x21')](function(_0x41dd21){if(_0x41dd21){return _0x41dd21['update']({'UserId':_0x3df845[_0x921a('0x5a')]['UserId'],'read1stAt':_[_0x921a('0x69')](_0x41dd21[_0x921a('0x6a')])?moment()[_0x921a('0x6b')](_0x921a('0x62')):undefined});}return null;})['then'](function(_0x5c0b4b){if(_0x5c0b4b){_0x5db63d[_0x921a('0x6c')]=_0x5c0b4b[_0x921a('0x66')]({'plain':!![]});interaction_log[_0x921a('0x22')]('[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3df845[_0x921a('0x64')]['id'],_0x3df845[_0x921a('0x64')][_0x921a('0x38')],_0x3df845[_0x921a('0x64')]['role'],_0x5db63d['interaction']['id'],_0x3df845[_0x921a('0x5a')]?JSON[_0x921a('0x26')](_0x3df845[_0x921a('0x5a')]):_0x921a('0x6d'));return respondWithRpcPromise(_0x921a('0x6e'),_0x921a('0x6f'),_0x5db63d);}return null;})[_0x921a('0x21')](function(_0x2bfd17){var _0xf1b34b=_0x921a('0x70')+_0x2bfd17[_0x921a('0x29')][_0x921a('0x71')];return db[_0x921a('0x72')]['query'](_0xf1b34b,{'type':db['Sequelize'][_0x921a('0x73')][_0x921a('0x74')],'raw':!![]})[_0x921a('0x21')](function(_0x29d488){return _0x29d488;});})[_0x921a('0x21')](function(_0x1ed425){if(_0x1ed425){_0x5db63d['message'][_0x921a('0x75')]=_0x1ed425[0x0];if(!_0x3df845[_0x921a('0x5a')]['UserId'])return;return db['User']['find']({'where':{'id':_0x3df845[_0x921a('0x5a')][_0x921a('0x63')],'role':_0x921a('0x65')},'attributes':['id',_0x921a('0x38'),_0x921a('0x76'),'email','internal'],'raw':!![]});}return null;})[_0x921a('0x21')](function(_0x336bd1){if(!_0x336bd1)return null;_0x5db63d[_0x921a('0x29')][_0x921a('0x65')]=_0x336bd1;return _0x5db63d;})[_0x921a('0x21')](function(_0x48d453){if(_0x48d453){if(_0x3df845['body'][_0x921a('0x77')]){_0x5db63d[_0x921a('0x29')]['interface']=util['format'](_0x921a('0x78'),_0x3df845['user'][_0x921a('0x38')]);_0x5db63d['message'][_0x921a('0x79')]=_0x5db63d[_0x921a('0x79')];_0x5db63d['message']['event']=_0x921a('0x60');return respondWithRpcPromise('EventManager',_0x921a('0x7a'),{'event':_0x921a('0x7b'),'message':_0x5db63d[_0x921a('0x29')]},client9002)['then'](function(){return _0x5db63d;});}return _0x5db63d;}return null;})[_0x921a('0x21')](respondWithResult(_0x1fe3ac,null))[_0x921a('0x56')](handleError(_0x1fe3ac,null));};var interaction_log=require(_0x921a('0x16'))('sms-interactions');exports[_0x921a('0x7c')]=function(_0x4979a4,_0x59341a,_0x1cc9a9){var _0x1c0fec={'agent':{},'channel':_0x921a('0x61')};if(_0x4979a4[_0x921a('0x5a')]['id']){delete _0x4979a4[_0x921a('0x5a')]['id'];}_0x4979a4['body']['UserId']=_0x4979a4['body'][_0x921a('0x63')]||_0x4979a4[_0x921a('0x64')]['id'];_0x1c0fec['agent']['id']=_0x4979a4[_0x921a('0x5a')]['UserId'];return db['SmsMessage'][_0x921a('0x5b')]({'where':{'id':_0x4979a4[_0x921a('0x5c')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x59341a,null))[_0x921a('0x21')](function(_0x207e10){if(_0x207e10){_0x1c0fec['message']=_0x207e10[_0x921a('0x66')]({'plain':!![]});return db[_0x921a('0x67')]['find']({'where':{'id':_0x207e10['SmsInteractionId']}});}return null;})['then'](handleEntityNotFound(_0x59341a,null))[_0x921a('0x21')](function(_0xfc5c99){if(_0xfc5c99){_0x1c0fec[_0x921a('0x6c')]=_0xfc5c99['get']({'plain':!![]});interaction_log[_0x921a('0x22')](_0x921a('0x7d'),_0x4979a4[_0x921a('0x64')]['id'],_0x4979a4[_0x921a('0x64')][_0x921a('0x38')],_0x4979a4[_0x921a('0x64')][_0x921a('0x7e')],_0x1c0fec[_0x921a('0x6c')]['id'],_0x4979a4[_0x921a('0x5a')]?JSON[_0x921a('0x26')](_0x4979a4[_0x921a('0x5a')]):_0x921a('0x6d'));return respondWithRpcPromise(_0x921a('0x7f'),'rejectMessage',_0x1c0fec);}return null;})['then'](function(_0x52480f){var _0x34583c=_0x921a('0x70')+_0x52480f[_0x921a('0x29')][_0x921a('0x71')];return db[_0x921a('0x72')][_0x921a('0x40')](_0x34583c,{'type':db[_0x921a('0x80')][_0x921a('0x73')][_0x921a('0x74')],'raw':!![]})[_0x921a('0x21')](function(_0x3200fd){return _0x3200fd;});})[_0x921a('0x21')](function(_0x388b30){if(_0x388b30){_0x1c0fec[_0x921a('0x29')][_0x921a('0x75')]=_0x388b30[0x0];if(!_0x4979a4['body'][_0x921a('0x63')])return;return db[_0x921a('0x81')][_0x921a('0x5b')]({'where':{'id':_0x4979a4[_0x921a('0x5a')][_0x921a('0x63')],'role':_0x921a('0x65')},'attributes':['id',_0x921a('0x38'),_0x921a('0x76'),_0x921a('0x82'),'internal'],'raw':!![]});}return null;})[_0x921a('0x21')](function(_0x5939f1){if(!_0x5939f1)return null;_0x1c0fec[_0x921a('0x29')]['agent']=_0x5939f1;return _0x1c0fec;})[_0x921a('0x21')](function(_0x2cd43c){if(_0x2cd43c){_0x2cd43c['message'][_0x921a('0x83')]=util['format']('SIP/%s',_0x4979a4[_0x921a('0x64')][_0x921a('0x38')]);_0x2cd43c[_0x921a('0x29')]['channel']=_0x1c0fec[_0x921a('0x79')];_0x2cd43c[_0x921a('0x29')][_0x921a('0x84')]=_0x921a('0x7c');respondWithRpcPromise(_0x921a('0x7a'),'EventManager',{'event':_0x921a('0x85'),'message':_0x2cd43c[_0x921a('0x29')]},client9002);return _0x1c0fec;}return null;})['then'](respondWithResult(_0x59341a,null))['catch'](handleError(_0x59341a,null));};exports[_0x921a('0x2d')]=function(_0x23fb67,_0x19c3d5,_0xb8eddf){if(_0x23fb67['body']['id']){delete _0x23fb67[_0x921a('0x5a')]['id'];}var _0x5e9356;return db[_0x921a('0x53')]['find']({'where':{'id':_0x23fb67[_0x921a('0x5c')]['id']}})[_0x921a('0x21')](handleEntityNotFound(_0x19c3d5,null))[_0x921a('0x21')](function(_0x65a42d){if(_0x65a42d){_0x5e9356=_0x65a42d;return db['SmsAccount']['find']({'where':{'id':_0x65a42d[_0x921a('0x86')]}});}})['then'](handleEntityNotFound(_0x19c3d5,null))[_0x921a('0x21')](function(_0x25d36e){if(_0x25d36e){logger[_0x921a('0x24')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x921a('0x2d'),_0x921a('0x87'),_0x25d36e['type'],util[_0x921a('0x88')](_0x23fb67['body'],{'showHidden':![],'depth':null}));switch(_0x25d36e[_0x921a('0x4f')]){case _0x921a('0x89'):if(_0x23fb67['body']['MessageSid']&&_0x23fb67[_0x921a('0x5a')][_0x921a('0x8a')]===_0x5e9356['messageId']){return _0x5e9356['update']({'read':!![]});}else{logger[_0x921a('0x27')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x921a('0x2d'),_0x921a('0x89'),util[_0x921a('0x88')](_0x23fb67[_0x921a('0x5a')],{'showHidden':![],'depth':null}));}break;case _0x921a('0x8b'):if(_0x23fb67[_0x921a('0x5a')][_0x921a('0x8c')]&&_0x23fb67[_0x921a('0x5a')][_0x921a('0x8c')]===_0x5e9356['messageId']&&_[_0x921a('0x8d')](['sent',_0x921a('0x8e')],_0x23fb67[_0x921a('0x5a')][_0x921a('0x8f')])>=0x0){return _0x5e9356[_0x921a('0x37')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0x921a('0x90'),util[_0x921a('0x88')](_0x23fb67[_0x921a('0x5a')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x546d93=_0x23fb67[_0x921a('0x5a')][_0x921a('0x91')][0x0];if(_0x546d93[_0x921a('0x2d')]['groupName']===_0x921a('0x92')){return _0x5e9356[_0x921a('0x37')]({'read':!![]});}else{logger[_0x921a('0x27')](_0x921a('0x93'),_0x921a('0x2d'),_0x921a('0x94'),util[_0x921a('0x88')](_0x23fb67['body'],{'showHidden':![],'depth':null}));}break;}return _0x5e9356;}})[_0x921a('0x21')](respondWithResult(_0x19c3d5,null))['catch'](handleError(_0x19c3d5,null));}; \ No newline at end of file +var _0xcf9d=['SELECT','contact','User','fullname','email','internal','manual','interface','format','channel','event','EventManager','acceptmessage','reject','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','QueryTypes','SmsAccount','SmsAccountId','received\x20delivery\x20report\x20from','twilio','MessageSid','MessageUUID','messageId','indexOf','sent','delivered','Status','plivio','inspect','infobip','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','ejs','lodash','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','./smsMessage.socket','register','jayson/promise','client','http','request','info','SmsMessage,\x20%s,\x20%s','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','end','json','offset','undefined','count','Content-Range','apply','save','update','destroy','stack','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','limit','order','where','pick','filter','name','merge','options','SmsMessage','then','includeAll','findAll','rows','show','params','include','find','create','body','describe','sms-interactions','accept','sms','read','readAt','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','SmsInteraction','isNil','interaction','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize'];(function(_0x2c9e47,_0x20ff4a){var _0x151039=function(_0x253832){while(--_0x253832){_0x2c9e47['push'](_0x2c9e47['shift']());}};_0x151039(++_0x20ff4a);}(_0xcf9d,0xb0));var _0xdcf9=function(_0x22d6dc,_0x500359){_0x22d6dc=_0x22d6dc-0x0;var _0x203060=_0xcf9d[_0x22d6dc];return _0x203060;};'use strict';var emlformat=require(_0xdcf9('0x0'));var rimraf=require(_0xdcf9('0x1'));var zipdir=require(_0xdcf9('0x2'));var jsonpatch=require(_0xdcf9('0x3'));var rp=require(_0xdcf9('0x4'));var moment=require(_0xdcf9('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xdcf9('0x6'));var util=require('util');var path=require(_0xdcf9('0x7'));var sox=require(_0xdcf9('0x8'));var csv=require('to-csv');var ejs=require(_0xdcf9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcf9('0xa'));var squel=require('squel');var crypto=require(_0xdcf9('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xdcf9('0xc'));var querystring=require(_0xdcf9('0xd'));var Papa=require('papaparse');var Redis=require(_0xdcf9('0xe'));var authService=require(_0xdcf9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xdcf9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xdcf9('0x11'))(_0xdcf9('0x12'));var utils=require(_0xdcf9('0x13'));var config=require(_0xdcf9('0x14'));var licenseUtil=require(_0xdcf9('0x15'));var db=require(_0xdcf9('0x16'))['db'];config[_0xdcf9('0x17')]=_['defaults'](config[_0xdcf9('0x17')],{'host':_0xdcf9('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdcf9('0x17')]));require(_0xdcf9('0x19'))[_0xdcf9('0x1a')](socket);var jayson=require(_0xdcf9('0x1b'));var client=jayson[_0xdcf9('0x1c')]['http']({'port':0x232c});var client9002=jayson[_0xdcf9('0x1c')][_0xdcf9('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x237dd3,_0x3eae49,_0x4e0715,_0x240652){return new BPromise(function(_0x437285,_0x4b2c39){var _0x57fb35=_0x240652||client;return _0x57fb35[_0xdcf9('0x1e')](_0x237dd3,_0x4e0715)['then'](function(_0x22fb85){logger[_0xdcf9('0x1f')](_0xdcf9('0x20'),_0x3eae49,_0xdcf9('0x21'));logger['debug'](_0xdcf9('0x22'),_0x3eae49,_0xdcf9('0x21'),JSON[_0xdcf9('0x23')](_0x22fb85));if(_0x22fb85[_0xdcf9('0x24')]){if(_0x22fb85['error']['code']===0x1f4){logger[_0xdcf9('0x24')](_0xdcf9('0x20'),_0x3eae49,_0x22fb85[_0xdcf9('0x24')][_0xdcf9('0x25')]);return _0x4b2c39(_0x22fb85[_0xdcf9('0x24')][_0xdcf9('0x25')]);}logger[_0xdcf9('0x24')]('SmsMessage,\x20%s,\x20%s',_0x3eae49,_0x22fb85['error']['message']);return _0x437285(_0x22fb85['error'][_0xdcf9('0x25')]);}else{logger[_0xdcf9('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x3eae49,_0xdcf9('0x21'));_0x437285(_0x22fb85['result'][_0xdcf9('0x25')]);}})[_0xdcf9('0x26')](function(_0x121d28){logger[_0xdcf9('0x24')](_0xdcf9('0x20'),_0x3eae49,_0x121d28);_0x4b2c39(_0x121d28);});});}function respondWithStatusCode(_0x1f3e2a,_0x421e35){_0x421e35=_0x421e35||0xcc;return function(_0x4996c2){if(_0x4996c2){return _0x1f3e2a[_0xdcf9('0x27')](_0x421e35);}return _0x1f3e2a[_0xdcf9('0x28')](_0x421e35)[_0xdcf9('0x29')]();};}function respondWithResult(_0x2ecfc6,_0x490a54){_0x490a54=_0x490a54||0xc8;return function(_0x4a9515){if(_0x4a9515){return _0x2ecfc6[_0xdcf9('0x28')](_0x490a54)[_0xdcf9('0x2a')](_0x4a9515);}};}function respondWithFilteredResult(_0x124928,_0x195d95){return function(_0x113967){if(_0x113967){var _0x386bec=typeof _0x195d95[_0xdcf9('0x2b')]==='undefined'&&typeof _0x195d95['limit']===_0xdcf9('0x2c');var _0x2b69d9=_0x113967[_0xdcf9('0x2d')];var _0x26b2e9=_0x386bec?0x0:_0x195d95[_0xdcf9('0x2b')];var _0x34f4cf=_0x386bec?_0x113967[_0xdcf9('0x2d')]:_0x195d95['offset']+_0x195d95['limit'];var _0x45b379;if(_0x34f4cf>=_0x2b69d9){_0x34f4cf=_0x2b69d9;_0x45b379=0xc8;}else{_0x45b379=0xce;}_0x124928[_0xdcf9('0x28')](_0x45b379);return _0x124928['set'](_0xdcf9('0x2e'),_0x26b2e9+'-'+_0x34f4cf+'/'+_0x2b69d9)[_0xdcf9('0x2a')](_0x113967);}return null;};}function patchUpdates(_0x225563){return function(_0x232a21){try{jsonpatch[_0xdcf9('0x2f')](_0x232a21,_0x225563,!![]);}catch(_0x35236e){return BPromise['reject'](_0x35236e);}return _0x232a21[_0xdcf9('0x30')]();};}function saveUpdates(_0x30ca4f,_0x101200){return function(_0x2a4f0c){if(_0x2a4f0c){return _0x2a4f0c[_0xdcf9('0x31')](_0x30ca4f)['then'](function(_0x16804f){return _0x16804f;});}return null;};}function removeEntity(_0xe078c6,_0x1d6866){return function(_0x1705bf){if(_0x1705bf){return _0x1705bf[_0xdcf9('0x32')]()['then'](function(){_0xe078c6[_0xdcf9('0x28')](0xcc)[_0xdcf9('0x29')]();});}};}function handleEntityNotFound(_0x35667a,_0x378171){return function(_0x30e910){if(!_0x30e910){_0x35667a[_0xdcf9('0x27')](0x194);}return _0x30e910;};}function handleError(_0x1fdd21,_0xd4a9b1){_0xd4a9b1=_0xd4a9b1||0x1f4;return function(_0x20cd62){logger[_0xdcf9('0x24')](_0x20cd62[_0xdcf9('0x33')]);if(_0x20cd62['name']){delete _0x20cd62['name'];}_0x1fdd21[_0xdcf9('0x28')](_0xd4a9b1)['send'](_0x20cd62);};}exports['index']=function(_0x57fbb1,_0x47f7b9){var _0x445b44={},_0x518eea={},_0x176f0b={'count':0x0,'rows':[]};var _0xee2103=_[_0xdcf9('0x34')](db['SmsMessage'][_0xdcf9('0x35')],function(_0x83bba5){return{'name':_0x83bba5[_0xdcf9('0x36')],'type':_0x83bba5[_0xdcf9('0x37')][_0xdcf9('0x38')]};});_0x518eea['model']=_[_0xdcf9('0x34')](_0xee2103,'name');_0x518eea[_0xdcf9('0x39')]=_[_0xdcf9('0x3a')](_0x57fbb1[_0xdcf9('0x39')]);_0x518eea[_0xdcf9('0x3b')]=_[_0xdcf9('0x3c')](_0x518eea[_0xdcf9('0x3d')],_0x518eea[_0xdcf9('0x39')]);_0x445b44['attributes']=_[_0xdcf9('0x3c')](_0x518eea[_0xdcf9('0x3d')],qs[_0xdcf9('0x3e')](_0x57fbb1[_0xdcf9('0x39')][_0xdcf9('0x3e')]));_0x445b44[_0xdcf9('0x3f')]=_0x445b44[_0xdcf9('0x3f')][_0xdcf9('0x40')]?_0x445b44[_0xdcf9('0x3f')]:_0x518eea[_0xdcf9('0x3d')];if(!_0x57fbb1[_0xdcf9('0x39')][_0xdcf9('0x41')](_0xdcf9('0x42'))){_0x445b44[_0xdcf9('0x43')]=qs[_0xdcf9('0x43')](_0x57fbb1[_0xdcf9('0x39')][_0xdcf9('0x43')]);_0x445b44[_0xdcf9('0x2b')]=qs[_0xdcf9('0x2b')](_0x57fbb1[_0xdcf9('0x39')][_0xdcf9('0x2b')]);}_0x445b44[_0xdcf9('0x44')]=qs['sort'](_0x57fbb1['query']['sort']);_0x445b44[_0xdcf9('0x45')]=qs[_0xdcf9('0x3b')](_[_0xdcf9('0x46')](_0x57fbb1[_0xdcf9('0x39')],_0x518eea['filters']),_0xee2103);if(_0x57fbb1[_0xdcf9('0x39')][_0xdcf9('0x47')]){_0x445b44[_0xdcf9('0x45')]=_['merge'](_0x445b44[_0xdcf9('0x45')],{'$or':_[_0xdcf9('0x34')](_0xee2103,function(_0x142f61){if(_0x142f61[_0xdcf9('0x37')]!=='VIRTUAL'){var _0x4b5182={};_0x4b5182[_0x142f61[_0xdcf9('0x48')]]={'$like':'%'+_0x57fbb1[_0xdcf9('0x39')][_0xdcf9('0x47')]+'%'};return _0x4b5182;}})});}_0x445b44=_[_0xdcf9('0x49')]({},_0x445b44,_0x57fbb1[_0xdcf9('0x4a')]);var _0x2b42bc={'where':_0x445b44['where']};return db[_0xdcf9('0x4b')][_0xdcf9('0x2d')](_0x2b42bc)[_0xdcf9('0x4c')](function(_0x2f29c5){_0x176f0b['count']=_0x2f29c5;if(_0x57fbb1[_0xdcf9('0x39')][_0xdcf9('0x4d')]){_0x445b44['include']=[{'all':!![]}];}return db['SmsMessage'][_0xdcf9('0x4e')](_0x445b44);})[_0xdcf9('0x4c')](function(_0x5062cb){_0x176f0b[_0xdcf9('0x4f')]=_0x5062cb;return _0x176f0b;})[_0xdcf9('0x4c')](respondWithFilteredResult(_0x47f7b9,_0x445b44))[_0xdcf9('0x26')](handleError(_0x47f7b9,null));};exports[_0xdcf9('0x50')]=function(_0x18916a,_0x3f9fe2){var _0x4df9be={'raw':!![],'where':{'id':_0x18916a[_0xdcf9('0x51')]['id']}},_0x1bc8c4={};_0x1bc8c4[_0xdcf9('0x3d')]=_[_0xdcf9('0x3a')](db['SmsMessage'][_0xdcf9('0x35')]);_0x1bc8c4[_0xdcf9('0x39')]=_['keys'](_0x18916a[_0xdcf9('0x39')]);_0x1bc8c4['filters']=_[_0xdcf9('0x3c')](_0x1bc8c4['model'],_0x1bc8c4[_0xdcf9('0x39')]);_0x4df9be[_0xdcf9('0x3f')]=_[_0xdcf9('0x3c')](_0x1bc8c4['model'],qs['fields'](_0x18916a['query']['fields']));_0x4df9be['attributes']=_0x4df9be['attributes'][_0xdcf9('0x40')]?_0x4df9be[_0xdcf9('0x3f')]:_0x1bc8c4[_0xdcf9('0x3d')];if(_0x18916a['query'][_0xdcf9('0x4d')]){_0x4df9be[_0xdcf9('0x52')]=[{'all':!![]}];}_0x4df9be=_[_0xdcf9('0x49')]({},_0x4df9be,_0x18916a[_0xdcf9('0x4a')]);return db[_0xdcf9('0x4b')][_0xdcf9('0x53')](_0x4df9be)[_0xdcf9('0x4c')](handleEntityNotFound(_0x3f9fe2,null))[_0xdcf9('0x4c')](respondWithResult(_0x3f9fe2,null))[_0xdcf9('0x26')](handleError(_0x3f9fe2,null));};exports[_0xdcf9('0x54')]=function(_0x37b49c,_0x3c80e0){return db[_0xdcf9('0x4b')]['create'](_0x37b49c[_0xdcf9('0x55')],{})[_0xdcf9('0x4c')](respondWithResult(_0x3c80e0,0xc9))[_0xdcf9('0x26')](handleError(_0x3c80e0,null));};exports[_0xdcf9('0x31')]=function(_0x5a8449,_0x2f9530){if(_0x5a8449[_0xdcf9('0x55')]['id']){delete _0x5a8449['body']['id'];}return db[_0xdcf9('0x4b')][_0xdcf9('0x53')]({'where':{'id':_0x5a8449[_0xdcf9('0x51')]['id']}})['then'](handleEntityNotFound(_0x2f9530,null))[_0xdcf9('0x4c')](saveUpdates(_0x5a8449[_0xdcf9('0x55')],null))[_0xdcf9('0x4c')](respondWithResult(_0x2f9530,null))[_0xdcf9('0x26')](handleError(_0x2f9530,null));};exports[_0xdcf9('0x32')]=function(_0x3b5352,_0x201e06){return db[_0xdcf9('0x4b')]['find']({'where':{'id':_0x3b5352[_0xdcf9('0x51')]['id']}})[_0xdcf9('0x4c')](handleEntityNotFound(_0x201e06,null))[_0xdcf9('0x4c')](removeEntity(_0x201e06,null))[_0xdcf9('0x26')](handleError(_0x201e06,null));};exports['describe']=function(_0x486ed4,_0xdfc1d){return db[_0xdcf9('0x4b')][_0xdcf9('0x56')]()['then'](respondWithResult(_0xdfc1d,null))[_0xdcf9('0x26')](handleError(_0xdfc1d,null));};var interaction_log=require(_0xdcf9('0x11'))(_0xdcf9('0x57'));exports[_0xdcf9('0x58')]=function(_0x5be675,_0x3e4195,_0x582de2){var _0x226f34={'agent':{},'channel':_0xdcf9('0x59')};if(_0x5be675[_0xdcf9('0x55')]['id']){delete _0x5be675['body']['id'];}_0x5be675[_0xdcf9('0x55')][_0xdcf9('0x5a')]=!![];_0x5be675[_0xdcf9('0x55')][_0xdcf9('0x5b')]=moment()['format'](_0xdcf9('0x5c'));_0x5be675[_0xdcf9('0x55')]['UserId']=_0x5be675['body'][_0xdcf9('0x5d')]||_0x5be675[_0xdcf9('0x5e')]['id'];_0x226f34[_0xdcf9('0x5f')]['id']=_0x5be675['body'][_0xdcf9('0x5d')];return db[_0xdcf9('0x4b')][_0xdcf9('0x53')]({'where':{'id':_0x5be675['params']['id'],'UserId':null}})[_0xdcf9('0x4c')](handleEntityNotFound(_0x3e4195,null))[_0xdcf9('0x4c')](saveUpdates(_0x5be675[_0xdcf9('0x55')],null))['then'](function(_0x1edaeb){if(_0x1edaeb){_0x226f34[_0xdcf9('0x25')]=_0x1edaeb[_0xdcf9('0x60')]({'plain':!![]});return db[_0xdcf9('0x61')][_0xdcf9('0x53')]({'where':{'id':_0x1edaeb['SmsInteractionId']}});}return null;})[_0xdcf9('0x4c')](handleEntityNotFound(_0x3e4195,null))[_0xdcf9('0x4c')](function(_0x561da6){if(_0x561da6){return _0x561da6[_0xdcf9('0x31')]({'UserId':_0x5be675[_0xdcf9('0x55')][_0xdcf9('0x5d')],'read1stAt':_[_0xdcf9('0x62')](_0x561da6['read1stAt'])?moment()['format'](_0xdcf9('0x5c')):undefined});}return null;})[_0xdcf9('0x4c')](function(_0x406da2){if(_0x406da2){_0x226f34[_0xdcf9('0x63')]=_0x406da2[_0xdcf9('0x60')]({'plain':!![]});interaction_log[_0xdcf9('0x1f')](_0xdcf9('0x64'),_0x5be675['user']['id'],_0x5be675[_0xdcf9('0x5e')][_0xdcf9('0x48')],_0x5be675[_0xdcf9('0x5e')][_0xdcf9('0x65')],_0x226f34[_0xdcf9('0x63')]['id'],_0x5be675[_0xdcf9('0x55')]?JSON[_0xdcf9('0x23')](_0x5be675[_0xdcf9('0x55')]):_0xdcf9('0x66'));return respondWithRpcPromise('AcceptMessage','acceptMessage',_0x226f34);}return null;})[_0xdcf9('0x4c')](function(_0x311ba6){var _0xf3e73=_0xdcf9('0x67')+_0x311ba6[_0xdcf9('0x25')][_0xdcf9('0x68')];return db['sequelize'][_0xdcf9('0x39')](_0xf3e73,{'type':db[_0xdcf9('0x69')]['QueryTypes'][_0xdcf9('0x6a')],'raw':!![]})[_0xdcf9('0x4c')](function(_0x3de62f){return _0x3de62f;});})['then'](function(_0x14b145){if(_0x14b145){_0x226f34[_0xdcf9('0x25')][_0xdcf9('0x6b')]=_0x14b145[0x0];if(!_0x5be675[_0xdcf9('0x55')][_0xdcf9('0x5d')])return;return db[_0xdcf9('0x6c')][_0xdcf9('0x53')]({'where':{'id':_0x5be675[_0xdcf9('0x55')][_0xdcf9('0x5d')],'role':_0xdcf9('0x5f')},'attributes':['id',_0xdcf9('0x48'),_0xdcf9('0x6d'),_0xdcf9('0x6e'),_0xdcf9('0x6f')],'raw':!![]});}return null;})[_0xdcf9('0x4c')](function(_0x487e4c){if(!_0x487e4c)return null;_0x226f34[_0xdcf9('0x25')][_0xdcf9('0x5f')]=_0x487e4c;return _0x226f34;})[_0xdcf9('0x4c')](function(_0xc5b6cf){if(_0xc5b6cf){if(_0x5be675[_0xdcf9('0x55')][_0xdcf9('0x70')]){_0x226f34[_0xdcf9('0x25')][_0xdcf9('0x71')]=util[_0xdcf9('0x72')]('SIP/%s',_0x5be675['user'][_0xdcf9('0x48')]);_0x226f34['message'][_0xdcf9('0x73')]=_0x226f34[_0xdcf9('0x73')];_0x226f34[_0xdcf9('0x25')][_0xdcf9('0x74')]=_0xdcf9('0x58');return respondWithRpcPromise('EventManager',_0xdcf9('0x75'),{'event':_0xdcf9('0x76'),'message':_0x226f34[_0xdcf9('0x25')]},client9002)[_0xdcf9('0x4c')](function(){return _0x226f34;});}return _0x226f34;}return null;})[_0xdcf9('0x4c')](respondWithResult(_0x3e4195,null))[_0xdcf9('0x26')](handleError(_0x3e4195,null));};var interaction_log=require(_0xdcf9('0x11'))(_0xdcf9('0x57'));exports[_0xdcf9('0x77')]=function(_0x1097f6,_0x2704d4,_0xb4e7dc){var _0x25a41c={'agent':{},'channel':_0xdcf9('0x59')};if(_0x1097f6[_0xdcf9('0x55')]['id']){delete _0x1097f6['body']['id'];}_0x1097f6['body'][_0xdcf9('0x5d')]=_0x1097f6[_0xdcf9('0x55')][_0xdcf9('0x5d')]||_0x1097f6[_0xdcf9('0x5e')]['id'];_0x25a41c['agent']['id']=_0x1097f6[_0xdcf9('0x55')][_0xdcf9('0x5d')];return db[_0xdcf9('0x4b')]['find']({'where':{'id':_0x1097f6['params']['id'],'UserId':null}})[_0xdcf9('0x4c')](handleEntityNotFound(_0x2704d4,null))[_0xdcf9('0x4c')](function(_0x25c0b4){if(_0x25c0b4){_0x25a41c[_0xdcf9('0x25')]=_0x25c0b4['get']({'plain':!![]});return db[_0xdcf9('0x61')][_0xdcf9('0x53')]({'where':{'id':_0x25c0b4['SmsInteractionId']}});}return null;})[_0xdcf9('0x4c')](handleEntityNotFound(_0x2704d4,null))['then'](function(_0x17c64f){if(_0x17c64f){_0x25a41c[_0xdcf9('0x63')]=_0x17c64f[_0xdcf9('0x60')]({'plain':!![]});interaction_log[_0xdcf9('0x1f')](_0xdcf9('0x78'),_0x1097f6[_0xdcf9('0x5e')]['id'],_0x1097f6[_0xdcf9('0x5e')]['name'],_0x1097f6[_0xdcf9('0x5e')][_0xdcf9('0x65')],_0x25a41c[_0xdcf9('0x63')]['id'],_0x1097f6[_0xdcf9('0x55')]?JSON[_0xdcf9('0x23')](_0x1097f6[_0xdcf9('0x55')]):'null');return respondWithRpcPromise(_0xdcf9('0x79'),_0xdcf9('0x7a'),_0x25a41c);}return null;})[_0xdcf9('0x4c')](function(_0x4e2b68){var _0x2ac0ef=_0xdcf9('0x67')+_0x4e2b68[_0xdcf9('0x25')][_0xdcf9('0x68')];return db[_0xdcf9('0x7b')][_0xdcf9('0x39')](_0x2ac0ef,{'type':db[_0xdcf9('0x69')][_0xdcf9('0x7c')][_0xdcf9('0x6a')],'raw':!![]})[_0xdcf9('0x4c')](function(_0x419119){return _0x419119;});})[_0xdcf9('0x4c')](function(_0x353ca0){if(_0x353ca0){_0x25a41c['message'][_0xdcf9('0x6b')]=_0x353ca0[0x0];if(!_0x1097f6[_0xdcf9('0x55')][_0xdcf9('0x5d')])return;return db[_0xdcf9('0x6c')]['find']({'where':{'id':_0x1097f6[_0xdcf9('0x55')]['UserId'],'role':_0xdcf9('0x5f')},'attributes':['id',_0xdcf9('0x48'),_0xdcf9('0x6d'),'email','internal'],'raw':!![]});}return null;})[_0xdcf9('0x4c')](function(_0x394bf1){if(!_0x394bf1)return null;_0x25a41c[_0xdcf9('0x25')][_0xdcf9('0x5f')]=_0x394bf1;return _0x25a41c;})[_0xdcf9('0x4c')](function(_0x2e85aa){if(_0x2e85aa){_0x2e85aa['message'][_0xdcf9('0x71')]=util[_0xdcf9('0x72')]('SIP/%s',_0x1097f6[_0xdcf9('0x5e')][_0xdcf9('0x48')]);_0x2e85aa['message'][_0xdcf9('0x73')]=_0x25a41c['channel'];_0x2e85aa[_0xdcf9('0x25')][_0xdcf9('0x74')]=_0xdcf9('0x77');respondWithRpcPromise(_0xdcf9('0x75'),_0xdcf9('0x75'),{'event':'rejectmessage','message':_0x2e85aa[_0xdcf9('0x25')]},client9002);return _0x25a41c;}return null;})[_0xdcf9('0x4c')](respondWithResult(_0x2704d4,null))['catch'](handleError(_0x2704d4,null));};exports[_0xdcf9('0x28')]=function(_0x192b2b,_0x2f4781,_0x54d837){if(_0x192b2b[_0xdcf9('0x55')]['id']){delete _0x192b2b[_0xdcf9('0x55')]['id'];}var _0x342a31;return db[_0xdcf9('0x4b')][_0xdcf9('0x53')]({'where':{'id':_0x192b2b['params']['id']}})[_0xdcf9('0x4c')](handleEntityNotFound(_0x2f4781,null))[_0xdcf9('0x4c')](function(_0x3be8d8){if(_0x3be8d8){_0x342a31=_0x3be8d8;return db[_0xdcf9('0x7d')][_0xdcf9('0x53')]({'where':{'id':_0x3be8d8[_0xdcf9('0x7e')]}});}})[_0xdcf9('0x4c')](handleEntityNotFound(_0x2f4781,null))[_0xdcf9('0x4c')](function(_0xf0888f){if(_0xf0888f){logger['debug'](_0xdcf9('0x22'),'status',_0xdcf9('0x7f'),_0xf0888f['type'],util['inspect'](_0x192b2b[_0xdcf9('0x55')],{'showHidden':![],'depth':null}));switch(_0xf0888f['type']){case _0xdcf9('0x80'):if(_0x192b2b[_0xdcf9('0x55')]['MessageSid']&&_0x192b2b[_0xdcf9('0x55')][_0xdcf9('0x81')]===_0x342a31['messageId']){return _0x342a31[_0xdcf9('0x31')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xdcf9('0x80'),util['inspect'](_0x192b2b[_0xdcf9('0x55')],{'showHidden':![],'depth':null}));}break;case'plivo':if(_0x192b2b[_0xdcf9('0x55')][_0xdcf9('0x82')]&&_0x192b2b['body'][_0xdcf9('0x82')]===_0x342a31[_0xdcf9('0x83')]&&_[_0xdcf9('0x84')]([_0xdcf9('0x85'),_0xdcf9('0x86')],_0x192b2b[_0xdcf9('0x55')][_0xdcf9('0x87')])>=0x0){return _0x342a31['update']({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s','status',_0xdcf9('0x88'),util[_0xdcf9('0x89')](_0x192b2b[_0xdcf9('0x55')],{'showHidden':![],'depth':null}));}break;case _0xdcf9('0x8a'):var _0x95eaa=_0x192b2b[_0xdcf9('0x55')]['results'][0x0];if(_0x95eaa['status'][_0xdcf9('0x8b')]===_0xdcf9('0x8c')){return _0x342a31[_0xdcf9('0x31')]({'read':!![]});}else{logger[_0xdcf9('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xdcf9('0x28'),_0xdcf9('0x8a'),util[_0xdcf9('0x89')](_0x192b2b[_0xdcf9('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x342a31;}})[_0xdcf9('0x4c')](respondWithResult(_0x2f4781,null))[_0xdcf9('0x26')](handleError(_0x2f4781,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index b413095..6f85283 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 _0x9eb5=['SmsMessage','setMaxListeners','save','update','remove','emit','hook','exports','events','../../mysqldb'];(function(_0xab9352,_0x497dd7){var _0x16e292=function(_0x3a41cc){while(--_0x3a41cc){_0xab9352['push'](_0xab9352['shift']());}};_0x16e292(++_0x497dd7);}(_0x9eb5,0xee));var _0x59eb=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9eb5[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x59eb('0x0'));var SmsMessage=require(_0x59eb('0x1'))['db'][_0x59eb('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x59eb('0x3')](0x0);var events={'afterCreate':_0x59eb('0x4'),'afterUpdate':_0x59eb('0x5'),'afterDestroy':_0x59eb('0x6')};function emitEvent(_0x21a63c){return function(_0x5692eb,_0x2f0a53,_0x3c39b6){SmsMessageEvents[_0x59eb('0x7')](_0x21a63c+':'+_0x5692eb['id'],_0x5692eb);SmsMessageEvents['emit'](_0x21a63c,_0x5692eb);_0x3c39b6(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsMessage[_0x59eb('0x8')](e,emitEvent(event));}}module[_0x59eb('0x9')]=SmsMessageEvents; \ No newline at end of file +var _0xffc4=['hasOwnProperty','exports','events','SmsMessage','setMaxListeners','update','remove','emit'];(function(_0x5ecf83,_0x35f63e){var _0x271de2=function(_0x3b6f58){while(--_0x3b6f58){_0x5ecf83['push'](_0x5ecf83['shift']());}};_0x271de2(++_0x35f63e);}(_0xffc4,0x1b2));var _0x4ffc=function(_0x197160,_0x2dada2){_0x197160=_0x197160-0x0;var _0x5e53b0=_0xffc4[_0x197160];return _0x5e53b0;};'use strict';var EventEmitter=require(_0x4ffc('0x0'));var SmsMessage=require('../../mysqldb')['db'][_0x4ffc('0x1')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x4ffc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4ffc('0x3'),'afterDestroy':_0x4ffc('0x4')};function emitEvent(_0x6e009e){return function(_0x4ad990,_0x226967,_0x3710ff){SmsMessageEvents['emit'](_0x6e009e+':'+_0x4ad990['id'],_0x4ad990);SmsMessageEvents[_0x4ffc('0x5')](_0x6e009e,_0x4ad990);_0x3710ff(null);};}for(var e in events){if(events[_0x4ffc('0x6')](e)){var event=events[e];SmsMessage['hook'](e,emitEvent(event));}}module[_0x4ffc('0x7')]=SmsMessageEvents; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.model.js b/server/api/smsMessage/smsMessage.model.js index e783e36..a045193 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 _0xfc1e=['catch','error','SmsAccount','find','SmsAccountId','type','twilio','authToken','messages','phone','remote','/api/sms/messages/','/status?token=','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','password','smsMethod','sender','login?username=','&password=','GET','split','sms','POST','user_key','session_key','total_sent','internal_order_id','deliveryReport','Missing\x20parameters:\x20username,\x20password','connectel','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','read','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','format','%s:%s','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','base64','http_code','data','queued_count','head','clickSend','authId','token','https://api.plivo.com/v1/Account/%s/Message/','toString','plivo','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','login','text','keys','sort','length','createHash','digest','hex','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','apiMessageId','Missing\x20parameters:\x20apiKey','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','intelepeer','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','status','Token\x20not\x20received','finally','utf8mb4','api','moment','bluebird','request-promise','path','../../config/environment','./smsMessage.attributes','define','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','secret','isNil','SmsInteraction','findOne','SmsInteractionId','then','update','createdAt'];(function(_0x3a59ea,_0x53fe86){var _0xaada3f=function(_0x4a1c1d){while(--_0x4a1c1d){_0x3a59ea['push'](_0x3a59ea['shift']());}};_0xaada3f(++_0x53fe86);}(_0xfc1e,0x1c9));var _0xefc1=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xfc1e[_0x5f09c5];return _0x426ad9;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xefc1('0x0'));var moment=require(_0xefc1('0x1'));var BPromise=require(_0xefc1('0x2'));var rp=require(_0xefc1('0x3'));var fs=require('fs');var path=require(_0xefc1('0x4'));var rimraf=require('rimraf');var config=require(_0xefc1('0x5'));var attributes=require(_0xefc1('0x6'));module['exports']=function(_0x4fc84b,_0x32de5b){return _0x4fc84b[_0xefc1('0x7')](_0xefc1('0x8'),attributes,{'tableName':_0xefc1('0x9'),'paranoid':![],'indexes':[{'name':_0xefc1('0xa'),'fields':[_0xefc1('0xa')]},{'name':_0xefc1('0xb'),'fields':[_0xefc1('0xc')],'type':_0xefc1('0xd')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x165326,_0x1d10bc,_0x4caf4f){var _0x3759d2=_0x4fc84b[_0xefc1('0xe')];var _0x1826a4=_0x165326[_0xefc1('0xf')]({'plain':!![]});if(_0x1826a4[_0xefc1('0x10')][_0xefc1('0x11')]()==='in'||_0x1826a4[_0xefc1('0x10')][_0xefc1('0x11')]()===_0xefc1('0x12')&&!_0x1826a4[_0xefc1('0x13')]&&!_[_0xefc1('0x14')](_0x1826a4['UserId'])){_0x3759d2[_0xefc1('0x15')][_0xefc1('0x16')]({'where':{'id':_0x1826a4[_0xefc1('0x17')]}})[_0xefc1('0x18')](function(_0x32372b){if(_0x32372b){_0x32372b[_0xefc1('0x19')]({'lastMsgAt':_0x1826a4[_0xefc1('0x1a')],'lastMsgDirection':_0x1826a4[_0xefc1('0x10')]['toLowerCase']()});}})[_0xefc1('0x1b')](function(_0x1cc6d9){console[_0xefc1('0x1c')](_0x1cc6d9);});}if(_0x1826a4['direction']===_0xefc1('0x12')&&!_0x1826a4[_0xefc1('0x13')]){var _0x352f28;_0x3759d2[_0xefc1('0x1d')][_0xefc1('0x1e')]({'where':{'id':_0x1826a4[_0xefc1('0x1f')]},'raw':!![]})[_0xefc1('0x18')](function(_0x126052){_0x352f28=_0x126052;if(_0x352f28&&_0x352f28['type']){switch(_0x352f28[_0xefc1('0x20')]){case _0xefc1('0x21'):var _0x2670a9=require('twilio');if(_0x352f28['accountSid']&&_0x352f28[_0xefc1('0x22')]&&_0x352f28['phone']){var _0x379c24=new _0x2670a9(_0x352f28['accountSid'],_0x352f28[_0xefc1('0x22')]);_0x379c24[_0xefc1('0x23')]['create']({'body':_0x1826a4[_0xefc1('0xc')],'to':_0x1826a4[_0xefc1('0x24')],'from':_0x352f28[_0xefc1('0x24')],'statusCallback':_0x352f28[_0xefc1('0x25')]+_0xefc1('0x26')+_0x1826a4['id']+_0xefc1('0x27')+_0x352f28['token']})[_0xefc1('0x18')](function(_0xd950ce){if(_0xd950ce['sid']){return _0x165326[_0xefc1('0x19')]({'messageId':_0xd950ce['sid']});}})['catch'](function(_0x21aa3b){logger[_0xefc1('0x1c')](_0xefc1('0x28'),_0xefc1('0x29'),_0xefc1('0x21'),util[_0xefc1('0x2a')](_0x21aa3b,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefc1('0x29'),_0xefc1('0x21'),_0xefc1('0x2b'));}break;case _0xefc1('0x2c'):var _0x20e5f8='https://api.skebby.it/API/v1.0/REST/';if(_0x352f28[_0xefc1('0x2d')]&&_0x352f28[_0xefc1('0x2e')]){var _0x55f900={'recipient':[_0x1826a4['phone']],'message':_0x1826a4[_0xefc1('0xc')],'message_type':_0x352f28[_0xefc1('0x2f')]};if(_0x352f28[_0xefc1('0x2f')]&&_0x352f28['smsMethod']!=='SI'){_0x55f900[_0xefc1('0x30')]=_0x352f28[_0xefc1('0x24')];}var _0x7224dd={'url':_0x20e5f8+_0xefc1('0x31')+_0x352f28[_0xefc1('0x2d')]+_0xefc1('0x32')+_0x352f28[_0xefc1('0x2e')],'method':_0xefc1('0x33')};rp(_0x7224dd)['then'](function(_0x347cdc){var _0x28132b=_0x347cdc[_0xefc1('0x34')](';');var _0x21b53f={'user_key':_0x28132b[0x0],'session_key':_0x28132b[0x1]};_0x7224dd={'url':_0x20e5f8+_0xefc1('0x35'),'method':_0xefc1('0x36'),'headers':{'user_key':_0x21b53f[_0xefc1('0x37')],'Session_key':_0x21b53f[_0xefc1('0x38')]},'json':!![],'body':_0x55f900};return rp(_0x7224dd);})['then'](function(_0x2b0ae8){if(_0x2b0ae8[_0xefc1('0x39')]>=0x1){var _0x67835a={'messageId':_0x2b0ae8[_0xefc1('0x3a')]};if(_0x352f28['smsMethod']!=='GP'||!_0x352f28[_0xefc1('0x3b')]){_0x67835a['read']=!![];}return _0x165326[_0xefc1('0x19')](_0x67835a);}else{return logger[_0xefc1('0x1c')](_0xefc1('0x28'),_0xefc1('0x29'),'skebby',util[_0xefc1('0x2a')](_0x2b0ae8,{'showHidden':![],'depth':null}));}})[_0xefc1('0x1b')](function(_0x3cb8f9){return logger['error'](_0xefc1('0x28'),'afterCreate','skebby',util[_0xefc1('0x2a')](_0x3cb8f9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xefc1('0x28'),_0xefc1('0x29'),_0xefc1('0x2c'),_0xefc1('0x3c'));}break;case _0xefc1('0x3d'):if(_0x352f28['authToken']){var _0x11e853={'recipient':_0x1826a4[_0xefc1('0x24')],'message':_0x1826a4['body'],'sender':_0x352f28[_0xefc1('0x3e')]||_0x352f28[_0xefc1('0x24')],'authorization':_0x352f28[_0xefc1('0x22')]};var _0x1d10bc={'method':'POST','uri':_0xefc1('0x3f'),'body':_0x11e853,'json':!![]};rp(_0x1d10bc)[_0xefc1('0x18')](function(_0x1b899b){var _0x228ee8={'messageId':_0x1b899b[_0xefc1('0x40')]};if(!_0x352f28[_0xefc1('0x3b')]){_0x228ee8[_0xefc1('0x41')]=!![];}return _0x165326[_0xefc1('0x19')](_0x228ee8);})[_0xefc1('0x1b')](function(_0x5cece3){logger[_0xefc1('0x1c')](_0xefc1('0x28'),_0xefc1('0x29'),_0xefc1('0x3d'),util[_0xefc1('0x2a')](_0x5cece3,{'showHidden':![],'depth':null}));});}else{logger[_0xefc1('0x1c')](_0xefc1('0x28'),'afterCreate',_0xefc1('0x3d'),_0xefc1('0x42'));}break;case _0xefc1('0x43'):if(_0x352f28[_0xefc1('0x2d')]&&_0x352f28['password']){var _0x11e853={'messages':[{'source':_0xefc1('0x44'),'to':_0x1826a4[_0xefc1('0x24')],'body':_0x1826a4['body'],'from':_0x352f28[_0xefc1('0x3e')]||_0x352f28[_0xefc1('0x24')]}]};var _0x2528b1=util[_0xefc1('0x45')](_0xefc1('0x46'),_0x352f28['username'],_0x352f28[_0xefc1('0x2e')]);var _0x1d10bc={'method':_0xefc1('0x36'),'uri':_0xefc1('0x47'),'body':_0x11e853,'headers':{'Authorization':util[_0xefc1('0x45')](_0xefc1('0x48'),new Buffer(_0x2528b1)['toString'](_0xefc1('0x49')))},'json':!![]};rp(_0x1d10bc)['then'](function(_0x45fd44){if(_0x45fd44[_0xefc1('0x4a')]>=0xc8&&_0x45fd44['http_code']<=0xce){if(_0x45fd44[_0xefc1('0x4b')]&&_0x45fd44[_0xefc1('0x4b')][_0xefc1('0x4c')]>0x0){var _0x3ff194=_[_0xefc1('0x4d')](_0x45fd44[_0xefc1('0x4b')][_0xefc1('0x23')]);var _0x161342={'messageId':_0x3ff194['message_id']};if(!_0x352f28[_0xefc1('0x3b')]){_0x161342[_0xefc1('0x41')]=!![];}return _0x165326[_0xefc1('0x19')](_0x161342);}else{logger['error'](_0xefc1('0x28'),'afterCreate',_0xefc1('0x4e'),util[_0xefc1('0x2a')](_0x45fd44,{'showHidden':![],'depth':null}));}}else{logger[_0xefc1('0x1c')](_0xefc1('0x28'),'afterCreate',_0xefc1('0x4e'),util['inspect'](_0x45fd44,{'showHidden':![],'depth':null}));}})[_0xefc1('0x1b')](function(_0x55ce61){logger[_0xefc1('0x1c')](_0xefc1('0x28'),'afterCreate','clickSend',util[_0xefc1('0x2a')](_0x55ce61,{'showHidden':![],'depth':null}));});}else{logger[_0xefc1('0x1c')](_0xefc1('0x28'),_0xefc1('0x29'),_0xefc1('0x4e'),_0xefc1('0x3c'));}break;case'plivo':if(_0x352f28[_0xefc1('0x4f')]&&_0x352f28[_0xefc1('0x22')]){var _0x11e853={'dst':_0x1826a4[_0xefc1('0x24')],'text':_0x1826a4[_0xefc1('0xc')],'src':_0x352f28['senderString']||_0x352f28[_0xefc1('0x24')],'url':_0x352f28[_0xefc1('0x25')]+_0xefc1('0x26')+_0x1826a4['id']+_0xefc1('0x27')+_0x352f28[_0xefc1('0x50')]};var _0x2528b1=util['format'](_0xefc1('0x46'),_0x352f28['authId'],_0x352f28['authToken']);var _0x1d10bc={'method':_0xefc1('0x36'),'uri':util[_0xefc1('0x45')](_0xefc1('0x51'),_0x352f28[_0xefc1('0x4f')]),'body':_0x11e853,'headers':{'Authorization':util[_0xefc1('0x45')]('Basic\x20%s',new Buffer(_0x2528b1)[_0xefc1('0x52')](_0xefc1('0x49')))},'json':!![]};rp(_0x1d10bc)[_0xefc1('0x18')](function(_0x4c704e){var _0x2392ed={'messageId':_0x4c704e['message_uuid'][0x0]};return _0x165326[_0xefc1('0x19')](_0x2392ed);})[_0xefc1('0x1b')](function(_0x1aa729){logger[_0xefc1('0x1c')](_0xefc1('0x28'),_0xefc1('0x29'),_0xefc1('0x53'),util[_0xefc1('0x2a')](_0x1aa729,{'showHidden':![],'depth':null}));});}else{logger[_0xefc1('0x1c')](_0xefc1('0x28'),_0xefc1('0x29'),'plivo',_0xefc1('0x54'));}break;case _0xefc1('0x55'):if(_0x352f28[_0xefc1('0x2d')]&&_0x352f28[_0xefc1('0x2e')]){if(_0x352f28[_0xefc1('0x56')]){var _0x5d6dad={'method':_0xefc1('0x36'),'uri':_0x352f28[_0xefc1('0x56')]+_0xefc1('0x57'),'body':{'username':_0x352f28['username'],'password':_0x352f28['password']},'json':!![]};return rp(_0x5d6dad)[_0xefc1('0x18')](function(_0x3372b0){var _0x2e7dc1={'method':_0xefc1('0x36'),'uri':_0x352f28['baseUrl']+_0xefc1('0x58'),'body':{'messages':[{'from':_0x352f28[_0xefc1('0x24')],'destinations':[{'to':_0x1826a4[_0xefc1('0x24')]}],'text':_0x1826a4[_0xefc1('0xc')],'notifyUrl':_0x352f28[_0xefc1('0x25')]+_0xefc1('0x26')+_0x1826a4['id']+_0xefc1('0x27')+_0x352f28['token'],'notifyContentType':_0xefc1('0x59'),'callbackData':_0x352f28[_0xefc1('0x24')]+';'+_0x1826a4[_0xefc1('0xc')]}]},'headers':{'Authorization':_0xefc1('0x5a')+_0x3372b0['token']},'json':!![]};return rp(_0x2e7dc1)[_0xefc1('0x18')](function(_0x2e5823){if(_0x2e5823['messages']){var _0x441959={'messageId':_0x2e5823[_0xefc1('0x23')][0x0][_0xefc1('0xa')]};if(!_0x352f28[_0xefc1('0x3b')]){_0x441959[_0xefc1('0x41')]=!![];}return _0x165326[_0xefc1('0x19')](_0x441959);}else{return logger[_0xefc1('0x1c')](_0xefc1('0x28'),'afterCreate',_0xefc1('0x55'),util['inspect'](_0x2e5823,{'showHidden':![],'depth':null}));}});})[_0xefc1('0x1b')](function(_0x43738c){return logger[_0xefc1('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefc1('0x29'),'infobip',util['inspect'](_0x43738c,{'showHidden':![],'depth':null}));});}else{logger[_0xefc1('0x1c')](_0xefc1('0x28'),'afterCreate',_0xefc1('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xefc1('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xefc1('0x55'),_0xefc1('0x3c'));}break;case _0xefc1('0x5b'):var _0x450c85=require(_0xefc1('0x5c'));if(_0x352f28[_0xefc1('0x5d')]){var _0x504ca9={};_0x504ca9[_0xefc1('0x5e')]=_0x352f28['username'];_0x504ca9['phone']=_0x1826a4['phone'];_0x504ca9['sender']=_0x352f28[_0xefc1('0x24')];_0x504ca9[_0xefc1('0x5f')]=_0x1826a4['body'];_0x504ca9['timestamp']=+new Date();var _0x4c7e68='';var _0x4a717b='';var _0x1971f4=Object[_0xefc1('0x60')](_0x504ca9);_0x1971f4[_0xefc1('0x61')]();for(var _0x32a20e=0x0;_0x32a20e<_0x1971f4[_0xefc1('0x62')];_0x32a20e++){if(_0x4c7e68!=''){_0x4c7e68+='&';}_0x4c7e68+=_0x1971f4[_0x32a20e]+'='+encodeURIComponent(_0x504ca9[_0x1971f4[_0x32a20e]]);_0x4a717b+=_0x504ca9[_0x1971f4[_0x32a20e]];}_0x4a717b+=_0x352f28[_0xefc1('0x5d')];_0x4a717b=_0x450c85[_0xefc1('0x63')]('md5')['update'](_0x4a717b)[_0xefc1('0x64')](_0xefc1('0x65'));if(_0x4c7e68!==''){_0x4c7e68+='&';}_0x4c7e68+='signature='+_0x4a717b;var _0x7224dd={'method':'GET','uri':_0x352f28[_0xefc1('0x56')]+_0xefc1('0x66')+_0x4c7e68,'json':!![]};return rp(_0x7224dd)[_0xefc1('0x18')](function(_0x2c2f52){var _0x168ba4=Object[_0xefc1('0x60')](_0x2c2f52);if(_0x2c2f52[_0x168ba4[0x0]][_0xefc1('0x1c')]&&parseInt(_0x2c2f52[_0x168ba4[0x0]]['error'])===0x0){var _0x344428={'messageId':_0x2c2f52[_0x168ba4[0x0]][_0xefc1('0x67')]};if(!_0x352f28[_0xefc1('0x3b')]){_0x344428[_0xefc1('0x41')]=!![];}return _0x165326['update'](_0x344428);}else{return logger[_0xefc1('0x1c')](_0xefc1('0x28'),_0xefc1('0x29'),'csc',util['inspect'](_0x2c2f52[_0xefc1('0x1c')],{'showHidden':![],'depth':null}));}})[_0xefc1('0x1b')](function(_0x43599d){return logger[_0xefc1('0x1c')](_0xefc1('0x28'),'afterCreate',_0xefc1('0x5b'),util[_0xefc1('0x2a')](_0x43599d,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xefc1('0x28'),_0xefc1('0x29'),_0xefc1('0x5b'),'Missing\x20parameters:\x20apiKey');}break;case _0xefc1('0x68'):if(_0x352f28[_0xefc1('0x5d')]){var _0x2de698={'method':_0xefc1('0x36'),'uri':_0xefc1('0x69'),'headers':{'Authorization':_0x352f28[_0xefc1('0x5d')]},'body':{'content':_0x1826a4['body'],'to':[_0x1826a4[_0xefc1('0x24')]],'from':_0x352f28[_0xefc1('0x24')],'binary':![],'clientMessageId':'uuid','charset':'UTF-8'},'json':!![]};rp(_0x2de698)[_0xefc1('0x18')](function(_0x1cb505){if(!_0x1cb505[_0xefc1('0x1c')]){var _0x3ef13d={'messageId':_0x1cb505[_0xefc1('0x23')][0x0][_0xefc1('0x6a')]};if(!_0x352f28[_0xefc1('0x3b')]){_0x3ef13d[_0xefc1('0x41')]=!![];}return _0x165326[_0xefc1('0x19')](_0x3ef13d);}else{return logger[_0xefc1('0x1c')](_0xefc1('0x28'),'afterCreate',_0xefc1('0x68'),util[_0xefc1('0x2a')](_0x1cb505['error'],{'showHidden':![],'depth':null}));}})[_0xefc1('0x1b')](function(_0x3cbaa0){return logger['error'](_0xefc1('0x28'),_0xefc1('0x29'),_0xefc1('0x68'),util[_0xefc1('0x2a')](_0x3cbaa0,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefc1('0x29'),'clickatell',_0xefc1('0x6b'));}break;case _0xefc1('0x6c'):if(_0x352f28[_0xefc1('0x2d')]&&_0x352f28['password']){var _0x2528b1=util[_0xefc1('0x45')](_0xefc1('0x46'),_0x352f28[_0xefc1('0x2d')],_0x352f28['password']);var _0x1d10bc={'method':_0xefc1('0x36'),'uri':_0xefc1('0x6d')+_0x352f28[_0xefc1('0x6e')]+'/messages','body':{'to':[_0x1826a4['phone']],'text':_0x1826a4[_0xefc1('0xc')],'from':_0x352f28[_0xefc1('0x24')],'applicationId':_0x352f28[_0xefc1('0x6f')]},'headers':{'Authorization':util['format'](_0xefc1('0x48'),new Buffer(_0x2528b1)[_0xefc1('0x52')]('base64'))},'json':!![]};rp(_0x1d10bc)[_0xefc1('0x18')](function(_0x346112){if(_0x346112['id']){var _0x2ca434={'messageId':_0x346112['id']};return _0x165326[_0xefc1('0x19')](_0x2ca434);}else{logger[_0xefc1('0x1c')](_0xefc1('0x28'),'afterCreate','bandwidth',util[_0xefc1('0x2a')](_0x346112,{'showHidden':![],'depth':null}));}})['catch'](function(_0x30cd8f){logger[_0xefc1('0x1c')](_0xefc1('0x28'),'afterCreate',_0xefc1('0x6c'),util[_0xefc1('0x2a')](_0x30cd8f,{'showHidden':![],'depth':null}));});}else{logger[_0xefc1('0x1c')](_0xefc1('0x28'),_0xefc1('0x29'),_0xefc1('0x6c'),'Missing\x20parameters:\x20username,\x20password');}break;case _0xefc1('0x70'):if(_0x352f28[_0xefc1('0x5d')]){var _0x4df369={};var _0x7224dd={'method':_0xefc1('0x36'),'uri':_0xefc1('0x71'),'headers':{'Authorization':_0xefc1('0x72')+_0x352f28[_0xefc1('0x5d')],'Content-Type':'application/json'},'body':{'from':_0x352f28[_0xefc1('0x24')],'to':_0x1826a4[_0xefc1('0x24')],'text':_0x1826a4[_0xefc1('0xc')]},'json':!![]};return rp(_0x7224dd)[_0xefc1('0x18')](function(_0xd7bb5d){if(_0xd7bb5d[_0xefc1('0x73')]==0xca){_0x4df369[_0xefc1('0x74')]=_0xd7bb5d;var _0x43cba2={'method':_0xefc1('0x36'),'uri':'https://api.intelepeer.com/_rest/v4/app/sms/mdr','headers':{'Authorization':_0xefc1('0x72')+_0x352f28[_0xefc1('0x5d')],'Content-Type':_0xefc1('0x59')},'body':{'refid':_0x4df369['message']['refid']},'json':!![]};return rp(_0x43cba2)[_0xefc1('0x18')](function(_0x2f9bfa){_0x4df369[_0xefc1('0x75')]=_0x2f9bfa;var _0x298725={'messageId':_0x4df369[_0xefc1('0x74')]['refid'],'read':!![]};return _0x165326[_0xefc1('0x19')](_0x298725);});}else{return logger[_0xefc1('0x1c')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefc1('0x29'),_0xefc1('0x70'),util[_0xefc1('0x2a')](_0xd7bb5d,{'showHidden':![],'depth':null}));}})[_0xefc1('0x1b')](function(_0x3d9883){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0xefc1('0x29'),'intelepeer',util[_0xefc1('0x2a')](_0x3d9883,{'showHidden':![],'depth':null}));});}else{return logger[_0xefc1('0x1c')](_0xefc1('0x28'),_0xefc1('0x29'),_0xefc1('0x70'),_0xefc1('0x76'));}break;}}})[_0xefc1('0x77')](function(){_0x4caf4f();});}else{_0x4caf4f();}}},'charset':_0xefc1('0x78'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc4e6=['uuid','apiMessageId','bandwidth','accountId','applicationId','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','Token\x20not\x20received','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsMessage.attributes','SmsMessage','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','findOne','SmsInteractionId','then','update','catch','SmsAccount','SmsAccountId','type','twilio','accountSid','phone','authToken','messages','create','remote','/api/sms/messages/','sid','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','https://api.skebby.it/API/v1.0/REST/','password','smsMethod','sender','login?username=','username','split','sms','POST','session_key','total_sent','internal_order_id','deliveryReport','error','Missing\x20parameters:\x20username,\x20password','connectel','requestid','Missing\x20parameters:\x20authToken','clicksend','xCALLY\x20Motion','senderString','format','toString','http_code','data','head','message_id','read','clickSend','plivo','authId','/status?token=','token','%s:%s','https://api.plivo.com/v1/Account/%s/Message/','Basic\x20%s','base64','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','csc','crypto','apiKey','login','text','timestamp','keys','sort','createHash','md5','hex','GET','/external/get/send.php?','clickatell','https://platform.clickatell.com/messages'];(function(_0x5a55c1,_0x219473){var _0x478236=function(_0x1abdfe){while(--_0x1abdfe){_0x5a55c1['push'](_0x5a55c1['shift']());}};_0x478236(++_0x219473);}(_0xc4e6,0x1d9));var _0x6c4e=function(_0x9be28f,_0x231334){_0x9be28f=_0x9be28f-0x0;var _0xa9f52d=_0xc4e6[_0x9be28f];return _0xa9f52d;};'use strict';var _=require(_0x6c4e('0x0'));var util=require(_0x6c4e('0x1'));var logger=require('../../config/logger')(_0x6c4e('0x2'));var moment=require(_0x6c4e('0x3'));var BPromise=require(_0x6c4e('0x4'));var rp=require(_0x6c4e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6c4e('0x6'));var config=require(_0x6c4e('0x7'));var attributes=require(_0x6c4e('0x8'));module['exports']=function(_0x266061,_0x587927){return _0x266061['define'](_0x6c4e('0x9'),attributes,{'tableName':_0x6c4e('0xa'),'paranoid':![],'indexes':[{'name':_0x6c4e('0xb'),'fields':[_0x6c4e('0xb')]},{'name':_0x6c4e('0xc'),'fields':[_0x6c4e('0xd')],'type':_0x6c4e('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x2231a7,_0x190138,_0x3d40f8){var _0x35e27b=_0x266061[_0x6c4e('0xf')];var _0x4ee21b=_0x2231a7['get']({'plain':!![]});if(_0x4ee21b[_0x6c4e('0x10')][_0x6c4e('0x11')]()==='in'||_0x4ee21b[_0x6c4e('0x10')]['toLowerCase']()===_0x6c4e('0x12')&&!_0x4ee21b[_0x6c4e('0x13')]&&!_[_0x6c4e('0x14')](_0x4ee21b[_0x6c4e('0x15')])){_0x35e27b['SmsInteraction'][_0x6c4e('0x16')]({'where':{'id':_0x4ee21b[_0x6c4e('0x17')]}})[_0x6c4e('0x18')](function(_0x48c29e){if(_0x48c29e){_0x48c29e[_0x6c4e('0x19')]({'lastMsgAt':_0x4ee21b['createdAt'],'lastMsgDirection':_0x4ee21b[_0x6c4e('0x10')][_0x6c4e('0x11')]()});}})[_0x6c4e('0x1a')](function(_0x5b83aa){console['error'](_0x5b83aa);});}if(_0x4ee21b['direction']==='out'&&!_0x4ee21b[_0x6c4e('0x13')]){var _0x5946e1;_0x35e27b[_0x6c4e('0x1b')]['find']({'where':{'id':_0x4ee21b[_0x6c4e('0x1c')]},'raw':!![]})[_0x6c4e('0x18')](function(_0x5c4ad5){_0x5946e1=_0x5c4ad5;if(_0x5946e1&&_0x5946e1[_0x6c4e('0x1d')]){switch(_0x5946e1['type']){case _0x6c4e('0x1e'):var _0x2df24e=require(_0x6c4e('0x1e'));if(_0x5946e1[_0x6c4e('0x1f')]&&_0x5946e1['authToken']&&_0x5946e1[_0x6c4e('0x20')]){var _0x6b6a2=new _0x2df24e(_0x5946e1['accountSid'],_0x5946e1[_0x6c4e('0x21')]);_0x6b6a2[_0x6c4e('0x22')][_0x6c4e('0x23')]({'body':_0x4ee21b[_0x6c4e('0xd')],'to':_0x4ee21b[_0x6c4e('0x20')],'from':_0x5946e1['phone'],'statusCallback':_0x5946e1[_0x6c4e('0x24')]+_0x6c4e('0x25')+_0x4ee21b['id']+'/status?token='+_0x5946e1['token']})[_0x6c4e('0x18')](function(_0x2c8a7e){if(_0x2c8a7e[_0x6c4e('0x26')]){return _0x2231a7[_0x6c4e('0x19')]({'messageId':_0x2c8a7e[_0x6c4e('0x26')]});}})[_0x6c4e('0x1a')](function(_0xf2254f){logger['error'](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x1e'),util[_0x6c4e('0x29')](_0xf2254f,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x1e'),_0x6c4e('0x2a'));}break;case _0x6c4e('0x2b'):var _0x14ccfc=_0x6c4e('0x2c');if(_0x5946e1['username']&&_0x5946e1[_0x6c4e('0x2d')]){var _0x2f6f01={'recipient':[_0x4ee21b['phone']],'message':_0x4ee21b[_0x6c4e('0xd')],'message_type':_0x5946e1[_0x6c4e('0x2e')]};if(_0x5946e1['smsMethod']&&_0x5946e1['smsMethod']!=='SI'){_0x2f6f01[_0x6c4e('0x2f')]=_0x5946e1[_0x6c4e('0x20')];}var _0x467f65={'url':_0x14ccfc+_0x6c4e('0x30')+_0x5946e1[_0x6c4e('0x31')]+'&password='+_0x5946e1[_0x6c4e('0x2d')],'method':'GET'};rp(_0x467f65)[_0x6c4e('0x18')](function(_0x43a6df){var _0x5a9e0d=_0x43a6df[_0x6c4e('0x32')](';');var _0x58dd23={'user_key':_0x5a9e0d[0x0],'session_key':_0x5a9e0d[0x1]};_0x467f65={'url':_0x14ccfc+_0x6c4e('0x33'),'method':_0x6c4e('0x34'),'headers':{'user_key':_0x58dd23['user_key'],'Session_key':_0x58dd23[_0x6c4e('0x35')]},'json':!![],'body':_0x2f6f01};return rp(_0x467f65);})['then'](function(_0x338d3e){if(_0x338d3e[_0x6c4e('0x36')]>=0x1){var _0x2f0eda={'messageId':_0x338d3e[_0x6c4e('0x37')]};if(_0x5946e1[_0x6c4e('0x2e')]!=='GP'||!_0x5946e1[_0x6c4e('0x38')]){_0x2f0eda['read']=!![];}return _0x2231a7[_0x6c4e('0x19')](_0x2f0eda);}else{return logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x2b'),util[_0x6c4e('0x29')](_0x338d3e,{'showHidden':![],'depth':null}));}})[_0x6c4e('0x1a')](function(_0x3771c1){return logger[_0x6c4e('0x39')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0x6c4e('0x2b'),util[_0x6c4e('0x29')](_0x3771c1,{'showHidden':![],'depth':null}));});}else{logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x2b'),_0x6c4e('0x3a'));}break;case _0x6c4e('0x3b'):if(_0x5946e1[_0x6c4e('0x21')]){var _0x9f2e0f={'recipient':_0x4ee21b['phone'],'message':_0x4ee21b['body'],'sender':_0x5946e1['senderString']||_0x5946e1['phone'],'authorization':_0x5946e1[_0x6c4e('0x21')]};var _0x190138={'method':_0x6c4e('0x34'),'uri':'https://smsapi.connectel.se/api/v2/send/','body':_0x9f2e0f,'json':!![]};rp(_0x190138)[_0x6c4e('0x18')](function(_0x4a5d0e){var _0x2e4232={'messageId':_0x4a5d0e[_0x6c4e('0x3c')]};if(!_0x5946e1['deliveryReport']){_0x2e4232['read']=!![];}return _0x2231a7[_0x6c4e('0x19')](_0x2e4232);})[_0x6c4e('0x1a')](function(_0x203e7c){logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x3b'),util[_0x6c4e('0x29')](_0x203e7c,{'showHidden':![],'depth':null}));});}else{logger[_0x6c4e('0x39')](_0x6c4e('0x27'),'afterCreate',_0x6c4e('0x3b'),_0x6c4e('0x3d'));}break;case _0x6c4e('0x3e'):if(_0x5946e1[_0x6c4e('0x31')]&&_0x5946e1[_0x6c4e('0x2d')]){var _0x9f2e0f={'messages':[{'source':_0x6c4e('0x3f'),'to':_0x4ee21b[_0x6c4e('0x20')],'body':_0x4ee21b[_0x6c4e('0xd')],'from':_0x5946e1[_0x6c4e('0x40')]||_0x5946e1[_0x6c4e('0x20')]}]};var _0x166788=util[_0x6c4e('0x41')]('%s:%s',_0x5946e1[_0x6c4e('0x31')],_0x5946e1[_0x6c4e('0x2d')]);var _0x190138={'method':_0x6c4e('0x34'),'uri':'https://rest.clicksend.com/v3/sms/send','body':_0x9f2e0f,'headers':{'Authorization':util[_0x6c4e('0x41')]('Basic\x20%s',new Buffer(_0x166788)[_0x6c4e('0x42')]('base64'))},'json':!![]};rp(_0x190138)[_0x6c4e('0x18')](function(_0x531c5b){if(_0x531c5b['http_code']>=0xc8&&_0x531c5b[_0x6c4e('0x43')]<=0xce){if(_0x531c5b[_0x6c4e('0x44')]&&_0x531c5b[_0x6c4e('0x44')]['queued_count']>0x0){var _0x2648d5=_[_0x6c4e('0x45')](_0x531c5b[_0x6c4e('0x44')][_0x6c4e('0x22')]);var _0x18afb2={'messageId':_0x2648d5[_0x6c4e('0x46')]};if(!_0x5946e1[_0x6c4e('0x38')]){_0x18afb2[_0x6c4e('0x47')]=!![];}return _0x2231a7['update'](_0x18afb2);}else{logger['error'](_0x6c4e('0x27'),_0x6c4e('0x28'),'clickSend',util[_0x6c4e('0x29')](_0x531c5b,{'showHidden':![],'depth':null}));}}else{logger['error'](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x48'),util['inspect'](_0x531c5b,{'showHidden':![],'depth':null}));}})['catch'](function(_0x44d0b3){logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x48'),util['inspect'](_0x44d0b3,{'showHidden':![],'depth':null}));});}else{logger[_0x6c4e('0x39')](_0x6c4e('0x27'),'afterCreate',_0x6c4e('0x48'),_0x6c4e('0x3a'));}break;case _0x6c4e('0x49'):if(_0x5946e1[_0x6c4e('0x4a')]&&_0x5946e1[_0x6c4e('0x21')]){var _0x9f2e0f={'dst':_0x4ee21b[_0x6c4e('0x20')],'text':_0x4ee21b[_0x6c4e('0xd')],'src':_0x5946e1[_0x6c4e('0x40')]||_0x5946e1['phone'],'url':_0x5946e1['remote']+_0x6c4e('0x25')+_0x4ee21b['id']+_0x6c4e('0x4b')+_0x5946e1[_0x6c4e('0x4c')]};var _0x166788=util[_0x6c4e('0x41')](_0x6c4e('0x4d'),_0x5946e1['authId'],_0x5946e1['authToken']);var _0x190138={'method':'POST','uri':util[_0x6c4e('0x41')](_0x6c4e('0x4e'),_0x5946e1[_0x6c4e('0x4a')]),'body':_0x9f2e0f,'headers':{'Authorization':util[_0x6c4e('0x41')](_0x6c4e('0x4f'),new Buffer(_0x166788)[_0x6c4e('0x42')](_0x6c4e('0x50')))},'json':!![]};rp(_0x190138)[_0x6c4e('0x18')](function(_0x185fd0){var _0xd62861={'messageId':_0x185fd0['message_uuid'][0x0]};return _0x2231a7[_0x6c4e('0x19')](_0xd62861);})[_0x6c4e('0x1a')](function(_0x17b125){logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x49'),util[_0x6c4e('0x29')](_0x17b125,{'showHidden':![],'depth':null}));});}else{logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),'plivo','Missing\x20parameters:\x20authId,\x20authToken');}break;case _0x6c4e('0x51'):if(_0x5946e1[_0x6c4e('0x31')]&&_0x5946e1['password']){if(_0x5946e1[_0x6c4e('0x52')]){var _0x206e75={'method':'POST','uri':_0x5946e1[_0x6c4e('0x52')]+_0x6c4e('0x53'),'body':{'username':_0x5946e1['username'],'password':_0x5946e1[_0x6c4e('0x2d')]},'json':!![]};return rp(_0x206e75)[_0x6c4e('0x18')](function(_0x4056af){var _0x49fa6d={'method':'POST','uri':_0x5946e1[_0x6c4e('0x52')]+_0x6c4e('0x54'),'body':{'messages':[{'from':_0x5946e1['phone'],'destinations':[{'to':_0x4ee21b[_0x6c4e('0x20')]}],'text':_0x4ee21b['body'],'notifyUrl':_0x5946e1['remote']+_0x6c4e('0x25')+_0x4ee21b['id']+'/status?token='+_0x5946e1[_0x6c4e('0x4c')],'notifyContentType':_0x6c4e('0x55'),'callbackData':_0x5946e1[_0x6c4e('0x20')]+';'+_0x4ee21b[_0x6c4e('0xd')]}]},'headers':{'Authorization':_0x6c4e('0x56')+_0x4056af[_0x6c4e('0x4c')]},'json':!![]};return rp(_0x49fa6d)[_0x6c4e('0x18')](function(_0x3b533f){if(_0x3b533f[_0x6c4e('0x22')]){var _0x4912cd={'messageId':_0x3b533f[_0x6c4e('0x22')][0x0]['messageId']};if(!_0x5946e1['deliveryReport']){_0x4912cd[_0x6c4e('0x47')]=!![];}return _0x2231a7[_0x6c4e('0x19')](_0x4912cd);}else{return logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),'infobip',util['inspect'](_0x3b533f,{'showHidden':![],'depth':null}));}});})[_0x6c4e('0x1a')](function(_0x397ef4){return logger[_0x6c4e('0x39')](_0x6c4e('0x27'),'afterCreate',_0x6c4e('0x51'),util[_0x6c4e('0x29')](_0x397ef4,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6c4e('0x27'),'afterCreate',_0x6c4e('0x51'),'Missing\x20parameters:\x20base_url');}}else{logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x51'),_0x6c4e('0x3a'));}break;case _0x6c4e('0x57'):var _0x4bdbdb=require(_0x6c4e('0x58'));if(_0x5946e1[_0x6c4e('0x59')]){var _0xc0386d={};_0xc0386d[_0x6c4e('0x5a')]=_0x5946e1[_0x6c4e('0x31')];_0xc0386d[_0x6c4e('0x20')]=_0x4ee21b[_0x6c4e('0x20')];_0xc0386d['sender']=_0x5946e1[_0x6c4e('0x20')];_0xc0386d[_0x6c4e('0x5b')]=_0x4ee21b[_0x6c4e('0xd')];_0xc0386d[_0x6c4e('0x5c')]=+new Date();var _0x5e8156='';var _0x208451='';var _0x23e559=Object[_0x6c4e('0x5d')](_0xc0386d);_0x23e559[_0x6c4e('0x5e')]();for(var _0x5a0ef0=0x0;_0x5a0ef0<_0x23e559['length'];_0x5a0ef0++){if(_0x5e8156!=''){_0x5e8156+='&';}_0x5e8156+=_0x23e559[_0x5a0ef0]+'='+encodeURIComponent(_0xc0386d[_0x23e559[_0x5a0ef0]]);_0x208451+=_0xc0386d[_0x23e559[_0x5a0ef0]];}_0x208451+=_0x5946e1[_0x6c4e('0x59')];_0x208451=_0x4bdbdb[_0x6c4e('0x5f')](_0x6c4e('0x60'))[_0x6c4e('0x19')](_0x208451)['digest'](_0x6c4e('0x61'));if(_0x5e8156!==''){_0x5e8156+='&';}_0x5e8156+='signature='+_0x208451;var _0x467f65={'method':_0x6c4e('0x62'),'uri':_0x5946e1[_0x6c4e('0x52')]+_0x6c4e('0x63')+_0x5e8156,'json':!![]};return rp(_0x467f65)[_0x6c4e('0x18')](function(_0x578173){var _0x4889fb=Object[_0x6c4e('0x5d')](_0x578173);if(_0x578173[_0x4889fb[0x0]][_0x6c4e('0x39')]&&parseInt(_0x578173[_0x4889fb[0x0]][_0x6c4e('0x39')])===0x0){var _0x582bb6={'messageId':_0x578173[_0x4889fb[0x0]]['id_sms']};if(!_0x5946e1[_0x6c4e('0x38')]){_0x582bb6[_0x6c4e('0x47')]=!![];}return _0x2231a7['update'](_0x582bb6);}else{return logger['error'](_0x6c4e('0x27'),_0x6c4e('0x28'),'csc',util[_0x6c4e('0x29')](_0x578173[_0x6c4e('0x39')],{'showHidden':![],'depth':null}));}})[_0x6c4e('0x1a')](function(_0xf9c781){return logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x57'),util[_0x6c4e('0x29')](_0xf9c781,{'showHidden':![],'depth':null}));});}else{logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),'csc','Missing\x20parameters:\x20apiKey');}break;case _0x6c4e('0x64'):if(_0x5946e1[_0x6c4e('0x59')]){var _0x8b853d={'method':_0x6c4e('0x34'),'uri':_0x6c4e('0x65'),'headers':{'Authorization':_0x5946e1[_0x6c4e('0x59')]},'body':{'content':_0x4ee21b['body'],'to':[_0x4ee21b[_0x6c4e('0x20')]],'from':_0x5946e1[_0x6c4e('0x20')],'binary':![],'clientMessageId':_0x6c4e('0x66'),'charset':'UTF-8'},'json':!![]};rp(_0x8b853d)[_0x6c4e('0x18')](function(_0x2e8ad2){if(!_0x2e8ad2[_0x6c4e('0x39')]){var _0x5b998b={'messageId':_0x2e8ad2[_0x6c4e('0x22')][0x0][_0x6c4e('0x67')]};if(!_0x5946e1[_0x6c4e('0x38')]){_0x5b998b[_0x6c4e('0x47')]=!![];}return _0x2231a7['update'](_0x5b998b);}else{return logger['error'](_0x6c4e('0x27'),_0x6c4e('0x28'),'clickatell',util[_0x6c4e('0x29')](_0x2e8ad2[_0x6c4e('0x39')],{'showHidden':![],'depth':null}));}})[_0x6c4e('0x1a')](function(_0x23f8ea){return logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x64'),util[_0x6c4e('0x29')](_0x23f8ea,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x6c4e('0x27'),_0x6c4e('0x28'),'clickatell','Missing\x20parameters:\x20apiKey');}break;case _0x6c4e('0x68'):if(_0x5946e1[_0x6c4e('0x31')]&&_0x5946e1[_0x6c4e('0x2d')]){var _0x166788=util['format'](_0x6c4e('0x4d'),_0x5946e1[_0x6c4e('0x31')],_0x5946e1[_0x6c4e('0x2d')]);var _0x190138={'method':_0x6c4e('0x34'),'uri':'https://messaging.bandwidth.com/api/v2/users/'+_0x5946e1[_0x6c4e('0x69')]+'/messages','body':{'to':[_0x4ee21b[_0x6c4e('0x20')]],'text':_0x4ee21b[_0x6c4e('0xd')],'from':_0x5946e1[_0x6c4e('0x20')],'applicationId':_0x5946e1[_0x6c4e('0x6a')]},'headers':{'Authorization':util[_0x6c4e('0x41')](_0x6c4e('0x4f'),new Buffer(_0x166788)['toString'](_0x6c4e('0x50')))},'json':!![]};rp(_0x190138)[_0x6c4e('0x18')](function(_0x3ced29){if(_0x3ced29['id']){var _0x41fd3c={'messageId':_0x3ced29['id']};return _0x2231a7['update'](_0x41fd3c);}else{logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),'bandwidth',util['inspect'](_0x3ced29,{'showHidden':![],'depth':null}));}})[_0x6c4e('0x1a')](function(_0x2626a9){logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),'bandwidth',util[_0x6c4e('0x29')](_0x2626a9,{'showHidden':![],'depth':null}));});}else{logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x68'),_0x6c4e('0x3a'));}break;case'intelepeer':if(_0x5946e1[_0x6c4e('0x59')]){var _0xc49130={};var _0x467f65={'method':_0x6c4e('0x34'),'uri':_0x6c4e('0x6b'),'headers':{'Authorization':_0x6c4e('0x6c')+_0x5946e1[_0x6c4e('0x59')],'Content-Type':'application/json'},'body':{'from':_0x5946e1['phone'],'to':_0x4ee21b[_0x6c4e('0x20')],'text':_0x4ee21b['body']},'json':!![]};return rp(_0x467f65)[_0x6c4e('0x18')](function(_0x525bdf){if(_0x525bdf[_0x6c4e('0x6d')]==0xca){_0xc49130[_0x6c4e('0x6e')]=_0x525bdf;var _0x3aac89={'method':_0x6c4e('0x34'),'uri':_0x6c4e('0x6f'),'headers':{'Authorization':_0x6c4e('0x6c')+_0x5946e1[_0x6c4e('0x59')],'Content-Type':'application/json'},'body':{'refid':_0xc49130['message'][_0x6c4e('0x70')]},'json':!![]};return rp(_0x3aac89)[_0x6c4e('0x18')](function(_0x35eb30){_0xc49130['status']=_0x35eb30;var _0x237e60={'messageId':_0xc49130[_0x6c4e('0x6e')][_0x6c4e('0x70')],'read':!![]};return _0x2231a7['update'](_0x237e60);});}else{return logger[_0x6c4e('0x39')](_0x6c4e('0x27'),'afterCreate',_0x6c4e('0x71'),util['inspect'](_0x525bdf,{'showHidden':![],'depth':null}));}})[_0x6c4e('0x1a')](function(_0x240399){return logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x71'),util['inspect'](_0x240399,{'showHidden':![],'depth':null}));});}else{return logger[_0x6c4e('0x39')](_0x6c4e('0x27'),_0x6c4e('0x28'),_0x6c4e('0x71'),_0x6c4e('0x72'));}break;}}})['finally'](function(){_0x3d40f8();});}else{_0x3d40f8();}}},'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 b3f3714..0ded428 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 _0x9555=['SmsMessage','create','body','options','raw','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','./smsMessage.socket','then','info','SmsMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','catch','CreateSmsMessage'];(function(_0xc0f49e,_0x55700c){var _0x7ec980=function(_0x1abc06){while(--_0x1abc06){_0xc0f49e['push'](_0xc0f49e['shift']());}};_0x7ec980(++_0x55700c);}(_0x9555,0x125));var _0x5955=function(_0x4dbcdc,_0x45b270){_0x4dbcdc=_0x4dbcdc-0x0;var _0x1252bb=_0x9555[_0x4dbcdc];return _0x1252bb;};'use strict';var _=require(_0x5955('0x0'));var util=require(_0x5955('0x1'));var moment=require(_0x5955('0x2'));var BPromise=require('bluebird');var rs=require(_0x5955('0x3'));var fs=require('fs');var Redis=require(_0x5955('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5955('0x5'));var logger=require(_0x5955('0x6'))(_0x5955('0x7'));var config=require(_0x5955('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x5955('0x9')][_0x5955('0xa')]({'port':0x232a});config[_0x5955('0xb')]=_[_0x5955('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x5955('0xd'))(new Redis(config[_0x5955('0xb')]));require(_0x5955('0xe'))['register'](socket);function respondWithRpcPromise(_0x8e3371,_0x5aeca9,_0x4151e3){return new BPromise(function(_0x5cdf34,_0x2e3606){return client['request'](_0x8e3371,_0x4151e3)[_0x5955('0xf')](function(_0x50b315){logger[_0x5955('0x10')](_0x5955('0x11'),_0x5aeca9,'request\x20sent');logger[_0x5955('0x12')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x5aeca9,_0x5955('0x13'),JSON[_0x5955('0x14')](_0x50b315));if(_0x50b315[_0x5955('0x15')]){if(_0x50b315[_0x5955('0x15')][_0x5955('0x16')]===0x1f4){logger[_0x5955('0x15')](_0x5955('0x11'),_0x5aeca9,_0x50b315[_0x5955('0x15')][_0x5955('0x17')]);return _0x2e3606(_0x50b315['error']['message']);}logger[_0x5955('0x15')]('SmsMessage,\x20%s,\x20%s',_0x5aeca9,_0x50b315[_0x5955('0x15')][_0x5955('0x17')]);return _0x5cdf34(_0x50b315[_0x5955('0x15')][_0x5955('0x17')]);}else{logger[_0x5955('0x10')](_0x5955('0x11'),_0x5aeca9,_0x5955('0x13'));_0x5cdf34(_0x50b315[_0x5955('0x18')][_0x5955('0x17')]);}})[_0x5955('0x19')](function(_0x288f5c){logger[_0x5955('0x15')]('SmsMessage,\x20%s,\x20%s',_0x5aeca9,_0x288f5c);_0x2e3606(_0x288f5c);});});}exports[_0x5955('0x1a')]=function(_0x1a7b2a){var _0xa4462a=this;return new Promise(function(_0x2256f5,_0x49eded){return db[_0x5955('0x1b')][_0x5955('0x1c')](_0x1a7b2a[_0x5955('0x1d')],{'raw':_0x1a7b2a[_0x5955('0x1e')]?_0x1a7b2a['options'][_0x5955('0x1f')]===undefined?!![]:![]:!![]})['then'](function(_0x283a64){logger[_0x5955('0x10')]('CreateSmsMessage',_0x1a7b2a);logger[_0x5955('0x12')](_0x5955('0x1a'),_0x1a7b2a,JSON[_0x5955('0x14')](_0x283a64));_0x2256f5(_0x283a64);})[_0x5955('0x19')](function(_0x541fe2){logger[_0x5955('0x15')](_0x5955('0x1a'),_0x541fe2[_0x5955('0x17')],_0x1a7b2a);_0x49eded(_0xa4462a[_0x5955('0x15')](0x1f4,_0x541fe2[_0x5955('0x17')]));});});}; \ No newline at end of file +var _0x50ab=['register','request','then','request\x20sent','SmsMessage,\x20%s,\x20%s,\x20%s','error','code','SmsMessage,\x20%s,\x20%s','message','result','catch','CreateSmsMessage','create','body','options','raw','debug','stringify','lodash','moment','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','./smsMessage.socket'];(function(_0x2b91c5,_0x3b6db5){var _0xbd5531=function(_0x54783d){while(--_0x54783d){_0x2b91c5['push'](_0x2b91c5['shift']());}};_0xbd5531(++_0x3b6db5);}(_0x50ab,0x1d4));var _0xb50a=function(_0x2dee4c,_0x59e3d3){_0x2dee4c=_0x2dee4c-0x0;var _0x32439b=_0x50ab[_0x2dee4c];return _0x32439b;};'use strict';var _=require(_0xb50a('0x0'));var util=require('util');var moment=require(_0xb50a('0x1'));var BPromise=require('bluebird');var rs=require(_0xb50a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb50a('0x3'))['db'];var utils=require(_0xb50a('0x4'));var logger=require('../../config/logger')(_0xb50a('0x5'));var config=require(_0xb50a('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb50a('0x7')][_0xb50a('0x8')]({'port':0x232a});config[_0xb50a('0x9')]=_[_0xb50a('0xa')](config[_0xb50a('0x9')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb50a('0xb'))[_0xb50a('0xc')](socket);function respondWithRpcPromise(_0x11f216,_0x338da9,_0x52dec8){return new BPromise(function(_0x2af5cb,_0x10339b){return client[_0xb50a('0xd')](_0x11f216,_0x52dec8)[_0xb50a('0xe')](function(_0x560577){logger['info']('SmsMessage,\x20%s,\x20%s',_0x338da9,_0xb50a('0xf'));logger['debug'](_0xb50a('0x10'),_0x338da9,_0xb50a('0xf'),JSON['stringify'](_0x560577));if(_0x560577[_0xb50a('0x11')]){if(_0x560577[_0xb50a('0x11')][_0xb50a('0x12')]===0x1f4){logger[_0xb50a('0x11')](_0xb50a('0x13'),_0x338da9,_0x560577['error'][_0xb50a('0x14')]);return _0x10339b(_0x560577[_0xb50a('0x11')][_0xb50a('0x14')]);}logger[_0xb50a('0x11')]('SmsMessage,\x20%s,\x20%s',_0x338da9,_0x560577[_0xb50a('0x11')][_0xb50a('0x14')]);return _0x2af5cb(_0x560577[_0xb50a('0x11')][_0xb50a('0x14')]);}else{logger['info'](_0xb50a('0x13'),_0x338da9,'request\x20sent');_0x2af5cb(_0x560577[_0xb50a('0x15')]['message']);}})[_0xb50a('0x16')](function(_0x192d98){logger[_0xb50a('0x11')]('SmsMessage,\x20%s,\x20%s',_0x338da9,_0x192d98);_0x10339b(_0x192d98);});});}exports[_0xb50a('0x17')]=function(_0x2b7a9){var _0x3e66ff=this;return new Promise(function(_0x140215,_0x7ed563){return db['SmsMessage'][_0xb50a('0x18')](_0x2b7a9[_0xb50a('0x19')],{'raw':_0x2b7a9[_0xb50a('0x1a')]?_0x2b7a9[_0xb50a('0x1a')][_0xb50a('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x43aae7){logger['info']('CreateSmsMessage',_0x2b7a9);logger[_0xb50a('0x1c')]('CreateSmsMessage',_0x2b7a9,JSON[_0xb50a('0x1d')](_0x43aae7));_0x140215(_0x43aae7);})[_0xb50a('0x16')](function(_0x361919){logger[_0xb50a('0x11')](_0xb50a('0x17'),_0x361919[_0xb50a('0x14')],_0x2b7a9);_0x7ed563(_0x3e66ff[_0xb50a('0x11')](0x1f4,_0x361919['message']));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index de548d5..fc26235 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 _0x9962=['save','update','emit','removeListener','register','length','smsMessage:','./smsMessage.events'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0x9962,0x197));var _0x2996=function(_0x151878,_0x4652fe){_0x151878=_0x151878-0x0;var _0x224c9b=_0x9962[_0x151878];return _0x224c9b;};'use strict';var SmsMessageEvents=require(_0x2996('0x0'));var events=[_0x2996('0x1'),'remove',_0x2996('0x2')];function createListener(_0x333b24,_0x24f5dc){return function(_0x17aa85){_0x24f5dc[_0x2996('0x3')](_0x333b24,_0x17aa85);};}function removeListener(_0x360b20,_0x2b70b2){return function(){SmsMessageEvents[_0x2996('0x4')](_0x360b20,_0x2b70b2);};}exports[_0x2996('0x5')]=function(_0x36bb53){for(var _0x22719c=0x0,_0x4f34b7=events[_0x2996('0x6')];_0x22719c<_0x4f34b7;_0x22719c++){var _0x13815b=events[_0x22719c];var _0x5ed2ee=createListener(_0x2996('0x7')+_0x13815b,_0x36bb53);SmsMessageEvents['on'](_0x13815b,_0x5ed2ee);}}; \ No newline at end of file +var _0xc469=['update','emit','removeListener','register','length','smsMessage:','./smsMessage.events','save'];(function(_0x2a5ae4,_0x1a36c5){var _0x24dbb7=function(_0x291651){while(--_0x291651){_0x2a5ae4['push'](_0x2a5ae4['shift']());}};_0x24dbb7(++_0x1a36c5);}(_0xc469,0xe6));var _0x9c46=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0xc469[_0x1ab0e6];return _0x248815;};'use strict';var SmsMessageEvents=require(_0x9c46('0x0'));var events=[_0x9c46('0x1'),'remove',_0x9c46('0x2')];function createListener(_0x5dfb76,_0x2f4fa5){return function(_0x5c68a5){_0x2f4fa5[_0x9c46('0x3')](_0x5dfb76,_0x5c68a5);};}function removeListener(_0x26c604,_0x282650){return function(){SmsMessageEvents[_0x9c46('0x4')](_0x26c604,_0x282650);};}exports[_0x9c46('0x5')]=function(_0x496bd2){for(var _0x14f382=0x0,_0x3fd97d=events[_0x9c46('0x6')];_0x14f382<_0x3fd97d;_0x14f382++){var _0x15981a=events[_0x14f382];var _0x15f390=createListener(_0x9c46('0x7')+_0x15981a,_0x496bd2);SmsMessageEvents['on'](_0x15981a,_0x15f390);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index a7c5802..5fc2f7e 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 _0x3f5c=['express','fs-extra','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','getAgents','post','create','addTeams','addAgents','put','update','delete','destroy','removeTeams','removeAgents','exports','multer','path','connect-timeout'];(function(_0x3aef3c,_0x7b70ff){var _0x4e8c48=function(_0x4308e5){while(--_0x4308e5){_0x3aef3c['push'](_0x3aef3c['shift']());}};_0x4e8c48(++_0x7b70ff);}(_0x3f5c,0x129));var _0xc3f5=function(_0x2eafe2,_0x2b789a){_0x2eafe2=_0x2eafe2-0x0;var _0x14b115=_0x3f5c[_0x2eafe2];return _0x14b115;};'use strict';var multer=require(_0xc3f5('0x0'));var util=require('util');var path=require(_0xc3f5('0x1'));var timeout=require(_0xc3f5('0x2'));var express=require(_0xc3f5('0x3'));var router=express['Router']();var fs_extra=require(_0xc3f5('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xc3f5('0x5'));var controller=require('./smsQueue.controller');router[_0xc3f5('0x6')]('/',auth[_0xc3f5('0x7')](),controller[_0xc3f5('0x8')]);router[_0xc3f5('0x6')](_0xc3f5('0x9'),auth['isAuthenticated'](),controller[_0xc3f5('0xa')]);router[_0xc3f5('0x6')](_0xc3f5('0xb'),auth[_0xc3f5('0x7')](),controller[_0xc3f5('0xc')]);router[_0xc3f5('0x6')](_0xc3f5('0xd'),auth[_0xc3f5('0x7')](),controller[_0xc3f5('0xe')]);router[_0xc3f5('0x6')](_0xc3f5('0xf'),auth[_0xc3f5('0x7')](),controller[_0xc3f5('0x10')]);router[_0xc3f5('0x6')](_0xc3f5('0x11'),auth['isAuthenticated'](),controller[_0xc3f5('0x12')]);router[_0xc3f5('0x13')]('/',auth[_0xc3f5('0x7')](),controller[_0xc3f5('0x14')]);router['post'](_0xc3f5('0xf'),auth[_0xc3f5('0x7')](),controller[_0xc3f5('0x15')]);router[_0xc3f5('0x13')](_0xc3f5('0x11'),auth[_0xc3f5('0x7')](),controller[_0xc3f5('0x16')]);router[_0xc3f5('0x17')](_0xc3f5('0xb'),auth[_0xc3f5('0x7')](),controller[_0xc3f5('0x18')]);router[_0xc3f5('0x19')](_0xc3f5('0xb'),auth[_0xc3f5('0x7')](),controller[_0xc3f5('0x1a')]);router[_0xc3f5('0x19')](_0xc3f5('0xf'),auth[_0xc3f5('0x7')](),controller[_0xc3f5('0x1b')]);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0xc3f5('0x1c')]);module[_0xc3f5('0x1d')]=router; \ No newline at end of file +var _0x8de3=['delete','removeAgents','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','/:id/users','getAgents','create','post','addTeams','put','destroy','removeTeams'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x8de3,0x136));var _0x38de=function(_0x399338,_0x11496b){_0x399338=_0x399338-0x0;var _0x3c4485=_0x8de3[_0x399338];return _0x3c4485;};'use strict';var multer=require('multer');var util=require(_0x38de('0x0'));var path=require(_0x38de('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x38de('0x2')]();var fs_extra=require(_0x38de('0x3'));var auth=require(_0x38de('0x4'));var interaction=require(_0x38de('0x5'));var config=require(_0x38de('0x6'));var controller=require(_0x38de('0x7'));router[_0x38de('0x8')]('/',auth[_0x38de('0x9')](),controller[_0x38de('0xa')]);router['get'](_0x38de('0xb'),auth['isAuthenticated'](),controller[_0x38de('0xc')]);router[_0x38de('0x8')](_0x38de('0xd'),auth[_0x38de('0x9')](),controller[_0x38de('0xe')]);router[_0x38de('0x8')]('/:id/members',auth['isAuthenticated'](),controller[_0x38de('0xf')]);router[_0x38de('0x8')](_0x38de('0x10'),auth['isAuthenticated'](),controller[_0x38de('0x11')]);router[_0x38de('0x8')](_0x38de('0x12'),auth[_0x38de('0x9')](),controller[_0x38de('0x13')]);router['post']('/',auth[_0x38de('0x9')](),controller[_0x38de('0x14')]);router[_0x38de('0x15')](_0x38de('0x10'),auth['isAuthenticated'](),controller[_0x38de('0x16')]);router[_0x38de('0x15')]('/:id/users',auth[_0x38de('0x9')](),controller['addAgents']);router[_0x38de('0x17')](_0x38de('0xd'),auth[_0x38de('0x9')](),controller['update']);router['delete'](_0x38de('0xd'),auth['isAuthenticated'](),controller[_0x38de('0x18')]);router['delete']('/:id/teams',auth[_0x38de('0x9')](),controller[_0x38de('0x19')]);router[_0x38de('0x1a')](_0x38de('0x12'),auth[_0x38de('0x9')](),controller[_0x38de('0x1b')]);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 93afe93..7f9bfe6 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 _0x720f=['rrmemory','beepall','sequelize','name','STRING','INTEGER','ENUM'];(function(_0x249e96,_0x3ea39d){var _0x17444c=function(_0x1221d0){while(--_0x1221d0){_0x249e96['push'](_0x249e96['shift']());}};_0x17444c(++_0x3ea39d);}(_0x720f,0x1e5));var _0xf720=function(_0xa9a245,_0x2a0387){_0xa9a245=_0xa9a245-0x0;var _0x2d0eaa=_0x720f[_0xa9a245];return _0x2d0eaa;};'use strict';var Sequelize=require(_0xf720('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xf720('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xf720('0x2')]},'timeout':{'type':Sequelize[_0xf720('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xf720('0x4')](_0xf720('0x5'),_0xf720('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x0551=['beepall','roundrobin','exports','name','STRING','INTEGER','ENUM'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x0551,0x1de));var _0x1055=function(_0x33007f,_0x4b38d2){_0x33007f=_0x33007f-0x0;var _0x10d38c=_0x0551[_0x33007f];return _0x10d38c;};'use strict';var Sequelize=require('sequelize');module[_0x1055('0x0')]={'name':{'type':Sequelize['STRING'],'unique':_0x1055('0x1'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x1055('0x2')]},'timeout':{'type':Sequelize[_0x1055('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x1055('0x4')]('rrmemory',_0x1055('0x5'),_0x1055('0x6'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 6e250d3..5b1bb3d 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 _0xafdc=['length','hasOwnProperty','order','pick','filter','where','merge','VIRTUAL','options','includeAll','rows','show','params','include','find','catch','create','body','user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','getMembers','findOne','nolimit','sort','SmsQueueId','findAll','User','findAndCountAll','UserId','smsPause','createdAt','%s/%s','SIP','updatedAt','getTeams','ids','Team','Agents','interface','flatMap','sequelize','transaction','addTeams','each','findOrCreate','forEach','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','push','toString','SELECT','every','TeamId','includes','all','compact','value','isEmpty','removeAgents','userSmsQueue:remove','addAgents','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','redis','localhost','socket.io-emitter','./smsQueue.socket','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','then','destroy','get','SmsQueues','UserProfileResource','end','sendStatus','error','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields'];(function(_0x257905,_0x524fb4){var _0x5e01ba=function(_0x4e9e2c){while(--_0x4e9e2c){_0x257905['push'](_0x257905['shift']());}};_0x5e01ba(++_0x524fb4);}(_0xafdc,0xd6));var _0xcafd=function(_0x3330b9,_0x21d772){_0x3330b9=_0x3330b9-0x0;var _0x9129bb=_0xafdc[_0x3330b9];return _0x9129bb;};'use strict';var emlformat=require(_0xcafd('0x0'));var rimraf=require(_0xcafd('0x1'));var zipdir=require(_0xcafd('0x2'));var jsonpatch=require(_0xcafd('0x3'));var rp=require(_0xcafd('0x4'));var moment=require('moment');var BPromise=require(_0xcafd('0x5'));var Mustache=require(_0xcafd('0x6'));var util=require(_0xcafd('0x7'));var path=require('path');var sox=require(_0xcafd('0x8'));var csv=require(_0xcafd('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xcafd('0xa'));var _=require(_0xcafd('0xb'));var squel=require(_0xcafd('0xc'));var crypto=require(_0xcafd('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xcafd('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xcafd('0xe'));var authService=require(_0xcafd('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xcafd('0x10'));var hardwareService=require(_0xcafd('0x11'));var logger=require(_0xcafd('0x12'))('api');var utils=require(_0xcafd('0x13'));var config=require(_0xcafd('0x14'));var licenseUtil=require(_0xcafd('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xcafd('0x16')](config[_0xcafd('0x17')],{'host':_0xcafd('0x18'),'port':0x18eb});var socket=require(_0xcafd('0x19'))(new Redis(config[_0xcafd('0x17')]));require(_0xcafd('0x1a'))['register'](socket);function respondWithStatusCode(_0x2fa115,_0x9119d1){_0x9119d1=_0x9119d1||0xcc;return function(_0x28c593){if(_0x28c593){return _0x2fa115['sendStatus'](_0x9119d1);}return _0x2fa115[_0xcafd('0x1b')](_0x9119d1)['end']();};}function respondWithResult(_0x3eaa4e,_0x17e9be){_0x17e9be=_0x17e9be||0xc8;return function(_0x35ef12){if(_0x35ef12){return _0x3eaa4e[_0xcafd('0x1b')](_0x17e9be)[_0xcafd('0x1c')](_0x35ef12);}};}function respondWithFilteredResult(_0x4f861d,_0x3dd474){return function(_0x554f27){if(_0x554f27){var _0x1b3d90=typeof _0x3dd474['offset']===_0xcafd('0x1d')&&typeof _0x3dd474[_0xcafd('0x1e')]===_0xcafd('0x1d');var _0x427d8b=_0x554f27[_0xcafd('0x1f')];var _0x52eb3a=_0x1b3d90?0x0:_0x3dd474[_0xcafd('0x20')];var _0xdbba8=_0x1b3d90?_0x554f27[_0xcafd('0x1f')]:_0x3dd474['offset']+_0x3dd474['limit'];var _0x226069;if(_0xdbba8>=_0x427d8b){_0xdbba8=_0x427d8b;_0x226069=0xc8;}else{_0x226069=0xce;}_0x4f861d['status'](_0x226069);return _0x4f861d[_0xcafd('0x21')](_0xcafd('0x22'),_0x52eb3a+'-'+_0xdbba8+'/'+_0x427d8b)['json'](_0x554f27);}return null;};}function patchUpdates(_0x17ef6e){return function(_0x20e44e){try{jsonpatch[_0xcafd('0x23')](_0x20e44e,_0x17ef6e,!![]);}catch(_0x509e7f){return BPromise[_0xcafd('0x24')](_0x509e7f);}return _0x20e44e[_0xcafd('0x25')]();};}function saveUpdates(_0x22ad28,_0x573751){return function(_0xa1572e){if(_0xa1572e){return _0xa1572e['update'](_0x22ad28)[_0xcafd('0x26')](function(_0x246b41){return _0x246b41;});}return null;};}function removeEntity(_0x1eb8db,_0x520e4f){return function(_0x3f76d7){if(_0x3f76d7){return _0x3f76d7[_0xcafd('0x27')]()[_0xcafd('0x26')](function(){var _0x3d5601=_0x3f76d7[_0xcafd('0x28')]({'plain':!![]});var _0x58e23f=_0xcafd('0x29');return db[_0xcafd('0x2a')]['destroy']({'where':{'type':_0x58e23f,'resourceId':_0x3d5601['id']}})[_0xcafd('0x26')](function(){return _0x3f76d7;});})[_0xcafd('0x26')](function(){_0x1eb8db[_0xcafd('0x1b')](0xcc)[_0xcafd('0x2b')]();});}};}function handleEntityNotFound(_0x287503,_0x28ea35){return function(_0x2324fd){if(!_0x2324fd){_0x287503[_0xcafd('0x2c')](0x194);}return _0x2324fd;};}function handleError(_0x150c26,_0x45a1f4){_0x45a1f4=_0x45a1f4||0x1f4;return function(_0x2aad55){logger[_0xcafd('0x2d')](_0x2aad55['stack']);if(_0x2aad55[_0xcafd('0x2e')]){delete _0x2aad55[_0xcafd('0x2e')];}_0x150c26['status'](_0x45a1f4)[_0xcafd('0x2f')](_0x2aad55);};}exports[_0xcafd('0x30')]=function(_0x3db069,_0x26e1a9){var _0x11a5c4={},_0x4f4f9f={},_0x701d6={'count':0x0,'rows':[]};var _0x4ba745=_[_0xcafd('0x31')](db[_0xcafd('0x32')][_0xcafd('0x33')],function(_0x2b9af8){return{'name':_0x2b9af8[_0xcafd('0x34')],'type':_0x2b9af8[_0xcafd('0x35')][_0xcafd('0x36')]};});_0x4f4f9f[_0xcafd('0x37')]=_[_0xcafd('0x31')](_0x4ba745,_0xcafd('0x2e'));_0x4f4f9f[_0xcafd('0x38')]=_[_0xcafd('0x39')](_0x3db069[_0xcafd('0x38')]);_0x4f4f9f[_0xcafd('0x3a')]=_['intersection'](_0x4f4f9f[_0xcafd('0x37')],_0x4f4f9f[_0xcafd('0x38')]);_0x11a5c4[_0xcafd('0x3b')]=_[_0xcafd('0x3c')](_0x4f4f9f[_0xcafd('0x37')],qs[_0xcafd('0x3d')](_0x3db069[_0xcafd('0x38')]['fields']));_0x11a5c4[_0xcafd('0x3b')]=_0x11a5c4[_0xcafd('0x3b')][_0xcafd('0x3e')]?_0x11a5c4[_0xcafd('0x3b')]:_0x4f4f9f[_0xcafd('0x37')];if(!_0x3db069[_0xcafd('0x38')][_0xcafd('0x3f')]('nolimit')){_0x11a5c4[_0xcafd('0x1e')]=qs['limit'](_0x3db069[_0xcafd('0x38')][_0xcafd('0x1e')]);_0x11a5c4[_0xcafd('0x20')]=qs['offset'](_0x3db069[_0xcafd('0x38')][_0xcafd('0x20')]);}_0x11a5c4[_0xcafd('0x40')]=qs['sort'](_0x3db069[_0xcafd('0x38')]['sort']);_0x11a5c4['where']=qs[_0xcafd('0x3a')](_[_0xcafd('0x41')](_0x3db069[_0xcafd('0x38')],_0x4f4f9f[_0xcafd('0x3a')]),_0x4ba745);if(_0x3db069['query'][_0xcafd('0x42')]){_0x11a5c4[_0xcafd('0x43')]=_[_0xcafd('0x44')](_0x11a5c4[_0xcafd('0x43')],{'$or':_[_0xcafd('0x31')](_0x4ba745,function(_0x2239f2){if(_0x2239f2[_0xcafd('0x35')]!==_0xcafd('0x45')){var _0x380bdb={};_0x380bdb[_0x2239f2[_0xcafd('0x2e')]]={'$like':'%'+_0x3db069['query'][_0xcafd('0x42')]+'%'};return _0x380bdb;}})});}_0x11a5c4=_['merge']({},_0x11a5c4,_0x3db069[_0xcafd('0x46')]);var _0x22b7ad={'where':_0x11a5c4[_0xcafd('0x43')]};return db[_0xcafd('0x32')][_0xcafd('0x1f')](_0x22b7ad)[_0xcafd('0x26')](function(_0x2f03b4){_0x701d6[_0xcafd('0x1f')]=_0x2f03b4;if(_0x3db069['query'][_0xcafd('0x47')]){_0x11a5c4['include']=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x11a5c4);})[_0xcafd('0x26')](function(_0x361bcc){_0x701d6[_0xcafd('0x48')]=_0x361bcc;return _0x701d6;})['then'](respondWithFilteredResult(_0x26e1a9,_0x11a5c4))['catch'](handleError(_0x26e1a9,null));};exports[_0xcafd('0x49')]=function(_0x3e71ae,_0x1b2838){var _0x9d89cd={'raw':!![],'where':{'id':_0x3e71ae[_0xcafd('0x4a')]['id']}},_0x5c6144={};_0x5c6144[_0xcafd('0x37')]=_[_0xcafd('0x39')](db[_0xcafd('0x32')]['rawAttributes']);_0x5c6144[_0xcafd('0x38')]=_[_0xcafd('0x39')](_0x3e71ae[_0xcafd('0x38')]);_0x5c6144['filters']=_[_0xcafd('0x3c')](_0x5c6144[_0xcafd('0x37')],_0x5c6144['query']);_0x9d89cd['attributes']=_[_0xcafd('0x3c')](_0x5c6144['model'],qs[_0xcafd('0x3d')](_0x3e71ae[_0xcafd('0x38')][_0xcafd('0x3d')]));_0x9d89cd[_0xcafd('0x3b')]=_0x9d89cd[_0xcafd('0x3b')][_0xcafd('0x3e')]?_0x9d89cd[_0xcafd('0x3b')]:_0x5c6144['model'];if(_0x3e71ae[_0xcafd('0x38')][_0xcafd('0x47')]){_0x9d89cd[_0xcafd('0x4b')]=[{'all':!![]}];}_0x9d89cd=_[_0xcafd('0x44')]({},_0x9d89cd,_0x3e71ae[_0xcafd('0x46')]);return db[_0xcafd('0x32')][_0xcafd('0x4c')](_0x9d89cd)['then'](handleEntityNotFound(_0x1b2838,null))['then'](respondWithResult(_0x1b2838,null))[_0xcafd('0x4d')](handleError(_0x1b2838,null));};exports['create']=function(_0x1a6436,_0xf1eab9){return db[_0xcafd('0x32')][_0xcafd('0x4e')](_0x1a6436[_0xcafd('0x4f')],{})[_0xcafd('0x26')](function(_0x4dd7c1){var _0x4966ce=_0x1a6436[_0xcafd('0x50')][_0xcafd('0x28')]({'plain':!![]});if(!_0x4966ce)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4966ce[_0xcafd('0x51')]===_0xcafd('0x50')){var _0x320c60=_0x4dd7c1[_0xcafd('0x28')]({'plain':!![]});var _0x23db4c=_0xcafd('0x29');return db[_0xcafd('0x52')]['find']({'where':{'name':_0x23db4c,'userProfileId':_0x4966ce['userProfileId']},'raw':!![]})[_0xcafd('0x26')](function(_0xc522c8){if(_0xc522c8&&_0xc522c8['autoAssociation']===0x0){return db[_0xcafd('0x2a')]['create']({'name':_0x320c60[_0xcafd('0x2e')],'resourceId':_0x320c60['id'],'type':_0xc522c8[_0xcafd('0x2e')],'sectionId':_0xc522c8['id']},{})[_0xcafd('0x26')](function(){return _0x4dd7c1;});}else{return _0x4dd7c1;}})['catch'](function(_0x50e888){logger[_0xcafd('0x2d')](_0xcafd('0x53'),_0x50e888);throw _0x50e888;});}return _0x4dd7c1;})[_0xcafd('0x26')](respondWithResult(_0xf1eab9,0xc9))[_0xcafd('0x4d')](handleError(_0xf1eab9,null));};exports[_0xcafd('0x54')]=function(_0xd3c502,_0x305ab3){if(_0xd3c502[_0xcafd('0x4f')]['id']){delete _0xd3c502[_0xcafd('0x4f')]['id'];}return db[_0xcafd('0x32')]['find']({'where':{'id':_0xd3c502[_0xcafd('0x4a')]['id']}})[_0xcafd('0x26')](handleEntityNotFound(_0x305ab3,null))[_0xcafd('0x26')](saveUpdates(_0xd3c502[_0xcafd('0x4f')],null))[_0xcafd('0x26')](respondWithResult(_0x305ab3,null))[_0xcafd('0x4d')](handleError(_0x305ab3,null));};exports[_0xcafd('0x27')]=function(_0x1d0197,_0x2c71ee){return db['SmsQueue'][_0xcafd('0x4c')]({'where':{'id':_0x1d0197[_0xcafd('0x4a')]['id']}})[_0xcafd('0x26')](handleEntityNotFound(_0x2c71ee,null))[_0xcafd('0x26')](removeEntity(_0x2c71ee,null))[_0xcafd('0x4d')](handleError(_0x2c71ee,null));};exports['describe']=function(_0x119f65,_0x511bb3){return db['SmsQueue'][_0xcafd('0x55')]()[_0xcafd('0x26')](respondWithResult(_0x511bb3,null))[_0xcafd('0x4d')](handleError(_0x511bb3,null));};exports[_0xcafd('0x56')]=function(_0x2f06ed,_0x3aa5ac,_0x14e6ab){var _0x3d159e={'raw':!![],'where':{}},_0x3a5882={},_0x3a8775;return db[_0xcafd('0x32')][_0xcafd('0x57')]({'where':{'id':_0x2f06ed[_0xcafd('0x4a')]['id']}})[_0xcafd('0x26')](handleEntityNotFound(_0x3aa5ac,null))[_0xcafd('0x26')](function(_0x250ec6){if(_0x250ec6){_0x3a8775=_0x250ec6[_0xcafd('0x28')]({'plain':!![]});_0x3a5882[_0xcafd('0x37')]=_[_0xcafd('0x39')](db['UserSmsQueue'][_0xcafd('0x33')]);_0x3a5882['query']=_[_0xcafd('0x39')](_0x2f06ed[_0xcafd('0x38')]);_0x3a5882[_0xcafd('0x3a')]=_[_0xcafd('0x3c')](_0x3a5882[_0xcafd('0x37')],_0x3a5882[_0xcafd('0x38')]);_0x3d159e['attributes']=_[_0xcafd('0x3c')](_0x3a5882[_0xcafd('0x37')],qs['fields'](_0x2f06ed['query']['fields']));_0x3d159e[_0xcafd('0x3b')]=_0x3d159e[_0xcafd('0x3b')][_0xcafd('0x3e')]?_0x3d159e[_0xcafd('0x3b')]:_0x3a5882[_0xcafd('0x37')];if(!_0x2f06ed[_0xcafd('0x38')][_0xcafd('0x3f')](_0xcafd('0x58'))){_0x3d159e['limit']=qs[_0xcafd('0x1e')](_0x2f06ed['query'][_0xcafd('0x1e')]);_0x3d159e[_0xcafd('0x20')]=qs[_0xcafd('0x20')](_0x2f06ed[_0xcafd('0x38')][_0xcafd('0x20')]);}_0x3d159e[_0xcafd('0x40')]=qs[_0xcafd('0x59')](_0x2f06ed[_0xcafd('0x38')]['sort']);_0x3d159e[_0xcafd('0x43')]=qs[_0xcafd('0x3a')](_[_0xcafd('0x41')](_0x2f06ed[_0xcafd('0x38')],_0x3a5882['filters']));_0x3d159e['where'][_0xcafd('0x5a')]=_0x250ec6['id'];if(_0x2f06ed[_0xcafd('0x38')][_0xcafd('0x42')]){_0x3d159e[_0xcafd('0x43')]=_[_0xcafd('0x44')](_0x3d159e['where'],{'$or':_[_0xcafd('0x31')](_0x3d159e[_0xcafd('0x3b')],function(_0x1a3beb){var _0x53df08={};_0x53df08[_0x1a3beb]={'$like':'%'+_0x2f06ed[_0xcafd('0x38')][_0xcafd('0x42')]+'%'};return _0x53df08;})});}_0x3d159e=_[_0xcafd('0x44')]({},_0x3d159e,_0x2f06ed[_0xcafd('0x46')]);return db['UserSmsQueue'][_0xcafd('0x5b')](_0x3d159e);}})[_0xcafd('0x26')](function(_0x57e422){if(_0x57e422){return db[_0xcafd('0x5c')][_0xcafd('0x5d')]({'where':{'id':_[_0xcafd('0x31')](_0x57e422,_0xcafd('0x5e')),'role':'agent'},'attributes':['id','name',_0xcafd('0x5f'),'updatedAt',_0xcafd('0x60')]});}})[_0xcafd('0x26')](function(_0x11b832){if(_0x11b832){return{'count':_0x11b832[_0xcafd('0x1f')],'rows':_[_0xcafd('0x31')](_0x11b832[_0xcafd('0x48')],function(_0x4acb2f){return{'membername':_0x4acb2f[_0xcafd('0x2e')],'UserId':_0x4acb2f['id'],'queue_name':_0x3a8775['name'],'SmsQueueId':_0x3a8775['id'],'interface':util['format'](_0xcafd('0x61'),_0xcafd('0x62'),_0x4acb2f[_0xcafd('0x2e')]),'penalty':0x0,'paused':_0x4acb2f[_0xcafd('0x5f')],'createdAt':_0x4acb2f[_0xcafd('0x60')],'updatedAt':_0x4acb2f[_0xcafd('0x63')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xcafd('0x26')](respondWithFilteredResult(_0x3aa5ac,_0x3d159e))[_0xcafd('0x4d')](handleError(_0x3aa5ac,null));};exports[_0xcafd('0x64')]=function(_0x1c7705,_0x4b14f0,_0x127a3a){var _0x46c970={};var _0x15542b={};var _0x5ea967;var _0x328dbe;return db['SmsQueue'][_0xcafd('0x57')]({'where':{'id':_0x1c7705[_0xcafd('0x4a')]['id']}})[_0xcafd('0x26')](handleEntityNotFound(_0x4b14f0,null))['then'](function(_0x9323c0){if(_0x9323c0){_0x5ea967=_0x9323c0;_0x15542b[_0xcafd('0x37')]=_[_0xcafd('0x39')](db['Team'][_0xcafd('0x33')]);_0x15542b[_0xcafd('0x38')]=_[_0xcafd('0x39')](_0x1c7705[_0xcafd('0x38')]);_0x15542b['filters']=_['intersection'](_0x15542b['model'],_0x15542b[_0xcafd('0x38')]);_0x46c970[_0xcafd('0x3b')]=_[_0xcafd('0x3c')](_0x15542b['model'],qs[_0xcafd('0x3d')](_0x1c7705[_0xcafd('0x38')]['fields']));_0x46c970[_0xcafd('0x3b')]=_0x46c970[_0xcafd('0x3b')][_0xcafd('0x3e')]?_0x46c970[_0xcafd('0x3b')]:_0x15542b['model'];_0x46c970['order']=qs['sort'](_0x1c7705[_0xcafd('0x38')][_0xcafd('0x59')]);_0x46c970[_0xcafd('0x43')]=qs['filters'](_[_0xcafd('0x41')](_0x1c7705[_0xcafd('0x38')],_0x15542b[_0xcafd('0x3a')]));if(_0x1c7705['query'][_0xcafd('0x42')]){_0x46c970[_0xcafd('0x43')]=_['merge'](_0x46c970['where'],{'$or':_[_0xcafd('0x31')](_0x46c970[_0xcafd('0x3b')],function(_0x2275a1){var _0x240a02={};_0x240a02[_0x2275a1]={'$like':'%'+_0x1c7705[_0xcafd('0x38')][_0xcafd('0x42')]+'%'};return _0x240a02;})});}_0x46c970=_[_0xcafd('0x44')]({},_0x46c970,_0x1c7705[_0xcafd('0x46')]);return _0x5ea967[_0xcafd('0x64')](_0x46c970);}})['then'](function(_0x4ea278){if(_0x4ea278){_0x328dbe=_0x4ea278['length'];if(!_0x1c7705[_0xcafd('0x38')]['hasOwnProperty'](_0xcafd('0x58'))){_0x46c970[_0xcafd('0x1e')]=qs[_0xcafd('0x1e')](_0x1c7705[_0xcafd('0x38')][_0xcafd('0x1e')]);_0x46c970[_0xcafd('0x20')]=qs['offset'](_0x1c7705['query']['offset']);}return _0x5ea967['getTeams'](_0x46c970);}})['then'](function(_0x51c09a){if(_0x51c09a){return _0x51c09a?{'count':_0x328dbe,'rows':_0x51c09a}:null;}})[_0xcafd('0x26')](respondWithResult(_0x4b14f0,null))['catch'](handleError(_0x4b14f0,null));};exports['addTeams']=function(_0x198315,_0x4d0f3b,_0x470951){var _0x15ec94=_0x198315[_0xcafd('0x4f')][_0xcafd('0x65')];return db[_0xcafd('0x66')][_0xcafd('0x5b')]({'where':{'id':_0x15ec94},'attributes':['id'],'include':[{'model':db[_0xcafd('0x5c')],'as':_0xcafd('0x67'),'attributes':['id',_0xcafd('0x2e'),'online','voicePause',_0xcafd('0x68')],'raw':!![]}]})['then'](function(_0xf163d1){if(_0xf163d1){var _0x1fb1ca=_[_0xcafd('0x69')](_0xf163d1,function(_0x31b9af){var _0xcd329d=_0x31b9af[_0xcafd('0x28')]({'plain':!![]});return _0xcd329d['Agents'];});return db['SmsQueue'][_0xcafd('0x4c')]({'where':{'id':_0x198315['params']['id']}})[_0xcafd('0x26')](function(_0x3e8c7b){return db[_0xcafd('0x6a')][_0xcafd('0x6b')](function(_0x52ed10){return _0x3e8c7b[_0xcafd('0x6c')](_0x15ec94,{'transaction':_0x52ed10})[_0xcafd('0x26')](function(){return BPromise[_0xcafd('0x6d')](_0x1fb1ca,function(_0x41bafc){return db['UserSmsQueue'][_0xcafd('0x6e')]({'where':{'UserId':_0x41bafc['id'],'SmsQueueId':_0x198315[_0xcafd('0x4a')]['id']},'transaction':_0x52ed10});});})[_0xcafd('0x26')](function(){_0x1fb1ca[_0xcafd('0x6f')](function(_0x248aa3){socket[_0xcafd('0x70')](_0xcafd('0x71'),{'UserId':_0x248aa3['id'],'SmsQueueId':_0x3e8c7b['id']});});});});});}})[_0xcafd('0x26')](respondWithStatusCode(_0x4d0f3b,null))['catch'](handleError(_0x4d0f3b,null));};exports[_0xcafd('0x72')]=function(_0x4cd012,_0x4e7b54,_0x4c8dc6){return db[_0xcafd('0x66')][_0xcafd('0x5b')]({'where':{'id':_0x4cd012[_0xcafd('0x38')][_0xcafd('0x65')]},'attributes':['id'],'include':[{'model':db[_0xcafd('0x5c')],'as':_0xcafd('0x67'),'attributes':['id'],'raw':!![]}]})[_0xcafd('0x26')](handleEntityNotFound(_0x4e7b54,null))[_0xcafd('0x26')](function(_0x3d634a){var _0x2fe4c0=_[_0xcafd('0x31')](_0x3d634a,'id');var _0x388de5=[];var _0x3467d5=[];var _0xe7fcca=squel[_0xcafd('0x73')]();_0xe7fcca[_0xcafd('0x74')]('tq.TeamId')[_0xcafd('0x75')](_0xcafd('0x76'),'tq')['join'](_0xcafd('0x77'),'ut',_0xcafd('0x78'))['where'](_0xcafd('0x79'),_0x4cd012[_0xcafd('0x4a')]['id']);for(var _0x13c5d9=0x0;_0x13c5d9<_0x3d634a['length'];_0x13c5d9+=0x1){let _0x1c460a=_0x3d634a[_0x13c5d9];for(var _0x90c798=0x0;_0x90c798<_0x1c460a[_0xcafd('0x67')][_0xcafd('0x3e')];_0x90c798+=0x1){let _0x3f08d0=_0x1c460a[_0xcafd('0x67')][_0x90c798];var _0xe827d7=_0xe7fcca['clone']();_0xe827d7['where']('ut.UserId\x20=\x20?',_0x3f08d0['id']);_0x3467d5[_0xcafd('0x7a')](db[_0xcafd('0x6a')][_0xcafd('0x38')](_0xe827d7[_0xcafd('0x7b')](),{'type':db[_0xcafd('0x6a')]['QueryTypes'][_0xcafd('0x7c')]})[_0xcafd('0x26')](function(_0xb97bf2){if(_0xb97bf2['length']===0x1){return _0x3f08d0['id'];}else{var _0x2b50dc=_[_0xcafd('0x7d')](_[_0xcafd('0x31')](_0xb97bf2,_0xcafd('0x7e')),function(_0x10d866){return _[_0xcafd('0x7f')](_0x2fe4c0,_0x10d866);});if(_0x2b50dc){return _0x3f08d0['id'];}}}));}}return BPromise[_0xcafd('0x80')](_0x3467d5)[_0xcafd('0x26')](function(_0x4f6512){_0x388de5=_(_0x388de5)['union'](_0x4f6512)[_0xcafd('0x81')]()[_0xcafd('0x82')]();return db[_0xcafd('0x32')][_0xcafd('0x4c')]({'where':{'id':_0x4cd012[_0xcafd('0x4a')]['id']}})['then'](function(_0x51da1d){return db['sequelize'][_0xcafd('0x6b')](function(_0x407ac7){return _0x51da1d[_0xcafd('0x72')](_0x4cd012[_0xcafd('0x38')][_0xcafd('0x65')],{'transaction':_0x407ac7})[_0xcafd('0x26')](function(){if(!_[_0xcafd('0x83')](_0x388de5)){return _0x51da1d[_0xcafd('0x84')](_0x388de5,{'transaction':_0x407ac7});}})[_0xcafd('0x26')](function(){_0x388de5[_0xcafd('0x6f')](function(_0x237694){socket[_0xcafd('0x70')](_0xcafd('0x85'),{'UserId':_0x237694,'SmsQueueId':_0x51da1d['id']});});});});});});})[_0xcafd('0x26')](respondWithStatusCode(_0x4e7b54,null))[_0xcafd('0x4d')](handleError(_0x4e7b54,null));};exports[_0xcafd('0x86')]=function(_0x50185,_0x5479e0,_0x2ead4c){return db[_0xcafd('0x32')]['find']({'where':{'id':_0x50185[_0xcafd('0x4a')]['id']}})[_0xcafd('0x26')](handleEntityNotFound(_0x5479e0,null))[_0xcafd('0x26')](function(_0x446595){if(_0x446595){return _0x446595[_0xcafd('0x86')](_0x50185[_0xcafd('0x4f')]['ids'],_['omit'](_0x50185[_0xcafd('0x4f')],[_0xcafd('0x65'),'id'])||{})[_0xcafd('0x87')](function(_0x591140){for(var _0x8e0f94=0x0;_0x8e0f94<_0x50185[_0xcafd('0x4f')][_0xcafd('0x65')][_0xcafd('0x3e')];_0x8e0f94+=0x1){socket['emit'](_0xcafd('0x71'),{'UserId':Number(_0x50185[_0xcafd('0x4f')][_0xcafd('0x65')][_0x8e0f94]),'SmsQueueId':Number(_0x50185[_0xcafd('0x4a')]['id'])});}return _0x591140;});}})[_0xcafd('0x26')](respondWithResult(_0x5479e0,null))[_0xcafd('0x4d')](handleError(_0x5479e0,null));};exports[_0xcafd('0x84')]=function(_0x5e16c0,_0x424280,_0x228bf3){return db[_0xcafd('0x32')][_0xcafd('0x4c')]({'where':{'id':_0x5e16c0['params']['id']}})[_0xcafd('0x26')](handleEntityNotFound(_0x424280,null))['then'](function(_0x880477){if(_0x880477){return _0x880477[_0xcafd('0x84')](_0x5e16c0[_0xcafd('0x38')][_0xcafd('0x65')])['then'](function(){if(_[_0xcafd('0x88')](_0x5e16c0[_0xcafd('0x38')][_0xcafd('0x65')])){for(var _0xaff20d=0x0;_0xaff20d<_0x5e16c0[_0xcafd('0x38')]['ids'][_0xcafd('0x3e')];_0xaff20d+=0x1){socket[_0xcafd('0x70')](_0xcafd('0x85'),{'UserId':Number(_0x5e16c0['query'][_0xcafd('0x65')][_0xaff20d]),'SmsQueueId':Number(_0x5e16c0[_0xcafd('0x4a')]['id'])});}}else{socket[_0xcafd('0x70')]('userSmsQueue:remove',{'UserId':Number(_0x5e16c0['query']['ids']),'SmsQueueId':Number(_0x5e16c0[_0xcafd('0x4a')]['id'])});}});}})[_0xcafd('0x26')](respondWithStatusCode(_0x424280,null))[_0xcafd('0x4d')](handleError(_0x424280,null));};exports[_0xcafd('0x89')]=function(_0x4d83ec,_0x5ca142,_0x2ed0db){var _0x53237b={};var _0x4aa8e0={};var _0x650f1d;var _0x17a8e4;return db[_0xcafd('0x32')][_0xcafd('0x57')]({'where':{'id':_0x4d83ec[_0xcafd('0x4a')]['id']}})[_0xcafd('0x26')](handleEntityNotFound(_0x5ca142,null))[_0xcafd('0x26')](function(_0x34abfa){if(_0x34abfa){_0x650f1d=_0x34abfa;_0x4aa8e0[_0xcafd('0x37')]=_[_0xcafd('0x39')](db[_0xcafd('0x5c')]['rawAttributes']);_0x4aa8e0[_0xcafd('0x38')]=_[_0xcafd('0x39')](_0x4d83ec[_0xcafd('0x38')]);_0x4aa8e0[_0xcafd('0x3a')]=_[_0xcafd('0x3c')](_0x4aa8e0[_0xcafd('0x37')],_0x4aa8e0[_0xcafd('0x38')]);_0x53237b[_0xcafd('0x3b')]=_[_0xcafd('0x3c')](_0x4aa8e0[_0xcafd('0x37')],qs[_0xcafd('0x3d')](_0x4d83ec[_0xcafd('0x38')][_0xcafd('0x3d')]));_0x53237b[_0xcafd('0x3b')]=_0x53237b[_0xcafd('0x3b')]['length']?_0x53237b[_0xcafd('0x3b')]:_0x4aa8e0[_0xcafd('0x37')];_0x53237b[_0xcafd('0x40')]=qs['sort'](_0x4d83ec[_0xcafd('0x38')][_0xcafd('0x59')]);_0x53237b[_0xcafd('0x43')]=qs[_0xcafd('0x3a')](_['pick'](_0x4d83ec[_0xcafd('0x38')],_0x4aa8e0[_0xcafd('0x3a')]));if(_0x4d83ec[_0xcafd('0x38')][_0xcafd('0x42')]){_0x53237b['where']=_[_0xcafd('0x44')](_0x53237b[_0xcafd('0x43')],{'$or':_[_0xcafd('0x31')](_0x53237b['attributes'],function(_0x2d8213){var _0x203639={};_0x203639[_0x2d8213]={'$like':'%'+_0x4d83ec[_0xcafd('0x38')][_0xcafd('0x42')]+'%'};return _0x203639;})});}_0x53237b=_[_0xcafd('0x44')]({},_0x53237b,_0x4d83ec[_0xcafd('0x46')]);return _0x650f1d['getAgents'](_0x53237b);}})[_0xcafd('0x26')](function(_0x3990bc){if(_0x3990bc){_0x17a8e4=_0x3990bc[_0xcafd('0x3e')];if(!_0x4d83ec[_0xcafd('0x38')]['hasOwnProperty'](_0xcafd('0x58'))){_0x53237b[_0xcafd('0x1e')]=qs[_0xcafd('0x1e')](_0x4d83ec[_0xcafd('0x38')][_0xcafd('0x1e')]);_0x53237b[_0xcafd('0x20')]=qs[_0xcafd('0x20')](_0x4d83ec[_0xcafd('0x38')][_0xcafd('0x20')]);}return _0x650f1d[_0xcafd('0x89')](_0x53237b);}})[_0xcafd('0x26')](function(_0x3170fd){if(_0x3170fd){return _0x3170fd?{'count':_0x17a8e4,'rows':_0x3170fd}:null;}})[_0xcafd('0x26')](respondWithResult(_0x5ca142,null))[_0xcafd('0x4d')](handleError(_0x5ca142,null));}; \ No newline at end of file +var _0xffcf=['find','create','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','UserSmsQueue','nolimit','sort','SmsQueueId','findAll','findAndCountAll','UserId','smsPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','pick','addTeams','ids','Team','User','Agents','online','voicePause','flatMap','each','findOrCreate','emit','userSmsQueue:save','removeTeams','select','field','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','transaction','removeAgents','userSmsQueue:remove','addAgents','omit','isArray','getAgents','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs','lodash','squel','crypto','jsforce','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','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','UserProfileResource','stack','name','send','index','SmsQueue','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','order','where','filter','merge','map','count','includeAll','include','catch','show','params','options'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xffcf,0x169));var _0xfffc=function(_0x65d12e,_0x4b0a30){_0x65d12e=_0x65d12e-0x0;var _0x4274e0=_0xffcf[_0x65d12e];return _0x4274e0;};'use strict';var emlformat=require(_0xfffc('0x0'));var rimraf=require(_0xfffc('0x1'));var zipdir=require(_0xfffc('0x2'));var jsonpatch=require(_0xfffc('0x3'));var rp=require(_0xfffc('0x4'));var moment=require(_0xfffc('0x5'));var BPromise=require(_0xfffc('0x6'));var Mustache=require('mustache');var util=require(_0xfffc('0x7'));var path=require(_0xfffc('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xfffc('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xfffc('0xa'));var squel=require(_0xfffc('0xb'));var crypto=require(_0xfffc('0xc'));var jsforce=require(_0xfffc('0xd'));var deskjs=require(_0xfffc('0xe'));var toCsv=require(_0xfffc('0xf'));var querystring=require(_0xfffc('0x10'));var Papa=require(_0xfffc('0x11'));var Redis=require(_0xfffc('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xfffc('0x13'));var as=require(_0xfffc('0x14'));var hardwareService=require(_0xfffc('0x15'));var logger=require(_0xfffc('0x16'))(_0xfffc('0x17'));var utils=require('../../config/utils');var config=require(_0xfffc('0x18'));var licenseUtil=require(_0xfffc('0x19'));var db=require(_0xfffc('0x1a'))['db'];config[_0xfffc('0x1b')]=_[_0xfffc('0x1c')](config[_0xfffc('0x1b')],{'host':_0xfffc('0x1d'),'port':0x18eb});var socket=require(_0xfffc('0x1e'))(new Redis(config[_0xfffc('0x1b')]));require(_0xfffc('0x1f'))['register'](socket);function respondWithStatusCode(_0x7040cb,_0xa0088a){_0xa0088a=_0xa0088a||0xcc;return function(_0x12ee17){if(_0x12ee17){return _0x7040cb[_0xfffc('0x20')](_0xa0088a);}return _0x7040cb[_0xfffc('0x21')](_0xa0088a)[_0xfffc('0x22')]();};}function respondWithResult(_0x178190,_0x534e13){_0x534e13=_0x534e13||0xc8;return function(_0x1899e7){if(_0x1899e7){return _0x178190[_0xfffc('0x21')](_0x534e13)[_0xfffc('0x23')](_0x1899e7);}};}function respondWithFilteredResult(_0x676d3d,_0x404378){return function(_0x15347d){if(_0x15347d){var _0x204975=typeof _0x404378[_0xfffc('0x24')]===_0xfffc('0x25')&&typeof _0x404378[_0xfffc('0x26')]===_0xfffc('0x25');var _0x358f1b=_0x15347d['count'];var _0x4e8295=_0x204975?0x0:_0x404378[_0xfffc('0x24')];var _0x42ef0c=_0x204975?_0x15347d['count']:_0x404378[_0xfffc('0x24')]+_0x404378[_0xfffc('0x26')];var _0xd199de;if(_0x42ef0c>=_0x358f1b){_0x42ef0c=_0x358f1b;_0xd199de=0xc8;}else{_0xd199de=0xce;}_0x676d3d['status'](_0xd199de);return _0x676d3d['set'](_0xfffc('0x27'),_0x4e8295+'-'+_0x42ef0c+'/'+_0x358f1b)[_0xfffc('0x23')](_0x15347d);}return null;};}function patchUpdates(_0x1da603){return function(_0x5c3d9b){try{jsonpatch[_0xfffc('0x28')](_0x5c3d9b,_0x1da603,!![]);}catch(_0x103a7a){return BPromise[_0xfffc('0x29')](_0x103a7a);}return _0x5c3d9b[_0xfffc('0x2a')]();};}function saveUpdates(_0x10d9ce,_0x47fb51){return function(_0x304f65){if(_0x304f65){return _0x304f65[_0xfffc('0x2b')](_0x10d9ce)[_0xfffc('0x2c')](function(_0x2d7529){return _0x2d7529;});}return null;};}function removeEntity(_0x2a5c13,_0x345b3d){return function(_0x2e9627){if(_0x2e9627){return _0x2e9627[_0xfffc('0x2d')]()[_0xfffc('0x2c')](function(){var _0x422109=_0x2e9627[_0xfffc('0x2e')]({'plain':!![]});var _0x261be1=_0xfffc('0x2f');return db[_0xfffc('0x30')][_0xfffc('0x2d')]({'where':{'type':_0x261be1,'resourceId':_0x422109['id']}})[_0xfffc('0x2c')](function(){return _0x2e9627;});})['then'](function(){_0x2a5c13['status'](0xcc)[_0xfffc('0x22')]();});}};}function handleEntityNotFound(_0x9c4bed,_0x1d9697){return function(_0x123fef){if(!_0x123fef){_0x9c4bed[_0xfffc('0x20')](0x194);}return _0x123fef;};}function handleError(_0xfe0a16,_0x184122){_0x184122=_0x184122||0x1f4;return function(_0x1f401b){logger['error'](_0x1f401b[_0xfffc('0x31')]);if(_0x1f401b[_0xfffc('0x32')]){delete _0x1f401b[_0xfffc('0x32')];}_0xfe0a16['status'](_0x184122)[_0xfffc('0x33')](_0x1f401b);};}exports[_0xfffc('0x34')]=function(_0x290421,_0x49c853){var _0x186075={},_0x2ed3ab={},_0x431617={'count':0x0,'rows':[]};var _0x197d19=_['map'](db[_0xfffc('0x35')][_0xfffc('0x36')],function(_0x333701){return{'name':_0x333701['fieldName'],'type':_0x333701[_0xfffc('0x37')][_0xfffc('0x38')]};});_0x2ed3ab[_0xfffc('0x39')]=_['map'](_0x197d19,_0xfffc('0x32'));_0x2ed3ab[_0xfffc('0x3a')]=_[_0xfffc('0x3b')](_0x290421[_0xfffc('0x3a')]);_0x2ed3ab[_0xfffc('0x3c')]=_[_0xfffc('0x3d')](_0x2ed3ab[_0xfffc('0x39')],_0x2ed3ab[_0xfffc('0x3a')]);_0x186075[_0xfffc('0x3e')]=_[_0xfffc('0x3d')](_0x2ed3ab[_0xfffc('0x39')],qs[_0xfffc('0x3f')](_0x290421[_0xfffc('0x3a')][_0xfffc('0x3f')]));_0x186075[_0xfffc('0x3e')]=_0x186075[_0xfffc('0x3e')][_0xfffc('0x40')]?_0x186075['attributes']:_0x2ed3ab[_0xfffc('0x39')];if(!_0x290421[_0xfffc('0x3a')]['hasOwnProperty']('nolimit')){_0x186075[_0xfffc('0x26')]=qs[_0xfffc('0x26')](_0x290421[_0xfffc('0x3a')][_0xfffc('0x26')]);_0x186075['offset']=qs['offset'](_0x290421[_0xfffc('0x3a')][_0xfffc('0x24')]);}_0x186075[_0xfffc('0x41')]=qs['sort'](_0x290421[_0xfffc('0x3a')]['sort']);_0x186075[_0xfffc('0x42')]=qs[_0xfffc('0x3c')](_['pick'](_0x290421[_0xfffc('0x3a')],_0x2ed3ab[_0xfffc('0x3c')]),_0x197d19);if(_0x290421['query'][_0xfffc('0x43')]){_0x186075[_0xfffc('0x42')]=_[_0xfffc('0x44')](_0x186075['where'],{'$or':_[_0xfffc('0x45')](_0x197d19,function(_0x3a38b4){if(_0x3a38b4[_0xfffc('0x37')]!=='VIRTUAL'){var _0x252773={};_0x252773[_0x3a38b4[_0xfffc('0x32')]]={'$like':'%'+_0x290421[_0xfffc('0x3a')][_0xfffc('0x43')]+'%'};return _0x252773;}})});}_0x186075=_[_0xfffc('0x44')]({},_0x186075,_0x290421['options']);var _0x58b444={'where':_0x186075[_0xfffc('0x42')]};return db[_0xfffc('0x35')][_0xfffc('0x46')](_0x58b444)[_0xfffc('0x2c')](function(_0x573a1f){_0x431617[_0xfffc('0x46')]=_0x573a1f;if(_0x290421[_0xfffc('0x3a')][_0xfffc('0x47')]){_0x186075[_0xfffc('0x48')]=[{'all':!![]}];}return db['SmsQueue']['findAll'](_0x186075);})[_0xfffc('0x2c')](function(_0x334d2f){_0x431617['rows']=_0x334d2f;return _0x431617;})[_0xfffc('0x2c')](respondWithFilteredResult(_0x49c853,_0x186075))[_0xfffc('0x49')](handleError(_0x49c853,null));};exports[_0xfffc('0x4a')]=function(_0x26eb03,_0x20e205){var _0x5a3665={'raw':!![],'where':{'id':_0x26eb03[_0xfffc('0x4b')]['id']}},_0x4a7054={};_0x4a7054[_0xfffc('0x39')]=_[_0xfffc('0x3b')](db[_0xfffc('0x35')][_0xfffc('0x36')]);_0x4a7054[_0xfffc('0x3a')]=_[_0xfffc('0x3b')](_0x26eb03['query']);_0x4a7054[_0xfffc('0x3c')]=_['intersection'](_0x4a7054[_0xfffc('0x39')],_0x4a7054['query']);_0x5a3665[_0xfffc('0x3e')]=_[_0xfffc('0x3d')](_0x4a7054[_0xfffc('0x39')],qs[_0xfffc('0x3f')](_0x26eb03[_0xfffc('0x3a')][_0xfffc('0x3f')]));_0x5a3665[_0xfffc('0x3e')]=_0x5a3665[_0xfffc('0x3e')][_0xfffc('0x40')]?_0x5a3665[_0xfffc('0x3e')]:_0x4a7054[_0xfffc('0x39')];if(_0x26eb03[_0xfffc('0x3a')][_0xfffc('0x47')]){_0x5a3665[_0xfffc('0x48')]=[{'all':!![]}];}_0x5a3665=_[_0xfffc('0x44')]({},_0x5a3665,_0x26eb03[_0xfffc('0x4c')]);return db['SmsQueue'][_0xfffc('0x4d')](_0x5a3665)[_0xfffc('0x2c')](handleEntityNotFound(_0x20e205,null))[_0xfffc('0x2c')](respondWithResult(_0x20e205,null))['catch'](handleError(_0x20e205,null));};exports[_0xfffc('0x4e')]=function(_0x237b1c,_0x4baba8){return db[_0xfffc('0x35')][_0xfffc('0x4e')](_0x237b1c['body'],{})[_0xfffc('0x2c')](function(_0x1631b1){var _0x57afbb=_0x237b1c['user'][_0xfffc('0x2e')]({'plain':!![]});if(!_0x57afbb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x57afbb['role']===_0xfffc('0x4f')){var _0x4e1e88=_0x1631b1[_0xfffc('0x2e')]({'plain':!![]});var _0x9e54f1=_0xfffc('0x2f');return db[_0xfffc('0x50')][_0xfffc('0x4d')]({'where':{'name':_0x9e54f1,'userProfileId':_0x57afbb[_0xfffc('0x51')]},'raw':!![]})[_0xfffc('0x2c')](function(_0x45758a){if(_0x45758a&&_0x45758a[_0xfffc('0x52')]===0x0){return db[_0xfffc('0x30')][_0xfffc('0x4e')]({'name':_0x4e1e88[_0xfffc('0x32')],'resourceId':_0x4e1e88['id'],'type':_0x45758a[_0xfffc('0x32')],'sectionId':_0x45758a['id']},{})[_0xfffc('0x2c')](function(){return _0x1631b1;});}else{return _0x1631b1;}})[_0xfffc('0x49')](function(_0x564488){logger[_0xfffc('0x53')](_0xfffc('0x54'),_0x564488);throw _0x564488;});}return _0x1631b1;})[_0xfffc('0x2c')](respondWithResult(_0x4baba8,0xc9))['catch'](handleError(_0x4baba8,null));};exports[_0xfffc('0x2b')]=function(_0x5aae40,_0x3ac901){if(_0x5aae40['body']['id']){delete _0x5aae40[_0xfffc('0x55')]['id'];}return db[_0xfffc('0x35')][_0xfffc('0x4d')]({'where':{'id':_0x5aae40['params']['id']}})[_0xfffc('0x2c')](handleEntityNotFound(_0x3ac901,null))[_0xfffc('0x2c')](saveUpdates(_0x5aae40[_0xfffc('0x55')],null))[_0xfffc('0x2c')](respondWithResult(_0x3ac901,null))[_0xfffc('0x49')](handleError(_0x3ac901,null));};exports[_0xfffc('0x2d')]=function(_0x1272fb,_0x1e8f77){return db[_0xfffc('0x35')][_0xfffc('0x4d')]({'where':{'id':_0x1272fb[_0xfffc('0x4b')]['id']}})[_0xfffc('0x2c')](handleEntityNotFound(_0x1e8f77,null))[_0xfffc('0x2c')](removeEntity(_0x1e8f77,null))['catch'](handleError(_0x1e8f77,null));};exports[_0xfffc('0x56')]=function(_0x247405,_0x309e6c){return db[_0xfffc('0x35')][_0xfffc('0x56')]()['then'](respondWithResult(_0x309e6c,null))[_0xfffc('0x49')](handleError(_0x309e6c,null));};exports[_0xfffc('0x57')]=function(_0x3b3843,_0x91d1ef,_0x51842f){var _0x19af3c={'raw':!![],'where':{}},_0x4a843e={},_0x1abbc2;return db[_0xfffc('0x35')]['findOne']({'where':{'id':_0x3b3843[_0xfffc('0x4b')]['id']}})[_0xfffc('0x2c')](handleEntityNotFound(_0x91d1ef,null))['then'](function(_0x2db62e){if(_0x2db62e){_0x1abbc2=_0x2db62e[_0xfffc('0x2e')]({'plain':!![]});_0x4a843e[_0xfffc('0x39')]=_[_0xfffc('0x3b')](db[_0xfffc('0x58')]['rawAttributes']);_0x4a843e[_0xfffc('0x3a')]=_['keys'](_0x3b3843['query']);_0x4a843e['filters']=_[_0xfffc('0x3d')](_0x4a843e['model'],_0x4a843e[_0xfffc('0x3a')]);_0x19af3c[_0xfffc('0x3e')]=_[_0xfffc('0x3d')](_0x4a843e[_0xfffc('0x39')],qs[_0xfffc('0x3f')](_0x3b3843[_0xfffc('0x3a')][_0xfffc('0x3f')]));_0x19af3c['attributes']=_0x19af3c[_0xfffc('0x3e')]['length']?_0x19af3c['attributes']:_0x4a843e[_0xfffc('0x39')];if(!_0x3b3843['query']['hasOwnProperty'](_0xfffc('0x59'))){_0x19af3c[_0xfffc('0x26')]=qs['limit'](_0x3b3843['query'][_0xfffc('0x26')]);_0x19af3c[_0xfffc('0x24')]=qs[_0xfffc('0x24')](_0x3b3843[_0xfffc('0x3a')][_0xfffc('0x24')]);}_0x19af3c[_0xfffc('0x41')]=qs[_0xfffc('0x5a')](_0x3b3843[_0xfffc('0x3a')]['sort']);_0x19af3c[_0xfffc('0x42')]=qs[_0xfffc('0x3c')](_['pick'](_0x3b3843[_0xfffc('0x3a')],_0x4a843e[_0xfffc('0x3c')]));_0x19af3c[_0xfffc('0x42')][_0xfffc('0x5b')]=_0x2db62e['id'];if(_0x3b3843['query'][_0xfffc('0x43')]){_0x19af3c[_0xfffc('0x42')]=_[_0xfffc('0x44')](_0x19af3c['where'],{'$or':_['map'](_0x19af3c[_0xfffc('0x3e')],function(_0x167b1d){var _0x1d046f={};_0x1d046f[_0x167b1d]={'$like':'%'+_0x3b3843[_0xfffc('0x3a')]['filter']+'%'};return _0x1d046f;})});}_0x19af3c=_[_0xfffc('0x44')]({},_0x19af3c,_0x3b3843[_0xfffc('0x4c')]);return db['UserSmsQueue'][_0xfffc('0x5c')](_0x19af3c);}})[_0xfffc('0x2c')](function(_0x582413){if(_0x582413){return db['User'][_0xfffc('0x5d')]({'where':{'id':_['map'](_0x582413,_0xfffc('0x5e')),'role':'agent'},'attributes':['id','name',_0xfffc('0x5f'),_0xfffc('0x60'),_0xfffc('0x61')]});}})['then'](function(_0x51e038){if(_0x51e038){return{'count':_0x51e038[_0xfffc('0x46')],'rows':_[_0xfffc('0x45')](_0x51e038['rows'],function(_0x1a10d3){return{'membername':_0x1a10d3[_0xfffc('0x32')],'UserId':_0x1a10d3['id'],'queue_name':_0x1abbc2['name'],'SmsQueueId':_0x1abbc2['id'],'interface':util[_0xfffc('0x62')](_0xfffc('0x63'),_0xfffc('0x64'),_0x1a10d3[_0xfffc('0x32')]),'penalty':0x0,'paused':_0x1a10d3[_0xfffc('0x5f')],'createdAt':_0x1a10d3[_0xfffc('0x61')],'updatedAt':_0x1a10d3['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xfffc('0x2c')](respondWithFilteredResult(_0x91d1ef,_0x19af3c))['catch'](handleError(_0x91d1ef,null));};exports[_0xfffc('0x65')]=function(_0x482f5d,_0x2b8aca,_0x2db99a){var _0x356558={};var _0x1da3de={};var _0x49ff09;var _0x4d690c;return db[_0xfffc('0x35')]['findOne']({'where':{'id':_0x482f5d[_0xfffc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2b8aca,null))[_0xfffc('0x2c')](function(_0x3a898c){if(_0x3a898c){_0x49ff09=_0x3a898c;_0x1da3de[_0xfffc('0x39')]=_[_0xfffc('0x3b')](db['Team'][_0xfffc('0x36')]);_0x1da3de[_0xfffc('0x3a')]=_[_0xfffc('0x3b')](_0x482f5d[_0xfffc('0x3a')]);_0x1da3de[_0xfffc('0x3c')]=_[_0xfffc('0x3d')](_0x1da3de[_0xfffc('0x39')],_0x1da3de[_0xfffc('0x3a')]);_0x356558[_0xfffc('0x3e')]=_[_0xfffc('0x3d')](_0x1da3de[_0xfffc('0x39')],qs['fields'](_0x482f5d[_0xfffc('0x3a')][_0xfffc('0x3f')]));_0x356558[_0xfffc('0x3e')]=_0x356558[_0xfffc('0x3e')]['length']?_0x356558[_0xfffc('0x3e')]:_0x1da3de[_0xfffc('0x39')];_0x356558['order']=qs[_0xfffc('0x5a')](_0x482f5d[_0xfffc('0x3a')][_0xfffc('0x5a')]);_0x356558[_0xfffc('0x42')]=qs[_0xfffc('0x3c')](_[_0xfffc('0x66')](_0x482f5d[_0xfffc('0x3a')],_0x1da3de[_0xfffc('0x3c')]));if(_0x482f5d[_0xfffc('0x3a')][_0xfffc('0x43')]){_0x356558[_0xfffc('0x42')]=_[_0xfffc('0x44')](_0x356558[_0xfffc('0x42')],{'$or':_[_0xfffc('0x45')](_0x356558[_0xfffc('0x3e')],function(_0x1c52b4){var _0x33487a={};_0x33487a[_0x1c52b4]={'$like':'%'+_0x482f5d[_0xfffc('0x3a')][_0xfffc('0x43')]+'%'};return _0x33487a;})});}_0x356558=_[_0xfffc('0x44')]({},_0x356558,_0x482f5d[_0xfffc('0x4c')]);return _0x49ff09[_0xfffc('0x65')](_0x356558);}})[_0xfffc('0x2c')](function(_0x1b0a7a){if(_0x1b0a7a){_0x4d690c=_0x1b0a7a[_0xfffc('0x40')];if(!_0x482f5d[_0xfffc('0x3a')]['hasOwnProperty'](_0xfffc('0x59'))){_0x356558['limit']=qs[_0xfffc('0x26')](_0x482f5d[_0xfffc('0x3a')][_0xfffc('0x26')]);_0x356558[_0xfffc('0x24')]=qs[_0xfffc('0x24')](_0x482f5d[_0xfffc('0x3a')]['offset']);}return _0x49ff09[_0xfffc('0x65')](_0x356558);}})[_0xfffc('0x2c')](function(_0xdb1c29){if(_0xdb1c29){return _0xdb1c29?{'count':_0x4d690c,'rows':_0xdb1c29}:null;}})['then'](respondWithResult(_0x2b8aca,null))[_0xfffc('0x49')](handleError(_0x2b8aca,null));};exports[_0xfffc('0x67')]=function(_0x37c6bb,_0x377355,_0x1bb892){var _0x7acd3=_0x37c6bb[_0xfffc('0x55')][_0xfffc('0x68')];return db[_0xfffc('0x69')]['findAll']({'where':{'id':_0x7acd3},'attributes':['id'],'include':[{'model':db[_0xfffc('0x6a')],'as':_0xfffc('0x6b'),'attributes':['id',_0xfffc('0x32'),_0xfffc('0x6c'),_0xfffc('0x6d'),'interface'],'raw':!![]}]})['then'](function(_0x553533){if(_0x553533){var _0x4d5ac8=_[_0xfffc('0x6e')](_0x553533,function(_0x312031){var _0x34df38=_0x312031[_0xfffc('0x2e')]({'plain':!![]});return _0x34df38[_0xfffc('0x6b')];});return db[_0xfffc('0x35')][_0xfffc('0x4d')]({'where':{'id':_0x37c6bb['params']['id']}})['then'](function(_0x2c1954){return db['sequelize']['transaction'](function(_0x37d000){return _0x2c1954[_0xfffc('0x67')](_0x7acd3,{'transaction':_0x37d000})[_0xfffc('0x2c')](function(){return BPromise[_0xfffc('0x6f')](_0x4d5ac8,function(_0x4cfa6e){return db[_0xfffc('0x58')][_0xfffc('0x70')]({'where':{'UserId':_0x4cfa6e['id'],'SmsQueueId':_0x37c6bb['params']['id']},'transaction':_0x37d000});});})[_0xfffc('0x2c')](function(){_0x4d5ac8['forEach'](function(_0x5e26fb){socket[_0xfffc('0x71')](_0xfffc('0x72'),{'UserId':_0x5e26fb['id'],'SmsQueueId':_0x2c1954['id']});});});});});}})[_0xfffc('0x2c')](respondWithStatusCode(_0x377355,null))[_0xfffc('0x49')](handleError(_0x377355,null));};exports[_0xfffc('0x73')]=function(_0x5bdf07,_0xf0752c,_0x59f4d4){return db[_0xfffc('0x69')]['findAll']({'where':{'id':_0x5bdf07[_0xfffc('0x3a')]['ids']},'attributes':['id'],'include':[{'model':db[_0xfffc('0x6a')],'as':_0xfffc('0x6b'),'attributes':['id'],'raw':!![]}]})[_0xfffc('0x2c')](handleEntityNotFound(_0xf0752c,null))[_0xfffc('0x2c')](function(_0x31ea75){var _0x1da424=_['map'](_0x31ea75,'id');var _0x41af32=[];var _0x2a728e=[];var _0x12d824=squel[_0xfffc('0x74')]();_0x12d824[_0xfffc('0x75')]('tq.TeamId')[_0xfffc('0x76')](_0xfffc('0x77'),'tq')[_0xfffc('0x78')](_0xfffc('0x79'),'ut',_0xfffc('0x7a'))[_0xfffc('0x42')](_0xfffc('0x7b'),_0x5bdf07[_0xfffc('0x4b')]['id']);for(var _0x4b48b6=0x0;_0x4b48b6<_0x31ea75[_0xfffc('0x40')];_0x4b48b6+=0x1){let _0x5da1e0=_0x31ea75[_0x4b48b6];for(var _0x32a399=0x0;_0x32a399<_0x5da1e0[_0xfffc('0x6b')][_0xfffc('0x40')];_0x32a399+=0x1){let _0x58ff7d=_0x5da1e0['Agents'][_0x32a399];var _0x3d3b14=_0x12d824[_0xfffc('0x7c')]();_0x3d3b14['where'](_0xfffc('0x7d'),_0x58ff7d['id']);_0x2a728e[_0xfffc('0x7e')](db['sequelize']['query'](_0x3d3b14[_0xfffc('0x7f')](),{'type':db[_0xfffc('0x80')][_0xfffc('0x81')][_0xfffc('0x82')]})[_0xfffc('0x2c')](function(_0xa0697c){if(_0xa0697c[_0xfffc('0x40')]===0x1){return _0x58ff7d['id'];}else{var _0x123cf1=_[_0xfffc('0x83')](_[_0xfffc('0x45')](_0xa0697c,_0xfffc('0x84')),function(_0x3d4a6b){return _[_0xfffc('0x85')](_0x1da424,_0x3d4a6b);});if(_0x123cf1){return _0x58ff7d['id'];}}}));}}return BPromise[_0xfffc('0x86')](_0x2a728e)[_0xfffc('0x2c')](function(_0x2894ee){_0x41af32=_(_0x41af32)[_0xfffc('0x87')](_0x2894ee)[_0xfffc('0x88')]()[_0xfffc('0x89')]();return db[_0xfffc('0x35')][_0xfffc('0x4d')]({'where':{'id':_0x5bdf07[_0xfffc('0x4b')]['id']}})[_0xfffc('0x2c')](function(_0x1999ce){return db[_0xfffc('0x80')][_0xfffc('0x8a')](function(_0x3ed11f){return _0x1999ce['removeTeams'](_0x5bdf07[_0xfffc('0x3a')][_0xfffc('0x68')],{'transaction':_0x3ed11f})['then'](function(){if(!_['isEmpty'](_0x41af32)){return _0x1999ce[_0xfffc('0x8b')](_0x41af32,{'transaction':_0x3ed11f});}})[_0xfffc('0x2c')](function(){_0x41af32['forEach'](function(_0xe8a2c5){socket[_0xfffc('0x71')](_0xfffc('0x8c'),{'UserId':_0xe8a2c5,'SmsQueueId':_0x1999ce['id']});});});});});});})[_0xfffc('0x2c')](respondWithStatusCode(_0xf0752c,null))[_0xfffc('0x49')](handleError(_0xf0752c,null));};exports[_0xfffc('0x8d')]=function(_0x46c398,_0xaeccdc,_0x1345dc){return db[_0xfffc('0x35')][_0xfffc('0x4d')]({'where':{'id':_0x46c398['params']['id']}})[_0xfffc('0x2c')](handleEntityNotFound(_0xaeccdc,null))[_0xfffc('0x2c')](function(_0x2d451c){if(_0x2d451c){return _0x2d451c[_0xfffc('0x8d')](_0x46c398[_0xfffc('0x55')]['ids'],_[_0xfffc('0x8e')](_0x46c398['body'],[_0xfffc('0x68'),'id'])||{})['spread'](function(_0x583082){for(var _0x2ffe65=0x0;_0x2ffe65<_0x46c398['body'][_0xfffc('0x68')][_0xfffc('0x40')];_0x2ffe65+=0x1){socket['emit'](_0xfffc('0x72'),{'UserId':Number(_0x46c398[_0xfffc('0x55')][_0xfffc('0x68')][_0x2ffe65]),'SmsQueueId':Number(_0x46c398[_0xfffc('0x4b')]['id'])});}return _0x583082;});}})[_0xfffc('0x2c')](respondWithResult(_0xaeccdc,null))[_0xfffc('0x49')](handleError(_0xaeccdc,null));};exports[_0xfffc('0x8b')]=function(_0x3d0244,_0x48e118,_0x26d99f){return db[_0xfffc('0x35')][_0xfffc('0x4d')]({'where':{'id':_0x3d0244[_0xfffc('0x4b')]['id']}})['then'](handleEntityNotFound(_0x48e118,null))[_0xfffc('0x2c')](function(_0x5b4dd8){if(_0x5b4dd8){return _0x5b4dd8[_0xfffc('0x8b')](_0x3d0244['query'][_0xfffc('0x68')])['then'](function(){if(_[_0xfffc('0x8f')](_0x3d0244[_0xfffc('0x3a')][_0xfffc('0x68')])){for(var _0x3a7d4b=0x0;_0x3a7d4b<_0x3d0244['query'][_0xfffc('0x68')][_0xfffc('0x40')];_0x3a7d4b+=0x1){socket[_0xfffc('0x71')](_0xfffc('0x8c'),{'UserId':Number(_0x3d0244[_0xfffc('0x3a')][_0xfffc('0x68')][_0x3a7d4b]),'SmsQueueId':Number(_0x3d0244[_0xfffc('0x4b')]['id'])});}}else{socket[_0xfffc('0x71')](_0xfffc('0x8c'),{'UserId':Number(_0x3d0244[_0xfffc('0x3a')][_0xfffc('0x68')]),'SmsQueueId':Number(_0x3d0244[_0xfffc('0x4b')]['id'])});}});}})[_0xfffc('0x2c')](respondWithStatusCode(_0x48e118,null))['catch'](handleError(_0x48e118,null));};exports[_0xfffc('0x90')]=function(_0x2c6ba0,_0x42aa53,_0x394caf){var _0x54dbfa={};var _0xef6a53={};var _0x2f564b;var _0x1b0d9b;return db[_0xfffc('0x35')][_0xfffc('0x91')]({'where':{'id':_0x2c6ba0['params']['id']}})[_0xfffc('0x2c')](handleEntityNotFound(_0x42aa53,null))[_0xfffc('0x2c')](function(_0x237f52){if(_0x237f52){_0x2f564b=_0x237f52;_0xef6a53[_0xfffc('0x39')]=_[_0xfffc('0x3b')](db[_0xfffc('0x6a')][_0xfffc('0x36')]);_0xef6a53[_0xfffc('0x3a')]=_[_0xfffc('0x3b')](_0x2c6ba0['query']);_0xef6a53[_0xfffc('0x3c')]=_[_0xfffc('0x3d')](_0xef6a53['model'],_0xef6a53[_0xfffc('0x3a')]);_0x54dbfa[_0xfffc('0x3e')]=_[_0xfffc('0x3d')](_0xef6a53[_0xfffc('0x39')],qs[_0xfffc('0x3f')](_0x2c6ba0['query'][_0xfffc('0x3f')]));_0x54dbfa[_0xfffc('0x3e')]=_0x54dbfa['attributes'][_0xfffc('0x40')]?_0x54dbfa[_0xfffc('0x3e')]:_0xef6a53['model'];_0x54dbfa[_0xfffc('0x41')]=qs[_0xfffc('0x5a')](_0x2c6ba0['query']['sort']);_0x54dbfa[_0xfffc('0x42')]=qs['filters'](_[_0xfffc('0x66')](_0x2c6ba0[_0xfffc('0x3a')],_0xef6a53[_0xfffc('0x3c')]));if(_0x2c6ba0[_0xfffc('0x3a')]['filter']){_0x54dbfa[_0xfffc('0x42')]=_['merge'](_0x54dbfa[_0xfffc('0x42')],{'$or':_[_0xfffc('0x45')](_0x54dbfa[_0xfffc('0x3e')],function(_0x1db447){var _0x463bce={};_0x463bce[_0x1db447]={'$like':'%'+_0x2c6ba0[_0xfffc('0x3a')][_0xfffc('0x43')]+'%'};return _0x463bce;})});}_0x54dbfa=_[_0xfffc('0x44')]({},_0x54dbfa,_0x2c6ba0[_0xfffc('0x4c')]);return _0x2f564b['getAgents'](_0x54dbfa);}})[_0xfffc('0x2c')](function(_0x146692){if(_0x146692){_0x1b0d9b=_0x146692['length'];if(!_0x2c6ba0[_0xfffc('0x3a')]['hasOwnProperty']('nolimit')){_0x54dbfa[_0xfffc('0x26')]=qs[_0xfffc('0x26')](_0x2c6ba0['query']['limit']);_0x54dbfa[_0xfffc('0x24')]=qs[_0xfffc('0x24')](_0x2c6ba0[_0xfffc('0x3a')][_0xfffc('0x24')]);}return _0x2f564b['getAgents'](_0x54dbfa);}})[_0xfffc('0x2c')](function(_0x312537){if(_0x312537){return _0x312537?{'count':_0x1b0d9b,'rows':_0x312537}:null;}})[_0xfffc('0x2c')](respondWithResult(_0x42aa53,null))[_0xfffc('0x49')](handleError(_0x42aa53,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 36f1145..7f490bf 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 _0xd34a=['hasOwnProperty','hook','events','../../mysqldb','SmsQueue','setMaxListeners','remove','emit'];(function(_0x5ce31b,_0x16c7bc){var _0x52c358=function(_0x5d8d64){while(--_0x5d8d64){_0x5ce31b['push'](_0x5ce31b['shift']());}};_0x52c358(++_0x16c7bc);}(_0xd34a,0x1e2));var _0xad34=function(_0x520526,_0x28ac16){_0x520526=_0x520526-0x0;var _0xef6f5b=_0xd34a[_0x520526];return _0xef6f5b;};'use strict';var EventEmitter=require(_0xad34('0x0'));var SmsQueue=require(_0xad34('0x1'))['db'][_0xad34('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xad34('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xad34('0x4')};function emitEvent(_0x7ae20e){return function(_0x36f5f0,_0x3cea37,_0x558edb){SmsQueueEvents[_0xad34('0x5')](_0x7ae20e+':'+_0x36f5f0['id'],_0x36f5f0);SmsQueueEvents['emit'](_0x7ae20e,_0x36f5f0);_0x558edb(null);};}for(var e in events){if(events[_0xad34('0x6')](e)){var event=events[e];SmsQueue[_0xad34('0x7')](e,emitEvent(event));}}module['exports']=SmsQueueEvents; \ No newline at end of file +var _0xf148=['exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x5f4f52,_0xbc3a5a){var _0xe2338a=function(_0x4bef0f){while(--_0x4bef0f){_0x5f4f52['push'](_0x5f4f52['shift']());}};_0xe2338a(++_0xbc3a5a);}(_0xf148,0x184));var _0x8f14=function(_0x52b725,_0x40ce43){_0x52b725=_0x52b725-0x0;var _0x58e629=_0xf148[_0x52b725];return _0x58e629;};'use strict';var EventEmitter=require(_0x8f14('0x0'));var SmsQueue=require(_0x8f14('0x1'))['db'][_0x8f14('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x8f14('0x3')](0x0);var events={'afterCreate':_0x8f14('0x4'),'afterUpdate':'update','afterDestroy':_0x8f14('0x5')};function emitEvent(_0x370ccd){return function(_0xbc711f,_0x1bed81,_0x458f2a){SmsQueueEvents[_0x8f14('0x6')](_0x370ccd+':'+_0xbc711f['id'],_0xbc711f);SmsQueueEvents[_0x8f14('0x6')](_0x370ccd,_0xbc711f);_0x458f2a(null);};}for(var e in events){if(events[_0x8f14('0x7')](e)){var event=events[e];SmsQueue['hook'](e,emitEvent(event));}}module[_0x8f14('0x8')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 8abb7e5..c4eee39 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 _0x1416=['path','../../config/environment','./smsQueue.attributes','define','SmsQueue','sms_queues','lodash','util','../../config/logger','api','bluebird'];(function(_0x33efcc,_0x2ebf86){var _0x2e9f19=function(_0x44d9e4){while(--_0x44d9e4){_0x33efcc['push'](_0x33efcc['shift']());}};_0x2e9f19(++_0x2ebf86);}(_0x1416,0x145));var _0x6141=function(_0x383a0f,_0x106940){_0x383a0f=_0x383a0f-0x0;var _0x4c9faf=_0x1416[_0x383a0f];return _0x4c9faf;};'use strict';var _=require(_0x6141('0x0'));var util=require(_0x6141('0x1'));var logger=require(_0x6141('0x2'))(_0x6141('0x3'));var moment=require('moment');var BPromise=require(_0x6141('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x6141('0x5'));var rimraf=require('rimraf');var config=require(_0x6141('0x6'));var attributes=require(_0x6141('0x7'));module['exports']=function(_0x10e73f,_0x30220b){return _0x10e73f[_0x6141('0x8')](_0x6141('0x9'),attributes,{'tableName':_0x6141('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x010d=['path','../../config/environment','./smsQueue.attributes','exports','SmsQueue','lodash','util','../../config/logger','api','bluebird','request-promise'];(function(_0x4796eb,_0x2f8389){var _0x1fb1a4=function(_0x1c4717){while(--_0x1c4717){_0x4796eb['push'](_0x4796eb['shift']());}};_0x1fb1a4(++_0x2f8389);}(_0x010d,0x1b2));var _0xd010=function(_0x8e49d5,_0x3446f3){_0x8e49d5=_0x8e49d5-0x0;var _0x536453=_0x010d[_0x8e49d5];return _0x536453;};'use strict';var _=require(_0xd010('0x0'));var util=require(_0xd010('0x1'));var logger=require(_0xd010('0x2'))(_0xd010('0x3'));var moment=require('moment');var BPromise=require(_0xd010('0x4'));var rp=require(_0xd010('0x5'));var fs=require('fs');var path=require(_0xd010('0x6'));var rimraf=require('rimraf');var config=require(_0xd010('0x7'));var attributes=require(_0xd010('0x8'));module[_0xd010('0x9')]=function(_0x472626,_0x5b8c34){return _0x472626['define'](_0xd010('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 2683253..00f40f3 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 _0x18a1=['where','attributes','limit','map','include','model','then','debug','stringify','ShowSmsQueue','find','lodash','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','SmsQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetSmsQueue','SmsQueue','options','raw'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x18a1,0x1c7));var _0x118a=function(_0x534dd3,_0x2c4bc6){_0x534dd3=_0x534dd3-0x0;var _0x5e7444=_0x18a1[_0x534dd3];return _0x5e7444;};'use strict';var _=require(_0x118a('0x0'));var util=require('util');var moment=require(_0x118a('0x1'));var BPromise=require('bluebird');var rs=require(_0x118a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x118a('0x3'));var logger=require('../../config/logger')(_0x118a('0x4'));var config=require(_0x118a('0x5'));var jayson=require(_0x118a('0x6'));var client=jayson[_0x118a('0x7')][_0x118a('0x8')]({'port':0x232a});config[_0x118a('0x9')]=_[_0x118a('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x118a('0x9')]));require('./smsQueue.socket')[_0x118a('0xb')](socket);function respondWithRpcPromise(_0x545189,_0x27e5e2,_0x2a96b5){return new BPromise(function(_0x4cfa74,_0x288adc){return client[_0x118a('0xc')](_0x545189,_0x2a96b5)['then'](function(_0x2e1b66){logger[_0x118a('0xd')](_0x118a('0xe'),_0x27e5e2,_0x118a('0xf'));logger['debug'](_0x118a('0x10'),_0x27e5e2,_0x118a('0xf'),JSON['stringify'](_0x2e1b66));if(_0x2e1b66[_0x118a('0x11')]){if(_0x2e1b66[_0x118a('0x11')][_0x118a('0x12')]===0x1f4){logger[_0x118a('0x11')](_0x118a('0xe'),_0x27e5e2,_0x2e1b66[_0x118a('0x11')][_0x118a('0x13')]);return _0x288adc(_0x2e1b66['error'][_0x118a('0x13')]);}logger[_0x118a('0x11')](_0x118a('0xe'),_0x27e5e2,_0x2e1b66[_0x118a('0x11')]['message']);return _0x4cfa74(_0x2e1b66[_0x118a('0x11')]['message']);}else{logger[_0x118a('0xd')](_0x118a('0xe'),_0x27e5e2,_0x118a('0xf'));_0x4cfa74(_0x2e1b66[_0x118a('0x14')]['message']);}})[_0x118a('0x15')](function(_0x3de478){logger[_0x118a('0x11')](_0x118a('0xe'),_0x27e5e2,_0x3de478);_0x288adc(_0x3de478);});});}exports[_0x118a('0x16')]=function(_0x34a817){var _0x687786=this;return new Promise(function(_0x305741,_0xa94a6b){return db[_0x118a('0x17')]['findAll']({'raw':_0x34a817[_0x118a('0x18')]?_0x34a817[_0x118a('0x18')][_0x118a('0x19')]===undefined?!![]:![]:!![],'where':_0x34a817['options']?_0x34a817[_0x118a('0x18')][_0x118a('0x1a')]||null:null,'attributes':_0x34a817['options']?_0x34a817[_0x118a('0x18')][_0x118a('0x1b')]||null:null,'limit':_0x34a817['options']?_0x34a817[_0x118a('0x18')][_0x118a('0x1c')]||null:null,'include':_0x34a817[_0x118a('0x18')]?_0x34a817[_0x118a('0x18')]['include']?_[_0x118a('0x1d')](_0x34a817['options'][_0x118a('0x1e')],function(_0x150533){return{'model':db[_0x150533[_0x118a('0x1f')]],'as':_0x150533['as'],'attributes':_0x150533[_0x118a('0x1b')],'include':_0x150533['include']?_[_0x118a('0x1d')](_0x150533[_0x118a('0x1e')],function(_0x17600d){return{'model':db[_0x17600d[_0x118a('0x1f')]],'as':_0x17600d['as'],'attributes':_0x17600d['attributes'],'include':_0x17600d['include']?_[_0x118a('0x1d')](_0x17600d[_0x118a('0x1e')],function(_0x352ec9){return{'model':db[_0x352ec9[_0x118a('0x1f')]],'as':_0x352ec9['as'],'attributes':_0x352ec9[_0x118a('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x118a('0x20')](function(_0x305023){logger[_0x118a('0xd')](_0x118a('0x16'),_0x34a817);logger[_0x118a('0x21')](_0x118a('0x16'),_0x34a817,JSON[_0x118a('0x22')](_0x305023));_0x305741(_0x305023);})[_0x118a('0x15')](function(_0x4bf2f3){logger[_0x118a('0x11')]('GetSmsQueue',_0x4bf2f3['message'],_0x34a817);_0xa94a6b(_0x687786[_0x118a('0x11')](0x1f4,_0x4bf2f3[_0x118a('0x13')]));});});};exports[_0x118a('0x23')]=function(_0x57fcca){var _0x3bc4b9=this;return new Promise(function(_0x362d48,_0x55c1ec){return db[_0x118a('0x17')][_0x118a('0x24')]({'raw':_0x57fcca[_0x118a('0x18')]?_0x57fcca[_0x118a('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x57fcca[_0x118a('0x18')]?_0x57fcca['options']['where']||null:null,'attributes':_0x57fcca[_0x118a('0x18')]?_0x57fcca[_0x118a('0x18')][_0x118a('0x1b')]||null:null,'include':_0x57fcca[_0x118a('0x18')]?_0x57fcca[_0x118a('0x18')][_0x118a('0x1e')]?_['map'](_0x57fcca[_0x118a('0x18')][_0x118a('0x1e')],function(_0x19a6e8){return{'model':db[_0x19a6e8['model']],'as':_0x19a6e8['as'],'attributes':_0x19a6e8[_0x118a('0x1b')],'include':_0x19a6e8[_0x118a('0x1e')]?_[_0x118a('0x1d')](_0x19a6e8[_0x118a('0x1e')],function(_0x8fd390){return{'model':db[_0x8fd390['model']],'as':_0x8fd390['as'],'attributes':_0x8fd390[_0x118a('0x1b')],'include':_0x8fd390[_0x118a('0x1e')]?_[_0x118a('0x1d')](_0x8fd390['include'],function(_0x2be42a){return{'model':db[_0x2be42a[_0x118a('0x1f')]],'as':_0x2be42a['as'],'attributes':_0x2be42a[_0x118a('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x430608){logger[_0x118a('0xd')](_0x118a('0x23'),_0x57fcca);logger[_0x118a('0x21')](_0x118a('0x23'),_0x57fcca,JSON[_0x118a('0x22')](_0x430608));_0x362d48(_0x430608);})[_0x118a('0x15')](function(_0x1bf282){logger[_0x118a('0x11')](_0x118a('0x23'),_0x1bf282['message'],_0x57fcca);_0x55c1ec(_0x3bc4b9['error'](0x1f4,_0x1bf282[_0x118a('0x13')]));});});}; \ No newline at end of file +var _0xfb44=['request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','findAll','options','raw','attributes','limit','include','map','model','GetSmsQueue','SmsQueue','find','where','ShowSmsQueue','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./smsQueue.socket','register','request','then','info','SmsQueue,\x20%s,\x20%s'];(function(_0x58ab65,_0x5e13d0){var _0x49a6a7=function(_0x4fd7bf){while(--_0x4fd7bf){_0x58ab65['push'](_0x58ab65['shift']());}};_0x49a6a7(++_0x5e13d0);}(_0xfb44,0x126));var _0x4fb4=function(_0xbd6f7f,_0x21a6f7){_0xbd6f7f=_0xbd6f7f-0x0;var _0x14d232=_0xfb44[_0xbd6f7f];return _0x14d232;};'use strict';var _=require(_0x4fb4('0x0'));var util=require(_0x4fb4('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x4fb4('0x2'));var fs=require('fs');var Redis=require(_0x4fb4('0x3'));var db=require(_0x4fb4('0x4'))['db'];var utils=require(_0x4fb4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x4fb4('0x6'));var jayson=require(_0x4fb4('0x7'));var client=jayson['client'][_0x4fb4('0x8')]({'port':0x232a});config[_0x4fb4('0x9')]=_[_0x4fb4('0xa')](config[_0x4fb4('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0x4fb4('0xb'))(new Redis(config[_0x4fb4('0x9')]));require(_0x4fb4('0xc'))[_0x4fb4('0xd')](socket);function respondWithRpcPromise(_0x148138,_0x45ecae,_0x57dd1c){return new BPromise(function(_0x345e35,_0x2d83a8){return client[_0x4fb4('0xe')](_0x148138,_0x57dd1c)[_0x4fb4('0xf')](function(_0xb27a95){logger[_0x4fb4('0x10')](_0x4fb4('0x11'),_0x45ecae,_0x4fb4('0x12'));logger[_0x4fb4('0x13')](_0x4fb4('0x14'),_0x45ecae,'request\x20sent',JSON[_0x4fb4('0x15')](_0xb27a95));if(_0xb27a95[_0x4fb4('0x16')]){if(_0xb27a95['error'][_0x4fb4('0x17')]===0x1f4){logger['error'](_0x4fb4('0x11'),_0x45ecae,_0xb27a95['error'][_0x4fb4('0x18')]);return _0x2d83a8(_0xb27a95['error'][_0x4fb4('0x18')]);}logger['error'](_0x4fb4('0x11'),_0x45ecae,_0xb27a95['error'][_0x4fb4('0x18')]);return _0x345e35(_0xb27a95['error'][_0x4fb4('0x18')]);}else{logger[_0x4fb4('0x10')](_0x4fb4('0x11'),_0x45ecae,_0x4fb4('0x12'));_0x345e35(_0xb27a95['result'][_0x4fb4('0x18')]);}})[_0x4fb4('0x19')](function(_0x401aee){logger[_0x4fb4('0x16')](_0x4fb4('0x11'),_0x45ecae,_0x401aee);_0x2d83a8(_0x401aee);});});}exports['GetSmsQueue']=function(_0x3801f4){var _0xdd7d41=this;return new Promise(function(_0x2cc8b3,_0x406bbd){return db['SmsQueue'][_0x4fb4('0x1a')]({'raw':_0x3801f4[_0x4fb4('0x1b')]?_0x3801f4[_0x4fb4('0x1b')][_0x4fb4('0x1c')]===undefined?!![]:![]:!![],'where':_0x3801f4['options']?_0x3801f4[_0x4fb4('0x1b')]['where']||null:null,'attributes':_0x3801f4[_0x4fb4('0x1b')]?_0x3801f4[_0x4fb4('0x1b')][_0x4fb4('0x1d')]||null:null,'limit':_0x3801f4['options']?_0x3801f4[_0x4fb4('0x1b')][_0x4fb4('0x1e')]||null:null,'include':_0x3801f4[_0x4fb4('0x1b')]?_0x3801f4[_0x4fb4('0x1b')][_0x4fb4('0x1f')]?_[_0x4fb4('0x20')](_0x3801f4[_0x4fb4('0x1b')]['include'],function(_0xfc48e7){return{'model':db[_0xfc48e7[_0x4fb4('0x21')]],'as':_0xfc48e7['as'],'attributes':_0xfc48e7[_0x4fb4('0x1d')],'include':_0xfc48e7[_0x4fb4('0x1f')]?_['map'](_0xfc48e7[_0x4fb4('0x1f')],function(_0x463a1f){return{'model':db[_0x463a1f['model']],'as':_0x463a1f['as'],'attributes':_0x463a1f[_0x4fb4('0x1d')],'include':_0x463a1f['include']?_[_0x4fb4('0x20')](_0x463a1f['include'],function(_0x3cd977){return{'model':db[_0x3cd977[_0x4fb4('0x21')]],'as':_0x3cd977['as'],'attributes':_0x3cd977[_0x4fb4('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x4fb4('0xf')](function(_0x1d2dd3){logger[_0x4fb4('0x10')](_0x4fb4('0x22'),_0x3801f4);logger[_0x4fb4('0x13')]('GetSmsQueue',_0x3801f4,JSON['stringify'](_0x1d2dd3));_0x2cc8b3(_0x1d2dd3);})[_0x4fb4('0x19')](function(_0x164835){logger['error']('GetSmsQueue',_0x164835[_0x4fb4('0x18')],_0x3801f4);_0x406bbd(_0xdd7d41[_0x4fb4('0x16')](0x1f4,_0x164835[_0x4fb4('0x18')]));});});};exports['ShowSmsQueue']=function(_0x34e557){var _0x1d3861=this;return new Promise(function(_0x52ae82,_0x3bc28f){return db[_0x4fb4('0x23')][_0x4fb4('0x24')]({'raw':_0x34e557[_0x4fb4('0x1b')]?_0x34e557[_0x4fb4('0x1b')][_0x4fb4('0x1c')]===undefined?!![]:![]:!![],'where':_0x34e557['options']?_0x34e557[_0x4fb4('0x1b')][_0x4fb4('0x25')]||null:null,'attributes':_0x34e557[_0x4fb4('0x1b')]?_0x34e557[_0x4fb4('0x1b')][_0x4fb4('0x1d')]||null:null,'include':_0x34e557['options']?_0x34e557[_0x4fb4('0x1b')][_0x4fb4('0x1f')]?_[_0x4fb4('0x20')](_0x34e557['options'][_0x4fb4('0x1f')],function(_0x25ca6c){return{'model':db[_0x25ca6c[_0x4fb4('0x21')]],'as':_0x25ca6c['as'],'attributes':_0x25ca6c[_0x4fb4('0x1d')],'include':_0x25ca6c[_0x4fb4('0x1f')]?_['map'](_0x25ca6c['include'],function(_0x2f2cbc){return{'model':db[_0x2f2cbc[_0x4fb4('0x21')]],'as':_0x2f2cbc['as'],'attributes':_0x2f2cbc[_0x4fb4('0x1d')],'include':_0x2f2cbc[_0x4fb4('0x1f')]?_[_0x4fb4('0x20')](_0x2f2cbc['include'],function(_0x159c54){return{'model':db[_0x159c54[_0x4fb4('0x21')]],'as':_0x159c54['as'],'attributes':_0x159c54['attributes']};}):[]};}):[]};}):[]:[]})[_0x4fb4('0xf')](function(_0x49f09e){logger['info'](_0x4fb4('0x26'),_0x34e557);logger[_0x4fb4('0x13')](_0x4fb4('0x26'),_0x34e557,JSON[_0x4fb4('0x15')](_0x49f09e));_0x52ae82(_0x49f09e);})[_0x4fb4('0x19')](function(_0x11d470){logger['error'](_0x4fb4('0x26'),_0x11d470[_0x4fb4('0x18')],_0x34e557);_0x3bc28f(_0x1d3861['error'](0x1f4,_0x11d470['message']));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index b429ab7..dea525a 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 _0x18c0=['update','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x18c0,0xef));var _0x018c=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x18c0[_0x4565bf];return _0x5610ba;};'use strict';var SmsQueueEvents=require(_0x018c('0x0'));var events=['save','remove',_0x018c('0x1')];function createListener(_0xc5cd7d,_0x5dba34){return function(_0x2964e3){_0x5dba34['emit'](_0xc5cd7d,_0x2964e3);};}function removeListener(_0x339ba5,_0x14e79d){return function(){SmsQueueEvents[_0x018c('0x2')](_0x339ba5,_0x14e79d);};}exports[_0x018c('0x3')]=function(_0x52e648){for(var _0x10f6c5=0x0,_0x473d81=events[_0x018c('0x4')];_0x10f6c5<_0x473d81;_0x10f6c5++){var _0x246a5b=events[_0x10f6c5];var _0x3da7db=createListener(_0x018c('0x5')+_0x246a5b,_0x52e648);SmsQueueEvents['on'](_0x246a5b,_0x3da7db);}}; \ No newline at end of file +var _0x2c59=['save','remove','update','emit','removeListener','register','length','smsQueue:','./smsQueue.events'];(function(_0x2b92ec,_0x18e0e3){var _0x12be46=function(_0x18118b){while(--_0x18118b){_0x2b92ec['push'](_0x2b92ec['shift']());}};_0x12be46(++_0x18e0e3);}(_0x2c59,0x1e5));var _0x92c5=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c59[_0x3dd15e];return _0x231fd0;};'use strict';var SmsQueueEvents=require(_0x92c5('0x0'));var events=[_0x92c5('0x1'),_0x92c5('0x2'),_0x92c5('0x3')];function createListener(_0x5e0357,_0x47f0c2){return function(_0x3857cc){_0x47f0c2[_0x92c5('0x4')](_0x5e0357,_0x3857cc);};}function removeListener(_0x483706,_0x7b1fd2){return function(){SmsQueueEvents[_0x92c5('0x5')](_0x483706,_0x7b1fd2);};}exports[_0x92c5('0x6')]=function(_0x52f652){for(var _0x62a456=0x0,_0x4a5fc4=events[_0x92c5('0x7')];_0x62a456<_0x4a5fc4;_0x62a456++){var _0x2e9298=events[_0x62a456];var _0x412431=createListener(_0x92c5('0x8')+_0x2e9298,_0x52f652);SmsQueueEvents['on'](_0x2e9298,_0x412431);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index cb70464..f6bc796 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 _0xdab6=['describe','/:id','post','create','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe'];(function(_0x368e3c,_0x2c226e){var _0x1950d5=function(_0x588062){while(--_0x588062){_0x368e3c['push'](_0x368e3c['shift']());}};_0x1950d5(++_0x2c226e);}(_0xdab6,0x9a));var _0x6dab=function(_0x3cdbe7,_0x3d6df1){_0x3cdbe7=_0x3cdbe7-0x0;var _0x38886e=_0xdab6[_0x3cdbe7];return _0x38886e;};'use strict';var multer=require(_0x6dab('0x0'));var util=require(_0x6dab('0x1'));var path=require(_0x6dab('0x2'));var timeout=require(_0x6dab('0x3'));var express=require(_0x6dab('0x4'));var router=express[_0x6dab('0x5')]();var fs_extra=require(_0x6dab('0x6'));var auth=require(_0x6dab('0x7'));var interaction=require(_0x6dab('0x8'));var config=require(_0x6dab('0x9'));var controller=require('./smsQueueReport.controller');router[_0x6dab('0xa')]('/',auth[_0x6dab('0xb')](),controller[_0x6dab('0xc')]);router[_0x6dab('0xa')](_0x6dab('0xd'),auth[_0x6dab('0xb')](),controller[_0x6dab('0xe')]);router[_0x6dab('0xa')](_0x6dab('0xf'),auth[_0x6dab('0xb')](),controller['show']);router[_0x6dab('0x10')]('/',auth[_0x6dab('0xb')](),controller[_0x6dab('0x11')]);router['put'](_0x6dab('0xf'),auth['isAuthenticated'](),controller['update']);router[_0x6dab('0x12')](_0x6dab('0xf'),auth[_0x6dab('0xb')](),controller[_0x6dab('0x13')]);module[_0x6dab('0x14')]=router; \ No newline at end of file +var _0xb3e9=['create','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsQueueReport.controller','isAuthenticated','/:id','show','post'];(function(_0x396277,_0x202066){var _0x3ed311=function(_0x2f6752){while(--_0x2f6752){_0x396277['push'](_0x396277['shift']());}};_0x3ed311(++_0x202066);}(_0xb3e9,0x1eb));var _0x9b3e=function(_0x26f702,_0x3919bf){_0x26f702=_0x26f702-0x0;var _0x11417d=_0xb3e9[_0x26f702];return _0x11417d;};'use strict';var multer=require(_0x9b3e('0x0'));var util=require('util');var path=require(_0x9b3e('0x1'));var timeout=require(_0x9b3e('0x2'));var express=require(_0x9b3e('0x3'));var router=express[_0x9b3e('0x4')]();var fs_extra=require(_0x9b3e('0x5'));var auth=require(_0x9b3e('0x6'));var interaction=require(_0x9b3e('0x7'));var config=require('../../config/environment');var controller=require(_0x9b3e('0x8'));router['get']('/',auth[_0x9b3e('0x9')](),controller['index']);router['get']('/describe',auth[_0x9b3e('0x9')](),controller['describe']);router['get'](_0x9b3e('0xa'),auth[_0x9b3e('0x9')](),controller[_0x9b3e('0xb')]);router[_0x9b3e('0xc')]('/',auth[_0x9b3e('0x9')](),controller[_0x9b3e('0xd')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0x9b3e('0xe')]);router[_0x9b3e('0xf')]('/:id',auth[_0x9b3e('0x9')](),controller[_0x9b3e('0x10')]);module[_0x9b3e('0x11')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 1cf4f72..6d37d96 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 _0xe1cc=['STRING','DATE','moment','exports'];(function(_0x20b8c2,_0xee1df0){var _0x4a00a0=function(_0x255088){while(--_0x255088){_0x20b8c2['push'](_0x20b8c2['shift']());}};_0x4a00a0(++_0xee1df0);}(_0xe1cc,0xf2));var _0xce1c=function(_0x5eb807,_0x3e4726){_0x5eb807=_0x5eb807-0x0;var _0x51f8ba=_0xe1cc[_0x5eb807];return _0x51f8ba;};'use strict';var moment=require(_0xce1c('0x0'));var Sequelize=require('sequelize');module[_0xce1c('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0xce1c('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0xce1c('0x3')]},'acceptAt':{'type':Sequelize[_0xce1c('0x3')]},'exitAt':{'type':Sequelize[_0xce1c('0x3')]},'reason':{'type':Sequelize[_0xce1c('0x2')]}}; \ No newline at end of file +var _0x64c4=['STRING','DATE','sequelize'];(function(_0x9383b3,_0x184815){var _0x28358c=function(_0x2ee293){while(--_0x2ee293){_0x9383b3['push'](_0x9383b3['shift']());}};_0x28358c(++_0x184815);}(_0x64c4,0x13a));var _0x464c=function(_0x3b9af2,_0x1508c7){_0x3b9af2=_0x3b9af2-0x0;var _0x3b1999=_0x64c4[_0x3b9af2];return _0x3b1999;};'use strict';var moment=require('moment');var Sequelize=require(_0x464c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0x464c('0x1')],'allowNull':![]},'from':{'type':Sequelize[_0x464c('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x464c('0x2')]},'acceptAt':{'type':Sequelize[_0x464c('0x2')]},'exitAt':{'type':Sequelize[_0x464c('0x2')]},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index b48c22c..e3da96f 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 _0x8e88=['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','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','nolimit','offset','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','findAll','catch','show','length','include','create','body','find','describe','eml-format','rimraf','fast-json-patch'];(function(_0x55d2dd,_0x139145){var _0x4195fd=function(_0x35c599){while(--_0x35c599){_0x55d2dd['push'](_0x55d2dd['shift']());}};_0x4195fd(++_0x139145);}(_0x8e88,0x95));var _0x88e8=function(_0x34a8c8,_0x31e259){_0x34a8c8=_0x34a8c8-0x0;var _0x1fe6e5=_0x8e88[_0x34a8c8];return _0x1fe6e5;};'use strict';var emlformat=require(_0x88e8('0x0'));var rimraf=require(_0x88e8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x88e8('0x2'));var rp=require(_0x88e8('0x3'));var moment=require(_0x88e8('0x4'));var BPromise=require(_0x88e8('0x5'));var Mustache=require(_0x88e8('0x6'));var util=require(_0x88e8('0x7'));var path=require(_0x88e8('0x8'));var sox=require(_0x88e8('0x9'));var csv=require(_0x88e8('0xa'));var ejs=require(_0x88e8('0xb'));var fs=require('fs');var fs_extra=require(_0x88e8('0xc'));var _=require(_0x88e8('0xd'));var squel=require('squel');var crypto=require(_0x88e8('0xe'));var jsforce=require(_0x88e8('0xf'));var deskjs=require(_0x88e8('0x10'));var toCsv=require(_0x88e8('0xa'));var querystring=require(_0x88e8('0x11'));var Papa=require('papaparse');var Redis=require(_0x88e8('0x12'));var authService=require(_0x88e8('0x13'));var qs=require(_0x88e8('0x14'));var as=require(_0x88e8('0x15'));var hardwareService=require(_0x88e8('0x16'));var logger=require(_0x88e8('0x17'))('api');var utils=require(_0x88e8('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x88e8('0x19'));var db=require(_0x88e8('0x1a'))['db'];function respondWithStatusCode(_0x56a861,_0x1aecb6){_0x1aecb6=_0x1aecb6||0xcc;return function(_0x46cb27){if(_0x46cb27){return _0x56a861[_0x88e8('0x1b')](_0x1aecb6);}return _0x56a861[_0x88e8('0x1c')](_0x1aecb6)[_0x88e8('0x1d')]();};}function respondWithResult(_0x5d72f3,_0x106bc6){_0x106bc6=_0x106bc6||0xc8;return function(_0xc3c036){if(_0xc3c036){return _0x5d72f3['status'](_0x106bc6)[_0x88e8('0x1e')](_0xc3c036);}};}function respondWithFilteredResult(_0x3914b3,_0x4d0dfe){return function(_0xceb891){if(_0xceb891){var _0x25bd5e=typeof _0x4d0dfe['offset']===_0x88e8('0x1f')&&typeof _0x4d0dfe[_0x88e8('0x20')]===_0x88e8('0x1f');var _0x41ffcd=_0xceb891[_0x88e8('0x21')];var _0x21d17c=_0x25bd5e?0x0:_0x4d0dfe['offset'];var _0x59b938=_0x25bd5e?_0xceb891['count']:_0x4d0dfe['offset']+_0x4d0dfe[_0x88e8('0x20')];var _0x379667;if(_0x59b938>=_0x41ffcd){_0x59b938=_0x41ffcd;_0x379667=0xc8;}else{_0x379667=0xce;}_0x3914b3[_0x88e8('0x1c')](_0x379667);return _0x3914b3[_0x88e8('0x22')](_0x88e8('0x23'),_0x21d17c+'-'+_0x59b938+'/'+_0x41ffcd)[_0x88e8('0x1e')](_0xceb891);}return null;};}function patchUpdates(_0x163b14){return function(_0x29f2a8){try{jsonpatch[_0x88e8('0x24')](_0x29f2a8,_0x163b14,!![]);}catch(_0x2f18e8){return BPromise[_0x88e8('0x25')](_0x2f18e8);}return _0x29f2a8[_0x88e8('0x26')]();};}function saveUpdates(_0x4c9154,_0x2e8b4a){return function(_0x483d08){if(_0x483d08){return _0x483d08[_0x88e8('0x27')](_0x4c9154)[_0x88e8('0x28')](function(_0x6c8fce){return _0x6c8fce;});}return null;};}function removeEntity(_0x5313d7,_0x18eb7f){return function(_0x2649bd){if(_0x2649bd){return _0x2649bd['destroy']()[_0x88e8('0x28')](function(){_0x5313d7['status'](0xcc)[_0x88e8('0x1d')]();});}};}function handleEntityNotFound(_0x10d13b,_0x558258){return function(_0x482552){if(!_0x482552){_0x10d13b['sendStatus'](0x194);}return _0x482552;};}function handleError(_0x3d6e3c,_0x54f3a2){_0x54f3a2=_0x54f3a2||0x1f4;return function(_0x38c7e6){logger['error'](_0x38c7e6[_0x88e8('0x29')]);if(_0x38c7e6['name']){delete _0x38c7e6[_0x88e8('0x2a')];}_0x3d6e3c['status'](_0x54f3a2)[_0x88e8('0x2b')](_0x38c7e6);};}exports[_0x88e8('0x2c')]=function(_0xa0080d,_0x465bb2){var _0x4b13e7={},_0x5a0f0a={},_0x4b7ee8={'count':0x0,'rows':[]};var _0x41686a=_[_0x88e8('0x2d')](db[_0x88e8('0x2e')][_0x88e8('0x2f')],function(_0x160e8f){return{'name':_0x160e8f[_0x88e8('0x30')],'type':_0x160e8f['type']['key']};});_0x5a0f0a[_0x88e8('0x31')]=_[_0x88e8('0x2d')](_0x41686a,_0x88e8('0x2a'));_0x5a0f0a[_0x88e8('0x32')]=_[_0x88e8('0x33')](_0xa0080d['query']);_0x5a0f0a[_0x88e8('0x34')]=_[_0x88e8('0x35')](_0x5a0f0a[_0x88e8('0x31')],_0x5a0f0a[_0x88e8('0x32')]);_0x4b13e7[_0x88e8('0x36')]=_[_0x88e8('0x35')](_0x5a0f0a[_0x88e8('0x31')],qs[_0x88e8('0x37')](_0xa0080d[_0x88e8('0x32')]['fields']));_0x4b13e7[_0x88e8('0x36')]=_0x4b13e7[_0x88e8('0x36')]['length']?_0x4b13e7['attributes']:_0x5a0f0a[_0x88e8('0x31')];if(!_0xa0080d[_0x88e8('0x32')]['hasOwnProperty'](_0x88e8('0x38'))){_0x4b13e7['limit']=qs[_0x88e8('0x20')](_0xa0080d[_0x88e8('0x32')][_0x88e8('0x20')]);_0x4b13e7[_0x88e8('0x39')]=qs[_0x88e8('0x39')](_0xa0080d[_0x88e8('0x32')]['offset']);}_0x4b13e7['order']=qs[_0x88e8('0x3a')](_0xa0080d[_0x88e8('0x32')][_0x88e8('0x3a')]);_0x4b13e7[_0x88e8('0x3b')]=qs[_0x88e8('0x34')](_[_0x88e8('0x3c')](_0xa0080d[_0x88e8('0x32')],_0x5a0f0a[_0x88e8('0x34')]),_0x41686a);if(_0xa0080d[_0x88e8('0x32')]['filter']){_0x4b13e7[_0x88e8('0x3b')]=_['merge'](_0x4b13e7['where'],{'$or':_['map'](_0x41686a,function(_0x45e9e8){if(_0x45e9e8[_0x88e8('0x3d')]!==_0x88e8('0x3e')){var _0x4c08dd={};_0x4c08dd[_0x45e9e8[_0x88e8('0x2a')]]={'$like':'%'+_0xa0080d[_0x88e8('0x32')][_0x88e8('0x3f')]+'%'};return _0x4c08dd;}})});}_0x4b13e7=_[_0x88e8('0x40')]({},_0x4b13e7,_0xa0080d[_0x88e8('0x41')]);var _0x36d38c={'where':_0x4b13e7['where']};return db['SmsQueueReport'][_0x88e8('0x21')](_0x36d38c)[_0x88e8('0x28')](function(_0x16e0e3){_0x4b7ee8[_0x88e8('0x21')]=_0x16e0e3;if(_0xa0080d[_0x88e8('0x32')][_0x88e8('0x42')]){_0x4b13e7['include']=[{'all':!![]}];}return db[_0x88e8('0x2e')][_0x88e8('0x43')](_0x4b13e7);})[_0x88e8('0x28')](function(_0x566b4e){_0x4b7ee8['rows']=_0x566b4e;return _0x4b7ee8;})[_0x88e8('0x28')](respondWithFilteredResult(_0x465bb2,_0x4b13e7))[_0x88e8('0x44')](handleError(_0x465bb2,null));};exports[_0x88e8('0x45')]=function(_0x1e7921,_0x3e4f4b){var _0x2688d6={'raw':!![],'where':{'id':_0x1e7921['params']['id']}},_0x41eb92={};_0x41eb92[_0x88e8('0x31')]=_[_0x88e8('0x33')](db[_0x88e8('0x2e')][_0x88e8('0x2f')]);_0x41eb92[_0x88e8('0x32')]=_[_0x88e8('0x33')](_0x1e7921[_0x88e8('0x32')]);_0x41eb92[_0x88e8('0x34')]=_[_0x88e8('0x35')](_0x41eb92[_0x88e8('0x31')],_0x41eb92[_0x88e8('0x32')]);_0x2688d6[_0x88e8('0x36')]=_[_0x88e8('0x35')](_0x41eb92[_0x88e8('0x31')],qs['fields'](_0x1e7921['query'][_0x88e8('0x37')]));_0x2688d6['attributes']=_0x2688d6['attributes'][_0x88e8('0x46')]?_0x2688d6[_0x88e8('0x36')]:_0x41eb92['model'];if(_0x1e7921[_0x88e8('0x32')][_0x88e8('0x42')]){_0x2688d6[_0x88e8('0x47')]=[{'all':!![]}];}_0x2688d6=_[_0x88e8('0x40')]({},_0x2688d6,_0x1e7921[_0x88e8('0x41')]);return db[_0x88e8('0x2e')]['find'](_0x2688d6)[_0x88e8('0x28')](handleEntityNotFound(_0x3e4f4b,null))[_0x88e8('0x28')](respondWithResult(_0x3e4f4b,null))[_0x88e8('0x44')](handleError(_0x3e4f4b,null));};exports['create']=function(_0x17d8b8,_0x5e5712){return db[_0x88e8('0x2e')][_0x88e8('0x48')](_0x17d8b8[_0x88e8('0x49')],{})[_0x88e8('0x28')](respondWithResult(_0x5e5712,0xc9))['catch'](handleError(_0x5e5712,null));};exports['update']=function(_0x5016bd,_0x516ef5){if(_0x5016bd['body']['id']){delete _0x5016bd[_0x88e8('0x49')]['id'];}return db[_0x88e8('0x2e')][_0x88e8('0x4a')]({'where':{'id':_0x5016bd['params']['id']}})[_0x88e8('0x28')](handleEntityNotFound(_0x516ef5,null))[_0x88e8('0x28')](saveUpdates(_0x5016bd[_0x88e8('0x49')],null))['then'](respondWithResult(_0x516ef5,null))[_0x88e8('0x44')](handleError(_0x516ef5,null));};exports['destroy']=function(_0x2b4bb2,_0x5c6076){return db[_0x88e8('0x2e')][_0x88e8('0x4a')]({'where':{'id':_0x2b4bb2['params']['id']}})['then'](handleEntityNotFound(_0x5c6076,null))[_0x88e8('0x28')](removeEntity(_0x5c6076,null))[_0x88e8('0x44')](handleError(_0x5c6076,null));};exports[_0x88e8('0x4b')]=function(_0xf3fe8f,_0x524bfa){return db['SmsQueueReport'][_0x88e8('0x4b')]()[_0x88e8('0x28')](respondWithResult(_0x524bfa,null))['catch'](handleError(_0x524bfa,null));}; \ No newline at end of file +var _0x21e5=['../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','sendStatus','send','index','SmsQueueReport','type','key','model','filters','intersection','query','attributes','fields','length','order','sort','where','pick','filter','merge','map','VIRTUAL','includeAll','findAll','catch','show','keys','include','find','create','update','body','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','path','sox','ejs','fs-extra','squel','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x2ba9ac,_0xa1fdc4){var _0x1b0fc9=function(_0x4343de){while(--_0x4343de){_0x2ba9ac['push'](_0x2ba9ac['shift']());}};_0x1b0fc9(++_0xa1fdc4);}(_0x21e5,0x186));var _0x521e=function(_0x1e2321,_0x3ae1c5){_0x1e2321=_0x1e2321-0x0;var _0x1d346d=_0x21e5[_0x1e2321];return _0x1d346d;};'use strict';var emlformat=require(_0x521e('0x0'));var rimraf=require(_0x521e('0x1'));var zipdir=require(_0x521e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x521e('0x3'));var moment=require(_0x521e('0x4'));var BPromise=require(_0x521e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x521e('0x6'));var sox=require(_0x521e('0x7'));var csv=require('to-csv');var ejs=require(_0x521e('0x8'));var fs=require('fs');var fs_extra=require(_0x521e('0x9'));var _=require('lodash');var squel=require(_0x521e('0xa'));var crypto=require('crypto');var jsforce=require(_0x521e('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x521e('0xc'));var querystring=require('querystring');var Papa=require(_0x521e('0xd'));var Redis=require(_0x521e('0xe'));var authService=require(_0x521e('0xf'));var qs=require(_0x521e('0x10'));var as=require(_0x521e('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x521e('0x12'))(_0x521e('0x13'));var utils=require('../../config/utils');var config=require(_0x521e('0x14'));var licenseUtil=require(_0x521e('0x15'));var db=require(_0x521e('0x16'))['db'];function respondWithStatusCode(_0x54e2df,_0x4ffade){_0x4ffade=_0x4ffade||0xcc;return function(_0x5f2111){if(_0x5f2111){return _0x54e2df['sendStatus'](_0x4ffade);}return _0x54e2df[_0x521e('0x17')](_0x4ffade)[_0x521e('0x18')]();};}function respondWithResult(_0x49240d,_0x3b9769){_0x3b9769=_0x3b9769||0xc8;return function(_0x4d9eee){if(_0x4d9eee){return _0x49240d[_0x521e('0x17')](_0x3b9769)[_0x521e('0x19')](_0x4d9eee);}};}function respondWithFilteredResult(_0x246cfe,_0x4470a4){return function(_0x312a4e){if(_0x312a4e){var _0x4260c9=typeof _0x4470a4[_0x521e('0x1a')]===_0x521e('0x1b')&&typeof _0x4470a4[_0x521e('0x1c')]===_0x521e('0x1b');var _0x301355=_0x312a4e[_0x521e('0x1d')];var _0x2ada69=_0x4260c9?0x0:_0x4470a4['offset'];var _0x15942e=_0x4260c9?_0x312a4e['count']:_0x4470a4['offset']+_0x4470a4[_0x521e('0x1c')];var _0x4de84b;if(_0x15942e>=_0x301355){_0x15942e=_0x301355;_0x4de84b=0xc8;}else{_0x4de84b=0xce;}_0x246cfe[_0x521e('0x17')](_0x4de84b);return _0x246cfe[_0x521e('0x1e')](_0x521e('0x1f'),_0x2ada69+'-'+_0x15942e+'/'+_0x301355)[_0x521e('0x19')](_0x312a4e);}return null;};}function patchUpdates(_0x30e60b){return function(_0xef2eb6){try{jsonpatch['apply'](_0xef2eb6,_0x30e60b,!![]);}catch(_0x2d3884){return BPromise[_0x521e('0x20')](_0x2d3884);}return _0xef2eb6[_0x521e('0x21')]();};}function saveUpdates(_0x25e7ec,_0x35b435){return function(_0x6c9fcb){if(_0x6c9fcb){return _0x6c9fcb['update'](_0x25e7ec)['then'](function(_0x217bb2){return _0x217bb2;});}return null;};}function removeEntity(_0x5a6605,_0x49615e){return function(_0x332d95){if(_0x332d95){return _0x332d95['destroy']()[_0x521e('0x22')](function(){_0x5a6605[_0x521e('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3ce1b2,_0x320fb2){return function(_0x2cbbd7){if(!_0x2cbbd7){_0x3ce1b2[_0x521e('0x23')](0x194);}return _0x2cbbd7;};}function handleError(_0x51a167,_0x5c92d1){_0x5c92d1=_0x5c92d1||0x1f4;return function(_0x1b0cfc){logger['error'](_0x1b0cfc['stack']);if(_0x1b0cfc['name']){delete _0x1b0cfc['name'];}_0x51a167[_0x521e('0x17')](_0x5c92d1)[_0x521e('0x24')](_0x1b0cfc);};}exports[_0x521e('0x25')]=function(_0x2d75eb,_0x81761e){var _0x5d8523={},_0x3933a5={},_0x1582d8={'count':0x0,'rows':[]};var _0x2bfcda=_['map'](db[_0x521e('0x26')]['rawAttributes'],function(_0x375db8){return{'name':_0x375db8['fieldName'],'type':_0x375db8[_0x521e('0x27')][_0x521e('0x28')]};});_0x3933a5[_0x521e('0x29')]=_['map'](_0x2bfcda,'name');_0x3933a5['query']=_['keys'](_0x2d75eb['query']);_0x3933a5[_0x521e('0x2a')]=_[_0x521e('0x2b')](_0x3933a5['model'],_0x3933a5[_0x521e('0x2c')]);_0x5d8523[_0x521e('0x2d')]=_[_0x521e('0x2b')](_0x3933a5[_0x521e('0x29')],qs[_0x521e('0x2e')](_0x2d75eb[_0x521e('0x2c')][_0x521e('0x2e')]));_0x5d8523[_0x521e('0x2d')]=_0x5d8523[_0x521e('0x2d')][_0x521e('0x2f')]?_0x5d8523['attributes']:_0x3933a5[_0x521e('0x29')];if(!_0x2d75eb[_0x521e('0x2c')]['hasOwnProperty']('nolimit')){_0x5d8523['limit']=qs[_0x521e('0x1c')](_0x2d75eb['query'][_0x521e('0x1c')]);_0x5d8523[_0x521e('0x1a')]=qs[_0x521e('0x1a')](_0x2d75eb[_0x521e('0x2c')][_0x521e('0x1a')]);}_0x5d8523[_0x521e('0x30')]=qs[_0x521e('0x31')](_0x2d75eb['query'][_0x521e('0x31')]);_0x5d8523[_0x521e('0x32')]=qs[_0x521e('0x2a')](_[_0x521e('0x33')](_0x2d75eb['query'],_0x3933a5['filters']),_0x2bfcda);if(_0x2d75eb[_0x521e('0x2c')][_0x521e('0x34')]){_0x5d8523[_0x521e('0x32')]=_[_0x521e('0x35')](_0x5d8523[_0x521e('0x32')],{'$or':_[_0x521e('0x36')](_0x2bfcda,function(_0x28a05a){if(_0x28a05a[_0x521e('0x27')]!==_0x521e('0x37')){var _0xc4c595={};_0xc4c595[_0x28a05a['name']]={'$like':'%'+_0x2d75eb[_0x521e('0x2c')]['filter']+'%'};return _0xc4c595;}})});}_0x5d8523=_[_0x521e('0x35')]({},_0x5d8523,_0x2d75eb['options']);var _0xc5643a={'where':_0x5d8523[_0x521e('0x32')]};return db[_0x521e('0x26')][_0x521e('0x1d')](_0xc5643a)['then'](function(_0x381062){_0x1582d8[_0x521e('0x1d')]=_0x381062;if(_0x2d75eb[_0x521e('0x2c')][_0x521e('0x38')]){_0x5d8523['include']=[{'all':!![]}];}return db[_0x521e('0x26')][_0x521e('0x39')](_0x5d8523);})[_0x521e('0x22')](function(_0x18dcf8){_0x1582d8['rows']=_0x18dcf8;return _0x1582d8;})[_0x521e('0x22')](respondWithFilteredResult(_0x81761e,_0x5d8523))[_0x521e('0x3a')](handleError(_0x81761e,null));};exports[_0x521e('0x3b')]=function(_0x4619d6,_0x3629c0){var _0x509ffe={'raw':!![],'where':{'id':_0x4619d6['params']['id']}},_0x1cdcd3={};_0x1cdcd3[_0x521e('0x29')]=_[_0x521e('0x3c')](db[_0x521e('0x26')]['rawAttributes']);_0x1cdcd3['query']=_[_0x521e('0x3c')](_0x4619d6['query']);_0x1cdcd3[_0x521e('0x2a')]=_['intersection'](_0x1cdcd3[_0x521e('0x29')],_0x1cdcd3[_0x521e('0x2c')]);_0x509ffe['attributes']=_[_0x521e('0x2b')](_0x1cdcd3[_0x521e('0x29')],qs[_0x521e('0x2e')](_0x4619d6[_0x521e('0x2c')][_0x521e('0x2e')]));_0x509ffe[_0x521e('0x2d')]=_0x509ffe[_0x521e('0x2d')][_0x521e('0x2f')]?_0x509ffe[_0x521e('0x2d')]:_0x1cdcd3['model'];if(_0x4619d6[_0x521e('0x2c')][_0x521e('0x38')]){_0x509ffe[_0x521e('0x3d')]=[{'all':!![]}];}_0x509ffe=_['merge']({},_0x509ffe,_0x4619d6['options']);return db[_0x521e('0x26')][_0x521e('0x3e')](_0x509ffe)[_0x521e('0x22')](handleEntityNotFound(_0x3629c0,null))['then'](respondWithResult(_0x3629c0,null))['catch'](handleError(_0x3629c0,null));};exports[_0x521e('0x3f')]=function(_0x27647a,_0xfd1dd9){return db[_0x521e('0x26')][_0x521e('0x3f')](_0x27647a['body'],{})[_0x521e('0x22')](respondWithResult(_0xfd1dd9,0xc9))[_0x521e('0x3a')](handleError(_0xfd1dd9,null));};exports[_0x521e('0x40')]=function(_0x58e27e,_0x1b1d36){if(_0x58e27e[_0x521e('0x41')]['id']){delete _0x58e27e[_0x521e('0x41')]['id'];}return db['SmsQueueReport'][_0x521e('0x3e')]({'where':{'id':_0x58e27e[_0x521e('0x42')]['id']}})[_0x521e('0x22')](handleEntityNotFound(_0x1b1d36,null))[_0x521e('0x22')](saveUpdates(_0x58e27e['body'],null))[_0x521e('0x22')](respondWithResult(_0x1b1d36,null))[_0x521e('0x3a')](handleError(_0x1b1d36,null));};exports['destroy']=function(_0x355119,_0x39e438){return db[_0x521e('0x26')][_0x521e('0x3e')]({'where':{'id':_0x355119[_0x521e('0x42')]['id']}})['then'](handleEntityNotFound(_0x39e438,null))[_0x521e('0x22')](removeEntity(_0x39e438,null))[_0x521e('0x3a')](handleError(_0x39e438,null));};exports[_0x521e('0x43')]=function(_0x2bd15a,_0x1c2d72){return db[_0x521e('0x26')][_0x521e('0x43')]()[_0x521e('0x22')](respondWithResult(_0x1c2d72,null))[_0x521e('0x3a')](handleError(_0x1c2d72,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 93b8b0b..0a3ce06 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x69c0c2,_0x2af0bf){var _0x3422f6=function(_0x283e41){while(--_0x283e41){_0x69c0c2['push'](_0x69c0c2['shift']());}};_0x3422f6(++_0x2af0bf);}(_0xe706,0xa3));var _0x6e70=function(_0x4b97c6,_0x21017c){_0x4b97c6=_0x4b97c6-0x0;var _0x342ead=_0xe706[_0x4b97c6];return _0x342ead;};'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':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_sms_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x37f57e,_0x179c3b){var _0x513338=function(_0x24d129){while(--_0x24d129){_0x37f57e['push'](_0x37f57e['shift']());}};_0x513338(++_0x179c3b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./smsQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('SmsQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('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 4415102..3c0d227 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 _0x048e=['update','body','raw','where','stringify','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','SmsQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateSmsQueueReport','create','options','debug','UpdateSmsQueueReport'];(function(_0x1bc2d6,_0x1257d3){var _0x559744=function(_0x537bad){while(--_0x537bad){_0x1bc2d6['push'](_0x1bc2d6['shift']());}};_0x559744(++_0x1257d3);}(_0x048e,0x137));var _0xe048=function(_0x12db5b,_0x17dec0){_0x12db5b=_0x12db5b-0x0;var _0xf0f483=_0x048e[_0x12db5b];return _0xf0f483;};'use strict';var _=require('lodash');var util=require(_0xe048('0x0'));var moment=require(_0xe048('0x1'));var BPromise=require(_0xe048('0x2'));var rs=require(_0xe048('0x3'));var fs=require('fs');var Redis=require(_0xe048('0x4'));var db=require(_0xe048('0x5'))['db'];var utils=require(_0xe048('0x6'));var logger=require(_0xe048('0x7'))(_0xe048('0x8'));var config=require(_0xe048('0x9'));var jayson=require(_0xe048('0xa'));var client=jayson[_0xe048('0xb')][_0xe048('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x383cdb,_0x1f7b67,_0x39e20c){return new BPromise(function(_0x4c48a1,_0x4ee27b){return client[_0xe048('0xd')](_0x383cdb,_0x39e20c)[_0xe048('0xe')](function(_0x3ee7da){logger[_0xe048('0xf')](_0xe048('0x10'),_0x1f7b67,_0xe048('0x11'));logger['debug'](_0xe048('0x12'),_0x1f7b67,_0xe048('0x11'),JSON['stringify'](_0x3ee7da));if(_0x3ee7da[_0xe048('0x13')]){if(_0x3ee7da[_0xe048('0x13')][_0xe048('0x14')]===0x1f4){logger[_0xe048('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x1f7b67,_0x3ee7da['error'][_0xe048('0x15')]);return _0x4ee27b(_0x3ee7da['error'][_0xe048('0x15')]);}logger[_0xe048('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x1f7b67,_0x3ee7da[_0xe048('0x13')]['message']);return _0x4c48a1(_0x3ee7da['error'][_0xe048('0x15')]);}else{logger['info'](_0xe048('0x10'),_0x1f7b67,_0xe048('0x11'));_0x4c48a1(_0x3ee7da[_0xe048('0x16')]['message']);}})[_0xe048('0x17')](function(_0x248a30){logger[_0xe048('0x13')]('SmsQueueReport,\x20%s,\x20%s',_0x1f7b67,_0x248a30);_0x4ee27b(_0x248a30);});});}exports[_0xe048('0x18')]=function(_0x3fe238){var _0x301412=this;return new Promise(function(_0x2e077f,_0x4021da){return db['SmsQueueReport'][_0xe048('0x19')](_0x3fe238['body'],{'raw':_0x3fe238[_0xe048('0x1a')]?_0x3fe238['options']['raw']===undefined?!![]:![]:!![]})[_0xe048('0xe')](function(_0x29d28e){logger['info'](_0xe048('0x18'),_0x3fe238);logger[_0xe048('0x1b')]('CreateSmsQueueReport',_0x3fe238,JSON['stringify'](_0x29d28e));_0x2e077f(_0x29d28e);})[_0xe048('0x17')](function(_0x6bb078){logger[_0xe048('0x13')]('CreateSmsQueueReport',_0x6bb078[_0xe048('0x15')],_0x3fe238);_0x4021da(_0x301412[_0xe048('0x13')](0x1f4,_0x6bb078[_0xe048('0x15')]));});});};exports[_0xe048('0x1c')]=function(_0x5b9ae6){var _0x2afe6b=this;return new Promise(function(_0xf07c8b,_0x222c5d){return db['SmsQueueReport'][_0xe048('0x1d')](_0x5b9ae6[_0xe048('0x1e')],{'raw':_0x5b9ae6['options']?_0x5b9ae6[_0xe048('0x1a')][_0xe048('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b9ae6['options']?_0x5b9ae6['options'][_0xe048('0x20')]||null:null,'attributes':_0x5b9ae6['options']?_0x5b9ae6['options']['attributes']||null:null,'limit':_0x5b9ae6[_0xe048('0x1a')]?_0x5b9ae6[_0xe048('0x1a')]['limit']||null:null})['then'](function(_0x3756a1){logger[_0xe048('0xf')](_0xe048('0x1c'),_0x5b9ae6);logger[_0xe048('0x1b')](_0xe048('0x1c'),_0x5b9ae6,JSON[_0xe048('0x21')](_0x3756a1));_0xf07c8b(_0x3756a1);})[_0xe048('0x17')](function(_0x2266dc){logger['error']('UpdateSmsQueueReport',_0x2266dc['message'],_0x5b9ae6);_0x222c5d(_0x2afe6b['error'](0x1f4,_0x2266dc[_0xe048('0x15')]));});});}; \ No newline at end of file +var _0x31de=['lodash','util','moment','bluebird','../../mysqldb','rpc','jayson/promise','client','http','request','then','SmsQueueReport,\x20%s,\x20%s','request\x20sent','debug','SmsQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','SmsQueueReport','body','options','raw','CreateSmsQueueReport','update','where','attributes','limit','UpdateSmsQueueReport'];(function(_0x34893e,_0x4f6f59){var _0x8b0331=function(_0x167960){while(--_0x167960){_0x34893e['push'](_0x34893e['shift']());}};_0x8b0331(++_0x4f6f59);}(_0x31de,0x100));var _0xe31d=function(_0x4b3e5b,_0x118d1a){_0x4b3e5b=_0x4b3e5b-0x0;var _0x4e2a71=_0x31de[_0x4b3e5b];return _0x4e2a71;};'use strict';var _=require(_0xe31d('0x0'));var util=require(_0xe31d('0x1'));var moment=require(_0xe31d('0x2'));var BPromise=require(_0xe31d('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe31d('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xe31d('0x5'));var config=require('../../config/environment');var jayson=require(_0xe31d('0x6'));var client=jayson[_0xe31d('0x7')][_0xe31d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3bf114,_0x26a117,_0x4fdabf){return new BPromise(function(_0x8f9af,_0x2e8853){return client[_0xe31d('0x9')](_0x3bf114,_0x4fdabf)[_0xe31d('0xa')](function(_0x2c4b7f){logger['info'](_0xe31d('0xb'),_0x26a117,_0xe31d('0xc'));logger[_0xe31d('0xd')](_0xe31d('0xe'),_0x26a117,_0xe31d('0xc'),JSON[_0xe31d('0xf')](_0x2c4b7f));if(_0x2c4b7f['error']){if(_0x2c4b7f[_0xe31d('0x10')][_0xe31d('0x11')]===0x1f4){logger[_0xe31d('0x10')](_0xe31d('0xb'),_0x26a117,_0x2c4b7f[_0xe31d('0x10')][_0xe31d('0x12')]);return _0x2e8853(_0x2c4b7f['error']['message']);}logger['error']('SmsQueueReport,\x20%s,\x20%s',_0x26a117,_0x2c4b7f[_0xe31d('0x10')][_0xe31d('0x12')]);return _0x8f9af(_0x2c4b7f[_0xe31d('0x10')][_0xe31d('0x12')]);}else{logger[_0xe31d('0x13')](_0xe31d('0xb'),_0x26a117,'request\x20sent');_0x8f9af(_0x2c4b7f[_0xe31d('0x14')]['message']);}})[_0xe31d('0x15')](function(_0x5425f3){logger[_0xe31d('0x10')](_0xe31d('0xb'),_0x26a117,_0x5425f3);_0x2e8853(_0x5425f3);});});}exports['CreateSmsQueueReport']=function(_0x80e6c9){var _0x49ea17=this;return new Promise(function(_0x4188c2,_0x51c4b7){return db[_0xe31d('0x16')]['create'](_0x80e6c9[_0xe31d('0x17')],{'raw':_0x80e6c9[_0xe31d('0x18')]?_0x80e6c9[_0xe31d('0x18')][_0xe31d('0x19')]===undefined?!![]:![]:!![]})['then'](function(_0x32b98b){logger[_0xe31d('0x13')](_0xe31d('0x1a'),_0x80e6c9);logger['debug'](_0xe31d('0x1a'),_0x80e6c9,JSON[_0xe31d('0xf')](_0x32b98b));_0x4188c2(_0x32b98b);})[_0xe31d('0x15')](function(_0x591f3c){logger[_0xe31d('0x10')](_0xe31d('0x1a'),_0x591f3c[_0xe31d('0x12')],_0x80e6c9);_0x51c4b7(_0x49ea17[_0xe31d('0x10')](0x1f4,_0x591f3c['message']));});});};exports['UpdateSmsQueueReport']=function(_0x48bc95){var _0x415e9f=this;return new Promise(function(_0x1f22df,_0x15afd5){return db['SmsQueueReport'][_0xe31d('0x1b')](_0x48bc95[_0xe31d('0x17')],{'raw':_0x48bc95[_0xe31d('0x18')]?_0x48bc95[_0xe31d('0x18')][_0xe31d('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x48bc95['options']?_0x48bc95[_0xe31d('0x18')][_0xe31d('0x1c')]||null:null,'attributes':_0x48bc95[_0xe31d('0x18')]?_0x48bc95['options'][_0xe31d('0x1d')]||null:null,'limit':_0x48bc95[_0xe31d('0x18')]?_0x48bc95[_0xe31d('0x18')][_0xe31d('0x1e')]||null:null})[_0xe31d('0xa')](function(_0x2ada16){logger[_0xe31d('0x13')](_0xe31d('0x1f'),_0x48bc95);logger[_0xe31d('0xd')](_0xe31d('0x1f'),_0x48bc95,JSON[_0xe31d('0xf')](_0x2ada16));_0x1f22df(_0x2ada16);})['catch'](function(_0x396972){logger['error']('UpdateSmsQueueReport',_0x396972[_0xe31d('0x12')],_0x48bc95);_0x15afd5(_0x415e9f[_0xe31d('0x10')](0x1f4,_0x396972[_0xe31d('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 0448e33..edc6761 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 _0x57d4=['../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x57d4,0x78));var _0x457d=function(_0x48968b,_0x51cf51){_0x48968b=_0x48968b-0x0;var _0x55c043=_0x57d4[_0x48968b];return _0x55c043;};'use strict';var multer=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var path=require('path');var timeout=require(_0x457d('0x2'));var express=require(_0x457d('0x3'));var router=express[_0x457d('0x4')]();var fs_extra=require(_0x457d('0x5'));var auth=require(_0x457d('0x6'));var interaction=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var controller=require(_0x457d('0x9'));router[_0x457d('0xa')]('/',auth[_0x457d('0xb')](),controller[_0x457d('0xc')]);router['get'](_0x457d('0xd'),auth[_0x457d('0xb')](),controller['describe']);router['get'](_0x457d('0xe'),auth[_0x457d('0xb')](),controller[_0x457d('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x457d('0x10')](_0x457d('0xe'),auth[_0x457d('0xb')](),controller[_0x457d('0x11')]);router[_0x457d('0x12')](_0x457d('0xe'),auth[_0x457d('0xb')](),controller[_0x457d('0x13')]);module[_0x457d('0x14')]=router; \ No newline at end of file +var _0x5178=['/describe','isAuthenticated','describe','/:id','post','put','update','delete','destroy','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','index'];(function(_0x3c0a19,_0x119895){var _0x26a2cd=function(_0x69b63e){while(--_0x69b63e){_0x3c0a19['push'](_0x3c0a19['shift']());}};_0x26a2cd(++_0x119895);}(_0x5178,0x171));var _0x8517=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x5178[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require(_0x8517('0x0'));var path=require(_0x8517('0x1'));var timeout=require(_0x8517('0x2'));var express=require(_0x8517('0x3'));var router=express[_0x8517('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8517('0x5'));var config=require(_0x8517('0x6'));var controller=require('./smsTransferReport.controller');router[_0x8517('0x7')]('/',auth['isAuthenticated'](),controller[_0x8517('0x8')]);router[_0x8517('0x7')](_0x8517('0x9'),auth[_0x8517('0xa')](),controller[_0x8517('0xb')]);router['get'](_0x8517('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x8517('0xd')]('/',auth[_0x8517('0xa')](),controller['create']);router[_0x8517('0xe')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0xf')]);router[_0x8517('0x10')](_0x8517('0xc'),auth[_0x8517('0xa')](),controller[_0x8517('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index e6601e2..7a722a4 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 _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x51f61e,_0x3c72ef){var _0x14566d=function(_0x583f42){while(--_0x583f42){_0x51f61e['push'](_0x51f61e['shift']());}};_0x14566d(++_0x3c72ef);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x445101,_0x2414bf){_0x445101=_0x445101-0x0;var _0x3c3d04=_0xf3cd[_0x445101];return _0x3c3d04;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xaa88=['account','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x117921,_0x3918d9){var _0x47d0dd=function(_0x19ad1e){while(--_0x19ad1e){_0x117921['push'](_0x117921['shift']());}};_0x47d0dd(++_0x3918d9);}(_0xaa88,0x137));var _0x8aa8=function(_0x421725,_0x318a04){_0x421725=_0x421725-0x0;var _0x51b322=_0xaa88[_0x421725];return _0x51b322;};'use strict';var moment=require(_0x8aa8('0x0'));var Sequelize=require(_0x8aa8('0x1'));module[_0x8aa8('0x2')]={'uniqueid':{'type':Sequelize[_0x8aa8('0x3')],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x8aa8('0x4'),_0x8aa8('0x5'),_0x8aa8('0x6')),'allowNull':![],'defaultValue':_0x8aa8('0x6')},'transferredAt':{'type':Sequelize[_0x8aa8('0x7')],'allowNull':![],'defaultValue':Sequelize[_0x8aa8('0x8')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index b127fa4..cfe6b9b 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 _0x439e=['filter','merge','type','options','count','includeAll','include','findAll','catch','show','params','rawAttributes','intersection','find','create','body','update','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','offset','apply','reject','destroy','then','error','stack','name','send','map','SmsTransferReport','model','query','keys','filters','attributes','fields','length','order','sort','where','pick'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x439e,0x12e));var _0xe439=function(_0x3b033c,_0x1a8656){_0x3b033c=_0x3b033c-0x0;var _0xa50790=_0x439e[_0x3b033c];return _0xa50790;};'use strict';var emlformat=require(_0xe439('0x0'));var rimraf=require(_0xe439('0x1'));var zipdir=require(_0xe439('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe439('0x3'));var moment=require('moment');var BPromise=require(_0xe439('0x4'));var Mustache=require(_0xe439('0x5'));var util=require(_0xe439('0x6'));var path=require(_0xe439('0x7'));var sox=require(_0xe439('0x8'));var csv=require(_0xe439('0x9'));var ejs=require(_0xe439('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xe439('0xb'));var squel=require('squel');var crypto=require(_0xe439('0xc'));var jsforce=require(_0xe439('0xd'));var deskjs=require(_0xe439('0xe'));var toCsv=require(_0xe439('0x9'));var querystring=require(_0xe439('0xf'));var Papa=require(_0xe439('0x10'));var Redis=require(_0xe439('0x11'));var authService=require(_0xe439('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe439('0x13'));var logger=require('../../config/logger')(_0xe439('0x14'));var utils=require(_0xe439('0x15'));var config=require(_0xe439('0x16'));var licenseUtil=require(_0xe439('0x17'));var db=require(_0xe439('0x18'))['db'];function respondWithStatusCode(_0x10caa8,_0x13e89d){_0x13e89d=_0x13e89d||0xcc;return function(_0xd365d0){if(_0xd365d0){return _0x10caa8[_0xe439('0x19')](_0x13e89d);}return _0x10caa8[_0xe439('0x1a')](_0x13e89d)[_0xe439('0x1b')]();};}function respondWithResult(_0x1d2860,_0x1f9c3d){_0x1f9c3d=_0x1f9c3d||0xc8;return function(_0x2cc19a){if(_0x2cc19a){return _0x1d2860[_0xe439('0x1a')](_0x1f9c3d)[_0xe439('0x1c')](_0x2cc19a);}};}function respondWithFilteredResult(_0x3c804f,_0x577270){return function(_0x2fa183){if(_0x2fa183){var _0x574cf7=typeof _0x577270['offset']===_0xe439('0x1d')&&typeof _0x577270[_0xe439('0x1e')]===_0xe439('0x1d');var _0x56107d=_0x2fa183['count'];var _0x9980e2=_0x574cf7?0x0:_0x577270[_0xe439('0x1f')];var _0x28c0c1=_0x574cf7?_0x2fa183['count']:_0x577270[_0xe439('0x1f')]+_0x577270['limit'];var _0x493bef;if(_0x28c0c1>=_0x56107d){_0x28c0c1=_0x56107d;_0x493bef=0xc8;}else{_0x493bef=0xce;}_0x3c804f[_0xe439('0x1a')](_0x493bef);return _0x3c804f['set']('Content-Range',_0x9980e2+'-'+_0x28c0c1+'/'+_0x56107d)['json'](_0x2fa183);}return null;};}function patchUpdates(_0x4209bc){return function(_0x56c9d7){try{jsonpatch[_0xe439('0x20')](_0x56c9d7,_0x4209bc,!![]);}catch(_0x5b378e){return BPromise[_0xe439('0x21')](_0x5b378e);}return _0x56c9d7['save']();};}function saveUpdates(_0x169927,_0x2b5bcd){return function(_0x5dff50){if(_0x5dff50){return _0x5dff50['update'](_0x169927)['then'](function(_0x4bd616){return _0x4bd616;});}return null;};}function removeEntity(_0x34cd77,_0x3305ee){return function(_0x3967f5){if(_0x3967f5){return _0x3967f5[_0xe439('0x22')]()[_0xe439('0x23')](function(){_0x34cd77[_0xe439('0x1a')](0xcc)[_0xe439('0x1b')]();});}};}function handleEntityNotFound(_0x202d92,_0x20d171){return function(_0x2d00f3){if(!_0x2d00f3){_0x202d92['sendStatus'](0x194);}return _0x2d00f3;};}function handleError(_0x492855,_0x20ea18){_0x20ea18=_0x20ea18||0x1f4;return function(_0x27dd4c){logger[_0xe439('0x24')](_0x27dd4c[_0xe439('0x25')]);if(_0x27dd4c[_0xe439('0x26')]){delete _0x27dd4c[_0xe439('0x26')];}_0x492855[_0xe439('0x1a')](_0x20ea18)[_0xe439('0x27')](_0x27dd4c);};}exports['index']=function(_0x279363,_0x350525){var _0x113fb9={},_0x5c5783={},_0x22c4be={'count':0x0,'rows':[]};var _0x4fef7a=_[_0xe439('0x28')](db[_0xe439('0x29')]['rawAttributes'],function(_0x2bfeac){return{'name':_0x2bfeac['fieldName'],'type':_0x2bfeac['type']['key']};});_0x5c5783[_0xe439('0x2a')]=_[_0xe439('0x28')](_0x4fef7a,_0xe439('0x26'));_0x5c5783[_0xe439('0x2b')]=_[_0xe439('0x2c')](_0x279363['query']);_0x5c5783[_0xe439('0x2d')]=_['intersection'](_0x5c5783[_0xe439('0x2a')],_0x5c5783['query']);_0x113fb9[_0xe439('0x2e')]=_['intersection'](_0x5c5783[_0xe439('0x2a')],qs[_0xe439('0x2f')](_0x279363[_0xe439('0x2b')][_0xe439('0x2f')]));_0x113fb9[_0xe439('0x2e')]=_0x113fb9[_0xe439('0x2e')][_0xe439('0x30')]?_0x113fb9[_0xe439('0x2e')]:_0x5c5783[_0xe439('0x2a')];if(!_0x279363['query']['hasOwnProperty']('nolimit')){_0x113fb9[_0xe439('0x1e')]=qs['limit'](_0x279363[_0xe439('0x2b')][_0xe439('0x1e')]);_0x113fb9[_0xe439('0x1f')]=qs['offset'](_0x279363[_0xe439('0x2b')][_0xe439('0x1f')]);}_0x113fb9[_0xe439('0x31')]=qs['sort'](_0x279363[_0xe439('0x2b')][_0xe439('0x32')]);_0x113fb9[_0xe439('0x33')]=qs[_0xe439('0x2d')](_[_0xe439('0x34')](_0x279363[_0xe439('0x2b')],_0x5c5783['filters']),_0x4fef7a);if(_0x279363[_0xe439('0x2b')][_0xe439('0x35')]){_0x113fb9[_0xe439('0x33')]=_[_0xe439('0x36')](_0x113fb9[_0xe439('0x33')],{'$or':_[_0xe439('0x28')](_0x4fef7a,function(_0x2fe36b){if(_0x2fe36b[_0xe439('0x37')]!=='VIRTUAL'){var _0xea70a0={};_0xea70a0[_0x2fe36b[_0xe439('0x26')]]={'$like':'%'+_0x279363['query'][_0xe439('0x35')]+'%'};return _0xea70a0;}})});}_0x113fb9=_[_0xe439('0x36')]({},_0x113fb9,_0x279363[_0xe439('0x38')]);var _0x3b0b4f={'where':_0x113fb9['where']};return db[_0xe439('0x29')][_0xe439('0x39')](_0x3b0b4f)[_0xe439('0x23')](function(_0x56d51e){_0x22c4be[_0xe439('0x39')]=_0x56d51e;if(_0x279363['query'][_0xe439('0x3a')]){_0x113fb9[_0xe439('0x3b')]=[{'all':!![]}];}return db[_0xe439('0x29')][_0xe439('0x3c')](_0x113fb9);})['then'](function(_0x189ffc){_0x22c4be['rows']=_0x189ffc;return _0x22c4be;})['then'](respondWithFilteredResult(_0x350525,_0x113fb9))[_0xe439('0x3d')](handleError(_0x350525,null));};exports[_0xe439('0x3e')]=function(_0x44c0d3,_0x2c87a7){var _0x179804={'raw':!![],'where':{'id':_0x44c0d3[_0xe439('0x3f')]['id']}},_0x65eab2={};_0x65eab2[_0xe439('0x2a')]=_['keys'](db['SmsTransferReport'][_0xe439('0x40')]);_0x65eab2[_0xe439('0x2b')]=_['keys'](_0x44c0d3['query']);_0x65eab2[_0xe439('0x2d')]=_[_0xe439('0x41')](_0x65eab2['model'],_0x65eab2[_0xe439('0x2b')]);_0x179804[_0xe439('0x2e')]=_[_0xe439('0x41')](_0x65eab2[_0xe439('0x2a')],qs[_0xe439('0x2f')](_0x44c0d3['query']['fields']));_0x179804['attributes']=_0x179804['attributes'][_0xe439('0x30')]?_0x179804['attributes']:_0x65eab2[_0xe439('0x2a')];if(_0x44c0d3[_0xe439('0x2b')]['includeAll']){_0x179804['include']=[{'all':!![]}];}_0x179804=_[_0xe439('0x36')]({},_0x179804,_0x44c0d3['options']);return db[_0xe439('0x29')][_0xe439('0x42')](_0x179804)['then'](handleEntityNotFound(_0x2c87a7,null))[_0xe439('0x23')](respondWithResult(_0x2c87a7,null))[_0xe439('0x3d')](handleError(_0x2c87a7,null));};exports[_0xe439('0x43')]=function(_0x1dc729,_0x5c0838){return db[_0xe439('0x29')][_0xe439('0x43')](_0x1dc729[_0xe439('0x44')],{})[_0xe439('0x23')](respondWithResult(_0x5c0838,0xc9))[_0xe439('0x3d')](handleError(_0x5c0838,null));};exports[_0xe439('0x45')]=function(_0x3b4781,_0x3a646b){if(_0x3b4781[_0xe439('0x44')]['id']){delete _0x3b4781['body']['id'];}return db[_0xe439('0x29')]['find']({'where':{'id':_0x3b4781['params']['id']}})['then'](handleEntityNotFound(_0x3a646b,null))[_0xe439('0x23')](saveUpdates(_0x3b4781[_0xe439('0x44')],null))[_0xe439('0x23')](respondWithResult(_0x3a646b,null))[_0xe439('0x3d')](handleError(_0x3a646b,null));};exports[_0xe439('0x22')]=function(_0x3caa83,_0x36859b){return db['SmsTransferReport']['find']({'where':{'id':_0x3caa83[_0xe439('0x3f')]['id']}})[_0xe439('0x23')](handleEntityNotFound(_0x36859b,null))[_0xe439('0x23')](removeEntity(_0x36859b,null))[_0xe439('0x3d')](handleError(_0x36859b,null));};exports[_0xe439('0x46')]=function(_0x43f577,_0xd6d33){return db[_0xe439('0x29')][_0xe439('0x46')]()[_0xe439('0x23')](respondWithResult(_0xd6d33,null))[_0xe439('0x3d')](handleError(_0xd6d33,null));}; \ No newline at end of file +var _0xf699=['lodash','crypto','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','end','status','offset','undefined','count','limit','set','json','apply','reject','save','update','then','destroy','stack','name','send','index','SmsTransferReport','fieldName','type','key','model','map','keys','query','filters','intersection','fields','attributes','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','create','body','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra'];(function(_0xd80f6f,_0x349301){var _0x5a228c=function(_0x2bc867){while(--_0x2bc867){_0xd80f6f['push'](_0xd80f6f['shift']());}};_0x5a228c(++_0x349301);}(_0xf699,0x125));var _0x9f69=function(_0x57283c,_0xaa3c5){_0x57283c=_0x57283c-0x0;var _0x781d79=_0xf699[_0x57283c];return _0x781d79;};'use strict';var emlformat=require(_0x9f69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9f69('0x1'));var jsonpatch=require(_0x9f69('0x2'));var rp=require(_0x9f69('0x3'));var moment=require(_0x9f69('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x9f69('0x5'));var path=require(_0x9f69('0x6'));var sox=require(_0x9f69('0x7'));var csv=require(_0x9f69('0x8'));var ejs=require(_0x9f69('0x9'));var fs=require('fs');var fs_extra=require(_0x9f69('0xa'));var _=require(_0x9f69('0xb'));var squel=require('squel');var crypto=require(_0x9f69('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x9f69('0xd'));var toCsv=require(_0x9f69('0x8'));var querystring=require(_0x9f69('0xe'));var Papa=require(_0x9f69('0xf'));var Redis=require(_0x9f69('0x10'));var authService=require(_0x9f69('0x11'));var qs=require(_0x9f69('0x12'));var as=require(_0x9f69('0x13'));var hardwareService=require(_0x9f69('0x14'));var logger=require(_0x9f69('0x15'))(_0x9f69('0x16'));var utils=require(_0x9f69('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x9f69('0x18'));var db=require(_0x9f69('0x19'))['db'];function respondWithStatusCode(_0x2bedf5,_0x4611e9){_0x4611e9=_0x4611e9||0xcc;return function(_0x59b975){if(_0x59b975){return _0x2bedf5[_0x9f69('0x1a')](_0x4611e9);}return _0x2bedf5['status'](_0x4611e9)[_0x9f69('0x1b')]();};}function respondWithResult(_0x56db94,_0x40a588){_0x40a588=_0x40a588||0xc8;return function(_0x1b245a){if(_0x1b245a){return _0x56db94[_0x9f69('0x1c')](_0x40a588)['json'](_0x1b245a);}};}function respondWithFilteredResult(_0x455e08,_0x55e4c2){return function(_0x4cf66b){if(_0x4cf66b){var _0x309d33=typeof _0x55e4c2[_0x9f69('0x1d')]===_0x9f69('0x1e')&&typeof _0x55e4c2['limit']===_0x9f69('0x1e');var _0x4ce060=_0x4cf66b[_0x9f69('0x1f')];var _0x46ceba=_0x309d33?0x0:_0x55e4c2[_0x9f69('0x1d')];var _0x4f5f9d=_0x309d33?_0x4cf66b[_0x9f69('0x1f')]:_0x55e4c2[_0x9f69('0x1d')]+_0x55e4c2[_0x9f69('0x20')];var _0x34c107;if(_0x4f5f9d>=_0x4ce060){_0x4f5f9d=_0x4ce060;_0x34c107=0xc8;}else{_0x34c107=0xce;}_0x455e08[_0x9f69('0x1c')](_0x34c107);return _0x455e08[_0x9f69('0x21')]('Content-Range',_0x46ceba+'-'+_0x4f5f9d+'/'+_0x4ce060)[_0x9f69('0x22')](_0x4cf66b);}return null;};}function patchUpdates(_0x4f73ae){return function(_0x1fd727){try{jsonpatch[_0x9f69('0x23')](_0x1fd727,_0x4f73ae,!![]);}catch(_0xfca8db){return BPromise[_0x9f69('0x24')](_0xfca8db);}return _0x1fd727[_0x9f69('0x25')]();};}function saveUpdates(_0x5b4501,_0x40dbdd){return function(_0x51de51){if(_0x51de51){return _0x51de51[_0x9f69('0x26')](_0x5b4501)[_0x9f69('0x27')](function(_0xf018e){return _0xf018e;});}return null;};}function removeEntity(_0x3b98ef,_0x21eabb){return function(_0x8be137){if(_0x8be137){return _0x8be137[_0x9f69('0x28')]()[_0x9f69('0x27')](function(){_0x3b98ef[_0x9f69('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x43426d,_0x8459a4){return function(_0x50262e){if(!_0x50262e){_0x43426d[_0x9f69('0x1a')](0x194);}return _0x50262e;};}function handleError(_0x2f3f89,_0x8eca21){_0x8eca21=_0x8eca21||0x1f4;return function(_0x394afe){logger['error'](_0x394afe[_0x9f69('0x29')]);if(_0x394afe[_0x9f69('0x2a')]){delete _0x394afe[_0x9f69('0x2a')];}_0x2f3f89[_0x9f69('0x1c')](_0x8eca21)[_0x9f69('0x2b')](_0x394afe);};}exports[_0x9f69('0x2c')]=function(_0x36912e,_0x391cbf){var _0x22e41a={},_0x1e74a9={},_0x43095f={'count':0x0,'rows':[]};var _0x2e5369=_['map'](db[_0x9f69('0x2d')]['rawAttributes'],function(_0x58a8a9){return{'name':_0x58a8a9[_0x9f69('0x2e')],'type':_0x58a8a9[_0x9f69('0x2f')][_0x9f69('0x30')]};});_0x1e74a9[_0x9f69('0x31')]=_[_0x9f69('0x32')](_0x2e5369,_0x9f69('0x2a'));_0x1e74a9['query']=_[_0x9f69('0x33')](_0x36912e[_0x9f69('0x34')]);_0x1e74a9[_0x9f69('0x35')]=_['intersection'](_0x1e74a9[_0x9f69('0x31')],_0x1e74a9[_0x9f69('0x34')]);_0x22e41a['attributes']=_[_0x9f69('0x36')](_0x1e74a9[_0x9f69('0x31')],qs[_0x9f69('0x37')](_0x36912e[_0x9f69('0x34')][_0x9f69('0x37')]));_0x22e41a['attributes']=_0x22e41a[_0x9f69('0x38')]['length']?_0x22e41a['attributes']:_0x1e74a9['model'];if(!_0x36912e[_0x9f69('0x34')]['hasOwnProperty'](_0x9f69('0x39'))){_0x22e41a[_0x9f69('0x20')]=qs[_0x9f69('0x20')](_0x36912e[_0x9f69('0x34')][_0x9f69('0x20')]);_0x22e41a[_0x9f69('0x1d')]=qs[_0x9f69('0x1d')](_0x36912e[_0x9f69('0x34')][_0x9f69('0x1d')]);}_0x22e41a['order']=qs['sort'](_0x36912e[_0x9f69('0x34')][_0x9f69('0x3a')]);_0x22e41a[_0x9f69('0x3b')]=qs[_0x9f69('0x35')](_[_0x9f69('0x3c')](_0x36912e[_0x9f69('0x34')],_0x1e74a9[_0x9f69('0x35')]),_0x2e5369);if(_0x36912e['query'][_0x9f69('0x3d')]){_0x22e41a[_0x9f69('0x3b')]=_[_0x9f69('0x3e')](_0x22e41a[_0x9f69('0x3b')],{'$or':_[_0x9f69('0x32')](_0x2e5369,function(_0x29d28f){if(_0x29d28f[_0x9f69('0x2f')]!==_0x9f69('0x3f')){var _0x2b76db={};_0x2b76db[_0x29d28f[_0x9f69('0x2a')]]={'$like':'%'+_0x36912e[_0x9f69('0x34')][_0x9f69('0x3d')]+'%'};return _0x2b76db;}})});}_0x22e41a=_[_0x9f69('0x3e')]({},_0x22e41a,_0x36912e[_0x9f69('0x40')]);var _0x4b3638={'where':_0x22e41a['where']};return db[_0x9f69('0x2d')]['count'](_0x4b3638)[_0x9f69('0x27')](function(_0x809d7f){_0x43095f[_0x9f69('0x1f')]=_0x809d7f;if(_0x36912e[_0x9f69('0x34')][_0x9f69('0x41')]){_0x22e41a['include']=[{'all':!![]}];}return db['SmsTransferReport'][_0x9f69('0x42')](_0x22e41a);})['then'](function(_0x11fc40){_0x43095f[_0x9f69('0x43')]=_0x11fc40;return _0x43095f;})[_0x9f69('0x27')](respondWithFilteredResult(_0x391cbf,_0x22e41a))[_0x9f69('0x44')](handleError(_0x391cbf,null));};exports[_0x9f69('0x45')]=function(_0x50ee22,_0x5c2712){var _0x1d062d={'raw':!![],'where':{'id':_0x50ee22[_0x9f69('0x46')]['id']}},_0x5e75c9={};_0x5e75c9[_0x9f69('0x31')]=_['keys'](db[_0x9f69('0x2d')]['rawAttributes']);_0x5e75c9[_0x9f69('0x34')]=_[_0x9f69('0x33')](_0x50ee22[_0x9f69('0x34')]);_0x5e75c9[_0x9f69('0x35')]=_[_0x9f69('0x36')](_0x5e75c9[_0x9f69('0x31')],_0x5e75c9['query']);_0x1d062d[_0x9f69('0x38')]=_[_0x9f69('0x36')](_0x5e75c9[_0x9f69('0x31')],qs[_0x9f69('0x37')](_0x50ee22[_0x9f69('0x34')][_0x9f69('0x37')]));_0x1d062d[_0x9f69('0x38')]=_0x1d062d[_0x9f69('0x38')]['length']?_0x1d062d[_0x9f69('0x38')]:_0x5e75c9[_0x9f69('0x31')];if(_0x50ee22[_0x9f69('0x34')][_0x9f69('0x41')]){_0x1d062d[_0x9f69('0x47')]=[{'all':!![]}];}_0x1d062d=_[_0x9f69('0x3e')]({},_0x1d062d,_0x50ee22[_0x9f69('0x40')]);return db[_0x9f69('0x2d')]['find'](_0x1d062d)['then'](handleEntityNotFound(_0x5c2712,null))['then'](respondWithResult(_0x5c2712,null))[_0x9f69('0x44')](handleError(_0x5c2712,null));};exports[_0x9f69('0x48')]=function(_0x4e17a4,_0x4a1e9a){return db['SmsTransferReport'][_0x9f69('0x48')](_0x4e17a4[_0x9f69('0x49')],{})[_0x9f69('0x27')](respondWithResult(_0x4a1e9a,0xc9))[_0x9f69('0x44')](handleError(_0x4a1e9a,null));};exports['update']=function(_0x43ed60,_0xc00fd7){if(_0x43ed60[_0x9f69('0x49')]['id']){delete _0x43ed60['body']['id'];}return db[_0x9f69('0x2d')][_0x9f69('0x4a')]({'where':{'id':_0x43ed60[_0x9f69('0x46')]['id']}})[_0x9f69('0x27')](handleEntityNotFound(_0xc00fd7,null))['then'](saveUpdates(_0x43ed60[_0x9f69('0x49')],null))['then'](respondWithResult(_0xc00fd7,null))[_0x9f69('0x44')](handleError(_0xc00fd7,null));};exports[_0x9f69('0x28')]=function(_0x24e2a2,_0x3abc31){return db[_0x9f69('0x2d')][_0x9f69('0x4a')]({'where':{'id':_0x24e2a2[_0x9f69('0x46')]['id']}})['then'](handleEntityNotFound(_0x3abc31,null))[_0x9f69('0x27')](removeEntity(_0x3abc31,null))[_0x9f69('0x44')](handleError(_0x3abc31,null));};exports[_0x9f69('0x4b')]=function(_0x2de1db,_0x4cd1b1){return db[_0x9f69('0x2d')][_0x9f69('0x4b')]()[_0x9f69('0x27')](respondWithResult(_0x4cd1b1,null))[_0x9f69('0x44')](handleError(_0x4cd1b1,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 3ca9531..91a1af7 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 _0x0911=['exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./smsTransferReport.attributes'];(function(_0x187454,_0x69cd05){var _0x4a203a=function(_0x157324){while(--_0x157324){_0x187454['push'](_0x187454['shift']());}};_0x4a203a(++_0x69cd05);}(_0x0911,0x1a9));var _0x1091=function(_0x5da0d9,_0x49ee54){_0x5da0d9=_0x5da0d9-0x0;var _0x4b6d2f=_0x0911[_0x5da0d9];return _0x4b6d2f;};'use strict';var _=require(_0x1091('0x0'));var util=require(_0x1091('0x1'));var logger=require(_0x1091('0x2'))(_0x1091('0x3'));var moment=require(_0x1091('0x4'));var BPromise=require('bluebird');var rp=require(_0x1091('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1091('0x6'));var config=require(_0x1091('0x7'));var attributes=require(_0x1091('0x8'));module[_0x1091('0x9')]=function(_0x3e3868,_0x28747){return _0x3e3868[_0x1091('0xa')](_0x1091('0xb'),attributes,{'tableName':_0x1091('0xc'),'paranoid':![],'indexes':[{'name':_0x1091('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xfba8=['uniqueid','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','SmsTransferReport','report_sms_transfer'];(function(_0x450c47,_0x35f5c6){var _0x209d46=function(_0x285189){while(--_0x285189){_0x450c47['push'](_0x450c47['shift']());}};_0x209d46(++_0x35f5c6);}(_0xfba8,0x90));var _0x8fba=function(_0x167c13,_0x1c0d6c){_0x167c13=_0x167c13-0x0;var _0x1a91dd=_0xfba8[_0x167c13];return _0x1a91dd;};'use strict';var _=require('lodash');var util=require(_0x8fba('0x0'));var logger=require(_0x8fba('0x1'))(_0x8fba('0x2'));var moment=require(_0x8fba('0x3'));var BPromise=require(_0x8fba('0x4'));var rp=require(_0x8fba('0x5'));var fs=require('fs');var path=require(_0x8fba('0x6'));var rimraf=require(_0x8fba('0x7'));var config=require(_0x8fba('0x8'));var attributes=require('./smsTransferReport.attributes');module[_0x8fba('0x9')]=function(_0x264b22,_0x182bf2){return _0x264b22['define'](_0x8fba('0xa'),attributes,{'tableName':_0x8fba('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x8fba('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index 3751b12..a0bef61 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 _0x6c96=['SmsTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsTransferReport,\x20%s,\x20%s','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then'];(function(_0x7a8cb6,_0x5fcc8a){var _0x3d2d60=function(_0x4bb1a6){while(--_0x4bb1a6){_0x7a8cb6['push'](_0x7a8cb6['shift']());}};_0x3d2d60(++_0x5fcc8a);}(_0x6c96,0x1c1));var _0x66c9=function(_0x57bb04,_0x30ee1f){_0x57bb04=_0x57bb04-0x0;var _0x526411=_0x6c96[_0x57bb04];return _0x526411;};'use strict';var _=require(_0x66c9('0x0'));var util=require('util');var moment=require(_0x66c9('0x1'));var BPromise=require(_0x66c9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66c9('0x3'));var db=require(_0x66c9('0x4'))['db'];var utils=require(_0x66c9('0x5'));var logger=require(_0x66c9('0x6'))(_0x66c9('0x7'));var config=require(_0x66c9('0x8'));var jayson=require(_0x66c9('0x9'));var client=jayson['client'][_0x66c9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4c6baa,_0xb03819,_0x4d7692){return new BPromise(function(_0x55b488,_0xfc41a4){return client[_0x66c9('0xb')](_0x4c6baa,_0x4d7692)[_0x66c9('0xc')](function(_0x2e8ad5){logger['info']('SmsTransferReport,\x20%s,\x20%s',_0xb03819,'request\x20sent');logger['debug'](_0x66c9('0xd'),_0xb03819,_0x66c9('0xe'),JSON[_0x66c9('0xf')](_0x2e8ad5));if(_0x2e8ad5['error']){if(_0x2e8ad5[_0x66c9('0x10')][_0x66c9('0x11')]===0x1f4){logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x2e8ad5['error'][_0x66c9('0x13')]);return _0xfc41a4(_0x2e8ad5['error'][_0x66c9('0x13')]);}logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x2e8ad5[_0x66c9('0x10')]['message']);return _0x55b488(_0x2e8ad5[_0x66c9('0x10')][_0x66c9('0x13')]);}else{logger['info'](_0x66c9('0x12'),_0xb03819,_0x66c9('0xe'));_0x55b488(_0x2e8ad5[_0x66c9('0x14')][_0x66c9('0x13')]);}})[_0x66c9('0x15')](function(_0x14d989){logger[_0x66c9('0x10')](_0x66c9('0x12'),_0xb03819,_0x14d989);_0xfc41a4(_0x14d989);});});} \ No newline at end of file +var _0x57cf=['debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x1520ec,_0x41aa57){var _0x41929a=function(_0x45e9ae){while(--_0x45e9ae){_0x1520ec['push'](_0x1520ec['shift']());}};_0x41929a(++_0x41aa57);}(_0x57cf,0x11b));var _0xf57c=function(_0x28b0a4,_0x2ea758){_0x28b0a4=_0x28b0a4-0x0;var _0x105ce6=_0x57cf[_0x28b0a4];return _0x105ce6;};'use strict';var _=require(_0xf57c('0x0'));var util=require(_0xf57c('0x1'));var moment=require(_0xf57c('0x2'));var BPromise=require(_0xf57c('0x3'));var rs=require(_0xf57c('0x4'));var fs=require('fs');var Redis=require(_0xf57c('0x5'));var db=require(_0xf57c('0x6'))['db'];var utils=require(_0xf57c('0x7'));var logger=require(_0xf57c('0x8'))(_0xf57c('0x9'));var config=require('../../config/environment');var jayson=require(_0xf57c('0xa'));var client=jayson['client'][_0xf57c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5816f5,_0x53ed52,_0x21a69d){return new BPromise(function(_0x4867f6,_0x2cbb69){return client[_0xf57c('0xc')](_0x5816f5,_0x21a69d)['then'](function(_0x5b5314){logger[_0xf57c('0xd')](_0xf57c('0xe'),_0x53ed52,_0xf57c('0xf'));logger[_0xf57c('0x10')]('SmsTransferReport,\x20%s,\x20%s,\x20%s',_0x53ed52,_0xf57c('0xf'),JSON[_0xf57c('0x11')](_0x5b5314));if(_0x5b5314[_0xf57c('0x12')]){if(_0x5b5314['error'][_0xf57c('0x13')]===0x1f4){logger['error'](_0xf57c('0xe'),_0x53ed52,_0x5b5314[_0xf57c('0x12')]['message']);return _0x2cbb69(_0x5b5314[_0xf57c('0x12')]['message']);}logger[_0xf57c('0x12')]('SmsTransferReport,\x20%s,\x20%s',_0x53ed52,_0x5b5314[_0xf57c('0x12')][_0xf57c('0x14')]);return _0x4867f6(_0x5b5314[_0xf57c('0x12')][_0xf57c('0x14')]);}else{logger[_0xf57c('0xd')](_0xf57c('0xe'),_0x53ed52,_0xf57c('0xf'));_0x4867f6(_0x5b5314[_0xf57c('0x15')]['message']);}})[_0xf57c('0x16')](function(_0x524084){logger[_0xf57c('0x12')](_0xf57c('0xe'),_0x53ed52,_0x524084);_0x2cbb69(_0x524084);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index a752d28..1519370 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 _0xd541=['%s-%s%s','extname','post','/:id','update','delete','exports','util','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./sound.controller','index','show','/:id/download','download','join','root','server/files/sounds/original/','originalname','replace','format'];(function(_0x118afa,_0x4bf0c1){var _0x167d76=function(_0x2c529b){while(--_0x2c529b){_0x118afa['push'](_0x118afa['shift']());}};_0x167d76(++_0x4bf0c1);}(_0xd541,0x16f));var _0x1d54=function(_0x3e5e03,_0x2fac27){_0x3e5e03=_0x3e5e03-0x0;var _0x45279e=_0xd541[_0x3e5e03];return _0x45279e;};'use strict';var multer=require('multer');var util=require(_0x1d54('0x0'));var path=require('path');var timeout=require(_0x1d54('0x1'));var express=require(_0x1d54('0x2'));var router=express[_0x1d54('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1d54('0x4'));var config=require(_0x1d54('0x5'));var controller=require(_0x1d54('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x1d54('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x1d54('0x8')]);router['get'](_0x1d54('0x9'),auth['isAuthenticated'](),controller[_0x1d54('0xa')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3b1d77,_0x4222e7,_0x3df7dd){_0x3df7dd(null,path[_0x1d54('0xb')](config[_0x1d54('0xc')],_0x1d54('0xd')));},'filename':function(_0x3ad463,_0x4e44f8,_0x3520a6){_0x4e44f8[_0x1d54('0xe')]=_0x4e44f8[_0x1d54('0xe')][_0x1d54('0xf')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x3520a6(null,util[_0x1d54('0x10')](_0x1d54('0x11'),path['basename'](_0x4e44f8[_0x1d54('0xe')],path[_0x1d54('0x12')](_0x4e44f8[_0x1d54('0xe')])),Date['now'](),path[_0x1d54('0x12')](_0x4e44f8['originalname'])));}})});router[_0x1d54('0x13')]('/',upload['single']('file'),controller['create']);router['put'](_0x1d54('0x14'),auth['isAuthenticated'](),controller[_0x1d54('0x15')]);router[_0x1d54('0x16')](_0x1d54('0x14'),auth['isAuthenticated'](),controller['delete']);module[_0x1d54('0x17')]=router; \ No newline at end of file +var _0x670b=['fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','/:id/download','download','diskStorage','root','server/files/sounds/original/','originalname','replace','format','basename','now','extname','create','put','update','delete','exports','multer','util','path','connect-timeout','Router'];(function(_0x491cb8,_0xbbc144){var _0x2f05c5=function(_0x1fa0db){while(--_0x1fa0db){_0x491cb8['push'](_0x491cb8['shift']());}};_0x2f05c5(++_0xbbc144);}(_0x670b,0xf7));var _0xb670=function(_0x1aa21b,_0x3806b1){_0x1aa21b=_0x1aa21b-0x0;var _0x5838d9=_0x670b[_0x1aa21b];return _0x5838d9;};'use strict';var multer=require(_0xb670('0x0'));var util=require(_0xb670('0x1'));var path=require(_0xb670('0x2'));var timeout=require(_0xb670('0x3'));var express=require('express');var router=express[_0xb670('0x4')]();var fs_extra=require(_0xb670('0x5'));var auth=require(_0xb670('0x6'));var interaction=require(_0xb670('0x7'));var config=require('../../config/environment');var controller=require('./sound.controller');router[_0xb670('0x8')]('/',auth[_0xb670('0x9')](),controller['index']);router[_0xb670('0x8')](_0xb670('0xa'),auth['isAuthenticated'](),controller[_0xb670('0xb')]);router[_0xb670('0x8')](_0xb670('0xc'),auth[_0xb670('0x9')](),controller[_0xb670('0xd')]);var upload=multer({'storage':multer[_0xb670('0xe')]({'destination':function(_0x1d982f,_0x5484e7,_0x2217c5){_0x2217c5(null,path['join'](config[_0xb670('0xf')],_0xb670('0x10')));},'filename':function(_0x449f2c,_0x588981,_0x9f211d){_0x588981[_0xb670('0x11')]=_0x588981[_0xb670('0x11')][_0xb670('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x9f211d(null,util[_0xb670('0x13')]('%s-%s%s',path[_0xb670('0x14')](_0x588981[_0xb670('0x11')],path['extname'](_0x588981['originalname'])),Date[_0xb670('0x15')](),path[_0xb670('0x16')](_0x588981[_0xb670('0x11')])));}})});router['post']('/',upload['single']('file'),controller[_0xb670('0x17')]);router[_0xb670('0x18')]('/:id',auth['isAuthenticated'](),controller[_0xb670('0x19')]);router[_0xb670('0x1a')](_0xb670('0xa'),auth[_0xb670('0x9')](),controller['delete']);module[_0xb670('0x1b')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index c743045..07c24fe 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 _0xd2af=['INTEGER','BIGINT','FLOAT','sequelize','exports','name','STRING'];(function(_0x1925df,_0xbd3e63){var _0x2f4e05=function(_0x4ffc0b){while(--_0x4ffc0b){_0x1925df['push'](_0x1925df['shift']());}};_0x2f4e05(++_0xbd3e63);}(_0xd2af,0xea));var _0xfd2a=function(_0x2070da,_0x45e586){_0x2070da=_0x2070da-0x0;var _0x4f9fe1=_0xd2af[_0x2070da];return _0x4f9fe1;};'use strict';var Sequelize=require(_0xfd2a('0x0'));module[_0xfd2a('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfd2a('0x2'),'allowNull':![]},'save_name':{'type':Sequelize[_0xfd2a('0x3')]},'display_name':{'type':Sequelize[_0xfd2a('0x3')],'defaultValue':''},'description':{'type':Sequelize[_0xfd2a('0x3')]},'original_format':{'type':Sequelize[_0xfd2a('0x3')]},'original_duration':{'type':Sequelize['FLOAT']},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0xfd2a('0x4')]},'original_bitRate':{'type':Sequelize[_0xfd2a('0x5')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0xfd2a('0x3')]},'converted_duration':{'type':Sequelize[_0xfd2a('0x6')]},'converted_sampleCount':{'type':Sequelize[_0xfd2a('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0xfd2a('0x5')]},'converted_sampleRate':{'type':Sequelize[_0xfd2a('0x4')]}}; \ No newline at end of file +var _0xe3d7=['exports','STRING','name','FLOAT','BIGINT','INTEGER'];(function(_0x2baeee,_0x314a80){var _0x2b325d=function(_0x3d54c3){while(--_0x3d54c3){_0x2baeee['push'](_0x2baeee['shift']());}};_0x2b325d(++_0x314a80);}(_0xe3d7,0x7e));var _0x7e3d=function(_0x191ee1,_0xee1313){_0x191ee1=_0x191ee1-0x0;var _0x3e73ce=_0xe3d7[_0x191ee1];return _0x3e73ce;};'use strict';var Sequelize=require('sequelize');module[_0x7e3d('0x0')]={'name':{'type':Sequelize[_0x7e3d('0x1')],'unique':_0x7e3d('0x2'),'allowNull':![]},'save_name':{'type':Sequelize['STRING']},'display_name':{'type':Sequelize[_0x7e3d('0x1')],'defaultValue':''},'description':{'type':Sequelize[_0x7e3d('0x1')]},'original_format':{'type':Sequelize[_0x7e3d('0x1')]},'original_duration':{'type':Sequelize[_0x7e3d('0x3')]},'original_sampleCount':{'type':Sequelize[_0x7e3d('0x4')]},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize[_0x7e3d('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x7e3d('0x1')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize['BIGINT']},'converted_channelCount':{'type':Sequelize[_0x7e3d('0x5')]},'converted_bitRate':{'type':Sequelize[_0x7e3d('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x7e3d('0x5')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index 6467b90..46ee638 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 _0x8c83=['get','UserProfileSection','Sounds','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','description','delete','original_format','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','UserProfileResource','destroy','error','stack','name','send','index','map','Sound','rawAttributes','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','findAll','rows','catch','show','params','keys','include','find','converted_format','existsSync','join','server/files/sounds/converted','save_name','ValidationError','Sound\x20not\x20found','download','root','format','%s.%s','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','unlinkSync','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_channelCount','converted_bitRate','bitRate','0777','body','role','Unable\x20to\x20retrieve\x20the\x20current\x20user','user'];(function(_0x24398d,_0x5beba5){var _0x1e6116=function(_0xafbf06){while(--_0xafbf06){_0x24398d['push'](_0x24398d['shift']());}};_0x1e6116(++_0x5beba5);}(_0x8c83,0x8a));var _0x38c8=function(_0x1850a9,_0x597765){_0x1850a9=_0x1850a9-0x0;var _0x90c49c=_0x8c83[_0x1850a9];return _0x90c49c;};'use strict';var emlformat=require(_0x38c8('0x0'));var rimraf=require(_0x38c8('0x1'));var zipdir=require(_0x38c8('0x2'));var jsonpatch=require(_0x38c8('0x3'));var rp=require('request-promise');var moment=require(_0x38c8('0x4'));var BPromise=require(_0x38c8('0x5'));var Mustache=require(_0x38c8('0x6'));var util=require(_0x38c8('0x7'));var path=require(_0x38c8('0x8'));var sox=require(_0x38c8('0x9'));var csv=require('to-csv');var ejs=require(_0x38c8('0xa'));var fs=require('fs');var fs_extra=require(_0x38c8('0xb'));var _=require(_0x38c8('0xc'));var squel=require(_0x38c8('0xd'));var crypto=require(_0x38c8('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x38c8('0xf'));var querystring=require(_0x38c8('0x10'));var Papa=require('papaparse');var Redis=require(_0x38c8('0x11'));var authService=require(_0x38c8('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x38c8('0x13'));var hardwareService=require(_0x38c8('0x14'));var logger=require(_0x38c8('0x15'))(_0x38c8('0x16'));var utils=require(_0x38c8('0x17'));var config=require(_0x38c8('0x18'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f3936,_0x8985f3){_0x8985f3=_0x8985f3||0xcc;return function(_0x5eb3cc){if(_0x5eb3cc){return _0x5f3936[_0x38c8('0x19')](_0x8985f3);}return _0x5f3936[_0x38c8('0x1a')](_0x8985f3)[_0x38c8('0x1b')]();};}function respondWithResult(_0x393a9d,_0x3f1f7f){_0x3f1f7f=_0x3f1f7f||0xc8;return function(_0x137844){if(_0x137844){return _0x393a9d[_0x38c8('0x1a')](_0x3f1f7f)[_0x38c8('0x1c')](_0x137844);}};}function respondWithFilteredResult(_0x344f82,_0x2467b8){return function(_0x36520b){if(_0x36520b){var _0x1ee05f=typeof _0x2467b8[_0x38c8('0x1d')]===_0x38c8('0x1e')&&typeof _0x2467b8['limit']===_0x38c8('0x1e');var _0x24a9cf=_0x36520b[_0x38c8('0x1f')];var _0xe2dc15=_0x1ee05f?0x0:_0x2467b8[_0x38c8('0x1d')];var _0x7442d=_0x1ee05f?_0x36520b['count']:_0x2467b8[_0x38c8('0x1d')]+_0x2467b8[_0x38c8('0x20')];var _0x3f75bb;if(_0x7442d>=_0x24a9cf){_0x7442d=_0x24a9cf;_0x3f75bb=0xc8;}else{_0x3f75bb=0xce;}_0x344f82['status'](_0x3f75bb);return _0x344f82[_0x38c8('0x21')](_0x38c8('0x22'),_0xe2dc15+'-'+_0x7442d+'/'+_0x24a9cf)[_0x38c8('0x1c')](_0x36520b);}return null;};}function patchUpdates(_0x2bd1a9){return function(_0x3ae85a){try{jsonpatch[_0x38c8('0x23')](_0x3ae85a,_0x2bd1a9,!![]);}catch(_0x33ff5c){return BPromise[_0x38c8('0x24')](_0x33ff5c);}return _0x3ae85a[_0x38c8('0x25')]();};}function saveUpdates(_0x194d43,_0x5f3954){return function(_0x4c8d5f){if(_0x4c8d5f){return _0x4c8d5f[_0x38c8('0x26')](_0x194d43)[_0x38c8('0x27')](function(_0x2bb145){return _0x2bb145;});}return null;};}function removeEntity(_0x527b0b,_0x29b325){return function(_0x3d945b){if(_0x3d945b){return _0x3d945b['destroy']()[_0x38c8('0x27')](function(){var _0x19a99f=_0x3d945b['get']({'plain':!![]});var _0x15fa13='Sounds';return db[_0x38c8('0x28')][_0x38c8('0x29')]({'where':{'type':_0x15fa13,'resourceId':_0x19a99f['id']}})['then'](function(){return _0x3d945b;});})[_0x38c8('0x27')](function(){_0x527b0b[_0x38c8('0x1a')](0xcc)[_0x38c8('0x1b')]();});}};}function handleEntityNotFound(_0x5bf57c,_0x39c276){return function(_0x3d378d){if(!_0x3d378d){_0x5bf57c[_0x38c8('0x19')](0x194);}return _0x3d378d;};}function handleError(_0x27787b,_0x4a7a36){_0x4a7a36=_0x4a7a36||0x1f4;return function(_0xd79f67){logger[_0x38c8('0x2a')](_0xd79f67[_0x38c8('0x2b')]);if(_0xd79f67[_0x38c8('0x2c')]){delete _0xd79f67['name'];}_0x27787b[_0x38c8('0x1a')](_0x4a7a36)[_0x38c8('0x2d')](_0xd79f67);};}exports[_0x38c8('0x2e')]=function(_0x4fdaff,_0x4a6619){var _0x576f90={},_0x3f0a88={},_0x2b0f16={'count':0x0,'rows':[]};var _0x6679b3=_[_0x38c8('0x2f')](db[_0x38c8('0x30')][_0x38c8('0x31')],function(_0xf4d3c6){return{'name':_0xf4d3c6['fieldName'],'type':_0xf4d3c6[_0x38c8('0x32')][_0x38c8('0x33')]};});_0x3f0a88[_0x38c8('0x34')]=_[_0x38c8('0x2f')](_0x6679b3,_0x38c8('0x2c'));_0x3f0a88[_0x38c8('0x35')]=_['keys'](_0x4fdaff[_0x38c8('0x35')]);_0x3f0a88[_0x38c8('0x36')]=_[_0x38c8('0x37')](_0x3f0a88[_0x38c8('0x34')],_0x3f0a88[_0x38c8('0x35')]);_0x576f90[_0x38c8('0x38')]=_[_0x38c8('0x37')](_0x3f0a88[_0x38c8('0x34')],qs[_0x38c8('0x39')](_0x4fdaff[_0x38c8('0x35')][_0x38c8('0x39')]));_0x576f90[_0x38c8('0x38')]=_0x576f90[_0x38c8('0x38')]['length']?_0x576f90[_0x38c8('0x38')]:_0x3f0a88[_0x38c8('0x34')];if(!_0x4fdaff['query'][_0x38c8('0x3a')](_0x38c8('0x3b'))){_0x576f90[_0x38c8('0x20')]=qs[_0x38c8('0x20')](_0x4fdaff['query'][_0x38c8('0x20')]);_0x576f90[_0x38c8('0x1d')]=qs['offset'](_0x4fdaff[_0x38c8('0x35')]['offset']);}_0x576f90[_0x38c8('0x3c')]=qs[_0x38c8('0x3d')](_0x4fdaff[_0x38c8('0x35')][_0x38c8('0x3d')]);_0x576f90[_0x38c8('0x3e')]=qs['filters'](_[_0x38c8('0x3f')](_0x4fdaff[_0x38c8('0x35')],_0x3f0a88[_0x38c8('0x36')]),_0x6679b3);if(_0x4fdaff['query']['filter']){_0x576f90['where']=_['merge'](_0x576f90[_0x38c8('0x3e')],{'$or':_[_0x38c8('0x2f')](_0x6679b3,function(_0x552c2f){if(_0x552c2f[_0x38c8('0x32')]!=='VIRTUAL'){var _0x175679={};_0x175679[_0x552c2f['name']]={'$like':'%'+_0x4fdaff[_0x38c8('0x35')][_0x38c8('0x40')]+'%'};return _0x175679;}})});}_0x576f90=_[_0x38c8('0x41')]({},_0x576f90,_0x4fdaff[_0x38c8('0x42')]);var _0x2e1c79={'where':_0x576f90[_0x38c8('0x3e')]};return db[_0x38c8('0x30')][_0x38c8('0x1f')](_0x2e1c79)[_0x38c8('0x27')](function(_0xbb0cea){_0x2b0f16['count']=_0xbb0cea;if(_0x4fdaff['query'][_0x38c8('0x43')]){_0x576f90['include']=[{'all':!![]}];}return db[_0x38c8('0x30')][_0x38c8('0x44')](_0x576f90);})['then'](function(_0xd26825){_0x2b0f16[_0x38c8('0x45')]=_0xd26825;return _0x2b0f16;})[_0x38c8('0x27')](respondWithFilteredResult(_0x4a6619,_0x576f90))[_0x38c8('0x46')](handleError(_0x4a6619,null));};exports[_0x38c8('0x47')]=function(_0x4e6ea9,_0x1657ce){var _0x3e03e1={'raw':!![],'where':{'id':_0x4e6ea9[_0x38c8('0x48')]['id']}},_0x35d431={};_0x35d431['model']=_[_0x38c8('0x49')](db['Sound'][_0x38c8('0x31')]);_0x35d431[_0x38c8('0x35')]=_[_0x38c8('0x49')](_0x4e6ea9['query']);_0x35d431['filters']=_[_0x38c8('0x37')](_0x35d431[_0x38c8('0x34')],_0x35d431[_0x38c8('0x35')]);_0x3e03e1[_0x38c8('0x38')]=_[_0x38c8('0x37')](_0x35d431['model'],qs[_0x38c8('0x39')](_0x4e6ea9[_0x38c8('0x35')][_0x38c8('0x39')]));_0x3e03e1[_0x38c8('0x38')]=_0x3e03e1[_0x38c8('0x38')]['length']?_0x3e03e1[_0x38c8('0x38')]:_0x35d431[_0x38c8('0x34')];if(_0x4e6ea9[_0x38c8('0x35')][_0x38c8('0x43')]){_0x3e03e1[_0x38c8('0x4a')]=[{'all':!![]}];}_0x3e03e1=_['merge']({},_0x3e03e1,_0x4e6ea9[_0x38c8('0x42')]);return db['Sound'][_0x38c8('0x4b')](_0x3e03e1)['then'](handleEntityNotFound(_0x1657ce,null))[_0x38c8('0x27')](respondWithResult(_0x1657ce,null))[_0x38c8('0x46')](handleError(_0x1657ce,null));};exports['download']=function(_0x4ea413,_0x8b4ab5,_0x5d907d){return db[_0x38c8('0x30')][_0x38c8('0x4b')]({'where':{'id':_0x4ea413['params']['id']},'attributes':[_0x38c8('0x2c'),'save_name',_0x38c8('0x4c')],'raw':!![]})[_0x38c8('0x27')](handleEntityNotFound(_0x8b4ab5,null))[_0x38c8('0x27')](function(_0x15cfbc){if(_0x15cfbc){if(!fs[_0x38c8('0x4d')](path[_0x38c8('0x4e')](config['root'],_0x38c8('0x4f'),_0x15cfbc[_0x38c8('0x50')]+'.'+_0x15cfbc[_0x38c8('0x4c')]))){throw new db['Sequelize'][(_0x38c8('0x51'))](_0x38c8('0x52'));}return _0x8b4ab5[_0x38c8('0x53')](path[_0x38c8('0x4e')](config[_0x38c8('0x54')],'server/files/sounds/converted',util[_0x38c8('0x55')]('%s.%s',_0x15cfbc['save_name'],_0x15cfbc[_0x38c8('0x4c')])),util[_0x38c8('0x55')](_0x38c8('0x56'),_0x15cfbc[_0x38c8('0x2c')],_0x15cfbc['converted_format']));}return null;})['catch'](handleError(_0x8b4ab5,null));};exports['create']=function(_0x46c110,_0x252903,_0x5bbd16){var _0x1028bc={'name':path[_0x38c8('0x57')](_0x46c110[_0x38c8('0x58')][_0x38c8('0x59')],path[_0x38c8('0x5a')](_0x46c110['file']['originalname'])),'save_name':path[_0x38c8('0x57')](_0x46c110[_0x38c8('0x58')]['filename'],path['extname'](_0x46c110[_0x38c8('0x58')][_0x38c8('0x5b')])),'original_format':path[_0x38c8('0x5a')](_0x46c110[_0x38c8('0x58')][_0x38c8('0x59')])[_0x38c8('0x5c')](0x1),'converted_format':_0x38c8('0x5d')};var _0x159718=path[_0x38c8('0x4e')](config[_0x38c8('0x54')],_0x38c8('0x5e'),_0x46c110[_0x38c8('0x58')][_0x38c8('0x5b')]);var _0x28ea42=path[_0x38c8('0x4e')](config[_0x38c8('0x54')],_0x38c8('0x4f'),util[_0x38c8('0x55')]('%s.%s',path[_0x38c8('0x57')](_0x46c110[_0x38c8('0x58')][_0x38c8('0x5b')],path[_0x38c8('0x5a')](_0x46c110[_0x38c8('0x58')]['filename'])),_0x1028bc['converted_format']));logger[_0x38c8('0x5f')](_0x38c8('0x60'),_0x159718);logger['info'](_0x38c8('0x61'),_0x28ea42);try{fs[_0x38c8('0x62')](_0x159718,parseInt('0777',0x8));var _0x22f18d=sox[_0x38c8('0x63')](_0x159718,_0x28ea42,{'sampleRate':0x1f40,'format':_0x38c8('0x5d'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x22f18d['on'](_0x38c8('0x2a'),function(_0x507db5){fs[_0x38c8('0x64')](_0x159718);_0x252903[_0x38c8('0x1a')](0x1f4)['send'](_0x507db5);});_0x22f18d['on']('src',function(_0x2e5dea){_0x1028bc[_0x38c8('0x65')]=isNaN(_0x2e5dea[_0x38c8('0x66')])?null:_0x2e5dea[_0x38c8('0x66')]*0x3e8;_0x1028bc[_0x38c8('0x67')]=isNaN(_0x2e5dea[_0x38c8('0x68')])?null:_0x2e5dea[_0x38c8('0x68')];_0x1028bc[_0x38c8('0x69')]=isNaN(_0x2e5dea[_0x38c8('0x6a')])?null:_0x2e5dea[_0x38c8('0x6a')];_0x1028bc[_0x38c8('0x6b')]=isNaN(_0x2e5dea['bitRate'])?null:_0x2e5dea['bitRate'];_0x1028bc[_0x38c8('0x6c')]=isNaN(_0x2e5dea[_0x38c8('0x6d')])?null:_0x2e5dea['sampleRate'];});_0x22f18d['on'](_0x38c8('0x6e'),function(_0x1ebdf6){_0x1028bc[_0x38c8('0x6f')]=isNaN(_0x1ebdf6[_0x38c8('0x66')])?null:_0x1ebdf6[_0x38c8('0x66')]*0x3e8;_0x1028bc['converted_sampleCount']=isNaN(_0x1ebdf6[_0x38c8('0x68')])?null:_0x1ebdf6['sampleCount'];_0x1028bc[_0x38c8('0x70')]=isNaN(_0x1ebdf6[_0x38c8('0x6a')])?null:_0x1ebdf6[_0x38c8('0x6a')];_0x1028bc[_0x38c8('0x71')]=isNaN(_0x1ebdf6['bitRate'])?null:_0x1ebdf6[_0x38c8('0x72')];_0x1028bc['converted_sampleRate']=isNaN(_0x1ebdf6['sampleRate'])?null:_0x1ebdf6[_0x38c8('0x6d')];});_0x22f18d['on']('end',function(){fs[_0x38c8('0x62')](_0x28ea42,parseInt(_0x38c8('0x73'),0x8));return db['Sound']['create'](_0x1028bc)[_0x38c8('0x27')](function(_0x355342){var _0x1b7f3a={'role':_0x46c110[_0x38c8('0x74')][_0x38c8('0x75')],'userProfileId':_0x46c110[_0x38c8('0x74')]['userProfileId']};if(!_0x1b7f3a)throw new Error(_0x38c8('0x76'));if(_0x1b7f3a['role']===_0x38c8('0x77')){var _0x3645be=_0x355342[_0x38c8('0x78')]({'plain':!![]});return db[_0x38c8('0x79')][_0x38c8('0x4b')]({'where':{'name':_0x38c8('0x7a'),'userProfileId':_0x1b7f3a[_0x38c8('0x7b')]},'raw':!![]})['then'](function(_0x5e103b){if(_0x5e103b&&_0x5e103b['autoAssociation']===0x0){return db[_0x38c8('0x28')]['create']({'name':_0x3645be[_0x38c8('0x2c')],'resourceId':_0x3645be['id'],'type':_0x5e103b[_0x38c8('0x2c')],'sectionId':_0x5e103b['id']},{})[_0x38c8('0x27')](function(){return _0x355342;});}else{return _0x355342;}})[_0x38c8('0x46')](function(_0x471d96){logger[_0x38c8('0x2a')](_0x38c8('0x7c'),_0x471d96);throw _0x471d96;});}return _0x355342;})['then'](respondWithResult(_0x252903,null))[_0x38c8('0x46')](handleError(_0x252903,null));});_0x22f18d[_0x38c8('0x7d')]();}catch(_0x5bf929){_0x252903[_0x38c8('0x1a')](0x1f4)[_0x38c8('0x2d')](_0x5bf929);}};exports['update']=function(_0x483f7d,_0x2cf926,_0x4b949a){return db[_0x38c8('0x30')][_0x38c8('0x4b')]({'where':{'id':_0x483f7d['params']['id']}})[_0x38c8('0x27')](handleEntityNotFound(_0x2cf926,null))[_0x38c8('0x27')](saveUpdates(_['pick'](_0x483f7d[_0x38c8('0x74')],['name',_0x38c8('0x7e')]),null))[_0x38c8('0x27')](respondWithResult(_0x2cf926,null))[_0x38c8('0x46')](handleError(_0x2cf926,null));};exports[_0x38c8('0x7f')]=function(_0x2a2529,_0x39503e,_0x155626){return db['Sound'][_0x38c8('0x4b')]({'where':{'id':_0x2a2529[_0x38c8('0x48')]['id']}})[_0x38c8('0x27')](function(_0x3a744e){if(_0x3a744e){return _0x3a744e[_0x38c8('0x29')]();}})[_0x38c8('0x27')](function(_0x11baba){var _0x207a26=path[_0x38c8('0x4e')](config['root'],_0x38c8('0x5e'),util['format'](_0x38c8('0x56'),_0x11baba[_0x38c8('0x50')],_0x11baba[_0x38c8('0x80')]));var _0x309a6d=path[_0x38c8('0x4e')](config[_0x38c8('0x54')],_0x38c8('0x4f'),util['format'](_0x38c8('0x56'),_0x11baba[_0x38c8('0x50')],_0x11baba[_0x38c8('0x4c')]));fs[_0x38c8('0x64')](_0x207a26);fs['unlinkSync'](_0x309a6d);return _0x11baba;})['then'](function(_0x1be883){if(_0x1be883){return _0x39503e['status'](0xcc)[_0x38c8('0x1b')]();}})[_0x38c8('0x27')](handleEntityNotFound(_0x39503e,null))[_0x38c8('0x46')](handleError(_0x39503e,null));}; \ No newline at end of file +var _0xc8ab=['includeAll','find','download','save_name','converted_format','existsSync','join','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','root','format','%s.%s','create','basename','file','originalname','extname','filename','substring','wav','server/files/sounds/original','info','Sound\x20upload\x20destination:\x20%s','chmodSync','transcode','error','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','0777','role','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','pick','description','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash','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','../../mysqldb','sendStatus','status','end','json','limit','count','offset','set','apply','save','update','then','get','Sounds','UserProfileResource','destroy','stack','name','send','index','Sound','rawAttributes','fieldName','type','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','include','findAll','catch','show','params'];(function(_0x541570,_0x20b8e9){var _0x2ce39e=function(_0x264d5d){while(--_0x264d5d){_0x541570['push'](_0x541570['shift']());}};_0x2ce39e(++_0x20b8e9);}(_0xc8ab,0x1a5));var _0xbc8a=function(_0x2900bf,_0x396900){_0x2900bf=_0x2900bf-0x0;var _0x4ff896=_0xc8ab[_0x2900bf];return _0x4ff896;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbc8a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xbc8a('0x1'));var rp=require(_0xbc8a('0x2'));var moment=require(_0xbc8a('0x3'));var BPromise=require(_0xbc8a('0x4'));var Mustache=require(_0xbc8a('0x5'));var util=require(_0xbc8a('0x6'));var path=require(_0xbc8a('0x7'));var sox=require(_0xbc8a('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbc8a('0x9'));var _=require(_0xbc8a('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xbc8a('0xb'));var deskjs=require(_0xbc8a('0xc'));var toCsv=require(_0xbc8a('0xd'));var querystring=require(_0xbc8a('0xe'));var Papa=require('papaparse');var Redis=require(_0xbc8a('0xf'));var authService=require(_0xbc8a('0x10'));var qs=require(_0xbc8a('0x11'));var as=require(_0xbc8a('0x12'));var hardwareService=require(_0xbc8a('0x13'));var logger=require(_0xbc8a('0x14'))(_0xbc8a('0x15'));var utils=require(_0xbc8a('0x16'));var config=require(_0xbc8a('0x17'));var licenseUtil=require(_0xbc8a('0x18'));var db=require(_0xbc8a('0x19'))['db'];function respondWithStatusCode(_0x5a6416,_0x46a4d3){_0x46a4d3=_0x46a4d3||0xcc;return function(_0x23c365){if(_0x23c365){return _0x5a6416[_0xbc8a('0x1a')](_0x46a4d3);}return _0x5a6416[_0xbc8a('0x1b')](_0x46a4d3)[_0xbc8a('0x1c')]();};}function respondWithResult(_0x48b5c7,_0x25e758){_0x25e758=_0x25e758||0xc8;return function(_0x9f8376){if(_0x9f8376){return _0x48b5c7['status'](_0x25e758)[_0xbc8a('0x1d')](_0x9f8376);}};}function respondWithFilteredResult(_0x4c7998,_0x56914d){return function(_0x46100d){if(_0x46100d){var _0xd37da4=typeof _0x56914d['offset']==='undefined'&&typeof _0x56914d[_0xbc8a('0x1e')]==='undefined';var _0x4937f3=_0x46100d[_0xbc8a('0x1f')];var _0x3f20cb=_0xd37da4?0x0:_0x56914d[_0xbc8a('0x20')];var _0x323e31=_0xd37da4?_0x46100d[_0xbc8a('0x1f')]:_0x56914d[_0xbc8a('0x20')]+_0x56914d[_0xbc8a('0x1e')];var _0x4b7d08;if(_0x323e31>=_0x4937f3){_0x323e31=_0x4937f3;_0x4b7d08=0xc8;}else{_0x4b7d08=0xce;}_0x4c7998[_0xbc8a('0x1b')](_0x4b7d08);return _0x4c7998[_0xbc8a('0x21')]('Content-Range',_0x3f20cb+'-'+_0x323e31+'/'+_0x4937f3)[_0xbc8a('0x1d')](_0x46100d);}return null;};}function patchUpdates(_0x5c0f1d){return function(_0x2f748e){try{jsonpatch[_0xbc8a('0x22')](_0x2f748e,_0x5c0f1d,!![]);}catch(_0x5b4573){return BPromise['reject'](_0x5b4573);}return _0x2f748e[_0xbc8a('0x23')]();};}function saveUpdates(_0x286189,_0x1f9f29){return function(_0x1b174b){if(_0x1b174b){return _0x1b174b[_0xbc8a('0x24')](_0x286189)[_0xbc8a('0x25')](function(_0x1acbdb){return _0x1acbdb;});}return null;};}function removeEntity(_0x538372,_0x1ee435){return function(_0x4a0c5a){if(_0x4a0c5a){return _0x4a0c5a['destroy']()[_0xbc8a('0x25')](function(){var _0x2bea66=_0x4a0c5a[_0xbc8a('0x26')]({'plain':!![]});var _0xcd6f34=_0xbc8a('0x27');return db[_0xbc8a('0x28')][_0xbc8a('0x29')]({'where':{'type':_0xcd6f34,'resourceId':_0x2bea66['id']}})[_0xbc8a('0x25')](function(){return _0x4a0c5a;});})[_0xbc8a('0x25')](function(){_0x538372[_0xbc8a('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x7455eb,_0x345ee4){return function(_0x2ebd54){if(!_0x2ebd54){_0x7455eb[_0xbc8a('0x1a')](0x194);}return _0x2ebd54;};}function handleError(_0x5079cf,_0x52b142){_0x52b142=_0x52b142||0x1f4;return function(_0x4dac05){logger['error'](_0x4dac05[_0xbc8a('0x2a')]);if(_0x4dac05[_0xbc8a('0x2b')]){delete _0x4dac05[_0xbc8a('0x2b')];}_0x5079cf[_0xbc8a('0x1b')](_0x52b142)[_0xbc8a('0x2c')](_0x4dac05);};}exports[_0xbc8a('0x2d')]=function(_0x42dfca,_0x548b79){var _0x7076b0={},_0x3b4a66={},_0x4941e5={'count':0x0,'rows':[]};var _0x462c78=_['map'](db[_0xbc8a('0x2e')][_0xbc8a('0x2f')],function(_0x454623){return{'name':_0x454623[_0xbc8a('0x30')],'type':_0x454623[_0xbc8a('0x31')]['key']};});_0x3b4a66[_0xbc8a('0x32')]=_['map'](_0x462c78,_0xbc8a('0x2b'));_0x3b4a66['query']=_[_0xbc8a('0x33')](_0x42dfca[_0xbc8a('0x34')]);_0x3b4a66['filters']=_[_0xbc8a('0x35')](_0x3b4a66[_0xbc8a('0x32')],_0x3b4a66[_0xbc8a('0x34')]);_0x7076b0[_0xbc8a('0x36')]=_['intersection'](_0x3b4a66['model'],qs['fields'](_0x42dfca['query'][_0xbc8a('0x37')]));_0x7076b0[_0xbc8a('0x36')]=_0x7076b0[_0xbc8a('0x36')][_0xbc8a('0x38')]?_0x7076b0[_0xbc8a('0x36')]:_0x3b4a66[_0xbc8a('0x32')];if(!_0x42dfca['query'][_0xbc8a('0x39')](_0xbc8a('0x3a'))){_0x7076b0['limit']=qs['limit'](_0x42dfca[_0xbc8a('0x34')][_0xbc8a('0x1e')]);_0x7076b0[_0xbc8a('0x20')]=qs['offset'](_0x42dfca[_0xbc8a('0x34')][_0xbc8a('0x20')]);}_0x7076b0[_0xbc8a('0x3b')]=qs['sort'](_0x42dfca[_0xbc8a('0x34')][_0xbc8a('0x3c')]);_0x7076b0[_0xbc8a('0x3d')]=qs[_0xbc8a('0x3e')](_['pick'](_0x42dfca[_0xbc8a('0x34')],_0x3b4a66[_0xbc8a('0x3e')]),_0x462c78);if(_0x42dfca[_0xbc8a('0x34')][_0xbc8a('0x3f')]){_0x7076b0['where']=_[_0xbc8a('0x40')](_0x7076b0[_0xbc8a('0x3d')],{'$or':_['map'](_0x462c78,function(_0x460fa7){if(_0x460fa7[_0xbc8a('0x31')]!=='VIRTUAL'){var _0xcb14a8={};_0xcb14a8[_0x460fa7[_0xbc8a('0x2b')]]={'$like':'%'+_0x42dfca['query']['filter']+'%'};return _0xcb14a8;}})});}_0x7076b0=_['merge']({},_0x7076b0,_0x42dfca[_0xbc8a('0x41')]);var _0x43232a={'where':_0x7076b0['where']};return db['Sound']['count'](_0x43232a)[_0xbc8a('0x25')](function(_0xfe26c2){_0x4941e5[_0xbc8a('0x1f')]=_0xfe26c2;if(_0x42dfca[_0xbc8a('0x34')]['includeAll']){_0x7076b0[_0xbc8a('0x42')]=[{'all':!![]}];}return db[_0xbc8a('0x2e')][_0xbc8a('0x43')](_0x7076b0);})[_0xbc8a('0x25')](function(_0xab8016){_0x4941e5['rows']=_0xab8016;return _0x4941e5;})[_0xbc8a('0x25')](respondWithFilteredResult(_0x548b79,_0x7076b0))[_0xbc8a('0x44')](handleError(_0x548b79,null));};exports[_0xbc8a('0x45')]=function(_0x144cff,_0x4ef155){var _0x255865={'raw':!![],'where':{'id':_0x144cff[_0xbc8a('0x46')]['id']}},_0x43d81c={};_0x43d81c[_0xbc8a('0x32')]=_[_0xbc8a('0x33')](db[_0xbc8a('0x2e')][_0xbc8a('0x2f')]);_0x43d81c[_0xbc8a('0x34')]=_[_0xbc8a('0x33')](_0x144cff['query']);_0x43d81c[_0xbc8a('0x3e')]=_[_0xbc8a('0x35')](_0x43d81c[_0xbc8a('0x32')],_0x43d81c[_0xbc8a('0x34')]);_0x255865['attributes']=_[_0xbc8a('0x35')](_0x43d81c['model'],qs[_0xbc8a('0x37')](_0x144cff[_0xbc8a('0x34')]['fields']));_0x255865[_0xbc8a('0x36')]=_0x255865[_0xbc8a('0x36')][_0xbc8a('0x38')]?_0x255865[_0xbc8a('0x36')]:_0x43d81c[_0xbc8a('0x32')];if(_0x144cff[_0xbc8a('0x34')][_0xbc8a('0x47')]){_0x255865['include']=[{'all':!![]}];}_0x255865=_['merge']({},_0x255865,_0x144cff['options']);return db[_0xbc8a('0x2e')][_0xbc8a('0x48')](_0x255865)[_0xbc8a('0x25')](handleEntityNotFound(_0x4ef155,null))[_0xbc8a('0x25')](respondWithResult(_0x4ef155,null))['catch'](handleError(_0x4ef155,null));};exports[_0xbc8a('0x49')]=function(_0x256aa5,_0x6ca832,_0x42d317){return db[_0xbc8a('0x2e')][_0xbc8a('0x48')]({'where':{'id':_0x256aa5[_0xbc8a('0x46')]['id']},'attributes':[_0xbc8a('0x2b'),_0xbc8a('0x4a'),_0xbc8a('0x4b')],'raw':!![]})[_0xbc8a('0x25')](handleEntityNotFound(_0x6ca832,null))[_0xbc8a('0x25')](function(_0x4cb126){if(_0x4cb126){if(!fs[_0xbc8a('0x4c')](path[_0xbc8a('0x4d')](config['root'],_0xbc8a('0x4e'),_0x4cb126['save_name']+'.'+_0x4cb126[_0xbc8a('0x4b')]))){throw new db['Sequelize'][(_0xbc8a('0x4f'))](_0xbc8a('0x50'));}return _0x6ca832[_0xbc8a('0x49')](path[_0xbc8a('0x4d')](config[_0xbc8a('0x51')],_0xbc8a('0x4e'),util[_0xbc8a('0x52')](_0xbc8a('0x53'),_0x4cb126[_0xbc8a('0x4a')],_0x4cb126[_0xbc8a('0x4b')])),util[_0xbc8a('0x52')](_0xbc8a('0x53'),_0x4cb126[_0xbc8a('0x2b')],_0x4cb126['converted_format']));}return null;})['catch'](handleError(_0x6ca832,null));};exports[_0xbc8a('0x54')]=function(_0x19311d,_0x5acbaf,_0x48ddc6){var _0xc85429={'name':path[_0xbc8a('0x55')](_0x19311d[_0xbc8a('0x56')][_0xbc8a('0x57')],path[_0xbc8a('0x58')](_0x19311d[_0xbc8a('0x56')][_0xbc8a('0x57')])),'save_name':path[_0xbc8a('0x55')](_0x19311d[_0xbc8a('0x56')]['filename'],path[_0xbc8a('0x58')](_0x19311d[_0xbc8a('0x56')][_0xbc8a('0x59')])),'original_format':path[_0xbc8a('0x58')](_0x19311d[_0xbc8a('0x56')]['originalname'])[_0xbc8a('0x5a')](0x1),'converted_format':_0xbc8a('0x5b')};var _0x3883f8=path[_0xbc8a('0x4d')](config[_0xbc8a('0x51')],_0xbc8a('0x5c'),_0x19311d[_0xbc8a('0x56')]['filename']);var _0x28ab55=path[_0xbc8a('0x4d')](config[_0xbc8a('0x51')],_0xbc8a('0x4e'),util[_0xbc8a('0x52')](_0xbc8a('0x53'),path[_0xbc8a('0x55')](_0x19311d['file'][_0xbc8a('0x59')],path['extname'](_0x19311d['file'][_0xbc8a('0x59')])),_0xc85429['converted_format']));logger['info']('Sound\x20upload\x20filepath:\x20%s',_0x3883f8);logger[_0xbc8a('0x5d')](_0xbc8a('0x5e'),_0x28ab55);try{fs[_0xbc8a('0x5f')](_0x3883f8,parseInt('0777',0x8));var _0x1b5d9b=sox[_0xbc8a('0x60')](_0x3883f8,_0x28ab55,{'sampleRate':0x1f40,'format':_0xbc8a('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1b5d9b['on'](_0xbc8a('0x61'),function(_0xb796f2){fs[_0xbc8a('0x62')](_0x3883f8);_0x5acbaf[_0xbc8a('0x1b')](0x1f4)[_0xbc8a('0x2c')](_0xb796f2);});_0x1b5d9b['on'](_0xbc8a('0x63'),function(_0x47db96){_0xc85429[_0xbc8a('0x64')]=isNaN(_0x47db96[_0xbc8a('0x65')])?null:_0x47db96[_0xbc8a('0x65')]*0x3e8;_0xc85429[_0xbc8a('0x66')]=isNaN(_0x47db96[_0xbc8a('0x67')])?null:_0x47db96[_0xbc8a('0x67')];_0xc85429['original_channelCount']=isNaN(_0x47db96['channelCount'])?null:_0x47db96[_0xbc8a('0x68')];_0xc85429[_0xbc8a('0x69')]=isNaN(_0x47db96[_0xbc8a('0x6a')])?null:_0x47db96['bitRate'];_0xc85429[_0xbc8a('0x6b')]=isNaN(_0x47db96[_0xbc8a('0x6c')])?null:_0x47db96[_0xbc8a('0x6c')];});_0x1b5d9b['on'](_0xbc8a('0x6d'),function(_0x1b7005){_0xc85429[_0xbc8a('0x6e')]=isNaN(_0x1b7005[_0xbc8a('0x65')])?null:_0x1b7005[_0xbc8a('0x65')]*0x3e8;_0xc85429[_0xbc8a('0x6f')]=isNaN(_0x1b7005[_0xbc8a('0x67')])?null:_0x1b7005[_0xbc8a('0x67')];_0xc85429[_0xbc8a('0x70')]=isNaN(_0x1b7005[_0xbc8a('0x68')])?null:_0x1b7005[_0xbc8a('0x68')];_0xc85429[_0xbc8a('0x71')]=isNaN(_0x1b7005['bitRate'])?null:_0x1b7005['bitRate'];_0xc85429['converted_sampleRate']=isNaN(_0x1b7005[_0xbc8a('0x6c')])?null:_0x1b7005[_0xbc8a('0x6c')];});_0x1b5d9b['on'](_0xbc8a('0x1c'),function(){fs[_0xbc8a('0x5f')](_0x28ab55,parseInt(_0xbc8a('0x72'),0x8));return db[_0xbc8a('0x2e')][_0xbc8a('0x54')](_0xc85429)['then'](function(_0x32db8c){var _0x2d7bc2={'role':_0x19311d['body'][_0xbc8a('0x73')],'userProfileId':_0x19311d[_0xbc8a('0x74')][_0xbc8a('0x75')]};if(!_0x2d7bc2)throw new Error(_0xbc8a('0x76'));if(_0x2d7bc2['role']==='user'){var _0x462907=_0x32db8c['get']({'plain':!![]});return db[_0xbc8a('0x77')][_0xbc8a('0x48')]({'where':{'name':'Sounds','userProfileId':_0x2d7bc2[_0xbc8a('0x75')]},'raw':!![]})[_0xbc8a('0x25')](function(_0x381d4d){if(_0x381d4d&&_0x381d4d[_0xbc8a('0x78')]===0x0){return db[_0xbc8a('0x28')][_0xbc8a('0x54')]({'name':_0x462907['name'],'resourceId':_0x462907['id'],'type':_0x381d4d[_0xbc8a('0x2b')],'sectionId':_0x381d4d['id']},{})[_0xbc8a('0x25')](function(){return _0x32db8c;});}else{return _0x32db8c;}})[_0xbc8a('0x44')](function(_0x283b3c){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x283b3c);throw _0x283b3c;});}return _0x32db8c;})[_0xbc8a('0x25')](respondWithResult(_0x5acbaf,null))[_0xbc8a('0x44')](handleError(_0x5acbaf,null));});_0x1b5d9b['start']();}catch(_0x1f611a){_0x5acbaf['status'](0x1f4)[_0xbc8a('0x2c')](_0x1f611a);}};exports[_0xbc8a('0x24')]=function(_0x68d1aa,_0x233f13,_0xb3ac08){return db[_0xbc8a('0x2e')][_0xbc8a('0x48')]({'where':{'id':_0x68d1aa[_0xbc8a('0x46')]['id']}})[_0xbc8a('0x25')](handleEntityNotFound(_0x233f13,null))[_0xbc8a('0x25')](saveUpdates(_[_0xbc8a('0x79')](_0x68d1aa[_0xbc8a('0x74')],[_0xbc8a('0x2b'),_0xbc8a('0x7a')]),null))[_0xbc8a('0x25')](respondWithResult(_0x233f13,null))[_0xbc8a('0x44')](handleError(_0x233f13,null));};exports['delete']=function(_0x43a49f,_0x1cbb90,_0x2c3dde){return db[_0xbc8a('0x2e')][_0xbc8a('0x48')]({'where':{'id':_0x43a49f['params']['id']}})[_0xbc8a('0x25')](function(_0x586e27){if(_0x586e27){return _0x586e27[_0xbc8a('0x29')]();}})[_0xbc8a('0x25')](function(_0xc25a11){var _0x2e4ddc=path['join'](config[_0xbc8a('0x51')],_0xbc8a('0x5c'),util[_0xbc8a('0x52')](_0xbc8a('0x53'),_0xc25a11[_0xbc8a('0x4a')],_0xc25a11['original_format']));var _0x3fd9d1=path[_0xbc8a('0x4d')](config['root'],_0xbc8a('0x4e'),util['format'](_0xbc8a('0x53'),_0xc25a11[_0xbc8a('0x4a')],_0xc25a11[_0xbc8a('0x4b')]));fs[_0xbc8a('0x62')](_0x2e4ddc);fs['unlinkSync'](_0x3fd9d1);return _0xc25a11;})[_0xbc8a('0x25')](function(_0x35963c){if(_0x35963c){return _0x1cbb90['status'](0xcc)['end']();}})['then'](handleEntityNotFound(_0x1cbb90,null))[_0xbc8a('0x44')](handleError(_0x1cbb90,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 9158cac..7796cf1 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 _0xbb61=['../../config/environment','./sound.attributes','exports','tools_sounds','lodash','util','../../config/logger','moment','bluebird','path','rimraf'];(function(_0x404cde,_0x27b51c){var _0x139882=function(_0x1f31d1){while(--_0x1f31d1){_0x404cde['push'](_0x404cde['shift']());}};_0x139882(++_0x27b51c);}(_0xbb61,0x185));var _0x1bb6=function(_0x599e60,_0x5b6519){_0x599e60=_0x599e60-0x0;var _0x468e19=_0xbb61[_0x599e60];return _0x468e19;};'use strict';var _=require(_0x1bb6('0x0'));var util=require(_0x1bb6('0x1'));var logger=require(_0x1bb6('0x2'))('api');var moment=require(_0x1bb6('0x3'));var BPromise=require(_0x1bb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1bb6('0x5'));var rimraf=require(_0x1bb6('0x6'));var config=require(_0x1bb6('0x7'));var attributes=require(_0x1bb6('0x8'));module[_0x1bb6('0x9')]=function(_0x14d952,_0x134ac9){return _0x14d952['define']('Sound',attributes,{'tableName':_0x1bb6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d74=['../../config/environment','./sound.attributes','exports','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x459240,_0x4c7c29){var _0x2b9388=function(_0x3706a5){while(--_0x3706a5){_0x459240['push'](_0x459240['shift']());}};_0x2b9388(++_0x4c7c29);}(_0x7d74,0x15f));var _0x47d7=function(_0x3e5086,_0x48f4a2){_0x3e5086=_0x3e5086-0x0;var _0xfeb102=_0x7d74[_0x3e5086];return _0xfeb102;};'use strict';var _=require(_0x47d7('0x0'));var util=require(_0x47d7('0x1'));var logger=require(_0x47d7('0x2'))(_0x47d7('0x3'));var moment=require(_0x47d7('0x4'));var BPromise=require(_0x47d7('0x5'));var rp=require(_0x47d7('0x6'));var fs=require('fs');var path=require(_0x47d7('0x7'));var rimraf=require(_0x47d7('0x8'));var config=require(_0x47d7('0x9'));var attributes=require(_0x47d7('0xa'));module[_0x47d7('0xb')]=function(_0x24ffd6,_0x252647){return _0x24ffd6['define']('Sound',attributes,{'tableName':'tools_sounds','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 469fc29..ab57ea3 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 _0x4f16=['code','message','catch','ShowSound','find','options','raw','where','include','model','attributes','map','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Sound,\x20%s,\x20%s','request\x20sent','debug','Sound,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x16fbe9,_0x4feb10){var _0x12fcb2=function(_0x5b3455){while(--_0x5b3455){_0x16fbe9['push'](_0x16fbe9['shift']());}};_0x12fcb2(++_0x4feb10);}(_0x4f16,0x19f));var _0x64f1=function(_0x388c1c,_0x45ac57){_0x388c1c=_0x388c1c-0x0;var _0x2dada8=_0x4f16[_0x388c1c];return _0x2dada8;};'use strict';var _=require('lodash');var util=require(_0x64f1('0x0'));var moment=require(_0x64f1('0x1'));var BPromise=require(_0x64f1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x64f1('0x3'));var db=require(_0x64f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x64f1('0x5'))(_0x64f1('0x6'));var config=require('../../config/environment');var jayson=require(_0x64f1('0x7'));var client=jayson[_0x64f1('0x8')][_0x64f1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ff97a,_0x2dc8de,_0x273464){return new BPromise(function(_0x5749f5,_0x510fcc){return client[_0x64f1('0xa')](_0x1ff97a,_0x273464)[_0x64f1('0xb')](function(_0x274d75){logger[_0x64f1('0xc')](_0x64f1('0xd'),_0x2dc8de,_0x64f1('0xe'));logger[_0x64f1('0xf')](_0x64f1('0x10'),_0x2dc8de,'request\x20sent',JSON[_0x64f1('0x11')](_0x274d75));if(_0x274d75[_0x64f1('0x12')]){if(_0x274d75[_0x64f1('0x12')][_0x64f1('0x13')]===0x1f4){logger[_0x64f1('0x12')](_0x64f1('0xd'),_0x2dc8de,_0x274d75[_0x64f1('0x12')][_0x64f1('0x14')]);return _0x510fcc(_0x274d75[_0x64f1('0x12')][_0x64f1('0x14')]);}logger[_0x64f1('0x12')](_0x64f1('0xd'),_0x2dc8de,_0x274d75[_0x64f1('0x12')][_0x64f1('0x14')]);return _0x5749f5(_0x274d75[_0x64f1('0x12')][_0x64f1('0x14')]);}else{logger[_0x64f1('0xc')](_0x64f1('0xd'),_0x2dc8de,_0x64f1('0xe'));_0x5749f5(_0x274d75['result'][_0x64f1('0x14')]);}})[_0x64f1('0x15')](function(_0x4158e7){logger[_0x64f1('0x12')](_0x64f1('0xd'),_0x2dc8de,_0x4158e7);_0x510fcc(_0x4158e7);});});}exports[_0x64f1('0x16')]=function(_0x627193){var _0x623faf=this;return new Promise(function(_0x3e177d,_0x15576e){return db['Sound'][_0x64f1('0x17')]({'raw':_0x627193[_0x64f1('0x18')]?_0x627193['options'][_0x64f1('0x19')]===undefined?!![]:![]:!![],'where':_0x627193['options']?_0x627193[_0x64f1('0x18')][_0x64f1('0x1a')]||null:null,'attributes':_0x627193['options']?_0x627193[_0x64f1('0x18')]['attributes']||null:null,'include':_0x627193[_0x64f1('0x18')]?_0x627193[_0x64f1('0x18')][_0x64f1('0x1b')]?_['map'](_0x627193[_0x64f1('0x18')]['include'],function(_0x142ad1){return{'model':db[_0x142ad1[_0x64f1('0x1c')]],'as':_0x142ad1['as'],'attributes':_0x142ad1[_0x64f1('0x1d')],'include':_0x142ad1[_0x64f1('0x1b')]?_[_0x64f1('0x1e')](_0x142ad1['include'],function(_0x1e624b){return{'model':db[_0x1e624b[_0x64f1('0x1c')]],'as':_0x1e624b['as'],'attributes':_0x1e624b['attributes'],'include':_0x1e624b[_0x64f1('0x1b')]?_[_0x64f1('0x1e')](_0x1e624b[_0x64f1('0x1b')],function(_0x84c738){return{'model':db[_0x84c738['model']],'as':_0x84c738['as'],'attributes':_0x84c738[_0x64f1('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x64f1('0xb')](function(_0xfbe334){logger[_0x64f1('0xc')]('ShowSound',_0x627193);logger['debug'](_0x64f1('0x16'),_0x627193,JSON[_0x64f1('0x11')](_0xfbe334));_0x3e177d(_0xfbe334);})[_0x64f1('0x15')](function(_0x2a4112){logger['error'](_0x64f1('0x16'),_0x2a4112[_0x64f1('0x14')],_0x627193);_0x15576e(_0x623faf[_0x64f1('0x12')](0x1f4,_0x2a4112['message']));});});}; \ No newline at end of file +var _0x5064=['code','error','message','request\x20sent','result','catch','Sound','options','map','model','attributes','include','ShowSound','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','http','request','then','info','Sound,\x20%s,\x20%s','debug','Sound,\x20%s,\x20%s,\x20%s','stringify'];(function(_0xd58f7e,_0xf2781d){var _0xdf721a=function(_0x301d42){while(--_0x301d42){_0xd58f7e['push'](_0xd58f7e['shift']());}};_0xdf721a(++_0xf2781d);}(_0x5064,0x1dd));var _0x4506=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x5064[_0x2dafbe];return _0x58a45a;};'use strict';var _=require('lodash');var util=require(_0x4506('0x0'));var moment=require(_0x4506('0x1'));var BPromise=require(_0x4506('0x2'));var rs=require(_0x4506('0x3'));var fs=require('fs');var Redis=require(_0x4506('0x4'));var db=require(_0x4506('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4506('0x6'))(_0x4506('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x4506('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1d9fc3,_0xbb600c,_0x4f7de7){return new BPromise(function(_0x357d25,_0x4b2763){return client[_0x4506('0x9')](_0x1d9fc3,_0x4f7de7)[_0x4506('0xa')](function(_0x38da39){logger[_0x4506('0xb')](_0x4506('0xc'),_0xbb600c,'request\x20sent');logger[_0x4506('0xd')](_0x4506('0xe'),_0xbb600c,'request\x20sent',JSON[_0x4506('0xf')](_0x38da39));if(_0x38da39['error']){if(_0x38da39['error'][_0x4506('0x10')]===0x1f4){logger['error'](_0x4506('0xc'),_0xbb600c,_0x38da39[_0x4506('0x11')][_0x4506('0x12')]);return _0x4b2763(_0x38da39[_0x4506('0x11')][_0x4506('0x12')]);}logger[_0x4506('0x11')](_0x4506('0xc'),_0xbb600c,_0x38da39[_0x4506('0x11')][_0x4506('0x12')]);return _0x357d25(_0x38da39[_0x4506('0x11')][_0x4506('0x12')]);}else{logger[_0x4506('0xb')](_0x4506('0xc'),_0xbb600c,_0x4506('0x13'));_0x357d25(_0x38da39[_0x4506('0x14')][_0x4506('0x12')]);}})[_0x4506('0x15')](function(_0x37851a){logger[_0x4506('0x11')](_0x4506('0xc'),_0xbb600c,_0x37851a);_0x4b2763(_0x37851a);});});}exports['ShowSound']=function(_0x413362){var _0x1f1542=this;return new Promise(function(_0x85d823,_0x10bd09){return db[_0x4506('0x16')]['find']({'raw':_0x413362[_0x4506('0x17')]?_0x413362['options']['raw']===undefined?!![]:![]:!![],'where':_0x413362[_0x4506('0x17')]?_0x413362[_0x4506('0x17')]['where']||null:null,'attributes':_0x413362[_0x4506('0x17')]?_0x413362['options']['attributes']||null:null,'include':_0x413362[_0x4506('0x17')]?_0x413362[_0x4506('0x17')]['include']?_[_0x4506('0x18')](_0x413362[_0x4506('0x17')]['include'],function(_0x2f5d82){return{'model':db[_0x2f5d82[_0x4506('0x19')]],'as':_0x2f5d82['as'],'attributes':_0x2f5d82[_0x4506('0x1a')],'include':_0x2f5d82[_0x4506('0x1b')]?_[_0x4506('0x18')](_0x2f5d82['include'],function(_0x282ca9){return{'model':db[_0x282ca9[_0x4506('0x19')]],'as':_0x282ca9['as'],'attributes':_0x282ca9[_0x4506('0x1a')],'include':_0x282ca9['include']?_[_0x4506('0x18')](_0x282ca9['include'],function(_0x283aac){return{'model':db[_0x283aac[_0x4506('0x19')]],'as':_0x283aac['as'],'attributes':_0x283aac[_0x4506('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x4506('0xa')](function(_0x1311fe){logger['info'](_0x4506('0x1c'),_0x413362);logger['debug'](_0x4506('0x1c'),_0x413362,JSON[_0x4506('0xf')](_0x1311fe));_0x85d823(_0x1311fe);})[_0x4506('0x15')](function(_0x17e986){logger[_0x4506('0x11')](_0x4506('0x1c'),_0x17e986['message'],_0x413362);_0x10bd09(_0x1f1542['error'](0x1f4,_0x17e986['message']));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index cbdda0f..da5e89c 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 _0x4fc2=['show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareMessage.controller','isAuthenticated','index','/:id'];(function(_0x164ef5,_0xba6238){var _0x2d60c5=function(_0x34deca){while(--_0x34deca){_0x164ef5['push'](_0x164ef5['shift']());}};_0x2d60c5(++_0xba6238);}(_0x4fc2,0x111));var _0x24fc=function(_0x298152,_0x2bab07){_0x298152=_0x298152-0x0;var _0x58117d=_0x4fc2[_0x298152];return _0x58117d;};'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 +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0x3e4db1,_0x385cd6){var _0x33ecd5=function(_0x1213ad){while(--_0x1213ad){_0x3e4db1['push'](_0x3e4db1['shift']());}};_0x33ecd5(++_0x385cd6);}(_0xda2d,0x102));var _0xdda2=function(_0x5ee82f,_0xb57a9d){_0x5ee82f=_0x5ee82f-0x0;var _0xdb2e42=_0xda2d[_0x5ee82f];return _0xdb2e42;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 9561812..d77f1ce 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 _0x4f3d=['out','exports','STRING','TEXT'];(function(_0x5a2f41,_0x3962a9){var _0x533cb8=function(_0x3e7e7c){while(--_0x3e7e7c){_0x5a2f41['push'](_0x5a2f41['shift']());}};_0x533cb8(++_0x3962a9);}(_0x4f3d,0x161));var _0xd4f3=function(_0x4189be,_0x14fda3){_0x4189be=_0x4189be-0x0;var _0x339705=_0x4f3d[_0x4189be];return _0x339705;};'use strict';var Sequelize=require('sequelize');module[_0xd4f3('0x0')]={'uniqueid':{'type':Sequelize[_0xd4f3('0x1')]},'body':{'type':Sequelize[_0xd4f3('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize['ENUM']('in',_0xd4f3('0x3')),'defaultValue':_0xd4f3('0x3'),'allowNull':![]},'providerName':{'type':Sequelize[_0xd4f3('0x1')]},'providerResponse':{'type':Sequelize[_0xd4f3('0x2')]}}; \ No newline at end of file +var _0x0a12=['medium','ENUM','out','sequelize','exports','STRING','TEXT'];(function(_0x24b84b,_0x40e358){var _0x3cc9c2=function(_0x4ea7d5){while(--_0x4ea7d5){_0x24b84b['push'](_0x24b84b['shift']());}};_0x3cc9c2(++_0x40e358);}(_0x0a12,0x1d1));var _0x20a1=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x0a12[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0x20a1('0x0'));module[_0x20a1('0x1')]={'uniqueid':{'type':Sequelize[_0x20a1('0x2')]},'body':{'type':Sequelize[_0x20a1('0x3')](_0x20a1('0x4')),'allowNull':![]},'direction':{'type':Sequelize[_0x20a1('0x5')]('in',_0x20a1('0x6')),'defaultValue':_0x20a1('0x6'),'allowNull':![]},'providerName':{'type':Sequelize[_0x20a1('0x2')]},'providerResponse':{'type':Sequelize[_0x20a1('0x3')]}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 73210a2..919bd00 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 _0x2faf=['key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','sort','where','filters','filter','merge','options','then','includeAll','include','findAll','rows','catch','params','rawAttributes','create','update','body','destroy','find','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','reject','error','stack','name','send','map','SquareMessage','fieldName','type'];(function(_0x3bcfe3,_0x35b860){var _0xdb83d9=function(_0x32741f){while(--_0x32741f){_0x3bcfe3['push'](_0x3bcfe3['shift']());}};_0xdb83d9(++_0x35b860);}(_0x2faf,0xb0));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0xf2fa('0x0'));var rimraf=require(_0xf2fa('0x1'));var zipdir=require(_0xf2fa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2fa('0x3'));var moment=require(_0xf2fa('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf2fa('0x5'));var util=require(_0xf2fa('0x6'));var path=require(_0xf2fa('0x7'));var sox=require(_0xf2fa('0x8'));var csv=require(_0xf2fa('0x9'));var ejs=require(_0xf2fa('0xa'));var fs=require('fs');var fs_extra=require(_0xf2fa('0xb'));var _=require('lodash');var squel=require(_0xf2fa('0xc'));var crypto=require(_0xf2fa('0xd'));var jsforce=require(_0xf2fa('0xe'));var deskjs=require(_0xf2fa('0xf'));var toCsv=require('to-csv');var querystring=require(_0xf2fa('0x10'));var Papa=require('papaparse');var Redis=require(_0xf2fa('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf2fa('0x12'));var as=require(_0xf2fa('0x13'));var hardwareService=require(_0xf2fa('0x14'));var logger=require(_0xf2fa('0x15'))(_0xf2fa('0x16'));var utils=require(_0xf2fa('0x17'));var config=require(_0xf2fa('0x18'));var licenseUtil=require(_0xf2fa('0x19'));var db=require(_0xf2fa('0x1a'))['db'];function respondWithStatusCode(_0x15a15f,_0x4fe6e9){_0x4fe6e9=_0x4fe6e9||0xcc;return function(_0x2dabbb){if(_0x2dabbb){return _0x15a15f[_0xf2fa('0x1b')](_0x4fe6e9);}return _0x15a15f[_0xf2fa('0x1c')](_0x4fe6e9)[_0xf2fa('0x1d')]();};}function respondWithResult(_0x13ca94,_0x416ca6){_0x416ca6=_0x416ca6||0xc8;return function(_0x30a8b1){if(_0x30a8b1){return _0x13ca94[_0xf2fa('0x1c')](_0x416ca6)['json'](_0x30a8b1);}};}function respondWithFilteredResult(_0x2d8fc2,_0x4fea4a){return function(_0x2aa797){if(_0x2aa797){var _0x9e3bc8=typeof _0x4fea4a['offset']==='undefined'&&typeof _0x4fea4a[_0xf2fa('0x1e')]===_0xf2fa('0x1f');var _0xd9c050=_0x2aa797[_0xf2fa('0x20')];var _0x2b8f69=_0x9e3bc8?0x0:_0x4fea4a[_0xf2fa('0x21')];var _0x551b3d=_0x9e3bc8?_0x2aa797[_0xf2fa('0x20')]:_0x4fea4a[_0xf2fa('0x21')]+_0x4fea4a[_0xf2fa('0x1e')];var _0x57bca1;if(_0x551b3d>=_0xd9c050){_0x551b3d=_0xd9c050;_0x57bca1=0xc8;}else{_0x57bca1=0xce;}_0x2d8fc2[_0xf2fa('0x1c')](_0x57bca1);return _0x2d8fc2[_0xf2fa('0x22')](_0xf2fa('0x23'),_0x2b8f69+'-'+_0x551b3d+'/'+_0xd9c050)[_0xf2fa('0x24')](_0x2aa797);}return null;};}function patchUpdates(_0x25f5d3){return function(_0x536a2d){try{jsonpatch['apply'](_0x536a2d,_0x25f5d3,!![]);}catch(_0x568448){return BPromise[_0xf2fa('0x25')](_0x568448);}return _0x536a2d['save']();};}function saveUpdates(_0x2ddb2c,_0x4034ab){return function(_0x599c7b){if(_0x599c7b){return _0x599c7b['update'](_0x2ddb2c)['then'](function(_0x453c9d){return _0x453c9d;});}return null;};}function removeEntity(_0x17a54f,_0x2b753e){return function(_0x2e809d){if(_0x2e809d){return _0x2e809d['destroy']()['then'](function(){_0x17a54f[_0xf2fa('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x557631,_0x4ab17d){return function(_0x319b68){if(!_0x319b68){_0x557631['sendStatus'](0x194);}return _0x319b68;};}function handleError(_0x5ba4dd,_0xb18557){_0xb18557=_0xb18557||0x1f4;return function(_0x5553fa){logger[_0xf2fa('0x26')](_0x5553fa[_0xf2fa('0x27')]);if(_0x5553fa[_0xf2fa('0x28')]){delete _0x5553fa['name'];}_0x5ba4dd['status'](_0xb18557)[_0xf2fa('0x29')](_0x5553fa);};}exports['index']=function(_0x1b8532,_0xd4a340){var _0x18fefb={},_0x3e631d={},_0x50ead8={'count':0x0,'rows':[]};var _0x19a4ad=_[_0xf2fa('0x2a')](db[_0xf2fa('0x2b')]['rawAttributes'],function(_0xd01492){return{'name':_0xd01492[_0xf2fa('0x2c')],'type':_0xd01492[_0xf2fa('0x2d')][_0xf2fa('0x2e')]};});_0x3e631d[_0xf2fa('0x2f')]=_[_0xf2fa('0x2a')](_0x19a4ad,_0xf2fa('0x28'));_0x3e631d[_0xf2fa('0x30')]=_[_0xf2fa('0x31')](_0x1b8532[_0xf2fa('0x30')]);_0x3e631d['filters']=_['intersection'](_0x3e631d[_0xf2fa('0x2f')],_0x3e631d[_0xf2fa('0x30')]);_0x18fefb[_0xf2fa('0x32')]=_[_0xf2fa('0x33')](_0x3e631d[_0xf2fa('0x2f')],qs['fields'](_0x1b8532['query'][_0xf2fa('0x34')]));_0x18fefb[_0xf2fa('0x32')]=_0x18fefb[_0xf2fa('0x32')][_0xf2fa('0x35')]?_0x18fefb[_0xf2fa('0x32')]:_0x3e631d[_0xf2fa('0x2f')];if(!_0x1b8532['query'][_0xf2fa('0x36')]('nolimit')){_0x18fefb[_0xf2fa('0x1e')]=qs[_0xf2fa('0x1e')](_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x1e')]);_0x18fefb[_0xf2fa('0x21')]=qs[_0xf2fa('0x21')](_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x21')]);}_0x18fefb['order']=qs[_0xf2fa('0x37')](_0x1b8532['query'][_0xf2fa('0x37')]);_0x18fefb[_0xf2fa('0x38')]=qs[_0xf2fa('0x39')](_['pick'](_0x1b8532['query'],_0x3e631d[_0xf2fa('0x39')]),_0x19a4ad);if(_0x1b8532['query'][_0xf2fa('0x3a')]){_0x18fefb[_0xf2fa('0x38')]=_[_0xf2fa('0x3b')](_0x18fefb[_0xf2fa('0x38')],{'$or':_[_0xf2fa('0x2a')](_0x19a4ad,function(_0x8ab728){if(_0x8ab728[_0xf2fa('0x2d')]!=='VIRTUAL'){var _0x5a324e={};_0x5a324e[_0x8ab728['name']]={'$like':'%'+_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x3a')]+'%'};return _0x5a324e;}})});}_0x18fefb=_[_0xf2fa('0x3b')]({},_0x18fefb,_0x1b8532[_0xf2fa('0x3c')]);var _0x178f84={'where':_0x18fefb[_0xf2fa('0x38')]};return db[_0xf2fa('0x2b')][_0xf2fa('0x20')](_0x178f84)[_0xf2fa('0x3d')](function(_0x166668){_0x50ead8[_0xf2fa('0x20')]=_0x166668;if(_0x1b8532[_0xf2fa('0x30')][_0xf2fa('0x3e')]){_0x18fefb[_0xf2fa('0x3f')]=[{'all':!![]}];}return db[_0xf2fa('0x2b')][_0xf2fa('0x40')](_0x18fefb);})['then'](function(_0x4dc672){_0x50ead8[_0xf2fa('0x41')]=_0x4dc672;return _0x50ead8;})['then'](respondWithFilteredResult(_0xd4a340,_0x18fefb))[_0xf2fa('0x42')](handleError(_0xd4a340,null));};exports['show']=function(_0x38aed5,_0x1005f4){var _0x110902={'raw':!![],'where':{'id':_0x38aed5[_0xf2fa('0x43')]['id']}},_0x44c14d={};_0x44c14d[_0xf2fa('0x2f')]=_['keys'](db['SquareMessage'][_0xf2fa('0x44')]);_0x44c14d[_0xf2fa('0x30')]=_[_0xf2fa('0x31')](_0x38aed5[_0xf2fa('0x30')]);_0x44c14d['filters']=_[_0xf2fa('0x33')](_0x44c14d[_0xf2fa('0x2f')],_0x44c14d[_0xf2fa('0x30')]);_0x110902['attributes']=_[_0xf2fa('0x33')](_0x44c14d['model'],qs[_0xf2fa('0x34')](_0x38aed5[_0xf2fa('0x30')][_0xf2fa('0x34')]));_0x110902[_0xf2fa('0x32')]=_0x110902[_0xf2fa('0x32')][_0xf2fa('0x35')]?_0x110902[_0xf2fa('0x32')]:_0x44c14d[_0xf2fa('0x2f')];if(_0x38aed5[_0xf2fa('0x30')][_0xf2fa('0x3e')]){_0x110902[_0xf2fa('0x3f')]=[{'all':!![]}];}_0x110902=_[_0xf2fa('0x3b')]({},_0x110902,_0x38aed5['options']);return db['SquareMessage']['find'](_0x110902)[_0xf2fa('0x3d')](handleEntityNotFound(_0x1005f4,null))[_0xf2fa('0x3d')](respondWithResult(_0x1005f4,null))['catch'](handleError(_0x1005f4,null));};exports[_0xf2fa('0x45')]=function(_0x158d43,_0x3769cf){return db[_0xf2fa('0x2b')]['create'](_0x158d43['body'],{})[_0xf2fa('0x3d')](respondWithResult(_0x3769cf,0xc9))['catch'](handleError(_0x3769cf,null));};exports[_0xf2fa('0x46')]=function(_0x534c5f,_0x5b62a3){if(_0x534c5f['body']['id']){delete _0x534c5f[_0xf2fa('0x47')]['id'];}return db[_0xf2fa('0x2b')]['find']({'where':{'id':_0x534c5f['params']['id']}})[_0xf2fa('0x3d')](handleEntityNotFound(_0x5b62a3,null))['then'](saveUpdates(_0x534c5f[_0xf2fa('0x47')],null))[_0xf2fa('0x3d')](respondWithResult(_0x5b62a3,null))[_0xf2fa('0x42')](handleError(_0x5b62a3,null));};exports[_0xf2fa('0x48')]=function(_0x30a57b,_0x3366df){return db[_0xf2fa('0x2b')][_0xf2fa('0x49')]({'where':{'id':_0x30a57b[_0xf2fa('0x43')]['id']}})[_0xf2fa('0x3d')](handleEntityNotFound(_0x3366df,null))[_0xf2fa('0x3d')](removeEntity(_0x3366df,null))[_0xf2fa('0x42')](handleError(_0x3366df,null));}; \ No newline at end of file +var _0x3172=['error','stack','name','send','index','map','SquareMessage','fieldName','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','where','pick','filters','filter','merge','type','VIRTUAL','include','findAll','catch','show','params','keys','rawAttributes','includeAll','options','find','create','body','fast-json-patch','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy'];(function(_0x2d01d0,_0x13a058){var _0x515401=function(_0x392f3d){while(--_0x392f3d){_0x2d01d0['push'](_0x2d01d0['shift']());}};_0x515401(++_0x13a058);}(_0x3172,0x1da));var _0x2317=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0x3172[_0x27031e];return _0xfd46b3;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x2317('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2317('0x1'));var util=require(_0x2317('0x2'));var path=require(_0x2317('0x3'));var sox=require(_0x2317('0x4'));var csv=require(_0x2317('0x5'));var ejs=require(_0x2317('0x6'));var fs=require('fs');var fs_extra=require(_0x2317('0x7'));var _=require(_0x2317('0x8'));var squel=require(_0x2317('0x9'));var crypto=require(_0x2317('0xa'));var jsforce=require(_0x2317('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2317('0xc'));var Redis=require(_0x2317('0xd'));var authService=require(_0x2317('0xe'));var qs=require(_0x2317('0xf'));var as=require(_0x2317('0x10'));var hardwareService=require(_0x2317('0x11'));var logger=require(_0x2317('0x12'))('api');var utils=require(_0x2317('0x13'));var config=require(_0x2317('0x14'));var licenseUtil=require(_0x2317('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4c32eb,_0x1d7c7e){_0x1d7c7e=_0x1d7c7e||0xcc;return function(_0x55059a){if(_0x55059a){return _0x4c32eb[_0x2317('0x16')](_0x1d7c7e);}return _0x4c32eb[_0x2317('0x17')](_0x1d7c7e)[_0x2317('0x18')]();};}function respondWithResult(_0x5089b0,_0x1ac6b0){_0x1ac6b0=_0x1ac6b0||0xc8;return function(_0x1eea00){if(_0x1eea00){return _0x5089b0[_0x2317('0x17')](_0x1ac6b0)[_0x2317('0x19')](_0x1eea00);}};}function respondWithFilteredResult(_0x37de4a,_0x2b09ef){return function(_0x41ace1){if(_0x41ace1){var _0x518d7b=typeof _0x2b09ef[_0x2317('0x1a')]===_0x2317('0x1b')&&typeof _0x2b09ef[_0x2317('0x1c')]===_0x2317('0x1b');var _0x2d29e5=_0x41ace1[_0x2317('0x1d')];var _0x5a518e=_0x518d7b?0x0:_0x2b09ef[_0x2317('0x1a')];var _0x259f6a=_0x518d7b?_0x41ace1[_0x2317('0x1d')]:_0x2b09ef['offset']+_0x2b09ef[_0x2317('0x1c')];var _0x1fa538;if(_0x259f6a>=_0x2d29e5){_0x259f6a=_0x2d29e5;_0x1fa538=0xc8;}else{_0x1fa538=0xce;}_0x37de4a[_0x2317('0x17')](_0x1fa538);return _0x37de4a[_0x2317('0x1e')]('Content-Range',_0x5a518e+'-'+_0x259f6a+'/'+_0x2d29e5)[_0x2317('0x19')](_0x41ace1);}return null;};}function patchUpdates(_0xf3856b){return function(_0x41ad13){try{jsonpatch[_0x2317('0x1f')](_0x41ad13,_0xf3856b,!![]);}catch(_0x5e2bad){return BPromise[_0x2317('0x20')](_0x5e2bad);}return _0x41ad13[_0x2317('0x21')]();};}function saveUpdates(_0x5e36eb,_0xd09f9f){return function(_0x54daab){if(_0x54daab){return _0x54daab[_0x2317('0x22')](_0x5e36eb)[_0x2317('0x23')](function(_0x13f01f){return _0x13f01f;});}return null;};}function removeEntity(_0x5a329a,_0xae7ba7){return function(_0x5ad0a2){if(_0x5ad0a2){return _0x5ad0a2[_0x2317('0x24')]()[_0x2317('0x23')](function(){_0x5a329a[_0x2317('0x17')](0xcc)[_0x2317('0x18')]();});}};}function handleEntityNotFound(_0x5eaa8f,_0x4e9f97){return function(_0x49a41b){if(!_0x49a41b){_0x5eaa8f[_0x2317('0x16')](0x194);}return _0x49a41b;};}function handleError(_0x1b8f12,_0x406597){_0x406597=_0x406597||0x1f4;return function(_0x61bfcc){logger[_0x2317('0x25')](_0x61bfcc[_0x2317('0x26')]);if(_0x61bfcc['name']){delete _0x61bfcc[_0x2317('0x27')];}_0x1b8f12['status'](_0x406597)[_0x2317('0x28')](_0x61bfcc);};}exports[_0x2317('0x29')]=function(_0x1ad23c,_0x498eb7){var _0x39904f={},_0x266843={},_0x518be1={'count':0x0,'rows':[]};var _0xbaa7fb=_[_0x2317('0x2a')](db[_0x2317('0x2b')]['rawAttributes'],function(_0x21f806){return{'name':_0x21f806[_0x2317('0x2c')],'type':_0x21f806['type']['key']};});_0x266843[_0x2317('0x2d')]=_[_0x2317('0x2a')](_0xbaa7fb,_0x2317('0x27'));_0x266843[_0x2317('0x2e')]=_['keys'](_0x1ad23c[_0x2317('0x2e')]);_0x266843['filters']=_['intersection'](_0x266843[_0x2317('0x2d')],_0x266843[_0x2317('0x2e')]);_0x39904f[_0x2317('0x2f')]=_[_0x2317('0x30')](_0x266843[_0x2317('0x2d')],qs[_0x2317('0x31')](_0x1ad23c[_0x2317('0x2e')]['fields']));_0x39904f[_0x2317('0x2f')]=_0x39904f[_0x2317('0x2f')][_0x2317('0x32')]?_0x39904f[_0x2317('0x2f')]:_0x266843[_0x2317('0x2d')];if(!_0x1ad23c[_0x2317('0x2e')][_0x2317('0x33')](_0x2317('0x34'))){_0x39904f['limit']=qs[_0x2317('0x1c')](_0x1ad23c[_0x2317('0x2e')][_0x2317('0x1c')]);_0x39904f['offset']=qs[_0x2317('0x1a')](_0x1ad23c[_0x2317('0x2e')][_0x2317('0x1a')]);}_0x39904f[_0x2317('0x35')]=qs['sort'](_0x1ad23c['query']['sort']);_0x39904f[_0x2317('0x36')]=qs['filters'](_[_0x2317('0x37')](_0x1ad23c[_0x2317('0x2e')],_0x266843[_0x2317('0x38')]),_0xbaa7fb);if(_0x1ad23c[_0x2317('0x2e')][_0x2317('0x39')]){_0x39904f[_0x2317('0x36')]=_[_0x2317('0x3a')](_0x39904f[_0x2317('0x36')],{'$or':_['map'](_0xbaa7fb,function(_0x99fe91){if(_0x99fe91[_0x2317('0x3b')]!==_0x2317('0x3c')){var _0x7dfd8f={};_0x7dfd8f[_0x99fe91[_0x2317('0x27')]]={'$like':'%'+_0x1ad23c[_0x2317('0x2e')]['filter']+'%'};return _0x7dfd8f;}})});}_0x39904f=_['merge']({},_0x39904f,_0x1ad23c['options']);var _0x5771d4={'where':_0x39904f[_0x2317('0x36')]};return db['SquareMessage']['count'](_0x5771d4)['then'](function(_0x30c898){_0x518be1[_0x2317('0x1d')]=_0x30c898;if(_0x1ad23c[_0x2317('0x2e')]['includeAll']){_0x39904f[_0x2317('0x3d')]=[{'all':!![]}];}return db[_0x2317('0x2b')][_0x2317('0x3e')](_0x39904f);})[_0x2317('0x23')](function(_0x1c9935){_0x518be1['rows']=_0x1c9935;return _0x518be1;})[_0x2317('0x23')](respondWithFilteredResult(_0x498eb7,_0x39904f))[_0x2317('0x3f')](handleError(_0x498eb7,null));};exports[_0x2317('0x40')]=function(_0x81a956,_0x13708b){var _0x393c62={'raw':!![],'where':{'id':_0x81a956[_0x2317('0x41')]['id']}},_0x57d403={};_0x57d403['model']=_[_0x2317('0x42')](db[_0x2317('0x2b')][_0x2317('0x43')]);_0x57d403[_0x2317('0x2e')]=_[_0x2317('0x42')](_0x81a956[_0x2317('0x2e')]);_0x57d403[_0x2317('0x38')]=_['intersection'](_0x57d403['model'],_0x57d403['query']);_0x393c62['attributes']=_[_0x2317('0x30')](_0x57d403[_0x2317('0x2d')],qs[_0x2317('0x31')](_0x81a956['query'][_0x2317('0x31')]));_0x393c62[_0x2317('0x2f')]=_0x393c62['attributes'][_0x2317('0x32')]?_0x393c62[_0x2317('0x2f')]:_0x57d403[_0x2317('0x2d')];if(_0x81a956[_0x2317('0x2e')][_0x2317('0x44')]){_0x393c62['include']=[{'all':!![]}];}_0x393c62=_[_0x2317('0x3a')]({},_0x393c62,_0x81a956[_0x2317('0x45')]);return db[_0x2317('0x2b')][_0x2317('0x46')](_0x393c62)['then'](handleEntityNotFound(_0x13708b,null))[_0x2317('0x23')](respondWithResult(_0x13708b,null))[_0x2317('0x3f')](handleError(_0x13708b,null));};exports[_0x2317('0x47')]=function(_0x3c27fd,_0x4762c6){return db[_0x2317('0x2b')][_0x2317('0x47')](_0x3c27fd['body'],{})[_0x2317('0x23')](respondWithResult(_0x4762c6,0xc9))[_0x2317('0x3f')](handleError(_0x4762c6,null));};exports[_0x2317('0x22')]=function(_0x12d988,_0x5c031d){if(_0x12d988[_0x2317('0x48')]['id']){delete _0x12d988['body']['id'];}return db[_0x2317('0x2b')][_0x2317('0x46')]({'where':{'id':_0x12d988[_0x2317('0x41')]['id']}})[_0x2317('0x23')](handleEntityNotFound(_0x5c031d,null))[_0x2317('0x23')](saveUpdates(_0x12d988[_0x2317('0x48')],null))[_0x2317('0x23')](respondWithResult(_0x5c031d,null))[_0x2317('0x3f')](handleError(_0x5c031d,null));};exports['destroy']=function(_0x512095,_0x2c9d31){return db[_0x2317('0x2b')]['find']({'where':{'id':_0x512095['params']['id']}})[_0x2317('0x23')](handleEntityNotFound(_0x2c9d31,null))[_0x2317('0x23')](removeEntity(_0x2c9d31,null))[_0x2317('0x3f')](handleError(_0x2c9d31,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 9d3ca2f..81c2ab4 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 _0xdd70=['rimraf','../../config/environment','exports','SquareMessage','square_messages','lodash','util','moment','bluebird','request-promise'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0xdd70,0x18b));var _0x0dd7=function(_0x58f266,_0x258d3d){_0x58f266=_0x58f266-0x0;var _0x139b99=_0xdd70[_0x58f266];return _0x139b99;};'use strict';var _=require(_0x0dd7('0x0'));var util=require(_0x0dd7('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x0dd7('0x2'));var BPromise=require(_0x0dd7('0x3'));var rp=require(_0x0dd7('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0dd7('0x5'));var config=require(_0x0dd7('0x6'));var attributes=require('./squareMessage.attributes');module[_0x0dd7('0x7')]=function(_0x349081,_0x34aa1b){return _0x349081['define'](_0x0dd7('0x8'),attributes,{'tableName':_0x0dd7('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1362=['SquareMessage','lodash','util','bluebird','request-promise','rimraf','../../config/environment','./squareMessage.attributes','define'];(function(_0x2900bf,_0x396900){var _0x4ff896=function(_0x4366c7){while(--_0x4366c7){_0x2900bf['push'](_0x2900bf['shift']());}};_0x4ff896(++_0x396900);}(_0x1362,0xbe));var _0x2136=function(_0x3cc606,_0x2465d6){_0x3cc606=_0x3cc606-0x0;var _0x3add67=_0x1362[_0x3cc606];return _0x3add67;};'use strict';var _=require(_0x2136('0x0'));var util=require(_0x2136('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x2136('0x2'));var rp=require(_0x2136('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2136('0x4'));var config=require(_0x2136('0x5'));var attributes=require(_0x2136('0x6'));module['exports']=function(_0x2a26c4,_0x5d7dca){return _0x2a26c4[_0x2136('0x7')](_0x2136('0x8'),attributes,{'tableName':'square_messages','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 aa702bd..d9d2d13 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 _0x373a=['info','SquareMessage,\x20%s,\x20%s','debug','SquareMessage,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','create','body','options','CreateSquareMessage','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x338044,_0x42805b){var _0x2611c2=function(_0x2f1e52){while(--_0x2f1e52){_0x338044['push'](_0x338044['shift']());}};_0x2611c2(++_0x42805b);}(_0x373a,0x145));var _0xa373=function(_0x5be64a,_0x1424a7){_0x5be64a=_0x5be64a-0x0;var _0x60aac4=_0x373a[_0x5be64a];return _0x60aac4;};'use strict';var _=require(_0xa373('0x0'));var util=require(_0xa373('0x1'));var moment=require(_0xa373('0x2'));var BPromise=require(_0xa373('0x3'));var rs=require(_0xa373('0x4'));var fs=require('fs');var Redis=require(_0xa373('0x5'));var db=require(_0xa373('0x6'))['db'];var utils=require(_0xa373('0x7'));var logger=require(_0xa373('0x8'))(_0xa373('0x9'));var config=require(_0xa373('0xa'));var jayson=require(_0xa373('0xb'));var client=jayson[_0xa373('0xc')][_0xa373('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x929207,_0x307f13,_0x5d846a){return new BPromise(function(_0x42fa69,_0x49cce6){return client[_0xa373('0xe')](_0x929207,_0x5d846a)[_0xa373('0xf')](function(_0x15e53b){logger[_0xa373('0x10')](_0xa373('0x11'),_0x307f13,'request\x20sent');logger[_0xa373('0x12')](_0xa373('0x13'),_0x307f13,_0xa373('0x14'),JSON['stringify'](_0x15e53b));if(_0x15e53b[_0xa373('0x15')]){if(_0x15e53b[_0xa373('0x15')][_0xa373('0x16')]===0x1f4){logger[_0xa373('0x15')]('SquareMessage,\x20%s,\x20%s',_0x307f13,_0x15e53b[_0xa373('0x15')]['message']);return _0x49cce6(_0x15e53b[_0xa373('0x15')][_0xa373('0x17')]);}logger[_0xa373('0x15')](_0xa373('0x11'),_0x307f13,_0x15e53b['error'][_0xa373('0x17')]);return _0x42fa69(_0x15e53b[_0xa373('0x15')][_0xa373('0x17')]);}else{logger[_0xa373('0x10')](_0xa373('0x11'),_0x307f13,_0xa373('0x14'));_0x42fa69(_0x15e53b[_0xa373('0x18')][_0xa373('0x17')]);}})[_0xa373('0x19')](function(_0xd9e8dc){logger[_0xa373('0x15')](_0xa373('0x11'),_0x307f13,_0xd9e8dc);_0x49cce6(_0xd9e8dc);});});}exports['CreateSquareMessage']=function(_0x49e1f3){var _0xcd401=this;return new Promise(function(_0x3ce03b,_0x574a90){return db['SquareMessage'][_0xa373('0x1a')](_0x49e1f3[_0xa373('0x1b')],{'raw':_0x49e1f3['options']?_0x49e1f3[_0xa373('0x1c')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x182bd2){logger['info'](_0xa373('0x1d'),_0x49e1f3);logger[_0xa373('0x12')](_0xa373('0x1d'),_0x49e1f3,JSON[_0xa373('0x1e')](_0x182bd2));_0x3ce03b(_0x182bd2);})[_0xa373('0x19')](function(_0x58a9d4){logger[_0xa373('0x15')](_0xa373('0x1d'),_0x58a9d4['message'],_0x49e1f3);_0x574a90(_0xcd401[_0xa373('0x15')](0x1f4,_0x58a9d4[_0xa373('0x17')]));});});}; \ No newline at end of file +var _0xe3b5=['error','message','result','CreateSquareMessage','SquareMessage','create','body','options','raw','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x4ed786,_0x74f270){var _0x2f0243=function(_0x5642f5){while(--_0x5642f5){_0x4ed786['push'](_0x4ed786['shift']());}};_0x2f0243(++_0x74f270);}(_0xe3b5,0xea));var _0x5e3b=function(_0x13605e,_0x4dc60a){_0x13605e=_0x13605e-0x0;var _0x188c46=_0xe3b5[_0x13605e];return _0x188c46;};'use strict';var _=require(_0x5e3b('0x0'));var util=require(_0x5e3b('0x1'));var moment=require(_0x5e3b('0x2'));var BPromise=require(_0x5e3b('0x3'));var rs=require(_0x5e3b('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5e3b('0x5'));var logger=require(_0x5e3b('0x6'))(_0x5e3b('0x7'));var config=require(_0x5e3b('0x8'));var jayson=require(_0x5e3b('0x9'));var client=jayson[_0x5e3b('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5567b4,_0x391143,_0x338d37){return new BPromise(function(_0x5ef2a7,_0x10ddb6){return client[_0x5e3b('0xb')](_0x5567b4,_0x338d37)[_0x5e3b('0xc')](function(_0xbc1b24){logger[_0x5e3b('0xd')](_0x5e3b('0xe'),_0x391143,_0x5e3b('0xf'));logger[_0x5e3b('0x10')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x391143,_0x5e3b('0xf'),JSON[_0x5e3b('0x11')](_0xbc1b24));if(_0xbc1b24[_0x5e3b('0x12')]){if(_0xbc1b24['error']['code']===0x1f4){logger[_0x5e3b('0x12')]('SquareMessage,\x20%s,\x20%s',_0x391143,_0xbc1b24[_0x5e3b('0x12')][_0x5e3b('0x13')]);return _0x10ddb6(_0xbc1b24[_0x5e3b('0x12')][_0x5e3b('0x13')]);}logger[_0x5e3b('0x12')](_0x5e3b('0xe'),_0x391143,_0xbc1b24['error'][_0x5e3b('0x13')]);return _0x5ef2a7(_0xbc1b24[_0x5e3b('0x12')][_0x5e3b('0x13')]);}else{logger[_0x5e3b('0xd')](_0x5e3b('0xe'),_0x391143,_0x5e3b('0xf'));_0x5ef2a7(_0xbc1b24[_0x5e3b('0x14')]['message']);}})['catch'](function(_0xda8fb){logger[_0x5e3b('0x12')](_0x5e3b('0xe'),_0x391143,_0xda8fb);_0x10ddb6(_0xda8fb);});});}exports[_0x5e3b('0x15')]=function(_0xb3fe0d){var _0x1f08d8=this;return new Promise(function(_0x4116de,_0x58ccc8){return db[_0x5e3b('0x16')][_0x5e3b('0x17')](_0xb3fe0d[_0x5e3b('0x18')],{'raw':_0xb3fe0d['options']?_0xb3fe0d[_0x5e3b('0x19')][_0x5e3b('0x1a')]===undefined?!![]:![]:!![]})[_0x5e3b('0xc')](function(_0x195139){logger[_0x5e3b('0xd')](_0x5e3b('0x15'),_0xb3fe0d);logger['debug']('CreateSquareMessage',_0xb3fe0d,JSON[_0x5e3b('0x11')](_0x195139));_0x4116de(_0x195139);})[_0x5e3b('0x1b')](function(_0x1a1090){logger[_0x5e3b('0x12')]('CreateSquareMessage',_0x1a1090[_0x5e3b('0x13')],_0xb3fe0d);_0x58ccc8(_0x1f08d8[_0x5e3b('0x12')](0x1f4,_0x1a1090[_0x5e3b('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 17d2f9c..f9fe57b 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 _0x8d01=['../../components/auth/service','../../components/interaction/service','./squareOdbc.controller','get','/:id','isAuthenticated','show','/:id/test','15s','test','create','put','update','delete','destroy','exports','multer','util','path','express','Router','fs-extra'];(function(_0x36dc6f,_0x4995e0){var _0x5cd4db=function(_0x1aa23e){while(--_0x1aa23e){_0x36dc6f['push'](_0x36dc6f['shift']());}};_0x5cd4db(++_0x4995e0);}(_0x8d01,0xd6));var _0x18d0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8d01[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x18d0('0x0'));var util=require(_0x18d0('0x1'));var path=require(_0x18d0('0x2'));var timeout=require('connect-timeout');var express=require(_0x18d0('0x3'));var router=express[_0x18d0('0x4')]();var fs_extra=require(_0x18d0('0x5'));var auth=require(_0x18d0('0x6'));var interaction=require(_0x18d0('0x7'));var config=require('../../config/environment');var controller=require(_0x18d0('0x8'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x18d0('0x9')](_0x18d0('0xa'),auth[_0x18d0('0xb')](),controller[_0x18d0('0xc')]);router['get'](_0x18d0('0xd'),auth[_0x18d0('0xb')](),timeout(_0x18d0('0xe')),controller[_0x18d0('0xf')]);router['post']('/',auth[_0x18d0('0xb')](),controller[_0x18d0('0x10')]);router[_0x18d0('0x11')](_0x18d0('0xa'),auth[_0x18d0('0xb')](),controller[_0x18d0('0x12')]);router[_0x18d0('0x13')](_0x18d0('0xa'),auth['isAuthenticated'](),controller[_0x18d0('0x14')]);module[_0x18d0('0x15')]=router; \ No newline at end of file +var _0x96a5=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','15s','test','create','put','update','delete','destroy','exports','multer'];(function(_0x3747ae,_0x408e61){var _0x339035=function(_0x83be87){while(--_0x83be87){_0x3747ae['push'](_0x3747ae['shift']());}};_0x339035(++_0x408e61);}(_0x96a5,0x89));var _0x596a=function(_0x2858c6,_0xf74530){_0x2858c6=_0x2858c6-0x0;var _0x58b5c0=_0x96a5[_0x2858c6];return _0x58b5c0;};'use strict';var multer=require(_0x596a('0x0'));var util=require(_0x596a('0x1'));var path=require(_0x596a('0x2'));var timeout=require(_0x596a('0x3'));var express=require(_0x596a('0x4'));var router=express[_0x596a('0x5')]();var fs_extra=require(_0x596a('0x6'));var auth=require(_0x596a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x596a('0x8'));var controller=require(_0x596a('0x9'));router[_0x596a('0xa')]('/',auth[_0x596a('0xb')](),controller[_0x596a('0xc')]);router[_0x596a('0xa')](_0x596a('0xd'),auth[_0x596a('0xb')](),controller[_0x596a('0xe')]);router[_0x596a('0xa')]('/:id/test',auth[_0x596a('0xb')](),timeout(_0x596a('0xf')),controller[_0x596a('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x596a('0x11')]);router[_0x596a('0x12')](_0x596a('0xd'),auth['isAuthenticated'](),controller[_0x596a('0x13')]);router[_0x596a('0x14')](_0x596a('0xd'),auth['isAuthenticated'](),controller[_0x596a('0x15')]);module[_0x596a('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index 8030b44..6f768e5 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 _0x8cbf=['name','exports','STRING'];(function(_0x1c5b66,_0x89c079){var _0x373f8c=function(_0x3b128d){while(--_0x3b128d){_0x1c5b66['push'](_0x1c5b66['shift']());}};_0x373f8c(++_0x89c079);}(_0x8cbf,0x15a));var _0xf8cb=function(_0x35fb5b,_0x3a2c5f){_0x35fb5b=_0x35fb5b-0x0;var _0x38f4ff=_0x8cbf[_0x35fb5b];return _0x38f4ff;};'use strict';var Sequelize=require('sequelize');module[_0xf8cb('0x0')]={'name':{'type':Sequelize[_0xf8cb('0x1')],'unique':_0xf8cb('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xf8cb('0x1')]}}; \ No newline at end of file +var _0x13fe=['name','STRING'];(function(_0x1b6186,_0x1ec7f2){var _0x186121=function(_0x1748a8){while(--_0x1748a8){_0x1b6186['push'](_0x1b6186['shift']());}};_0x186121(++_0x1ec7f2);}(_0x13fe,0xe9));var _0xe13f=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0x13fe[_0x187ee1];return _0x388160;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xe13f('0x0')],'unique':_0xe13f('0x1'),'allowNull':![]},'dsn':{'type':Sequelize[_0xe13f('0x0')]},'description':{'type':Sequelize[_0xe13f('0x0')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index bbb63cf..3c80a57 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 _0x9e4e=['update','then','destroy','get','ODBC','stack','name','send','index','SquareOdbc','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','dsn','openSync','closeSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','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','end','json','undefined','limit','count','offset','set','reject'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9e4e,0x136));var _0xe9e4=function(_0x882eb7,_0x32f637){_0x882eb7=_0x882eb7-0x0;var _0x4abcd0=_0x9e4e[_0x882eb7];return _0x4abcd0;};'use strict';var emlformat=require(_0xe9e4('0x0'));var rimraf=require(_0xe9e4('0x1'));var zipdir=require(_0xe9e4('0x2'));var jsonpatch=require(_0xe9e4('0x3'));var rp=require(_0xe9e4('0x4'));var moment=require(_0xe9e4('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xe9e4('0x6'));var util=require('util');var path=require('path');var sox=require(_0xe9e4('0x7'));var csv=require(_0xe9e4('0x8'));var ejs=require(_0xe9e4('0x9'));var fs=require('fs');var fs_extra=require(_0xe9e4('0xa'));var _=require('lodash');var squel=require(_0xe9e4('0xb'));var crypto=require(_0xe9e4('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xe9e4('0xd'));var toCsv=require(_0xe9e4('0x8'));var querystring=require(_0xe9e4('0xe'));var Papa=require(_0xe9e4('0xf'));var Redis=require('ioredis');var authService=require(_0xe9e4('0x10'));var qs=require(_0xe9e4('0x11'));var as=require(_0xe9e4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe9e4('0x13'))('api');var utils=require(_0xe9e4('0x14'));var config=require(_0xe9e4('0x15'));var licenseUtil=require(_0xe9e4('0x16'));var db=require(_0xe9e4('0x17'))['db'];function respondWithStatusCode(_0x5d2cbf,_0x5855b0){_0x5855b0=_0x5855b0||0xcc;return function(_0x40437e){if(_0x40437e){return _0x5d2cbf[_0xe9e4('0x18')](_0x5855b0);}return _0x5d2cbf[_0xe9e4('0x19')](_0x5855b0)[_0xe9e4('0x1a')]();};}function respondWithResult(_0x13d707,_0x5bef6f){_0x5bef6f=_0x5bef6f||0xc8;return function(_0x220423){if(_0x220423){return _0x13d707[_0xe9e4('0x19')](_0x5bef6f)[_0xe9e4('0x1b')](_0x220423);}};}function respondWithFilteredResult(_0x11dfc0,_0x5bc03b){return function(_0x11de69){if(_0x11de69){var _0x1da3ca=typeof _0x5bc03b['offset']===_0xe9e4('0x1c')&&typeof _0x5bc03b[_0xe9e4('0x1d')]==='undefined';var _0x445594=_0x11de69[_0xe9e4('0x1e')];var _0x854883=_0x1da3ca?0x0:_0x5bc03b[_0xe9e4('0x1f')];var _0x2743d5=_0x1da3ca?_0x11de69[_0xe9e4('0x1e')]:_0x5bc03b['offset']+_0x5bc03b['limit'];var _0xf41858;if(_0x2743d5>=_0x445594){_0x2743d5=_0x445594;_0xf41858=0xc8;}else{_0xf41858=0xce;}_0x11dfc0['status'](_0xf41858);return _0x11dfc0[_0xe9e4('0x20')]('Content-Range',_0x854883+'-'+_0x2743d5+'/'+_0x445594)[_0xe9e4('0x1b')](_0x11de69);}return null;};}function patchUpdates(_0xc26c73){return function(_0x53d1fc){try{jsonpatch['apply'](_0x53d1fc,_0xc26c73,!![]);}catch(_0x1bb040){return BPromise[_0xe9e4('0x21')](_0x1bb040);}return _0x53d1fc['save']();};}function saveUpdates(_0x4ab90c,_0x5c2e4f){return function(_0x463497){if(_0x463497){return _0x463497[_0xe9e4('0x22')](_0x4ab90c)[_0xe9e4('0x23')](function(_0x24ff42){return _0x24ff42;});}return null;};}function removeEntity(_0x1eec17,_0x29ff08){return function(_0x1c8e57){if(_0x1c8e57){return _0x1c8e57[_0xe9e4('0x24')]()[_0xe9e4('0x23')](function(){var _0x5c47c4=_0x1c8e57[_0xe9e4('0x25')]({'plain':!![]});var _0x197b45=_0xe9e4('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x197b45,'resourceId':_0x5c47c4['id']}})[_0xe9e4('0x23')](function(){return _0x1c8e57;});})['then'](function(){_0x1eec17[_0xe9e4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x29f1e9,_0x4c512f){return function(_0x5dfa53){if(!_0x5dfa53){_0x29f1e9[_0xe9e4('0x18')](0x194);}return _0x5dfa53;};}function handleError(_0xe55ed7,_0xdf7767){_0xdf7767=_0xdf7767||0x1f4;return function(_0x346c7d){logger['error'](_0x346c7d[_0xe9e4('0x27')]);if(_0x346c7d['name']){delete _0x346c7d[_0xe9e4('0x28')];}_0xe55ed7[_0xe9e4('0x19')](_0xdf7767)[_0xe9e4('0x29')](_0x346c7d);};}exports[_0xe9e4('0x2a')]=function(_0x1a8cdc,_0x551044){var _0x492eea={},_0x21d851={},_0x42fed2={'count':0x0,'rows':[]};var _0x4dd780=_['map'](db[_0xe9e4('0x2b')][_0xe9e4('0x2c')],function(_0x2d166f){return{'name':_0x2d166f[_0xe9e4('0x2d')],'type':_0x2d166f[_0xe9e4('0x2e')][_0xe9e4('0x2f')]};});_0x21d851[_0xe9e4('0x30')]=_[_0xe9e4('0x31')](_0x4dd780,_0xe9e4('0x28'));_0x21d851[_0xe9e4('0x32')]=_[_0xe9e4('0x33')](_0x1a8cdc['query']);_0x21d851['filters']=_['intersection'](_0x21d851[_0xe9e4('0x30')],_0x21d851[_0xe9e4('0x32')]);_0x492eea[_0xe9e4('0x34')]=_[_0xe9e4('0x35')](_0x21d851[_0xe9e4('0x30')],qs[_0xe9e4('0x36')](_0x1a8cdc['query'][_0xe9e4('0x36')]));_0x492eea[_0xe9e4('0x34')]=_0x492eea[_0xe9e4('0x34')][_0xe9e4('0x37')]?_0x492eea[_0xe9e4('0x34')]:_0x21d851[_0xe9e4('0x30')];if(!_0x1a8cdc['query'][_0xe9e4('0x38')](_0xe9e4('0x39'))){_0x492eea['limit']=qs[_0xe9e4('0x1d')](_0x1a8cdc[_0xe9e4('0x32')][_0xe9e4('0x1d')]);_0x492eea[_0xe9e4('0x1f')]=qs[_0xe9e4('0x1f')](_0x1a8cdc[_0xe9e4('0x32')][_0xe9e4('0x1f')]);}_0x492eea[_0xe9e4('0x3a')]=qs[_0xe9e4('0x3b')](_0x1a8cdc['query']['sort']);_0x492eea[_0xe9e4('0x3c')]=qs[_0xe9e4('0x3d')](_[_0xe9e4('0x3e')](_0x1a8cdc['query'],_0x21d851[_0xe9e4('0x3d')]),_0x4dd780);if(_0x1a8cdc['query']['filter']){_0x492eea[_0xe9e4('0x3c')]=_[_0xe9e4('0x3f')](_0x492eea[_0xe9e4('0x3c')],{'$or':_[_0xe9e4('0x31')](_0x4dd780,function(_0x12069f){if(_0x12069f['type']!==_0xe9e4('0x40')){var _0x35480b={};_0x35480b[_0x12069f[_0xe9e4('0x28')]]={'$like':'%'+_0x1a8cdc[_0xe9e4('0x32')]['filter']+'%'};return _0x35480b;}})});}_0x492eea=_[_0xe9e4('0x3f')]({},_0x492eea,_0x1a8cdc[_0xe9e4('0x41')]);var _0x89e36a={'where':_0x492eea[_0xe9e4('0x3c')]};return db['SquareOdbc'][_0xe9e4('0x1e')](_0x89e36a)[_0xe9e4('0x23')](function(_0x2fe003){_0x42fed2[_0xe9e4('0x1e')]=_0x2fe003;if(_0x1a8cdc['query'][_0xe9e4('0x42')]){_0x492eea[_0xe9e4('0x43')]=[{'all':!![]}];}return db[_0xe9e4('0x2b')][_0xe9e4('0x44')](_0x492eea);})[_0xe9e4('0x23')](function(_0x5905a1){_0x42fed2[_0xe9e4('0x45')]=_0x5905a1;return _0x42fed2;})[_0xe9e4('0x23')](respondWithFilteredResult(_0x551044,_0x492eea))[_0xe9e4('0x46')](handleError(_0x551044,null));};exports[_0xe9e4('0x47')]=function(_0x3c2021,_0x5d1c5d){var _0x7a4424={'raw':!![],'where':{'id':_0x3c2021['params']['id']}},_0x585932={};_0x585932[_0xe9e4('0x30')]=_[_0xe9e4('0x33')](db['SquareOdbc'][_0xe9e4('0x2c')]);_0x585932[_0xe9e4('0x32')]=_['keys'](_0x3c2021[_0xe9e4('0x32')]);_0x585932[_0xe9e4('0x3d')]=_['intersection'](_0x585932[_0xe9e4('0x30')],_0x585932[_0xe9e4('0x32')]);_0x7a4424[_0xe9e4('0x34')]=_['intersection'](_0x585932[_0xe9e4('0x30')],qs[_0xe9e4('0x36')](_0x3c2021[_0xe9e4('0x32')][_0xe9e4('0x36')]));_0x7a4424[_0xe9e4('0x34')]=_0x7a4424['attributes'][_0xe9e4('0x37')]?_0x7a4424[_0xe9e4('0x34')]:_0x585932[_0xe9e4('0x30')];if(_0x3c2021['query']['includeAll']){_0x7a4424[_0xe9e4('0x43')]=[{'all':!![]}];}_0x7a4424=_['merge']({},_0x7a4424,_0x3c2021[_0xe9e4('0x41')]);return db[_0xe9e4('0x2b')][_0xe9e4('0x48')](_0x7a4424)[_0xe9e4('0x23')](handleEntityNotFound(_0x5d1c5d,null))['then'](respondWithResult(_0x5d1c5d,null))[_0xe9e4('0x46')](handleError(_0x5d1c5d,null));};exports[_0xe9e4('0x49')]=function(_0x467765,_0x35ed16){return db[_0xe9e4('0x2b')]['create'](_0x467765[_0xe9e4('0x4a')],{})[_0xe9e4('0x23')](function(_0x4b7cc3){var _0x55fb63=_0x467765['user']['get']({'plain':!![]});if(!_0x55fb63)throw new Error(_0xe9e4('0x4b'));if(_0x55fb63[_0xe9e4('0x4c')]===_0xe9e4('0x4d')){var _0x33b25b=_0x4b7cc3[_0xe9e4('0x25')]({'plain':!![]});var _0x4d128d='ODBC';return db[_0xe9e4('0x4e')][_0xe9e4('0x48')]({'where':{'name':_0x4d128d,'userProfileId':_0x55fb63[_0xe9e4('0x4f')]},'raw':!![]})[_0xe9e4('0x23')](function(_0x2c5b40){if(_0x2c5b40&&_0x2c5b40['autoAssociation']===0x0){return db['UserProfileResource'][_0xe9e4('0x49')]({'name':_0x33b25b[_0xe9e4('0x28')],'resourceId':_0x33b25b['id'],'type':_0x2c5b40[_0xe9e4('0x28')],'sectionId':_0x2c5b40['id']},{})['then'](function(){return _0x4b7cc3;});}else{return _0x4b7cc3;}})[_0xe9e4('0x46')](function(_0x463f1a){logger[_0xe9e4('0x50')](_0xe9e4('0x51'),_0x463f1a);throw _0x463f1a;});}return _0x4b7cc3;})['then'](respondWithResult(_0x35ed16,0xc9))['catch'](handleError(_0x35ed16,null));};exports['update']=function(_0x44afe8,_0x30726c){if(_0x44afe8[_0xe9e4('0x4a')]['id']){delete _0x44afe8[_0xe9e4('0x4a')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x44afe8[_0xe9e4('0x52')]['id']}})[_0xe9e4('0x23')](handleEntityNotFound(_0x30726c,null))[_0xe9e4('0x23')](saveUpdates(_0x44afe8[_0xe9e4('0x4a')],null))[_0xe9e4('0x23')](respondWithResult(_0x30726c,null))[_0xe9e4('0x46')](handleError(_0x30726c,null));};exports['destroy']=function(_0x7fdd58,_0xb7ac04){return db[_0xe9e4('0x2b')][_0xe9e4('0x48')]({'where':{'id':_0x7fdd58['params']['id']}})['then'](handleEntityNotFound(_0xb7ac04,null))[_0xe9e4('0x23')](removeEntity(_0xb7ac04,null))[_0xe9e4('0x46')](handleError(_0xb7ac04,null));};exports['test']=function(_0x21aeee,_0x5ad107,_0x25e88b){var _0x333c6d;return db[_0xe9e4('0x2b')][_0xe9e4('0x48')]({'where':{'id':_0x21aeee[_0xe9e4('0x52')]['id']},'attributes':['id',_0xe9e4('0x53')]})['then'](handleEntityNotFound(_0x5ad107,null))[_0xe9e4('0x23')](function(_0x9a1c97){if(_0x9a1c97){var _0x592059=require('odbc')();_0x592059[_0xe9e4('0x54')](_0x9a1c97['dsn']);_0x592059[_0xe9e4('0x55')]();return _0x9a1c97;}})['then'](respondWithResult(_0x5ad107,null))[_0xe9e4('0x46')](handleError(_0x5ad107,null));}; \ No newline at end of file +var _0x22ed=['jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/qs','../../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','reject','save','update','then','destroy','get','ODBC','sendStatus','name','send','index','map','SquareOdbc','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','includeAll','include','findAll','catch','params','options','create','body','user','role','find','autoAssociation','error','test','dsn','odbc','openSync','closeSync','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','fs-extra','lodash','crypto'];(function(_0x2a445b,_0x29b6e2){var _0x1eb715=function(_0x2e1914){while(--_0x2e1914){_0x2a445b['push'](_0x2a445b['shift']());}};_0x1eb715(++_0x29b6e2);}(_0x22ed,0xf2));var _0xd22e=function(_0x2220f0,_0x4d89ff){_0x2220f0=_0x2220f0-0x0;var _0x31dcda=_0x22ed[_0x2220f0];return _0x31dcda;};'use strict';var emlformat=require(_0xd22e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xd22e('0x1'));var jsonpatch=require(_0xd22e('0x2'));var rp=require(_0xd22e('0x3'));var moment=require(_0xd22e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xd22e('0x5'));var util=require(_0xd22e('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(_0xd22e('0x7'));var _=require(_0xd22e('0x8'));var squel=require('squel');var crypto=require(_0xd22e('0x9'));var jsforce=require(_0xd22e('0xa'));var deskjs=require(_0xd22e('0xb'));var toCsv=require(_0xd22e('0xc'));var querystring=require('querystring');var Papa=require(_0xd22e('0xd'));var Redis=require(_0xd22e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xd22e('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd22e('0x10'));var logger=require(_0xd22e('0x11'))(_0xd22e('0x12'));var utils=require(_0xd22e('0x13'));var config=require(_0xd22e('0x14'));var licenseUtil=require(_0xd22e('0x15'));var db=require(_0xd22e('0x16'))['db'];function respondWithStatusCode(_0x568c3f,_0x3a3860){_0x3a3860=_0x3a3860||0xcc;return function(_0x3a4eab){if(_0x3a4eab){return _0x568c3f['sendStatus'](_0x3a3860);}return _0x568c3f[_0xd22e('0x17')](_0x3a3860)[_0xd22e('0x18')]();};}function respondWithResult(_0x19068d,_0x496135){_0x496135=_0x496135||0xc8;return function(_0xba8d8f){if(_0xba8d8f){return _0x19068d[_0xd22e('0x17')](_0x496135)['json'](_0xba8d8f);}};}function respondWithFilteredResult(_0x15596b,_0x53c1af){return function(_0xcac5b4){if(_0xcac5b4){var _0x13a21d=typeof _0x53c1af[_0xd22e('0x19')]===_0xd22e('0x1a')&&typeof _0x53c1af[_0xd22e('0x1b')]===_0xd22e('0x1a');var _0x25b8ce=_0xcac5b4['count'];var _0x316994=_0x13a21d?0x0:_0x53c1af[_0xd22e('0x19')];var _0x45f1d2=_0x13a21d?_0xcac5b4[_0xd22e('0x1c')]:_0x53c1af[_0xd22e('0x19')]+_0x53c1af[_0xd22e('0x1b')];var _0x1febf3;if(_0x45f1d2>=_0x25b8ce){_0x45f1d2=_0x25b8ce;_0x1febf3=0xc8;}else{_0x1febf3=0xce;}_0x15596b[_0xd22e('0x17')](_0x1febf3);return _0x15596b[_0xd22e('0x1d')](_0xd22e('0x1e'),_0x316994+'-'+_0x45f1d2+'/'+_0x25b8ce)[_0xd22e('0x1f')](_0xcac5b4);}return null;};}function patchUpdates(_0x5219e5){return function(_0x620c69){try{jsonpatch[_0xd22e('0x20')](_0x620c69,_0x5219e5,!![]);}catch(_0x3a4ba2){return BPromise[_0xd22e('0x21')](_0x3a4ba2);}return _0x620c69[_0xd22e('0x22')]();};}function saveUpdates(_0x5de316,_0x4182d4){return function(_0x832a7){if(_0x832a7){return _0x832a7[_0xd22e('0x23')](_0x5de316)[_0xd22e('0x24')](function(_0x19950e){return _0x19950e;});}return null;};}function removeEntity(_0x5851e9,_0x5495d7){return function(_0x3e046d){if(_0x3e046d){return _0x3e046d[_0xd22e('0x25')]()[_0xd22e('0x24')](function(){var _0x3f3581=_0x3e046d[_0xd22e('0x26')]({'plain':!![]});var _0x5e4852=_0xd22e('0x27');return db['UserProfileResource'][_0xd22e('0x25')]({'where':{'type':_0x5e4852,'resourceId':_0x3f3581['id']}})[_0xd22e('0x24')](function(){return _0x3e046d;});})[_0xd22e('0x24')](function(){_0x5851e9['status'](0xcc)[_0xd22e('0x18')]();});}};}function handleEntityNotFound(_0x2f9511,_0x2b759d){return function(_0x2f0580){if(!_0x2f0580){_0x2f9511[_0xd22e('0x28')](0x194);}return _0x2f0580;};}function handleError(_0x559f32,_0x158390){_0x158390=_0x158390||0x1f4;return function(_0x8ac3d7){logger['error'](_0x8ac3d7['stack']);if(_0x8ac3d7[_0xd22e('0x29')]){delete _0x8ac3d7[_0xd22e('0x29')];}_0x559f32[_0xd22e('0x17')](_0x158390)[_0xd22e('0x2a')](_0x8ac3d7);};}exports[_0xd22e('0x2b')]=function(_0x4c74ae,_0x1a22d6){var _0x30d816={},_0x3ac9fa={},_0x22c1f2={'count':0x0,'rows':[]};var _0x30014e=_[_0xd22e('0x2c')](db[_0xd22e('0x2d')][_0xd22e('0x2e')],function(_0xec145){return{'name':_0xec145[_0xd22e('0x2f')],'type':_0xec145['type'][_0xd22e('0x30')]};});_0x3ac9fa[_0xd22e('0x31')]=_[_0xd22e('0x2c')](_0x30014e,_0xd22e('0x29'));_0x3ac9fa[_0xd22e('0x32')]=_[_0xd22e('0x33')](_0x4c74ae[_0xd22e('0x32')]);_0x3ac9fa['filters']=_['intersection'](_0x3ac9fa[_0xd22e('0x31')],_0x3ac9fa[_0xd22e('0x32')]);_0x30d816[_0xd22e('0x34')]=_[_0xd22e('0x35')](_0x3ac9fa[_0xd22e('0x31')],qs[_0xd22e('0x36')](_0x4c74ae[_0xd22e('0x32')]['fields']));_0x30d816[_0xd22e('0x34')]=_0x30d816[_0xd22e('0x34')][_0xd22e('0x37')]?_0x30d816[_0xd22e('0x34')]:_0x3ac9fa[_0xd22e('0x31')];if(!_0x4c74ae['query'][_0xd22e('0x38')]('nolimit')){_0x30d816[_0xd22e('0x1b')]=qs[_0xd22e('0x1b')](_0x4c74ae[_0xd22e('0x32')][_0xd22e('0x1b')]);_0x30d816[_0xd22e('0x19')]=qs[_0xd22e('0x19')](_0x4c74ae[_0xd22e('0x32')][_0xd22e('0x19')]);}_0x30d816[_0xd22e('0x39')]=qs[_0xd22e('0x3a')](_0x4c74ae[_0xd22e('0x32')][_0xd22e('0x3a')]);_0x30d816['where']=qs[_0xd22e('0x3b')](_[_0xd22e('0x3c')](_0x4c74ae['query'],_0x3ac9fa['filters']),_0x30014e);if(_0x4c74ae[_0xd22e('0x32')][_0xd22e('0x3d')]){_0x30d816[_0xd22e('0x3e')]=_[_0xd22e('0x3f')](_0x30d816['where'],{'$or':_['map'](_0x30014e,function(_0x5d1f81){if(_0x5d1f81[_0xd22e('0x40')]!==_0xd22e('0x41')){var _0xc5ce38={};_0xc5ce38[_0x5d1f81[_0xd22e('0x29')]]={'$like':'%'+_0x4c74ae[_0xd22e('0x32')][_0xd22e('0x3d')]+'%'};return _0xc5ce38;}})});}_0x30d816=_[_0xd22e('0x3f')]({},_0x30d816,_0x4c74ae['options']);var _0x3bb881={'where':_0x30d816[_0xd22e('0x3e')]};return db['SquareOdbc'][_0xd22e('0x1c')](_0x3bb881)[_0xd22e('0x24')](function(_0x559f89){_0x22c1f2[_0xd22e('0x1c')]=_0x559f89;if(_0x4c74ae[_0xd22e('0x32')][_0xd22e('0x42')]){_0x30d816[_0xd22e('0x43')]=[{'all':!![]}];}return db['SquareOdbc'][_0xd22e('0x44')](_0x30d816);})[_0xd22e('0x24')](function(_0x5e797d){_0x22c1f2['rows']=_0x5e797d;return _0x22c1f2;})[_0xd22e('0x24')](respondWithFilteredResult(_0x1a22d6,_0x30d816))[_0xd22e('0x45')](handleError(_0x1a22d6,null));};exports['show']=function(_0x1b855d,_0x48159b){var _0x3292ba={'raw':!![],'where':{'id':_0x1b855d[_0xd22e('0x46')]['id']}},_0x5e250e={};_0x5e250e['model']=_['keys'](db[_0xd22e('0x2d')]['rawAttributes']);_0x5e250e[_0xd22e('0x32')]=_[_0xd22e('0x33')](_0x1b855d[_0xd22e('0x32')]);_0x5e250e[_0xd22e('0x3b')]=_['intersection'](_0x5e250e[_0xd22e('0x31')],_0x5e250e[_0xd22e('0x32')]);_0x3292ba[_0xd22e('0x34')]=_[_0xd22e('0x35')](_0x5e250e['model'],qs[_0xd22e('0x36')](_0x1b855d['query'][_0xd22e('0x36')]));_0x3292ba['attributes']=_0x3292ba['attributes'][_0xd22e('0x37')]?_0x3292ba[_0xd22e('0x34')]:_0x5e250e['model'];if(_0x1b855d[_0xd22e('0x32')]['includeAll']){_0x3292ba[_0xd22e('0x43')]=[{'all':!![]}];}_0x3292ba=_[_0xd22e('0x3f')]({},_0x3292ba,_0x1b855d[_0xd22e('0x47')]);return db[_0xd22e('0x2d')]['find'](_0x3292ba)[_0xd22e('0x24')](handleEntityNotFound(_0x48159b,null))[_0xd22e('0x24')](respondWithResult(_0x48159b,null))[_0xd22e('0x45')](handleError(_0x48159b,null));};exports[_0xd22e('0x48')]=function(_0x3740f7,_0x4f8ea7){return db[_0xd22e('0x2d')][_0xd22e('0x48')](_0x3740f7[_0xd22e('0x49')],{})[_0xd22e('0x24')](function(_0xe18662){var _0x5ab234=_0x3740f7[_0xd22e('0x4a')]['get']({'plain':!![]});if(!_0x5ab234)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5ab234[_0xd22e('0x4b')]===_0xd22e('0x4a')){var _0x40988f=_0xe18662[_0xd22e('0x26')]({'plain':!![]});var _0x2462d6=_0xd22e('0x27');return db['UserProfileSection'][_0xd22e('0x4c')]({'where':{'name':_0x2462d6,'userProfileId':_0x5ab234['userProfileId']},'raw':!![]})[_0xd22e('0x24')](function(_0x1fc844){if(_0x1fc844&&_0x1fc844[_0xd22e('0x4d')]===0x0){return db['UserProfileResource']['create']({'name':_0x40988f[_0xd22e('0x29')],'resourceId':_0x40988f['id'],'type':_0x1fc844[_0xd22e('0x29')],'sectionId':_0x1fc844['id']},{})[_0xd22e('0x24')](function(){return _0xe18662;});}else{return _0xe18662;}})[_0xd22e('0x45')](function(_0x105c24){logger[_0xd22e('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x105c24);throw _0x105c24;});}return _0xe18662;})[_0xd22e('0x24')](respondWithResult(_0x4f8ea7,0xc9))[_0xd22e('0x45')](handleError(_0x4f8ea7,null));};exports[_0xd22e('0x23')]=function(_0x3fad40,_0x384af8){if(_0x3fad40[_0xd22e('0x49')]['id']){delete _0x3fad40[_0xd22e('0x49')]['id'];}return db[_0xd22e('0x2d')][_0xd22e('0x4c')]({'where':{'id':_0x3fad40[_0xd22e('0x46')]['id']}})[_0xd22e('0x24')](handleEntityNotFound(_0x384af8,null))['then'](saveUpdates(_0x3fad40[_0xd22e('0x49')],null))[_0xd22e('0x24')](respondWithResult(_0x384af8,null))[_0xd22e('0x45')](handleError(_0x384af8,null));};exports[_0xd22e('0x25')]=function(_0x12827c,_0xcb24bf){return db[_0xd22e('0x2d')][_0xd22e('0x4c')]({'where':{'id':_0x12827c[_0xd22e('0x46')]['id']}})[_0xd22e('0x24')](handleEntityNotFound(_0xcb24bf,null))[_0xd22e('0x24')](removeEntity(_0xcb24bf,null))[_0xd22e('0x45')](handleError(_0xcb24bf,null));};exports[_0xd22e('0x4f')]=function(_0x3eca29,_0x2f1c73,_0xc7ef49){var _0x4292f0;return db[_0xd22e('0x2d')]['find']({'where':{'id':_0x3eca29[_0xd22e('0x46')]['id']},'attributes':['id',_0xd22e('0x50')]})[_0xd22e('0x24')](handleEntityNotFound(_0x2f1c73,null))[_0xd22e('0x24')](function(_0x2e7d4d){if(_0x2e7d4d){var _0x257e11=require(_0xd22e('0x51'))();_0x257e11[_0xd22e('0x52')](_0x2e7d4d[_0xd22e('0x50')]);_0x257e11[_0xd22e('0x53')]();return _0x2e7d4d;}})[_0xd22e('0x24')](respondWithResult(_0x2f1c73,null))['catch'](handleError(_0x2f1c73,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index 0ad0223..bf819b8 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 _0xfb93=['api','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','lodash','../../config/logger'];(function(_0x82d4ef,_0x4e7b38){var _0x5c3062=function(_0x2d544b){while(--_0x2d544b){_0x82d4ef['push'](_0x82d4ef['shift']());}};_0x5c3062(++_0x4e7b38);}(_0xfb93,0xa9));var _0x3fb9=function(_0xe441a6,_0x3459f6){_0xe441a6=_0xe441a6-0x0;var _0x5faec8=_0xfb93[_0xe441a6];return _0x5faec8;};'use strict';var _=require(_0x3fb9('0x0'));var util=require('util');var logger=require(_0x3fb9('0x1'))(_0x3fb9('0x2'));var moment=require('moment');var BPromise=require(_0x3fb9('0x3'));var rp=require(_0x3fb9('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x3fb9('0x5'));var config=require(_0x3fb9('0x6'));var attributes=require(_0x3fb9('0x7'));module[_0x3fb9('0x8')]=function(_0x5ec95f,_0x1e94ea){return _0x5ec95f['define']('SquareOdbc',attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1ee1=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','SquareOdbc','lodash'];(function(_0x12296c,_0x417890){var _0x16b990=function(_0x2b9d10){while(--_0x2b9d10){_0x12296c['push'](_0x12296c['shift']());}};_0x16b990(++_0x417890);}(_0x1ee1,0x117));var _0x11ee=function(_0x544b1e,_0x3c7aef){_0x544b1e=_0x544b1e-0x0;var _0x152b8b=_0x1ee1[_0x544b1e];return _0x152b8b;};'use strict';var _=require(_0x11ee('0x0'));var util=require('util');var logger=require(_0x11ee('0x1'))(_0x11ee('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x11ee('0x3'));var fs=require('fs');var path=require(_0x11ee('0x4'));var rimraf=require(_0x11ee('0x5'));var config=require(_0x11ee('0x6'));var attributes=require('./squareOdbc.attributes');module[_0x11ee('0x7')]=function(_0x39ff9d,_0x5759b2){return _0x39ff9d[_0x11ee('0x8')](_0x11ee('0x9'),attributes,{'tableName':'square_odbc','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 b1210d5..bb2aa3e 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 _0x35c5=['stringify','error','code','message','ShowSquareOdbc','SquareOdbc','find','options','raw','where','attributes','include','model','map','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../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'];(function(_0x4e37ac,_0xcd9391){var _0x3d2da7=function(_0x6168fb){while(--_0x6168fb){_0x4e37ac['push'](_0x4e37ac['shift']());}};_0x3d2da7(++_0xcd9391);}(_0x35c5,0x159));var _0x535c=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0x35c5[_0x5bd426];return _0x23a7eb;};'use strict';var _=require(_0x535c('0x0'));var util=require(_0x535c('0x1'));var moment=require(_0x535c('0x2'));var BPromise=require(_0x535c('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x535c('0x4'));var db=require(_0x535c('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x535c('0x6'))(_0x535c('0x7'));var config=require(_0x535c('0x8'));var jayson=require(_0x535c('0x9'));var client=jayson[_0x535c('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1edec5,_0x49b7a5,_0x108166){return new BPromise(function(_0x165a4b,_0x1cebd6){return client[_0x535c('0xb')](_0x1edec5,_0x108166)[_0x535c('0xc')](function(_0xc02d32){logger[_0x535c('0xd')](_0x535c('0xe'),_0x49b7a5,_0x535c('0xf'));logger[_0x535c('0x10')](_0x535c('0x11'),_0x49b7a5,_0x535c('0xf'),JSON[_0x535c('0x12')](_0xc02d32));if(_0xc02d32[_0x535c('0x13')]){if(_0xc02d32[_0x535c('0x13')][_0x535c('0x14')]===0x1f4){logger[_0x535c('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x49b7a5,_0xc02d32[_0x535c('0x13')][_0x535c('0x15')]);return _0x1cebd6(_0xc02d32[_0x535c('0x13')]['message']);}logger[_0x535c('0x13')](_0x535c('0xe'),_0x49b7a5,_0xc02d32[_0x535c('0x13')]['message']);return _0x165a4b(_0xc02d32[_0x535c('0x13')][_0x535c('0x15')]);}else{logger[_0x535c('0xd')](_0x535c('0xe'),_0x49b7a5,_0x535c('0xf'));_0x165a4b(_0xc02d32['result']['message']);}})['catch'](function(_0x558a93){logger[_0x535c('0x13')]('SquareOdbc,\x20%s,\x20%s',_0x49b7a5,_0x558a93);_0x1cebd6(_0x558a93);});});}exports[_0x535c('0x16')]=function(_0x29584a){var _0x5bef69=this;return new Promise(function(_0x5c6dca,_0x10341e){return db[_0x535c('0x17')][_0x535c('0x18')]({'raw':_0x29584a[_0x535c('0x19')]?_0x29584a[_0x535c('0x19')][_0x535c('0x1a')]===undefined?!![]:![]:!![],'where':_0x29584a['options']?_0x29584a[_0x535c('0x19')][_0x535c('0x1b')]||null:null,'attributes':_0x29584a[_0x535c('0x19')]?_0x29584a[_0x535c('0x19')][_0x535c('0x1c')]||null:null,'include':_0x29584a[_0x535c('0x19')]?_0x29584a[_0x535c('0x19')][_0x535c('0x1d')]?_['map'](_0x29584a[_0x535c('0x19')][_0x535c('0x1d')],function(_0x5eb988){return{'model':db[_0x5eb988[_0x535c('0x1e')]],'as':_0x5eb988['as'],'attributes':_0x5eb988[_0x535c('0x1c')],'include':_0x5eb988['include']?_[_0x535c('0x1f')](_0x5eb988[_0x535c('0x1d')],function(_0x403563){return{'model':db[_0x403563['model']],'as':_0x403563['as'],'attributes':_0x403563[_0x535c('0x1c')],'include':_0x403563[_0x535c('0x1d')]?_[_0x535c('0x1f')](_0x403563[_0x535c('0x1d')],function(_0x32553b){return{'model':db[_0x32553b[_0x535c('0x1e')]],'as':_0x32553b['as'],'attributes':_0x32553b[_0x535c('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3d5097){logger[_0x535c('0xd')](_0x535c('0x16'),_0x29584a);logger[_0x535c('0x10')](_0x535c('0x16'),_0x29584a,JSON['stringify'](_0x3d5097));_0x5c6dca(_0x3d5097);})[_0x535c('0x20')](function(_0x2e1192){logger['error'](_0x535c('0x16'),_0x2e1192[_0x535c('0x15')],_0x29584a);_0x10341e(_0x5bef69['error'](0x1f4,_0x2e1192[_0x535c('0x15')]));});});}; \ No newline at end of file +var _0xf4fc=['SquareOdbc','find','raw','options','map','include','attributes','model','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','debug','request\x20sent','stringify','error','code','SquareOdbc,\x20%s,\x20%s','message','catch','ShowSquareOdbc'];(function(_0x21c8e7,_0x89957){var _0x57885f=function(_0x46ab43){while(--_0x46ab43){_0x21c8e7['push'](_0x21c8e7['shift']());}};_0x57885f(++_0x89957);}(_0xf4fc,0x1ba));var _0xcf4f=function(_0xc97c9c,_0x438cdc){_0xc97c9c=_0xc97c9c-0x0;var _0x4c9165=_0xf4fc[_0xc97c9c];return _0x4c9165;};'use strict';var _=require(_0xcf4f('0x0'));var util=require(_0xcf4f('0x1'));var moment=require(_0xcf4f('0x2'));var BPromise=require('bluebird');var rs=require(_0xcf4f('0x3'));var fs=require('fs');var Redis=require(_0xcf4f('0x4'));var db=require(_0xcf4f('0x5'))['db'];var utils=require(_0xcf4f('0x6'));var logger=require(_0xcf4f('0x7'))('rpc');var config=require(_0xcf4f('0x8'));var jayson=require(_0xcf4f('0x9'));var client=jayson[_0xcf4f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x413373,_0x353bf8,_0x4519a8){return new BPromise(function(_0x8e73ac,_0x41746e){return client[_0xcf4f('0xb')](_0x413373,_0x4519a8)[_0xcf4f('0xc')](function(_0x51bf39){logger[_0xcf4f('0xd')]('SquareOdbc,\x20%s,\x20%s',_0x353bf8,'request\x20sent');logger[_0xcf4f('0xe')]('SquareOdbc,\x20%s,\x20%s,\x20%s',_0x353bf8,_0xcf4f('0xf'),JSON[_0xcf4f('0x10')](_0x51bf39));if(_0x51bf39[_0xcf4f('0x11')]){if(_0x51bf39[_0xcf4f('0x11')][_0xcf4f('0x12')]===0x1f4){logger[_0xcf4f('0x11')]('SquareOdbc,\x20%s,\x20%s',_0x353bf8,_0x51bf39[_0xcf4f('0x11')]['message']);return _0x41746e(_0x51bf39[_0xcf4f('0x11')]['message']);}logger[_0xcf4f('0x11')](_0xcf4f('0x13'),_0x353bf8,_0x51bf39['error']['message']);return _0x8e73ac(_0x51bf39[_0xcf4f('0x11')]['message']);}else{logger[_0xcf4f('0xd')](_0xcf4f('0x13'),_0x353bf8,_0xcf4f('0xf'));_0x8e73ac(_0x51bf39['result'][_0xcf4f('0x14')]);}})[_0xcf4f('0x15')](function(_0x181f87){logger[_0xcf4f('0x11')](_0xcf4f('0x13'),_0x353bf8,_0x181f87);_0x41746e(_0x181f87);});});}exports[_0xcf4f('0x16')]=function(_0x3dd10f){var _0x55d875=this;return new Promise(function(_0x19ad36,_0x31ffa3){return db[_0xcf4f('0x17')][_0xcf4f('0x18')]({'raw':_0x3dd10f['options']?_0x3dd10f['options'][_0xcf4f('0x19')]===undefined?!![]:![]:!![],'where':_0x3dd10f[_0xcf4f('0x1a')]?_0x3dd10f[_0xcf4f('0x1a')]['where']||null:null,'attributes':_0x3dd10f[_0xcf4f('0x1a')]?_0x3dd10f[_0xcf4f('0x1a')]['attributes']||null:null,'include':_0x3dd10f[_0xcf4f('0x1a')]?_0x3dd10f['options']['include']?_[_0xcf4f('0x1b')](_0x3dd10f[_0xcf4f('0x1a')][_0xcf4f('0x1c')],function(_0x28bf05){return{'model':db[_0x28bf05['model']],'as':_0x28bf05['as'],'attributes':_0x28bf05[_0xcf4f('0x1d')],'include':_0x28bf05[_0xcf4f('0x1c')]?_[_0xcf4f('0x1b')](_0x28bf05[_0xcf4f('0x1c')],function(_0x2213c1){return{'model':db[_0x2213c1['model']],'as':_0x2213c1['as'],'attributes':_0x2213c1['attributes'],'include':_0x2213c1[_0xcf4f('0x1c')]?_[_0xcf4f('0x1b')](_0x2213c1[_0xcf4f('0x1c')],function(_0x536431){return{'model':db[_0x536431[_0xcf4f('0x1e')]],'as':_0x536431['as'],'attributes':_0x536431[_0xcf4f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xcf4f('0xc')](function(_0xc21f34){logger[_0xcf4f('0xd')](_0xcf4f('0x16'),_0x3dd10f);logger[_0xcf4f('0xe')](_0xcf4f('0x16'),_0x3dd10f,JSON[_0xcf4f('0x10')](_0xc21f34));_0x19ad36(_0xc21f34);})[_0xcf4f('0x15')](function(_0x5657a5){logger['error'](_0xcf4f('0x16'),_0x5657a5[_0xcf4f('0x14')],_0x3dd10f);_0x31ffa3(_0x55d875['error'](0x1f4,_0x5657a5[_0xcf4f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 4fcf03a..b868c87 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 _0x1541=['put','update','delete','destroy','removeUsers','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get','/:id','isAuthenticated','show','post','create','/:id/users'];(function(_0x5482f4,_0x150cac){var _0x42d1ec=function(_0x2d3af5){while(--_0x2d3af5){_0x5482f4['push'](_0x5482f4['shift']());}};_0x42d1ec(++_0x150cac);}(_0x1541,0xb9));var _0x1154=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x1541[_0x92c450];return _0x2a9599;};'use strict';var multer=require('multer');var util=require(_0x1154('0x0'));var path=require('path');var timeout=require(_0x1154('0x1'));var express=require('express');var router=express[_0x1154('0x2')]();var fs_extra=require(_0x1154('0x3'));var auth=require(_0x1154('0x4'));var interaction=require(_0x1154('0x5'));var config=require(_0x1154('0x6'));var controller=require(_0x1154('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x1154('0x8')](_0x1154('0x9'),auth[_0x1154('0xa')](),controller[_0x1154('0xb')]);router[_0x1154('0x8')]('/:id/users',auth['isAuthenticated'](),controller['getUsers']);router[_0x1154('0xc')]('/',auth['isAuthenticated'](),controller[_0x1154('0xd')]);router[_0x1154('0xc')](_0x1154('0xe'),auth[_0x1154('0xa')](),controller['addUsers']);router[_0x1154('0xf')](_0x1154('0x9'),auth[_0x1154('0xa')](),controller[_0x1154('0x10')]);router[_0x1154('0x11')](_0x1154('0x9'),auth[_0x1154('0xa')](),controller[_0x1154('0x12')]);router['delete'](_0x1154('0xe'),auth['isAuthenticated'](),controller[_0x1154('0x13')]);module['exports']=router; \ No newline at end of file +var _0x48bc=['put','update','delete','destroy','removeUsers','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','isAuthenticated','get','/:id','show','/:id/users','post','create','addUsers'];(function(_0x113324,_0x273ee0){var _0x29604d=function(_0x45feab){while(--_0x45feab){_0x113324['push'](_0x113324['shift']());}};_0x29604d(++_0x273ee0);}(_0x48bc,0x1b6));var _0xc48b=function(_0x21f4b1,_0x4b136e){_0x21f4b1=_0x21f4b1-0x0;var _0x57b9e8=_0x48bc[_0x21f4b1];return _0x57b9e8;};'use strict';var multer=require(_0xc48b('0x0'));var util=require(_0xc48b('0x1'));var path=require(_0xc48b('0x2'));var timeout=require('connect-timeout');var express=require(_0xc48b('0x3'));var router=express[_0xc48b('0x4')]();var fs_extra=require(_0xc48b('0x5'));var auth=require(_0xc48b('0x6'));var interaction=require(_0xc48b('0x7'));var config=require(_0xc48b('0x8'));var controller=require(_0xc48b('0x9'));router['get']('/',auth[_0xc48b('0xa')](),controller['index']);router[_0xc48b('0xb')](_0xc48b('0xc'),auth['isAuthenticated'](),controller[_0xc48b('0xd')]);router['get'](_0xc48b('0xe'),auth[_0xc48b('0xa')](),controller['getUsers']);router[_0xc48b('0xf')]('/',auth[_0xc48b('0xa')](),controller[_0xc48b('0x10')]);router[_0xc48b('0xf')](_0xc48b('0xe'),auth[_0xc48b('0xa')](),controller[_0xc48b('0x11')]);router[_0xc48b('0x12')](_0xc48b('0xc'),auth[_0xc48b('0xa')](),controller[_0xc48b('0x13')]);router[_0xc48b('0x14')]('/:id',auth[_0xc48b('0xa')](),controller[_0xc48b('0x15')]);router[_0xc48b('0x14')]('/:id/users',auth[_0xc48b('0xa')](),controller[_0xc48b('0x16')]);module[_0xc48b('0x17')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index 636f8cb..d3f5e80 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 _0x9fee=['production','toString','DATE','exports','STRING','TEXT','BLOB','long','getDataValue','preproduction','utf8'];(function(_0xdf2886,_0x137591){var _0x5866f1=function(_0x376f38){while(--_0x376f38){_0xdf2886['push'](_0xdf2886['shift']());}};_0x5866f1(++_0x137591);}(_0x9fee,0x1e7));var _0xe9fe=function(_0x597a04,_0x3d8c84){_0x597a04=_0x597a04-0x0;var _0x3099fe=_0x9fee[_0x597a04];return _0x3099fe;};'use strict';var Sequelize=require('sequelize');module[_0xe9fe('0x0')]={'name':{'type':Sequelize[_0xe9fe('0x1')],'unique':'name','allowNull':![]},'description':{'type':Sequelize['STRING']},'notes':{'type':Sequelize[_0xe9fe('0x2')]},'preproduction':{'type':Sequelize[_0xe9fe('0x3')](_0xe9fe('0x4')),'get':function(){if(this[_0xe9fe('0x5')](_0xe9fe('0x6'))){return this[_0xe9fe('0x5')](_0xe9fe('0x6'))['toString'](_0xe9fe('0x7'));}}},'production':{'type':Sequelize[_0xe9fe('0x3')](_0xe9fe('0x4')),'get':function(){if(this['getDataValue'](_0xe9fe('0x8'))){return this[_0xe9fe('0x5')](_0xe9fe('0x8'))[_0xe9fe('0x9')](_0xe9fe('0x7'));}}},'savedAt':{'type':Sequelize[_0xe9fe('0xa')]},'publishedAt':{'type':Sequelize[_0xe9fe('0xa')]}}; \ No newline at end of file +var _0x2d85=['BLOB','getDataValue','preproduction','utf8','long','DATE','sequelize','exports','STRING','name'];(function(_0x2bed0c,_0xab68d5){var _0x52dbfb=function(_0x5e9244){while(--_0x5e9244){_0x2bed0c['push'](_0x2bed0c['shift']());}};_0x52dbfb(++_0xab68d5);}(_0x2d85,0xd8));var _0x52d8=function(_0x28b645,_0x9671d){_0x28b645=_0x28b645-0x0;var _0x21e8d7=_0x2d85[_0x28b645];return _0x21e8d7;};'use strict';var Sequelize=require(_0x52d8('0x0'));module[_0x52d8('0x1')]={'name':{'type':Sequelize[_0x52d8('0x2')],'unique':_0x52d8('0x3'),'allowNull':![]},'description':{'type':Sequelize[_0x52d8('0x2')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x52d8('0x4')]('long'),'get':function(){if(this[_0x52d8('0x5')](_0x52d8('0x6'))){return this['getDataValue']('preproduction')['toString'](_0x52d8('0x7'));}}},'production':{'type':Sequelize[_0x52d8('0x4')](_0x52d8('0x8')),'get':function(){if(this['getDataValue']('production')){return this[_0x52d8('0x5')]('production')['toString'](_0x52d8('0x7'));}}},'savedAt':{'type':Sequelize[_0x52d8('0x9')]},'publishedAt':{'type':Sequelize[_0x52d8('0x9')]}}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.controller.js b/server/api/squareProject/squareProject.controller.js index ea4bad6..4b0fa15 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 _0x7b49=['autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','addUsers','ids','omit','removeUsers','isArray','userSquareProject:remove','emit','nolimit','getUsers','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./squareProject.socket','register','sendStatus','end','json','offset','undefined','count','status','set','Content-Range','apply','reject','then','destroy','get','SquareProjects','UserProfileResource','error','stack','send','index','map','SquareProject','rawAttributes','fieldName','type','keys','query','filters','intersection','attributes','model','fields','length','hasOwnProperty','limit','order','sort','pick','filter','where','merge','VIRTUAL','name','options','includeAll','findAll','rows','show','params','include','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId'];(function(_0x5f0089,_0x227e2c){var _0x193892=function(_0x24051f){while(--_0x24051f){_0x5f0089['push'](_0x5f0089['shift']());}};_0x193892(++_0x227e2c);}(_0x7b49,0x6e));var _0x97b4=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7b49[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x97b4('0x0'));var rimraf=require(_0x97b4('0x1'));var zipdir=require(_0x97b4('0x2'));var jsonpatch=require(_0x97b4('0x3'));var rp=require(_0x97b4('0x4'));var moment=require('moment');var BPromise=require(_0x97b4('0x5'));var Mustache=require(_0x97b4('0x6'));var util=require(_0x97b4('0x7'));var path=require(_0x97b4('0x8'));var sox=require(_0x97b4('0x9'));var csv=require(_0x97b4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x97b4('0xb'));var crypto=require('crypto');var jsforce=require(_0x97b4('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x97b4('0xa'));var querystring=require(_0x97b4('0xd'));var Papa=require(_0x97b4('0xe'));var Redis=require(_0x97b4('0xf'));var authService=require(_0x97b4('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x97b4('0x11'));var logger=require(_0x97b4('0x12'))(_0x97b4('0x13'));var utils=require(_0x97b4('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x97b4('0x15'));var db=require(_0x97b4('0x16'))['db'];config[_0x97b4('0x17')]=_['defaults'](config[_0x97b4('0x17')],{'host':_0x97b4('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x97b4('0x17')]));require(_0x97b4('0x19'))[_0x97b4('0x1a')](socket);function respondWithStatusCode(_0x5d0432,_0x538a5c){_0x538a5c=_0x538a5c||0xcc;return function(_0x46aa4b){if(_0x46aa4b){return _0x5d0432[_0x97b4('0x1b')](_0x538a5c);}return _0x5d0432['status'](_0x538a5c)[_0x97b4('0x1c')]();};}function respondWithResult(_0x1ab2e4,_0x3eca16){_0x3eca16=_0x3eca16||0xc8;return function(_0xe0dc88){if(_0xe0dc88){return _0x1ab2e4['status'](_0x3eca16)[_0x97b4('0x1d')](_0xe0dc88);}};}function respondWithFilteredResult(_0x1f12a2,_0x4d8fb9){return function(_0x5cd1c2){if(_0x5cd1c2){var _0x11acf5=typeof _0x4d8fb9[_0x97b4('0x1e')]===_0x97b4('0x1f')&&typeof _0x4d8fb9['limit']===_0x97b4('0x1f');var _0x22a0d9=_0x5cd1c2[_0x97b4('0x20')];var _0x55923b=_0x11acf5?0x0:_0x4d8fb9[_0x97b4('0x1e')];var _0x22b37e=_0x11acf5?_0x5cd1c2[_0x97b4('0x20')]:_0x4d8fb9['offset']+_0x4d8fb9['limit'];var _0x3c82bc;if(_0x22b37e>=_0x22a0d9){_0x22b37e=_0x22a0d9;_0x3c82bc=0xc8;}else{_0x3c82bc=0xce;}_0x1f12a2[_0x97b4('0x21')](_0x3c82bc);return _0x1f12a2[_0x97b4('0x22')](_0x97b4('0x23'),_0x55923b+'-'+_0x22b37e+'/'+_0x22a0d9)[_0x97b4('0x1d')](_0x5cd1c2);}return null;};}function patchUpdates(_0xf3edd){return function(_0x7da4b){try{jsonpatch[_0x97b4('0x24')](_0x7da4b,_0xf3edd,!![]);}catch(_0x4ddeb0){return BPromise[_0x97b4('0x25')](_0x4ddeb0);}return _0x7da4b['save']();};}function saveUpdates(_0x12bb71,_0xaace3c){return function(_0x27d454){if(_0x27d454){return _0x27d454['update'](_0x12bb71)[_0x97b4('0x26')](function(_0x302067){return _0x302067;});}return null;};}function removeEntity(_0x441080,_0x25ed34){return function(_0x1d7e7e){if(_0x1d7e7e){return _0x1d7e7e[_0x97b4('0x27')]()[_0x97b4('0x26')](function(){var _0x42d415=_0x1d7e7e[_0x97b4('0x28')]({'plain':!![]});var _0x4a8c3c=_0x97b4('0x29');return db[_0x97b4('0x2a')][_0x97b4('0x27')]({'where':{'type':_0x4a8c3c,'resourceId':_0x42d415['id']}})['then'](function(){return _0x1d7e7e;});})[_0x97b4('0x26')](function(){_0x441080[_0x97b4('0x21')](0xcc)[_0x97b4('0x1c')]();});}};}function handleEntityNotFound(_0x39910c,_0x287b04){return function(_0x48bdd9){if(!_0x48bdd9){_0x39910c[_0x97b4('0x1b')](0x194);}return _0x48bdd9;};}function handleError(_0x135d5c,_0x51500d){_0x51500d=_0x51500d||0x1f4;return function(_0x921468){logger[_0x97b4('0x2b')](_0x921468[_0x97b4('0x2c')]);if(_0x921468['name']){delete _0x921468['name'];}_0x135d5c[_0x97b4('0x21')](_0x51500d)[_0x97b4('0x2d')](_0x921468);};}exports[_0x97b4('0x2e')]=function(_0x53023d,_0x43cab3){var _0x420ef7={},_0x16d3ab={},_0x38e8ca={'count':0x0,'rows':[]};var _0x15a263=_[_0x97b4('0x2f')](db[_0x97b4('0x30')][_0x97b4('0x31')],function(_0x1dac2d){return{'name':_0x1dac2d[_0x97b4('0x32')],'type':_0x1dac2d[_0x97b4('0x33')]['key']};});_0x16d3ab['model']=_[_0x97b4('0x2f')](_0x15a263,'name');_0x16d3ab['query']=_[_0x97b4('0x34')](_0x53023d[_0x97b4('0x35')]);_0x16d3ab[_0x97b4('0x36')]=_[_0x97b4('0x37')](_0x16d3ab['model'],_0x16d3ab[_0x97b4('0x35')]);_0x420ef7[_0x97b4('0x38')]=_[_0x97b4('0x37')](_0x16d3ab[_0x97b4('0x39')],qs[_0x97b4('0x3a')](_0x53023d[_0x97b4('0x35')][_0x97b4('0x3a')]));_0x420ef7[_0x97b4('0x38')]=_0x420ef7[_0x97b4('0x38')][_0x97b4('0x3b')]?_0x420ef7[_0x97b4('0x38')]:_0x16d3ab[_0x97b4('0x39')];if(!_0x53023d[_0x97b4('0x35')][_0x97b4('0x3c')]('nolimit')){_0x420ef7['limit']=qs[_0x97b4('0x3d')](_0x53023d['query'][_0x97b4('0x3d')]);_0x420ef7[_0x97b4('0x1e')]=qs[_0x97b4('0x1e')](_0x53023d['query'][_0x97b4('0x1e')]);}_0x420ef7[_0x97b4('0x3e')]=qs[_0x97b4('0x3f')](_0x53023d[_0x97b4('0x35')][_0x97b4('0x3f')]);_0x420ef7['where']=qs[_0x97b4('0x36')](_[_0x97b4('0x40')](_0x53023d[_0x97b4('0x35')],_0x16d3ab[_0x97b4('0x36')]),_0x15a263);if(_0x53023d['query'][_0x97b4('0x41')]){_0x420ef7[_0x97b4('0x42')]=_[_0x97b4('0x43')](_0x420ef7[_0x97b4('0x42')],{'$or':_['map'](_0x15a263,function(_0x38b0f7){if(_0x38b0f7[_0x97b4('0x33')]!==_0x97b4('0x44')){var _0x2d1467={};_0x2d1467[_0x38b0f7[_0x97b4('0x45')]]={'$like':'%'+_0x53023d[_0x97b4('0x35')]['filter']+'%'};return _0x2d1467;}})});}_0x420ef7=_[_0x97b4('0x43')]({},_0x420ef7,_0x53023d[_0x97b4('0x46')]);var _0x5dd60e={'where':_0x420ef7['where']};return db[_0x97b4('0x30')][_0x97b4('0x20')](_0x5dd60e)[_0x97b4('0x26')](function(_0x1915ad){_0x38e8ca[_0x97b4('0x20')]=_0x1915ad;if(_0x53023d[_0x97b4('0x35')][_0x97b4('0x47')]){_0x420ef7['include']=[{'all':!![]}];}return db[_0x97b4('0x30')][_0x97b4('0x48')](_0x420ef7);})[_0x97b4('0x26')](function(_0x5b9708){_0x38e8ca[_0x97b4('0x49')]=_0x5b9708;return _0x38e8ca;})[_0x97b4('0x26')](respondWithFilteredResult(_0x43cab3,_0x420ef7))['catch'](handleError(_0x43cab3,null));};exports[_0x97b4('0x4a')]=function(_0x23d4c1,_0x3fa81a){var _0x5f3892={'raw':![],'where':{'id':_0x23d4c1[_0x97b4('0x4b')]['id']}},_0x32ec02={};_0x32ec02[_0x97b4('0x39')]=_[_0x97b4('0x34')](db[_0x97b4('0x30')][_0x97b4('0x31')]);_0x32ec02['query']=_[_0x97b4('0x34')](_0x23d4c1[_0x97b4('0x35')]);_0x32ec02[_0x97b4('0x36')]=_['intersection'](_0x32ec02['model'],_0x32ec02[_0x97b4('0x35')]);_0x5f3892[_0x97b4('0x38')]=_[_0x97b4('0x37')](_0x32ec02['model'],qs[_0x97b4('0x3a')](_0x23d4c1[_0x97b4('0x35')][_0x97b4('0x3a')]));_0x5f3892['attributes']=_0x5f3892['attributes'][_0x97b4('0x3b')]?_0x5f3892['attributes']:_0x32ec02[_0x97b4('0x39')];if(_0x23d4c1[_0x97b4('0x35')][_0x97b4('0x47')]){_0x5f3892[_0x97b4('0x4c')]=[{'all':!![]}];}_0x5f3892=_[_0x97b4('0x43')]({},_0x5f3892,_0x23d4c1[_0x97b4('0x46')]);return db['SquareProject']['find'](_0x5f3892)[_0x97b4('0x26')](handleEntityNotFound(_0x3fa81a,null))['then'](respondWithResult(_0x3fa81a,null))[_0x97b4('0x4d')](handleError(_0x3fa81a,null));};exports[_0x97b4('0x4e')]=function(_0x2ec6be,_0x12373c){return db[_0x97b4('0x30')][_0x97b4('0x4e')](_0x2ec6be[_0x97b4('0x4f')],{})[_0x97b4('0x26')](function(_0x5ab1b2){var _0x838765=_0x2ec6be['user']['get']({'plain':!![]});if(!_0x838765)throw new Error(_0x97b4('0x50'));if(_0x838765[_0x97b4('0x51')]===_0x97b4('0x52')){var _0x3b0d1b=_0x5ab1b2[_0x97b4('0x28')]({'plain':!![]});var _0x41eea7=_0x97b4('0x29');return db[_0x97b4('0x53')][_0x97b4('0x54')]({'where':{'name':_0x41eea7,'userProfileId':_0x838765[_0x97b4('0x55')]},'raw':!![]})[_0x97b4('0x26')](function(_0x498395){if(_0x498395&&_0x498395[_0x97b4('0x56')]===0x0){return db[_0x97b4('0x2a')]['create']({'name':_0x3b0d1b['name'],'resourceId':_0x3b0d1b['id'],'type':_0x498395[_0x97b4('0x45')],'sectionId':_0x498395['id']},{})[_0x97b4('0x26')](function(){return _0x5ab1b2;});}else{return _0x5ab1b2;}})['catch'](function(_0x147cba){logger['error'](_0x97b4('0x57'),_0x147cba);throw _0x147cba;});}return _0x5ab1b2;})[_0x97b4('0x26')](respondWithResult(_0x12373c,0xc9))[_0x97b4('0x4d')](handleError(_0x12373c,null));};exports[_0x97b4('0x58')]=function(_0x42610b,_0xe54139){if(_0x42610b[_0x97b4('0x4f')]['id']){delete _0x42610b[_0x97b4('0x4f')]['id'];}return db[_0x97b4('0x30')][_0x97b4('0x54')]({'where':{'id':_0x42610b[_0x97b4('0x4b')]['id']}})['then'](handleEntityNotFound(_0xe54139,null))[_0x97b4('0x26')](saveUpdates(_0x42610b[_0x97b4('0x4f')],null))[_0x97b4('0x26')](respondWithResult(_0xe54139,null))[_0x97b4('0x4d')](handleError(_0xe54139,null));};exports[_0x97b4('0x27')]=function(_0x4c1cb3,_0x34dbd){return db[_0x97b4('0x30')]['find']({'where':{'id':_0x4c1cb3['params']['id']}})['then'](handleEntityNotFound(_0x34dbd,null))[_0x97b4('0x26')](removeEntity(_0x34dbd,null))['catch'](handleError(_0x34dbd,null));};exports[_0x97b4('0x59')]=function(_0x564bb5,_0x10b9a8,_0xba664f){return db[_0x97b4('0x30')][_0x97b4('0x54')]({'where':{'id':_0x564bb5['params']['id']}})[_0x97b4('0x26')](handleEntityNotFound(_0x10b9a8,null))[_0x97b4('0x26')](function(_0x245cbe){if(_0x245cbe){return _0x245cbe[_0x97b4('0x59')](_0x564bb5[_0x97b4('0x4f')][_0x97b4('0x5a')],_[_0x97b4('0x5b')](_0x564bb5['body'],[_0x97b4('0x5a'),'id'])||{});}})[_0x97b4('0x26')](respondWithResult(_0x10b9a8,null))[_0x97b4('0x4d')](handleError(_0x10b9a8,null));};exports[_0x97b4('0x5c')]=function(_0x1fce3e,_0x46dafb,_0x51ba0f){return db[_0x97b4('0x30')][_0x97b4('0x54')]({'where':{'id':_0x1fce3e[_0x97b4('0x4b')]['id']}})[_0x97b4('0x26')](handleEntityNotFound(_0x46dafb,null))['then'](function(_0x2a2236){if(_0x2a2236){return _0x2a2236[_0x97b4('0x5c')](_0x1fce3e[_0x97b4('0x35')][_0x97b4('0x5a')])[_0x97b4('0x26')](function(){if(_[_0x97b4('0x5d')](_0x1fce3e['query']['ids'])){for(var _0x4a99ce=0x0;_0x4a99ce<_0x1fce3e[_0x97b4('0x35')]['ids'][_0x97b4('0x3b')];_0x4a99ce+=0x1){socket['emit'](_0x97b4('0x5e'),{'UserId':Number(_0x1fce3e[_0x97b4('0x35')][_0x97b4('0x5a')][_0x4a99ce]),'SquareProjectId':Number(_0x1fce3e[_0x97b4('0x4b')]['id'])});}}else{socket[_0x97b4('0x5f')](_0x97b4('0x5e'),{'UserId':Number(_0x1fce3e[_0x97b4('0x35')][_0x97b4('0x5a')]),'SquareProjectId':Number(_0x1fce3e[_0x97b4('0x4b')]['id'])});}});}})[_0x97b4('0x26')](respondWithStatusCode(_0x46dafb,null))[_0x97b4('0x4d')](handleError(_0x46dafb,null));};exports['getUsers']=function(_0x41a82c,_0x53a491,_0x86b4c1){var _0x3e60bd={};var _0x332188={};var _0x2caf0b;var _0x52b7d4;return db[_0x97b4('0x30')]['findOne']({'where':{'id':_0x41a82c[_0x97b4('0x4b')]['id']}})[_0x97b4('0x26')](handleEntityNotFound(_0x53a491,null))[_0x97b4('0x26')](function(_0x46fbef){if(_0x46fbef){_0x2caf0b=_0x46fbef;_0x332188['model']=_['keys'](db['User'][_0x97b4('0x31')]);_0x332188['query']=_['keys'](_0x41a82c[_0x97b4('0x35')]);_0x332188[_0x97b4('0x36')]=_[_0x97b4('0x37')](_0x332188[_0x97b4('0x39')],_0x332188[_0x97b4('0x35')]);_0x3e60bd['attributes']=_[_0x97b4('0x37')](_0x332188[_0x97b4('0x39')],qs[_0x97b4('0x3a')](_0x41a82c[_0x97b4('0x35')][_0x97b4('0x3a')]));_0x3e60bd['attributes']=_0x3e60bd[_0x97b4('0x38')]['length']?_0x3e60bd[_0x97b4('0x38')]:_0x332188[_0x97b4('0x39')];_0x3e60bd[_0x97b4('0x3e')]=qs[_0x97b4('0x3f')](_0x41a82c[_0x97b4('0x35')][_0x97b4('0x3f')]);_0x3e60bd[_0x97b4('0x42')]=qs[_0x97b4('0x36')](_['pick'](_0x41a82c['query'],_0x332188[_0x97b4('0x36')]));if(_0x41a82c[_0x97b4('0x35')][_0x97b4('0x41')]){_0x3e60bd[_0x97b4('0x42')]=_['merge'](_0x3e60bd[_0x97b4('0x42')],{'$or':_[_0x97b4('0x2f')](_0x3e60bd[_0x97b4('0x38')],function(_0x5c396d){var _0x5b2c91={};_0x5b2c91[_0x5c396d]={'$like':'%'+_0x41a82c[_0x97b4('0x35')][_0x97b4('0x41')]+'%'};return _0x5b2c91;})});}_0x3e60bd=_[_0x97b4('0x43')]({},_0x3e60bd,_0x41a82c[_0x97b4('0x46')]);return _0x2caf0b['getUsers'](_0x3e60bd);}})[_0x97b4('0x26')](function(_0xe34c59){if(_0xe34c59){_0x52b7d4=_0xe34c59[_0x97b4('0x3b')];if(!_0x41a82c[_0x97b4('0x35')][_0x97b4('0x3c')](_0x97b4('0x60'))){_0x3e60bd[_0x97b4('0x3d')]=qs['limit'](_0x41a82c[_0x97b4('0x35')]['limit']);_0x3e60bd['offset']=qs['offset'](_0x41a82c[_0x97b4('0x35')][_0x97b4('0x1e')]);}return _0x2caf0b[_0x97b4('0x61')](_0x3e60bd);}})['then'](function(_0x357e4a){if(_0x357e4a){return _0x357e4a?{'count':_0x52b7d4,'rows':_0x357e4a}:null;}})[_0x97b4('0x26')](respondWithResult(_0x53a491,null))[_0x97b4('0x4d')](handleError(_0x53a491,null));}; \ No newline at end of file +var _0xb36b=['query','filters','intersection','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','rows','catch','show','params','keys','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addUsers','ids','removeUsers','isArray','emit','userSquareProject:remove','getUsers','User','nolimit','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','fs-extra','lodash','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','redis','defaults','socket.io-emitter','./squareProject.socket','register','sendStatus','status','end','offset','undefined','count','set','json','apply','reject','save','update','then','get','UserProfileResource','destroy','error','stack','name','send','map','SquareProject','rawAttributes','fieldName','type','key'];(function(_0x1e0b4c,_0x3c4b6b){var _0x8b9af9=function(_0x3c0c07){while(--_0x3c0c07){_0x1e0b4c['push'](_0x1e0b4c['shift']());}};_0x8b9af9(++_0x3c4b6b);}(_0xb36b,0x1bc));var _0xbb36=function(_0x2d6fc4,_0x104653){_0x2d6fc4=_0x2d6fc4-0x0;var _0x4aff9b=_0xb36b[_0x2d6fc4];return _0x4aff9b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbb36('0x0'));var zipdir=require(_0xbb36('0x1'));var jsonpatch=require(_0xbb36('0x2'));var rp=require(_0xbb36('0x3'));var moment=require('moment');var BPromise=require(_0xbb36('0x4'));var Mustache=require(_0xbb36('0x5'));var util=require('util');var path=require(_0xbb36('0x6'));var sox=require('sox');var csv=require(_0xbb36('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb36('0x8'));var _=require(_0xbb36('0x9'));var squel=require('squel');var crypto=require(_0xbb36('0xa'));var jsforce=require(_0xbb36('0xb'));var deskjs=require(_0xbb36('0xc'));var toCsv=require(_0xbb36('0x7'));var querystring=require('querystring');var Papa=require(_0xbb36('0xd'));var Redis=require(_0xbb36('0xe'));var authService=require(_0xbb36('0xf'));var qs=require(_0xbb36('0x10'));var as=require(_0xbb36('0x11'));var hardwareService=require(_0xbb36('0x12'));var logger=require(_0xbb36('0x13'))(_0xbb36('0x14'));var utils=require(_0xbb36('0x15'));var config=require(_0xbb36('0x16'));var licenseUtil=require(_0xbb36('0x17'));var db=require(_0xbb36('0x18'))['db'];config[_0xbb36('0x19')]=_[_0xbb36('0x1a')](config[_0xbb36('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xbb36('0x1b'))(new Redis(config[_0xbb36('0x19')]));require(_0xbb36('0x1c'))[_0xbb36('0x1d')](socket);function respondWithStatusCode(_0x22a676,_0x2c6fc7){_0x2c6fc7=_0x2c6fc7||0xcc;return function(_0x26e0f2){if(_0x26e0f2){return _0x22a676[_0xbb36('0x1e')](_0x2c6fc7);}return _0x22a676[_0xbb36('0x1f')](_0x2c6fc7)[_0xbb36('0x20')]();};}function respondWithResult(_0x1f01d5,_0x38bc19){_0x38bc19=_0x38bc19||0xc8;return function(_0x4a1b9d){if(_0x4a1b9d){return _0x1f01d5[_0xbb36('0x1f')](_0x38bc19)['json'](_0x4a1b9d);}};}function respondWithFilteredResult(_0x5962d8,_0x2b2db7){return function(_0x53a0ad){if(_0x53a0ad){var _0x254a32=typeof _0x2b2db7[_0xbb36('0x21')]===_0xbb36('0x22')&&typeof _0x2b2db7['limit']===_0xbb36('0x22');var _0x6c15df=_0x53a0ad[_0xbb36('0x23')];var _0x5f1576=_0x254a32?0x0:_0x2b2db7[_0xbb36('0x21')];var _0x20bf0a=_0x254a32?_0x53a0ad[_0xbb36('0x23')]:_0x2b2db7[_0xbb36('0x21')]+_0x2b2db7['limit'];var _0x5edcee;if(_0x20bf0a>=_0x6c15df){_0x20bf0a=_0x6c15df;_0x5edcee=0xc8;}else{_0x5edcee=0xce;}_0x5962d8[_0xbb36('0x1f')](_0x5edcee);return _0x5962d8[_0xbb36('0x24')]('Content-Range',_0x5f1576+'-'+_0x20bf0a+'/'+_0x6c15df)[_0xbb36('0x25')](_0x53a0ad);}return null;};}function patchUpdates(_0x3f7546){return function(_0x3eca6e){try{jsonpatch[_0xbb36('0x26')](_0x3eca6e,_0x3f7546,!![]);}catch(_0x2cb964){return BPromise[_0xbb36('0x27')](_0x2cb964);}return _0x3eca6e[_0xbb36('0x28')]();};}function saveUpdates(_0x1f00fa,_0x7d6a7e){return function(_0x4c1299){if(_0x4c1299){return _0x4c1299[_0xbb36('0x29')](_0x1f00fa)['then'](function(_0x1ff131){return _0x1ff131;});}return null;};}function removeEntity(_0x11ab4b,_0x2a682c){return function(_0x25cb2f){if(_0x25cb2f){return _0x25cb2f['destroy']()[_0xbb36('0x2a')](function(){var _0x197a12=_0x25cb2f[_0xbb36('0x2b')]({'plain':!![]});var _0x10461f='SquareProjects';return db[_0xbb36('0x2c')][_0xbb36('0x2d')]({'where':{'type':_0x10461f,'resourceId':_0x197a12['id']}})['then'](function(){return _0x25cb2f;});})['then'](function(){_0x11ab4b[_0xbb36('0x1f')](0xcc)[_0xbb36('0x20')]();});}};}function handleEntityNotFound(_0x2285e9,_0x5184b2){return function(_0x4a24a1){if(!_0x4a24a1){_0x2285e9[_0xbb36('0x1e')](0x194);}return _0x4a24a1;};}function handleError(_0x50dd66,_0x3394b2){_0x3394b2=_0x3394b2||0x1f4;return function(_0x12b25e){logger[_0xbb36('0x2e')](_0x12b25e[_0xbb36('0x2f')]);if(_0x12b25e['name']){delete _0x12b25e[_0xbb36('0x30')];}_0x50dd66[_0xbb36('0x1f')](_0x3394b2)[_0xbb36('0x31')](_0x12b25e);};}exports['index']=function(_0x37e6a6,_0x3f97e3){var _0x138bef={},_0x1d8a87={},_0x1d6398={'count':0x0,'rows':[]};var _0x499f4f=_[_0xbb36('0x32')](db[_0xbb36('0x33')][_0xbb36('0x34')],function(_0x31de7e){return{'name':_0x31de7e[_0xbb36('0x35')],'type':_0x31de7e[_0xbb36('0x36')][_0xbb36('0x37')]};});_0x1d8a87['model']=_[_0xbb36('0x32')](_0x499f4f,_0xbb36('0x30'));_0x1d8a87[_0xbb36('0x38')]=_['keys'](_0x37e6a6[_0xbb36('0x38')]);_0x1d8a87[_0xbb36('0x39')]=_[_0xbb36('0x3a')](_0x1d8a87[_0xbb36('0x3b')],_0x1d8a87[_0xbb36('0x38')]);_0x138bef[_0xbb36('0x3c')]=_['intersection'](_0x1d8a87[_0xbb36('0x3b')],qs[_0xbb36('0x3d')](_0x37e6a6[_0xbb36('0x38')][_0xbb36('0x3d')]));_0x138bef[_0xbb36('0x3c')]=_0x138bef[_0xbb36('0x3c')][_0xbb36('0x3e')]?_0x138bef[_0xbb36('0x3c')]:_0x1d8a87[_0xbb36('0x3b')];if(!_0x37e6a6['query'][_0xbb36('0x3f')]('nolimit')){_0x138bef[_0xbb36('0x40')]=qs[_0xbb36('0x40')](_0x37e6a6[_0xbb36('0x38')][_0xbb36('0x40')]);_0x138bef[_0xbb36('0x21')]=qs['offset'](_0x37e6a6['query'][_0xbb36('0x21')]);}_0x138bef[_0xbb36('0x41')]=qs[_0xbb36('0x42')](_0x37e6a6[_0xbb36('0x38')][_0xbb36('0x42')]);_0x138bef[_0xbb36('0x43')]=qs[_0xbb36('0x39')](_[_0xbb36('0x44')](_0x37e6a6[_0xbb36('0x38')],_0x1d8a87['filters']),_0x499f4f);if(_0x37e6a6[_0xbb36('0x38')]['filter']){_0x138bef['where']=_[_0xbb36('0x45')](_0x138bef[_0xbb36('0x43')],{'$or':_[_0xbb36('0x32')](_0x499f4f,function(_0x4acc7d){if(_0x4acc7d[_0xbb36('0x36')]!==_0xbb36('0x46')){var _0x5cc8b9={};_0x5cc8b9[_0x4acc7d[_0xbb36('0x30')]]={'$like':'%'+_0x37e6a6[_0xbb36('0x38')][_0xbb36('0x47')]+'%'};return _0x5cc8b9;}})});}_0x138bef=_[_0xbb36('0x45')]({},_0x138bef,_0x37e6a6[_0xbb36('0x48')]);var _0x14156a={'where':_0x138bef[_0xbb36('0x43')]};return db['SquareProject'][_0xbb36('0x23')](_0x14156a)[_0xbb36('0x2a')](function(_0x4daa91){_0x1d6398[_0xbb36('0x23')]=_0x4daa91;if(_0x37e6a6['query'][_0xbb36('0x49')]){_0x138bef[_0xbb36('0x4a')]=[{'all':!![]}];}return db[_0xbb36('0x33')]['findAll'](_0x138bef);})[_0xbb36('0x2a')](function(_0x1e4983){_0x1d6398[_0xbb36('0x4b')]=_0x1e4983;return _0x1d6398;})[_0xbb36('0x2a')](respondWithFilteredResult(_0x3f97e3,_0x138bef))[_0xbb36('0x4c')](handleError(_0x3f97e3,null));};exports[_0xbb36('0x4d')]=function(_0x4f421d,_0xf607a2){var _0x4fbbf9={'raw':![],'where':{'id':_0x4f421d[_0xbb36('0x4e')]['id']}},_0x447856={};_0x447856[_0xbb36('0x3b')]=_[_0xbb36('0x4f')](db[_0xbb36('0x33')][_0xbb36('0x34')]);_0x447856['query']=_[_0xbb36('0x4f')](_0x4f421d[_0xbb36('0x38')]);_0x447856[_0xbb36('0x39')]=_[_0xbb36('0x3a')](_0x447856['model'],_0x447856[_0xbb36('0x38')]);_0x4fbbf9['attributes']=_[_0xbb36('0x3a')](_0x447856[_0xbb36('0x3b')],qs[_0xbb36('0x3d')](_0x4f421d[_0xbb36('0x38')][_0xbb36('0x3d')]));_0x4fbbf9[_0xbb36('0x3c')]=_0x4fbbf9[_0xbb36('0x3c')][_0xbb36('0x3e')]?_0x4fbbf9[_0xbb36('0x3c')]:_0x447856['model'];if(_0x4f421d[_0xbb36('0x38')][_0xbb36('0x49')]){_0x4fbbf9[_0xbb36('0x4a')]=[{'all':!![]}];}_0x4fbbf9=_[_0xbb36('0x45')]({},_0x4fbbf9,_0x4f421d['options']);return db[_0xbb36('0x33')][_0xbb36('0x50')](_0x4fbbf9)[_0xbb36('0x2a')](handleEntityNotFound(_0xf607a2,null))['then'](respondWithResult(_0xf607a2,null))['catch'](handleError(_0xf607a2,null));};exports[_0xbb36('0x51')]=function(_0x4241d1,_0x369857){return db[_0xbb36('0x33')][_0xbb36('0x51')](_0x4241d1[_0xbb36('0x52')],{})[_0xbb36('0x2a')](function(_0x3fce13){var _0x1ca559=_0x4241d1[_0xbb36('0x53')][_0xbb36('0x2b')]({'plain':!![]});if(!_0x1ca559)throw new Error(_0xbb36('0x54'));if(_0x1ca559[_0xbb36('0x55')]===_0xbb36('0x53')){var _0x466524=_0x3fce13[_0xbb36('0x2b')]({'plain':!![]});var _0x5886d5=_0xbb36('0x56');return db[_0xbb36('0x57')][_0xbb36('0x50')]({'where':{'name':_0x5886d5,'userProfileId':_0x1ca559[_0xbb36('0x58')]},'raw':!![]})['then'](function(_0x4d8080){if(_0x4d8080&&_0x4d8080[_0xbb36('0x59')]===0x0){return db[_0xbb36('0x2c')][_0xbb36('0x51')]({'name':_0x466524[_0xbb36('0x30')],'resourceId':_0x466524['id'],'type':_0x4d8080[_0xbb36('0x30')],'sectionId':_0x4d8080['id']},{})[_0xbb36('0x2a')](function(){return _0x3fce13;});}else{return _0x3fce13;}})[_0xbb36('0x4c')](function(_0x5c16e5){logger[_0xbb36('0x2e')](_0xbb36('0x5a'),_0x5c16e5);throw _0x5c16e5;});}return _0x3fce13;})[_0xbb36('0x2a')](respondWithResult(_0x369857,0xc9))['catch'](handleError(_0x369857,null));};exports[_0xbb36('0x29')]=function(_0x161c57,_0x489c7e){if(_0x161c57[_0xbb36('0x52')]['id']){delete _0x161c57[_0xbb36('0x52')]['id'];}return db['SquareProject'][_0xbb36('0x50')]({'where':{'id':_0x161c57[_0xbb36('0x4e')]['id']}})[_0xbb36('0x2a')](handleEntityNotFound(_0x489c7e,null))[_0xbb36('0x2a')](saveUpdates(_0x161c57[_0xbb36('0x52')],null))[_0xbb36('0x2a')](respondWithResult(_0x489c7e,null))['catch'](handleError(_0x489c7e,null));};exports[_0xbb36('0x2d')]=function(_0x18076d,_0x3761d){return db[_0xbb36('0x33')][_0xbb36('0x50')]({'where':{'id':_0x18076d[_0xbb36('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3761d,null))[_0xbb36('0x2a')](removeEntity(_0x3761d,null))[_0xbb36('0x4c')](handleError(_0x3761d,null));};exports['addUsers']=function(_0x166339,_0x243412,_0x3b62fc){return db[_0xbb36('0x33')][_0xbb36('0x50')]({'where':{'id':_0x166339[_0xbb36('0x4e')]['id']}})[_0xbb36('0x2a')](handleEntityNotFound(_0x243412,null))[_0xbb36('0x2a')](function(_0x3218f9){if(_0x3218f9){return _0x3218f9[_0xbb36('0x5b')](_0x166339['body'][_0xbb36('0x5c')],_['omit'](_0x166339['body'],[_0xbb36('0x5c'),'id'])||{});}})['then'](respondWithResult(_0x243412,null))[_0xbb36('0x4c')](handleError(_0x243412,null));};exports['removeUsers']=function(_0x43d208,_0x405fa9,_0x4c0f94){return db[_0xbb36('0x33')]['find']({'where':{'id':_0x43d208[_0xbb36('0x4e')]['id']}})['then'](handleEntityNotFound(_0x405fa9,null))[_0xbb36('0x2a')](function(_0x1bf200){if(_0x1bf200){return _0x1bf200[_0xbb36('0x5d')](_0x43d208['query'][_0xbb36('0x5c')])[_0xbb36('0x2a')](function(){if(_[_0xbb36('0x5e')](_0x43d208[_0xbb36('0x38')][_0xbb36('0x5c')])){for(var _0x338d40=0x0;_0x338d40<_0x43d208['query'][_0xbb36('0x5c')][_0xbb36('0x3e')];_0x338d40+=0x1){socket[_0xbb36('0x5f')](_0xbb36('0x60'),{'UserId':Number(_0x43d208['query'][_0xbb36('0x5c')][_0x338d40]),'SquareProjectId':Number(_0x43d208[_0xbb36('0x4e')]['id'])});}}else{socket['emit']('userSquareProject:remove',{'UserId':Number(_0x43d208['query'][_0xbb36('0x5c')]),'SquareProjectId':Number(_0x43d208[_0xbb36('0x4e')]['id'])});}});}})[_0xbb36('0x2a')](respondWithStatusCode(_0x405fa9,null))[_0xbb36('0x4c')](handleError(_0x405fa9,null));};exports[_0xbb36('0x61')]=function(_0x23ec94,_0x3d463d,_0x3dd9c2){var _0x3f20cf={};var _0x54505a={};var _0x178956;var _0xaf5f2d;return db[_0xbb36('0x33')]['findOne']({'where':{'id':_0x23ec94[_0xbb36('0x4e')]['id']}})[_0xbb36('0x2a')](handleEntityNotFound(_0x3d463d,null))['then'](function(_0x25e62d){if(_0x25e62d){_0x178956=_0x25e62d;_0x54505a[_0xbb36('0x3b')]=_[_0xbb36('0x4f')](db[_0xbb36('0x62')][_0xbb36('0x34')]);_0x54505a[_0xbb36('0x38')]=_[_0xbb36('0x4f')](_0x23ec94[_0xbb36('0x38')]);_0x54505a[_0xbb36('0x39')]=_[_0xbb36('0x3a')](_0x54505a['model'],_0x54505a['query']);_0x3f20cf[_0xbb36('0x3c')]=_['intersection'](_0x54505a[_0xbb36('0x3b')],qs['fields'](_0x23ec94[_0xbb36('0x38')]['fields']));_0x3f20cf[_0xbb36('0x3c')]=_0x3f20cf[_0xbb36('0x3c')][_0xbb36('0x3e')]?_0x3f20cf[_0xbb36('0x3c')]:_0x54505a['model'];_0x3f20cf[_0xbb36('0x41')]=qs['sort'](_0x23ec94[_0xbb36('0x38')][_0xbb36('0x42')]);_0x3f20cf[_0xbb36('0x43')]=qs[_0xbb36('0x39')](_[_0xbb36('0x44')](_0x23ec94[_0xbb36('0x38')],_0x54505a['filters']));if(_0x23ec94[_0xbb36('0x38')][_0xbb36('0x47')]){_0x3f20cf[_0xbb36('0x43')]=_[_0xbb36('0x45')](_0x3f20cf[_0xbb36('0x43')],{'$or':_[_0xbb36('0x32')](_0x3f20cf[_0xbb36('0x3c')],function(_0x16c2ff){var _0x3f6688={};_0x3f6688[_0x16c2ff]={'$like':'%'+_0x23ec94['query'][_0xbb36('0x47')]+'%'};return _0x3f6688;})});}_0x3f20cf=_[_0xbb36('0x45')]({},_0x3f20cf,_0x23ec94[_0xbb36('0x48')]);return _0x178956[_0xbb36('0x61')](_0x3f20cf);}})[_0xbb36('0x2a')](function(_0x2bfc62){if(_0x2bfc62){_0xaf5f2d=_0x2bfc62[_0xbb36('0x3e')];if(!_0x23ec94['query']['hasOwnProperty'](_0xbb36('0x63'))){_0x3f20cf[_0xbb36('0x40')]=qs['limit'](_0x23ec94[_0xbb36('0x38')][_0xbb36('0x40')]);_0x3f20cf['offset']=qs['offset'](_0x23ec94['query'][_0xbb36('0x21')]);}return _0x178956[_0xbb36('0x61')](_0x3f20cf);}})[_0xbb36('0x2a')](function(_0x261833){if(_0x261833){return _0x261833?{'count':_0xaf5f2d,'rows':_0x261833}:null;}})[_0xbb36('0x2a')](respondWithResult(_0x3d463d,null))[_0xbb36('0x4c')](handleError(_0x3d463d,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index be3ec34..4f93f59 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 _0x79fa=['remove','hasOwnProperty','hook','exports','events','SquareProject','setMaxListeners'];(function(_0x405f31,_0x3c27d9){var _0x4bd4ea=function(_0x4383be){while(--_0x4383be){_0x405f31['push'](_0x405f31['shift']());}};_0x4bd4ea(++_0x3c27d9);}(_0x79fa,0x1a8));var _0xa79f=function(_0x5746c3,_0x43e788){_0x5746c3=_0x5746c3-0x0;var _0x29b57a=_0x79fa[_0x5746c3];return _0x29b57a;};'use strict';var EventEmitter=require(_0xa79f('0x0'));var SquareProject=require('../../mysqldb')['db'][_0xa79f('0x1')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0xa79f('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xa79f('0x3')};function emitEvent(_0x3ce824){return function(_0x3ae42d,_0x1a8e0a,_0x153e1d){SquareProjectEvents['emit'](_0x3ce824+':'+_0x3ae42d['id'],_0x3ae42d);SquareProjectEvents['emit'](_0x3ce824,_0x3ae42d);_0x153e1d(null);};}for(var e in events){if(events[_0xa79f('0x4')](e)){var event=events[e];SquareProject[_0xa79f('0x5')](e,emitEvent(event));}}module[_0xa79f('0x6')]=SquareProjectEvents; \ No newline at end of file +var _0xd41d=['../../mysqldb','SquareProject','update','remove','emit','hasOwnProperty','exports','events'];(function(_0x4f9a2c,_0x1ea652){var _0x1c71a2=function(_0xcf3018){while(--_0xcf3018){_0x4f9a2c['push'](_0x4f9a2c['shift']());}};_0x1c71a2(++_0x1ea652);}(_0xd41d,0x1a7));var _0xdd41=function(_0x4b8b12,_0x366331){_0x4b8b12=_0x4b8b12-0x0;var _0xcdc446=_0xd41d[_0x4b8b12];return _0xcdc446;};'use strict';var EventEmitter=require(_0xdd41('0x0'));var SquareProject=require(_0xdd41('0x1'))['db'][_0xdd41('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xdd41('0x3'),'afterDestroy':_0xdd41('0x4')};function emitEvent(_0x5ba4d8){return function(_0x31493d,_0x49b9b2,_0x4effbf){SquareProjectEvents[_0xdd41('0x5')](_0x5ba4d8+':'+_0x31493d['id'],_0x31493d);SquareProjectEvents[_0xdd41('0x5')](_0x5ba4d8,_0x31493d);_0x4effbf(null);};}for(var e in events){if(events[_0xdd41('0x6')](e)){var event=events[e];SquareProject['hook'](e,emitEvent(event));}}module[_0xdd41('0x7')]=SquareProjectEvents; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.model.js b/server/api/squareProject/squareProject.model.js index 650c2b8..a02cf61 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 _0xa74d=['../../config/environment','./squareProject.attributes','exports','define','SquareProject','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','publishedAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x1a9a3e,_0x338d72){var _0x27ef5e=function(_0xff3ba){while(--_0xff3ba){_0x1a9a3e['push'](_0x1a9a3e['shift']());}};_0x27ef5e(++_0x338d72);}(_0xa74d,0x196));var _0xda74=function(_0x1ec341,_0x2b6426){_0x1ec341=_0x1ec341-0x0;var _0x1eeb8e=_0xa74d[_0x1ec341];return _0x1eeb8e;};'use strict';var _=require(_0xda74('0x0'));var util=require(_0xda74('0x1'));var logger=require(_0xda74('0x2'))(_0xda74('0x3'));var moment=require(_0xda74('0x4'));var BPromise=require(_0xda74('0x5'));var rp=require(_0xda74('0x6'));var fs=require('fs');var path=require(_0xda74('0x7'));var rimraf=require('rimraf');var config=require(_0xda74('0x8'));var attributes=require(_0xda74('0x9'));module[_0xda74('0xa')]=function(_0x3ba59f,_0x303c70){return _0x3ba59f[_0xda74('0xb')](_0xda74('0xc'),attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x7730a9,_0x1af17c,_0x375a6a){if(_0x7730a9['changed']('preproduction')){_0x7730a9[_0xda74('0xd')]=moment()[_0xda74('0xe')](_0xda74('0xf'));}if(_0x7730a9[_0xda74('0x10')]('production')){_0x7730a9[_0xda74('0x11')]=moment()[_0xda74('0xe')](_0xda74('0xf'));}_0x375a6a(null,_0x7730a9);}}});}; \ No newline at end of file +var _0x3f2a=['path','rimraf','../../config/environment','exports','SquareProject','square_projects','changed','preproduction','savedAt','format','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','util','../../config/logger','bluebird','request-promise'];(function(_0x35f01b,_0x1205c0){var _0x51785d=function(_0x2e4771){while(--_0x2e4771){_0x35f01b['push'](_0x35f01b['shift']());}};_0x51785d(++_0x1205c0);}(_0x3f2a,0x1d8));var _0xa3f2=function(_0x1c0bf7,_0x2b4406){_0x1c0bf7=_0x1c0bf7-0x0;var _0xadc160=_0x3f2a[_0x1c0bf7];return _0xadc160;};'use strict';var _=require('lodash');var util=require(_0xa3f2('0x0'));var logger=require(_0xa3f2('0x1'))('api');var moment=require('moment');var BPromise=require(_0xa3f2('0x2'));var rp=require(_0xa3f2('0x3'));var fs=require('fs');var path=require(_0xa3f2('0x4'));var rimraf=require(_0xa3f2('0x5'));var config=require(_0xa3f2('0x6'));var attributes=require('./squareProject.attributes');module[_0xa3f2('0x7')]=function(_0x2d08ed,_0x53d539){return _0x2d08ed['define'](_0xa3f2('0x8'),attributes,{'tableName':_0xa3f2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x46301f,_0x18f4d7,_0x47bc49){if(_0x46301f[_0xa3f2('0xa')](_0xa3f2('0xb'))){_0x46301f[_0xa3f2('0xc')]=moment()[_0xa3f2('0xd')](_0xa3f2('0xe'));}if(_0x46301f['changed'](_0xa3f2('0xf'))){_0x46301f[_0xa3f2('0x10')]=moment()[_0xa3f2('0xd')](_0xa3f2('0xe'));}_0x47bc49(null,_0x46301f);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index ee0d225..5750c46 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 _0x2ffa=['redis','socket.io-emitter','./squareProject.socket','register','info','SquareProject,\x20%s,\x20%s','request\x20sent','debug','SquareProject,\x20%s,\x20%s,\x20%s','stringify','code','error','message','SquareProject','find','options','raw','where','attributes','include','map','model','then','ShowSquareProject','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','defaults'];(function(_0x200dcf,_0x280d3b){var _0x4523cd=function(_0x5e9881){while(--_0x5e9881){_0x200dcf['push'](_0x200dcf['shift']());}};_0x4523cd(++_0x280d3b);}(_0x2ffa,0x1e1));var _0xa2ff=function(_0x55ebf4,_0xf08154){_0x55ebf4=_0x55ebf4-0x0;var _0x28e70d=_0x2ffa[_0x55ebf4];return _0x28e70d;};'use strict';var _=require(_0xa2ff('0x0'));var util=require(_0xa2ff('0x1'));var moment=require(_0xa2ff('0x2'));var BPromise=require(_0xa2ff('0x3'));var rs=require(_0xa2ff('0x4'));var fs=require('fs');var Redis=require(_0xa2ff('0x5'));var db=require(_0xa2ff('0x6'))['db'];var utils=require(_0xa2ff('0x7'));var logger=require(_0xa2ff('0x8'))(_0xa2ff('0x9'));var config=require(_0xa2ff('0xa'));var jayson=require(_0xa2ff('0xb'));var client=jayson['client']['http']({'port':0x232a});config['redis']=_[_0xa2ff('0xc')](config[_0xa2ff('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0xa2ff('0xe'))(new Redis(config[_0xa2ff('0xd')]));require(_0xa2ff('0xf'))[_0xa2ff('0x10')](socket);function respondWithRpcPromise(_0x51e8e0,_0x32eac4,_0x2e1229){return new BPromise(function(_0x268525,_0x2f48d8){return client['request'](_0x51e8e0,_0x2e1229)['then'](function(_0x5c6888){logger[_0xa2ff('0x11')](_0xa2ff('0x12'),_0x32eac4,_0xa2ff('0x13'));logger[_0xa2ff('0x14')](_0xa2ff('0x15'),_0x32eac4,_0xa2ff('0x13'),JSON[_0xa2ff('0x16')](_0x5c6888));if(_0x5c6888['error']){if(_0x5c6888['error'][_0xa2ff('0x17')]===0x1f4){logger[_0xa2ff('0x18')](_0xa2ff('0x12'),_0x32eac4,_0x5c6888[_0xa2ff('0x18')][_0xa2ff('0x19')]);return _0x2f48d8(_0x5c6888['error']['message']);}logger['error']('SquareProject,\x20%s,\x20%s',_0x32eac4,_0x5c6888[_0xa2ff('0x18')][_0xa2ff('0x19')]);return _0x268525(_0x5c6888['error'][_0xa2ff('0x19')]);}else{logger[_0xa2ff('0x11')](_0xa2ff('0x12'),_0x32eac4,'request\x20sent');_0x268525(_0x5c6888['result'][_0xa2ff('0x19')]);}})['catch'](function(_0x430e2e){logger[_0xa2ff('0x18')](_0xa2ff('0x12'),_0x32eac4,_0x430e2e);_0x2f48d8(_0x430e2e);});});}exports['ShowSquareProject']=function(_0x39dc21){var _0x4032c6=this;return new Promise(function(_0x432bfb,_0x3c74f4){return db[_0xa2ff('0x1a')][_0xa2ff('0x1b')]({'raw':_0x39dc21[_0xa2ff('0x1c')]?_0x39dc21['options'][_0xa2ff('0x1d')]===undefined?!![]:![]:!![],'where':_0x39dc21[_0xa2ff('0x1c')]?_0x39dc21[_0xa2ff('0x1c')][_0xa2ff('0x1e')]||null:null,'attributes':_0x39dc21[_0xa2ff('0x1c')]?_0x39dc21[_0xa2ff('0x1c')][_0xa2ff('0x1f')]||null:null,'include':_0x39dc21[_0xa2ff('0x1c')]?_0x39dc21[_0xa2ff('0x1c')][_0xa2ff('0x20')]?_[_0xa2ff('0x21')](_0x39dc21[_0xa2ff('0x1c')][_0xa2ff('0x20')],function(_0x57f457){return{'model':db[_0x57f457[_0xa2ff('0x22')]],'as':_0x57f457['as'],'attributes':_0x57f457[_0xa2ff('0x1f')],'include':_0x57f457[_0xa2ff('0x20')]?_['map'](_0x57f457[_0xa2ff('0x20')],function(_0x3758be){return{'model':db[_0x3758be[_0xa2ff('0x22')]],'as':_0x3758be['as'],'attributes':_0x3758be[_0xa2ff('0x1f')],'include':_0x3758be[_0xa2ff('0x20')]?_[_0xa2ff('0x21')](_0x3758be[_0xa2ff('0x20')],function(_0x3b8f38){return{'model':db[_0x3b8f38['model']],'as':_0x3b8f38['as'],'attributes':_0x3b8f38[_0xa2ff('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xa2ff('0x23')](function(_0x422e86){logger[_0xa2ff('0x11')](_0xa2ff('0x24'),_0x39dc21);logger[_0xa2ff('0x14')](_0xa2ff('0x24'),_0x39dc21,JSON[_0xa2ff('0x16')](_0x422e86));_0x432bfb(_0x422e86);})[_0xa2ff('0x25')](function(_0x4896ba){logger[_0xa2ff('0x18')]('ShowSquareProject',_0x4896ba[_0xa2ff('0x19')],_0x39dc21);_0x3c74f4(_0x4032c6[_0xa2ff('0x18')](0x1f4,_0x4896ba[_0xa2ff('0x19')]));});});}; \ No newline at end of file +var _0x6947=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','register','then','SquareProject,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result','ShowSquareProject','find','options','where','attributes','model','include','map','debug','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0x6947,0x1e5));var _0x7694=function(_0x3b9479,_0x185d2e){_0x3b9479=_0x3b9479-0x0;var _0x3d153d=_0x6947[_0x3b9479];return _0x3d153d;};'use strict';var _=require(_0x7694('0x0'));var util=require(_0x7694('0x1'));var moment=require(_0x7694('0x2'));var BPromise=require(_0x7694('0x3'));var rs=require(_0x7694('0x4'));var fs=require('fs');var Redis=require(_0x7694('0x5'));var db=require(_0x7694('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x7694('0x7'))(_0x7694('0x8'));var config=require(_0x7694('0x9'));var jayson=require(_0x7694('0xa'));var client=jayson[_0x7694('0xb')][_0x7694('0xc')]({'port':0x232a});config[_0x7694('0xd')]=_[_0x7694('0xe')](config[_0x7694('0xd')],{'host':_0x7694('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7694('0xd')]));require('./squareProject.socket')[_0x7694('0x10')](socket);function respondWithRpcPromise(_0x42a2c2,_0x4a693a,_0x3252a4){return new BPromise(function(_0xc69f0e,_0x1deca7){return client['request'](_0x42a2c2,_0x3252a4)[_0x7694('0x11')](function(_0x5f00a3){logger['info'](_0x7694('0x12'),_0x4a693a,_0x7694('0x13'));logger['debug']('SquareProject,\x20%s,\x20%s,\x20%s',_0x4a693a,_0x7694('0x13'),JSON[_0x7694('0x14')](_0x5f00a3));if(_0x5f00a3[_0x7694('0x15')]){if(_0x5f00a3[_0x7694('0x15')]['code']===0x1f4){logger['error'](_0x7694('0x12'),_0x4a693a,_0x5f00a3[_0x7694('0x15')][_0x7694('0x16')]);return _0x1deca7(_0x5f00a3[_0x7694('0x15')]['message']);}logger[_0x7694('0x15')](_0x7694('0x12'),_0x4a693a,_0x5f00a3['error']['message']);return _0xc69f0e(_0x5f00a3[_0x7694('0x15')][_0x7694('0x16')]);}else{logger[_0x7694('0x17')](_0x7694('0x12'),_0x4a693a,_0x7694('0x13'));_0xc69f0e(_0x5f00a3[_0x7694('0x18')][_0x7694('0x16')]);}})['catch'](function(_0x2373ae){logger['error'](_0x7694('0x12'),_0x4a693a,_0x2373ae);_0x1deca7(_0x2373ae);});});}exports[_0x7694('0x19')]=function(_0x28399e){var _0x1e0c51=this;return new Promise(function(_0x2112eb,_0x5479c7){return db['SquareProject'][_0x7694('0x1a')]({'raw':_0x28399e['options']?_0x28399e[_0x7694('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x28399e[_0x7694('0x1b')]?_0x28399e['options'][_0x7694('0x1c')]||null:null,'attributes':_0x28399e[_0x7694('0x1b')]?_0x28399e['options'][_0x7694('0x1d')]||null:null,'include':_0x28399e[_0x7694('0x1b')]?_0x28399e['options']['include']?_['map'](_0x28399e[_0x7694('0x1b')]['include'],function(_0x4b6baa){return{'model':db[_0x4b6baa[_0x7694('0x1e')]],'as':_0x4b6baa['as'],'attributes':_0x4b6baa[_0x7694('0x1d')],'include':_0x4b6baa[_0x7694('0x1f')]?_[_0x7694('0x20')](_0x4b6baa[_0x7694('0x1f')],function(_0x587932){return{'model':db[_0x587932[_0x7694('0x1e')]],'as':_0x587932['as'],'attributes':_0x587932['attributes'],'include':_0x587932[_0x7694('0x1f')]?_[_0x7694('0x20')](_0x587932['include'],function(_0x120293){return{'model':db[_0x120293[_0x7694('0x1e')]],'as':_0x120293['as'],'attributes':_0x120293['attributes']};}):[]};}):[]};}):[]:[]})[_0x7694('0x11')](function(_0x542236){logger[_0x7694('0x17')]('ShowSquareProject',_0x28399e);logger[_0x7694('0x21')](_0x7694('0x19'),_0x28399e,JSON[_0x7694('0x14')](_0x542236));_0x2112eb(_0x542236);})[_0x7694('0x22')](function(_0x4d635b){logger['error']('ShowSquareProject',_0x4d635b[_0x7694('0x16')],_0x28399e);_0x5479c7(_0x1e0c51['error'](0x1f4,_0x4d635b[_0x7694('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 531b962..117f3a9 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 _0x3258=['length','squareProject:','remove','update','emit','removeListener','register'];(function(_0xe66cf2,_0x32ba5f){var _0x2d84e7=function(_0x58a7d8){while(--_0x58a7d8){_0xe66cf2['push'](_0xe66cf2['shift']());}};_0x2d84e7(++_0x32ba5f);}(_0x3258,0x1f3));var _0x8325=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x3258[_0x321bb2];return _0x9c12ed;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=['save',_0x8325('0x0'),_0x8325('0x1')];function createListener(_0x339435,_0x3c283d){return function(_0x1e6d92){_0x3c283d[_0x8325('0x2')](_0x339435,_0x1e6d92);};}function removeListener(_0x4fa9db,_0x5d867b){return function(){SquareProjectEvents[_0x8325('0x3')](_0x4fa9db,_0x5d867b);};}exports[_0x8325('0x4')]=function(_0x443fbc){for(var _0x386d21=0x0,_0x74c874=events[_0x8325('0x5')];_0x386d21<_0x74c874;_0x386d21++){var _0x125248=events[_0x386d21];var _0x28b096=createListener(_0x8325('0x6')+_0x125248,_0x443fbc);SquareProjectEvents['on'](_0x125248,_0x28b096);}}; \ No newline at end of file +var _0x9a0a=['./squareProject.events','save','remove','update','emit','removeListener','register','length','squareProject:'];(function(_0x1b5aea,_0x1afe6f){var _0x51cae9=function(_0x1494a6){while(--_0x1494a6){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x51cae9(++_0x1afe6f);}(_0x9a0a,0x105));var _0xa9a0=function(_0x530cc0,_0x3db446){_0x530cc0=_0x530cc0-0x0;var _0x4de206=_0x9a0a[_0x530cc0];return _0x4de206;};'use strict';var SquareProjectEvents=require(_0xa9a0('0x0'));var events=[_0xa9a0('0x1'),_0xa9a0('0x2'),_0xa9a0('0x3')];function createListener(_0x1d40f9,_0x54776a){return function(_0x36d075){_0x54776a[_0xa9a0('0x4')](_0x1d40f9,_0x36d075);};}function removeListener(_0x52b894,_0x2b4941){return function(){SquareProjectEvents[_0xa9a0('0x5')](_0x52b894,_0x2b4941);};}exports[_0xa9a0('0x6')]=function(_0x48bff4){for(var _0x241828=0x0,_0x3c5b06=events[_0xa9a0('0x7')];_0x241828<_0x3c5b06;_0x241828++){var _0x3087b7=events[_0x241828];var _0x79d45f=createListener(_0xa9a0('0x8')+_0x3087b7,_0x48bff4);SquareProjectEvents['on'](_0x3087b7,_0x79d45f);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index 1fe56a5..3940cea 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 _0x1261=['isAuthenticated','show','/:id/download','post','create','/:id','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','index','get'];(function(_0x318f66,_0x2477d8){var _0x369c96=function(_0x2f77e9){while(--_0x2f77e9){_0x318f66['push'](_0x318f66['shift']());}};_0x369c96(++_0x2477d8);}(_0x1261,0x144));var _0x1126=function(_0x234ae1,_0x42bdd6){_0x234ae1=_0x234ae1-0x0;var _0x227ba0=_0x1261[_0x234ae1];return _0x227ba0;};'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('0xb')](_0x1126('0xe'),auth[_0x1126('0xc')](),controller['download']);router[_0x1126('0xf')]('/',auth[_0x1126('0xc')](),controller[_0x1126('0x10')]);router['put'](_0x1126('0x11'),auth['isAuthenticated'](),controller['update']);router[_0x1126('0x12')]('/:id',auth[_0x1126('0xc')](),controller[_0x1126('0x13')]);module[_0x1126('0x14')]=router; \ No newline at end of file +var _0x1cb9=['update','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./squareRecording.controller','get','isAuthenticated','index','/:id','show','/:id/download','download','post','create','put'];(function(_0x279443,_0x44a6c9){var _0x391b97=function(_0x3c6e7d){while(--_0x3c6e7d){_0x279443['push'](_0x279443['shift']());}};_0x391b97(++_0x44a6c9);}(_0x1cb9,0x14e));var _0x91cb=function(_0x57f5ee,_0x2d89e3){_0x57f5ee=_0x57f5ee-0x0;var _0xba854b=_0x1cb9[_0x57f5ee];return _0xba854b;};'use strict';var multer=require(_0x91cb('0x0'));var util=require('util');var path=require(_0x91cb('0x1'));var timeout=require(_0x91cb('0x2'));var express=require(_0x91cb('0x3'));var router=express[_0x91cb('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x91cb('0x5'));var interaction=require(_0x91cb('0x6'));var config=require('../../config/environment');var controller=require(_0x91cb('0x7'));router[_0x91cb('0x8')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0xa')]);router[_0x91cb('0x8')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0xc')]);router['get'](_0x91cb('0xd'),auth['isAuthenticated'](),controller[_0x91cb('0xe')]);router[_0x91cb('0xf')]('/',auth[_0x91cb('0x9')](),controller[_0x91cb('0x10')]);router[_0x91cb('0x11')](_0x91cb('0xb'),auth[_0x91cb('0x9')](),controller[_0x91cb('0x12')]);router[_0x91cb('0x13')](_0x91cb('0xb'),auth['isAuthenticated'](),controller[_0x91cb('0x14')]);module[_0x91cb('0x15')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index 88af9e3..1be8a30 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 _0x24ca=['sequelize','STRING','VIRTUAL','savePath','substring','lastIndexOf'];(function(_0x1cc62b,_0x588223){var _0x4df5c6=function(_0x4190cd){while(--_0x4190cd){_0x1cc62b['push'](_0x1cc62b['shift']());}};_0x4df5c6(++_0x588223);}(_0x24ca,0x1bc));var _0xa24c=function(_0x49ad79,_0x48ee93){_0x49ad79=_0x49ad79-0x0;var _0xa4e38a=_0x24ca[_0x49ad79];return _0xa4e38a;};'use strict';var Sequelize=require(_0xa24c('0x0'));module['exports']={'uniqueid':{'type':Sequelize[_0xa24c('0x1')]},'callerid':{'type':Sequelize[_0xa24c('0x1')]},'calleridname':{'type':Sequelize[_0xa24c('0x1')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa24c('0x1')]},'priority':{'type':Sequelize[_0xa24c('0x1')]},'accountcode':{'type':Sequelize[_0xa24c('0x1')]},'dnid':{'type':Sequelize[_0xa24c('0x1')]},'projectName':{'type':Sequelize[_0xa24c('0x1')]},'saveName':{'type':Sequelize[_0xa24c('0x1')]},'filename':{'type':Sequelize[_0xa24c('0x1')]},'savePath':{'type':Sequelize[_0xa24c('0x1')]},'format':{'type':Sequelize[_0xa24c('0x2')],'get':function(){var _0x257264='';var _0x9a5013=this['getDataValue'](_0xa24c('0x3'));if(_0x9a5013){_0x257264=_0x9a5013[_0xa24c('0x4')](_0x9a5013[_0xa24c('0x5')]('.'));}return _0x257264;}}}; \ No newline at end of file +var _0xed1f=['lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue','substring'];(function(_0x470bfb,_0x389787){var _0x2f5d97=function(_0x3431b4){while(--_0x3431b4){_0x470bfb['push'](_0x470bfb['shift']());}};_0x2f5d97(++_0x389787);}(_0xed1f,0x6a));var _0xfed1=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0xed1f[_0x45b034];return _0x509cb0;};'use strict';var Sequelize=require(_0xfed1('0x0'));module[_0xfed1('0x1')]={'uniqueid':{'type':Sequelize[_0xfed1('0x2')]},'callerid':{'type':Sequelize[_0xfed1('0x2')]},'calleridname':{'type':Sequelize[_0xfed1('0x2')]},'context':{'type':Sequelize[_0xfed1('0x2')]},'extension':{'type':Sequelize[_0xfed1('0x2')]},'priority':{'type':Sequelize[_0xfed1('0x2')]},'accountcode':{'type':Sequelize[_0xfed1('0x2')]},'dnid':{'type':Sequelize[_0xfed1('0x2')]},'projectName':{'type':Sequelize[_0xfed1('0x2')]},'saveName':{'type':Sequelize[_0xfed1('0x2')]},'filename':{'type':Sequelize[_0xfed1('0x2')]},'savePath':{'type':Sequelize[_0xfed1('0x2')]},'format':{'type':Sequelize[_0xfed1('0x3')],'get':function(){var _0x612b38='';var _0x2a6082=this[_0xfed1('0x4')]('savePath');if(_0x2a6082){_0x612b38=_0x2a6082[_0xfed1('0x5')](_0x2a6082[_0xfed1('0x6')]('.'));}return _0x612b38;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index eb25979..9870faa 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 _0x31d6=['status','json','offset','count','limit','set','Content-Range','apply','save','then','destroy','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','SquareRecording','include','rows','catch','keys','find','create','body','download','../../components/encryptor','uniqueid','params','savePath','format','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','filename','extname','unlink','message','SquareRecording\x20not\x20found','Not\x20found','Entity\x20not\x20found','info','isNil','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','.cypher','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','lodash','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','end'];(function(_0x12eb3f,_0xb9b753){var _0x4585dd=function(_0x5116e4){while(--_0x5116e4){_0x12eb3f['push'](_0x12eb3f['shift']());}};_0x4585dd(++_0xb9b753);}(_0x31d6,0x160));var _0x631d=function(_0x3dc3a5,_0x26551e){_0x3dc3a5=_0x3dc3a5-0x0;var _0x3eeffe=_0x31d6[_0x3dc3a5];return _0x3eeffe;};'use strict';var emlformat=require(_0x631d('0x0'));var rimraf=require(_0x631d('0x1'));var zipdir=require(_0x631d('0x2'));var jsonpatch=require(_0x631d('0x3'));var rp=require(_0x631d('0x4'));var moment=require(_0x631d('0x5'));var BPromise=require(_0x631d('0x6'));var Mustache=require(_0x631d('0x7'));var util=require('util');var path=require(_0x631d('0x8'));var sox=require('sox');var csv=require(_0x631d('0x9'));var ejs=require(_0x631d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x631d('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x631d('0xc'));var toCsv=require(_0x631d('0x9'));var querystring=require(_0x631d('0xd'));var Papa=require('papaparse');var Redis=require(_0x631d('0xe'));var authService=require(_0x631d('0xf'));var qs=require(_0x631d('0x10'));var as=require(_0x631d('0x11'));var hardwareService=require(_0x631d('0x12'));var logger=require('../../config/logger')(_0x631d('0x13'));var utils=require('../../config/utils');var config=require(_0x631d('0x14'));var licenseUtil=require(_0x631d('0x15'));var db=require(_0x631d('0x16'))['db'];function respondWithStatusCode(_0x3ebc31,_0x7ffc15){_0x7ffc15=_0x7ffc15||0xcc;return function(_0x22e86e){if(_0x22e86e){return _0x3ebc31['sendStatus'](_0x7ffc15);}return _0x3ebc31['status'](_0x7ffc15)[_0x631d('0x17')]();};}function respondWithResult(_0x2c5636,_0x5a8f4d){_0x5a8f4d=_0x5a8f4d||0xc8;return function(_0x3cb80d){if(_0x3cb80d){return _0x2c5636[_0x631d('0x18')](_0x5a8f4d)[_0x631d('0x19')](_0x3cb80d);}};}function respondWithFilteredResult(_0x4e9d48,_0x38aba7){return function(_0x42fb8a){if(_0x42fb8a){var _0x3ec729=typeof _0x38aba7[_0x631d('0x1a')]==='undefined'&&typeof _0x38aba7['limit']==='undefined';var _0x1071a3=_0x42fb8a[_0x631d('0x1b')];var _0x3da560=_0x3ec729?0x0:_0x38aba7[_0x631d('0x1a')];var _0x423306=_0x3ec729?_0x42fb8a[_0x631d('0x1b')]:_0x38aba7[_0x631d('0x1a')]+_0x38aba7[_0x631d('0x1c')];var _0x14ca9e;if(_0x423306>=_0x1071a3){_0x423306=_0x1071a3;_0x14ca9e=0xc8;}else{_0x14ca9e=0xce;}_0x4e9d48[_0x631d('0x18')](_0x14ca9e);return _0x4e9d48[_0x631d('0x1d')](_0x631d('0x1e'),_0x3da560+'-'+_0x423306+'/'+_0x1071a3)[_0x631d('0x19')](_0x42fb8a);}return null;};}function patchUpdates(_0x135af8){return function(_0x308c3c){try{jsonpatch[_0x631d('0x1f')](_0x308c3c,_0x135af8,!![]);}catch(_0xba7c2f){return BPromise['reject'](_0xba7c2f);}return _0x308c3c[_0x631d('0x20')]();};}function saveUpdates(_0x272639,_0xb35759){return function(_0x283487){if(_0x283487){return _0x283487['update'](_0x272639)[_0x631d('0x21')](function(_0x93f61c){return _0x93f61c;});}return null;};}function removeEntity(_0x2afe05,_0x3c1eb1){return function(_0x10ecda){if(_0x10ecda){return _0x10ecda[_0x631d('0x22')]()[_0x631d('0x21')](function(){_0x2afe05[_0x631d('0x18')](0xcc)[_0x631d('0x17')]();});}};}function handleEntityNotFound(_0x240e6a,_0x3d32f8){return function(_0xdff789){if(!_0xdff789){_0x240e6a[_0x631d('0x23')](0x194);}return _0xdff789;};}function handleError(_0x41b37d,_0x5a80fe){_0x5a80fe=_0x5a80fe||0x1f4;return function(_0x33737a){logger[_0x631d('0x24')](_0x33737a['stack']);if(_0x33737a[_0x631d('0x25')]){delete _0x33737a[_0x631d('0x25')];}_0x41b37d['status'](_0x5a80fe)[_0x631d('0x26')](_0x33737a);};}exports[_0x631d('0x27')]=function(_0x280613,_0x3eace1){var _0x3f48ea={},_0x255869={},_0x29e0db={'count':0x0,'rows':[]};var _0x46082f=_[_0x631d('0x28')](db['SquareRecording'][_0x631d('0x29')],function(_0x153e27){return{'name':_0x153e27[_0x631d('0x2a')],'type':_0x153e27[_0x631d('0x2b')][_0x631d('0x2c')]};});_0x255869[_0x631d('0x2d')]=_[_0x631d('0x28')](_0x46082f,_0x631d('0x25'));_0x255869[_0x631d('0x2e')]=_['keys'](_0x280613[_0x631d('0x2e')]);_0x255869[_0x631d('0x2f')]=_[_0x631d('0x30')](_0x255869[_0x631d('0x2d')],_0x255869[_0x631d('0x2e')]);_0x3f48ea[_0x631d('0x31')]=_['intersection'](_0x255869[_0x631d('0x2d')],qs[_0x631d('0x32')](_0x280613[_0x631d('0x2e')][_0x631d('0x32')]));_0x3f48ea[_0x631d('0x31')]=_0x3f48ea[_0x631d('0x31')][_0x631d('0x33')]?_0x3f48ea[_0x631d('0x31')]:_0x255869[_0x631d('0x2d')];if(!_0x280613[_0x631d('0x2e')][_0x631d('0x34')](_0x631d('0x35'))){_0x3f48ea['limit']=qs[_0x631d('0x1c')](_0x280613[_0x631d('0x2e')][_0x631d('0x1c')]);_0x3f48ea['offset']=qs[_0x631d('0x1a')](_0x280613[_0x631d('0x2e')]['offset']);}_0x3f48ea[_0x631d('0x36')]=qs[_0x631d('0x37')](_0x280613['query']['sort']);_0x3f48ea['where']=qs[_0x631d('0x2f')](_[_0x631d('0x38')](_0x280613[_0x631d('0x2e')],_0x255869['filters']),_0x46082f);if(_0x280613[_0x631d('0x2e')][_0x631d('0x39')]){_0x3f48ea[_0x631d('0x3a')]=_['merge'](_0x3f48ea[_0x631d('0x3a')],{'$or':_[_0x631d('0x28')](_0x46082f,function(_0x4ca0e6){if(_0x4ca0e6[_0x631d('0x2b')]!=='VIRTUAL'){var _0x473623={};_0x473623[_0x4ca0e6['name']]={'$like':'%'+_0x280613[_0x631d('0x2e')][_0x631d('0x39')]+'%'};return _0x473623;}})});}_0x3f48ea=_[_0x631d('0x3b')]({},_0x3f48ea,_0x280613[_0x631d('0x3c')]);var _0x1223b8={'where':_0x3f48ea['where']};return db[_0x631d('0x3d')][_0x631d('0x1b')](_0x1223b8)[_0x631d('0x21')](function(_0x562811){_0x29e0db['count']=_0x562811;if(_0x280613[_0x631d('0x2e')]['includeAll']){_0x3f48ea[_0x631d('0x3e')]=[{'all':!![]}];}return db[_0x631d('0x3d')]['findAll'](_0x3f48ea);})[_0x631d('0x21')](function(_0x523327){_0x29e0db[_0x631d('0x3f')]=_0x523327;return _0x29e0db;})[_0x631d('0x21')](respondWithFilteredResult(_0x3eace1,_0x3f48ea))[_0x631d('0x40')](handleError(_0x3eace1,null));};exports['show']=function(_0xfa8ca7,_0x24a4b4){var _0x2ca117={'raw':!![],'where':{'id':_0xfa8ca7['params']['id']}},_0x5ed70b={};_0x5ed70b[_0x631d('0x2d')]=_[_0x631d('0x41')](db['SquareRecording'][_0x631d('0x29')]);_0x5ed70b[_0x631d('0x2e')]=_[_0x631d('0x41')](_0xfa8ca7[_0x631d('0x2e')]);_0x5ed70b[_0x631d('0x2f')]=_['intersection'](_0x5ed70b[_0x631d('0x2d')],_0x5ed70b[_0x631d('0x2e')]);_0x2ca117[_0x631d('0x31')]=_[_0x631d('0x30')](_0x5ed70b[_0x631d('0x2d')],qs[_0x631d('0x32')](_0xfa8ca7[_0x631d('0x2e')]['fields']));_0x2ca117[_0x631d('0x31')]=_0x2ca117[_0x631d('0x31')][_0x631d('0x33')]?_0x2ca117[_0x631d('0x31')]:_0x5ed70b[_0x631d('0x2d')];if(_0xfa8ca7['query']['includeAll']){_0x2ca117['include']=[{'all':!![]}];}_0x2ca117=_[_0x631d('0x3b')]({},_0x2ca117,_0xfa8ca7[_0x631d('0x3c')]);return db[_0x631d('0x3d')][_0x631d('0x42')](_0x2ca117)[_0x631d('0x21')](handleEntityNotFound(_0x24a4b4,null))[_0x631d('0x21')](respondWithResult(_0x24a4b4,null))[_0x631d('0x40')](handleError(_0x24a4b4,null));};exports[_0x631d('0x43')]=function(_0xa08a82,_0x4e06ee){return db[_0x631d('0x3d')]['create'](_0xa08a82['body'],{})['then'](respondWithResult(_0x4e06ee,0xc9))[_0x631d('0x40')](handleError(_0x4e06ee,null));};exports['update']=function(_0x49ff4b,_0x538d8e){if(_0x49ff4b[_0x631d('0x44')]['id']){delete _0x49ff4b[_0x631d('0x44')]['id'];}return db['SquareRecording'][_0x631d('0x42')]({'where':{'id':_0x49ff4b['params']['id']}})[_0x631d('0x21')](handleEntityNotFound(_0x538d8e,null))[_0x631d('0x21')](saveUpdates(_0x49ff4b[_0x631d('0x44')],null))[_0x631d('0x21')](respondWithResult(_0x538d8e,null))['catch'](handleError(_0x538d8e,null));};exports[_0x631d('0x45')]=function(_0x31de96,_0x54aa5e,_0x448c25){var _0x3ea235=require(_0x631d('0x46'));var _0x2864bd=![];var _0x575b5a={};if(_0x31de96[_0x631d('0x2e')]['type']&&_0x31de96[_0x631d('0x2e')][_0x631d('0x2b')]==='uniqueid'){_0x575b5a[_0x631d('0x47')]=_0x31de96[_0x631d('0x48')]['id'];}else{_0x575b5a['id']=_0x31de96[_0x631d('0x48')]['id'];}return db[_0x631d('0x3d')][_0x631d('0x42')]({'where':_0x575b5a,'attributes':['id','savePath','filename'],'raw':!![]})[_0x631d('0x21')](handleEntityNotFound(_0x54aa5e,null))[_0x631d('0x21')](function(_0x9a8393){if(_0x9a8393){var _0x4cb182=_0x9a8393[_0x631d('0x49')];var _0x3955ab=util[_0x631d('0x4a')]('%s.cypher',_0x4cb182);if(fs[_0x631d('0x4b')](_0x3955ab)){_0x2864bd=!![];return _0x3ea235[_0x631d('0x4c')](_0x3955ab,_0x4cb182,config[_0x631d('0x4d')][_0x631d('0x4e')])['then'](function(){return _0x9a8393;});}return _0x9a8393;}})[_0x631d('0x21')](function(_0x1cbf98){if(_0x1cbf98){var _0x315c6e=_0x1cbf98[_0x631d('0x49')];if(!fs[_0x631d('0x4b')](_0x315c6e)){throw new db[(_0x631d('0x4f'))][(_0x631d('0x50'))]('SquareRecording\x20not\x20found');}if(_0x1cbf98[_0x631d('0x51')]){return _0x54aa5e[_0x631d('0x45')](_0x315c6e,_0x1cbf98['filename']+path[_0x631d('0x52')](_0x315c6e),function(){if(_0x2864bd){fs[_0x631d('0x53')](_0x315c6e);}});}else{return _0x54aa5e[_0x631d('0x45')](_0x315c6e,function(_0x5b421c){if(_0x2864bd){fs[_0x631d('0x53')](_0x315c6e);}});}}})[_0x631d('0x40')](function(_0x142652){if(_0x142652[_0x631d('0x54')]===_0x631d('0x55')){_0x54aa5e[_0x631d('0x18')](0x194)[_0x631d('0x26')](_0x631d('0x56'));}else{return handleError(_0x54aa5e,null);}});};exports['destroy']=function(_0x199fe1,_0x51441d){return db[_0x631d('0x3d')]['find']({'where':{'id':_0x199fe1['params']['id']}})[_0x631d('0x21')](function(_0x15551e){if(_['isNil'](_0x15551e)){throw new ReferenceError(_0x631d('0x57'));}return _0x15551e;})[_0x631d('0x21')](function(_0x3e73fd){var _0x2fea72=_0x3e73fd['savePath'];logger[_0x631d('0x58')]('cancellazione\x20fisica\x20documento\x20%s',_0x2fea72);if(!_[_0x631d('0x59')](_0x3e73fd[_0x631d('0x49')])&&fs['existsSync'](_0x2fea72)){logger[_0x631d('0x58')](_0x631d('0x5a')+_0x2fea72+_0x631d('0x5b'));fs['unlinkSync'](_0x2fea72);}_0x2fea72=_0x2fea72+_0x631d('0x5c');if(!_[_0x631d('0x59')](_0x3e73fd['savePath'])&&fs[_0x631d('0x4b')](_0x2fea72)){logger[_0x631d('0x58')](_0x631d('0x5a')+_0x2fea72+_0x631d('0x5b'));fs[_0x631d('0x5d')](_0x2fea72);}return _0x3e73fd;})[_0x631d('0x21')](function(_0x45f49f){if(!_0x45f49f)throw new InternalError();return _0x45f49f[_0x631d('0x22')]();})[_0x631d('0x21')](function(){_0x51441d[_0x631d('0x18')](0xcc)[_0x631d('0x17')]();})[_0x631d('0x40')](handleError(_0x51441d,null));}; \ No newline at end of file +var _0xdc3b=['length','hasOwnProperty','order','filter','where','merge','VIRTUAL','options','rows','catch','show','params','include','find','create','body','download','../../components/encryptor','uniqueid','savePath','format','%s.cypher','existsSync','decryptFile','recording','Sequelize','ValidationError','SquareRecording\x20not\x20found','filename','extname','unlink','Not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareRecording','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields'];(function(_0x3cc5cf,_0x5aefef){var _0x330d25=function(_0xd0eb9f){while(--_0xd0eb9f){_0x3cc5cf['push'](_0x3cc5cf['shift']());}};_0x330d25(++_0x5aefef);}(_0xdc3b,0x137));var _0xbdc3=function(_0x3bcb3f,_0x3106a0){_0x3bcb3f=_0x3bcb3f-0x0;var _0x59e8f6=_0xdc3b[_0x3bcb3f];return _0x59e8f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xbdc3('0x0'));var zipdir=require(_0xbdc3('0x1'));var jsonpatch=require(_0xbdc3('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xbdc3('0x3'));var Mustache=require(_0xbdc3('0x4'));var util=require('util');var path=require(_0xbdc3('0x5'));var sox=require(_0xbdc3('0x6'));var csv=require(_0xbdc3('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbdc3('0x8'));var _=require(_0xbdc3('0x9'));var squel=require('squel');var crypto=require(_0xbdc3('0xa'));var jsforce=require(_0xbdc3('0xb'));var deskjs=require(_0xbdc3('0xc'));var toCsv=require(_0xbdc3('0x7'));var querystring=require('querystring');var Papa=require(_0xbdc3('0xd'));var Redis=require('ioredis');var authService=require(_0xbdc3('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbdc3('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xbdc3('0x10'))(_0xbdc3('0x11'));var utils=require(_0xbdc3('0x12'));var config=require(_0xbdc3('0x13'));var licenseUtil=require(_0xbdc3('0x14'));var db=require(_0xbdc3('0x15'))['db'];function respondWithStatusCode(_0x593a81,_0x3f9b28){_0x3f9b28=_0x3f9b28||0xcc;return function(_0xe058fc){if(_0xe058fc){return _0x593a81[_0xbdc3('0x16')](_0x3f9b28);}return _0x593a81[_0xbdc3('0x17')](_0x3f9b28)[_0xbdc3('0x18')]();};}function respondWithResult(_0x163509,_0x3f108b){_0x3f108b=_0x3f108b||0xc8;return function(_0x3be740){if(_0x3be740){return _0x163509['status'](_0x3f108b)[_0xbdc3('0x19')](_0x3be740);}};}function respondWithFilteredResult(_0x410937,_0x302074){return function(_0x4fd19f){if(_0x4fd19f){var _0x3a891c=typeof _0x302074[_0xbdc3('0x1a')]===_0xbdc3('0x1b')&&typeof _0x302074['limit']===_0xbdc3('0x1b');var _0xf2e7fa=_0x4fd19f[_0xbdc3('0x1c')];var _0x34aaca=_0x3a891c?0x0:_0x302074[_0xbdc3('0x1a')];var _0x1b72ab=_0x3a891c?_0x4fd19f[_0xbdc3('0x1c')]:_0x302074['offset']+_0x302074[_0xbdc3('0x1d')];var _0x49c046;if(_0x1b72ab>=_0xf2e7fa){_0x1b72ab=_0xf2e7fa;_0x49c046=0xc8;}else{_0x49c046=0xce;}_0x410937['status'](_0x49c046);return _0x410937['set']('Content-Range',_0x34aaca+'-'+_0x1b72ab+'/'+_0xf2e7fa)[_0xbdc3('0x19')](_0x4fd19f);}return null;};}function patchUpdates(_0x3357c0){return function(_0x259670){try{jsonpatch[_0xbdc3('0x1e')](_0x259670,_0x3357c0,!![]);}catch(_0x4e04ad){return BPromise[_0xbdc3('0x1f')](_0x4e04ad);}return _0x259670[_0xbdc3('0x20')]();};}function saveUpdates(_0x161e5d,_0x10784b){return function(_0xc3c01a){if(_0xc3c01a){return _0xc3c01a[_0xbdc3('0x21')](_0x161e5d)[_0xbdc3('0x22')](function(_0x1b2a3d){return _0x1b2a3d;});}return null;};}function removeEntity(_0x48ea04,_0x8c327f){return function(_0x1735d0){if(_0x1735d0){return _0x1735d0[_0xbdc3('0x23')]()['then'](function(){_0x48ea04[_0xbdc3('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1dff73,_0x208513){return function(_0x32dadc){if(!_0x32dadc){_0x1dff73[_0xbdc3('0x16')](0x194);}return _0x32dadc;};}function handleError(_0x16b55b,_0x530b91){_0x530b91=_0x530b91||0x1f4;return function(_0x22ba52){logger[_0xbdc3('0x24')](_0x22ba52[_0xbdc3('0x25')]);if(_0x22ba52[_0xbdc3('0x26')]){delete _0x22ba52['name'];}_0x16b55b[_0xbdc3('0x17')](_0x530b91)[_0xbdc3('0x27')](_0x22ba52);};}exports['index']=function(_0x11e7aa,_0x245fcd){var _0x46547f={},_0x5e4253={},_0x31e85c={'count':0x0,'rows':[]};var _0x27e5a0=_[_0xbdc3('0x28')](db[_0xbdc3('0x29')][_0xbdc3('0x2a')],function(_0x25841a){return{'name':_0x25841a[_0xbdc3('0x2b')],'type':_0x25841a[_0xbdc3('0x2c')][_0xbdc3('0x2d')]};});_0x5e4253['model']=_[_0xbdc3('0x28')](_0x27e5a0,'name');_0x5e4253[_0xbdc3('0x2e')]=_[_0xbdc3('0x2f')](_0x11e7aa[_0xbdc3('0x2e')]);_0x5e4253[_0xbdc3('0x30')]=_['intersection'](_0x5e4253[_0xbdc3('0x31')],_0x5e4253[_0xbdc3('0x2e')]);_0x46547f[_0xbdc3('0x32')]=_[_0xbdc3('0x33')](_0x5e4253[_0xbdc3('0x31')],qs[_0xbdc3('0x34')](_0x11e7aa['query'][_0xbdc3('0x34')]));_0x46547f[_0xbdc3('0x32')]=_0x46547f['attributes'][_0xbdc3('0x35')]?_0x46547f[_0xbdc3('0x32')]:_0x5e4253[_0xbdc3('0x31')];if(!_0x11e7aa[_0xbdc3('0x2e')][_0xbdc3('0x36')]('nolimit')){_0x46547f[_0xbdc3('0x1d')]=qs['limit'](_0x11e7aa[_0xbdc3('0x2e')][_0xbdc3('0x1d')]);_0x46547f[_0xbdc3('0x1a')]=qs['offset'](_0x11e7aa[_0xbdc3('0x2e')][_0xbdc3('0x1a')]);}_0x46547f[_0xbdc3('0x37')]=qs['sort'](_0x11e7aa['query']['sort']);_0x46547f['where']=qs['filters'](_['pick'](_0x11e7aa[_0xbdc3('0x2e')],_0x5e4253[_0xbdc3('0x30')]),_0x27e5a0);if(_0x11e7aa[_0xbdc3('0x2e')][_0xbdc3('0x38')]){_0x46547f[_0xbdc3('0x39')]=_[_0xbdc3('0x3a')](_0x46547f[_0xbdc3('0x39')],{'$or':_[_0xbdc3('0x28')](_0x27e5a0,function(_0x4c5d7f){if(_0x4c5d7f['type']!==_0xbdc3('0x3b')){var _0x18a467={};_0x18a467[_0x4c5d7f[_0xbdc3('0x26')]]={'$like':'%'+_0x11e7aa[_0xbdc3('0x2e')]['filter']+'%'};return _0x18a467;}})});}_0x46547f=_[_0xbdc3('0x3a')]({},_0x46547f,_0x11e7aa[_0xbdc3('0x3c')]);var _0x427746={'where':_0x46547f[_0xbdc3('0x39')]};return db[_0xbdc3('0x29')][_0xbdc3('0x1c')](_0x427746)[_0xbdc3('0x22')](function(_0x25261a){_0x31e85c[_0xbdc3('0x1c')]=_0x25261a;if(_0x11e7aa[_0xbdc3('0x2e')]['includeAll']){_0x46547f['include']=[{'all':!![]}];}return db[_0xbdc3('0x29')]['findAll'](_0x46547f);})[_0xbdc3('0x22')](function(_0x21197e){_0x31e85c[_0xbdc3('0x3d')]=_0x21197e;return _0x31e85c;})[_0xbdc3('0x22')](respondWithFilteredResult(_0x245fcd,_0x46547f))[_0xbdc3('0x3e')](handleError(_0x245fcd,null));};exports[_0xbdc3('0x3f')]=function(_0x445a16,_0x36869d){var _0x5079cf={'raw':!![],'where':{'id':_0x445a16[_0xbdc3('0x40')]['id']}},_0x3f4ab2={};_0x3f4ab2[_0xbdc3('0x31')]=_['keys'](db[_0xbdc3('0x29')][_0xbdc3('0x2a')]);_0x3f4ab2[_0xbdc3('0x2e')]=_[_0xbdc3('0x2f')](_0x445a16[_0xbdc3('0x2e')]);_0x3f4ab2[_0xbdc3('0x30')]=_[_0xbdc3('0x33')](_0x3f4ab2['model'],_0x3f4ab2[_0xbdc3('0x2e')]);_0x5079cf[_0xbdc3('0x32')]=_[_0xbdc3('0x33')](_0x3f4ab2['model'],qs[_0xbdc3('0x34')](_0x445a16['query'][_0xbdc3('0x34')]));_0x5079cf[_0xbdc3('0x32')]=_0x5079cf[_0xbdc3('0x32')]['length']?_0x5079cf[_0xbdc3('0x32')]:_0x3f4ab2[_0xbdc3('0x31')];if(_0x445a16[_0xbdc3('0x2e')]['includeAll']){_0x5079cf[_0xbdc3('0x41')]=[{'all':!![]}];}_0x5079cf=_[_0xbdc3('0x3a')]({},_0x5079cf,_0x445a16[_0xbdc3('0x3c')]);return db[_0xbdc3('0x29')][_0xbdc3('0x42')](_0x5079cf)[_0xbdc3('0x22')](handleEntityNotFound(_0x36869d,null))[_0xbdc3('0x22')](respondWithResult(_0x36869d,null))[_0xbdc3('0x3e')](handleError(_0x36869d,null));};exports['create']=function(_0x3c18c9,_0x1029cf){return db[_0xbdc3('0x29')][_0xbdc3('0x43')](_0x3c18c9[_0xbdc3('0x44')],{})[_0xbdc3('0x22')](respondWithResult(_0x1029cf,0xc9))[_0xbdc3('0x3e')](handleError(_0x1029cf,null));};exports['update']=function(_0x4837fb,_0x459890){if(_0x4837fb[_0xbdc3('0x44')]['id']){delete _0x4837fb[_0xbdc3('0x44')]['id'];}return db['SquareRecording'][_0xbdc3('0x42')]({'where':{'id':_0x4837fb[_0xbdc3('0x40')]['id']}})[_0xbdc3('0x22')](handleEntityNotFound(_0x459890,null))[_0xbdc3('0x22')](saveUpdates(_0x4837fb[_0xbdc3('0x44')],null))[_0xbdc3('0x22')](respondWithResult(_0x459890,null))[_0xbdc3('0x3e')](handleError(_0x459890,null));};exports[_0xbdc3('0x45')]=function(_0x2da2d6,_0x422000,_0x440c03){var _0x59d157=require(_0xbdc3('0x46'));var _0x201fa=![];var _0x433102={};if(_0x2da2d6[_0xbdc3('0x2e')][_0xbdc3('0x2c')]&&_0x2da2d6[_0xbdc3('0x2e')][_0xbdc3('0x2c')]===_0xbdc3('0x47')){_0x433102['uniqueid']=_0x2da2d6[_0xbdc3('0x40')]['id'];}else{_0x433102['id']=_0x2da2d6[_0xbdc3('0x40')]['id'];}return db[_0xbdc3('0x29')][_0xbdc3('0x42')]({'where':_0x433102,'attributes':['id',_0xbdc3('0x48'),'filename'],'raw':!![]})[_0xbdc3('0x22')](handleEntityNotFound(_0x422000,null))[_0xbdc3('0x22')](function(_0xcc42a9){if(_0xcc42a9){var _0x4ebaca=_0xcc42a9['savePath'];var _0x1f2377=util[_0xbdc3('0x49')](_0xbdc3('0x4a'),_0x4ebaca);if(fs[_0xbdc3('0x4b')](_0x1f2377)){_0x201fa=!![];return _0x59d157[_0xbdc3('0x4c')](_0x1f2377,_0x4ebaca,config['secrets'][_0xbdc3('0x4d')])[_0xbdc3('0x22')](function(){return _0xcc42a9;});}return _0xcc42a9;}})['then'](function(_0x3bc6b7){if(_0x3bc6b7){var _0x54d01b=_0x3bc6b7[_0xbdc3('0x48')];if(!fs[_0xbdc3('0x4b')](_0x54d01b)){throw new db[(_0xbdc3('0x4e'))][(_0xbdc3('0x4f'))](_0xbdc3('0x50'));}if(_0x3bc6b7['filename']){return _0x422000[_0xbdc3('0x45')](_0x54d01b,_0x3bc6b7[_0xbdc3('0x51')]+path[_0xbdc3('0x52')](_0x54d01b),function(){if(_0x201fa){fs[_0xbdc3('0x53')](_0x54d01b);}});}else{return _0x422000['download'](_0x54d01b,function(_0x375396){if(_0x201fa){fs[_0xbdc3('0x53')](_0x54d01b);}});}}})[_0xbdc3('0x3e')](function(_0x5ceb56){if(_0x5ceb56['message']===_0xbdc3('0x50')){_0x422000['status'](0x194)[_0xbdc3('0x27')](_0xbdc3('0x54'));}else{return handleError(_0x422000,null);}});};exports[_0xbdc3('0x23')]=function(_0x3f0af6,_0x4e6811){return db[_0xbdc3('0x29')]['find']({'where':{'id':_0x3f0af6[_0xbdc3('0x40')]['id']}})['then'](function(_0x5e1fbf){if(_['isNil'](_0x5e1fbf)){throw new ReferenceError('Entity\x20not\x20found');}return _0x5e1fbf;})[_0xbdc3('0x22')](function(_0x39b993){var _0x49231b=_0x39b993[_0xbdc3('0x48')];logger['info'](_0xbdc3('0x55'),_0x49231b);if(!_[_0xbdc3('0x56')](_0x39b993[_0xbdc3('0x48')])&&fs[_0xbdc3('0x4b')](_0x49231b)){logger[_0xbdc3('0x57')](_0xbdc3('0x58')+_0x49231b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0xbdc3('0x59')](_0x49231b);}_0x49231b=_0x49231b+'.cypher';if(!_['isNil'](_0x39b993['savePath'])&&fs[_0xbdc3('0x4b')](_0x49231b)){logger['info'](_0xbdc3('0x58')+_0x49231b+_0xbdc3('0x5a'));fs[_0xbdc3('0x59')](_0x49231b);}return _0x39b993;})[_0xbdc3('0x22')](function(_0x4e6fff){if(!_0x4e6fff)throw new InternalError();return _0x4e6fff['destroy']();})['then'](function(){_0x4e6811['status'](0xcc)[_0xbdc3('0x18')]();})[_0xbdc3('0x3e')](handleError(_0x4e6811,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index e5500c8..118358f 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 _0xaf5a=['./squareRecording.attributes','exports','square_recordings','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf'];(function(_0x5cf4b3,_0x5a1483){var _0x4d78ef=function(_0x1bfa9e){while(--_0x1bfa9e){_0x5cf4b3['push'](_0x5cf4b3['shift']());}};_0x4d78ef(++_0x5a1483);}(_0xaf5a,0x116));var _0xaaf5=function(_0x22754d,_0x3ffa6b){_0x22754d=_0x22754d-0x0;var _0x4e2724=_0xaf5a[_0x22754d];return _0x4e2724;};'use strict';var _=require('lodash');var util=require(_0xaaf5('0x0'));var logger=require(_0xaaf5('0x1'))(_0xaaf5('0x2'));var moment=require(_0xaaf5('0x3'));var BPromise=require(_0xaaf5('0x4'));var rp=require(_0xaaf5('0x5'));var fs=require('fs');var path=require(_0xaaf5('0x6'));var rimraf=require(_0xaaf5('0x7'));var config=require('../../config/environment');var attributes=require(_0xaaf5('0x8'));module[_0xaaf5('0x9')]=function(_0x38d568,_0x8833b8){return _0x38d568['define']('SquareRecording',attributes,{'tableName':_0xaaf5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x147b=['api','moment','request-promise','path','rimraf','./squareRecording.attributes','define','lodash','util'];(function(_0xeb29c7,_0x3969a5){var _0x55e291=function(_0x120b00){while(--_0x120b00){_0xeb29c7['push'](_0xeb29c7['shift']());}};_0x55e291(++_0x3969a5);}(_0x147b,0x193));var _0xb147=function(_0x21f9fc,_0x33b8f2){_0x21f9fc=_0x21f9fc-0x0;var _0x1b5af9=_0x147b[_0x21f9fc];return _0x1b5af9;};'use strict';var _=require(_0xb147('0x0'));var util=require(_0xb147('0x1'));var logger=require('../../config/logger')(_0xb147('0x2'));var moment=require(_0xb147('0x3'));var BPromise=require('bluebird');var rp=require(_0xb147('0x4'));var fs=require('fs');var path=require(_0xb147('0x5'));var rimraf=require(_0xb147('0x6'));var config=require('../../config/environment');var attributes=require(_0xb147('0x7'));module['exports']=function(_0x2432f1,_0x72c3cf){return _0x2432f1[_0xb147('0x8')]('SquareRecording',attributes,{'tableName':'square_recordings','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 681ae9d..6acdc5b 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 _0xb675=['catch','CreateSquareRecording','SquareRecording','create','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xb675,0xe0));var _0x5b67=function(_0xd98ca3,_0x38fbd9){_0xd98ca3=_0xd98ca3-0x0;var _0x35960d=_0xb675[_0xd98ca3];return _0x35960d;};'use strict';var _=require(_0x5b67('0x0'));var util=require(_0x5b67('0x1'));var moment=require(_0x5b67('0x2'));var BPromise=require(_0x5b67('0x3'));var rs=require(_0x5b67('0x4'));var fs=require('fs');var Redis=require(_0x5b67('0x5'));var db=require(_0x5b67('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5b67('0x7'));var config=require(_0x5b67('0x8'));var jayson=require(_0x5b67('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x318203,_0x588d0e,_0x3e23b7){return new BPromise(function(_0x15222c,_0x2d0ae0){return client[_0x5b67('0xa')](_0x318203,_0x3e23b7)[_0x5b67('0xb')](function(_0x2ac7b1){logger[_0x5b67('0xc')](_0x5b67('0xd'),_0x588d0e,_0x5b67('0xe'));logger['debug']('SquareRecording,\x20%s,\x20%s,\x20%s',_0x588d0e,'request\x20sent',JSON[_0x5b67('0xf')](_0x2ac7b1));if(_0x2ac7b1['error']){if(_0x2ac7b1[_0x5b67('0x10')]['code']===0x1f4){logger[_0x5b67('0x10')](_0x5b67('0xd'),_0x588d0e,_0x2ac7b1['error'][_0x5b67('0x11')]);return _0x2d0ae0(_0x2ac7b1[_0x5b67('0x10')]['message']);}logger[_0x5b67('0x10')]('SquareRecording,\x20%s,\x20%s',_0x588d0e,_0x2ac7b1['error'][_0x5b67('0x11')]);return _0x15222c(_0x2ac7b1['error'][_0x5b67('0x11')]);}else{logger[_0x5b67('0xc')]('SquareRecording,\x20%s,\x20%s',_0x588d0e,_0x5b67('0xe'));_0x15222c(_0x2ac7b1[_0x5b67('0x12')][_0x5b67('0x11')]);}})[_0x5b67('0x13')](function(_0x4d4da0){logger[_0x5b67('0x10')](_0x5b67('0xd'),_0x588d0e,_0x4d4da0);_0x2d0ae0(_0x4d4da0);});});}exports[_0x5b67('0x14')]=function(_0x452d6b){var _0x567e2b=this;return new Promise(function(_0x243c3a,_0x3fe358){return db[_0x5b67('0x15')][_0x5b67('0x16')](_0x452d6b[_0x5b67('0x17')],{'raw':_0x452d6b[_0x5b67('0x18')]?_0x452d6b[_0x5b67('0x18')][_0x5b67('0x19')]===undefined?!![]:![]:!![]})[_0x5b67('0xb')](function(_0x28f05f){logger[_0x5b67('0xc')](_0x5b67('0x14'),_0x452d6b);logger[_0x5b67('0x1a')](_0x5b67('0x14'),_0x452d6b,JSON[_0x5b67('0xf')](_0x28f05f));_0x243c3a(_0x28f05f);})['catch'](function(_0x18a613){logger[_0x5b67('0x10')](_0x5b67('0x14'),_0x18a613[_0x5b67('0x11')],_0x452d6b);_0x3fe358(_0x567e2b[_0x5b67('0x10')](0x1f4,_0x18a613[_0x5b67('0x11')]));});});}; \ No newline at end of file +var _0x1bf1=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','then','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','create','body','options','raw','CreateSquareRecording','lodash','util','moment','bluebird'];(function(_0x12d87d,_0x1ab7ea){var _0x476ac7=function(_0x4f53a5){while(--_0x4f53a5){_0x12d87d['push'](_0x12d87d['shift']());}};_0x476ac7(++_0x1ab7ea);}(_0x1bf1,0x1ac));var _0x11bf=function(_0x72895a,_0x433607){_0x72895a=_0x72895a-0x0;var _0x5226d5=_0x1bf1[_0x72895a];return _0x5226d5;};'use strict';var _=require(_0x11bf('0x0'));var util=require(_0x11bf('0x1'));var moment=require(_0x11bf('0x2'));var BPromise=require(_0x11bf('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11bf('0x4'));var db=require(_0x11bf('0x5'))['db'];var utils=require(_0x11bf('0x6'));var logger=require(_0x11bf('0x7'))(_0x11bf('0x8'));var config=require('../../config/environment');var jayson=require(_0x11bf('0x9'));var client=jayson[_0x11bf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3a4fdd,_0x4d65ab,_0x4d4a32){return new BPromise(function(_0x54a5a4,_0x57541d){return client['request'](_0x3a4fdd,_0x4d4a32)[_0x11bf('0xb')](function(_0xf488b){logger[_0x11bf('0xc')](_0x11bf('0xd'),_0x4d65ab,'request\x20sent');logger[_0x11bf('0xe')](_0x11bf('0xf'),_0x4d65ab,_0x11bf('0x10'),JSON[_0x11bf('0x11')](_0xf488b));if(_0xf488b[_0x11bf('0x12')]){if(_0xf488b['error']['code']===0x1f4){logger[_0x11bf('0x12')](_0x11bf('0xd'),_0x4d65ab,_0xf488b[_0x11bf('0x12')]['message']);return _0x57541d(_0xf488b[_0x11bf('0x12')][_0x11bf('0x13')]);}logger[_0x11bf('0x12')](_0x11bf('0xd'),_0x4d65ab,_0xf488b[_0x11bf('0x12')][_0x11bf('0x13')]);return _0x54a5a4(_0xf488b[_0x11bf('0x12')][_0x11bf('0x13')]);}else{logger[_0x11bf('0xc')](_0x11bf('0xd'),_0x4d65ab,_0x11bf('0x10'));_0x54a5a4(_0xf488b[_0x11bf('0x14')][_0x11bf('0x13')]);}})[_0x11bf('0x15')](function(_0x5a3cd9){logger[_0x11bf('0x12')](_0x11bf('0xd'),_0x4d65ab,_0x5a3cd9);_0x57541d(_0x5a3cd9);});});}exports['CreateSquareRecording']=function(_0x30da29){var _0x2f6e73=this;return new Promise(function(_0x3e3d38,_0x54445e){return db['SquareRecording'][_0x11bf('0x16')](_0x30da29[_0x11bf('0x17')],{'raw':_0x30da29[_0x11bf('0x18')]?_0x30da29[_0x11bf('0x18')][_0x11bf('0x19')]===undefined?!![]:![]:!![]})[_0x11bf('0xb')](function(_0x529488){logger['info'](_0x11bf('0x1a'),_0x30da29);logger[_0x11bf('0xe')](_0x11bf('0x1a'),_0x30da29,JSON[_0x11bf('0x11')](_0x529488));_0x3e3d38(_0x529488);})[_0x11bf('0x15')](function(_0xae977e){logger['error']('CreateSquareRecording',_0xae977e['message'],_0x30da29);_0x54445e(_0x2f6e73[_0x11bf('0x12')](0x1f4,_0xae977e[_0x11bf('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 34cc22d..79f2732 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 _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x3da707,_0x30c36d){var _0x342ee7=function(_0x175135){while(--_0x175135){_0x3da707['push'](_0x3da707['shift']());}};_0x342ee7(++_0x30c36d);}(_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'));var controller=require('./squareReport.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xbaf0=['/:id','update','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index','/describe','show','post','create','put'];(function(_0xb7627e,_0x3f71ea){var _0x137dbb=function(_0x158aee){while(--_0x158aee){_0xb7627e['push'](_0xb7627e['shift']());}};_0x137dbb(++_0x3f71ea);}(_0xbaf0,0x12a));var _0x0baf=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xbaf0[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['describe']);router[_0x0baf('0x9')]('/:id',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0xe')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')](_0x0baf('0x11'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x12')]);router[_0x0baf('0x13')](_0x0baf('0x11'),auth['isAuthenticated'](),controller['destroy']);module[_0x0baf('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 cea277b..f891be7 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 _0xdfb1=['sequelize','exports','STRING','DATE','BOOLEAN'];(function(_0x67b7fb,_0x429a6e){var _0x1e9142=function(_0x30f349){while(--_0x30f349){_0x67b7fb['push'](_0x67b7fb['shift']());}};_0x1e9142(++_0x429a6e);}(_0xdfb1,0x8c));var _0x1dfb=function(_0x21e9c8,_0x547bfa){_0x21e9c8=_0x21e9c8-0x0;var _0x26f560=_0xdfb1[_0x21e9c8];return _0x26f560;};'use strict';var Sequelize=require(_0x1dfb('0x0'));module[_0x1dfb('0x1')]={'network':{'type':Sequelize[_0x1dfb('0x2')]},'network_script':{'type':Sequelize[_0x1dfb('0x2')]},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0x1dfb('0x2')]},'language':{'type':Sequelize[_0x1dfb('0x2')]},'type':{'type':Sequelize[_0x1dfb('0x2')]},'uniqueid':{'type':Sequelize[_0x1dfb('0x2')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'callingpres':{'type':Sequelize[_0x1dfb('0x2')]},'callingani2':{'type':Sequelize[_0x1dfb('0x2')]},'callington':{'type':Sequelize[_0x1dfb('0x2')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x1dfb('0x2')]},'rdnis':{'type':Sequelize[_0x1dfb('0x2')]},'context':{'type':Sequelize[_0x1dfb('0x2')]},'extension':{'type':Sequelize[_0x1dfb('0x2')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize[_0x1dfb('0x2')]},'accountcode':{'type':Sequelize[_0x1dfb('0x2')]},'threadid':{'type':Sequelize[_0x1dfb('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x1dfb('0x3')]},'leaveAt':{'type':Sequelize[_0x1dfb('0x3')]},'bot':{'type':Sequelize[_0x1dfb('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xa794=['exports','STRING','DATE','BOOLEAN','sequelize'];(function(_0x3c5a82,_0x5d00b1){var _0x29d919=function(_0x503f25){while(--_0x503f25){_0x3c5a82['push'](_0x3c5a82['shift']());}};_0x29d919(++_0x5d00b1);}(_0xa794,0x126));var _0x4a79=function(_0x2b271a,_0x1e3da4){_0x2b271a=_0x2b271a-0x0;var _0x134170=_0xa794[_0x2b271a];return _0x134170;};'use strict';var Sequelize=require(_0x4a79('0x0'));module[_0x4a79('0x1')]={'network':{'type':Sequelize[_0x4a79('0x2')]},'network_script':{'type':Sequelize[_0x4a79('0x2')]},'request':{'type':Sequelize[_0x4a79('0x2')]},'channel':{'type':Sequelize[_0x4a79('0x2')]},'language':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x4a79('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'version':{'type':Sequelize[_0x4a79('0x2')]},'callerid':{'type':Sequelize[_0x4a79('0x2')]},'calleridname':{'type':Sequelize[_0x4a79('0x2')]},'callingpres':{'type':Sequelize[_0x4a79('0x2')]},'callingani2':{'type':Sequelize[_0x4a79('0x2')]},'callington':{'type':Sequelize['STRING']},'callingtns':{'type':Sequelize[_0x4a79('0x2')]},'dnid':{'type':Sequelize[_0x4a79('0x2')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4a79('0x2')]},'extension':{'type':Sequelize[_0x4a79('0x2')]},'priority':{'type':Sequelize[_0x4a79('0x2')]},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4a79('0x2')]},'threadid':{'type':Sequelize[_0x4a79('0x2')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x4a79('0x3')]},'leaveAt':{'type':Sequelize[_0x4a79('0x3')]},'bot':{'type':Sequelize[_0x4a79('0x4')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 0055a0f..2f7662f 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 _0x3297=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','SquareReport','catch','length','body','params','find','eml-format','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'];(function(_0x860966,_0x4c00b){var _0x33770f=function(_0x2c7aef){while(--_0x2c7aef){_0x860966['push'](_0x860966['shift']());}};_0x33770f(++_0x4c00b);}(_0x3297,0xcd));var _0x7329=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0x3297[_0x4fc9e6];return _0x551d28;};'use strict';var emlformat=require(_0x7329('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7329('0x1'));var jsonpatch=require(_0x7329('0x2'));var rp=require(_0x7329('0x3'));var moment=require(_0x7329('0x4'));var BPromise=require(_0x7329('0x5'));var Mustache=require(_0x7329('0x6'));var util=require(_0x7329('0x7'));var path=require(_0x7329('0x8'));var sox=require(_0x7329('0x9'));var csv=require(_0x7329('0xa'));var ejs=require(_0x7329('0xb'));var fs=require('fs');var fs_extra=require(_0x7329('0xc'));var _=require(_0x7329('0xd'));var squel=require(_0x7329('0xe'));var crypto=require(_0x7329('0xf'));var jsforce=require(_0x7329('0x10'));var deskjs=require(_0x7329('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x7329('0x12'));var Redis=require(_0x7329('0x13'));var authService=require(_0x7329('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x7329('0x15'));var hardwareService=require(_0x7329('0x16'));var logger=require(_0x7329('0x17'))(_0x7329('0x18'));var utils=require('../../config/utils');var config=require(_0x7329('0x19'));var licenseUtil=require(_0x7329('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57b579,_0x4f7032){_0x4f7032=_0x4f7032||0xcc;return function(_0x55f173){if(_0x55f173){return _0x57b579[_0x7329('0x1b')](_0x4f7032);}return _0x57b579[_0x7329('0x1c')](_0x4f7032)[_0x7329('0x1d')]();};}function respondWithResult(_0x56b9a6,_0x46ecad){_0x46ecad=_0x46ecad||0xc8;return function(_0x416fd9){if(_0x416fd9){return _0x56b9a6['status'](_0x46ecad)[_0x7329('0x1e')](_0x416fd9);}};}function respondWithFilteredResult(_0x48117a,_0x41a742){return function(_0x437394){if(_0x437394){var _0x3ff8b1=typeof _0x41a742['offset']===_0x7329('0x1f')&&typeof _0x41a742[_0x7329('0x20')]==='undefined';var _0x96e4c3=_0x437394[_0x7329('0x21')];var _0x4f65a4=_0x3ff8b1?0x0:_0x41a742[_0x7329('0x22')];var _0x56447b=_0x3ff8b1?_0x437394[_0x7329('0x21')]:_0x41a742['offset']+_0x41a742[_0x7329('0x20')];var _0x3dc008;if(_0x56447b>=_0x96e4c3){_0x56447b=_0x96e4c3;_0x3dc008=0xc8;}else{_0x3dc008=0xce;}_0x48117a['status'](_0x3dc008);return _0x48117a[_0x7329('0x23')](_0x7329('0x24'),_0x4f65a4+'-'+_0x56447b+'/'+_0x96e4c3)[_0x7329('0x1e')](_0x437394);}return null;};}function patchUpdates(_0x4338c2){return function(_0x1c9b6c){try{jsonpatch[_0x7329('0x25')](_0x1c9b6c,_0x4338c2,!![]);}catch(_0x54bbce){return BPromise[_0x7329('0x26')](_0x54bbce);}return _0x1c9b6c['save']();};}function saveUpdates(_0x296555,_0xfba896){return function(_0x45ab33){if(_0x45ab33){return _0x45ab33[_0x7329('0x27')](_0x296555)[_0x7329('0x28')](function(_0x5b7f78){return _0x5b7f78;});}return null;};}function removeEntity(_0x298b27,_0x2fb1ff){return function(_0x2c1f7f){if(_0x2c1f7f){return _0x2c1f7f[_0x7329('0x29')]()['then'](function(){_0x298b27['status'](0xcc)[_0x7329('0x1d')]();});}};}function handleEntityNotFound(_0x30391c,_0x3611de){return function(_0x5cea7b){if(!_0x5cea7b){_0x30391c[_0x7329('0x1b')](0x194);}return _0x5cea7b;};}function handleError(_0x2da173,_0x53ed41){_0x53ed41=_0x53ed41||0x1f4;return function(_0x299ba2){logger[_0x7329('0x2a')](_0x299ba2[_0x7329('0x2b')]);if(_0x299ba2[_0x7329('0x2c')]){delete _0x299ba2[_0x7329('0x2c')];}_0x2da173[_0x7329('0x1c')](_0x53ed41)['send'](_0x299ba2);};}exports[_0x7329('0x2d')]=function(_0x4f1edb,_0x35e332){var _0x57e9c4={},_0x299106={},_0x31f8c4={'count':0x0,'rows':[]};var _0x40e133=_['map'](db['SquareReport'][_0x7329('0x2e')],function(_0x54c526){return{'name':_0x54c526[_0x7329('0x2f')],'type':_0x54c526[_0x7329('0x30')][_0x7329('0x31')]};});_0x299106[_0x7329('0x32')]=_[_0x7329('0x33')](_0x40e133,'name');_0x299106[_0x7329('0x34')]=_[_0x7329('0x35')](_0x4f1edb['query']);_0x299106[_0x7329('0x36')]=_[_0x7329('0x37')](_0x299106['model'],_0x299106[_0x7329('0x34')]);_0x57e9c4[_0x7329('0x38')]=_[_0x7329('0x37')](_0x299106[_0x7329('0x32')],qs[_0x7329('0x39')](_0x4f1edb['query'][_0x7329('0x39')]));_0x57e9c4[_0x7329('0x38')]=_0x57e9c4[_0x7329('0x38')]['length']?_0x57e9c4[_0x7329('0x38')]:_0x299106['model'];if(!_0x4f1edb[_0x7329('0x34')][_0x7329('0x3a')]('nolimit')){_0x57e9c4[_0x7329('0x20')]=qs[_0x7329('0x20')](_0x4f1edb[_0x7329('0x34')]['limit']);_0x57e9c4[_0x7329('0x22')]=qs[_0x7329('0x22')](_0x4f1edb[_0x7329('0x34')][_0x7329('0x22')]);}_0x57e9c4[_0x7329('0x3b')]=qs[_0x7329('0x3c')](_0x4f1edb[_0x7329('0x34')][_0x7329('0x3c')]);_0x57e9c4[_0x7329('0x3d')]=qs[_0x7329('0x36')](_[_0x7329('0x3e')](_0x4f1edb[_0x7329('0x34')],_0x299106[_0x7329('0x36')]),_0x40e133);if(_0x4f1edb['query'][_0x7329('0x3f')]){_0x57e9c4[_0x7329('0x3d')]=_[_0x7329('0x40')](_0x57e9c4[_0x7329('0x3d')],{'$or':_[_0x7329('0x33')](_0x40e133,function(_0x3f6f3c){if(_0x3f6f3c[_0x7329('0x30')]!==_0x7329('0x41')){var _0x1d2884={};_0x1d2884[_0x3f6f3c[_0x7329('0x2c')]]={'$like':'%'+_0x4f1edb[_0x7329('0x34')]['filter']+'%'};return _0x1d2884;}})});}_0x57e9c4=_[_0x7329('0x40')]({},_0x57e9c4,_0x4f1edb[_0x7329('0x42')]);var _0x54853c={'where':_0x57e9c4[_0x7329('0x3d')]};return db['SquareReport'][_0x7329('0x21')](_0x54853c)[_0x7329('0x28')](function(_0x3742ed){_0x31f8c4['count']=_0x3742ed;if(_0x4f1edb[_0x7329('0x34')][_0x7329('0x43')]){_0x57e9c4[_0x7329('0x44')]=[{'all':!![]}];}return db[_0x7329('0x45')]['findAll'](_0x57e9c4);})[_0x7329('0x28')](function(_0x23268f){_0x31f8c4['rows']=_0x23268f;return _0x31f8c4;})[_0x7329('0x28')](respondWithFilteredResult(_0x35e332,_0x57e9c4))[_0x7329('0x46')](handleError(_0x35e332,null));};exports['show']=function(_0x3481a7,_0x2e1999){var _0x258b0e={'raw':!![],'where':{'id':_0x3481a7['params']['id']}},_0x69700e={};_0x69700e[_0x7329('0x32')]=_[_0x7329('0x35')](db[_0x7329('0x45')][_0x7329('0x2e')]);_0x69700e['query']=_[_0x7329('0x35')](_0x3481a7['query']);_0x69700e['filters']=_[_0x7329('0x37')](_0x69700e[_0x7329('0x32')],_0x69700e[_0x7329('0x34')]);_0x258b0e[_0x7329('0x38')]=_[_0x7329('0x37')](_0x69700e[_0x7329('0x32')],qs['fields'](_0x3481a7[_0x7329('0x34')][_0x7329('0x39')]));_0x258b0e['attributes']=_0x258b0e['attributes'][_0x7329('0x47')]?_0x258b0e['attributes']:_0x69700e['model'];if(_0x3481a7[_0x7329('0x34')][_0x7329('0x43')]){_0x258b0e[_0x7329('0x44')]=[{'all':!![]}];}_0x258b0e=_['merge']({},_0x258b0e,_0x3481a7[_0x7329('0x42')]);return db[_0x7329('0x45')]['find'](_0x258b0e)[_0x7329('0x28')](handleEntityNotFound(_0x2e1999,null))[_0x7329('0x28')](respondWithResult(_0x2e1999,null))[_0x7329('0x46')](handleError(_0x2e1999,null));};exports['create']=function(_0x525bce,_0x22303e){return db[_0x7329('0x45')]['create'](_0x525bce[_0x7329('0x48')],{})[_0x7329('0x28')](respondWithResult(_0x22303e,0xc9))['catch'](handleError(_0x22303e,null));};exports[_0x7329('0x27')]=function(_0x4084e4,_0x31f509){if(_0x4084e4[_0x7329('0x48')]['id']){delete _0x4084e4[_0x7329('0x48')]['id'];}return db[_0x7329('0x45')]['find']({'where':{'id':_0x4084e4[_0x7329('0x49')]['id']}})['then'](handleEntityNotFound(_0x31f509,null))[_0x7329('0x28')](saveUpdates(_0x4084e4[_0x7329('0x48')],null))[_0x7329('0x28')](respondWithResult(_0x31f509,null))[_0x7329('0x46')](handleError(_0x31f509,null));};exports[_0x7329('0x29')]=function(_0x363348,_0x56d01b){return db['SquareReport'][_0x7329('0x4a')]({'where':{'id':_0x363348[_0x7329('0x49')]['id']}})[_0x7329('0x28')](handleEntityNotFound(_0x56d01b,null))[_0x7329('0x28')](removeEntity(_0x56d01b,null))[_0x7329('0x46')](handleError(_0x56d01b,null));};exports['describe']=function(_0x25a4df,_0x2f51a8){return db[_0x7329('0x45')]['describe']()['then'](respondWithResult(_0x2f51a8,null))[_0x7329('0x46')](handleError(_0x2f51a8,null));}; \ No newline at end of file +var _0x8a8c=['../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SquareReport','rawAttributes','fieldName','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','keys','create','body','find','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8a8c,0xc7));var _0xc8a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8a8c[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xc8a8('0x0'));var rimraf=require(_0xc8a8('0x1'));var zipdir=require(_0xc8a8('0x2'));var jsonpatch=require(_0xc8a8('0x3'));var rp=require('request-promise');var moment=require(_0xc8a8('0x4'));var BPromise=require(_0xc8a8('0x5'));var Mustache=require(_0xc8a8('0x6'));var util=require(_0xc8a8('0x7'));var path=require(_0xc8a8('0x8'));var sox=require('sox');var csv=require(_0xc8a8('0x9'));var ejs=require(_0xc8a8('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xc8a8('0xb'));var crypto=require(_0xc8a8('0xc'));var jsforce=require(_0xc8a8('0xd'));var deskjs=require(_0xc8a8('0xe'));var toCsv=require(_0xc8a8('0x9'));var querystring=require('querystring');var Papa=require(_0xc8a8('0xf'));var Redis=require(_0xc8a8('0x10'));var authService=require(_0xc8a8('0x11'));var qs=require(_0xc8a8('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc8a8('0x13'));var logger=require(_0xc8a8('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xc8a8('0x15'));var licenseUtil=require(_0xc8a8('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cb7db,_0x5bbc66){_0x5bbc66=_0x5bbc66||0xcc;return function(_0x139671){if(_0x139671){return _0x3cb7db[_0xc8a8('0x17')](_0x5bbc66);}return _0x3cb7db[_0xc8a8('0x18')](_0x5bbc66)[_0xc8a8('0x19')]();};}function respondWithResult(_0x39f5e5,_0x4e25ff){_0x4e25ff=_0x4e25ff||0xc8;return function(_0x25b56b){if(_0x25b56b){return _0x39f5e5[_0xc8a8('0x18')](_0x4e25ff)[_0xc8a8('0x1a')](_0x25b56b);}};}function respondWithFilteredResult(_0x9a1e52,_0x337d7f){return function(_0x11c15a){if(_0x11c15a){var _0xdd9c02=typeof _0x337d7f[_0xc8a8('0x1b')]==='undefined'&&typeof _0x337d7f[_0xc8a8('0x1c')]===_0xc8a8('0x1d');var _0x4025cd=_0x11c15a['count'];var _0x779059=_0xdd9c02?0x0:_0x337d7f['offset'];var _0x117280=_0xdd9c02?_0x11c15a[_0xc8a8('0x1e')]:_0x337d7f[_0xc8a8('0x1b')]+_0x337d7f[_0xc8a8('0x1c')];var _0x8922b5;if(_0x117280>=_0x4025cd){_0x117280=_0x4025cd;_0x8922b5=0xc8;}else{_0x8922b5=0xce;}_0x9a1e52['status'](_0x8922b5);return _0x9a1e52['set'](_0xc8a8('0x1f'),_0x779059+'-'+_0x117280+'/'+_0x4025cd)['json'](_0x11c15a);}return null;};}function patchUpdates(_0x38f70b){return function(_0x48cfe0){try{jsonpatch[_0xc8a8('0x20')](_0x48cfe0,_0x38f70b,!![]);}catch(_0xfe1804){return BPromise[_0xc8a8('0x21')](_0xfe1804);}return _0x48cfe0[_0xc8a8('0x22')]();};}function saveUpdates(_0x1a4fa0,_0x4fc6be){return function(_0x154b82){if(_0x154b82){return _0x154b82[_0xc8a8('0x23')](_0x1a4fa0)['then'](function(_0x485daa){return _0x485daa;});}return null;};}function removeEntity(_0x3dea59,_0x23206c){return function(_0x148f4b){if(_0x148f4b){return _0x148f4b[_0xc8a8('0x24')]()[_0xc8a8('0x25')](function(){_0x3dea59[_0xc8a8('0x18')](0xcc)[_0xc8a8('0x19')]();});}};}function handleEntityNotFound(_0x5e787c,_0x3e684c){return function(_0x5d0490){if(!_0x5d0490){_0x5e787c[_0xc8a8('0x17')](0x194);}return _0x5d0490;};}function handleError(_0x4166d0,_0x25a0c9){_0x25a0c9=_0x25a0c9||0x1f4;return function(_0x3b8c3e){logger[_0xc8a8('0x26')](_0x3b8c3e[_0xc8a8('0x27')]);if(_0x3b8c3e[_0xc8a8('0x28')]){delete _0x3b8c3e[_0xc8a8('0x28')];}_0x4166d0[_0xc8a8('0x18')](_0x25a0c9)[_0xc8a8('0x29')](_0x3b8c3e);};}exports[_0xc8a8('0x2a')]=function(_0x4a099d,_0xe61171){var _0x5d44e7={},_0x12375b={},_0x3976e8={'count':0x0,'rows':[]};var _0x1ef44f=_[_0xc8a8('0x2b')](db[_0xc8a8('0x2c')][_0xc8a8('0x2d')],function(_0x311e6f){return{'name':_0x311e6f[_0xc8a8('0x2e')],'type':_0x311e6f[_0xc8a8('0x2f')][_0xc8a8('0x30')]};});_0x12375b[_0xc8a8('0x31')]=_[_0xc8a8('0x2b')](_0x1ef44f,_0xc8a8('0x28'));_0x12375b[_0xc8a8('0x32')]=_['keys'](_0x4a099d['query']);_0x12375b['filters']=_[_0xc8a8('0x33')](_0x12375b[_0xc8a8('0x31')],_0x12375b[_0xc8a8('0x32')]);_0x5d44e7[_0xc8a8('0x34')]=_['intersection'](_0x12375b[_0xc8a8('0x31')],qs[_0xc8a8('0x35')](_0x4a099d[_0xc8a8('0x32')][_0xc8a8('0x35')]));_0x5d44e7[_0xc8a8('0x34')]=_0x5d44e7[_0xc8a8('0x34')][_0xc8a8('0x36')]?_0x5d44e7['attributes']:_0x12375b[_0xc8a8('0x31')];if(!_0x4a099d[_0xc8a8('0x32')][_0xc8a8('0x37')]('nolimit')){_0x5d44e7['limit']=qs[_0xc8a8('0x1c')](_0x4a099d[_0xc8a8('0x32')]['limit']);_0x5d44e7['offset']=qs[_0xc8a8('0x1b')](_0x4a099d[_0xc8a8('0x32')][_0xc8a8('0x1b')]);}_0x5d44e7['order']=qs[_0xc8a8('0x38')](_0x4a099d['query'][_0xc8a8('0x38')]);_0x5d44e7[_0xc8a8('0x39')]=qs[_0xc8a8('0x3a')](_[_0xc8a8('0x3b')](_0x4a099d[_0xc8a8('0x32')],_0x12375b[_0xc8a8('0x3a')]),_0x1ef44f);if(_0x4a099d['query'][_0xc8a8('0x3c')]){_0x5d44e7[_0xc8a8('0x39')]=_[_0xc8a8('0x3d')](_0x5d44e7[_0xc8a8('0x39')],{'$or':_[_0xc8a8('0x2b')](_0x1ef44f,function(_0x4cc2e1){if(_0x4cc2e1[_0xc8a8('0x2f')]!==_0xc8a8('0x3e')){var _0x39df83={};_0x39df83[_0x4cc2e1[_0xc8a8('0x28')]]={'$like':'%'+_0x4a099d[_0xc8a8('0x32')][_0xc8a8('0x3c')]+'%'};return _0x39df83;}})});}_0x5d44e7=_[_0xc8a8('0x3d')]({},_0x5d44e7,_0x4a099d[_0xc8a8('0x3f')]);var _0x5ce162={'where':_0x5d44e7[_0xc8a8('0x39')]};return db[_0xc8a8('0x2c')][_0xc8a8('0x1e')](_0x5ce162)['then'](function(_0x5df983){_0x3976e8[_0xc8a8('0x1e')]=_0x5df983;if(_0x4a099d[_0xc8a8('0x32')][_0xc8a8('0x40')]){_0x5d44e7[_0xc8a8('0x41')]=[{'all':!![]}];}return db[_0xc8a8('0x2c')]['findAll'](_0x5d44e7);})[_0xc8a8('0x25')](function(_0x2c2321){_0x3976e8['rows']=_0x2c2321;return _0x3976e8;})[_0xc8a8('0x25')](respondWithFilteredResult(_0xe61171,_0x5d44e7))[_0xc8a8('0x42')](handleError(_0xe61171,null));};exports['show']=function(_0x59f4ae,_0x4f7e92){var _0x1acc5d={'raw':!![],'where':{'id':_0x59f4ae['params']['id']}},_0x1c249c={};_0x1c249c[_0xc8a8('0x31')]=_[_0xc8a8('0x43')](db[_0xc8a8('0x2c')][_0xc8a8('0x2d')]);_0x1c249c['query']=_[_0xc8a8('0x43')](_0x59f4ae[_0xc8a8('0x32')]);_0x1c249c['filters']=_['intersection'](_0x1c249c[_0xc8a8('0x31')],_0x1c249c[_0xc8a8('0x32')]);_0x1acc5d[_0xc8a8('0x34')]=_[_0xc8a8('0x33')](_0x1c249c[_0xc8a8('0x31')],qs[_0xc8a8('0x35')](_0x59f4ae[_0xc8a8('0x32')][_0xc8a8('0x35')]));_0x1acc5d[_0xc8a8('0x34')]=_0x1acc5d[_0xc8a8('0x34')]['length']?_0x1acc5d['attributes']:_0x1c249c['model'];if(_0x59f4ae[_0xc8a8('0x32')][_0xc8a8('0x40')]){_0x1acc5d[_0xc8a8('0x41')]=[{'all':!![]}];}_0x1acc5d=_[_0xc8a8('0x3d')]({},_0x1acc5d,_0x59f4ae[_0xc8a8('0x3f')]);return db[_0xc8a8('0x2c')]['find'](_0x1acc5d)[_0xc8a8('0x25')](handleEntityNotFound(_0x4f7e92,null))['then'](respondWithResult(_0x4f7e92,null))[_0xc8a8('0x42')](handleError(_0x4f7e92,null));};exports[_0xc8a8('0x44')]=function(_0x112c1f,_0x1b820a){return db['SquareReport'][_0xc8a8('0x44')](_0x112c1f[_0xc8a8('0x45')],{})['then'](respondWithResult(_0x1b820a,0xc9))[_0xc8a8('0x42')](handleError(_0x1b820a,null));};exports['update']=function(_0x38255c,_0x49748e){if(_0x38255c['body']['id']){delete _0x38255c[_0xc8a8('0x45')]['id'];}return db[_0xc8a8('0x2c')][_0xc8a8('0x46')]({'where':{'id':_0x38255c[_0xc8a8('0x47')]['id']}})[_0xc8a8('0x25')](handleEntityNotFound(_0x49748e,null))['then'](saveUpdates(_0x38255c[_0xc8a8('0x45')],null))['then'](respondWithResult(_0x49748e,null))['catch'](handleError(_0x49748e,null));};exports[_0xc8a8('0x24')]=function(_0x1c03be,_0x208269){return db[_0xc8a8('0x2c')][_0xc8a8('0x46')]({'where':{'id':_0x1c03be['params']['id']}})[_0xc8a8('0x25')](handleEntityNotFound(_0x208269,null))[_0xc8a8('0x25')](removeEntity(_0x208269,null))['catch'](handleError(_0x208269,null));};exports['describe']=function(_0x3b29bd,_0x5e9b7f){return db[_0xc8a8('0x2c')][_0xc8a8('0x48')]()[_0xc8a8('0x25')](respondWithResult(_0x5e9b7f,null))['catch'](handleError(_0x5e9b7f,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f7d31ac..e272640 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 _0x6cae=['rimraf','../../config/environment','./squareReport.attributes','exports','define','uniqueid','leaveAt','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x4b2976,_0x26fcb0){var _0x9050e=function(_0x1dfa5e){while(--_0x1dfa5e){_0x4b2976['push'](_0x4b2976['shift']());}};_0x9050e(++_0x26fcb0);}(_0x6cae,0xfe));var _0xe6ca=function(_0x39db38,_0x2b877f){_0x39db38=_0x39db38-0x0;var _0x1b1e27=_0x6cae[_0x39db38];return _0x1b1e27;};'use strict';var _=require(_0xe6ca('0x0'));var util=require(_0xe6ca('0x1'));var logger=require(_0xe6ca('0x2'))(_0xe6ca('0x3'));var moment=require('moment');var BPromise=require(_0xe6ca('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe6ca('0x5'));var rimraf=require(_0xe6ca('0x6'));var config=require(_0xe6ca('0x7'));var attributes=require(_0xe6ca('0x8'));module[_0xe6ca('0x9')]=function(_0x2ea82c,_0x4ab852){return _0x2ea82c[_0xe6ca('0xa')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':'uid_pname','fields':[_0xe6ca('0xb'),'project_name']},{'name':_0xe6ca('0xc'),'fields':[_0xe6ca('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9ed8=['request-promise','path','rimraf','../../config/environment','exports','define','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','moment'];(function(_0x575289,_0x210cc3){var _0x3a2f08=function(_0x5bf683){while(--_0x5bf683){_0x575289['push'](_0x575289['shift']());}};_0x3a2f08(++_0x210cc3);}(_0x9ed8,0x1c9));var _0x89ed=function(_0x33a775,_0x5779ae){_0x33a775=_0x33a775-0x0;var _0x599279=_0x9ed8[_0x33a775];return _0x599279;};'use strict';var _=require(_0x89ed('0x0'));var util=require(_0x89ed('0x1'));var logger=require(_0x89ed('0x2'))(_0x89ed('0x3'));var moment=require(_0x89ed('0x4'));var BPromise=require('bluebird');var rp=require(_0x89ed('0x5'));var fs=require('fs');var path=require(_0x89ed('0x6'));var rimraf=require(_0x89ed('0x7'));var config=require(_0x89ed('0x8'));var attributes=require('./squareReport.attributes');module[_0x89ed('0x9')]=function(_0x54a5e9,_0x11324f){return _0x54a5e9[_0x89ed('0xa')]('SquareReport',attributes,{'tableName':'report_square','paranoid':![],'indexes':[{'name':_0x89ed('0xb'),'fields':['uniqueid',_0x89ed('0xc')]},{'name':_0x89ed('0xd'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 60bcb2e..a12b42a 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 _0x3ec9=['rpc','../../config/environment','jayson/promise','http','request','then','SquareReport,\x20%s,\x20%s','SquareReport,\x20%s,\x20%s,\x20%s','error','message','request\x20sent','result','catch','create','options','info','debug','UpdateSquareReport','SquareReport','update','stringify','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xc8a931,_0x260690){var _0x28bd27=function(_0x591b9f){while(--_0x591b9f){_0xc8a931['push'](_0xc8a931['shift']());}};_0x28bd27(++_0x260690);}(_0x3ec9,0x85));var _0x93ec=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3ec9[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x93ec('0x0'));var util=require(_0x93ec('0x1'));var moment=require(_0x93ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x93ec('0x3'));var fs=require('fs');var Redis=require(_0x93ec('0x4'));var db=require(_0x93ec('0x5'))['db'];var utils=require(_0x93ec('0x6'));var logger=require('../../config/logger')(_0x93ec('0x7'));var config=require(_0x93ec('0x8'));var jayson=require(_0x93ec('0x9'));var client=jayson['client'][_0x93ec('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x415630,_0x38afc7,_0x3cdd5e){return new BPromise(function(_0x569ea5,_0x33ca26){return client[_0x93ec('0xb')](_0x415630,_0x3cdd5e)[_0x93ec('0xc')](function(_0x1cf570){logger['info'](_0x93ec('0xd'),_0x38afc7,'request\x20sent');logger['debug'](_0x93ec('0xe'),_0x38afc7,'request\x20sent',JSON['stringify'](_0x1cf570));if(_0x1cf570['error']){if(_0x1cf570[_0x93ec('0xf')]['code']===0x1f4){logger[_0x93ec('0xf')]('SquareReport,\x20%s,\x20%s',_0x38afc7,_0x1cf570[_0x93ec('0xf')][_0x93ec('0x10')]);return _0x33ca26(_0x1cf570[_0x93ec('0xf')][_0x93ec('0x10')]);}logger[_0x93ec('0xf')]('SquareReport,\x20%s,\x20%s',_0x38afc7,_0x1cf570[_0x93ec('0xf')]['message']);return _0x569ea5(_0x1cf570[_0x93ec('0xf')]['message']);}else{logger['info']('SquareReport,\x20%s,\x20%s',_0x38afc7,_0x93ec('0x11'));_0x569ea5(_0x1cf570[_0x93ec('0x12')][_0x93ec('0x10')]);}})[_0x93ec('0x13')](function(_0x16989b){logger[_0x93ec('0xf')](_0x93ec('0xd'),_0x38afc7,_0x16989b);_0x33ca26(_0x16989b);});});}exports['CreateSquareReport']=function(_0x55916b){var _0x3c5952=this;return new Promise(function(_0xd3c2c5,_0x207870){return db['SquareReport'][_0x93ec('0x14')](_0x55916b['body'],{'raw':_0x55916b[_0x93ec('0x15')]?_0x55916b[_0x93ec('0x15')]['raw']===undefined?!![]:![]:!![]})[_0x93ec('0xc')](function(_0x21a3ec){logger[_0x93ec('0x16')]('CreateSquareReport',_0x55916b);logger[_0x93ec('0x17')]('CreateSquareReport',_0x55916b,JSON['stringify'](_0x21a3ec));_0xd3c2c5(_0x21a3ec);})[_0x93ec('0x13')](function(_0x1aa052){logger[_0x93ec('0xf')]('CreateSquareReport',_0x1aa052['message'],_0x55916b);_0x207870(_0x3c5952[_0x93ec('0xf')](0x1f4,_0x1aa052[_0x93ec('0x10')]));});});};exports[_0x93ec('0x18')]=function(_0x34e3e8){var _0xf406e8=this;return new Promise(function(_0x18fadd,_0x2ce9a9){return db[_0x93ec('0x19')][_0x93ec('0x1a')](_0x34e3e8['body'],{'raw':_0x34e3e8[_0x93ec('0x15')]?_0x34e3e8[_0x93ec('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34e3e8[_0x93ec('0x15')]?_0x34e3e8[_0x93ec('0x15')]['where']||null:null,'attributes':_0x34e3e8[_0x93ec('0x15')]?_0x34e3e8[_0x93ec('0x15')]['attributes']||null:null,'limit':_0x34e3e8['options']?_0x34e3e8['options']['limit']||null:null})[_0x93ec('0xc')](function(_0x361b37){logger[_0x93ec('0x16')](_0x93ec('0x18'),_0x34e3e8);logger['debug'](_0x93ec('0x18'),_0x34e3e8,JSON[_0x93ec('0x1b')](_0x361b37));_0x18fadd(_0x361b37);})[_0x93ec('0x13')](function(_0x269533){logger[_0x93ec('0xf')]('UpdateSquareReport',_0x269533[_0x93ec('0x10')],_0x34e3e8);_0x2ce9a9(_0xf406e8['error'](0x1f4,_0x269533[_0x93ec('0x10')]));});});}; \ No newline at end of file +var _0xf414=['SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateSquareReport','SquareReport','create','options','raw','then','debug','update','body','attributes','UpdateSquareReport','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','info','SquareReport,\x20%s,\x20%s','request\x20sent'];(function(_0x56442c,_0x2df71a){var _0x35bc36=function(_0x23ccad){while(--_0x23ccad){_0x56442c['push'](_0x56442c['shift']());}};_0x35bc36(++_0x2df71a);}(_0xf414,0x10a));var _0x4f41=function(_0x47242d,_0x13f993){_0x47242d=_0x47242d-0x0;var _0x30273a=_0xf414[_0x47242d];return _0x30273a;};'use strict';var _=require(_0x4f41('0x0'));var util=require('util');var moment=require(_0x4f41('0x1'));var BPromise=require(_0x4f41('0x2'));var rs=require(_0x4f41('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f41('0x4'))['db'];var utils=require(_0x4f41('0x5'));var logger=require(_0x4f41('0x6'))('rpc');var config=require(_0x4f41('0x7'));var jayson=require(_0x4f41('0x8'));var client=jayson[_0x4f41('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2384e9,_0xae2ccd,_0xd89f50){return new BPromise(function(_0x750cd1,_0x19fbbc){return client['request'](_0x2384e9,_0xd89f50)['then'](function(_0x2440b9){logger[_0x4f41('0xa')](_0x4f41('0xb'),_0xae2ccd,_0x4f41('0xc'));logger['debug'](_0x4f41('0xd'),_0xae2ccd,_0x4f41('0xc'),JSON[_0x4f41('0xe')](_0x2440b9));if(_0x2440b9[_0x4f41('0xf')]){if(_0x2440b9[_0x4f41('0xf')][_0x4f41('0x10')]===0x1f4){logger[_0x4f41('0xf')]('SquareReport,\x20%s,\x20%s',_0xae2ccd,_0x2440b9['error']['message']);return _0x19fbbc(_0x2440b9[_0x4f41('0xf')][_0x4f41('0x11')]);}logger[_0x4f41('0xf')]('SquareReport,\x20%s,\x20%s',_0xae2ccd,_0x2440b9[_0x4f41('0xf')][_0x4f41('0x11')]);return _0x750cd1(_0x2440b9[_0x4f41('0xf')][_0x4f41('0x11')]);}else{logger['info'](_0x4f41('0xb'),_0xae2ccd,_0x4f41('0xc'));_0x750cd1(_0x2440b9[_0x4f41('0x12')][_0x4f41('0x11')]);}})[_0x4f41('0x13')](function(_0x168f35){logger[_0x4f41('0xf')](_0x4f41('0xb'),_0xae2ccd,_0x168f35);_0x19fbbc(_0x168f35);});});}exports[_0x4f41('0x14')]=function(_0x241780){var _0x18264a=this;return new Promise(function(_0x1d405a,_0x4447d2){return db[_0x4f41('0x15')][_0x4f41('0x16')](_0x241780['body'],{'raw':_0x241780['options']?_0x241780[_0x4f41('0x17')][_0x4f41('0x18')]===undefined?!![]:![]:!![]})[_0x4f41('0x19')](function(_0x43f030){logger[_0x4f41('0xa')]('CreateSquareReport',_0x241780);logger[_0x4f41('0x1a')](_0x4f41('0x14'),_0x241780,JSON[_0x4f41('0xe')](_0x43f030));_0x1d405a(_0x43f030);})[_0x4f41('0x13')](function(_0x5c0bf6){logger[_0x4f41('0xf')]('CreateSquareReport',_0x5c0bf6[_0x4f41('0x11')],_0x241780);_0x4447d2(_0x18264a[_0x4f41('0xf')](0x1f4,_0x5c0bf6[_0x4f41('0x11')]));});});};exports['UpdateSquareReport']=function(_0x2281fb){var _0x3f0d44=this;return new Promise(function(_0x2fb575,_0x1de041){return db['SquareReport'][_0x4f41('0x1b')](_0x2281fb[_0x4f41('0x1c')],{'raw':_0x2281fb[_0x4f41('0x17')]?_0x2281fb[_0x4f41('0x17')][_0x4f41('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2281fb[_0x4f41('0x17')]?_0x2281fb[_0x4f41('0x17')]['where']||null:null,'attributes':_0x2281fb[_0x4f41('0x17')]?_0x2281fb[_0x4f41('0x17')][_0x4f41('0x1d')]||null:null,'limit':_0x2281fb[_0x4f41('0x17')]?_0x2281fb[_0x4f41('0x17')]['limit']||null:null})[_0x4f41('0x19')](function(_0xf8b0ae){logger['info'](_0x4f41('0x1e'),_0x2281fb);logger[_0x4f41('0x1a')](_0x4f41('0x1e'),_0x2281fb,JSON[_0x4f41('0xe')](_0xf8b0ae));_0x2fb575(_0xf8b0ae);})['catch'](function(_0x5a0d9a){logger[_0x4f41('0xf')](_0x4f41('0x1e'),_0x5a0d9a[_0x4f41('0x11')],_0x2281fb);_0x1de041(_0x3f0d44[_0x4f41('0xf')](0x1f4,_0x5a0d9a[_0x4f41('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index a0beefe..2a066f8 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 _0x6444=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReportDetail.controller','get','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','multer','util','connect-timeout'];(function(_0x216799,_0x44b817){var _0x3661c3=function(_0x28f85e){while(--_0x28f85e){_0x216799['push'](_0x216799['shift']());}};_0x3661c3(++_0x44b817);}(_0x6444,0xd9));var _0x4644=function(_0xfc6df6,_0x19a906){_0xfc6df6=_0xfc6df6-0x0;var _0x2da895=_0x6444[_0xfc6df6];return _0x2da895;};'use strict';var multer=require(_0x4644('0x0'));var util=require(_0x4644('0x1'));var path=require('path');var timeout=require(_0x4644('0x2'));var express=require('express');var router=express[_0x4644('0x3')]();var fs_extra=require(_0x4644('0x4'));var auth=require(_0x4644('0x5'));var interaction=require(_0x4644('0x6'));var config=require(_0x4644('0x7'));var controller=require(_0x4644('0x8'));router[_0x4644('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x4644('0x9')](_0x4644('0xa'),auth['isAuthenticated'](),controller[_0x4644('0xb')]);router[_0x4644('0x9')](_0x4644('0xc'),auth[_0x4644('0xd')](),controller[_0x4644('0xe')]);router[_0x4644('0xf')]('/',auth[_0x4644('0xd')](),controller[_0x4644('0x10')]);router[_0x4644('0x11')]('/:id',auth[_0x4644('0xd')](),controller[_0x4644('0x12')]);router[_0x4644('0x13')](_0x4644('0xc'),auth[_0x4644('0xd')](),controller[_0x4644('0x14')]);module[_0x4644('0x15')]=router; \ No newline at end of file +var _0xf910=['/:id','show','post','isAuthenticated','put','update','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','./squareReportDetail.controller','get','index','describe'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xf910,0x127));var _0x0f91=function(_0x1da6d9,_0x5af7d5){_0x1da6d9=_0x1da6d9-0x0;var _0x8f528b=_0xf910[_0x1da6d9];return _0x8f528b;};'use strict';var multer=require(_0x0f91('0x0'));var util=require(_0x0f91('0x1'));var path=require('path');var timeout=require(_0x0f91('0x2'));var express=require(_0x0f91('0x3'));var router=express[_0x0f91('0x4')]();var fs_extra=require(_0x0f91('0x5'));var auth=require(_0x0f91('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x0f91('0x7'));router[_0x0f91('0x8')]('/',auth['isAuthenticated'](),controller[_0x0f91('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0x0f91('0xa')]);router[_0x0f91('0x8')](_0x0f91('0xb'),auth['isAuthenticated'](),controller[_0x0f91('0xc')]);router[_0x0f91('0xd')]('/',auth[_0x0f91('0xe')](),controller['create']);router[_0x0f91('0xf')](_0x0f91('0xb'),auth[_0x0f91('0xe')](),controller[_0x0f91('0x10')]);router['delete'](_0x0f91('0xb'),auth[_0x0f91('0xe')](),controller['destroy']);module[_0x0f91('0x11')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 1871999..2079e8e 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 _0xe09c=['exports','STRING','TEXT','sequelize'];(function(_0x43241c,_0xad3f71){var _0x43b112=function(_0x4800e5){while(--_0x4800e5){_0x43241c['push'](_0x43241c['shift']());}};_0x43b112(++_0xad3f71);}(_0xe09c,0x117));var _0xce09=function(_0x45e0cb,_0x3cbdfb){_0x45e0cb=_0x45e0cb-0x0;var _0x5aa552=_0xe09c[_0x45e0cb];return _0x5aa552;};'use strict';var Sequelize=require(_0xce09('0x0'));module[_0xce09('0x1')]={'uniqueid':{'type':Sequelize[_0xce09('0x2')]},'node':{'type':Sequelize[_0xce09('0x2')]},'application':{'type':Sequelize[_0xce09('0x2')]},'data':{'type':Sequelize[_0xce09('0x3')]},'project_name':{'type':Sequelize[_0xce09('0x2')]},'callerid':{'type':Sequelize[_0xce09('0x2')]}}; \ No newline at end of file +var _0x12f9=['exports','STRING'];(function(_0x1bb6aa,_0x40fe82){var _0x2ef28e=function(_0x32b4eb){while(--_0x32b4eb){_0x1bb6aa['push'](_0x1bb6aa['shift']());}};_0x2ef28e(++_0x40fe82);}(_0x12f9,0x134));var _0x912f=function(_0x35b742,_0x42859b){_0x35b742=_0x35b742-0x0;var _0x229993=_0x12f9[_0x35b742];return _0x229993;};'use strict';var Sequelize=require('sequelize');module[_0x912f('0x0')]={'uniqueid':{'type':Sequelize[_0x912f('0x1')]},'node':{'type':Sequelize[_0x912f('0x1')]},'application':{'type':Sequelize[_0x912f('0x1')]},'data':{'type':Sequelize['TEXT']},'project_name':{'type':Sequelize[_0x912f('0x1')]},'callerid':{'type':Sequelize[_0x912f('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index 0066184..28c9225 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 _0xc1e7=['rows','catch','show','find','create','body','update','describe','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','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','status','end','json','offset','limit','count','apply','save','destroy','then','sendStatus','error','name','send','map','SquareDetailsReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','options','includeAll','findAll'];(function(_0x1852fe,_0x5c4e14){var _0x430337=function(_0x437cdc){while(--_0x437cdc){_0x1852fe['push'](_0x1852fe['shift']());}};_0x430337(++_0x5c4e14);}(_0xc1e7,0x12c));var _0x7c1e=function(_0x1c027a,_0x4309eb){_0x1c027a=_0x1c027a-0x0;var _0x4e1289=_0xc1e7[_0x1c027a];return _0x4e1289;};'use strict';var emlformat=require(_0x7c1e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7c1e('0x1'));var jsonpatch=require(_0x7c1e('0x2'));var rp=require('request-promise');var moment=require(_0x7c1e('0x3'));var BPromise=require(_0x7c1e('0x4'));var Mustache=require(_0x7c1e('0x5'));var util=require(_0x7c1e('0x6'));var path=require(_0x7c1e('0x7'));var sox=require('sox');var csv=require(_0x7c1e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7c1e('0x9'));var _=require(_0x7c1e('0xa'));var squel=require(_0x7c1e('0xb'));var crypto=require(_0x7c1e('0xc'));var jsforce=require(_0x7c1e('0xd'));var deskjs=require(_0x7c1e('0xe'));var toCsv=require(_0x7c1e('0x8'));var querystring=require(_0x7c1e('0xf'));var Papa=require(_0x7c1e('0x10'));var Redis=require('ioredis');var authService=require(_0x7c1e('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7c1e('0x12'));var hardwareService=require(_0x7c1e('0x13'));var logger=require(_0x7c1e('0x14'))(_0x7c1e('0x15'));var utils=require(_0x7c1e('0x16'));var config=require(_0x7c1e('0x17'));var licenseUtil=require(_0x7c1e('0x18'));var db=require(_0x7c1e('0x19'))['db'];function respondWithStatusCode(_0x1b3c90,_0x4354bd){_0x4354bd=_0x4354bd||0xcc;return function(_0x1d9f92){if(_0x1d9f92){return _0x1b3c90['sendStatus'](_0x4354bd);}return _0x1b3c90[_0x7c1e('0x1a')](_0x4354bd)[_0x7c1e('0x1b')]();};}function respondWithResult(_0x337edd,_0x26891d){_0x26891d=_0x26891d||0xc8;return function(_0x3f220e){if(_0x3f220e){return _0x337edd[_0x7c1e('0x1a')](_0x26891d)[_0x7c1e('0x1c')](_0x3f220e);}};}function respondWithFilteredResult(_0x380044,_0x2c705a){return function(_0x1889c0){if(_0x1889c0){var _0x421a88=typeof _0x2c705a[_0x7c1e('0x1d')]==='undefined'&&typeof _0x2c705a[_0x7c1e('0x1e')]==='undefined';var _0x96d166=_0x1889c0[_0x7c1e('0x1f')];var _0x4bf358=_0x421a88?0x0:_0x2c705a[_0x7c1e('0x1d')];var _0x3a416b=_0x421a88?_0x1889c0[_0x7c1e('0x1f')]:_0x2c705a['offset']+_0x2c705a[_0x7c1e('0x1e')];var _0x3c9eb9;if(_0x3a416b>=_0x96d166){_0x3a416b=_0x96d166;_0x3c9eb9=0xc8;}else{_0x3c9eb9=0xce;}_0x380044[_0x7c1e('0x1a')](_0x3c9eb9);return _0x380044['set']('Content-Range',_0x4bf358+'-'+_0x3a416b+'/'+_0x96d166)['json'](_0x1889c0);}return null;};}function patchUpdates(_0x43808f){return function(_0x2f4adc){try{jsonpatch[_0x7c1e('0x20')](_0x2f4adc,_0x43808f,!![]);}catch(_0x3aae6f){return BPromise['reject'](_0x3aae6f);}return _0x2f4adc[_0x7c1e('0x21')]();};}function saveUpdates(_0x48fb5e,_0x2595cb){return function(_0x3382a0){if(_0x3382a0){return _0x3382a0['update'](_0x48fb5e)['then'](function(_0x4bfe35){return _0x4bfe35;});}return null;};}function removeEntity(_0x3db4a2,_0x57ac9e){return function(_0x419d17){if(_0x419d17){return _0x419d17[_0x7c1e('0x22')]()[_0x7c1e('0x23')](function(){_0x3db4a2[_0x7c1e('0x1a')](0xcc)[_0x7c1e('0x1b')]();});}};}function handleEntityNotFound(_0x2a19fc,_0x40073c){return function(_0xfa6ad1){if(!_0xfa6ad1){_0x2a19fc[_0x7c1e('0x24')](0x194);}return _0xfa6ad1;};}function handleError(_0x4632f0,_0x1c07e8){_0x1c07e8=_0x1c07e8||0x1f4;return function(_0x42bca6){logger[_0x7c1e('0x25')](_0x42bca6['stack']);if(_0x42bca6[_0x7c1e('0x26')]){delete _0x42bca6['name'];}_0x4632f0['status'](_0x1c07e8)[_0x7c1e('0x27')](_0x42bca6);};}exports['index']=function(_0x54a347,_0x57a28f){var _0x47d6d9={},_0x23fc84={},_0x3dbe8f={'count':0x0,'rows':[]};var _0x815f70=_[_0x7c1e('0x28')](db[_0x7c1e('0x29')][_0x7c1e('0x2a')],function(_0x2f52d4){return{'name':_0x2f52d4[_0x7c1e('0x2b')],'type':_0x2f52d4[_0x7c1e('0x2c')][_0x7c1e('0x2d')]};});_0x23fc84['model']=_[_0x7c1e('0x28')](_0x815f70,_0x7c1e('0x26'));_0x23fc84[_0x7c1e('0x2e')]=_[_0x7c1e('0x2f')](_0x54a347[_0x7c1e('0x2e')]);_0x23fc84[_0x7c1e('0x30')]=_[_0x7c1e('0x31')](_0x23fc84[_0x7c1e('0x32')],_0x23fc84['query']);_0x47d6d9['attributes']=_['intersection'](_0x23fc84[_0x7c1e('0x32')],qs[_0x7c1e('0x33')](_0x54a347['query'][_0x7c1e('0x33')]));_0x47d6d9[_0x7c1e('0x34')]=_0x47d6d9['attributes'][_0x7c1e('0x35')]?_0x47d6d9[_0x7c1e('0x34')]:_0x23fc84[_0x7c1e('0x32')];if(!_0x54a347[_0x7c1e('0x2e')][_0x7c1e('0x36')](_0x7c1e('0x37'))){_0x47d6d9[_0x7c1e('0x1e')]=qs['limit'](_0x54a347[_0x7c1e('0x2e')][_0x7c1e('0x1e')]);_0x47d6d9[_0x7c1e('0x1d')]=qs[_0x7c1e('0x1d')](_0x54a347['query'][_0x7c1e('0x1d')]);}_0x47d6d9[_0x7c1e('0x38')]=qs[_0x7c1e('0x39')](_0x54a347['query'][_0x7c1e('0x39')]);_0x47d6d9['where']=qs[_0x7c1e('0x30')](_[_0x7c1e('0x3a')](_0x54a347[_0x7c1e('0x2e')],_0x23fc84[_0x7c1e('0x30')]),_0x815f70);if(_0x54a347['query'][_0x7c1e('0x3b')]){_0x47d6d9[_0x7c1e('0x3c')]=_[_0x7c1e('0x3d')](_0x47d6d9[_0x7c1e('0x3c')],{'$or':_[_0x7c1e('0x28')](_0x815f70,function(_0x1834aa){if(_0x1834aa[_0x7c1e('0x2c')]!=='VIRTUAL'){var _0x2af85d={};_0x2af85d[_0x1834aa[_0x7c1e('0x26')]]={'$like':'%'+_0x54a347[_0x7c1e('0x2e')][_0x7c1e('0x3b')]+'%'};return _0x2af85d;}})});}_0x47d6d9=_['merge']({},_0x47d6d9,_0x54a347[_0x7c1e('0x3e')]);var _0xfe799a={'where':_0x47d6d9[_0x7c1e('0x3c')]};return db[_0x7c1e('0x29')][_0x7c1e('0x1f')](_0xfe799a)[_0x7c1e('0x23')](function(_0x39a2cc){_0x3dbe8f[_0x7c1e('0x1f')]=_0x39a2cc;if(_0x54a347[_0x7c1e('0x2e')][_0x7c1e('0x3f')]){_0x47d6d9['include']=[{'all':!![]}];}return db['SquareDetailsReport'][_0x7c1e('0x40')](_0x47d6d9);})[_0x7c1e('0x23')](function(_0x322c3a){_0x3dbe8f[_0x7c1e('0x41')]=_0x322c3a;return _0x3dbe8f;})['then'](respondWithFilteredResult(_0x57a28f,_0x47d6d9))[_0x7c1e('0x42')](handleError(_0x57a28f,null));};exports[_0x7c1e('0x43')]=function(_0x2aadd1,_0x5ca097){var _0x361ea3={'raw':!![],'where':{'id':_0x2aadd1['params']['id']}},_0x1f9bb3={};_0x1f9bb3[_0x7c1e('0x32')]=_['keys'](db[_0x7c1e('0x29')][_0x7c1e('0x2a')]);_0x1f9bb3[_0x7c1e('0x2e')]=_[_0x7c1e('0x2f')](_0x2aadd1[_0x7c1e('0x2e')]);_0x1f9bb3[_0x7c1e('0x30')]=_[_0x7c1e('0x31')](_0x1f9bb3[_0x7c1e('0x32')],_0x1f9bb3['query']);_0x361ea3[_0x7c1e('0x34')]=_[_0x7c1e('0x31')](_0x1f9bb3[_0x7c1e('0x32')],qs[_0x7c1e('0x33')](_0x2aadd1[_0x7c1e('0x2e')][_0x7c1e('0x33')]));_0x361ea3[_0x7c1e('0x34')]=_0x361ea3['attributes'][_0x7c1e('0x35')]?_0x361ea3[_0x7c1e('0x34')]:_0x1f9bb3[_0x7c1e('0x32')];if(_0x2aadd1[_0x7c1e('0x2e')][_0x7c1e('0x3f')]){_0x361ea3['include']=[{'all':!![]}];}_0x361ea3=_[_0x7c1e('0x3d')]({},_0x361ea3,_0x2aadd1['options']);return db[_0x7c1e('0x29')][_0x7c1e('0x44')](_0x361ea3)['then'](handleEntityNotFound(_0x5ca097,null))[_0x7c1e('0x23')](respondWithResult(_0x5ca097,null))[_0x7c1e('0x42')](handleError(_0x5ca097,null));};exports['create']=function(_0x1e3418,_0x367598){return db[_0x7c1e('0x29')][_0x7c1e('0x45')](_0x1e3418[_0x7c1e('0x46')],{})[_0x7c1e('0x23')](respondWithResult(_0x367598,0xc9))['catch'](handleError(_0x367598,null));};exports[_0x7c1e('0x47')]=function(_0x2f312f,_0x1af7f0){if(_0x2f312f[_0x7c1e('0x46')]['id']){delete _0x2f312f[_0x7c1e('0x46')]['id'];}return db['SquareDetailsReport']['find']({'where':{'id':_0x2f312f['params']['id']}})[_0x7c1e('0x23')](handleEntityNotFound(_0x1af7f0,null))['then'](saveUpdates(_0x2f312f[_0x7c1e('0x46')],null))[_0x7c1e('0x23')](respondWithResult(_0x1af7f0,null))[_0x7c1e('0x42')](handleError(_0x1af7f0,null));};exports[_0x7c1e('0x22')]=function(_0x52b5bb,_0x36ac8c){return db[_0x7c1e('0x29')][_0x7c1e('0x44')]({'where':{'id':_0x52b5bb['params']['id']}})[_0x7c1e('0x23')](handleEntityNotFound(_0x36ac8c,null))['then'](removeEntity(_0x36ac8c,null))[_0x7c1e('0x42')](handleError(_0x36ac8c,null));};exports[_0x7c1e('0x48')]=function(_0x5e929b,_0x4deb76){return db[_0x7c1e('0x29')]['describe']()['then'](respondWithResult(_0x4deb76,null))[_0x7c1e('0x42')](handleError(_0x4deb76,null));}; \ No newline at end of file +var _0x56b8=['where','filter','merge','VIRTUAL','options','include','findAll','catch','params','includeAll','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','destroy','then','error','stack','name','send','index','map','SquareDetailsReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort'];(function(_0x20beae,_0x5eac6d){var _0xf5725=function(_0x926a3b){while(--_0x926a3b){_0x20beae['push'](_0x20beae['shift']());}};_0xf5725(++_0x5eac6d);}(_0x56b8,0x1dd));var _0x856b=function(_0x5d1f2f,_0x562de1){_0x5d1f2f=_0x5d1f2f-0x0;var _0x4029a2=_0x56b8[_0x5d1f2f];return _0x4029a2;};'use strict';var emlformat=require(_0x856b('0x0'));var rimraf=require(_0x856b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x856b('0x2'));var rp=require(_0x856b('0x3'));var moment=require(_0x856b('0x4'));var BPromise=require(_0x856b('0x5'));var Mustache=require('mustache');var util=require(_0x856b('0x6'));var path=require(_0x856b('0x7'));var sox=require('sox');var csv=require(_0x856b('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x856b('0x9'));var _=require(_0x856b('0xa'));var squel=require(_0x856b('0xb'));var crypto=require(_0x856b('0xc'));var jsforce=require(_0x856b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x856b('0x8'));var querystring=require(_0x856b('0xe'));var Papa=require('papaparse');var Redis=require(_0x856b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x856b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x856b('0x11'));var logger=require(_0x856b('0x12'))(_0x856b('0x13'));var utils=require(_0x856b('0x14'));var config=require(_0x856b('0x15'));var licenseUtil=require(_0x856b('0x16'));var db=require(_0x856b('0x17'))['db'];function respondWithStatusCode(_0x17ff3f,_0x3c93e5){_0x3c93e5=_0x3c93e5||0xcc;return function(_0x545d0d){if(_0x545d0d){return _0x17ff3f[_0x856b('0x18')](_0x3c93e5);}return _0x17ff3f[_0x856b('0x19')](_0x3c93e5)[_0x856b('0x1a')]();};}function respondWithResult(_0x1e706e,_0x5f387d){_0x5f387d=_0x5f387d||0xc8;return function(_0x295a3a){if(_0x295a3a){return _0x1e706e[_0x856b('0x19')](_0x5f387d)[_0x856b('0x1b')](_0x295a3a);}};}function respondWithFilteredResult(_0x516256,_0xfda532){return function(_0x42c09b){if(_0x42c09b){var _0x5af81a=typeof _0xfda532[_0x856b('0x1c')]==='undefined'&&typeof _0xfda532[_0x856b('0x1d')]===_0x856b('0x1e');var _0x5da5db=_0x42c09b[_0x856b('0x1f')];var _0x81f167=_0x5af81a?0x0:_0xfda532[_0x856b('0x1c')];var _0x2accd7=_0x5af81a?_0x42c09b['count']:_0xfda532[_0x856b('0x1c')]+_0xfda532[_0x856b('0x1d')];var _0x2d4614;if(_0x2accd7>=_0x5da5db){_0x2accd7=_0x5da5db;_0x2d4614=0xc8;}else{_0x2d4614=0xce;}_0x516256['status'](_0x2d4614);return _0x516256[_0x856b('0x20')](_0x856b('0x21'),_0x81f167+'-'+_0x2accd7+'/'+_0x5da5db)[_0x856b('0x1b')](_0x42c09b);}return null;};}function patchUpdates(_0x2b5996){return function(_0x25aa10){try{jsonpatch[_0x856b('0x22')](_0x25aa10,_0x2b5996,!![]);}catch(_0x7faf6){return BPromise[_0x856b('0x23')](_0x7faf6);}return _0x25aa10[_0x856b('0x24')]();};}function saveUpdates(_0x126cfc,_0x1bcf1c){return function(_0xf8261a){if(_0xf8261a){return _0xf8261a['update'](_0x126cfc)['then'](function(_0x4214e1){return _0x4214e1;});}return null;};}function removeEntity(_0x2cbe50,_0x50488f){return function(_0x8cff06){if(_0x8cff06){return _0x8cff06[_0x856b('0x25')]()[_0x856b('0x26')](function(){_0x2cbe50[_0x856b('0x19')](0xcc)[_0x856b('0x1a')]();});}};}function handleEntityNotFound(_0x12b4cf,_0x2b2bb3){return function(_0x174e70){if(!_0x174e70){_0x12b4cf[_0x856b('0x18')](0x194);}return _0x174e70;};}function handleError(_0xca81bc,_0x4e77d1){_0x4e77d1=_0x4e77d1||0x1f4;return function(_0x2c85fe){logger[_0x856b('0x27')](_0x2c85fe[_0x856b('0x28')]);if(_0x2c85fe[_0x856b('0x29')]){delete _0x2c85fe[_0x856b('0x29')];}_0xca81bc[_0x856b('0x19')](_0x4e77d1)[_0x856b('0x2a')](_0x2c85fe);};}exports[_0x856b('0x2b')]=function(_0x7f42b,_0x17ac01){var _0x42d9f2={},_0x3dce38={},_0xb4113={'count':0x0,'rows':[]};var _0x5cc72f=_[_0x856b('0x2c')](db[_0x856b('0x2d')][_0x856b('0x2e')],function(_0x116157){return{'name':_0x116157[_0x856b('0x2f')],'type':_0x116157[_0x856b('0x30')][_0x856b('0x31')]};});_0x3dce38[_0x856b('0x32')]=_[_0x856b('0x2c')](_0x5cc72f,_0x856b('0x29'));_0x3dce38[_0x856b('0x33')]=_[_0x856b('0x34')](_0x7f42b[_0x856b('0x33')]);_0x3dce38[_0x856b('0x35')]=_[_0x856b('0x36')](_0x3dce38[_0x856b('0x32')],_0x3dce38[_0x856b('0x33')]);_0x42d9f2[_0x856b('0x37')]=_['intersection'](_0x3dce38[_0x856b('0x32')],qs[_0x856b('0x38')](_0x7f42b[_0x856b('0x33')][_0x856b('0x38')]));_0x42d9f2[_0x856b('0x37')]=_0x42d9f2[_0x856b('0x37')][_0x856b('0x39')]?_0x42d9f2['attributes']:_0x3dce38[_0x856b('0x32')];if(!_0x7f42b[_0x856b('0x33')][_0x856b('0x3a')](_0x856b('0x3b'))){_0x42d9f2[_0x856b('0x1d')]=qs[_0x856b('0x1d')](_0x7f42b[_0x856b('0x33')][_0x856b('0x1d')]);_0x42d9f2[_0x856b('0x1c')]=qs[_0x856b('0x1c')](_0x7f42b[_0x856b('0x33')][_0x856b('0x1c')]);}_0x42d9f2[_0x856b('0x3c')]=qs[_0x856b('0x3d')](_0x7f42b[_0x856b('0x33')]['sort']);_0x42d9f2[_0x856b('0x3e')]=qs[_0x856b('0x35')](_['pick'](_0x7f42b['query'],_0x3dce38[_0x856b('0x35')]),_0x5cc72f);if(_0x7f42b['query'][_0x856b('0x3f')]){_0x42d9f2[_0x856b('0x3e')]=_[_0x856b('0x40')](_0x42d9f2[_0x856b('0x3e')],{'$or':_['map'](_0x5cc72f,function(_0x21d5b2){if(_0x21d5b2[_0x856b('0x30')]!==_0x856b('0x41')){var _0x51fcd9={};_0x51fcd9[_0x21d5b2[_0x856b('0x29')]]={'$like':'%'+_0x7f42b[_0x856b('0x33')][_0x856b('0x3f')]+'%'};return _0x51fcd9;}})});}_0x42d9f2=_[_0x856b('0x40')]({},_0x42d9f2,_0x7f42b[_0x856b('0x42')]);var _0x566900={'where':_0x42d9f2['where']};return db[_0x856b('0x2d')][_0x856b('0x1f')](_0x566900)[_0x856b('0x26')](function(_0x51aa46){_0xb4113['count']=_0x51aa46;if(_0x7f42b[_0x856b('0x33')]['includeAll']){_0x42d9f2[_0x856b('0x43')]=[{'all':!![]}];}return db[_0x856b('0x2d')][_0x856b('0x44')](_0x42d9f2);})[_0x856b('0x26')](function(_0x5603f3){_0xb4113['rows']=_0x5603f3;return _0xb4113;})[_0x856b('0x26')](respondWithFilteredResult(_0x17ac01,_0x42d9f2))[_0x856b('0x45')](handleError(_0x17ac01,null));};exports['show']=function(_0x1273c2,_0x199004){var _0x32ac53={'raw':!![],'where':{'id':_0x1273c2[_0x856b('0x46')]['id']}},_0x18ad1c={};_0x18ad1c[_0x856b('0x32')]=_[_0x856b('0x34')](db[_0x856b('0x2d')][_0x856b('0x2e')]);_0x18ad1c['query']=_[_0x856b('0x34')](_0x1273c2[_0x856b('0x33')]);_0x18ad1c['filters']=_[_0x856b('0x36')](_0x18ad1c[_0x856b('0x32')],_0x18ad1c[_0x856b('0x33')]);_0x32ac53[_0x856b('0x37')]=_[_0x856b('0x36')](_0x18ad1c['model'],qs['fields'](_0x1273c2[_0x856b('0x33')][_0x856b('0x38')]));_0x32ac53[_0x856b('0x37')]=_0x32ac53[_0x856b('0x37')][_0x856b('0x39')]?_0x32ac53[_0x856b('0x37')]:_0x18ad1c[_0x856b('0x32')];if(_0x1273c2[_0x856b('0x33')][_0x856b('0x47')]){_0x32ac53[_0x856b('0x43')]=[{'all':!![]}];}_0x32ac53=_[_0x856b('0x40')]({},_0x32ac53,_0x1273c2[_0x856b('0x42')]);return db[_0x856b('0x2d')][_0x856b('0x48')](_0x32ac53)['then'](handleEntityNotFound(_0x199004,null))[_0x856b('0x26')](respondWithResult(_0x199004,null))[_0x856b('0x45')](handleError(_0x199004,null));};exports[_0x856b('0x49')]=function(_0x5ecce,_0x5aab08){return db['SquareDetailsReport']['create'](_0x5ecce['body'],{})[_0x856b('0x26')](respondWithResult(_0x5aab08,0xc9))[_0x856b('0x45')](handleError(_0x5aab08,null));};exports[_0x856b('0x4a')]=function(_0x219f0,_0x2c608b){if(_0x219f0[_0x856b('0x4b')]['id']){delete _0x219f0[_0x856b('0x4b')]['id'];}return db[_0x856b('0x2d')][_0x856b('0x48')]({'where':{'id':_0x219f0[_0x856b('0x46')]['id']}})[_0x856b('0x26')](handleEntityNotFound(_0x2c608b,null))['then'](saveUpdates(_0x219f0['body'],null))['then'](respondWithResult(_0x2c608b,null))[_0x856b('0x45')](handleError(_0x2c608b,null));};exports[_0x856b('0x25')]=function(_0x17cb21,_0x1f816c){return db['SquareDetailsReport'][_0x856b('0x48')]({'where':{'id':_0x17cb21[_0x856b('0x46')]['id']}})['then'](handleEntityNotFound(_0x1f816c,null))[_0x856b('0x26')](removeEntity(_0x1f816c,null))[_0x856b('0x45')](handleError(_0x1f816c,null));};exports['describe']=function(_0x1df65b,_0x31d62d){return db[_0x856b('0x2d')][_0x856b('0x4c')]()['then'](respondWithResult(_0x31d62d,null))[_0x856b('0x45')](handleError(_0x31d62d,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 0bac82c..19dcd14 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 _0x9ae4=['exports','define','SquareDetailsReport','lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareReportDetail.attributes'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x9ae4,0xb7));var _0x49ae=function(_0x27a948,_0x2eebae){_0x27a948=_0x27a948-0x0;var _0x45ac61=_0x9ae4[_0x27a948];return _0x45ac61;};'use strict';var _=require(_0x49ae('0x0'));var util=require('util');var logger=require(_0x49ae('0x1'))(_0x49ae('0x2'));var moment=require(_0x49ae('0x3'));var BPromise=require('bluebird');var rp=require(_0x49ae('0x4'));var fs=require('fs');var path=require(_0x49ae('0x5'));var rimraf=require(_0x49ae('0x6'));var config=require(_0x49ae('0x7'));var attributes=require(_0x49ae('0x8'));module[_0x49ae('0x9')]=function(_0x3d1a99,_0x14fd91){return _0x3d1a99[_0x49ae('0xa')](_0x49ae('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x875d=['../../config/logger','api','moment','path','rimraf','../../config/environment','./squareReportDetail.attributes','exports','define','SquareDetailsReport','report_square_details','lodash','util'];(function(_0x33bb4c,_0x33c7fa){var _0x36e2e1=function(_0x11eced){while(--_0x11eced){_0x33bb4c['push'](_0x33bb4c['shift']());}};_0x36e2e1(++_0x33c7fa);}(_0x875d,0x184));var _0xd875=function(_0x455c6c,_0x1e78b7){_0x455c6c=_0x455c6c-0x0;var _0x488242=_0x875d[_0x455c6c];return _0x488242;};'use strict';var _=require(_0xd875('0x0'));var util=require(_0xd875('0x1'));var logger=require(_0xd875('0x2'))(_0xd875('0x3'));var moment=require(_0xd875('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd875('0x5'));var rimraf=require(_0xd875('0x6'));var config=require(_0xd875('0x7'));var attributes=require(_0xd875('0x8'));module[_0xd875('0x9')]=function(_0x3c8e70,_0x2ca2fa){return _0x3c8e70[_0xd875('0xa')](_0xd875('0xb'),attributes,{'tableName':_0xd875('0xc'),'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 dcd67dd..e95ed9f 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 _0xde9f=['../../config/environment','jayson/promise','client','request','then','info','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','SquareDetailsReport','options','raw','CreateSquareDetailsReport','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x3d0afb,_0x31c391){var _0x375e8f=function(_0x20a8b3){while(--_0x20a8b3){_0x3d0afb['push'](_0x3d0afb['shift']());}};_0x375e8f(++_0x31c391);}(_0xde9f,0x118));var _0xfde9=function(_0x414655,_0x79d916){_0x414655=_0x414655-0x0;var _0x237884=_0xde9f[_0x414655];return _0x237884;};'use strict';var _=require(_0xfde9('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xfde9('0x1'));var rs=require(_0xfde9('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xfde9('0x3'))['db'];var utils=require(_0xfde9('0x4'));var logger=require('../../config/logger')(_0xfde9('0x5'));var config=require(_0xfde9('0x6'));var jayson=require(_0xfde9('0x7'));var client=jayson[_0xfde9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4c3e01,_0x179ee0,_0x18a202){return new BPromise(function(_0x5569c2,_0x19a337){return client[_0xfde9('0x9')](_0x4c3e01,_0x18a202)[_0xfde9('0xa')](function(_0x3b775d){logger[_0xfde9('0xb')](_0xfde9('0xc'),_0x179ee0,_0xfde9('0xd'));logger[_0xfde9('0xe')](_0xfde9('0xf'),_0x179ee0,_0xfde9('0xd'),JSON[_0xfde9('0x10')](_0x3b775d));if(_0x3b775d[_0xfde9('0x11')]){if(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x12')]===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x19a337(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);return _0x5569c2(_0x3b775d[_0xfde9('0x11')][_0xfde9('0x13')]);}else{logger[_0xfde9('0xb')]('SquareDetailsReport,\x20%s,\x20%s',_0x179ee0,_0xfde9('0xd'));_0x5569c2(_0x3b775d[_0xfde9('0x14')][_0xfde9('0x13')]);}})['catch'](function(_0x31b1c7){logger[_0xfde9('0x11')](_0xfde9('0xc'),_0x179ee0,_0x31b1c7);_0x19a337(_0x31b1c7);});});}exports['CreateSquareDetailsReport']=function(_0x4c9f24){var _0x5eb89e=this;return new Promise(function(_0x544f19,_0x166f1c){return db[_0xfde9('0x15')]['create'](_0x4c9f24['body'],{'raw':_0x4c9f24[_0xfde9('0x16')]?_0x4c9f24[_0xfde9('0x16')][_0xfde9('0x17')]===undefined?!![]:![]:!![]})[_0xfde9('0xa')](function(_0x162b07){logger[_0xfde9('0xb')](_0xfde9('0x18'),_0x4c9f24);logger[_0xfde9('0xe')](_0xfde9('0x18'),_0x4c9f24,JSON[_0xfde9('0x10')](_0x162b07));_0x544f19(_0x162b07);})[_0xfde9('0x19')](function(_0x28d189){logger['error'](_0xfde9('0x18'),_0x28d189['message'],_0x4c9f24);_0x166f1c(_0x5eb89e[_0xfde9('0x11')](0x1f4,_0x28d189[_0xfde9('0x13')]));});});}; \ No newline at end of file +var _0xe1e3=['jayson/promise','client','http','request','then','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','SquareDetailsReport,\x20%s,\x20%s','message','info','result','CreateSquareDetailsReport','options','raw','debug','catch','lodash','util','bluebird','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x361fc6,_0x40ea4f){var _0x35d5ad=function(_0x25455a){while(--_0x25455a){_0x361fc6['push'](_0x361fc6['shift']());}};_0x35d5ad(++_0x40ea4f);}(_0xe1e3,0x1bb));var _0x3e1e=function(_0x1a453d,_0x2d0fb6){_0x1a453d=_0x1a453d-0x0;var _0x381f41=_0xe1e3[_0x1a453d];return _0x381f41;};'use strict';var _=require(_0x3e1e('0x0'));var util=require(_0x3e1e('0x1'));var moment=require('moment');var BPromise=require(_0x3e1e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e1e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x3e1e('0x4'))(_0x3e1e('0x5'));var config=require(_0x3e1e('0x6'));var jayson=require(_0x3e1e('0x7'));var client=jayson[_0x3e1e('0x8')][_0x3e1e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x55cfba,_0x1574e5,_0x13926d){return new BPromise(function(_0x2f0e12,_0xa67e35){return client[_0x3e1e('0xa')](_0x55cfba,_0x13926d)[_0x3e1e('0xb')](function(_0x5e7d1f){logger['info']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x3e1e('0xc'));logger['debug'](_0x3e1e('0xd'),_0x1574e5,_0x3e1e('0xc'),JSON[_0x3e1e('0xe')](_0x5e7d1f));if(_0x5e7d1f['error']){if(_0x5e7d1f[_0x3e1e('0xf')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x1574e5,_0x5e7d1f['error']['message']);return _0xa67e35(_0x5e7d1f[_0x3e1e('0xf')]['message']);}logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x5e7d1f[_0x3e1e('0xf')][_0x3e1e('0x11')]);return _0x2f0e12(_0x5e7d1f['error']['message']);}else{logger[_0x3e1e('0x12')](_0x3e1e('0x10'),_0x1574e5,'request\x20sent');_0x2f0e12(_0x5e7d1f[_0x3e1e('0x13')][_0x3e1e('0x11')]);}})['catch'](function(_0x11c07f){logger['error'](_0x3e1e('0x10'),_0x1574e5,_0x11c07f);_0xa67e35(_0x11c07f);});});}exports[_0x3e1e('0x14')]=function(_0x1d786c){var _0x39eaa7=this;return new Promise(function(_0x791ed8,_0x1c181b){return db['SquareDetailsReport']['create'](_0x1d786c['body'],{'raw':_0x1d786c[_0x3e1e('0x15')]?_0x1d786c[_0x3e1e('0x15')][_0x3e1e('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x1c5acd){logger['info'](_0x3e1e('0x14'),_0x1d786c);logger[_0x3e1e('0x17')](_0x3e1e('0x14'),_0x1d786c,JSON['stringify'](_0x1c5acd));_0x791ed8(_0x1c5acd);})[_0x3e1e('0x18')](function(_0x96396){logger[_0x3e1e('0xf')]('CreateSquareDetailsReport',_0x96396['message'],_0x1d786c);_0x1c181b(_0x39eaa7[_0x3e1e('0xf')](0x1f4,_0x96396[_0x3e1e('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index e1179b1..3775faf 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 _0x5506=['isAuthenticated','index','get','killProcess','express','Router','../../components/auth/service'];(function(_0x204911,_0x4d76d3){var _0x19c0eb=function(_0x587f2b){while(--_0x587f2b){_0x204911['push'](_0x204911['shift']());}};_0x19c0eb(++_0x4d76d3);}(_0x5506,0x1e0));var _0x6550=function(_0x4fe202,_0x1dcbef){_0x4fe202=_0x4fe202-0x0;var _0x346ce5=_0x5506[_0x4fe202];return _0x346ce5;};'use strict';var express=require(_0x6550('0x0'));var router=express[_0x6550('0x1')]();var auth=require(_0x6550('0x2'));var controller=require('./system.controller');router['get']('/',auth[_0x6550('0x3')](),controller[_0x6550('0x4')]);router[_0x6550('0x5')]('/process/:pid/kill',auth[_0x6550('0x3')](),controller[_0x6550('0x6')]);module['exports']=router; \ No newline at end of file +var _0x4cfd=['isAuthenticated','Router','../../components/auth/service','./system.controller','index'];(function(_0x24bed6,_0x1159d6){var _0x2e5d34=function(_0x31ee9a){while(--_0x31ee9a){_0x24bed6['push'](_0x24bed6['shift']());}};_0x2e5d34(++_0x1159d6);}(_0x4cfd,0x169));var _0xd4cf=function(_0x367e5b,_0x5721e4){_0x367e5b=_0x367e5b-0x0;var _0x4b909e=_0x4cfd[_0x367e5b];return _0x4b909e;};'use strict';var express=require('express');var router=express[_0xd4cf('0x0')]();var auth=require(_0xd4cf('0x1'));var controller=require(_0xd4cf('0x2'));router['get']('/',auth['isAuthenticated'](),controller[_0xd4cf('0x3')]);router['get']('/process/:pid/kill',auth[_0xd4cf('0x4')](),controller['killProcess']);module['exports']=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 01bbd43..a3be5dc 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 _0xcdec=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','name','send','index','getAllData','status','catch','json','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','then','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','Process\x20with\x20pid\x20%s\x20killed\x20correctly','child_process','exec','../../config/logger','api'];(function(_0x2a2470,_0x4eb4a3){var _0x13371b=function(_0x3bbc48){while(--_0x3bbc48){_0x2a2470['push'](_0x2a2470['shift']());}};_0x13371b(++_0x4eb4a3);}(_0xcdec,0xd4));var _0xccde=function(_0x173aa0,_0x147b01){_0x173aa0=_0x173aa0-0x0;var _0x58c4d7=_0xcdec[_0x173aa0];return _0x58c4d7;};'use strict';var info=require('systeminformation');var exec=require(_0xccde('0x0'))[_0xccde('0x1')];var logger=require(_0xccde('0x2'))(_0xccde('0x3'));var util=require('util');var BPromise=require(_0xccde('0x4'));var _=require(_0xccde('0x5'));function handleError(_0x3cec67,_0x3d8d8f,_0x183d01){_0x3d8d8f=_0x3d8d8f||0x1f4;return function(_0x61f919){logger[_0xccde('0x6')](_0xccde('0x7'),_0x183d01,_0x3d8d8f,util['inspect'](_0x61f919,{'showHidden':![],'depth':null}));delete _0x61f919[_0xccde('0x8')];_0x3cec67['status'](_0x3d8d8f)[_0xccde('0x9')](_0x61f919);};}exports[_0xccde('0xa')]=function(_0x2eba6e,_0x16801f){return info[_0xccde('0xb')]()['then'](function(_0x1c615b){return _0x16801f[_0xccde('0xc')](0xc8)['json'](_0x1c615b);})[_0xccde('0xd')](function(_0x2fa75){return _0x16801f[_0xccde('0xc')](0x1f4)[_0xccde('0xe')](_0x2fa75);});};exports[_0xccde('0xf')]=function(_0x1092d6,_0x59391c){var _0x45958b=['components/import/cm'];return new BPromise(function(_0x57f95d,_0x2818a3){return exec(util[_0xccde('0x10')](_0xccde('0x11'),_0x1092d6[_0xccde('0x12')][_0xccde('0x13')]),function(_0x57eb38,_0x4b313c,_0x58776f){if(_0x57eb38){return _0x2818a3(_0x57eb38);}return _0x57f95d(_0x4b313c);});})[_0xccde('0x14')](function(_0x5c91ea){var _0x30a3de=![];var _0xd9ff5=_0x5c91ea[_0xccde('0x15')](/\n/);for(var _0x2d882d=0x0,_0x471df9=_0x45958b[_0xccde('0x16')];_0x2d882d<_0x471df9,_0x30a3de===![];_0x2d882d+=0x1){if(_0x5c91ea[_0xccde('0x17')](_0x45958b[_0x2d882d])>=0x0){_0x30a3de=!![];}}if(!_0x30a3de){throw new Error(util[_0xccde('0x10')](_0xccde('0x18'),_0x1092d6[_0xccde('0x12')][_0xccde('0x13')]));}process[_0xccde('0x19')](_0x1092d6[_0xccde('0x12')][_0xccde('0x13')],'SIGINT');return _0x59391c['status'](0xc8)[_0xccde('0xe')]({'message':util[_0xccde('0x10')](_0xccde('0x1a'),_0x1092d6[_0xccde('0x12')][_0xccde('0x13')])});})['catch'](handleError(_0x59391c,null,_0xccde('0xf')));}; \ No newline at end of file +var _0x999e=['params','then','length','indexOf','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','catch','../../config/logger','api','util','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','status','index','getAllData','json','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args'];(function(_0x17de72,_0x3981ec){var _0x3ecb59=function(_0x25c146){while(--_0x25c146){_0x17de72['push'](_0x17de72['shift']());}};_0x3ecb59(++_0x3981ec);}(_0x999e,0x111));var _0xe999=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x999e[_0x3dd15e];return _0x231fd0;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0xe999('0x0'))(_0xe999('0x1'));var util=require(_0xe999('0x2'));var BPromise=require(_0xe999('0x3'));var _=require(_0xe999('0x4'));function handleError(_0x2f169b,_0x3a9606,_0x40ca66){_0x3a9606=_0x3a9606||0x1f4;return function(_0x55a3d1){logger[_0xe999('0x5')](_0xe999('0x6'),_0x40ca66,_0x3a9606,util['inspect'](_0x55a3d1,{'showHidden':![],'depth':null}));delete _0x55a3d1['name'];_0x2f169b[_0xe999('0x7')](_0x3a9606)['send'](_0x55a3d1);};}exports[_0xe999('0x8')]=function(_0x4b41d4,_0x100e36){return info[_0xe999('0x9')]()['then'](function(_0x204c64){return _0x100e36[_0xe999('0x7')](0xc8)[_0xe999('0xa')](_0x204c64);})['catch'](function(_0x4b7e1b){return _0x100e36['status'](0x1f4)[_0xe999('0xa')](_0x4b7e1b);});};exports[_0xe999('0xb')]=function(_0x5e8be4,_0x193549){var _0x2730bb=[_0xe999('0xc')];return new BPromise(function(_0x9653b6,_0x5deebd){return exec(util[_0xe999('0xd')](_0xe999('0xe'),_0x5e8be4[_0xe999('0xf')]['pid']),function(_0x305d2a,_0x34f31d,_0x15f753){if(_0x305d2a){return _0x5deebd(_0x305d2a);}return _0x9653b6(_0x34f31d);});})[_0xe999('0x10')](function(_0x190a44){var _0x35ef48=![];var _0x3ee538=_0x190a44['split'](/\n/);for(var _0x55c6db=0x0,_0x5ae4b7=_0x2730bb[_0xe999('0x11')];_0x55c6db<_0x5ae4b7,_0x35ef48===![];_0x55c6db+=0x1){if(_0x190a44[_0xe999('0x12')](_0x2730bb[_0x55c6db])>=0x0){_0x35ef48=!![];}}if(!_0x35ef48){throw new Error(util[_0xe999('0xd')]('Process\x20with\x20pid\x20%s\x20not\x20found!',_0x5e8be4['params'][_0xe999('0x13')]));}process[_0xe999('0x14')](_0x5e8be4[_0xe999('0xf')][_0xe999('0x13')],_0xe999('0x15'));return _0x193549[_0xe999('0x7')](0xc8)['json']({'message':util['format'](_0xe999('0x16'),_0x5e8be4[_0xe999('0xf')][_0xe999('0x13')])});})[_0xe999('0x17')](handleError(_0x193549,null,'killProcess'));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index 891e153..ef2008b 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 _0xc17d=['create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./tag.controller','index','/:id','isAuthenticated'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xc17d,0x96));var _0xdc17=function(_0x2e2d1d,_0x54213d){_0x2e2d1d=_0x2e2d1d-0x0;var _0xc965a=_0xc17d[_0x2e2d1d];return _0xc965a;};'use strict';var multer=require(_0xdc17('0x0'));var util=require(_0xdc17('0x1'));var path=require(_0xdc17('0x2'));var timeout=require(_0xdc17('0x3'));var express=require('express');var router=express[_0xdc17('0x4')]();var fs_extra=require(_0xdc17('0x5'));var auth=require(_0xdc17('0x6'));var interaction=require(_0xdc17('0x7'));var config=require('../../config/environment');var controller=require(_0xdc17('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0xdc17('0x9')]);router['get'](_0xdc17('0xa'),auth[_0xdc17('0xb')](),controller['show']);router['post']('/',auth[_0xdc17('0xb')](),controller[_0xdc17('0xc')]);router[_0xdc17('0xd')](_0xdc17('0xa'),auth[_0xdc17('0xb')](),controller[_0xdc17('0xe')]);router[_0xdc17('0xf')](_0xdc17('0xa'),auth['isAuthenticated'](),controller[_0xdc17('0x10')]);module[_0xdc17('0x11')]=router; \ No newline at end of file +var _0xcdd3=['../../components/auth/service','./tag.controller','isAuthenticated','get','/:id','show','post','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x157348,_0x2e3cb6){var _0x51d9e8=function(_0xc8fb62){while(--_0xc8fb62){_0x157348['push'](_0x157348['shift']());}};_0x51d9e8(++_0x2e3cb6);}(_0xcdd3,0x109));var _0x3cdd=function(_0x17edab,_0x46d00a){_0x17edab=_0x17edab-0x0;var _0x5eef3e=_0xcdd3[_0x17edab];return _0x5eef3e;};'use strict';var multer=require(_0x3cdd('0x0'));var util=require(_0x3cdd('0x1'));var path=require(_0x3cdd('0x2'));var timeout=require(_0x3cdd('0x3'));var express=require(_0x3cdd('0x4'));var router=express[_0x3cdd('0x5')]();var fs_extra=require(_0x3cdd('0x6'));var auth=require(_0x3cdd('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3cdd('0x8'));router['get']('/',auth[_0x3cdd('0x9')](),controller['index']);router[_0x3cdd('0xa')](_0x3cdd('0xb'),auth['isAuthenticated'](),controller[_0x3cdd('0xc')]);router[_0x3cdd('0xd')]('/',auth[_0x3cdd('0x9')](),controller[_0x3cdd('0xe')]);router['put'](_0x3cdd('0xb'),auth['isAuthenticated'](),controller['update']);router[_0x3cdd('0xf')](_0x3cdd('0xb'),auth[_0x3cdd('0x9')](),controller[_0x3cdd('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index 1a6b2c6..588aaed 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 _0xa20a=['name','#0091EA','STRING'];(function(_0x4b4e1e,_0x36dda2){var _0x5142b5=function(_0x2f5ed8){while(--_0x2f5ed8){_0x4b4e1e['push'](_0x4b4e1e['shift']());}};_0x5142b5(++_0x36dda2);}(_0xa20a,0x74));var _0xaa20=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0xa20a[_0x26462c];return _0x509a42;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xaa20('0x0')],'unique':_0xaa20('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0xaa20('0x0')],'defaultValue':_0xaa20('0x2')},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x34b7=['#0091EA','STRING','name'];(function(_0x55e659,_0x233aa4){var _0xca08c7=function(_0xe1c5b0){while(--_0xe1c5b0){_0x55e659['push'](_0x55e659['shift']());}};_0xca08c7(++_0x233aa4);}(_0x34b7,0x196));var _0x734b=function(_0x242566,_0x4ec88d){_0x242566=_0x242566-0x0;var _0x1bc410=_0x34b7[_0x242566];return _0x1bc410;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x734b('0x0')],'unique':_0x734b('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize[_0x734b('0x0')],'defaultValue':_0x734b('0x2')},'description':{'type':Sequelize[_0x734b('0x0')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 01a807b..87fc4a3 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 _0xc6d8=['apply','reject','destroy','UserProfileResource','then','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','find','catch','create','body','role','user','get','Tags','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','eml-format','zip-dir','request-promise','bluebird','path','sox','to-csv','ejs','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/environment','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range'];(function(_0x3209e1,_0x2dd559){var _0x34477c=function(_0x195c27){while(--_0x195c27){_0x3209e1['push'](_0x3209e1['shift']());}};_0x34477c(++_0x2dd559);}(_0xc6d8,0xd7));var _0x8c6d=function(_0x435ba5,_0x55875f){_0x435ba5=_0x435ba5-0x0;var _0x5af51d=_0xc6d8[_0x435ba5];return _0x5af51d;};'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'];function respondWithStatusCode(_0x22d0fb,_0x890e85){_0x890e85=_0x890e85||0xcc;return function(_0x131d97){if(_0x131d97){return _0x22d0fb[_0x8c6d('0x16')](_0x890e85);}return _0x22d0fb[_0x8c6d('0x17')](_0x890e85)[_0x8c6d('0x18')]();};}function respondWithResult(_0x42d746,_0x103699){_0x103699=_0x103699||0xc8;return function(_0x14c1ee){if(_0x14c1ee){return _0x42d746[_0x8c6d('0x17')](_0x103699)['json'](_0x14c1ee);}};}function respondWithFilteredResult(_0x16c6b5,_0x4b2bb1){return function(_0x16af06){if(_0x16af06){var _0x4dd4b6=typeof _0x4b2bb1[_0x8c6d('0x19')]===_0x8c6d('0x1a')&&typeof _0x4b2bb1['limit']===_0x8c6d('0x1a');var _0x2b8a26=_0x16af06['count'];var _0x3e5495=_0x4dd4b6?0x0:_0x4b2bb1['offset'];var _0x4c2f8d=_0x4dd4b6?_0x16af06[_0x8c6d('0x1b')]:_0x4b2bb1['offset']+_0x4b2bb1[_0x8c6d('0x1c')];var _0x174a4f;if(_0x4c2f8d>=_0x2b8a26){_0x4c2f8d=_0x2b8a26;_0x174a4f=0xc8;}else{_0x174a4f=0xce;}_0x16c6b5[_0x8c6d('0x17')](_0x174a4f);return _0x16c6b5[_0x8c6d('0x1d')](_0x8c6d('0x1e'),_0x3e5495+'-'+_0x4c2f8d+'/'+_0x2b8a26)['json'](_0x16af06);}return null;};}function patchUpdates(_0x5512be){return function(_0x550079){try{jsonpatch[_0x8c6d('0x1f')](_0x550079,_0x5512be,!![]);}catch(_0x507e0c){return BPromise[_0x8c6d('0x20')](_0x507e0c);}return _0x550079['save']();};}function saveUpdates(_0x4c378b,_0x37fd7c){return function(_0x8cebeb){if(_0x8cebeb){return _0x8cebeb['update'](_0x4c378b)['then'](function(_0x51bb08){return _0x51bb08;});}return null;};}function removeEntity(_0x47d3a0,_0x2a85b5){return function(_0xd16c91){if(_0xd16c91){return _0xd16c91[_0x8c6d('0x21')]()['then'](function(){var _0x41c904=_0xd16c91['get']({'plain':!![]});var _0x15a9c4='Tags';return db[_0x8c6d('0x22')][_0x8c6d('0x21')]({'where':{'type':_0x15a9c4,'resourceId':_0x41c904['id']}})[_0x8c6d('0x23')](function(){return _0xd16c91;});})[_0x8c6d('0x23')](function(){_0x47d3a0[_0x8c6d('0x17')](0xcc)[_0x8c6d('0x18')]();});}};}function handleEntityNotFound(_0x9c269d,_0x41957d){return function(_0x3eab38){if(!_0x3eab38){_0x9c269d['sendStatus'](0x194);}return _0x3eab38;};}function handleError(_0x544143,_0x342d8e){_0x342d8e=_0x342d8e||0x1f4;return function(_0x93a094){logger[_0x8c6d('0x24')](_0x93a094[_0x8c6d('0x25')]);if(_0x93a094[_0x8c6d('0x26')]){delete _0x93a094[_0x8c6d('0x26')];}_0x544143[_0x8c6d('0x17')](_0x342d8e)[_0x8c6d('0x27')](_0x93a094);};}exports[_0x8c6d('0x28')]=function(_0x43d70c,_0x3375dd){var _0x15a508={},_0x4e5203={},_0x3af625={'count':0x0,'rows':[]};var _0x332f6a=_[_0x8c6d('0x29')](db[_0x8c6d('0x2a')][_0x8c6d('0x2b')],function(_0xa46064){return{'name':_0xa46064[_0x8c6d('0x2c')],'type':_0xa46064[_0x8c6d('0x2d')][_0x8c6d('0x2e')]};});_0x4e5203['model']=_[_0x8c6d('0x29')](_0x332f6a,'name');_0x4e5203[_0x8c6d('0x2f')]=_[_0x8c6d('0x30')](_0x43d70c[_0x8c6d('0x2f')]);_0x4e5203[_0x8c6d('0x31')]=_[_0x8c6d('0x32')](_0x4e5203[_0x8c6d('0x33')],_0x4e5203['query']);_0x15a508['attributes']=_[_0x8c6d('0x32')](_0x4e5203[_0x8c6d('0x33')],qs[_0x8c6d('0x34')](_0x43d70c[_0x8c6d('0x2f')]['fields']));_0x15a508[_0x8c6d('0x35')]=_0x15a508[_0x8c6d('0x35')][_0x8c6d('0x36')]?_0x15a508[_0x8c6d('0x35')]:_0x4e5203[_0x8c6d('0x33')];if(!_0x43d70c[_0x8c6d('0x2f')]['hasOwnProperty'](_0x8c6d('0x37'))){_0x15a508[_0x8c6d('0x1c')]=qs[_0x8c6d('0x1c')](_0x43d70c[_0x8c6d('0x2f')][_0x8c6d('0x1c')]);_0x15a508[_0x8c6d('0x19')]=qs[_0x8c6d('0x19')](_0x43d70c[_0x8c6d('0x2f')][_0x8c6d('0x19')]);}_0x15a508[_0x8c6d('0x38')]=qs[_0x8c6d('0x39')](_0x43d70c[_0x8c6d('0x2f')]['sort']);_0x15a508[_0x8c6d('0x3a')]=qs[_0x8c6d('0x31')](_[_0x8c6d('0x3b')](_0x43d70c[_0x8c6d('0x2f')],_0x4e5203[_0x8c6d('0x31')]),_0x332f6a);if(_0x43d70c['query'][_0x8c6d('0x3c')]){_0x15a508[_0x8c6d('0x3a')]=_['merge'](_0x15a508[_0x8c6d('0x3a')],{'$or':_[_0x8c6d('0x29')](_0x332f6a,function(_0x3b329){if(_0x3b329['type']!==_0x8c6d('0x3d')){var _0xb7293d={};_0xb7293d[_0x3b329[_0x8c6d('0x26')]]={'$like':'%'+_0x43d70c[_0x8c6d('0x2f')][_0x8c6d('0x3c')]+'%'};return _0xb7293d;}})});}_0x15a508=_[_0x8c6d('0x3e')]({},_0x15a508,_0x43d70c[_0x8c6d('0x3f')]);var _0x2bbf60={'where':_0x15a508[_0x8c6d('0x3a')]};return db[_0x8c6d('0x2a')][_0x8c6d('0x1b')](_0x2bbf60)['then'](function(_0x58af06){_0x3af625['count']=_0x58af06;if(_0x43d70c[_0x8c6d('0x2f')][_0x8c6d('0x40')]){_0x15a508[_0x8c6d('0x41')]=[{'all':!![]}];}return db[_0x8c6d('0x2a')][_0x8c6d('0x42')](_0x15a508);})['then'](function(_0x274d01){_0x3af625[_0x8c6d('0x43')]=_0x274d01;return _0x3af625;})[_0x8c6d('0x23')](respondWithFilteredResult(_0x3375dd,_0x15a508))['catch'](handleError(_0x3375dd,null));};exports[_0x8c6d('0x44')]=function(_0x4aa3e8,_0x496aeb){var _0x4e4262={'raw':!![],'where':{'id':_0x4aa3e8['params']['id']}},_0x4bd626={};_0x4bd626['model']=_[_0x8c6d('0x30')](db[_0x8c6d('0x2a')][_0x8c6d('0x2b')]);_0x4bd626[_0x8c6d('0x2f')]=_[_0x8c6d('0x30')](_0x4aa3e8['query']);_0x4bd626['filters']=_['intersection'](_0x4bd626['model'],_0x4bd626[_0x8c6d('0x2f')]);_0x4e4262['attributes']=_[_0x8c6d('0x32')](_0x4bd626[_0x8c6d('0x33')],qs[_0x8c6d('0x34')](_0x4aa3e8[_0x8c6d('0x2f')][_0x8c6d('0x34')]));_0x4e4262[_0x8c6d('0x35')]=_0x4e4262['attributes'][_0x8c6d('0x36')]?_0x4e4262[_0x8c6d('0x35')]:_0x4bd626['model'];if(_0x4aa3e8[_0x8c6d('0x2f')][_0x8c6d('0x40')]){_0x4e4262['include']=[{'all':!![]}];}_0x4e4262=_[_0x8c6d('0x3e')]({},_0x4e4262,_0x4aa3e8[_0x8c6d('0x3f')]);return db[_0x8c6d('0x2a')][_0x8c6d('0x45')](_0x4e4262)[_0x8c6d('0x23')](handleEntityNotFound(_0x496aeb,null))[_0x8c6d('0x23')](respondWithResult(_0x496aeb,null))[_0x8c6d('0x46')](handleError(_0x496aeb,null));};exports[_0x8c6d('0x47')]=function(_0x1f1609,_0x1d6c29){return db[_0x8c6d('0x2a')][_0x8c6d('0x47')](_0x1f1609[_0x8c6d('0x48')],{})[_0x8c6d('0x23')](function(_0x8ff437){var _0x337e37=_0x1f1609['user']['get']({'plain':!![]});if(!_0x337e37)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x337e37[_0x8c6d('0x49')]===_0x8c6d('0x4a')){var _0x4919b8=_0x8ff437[_0x8c6d('0x4b')]({'plain':!![]});var _0x53f7b0=_0x8c6d('0x4c');return db['UserProfileSection'][_0x8c6d('0x45')]({'where':{'name':_0x53f7b0,'userProfileId':_0x337e37[_0x8c6d('0x4d')]},'raw':!![]})[_0x8c6d('0x23')](function(_0x5e2dbb){if(_0x5e2dbb&&_0x5e2dbb[_0x8c6d('0x4e')]===0x0){return db['UserProfileResource'][_0x8c6d('0x47')]({'name':_0x4919b8['name'],'resourceId':_0x4919b8['id'],'type':_0x5e2dbb[_0x8c6d('0x26')],'sectionId':_0x5e2dbb['id']},{})[_0x8c6d('0x23')](function(){return _0x8ff437;});}else{return _0x8ff437;}})[_0x8c6d('0x46')](function(_0x334a29){logger['error'](_0x8c6d('0x4f'),_0x334a29);throw _0x334a29;});}return _0x8ff437;})[_0x8c6d('0x23')](respondWithResult(_0x1d6c29,0xc9))[_0x8c6d('0x46')](handleError(_0x1d6c29,null));};exports[_0x8c6d('0x50')]=function(_0x309396,_0x219a8b){if(_0x309396[_0x8c6d('0x48')]['id']){delete _0x309396[_0x8c6d('0x48')]['id'];}return db['Tag'][_0x8c6d('0x45')]({'where':{'id':_0x309396[_0x8c6d('0x51')]['id']}})[_0x8c6d('0x23')](handleEntityNotFound(_0x219a8b,null))[_0x8c6d('0x23')](saveUpdates(_0x309396['body'],null))[_0x8c6d('0x23')](respondWithResult(_0x219a8b,null))['catch'](handleError(_0x219a8b,null));};exports['destroy']=function(_0x28b5c6,_0x6c8f78){return db[_0x8c6d('0x2a')][_0x8c6d('0x45')]({'where':{'id':_0x28b5c6[_0x8c6d('0x51')]['id']}})[_0x8c6d('0x23')](handleEntityNotFound(_0x6c8f78,null))[_0x8c6d('0x23')](removeEntity(_0x6c8f78,null))['catch'](handleError(_0x6c8f78,null));}; \ No newline at end of file +var _0x222f=['eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','Tags','UserProfileResource','error','stack','name','send','index','map','Tag','rawAttributes','fieldName','model','query','keys','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','filters','pick','filter','merge','type','options','includeAll','include','findAll','rows','catch','show','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body'];(function(_0x28389b,_0x4824df){var _0x3e9a6d=function(_0x150c52){while(--_0x150c52){_0x28389b['push'](_0x28389b['shift']());}};_0x3e9a6d(++_0x4824df);}(_0x222f,0x1a4));var _0xf222=function(_0x53c2b9,_0x1dbc82){_0x53c2b9=_0x53c2b9-0x0;var _0x2c677b=_0x222f[_0x53c2b9];return _0x2c677b;};'use strict';var emlformat=require(_0xf222('0x0'));var rimraf=require(_0xf222('0x1'));var zipdir=require(_0xf222('0x2'));var jsonpatch=require(_0xf222('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf222('0x4'));var Mustache=require(_0xf222('0x5'));var util=require(_0xf222('0x6'));var path=require(_0xf222('0x7'));var sox=require('sox');var csv=require(_0xf222('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf222('0x9'));var _=require(_0xf222('0xa'));var squel=require('squel');var crypto=require(_0xf222('0xb'));var jsforce=require(_0xf222('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xf222('0x8'));var querystring=require(_0xf222('0xd'));var Papa=require(_0xf222('0xe'));var Redis=require(_0xf222('0xf'));var authService=require(_0xf222('0x10'));var qs=require(_0xf222('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf222('0x12'));var logger=require(_0xf222('0x13'))(_0xf222('0x14'));var utils=require(_0xf222('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf222('0x16'));var db=require(_0xf222('0x17'))['db'];function respondWithStatusCode(_0x2a6965,_0x3d3d29){_0x3d3d29=_0x3d3d29||0xcc;return function(_0x12f968){if(_0x12f968){return _0x2a6965[_0xf222('0x18')](_0x3d3d29);}return _0x2a6965[_0xf222('0x19')](_0x3d3d29)[_0xf222('0x1a')]();};}function respondWithResult(_0x52a003,_0x5b8f97){_0x5b8f97=_0x5b8f97||0xc8;return function(_0x1feb86){if(_0x1feb86){return _0x52a003[_0xf222('0x19')](_0x5b8f97)['json'](_0x1feb86);}};}function respondWithFilteredResult(_0x39be58,_0x43d35b){return function(_0x464f3e){if(_0x464f3e){var _0x4392a0=typeof _0x43d35b[_0xf222('0x1b')]===_0xf222('0x1c')&&typeof _0x43d35b[_0xf222('0x1d')]==='undefined';var _0x1efa9f=_0x464f3e[_0xf222('0x1e')];var _0x8783ab=_0x4392a0?0x0:_0x43d35b[_0xf222('0x1b')];var _0x12a2e4=_0x4392a0?_0x464f3e[_0xf222('0x1e')]:_0x43d35b[_0xf222('0x1b')]+_0x43d35b['limit'];var _0xf26a16;if(_0x12a2e4>=_0x1efa9f){_0x12a2e4=_0x1efa9f;_0xf26a16=0xc8;}else{_0xf26a16=0xce;}_0x39be58[_0xf222('0x19')](_0xf26a16);return _0x39be58[_0xf222('0x1f')](_0xf222('0x20'),_0x8783ab+'-'+_0x12a2e4+'/'+_0x1efa9f)['json'](_0x464f3e);}return null;};}function patchUpdates(_0x5cd899){return function(_0x398ff4){try{jsonpatch[_0xf222('0x21')](_0x398ff4,_0x5cd899,!![]);}catch(_0x201cf0){return BPromise[_0xf222('0x22')](_0x201cf0);}return _0x398ff4[_0xf222('0x23')]();};}function saveUpdates(_0x151a89,_0x51b872){return function(_0x176b20){if(_0x176b20){return _0x176b20[_0xf222('0x24')](_0x151a89)[_0xf222('0x25')](function(_0x12d443){return _0x12d443;});}return null;};}function removeEntity(_0x2c48ce,_0x2d18ab){return function(_0x4616de){if(_0x4616de){return _0x4616de[_0xf222('0x26')]()['then'](function(){var _0x145e2e=_0x4616de[_0xf222('0x27')]({'plain':!![]});var _0x1883c1=_0xf222('0x28');return db[_0xf222('0x29')][_0xf222('0x26')]({'where':{'type':_0x1883c1,'resourceId':_0x145e2e['id']}})[_0xf222('0x25')](function(){return _0x4616de;});})[_0xf222('0x25')](function(){_0x2c48ce[_0xf222('0x19')](0xcc)[_0xf222('0x1a')]();});}};}function handleEntityNotFound(_0x2a8310,_0x501f8e){return function(_0x14b2b1){if(!_0x14b2b1){_0x2a8310[_0xf222('0x18')](0x194);}return _0x14b2b1;};}function handleError(_0x3d5508,_0x2f04bf){_0x2f04bf=_0x2f04bf||0x1f4;return function(_0xe41039){logger[_0xf222('0x2a')](_0xe41039[_0xf222('0x2b')]);if(_0xe41039[_0xf222('0x2c')]){delete _0xe41039[_0xf222('0x2c')];}_0x3d5508['status'](_0x2f04bf)[_0xf222('0x2d')](_0xe41039);};}exports[_0xf222('0x2e')]=function(_0x3ffc30,_0x53a382){var _0x3ccc9e={},_0x5d5963={},_0x40c7e7={'count':0x0,'rows':[]};var _0x27a8cc=_[_0xf222('0x2f')](db[_0xf222('0x30')][_0xf222('0x31')],function(_0x152d79){return{'name':_0x152d79[_0xf222('0x32')],'type':_0x152d79['type']['key']};});_0x5d5963[_0xf222('0x33')]=_[_0xf222('0x2f')](_0x27a8cc,_0xf222('0x2c'));_0x5d5963[_0xf222('0x34')]=_[_0xf222('0x35')](_0x3ffc30[_0xf222('0x34')]);_0x5d5963['filters']=_[_0xf222('0x36')](_0x5d5963[_0xf222('0x33')],_0x5d5963[_0xf222('0x34')]);_0x3ccc9e['attributes']=_[_0xf222('0x36')](_0x5d5963[_0xf222('0x33')],qs[_0xf222('0x37')](_0x3ffc30['query'][_0xf222('0x37')]));_0x3ccc9e[_0xf222('0x38')]=_0x3ccc9e[_0xf222('0x38')]['length']?_0x3ccc9e[_0xf222('0x38')]:_0x5d5963[_0xf222('0x33')];if(!_0x3ffc30[_0xf222('0x34')][_0xf222('0x39')](_0xf222('0x3a'))){_0x3ccc9e['limit']=qs[_0xf222('0x1d')](_0x3ffc30['query'][_0xf222('0x1d')]);_0x3ccc9e[_0xf222('0x1b')]=qs[_0xf222('0x1b')](_0x3ffc30['query'][_0xf222('0x1b')]);}_0x3ccc9e[_0xf222('0x3b')]=qs['sort'](_0x3ffc30[_0xf222('0x34')]['sort']);_0x3ccc9e[_0xf222('0x3c')]=qs[_0xf222('0x3d')](_[_0xf222('0x3e')](_0x3ffc30['query'],_0x5d5963[_0xf222('0x3d')]),_0x27a8cc);if(_0x3ffc30[_0xf222('0x34')][_0xf222('0x3f')]){_0x3ccc9e[_0xf222('0x3c')]=_[_0xf222('0x40')](_0x3ccc9e[_0xf222('0x3c')],{'$or':_['map'](_0x27a8cc,function(_0x1ae1d4){if(_0x1ae1d4[_0xf222('0x41')]!=='VIRTUAL'){var _0x49cad2={};_0x49cad2[_0x1ae1d4[_0xf222('0x2c')]]={'$like':'%'+_0x3ffc30['query'][_0xf222('0x3f')]+'%'};return _0x49cad2;}})});}_0x3ccc9e=_[_0xf222('0x40')]({},_0x3ccc9e,_0x3ffc30[_0xf222('0x42')]);var _0xc16fcb={'where':_0x3ccc9e['where']};return db['Tag'][_0xf222('0x1e')](_0xc16fcb)['then'](function(_0x522a9e){_0x40c7e7[_0xf222('0x1e')]=_0x522a9e;if(_0x3ffc30[_0xf222('0x34')][_0xf222('0x43')]){_0x3ccc9e[_0xf222('0x44')]=[{'all':!![]}];}return db[_0xf222('0x30')][_0xf222('0x45')](_0x3ccc9e);})['then'](function(_0xf829ae){_0x40c7e7[_0xf222('0x46')]=_0xf829ae;return _0x40c7e7;})['then'](respondWithFilteredResult(_0x53a382,_0x3ccc9e))[_0xf222('0x47')](handleError(_0x53a382,null));};exports[_0xf222('0x48')]=function(_0x56a5f0,_0x19cb67){var _0x51ed52={'raw':!![],'where':{'id':_0x56a5f0[_0xf222('0x49')]['id']}},_0x149589={};_0x149589[_0xf222('0x33')]=_[_0xf222('0x35')](db[_0xf222('0x30')][_0xf222('0x31')]);_0x149589[_0xf222('0x34')]=_[_0xf222('0x35')](_0x56a5f0[_0xf222('0x34')]);_0x149589[_0xf222('0x3d')]=_[_0xf222('0x36')](_0x149589['model'],_0x149589['query']);_0x51ed52['attributes']=_[_0xf222('0x36')](_0x149589[_0xf222('0x33')],qs[_0xf222('0x37')](_0x56a5f0[_0xf222('0x34')]['fields']));_0x51ed52[_0xf222('0x38')]=_0x51ed52[_0xf222('0x38')][_0xf222('0x4a')]?_0x51ed52[_0xf222('0x38')]:_0x149589['model'];if(_0x56a5f0[_0xf222('0x34')][_0xf222('0x43')]){_0x51ed52[_0xf222('0x44')]=[{'all':!![]}];}_0x51ed52=_[_0xf222('0x40')]({},_0x51ed52,_0x56a5f0[_0xf222('0x42')]);return db[_0xf222('0x30')][_0xf222('0x4b')](_0x51ed52)[_0xf222('0x25')](handleEntityNotFound(_0x19cb67,null))[_0xf222('0x25')](respondWithResult(_0x19cb67,null))[_0xf222('0x47')](handleError(_0x19cb67,null));};exports['create']=function(_0x5d0d70,_0x193762){return db['Tag'][_0xf222('0x4c')](_0x5d0d70['body'],{})[_0xf222('0x25')](function(_0x4e9083){var _0x2d8a04=_0x5d0d70[_0xf222('0x4d')][_0xf222('0x27')]({'plain':!![]});if(!_0x2d8a04)throw new Error(_0xf222('0x4e'));if(_0x2d8a04['role']===_0xf222('0x4d')){var _0x34fd50=_0x4e9083[_0xf222('0x27')]({'plain':!![]});var _0x2dc8d2=_0xf222('0x28');return db[_0xf222('0x4f')][_0xf222('0x4b')]({'where':{'name':_0x2dc8d2,'userProfileId':_0x2d8a04[_0xf222('0x50')]},'raw':!![]})[_0xf222('0x25')](function(_0x8e620){if(_0x8e620&&_0x8e620[_0xf222('0x51')]===0x0){return db[_0xf222('0x29')]['create']({'name':_0x34fd50['name'],'resourceId':_0x34fd50['id'],'type':_0x8e620[_0xf222('0x2c')],'sectionId':_0x8e620['id']},{})[_0xf222('0x25')](function(){return _0x4e9083;});}else{return _0x4e9083;}})[_0xf222('0x47')](function(_0xfb75f0){logger[_0xf222('0x2a')](_0xf222('0x52'),_0xfb75f0);throw _0xfb75f0;});}return _0x4e9083;})[_0xf222('0x25')](respondWithResult(_0x193762,0xc9))[_0xf222('0x47')](handleError(_0x193762,null));};exports[_0xf222('0x24')]=function(_0x1e680a,_0x19d859){if(_0x1e680a['body']['id']){delete _0x1e680a['body']['id'];}return db[_0xf222('0x30')][_0xf222('0x4b')]({'where':{'id':_0x1e680a[_0xf222('0x49')]['id']}})[_0xf222('0x25')](handleEntityNotFound(_0x19d859,null))[_0xf222('0x25')](saveUpdates(_0x1e680a[_0xf222('0x53')],null))[_0xf222('0x25')](respondWithResult(_0x19d859,null))[_0xf222('0x47')](handleError(_0x19d859,null));};exports[_0xf222('0x26')]=function(_0x1c4da4,_0x32ec77){return db[_0xf222('0x30')][_0xf222('0x4b')]({'where':{'id':_0x1c4da4[_0xf222('0x49')]['id']}})['then'](handleEntityNotFound(_0x32ec77,null))[_0xf222('0x25')](removeEntity(_0x32ec77,null))['catch'](handleError(_0x32ec77,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index cf0ef0c..453329c 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 _0xe444=['Tag','lodash','../../config/logger','api','moment','request-promise','../../config/environment','exports','define'];(function(_0x5c72ee,_0x5a8bf8){var _0x231876=function(_0x955276){while(--_0x955276){_0x5c72ee['push'](_0x5c72ee['shift']());}};_0x231876(++_0x5a8bf8);}(_0xe444,0x196));var _0x4e44=function(_0x48c5fe,_0xf38e17){_0x48c5fe=_0x48c5fe-0x0;var _0x3bf1f4=_0xe444[_0x48c5fe];return _0x3bf1f4;};'use strict';var _=require(_0x4e44('0x0'));var util=require('util');var logger=require(_0x4e44('0x1'))(_0x4e44('0x2'));var moment=require(_0x4e44('0x3'));var BPromise=require('bluebird');var rp=require(_0x4e44('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4e44('0x5'));var attributes=require('./tag.attributes');module[_0x4e44('0x6')]=function(_0x2897c0,_0x40a83f){return _0x2897c0[_0x4e44('0x7')](_0x4e44('0x8'),attributes,{'tableName':'tools_tags','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a37=['request-promise','../../config/environment','./tag.attributes','exports','define','Tag','tools_tags','lodash','util','../../config/logger','api','moment'];(function(_0x40e6cb,_0x2eaa1e){var _0x45d9c7=function(_0x4832a0){while(--_0x4832a0){_0x40e6cb['push'](_0x40e6cb['shift']());}};_0x45d9c7(++_0x2eaa1e);}(_0x7a37,0xdf));var _0x77a3=function(_0x4017fc,_0x4734de){_0x4017fc=_0x4017fc-0x0;var _0x49b7e4=_0x7a37[_0x4017fc];return _0x49b7e4;};'use strict';var _=require(_0x77a3('0x0'));var util=require(_0x77a3('0x1'));var logger=require(_0x77a3('0x2'))(_0x77a3('0x3'));var moment=require(_0x77a3('0x4'));var BPromise=require('bluebird');var rp=require(_0x77a3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x77a3('0x6'));var attributes=require(_0x77a3('0x7'));module[_0x77a3('0x8')]=function(_0x33b1e2,_0x48a5ae){return _0x33b1e2[_0x77a3('0x9')](_0x77a3('0xa'),attributes,{'tableName':_0x77a3('0xb'),'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 95a1044..da4a154 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 _0x0f9f=['message','info','result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x93b5e2,_0x397ba2){var _0x36277b=function(_0x1a88bb){while(--_0x1a88bb){_0x93b5e2['push'](_0x93b5e2['shift']());}};_0x36277b(++_0x397ba2);}(_0x0f9f,0x1cc));var _0xf0f9=function(_0x24a312,_0x816625){_0x24a312=_0x24a312-0x0;var _0x4ac91f=_0x0f9f[_0x24a312];return _0x4ac91f;};'use strict';var _=require('lodash');var util=require(_0xf0f9('0x0'));var moment=require(_0xf0f9('0x1'));var BPromise=require(_0xf0f9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf0f9('0x3'));var db=require(_0xf0f9('0x4'))['db'];var utils=require(_0xf0f9('0x5'));var logger=require(_0xf0f9('0x6'))(_0xf0f9('0x7'));var config=require(_0xf0f9('0x8'));var jayson=require(_0xf0f9('0x9'));var client=jayson[_0xf0f9('0xa')][_0xf0f9('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x45694e,_0x51a0ed,_0x448cf5){return new BPromise(function(_0x294b42,_0x5d1753){return client[_0xf0f9('0xc')](_0x45694e,_0x448cf5)[_0xf0f9('0xd')](function(_0x2d72c9){logger['info'](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));logger[_0xf0f9('0x10')]('Tag,\x20%s,\x20%s,\x20%s',_0x51a0ed,'request\x20sent',JSON[_0xf0f9('0x11')](_0x2d72c9));if(_0x2d72c9[_0xf0f9('0x12')]){if(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x13')]===0x1f4){logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x5d1753(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}logger[_0xf0f9('0x12')](_0xf0f9('0xe'),_0x51a0ed,_0x2d72c9[_0xf0f9('0x12')]['message']);return _0x294b42(_0x2d72c9[_0xf0f9('0x12')][_0xf0f9('0x14')]);}else{logger[_0xf0f9('0x15')](_0xf0f9('0xe'),_0x51a0ed,_0xf0f9('0xf'));_0x294b42(_0x2d72c9[_0xf0f9('0x16')][_0xf0f9('0x14')]);}})[_0xf0f9('0x17')](function(_0x677b32){logger[_0xf0f9('0x12')]('Tag,\x20%s,\x20%s',_0x51a0ed,_0x677b32);_0x5d1753(_0x677b32);});});} \ No newline at end of file +var _0xc978=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc978,0xcd));var _0x8c97=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xc978[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x8c97('0x0'));var util=require(_0x8c97('0x1'));var moment=require(_0x8c97('0x2'));var BPromise=require(_0x8c97('0x3'));var rs=require(_0x8c97('0x4'));var fs=require('fs');var Redis=require(_0x8c97('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c97('0x6'));var logger=require(_0x8c97('0x7'))(_0x8c97('0x8'));var config=require(_0x8c97('0x9'));var jayson=require(_0x8c97('0xa'));var client=jayson[_0x8c97('0xb')][_0x8c97('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x524196,_0x41a511,_0x1b5864){return new BPromise(function(_0x332cd1,_0x26ff40){return client[_0x8c97('0xd')](_0x524196,_0x1b5864)[_0x8c97('0xe')](function(_0x17aef0){logger['info'](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));logger[_0x8c97('0x11')](_0x8c97('0x12'),_0x41a511,_0x8c97('0x10'),JSON[_0x8c97('0x13')](_0x17aef0));if(_0x17aef0[_0x8c97('0x14')]){if(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x15')]===0x1f4){logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0[_0x8c97('0x14')]['message']);return _0x26ff40(_0x17aef0[_0x8c97('0x14')][_0x8c97('0x16')]);}logger['error'](_0x8c97('0xf'),_0x41a511,_0x17aef0['error']['message']);return _0x332cd1(_0x17aef0['error'][_0x8c97('0x16')]);}else{logger[_0x8c97('0x17')](_0x8c97('0xf'),_0x41a511,_0x8c97('0x10'));_0x332cd1(_0x17aef0[_0x8c97('0x18')][_0x8c97('0x16')]);}})[_0x8c97('0x19')](function(_0xe3be1){logger[_0x8c97('0x14')]('Tag,\x20%s,\x20%s',_0x41a511,_0xe3be1);_0x26ff40(_0xe3be1);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 1d79303..d14880a 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 _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5037ab,_0x43209e){_0x5037ab=_0x5037ab-0x0;var _0x512adb=_0xa9e0[_0x5037ab];return _0x512adb;};'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['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index fa78122..3c0d004 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 _0xb7e7=['STRING','sequelize'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0xb7e7,0x121));var _0x7b7e=function(_0xc67528,_0x24e2fb){_0xc67528=_0xc67528-0x0;var _0x38e26d=_0xb7e7[_0xc67528];return _0x38e26d;};'use strict';var Sequelize=require(_0x7b7e('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b7e('0x1')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x7b7e('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0xc32356,_0x1c883d){var _0x55073c=function(_0xbf4cae){while(--_0xbf4cae){_0xc32356['push'](_0xc32356['shift']());}};_0x55073c(++_0x1c883d);}(_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')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'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 a3dee23..107e3bc 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 _0xfc31=['ids','addAgents','Voice','Chat','Sms','Fax','Openchannel','Whatsapp','sequelize','transaction','through','TeamVoiceQueue','penalty','findOrCreate','emit','User','online','voicePause','interface','UserVoiceQueueRt','isNil','SIP/%s','all','spread','removeAgents','Mail','parse','Queue:remove','getAgents','findOne','hasOwnProperty','eml-format','rimraf','zip-dir','request-promise','bluebird','util','sox','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/license/util','redis','defaults','localhost','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','Teams','UserProfileResource','destroy','end','error','stack','name','map','Team','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','findAll','rows','show','rawAttributes','includeAll','include','find','catch','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','isValidChannel','channel','Sequelize','ValidationError','toLowerCase','Queue','capitalize','Queues','addQueues','Unknown\x20channel','add','removeQueues','remove'];(function(_0x7b1ccd,_0x103dcd){var _0x39e4db=function(_0x35e0e0){while(--_0x35e0e0){_0x7b1ccd['push'](_0x7b1ccd['shift']());}};_0x39e4db(++_0x103dcd);}(_0xfc31,0x121));var _0x1fc3=function(_0x545080,_0xfd4833){_0x545080=_0x545080-0x0;var _0x15e0ea=_0xfc31[_0x545080];return _0x15e0ea;};'use strict';var emlformat=require(_0x1fc3('0x0'));var rimraf=require(_0x1fc3('0x1'));var zipdir=require(_0x1fc3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1fc3('0x3'));var moment=require('moment');var BPromise=require(_0x1fc3('0x4'));var Mustache=require('mustache');var util=require(_0x1fc3('0x5'));var path=require('path');var sox=require(_0x1fc3('0x6'));var csv=require(_0x1fc3('0x7'));var ejs=require(_0x1fc3('0x8'));var fs=require('fs');var fs_extra=require(_0x1fc3('0x9'));var _=require(_0x1fc3('0xa'));var squel=require(_0x1fc3('0xb'));var crypto=require(_0x1fc3('0xc'));var jsforce=require(_0x1fc3('0xd'));var deskjs=require(_0x1fc3('0xe'));var toCsv=require(_0x1fc3('0x7'));var querystring=require(_0x1fc3('0xf'));var Papa=require(_0x1fc3('0x10'));var Redis=require(_0x1fc3('0x11'));var authService=require(_0x1fc3('0x12'));var qs=require(_0x1fc3('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1fc3('0x14'));var logger=require(_0x1fc3('0x15'))(_0x1fc3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x1fc3('0x17'));var db=require('../../mysqldb')['db'];config[_0x1fc3('0x18')]=_[_0x1fc3('0x19')](config[_0x1fc3('0x18')],{'host':_0x1fc3('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x46f04d,_0x435df3){_0x435df3=_0x435df3||0xcc;return function(_0x43e861){if(_0x43e861){return _0x46f04d[_0x1fc3('0x1b')](_0x435df3);}return _0x46f04d[_0x1fc3('0x1c')](_0x435df3)['end']();};}function respondWithResult(_0x180650,_0x3ecd4b){_0x3ecd4b=_0x3ecd4b||0xc8;return function(_0x212da0){if(_0x212da0){return _0x180650['status'](_0x3ecd4b)[_0x1fc3('0x1d')](_0x212da0);}};}function respondWithFilteredResult(_0x510058,_0x2b6a39){return function(_0x27aaec){if(_0x27aaec){var _0xf152df=typeof _0x2b6a39[_0x1fc3('0x1e')]===_0x1fc3('0x1f')&&typeof _0x2b6a39[_0x1fc3('0x20')]===_0x1fc3('0x1f');var _0x3a426d=_0x27aaec['count'];var _0x46e66a=_0xf152df?0x0:_0x2b6a39[_0x1fc3('0x1e')];var _0x38693b=_0xf152df?_0x27aaec[_0x1fc3('0x21')]:_0x2b6a39['offset']+_0x2b6a39[_0x1fc3('0x20')];var _0x53cad9;if(_0x38693b>=_0x3a426d){_0x38693b=_0x3a426d;_0x53cad9=0xc8;}else{_0x53cad9=0xce;}_0x510058[_0x1fc3('0x1c')](_0x53cad9);return _0x510058[_0x1fc3('0x22')](_0x1fc3('0x23'),_0x46e66a+'-'+_0x38693b+'/'+_0x3a426d)['json'](_0x27aaec);}return null;};}function patchUpdates(_0x208895){return function(_0x1a4d13){try{jsonpatch['apply'](_0x1a4d13,_0x208895,!![]);}catch(_0x4b9c08){return BPromise['reject'](_0x4b9c08);}return _0x1a4d13[_0x1fc3('0x24')]();};}function saveUpdates(_0x25cf54,_0xef68e2){return function(_0x41984e){if(_0x41984e){return _0x41984e[_0x1fc3('0x25')](_0x25cf54)[_0x1fc3('0x26')](function(_0x1d1eb9){return _0x1d1eb9;});}return null;};}function removeEntity(_0x4ef83e,_0x591b7f){return function(_0x23a18d){if(_0x23a18d){return _0x23a18d['destroy']()['then'](function(){var _0x266aa7=_0x23a18d[_0x1fc3('0x27')]({'plain':!![]});var _0x18fe24=_0x1fc3('0x28');return db[_0x1fc3('0x29')][_0x1fc3('0x2a')]({'where':{'type':_0x18fe24,'resourceId':_0x266aa7['id']}})[_0x1fc3('0x26')](function(){return _0x23a18d;});})[_0x1fc3('0x26')](function(){_0x4ef83e[_0x1fc3('0x1c')](0xcc)[_0x1fc3('0x2b')]();});}};}function handleEntityNotFound(_0x283788,_0x31a7c9){return function(_0x4121df){if(!_0x4121df){_0x283788[_0x1fc3('0x1b')](0x194);}return _0x4121df;};}function handleError(_0x2a0071,_0x506244){_0x506244=_0x506244||0x1f4;return function(_0x3696d2){logger[_0x1fc3('0x2c')](_0x3696d2[_0x1fc3('0x2d')]);if(_0x3696d2['name']){delete _0x3696d2[_0x1fc3('0x2e')];}_0x2a0071['status'](_0x506244)['send'](_0x3696d2);};}exports['index']=function(_0x1c135c,_0x16f0d1){var _0x14b6e7={},_0x1cf07f={},_0x4e776f={'count':0x0,'rows':[]};var _0x292125=_[_0x1fc3('0x2f')](db[_0x1fc3('0x30')]['rawAttributes'],function(_0x236a31){return{'name':_0x236a31[_0x1fc3('0x31')],'type':_0x236a31[_0x1fc3('0x32')][_0x1fc3('0x33')]};});_0x1cf07f[_0x1fc3('0x34')]=_[_0x1fc3('0x2f')](_0x292125,_0x1fc3('0x2e'));_0x1cf07f['query']=_[_0x1fc3('0x35')](_0x1c135c[_0x1fc3('0x36')]);_0x1cf07f[_0x1fc3('0x37')]=_[_0x1fc3('0x38')](_0x1cf07f['model'],_0x1cf07f[_0x1fc3('0x36')]);_0x14b6e7[_0x1fc3('0x39')]=_['intersection'](_0x1cf07f['model'],qs[_0x1fc3('0x3a')](_0x1c135c['query'][_0x1fc3('0x3a')]));_0x14b6e7[_0x1fc3('0x39')]=_0x14b6e7[_0x1fc3('0x39')][_0x1fc3('0x3b')]?_0x14b6e7[_0x1fc3('0x39')]:_0x1cf07f['model'];if(!_0x1c135c['query']['hasOwnProperty'](_0x1fc3('0x3c'))){_0x14b6e7['limit']=qs['limit'](_0x1c135c[_0x1fc3('0x36')][_0x1fc3('0x20')]);_0x14b6e7[_0x1fc3('0x1e')]=qs['offset'](_0x1c135c[_0x1fc3('0x36')][_0x1fc3('0x1e')]);}_0x14b6e7[_0x1fc3('0x3d')]=qs[_0x1fc3('0x3e')](_0x1c135c[_0x1fc3('0x36')]['sort']);_0x14b6e7['where']=qs[_0x1fc3('0x37')](_[_0x1fc3('0x3f')](_0x1c135c[_0x1fc3('0x36')],_0x1cf07f[_0x1fc3('0x37')]),_0x292125);if(_0x1c135c[_0x1fc3('0x36')][_0x1fc3('0x40')]){_0x14b6e7[_0x1fc3('0x41')]=_['merge'](_0x14b6e7[_0x1fc3('0x41')],{'$or':_[_0x1fc3('0x2f')](_0x292125,function(_0x57af46){if(_0x57af46[_0x1fc3('0x32')]!==_0x1fc3('0x42')){var _0x2028c1={};_0x2028c1[_0x57af46[_0x1fc3('0x2e')]]={'$like':'%'+_0x1c135c['query']['filter']+'%'};return _0x2028c1;}})});}_0x14b6e7=_[_0x1fc3('0x43')]({},_0x14b6e7,_0x1c135c[_0x1fc3('0x44')]);var _0x4e56d9={'where':_0x14b6e7[_0x1fc3('0x41')]};return db[_0x1fc3('0x30')][_0x1fc3('0x21')](_0x4e56d9)[_0x1fc3('0x26')](function(_0x3c997b){_0x4e776f[_0x1fc3('0x21')]=_0x3c997b;if(_0x1c135c[_0x1fc3('0x36')]['includeAll']){_0x14b6e7['include']=[{'all':!![]}];}return db[_0x1fc3('0x30')][_0x1fc3('0x45')](_0x14b6e7);})[_0x1fc3('0x26')](function(_0xeb80a6){_0x4e776f[_0x1fc3('0x46')]=_0xeb80a6;return _0x4e776f;})[_0x1fc3('0x26')](respondWithFilteredResult(_0x16f0d1,_0x14b6e7))['catch'](handleError(_0x16f0d1,null));};exports[_0x1fc3('0x47')]=function(_0x52bf42,_0x3fed4f){var _0x3602ff={'raw':![],'where':{'id':_0x52bf42['params']['id']}},_0x53709f={};_0x53709f[_0x1fc3('0x34')]=_[_0x1fc3('0x35')](db[_0x1fc3('0x30')][_0x1fc3('0x48')]);_0x53709f[_0x1fc3('0x36')]=_[_0x1fc3('0x35')](_0x52bf42[_0x1fc3('0x36')]);_0x53709f[_0x1fc3('0x37')]=_[_0x1fc3('0x38')](_0x53709f[_0x1fc3('0x34')],_0x53709f[_0x1fc3('0x36')]);_0x3602ff[_0x1fc3('0x39')]=_['intersection'](_0x53709f['model'],qs['fields'](_0x52bf42['query']['fields']));_0x3602ff[_0x1fc3('0x39')]=_0x3602ff['attributes'][_0x1fc3('0x3b')]?_0x3602ff[_0x1fc3('0x39')]:_0x53709f[_0x1fc3('0x34')];if(_0x52bf42['query'][_0x1fc3('0x49')]){_0x3602ff[_0x1fc3('0x4a')]=[{'all':!![]}];}_0x3602ff=_['merge']({},_0x3602ff,_0x52bf42['options']);return db[_0x1fc3('0x30')][_0x1fc3('0x4b')](_0x3602ff)[_0x1fc3('0x26')](handleEntityNotFound(_0x3fed4f,null))['then'](respondWithResult(_0x3fed4f,null))[_0x1fc3('0x4c')](handleError(_0x3fed4f,null));};exports[_0x1fc3('0x4d')]=function(_0x1473d0,_0x13945a){return db['Team'][_0x1fc3('0x4d')](_0x1473d0[_0x1fc3('0x4e')],{})[_0x1fc3('0x26')](function(_0x284e9d){var _0x6147b1=_0x1473d0['user'][_0x1fc3('0x27')]({'plain':!![]});if(!_0x6147b1)throw new Error(_0x1fc3('0x4f'));if(_0x6147b1['role']===_0x1fc3('0x50')){var _0x519fba=_0x284e9d[_0x1fc3('0x27')]({'plain':!![]});var _0x506c55='Teams';return db['UserProfileSection'][_0x1fc3('0x4b')]({'where':{'name':_0x506c55,'userProfileId':_0x6147b1['userProfileId']},'raw':!![]})[_0x1fc3('0x26')](function(_0x58d2f0){if(_0x58d2f0&&_0x58d2f0[_0x1fc3('0x51')]===0x0){return db[_0x1fc3('0x29')][_0x1fc3('0x4d')]({'name':_0x519fba[_0x1fc3('0x2e')],'resourceId':_0x519fba['id'],'type':_0x58d2f0[_0x1fc3('0x2e')],'sectionId':_0x58d2f0['id']},{})['then'](function(){return _0x284e9d;});}else{return _0x284e9d;}})[_0x1fc3('0x4c')](function(_0x4fc62e){logger[_0x1fc3('0x2c')](_0x1fc3('0x52'),_0x4fc62e);throw _0x4fc62e;});}return _0x284e9d;})[_0x1fc3('0x26')](respondWithResult(_0x13945a,0xc9))[_0x1fc3('0x4c')](handleError(_0x13945a,null));};exports['update']=function(_0x15989e,_0x360f72){if(_0x15989e[_0x1fc3('0x4e')]['id']){delete _0x15989e[_0x1fc3('0x4e')]['id'];}return db[_0x1fc3('0x30')]['find']({'where':{'id':_0x15989e[_0x1fc3('0x53')]['id']}})[_0x1fc3('0x26')](handleEntityNotFound(_0x360f72,null))[_0x1fc3('0x26')](saveUpdates(_0x15989e[_0x1fc3('0x4e')],null))[_0x1fc3('0x26')](respondWithResult(_0x360f72,null))['catch'](handleError(_0x360f72,null));};exports['destroy']=function(_0x1812b9,_0x204798){return db['Team']['find']({'where':{'id':_0x1812b9['params']['id']}})[_0x1fc3('0x26')](handleEntityNotFound(_0x204798,null))[_0x1fc3('0x26')](removeEntity(_0x204798,null))[_0x1fc3('0x4c')](handleError(_0x204798,null));};exports[_0x1fc3('0x54')]=function(_0x564807,_0x3c8332,_0xb3af62){return db[_0x1fc3('0x30')]['findOne']({'where':{'id':_0x564807['params']['id']}})[_0x1fc3('0x26')](handleEntityNotFound(_0x3c8332,null))['then'](function(_0x47c577){if(!_0x564807['query']['channel']||!utils[_0x1fc3('0x55')](_0x564807[_0x1fc3('0x36')][_0x1fc3('0x56')])){throw new db[(_0x1fc3('0x57'))][(_0x1fc3('0x58'))]('Unknown\x20channel');}var _0x231d86={};var _0x198f22={};_0x198f22['model']=_[_0x1fc3('0x35')](db[_['capitalize'](_0x564807[_0x1fc3('0x36')][_0x1fc3('0x56')][_0x1fc3('0x59')]())+_0x1fc3('0x5a')][_0x1fc3('0x48')]);_0x198f22[_0x1fc3('0x36')]=_[_0x1fc3('0x35')](_0x564807['query']);_0x198f22[_0x1fc3('0x37')]=_['intersection'](_0x198f22['model'],_0x198f22[_0x1fc3('0x36')]);_0x231d86['attributes']=_[_0x1fc3('0x38')](_0x198f22[_0x1fc3('0x34')],qs[_0x1fc3('0x3a')](_0x564807[_0x1fc3('0x36')][_0x1fc3('0x3a')]));_0x231d86['attributes']=_0x231d86[_0x1fc3('0x39')]['length']?_0x231d86[_0x1fc3('0x39')]:_0x198f22[_0x1fc3('0x34')];_0x231d86[_0x1fc3('0x20')]=qs[_0x1fc3('0x20')](_0x564807[_0x1fc3('0x36')][_0x1fc3('0x20')]);_0x231d86['offset']=qs[_0x1fc3('0x1e')](_0x564807[_0x1fc3('0x36')][_0x1fc3('0x1e')]);_0x231d86['order']=qs['sort'](_0x564807[_0x1fc3('0x36')][_0x1fc3('0x3e')]);_0x231d86[_0x1fc3('0x41')]=qs[_0x1fc3('0x37')](_[_0x1fc3('0x3f')](_0x564807[_0x1fc3('0x36')],_0x198f22[_0x1fc3('0x37')]));_0x231d86=_[_0x1fc3('0x43')]({},_0x231d86,_0x564807['options']);return _0x47c577[_0x1fc3('0x27')+_[_0x1fc3('0x5b')](_0x564807['query'][_0x1fc3('0x56')][_0x1fc3('0x59')]())+_0x1fc3('0x5c')](_0x231d86);})[_0x1fc3('0x26')](respondWithResult(_0x3c8332,null))[_0x1fc3('0x4c')](handleError(_0x3c8332,null));};exports[_0x1fc3('0x5d')]=function(_0x2e83df,_0x13dd39,_0x4a6d1b){return db[_0x1fc3('0x30')]['findOne']({'where':{'id':_0x2e83df[_0x1fc3('0x53')]['id']}})[_0x1fc3('0x26')](function(_0x2030f3){if(_0x2030f3){if(!_0x2e83df[_0x1fc3('0x4e')][_0x1fc3('0x56')]||!utils[_0x1fc3('0x55')](_0x2e83df[_0x1fc3('0x4e')][_0x1fc3('0x56')])){throw new db[(_0x1fc3('0x57'))][(_0x1fc3('0x58'))](_0x1fc3('0x5e'));}return _0x2030f3[_0x1fc3('0x5f')+_[_0x1fc3('0x5b')](_0x2e83df[_0x1fc3('0x4e')][_0x1fc3('0x56')][_0x1fc3('0x59')]())+_0x1fc3('0x5c')](_0x2e83df['body']['ids']);}return null;})[_0x1fc3('0x26')](handleEntityNotFound(_0x13dd39,null))['then'](respondWithStatusCode(_0x13dd39,null))[_0x1fc3('0x4c')](handleError(_0x13dd39,null));};exports[_0x1fc3('0x60')]=function(_0x11a1ff,_0x386c64,_0x56a578){return db[_0x1fc3('0x30')]['findOne']({'where':{'id':_0x11a1ff[_0x1fc3('0x53')]['id']}})['then'](function(_0x917109){if(_0x917109){if(!_0x11a1ff[_0x1fc3('0x36')][_0x1fc3('0x56')]||!utils['isValidChannel'](_0x11a1ff[_0x1fc3('0x36')][_0x1fc3('0x56')])){throw new db['Sequelize']['ValidationError'](_0x1fc3('0x5e'));}return _0x917109[_0x1fc3('0x61')+_[_0x1fc3('0x5b')](_0x11a1ff[_0x1fc3('0x36')]['channel'][_0x1fc3('0x59')]())+_0x1fc3('0x5c')](_0x11a1ff['query'][_0x1fc3('0x62')]);}return null;})[_0x1fc3('0x26')](handleEntityNotFound(_0x386c64,null))[_0x1fc3('0x26')](respondWithStatusCode(_0x386c64,null))[_0x1fc3('0x4c')](handleError(_0x386c64,null));};exports[_0x1fc3('0x63')]=function(_0x15c60c,_0xfec122){return db['Team'][_0x1fc3('0x4b')]({'where':{'id':_0x15c60c[_0x1fc3('0x53')]['id']}})[_0x1fc3('0x26')](handleEntityNotFound(_0xfec122,null))[_0x1fc3('0x26')](function(_0x4c7a38){if(_0x4c7a38){var _0xcd5c70=[_0x1fc3('0x64'),_0x1fc3('0x65'),'Mail',_0x1fc3('0x66'),_0x1fc3('0x67'),_0x1fc3('0x68'),_0x1fc3('0x69')];return db[_0x1fc3('0x6a')][_0x1fc3('0x6b')](function(_0x2579a9){var _0x23c1db=_['map'](_0xcd5c70,function(_0x37d939){var _0x2cac83={'attributes':['id',_0x1fc3('0x2e')]};if(_0x37d939===_0x1fc3('0x64')){_0x2cac83[_0x1fc3('0x6c')]={'attributes':['penalty']};}return _0x4c7a38['get'+_0x37d939+_0x1fc3('0x5c')](_0x2cac83)[_0x1fc3('0x26')](function(_0x420bd2){var _0x201de9=_[_0x1fc3('0x2f')](_0x420bd2,function(_0x487b21){var _0x5a48c4=_[_0x1fc3('0x2f')](_0x15c60c[_0x1fc3('0x4e')][_0x1fc3('0x62')],function(_0x1854da){var _0xce1565={'where':{'UserId':_0x1854da,[_0x37d939+'QueueId']:_0x487b21['id']},'transaction':_0x2579a9};if(_0x37d939===_0x1fc3('0x64')){_0xce1565[_0x1fc3('0x19')]={'penalty':_0x487b21[_0x1fc3('0x6d')][_0x1fc3('0x6e')]};}return db['User'+_0x37d939+_0x1fc3('0x5a')][_0x1fc3('0x6f')](_0xce1565)[_0x1fc3('0x26')](function(){socket[_0x1fc3('0x70')]('user'+_0x37d939+'Queue:save',{'UserId':_0x1854da,[_0x37d939+'QueueId']:_0x487b21['id']});if(_0x37d939!=='Voice')return;return db[_0x1fc3('0x71')]['findAll']({'where':{'id':_0x15c60c[_0x1fc3('0x4e')][_0x1fc3('0x62')],'online':0x1},'attributes':['id',_0x1fc3('0x2e'),_0x1fc3('0x72'),_0x1fc3('0x73'),_0x1fc3('0x74')],'raw':!![]})[_0x1fc3('0x26')](function(_0x10eea0){var _0x5d6a26=_[_0x1fc3('0x2f')](_0x10eea0,function(_0x50b86c){return db[_0x1fc3('0x75')]['upsert']({'membername':_0x50b86c['name'],'UserId':_0x50b86c['id'],'queue_name':_0x487b21[_0x1fc3('0x2e')],'VoiceQueueId':_0x487b21['id'],'interface':_[_0x1fc3('0x76')](_0x50b86c[_0x1fc3('0x74')])?util['format'](_0x1fc3('0x77'),_0x50b86c[_0x1fc3('0x2e')]):_0x50b86c[_0x1fc3('0x74')],'paused':_0x50b86c[_0x1fc3('0x73')]||![],'penalty':_0x487b21[_0x1fc3('0x6d')]['penalty']},{'transaction':_0x2579a9});});return Promise[_0x1fc3('0x78')](_0x5d6a26);});});});return Promise['all'](_0x5a48c4);});return Promise[_0x1fc3('0x78')](_0x201de9);});});return Promise['all'](_0x23c1db)[_0x1fc3('0x26')](function(){return _0x4c7a38[_0x1fc3('0x63')](_0x15c60c[_0x1fc3('0x4e')][_0x1fc3('0x62')],{'transaction':_0x2579a9})[_0x1fc3('0x79')](function(_0x26abc4){return _0x26abc4;});});});}})[_0x1fc3('0x26')](respondWithResult(_0xfec122,null))[_0x1fc3('0x4c')](handleError(_0xfec122,null));};exports[_0x1fc3('0x7a')]=function(_0x4add8d,_0x3807fc){return db[_0x1fc3('0x30')][_0x1fc3('0x4b')]({'where':{'id':_0x4add8d[_0x1fc3('0x53')]['id']}})[_0x1fc3('0x26')](handleEntityNotFound(_0x3807fc,null))['then'](function(_0x267425){if(_0x267425){var _0x5e1bb5=[_0x1fc3('0x64'),'Chat',_0x1fc3('0x7b'),'Sms',_0x1fc3('0x67'),_0x1fc3('0x68'),_0x1fc3('0x69')];return db[_0x1fc3('0x6a')][_0x1fc3('0x6b')](function(_0x487819){var _0x320b47=_[_0x1fc3('0x2f')](_0x5e1bb5,function(_0x49b339){var _0xe56a29={'attributes':['id','name']};return _0x267425[_0x1fc3('0x27')+_0x49b339+'Queues'](_0xe56a29)[_0x1fc3('0x26')](function(_0x32375c){var _0x962b80=_[_0x1fc3('0x2f')](_0x32375c,function(_0x59f2a7){return _0x59f2a7[_0x1fc3('0x7a')](_0x4add8d[_0x1fc3('0x36')][_0x1fc3('0x62')],{'transaction':_0x487819})[_0x1fc3('0x26')](function(){var _0x28f9d3=JSON[_0x1fc3('0x7c')]('['+_0x4add8d[_0x1fc3('0x36')]['ids']+']');var _0x1f788f=_[_0x1fc3('0x2f')](_0x28f9d3,function(_0x37eebe){socket['emit']('user'+_0x49b339+_0x1fc3('0x7d'),{'UserId':Number(_0x37eebe),[_0x49b339+'QueueId']:_0x59f2a7['id']});if(_0x49b339!=='Voice')return;return db['UserVoiceQueueRt'][_0x1fc3('0x2a')]({'where':{'VoiceQueueId':_0x59f2a7['id'],'UserId':_0x37eebe},'transaction':_0x487819});});return Promise[_0x1fc3('0x78')](_0x1f788f);});});return Promise[_0x1fc3('0x78')](_0x962b80);});});return Promise[_0x1fc3('0x78')](_0x320b47)['then'](function(){return _0x267425['removeAgents'](_0x4add8d[_0x1fc3('0x36')][_0x1fc3('0x62')],{'transaction':_0x487819});});});}})[_0x1fc3('0x26')](respondWithStatusCode(_0x3807fc,null))[_0x1fc3('0x4c')](handleError(_0x3807fc,null));};exports[_0x1fc3('0x7e')]=function(_0x56056b,_0x34536c,_0x2ba230){var _0x160eff={};var _0x2ddff7={};var _0xd44ec1;var _0x4b2a81;return db[_0x1fc3('0x30')][_0x1fc3('0x7f')]({'where':{'id':_0x56056b['params']['id']}})[_0x1fc3('0x26')](handleEntityNotFound(_0x34536c,null))[_0x1fc3('0x26')](function(_0x5ab742){if(_0x5ab742){_0xd44ec1=_0x5ab742;_0x2ddff7[_0x1fc3('0x34')]=_[_0x1fc3('0x35')](db[_0x1fc3('0x71')][_0x1fc3('0x48')]);_0x2ddff7['query']=_['keys'](_0x56056b[_0x1fc3('0x36')]);_0x2ddff7[_0x1fc3('0x37')]=_[_0x1fc3('0x38')](_0x2ddff7['model'],_0x2ddff7[_0x1fc3('0x36')]);_0x160eff[_0x1fc3('0x39')]=_['intersection'](_0x2ddff7[_0x1fc3('0x34')],qs[_0x1fc3('0x3a')](_0x56056b[_0x1fc3('0x36')][_0x1fc3('0x3a')]));_0x160eff[_0x1fc3('0x39')]=_0x160eff[_0x1fc3('0x39')][_0x1fc3('0x3b')]?_0x160eff['attributes']:_0x2ddff7['model'];_0x160eff[_0x1fc3('0x3d')]=qs['sort'](_0x56056b[_0x1fc3('0x36')][_0x1fc3('0x3e')]);_0x160eff['where']=qs[_0x1fc3('0x37')](_[_0x1fc3('0x3f')](_0x56056b[_0x1fc3('0x36')],_0x2ddff7[_0x1fc3('0x37')]));if(_0x56056b[_0x1fc3('0x36')][_0x1fc3('0x40')]){_0x160eff[_0x1fc3('0x41')]=_['merge'](_0x160eff[_0x1fc3('0x41')],{'$or':_['map'](_0x160eff[_0x1fc3('0x39')],function(_0x318819){var _0x70081e={};_0x70081e[_0x318819]={'$like':'%'+_0x56056b['query'][_0x1fc3('0x40')]+'%'};return _0x70081e;})});}_0x160eff=_['merge']({},_0x160eff,_0x56056b[_0x1fc3('0x44')]);return _0xd44ec1[_0x1fc3('0x7e')](_0x160eff);}})[_0x1fc3('0x26')](function(_0x1b919f){if(_0x1b919f){_0x4b2a81=_0x1b919f[_0x1fc3('0x3b')];if(!_0x56056b['query'][_0x1fc3('0x80')](_0x1fc3('0x3c'))){_0x160eff[_0x1fc3('0x20')]=qs[_0x1fc3('0x20')](_0x56056b['query'][_0x1fc3('0x20')]);_0x160eff[_0x1fc3('0x1e')]=qs[_0x1fc3('0x1e')](_0x56056b[_0x1fc3('0x36')]['offset']);}return _0xd44ec1[_0x1fc3('0x7e')](_0x160eff);}})['then'](function(_0x7b02f){if(_0x7b02f){return _0x7b02f?{'count':_0x4b2a81,'rows':_0x7b02f}:null;}})['then'](respondWithResult(_0x34536c,null))[_0x1fc3('0x4c')](handleError(_0x34536c,null));}; \ No newline at end of file +var _0xb784=['api','../../config/license/util','redis','defaults','localhost','socket.io-emitter','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','Teams','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','nolimit','order','sort','where','merge','VIRTUAL','filter','options','Team','includeAll','include','findAll','rows','catch','show','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','getQueues','findOne','Sequelize','ValidationError','channel','toLowerCase','Queue','pick','addQueues','isValidChannel','Unknown\x20channel','add','capitalize','ids','remove','Queues','addAgents','Chat','Sms','Openchannel','Whatsapp','sequelize','Voice','through','QueueId','TeamVoiceQueue','penalty','User','online','voicePause','interface','upsert','isNil','format','SIP/%s','all','removeAgents','Mail','Fax','parse','emit','Queue:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../config/logger'];(function(_0x22e75f,_0x255868){var _0x35c241=function(_0x2696be){while(--_0x2696be){_0x22e75f['push'](_0x22e75f['shift']());}};_0x35c241(++_0x255868);}(_0xb784,0x16d));var _0x4b78=function(_0x1c667e,_0x2600fa){_0x1c667e=_0x1c667e-0x0;var _0x1e4639=_0xb784[_0x1c667e];return _0x1e4639;};'use strict';var emlformat=require(_0x4b78('0x0'));var rimraf=require(_0x4b78('0x1'));var zipdir=require(_0x4b78('0x2'));var jsonpatch=require(_0x4b78('0x3'));var rp=require(_0x4b78('0x4'));var moment=require(_0x4b78('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x4b78('0x6'));var util=require(_0x4b78('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x4b78('0x8'));var ejs=require(_0x4b78('0x9'));var fs=require('fs');var fs_extra=require(_0x4b78('0xa'));var _=require(_0x4b78('0xb'));var squel=require(_0x4b78('0xc'));var crypto=require(_0x4b78('0xd'));var jsforce=require(_0x4b78('0xe'));var deskjs=require(_0x4b78('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4b78('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x4b78('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x4b78('0x12'))(_0x4b78('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x4b78('0x14'));var db=require('../../mysqldb')['db'];config[_0x4b78('0x15')]=_[_0x4b78('0x16')](config[_0x4b78('0x15')],{'host':_0x4b78('0x17'),'port':0x18eb});var socket=require(_0x4b78('0x18'))(new Redis(config[_0x4b78('0x15')]));require('./team.socket')['register'](socket);function respondWithStatusCode(_0x31103e,_0x3ea5f6){_0x3ea5f6=_0x3ea5f6||0xcc;return function(_0x245eb8){if(_0x245eb8){return _0x31103e['sendStatus'](_0x3ea5f6);}return _0x31103e['status'](_0x3ea5f6)[_0x4b78('0x19')]();};}function respondWithResult(_0x444288,_0x1be8eb){_0x1be8eb=_0x1be8eb||0xc8;return function(_0x1b32d9){if(_0x1b32d9){return _0x444288[_0x4b78('0x1a')](_0x1be8eb)[_0x4b78('0x1b')](_0x1b32d9);}};}function respondWithFilteredResult(_0x2103e4,_0x2e6180){return function(_0x6a0233){if(_0x6a0233){var _0x5db05e=typeof _0x2e6180[_0x4b78('0x1c')]===_0x4b78('0x1d')&&typeof _0x2e6180['limit']===_0x4b78('0x1d');var _0x5796e9=_0x6a0233[_0x4b78('0x1e')];var _0x5c1c79=_0x5db05e?0x0:_0x2e6180['offset'];var _0x4a07a2=_0x5db05e?_0x6a0233['count']:_0x2e6180[_0x4b78('0x1c')]+_0x2e6180[_0x4b78('0x1f')];var _0x790842;if(_0x4a07a2>=_0x5796e9){_0x4a07a2=_0x5796e9;_0x790842=0xc8;}else{_0x790842=0xce;}_0x2103e4[_0x4b78('0x1a')](_0x790842);return _0x2103e4[_0x4b78('0x20')](_0x4b78('0x21'),_0x5c1c79+'-'+_0x4a07a2+'/'+_0x5796e9)[_0x4b78('0x1b')](_0x6a0233);}return null;};}function patchUpdates(_0xf02e58){return function(_0x24ef10){try{jsonpatch[_0x4b78('0x22')](_0x24ef10,_0xf02e58,!![]);}catch(_0x5c2438){return BPromise[_0x4b78('0x23')](_0x5c2438);}return _0x24ef10[_0x4b78('0x24')]();};}function saveUpdates(_0x306ef1,_0x16380a){return function(_0x151964){if(_0x151964){return _0x151964[_0x4b78('0x25')](_0x306ef1)[_0x4b78('0x26')](function(_0xb9c1e5){return _0xb9c1e5;});}return null;};}function removeEntity(_0x41ac33,_0x5c8d87){return function(_0x1df252){if(_0x1df252){return _0x1df252['destroy']()[_0x4b78('0x26')](function(){var _0x14d545=_0x1df252[_0x4b78('0x27')]({'plain':!![]});var _0x429a8f=_0x4b78('0x28');return db[_0x4b78('0x29')][_0x4b78('0x2a')]({'where':{'type':_0x429a8f,'resourceId':_0x14d545['id']}})[_0x4b78('0x26')](function(){return _0x1df252;});})[_0x4b78('0x26')](function(){_0x41ac33[_0x4b78('0x1a')](0xcc)[_0x4b78('0x19')]();});}};}function handleEntityNotFound(_0x41e430,_0x3ebadf){return function(_0x3f8b4c){if(!_0x3f8b4c){_0x41e430[_0x4b78('0x2b')](0x194);}return _0x3f8b4c;};}function handleError(_0x45c08b,_0x51108d){_0x51108d=_0x51108d||0x1f4;return function(_0x2f5191){logger[_0x4b78('0x2c')](_0x2f5191[_0x4b78('0x2d')]);if(_0x2f5191['name']){delete _0x2f5191[_0x4b78('0x2e')];}_0x45c08b[_0x4b78('0x1a')](_0x51108d)[_0x4b78('0x2f')](_0x2f5191);};}exports[_0x4b78('0x30')]=function(_0x18e810,_0x2b2be1){var _0x2fe367={},_0x2971f8={},_0x1b70b5={'count':0x0,'rows':[]};var _0x42e2ab=_[_0x4b78('0x31')](db['Team']['rawAttributes'],function(_0xa5eaf8){return{'name':_0xa5eaf8[_0x4b78('0x32')],'type':_0xa5eaf8[_0x4b78('0x33')][_0x4b78('0x34')]};});_0x2971f8[_0x4b78('0x35')]=_[_0x4b78('0x31')](_0x42e2ab,_0x4b78('0x2e'));_0x2971f8[_0x4b78('0x36')]=_[_0x4b78('0x37')](_0x18e810[_0x4b78('0x36')]);_0x2971f8[_0x4b78('0x38')]=_[_0x4b78('0x39')](_0x2971f8[_0x4b78('0x35')],_0x2971f8[_0x4b78('0x36')]);_0x2fe367[_0x4b78('0x3a')]=_[_0x4b78('0x39')](_0x2971f8[_0x4b78('0x35')],qs[_0x4b78('0x3b')](_0x18e810[_0x4b78('0x36')][_0x4b78('0x3b')]));_0x2fe367[_0x4b78('0x3a')]=_0x2fe367[_0x4b78('0x3a')]['length']?_0x2fe367[_0x4b78('0x3a')]:_0x2971f8['model'];if(!_0x18e810[_0x4b78('0x36')]['hasOwnProperty'](_0x4b78('0x3c'))){_0x2fe367[_0x4b78('0x1f')]=qs[_0x4b78('0x1f')](_0x18e810[_0x4b78('0x36')][_0x4b78('0x1f')]);_0x2fe367[_0x4b78('0x1c')]=qs[_0x4b78('0x1c')](_0x18e810[_0x4b78('0x36')][_0x4b78('0x1c')]);}_0x2fe367[_0x4b78('0x3d')]=qs[_0x4b78('0x3e')](_0x18e810['query']['sort']);_0x2fe367['where']=qs[_0x4b78('0x38')](_['pick'](_0x18e810[_0x4b78('0x36')],_0x2971f8['filters']),_0x42e2ab);if(_0x18e810['query']['filter']){_0x2fe367[_0x4b78('0x3f')]=_[_0x4b78('0x40')](_0x2fe367[_0x4b78('0x3f')],{'$or':_[_0x4b78('0x31')](_0x42e2ab,function(_0x3b190f){if(_0x3b190f[_0x4b78('0x33')]!==_0x4b78('0x41')){var _0x23c5f1={};_0x23c5f1[_0x3b190f[_0x4b78('0x2e')]]={'$like':'%'+_0x18e810['query'][_0x4b78('0x42')]+'%'};return _0x23c5f1;}})});}_0x2fe367=_[_0x4b78('0x40')]({},_0x2fe367,_0x18e810[_0x4b78('0x43')]);var _0x3b6f6b={'where':_0x2fe367[_0x4b78('0x3f')]};return db[_0x4b78('0x44')][_0x4b78('0x1e')](_0x3b6f6b)[_0x4b78('0x26')](function(_0x18f541){_0x1b70b5['count']=_0x18f541;if(_0x18e810['query'][_0x4b78('0x45')]){_0x2fe367[_0x4b78('0x46')]=[{'all':!![]}];}return db['Team'][_0x4b78('0x47')](_0x2fe367);})['then'](function(_0x1ceda7){_0x1b70b5[_0x4b78('0x48')]=_0x1ceda7;return _0x1b70b5;})['then'](respondWithFilteredResult(_0x2b2be1,_0x2fe367))[_0x4b78('0x49')](handleError(_0x2b2be1,null));};exports[_0x4b78('0x4a')]=function(_0x4b06fd,_0x2e6143){var _0x7f6dfc={'raw':![],'where':{'id':_0x4b06fd['params']['id']}},_0x534eef={};_0x534eef[_0x4b78('0x35')]=_[_0x4b78('0x37')](db[_0x4b78('0x44')][_0x4b78('0x4b')]);_0x534eef[_0x4b78('0x36')]=_['keys'](_0x4b06fd[_0x4b78('0x36')]);_0x534eef['filters']=_[_0x4b78('0x39')](_0x534eef[_0x4b78('0x35')],_0x534eef[_0x4b78('0x36')]);_0x7f6dfc[_0x4b78('0x3a')]=_[_0x4b78('0x39')](_0x534eef[_0x4b78('0x35')],qs[_0x4b78('0x3b')](_0x4b06fd['query'][_0x4b78('0x3b')]));_0x7f6dfc[_0x4b78('0x3a')]=_0x7f6dfc[_0x4b78('0x3a')][_0x4b78('0x4c')]?_0x7f6dfc[_0x4b78('0x3a')]:_0x534eef[_0x4b78('0x35')];if(_0x4b06fd['query'][_0x4b78('0x45')]){_0x7f6dfc['include']=[{'all':!![]}];}_0x7f6dfc=_[_0x4b78('0x40')]({},_0x7f6dfc,_0x4b06fd[_0x4b78('0x43')]);return db[_0x4b78('0x44')][_0x4b78('0x4d')](_0x7f6dfc)[_0x4b78('0x26')](handleEntityNotFound(_0x2e6143,null))[_0x4b78('0x26')](respondWithResult(_0x2e6143,null))[_0x4b78('0x49')](handleError(_0x2e6143,null));};exports[_0x4b78('0x4e')]=function(_0x2ecf7e,_0x314b05){return db[_0x4b78('0x44')]['create'](_0x2ecf7e[_0x4b78('0x4f')],{})[_0x4b78('0x26')](function(_0x443be4){var _0x72ce56=_0x2ecf7e[_0x4b78('0x50')][_0x4b78('0x27')]({'plain':!![]});if(!_0x72ce56)throw new Error(_0x4b78('0x51'));if(_0x72ce56[_0x4b78('0x52')]===_0x4b78('0x50')){var _0x2c33b5=_0x443be4[_0x4b78('0x27')]({'plain':!![]});var _0x4e3ae7=_0x4b78('0x28');return db['UserProfileSection']['find']({'where':{'name':_0x4e3ae7,'userProfileId':_0x72ce56['userProfileId']},'raw':!![]})[_0x4b78('0x26')](function(_0x170f88){if(_0x170f88&&_0x170f88['autoAssociation']===0x0){return db[_0x4b78('0x29')]['create']({'name':_0x2c33b5[_0x4b78('0x2e')],'resourceId':_0x2c33b5['id'],'type':_0x170f88['name'],'sectionId':_0x170f88['id']},{})[_0x4b78('0x26')](function(){return _0x443be4;});}else{return _0x443be4;}})[_0x4b78('0x49')](function(_0x110223){logger[_0x4b78('0x2c')](_0x4b78('0x53'),_0x110223);throw _0x110223;});}return _0x443be4;})[_0x4b78('0x26')](respondWithResult(_0x314b05,0xc9))[_0x4b78('0x49')](handleError(_0x314b05,null));};exports['update']=function(_0x21d931,_0x747c8e){if(_0x21d931['body']['id']){delete _0x21d931[_0x4b78('0x4f')]['id'];}return db['Team'][_0x4b78('0x4d')]({'where':{'id':_0x21d931[_0x4b78('0x54')]['id']}})['then'](handleEntityNotFound(_0x747c8e,null))[_0x4b78('0x26')](saveUpdates(_0x21d931[_0x4b78('0x4f')],null))[_0x4b78('0x26')](respondWithResult(_0x747c8e,null))[_0x4b78('0x49')](handleError(_0x747c8e,null));};exports[_0x4b78('0x2a')]=function(_0x4266c2,_0x575cb5){return db['Team']['find']({'where':{'id':_0x4266c2[_0x4b78('0x54')]['id']}})[_0x4b78('0x26')](handleEntityNotFound(_0x575cb5,null))[_0x4b78('0x26')](removeEntity(_0x575cb5,null))['catch'](handleError(_0x575cb5,null));};exports[_0x4b78('0x55')]=function(_0x4d91d6,_0x5be6b1,_0x5b33bd){return db[_0x4b78('0x44')][_0x4b78('0x56')]({'where':{'id':_0x4d91d6['params']['id']}})[_0x4b78('0x26')](handleEntityNotFound(_0x5be6b1,null))['then'](function(_0x2025f9){if(!_0x4d91d6[_0x4b78('0x36')]['channel']||!utils['isValidChannel'](_0x4d91d6[_0x4b78('0x36')]['channel'])){throw new db[(_0x4b78('0x57'))][(_0x4b78('0x58'))]('Unknown\x20channel');}var _0x3e2b63={};var _0xa693d5={};_0xa693d5[_0x4b78('0x35')]=_['keys'](db[_['capitalize'](_0x4d91d6[_0x4b78('0x36')][_0x4b78('0x59')][_0x4b78('0x5a')]())+_0x4b78('0x5b')]['rawAttributes']);_0xa693d5[_0x4b78('0x36')]=_[_0x4b78('0x37')](_0x4d91d6[_0x4b78('0x36')]);_0xa693d5[_0x4b78('0x38')]=_[_0x4b78('0x39')](_0xa693d5[_0x4b78('0x35')],_0xa693d5[_0x4b78('0x36')]);_0x3e2b63[_0x4b78('0x3a')]=_[_0x4b78('0x39')](_0xa693d5[_0x4b78('0x35')],qs[_0x4b78('0x3b')](_0x4d91d6[_0x4b78('0x36')][_0x4b78('0x3b')]));_0x3e2b63[_0x4b78('0x3a')]=_0x3e2b63['attributes']['length']?_0x3e2b63[_0x4b78('0x3a')]:_0xa693d5[_0x4b78('0x35')];_0x3e2b63[_0x4b78('0x1f')]=qs[_0x4b78('0x1f')](_0x4d91d6[_0x4b78('0x36')][_0x4b78('0x1f')]);_0x3e2b63[_0x4b78('0x1c')]=qs[_0x4b78('0x1c')](_0x4d91d6['query']['offset']);_0x3e2b63[_0x4b78('0x3d')]=qs[_0x4b78('0x3e')](_0x4d91d6[_0x4b78('0x36')][_0x4b78('0x3e')]);_0x3e2b63['where']=qs[_0x4b78('0x38')](_[_0x4b78('0x5c')](_0x4d91d6[_0x4b78('0x36')],_0xa693d5[_0x4b78('0x38')]));_0x3e2b63=_[_0x4b78('0x40')]({},_0x3e2b63,_0x4d91d6['options']);return _0x2025f9[_0x4b78('0x27')+_['capitalize'](_0x4d91d6[_0x4b78('0x36')]['channel'][_0x4b78('0x5a')]())+'Queues'](_0x3e2b63);})[_0x4b78('0x26')](respondWithResult(_0x5be6b1,null))[_0x4b78('0x49')](handleError(_0x5be6b1,null));};exports[_0x4b78('0x5d')]=function(_0x3537e2,_0xfbde8f,_0xad1486){return db[_0x4b78('0x44')][_0x4b78('0x56')]({'where':{'id':_0x3537e2['params']['id']}})['then'](function(_0x1d9dcc){if(_0x1d9dcc){if(!_0x3537e2[_0x4b78('0x4f')][_0x4b78('0x59')]||!utils[_0x4b78('0x5e')](_0x3537e2[_0x4b78('0x4f')][_0x4b78('0x59')])){throw new db[(_0x4b78('0x57'))][(_0x4b78('0x58'))](_0x4b78('0x5f'));}return _0x1d9dcc[_0x4b78('0x60')+_[_0x4b78('0x61')](_0x3537e2[_0x4b78('0x4f')]['channel']['toLowerCase']())+'Queues'](_0x3537e2[_0x4b78('0x4f')][_0x4b78('0x62')]);}return null;})['then'](handleEntityNotFound(_0xfbde8f,null))[_0x4b78('0x26')](respondWithStatusCode(_0xfbde8f,null))[_0x4b78('0x49')](handleError(_0xfbde8f,null));};exports['removeQueues']=function(_0x26b3e2,_0x1d44b9,_0x375060){return db['Team'][_0x4b78('0x56')]({'where':{'id':_0x26b3e2['params']['id']}})[_0x4b78('0x26')](function(_0x12667f){if(_0x12667f){if(!_0x26b3e2[_0x4b78('0x36')][_0x4b78('0x59')]||!utils[_0x4b78('0x5e')](_0x26b3e2['query'][_0x4b78('0x59')])){throw new db['Sequelize']['ValidationError'](_0x4b78('0x5f'));}return _0x12667f[_0x4b78('0x63')+_[_0x4b78('0x61')](_0x26b3e2['query'][_0x4b78('0x59')]['toLowerCase']())+_0x4b78('0x64')](_0x26b3e2['query'][_0x4b78('0x62')]);}return null;})[_0x4b78('0x26')](handleEntityNotFound(_0x1d44b9,null))[_0x4b78('0x26')](respondWithStatusCode(_0x1d44b9,null))[_0x4b78('0x49')](handleError(_0x1d44b9,null));};exports[_0x4b78('0x65')]=function(_0x33dc28,_0x8a03ff){return db[_0x4b78('0x44')]['find']({'where':{'id':_0x33dc28['params']['id']}})[_0x4b78('0x26')](handleEntityNotFound(_0x8a03ff,null))[_0x4b78('0x26')](function(_0x1617f3){if(_0x1617f3){var _0x5b987e=['Voice',_0x4b78('0x66'),'Mail',_0x4b78('0x67'),'Fax',_0x4b78('0x68'),_0x4b78('0x69')];return db[_0x4b78('0x6a')]['transaction'](function(_0x5b94ea){var _0x17ff1a=_[_0x4b78('0x31')](_0x5b987e,function(_0x4a8bb4){var _0x34dded={'attributes':['id',_0x4b78('0x2e')]};if(_0x4a8bb4===_0x4b78('0x6b')){_0x34dded[_0x4b78('0x6c')]={'attributes':['penalty']};}return _0x1617f3['get'+_0x4a8bb4+_0x4b78('0x64')](_0x34dded)['then'](function(_0x15c23d){var _0x1e6fa3=_[_0x4b78('0x31')](_0x15c23d,function(_0x78b37d){var _0x1ace9c=_['map'](_0x33dc28['body'][_0x4b78('0x62')],function(_0x50f5ba){var _0x44e00c={'where':{'UserId':_0x50f5ba,[_0x4a8bb4+_0x4b78('0x6d')]:_0x78b37d['id']},'transaction':_0x5b94ea};if(_0x4a8bb4===_0x4b78('0x6b')){_0x44e00c['defaults']={'penalty':_0x78b37d[_0x4b78('0x6e')][_0x4b78('0x6f')]};}return db['User'+_0x4a8bb4+'Queue']['findOrCreate'](_0x44e00c)[_0x4b78('0x26')](function(){socket['emit'](_0x4b78('0x50')+_0x4a8bb4+'Queue:save',{'UserId':_0x50f5ba,[_0x4a8bb4+_0x4b78('0x6d')]:_0x78b37d['id']});if(_0x4a8bb4!=='Voice')return;return db[_0x4b78('0x70')][_0x4b78('0x47')]({'where':{'id':_0x33dc28[_0x4b78('0x4f')][_0x4b78('0x62')],'online':0x1},'attributes':['id',_0x4b78('0x2e'),_0x4b78('0x71'),_0x4b78('0x72'),_0x4b78('0x73')],'raw':!![]})[_0x4b78('0x26')](function(_0x3a0a0a){var _0x15f572=_[_0x4b78('0x31')](_0x3a0a0a,function(_0x4afe21){return db['UserVoiceQueueRt'][_0x4b78('0x74')]({'membername':_0x4afe21[_0x4b78('0x2e')],'UserId':_0x4afe21['id'],'queue_name':_0x78b37d['name'],'VoiceQueueId':_0x78b37d['id'],'interface':_[_0x4b78('0x75')](_0x4afe21[_0x4b78('0x73')])?util[_0x4b78('0x76')](_0x4b78('0x77'),_0x4afe21['name']):_0x4afe21['interface'],'paused':_0x4afe21[_0x4b78('0x72')]||![],'penalty':_0x78b37d[_0x4b78('0x6e')][_0x4b78('0x6f')]},{'transaction':_0x5b94ea});});return Promise['all'](_0x15f572);});});});return Promise[_0x4b78('0x78')](_0x1ace9c);});return Promise['all'](_0x1e6fa3);});});return Promise['all'](_0x17ff1a)[_0x4b78('0x26')](function(){return _0x1617f3[_0x4b78('0x65')](_0x33dc28['body'][_0x4b78('0x62')],{'transaction':_0x5b94ea})['spread'](function(_0x2d02be){return _0x2d02be;});});});}})[_0x4b78('0x26')](respondWithResult(_0x8a03ff,null))['catch'](handleError(_0x8a03ff,null));};exports[_0x4b78('0x79')]=function(_0x11b3f9,_0x13ea6a){return db[_0x4b78('0x44')][_0x4b78('0x4d')]({'where':{'id':_0x11b3f9['params']['id']}})[_0x4b78('0x26')](handleEntityNotFound(_0x13ea6a,null))[_0x4b78('0x26')](function(_0x342cde){if(_0x342cde){var _0x17877f=[_0x4b78('0x6b'),_0x4b78('0x66'),_0x4b78('0x7a'),_0x4b78('0x67'),_0x4b78('0x7b'),'Openchannel','Whatsapp'];return db[_0x4b78('0x6a')]['transaction'](function(_0x528b8a){var _0x3f4451=_['map'](_0x17877f,function(_0x1bc860){var _0x4cec06={'attributes':['id','name']};return _0x342cde[_0x4b78('0x27')+_0x1bc860+_0x4b78('0x64')](_0x4cec06)[_0x4b78('0x26')](function(_0x57bf93){var _0x476569=_['map'](_0x57bf93,function(_0x2ad79f){return _0x2ad79f['removeAgents'](_0x11b3f9[_0x4b78('0x36')][_0x4b78('0x62')],{'transaction':_0x528b8a})[_0x4b78('0x26')](function(){var _0x153c9c=JSON[_0x4b78('0x7c')]('['+_0x11b3f9['query']['ids']+']');var _0x165cb4=_[_0x4b78('0x31')](_0x153c9c,function(_0x1124ee){socket[_0x4b78('0x7d')](_0x4b78('0x50')+_0x1bc860+_0x4b78('0x7e'),{'UserId':Number(_0x1124ee),[_0x1bc860+'QueueId']:_0x2ad79f['id']});if(_0x1bc860!==_0x4b78('0x6b'))return;return db['UserVoiceQueueRt'][_0x4b78('0x2a')]({'where':{'VoiceQueueId':_0x2ad79f['id'],'UserId':_0x1124ee},'transaction':_0x528b8a});});return Promise['all'](_0x165cb4);});});return Promise[_0x4b78('0x78')](_0x476569);});});return Promise[_0x4b78('0x78')](_0x3f4451)[_0x4b78('0x26')](function(){return _0x342cde[_0x4b78('0x79')](_0x11b3f9[_0x4b78('0x36')][_0x4b78('0x62')],{'transaction':_0x528b8a});});});}})[_0x4b78('0x26')](respondWithStatusCode(_0x13ea6a,null))[_0x4b78('0x49')](handleError(_0x13ea6a,null));};exports['getAgents']=function(_0xf4d535,_0x1b3645,_0x5b91bd){var _0x2f8613={};var _0x41daac={};var _0x7dfa18;var _0x2cb6a3;return db[_0x4b78('0x44')][_0x4b78('0x56')]({'where':{'id':_0xf4d535[_0x4b78('0x54')]['id']}})[_0x4b78('0x26')](handleEntityNotFound(_0x1b3645,null))['then'](function(_0x45d439){if(_0x45d439){_0x7dfa18=_0x45d439;_0x41daac['model']=_['keys'](db[_0x4b78('0x70')][_0x4b78('0x4b')]);_0x41daac[_0x4b78('0x36')]=_[_0x4b78('0x37')](_0xf4d535[_0x4b78('0x36')]);_0x41daac[_0x4b78('0x38')]=_[_0x4b78('0x39')](_0x41daac['model'],_0x41daac[_0x4b78('0x36')]);_0x2f8613[_0x4b78('0x3a')]=_['intersection'](_0x41daac['model'],qs['fields'](_0xf4d535['query'][_0x4b78('0x3b')]));_0x2f8613['attributes']=_0x2f8613['attributes'][_0x4b78('0x4c')]?_0x2f8613['attributes']:_0x41daac['model'];_0x2f8613[_0x4b78('0x3d')]=qs['sort'](_0xf4d535[_0x4b78('0x36')][_0x4b78('0x3e')]);_0x2f8613[_0x4b78('0x3f')]=qs[_0x4b78('0x38')](_[_0x4b78('0x5c')](_0xf4d535[_0x4b78('0x36')],_0x41daac[_0x4b78('0x38')]));if(_0xf4d535[_0x4b78('0x36')][_0x4b78('0x42')]){_0x2f8613[_0x4b78('0x3f')]=_[_0x4b78('0x40')](_0x2f8613[_0x4b78('0x3f')],{'$or':_[_0x4b78('0x31')](_0x2f8613[_0x4b78('0x3a')],function(_0x2d5823){var _0xe1a6b5={};_0xe1a6b5[_0x2d5823]={'$like':'%'+_0xf4d535[_0x4b78('0x36')][_0x4b78('0x42')]+'%'};return _0xe1a6b5;})});}_0x2f8613=_[_0x4b78('0x40')]({},_0x2f8613,_0xf4d535[_0x4b78('0x43')]);return _0x7dfa18[_0x4b78('0x7f')](_0x2f8613);}})[_0x4b78('0x26')](function(_0x1aeacc){if(_0x1aeacc){_0x2cb6a3=_0x1aeacc[_0x4b78('0x4c')];if(!_0xf4d535[_0x4b78('0x36')]['hasOwnProperty']('nolimit')){_0x2f8613[_0x4b78('0x1f')]=qs[_0x4b78('0x1f')](_0xf4d535[_0x4b78('0x36')][_0x4b78('0x1f')]);_0x2f8613[_0x4b78('0x1c')]=qs['offset'](_0xf4d535['query'][_0x4b78('0x1c')]);}return _0x7dfa18[_0x4b78('0x7f')](_0x2f8613);}})[_0x4b78('0x26')](function(_0x165c8e){if(_0x165c8e){return _0x165c8e?{'count':_0x2cb6a3,'rows':_0x165c8e}:null;}})[_0x4b78('0x26')](respondWithResult(_0x1b3645,null))[_0x4b78('0x49')](handleError(_0x1b3645,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index e7087c2..599593c 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 _0xde5c=['events','../../mysqldb','Team','save','remove','emit','exports'];(function(_0x40b0fb,_0x2912e){var _0x1f1e9a=function(_0xb93eb4){while(--_0xb93eb4){_0x40b0fb['push'](_0x40b0fb['shift']());}};_0x1f1e9a(++_0x2912e);}(_0xde5c,0x19d));var _0xcde5=function(_0x2c3255,_0x4e00ae){_0x2c3255=_0x2c3255-0x0;var _0x282aba=_0xde5c[_0x2c3255];return _0x282aba;};'use strict';var EventEmitter=require(_0xcde5('0x0'));var Team=require(_0xcde5('0x1'))['db'][_0xcde5('0x2')];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xcde5('0x3'),'afterUpdate':'update','afterDestroy':_0xcde5('0x4')};function emitEvent(_0xaf126c){return function(_0x3f3189,_0x58d831,_0x1b003b){TeamEvents[_0xcde5('0x5')](_0xaf126c+':'+_0x3f3189['id'],_0x3f3189);TeamEvents['emit'](_0xaf126c,_0x3f3189);_0x1b003b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Team['hook'](e,emitEvent(event));}}module[_0xcde5('0x6')]=TeamEvents; \ No newline at end of file +var _0xf830=['hook','exports','events','../../mysqldb','Team','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x3efd98,_0x5a231a){var _0x3d99b7=function(_0x5d8a4e){while(--_0x5d8a4e){_0x3efd98['push'](_0x3efd98['shift']());}};_0x3d99b7(++_0x5a231a);}(_0xf830,0x19c));var _0x0f83=function(_0x241500,_0x10ed3f){_0x241500=_0x241500-0x0;var _0x219020=_0xf830[_0x241500];return _0x219020;};'use strict';var EventEmitter=require(_0x0f83('0x0'));var Team=require(_0x0f83('0x1'))['db'][_0x0f83('0x2')];var TeamEvents=new EventEmitter();TeamEvents[_0x0f83('0x3')](0x0);var events={'afterCreate':_0x0f83('0x4'),'afterUpdate':_0x0f83('0x5'),'afterDestroy':'remove'};function emitEvent(_0x2821bd){return function(_0x58c957,_0x41e1f0,_0x2872a9){TeamEvents[_0x0f83('0x6')](_0x2821bd+':'+_0x58c957['id'],_0x58c957);TeamEvents[_0x0f83('0x6')](_0x2821bd,_0x58c957);_0x2872a9(null);};}for(var e in events){if(events[_0x0f83('0x7')](e)){var event=events[e];Team[_0x0f83('0x8')](e,emitEvent(event));}}module[_0x0f83('0x9')]=TeamEvents; \ No newline at end of file diff --git a/server/api/team/team.model.js b/server/api/team/team.model.js index 9582b2d..4fb20a7 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 _0x49e0=['path','./team.attributes','exports','define','Team','teams','lodash','../../config/logger','api','bluebird'];(function(_0x4f8ac9,_0x3cecb8){var _0x41b957=function(_0x39b53e){while(--_0x39b53e){_0x4f8ac9['push'](_0x4f8ac9['shift']());}};_0x41b957(++_0x3cecb8);}(_0x49e0,0x1d2));var _0x049e=function(_0x2672e0,_0x254e0a){_0x2672e0=_0x2672e0-0x0;var _0x53220a=_0x49e0[_0x2672e0];return _0x53220a;};'use strict';var _=require(_0x049e('0x0'));var util=require('util');var logger=require(_0x049e('0x1'))(_0x049e('0x2'));var moment=require('moment');var BPromise=require(_0x049e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x049e('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x049e('0x5'));module[_0x049e('0x6')]=function(_0x2ef4bc,_0x1deada){return _0x2ef4bc[_0x049e('0x7')](_0x049e('0x8'),attributes,{'tableName':_0x049e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3842=['lodash','util','api','path','rimraf','../../config/environment','./team.attributes','define','teams'];(function(_0x2b4458,_0x3a2576){var _0xa8dc5c=function(_0x125b11){while(--_0x125b11){_0x2b4458['push'](_0x2b4458['shift']());}};_0xa8dc5c(++_0x3a2576);}(_0x3842,0xea));var _0x2384=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x3842[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x2384('0x0'));var util=require(_0x2384('0x1'));var logger=require('../../config/logger')(_0x2384('0x2'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x2384('0x3'));var rimraf=require(_0x2384('0x4'));var config=require(_0x2384('0x5'));var attributes=require(_0x2384('0x6'));module['exports']=function(_0x4bba99,_0x1b554d){return _0x4bba99[_0x2384('0x7')]('Team',attributes,{'tableName':_0x2384('0x8'),'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 e6d22d6..76c0d57 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 _0xf3e6=['../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','request','then','info','debug','Team,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','Team,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','ioredis','../../config/utils'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xf3e6,0xe5));var _0x6f3e=function(_0x52ec3b,_0x586ee5){_0x52ec3b=_0x52ec3b-0x0;var _0x29ab67=_0xf3e6[_0x52ec3b];return _0x29ab67;};'use strict';var _=require(_0x6f3e('0x0'));var util=require(_0x6f3e('0x1'));var moment=require('moment');var BPromise=require(_0x6f3e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6f3e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x6f3e('0x4'));var logger=require(_0x6f3e('0x5'))(_0x6f3e('0x6'));var config=require(_0x6f3e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x6f3e('0x8')]['http']({'port':0x232a});config[_0x6f3e('0x9')]=_[_0x6f3e('0xa')](config[_0x6f3e('0x9')],{'host':_0x6f3e('0xb'),'port':0x18eb});var socket=require(_0x6f3e('0xc'))(new Redis(config[_0x6f3e('0x9')]));require('./team.socket')['register'](socket);function respondWithRpcPromise(_0x3d4129,_0x2f4286,_0x5a76a3){return new BPromise(function(_0x5171b5,_0x37f8df){return client[_0x6f3e('0xd')](_0x3d4129,_0x5a76a3)[_0x6f3e('0xe')](function(_0x1f685b){logger[_0x6f3e('0xf')]('Team,\x20%s,\x20%s',_0x2f4286,'request\x20sent');logger[_0x6f3e('0x10')](_0x6f3e('0x11'),_0x2f4286,_0x6f3e('0x12'),JSON[_0x6f3e('0x13')](_0x1f685b));if(_0x1f685b['error']){if(_0x1f685b['error'][_0x6f3e('0x14')]===0x1f4){logger[_0x6f3e('0x15')](_0x6f3e('0x16'),_0x2f4286,_0x1f685b[_0x6f3e('0x15')][_0x6f3e('0x17')]);return _0x37f8df(_0x1f685b[_0x6f3e('0x15')][_0x6f3e('0x17')]);}logger[_0x6f3e('0x15')](_0x6f3e('0x16'),_0x2f4286,_0x1f685b['error']['message']);return _0x5171b5(_0x1f685b['error']['message']);}else{logger[_0x6f3e('0xf')](_0x6f3e('0x16'),_0x2f4286,_0x6f3e('0x12'));_0x5171b5(_0x1f685b[_0x6f3e('0x18')]['message']);}})[_0x6f3e('0x19')](function(_0x5915cc){logger[_0x6f3e('0x15')](_0x6f3e('0x16'),_0x2f4286,_0x5915cc);_0x37f8df(_0x5915cc);});});} \ No newline at end of file +var _0xc454=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','./team.socket','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x511bd1,_0x223e5b){var _0x4c48ec=function(_0x31814e){while(--_0x31814e){_0x511bd1['push'](_0x511bd1['shift']());}};_0x4c48ec(++_0x223e5b);}(_0xc454,0x1cf));var _0x4c45=function(_0x538e32,_0x512f39){_0x538e32=_0x538e32-0x0;var _0x1992b3=_0xc454[_0x538e32];return _0x1992b3;};'use strict';var _=require(_0x4c45('0x0'));var util=require(_0x4c45('0x1'));var moment=require(_0x4c45('0x2'));var BPromise=require(_0x4c45('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4c45('0x4'));var db=require(_0x4c45('0x5'))['db'];var utils=require(_0x4c45('0x6'));var logger=require(_0x4c45('0x7'))(_0x4c45('0x8'));var config=require(_0x4c45('0x9'));var jayson=require(_0x4c45('0xa'));var client=jayson[_0x4c45('0xb')]['http']({'port':0x232a});config[_0x4c45('0xc')]=_['defaults'](config[_0x4c45('0xc')],{'host':_0x4c45('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x4c45('0xe'))[_0x4c45('0xf')](socket);function respondWithRpcPromise(_0x3a63b1,_0x24dcb6,_0x41dfe0){return new BPromise(function(_0x2ee657,_0x333e93){return client[_0x4c45('0x10')](_0x3a63b1,_0x41dfe0)[_0x4c45('0x11')](function(_0x19a4cc){logger[_0x4c45('0x12')](_0x4c45('0x13'),_0x24dcb6,_0x4c45('0x14'));logger[_0x4c45('0x15')](_0x4c45('0x16'),_0x24dcb6,_0x4c45('0x14'),JSON[_0x4c45('0x17')](_0x19a4cc));if(_0x19a4cc['error']){if(_0x19a4cc[_0x4c45('0x18')][_0x4c45('0x19')]===0x1f4){logger[_0x4c45('0x18')](_0x4c45('0x13'),_0x24dcb6,_0x19a4cc['error']['message']);return _0x333e93(_0x19a4cc[_0x4c45('0x18')][_0x4c45('0x1a')]);}logger[_0x4c45('0x18')](_0x4c45('0x13'),_0x24dcb6,_0x19a4cc[_0x4c45('0x18')][_0x4c45('0x1a')]);return _0x2ee657(_0x19a4cc[_0x4c45('0x18')][_0x4c45('0x1a')]);}else{logger[_0x4c45('0x12')]('Team,\x20%s,\x20%s',_0x24dcb6,_0x4c45('0x14'));_0x2ee657(_0x19a4cc[_0x4c45('0x1b')]['message']);}})[_0x4c45('0x1c')](function(_0x5daf59){logger[_0x4c45('0x18')](_0x4c45('0x13'),_0x24dcb6,_0x5daf59);_0x333e93(_0x5daf59);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index 268c0e0..d7ae9da 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 _0xd7ab=['remove','update','removeListener','length','team:','./team.events','save'];(function(_0x16803c,_0x21deb4){var _0x4a272c=function(_0x43ddba){while(--_0x43ddba){_0x16803c['push'](_0x16803c['shift']());}};_0x4a272c(++_0x21deb4);}(_0xd7ab,0x14e));var _0xbd7a=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xd7ab[_0x3947c9];return _0x2e7871;};'use strict';var TeamEvents=require(_0xbd7a('0x0'));var events=[_0xbd7a('0x1'),_0xbd7a('0x2'),_0xbd7a('0x3')];function createListener(_0x687a21,_0x5d2c5a){return function(_0xa417ef){_0x5d2c5a['emit'](_0x687a21,_0xa417ef);};}function removeListener(_0x5104f2,_0x5a7dc8){return function(){TeamEvents[_0xbd7a('0x4')](_0x5104f2,_0x5a7dc8);};}exports['register']=function(_0x480cb0){for(var _0x458cda=0x0,_0x331bcb=events[_0xbd7a('0x5')];_0x458cda<_0x331bcb;_0x458cda++){var _0x5ccda4=events[_0x458cda];var _0x3eb09d=createListener(_0xbd7a('0x6')+_0x5ccda4,_0x480cb0);TeamEvents['on'](_0x5ccda4,_0x3eb09d);}}; \ No newline at end of file +var _0xa5be=['remove','update','emit','register','length'];(function(_0x42c5dd,_0x412185){var _0x39395e=function(_0x1b7c4e){while(--_0x1b7c4e){_0x42c5dd['push'](_0x42c5dd['shift']());}};_0x39395e(++_0x412185);}(_0xa5be,0x10e));var _0xea5b=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xa5be[_0x397e5f];return _0x5302b8;};'use strict';var TeamEvents=require('./team.events');var events=['save',_0xea5b('0x0'),_0xea5b('0x1')];function createListener(_0x1ef1c,_0x3c0d72){return function(_0x276312){_0x3c0d72[_0xea5b('0x2')](_0x1ef1c,_0x276312);};}function removeListener(_0x506b12,_0x197378){return function(){TeamEvents['removeListener'](_0x506b12,_0x197378);};}exports[_0xea5b('0x3')]=function(_0x22a064){for(var _0xd0240d=0x0,_0x4f386f=events[_0xea5b('0x4')];_0xd0240d<_0x4f386f;_0xd0240d++){var _0x586628=events[_0xd0240d];var _0x12d789=createListener('team:'+_0x586628,_0x22a064);TeamEvents['on'](_0x586628,_0x12d789);}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index 2db929d..30ce6eb 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 _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x510b08,_0x16cd04){var _0xbf9488=function(_0x2bd2bd){while(--_0x2bd2bd){_0x510b08['push'](_0x510b08['shift']());}};_0xbf9488(++_0x16cd04);}(_0x9c44,0x178));var _0x49c4=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0x9c44[_0x53ccf2];return _0x5a2964;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x5b6375,_0x563718){var _0x4045b4=function(_0x314db8){while(--_0x314db8){_0x5b6375['push'](_0x5b6375['shift']());}};_0x4045b4(++_0x563718);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0xa9e0[_0x9df060];return _0x338dfe;};'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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 5b04f16..1987d9f 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 _0x6666=['sequelize'];(function(_0x7a6aed,_0x335e68){var _0x9dbabf=function(_0x453c9c){while(--_0x453c9c){_0x7a6aed['push'](_0x7a6aed['shift']());}};_0x9dbabf(++_0x335e68);}(_0x6666,0x6e));var _0x6666=function(_0x1bb6aa,_0x40fe82){_0x1bb6aa=_0x1bb6aa-0x0;var _0x2ef28e=_0x6666[_0x1bb6aa];return _0x2ef28e;};'use strict';var Sequelize=require(_0x6666('0x0'));module['exports']={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x890e=['exports','INTEGER','sequelize'];(function(_0x342828,_0x4c41e6){var _0x113e56=function(_0x2b9602){while(--_0x2b9602){_0x342828['push'](_0x342828['shift']());}};_0x113e56(++_0x4c41e6);}(_0x890e,0xce));var _0xe890=function(_0x5734e6,_0x298c8){_0x5734e6=_0x5734e6-0x0;var _0x337c76=_0x890e[_0x5734e6];return _0x337c76;};'use strict';var Sequelize=require(_0xe890('0x0'));module[_0xe890('0x1')]={'penalty':{'type':Sequelize[_0xe890('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 6647826..75e1c56 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 _0xd4d1=['team_has_voice_queues','lodash','util','../../config/logger','api','moment','request-promise','rimraf','./teamVoiceQueue.attributes','define'];(function(_0x219d7b,_0x1346dd){var _0x368fe2=function(_0x51ec4e){while(--_0x51ec4e){_0x219d7b['push'](_0x219d7b['shift']());}};_0x368fe2(++_0x1346dd);}(_0xd4d1,0x123));var _0x1d4d=function(_0x58f753,_0x102730){_0x58f753=_0x58f753-0x0;var _0x4543c6=_0xd4d1[_0x58f753];return _0x4543c6;};'use strict';var _=require(_0x1d4d('0x0'));var util=require(_0x1d4d('0x1'));var logger=require(_0x1d4d('0x2'))(_0x1d4d('0x3'));var moment=require(_0x1d4d('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d4d('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x1d4d('0x6'));var config=require('../../config/environment');var attributes=require(_0x1d4d('0x7'));module['exports']=function(_0x2bc295,_0x184978){return _0x2bc295[_0x1d4d('0x8')]('TeamVoiceQueue',attributes,{'tableName':_0x1d4d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x818f=['rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x4b3f3e,_0x47dfcc){var _0x921fc3=function(_0x3e4b3b){while(--_0x3e4b3b){_0x4b3f3e['push'](_0x4b3f3e['shift']());}};_0x921fc3(++_0x47dfcc);}(_0x818f,0x1da));var _0xf818=function(_0x397254,_0x1b6e6a){_0x397254=_0x397254-0x0;var _0x50a055=_0x818f[_0x397254];return _0x50a055;};'use strict';var _=require(_0xf818('0x0'));var util=require(_0xf818('0x1'));var logger=require(_0xf818('0x2'))(_0xf818('0x3'));var moment=require(_0xf818('0x4'));var BPromise=require(_0xf818('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xf818('0x6'));var rimraf=require(_0xf818('0x7'));var config=require(_0xf818('0x8'));var attributes=require(_0xf818('0x9'));module[_0xf818('0xa')]=function(_0x41310f,_0x27119b){return _0x41310f[_0xf818('0xb')](_0xf818('0xc'),attributes,{'tableName':'team_has_voice_queues','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 d0fb22a..293ab0b 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 _0xae11=['client','http','request','then','TeamVoiceQueue,\x20%s,\x20%s','debug','error','message','request\x20sent','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x10e3ac,_0x183622){var _0x27306f=function(_0x2c6e1f){while(--_0x2c6e1f){_0x10e3ac['push'](_0x10e3ac['shift']());}};_0x27306f(++_0x183622);}(_0xae11,0x1c1));var _0x1ae1=function(_0x55ef8b,_0x5deb5e){_0x55ef8b=_0x55ef8b-0x0;var _0x359c84=_0xae11[_0x55ef8b];return _0x359c84;};'use strict';var _=require(_0x1ae1('0x0'));var util=require(_0x1ae1('0x1'));var moment=require(_0x1ae1('0x2'));var BPromise=require(_0x1ae1('0x3'));var rs=require(_0x1ae1('0x4'));var fs=require('fs');var Redis=require(_0x1ae1('0x5'));var db=require(_0x1ae1('0x6'))['db'];var utils=require(_0x1ae1('0x7'));var logger=require(_0x1ae1('0x8'))(_0x1ae1('0x9'));var config=require('../../config/environment');var jayson=require(_0x1ae1('0xa'));var client=jayson[_0x1ae1('0xb')][_0x1ae1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x42020c,_0x537680,_0x44e91c){return new BPromise(function(_0x84d82,_0xe52ab4){return client[_0x1ae1('0xd')](_0x42020c,_0x44e91c)[_0x1ae1('0xe')](function(_0x4bed32){logger['info'](_0x1ae1('0xf'),_0x537680,'request\x20sent');logger[_0x1ae1('0x10')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x537680,'request\x20sent',JSON['stringify'](_0x4bed32));if(_0x4bed32[_0x1ae1('0x11')]){if(_0x4bed32[_0x1ae1('0x11')]['code']===0x1f4){logger['error'](_0x1ae1('0xf'),_0x537680,_0x4bed32[_0x1ae1('0x11')][_0x1ae1('0x12')]);return _0xe52ab4(_0x4bed32[_0x1ae1('0x11')][_0x1ae1('0x12')]);}logger['error'](_0x1ae1('0xf'),_0x537680,_0x4bed32[_0x1ae1('0x11')]['message']);return _0x84d82(_0x4bed32[_0x1ae1('0x11')][_0x1ae1('0x12')]);}else{logger['info'](_0x1ae1('0xf'),_0x537680,_0x1ae1('0x13'));_0x84d82(_0x4bed32['result'][_0x1ae1('0x12')]);}})['catch'](function(_0x322727){logger[_0x1ae1('0x11')](_0x1ae1('0xf'),_0x537680,_0x322727);_0xe52ab4(_0x322727);});});} \ No newline at end of file +var _0xcc92=['catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','request','info','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message'];(function(_0x20cf8a,_0x44cd6b){var _0x54e165=function(_0xcce1d0){while(--_0xcce1d0){_0x20cf8a['push'](_0x20cf8a['shift']());}};_0x54e165(++_0x44cd6b);}(_0xcc92,0x141));var _0x2cc9=function(_0x5817e6,_0x44a2d0){_0x5817e6=_0x5817e6-0x0;var _0x51916a=_0xcc92[_0x5817e6];return _0x51916a;};'use strict';var _=require(_0x2cc9('0x0'));var util=require(_0x2cc9('0x1'));var moment=require(_0x2cc9('0x2'));var BPromise=require('bluebird');var rs=require(_0x2cc9('0x3'));var fs=require('fs');var Redis=require(_0x2cc9('0x4'));var db=require(_0x2cc9('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2cc9('0x6'));var config=require(_0x2cc9('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x2cc9('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c1fee,_0x41c0b7,_0x1b46f5){return new BPromise(function(_0x110485,_0x544b1f){return client[_0x2cc9('0x9')](_0x1c1fee,_0x1b46f5)['then'](function(_0x103a34){logger[_0x2cc9('0xa')]('TeamVoiceQueue,\x20%s,\x20%s',_0x41c0b7,'request\x20sent');logger[_0x2cc9('0xb')](_0x2cc9('0xc'),_0x41c0b7,_0x2cc9('0xd'),JSON[_0x2cc9('0xe')](_0x103a34));if(_0x103a34[_0x2cc9('0xf')]){if(_0x103a34[_0x2cc9('0xf')][_0x2cc9('0x10')]===0x1f4){logger[_0x2cc9('0xf')](_0x2cc9('0x11'),_0x41c0b7,_0x103a34[_0x2cc9('0xf')][_0x2cc9('0x12')]);return _0x544b1f(_0x103a34[_0x2cc9('0xf')]['message']);}logger[_0x2cc9('0xf')](_0x2cc9('0x11'),_0x41c0b7,_0x103a34[_0x2cc9('0xf')][_0x2cc9('0x12')]);return _0x110485(_0x103a34['error'][_0x2cc9('0x12')]);}else{logger[_0x2cc9('0xa')](_0x2cc9('0x11'),_0x41c0b7,_0x2cc9('0xd'));_0x110485(_0x103a34['result'][_0x2cc9('0x12')]);}})[_0x2cc9('0x13')](function(_0x3080ed){logger['error'](_0x2cc9('0x11'),_0x41c0b7,_0x3080ed);_0x544b1f(_0x3080ed);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 2ddd99e..bb10a12 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 _0xdf4d=['../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','post','create','put','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xdf4d,0xcb));var _0xddf4=function(_0x183897,_0x2dc150){_0x183897=_0x183897-0x0;var _0x48b317=_0xdf4d[_0x183897];return _0x48b317;};'use strict';var multer=require('multer');var util=require(_0xddf4('0x0'));var path=require(_0xddf4('0x1'));var timeout=require('connect-timeout');var express=require(_0xddf4('0x2'));var router=express[_0xddf4('0x3')]();var fs_extra=require(_0xddf4('0x4'));var auth=require(_0xddf4('0x5'));var interaction=require(_0xddf4('0x6'));var config=require(_0xddf4('0x7'));var controller=require('./template.controller');router['get']('/',auth[_0xddf4('0x8')](),controller[_0xddf4('0x9')]);router[_0xddf4('0xa')](_0xddf4('0xb'),auth[_0xddf4('0x8')](),controller[_0xddf4('0xc')]);router[_0xddf4('0xd')]('/',auth[_0xddf4('0x8')](),controller[_0xddf4('0xe')]);router[_0xddf4('0xf')](_0xddf4('0xb'),auth['isAuthenticated'](),controller[_0xddf4('0x10')]);router['delete'](_0xddf4('0xb'),auth[_0xddf4('0x8')](),controller[_0xddf4('0x11')]);module[_0xddf4('0x12')]=router; \ No newline at end of file +var _0x2015=['post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./template.controller','get','isAuthenticated','index','/:id','show'];(function(_0x51c560,_0x4e6c0e){var _0x594579=function(_0x18c6fe){while(--_0x18c6fe){_0x51c560['push'](_0x51c560['shift']());}};_0x594579(++_0x4e6c0e);}(_0x2015,0x193));var _0x5201=function(_0x501002,_0x583ddf){_0x501002=_0x501002-0x0;var _0x38da1e=_0x2015[_0x501002];return _0x38da1e;};'use strict';var multer=require(_0x5201('0x0'));var util=require(_0x5201('0x1'));var path=require(_0x5201('0x2'));var timeout=require(_0x5201('0x3'));var express=require(_0x5201('0x4'));var router=express[_0x5201('0x5')]();var fs_extra=require(_0x5201('0x6'));var auth=require(_0x5201('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x5201('0x8'));var controller=require(_0x5201('0x9'));router[_0x5201('0xa')]('/',auth[_0x5201('0xb')](),controller[_0x5201('0xc')]);router[_0x5201('0xa')](_0x5201('0xd'),auth[_0x5201('0xb')](),controller[_0x5201('0xe')]);router[_0x5201('0xf')]('/',auth['isAuthenticated'](),controller[_0x5201('0x10')]);router[_0x5201('0x11')]('/:id',auth[_0x5201('0xb')](),controller[_0x5201('0x12')]);router[_0x5201('0x13')]('/:id',auth[_0x5201('0xb')](),controller[_0x5201('0x14')]);module[_0x5201('0x15')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 4e9f578..76367f2 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 _0x25e0=['TEXT','sequelize','exports','STRING'];(function(_0x568bd7,_0x23eea6){var _0x203cda=function(_0x26d94f){while(--_0x26d94f){_0x568bd7['push'](_0x568bd7['shift']());}};_0x203cda(++_0x23eea6);}(_0x25e0,0x119));var _0x025e=function(_0x4dc0d9,_0x4f6443){_0x4dc0d9=_0x4dc0d9-0x0;var _0x3e44a8=_0x25e0[_0x4dc0d9];return _0x3e44a8;};'use strict';var Sequelize=require(_0x025e('0x0'));module[_0x025e('0x1')]={'name':{'type':Sequelize[_0x025e('0x2')]},'description':{'type':Sequelize[_0x025e('0x2')]},'html':{'type':Sequelize[_0x025e('0x3')]}}; \ No newline at end of file +var _0x2316=['TEXT','exports'];(function(_0x59cad8,_0x3a8e3a){var _0x36b155=function(_0x565fdd){while(--_0x565fdd){_0x59cad8['push'](_0x59cad8['shift']());}};_0x36b155(++_0x3a8e3a);}(_0x2316,0x12b));var _0x6231=function(_0x2a55f8,_0x540ac4){_0x2a55f8=_0x2a55f8-0x0;var _0x245efd=_0x2316[_0x2a55f8];return _0x245efd;};'use strict';var Sequelize=require('sequelize');module[_0x6231('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']},'html':{'type':Sequelize[_0x6231('0x1')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 3640531..f61c0b9 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 _0x661b=['VIRTUAL','options','include','Template','findAll','catch','params','includeAll','find','create','body','get','role','user','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','request-promise','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','save','then','destroy','Templates','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','pick','filter','where','merge'];(function(_0x3cf592,_0x5042b1){var _0x29e184=function(_0x124b73){while(--_0x124b73){_0x3cf592['push'](_0x3cf592['shift']());}};_0x29e184(++_0x5042b1);}(_0x661b,0x1f3));var _0xb661=function(_0x1dece9,_0x2cd405){_0x1dece9=_0x1dece9-0x0;var _0x449378=_0x661b[_0x1dece9];return _0x449378;};'use strict';var emlformat=require(_0xb661('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb661('0x1'));var moment=require(_0xb661('0x2'));var BPromise=require('bluebird');var Mustache=require(_0xb661('0x3'));var util=require('util');var path=require('path');var sox=require(_0xb661('0x4'));var csv=require(_0xb661('0x5'));var ejs=require(_0xb661('0x6'));var fs=require('fs');var fs_extra=require(_0xb661('0x7'));var _=require(_0xb661('0x8'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xb661('0x9'));var deskjs=require(_0xb661('0xa'));var toCsv=require(_0xb661('0x5'));var querystring=require(_0xb661('0xb'));var Papa=require(_0xb661('0xc'));var Redis=require('ioredis');var authService=require(_0xb661('0xd'));var qs=require(_0xb661('0xe'));var as=require(_0xb661('0xf'));var hardwareService=require(_0xb661('0x10'));var logger=require('../../config/logger')(_0xb661('0x11'));var utils=require(_0xb661('0x12'));var config=require(_0xb661('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0xb661('0x14'))['db'];function respondWithStatusCode(_0x203edd,_0x579a82){_0x579a82=_0x579a82||0xcc;return function(_0x46aac0){if(_0x46aac0){return _0x203edd[_0xb661('0x15')](_0x579a82);}return _0x203edd[_0xb661('0x16')](_0x579a82)[_0xb661('0x17')]();};}function respondWithResult(_0x3a48e3,_0x52fa47){_0x52fa47=_0x52fa47||0xc8;return function(_0x33db0e){if(_0x33db0e){return _0x3a48e3[_0xb661('0x16')](_0x52fa47)[_0xb661('0x18')](_0x33db0e);}};}function respondWithFilteredResult(_0x3da891,_0x1c2b39){return function(_0x4e3162){if(_0x4e3162){var _0x9db11c=typeof _0x1c2b39['offset']===_0xb661('0x19')&&typeof _0x1c2b39[_0xb661('0x1a')]===_0xb661('0x19');var _0x8c143=_0x4e3162[_0xb661('0x1b')];var _0x505361=_0x9db11c?0x0:_0x1c2b39[_0xb661('0x1c')];var _0x43c695=_0x9db11c?_0x4e3162[_0xb661('0x1b')]:_0x1c2b39[_0xb661('0x1c')]+_0x1c2b39[_0xb661('0x1a')];var _0x5f19b0;if(_0x43c695>=_0x8c143){_0x43c695=_0x8c143;_0x5f19b0=0xc8;}else{_0x5f19b0=0xce;}_0x3da891[_0xb661('0x16')](_0x5f19b0);return _0x3da891[_0xb661('0x1d')](_0xb661('0x1e'),_0x505361+'-'+_0x43c695+'/'+_0x8c143)[_0xb661('0x18')](_0x4e3162);}return null;};}function patchUpdates(_0x1e67e5){return function(_0x3a9fbb){try{jsonpatch[_0xb661('0x1f')](_0x3a9fbb,_0x1e67e5,!![]);}catch(_0x5a61ab){return BPromise['reject'](_0x5a61ab);}return _0x3a9fbb[_0xb661('0x20')]();};}function saveUpdates(_0x170b39,_0x56c275){return function(_0x936ca8){if(_0x936ca8){return _0x936ca8['update'](_0x170b39)[_0xb661('0x21')](function(_0x2c7368){return _0x2c7368;});}return null;};}function removeEntity(_0x5808db,_0x38c41b){return function(_0x40bc9b){if(_0x40bc9b){return _0x40bc9b[_0xb661('0x22')]()['then'](function(){var _0x370f97=_0x40bc9b['get']({'plain':!![]});var _0x505251=_0xb661('0x23');return db['UserProfileResource'][_0xb661('0x22')]({'where':{'type':_0x505251,'resourceId':_0x370f97['id']}})[_0xb661('0x21')](function(){return _0x40bc9b;});})[_0xb661('0x21')](function(){_0x5808db['status'](0xcc)[_0xb661('0x17')]();});}};}function handleEntityNotFound(_0x406966,_0x5a7788){return function(_0x43e36a){if(!_0x43e36a){_0x406966[_0xb661('0x15')](0x194);}return _0x43e36a;};}function handleError(_0x359c05,_0x47b39b){_0x47b39b=_0x47b39b||0x1f4;return function(_0x237b8a){logger[_0xb661('0x24')](_0x237b8a[_0xb661('0x25')]);if(_0x237b8a[_0xb661('0x26')]){delete _0x237b8a[_0xb661('0x26')];}_0x359c05[_0xb661('0x16')](_0x47b39b)[_0xb661('0x27')](_0x237b8a);};}exports[_0xb661('0x28')]=function(_0x3c3093,_0x2e734c){var _0x2b9c22={},_0xad396d={},_0x4de570={'count':0x0,'rows':[]};var _0x1f0247=_['map'](db['Template'][_0xb661('0x29')],function(_0x32ba63){return{'name':_0x32ba63[_0xb661('0x2a')],'type':_0x32ba63[_0xb661('0x2b')][_0xb661('0x2c')]};});_0xad396d[_0xb661('0x2d')]=_[_0xb661('0x2e')](_0x1f0247,'name');_0xad396d[_0xb661('0x2f')]=_[_0xb661('0x30')](_0x3c3093[_0xb661('0x2f')]);_0xad396d[_0xb661('0x31')]=_['intersection'](_0xad396d['model'],_0xad396d[_0xb661('0x2f')]);_0x2b9c22[_0xb661('0x32')]=_[_0xb661('0x33')](_0xad396d[_0xb661('0x2d')],qs[_0xb661('0x34')](_0x3c3093[_0xb661('0x2f')][_0xb661('0x34')]));_0x2b9c22['attributes']=_0x2b9c22[_0xb661('0x32')][_0xb661('0x35')]?_0x2b9c22[_0xb661('0x32')]:_0xad396d[_0xb661('0x2d')];if(!_0x3c3093[_0xb661('0x2f')]['hasOwnProperty'](_0xb661('0x36'))){_0x2b9c22[_0xb661('0x1a')]=qs[_0xb661('0x1a')](_0x3c3093[_0xb661('0x2f')][_0xb661('0x1a')]);_0x2b9c22[_0xb661('0x1c')]=qs['offset'](_0x3c3093[_0xb661('0x2f')]['offset']);}_0x2b9c22[_0xb661('0x37')]=qs[_0xb661('0x38')](_0x3c3093['query'][_0xb661('0x38')]);_0x2b9c22['where']=qs[_0xb661('0x31')](_[_0xb661('0x39')](_0x3c3093[_0xb661('0x2f')],_0xad396d[_0xb661('0x31')]),_0x1f0247);if(_0x3c3093[_0xb661('0x2f')][_0xb661('0x3a')]){_0x2b9c22[_0xb661('0x3b')]=_[_0xb661('0x3c')](_0x2b9c22[_0xb661('0x3b')],{'$or':_[_0xb661('0x2e')](_0x1f0247,function(_0x42bd1c){if(_0x42bd1c[_0xb661('0x2b')]!==_0xb661('0x3d')){var _0x241ea6={};_0x241ea6[_0x42bd1c[_0xb661('0x26')]]={'$like':'%'+_0x3c3093[_0xb661('0x2f')][_0xb661('0x3a')]+'%'};return _0x241ea6;}})});}_0x2b9c22=_[_0xb661('0x3c')]({},_0x2b9c22,_0x3c3093[_0xb661('0x3e')]);var _0x21aa7a={'where':_0x2b9c22[_0xb661('0x3b')]};return db['Template'][_0xb661('0x1b')](_0x21aa7a)[_0xb661('0x21')](function(_0x29480c){_0x4de570[_0xb661('0x1b')]=_0x29480c;if(_0x3c3093[_0xb661('0x2f')]['includeAll']){_0x2b9c22[_0xb661('0x3f')]=[{'all':!![]}];}return db[_0xb661('0x40')][_0xb661('0x41')](_0x2b9c22);})[_0xb661('0x21')](function(_0x4e7bcb){_0x4de570['rows']=_0x4e7bcb;return _0x4de570;})[_0xb661('0x21')](respondWithFilteredResult(_0x2e734c,_0x2b9c22))[_0xb661('0x42')](handleError(_0x2e734c,null));};exports['show']=function(_0x5921de,_0x5cda2c){var _0x4d4816={'raw':!![],'where':{'id':_0x5921de[_0xb661('0x43')]['id']}},_0x31b4b8={};_0x31b4b8[_0xb661('0x2d')]=_['keys'](db['Template'][_0xb661('0x29')]);_0x31b4b8[_0xb661('0x2f')]=_[_0xb661('0x30')](_0x5921de[_0xb661('0x2f')]);_0x31b4b8[_0xb661('0x31')]=_['intersection'](_0x31b4b8[_0xb661('0x2d')],_0x31b4b8['query']);_0x4d4816['attributes']=_['intersection'](_0x31b4b8[_0xb661('0x2d')],qs[_0xb661('0x34')](_0x5921de[_0xb661('0x2f')][_0xb661('0x34')]));_0x4d4816['attributes']=_0x4d4816['attributes'][_0xb661('0x35')]?_0x4d4816[_0xb661('0x32')]:_0x31b4b8[_0xb661('0x2d')];if(_0x5921de[_0xb661('0x2f')][_0xb661('0x44')]){_0x4d4816[_0xb661('0x3f')]=[{'all':!![]}];}_0x4d4816=_['merge']({},_0x4d4816,_0x5921de[_0xb661('0x3e')]);return db['Template'][_0xb661('0x45')](_0x4d4816)[_0xb661('0x21')](handleEntityNotFound(_0x5cda2c,null))[_0xb661('0x21')](respondWithResult(_0x5cda2c,null))[_0xb661('0x42')](handleError(_0x5cda2c,null));};exports[_0xb661('0x46')]=function(_0x4701bb,_0x1f1641){return db[_0xb661('0x40')][_0xb661('0x46')](_0x4701bb[_0xb661('0x47')],{})['then'](function(_0x25de5c){var _0x5aa747=_0x4701bb['user'][_0xb661('0x48')]({'plain':!![]});if(!_0x5aa747)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5aa747[_0xb661('0x49')]===_0xb661('0x4a')){var _0x402693=_0x25de5c['get']({'plain':!![]});var _0x3d8ec5=_0xb661('0x23');return db[_0xb661('0x4b')][_0xb661('0x45')]({'where':{'name':_0x3d8ec5,'userProfileId':_0x5aa747[_0xb661('0x4c')]},'raw':!![]})[_0xb661('0x21')](function(_0x43d1a3){if(_0x43d1a3&&_0x43d1a3['autoAssociation']===0x0){return db[_0xb661('0x4d')][_0xb661('0x46')]({'name':_0x402693[_0xb661('0x26')],'resourceId':_0x402693['id'],'type':_0x43d1a3[_0xb661('0x26')],'sectionId':_0x43d1a3['id']},{})[_0xb661('0x21')](function(){return _0x25de5c;});}else{return _0x25de5c;}})[_0xb661('0x42')](function(_0x3afc2a){logger[_0xb661('0x24')](_0xb661('0x4e'),_0x3afc2a);throw _0x3afc2a;});}return _0x25de5c;})['then'](respondWithResult(_0x1f1641,0xc9))['catch'](handleError(_0x1f1641,null));};exports[_0xb661('0x4f')]=function(_0x443a3c,_0x29409c){if(_0x443a3c['body']['id']){delete _0x443a3c[_0xb661('0x47')]['id'];}return db[_0xb661('0x40')][_0xb661('0x45')]({'where':{'id':_0x443a3c[_0xb661('0x43')]['id']}})[_0xb661('0x21')](handleEntityNotFound(_0x29409c,null))['then'](saveUpdates(_0x443a3c[_0xb661('0x47')],null))[_0xb661('0x21')](respondWithResult(_0x29409c,null))[_0xb661('0x42')](handleError(_0x29409c,null));};exports[_0xb661('0x22')]=function(_0x434f82,_0x43986f){return db['Template'][_0xb661('0x45')]({'where':{'id':_0x434f82[_0xb661('0x43')]['id']}})[_0xb661('0x21')](handleEntityNotFound(_0x43986f,null))['then'](removeEntity(_0x43986f,null))['catch'](handleError(_0x43986f,null));}; \ No newline at end of file +var _0xbb58=['name','send','index','map','Template','fieldName','type','key','model','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','find','create','body','user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','limit','undefined','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','stack'];(function(_0x2f0197,_0x140cb4){var _0x2a409b=function(_0x36e911){while(--_0x36e911){_0x2f0197['push'](_0x2f0197['shift']());}};_0x2a409b(++_0x140cb4);}(_0xbb58,0xd0));var _0x8bb5=function(_0x5ca798,_0x1c7d4b){_0x5ca798=_0x5ca798-0x0;var _0xb21e8f=_0xbb58[_0x5ca798];return _0xb21e8f;};'use strict';var emlformat=require(_0x8bb5('0x0'));var rimraf=require(_0x8bb5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x8bb5('0x2'));var rp=require(_0x8bb5('0x3'));var moment=require(_0x8bb5('0x4'));var BPromise=require(_0x8bb5('0x5'));var Mustache=require(_0x8bb5('0x6'));var util=require('util');var path=require(_0x8bb5('0x7'));var sox=require('sox');var csv=require(_0x8bb5('0x8'));var ejs=require(_0x8bb5('0x9'));var fs=require('fs');var fs_extra=require(_0x8bb5('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x8bb5('0xb'));var deskjs=require(_0x8bb5('0xc'));var toCsv=require(_0x8bb5('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x8bb5('0xd'));var qs=require(_0x8bb5('0xe'));var as=require(_0x8bb5('0xf'));var hardwareService=require(_0x8bb5('0x10'));var logger=require(_0x8bb5('0x11'))('api');var utils=require(_0x8bb5('0x12'));var config=require(_0x8bb5('0x13'));var licenseUtil=require(_0x8bb5('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5f04b5,_0x292221){_0x292221=_0x292221||0xcc;return function(_0xc7391f){if(_0xc7391f){return _0x5f04b5[_0x8bb5('0x15')](_0x292221);}return _0x5f04b5[_0x8bb5('0x16')](_0x292221)[_0x8bb5('0x17')]();};}function respondWithResult(_0x4bace0,_0x50fe50){_0x50fe50=_0x50fe50||0xc8;return function(_0x27ea08){if(_0x27ea08){return _0x4bace0[_0x8bb5('0x16')](_0x50fe50)['json'](_0x27ea08);}};}function respondWithFilteredResult(_0x491202,_0x39c3f6){return function(_0x3f2844){if(_0x3f2844){var _0x24fd84=typeof _0x39c3f6['offset']==='undefined'&&typeof _0x39c3f6[_0x8bb5('0x18')]===_0x8bb5('0x19');var _0x2a8a15=_0x3f2844[_0x8bb5('0x1a')];var _0x25d0cf=_0x24fd84?0x0:_0x39c3f6[_0x8bb5('0x1b')];var _0x328d8b=_0x24fd84?_0x3f2844['count']:_0x39c3f6[_0x8bb5('0x1b')]+_0x39c3f6['limit'];var _0x2f993a;if(_0x328d8b>=_0x2a8a15){_0x328d8b=_0x2a8a15;_0x2f993a=0xc8;}else{_0x2f993a=0xce;}_0x491202['status'](_0x2f993a);return _0x491202[_0x8bb5('0x1c')](_0x8bb5('0x1d'),_0x25d0cf+'-'+_0x328d8b+'/'+_0x2a8a15)[_0x8bb5('0x1e')](_0x3f2844);}return null;};}function patchUpdates(_0x2f5d40){return function(_0x40ea99){try{jsonpatch[_0x8bb5('0x1f')](_0x40ea99,_0x2f5d40,!![]);}catch(_0x22c63e){return BPromise[_0x8bb5('0x20')](_0x22c63e);}return _0x40ea99[_0x8bb5('0x21')]();};}function saveUpdates(_0x575784,_0x142241){return function(_0x8b2039){if(_0x8b2039){return _0x8b2039[_0x8bb5('0x22')](_0x575784)[_0x8bb5('0x23')](function(_0x1caf3f){return _0x1caf3f;});}return null;};}function removeEntity(_0x2e308b,_0x20d546){return function(_0x256ba9){if(_0x256ba9){return _0x256ba9[_0x8bb5('0x24')]()[_0x8bb5('0x23')](function(){var _0x3fb6f7=_0x256ba9[_0x8bb5('0x25')]({'plain':!![]});var _0x1d5c6d=_0x8bb5('0x26');return db[_0x8bb5('0x27')][_0x8bb5('0x24')]({'where':{'type':_0x1d5c6d,'resourceId':_0x3fb6f7['id']}})[_0x8bb5('0x23')](function(){return _0x256ba9;});})[_0x8bb5('0x23')](function(){_0x2e308b['status'](0xcc)[_0x8bb5('0x17')]();});}};}function handleEntityNotFound(_0x273ef1,_0x225c18){return function(_0x4b764a){if(!_0x4b764a){_0x273ef1[_0x8bb5('0x15')](0x194);}return _0x4b764a;};}function handleError(_0x44c6c7,_0x4595e8){_0x4595e8=_0x4595e8||0x1f4;return function(_0x10ed8c){logger['error'](_0x10ed8c[_0x8bb5('0x28')]);if(_0x10ed8c[_0x8bb5('0x29')]){delete _0x10ed8c[_0x8bb5('0x29')];}_0x44c6c7['status'](_0x4595e8)[_0x8bb5('0x2a')](_0x10ed8c);};}exports[_0x8bb5('0x2b')]=function(_0x25f6ed,_0x2d0f9){var _0x48f070={},_0x1ed2d1={},_0x4a09b4={'count':0x0,'rows':[]};var _0x521f92=_[_0x8bb5('0x2c')](db[_0x8bb5('0x2d')]['rawAttributes'],function(_0x5d67b0){return{'name':_0x5d67b0[_0x8bb5('0x2e')],'type':_0x5d67b0[_0x8bb5('0x2f')][_0x8bb5('0x30')]};});_0x1ed2d1[_0x8bb5('0x31')]=_[_0x8bb5('0x2c')](_0x521f92,_0x8bb5('0x29'));_0x1ed2d1['query']=_['keys'](_0x25f6ed[_0x8bb5('0x32')]);_0x1ed2d1['filters']=_['intersection'](_0x1ed2d1[_0x8bb5('0x31')],_0x1ed2d1[_0x8bb5('0x32')]);_0x48f070[_0x8bb5('0x33')]=_[_0x8bb5('0x34')](_0x1ed2d1[_0x8bb5('0x31')],qs['fields'](_0x25f6ed[_0x8bb5('0x32')][_0x8bb5('0x35')]));_0x48f070[_0x8bb5('0x33')]=_0x48f070[_0x8bb5('0x33')][_0x8bb5('0x36')]?_0x48f070[_0x8bb5('0x33')]:_0x1ed2d1[_0x8bb5('0x31')];if(!_0x25f6ed[_0x8bb5('0x32')][_0x8bb5('0x37')](_0x8bb5('0x38'))){_0x48f070[_0x8bb5('0x18')]=qs['limit'](_0x25f6ed[_0x8bb5('0x32')][_0x8bb5('0x18')]);_0x48f070[_0x8bb5('0x1b')]=qs[_0x8bb5('0x1b')](_0x25f6ed[_0x8bb5('0x32')][_0x8bb5('0x1b')]);}_0x48f070[_0x8bb5('0x39')]=qs[_0x8bb5('0x3a')](_0x25f6ed[_0x8bb5('0x32')][_0x8bb5('0x3a')]);_0x48f070[_0x8bb5('0x3b')]=qs[_0x8bb5('0x3c')](_['pick'](_0x25f6ed['query'],_0x1ed2d1[_0x8bb5('0x3c')]),_0x521f92);if(_0x25f6ed[_0x8bb5('0x32')][_0x8bb5('0x3d')]){_0x48f070['where']=_[_0x8bb5('0x3e')](_0x48f070[_0x8bb5('0x3b')],{'$or':_[_0x8bb5('0x2c')](_0x521f92,function(_0x20b003){if(_0x20b003[_0x8bb5('0x2f')]!==_0x8bb5('0x3f')){var _0x5a7399={};_0x5a7399[_0x20b003[_0x8bb5('0x29')]]={'$like':'%'+_0x25f6ed[_0x8bb5('0x32')]['filter']+'%'};return _0x5a7399;}})});}_0x48f070=_[_0x8bb5('0x3e')]({},_0x48f070,_0x25f6ed[_0x8bb5('0x40')]);var _0x45ee26={'where':_0x48f070[_0x8bb5('0x3b')]};return db[_0x8bb5('0x2d')][_0x8bb5('0x1a')](_0x45ee26)['then'](function(_0x182353){_0x4a09b4[_0x8bb5('0x1a')]=_0x182353;if(_0x25f6ed[_0x8bb5('0x32')][_0x8bb5('0x41')]){_0x48f070[_0x8bb5('0x42')]=[{'all':!![]}];}return db[_0x8bb5('0x2d')][_0x8bb5('0x43')](_0x48f070);})['then'](function(_0x1c2d21){_0x4a09b4[_0x8bb5('0x44')]=_0x1c2d21;return _0x4a09b4;})[_0x8bb5('0x23')](respondWithFilteredResult(_0x2d0f9,_0x48f070))[_0x8bb5('0x45')](handleError(_0x2d0f9,null));};exports[_0x8bb5('0x46')]=function(_0x57175a,_0x43cad6){var _0x317c6b={'raw':!![],'where':{'id':_0x57175a[_0x8bb5('0x47')]['id']}},_0x44f4b5={};_0x44f4b5['model']=_[_0x8bb5('0x48')](db[_0x8bb5('0x2d')][_0x8bb5('0x49')]);_0x44f4b5[_0x8bb5('0x32')]=_['keys'](_0x57175a[_0x8bb5('0x32')]);_0x44f4b5[_0x8bb5('0x3c')]=_[_0x8bb5('0x34')](_0x44f4b5[_0x8bb5('0x31')],_0x44f4b5[_0x8bb5('0x32')]);_0x317c6b[_0x8bb5('0x33')]=_[_0x8bb5('0x34')](_0x44f4b5[_0x8bb5('0x31')],qs[_0x8bb5('0x35')](_0x57175a['query']['fields']));_0x317c6b[_0x8bb5('0x33')]=_0x317c6b[_0x8bb5('0x33')][_0x8bb5('0x36')]?_0x317c6b['attributes']:_0x44f4b5[_0x8bb5('0x31')];if(_0x57175a[_0x8bb5('0x32')]['includeAll']){_0x317c6b[_0x8bb5('0x42')]=[{'all':!![]}];}_0x317c6b=_['merge']({},_0x317c6b,_0x57175a['options']);return db[_0x8bb5('0x2d')][_0x8bb5('0x4a')](_0x317c6b)[_0x8bb5('0x23')](handleEntityNotFound(_0x43cad6,null))[_0x8bb5('0x23')](respondWithResult(_0x43cad6,null))[_0x8bb5('0x45')](handleError(_0x43cad6,null));};exports['create']=function(_0x7a453a,_0x31074b){return db['Template'][_0x8bb5('0x4b')](_0x7a453a[_0x8bb5('0x4c')],{})[_0x8bb5('0x23')](function(_0x5c4c48){var _0xc8184e=_0x7a453a[_0x8bb5('0x4d')][_0x8bb5('0x25')]({'plain':!![]});if(!_0xc8184e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0xc8184e[_0x8bb5('0x4e')]==='user'){var _0x523955=_0x5c4c48[_0x8bb5('0x25')]({'plain':!![]});var _0x49d386=_0x8bb5('0x26');return db[_0x8bb5('0x4f')][_0x8bb5('0x4a')]({'where':{'name':_0x49d386,'userProfileId':_0xc8184e['userProfileId']},'raw':!![]})[_0x8bb5('0x23')](function(_0x298fa2){if(_0x298fa2&&_0x298fa2[_0x8bb5('0x50')]===0x0){return db['UserProfileResource'][_0x8bb5('0x4b')]({'name':_0x523955['name'],'resourceId':_0x523955['id'],'type':_0x298fa2['name'],'sectionId':_0x298fa2['id']},{})[_0x8bb5('0x23')](function(){return _0x5c4c48;});}else{return _0x5c4c48;}})[_0x8bb5('0x45')](function(_0x25c59c){logger[_0x8bb5('0x51')](_0x8bb5('0x52'),_0x25c59c);throw _0x25c59c;});}return _0x5c4c48;})[_0x8bb5('0x23')](respondWithResult(_0x31074b,0xc9))[_0x8bb5('0x45')](handleError(_0x31074b,null));};exports['update']=function(_0x51aa3a,_0x583a8a){if(_0x51aa3a[_0x8bb5('0x4c')]['id']){delete _0x51aa3a[_0x8bb5('0x4c')]['id'];}return db[_0x8bb5('0x2d')][_0x8bb5('0x4a')]({'where':{'id':_0x51aa3a[_0x8bb5('0x47')]['id']}})['then'](handleEntityNotFound(_0x583a8a,null))['then'](saveUpdates(_0x51aa3a[_0x8bb5('0x4c')],null))[_0x8bb5('0x23')](respondWithResult(_0x583a8a,null))['catch'](handleError(_0x583a8a,null));};exports[_0x8bb5('0x24')]=function(_0x251535,_0x2ab720){return db[_0x8bb5('0x2d')][_0x8bb5('0x4a')]({'where':{'id':_0x251535[_0x8bb5('0x47')]['id']}})[_0x8bb5('0x23')](handleEntityNotFound(_0x2ab720,null))[_0x8bb5('0x23')](removeEntity(_0x2ab720,null))[_0x8bb5('0x45')](handleError(_0x2ab720,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index c838649..7f32e0f 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 _0x41a5=['../../config/environment','./template.attributes','exports','define','Template','tools_templates','util','api','bluebird','path','rimraf'];(function(_0x5cf4aa,_0x2e5fc2){var _0x1c3458=function(_0x5db6e9){while(--_0x5db6e9){_0x5cf4aa['push'](_0x5cf4aa['shift']());}};_0x1c3458(++_0x2e5fc2);}(_0x41a5,0x95));var _0x541a=function(_0x1ab244,_0x414c93){_0x1ab244=_0x1ab244-0x0;var _0x200bc4=_0x41a5[_0x1ab244];return _0x200bc4;};'use strict';var _=require('lodash');var util=require(_0x541a('0x0'));var logger=require('../../config/logger')(_0x541a('0x1'));var moment=require('moment');var BPromise=require(_0x541a('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x541a('0x3'));var rimraf=require(_0x541a('0x4'));var config=require(_0x541a('0x5'));var attributes=require(_0x541a('0x6'));module[_0x541a('0x7')]=function(_0x368bab,_0x11f704){return _0x368bab[_0x541a('0x8')](_0x541a('0x9'),attributes,{'tableName':_0x541a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd26a=['../../config/environment','./template.attributes','exports','define','Template','tools_templates','lodash','../../config/logger','api','bluebird','request-promise','rimraf'];(function(_0x20eca9,_0x3323bb){var _0x1b6f68=function(_0x272e3a){while(--_0x272e3a){_0x20eca9['push'](_0x20eca9['shift']());}};_0x1b6f68(++_0x3323bb);}(_0xd26a,0x102));var _0xad26=function(_0x278e67,_0x44a2fa){_0x278e67=_0x278e67-0x0;var _0x72a926=_0xd26a[_0x278e67];return _0x72a926;};'use strict';var _=require(_0xad26('0x0'));var util=require('util');var logger=require(_0xad26('0x1'))(_0xad26('0x2'));var moment=require('moment');var BPromise=require(_0xad26('0x3'));var rp=require(_0xad26('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xad26('0x5'));var config=require(_0xad26('0x6'));var attributes=require(_0xad26('0x7'));module[_0xad26('0x8')]=function(_0x5a05fd,_0x4419a1){return _0x5a05fd[_0xad26('0x9')](_0xad26('0xa'),attributes,{'tableName':_0xad26('0xb'),'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 6e2e3de..c4bd0d6 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 _0x25c5=['attributes','limit','include','map','model','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','info','Template,\x20%s,\x20%s','debug','Template,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetTemplate','findAll','options','raw'];(function(_0x2e1adf,_0x556f37){var _0x45ba88=function(_0x3f1859){while(--_0x3f1859){_0x2e1adf['push'](_0x2e1adf['shift']());}};_0x45ba88(++_0x556f37);}(_0x25c5,0xfd));var _0x525c=function(_0x29db36,_0x410ae9){_0x29db36=_0x29db36-0x0;var _0x234e87=_0x25c5[_0x29db36];return _0x234e87;};'use strict';var _=require('lodash');var util=require(_0x525c('0x0'));var moment=require(_0x525c('0x1'));var BPromise=require(_0x525c('0x2'));var rs=require(_0x525c('0x3'));var fs=require('fs');var Redis=require(_0x525c('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x525c('0x5'))(_0x525c('0x6'));var config=require(_0x525c('0x7'));var jayson=require(_0x525c('0x8'));var client=jayson[_0x525c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x361e9c,_0x429103,_0x435deb){return new BPromise(function(_0x29b99b,_0x3c1861){return client['request'](_0x361e9c,_0x435deb)[_0x525c('0xa')](function(_0x520cef){logger[_0x525c('0xb')](_0x525c('0xc'),_0x429103,'request\x20sent');logger[_0x525c('0xd')](_0x525c('0xe'),_0x429103,_0x525c('0xf'),JSON[_0x525c('0x10')](_0x520cef));if(_0x520cef[_0x525c('0x11')]){if(_0x520cef[_0x525c('0x11')][_0x525c('0x12')]===0x1f4){logger['error'](_0x525c('0xc'),_0x429103,_0x520cef[_0x525c('0x11')][_0x525c('0x13')]);return _0x3c1861(_0x520cef[_0x525c('0x11')][_0x525c('0x13')]);}logger['error'](_0x525c('0xc'),_0x429103,_0x520cef['error']['message']);return _0x29b99b(_0x520cef[_0x525c('0x11')][_0x525c('0x13')]);}else{logger[_0x525c('0xb')](_0x525c('0xc'),_0x429103,_0x525c('0xf'));_0x29b99b(_0x520cef[_0x525c('0x14')][_0x525c('0x13')]);}})[_0x525c('0x15')](function(_0x4888cc){logger['error'](_0x525c('0xc'),_0x429103,_0x4888cc);_0x3c1861(_0x4888cc);});});}exports[_0x525c('0x16')]=function(_0x2d041c){var _0x58d915=this;return new Promise(function(_0xcbfbe1,_0x51bf06){return db['Template'][_0x525c('0x17')]({'raw':_0x2d041c[_0x525c('0x18')]?_0x2d041c['options'][_0x525c('0x19')]===undefined?!![]:![]:!![],'where':_0x2d041c['options']?_0x2d041c[_0x525c('0x18')]['where']||null:null,'attributes':_0x2d041c['options']?_0x2d041c['options'][_0x525c('0x1a')]||null:null,'limit':_0x2d041c[_0x525c('0x18')]?_0x2d041c[_0x525c('0x18')][_0x525c('0x1b')]||null:null,'include':_0x2d041c['options']?_0x2d041c[_0x525c('0x18')][_0x525c('0x1c')]?_[_0x525c('0x1d')](_0x2d041c['options'][_0x525c('0x1c')],function(_0x42f1fd){return{'model':db[_0x42f1fd[_0x525c('0x1e')]],'as':_0x42f1fd['as'],'attributes':_0x42f1fd[_0x525c('0x1a')],'include':_0x42f1fd['include']?_[_0x525c('0x1d')](_0x42f1fd[_0x525c('0x1c')],function(_0xfc0885){return{'model':db[_0xfc0885[_0x525c('0x1e')]],'as':_0xfc0885['as'],'attributes':_0xfc0885[_0x525c('0x1a')],'include':_0xfc0885[_0x525c('0x1c')]?_[_0x525c('0x1d')](_0xfc0885[_0x525c('0x1c')],function(_0x3213e6){return{'model':db[_0x3213e6[_0x525c('0x1e')]],'as':_0x3213e6['as'],'attributes':_0x3213e6[_0x525c('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x525c('0xa')](function(_0xea63c6){logger[_0x525c('0xb')]('GetTemplate',_0x2d041c);logger[_0x525c('0xd')](_0x525c('0x16'),_0x2d041c,JSON[_0x525c('0x10')](_0xea63c6));_0xcbfbe1(_0xea63c6);})['catch'](function(_0xd4c6dc){logger[_0x525c('0x11')](_0x525c('0x16'),_0xd4c6dc[_0x525c('0x13')],_0x2d041c);_0x51bf06(_0x58d915[_0x525c('0x11')](0x1f4,_0xd4c6dc[_0x525c('0x13')]));});});}; \ No newline at end of file +var _0xc307=['moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','http','request','then','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','GetTemplate','Template','options','where','attributes','limit','include','map','model','lodash'];(function(_0x269090,_0x3af6da){var _0x5de4a8=function(_0xa1e8c8){while(--_0xa1e8c8){_0x269090['push'](_0x269090['shift']());}};_0x5de4a8(++_0x3af6da);}(_0xc307,0x187));var _0x7c30=function(_0x408dc7,_0x109fd2){_0x408dc7=_0x408dc7-0x0;var _0x5cf151=_0xc307[_0x408dc7];return _0x5cf151;};'use strict';var _=require(_0x7c30('0x0'));var util=require('util');var moment=require(_0x7c30('0x1'));var BPromise=require(_0x7c30('0x2'));var rs=require(_0x7c30('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c30('0x4'));var logger=require('../../config/logger')(_0x7c30('0x5'));var config=require(_0x7c30('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7c30('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x16cbf5,_0x32077d,_0x34d120){return new BPromise(function(_0x579f41,_0x141c55){return client[_0x7c30('0x8')](_0x16cbf5,_0x34d120)[_0x7c30('0x9')](function(_0x459d9c){logger['info'](_0x7c30('0xa'),_0x32077d,_0x7c30('0xb'));logger[_0x7c30('0xc')](_0x7c30('0xd'),_0x32077d,'request\x20sent',JSON[_0x7c30('0xe')](_0x459d9c));if(_0x459d9c[_0x7c30('0xf')]){if(_0x459d9c[_0x7c30('0xf')][_0x7c30('0x10')]===0x1f4){logger[_0x7c30('0xf')](_0x7c30('0xa'),_0x32077d,_0x459d9c[_0x7c30('0xf')][_0x7c30('0x11')]);return _0x141c55(_0x459d9c[_0x7c30('0xf')][_0x7c30('0x11')]);}logger['error']('Template,\x20%s,\x20%s',_0x32077d,_0x459d9c[_0x7c30('0xf')]['message']);return _0x579f41(_0x459d9c[_0x7c30('0xf')][_0x7c30('0x11')]);}else{logger[_0x7c30('0x12')](_0x7c30('0xa'),_0x32077d,_0x7c30('0xb'));_0x579f41(_0x459d9c['result'][_0x7c30('0x11')]);}})['catch'](function(_0x2d050f){logger[_0x7c30('0xf')]('Template,\x20%s,\x20%s',_0x32077d,_0x2d050f);_0x141c55(_0x2d050f);});});}exports[_0x7c30('0x13')]=function(_0x28d860){var _0x2d1436=this;return new Promise(function(_0x1be897,_0x30abb9){return db[_0x7c30('0x14')]['findAll']({'raw':_0x28d860['options']?_0x28d860['options']['raw']===undefined?!![]:![]:!![],'where':_0x28d860['options']?_0x28d860[_0x7c30('0x15')][_0x7c30('0x16')]||null:null,'attributes':_0x28d860[_0x7c30('0x15')]?_0x28d860[_0x7c30('0x15')][_0x7c30('0x17')]||null:null,'limit':_0x28d860['options']?_0x28d860['options'][_0x7c30('0x18')]||null:null,'include':_0x28d860[_0x7c30('0x15')]?_0x28d860[_0x7c30('0x15')][_0x7c30('0x19')]?_[_0x7c30('0x1a')](_0x28d860[_0x7c30('0x15')][_0x7c30('0x19')],function(_0x2f9d9d){return{'model':db[_0x2f9d9d[_0x7c30('0x1b')]],'as':_0x2f9d9d['as'],'attributes':_0x2f9d9d[_0x7c30('0x17')],'include':_0x2f9d9d['include']?_['map'](_0x2f9d9d[_0x7c30('0x19')],function(_0x46e8fe){return{'model':db[_0x46e8fe[_0x7c30('0x1b')]],'as':_0x46e8fe['as'],'attributes':_0x46e8fe[_0x7c30('0x17')],'include':_0x46e8fe[_0x7c30('0x19')]?_[_0x7c30('0x1a')](_0x46e8fe['include'],function(_0x2232f7){return{'model':db[_0x2232f7[_0x7c30('0x1b')]],'as':_0x2232f7['as'],'attributes':_0x2232f7[_0x7c30('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7c30('0x9')](function(_0x26b521){logger[_0x7c30('0x12')](_0x7c30('0x13'),_0x28d860);logger[_0x7c30('0xc')](_0x7c30('0x13'),_0x28d860,JSON[_0x7c30('0xe')](_0x26b521));_0x1be897(_0x26b521);})['catch'](function(_0x32cba5){logger[_0x7c30('0xf')](_0x7c30('0x13'),_0x32cba5['message'],_0x28d860);_0x30abb9(_0x2d1436['error'](0x1f4,_0x32cba5[_0x7c30('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 434e0c9..fadabc4 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 _0xb464=['index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getActions','post','create','/:id/actions','addAction','put','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./trigger.controller','get'];(function(_0x1eb6b9,_0x5c6b80){var _0x3d895f=function(_0x2265e0){while(--_0x2265e0){_0x1eb6b9['push'](_0x1eb6b9['shift']());}};_0x3d895f(++_0x5c6b80);}(_0xb464,0xad));var _0x4b46=function(_0x2b4d01,_0x4c6044){_0x2b4d01=_0x2b4d01-0x0;var _0x4195d7=_0xb464[_0x2b4d01];return _0x4195d7;};'use strict';var multer=require(_0x4b46('0x0'));var util=require(_0x4b46('0x1'));var path=require('path');var timeout=require(_0x4b46('0x2'));var express=require(_0x4b46('0x3'));var router=express['Router']();var fs_extra=require(_0x4b46('0x4'));var auth=require(_0x4b46('0x5'));var interaction=require(_0x4b46('0x6'));var config=require('../../config/environment');var controller=require(_0x4b46('0x7'));router[_0x4b46('0x8')]('/',auth['isAuthenticated'](),controller[_0x4b46('0x9')]);router[_0x4b46('0x8')](_0x4b46('0xa'),auth[_0x4b46('0xb')](),controller[_0x4b46('0xc')]);router[_0x4b46('0x8')](_0x4b46('0xd'),auth[_0x4b46('0xb')](),controller[_0x4b46('0xe')]);router[_0x4b46('0x8')](_0x4b46('0xf'),auth['isAuthenticated'](),controller['getAnyConditions']);router[_0x4b46('0x8')]('/:id/actions',auth[_0x4b46('0xb')](),controller[_0x4b46('0x10')]);router[_0x4b46('0x11')]('/',auth[_0x4b46('0xb')](),controller[_0x4b46('0x12')]);router[_0x4b46('0x11')](_0x4b46('0xd'),auth[_0x4b46('0xb')](),controller['addAllCondition']);router[_0x4b46('0x11')](_0x4b46('0xf'),auth['isAuthenticated'](),controller['addAnyCondition']);router[_0x4b46('0x11')](_0x4b46('0x13'),auth[_0x4b46('0xb')](),controller[_0x4b46('0x14')]);router[_0x4b46('0x15')](_0x4b46('0xa'),auth['isAuthenticated'](),controller[_0x4b46('0x16')]);router[_0x4b46('0x17')](_0x4b46('0xa'),auth['isAuthenticated'](),controller[_0x4b46('0x18')]);module[_0x4b46('0x19')]=router; \ No newline at end of file +var _0xe2b9=['post','create','/:id/any_conditions','addAnyCondition','addAction','put','/:id','delete','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','index','get','isAuthenticated','show','/:id/all_conditions','getAllConditions','getAnyConditions','/:id/actions','getActions'];(function(_0x3786eb,_0x27c6a7){var _0x3b1c03=function(_0x1b56ce){while(--_0x1b56ce){_0x3786eb['push'](_0x3786eb['shift']());}};_0x3b1c03(++_0x27c6a7);}(_0xe2b9,0x140));var _0x9e2b=function(_0x1a0ef3,_0x535bbf){_0x1a0ef3=_0x1a0ef3-0x0;var _0x2b86da=_0xe2b9[_0x1a0ef3];return _0x2b86da;};'use strict';var multer=require(_0x9e2b('0x0'));var util=require('util');var path=require(_0x9e2b('0x1'));var timeout=require(_0x9e2b('0x2'));var express=require(_0x9e2b('0x3'));var router=express['Router']();var fs_extra=require(_0x9e2b('0x4'));var auth=require(_0x9e2b('0x5'));var interaction=require(_0x9e2b('0x6'));var config=require('../../config/environment');var controller=require('./trigger.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x9e2b('0x7')]);router[_0x9e2b('0x8')]('/:id',auth[_0x9e2b('0x9')](),controller[_0x9e2b('0xa')]);router[_0x9e2b('0x8')](_0x9e2b('0xb'),auth[_0x9e2b('0x9')](),controller[_0x9e2b('0xc')]);router['get']('/:id/any_conditions',auth[_0x9e2b('0x9')](),controller[_0x9e2b('0xd')]);router[_0x9e2b('0x8')](_0x9e2b('0xe'),auth[_0x9e2b('0x9')](),controller[_0x9e2b('0xf')]);router[_0x9e2b('0x10')]('/',auth['isAuthenticated'](),controller[_0x9e2b('0x11')]);router['post']('/:id/all_conditions',auth[_0x9e2b('0x9')](),controller['addAllCondition']);router[_0x9e2b('0x10')](_0x9e2b('0x12'),auth['isAuthenticated'](),controller[_0x9e2b('0x13')]);router['post'](_0x9e2b('0xe'),auth['isAuthenticated'](),controller[_0x9e2b('0x14')]);router[_0x9e2b('0x15')](_0x9e2b('0x16'),auth[_0x9e2b('0x9')](),controller['update']);router[_0x9e2b('0x17')]('/:id',auth[_0x9e2b('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index c141c1d..d57f7d2 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 _0x7b17=['STRING','sequelize','exports'];(function(_0xf9d9ae,_0x532f54){var _0x4f6825=function(_0x3a737d){while(--_0x3a737d){_0xf9d9ae['push'](_0xf9d9ae['shift']());}};_0x4f6825(++_0x532f54);}(_0x7b17,0x157));var _0x77b1=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x7b17[_0x4b2863];return _0x567d67;};'use strict';var Sequelize=require(_0x77b1('0x0'));module[_0x77b1('0x1')]={'name':{'type':Sequelize[_0x77b1('0x2')]},'channel':{'type':Sequelize[_0x77b1('0x2')]},'description':{'type':Sequelize[_0x77b1('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0xb62c=['exports','STRING','sequelize'];(function(_0x283415,_0x553adf){var _0x3b98b9=function(_0x2c27a4){while(--_0x2c27a4){_0x283415['push'](_0x283415['shift']());}};_0x3b98b9(++_0x553adf);}(_0xb62c,0x15e));var _0xcb62=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb62c[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xcb62('0x0'));module[_0xcb62('0x1')]={'name':{'type':Sequelize[_0xcb62('0x2')]},'channel':{'type':Sequelize[_0xcb62('0x2')]},'description':{'type':Sequelize[_0xcb62('0x2')]},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/trigger/trigger.controller.js b/server/api/trigger/trigger.controller.js index 713be45..7503332 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 _0x32af=['fields','length','hasOwnProperty','nolimit','order','sort','filters','filter','where','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','Triggers','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','addAllCondition','TriggerAllId','Condition','addAnyCondition','getAllConditions','findOne','pick','getAnyConditions','TriggerId','Action','getActions','eml-format','rimraf','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','sendStatus','error','stack','name','send','index','Trigger','rawAttributes','type','key','model','map','query','keys','intersection','attributes'];(function(_0xe4976c,_0x50e724){var _0xb69102=function(_0x41f58e){while(--_0x41f58e){_0xe4976c['push'](_0xe4976c['shift']());}};_0xb69102(++_0x50e724);}(_0x32af,0x145));var _0xf32a=function(_0x18be76,_0x232bb6){_0x18be76=_0x18be76-0x0;var _0x129d4a=_0x32af[_0x18be76];return _0x129d4a;};'use strict';var emlformat=require(_0xf32a('0x0'));var rimraf=require(_0xf32a('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf32a('0x2'));var rp=require('request-promise');var moment=require(_0xf32a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf32a('0x4'));var util=require(_0xf32a('0x5'));var path=require(_0xf32a('0x6'));var sox=require(_0xf32a('0x7'));var csv=require(_0xf32a('0x8'));var ejs=require(_0xf32a('0x9'));var fs=require('fs');var fs_extra=require(_0xf32a('0xa'));var _=require('lodash');var squel=require(_0xf32a('0xb'));var crypto=require(_0xf32a('0xc'));var jsforce=require(_0xf32a('0xd'));var deskjs=require(_0xf32a('0xe'));var toCsv=require(_0xf32a('0x8'));var querystring=require(_0xf32a('0xf'));var Papa=require('papaparse');var Redis=require(_0xf32a('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xf32a('0x11'));var hardwareService=require(_0xf32a('0x12'));var logger=require(_0xf32a('0x13'))('api');var utils=require(_0xf32a('0x14'));var config=require(_0xf32a('0x15'));var licenseUtil=require(_0xf32a('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15fd70,_0x3c33a3){_0x3c33a3=_0x3c33a3||0xcc;return function(_0x409ab5){if(_0x409ab5){return _0x15fd70['sendStatus'](_0x3c33a3);}return _0x15fd70[_0xf32a('0x17')](_0x3c33a3)[_0xf32a('0x18')]();};}function respondWithResult(_0xb3ce0b,_0x4a163f){_0x4a163f=_0x4a163f||0xc8;return function(_0x2d5007){if(_0x2d5007){return _0xb3ce0b[_0xf32a('0x17')](_0x4a163f)[_0xf32a('0x19')](_0x2d5007);}};}function respondWithFilteredResult(_0x208bec,_0x1f6d9d){return function(_0x505218){if(_0x505218){var _0x2a8e0a=typeof _0x1f6d9d[_0xf32a('0x1a')]===_0xf32a('0x1b')&&typeof _0x1f6d9d[_0xf32a('0x1c')]==='undefined';var _0x4cd06f=_0x505218[_0xf32a('0x1d')];var _0x2e8b76=_0x2a8e0a?0x0:_0x1f6d9d[_0xf32a('0x1a')];var _0x133938=_0x2a8e0a?_0x505218['count']:_0x1f6d9d[_0xf32a('0x1a')]+_0x1f6d9d[_0xf32a('0x1c')];var _0x58cd80;if(_0x133938>=_0x4cd06f){_0x133938=_0x4cd06f;_0x58cd80=0xc8;}else{_0x58cd80=0xce;}_0x208bec[_0xf32a('0x17')](_0x58cd80);return _0x208bec['set'](_0xf32a('0x1e'),_0x2e8b76+'-'+_0x133938+'/'+_0x4cd06f)['json'](_0x505218);}return null;};}function patchUpdates(_0x50c94d){return function(_0x2ab6f6){try{jsonpatch['apply'](_0x2ab6f6,_0x50c94d,!![]);}catch(_0x3ab477){return BPromise['reject'](_0x3ab477);}return _0x2ab6f6[_0xf32a('0x1f')]();};}function saveUpdates(_0x14e118,_0x58be1a){return function(_0x597ac5){if(_0x597ac5){return _0x597ac5[_0xf32a('0x20')](_0x14e118)['then'](function(_0x2e527f){return _0x2e527f;});}return null;};}function removeEntity(_0x92667e,_0x1b5dd1){return function(_0x394f9c){if(_0x394f9c){return _0x394f9c[_0xf32a('0x21')]()[_0xf32a('0x22')](function(){var _0x57f946=_0x394f9c['get']({'plain':!![]});var _0x47b1e5='Triggers';return db['UserProfileResource']['destroy']({'where':{'type':_0x47b1e5,'resourceId':_0x57f946['id']}})[_0xf32a('0x22')](function(){return _0x394f9c;});})[_0xf32a('0x22')](function(){_0x92667e['status'](0xcc)[_0xf32a('0x18')]();});}};}function handleEntityNotFound(_0x434aef,_0x1dc269){return function(_0x25b205){if(!_0x25b205){_0x434aef[_0xf32a('0x23')](0x194);}return _0x25b205;};}function handleError(_0x5ab486,_0x3a690c){_0x3a690c=_0x3a690c||0x1f4;return function(_0x300ef7){logger[_0xf32a('0x24')](_0x300ef7[_0xf32a('0x25')]);if(_0x300ef7[_0xf32a('0x26')]){delete _0x300ef7[_0xf32a('0x26')];}_0x5ab486[_0xf32a('0x17')](_0x3a690c)[_0xf32a('0x27')](_0x300ef7);};}exports[_0xf32a('0x28')]=function(_0xc9e461,_0x244c1d){var _0x3a1202={},_0x1d58dc={},_0x582b0c={'count':0x0,'rows':[]};var _0x24549f=_['map'](db[_0xf32a('0x29')][_0xf32a('0x2a')],function(_0x359138){return{'name':_0x359138['fieldName'],'type':_0x359138[_0xf32a('0x2b')][_0xf32a('0x2c')]};});_0x1d58dc[_0xf32a('0x2d')]=_[_0xf32a('0x2e')](_0x24549f,_0xf32a('0x26'));_0x1d58dc[_0xf32a('0x2f')]=_[_0xf32a('0x30')](_0xc9e461[_0xf32a('0x2f')]);_0x1d58dc['filters']=_[_0xf32a('0x31')](_0x1d58dc[_0xf32a('0x2d')],_0x1d58dc['query']);_0x3a1202[_0xf32a('0x32')]=_[_0xf32a('0x31')](_0x1d58dc[_0xf32a('0x2d')],qs[_0xf32a('0x33')](_0xc9e461[_0xf32a('0x2f')][_0xf32a('0x33')]));_0x3a1202[_0xf32a('0x32')]=_0x3a1202['attributes'][_0xf32a('0x34')]?_0x3a1202['attributes']:_0x1d58dc['model'];if(!_0xc9e461['query'][_0xf32a('0x35')](_0xf32a('0x36'))){_0x3a1202[_0xf32a('0x1c')]=qs[_0xf32a('0x1c')](_0xc9e461['query'][_0xf32a('0x1c')]);_0x3a1202[_0xf32a('0x1a')]=qs[_0xf32a('0x1a')](_0xc9e461[_0xf32a('0x2f')]['offset']);}_0x3a1202[_0xf32a('0x37')]=qs[_0xf32a('0x38')](_0xc9e461[_0xf32a('0x2f')]['sort']);_0x3a1202['where']=qs[_0xf32a('0x39')](_['pick'](_0xc9e461[_0xf32a('0x2f')],_0x1d58dc[_0xf32a('0x39')]),_0x24549f);if(_0xc9e461[_0xf32a('0x2f')][_0xf32a('0x3a')]){_0x3a1202[_0xf32a('0x3b')]=_[_0xf32a('0x3c')](_0x3a1202[_0xf32a('0x3b')],{'$or':_[_0xf32a('0x2e')](_0x24549f,function(_0x3e16d0){if(_0x3e16d0[_0xf32a('0x2b')]!==_0xf32a('0x3d')){var _0x4de0ac={};_0x4de0ac[_0x3e16d0['name']]={'$like':'%'+_0xc9e461[_0xf32a('0x2f')][_0xf32a('0x3a')]+'%'};return _0x4de0ac;}})});}_0x3a1202=_[_0xf32a('0x3c')]({},_0x3a1202,_0xc9e461[_0xf32a('0x3e')]);var _0x385693={'where':_0x3a1202['where']};return db[_0xf32a('0x29')][_0xf32a('0x1d')](_0x385693)[_0xf32a('0x22')](function(_0x1f1c1f){_0x582b0c[_0xf32a('0x1d')]=_0x1f1c1f;if(_0xc9e461[_0xf32a('0x2f')]['includeAll']){_0x3a1202[_0xf32a('0x3f')]=[{'all':!![]}];}return db['Trigger'][_0xf32a('0x40')](_0x3a1202);})[_0xf32a('0x22')](function(_0x406f73){_0x582b0c[_0xf32a('0x41')]=_0x406f73;return _0x582b0c;})[_0xf32a('0x22')](respondWithFilteredResult(_0x244c1d,_0x3a1202))[_0xf32a('0x42')](handleError(_0x244c1d,null));};exports[_0xf32a('0x43')]=function(_0xbbaeaf,_0x3d9cdc){var _0x3fdc03={'raw':![],'where':{'id':_0xbbaeaf[_0xf32a('0x44')]['id']}},_0x3b0d44={};_0x3b0d44[_0xf32a('0x2d')]=_[_0xf32a('0x30')](db[_0xf32a('0x29')][_0xf32a('0x2a')]);_0x3b0d44[_0xf32a('0x2f')]=_[_0xf32a('0x30')](_0xbbaeaf['query']);_0x3b0d44[_0xf32a('0x39')]=_[_0xf32a('0x31')](_0x3b0d44['model'],_0x3b0d44[_0xf32a('0x2f')]);_0x3fdc03[_0xf32a('0x32')]=_['intersection'](_0x3b0d44[_0xf32a('0x2d')],qs[_0xf32a('0x33')](_0xbbaeaf[_0xf32a('0x2f')]['fields']));_0x3fdc03[_0xf32a('0x32')]=_0x3fdc03['attributes']['length']?_0x3fdc03[_0xf32a('0x32')]:_0x3b0d44[_0xf32a('0x2d')];if(_0xbbaeaf[_0xf32a('0x2f')][_0xf32a('0x45')]){_0x3fdc03[_0xf32a('0x3f')]=[{'all':!![]}];}_0x3fdc03=_[_0xf32a('0x3c')]({},_0x3fdc03,_0xbbaeaf['options']);return db['Trigger'][_0xf32a('0x46')](_0x3fdc03)['then'](handleEntityNotFound(_0x3d9cdc,null))[_0xf32a('0x22')](respondWithResult(_0x3d9cdc,null))['catch'](handleError(_0x3d9cdc,null));};exports[_0xf32a('0x47')]=function(_0x49289a,_0x51744e){return db['Trigger'][_0xf32a('0x47')](_0x49289a['body'],{})[_0xf32a('0x22')](function(_0x445a1f){var _0x5ace92=_0x49289a[_0xf32a('0x48')]['get']({'plain':!![]});if(!_0x5ace92)throw new Error(_0xf32a('0x49'));if(_0x5ace92[_0xf32a('0x4a')]===_0xf32a('0x48')){var _0x249b73=_0x445a1f[_0xf32a('0x4b')]({'plain':!![]});var _0x519a8b=_0xf32a('0x4c');return db[_0xf32a('0x4d')][_0xf32a('0x46')]({'where':{'name':_0x519a8b,'userProfileId':_0x5ace92[_0xf32a('0x4e')]},'raw':!![]})[_0xf32a('0x22')](function(_0x1d6acb){if(_0x1d6acb&&_0x1d6acb[_0xf32a('0x4f')]===0x0){return db[_0xf32a('0x50')][_0xf32a('0x47')]({'name':_0x249b73[_0xf32a('0x26')],'resourceId':_0x249b73['id'],'type':_0x1d6acb[_0xf32a('0x26')],'sectionId':_0x1d6acb['id']},{})[_0xf32a('0x22')](function(){return _0x445a1f;});}else{return _0x445a1f;}})['catch'](function(_0x58e74d){logger[_0xf32a('0x24')](_0xf32a('0x51'),_0x58e74d);throw _0x58e74d;});}return _0x445a1f;})['then'](respondWithResult(_0x51744e,0xc9))[_0xf32a('0x42')](handleError(_0x51744e,null));};exports['update']=function(_0x5cdd80,_0x4b5436){if(_0x5cdd80['body']['id']){delete _0x5cdd80[_0xf32a('0x52')]['id'];}return db[_0xf32a('0x29')][_0xf32a('0x46')]({'where':{'id':_0x5cdd80[_0xf32a('0x44')]['id']}})[_0xf32a('0x22')](handleEntityNotFound(_0x4b5436,null))[_0xf32a('0x22')](saveUpdates(_0x5cdd80[_0xf32a('0x52')],null))['then'](respondWithResult(_0x4b5436,null))['catch'](handleError(_0x4b5436,null));};exports[_0xf32a('0x21')]=function(_0x1fbd2f,_0x542e97){return db[_0xf32a('0x29')][_0xf32a('0x46')]({'where':{'id':_0x1fbd2f[_0xf32a('0x44')]['id']}})[_0xf32a('0x22')](handleEntityNotFound(_0x542e97,null))['then'](removeEntity(_0x542e97,null))[_0xf32a('0x42')](handleError(_0x542e97,null));};exports[_0xf32a('0x53')]=function(_0x498de0,_0x270b51,_0x4ab7c2){if(_0x498de0[_0xf32a('0x52')]['id']){delete _0x498de0['body']['id'];}return db[_0xf32a('0x29')]['find']({'where':{'id':_0x498de0[_0xf32a('0x44')]['id']}})[_0xf32a('0x22')](handleEntityNotFound(_0x270b51,null))[_0xf32a('0x22')](function(_0x36385e){if(_0x36385e){_0x498de0[_0xf32a('0x52')][_0xf32a('0x54')]=_0x36385e['id'];return db[_0xf32a('0x55')][_0xf32a('0x47')](_0x498de0[_0xf32a('0x52')]);}})[_0xf32a('0x22')](respondWithResult(_0x270b51,null))[_0xf32a('0x42')](handleError(_0x270b51,null));};exports[_0xf32a('0x56')]=function(_0x4a9105,_0xae0e9d,_0x3363a4){if(_0x4a9105[_0xf32a('0x52')]['id']){delete _0x4a9105[_0xf32a('0x52')]['id'];}return db[_0xf32a('0x29')][_0xf32a('0x46')]({'where':{'id':_0x4a9105[_0xf32a('0x44')]['id']}})[_0xf32a('0x22')](handleEntityNotFound(_0xae0e9d,null))['then'](function(_0x371fc2){if(_0x371fc2){_0x4a9105[_0xf32a('0x52')]['TriggerAnyId']=_0x371fc2['id'];return db['Condition'][_0xf32a('0x47')](_0x4a9105[_0xf32a('0x52')]);}})[_0xf32a('0x22')](respondWithResult(_0xae0e9d,null))['catch'](handleError(_0xae0e9d,null));};exports[_0xf32a('0x57')]=function(_0x1fbd6f,_0x116670,_0x5058eb){var _0xab5924={};var _0x202693={};var _0x1df60b;var _0x1d3535;return db[_0xf32a('0x29')][_0xf32a('0x58')]({'where':{'id':_0x1fbd6f['params']['id']}})[_0xf32a('0x22')](handleEntityNotFound(_0x116670,null))[_0xf32a('0x22')](function(_0x1b8a10){if(_0x1b8a10){_0x1df60b=_0x1b8a10;_0x202693['model']=_[_0xf32a('0x30')](db[_0xf32a('0x55')][_0xf32a('0x2a')]);_0x202693[_0xf32a('0x2f')]=_[_0xf32a('0x30')](_0x1fbd6f[_0xf32a('0x2f')]);_0x202693[_0xf32a('0x39')]=_[_0xf32a('0x31')](_0x202693[_0xf32a('0x2d')],_0x202693[_0xf32a('0x2f')]);_0xab5924['attributes']=_['intersection'](_0x202693['model'],qs[_0xf32a('0x33')](_0x1fbd6f[_0xf32a('0x2f')][_0xf32a('0x33')]));_0xab5924[_0xf32a('0x32')]=_0xab5924['attributes'][_0xf32a('0x34')]?_0xab5924[_0xf32a('0x32')]:_0x202693[_0xf32a('0x2d')];_0xab5924[_0xf32a('0x37')]=qs[_0xf32a('0x38')](_0x1fbd6f[_0xf32a('0x2f')]['sort']);_0xab5924[_0xf32a('0x3b')]=qs[_0xf32a('0x39')](_[_0xf32a('0x59')](_0x1fbd6f[_0xf32a('0x2f')],_0x202693[_0xf32a('0x39')]));if(_0x1fbd6f[_0xf32a('0x2f')][_0xf32a('0x3a')]){_0xab5924['where']=_[_0xf32a('0x3c')](_0xab5924[_0xf32a('0x3b')],{'$or':_[_0xf32a('0x2e')](_0xab5924[_0xf32a('0x32')],function(_0x47daa0){var _0x137fd7={};_0x137fd7[_0x47daa0]={'$like':'%'+_0x1fbd6f[_0xf32a('0x2f')][_0xf32a('0x3a')]+'%'};return _0x137fd7;})});}_0xab5924=_['merge']({},_0xab5924,_0x1fbd6f[_0xf32a('0x3e')]);return _0x1df60b[_0xf32a('0x57')](_0xab5924);}})[_0xf32a('0x22')](function(_0xcb9c0a){if(_0xcb9c0a){_0x1d3535=_0xcb9c0a['length'];if(!_0x1fbd6f[_0xf32a('0x2f')][_0xf32a('0x35')](_0xf32a('0x36'))){_0xab5924[_0xf32a('0x1c')]=qs[_0xf32a('0x1c')](_0x1fbd6f['query'][_0xf32a('0x1c')]);_0xab5924['offset']=qs[_0xf32a('0x1a')](_0x1fbd6f[_0xf32a('0x2f')][_0xf32a('0x1a')]);}return _0x1df60b[_0xf32a('0x57')](_0xab5924);}})[_0xf32a('0x22')](function(_0x4975f4){if(_0x4975f4){return _0x4975f4?{'count':_0x1d3535,'rows':_0x4975f4}:null;}})['then'](respondWithResult(_0x116670,null))['catch'](handleError(_0x116670,null));};exports[_0xf32a('0x5a')]=function(_0x4a462c,_0x7910ad,_0x4f7b91){var _0x143dac={};var _0x31cfbc={};var _0xa47070;var _0x4be4ee;return db[_0xf32a('0x29')][_0xf32a('0x58')]({'where':{'id':_0x4a462c['params']['id']}})[_0xf32a('0x22')](handleEntityNotFound(_0x7910ad,null))['then'](function(_0x14efc4){if(_0x14efc4){_0xa47070=_0x14efc4;_0x31cfbc['model']=_['keys'](db[_0xf32a('0x55')][_0xf32a('0x2a')]);_0x31cfbc[_0xf32a('0x2f')]=_[_0xf32a('0x30')](_0x4a462c[_0xf32a('0x2f')]);_0x31cfbc[_0xf32a('0x39')]=_[_0xf32a('0x31')](_0x31cfbc[_0xf32a('0x2d')],_0x31cfbc[_0xf32a('0x2f')]);_0x143dac[_0xf32a('0x32')]=_[_0xf32a('0x31')](_0x31cfbc[_0xf32a('0x2d')],qs[_0xf32a('0x33')](_0x4a462c['query'][_0xf32a('0x33')]));_0x143dac[_0xf32a('0x32')]=_0x143dac[_0xf32a('0x32')][_0xf32a('0x34')]?_0x143dac[_0xf32a('0x32')]:_0x31cfbc['model'];_0x143dac[_0xf32a('0x37')]=qs['sort'](_0x4a462c[_0xf32a('0x2f')][_0xf32a('0x38')]);_0x143dac[_0xf32a('0x3b')]=qs[_0xf32a('0x39')](_[_0xf32a('0x59')](_0x4a462c['query'],_0x31cfbc[_0xf32a('0x39')]));if(_0x4a462c[_0xf32a('0x2f')][_0xf32a('0x3a')]){_0x143dac[_0xf32a('0x3b')]=_[_0xf32a('0x3c')](_0x143dac[_0xf32a('0x3b')],{'$or':_[_0xf32a('0x2e')](_0x143dac[_0xf32a('0x32')],function(_0x37d1dd){var _0x40c868={};_0x40c868[_0x37d1dd]={'$like':'%'+_0x4a462c[_0xf32a('0x2f')][_0xf32a('0x3a')]+'%'};return _0x40c868;})});}_0x143dac=_[_0xf32a('0x3c')]({},_0x143dac,_0x4a462c['options']);return _0xa47070['getAnyConditions'](_0x143dac);}})[_0xf32a('0x22')](function(_0x172648){if(_0x172648){_0x4be4ee=_0x172648['length'];if(!_0x4a462c[_0xf32a('0x2f')][_0xf32a('0x35')](_0xf32a('0x36'))){_0x143dac['limit']=qs[_0xf32a('0x1c')](_0x4a462c[_0xf32a('0x2f')]['limit']);_0x143dac[_0xf32a('0x1a')]=qs[_0xf32a('0x1a')](_0x4a462c[_0xf32a('0x2f')][_0xf32a('0x1a')]);}return _0xa47070['getAnyConditions'](_0x143dac);}})[_0xf32a('0x22')](function(_0x2a05aa){if(_0x2a05aa){return _0x2a05aa?{'count':_0x4be4ee,'rows':_0x2a05aa}:null;}})[_0xf32a('0x22')](respondWithResult(_0x7910ad,null))[_0xf32a('0x42')](handleError(_0x7910ad,null));};exports['addAction']=function(_0x3ff7a8,_0x212a20,_0x13837d){if(_0x3ff7a8[_0xf32a('0x52')]['id']){delete _0x3ff7a8[_0xf32a('0x52')]['id'];}return db[_0xf32a('0x29')][_0xf32a('0x46')]({'where':{'id':_0x3ff7a8[_0xf32a('0x44')]['id']}})[_0xf32a('0x22')](handleEntityNotFound(_0x212a20,null))['then'](function(_0x1b3fb7){if(_0x1b3fb7){_0x3ff7a8[_0xf32a('0x52')][_0xf32a('0x5b')]=_0x1b3fb7['id'];return db[_0xf32a('0x5c')]['create'](_0x3ff7a8[_0xf32a('0x52')]);}})[_0xf32a('0x22')](respondWithResult(_0x212a20,null))['catch'](handleError(_0x212a20,null));};exports[_0xf32a('0x5d')]=function(_0x2d86aa,_0x3a78bf,_0x17d181){var _0x5f36b7={};var _0x5dacf3={};var _0x28d20b;var _0x2a405d;return db['Trigger'][_0xf32a('0x58')]({'where':{'id':_0x2d86aa[_0xf32a('0x44')]['id']}})[_0xf32a('0x22')](handleEntityNotFound(_0x3a78bf,null))[_0xf32a('0x22')](function(_0x1c7810){if(_0x1c7810){_0x28d20b=_0x1c7810;_0x5dacf3['model']=_[_0xf32a('0x30')](db[_0xf32a('0x5c')][_0xf32a('0x2a')]);_0x5dacf3[_0xf32a('0x2f')]=_['keys'](_0x2d86aa['query']);_0x5dacf3[_0xf32a('0x39')]=_[_0xf32a('0x31')](_0x5dacf3[_0xf32a('0x2d')],_0x5dacf3['query']);_0x5f36b7[_0xf32a('0x32')]=_[_0xf32a('0x31')](_0x5dacf3[_0xf32a('0x2d')],qs[_0xf32a('0x33')](_0x2d86aa[_0xf32a('0x2f')][_0xf32a('0x33')]));_0x5f36b7['attributes']=_0x5f36b7['attributes'][_0xf32a('0x34')]?_0x5f36b7[_0xf32a('0x32')]:_0x5dacf3[_0xf32a('0x2d')];_0x5f36b7[_0xf32a('0x37')]=qs[_0xf32a('0x38')](_0x2d86aa[_0xf32a('0x2f')][_0xf32a('0x38')]);_0x5f36b7[_0xf32a('0x3b')]=qs[_0xf32a('0x39')](_[_0xf32a('0x59')](_0x2d86aa[_0xf32a('0x2f')],_0x5dacf3[_0xf32a('0x39')]));if(_0x2d86aa['query']['filter']){_0x5f36b7[_0xf32a('0x3b')]=_[_0xf32a('0x3c')](_0x5f36b7[_0xf32a('0x3b')],{'$or':_[_0xf32a('0x2e')](_0x5f36b7[_0xf32a('0x32')],function(_0x4c2fc4){var _0x8797d4={};_0x8797d4[_0x4c2fc4]={'$like':'%'+_0x2d86aa['query'][_0xf32a('0x3a')]+'%'};return _0x8797d4;})});}_0x5f36b7=_[_0xf32a('0x3c')]({},_0x5f36b7,_0x2d86aa['options']);return _0x28d20b[_0xf32a('0x5d')](_0x5f36b7);}})[_0xf32a('0x22')](function(_0x4320d0){if(_0x4320d0){_0x2a405d=_0x4320d0[_0xf32a('0x34')];if(!_0x2d86aa[_0xf32a('0x2f')][_0xf32a('0x35')](_0xf32a('0x36'))){_0x5f36b7[_0xf32a('0x1c')]=qs[_0xf32a('0x1c')](_0x2d86aa['query'][_0xf32a('0x1c')]);_0x5f36b7[_0xf32a('0x1a')]=qs['offset'](_0x2d86aa['query'][_0xf32a('0x1a')]);}return _0x28d20b[_0xf32a('0x5d')](_0x5f36b7);}})['then'](function(_0x5a7544){if(_0x5a7544){return _0x5a7544?{'count':_0x2a405d,'rows':_0x5a7544}:null;}})[_0xf32a('0x22')](respondWithResult(_0x3a78bf,null))[_0xf32a('0x42')](handleError(_0x3a78bf,null));}; \ No newline at end of file +var _0x8d68=['Condition','getAllConditions','findOne','nolimit','getAnyConditions','TriggerId','Action','getActions','rimraf','zip-dir','request-promise','bluebird','mustache','util','sox','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/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','save','destroy','then','get','UserProfileResource','stack','name','send','index','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','Triggers','UserProfileSection','userProfileId','autoAssociation','error','update','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId'];(function(_0x58f9d1,_0x8f60f7){var _0xe2a5b3=function(_0x39e205){while(--_0x39e205){_0x58f9d1['push'](_0x58f9d1['shift']());}};_0xe2a5b3(++_0x8f60f7);}(_0x8d68,0x67));var _0x88d6=function(_0x31c2a2,_0x235648){_0x31c2a2=_0x31c2a2-0x0;var _0x2eb751=_0x8d68[_0x31c2a2];return _0x2eb751;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x88d6('0x0'));var zipdir=require(_0x88d6('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x88d6('0x2'));var moment=require('moment');var BPromise=require(_0x88d6('0x3'));var Mustache=require(_0x88d6('0x4'));var util=require(_0x88d6('0x5'));var path=require('path');var sox=require(_0x88d6('0x6'));var csv=require(_0x88d6('0x7'));var ejs=require(_0x88d6('0x8'));var fs=require('fs');var fs_extra=require(_0x88d6('0x9'));var _=require(_0x88d6('0xa'));var squel=require(_0x88d6('0xb'));var crypto=require(_0x88d6('0xc'));var jsforce=require(_0x88d6('0xd'));var deskjs=require(_0x88d6('0xe'));var toCsv=require('to-csv');var querystring=require(_0x88d6('0xf'));var Papa=require(_0x88d6('0x10'));var Redis=require(_0x88d6('0x11'));var authService=require(_0x88d6('0x12'));var qs=require(_0x88d6('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x88d6('0x14'));var logger=require(_0x88d6('0x15'))(_0x88d6('0x16'));var utils=require('../../config/utils');var config=require(_0x88d6('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x88d6('0x18'))['db'];function respondWithStatusCode(_0x2e8dd8,_0x484598){_0x484598=_0x484598||0xcc;return function(_0x9ebd27){if(_0x9ebd27){return _0x2e8dd8[_0x88d6('0x19')](_0x484598);}return _0x2e8dd8[_0x88d6('0x1a')](_0x484598)[_0x88d6('0x1b')]();};}function respondWithResult(_0x544d31,_0x34ea66){_0x34ea66=_0x34ea66||0xc8;return function(_0x4852ba){if(_0x4852ba){return _0x544d31[_0x88d6('0x1a')](_0x34ea66)[_0x88d6('0x1c')](_0x4852ba);}};}function respondWithFilteredResult(_0x140aa0,_0x33abc7){return function(_0x518850){if(_0x518850){var _0x1a1667=typeof _0x33abc7[_0x88d6('0x1d')]===_0x88d6('0x1e')&&typeof _0x33abc7['limit']===_0x88d6('0x1e');var _0x4d2278=_0x518850[_0x88d6('0x1f')];var _0x569482=_0x1a1667?0x0:_0x33abc7[_0x88d6('0x1d')];var _0x289275=_0x1a1667?_0x518850[_0x88d6('0x1f')]:_0x33abc7['offset']+_0x33abc7[_0x88d6('0x20')];var _0x32a77a;if(_0x289275>=_0x4d2278){_0x289275=_0x4d2278;_0x32a77a=0xc8;}else{_0x32a77a=0xce;}_0x140aa0[_0x88d6('0x1a')](_0x32a77a);return _0x140aa0['set'](_0x88d6('0x21'),_0x569482+'-'+_0x289275+'/'+_0x4d2278)[_0x88d6('0x1c')](_0x518850);}return null;};}function patchUpdates(_0x18f25c){return function(_0x213c9e){try{jsonpatch[_0x88d6('0x22')](_0x213c9e,_0x18f25c,!![]);}catch(_0x3cb90c){return BPromise['reject'](_0x3cb90c);}return _0x213c9e[_0x88d6('0x23')]();};}function saveUpdates(_0x1b9b07,_0x380824){return function(_0x31223a){if(_0x31223a){return _0x31223a['update'](_0x1b9b07)['then'](function(_0x51574c){return _0x51574c;});}return null;};}function removeEntity(_0x3b1fe,_0x2e8fb8){return function(_0x4a11ea){if(_0x4a11ea){return _0x4a11ea[_0x88d6('0x24')]()[_0x88d6('0x25')](function(){var _0x27070f=_0x4a11ea[_0x88d6('0x26')]({'plain':!![]});var _0x28ac64='Triggers';return db[_0x88d6('0x27')][_0x88d6('0x24')]({'where':{'type':_0x28ac64,'resourceId':_0x27070f['id']}})[_0x88d6('0x25')](function(){return _0x4a11ea;});})['then'](function(){_0x3b1fe[_0x88d6('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x33aaed,_0x273f25){return function(_0x96823b){if(!_0x96823b){_0x33aaed[_0x88d6('0x19')](0x194);}return _0x96823b;};}function handleError(_0x408cfd,_0x201712){_0x201712=_0x201712||0x1f4;return function(_0x29e694){logger['error'](_0x29e694[_0x88d6('0x28')]);if(_0x29e694['name']){delete _0x29e694[_0x88d6('0x29')];}_0x408cfd[_0x88d6('0x1a')](_0x201712)[_0x88d6('0x2a')](_0x29e694);};}exports[_0x88d6('0x2b')]=function(_0x4721a2,_0x480b00){var _0x1f1fea={},_0x24df21={},_0x926a44={'count':0x0,'rows':[]};var _0x1929f8=_[_0x88d6('0x2c')](db[_0x88d6('0x2d')][_0x88d6('0x2e')],function(_0x45bcc1){return{'name':_0x45bcc1[_0x88d6('0x2f')],'type':_0x45bcc1[_0x88d6('0x30')][_0x88d6('0x31')]};});_0x24df21[_0x88d6('0x32')]=_[_0x88d6('0x2c')](_0x1929f8,_0x88d6('0x29'));_0x24df21[_0x88d6('0x33')]=_[_0x88d6('0x34')](_0x4721a2[_0x88d6('0x33')]);_0x24df21[_0x88d6('0x35')]=_[_0x88d6('0x36')](_0x24df21[_0x88d6('0x32')],_0x24df21[_0x88d6('0x33')]);_0x1f1fea['attributes']=_[_0x88d6('0x36')](_0x24df21[_0x88d6('0x32')],qs[_0x88d6('0x37')](_0x4721a2[_0x88d6('0x33')]['fields']));_0x1f1fea[_0x88d6('0x38')]=_0x1f1fea['attributes'][_0x88d6('0x39')]?_0x1f1fea[_0x88d6('0x38')]:_0x24df21['model'];if(!_0x4721a2[_0x88d6('0x33')][_0x88d6('0x3a')]('nolimit')){_0x1f1fea[_0x88d6('0x20')]=qs[_0x88d6('0x20')](_0x4721a2[_0x88d6('0x33')][_0x88d6('0x20')]);_0x1f1fea[_0x88d6('0x1d')]=qs[_0x88d6('0x1d')](_0x4721a2['query'][_0x88d6('0x1d')]);}_0x1f1fea[_0x88d6('0x3b')]=qs['sort'](_0x4721a2[_0x88d6('0x33')][_0x88d6('0x3c')]);_0x1f1fea[_0x88d6('0x3d')]=qs[_0x88d6('0x35')](_[_0x88d6('0x3e')](_0x4721a2[_0x88d6('0x33')],_0x24df21[_0x88d6('0x35')]),_0x1929f8);if(_0x4721a2[_0x88d6('0x33')][_0x88d6('0x3f')]){_0x1f1fea[_0x88d6('0x3d')]=_[_0x88d6('0x40')](_0x1f1fea[_0x88d6('0x3d')],{'$or':_[_0x88d6('0x2c')](_0x1929f8,function(_0x39a360){if(_0x39a360[_0x88d6('0x30')]!==_0x88d6('0x41')){var _0x406fa7={};_0x406fa7[_0x39a360[_0x88d6('0x29')]]={'$like':'%'+_0x4721a2['query']['filter']+'%'};return _0x406fa7;}})});}_0x1f1fea=_[_0x88d6('0x40')]({},_0x1f1fea,_0x4721a2[_0x88d6('0x42')]);var _0x419fc5={'where':_0x1f1fea[_0x88d6('0x3d')]};return db[_0x88d6('0x2d')]['count'](_0x419fc5)[_0x88d6('0x25')](function(_0x10b0b7){_0x926a44[_0x88d6('0x1f')]=_0x10b0b7;if(_0x4721a2[_0x88d6('0x33')][_0x88d6('0x43')]){_0x1f1fea[_0x88d6('0x44')]=[{'all':!![]}];}return db[_0x88d6('0x2d')]['findAll'](_0x1f1fea);})[_0x88d6('0x25')](function(_0x23c4c7){_0x926a44[_0x88d6('0x45')]=_0x23c4c7;return _0x926a44;})[_0x88d6('0x25')](respondWithFilteredResult(_0x480b00,_0x1f1fea))[_0x88d6('0x46')](handleError(_0x480b00,null));};exports['show']=function(_0x192091,_0x5f2d1b){var _0x2c78c4={'raw':![],'where':{'id':_0x192091[_0x88d6('0x47')]['id']}},_0x16a7ec={};_0x16a7ec[_0x88d6('0x32')]=_[_0x88d6('0x34')](db[_0x88d6('0x2d')][_0x88d6('0x2e')]);_0x16a7ec[_0x88d6('0x33')]=_[_0x88d6('0x34')](_0x192091[_0x88d6('0x33')]);_0x16a7ec[_0x88d6('0x35')]=_[_0x88d6('0x36')](_0x16a7ec[_0x88d6('0x32')],_0x16a7ec[_0x88d6('0x33')]);_0x2c78c4['attributes']=_[_0x88d6('0x36')](_0x16a7ec[_0x88d6('0x32')],qs[_0x88d6('0x37')](_0x192091['query'][_0x88d6('0x37')]));_0x2c78c4['attributes']=_0x2c78c4[_0x88d6('0x38')][_0x88d6('0x39')]?_0x2c78c4[_0x88d6('0x38')]:_0x16a7ec[_0x88d6('0x32')];if(_0x192091['query'][_0x88d6('0x43')]){_0x2c78c4['include']=[{'all':!![]}];}_0x2c78c4=_['merge']({},_0x2c78c4,_0x192091[_0x88d6('0x42')]);return db['Trigger'][_0x88d6('0x48')](_0x2c78c4)[_0x88d6('0x25')](handleEntityNotFound(_0x5f2d1b,null))['then'](respondWithResult(_0x5f2d1b,null))[_0x88d6('0x46')](handleError(_0x5f2d1b,null));};exports[_0x88d6('0x49')]=function(_0x120bbb,_0x3788a9){return db[_0x88d6('0x2d')][_0x88d6('0x49')](_0x120bbb[_0x88d6('0x4a')],{})['then'](function(_0x3f8ed4){var _0x145bd9=_0x120bbb[_0x88d6('0x4b')]['get']({'plain':!![]});if(!_0x145bd9)throw new Error(_0x88d6('0x4c'));if(_0x145bd9['role']==='user'){var _0xbe25a5=_0x3f8ed4[_0x88d6('0x26')]({'plain':!![]});var _0x396822=_0x88d6('0x4d');return db[_0x88d6('0x4e')]['find']({'where':{'name':_0x396822,'userProfileId':_0x145bd9[_0x88d6('0x4f')]},'raw':!![]})[_0x88d6('0x25')](function(_0x195b0b){if(_0x195b0b&&_0x195b0b[_0x88d6('0x50')]===0x0){return db[_0x88d6('0x27')]['create']({'name':_0xbe25a5[_0x88d6('0x29')],'resourceId':_0xbe25a5['id'],'type':_0x195b0b[_0x88d6('0x29')],'sectionId':_0x195b0b['id']},{})[_0x88d6('0x25')](function(){return _0x3f8ed4;});}else{return _0x3f8ed4;}})[_0x88d6('0x46')](function(_0x24901c){logger[_0x88d6('0x51')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x24901c);throw _0x24901c;});}return _0x3f8ed4;})[_0x88d6('0x25')](respondWithResult(_0x3788a9,0xc9))[_0x88d6('0x46')](handleError(_0x3788a9,null));};exports[_0x88d6('0x52')]=function(_0x1c7fb0,_0x192fa7){if(_0x1c7fb0[_0x88d6('0x4a')]['id']){delete _0x1c7fb0['body']['id'];}return db['Trigger'][_0x88d6('0x48')]({'where':{'id':_0x1c7fb0[_0x88d6('0x47')]['id']}})['then'](handleEntityNotFound(_0x192fa7,null))[_0x88d6('0x25')](saveUpdates(_0x1c7fb0['body'],null))[_0x88d6('0x25')](respondWithResult(_0x192fa7,null))[_0x88d6('0x46')](handleError(_0x192fa7,null));};exports[_0x88d6('0x24')]=function(_0x10ea96,_0x126905){return db[_0x88d6('0x2d')][_0x88d6('0x48')]({'where':{'id':_0x10ea96[_0x88d6('0x47')]['id']}})[_0x88d6('0x25')](handleEntityNotFound(_0x126905,null))[_0x88d6('0x25')](removeEntity(_0x126905,null))[_0x88d6('0x46')](handleError(_0x126905,null));};exports[_0x88d6('0x53')]=function(_0x4a16a9,_0x31a361,_0x509f31){if(_0x4a16a9[_0x88d6('0x4a')]['id']){delete _0x4a16a9['body']['id'];}return db[_0x88d6('0x2d')][_0x88d6('0x48')]({'where':{'id':_0x4a16a9[_0x88d6('0x47')]['id']}})[_0x88d6('0x25')](handleEntityNotFound(_0x31a361,null))['then'](function(_0x40ef06){if(_0x40ef06){_0x4a16a9[_0x88d6('0x4a')][_0x88d6('0x54')]=_0x40ef06['id'];return db['Condition'][_0x88d6('0x49')](_0x4a16a9[_0x88d6('0x4a')]);}})[_0x88d6('0x25')](respondWithResult(_0x31a361,null))['catch'](handleError(_0x31a361,null));};exports[_0x88d6('0x55')]=function(_0x4cc042,_0x3117b7,_0x4986c6){if(_0x4cc042['body']['id']){delete _0x4cc042[_0x88d6('0x4a')]['id'];}return db[_0x88d6('0x2d')][_0x88d6('0x48')]({'where':{'id':_0x4cc042['params']['id']}})[_0x88d6('0x25')](handleEntityNotFound(_0x3117b7,null))['then'](function(_0x3cd32f){if(_0x3cd32f){_0x4cc042['body'][_0x88d6('0x56')]=_0x3cd32f['id'];return db[_0x88d6('0x57')]['create'](_0x4cc042[_0x88d6('0x4a')]);}})[_0x88d6('0x25')](respondWithResult(_0x3117b7,null))['catch'](handleError(_0x3117b7,null));};exports[_0x88d6('0x58')]=function(_0x24f12d,_0x5b3aad,_0x33d0c2){var _0x34f2a9={};var _0x22a445={};var _0x46c241;var _0x3c35ff;return db[_0x88d6('0x2d')][_0x88d6('0x59')]({'where':{'id':_0x24f12d[_0x88d6('0x47')]['id']}})['then'](handleEntityNotFound(_0x5b3aad,null))[_0x88d6('0x25')](function(_0x142e07){if(_0x142e07){_0x46c241=_0x142e07;_0x22a445[_0x88d6('0x32')]=_[_0x88d6('0x34')](db[_0x88d6('0x57')][_0x88d6('0x2e')]);_0x22a445['query']=_[_0x88d6('0x34')](_0x24f12d['query']);_0x22a445[_0x88d6('0x35')]=_[_0x88d6('0x36')](_0x22a445[_0x88d6('0x32')],_0x22a445[_0x88d6('0x33')]);_0x34f2a9['attributes']=_[_0x88d6('0x36')](_0x22a445[_0x88d6('0x32')],qs[_0x88d6('0x37')](_0x24f12d[_0x88d6('0x33')][_0x88d6('0x37')]));_0x34f2a9[_0x88d6('0x38')]=_0x34f2a9[_0x88d6('0x38')][_0x88d6('0x39')]?_0x34f2a9[_0x88d6('0x38')]:_0x22a445[_0x88d6('0x32')];_0x34f2a9[_0x88d6('0x3b')]=qs[_0x88d6('0x3c')](_0x24f12d['query'][_0x88d6('0x3c')]);_0x34f2a9[_0x88d6('0x3d')]=qs['filters'](_['pick'](_0x24f12d['query'],_0x22a445['filters']));if(_0x24f12d[_0x88d6('0x33')][_0x88d6('0x3f')]){_0x34f2a9['where']=_['merge'](_0x34f2a9[_0x88d6('0x3d')],{'$or':_[_0x88d6('0x2c')](_0x34f2a9[_0x88d6('0x38')],function(_0x5d5fca){var _0xeee79c={};_0xeee79c[_0x5d5fca]={'$like':'%'+_0x24f12d[_0x88d6('0x33')][_0x88d6('0x3f')]+'%'};return _0xeee79c;})});}_0x34f2a9=_[_0x88d6('0x40')]({},_0x34f2a9,_0x24f12d[_0x88d6('0x42')]);return _0x46c241[_0x88d6('0x58')](_0x34f2a9);}})[_0x88d6('0x25')](function(_0x28829c){if(_0x28829c){_0x3c35ff=_0x28829c[_0x88d6('0x39')];if(!_0x24f12d['query'][_0x88d6('0x3a')](_0x88d6('0x5a'))){_0x34f2a9['limit']=qs[_0x88d6('0x20')](_0x24f12d[_0x88d6('0x33')][_0x88d6('0x20')]);_0x34f2a9['offset']=qs[_0x88d6('0x1d')](_0x24f12d[_0x88d6('0x33')][_0x88d6('0x1d')]);}return _0x46c241['getAllConditions'](_0x34f2a9);}})[_0x88d6('0x25')](function(_0xea9079){if(_0xea9079){return _0xea9079?{'count':_0x3c35ff,'rows':_0xea9079}:null;}})[_0x88d6('0x25')](respondWithResult(_0x5b3aad,null))[_0x88d6('0x46')](handleError(_0x5b3aad,null));};exports[_0x88d6('0x5b')]=function(_0x316146,_0x2df487,_0x1b5892){var _0x62088e={};var _0x434bb5={};var _0x34c050;var _0x4441e6;return db[_0x88d6('0x2d')][_0x88d6('0x59')]({'where':{'id':_0x316146[_0x88d6('0x47')]['id']}})[_0x88d6('0x25')](handleEntityNotFound(_0x2df487,null))['then'](function(_0x36b53a){if(_0x36b53a){_0x34c050=_0x36b53a;_0x434bb5[_0x88d6('0x32')]=_[_0x88d6('0x34')](db[_0x88d6('0x57')][_0x88d6('0x2e')]);_0x434bb5['query']=_[_0x88d6('0x34')](_0x316146[_0x88d6('0x33')]);_0x434bb5[_0x88d6('0x35')]=_[_0x88d6('0x36')](_0x434bb5[_0x88d6('0x32')],_0x434bb5['query']);_0x62088e[_0x88d6('0x38')]=_[_0x88d6('0x36')](_0x434bb5[_0x88d6('0x32')],qs[_0x88d6('0x37')](_0x316146[_0x88d6('0x33')][_0x88d6('0x37')]));_0x62088e[_0x88d6('0x38')]=_0x62088e[_0x88d6('0x38')][_0x88d6('0x39')]?_0x62088e[_0x88d6('0x38')]:_0x434bb5['model'];_0x62088e[_0x88d6('0x3b')]=qs[_0x88d6('0x3c')](_0x316146[_0x88d6('0x33')][_0x88d6('0x3c')]);_0x62088e['where']=qs[_0x88d6('0x35')](_[_0x88d6('0x3e')](_0x316146[_0x88d6('0x33')],_0x434bb5[_0x88d6('0x35')]));if(_0x316146['query'][_0x88d6('0x3f')]){_0x62088e[_0x88d6('0x3d')]=_['merge'](_0x62088e[_0x88d6('0x3d')],{'$or':_['map'](_0x62088e['attributes'],function(_0x404e7e){var _0x371fec={};_0x371fec[_0x404e7e]={'$like':'%'+_0x316146[_0x88d6('0x33')][_0x88d6('0x3f')]+'%'};return _0x371fec;})});}_0x62088e=_['merge']({},_0x62088e,_0x316146[_0x88d6('0x42')]);return _0x34c050[_0x88d6('0x5b')](_0x62088e);}})[_0x88d6('0x25')](function(_0x17b671){if(_0x17b671){_0x4441e6=_0x17b671[_0x88d6('0x39')];if(!_0x316146[_0x88d6('0x33')][_0x88d6('0x3a')](_0x88d6('0x5a'))){_0x62088e[_0x88d6('0x20')]=qs['limit'](_0x316146[_0x88d6('0x33')]['limit']);_0x62088e[_0x88d6('0x1d')]=qs[_0x88d6('0x1d')](_0x316146[_0x88d6('0x33')][_0x88d6('0x1d')]);}return _0x34c050['getAnyConditions'](_0x62088e);}})[_0x88d6('0x25')](function(_0x380ad9){if(_0x380ad9){return _0x380ad9?{'count':_0x4441e6,'rows':_0x380ad9}:null;}})['then'](respondWithResult(_0x2df487,null))[_0x88d6('0x46')](handleError(_0x2df487,null));};exports['addAction']=function(_0x4075ab,_0x5dfff7,_0x30400d){if(_0x4075ab[_0x88d6('0x4a')]['id']){delete _0x4075ab[_0x88d6('0x4a')]['id'];}return db[_0x88d6('0x2d')][_0x88d6('0x48')]({'where':{'id':_0x4075ab[_0x88d6('0x47')]['id']}})[_0x88d6('0x25')](handleEntityNotFound(_0x5dfff7,null))['then'](function(_0x2efb19){if(_0x2efb19){_0x4075ab[_0x88d6('0x4a')][_0x88d6('0x5c')]=_0x2efb19['id'];return db[_0x88d6('0x5d')]['create'](_0x4075ab[_0x88d6('0x4a')]);}})['then'](respondWithResult(_0x5dfff7,null))[_0x88d6('0x46')](handleError(_0x5dfff7,null));};exports['getActions']=function(_0x341c0e,_0x3624bc,_0x57ee35){var _0x53ba6d={};var _0x1ce98a={};var _0x363ce9;var _0xcec57f;return db[_0x88d6('0x2d')][_0x88d6('0x59')]({'where':{'id':_0x341c0e['params']['id']}})[_0x88d6('0x25')](handleEntityNotFound(_0x3624bc,null))[_0x88d6('0x25')](function(_0x1a621b){if(_0x1a621b){_0x363ce9=_0x1a621b;_0x1ce98a[_0x88d6('0x32')]=_[_0x88d6('0x34')](db[_0x88d6('0x5d')]['rawAttributes']);_0x1ce98a[_0x88d6('0x33')]=_[_0x88d6('0x34')](_0x341c0e[_0x88d6('0x33')]);_0x1ce98a[_0x88d6('0x35')]=_[_0x88d6('0x36')](_0x1ce98a['model'],_0x1ce98a[_0x88d6('0x33')]);_0x53ba6d['attributes']=_[_0x88d6('0x36')](_0x1ce98a['model'],qs[_0x88d6('0x37')](_0x341c0e[_0x88d6('0x33')][_0x88d6('0x37')]));_0x53ba6d[_0x88d6('0x38')]=_0x53ba6d[_0x88d6('0x38')]['length']?_0x53ba6d[_0x88d6('0x38')]:_0x1ce98a[_0x88d6('0x32')];_0x53ba6d[_0x88d6('0x3b')]=qs[_0x88d6('0x3c')](_0x341c0e['query'][_0x88d6('0x3c')]);_0x53ba6d[_0x88d6('0x3d')]=qs[_0x88d6('0x35')](_[_0x88d6('0x3e')](_0x341c0e[_0x88d6('0x33')],_0x1ce98a[_0x88d6('0x35')]));if(_0x341c0e[_0x88d6('0x33')][_0x88d6('0x3f')]){_0x53ba6d[_0x88d6('0x3d')]=_[_0x88d6('0x40')](_0x53ba6d[_0x88d6('0x3d')],{'$or':_[_0x88d6('0x2c')](_0x53ba6d['attributes'],function(_0x3cd6eb){var _0x3040bd={};_0x3040bd[_0x3cd6eb]={'$like':'%'+_0x341c0e[_0x88d6('0x33')]['filter']+'%'};return _0x3040bd;})});}_0x53ba6d=_[_0x88d6('0x40')]({},_0x53ba6d,_0x341c0e[_0x88d6('0x42')]);return _0x363ce9[_0x88d6('0x5e')](_0x53ba6d);}})[_0x88d6('0x25')](function(_0x34acad){if(_0x34acad){_0xcec57f=_0x34acad[_0x88d6('0x39')];if(!_0x341c0e[_0x88d6('0x33')]['hasOwnProperty'](_0x88d6('0x5a'))){_0x53ba6d['limit']=qs[_0x88d6('0x20')](_0x341c0e['query'][_0x88d6('0x20')]);_0x53ba6d[_0x88d6('0x1d')]=qs[_0x88d6('0x1d')](_0x341c0e[_0x88d6('0x33')][_0x88d6('0x1d')]);}return _0x363ce9[_0x88d6('0x5e')](_0x53ba6d);}})['then'](function(_0x19407a){if(_0x19407a){return _0x19407a?{'count':_0xcec57f,'rows':_0x19407a}:null;}})[_0x88d6('0x25')](respondWithResult(_0x3624bc,null))[_0x88d6('0x46')](handleError(_0x3624bc,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index 9be168b..c65b2cf 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 _0xf822=['path','../../config/environment','./trigger.attributes','exports','Trigger','tools_triggers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0xfb0281,_0x3ff38b){var _0x408dd3=function(_0x5d8017){while(--_0x5d8017){_0xfb0281['push'](_0xfb0281['shift']());}};_0x408dd3(++_0x3ff38b);}(_0xf822,0x19e));var _0x2f82=function(_0x19cd08,_0x32b293){_0x19cd08=_0x19cd08-0x0;var _0x429c39=_0xf822[_0x19cd08];return _0x429c39;};'use strict';var _=require(_0x2f82('0x0'));var util=require('util');var logger=require(_0x2f82('0x1'))(_0x2f82('0x2'));var moment=require(_0x2f82('0x3'));var BPromise=require(_0x2f82('0x4'));var rp=require(_0x2f82('0x5'));var fs=require('fs');var path=require(_0x2f82('0x6'));var rimraf=require('rimraf');var config=require(_0x2f82('0x7'));var attributes=require(_0x2f82('0x8'));module[_0x2f82('0x9')]=function(_0x5b73e5,_0x360c8f){return _0x5b73e5['define'](_0x2f82('0xa'),attributes,{'tableName':_0x2f82('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5af0=['moment','bluebird','request-promise','path','../../config/environment','exports','Trigger','lodash','util','../../config/logger','api'];(function(_0x4213f3,_0xcb0c48){var _0x38c808=function(_0x32ce61){while(--_0x32ce61){_0x4213f3['push'](_0x4213f3['shift']());}};_0x38c808(++_0xcb0c48);}(_0x5af0,0x1eb));var _0x05af=function(_0x564cf3,_0x595b52){_0x564cf3=_0x564cf3-0x0;var _0x9cd21e=_0x5af0[_0x564cf3];return _0x9cd21e;};'use strict';var _=require(_0x05af('0x0'));var util=require(_0x05af('0x1'));var logger=require(_0x05af('0x2'))(_0x05af('0x3'));var moment=require(_0x05af('0x4'));var BPromise=require(_0x05af('0x5'));var rp=require(_0x05af('0x6'));var fs=require('fs');var path=require(_0x05af('0x7'));var rimraf=require('rimraf');var config=require(_0x05af('0x8'));var attributes=require('./trigger.attributes');module[_0x05af('0x9')]=function(_0x27a3e2,_0x2a8ef6){return _0x27a3e2['define'](_0x05af('0xa'),attributes,{'tableName':'tools_triggers','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 4f41e74..bd14039 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 _0x43ff=['result','catch','GetTrigger','Trigger','findAll','options','raw','map','include','attributes','model','find','where','debug','ShowTrigger','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xf938a0,_0x3c1f6f){var _0x7c8650=function(_0x3785d0){while(--_0x3785d0){_0xf938a0['push'](_0xf938a0['shift']());}};_0x7c8650(++_0x3c1f6f);}(_0x43ff,0xe1));var _0xf43f=function(_0x21549c,_0x6d64d1){_0x21549c=_0x21549c-0x0;var _0x426cbd=_0x43ff[_0x21549c];return _0x426cbd;};'use strict';var _=require(_0xf43f('0x0'));var util=require('util');var moment=require(_0xf43f('0x1'));var BPromise=require(_0xf43f('0x2'));var rs=require(_0xf43f('0x3'));var fs=require('fs');var Redis=require(_0xf43f('0x4'));var db=require(_0xf43f('0x5'))['db'];var utils=require(_0xf43f('0x6'));var logger=require(_0xf43f('0x7'))(_0xf43f('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xf43f('0x9')][_0xf43f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e5c64,_0x563346,_0xfca324){return new BPromise(function(_0x1f496b,_0x585de2){return client[_0xf43f('0xb')](_0x1e5c64,_0xfca324)[_0xf43f('0xc')](function(_0x2ab655){logger[_0xf43f('0xd')](_0xf43f('0xe'),_0x563346,_0xf43f('0xf'));logger['debug']('Trigger,\x20%s,\x20%s,\x20%s',_0x563346,_0xf43f('0xf'),JSON[_0xf43f('0x10')](_0x2ab655));if(_0x2ab655[_0xf43f('0x11')]){if(_0x2ab655[_0xf43f('0x11')][_0xf43f('0x12')]===0x1f4){logger['error']('Trigger,\x20%s,\x20%s',_0x563346,_0x2ab655[_0xf43f('0x11')][_0xf43f('0x13')]);return _0x585de2(_0x2ab655[_0xf43f('0x11')][_0xf43f('0x13')]);}logger[_0xf43f('0x11')](_0xf43f('0xe'),_0x563346,_0x2ab655[_0xf43f('0x11')][_0xf43f('0x13')]);return _0x1f496b(_0x2ab655['error'][_0xf43f('0x13')]);}else{logger['info']('Trigger,\x20%s,\x20%s',_0x563346,_0xf43f('0xf'));_0x1f496b(_0x2ab655[_0xf43f('0x14')][_0xf43f('0x13')]);}})[_0xf43f('0x15')](function(_0x24fd60){logger[_0xf43f('0x11')](_0xf43f('0xe'),_0x563346,_0x24fd60);_0x585de2(_0x24fd60);});});}exports[_0xf43f('0x16')]=function(_0x533eaa){var _0x1f3c4c=this;return new Promise(function(_0x3c750b,_0x4ed922){return db[_0xf43f('0x17')][_0xf43f('0x18')]({'raw':_0x533eaa['options']?_0x533eaa[_0xf43f('0x19')][_0xf43f('0x1a')]===undefined?!![]:![]:!![],'where':_0x533eaa[_0xf43f('0x19')]?_0x533eaa['options']['where']||null:null,'attributes':_0x533eaa[_0xf43f('0x19')]?_0x533eaa['options']['attributes']||null:null,'limit':_0x533eaa['options']?_0x533eaa[_0xf43f('0x19')]['limit']||null:null,'include':_0x533eaa[_0xf43f('0x19')]?_0x533eaa['options']['include']?_[_0xf43f('0x1b')](_0x533eaa[_0xf43f('0x19')][_0xf43f('0x1c')],function(_0x42e47c){return{'model':db[_0x42e47c['model']],'as':_0x42e47c['as'],'attributes':_0x42e47c[_0xf43f('0x1d')],'include':_0x42e47c[_0xf43f('0x1c')]?_[_0xf43f('0x1b')](_0x42e47c[_0xf43f('0x1c')],function(_0x152389){return{'model':db[_0x152389[_0xf43f('0x1e')]],'as':_0x152389['as'],'attributes':_0x152389[_0xf43f('0x1d')],'include':_0x152389[_0xf43f('0x1c')]?_[_0xf43f('0x1b')](_0x152389['include'],function(_0x1be7ae){return{'model':db[_0x1be7ae[_0xf43f('0x1e')]],'as':_0x1be7ae['as'],'attributes':_0x1be7ae[_0xf43f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf43f('0xc')](function(_0x18a432){logger['info'](_0xf43f('0x16'),_0x533eaa);logger['debug']('GetTrigger',_0x533eaa,JSON['stringify'](_0x18a432));_0x3c750b(_0x18a432);})[_0xf43f('0x15')](function(_0x353d94){logger[_0xf43f('0x11')]('GetTrigger',_0x353d94[_0xf43f('0x13')],_0x533eaa);_0x4ed922(_0x1f3c4c[_0xf43f('0x11')](0x1f4,_0x353d94[_0xf43f('0x13')]));});});};exports['ShowTrigger']=function(_0x448116){var _0x3033d7=this;return new Promise(function(_0x3c5d02,_0x77c40b){return db[_0xf43f('0x17')][_0xf43f('0x1f')]({'raw':_0x448116[_0xf43f('0x19')]?_0x448116['options'][_0xf43f('0x1a')]===undefined?!![]:![]:!![],'where':_0x448116['options']?_0x448116[_0xf43f('0x19')][_0xf43f('0x20')]||null:null,'attributes':_0x448116[_0xf43f('0x19')]?_0x448116[_0xf43f('0x19')]['attributes']||null:null,'include':_0x448116[_0xf43f('0x19')]?_0x448116[_0xf43f('0x19')][_0xf43f('0x1c')]?_['map'](_0x448116[_0xf43f('0x19')][_0xf43f('0x1c')],function(_0x4abb90){return{'model':db[_0x4abb90[_0xf43f('0x1e')]],'as':_0x4abb90['as'],'attributes':_0x4abb90['attributes'],'include':_0x4abb90[_0xf43f('0x1c')]?_['map'](_0x4abb90[_0xf43f('0x1c')],function(_0x1bed75){return{'model':db[_0x1bed75['model']],'as':_0x1bed75['as'],'attributes':_0x1bed75['attributes'],'include':_0x1bed75[_0xf43f('0x1c')]?_[_0xf43f('0x1b')](_0x1bed75['include'],function(_0x47ec39){return{'model':db[_0x47ec39['model']],'as':_0x47ec39['as'],'attributes':_0x47ec39[_0xf43f('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xf43f('0xc')](function(_0x26281e){logger[_0xf43f('0xd')]('ShowTrigger',_0x448116);logger[_0xf43f('0x21')](_0xf43f('0x22'),_0x448116,JSON[_0xf43f('0x10')](_0x26281e));_0x3c5d02(_0x26281e);})[_0xf43f('0x15')](function(_0x32b476){logger[_0xf43f('0x11')](_0xf43f('0x22'),_0x32b476[_0xf43f('0x13')],_0x448116);_0x77c40b(_0x3033d7[_0xf43f('0x11')](0x1f4,_0x32b476[_0xf43f('0x13')]));});});}; \ No newline at end of file +var _0xcf35=['debug','Trigger,\x20%s,\x20%s,\x20%s','stringify','code','error','Trigger,\x20%s,\x20%s','message','info','result','Trigger','findAll','options','raw','where','attributes','limit','map','include','model','GetTrigger','catch','find','ShowTrigger','lodash','util','moment','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','client','http','request','then','request\x20sent'];(function(_0x25f9cf,_0x250ac1){var _0x437b01=function(_0x54404f){while(--_0x54404f){_0x25f9cf['push'](_0x25f9cf['shift']());}};_0x437b01(++_0x250ac1);}(_0xcf35,0x1c7));var _0x5cf3=function(_0x49d280,_0x33d68f){_0x49d280=_0x49d280-0x0;var _0x25274a=_0xcf35[_0x49d280];return _0x25274a;};'use strict';var _=require(_0x5cf3('0x0'));var util=require(_0x5cf3('0x1'));var moment=require(_0x5cf3('0x2'));var BPromise=require('bluebird');var rs=require(_0x5cf3('0x3'));var fs=require('fs');var Redis=require(_0x5cf3('0x4'));var db=require(_0x5cf3('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x5cf3('0x6'));var config=require('../../config/environment');var jayson=require(_0x5cf3('0x7'));var client=jayson[_0x5cf3('0x8')][_0x5cf3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x491bfe,_0x2ceb82,_0xac7260){return new BPromise(function(_0x46139d,_0x1c425f){return client[_0x5cf3('0xa')](_0x491bfe,_0xac7260)[_0x5cf3('0xb')](function(_0x128136){logger['info']('Trigger,\x20%s,\x20%s',_0x2ceb82,_0x5cf3('0xc'));logger[_0x5cf3('0xd')](_0x5cf3('0xe'),_0x2ceb82,'request\x20sent',JSON[_0x5cf3('0xf')](_0x128136));if(_0x128136['error']){if(_0x128136['error'][_0x5cf3('0x10')]===0x1f4){logger[_0x5cf3('0x11')](_0x5cf3('0x12'),_0x2ceb82,_0x128136[_0x5cf3('0x11')][_0x5cf3('0x13')]);return _0x1c425f(_0x128136[_0x5cf3('0x11')][_0x5cf3('0x13')]);}logger[_0x5cf3('0x11')](_0x5cf3('0x12'),_0x2ceb82,_0x128136[_0x5cf3('0x11')]['message']);return _0x46139d(_0x128136[_0x5cf3('0x11')][_0x5cf3('0x13')]);}else{logger[_0x5cf3('0x14')](_0x5cf3('0x12'),_0x2ceb82,_0x5cf3('0xc'));_0x46139d(_0x128136[_0x5cf3('0x15')][_0x5cf3('0x13')]);}})['catch'](function(_0x4413cd){logger[_0x5cf3('0x11')](_0x5cf3('0x12'),_0x2ceb82,_0x4413cd);_0x1c425f(_0x4413cd);});});}exports['GetTrigger']=function(_0x51945e){var _0x5c133d=this;return new Promise(function(_0x2c688e,_0xd83bce){return db[_0x5cf3('0x16')][_0x5cf3('0x17')]({'raw':_0x51945e[_0x5cf3('0x18')]?_0x51945e[_0x5cf3('0x18')][_0x5cf3('0x19')]===undefined?!![]:![]:!![],'where':_0x51945e['options']?_0x51945e[_0x5cf3('0x18')][_0x5cf3('0x1a')]||null:null,'attributes':_0x51945e['options']?_0x51945e[_0x5cf3('0x18')][_0x5cf3('0x1b')]||null:null,'limit':_0x51945e[_0x5cf3('0x18')]?_0x51945e[_0x5cf3('0x18')][_0x5cf3('0x1c')]||null:null,'include':_0x51945e[_0x5cf3('0x18')]?_0x51945e['options']['include']?_[_0x5cf3('0x1d')](_0x51945e['options'][_0x5cf3('0x1e')],function(_0x431595){return{'model':db[_0x431595[_0x5cf3('0x1f')]],'as':_0x431595['as'],'attributes':_0x431595[_0x5cf3('0x1b')],'include':_0x431595[_0x5cf3('0x1e')]?_['map'](_0x431595['include'],function(_0x400556){return{'model':db[_0x400556[_0x5cf3('0x1f')]],'as':_0x400556['as'],'attributes':_0x400556['attributes'],'include':_0x400556[_0x5cf3('0x1e')]?_[_0x5cf3('0x1d')](_0x400556[_0x5cf3('0x1e')],function(_0xdffe9b){return{'model':db[_0xdffe9b['model']],'as':_0xdffe9b['as'],'attributes':_0xdffe9b[_0x5cf3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5cf3('0xb')](function(_0x30424e){logger['info'](_0x5cf3('0x20'),_0x51945e);logger[_0x5cf3('0xd')](_0x5cf3('0x20'),_0x51945e,JSON[_0x5cf3('0xf')](_0x30424e));_0x2c688e(_0x30424e);})[_0x5cf3('0x21')](function(_0x2ea860){logger[_0x5cf3('0x11')](_0x5cf3('0x20'),_0x2ea860['message'],_0x51945e);_0xd83bce(_0x5c133d[_0x5cf3('0x11')](0x1f4,_0x2ea860[_0x5cf3('0x13')]));});});};exports['ShowTrigger']=function(_0x3d674a){var _0x250879=this;return new Promise(function(_0x4b31c5,_0xd23a39){return db[_0x5cf3('0x16')][_0x5cf3('0x22')]({'raw':_0x3d674a[_0x5cf3('0x18')]?_0x3d674a[_0x5cf3('0x18')][_0x5cf3('0x19')]===undefined?!![]:![]:!![],'where':_0x3d674a['options']?_0x3d674a['options'][_0x5cf3('0x1a')]||null:null,'attributes':_0x3d674a[_0x5cf3('0x18')]?_0x3d674a[_0x5cf3('0x18')]['attributes']||null:null,'include':_0x3d674a[_0x5cf3('0x18')]?_0x3d674a[_0x5cf3('0x18')][_0x5cf3('0x1e')]?_[_0x5cf3('0x1d')](_0x3d674a[_0x5cf3('0x18')][_0x5cf3('0x1e')],function(_0x3cc411){return{'model':db[_0x3cc411[_0x5cf3('0x1f')]],'as':_0x3cc411['as'],'attributes':_0x3cc411[_0x5cf3('0x1b')],'include':_0x3cc411[_0x5cf3('0x1e')]?_['map'](_0x3cc411[_0x5cf3('0x1e')],function(_0x43211e){return{'model':db[_0x43211e[_0x5cf3('0x1f')]],'as':_0x43211e['as'],'attributes':_0x43211e[_0x5cf3('0x1b')],'include':_0x43211e['include']?_[_0x5cf3('0x1d')](_0x43211e['include'],function(_0x236588){return{'model':db[_0x236588[_0x5cf3('0x1f')]],'as':_0x236588['as'],'attributes':_0x236588[_0x5cf3('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x5cf3('0xb')](function(_0x5140ed){logger[_0x5cf3('0x14')](_0x5cf3('0x23'),_0x3d674a);logger[_0x5cf3('0xd')](_0x5cf3('0x23'),_0x3d674a,JSON[_0x5cf3('0xf')](_0x5140ed));_0x4b31c5(_0x5140ed);})[_0x5cf3('0x21')](function(_0x4d3fa2){logger[_0x5cf3('0x11')](_0x5cf3('0x23'),_0x4d3fa2['message'],_0x3d674a);_0xd23a39(_0x250879['error'](0x1f4,_0x4d3fa2[_0x5cf3('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 609f7ea..fc557e6 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 _0x7480=['update','delete','destroy','exports','multer','path','connect-timeout','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','isAuthenticated','index','get','/:id','show','post','/:id/clone','clone','create'];(function(_0x141b18,_0x4da875){var _0x4aaf16=function(_0x1fe47d){while(--_0x1fe47d){_0x141b18['push'](_0x141b18['shift']());}};_0x4aaf16(++_0x4da875);}(_0x7480,0x180));var _0x0748=function(_0x3002c0,_0x263672){_0x3002c0=_0x3002c0-0x0;var _0x5c2a7d=_0x7480[_0x3002c0];return _0x5c2a7d;};'use strict';var multer=require(_0x0748('0x0'));var util=require('util');var path=require(_0x0748('0x1'));var timeout=require(_0x0748('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x0748('0x3'));var auth=require(_0x0748('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x0748('0x5'));var controller=require(_0x0748('0x6'));router['get']('/',auth[_0x0748('0x7')](),controller[_0x0748('0x8')]);router[_0x0748('0x9')](_0x0748('0xa'),auth['isAuthenticated'](),controller[_0x0748('0xb')]);router[_0x0748('0xc')](_0x0748('0xd'),auth[_0x0748('0x7')](),controller[_0x0748('0xe')]);router[_0x0748('0xc')]('/',auth[_0x0748('0x7')](),controller[_0x0748('0xf')]);router['put'](_0x0748('0xa'),auth[_0x0748('0x7')](),controller[_0x0748('0x10')]);router[_0x0748('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x0748('0x12')]);module[_0x0748('0x13')]=router; \ No newline at end of file +var _0x76ef=['clone','create','put','/:id','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','/:id/clone'];(function(_0x37fc28,_0x28c9d9){var _0x4a6e4a=function(_0x41e3d5){while(--_0x41e3d5){_0x37fc28['push'](_0x37fc28['shift']());}};_0x4a6e4a(++_0x28c9d9);}(_0x76ef,0xf7));var _0xf76e=function(_0x1de5ca,_0x5eeceb){_0x1de5ca=_0x1de5ca-0x0;var _0x33b03e=_0x76ef[_0x1de5ca];return _0x33b03e;};'use strict';var multer=require(_0xf76e('0x0'));var util=require(_0xf76e('0x1'));var path=require(_0xf76e('0x2'));var timeout=require(_0xf76e('0x3'));var express=require('express');var router=express[_0xf76e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf76e('0x5'));var config=require(_0xf76e('0x6'));var controller=require('./trunk.controller');router[_0xf76e('0x7')]('/',auth[_0xf76e('0x8')](),controller[_0xf76e('0x9')]);router[_0xf76e('0x7')]('/:id',auth[_0xf76e('0x8')](),controller[_0xf76e('0xa')]);router[_0xf76e('0xb')](_0xf76e('0xc'),auth['isAuthenticated'](),controller[_0xf76e('0xd')]);router[_0xf76e('0xb')]('/',auth[_0xf76e('0x8')](),controller[_0xf76e('0xe')]);router[_0xf76e('0xf')](_0xf76e('0x10'),auth[_0xf76e('0x8')](),controller['update']);router[_0xf76e('0x11')](_0xf76e('0x10'),auth[_0xf76e('0x8')](),controller[_0xf76e('0x12')]);module[_0xf76e('0x13')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index 6b696da..7f9563a 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 _0x15c0=['outgoing','nat','split','all','allow','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','dynamic','BOOLEAN','exports','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','setDataValue','transport','join','getDataValue','info','shortinfo','inband','auto','yes','nonat','update'];(function(_0x21eeb4,_0x306590){var _0x12a3fb=function(_0x11a9fb){while(--_0x11a9fb){_0x21eeb4['push'](_0x21eeb4['shift']());}};_0x12a3fb(++_0x306590);}(_0x15c0,0xa0));var _0x015c=function(_0x2208d1,_0x35ac8e){_0x2208d1=_0x2208d1-0x0;var _0x208667=_0x15c0[_0x2208d1];return _0x208667;};'use strict';var Sequelize=require('sequelize');module[_0x015c('0x0')]={'name':{'type':Sequelize[_0x015c('0x1')],'allowNull':![],'unique':_0x015c('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x4'),_0x015c('0x5'),'peer'),'allowNull':![],'defaultValue':_0x015c('0x4')},'context':{'type':Sequelize[_0x015c('0x1')],'allowNull':![],'defaultValue':_0x015c('0x6')},'callingpres':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x7'),_0x015c('0x8'),'ALLOWED_FAILED_SCREEN',_0x015c('0x9'),_0x015c('0xa'),_0x015c('0xb'),'PROHIB_FAILED_SCREEN',_0x015c('0xc'))},'deny':{'type':Sequelize[_0x015c('0x1')]},'permit':{'type':Sequelize[_0x015c('0x1')]},'secret':{'type':Sequelize[_0x015c('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0x015c('0x1')]},'transport':{'type':Sequelize[_0x015c('0x1')],'defaultValue':'udp','set':function(_0x1ffc5d){this[_0x015c('0xd')](_0x015c('0xe'),_0x1ffc5d?_0x1ffc5d[_0x015c('0xf')](','):null);},'get':function(){return this[_0x015c('0x10')]('transport')?this['getDataValue'](_0x015c('0xe'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0x015c('0x3')]('rfc2833',_0x015c('0x11'),_0x015c('0x12'),_0x015c('0x13'),_0x015c('0x14')),'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no',_0x015c('0x16'),_0x015c('0x17'),_0x015c('0x18')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x015c('0x1')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0x015c('0x1')],'defaultValue':'force_rport,comedia','set':function(_0x161cda){this[_0x015c('0xd')]('nat',_0x161cda?_0x161cda[_0x015c('0xf')](','):null);},'get':function(){return this[_0x015c('0x10')]('nat')?this[_0x015c('0x10')](_0x015c('0x19'))[_0x015c('0x1a')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x015c('0x1')]},'namedcallgroup':{'type':Sequelize[_0x015c('0x1')]},'pickupgroup':{'type':Sequelize[_0x015c('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x015c('0x1')]},'language':{'type':Sequelize[_0x015c('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING'],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0x015c('0x1b')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x3942da){this['setDataValue'](_0x015c('0x1c'),_0x3942da?_0x3942da['join'](';'):'ulaw;alaw;gsm');},'get':function(){return this['getDataValue'](_0x015c('0x1c'))?this[_0x015c('0x10')](_0x015c('0x1c'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'insecure':{'type':Sequelize[_0x015c('0x1')],'defaultValue':'port,invite','set':function(_0xa1471d){this['setDataValue'](_0x015c('0x1d'),_0xa1471d?_0xa1471d[_0x015c('0xf')](','):null);},'get':function(){return this[_0x015c('0x10')](_0x015c('0x1d'))?this[_0x015c('0x10')]('insecure')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x015c('0x3')]('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x015c('0x3')]('yes','no',_0x015c('0x1e'))},'promiscredir':{'type':Sequelize[_0x015c('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'accountcode':{'type':Sequelize[_0x015c('0x1f')](0xb)},'setvar':{'type':Sequelize[_0x015c('0x1')]},'callerid':{'type':Sequelize[_0x015c('0x1')],'defaultValue':_0x015c('0x20')},'amaflags':{'type':Sequelize[_0x015c('0x1')]},'callcounter':{'type':Sequelize[_0x015c('0x3')]('yes','no'),'defaultValue':_0x015c('0x15')},'busylevel':{'type':Sequelize[_0x015c('0x1f')](0xb)},'allowoverlap':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'allowsubscribe':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'allowtransfer':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'ignoresdpversion':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'subscribecontext':{'type':Sequelize[_0x015c('0x1')]},'template':{'type':Sequelize[_0x015c('0x1')]},'videosupport':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no',_0x015c('0x21')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x015c('0x1f')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'mailbox':{'type':Sequelize['STRING']},'session_timers':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x22'),_0x015c('0x23'),_0x015c('0x24'))},'session_expires':{'type':Sequelize[_0x015c('0x1f')](0xb)},'session_minse':{'type':Sequelize[_0x015c('0x1f')](0xb)},'session_refresher':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x25'),'uas'),'defaultValue':_0x015c('0x26')},'t38pt_usertpsource':{'type':Sequelize[_0x015c('0x1')]},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0x015c('0x1')]},'port':{'type':Sequelize[_0x015c('0x1f')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0x015c('0x15'),'no'),'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x015c('0x1f')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0x015c('0x1')]},'rtptimeout':{'type':Sequelize[_0x015c('0x1f')](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x015c('0x1f')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x015c('0x1f')](0xb)},'sendrpid':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no',_0x015c('0x27')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING']},'callbackextension':{'type':Sequelize['STRING']},'timert1':{'type':Sequelize[_0x015c('0x1f')](0xb)},'timerb':{'type':Sequelize[_0x015c('0x1f')](0xb)},'qualifyfreq':{'type':Sequelize[_0x015c('0x1f')](0xb)},'contactpermit':{'type':Sequelize[_0x015c('0x1')]},'contactdeny':{'type':Sequelize[_0x015c('0x1')]},'contactacl':{'type':Sequelize['STRING']},'unsolicited_mailbox':{'type':Sequelize[_0x015c('0x1')]},'use_q850_reason':{'type':Sequelize[_0x015c('0x1')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'force_avp':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'icesupport':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'dtlsenable':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'dtlsverify':{'type':Sequelize[_0x015c('0x3')]('yes','no',_0x015c('0x28'),_0x015c('0x29'))},'dtlsrekey':{'type':Sequelize[_0x015c('0x1f')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x015c('0x1')]},'dtlscafile':{'type':Sequelize[_0x015c('0x1')]},'dtlscapath':{'type':Sequelize[_0x015c('0x1')]},'dtlssetup':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x2a'),_0x015c('0x2b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x015c('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x015c('0x15'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING']},'recordofffeature':{'type':Sequelize[_0x015c('0x1')]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0x015c('0x15'),'no')},'subscribemwi':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no')},'vmexten':{'type':Sequelize[_0x015c('0x1')]},'mohinterpret':{'type':Sequelize[_0x015c('0x1')]},'mohsuggest':{'type':Sequelize[_0x015c('0x1')]},'parkinglot':{'type':Sequelize[_0x015c('0x1')]},'description':{'type':Sequelize[_0x015c('0x1')]},'host':{'type':Sequelize['STRING'],'defaultValue':_0x015c('0x2c')},'canreinvite':{'type':Sequelize[_0x015c('0x3')](_0x015c('0x15'),'no','nonat','update','update,nonat'),'defaultValue':'no'},'registry':{'type':Sequelize[_0x015c('0x1')]},'otherFields':{'type':Sequelize[_0x015c('0x1')]},'active':{'type':Sequelize[_0x015c('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0x015c('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0xb1cb=['exports','STRING','name','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','PROHIB','udp','setDataValue','transport','join','getDataValue','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','ENUM','rfc2833','info','shortinfo','auto','yes','update','outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','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<>','always','accept','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','nonat','update,nonat','BOOLEAN','sequelize'];(function(_0x3b1d68,_0xeb6d1f){var _0x3edccb=function(_0x32c6fe){while(--_0x32c6fe){_0x3b1d68['push'](_0x3b1d68['shift']());}};_0x3edccb(++_0xeb6d1f);}(_0xb1cb,0xdf));var _0xbb1c=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0xb1cb[_0x68c979];return _0x4f0001;};'use strict';var Sequelize=require(_0xbb1c('0x0'));module[_0xbb1c('0x1')]={'name':{'type':Sequelize[_0xbb1c('0x2')],'allowNull':![],'unique':_0xbb1c('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0xbb1c('0x4'),_0xbb1c('0x5'),_0xbb1c('0x6')),'allowNull':![],'defaultValue':_0xbb1c('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xbb1c('0x7')},'callingpres':{'type':Sequelize['ENUM'](_0xbb1c('0x8'),_0xbb1c('0x9'),_0xbb1c('0xa'),'ALLOWED',_0xbb1c('0xb'),_0xbb1c('0xc'),_0xbb1c('0xd'),_0xbb1c('0xe'))},'deny':{'type':Sequelize[_0xbb1c('0x2')]},'permit':{'type':Sequelize[_0xbb1c('0x2')]},'secret':{'type':Sequelize[_0xbb1c('0x2')]},'md5secret':{'type':Sequelize[_0xbb1c('0x2')]},'remotesecret':{'type':Sequelize[_0xbb1c('0x2')]},'transport':{'type':Sequelize[_0xbb1c('0x2')],'defaultValue':_0xbb1c('0xf'),'set':function(_0x4053c8){this[_0xbb1c('0x10')](_0xbb1c('0x11'),_0x4053c8?_0x4053c8[_0xbb1c('0x12')](','):null);},'get':function(){return this[_0xbb1c('0x13')](_0xbb1c('0x11'))?this[_0xbb1c('0x13')](_0xbb1c('0x11'))[_0xbb1c('0x14')](','):null;},'comment':_0xbb1c('0x15')},'dtmfmode':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x17'),_0xbb1c('0x18'),_0xbb1c('0x19'),'inband',_0xbb1c('0x1a')),'defaultValue':_0xbb1c('0x17')},'directmedia':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no','nonat',_0xbb1c('0x1c'),_0xbb1c('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xbb1c('0x2')]},'directmediadeny':{'type':Sequelize['STRING']},'nat':{'type':Sequelize[_0xbb1c('0x2')],'defaultValue':_0xbb1c('0x1e'),'set':function(_0x5e72ab){this['setDataValue'](_0xbb1c('0x1f'),_0x5e72ab?_0x5e72ab['join'](','):null);},'get':function(){return this[_0xbb1c('0x13')]('nat')?this['getDataValue'](_0xbb1c('0x1f'))[_0xbb1c('0x14')](','):null;},'comment':_0xbb1c('0x20')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize[_0xbb1c('0x2')]},'namedpickupgroup':{'type':Sequelize[_0xbb1c('0x2')]},'language':{'type':Sequelize[_0xbb1c('0x2')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xbb1c('0x2')],'allowNull':!![]},'disallow':{'type':Sequelize['STRING'],'defaultValue':_0xbb1c('0x21')},'allow':{'type':Sequelize[_0xbb1c('0x2')],'allowNull':![],'defaultValue':_0xbb1c('0x22'),'set':function(_0x4d8845){this['setDataValue'](_0xbb1c('0x23'),_0x4d8845?_0x4d8845['join'](';'):_0xbb1c('0x22'));},'get':function(){return this[_0xbb1c('0x13')](_0xbb1c('0x23'))?this[_0xbb1c('0x13')](_0xbb1c('0x23'))[_0xbb1c('0x14')](';'):null;},'comment':_0xbb1c('0x24')},'autoframing':{'type':Sequelize['ENUM'](_0xbb1c('0x1b'),'no')},'insecure':{'type':Sequelize[_0xbb1c('0x2')],'defaultValue':_0xbb1c('0x25'),'set':function(_0x1e5260){this['setDataValue'](_0xbb1c('0x26'),_0x1e5260?_0x1e5260[_0xbb1c('0x12')](','):null);},'get':function(){return this['getDataValue']('insecure')?this[_0xbb1c('0x13')](_0xbb1c('0x26'))[_0xbb1c('0x14')](','):null;},'comment':_0xbb1c('0x27')},'trustrpid':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no',_0xbb1c('0x28'))},'promiscredir':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'useclientcode':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'accountcode':{'type':Sequelize[_0xbb1c('0x29')](0xb)},'setvar':{'type':Sequelize[_0xbb1c('0x2')]},'callerid':{'type':Sequelize[_0xbb1c('0x2')],'defaultValue':_0xbb1c('0x2a')},'amaflags':{'type':Sequelize[_0xbb1c('0x2')]},'callcounter':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no'),'defaultValue':_0xbb1c('0x1b')},'busylevel':{'type':Sequelize[_0xbb1c('0x29')](0xb)},'allowoverlap':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'allowsubscribe':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'allowtransfer':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'ignoresdpversion':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'subscribecontext':{'type':Sequelize[_0xbb1c('0x2')]},'template':{'type':Sequelize[_0xbb1c('0x2')]},'videosupport':{'type':Sequelize['ENUM'](_0xbb1c('0x1b'),'no',_0xbb1c('0x2b')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xbb1c('0x29')](0xb)},'rfc2833compensate':{'type':Sequelize[_0xbb1c('0x16')]('yes','no')},'mailbox':{'type':Sequelize[_0xbb1c('0x2')]},'session_timers':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x2c'),'refuse','originate')},'session_expires':{'type':Sequelize['INTEGER'](0xb)},'session_minse':{'type':Sequelize[_0xbb1c('0x29')](0xb)},'session_refresher':{'type':Sequelize['ENUM']('uac','uas'),'defaultValue':_0xbb1c('0x2d')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize['STRING']},'fromdomain':{'type':Sequelize[_0xbb1c('0x2')]},'fromuser':{'type':Sequelize[_0xbb1c('0x2')]},'port':{'type':Sequelize[_0xbb1c('0x29')](0x5)},'qualify':{'type':Sequelize['ENUM'](_0xbb1c('0x1b'),'no'),'defaultValue':_0xbb1c('0x1b')},'keepalive':{'type':Sequelize[_0xbb1c('0x29')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xbb1c('0x2')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0xbb1c('0x29')](0xb)},'rtpkeepalive':{'type':Sequelize[_0xbb1c('0x29')](0xb)},'sendrpid':{'type':Sequelize[_0xbb1c('0x16')]('yes','no',_0xbb1c('0x2e')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xbb1c('0x2')]},'callbackextension':{'type':Sequelize[_0xbb1c('0x2')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0xbb1c('0x29')](0xb)},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xbb1c('0x2')]},'contactacl':{'type':Sequelize[_0xbb1c('0x2')]},'unsolicited_mailbox':{'type':Sequelize[_0xbb1c('0x2')]},'use_q850_reason':{'type':Sequelize[_0xbb1c('0x2')]},'maxforwards':{'type':Sequelize['INTEGER'](0xb)},'encryption':{'type':Sequelize[_0xbb1c('0x16')]('yes','no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'force_avp':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'icesupport':{'type':Sequelize[_0xbb1c('0x16')]('yes','no')},'dtlsenable':{'type':Sequelize['ENUM'](_0xbb1c('0x1b'),'no')},'dtlsverify':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no',_0xbb1c('0x2f'),_0xbb1c('0x30'))},'dtlsrekey':{'type':Sequelize[_0xbb1c('0x29')](0xb)},'dtlscertfile':{'type':Sequelize[_0xbb1c('0x2')]},'dtlsprivatekey':{'type':Sequelize[_0xbb1c('0x2')]},'dtlscipher':{'type':Sequelize[_0xbb1c('0x2')]},'dtlscafile':{'type':Sequelize[_0xbb1c('0x2')]},'dtlscapath':{'type':Sequelize[_0xbb1c('0x2')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xbb1c('0x31'),_0xbb1c('0x32'),_0xbb1c('0x33')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING']},'usereqphone':{'type':Sequelize['ENUM'](_0xbb1c('0x1b'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xbb1c('0x2')]},'recordofffeature':{'type':Sequelize[_0xbb1c('0x2')]},'call_limit':{'type':Sequelize[_0xbb1c('0x29')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'subscribemwi':{'type':Sequelize[_0xbb1c('0x16')](_0xbb1c('0x1b'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0xbb1c('0x2')]},'mohsuggest':{'type':Sequelize[_0xbb1c('0x2')]},'parkinglot':{'type':Sequelize[_0xbb1c('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize['STRING'],'defaultValue':_0xbb1c('0x34')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xbb1c('0x35'),_0xbb1c('0x1c'),_0xbb1c('0x36')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0xbb1c('0x2')]},'active':{'type':Sequelize[_0xbb1c('0x37')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xbb1c('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 9ef992b..cb2f48a 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 _0x81bd=['/etc/asterisk/sip_xcally_trunks.conf','registry','render','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','update','server/files/templates/trunk.ejs','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','lodash','jsforce','to-csv','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','jayson/promise','http','request','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\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','destroy','UserProfileResource','name','index','Trunk','rawAttributes','fieldName','key','model','map','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','clone','find','get','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Trunks','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readFileSync','join','root','server/files/templates/registry.ejs','utf8','writeFileSync'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x81bd,0x7c));var _0xd81b=function(_0x44bcb0,_0x235aa9){_0x44bcb0=_0x44bcb0-0x0;var _0xfaf881=_0x81bd[_0x44bcb0];return _0xfaf881;};'use strict';var emlformat=require(_0xd81b('0x0'));var rimraf=require(_0xd81b('0x1'));var zipdir=require(_0xd81b('0x2'));var jsonpatch=require(_0xd81b('0x3'));var rp=require(_0xd81b('0x4'));var moment=require(_0xd81b('0x5'));var BPromise=require(_0xd81b('0x6'));var Mustache=require('mustache');var util=require(_0xd81b('0x7'));var path=require(_0xd81b('0x8'));var sox=require(_0xd81b('0x9'));var csv=require('to-csv');var ejs=require(_0xd81b('0xa'));var fs=require('fs');var fs_extra=require(_0xd81b('0xb'));var _=require(_0xd81b('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xd81b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd81b('0xe'));var querystring=require(_0xd81b('0xf'));var Papa=require(_0xd81b('0x10'));var Redis=require(_0xd81b('0x11'));var authService=require(_0xd81b('0x12'));var qs=require(_0xd81b('0x13'));var as=require(_0xd81b('0x14'));var hardwareService=require(_0xd81b('0x15'));var logger=require(_0xd81b('0x16'))(_0xd81b('0x17'));var utils=require(_0xd81b('0x18'));var config=require(_0xd81b('0x19'));var licenseUtil=require(_0xd81b('0x1a'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd81b('0x1b'));var client=jayson['client'][_0xd81b('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0xe75568,_0x5f0b6b,_0x35a053,_0x47dd04){return new BPromise(function(_0x13dd00,_0x41bf7a){var _0x6c6041=_0x47dd04||client;return _0x6c6041[_0xd81b('0x1d')](_0xe75568,_0x35a053)[_0xd81b('0x1e')](function(_0x552215){logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');logger[_0xd81b('0x21')](_0xd81b('0x22'),_0x5f0b6b,_0xd81b('0x23'),JSON[_0xd81b('0x24')](_0x552215));if(_0x552215[_0xd81b('0x25')]){if(_0x552215[_0xd81b('0x25')][_0xd81b('0x26')]===0x1f4){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);return _0x41bf7a(_0x552215[_0xd81b('0x25')][_0xd81b('0x27')]);}logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0x552215[_0xd81b('0x25')]['message']);return _0x13dd00(_0x552215['error'][_0xd81b('0x27')]);}else{logger[_0xd81b('0x1f')](_0xd81b('0x20'),_0x5f0b6b,'request\x20sent');_0x13dd00(_0x552215[_0xd81b('0x28')][_0xd81b('0x27')]);}})['catch'](function(_0xcd6474){logger[_0xd81b('0x25')](_0xd81b('0x20'),_0x5f0b6b,_0xcd6474);_0x41bf7a(_0xcd6474);});});}function respondWithStatusCode(_0x1ad65c,_0x279176){_0x279176=_0x279176||0xcc;return function(_0xcb4f91){if(_0xcb4f91){return _0x1ad65c[_0xd81b('0x29')](_0x279176);}return _0x1ad65c[_0xd81b('0x2a')](_0x279176)[_0xd81b('0x2b')]();};}function respondWithResult(_0x212c4e,_0x2ccedf){_0x2ccedf=_0x2ccedf||0xc8;return function(_0x1bf351){if(_0x1bf351){return _0x212c4e['status'](_0x2ccedf)[_0xd81b('0x2c')](_0x1bf351);}};}function respondWithFilteredResult(_0x99dbc9,_0xe3637a){return function(_0x31b9fd){if(_0x31b9fd){var _0x3266c2=typeof _0xe3637a[_0xd81b('0x2d')]===_0xd81b('0x2e')&&typeof _0xe3637a[_0xd81b('0x2f')]===_0xd81b('0x2e');var _0x483a3d=_0x31b9fd[_0xd81b('0x30')];var _0x4e2eff=_0x3266c2?0x0:_0xe3637a['offset'];var _0xb9ff9f=_0x3266c2?_0x31b9fd[_0xd81b('0x30')]:_0xe3637a['offset']+_0xe3637a['limit'];var _0x4093c8;if(_0xb9ff9f>=_0x483a3d){_0xb9ff9f=_0x483a3d;_0x4093c8=0xc8;}else{_0x4093c8=0xce;}_0x99dbc9[_0xd81b('0x2a')](_0x4093c8);return _0x99dbc9[_0xd81b('0x31')](_0xd81b('0x32'),_0x4e2eff+'-'+_0xb9ff9f+'/'+_0x483a3d)[_0xd81b('0x2c')](_0x31b9fd);}return null;};}function patchUpdates(_0x4654ba){return function(_0x5527ed){try{jsonpatch[_0xd81b('0x33')](_0x5527ed,_0x4654ba,!![]);}catch(_0x26f629){return BPromise['reject'](_0x26f629);}return _0x5527ed['save']();};}function saveUpdates(_0x165892,_0x1966b1){return function(_0x50472a){if(_0x50472a){return _0x50472a['update'](_0x165892)['then'](function(_0x322991){return _0x322991;});}return null;};}function removeEntity(_0x3ead68,_0x1d2f46){return function(_0x1c4cf7){if(_0x1c4cf7){return _0x1c4cf7[_0xd81b('0x34')]()[_0xd81b('0x1e')](function(){var _0x29aabf=_0x1c4cf7['get']({'plain':!![]});var _0x28782f='Trunks';return db[_0xd81b('0x35')][_0xd81b('0x34')]({'where':{'type':_0x28782f,'resourceId':_0x29aabf['id']}})[_0xd81b('0x1e')](function(){return _0x1c4cf7;});})[_0xd81b('0x1e')](function(){_0x3ead68[_0xd81b('0x2a')](0xcc)[_0xd81b('0x2b')]();});}};}function handleEntityNotFound(_0x1c20d3,_0x2d23b9){return function(_0xf9d1a5){if(!_0xf9d1a5){_0x1c20d3[_0xd81b('0x29')](0x194);}return _0xf9d1a5;};}function handleError(_0x1be4e2,_0x3c8371){_0x3c8371=_0x3c8371||0x1f4;return function(_0x346038){logger['error'](_0x346038['stack']);if(_0x346038[_0xd81b('0x36')]){delete _0x346038[_0xd81b('0x36')];}_0x1be4e2[_0xd81b('0x2a')](_0x3c8371)['send'](_0x346038);};}exports[_0xd81b('0x37')]=function(_0x37ba34,_0x5a236a){var _0x46f058={},_0xaa9e97={},_0x512e39={'count':0x0,'rows':[]};var _0xed5272=_['map'](db[_0xd81b('0x38')][_0xd81b('0x39')],function(_0x203365){return{'name':_0x203365[_0xd81b('0x3a')],'type':_0x203365['type'][_0xd81b('0x3b')]};});_0xaa9e97[_0xd81b('0x3c')]=_[_0xd81b('0x3d')](_0xed5272,_0xd81b('0x36'));_0xaa9e97[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x37ba34[_0xd81b('0x3e')]);_0xaa9e97['filters']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],_0xaa9e97[_0xd81b('0x3e')]);_0x46f058['attributes']=_[_0xd81b('0x40')](_0xaa9e97[_0xd81b('0x3c')],qs[_0xd81b('0x41')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x46f058['attributes']=_0x46f058[_0xd81b('0x42')][_0xd81b('0x43')]?_0x46f058[_0xd81b('0x42')]:_0xaa9e97[_0xd81b('0x3c')];if(!_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x44')](_0xd81b('0x45'))){_0x46f058[_0xd81b('0x2f')]=qs[_0xd81b('0x2f')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2f')]);_0x46f058['offset']=qs[_0xd81b('0x2d')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x2d')]);}_0x46f058[_0xd81b('0x46')]=qs[_0xd81b('0x47')](_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x47')]);_0x46f058[_0xd81b('0x48')]=qs['filters'](_['pick'](_0x37ba34[_0xd81b('0x3e')],_0xaa9e97[_0xd81b('0x49')]),_0xed5272);if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]){_0x46f058[_0xd81b('0x48')]=_[_0xd81b('0x4b')](_0x46f058[_0xd81b('0x48')],{'$or':_[_0xd81b('0x3d')](_0xed5272,function(_0x2fa588){if(_0x2fa588[_0xd81b('0x4c')]!==_0xd81b('0x4d')){var _0x38e436={};_0x38e436[_0x2fa588['name']]={'$like':'%'+_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4a')]+'%'};return _0x38e436;}})});}_0x46f058=_[_0xd81b('0x4b')]({},_0x46f058,_0x37ba34[_0xd81b('0x4e')]);var _0x105a48={'where':_0x46f058[_0xd81b('0x48')]};return db[_0xd81b('0x38')][_0xd81b('0x30')](_0x105a48)[_0xd81b('0x1e')](function(_0x53ea36){_0x512e39[_0xd81b('0x30')]=_0x53ea36;if(_0x37ba34[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x46f058[_0xd81b('0x50')]=[{'all':!![]}];}return db['Trunk'][_0xd81b('0x51')](_0x46f058);})[_0xd81b('0x1e')](function(_0x15030b){_0x512e39[_0xd81b('0x52')]=_0x15030b;return _0x512e39;})[_0xd81b('0x1e')](respondWithFilteredResult(_0x5a236a,_0x46f058))[_0xd81b('0x53')](handleError(_0x5a236a,null));};exports[_0xd81b('0x54')]=function(_0x43d7ce,_0x133a76){var _0x49cba6={'raw':![],'where':{'id':_0x43d7ce[_0xd81b('0x55')]['id']}},_0x534d10={};_0x534d10[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db[_0xd81b('0x38')][_0xd81b('0x39')]);_0x534d10[_0xd81b('0x3e')]=_[_0xd81b('0x3f')](_0x43d7ce[_0xd81b('0x3e')]);_0x534d10['filters']=_[_0xd81b('0x40')](_0x534d10[_0xd81b('0x3c')],_0x534d10[_0xd81b('0x3e')]);_0x49cba6[_0xd81b('0x42')]=_[_0xd81b('0x40')](_0x534d10['model'],qs[_0xd81b('0x41')](_0x43d7ce[_0xd81b('0x3e')]['fields']));_0x49cba6[_0xd81b('0x42')]=_0x49cba6[_0xd81b('0x42')][_0xd81b('0x43')]?_0x49cba6[_0xd81b('0x42')]:_0x534d10[_0xd81b('0x3c')];if(_0x43d7ce[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x49cba6[_0xd81b('0x50')]=[{'all':!![]}];}_0x49cba6=_[_0xd81b('0x4b')]({},_0x49cba6,_0x43d7ce[_0xd81b('0x4e')]);return db[_0xd81b('0x38')]['find'](_0x49cba6)[_0xd81b('0x1e')](handleEntityNotFound(_0x133a76,null))['then'](respondWithResult(_0x133a76,null))[_0xd81b('0x53')](handleError(_0x133a76,null));};exports[_0xd81b('0x56')]=function(_0x390db6,_0x3c2a9f){var _0x34d2a2={'where':{'id':_0x390db6['params']['id']}},_0x1e9f73={};_0x1e9f73[_0xd81b('0x3c')]=_[_0xd81b('0x3f')](db['Trunk']['rawAttributes']);_0x34d2a2[_0xd81b('0x42')]=_['intersection'](_0x1e9f73[_0xd81b('0x3c')],qs['fields'](_0x390db6[_0xd81b('0x3e')][_0xd81b('0x41')]));_0x34d2a2[_0xd81b('0x42')]=_0x34d2a2['attributes'][_0xd81b('0x43')]?_0x34d2a2[_0xd81b('0x42')]:_0x1e9f73['model'];if(_0x390db6[_0xd81b('0x3e')][_0xd81b('0x4f')]){_0x34d2a2['include']=[{'all':!![]}];}_0x34d2a2=_[_0xd81b('0x4b')]({},_0x34d2a2,_0x390db6['options']);return db[_0xd81b('0x38')][_0xd81b('0x57')](_0x34d2a2)[_0xd81b('0x1e')](handleEntityNotFound(_0x3c2a9f,null))[_0xd81b('0x1e')](function(_0x4add79){if(_0x4add79){var _0x32eab4=_0x4add79[_0xd81b('0x58')]({'plain':!![]});_0x32eab4=qs[_0xd81b('0x59')](_0x32eab4,['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);_0x390db6['body']=_[_0xd81b('0x59')](_0x390db6[_0xd81b('0x5c')],['id',_0xd81b('0x5a'),_0xd81b('0x5b')]);return db[_0xd81b('0x38')][_0xd81b('0x5d')](_[_0xd81b('0x4b')](_0x32eab4,_0x390db6['body']),{'include':_0x390db6['query']['includeAll']?[{'all':!![]}]:undefined})[_0xd81b('0x1e')](function(_0x12b0bf){var _0x37507e=_0x390db6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x37507e)throw new Error(_0xd81b('0x5f'));if(_0x37507e[_0xd81b('0x60')]==='user'){var _0x3fcd8c=_0x12b0bf[_0xd81b('0x58')]({'plain':!![]});var _0x35c9cf=_0xd81b('0x61');return db[_0xd81b('0x62')][_0xd81b('0x57')]({'where':{'name':_0x35c9cf,'userProfileId':_0x37507e[_0xd81b('0x63')]},'raw':!![]})['then'](function(_0x14b187){if(_0x14b187&&_0x14b187[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x3fcd8c[_0xd81b('0x36')],'resourceId':_0x3fcd8c['id'],'type':_0x14b187[_0xd81b('0x36')],'sectionId':_0x14b187['id']},{})[_0xd81b('0x1e')](function(){return _0x12b0bf;});}else{return _0x12b0bf;}})[_0xd81b('0x53')](function(_0x8fa8cd){logger[_0xd81b('0x25')](_0xd81b('0x65'),_0x8fa8cd);throw _0x8fa8cd;});}return _0x12b0bf;});}})[_0xd81b('0x1e')](respondWithResult(_0x3c2a9f,0xc9))['catch'](handleError(_0x3c2a9f,null));};exports[_0xd81b('0x5d')]=function(_0x5358a6,_0x2e7141,_0x6fa974){var _0x414f40;return db[_0xd81b('0x38')][_0xd81b('0x5d')](_0x5358a6[_0xd81b('0x5c')],{'raw':!![]})[_0xd81b('0x1e')](function(_0x18f2ac){_0x414f40=_0x18f2ac;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0xfa2a13){var _0x344c32=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),'utf8');var _0x3274d2=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),_0xd81b('0x6a'));var _0xaee7e3=ejs['render'](_0x344c32,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0xaee7e3);if(_0x414f40[_0xd81b('0x6d')]){var _0x1c6ec8=ejs[_0xd81b('0x6e')](_0x3274d2,{'trunks':_0xfa2a13||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x1c6ec8);}})[_0xd81b('0x1e')](function(){return respondWithRpcPromise(_0xd81b('0x70'),'create',{'module':_0xd81b('0x71')});})[_0xd81b('0x1e')](function(){var _0x3858eb=_0x5358a6[_0xd81b('0x5e')][_0xd81b('0x58')]({'plain':!![]});if(!_0x3858eb)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3858eb[_0xd81b('0x60')]===_0xd81b('0x5e')){var _0x4cc440=_0x414f40[_0xd81b('0x58')]({'plain':!![]});return db[_0xd81b('0x62')]['find']({'where':{'name':_0xd81b('0x61'),'userProfileId':_0x3858eb[_0xd81b('0x63')]},'raw':!![]})[_0xd81b('0x1e')](function(_0x483026){if(_0x483026&&_0x483026[_0xd81b('0x64')]===0x0){return db[_0xd81b('0x35')][_0xd81b('0x5d')]({'name':_0x4cc440['name'],'resourceId':_0x4cc440['id'],'type':_0x483026['name'],'sectionId':_0x483026['id']},{})[_0xd81b('0x1e')](function(){return _0x414f40;});}else{return _0x414f40;}})[_0xd81b('0x53')](function(_0x36c694){logger['error'](_0xd81b('0x65'),_0x36c694);throw _0x36c694;});}return _0x414f40;})[_0xd81b('0x1e')](respondWithResult(_0x2e7141,0xc9))[_0xd81b('0x53')](handleError(_0x2e7141,null));};exports[_0xd81b('0x72')]=function(_0x524196,_0x4f69a7,_0x42ae01){var _0x256696;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x524196['params']['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x4f69a7,null))[_0xd81b('0x1e')](saveUpdates(_0x524196['body'],null))[_0xd81b('0x1e')](function(_0x4e5bf4){if(_0x4e5bf4){_0x256696=_0x4e5bf4;return db[_0xd81b('0x38')][_0xd81b('0x51')]({'raw':!![]});}})['then'](function(_0x1be0e6){if(_0x1be0e6){var _0x9a9634=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],'server/files/templates/trunk.ejs'),_0xd81b('0x6a'));var _0xc0e137=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config[_0xd81b('0x68')],_0xd81b('0x69')),'utf8');var _0x5c8ea0=ejs[_0xd81b('0x6e')](_0x9a9634,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6c'),_0x5c8ea0);var _0x15aed5=ejs['render'](_0xc0e137,{'trunks':_0x1be0e6||[]});fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x15aed5);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x72'),{'module':_0xd81b('0x71')});}return null;})['then'](function(_0x3744bf){if(_0x3744bf){return _0x256696;}})[_0xd81b('0x1e')](respondWithResult(_0x4f69a7,null))[_0xd81b('0x53')](handleError(_0x4f69a7,null));};exports[_0xd81b('0x34')]=function(_0x1d596c,_0x288124,_0x402eb9){var _0x57179a;return db[_0xd81b('0x38')][_0xd81b('0x57')]({'where':{'id':_0x1d596c[_0xd81b('0x55')]['id']}})[_0xd81b('0x1e')](handleEntityNotFound(_0x288124,null))[_0xd81b('0x1e')](removeEntity(_0x288124,null))[_0xd81b('0x1e')](function(){return db['Trunk'][_0xd81b('0x51')]({'raw':!![]});})['then'](function(_0x11e590){var _0x9e6e05=fs[_0xd81b('0x66')](path['join'](config[_0xd81b('0x68')],_0xd81b('0x73')),_0xd81b('0x6a'));var _0x5060dc=fs[_0xd81b('0x66')](path[_0xd81b('0x67')](config['root'],_0xd81b('0x69')),'utf8');var _0x5f5514=ejs[_0xd81b('0x6e')](_0x9e6e05,{'trunks':_0x11e590});var _0x428317=ejs[_0xd81b('0x6e')](_0x5060dc,{'trunks':_0x11e590});fs['writeFileSync'](_0xd81b('0x6c'),_0x5f5514);fs[_0xd81b('0x6b')](_0xd81b('0x6f'),_0x428317);return respondWithRpcPromise(_0xd81b('0x70'),_0xd81b('0x34'),{'module':_0xd81b('0x71')});})['catch'](handleError(_0x288124,null));}; \ No newline at end of file +var _0xe14d=['options','includeAll','include','findAll','rows','params','keys','rawAttributes','find','omit','createdAt','updatedAt','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','server/files/templates/trunk.ejs','utf8','root','server/files/templates/registry.ejs','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','registry','Reload','UserProfileSection','autoAssociation','readFileSync','render','/etc/asterisk/sip_xcally_registers.conf','chan_sip.so','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','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','../../mysqldb','jayson/promise','client','http','request','then','info','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','get','Trunks','UserProfileResource','destroy','stack','name','map','Trunk','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','where','pick','filter','merge','VIRTUAL'];(function(_0x5d1b90,_0x4f273a){var _0x2b60f1=function(_0x2bf3ac){while(--_0x2bf3ac){_0x5d1b90['push'](_0x5d1b90['shift']());}};_0x2b60f1(++_0x4f273a);}(_0xe14d,0x1ee));var _0xde14=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0xe14d[_0x4ae625];return _0x31accf;};'use strict';var emlformat=require(_0xde14('0x0'));var rimraf=require(_0xde14('0x1'));var zipdir=require(_0xde14('0x2'));var jsonpatch=require(_0xde14('0x3'));var rp=require('request-promise');var moment=require(_0xde14('0x4'));var BPromise=require(_0xde14('0x5'));var Mustache=require('mustache');var util=require(_0xde14('0x6'));var path=require(_0xde14('0x7'));var sox=require(_0xde14('0x8'));var csv=require(_0xde14('0x9'));var ejs=require(_0xde14('0xa'));var fs=require('fs');var fs_extra=require(_0xde14('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xde14('0xc'));var jsforce=require(_0xde14('0xd'));var deskjs=require(_0xde14('0xe'));var toCsv=require(_0xde14('0x9'));var querystring=require(_0xde14('0xf'));var Papa=require(_0xde14('0x10'));var Redis=require(_0xde14('0x11'));var authService=require(_0xde14('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde14('0x13'));var hardwareService=require(_0xde14('0x14'));var logger=require(_0xde14('0x15'))(_0xde14('0x16'));var utils=require(_0xde14('0x17'));var config=require(_0xde14('0x18'));var licenseUtil=require(_0xde14('0x19'));var db=require(_0xde14('0x1a'))['db'];var jayson=require(_0xde14('0x1b'));var client=jayson[_0xde14('0x1c')][_0xde14('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x464624,_0x3521d4,_0x281c54,_0x1489e9){return new BPromise(function(_0x54c58b,_0x584959){var _0x23c878=_0x1489e9||client;return _0x23c878[_0xde14('0x1e')](_0x464624,_0x281c54)[_0xde14('0x1f')](function(_0x4c86ff){logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));logger[_0xde14('0x23')](_0xde14('0x24'),_0x3521d4,_0xde14('0x22'),JSON[_0xde14('0x25')](_0x4c86ff));if(_0x4c86ff[_0xde14('0x26')]){if(_0x4c86ff[_0xde14('0x26')][_0xde14('0x27')]===0x1f4){logger['error'](_0xde14('0x21'),_0x3521d4,_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);return _0x584959(_0x4c86ff[_0xde14('0x26')]['message']);}logger[_0xde14('0x26')]('Trunk,\x20%s,\x20%s',_0x3521d4,_0x4c86ff[_0xde14('0x26')]['message']);return _0x54c58b(_0x4c86ff[_0xde14('0x26')][_0xde14('0x28')]);}else{logger[_0xde14('0x20')](_0xde14('0x21'),_0x3521d4,_0xde14('0x22'));_0x54c58b(_0x4c86ff[_0xde14('0x29')][_0xde14('0x28')]);}})[_0xde14('0x2a')](function(_0xdd8d59){logger[_0xde14('0x26')](_0xde14('0x21'),_0x3521d4,_0xdd8d59);_0x584959(_0xdd8d59);});});}function respondWithStatusCode(_0xbaa078,_0x8f8033){_0x8f8033=_0x8f8033||0xcc;return function(_0x5ae4c1){if(_0x5ae4c1){return _0xbaa078[_0xde14('0x2b')](_0x8f8033);}return _0xbaa078[_0xde14('0x2c')](_0x8f8033)[_0xde14('0x2d')]();};}function respondWithResult(_0xbd05d6,_0x1bb7be){_0x1bb7be=_0x1bb7be||0xc8;return function(_0x21ef15){if(_0x21ef15){return _0xbd05d6[_0xde14('0x2c')](_0x1bb7be)[_0xde14('0x2e')](_0x21ef15);}};}function respondWithFilteredResult(_0x1618e1,_0x350a78){return function(_0x4eff65){if(_0x4eff65){var _0x309922=typeof _0x350a78[_0xde14('0x2f')]===_0xde14('0x30')&&typeof _0x350a78[_0xde14('0x31')]==='undefined';var _0x3fc2a4=_0x4eff65[_0xde14('0x32')];var _0x30c4a8=_0x309922?0x0:_0x350a78['offset'];var _0x4655fb=_0x309922?_0x4eff65['count']:_0x350a78[_0xde14('0x2f')]+_0x350a78[_0xde14('0x31')];var _0x3bb1da;if(_0x4655fb>=_0x3fc2a4){_0x4655fb=_0x3fc2a4;_0x3bb1da=0xc8;}else{_0x3bb1da=0xce;}_0x1618e1[_0xde14('0x2c')](_0x3bb1da);return _0x1618e1[_0xde14('0x33')](_0xde14('0x34'),_0x30c4a8+'-'+_0x4655fb+'/'+_0x3fc2a4)[_0xde14('0x2e')](_0x4eff65);}return null;};}function patchUpdates(_0x464666){return function(_0x4e7c5b){try{jsonpatch[_0xde14('0x35')](_0x4e7c5b,_0x464666,!![]);}catch(_0xbf49ac){return BPromise['reject'](_0xbf49ac);}return _0x4e7c5b[_0xde14('0x36')]();};}function saveUpdates(_0x4c9b15,_0x2e40ad){return function(_0x44e88a){if(_0x44e88a){return _0x44e88a[_0xde14('0x37')](_0x4c9b15)[_0xde14('0x1f')](function(_0x13c164){return _0x13c164;});}return null;};}function removeEntity(_0x57fc47,_0x26dfa9){return function(_0x57b98b){if(_0x57b98b){return _0x57b98b['destroy']()[_0xde14('0x1f')](function(){var _0x3c943b=_0x57b98b[_0xde14('0x38')]({'plain':!![]});var _0x319136=_0xde14('0x39');return db[_0xde14('0x3a')][_0xde14('0x3b')]({'where':{'type':_0x319136,'resourceId':_0x3c943b['id']}})[_0xde14('0x1f')](function(){return _0x57b98b;});})[_0xde14('0x1f')](function(){_0x57fc47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1c7136,_0x403007){return function(_0x20913d){if(!_0x20913d){_0x1c7136[_0xde14('0x2b')](0x194);}return _0x20913d;};}function handleError(_0x31cad4,_0x23813f){_0x23813f=_0x23813f||0x1f4;return function(_0x1f42ab){logger[_0xde14('0x26')](_0x1f42ab[_0xde14('0x3c')]);if(_0x1f42ab['name']){delete _0x1f42ab[_0xde14('0x3d')];}_0x31cad4['status'](_0x23813f)['send'](_0x1f42ab);};}exports['index']=function(_0xb0eba6,_0x258759){var _0x398f63={},_0x152dab={},_0x1228d8={'count':0x0,'rows':[]};var _0x8b5bb4=_[_0xde14('0x3e')](db[_0xde14('0x3f')]['rawAttributes'],function(_0xc2a39d){return{'name':_0xc2a39d[_0xde14('0x40')],'type':_0xc2a39d[_0xde14('0x41')][_0xde14('0x42')]};});_0x152dab[_0xde14('0x43')]=_[_0xde14('0x3e')](_0x8b5bb4,_0xde14('0x3d'));_0x152dab[_0xde14('0x44')]=_['keys'](_0xb0eba6[_0xde14('0x44')]);_0x152dab[_0xde14('0x45')]=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],_0x152dab['query']);_0x398f63['attributes']=_[_0xde14('0x46')](_0x152dab[_0xde14('0x43')],qs[_0xde14('0x47')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x47')]));_0x398f63['attributes']=_0x398f63[_0xde14('0x48')][_0xde14('0x49')]?_0x398f63[_0xde14('0x48')]:_0x152dab['model'];if(!_0xb0eba6[_0xde14('0x44')]['hasOwnProperty'](_0xde14('0x4a'))){_0x398f63['limit']=qs[_0xde14('0x31')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x31')]);_0x398f63[_0xde14('0x2f')]=qs[_0xde14('0x2f')](_0xb0eba6[_0xde14('0x44')][_0xde14('0x2f')]);}_0x398f63[_0xde14('0x4b')]=qs['sort'](_0xb0eba6[_0xde14('0x44')]['sort']);_0x398f63[_0xde14('0x4c')]=qs['filters'](_[_0xde14('0x4d')](_0xb0eba6[_0xde14('0x44')],_0x152dab[_0xde14('0x45')]),_0x8b5bb4);if(_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]){_0x398f63[_0xde14('0x4c')]=_[_0xde14('0x4f')](_0x398f63[_0xde14('0x4c')],{'$or':_['map'](_0x8b5bb4,function(_0x15859c){if(_0x15859c[_0xde14('0x41')]!==_0xde14('0x50')){var _0x4b1ef7={};_0x4b1ef7[_0x15859c['name']]={'$like':'%'+_0xb0eba6[_0xde14('0x44')][_0xde14('0x4e')]+'%'};return _0x4b1ef7;}})});}_0x398f63=_[_0xde14('0x4f')]({},_0x398f63,_0xb0eba6[_0xde14('0x51')]);var _0x39572b={'where':_0x398f63[_0xde14('0x4c')]};return db['Trunk'][_0xde14('0x32')](_0x39572b)['then'](function(_0xa408ec){_0x1228d8[_0xde14('0x32')]=_0xa408ec;if(_0xb0eba6['query'][_0xde14('0x52')]){_0x398f63[_0xde14('0x53')]=[{'all':!![]}];}return db[_0xde14('0x3f')][_0xde14('0x54')](_0x398f63);})[_0xde14('0x1f')](function(_0x1c87e1){_0x1228d8[_0xde14('0x55')]=_0x1c87e1;return _0x1228d8;})['then'](respondWithFilteredResult(_0x258759,_0x398f63))[_0xde14('0x2a')](handleError(_0x258759,null));};exports['show']=function(_0xfa80c8,_0x6aa9ab){var _0x237be4={'raw':![],'where':{'id':_0xfa80c8[_0xde14('0x56')]['id']}},_0x235202={};_0x235202[_0xde14('0x43')]=_[_0xde14('0x57')](db[_0xde14('0x3f')][_0xde14('0x58')]);_0x235202[_0xde14('0x44')]=_['keys'](_0xfa80c8[_0xde14('0x44')]);_0x235202[_0xde14('0x45')]=_[_0xde14('0x46')](_0x235202[_0xde14('0x43')],_0x235202[_0xde14('0x44')]);_0x237be4['attributes']=_[_0xde14('0x46')](_0x235202['model'],qs[_0xde14('0x47')](_0xfa80c8[_0xde14('0x44')][_0xde14('0x47')]));_0x237be4[_0xde14('0x48')]=_0x237be4[_0xde14('0x48')]['length']?_0x237be4['attributes']:_0x235202[_0xde14('0x43')];if(_0xfa80c8['query'][_0xde14('0x52')]){_0x237be4[_0xde14('0x53')]=[{'all':!![]}];}_0x237be4=_[_0xde14('0x4f')]({},_0x237be4,_0xfa80c8[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x237be4)[_0xde14('0x1f')](handleEntityNotFound(_0x6aa9ab,null))[_0xde14('0x1f')](respondWithResult(_0x6aa9ab,null))[_0xde14('0x2a')](handleError(_0x6aa9ab,null));};exports['clone']=function(_0x205a94,_0x2c972b){var _0x1ea6d2={'where':{'id':_0x205a94[_0xde14('0x56')]['id']}},_0x21d226={};_0x21d226['model']=_[_0xde14('0x57')](db['Trunk'][_0xde14('0x58')]);_0x1ea6d2[_0xde14('0x48')]=_[_0xde14('0x46')](_0x21d226[_0xde14('0x43')],qs[_0xde14('0x47')](_0x205a94[_0xde14('0x44')][_0xde14('0x47')]));_0x1ea6d2[_0xde14('0x48')]=_0x1ea6d2['attributes']['length']?_0x1ea6d2['attributes']:_0x21d226[_0xde14('0x43')];if(_0x205a94['query']['includeAll']){_0x1ea6d2[_0xde14('0x53')]=[{'all':!![]}];}_0x1ea6d2=_[_0xde14('0x4f')]({},_0x1ea6d2,_0x205a94[_0xde14('0x51')]);return db[_0xde14('0x3f')][_0xde14('0x59')](_0x1ea6d2)[_0xde14('0x1f')](handleEntityNotFound(_0x2c972b,null))[_0xde14('0x1f')](function(_0x13f698){if(_0x13f698){var _0x2dd108=_0x13f698['get']({'plain':!![]});_0x2dd108=qs[_0xde14('0x5a')](_0x2dd108,['id',_0xde14('0x5b'),_0xde14('0x5c')]);_0x205a94['body']=_[_0xde14('0x5a')](_0x205a94['body'],['id',_0xde14('0x5b'),_0xde14('0x5c')]);return db[_0xde14('0x3f')][_0xde14('0x5d')](_[_0xde14('0x4f')](_0x2dd108,_0x205a94[_0xde14('0x5e')]),{'include':_0x205a94[_0xde14('0x44')]['includeAll']?[{'all':!![]}]:undefined})[_0xde14('0x1f')](function(_0x25ba7e){var _0x1a0bb1=_0x205a94[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x1a0bb1)throw new Error(_0xde14('0x60'));if(_0x1a0bb1[_0xde14('0x61')]==='user'){var _0x4a9e85=_0x25ba7e[_0xde14('0x38')]({'plain':!![]});var _0x19a162=_0xde14('0x39');return db['UserProfileSection'][_0xde14('0x59')]({'where':{'name':_0x19a162,'userProfileId':_0x1a0bb1[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x32e075){if(_0x32e075&&_0x32e075['autoAssociation']===0x0){return db['UserProfileResource'][_0xde14('0x5d')]({'name':_0x4a9e85[_0xde14('0x3d')],'resourceId':_0x4a9e85['id'],'type':_0x32e075[_0xde14('0x3d')],'sectionId':_0x32e075['id']},{})[_0xde14('0x1f')](function(){return _0x25ba7e;});}else{return _0x25ba7e;}})[_0xde14('0x2a')](function(_0x120284){logger[_0xde14('0x26')](_0xde14('0x63'),_0x120284);throw _0x120284;});}return _0x25ba7e;});}})[_0xde14('0x1f')](respondWithResult(_0x2c972b,0xc9))[_0xde14('0x2a')](handleError(_0x2c972b,null));};exports[_0xde14('0x5d')]=function(_0x299b69,_0x1ff577,_0x42329a){var _0x6a641f;return db[_0xde14('0x3f')][_0xde14('0x5d')](_0x299b69[_0xde14('0x5e')],{'raw':!![]})[_0xde14('0x1f')](function(_0x1b5d70){_0x6a641f=_0x1b5d70;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})[_0xde14('0x1f')](function(_0x4809fa){var _0x1084fb=fs['readFileSync'](path[_0xde14('0x64')](config['root'],_0xde14('0x65')),_0xde14('0x66'));var _0x3aaba2=fs['readFileSync'](path['join'](config[_0xde14('0x67')],_0xde14('0x68')),_0xde14('0x66'));var _0x430bdb=ejs['render'](_0x1084fb,{'trunks':_0x4809fa||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x430bdb);if(_0x6a641f[_0xde14('0x6b')]){var _0x500344=ejs['render'](_0x3aaba2,{'trunks':_0x4809fa||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x500344);}})[_0xde14('0x1f')](function(){return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x5d'),{'module':'chan_sip.so'});})[_0xde14('0x1f')](function(){var _0x37f7c3=_0x299b69[_0xde14('0x5f')][_0xde14('0x38')]({'plain':!![]});if(!_0x37f7c3)throw new Error(_0xde14('0x60'));if(_0x37f7c3[_0xde14('0x61')]==='user'){var _0x579a6c=_0x6a641f[_0xde14('0x38')]({'plain':!![]});return db[_0xde14('0x6d')]['find']({'where':{'name':_0xde14('0x39'),'userProfileId':_0x37f7c3[_0xde14('0x62')]},'raw':!![]})[_0xde14('0x1f')](function(_0x367ede){if(_0x367ede&&_0x367ede[_0xde14('0x6e')]===0x0){return db[_0xde14('0x3a')][_0xde14('0x5d')]({'name':_0x579a6c['name'],'resourceId':_0x579a6c['id'],'type':_0x367ede['name'],'sectionId':_0x367ede['id']},{})['then'](function(){return _0x6a641f;});}else{return _0x6a641f;}})['catch'](function(_0x3dbda9){logger[_0xde14('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3dbda9);throw _0x3dbda9;});}return _0x6a641f;})['then'](respondWithResult(_0x1ff577,0xc9))[_0xde14('0x2a')](handleError(_0x1ff577,null));};exports[_0xde14('0x37')]=function(_0xe2b9f5,_0x5805ec,_0x1aa75d){var _0x2b1e2e;return db['Trunk'][_0xde14('0x59')]({'where':{'id':_0xe2b9f5[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5805ec,null))[_0xde14('0x1f')](saveUpdates(_0xe2b9f5['body'],null))[_0xde14('0x1f')](function(_0x5a5b25){if(_0x5a5b25){_0x2b1e2e=_0x5a5b25;return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});}})[_0xde14('0x1f')](function(_0x5f49d1){if(_0x5f49d1){var _0x283eb8=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],_0xde14('0x65')),'utf8');var _0x53433d=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),_0xde14('0x66'));var _0x1a12b5=ejs[_0xde14('0x70')](_0x283eb8,{'trunks':_0x5f49d1||[]});fs[_0xde14('0x69')](_0xde14('0x6a'),_0x1a12b5);var _0x2cc5b7=ejs[_0xde14('0x70')](_0x53433d,{'trunks':_0x5f49d1||[]});fs['writeFileSync'](_0xde14('0x71'),_0x2cc5b7);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x37'),{'module':_0xde14('0x72')});}return null;})[_0xde14('0x1f')](function(_0x1732d0){if(_0x1732d0){return _0x2b1e2e;}})[_0xde14('0x1f')](respondWithResult(_0x5805ec,null))['catch'](handleError(_0x5805ec,null));};exports[_0xde14('0x3b')]=function(_0x1bdeae,_0x5f4b92,_0x4543f1){var _0x4a0108;return db[_0xde14('0x3f')]['find']({'where':{'id':_0x1bdeae[_0xde14('0x56')]['id']}})[_0xde14('0x1f')](handleEntityNotFound(_0x5f4b92,null))[_0xde14('0x1f')](removeEntity(_0x5f4b92,null))[_0xde14('0x1f')](function(){return db[_0xde14('0x3f')][_0xde14('0x54')]({'raw':!![]});})['then'](function(_0x43a155){var _0x58cf06=fs[_0xde14('0x6f')](path['join'](config[_0xde14('0x67')],_0xde14('0x65')),_0xde14('0x66'));var _0x4a1114=fs[_0xde14('0x6f')](path[_0xde14('0x64')](config[_0xde14('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x495741=ejs['render'](_0x58cf06,{'trunks':_0x43a155});var _0x381d6d=ejs[_0xde14('0x70')](_0x4a1114,{'trunks':_0x43a155});fs['writeFileSync'](_0xde14('0x6a'),_0x495741);fs[_0xde14('0x69')](_0xde14('0x71'),_0x381d6d);return respondWithRpcPromise(_0xde14('0x6c'),_0xde14('0x3b'),{'module':'chan_sip.so'});})[_0xde14('0x2a')](handleError(_0x5f4b92,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index fcbf7c1..9b1a90a 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 _0xc753=['rimraf','./trunk.attributes','exports','define','Trunk','tools_trunks','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x82c354,_0x1b4c7d){var _0x593a18=function(_0x252cf5){while(--_0x252cf5){_0x82c354['push'](_0x82c354['shift']());}};_0x593a18(++_0x1b4c7d);}(_0xc753,0x1b3));var _0x3c75=function(_0x1e6951,_0x4d39ee){_0x1e6951=_0x1e6951-0x0;var _0x235723=_0xc753[_0x1e6951];return _0x235723;};'use strict';var _=require(_0x3c75('0x0'));var util=require(_0x3c75('0x1'));var logger=require('../../config/logger')(_0x3c75('0x2'));var moment=require(_0x3c75('0x3'));var BPromise=require(_0x3c75('0x4'));var rp=require(_0x3c75('0x5'));var fs=require('fs');var path=require(_0x3c75('0x6'));var rimraf=require(_0x3c75('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c75('0x8'));module[_0x3c75('0x9')]=function(_0x3af062,_0x4f4357){return _0x3af062[_0x3c75('0xa')](_0x3c75('0xb'),attributes,{'tableName':_0x3c75('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf91b=['rimraf','../../config/environment','./trunk.attributes','exports','define','tools_trunks','lodash','util','api','moment','bluebird','request-promise'];(function(_0x485f46,_0x40d53f){var _0x9f5664=function(_0x254a9d){while(--_0x254a9d){_0x485f46['push'](_0x485f46['shift']());}};_0x9f5664(++_0x40d53f);}(_0xf91b,0x186));var _0xbf91=function(_0x389090,_0x24308f){_0x389090=_0x389090-0x0;var _0x57f434=_0xf91b[_0x389090];return _0x57f434;};'use strict';var _=require(_0xbf91('0x0'));var util=require(_0xbf91('0x1'));var logger=require('../../config/logger')(_0xbf91('0x2'));var moment=require(_0xbf91('0x3'));var BPromise=require(_0xbf91('0x4'));var rp=require(_0xbf91('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xbf91('0x6'));var config=require(_0xbf91('0x7'));var attributes=require(_0xbf91('0x8'));module[_0xbf91('0x9')]=function(_0x55613a,_0x12b14e){return _0x55613a[_0xbf91('0xa')]('Trunk',attributes,{'tableName':_0xbf91('0xb'),'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 743c6cd..d1d0084 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 _0x2ce7=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','request','then','Trunk,\x20%s,\x20%s','request\x20sent','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','options','where','attributes','limit','include','map','model','GetTrunk','ShowTrunk','Trunk','raw','util','moment','bluebird','randomstring','ioredis'];(function(_0x3f4567,_0x58d30d){var _0x4c1c4d=function(_0x452afe){while(--_0x452afe){_0x3f4567['push'](_0x3f4567['shift']());}};_0x4c1c4d(++_0x58d30d);}(_0x2ce7,0x1ea));var _0x72ce=function(_0x418c71,_0x52f197){_0x418c71=_0x418c71-0x0;var _0x391525=_0x2ce7[_0x418c71];return _0x391525;};'use strict';var _=require('lodash');var util=require(_0x72ce('0x0'));var moment=require(_0x72ce('0x1'));var BPromise=require(_0x72ce('0x2'));var rs=require(_0x72ce('0x3'));var fs=require('fs');var Redis=require(_0x72ce('0x4'));var db=require(_0x72ce('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x72ce('0x6'))('rpc');var config=require(_0x72ce('0x7'));var jayson=require(_0x72ce('0x8'));var client=jayson[_0x72ce('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14a147,_0x372ae7,_0x43f5b8){return new BPromise(function(_0x426c5b,_0x19c13b){return client[_0x72ce('0xa')](_0x14a147,_0x43f5b8)[_0x72ce('0xb')](function(_0x57c425){logger['info'](_0x72ce('0xc'),_0x372ae7,_0x72ce('0xd'));logger[_0x72ce('0xe')](_0x72ce('0xf'),_0x372ae7,_0x72ce('0xd'),JSON[_0x72ce('0x10')](_0x57c425));if(_0x57c425['error']){if(_0x57c425[_0x72ce('0x11')]['code']===0x1f4){logger['error'](_0x72ce('0xc'),_0x372ae7,_0x57c425['error'][_0x72ce('0x12')]);return _0x19c13b(_0x57c425[_0x72ce('0x11')][_0x72ce('0x12')]);}logger[_0x72ce('0x11')]('Trunk,\x20%s,\x20%s',_0x372ae7,_0x57c425['error'][_0x72ce('0x12')]);return _0x426c5b(_0x57c425['error'][_0x72ce('0x12')]);}else{logger[_0x72ce('0x13')](_0x72ce('0xc'),_0x372ae7,_0x72ce('0xd'));_0x426c5b(_0x57c425[_0x72ce('0x14')]['message']);}})[_0x72ce('0x15')](function(_0x4e8ef7){logger['error'](_0x72ce('0xc'),_0x372ae7,_0x4e8ef7);_0x19c13b(_0x4e8ef7);});});}exports['GetTrunk']=function(_0x56deab){var _0x442cb8=this;return new Promise(function(_0x2c76a2,_0x11e4c6){return db['Trunk']['findAll']({'raw':_0x56deab[_0x72ce('0x16')]?_0x56deab[_0x72ce('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x56deab[_0x72ce('0x16')]?_0x56deab[_0x72ce('0x16')][_0x72ce('0x17')]||null:null,'attributes':_0x56deab['options']?_0x56deab[_0x72ce('0x16')][_0x72ce('0x18')]||null:null,'limit':_0x56deab['options']?_0x56deab[_0x72ce('0x16')][_0x72ce('0x19')]||null:null,'include':_0x56deab['options']?_0x56deab['options'][_0x72ce('0x1a')]?_[_0x72ce('0x1b')](_0x56deab[_0x72ce('0x16')][_0x72ce('0x1a')],function(_0x5310c2){return{'model':db[_0x5310c2[_0x72ce('0x1c')]],'as':_0x5310c2['as'],'attributes':_0x5310c2[_0x72ce('0x18')],'include':_0x5310c2[_0x72ce('0x1a')]?_[_0x72ce('0x1b')](_0x5310c2['include'],function(_0xfdd7c0){return{'model':db[_0xfdd7c0[_0x72ce('0x1c')]],'as':_0xfdd7c0['as'],'attributes':_0xfdd7c0[_0x72ce('0x18')],'include':_0xfdd7c0[_0x72ce('0x1a')]?_[_0x72ce('0x1b')](_0xfdd7c0[_0x72ce('0x1a')],function(_0x5de7fc){return{'model':db[_0x5de7fc['model']],'as':_0x5de7fc['as'],'attributes':_0x5de7fc[_0x72ce('0x18')]};}):[]};}):[]};}):[]:[]})[_0x72ce('0xb')](function(_0x43a2ff){logger[_0x72ce('0x13')](_0x72ce('0x1d'),_0x56deab);logger[_0x72ce('0xe')](_0x72ce('0x1d'),_0x56deab,JSON[_0x72ce('0x10')](_0x43a2ff));_0x2c76a2(_0x43a2ff);})['catch'](function(_0x27f356){logger[_0x72ce('0x11')](_0x72ce('0x1d'),_0x27f356[_0x72ce('0x12')],_0x56deab);_0x11e4c6(_0x442cb8[_0x72ce('0x11')](0x1f4,_0x27f356[_0x72ce('0x12')]));});});};exports[_0x72ce('0x1e')]=function(_0xd4acb8){var _0x2b327a=this;return new Promise(function(_0x1164d2,_0x71e69a){return db[_0x72ce('0x1f')]['find']({'raw':_0xd4acb8[_0x72ce('0x16')]?_0xd4acb8['options'][_0x72ce('0x20')]===undefined?!![]:![]:!![],'where':_0xd4acb8['options']?_0xd4acb8[_0x72ce('0x16')][_0x72ce('0x17')]||null:null,'attributes':_0xd4acb8[_0x72ce('0x16')]?_0xd4acb8[_0x72ce('0x16')]['attributes']||null:null,'include':_0xd4acb8['options']?_0xd4acb8[_0x72ce('0x16')][_0x72ce('0x1a')]?_[_0x72ce('0x1b')](_0xd4acb8['options'][_0x72ce('0x1a')],function(_0x358af6){return{'model':db[_0x358af6['model']],'as':_0x358af6['as'],'attributes':_0x358af6['attributes'],'include':_0x358af6[_0x72ce('0x1a')]?_[_0x72ce('0x1b')](_0x358af6['include'],function(_0xa7763d){return{'model':db[_0xa7763d[_0x72ce('0x1c')]],'as':_0xa7763d['as'],'attributes':_0xa7763d[_0x72ce('0x18')],'include':_0xa7763d[_0x72ce('0x1a')]?_[_0x72ce('0x1b')](_0xa7763d[_0x72ce('0x1a')],function(_0xe3f07b){return{'model':db[_0xe3f07b[_0x72ce('0x1c')]],'as':_0xe3f07b['as'],'attributes':_0xe3f07b[_0x72ce('0x18')]};}):[]};}):[]};}):[]:[]})[_0x72ce('0xb')](function(_0x3badb3){logger[_0x72ce('0x13')](_0x72ce('0x1e'),_0xd4acb8);logger['debug'](_0x72ce('0x1e'),_0xd4acb8,JSON[_0x72ce('0x10')](_0x3badb3));_0x1164d2(_0x3badb3);})[_0x72ce('0x15')](function(_0xac31c2){logger[_0x72ce('0x11')](_0x72ce('0x1e'),_0xac31c2[_0x72ce('0x12')],_0xd4acb8);_0x71e69a(_0x2b327a[_0x72ce('0x11')](0x1f4,_0xac31c2[_0x72ce('0x12')]));});});}; \ No newline at end of file +var _0x4e2c=['../../config/logger','rpc','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','Trunk,\x20%s,\x20%s','message','result','catch','GetTrunk','options','raw','where','limit','include','model','attributes','map','ShowTrunk','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xdd2bfa,_0x5bd304){var _0x55397e=function(_0x196f7d){while(--_0x196f7d){_0xdd2bfa['push'](_0xdd2bfa['shift']());}};_0x55397e(++_0x5bd304);}(_0x4e2c,0x119));var _0xc4e2=function(_0x596b33,_0x56a31f){_0x596b33=_0x596b33-0x0;var _0x59ccab=_0x4e2c[_0x596b33];return _0x59ccab;};'use strict';var _=require('lodash');var util=require(_0xc4e2('0x0'));var moment=require(_0xc4e2('0x1'));var BPromise=require(_0xc4e2('0x2'));var rs=require(_0xc4e2('0x3'));var fs=require('fs');var Redis=require(_0xc4e2('0x4'));var db=require(_0xc4e2('0x5'))['db'];var utils=require(_0xc4e2('0x6'));var logger=require(_0xc4e2('0x7'))(_0xc4e2('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xc4e2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2deb9f,_0x277033,_0x4c1478){return new BPromise(function(_0x44b780,_0x304dbb){return client[_0xc4e2('0xa')](_0x2deb9f,_0x4c1478)[_0xc4e2('0xb')](function(_0x20665a){logger[_0xc4e2('0xc')]('Trunk,\x20%s,\x20%s',_0x277033,'request\x20sent');logger[_0xc4e2('0xd')](_0xc4e2('0xe'),_0x277033,_0xc4e2('0xf'),JSON[_0xc4e2('0x10')](_0x20665a));if(_0x20665a[_0xc4e2('0x11')]){if(_0x20665a[_0xc4e2('0x11')]['code']===0x1f4){logger[_0xc4e2('0x11')](_0xc4e2('0x12'),_0x277033,_0x20665a[_0xc4e2('0x11')][_0xc4e2('0x13')]);return _0x304dbb(_0x20665a[_0xc4e2('0x11')][_0xc4e2('0x13')]);}logger[_0xc4e2('0x11')](_0xc4e2('0x12'),_0x277033,_0x20665a[_0xc4e2('0x11')]['message']);return _0x44b780(_0x20665a[_0xc4e2('0x11')][_0xc4e2('0x13')]);}else{logger[_0xc4e2('0xc')](_0xc4e2('0x12'),_0x277033,_0xc4e2('0xf'));_0x44b780(_0x20665a[_0xc4e2('0x14')][_0xc4e2('0x13')]);}})[_0xc4e2('0x15')](function(_0x5699a4){logger[_0xc4e2('0x11')](_0xc4e2('0x12'),_0x277033,_0x5699a4);_0x304dbb(_0x5699a4);});});}exports[_0xc4e2('0x16')]=function(_0x2858fa){var _0x372b35=this;return new Promise(function(_0x47b2c3,_0x3b3e72){return db['Trunk']['findAll']({'raw':_0x2858fa[_0xc4e2('0x17')]?_0x2858fa[_0xc4e2('0x17')][_0xc4e2('0x18')]===undefined?!![]:![]:!![],'where':_0x2858fa[_0xc4e2('0x17')]?_0x2858fa[_0xc4e2('0x17')][_0xc4e2('0x19')]||null:null,'attributes':_0x2858fa[_0xc4e2('0x17')]?_0x2858fa[_0xc4e2('0x17')]['attributes']||null:null,'limit':_0x2858fa[_0xc4e2('0x17')]?_0x2858fa[_0xc4e2('0x17')][_0xc4e2('0x1a')]||null:null,'include':_0x2858fa[_0xc4e2('0x17')]?_0x2858fa['options'][_0xc4e2('0x1b')]?_['map'](_0x2858fa[_0xc4e2('0x17')]['include'],function(_0x29cba1){return{'model':db[_0x29cba1[_0xc4e2('0x1c')]],'as':_0x29cba1['as'],'attributes':_0x29cba1[_0xc4e2('0x1d')],'include':_0x29cba1[_0xc4e2('0x1b')]?_[_0xc4e2('0x1e')](_0x29cba1[_0xc4e2('0x1b')],function(_0x510acc){return{'model':db[_0x510acc[_0xc4e2('0x1c')]],'as':_0x510acc['as'],'attributes':_0x510acc['attributes'],'include':_0x510acc['include']?_[_0xc4e2('0x1e')](_0x510acc[_0xc4e2('0x1b')],function(_0x5c9891){return{'model':db[_0x5c9891[_0xc4e2('0x1c')]],'as':_0x5c9891['as'],'attributes':_0x5c9891[_0xc4e2('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x149c2){logger[_0xc4e2('0xc')]('GetTrunk',_0x2858fa);logger[_0xc4e2('0xd')](_0xc4e2('0x16'),_0x2858fa,JSON[_0xc4e2('0x10')](_0x149c2));_0x47b2c3(_0x149c2);})[_0xc4e2('0x15')](function(_0x1d89db){logger[_0xc4e2('0x11')](_0xc4e2('0x16'),_0x1d89db[_0xc4e2('0x13')],_0x2858fa);_0x3b3e72(_0x372b35['error'](0x1f4,_0x1d89db[_0xc4e2('0x13')]));});});};exports[_0xc4e2('0x1f')]=function(_0x2a5cd6){var _0x1e86f2=this;return new Promise(function(_0x1f698d,_0x663e63){return db['Trunk']['find']({'raw':_0x2a5cd6['options']?_0x2a5cd6[_0xc4e2('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x2a5cd6[_0xc4e2('0x17')]?_0x2a5cd6[_0xc4e2('0x17')][_0xc4e2('0x19')]||null:null,'attributes':_0x2a5cd6[_0xc4e2('0x17')]?_0x2a5cd6[_0xc4e2('0x17')][_0xc4e2('0x1d')]||null:null,'include':_0x2a5cd6['options']?_0x2a5cd6[_0xc4e2('0x17')][_0xc4e2('0x1b')]?_['map'](_0x2a5cd6[_0xc4e2('0x17')]['include'],function(_0x1f91ef){return{'model':db[_0x1f91ef[_0xc4e2('0x1c')]],'as':_0x1f91ef['as'],'attributes':_0x1f91ef[_0xc4e2('0x1d')],'include':_0x1f91ef[_0xc4e2('0x1b')]?_[_0xc4e2('0x1e')](_0x1f91ef[_0xc4e2('0x1b')],function(_0x2ce055){return{'model':db[_0x2ce055[_0xc4e2('0x1c')]],'as':_0x2ce055['as'],'attributes':_0x2ce055['attributes'],'include':_0x2ce055[_0xc4e2('0x1b')]?_[_0xc4e2('0x1e')](_0x2ce055['include'],function(_0x316893){return{'model':db[_0x316893[_0xc4e2('0x1c')]],'as':_0x316893['as'],'attributes':_0x316893[_0xc4e2('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc4e2('0xb')](function(_0x21aeaa){logger[_0xc4e2('0xc')](_0xc4e2('0x1f'),_0x2a5cd6);logger[_0xc4e2('0xd')](_0xc4e2('0x1f'),_0x2a5cd6,JSON[_0xc4e2('0x10')](_0x21aeaa));_0x1f698d(_0x21aeaa);})[_0xc4e2('0x15')](function(_0x282860){logger['error']('ShowTrunk',_0x282860['message'],_0x2a5cd6);_0x663e63(_0x1e86f2[_0xc4e2('0x11')](0x1f4,_0x282860['message']));});});}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index 123a4ef..ee471ac 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 _0xb5ab=['path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./user.controller','get','isAuthenticated','index','describe','/whoami','whoami','/presence','getPresence','/:id','getAvatar','/:id/open_tabs','getOpenTabs','getContacts','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/chat/interactions','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','/:id/teams','/:id/lists','getLists','/:id/agents','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','/:id/chat_websites','getChatWebsites','getWhatsappAccounts','/:id/api_key','post','addContacts','create','bulkCreate','/:id/queues','addQueues','diskStorage','join','root','server/files/images/','originalname','/:id/avatar','/:id/login','login','/:id/logout','pause','/:id/unpause','unpause','addTeams','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addSmsAccounts','/:id/whatsapp_accounts','addWhatsappAccounts','/:id/square_projects','addSquareProjects','createApiKey','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','exports','multer','util'];(function(_0x1b2b13,_0x58fdb4){var _0xe9f43a=function(_0x299e83){while(--_0x299e83){_0x1b2b13['push'](_0x1b2b13['shift']());}};_0xe9f43a(++_0x58fdb4);}(_0xb5ab,0x1ae));var _0xbb5a=function(_0x466201,_0x4bb00e){_0x466201=_0x466201-0x0;var _0x768371=_0xb5ab[_0x466201];return _0x768371;};'use strict';var multer=require(_0xbb5a('0x0'));var util=require(_0xbb5a('0x1'));var path=require(_0xbb5a('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbb5a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbb5a('0x4'));var interaction=require(_0xbb5a('0x5'));var config=require(_0xbb5a('0x6'));var controller=require(_0xbb5a('0x7'));router[_0xbb5a('0x8')]('/',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0xa')]);router['get']('/describe',auth['isAuthenticated'](),controller[_0xbb5a('0xb')]);router[_0xbb5a('0x8')](_0xbb5a('0xc'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0xd')]);router[_0xbb5a('0x8')](_0xbb5a('0xe'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0xf')]);router[_0xbb5a('0x8')](_0xbb5a('0x10'),auth[_0xbb5a('0x9')](),controller['show']);router[_0xbb5a('0x8')]('/:id/avatar',controller[_0xbb5a('0x11')]);router[_0xbb5a('0x8')](_0xbb5a('0x12'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x13')]);router[_0xbb5a('0x8')]('/:id/contacts',auth['isAuthenticated'](),controller[_0xbb5a('0x14')]);router['get']('/:id/queues',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x15')]);router[_0xbb5a('0x8')](_0xbb5a('0x16'),auth['isAuthenticated'](),controller[_0xbb5a('0x17')]);router[_0xbb5a('0x8')](_0xbb5a('0x18'),auth['isAuthenticated'](),controller[_0xbb5a('0x19')]);router[_0xbb5a('0x8')]('/:id/recordings',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x1a')]);router[_0xbb5a('0x8')](_0xbb5a('0x1b'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x1c')]);router[_0xbb5a('0x8')](_0xbb5a('0x1d'),auth[_0xbb5a('0x9')](),controller['getChatInteractions']);router['get'](_0xbb5a('0x1e'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x1f')]);router[_0xbb5a('0x8')](_0xbb5a('0x20'),auth[_0xbb5a('0x9')](),controller['getMailInteractions']);router[_0xbb5a('0x8')](_0xbb5a('0x21'),auth[_0xbb5a('0x9')](),controller['getSmsInteractions']);router[_0xbb5a('0x8')](_0xbb5a('0x22'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x23')]);router[_0xbb5a('0x8')](_0xbb5a('0x24'),auth[_0xbb5a('0x9')](),controller['getWhatsappInteractions']);router[_0xbb5a('0x8')](_0xbb5a('0x25'),auth[_0xbb5a('0x9')](),controller['getTeams']);router[_0xbb5a('0x8')](_0xbb5a('0x26'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x27')]);router[_0xbb5a('0x8')](_0xbb5a('0x28'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x29')]);router[_0xbb5a('0x8')](_0xbb5a('0x2a'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x2b')]);router[_0xbb5a('0x8')](_0xbb5a('0x2c'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x2d')]);router[_0xbb5a('0x8')](_0xbb5a('0x2e'),auth['isAuthenticated'](),controller['getMailAccounts']);router['get'](_0xbb5a('0x2f'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x30')]);router['get'](_0xbb5a('0x31'),auth[_0xbb5a('0x9')](),controller['getSmsAccounts']);router[_0xbb5a('0x8')](_0xbb5a('0x32'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x33')]);router[_0xbb5a('0x8')]('/:id/whatsapp_accounts',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x34')]);router[_0xbb5a('0x8')]('/:id/square_projects',auth['isAuthenticated'](),controller['getSquareProjects']);router[_0xbb5a('0x8')]('/:id/scheduled_calls',auth[_0xbb5a('0x9')](),controller['getScheduledCalls']);router[_0xbb5a('0x8')](_0xbb5a('0x35'),auth[_0xbb5a('0x9')](),controller['getApiKey']);router[_0xbb5a('0x36')]('/:id/contacts',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x37')]);router[_0xbb5a('0x36')]('/',auth['isAuthenticated'](),controller[_0xbb5a('0x38')]);router[_0xbb5a('0x36')]('/create_many',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x39')]);router['post'](_0xbb5a('0x3a'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x3b')]);var upload=multer({'storage':multer[_0xbb5a('0x3c')]({'destination':function(_0x4bded2,_0x1f4e69,_0x584057){_0x584057(null,path[_0xbb5a('0x3d')](config[_0xbb5a('0x3e')],_0xbb5a('0x3f')));},'filename':function(_0x355ec1,_0x264111,_0x5a7bb6){_0x5a7bb6(null,util['format']('%s-%s',Date['now'](),_0x264111[_0xbb5a('0x40')]));}})});router[_0xbb5a('0x36')](_0xbb5a('0x41'),upload['single']('file'),controller['addAvatar']);router[_0xbb5a('0x36')](_0xbb5a('0x42'),auth['isAuthenticated'](),controller[_0xbb5a('0x43')]);router['post'](_0xbb5a('0x44'),auth['isAuthenticated'](),controller['logout']);router[_0xbb5a('0x36')]('/:id/pause',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x45')]);router[_0xbb5a('0x36')](_0xbb5a('0x46'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x47')]);router[_0xbb5a('0x36')](_0xbb5a('0x25'),auth['isAuthenticated'](),controller[_0xbb5a('0x48')]);router[_0xbb5a('0x36')]('/:id/chat_interactions',auth[_0xbb5a('0x9')](),controller['addChatInteractions']);router[_0xbb5a('0x36')]('/:id/mail_interactions',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x49')]);router[_0xbb5a('0x36')](_0xbb5a('0x4a'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x4b')]);router[_0xbb5a('0x36')](_0xbb5a('0x4c'),auth[_0xbb5a('0x9')](),controller['addSmsInteractions']);router[_0xbb5a('0x36')](_0xbb5a('0x4d'),auth[_0xbb5a('0x9')](),controller['addOpenchannelInteractions']);router['post'](_0xbb5a('0x4e'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x4f')]);router[_0xbb5a('0x36')](_0xbb5a('0x2c'),auth['isAuthenticated'](),controller['addFaxAccounts']);router[_0xbb5a('0x36')](_0xbb5a('0x2e'),auth['isAuthenticated'](),controller[_0xbb5a('0x50')]);router[_0xbb5a('0x36')]('/:id/openchannel_accounts',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x51')]);router['post'](_0xbb5a('0x31'),auth['isAuthenticated'](),controller[_0xbb5a('0x52')]);router[_0xbb5a('0x36')]('/:id/chat_websites',auth[_0xbb5a('0x9')](),controller['addChatWebsites']);router['post'](_0xbb5a('0x53'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x54')]);router[_0xbb5a('0x36')](_0xbb5a('0x55'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x56')]);router[_0xbb5a('0x36')](_0xbb5a('0x35'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x57')]);router[_0xbb5a('0x58')]('/:id',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x59')]);router[_0xbb5a('0x58')](_0xbb5a('0x5a'),auth[_0xbb5a('0x9')](),controller['changePassword']);router[_0xbb5a('0x5b')]('/:id/queues',auth['isAuthenticated'](),controller[_0xbb5a('0x5c')]);router[_0xbb5a('0x5b')](_0xbb5a('0x25'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x5d')]);router[_0xbb5a('0x5b')](_0xbb5a('0x10'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x5e')]);router[_0xbb5a('0x5b')](_0xbb5a('0x5f'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x60')]);router['delete']('/:id/mail_interactions',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x61')]);router[_0xbb5a('0x5b')](_0xbb5a('0x4a'),auth['isAuthenticated'](),controller[_0xbb5a('0x62')]);router[_0xbb5a('0x5b')](_0xbb5a('0x4c'),auth[_0xbb5a('0x9')](),controller['removeSmsInteractions']);router[_0xbb5a('0x5b')](_0xbb5a('0x4d'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xbb5a('0x5b')](_0xbb5a('0x4e'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x63')]);router[_0xbb5a('0x5b')]('/:id/fax_accounts',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x64')]);router[_0xbb5a('0x5b')](_0xbb5a('0x2e'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x65')]);router[_0xbb5a('0x5b')]('/:id/openchannel_accounts',auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x66')]);router['delete'](_0xbb5a('0x31'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x67')]);router['delete'](_0xbb5a('0x32'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x68')]);router[_0xbb5a('0x5b')](_0xbb5a('0x53'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x69')]);router[_0xbb5a('0x5b')]('/:id/square_projects',auth[_0xbb5a('0x9')](),controller['removeSquareProjects']);router[_0xbb5a('0x5b')](_0xbb5a('0x35'),auth[_0xbb5a('0x9')](),controller[_0xbb5a('0x6a')]);module[_0xbb5a('0x6b')]=router; \ No newline at end of file +var _0x998b=['join','root','format','%s-%s','now','originalname','single','file','/:id/login','login','/:id/logout','logout','/:id/pause','unpause','/:id/teams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addOpenchannelAccounts','addChatWebsites','addWhatsappAccounts','addSquareProjects','createApiKey','put','/:id/password','changePassword','delete','removeTeams','destroy','removeChatInteractions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','removeMailAccounts','removeOpenchannelAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeSquareProjects','removeApiKey','exports','util','path','connect-timeout','express','Router','../../components/auth/service','./user.controller','isAuthenticated','index','get','describe','/whoami','/presence','getPresence','/:id','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','getQueues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','getScreenRecordings','/:id/openchannel/interactions','getOpenchannelInteractions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/lists','getLists','getAgents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','/:id/square_projects','getSquareProjects','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','getApiKey','post','addContacts','create','bulkCreate','diskStorage'];(function(_0x57ef27,_0x36f83a){var _0x2c6a33=function(_0x5640ab){while(--_0x5640ab){_0x57ef27['push'](_0x57ef27['shift']());}};_0x2c6a33(++_0x36f83a);}(_0x998b,0xa0));var _0xb998=function(_0x4735b0,_0x33e46e){_0x4735b0=_0x4735b0-0x0;var _0x4d3c9e=_0x998b[_0x4735b0];return _0x4d3c9e;};'use strict';var multer=require('multer');var util=require(_0xb998('0x0'));var path=require(_0xb998('0x1'));var timeout=require(_0xb998('0x2'));var express=require(_0xb998('0x3'));var router=express[_0xb998('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb998('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xb998('0x6'));router['get']('/',auth[_0xb998('0x7')](),controller[_0xb998('0x8')]);router[_0xb998('0x9')]('/describe',auth[_0xb998('0x7')](),controller[_0xb998('0xa')]);router[_0xb998('0x9')](_0xb998('0xb'),auth[_0xb998('0x7')](),controller['whoami']);router[_0xb998('0x9')](_0xb998('0xc'),auth['isAuthenticated'](),controller[_0xb998('0xd')]);router[_0xb998('0x9')](_0xb998('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xb998('0x9')](_0xb998('0xf'),controller['getAvatar']);router['get'](_0xb998('0x10'),auth[_0xb998('0x7')](),controller['getOpenTabs']);router[_0xb998('0x9')](_0xb998('0x11'),auth['isAuthenticated'](),controller[_0xb998('0x12')]);router['get'](_0xb998('0x13'),auth[_0xb998('0x7')](),controller[_0xb998('0x14')]);router[_0xb998('0x9')](_0xb998('0x15'),auth['isAuthenticated'](),controller[_0xb998('0x16')]);router[_0xb998('0x9')](_0xb998('0x17'),auth[_0xb998('0x7')](),controller[_0xb998('0x18')]);router[_0xb998('0x9')](_0xb998('0x19'),auth[_0xb998('0x7')](),controller[_0xb998('0x1a')]);router[_0xb998('0x9')](_0xb998('0x1b'),auth[_0xb998('0x7')](),controller[_0xb998('0x1c')]);router[_0xb998('0x9')]('/:id/chat/interactions',auth[_0xb998('0x7')](),controller['getChatInteractions']);router[_0xb998('0x9')](_0xb998('0x1d'),auth['isAuthenticated'](),controller[_0xb998('0x1e')]);router['get'](_0xb998('0x1f'),auth[_0xb998('0x7')](),controller[_0xb998('0x20')]);router['get']('/:id/sms/interactions',auth[_0xb998('0x7')](),controller[_0xb998('0x21')]);router['get'](_0xb998('0x22'),auth['isAuthenticated'](),controller[_0xb998('0x23')]);router[_0xb998('0x9')](_0xb998('0x24'),auth[_0xb998('0x7')](),controller[_0xb998('0x25')]);router[_0xb998('0x9')]('/:id/teams',auth[_0xb998('0x7')](),controller['getTeams']);router[_0xb998('0x9')](_0xb998('0x26'),auth['isAuthenticated'](),controller[_0xb998('0x27')]);router[_0xb998('0x9')]('/:id/agents',auth[_0xb998('0x7')](),controller[_0xb998('0x28')]);router['get'](_0xb998('0x29'),auth[_0xb998('0x7')](),controller[_0xb998('0x2a')]);router[_0xb998('0x9')](_0xb998('0x2b'),auth['isAuthenticated'](),controller[_0xb998('0x2c')]);router[_0xb998('0x9')](_0xb998('0x2d'),auth[_0xb998('0x7')](),controller['getMailAccounts']);router['get'](_0xb998('0x2e'),auth[_0xb998('0x7')](),controller[_0xb998('0x2f')]);router[_0xb998('0x9')](_0xb998('0x30'),auth[_0xb998('0x7')](),controller[_0xb998('0x31')]);router[_0xb998('0x9')](_0xb998('0x32'),auth[_0xb998('0x7')](),controller[_0xb998('0x33')]);router[_0xb998('0x9')](_0xb998('0x34'),auth['isAuthenticated'](),controller['getWhatsappAccounts']);router[_0xb998('0x9')](_0xb998('0x35'),auth[_0xb998('0x7')](),controller[_0xb998('0x36')]);router[_0xb998('0x9')](_0xb998('0x37'),auth['isAuthenticated'](),controller[_0xb998('0x38')]);router[_0xb998('0x9')](_0xb998('0x39'),auth[_0xb998('0x7')](),controller[_0xb998('0x3a')]);router[_0xb998('0x3b')](_0xb998('0x11'),auth[_0xb998('0x7')](),controller[_0xb998('0x3c')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb998('0x3d')]);router[_0xb998('0x3b')]('/create_many',auth[_0xb998('0x7')](),controller[_0xb998('0x3e')]);router['post'](_0xb998('0x13'),auth[_0xb998('0x7')](),controller['addQueues']);var upload=multer({'storage':multer[_0xb998('0x3f')]({'destination':function(_0x5d13a1,_0x82dde9,_0x235595){_0x235595(null,path[_0xb998('0x40')](config[_0xb998('0x41')],'server/files/images/'));},'filename':function(_0x56b092,_0x3081da,_0x38eecd){_0x38eecd(null,util[_0xb998('0x42')](_0xb998('0x43'),Date[_0xb998('0x44')](),_0x3081da[_0xb998('0x45')]));}})});router['post'](_0xb998('0xf'),upload[_0xb998('0x46')](_0xb998('0x47')),controller['addAvatar']);router[_0xb998('0x3b')](_0xb998('0x48'),auth[_0xb998('0x7')](),controller[_0xb998('0x49')]);router[_0xb998('0x3b')](_0xb998('0x4a'),auth[_0xb998('0x7')](),controller[_0xb998('0x4b')]);router[_0xb998('0x3b')](_0xb998('0x4c'),auth[_0xb998('0x7')](),controller['pause']);router['post']('/:id/unpause',auth[_0xb998('0x7')](),controller[_0xb998('0x4d')]);router['post'](_0xb998('0x4e'),auth[_0xb998('0x7')](),controller['addTeams']);router[_0xb998('0x3b')](_0xb998('0x4f'),auth[_0xb998('0x7')](),controller[_0xb998('0x50')]);router[_0xb998('0x3b')](_0xb998('0x51'),auth['isAuthenticated'](),controller[_0xb998('0x52')]);router[_0xb998('0x3b')](_0xb998('0x53'),auth[_0xb998('0x7')](),controller[_0xb998('0x54')]);router[_0xb998('0x3b')](_0xb998('0x55'),auth[_0xb998('0x7')](),controller['addSmsInteractions']);router[_0xb998('0x3b')](_0xb998('0x56'),auth['isAuthenticated'](),controller[_0xb998('0x57')]);router[_0xb998('0x3b')](_0xb998('0x58'),auth[_0xb998('0x7')](),controller['addWhatsappInteractions']);router[_0xb998('0x3b')]('/:id/fax_accounts',auth[_0xb998('0x7')](),controller['addFaxAccounts']);router[_0xb998('0x3b')](_0xb998('0x2d'),auth[_0xb998('0x7')](),controller['addMailAccounts']);router[_0xb998('0x3b')](_0xb998('0x2e'),auth[_0xb998('0x7')](),controller[_0xb998('0x59')]);router['post'](_0xb998('0x30'),auth[_0xb998('0x7')](),controller['addSmsAccounts']);router[_0xb998('0x3b')](_0xb998('0x32'),auth[_0xb998('0x7')](),controller[_0xb998('0x5a')]);router[_0xb998('0x3b')]('/:id/whatsapp_accounts',auth[_0xb998('0x7')](),controller[_0xb998('0x5b')]);router[_0xb998('0x3b')](_0xb998('0x35'),auth[_0xb998('0x7')](),controller[_0xb998('0x5c')]);router['post'](_0xb998('0x39'),auth['isAuthenticated'](),controller[_0xb998('0x5d')]);router[_0xb998('0x5e')](_0xb998('0xe'),auth[_0xb998('0x7')](),controller['update']);router[_0xb998('0x5e')](_0xb998('0x5f'),auth['isAuthenticated'](),controller[_0xb998('0x60')]);router[_0xb998('0x61')](_0xb998('0x13'),auth[_0xb998('0x7')](),controller['removeQueues']);router['delete']('/:id/teams',auth[_0xb998('0x7')](),controller[_0xb998('0x62')]);router[_0xb998('0x61')](_0xb998('0xe'),auth['isAuthenticated'](),controller[_0xb998('0x63')]);router['delete'](_0xb998('0x4f'),auth[_0xb998('0x7')](),controller[_0xb998('0x64')]);router[_0xb998('0x61')](_0xb998('0x51'),auth[_0xb998('0x7')](),controller[_0xb998('0x65')]);router[_0xb998('0x61')](_0xb998('0x53'),auth[_0xb998('0x7')](),controller[_0xb998('0x66')]);router['delete']('/:id/sms_interactions',auth[_0xb998('0x7')](),controller['removeSmsInteractions']);router[_0xb998('0x61')](_0xb998('0x56'),auth[_0xb998('0x7')](),controller[_0xb998('0x67')]);router[_0xb998('0x61')]('/:id/whatsapp_interactions',auth[_0xb998('0x7')](),controller['removeWhatsappInteractions']);router[_0xb998('0x61')](_0xb998('0x2b'),auth[_0xb998('0x7')](),controller['removeFaxAccounts']);router[_0xb998('0x61')](_0xb998('0x2d'),auth['isAuthenticated'](),controller[_0xb998('0x68')]);router[_0xb998('0x61')](_0xb998('0x2e'),auth['isAuthenticated'](),controller[_0xb998('0x69')]);router[_0xb998('0x61')](_0xb998('0x30'),auth[_0xb998('0x7')](),controller[_0xb998('0x6a')]);router['delete'](_0xb998('0x32'),auth[_0xb998('0x7')](),controller[_0xb998('0x6b')]);router[_0xb998('0x61')](_0xb998('0x34'),auth[_0xb998('0x7')](),controller[_0xb998('0x6c')]);router[_0xb998('0x61')](_0xb998('0x35'),auth[_0xb998('0x7')](),controller[_0xb998('0x6d')]);router['delete'](_0xb998('0x39'),auth[_0xb998('0x7')](),controller[_0xb998('0x6e')]);module[_0xb998('0x6f')]=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index d04bd9e..5ac014c 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 _0x52aa=['dtlsenable','dtlsverify','dtlscertfile','dtlsprivatekey','avpf','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','rtcp_mux','permissions','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','false','loginAttempts','moment','util','lodash','exports','STRING','name','setDataValue','defaultuser','fullname','callerid','format','\x22%s\x22\x20<%s>','getDataValue','internal','email','toLowerCase','ENUM','admin','user','agent','telephone','local','INTEGER','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','ALLOWED_NOT_SCREENED','ALLOWED_PASSED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','udp','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','shortinfo','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','never','\x22\x22\x20<>','always','accept','refuse','uac','uas','fingerprint','active','passive','actpass','update','update,nonat','TEXT','showWebBar','get','isArray','wss','encryption','force_avp','icesupport'];(function(_0x862ea5,_0x2bf3b4){var _0x417e3e=function(_0x3ed16e){while(--_0x3ed16e){_0x862ea5['push'](_0x862ea5['shift']());}};_0x417e3e(++_0x2bf3b4);}(_0x52aa,0x113));var _0xa52a=function(_0x320198,_0x136c87){_0x320198=_0x320198-0x0;var _0x355481=_0x52aa[_0x320198];return _0x355481;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa52a('0x0'));var util=require(_0xa52a('0x1'));var _=require(_0xa52a('0x2'));module[_0xa52a('0x3')]={'name':{'type':Sequelize[_0xa52a('0x4')],'allowNull':![],'unique':_0xa52a('0x5'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x1145c1){this[_0xa52a('0x6')](_0xa52a('0x5'),_0x1145c1);this[_0xa52a('0x6')](_0xa52a('0x7'),_0x1145c1);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize['STRING'],'allowNull':![],'set':function(_0x8609ec){this[_0xa52a('0x6')](_0xa52a('0x8'),_0x8609ec);this[_0xa52a('0x6')](_0xa52a('0x9'),util[_0xa52a('0xa')](_0xa52a('0xb'),_0x8609ec,this[_0xa52a('0xc')](_0xa52a('0xd'))));}},'alias':{'type':Sequelize[_0xa52a('0x4')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xa52a('0xe'),'validate':{'isEmail':!![]},'set':function(_0x547708){if(_0x547708){this[_0xa52a('0x6')](_0xa52a('0xe'),_0x547708[_0xa52a('0xf')]());}}},'role':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x11'),_0xa52a('0x12'),_0xa52a('0x13'),_0xa52a('0x14')),'allowNull':![]},'password':{'type':Sequelize[_0xa52a('0x4')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xa52a('0x4')],'defaultValue':_0xa52a('0x15')},'internal':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':![],'unique':_0xa52a('0xd'),'set':function(_0x482f79){this['setDataValue'](_0xa52a('0xd'),_0x482f79);this[_0xa52a('0x6')]('accountcode',_0x482f79);this[_0xa52a('0x6')](_0xa52a('0x9'),util[_0xa52a('0xa')](_0xa52a('0xb'),this[_0xa52a('0xc')](_0xa52a('0x8')),_0x482f79));}},'salt':{'type':Sequelize[_0xa52a('0x4')]},'phone':{'type':Sequelize[_0xa52a('0x4')]},'mobile':{'type':Sequelize[_0xa52a('0x4')]},'address':{'type':Sequelize[_0xa52a('0x4')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize[_0xa52a('0x4')]},'city':{'type':Sequelize[_0xa52a('0x4')]},'country':{'type':Sequelize[_0xa52a('0x4')]},'online':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xa52a('0x18')]},'voicePause':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'chatPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xa52a('0x4')],'defaultValue':_0xa52a('0x19')},'lastPauseAt':{'type':Sequelize[_0xa52a('0x18')]},'chatCapacity':{'type':Sequelize[_0xa52a('0x16')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xa52a('0x16')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xa52a('0x16')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xa52a('0x16')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'description':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'host':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![],'defaultValue':_0xa52a('0x1a')},'ipaddr':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'port':{'type':Sequelize[_0xa52a('0x16')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'useragent':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'lastms':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x1b'),_0xa52a('0x12'),_0xa52a('0x1c')),'allowNull':!![],'defaultValue':_0xa52a('0x1b')},'context':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![],'defaultValue':'from-sip'},'callingpres':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x1d'),_0xa52a('0x1e'),'ALLOWED_FAILED_SCREEN','ALLOWED',_0xa52a('0x1f'),_0xa52a('0x20'),_0xa52a('0x21'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'permit':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'secret':{'type':Sequelize['STRING'],'allowNull':!![]},'md5secret':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'transport':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![],'defaultValue':_0xa52a('0x22'),'set':function(_0x15a2a4){this[_0xa52a('0x6')](_0xa52a('0x23'),_0x15a2a4?_0x15a2a4[_0xa52a('0x24')](','):null);},'get':function(){return this['getDataValue'](_0xa52a('0x23'))?this['getDataValue']('transport')[_0xa52a('0x25')](','):null;},'comment':_0xa52a('0x26')},'dtmfmode':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x27'),'info',_0xa52a('0x28'),'inband',_0xa52a('0x29')),'allowNull':!![],'defaultValue':'rfc2833'},'directmedia':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no',_0xa52a('0x2b'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'nat':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![],'defaultValue':_0xa52a('0x2c'),'set':function(_0x43342a){this[_0xa52a('0x6')]('nat',_0x43342a?_0x43342a['join'](','):null);},'get':function(){return this['getDataValue'](_0xa52a('0x2d'))?this[_0xa52a('0xc')]('nat')['split'](','):null;},'comment':_0xa52a('0x2e')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0xa52a('0x4')]},'pickupgroup':{'type':Sequelize[_0xa52a('0x4')]},'namedpickupgroup':{'type':Sequelize[_0xa52a('0x4')]},'language':{'type':Sequelize[_0xa52a('0x4')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xa52a('0x4')],'allowNull':![],'defaultValue':_0xa52a('0x2f')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x5ffb0f){this[_0xa52a('0x6')](_0xa52a('0x30'),_0x5ffb0f?_0x5ffb0f['join'](';'):_0xa52a('0x31'));},'get':function(){return this['getDataValue'](_0xa52a('0x30'))?this[_0xa52a('0xc')](_0xa52a('0x30'))[_0xa52a('0x25')](';'):null;},'comment':_0xa52a('0x32')},'autoframing':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![],'set':function(_0x4b04b3){this[_0xa52a('0x6')](_0xa52a('0x33'),_0x4b04b3?_0x4b04b3[_0xa52a('0x24')](','):null);},'get':function(){return this[_0xa52a('0xc')]('insecure')?this[_0xa52a('0xc')]('insecure')[_0xa52a('0x25')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize['ENUM'](_0xa52a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM'](_0xa52a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no',_0xa52a('0x34')),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0xa52a('0x2a'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize['ENUM'](_0xa52a('0x2a'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'callerid':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![],'defaultValue':_0xa52a('0x35')},'amaflags':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xa52a('0x10')]('yes','no'),'allowNull':!![],'defaultValue':_0xa52a('0x2a')},'busylevel':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xa52a('0x2a'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xa52a('0x2a'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'template':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xa52a('0x2a'),'no',_0xa52a('0x36')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x37'),_0xa52a('0x38'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x39'),_0xa52a('0x3a')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'regexten':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![],'defaultValue':_0xa52a('0x2a')},'keepalive':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize['STRING'],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xa52a('0x10')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize['STRING'],'allowNull':!![]},'callbackextension':{'type':Sequelize['STRING'],'allowNull':!![]},'timert1':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xa52a('0x2a'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no',_0xa52a('0x3b'),'certificate'),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xa52a('0x16')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x3c'),_0xa52a('0x3d'),_0xa52a('0x3e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xa52a('0x10')](_0xa52a('0x2a'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'mohsuggest':{'type':Sequelize['STRING'],'allowNull':!![]},'parkinglot':{'type':Sequelize['STRING'],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xa52a('0x10')]('yes','no',_0xa52a('0x2b'),_0xa52a('0x3f'),_0xa52a('0x40')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xa52a('0x4')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xa52a('0x18')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xa52a('0x41')]},'showWebBar':{'type':Sequelize[_0xa52a('0x16')],'defaultValue':0x0,'set':function(_0x4e3957){this['setDataValue'](_0xa52a('0x42'),_0x4e3957);var _0x149461=this[_0xa52a('0x43')]({'plain':!![]});switch(_0x4e3957){case 0x0:case 0x1:var _0x598326=_0x149461[_0xa52a('0x23')]?_[_0xa52a('0x44')](_0x149461[_0xa52a('0x23')])?_0x149461[_0xa52a('0x23')][_0xa52a('0x24')]():_0x149461[_0xa52a('0x23')]:_0xa52a('0x22');if(_0x598326===_0xa52a('0x45')){_0x598326=_0xa52a('0x22');}this[_0xa52a('0x6')](_0xa52a('0x23'),_0x598326);this[_0xa52a('0x6')](_0xa52a('0x46'),'no');this[_0xa52a('0x6')]('avpf',null);this[_0xa52a('0x6')](_0xa52a('0x47'),null);this[_0xa52a('0x6')](_0xa52a('0x48'),null);this[_0xa52a('0x6')](_0xa52a('0x49'),null);this[_0xa52a('0x6')](_0xa52a('0x4a'),null);this[_0xa52a('0x6')]('dtlssetup',null);this['setDataValue'](_0xa52a('0x4b'),null);this['setDataValue'](_0xa52a('0x4c'),null);this[_0xa52a('0x6')]('rtcp_mux','no');break;case 0x2:this[_0xa52a('0x6')](_0xa52a('0x23'),'wss');this[_0xa52a('0x6')](_0xa52a('0x46'),_0xa52a('0x2a'));this['setDataValue'](_0xa52a('0x4d'),_0xa52a('0x2a'));this[_0xa52a('0x6')]('force_avp','yes');this[_0xa52a('0x6')]('icesupport',_0xa52a('0x2a'));this['setDataValue'](_0xa52a('0x49'),_0xa52a('0x2a'));this[_0xa52a('0x6')]('dtlsverify','no');this[_0xa52a('0x6')]('dtlssetup',_0xa52a('0x3e'));this[_0xa52a('0x6')]('dtlscertfile',_0x149461[_0xa52a('0x4b')]||_0xa52a('0x4e'));this[_0xa52a('0x6')](_0xa52a('0x4c'),_0x149461[_0xa52a('0x4c')]||_0xa52a('0x4f'));this['setDataValue'](_0xa52a('0x50'),_0xa52a('0x2a'));break;default:}}},'permissions':{'type':Sequelize[_0xa52a('0x41')],'set':function(_0xd395e0){this[_0xa52a('0x6')](_0xa52a('0x51'),_0xd395e0?_0xd395e0[_0xa52a('0x24')](','):[]);},'get':function(){return this['getDataValue']('permissions')?_['map'](this[_0xa52a('0xc')](_0xa52a('0x51'))['split'](','),function(_0x249b5b){return parseInt(_0x249b5b,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0xa52a('0x4')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize['STRING']},'phoneBarUnconditional':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xa52a('0x4')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xa52a('0x16')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM'](_0xa52a('0x2a'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xa52a('0x4')]},'phoneBarEnableJaws':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xa52a('0x52')],'get':function(){return this[_0xa52a('0xc')](_0xa52a('0x53'))?this['getDataValue'](_0xa52a('0x53')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'interface':{'type':Sequelize[_0xa52a('0x4')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xa52a('0x4')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':![],'set':function(_0x373e75){if(typeof _0x373e75===_0xa52a('0x54')){var _0x1038c6=_0x373e75==='1'?!![]:_0x373e75==='0'?![]:_0x373e75==='true'?!![]:_0x373e75===_0xa52a('0x55')?![]:![];this[_0xa52a('0x6')]('screenrecording',_0x1038c6);}else{this[_0xa52a('0x6')]('screenrecording',_0x373e75);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x492c57){this[_0xa52a('0x6')]('blocked',_0x492c57);if(_0x492c57===!![]){this[_0xa52a('0x6')]('blockedAt',moment());this[_0xa52a('0x6')](_0xa52a('0x56'),0x0);}else{this[_0xa52a('0x6')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xa52a('0x16')],'defaultValue':0x0},'disabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xa52a('0x16')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xa52a('0x17')],'defaultValue':!![]}}; \ No newline at end of file +var _0x297f=['shortinfo','auto','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','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]','insecure','\x22\x22\x20<>','always','accept','refuse','uac','uas','certificate','active','passive','actpass','update,nonat','TEXT','isArray','udp','wss','encryption','avpf','force_avp','icesupport','dtlsverify','dtlssetup','dtlsprivatekey','rtcp_mux','dtlsenable','dtlscertfile','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','UNSIGNED','sequelize','moment','exports','STRING','name','defaultuser','The\x20name\x20of\x20the\x20user','fullname','setDataValue','callerid','\x22%s\x22\x20<%s>','getDataValue','email','toLowerCase','admin','telephone','local','INTEGER','internal','accountcode','format','BOOLEAN','DATE','dynamic','peer','friend','from-sip','ENUM','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB_FAILED_SCREEN','transport','join','split','rfc2833','info'];(function(_0x3ac119,_0x3889ee){var _0x30d5b6=function(_0x32a156){while(--_0x32a156){_0x3ac119['push'](_0x3ac119['shift']());}};_0x30d5b6(++_0x3889ee);}(_0x297f,0x1f0));var _0xf297=function(_0x19ebf7,_0x5b1007){_0x19ebf7=_0x19ebf7-0x0;var _0x3d0cad=_0x297f[_0x19ebf7];return _0x3d0cad;};'use strict';var Sequelize=require(_0xf297('0x0'));var moment=require(_0xf297('0x1'));var util=require('util');var _=require('lodash');module[_0xf297('0x2')]={'name':{'type':Sequelize[_0xf297('0x3')],'allowNull':![],'unique':_0xf297('0x4'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x39ec01){this['setDataValue'](_0xf297('0x4'),_0x39ec01);this['setDataValue'](_0xf297('0x5'),_0x39ec01);},'comment':_0xf297('0x6')},'fullname':{'type':Sequelize[_0xf297('0x3')],'allowNull':![],'set':function(_0x4bb956){this['setDataValue'](_0xf297('0x7'),_0x4bb956);this[_0xf297('0x8')](_0xf297('0x9'),util['format'](_0xf297('0xa'),_0x4bb956,this[_0xf297('0xb')]('internal')));}},'alias':{'type':Sequelize[_0xf297('0x3')]},'email':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xf297('0xc'),'validate':{'isEmail':!![]},'set':function(_0x372df7){if(_0x372df7){this[_0xf297('0x8')]('email',_0x372df7[_0xf297('0xd')]());}}},'role':{'type':Sequelize['ENUM'](_0xf297('0xe'),'user','agent',_0xf297('0xf')),'allowNull':![]},'password':{'type':Sequelize[_0xf297('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0xf297('0x3')],'defaultValue':_0xf297('0x10')},'internal':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':![],'unique':_0xf297('0x12'),'set':function(_0x5c5e7c){this[_0xf297('0x8')](_0xf297('0x12'),_0x5c5e7c);this['setDataValue'](_0xf297('0x13'),_0x5c5e7c);this['setDataValue'](_0xf297('0x9'),util[_0xf297('0x14')](_0xf297('0xa'),this['getDataValue']('fullname'),_0x5c5e7c));}},'salt':{'type':Sequelize[_0xf297('0x3')]},'phone':{'type':Sequelize[_0xf297('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize['STRING']},'zipcode':{'type':Sequelize[_0xf297('0x3')]},'userpic':{'type':Sequelize[_0xf297('0x3')]},'city':{'type':Sequelize['STRING']},'country':{'type':Sequelize[_0xf297('0x3')]},'online':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0xf297('0x16')]},'voicePause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatPause':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0xf297('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0xf297('0x16')]},'chatCapacity':{'type':Sequelize[_0xf297('0x11')],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0xf297('0x11')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0xf297('0x11')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0xf297('0x11')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0xf297('0x11')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0xf297('0x11')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0xf297('0x11')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf297('0x17')},'ipaddr':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0xf297('0x11')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize['STRING'],'allowNull':!![]},'lastms':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'type':{'type':Sequelize['ENUM']('friend','user',_0xf297('0x18')),'allowNull':!![],'defaultValue':_0xf297('0x19')},'context':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![],'defaultValue':_0xf297('0x1a')},'callingpres':{'type':Sequelize[_0xf297('0x1b')]('ALLOWED_NOT_SCREENED',_0xf297('0x1c'),_0xf297('0x1d'),'ALLOWED',_0xf297('0x1e'),_0xf297('0x1f'),_0xf297('0x20'),'PROHIB'),'allowNull':!![]},'deny':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize['STRING'],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x2242ab){this[_0xf297('0x8')](_0xf297('0x21'),_0x2242ab?_0x2242ab[_0xf297('0x22')](','):null);},'get':function(){return this[_0xf297('0xb')](_0xf297('0x21'))?this['getDataValue'](_0xf297('0x21'))[_0xf297('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x24'),_0xf297('0x25'),_0xf297('0x26'),'inband',_0xf297('0x27')),'allowNull':!![],'defaultValue':_0xf297('0x24')},'directmedia':{'type':Sequelize[_0xf297('0x1b')]('yes','no',_0xf297('0x28'),_0xf297('0x29'),_0xf297('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![],'defaultValue':'force_rport,comedia','set':function(_0x3be1d3){this[_0xf297('0x8')](_0xf297('0x2c'),_0x3be1d3?_0x3be1d3[_0xf297('0x22')](','):null);},'get':function(){return this[_0xf297('0xb')](_0xf297('0x2c'))?this[_0xf297('0xb')](_0xf297('0x2c'))[_0xf297('0x23')](','):null;},'comment':_0xf297('0x2d')},'callgroup':{'type':Sequelize[_0xf297('0x3')]},'namedcallgroup':{'type':Sequelize[_0xf297('0x3')]},'pickupgroup':{'type':Sequelize[_0xf297('0x3')]},'namedpickupgroup':{'type':Sequelize[_0xf297('0x3')]},'language':{'type':Sequelize[_0xf297('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize['STRING']},'disallow':{'type':Sequelize[_0xf297('0x3')],'allowNull':![],'defaultValue':_0xf297('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xf297('0x2f'),'set':function(_0x463b21){this[_0xf297('0x8')](_0xf297('0x30'),_0x463b21?_0x463b21[_0xf297('0x22')](';'):_0xf297('0x2f'));},'get':function(){return this['getDataValue']('allow')?this[_0xf297('0xb')](_0xf297('0x30'))[_0xf297('0x23')](';'):null;},'comment':_0xf297('0x31')},'autoframing':{'type':Sequelize[_0xf297('0x1b')]('yes','no'),'allowNull':!![]},'insecure':{'type':Sequelize['STRING'],'allowNull':!![],'set':function(_0x5a54d2){this[_0xf297('0x8')](_0xf297('0x32'),_0x5a54d2?_0x5a54d2['join'](','):null);},'get':function(){return this[_0xf297('0xb')]('insecure')?this[_0xf297('0xb')](_0xf297('0x32'))[_0xf297('0x23')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0xf297('0x1b')]('yes','no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0xf297('0x33')},'amaflags':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0xf297('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':'yes'},'busylevel':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize['ENUM'](_0xf297('0x2b'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize['ENUM'](_0xf297('0x2b'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xf297('0x2b'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize['STRING'],'allowNull':!![]},'template':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize['ENUM'](_0xf297('0x2b'),'no',_0xf297('0x34')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x35'),_0xf297('0x36'),'originate'),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x37'),_0xf297('0x38')),'allowNull':!![],'defaultValue':_0xf297('0x38')},'t38pt_usertpsource':{'type':Sequelize['STRING'],'allowNull':!![]},'regexten':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0xf297('0x1b')]('yes','no'),'allowNull':!![],'defaultValue':_0xf297('0x2b')},'keepalive':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0xf297('0x2b'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no','fingerprint',_0xf297('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x3a'),_0xf297('0x3b'),_0xf297('0x3c')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize['STRING'],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM'](_0xf297('0x2b'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0xf297('0x11')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0xf297('0x1b')](_0xf297('0x2b'),'no',_0xf297('0x28'),_0xf297('0x29'),_0xf297('0x3d')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0xf297('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0xf297('0x16')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0xf297('0x3e')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x36bd14){this[_0xf297('0x8')]('showWebBar',_0x36bd14);var _0x250414=this['get']({'plain':!![]});switch(_0x36bd14){case 0x0:case 0x1:var _0x3d1acf=_0x250414[_0xf297('0x21')]?_[_0xf297('0x3f')](_0x250414['transport'])?_0x250414[_0xf297('0x21')]['join']():_0x250414[_0xf297('0x21')]:_0xf297('0x40');if(_0x3d1acf===_0xf297('0x41')){_0x3d1acf=_0xf297('0x40');}this['setDataValue'](_0xf297('0x21'),_0x3d1acf);this[_0xf297('0x8')](_0xf297('0x42'),'no');this[_0xf297('0x8')](_0xf297('0x43'),null);this[_0xf297('0x8')](_0xf297('0x44'),null);this['setDataValue'](_0xf297('0x45'),null);this[_0xf297('0x8')]('dtlsenable',null);this['setDataValue'](_0xf297('0x46'),null);this[_0xf297('0x8')](_0xf297('0x47'),null);this[_0xf297('0x8')]('dtlscertfile',null);this[_0xf297('0x8')](_0xf297('0x48'),null);this['setDataValue'](_0xf297('0x49'),'no');break;case 0x2:this[_0xf297('0x8')](_0xf297('0x21'),_0xf297('0x41'));this[_0xf297('0x8')]('encryption',_0xf297('0x2b'));this[_0xf297('0x8')](_0xf297('0x43'),_0xf297('0x2b'));this[_0xf297('0x8')](_0xf297('0x44'),_0xf297('0x2b'));this[_0xf297('0x8')](_0xf297('0x45'),_0xf297('0x2b'));this['setDataValue'](_0xf297('0x4a'),'yes');this['setDataValue'](_0xf297('0x46'),'no');this[_0xf297('0x8')](_0xf297('0x47'),_0xf297('0x3c'));this[_0xf297('0x8')](_0xf297('0x4b'),_0x250414[_0xf297('0x4b')]||_0xf297('0x4c'));this['setDataValue'](_0xf297('0x48'),_0x250414['dtlsprivatekey']||_0xf297('0x4d'));this[_0xf297('0x8')](_0xf297('0x49'),_0xf297('0x2b'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0x86a157){this['setDataValue']('permissions',_0x86a157?_0x86a157[_0xf297('0x22')](','):[]);},'get':function(){return this[_0xf297('0xb')](_0xf297('0x4e'))?_[_0xf297('0x4f')](this[_0xf297('0xb')](_0xf297('0x4e'))['split'](','),function(_0x2f67b5){return parseInt(_0x2f67b5,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize['STRING']},'phoneBarNoReplyNumber':{'type':Sequelize[_0xf297('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0xf297('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0xf297('0x15')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0xf297('0x15')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0xf297('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0xf297('0x11')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0xf297('0x15')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize[_0xf297('0x3')]},'phoneBarEnableJaws':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0xf297('0x50')],'get':function(){return this['getDataValue']('phoneBarEnableScreenRecordingByAgent')?this[_0xf297('0xb')]('phoneBarEnableScreenRecordingByAgent'):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'interface':{'type':Sequelize[_0xf297('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0xf297('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![],'set':function(_0x59c595){if(typeof _0x59c595===_0xf297('0x51')){var _0x449a46=_0x59c595==='1'?!![]:_0x59c595==='0'?![]:_0x59c595===_0xf297('0x52')?!![]:_0x59c595===_0xf297('0x53')?![]:![];this[_0xf297('0x8')](_0xf297('0x54'),_0x449a46);}else{this[_0xf297('0x8')](_0xf297('0x54'),_0x59c595);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x47f733){this['setDataValue'](_0xf297('0x55'),_0x47f733);if(_0x47f733===!![]){this[_0xf297('0x8')](_0xf297('0x56'),moment());this[_0xf297('0x8')](_0xf297('0x57'),0x0);}else{this['setDataValue'](_0xf297('0x56'),null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0xf297('0x11')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0xf297('0x15')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize[_0xf297('0x15')],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0xf297('0x11')](0x5)[_0xf297('0x58')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0xf297('0x15')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xf297('0x15')],'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 03d2712..aca5787 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 _0xaecc=['UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','MailInteraction','getSmsInteractions','getFaxInteractions','getWhatsappInteractions','login','phone','format','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','remoteAddress','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','each','upsert','MemberReport','forEach','LOGIN','device','PAUSE','LOGININPAUSE','concat','YYYY-MM-DD\x20HH:mm:ss','isMiddleware','resolve','logout','pause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','mailPause','chatPause','openchannelPause','smsPause','whatsapppause','pauseType','lastPauseAt','manual','QueuePause','Team','getTeams','setDataValue','Voice','getChatQueues','Chat','Mail','getSmsQueues','getWhatsappQueues','Fax','getOpenchannelQueues','flatten','transaction','addAgent','getDataValue','removeTeams','getMailQueues','Sms','Whatsapp','getFaxQueues','Openchannel','removeAgent','getLists','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','removeChatInteractions','isArray','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','removeMailInteractions','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','removeWhatsappInteractions','getVoicePrefixes','VoicePrefix','getFaxAccounts','addFaxAccounts','removeFaxAccounts','getMailAccounts','MailAccount','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','removeWhatsappAccounts','getSquareProjects','SquareProject','addSquareProjects','removeSquareProjects','getScheduledCalls','CmHopper','$and','$lt','$ne','$eq','$between','$notBetween','$in','$notIn','$like','$notLike','$iLike','$notILike','$overlap','$contains','$any','firstName','Contact','getApiKey','retrieveApiKey','token','No\x20API\x20access\x20key\x20found!','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','generateApiKey','iat','apiKeyNonce','API\x20key\x20not\x20available','whoami','Unable\x20to\x20retrieve\x20the\x20current\x20user','getPresence','teams','queues','VoiceQueue','inbound','asc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','http','idle','unknown','unavailable','ringing','voiceStatus','charAt','slice','select','field','ui.','ui.createdAt','user_has_','ui.UserId\x20=\x20?','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./user.socket','register','jayson/promise','request','User,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','role','Users','Telephones','telephone','filter','ignore','map','value','includes','find','UserProfileResource','stack','name','send','fieldName','key','differenceBy','password','salt','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','where','pick','VIRTUAL','sequelize','lower','col','merge','options','User','includeAll','include','push','findAll','rows','openTabs','true','chat','dataValues','sms','openchannel','whatsapp','all','show','params','rawAttributes','fax','body','describe','addContacts','ids','internal','securePassword','validatePasswordPattern','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)','QueryTypes','SELECT','from','voicemail','mailbox','VoiceMail','fullname','agent','permissions','101','102','113','110','104','105','106','107','108','100','111','114','115','create','user','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','Agents','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','bulkCreate','some','isEmpty','autoAssociation','compact','oldPassword','newPassword','Sequelize','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','ValidationError','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','Setting','findOne','enforcePasswordHistory','passwordHistoryLimit','previousPasswords','validatePasswordHistory','updatePasswordsHistory','addQueues','channel','online','loginInPause','interface','isValidChannel','Unknown\x20channel','add','capitalize','toLowerCase','Queues','penalty','spread','Queue:save','voice','SIP/%s','voicePause','remove','QueueId','emit','Queue:remove','addAvatar','userpic','file','join','download','root','server/files/images/','mail','ChatOpenTabs','createdAt','FaxOpenTabs','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','getContacts','order','CmList','List','Tag','Tags','color','tag','getQueues','Queue','get','Unknown\x20role','getVoiceQueuesRt','UserVoiceQueueRt','ChatGroup','getGroups','getRecordings','VoiceRecording'];(function(_0x28663a,_0x1078a4){var _0x2d3d17=function(_0x9714a0){while(--_0x9714a0){_0x28663a['push'](_0x28663a['shift']());}};_0x2d3d17(++_0x1078a4);}(_0xaecc,0xb1));var _0xcaec=function(_0x3b5377,_0x1cf47a){_0x3b5377=_0x3b5377-0x0;var _0x40ffde=_0xaecc[_0x3b5377];return _0x40ffde;};'use strict';var emlformat=require(_0xcaec('0x0'));var rimraf=require(_0xcaec('0x1'));var zipdir=require(_0xcaec('0x2'));var jsonpatch=require(_0xcaec('0x3'));var rp=require(_0xcaec('0x4'));var moment=require(_0xcaec('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xcaec('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xcaec('0x7'));var ejs=require(_0xcaec('0x8'));var fs=require('fs');var fs_extra=require(_0xcaec('0x9'));var _=require(_0xcaec('0xa'));var squel=require(_0xcaec('0xb'));var crypto=require(_0xcaec('0xc'));var jsforce=require(_0xcaec('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xcaec('0xe'));var Papa=require(_0xcaec('0xf'));var Redis=require(_0xcaec('0x10'));var values;var authService=require(_0xcaec('0x11'));var qs=require(_0xcaec('0x12'));var as=require(_0xcaec('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xcaec('0x14'));var utils=require('../../config/utils');var config=require(_0xcaec('0x15'));var licenseUtil=require(_0xcaec('0x16'));var db=require('../../mysqldb')['db'];config[_0xcaec('0x17')]=_[_0xcaec('0x18')](config[_0xcaec('0x17')],{'host':_0xcaec('0x19'),'port':0x18eb});var socket=require(_0xcaec('0x1a'))(new Redis(config[_0xcaec('0x17')]));require(_0xcaec('0x1b'))[_0xcaec('0x1c')](socket);var jayson=require(_0xcaec('0x1d'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xef39e5,_0x130ca7,_0x45b6b0,_0x463270){return new BPromise(function(_0x5ea737,_0x4dbf00){var _0x280e79=_0x463270||client;return _0x280e79[_0xcaec('0x1e')](_0xef39e5,_0x45b6b0)['then'](function(_0x55f167){logger['info'](_0xcaec('0x1f'),_0x130ca7,_0xcaec('0x20'));logger['debug']('User,\x20%s,\x20%s,\x20%s',_0x130ca7,_0xcaec('0x20'),JSON[_0xcaec('0x21')](_0x55f167));if(_0x55f167[_0xcaec('0x22')]){if(_0x55f167[_0xcaec('0x22')][_0xcaec('0x23')]===0x1f4){logger['error'](_0xcaec('0x1f'),_0x130ca7,_0x55f167[_0xcaec('0x22')]['message']);return _0x4dbf00(_0x55f167[_0xcaec('0x22')][_0xcaec('0x24')]);}logger[_0xcaec('0x22')](_0xcaec('0x1f'),_0x130ca7,_0x55f167['error']['message']);return _0x5ea737(_0x55f167[_0xcaec('0x22')][_0xcaec('0x24')]);}else{logger['info'](_0xcaec('0x1f'),_0x130ca7,_0xcaec('0x20'));_0x5ea737(_0x55f167[_0xcaec('0x25')][_0xcaec('0x24')]);}})[_0xcaec('0x26')](function(_0x4e6256){logger[_0xcaec('0x22')]('User,\x20%s,\x20%s',_0x130ca7,_0x4e6256);_0x4dbf00(_0x4e6256);});});}function respondWithStatusCode(_0x1b0ff,_0x5a98a7){_0x5a98a7=_0x5a98a7||0xcc;return function(_0x4774f0){if(_0x4774f0){return _0x1b0ff[_0xcaec('0x27')](_0x5a98a7);}return _0x1b0ff[_0xcaec('0x28')](_0x5a98a7)[_0xcaec('0x29')]();};}function respondWithResult(_0x2aa663,_0x2e6377){_0x2e6377=_0x2e6377||0xc8;return function(_0xf392d2){if(_0xf392d2){return _0x2aa663['status'](_0x2e6377)[_0xcaec('0x2a')](_0xf392d2);}};}function respondWithFilteredResult(_0x4dbd33,_0x13906b){return function(_0x391663){if(_0x391663){var _0x215f28=typeof _0x13906b[_0xcaec('0x2b')]===_0xcaec('0x2c')&&typeof _0x13906b['limit']===_0xcaec('0x2c');var _0x386fc1=_0x391663[_0xcaec('0x2d')];var _0x45f1a0=_0x215f28?0x0:_0x13906b[_0xcaec('0x2b')];var _0x3d2fcf=_0x215f28?_0x391663[_0xcaec('0x2d')]:_0x13906b[_0xcaec('0x2b')]+_0x13906b[_0xcaec('0x2e')];var _0x3d83b3;if(_0x3d2fcf>=_0x386fc1){_0x3d2fcf=_0x386fc1;_0x3d83b3=0xc8;}else{_0x3d83b3=0xce;}_0x4dbd33['status'](_0x3d83b3);return _0x4dbd33[_0xcaec('0x2f')](_0xcaec('0x30'),_0x45f1a0+'-'+_0x3d2fcf+'/'+_0x386fc1)['json'](_0x391663);}return null;};}function patchUpdates(_0x1ea5db){return function(_0x564417){try{jsonpatch[_0xcaec('0x31')](_0x564417,_0x1ea5db,!![]);}catch(_0x5de731){return BPromise[_0xcaec('0x32')](_0x5de731);}return _0x564417[_0xcaec('0x33')]();};}function saveUpdates(_0x35f051,_0x17f118){return function(_0x5cf41c){if(_0x5cf41c){return _0x5cf41c[_0xcaec('0x34')](_0x35f051)[_0xcaec('0x35')](function(_0x12d000){return _0x12d000;});}return null;};}function removeEntity(_0x422045,_0x552ecb){return function(_0x4f1013){if(_0x4f1013){return _0x4f1013[_0xcaec('0x36')]()[_0xcaec('0x35')](function(){var _0x10829f=_0x4f1013['get']({'plain':!![]});if(_0x10829f[_0xcaec('0x37')]==='admin')return;var _0x2933cb=[{'name':_0xcaec('0x38'),'value':'user','ignore':!![]},{'name':'Agents','value':'agent','ignore':![]},{'name':_0xcaec('0x39'),'value':_0xcaec('0x3a'),'ignore':![]}];var _0xaa94f8=_(_0x2933cb)[_0xcaec('0x3b')](_0xcaec('0x3c'))[_0xcaec('0x3d')](_0xcaec('0x3e'))['value']();if(_[_0xcaec('0x3f')](_0xaa94f8,_0x10829f['role'])){return;}var _0x1107a1=_[_0xcaec('0x40')](_0x2933cb,['value',_0x10829f['role']])['name'];return db[_0xcaec('0x41')]['destroy']({'where':{'type':_0x1107a1,'resourceId':_0x10829f['id']}})[_0xcaec('0x35')](function(){return _0x4f1013;});})[_0xcaec('0x35')](function(){_0x422045[_0xcaec('0x28')](0xcc)[_0xcaec('0x29')]();});}};}function handleEntityNotFound(_0x173f53,_0x1da591){return function(_0x14f12e){if(!_0x14f12e){_0x173f53[_0xcaec('0x27')](0x194);}return _0x14f12e;};}function handleError(_0x4db4b2,_0x290dc6){_0x290dc6=_0x290dc6||0x1f4;return function(_0x481297){logger[_0xcaec('0x22')](_0x481297[_0xcaec('0x42')]);if(_0x481297[_0xcaec('0x43')]){delete _0x481297['name'];}_0x4db4b2[_0xcaec('0x28')](_0x290dc6)[_0xcaec('0x44')](_0x481297);};}exports['index']=function(_0x2a1f62,_0x54707c){var _0x1e22c5={},_0x3fe0aa={},_0x359b82={'count':0x0,'rows':[]};var _0x11a0ba=_[_0xcaec('0x3d')](db['User']['rawAttributes'],function(_0x4abf17){return{'name':_0x4abf17[_0xcaec('0x45')],'type':_0x4abf17['type'][_0xcaec('0x46')]};});_0x3fe0aa['model']=_[_0xcaec('0x47')](_[_0xcaec('0x3d')](_0x11a0ba,_0xcaec('0x43')),[_0xcaec('0x48'),_0xcaec('0x49')]);_0x3fe0aa[_0xcaec('0x4a')]=_[_0xcaec('0x4b')](_0x2a1f62[_0xcaec('0x4a')]);_0x3fe0aa[_0xcaec('0x4c')]=_['intersection'](_0x3fe0aa[_0xcaec('0x4d')],_0x3fe0aa[_0xcaec('0x4a')]);_0x1e22c5[_0xcaec('0x4e')]=_[_0xcaec('0x4f')](_0x3fe0aa[_0xcaec('0x4d')],qs[_0xcaec('0x50')](_0x2a1f62[_0xcaec('0x4a')][_0xcaec('0x50')]));_0x1e22c5[_0xcaec('0x4e')]=_0x1e22c5[_0xcaec('0x4e')][_0xcaec('0x51')]?_0x1e22c5['attributes']:_0x3fe0aa[_0xcaec('0x4d')];if(!_0x2a1f62[_0xcaec('0x4a')][_0xcaec('0x52')](_0xcaec('0x53'))){_0x1e22c5[_0xcaec('0x2e')]=qs[_0xcaec('0x2e')](_0x2a1f62[_0xcaec('0x4a')][_0xcaec('0x2e')]);_0x1e22c5[_0xcaec('0x2b')]=qs[_0xcaec('0x2b')](_0x2a1f62[_0xcaec('0x4a')]['offset']);}_0x1e22c5['order']=qs[_0xcaec('0x54')](_0x2a1f62[_0xcaec('0x4a')][_0xcaec('0x54')]);_0x1e22c5[_0xcaec('0x55')]=qs[_0xcaec('0x4c')](_[_0xcaec('0x56')](_0x2a1f62[_0xcaec('0x4a')],_0x3fe0aa['filters']),_0x11a0ba);if(_0x2a1f62[_0xcaec('0x4a')][_0xcaec('0x3b')]){_0x1e22c5['where']=_['merge'](_0x1e22c5[_0xcaec('0x55')],{'$or':_[_0xcaec('0x3d')](_0x11a0ba,function(_0x467987){if(_0x467987['type']!==_0xcaec('0x57')){return db[_0xcaec('0x58')]['where'](db[_0xcaec('0x58')]['fn'](_0xcaec('0x59'),db[_0xcaec('0x58')][_0xcaec('0x5a')](_0x467987['name'])),{'$like':db[_0xcaec('0x58')]['fn']('lower','%'+_0x2a1f62[_0xcaec('0x4a')]['filter']+'%')});}})});}_0x1e22c5=_[_0xcaec('0x5b')]({},_0x1e22c5,_0x2a1f62[_0xcaec('0x5c')]);var _0x2efd06={'where':_0x1e22c5[_0xcaec('0x55')]};return db[_0xcaec('0x5d')]['count'](_0x2efd06)['then'](function(_0x5ac232){_0x359b82[_0xcaec('0x2d')]=_0x5ac232;if(_0x2a1f62[_0xcaec('0x4a')][_0xcaec('0x5e')]){_0x1e22c5[_0xcaec('0x5f')]=[{'all':!![]}];}if(!_['includes'](_0x1e22c5[_0xcaec('0x4e')],'id')){_0x1e22c5[_0xcaec('0x4e')][_0xcaec('0x60')]('id');}return db[_0xcaec('0x5d')][_0xcaec('0x61')](_0x1e22c5);})[_0xcaec('0x35')](function(_0x54bbf7){_0x359b82[_0xcaec('0x62')]=_0x54bbf7;if(_0x2a1f62[_0xcaec('0x4a')][_0xcaec('0x63')]===_0xcaec('0x64')){var _0x48255d=[];for(var _0x10efc7=0x0;_0x10efc7<_0x359b82['rows']['length'];_0x10efc7++){_0x48255d[_0xcaec('0x60')](get_open_tabs(_0xcaec('0x65'),_0x359b82[_0xcaec('0x62')][_0x10efc7][_0xcaec('0x66')]));_0x48255d['push'](get_open_tabs(_0xcaec('0x67'),_0x359b82[_0xcaec('0x62')][_0x10efc7][_0xcaec('0x66')]));_0x48255d[_0xcaec('0x60')](get_open_tabs('fax',_0x359b82[_0xcaec('0x62')][_0x10efc7]['dataValues']));_0x48255d[_0xcaec('0x60')](get_open_tabs('mail',_0x359b82[_0xcaec('0x62')][_0x10efc7][_0xcaec('0x66')]));_0x48255d[_0xcaec('0x60')](get_open_tabs(_0xcaec('0x68'),_0x359b82['rows'][_0x10efc7][_0xcaec('0x66')]));_0x48255d[_0xcaec('0x60')](get_open_tabs(_0xcaec('0x69'),_0x359b82[_0xcaec('0x62')][_0x10efc7][_0xcaec('0x66')]));}return BPromise[_0xcaec('0x6a')](_0x48255d)[_0xcaec('0x35')](function(_0x33cdb2){return _0x359b82;});}else{return _0x359b82;}})[_0xcaec('0x35')](respondWithFilteredResult(_0x54707c,_0x1e22c5))[_0xcaec('0x26')](handleError(_0x54707c,null));};exports[_0xcaec('0x6b')]=function(_0x45269f,_0x190bc2){var _0x36e1b5={'raw':![],'where':{'id':_0x45269f[_0xcaec('0x6c')]['id']}},_0x3b9314={};_0x3b9314[_0xcaec('0x4d')]=_[_0xcaec('0x47')](_[_0xcaec('0x4b')](db[_0xcaec('0x5d')][_0xcaec('0x6d')]),[_0xcaec('0x48'),_0xcaec('0x49')]);_0x3b9314[_0xcaec('0x4a')]=_[_0xcaec('0x4b')](_0x45269f[_0xcaec('0x4a')]);_0x3b9314[_0xcaec('0x4c')]=_[_0xcaec('0x4f')](_0x3b9314[_0xcaec('0x4d')],_0x3b9314[_0xcaec('0x4a')]);_0x36e1b5[_0xcaec('0x4e')]=_[_0xcaec('0x4f')](_0x3b9314[_0xcaec('0x4d')],qs[_0xcaec('0x50')](_0x45269f['query']['fields']));_0x36e1b5['attributes']=_0x36e1b5[_0xcaec('0x4e')][_0xcaec('0x51')]?_0x36e1b5['attributes']:_0x3b9314[_0xcaec('0x4d')];if(_0x45269f[_0xcaec('0x4a')]['includeAll']){_0x36e1b5[_0xcaec('0x5f')]=[{'all':!![]}];}_0x36e1b5=_[_0xcaec('0x5b')]({},_0x36e1b5,_0x45269f[_0xcaec('0x5c')]);if(!_['includes'](_0x36e1b5[_0xcaec('0x4e')],'id')){_0x36e1b5[_0xcaec('0x4e')][_0xcaec('0x60')]('id');}return db[_0xcaec('0x5d')][_0xcaec('0x40')](_0x36e1b5)[_0xcaec('0x35')](handleEntityNotFound(_0x190bc2,null))['then'](function(_0x42b019){var _0x69dd65=[];values=_0x42b019;if(_0x45269f[_0xcaec('0x4a')]['openTabs']===_0xcaec('0x64')){_0x69dd65[_0xcaec('0x60')](get_open_tabs('chat',_0x42b019[_0xcaec('0x66')]));_0x69dd65['push'](get_open_tabs('sms',_0x42b019[_0xcaec('0x66')]));_0x69dd65[_0xcaec('0x60')](get_open_tabs(_0xcaec('0x68'),_0x42b019['dataValues']));_0x69dd65[_0xcaec('0x60')](get_open_tabs(_0xcaec('0x69'),_0x42b019[_0xcaec('0x66')]));_0x69dd65[_0xcaec('0x60')](get_open_tabs(_0xcaec('0x6e'),_0x42b019[_0xcaec('0x66')]));_0x69dd65[_0xcaec('0x60')](get_open_tabs('mail',_0x42b019[_0xcaec('0x66')]));return BPromise[_0xcaec('0x6a')](_0x69dd65);}else{return values;}})[_0xcaec('0x35')](function(_0x222da7){return values;})[_0xcaec('0x35')](respondWithResult(_0x190bc2,null))[_0xcaec('0x26')](handleError(_0x190bc2,null));};exports[_0xcaec('0x34')]=function(_0x141d58,_0x324a8d){if(_0x141d58['body']['id']){delete _0x141d58[_0xcaec('0x6f')]['id'];}delete _0x141d58['body'][_0xcaec('0x37')];return db[_0xcaec('0x5d')][_0xcaec('0x40')]({'where':{'id':_0x141d58[_0xcaec('0x6c')]['id']}})['then'](handleEntityNotFound(_0x324a8d,null))['then'](saveUpdates(_0x141d58[_0xcaec('0x6f')],null))[_0xcaec('0x35')](respondWithResult(_0x324a8d,null))['catch'](handleError(_0x324a8d,null));};exports[_0xcaec('0x70')]=function(_0x22c626,_0x47afe5){return db[_0xcaec('0x5d')]['describe']()[_0xcaec('0x35')](respondWithResult(_0x47afe5,null))[_0xcaec('0x26')](handleError(_0x47afe5,null));};exports[_0xcaec('0x71')]=function(_0x32bde2,_0x2cf1f2,_0x25bcb6){return db['User'][_0xcaec('0x40')]({'where':{'id':_0x32bde2[_0xcaec('0x6c')]['id']}})[_0xcaec('0x35')](handleEntityNotFound(_0x2cf1f2,null))[_0xcaec('0x35')](function(_0x128d0c){if(_0x128d0c){return _0x128d0c[_0xcaec('0x71')](_0x32bde2[_0xcaec('0x6f')][_0xcaec('0x72')],_['omit'](_0x32bde2[_0xcaec('0x6f')],[_0xcaec('0x72'),'id'])||{});}})[_0xcaec('0x35')](respondWithResult(_0x2cf1f2,null))[_0xcaec('0x26')](handleError(_0x2cf1f2,null));};function validateUser(_0x3b078c){return new BPromise(function(_0x3bc7b7,_0xd3bea2){if(_0x3b078c[_0xcaec('0x73')])return _0x3bc7b7(_0x3b078c);return db['Setting']['findById'](0x1)['then'](function(_0x2cee8c){if(_0x2cee8c[_0xcaec('0x74')])authService[_0xcaec('0x75')](_0x3b078c[_0xcaec('0x48')]);db[_0xcaec('0x5d')][_0xcaec('0x76')](_0xcaec('0x73'))[_0xcaec('0x35')](function(_0x555a6d){if(_[_0xcaec('0x77')](_0x555a6d)){_0x3b078c[_0xcaec('0x73')]=_0x2cee8c[_0xcaec('0x78')]||0x1;return;}if(_[_0xcaec('0x77')](_0x2cee8c[_0xcaec('0x78')])||_0x2cee8c[_0xcaec('0x78')]===_0x555a6d){_0x3b078c[_0xcaec('0x73')]=_0x555a6d+0x1;return;}if(_0x2cee8c[_0xcaec('0x78')]>_0x555a6d){_0x3b078c[_0xcaec('0x73')]=_0x2cee8c['min_internal'];return;}return db[_0xcaec('0x58')][_0xcaec('0x4a')](_0xcaec('0x79'),{'type':db[_0xcaec('0x58')][_0xcaec('0x7a')][_0xcaec('0x7b')]})['then'](function(_0x51b0ac){if(_0x51b0ac&&_0x51b0ac[_0xcaec('0x51')]){for(var _0x43a3f8=0x0,_0x1d1a42=_0x51b0ac[_0xcaec('0x51')];_0x43a3f8<_0x1d1a42&&_['isNil'](_0x3b078c[_0xcaec('0x73')]);_0x43a3f8++){if(_0x2cee8c[_0xcaec('0x78')]<=_0x51b0ac[_0x43a3f8][_0xcaec('0x7c')]){_0x3b078c[_0xcaec('0x73')]=_0x51b0ac[_0x43a3f8][_0xcaec('0x7c')];}else if(_0x2cee8c['min_internal']>_0x51b0ac[_0x43a3f8][_0xcaec('0x7c')]&&_0x2cee8c[_0xcaec('0x78')]<=_0x51b0ac[_0x43a3f8]['to']){_0x3b078c[_0xcaec('0x73')]=_0x2cee8c[_0xcaec('0x78')];}}}if(_[_0xcaec('0x77')](_0x3b078c[_0xcaec('0x73')])){_0x3b078c[_0xcaec('0x73')]=_0x555a6d+0x1;}return _0x3bc7b7(_0x3b078c);});});})[_0xcaec('0x26')](function(_0x24cfa9){_0xd3bea2(_0x24cfa9);});});}function updateUser(_0x5e00fe){return new BPromise(function(_0x41ad55,_0x1262b7){try{if(_0x5e00fe[_0xcaec('0x7d')]){_0x5e00fe[_0xcaec('0x7e')]=_0x5e00fe[_0xcaec('0x73')];_0x5e00fe[_0xcaec('0x7f')]={'mailbox':_0x5e00fe[_0xcaec('0x73')],'password':_0x5e00fe[_0xcaec('0x48')],'fullname':_0x5e00fe[_0xcaec('0x80')],'email':_0x5e00fe['email']};}if(_0x5e00fe['role']===_0xcaec('0x81')){if(!_0x5e00fe[_0xcaec('0x82')])_0x5e00fe[_0xcaec('0x82')]=[_0xcaec('0x83'),_0xcaec('0x84'),'103',_0xcaec('0x85'),_0xcaec('0x86'),_0xcaec('0x87'),_0xcaec('0x88'),_0xcaec('0x89'),_0xcaec('0x8a'),_0xcaec('0x8b'),'109',_0xcaec('0x8c'),_0xcaec('0x8d'),_0xcaec('0x8e'),_0xcaec('0x8f')];}_0x41ad55(_0x5e00fe);}catch(_0x3044d9){_0x1262b7(_0x3044d9);}});}exports[_0xcaec('0x90')]=function(_0x527fa9,_0x1d013b){if(_0x527fa9[_0xcaec('0x91')][_0xcaec('0x37')]===_0xcaec('0x81'))throw new Error(_0xcaec('0x92'));if(_0x527fa9[_0xcaec('0x6f')]['role']==='user'&&_0x527fa9[_0xcaec('0x91')]['role']!==_0xcaec('0x93')){throw new Error(_0xcaec('0x94'));}if(_0x527fa9['body'][_0xcaec('0x37')]===_0xcaec('0x93')&&_0x527fa9[_0xcaec('0x91')][_0xcaec('0x37')]!==_0xcaec('0x93')){throw new Error(_0xcaec('0x95'));}return licenseUtil[_0xcaec('0x96')]([_0x527fa9[_0xcaec('0x6f')]])[_0xcaec('0x35')](function(){return validateUser(_0x527fa9[_0xcaec('0x6f')]);})[_0xcaec('0x35')](function(_0x2c2050){return updateUser(_0x2c2050)[_0xcaec('0x35')](function(_0x9ad51){if(_0x9ad51[_0xcaec('0x37')]==='admin'){_0x9ad51['settingsEnabled']=_0x527fa9[_0xcaec('0x91')][_0xcaec('0x97')];delete _0x9ad51[_0xcaec('0x98')];}return _0x9ad51;});})[_0xcaec('0x35')](function(_0x39fa44){return db[_0xcaec('0x5d')][_0xcaec('0x90')](_0x39fa44,{'include':[{'model':db[_0xcaec('0x7f')],'as':_0xcaec('0x7f')}]});})['then'](function(_0x44b9c2){if(_0x527fa9['body']['role']===_0xcaec('0x91'))return _0x44b9c2;if(_0x527fa9['user'][_0xcaec('0x37')]!==_0xcaec('0x91'))return _0x44b9c2;return db[_0xcaec('0x99')][_0xcaec('0x40')]({'where':{'name':_0x44b9c2[_0xcaec('0x37')]===_0xcaec('0x81')?_0xcaec('0x9a'):_0xcaec('0x39'),'userProfileId':_0x527fa9[_0xcaec('0x91')]['userProfileId']},'raw':!![]})[_0xcaec('0x35')](function(_0x171636){if(!_0x171636||_0x171636['autoAssociation']!=0x0)return _0x44b9c2;return db['UserProfileResource'][_0xcaec('0x90')]({'name':_0x44b9c2['name'],'resourceId':_0x44b9c2['id'],'type':_0x171636[_0xcaec('0x43')],'sectionId':_0x171636['id']},{})[_0xcaec('0x35')](function(){return _0x44b9c2;});})[_0xcaec('0x26')](function(_0x3344e7){logger[_0xcaec('0x22')](_0xcaec('0x9b'),_0x3344e7);throw _0x3344e7;});})[_0xcaec('0x35')](respondWithResult(_0x1d013b,0xc9))['catch'](handleError(_0x1d013b,null));};exports[_0xcaec('0x9c')]=function(_0x3e024d,_0x2508d0){var _0x8a09d6=_0x3e024d[_0xcaec('0x6f')];var _0xb20f9e=[];if(_0x3e024d[_0xcaec('0x91')][_0xcaec('0x37')]===_0xcaec('0x81'))throw new Error('Unauthorized');if(_['some'](_0x8a09d6,[_0xcaec('0x37'),_0xcaec('0x91')])&&_0x3e024d[_0xcaec('0x91')]['role']!=='admin'){throw new Error(_0xcaec('0x94'));}if(_[_0xcaec('0x9d')](_0x8a09d6,[_0xcaec('0x37'),_0xcaec('0x93')])&&_0x3e024d[_0xcaec('0x91')][_0xcaec('0x37')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator');}return licenseUtil[_0xcaec('0x96')](_0x8a09d6)[_0xcaec('0x35')](function(){return validateUser(_0x8a09d6[0x0]);})['then'](function(){for(var _0x4d80fa=0x1;_0x4d80fa<_0x8a09d6[_0xcaec('0x51')];_0x4d80fa++){var _0x3ae33e=_0x8a09d6[_0x4d80fa-0x1]['internal'];if(!_0x8a09d6[_0x4d80fa][_0xcaec('0x73')])_0x8a09d6[_0x4d80fa][_0xcaec('0x73')]=_0x3ae33e+0x1;_0xb20f9e[_0xcaec('0x60')](validateUser(_0x8a09d6[_0x4d80fa]));}return BPromise['all'](_0xb20f9e);})[_0xcaec('0x35')](function(){_0xb20f9e=[];for(var _0x5b30f2=0x0;_0x5b30f2<_0x8a09d6[_0xcaec('0x51')];_0x5b30f2++){_0xb20f9e[_0xcaec('0x60')](updateUser(_0x8a09d6[_0x5b30f2]));}return BPromise[_0xcaec('0x6a')](_0xb20f9e);})[_0xcaec('0x35')](function(){return BPromise['each'](_0x8a09d6,function(_0x411a8e){return db['User'][_0xcaec('0x90')](_0x411a8e,{'include':[{'model':db[_0xcaec('0x7f')],'as':_0xcaec('0x7f')}]})['then'](function(_0x5d5006){_0x411a8e['id']=_0x5d5006['id'];return _0x411a8e;});});})['then'](function(_0x28e4b2){if(_0x3e024d['body']['role']==='user')return _0x28e4b2;if(_0x3e024d[_0xcaec('0x91')][_0xcaec('0x37')]!==_0xcaec('0x91'))return _0x28e4b2;var _0x2566e9=_[_0xcaec('0x9d')](_0x28e4b2,function(_0x3018fe){return _0x3018fe[_0xcaec('0x37')]===_0xcaec('0x81')||_0x3018fe['role']===_0xcaec('0x3a');});if(!_0x2566e9)return _0x28e4b2;return db['UserProfileSection'][_0xcaec('0x61')]({'where':{'name':{'$or':[_0xcaec('0x9a'),_0xcaec('0x39')]},'userProfileId':_0x3e024d[_0xcaec('0x91')][_0xcaec('0x98')]},'raw':!![]})[_0xcaec('0x35')](function(_0xb5d0a0){if(_[_0xcaec('0x9e')](_0xb5d0a0)||!_['some'](_0xb5d0a0,['autoAssociation',0x0]))return _0x28e4b2;_0xb20f9e=[];var _0x52f7b8=_(_0xb5d0a0)[_0xcaec('0x3d')](function(_0x3d6548){if(_0x3d6548[_0xcaec('0x9f')]===0x1)return;return _0x3d6548[_0xcaec('0x43')]==='Agents'?'agent':_0xcaec('0x3a');})[_0xcaec('0xa0')]()[_0xcaec('0x3e')]();for(var _0x16c67a=0x0;_0x16c67a<_0x28e4b2[_0xcaec('0x51')];_0x16c67a++){if(!_[_0xcaec('0x3f')](_0x52f7b8,_0x28e4b2[_0x16c67a][_0xcaec('0x37')]))return;var _0x476e6f=_0x28e4b2[_0x16c67a]['role']===_0xcaec('0x81')?'Agents':_0xcaec('0x39');_0xb20f9e[_0xcaec('0x60')](db[_0xcaec('0x41')][_0xcaec('0x90')]({'name':_0x28e4b2[_0x16c67a]['name'],'resourceId':_0x28e4b2[_0x16c67a]['id'],'type':_0x476e6f,'sectionId':_['find'](_0xb5d0a0,[_0xcaec('0x43'),_0x476e6f])['id']},{}));}return BPromise[_0xcaec('0x6a')](_0xb20f9e);});})[_0xcaec('0x35')](respondWithResult(_0x2508d0,0xc9))['catch'](handleError(_0x2508d0,null));};exports['changePassword']=function(_0x3fe6ce,_0x54cd44,_0x24b9c0){if(_0x3fe6ce[_0xcaec('0x6f')]['id']){delete _0x3fe6ce[_0xcaec('0x6f')]['id'];}return db['User'][_0xcaec('0x40')]({'where':{'id':_0x3fe6ce[_0xcaec('0x6c')]['id']}})['then'](function(_0x7218b6){if(!_0x7218b6)return null;if(_0x7218b6['id']===_0x3fe6ce[_0xcaec('0x91')]['id']){if(!_0x3fe6ce[_0xcaec('0x6f')][_0xcaec('0xa1')]||!_0x3fe6ce['body'][_0xcaec('0xa2')]){throw new db[(_0xcaec('0xa3'))]['ValidationError'](_0xcaec('0xa4'));}if(!_0x7218b6[_0xcaec('0xa5')](_0x3fe6ce['body'][_0xcaec('0xa1')])){throw new db[(_0xcaec('0xa3'))][(_0xcaec('0xa6'))](_0xcaec('0xa7'));}if(_0x3fe6ce[_0xcaec('0x6f')]['oldPassword']===_0x3fe6ce[_0xcaec('0x6f')][_0xcaec('0xa2')]){throw new db['Sequelize'][(_0xcaec('0xa6'))](_0xcaec('0xa8'));}}else if(_0x3fe6ce['user'][_0xcaec('0x37')]===_0xcaec('0x93')){if(!_0x3fe6ce['body'][_0xcaec('0xa2')]){throw new db[(_0xcaec('0xa3'))]['ValidationError'](_0xcaec('0xa9'));}}else if(_0x3fe6ce[_0xcaec('0x91')][_0xcaec('0x37')]===_0xcaec('0x91')){if(!_0x3fe6ce['body'][_0xcaec('0xa2')]){throw new db['Sequelize'][(_0xcaec('0xa6'))](_0xcaec('0xa9'));}if(_0x7218b6[_0xcaec('0x37')]!==_0xcaec('0x81')){throw new db['Sequelize'][(_0xcaec('0xa6'))](_0xcaec('0x92'));}}else{throw new db['Sequelize'][(_0xcaec('0xa6'))](_0xcaec('0x92'));}return _0x7218b6;})['then'](handleEntityNotFound(_0x54cd44,null))[_0xcaec('0x35')](function(_0x5b3ba1){return db[_0xcaec('0xaa')][_0xcaec('0xab')]({'attributes':['id',_0xcaec('0x74'),_0xcaec('0xac'),_0xcaec('0xad')]})[_0xcaec('0x35')](function(_0x22c59f){if(_0x22c59f[_0xcaec('0x74')])authService['validatePasswordPattern'](_0x3fe6ce[_0xcaec('0x6f')][_0xcaec('0xa2')]);if(!_0x22c59f[_0xcaec('0xac')]||!_0x5b3ba1[_0xcaec('0xae')])return _0x5b3ba1;authService[_0xcaec('0xaf')](_0x3fe6ce[_0xcaec('0x6f')]['newPassword'],_0x5b3ba1[_0xcaec('0xae')],_0x22c59f[_0xcaec('0xad')]);return _0x5b3ba1;})['then'](saveUpdates({'password':_0x3fe6ce[_0xcaec('0x6f')][_0xcaec('0xa2')],'passwordResetAt':_0x3fe6ce[_0xcaec('0x91')]['id']==_0x3fe6ce[_0xcaec('0x6c')]['id']?moment():null,'previousPasswords':authService[_0xcaec('0xb0')](_0x3fe6ce['body']['newPassword'],_0x5b3ba1['previousPasswords'])},null));})[_0xcaec('0x35')](respondWithResult(_0x54cd44,null))[_0xcaec('0x26')](handleError(_0x54cd44,null));};exports[_0xcaec('0xb1')]=function(_0x2773dc,_0x2467b9,_0x22f777){var _0x174a11=_0x2773dc[_0xcaec('0x6f')][_0xcaec('0xb2')];return db['User'][_0xcaec('0x40')]({'where':{'id':_0x2773dc[_0xcaec('0x6c')]['id']},'attributes':['id',_0xcaec('0x43'),'role',_0xcaec('0xb3'),_0xcaec('0xb4'),'voicePause',_0xcaec('0xb5')]})['then'](handleEntityNotFound(_0x2467b9,null))[_0xcaec('0x35')](function(_0x3aba06){if(_0x3aba06){if(!utils[_0xcaec('0xb6')](_0x174a11)){throw new db[(_0xcaec('0xa3'))][(_0xcaec('0xa6'))](_0xcaec('0xb7'));}return _0x3aba06[_0xcaec('0xb8')+_[_0xcaec('0xb9')](_0x174a11[_0xcaec('0xba')]())+_0xcaec('0xbb')](_0x2773dc[_0xcaec('0x6f')]['ids'],{'penalty':_0x2773dc[_0xcaec('0x6f')][_0xcaec('0xbc')]||0x0})[_0xcaec('0xbd')](function(_0x1546c9){for(var _0x3e4300=0x0;_0x3e4300<_0x2773dc[_0xcaec('0x6f')][_0xcaec('0x72')][_0xcaec('0x51')];_0x3e4300+=0x1){var _0x448ef9={'UserId':Number(_0x2773dc[_0xcaec('0x6c')]['id'])};_0x448ef9[_[_0xcaec('0xb9')](_0x174a11['toLowerCase']())+'QueueId']=Number(_0x2773dc[_0xcaec('0x6f')]['ids'][_0x3e4300]);socket['emit'](_0xcaec('0x91')+_['capitalize'](_0x174a11[_0xcaec('0xba')]())+_0xcaec('0xbe'),_0x448ef9);}return _0x1546c9;})[_0xcaec('0x35')](function(){if(_0x174a11===_0xcaec('0xbf')){return db['VoiceQueue']['findAll']({'where':{'id':_0x2773dc[_0xcaec('0x6f')][_0xcaec('0x72')]||[]},'raw':!![],'attributes':['id',_0xcaec('0x43')]});}})[_0xcaec('0x35')](function(_0x188c60){var _0x143586=_0x3aba06['get']({'plain':!![]});var _0x29e8a1=[];if(_0x174a11===_0xcaec('0xbf')&&_0x143586['role']===_0xcaec('0x81')&&_0x143586[_0xcaec('0xb3')]){for(var _0x2cb6f4=0x0;_0x2cb6f4<_0x188c60[_0xcaec('0x51')];_0x2cb6f4+=0x1){_0x29e8a1[_0xcaec('0x60')]({'membername':_0x143586['name'],'UserId':_0x143586['id'],'queue_name':_0x188c60[_0x2cb6f4][_0xcaec('0x43')],'VoiceQueueId':_0x188c60[_0x2cb6f4]['id'],'interface':_[_0xcaec('0x77')](_0x143586[_0xcaec('0xb5')])?util['format'](_0xcaec('0xc0'),_0x143586[_0xcaec('0x43')]):_0x143586[_0xcaec('0xb5')],'paused':_0x143586[_0xcaec('0xc1')]||![],'penalty':_0x2773dc[_0xcaec('0x6f')][_0xcaec('0xbc')]||0x0});}return BPromise['each'](_0x29e8a1,function(_0x201825){return db['UserVoiceQueueRt']['upsert'](_0x201825);});}return _0x3aba06;});}})['then'](respondWithStatusCode(_0x2467b9,null))[_0xcaec('0x26')](handleError(_0x2467b9,null));};exports['removeQueues']=function(_0x50f912,_0x2d87eb,_0x3c15f3){var _0x42d973;return db[_0xcaec('0x5d')][_0xcaec('0x40')]({'where':{'id':_0x50f912[_0xcaec('0x6c')]['id']},'attributes':['id',_0xcaec('0x43'),'role']})['then'](handleEntityNotFound(_0x2d87eb,null))[_0xcaec('0x35')](function(_0x196747){if(_0x196747){_0x42d973=_0x196747;if(!_0x50f912['query'][_0xcaec('0xb2')]||!utils[_0xcaec('0xb6')](_0x50f912[_0xcaec('0x4a')][_0xcaec('0xb2')])){throw new db['Sequelize']['ValidationError'](_0xcaec('0xb7'));}return _0x196747[_0xcaec('0xc2')+_[_0xcaec('0xb9')](_0x50f912['query'][_0xcaec('0xb2')][_0xcaec('0xba')]())+_0xcaec('0xbb')](_0x50f912['query'][_0xcaec('0x72')]);}})[_0xcaec('0x35')](function(_0x4a542){for(var _0x10d7bc=0x0;_0x10d7bc<_0x50f912['query']['ids'][_0xcaec('0x51')];_0x10d7bc+=0x1){var _0x51fe8f={'UserId':Number(_0x50f912[_0xcaec('0x6c')]['id'])};_0x51fe8f[_[_0xcaec('0xb9')](_0x50f912['query'][_0xcaec('0xb2')]['toLowerCase']())+_0xcaec('0xc3')]=Number(_0x50f912[_0xcaec('0x4a')]['ids'][_0x10d7bc]);socket[_0xcaec('0xc4')](_0xcaec('0x91')+_[_0xcaec('0xb9')](_0x50f912['query']['channel']['toLowerCase']())+_0xcaec('0xc5'),_0x51fe8f);}return _0x4a542;})['then'](function(){if(_0x50f912['query'][_0xcaec('0xb2')]===_0xcaec('0xbf')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x50f912['params']['id'],'VoiceQueueId':_0x50f912[_0xcaec('0x4a')][_0xcaec('0x72')]},'individualHooks':!![]})['then'](function(){return _0x42d973;});}return _0x42d973;})[_0xcaec('0x35')](respondWithStatusCode(_0x2d87eb,null))[_0xcaec('0x26')](handleError(_0x2d87eb,null));};exports[_0xcaec('0xc6')]=function(_0x496030,_0x568bca,_0x466330){_0x496030[_0xcaec('0x6f')][_0xcaec('0xc7')]=_0x496030[_0xcaec('0xc8')]['filename'];return db[_0xcaec('0x5d')]['find']({'where':{'id':_0x496030[_0xcaec('0x6c')]['id']}})['then'](handleEntityNotFound(_0x568bca,null))[_0xcaec('0x35')](saveUpdates(_0x496030[_0xcaec('0x6f')],null))[_0xcaec('0x35')](respondWithResult(_0x568bca,null))[_0xcaec('0x26')](handleError(_0x568bca,null));};exports['getAvatar']=function(_0x31a7bb,_0x3093dc,_0x19888a){var _0x2b07a9=path[_0xcaec('0xc9')](config['root'],'server/files/images/logos/default_profile.png');return db[_0xcaec('0x5d')]['find']({'where':{'id':_0x31a7bb[_0xcaec('0x6c')]['id']},'attributes':['id',_0xcaec('0xc7')],'raw':!![]})[_0xcaec('0x35')](handleEntityNotFound(_0x3093dc,null))[_0xcaec('0x35')](function(_0x3678a3){if(_0x3678a3){if(_[_0xcaec('0x77')](_0x3678a3[_0xcaec('0xc7')])){return _0x3093dc[_0xcaec('0xca')](_0x2b07a9);}else{if(!fs['existsSync'](path['join'](config[_0xcaec('0xcb')],_0xcaec('0xcc'),_0x3678a3['userpic']))){return _0x3093dc[_0xcaec('0xca')](_0x2b07a9);}return _0x3093dc[_0xcaec('0xca')](path[_0xcaec('0xc9')](config[_0xcaec('0xcb')],_0xcaec('0xcc'),_0x3678a3[_0xcaec('0xc7')]));}}})[_0xcaec('0x26')](handleError(_0x3093dc,null));};exports['getOpenTabs']=function(_0x3031eb,_0x493c48,_0x28c25c){return db[_0xcaec('0x5d')]['find']({'where':{'id':_0x3031eb[_0xcaec('0x6c')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x493c48,null))['then'](function(_0x208840){var _0x5a5688=[];values=_0x208840[_0xcaec('0x66')];_0x5a5688[_0xcaec('0x60')](get_open_tabs(_0xcaec('0x65'),_0x208840[_0xcaec('0x66')]));_0x5a5688[_0xcaec('0x60')](get_open_tabs(_0xcaec('0x67'),_0x208840[_0xcaec('0x66')]));_0x5a5688[_0xcaec('0x60')](get_open_tabs('openchannel',_0x208840[_0xcaec('0x66')]));_0x5a5688[_0xcaec('0x60')](get_open_tabs('whatsapp',_0x208840['dataValues']));_0x5a5688[_0xcaec('0x60')](get_open_tabs('fax',_0x208840['dataValues']));_0x5a5688['push'](get_open_tabs(_0xcaec('0xcd'),_0x208840[_0xcaec('0x66')]));return BPromise[_0xcaec('0x6a')](_0x5a5688);})['then'](function(_0x88f5b9){var _0x2a2fdc=[];if(_0x88f5b9){for(var _0x3eba73=0x0;_0x3eba73=_0x5f58ee){_0x30f278=_0x5f58ee;_0x69447a=0xc8;}else{_0x69447a=0xce;}_0x96c716[_0xf756('0x2e')](_0x69447a);return _0x96c716[_0xf756('0x34')](_0xf756('0x35'),_0x1391f3+'-'+_0x30f278+'/'+_0x5f58ee)['json'](_0x4728dd);}return null;};}function patchUpdates(_0x172077){return function(_0x3371f0){try{jsonpatch['apply'](_0x3371f0,_0x172077,!![]);}catch(_0x2aa3aa){return BPromise['reject'](_0x2aa3aa);}return _0x3371f0[_0xf756('0x36')]();};}function saveUpdates(_0x3a6993,_0x2d71cc){return function(_0x159be4){if(_0x159be4){return _0x159be4[_0xf756('0x37')](_0x3a6993)[_0xf756('0x23')](function(_0x40858f){return _0x40858f;});}return null;};}function removeEntity(_0x5b9bde,_0x1a243b){return function(_0x2f350c){if(_0x2f350c){return _0x2f350c['destroy']()['then'](function(){var _0xaff053=_0x2f350c[_0xf756('0x38')]({'plain':!![]});if(_0xaff053[_0xf756('0x39')]===_0xf756('0x3a'))return;var _0x2cc437=[{'name':_0xf756('0x3b'),'value':_0xf756('0x3c'),'ignore':!![]},{'name':_0xf756('0x3d'),'value':'agent','ignore':![]},{'name':_0xf756('0x3e'),'value':_0xf756('0x3f'),'ignore':![]}];var _0x82fd0=_(_0x2cc437)[_0xf756('0x40')](_0xf756('0x41'))[_0xf756('0x42')](_0xf756('0x43'))[_0xf756('0x43')]();if(_[_0xf756('0x44')](_0x82fd0,_0xaff053[_0xf756('0x39')])){return;}var _0x20f4a1=_[_0xf756('0x45')](_0x2cc437,[_0xf756('0x43'),_0xaff053[_0xf756('0x39')]])['name'];return db['UserProfileResource']['destroy']({'where':{'type':_0x20f4a1,'resourceId':_0xaff053['id']}})[_0xf756('0x23')](function(){return _0x2f350c;});})[_0xf756('0x23')](function(){_0x5b9bde[_0xf756('0x2e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b8b3a,_0x3e921e){return function(_0xe8da34){if(!_0xe8da34){_0x4b8b3a['sendStatus'](0x194);}return _0xe8da34;};}function handleError(_0x27ec35,_0x2a0dbb){_0x2a0dbb=_0x2a0dbb||0x1f4;return function(_0x4391a9){logger[_0xf756('0x2a')](_0x4391a9[_0xf756('0x46')]);if(_0x4391a9[_0xf756('0x47')]){delete _0x4391a9[_0xf756('0x47')];}_0x27ec35['status'](_0x2a0dbb)['send'](_0x4391a9);};}exports[_0xf756('0x48')]=function(_0x15b636,_0x3ad93e){var _0x1d26a7={},_0x29d85f={},_0x54fe87={'count':0x0,'rows':[]};var _0x2732de=_[_0xf756('0x42')](db['User'][_0xf756('0x49')],function(_0x2f4273){return{'name':_0x2f4273[_0xf756('0x4a')],'type':_0x2f4273[_0xf756('0x4b')][_0xf756('0x4c')]};});_0x29d85f[_0xf756('0x4d')]=_['differenceBy'](_[_0xf756('0x42')](_0x2732de,_0xf756('0x47')),['password','salt']);_0x29d85f[_0xf756('0x4e')]=_['keys'](_0x15b636[_0xf756('0x4e')]);_0x29d85f[_0xf756('0x4f')]=_[_0xf756('0x50')](_0x29d85f['model'],_0x29d85f['query']);_0x1d26a7[_0xf756('0x51')]=_[_0xf756('0x50')](_0x29d85f[_0xf756('0x4d')],qs[_0xf756('0x52')](_0x15b636[_0xf756('0x4e')][_0xf756('0x52')]));_0x1d26a7[_0xf756('0x51')]=_0x1d26a7[_0xf756('0x51')][_0xf756('0x53')]?_0x1d26a7[_0xf756('0x51')]:_0x29d85f[_0xf756('0x4d')];if(!_0x15b636['query'][_0xf756('0x54')](_0xf756('0x55'))){_0x1d26a7[_0xf756('0x32')]=qs[_0xf756('0x32')](_0x15b636[_0xf756('0x4e')][_0xf756('0x32')]);_0x1d26a7[_0xf756('0x30')]=qs['offset'](_0x15b636[_0xf756('0x4e')]['offset']);}_0x1d26a7['order']=qs[_0xf756('0x56')](_0x15b636[_0xf756('0x4e')][_0xf756('0x56')]);_0x1d26a7[_0xf756('0x57')]=qs['filters'](_[_0xf756('0x58')](_0x15b636[_0xf756('0x4e')],_0x29d85f[_0xf756('0x4f')]),_0x2732de);if(_0x15b636[_0xf756('0x4e')]['filter']){_0x1d26a7[_0xf756('0x57')]=_['merge'](_0x1d26a7[_0xf756('0x57')],{'$or':_[_0xf756('0x42')](_0x2732de,function(_0x3561ef){if(_0x3561ef[_0xf756('0x4b')]!==_0xf756('0x59')){return db[_0xf756('0x5a')][_0xf756('0x57')](db[_0xf756('0x5a')]['fn'](_0xf756('0x5b'),db['sequelize']['col'](_0x3561ef['name'])),{'$like':db[_0xf756('0x5a')]['fn'](_0xf756('0x5b'),'%'+_0x15b636[_0xf756('0x4e')][_0xf756('0x40')]+'%')});}})});}_0x1d26a7=_[_0xf756('0x5c')]({},_0x1d26a7,_0x15b636['options']);var _0xd00418={'where':_0x1d26a7['where']};return db[_0xf756('0x5d')][_0xf756('0x33')](_0xd00418)['then'](function(_0x155a80){_0x54fe87[_0xf756('0x33')]=_0x155a80;if(_0x15b636[_0xf756('0x4e')][_0xf756('0x5e')]){_0x1d26a7[_0xf756('0x5f')]=[{'all':!![]}];}if(!_[_0xf756('0x44')](_0x1d26a7[_0xf756('0x51')],'id')){_0x1d26a7['attributes']['push']('id');}return db['User']['findAll'](_0x1d26a7);})['then'](function(_0x153f96){_0x54fe87[_0xf756('0x60')]=_0x153f96;if(_0x15b636['query'][_0xf756('0x61')]===_0xf756('0x62')){var _0x411fc2=[];for(var _0x1d9b9a=0x0;_0x1d9b9a<_0x54fe87['rows'][_0xf756('0x53')];_0x1d9b9a++){_0x411fc2[_0xf756('0x63')](get_open_tabs(_0xf756('0x64'),_0x54fe87[_0xf756('0x60')][_0x1d9b9a][_0xf756('0x65')]));_0x411fc2[_0xf756('0x63')](get_open_tabs(_0xf756('0x66'),_0x54fe87[_0xf756('0x60')][_0x1d9b9a][_0xf756('0x65')]));_0x411fc2['push'](get_open_tabs(_0xf756('0x67'),_0x54fe87[_0xf756('0x60')][_0x1d9b9a][_0xf756('0x65')]));_0x411fc2[_0xf756('0x63')](get_open_tabs(_0xf756('0x68'),_0x54fe87[_0xf756('0x60')][_0x1d9b9a][_0xf756('0x65')]));_0x411fc2['push'](get_open_tabs(_0xf756('0x69'),_0x54fe87[_0xf756('0x60')][_0x1d9b9a][_0xf756('0x65')]));_0x411fc2[_0xf756('0x63')](get_open_tabs(_0xf756('0x6a'),_0x54fe87[_0xf756('0x60')][_0x1d9b9a][_0xf756('0x65')]));}return BPromise[_0xf756('0x6b')](_0x411fc2)[_0xf756('0x23')](function(_0x4d43ac){return _0x54fe87;});}else{return _0x54fe87;}})[_0xf756('0x23')](respondWithFilteredResult(_0x3ad93e,_0x1d26a7))[_0xf756('0x2d')](handleError(_0x3ad93e,null));};exports[_0xf756('0x6c')]=function(_0x5c5dbe,_0x4a8661){var _0x13a350={'raw':![],'where':{'id':_0x5c5dbe['params']['id']}},_0x5c99e7={};_0x5c99e7[_0xf756('0x4d')]=_['differenceBy'](_[_0xf756('0x6d')](db[_0xf756('0x5d')][_0xf756('0x49')]),[_0xf756('0x6e'),_0xf756('0x6f')]);_0x5c99e7[_0xf756('0x4e')]=_[_0xf756('0x6d')](_0x5c5dbe['query']);_0x5c99e7[_0xf756('0x4f')]=_['intersection'](_0x5c99e7['model'],_0x5c99e7[_0xf756('0x4e')]);_0x13a350['attributes']=_[_0xf756('0x50')](_0x5c99e7[_0xf756('0x4d')],qs['fields'](_0x5c5dbe[_0xf756('0x4e')][_0xf756('0x52')]));_0x13a350['attributes']=_0x13a350['attributes'][_0xf756('0x53')]?_0x13a350[_0xf756('0x51')]:_0x5c99e7[_0xf756('0x4d')];if(_0x5c5dbe[_0xf756('0x4e')]['includeAll']){_0x13a350[_0xf756('0x5f')]=[{'all':!![]}];}_0x13a350=_[_0xf756('0x5c')]({},_0x13a350,_0x5c5dbe[_0xf756('0x70')]);if(!_[_0xf756('0x44')](_0x13a350['attributes'],'id')){_0x13a350[_0xf756('0x51')]['push']('id');}return db['User'][_0xf756('0x45')](_0x13a350)['then'](handleEntityNotFound(_0x4a8661,null))['then'](function(_0x688923){var _0x5d7bfc=[];values=_0x688923;if(_0x5c5dbe[_0xf756('0x4e')][_0xf756('0x61')]===_0xf756('0x62')){_0x5d7bfc[_0xf756('0x63')](get_open_tabs(_0xf756('0x64'),_0x688923[_0xf756('0x65')]));_0x5d7bfc[_0xf756('0x63')](get_open_tabs(_0xf756('0x66'),_0x688923['dataValues']));_0x5d7bfc[_0xf756('0x63')](get_open_tabs(_0xf756('0x69'),_0x688923[_0xf756('0x65')]));_0x5d7bfc[_0xf756('0x63')](get_open_tabs(_0xf756('0x6a'),_0x688923[_0xf756('0x65')]));_0x5d7bfc['push'](get_open_tabs('fax',_0x688923[_0xf756('0x65')]));_0x5d7bfc['push'](get_open_tabs(_0xf756('0x68'),_0x688923[_0xf756('0x65')]));return BPromise[_0xf756('0x6b')](_0x5d7bfc);}else{return values;}})[_0xf756('0x23')](function(_0x181f98){return values;})[_0xf756('0x23')](respondWithResult(_0x4a8661,null))[_0xf756('0x2d')](handleError(_0x4a8661,null));};exports[_0xf756('0x37')]=function(_0x3fac39,_0x4ddfdd){if(_0x3fac39[_0xf756('0x71')]['id']){delete _0x3fac39[_0xf756('0x71')]['id'];}delete _0x3fac39['body'][_0xf756('0x39')];return db[_0xf756('0x5d')][_0xf756('0x45')]({'where':{'id':_0x3fac39[_0xf756('0x72')]['id']}})['then'](handleEntityNotFound(_0x4ddfdd,null))['then'](saveUpdates(_0x3fac39[_0xf756('0x71')],null))[_0xf756('0x23')](respondWithResult(_0x4ddfdd,null))[_0xf756('0x2d')](handleError(_0x4ddfdd,null));};exports[_0xf756('0x73')]=function(_0x46262f,_0x35ccc6){return db[_0xf756('0x5d')][_0xf756('0x73')]()['then'](respondWithResult(_0x35ccc6,null))[_0xf756('0x2d')](handleError(_0x35ccc6,null));};exports[_0xf756('0x74')]=function(_0x5d5da4,_0x1f1bee,_0x9c1782){return db[_0xf756('0x5d')]['find']({'where':{'id':_0x5d5da4['params']['id']}})[_0xf756('0x23')](handleEntityNotFound(_0x1f1bee,null))[_0xf756('0x23')](function(_0x27a6b5){if(_0x27a6b5){return _0x27a6b5['addContacts'](_0x5d5da4[_0xf756('0x71')][_0xf756('0x75')],_[_0xf756('0x76')](_0x5d5da4[_0xf756('0x71')],[_0xf756('0x75'),'id'])||{});}})[_0xf756('0x23')](respondWithResult(_0x1f1bee,null))[_0xf756('0x2d')](handleError(_0x1f1bee,null));};function validateUser(_0x2e56e5){return new BPromise(function(_0x207e84,_0x340018){if(_0x2e56e5[_0xf756('0x77')])return _0x207e84(_0x2e56e5);return db[_0xf756('0x78')][_0xf756('0x79')](0x1)['then'](function(_0x115ff7){if(_0x115ff7[_0xf756('0x7a')])authService[_0xf756('0x7b')](_0x2e56e5[_0xf756('0x6e')]);db[_0xf756('0x5d')][_0xf756('0x7c')]('internal')[_0xf756('0x23')](function(_0x313d7c){if(_[_0xf756('0x7d')](_0x313d7c)){_0x2e56e5['internal']=_0x115ff7['min_internal']||0x1;return;}if(_[_0xf756('0x7d')](_0x115ff7['min_internal'])||_0x115ff7[_0xf756('0x7e')]===_0x313d7c){_0x2e56e5['internal']=_0x313d7c+0x1;return;}if(_0x115ff7[_0xf756('0x7e')]>_0x313d7c){_0x2e56e5['internal']=_0x115ff7[_0xf756('0x7e')];return;}return db[_0xf756('0x5a')][_0xf756('0x4e')]('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[_0xf756('0x5a')]['QueryTypes']['SELECT']})[_0xf756('0x23')](function(_0x29feb8){if(_0x29feb8&&_0x29feb8[_0xf756('0x53')]){for(var _0x194135=0x0,_0x8c681e=_0x29feb8[_0xf756('0x53')];_0x194135<_0x8c681e&&_[_0xf756('0x7d')](_0x2e56e5[_0xf756('0x77')]);_0x194135++){if(_0x115ff7['min_internal']<=_0x29feb8[_0x194135]['from']){_0x2e56e5[_0xf756('0x77')]=_0x29feb8[_0x194135][_0xf756('0x7f')];}else if(_0x115ff7[_0xf756('0x7e')]>_0x29feb8[_0x194135]['from']&&_0x115ff7['min_internal']<=_0x29feb8[_0x194135]['to']){_0x2e56e5['internal']=_0x115ff7[_0xf756('0x7e')];}}}if(_[_0xf756('0x7d')](_0x2e56e5[_0xf756('0x77')])){_0x2e56e5['internal']=_0x313d7c+0x1;}return _0x207e84(_0x2e56e5);});});})['catch'](function(_0x463d6c){_0x340018(_0x463d6c);});});}function updateUser(_0x4c1756){return new BPromise(function(_0x214bdf,_0x525e22){try{if(_0x4c1756[_0xf756('0x80')]){_0x4c1756[_0xf756('0x81')]=_0x4c1756[_0xf756('0x77')];_0x4c1756[_0xf756('0x82')]={'mailbox':_0x4c1756['internal'],'password':_0x4c1756[_0xf756('0x6e')],'fullname':_0x4c1756[_0xf756('0x83')],'email':_0x4c1756['email']};}if(_0x4c1756['role']==='agent'){if(!_0x4c1756[_0xf756('0x84')])_0x4c1756[_0xf756('0x84')]=[_0xf756('0x85'),_0xf756('0x86'),_0xf756('0x87'),'113',_0xf756('0x88'),_0xf756('0x89'),'105',_0xf756('0x8a'),_0xf756('0x8b'),_0xf756('0x8c'),_0xf756('0x8d'),'100',_0xf756('0x8e'),_0xf756('0x8f'),_0xf756('0x90')];}_0x214bdf(_0x4c1756);}catch(_0x5787c5){_0x525e22(_0x5787c5);}});}exports[_0xf756('0x91')]=function(_0x34c297,_0x4738b7){if(_0x34c297[_0xf756('0x3c')][_0xf756('0x39')]===_0xf756('0x92'))throw new Error(_0xf756('0x93'));if(_0x34c297['body'][_0xf756('0x39')]===_0xf756('0x3c')&&_0x34c297['user']['role']!==_0xf756('0x3a')){throw new Error(_0xf756('0x94'));}if(_0x34c297['body'][_0xf756('0x39')]===_0xf756('0x3a')&&_0x34c297[_0xf756('0x3c')][_0xf756('0x39')]!=='admin'){throw new Error(_0xf756('0x95'));}return licenseUtil[_0xf756('0x96')]([_0x34c297[_0xf756('0x71')]])[_0xf756('0x23')](function(){return validateUser(_0x34c297[_0xf756('0x71')]);})[_0xf756('0x23')](function(_0x47cd53){return updateUser(_0x47cd53)['then'](function(_0x559309){if(_0x559309['role']===_0xf756('0x3a')){_0x559309[_0xf756('0x97')]=_0x34c297[_0xf756('0x3c')][_0xf756('0x97')];delete _0x559309[_0xf756('0x98')];}return _0x559309;});})[_0xf756('0x23')](function(_0x212a19){return db[_0xf756('0x5d')]['create'](_0x212a19,{'include':[{'model':db[_0xf756('0x82')],'as':_0xf756('0x82')}]});})[_0xf756('0x23')](function(_0x7e50bb){if(_0x34c297[_0xf756('0x71')][_0xf756('0x39')]===_0xf756('0x3c'))return _0x7e50bb;if(_0x34c297['user'][_0xf756('0x39')]!==_0xf756('0x3c'))return _0x7e50bb;return db[_0xf756('0x99')][_0xf756('0x45')]({'where':{'name':_0x7e50bb[_0xf756('0x39')]===_0xf756('0x92')?_0xf756('0x3d'):_0xf756('0x3e'),'userProfileId':_0x34c297['user'][_0xf756('0x98')]},'raw':!![]})[_0xf756('0x23')](function(_0x43db52){if(!_0x43db52||_0x43db52['autoAssociation']!=0x0)return _0x7e50bb;return db[_0xf756('0x9a')][_0xf756('0x91')]({'name':_0x7e50bb[_0xf756('0x47')],'resourceId':_0x7e50bb['id'],'type':_0x43db52[_0xf756('0x47')],'sectionId':_0x43db52['id']},{})['then'](function(){return _0x7e50bb;});})[_0xf756('0x2d')](function(_0x59d86d){logger[_0xf756('0x2a')](_0xf756('0x9b'),_0x59d86d);throw _0x59d86d;});})[_0xf756('0x23')](respondWithResult(_0x4738b7,0xc9))[_0xf756('0x2d')](handleError(_0x4738b7,null));};exports[_0xf756('0x9c')]=function(_0x14d2a2,_0x59f80e){var _0x393ea0=_0x14d2a2[_0xf756('0x71')];var _0x3039d4=[];if(_0x14d2a2[_0xf756('0x3c')][_0xf756('0x39')]===_0xf756('0x92'))throw new Error('Unauthorized');if(_['some'](_0x393ea0,[_0xf756('0x39'),_0xf756('0x3c')])&&_0x14d2a2[_0xf756('0x3c')][_0xf756('0x39')]!==_0xf756('0x3a')){throw new Error(_0xf756('0x94'));}if(_['some'](_0x393ea0,['role',_0xf756('0x3a')])&&_0x14d2a2['user'][_0xf756('0x39')]!==_0xf756('0x3a')){throw new Error(_0xf756('0x9d'));}return licenseUtil[_0xf756('0x96')](_0x393ea0)[_0xf756('0x23')](function(){return validateUser(_0x393ea0[0x0]);})[_0xf756('0x23')](function(){for(var _0x246ae5=0x1;_0x246ae5<_0x393ea0[_0xf756('0x53')];_0x246ae5++){var _0x2e378a=_0x393ea0[_0x246ae5-0x1][_0xf756('0x77')];if(!_0x393ea0[_0x246ae5][_0xf756('0x77')])_0x393ea0[_0x246ae5][_0xf756('0x77')]=_0x2e378a+0x1;_0x3039d4[_0xf756('0x63')](validateUser(_0x393ea0[_0x246ae5]));}return BPromise[_0xf756('0x6b')](_0x3039d4);})['then'](function(){_0x3039d4=[];for(var _0x51d64b=0x0;_0x51d64b<_0x393ea0[_0xf756('0x53')];_0x51d64b++){_0x3039d4[_0xf756('0x63')](updateUser(_0x393ea0[_0x51d64b]));}return BPromise['all'](_0x3039d4);})[_0xf756('0x23')](function(){return BPromise[_0xf756('0x9e')](_0x393ea0,function(_0xe6bdc4){return db[_0xf756('0x5d')][_0xf756('0x91')](_0xe6bdc4,{'include':[{'model':db[_0xf756('0x82')],'as':_0xf756('0x82')}]})[_0xf756('0x23')](function(_0x3568f8){_0xe6bdc4['id']=_0x3568f8['id'];return _0xe6bdc4;});});})[_0xf756('0x23')](function(_0xba8cdc){if(_0x14d2a2[_0xf756('0x71')]['role']==='user')return _0xba8cdc;if(_0x14d2a2[_0xf756('0x3c')]['role']!=='user')return _0xba8cdc;var _0x11ede3=_[_0xf756('0x9f')](_0xba8cdc,function(_0xf844e4){return _0xf844e4[_0xf756('0x39')]===_0xf756('0x92')||_0xf844e4[_0xf756('0x39')]===_0xf756('0x3f');});if(!_0x11ede3)return _0xba8cdc;return db[_0xf756('0x99')][_0xf756('0xa0')]({'where':{'name':{'$or':[_0xf756('0x3d'),_0xf756('0x3e')]},'userProfileId':_0x14d2a2[_0xf756('0x3c')][_0xf756('0x98')]},'raw':!![]})['then'](function(_0x3d5ace){if(_[_0xf756('0xa1')](_0x3d5ace)||!_[_0xf756('0x9f')](_0x3d5ace,['autoAssociation',0x0]))return _0xba8cdc;_0x3039d4=[];var _0x5d493f=_(_0x3d5ace)[_0xf756('0x42')](function(_0x5b38f9){if(_0x5b38f9[_0xf756('0xa2')]===0x1)return;return _0x5b38f9[_0xf756('0x47')]===_0xf756('0x3d')?'agent':_0xf756('0x3f');})['compact']()[_0xf756('0x43')]();for(var _0x5d2b7c=0x0;_0x5d2b7c<_0xba8cdc[_0xf756('0x53')];_0x5d2b7c++){if(!_[_0xf756('0x44')](_0x5d493f,_0xba8cdc[_0x5d2b7c][_0xf756('0x39')]))return;var _0x1e0230=_0xba8cdc[_0x5d2b7c][_0xf756('0x39')]===_0xf756('0x92')?_0xf756('0x3d'):_0xf756('0x3e');_0x3039d4[_0xf756('0x63')](db[_0xf756('0x9a')]['create']({'name':_0xba8cdc[_0x5d2b7c]['name'],'resourceId':_0xba8cdc[_0x5d2b7c]['id'],'type':_0x1e0230,'sectionId':_[_0xf756('0x45')](_0x3d5ace,[_0xf756('0x47'),_0x1e0230])['id']},{}));}return BPromise[_0xf756('0x6b')](_0x3039d4);});})[_0xf756('0x23')](respondWithResult(_0x59f80e,0xc9))[_0xf756('0x2d')](handleError(_0x59f80e,null));};exports[_0xf756('0xa3')]=function(_0x7dd24d,_0x359547,_0x56042c){if(_0x7dd24d[_0xf756('0x71')]['id']){delete _0x7dd24d[_0xf756('0x71')]['id'];}return db['User']['find']({'where':{'id':_0x7dd24d['params']['id']}})[_0xf756('0x23')](function(_0x4d1c5a){if(!_0x4d1c5a)return null;if(_0x4d1c5a['id']===_0x7dd24d['user']['id']){if(!_0x7dd24d['body']['oldPassword']||!_0x7dd24d[_0xf756('0x71')]['newPassword']){throw new db[(_0xf756('0xa4'))]['ValidationError'](_0xf756('0xa5'));}if(!_0x4d1c5a[_0xf756('0xa6')](_0x7dd24d[_0xf756('0x71')]['oldPassword'])){throw new db['Sequelize'][(_0xf756('0xa7'))](_0xf756('0xa8'));}if(_0x7dd24d[_0xf756('0x71')]['oldPassword']===_0x7dd24d[_0xf756('0x71')][_0xf756('0xa9')]){throw new db[(_0xf756('0xa4'))]['ValidationError'](_0xf756('0xaa'));}}else if(_0x7dd24d['user']['role']===_0xf756('0x3a')){if(!_0x7dd24d['body']['newPassword']){throw new db[(_0xf756('0xa4'))][(_0xf756('0xa7'))](_0xf756('0xab'));}}else if(_0x7dd24d[_0xf756('0x3c')][_0xf756('0x39')]===_0xf756('0x3c')){if(!_0x7dd24d['body']['newPassword']){throw new db[(_0xf756('0xa4'))][(_0xf756('0xa7'))](_0xf756('0xab'));}if(_0x4d1c5a[_0xf756('0x39')]!=='agent'){throw new db[(_0xf756('0xa4'))]['ValidationError']('Unauthorized');}}else{throw new db['Sequelize'][(_0xf756('0xa7'))](_0xf756('0x93'));}return _0x4d1c5a;})[_0xf756('0x23')](handleEntityNotFound(_0x359547,null))['then'](function(_0x5524af){return db[_0xf756('0x78')]['findOne']({'attributes':['id',_0xf756('0x7a'),_0xf756('0xac'),_0xf756('0xad')]})[_0xf756('0x23')](function(_0x384868){if(_0x384868['securePassword'])authService[_0xf756('0x7b')](_0x7dd24d['body'][_0xf756('0xa9')]);if(!_0x384868['enforcePasswordHistory']||!_0x5524af[_0xf756('0xae')])return _0x5524af;authService[_0xf756('0xaf')](_0x7dd24d[_0xf756('0x71')]['newPassword'],_0x5524af[_0xf756('0xae')],_0x384868['passwordHistoryLimit']);return _0x5524af;})[_0xf756('0x23')](saveUpdates({'password':_0x7dd24d[_0xf756('0x71')]['newPassword'],'passwordResetAt':_0x7dd24d[_0xf756('0x3c')]['id']==_0x7dd24d[_0xf756('0x72')]['id']?moment():null,'previousPasswords':authService[_0xf756('0xb0')](_0x7dd24d[_0xf756('0x71')][_0xf756('0xa9')],_0x5524af[_0xf756('0xae')])},null));})['then'](respondWithResult(_0x359547,null))['catch'](handleError(_0x359547,null));};exports[_0xf756('0xb1')]=function(_0x20537f,_0x340782,_0x2b7028){var _0x2b739b=_0x20537f['body'][_0xf756('0xb2')];return db[_0xf756('0x5d')][_0xf756('0x45')]({'where':{'id':_0x20537f[_0xf756('0x72')]['id']},'attributes':['id',_0xf756('0x47'),_0xf756('0x39'),_0xf756('0xb3'),_0xf756('0xb4'),_0xf756('0xb5'),_0xf756('0xb6')]})[_0xf756('0x23')](handleEntityNotFound(_0x340782,null))[_0xf756('0x23')](function(_0x1beb67){if(_0x1beb67){if(!utils[_0xf756('0xb7')](_0x2b739b)){throw new db['Sequelize'][(_0xf756('0xa7'))](_0xf756('0xb8'));}return _0x1beb67['add'+_[_0xf756('0xb9')](_0x2b739b[_0xf756('0xba')]())+_0xf756('0xbb')](_0x20537f[_0xf756('0x71')]['ids'],{'penalty':_0x20537f[_0xf756('0x71')][_0xf756('0xbc')]||0x0})[_0xf756('0xbd')](function(_0x293959){for(var _0x3adc6c=0x0;_0x3adc6c<_0x20537f[_0xf756('0x71')][_0xf756('0x75')][_0xf756('0x53')];_0x3adc6c+=0x1){var _0x393518={'UserId':Number(_0x20537f[_0xf756('0x72')]['id'])};_0x393518[_[_0xf756('0xb9')](_0x2b739b[_0xf756('0xba')]())+_0xf756('0xbe')]=Number(_0x20537f['body'][_0xf756('0x75')][_0x3adc6c]);socket[_0xf756('0xbf')](_0xf756('0x3c')+_[_0xf756('0xb9')](_0x2b739b[_0xf756('0xba')]())+'Queue:save',_0x393518);}return _0x293959;})[_0xf756('0x23')](function(){if(_0x2b739b==='voice'){return db[_0xf756('0xc0')][_0xf756('0xa0')]({'where':{'id':_0x20537f['body'][_0xf756('0x75')]||[]},'raw':!![],'attributes':['id',_0xf756('0x47')]});}})[_0xf756('0x23')](function(_0xd88f09){var _0x356716=_0x1beb67['get']({'plain':!![]});var _0x2979e8=[];if(_0x2b739b==='voice'&&_0x356716['role']===_0xf756('0x92')&&_0x356716['online']){for(var _0x46a605=0x0;_0x46a605<_0xd88f09[_0xf756('0x53')];_0x46a605+=0x1){_0x2979e8[_0xf756('0x63')]({'membername':_0x356716[_0xf756('0x47')],'UserId':_0x356716['id'],'queue_name':_0xd88f09[_0x46a605][_0xf756('0x47')],'VoiceQueueId':_0xd88f09[_0x46a605]['id'],'interface':_['isNil'](_0x356716[_0xf756('0xb6')])?util[_0xf756('0xc1')](_0xf756('0xc2'),_0x356716[_0xf756('0x47')]):_0x356716[_0xf756('0xb6')],'paused':_0x356716['voicePause']||![],'penalty':_0x20537f[_0xf756('0x71')][_0xf756('0xbc')]||0x0});}return BPromise[_0xf756('0x9e')](_0x2979e8,function(_0x580b3f){return db[_0xf756('0xc3')][_0xf756('0xc4')](_0x580b3f);});}return _0x1beb67;});}})[_0xf756('0x23')](respondWithStatusCode(_0x340782,null))[_0xf756('0x2d')](handleError(_0x340782,null));};exports['removeQueues']=function(_0x4271dd,_0x13b6fe,_0x17d4f5){var _0x157ec6;return db['User'][_0xf756('0x45')]({'where':{'id':_0x4271dd['params']['id']},'attributes':['id',_0xf756('0x47'),_0xf756('0x39')]})[_0xf756('0x23')](handleEntityNotFound(_0x13b6fe,null))[_0xf756('0x23')](function(_0x44e66c){if(_0x44e66c){_0x157ec6=_0x44e66c;if(!_0x4271dd[_0xf756('0x4e')][_0xf756('0xb2')]||!utils[_0xf756('0xb7')](_0x4271dd[_0xf756('0x4e')][_0xf756('0xb2')])){throw new db['Sequelize'][(_0xf756('0xa7'))](_0xf756('0xb8'));}return _0x44e66c['remove'+_[_0xf756('0xb9')](_0x4271dd[_0xf756('0x4e')][_0xf756('0xb2')][_0xf756('0xba')]())+_0xf756('0xbb')](_0x4271dd['query'][_0xf756('0x75')]);}})['then'](function(_0xcd733a){for(var _0xfbc55d=0x0;_0xfbc55d<_0x4271dd['query']['ids'][_0xf756('0x53')];_0xfbc55d+=0x1){var _0x987aef={'UserId':Number(_0x4271dd[_0xf756('0x72')]['id'])};_0x987aef[_[_0xf756('0xb9')](_0x4271dd[_0xf756('0x4e')][_0xf756('0xb2')][_0xf756('0xba')]())+'QueueId']=Number(_0x4271dd[_0xf756('0x4e')][_0xf756('0x75')][_0xfbc55d]);socket[_0xf756('0xbf')](_0xf756('0x3c')+_[_0xf756('0xb9')](_0x4271dd[_0xf756('0x4e')][_0xf756('0xb2')][_0xf756('0xba')]())+_0xf756('0xc5'),_0x987aef);}return _0xcd733a;})[_0xf756('0x23')](function(){if(_0x4271dd['query']['channel']===_0xf756('0xc6')){return db[_0xf756('0xc3')][_0xf756('0xc7')]({'where':{'UserId':_0x4271dd[_0xf756('0x72')]['id'],'VoiceQueueId':_0x4271dd['query'][_0xf756('0x75')]},'individualHooks':!![]})['then'](function(){return _0x157ec6;});}return _0x157ec6;})['then'](respondWithStatusCode(_0x13b6fe,null))[_0xf756('0x2d')](handleError(_0x13b6fe,null));};exports[_0xf756('0xc8')]=function(_0x1071ed,_0x5f1fe3,_0x52f941){_0x1071ed['body'][_0xf756('0xc9')]=_0x1071ed[_0xf756('0xca')][_0xf756('0xcb')];return db[_0xf756('0x5d')][_0xf756('0x45')]({'where':{'id':_0x1071ed[_0xf756('0x72')]['id']}})[_0xf756('0x23')](handleEntityNotFound(_0x5f1fe3,null))[_0xf756('0x23')](saveUpdates(_0x1071ed[_0xf756('0x71')],null))['then'](respondWithResult(_0x5f1fe3,null))['catch'](handleError(_0x5f1fe3,null));};exports[_0xf756('0xcc')]=function(_0x28e533,_0x2c94f8,_0x4b0820){var _0x1aed4a=path[_0xf756('0xcd')](config['root'],_0xf756('0xce'));return db[_0xf756('0x5d')][_0xf756('0x45')]({'where':{'id':_0x28e533[_0xf756('0x72')]['id']},'attributes':['id',_0xf756('0xc9')],'raw':!![]})[_0xf756('0x23')](handleEntityNotFound(_0x2c94f8,null))[_0xf756('0x23')](function(_0xba17fd){if(_0xba17fd){if(_[_0xf756('0x7d')](_0xba17fd[_0xf756('0xc9')])){return _0x2c94f8[_0xf756('0xcf')](_0x1aed4a);}else{if(!fs[_0xf756('0xd0')](path[_0xf756('0xcd')](config[_0xf756('0xd1')],'server/files/images/',_0xba17fd[_0xf756('0xc9')]))){return _0x2c94f8[_0xf756('0xcf')](_0x1aed4a);}return _0x2c94f8[_0xf756('0xcf')](path[_0xf756('0xcd')](config[_0xf756('0xd1')],_0xf756('0xd2'),_0xba17fd[_0xf756('0xc9')]));}}})[_0xf756('0x2d')](handleError(_0x2c94f8,null));};exports[_0xf756('0xd3')]=function(_0x4cf536,_0x1dbdaf,_0x12deb3){return db[_0xf756('0x5d')]['find']({'where':{'id':_0x4cf536[_0xf756('0x72')]['id']},'attributes':['id']})[_0xf756('0x23')](handleEntityNotFound(_0x1dbdaf,null))[_0xf756('0x23')](function(_0x414efa){var _0x35dbbe=[];values=_0x414efa[_0xf756('0x65')];_0x35dbbe[_0xf756('0x63')](get_open_tabs(_0xf756('0x64'),_0x414efa[_0xf756('0x65')]));_0x35dbbe[_0xf756('0x63')](get_open_tabs(_0xf756('0x66'),_0x414efa[_0xf756('0x65')]));_0x35dbbe[_0xf756('0x63')](get_open_tabs('openchannel',_0x414efa[_0xf756('0x65')]));_0x35dbbe[_0xf756('0x63')](get_open_tabs('whatsapp',_0x414efa[_0xf756('0x65')]));_0x35dbbe['push'](get_open_tabs(_0xf756('0x67'),_0x414efa[_0xf756('0x65')]));_0x35dbbe[_0xf756('0x63')](get_open_tabs('mail',_0x414efa['dataValues']));return BPromise['all'](_0x35dbbe);})['then'](function(_0xe7ab18){var _0x3d0b5b=[];if(_0xe7ab18){for(var _0x128391=0x0;_0x128391=_0x23fddb[_0x6ece('0x57')]){throw new Error(_0x6ece('0x58'));}})[_0x6ece('0x11')](function(){if(_0x49b639){return db[_0x6ece('0x2e')][_0x6ece('0x4f')]({'where':{'membername':_0x49b639['name']},'individualHooks':!![]});}})['then'](function(){if(_0x49b639){return _0x49b639['getVoiceQueues']({'raw':!![]});}})[_0x6ece('0x11')](function(_0x46e80a){if(_0x49b639){if(_0x46e80a){var _0x2fea20=[];_0x33f46e=_0x46e80a;if(_0x33f46e[_0x6ece('0x31')]){for(var _0x56b6ac=0x0;_0x56b6ac<_0x33f46e[_0x6ece('0x31')];_0x56b6ac++){_0x2fea20[_0x6ece('0x4d')](db[_0x6ece('0x2e')]['upsert']({'membername':_0x49b639['name'],'UserId':_0x49b639['id'],'queue_name':_0x33f46e[_0x56b6ac]['name'],'VoiceQueueId':_0x33f46e[_0x56b6ac]['id'],'interface':_0x128444,'paused':_0x49b639['loginInPause']||![],'penalty':_0x33f46e[_0x56b6ac][_0x6ece('0x59')]||0x0}));}return BPromise[_0x6ece('0x50')](_0x2fea20);}}}})[_0x6ece('0x11')](function(){if(_0x49b639){return db['MemberReport'][_0x6ece('0x1c')]({'where':{'membername':_0x49b639['name'],'exitAt':null}});}})[_0x6ece('0x11')](function(_0x381595){if(_0x49b639){if(_0x381595&&_0x381595[_0x6ece('0x31')]){var _0x51ac2c=[];_0x381595['forEach'](function(_0x422efb){_0x51ac2c[_0x6ece('0x4d')](_0x422efb[_0x6ece('0x3c')]({'exitAt':moment()[_0x6ece('0x32')](_0x6ece('0x33'))}));});return BPromise[_0x6ece('0x50')](_0x51ac2c);}}})[_0x6ece('0x11')](function(_0x583e0f){if(_0x49b639){var _0x3d9b56=[];var _0x5a7d7e=[];var _0x1b12c9=utils[_0x6ece('0x35')]();var _0x90c7ab={'membername':_0x49b639[_0x6ece('0x2b')],'interface':_0x128444,'enterAt':moment()['format'](_0x6ece('0x33')),'role':_0x49b639[_0x6ece('0x2c')],'internal':_0x49b639[_0x6ece('0x2d')]};_0x1b12c9[_0x6ece('0x4c')](function(_0x437fb5){_0x3d9b56['push'](_[_0x6ece('0x5a')]({'channel':_0x437fb5,'type':_0x6ece('0x5b'),'data1':'callysquare','data2':_0x128444},_0x90c7ab));if(_0x49b639['loginInPause']){_0x5a7d7e[_0x6ece('0x4d')](_[_0x6ece('0x5a')]({'channel':_0x437fb5,'type':'PAUSE','data1':'LOGININPAUSE'},_0x90c7ab));}});return db[_0x6ece('0x2f')]['bulkCreate'](_0x3d9b56['concat'](_0x5a7d7e),{'individualHooks':!![]});}})[_0x6ece('0x11')](function(){if(_0x49b639){return _0x49b639[_0x6ece('0x3c')]({'online':!![],'lastLoginAt':moment()['format'](_0x6ece('0x33')),'voicePause':_0x49b639['loginInPause']||![],'mailPause':_0x49b639['loginInPause']||![],'chatPause':_0x49b639['loginInPause']||![],'faxPause':_0x49b639[_0x6ece('0x53')]||![],'smsPause':_0x49b639[_0x6ece('0x53')]||![],'openchannelPause':_0x49b639['loginInPause']||![],'pauseType':_0x49b639['loginInPause']?'LOGININPAUSE':null,'lastPauseAt':moment()[_0x6ece('0x32')](_0x6ece('0x33')),'interface':_0x128444});}})[_0x6ece('0x11')](function(_0x308ec2){_0x55547c(_0x308ec2);})[_0x6ece('0x1b')](function(_0x4b6f80){_0x54f60e(_0x5b414f[_0x6ece('0x17')](0x1f4,_0x4b6f80['message']));});});}; \ No newline at end of file +var _0x9173=['result','catch','GetUser','User','options','raw','where','attributes','limit','include','map','model','debug','stringify','ShowUser','find','PauseUser','name','role','interface','UserVoiceQueueRt','findAll','PAUSE','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','getChannels','push','isNil','SIP/%s','type','DEFAULT\x20PAUSE','internal','uniqueid','MemberReport','update','body','UnpauseUser','findOne','channel','Unknown\x20channel','voice','chat','fax','sms','whatsapp','set','%s%s','Pause','forEach','system','LogoutUser','length','all','LoginUser','mobile','phone','loginInPause','count','agent','../../config/license/util','agents','Maximum\x20login\x20has\x20been\x20reached','destroy','getVoiceQueues','upsert','UserVoiceQueue.penalty','LOGIN','callysquare','merge','LOGININPAUSE','bulkCreate','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./user.socket','register','then','info','User,\x20%s,\x20%s','request\x20sent','User,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x5b5618,_0x2dee40){var _0x28760c=function(_0x55ba99){while(--_0x55ba99){_0x5b5618['push'](_0x5b5618['shift']());}};_0x28760c(++_0x2dee40);}(_0x9173,0x165));var _0x3917=function(_0x1db159,_0x2475c9){_0x1db159=_0x1db159-0x0;var _0x4c17d0=_0x9173[_0x1db159];return _0x4c17d0;};'use strict';var _=require(_0x3917('0x0'));var util=require(_0x3917('0x1'));var moment=require(_0x3917('0x2'));var BPromise=require('bluebird');var rs=require(_0x3917('0x3'));var fs=require('fs');var Redis=require(_0x3917('0x4'));var db=require(_0x3917('0x5'))['db'];var utils=require(_0x3917('0x6'));var logger=require('../../config/logger')(_0x3917('0x7'));var config=require(_0x3917('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3917('0x9')][_0x3917('0xa')]({'port':0x232a});config[_0x3917('0xb')]=_['defaults'](config[_0x3917('0xb')],{'host':_0x3917('0xc'),'port':0x18eb});var socket=require(_0x3917('0xd'))(new Redis(config[_0x3917('0xb')]));require(_0x3917('0xe'))[_0x3917('0xf')](socket);function respondWithRpcPromise(_0x2e4667,_0x3c2056,_0x408f8c){return new BPromise(function(_0xc13d3b,_0x4b8131){return client['request'](_0x2e4667,_0x408f8c)[_0x3917('0x10')](function(_0x136c00){logger[_0x3917('0x11')](_0x3917('0x12'),_0x3c2056,_0x3917('0x13'));logger['debug'](_0x3917('0x14'),_0x3c2056,'request\x20sent',JSON['stringify'](_0x136c00));if(_0x136c00[_0x3917('0x15')]){if(_0x136c00[_0x3917('0x15')]['code']===0x1f4){logger[_0x3917('0x15')]('User,\x20%s,\x20%s',_0x3c2056,_0x136c00[_0x3917('0x15')][_0x3917('0x16')]);return _0x4b8131(_0x136c00[_0x3917('0x15')][_0x3917('0x16')]);}logger[_0x3917('0x15')](_0x3917('0x12'),_0x3c2056,_0x136c00['error'][_0x3917('0x16')]);return _0xc13d3b(_0x136c00['error'][_0x3917('0x16')]);}else{logger[_0x3917('0x11')]('User,\x20%s,\x20%s',_0x3c2056,_0x3917('0x13'));_0xc13d3b(_0x136c00[_0x3917('0x17')]['message']);}})[_0x3917('0x18')](function(_0x23da4f){logger['error'](_0x3917('0x12'),_0x3c2056,_0x23da4f);_0x4b8131(_0x23da4f);});});}exports[_0x3917('0x19')]=function(_0x4e5869){var _0xb070bf=this;return new Promise(function(_0x8799fa,_0x4a2c83){return db[_0x3917('0x1a')]['findAll']({'raw':_0x4e5869[_0x3917('0x1b')]?_0x4e5869[_0x3917('0x1b')][_0x3917('0x1c')]===undefined?!![]:![]:!![],'where':_0x4e5869[_0x3917('0x1b')]?_0x4e5869[_0x3917('0x1b')][_0x3917('0x1d')]||null:null,'attributes':_0x4e5869[_0x3917('0x1b')]?_0x4e5869[_0x3917('0x1b')][_0x3917('0x1e')]||null:null,'limit':_0x4e5869[_0x3917('0x1b')]?_0x4e5869[_0x3917('0x1b')][_0x3917('0x1f')]||null:null,'include':_0x4e5869[_0x3917('0x1b')]?_0x4e5869[_0x3917('0x1b')][_0x3917('0x20')]?_[_0x3917('0x21')](_0x4e5869['options']['include'],function(_0x4de0a9){return{'model':db[_0x4de0a9[_0x3917('0x22')]],'as':_0x4de0a9['as'],'attributes':_0x4de0a9[_0x3917('0x1e')],'include':_0x4de0a9['include']?_[_0x3917('0x21')](_0x4de0a9[_0x3917('0x20')],function(_0x33a665){return{'model':db[_0x33a665[_0x3917('0x22')]],'as':_0x33a665['as'],'attributes':_0x33a665['attributes'],'include':_0x33a665[_0x3917('0x20')]?_['map'](_0x33a665[_0x3917('0x20')],function(_0x5c07b3){return{'model':db[_0x5c07b3[_0x3917('0x22')]],'as':_0x5c07b3['as'],'attributes':_0x5c07b3[_0x3917('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3917('0x10')](function(_0x3f3143){logger[_0x3917('0x11')](_0x3917('0x19'),_0x4e5869);logger[_0x3917('0x23')](_0x3917('0x19'),_0x4e5869,JSON[_0x3917('0x24')](_0x3f3143));_0x8799fa(_0x3f3143);})[_0x3917('0x18')](function(_0x379460){logger[_0x3917('0x15')](_0x3917('0x19'),_0x379460[_0x3917('0x16')],_0x4e5869);_0x4a2c83(_0xb070bf[_0x3917('0x15')](0x1f4,_0x379460[_0x3917('0x16')]));});});};exports[_0x3917('0x25')]=function(_0x1b11a7){var _0x2814f4=this;return new Promise(function(_0x3e4c17,_0x63c099){return db['User'][_0x3917('0x26')]({'raw':_0x1b11a7[_0x3917('0x1b')]?_0x1b11a7[_0x3917('0x1b')][_0x3917('0x1c')]===undefined?!![]:![]:!![],'where':_0x1b11a7[_0x3917('0x1b')]?_0x1b11a7[_0x3917('0x1b')][_0x3917('0x1d')]||null:null,'attributes':_0x1b11a7[_0x3917('0x1b')]?_0x1b11a7['options'][_0x3917('0x1e')]||null:null,'include':_0x1b11a7['options']?_0x1b11a7['options'][_0x3917('0x20')]?_[_0x3917('0x21')](_0x1b11a7['options'][_0x3917('0x20')],function(_0x5644bc){return{'model':db[_0x5644bc[_0x3917('0x22')]],'as':_0x5644bc['as'],'attributes':_0x5644bc['attributes'],'include':_0x5644bc[_0x3917('0x20')]?_[_0x3917('0x21')](_0x5644bc[_0x3917('0x20')],function(_0x1ef3c3){return{'model':db[_0x1ef3c3[_0x3917('0x22')]],'as':_0x1ef3c3['as'],'attributes':_0x1ef3c3['attributes'],'include':_0x1ef3c3['include']?_['map'](_0x1ef3c3[_0x3917('0x20')],function(_0x57bb98){return{'model':db[_0x57bb98[_0x3917('0x22')]],'as':_0x57bb98['as'],'attributes':_0x57bb98[_0x3917('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x3917('0x10')](function(_0x38bebc){logger[_0x3917('0x11')](_0x3917('0x25'),_0x1b11a7);logger[_0x3917('0x23')](_0x3917('0x25'),_0x1b11a7,JSON[_0x3917('0x24')](_0x38bebc));_0x3e4c17(_0x38bebc);})[_0x3917('0x18')](function(_0x200afb){logger[_0x3917('0x15')]('ShowUser',_0x200afb['message'],_0x1b11a7);_0x63c099(_0x2814f4[_0x3917('0x15')](0x1f4,_0x200afb[_0x3917('0x16')]));});});};exports[_0x3917('0x27')]=function(_0x13c5d1){var _0x202c7c=this;return new Promise(function(_0x511d28,_0x383e84){var _0x409e64;return db[_0x3917('0x1a')]['find']({'where':_0x13c5d1[_0x3917('0x1b')]['where']||{},'attributes':['id',_0x3917('0x28'),_0x3917('0x29'),'internal',_0x3917('0x2a')]})[_0x3917('0x10')](function(_0x2cfad8){if(_0x2cfad8){_0x409e64=_0x2cfad8;return db[_0x3917('0x2b')]['update']({'paused':0x1},{'where':{'UserId':_0x409e64['id']},'individualHooks':!![]});}})[_0x3917('0x10')](function(){if(_0x409e64){return db['MemberReport'][_0x3917('0x2c')]({'where':{'membername':_0x409e64['name'],'type':_0x3917('0x2d'),'exitAt':null}});}})[_0x3917('0x10')](function(_0xd1e5f3){if(_0x409e64){if(_0xd1e5f3&&_0xd1e5f3['length']){var _0x58bc00=moment()[_0x3917('0x2e')](_0x3917('0x2f'));for(var _0x5cc026=0x0,_0x3f35fa=_0xd1e5f3['length'];_0x5cc026<_0x3f35fa;_0x5cc026++){_0xd1e5f3[_0x5cc026][_0x3917('0x30')]({'exitAt':_0x58bc00});}}}})['then'](function(){if(_0x409e64){var _0x30d814=[];var _0x44aa71=utils[_0x3917('0x31')]();_0x44aa71['forEach'](function(_0xb41f3e){_0x30d814[_0x3917('0x32')]({'channel':_0xb41f3e,'membername':_0x409e64[_0x3917('0x28')],'interface':_[_0x3917('0x33')](_0x409e64[_0x3917('0x2a')])?util[_0x3917('0x2e')](_0x3917('0x34'),_0x409e64[_0x3917('0x28')]):_0x409e64[_0x3917('0x2a')],'type':_0x3917('0x2d'),'enterAt':moment()[_0x3917('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x13c5d1['body'][_0x3917('0x35')]||_0x3917('0x36'),'role':_0x409e64['role'],'internal':_0x409e64[_0x3917('0x37')],'uniqueid':_0x13c5d1['body'][_0x3917('0x38')]||null});});return db[_0x3917('0x39')]['bulkCreate'](_0x30d814,{'individualHooks':!![]});}})[_0x3917('0x10')](function(){if(_0x409e64){return _0x409e64[_0x3917('0x3a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x13c5d1[_0x3917('0x3b')][_0x3917('0x35')]||_0x3917('0x36'),'lastPauseAt':moment()[_0x3917('0x2e')](_0x3917('0x2f'))});}})[_0x3917('0x10')](function(_0x351923){_0x511d28(_0x351923);})['catch'](function(_0x5b5b15){_0x383e84(_0x202c7c[_0x3917('0x15')](0x1f4,_0x5b5b15['message']));});});};exports[_0x3917('0x3c')]=function(_0xffcbbf){var _0x170a34=this;return new Promise(function(_0x47d39d,_0x1d5593){var _0x4cfec1;return db[_0x3917('0x1a')][_0x3917('0x3d')]({'where':_0xffcbbf[_0x3917('0x1b')][_0x3917('0x1d')]||{},'attributes':['id',_0x3917('0x28')]})['then'](function(_0x324922){if(_0x324922){_0x4cfec1=_0x324922;if(_0xffcbbf[_0x3917('0x3b')][_0x3917('0x3e')]&&!utils['isValidChannel'](_0xffcbbf[_0x3917('0x3b')][_0x3917('0x3e')])){throw new Error(_0x3917('0x3f'));}switch(_0xffcbbf[_0x3917('0x3b')][_0x3917('0x3e')]){case _0x3917('0x40'):return db[_0x3917('0x2b')][_0x3917('0x3a')]({'paused':0x0},{'where':{'UserId':_0x4cfec1['id']}})[_0x3917('0x10')](function(){return db['MemberReport'][_0x3917('0x26')]({'where':{'channel':_0xffcbbf[_0x3917('0x3b')][_0x3917('0x3e')],'membername':_0x4cfec1[_0x3917('0x28')],'type':_0x3917('0x2d'),'exitAt':null}});})['then'](function(_0x45ac4b){if(_0x45ac4b){return _0x45ac4b[_0x3917('0x3a')]({'exitAt':moment()[_0x3917('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'data2':'system'},{'individualHooks':!![]});}return null;})[_0x3917('0x10')](function(){return _0x4cfec1[_0x3917('0x3a')]({'voicePause':![]});});case'mail':case _0x3917('0x41'):case _0x3917('0x42'):case _0x3917('0x43'):case'openchannel':case _0x3917('0x44'):return db['MemberReport'][_0x3917('0x26')]({'where':{'channel':_0xffcbbf[_0x3917('0x3b')][_0x3917('0x3e')],'membername':_0x4cfec1[_0x3917('0x28')],'type':_0x3917('0x2d'),'exitAt':null}})[_0x3917('0x10')](function(_0x269fe4){return _0x269fe4[_0x3917('0x3a')]({'exitAt':moment()[_0x3917('0x2e')](_0x3917('0x2f')),'data2':'system'},{'individualHooks':!![]});})[_0x3917('0x10')](function(){var _0x51fcf2={};_[_0x3917('0x45')](_0x51fcf2,util['format'](_0x3917('0x46'),_0xffcbbf[_0x3917('0x3b')][_0x3917('0x3e')],_0x3917('0x47')),![]);return _0x4cfec1[_0x3917('0x3a')](_0x51fcf2);});default:return db[_0x3917('0x2b')][_0x3917('0x3a')]({'paused':0x0},{'where':{'UserId':_0x4cfec1['id']}})[_0x3917('0x10')](function(){return db[_0x3917('0x39')][_0x3917('0x2c')]({'where':{'membername':_0x4cfec1[_0x3917('0x28')],'type':_0x3917('0x2d'),'exitAt':null}});})[_0x3917('0x10')](function(_0x2ae96c){var _0x3040a0=[];_0x2ae96c[_0x3917('0x48')](function(_0xfb09c6){_0x3040a0[_0x3917('0x32')](_0xfb09c6['update']({'exitAt':moment()['format'](_0x3917('0x2f')),'data2':_0x3917('0x49')}));});return BPromise['all'](_0x3040a0);})[_0x3917('0x10')](function(){return _0x4cfec1[_0x3917('0x3a')]({'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![]});});}}})['then'](function(_0x291a8c){_0x47d39d(_0x291a8c);})[_0x3917('0x18')](function(_0xee0f87){_0x1d5593(_0x170a34[_0x3917('0x15')](0x1f4,_0xee0f87[_0x3917('0x16')]));});});};exports[_0x3917('0x4a')]=function(_0x303120){var _0x5cf246=this;return new Promise(function(_0x1ab2d3,_0xcaf929){var _0x2e030c;return db[_0x3917('0x1a')][_0x3917('0x3d')]({'where':_0x303120[_0x3917('0x1b')]['where']||{},'attributes':['id',_0x3917('0x28')]})[_0x3917('0x10')](function(_0x323503){if(_0x323503){_0x2e030c=_0x323503;return db[_0x3917('0x2b')]['destroy']({'where':{'membername':_0x2e030c['name']},'individualHooks':!![]});}})[_0x3917('0x10')](function(){if(_0x2e030c){return db[_0x3917('0x39')][_0x3917('0x2c')]({'where':{'membername':_0x2e030c[_0x3917('0x28')],'exitAt':null}});}})[_0x3917('0x10')](function(_0x5e0811){if(_0x2e030c){if(_0x5e0811&&_0x5e0811[_0x3917('0x4b')]){var _0x2559dc=[];_0x5e0811[_0x3917('0x48')](function(_0x1b65c8){_0x2559dc[_0x3917('0x32')](_0x1b65c8[_0x3917('0x3a')]({'exitAt':moment()['format'](_0x3917('0x2f'))}));});return BPromise[_0x3917('0x4c')](_0x2559dc);}}})[_0x3917('0x10')](function(){if(_0x2e030c){return _0x2e030c[_0x3917('0x3a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})['then'](function(_0xd7b611){_0x1ab2d3(_0xd7b611);})[_0x3917('0x18')](function(_0xcff499){_0xcaf929(_0x5cf246['error'](0x1f4,_0xcff499['message']));});});};exports[_0x3917('0x4d')]=function(_0x4f539f){var _0x265a20=this;return new Promise(function(_0x22c92d,_0x2678f7){var _0x5c0b4c;var _0x33d564;var _0x3ec723;var _0x8c8eea;return db[_0x3917('0x1a')][_0x3917('0x3d')]({'where':_0x4f539f['options'][_0x3917('0x1d')]||{},'attributes':['id',_0x3917('0x28'),'role',_0x3917('0x4e'),_0x3917('0x4f'),_0x3917('0x37'),_0x3917('0x50'),_0x3917('0x2a')]})[_0x3917('0x10')](function(_0x4c24bd){if(_0x4c24bd){_0x5c0b4c=_0x4c24bd;_0x8c8eea=_0x4f539f[_0x3917('0x3b')][_0x3917('0x2a')]?_0x4f539f['body'][_0x3917('0x2a')]:util[_0x3917('0x2e')](_0x3917('0x34'),_0x5c0b4c['name']);return db[_0x3917('0x1a')][_0x3917('0x51')]({'where':{'role':_0x3917('0x52'),'online':!![],'id':{'$ne':_0x5c0b4c['id']}}});}})['then'](function(_0x4cdf08){if(_0x4cdf08){_0x3ec723=_0x4cdf08;return require(_0x3917('0x53'))['getLicense']();}})[_0x3917('0x10')](function(_0x2bcb60){if(_0x2bcb60&&_0x2bcb60[_0x3917('0x54')]&&_0x3ec723>=_0x2bcb60['agents']){throw new Error(_0x3917('0x55'));}})[_0x3917('0x10')](function(){if(_0x5c0b4c){return db[_0x3917('0x2b')][_0x3917('0x56')]({'where':{'membername':_0x5c0b4c[_0x3917('0x28')]},'individualHooks':!![]});}})['then'](function(){if(_0x5c0b4c){return _0x5c0b4c[_0x3917('0x57')]({'raw':!![]});}})[_0x3917('0x10')](function(_0x2899a7){if(_0x5c0b4c){if(_0x2899a7){var _0x4cd9eb=[];_0x33d564=_0x2899a7;if(_0x33d564[_0x3917('0x4b')]){for(var _0x5f1013=0x0;_0x5f1013<_0x33d564[_0x3917('0x4b')];_0x5f1013++){_0x4cd9eb[_0x3917('0x32')](db['UserVoiceQueueRt'][_0x3917('0x58')]({'membername':_0x5c0b4c[_0x3917('0x28')],'UserId':_0x5c0b4c['id'],'queue_name':_0x33d564[_0x5f1013]['name'],'VoiceQueueId':_0x33d564[_0x5f1013]['id'],'interface':_0x8c8eea,'paused':_0x5c0b4c['loginInPause']||![],'penalty':_0x33d564[_0x5f1013][_0x3917('0x59')]||0x0}));}return BPromise[_0x3917('0x4c')](_0x4cd9eb);}}}})[_0x3917('0x10')](function(){if(_0x5c0b4c){return db[_0x3917('0x39')][_0x3917('0x2c')]({'where':{'membername':_0x5c0b4c[_0x3917('0x28')],'exitAt':null}});}})[_0x3917('0x10')](function(_0x464af4){if(_0x5c0b4c){if(_0x464af4&&_0x464af4['length']){var _0x5d73ac=[];_0x464af4['forEach'](function(_0x482b71){_0x5d73ac[_0x3917('0x32')](_0x482b71[_0x3917('0x3a')]({'exitAt':moment()[_0x3917('0x2e')](_0x3917('0x2f'))}));});return BPromise['all'](_0x5d73ac);}}})[_0x3917('0x10')](function(_0x312c48){if(_0x5c0b4c){var _0x4411cf=[];var _0x1844d1=[];var _0x48f864=utils[_0x3917('0x31')]();var _0x46ddc6={'membername':_0x5c0b4c['name'],'interface':_0x8c8eea,'enterAt':moment()[_0x3917('0x2e')](_0x3917('0x2f')),'role':_0x5c0b4c[_0x3917('0x29')],'internal':_0x5c0b4c[_0x3917('0x37')]};_0x48f864[_0x3917('0x48')](function(_0x43aa58){_0x4411cf[_0x3917('0x32')](_['merge']({'channel':_0x43aa58,'type':_0x3917('0x5a'),'data1':_0x3917('0x5b'),'data2':_0x8c8eea},_0x46ddc6));if(_0x5c0b4c[_0x3917('0x50')]){_0x1844d1[_0x3917('0x32')](_[_0x3917('0x5c')]({'channel':_0x43aa58,'type':_0x3917('0x2d'),'data1':_0x3917('0x5d')},_0x46ddc6));}});return db[_0x3917('0x39')][_0x3917('0x5e')](_0x4411cf['concat'](_0x1844d1),{'individualHooks':!![]});}})[_0x3917('0x10')](function(){if(_0x5c0b4c){return _0x5c0b4c[_0x3917('0x3a')]({'online':!![],'lastLoginAt':moment()[_0x3917('0x2e')](_0x3917('0x2f')),'voicePause':_0x5c0b4c[_0x3917('0x50')]||![],'mailPause':_0x5c0b4c[_0x3917('0x50')]||![],'chatPause':_0x5c0b4c[_0x3917('0x50')]||![],'faxPause':_0x5c0b4c[_0x3917('0x50')]||![],'smsPause':_0x5c0b4c[_0x3917('0x50')]||![],'openchannelPause':_0x5c0b4c[_0x3917('0x50')]||![],'pauseType':_0x5c0b4c['loginInPause']?_0x3917('0x5d'):null,'lastPauseAt':moment()[_0x3917('0x2e')]('YYYY-MM-DD\x20HH:mm:ss'),'interface':_0x8c8eea});}})['then'](function(_0x2ff49e){_0x22c92d(_0x2ff49e);})[_0x3917('0x18')](function(_0x590fd8){_0x2678f7(_0x265a20[_0x3917('0x15')](0x1f4,_0x590fd8['message']));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index e754a19..575f274 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 _0x096a=['update','emit','removeListener','register','length','./user.events','save','remove'];(function(_0x4145ce,_0x31e6e4){var _0x4cb0e6=function(_0x5ae5c4){while(--_0x5ae5c4){_0x4145ce['push'](_0x4145ce['shift']());}};_0x4cb0e6(++_0x31e6e4);}(_0x096a,0xbd));var _0xa096=function(_0x49bd50,_0x49918e){_0x49bd50=_0x49bd50-0x0;var _0x273187=_0x096a[_0x49bd50];return _0x273187;};'use strict';var UserEvents=require(_0xa096('0x0'));var events=[_0xa096('0x1'),_0xa096('0x2'),_0xa096('0x3')];function createListener(_0xf6116,_0x1105eb){return function(_0x3c5412){_0x1105eb[_0xa096('0x4')](_0xf6116,_0x3c5412);};}function removeListener(_0x508a16,_0xbfe072){return function(){UserEvents[_0xa096('0x5')](_0x508a16,_0xbfe072);};}exports[_0xa096('0x6')]=function(_0x4144fd){for(var _0x289771=0x0,_0x3c2939=events[_0xa096('0x7')];_0x289771<_0x3c2939;_0x289771++){var _0x5c50f6=events[_0x289771];var _0x13f4fe=createListener('user:'+_0x5c50f6,_0x4144fd);UserEvents['on'](_0x5c50f6,_0x13f4fe);}}; \ No newline at end of file +var _0x061a=['length','user:','./user.events','save','update','emit','removeListener'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x061a,0x64));var _0xa061=function(_0x1996d2,_0x3f3c21){_0x1996d2=_0x1996d2-0x0;var _0x5d2f04=_0x061a[_0x1996d2];return _0x5d2f04;};'use strict';var UserEvents=require(_0xa061('0x0'));var events=[_0xa061('0x1'),'remove',_0xa061('0x2')];function createListener(_0x1172d5,_0x42ccce){return function(_0x26c438){_0x42ccce[_0xa061('0x3')](_0x1172d5,_0x26c438);};}function removeListener(_0x1fc6d0,_0x5c82b4){return function(){UserEvents[_0xa061('0x4')](_0x1fc6d0,_0x5c82b4);};}exports['register']=function(_0x2e9883){for(var _0x424a43=0x0,_0x5a3850=events[_0xa061('0x5')];_0x424a43<_0x5a3850;_0x424a43++){var _0x1c5dcf=events[_0x424a43];var _0xc92235=createListener(_0xa061('0x6')+_0x1c5dcf,_0x2e9883);UserEvents['on'](_0x1c5dcf,_0xc92235);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index e25fb7c..94f689a 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x45371d,_0x346914){var _0x357362=function(_0x29e7c8){while(--_0x29e7c8){_0x45371d['push'](_0x45371d['shift']());}};_0x357362(++_0x346914);}(_0xe706,0xa3));var _0x6e70=function(_0x25806f,_0x16dbdd){_0x25806f=_0x25806f-0x0;var _0x163f12=_0xe706[_0x25806f];return _0x163f12;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xd569cd,_0x58a1d5){var _0x4e9474=function(_0x364a32){while(--_0x364a32){_0xd569cd['push'](_0xd569cd['shift']());}};_0x4e9474(++_0x58a1d5);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x27d8bc,_0x19e010){_0x27d8bc=_0x27d8bc-0x0;var _0x4b04cb=_0xcb91[_0x27d8bc];return _0x4b04cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index 9c73857..f30e88a 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 _0x9891=['INTEGER'];(function(_0x322752,_0x1ab149){var _0x2a6840=function(_0xf31750){while(--_0xf31750){_0x322752['push'](_0x322752['shift']());}};_0x2a6840(++_0x1ab149);}(_0x9891,0x1ee));var _0x1989=function(_0x57add2,_0x4f2b7d){_0x57add2=_0x57add2-0x0;var _0x4e3670=_0x9891[_0x57add2];return _0x4e3670;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x1989('0x0')],'defaultValue':0x0}}; \ No newline at end of file +var _0x0b3b=['INTEGER','exports'];(function(_0x366d69,_0x25bb6f){var _0x4aee7a=function(_0x557363){while(--_0x557363){_0x366d69['push'](_0x366d69['shift']());}};_0x4aee7a(++_0x25bb6f);}(_0x0b3b,0xcd));var _0xb0b3=function(_0x2c6652,_0x2ad6d9){_0x2c6652=_0x2c6652-0x0;var _0x3ddea9=_0x0b3b[_0x2c6652];return _0x3ddea9;};'use strict';var Sequelize=require('sequelize');module[_0xb0b3('0x0')]={'penalty':{'type':Sequelize[_0xb0b3('0x1')],'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 3f4eb06..ba067ba 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 _0x95ac=['moment','bluebird','path','./userChatQueue.attributes','exports','define','user_has_chat_queues','lodash','../../config/logger','api'];(function(_0x5b9e08,_0x3a1cec){var _0x37695a=function(_0x3ad374){while(--_0x3ad374){_0x5b9e08['push'](_0x5b9e08['shift']());}};_0x37695a(++_0x3a1cec);}(_0x95ac,0xa7));var _0xc95a=function(_0x173193,_0x48ea57){_0x173193=_0x173193-0x0;var _0x583e23=_0x95ac[_0x173193];return _0x583e23;};'use strict';var _=require(_0xc95a('0x0'));var util=require('util');var logger=require(_0xc95a('0x1'))(_0xc95a('0x2'));var moment=require(_0xc95a('0x3'));var BPromise=require(_0xc95a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc95a('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc95a('0x6'));module[_0xc95a('0x7')]=function(_0x3c4e2a,_0x3df788){return _0x3c4e2a[_0xc95a('0x8')]('UserChatQueue',attributes,{'tableName':_0xc95a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x00fc=['rimraf','../../config/environment','./userChatQueue.attributes','exports','define','UserChatQueue','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x512a4c,_0xc0b92b){var _0x54f3c8=function(_0x24dd70){while(--_0x24dd70){_0x512a4c['push'](_0x512a4c['shift']());}};_0x54f3c8(++_0xc0b92b);}(_0x00fc,0x96));var _0xc00f=function(_0x352d28,_0x444033){_0x352d28=_0x352d28-0x0;var _0x387d7e=_0x00fc[_0x352d28];return _0x387d7e;};'use strict';var _=require('lodash');var util=require(_0xc00f('0x0'));var logger=require(_0xc00f('0x1'))('api');var moment=require(_0xc00f('0x2'));var BPromise=require(_0xc00f('0x3'));var rp=require(_0xc00f('0x4'));var fs=require('fs');var path=require(_0xc00f('0x5'));var rimraf=require(_0xc00f('0x6'));var config=require(_0xc00f('0x7'));var attributes=require(_0xc00f('0x8'));module[_0xc00f('0x9')]=function(_0xeb4dc9,_0x482d50){return _0xeb4dc9[_0xc00f('0xa')](_0xc00f('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 d2a4810..4d9c8bf 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 _0x6258=['../../config/environment','jayson/promise','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','rpc'];(function(_0x39bafc,_0x486f52){var _0x13738b=function(_0x2544cf){while(--_0x2544cf){_0x39bafc['push'](_0x39bafc['shift']());}};_0x13738b(++_0x486f52);}(_0x6258,0x117));var _0x8625=function(_0x31ac50,_0x567d52){_0x31ac50=_0x31ac50-0x0;var _0x4daac4=_0x6258[_0x31ac50];return _0x4daac4;};'use strict';var _=require(_0x8625('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x8625('0x1'));var rs=require(_0x8625('0x2'));var fs=require('fs');var Redis=require(_0x8625('0x3'));var db=require(_0x8625('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x8625('0x5'));var config=require(_0x8625('0x6'));var jayson=require(_0x8625('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x29e4a7,_0x335d82,_0x5b6fb8){return new BPromise(function(_0x51cd4a,_0x3ba754){return client['request'](_0x29e4a7,_0x5b6fb8)[_0x8625('0x8')](function(_0x28abb9){logger[_0x8625('0x9')](_0x8625('0xa'),_0x335d82,_0x8625('0xb'));logger['debug'](_0x8625('0xc'),_0x335d82,_0x8625('0xb'),JSON[_0x8625('0xd')](_0x28abb9));if(_0x28abb9[_0x8625('0xe')]){if(_0x28abb9['error'][_0x8625('0xf')]===0x1f4){logger[_0x8625('0xe')](_0x8625('0xa'),_0x335d82,_0x28abb9[_0x8625('0xe')][_0x8625('0x10')]);return _0x3ba754(_0x28abb9[_0x8625('0xe')][_0x8625('0x10')]);}logger['error'](_0x8625('0xa'),_0x335d82,_0x28abb9[_0x8625('0xe')][_0x8625('0x10')]);return _0x51cd4a(_0x28abb9[_0x8625('0xe')]['message']);}else{logger['info'](_0x8625('0xa'),_0x335d82,_0x8625('0xb'));_0x51cd4a(_0x28abb9[_0x8625('0x11')][_0x8625('0x10')]);}})[_0x8625('0x12')](function(_0x18bce6){logger['error'](_0x8625('0xa'),_0x335d82,_0x18bce6);_0x3ba754(_0x18bce6);});});} \ No newline at end of file +var _0x40fc=['catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result'];(function(_0x4cf98e,_0xba4b79){var _0x1623ac=function(_0x459bc0){while(--_0x459bc0){_0x4cf98e['push'](_0x4cf98e['shift']());}};_0x1623ac(++_0xba4b79);}(_0x40fc,0x190));var _0xc40f=function(_0x5c6be5,_0x3ff1d5){_0x5c6be5=_0x5c6be5-0x0;var _0x151348=_0x40fc[_0x5c6be5];return _0x151348;};'use strict';var _=require(_0xc40f('0x0'));var util=require(_0xc40f('0x1'));var moment=require(_0xc40f('0x2'));var BPromise=require(_0xc40f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc40f('0x4'));var db=require(_0xc40f('0x5'))['db'];var utils=require(_0xc40f('0x6'));var logger=require('../../config/logger')(_0xc40f('0x7'));var config=require(_0xc40f('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xc40f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2b4c51,_0x50cbb6,_0x882e7){return new BPromise(function(_0x3a5087,_0x207ab3){return client['request'](_0x2b4c51,_0x882e7)[_0xc40f('0xa')](function(_0x2e0591){logger[_0xc40f('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x50cbb6,_0xc40f('0xc'));logger['debug'](_0xc40f('0xd'),_0x50cbb6,_0xc40f('0xc'),JSON[_0xc40f('0xe')](_0x2e0591));if(_0x2e0591['error']){if(_0x2e0591[_0xc40f('0xf')][_0xc40f('0x10')]===0x1f4){logger[_0xc40f('0xf')](_0xc40f('0x11'),_0x50cbb6,_0x2e0591[_0xc40f('0xf')][_0xc40f('0x12')]);return _0x207ab3(_0x2e0591[_0xc40f('0xf')]['message']);}logger['error'](_0xc40f('0x11'),_0x50cbb6,_0x2e0591[_0xc40f('0xf')]['message']);return _0x3a5087(_0x2e0591[_0xc40f('0xf')]['message']);}else{logger[_0xc40f('0xb')](_0xc40f('0x11'),_0x50cbb6,_0xc40f('0xc'));_0x3a5087(_0x2e0591[_0xc40f('0x13')][_0xc40f('0x12')]);}})[_0xc40f('0x14')](function(_0x3e693e){logger[_0xc40f('0xf')](_0xc40f('0x11'),_0x50cbb6,_0x3e693e);_0x207ab3(_0x3e693e);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 44a4988..eafae44 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0xe1ee8c,_0x2e69fd){var _0x46ee74=function(_0x5d1720){while(--_0x5d1720){_0xe1ee8c['push'](_0xe1ee8c['shift']());}};_0x46ee74(++_0x2e69fd);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x1c5142,_0x30ea72){_0x1c5142=_0x1c5142-0x0;var _0x1268cb=_0xcb91[_0x1c5142];return _0x1268cb;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x288325,_0x26e4ff){var _0x3b9fd7=function(_0x1f2816){while(--_0x1f2816){_0x288325['push'](_0x288325['shift']());}};_0x3b9fd7(++_0x26e4ff);}(_0x9c44,0x178));var _0x49c4=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x9c44[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 447b0ca..0c89dbe 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 _0x882f=['sequelize','exports','INTEGER','STRING'];(function(_0x5843eb,_0x3a389b){var _0x34fb03=function(_0x54666f){while(--_0x54666f){_0x5843eb['push'](_0x5843eb['shift']());}};_0x34fb03(++_0x3a389b);}(_0x882f,0x6c));var _0xf882=function(_0x45262e,_0x1d9c0b){_0x45262e=_0x45262e-0x0;var _0x3b7f60=_0x882f[_0x45262e];return _0x3b7f60;};'use strict';var Sequelize=require(_0xf882('0x0'));module[_0xf882('0x1')]={'penalty':{'type':Sequelize[_0xf882('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xf882('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0xf882('0x3')]}}; \ No newline at end of file +var _0x32d2=['INTEGER','STRING','sequelize','exports'];(function(_0x461ca8,_0x3bc86d){var _0x279089=function(_0x38bbf8){while(--_0x38bbf8){_0x461ca8['push'](_0x461ca8['shift']());}};_0x279089(++_0x3bc86d);}(_0x32d2,0x162));var _0x232d=function(_0x1c2a44,_0x3da922){_0x1c2a44=_0x1c2a44-0x0;var _0x23b3f4=_0x32d2[_0x1c2a44];return _0x23b3f4;};'use strict';var Sequelize=require(_0x232d('0x0'));module[_0x232d('0x1')]={'penalty':{'type':Sequelize[_0x232d('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x232d('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x232d('0x3')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 095cbba..fa02b52 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 _0x5b03=['rimraf','../../config/environment','./userFaxQueue.attributes','exports','define','user_has_fax_queues','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x35be18,_0x322cbe){var _0x471513=function(_0x5c45bd){while(--_0x5c45bd){_0x35be18['push'](_0x35be18['shift']());}};_0x471513(++_0x322cbe);}(_0x5b03,0x19e));var _0x35b0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5b03[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0x35b0('0x0'));var logger=require(_0x35b0('0x1'))('api');var moment=require(_0x35b0('0x2'));var BPromise=require(_0x35b0('0x3'));var rp=require(_0x35b0('0x4'));var fs=require('fs');var path=require(_0x35b0('0x5'));var rimraf=require(_0x35b0('0x6'));var config=require(_0x35b0('0x7'));var attributes=require(_0x35b0('0x8'));module[_0x35b0('0x9')]=function(_0x476e6d,_0x3cfd10){return _0x476e6d[_0x35b0('0xa')]('UserFaxQueue',attributes,{'tableName':_0x35b0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc95c=['util','../../config/logger','api','moment','bluebird','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue','user_has_fax_queues','lodash'];(function(_0xbf9376,_0x2787bf){var _0x4721ed=function(_0x582b1e){while(--_0x582b1e){_0xbf9376['push'](_0xbf9376['shift']());}};_0x4721ed(++_0x2787bf);}(_0xc95c,0x1bb));var _0xcc95=function(_0x42e986,_0x11b8c8){_0x42e986=_0x42e986-0x0;var _0x530cb0=_0xc95c[_0x42e986];return _0x530cb0;};'use strict';var _=require(_0xcc95('0x0'));var util=require(_0xcc95('0x1'));var logger=require(_0xcc95('0x2'))(_0xcc95('0x3'));var moment=require(_0xcc95('0x4'));var BPromise=require(_0xcc95('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcc95('0x6'));var config=require('../../config/environment');var attributes=require(_0xcc95('0x7'));module[_0xcc95('0x8')]=function(_0x528421,_0x323e43){return _0x528421[_0xcc95('0x9')](_0xcc95('0xa'),attributes,{'tableName':_0xcc95('0xb'),'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 b57a75b..9ed1342 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 _0x24bc=['info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','client','request','then'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x24bc,0x82));var _0xc24b=function(_0x451646,_0x1c6027){_0x451646=_0x451646-0x0;var _0x324e2d=_0x24bc[_0x451646];return _0x324e2d;};'use strict';var _=require(_0xc24b('0x0'));var util=require('util');var moment=require(_0xc24b('0x1'));var BPromise=require(_0xc24b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc24b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xc24b('0x4'));var logger=require(_0xc24b('0x5'))('rpc');var config=require(_0xc24b('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xc24b('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0xa264fb,_0x3e886e,_0x1cd595){return new BPromise(function(_0x1f3060,_0xc4ed84){return client[_0xc24b('0x8')](_0xa264fb,_0x1cd595)[_0xc24b('0x9')](function(_0x3dfa1f){logger[_0xc24b('0xa')](_0xc24b('0xb'),_0x3e886e,_0xc24b('0xc'));logger[_0xc24b('0xd')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x3e886e,_0xc24b('0xc'),JSON[_0xc24b('0xe')](_0x3dfa1f));if(_0x3dfa1f[_0xc24b('0xf')]){if(_0x3dfa1f[_0xc24b('0xf')][_0xc24b('0x10')]===0x1f4){logger['error'](_0xc24b('0xb'),_0x3e886e,_0x3dfa1f['error']['message']);return _0xc4ed84(_0x3dfa1f[_0xc24b('0xf')]['message']);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x3e886e,_0x3dfa1f[_0xc24b('0xf')][_0xc24b('0x11')]);return _0x1f3060(_0x3dfa1f[_0xc24b('0xf')]['message']);}else{logger[_0xc24b('0xa')](_0xc24b('0xb'),_0x3e886e,'request\x20sent');_0x1f3060(_0x3dfa1f[_0xc24b('0x12')][_0xc24b('0x11')]);}})[_0xc24b('0x13')](function(_0x55c93a){logger[_0xc24b('0xf')](_0xc24b('0xb'),_0x3e886e,_0x55c93a);_0xc4ed84(_0x55c93a);});});} \ No newline at end of file +var _0x8bfb=['http','request','then','info','UserFaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x5c618f,_0x450766){var _0x3f9cf5=function(_0x1c4a22){while(--_0x1c4a22){_0x5c618f['push'](_0x5c618f['shift']());}};_0x3f9cf5(++_0x450766);}(_0x8bfb,0x141));var _0xb8bf=function(_0x41eb67,_0x1357a9){_0x41eb67=_0x41eb67-0x0;var _0xb84fac=_0x8bfb[_0x41eb67];return _0xb84fac;};'use strict';var _=require(_0xb8bf('0x0'));var util=require(_0xb8bf('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xb8bf('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb8bf('0x3'))['db'];var utils=require(_0xb8bf('0x4'));var logger=require(_0xb8bf('0x5'))(_0xb8bf('0x6'));var config=require(_0xb8bf('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb8bf('0x8')][_0xb8bf('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1689b7,_0xc49932,_0x52ba83){return new BPromise(function(_0x80e474,_0x1a5609){return client[_0xb8bf('0xa')](_0x1689b7,_0x52ba83)[_0xb8bf('0xb')](function(_0x32a812){logger[_0xb8bf('0xc')](_0xb8bf('0xd'),_0xc49932,_0xb8bf('0xe'));logger[_0xb8bf('0xf')]('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0xc49932,_0xb8bf('0xe'),JSON[_0xb8bf('0x10')](_0x32a812));if(_0x32a812['error']){if(_0x32a812['error'][_0xb8bf('0x11')]===0x1f4){logger[_0xb8bf('0x12')](_0xb8bf('0xd'),_0xc49932,_0x32a812[_0xb8bf('0x12')][_0xb8bf('0x13')]);return _0x1a5609(_0x32a812[_0xb8bf('0x12')][_0xb8bf('0x13')]);}logger[_0xb8bf('0x12')](_0xb8bf('0xd'),_0xc49932,_0x32a812['error'][_0xb8bf('0x13')]);return _0x80e474(_0x32a812['error'][_0xb8bf('0x13')]);}else{logger[_0xb8bf('0xc')](_0xb8bf('0xd'),_0xc49932,_0xb8bf('0xe'));_0x80e474(_0x32a812[_0xb8bf('0x14')][_0xb8bf('0x13')]);}})[_0xb8bf('0x15')](function(_0x3ad8db){logger[_0xb8bf('0x12')](_0xb8bf('0xd'),_0xc49932,_0x3ad8db);_0x1a5609(_0x3ad8db);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index 62536da..62b3426 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 _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x53f4d0,_0x533fce){var _0x16cfac=function(_0x447c27){while(--_0x447c27){_0x53f4d0['push'](_0x53f4d0['shift']());}};_0x16cfac(++_0x533fce);}(_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'));module[_0x3071('0x7')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x48bb44,_0x15d56f){var _0x2c4261=function(_0x511fee){while(--_0x511fee){_0x48bb44['push'](_0x48bb44['shift']());}};_0x2c4261(++_0x15d56f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0xa9e0[_0x4b7b62];return _0x2280df;};'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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index 6a767f7..fd54826 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 _0xcc36=['exports','INTEGER','sequelize'];(function(_0x2072f4,_0x1f2f7e){var _0x330448=function(_0x27be6a){while(--_0x27be6a){_0x2072f4['push'](_0x2072f4['shift']());}};_0x330448(++_0x1f2f7e);}(_0xcc36,0x1a6));var _0x6cc3=function(_0x32ac9f,_0x5e6bbf){_0x32ac9f=_0x32ac9f-0x0;var _0x301c44=_0xcc36[_0x32ac9f];return _0x301c44;};'use strict';var Sequelize=require(_0x6cc3('0x0'));module[_0x6cc3('0x1')]={'penalty':{'type':Sequelize[_0x6cc3('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xeb83=['exports','INTEGER'];(function(_0xfaa35e,_0x4257cc){var _0x56fb8e=function(_0xc8b487){while(--_0xc8b487){_0xfaa35e['push'](_0xfaa35e['shift']());}};_0x56fb8e(++_0x4257cc);}(_0xeb83,0x1c6));var _0x3eb8=function(_0x33035e,_0x2a5475){_0x33035e=_0x33035e-0x0;var _0x3d1080=_0xeb83[_0x33035e];return _0x3d1080;};'use strict';var Sequelize=require('sequelize');module[_0x3eb8('0x0')]={'penalty':{'type':Sequelize[_0x3eb8('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 0a84e93..20abbb9 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 _0xe8e5=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','UserMailQueue'];(function(_0x1bb7a7,_0x5ee8f8){var _0x2773b3=function(_0x4274fc){while(--_0x4274fc){_0x1bb7a7['push'](_0x1bb7a7['shift']());}};_0x2773b3(++_0x5ee8f8);}(_0xe8e5,0xdc));var _0x5e8e=function(_0x440b1f,_0x27e025){_0x440b1f=_0x440b1f-0x0;var _0x3a1ede=_0xe8e5[_0x440b1f];return _0x3a1ede;};'use strict';var _=require(_0x5e8e('0x0'));var util=require(_0x5e8e('0x1'));var logger=require(_0x5e8e('0x2'))(_0x5e8e('0x3'));var moment=require(_0x5e8e('0x4'));var BPromise=require(_0x5e8e('0x5'));var rp=require(_0x5e8e('0x6'));var fs=require('fs');var path=require(_0x5e8e('0x7'));var rimraf=require(_0x5e8e('0x8'));var config=require('../../config/environment');var attributes=require('./userMailQueue.attributes');module[_0x5e8e('0x9')]=function(_0x609523,_0x694296){return _0x609523['define'](_0x5e8e('0xa'),attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9b97=['user_has_mail_queues','lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','exports','UserMailQueue'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x9b97,0xa6));var _0x79b9=function(_0x3bc59f,_0x269485){_0x3bc59f=_0x3bc59f-0x0;var _0x5d063f=_0x9b97[_0x3bc59f];return _0x5d063f;};'use strict';var _=require(_0x79b9('0x0'));var util=require(_0x79b9('0x1'));var logger=require('../../config/logger')(_0x79b9('0x2'));var moment=require(_0x79b9('0x3'));var BPromise=require(_0x79b9('0x4'));var rp=require(_0x79b9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x79b9('0x6'));var config=require(_0x79b9('0x7'));var attributes=require('./userMailQueue.attributes');module[_0x79b9('0x8')]=function(_0xcb7c8b,_0x435fb6){return _0xcb7c8b['define'](_0x79b9('0x9'),attributes,{'tableName':_0x79b9('0xa'),'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 275a234..63f2a45 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 _0x8ef6=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x3a3bfb,_0x1db365){var _0x32e890=function(_0x4373c1){while(--_0x4373c1){_0x3a3bfb['push'](_0x3a3bfb['shift']());}};_0x32e890(++_0x1db365);}(_0x8ef6,0xf2));var _0x68ef=function(_0x1340cf,_0x2c0a5e){_0x1340cf=_0x1340cf-0x0;var _0x159856=_0x8ef6[_0x1340cf];return _0x159856;};'use strict';var _=require(_0x68ef('0x0'));var util=require(_0x68ef('0x1'));var moment=require(_0x68ef('0x2'));var BPromise=require(_0x68ef('0x3'));var rs=require(_0x68ef('0x4'));var fs=require('fs');var Redis=require(_0x68ef('0x5'));var db=require(_0x68ef('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x68ef('0x7'))(_0x68ef('0x8'));var config=require(_0x68ef('0x9'));var jayson=require(_0x68ef('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3c2ff3,_0x4740e8,_0x2de776){return new BPromise(function(_0x4eb5eb,_0x228967){return client[_0x68ef('0xb')](_0x3c2ff3,_0x2de776)[_0x68ef('0xc')](function(_0x22ae26){logger[_0x68ef('0xd')](_0x68ef('0xe'),_0x4740e8,_0x68ef('0xf'));logger[_0x68ef('0x10')](_0x68ef('0x11'),_0x4740e8,_0x68ef('0xf'),JSON[_0x68ef('0x12')](_0x22ae26));if(_0x22ae26[_0x68ef('0x13')]){if(_0x22ae26['error'][_0x68ef('0x14')]===0x1f4){logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);return _0x228967(_0x22ae26[_0x68ef('0x13')]['message']);}logger[_0x68ef('0x13')](_0x68ef('0xe'),_0x4740e8,_0x22ae26[_0x68ef('0x13')]['message']);return _0x4eb5eb(_0x22ae26[_0x68ef('0x13')][_0x68ef('0x15')]);}else{logger[_0x68ef('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x68ef('0xf'));_0x4eb5eb(_0x22ae26[_0x68ef('0x16')][_0x68ef('0x15')]);}})[_0x68ef('0x17')](function(_0x5c4456){logger[_0x68ef('0x13')]('UserMailQueue,\x20%s,\x20%s',_0x4740e8,_0x5c4456);_0x228967(_0x5c4456);});});} \ No newline at end of file +var _0x6aa7=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','UserMailQueue,\x20%s,\x20%s','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x2d7369,_0xc3f411){var _0x3e0359=function(_0xa1b572){while(--_0xa1b572){_0x2d7369['push'](_0x2d7369['shift']());}};_0x3e0359(++_0xc3f411);}(_0x6aa7,0x178));var _0x76aa=function(_0x31f2e4,_0x340804){_0x31f2e4=_0x31f2e4-0x0;var _0x206316=_0x6aa7[_0x31f2e4];return _0x206316;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index 263c089..552392e 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 _0xa624=['../../config/environment','./userNotification.controller','sendUserNotification','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x3af955,_0x21431c){var _0x167de5=function(_0x78879c){while(--_0x78879c){_0x3af955['push'](_0x3af955['shift']());}};_0x167de5(++_0x21431c);}(_0xa624,0x143));var _0x4a62=function(_0x492535,_0x46524a){_0x492535=_0x492535-0x0;var _0x256620=_0xa624[_0x492535];return _0x256620;};'use strict';var multer=require(_0x4a62('0x0'));var util=require('util');var path=require(_0x4a62('0x1'));var timeout=require(_0x4a62('0x2'));var express=require(_0x4a62('0x3'));var router=express[_0x4a62('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4a62('0x5'));var interaction=require(_0x4a62('0x6'));var config=require(_0x4a62('0x7'));var controller=require(_0x4a62('0x8'));router['post']('/',auth['isAuthenticated'](),controller[_0x4a62('0x9')]);module[_0x4a62('0xa')]=router; \ No newline at end of file +var _0x1fd9=['post','sendUserNotification','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userNotification.controller'];(function(_0xfcdda0,_0x32479b){var _0x17ebe3=function(_0x5bfaa3){while(--_0x5bfaa3){_0xfcdda0['push'](_0xfcdda0['shift']());}};_0x17ebe3(++_0x32479b);}(_0x1fd9,0xc2));var _0x91fd=function(_0x5bcc58,_0x218d5a){_0x5bcc58=_0x5bcc58-0x0;var _0x5d3d83=_0x1fd9[_0x5bcc58];return _0x5d3d83;};'use strict';var multer=require('multer');var util=require(_0x91fd('0x0'));var path=require(_0x91fd('0x1'));var timeout=require(_0x91fd('0x2'));var express=require(_0x91fd('0x3'));var router=express[_0x91fd('0x4')]();var fs_extra=require(_0x91fd('0x5'));var auth=require(_0x91fd('0x6'));var interaction=require(_0x91fd('0x7'));var config=require(_0x91fd('0x8'));var controller=require(_0x91fd('0x9'));router[_0x91fd('0xa')]('/',auth['isAuthenticated'](),controller[_0x91fd('0xb')]);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 053dd58..0240f70 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 _0xecca=['BOOLEAN','TEXT','STRING'];(function(_0x4d2e78,_0x20648a){var _0x55fe87=function(_0x5f1dd1){while(--_0x5f1dd1){_0x4d2e78['push'](_0x4d2e78['shift']());}};_0x55fe87(++_0x20648a);}(_0xecca,0x67));var _0xaecc=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xecca[_0x2ec461];return _0x28603d;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0xaecc('0x0')]},'senderName':{'type':Sequelize[_0xaecc('0x1')]},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize[_0xaecc('0x1')]},'beep':{'type':Sequelize[_0xaecc('0x2')]}}; \ No newline at end of file +var _0xd7f2=['BOOLEAN','sequelize','exports'];(function(_0xc7951e,_0x2a7c2b){var _0x4f9cea=function(_0x1678c4){while(--_0x1678c4){_0xc7951e['push'](_0xc7951e['shift']());}};_0x4f9cea(++_0x2a7c2b);}(_0xd7f2,0x9a));var _0x2d7f=function(_0x19066e,_0xd619f5){_0x19066e=_0x19066e-0x0;var _0x31f046=_0xd7f2[_0x19066e];return _0x31f046;};'use strict';var Sequelize=require(_0x2d7f('0x0'));module[_0x2d7f('0x1')]={'body':{'type':Sequelize['TEXT']},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize['TEXT']},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x2d7f('0x2')]}}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.controller.js b/server/api/userNotification/userNotification.controller.js index af9afd1..7dccfa1 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 _0x2e93=['recipients','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','openchannelqueue','smsqueue','voicequeue','whatsappqueue','team','some','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','join','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','text','Template','findOne','Invalid\x20\x27TemplateId\x27\x20parameter','render','html','startCase','User','union','includes','queue','replace','push','all','getAgents','map','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','squel','crypto','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','sendStatus','send','body','hasOwnProperty','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter'];(function(_0xbfa681,_0x206602){var _0x5504ce=function(_0x442f8a){while(--_0x442f8a){_0xbfa681['push'](_0xbfa681['shift']());}};_0x5504ce(++_0x206602);}(_0x2e93,0x95));var _0x32e9=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2e93[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x32e9('0x0'));var rimraf=require(_0x32e9('0x1'));var zipdir=require(_0x32e9('0x2'));var jsonpatch=require(_0x32e9('0x3'));var rp=require('request-promise');var moment=require(_0x32e9('0x4'));var BPromise=require(_0x32e9('0x5'));var Mustache=require(_0x32e9('0x6'));var util=require(_0x32e9('0x7'));var path=require('path');var sox=require(_0x32e9('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(_0x32e9('0x9'));var crypto=require(_0x32e9('0xa'));var jsforce=require(_0x32e9('0xb'));var deskjs=require(_0x32e9('0xc'));var toCsv=require(_0x32e9('0xd'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x32e9('0xe'));var authService=require(_0x32e9('0xf'));var qs=require(_0x32e9('0x10'));var as=require(_0x32e9('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x32e9('0x12'))('api');var utils=require(_0x32e9('0x13'));var config=require(_0x32e9('0x14'));var licenseUtil=require(_0x32e9('0x15'));var db=require(_0x32e9('0x16'))['db'];config[_0x32e9('0x17')]=_[_0x32e9('0x18')](config[_0x32e9('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x32e9('0x19'))(new Redis(config[_0x32e9('0x17')]));require(_0x32e9('0x1a'))[_0x32e9('0x1b')](socket);function respondWithStatusCode(_0x14ec22,_0x5c98e4){_0x5c98e4=_0x5c98e4||0xcc;return function(_0x481076){if(_0x481076){return _0x14ec22['sendStatus'](_0x5c98e4);}return _0x14ec22[_0x32e9('0x1c')](_0x5c98e4)[_0x32e9('0x1d')]();};}function respondWithResult(_0x451f2d,_0x58be4c){_0x58be4c=_0x58be4c||0xc8;return function(_0x53df19){if(_0x53df19){return _0x451f2d[_0x32e9('0x1c')](_0x58be4c)[_0x32e9('0x1e')](_0x53df19);}};}function respondWithFilteredResult(_0x3a0635,_0x5e7b2b){return function(_0x147369){if(_0x147369){var _0x52fa13=typeof _0x5e7b2b[_0x32e9('0x1f')]===_0x32e9('0x20')&&typeof _0x5e7b2b[_0x32e9('0x21')]===_0x32e9('0x20');var _0x423d0e=_0x147369[_0x32e9('0x22')];var _0x95a3ab=_0x52fa13?0x0:_0x5e7b2b[_0x32e9('0x1f')];var _0x1949a2=_0x52fa13?_0x147369[_0x32e9('0x22')]:_0x5e7b2b['offset']+_0x5e7b2b[_0x32e9('0x21')];var _0x63f739;if(_0x1949a2>=_0x423d0e){_0x1949a2=_0x423d0e;_0x63f739=0xc8;}else{_0x63f739=0xce;}_0x3a0635[_0x32e9('0x1c')](_0x63f739);return _0x3a0635['set'](_0x32e9('0x23'),_0x95a3ab+'-'+_0x1949a2+'/'+_0x423d0e)[_0x32e9('0x1e')](_0x147369);}return null;};}function patchUpdates(_0x527497){return function(_0x2046ce){try{jsonpatch['apply'](_0x2046ce,_0x527497,!![]);}catch(_0x124c0f){return BPromise[_0x32e9('0x24')](_0x124c0f);}return _0x2046ce[_0x32e9('0x25')]();};}function saveUpdates(_0x3476a6,_0x4b5e7f){return function(_0x45932c){if(_0x45932c){return _0x45932c[_0x32e9('0x26')](_0x3476a6)[_0x32e9('0x27')](function(_0x12eb39){return _0x12eb39;});}return null;};}function removeEntity(_0x592457,_0x58941e){return function(_0x801901){if(_0x801901){return _0x801901[_0x32e9('0x28')]()[_0x32e9('0x27')](function(){_0x592457[_0x32e9('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x8f3fda,_0x46ecde){return function(_0x146f06){if(!_0x146f06){_0x8f3fda[_0x32e9('0x29')](0x194);}return _0x146f06;};}function handleError(_0x1a95ca,_0x319e9d){_0x319e9d=_0x319e9d||0x1f4;return function(_0x4eef11){logger['error'](_0x4eef11['stack']);if(_0x4eef11['name']){delete _0x4eef11['name'];}_0x1a95ca[_0x32e9('0x1c')](_0x319e9d)[_0x32e9('0x2a')](_0x4eef11);};}exports['sendUserNotification']=function(_0x2105af,_0x10120e,_0xd4cd88){if(!_0x2105af[_0x32e9('0x2b')][_0x32e9('0x2c')]('text')&&!_0x2105af[_0x32e9('0x2b')][_0x32e9('0x2c')](_0x32e9('0x2d'))){throw new db[(_0x32e9('0x2e'))][(_0x32e9('0x2f'))](_0x32e9('0x30'));}else{if(_0x2105af[_0x32e9('0x2b')][_0x32e9('0x2c')](_0x32e9('0x2d'))&&!_0x2105af[_0x32e9('0x2b')][_0x32e9('0x2c')](_0x32e9('0x31'))){throw new db[(_0x32e9('0x2e'))][(_0x32e9('0x2f'))](_0x32e9('0x32'));}if(!_0x2105af[_0x32e9('0x2b')][_0x32e9('0x2c')](_0x32e9('0x33'))){throw new db[(_0x32e9('0x2e'))]['ValidationError']('Missing\x20\x27recipients\x27\x20parameter');}else{try{var _0x30b73a=JSON['parse'](_0x2105af[_0x32e9('0x2b')][_0x32e9('0x33')]);}catch(_0x3feed0){logger[_0x32e9('0x34')](_0x3feed0);throw new db[(_0x32e9('0x2e'))][(_0x32e9('0x2f'))](_0x32e9('0x35'));}var _0x5e34c8=[_0x32e9('0x36'),_0x32e9('0x37'),_0x32e9('0x38'),_0x32e9('0x39'),_0x32e9('0x3a'),_0x32e9('0x3b'),_0x32e9('0x3c'),_0x32e9('0x3d'),'user'];if(_[_0x32e9('0x3e')](_0x30b73a,function(_0xfd25d3){return!_['includes'](_0x5e34c8,_0xfd25d3[_0x32e9('0x3f')][_0x32e9('0x40')]());})){throw new db[(_0x32e9('0x2e'))]['ValidationError'](_0x32e9('0x41'));}}}var _0x4ee6ef={};_0x4ee6ef['senderName']=_0x2105af[_0x32e9('0x2b')]['hasOwnProperty'](_0x32e9('0x42'))?_0x2105af[_0x32e9('0x2b')][_0x32e9('0x42')]:_0x2105af[_0x32e9('0x43')][_0x32e9('0x44')];_0x4ee6ef[_0x32e9('0x45')]=_[_0x32e9('0x46')](_0x2105af[_0x32e9('0x2b')][_0x32e9('0x45')])?null:_0x2105af[_0x32e9('0x2b')]['recipientsDescription'];_0x4ee6ef[_0x32e9('0x47')]=_0x2105af[_0x32e9('0x2b')][_0x32e9('0x47')]||![];_0x4ee6ef[_0x32e9('0x48')]=_0x2105af[_0x32e9('0x43')]['id'];return getContent(_0x2105af[_0x32e9('0x2b')])['then'](function(_0x58d0fa){_0x4ee6ef[_0x32e9('0x2b')]=_0x58d0fa;return getRecipients(_0x30b73a);})[_0x32e9('0x27')](function(_0x17b955){_0x4ee6ef[_0x32e9('0x49')]=_[_0x32e9('0x4a')](_0x17b955)[_0x32e9('0x4b')](',');return db['sequelize'][_0x32e9('0x4c')](function(_0x28d642){return db[_0x32e9('0x4d')][_0x32e9('0x4e')](_0x4ee6ef,{'raw':!![],'transaction':_0x28d642})['then'](function(_0x603a1d){var _0x4c7aaa={'sender':_0x4ee6ef['senderName'],'description':_0x4ee6ef['recipientsDescription'],'content':_0x4ee6ef['body'],'beep':_0x4ee6ef[_0x32e9('0x47')]};_0x17b955[_0x32e9('0x4f')](function(_0x4d3573){_0x4c7aaa[_0x32e9('0x50')]=_0x4d3573;socket[_0x32e9('0x51')](_0x32e9('0x52'),_0x4c7aaa);});return _0x603a1d;});});})['then'](respondWithResult(_0x10120e,0xc9))[_0x32e9('0x53')](handleError(_0x10120e,null));};function getContent(_0x25e7d8){return new BPromise(function(_0x2b1876,_0x3372a7){if(_0x25e7d8[_0x32e9('0x54')]){_0x2b1876(_0x25e7d8[_0x32e9('0x54')]);return;}return db[_0x32e9('0x55')][_0x32e9('0x56')]({'attributes':['html'],'where':{'id':_0x25e7d8[_0x32e9('0x2d')]},'raw':!![]})[_0x32e9('0x27')](function(_0xe2c833){if(!_0xe2c833)throw new db[(_0x32e9('0x2e'))][(_0x32e9('0x2f'))](_0x32e9('0x57'));var _0xee103d=Mustache[_0x32e9('0x58')](_0xe2c833[_0x32e9('0x59')],_0x25e7d8[_0x32e9('0x31')]);_0x2b1876(_0xee103d);})['catch'](function(_0x41d7ab){_0x3372a7(_0x41d7ab);});});}function getRecipients(_0x30a5d9){return new BPromise(function(_0x4161e8,_0x4207e6){var _0x3335f4=[];var _0x4e96a8=[];_0x30a5d9['forEach'](function(_0x4bf9cc){var _0x5beae2=_[_0x32e9('0x5a')](_0x4bf9cc[_0x32e9('0x3f')][_0x32e9('0x40')]());if(_0x5beae2===_0x32e9('0x5b')){_0x3335f4=_[_0x32e9('0x5c')](_0x3335f4,_0x4bf9cc['ids']);}else{if(_[_0x32e9('0x5d')](_0x5beae2,_0x32e9('0x5e')))_0x5beae2=_0x5beae2[_0x32e9('0x5f')](_0x32e9('0x5e'),'Queue');_0x4bf9cc['ids'][_0x32e9('0x4f')](function(_0x3c3476){_0x4e96a8[_0x32e9('0x60')](getAgents(_0x5beae2,_0x3c3476));});}});return BPromise[_0x32e9('0x61')](_0x4e96a8)[_0x32e9('0x27')](function(_0x36004a){_0x3335f4=_[_0x32e9('0x5c')](_0x3335f4,_['flatten'](_0x36004a));_0x4161e8(_0x3335f4);})[_0x32e9('0x53')](function(_0x294992){_0x4207e6(_0x294992);});});}function getAgents(_0x4c65de,_0x3f8fe4){return new BPromise(function(_0x558997,_0x145430){return db[_0x4c65de][_0x32e9('0x56')]({'where':{'id':_0x3f8fe4}})[_0x32e9('0x27')](function(_0x5a4a9a){return _0x5a4a9a[_0x32e9('0x62')]({'attributes':['id'],'raw':!![]})[_0x32e9('0x27')](function(_0x24653a){var _0x5f5705=_[_0x32e9('0x63')](_0x24653a,'id');_0x558997(_0x5f5705);});})[_0x32e9('0x53')](function(_0x4ec746){_0x145430(_0x4ec746);});});} \ No newline at end of file +var _0x53c2=['recipientsDescription','beep','recipientsId','sortBy','join','UserNotification','create','recipient','userNotification:send','catch','text','Template','html','forEach','startCase','model','User','union','queue','Queue','push','all','findOne','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','path','sox','to-csv','ejs','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./userNotification.socket','register','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','then','name','send','hasOwnProperty','body','TemplateId','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','Sequelize','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','faxqueue','mailqueue','smsqueue','voicequeue','team','some','includes','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','user','fullname','isEmpty'];(function(_0x2b1161,_0x509b08){var _0x140c60=function(_0xd36bcb){while(--_0xd36bcb){_0x2b1161['push'](_0x2b1161['shift']());}};_0x140c60(++_0x509b08);}(_0x53c2,0x1df));var _0x253c=function(_0x2fd3b8,_0x2c78b9){_0x2fd3b8=_0x2fd3b8-0x0;var _0x3ca404=_0x53c2[_0x2fd3b8];return _0x3ca404;};'use strict';var emlformat=require(_0x253c('0x0'));var rimraf=require(_0x253c('0x1'));var zipdir=require(_0x253c('0x2'));var jsonpatch=require(_0x253c('0x3'));var rp=require('request-promise');var moment=require(_0x253c('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x253c('0x5'));var sox=require(_0x253c('0x6'));var csv=require(_0x253c('0x7'));var ejs=require(_0x253c('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x253c('0x9'));var squel=require(_0x253c('0xa'));var crypto=require('crypto');var jsforce=require(_0x253c('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x253c('0x7'));var querystring=require(_0x253c('0xc'));var Papa=require(_0x253c('0xd'));var Redis=require(_0x253c('0xe'));var authService=require(_0x253c('0xf'));var qs=require(_0x253c('0x10'));var as=require(_0x253c('0x11'));var hardwareService=require(_0x253c('0x12'));var logger=require(_0x253c('0x13'))(_0x253c('0x14'));var utils=require('../../config/utils');var config=require(_0x253c('0x15'));var licenseUtil=require(_0x253c('0x16'));var db=require(_0x253c('0x17'))['db'];config[_0x253c('0x18')]=_[_0x253c('0x19')](config[_0x253c('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x253c('0x1a'))(new Redis(config['redis']));require(_0x253c('0x1b'))[_0x253c('0x1c')](socket);function respondWithStatusCode(_0x5837d1,_0x26d243){_0x26d243=_0x26d243||0xcc;return function(_0x5ad556){if(_0x5ad556){return _0x5837d1[_0x253c('0x1d')](_0x26d243);}return _0x5837d1[_0x253c('0x1e')](_0x26d243)[_0x253c('0x1f')]();};}function respondWithResult(_0x3c1758,_0x242693){_0x242693=_0x242693||0xc8;return function(_0x33f2c6){if(_0x33f2c6){return _0x3c1758['status'](_0x242693)[_0x253c('0x20')](_0x33f2c6);}};}function respondWithFilteredResult(_0x265655,_0x4649b9){return function(_0x38f0cd){if(_0x38f0cd){var _0x182a31=typeof _0x4649b9['offset']===_0x253c('0x21')&&typeof _0x4649b9['limit']===_0x253c('0x21');var _0x31d0a1=_0x38f0cd[_0x253c('0x22')];var _0x4c4027=_0x182a31?0x0:_0x4649b9[_0x253c('0x23')];var _0x488e52=_0x182a31?_0x38f0cd[_0x253c('0x22')]:_0x4649b9[_0x253c('0x23')]+_0x4649b9[_0x253c('0x24')];var _0x3fd827;if(_0x488e52>=_0x31d0a1){_0x488e52=_0x31d0a1;_0x3fd827=0xc8;}else{_0x3fd827=0xce;}_0x265655[_0x253c('0x1e')](_0x3fd827);return _0x265655[_0x253c('0x25')](_0x253c('0x26'),_0x4c4027+'-'+_0x488e52+'/'+_0x31d0a1)['json'](_0x38f0cd);}return null;};}function patchUpdates(_0x3b42e7){return function(_0x269606){try{jsonpatch[_0x253c('0x27')](_0x269606,_0x3b42e7,!![]);}catch(_0x12af32){return BPromise['reject'](_0x12af32);}return _0x269606['save']();};}function saveUpdates(_0x5e778f,_0x1f2612){return function(_0x1c5433){if(_0x1c5433){return _0x1c5433['update'](_0x5e778f)[_0x253c('0x28')](function(_0x1ff203){return _0x1ff203;});}return null;};}function removeEntity(_0x4871ca,_0x42b3a2){return function(_0x228582){if(_0x228582){return _0x228582['destroy']()[_0x253c('0x28')](function(){_0x4871ca[_0x253c('0x1e')](0xcc)[_0x253c('0x1f')]();});}};}function handleEntityNotFound(_0x155f94,_0x5a3cf1){return function(_0x21def6){if(!_0x21def6){_0x155f94[_0x253c('0x1d')](0x194);}return _0x21def6;};}function handleError(_0x443666,_0x371aa3){_0x371aa3=_0x371aa3||0x1f4;return function(_0x1ee632){logger['error'](_0x1ee632['stack']);if(_0x1ee632[_0x253c('0x29')]){delete _0x1ee632['name'];}_0x443666['status'](_0x371aa3)[_0x253c('0x2a')](_0x1ee632);};}exports['sendUserNotification']=function(_0x590be2,_0x4fa1fc,_0x119305){if(!_0x590be2['body'][_0x253c('0x2b')]('text')&&!_0x590be2[_0x253c('0x2c')][_0x253c('0x2b')](_0x253c('0x2d'))){throw new db['Sequelize'][(_0x253c('0x2e'))](_0x253c('0x2f'));}else{if(_0x590be2[_0x253c('0x2c')][_0x253c('0x2b')](_0x253c('0x2d'))&&!_0x590be2[_0x253c('0x2c')][_0x253c('0x2b')]('view')){throw new db[(_0x253c('0x30'))][(_0x253c('0x2e'))](_0x253c('0x31'));}if(!_0x590be2['body'][_0x253c('0x2b')](_0x253c('0x32'))){throw new db['Sequelize']['ValidationError'](_0x253c('0x33'));}else{try{var _0x4b8aee=JSON[_0x253c('0x34')](_0x590be2[_0x253c('0x2c')]['recipients']);}catch(_0x42ef65){logger[_0x253c('0x35')](_0x42ef65);throw new db[(_0x253c('0x30'))][(_0x253c('0x2e'))](_0x253c('0x36'));}var _0x3e3c74=['chatqueue',_0x253c('0x37'),_0x253c('0x38'),'openchannelqueue',_0x253c('0x39'),_0x253c('0x3a'),'whatsappqueue',_0x253c('0x3b'),'user'];if(_[_0x253c('0x3c')](_0x4b8aee,function(_0x2cf460){return!_[_0x253c('0x3d')](_0x3e3c74,_0x2cf460['model']['toLowerCase']());})){throw new db[(_0x253c('0x30'))][(_0x253c('0x2e'))](_0x253c('0x3e'));}}}var _0x5f2595={};_0x5f2595[_0x253c('0x3f')]=_0x590be2[_0x253c('0x2c')][_0x253c('0x2b')]('senderName')?_0x590be2[_0x253c('0x2c')][_0x253c('0x3f')]:_0x590be2[_0x253c('0x40')][_0x253c('0x41')];_0x5f2595['recipientsDescription']=_[_0x253c('0x42')](_0x590be2[_0x253c('0x2c')]['recipientsDescription'])?null:_0x590be2['body'][_0x253c('0x43')];_0x5f2595[_0x253c('0x44')]=_0x590be2[_0x253c('0x2c')][_0x253c('0x44')]||![];_0x5f2595['SenderId']=_0x590be2[_0x253c('0x40')]['id'];return getContent(_0x590be2['body'])[_0x253c('0x28')](function(_0x139818){_0x5f2595['body']=_0x139818;return getRecipients(_0x4b8aee);})[_0x253c('0x28')](function(_0x30caf3){_0x5f2595[_0x253c('0x45')]=_[_0x253c('0x46')](_0x30caf3)[_0x253c('0x47')](',');return db['sequelize']['transaction'](function(_0x252143){return db[_0x253c('0x48')][_0x253c('0x49')](_0x5f2595,{'raw':!![],'transaction':_0x252143})['then'](function(_0x23e88c){var _0x4853d9={'sender':_0x5f2595[_0x253c('0x3f')],'description':_0x5f2595[_0x253c('0x43')],'content':_0x5f2595['body'],'beep':_0x5f2595[_0x253c('0x44')]};_0x30caf3['forEach'](function(_0x21b73c){_0x4853d9[_0x253c('0x4a')]=_0x21b73c;socket['emit'](_0x253c('0x4b'),_0x4853d9);});return _0x23e88c;});});})[_0x253c('0x28')](respondWithResult(_0x4fa1fc,0xc9))[_0x253c('0x4c')](handleError(_0x4fa1fc,null));};function getContent(_0x9165a6){return new BPromise(function(_0x32a5d5,_0x4c165a){if(_0x9165a6[_0x253c('0x4d')]){_0x32a5d5(_0x9165a6['text']);return;}return db[_0x253c('0x4e')]['findOne']({'attributes':[_0x253c('0x4f')],'where':{'id':_0x9165a6[_0x253c('0x2d')]},'raw':!![]})[_0x253c('0x28')](function(_0x1bb51d){if(!_0x1bb51d)throw new db[(_0x253c('0x30'))][(_0x253c('0x2e'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x109f65=Mustache['render'](_0x1bb51d['html'],_0x9165a6['view']);_0x32a5d5(_0x109f65);})[_0x253c('0x4c')](function(_0x32abb2){_0x4c165a(_0x32abb2);});});}function getRecipients(_0x1c2d49){return new BPromise(function(_0x161b00,_0x31133c){var _0x379ef6=[];var _0x5cf8f5=[];_0x1c2d49[_0x253c('0x50')](function(_0x5a06a4){var _0x3ee690=_[_0x253c('0x51')](_0x5a06a4[_0x253c('0x52')]['toLowerCase']());if(_0x3ee690===_0x253c('0x53')){_0x379ef6=_[_0x253c('0x54')](_0x379ef6,_0x5a06a4['ids']);}else{if(_[_0x253c('0x3d')](_0x3ee690,_0x253c('0x55')))_0x3ee690=_0x3ee690['replace'](_0x253c('0x55'),_0x253c('0x56'));_0x5a06a4['ids'][_0x253c('0x50')](function(_0x427620){_0x5cf8f5[_0x253c('0x57')](getAgents(_0x3ee690,_0x427620));});}});return BPromise[_0x253c('0x58')](_0x5cf8f5)['then'](function(_0x13ce70){_0x379ef6=_[_0x253c('0x54')](_0x379ef6,_['flatten'](_0x13ce70));_0x161b00(_0x379ef6);})['catch'](function(_0x18181b){_0x31133c(_0x18181b);});});}function getAgents(_0x30591c,_0x5c568d){return new BPromise(function(_0x196179,_0x81aa5){return db[_0x30591c][_0x253c('0x59')]({'where':{'id':_0x5c568d}})[_0x253c('0x28')](function(_0x29aa85){return _0x29aa85[_0x253c('0x5a')]({'attributes':['id'],'raw':!![]})[_0x253c('0x28')](function(_0x2cf0a4){var _0x31f605=_['map'](_0x2cf0a4,'id');_0x196179(_0x31f605);});})[_0x253c('0x4c')](function(_0xa5df53){_0x81aa5(_0xa5df53);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index ac4eea9..57e5b82 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 _0x1532=['UserNotification','setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','../../mysqldb'];(function(_0x362eaa,_0x2e3d02){var _0x46590=function(_0x18c79d){while(--_0x18c79d){_0x362eaa['push'](_0x362eaa['shift']());}};_0x46590(++_0x2e3d02);}(_0x1532,0x11e));var _0x2153=function(_0x26d5db,_0x205da8){_0x26d5db=_0x26d5db-0x0;var _0x172e54=_0x1532[_0x26d5db];return _0x172e54;};'use strict';var EventEmitter=require(_0x2153('0x0'));var UserNotification=require(_0x2153('0x1'))['db'][_0x2153('0x2')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x2153('0x3')](0x0);var events={'afterCreate':_0x2153('0x4'),'afterUpdate':'update','afterDestroy':_0x2153('0x5')};function emitEvent(_0x1452d0){return function(_0xa469fe,_0x41adef,_0x12871){UserNotificationEvents[_0x2153('0x6')](_0x1452d0+':'+_0xa469fe['id'],_0xa469fe);UserNotificationEvents[_0x2153('0x6')](_0x1452d0,_0xa469fe);_0x12871(null);};}for(var e in events){if(events[_0x2153('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0x2153('0x8')]=UserNotificationEvents; \ No newline at end of file +var _0x49aa=['events','../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x1fb710,_0x1a1bed){var _0xc217df=function(_0x1f9b79){while(--_0x1f9b79){_0x1fb710['push'](_0x1fb710['shift']());}};_0xc217df(++_0x1a1bed);}(_0x49aa,0x1c2));var _0xa49a=function(_0x2a6d18,_0x7382c7){_0x2a6d18=_0x2a6d18-0x0;var _0x41c9bd=_0x49aa[_0x2a6d18];return _0x41c9bd;};'use strict';var EventEmitter=require(_0xa49a('0x0'));var UserNotification=require(_0xa49a('0x1'))['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0xa49a('0x2')](0x0);var events={'afterCreate':_0xa49a('0x3'),'afterUpdate':_0xa49a('0x4'),'afterDestroy':_0xa49a('0x5')};function emitEvent(_0x2b4f5d){return function(_0x3ab065,_0x1403e5,_0x56d710){UserNotificationEvents[_0xa49a('0x6')](_0x2b4f5d+':'+_0x3ab065['id'],_0x3ab065);UserNotificationEvents[_0xa49a('0x6')](_0x2b4f5d,_0x3ab065);_0x56d710(null);};}for(var e in events){if(events[_0xa49a('0x7')](e)){var event=events[e];UserNotification['hook'](e,emitEvent(event));}}module[_0xa49a('0x8')]=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 9932a9f..69cfb80 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 _0x944f=['exports','define','UserNotification','userNotifications','utf8mb4_unicode_ci','lodash','api','moment','bluebird','request-promise','rimraf','../../config/environment'];(function(_0x310ca4,_0x195e91){var _0x303c6f=function(_0x53dbf2){while(--_0x53dbf2){_0x310ca4['push'](_0x310ca4['shift']());}};_0x303c6f(++_0x195e91);}(_0x944f,0x65));var _0xf944=function(_0x5c19d8,_0x10e7aa){_0x5c19d8=_0x5c19d8-0x0;var _0x558708=_0x944f[_0x5c19d8];return _0x558708;};'use strict';var _=require(_0xf944('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xf944('0x1'));var moment=require(_0xf944('0x2'));var BPromise=require(_0xf944('0x3'));var rp=require(_0xf944('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf944('0x5'));var config=require(_0xf944('0x6'));var attributes=require('./userNotification.attributes');module[_0xf944('0x7')]=function(_0x318612,_0x390455){return _0x318612[_0xf944('0x8')](_0xf944('0x9'),attributes,{'tableName':_0xf944('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0xf944('0xb')});}; \ No newline at end of file +var _0x1f90=['utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userNotification.attributes','exports','define','UserNotification','userNotifications'];(function(_0x4e2e14,_0x3914c5){var _0x4248b1=function(_0x39e555){while(--_0x39e555){_0x4e2e14['push'](_0x4e2e14['shift']());}};_0x4248b1(++_0x3914c5);}(_0x1f90,0xb6));var _0x01f9=function(_0x26dda0,_0x5b58ab){_0x26dda0=_0x26dda0-0x0;var _0x41089c=_0x1f90[_0x26dda0];return _0x41089c;};'use strict';var _=require(_0x01f9('0x0'));var util=require('util');var logger=require(_0x01f9('0x1'))('api');var moment=require(_0x01f9('0x2'));var BPromise=require(_0x01f9('0x3'));var rp=require(_0x01f9('0x4'));var fs=require('fs');var path=require(_0x01f9('0x5'));var rimraf=require(_0x01f9('0x6'));var config=require(_0x01f9('0x7'));var attributes=require(_0x01f9('0x8'));module[_0x01f9('0x9')]=function(_0x556c07,_0x4b6355){return _0x556c07[_0x01f9('0xa')](_0x01f9('0xb'),attributes,{'tableName':_0x01f9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x01f9('0xd'),'collate':_0x01f9('0xe')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 7a5e874..ff573c1 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 _0xee90=['util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch'];(function(_0xbda849,_0x2dcb1a){var _0x2d3e9d=function(_0x2c8f10){while(--_0x2c8f10){_0xbda849['push'](_0xbda849['shift']());}};_0x2d3e9d(++_0x2dcb1a);}(_0xee90,0x177));var _0x0ee9=function(_0x4be64f,_0x35c983){_0x4be64f=_0x4be64f-0x0;var _0x370f5a=_0xee90[_0x4be64f];return _0x370f5a;};'use strict';var _=require('lodash');var util=require(_0x0ee9('0x0'));var moment=require(_0x0ee9('0x1'));var BPromise=require(_0x0ee9('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0ee9('0x3'));var db=require(_0x0ee9('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0ee9('0x5'))(_0x0ee9('0x6'));var config=require('../../config/environment');var jayson=require(_0x0ee9('0x7'));var client=jayson[_0x0ee9('0x8')][_0x0ee9('0x9')]({'port':0x232a});config[_0x0ee9('0xa')]=_[_0x0ee9('0xb')](config[_0x0ee9('0xa')],{'host':_0x0ee9('0xc'),'port':0x18eb});var socket=require(_0x0ee9('0xd'))(new Redis(config[_0x0ee9('0xa')]));require(_0x0ee9('0xe'))[_0x0ee9('0xf')](socket);function respondWithRpcPromise(_0x13a511,_0x3acbe2,_0x199ff2){return new BPromise(function(_0x38b629,_0x37b8dc){return client['request'](_0x13a511,_0x199ff2)['then'](function(_0x5c8981){logger[_0x0ee9('0x10')](_0x0ee9('0x11'),_0x3acbe2,_0x0ee9('0x12'));logger[_0x0ee9('0x13')]('UserNotification,\x20%s,\x20%s,\x20%s',_0x3acbe2,'request\x20sent',JSON[_0x0ee9('0x14')](_0x5c8981));if(_0x5c8981[_0x0ee9('0x15')]){if(_0x5c8981[_0x0ee9('0x15')][_0x0ee9('0x16')]===0x1f4){logger[_0x0ee9('0x15')](_0x0ee9('0x11'),_0x3acbe2,_0x5c8981[_0x0ee9('0x15')][_0x0ee9('0x17')]);return _0x37b8dc(_0x5c8981[_0x0ee9('0x15')][_0x0ee9('0x17')]);}logger['error'](_0x0ee9('0x11'),_0x3acbe2,_0x5c8981[_0x0ee9('0x15')][_0x0ee9('0x17')]);return _0x38b629(_0x5c8981['error'][_0x0ee9('0x17')]);}else{logger['info']('UserNotification,\x20%s,\x20%s',_0x3acbe2,'request\x20sent');_0x38b629(_0x5c8981['result'][_0x0ee9('0x17')]);}})[_0x0ee9('0x18')](function(_0x152a7c){logger[_0x0ee9('0x15')](_0x0ee9('0x11'),_0x3acbe2,_0x152a7c);_0x37b8dc(_0x152a7c);});});} \ No newline at end of file +var _0xb2fb=['error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','./userNotification.socket','request','then','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xb2fb,0x91));var _0xbb2f=function(_0x167fb4,_0x4955de){_0x167fb4=_0x167fb4-0x0;var _0x51a385=_0xb2fb[_0x167fb4];return _0x51a385;};'use strict';var _=require(_0xbb2f('0x0'));var util=require(_0xbb2f('0x1'));var moment=require(_0xbb2f('0x2'));var BPromise=require(_0xbb2f('0x3'));var rs=require(_0xbb2f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb2f('0x5'))['db'];var utils=require(_0xbb2f('0x6'));var logger=require(_0xbb2f('0x7'))(_0xbb2f('0x8'));var config=require(_0xbb2f('0x9'));var jayson=require(_0xbb2f('0xa'));var client=jayson[_0xbb2f('0xb')]['http']({'port':0x232a});config['redis']=_[_0xbb2f('0xc')](config[_0xbb2f('0xd')],{'host':_0xbb2f('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbb2f('0xd')]));require(_0xbb2f('0xf'))['register'](socket);function respondWithRpcPromise(_0x467bc3,_0x374747,_0x490151){return new BPromise(function(_0x173a76,_0x196389){return client[_0xbb2f('0x10')](_0x467bc3,_0x490151)[_0xbb2f('0x11')](function(_0x3d25f1){logger['info'](_0xbb2f('0x12'),_0x374747,_0xbb2f('0x13'));logger[_0xbb2f('0x14')](_0xbb2f('0x15'),_0x374747,_0xbb2f('0x13'),JSON[_0xbb2f('0x16')](_0x3d25f1));if(_0x3d25f1[_0xbb2f('0x17')]){if(_0x3d25f1[_0xbb2f('0x17')][_0xbb2f('0x18')]===0x1f4){logger[_0xbb2f('0x17')](_0xbb2f('0x12'),_0x374747,_0x3d25f1[_0xbb2f('0x17')]['message']);return _0x196389(_0x3d25f1['error']['message']);}logger['error'](_0xbb2f('0x12'),_0x374747,_0x3d25f1[_0xbb2f('0x17')]['message']);return _0x173a76(_0x3d25f1[_0xbb2f('0x17')][_0xbb2f('0x19')]);}else{logger['info'](_0xbb2f('0x12'),_0x374747,'request\x20sent');_0x173a76(_0x3d25f1[_0xbb2f('0x1a')][_0xbb2f('0x19')]);}})[_0xbb2f('0x1b')](function(_0x567f6a){logger['error'](_0xbb2f('0x12'),_0x374747,_0x567f6a);_0x196389(_0x567f6a);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index c671881..cc7c664 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 _0x213a=['length','save','remove','update','emit','register'];(function(_0x4b58bf,_0x592b2b){var _0x80fae5=function(_0x274f14){while(--_0x274f14){_0x4b58bf['push'](_0x4b58bf['shift']());}};_0x80fae5(++_0x592b2b);}(_0x213a,0x19f));var _0xa213=function(_0x39c734,_0x2f3e06){_0x39c734=_0x39c734-0x0;var _0xb2a2f9=_0x213a[_0x39c734];return _0xb2a2f9;};'use strict';var UserNotificationEvents=require('./userNotification.events');var events=[_0xa213('0x0'),_0xa213('0x1'),_0xa213('0x2')];function createListener(_0x28daf9,_0x579a89){return function(_0x3215ae){_0x579a89[_0xa213('0x3')](_0x28daf9,_0x3215ae);};}function removeListener(_0x4566dc,_0x1619a7){return function(){UserNotificationEvents['removeListener'](_0x4566dc,_0x1619a7);};}exports[_0xa213('0x4')]=function(_0x254857){for(var _0x2a7820=0x0,_0x2ea2b4=events[_0xa213('0x5')];_0x2a7820<_0x2ea2b4;_0x2a7820++){var _0xce51f9=events[_0x2a7820];var _0x375a16=createListener('userNotification:'+_0xce51f9,_0x254857);UserNotificationEvents['on'](_0xce51f9,_0x375a16);}}; \ No newline at end of file +var _0x3501=['./userNotification.events','save','remove','update','emit','userNotification:'];(function(_0x7f6bba,_0xb6527){var _0x51c9aa=function(_0xf0903){while(--_0xf0903){_0x7f6bba['push'](_0x7f6bba['shift']());}};_0x51c9aa(++_0xb6527);}(_0x3501,0x10e));var _0x1350=function(_0x2f257e,_0x49af2c){_0x2f257e=_0x2f257e-0x0;var _0x16293c=_0x3501[_0x2f257e];return _0x16293c;};'use strict';var UserNotificationEvents=require(_0x1350('0x0'));var events=[_0x1350('0x1'),_0x1350('0x2'),_0x1350('0x3')];function createListener(_0x5db3d8,_0x497537){return function(_0x3b7035){_0x497537[_0x1350('0x4')](_0x5db3d8,_0x3b7035);};}function removeListener(_0x117410,_0x27e8f7){return function(){UserNotificationEvents['removeListener'](_0x117410,_0x27e8f7);};}exports['register']=function(_0x3fde3e){for(var _0x23aa87=0x0,_0x65a578=events['length'];_0x23aa87<_0x65a578;_0x23aa87++){var _0x3d5d36=events[_0x23aa87];var _0xe04ed1=createListener(_0x1350('0x5')+_0x3d5d36,_0x3fde3e);UserNotificationEvents['on'](_0x3d5d36,_0xe04ed1);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index 75b60a1..8b3cc37 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x4d4a90,_0x38b8ee){var _0x436512=function(_0x982ac8){while(--_0x982ac8){_0x4d4a90['push'](_0x4d4a90['shift']());}};_0x436512(++_0x38b8ee);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x218972,_0x1f9794){_0x218972=_0x218972-0x0;var _0x1bb1a8=_0xcb91[_0x218972];return _0x1bb1a8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x82305a,_0x46a9fb){var _0x5b57e6=function(_0x1139a9){while(--_0x1139a9){_0x82305a['push'](_0x82305a['shift']());}};_0x5b57e6(++_0x46a9fb);}(_0x9c44,0x178));var _0x49c4=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x9c44[_0xfae23b];return _0x200640;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index 64ea78b..0711787 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 _0xca6a=['exports','INTEGER','sequelize'];(function(_0x379459,_0x1f3d0b){var _0x391a3c=function(_0x429c15){while(--_0x429c15){_0x379459['push'](_0x379459['shift']());}};_0x391a3c(++_0x1f3d0b);}(_0xca6a,0x17c));var _0xaca6=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0xca6a[_0x126558];return _0x1f6d14;};'use strict';var Sequelize=require(_0xaca6('0x0'));module[_0xaca6('0x1')]={'penalty':{'type':Sequelize[_0xaca6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9963=['INTEGER','sequelize','exports'];(function(_0x998e92,_0x4b73b3){var _0x2fa3d2=function(_0x1c5a8f){while(--_0x1c5a8f){_0x998e92['push'](_0x998e92['shift']());}};_0x2fa3d2(++_0x4b73b3);}(_0x9963,0x1c0));var _0x3996=function(_0xd204b0,_0x4c7d1d){_0xd204b0=_0xd204b0-0x0;var _0xfc8310=_0x9963[_0xd204b0];return _0xfc8310;};'use strict';var Sequelize=require(_0x3996('0x0'));module[_0x3996('0x1')]={'penalty':{'type':Sequelize[_0x3996('0x2')],'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 2039c2a..fdd5c60 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 _0xbebb=['../../config/environment','./userOpenchannelQueue.attributes','exports','define','user_has_openchannel_queues','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x5777eb,_0x3a23d1){var _0x4a4cae=function(_0x507e53){while(--_0x507e53){_0x5777eb['push'](_0x5777eb['shift']());}};_0x4a4cae(++_0x3a23d1);}(_0xbebb,0x161));var _0xbbeb=function(_0x35c628,_0x47de5b){_0x35c628=_0x35c628-0x0;var _0x10f621=_0xbebb[_0x35c628];return _0x10f621;};'use strict';var _=require(_0xbbeb('0x0'));var util=require(_0xbbeb('0x1'));var logger=require(_0xbbeb('0x2'))(_0xbbeb('0x3'));var moment=require('moment');var BPromise=require(_0xbbeb('0x4'));var rp=require(_0xbbeb('0x5'));var fs=require('fs');var path=require(_0xbbeb('0x6'));var rimraf=require('rimraf');var config=require(_0xbbeb('0x7'));var attributes=require(_0xbbeb('0x8'));module[_0xbbeb('0x9')]=function(_0x41bc5a,_0x3b213f){return _0x41bc5a[_0xbbeb('0xa')]('UserOpenchannelQueue',attributes,{'tableName':_0xbbeb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x615f=['request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','exports','lodash','../../config/logger','api','moment','bluebird'];(function(_0xf9139f,_0x58ba89){var _0x3efc69=function(_0x67ceca){while(--_0x67ceca){_0xf9139f['push'](_0xf9139f['shift']());}};_0x3efc69(++_0x58ba89);}(_0x615f,0xb9));var _0xf615=function(_0x30e86a,_0xdb8ad1){_0x30e86a=_0x30e86a-0x0;var _0x484b30=_0x615f[_0x30e86a];return _0x484b30;};'use strict';var _=require(_0xf615('0x0'));var util=require('util');var logger=require(_0xf615('0x1'))(_0xf615('0x2'));var moment=require(_0xf615('0x3'));var BPromise=require(_0xf615('0x4'));var rp=require(_0xf615('0x5'));var fs=require('fs');var path=require(_0xf615('0x6'));var rimraf=require('rimraf');var config=require(_0xf615('0x7'));var attributes=require(_0xf615('0x8'));module[_0xf615('0x9')]=function(_0x4f67e3,_0x317eed){return _0x4f67e3['define']('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 0a80a95..3bc3853 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 _0x3945=['info','result','catch','util','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3945,0xd4));var _0x5394=function(_0x58b2c5,_0x378b02){_0x58b2c5=_0x58b2c5-0x0;var _0x1cc6e6=_0x3945[_0x58b2c5];return _0x1cc6e6;};'use strict';var _=require('lodash');var util=require(_0x5394('0x0'));var moment=require('moment');var BPromise=require(_0x5394('0x1'));var rs=require(_0x5394('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5394('0x3'));var logger=require(_0x5394('0x4'))(_0x5394('0x5'));var config=require(_0x5394('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x5394('0x7')][_0x5394('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x23b99a,_0x5ad025,_0x42c472){return new BPromise(function(_0x27ed16,_0x2c6132){return client['request'](_0x23b99a,_0x42c472)['then'](function(_0x2d088b){logger['info'](_0x5394('0x9'),_0x5ad025,_0x5394('0xa'));logger['debug'](_0x5394('0xb'),_0x5ad025,_0x5394('0xa'),JSON[_0x5394('0xc')](_0x2d088b));if(_0x2d088b['error']){if(_0x2d088b['error'][_0x5394('0xd')]===0x1f4){logger[_0x5394('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5ad025,_0x2d088b[_0x5394('0xe')][_0x5394('0xf')]);return _0x2c6132(_0x2d088b[_0x5394('0xe')][_0x5394('0xf')]);}logger[_0x5394('0xe')](_0x5394('0x9'),_0x5ad025,_0x2d088b[_0x5394('0xe')][_0x5394('0xf')]);return _0x27ed16(_0x2d088b[_0x5394('0xe')][_0x5394('0xf')]);}else{logger[_0x5394('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x5ad025,_0x5394('0xa'));_0x27ed16(_0x2d088b[_0x5394('0x11')][_0x5394('0xf')]);}})[_0x5394('0x12')](function(_0x1127a2){logger[_0x5394('0xe')](_0x5394('0x9'),_0x5ad025,_0x1127a2);_0x2c6132(_0x1127a2);});});} \ No newline at end of file +var _0x418e=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x418e,0xa6));var _0xe418=function(_0x216c0d,_0x3a37ec){_0x216c0d=_0x216c0d-0x0;var _0x2ccb51=_0x418e[_0x216c0d];return _0x2ccb51;};'use strict';var _=require(_0xe418('0x0'));var util=require(_0xe418('0x1'));var moment=require(_0xe418('0x2'));var BPromise=require(_0xe418('0x3'));var rs=require(_0xe418('0x4'));var fs=require('fs');var Redis=require(_0xe418('0x5'));var db=require(_0xe418('0x6'))['db'];var utils=require(_0xe418('0x7'));var logger=require('../../config/logger')(_0xe418('0x8'));var config=require('../../config/environment');var jayson=require(_0xe418('0x9'));var client=jayson[_0xe418('0xa')][_0xe418('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x38e508,_0x1df17b,_0x35dd9e){return new BPromise(function(_0x36b372,_0x63cbb8){return client[_0xe418('0xc')](_0x38e508,_0x35dd9e)[_0xe418('0xd')](function(_0x348b55){logger[_0xe418('0xe')](_0xe418('0xf'),_0x1df17b,'request\x20sent');logger['debug'](_0xe418('0x10'),_0x1df17b,_0xe418('0x11'),JSON[_0xe418('0x12')](_0x348b55));if(_0x348b55[_0xe418('0x13')]){if(_0x348b55[_0xe418('0x13')][_0xe418('0x14')]===0x1f4){logger['error'](_0xe418('0xf'),_0x1df17b,_0x348b55[_0xe418('0x13')][_0xe418('0x15')]);return _0x63cbb8(_0x348b55[_0xe418('0x13')][_0xe418('0x15')]);}logger[_0xe418('0x13')](_0xe418('0xf'),_0x1df17b,_0x348b55[_0xe418('0x13')][_0xe418('0x15')]);return _0x36b372(_0x348b55[_0xe418('0x13')][_0xe418('0x15')]);}else{logger['info'](_0xe418('0xf'),_0x1df17b,'request\x20sent');_0x36b372(_0x348b55[_0xe418('0x16')][_0xe418('0x15')]);}})[_0xe418('0x17')](function(_0x305403){logger['error'](_0xe418('0xf'),_0x1df17b,_0x305403);_0x63cbb8(_0x305403);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 8bb0839..15c09a9 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 _0x26dc=['addSections','addResources','put','/:id','update','delete','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','show','getSections','/:id/resources','getResources','create','post','/:id/clone','clone','/:id/sections'];(function(_0x584925,_0x4e8c1f){var _0x13fba4=function(_0xe08753){while(--_0xe08753){_0x584925['push'](_0x584925['shift']());}};_0x13fba4(++_0x4e8c1f);}(_0x26dc,0x1ac));var _0xc26d=function(_0x32d6c1,_0x2942b3){_0x32d6c1=_0x32d6c1-0x0;var _0x59de2a=_0x26dc[_0x32d6c1];return _0x59de2a;};'use strict';var multer=require(_0xc26d('0x0'));var util=require(_0xc26d('0x1'));var path=require(_0xc26d('0x2'));var timeout=require(_0xc26d('0x3'));var express=require(_0xc26d('0x4'));var router=express[_0xc26d('0x5')]();var fs_extra=require(_0xc26d('0x6'));var auth=require(_0xc26d('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xc26d('0x8'));var controller=require(_0xc26d('0x9'));router[_0xc26d('0xa')]('/',auth[_0xc26d('0xb')](),controller[_0xc26d('0xc')]);router['get']('/describe',auth[_0xc26d('0xb')](),controller['describe']);router[_0xc26d('0xa')]('/:id',auth[_0xc26d('0xb')](),controller[_0xc26d('0xd')]);router[_0xc26d('0xa')]('/:id/sections',auth['isAuthenticated'](),controller[_0xc26d('0xe')]);router[_0xc26d('0xa')](_0xc26d('0xf'),auth[_0xc26d('0xb')](),controller[_0xc26d('0x10')]);router['post']('/',auth[_0xc26d('0xb')](),controller[_0xc26d('0x11')]);router[_0xc26d('0x12')](_0xc26d('0x13'),auth[_0xc26d('0xb')](),controller[_0xc26d('0x14')]);router[_0xc26d('0x12')](_0xc26d('0x15'),auth[_0xc26d('0xb')](),controller[_0xc26d('0x16')]);router[_0xc26d('0x12')](_0xc26d('0xf'),auth[_0xc26d('0xb')](),controller[_0xc26d('0x17')]);router[_0xc26d('0x18')](_0xc26d('0x19'),auth['isAuthenticated'](),controller[_0xc26d('0x1a')]);router['delete'](_0xc26d('0x19'),auth['isAuthenticated'](),controller['destroy']);router[_0xc26d('0x1b')]('/:id/sections',auth[_0xc26d('0xb')](),controller['removeSections']);router[_0xc26d('0x1b')](_0xc26d('0xf'),auth[_0xc26d('0xb')](),controller[_0xc26d('0x1c')]);module[_0xc26d('0x1d')]=router; \ No newline at end of file +var _0xb140=['../../config/environment','./userProfile.controller','get','isAuthenticated','index','/:id','show','/:id/sections','getSections','/:id/resources','getResources','post','create','clone','addSections','addResources','put','update','delete','removeSections','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x1ab180,_0x382b2c){var _0xfb2c2d=function(_0x1c5fd3){while(--_0x1c5fd3){_0x1ab180['push'](_0x1ab180['shift']());}};_0xfb2c2d(++_0x382b2c);}(_0xb140,0x1a9));var _0x0b14=function(_0x4225aa,_0x582bf2){_0x4225aa=_0x4225aa-0x0;var _0x3f8fab=_0xb140[_0x4225aa];return _0x3f8fab;};'use strict';var multer=require(_0x0b14('0x0'));var util=require(_0x0b14('0x1'));var path=require(_0x0b14('0x2'));var timeout=require(_0x0b14('0x3'));var express=require('express');var router=express[_0x0b14('0x4')]();var fs_extra=require(_0x0b14('0x5'));var auth=require(_0x0b14('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0b14('0x7'));var controller=require(_0x0b14('0x8'));router[_0x0b14('0x9')]('/',auth[_0x0b14('0xa')](),controller[_0x0b14('0xb')]);router[_0x0b14('0x9')]('/describe',auth[_0x0b14('0xa')](),controller['describe']);router[_0x0b14('0x9')](_0x0b14('0xc'),auth[_0x0b14('0xa')](),controller[_0x0b14('0xd')]);router['get'](_0x0b14('0xe'),auth[_0x0b14('0xa')](),controller[_0x0b14('0xf')]);router[_0x0b14('0x9')](_0x0b14('0x10'),auth[_0x0b14('0xa')](),controller[_0x0b14('0x11')]);router[_0x0b14('0x12')]('/',auth[_0x0b14('0xa')](),controller[_0x0b14('0x13')]);router['post']('/:id/clone',auth[_0x0b14('0xa')](),controller[_0x0b14('0x14')]);router[_0x0b14('0x12')](_0x0b14('0xe'),auth[_0x0b14('0xa')](),controller[_0x0b14('0x15')]);router['post'](_0x0b14('0x10'),auth[_0x0b14('0xa')](),controller[_0x0b14('0x16')]);router[_0x0b14('0x17')](_0x0b14('0xc'),auth[_0x0b14('0xa')](),controller[_0x0b14('0x18')]);router[_0x0b14('0x19')](_0x0b14('0xc'),auth[_0x0b14('0xa')](),controller['destroy']);router[_0x0b14('0x19')]('/:id/sections',auth['isAuthenticated'](),controller[_0x0b14('0x1a')]);router['delete']('/:id/resources',auth[_0x0b14('0xa')](),controller['removeResources']);module['exports']=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 741b74f..454e638 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 _0x0448=['setDataValue','crudPermissions','join','getDataValue','split','BOOLEAN','exports','STRING'];(function(_0xd140f4,_0x5624f0){var _0x4e5b3f=function(_0x423bc2){while(--_0x423bc2){_0xd140f4['push'](_0xd140f4['shift']());}};_0x4e5b3f(++_0x5624f0);}(_0x0448,0x186));var _0x8044=function(_0x30033a,_0x5ce4a6){_0x30033a=_0x30033a-0x0;var _0x5e3518=_0x0448[_0x30033a];return _0x5e3518;};'use strict';var Sequelize=require('sequelize');module[_0x8044('0x0')]={'name':{'type':Sequelize[_0x8044('0x1')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x511026){this[_0x8044('0x2')](_0x8044('0x3'),_0x511026?_0x511026[_0x8044('0x4')](''):[]);},'get':function(){return this['getDataValue'](_0x8044('0x3'))?this[_0x8044('0x5')](_0x8044('0x3'))[_0x8044('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'privacyEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x8044('0x7')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8044('0x7')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8044('0x7')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8044('0x7')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x8044('0x7')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8044('0x7')],'defaultValue':!![]}}; \ No newline at end of file +var _0xf50f=['join','getDataValue','crudPermissions','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue'];(function(_0x1cf6fa,_0x27b314){var _0x3b23db=function(_0x13f420){while(--_0x13f420){_0x1cf6fa['push'](_0x1cf6fa['shift']());}};_0x3b23db(++_0x27b314);}(_0xf50f,0x87));var _0xff50=function(_0x3fc478,_0x5cc1f3){_0x3fc478=_0x3fc478-0x0;var _0x2ffab7=_0xf50f[_0x3fc478];return _0x2ffab7;};'use strict';var Sequelize=require(_0xff50('0x0'));module[_0xff50('0x1')]={'name':{'type':Sequelize[_0xff50('0x2')],'allowNull':![],'unique':_0xff50('0x3')},'crudPermissions':{'type':Sequelize[_0xff50('0x2')],'set':function(_0x334fe4){this[_0xff50('0x4')]('crudPermissions',_0x334fe4?_0x334fe4[_0xff50('0x5')](''):[]);},'get':function(){return this[_0xff50('0x6')]('crudPermissions')?this[_0xff50('0x6')](_0xff50('0x7'))[_0xff50('0x8')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0xff50('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0xff50('0x9')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0xff50('0x9')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0xff50('0x9')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0xff50('0x9')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0xff50('0x9')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0xff50('0x9')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0xff50('0x9')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0xff50('0x9')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 57f7f55..8d96eb2 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 _0x0137=['resourceId','Plugin','bulkCreate','removeResources','Missing\x20section\x20parameter','hasOwnProperty','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','eml-format','rimraf','zip-dir','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','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','status','end','offset','limit','undefined','set','Content-Range','json','apply','reject','save','update','then','destroy','error','name','index','map','UserProfile','fieldName','type','model','query','keys','attributes','intersection','nolimit','order','sort','pick','filters','VIRTUAL','merge','options','where','count','findAll','rows','show','params','fields','include','find','catch','create','clone','rawAttributes','length','includeAll','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','autoAssociation','UserProfileResource','userProfileId','Resources','describe','addSections','push','removeSections','ids','getSections','includes','sectionId','subsections','enabled','filter','Dashboard','forEach'];(function(_0x2709d4,_0x38b970){var _0x1b7ef0=function(_0x16af6){while(--_0x16af6){_0x2709d4['push'](_0x2709d4['shift']());}};_0x1b7ef0(++_0x38b970);}(_0x0137,0x1d8));var _0x7013=function(_0x928aa1,_0x16bd67){_0x928aa1=_0x928aa1-0x0;var _0x37b02b=_0x0137[_0x928aa1];return _0x37b02b;};'use strict';var emlformat=require(_0x7013('0x0'));var rimraf=require(_0x7013('0x1'));var zipdir=require(_0x7013('0x2'));var jsonpatch=require(_0x7013('0x3'));var rp=require(_0x7013('0x4'));var moment=require('moment');var BPromise=require(_0x7013('0x5'));var Mustache=require(_0x7013('0x6'));var util=require(_0x7013('0x7'));var path=require(_0x7013('0x8'));var sox=require(_0x7013('0x9'));var csv=require(_0x7013('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7013('0xb'));var _=require(_0x7013('0xc'));var squel=require('squel');var crypto=require(_0x7013('0xd'));var jsforce=require(_0x7013('0xe'));var deskjs=require(_0x7013('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7013('0x10'));var Papa=require(_0x7013('0x11'));var Redis=require(_0x7013('0x12'));var authService=require(_0x7013('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x7013('0x14'));var hardwareService=require(_0x7013('0x15'));var logger=require(_0x7013('0x16'))(_0x7013('0x17'));var utils=require(_0x7013('0x18'));var config=require(_0x7013('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x7013('0x1a'))['db'];config[_0x7013('0x1b')]=_[_0x7013('0x1c')](config[_0x7013('0x1b')],{'host':_0x7013('0x1d'),'port':0x18eb});var socket=require(_0x7013('0x1e'))(new Redis(config[_0x7013('0x1b')]));require(_0x7013('0x1f'))[_0x7013('0x20')](socket);function respondWithStatusCode(_0x710f8a,_0x1c579f){_0x1c579f=_0x1c579f||0xcc;return function(_0x4af565){if(_0x4af565){return _0x710f8a['sendStatus'](_0x1c579f);}return _0x710f8a[_0x7013('0x21')](_0x1c579f)[_0x7013('0x22')]();};}function respondWithResult(_0x3e1a30,_0x4651a6){_0x4651a6=_0x4651a6||0xc8;return function(_0x36beb8){if(_0x36beb8){return _0x3e1a30['status'](_0x4651a6)['json'](_0x36beb8);}};}function respondWithFilteredResult(_0x13590e,_0x159a59){return function(_0x161a19){if(_0x161a19){var _0x1b68b0=typeof _0x159a59[_0x7013('0x23')]==='undefined'&&typeof _0x159a59[_0x7013('0x24')]===_0x7013('0x25');var _0x5da44b=_0x161a19['count'];var _0xdedff=_0x1b68b0?0x0:_0x159a59[_0x7013('0x23')];var _0x1e6e54=_0x1b68b0?_0x161a19['count']:_0x159a59[_0x7013('0x23')]+_0x159a59['limit'];var _0x2e4177;if(_0x1e6e54>=_0x5da44b){_0x1e6e54=_0x5da44b;_0x2e4177=0xc8;}else{_0x2e4177=0xce;}_0x13590e[_0x7013('0x21')](_0x2e4177);return _0x13590e[_0x7013('0x26')](_0x7013('0x27'),_0xdedff+'-'+_0x1e6e54+'/'+_0x5da44b)[_0x7013('0x28')](_0x161a19);}return null;};}function patchUpdates(_0x44c93a){return function(_0x2f261d){try{jsonpatch[_0x7013('0x29')](_0x2f261d,_0x44c93a,!![]);}catch(_0x1ba140){return BPromise[_0x7013('0x2a')](_0x1ba140);}return _0x2f261d[_0x7013('0x2b')]();};}function saveUpdates(_0x99f13d,_0x34811e){return function(_0x18a137){if(_0x18a137){return _0x18a137[_0x7013('0x2c')](_0x99f13d)[_0x7013('0x2d')](function(_0x1c11bf){return _0x1c11bf;});}return null;};}function removeEntity(_0x39c5f0,_0x15eda3){return function(_0x2e591b){if(_0x2e591b){return _0x2e591b[_0x7013('0x2e')]()['then'](function(){_0x39c5f0[_0x7013('0x21')](0xcc)[_0x7013('0x22')]();});}};}function handleEntityNotFound(_0x35d23f,_0x5b4562){return function(_0x15c3eb){if(!_0x15c3eb){_0x35d23f['sendStatus'](0x194);}return _0x15c3eb;};}function handleError(_0xedca92,_0x2c9daa){_0x2c9daa=_0x2c9daa||0x1f4;return function(_0x58a254){logger[_0x7013('0x2f')](_0x58a254['stack']);if(_0x58a254[_0x7013('0x30')]){delete _0x58a254[_0x7013('0x30')];}_0xedca92[_0x7013('0x21')](_0x2c9daa)['send'](_0x58a254);};}exports[_0x7013('0x31')]=function(_0x182958,_0x406322){var _0xe8090={},_0x5ef79c={},_0x44ab0b={'count':0x0,'rows':[]};var _0x4764df=_[_0x7013('0x32')](db[_0x7013('0x33')]['rawAttributes'],function(_0x520525){return{'name':_0x520525[_0x7013('0x34')],'type':_0x520525[_0x7013('0x35')]['key']};});_0x5ef79c[_0x7013('0x36')]=_[_0x7013('0x32')](_0x4764df,_0x7013('0x30'));_0x5ef79c[_0x7013('0x37')]=_[_0x7013('0x38')](_0x182958[_0x7013('0x37')]);_0x5ef79c['filters']=_['intersection'](_0x5ef79c[_0x7013('0x36')],_0x5ef79c[_0x7013('0x37')]);_0xe8090[_0x7013('0x39')]=_[_0x7013('0x3a')](_0x5ef79c[_0x7013('0x36')],qs['fields'](_0x182958[_0x7013('0x37')]['fields']));_0xe8090['attributes']=_0xe8090['attributes']['length']?_0xe8090[_0x7013('0x39')]:_0x5ef79c['model'];if(!_0x182958[_0x7013('0x37')]['hasOwnProperty'](_0x7013('0x3b'))){_0xe8090[_0x7013('0x24')]=qs[_0x7013('0x24')](_0x182958['query'][_0x7013('0x24')]);_0xe8090[_0x7013('0x23')]=qs[_0x7013('0x23')](_0x182958[_0x7013('0x37')][_0x7013('0x23')]);}_0xe8090[_0x7013('0x3c')]=qs[_0x7013('0x3d')](_0x182958[_0x7013('0x37')][_0x7013('0x3d')]);_0xe8090['where']=qs['filters'](_[_0x7013('0x3e')](_0x182958[_0x7013('0x37')],_0x5ef79c[_0x7013('0x3f')]),_0x4764df);if(_0x182958[_0x7013('0x37')]['filter']){_0xe8090['where']=_['merge'](_0xe8090['where'],{'$or':_['map'](_0x4764df,function(_0x28e17b){if(_0x28e17b['type']!==_0x7013('0x40')){var _0x56a178={};_0x56a178[_0x28e17b[_0x7013('0x30')]]={'$like':'%'+_0x182958[_0x7013('0x37')]['filter']+'%'};return _0x56a178;}})});}_0xe8090=_[_0x7013('0x41')]({},_0xe8090,_0x182958[_0x7013('0x42')]);var _0x2627a0={'where':_0xe8090[_0x7013('0x43')]};return db[_0x7013('0x33')][_0x7013('0x44')](_0x2627a0)[_0x7013('0x2d')](function(_0x3afd4a){_0x44ab0b[_0x7013('0x44')]=_0x3afd4a;if(_0x182958[_0x7013('0x37')]['includeAll']){_0xe8090['include']=[{'all':!![]}];}return db[_0x7013('0x33')][_0x7013('0x45')](_0xe8090);})[_0x7013('0x2d')](function(_0x3a9fec){_0x44ab0b[_0x7013('0x46')]=_0x3a9fec;return _0x44ab0b;})['then'](respondWithFilteredResult(_0x406322,_0xe8090))['catch'](handleError(_0x406322,null));};exports[_0x7013('0x47')]=function(_0x25f45a,_0xda2d3a){var _0x4a0e7a={'raw':![],'where':{'id':_0x25f45a[_0x7013('0x48')]['id']}},_0x327cc2={};_0x327cc2['model']=_[_0x7013('0x38')](db[_0x7013('0x33')]['rawAttributes']);_0x327cc2[_0x7013('0x37')]=_['keys'](_0x25f45a[_0x7013('0x37')]);_0x327cc2['filters']=_['intersection'](_0x327cc2[_0x7013('0x36')],_0x327cc2[_0x7013('0x37')]);_0x4a0e7a[_0x7013('0x39')]=_[_0x7013('0x3a')](_0x327cc2[_0x7013('0x36')],qs[_0x7013('0x49')](_0x25f45a[_0x7013('0x37')][_0x7013('0x49')]));_0x4a0e7a[_0x7013('0x39')]=_0x4a0e7a['attributes']['length']?_0x4a0e7a[_0x7013('0x39')]:_0x327cc2[_0x7013('0x36')];if(_0x25f45a['query']['includeAll']){_0x4a0e7a[_0x7013('0x4a')]=[{'all':!![]}];}_0x4a0e7a=_['merge']({},_0x4a0e7a,_0x25f45a[_0x7013('0x42')]);return db['UserProfile'][_0x7013('0x4b')](_0x4a0e7a)[_0x7013('0x2d')](handleEntityNotFound(_0xda2d3a,null))[_0x7013('0x2d')](respondWithResult(_0xda2d3a,null))[_0x7013('0x4c')](handleError(_0xda2d3a,null));};exports[_0x7013('0x4d')]=function(_0x28f10c,_0x3c71fa){return db[_0x7013('0x33')][_0x7013('0x4d')](_0x28f10c['body'],{})['then'](respondWithResult(_0x3c71fa,0xc9))[_0x7013('0x4c')](handleError(_0x3c71fa,null));};exports[_0x7013('0x4e')]=function(_0xa1881a,_0x10cc12){var _0x128009={'where':{'id':_0xa1881a[_0x7013('0x48')]['id']}},_0x461a40={};_0x461a40[_0x7013('0x36')]=_['keys'](db[_0x7013('0x33')][_0x7013('0x4f')]);_0x128009['attributes']=_[_0x7013('0x3a')](_0x461a40[_0x7013('0x36')],qs[_0x7013('0x49')](_0xa1881a[_0x7013('0x37')][_0x7013('0x49')]));_0x128009['attributes']=_0x128009[_0x7013('0x39')][_0x7013('0x50')]?_0x128009['attributes']:_0x461a40[_0x7013('0x36')];if(_0xa1881a[_0x7013('0x37')][_0x7013('0x51')]){_0x128009[_0x7013('0x4a')]=[{'all':!![]}];}_0x128009=_['merge']({},_0x128009,_0xa1881a[_0x7013('0x42')]);return db[_0x7013('0x33')]['find'](_0x128009)[_0x7013('0x2d')](handleEntityNotFound(_0x10cc12,null))['then'](function(_0x5195ae){if(_0x5195ae){var _0x425b06=_0x5195ae[_0x7013('0x52')]({'plain':!![]});_0x425b06=qs[_0x7013('0x53')](_0x425b06,['id',_0x7013('0x54'),_0x7013('0x55'),_0x7013('0x56')]);_0xa1881a[_0x7013('0x57')]=_[_0x7013('0x53')](_0xa1881a[_0x7013('0x57')],['id',_0x7013('0x54'),_0x7013('0x55')]);return db[_0x7013('0x58')][_0x7013('0x59')](function(_0x42cd12){return db[_0x7013('0x33')]['create'](_['merge'](_0x425b06,_0xa1881a['body']),{'include':_0xa1881a[_0x7013('0x37')][_0x7013('0x51')]?[{'all':!![]}]:undefined,'transaction':_0x42cd12})[_0x7013('0x2d')](function(_0x44b678){var _0x2836a3=_0x44b678[_0x7013('0x52')]({'plain':!![]});return db[_0x7013('0x5a')][_0x7013('0x45')]({'where':{'userProfileId':_0xa1881a[_0x7013('0x48')]['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x2ae1ea){if(_0x2ae1ea){return BPromise['each'](_0x2ae1ea,function(_0x5e7e43){return new BPromise(function(_0xe83ce9,_0x888890){if(_0x5e7e43[_0x7013('0x5b')]===null||_0x5e7e43[_0x7013('0x5b')]===0x1)_0xe83ce9(null);return db[_0x7013('0x5c')][_0x7013('0x45')]({'where':{'sectionId':_0x5e7e43['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x31df3d){var _0x4a2239=_[_0x7013('0x32')](_0x31df3d,function(_0x395840){return qs[_0x7013('0x53')](_0x395840,['id',_0x7013('0x54'),_0x7013('0x55'),'sectionId']);});_0xe83ce9(_0x4a2239);})[_0x7013('0x4c')](function(_0x5498f7){_0x888890(_0x5498f7);});})[_0x7013('0x2d')](function(_0x3e08b3){var _0x394729=qs['omit'](_0x5e7e43,['id',_0x7013('0x54'),_0x7013('0x55')]);_0x394729[_0x7013('0x5d')]=_0x2836a3['id'];if(_0x3e08b3)_0x394729[_0x7013('0x5e')]=_0x3e08b3;return _0x394729;})[_0x7013('0x2d')](function(_0x42fa64){return db[_0x7013('0x5a')]['create'](_0x42fa64,{'include':[{'model':db[_0x7013('0x5c')],'as':'Resources'}],'raw':!![],'transaction':_0x42cd12});});})[_0x7013('0x2d')](function(){return _0x2836a3;});}});});});}})[_0x7013('0x2d')](respondWithResult(_0x10cc12,0xc9))[_0x7013('0x4c')](handleError(_0x10cc12,null));};exports[_0x7013('0x2c')]=function(_0x57fb5b,_0x3ea42c){if(_0x57fb5b['body']['id']){delete _0x57fb5b['body']['id'];}return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x57fb5b[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x3ea42c,null))['then'](saveUpdates(_0x57fb5b[_0x7013('0x57')],null))['then'](respondWithResult(_0x3ea42c,null))['catch'](handleError(_0x3ea42c,null));};exports['destroy']=function(_0x4d0665,_0x4caa98){return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x4d0665[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x4caa98,null))[_0x7013('0x2d')](removeEntity(_0x4caa98,null))[_0x7013('0x4c')](handleError(_0x4caa98,null));};exports[_0x7013('0x5f')]=function(_0xcff2c7,_0x488caa){return db['UserProfile'][_0x7013('0x5f')]()[_0x7013('0x2d')](respondWithResult(_0x488caa,null))['catch'](handleError(_0x488caa,null));};exports[_0x7013('0x60')]=function(_0x4f85e8,_0x3ad0da){var _0x2dc245=_0x4f85e8[_0x7013('0x57')];return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x4f85e8[_0x7013('0x48')]['id']}})[_0x7013('0x2d')](handleEntityNotFound(_0x3ad0da,null))['then'](function(_0x312d71){if(_0x312d71){return db['sequelize'][_0x7013('0x59')](function(_0x20151d){return db[_0x7013('0x5a')][_0x7013('0x2e')]({'where':{'userProfileId':_0x4f85e8[_0x7013('0x48')]['id'],'sectionId':_['map'](_0x2dc245,function(_0x4056f4){return _0x4056f4['sectionId'];})},'transaction':_0x20151d})[_0x7013('0x2d')](function(){var _0x3a7eb6=_[_0x7013('0x32')](_0x2dc245,function(_0x27a034){_0x27a034[_0x7013('0x5d')]=_0x4f85e8['params']['id'];return _0x27a034;});var _0x53ec35=[];return BPromise['each'](_0x3a7eb6,function(_0x567a18){return db[_0x7013('0x5a')]['create'](_0x567a18,{'include':[{'model':db['UserProfileResource'],'as':_0x7013('0x5e')}],'raw':!![],'transaction':_0x20151d})['then'](function(_0x16fdc6){_0x53ec35[_0x7013('0x61')](_0x16fdc6[_0x7013('0x52')]({'plain':!![]}));});})['then'](function(){return _0x53ec35;});});});}})[_0x7013('0x2d')](function(_0x3b991d){return _0x3b991d;})[_0x7013('0x2d')](respondWithResult(_0x3ad0da,null))[_0x7013('0x4c')](handleError(_0x3ad0da,null));};exports[_0x7013('0x62')]=function(_0x36d4f8,_0x3a58d1){var _0x51df7c;return db[_0x7013('0x33')]['find']({'where':{'id':_0x36d4f8[_0x7013('0x48')]['id']},'attributes':['id',_0x7013('0x30')]})['then'](handleEntityNotFound(_0x3a58d1,null))['then'](function(_0x10184a){if(_0x10184a){_0x51df7c=_0x10184a;return db[_0x7013('0x5a')][_0x7013('0x2e')]({'where':{'userProfileId':_0x36d4f8[_0x7013('0x48')]['id'],'sectionId':_0x36d4f8[_0x7013('0x37')][_0x7013('0x63')]}});}})[_0x7013('0x2d')](function(){return _0x51df7c;})[_0x7013('0x2d')](respondWithStatusCode(_0x3a58d1,null))['catch'](handleError(_0x3a58d1,null));};exports[_0x7013('0x64')]=function(_0x3b483b,_0xb89bf3){var _0x1d7aa6=[];var _0x3d01e7=[];return db[_0x7013('0x5a')][_0x7013('0x45')]({'where':{'userProfileId':_0x3b483b[_0x7013('0x48')]['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x413c9e){_0x1d7aa6=_['filter'](_0x413c9e,function(_0x29804e){return _0x29804e['enabled']===0x1||_[_0x7013('0x65')]([0x3eb,0x709],_0x29804e[_0x7013('0x66')]);});if(!_['isEmpty'](_0x1d7aa6)){return _[_0x7013('0x32')](_0x1d7aa6,function(_0x36ec07){return _0x36ec07[_0x7013('0x66')];});}else{return;}})['then'](function(_0x582931){if(_0x582931)_0x3d01e7=_0x582931;if(_[_0x7013('0x65')](_0x3d01e7,0x64)){var _0x17c13b=_[_0x7013('0x4b')](_0x1d7aa6,{'sectionId':0x64});return hasDefaultDashboard(_0x17c13b)[_0x7013('0x2d')](function(_0x30b0d9){return _[_0x7013('0x32')](_0x1d7aa6,function(_0x20f13d){if(_0x20f13d[_0x7013('0x66')]===0x64){_0x20f13d[_0x7013('0x67')]=_0x30b0d9;}return _0x20f13d;});});}else{return;}})[_0x7013('0x2d')](function(_0x335e62){if(_0x335e62)_0x1d7aa6=_0x335e62;if(_[_0x7013('0x65')](_0x3d01e7,0x3eb)){var _0x3624ed=_[_0x7013('0x4b')](_0x1d7aa6,{'sectionId':0x3eb});return getCustomDashboards(_0x3624ed)[_0x7013('0x2d')](function(_0x542aff){return _[_0x7013('0x32')](_0x1d7aa6,function(_0xcd460d){if(_0x3624ed[_0x7013('0x68')]){if(_0xcd460d[_0x7013('0x66')]===0x3eb){_0xcd460d[_0x7013('0x67')]=_0x542aff;}}else{if(_0xcd460d[_0x7013('0x66')]===0x64){_0xcd460d[_0x7013('0x67')]=_0x542aff;}}return _0xcd460d;});});}else{return;}})[_0x7013('0x2d')](function(_0x33e064){if(_0x33e064)_0x1d7aa6=_0x33e064;if(_['includes'](_0x3d01e7,0x709)){var _0x5c5715=_[_0x7013('0x4b')](_0x1d7aa6,{'sectionId':0x709});return getPlugins(_0x5c5715)[_0x7013('0x2d')](function(_0x2d67b6){if(_0x5c5715['enabled']){return _['map'](_0x1d7aa6,function(_0x9887c2){if(_0x9887c2['sectionId']===0x709){_0x9887c2[_0x7013('0x67')]=_0x2d67b6;}return _0x9887c2;});}else{var _0x5ca440={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2d67b6};var _0x351642=_[_0x7013('0x32')](_0x1d7aa6);_0x351642['push'](_0x5ca440);return _0x351642;}});}else{return;}})[_0x7013('0x2d')](function(_0xfb256){if(_0xfb256)_0x1d7aa6=_0xfb256;return _[_0x7013('0x69')](_0x1d7aa6,[_0x7013('0x68'),0x1]);})['then'](respondWithResult(_0xb89bf3,null))['catch'](handleError(_0xb89bf3,null));};function hasDefaultDashboard(_0x23566f){var _0x2e68a9=[0x65];return new BPromise(function(_0x12e071,_0x504860){try{if(_0x23566f[_0x7013('0x5b')]){_0x12e071(_0x2e68a9);}else{return db['UserProfileResource']['findOne']({'where':{'sectionId':_0x23566f['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x36c309){_0x36c309?_0x12e071(_0x2e68a9):_0x12e071();});}}catch(_0x324335){_0x504860(_0x324335);}});}function getCustomDashboards(_0x124b7a){var _0x2f8790=[];return new BPromise(function(_0x5ae9da,_0x1ceb47){try{if(_0x124b7a[_0x7013('0x5b')]){return db[_0x7013('0x6a')][_0x7013('0x45')]({'raw':!![]})[_0x7013('0x2d')](function(_0x94f539){_0x94f539[_0x7013('0x6b')](function(_0x3b5c70){_0x2f8790['push'](_0x3b5c70['id']+0x1869f);});_0x5ae9da(_0x2f8790);});}else{return db[_0x7013('0x5c')][_0x7013('0x45')]({'where':{'sectionId':_0x124b7a['id']},'raw':!![]})[_0x7013('0x2d')](function(_0x8ce268){_0x8ce268['forEach'](function(_0x2fdba1){_0x2f8790[_0x7013('0x61')](_0x2fdba1[_0x7013('0x6c')]+0x1869f);});_0x5ae9da(_0x2f8790);});}}catch(_0x17dac2){_0x1ceb47(_0x17dac2);}});}function getPlugins(_0x150d07){var _0x159111=[];return new BPromise(function(_0x4ee653,_0x39f649){try{if(_0x150d07['autoAssociation']){return db[_0x7013('0x6d')][_0x7013('0x45')]({'raw':!![]})['then'](function(_0xbf39c8){_0xbf39c8['forEach'](function(_0x20676d){_0x159111[_0x7013('0x61')](_0x20676d['id']+0x15b38);});_0x4ee653(_0x159111);});}else{return db['UserProfileResource'][_0x7013('0x45')]({'where':{'sectionId':_0x150d07['id']},'raw':!![]})['then'](function(_0x310b53){_0x310b53['forEach'](function(_0x3a3aa6){_0x159111[_0x7013('0x61')](_0x3a3aa6[_0x7013('0x6c')]+0x15b38);});_0x4ee653(_0x159111);});}}catch(_0x14d179){_0x39f649(_0x14d179);}});}exports['addResources']=function(_0x126f5a,_0x152605){return db['UserProfile'][_0x7013('0x4b')]({'where':{'id':_0x126f5a[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x152605,null))[_0x7013('0x2d')](function(_0x31b468){if(_0x31b468){return db[_0x7013('0x58')][_0x7013('0x59')](function(_0xae7b6b){return db[_0x7013('0x5a')][_0x7013('0x45')]({'where':{'userProfileId':_0x126f5a['params']['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x216eab){if(_0x216eab){return db[_0x7013('0x5a')][_0x7013('0x2e')]({'where':{'userProfileId':_0x126f5a[_0x7013('0x48')]['id'],'id':_['map'](_0x216eab,function(_0x3ded8e){return _0x3ded8e['id'];})},'transaction':_0xae7b6b});}})['then'](function(_0x279c64){var _0x43c155=_[_0x7013('0x32')](_0x126f5a['body'],function(_0x181c31){_0x181c31[_0x7013('0x5d')]=_0x126f5a['params']['id'];return _0x181c31;});return db[_0x7013('0x5a')][_0x7013('0x6e')](_0x43c155,{'raw':!![],'transaction':_0xae7b6b});})[_0x7013('0x2d')](function(_0x3ad702){var _0x3dd4db=_[_0x7013('0x69')](_[_0x7013('0x32')](_0x3ad702,function(_0x4a1002){return _0x4a1002[_0x7013('0x52')]({'plain':!![]});}),{'includeAll':![]});if(_0x3dd4db){return db['UserProfileSection'][_0x7013('0x45')]({'where':{'userProfileId':_0x126f5a[_0x7013('0x48')]['id'],'sectionId':_[_0x7013('0x32')](_0x3dd4db,function(_0x54b03f){return _0x54b03f['sectionId'];})},'attributes':['id',_0x7013('0x66')],'raw':!![]})['then'](function(_0x20aa2c){var _0x3069ff=_[_0x7013('0x32')](_0x126f5a[_0x7013('0x57')],function(_0x4e33b2){_0x4e33b2['userProfileId']=_0x126f5a[_0x7013('0x48')]['id'];return _0x4e33b2;});return db[_0x7013('0x5c')]['bulkCreate'](_0x3069ff,{'raw':!![],'transaction':_0xae7b6b});});}})['catch'](handleError(_0x152605,null));});}})[_0x7013('0x2d')](function(_0x1af5ea){var _0x1dd404=_[_0x7013('0x32')](_0x1af5ea,function(_0x1ee9f4){return _0x1ee9f4[_0x7013('0x52')]({'plain':!![]});});})[_0x7013('0x2d')](respondWithResult(_0x152605,null))['catch'](handleError(_0x152605,null));};exports[_0x7013('0x6f')]=function(_0x4db20b,_0x98dc40,_0x1ef916){return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x4db20b[_0x7013('0x48')]['id']}})['then'](handleEntityNotFound(_0x98dc40,null))['then'](function(_0x35f41b){if(_0x35f41b){return _0x35f41b[_0x7013('0x6f')](_0x4db20b[_0x7013('0x37')][_0x7013('0x63')]);}})[_0x7013('0x2d')](respondWithStatusCode(_0x98dc40,null))[_0x7013('0x4c')](handleError(_0x98dc40,null));};exports['getResources']=function(_0x5e35b4,_0x47aab0){var _0x4042d5={};if(!_0x5e35b4['query']['section'])throw new Error(_0x7013('0x70'));if(!_0x5e35b4[_0x7013('0x37')][_0x7013('0x71')]('nolimit')){_0x4042d5[_0x7013('0x24')]=qs['limit'](_0x5e35b4['query']['limit']);_0x4042d5[_0x7013('0x23')]=qs[_0x7013('0x23')](_0x5e35b4['query']['offset']);}return db[_0x7013('0x33')][_0x7013('0x4b')]({'where':{'id':_0x5e35b4[_0x7013('0x48')]['id']}})[_0x7013('0x2d')](function(_0x100644){if(!_0x100644)throw new Error(_0x7013('0x72')+_0x5e35b4[_0x7013('0x48')]['id']);return db[_0x7013('0x33')][_0x7013('0x73')](_0x5e35b4);})['then'](respondWithFilteredResult(_0x47aab0,_0x4042d5))['catch'](handleError(_0x47aab0,null));}; \ No newline at end of file +var _0x56b9=['sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','clone','params','length','get','omit','updatedAt','crudPermissions','body','createdAt','sequelize','transaction','UserProfileSection','autoAssociation','sectionId','UserProfileResource','describe','addSections','userProfileId','Resources','push','removeSections','ids','getSections','enabled','isEmpty','includes','subsections','forEach','Plugin','resourceId','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userProfile.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','end','error','stack','name','send','index','map','UserProfile','rawAttributes','type','key','model','query','keys','attributes','intersection','fields','hasOwnProperty','nolimit'];(function(_0x17c772,_0x4bdd93){var _0x3f40ba=function(_0x3bbe2a){while(--_0x3bbe2a){_0x17c772['push'](_0x17c772['shift']());}};_0x3f40ba(++_0x4bdd93);}(_0x56b9,0x196));var _0x956b=function(_0xf73a86,_0x285496){_0xf73a86=_0xf73a86-0x0;var _0x457e11=_0x56b9[_0xf73a86];return _0x457e11;};'use strict';var emlformat=require(_0x956b('0x0'));var rimraf=require(_0x956b('0x1'));var zipdir=require(_0x956b('0x2'));var jsonpatch=require(_0x956b('0x3'));var rp=require(_0x956b('0x4'));var moment=require(_0x956b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x956b('0x6'));var util=require('util');var path=require(_0x956b('0x7'));var sox=require(_0x956b('0x8'));var csv=require(_0x956b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x956b('0xa'));var _=require(_0x956b('0xb'));var squel=require(_0x956b('0xc'));var crypto=require(_0x956b('0xd'));var jsforce=require(_0x956b('0xe'));var deskjs=require(_0x956b('0xf'));var toCsv=require(_0x956b('0x9'));var querystring=require(_0x956b('0x10'));var Papa=require('papaparse');var Redis=require(_0x956b('0x11'));var authService=require(_0x956b('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x956b('0x13'));var hardwareService=require(_0x956b('0x14'));var logger=require(_0x956b('0x15'))(_0x956b('0x16'));var utils=require(_0x956b('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x956b('0x18'));var db=require(_0x956b('0x19'))['db'];config[_0x956b('0x1a')]=_[_0x956b('0x1b')](config[_0x956b('0x1a')],{'host':_0x956b('0x1c'),'port':0x18eb});var socket=require(_0x956b('0x1d'))(new Redis(config[_0x956b('0x1a')]));require(_0x956b('0x1e'))[_0x956b('0x1f')](socket);function respondWithStatusCode(_0x389c3b,_0x5d3016){_0x5d3016=_0x5d3016||0xcc;return function(_0x43655d){if(_0x43655d){return _0x389c3b[_0x956b('0x20')](_0x5d3016);}return _0x389c3b[_0x956b('0x21')](_0x5d3016)['end']();};}function respondWithResult(_0x96ea9d,_0x3426a2){_0x3426a2=_0x3426a2||0xc8;return function(_0x3e37f1){if(_0x3e37f1){return _0x96ea9d[_0x956b('0x21')](_0x3426a2)[_0x956b('0x22')](_0x3e37f1);}};}function respondWithFilteredResult(_0x2bece3,_0x978146){return function(_0x57dff2){if(_0x57dff2){var _0x2db85f=typeof _0x978146[_0x956b('0x23')]===_0x956b('0x24')&&typeof _0x978146['limit']===_0x956b('0x24');var _0x45211c=_0x57dff2['count'];var _0x5dc7e0=_0x2db85f?0x0:_0x978146[_0x956b('0x23')];var _0x218974=_0x2db85f?_0x57dff2[_0x956b('0x25')]:_0x978146['offset']+_0x978146[_0x956b('0x26')];var _0x2a4cb5;if(_0x218974>=_0x45211c){_0x218974=_0x45211c;_0x2a4cb5=0xc8;}else{_0x2a4cb5=0xce;}_0x2bece3[_0x956b('0x21')](_0x2a4cb5);return _0x2bece3[_0x956b('0x27')](_0x956b('0x28'),_0x5dc7e0+'-'+_0x218974+'/'+_0x45211c)[_0x956b('0x22')](_0x57dff2);}return null;};}function patchUpdates(_0x4ad9bb){return function(_0xf69961){try{jsonpatch[_0x956b('0x29')](_0xf69961,_0x4ad9bb,!![]);}catch(_0x1f9ff6){return BPromise[_0x956b('0x2a')](_0x1f9ff6);}return _0xf69961[_0x956b('0x2b')]();};}function saveUpdates(_0x1ecd0a,_0x9ce16){return function(_0xb99870){if(_0xb99870){return _0xb99870[_0x956b('0x2c')](_0x1ecd0a)[_0x956b('0x2d')](function(_0x32f727){return _0x32f727;});}return null;};}function removeEntity(_0x512a68,_0x502875){return function(_0x3940bb){if(_0x3940bb){return _0x3940bb[_0x956b('0x2e')]()[_0x956b('0x2d')](function(){_0x512a68[_0x956b('0x21')](0xcc)[_0x956b('0x2f')]();});}};}function handleEntityNotFound(_0xa0105e,_0x331c58){return function(_0x4c529a){if(!_0x4c529a){_0xa0105e[_0x956b('0x20')](0x194);}return _0x4c529a;};}function handleError(_0x30786d,_0x6268cb){_0x6268cb=_0x6268cb||0x1f4;return function(_0x3d33ad){logger[_0x956b('0x30')](_0x3d33ad[_0x956b('0x31')]);if(_0x3d33ad[_0x956b('0x32')]){delete _0x3d33ad[_0x956b('0x32')];}_0x30786d[_0x956b('0x21')](_0x6268cb)[_0x956b('0x33')](_0x3d33ad);};}exports[_0x956b('0x34')]=function(_0x29dd86,_0x1c5f3d){var _0x2dac3e={},_0x397865={},_0x3d7edb={'count':0x0,'rows':[]};var _0x46a67c=_[_0x956b('0x35')](db[_0x956b('0x36')][_0x956b('0x37')],function(_0xc2eeec){return{'name':_0xc2eeec['fieldName'],'type':_0xc2eeec[_0x956b('0x38')][_0x956b('0x39')]};});_0x397865[_0x956b('0x3a')]=_[_0x956b('0x35')](_0x46a67c,_0x956b('0x32'));_0x397865[_0x956b('0x3b')]=_[_0x956b('0x3c')](_0x29dd86[_0x956b('0x3b')]);_0x397865['filters']=_['intersection'](_0x397865[_0x956b('0x3a')],_0x397865[_0x956b('0x3b')]);_0x2dac3e[_0x956b('0x3d')]=_[_0x956b('0x3e')](_0x397865[_0x956b('0x3a')],qs[_0x956b('0x3f')](_0x29dd86[_0x956b('0x3b')]['fields']));_0x2dac3e[_0x956b('0x3d')]=_0x2dac3e['attributes']['length']?_0x2dac3e[_0x956b('0x3d')]:_0x397865[_0x956b('0x3a')];if(!_0x29dd86[_0x956b('0x3b')][_0x956b('0x40')](_0x956b('0x41'))){_0x2dac3e[_0x956b('0x26')]=qs[_0x956b('0x26')](_0x29dd86['query'][_0x956b('0x26')]);_0x2dac3e[_0x956b('0x23')]=qs['offset'](_0x29dd86[_0x956b('0x3b')][_0x956b('0x23')]);}_0x2dac3e['order']=qs[_0x956b('0x42')](_0x29dd86['query'][_0x956b('0x42')]);_0x2dac3e[_0x956b('0x43')]=qs[_0x956b('0x44')](_[_0x956b('0x45')](_0x29dd86['query'],_0x397865['filters']),_0x46a67c);if(_0x29dd86[_0x956b('0x3b')][_0x956b('0x46')]){_0x2dac3e[_0x956b('0x43')]=_[_0x956b('0x47')](_0x2dac3e[_0x956b('0x43')],{'$or':_[_0x956b('0x35')](_0x46a67c,function(_0x4ef70a){if(_0x4ef70a[_0x956b('0x38')]!==_0x956b('0x48')){var _0x4d8a3c={};_0x4d8a3c[_0x4ef70a[_0x956b('0x32')]]={'$like':'%'+_0x29dd86['query']['filter']+'%'};return _0x4d8a3c;}})});}_0x2dac3e=_[_0x956b('0x47')]({},_0x2dac3e,_0x29dd86[_0x956b('0x49')]);var _0x4df0bc={'where':_0x2dac3e[_0x956b('0x43')]};return db[_0x956b('0x36')]['count'](_0x4df0bc)[_0x956b('0x2d')](function(_0x591823){_0x3d7edb['count']=_0x591823;if(_0x29dd86[_0x956b('0x3b')][_0x956b('0x4a')]){_0x2dac3e[_0x956b('0x4b')]=[{'all':!![]}];}return db['UserProfile'][_0x956b('0x4c')](_0x2dac3e);})[_0x956b('0x2d')](function(_0x3b3fe6){_0x3d7edb[_0x956b('0x4d')]=_0x3b3fe6;return _0x3d7edb;})[_0x956b('0x2d')](respondWithFilteredResult(_0x1c5f3d,_0x2dac3e))[_0x956b('0x4e')](handleError(_0x1c5f3d,null));};exports[_0x956b('0x4f')]=function(_0x165d50,_0x58c86d){var _0x680222={'raw':![],'where':{'id':_0x165d50['params']['id']}},_0x27ceeb={};_0x27ceeb[_0x956b('0x3a')]=_[_0x956b('0x3c')](db[_0x956b('0x36')]['rawAttributes']);_0x27ceeb[_0x956b('0x3b')]=_[_0x956b('0x3c')](_0x165d50['query']);_0x27ceeb['filters']=_['intersection'](_0x27ceeb[_0x956b('0x3a')],_0x27ceeb[_0x956b('0x3b')]);_0x680222[_0x956b('0x3d')]=_[_0x956b('0x3e')](_0x27ceeb[_0x956b('0x3a')],qs[_0x956b('0x3f')](_0x165d50[_0x956b('0x3b')][_0x956b('0x3f')]));_0x680222[_0x956b('0x3d')]=_0x680222[_0x956b('0x3d')]['length']?_0x680222['attributes']:_0x27ceeb['model'];if(_0x165d50['query']['includeAll']){_0x680222[_0x956b('0x4b')]=[{'all':!![]}];}_0x680222=_[_0x956b('0x47')]({},_0x680222,_0x165d50[_0x956b('0x49')]);return db[_0x956b('0x36')][_0x956b('0x50')](_0x680222)['then'](handleEntityNotFound(_0x58c86d,null))[_0x956b('0x2d')](respondWithResult(_0x58c86d,null))[_0x956b('0x4e')](handleError(_0x58c86d,null));};exports[_0x956b('0x51')]=function(_0x4f1cfd,_0x49f331){return db[_0x956b('0x36')][_0x956b('0x51')](_0x4f1cfd['body'],{})[_0x956b('0x2d')](respondWithResult(_0x49f331,0xc9))[_0x956b('0x4e')](handleError(_0x49f331,null));};exports[_0x956b('0x52')]=function(_0x499fbe,_0x4fd0a1){var _0x4c969a={'where':{'id':_0x499fbe[_0x956b('0x53')]['id']}},_0x10e989={};_0x10e989[_0x956b('0x3a')]=_[_0x956b('0x3c')](db[_0x956b('0x36')][_0x956b('0x37')]);_0x4c969a[_0x956b('0x3d')]=_[_0x956b('0x3e')](_0x10e989[_0x956b('0x3a')],qs[_0x956b('0x3f')](_0x499fbe[_0x956b('0x3b')][_0x956b('0x3f')]));_0x4c969a[_0x956b('0x3d')]=_0x4c969a[_0x956b('0x3d')][_0x956b('0x54')]?_0x4c969a['attributes']:_0x10e989[_0x956b('0x3a')];if(_0x499fbe['query'][_0x956b('0x4a')]){_0x4c969a[_0x956b('0x4b')]=[{'all':!![]}];}_0x4c969a=_[_0x956b('0x47')]({},_0x4c969a,_0x499fbe[_0x956b('0x49')]);return db[_0x956b('0x36')][_0x956b('0x50')](_0x4c969a)['then'](handleEntityNotFound(_0x4fd0a1,null))['then'](function(_0x321573){if(_0x321573){var _0x2807f9=_0x321573[_0x956b('0x55')]({'plain':!![]});_0x2807f9=qs[_0x956b('0x56')](_0x2807f9,['id','createdAt',_0x956b('0x57'),_0x956b('0x58')]);_0x499fbe[_0x956b('0x59')]=_[_0x956b('0x56')](_0x499fbe[_0x956b('0x59')],['id',_0x956b('0x5a'),_0x956b('0x57')]);return db[_0x956b('0x5b')][_0x956b('0x5c')](function(_0x7832a6){return db[_0x956b('0x36')][_0x956b('0x51')](_[_0x956b('0x47')](_0x2807f9,_0x499fbe[_0x956b('0x59')]),{'include':_0x499fbe[_0x956b('0x3b')][_0x956b('0x4a')]?[{'all':!![]}]:undefined,'transaction':_0x7832a6})[_0x956b('0x2d')](function(_0xe12e4c){var _0x3e235c=_0xe12e4c['get']({'plain':!![]});return db[_0x956b('0x5d')][_0x956b('0x4c')]({'where':{'userProfileId':_0x499fbe[_0x956b('0x53')]['id']},'raw':!![]})['then'](function(_0x5efe94){if(_0x5efe94){return BPromise['each'](_0x5efe94,function(_0x2fba6a){return new BPromise(function(_0x31bd22,_0xb6b13){if(_0x2fba6a[_0x956b('0x5e')]===null||_0x2fba6a[_0x956b('0x5e')]===0x1)_0x31bd22(null);return db['UserProfileResource']['findAll']({'where':{'sectionId':_0x2fba6a['id']},'raw':!![]})[_0x956b('0x2d')](function(_0x5a2bf3){var _0x13e991=_['map'](_0x5a2bf3,function(_0x46caf7){return qs['omit'](_0x46caf7,['id','createdAt','updatedAt',_0x956b('0x5f')]);});_0x31bd22(_0x13e991);})[_0x956b('0x4e')](function(_0x42f69f){_0xb6b13(_0x42f69f);});})['then'](function(_0x31d413){var _0x16dc7b=qs[_0x956b('0x56')](_0x2fba6a,['id',_0x956b('0x5a'),'updatedAt']);_0x16dc7b['userProfileId']=_0x3e235c['id'];if(_0x31d413)_0x16dc7b['Resources']=_0x31d413;return _0x16dc7b;})[_0x956b('0x2d')](function(_0x2a3ca4){return db['UserProfileSection'][_0x956b('0x51')](_0x2a3ca4,{'include':[{'model':db[_0x956b('0x60')],'as':'Resources'}],'raw':!![],'transaction':_0x7832a6});});})[_0x956b('0x2d')](function(){return _0x3e235c;});}});});});}})['then'](respondWithResult(_0x4fd0a1,0xc9))[_0x956b('0x4e')](handleError(_0x4fd0a1,null));};exports['update']=function(_0x413b23,_0x426ea0){if(_0x413b23[_0x956b('0x59')]['id']){delete _0x413b23[_0x956b('0x59')]['id'];}return db[_0x956b('0x36')]['find']({'where':{'id':_0x413b23[_0x956b('0x53')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x426ea0,null))[_0x956b('0x2d')](saveUpdates(_0x413b23[_0x956b('0x59')],null))[_0x956b('0x2d')](respondWithResult(_0x426ea0,null))[_0x956b('0x4e')](handleError(_0x426ea0,null));};exports[_0x956b('0x2e')]=function(_0x3a1c97,_0x7606d5){return db[_0x956b('0x36')][_0x956b('0x50')]({'where':{'id':_0x3a1c97[_0x956b('0x53')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x7606d5,null))[_0x956b('0x2d')](removeEntity(_0x7606d5,null))[_0x956b('0x4e')](handleError(_0x7606d5,null));};exports[_0x956b('0x61')]=function(_0x47cf95,_0x2871e7){return db[_0x956b('0x36')][_0x956b('0x61')]()[_0x956b('0x2d')](respondWithResult(_0x2871e7,null))['catch'](handleError(_0x2871e7,null));};exports[_0x956b('0x62')]=function(_0x5a713d,_0x1d0d13){var _0x27c39d=_0x5a713d[_0x956b('0x59')];return db['UserProfile']['find']({'where':{'id':_0x5a713d[_0x956b('0x53')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x1d0d13,null))[_0x956b('0x2d')](function(_0x4b617d){if(_0x4b617d){return db[_0x956b('0x5b')][_0x956b('0x5c')](function(_0x5ee507){return db[_0x956b('0x5d')][_0x956b('0x2e')]({'where':{'userProfileId':_0x5a713d[_0x956b('0x53')]['id'],'sectionId':_[_0x956b('0x35')](_0x27c39d,function(_0x1d331b){return _0x1d331b[_0x956b('0x5f')];})},'transaction':_0x5ee507})[_0x956b('0x2d')](function(){var _0x21d2be=_[_0x956b('0x35')](_0x27c39d,function(_0x4f564f){_0x4f564f[_0x956b('0x63')]=_0x5a713d[_0x956b('0x53')]['id'];return _0x4f564f;});var _0x57b3fe=[];return BPromise['each'](_0x21d2be,function(_0x2ed012){return db[_0x956b('0x5d')][_0x956b('0x51')](_0x2ed012,{'include':[{'model':db['UserProfileResource'],'as':_0x956b('0x64')}],'raw':!![],'transaction':_0x5ee507})['then'](function(_0x23a2c3){_0x57b3fe[_0x956b('0x65')](_0x23a2c3[_0x956b('0x55')]({'plain':!![]}));});})[_0x956b('0x2d')](function(){return _0x57b3fe;});});});}})[_0x956b('0x2d')](function(_0x1b0e62){return _0x1b0e62;})[_0x956b('0x2d')](respondWithResult(_0x1d0d13,null))[_0x956b('0x4e')](handleError(_0x1d0d13,null));};exports[_0x956b('0x66')]=function(_0x570f27,_0x5dd704){var _0x10b0ca;return db[_0x956b('0x36')][_0x956b('0x50')]({'where':{'id':_0x570f27['params']['id']},'attributes':['id',_0x956b('0x32')]})['then'](handleEntityNotFound(_0x5dd704,null))[_0x956b('0x2d')](function(_0x2e1a8d){if(_0x2e1a8d){_0x10b0ca=_0x2e1a8d;return db[_0x956b('0x5d')][_0x956b('0x2e')]({'where':{'userProfileId':_0x570f27[_0x956b('0x53')]['id'],'sectionId':_0x570f27[_0x956b('0x3b')][_0x956b('0x67')]}});}})[_0x956b('0x2d')](function(){return _0x10b0ca;})[_0x956b('0x2d')](respondWithStatusCode(_0x5dd704,null))[_0x956b('0x4e')](handleError(_0x5dd704,null));};exports[_0x956b('0x68')]=function(_0x2627c3,_0x532531){var _0x3d58ca=[];var _0x4143b9=[];return db['UserProfileSection']['findAll']({'where':{'userProfileId':_0x2627c3[_0x956b('0x53')]['id']},'raw':!![]})[_0x956b('0x2d')](function(_0x32dea5){_0x3d58ca=_[_0x956b('0x46')](_0x32dea5,function(_0x12cdeb){return _0x12cdeb[_0x956b('0x69')]===0x1||_['includes']([0x3eb,0x709],_0x12cdeb[_0x956b('0x5f')]);});if(!_[_0x956b('0x6a')](_0x3d58ca)){return _[_0x956b('0x35')](_0x3d58ca,function(_0x1264a6){return _0x1264a6[_0x956b('0x5f')];});}else{return;}})[_0x956b('0x2d')](function(_0x4dd82c){if(_0x4dd82c)_0x4143b9=_0x4dd82c;if(_[_0x956b('0x6b')](_0x4143b9,0x64)){var _0x53a4ae=_[_0x956b('0x50')](_0x3d58ca,{'sectionId':0x64});return hasDefaultDashboard(_0x53a4ae)[_0x956b('0x2d')](function(_0x1e3c92){return _['map'](_0x3d58ca,function(_0x3e0473){if(_0x3e0473[_0x956b('0x5f')]===0x64){_0x3e0473[_0x956b('0x6c')]=_0x1e3c92;}return _0x3e0473;});});}else{return;}})[_0x956b('0x2d')](function(_0x1f8405){if(_0x1f8405)_0x3d58ca=_0x1f8405;if(_['includes'](_0x4143b9,0x3eb)){var _0x5dfdb7=_[_0x956b('0x50')](_0x3d58ca,{'sectionId':0x3eb});return getCustomDashboards(_0x5dfdb7)[_0x956b('0x2d')](function(_0x53b81d){return _['map'](_0x3d58ca,function(_0x38e366){if(_0x5dfdb7['enabled']){if(_0x38e366['sectionId']===0x3eb){_0x38e366[_0x956b('0x6c')]=_0x53b81d;}}else{if(_0x38e366[_0x956b('0x5f')]===0x64){_0x38e366[_0x956b('0x6c')]=_0x53b81d;}}return _0x38e366;});});}else{return;}})['then'](function(_0x1cee78){if(_0x1cee78)_0x3d58ca=_0x1cee78;if(_['includes'](_0x4143b9,0x709)){var _0x59836d=_['find'](_0x3d58ca,{'sectionId':0x709});return getPlugins(_0x59836d)[_0x956b('0x2d')](function(_0x5106e5){if(_0x59836d[_0x956b('0x69')]){return _[_0x956b('0x35')](_0x3d58ca,function(_0x4e33c2){if(_0x4e33c2[_0x956b('0x5f')]===0x709){_0x4e33c2[_0x956b('0x6c')]=_0x5106e5;}return _0x4e33c2;});}else{var _0x5a9ca8={'sectionId':0x76c,'enabled':0x1,'subsections':_0x5106e5};var _0xde2342=_[_0x956b('0x35')](_0x3d58ca);_0xde2342[_0x956b('0x65')](_0x5a9ca8);return _0xde2342;}});}else{return;}})['then'](function(_0x55d215){if(_0x55d215)_0x3d58ca=_0x55d215;return _[_0x956b('0x46')](_0x3d58ca,[_0x956b('0x69'),0x1]);})[_0x956b('0x2d')](respondWithResult(_0x532531,null))[_0x956b('0x4e')](handleError(_0x532531,null));};function hasDefaultDashboard(_0x3974f6){var _0x1f5b6f=[0x65];return new BPromise(function(_0x57df81,_0x1f2a50){try{if(_0x3974f6['autoAssociation']){_0x57df81(_0x1f5b6f);}else{return db[_0x956b('0x60')]['findOne']({'where':{'sectionId':_0x3974f6['id']},'raw':!![]})[_0x956b('0x2d')](function(_0x35041d){_0x35041d?_0x57df81(_0x1f5b6f):_0x57df81();});}}catch(_0xdf84a2){_0x1f2a50(_0xdf84a2);}});}function getCustomDashboards(_0x5396cb){var _0xc7e389=[];return new BPromise(function(_0x5cbf1c,_0x16cdb5){try{if(_0x5396cb[_0x956b('0x5e')]){return db['Dashboard'][_0x956b('0x4c')]({'raw':!![]})[_0x956b('0x2d')](function(_0x32975d){_0x32975d[_0x956b('0x6d')](function(_0x100f99){_0xc7e389[_0x956b('0x65')](_0x100f99['id']+0x1869f);});_0x5cbf1c(_0xc7e389);});}else{return db[_0x956b('0x60')][_0x956b('0x4c')]({'where':{'sectionId':_0x5396cb['id']},'raw':!![]})[_0x956b('0x2d')](function(_0x4a4746){_0x4a4746[_0x956b('0x6d')](function(_0x1310c3){_0xc7e389['push'](_0x1310c3['resourceId']+0x1869f);});_0x5cbf1c(_0xc7e389);});}}catch(_0x22bfb5){_0x16cdb5(_0x22bfb5);}});}function getPlugins(_0x5cee44){var _0x44069f=[];return new BPromise(function(_0x2dbe77,_0x58d9af){try{if(_0x5cee44[_0x956b('0x5e')]){return db[_0x956b('0x6e')][_0x956b('0x4c')]({'raw':!![]})[_0x956b('0x2d')](function(_0x4266be){_0x4266be[_0x956b('0x6d')](function(_0x33d051){_0x44069f[_0x956b('0x65')](_0x33d051['id']+0x15b38);});_0x2dbe77(_0x44069f);});}else{return db[_0x956b('0x60')]['findAll']({'where':{'sectionId':_0x5cee44['id']},'raw':!![]})[_0x956b('0x2d')](function(_0x5c8ef5){_0x5c8ef5[_0x956b('0x6d')](function(_0x4ece13){_0x44069f[_0x956b('0x65')](_0x4ece13[_0x956b('0x6f')]+0x15b38);});_0x2dbe77(_0x44069f);});}}catch(_0x424c65){_0x58d9af(_0x424c65);}});}exports['addResources']=function(_0x4cced1,_0x4f92e6){return db[_0x956b('0x36')][_0x956b('0x50')]({'where':{'id':_0x4cced1[_0x956b('0x53')]['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x4f92e6,null))[_0x956b('0x2d')](function(_0x3f4270){if(_0x3f4270){return db[_0x956b('0x5b')]['transaction'](function(_0x5d6ee2){return db[_0x956b('0x5d')]['findAll']({'where':{'userProfileId':_0x4cced1[_0x956b('0x53')]['id']},'attributes':['id'],'raw':!![]})[_0x956b('0x2d')](function(_0xc8b100){if(_0xc8b100){return db[_0x956b('0x5d')][_0x956b('0x2e')]({'where':{'userProfileId':_0x4cced1['params']['id'],'id':_['map'](_0xc8b100,function(_0xda80b6){return _0xda80b6['id'];})},'transaction':_0x5d6ee2});}})[_0x956b('0x2d')](function(_0x10347e){var _0x35328b=_['map'](_0x4cced1['body'],function(_0x1f1ded){_0x1f1ded[_0x956b('0x63')]=_0x4cced1['params']['id'];return _0x1f1ded;});return db['UserProfileSection']['bulkCreate'](_0x35328b,{'raw':!![],'transaction':_0x5d6ee2});})['then'](function(_0x556492){var _0x4b3e5d=_[_0x956b('0x46')](_[_0x956b('0x35')](_0x556492,function(_0x46965a){return _0x46965a['get']({'plain':!![]});}),{'includeAll':![]});if(_0x4b3e5d){return db[_0x956b('0x5d')]['findAll']({'where':{'userProfileId':_0x4cced1[_0x956b('0x53')]['id'],'sectionId':_[_0x956b('0x35')](_0x4b3e5d,function(_0x1be426){return _0x1be426['sectionId'];})},'attributes':['id',_0x956b('0x5f')],'raw':!![]})[_0x956b('0x2d')](function(_0x2028b3){var _0x5d0cfe=_['map'](_0x4cced1[_0x956b('0x59')],function(_0x28c40f){_0x28c40f[_0x956b('0x63')]=_0x4cced1[_0x956b('0x53')]['id'];return _0x28c40f;});return db[_0x956b('0x60')][_0x956b('0x70')](_0x5d0cfe,{'raw':!![],'transaction':_0x5d6ee2});});}})[_0x956b('0x4e')](handleError(_0x4f92e6,null));});}})[_0x956b('0x2d')](function(_0x42a200){var _0x288894=_[_0x956b('0x35')](_0x42a200,function(_0x5ba0b4){return _0x5ba0b4[_0x956b('0x55')]({'plain':!![]});});})[_0x956b('0x2d')](respondWithResult(_0x4f92e6,null))['catch'](handleError(_0x4f92e6,null));};exports[_0x956b('0x71')]=function(_0xc77505,_0x36aa28,_0x42c8f2){return db[_0x956b('0x36')][_0x956b('0x50')]({'where':{'id':_0xc77505['params']['id']}})[_0x956b('0x2d')](handleEntityNotFound(_0x36aa28,null))[_0x956b('0x2d')](function(_0x4fac7c){if(_0x4fac7c){return _0x4fac7c['removeResources'](_0xc77505[_0x956b('0x3b')][_0x956b('0x67')]);}})[_0x956b('0x2d')](respondWithStatusCode(_0x36aa28,null))[_0x956b('0x4e')](handleError(_0x36aa28,null));};exports[_0x956b('0x72')]=function(_0xfec9ec,_0x540fd0){var _0x1be098={};if(!_0xfec9ec[_0x956b('0x3b')][_0x956b('0x73')])throw new Error(_0x956b('0x74'));if(!_0xfec9ec[_0x956b('0x3b')][_0x956b('0x40')](_0x956b('0x41'))){_0x1be098[_0x956b('0x26')]=qs[_0x956b('0x26')](_0xfec9ec[_0x956b('0x3b')]['limit']);_0x1be098[_0x956b('0x23')]=qs[_0x956b('0x23')](_0xfec9ec['query'][_0x956b('0x23')]);}return db['UserProfile'][_0x956b('0x50')]({'where':{'id':_0xfec9ec['params']['id']}})[_0x956b('0x2d')](function(_0x180ab7){if(!_0x180ab7)throw new Error(_0x956b('0x75')+_0xfec9ec[_0x956b('0x53')]['id']);return db[_0x956b('0x36')][_0x956b('0x72')](_0xfec9ec);})[_0x956b('0x2d')](respondWithFilteredResult(_0x540fd0,_0x1be098))[_0x956b('0x4e')](handleError(_0x540fd0,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index d935866..2ab46b1 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 _0x0424=['exports','UserProfile','setMaxListeners','save','update','emit','hasOwnProperty','hook'];(function(_0x137b4a,_0x36b783){var _0x46a556=function(_0x10c11d){while(--_0x10c11d){_0x137b4a['push'](_0x137b4a['shift']());}};_0x46a556(++_0x36b783);}(_0x0424,0x159));var _0x4042=function(_0x295a92,_0x7d70dc){_0x295a92=_0x295a92-0x0;var _0x3f5dac=_0x0424[_0x295a92];return _0x3f5dac;};'use strict';var EventEmitter=require('events');var UserProfile=require('../../mysqldb')['db'][_0x4042('0x0')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x4042('0x1')](0x0);var events={'afterCreate':_0x4042('0x2'),'afterUpdate':_0x4042('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3cd879){return function(_0x519987,_0x491eae,_0x20d8df){UserProfileEvents[_0x4042('0x4')](_0x3cd879+':'+_0x519987['id'],_0x519987);UserProfileEvents[_0x4042('0x4')](_0x3cd879,_0x519987);_0x20d8df(null);};}for(var e in events){if(events[_0x4042('0x5')](e)){var event=events[e];UserProfile[_0x4042('0x6')](e,emitEvent(event));}}module[_0x4042('0x7')]=UserProfileEvents; \ No newline at end of file +var _0x4bd3=['events','UserProfile','setMaxListeners','emit','hook','exports'];(function(_0x352721,_0x5e4834){var _0x359541=function(_0x3fb949){while(--_0x3fb949){_0x352721['push'](_0x352721['shift']());}};_0x359541(++_0x5e4834);}(_0x4bd3,0x174));var _0x34bd=function(_0x313b27,_0x3c7509){_0x313b27=_0x313b27-0x0;var _0x4ae659=_0x4bd3[_0x313b27];return _0x4ae659;};'use strict';var EventEmitter=require(_0x34bd('0x0'));var UserProfile=require('../../mysqldb')['db'][_0x34bd('0x1')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x34bd('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x22b921){return function(_0x44854a,_0x1fc8eb,_0x5846f3){UserProfileEvents[_0x34bd('0x3')](_0x22b921+':'+_0x44854a['id'],_0x44854a);UserProfileEvents[_0x34bd('0x3')](_0x22b921,_0x44854a);_0x5846f3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserProfile[_0x34bd('0x4')](e,emitEvent(event));}}module[_0x34bd('0x5')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 1dabcdb..078d688 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 _0x2b8e=['ui.','InteractionId','ui.createdAt','from','user_has_','_interactions','where','sequelize','query','toString','define','UserProfile','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','find','params','all','ignore','union','autoAssociation','push','rawAttributes','keys','intersection','attributes','fields','hasOwnProperty','nolimit','limit','offset','sort','filters','pick','merge','key','foreignKey','forEach','options','includeAll','include','reportType','default','DefaultReports','custom','count','rows','Tags','tag','ThroughTags','openTabs','chat','dataValues','sms','fax','mail','openchannel','whatsapp','lodash','exports','models','filter','field','value','findAll','then','associatedResources','map','catch','model','AnalyticExtractedReport','resourceId','type','toLowerCase','squareprojects','childModel','odbc','SquareOdbc','squarerecordings','parentSections','projects','JscriptyProject','contacts','CmContact','Lists','ListId','CmList','companies','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','faxqueues','FaxQueue','faxaccounts','inboundroutes','outboundroutes','VoiceExtension','contexts','VoiceContext','VoiceMail','voicerecordings','name','membername','User','role','agent','Telephones','VoiceQueues','queue','VoiceQueue','inbound','QueueCampaigns','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','OpenchannelQueue','openchannelaccounts','OpenchannelAccount','smsqueues','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','WhatsappAccount','Team','voicequeues','queuecampaigns','users','agents','telephones','Users','admin','user','Agents','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','sugarcrmaccounts','zohoaccounts','vtigeraccounts','cannedanswers','CannedAnswer','Disposition','customdashboards','Dashboard','intervals','Interval','Pause','sounds','Sound','tags','Tag','templates','Template','triggers','Trigger','trunks','variables','Variable','plugins','extractedreports','reportId','AnalyticMetric','whatsappaccounts','charAt','toUpperCase','slice','Sequelize','QueryTypes'];(function(_0x2c4c92,_0x5e1f88){var _0xac3410=function(_0x1b0844){while(--_0x1b0844){_0x2c4c92['push'](_0x2c4c92['shift']());}};_0xac3410(++_0x5e1f88);}(_0x2b8e,0xf4));var _0xe2b8=function(_0x27529c,_0x5cca15){_0x27529c=_0x27529c-0x0;var _0x2fb92b=_0x2b8e[_0x27529c];return _0x2fb92b;};'use strict';var _=require(_0xe2b8('0x0'));var attributes=require('./userProfile.attributes');var qs=require('../../components/parsers/qs');module[_0xe2b8('0x1')]=function(_0x2cae53){var _0x4b6c87=_0x2cae53[_0xe2b8('0x2')];function _0x414d55(_0x24e45d,_0x382a04){return new Promise(function(_0x5dbe22,_0x5a54e3){if(!_0x382a04)return _0x5dbe22(null);var _0x162be9=_0x382a04['filter']?{[_0x382a04[_0xe2b8('0x3')][_0xe2b8('0x4')]]:_0x382a04[_0xe2b8('0x3')][_0xe2b8('0x5')]}:undefined;return _0x4b6c87[_0x24e45d][_0xe2b8('0x6')]({'where':_0x162be9,'raw':!![]})[_0xe2b8('0x7')](function(_0x137fc1){_0x382a04[_0xe2b8('0x8')]=_[_0xe2b8('0x9')](_0x137fc1,'id');_0x5dbe22(_0x382a04);})[_0xe2b8('0xa')](function(_0xe78e8){_0x5a54e3(_0xe78e8);});});}function _0x578e92(_0x4f21b8,_0x427852){return new Promise(function(_0x2184c5,_0x6c5d53){var _0x1f985e=_0x4f21b8[_0xe2b8('0x3')]?{[_0x4f21b8[_0xe2b8('0x3')][_0xe2b8('0x4')]]:_0x4f21b8[_0xe2b8('0x3')]['value']}:undefined;return _0x4b6c87[_0x4f21b8[_0xe2b8('0xb')]][_0xe2b8('0x6')]({'where':_0x1f985e,'raw':!![]})[_0xe2b8('0x7')](function(_0x4aae4a){_0x427852[_0xe2b8('0x8')]=_[_0xe2b8('0x9')](_0x4aae4a,function(_0x55f52d){return _0x55f52d['name'];});_0x2184c5(_0x427852);})[_0xe2b8('0xa')](function(_0x1742c7){_0x6c5d53(_0x1742c7);});});}function _0x481308(_0x4069e8,_0x1c0a82,_0x10a6f9){if(!_0x1c0a82)return resolve(null);return new Promise(function(_0x55c4a1,_0x3658a0){return _0x4b6c87['UserProfileResource'][_0xe2b8('0x6')]({'where':{'sectionId':_0x1c0a82['id']},'raw':!![]})['then'](function(_0x5f167e){if(_0x4069e8[_0xe2b8('0x4')]&&_0x4069e8[_0xe2b8('0x4')]!=='id'){_0x1c0a82['associatedResources']=_[_0xe2b8('0x9')](_0x5f167e,function(_0x4e5756){return _0x4e5756[_0x4069e8[_0xe2b8('0x4')]];});}else{if(_0x10a6f9===_0xe2b8('0xc')){_0x1c0a82[_0xe2b8('0x8')]=_[_0xe2b8('0x9')](_0x5f167e,function(_0x4d6f0f){return{'id':_0x4d6f0f[_0xe2b8('0xd')],'type':_0x4d6f0f[_0xe2b8('0xe')]};});}else{_0x1c0a82['associatedResources']=_[_0xe2b8('0x9')](_0x5f167e,function(_0x1c38c4){return _0x1c38c4['resourceId'];});}}_0x55c4a1(_0x1c0a82);})[_0xe2b8('0xa')](function(_0xefa3f5){_0x3658a0(_0xefa3f5);});});}function _0x300dc5(_0x357083,_0x339d90){var _0xe5ebe5={'parentSections':[]};switch(_0x357083[_0xe2b8('0xf')]()){case _0xe2b8('0x10'):_0xe5ebe5[_0xe2b8('0x11')]='SquareProject';break;case _0xe2b8('0x12'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x13');break;case _0xe2b8('0x14'):_0xe5ebe5[_0xe2b8('0x11')]='SquareRecording';_0xe5ebe5[_0xe2b8('0x15')]=[{'name':'SquareProjects','field':'name','foreignKey':'projectName'}];break;case _0xe2b8('0x16'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x17');break;case _0xe2b8('0x18'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x19');_0xe5ebe5[_0xe2b8('0x15')]=[{'name':_0xe2b8('0x1a'),'field':'id','foreignKey':_0xe2b8('0x1b')}];break;case'lists':_0xe5ebe5['childModel']=_0xe2b8('0x1c');break;case _0xe2b8('0x1d'):_0xe5ebe5['childModel']=_0xe2b8('0x1e');break;case _0xe2b8('0x1f'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x20');break;case _0xe2b8('0x21'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x22');break;case _0xe2b8('0x23'):_0xe5ebe5[_0xe2b8('0x11')]='ChatWebsite';break;case _0xe2b8('0x24'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x25');break;case _0xe2b8('0x26'):_0xe5ebe5[_0xe2b8('0x11')]='FaxAccount';break;case _0xe2b8('0x27'):case'internalroutes':case _0xe2b8('0x28'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x29');break;case _0xe2b8('0x2a'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x2b');break;case'voicemails':_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x2c');break;case _0xe2b8('0x2d'):_0xe5ebe5[_0xe2b8('0x11')]='VoiceRecording';_0xe5ebe5['parentSections']=[{'name':'Agents','field':_0xe2b8('0x2e'),'foreignKey':_0xe2b8('0x2f'),'model':_0xe2b8('0x30'),'filter':{'field':_0xe2b8('0x31'),'value':[_0xe2b8('0x32')]}},{'name':_0xe2b8('0x33'),'field':_0xe2b8('0x2e'),'foreignKey':'membername','model':_0xe2b8('0x30'),'filter':{'field':_0xe2b8('0x31'),'value':['telephone']}},{'name':_0xe2b8('0x34'),'field':_0xe2b8('0x2e'),'foreignKey':_0xe2b8('0x35'),'model':_0xe2b8('0x36'),'filter':{'field':'type','value':[_0xe2b8('0x37')]}},{'name':_0xe2b8('0x38'),'field':_0xe2b8('0x2e'),'foreignKey':_0xe2b8('0x35'),'model':_0xe2b8('0x36'),'filter':{'field':'type','value':['outbound']}}];break;case _0xe2b8('0x39'):_0xe5ebe5['childModel']=_0xe2b8('0x3a');break;case _0xe2b8('0x3b'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x3c');break;case'voiceprefixes':_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x3d');break;case _0xe2b8('0x3e'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x3f');break;case _0xe2b8('0x40'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x41');break;case _0xe2b8('0x42'):_0xe5ebe5['childModel']=_0xe2b8('0x43');break;case _0xe2b8('0x44'):_0xe5ebe5[_0xe2b8('0x11')]='MailSubstatus';break;case'openchannelqueues':_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x45');break;case _0xe2b8('0x46'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x47');break;case _0xe2b8('0x48'):_0xe5ebe5[_0xe2b8('0x11')]='SmsQueue';break;case _0xe2b8('0x49'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x4a');break;case _0xe2b8('0x4b'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x4c');break;case'whatsappaccounts':_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x4d');break;case'teams':_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x4e');break;case _0xe2b8('0x4f'):case _0xe2b8('0x50'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x36');if(_0x339d90){_0xe5ebe5[_0xe2b8('0x15')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0xe2b8('0x51'):case _0xe2b8('0x52'):case _0xe2b8('0x53'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x30');if(_0x339d90){_0xe5ebe5[_0xe2b8('0x15')]=[{'name':_0xe2b8('0x54'),'filter':{'field':_0xe2b8('0x31'),'value':[_0xe2b8('0x55'),_0xe2b8('0x56')]},'ignore':!![]},{'name':_0xe2b8('0x57')},{'name':'Telephones'}];}break;case'zendeskaccounts':_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x58');break;case _0xe2b8('0x59'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x5a');break;case _0xe2b8('0x5b'):_0xe5ebe5[_0xe2b8('0x11')]='FreshdeskAccount';break;case _0xe2b8('0x5c'):_0xe5ebe5[_0xe2b8('0x11')]='SugarcrmAccount';break;case'deskaccounts':_0xe5ebe5[_0xe2b8('0x11')]='DeskAccount';break;case _0xe2b8('0x5d'):_0xe5ebe5[_0xe2b8('0x11')]='ZohoAccount';break;case _0xe2b8('0x5e'):_0xe5ebe5[_0xe2b8('0x11')]='User';break;case _0xe2b8('0x5f'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x60');break;case'dispositions':_0xe5ebe5['childModel']=_0xe2b8('0x61');break;case _0xe2b8('0x62'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x63');break;case _0xe2b8('0x64'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x65');break;case'pauses':_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x66');break;case'scheduler':_0xe5ebe5[_0xe2b8('0x11')]='Schedule';break;case _0xe2b8('0x67'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x68');break;case _0xe2b8('0x69'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x6a');break;case _0xe2b8('0x6b'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x6c');break;case _0xe2b8('0x6d'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x6e');break;case _0xe2b8('0x6f'):_0xe5ebe5[_0xe2b8('0x11')]='Trunk';break;case _0xe2b8('0x70'):_0xe5ebe5['childModel']=_0xe2b8('0x71');break;case _0xe2b8('0x72'):_0xe5ebe5['childModel']='Plugin';break;case _0xe2b8('0x73'):_0xe5ebe5['childModel']=_0xe2b8('0xc');_0xe5ebe5[_0xe2b8('0x15')]=[{'name':'Reports','field':'id','foreignKey':_0xe2b8('0x74')}];break;case'metrics':_0xe5ebe5['childModel']=_0xe2b8('0x75');break;case _0xe2b8('0x76'):_0xe5ebe5[_0xe2b8('0x11')]=_0xe2b8('0x4d');break;}return _0xe5ebe5;}function _0x462307(_0x1a0759,_0x13181f){var _0x1a2450=_0x1a0759[_0xe2b8('0x77')](0x0)[_0xe2b8('0x78')]()+_0x1a0759[_0xe2b8('0x79')](0x1);var _0xcec689={'type':_0x4b6c87[_0xe2b8('0x7a')][_0xe2b8('0x7b')]['SELECT'],'raw':!![]};return new BPromise(function(_0x3e663d,_0x4cca10){var _0x18806c=squel['select']()['field'](_0xe2b8('0x7c')+_0x1a2450+_0xe2b8('0x7d'),'id')[_0xe2b8('0x4')](_0xe2b8('0x7e'))[_0xe2b8('0x7f')](_0xe2b8('0x80')+_0x1a0759+_0xe2b8('0x81'),'ui')[_0xe2b8('0x82')]('ui.UserId\x20=\x20?',_0x13181f['id']);return _0x4b6c87[_0xe2b8('0x83')][_0xe2b8('0x84')](_0x18806c[_0xe2b8('0x85')](),_0xcec689)[_0xe2b8('0x7')](function(_0x1b6dc4){_0x13181f[_0x1a2450+'OpenTabs']=_0x1b6dc4;_0x3e663d(_0x1b6dc4);})['catch'](function(_0x248578){_0x4cca10(_0x248578);});});}return _0x2cae53[_0xe2b8('0x86')](_0xe2b8('0x87'),attributes,{'tableName':_0xe2b8('0x88'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x51e779){var _0x35564b={'raw':![],'where':{}};var _0x5c60a7={};var _0x534a57={'count':0x0,'rows':[]};var _0x23fcf7=_0x51e779[_0xe2b8('0x84')]['section'];var _0x2e2a6b=_0x51e779['query'][_0xe2b8('0x89')]||![];var _0x166da6=_0x300dc5(_0x23fcf7,_0x2e2a6b);if(!_0x166da6['childModel'])throw new Error(_0xe2b8('0x8a')+_0x23fcf7+'\x27');var _0x417e72=[{'name':_0x23fcf7}];if(!_[_0xe2b8('0x8b')](_0x166da6[_0xe2b8('0x15')]))_0x417e72=_0x166da6['parentSections'];var _0x1e70e0=[];for(var _0xb78396=0x0;_0xb78396<_0x417e72[_0xe2b8('0x8c')];_0xb78396++){_0x1e70e0['push'](_0x4b6c87['UserProfileSection'][_0xe2b8('0x8d')]({'where':{'userProfileId':_0x51e779[_0xe2b8('0x8e')]['id'],'name':_0x417e72[_0xb78396][_0xe2b8('0x2e')]},'raw':!![]}));}return Promise[_0xe2b8('0x8f')](_0x1e70e0)[_0xe2b8('0x7')](function(_0x97fa19){var _0x9dfc24=_[_0xe2b8('0x3')](_0x97fa19,function(_0x37b595){return _0x37b595?_0x37b595:undefined;});var _0x24c78d=_['filter'](_0x417e72,[_0xe2b8('0x90'),!![]]);var _0x11dbb5=_['isEmpty'](_0x9dfc24)&&_[_0xe2b8('0x8b')](_0x24c78d)?null:_[_0xe2b8('0x91')](_0x24c78d,_0x9dfc24);if(!_0x11dbb5)return null;var _0x4fa961=[];for(var _0x3a29cd=0x0;_0x3a29cd<_0x11dbb5[_0xe2b8('0x8c')];_0x3a29cd++){var _0x47524d=_[_0xe2b8('0x8d')](_0x417e72,function(_0x3b4893){return _0x11dbb5[_0x3a29cd]?_0x3b4893['name']===_0x11dbb5[_0x3a29cd]['name']:null;});if(_0x47524d){if(_0x11dbb5[_0x3a29cd][_0xe2b8('0x90')]){_0x4fa961['push'](_0x414d55(_0x166da6[_0xe2b8('0x11')],_0x11dbb5[_0x3a29cd]));}else{if(!_0x11dbb5[_0x3a29cd][_0xe2b8('0x92')]){_0x4fa961[_0xe2b8('0x93')](_0x481308(_0x47524d,_0x11dbb5[_0x3a29cd],_0x166da6[_0xe2b8('0x11')]));}else{if(_0x47524d[_0xe2b8('0xb')]){_0x4fa961[_0xe2b8('0x93')](_0x578e92(_0x47524d,_0x11dbb5[_0x3a29cd]));}}}}}return Promise['all'](_0x4fa961);})['then'](function(_0x2dc832){var _0x1d8a04=_0x2dc832;var _0x1749fc=null;if(_0x1d8a04){_0x1749fc=_0x1d8a04[_0xe2b8('0x8c')]===0x1?_0x1d8a04[0x0]:null;}if(!_0x1749fc&&!_0x1d8a04)return _0x534a57;var _0x5bad52=_0x4b6c87[_0x166da6[_0xe2b8('0x11')]][_0xe2b8('0x94')];_0x5c60a7[_0xe2b8('0xb')]=_['keys'](_0x5bad52);_0x5c60a7['query']=_[_0xe2b8('0x95')](_0x51e779[_0xe2b8('0x84')]);_0x5c60a7['filters']=_[_0xe2b8('0x96')](_0x5c60a7['model'],_0x5c60a7[_0xe2b8('0x84')]);_0x35564b[_0xe2b8('0x97')]=_[_0xe2b8('0x96')](_0x5c60a7[_0xe2b8('0xb')],qs[_0xe2b8('0x98')](_0x51e779[_0xe2b8('0x84')][_0xe2b8('0x98')]));_0x35564b[_0xe2b8('0x97')]=_0x35564b[_0xe2b8('0x97')][_0xe2b8('0x8c')]?_0x35564b['attributes']:_0x5c60a7[_0xe2b8('0xb')];if(!_0x51e779[_0xe2b8('0x84')][_0xe2b8('0x99')](_0xe2b8('0x9a'))){_0x35564b[_0xe2b8('0x9b')]=qs['limit'](_0x51e779[_0xe2b8('0x84')]['limit']);_0x35564b[_0xe2b8('0x9c')]=qs['offset'](_0x51e779['query'][_0xe2b8('0x9c')]);}_0x35564b['order']=qs[_0xe2b8('0x9d')](_0x51e779[_0xe2b8('0x84')][_0xe2b8('0x9d')]);_0x35564b[_0xe2b8('0x82')]=qs[_0xe2b8('0x9e')](_[_0xe2b8('0x9f')](_0x51e779['query'],_0x5c60a7['filters']));if(_0x51e779['query']['filter']){_0x35564b[_0xe2b8('0x82')]=_[_0xe2b8('0xa0')](_0x35564b[_0xe2b8('0x82')],{'$or':_[_0xe2b8('0x9')](_0x5bad52,function(_0x38d3ae){if(_0x38d3ae[_0xe2b8('0xe')][_0xe2b8('0xa1')]!=='VIRTUAL'){var _0x911875={};_0x911875[_0x38d3ae[_0xe2b8('0x4')]]={'$like':'%'+_0x51e779['query'][_0xe2b8('0x3')]+'%'};return _0x911875;}})});}var _0x2bd08e=[];if(_0x1749fc){var _0x3ee2c0=_['find'](_0x417e72,['name',_0x1749fc[_0xe2b8('0x2e')]]);if(_0x3ee2c0[_0xe2b8('0x4')]){var _0x29662e={};if(_0x166da6[_0xe2b8('0x11')]===_0xe2b8('0xc')){_0x29662e[_0x3ee2c0[_0xe2b8('0xa2')]]=_[_0xe2b8('0x9')](_0x1749fc[_0xe2b8('0x8')],'id');}else{_0x29662e[_0x3ee2c0[_0xe2b8('0xa2')]]=_0x1749fc[_0xe2b8('0x8')];}_0x2bd08e[_0xe2b8('0x93')](_0x29662e);}else{_0x35564b[_0xe2b8('0x82')]['id']=_0x1749fc[_0xe2b8('0x8')];}}else{for(var _0x45bd41=0x0;_0x45bd41<_0x1d8a04['length'];_0x45bd41++){var _0x3ee2c0=_[_0xe2b8('0x8d')](_0x417e72,[_0xe2b8('0x2e'),_0x1d8a04[_0x45bd41][_0xe2b8('0x2e')]]);if(_0x3ee2c0['field']){var _0x29662e={};_0x29662e[_0x3ee2c0[_0xe2b8('0xa2')]]=_0x1d8a04[_0x45bd41]['associatedResources'];_0x2bd08e['push'](_0x29662e);}else{if(!_0x35564b[_0xe2b8('0x82')]['id'])_0x35564b[_0xe2b8('0x82')]['id']=[];_0x1d8a04[_0x45bd41][_0xe2b8('0x8')][_0xe2b8('0xa3')](function(_0xb274ff){_0x35564b[_0xe2b8('0x82')]['id'][_0xe2b8('0x93')](_0xb274ff);});}}}if(!_['isEmpty'](_0x2bd08e)){_0x35564b['where']=_['merge'](_0x35564b[_0xe2b8('0x82')],{'$and':{'$or':_0x2bd08e}});}_0x35564b=_[_0xe2b8('0xa0')]({},_0x35564b,_0x51e779[_0xe2b8('0xa4')]);if(_0x1749fc&&!_0x1749fc[_0xe2b8('0x92')]&&_0x166da6['childModel']===_0xe2b8('0xc')){if(_0x51e779[_0xe2b8('0x84')][_0xe2b8('0xa5')]){_0x35564b[_0xe2b8('0xa6')]=[{'all':!![]}];}return _0x4b6c87[_0x166da6[_0xe2b8('0x11')]][_0xe2b8('0x6')](_0x35564b)['then'](function(_0x59c5df){var _0x5514a1=[];_0x59c5df[_0xe2b8('0xa3')](function(_0x2f612a){var _0xcda5f9;switch(_0x2f612a[_0xe2b8('0xa7')]){case _0xe2b8('0xa8'):_0xcda5f9=_['find'](_0x1749fc[_0xe2b8('0x8')],function(_0x1d2ba3){return _0x1d2ba3['id']===_0x2f612a[_0xe2b8('0x74')]&&_0x1d2ba3[_0xe2b8('0xe')]===_0xe2b8('0xa9');});break;case _0xe2b8('0xaa'):_0xcda5f9=_['find'](_0x1749fc['associatedResources'],function(_0x3650e3){return _0x3650e3['id']===_0x2f612a[_0xe2b8('0x74')]&&_0x3650e3[_0xe2b8('0xe')]==='CustomReports';});break;}if(_0xcda5f9)_0x5514a1[_0xe2b8('0x93')](_0x2f612a);});_0x534a57[_0xe2b8('0xab')]=_0x5514a1[_0xe2b8('0x8c')];_0x534a57[_0xe2b8('0xac')]=_0x5514a1;return _0x534a57;});}else{return _0x4b6c87[_0x166da6[_0xe2b8('0x11')]]['count']({'where':_0x35564b[_0xe2b8('0x82')]})['then'](function(_0x33a4bd){_0x534a57['count']=_0x33a4bd;if(_0x51e779['query'][_0xe2b8('0xa5')]){if(_0x166da6[_0xe2b8('0x11')]==='CmContact'){_0x35564b[_0xe2b8('0xa6')]=[{'model':_0x4b6c87[_0xe2b8('0x6a')],'as':_0xe2b8('0xad'),'attributes':['id',_0xe2b8('0x2e'),'color'],'required':_0x51e779[_0xe2b8('0x84')][_0xe2b8('0xae')]?!![]:![]},{'model':_0x4b6c87[_0xe2b8('0x6a')],'as':_0xe2b8('0xaf'),'attributes':['id','name','color'],'through':_0x51e779['query'][_0xe2b8('0xae')]?{'attributes':[],'where':{'TagId':_0x51e779[_0xe2b8('0x84')][_0xe2b8('0xae')]||undefined}}:{},'required':_0x51e779[_0xe2b8('0x84')][_0xe2b8('0xae')]?!![]:![]}];}else{_0x35564b[_0xe2b8('0xa6')]=[{'all':!![]}];}}return _0x4b6c87[_0x166da6[_0xe2b8('0x11')]][_0xe2b8('0x6')](_0x35564b);})[_0xe2b8('0x7')](function(_0x126dcf){_0x534a57[_0xe2b8('0xac')]=_0x126dcf;if(_0x23fcf7===_0xe2b8('0x57')&&_0x51e779[_0xe2b8('0x84')][_0xe2b8('0xb0')]==='true'){var _0x3a856c=[];for(var _0x4f6c10=0x0;_0x4f6c10<_0x534a57[_0xe2b8('0xac')][_0xe2b8('0x8c')];_0x4f6c10++){_0x3a856c['push'](_0x462307(_0xe2b8('0xb1'),_0x534a57[_0xe2b8('0xac')][_0x4f6c10][_0xe2b8('0xb2')]));_0x3a856c[_0xe2b8('0x93')](_0x462307(_0xe2b8('0xb3'),_0x534a57['rows'][_0x4f6c10][_0xe2b8('0xb2')]));_0x3a856c['push'](_0x462307(_0xe2b8('0xb4'),_0x534a57[_0xe2b8('0xac')][_0x4f6c10]['dataValues']));_0x3a856c[_0xe2b8('0x93')](_0x462307(_0xe2b8('0xb5'),_0x534a57['rows'][_0x4f6c10]['dataValues']));_0x3a856c[_0xe2b8('0x93')](_0x462307(_0xe2b8('0xb6'),_0x534a57[_0xe2b8('0xac')][_0x4f6c10][_0xe2b8('0xb2')]));_0x3a856c[_0xe2b8('0x93')](_0x462307(_0xe2b8('0xb7'),_0x534a57[_0xe2b8('0xac')][_0x4f6c10][_0xe2b8('0xb2')]));}return Promise[_0xe2b8('0x8f')](_0x3a856c)[_0xe2b8('0x7')](function(){return _0x534a57;});}return _0x534a57;});}});}}});}; \ No newline at end of file +var _0x29ce=['type','toLowerCase','squareprojects','childModel','SquareProject','odbc','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','JscriptyProject','contacts','ListId','CmList','companies','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','FaxQueue','internalroutes','outboundroutes','VoiceExtension','VoiceContext','VoiceMail','voicerecordings','VoiceRecording','membername','User','agent','Telephones','role','telephone','queue','VoiceQueue','inbound','QueueCampaigns','outbound','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','ivrcampaigns','Campaign','mailqueues','MailQueue','MailAccount','mailsubstatuses','OpenchannelQueue','smsqueues','SmsQueue','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','voicequeues','queuecampaigns','VoiceQueues','users','admin','user','Agents','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','customdashboards','intervals','scheduler','Sound','tags','Tag','Trigger','Trunk','Variable','plugins','extractedreports','Reports','reportId','metrics','AnalyticMetric','slice','Sequelize','InteractionId','ui.createdAt','from','_interactions','where','ui.UserId\x20=\x20?','sequelize','query','toString','OpenTabs','define','UserProfile','user_profiles','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','push','UserProfileSection','find','params','ignore','union','autoAssociation','rawAttributes','keys','filters','attributes','fields','nolimit','limit','order','sort','merge','VIRTUAL','foreignKey','options','include','default','custom','count','includeAll','CmContact','Tags','color','tag','ThroughTags','true','rows','chat','dataValues','fax','openchannel','whatsapp','all','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','value','findAll','then','associatedResources','map','model','name','catch','AnalyticExtractedReport','resourceId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x29ce,0x96));var _0xe29c=function(_0x1d29de,_0x3d62b2){_0x1d29de=_0x1d29de-0x0;var _0x289630=_0x29ce[_0x1d29de];return _0x289630;};'use strict';var _=require('lodash');var attributes=require(_0xe29c('0x0'));var qs=require(_0xe29c('0x1'));module[_0xe29c('0x2')]=function(_0x3bbebd){var _0x47f85b=_0x3bbebd['models'];function _0x4098db(_0x291b33,_0x7e8470){return new Promise(function(_0x2d5413,_0x4fe61b){if(!_0x7e8470)return _0x2d5413(null);var _0x3b4e22=_0x7e8470['filter']?{[_0x7e8470[_0xe29c('0x3')][_0xe29c('0x4')]]:_0x7e8470['filter'][_0xe29c('0x5')]}:undefined;return _0x47f85b[_0x291b33][_0xe29c('0x6')]({'where':_0x3b4e22,'raw':!![]})[_0xe29c('0x7')](function(_0x51fa98){_0x7e8470[_0xe29c('0x8')]=_[_0xe29c('0x9')](_0x51fa98,'id');_0x2d5413(_0x7e8470);})['catch'](function(_0x4e6017){_0x4fe61b(_0x4e6017);});});}function _0x3f50c5(_0x234e59,_0x1e296c){return new Promise(function(_0x56ff3f,_0x4c112b){var _0x596034=_0x234e59['filter']?{[_0x234e59['filter']['field']]:_0x234e59['filter'][_0xe29c('0x5')]}:undefined;return _0x47f85b[_0x234e59[_0xe29c('0xa')]]['findAll']({'where':_0x596034,'raw':!![]})[_0xe29c('0x7')](function(_0x5a6ef3){_0x1e296c[_0xe29c('0x8')]=_[_0xe29c('0x9')](_0x5a6ef3,function(_0x587cd5){return _0x587cd5[_0xe29c('0xb')];});_0x56ff3f(_0x1e296c);})[_0xe29c('0xc')](function(_0x5eb8a4){_0x4c112b(_0x5eb8a4);});});}function _0x2be2ce(_0x46d552,_0x1b3673,_0xf24289){if(!_0x1b3673)return resolve(null);return new Promise(function(_0x32f547,_0x278596){return _0x47f85b['UserProfileResource'][_0xe29c('0x6')]({'where':{'sectionId':_0x1b3673['id']},'raw':!![]})[_0xe29c('0x7')](function(_0x105d79){if(_0x46d552['field']&&_0x46d552['field']!=='id'){_0x1b3673['associatedResources']=_[_0xe29c('0x9')](_0x105d79,function(_0x4da008){return _0x4da008[_0x46d552[_0xe29c('0x4')]];});}else{if(_0xf24289===_0xe29c('0xd')){_0x1b3673['associatedResources']=_[_0xe29c('0x9')](_0x105d79,function(_0x3db17b){return{'id':_0x3db17b[_0xe29c('0xe')],'type':_0x3db17b[_0xe29c('0xf')]};});}else{_0x1b3673[_0xe29c('0x8')]=_[_0xe29c('0x9')](_0x105d79,function(_0xbe7115){return _0xbe7115[_0xe29c('0xe')];});}}_0x32f547(_0x1b3673);})[_0xe29c('0xc')](function(_0x20f9d3){_0x278596(_0x20f9d3);});});}function _0x3d72f1(_0x5d82c2,_0xd7d096){var _0x46dadd={'parentSections':[]};switch(_0x5d82c2[_0xe29c('0x10')]()){case _0xe29c('0x11'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x13');break;case _0xe29c('0x14'):_0x46dadd['childModel']=_0xe29c('0x15');break;case _0xe29c('0x16'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x17');_0x46dadd[_0xe29c('0x18')]=[{'name':_0xe29c('0x19'),'field':'name','foreignKey':'projectName'}];break;case'projects':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x1a');break;case _0xe29c('0x1b'):_0x46dadd[_0xe29c('0x12')]='CmContact';_0x46dadd['parentSections']=[{'name':'Lists','field':'id','foreignKey':_0xe29c('0x1c')}];break;case'lists':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x1d');break;case _0xe29c('0x1e'):_0x46dadd[_0xe29c('0x12')]='CmCompany';break;case _0xe29c('0x1f'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x20');break;case _0xe29c('0x21'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x22');break;case _0xe29c('0x23'):_0x46dadd['childModel']=_0xe29c('0x24');break;case'faxqueues':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x25');break;case'faxaccounts':_0x46dadd[_0xe29c('0x12')]='FaxAccount';break;case'inboundroutes':case _0xe29c('0x26'):case _0xe29c('0x27'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x28');break;case'contexts':_0x46dadd['childModel']=_0xe29c('0x29');break;case'voicemails':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x2a');break;case _0xe29c('0x2b'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x2c');_0x46dadd[_0xe29c('0x18')]=[{'name':'Agents','field':'name','foreignKey':_0xe29c('0x2d'),'model':_0xe29c('0x2e'),'filter':{'field':'role','value':[_0xe29c('0x2f')]}},{'name':_0xe29c('0x30'),'field':'name','foreignKey':_0xe29c('0x2d'),'model':_0xe29c('0x2e'),'filter':{'field':_0xe29c('0x31'),'value':[_0xe29c('0x32')]}},{'name':'VoiceQueues','field':'name','foreignKey':_0xe29c('0x33'),'model':_0xe29c('0x34'),'filter':{'field':_0xe29c('0xf'),'value':[_0xe29c('0x35')]}},{'name':_0xe29c('0x36'),'field':_0xe29c('0xb'),'foreignKey':'queue','model':_0xe29c('0x34'),'filter':{'field':_0xe29c('0xf'),'value':[_0xe29c('0x37')]}}];break;case'musiconholds':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x38');break;case _0xe29c('0x39'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x3a');break;case _0xe29c('0x3b'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x3c');break;case _0xe29c('0x3d'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x3e');break;case _0xe29c('0x3f'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x40');break;case'mailaccounts':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x41');break;case _0xe29c('0x42'):_0x46dadd['childModel']='MailSubstatus';break;case'openchannelqueues':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x43');break;case'openchannelaccounts':_0x46dadd[_0xe29c('0x12')]='OpenchannelAccount';break;case _0xe29c('0x44'):_0x46dadd['childModel']=_0xe29c('0x45');break;case _0xe29c('0x46'):_0x46dadd['childModel']='SmsAccount';break;case _0xe29c('0x47'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x48');break;case _0xe29c('0x49'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x4a');break;case'teams':_0x46dadd['childModel']='Team';break;case _0xe29c('0x4b'):case _0xe29c('0x4c'):_0x46dadd['childModel']='VoiceQueue';if(_0xd7d096){_0x46dadd[_0xe29c('0x18')]=[{'name':_0xe29c('0x4d')},{'name':'QueueCampaigns'}];}break;case _0xe29c('0x4e'):case'agents':case'telephones':_0x46dadd['childModel']=_0xe29c('0x2e');if(_0xd7d096){_0x46dadd[_0xe29c('0x18')]=[{'name':'Users','filter':{'field':_0xe29c('0x31'),'value':[_0xe29c('0x4f'),_0xe29c('0x50')]},'ignore':!![]},{'name':_0xe29c('0x51')},{'name':_0xe29c('0x30')}];}break;case _0xe29c('0x52'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x53');break;case _0xe29c('0x54'):_0x46dadd['childModel']=_0xe29c('0x55');break;case _0xe29c('0x56'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x57');break;case _0xe29c('0x58'):_0x46dadd[_0xe29c('0x12')]='SugarcrmAccount';break;case'deskaccounts':_0x46dadd[_0xe29c('0x12')]='DeskAccount';break;case'zohoaccounts':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x59');break;case _0xe29c('0x5a'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x2e');break;case _0xe29c('0x5b'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x5c');break;case'dispositions':_0x46dadd[_0xe29c('0x12')]='Disposition';break;case _0xe29c('0x5d'):_0x46dadd[_0xe29c('0x12')]='Dashboard';break;case _0xe29c('0x5e'):_0x46dadd['childModel']='Interval';break;case'pauses':_0x46dadd[_0xe29c('0x12')]='Pause';break;case _0xe29c('0x5f'):_0x46dadd['childModel']='Schedule';break;case'sounds':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x60');break;case _0xe29c('0x61'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x62');break;case'templates':_0x46dadd[_0xe29c('0x12')]='Template';break;case'triggers':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x63');break;case'trunks':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x64');break;case'variables':_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x65');break;case _0xe29c('0x66'):_0x46dadd['childModel']='Plugin';break;case _0xe29c('0x67'):_0x46dadd['childModel']='AnalyticExtractedReport';_0x46dadd[_0xe29c('0x18')]=[{'name':_0xe29c('0x68'),'field':'id','foreignKey':_0xe29c('0x69')}];break;case _0xe29c('0x6a'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x6b');break;case _0xe29c('0x49'):_0x46dadd[_0xe29c('0x12')]=_0xe29c('0x4a');break;}return _0x46dadd;}function _0x195e07(_0x1d7918,_0x54e35b){var _0x123508=_0x1d7918['charAt'](0x0)['toUpperCase']()+_0x1d7918[_0xe29c('0x6c')](0x1);var _0xb3355c={'type':_0x47f85b[_0xe29c('0x6d')]['QueryTypes']['SELECT'],'raw':!![]};return new BPromise(function(_0x13b95c,_0x5df8b8){var _0x45757c=squel['select']()[_0xe29c('0x4')]('ui.'+_0x123508+_0xe29c('0x6e'),'id')[_0xe29c('0x4')](_0xe29c('0x6f'))[_0xe29c('0x70')]('user_has_'+_0x1d7918+_0xe29c('0x71'),'ui')[_0xe29c('0x72')](_0xe29c('0x73'),_0x54e35b['id']);return _0x47f85b[_0xe29c('0x74')][_0xe29c('0x75')](_0x45757c[_0xe29c('0x76')](),_0xb3355c)['then'](function(_0x37df10){_0x54e35b[_0x123508+_0xe29c('0x77')]=_0x37df10;_0x13b95c(_0x37df10);})['catch'](function(_0x539976){_0x5df8b8(_0x539976);});});}return _0x3bbebd[_0xe29c('0x78')](_0xe29c('0x79'),attributes,{'tableName':_0xe29c('0x7a'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x2d4ff4){var _0x478392={'raw':![],'where':{}};var _0xebe524={};var _0x398a8e={'count':0x0,'rows':[]};var _0x33bacf=_0x2d4ff4['query']['section'];var _0x464fa4=_0x2d4ff4[_0xe29c('0x75')][_0xe29c('0x7b')]||![];var _0x3b77a0=_0x3d72f1(_0x33bacf,_0x464fa4);if(!_0x3b77a0[_0xe29c('0x12')])throw new Error(_0xe29c('0x7c')+_0x33bacf+'\x27');var _0x5285ce=[{'name':_0x33bacf}];if(!_[_0xe29c('0x7d')](_0x3b77a0[_0xe29c('0x18')]))_0x5285ce=_0x3b77a0['parentSections'];var _0xa49459=[];for(var _0x333d59=0x0;_0x333d59<_0x5285ce[_0xe29c('0x7e')];_0x333d59++){_0xa49459[_0xe29c('0x7f')](_0x47f85b[_0xe29c('0x80')][_0xe29c('0x81')]({'where':{'userProfileId':_0x2d4ff4[_0xe29c('0x82')]['id'],'name':_0x5285ce[_0x333d59][_0xe29c('0xb')]},'raw':!![]}));}return Promise['all'](_0xa49459)[_0xe29c('0x7')](function(_0x4c4aa3){var _0x17e3c6=_[_0xe29c('0x3')](_0x4c4aa3,function(_0x526d25){return _0x526d25?_0x526d25:undefined;});var _0x5c0937=_[_0xe29c('0x3')](_0x5285ce,[_0xe29c('0x83'),!![]]);var _0x1a0754=_[_0xe29c('0x7d')](_0x17e3c6)&&_['isEmpty'](_0x5c0937)?null:_[_0xe29c('0x84')](_0x5c0937,_0x17e3c6);if(!_0x1a0754)return null;var _0x356895=[];for(var _0x32cd0a=0x0;_0x32cd0a<_0x1a0754[_0xe29c('0x7e')];_0x32cd0a++){var _0x3fa9a9=_[_0xe29c('0x81')](_0x5285ce,function(_0x5d405a){return _0x1a0754[_0x32cd0a]?_0x5d405a[_0xe29c('0xb')]===_0x1a0754[_0x32cd0a]['name']:null;});if(_0x3fa9a9){if(_0x1a0754[_0x32cd0a][_0xe29c('0x83')]){_0x356895[_0xe29c('0x7f')](_0x4098db(_0x3b77a0[_0xe29c('0x12')],_0x1a0754[_0x32cd0a]));}else{if(!_0x1a0754[_0x32cd0a][_0xe29c('0x85')]){_0x356895[_0xe29c('0x7f')](_0x2be2ce(_0x3fa9a9,_0x1a0754[_0x32cd0a],_0x3b77a0[_0xe29c('0x12')]));}else{if(_0x3fa9a9[_0xe29c('0xa')]){_0x356895['push'](_0x3f50c5(_0x3fa9a9,_0x1a0754[_0x32cd0a]));}}}}}return Promise['all'](_0x356895);})[_0xe29c('0x7')](function(_0xe3309c){var _0x28c2bc=_0xe3309c;var _0x53f64a=null;if(_0x28c2bc){_0x53f64a=_0x28c2bc['length']===0x1?_0x28c2bc[0x0]:null;}if(!_0x53f64a&&!_0x28c2bc)return _0x398a8e;var _0x3bb99=_0x47f85b[_0x3b77a0['childModel']][_0xe29c('0x86')];_0xebe524[_0xe29c('0xa')]=_[_0xe29c('0x87')](_0x3bb99);_0xebe524[_0xe29c('0x75')]=_[_0xe29c('0x87')](_0x2d4ff4['query']);_0xebe524[_0xe29c('0x88')]=_['intersection'](_0xebe524[_0xe29c('0xa')],_0xebe524[_0xe29c('0x75')]);_0x478392[_0xe29c('0x89')]=_['intersection'](_0xebe524[_0xe29c('0xa')],qs[_0xe29c('0x8a')](_0x2d4ff4['query'][_0xe29c('0x8a')]));_0x478392[_0xe29c('0x89')]=_0x478392[_0xe29c('0x89')][_0xe29c('0x7e')]?_0x478392[_0xe29c('0x89')]:_0xebe524['model'];if(!_0x2d4ff4['query']['hasOwnProperty'](_0xe29c('0x8b'))){_0x478392[_0xe29c('0x8c')]=qs[_0xe29c('0x8c')](_0x2d4ff4[_0xe29c('0x75')][_0xe29c('0x8c')]);_0x478392['offset']=qs['offset'](_0x2d4ff4['query']['offset']);}_0x478392[_0xe29c('0x8d')]=qs[_0xe29c('0x8e')](_0x2d4ff4[_0xe29c('0x75')][_0xe29c('0x8e')]);_0x478392['where']=qs[_0xe29c('0x88')](_['pick'](_0x2d4ff4[_0xe29c('0x75')],_0xebe524['filters']));if(_0x2d4ff4['query'][_0xe29c('0x3')]){_0x478392[_0xe29c('0x72')]=_[_0xe29c('0x8f')](_0x478392['where'],{'$or':_[_0xe29c('0x9')](_0x3bb99,function(_0xc0098f){if(_0xc0098f[_0xe29c('0xf')]['key']!==_0xe29c('0x90')){var _0x2d807e={};_0x2d807e[_0xc0098f[_0xe29c('0x4')]]={'$like':'%'+_0x2d4ff4['query']['filter']+'%'};return _0x2d807e;}})});}var _0x57cda8=[];if(_0x53f64a){var _0x4529f4=_[_0xe29c('0x81')](_0x5285ce,[_0xe29c('0xb'),_0x53f64a[_0xe29c('0xb')]]);if(_0x4529f4[_0xe29c('0x4')]){var _0x4ec830={};if(_0x3b77a0[_0xe29c('0x12')]===_0xe29c('0xd')){_0x4ec830[_0x4529f4[_0xe29c('0x91')]]=_[_0xe29c('0x9')](_0x53f64a['associatedResources'],'id');}else{_0x4ec830[_0x4529f4[_0xe29c('0x91')]]=_0x53f64a[_0xe29c('0x8')];}_0x57cda8[_0xe29c('0x7f')](_0x4ec830);}else{_0x478392['where']['id']=_0x53f64a[_0xe29c('0x8')];}}else{for(var _0x5a834d=0x0;_0x5a834d<_0x28c2bc[_0xe29c('0x7e')];_0x5a834d++){var _0x4529f4=_['find'](_0x5285ce,['name',_0x28c2bc[_0x5a834d][_0xe29c('0xb')]]);if(_0x4529f4[_0xe29c('0x4')]){var _0x4ec830={};_0x4ec830[_0x4529f4['foreignKey']]=_0x28c2bc[_0x5a834d][_0xe29c('0x8')];_0x57cda8[_0xe29c('0x7f')](_0x4ec830);}else{if(!_0x478392[_0xe29c('0x72')]['id'])_0x478392['where']['id']=[];_0x28c2bc[_0x5a834d][_0xe29c('0x8')]['forEach'](function(_0x17221b){_0x478392['where']['id'][_0xe29c('0x7f')](_0x17221b);});}}}if(!_[_0xe29c('0x7d')](_0x57cda8)){_0x478392[_0xe29c('0x72')]=_[_0xe29c('0x8f')](_0x478392[_0xe29c('0x72')],{'$and':{'$or':_0x57cda8}});}_0x478392=_[_0xe29c('0x8f')]({},_0x478392,_0x2d4ff4[_0xe29c('0x92')]);if(_0x53f64a&&!_0x53f64a[_0xe29c('0x85')]&&_0x3b77a0[_0xe29c('0x12')]===_0xe29c('0xd')){if(_0x2d4ff4[_0xe29c('0x75')]['includeAll']){_0x478392[_0xe29c('0x93')]=[{'all':!![]}];}return _0x47f85b[_0x3b77a0[_0xe29c('0x12')]][_0xe29c('0x6')](_0x478392)[_0xe29c('0x7')](function(_0x45779d){var _0x4d0bf6=[];_0x45779d['forEach'](function(_0x1491f3){var _0x23cc48;switch(_0x1491f3['reportType']){case _0xe29c('0x94'):_0x23cc48=_['find'](_0x53f64a['associatedResources'],function(_0x3dfb1a){return _0x3dfb1a['id']===_0x1491f3[_0xe29c('0x69')]&&_0x3dfb1a[_0xe29c('0xf')]==='DefaultReports';});break;case _0xe29c('0x95'):_0x23cc48=_[_0xe29c('0x81')](_0x53f64a['associatedResources'],function(_0x4279c5){return _0x4279c5['id']===_0x1491f3['reportId']&&_0x4279c5[_0xe29c('0xf')]==='CustomReports';});break;}if(_0x23cc48)_0x4d0bf6[_0xe29c('0x7f')](_0x1491f3);});_0x398a8e[_0xe29c('0x96')]=_0x4d0bf6[_0xe29c('0x7e')];_0x398a8e['rows']=_0x4d0bf6;return _0x398a8e;});}else{return _0x47f85b[_0x3b77a0[_0xe29c('0x12')]][_0xe29c('0x96')]({'where':_0x478392[_0xe29c('0x72')]})[_0xe29c('0x7')](function(_0x61d21){_0x398a8e[_0xe29c('0x96')]=_0x61d21;if(_0x2d4ff4[_0xe29c('0x75')][_0xe29c('0x97')]){if(_0x3b77a0[_0xe29c('0x12')]===_0xe29c('0x98')){_0x478392[_0xe29c('0x93')]=[{'model':_0x47f85b[_0xe29c('0x62')],'as':_0xe29c('0x99'),'attributes':['id',_0xe29c('0xb'),_0xe29c('0x9a')],'required':_0x2d4ff4['query'][_0xe29c('0x9b')]?!![]:![]},{'model':_0x47f85b['Tag'],'as':_0xe29c('0x9c'),'attributes':['id',_0xe29c('0xb'),_0xe29c('0x9a')],'through':_0x2d4ff4[_0xe29c('0x75')][_0xe29c('0x9b')]?{'attributes':[],'where':{'TagId':_0x2d4ff4[_0xe29c('0x75')][_0xe29c('0x9b')]||undefined}}:{},'required':_0x2d4ff4[_0xe29c('0x75')][_0xe29c('0x9b')]?!![]:![]}];}else{_0x478392[_0xe29c('0x93')]=[{'all':!![]}];}}return _0x47f85b[_0x3b77a0['childModel']]['findAll'](_0x478392);})[_0xe29c('0x7')](function(_0x1e9d8d){_0x398a8e['rows']=_0x1e9d8d;if(_0x33bacf===_0xe29c('0x51')&&_0x2d4ff4[_0xe29c('0x75')]['openTabs']===_0xe29c('0x9d')){var _0x4a7b80=[];for(var _0x743397=0x0;_0x743397<_0x398a8e[_0xe29c('0x9e')][_0xe29c('0x7e')];_0x743397++){_0x4a7b80['push'](_0x195e07(_0xe29c('0x9f'),_0x398a8e['rows'][_0x743397]['dataValues']));_0x4a7b80['push'](_0x195e07('sms',_0x398a8e['rows'][_0x743397][_0xe29c('0xa0')]));_0x4a7b80[_0xe29c('0x7f')](_0x195e07(_0xe29c('0xa1'),_0x398a8e[_0xe29c('0x9e')][_0x743397][_0xe29c('0xa0')]));_0x4a7b80[_0xe29c('0x7f')](_0x195e07('mail',_0x398a8e[_0xe29c('0x9e')][_0x743397][_0xe29c('0xa0')]));_0x4a7b80[_0xe29c('0x7f')](_0x195e07(_0xe29c('0xa2'),_0x398a8e['rows'][_0x743397]['dataValues']));_0x4a7b80[_0xe29c('0x7f')](_0x195e07(_0xe29c('0xa3'),_0x398a8e['rows'][_0x743397][_0xe29c('0xa0')]));}return Promise[_0xe29c('0xa4')](_0x4a7b80)[_0xe29c('0x7')](function(){return _0x398a8e;});}return _0x398a8e;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 2fae72d..14fbb93 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 _0xbedb=['error','code','message','result','catch','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','UserProfile,\x20%s,\x20%s','debug','request\x20sent','stringify'];(function(_0x1b25a1,_0x5e1498){var _0xae88d7=function(_0x2a6926){while(--_0x2a6926){_0x1b25a1['push'](_0x1b25a1['shift']());}};_0xae88d7(++_0x5e1498);}(_0xbedb,0x12e));var _0xbbed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xbedb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xbbed('0x0'));var util=require('util');var moment=require(_0xbbed('0x1'));var BPromise=require(_0xbbed('0x2'));var rs=require(_0xbbed('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbbed('0x4'));var logger=require(_0xbbed('0x5'))(_0xbbed('0x6'));var config=require(_0xbbed('0x7'));var jayson=require(_0xbbed('0x8'));var client=jayson[_0xbbed('0x9')][_0xbbed('0xa')]({'port':0x232a});config[_0xbbed('0xb')]=_[_0xbbed('0xc')](config[_0xbbed('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xbbed('0xd'))(new Redis(config['redis']));require('./userProfile.socket')[_0xbbed('0xe')](socket);function respondWithRpcPromise(_0x457c11,_0x34709f,_0x5f1b17){return new BPromise(function(_0x4a67ca,_0x22a117){return client[_0xbbed('0xf')](_0x457c11,_0x5f1b17)[_0xbbed('0x10')](function(_0xc8378c){logger[_0xbbed('0x11')](_0xbbed('0x12'),_0x34709f,'request\x20sent');logger[_0xbbed('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x34709f,_0xbbed('0x14'),JSON[_0xbbed('0x15')](_0xc8378c));if(_0xc8378c[_0xbbed('0x16')]){if(_0xc8378c[_0xbbed('0x16')][_0xbbed('0x17')]===0x1f4){logger[_0xbbed('0x16')](_0xbbed('0x12'),_0x34709f,_0xc8378c[_0xbbed('0x16')][_0xbbed('0x18')]);return _0x22a117(_0xc8378c[_0xbbed('0x16')]['message']);}logger[_0xbbed('0x16')]('UserProfile,\x20%s,\x20%s',_0x34709f,_0xc8378c[_0xbbed('0x16')][_0xbbed('0x18')]);return _0x4a67ca(_0xc8378c[_0xbbed('0x16')][_0xbbed('0x18')]);}else{logger[_0xbbed('0x11')]('UserProfile,\x20%s,\x20%s',_0x34709f,_0xbbed('0x14'));_0x4a67ca(_0xc8378c[_0xbbed('0x19')][_0xbbed('0x18')]);}})[_0xbbed('0x1a')](function(_0x178bfd){logger[_0xbbed('0x16')](_0xbbed('0x12'),_0x34709f,_0x178bfd);_0x22a117(_0x178bfd);});});} \ No newline at end of file +var _0xd1f1=['UserProfile,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent'];(function(_0x1534d1,_0x2de47d){var _0x297e4c=function(_0x5f1e2f){while(--_0x5f1e2f){_0x1534d1['push'](_0x1534d1['shift']());}};_0x297e4c(++_0x2de47d);}(_0xd1f1,0xbc));var _0x1d1f=function(_0x350277,_0x25d306){_0x350277=_0x350277-0x0;var _0x5e418b=_0xd1f1[_0x350277];return _0x5e418b;};'use strict';var _=require(_0x1d1f('0x0'));var util=require(_0x1d1f('0x1'));var moment=require('moment');var BPromise=require(_0x1d1f('0x2'));var rs=require(_0x1d1f('0x3'));var fs=require('fs');var Redis=require(_0x1d1f('0x4'));var db=require(_0x1d1f('0x5'))['db'];var utils=require(_0x1d1f('0x6'));var logger=require(_0x1d1f('0x7'))(_0x1d1f('0x8'));var config=require('../../config/environment');var jayson=require(_0x1d1f('0x9'));var client=jayson[_0x1d1f('0xa')][_0x1d1f('0xb')]({'port':0x232a});config[_0x1d1f('0xc')]=_[_0x1d1f('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1d1f('0xc')]));require(_0x1d1f('0xe'))[_0x1d1f('0xf')](socket);function respondWithRpcPromise(_0x18ac32,_0x5a640d,_0x474a28){return new BPromise(function(_0x3f1a34,_0x220282){return client[_0x1d1f('0x10')](_0x18ac32,_0x474a28)[_0x1d1f('0x11')](function(_0x5f39fe){logger['info'](_0x1d1f('0x12'),_0x5a640d,_0x1d1f('0x13'));logger['debug'](_0x1d1f('0x14'),_0x5a640d,_0x1d1f('0x13'),JSON[_0x1d1f('0x15')](_0x5f39fe));if(_0x5f39fe[_0x1d1f('0x16')]){if(_0x5f39fe['error'][_0x1d1f('0x17')]===0x1f4){logger[_0x1d1f('0x16')](_0x1d1f('0x12'),_0x5a640d,_0x5f39fe[_0x1d1f('0x16')][_0x1d1f('0x18')]);return _0x220282(_0x5f39fe[_0x1d1f('0x16')][_0x1d1f('0x18')]);}logger[_0x1d1f('0x16')](_0x1d1f('0x12'),_0x5a640d,_0x5f39fe[_0x1d1f('0x16')][_0x1d1f('0x18')]);return _0x3f1a34(_0x5f39fe[_0x1d1f('0x16')][_0x1d1f('0x18')]);}else{logger[_0x1d1f('0x19')]('UserProfile,\x20%s,\x20%s',_0x5a640d,'request\x20sent');_0x3f1a34(_0x5f39fe['result'][_0x1d1f('0x18')]);}})['catch'](function(_0x1300b0){logger['error']('UserProfile,\x20%s,\x20%s',_0x5a640d,_0x1300b0);_0x220282(_0x1300b0);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index 21f34a0..f308adf 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 _0xadc7=['register','length','userProfile:','./userProfile.events','save','remove','update','removeListener'];(function(_0x604253,_0x332579){var _0x3a9fc3=function(_0x4f2cad){while(--_0x4f2cad){_0x604253['push'](_0x604253['shift']());}};_0x3a9fc3(++_0x332579);}(_0xadc7,0x113));var _0x7adc=function(_0x70504d,_0x34e810){_0x70504d=_0x70504d-0x0;var _0x47e29b=_0xadc7[_0x70504d];return _0x47e29b;};'use strict';var UserProfileEvents=require(_0x7adc('0x0'));var events=[_0x7adc('0x1'),_0x7adc('0x2'),_0x7adc('0x3')];function createListener(_0x3afa8f,_0x3a1995){return function(_0x228d66){_0x3a1995['emit'](_0x3afa8f,_0x228d66);};}function removeListener(_0x5f1563,_0x112d67){return function(){UserProfileEvents[_0x7adc('0x4')](_0x5f1563,_0x112d67);};}exports[_0x7adc('0x5')]=function(_0x11e8f5){for(var _0xd067de=0x0,_0x27ffe8=events[_0x7adc('0x6')];_0xd067de<_0x27ffe8;_0xd067de++){var _0x10ea9f=events[_0xd067de];var _0x65785b=createListener(_0x7adc('0x7')+_0x10ea9f,_0x11e8f5);UserProfileEvents['on'](_0x10ea9f,_0x65785b);}}; \ No newline at end of file +var _0x0d85=['./userProfile.events','save','remove','update','userProfile:'];(function(_0x3359a7,_0x38ab8c){var _0x5b4f1a=function(_0x75cdbf){while(--_0x75cdbf){_0x3359a7['push'](_0x3359a7['shift']());}};_0x5b4f1a(++_0x38ab8c);}(_0x0d85,0x7d));var _0x50d8=function(_0x45d0a4,_0x3a21d4){_0x45d0a4=_0x45d0a4-0x0;var _0x296156=_0x0d85[_0x45d0a4];return _0x296156;};'use strict';var UserProfileEvents=require(_0x50d8('0x0'));var events=[_0x50d8('0x1'),_0x50d8('0x2'),_0x50d8('0x3')];function createListener(_0x135a47,_0x41fa1f){return function(_0x3e98f1){_0x41fa1f['emit'](_0x135a47,_0x3e98f1);};}function removeListener(_0x578f96,_0x12a88c){return function(){UserProfileEvents['removeListener'](_0x578f96,_0x12a88c);};}exports['register']=function(_0x843ff6){for(var _0xe0ed4c=0x0,_0x496542=events['length'];_0xe0ed4c<_0x496542;_0xe0ed4c++){var _0x35db7c=events[_0xe0ed4c];var _0x141433=createListener(_0x50d8('0x4')+_0x35db7c,_0x843ff6);UserProfileEvents['on'](_0x35db7c,_0x141433);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index a27253d..dc2c5f3 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 _0x2e06=['show','post','create','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./userProfileResource.controller','isAuthenticated','index','get','/:id'];(function(_0x31b9cf,_0x1a809b){var _0x357b8a=function(_0x50a273){while(--_0x50a273){_0x31b9cf['push'](_0x31b9cf['shift']());}};_0x357b8a(++_0x1a809b);}(_0x2e06,0x1b6));var _0x62e0=function(_0xb20cc4,_0x37d7c2){_0xb20cc4=_0xb20cc4-0x0;var _0x45e7d3=_0x2e06[_0xb20cc4];return _0x45e7d3;};'use strict';var multer=require('multer');var util=require(_0x62e0('0x0'));var path=require(_0x62e0('0x1'));var timeout=require(_0x62e0('0x2'));var express=require(_0x62e0('0x3'));var router=express[_0x62e0('0x4')]();var fs_extra=require(_0x62e0('0x5'));var auth=require(_0x62e0('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x62e0('0x7'));router['get']('/',auth[_0x62e0('0x8')](),controller[_0x62e0('0x9')]);router[_0x62e0('0xa')]('/describe',auth[_0x62e0('0x8')](),controller['describe']);router[_0x62e0('0xa')](_0x62e0('0xb'),auth['isAuthenticated'](),controller[_0x62e0('0xc')]);router[_0x62e0('0xd')]('/',auth['isAuthenticated'](),controller[_0x62e0('0xe')]);router[_0x62e0('0xf')](_0x62e0('0xb'),auth[_0x62e0('0x8')](),controller['update']);router[_0x62e0('0x10')](_0x62e0('0xb'),auth[_0x62e0('0x8')](),controller['destroy']);module[_0x62e0('0x11')]=router; \ No newline at end of file +var _0x84dd=['isAuthenticated','describe','create','put','update','/:id','destroy','multer','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./userProfileResource.controller','get','index','/describe'];(function(_0x5c7525,_0x39490f){var _0x2e2ec8=function(_0x20d59a){while(--_0x20d59a){_0x5c7525['push'](_0x5c7525['shift']());}};_0x2e2ec8(++_0x39490f);}(_0x84dd,0x16f));var _0xd84d=function(_0x29fba2,_0x1d2911){_0x29fba2=_0x29fba2-0x0;var _0x1a8e30=_0x84dd[_0x29fba2];return _0x1a8e30;};'use strict';var multer=require(_0xd84d('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd84d('0x1'));var express=require(_0xd84d('0x2'));var router=express[_0xd84d('0x3')]();var fs_extra=require(_0xd84d('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xd84d('0x5'));var config=require(_0xd84d('0x6'));var controller=require(_0xd84d('0x7'));router[_0xd84d('0x8')]('/',auth['isAuthenticated'](),controller[_0xd84d('0x9')]);router[_0xd84d('0x8')](_0xd84d('0xa'),auth[_0xd84d('0xb')](),controller[_0xd84d('0xc')]);router[_0xd84d('0x8')]('/:id',auth[_0xd84d('0xb')](),controller['show']);router['post']('/',auth[_0xd84d('0xb')](),controller[_0xd84d('0xd')]);router[_0xd84d('0xe')]('/:id',auth[_0xd84d('0xb')](),controller[_0xd84d('0xf')]);router['delete'](_0xd84d('0x10'),auth[_0xd84d('0xb')](),controller[_0xd84d('0x11')]);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 5a3deb0..3899daf 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 _0xd78c=['INTEGER','sequelize'];(function(_0xe9e8f9,_0xa250b8){var _0x28768e=function(_0x59087a){while(--_0x59087a){_0xe9e8f9['push'](_0xe9e8f9['shift']());}};_0x28768e(++_0xa250b8);}(_0xd78c,0x11d));var _0xcd78=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xd78c[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0xcd78('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize[_0xcd78('0x1')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x9af5=['sequelize','STRING','INTEGER'];(function(_0x266d8d,_0x47b1b3){var _0x160245=function(_0x3d0227){while(--_0x3d0227){_0x266d8d['push'](_0x266d8d['shift']());}};_0x160245(++_0x47b1b3);}(_0x9af5,0xf0));var _0x59af=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9af5[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x59af('0x0'));module['exports']={'name':{'type':Sequelize[_0x59af('0x1')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x59af('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x59af('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 0962f90..5d7975c 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 _0x47c5=['query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','map','VIRTUAL','filter','merge','count','includeAll','include','findAll','show','params','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','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','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','destroy','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','key','model'];(function(_0x3ccff6,_0x56c5f3){var _0x28e1cc=function(_0x164f88){while(--_0x164f88){_0x3ccff6['push'](_0x3ccff6['shift']());}};_0x28e1cc(++_0x56c5f3);}(_0x47c5,0x165));var _0x547c=function(_0xcb48ca,_0x540ecb){_0xcb48ca=_0xcb48ca-0x0;var _0x37be10=_0x47c5[_0xcb48ca];return _0x37be10;};'use strict';var emlformat=require(_0x547c('0x0'));var rimraf=require(_0x547c('0x1'));var zipdir=require(_0x547c('0x2'));var jsonpatch=require(_0x547c('0x3'));var rp=require(_0x547c('0x4'));var moment=require(_0x547c('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x547c('0x6'));var util=require(_0x547c('0x7'));var path=require('path');var sox=require(_0x547c('0x8'));var csv=require(_0x547c('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x547c('0xa'));var _=require(_0x547c('0xb'));var squel=require(_0x547c('0xc'));var crypto=require(_0x547c('0xd'));var jsforce=require(_0x547c('0xe'));var deskjs=require(_0x547c('0xf'));var toCsv=require(_0x547c('0x9'));var querystring=require(_0x547c('0x10'));var Papa=require(_0x547c('0x11'));var Redis=require(_0x547c('0x12'));var authService=require(_0x547c('0x13'));var qs=require(_0x547c('0x14'));var as=require(_0x547c('0x15'));var hardwareService=require(_0x547c('0x16'));var logger=require(_0x547c('0x17'))(_0x547c('0x18'));var utils=require(_0x547c('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0x547c('0x1a'));var db=require(_0x547c('0x1b'))['db'];function respondWithStatusCode(_0x5eea67,_0x436c19){_0x436c19=_0x436c19||0xcc;return function(_0x201d95){if(_0x201d95){return _0x5eea67[_0x547c('0x1c')](_0x436c19);}return _0x5eea67[_0x547c('0x1d')](_0x436c19)[_0x547c('0x1e')]();};}function respondWithResult(_0x150317,_0x2bc289){_0x2bc289=_0x2bc289||0xc8;return function(_0xa3c7b0){if(_0xa3c7b0){return _0x150317[_0x547c('0x1d')](_0x2bc289)[_0x547c('0x1f')](_0xa3c7b0);}};}function respondWithFilteredResult(_0x240243,_0x103455){return function(_0x39f316){if(_0x39f316){var _0x23644b=typeof _0x103455[_0x547c('0x20')]===_0x547c('0x21')&&typeof _0x103455[_0x547c('0x22')]===_0x547c('0x21');var _0x49acca=_0x39f316['count'];var _0x23fa9e=_0x23644b?0x0:_0x103455[_0x547c('0x20')];var _0xeb059e=_0x23644b?_0x39f316['count']:_0x103455[_0x547c('0x20')]+_0x103455[_0x547c('0x22')];var _0x1ddbd3;if(_0xeb059e>=_0x49acca){_0xeb059e=_0x49acca;_0x1ddbd3=0xc8;}else{_0x1ddbd3=0xce;}_0x240243['status'](_0x1ddbd3);return _0x240243[_0x547c('0x23')](_0x547c('0x24'),_0x23fa9e+'-'+_0xeb059e+'/'+_0x49acca)['json'](_0x39f316);}return null;};}function patchUpdates(_0x5453f9){return function(_0x35040a){try{jsonpatch[_0x547c('0x25')](_0x35040a,_0x5453f9,!![]);}catch(_0x4f20c1){return BPromise[_0x547c('0x26')](_0x4f20c1);}return _0x35040a[_0x547c('0x27')]();};}function saveUpdates(_0x592e46,_0x2e317a){return function(_0x17fd97){if(_0x17fd97){return _0x17fd97[_0x547c('0x28')](_0x592e46)['then'](function(_0x3a55a0){return _0x3a55a0;});}return null;};}function removeEntity(_0x361c5c,_0x470694){return function(_0x26823c){if(_0x26823c){return _0x26823c[_0x547c('0x29')]()[_0x547c('0x2a')](function(){_0x361c5c[_0x547c('0x1d')](0xcc)[_0x547c('0x1e')]();});}};}function handleEntityNotFound(_0x507895,_0x39c5f9){return function(_0x4c66b9){if(!_0x4c66b9){_0x507895['sendStatus'](0x194);}return _0x4c66b9;};}function handleError(_0x4855fd,_0x478f04){_0x478f04=_0x478f04||0x1f4;return function(_0x2c725d){logger['error'](_0x2c725d[_0x547c('0x2b')]);if(_0x2c725d['name']){delete _0x2c725d[_0x547c('0x2c')];}_0x4855fd['status'](_0x478f04)[_0x547c('0x2d')](_0x2c725d);};}exports[_0x547c('0x2e')]=function(_0x2389de,_0x30a96c){var _0x198afb={},_0x569924={},_0x575c74={'count':0x0,'rows':[]};var _0x28c282=_['map'](db[_0x547c('0x2f')][_0x547c('0x30')],function(_0x3e7652){return{'name':_0x3e7652[_0x547c('0x31')],'type':_0x3e7652[_0x547c('0x32')][_0x547c('0x33')]};});_0x569924[_0x547c('0x34')]=_['map'](_0x28c282,'name');_0x569924[_0x547c('0x35')]=_[_0x547c('0x36')](_0x2389de[_0x547c('0x35')]);_0x569924[_0x547c('0x37')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],_0x569924[_0x547c('0x35')]);_0x198afb[_0x547c('0x39')]=_[_0x547c('0x38')](_0x569924[_0x547c('0x34')],qs[_0x547c('0x3a')](_0x2389de[_0x547c('0x35')][_0x547c('0x3a')]));_0x198afb[_0x547c('0x39')]=_0x198afb['attributes'][_0x547c('0x3b')]?_0x198afb['attributes']:_0x569924['model'];if(!_0x2389de['query'][_0x547c('0x3c')](_0x547c('0x3d'))){_0x198afb[_0x547c('0x22')]=qs[_0x547c('0x22')](_0x2389de[_0x547c('0x35')][_0x547c('0x22')]);_0x198afb['offset']=qs['offset'](_0x2389de['query'][_0x547c('0x20')]);}_0x198afb[_0x547c('0x3e')]=qs[_0x547c('0x3f')](_0x2389de[_0x547c('0x35')][_0x547c('0x3f')]);_0x198afb[_0x547c('0x40')]=qs['filters'](_[_0x547c('0x41')](_0x2389de['query'],_0x569924[_0x547c('0x37')]),_0x28c282);if(_0x2389de[_0x547c('0x35')]['filter']){_0x198afb[_0x547c('0x40')]=_['merge'](_0x198afb['where'],{'$or':_[_0x547c('0x42')](_0x28c282,function(_0x281d52){if(_0x281d52[_0x547c('0x32')]!==_0x547c('0x43')){var _0x4c36b9={};_0x4c36b9[_0x281d52['name']]={'$like':'%'+_0x2389de[_0x547c('0x35')][_0x547c('0x44')]+'%'};return _0x4c36b9;}})});}_0x198afb=_[_0x547c('0x45')]({},_0x198afb,_0x2389de['options']);var _0x3886ae={'where':_0x198afb[_0x547c('0x40')]};return db[_0x547c('0x2f')]['count'](_0x3886ae)[_0x547c('0x2a')](function(_0x3a6a0a){_0x575c74[_0x547c('0x46')]=_0x3a6a0a;if(_0x2389de['query'][_0x547c('0x47')]){_0x198afb[_0x547c('0x48')]=[{'all':!![]}];}return db['UserProfileResource'][_0x547c('0x49')](_0x198afb);})[_0x547c('0x2a')](function(_0x9c3cb2){_0x575c74['rows']=_0x9c3cb2;return _0x575c74;})[_0x547c('0x2a')](respondWithFilteredResult(_0x30a96c,_0x198afb))['catch'](handleError(_0x30a96c,null));};exports[_0x547c('0x4a')]=function(_0x5393a2,_0xb86f5f){var _0x414b9d={'raw':![],'where':{'id':_0x5393a2[_0x547c('0x4b')]['id']}},_0x3d37d7={};_0x3d37d7[_0x547c('0x34')]=_[_0x547c('0x36')](db['UserProfileResource']['rawAttributes']);_0x3d37d7[_0x547c('0x35')]=_[_0x547c('0x36')](_0x5393a2[_0x547c('0x35')]);_0x3d37d7['filters']=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],_0x3d37d7[_0x547c('0x35')]);_0x414b9d[_0x547c('0x39')]=_[_0x547c('0x38')](_0x3d37d7[_0x547c('0x34')],qs['fields'](_0x5393a2[_0x547c('0x35')][_0x547c('0x3a')]));_0x414b9d[_0x547c('0x39')]=_0x414b9d['attributes'][_0x547c('0x3b')]?_0x414b9d[_0x547c('0x39')]:_0x3d37d7[_0x547c('0x34')];if(_0x5393a2[_0x547c('0x35')]['includeAll']){_0x414b9d[_0x547c('0x48')]=[{'all':!![]}];}_0x414b9d=_['merge']({},_0x414b9d,_0x5393a2[_0x547c('0x4c')]);return db['UserProfileResource'][_0x547c('0x4d')](_0x414b9d)[_0x547c('0x2a')](handleEntityNotFound(_0xb86f5f,null))['then'](respondWithResult(_0xb86f5f,null))[_0x547c('0x4e')](handleError(_0xb86f5f,null));};exports[_0x547c('0x4f')]=function(_0xa005cc,_0x1ddf30){return db['UserProfileResource'][_0x547c('0x4f')](_0xa005cc['body'],{})['then'](respondWithResult(_0x1ddf30,0xc9))[_0x547c('0x4e')](handleError(_0x1ddf30,null));};exports[_0x547c('0x28')]=function(_0x3e3f52,_0x11a878){if(_0x3e3f52[_0x547c('0x50')]['id']){delete _0x3e3f52[_0x547c('0x50')]['id'];}return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x3e3f52[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x11a878,null))[_0x547c('0x2a')](saveUpdates(_0x3e3f52[_0x547c('0x50')],null))['then'](respondWithResult(_0x11a878,null))['catch'](handleError(_0x11a878,null));};exports[_0x547c('0x29')]=function(_0x21ea26,_0x48de6e){return db[_0x547c('0x2f')][_0x547c('0x4d')]({'where':{'id':_0x21ea26[_0x547c('0x4b')]['id']}})[_0x547c('0x2a')](handleEntityNotFound(_0x48de6e,null))[_0x547c('0x2a')](removeEntity(_0x48de6e,null))[_0x547c('0x4e')](handleError(_0x48de6e,null));};exports['describe']=function(_0x152982,_0x5258cf){return db[_0x547c('0x2f')][_0x547c('0x51')]()[_0x547c('0x2a')](respondWithResult(_0x5258cf,null))['catch'](handleError(_0x5258cf,null));}; \ No newline at end of file +var _0x1a37=['index','map','UserProfileResource','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','options','find','create','body','params','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','error','stack','name','send'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1a37,0xb4));var _0x71a3=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0x1a37[_0x23e7c1];return _0x1add43;};'use strict';var emlformat=require(_0x71a3('0x0'));var rimraf=require(_0x71a3('0x1'));var zipdir=require(_0x71a3('0x2'));var jsonpatch=require(_0x71a3('0x3'));var rp=require(_0x71a3('0x4'));var moment=require(_0x71a3('0x5'));var BPromise=require(_0x71a3('0x6'));var Mustache=require(_0x71a3('0x7'));var util=require(_0x71a3('0x8'));var path=require(_0x71a3('0x9'));var sox=require('sox');var csv=require(_0x71a3('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x71a3('0xb'));var _=require(_0x71a3('0xc'));var squel=require(_0x71a3('0xd'));var crypto=require(_0x71a3('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x71a3('0xf'));var Redis=require(_0x71a3('0x10'));var authService=require(_0x71a3('0x11'));var qs=require(_0x71a3('0x12'));var as=require(_0x71a3('0x13'));var hardwareService=require(_0x71a3('0x14'));var logger=require(_0x71a3('0x15'))(_0x71a3('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x71a3('0x17'))['db'];function respondWithStatusCode(_0x3830cb,_0x27e46d){_0x27e46d=_0x27e46d||0xcc;return function(_0x229134){if(_0x229134){return _0x3830cb[_0x71a3('0x18')](_0x27e46d);}return _0x3830cb[_0x71a3('0x19')](_0x27e46d)[_0x71a3('0x1a')]();};}function respondWithResult(_0x3b256c,_0x4dc4ed){_0x4dc4ed=_0x4dc4ed||0xc8;return function(_0x203ee1){if(_0x203ee1){return _0x3b256c[_0x71a3('0x19')](_0x4dc4ed)['json'](_0x203ee1);}};}function respondWithFilteredResult(_0x1743d7,_0x32591a){return function(_0x59021f){if(_0x59021f){var _0x4aa918=typeof _0x32591a[_0x71a3('0x1b')]===_0x71a3('0x1c')&&typeof _0x32591a[_0x71a3('0x1d')]===_0x71a3('0x1c');var _0x1af1bc=_0x59021f[_0x71a3('0x1e')];var _0x5d4dee=_0x4aa918?0x0:_0x32591a[_0x71a3('0x1b')];var _0x27bfb4=_0x4aa918?_0x59021f['count']:_0x32591a['offset']+_0x32591a[_0x71a3('0x1d')];var _0x250db3;if(_0x27bfb4>=_0x1af1bc){_0x27bfb4=_0x1af1bc;_0x250db3=0xc8;}else{_0x250db3=0xce;}_0x1743d7[_0x71a3('0x19')](_0x250db3);return _0x1743d7[_0x71a3('0x1f')](_0x71a3('0x20'),_0x5d4dee+'-'+_0x27bfb4+'/'+_0x1af1bc)['json'](_0x59021f);}return null;};}function patchUpdates(_0x1ab947){return function(_0x4156e1){try{jsonpatch[_0x71a3('0x21')](_0x4156e1,_0x1ab947,!![]);}catch(_0x3ea036){return BPromise[_0x71a3('0x22')](_0x3ea036);}return _0x4156e1['save']();};}function saveUpdates(_0x1af24b,_0x5bbaee){return function(_0x3bf78e){if(_0x3bf78e){return _0x3bf78e[_0x71a3('0x23')](_0x1af24b)[_0x71a3('0x24')](function(_0x21899d){return _0x21899d;});}return null;};}function removeEntity(_0x452bc4,_0x2847b4){return function(_0x5f33c5){if(_0x5f33c5){return _0x5f33c5[_0x71a3('0x25')]()[_0x71a3('0x24')](function(){_0x452bc4[_0x71a3('0x19')](0xcc)[_0x71a3('0x1a')]();});}};}function handleEntityNotFound(_0xb0f3aa,_0x4fd214){return function(_0x107fbd){if(!_0x107fbd){_0xb0f3aa[_0x71a3('0x18')](0x194);}return _0x107fbd;};}function handleError(_0x4c1a3d,_0x412746){_0x412746=_0x412746||0x1f4;return function(_0x515519){logger[_0x71a3('0x26')](_0x515519[_0x71a3('0x27')]);if(_0x515519[_0x71a3('0x28')]){delete _0x515519[_0x71a3('0x28')];}_0x4c1a3d[_0x71a3('0x19')](_0x412746)[_0x71a3('0x29')](_0x515519);};}exports[_0x71a3('0x2a')]=function(_0x242b85,_0x305eb1){var _0x3fc578={},_0x3ea7aa={},_0x228afa={'count':0x0,'rows':[]};var _0x51cde3=_[_0x71a3('0x2b')](db[_0x71a3('0x2c')][_0x71a3('0x2d')],function(_0x23ae85){return{'name':_0x23ae85['fieldName'],'type':_0x23ae85[_0x71a3('0x2e')][_0x71a3('0x2f')]};});_0x3ea7aa[_0x71a3('0x30')]=_[_0x71a3('0x2b')](_0x51cde3,_0x71a3('0x28'));_0x3ea7aa[_0x71a3('0x31')]=_[_0x71a3('0x32')](_0x242b85['query']);_0x3ea7aa[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],_0x3ea7aa[_0x71a3('0x31')]);_0x3fc578[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x3ea7aa[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x36')]));_0x3fc578[_0x71a3('0x35')]=_0x3fc578[_0x71a3('0x35')][_0x71a3('0x37')]?_0x3fc578['attributes']:_0x3ea7aa['model'];if(!_0x242b85[_0x71a3('0x31')][_0x71a3('0x38')]('nolimit')){_0x3fc578[_0x71a3('0x1d')]=qs[_0x71a3('0x1d')](_0x242b85['query'][_0x71a3('0x1d')]);_0x3fc578[_0x71a3('0x1b')]=qs[_0x71a3('0x1b')](_0x242b85[_0x71a3('0x31')][_0x71a3('0x1b')]);}_0x3fc578[_0x71a3('0x39')]=qs[_0x71a3('0x3a')](_0x242b85['query'][_0x71a3('0x3a')]);_0x3fc578[_0x71a3('0x3b')]=qs[_0x71a3('0x33')](_['pick'](_0x242b85[_0x71a3('0x31')],_0x3ea7aa[_0x71a3('0x33')]),_0x51cde3);if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]){_0x3fc578[_0x71a3('0x3b')]=_['merge'](_0x3fc578['where'],{'$or':_[_0x71a3('0x2b')](_0x51cde3,function(_0x2b3197){if(_0x2b3197[_0x71a3('0x2e')]!==_0x71a3('0x3d')){var _0x36ed2e={};_0x36ed2e[_0x2b3197['name']]={'$like':'%'+_0x242b85[_0x71a3('0x31')][_0x71a3('0x3c')]+'%'};return _0x36ed2e;}})});}_0x3fc578=_[_0x71a3('0x3e')]({},_0x3fc578,_0x242b85['options']);var _0x17c467={'where':_0x3fc578['where']};return db[_0x71a3('0x2c')][_0x71a3('0x1e')](_0x17c467)[_0x71a3('0x24')](function(_0x43c6d1){_0x228afa[_0x71a3('0x1e')]=_0x43c6d1;if(_0x242b85[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x3fc578[_0x71a3('0x40')]=[{'all':!![]}];}return db[_0x71a3('0x2c')][_0x71a3('0x41')](_0x3fc578);})['then'](function(_0xa49846){_0x228afa['rows']=_0xa49846;return _0x228afa;})[_0x71a3('0x24')](respondWithFilteredResult(_0x305eb1,_0x3fc578))[_0x71a3('0x42')](handleError(_0x305eb1,null));};exports[_0x71a3('0x43')]=function(_0x18974c,_0x59c7c9){var _0x412bce={'raw':![],'where':{'id':_0x18974c['params']['id']}},_0x4b4fde={};_0x4b4fde[_0x71a3('0x30')]=_[_0x71a3('0x32')](db[_0x71a3('0x2c')][_0x71a3('0x2d')]);_0x4b4fde['query']=_[_0x71a3('0x32')](_0x18974c[_0x71a3('0x31')]);_0x4b4fde[_0x71a3('0x33')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],_0x4b4fde[_0x71a3('0x31')]);_0x412bce[_0x71a3('0x35')]=_[_0x71a3('0x34')](_0x4b4fde[_0x71a3('0x30')],qs[_0x71a3('0x36')](_0x18974c[_0x71a3('0x31')][_0x71a3('0x36')]));_0x412bce[_0x71a3('0x35')]=_0x412bce[_0x71a3('0x35')][_0x71a3('0x37')]?_0x412bce[_0x71a3('0x35')]:_0x4b4fde['model'];if(_0x18974c[_0x71a3('0x31')][_0x71a3('0x3f')]){_0x412bce['include']=[{'all':!![]}];}_0x412bce=_[_0x71a3('0x3e')]({},_0x412bce,_0x18974c[_0x71a3('0x44')]);return db[_0x71a3('0x2c')][_0x71a3('0x45')](_0x412bce)[_0x71a3('0x24')](handleEntityNotFound(_0x59c7c9,null))['then'](respondWithResult(_0x59c7c9,null))['catch'](handleError(_0x59c7c9,null));};exports[_0x71a3('0x46')]=function(_0x4305ee,_0x51d20d){return db[_0x71a3('0x2c')][_0x71a3('0x46')](_0x4305ee[_0x71a3('0x47')],{})[_0x71a3('0x24')](respondWithResult(_0x51d20d,0xc9))[_0x71a3('0x42')](handleError(_0x51d20d,null));};exports[_0x71a3('0x23')]=function(_0x501a62,_0x1c9ba6){if(_0x501a62['body']['id']){delete _0x501a62[_0x71a3('0x47')]['id'];}return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x501a62[_0x71a3('0x48')]['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x1c9ba6,null))['then'](saveUpdates(_0x501a62[_0x71a3('0x47')],null))[_0x71a3('0x24')](respondWithResult(_0x1c9ba6,null))[_0x71a3('0x42')](handleError(_0x1c9ba6,null));};exports['destroy']=function(_0x6c34,_0x4e6423){return db[_0x71a3('0x2c')][_0x71a3('0x45')]({'where':{'id':_0x6c34['params']['id']}})[_0x71a3('0x24')](handleEntityNotFound(_0x4e6423,null))[_0x71a3('0x24')](removeEntity(_0x4e6423,null))[_0x71a3('0x42')](handleError(_0x4e6423,null));};exports[_0x71a3('0x49')]=function(_0x11391d,_0x3952c0){return db[_0x71a3('0x2c')]['describe']()[_0x71a3('0x24')](respondWithResult(_0x3952c0,null))['catch'](handleError(_0x3952c0,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index a2ff045..c2bbdba 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 _0xd1ad=['rimraf','./userProfileResource.attributes','exports','user_profile_has_resources','resourceId','sectionId','lodash','util','../../config/logger','api','moment','path'];(function(_0x37583b,_0x53f88b){var _0x3bdf64=function(_0x3487c1){while(--_0x3487c1){_0x37583b['push'](_0x37583b['shift']());}};_0x3bdf64(++_0x53f88b);}(_0xd1ad,0x1aa));var _0xdd1a=function(_0x5027b1,_0x1409a5){_0x5027b1=_0x5027b1-0x0;var _0x4a46cf=_0xd1ad[_0x5027b1];return _0x4a46cf;};'use strict';var _=require(_0xdd1a('0x0'));var util=require(_0xdd1a('0x1'));var logger=require(_0xdd1a('0x2'))(_0xdd1a('0x3'));var moment=require(_0xdd1a('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xdd1a('0x5'));var rimraf=require(_0xdd1a('0x6'));var config=require('../../config/environment');var attributes=require(_0xdd1a('0x7'));module[_0xdd1a('0x8')]=function(_0x4ab0c1,_0x3423db){return _0x4ab0c1['define']('UserProfileResource',attributes,{'tableName':_0xdd1a('0x9'),'paranoid':![],'indexes':[{'name':'compositeIndex','fields':[_0xdd1a('0xa'),_0xdd1a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x88fd=['moment','bluebird','rimraf','../../config/environment','./userProfileResource.attributes','exports','define','user_profile_has_resources','compositeIndex','sectionId','lodash','util','api'];(function(_0x3c9e74,_0x4334c5){var _0x4fea21=function(_0x5a2cbb){while(--_0x5a2cbb){_0x3c9e74['push'](_0x3c9e74['shift']());}};_0x4fea21(++_0x4334c5);}(_0x88fd,0x99));var _0xd88f=function(_0x305c27,_0x21c7d7){_0x305c27=_0x305c27-0x0;var _0x2ebe0d=_0x88fd[_0x305c27];return _0x2ebe0d;};'use strict';var _=require(_0xd88f('0x0'));var util=require(_0xd88f('0x1'));var logger=require('../../config/logger')(_0xd88f('0x2'));var moment=require(_0xd88f('0x3'));var BPromise=require(_0xd88f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xd88f('0x5'));var config=require(_0xd88f('0x6'));var attributes=require(_0xd88f('0x7'));module[_0xd88f('0x8')]=function(_0x295395,_0x31d40d){return _0x295395[_0xd88f('0x9')]('UserProfileResource',attributes,{'tableName':_0xd88f('0xa'),'paranoid':![],'indexes':[{'name':_0xd88f('0xb'),'fields':['resourceId',_0xd88f('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index f178432..d03c952 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 _0x1956=['util','moment','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash'];(function(_0x5dfe3d,_0x2f6e7b){var _0x5bb8da=function(_0x37cfe0){while(--_0x37cfe0){_0x5dfe3d['push'](_0x5dfe3d['shift']());}};_0x5bb8da(++_0x2f6e7b);}(_0x1956,0x18e));var _0x6195=function(_0x55c485,_0x3fe77e){_0x55c485=_0x55c485-0x0;var _0x6bb521=_0x1956[_0x55c485];return _0x6bb521;};'use strict';var _=require(_0x6195('0x0'));var util=require(_0x6195('0x1'));var moment=require(_0x6195('0x2'));var BPromise=require('bluebird');var rs=require(_0x6195('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6195('0x4'));var logger=require(_0x6195('0x5'))('rpc');var config=require(_0x6195('0x6'));var jayson=require(_0x6195('0x7'));var client=jayson[_0x6195('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x116eb0,_0x2b5e2e,_0x3a4f74){return new BPromise(function(_0x5b6170,_0x2d1736){return client[_0x6195('0x9')](_0x116eb0,_0x3a4f74)[_0x6195('0xa')](function(_0x3d4519){logger[_0x6195('0xb')](_0x6195('0xc'),_0x2b5e2e,_0x6195('0xd'));logger[_0x6195('0xe')]('UserProfileResource,\x20%s,\x20%s,\x20%s',_0x2b5e2e,_0x6195('0xd'),JSON[_0x6195('0xf')](_0x3d4519));if(_0x3d4519[_0x6195('0x10')]){if(_0x3d4519['error'][_0x6195('0x11')]===0x1f4){logger['error'](_0x6195('0xc'),_0x2b5e2e,_0x3d4519['error'][_0x6195('0x12')]);return _0x2d1736(_0x3d4519[_0x6195('0x10')][_0x6195('0x12')]);}logger[_0x6195('0x10')](_0x6195('0xc'),_0x2b5e2e,_0x3d4519['error'][_0x6195('0x12')]);return _0x5b6170(_0x3d4519[_0x6195('0x10')][_0x6195('0x12')]);}else{logger['info'](_0x6195('0xc'),_0x2b5e2e,_0x6195('0xd'));_0x5b6170(_0x3d4519[_0x6195('0x13')]['message']);}})[_0x6195('0x14')](function(_0x53d1e8){logger['error'](_0x6195('0xc'),_0x2b5e2e,_0x53d1e8);_0x2d1736(_0x53d1e8);});});} \ No newline at end of file +var _0x594e=['result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','request\x20sent','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code','UserProfileResource,\x20%s,\x20%s','message'];(function(_0x34a38f,_0x1b936f){var _0x379288=function(_0x4c18e9){while(--_0x4c18e9){_0x34a38f['push'](_0x34a38f['shift']());}};_0x379288(++_0x1b936f);}(_0x594e,0xe8));var _0xe594=function(_0x109f3d,_0x16ce86){_0x109f3d=_0x109f3d-0x0;var _0x1a39a8=_0x594e[_0x109f3d];return _0x1a39a8;};'use strict';var _=require(_0xe594('0x0'));var util=require(_0xe594('0x1'));var moment=require(_0xe594('0x2'));var BPromise=require(_0xe594('0x3'));var rs=require(_0xe594('0x4'));var fs=require('fs');var Redis=require(_0xe594('0x5'));var db=require(_0xe594('0x6'))['db'];var utils=require(_0xe594('0x7'));var logger=require('../../config/logger')(_0xe594('0x8'));var config=require('../../config/environment');var jayson=require(_0xe594('0x9'));var client=jayson[_0xe594('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1544b4,_0x6ac7ec,_0x3bf91e){return new BPromise(function(_0x2c4933,_0xbd52dc){return client[_0xe594('0xb')](_0x1544b4,_0x3bf91e)[_0xe594('0xc')](function(_0x8212b9){logger[_0xe594('0xd')]('UserProfileResource,\x20%s,\x20%s',_0x6ac7ec,_0xe594('0xe'));logger['debug'](_0xe594('0xf'),_0x6ac7ec,'request\x20sent',JSON[_0xe594('0x10')](_0x8212b9));if(_0x8212b9[_0xe594('0x11')]){if(_0x8212b9[_0xe594('0x11')][_0xe594('0x12')]===0x1f4){logger[_0xe594('0x11')](_0xe594('0x13'),_0x6ac7ec,_0x8212b9[_0xe594('0x11')][_0xe594('0x14')]);return _0xbd52dc(_0x8212b9['error'][_0xe594('0x14')]);}logger[_0xe594('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x6ac7ec,_0x8212b9['error']['message']);return _0x2c4933(_0x8212b9[_0xe594('0x11')][_0xe594('0x14')]);}else{logger[_0xe594('0xd')](_0xe594('0x13'),_0x6ac7ec,'request\x20sent');_0x2c4933(_0x8212b9[_0xe594('0x15')]['message']);}})[_0xe594('0x16')](function(_0x5ea5ea){logger[_0xe594('0x11')](_0xe594('0x13'),_0x6ac7ec,_0x5ea5ea);_0xbd52dc(_0x5ea5ea);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index 865f08d..456b91f 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 _0x75c1=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','isAuthenticated','index','/describe','describe','/:id','show','update','destroy'];(function(_0x3adbc3,_0x257306){var _0x194192=function(_0x3be1e6){while(--_0x3be1e6){_0x3adbc3['push'](_0x3adbc3['shift']());}};_0x194192(++_0x257306);}(_0x75c1,0xc6));var _0x175c=function(_0x48dba8,_0x2f95c1){_0x48dba8=_0x48dba8-0x0;var _0x2d4489=_0x75c1[_0x48dba8];return _0x2d4489;};'use strict';var multer=require(_0x175c('0x0'));var util=require(_0x175c('0x1'));var path=require(_0x175c('0x2'));var timeout=require(_0x175c('0x3'));var express=require(_0x175c('0x4'));var router=express['Router']();var fs_extra=require(_0x175c('0x5'));var auth=require(_0x175c('0x6'));var interaction=require(_0x175c('0x7'));var config=require('../../config/environment');var controller=require(_0x175c('0x8'));router[_0x175c('0x9')]('/',auth[_0x175c('0xa')](),controller[_0x175c('0xb')]);router[_0x175c('0x9')](_0x175c('0xc'),auth['isAuthenticated'](),controller[_0x175c('0xd')]);router[_0x175c('0x9')](_0x175c('0xe'),auth[_0x175c('0xa')](),controller[_0x175c('0xf')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x175c('0xe'),auth[_0x175c('0xa')](),controller[_0x175c('0x10')]);router['delete'](_0x175c('0xe'),auth[_0x175c('0xa')](),controller[_0x175c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x2a24=['../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service'];(function(_0x48c4ef,_0x319d44){var _0x435715=function(_0x925d50){while(--_0x925d50){_0x48c4ef['push'](_0x48c4ef['shift']());}};_0x435715(++_0x319d44);}(_0x2a24,0x19b));var _0x42a2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a24[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x42a2('0x0'));var util=require(_0x42a2('0x1'));var path=require(_0x42a2('0x2'));var timeout=require(_0x42a2('0x3'));var express=require('express');var router=express[_0x42a2('0x4')]();var fs_extra=require(_0x42a2('0x5'));var auth=require(_0x42a2('0x6'));var interaction=require(_0x42a2('0x7'));var config=require(_0x42a2('0x8'));var controller=require(_0x42a2('0x9'));router[_0x42a2('0xa')]('/',auth[_0x42a2('0xb')](),controller[_0x42a2('0xc')]);router[_0x42a2('0xa')]('/describe',auth[_0x42a2('0xb')](),controller['describe']);router[_0x42a2('0xa')](_0x42a2('0xd'),auth[_0x42a2('0xb')](),controller[_0x42a2('0xe')]);router[_0x42a2('0xf')]('/',auth[_0x42a2('0xb')](),controller[_0x42a2('0x10')]);router[_0x42a2('0x11')]('/:id',auth[_0x42a2('0xb')](),controller[_0x42a2('0x12')]);router[_0x42a2('0x13')]('/:id',auth[_0x42a2('0xb')](),controller[_0x42a2('0x14')]);module[_0x42a2('0x15')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index 3608166..3922da3 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 _0x58a4=['split','sequelize','exports','STRING','INTEGER','BOOLEAN','setDataValue','crudPermissions','join','getDataValue'];(function(_0x1404a8,_0x5b4e46){var _0x28a692=function(_0x5ae53e){while(--_0x5ae53e){_0x1404a8['push'](_0x1404a8['shift']());}};_0x28a692(++_0x5b4e46);}(_0x58a4,0xbf));var _0x458a=function(_0x3eff21,_0x5bf36c){_0x3eff21=_0x3eff21-0x0;var _0x1945bb=_0x58a4[_0x3eff21];return _0x1945bb;};'use strict';var Sequelize=require(_0x458a('0x0'));module[_0x458a('0x1')]={'name':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x458a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize[_0x458a('0x3')],'allowNull':![]},'enabled':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x458a('0x4')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x458a('0x2')],'set':function(_0x362079){this[_0x458a('0x5')](_0x458a('0x6'),_0x362079?_0x362079[_0x458a('0x7')](''):[]);},'get':function(){return this[_0x458a('0x8')]('crudPermissions')?this['getDataValue'](_0x458a('0x6'))[_0x458a('0x9')](''):[];}}}; \ No newline at end of file +var _0xed3c=['join','getDataValue','sequelize','exports','STRING','BOOLEAN','crudPermissions'];(function(_0x240d46,_0x102866){var _0x260100=function(_0x59d179){while(--_0x59d179){_0x240d46['push'](_0x240d46['shift']());}};_0x260100(++_0x102866);}(_0xed3c,0x1a6));var _0xced3=function(_0x365c07,_0x3ef179){_0x365c07=_0x365c07-0x0;var _0x348481=_0xed3c[_0x365c07];return _0x348481;};'use strict';var Sequelize=require(_0xced3('0x0'));module[_0xced3('0x1')]={'name':{'type':Sequelize[_0xced3('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0xced3('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0xced3('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0xced3('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0xced3('0x2')],'set':function(_0x5f03e0){this['setDataValue'](_0xced3('0x4'),_0x5f03e0?_0x5f03e0[_0xced3('0x5')](''):[]);},'get':function(){return this[_0xced3('0x6')](_0xced3('0x4'))?this['getDataValue']('crudPermissions')['split'](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 0e7b491..4105eaa 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 _0x5c7c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../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','destroy','then','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','includeAll','include','catch','params','find','create','body','describe','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js'];(function(_0x1694f5,_0x49b7c3){var _0x5b4321=function(_0x58c183){while(--_0x58c183){_0x1694f5['push'](_0x1694f5['shift']());}};_0x5b4321(++_0x49b7c3);}(_0x5c7c,0x86));var _0xc5c7=function(_0x3cfeac,_0x37b305){_0x3cfeac=_0x3cfeac-0x0;var _0x278c83=_0x5c7c[_0x3cfeac];return _0x278c83;};'use strict';var emlformat=require(_0xc5c7('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xc5c7('0x1'));var rp=require(_0xc5c7('0x2'));var moment=require(_0xc5c7('0x3'));var BPromise=require(_0xc5c7('0x4'));var Mustache=require('mustache');var util=require(_0xc5c7('0x5'));var path=require(_0xc5c7('0x6'));var sox=require(_0xc5c7('0x7'));var csv=require(_0xc5c7('0x8'));var ejs=require(_0xc5c7('0x9'));var fs=require('fs');var fs_extra=require(_0xc5c7('0xa'));var _=require('lodash');var squel=require(_0xc5c7('0xb'));var crypto=require(_0xc5c7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc5c7('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc5c7('0xe'));var Redis=require(_0xc5c7('0xf'));var authService=require(_0xc5c7('0x10'));var qs=require(_0xc5c7('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc5c7('0x12'));var logger=require(_0xc5c7('0x13'))(_0xc5c7('0x14'));var utils=require('../../config/utils');var config=require(_0xc5c7('0x15'));var licenseUtil=require(_0xc5c7('0x16'));var db=require(_0xc5c7('0x17'))['db'];function respondWithStatusCode(_0x3b56a6,_0xa6e74d){_0xa6e74d=_0xa6e74d||0xcc;return function(_0x4d8f85){if(_0x4d8f85){return _0x3b56a6[_0xc5c7('0x18')](_0xa6e74d);}return _0x3b56a6[_0xc5c7('0x19')](_0xa6e74d)[_0xc5c7('0x1a')]();};}function respondWithResult(_0x34b820,_0x128356){_0x128356=_0x128356||0xc8;return function(_0x332540){if(_0x332540){return _0x34b820[_0xc5c7('0x19')](_0x128356)[_0xc5c7('0x1b')](_0x332540);}};}function respondWithFilteredResult(_0x2d0e4a,_0x49e19f){return function(_0x56eca1){if(_0x56eca1){var _0x38374e=typeof _0x49e19f[_0xc5c7('0x1c')]===_0xc5c7('0x1d')&&typeof _0x49e19f[_0xc5c7('0x1e')]===_0xc5c7('0x1d');var _0x11bce9=_0x56eca1[_0xc5c7('0x1f')];var _0x36cfb5=_0x38374e?0x0:_0x49e19f['offset'];var _0x216d1a=_0x38374e?_0x56eca1[_0xc5c7('0x1f')]:_0x49e19f['offset']+_0x49e19f[_0xc5c7('0x1e')];var _0x1ec8bc;if(_0x216d1a>=_0x11bce9){_0x216d1a=_0x11bce9;_0x1ec8bc=0xc8;}else{_0x1ec8bc=0xce;}_0x2d0e4a[_0xc5c7('0x19')](_0x1ec8bc);return _0x2d0e4a[_0xc5c7('0x20')](_0xc5c7('0x21'),_0x36cfb5+'-'+_0x216d1a+'/'+_0x11bce9)[_0xc5c7('0x1b')](_0x56eca1);}return null;};}function patchUpdates(_0x5bcb8e){return function(_0x5507bd){try{jsonpatch['apply'](_0x5507bd,_0x5bcb8e,!![]);}catch(_0x9a442b){return BPromise[_0xc5c7('0x22')](_0x9a442b);}return _0x5507bd[_0xc5c7('0x23')]();};}function saveUpdates(_0x30a5b9,_0x55d464){return function(_0x4b7bc4){if(_0x4b7bc4){return _0x4b7bc4['update'](_0x30a5b9)['then'](function(_0x14c4dd){return _0x14c4dd;});}return null;};}function removeEntity(_0x1ac784,_0x1584fa){return function(_0x18272c){if(_0x18272c){return _0x18272c[_0xc5c7('0x24')]()[_0xc5c7('0x25')](function(){_0x1ac784[_0xc5c7('0x19')](0xcc)[_0xc5c7('0x1a')]();});}};}function handleEntityNotFound(_0x143589,_0x32a2b4){return function(_0x3f7aed){if(!_0x3f7aed){_0x143589['sendStatus'](0x194);}return _0x3f7aed;};}function handleError(_0x464da2,_0x48ae20){_0x48ae20=_0x48ae20||0x1f4;return function(_0xdc0c15){logger[_0xc5c7('0x26')](_0xdc0c15[_0xc5c7('0x27')]);if(_0xdc0c15[_0xc5c7('0x28')]){delete _0xdc0c15[_0xc5c7('0x28')];}_0x464da2[_0xc5c7('0x19')](_0x48ae20)['send'](_0xdc0c15);};}exports[_0xc5c7('0x29')]=function(_0x31863f,_0x156423){var _0x1230a2={},_0x47920c={},_0x1d392d={'count':0x0,'rows':[]};var _0x182592=_[_0xc5c7('0x2a')](db[_0xc5c7('0x2b')][_0xc5c7('0x2c')],function(_0x20774d){return{'name':_0x20774d[_0xc5c7('0x2d')],'type':_0x20774d[_0xc5c7('0x2e')][_0xc5c7('0x2f')]};});_0x47920c[_0xc5c7('0x30')]=_[_0xc5c7('0x2a')](_0x182592,_0xc5c7('0x28'));_0x47920c[_0xc5c7('0x31')]=_[_0xc5c7('0x32')](_0x31863f['query']);_0x47920c[_0xc5c7('0x33')]=_[_0xc5c7('0x34')](_0x47920c[_0xc5c7('0x30')],_0x47920c['query']);_0x1230a2[_0xc5c7('0x35')]=_[_0xc5c7('0x34')](_0x47920c[_0xc5c7('0x30')],qs[_0xc5c7('0x36')](_0x31863f['query'][_0xc5c7('0x36')]));_0x1230a2[_0xc5c7('0x35')]=_0x1230a2[_0xc5c7('0x35')][_0xc5c7('0x37')]?_0x1230a2[_0xc5c7('0x35')]:_0x47920c['model'];if(!_0x31863f[_0xc5c7('0x31')][_0xc5c7('0x38')](_0xc5c7('0x39'))){_0x1230a2['limit']=qs['limit'](_0x31863f[_0xc5c7('0x31')][_0xc5c7('0x1e')]);_0x1230a2['offset']=qs[_0xc5c7('0x1c')](_0x31863f[_0xc5c7('0x31')]['offset']);}_0x1230a2[_0xc5c7('0x3a')]=qs[_0xc5c7('0x3b')](_0x31863f['query']['sort']);_0x1230a2['where']=qs[_0xc5c7('0x33')](_[_0xc5c7('0x3c')](_0x31863f[_0xc5c7('0x31')],_0x47920c[_0xc5c7('0x33')]),_0x182592);if(_0x31863f[_0xc5c7('0x31')]['filter']){_0x1230a2[_0xc5c7('0x3d')]=_[_0xc5c7('0x3e')](_0x1230a2[_0xc5c7('0x3d')],{'$or':_['map'](_0x182592,function(_0x13e80a){if(_0x13e80a[_0xc5c7('0x2e')]!==_0xc5c7('0x3f')){var _0x18718a={};_0x18718a[_0x13e80a['name']]={'$like':'%'+_0x31863f[_0xc5c7('0x31')][_0xc5c7('0x40')]+'%'};return _0x18718a;}})});}_0x1230a2=_[_0xc5c7('0x3e')]({},_0x1230a2,_0x31863f[_0xc5c7('0x41')]);var _0x5e27fa={'where':_0x1230a2['where']};return db['UserProfileSection'][_0xc5c7('0x1f')](_0x5e27fa)[_0xc5c7('0x25')](function(_0x527288){_0x1d392d[_0xc5c7('0x1f')]=_0x527288;if(_0x31863f[_0xc5c7('0x31')][_0xc5c7('0x42')]){_0x1230a2[_0xc5c7('0x43')]=[{'all':!![]}];}return db['UserProfileSection']['findAll'](_0x1230a2);})['then'](function(_0x27a03b){_0x1d392d['rows']=_0x27a03b;return _0x1d392d;})[_0xc5c7('0x25')](respondWithFilteredResult(_0x156423,_0x1230a2))[_0xc5c7('0x44')](handleError(_0x156423,null));};exports['show']=function(_0x2d4a1b,_0x39a754){var _0x7d0138={'raw':![],'where':{'id':_0x2d4a1b[_0xc5c7('0x45')]['id']}},_0x2bdead={};_0x2bdead[_0xc5c7('0x30')]=_[_0xc5c7('0x32')](db[_0xc5c7('0x2b')][_0xc5c7('0x2c')]);_0x2bdead[_0xc5c7('0x31')]=_[_0xc5c7('0x32')](_0x2d4a1b[_0xc5c7('0x31')]);_0x2bdead[_0xc5c7('0x33')]=_['intersection'](_0x2bdead[_0xc5c7('0x30')],_0x2bdead['query']);_0x7d0138[_0xc5c7('0x35')]=_['intersection'](_0x2bdead[_0xc5c7('0x30')],qs[_0xc5c7('0x36')](_0x2d4a1b['query']['fields']));_0x7d0138[_0xc5c7('0x35')]=_0x7d0138['attributes']['length']?_0x7d0138[_0xc5c7('0x35')]:_0x2bdead[_0xc5c7('0x30')];if(_0x2d4a1b[_0xc5c7('0x31')][_0xc5c7('0x42')]){_0x7d0138[_0xc5c7('0x43')]=[{'all':!![]}];}_0x7d0138=_[_0xc5c7('0x3e')]({},_0x7d0138,_0x2d4a1b[_0xc5c7('0x41')]);return db[_0xc5c7('0x2b')][_0xc5c7('0x46')](_0x7d0138)[_0xc5c7('0x25')](handleEntityNotFound(_0x39a754,null))[_0xc5c7('0x25')](respondWithResult(_0x39a754,null))[_0xc5c7('0x44')](handleError(_0x39a754,null));};exports[_0xc5c7('0x47')]=function(_0x43d6ce,_0x1d7067){return db[_0xc5c7('0x2b')][_0xc5c7('0x47')](_0x43d6ce['body'],{})[_0xc5c7('0x25')](respondWithResult(_0x1d7067,0xc9))[_0xc5c7('0x44')](handleError(_0x1d7067,null));};exports['update']=function(_0x4e37d7,_0x5ae62d){if(_0x4e37d7[_0xc5c7('0x48')]['id']){delete _0x4e37d7[_0xc5c7('0x48')]['id'];}return db[_0xc5c7('0x2b')]['find']({'where':{'id':_0x4e37d7[_0xc5c7('0x45')]['id']}})[_0xc5c7('0x25')](handleEntityNotFound(_0x5ae62d,null))[_0xc5c7('0x25')](saveUpdates(_0x4e37d7['body'],null))['then'](respondWithResult(_0x5ae62d,null))[_0xc5c7('0x44')](handleError(_0x5ae62d,null));};exports[_0xc5c7('0x24')]=function(_0x59e93f,_0x1b9789){return db['UserProfileSection']['find']({'where':{'id':_0x59e93f['params']['id']}})[_0xc5c7('0x25')](handleEntityNotFound(_0x1b9789,null))[_0xc5c7('0x25')](removeEntity(_0x1b9789,null))[_0xc5c7('0x44')](handleError(_0x1b9789,null));};exports['describe']=function(_0x90a950,_0x155add){return db['UserProfileSection'][_0xc5c7('0x49')]()[_0xc5c7('0x25')](respondWithResult(_0x155add,null))[_0xc5c7('0x44')](handleError(_0x155add,null));}; \ No newline at end of file +var _0x9a9f=['sendStatus','error','stack','name','send','index','map','UserProfileSection','rawAttributes','fieldName','key','model','query','attributes','intersection','fields','nolimit','sort','where','filters','filter','VIRTUAL','merge','options','then','includeAll','findAll','rows','catch','show','params','keys','length','include','find','body','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','status'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x9a9f,0x103));var _0xf9a9=function(_0x101537,_0x28f186){_0x101537=_0x101537-0x0;var _0x2901c6=_0x9a9f[_0x101537];return _0x2901c6;};'use strict';var emlformat=require(_0xf9a9('0x0'));var rimraf=require(_0xf9a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf9a9('0x2'));var rp=require(_0xf9a9('0x3'));var moment=require('moment');var BPromise=require(_0xf9a9('0x4'));var Mustache=require(_0xf9a9('0x5'));var util=require(_0xf9a9('0x6'));var path=require(_0xf9a9('0x7'));var sox=require(_0xf9a9('0x8'));var csv=require(_0xf9a9('0x9'));var ejs=require(_0xf9a9('0xa'));var fs=require('fs');var fs_extra=require(_0xf9a9('0xb'));var _=require(_0xf9a9('0xc'));var squel=require(_0xf9a9('0xd'));var crypto=require(_0xf9a9('0xe'));var jsforce=require(_0xf9a9('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xf9a9('0x10'));var Papa=require('papaparse');var Redis=require(_0xf9a9('0x11'));var authService=require(_0xf9a9('0x12'));var qs=require(_0xf9a9('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf9a9('0x14'));var logger=require(_0xf9a9('0x15'))('api');var utils=require(_0xf9a9('0x16'));var config=require(_0xf9a9('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf9a9('0x18'))['db'];function respondWithStatusCode(_0x5a0118,_0x387e6d){_0x387e6d=_0x387e6d||0xcc;return function(_0x21a96a){if(_0x21a96a){return _0x5a0118['sendStatus'](_0x387e6d);}return _0x5a0118['status'](_0x387e6d)['end']();};}function respondWithResult(_0x443e15,_0x312a1c){_0x312a1c=_0x312a1c||0xc8;return function(_0x46cdf3){if(_0x46cdf3){return _0x443e15['status'](_0x312a1c)['json'](_0x46cdf3);}};}function respondWithFilteredResult(_0x589f7e,_0x1f19cb){return function(_0x80d15a){if(_0x80d15a){var _0x27d6a3=typeof _0x1f19cb[_0xf9a9('0x19')]===_0xf9a9('0x1a')&&typeof _0x1f19cb[_0xf9a9('0x1b')]===_0xf9a9('0x1a');var _0x51a65f=_0x80d15a[_0xf9a9('0x1c')];var _0x333ad0=_0x27d6a3?0x0:_0x1f19cb[_0xf9a9('0x19')];var _0x129d9b=_0x27d6a3?_0x80d15a['count']:_0x1f19cb[_0xf9a9('0x19')]+_0x1f19cb[_0xf9a9('0x1b')];var _0x222366;if(_0x129d9b>=_0x51a65f){_0x129d9b=_0x51a65f;_0x222366=0xc8;}else{_0x222366=0xce;}_0x589f7e['status'](_0x222366);return _0x589f7e[_0xf9a9('0x1d')](_0xf9a9('0x1e'),_0x333ad0+'-'+_0x129d9b+'/'+_0x51a65f)[_0xf9a9('0x1f')](_0x80d15a);}return null;};}function patchUpdates(_0x534990){return function(_0x287cb5){try{jsonpatch[_0xf9a9('0x20')](_0x287cb5,_0x534990,!![]);}catch(_0x1143d1){return BPromise[_0xf9a9('0x21')](_0x1143d1);}return _0x287cb5[_0xf9a9('0x22')]();};}function saveUpdates(_0x37dbb0,_0x55e1dc){return function(_0x4f4a15){if(_0x4f4a15){return _0x4f4a15[_0xf9a9('0x23')](_0x37dbb0)['then'](function(_0x570712){return _0x570712;});}return null;};}function removeEntity(_0x3a2e2a,_0xdd4499){return function(_0xec3555){if(_0xec3555){return _0xec3555['destroy']()['then'](function(){_0x3a2e2a[_0xf9a9('0x24')](0xcc)['end']();});}};}function handleEntityNotFound(_0x269f09,_0xb280a2){return function(_0x26c74d){if(!_0x26c74d){_0x269f09[_0xf9a9('0x25')](0x194);}return _0x26c74d;};}function handleError(_0x43c27c,_0x48d3fc){_0x48d3fc=_0x48d3fc||0x1f4;return function(_0x418c51){logger[_0xf9a9('0x26')](_0x418c51[_0xf9a9('0x27')]);if(_0x418c51[_0xf9a9('0x28')]){delete _0x418c51[_0xf9a9('0x28')];}_0x43c27c[_0xf9a9('0x24')](_0x48d3fc)[_0xf9a9('0x29')](_0x418c51);};}exports[_0xf9a9('0x2a')]=function(_0x3ae628,_0x546d4e){var _0x29c5a0={},_0x1cb442={},_0x3294cc={'count':0x0,'rows':[]};var _0xc04e2b=_[_0xf9a9('0x2b')](db[_0xf9a9('0x2c')][_0xf9a9('0x2d')],function(_0x516b8c){return{'name':_0x516b8c[_0xf9a9('0x2e')],'type':_0x516b8c['type'][_0xf9a9('0x2f')]};});_0x1cb442[_0xf9a9('0x30')]=_[_0xf9a9('0x2b')](_0xc04e2b,_0xf9a9('0x28'));_0x1cb442[_0xf9a9('0x31')]=_['keys'](_0x3ae628['query']);_0x1cb442['filters']=_['intersection'](_0x1cb442[_0xf9a9('0x30')],_0x1cb442[_0xf9a9('0x31')]);_0x29c5a0[_0xf9a9('0x32')]=_[_0xf9a9('0x33')](_0x1cb442[_0xf9a9('0x30')],qs[_0xf9a9('0x34')](_0x3ae628['query']['fields']));_0x29c5a0['attributes']=_0x29c5a0[_0xf9a9('0x32')]['length']?_0x29c5a0[_0xf9a9('0x32')]:_0x1cb442['model'];if(!_0x3ae628[_0xf9a9('0x31')]['hasOwnProperty'](_0xf9a9('0x35'))){_0x29c5a0[_0xf9a9('0x1b')]=qs['limit'](_0x3ae628['query'][_0xf9a9('0x1b')]);_0x29c5a0[_0xf9a9('0x19')]=qs[_0xf9a9('0x19')](_0x3ae628[_0xf9a9('0x31')]['offset']);}_0x29c5a0['order']=qs[_0xf9a9('0x36')](_0x3ae628['query']['sort']);_0x29c5a0[_0xf9a9('0x37')]=qs[_0xf9a9('0x38')](_['pick'](_0x3ae628[_0xf9a9('0x31')],_0x1cb442[_0xf9a9('0x38')]),_0xc04e2b);if(_0x3ae628[_0xf9a9('0x31')][_0xf9a9('0x39')]){_0x29c5a0[_0xf9a9('0x37')]=_['merge'](_0x29c5a0['where'],{'$or':_[_0xf9a9('0x2b')](_0xc04e2b,function(_0xc34b39){if(_0xc34b39['type']!==_0xf9a9('0x3a')){var _0x253e77={};_0x253e77[_0xc34b39[_0xf9a9('0x28')]]={'$like':'%'+_0x3ae628['query'][_0xf9a9('0x39')]+'%'};return _0x253e77;}})});}_0x29c5a0=_[_0xf9a9('0x3b')]({},_0x29c5a0,_0x3ae628[_0xf9a9('0x3c')]);var _0x12f859={'where':_0x29c5a0[_0xf9a9('0x37')]};return db[_0xf9a9('0x2c')][_0xf9a9('0x1c')](_0x12f859)[_0xf9a9('0x3d')](function(_0x2537ff){_0x3294cc[_0xf9a9('0x1c')]=_0x2537ff;if(_0x3ae628[_0xf9a9('0x31')][_0xf9a9('0x3e')]){_0x29c5a0['include']=[{'all':!![]}];}return db[_0xf9a9('0x2c')][_0xf9a9('0x3f')](_0x29c5a0);})[_0xf9a9('0x3d')](function(_0x3be52e){_0x3294cc[_0xf9a9('0x40')]=_0x3be52e;return _0x3294cc;})[_0xf9a9('0x3d')](respondWithFilteredResult(_0x546d4e,_0x29c5a0))[_0xf9a9('0x41')](handleError(_0x546d4e,null));};exports[_0xf9a9('0x42')]=function(_0x59c439,_0xb5d45b){var _0x15d7e3={'raw':![],'where':{'id':_0x59c439[_0xf9a9('0x43')]['id']}},_0x40383d={};_0x40383d[_0xf9a9('0x30')]=_['keys'](db[_0xf9a9('0x2c')][_0xf9a9('0x2d')]);_0x40383d[_0xf9a9('0x31')]=_[_0xf9a9('0x44')](_0x59c439[_0xf9a9('0x31')]);_0x40383d[_0xf9a9('0x38')]=_[_0xf9a9('0x33')](_0x40383d[_0xf9a9('0x30')],_0x40383d[_0xf9a9('0x31')]);_0x15d7e3[_0xf9a9('0x32')]=_['intersection'](_0x40383d['model'],qs[_0xf9a9('0x34')](_0x59c439[_0xf9a9('0x31')]['fields']));_0x15d7e3[_0xf9a9('0x32')]=_0x15d7e3[_0xf9a9('0x32')][_0xf9a9('0x45')]?_0x15d7e3['attributes']:_0x40383d[_0xf9a9('0x30')];if(_0x59c439[_0xf9a9('0x31')][_0xf9a9('0x3e')]){_0x15d7e3[_0xf9a9('0x46')]=[{'all':!![]}];}_0x15d7e3=_['merge']({},_0x15d7e3,_0x59c439['options']);return db[_0xf9a9('0x2c')][_0xf9a9('0x47')](_0x15d7e3)[_0xf9a9('0x3d')](handleEntityNotFound(_0xb5d45b,null))[_0xf9a9('0x3d')](respondWithResult(_0xb5d45b,null))[_0xf9a9('0x41')](handleError(_0xb5d45b,null));};exports['create']=function(_0x15707,_0xd1d60b){return db[_0xf9a9('0x2c')]['create'](_0x15707[_0xf9a9('0x48')],{})[_0xf9a9('0x3d')](respondWithResult(_0xd1d60b,0xc9))[_0xf9a9('0x41')](handleError(_0xd1d60b,null));};exports[_0xf9a9('0x23')]=function(_0x124496,_0x327796){if(_0x124496[_0xf9a9('0x48')]['id']){delete _0x124496[_0xf9a9('0x48')]['id'];}return db[_0xf9a9('0x2c')]['find']({'where':{'id':_0x124496[_0xf9a9('0x43')]['id']}})[_0xf9a9('0x3d')](handleEntityNotFound(_0x327796,null))[_0xf9a9('0x3d')](saveUpdates(_0x124496[_0xf9a9('0x48')],null))['then'](respondWithResult(_0x327796,null))[_0xf9a9('0x41')](handleError(_0x327796,null));};exports['destroy']=function(_0x51d229,_0x2ac449){return db[_0xf9a9('0x2c')][_0xf9a9('0x47')]({'where':{'id':_0x51d229[_0xf9a9('0x43')]['id']}})[_0xf9a9('0x3d')](handleEntityNotFound(_0x2ac449,null))['then'](removeEntity(_0x2ac449,null))[_0xf9a9('0x41')](handleError(_0x2ac449,null));};exports['describe']=function(_0x3b2e15,_0x5dda7f){return db['UserProfileSection'][_0xf9a9('0x49')]()[_0xf9a9('0x3d')](respondWithResult(_0x5dda7f,null))[_0xf9a9('0x41')](handleError(_0x5dda7f,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 96f8499..5da10eb 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 _0x8d9e=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./userProfileSection.attributes','UserProfileSection','user_profile_has_sections','compositeIndex','lodash','util'];(function(_0x17ca87,_0x537b70){var _0xf236c5=function(_0x160e17){while(--_0x160e17){_0x17ca87['push'](_0x17ca87['shift']());}};_0xf236c5(++_0x537b70);}(_0x8d9e,0x150));var _0xe8d9=function(_0x26be65,_0x513b6a){_0x26be65=_0x26be65-0x0;var _0x35b5d8=_0x8d9e[_0x26be65];return _0x35b5d8;};'use strict';var _=require(_0xe8d9('0x0'));var util=require(_0xe8d9('0x1'));var logger=require(_0xe8d9('0x2'))('api');var moment=require(_0xe8d9('0x3'));var BPromise=require(_0xe8d9('0x4'));var rp=require(_0xe8d9('0x5'));var fs=require('fs');var path=require(_0xe8d9('0x6'));var rimraf=require(_0xe8d9('0x7'));var config=require(_0xe8d9('0x8'));var attributes=require(_0xe8d9('0x9'));module['exports']=function(_0x381cff,_0x5175ac){return _0x381cff['define'](_0xe8d9('0xa'),attributes,{'tableName':_0xe8d9('0xb'),'paranoid':![],'indexes':[{'name':_0xe8d9('0xc'),'fields':['sectionId','userProfileId']}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb6f=['UserProfileSection','compositeIndex','sectionId','userProfileId','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./userProfileSection.attributes','exports','define'];(function(_0x330723,_0x8de382){var _0x60c546=function(_0xd6d3fe){while(--_0xd6d3fe){_0x330723['push'](_0x330723['shift']());}};_0x60c546(++_0x8de382);}(_0xbb6f,0xf4));var _0xfbb6=function(_0x319dae,_0xe0d271){_0x319dae=_0x319dae-0x0;var _0x26143f=_0xbb6f[_0x319dae];return _0x26143f;};'use strict';var _=require(_0xfbb6('0x0'));var util=require(_0xfbb6('0x1'));var logger=require(_0xfbb6('0x2'))(_0xfbb6('0x3'));var moment=require('moment');var BPromise=require(_0xfbb6('0x4'));var rp=require(_0xfbb6('0x5'));var fs=require('fs');var path=require(_0xfbb6('0x6'));var rimraf=require('rimraf');var config=require(_0xfbb6('0x7'));var attributes=require(_0xfbb6('0x8'));module[_0xfbb6('0x9')]=function(_0x34bf09,_0x3eeded){return _0x34bf09[_0xfbb6('0xa')](_0xfbb6('0xb'),attributes,{'tableName':'user_profile_has_sections','paranoid':![],'indexes':[{'name':_0xfbb6('0xc'),'fields':[_0xfbb6('0xd'),_0xfbb6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.rpc.js b/server/api/userProfileSection/userProfileSection.rpc.js index 30a6e32..795e1ce 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 _0x7301=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','error','code','UserProfileSection,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x404efe,_0x2b1352){var _0xfe8d8a=function(_0x2171e4){while(--_0x2171e4){_0x404efe['push'](_0x404efe['shift']());}};_0xfe8d8a(++_0x2b1352);}(_0x7301,0x104));var _0x1730=function(_0x42cb2b,_0x490600){_0x42cb2b=_0x42cb2b-0x0;var _0x20758c=_0x7301[_0x42cb2b];return _0x20758c;};'use strict';var _=require('lodash');var util=require(_0x1730('0x0'));var moment=require(_0x1730('0x1'));var BPromise=require(_0x1730('0x2'));var rs=require(_0x1730('0x3'));var fs=require('fs');var Redis=require(_0x1730('0x4'));var db=require(_0x1730('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x1730('0x6'))(_0x1730('0x7'));var config=require(_0x1730('0x8'));var jayson=require(_0x1730('0x9'));var client=jayson['client'][_0x1730('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1e8b82,_0xb16163,_0x1c8b4b){return new BPromise(function(_0x1abf7e,_0x5b018e){return client[_0x1730('0xb')](_0x1e8b82,_0x1c8b4b)[_0x1730('0xc')](function(_0x92dea4){logger[_0x1730('0xd')]('UserProfileSection,\x20%s,\x20%s',_0xb16163,_0x1730('0xe'));logger[_0x1730('0xf')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0xb16163,_0x1730('0xe'),JSON['stringify'](_0x92dea4));if(_0x92dea4[_0x1730('0x10')]){if(_0x92dea4['error'][_0x1730('0x11')]===0x1f4){logger[_0x1730('0x10')](_0x1730('0x12'),_0xb16163,_0x92dea4[_0x1730('0x10')][_0x1730('0x13')]);return _0x5b018e(_0x92dea4[_0x1730('0x10')]['message']);}logger['error'](_0x1730('0x12'),_0xb16163,_0x92dea4[_0x1730('0x10')]['message']);return _0x1abf7e(_0x92dea4[_0x1730('0x10')]['message']);}else{logger[_0x1730('0xd')](_0x1730('0x12'),_0xb16163,_0x1730('0xe'));_0x1abf7e(_0x92dea4[_0x1730('0x14')][_0x1730('0x13')]);}})[_0x1730('0x15')](function(_0x5bdc76){logger[_0x1730('0x10')](_0x1730('0x12'),_0xb16163,_0x5bdc76);_0x5b018e(_0x5bdc76);});});} \ No newline at end of file +var _0xa7ac=['error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7ac,0xc2));var _0xca7a=function(_0x1b2875,_0xe3a15e){_0x1b2875=_0x1b2875-0x0;var _0x43ac35=_0xa7ac[_0x1b2875];return _0x43ac35;};'use strict';var _=require(_0xca7a('0x0'));var util=require('util');var moment=require(_0xca7a('0x1'));var BPromise=require(_0xca7a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xca7a('0x3'));var db=require(_0xca7a('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xca7a('0x5'));var jayson=require(_0xca7a('0x6'));var client=jayson[_0xca7a('0x7')][_0xca7a('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3532e1,_0x402ce1,_0x576cda){return new BPromise(function(_0x30e3e7,_0x392e05){return client[_0xca7a('0x9')](_0x3532e1,_0x576cda)[_0xca7a('0xa')](function(_0x1d6180){logger[_0xca7a('0xb')](_0xca7a('0xc'),_0x402ce1,_0xca7a('0xd'));logger[_0xca7a('0xe')]('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x402ce1,_0xca7a('0xd'),JSON[_0xca7a('0xf')](_0x1d6180));if(_0x1d6180[_0xca7a('0x10')]){if(_0x1d6180[_0xca7a('0x10')][_0xca7a('0x11')]===0x1f4){logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x402ce1,_0x1d6180['error']['message']);return _0x392e05(_0x1d6180[_0xca7a('0x10')]['message']);}logger[_0xca7a('0x10')](_0xca7a('0xc'),_0x402ce1,_0x1d6180[_0xca7a('0x10')][_0xca7a('0x12')]);return _0x30e3e7(_0x1d6180[_0xca7a('0x10')][_0xca7a('0x12')]);}else{logger[_0xca7a('0xb')]('UserProfileSection,\x20%s,\x20%s',_0x402ce1,'request\x20sent');_0x30e3e7(_0x1d6180[_0xca7a('0x13')][_0xca7a('0x12')]);}})[_0xca7a('0x14')](function(_0x39bdc2){logger['error'](_0xca7a('0xc'),_0x402ce1,_0x39bdc2);_0x392e05(_0x39bdc2);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 9172791..394f1b7 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x4a7bac,_0x1a8719){var _0x284a73=function(_0x19afeb){while(--_0x19afeb){_0x4a7bac['push'](_0x4a7bac['shift']());}};_0x284a73(++_0x1a8719);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 +var _0x0713=['../../config/environment','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service'];(function(_0x2336fb,_0x32a927){var _0x2d5b7c=function(_0x403503){while(--_0x403503){_0x2336fb['push'](_0x2336fb['shift']());}};_0x2d5b7c(++_0x32a927);}(_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'));module[_0x3071('0x7')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index 3d0d9d7..ee017a7 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 _0x36c3=['sequelize','exports','INTEGER'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x36c3,0x69));var _0x336c=function(_0x2389bc,_0x167cd2){_0x2389bc=_0x2389bc-0x0;var _0x170548=_0x36c3[_0x2389bc];return _0x170548;};'use strict';var Sequelize=require(_0x336c('0x0'));module[_0x336c('0x1')]={'penalty':{'type':Sequelize[_0x336c('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x3716=['INTEGER','sequelize','exports'];(function(_0x32c859,_0x4577fb){var _0x400b2b=function(_0x152d94){while(--_0x152d94){_0x32c859['push'](_0x32c859['shift']());}};_0x400b2b(++_0x4577fb);}(_0x3716,0xbe));var _0x6371=function(_0x409deb,_0x2b731){_0x409deb=_0x409deb-0x0;var _0x15a4f7=_0x3716[_0x409deb];return _0x15a4f7;};'use strict';var Sequelize=require(_0x6371('0x0'));module[_0x6371('0x1')]={'penalty':{'type':Sequelize[_0x6371('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 3e4bec7..71d8995 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 _0xe2fe=['../../config/environment','exports','define','UserSmsQueue','lodash','api','bluebird','request-promise','path','rimraf'];(function(_0x71cd05,_0x36ac11){var _0x59c9e7=function(_0x5472cd){while(--_0x5472cd){_0x71cd05['push'](_0x71cd05['shift']());}};_0x59c9e7(++_0x36ac11);}(_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('./userSmsQueue.attributes');module[_0xee2f('0x7')]=function(_0x2b7e7c,_0x49926b){return _0x2b7e7c[_0xee2f('0x8')](_0xee2f('0x9'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb091=['moment','request-promise','../../config/environment','./userSmsQueue.attributes','define','user_has_sms_queues','util','../../config/logger','api'];(function(_0x36d693,_0x4051e0){var _0xb16545=function(_0x1407f4){while(--_0x1407f4){_0x36d693['push'](_0x36d693['shift']());}};_0xb16545(++_0x4051e0);}(_0xb091,0x16e));var _0x1b09=function(_0x2194a4,_0x3e52e9){_0x2194a4=_0x2194a4-0x0;var _0x3e11ac=_0xb091[_0x2194a4];return _0x3e11ac;};'use strict';var _=require('lodash');var util=require(_0x1b09('0x0'));var logger=require(_0x1b09('0x1'))(_0x1b09('0x2'));var moment=require(_0x1b09('0x3'));var BPromise=require('bluebird');var rp=require(_0x1b09('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x1b09('0x5'));var attributes=require(_0x1b09('0x6'));module['exports']=function(_0xda8caa,_0x5fa348){return _0xda8caa[_0x1b09('0x7')]('UserSmsQueue',attributes,{'tableName':_0x1b09('0x8'),'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 ffff644..6bd521e 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 _0xd688=['stringify','error','code','message','info','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','jayson/promise','client','http','then','UserSmsQueue,\x20%s,\x20%s','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x37d52a,_0x1c8046){var _0x362936=function(_0x30a8af){while(--_0x30a8af){_0x37d52a['push'](_0x37d52a['shift']());}};_0x362936(++_0x1c8046);}(_0xd688,0x1eb));var _0x8d68=function(_0x171228,_0x48b8ec){_0x171228=_0x171228-0x0;var _0x2d7b2f=_0xd688[_0x171228];return _0x2d7b2f;};'use strict';var _=require(_0x8d68('0x0'));var util=require(_0x8d68('0x1'));var moment=require(_0x8d68('0x2'));var BPromise=require(_0x8d68('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8d68('0x4'));var db=require(_0x8d68('0x5'))['db'];var utils=require(_0x8d68('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x8d68('0x7'));var client=jayson[_0x8d68('0x8')][_0x8d68('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ec341,_0x13d9cb,_0x125cc1){return new BPromise(function(_0x52b8ea,_0x19dafe){return client['request'](_0x3ec341,_0x125cc1)[_0x8d68('0xa')](function(_0x5d6b27){logger['info'](_0x8d68('0xb'),_0x13d9cb,'request\x20sent');logger[_0x8d68('0xc')](_0x8d68('0xd'),_0x13d9cb,_0x8d68('0xe'),JSON[_0x8d68('0xf')](_0x5d6b27));if(_0x5d6b27[_0x8d68('0x10')]){if(_0x5d6b27[_0x8d68('0x10')][_0x8d68('0x11')]===0x1f4){logger['error'](_0x8d68('0xb'),_0x13d9cb,_0x5d6b27['error'][_0x8d68('0x12')]);return _0x19dafe(_0x5d6b27[_0x8d68('0x10')][_0x8d68('0x12')]);}logger[_0x8d68('0x10')](_0x8d68('0xb'),_0x13d9cb,_0x5d6b27[_0x8d68('0x10')][_0x8d68('0x12')]);return _0x52b8ea(_0x5d6b27[_0x8d68('0x10')][_0x8d68('0x12')]);}else{logger[_0x8d68('0x13')](_0x8d68('0xb'),_0x13d9cb,_0x8d68('0xe'));_0x52b8ea(_0x5d6b27[_0x8d68('0x14')][_0x8d68('0x12')]);}})[_0x8d68('0x15')](function(_0x3ffec1){logger[_0x8d68('0x10')]('UserSmsQueue,\x20%s,\x20%s',_0x13d9cb,_0x3ffec1);_0x19dafe(_0x3ffec1);});});} \ No newline at end of file +var _0x0280=['client','http','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','code','UserSmsQueue,\x20%s,\x20%s','message','info','result','catch','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0xb6cbf6,_0x5b7590){var _0xdd89f0=function(_0x1cdad8){while(--_0x1cdad8){_0xb6cbf6['push'](_0xb6cbf6['shift']());}};_0xdd89f0(++_0x5b7590);}(_0x0280,0x1bc));var _0x0028=function(_0x58832b,_0x4e6ffc){_0x58832b=_0x58832b-0x0;var _0x1a7b20=_0x0280[_0x58832b];return _0x1a7b20;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0028('0x0'));var BPromise=require(_0x0028('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x0028('0x2'));var logger=require(_0x0028('0x3'))(_0x0028('0x4'));var config=require(_0x0028('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x0028('0x6')][_0x0028('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x21410c,_0x53b3e1,_0x3cd9e3){return new BPromise(function(_0x1914c4,_0x2f8bfe){return client['request'](_0x21410c,_0x3cd9e3)['then'](function(_0xc360bc){logger['info']('UserSmsQueue,\x20%s,\x20%s',_0x53b3e1,_0x0028('0x8'));logger[_0x0028('0x9')](_0x0028('0xa'),_0x53b3e1,_0x0028('0x8'),JSON['stringify'](_0xc360bc));if(_0xc360bc[_0x0028('0xb')]){if(_0xc360bc['error'][_0x0028('0xc')]===0x1f4){logger[_0x0028('0xb')](_0x0028('0xd'),_0x53b3e1,_0xc360bc[_0x0028('0xb')]['message']);return _0x2f8bfe(_0xc360bc[_0x0028('0xb')][_0x0028('0xe')]);}logger[_0x0028('0xb')](_0x0028('0xd'),_0x53b3e1,_0xc360bc[_0x0028('0xb')][_0x0028('0xe')]);return _0x1914c4(_0xc360bc[_0x0028('0xb')][_0x0028('0xe')]);}else{logger[_0x0028('0xf')](_0x0028('0xd'),_0x53b3e1,_0x0028('0x8'));_0x1914c4(_0xc360bc[_0x0028('0x10')]['message']);}})[_0x0028('0x11')](function(_0x14fa41){logger[_0x0028('0xb')](_0x0028('0xd'),_0x53b3e1,_0x14fa41);_0x2f8bfe(_0x14fa41);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index 9e2d675..66e4172 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x125eb7,_0x13c7b8){var _0x41deb4=function(_0x359315){while(--_0x359315){_0x125eb7['push'](_0x125eb7['shift']());}};_0x41deb4(++_0x13c7b8);}(_0xedd9,0xfc));var _0x9edd=function(_0x343a14,_0xba64bc){_0x343a14=_0x343a14-0x0;var _0x114335=_0xedd9[_0x343a14];return _0x114335;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x1182bd,_0x52ebf2){var _0x5c868b=function(_0x2c905f){while(--_0x2c905f){_0x1182bd['push'](_0x1182bd['shift']());}};_0x5c868b(++_0x52ebf2);}(_0x9c44,0x178));var _0x49c4=function(_0x3ff085,_0x27c92e){_0x3ff085=_0x3ff085-0x0;var _0x2b68c3=_0x9c44[_0x3ff085];return _0x2b68c3;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index 132fecc..510da24 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 _0x282b=['INTEGER','sequelize','exports'];(function(_0x4960cb,_0x439a3b){var _0x17d4fb=function(_0x153444){while(--_0x153444){_0x4960cb['push'](_0x4960cb['shift']());}};_0x17d4fb(++_0x439a3b);}(_0x282b,0x19c));var _0xb282=function(_0x39ed63,_0x18d297){_0x39ed63=_0x39ed63-0x0;var _0x3ede2c=_0x282b[_0x39ed63];return _0x3ede2c;};'use strict';var Sequelize=require(_0xb282('0x0'));module[_0xb282('0x1')]={'penalty':{'type':Sequelize[_0xb282('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xc818=['sequelize','exports','INTEGER'];(function(_0x207061,_0xe38cda){var _0x4a2833=function(_0x16906e){while(--_0x16906e){_0x207061['push'](_0x207061['shift']());}};_0x4a2833(++_0xe38cda);}(_0xc818,0x1e3));var _0x8c81=function(_0x3b8ba4,_0x400656){_0x3b8ba4=_0x3b8ba4-0x0;var _0x33aa21=_0xc818[_0x3b8ba4];return _0x33aa21;};'use strict';var Sequelize=require(_0x8c81('0x0'));module[_0x8c81('0x1')]={'penalty':{'type':Sequelize[_0x8c81('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 2c24452..5e76ced 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 _0x0c69=['rimraf','../../config/environment','./userVoiceQueue.attributes','define','UserVoiceQueue','lodash','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x374dd7,_0x412532){var _0x4005f8=function(_0xebff19){while(--_0xebff19){_0x374dd7['push'](_0x374dd7['shift']());}};_0x4005f8(++_0x412532);}(_0x0c69,0x71));var _0x90c6=function(_0x17437a,_0x4cc6ec){_0x17437a=_0x17437a-0x0;var _0x14befc=_0x0c69[_0x17437a];return _0x14befc;};'use strict';var _=require(_0x90c6('0x0'));var util=require('util');var logger=require(_0x90c6('0x1'))(_0x90c6('0x2'));var moment=require(_0x90c6('0x3'));var BPromise=require(_0x90c6('0x4'));var rp=require(_0x90c6('0x5'));var fs=require('fs');var path=require(_0x90c6('0x6'));var rimraf=require(_0x90c6('0x7'));var config=require(_0x90c6('0x8'));var attributes=require(_0x90c6('0x9'));module['exports']=function(_0x6e4ae2,_0x4dcd6a){return _0x6e4ae2[_0x90c6('0xa')](_0x90c6('0xb'),attributes,{'tableName':'user_has_voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd716=['user_has_voice_queues','api','moment','bluebird','request-promise','exports','define','UserVoiceQueue'];(function(_0xba0502,_0x2fb75b){var _0x5ed16d=function(_0x3154a7){while(--_0x3154a7){_0xba0502['push'](_0xba0502['shift']());}};_0x5ed16d(++_0x2fb75b);}(_0xd716,0x159));var _0x6d71=function(_0x5e1b91,_0x236f17){_0x5e1b91=_0x5e1b91-0x0;var _0x59b52f=_0xd716[_0x5e1b91];return _0x59b52f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x6d71('0x0'));var moment=require(_0x6d71('0x1'));var BPromise=require(_0x6d71('0x2'));var rp=require(_0x6d71('0x3'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./userVoiceQueue.attributes');module[_0x6d71('0x4')]=function(_0x24fe1d,_0x4f1304){return _0x24fe1d[_0x6d71('0x5')](_0x6d71('0x6'),attributes,{'tableName':_0x6d71('0x7'),'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 5c1a39c..628061f 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 _0xa682=['UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info'];(function(_0x212a68,_0x1f0bd4){var _0x5dac80=function(_0x5753d7){while(--_0x5753d7){_0x212a68['push'](_0x212a68['shift']());}};_0x5dac80(++_0x1f0bd4);}(_0xa682,0xe5));var _0x2a68=function(_0x4656fd,_0x2904fa){_0x4656fd=_0x4656fd-0x0;var _0x4a8831=_0xa682[_0x4656fd];return _0x4a8831;};'use strict';var _=require(_0x2a68('0x0'));var util=require(_0x2a68('0x1'));var moment=require(_0x2a68('0x2'));var BPromise=require('bluebird');var rs=require(_0x2a68('0x3'));var fs=require('fs');var Redis=require(_0x2a68('0x4'));var db=require(_0x2a68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x2a68('0x6'))('rpc');var config=require(_0x2a68('0x7'));var jayson=require(_0x2a68('0x8'));var client=jayson[_0x2a68('0x9')][_0x2a68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3175dd,_0x2fc062,_0x2b08b2){return new BPromise(function(_0x173443,_0x270e30){return client[_0x2a68('0xb')](_0x3175dd,_0x2b08b2)['then'](function(_0x29e01d){logger[_0x2a68('0xc')](_0x2a68('0xd'),_0x2fc062,'request\x20sent');logger[_0x2a68('0xe')](_0x2a68('0xf'),_0x2fc062,_0x2a68('0x10'),JSON[_0x2a68('0x11')](_0x29e01d));if(_0x29e01d[_0x2a68('0x12')]){if(_0x29e01d[_0x2a68('0x12')][_0x2a68('0x13')]===0x1f4){logger[_0x2a68('0x12')]('UserVoiceQueue,\x20%s,\x20%s',_0x2fc062,_0x29e01d['error'][_0x2a68('0x14')]);return _0x270e30(_0x29e01d['error'][_0x2a68('0x14')]);}logger[_0x2a68('0x12')](_0x2a68('0xd'),_0x2fc062,_0x29e01d[_0x2a68('0x12')]['message']);return _0x173443(_0x29e01d['error'][_0x2a68('0x14')]);}else{logger[_0x2a68('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x2fc062,_0x2a68('0x10'));_0x173443(_0x29e01d[_0x2a68('0x15')]['message']);}})['catch'](function(_0x1fbe64){logger['error'](_0x2a68('0xd'),_0x2fc062,_0x1fbe64);_0x270e30(_0x1fbe64);});});} \ No newline at end of file +var _0x2519=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1d5895,_0x1acd4a){var _0x12977e=function(_0x3edd60){while(--_0x3edd60){_0x1d5895['push'](_0x1d5895['shift']());}};_0x12977e(++_0x1acd4a);}(_0x2519,0x134));var _0x9251=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2519[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9251('0x0'));var util=require(_0x9251('0x1'));var moment=require('moment');var BPromise=require(_0x9251('0x2'));var rs=require(_0x9251('0x3'));var fs=require('fs');var Redis=require(_0x9251('0x4'));var db=require(_0x9251('0x5'))['db'];var utils=require(_0x9251('0x6'));var logger=require(_0x9251('0x7'))(_0x9251('0x8'));var config=require(_0x9251('0x9'));var jayson=require(_0x9251('0xa'));var client=jayson[_0x9251('0xb')][_0x9251('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3a5b9d,_0xd3db0f,_0x216bed){return new BPromise(function(_0x4dce80,_0x2e1620){return client['request'](_0x3a5b9d,_0x216bed)['then'](function(_0xde21b1){logger['info'](_0x9251('0xd'),_0xd3db0f,_0x9251('0xe'));logger['debug'](_0x9251('0xf'),_0xd3db0f,_0x9251('0xe'),JSON['stringify'](_0xde21b1));if(_0xde21b1[_0x9251('0x10')]){if(_0xde21b1['error'][_0x9251('0x11')]===0x1f4){logger[_0x9251('0x10')](_0x9251('0xd'),_0xd3db0f,_0xde21b1[_0x9251('0x10')]['message']);return _0x2e1620(_0xde21b1[_0x9251('0x10')][_0x9251('0x12')]);}logger[_0x9251('0x10')](_0x9251('0xd'),_0xd3db0f,_0xde21b1[_0x9251('0x10')]['message']);return _0x4dce80(_0xde21b1[_0x9251('0x10')][_0x9251('0x12')]);}else{logger[_0x9251('0x13')](_0x9251('0xd'),_0xd3db0f,_0x9251('0xe'));_0x4dce80(_0xde21b1['result'][_0x9251('0x12')]);}})[_0x9251('0x14')](function(_0x12d49d){logger[_0x9251('0x10')](_0x9251('0xd'),_0xd3db0f,_0x12d49d);_0x2e1620(_0x12d49d);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index a198216..4a1ce31 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x19ac6d,_0x3fe806){var _0x11a628=function(_0x4cbbf4){while(--_0x4cbbf4){_0x19ac6d['push'](_0x19ac6d['shift']());}};_0x11a628(++_0x3fe806);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'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 +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3c3374,_0x1abecc){var _0x26e049=function(_0x26fa31){while(--_0x26fa31){_0x3c3374['push'](_0x3c3374['shift']());}};_0x26e049(++_0x1abecc);}(_0xe706,0xa3));var _0x6e70=function(_0x5634d2,_0x40ec38){_0x5634d2=_0x5634d2-0x0;var _0x4150b5=_0xe706[_0x5634d2];return _0x4150b5;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 6590008..a8f0fd9 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 _0x9663=['exports','INTEGER','Required\x20by\x20Asterisk','STRING','queue_interface','sequelize'];(function(_0xd5c810,_0xf6609d){var _0x418eb3=function(_0xc2eaf0){while(--_0xc2eaf0){_0xd5c810['push'](_0xd5c810['shift']());}};_0x418eb3(++_0xf6609d);}(_0x9663,0xe3));var _0x3966=function(_0x5475fe,_0x498f19){_0x5475fe=_0x5475fe-0x0;var _0x4c603d=_0x9663[_0x5475fe];return _0x4c603d;};'use strict';var Sequelize=require(_0x3966('0x0'));module[_0x3966('0x1')]={'uniqueid':{'type':Sequelize[_0x3966('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x3966('0x3')},'membername':{'type':Sequelize[_0x3966('0x4')],'allowNull':![],'comment':_0x3966('0x3')},'UserId':{'type':Sequelize[_0x3966('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x3966('0x4')],'allowNull':![],'unique':_0x3966('0x5'),'comment':_0x3966('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0x3966('0x4')],'allowNull':![],'unique':_0x3966('0x5'),'comment':_0x3966('0x3')},'penalty':{'type':Sequelize[_0x3966('0x2')](0xb),'defaultValue':0x0,'comment':_0x3966('0x3')},'paused':{'type':Sequelize[_0x3966('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'}}; \ No newline at end of file +var _0x4779=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x3b74bc,_0x21b50e){var _0x5a3fdc=function(_0x161f1c){while(--_0x161f1c){_0x3b74bc['push'](_0x3b74bc['shift']());}};_0x5a3fdc(++_0x21b50e);}(_0x4779,0xc2));var _0x9477=function(_0x1f54ea,_0x7fd810){_0x1f54ea=_0x1f54ea-0x0;var _0x1dff21=_0x4779[_0x1f54ea];return _0x1dff21;};'use strict';var Sequelize=require(_0x9477('0x0'));module[_0x9477('0x1')]={'uniqueid':{'type':Sequelize[_0x9477('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x9477('0x3')},'membername':{'type':Sequelize[_0x9477('0x4')],'allowNull':![],'comment':'Required\x20by\x20Asterisk'},'UserId':{'type':Sequelize[_0x9477('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9477('0x5'),'comment':_0x9477('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x9477('0x5'),'comment':_0x9477('0x3')},'penalty':{'type':Sequelize[_0x9477('0x2')](0xb),'defaultValue':0x0,'comment':_0x9477('0x3')},'paused':{'type':Sequelize[_0x9477('0x2')](0xb),'defaultValue':0x0,'comment':_0x9477('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index 602ca22..e1c345b 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 _0xc3c5=['UserVoiceQueueRt','setMaxListeners','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0x5d0fd4,_0x544139){var _0x1add95=function(_0x55b8e3){while(--_0x55b8e3){_0x5d0fd4['push'](_0x5d0fd4['shift']());}};_0x1add95(++_0x544139);}(_0xc3c5,0xa0));var _0x5c3c=function(_0x161037,_0x5d41a8){_0x161037=_0x161037-0x0;var _0x18fc3e=_0xc3c5[_0x161037];return _0x18fc3e;};'use strict';var EventEmitter=require(_0x5c3c('0x0'));var UserVoiceQueueRt=require(_0x5c3c('0x1'))['db'][_0x5c3c('0x2')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0x5c3c('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x5c3c('0x4')};function emitEvent(_0x2cd15d){return function(_0x1727ed,_0x194a91,_0x1e587d){UserVoiceQueueRtEvents[_0x5c3c('0x5')](_0x2cd15d+':'+_0x1727ed['id'],_0x1727ed);UserVoiceQueueRtEvents[_0x5c3c('0x5')](_0x2cd15d,_0x1727ed);_0x1e587d(null);};}for(var e in events){if(events[_0x5c3c('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x5c3c('0x7')](e,emitEvent(event));}}module[_0x5c3c('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0x27fc=['setMaxListeners','save','update','remove','emit','hook','exports','UserVoiceQueueRt'];(function(_0x5c27ae,_0x10dfb7){var _0x3eef82=function(_0x35b90c){while(--_0x35b90c){_0x5c27ae['push'](_0x5c27ae['shift']());}};_0x3eef82(++_0x10dfb7);}(_0x27fc,0x187));var _0xc27f=function(_0x29588b,_0x582f54){_0x29588b=_0x29588b-0x0;var _0x1192bf=_0x27fc[_0x29588b];return _0x1192bf;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require('../../mysqldb')['db'][_0xc27f('0x0')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents[_0xc27f('0x1')](0x0);var events={'afterCreate':_0xc27f('0x2'),'afterUpdate':_0xc27f('0x3'),'afterDestroy':_0xc27f('0x4')};function emitEvent(_0x582798){return function(_0x10ade3,_0x544c39,_0x17af4c){UserVoiceQueueRtEvents['emit'](_0x582798+':'+_0x10ade3['id'],_0x10ade3);UserVoiceQueueRtEvents[_0xc27f('0x5')](_0x582798,_0x10ade3);_0x17af4c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserVoiceQueueRt[_0xc27f('0x6')](e,emitEvent(event));}}module[_0xc27f('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 9e83134..d61f415 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 _0x30a9=['moment','request-promise','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','../../config/logger'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0x30a9,0x18e));var _0x930a=function(_0x667006,_0x24e7e4){_0x667006=_0x667006-0x0;var _0x5566dc=_0x30a9[_0x667006];return _0x5566dc;};'use strict';var _=require(_0x930a('0x0'));var util=require('util');var logger=require(_0x930a('0x1'))('api');var moment=require(_0x930a('0x2'));var BPromise=require('bluebird');var rp=require(_0x930a('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x930a('0x4'));var config=require(_0x930a('0x5'));var attributes=require(_0x930a('0x6'));module['exports']=function(_0x5de23a,_0x3114ee){return _0x5de23a[_0x930a('0x7')](_0x930a('0x8'),attributes,{'tableName':_0x930a('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9eff=['user_has_voice_queues_rt','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userVoiceQueueRt.attributes','exports','UserVoiceQueueRt'];(function(_0x1e3785,_0x74d559){var _0x5cd5c3=function(_0x34c59b){while(--_0x34c59b){_0x1e3785['push'](_0x1e3785['shift']());}};_0x5cd5c3(++_0x74d559);}(_0x9eff,0x85));var _0xf9ef=function(_0x819464,_0x46fc91){_0x819464=_0x819464-0x0;var _0x49dcc0=_0x9eff[_0x819464];return _0x49dcc0;};'use strict';var _=require(_0xf9ef('0x0'));var util=require('util');var logger=require(_0xf9ef('0x1'))(_0xf9ef('0x2'));var moment=require(_0xf9ef('0x3'));var BPromise=require(_0xf9ef('0x4'));var rp=require(_0xf9ef('0x5'));var fs=require('fs');var path=require(_0xf9ef('0x6'));var rimraf=require(_0xf9ef('0x7'));var config=require('../../config/environment');var attributes=require(_0xf9ef('0x8'));module[_0xf9ef('0x9')]=function(_0x381cfb,_0x3ed486){return _0x381cfb['define'](_0xf9ef('0xa'),attributes,{'tableName':_0xf9ef('0xb'),'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 f8554f3..52a90f9 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 _0xb84b=['client','http','redis','defaults','localhost','socket.io-emitter','then','info','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','UserVoiceQueueRt,\x20%s,\x20%s','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','raw','where','COUNT','sequelize','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','util','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0xacadf9,_0x435886){var _0x1f2a17=function(_0x52a859){while(--_0x52a859){_0xacadf9['push'](_0xacadf9['shift']());}};_0x1f2a17(++_0x435886);}(_0xb84b,0x178));var _0xbb84=function(_0x3de217,_0x5d866d){_0x3de217=_0x3de217-0x0;var _0x27b905=_0xb84b[_0x3de217];return _0x27b905;};'use strict';var _=require(_0xbb84('0x0'));var util=require(_0xbb84('0x1'));var moment=require(_0xbb84('0x2'));var BPromise=require(_0xbb84('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbb84('0x4'));var db=require(_0xbb84('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbb84('0x6'));var config=require(_0xbb84('0x7'));var jayson=require(_0xbb84('0x8'));var client=jayson[_0xbb84('0x9')][_0xbb84('0xa')]({'port':0x232a});config[_0xbb84('0xb')]=_[_0xbb84('0xc')](config['redis'],{'host':_0xbb84('0xd'),'port':0x18eb});var socket=require(_0xbb84('0xe'))(new Redis(config[_0xbb84('0xb')]));require('./userVoiceQueueRt.socket')['register'](socket);function respondWithRpcPromise(_0x5aa532,_0x530c15,_0x51c3fb){return new BPromise(function(_0x4617a0,_0x27e894){return client['request'](_0x5aa532,_0x51c3fb)[_0xbb84('0xf')](function(_0x46451c){logger[_0xbb84('0x10')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x530c15,'request\x20sent');logger['debug'](_0xbb84('0x11'),_0x530c15,_0xbb84('0x12'),JSON['stringify'](_0x46451c));if(_0x46451c[_0xbb84('0x13')]){if(_0x46451c[_0xbb84('0x13')][_0xbb84('0x14')]===0x1f4){logger[_0xbb84('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x530c15,_0x46451c[_0xbb84('0x13')]['message']);return _0x27e894(_0x46451c['error'][_0xbb84('0x15')]);}logger[_0xbb84('0x13')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x530c15,_0x46451c['error'][_0xbb84('0x15')]);return _0x4617a0(_0x46451c[_0xbb84('0x13')][_0xbb84('0x15')]);}else{logger[_0xbb84('0x10')](_0xbb84('0x16'),_0x530c15,_0xbb84('0x12'));_0x4617a0(_0x46451c[_0xbb84('0x17')][_0xbb84('0x15')]);}})['catch'](function(_0x379749){logger[_0xbb84('0x13')](_0xbb84('0x16'),_0x530c15,_0x379749);_0x27e894(_0x379749);});});}exports[_0xbb84('0x18')]=function(_0x2aae72){var _0x37c308=this;return new Promise(function(_0x54033f,_0x130828){return db[_0xbb84('0x19')][_0xbb84('0x1a')]({'raw':_0x2aae72[_0xbb84('0x1b')]?_0x2aae72[_0xbb84('0x1b')][_0xbb84('0x1c')]===undefined?!![]:![]:!![],'where':_0x2aae72[_0xbb84('0x1b')]?_0x2aae72[_0xbb84('0x1b')][_0xbb84('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0xbb84('0x1e'),db[_0xbb84('0x1f')]['fn']('IF',db['sequelize']['literal'](_0xbb84('0x20')))),_0xbb84('0x21')]]})[_0xbb84('0xf')](function(_0x33d627){logger[_0xbb84('0x10')](_0xbb84('0x18'),_0x2aae72);logger[_0xbb84('0x22')](_0xbb84('0x18'),_0x2aae72,JSON['stringify'](_0x33d627));_0x54033f(_0x33d627);})['catch'](function(_0x2a71c3){logger[_0xbb84('0x13')](_0xbb84('0x18'),_0x2a71c3[_0xbb84('0x15')],_0x2aae72);_0x130828(_0x37c308[_0xbb84('0x13')](0x1f4,_0x2a71c3[_0xbb84('0x15')]));});});}; \ No newline at end of file +var _0xb27e=['UserVoiceQueueRt','findAll','options','raw','where','sequelize','COUNT','literal','`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','debug','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','socket.io-emitter','./userVoiceQueueRt.socket','register','request','then','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','error','message','result','catch','GetVoiceQueueRtPauses'];(function(_0x51020b,_0x38c2c7){var _0x371e47=function(_0x2a538f){while(--_0x2a538f){_0x51020b['push'](_0x51020b['shift']());}};_0x371e47(++_0x38c2c7);}(_0xb27e,0x1c7));var _0xeb27=function(_0x3b0c6e,_0x308e8d){_0x3b0c6e=_0x3b0c6e-0x0;var _0x38b172=_0xb27e[_0x3b0c6e];return _0x38b172;};'use strict';var _=require(_0xeb27('0x0'));var util=require('util');var moment=require(_0xeb27('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb27('0x2'));var db=require(_0xeb27('0x3'))['db'];var utils=require(_0xeb27('0x4'));var logger=require(_0xeb27('0x5'))(_0xeb27('0x6'));var config=require(_0xeb27('0x7'));var jayson=require(_0xeb27('0x8'));var client=jayson[_0xeb27('0x9')]['http']({'port':0x232a});config['redis']=_[_0xeb27('0xa')](config[_0xeb27('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xeb27('0xc'))(new Redis(config[_0xeb27('0xb')]));require(_0xeb27('0xd'))[_0xeb27('0xe')](socket);function respondWithRpcPromise(_0x291007,_0x3c1119,_0x2baccc){return new BPromise(function(_0x37642f,_0x4df4e8){return client[_0xeb27('0xf')](_0x291007,_0x2baccc)[_0xeb27('0x10')](function(_0x5315e3){logger[_0xeb27('0x11')](_0xeb27('0x12'),_0x3c1119,_0xeb27('0x13'));logger['debug'](_0xeb27('0x14'),_0x3c1119,_0xeb27('0x13'),JSON['stringify'](_0x5315e3));if(_0x5315e3['error']){if(_0x5315e3['error']['code']===0x1f4){logger['error'](_0xeb27('0x12'),_0x3c1119,_0x5315e3[_0xeb27('0x15')][_0xeb27('0x16')]);return _0x4df4e8(_0x5315e3[_0xeb27('0x15')]['message']);}logger[_0xeb27('0x15')](_0xeb27('0x12'),_0x3c1119,_0x5315e3[_0xeb27('0x15')]['message']);return _0x37642f(_0x5315e3[_0xeb27('0x15')][_0xeb27('0x16')]);}else{logger['info'](_0xeb27('0x12'),_0x3c1119,'request\x20sent');_0x37642f(_0x5315e3[_0xeb27('0x17')]['message']);}})[_0xeb27('0x18')](function(_0x339147){logger[_0xeb27('0x15')](_0xeb27('0x12'),_0x3c1119,_0x339147);_0x4df4e8(_0x339147);});});}exports[_0xeb27('0x19')]=function(_0x5cb3b5){var _0x242732=this;return new Promise(function(_0x880d5e,_0x2661f2){return db[_0xeb27('0x1a')][_0xeb27('0x1b')]({'raw':_0x5cb3b5[_0xeb27('0x1c')]?_0x5cb3b5[_0xeb27('0x1c')][_0xeb27('0x1d')]===undefined?!![]:![]:!![],'where':_0x5cb3b5[_0xeb27('0x1c')]?_0x5cb3b5['options'][_0xeb27('0x1e')]||null:null,'attributes':[[db[_0xeb27('0x1f')]['fn'](_0xeb27('0x20'),db[_0xeb27('0x1f')]['fn']('IF',db['sequelize'][_0xeb27('0x21')](_0xeb27('0x22')))),_0xeb27('0x23')]]})['then'](function(_0x2fefb1){logger[_0xeb27('0x11')]('GetVoiceQueueRtPauses',_0x5cb3b5);logger[_0xeb27('0x24')](_0xeb27('0x19'),_0x5cb3b5,JSON['stringify'](_0x2fefb1));_0x880d5e(_0x2fefb1);})[_0xeb27('0x18')](function(_0x554e71){logger['error'](_0xeb27('0x19'),_0x554e71[_0xeb27('0x16')],_0x5cb3b5);_0x2661f2(_0x242732[_0xeb27('0x15')](0x1f4,_0x554e71[_0xeb27('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index 8a7cab2..ca031ee 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 _0xed08=['remove','update','emit','removeListener','register','length','userVoiceQueueRt:','save'];(function(_0x128450,_0x5869ba){var _0x4d80ed=function(_0x4a2da3){while(--_0x4a2da3){_0x128450['push'](_0x128450['shift']());}};_0x4d80ed(++_0x5869ba);}(_0xed08,0x67));var _0x8ed0=function(_0x1ffb1a,_0x2f1e05){_0x1ffb1a=_0x1ffb1a-0x0;var _0xde0b35=_0xed08[_0x1ffb1a];return _0xde0b35;};'use strict';var UserVoiceQueueRtEvents=require('./userVoiceQueueRt.events');var events=[_0x8ed0('0x0'),_0x8ed0('0x1'),_0x8ed0('0x2')];function createListener(_0x13c458,_0xce1ff){return function(_0x1ff91e){_0xce1ff[_0x8ed0('0x3')](_0x13c458,_0x1ff91e);};}function removeListener(_0x33c3ad,_0x14901f){return function(){UserVoiceQueueRtEvents[_0x8ed0('0x4')](_0x33c3ad,_0x14901f);};}exports[_0x8ed0('0x5')]=function(_0x43ca60){for(var _0x5c1343=0x0,_0x15f266=events[_0x8ed0('0x6')];_0x5c1343<_0x15f266;_0x5c1343++){var _0x1c86e6=events[_0x5c1343];var _0x39642a=createListener(_0x8ed0('0x7')+_0x1c86e6,_0x43ca60);UserVoiceQueueRtEvents['on'](_0x1c86e6,_0x39642a);}}; \ No newline at end of file +var _0xc569=['emit','register','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove'];(function(_0x4ff09b,_0x53f67d){var _0x3f5c2e=function(_0x124592){while(--_0x124592){_0x4ff09b['push'](_0x4ff09b['shift']());}};_0x3f5c2e(++_0x53f67d);}(_0xc569,0x159));var _0x9c56=function(_0x5e7705,_0x4d5db1){_0x5e7705=_0x5e7705-0x0;var _0x59adc0=_0xc569[_0x5e7705];return _0x59adc0;};'use strict';var UserVoiceQueueRtEvents=require(_0x9c56('0x0'));var events=[_0x9c56('0x1'),_0x9c56('0x2'),'update'];function createListener(_0x8d47c5,_0x1400d6){return function(_0x532f75){_0x1400d6[_0x9c56('0x3')](_0x8d47c5,_0x532f75);};}function removeListener(_0x24527a,_0x23402b){return function(){UserVoiceQueueRtEvents['removeListener'](_0x24527a,_0x23402b);};}exports[_0x9c56('0x4')]=function(_0x2e2421){for(var _0xe6ba11=0x0,_0x38a9cf=events['length'];_0xe6ba11<_0x38a9cf;_0xe6ba11++){var _0x15206f=events[_0xe6ba11];var _0xaba9c7=createListener(_0x9c56('0x5')+_0x15206f,_0x2e2421);UserVoiceQueueRtEvents['on'](_0x15206f,_0xaba9c7);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 3bab6ab..14ecba8 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 _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x4ebdf4,_0x57d47f){var _0x18d1c1=function(_0x83f2a0){while(--_0x83f2a0){_0x4ebdf4['push'](_0x4ebdf4['shift']());}};_0x18d1c1(++_0x57d47f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'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'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x4a6339,_0x30cd3a){var _0x5e9a19=function(_0x4ac2b4){while(--_0x4ac2b4){_0x4a6339['push'](_0x4a6339['shift']());}};_0x5e9a19(++_0x30cd3a);}(_0x9c44,0x178));var _0x49c4=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0x9c44[_0x32f7d7];return _0x133d09;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index 82f93a0..bdb0002 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 _0x32b7=['INTEGER','sequelize'];(function(_0x251e82,_0x3347bb){var _0x50da16=function(_0x5a59b4){while(--_0x5a59b4){_0x251e82['push'](_0x251e82['shift']());}};_0x50da16(++_0x3347bb);}(_0x32b7,0x91));var _0x732b=function(_0x28a191,_0x14b1ca){_0x28a191=_0x28a191-0x0;var _0x5f156c=_0x32b7[_0x28a191];return _0x5f156c;};'use strict';var Sequelize=require(_0x732b('0x0'));module['exports']={'penalty':{'type':Sequelize[_0x732b('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa7af=['sequelize','exports','INTEGER'];(function(_0x18459d,_0x1b1401){var _0x5c0828=function(_0x26ebb1){while(--_0x26ebb1){_0x18459d['push'](_0x18459d['shift']());}};_0x5c0828(++_0x1b1401);}(_0xa7af,0x13e));var _0xfa7a=function(_0x4f1d39,_0x2eb737){_0x4f1d39=_0x4f1d39-0x0;var _0x56134f=_0xa7af[_0x4f1d39];return _0x56134f;};'use strict';var Sequelize=require(_0xfa7a('0x0'));module[_0xfa7a('0x1')]={'penalty':{'type':Sequelize[_0xfa7a('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 4ea6899..b6632c7 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 _0x28b5=['path','rimraf','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util','api','moment','bluebird','request-promise'];(function(_0x2c8b5e,_0x4d3969){var _0x338efd=function(_0x3cd51a){while(--_0x3cd51a){_0x2c8b5e['push'](_0x2c8b5e['shift']());}};_0x338efd(++_0x4d3969);}(_0x28b5,0x96));var _0x528b=function(_0x2a370a,_0x120126){_0x2a370a=_0x2a370a-0x0;var _0x58f41c=_0x28b5[_0x2a370a];return _0x58f41c;};'use strict';var _=require(_0x528b('0x0'));var util=require(_0x528b('0x1'));var logger=require('../../config/logger')(_0x528b('0x2'));var moment=require(_0x528b('0x3'));var BPromise=require(_0x528b('0x4'));var rp=require(_0x528b('0x5'));var fs=require('fs');var path=require(_0x528b('0x6'));var rimraf=require(_0x528b('0x7'));var config=require('../../config/environment');var attributes=require(_0x528b('0x8'));module[_0x528b('0x9')]=function(_0x4261a6,_0x15e20a){return _0x4261a6[_0x528b('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x528b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0356=['../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./userWhatsappQueue.attributes','exports','define','user_has_whatsapp_queues','lodash','util'];(function(_0x16dd98,_0x11d346){var _0xfc7fb3=function(_0x40d7d8){while(--_0x40d7d8){_0x16dd98['push'](_0x16dd98['shift']());}};_0xfc7fb3(++_0x11d346);}(_0x0356,0x112));var _0x6035=function(_0x13b906,_0x4b3ae0){_0x13b906=_0x13b906-0x0;var _0x296f94=_0x0356[_0x13b906];return _0x296f94;};'use strict';var _=require(_0x6035('0x0'));var util=require(_0x6035('0x1'));var logger=require(_0x6035('0x2'))(_0x6035('0x3'));var moment=require(_0x6035('0x4'));var BPromise=require(_0x6035('0x5'));var rp=require(_0x6035('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6035('0x7'));var attributes=require(_0x6035('0x8'));module[_0x6035('0x9')]=function(_0x396b43,_0x3d8f62){return _0x396b43[_0x6035('0xa')]('UserWhatsappQueue',attributes,{'tableName':_0x6035('0xb'),'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 c727c29..cdde8ca 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 _0xe3b3=['error','code','message','result','catch','lodash','util','moment','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x575083,_0x5108f7){var _0xd2c82b=function(_0x1fec18){while(--_0x1fec18){_0x575083['push'](_0x575083['shift']());}};_0xd2c82b(++_0x5108f7);}(_0xe3b3,0x1bd));var _0x3e3b=function(_0x5b37d3,_0x1da2ea){_0x5b37d3=_0x5b37d3-0x0;var _0x53a515=_0xe3b3[_0x5b37d3];return _0x53a515;};'use strict';var _=require(_0x3e3b('0x0'));var util=require(_0x3e3b('0x1'));var moment=require(_0x3e3b('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3e3b('0x3'))['db'];var utils=require(_0x3e3b('0x4'));var logger=require('../../config/logger')(_0x3e3b('0x5'));var config=require(_0x3e3b('0x6'));var jayson=require(_0x3e3b('0x7'));var client=jayson[_0x3e3b('0x8')][_0x3e3b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4ae129,_0x40a5dd,_0x5f3b8a){return new BPromise(function(_0x48b926,_0x1b34a2){return client[_0x3e3b('0xa')](_0x4ae129,_0x5f3b8a)[_0x3e3b('0xb')](function(_0x2a1be2){logger[_0x3e3b('0xc')](_0x3e3b('0xd'),_0x40a5dd,_0x3e3b('0xe'));logger[_0x3e3b('0xf')]('UserWhatsappQueue,\x20%s,\x20%s,\x20%s',_0x40a5dd,'request\x20sent',JSON[_0x3e3b('0x10')](_0x2a1be2));if(_0x2a1be2[_0x3e3b('0x11')]){if(_0x2a1be2[_0x3e3b('0x11')][_0x3e3b('0x12')]===0x1f4){logger[_0x3e3b('0x11')](_0x3e3b('0xd'),_0x40a5dd,_0x2a1be2[_0x3e3b('0x11')][_0x3e3b('0x13')]);return _0x1b34a2(_0x2a1be2['error'][_0x3e3b('0x13')]);}logger[_0x3e3b('0x11')](_0x3e3b('0xd'),_0x40a5dd,_0x2a1be2[_0x3e3b('0x11')][_0x3e3b('0x13')]);return _0x48b926(_0x2a1be2[_0x3e3b('0x11')][_0x3e3b('0x13')]);}else{logger[_0x3e3b('0xc')](_0x3e3b('0xd'),_0x40a5dd,_0x3e3b('0xe'));_0x48b926(_0x2a1be2[_0x3e3b('0x14')][_0x3e3b('0x13')]);}})[_0x3e3b('0x15')](function(_0x2c2b20){logger[_0x3e3b('0x11')](_0x3e3b('0xd'),_0x40a5dd,_0x2c2b20);_0x1b34a2(_0x2c2b20);});});} \ No newline at end of file +var _0x478a=['message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x55e08b,_0x421620){var _0xd1a7ff=function(_0x58c7ff){while(--_0x58c7ff){_0x55e08b['push'](_0x55e08b['shift']());}};_0xd1a7ff(++_0x421620);}(_0x478a,0x128));var _0xa478=function(_0x58b9a7,_0x6920c3){_0x58b9a7=_0x58b9a7-0x0;var _0x86d552=_0x478a[_0x58b9a7];return _0x86d552;};'use strict';var _=require(_0xa478('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa478('0x1'));var rs=require(_0xa478('0x2'));var fs=require('fs');var Redis=require(_0xa478('0x3'));var db=require(_0xa478('0x4'))['db'];var utils=require(_0xa478('0x5'));var logger=require('../../config/logger')(_0xa478('0x6'));var config=require(_0xa478('0x7'));var jayson=require(_0xa478('0x8'));var client=jayson['client'][_0xa478('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3690c4,_0x390dd2,_0x2f5f6e){return new BPromise(function(_0x52cf59,_0x456b8a){return client[_0xa478('0xa')](_0x3690c4,_0x2f5f6e)[_0xa478('0xb')](function(_0x4baab3){logger[_0xa478('0xc')](_0xa478('0xd'),_0x390dd2,_0xa478('0xe'));logger[_0xa478('0xf')](_0xa478('0x10'),_0x390dd2,_0xa478('0xe'),JSON['stringify'](_0x4baab3));if(_0x4baab3[_0xa478('0x11')]){if(_0x4baab3[_0xa478('0x11')][_0xa478('0x12')]===0x1f4){logger[_0xa478('0x11')](_0xa478('0xd'),_0x390dd2,_0x4baab3[_0xa478('0x11')][_0xa478('0x13')]);return _0x456b8a(_0x4baab3[_0xa478('0x11')][_0xa478('0x13')]);}logger[_0xa478('0x11')](_0xa478('0xd'),_0x390dd2,_0x4baab3[_0xa478('0x11')]['message']);return _0x52cf59(_0x4baab3['error'][_0xa478('0x13')]);}else{logger[_0xa478('0xc')](_0xa478('0xd'),_0x390dd2,'request\x20sent');_0x52cf59(_0x4baab3[_0xa478('0x14')][_0xa478('0x13')]);}})['catch'](function(_0x31eab1){logger[_0xa478('0x11')](_0xa478('0xd'),_0x390dd2,_0x31eab1);_0x456b8a(_0x31eab1);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index 563604b..c107221 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 _0x9305=['show','post','create','/:id','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index'];(function(_0x23e393,_0x52c98b){var _0x187023=function(_0x1645ef){while(--_0x1645ef){_0x23e393['push'](_0x23e393['shift']());}};_0x187023(++_0x52c98b);}(_0x9305,0x1e2));var _0x5930=function(_0x17ba72,_0x308cf8){_0x17ba72=_0x17ba72-0x0;var _0x10361c=_0x9305[_0x17ba72];return _0x10361c;};'use strict';var multer=require(_0x5930('0x0'));var util=require(_0x5930('0x1'));var path=require(_0x5930('0x2'));var timeout=require(_0x5930('0x3'));var express=require('express');var router=express[_0x5930('0x4')]();var fs_extra=require(_0x5930('0x5'));var auth=require(_0x5930('0x6'));var interaction=require(_0x5930('0x7'));var config=require('../../config/environment');var controller=require(_0x5930('0x8'));router[_0x5930('0x9')]('/',auth[_0x5930('0xa')](),controller[_0x5930('0xb')]);router['get']('/:id',auth[_0x5930('0xa')](),controller[_0x5930('0xc')]);router[_0x5930('0xd')]('/',auth['isAuthenticated'](),controller[_0x5930('0xe')]);router['put'](_0x5930('0xf'),auth['isAuthenticated'](),controller[_0x5930('0x10')]);router[_0x5930('0x11')]('/:id',auth[_0x5930('0xa')](),controller[_0x5930('0x12')]);module['exports']=router; \ No newline at end of file +var _0x0e9f=['create','put','update','delete','destroy','exports','multer','util','express','../../components/auth/service','./variable.controller','get','index','/:id','isAuthenticated','show'];(function(_0x34232c,_0x18e61d){var _0x4d4f4e=function(_0x1aeb3d){while(--_0x1aeb3d){_0x34232c['push'](_0x34232c['shift']());}};_0x4d4f4e(++_0x18e61d);}(_0x0e9f,0x116));var _0xf0e9=function(_0x527d03,_0x37e61c){_0x527d03=_0x527d03-0x0;var _0x1f96b1=_0x0e9f[_0x527d03];return _0x1f96b1;};'use strict';var multer=require(_0xf0e9('0x0'));var util=require(_0xf0e9('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xf0e9('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf0e9('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf0e9('0x4'));router[_0xf0e9('0x5')]('/',auth['isAuthenticated'](),controller[_0xf0e9('0x6')]);router['get'](_0xf0e9('0x7'),auth[_0xf0e9('0x8')](),controller[_0xf0e9('0x9')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf0e9('0xa')]);router[_0xf0e9('0xb')](_0xf0e9('0x7'),auth['isAuthenticated'](),controller[_0xf0e9('0xc')]);router[_0xf0e9('0xd')](_0xf0e9('0x7'),auth['isAuthenticated'](),controller[_0xf0e9('0xe')]);module[_0xf0e9('0xf')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index bcb7d51..d41420d 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 _0xf54b=['name','exports','STRING'];(function(_0x40699c,_0x3e9d59){var _0x2aea6c=function(_0x19db08){while(--_0x19db08){_0x40699c['push'](_0x40699c['shift']());}};_0x2aea6c(++_0x3e9d59);}(_0xf54b,0xa6));var _0xbf54=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0xf54b[_0x249e96];return _0x17444c;};'use strict';var Sequelize=require('sequelize');module[_0xbf54('0x0')]={'name':{'type':Sequelize[_0xbf54('0x1')],'unique':_0xbf54('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xbf54('0x1')]}}; \ No newline at end of file +var _0x8137=['sequelize'];(function(_0x275fbb,_0x52bdd9){var _0x1a1699=function(_0x2ded23){while(--_0x2ded23){_0x275fbb['push'](_0x275fbb['shift']());}};_0x1a1699(++_0x52bdd9);}(_0x8137,0x16b));var _0x7813=function(_0x29d915,_0x54a040){_0x29d915=_0x29d915-0x0;var _0x160f86=_0x8137[_0x29d915];return _0x160f86;};'use strict';var Sequelize=require(_0x7813('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index f5d3372..de2df4d 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 _0xa752=['Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','fs-extra','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','update','destroy','then','get','Variables','UserProfileResource','error','stack','send','Variable','rawAttributes','type','model','map','name','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create'];(function(_0x479160,_0x3ab560){var _0x47ac6d=function(_0x3f7314){while(--_0x3f7314){_0x479160['push'](_0x479160['shift']());}};_0x47ac6d(++_0x3ab560);}(_0xa752,0x1ac));var _0x2a75=function(_0x40cf3d,_0x51ac5f){_0x40cf3d=_0x40cf3d-0x0;var _0x153887=_0xa752[_0x40cf3d];return _0x153887;};'use strict';var emlformat=require(_0x2a75('0x0'));var rimraf=require(_0x2a75('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2a75('0x2'));var rp=require(_0x2a75('0x3'));var moment=require(_0x2a75('0x4'));var BPromise=require(_0x2a75('0x5'));var Mustache=require(_0x2a75('0x6'));var util=require(_0x2a75('0x7'));var path=require('path');var sox=require('sox');var csv=require(_0x2a75('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2a75('0x9'));var _=require(_0x2a75('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x2a75('0xb'));var deskjs=require(_0x2a75('0xc'));var toCsv=require(_0x2a75('0x8'));var querystring=require(_0x2a75('0xd'));var Papa=require(_0x2a75('0xe'));var Redis=require(_0x2a75('0xf'));var authService=require(_0x2a75('0x10'));var qs=require(_0x2a75('0x11'));var as=require(_0x2a75('0x12'));var hardwareService=require(_0x2a75('0x13'));var logger=require(_0x2a75('0x14'))(_0x2a75('0x15'));var utils=require(_0x2a75('0x16'));var config=require(_0x2a75('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x2a75('0x18'))['db'];function respondWithStatusCode(_0x290ef1,_0x5cda94){_0x5cda94=_0x5cda94||0xcc;return function(_0x1e834c){if(_0x1e834c){return _0x290ef1[_0x2a75('0x19')](_0x5cda94);}return _0x290ef1[_0x2a75('0x1a')](_0x5cda94)[_0x2a75('0x1b')]();};}function respondWithResult(_0x1467bb,_0x265287){_0x265287=_0x265287||0xc8;return function(_0x508fb7){if(_0x508fb7){return _0x1467bb[_0x2a75('0x1a')](_0x265287)[_0x2a75('0x1c')](_0x508fb7);}};}function respondWithFilteredResult(_0x14d3a9,_0x5753bc){return function(_0x2f20c0){if(_0x2f20c0){var _0x4ed5f3=typeof _0x5753bc[_0x2a75('0x1d')]===_0x2a75('0x1e')&&typeof _0x5753bc['limit']===_0x2a75('0x1e');var _0x4d246b=_0x2f20c0['count'];var _0x408327=_0x4ed5f3?0x0:_0x5753bc['offset'];var _0x4e4632=_0x4ed5f3?_0x2f20c0[_0x2a75('0x1f')]:_0x5753bc[_0x2a75('0x1d')]+_0x5753bc[_0x2a75('0x20')];var _0x196291;if(_0x4e4632>=_0x4d246b){_0x4e4632=_0x4d246b;_0x196291=0xc8;}else{_0x196291=0xce;}_0x14d3a9[_0x2a75('0x1a')](_0x196291);return _0x14d3a9['set'](_0x2a75('0x21'),_0x408327+'-'+_0x4e4632+'/'+_0x4d246b)['json'](_0x2f20c0);}return null;};}function patchUpdates(_0x149ac1){return function(_0x1b0305){try{jsonpatch['apply'](_0x1b0305,_0x149ac1,!![]);}catch(_0x1cd379){return BPromise[_0x2a75('0x22')](_0x1cd379);}return _0x1b0305[_0x2a75('0x23')]();};}function saveUpdates(_0x5b0b5f,_0x405341){return function(_0x293c7a){if(_0x293c7a){return _0x293c7a[_0x2a75('0x24')](_0x5b0b5f)['then'](function(_0x4ab3a2){return _0x4ab3a2;});}return null;};}function removeEntity(_0x2eb118,_0xaf2bba){return function(_0x4c5bf6){if(_0x4c5bf6){return _0x4c5bf6[_0x2a75('0x25')]()[_0x2a75('0x26')](function(){var _0x2800a8=_0x4c5bf6[_0x2a75('0x27')]({'plain':!![]});var _0x5a82f4=_0x2a75('0x28');return db[_0x2a75('0x29')][_0x2a75('0x25')]({'where':{'type':_0x5a82f4,'resourceId':_0x2800a8['id']}})[_0x2a75('0x26')](function(){return _0x4c5bf6;});})['then'](function(){_0x2eb118[_0x2a75('0x1a')](0xcc)[_0x2a75('0x1b')]();});}};}function handleEntityNotFound(_0x2ec644,_0x177bdc){return function(_0x43a1d1){if(!_0x43a1d1){_0x2ec644[_0x2a75('0x19')](0x194);}return _0x43a1d1;};}function handleError(_0x5a8b78,_0x68fc71){_0x68fc71=_0x68fc71||0x1f4;return function(_0x5448f9){logger[_0x2a75('0x2a')](_0x5448f9[_0x2a75('0x2b')]);if(_0x5448f9['name']){delete _0x5448f9['name'];}_0x5a8b78[_0x2a75('0x1a')](_0x68fc71)[_0x2a75('0x2c')](_0x5448f9);};}exports['index']=function(_0x16c45d,_0x256567){var _0xdbe292={},_0x29eaef={},_0xfaf86e={'count':0x0,'rows':[]};var _0x445cd2=_['map'](db[_0x2a75('0x2d')][_0x2a75('0x2e')],function(_0x57accb){return{'name':_0x57accb['fieldName'],'type':_0x57accb[_0x2a75('0x2f')]['key']};});_0x29eaef[_0x2a75('0x30')]=_[_0x2a75('0x31')](_0x445cd2,_0x2a75('0x32'));_0x29eaef[_0x2a75('0x33')]=_[_0x2a75('0x34')](_0x16c45d[_0x2a75('0x33')]);_0x29eaef[_0x2a75('0x35')]=_[_0x2a75('0x36')](_0x29eaef['model'],_0x29eaef[_0x2a75('0x33')]);_0xdbe292['attributes']=_['intersection'](_0x29eaef['model'],qs[_0x2a75('0x37')](_0x16c45d[_0x2a75('0x33')][_0x2a75('0x37')]));_0xdbe292['attributes']=_0xdbe292['attributes'][_0x2a75('0x38')]?_0xdbe292[_0x2a75('0x39')]:_0x29eaef[_0x2a75('0x30')];if(!_0x16c45d[_0x2a75('0x33')][_0x2a75('0x3a')](_0x2a75('0x3b'))){_0xdbe292[_0x2a75('0x20')]=qs[_0x2a75('0x20')](_0x16c45d[_0x2a75('0x33')]['limit']);_0xdbe292[_0x2a75('0x1d')]=qs[_0x2a75('0x1d')](_0x16c45d[_0x2a75('0x33')]['offset']);}_0xdbe292[_0x2a75('0x3c')]=qs[_0x2a75('0x3d')](_0x16c45d['query'][_0x2a75('0x3d')]);_0xdbe292[_0x2a75('0x3e')]=qs[_0x2a75('0x35')](_[_0x2a75('0x3f')](_0x16c45d[_0x2a75('0x33')],_0x29eaef[_0x2a75('0x35')]),_0x445cd2);if(_0x16c45d[_0x2a75('0x33')][_0x2a75('0x40')]){_0xdbe292[_0x2a75('0x3e')]=_[_0x2a75('0x41')](_0xdbe292[_0x2a75('0x3e')],{'$or':_[_0x2a75('0x31')](_0x445cd2,function(_0x247695){if(_0x247695[_0x2a75('0x2f')]!=='VIRTUAL'){var _0x5077b0={};_0x5077b0[_0x247695[_0x2a75('0x32')]]={'$like':'%'+_0x16c45d[_0x2a75('0x33')][_0x2a75('0x40')]+'%'};return _0x5077b0;}})});}_0xdbe292=_[_0x2a75('0x41')]({},_0xdbe292,_0x16c45d[_0x2a75('0x42')]);var _0x261ddb={'where':_0xdbe292['where']};return db['Variable'][_0x2a75('0x1f')](_0x261ddb)[_0x2a75('0x26')](function(_0x3534d0){_0xfaf86e[_0x2a75('0x1f')]=_0x3534d0;if(_0x16c45d[_0x2a75('0x33')][_0x2a75('0x43')]){_0xdbe292[_0x2a75('0x44')]=[{'all':!![]}];}return db[_0x2a75('0x2d')][_0x2a75('0x45')](_0xdbe292);})['then'](function(_0x3eb494){_0xfaf86e[_0x2a75('0x46')]=_0x3eb494;return _0xfaf86e;})[_0x2a75('0x26')](respondWithFilteredResult(_0x256567,_0xdbe292))[_0x2a75('0x47')](handleError(_0x256567,null));};exports[_0x2a75('0x48')]=function(_0x11dadf,_0x1c6ae8){var _0x49d880={'raw':!![],'where':{'id':_0x11dadf[_0x2a75('0x49')]['id']}},_0x2f29b1={};_0x2f29b1[_0x2a75('0x30')]=_[_0x2a75('0x34')](db[_0x2a75('0x2d')]['rawAttributes']);_0x2f29b1['query']=_['keys'](_0x11dadf['query']);_0x2f29b1[_0x2a75('0x35')]=_[_0x2a75('0x36')](_0x2f29b1[_0x2a75('0x30')],_0x2f29b1[_0x2a75('0x33')]);_0x49d880[_0x2a75('0x39')]=_[_0x2a75('0x36')](_0x2f29b1[_0x2a75('0x30')],qs['fields'](_0x11dadf[_0x2a75('0x33')][_0x2a75('0x37')]));_0x49d880[_0x2a75('0x39')]=_0x49d880[_0x2a75('0x39')][_0x2a75('0x38')]?_0x49d880[_0x2a75('0x39')]:_0x2f29b1['model'];if(_0x11dadf[_0x2a75('0x33')][_0x2a75('0x43')]){_0x49d880[_0x2a75('0x44')]=[{'all':!![]}];}_0x49d880=_[_0x2a75('0x41')]({},_0x49d880,_0x11dadf['options']);return db[_0x2a75('0x2d')][_0x2a75('0x4a')](_0x49d880)[_0x2a75('0x26')](handleEntityNotFound(_0x1c6ae8,null))[_0x2a75('0x26')](respondWithResult(_0x1c6ae8,null))[_0x2a75('0x47')](handleError(_0x1c6ae8,null));};exports['create']=function(_0x1a4603,_0x1d18c2){return db[_0x2a75('0x2d')][_0x2a75('0x4b')](_0x1a4603['body'],{})[_0x2a75('0x26')](function(_0x29ee17){var _0x327eaf=_0x1a4603['user']['get']({'plain':!![]});if(!_0x327eaf)throw new Error(_0x2a75('0x4c'));if(_0x327eaf[_0x2a75('0x4d')]===_0x2a75('0x4e')){var _0xfae7ac=_0x29ee17[_0x2a75('0x27')]({'plain':!![]});var _0x4a273b=_0x2a75('0x28');return db[_0x2a75('0x4f')][_0x2a75('0x4a')]({'where':{'name':_0x4a273b,'userProfileId':_0x327eaf[_0x2a75('0x50')]},'raw':!![]})[_0x2a75('0x26')](function(_0x338049){if(_0x338049&&_0x338049[_0x2a75('0x51')]===0x0){return db[_0x2a75('0x29')][_0x2a75('0x4b')]({'name':_0xfae7ac[_0x2a75('0x32')],'resourceId':_0xfae7ac['id'],'type':_0x338049[_0x2a75('0x32')],'sectionId':_0x338049['id']},{})[_0x2a75('0x26')](function(){return _0x29ee17;});}else{return _0x29ee17;}})[_0x2a75('0x47')](function(_0x22d710){logger[_0x2a75('0x2a')](_0x2a75('0x52'),_0x22d710);throw _0x22d710;});}return _0x29ee17;})[_0x2a75('0x26')](respondWithResult(_0x1d18c2,0xc9))[_0x2a75('0x47')](handleError(_0x1d18c2,null));};exports['update']=function(_0x5f1842,_0x335518){if(_0x5f1842['body']['id']){delete _0x5f1842[_0x2a75('0x53')]['id'];}return db['Variable']['find']({'where':{'id':_0x5f1842[_0x2a75('0x49')]['id']}})[_0x2a75('0x26')](handleEntityNotFound(_0x335518,null))['then'](saveUpdates(_0x5f1842[_0x2a75('0x53')],null))[_0x2a75('0x26')](respondWithResult(_0x335518,null))['catch'](handleError(_0x335518,null));};exports[_0x2a75('0x25')]=function(_0x80f9f5,_0x4f9c53){return db['Variable']['find']({'where':{'id':_0x80f9f5[_0x2a75('0x49')]['id']}})['then'](handleEntityNotFound(_0x4f9c53,null))[_0x2a75('0x26')](removeEntity(_0x4f9c53,null))[_0x2a75('0x47')](handleError(_0x4f9c53,null));}; \ No newline at end of file +var _0x8f1f=['status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','get','Variables','UserProfileResource','then','stack','name','send','index','map','Variable','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','autoAssociation','create','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0x8f1f,0x139));var _0xf8f1=function(_0x4249a4,_0x1159df){_0x4249a4=_0x4249a4-0x0;var _0x119549=_0x8f1f[_0x4249a4];return _0x119549;};'use strict';var emlformat=require(_0xf8f1('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf8f1('0x1'));var jsonpatch=require(_0xf8f1('0x2'));var rp=require(_0xf8f1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xf8f1('0x4'));var util=require(_0xf8f1('0x5'));var path=require(_0xf8f1('0x6'));var sox=require(_0xf8f1('0x7'));var csv=require('to-csv');var ejs=require(_0xf8f1('0x8'));var fs=require('fs');var fs_extra=require(_0xf8f1('0x9'));var _=require(_0xf8f1('0xa'));var squel=require(_0xf8f1('0xb'));var crypto=require(_0xf8f1('0xc'));var jsforce=require(_0xf8f1('0xd'));var deskjs=require(_0xf8f1('0xe'));var toCsv=require(_0xf8f1('0xf'));var querystring=require('querystring');var Papa=require(_0xf8f1('0x10'));var Redis=require(_0xf8f1('0x11'));var authService=require(_0xf8f1('0x12'));var qs=require(_0xf8f1('0x13'));var as=require(_0xf8f1('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf8f1('0x15'));var utils=require(_0xf8f1('0x16'));var config=require(_0xf8f1('0x17'));var licenseUtil=require(_0xf8f1('0x18'));var db=require(_0xf8f1('0x19'))['db'];function respondWithStatusCode(_0x12325f,_0x3e6d9a){_0x3e6d9a=_0x3e6d9a||0xcc;return function(_0x571fca){if(_0x571fca){return _0x12325f[_0xf8f1('0x1a')](_0x3e6d9a);}return _0x12325f[_0xf8f1('0x1b')](_0x3e6d9a)['end']();};}function respondWithResult(_0x5aa456,_0x153ab9){_0x153ab9=_0x153ab9||0xc8;return function(_0xab173a){if(_0xab173a){return _0x5aa456[_0xf8f1('0x1b')](_0x153ab9)[_0xf8f1('0x1c')](_0xab173a);}};}function respondWithFilteredResult(_0x181151,_0xcaae6d){return function(_0x17dc51){if(_0x17dc51){var _0x39574d=typeof _0xcaae6d[_0xf8f1('0x1d')]===_0xf8f1('0x1e')&&typeof _0xcaae6d[_0xf8f1('0x1f')]===_0xf8f1('0x1e');var _0x2927c7=_0x17dc51[_0xf8f1('0x20')];var _0x5ee93a=_0x39574d?0x0:_0xcaae6d[_0xf8f1('0x1d')];var _0x39d8db=_0x39574d?_0x17dc51[_0xf8f1('0x20')]:_0xcaae6d['offset']+_0xcaae6d[_0xf8f1('0x1f')];var _0x4e8d62;if(_0x39d8db>=_0x2927c7){_0x39d8db=_0x2927c7;_0x4e8d62=0xc8;}else{_0x4e8d62=0xce;}_0x181151[_0xf8f1('0x1b')](_0x4e8d62);return _0x181151['set'](_0xf8f1('0x21'),_0x5ee93a+'-'+_0x39d8db+'/'+_0x2927c7)[_0xf8f1('0x1c')](_0x17dc51);}return null;};}function patchUpdates(_0x5051cb){return function(_0x53526f){try{jsonpatch[_0xf8f1('0x22')](_0x53526f,_0x5051cb,!![]);}catch(_0x5aea55){return BPromise[_0xf8f1('0x23')](_0x5aea55);}return _0x53526f[_0xf8f1('0x24')]();};}function saveUpdates(_0x33ee43,_0x34da80){return function(_0x2c3d02){if(_0x2c3d02){return _0x2c3d02[_0xf8f1('0x25')](_0x33ee43)['then'](function(_0x8b8bae){return _0x8b8bae;});}return null;};}function removeEntity(_0x4c2408,_0x4df477){return function(_0x3cc4d0){if(_0x3cc4d0){return _0x3cc4d0[_0xf8f1('0x26')]()['then'](function(){var _0x4bd4bd=_0x3cc4d0[_0xf8f1('0x27')]({'plain':!![]});var _0x1c7951=_0xf8f1('0x28');return db[_0xf8f1('0x29')][_0xf8f1('0x26')]({'where':{'type':_0x1c7951,'resourceId':_0x4bd4bd['id']}})[_0xf8f1('0x2a')](function(){return _0x3cc4d0;});})[_0xf8f1('0x2a')](function(){_0x4c2408[_0xf8f1('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3c821b,_0x2e7305){return function(_0x14bc26){if(!_0x14bc26){_0x3c821b[_0xf8f1('0x1a')](0x194);}return _0x14bc26;};}function handleError(_0x15b6b1,_0x3c072c){_0x3c072c=_0x3c072c||0x1f4;return function(_0x2ad69e){logger['error'](_0x2ad69e[_0xf8f1('0x2b')]);if(_0x2ad69e[_0xf8f1('0x2c')]){delete _0x2ad69e[_0xf8f1('0x2c')];}_0x15b6b1['status'](_0x3c072c)[_0xf8f1('0x2d')](_0x2ad69e);};}exports[_0xf8f1('0x2e')]=function(_0x4be3f8,_0xae0821){var _0x2f95eb={},_0x1f4d8e={},_0x3a884e={'count':0x0,'rows':[]};var _0x383b18=_[_0xf8f1('0x2f')](db[_0xf8f1('0x30')][_0xf8f1('0x31')],function(_0x2372cb){return{'name':_0x2372cb[_0xf8f1('0x32')],'type':_0x2372cb['type']['key']};});_0x1f4d8e[_0xf8f1('0x33')]=_['map'](_0x383b18,_0xf8f1('0x2c'));_0x1f4d8e[_0xf8f1('0x34')]=_[_0xf8f1('0x35')](_0x4be3f8[_0xf8f1('0x34')]);_0x1f4d8e[_0xf8f1('0x36')]=_[_0xf8f1('0x37')](_0x1f4d8e[_0xf8f1('0x33')],_0x1f4d8e[_0xf8f1('0x34')]);_0x2f95eb[_0xf8f1('0x38')]=_[_0xf8f1('0x37')](_0x1f4d8e[_0xf8f1('0x33')],qs[_0xf8f1('0x39')](_0x4be3f8[_0xf8f1('0x34')][_0xf8f1('0x39')]));_0x2f95eb[_0xf8f1('0x38')]=_0x2f95eb[_0xf8f1('0x38')][_0xf8f1('0x3a')]?_0x2f95eb[_0xf8f1('0x38')]:_0x1f4d8e[_0xf8f1('0x33')];if(!_0x4be3f8['query'][_0xf8f1('0x3b')]('nolimit')){_0x2f95eb[_0xf8f1('0x1f')]=qs[_0xf8f1('0x1f')](_0x4be3f8[_0xf8f1('0x34')][_0xf8f1('0x1f')]);_0x2f95eb['offset']=qs[_0xf8f1('0x1d')](_0x4be3f8[_0xf8f1('0x34')][_0xf8f1('0x1d')]);}_0x2f95eb[_0xf8f1('0x3c')]=qs[_0xf8f1('0x3d')](_0x4be3f8[_0xf8f1('0x34')][_0xf8f1('0x3d')]);_0x2f95eb[_0xf8f1('0x3e')]=qs[_0xf8f1('0x36')](_[_0xf8f1('0x3f')](_0x4be3f8['query'],_0x1f4d8e['filters']),_0x383b18);if(_0x4be3f8['query'][_0xf8f1('0x40')]){_0x2f95eb['where']=_[_0xf8f1('0x41')](_0x2f95eb['where'],{'$or':_[_0xf8f1('0x2f')](_0x383b18,function(_0x402cbc){if(_0x402cbc[_0xf8f1('0x42')]!==_0xf8f1('0x43')){var _0x327e33={};_0x327e33[_0x402cbc[_0xf8f1('0x2c')]]={'$like':'%'+_0x4be3f8[_0xf8f1('0x34')][_0xf8f1('0x40')]+'%'};return _0x327e33;}})});}_0x2f95eb=_['merge']({},_0x2f95eb,_0x4be3f8[_0xf8f1('0x44')]);var _0x1a00e5={'where':_0x2f95eb[_0xf8f1('0x3e')]};return db[_0xf8f1('0x30')][_0xf8f1('0x20')](_0x1a00e5)[_0xf8f1('0x2a')](function(_0x112d94){_0x3a884e[_0xf8f1('0x20')]=_0x112d94;if(_0x4be3f8['query'][_0xf8f1('0x45')]){_0x2f95eb[_0xf8f1('0x46')]=[{'all':!![]}];}return db[_0xf8f1('0x30')][_0xf8f1('0x47')](_0x2f95eb);})['then'](function(_0x29d36f){_0x3a884e['rows']=_0x29d36f;return _0x3a884e;})['then'](respondWithFilteredResult(_0xae0821,_0x2f95eb))[_0xf8f1('0x48')](handleError(_0xae0821,null));};exports[_0xf8f1('0x49')]=function(_0x415bfd,_0x3782b8){var _0x26ab68={'raw':!![],'where':{'id':_0x415bfd[_0xf8f1('0x4a')]['id']}},_0x27cacf={};_0x27cacf[_0xf8f1('0x33')]=_['keys'](db[_0xf8f1('0x30')][_0xf8f1('0x31')]);_0x27cacf[_0xf8f1('0x34')]=_[_0xf8f1('0x35')](_0x415bfd[_0xf8f1('0x34')]);_0x27cacf[_0xf8f1('0x36')]=_[_0xf8f1('0x37')](_0x27cacf[_0xf8f1('0x33')],_0x27cacf[_0xf8f1('0x34')]);_0x26ab68['attributes']=_[_0xf8f1('0x37')](_0x27cacf['model'],qs[_0xf8f1('0x39')](_0x415bfd[_0xf8f1('0x34')][_0xf8f1('0x39')]));_0x26ab68[_0xf8f1('0x38')]=_0x26ab68[_0xf8f1('0x38')][_0xf8f1('0x3a')]?_0x26ab68['attributes']:_0x27cacf[_0xf8f1('0x33')];if(_0x415bfd[_0xf8f1('0x34')]['includeAll']){_0x26ab68[_0xf8f1('0x46')]=[{'all':!![]}];}_0x26ab68=_[_0xf8f1('0x41')]({},_0x26ab68,_0x415bfd[_0xf8f1('0x44')]);return db['Variable'][_0xf8f1('0x4b')](_0x26ab68)[_0xf8f1('0x2a')](handleEntityNotFound(_0x3782b8,null))[_0xf8f1('0x2a')](respondWithResult(_0x3782b8,null))[_0xf8f1('0x48')](handleError(_0x3782b8,null));};exports['create']=function(_0xbbced0,_0xac2c){return db[_0xf8f1('0x30')]['create'](_0xbbced0[_0xf8f1('0x4c')],{})[_0xf8f1('0x2a')](function(_0x53dd61){var _0x23fc37=_0xbbced0['user'][_0xf8f1('0x27')]({'plain':!![]});if(!_0x23fc37)throw new Error(_0xf8f1('0x4d'));if(_0x23fc37[_0xf8f1('0x4e')]===_0xf8f1('0x4f')){var _0xd4d0f=_0x53dd61[_0xf8f1('0x27')]({'plain':!![]});var _0x3a28d9=_0xf8f1('0x28');return db[_0xf8f1('0x50')][_0xf8f1('0x4b')]({'where':{'name':_0x3a28d9,'userProfileId':_0x23fc37['userProfileId']},'raw':!![]})[_0xf8f1('0x2a')](function(_0x1d6889){if(_0x1d6889&&_0x1d6889[_0xf8f1('0x51')]===0x0){return db['UserProfileResource'][_0xf8f1('0x52')]({'name':_0xd4d0f[_0xf8f1('0x2c')],'resourceId':_0xd4d0f['id'],'type':_0x1d6889[_0xf8f1('0x2c')],'sectionId':_0x1d6889['id']},{})[_0xf8f1('0x2a')](function(){return _0x53dd61;});}else{return _0x53dd61;}})[_0xf8f1('0x48')](function(_0x184295){logger[_0xf8f1('0x53')](_0xf8f1('0x54'),_0x184295);throw _0x184295;});}return _0x53dd61;})['then'](respondWithResult(_0xac2c,0xc9))['catch'](handleError(_0xac2c,null));};exports['update']=function(_0x223eac,_0x514faa){if(_0x223eac[_0xf8f1('0x4c')]['id']){delete _0x223eac[_0xf8f1('0x4c')]['id'];}return db[_0xf8f1('0x30')]['find']({'where':{'id':_0x223eac['params']['id']}})[_0xf8f1('0x2a')](handleEntityNotFound(_0x514faa,null))['then'](saveUpdates(_0x223eac[_0xf8f1('0x4c')],null))[_0xf8f1('0x2a')](respondWithResult(_0x514faa,null))['catch'](handleError(_0x514faa,null));};exports[_0xf8f1('0x26')]=function(_0x36d595,_0x44239e){return db[_0xf8f1('0x30')][_0xf8f1('0x4b')]({'where':{'id':_0x36d595[_0xf8f1('0x4a')]['id']}})[_0xf8f1('0x2a')](handleEntityNotFound(_0x44239e,null))[_0xf8f1('0x2a')](removeEntity(_0x44239e,null))[_0xf8f1('0x48')](handleError(_0x44239e,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index b2394d8..d0cb62e 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 _0x387e=['request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','util','api','moment','bluebird'];(function(_0x30f339,_0xb657e5){var _0x130253=function(_0x4048c9){while(--_0x4048c9){_0x30f339['push'](_0x30f339['shift']());}};_0x130253(++_0xb657e5);}(_0x387e,0x146));var _0xe387=function(_0x48d6a3,_0x37c848){_0x48d6a3=_0x48d6a3-0x0;var _0x38bfa0=_0x387e[_0x48d6a3];return _0x38bfa0;};'use strict';var _=require('lodash');var util=require(_0xe387('0x0'));var logger=require('../../config/logger')(_0xe387('0x1'));var moment=require(_0xe387('0x2'));var BPromise=require(_0xe387('0x3'));var rp=require(_0xe387('0x4'));var fs=require('fs');var path=require(_0xe387('0x5'));var rimraf=require(_0xe387('0x6'));var config=require(_0xe387('0x7'));var attributes=require(_0xe387('0x8'));module[_0xe387('0x9')]=function(_0x29b087,_0x295f07){return _0x29b087['define']('Variable',attributes,{'tableName':'tools_variables','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe8dd=['../../config/environment','./variable.attributes','exports','define','Variable','tools_variables','lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf'];(function(_0x191ddb,_0x1936bb){var _0x38c415=function(_0x4a05e4){while(--_0x4a05e4){_0x191ddb['push'](_0x191ddb['shift']());}};_0x38c415(++_0x1936bb);}(_0xe8dd,0x68));var _0xde8d=function(_0x337d57,_0x2915d4){_0x337d57=_0x337d57-0x0;var _0x1f4321=_0xe8dd[_0x337d57];return _0x1f4321;};'use strict';var _=require(_0xde8d('0x0'));var util=require(_0xde8d('0x1'));var logger=require(_0xde8d('0x2'))(_0xde8d('0x3'));var moment=require(_0xde8d('0x4'));var BPromise=require(_0xde8d('0x5'));var rp=require(_0xde8d('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xde8d('0x7'));var config=require(_0xde8d('0x8'));var attributes=require(_0xde8d('0x9'));module[_0xde8d('0xa')]=function(_0x2889cb,_0xc70cf){return _0x2889cb[_0xde8d('0xb')](_0xde8d('0xc'),attributes,{'tableName':_0xde8d('0xd'),'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 bec4dc6..32aef62 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 _0x7217=['where','attributes','map','include','model','ShowVariable','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Variable,\x20%s,\x20%s','debug','Variable,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','Variable','find','options','raw'];(function(_0x162536,_0x24e08a){var _0x34d7d0=function(_0x34b15f){while(--_0x34b15f){_0x162536['push'](_0x162536['shift']());}};_0x34d7d0(++_0x24e08a);}(_0x7217,0x19e));var _0x7721=function(_0x18a79d,_0x57bd2c){_0x18a79d=_0x18a79d-0x0;var _0x4f8848=_0x7217[_0x18a79d];return _0x4f8848;};'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')]('Variable,\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']('Variable,\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['ShowVariable']=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')]('ShowVariable',_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 +var _0x5fc3=['info','request\x20sent','debug','stringify','error','code','message','Variable,\x20%s,\x20%s','result','catch','ShowVariable','find','options','where','attributes','include','map','model','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x411add,_0x1aed38){var _0x238242=function(_0x4a1cd5){while(--_0x4a1cd5){_0x411add['push'](_0x411add['shift']());}};_0x238242(++_0x1aed38);}(_0x5fc3,0xa8));var _0x35fc=function(_0x43f881,_0xd6e5a2){_0x43f881=_0x43f881-0x0;var _0x365c14=_0x5fc3[_0x43f881];return _0x365c14;};'use strict';var _=require(_0x35fc('0x0'));var util=require(_0x35fc('0x1'));var moment=require('moment');var BPromise=require(_0x35fc('0x2'));var rs=require(_0x35fc('0x3'));var fs=require('fs');var Redis=require(_0x35fc('0x4'));var db=require(_0x35fc('0x5'))['db'];var utils=require(_0x35fc('0x6'));var logger=require('../../config/logger')(_0x35fc('0x7'));var config=require(_0x35fc('0x8'));var jayson=require(_0x35fc('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x19a0d1,_0x508b32,_0x16e153){return new BPromise(function(_0x27524f,_0xc72d93){return client[_0x35fc('0xa')](_0x19a0d1,_0x16e153)[_0x35fc('0xb')](function(_0xf9d3a6){logger[_0x35fc('0xc')]('Variable,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('Variable,\x20%s,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'),JSON[_0x35fc('0xf')](_0xf9d3a6));if(_0xf9d3a6['error']){if(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x11')]===0x1f4){logger['error']('Variable,\x20%s,\x20%s',_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0xc72d93(_0xf9d3a6[_0x35fc('0x10')][_0x35fc('0x12')]);}logger[_0x35fc('0x10')](_0x35fc('0x13'),_0x508b32,_0xf9d3a6[_0x35fc('0x10')]['message']);return _0x27524f(_0xf9d3a6['error']['message']);}else{logger['info'](_0x35fc('0x13'),_0x508b32,_0x35fc('0xd'));_0x27524f(_0xf9d3a6[_0x35fc('0x14')][_0x35fc('0x12')]);}})[_0x35fc('0x15')](function(_0x1121fa){logger['error'](_0x35fc('0x13'),_0x508b32,_0x1121fa);_0xc72d93(_0x1121fa);});});}exports[_0x35fc('0x16')]=function(_0x553677){var _0x41e165=this;return new Promise(function(_0x363e47,_0x2e513b){return db['Variable'][_0x35fc('0x17')]({'raw':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x19')]||null:null,'attributes':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1a')]||null:null,'include':_0x553677[_0x35fc('0x18')]?_0x553677[_0x35fc('0x18')][_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x553677['options'][_0x35fc('0x1b')],function(_0xd5399f){return{'model':db[_0xd5399f[_0x35fc('0x1d')]],'as':_0xd5399f['as'],'attributes':_0xd5399f[_0x35fc('0x1a')],'include':_0xd5399f[_0x35fc('0x1b')]?_['map'](_0xd5399f[_0x35fc('0x1b')],function(_0x4c587a){return{'model':db[_0x4c587a['model']],'as':_0x4c587a['as'],'attributes':_0x4c587a[_0x35fc('0x1a')],'include':_0x4c587a[_0x35fc('0x1b')]?_[_0x35fc('0x1c')](_0x4c587a['include'],function(_0x4086e9){return{'model':db[_0x4086e9['model']],'as':_0x4086e9['as'],'attributes':_0x4086e9[_0x35fc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x35fc('0xb')](function(_0x5cb986){logger['info'](_0x35fc('0x16'),_0x553677);logger['debug'](_0x35fc('0x16'),_0x553677,JSON[_0x35fc('0xf')](_0x5cb986));_0x363e47(_0x5cb986);})['catch'](function(_0x26b7cb){logger[_0x35fc('0x10')](_0x35fc('0x16'),_0x26b7cb[_0x35fc('0x12')],_0x553677);_0x2e513b(_0x41e165[_0x35fc('0x10')](0x1f4,_0x26b7cb[_0x35fc('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 6277126..bc48786 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 _0xf438=['/migrations','migrations','express','Router','../../components/auth/service','./version.controller','get','/fetch','isAuthenticated','fetch','canUpdate','/pull','pull','/restart','restart'];(function(_0x20df86,_0x12fd0e){var _0x43021f=function(_0x90ea50){while(--_0x90ea50){_0x20df86['push'](_0x20df86['shift']());}};_0x43021f(++_0x12fd0e);}(_0xf438,0x11f));var _0x8f43=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0xf438[_0x4b055c];return _0x4b62bb;};'use strict';var express=require(_0x8f43('0x0'));var router=express[_0x8f43('0x1')]();var auth=require(_0x8f43('0x2'));var controller=require(_0x8f43('0x3'));router[_0x8f43('0x4')]('/',controller['index']);router[_0x8f43('0x4')](_0x8f43('0x5'),auth[_0x8f43('0x6')](),auth['canUpdate'](),controller[_0x8f43('0x7')]);router[_0x8f43('0x4')]('/reset',auth[_0x8f43('0x6')](),auth[_0x8f43('0x8')](),controller['reset']);router[_0x8f43('0x4')](_0x8f43('0x9'),auth[_0x8f43('0x6')](),auth[_0x8f43('0x8')](),controller[_0x8f43('0xa')]);router[_0x8f43('0x4')](_0x8f43('0xb'),auth[_0x8f43('0x6')](),controller[_0x8f43('0xc')]);router['get'](_0x8f43('0xd'),controller[_0x8f43('0xe')]);module['exports']=router; \ No newline at end of file +var _0x8e7e=['/fetch','canUpdate','isAuthenticated','reset','/pull','/restart','restart','/migrations','exports','express','../../components/auth/service','index','get'];(function(_0x17542e,_0x497c31){var _0x28c798=function(_0x18baa5){while(--_0x18baa5){_0x17542e['push'](_0x17542e['shift']());}};_0x28c798(++_0x497c31);}(_0x8e7e,0x175));var _0xe8e7=function(_0x191bb8,_0x3df12e){_0x191bb8=_0x191bb8-0x0;var _0x109f27=_0x8e7e[_0x191bb8];return _0x109f27;};'use strict';var express=require(_0xe8e7('0x0'));var router=express['Router']();var auth=require(_0xe8e7('0x1'));var controller=require('./version.controller');router['get']('/',controller[_0xe8e7('0x2')]);router[_0xe8e7('0x3')](_0xe8e7('0x4'),auth['isAuthenticated'](),auth[_0xe8e7('0x5')](),controller['fetch']);router['get']('/reset',auth[_0xe8e7('0x6')](),auth['canUpdate'](),controller[_0xe8e7('0x7')]);router['get'](_0xe8e7('0x8'),auth[_0xe8e7('0x6')](),auth['canUpdate'](),controller['pull']);router[_0xe8e7('0x3')](_0xe8e7('0x9'),auth[_0xe8e7('0x6')](),controller[_0xe8e7('0xa')]);router[_0xe8e7('0x3')](_0xe8e7('0xb'),controller['migrations']);module[_0xe8e7('0xc')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 3f97a73..39c363c 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 _0xf596=['reset','--hard','FETCH_HEAD','error','pull','npm\x20install\x20--production','restart','motion2','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','join','map','.js','then','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','pkginfo','version','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','query','latest','fetch','2.0.0','status','json','origin','master','info','git\x20fetch','git\x20fetch\x20origin\x20master'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xf596,0x102));var _0x6f59=function(_0x2e8900,_0xf65d19){_0x2e8900=_0x2e8900-0x0;var _0x2f3a73=_0xf596[_0x2e8900];return _0x2f3a73;};'use strict';var Umzug=require(_0x6f59('0x0'));var path=require(_0x6f59('0x1'));var fs=require('fs');var _=require(_0x6f59('0x2'));var pkginfo=require(_0x6f59('0x3'))(module,_0x6f59('0x4'));var compareVersions=require(_0x6f59('0x5'));var exec=require('child_process')[_0x6f59('0x6')];var db=require(_0x6f59('0x7'))['db'];var config=require(_0x6f59('0x8'));var pm2=require(_0x6f59('0x9'));var logger=require(_0x6f59('0xa'))(_0x6f59('0xb'));var git=require(_0x6f59('0xc'))(config[_0x6f59('0xd')]);exports[_0x6f59('0xe')]=function(_0x46bfda,_0x499eb9){var _0x36c4b1={'current':module[_0x6f59('0xf')][_0x6f59('0x4')],'phonebar':0x2};if(_0x46bfda[_0x6f59('0x10')]&&_0x46bfda[_0x6f59('0x10')][_0x6f59('0x11')]){return git[_0x6f59('0x12')]()['tags'](function(_0x45b901,_0x588d4d){_0x36c4b1[_0x6f59('0x11')]=(_0x45b901?module['exports'][_0x6f59('0x4')]:_0x588d4d[_0x6f59('0x11')])||_0x6f59('0x13');return _0x499eb9[_0x6f59('0x14')](0xc8)[_0x6f59('0x15')](_0x36c4b1);});}else{return _0x499eb9['status'](0xc8)[_0x6f59('0x15')](_0x36c4b1);}};exports[_0x6f59('0x12')]=function(_0xd4e670,_0x37c348){return git[_0x6f59('0x12')]([_0x6f59('0x16'),_0x6f59('0x17')],function(_0x59897b){if(_0x59897b){logger['error'](_0x59897b);return _0x37c348['status'](0x1f4)['json'](_0x59897b);}logger[_0x6f59('0x18')](_0x6f59('0x19'));return _0x37c348[_0x6f59('0x14')](0xc8)[_0x6f59('0x15')]({'output':_0x6f59('0x1a')});});};exports[_0x6f59('0x1b')]=function(_0x80a57a,_0x355e14){return git['reset']([_0x6f59('0x1c'),_0x6f59('0x1d')],function(_0x3684a7){if(_0x3684a7){logger[_0x6f59('0x1e')](_0x3684a7);return _0x355e14['status'](0x1f4)[_0x6f59('0x15')](_0x3684a7);}logger[_0x6f59('0x18')]('git\x20reset\x20--hard\x20FETCH_HEAD');return _0x355e14[_0x6f59('0x14')](0xc8)[_0x6f59('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0x6f59('0x1f')]=function(_0x2572c8,_0x45a026){exec(_0x6f59('0x20'),function(_0x46fadd,_0x1eda9f,_0x595a48){logger[_0x6f59('0x18')](_0x1eda9f);logger['info'](_0x595a48);if(_0x46fadd){logger['error'](_0x46fadd);return _0x45a026[_0x6f59('0x14')](0x1f4)[_0x6f59('0x15')](_0x46fadd);}return _0x45a026[_0x6f59('0x14')](0xc8)[_0x6f59('0x15')]({'output':_0x1eda9f});});};exports[_0x6f59('0x21')]=function(_0x45113e,_0x5b5025){return pm2['restart'](_0x6f59('0x22'))['then'](function(_0x176f41){logger[_0x6f59('0x18')](_0x6f59('0x23'),_0x176f41);return _0x5b5025['status'](0xc8)[_0x6f59('0x15')]({'output':_0x6f59('0x24')});})[_0x6f59('0x25')](function(_0x160dc9){logger['error'](_0x160dc9);return _0x5b5025['status'](0x1f4)['json'](_0x160dc9);});};exports[_0x6f59('0x26')]=function(_0x2ac3f8,_0x47debe){var _0x4fc9c9=fs[_0x6f59('0x27')](path['join'](config[_0x6f59('0xd')],_0x6f59('0x28'),_0x6f59('0x26')));var _0x469a73=[];for(var _0x5473b9=0x0;_0x5473b9<_0x4fc9c9[_0x6f59('0x29')];_0x5473b9++){var _0x3969f9=_0x4fc9c9[_0x5473b9][_0x6f59('0x2a')]('.js','');if(compareVersions(module['exports'][_0x6f59('0x4')],_0x3969f9)===-0x1){_0x469a73[_0x6f59('0x2b')](_0x3969f9);}}if(_0x469a73['length']){var _0x42a948=_0x469a73[_0x6f59('0x2c')](compareVersions);var _0x1370c4=new Umzug({'storage':_0x6f59('0x2d'),'storageOptions':{'model':db[_0x6f59('0x2e')],'modelName':'Migration','columnName':_0x6f59('0x4')},'migrations':{'params':[db['sequelize'][_0x6f59('0x2f')](),db[_0x6f59('0x2d')][_0x6f59('0x30')],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[_0x6f59('0x31')](config[_0x6f59('0xd')],'server',_0x6f59('0x26')),'pattern':/\.js$/}});_0x1370c4['up']({'migrations':_[_0x6f59('0x32')](_0x42a948,function(_0x3e8106){return _0x3e8106+_0x6f59('0x33');})})[_0x6f59('0x34')](function(){return _0x47debe['status'](0xc8)[_0x6f59('0x15')]({'output':'Database\x20migrated\x20successfully\x20from\x20version\x20'+module[_0x6f59('0xf')][_0x6f59('0x4')]+_0x6f59('0x35')+_[_0x6f59('0x36')](_0x42a948),'migrations':_[_0x6f59('0x31')](_0x42a948)});})['catch'](function(_0x25f325){if(_0x25f325 instanceof db['sequelize'][_0x6f59('0x37')]){return _0x47debe['status'](0xc8)[_0x6f59('0x15')]({'output':_0x6f59('0x38')});}else{return _0x47debe[_0x6f59('0x14')](0x1f4)[_0x6f59('0x15')](_0x25f325);}});}else{return _0x47debe[_0x6f59('0x14')](0xc8)[_0x6f59('0x15')]({'output':'Database\x20already\x20up-to-date'});}}; \ No newline at end of file +var _0x4a70=['umzug','path','lodash','pkginfo','compare-versions','exec','../../mysqldb','../../config/environment','../../config/pm2','../../config/logger','update','simple-git','root','index','exports','version','query','fetch','tags','2.0.0','status','json','origin','error','info','reset','--hard','FETCH_HEAD','git\x20reset\x20--hard\x20FETCH_HEAD','pull','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','readdirSync','join','server','length','replace','push','sort','sequelize','Migration','getQueryInterface','constructor','Migration\x20tried\x20to\x20use\x20old\x20style\x20\x22done\x22\x20callback.\x20Please\x20upgrade\x20to\x20\x22umzug\x22\x20and\x20return\x20a\x20promise\x20instead.','migrations','.js','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError'];(function(_0x3795f1,_0x384315){var _0x423a70=function(_0x19de93){while(--_0x19de93){_0x3795f1['push'](_0x3795f1['shift']());}};_0x423a70(++_0x384315);}(_0x4a70,0x14a));var _0x04a7=function(_0x5a3cf0,_0x160a68){_0x5a3cf0=_0x5a3cf0-0x0;var _0x5a64ee=_0x4a70[_0x5a3cf0];return _0x5a64ee;};'use strict';var Umzug=require(_0x04a7('0x0'));var path=require(_0x04a7('0x1'));var fs=require('fs');var _=require(_0x04a7('0x2'));var pkginfo=require(_0x04a7('0x3'))(module,'version');var compareVersions=require(_0x04a7('0x4'));var exec=require('child_process')[_0x04a7('0x5')];var db=require(_0x04a7('0x6'))['db'];var config=require(_0x04a7('0x7'));var pm2=require(_0x04a7('0x8'));var logger=require(_0x04a7('0x9'))(_0x04a7('0xa'));var git=require(_0x04a7('0xb'))(config[_0x04a7('0xc')]);exports[_0x04a7('0xd')]=function(_0x5bd065,_0x2e1b36){var _0x284420={'current':module[_0x04a7('0xe')][_0x04a7('0xf')],'phonebar':0x2};if(_0x5bd065[_0x04a7('0x10')]&&_0x5bd065['query']['latest']){return git[_0x04a7('0x11')]()[_0x04a7('0x12')](function(_0x13b2d6,_0x147686){_0x284420['latest']=(_0x13b2d6?module[_0x04a7('0xe')][_0x04a7('0xf')]:_0x147686['latest'])||_0x04a7('0x13');return _0x2e1b36[_0x04a7('0x14')](0xc8)[_0x04a7('0x15')](_0x284420);});}else{return _0x2e1b36[_0x04a7('0x14')](0xc8)['json'](_0x284420);}};exports['fetch']=function(_0x5f082b,_0x141688){return git[_0x04a7('0x11')]([_0x04a7('0x16'),'master'],function(_0x26eb0c){if(_0x26eb0c){logger[_0x04a7('0x17')](_0x26eb0c);return _0x141688[_0x04a7('0x14')](0x1f4)[_0x04a7('0x15')](_0x26eb0c);}logger[_0x04a7('0x18')]('git\x20fetch');return _0x141688[_0x04a7('0x14')](0xc8)[_0x04a7('0x15')]({'output':'git\x20fetch\x20origin\x20master'});});};exports[_0x04a7('0x19')]=function(_0xaf1a62,_0x6ac3fa){return git[_0x04a7('0x19')]([_0x04a7('0x1a'),_0x04a7('0x1b')],function(_0x4b6997){if(_0x4b6997){logger[_0x04a7('0x17')](_0x4b6997);return _0x6ac3fa['status'](0x1f4)[_0x04a7('0x15')](_0x4b6997);}logger[_0x04a7('0x18')](_0x04a7('0x1c'));return _0x6ac3fa[_0x04a7('0x14')](0xc8)[_0x04a7('0x15')]({'output':'git\x20reset\x20--hard'});});};exports[_0x04a7('0x1d')]=function(_0x41040e,_0x1cc56d){exec(_0x04a7('0x1e'),function(_0x3410db,_0x4b2208,_0x1ab056){logger[_0x04a7('0x18')](_0x4b2208);logger[_0x04a7('0x18')](_0x1ab056);if(_0x3410db){logger[_0x04a7('0x17')](_0x3410db);return _0x1cc56d[_0x04a7('0x14')](0x1f4)[_0x04a7('0x15')](_0x3410db);}return _0x1cc56d[_0x04a7('0x14')](0xc8)[_0x04a7('0x15')]({'output':_0x4b2208});});};exports[_0x04a7('0x1f')]=function(_0x38e008,_0x453646){return pm2[_0x04a7('0x1f')](_0x04a7('0x20'))[_0x04a7('0x21')](function(_0x14c8e0){logger[_0x04a7('0x18')](_0x04a7('0x22'),_0x14c8e0);return _0x453646[_0x04a7('0x14')](0xc8)[_0x04a7('0x15')]({'output':_0x04a7('0x23')});})[_0x04a7('0x24')](function(_0x4ba877){logger[_0x04a7('0x17')](_0x4ba877);return _0x453646[_0x04a7('0x14')](0x1f4)[_0x04a7('0x15')](_0x4ba877);});};exports['migrations']=function(_0x3f51a6,_0x41157c){var _0x41c730=fs[_0x04a7('0x25')](path[_0x04a7('0x26')](config['root'],_0x04a7('0x27'),'migrations'));var _0x5c91fd=[];for(var _0x560fca=0x0;_0x560fca<_0x41c730[_0x04a7('0x28')];_0x560fca++){var _0x290f33=_0x41c730[_0x560fca][_0x04a7('0x29')]('.js','');if(compareVersions(module[_0x04a7('0xe')][_0x04a7('0xf')],_0x290f33)===-0x1){_0x5c91fd[_0x04a7('0x2a')](_0x290f33);}}if(_0x5c91fd[_0x04a7('0x28')]){var _0x2e9270=_0x5c91fd[_0x04a7('0x2b')](compareVersions);var _0x9fe2fd=new Umzug({'storage':_0x04a7('0x2c'),'storageOptions':{'model':db[_0x04a7('0x2d')],'modelName':_0x04a7('0x2d'),'columnName':_0x04a7('0xf')},'migrations':{'params':[db[_0x04a7('0x2c')][_0x04a7('0x2e')](),db[_0x04a7('0x2c')][_0x04a7('0x2f')],function(){throw new Error(_0x04a7('0x30'));}],'path':path['join'](config[_0x04a7('0xc')],_0x04a7('0x27'),_0x04a7('0x31')),'pattern':/\.js$/}});_0x9fe2fd['up']({'migrations':_['map'](_0x2e9270,function(_0x57eff0){return _0x57eff0+_0x04a7('0x32');})})['then'](function(){return _0x41157c[_0x04a7('0x14')](0xc8)[_0x04a7('0x15')]({'output':_0x04a7('0x33')+module[_0x04a7('0xe')][_0x04a7('0xf')]+_0x04a7('0x34')+_[_0x04a7('0x35')](_0x2e9270),'migrations':_[_0x04a7('0x26')](_0x2e9270)});})['catch'](function(_0x2b8b49){if(_0x2b8b49 instanceof db['sequelize'][_0x04a7('0x36')]){return _0x41157c['status'](0xc8)[_0x04a7('0x15')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x41157c[_0x04a7('0x14')](0x1f4)[_0x04a7('0x15')](_0x2b8b49);}});}else{return _0x41157c[_0x04a7('0x14')](0xc8)[_0x04a7('0x15')]({'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 5109ea2..e527080 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 _0x60b0=['index','/describe','isAuthenticated','describe','/:id','show','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','get'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x60b0,0x140));var _0x060b=function(_0x4f0e62,_0x28e44f){_0x4f0e62=_0x4f0e62-0x0;var _0x117ab8=_0x60b0[_0x4f0e62];return _0x117ab8;};'use strict';var multer=require('multer');var util=require(_0x060b('0x0'));var path=require(_0x060b('0x1'));var timeout=require(_0x060b('0x2'));var express=require(_0x060b('0x3'));var router=express['Router']();var fs_extra=require(_0x060b('0x4'));var auth=require(_0x060b('0x5'));var interaction=require(_0x060b('0x6'));var config=require(_0x060b('0x7'));var controller=require(_0x060b('0x8'));router[_0x060b('0x9')]('/',auth['isAuthenticated'](),controller[_0x060b('0xa')]);router[_0x060b('0x9')](_0x060b('0xb'),auth[_0x060b('0xc')](),controller[_0x060b('0xd')]);router[_0x060b('0x9')](_0x060b('0xe'),auth[_0x060b('0xc')](),controller[_0x060b('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x060b('0x10')]);router[_0x060b('0x11')]('/:id',auth[_0x060b('0xc')](),controller[_0x060b('0x12')]);router[_0x060b('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x060b('0x14')]);module[_0x060b('0x15')]=router; \ No newline at end of file +var _0xd479=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','describe','/:id','show','post','put'];(function(_0x41d90f,_0x213cd9){var _0x44bdfd=function(_0x177fc5){while(--_0x177fc5){_0x41d90f['push'](_0x41d90f['shift']());}};_0x44bdfd(++_0x213cd9);}(_0xd479,0x10f));var _0x9d47=function(_0x3f44f9,_0x77e78f){_0x3f44f9=_0x3f44f9-0x0;var _0x552aa0=_0xd479[_0x3f44f9];return _0x552aa0;};'use strict';var multer=require(_0x9d47('0x0'));var util=require(_0x9d47('0x1'));var path=require('path');var timeout=require(_0x9d47('0x2'));var express=require(_0x9d47('0x3'));var router=express[_0x9d47('0x4')]();var fs_extra=require(_0x9d47('0x5'));var auth=require(_0x9d47('0x6'));var interaction=require(_0x9d47('0x7'));var config=require(_0x9d47('0x8'));var controller=require('./voiceAgentReport.controller');router[_0x9d47('0x9')]('/',auth[_0x9d47('0xa')](),controller[_0x9d47('0xb')]);router['get']('/describe',auth[_0x9d47('0xa')](),controller[_0x9d47('0xc')]);router[_0x9d47('0x9')](_0x9d47('0xd'),auth[_0x9d47('0xa')](),controller[_0x9d47('0xe')]);router[_0x9d47('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x9d47('0x10')](_0x9d47('0xd'),auth[_0x9d47('0xa')](),controller['update']);router['delete'](_0x9d47('0xd'),auth[_0x9d47('0xa')](),controller['destroy']);module[_0x9d47('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index cd622f4..e198dc3 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 _0x0bb4=['sequelize','exports','STRING','DATE','BOOLEAN','INTEGER','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x57a198,_0x2820b7){var _0x29ac39=function(_0x587222){while(--_0x587222){_0x57a198['push'](_0x57a198['shift']());}};_0x29ac39(++_0x2820b7);}(_0x0bb4,0x77));var _0x40bb=function(_0x27f22c,_0x17f633){_0x27f22c=_0x27f22c-0x0;var _0x14d4db=_0x0bb4[_0x27f22c];return _0x14d4db;};'use strict';var Sequelize=require(_0x40bb('0x0'));module[_0x40bb('0x1')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x40bb('0x2')]},'calleridnum':{'type':Sequelize[_0x40bb('0x2')]},'calleridname':{'type':Sequelize[_0x40bb('0x2')]},'queue':{'type':Sequelize[_0x40bb('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x40bb('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x40bb('0x3')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x40bb('0x3')]},'agentdumpAt':{'type':Sequelize[_0x40bb('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0x40bb('0x5')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x40bb('0x5')]},'reason':{'type':Sequelize[_0x40bb('0x2')]},'lastevent':{'type':Sequelize[_0x40bb('0x2')]},'channel':{'type':Sequelize[_0x40bb('0x2')]},'channelstate':{'type':Sequelize[_0x40bb('0x5')]},'channelstatedesc':{'type':Sequelize[_0x40bb('0x2')]},'connectedlinenum':{'type':Sequelize[_0x40bb('0x2')]},'connectedlinename':{'type':Sequelize[_0x40bb('0x2')]},'language':{'type':Sequelize[_0x40bb('0x2')]},'accountcode':{'type':Sequelize[_0x40bb('0x2')]},'context':{'type':Sequelize[_0x40bb('0x2')]},'exten':{'type':Sequelize[_0x40bb('0x2')]},'priority':{'type':Sequelize[_0x40bb('0x2')]},'destchannel':{'type':Sequelize[_0x40bb('0x2')]},'destchannelstate':{'type':Sequelize[_0x40bb('0x5')]},'destchannelstatedesc':{'type':Sequelize[_0x40bb('0x2')]},'destcalleridnum':{'type':Sequelize[_0x40bb('0x2')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0x40bb('0x2')]},'destlanguage':{'type':Sequelize[_0x40bb('0x2')]},'destaccountcode':{'type':Sequelize[_0x40bb('0x2')]},'destcontext':{'type':Sequelize[_0x40bb('0x2')]},'destexten':{'type':Sequelize[_0x40bb('0x2')]},'destpriority':{'type':Sequelize[_0x40bb('0x2')]},'destuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'answeredelsewheremembername':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0x40bb('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x40bb('0x2')],'comment':_0x40bb('0x6')},'transferexten':{'type':Sequelize[_0x40bb('0x2')]},'transferuniqueid':{'type':Sequelize[_0x40bb('0x2')]},'agententerreason':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0x86c0=['FORWARD,\x20BLIND,\x20ATTENDED','sequelize','STRING','DATE','INTEGER','BOOLEAN'];(function(_0x5bce14,_0x46fd0b){var _0x276eff=function(_0x467001){while(--_0x467001){_0x5bce14['push'](_0x5bce14['shift']());}};_0x276eff(++_0x46fd0b);}(_0x86c0,0x133));var _0x086c=function(_0x52456c,_0x2bea26){_0x52456c=_0x52456c-0x0;var _0x3040d9=_0x86c0[_0x52456c];return _0x3040d9;};'use strict';var Sequelize=require(_0x086c('0x0'));module['exports']={'type':{'type':Sequelize[_0x086c('0x1')]},'uniqueid':{'type':Sequelize[_0x086c('0x1')]},'calleridnum':{'type':Sequelize[_0x086c('0x1')]},'calleridname':{'type':Sequelize[_0x086c('0x1')]},'queue':{'type':Sequelize['STRING']},'interface':{'type':Sequelize[_0x086c('0x1')]},'membername':{'type':Sequelize[_0x086c('0x1')]},'agentcalledAt':{'type':Sequelize[_0x086c('0x2')]},'agentconnectAt':{'type':Sequelize[_0x086c('0x2')]},'agentcompleteAt':{'type':Sequelize['DATE']},'agentringnoanswerAt':{'type':Sequelize[_0x086c('0x2')]},'agentdumpAt':{'type':Sequelize[_0x086c('0x2')]},'holdtime':{'type':Sequelize[_0x086c('0x3')]},'agentcomplete':{'type':Sequelize[_0x086c('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x086c('0x4')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x086c('0x4')],'defaultValue':![]},'talktime':{'type':Sequelize['INTEGER']},'agentacw':{'type':Sequelize[_0x086c('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0x086c('0x3')]},'reason':{'type':Sequelize[_0x086c('0x1')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0x086c('0x3')]},'channelstatedesc':{'type':Sequelize[_0x086c('0x1')]},'connectedlinenum':{'type':Sequelize[_0x086c('0x1')]},'connectedlinename':{'type':Sequelize[_0x086c('0x1')]},'language':{'type':Sequelize[_0x086c('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x086c('0x1')]},'exten':{'type':Sequelize[_0x086c('0x1')]},'priority':{'type':Sequelize[_0x086c('0x1')]},'destchannel':{'type':Sequelize[_0x086c('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x086c('0x1')]},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x086c('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x086c('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0x086c('0x1')]},'destcontext':{'type':Sequelize[_0x086c('0x1')]},'destexten':{'type':Sequelize[_0x086c('0x1')]},'destpriority':{'type':Sequelize[_0x086c('0x1')]},'destuniqueid':{'type':Sequelize['STRING']},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x086c('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0x086c('0x1')]},'transfer':{'type':Sequelize[_0x086c('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x086c('0x5')},'transferexten':{'type':Sequelize[_0x086c('0x1')]},'transferuniqueid':{'type':Sequelize[_0x086c('0x1')]},'agententerreason':{'type':Sequelize[_0x086c('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 3e03d2b..ace9dab 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 _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','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','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4bfac3,_0x58324d){_0x4bfac3=_0x4bfac3-0x0;var _0x15f0f2=_0xa9e0[_0x4bfac3];return _0x15f0f2;};'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);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','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','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'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);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index f8ea58d..70116fe 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 _0xdc97=['define','uniqueid','destuniqueid','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x14fad0,_0x278d75){var _0x5c665f=function(_0xe43a83){while(--_0xe43a83){_0x14fad0['push'](_0x14fad0['shift']());}};_0x5c665f(++_0x278d75);}(_0xdc97,0x13b));var _0x7dc9=function(_0x14d5b4,_0x4946f1){_0x14d5b4=_0x14d5b4-0x0;var _0x1c5972=_0xdc97[_0x14d5b4];return _0x1c5972;};'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'));module[_0x7dc9('0x8')]=function(_0x3ba3ca,_0x589f02){return _0x3ba3ca[_0x7dc9('0x9')]('VoiceAgentReport',attributes,{'tableName':'report_agent','paranoid':![],'indexes':[{'fields':[_0x7dc9('0xa'),_0x7dc9('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x56a4=['rimraf','../../config/environment','./voiceAgentReport.attributes','exports','report_agent','uniqueid','destuniqueid','lodash','util','api','moment','path'];(function(_0x28a548,_0x1e7d0c){var _0x193554=function(_0x3adffd){while(--_0x3adffd){_0x28a548['push'](_0x28a548['shift']());}};_0x193554(++_0x1e7d0c);}(_0x56a4,0x11b));var _0x456a=function(_0x45a099,_0x20ea5c){_0x45a099=_0x45a099-0x0;var _0x557e01=_0x56a4[_0x45a099];return _0x557e01;};'use strict';var _=require(_0x456a('0x0'));var util=require(_0x456a('0x1'));var logger=require('../../config/logger')(_0x456a('0x2'));var moment=require(_0x456a('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x456a('0x4'));var rimraf=require(_0x456a('0x5'));var config=require(_0x456a('0x6'));var attributes=require(_0x456a('0x7'));module[_0x456a('0x8')]=function(_0x4b8eec,_0x3b0145){return _0x4b8eec['define']('VoiceAgentReport',attributes,{'tableName':_0x456a('0x9'),'paranoid':![],'indexes':[{'fields':[_0x456a('0xa'),_0x456a('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 1d022a9..04af1f4 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 _0x7fd1=['VoiceAgentReport','create','body','options','raw','then','UpdateVoiceAgentReport','where','attributes','limit','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','request','info','request\x20sent','debug','stringify','error','code','VoiceAgentReport,\x20%s,\x20%s','message','catch','CreateVoiceAgentReport'];(function(_0x476970,_0x25d963){var _0x41c6d6=function(_0x4a23cc){while(--_0x4a23cc){_0x476970['push'](_0x476970['shift']());}};_0x41c6d6(++_0x25d963);}(_0x7fd1,0x1ae));var _0x17fd=function(_0x20ef59,_0x584d83){_0x20ef59=_0x20ef59-0x0;var _0x2f5d67=_0x7fd1[_0x20ef59];return _0x2f5d67;};'use strict';var _=require(_0x17fd('0x0'));var util=require(_0x17fd('0x1'));var moment=require(_0x17fd('0x2'));var BPromise=require(_0x17fd('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x17fd('0x4'));var db=require(_0x17fd('0x5'))['db'];var utils=require(_0x17fd('0x6'));var logger=require('../../config/logger')(_0x17fd('0x7'));var config=require('../../config/environment');var jayson=require(_0x17fd('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x243912,_0x23f55c,_0x13d662){return new BPromise(function(_0x1e354d,_0x3efac2){return client[_0x17fd('0x9')](_0x243912,_0x13d662)['then'](function(_0x5c6564){logger[_0x17fd('0xa')]('VoiceAgentReport,\x20%s,\x20%s',_0x23f55c,_0x17fd('0xb'));logger[_0x17fd('0xc')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x23f55c,_0x17fd('0xb'),JSON[_0x17fd('0xd')](_0x5c6564));if(_0x5c6564[_0x17fd('0xe')]){if(_0x5c6564['error'][_0x17fd('0xf')]===0x1f4){logger['error'](_0x17fd('0x10'),_0x23f55c,_0x5c6564[_0x17fd('0xe')][_0x17fd('0x11')]);return _0x3efac2(_0x5c6564[_0x17fd('0xe')][_0x17fd('0x11')]);}logger[_0x17fd('0xe')](_0x17fd('0x10'),_0x23f55c,_0x5c6564['error']['message']);return _0x1e354d(_0x5c6564['error'][_0x17fd('0x11')]);}else{logger[_0x17fd('0xa')](_0x17fd('0x10'),_0x23f55c,'request\x20sent');_0x1e354d(_0x5c6564['result'][_0x17fd('0x11')]);}})[_0x17fd('0x12')](function(_0x465148){logger[_0x17fd('0xe')](_0x17fd('0x10'),_0x23f55c,_0x465148);_0x3efac2(_0x465148);});});}exports[_0x17fd('0x13')]=function(_0x30bf88){var _0x98e0fa=this;return new Promise(function(_0x1d0707,_0x4b6dda){return db[_0x17fd('0x14')][_0x17fd('0x15')](_0x30bf88[_0x17fd('0x16')],{'raw':_0x30bf88[_0x17fd('0x17')]?_0x30bf88[_0x17fd('0x17')][_0x17fd('0x18')]===undefined?!![]:![]:!![]})[_0x17fd('0x19')](function(_0x4d6943){logger['info']('CreateVoiceAgentReport',_0x30bf88);logger[_0x17fd('0xc')](_0x17fd('0x13'),_0x30bf88,JSON['stringify'](_0x4d6943));_0x1d0707(_0x4d6943);})['catch'](function(_0x10f3d7){logger['error'](_0x17fd('0x13'),_0x10f3d7['message'],_0x30bf88);_0x4b6dda(_0x98e0fa['error'](0x1f4,_0x10f3d7[_0x17fd('0x11')]));});});};exports[_0x17fd('0x1a')]=function(_0x4facfd){var _0x395edb=this;return new Promise(function(_0x42e03f,_0x1c0b9){return db[_0x17fd('0x14')]['update'](_0x4facfd[_0x17fd('0x16')],{'raw':_0x4facfd[_0x17fd('0x17')]?_0x4facfd[_0x17fd('0x17')][_0x17fd('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4facfd[_0x17fd('0x17')]?_0x4facfd[_0x17fd('0x17')][_0x17fd('0x1b')]||null:null,'attributes':_0x4facfd[_0x17fd('0x17')]?_0x4facfd[_0x17fd('0x17')][_0x17fd('0x1c')]||null:null,'limit':_0x4facfd[_0x17fd('0x17')]?_0x4facfd[_0x17fd('0x17')][_0x17fd('0x1d')]||null:null})[_0x17fd('0x19')](function(_0x44b450){logger[_0x17fd('0xa')]('UpdateVoiceAgentReport',_0x4facfd);logger[_0x17fd('0xc')](_0x17fd('0x1a'),_0x4facfd,JSON['stringify'](_0x44b450));_0x42e03f(_0x44b450);})[_0x17fd('0x12')](function(_0x4c248e){logger['error'](_0x17fd('0x1a'),_0x4c248e[_0x17fd('0x11')],_0x4facfd);_0x1c0b9(_0x395edb[_0x17fd('0xe')](0x1f4,_0x4c248e[_0x17fd('0x11')]));});});}; \ No newline at end of file +var _0xf37b=['../../config/environment','client','http','request','then','VoiceAgentReport,\x20%s,\x20%s','request\x20sent','VoiceAgentReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','VoiceAgentReport','create','options','CreateVoiceAgentReport','UpdateVoiceAgentReport','update','attributes','limit','debug','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0xf37b,0x1ca));var _0xbf37=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0xf37b[_0x4243a3];return _0x1b2a33;};'use strict';var _=require('lodash');var util=require(_0xbf37('0x0'));var moment=require(_0xbf37('0x1'));var BPromise=require(_0xbf37('0x2'));var rs=require(_0xbf37('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xbf37('0x4'));var logger=require(_0xbf37('0x5'))('rpc');var config=require(_0xbf37('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xbf37('0x7')][_0xbf37('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1e42cf,_0x38c4b3,_0x40d77b){return new BPromise(function(_0x2efa28,_0xd078b1){return client[_0xbf37('0x9')](_0x1e42cf,_0x40d77b)[_0xbf37('0xa')](function(_0x4eb65e){logger['info'](_0xbf37('0xb'),_0x38c4b3,_0xbf37('0xc'));logger['debug'](_0xbf37('0xd'),_0x38c4b3,_0xbf37('0xc'),JSON[_0xbf37('0xe')](_0x4eb65e));if(_0x4eb65e[_0xbf37('0xf')]){if(_0x4eb65e[_0xbf37('0xf')][_0xbf37('0x10')]===0x1f4){logger[_0xbf37('0xf')](_0xbf37('0xb'),_0x38c4b3,_0x4eb65e[_0xbf37('0xf')][_0xbf37('0x11')]);return _0xd078b1(_0x4eb65e[_0xbf37('0xf')][_0xbf37('0x11')]);}logger[_0xbf37('0xf')]('VoiceAgentReport,\x20%s,\x20%s',_0x38c4b3,_0x4eb65e['error'][_0xbf37('0x11')]);return _0x2efa28(_0x4eb65e['error'][_0xbf37('0x11')]);}else{logger[_0xbf37('0x12')](_0xbf37('0xb'),_0x38c4b3,_0xbf37('0xc'));_0x2efa28(_0x4eb65e['result'][_0xbf37('0x11')]);}})['catch'](function(_0x4bdfe5){logger[_0xbf37('0xf')](_0xbf37('0xb'),_0x38c4b3,_0x4bdfe5);_0xd078b1(_0x4bdfe5);});});}exports['CreateVoiceAgentReport']=function(_0x1902ba){var _0x207453=this;return new Promise(function(_0x3ef26f,_0x54d189){return db[_0xbf37('0x13')][_0xbf37('0x14')](_0x1902ba['body'],{'raw':_0x1902ba[_0xbf37('0x15')]?_0x1902ba[_0xbf37('0x15')]['raw']===undefined?!![]:![]:!![]})[_0xbf37('0xa')](function(_0x27d553){logger[_0xbf37('0x12')]('CreateVoiceAgentReport',_0x1902ba);logger['debug'](_0xbf37('0x16'),_0x1902ba,JSON['stringify'](_0x27d553));_0x3ef26f(_0x27d553);})['catch'](function(_0x5ec14d){logger[_0xbf37('0xf')](_0xbf37('0x16'),_0x5ec14d[_0xbf37('0x11')],_0x1902ba);_0x54d189(_0x207453['error'](0x1f4,_0x5ec14d['message']));});});};exports[_0xbf37('0x17')]=function(_0x96b965){var _0x52acf3=this;return new Promise(function(_0x3c8183,_0xf7f46f){return db['VoiceAgentReport'][_0xbf37('0x18')](_0x96b965['body'],{'raw':_0x96b965[_0xbf37('0x15')]?_0x96b965[_0xbf37('0x15')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x96b965['options']?_0x96b965[_0xbf37('0x15')]['where']||null:null,'attributes':_0x96b965['options']?_0x96b965[_0xbf37('0x15')][_0xbf37('0x19')]||null:null,'limit':_0x96b965[_0xbf37('0x15')]?_0x96b965['options'][_0xbf37('0x1a')]||null:null})[_0xbf37('0xa')](function(_0x31afb5){logger[_0xbf37('0x12')](_0xbf37('0x17'),_0x96b965);logger[_0xbf37('0x1b')](_0xbf37('0x17'),_0x96b965,JSON[_0xbf37('0xe')](_0x31afb5));_0x3c8183(_0x31afb5);})[_0xbf37('0x1c')](function(_0x53ba13){logger[_0xbf37('0xf')](_0xbf37('0x17'),_0x53ba13['message'],_0x96b965);_0xf7f46f(_0x52acf3[_0xbf37('0xf')](0x1f4,_0x53ba13[_0xbf37('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 9c363ce..a77a319 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 _0x6737=['isAuthenticated','index','get','show','create','put','update','/:id','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller'];(function(_0x183a11,_0x2f9df8){var _0x5e2bf5=function(_0x4cf91f){while(--_0x4cf91f){_0x183a11['push'](_0x183a11['shift']());}};_0x5e2bf5(++_0x2f9df8);}(_0x6737,0xe2));var _0x7673=function(_0x4a5f6e,_0x1d470a){_0x4a5f6e=_0x4a5f6e-0x0;var _0x298bf3=_0x6737[_0x4a5f6e];return _0x298bf3;};'use strict';var multer=require('multer');var util=require(_0x7673('0x0'));var path=require(_0x7673('0x1'));var timeout=require('connect-timeout');var express=require(_0x7673('0x2'));var router=express[_0x7673('0x3')]();var fs_extra=require(_0x7673('0x4'));var auth=require(_0x7673('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7673('0x6'));var controller=require(_0x7673('0x7'));router['get']('/',auth[_0x7673('0x8')](),controller[_0x7673('0x9')]);router['get']('/describe',auth['isAuthenticated'](),controller['describe']);router[_0x7673('0xa')]('/:id',auth[_0x7673('0x8')](),controller[_0x7673('0xb')]);router['post']('/',auth[_0x7673('0x8')](),controller[_0x7673('0xc')]);router[_0x7673('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x7673('0xe')]);router['delete'](_0x7673('0xf'),auth[_0x7673('0x8')](),controller[_0x7673('0x10')]);module[_0x7673('0x11')]=router; \ No newline at end of file +var _0x5636=['isAuthenticated','index','/describe','describe','/:id','show','create','put','delete','destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceCallReport.controller','get'];(function(_0x3c4eeb,_0x273ebd){var _0x8036b0=function(_0x486594){while(--_0x486594){_0x3c4eeb['push'](_0x3c4eeb['shift']());}};_0x8036b0(++_0x273ebd);}(_0x5636,0x102));var _0x6563=function(_0x519737,_0x1dd99e){_0x519737=_0x519737-0x0;var _0x291589=_0x5636[_0x519737];return _0x291589;};'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')]('/',auth[_0x6563('0x8')](),controller[_0x6563('0x9')]);router[_0x6563('0x7')](_0x6563('0xa'),auth[_0x6563('0x8')](),controller[_0x6563('0xb')]);router[_0x6563('0x7')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x6563('0xe')]);router[_0x6563('0xf')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x6563('0x10')](_0x6563('0xc'),auth[_0x6563('0x8')](),controller[_0x6563('0x11')]);module[_0x6563('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 477f897..a84f3d2 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 _0xfc64=['outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','sequelize','exports','STRING','inbound','internal'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfc64,0x1b3));var _0x4fc6=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xfc64[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x4fc6('0x0'));module[_0x4fc6('0x1')]={'uniqueid':{'type':Sequelize[_0x4fc6('0x2')]},'type':{'type':Sequelize['ENUM'](_0x4fc6('0x3'),_0x4fc6('0x4'),_0x4fc6('0x5'),_0x4fc6('0x6'),_0x4fc6('0x7'),'dialer')},'tag':{'type':Sequelize[_0x4fc6('0x2')]},'accountcode':{'type':Sequelize[_0x4fc6('0x2')]},'source':{'type':Sequelize[_0x4fc6('0x2')]},'destination':{'type':Sequelize[_0x4fc6('0x2')]},'destinationcontext':{'type':Sequelize[_0x4fc6('0x2')]},'callerid':{'type':Sequelize[_0x4fc6('0x2')]},'channel':{'type':Sequelize[_0x4fc6('0x2')]},'destinationchannel':{'type':Sequelize['STRING']},'lastapplication':{'type':Sequelize[_0x4fc6('0x2')]},'lastdata':{'type':Sequelize[_0x4fc6('0x8')]},'starttime':{'type':Sequelize[_0x4fc6('0x9')]},'systemanswertime':{'type':Sequelize[_0x4fc6('0x9')]},'answertime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'duration':{'type':Sequelize[_0x4fc6('0xa')]},'billableseconds':{'type':Sequelize[_0x4fc6('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0x4fc6('0x2')]},'userfield':{'type':Sequelize[_0x4fc6('0x2')]},'userDisposition':{'type':Sequelize[_0x4fc6('0x2')]},'userSecondDisposition':{'type':Sequelize[_0x4fc6('0x2')]},'userThirdDisposition':{'type':Sequelize[_0x4fc6('0x2')]},'note':{'type':Sequelize[_0x4fc6('0x2')]},'prefix':{'type':Sequelize[_0x4fc6('0x2')]},'routeid':{'type':Sequelize[_0x4fc6('0xa')]},'sipcallid':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xdaed=['STRING','DATE','INTEGER','exports','ENUM','internal','outbound','inbound-fax','outbound-fax','dialer'];(function(_0x418be0,_0x5d5893){var _0xb892dc=function(_0x2b8690){while(--_0x2b8690){_0x418be0['push'](_0x418be0['shift']());}};_0xb892dc(++_0x5d5893);}(_0xdaed,0xcb));var _0xddae=function(_0x13f9f1,_0x29feca){_0x13f9f1=_0x13f9f1-0x0;var _0x1cbce4=_0xdaed[_0x13f9f1];return _0x1cbce4;};'use strict';var Sequelize=require('sequelize');module[_0xddae('0x0')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xddae('0x1')]('inbound',_0xddae('0x2'),_0xddae('0x3'),_0xddae('0x4'),_0xddae('0x5'),_0xddae('0x6'))},'tag':{'type':Sequelize[_0xddae('0x7')]},'accountcode':{'type':Sequelize[_0xddae('0x7')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xddae('0x7')]},'destinationcontext':{'type':Sequelize[_0xddae('0x7')]},'callerid':{'type':Sequelize[_0xddae('0x7')]},'channel':{'type':Sequelize[_0xddae('0x7')]},'destinationchannel':{'type':Sequelize[_0xddae('0x7')]},'lastapplication':{'type':Sequelize[_0xddae('0x7')]},'lastdata':{'type':Sequelize['TEXT']},'starttime':{'type':Sequelize[_0xddae('0x8')]},'systemanswertime':{'type':Sequelize[_0xddae('0x8')]},'answertime':{'type':Sequelize[_0xddae('0x8')]},'endtime':{'type':Sequelize[_0xddae('0x8')]},'duration':{'type':Sequelize[_0xddae('0x9')]},'billableseconds':{'type':Sequelize[_0xddae('0x9')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xddae('0x7')]},'amaflags':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xddae('0x7')]},'userDisposition':{'type':Sequelize[_0xddae('0x7')]},'userSecondDisposition':{'type':Sequelize[_0xddae('0x7')]},'userThirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xddae('0x7')]},'prefix':{'type':Sequelize['STRING']},'routeid':{'type':Sequelize[_0xddae('0x9')]},'sipcallid':{'type':Sequelize[_0xddae('0x7')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index ca4eec8..295bf93 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 _0xb10b=['desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','VIRTUAL','filter','merge','options','VoiceCallReport','includeAll','include','alias','User','rows','show','find','create','body','catch','params','describe','uniqueid','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce'];(function(_0x492a,_0x2d686f){var _0x2bd51a=function(_0x567248){while(--_0x567248){_0x492a['push'](_0x492a['shift']());}};_0x2bd51a(++_0x2d686f);}(_0xb10b,0x12a));var _0xbb10=function(_0x5e8c32,_0x1b1f3f){_0x5e8c32=_0x5e8c32-0x0;var _0x595f7b=_0xb10b[_0x5e8c32];return _0x595f7b;};'use strict';var emlformat=require(_0xbb10('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbb10('0x1'));var jsonpatch=require(_0xbb10('0x2'));var rp=require(_0xbb10('0x3'));var moment=require('moment');var BPromise=require(_0xbb10('0x4'));var Mustache=require(_0xbb10('0x5'));var util=require(_0xbb10('0x6'));var path=require(_0xbb10('0x7'));var sox=require(_0xbb10('0x8'));var csv=require(_0xbb10('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xbb10('0xa'));var _=require(_0xbb10('0xb'));var squel=require('squel');var crypto=require(_0xbb10('0xc'));var jsforce=require(_0xbb10('0xd'));var deskjs=require(_0xbb10('0xe'));var toCsv=require(_0xbb10('0x9'));var querystring=require(_0xbb10('0xf'));var Papa=require(_0xbb10('0x10'));var Redis=require(_0xbb10('0x11'));var authService=require(_0xbb10('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbb10('0x13'));var logger=require(_0xbb10('0x14'))(_0xbb10('0x15'));var utils=require('../../config/utils');var config=require(_0xbb10('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xbb10('0x17'))['db'];function respondWithStatusCode(_0x916a32,_0x285009){_0x285009=_0x285009||0xcc;return function(_0x193a27){if(_0x193a27){return _0x916a32[_0xbb10('0x18')](_0x285009);}return _0x916a32[_0xbb10('0x19')](_0x285009)['end']();};}function respondWithResult(_0x26e021,_0x42d7e4){_0x42d7e4=_0x42d7e4||0xc8;return function(_0x45b9d6){if(_0x45b9d6){return _0x26e021[_0xbb10('0x19')](_0x42d7e4)[_0xbb10('0x1a')](_0x45b9d6);}};}function respondWithFilteredResult(_0x2f2ebf,_0x24a57b){return function(_0x36b5e8){if(_0x36b5e8){var _0x3e26f4=typeof _0x24a57b[_0xbb10('0x1b')]==='undefined'&&typeof _0x24a57b[_0xbb10('0x1c')]===_0xbb10('0x1d');var _0x133ac2=_0x36b5e8[_0xbb10('0x1e')];var _0x378da8=_0x3e26f4?0x0:_0x24a57b[_0xbb10('0x1b')];var _0x575cca=_0x3e26f4?_0x36b5e8[_0xbb10('0x1e')]:_0x24a57b[_0xbb10('0x1b')]+_0x24a57b[_0xbb10('0x1c')];var _0x48b6e9;if(_0x575cca>=_0x133ac2){_0x575cca=_0x133ac2;_0x48b6e9=0xc8;}else{_0x48b6e9=0xce;}_0x2f2ebf[_0xbb10('0x19')](_0x48b6e9);return _0x2f2ebf[_0xbb10('0x1f')](_0xbb10('0x20'),_0x378da8+'-'+_0x575cca+'/'+_0x133ac2)[_0xbb10('0x1a')](_0x36b5e8);}return null;};}function patchUpdates(_0xdf237d){return function(_0x44e563){try{jsonpatch['apply'](_0x44e563,_0xdf237d,!![]);}catch(_0x12f888){return BPromise[_0xbb10('0x21')](_0x12f888);}return _0x44e563['save']();};}function saveUpdates(_0x4c4b0d,_0x8e2b97){return function(_0x311abe){if(_0x311abe){return _0x311abe[_0xbb10('0x22')](_0x4c4b0d)[_0xbb10('0x23')](function(_0x445761){return _0x445761;});}return null;};}function removeEntity(_0x1824b7,_0x407cb4){return function(_0x436104){if(_0x436104){return _0x436104[_0xbb10('0x24')]()[_0xbb10('0x23')](function(){_0x1824b7[_0xbb10('0x19')](0xcc)[_0xbb10('0x25')]();});}};}function handleEntityNotFound(_0x537898,_0x4fedac){return function(_0x4fb5e0){if(!_0x4fb5e0){_0x537898[_0xbb10('0x18')](0x194);}return _0x4fb5e0;};}function handleError(_0x3c5ae7,_0x2c89b9){_0x2c89b9=_0x2c89b9||0x1f4;return function(_0x4e25ff){logger[_0xbb10('0x26')](_0x4e25ff[_0xbb10('0x27')]);if(_0x4e25ff[_0xbb10('0x28')]){delete _0x4e25ff[_0xbb10('0x28')];}_0x3c5ae7[_0xbb10('0x19')](_0x2c89b9)[_0xbb10('0x29')](_0x4e25ff);};}exports[_0xbb10('0x2a')]=function(_0x4aabb9,_0x3796c7){var _0x21ac54={},_0xfc3595={},_0x2e0249={'count':0x0,'rows':[]};var _0x1d30aa=_[_0xbb10('0x2b')](db['VoiceCallReport'][_0xbb10('0x2c')],function(_0x4ee02e){return{'name':_0x4ee02e[_0xbb10('0x2d')],'type':_0x4ee02e['type'][_0xbb10('0x2e')]};});_0xfc3595[_0xbb10('0x2f')]=_[_0xbb10('0x2b')](_0x1d30aa,'name');_0xfc3595['query']=_[_0xbb10('0x30')](_0x4aabb9[_0xbb10('0x31')]);_0xfc3595['filters']=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],_0xfc3595[_0xbb10('0x31')]);_0x21ac54[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0xfc3595[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x4aabb9['query'][_0xbb10('0x34')]));_0x21ac54[_0xbb10('0x33')]=_0x21ac54[_0xbb10('0x33')][_0xbb10('0x35')]?_0x21ac54[_0xbb10('0x33')]:_0xfc3595[_0xbb10('0x2f')];if(!_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x36')](_0xbb10('0x37'))){_0x21ac54['limit']=qs[_0xbb10('0x1c')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x1c')]);_0x21ac54[_0xbb10('0x1b')]=qs['offset'](_0x4aabb9[_0xbb10('0x31')]['offset']);}_0x21ac54['order']=qs[_0xbb10('0x38')](_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x38')]);_0x21ac54[_0xbb10('0x39')]=qs[_0xbb10('0x3a')](_[_0xbb10('0x3b')](_0x4aabb9['query'],_0xfc3595[_0xbb10('0x3a')]),_0x1d30aa);if(_0x4aabb9[_0xbb10('0x31')]['filter']){_0x21ac54['where']=_['merge'](_0x21ac54[_0xbb10('0x39')],{'$or':_[_0xbb10('0x2b')](_0x1d30aa,function(_0x2b658a){if(_0x2b658a['type']!==_0xbb10('0x3c')){var _0x3e8538={};_0x3e8538[_0x2b658a[_0xbb10('0x28')]]={'$like':'%'+_0x4aabb9['query'][_0xbb10('0x3d')]+'%'};return _0x3e8538;}})});}_0x21ac54=_[_0xbb10('0x3e')]({},_0x21ac54,_0x4aabb9[_0xbb10('0x3f')]);var _0x446f49={'where':_0x21ac54['where']};return db[_0xbb10('0x40')][_0xbb10('0x1e')](_0x446f49)['then'](function(_0xe2040f){_0x2e0249[_0xbb10('0x1e')]=_0xe2040f;if(_0x4aabb9[_0xbb10('0x31')][_0xbb10('0x41')]){_0x21ac54[_0xbb10('0x42')]=[{'attributes':['id',_0xbb10('0x28'),'fullname',_0xbb10('0x43')],'model':db[_0xbb10('0x44')],'as':_0xbb10('0x44')}];}return db[_0xbb10('0x40')]['findAll'](_0x21ac54);})[_0xbb10('0x23')](function(_0x331751){_0x2e0249[_0xbb10('0x45')]=_0x331751;return _0x2e0249;})[_0xbb10('0x23')](respondWithFilteredResult(_0x3796c7,_0x21ac54))['catch'](handleError(_0x3796c7,null));};exports[_0xbb10('0x46')]=function(_0x202c60,_0x54ac18){var _0x5d9a4f={'raw':!![],'where':{'id':_0x202c60['params']['id']}},_0x38d78f={};_0x38d78f[_0xbb10('0x2f')]=_[_0xbb10('0x30')](db['VoiceCallReport'][_0xbb10('0x2c')]);_0x38d78f[_0xbb10('0x31')]=_[_0xbb10('0x30')](_0x202c60['query']);_0x38d78f[_0xbb10('0x3a')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],_0x38d78f[_0xbb10('0x31')]);_0x5d9a4f[_0xbb10('0x33')]=_[_0xbb10('0x32')](_0x38d78f[_0xbb10('0x2f')],qs[_0xbb10('0x34')](_0x202c60[_0xbb10('0x31')][_0xbb10('0x34')]));_0x5d9a4f[_0xbb10('0x33')]=_0x5d9a4f[_0xbb10('0x33')]['length']?_0x5d9a4f[_0xbb10('0x33')]:_0x38d78f[_0xbb10('0x2f')];if(_0x202c60['query'][_0xbb10('0x41')]){_0x5d9a4f[_0xbb10('0x42')]=[{'all':!![]}];}_0x5d9a4f=_[_0xbb10('0x3e')]({},_0x5d9a4f,_0x202c60[_0xbb10('0x3f')]);return db[_0xbb10('0x40')][_0xbb10('0x47')](_0x5d9a4f)[_0xbb10('0x23')](handleEntityNotFound(_0x54ac18,null))['then'](respondWithResult(_0x54ac18,null))['catch'](handleError(_0x54ac18,null));};exports[_0xbb10('0x48')]=function(_0x76a208,_0x2b12bd){return db['VoiceCallReport']['create'](_0x76a208[_0xbb10('0x49')],{})[_0xbb10('0x23')](respondWithResult(_0x2b12bd,0xc9))[_0xbb10('0x4a')](handleError(_0x2b12bd,null));};exports[_0xbb10('0x24')]=function(_0x10159b,_0x22b315){return db[_0xbb10('0x40')][_0xbb10('0x47')]({'where':{'id':_0x10159b[_0xbb10('0x4b')]['id']}})[_0xbb10('0x23')](handleEntityNotFound(_0x22b315,null))['then'](removeEntity(_0x22b315,null))['catch'](handleError(_0x22b315,null));};exports[_0xbb10('0x4c')]=function(_0x467dba,_0x36ab7d){return db[_0xbb10('0x40')][_0xbb10('0x4c')]()[_0xbb10('0x23')](respondWithResult(_0x36ab7d,null))[_0xbb10('0x4a')](handleError(_0x36ab7d,null));};exports[_0xbb10('0x22')]=function(_0x1c0d8f,_0x1214f7){if(_0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')]){delete _0x1c0d8f[_0xbb10('0x49')][_0xbb10('0x4d')];}return db[_0xbb10('0x40')]['find']({'where':{'uniqueid':_0x1c0d8f[_0xbb10('0x4b')]['id'],'UserId':{'$or':[null,_0x1c0d8f['user']['id']]}}})[_0xbb10('0x23')](handleEntityNotFound(_0x1214f7,null))[_0xbb10('0x23')](saveUpdates(_0x1c0d8f[_0xbb10('0x49')],null))[_0xbb10('0x23')](respondWithResult(_0x1214f7,null))[_0xbb10('0x4a')](handleError(_0x1214f7,null));}; \ No newline at end of file +var _0xdb28=['options','includeAll','fullname','User','findAll','rows','catch','show','params','rawAttributes','intersection','include','find','create','destroy','describe','body','uniqueid','user','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','count','limit','set','apply','save','update','then','sendStatus','error','stack','name','send','index','VoiceCallReport','fieldName','type','key','map','query','keys','model','fields','attributes','length','nolimit','order','sort','filters','filter','where','VIRTUAL','merge'];(function(_0x36cf46,_0x403629){var _0xfc161f=function(_0x50a38d){while(--_0x50a38d){_0x36cf46['push'](_0x36cf46['shift']());}};_0xfc161f(++_0x403629);}(_0xdb28,0x106));var _0x8db2=function(_0x3afbfe,_0x344317){_0x3afbfe=_0x3afbfe-0x0;var _0x4bc4f4=_0xdb28[_0x3afbfe];return _0x4bc4f4;};'use strict';var emlformat=require(_0x8db2('0x0'));var rimraf=require(_0x8db2('0x1'));var zipdir=require(_0x8db2('0x2'));var jsonpatch=require(_0x8db2('0x3'));var rp=require('request-promise');var moment=require(_0x8db2('0x4'));var BPromise=require(_0x8db2('0x5'));var Mustache=require(_0x8db2('0x6'));var util=require(_0x8db2('0x7'));var path=require(_0x8db2('0x8'));var sox=require('sox');var csv=require(_0x8db2('0x9'));var ejs=require(_0x8db2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x8db2('0xb'));var crypto=require(_0x8db2('0xc'));var jsforce=require(_0x8db2('0xd'));var deskjs=require(_0x8db2('0xe'));var toCsv=require(_0x8db2('0x9'));var querystring=require(_0x8db2('0xf'));var Papa=require(_0x8db2('0x10'));var Redis=require('ioredis');var authService=require(_0x8db2('0x11'));var qs=require(_0x8db2('0x12'));var as=require(_0x8db2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8db2('0x14'))(_0x8db2('0x15'));var utils=require('../../config/utils');var config=require(_0x8db2('0x16'));var licenseUtil=require(_0x8db2('0x17'));var db=require(_0x8db2('0x18'))['db'];function respondWithStatusCode(_0x204f49,_0x37d017){_0x37d017=_0x37d017||0xcc;return function(_0x559fb1){if(_0x559fb1){return _0x204f49['sendStatus'](_0x37d017);}return _0x204f49[_0x8db2('0x19')](_0x37d017)[_0x8db2('0x1a')]();};}function respondWithResult(_0x350d61,_0x1d6a15){_0x1d6a15=_0x1d6a15||0xc8;return function(_0x227355){if(_0x227355){return _0x350d61[_0x8db2('0x19')](_0x1d6a15)[_0x8db2('0x1b')](_0x227355);}};}function respondWithFilteredResult(_0x3c96a7,_0x131252){return function(_0x16c8c2){if(_0x16c8c2){var _0x5489a9=typeof _0x131252[_0x8db2('0x1c')]===_0x8db2('0x1d')&&typeof _0x131252['limit']===_0x8db2('0x1d');var _0x44957d=_0x16c8c2[_0x8db2('0x1e')];var _0x3fddc2=_0x5489a9?0x0:_0x131252[_0x8db2('0x1c')];var _0x46ce14=_0x5489a9?_0x16c8c2['count']:_0x131252['offset']+_0x131252[_0x8db2('0x1f')];var _0x104e33;if(_0x46ce14>=_0x44957d){_0x46ce14=_0x44957d;_0x104e33=0xc8;}else{_0x104e33=0xce;}_0x3c96a7[_0x8db2('0x19')](_0x104e33);return _0x3c96a7[_0x8db2('0x20')]('Content-Range',_0x3fddc2+'-'+_0x46ce14+'/'+_0x44957d)[_0x8db2('0x1b')](_0x16c8c2);}return null;};}function patchUpdates(_0x36a9ff){return function(_0x260940){try{jsonpatch[_0x8db2('0x21')](_0x260940,_0x36a9ff,!![]);}catch(_0x3dbe8e){return BPromise['reject'](_0x3dbe8e);}return _0x260940[_0x8db2('0x22')]();};}function saveUpdates(_0x3e30e6,_0x18f69c){return function(_0x125be2){if(_0x125be2){return _0x125be2[_0x8db2('0x23')](_0x3e30e6)[_0x8db2('0x24')](function(_0x796ec1){return _0x796ec1;});}return null;};}function removeEntity(_0x5c6614,_0x256202){return function(_0x4f6516){if(_0x4f6516){return _0x4f6516['destroy']()['then'](function(){_0x5c6614['status'](0xcc)[_0x8db2('0x1a')]();});}};}function handleEntityNotFound(_0x29b5cd,_0x3be281){return function(_0x2baed0){if(!_0x2baed0){_0x29b5cd[_0x8db2('0x25')](0x194);}return _0x2baed0;};}function handleError(_0x8d4f54,_0x58cd9d){_0x58cd9d=_0x58cd9d||0x1f4;return function(_0x3544ba){logger[_0x8db2('0x26')](_0x3544ba[_0x8db2('0x27')]);if(_0x3544ba[_0x8db2('0x28')]){delete _0x3544ba['name'];}_0x8d4f54[_0x8db2('0x19')](_0x58cd9d)[_0x8db2('0x29')](_0x3544ba);};}exports[_0x8db2('0x2a')]=function(_0x1687ed,_0xbe5ece){var _0x21bae5={},_0xa54ea3={},_0x3124d5={'count':0x0,'rows':[]};var _0xbc5366=_['map'](db[_0x8db2('0x2b')]['rawAttributes'],function(_0x59cb77){return{'name':_0x59cb77[_0x8db2('0x2c')],'type':_0x59cb77[_0x8db2('0x2d')][_0x8db2('0x2e')]};});_0xa54ea3['model']=_[_0x8db2('0x2f')](_0xbc5366,'name');_0xa54ea3[_0x8db2('0x30')]=_[_0x8db2('0x31')](_0x1687ed[_0x8db2('0x30')]);_0xa54ea3['filters']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],_0xa54ea3[_0x8db2('0x30')]);_0x21bae5['attributes']=_['intersection'](_0xa54ea3[_0x8db2('0x32')],qs[_0x8db2('0x33')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x33')]));_0x21bae5[_0x8db2('0x34')]=_0x21bae5[_0x8db2('0x34')][_0x8db2('0x35')]?_0x21bae5[_0x8db2('0x34')]:_0xa54ea3[_0x8db2('0x32')];if(!_0x1687ed[_0x8db2('0x30')]['hasOwnProperty'](_0x8db2('0x36'))){_0x21bae5[_0x8db2('0x1f')]=qs['limit'](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x1f')]);_0x21bae5['offset']=qs['offset'](_0x1687ed[_0x8db2('0x30')]['offset']);}_0x21bae5[_0x8db2('0x37')]=qs[_0x8db2('0x38')](_0x1687ed[_0x8db2('0x30')][_0x8db2('0x38')]);_0x21bae5['where']=qs[_0x8db2('0x39')](_['pick'](_0x1687ed[_0x8db2('0x30')],_0xa54ea3[_0x8db2('0x39')]),_0xbc5366);if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]){_0x21bae5['where']=_['merge'](_0x21bae5[_0x8db2('0x3b')],{'$or':_[_0x8db2('0x2f')](_0xbc5366,function(_0x5dc2b4){if(_0x5dc2b4[_0x8db2('0x2d')]!==_0x8db2('0x3c')){var _0x656dd2={};_0x656dd2[_0x5dc2b4['name']]={'$like':'%'+_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3a')]+'%'};return _0x656dd2;}})});}_0x21bae5=_[_0x8db2('0x3d')]({},_0x21bae5,_0x1687ed[_0x8db2('0x3e')]);var _0x2e6f0c={'where':_0x21bae5[_0x8db2('0x3b')]};return db[_0x8db2('0x2b')][_0x8db2('0x1e')](_0x2e6f0c)[_0x8db2('0x24')](function(_0x63c561){_0x3124d5[_0x8db2('0x1e')]=_0x63c561;if(_0x1687ed[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x21bae5['include']=[{'attributes':['id',_0x8db2('0x28'),_0x8db2('0x40'),'alias'],'model':db['User'],'as':_0x8db2('0x41')}];}return db['VoiceCallReport'][_0x8db2('0x42')](_0x21bae5);})[_0x8db2('0x24')](function(_0x313130){_0x3124d5[_0x8db2('0x43')]=_0x313130;return _0x3124d5;})[_0x8db2('0x24')](respondWithFilteredResult(_0xbe5ece,_0x21bae5))[_0x8db2('0x44')](handleError(_0xbe5ece,null));};exports[_0x8db2('0x45')]=function(_0x5c97ef,_0x2f86b1){var _0x3d44de={'raw':!![],'where':{'id':_0x5c97ef[_0x8db2('0x46')]['id']}},_0x40c69e={};_0x40c69e['model']=_[_0x8db2('0x31')](db[_0x8db2('0x2b')][_0x8db2('0x47')]);_0x40c69e[_0x8db2('0x30')]=_['keys'](_0x5c97ef[_0x8db2('0x30')]);_0x40c69e['filters']=_[_0x8db2('0x48')](_0x40c69e[_0x8db2('0x32')],_0x40c69e[_0x8db2('0x30')]);_0x3d44de['attributes']=_['intersection'](_0x40c69e[_0x8db2('0x32')],qs['fields'](_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x33')]));_0x3d44de[_0x8db2('0x34')]=_0x3d44de[_0x8db2('0x34')][_0x8db2('0x35')]?_0x3d44de[_0x8db2('0x34')]:_0x40c69e[_0x8db2('0x32')];if(_0x5c97ef[_0x8db2('0x30')][_0x8db2('0x3f')]){_0x3d44de[_0x8db2('0x49')]=[{'all':!![]}];}_0x3d44de=_[_0x8db2('0x3d')]({},_0x3d44de,_0x5c97ef[_0x8db2('0x3e')]);return db['VoiceCallReport'][_0x8db2('0x4a')](_0x3d44de)[_0x8db2('0x24')](handleEntityNotFound(_0x2f86b1,null))[_0x8db2('0x24')](respondWithResult(_0x2f86b1,null))[_0x8db2('0x44')](handleError(_0x2f86b1,null));};exports['create']=function(_0x4ffd9d,_0x11c224){return db[_0x8db2('0x2b')][_0x8db2('0x4b')](_0x4ffd9d['body'],{})['then'](respondWithResult(_0x11c224,0xc9))['catch'](handleError(_0x11c224,null));};exports[_0x8db2('0x4c')]=function(_0x368c37,_0x55c7dd){return db[_0x8db2('0x2b')][_0x8db2('0x4a')]({'where':{'id':_0x368c37[_0x8db2('0x46')]['id']}})[_0x8db2('0x24')](handleEntityNotFound(_0x55c7dd,null))['then'](removeEntity(_0x55c7dd,null))['catch'](handleError(_0x55c7dd,null));};exports[_0x8db2('0x4d')]=function(_0x18c6ef,_0x2908e4){return db[_0x8db2('0x2b')][_0x8db2('0x4d')]()[_0x8db2('0x24')](respondWithResult(_0x2908e4,null))[_0x8db2('0x44')](handleError(_0x2908e4,null));};exports[_0x8db2('0x23')]=function(_0x4187d6,_0x426ae0){if(_0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')]){delete _0x4187d6[_0x8db2('0x4e')][_0x8db2('0x4f')];}return db[_0x8db2('0x2b')]['find']({'where':{'uniqueid':_0x4187d6[_0x8db2('0x46')]['id'],'UserId':{'$or':[null,_0x4187d6[_0x8db2('0x50')]['id']]}}})['then'](handleEntityNotFound(_0x426ae0,null))[_0x8db2('0x24')](saveUpdates(_0x4187d6[_0x8db2('0x4e')],null))[_0x8db2('0x24')](respondWithResult(_0x426ae0,null))['catch'](handleError(_0x426ae0,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index c79a265..29b7c99 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 _0x28ef=['request-promise','rimraf','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x49d249,_0x508570){var _0x50273d=function(_0x3d9a0d){while(--_0x3d9a0d){_0x49d249['push'](_0x49d249['shift']());}};_0x50273d(++_0x508570);}(_0x28ef,0x19b));var _0xf28e=function(_0x16e54f,_0x183f2f){_0x16e54f=_0x16e54f-0x0;var _0xa1cc26=_0x28ef[_0x16e54f];return _0xa1cc26;};'use strict';var _=require(_0xf28e('0x0'));var util=require(_0xf28e('0x1'));var logger=require(_0xf28e('0x2'))(_0xf28e('0x3'));var moment=require('moment');var BPromise=require(_0xf28e('0x4'));var rp=require(_0xf28e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf28e('0x6'));var config=require('../../config/environment');var attributes=require(_0xf28e('0x7'));module[_0xf28e('0x8')]=function(_0x3b19a4,_0x190d93){return _0x3b19a4[_0xf28e('0x9')](_0xf28e('0xa'),attributes,{'tableName':_0xf28e('0xb'),'paranoid':![],'indexes':[{'fields':[_0xf28e('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc61f=['define','VoiceCallReport','report_call','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports'];(function(_0x5cabfd,_0x5dea47){var _0x4bc06c=function(_0x4a2fea){while(--_0x4a2fea){_0x5cabfd['push'](_0x5cabfd['shift']());}};_0x4bc06c(++_0x5dea47);}(_0xc61f,0x65));var _0xfc61=function(_0x17869b,_0x290603){_0x17869b=_0x17869b-0x0;var _0x4db341=_0xc61f[_0x17869b];return _0x4db341;};'use strict';var _=require('lodash');var util=require(_0xfc61('0x0'));var logger=require(_0xfc61('0x1'))(_0xfc61('0x2'));var moment=require(_0xfc61('0x3'));var BPromise=require(_0xfc61('0x4'));var rp=require(_0xfc61('0x5'));var fs=require('fs');var path=require(_0xfc61('0x6'));var rimraf=require(_0xfc61('0x7'));var config=require(_0xfc61('0x8'));var attributes=require(_0xfc61('0x9'));module[_0xfc61('0xa')]=function(_0x4b7d26,_0x2e63de){return _0x4b7d26[_0xfc61('0xb')](_0xfc61('0xc'),attributes,{'tableName':_0xfc61('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index 8249097..2be0729 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 _0x8023=['CreateVoiceCallReport','create','body','UpdateVoiceCallReport','update','lodash','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','VoiceCallReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','model','map'];(function(_0x4e85f2,_0x1cf40b){var _0x3ac183=function(_0x11d3a6){while(--_0x11d3a6){_0x4e85f2['push'](_0x4e85f2['shift']());}};_0x3ac183(++_0x1cf40b);}(_0x8023,0xb9));var _0x3802=function(_0x2f001b,_0x2d3071){_0x2f001b=_0x2f001b-0x0;var _0x4a40d9=_0x8023[_0x2f001b];return _0x4a40d9;};'use strict';var _=require(_0x3802('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3802('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3802('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x3802('0x3'))('rpc');var config=require(_0x3802('0x4'));var jayson=require(_0x3802('0x5'));var client=jayson[_0x3802('0x6')][_0x3802('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1cec83,_0x34888c,_0x269ae6){return new BPromise(function(_0x218c2c,_0x34b893){return client[_0x3802('0x8')](_0x1cec83,_0x269ae6)[_0x3802('0x9')](function(_0x2f0ae2){logger['info'](_0x3802('0xa'),_0x34888c,_0x3802('0xb'));logger[_0x3802('0xc')](_0x3802('0xd'),_0x34888c,_0x3802('0xb'),JSON[_0x3802('0xe')](_0x2f0ae2));if(_0x2f0ae2['error']){if(_0x2f0ae2['error']['code']===0x1f4){logger[_0x3802('0xf')](_0x3802('0xa'),_0x34888c,_0x2f0ae2[_0x3802('0xf')][_0x3802('0x10')]);return _0x34b893(_0x2f0ae2[_0x3802('0xf')][_0x3802('0x10')]);}logger[_0x3802('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x34888c,_0x2f0ae2[_0x3802('0xf')][_0x3802('0x10')]);return _0x218c2c(_0x2f0ae2[_0x3802('0xf')][_0x3802('0x10')]);}else{logger[_0x3802('0x11')](_0x3802('0xa'),_0x34888c,'request\x20sent');_0x218c2c(_0x2f0ae2[_0x3802('0x12')][_0x3802('0x10')]);}})[_0x3802('0x13')](function(_0x54b80e){logger[_0x3802('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x34888c,_0x54b80e);_0x34b893(_0x54b80e);});});}exports[_0x3802('0x14')]=function(_0x5c17da){var _0x4f6dd4=this;return new Promise(function(_0x50a9a8,_0x2e37ed){return db[_0x3802('0x15')][_0x3802('0x16')]({'raw':_0x5c17da[_0x3802('0x17')]?_0x5c17da['options'][_0x3802('0x18')]===undefined?!![]:![]:!![],'where':_0x5c17da['options']?_0x5c17da[_0x3802('0x17')][_0x3802('0x19')]||null:null,'attributes':_0x5c17da[_0x3802('0x17')]?_0x5c17da[_0x3802('0x17')][_0x3802('0x1a')]||null:null,'limit':_0x5c17da['options']?_0x5c17da['options'][_0x3802('0x1b')]||null:null,'include':_0x5c17da[_0x3802('0x17')]?_0x5c17da['options'][_0x3802('0x1c')]?_['map'](_0x5c17da[_0x3802('0x17')][_0x3802('0x1c')],function(_0x3c68dc){return{'model':db[_0x3c68dc[_0x3802('0x1d')]],'as':_0x3c68dc['as'],'attributes':_0x3c68dc[_0x3802('0x1a')],'include':_0x3c68dc['include']?_[_0x3802('0x1e')](_0x3c68dc[_0x3802('0x1c')],function(_0x62f6c9){return{'model':db[_0x62f6c9[_0x3802('0x1d')]],'as':_0x62f6c9['as'],'attributes':_0x62f6c9[_0x3802('0x1a')],'include':_0x62f6c9[_0x3802('0x1c')]?_[_0x3802('0x1e')](_0x62f6c9['include'],function(_0x5896a6){return{'model':db[_0x5896a6[_0x3802('0x1d')]],'as':_0x5896a6['as'],'attributes':_0x5896a6[_0x3802('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x256311){logger[_0x3802('0x11')](_0x3802('0x14'),_0x5c17da);logger[_0x3802('0xc')](_0x3802('0x14'),_0x5c17da,JSON['stringify'](_0x256311));_0x50a9a8(_0x256311);})[_0x3802('0x13')](function(_0x104fdf){logger['error'](_0x3802('0x14'),_0x104fdf[_0x3802('0x10')],_0x5c17da);_0x2e37ed(_0x4f6dd4['error'](0x1f4,_0x104fdf[_0x3802('0x10')]));});});};exports[_0x3802('0x1f')]=function(_0x4c0ed1){var _0xd2f355=this;return new Promise(function(_0x43d687,_0x51afc6){return db['VoiceCallReport'][_0x3802('0x20')](_0x4c0ed1[_0x3802('0x21')],{'raw':_0x4c0ed1[_0x3802('0x17')]?_0x4c0ed1[_0x3802('0x17')][_0x3802('0x18')]===undefined?!![]:![]:!![]})[_0x3802('0x9')](function(_0x808bcd){logger[_0x3802('0x11')](_0x3802('0x1f'),_0x4c0ed1);logger['debug'](_0x3802('0x1f'),_0x4c0ed1,JSON[_0x3802('0xe')](_0x808bcd));_0x43d687(_0x808bcd);})[_0x3802('0x13')](function(_0x1e4bf0){logger['error'](_0x3802('0x1f'),_0x1e4bf0[_0x3802('0x10')],_0x4c0ed1);_0x51afc6(_0xd2f355[_0x3802('0xf')](0x1f4,_0x1e4bf0['message']));});});};exports[_0x3802('0x22')]=function(_0x2b2524){var _0x5d42b1=this;return new Promise(function(_0x2fca4e,_0x306f3d){return db[_0x3802('0x15')][_0x3802('0x23')](_0x2b2524[_0x3802('0x21')],{'raw':_0x2b2524[_0x3802('0x17')]?_0x2b2524[_0x3802('0x17')][_0x3802('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2b2524[_0x3802('0x17')]?_0x2b2524[_0x3802('0x17')][_0x3802('0x19')]||null:null,'attributes':_0x2b2524[_0x3802('0x17')]?_0x2b2524['options'][_0x3802('0x1a')]||null:null,'limit':_0x2b2524['options']?_0x2b2524['options']['limit']||null:null})[_0x3802('0x9')](function(_0x1f2645){logger[_0x3802('0x11')]('UpdateVoiceCallReport',_0x2b2524);logger[_0x3802('0xc')]('UpdateVoiceCallReport',_0x2b2524,JSON[_0x3802('0xe')](_0x1f2645));_0x2fca4e(_0x1f2645);})['catch'](function(_0x501fb0){logger[_0x3802('0xf')](_0x3802('0x22'),_0x501fb0[_0x3802('0x10')],_0x2b2524);_0x306f3d(_0x5d42b1[_0x3802('0xf')](0x1f4,_0x501fb0[_0x3802('0x10')]));});});}; \ No newline at end of file +var _0x6fe1=['VoiceCallReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','VoiceCallReport,\x20%s,\x20%s','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','CreateVoiceCallReport','body','UpdateVoiceCallReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','info'];(function(_0x40aaa4,_0x3b22f4){var _0x4e21e5=function(_0x35d2f3){while(--_0x35d2f3){_0x40aaa4['push'](_0x40aaa4['shift']());}};_0x4e21e5(++_0x3b22f4);}(_0x6fe1,0x1b0));var _0x16fe=function(_0x219d87,_0x1cb6f7){_0x219d87=_0x219d87-0x0;var _0x22823d=_0x6fe1[_0x219d87];return _0x22823d;};'use strict';var _=require(_0x16fe('0x0'));var util=require('util');var moment=require(_0x16fe('0x1'));var BPromise=require(_0x16fe('0x2'));var rs=require(_0x16fe('0x3'));var fs=require('fs');var Redis=require(_0x16fe('0x4'));var db=require(_0x16fe('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x16fe('0x6'))('rpc');var config=require(_0x16fe('0x7'));var jayson=require(_0x16fe('0x8'));var client=jayson[_0x16fe('0x9')][_0x16fe('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5373d6,_0x1d7738,_0x39037a){return new BPromise(function(_0x470718,_0x31bb52){return client['request'](_0x5373d6,_0x39037a)['then'](function(_0x15a7ab){logger[_0x16fe('0xb')]('VoiceCallReport,\x20%s,\x20%s',_0x1d7738,'request\x20sent');logger['debug'](_0x16fe('0xc'),_0x1d7738,_0x16fe('0xd'),JSON[_0x16fe('0xe')](_0x15a7ab));if(_0x15a7ab['error']){if(_0x15a7ab['error'][_0x16fe('0xf')]===0x1f4){logger[_0x16fe('0x10')](_0x16fe('0x11'),_0x1d7738,_0x15a7ab[_0x16fe('0x10')][_0x16fe('0x12')]);return _0x31bb52(_0x15a7ab[_0x16fe('0x10')]['message']);}logger['error'](_0x16fe('0x11'),_0x1d7738,_0x15a7ab[_0x16fe('0x10')][_0x16fe('0x12')]);return _0x470718(_0x15a7ab[_0x16fe('0x10')]['message']);}else{logger['info'](_0x16fe('0x11'),_0x1d7738,_0x16fe('0xd'));_0x470718(_0x15a7ab[_0x16fe('0x13')]['message']);}})[_0x16fe('0x14')](function(_0x292480){logger[_0x16fe('0x10')](_0x16fe('0x11'),_0x1d7738,_0x292480);_0x31bb52(_0x292480);});});}exports[_0x16fe('0x15')]=function(_0x16637f){var _0xa2db68=this;return new Promise(function(_0x5bdfc6,_0x2e2a12){return db[_0x16fe('0x16')][_0x16fe('0x17')]({'raw':_0x16637f[_0x16fe('0x18')]?_0x16637f[_0x16fe('0x18')][_0x16fe('0x19')]===undefined?!![]:![]:!![],'where':_0x16637f[_0x16fe('0x18')]?_0x16637f[_0x16fe('0x18')][_0x16fe('0x1a')]||null:null,'attributes':_0x16637f['options']?_0x16637f['options'][_0x16fe('0x1b')]||null:null,'limit':_0x16637f['options']?_0x16637f[_0x16fe('0x18')][_0x16fe('0x1c')]||null:null,'include':_0x16637f[_0x16fe('0x18')]?_0x16637f[_0x16fe('0x18')][_0x16fe('0x1d')]?_[_0x16fe('0x1e')](_0x16637f[_0x16fe('0x18')][_0x16fe('0x1d')],function(_0x5a416e){return{'model':db[_0x5a416e[_0x16fe('0x1f')]],'as':_0x5a416e['as'],'attributes':_0x5a416e[_0x16fe('0x1b')],'include':_0x5a416e[_0x16fe('0x1d')]?_[_0x16fe('0x1e')](_0x5a416e[_0x16fe('0x1d')],function(_0x398ab6){return{'model':db[_0x398ab6[_0x16fe('0x1f')]],'as':_0x398ab6['as'],'attributes':_0x398ab6[_0x16fe('0x1b')],'include':_0x398ab6[_0x16fe('0x1d')]?_['map'](_0x398ab6[_0x16fe('0x1d')],function(_0x315c4a){return{'model':db[_0x315c4a[_0x16fe('0x1f')]],'as':_0x315c4a['as'],'attributes':_0x315c4a[_0x16fe('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x16fe('0x20')](function(_0x55821b){logger[_0x16fe('0xb')]('GetVoiceCallReport',_0x16637f);logger[_0x16fe('0x21')](_0x16fe('0x15'),_0x16637f,JSON['stringify'](_0x55821b));_0x5bdfc6(_0x55821b);})['catch'](function(_0x423a77){logger[_0x16fe('0x10')](_0x16fe('0x15'),_0x423a77['message'],_0x16637f);_0x2e2a12(_0xa2db68[_0x16fe('0x10')](0x1f4,_0x423a77[_0x16fe('0x12')]));});});};exports[_0x16fe('0x22')]=function(_0x5a7959){var _0x44b909=this;return new Promise(function(_0x165746,_0x32ec64){return db[_0x16fe('0x16')]['create'](_0x5a7959[_0x16fe('0x23')],{'raw':_0x5a7959['options']?_0x5a7959['options'][_0x16fe('0x19')]===undefined?!![]:![]:!![]})[_0x16fe('0x20')](function(_0x1f27b5){logger['info'](_0x16fe('0x22'),_0x5a7959);logger[_0x16fe('0x21')](_0x16fe('0x22'),_0x5a7959,JSON[_0x16fe('0xe')](_0x1f27b5));_0x165746(_0x1f27b5);})[_0x16fe('0x14')](function(_0x514b13){logger['error']('CreateVoiceCallReport',_0x514b13[_0x16fe('0x12')],_0x5a7959);_0x32ec64(_0x44b909[_0x16fe('0x10')](0x1f4,_0x514b13['message']));});});};exports[_0x16fe('0x24')]=function(_0x838aa1){var _0x1fe429=this;return new Promise(function(_0x385d28,_0x5b59fb){return db[_0x16fe('0x16')]['update'](_0x838aa1[_0x16fe('0x23')],{'raw':_0x838aa1[_0x16fe('0x18')]?_0x838aa1[_0x16fe('0x18')][_0x16fe('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x838aa1[_0x16fe('0x18')]?_0x838aa1[_0x16fe('0x18')]['where']||null:null,'attributes':_0x838aa1['options']?_0x838aa1['options'][_0x16fe('0x1b')]||null:null,'limit':_0x838aa1[_0x16fe('0x18')]?_0x838aa1[_0x16fe('0x18')][_0x16fe('0x1c')]||null:null})[_0x16fe('0x20')](function(_0x5e20b7){logger[_0x16fe('0xb')](_0x16fe('0x24'),_0x838aa1);logger[_0x16fe('0x21')](_0x16fe('0x24'),_0x838aa1,JSON[_0x16fe('0xe')](_0x5e20b7));_0x385d28(_0x5e20b7);})['catch'](function(_0x24dee9){logger[_0x16fe('0x10')](_0x16fe('0x24'),_0x24dee9[_0x16fe('0x12')],_0x838aa1);_0x5b59fb(_0x1fe429['error'](0x1f4,_0x24dee9[_0x16fe('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index c158d70..42e7a1c 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 _0x2af3=['isAuthenticated','show','create','put','delete','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceChanSpy.controller','get','index','/:id'];(function(_0x53dcf8,_0x126104){var _0x307750=function(_0x10e4cd){while(--_0x10e4cd){_0x53dcf8['push'](_0x53dcf8['shift']());}};_0x307750(++_0x126104);}(_0x2af3,0x1a4));var _0x32af=function(_0x3c1304,_0x219ae5){_0x3c1304=_0x3c1304-0x0;var _0x11b071=_0x2af3[_0x3c1304];return _0x11b071;};'use strict';var multer=require('multer');var util=require(_0x32af('0x0'));var path=require(_0x32af('0x1'));var timeout=require(_0x32af('0x2'));var express=require(_0x32af('0x3'));var router=express[_0x32af('0x4')]();var fs_extra=require(_0x32af('0x5'));var auth=require(_0x32af('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x32af('0x7'));var controller=require(_0x32af('0x8'));router[_0x32af('0x9')]('/',auth['isAuthenticated'](),controller[_0x32af('0xa')]);router[_0x32af('0x9')](_0x32af('0xb'),auth[_0x32af('0xc')](),controller[_0x32af('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x32af('0xe')]);router[_0x32af('0xf')](_0x32af('0xb'),auth[_0x32af('0xc')](),controller['update']);router[_0x32af('0x10')](_0x32af('0xb'),auth[_0x32af('0xc')](),controller['destroy']);module[_0x32af('0x11')]=router; \ No newline at end of file +var _0xa760=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceChanSpy.controller','isAuthenticated','get','show','post','create','put','/:id'];(function(_0x15318c,_0x2e50e4){var _0x10d3ce=function(_0x2fecdd){while(--_0x2fecdd){_0x15318c['push'](_0x15318c['shift']());}};_0x10d3ce(++_0x2e50e4);}(_0xa760,0x15a));var _0x0a76=function(_0x33e55a,_0x3d5690){_0x33e55a=_0x33e55a-0x0;var _0x542283=_0xa760[_0x33e55a];return _0x542283;};'use strict';var multer=require(_0x0a76('0x0'));var util=require(_0x0a76('0x1'));var path=require(_0x0a76('0x2'));var timeout=require(_0x0a76('0x3'));var express=require(_0x0a76('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x0a76('0x5'));var interaction=require(_0x0a76('0x6'));var config=require('../../config/environment');var controller=require(_0x0a76('0x7'));router['get']('/',auth[_0x0a76('0x8')](),controller['index']);router[_0x0a76('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x0a76('0xa')]);router[_0x0a76('0xb')]('/',auth[_0x0a76('0x8')](),controller[_0x0a76('0xc')]);router[_0x0a76('0xd')](_0x0a76('0xe'),auth['isAuthenticated'](),controller[_0x0a76('0xf')]);router[_0x0a76('0x10')](_0x0a76('0xe'),auth[_0x0a76('0x8')](),controller[_0x0a76('0x11')]);module[_0x0a76('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 6627db8..4b2f02c 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 _0xe073=['name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING'];(function(_0x184d9d,_0x22e990){var _0x31e263=function(_0x244ac3){while(--_0x244ac3){_0x184d9d['push'](_0x184d9d['shift']());}};_0x31e263(++_0x22e990);}(_0xe073,0x13d));var _0x3e07=function(_0x2631cb,_0x4f5593){_0x2631cb=_0x2631cb-0x0;var _0x13fad3=_0xe073[_0x2631cb];return _0x13fad3;};'use strict';var Sequelize=require(_0x3e07('0x0'));module[_0x3e07('0x1')]={'name':{'type':Sequelize[_0x3e07('0x2')]},'prefix':{'type':Sequelize['STRING'],'unique':_0x3e07('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x246b0d){this[_0x3e07('0x4')](_0x3e07('0x5'),_0x246b0d?_0x246b0d[_0x3e07('0x6')](''):[]);},'get':function(){return this[_0x3e07('0x7')](_0x3e07('0x5'))?this[_0x3e07('0x7')](_0x3e07('0x5'))[_0x3e07('0x8')](''):[];}},'auth':{'type':Sequelize[_0x3e07('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0x3e07('0x2')]},'record':{'type':Sequelize[_0x3e07('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x3e07('0x2')]}}; \ No newline at end of file +var _0xe7ba=['exports','STRING','name','setDataValue','options','join','getDataValue','split','BOOLEAN','sequelize'];(function(_0x136025,_0x1b98dd){var _0x2e6137=function(_0x4a6e2c){while(--_0x4a6e2c){_0x136025['push'](_0x136025['shift']());}};_0x2e6137(++_0x1b98dd);}(_0xe7ba,0x149));var _0xae7b=function(_0x3d2ad1,_0x209faf){_0x3d2ad1=_0x3d2ad1-0x0;var _0x4536a0=_0xe7ba[_0x3d2ad1];return _0x4536a0;};'use strict';var Sequelize=require(_0xae7b('0x0'));module[_0xae7b('0x1')]={'name':{'type':Sequelize[_0xae7b('0x2')]},'prefix':{'type':Sequelize[_0xae7b('0x2')],'unique':_0xae7b('0x3'),'allowNull':![]},'options':{'type':Sequelize[_0xae7b('0x2')],'set':function(_0x1d62f6){this[_0xae7b('0x4')](_0xae7b('0x5'),_0x1d62f6?_0x1d62f6[_0xae7b('0x6')](''):[]);},'get':function(){return this[_0xae7b('0x7')](_0xae7b('0x5'))?this[_0xae7b('0x7')]('options')[_0xae7b('0x8')](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0xae7b('0x2')]},'record':{'type':Sequelize[_0xae7b('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xae7b('0x2')]},'description':{'type':Sequelize[_0xae7b('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 9c8086b..6d6e9a8 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 _0x1be1=['bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','ChanSpies','destroy','sendStatus','error','stack','name','send','index','map','VoiceChanSpy','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','type','include','findAll','rows','show','options','find','catch','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','zip-dir','fast-json-patch','moment'];(function(_0x441404,_0x272e8c){var _0x2f31e4=function(_0x2fc03a){while(--_0x2fc03a){_0x441404['push'](_0x441404['shift']());}};_0x2f31e4(++_0x272e8c);}(_0x1be1,0x192));var _0x11be=function(_0x378cf7,_0x480ed0){_0x378cf7=_0x378cf7-0x0;var _0x342460=_0x1be1[_0x378cf7];return _0x342460;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x11be('0x0'));var jsonpatch=require(_0x11be('0x1'));var rp=require('request-promise');var moment=require(_0x11be('0x2'));var BPromise=require(_0x11be('0x3'));var Mustache=require(_0x11be('0x4'));var util=require(_0x11be('0x5'));var path=require('path');var sox=require(_0x11be('0x6'));var csv=require(_0x11be('0x7'));var ejs=require(_0x11be('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11be('0x9'));var squel=require('squel');var crypto=require(_0x11be('0xa'));var jsforce=require(_0x11be('0xb'));var deskjs=require(_0x11be('0xc'));var toCsv=require(_0x11be('0x7'));var querystring=require(_0x11be('0xd'));var Papa=require('papaparse');var Redis=require(_0x11be('0xe'));var authService=require(_0x11be('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x11be('0x10'));var hardwareService=require(_0x11be('0x11'));var logger=require(_0x11be('0x12'))(_0x11be('0x13'));var utils=require('../../config/utils');var config=require(_0x11be('0x14'));var licenseUtil=require(_0x11be('0x15'));var db=require(_0x11be('0x16'))['db'];function respondWithStatusCode(_0x4b36c8,_0x3ff31f){_0x3ff31f=_0x3ff31f||0xcc;return function(_0x2dad05){if(_0x2dad05){return _0x4b36c8['sendStatus'](_0x3ff31f);}return _0x4b36c8[_0x11be('0x17')](_0x3ff31f)['end']();};}function respondWithResult(_0x49228e,_0x569842){_0x569842=_0x569842||0xc8;return function(_0x4b6e7e){if(_0x4b6e7e){return _0x49228e['status'](_0x569842)['json'](_0x4b6e7e);}};}function respondWithFilteredResult(_0x588871,_0x2280e2){return function(_0x52bbef){if(_0x52bbef){var _0x31047c=typeof _0x2280e2[_0x11be('0x18')]===_0x11be('0x19')&&typeof _0x2280e2[_0x11be('0x1a')]==='undefined';var _0x2ed725=_0x52bbef[_0x11be('0x1b')];var _0x56ab61=_0x31047c?0x0:_0x2280e2[_0x11be('0x18')];var _0xc3263c=_0x31047c?_0x52bbef[_0x11be('0x1b')]:_0x2280e2['offset']+_0x2280e2['limit'];var _0x141391;if(_0xc3263c>=_0x2ed725){_0xc3263c=_0x2ed725;_0x141391=0xc8;}else{_0x141391=0xce;}_0x588871[_0x11be('0x17')](_0x141391);return _0x588871[_0x11be('0x1c')](_0x11be('0x1d'),_0x56ab61+'-'+_0xc3263c+'/'+_0x2ed725)['json'](_0x52bbef);}return null;};}function patchUpdates(_0x12a5bd){return function(_0x45136f){try{jsonpatch[_0x11be('0x1e')](_0x45136f,_0x12a5bd,!![]);}catch(_0x452315){return BPromise[_0x11be('0x1f')](_0x452315);}return _0x45136f[_0x11be('0x20')]();};}function saveUpdates(_0xa944ac,_0x17678d){return function(_0x3aea14){if(_0x3aea14){return _0x3aea14[_0x11be('0x21')](_0xa944ac)['then'](function(_0xfe3737){return _0xfe3737;});}return null;};}function removeEntity(_0x46b7c2,_0x2fe43c){return function(_0x5d1690){if(_0x5d1690){return _0x5d1690['destroy']()[_0x11be('0x22')](function(){var _0x10ce04=_0x5d1690[_0x11be('0x23')]({'plain':!![]});var _0x4cb27f=_0x11be('0x24');return db['UserProfileResource'][_0x11be('0x25')]({'where':{'type':_0x4cb27f,'resourceId':_0x10ce04['id']}})['then'](function(){return _0x5d1690;});})[_0x11be('0x22')](function(){_0x46b7c2[_0x11be('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x48029b,_0x28b3a0){return function(_0x1d3b5c){if(!_0x1d3b5c){_0x48029b[_0x11be('0x26')](0x194);}return _0x1d3b5c;};}function handleError(_0x30427b,_0x17c67f){_0x17c67f=_0x17c67f||0x1f4;return function(_0xf5a6ac){logger[_0x11be('0x27')](_0xf5a6ac[_0x11be('0x28')]);if(_0xf5a6ac['name']){delete _0xf5a6ac[_0x11be('0x29')];}_0x30427b['status'](_0x17c67f)[_0x11be('0x2a')](_0xf5a6ac);};}exports[_0x11be('0x2b')]=function(_0x510476,_0x584d4c){var _0x49fd5c={},_0x265fc9={},_0x5e8f9a={'count':0x0,'rows':[]};var _0x66316d=_[_0x11be('0x2c')](db[_0x11be('0x2d')][_0x11be('0x2e')],function(_0x25e214){return{'name':_0x25e214[_0x11be('0x2f')],'type':_0x25e214['type'][_0x11be('0x30')]};});_0x265fc9[_0x11be('0x31')]=_[_0x11be('0x2c')](_0x66316d,_0x11be('0x29'));_0x265fc9[_0x11be('0x32')]=_[_0x11be('0x33')](_0x510476['query']);_0x265fc9[_0x11be('0x34')]=_[_0x11be('0x35')](_0x265fc9[_0x11be('0x31')],_0x265fc9[_0x11be('0x32')]);_0x49fd5c[_0x11be('0x36')]=_['intersection'](_0x265fc9[_0x11be('0x31')],qs[_0x11be('0x37')](_0x510476[_0x11be('0x32')]['fields']));_0x49fd5c[_0x11be('0x36')]=_0x49fd5c['attributes']['length']?_0x49fd5c['attributes']:_0x265fc9['model'];if(!_0x510476[_0x11be('0x32')][_0x11be('0x38')](_0x11be('0x39'))){_0x49fd5c['limit']=qs[_0x11be('0x1a')](_0x510476[_0x11be('0x32')]['limit']);_0x49fd5c[_0x11be('0x18')]=qs['offset'](_0x510476[_0x11be('0x32')]['offset']);}_0x49fd5c[_0x11be('0x3a')]=qs[_0x11be('0x3b')](_0x510476[_0x11be('0x32')][_0x11be('0x3b')]);_0x49fd5c['where']=qs[_0x11be('0x34')](_[_0x11be('0x3c')](_0x510476[_0x11be('0x32')],_0x265fc9[_0x11be('0x34')]),_0x66316d);if(_0x510476['query'][_0x11be('0x3d')]){_0x49fd5c[_0x11be('0x3e')]=_[_0x11be('0x3f')](_0x49fd5c[_0x11be('0x3e')],{'$or':_[_0x11be('0x2c')](_0x66316d,function(_0x1b1aac){if(_0x1b1aac[_0x11be('0x40')]!=='VIRTUAL'){var _0x2618f5={};_0x2618f5[_0x1b1aac[_0x11be('0x29')]]={'$like':'%'+_0x510476['query'][_0x11be('0x3d')]+'%'};return _0x2618f5;}})});}_0x49fd5c=_[_0x11be('0x3f')]({},_0x49fd5c,_0x510476['options']);var _0x30b67a={'where':_0x49fd5c['where']};return db[_0x11be('0x2d')]['count'](_0x30b67a)[_0x11be('0x22')](function(_0x30be21){_0x5e8f9a['count']=_0x30be21;if(_0x510476[_0x11be('0x32')]['includeAll']){_0x49fd5c[_0x11be('0x41')]=[{'all':!![]}];}return db[_0x11be('0x2d')][_0x11be('0x42')](_0x49fd5c);})[_0x11be('0x22')](function(_0x2b847a){_0x5e8f9a[_0x11be('0x43')]=_0x2b847a;return _0x5e8f9a;})[_0x11be('0x22')](respondWithFilteredResult(_0x584d4c,_0x49fd5c))['catch'](handleError(_0x584d4c,null));};exports[_0x11be('0x44')]=function(_0x18cddf,_0x9610a1){var _0x317e2d={'raw':![],'where':{'id':_0x18cddf['params']['id']}},_0x589ac4={};_0x589ac4['model']=_[_0x11be('0x33')](db['VoiceChanSpy'][_0x11be('0x2e')]);_0x589ac4['query']=_[_0x11be('0x33')](_0x18cddf[_0x11be('0x32')]);_0x589ac4[_0x11be('0x34')]=_[_0x11be('0x35')](_0x589ac4[_0x11be('0x31')],_0x589ac4[_0x11be('0x32')]);_0x317e2d[_0x11be('0x36')]=_['intersection'](_0x589ac4[_0x11be('0x31')],qs['fields'](_0x18cddf[_0x11be('0x32')][_0x11be('0x37')]));_0x317e2d[_0x11be('0x36')]=_0x317e2d['attributes']['length']?_0x317e2d['attributes']:_0x589ac4[_0x11be('0x31')];if(_0x18cddf[_0x11be('0x32')]['includeAll']){_0x317e2d['include']=[{'all':!![]}];}_0x317e2d=_['merge']({},_0x317e2d,_0x18cddf[_0x11be('0x45')]);return db[_0x11be('0x2d')][_0x11be('0x46')](_0x317e2d)[_0x11be('0x22')](handleEntityNotFound(_0x9610a1,null))[_0x11be('0x22')](respondWithResult(_0x9610a1,null))[_0x11be('0x47')](handleError(_0x9610a1,null));};exports[_0x11be('0x48')]=function(_0x3f2070,_0x2ce110){return db[_0x11be('0x2d')][_0x11be('0x48')](_0x3f2070['body'],{})[_0x11be('0x22')](function(_0x29f82f){var _0x534ee7=_0x3f2070['user']['get']({'plain':!![]});if(!_0x534ee7)throw new Error(_0x11be('0x49'));if(_0x534ee7['role']===_0x11be('0x4a')){var _0x1c1626=_0x29f82f[_0x11be('0x23')]({'plain':!![]});var _0x1fb48d=_0x11be('0x24');return db[_0x11be('0x4b')][_0x11be('0x46')]({'where':{'name':_0x1fb48d,'userProfileId':_0x534ee7[_0x11be('0x4c')]},'raw':!![]})[_0x11be('0x22')](function(_0x4c873a){if(_0x4c873a&&_0x4c873a[_0x11be('0x4d')]===0x0){return db['UserProfileResource'][_0x11be('0x48')]({'name':_0x1c1626[_0x11be('0x29')],'resourceId':_0x1c1626['id'],'type':_0x4c873a['name'],'sectionId':_0x4c873a['id']},{})[_0x11be('0x22')](function(){return _0x29f82f;});}else{return _0x29f82f;}})[_0x11be('0x47')](function(_0x4c0e37){logger[_0x11be('0x27')](_0x11be('0x4e'),_0x4c0e37);throw _0x4c0e37;});}return _0x29f82f;})['then'](respondWithResult(_0x2ce110,0xc9))['catch'](handleError(_0x2ce110,null));};exports[_0x11be('0x21')]=function(_0x2886ac,_0x50eeab){if(_0x2886ac['body']['id']){delete _0x2886ac[_0x11be('0x4f')]['id'];}return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x2886ac['params']['id']}})['then'](handleEntityNotFound(_0x50eeab,null))['then'](saveUpdates(_0x2886ac[_0x11be('0x4f')],null))[_0x11be('0x22')](respondWithResult(_0x50eeab,null))[_0x11be('0x47')](handleError(_0x50eeab,null));};exports['destroy']=function(_0x4db963,_0x33409c){return db[_0x11be('0x2d')][_0x11be('0x46')]({'where':{'id':_0x4db963[_0x11be('0x50')]['id']}})['then'](handleEntityNotFound(_0x33409c,null))[_0x11be('0x22')](removeEntity(_0x33409c,null))['catch'](handleError(_0x33409c,null));}; \ No newline at end of file +var _0x757f=['crypto','to-csv','querystring','papaparse','ioredis','../../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','undefined','count','set','reject','save','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','VoiceChanSpy','include','findAll','rows','catch','show','filters','includeAll','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChanSpies','find','autoAssociation','error','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel'];(function(_0x2b6602,_0x6c0102){var _0x4d9f52=function(_0x390e5e){while(--_0x390e5e){_0x2b6602['push'](_0x2b6602['shift']());}};_0x4d9f52(++_0x6c0102);}(_0x757f,0xee));var _0xf757=function(_0x1ac2d8,_0xe1aa59){_0x1ac2d8=_0x1ac2d8-0x0;var _0x2744af=_0x757f[_0x1ac2d8];return _0x2744af;};'use strict';var emlformat=require(_0xf757('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf757('0x1'));var jsonpatch=require(_0xf757('0x2'));var rp=require(_0xf757('0x3'));var moment=require(_0xf757('0x4'));var BPromise=require(_0xf757('0x5'));var Mustache=require(_0xf757('0x6'));var util=require(_0xf757('0x7'));var path=require(_0xf757('0x8'));var sox=require(_0xf757('0x9'));var csv=require('to-csv');var ejs=require(_0xf757('0xa'));var fs=require('fs');var fs_extra=require(_0xf757('0xb'));var _=require(_0xf757('0xc'));var squel=require(_0xf757('0xd'));var crypto=require(_0xf757('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xf757('0xf'));var querystring=require(_0xf757('0x10'));var Papa=require(_0xf757('0x11'));var Redis=require(_0xf757('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xf757('0x13'));var as=require(_0xf757('0x14'));var hardwareService=require(_0xf757('0x15'));var logger=require(_0xf757('0x16'))(_0xf757('0x17'));var utils=require(_0xf757('0x18'));var config=require(_0xf757('0x19'));var licenseUtil=require(_0xf757('0x1a'));var db=require(_0xf757('0x1b'))['db'];function respondWithStatusCode(_0x3b7033,_0xc839ec){_0xc839ec=_0xc839ec||0xcc;return function(_0x20b497){if(_0x20b497){return _0x3b7033[_0xf757('0x1c')](_0xc839ec);}return _0x3b7033[_0xf757('0x1d')](_0xc839ec)[_0xf757('0x1e')]();};}function respondWithResult(_0x22a2d9,_0x6dd606){_0x6dd606=_0x6dd606||0xc8;return function(_0x3fb479){if(_0x3fb479){return _0x22a2d9['status'](_0x6dd606)[_0xf757('0x1f')](_0x3fb479);}};}function respondWithFilteredResult(_0x12fb35,_0x5c297e){return function(_0x1ad422){if(_0x1ad422){var _0x2b3540=typeof _0x5c297e[_0xf757('0x20')]==='undefined'&&typeof _0x5c297e[_0xf757('0x21')]===_0xf757('0x22');var _0x2f3d50=_0x1ad422[_0xf757('0x23')];var _0x54af52=_0x2b3540?0x0:_0x5c297e[_0xf757('0x20')];var _0x4124a0=_0x2b3540?_0x1ad422[_0xf757('0x23')]:_0x5c297e[_0xf757('0x20')]+_0x5c297e[_0xf757('0x21')];var _0x4d6580;if(_0x4124a0>=_0x2f3d50){_0x4124a0=_0x2f3d50;_0x4d6580=0xc8;}else{_0x4d6580=0xce;}_0x12fb35['status'](_0x4d6580);return _0x12fb35[_0xf757('0x24')]('Content-Range',_0x54af52+'-'+_0x4124a0+'/'+_0x2f3d50)['json'](_0x1ad422);}return null;};}function patchUpdates(_0x323bff){return function(_0x366c60){try{jsonpatch['apply'](_0x366c60,_0x323bff,!![]);}catch(_0x3c0bc8){return BPromise[_0xf757('0x25')](_0x3c0bc8);}return _0x366c60[_0xf757('0x26')]();};}function saveUpdates(_0x383bb2,_0x47db84){return function(_0x495bad){if(_0x495bad){return _0x495bad[_0xf757('0x27')](_0x383bb2)[_0xf757('0x28')](function(_0x1e347f){return _0x1e347f;});}return null;};}function removeEntity(_0x180005,_0x3d38dd){return function(_0x12ee1d){if(_0x12ee1d){return _0x12ee1d[_0xf757('0x29')]()[_0xf757('0x28')](function(){var _0x355d70=_0x12ee1d[_0xf757('0x2a')]({'plain':!![]});var _0x4d9012='ChanSpies';return db[_0xf757('0x2b')][_0xf757('0x29')]({'where':{'type':_0x4d9012,'resourceId':_0x355d70['id']}})[_0xf757('0x28')](function(){return _0x12ee1d;});})[_0xf757('0x28')](function(){_0x180005[_0xf757('0x1d')](0xcc)[_0xf757('0x1e')]();});}};}function handleEntityNotFound(_0x155a13,_0x180882){return function(_0x58ac7a){if(!_0x58ac7a){_0x155a13['sendStatus'](0x194);}return _0x58ac7a;};}function handleError(_0x1b61bf,_0x524397){_0x524397=_0x524397||0x1f4;return function(_0x1fa192){logger['error'](_0x1fa192[_0xf757('0x2c')]);if(_0x1fa192[_0xf757('0x2d')]){delete _0x1fa192['name'];}_0x1b61bf[_0xf757('0x1d')](_0x524397)[_0xf757('0x2e')](_0x1fa192);};}exports[_0xf757('0x2f')]=function(_0x3ad266,_0x542b16){var _0x216832={},_0x4f490d={},_0x356d13={'count':0x0,'rows':[]};var _0x5643e6=_[_0xf757('0x30')](db['VoiceChanSpy'][_0xf757('0x31')],function(_0x2077d0){return{'name':_0x2077d0['fieldName'],'type':_0x2077d0[_0xf757('0x32')]['key']};});_0x4f490d[_0xf757('0x33')]=_['map'](_0x5643e6,_0xf757('0x2d'));_0x4f490d[_0xf757('0x34')]=_[_0xf757('0x35')](_0x3ad266[_0xf757('0x34')]);_0x4f490d['filters']=_[_0xf757('0x36')](_0x4f490d[_0xf757('0x33')],_0x4f490d[_0xf757('0x34')]);_0x216832[_0xf757('0x37')]=_[_0xf757('0x36')](_0x4f490d[_0xf757('0x33')],qs[_0xf757('0x38')](_0x3ad266[_0xf757('0x34')][_0xf757('0x38')]));_0x216832['attributes']=_0x216832[_0xf757('0x37')][_0xf757('0x39')]?_0x216832[_0xf757('0x37')]:_0x4f490d[_0xf757('0x33')];if(!_0x3ad266[_0xf757('0x34')][_0xf757('0x3a')](_0xf757('0x3b'))){_0x216832[_0xf757('0x21')]=qs[_0xf757('0x21')](_0x3ad266[_0xf757('0x34')]['limit']);_0x216832['offset']=qs['offset'](_0x3ad266['query'][_0xf757('0x20')]);}_0x216832[_0xf757('0x3c')]=qs[_0xf757('0x3d')](_0x3ad266[_0xf757('0x34')][_0xf757('0x3d')]);_0x216832['where']=qs['filters'](_[_0xf757('0x3e')](_0x3ad266[_0xf757('0x34')],_0x4f490d['filters']),_0x5643e6);if(_0x3ad266[_0xf757('0x34')][_0xf757('0x3f')]){_0x216832['where']=_[_0xf757('0x40')](_0x216832[_0xf757('0x41')],{'$or':_[_0xf757('0x30')](_0x5643e6,function(_0x14796c){if(_0x14796c['type']!==_0xf757('0x42')){var _0x9f3609={};_0x9f3609[_0x14796c[_0xf757('0x2d')]]={'$like':'%'+_0x3ad266[_0xf757('0x34')][_0xf757('0x3f')]+'%'};return _0x9f3609;}})});}_0x216832=_['merge']({},_0x216832,_0x3ad266['options']);var _0x3bcd45={'where':_0x216832[_0xf757('0x41')]};return db[_0xf757('0x43')][_0xf757('0x23')](_0x3bcd45)[_0xf757('0x28')](function(_0x544659){_0x356d13['count']=_0x544659;if(_0x3ad266[_0xf757('0x34')]['includeAll']){_0x216832[_0xf757('0x44')]=[{'all':!![]}];}return db[_0xf757('0x43')][_0xf757('0x45')](_0x216832);})['then'](function(_0x3f4e63){_0x356d13[_0xf757('0x46')]=_0x3f4e63;return _0x356d13;})['then'](respondWithFilteredResult(_0x542b16,_0x216832))[_0xf757('0x47')](handleError(_0x542b16,null));};exports[_0xf757('0x48')]=function(_0x3e7efe,_0xba2238){var _0xfd8913={'raw':![],'where':{'id':_0x3e7efe['params']['id']}},_0x1a021f={};_0x1a021f[_0xf757('0x33')]=_['keys'](db[_0xf757('0x43')][_0xf757('0x31')]);_0x1a021f[_0xf757('0x34')]=_['keys'](_0x3e7efe[_0xf757('0x34')]);_0x1a021f[_0xf757('0x49')]=_['intersection'](_0x1a021f[_0xf757('0x33')],_0x1a021f[_0xf757('0x34')]);_0xfd8913[_0xf757('0x37')]=_[_0xf757('0x36')](_0x1a021f['model'],qs[_0xf757('0x38')](_0x3e7efe['query'][_0xf757('0x38')]));_0xfd8913[_0xf757('0x37')]=_0xfd8913[_0xf757('0x37')][_0xf757('0x39')]?_0xfd8913[_0xf757('0x37')]:_0x1a021f[_0xf757('0x33')];if(_0x3e7efe['query'][_0xf757('0x4a')]){_0xfd8913[_0xf757('0x44')]=[{'all':!![]}];}_0xfd8913=_['merge']({},_0xfd8913,_0x3e7efe['options']);return db[_0xf757('0x43')]['find'](_0xfd8913)[_0xf757('0x28')](handleEntityNotFound(_0xba2238,null))[_0xf757('0x28')](respondWithResult(_0xba2238,null))[_0xf757('0x47')](handleError(_0xba2238,null));};exports[_0xf757('0x4b')]=function(_0x6e4d0b,_0x27ac4d){return db[_0xf757('0x43')][_0xf757('0x4b')](_0x6e4d0b[_0xf757('0x4c')],{})[_0xf757('0x28')](function(_0x2905c2){var _0x1a8b0b=_0x6e4d0b['user'][_0xf757('0x2a')]({'plain':!![]});if(!_0x1a8b0b)throw new Error(_0xf757('0x4d'));if(_0x1a8b0b[_0xf757('0x4e')]==='user'){var _0x5d9f03=_0x2905c2[_0xf757('0x2a')]({'plain':!![]});var _0x6015d4=_0xf757('0x4f');return db['UserProfileSection'][_0xf757('0x50')]({'where':{'name':_0x6015d4,'userProfileId':_0x1a8b0b['userProfileId']},'raw':!![]})[_0xf757('0x28')](function(_0x141d02){if(_0x141d02&&_0x141d02[_0xf757('0x51')]===0x0){return db[_0xf757('0x2b')][_0xf757('0x4b')]({'name':_0x5d9f03['name'],'resourceId':_0x5d9f03['id'],'type':_0x141d02['name'],'sectionId':_0x141d02['id']},{})[_0xf757('0x28')](function(){return _0x2905c2;});}else{return _0x2905c2;}})[_0xf757('0x47')](function(_0x5a95fe){logger[_0xf757('0x52')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5a95fe);throw _0x5a95fe;});}return _0x2905c2;})[_0xf757('0x28')](respondWithResult(_0x27ac4d,0xc9))[_0xf757('0x47')](handleError(_0x27ac4d,null));};exports[_0xf757('0x27')]=function(_0x53c26a,_0x174ac5){if(_0x53c26a[_0xf757('0x4c')]['id']){delete _0x53c26a['body']['id'];}return db[_0xf757('0x43')]['find']({'where':{'id':_0x53c26a[_0xf757('0x53')]['id']}})['then'](handleEntityNotFound(_0x174ac5,null))[_0xf757('0x28')](saveUpdates(_0x53c26a[_0xf757('0x4c')],null))[_0xf757('0x28')](respondWithResult(_0x174ac5,null))['catch'](handleError(_0x174ac5,null));};exports[_0xf757('0x29')]=function(_0x41692f,_0xa59237){return db[_0xf757('0x43')][_0xf757('0x50')]({'where':{'id':_0x41692f['params']['id']}})[_0xf757('0x28')](handleEntityNotFound(_0xa59237,null))[_0xf757('0x28')](removeEntity(_0xa59237,null))['catch'](handleError(_0xa59237,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index fb5db75..f118732 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 _0xfeb0=['password','ChanSpy','SIP/%s,%s','name','options','join','StopMixMonitor','concat','internal','User','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','length','bulkCreate','VoiceExtension','destroy','lodash','util','bluebird','from-sip','format','system','push','Set','CDR(type)=%s','chanspy','record','merge','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate'];(function(_0x1b21fa,_0x196834){var _0x2f0758=function(_0x7ec6dd){while(--_0x7ec6dd){_0x1b21fa['push'](_0x1b21fa['shift']());}};_0x2f0758(++_0x196834);}(_0xfeb0,0x191));var _0x0feb=function(_0xc3aae7,_0x3bfa91){_0xc3aae7=_0xc3aae7-0x0;var _0x1f365a=_0xfeb0[_0xc3aae7];return _0x1f365a;};'use strict';var _=require(_0x0feb('0x0'));var util=require(_0x0feb('0x1'));var BPromise=require(_0x0feb('0x2'));var attributes=require('./voiceChanSpy.attributes');var getUserApplications=function(_0x1a57f5,_0x4a1e47,_0x3df7d9){var _0x2e9153=0x1;var _0x20d33f=[];var _0x200889={'context':_0x4a1e47['context']||_0x0feb('0x3'),'exten':util[_0x0feb('0x4')]('%s%s',_0x1a57f5['prefix'],_0x3df7d9),'type':_0x0feb('0x5'),'isApp':![],'ChanSpyId':_0x1a57f5['id'],'UserId':_0x4a1e47['id']};_0x20d33f[_0x0feb('0x6')](_['merge']({'app':_0x0feb('0x7'),'appdata':util['format'](_0x0feb('0x8'),_0x0feb('0x9')),'priority':_0x2e9153++},_0x200889));if(_0x1a57f5[_0x0feb('0xa')]){_0x20d33f[_0x0feb('0x6')](_[_0x0feb('0xb')]({'app':_0x0feb('0xc'),'appdata':util[_0x0feb('0x4')](_0x0feb('0xd'),_0x1a57f5[_0x0feb('0xe')]),'priority':_0x2e9153++},_0x200889));}if(_0x1a57f5[_0x0feb('0xf')]){_0x20d33f[_0x0feb('0x6')](_[_0x0feb('0xb')]({'app':_0x0feb('0x10'),'appdata':_0x1a57f5[_0x0feb('0x11')],'priority':_0x2e9153++},_0x200889));}_0x20d33f[_0x0feb('0x6')](_['merge']({'app':_0x0feb('0x12'),'appdata':util[_0x0feb('0x4')](_0x0feb('0x13'),_0x4a1e47[_0x0feb('0x14')],_0x1a57f5[_0x0feb('0x15')]?_0x1a57f5['options'][_0x0feb('0x16')](''):''),'priority':_0x2e9153++},_0x200889));if(_0x1a57f5['record']){_0x20d33f['push'](_[_0x0feb('0xb')]({'app':_0x0feb('0x17'),'priority':_0x2e9153++},_0x200889));}return _0x20d33f;};var getChanSpyApplications=function(_0x3646b7,_0x5c6634){var _0x210c16=[];for(var _0x41323b=0x0,_0x388052=0x1;_0x41323b<_0x5c6634['length'];_0x41323b++,_0x388052=0x1){_0x210c16=_0x210c16[_0x0feb('0x18')](getUserApplications(_0x3646b7,_0x5c6634[_0x41323b],_0x5c6634[_0x41323b][_0x0feb('0x19')]));if(_0x5c6634[_0x41323b][_0x0feb('0x19')]!=_0x5c6634[_0x41323b]['name']){_0x210c16=_0x210c16['concat'](getUserApplications(_0x3646b7,_0x5c6634[_0x41323b],_0x5c6634[_0x41323b][_0x0feb('0x14')]));}}return _0x210c16;};var getChanSpyPromise=function(_0x5dae10,_0x256454){return new BPromise(function(_0x5de6e8,_0x36ff1d){return _0x5dae10[_0x0feb('0x1a')]['findAll']({'attributes':['id',_0x0feb('0x14'),'internal'],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x0feb('0x1b')](function(_0xe88fd0){if(_0xe88fd0){return _0x5de6e8(getChanSpyApplications(_0x256454,_0xe88fd0));}return _0x5de6e8([]);})[_0x0feb('0x1c')](function(_0x148ce8){_0x36ff1d(_0x148ce8);});});};module[_0x0feb('0x1d')]=function(_0x13a501,_0x5f425c){var _0x4f330f=_0x13a501[_0x0feb('0x1e')];return _0x13a501[_0x0feb('0x1f')](_0x0feb('0x20'),attributes,{'tableName':_0x0feb('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x244c4f,_0x53c5ab,_0x5de78a){return getChanSpyPromise(_0x4f330f,_0x244c4f)[_0x0feb('0x1b')](function(_0x162731){if(_0x162731&&_0x162731[_0x0feb('0x22')]){return _0x4f330f['VoiceExtension'][_0x0feb('0x23')](_0x162731);}})[_0x0feb('0x1b')](function(){_0x5de78a();})['catch'](function(_0x6b7956){_0x5de78a(_0x6b7956);});},'afterUpdate':function(_0x7012a8,_0x4cfb20,_0x262285){return _0x4f330f[_0x0feb('0x24')][_0x0feb('0x25')]({'where':{'ChanSpyId':_0x7012a8['id']}})[_0x0feb('0x1b')](function(){return getChanSpyPromise(_0x4f330f,_0x7012a8);})[_0x0feb('0x1b')](function(_0x166e1f){if(_0x166e1f&&_0x166e1f[_0x0feb('0x22')]){return _0x4f330f[_0x0feb('0x24')]['bulkCreate'](_0x166e1f);}})[_0x0feb('0x1b')](function(){_0x262285();})['catch'](function(_0xa5d473){_0x262285(_0xa5d473);});},'afterDestroy':function(_0x21dbcc,_0x5ebd5c,_0x2dc3f7){return _0x4f330f['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x21dbcc['id']}})[_0x0feb('0x1b')](function(){_0x2dc3f7();})[_0x0feb('0x1c')](function(_0xf48ca2){_0x2dc3f7(_0xf48ca2);});}}});}; \ No newline at end of file +var _0xf176=['format','%s%s','prefix','push','merge','Set','CDR(type)=%s','chanspy','record','MixMonitor','recordingFormat','auth','Authenticate','password','ChanSpy','name','options','join','StopMixMonitor','length','concat','internal','findAll','agent','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','context','from-sip'];(function(_0x4ef76f,_0x4758eb){var _0x40a80b=function(_0x2b544b){while(--_0x2b544b){_0x4ef76f['push'](_0x4ef76f['shift']());}};_0x40a80b(++_0x4758eb);}(_0xf176,0x13a));var _0x6f17=function(_0x22a5ec,_0xbc0e29){_0x22a5ec=_0x22a5ec-0x0;var _0x52a2c6=_0xf176[_0x22a5ec];return _0x52a2c6;};'use strict';var _=require(_0x6f17('0x0'));var util=require(_0x6f17('0x1'));var BPromise=require(_0x6f17('0x2'));var attributes=require(_0x6f17('0x3'));var getUserApplications=function(_0xc7aa85,_0x225e95,_0x157de8){var _0xc388c8=0x1;var _0x40fa45=[];var _0x44a3a9={'context':_0x225e95[_0x6f17('0x4')]||_0x6f17('0x5'),'exten':util[_0x6f17('0x6')](_0x6f17('0x7'),_0xc7aa85[_0x6f17('0x8')],_0x157de8),'type':'system','isApp':![],'ChanSpyId':_0xc7aa85['id'],'UserId':_0x225e95['id']};_0x40fa45[_0x6f17('0x9')](_[_0x6f17('0xa')]({'app':_0x6f17('0xb'),'appdata':util[_0x6f17('0x6')](_0x6f17('0xc'),_0x6f17('0xd')),'priority':_0xc388c8++},_0x44a3a9));if(_0xc7aa85[_0x6f17('0xe')]){_0x40fa45[_0x6f17('0x9')](_[_0x6f17('0xa')]({'app':_0x6f17('0xf'),'appdata':util[_0x6f17('0x6')]('${UNIQUEID}.%s,a',_0xc7aa85[_0x6f17('0x10')]),'priority':_0xc388c8++},_0x44a3a9));}if(_0xc7aa85[_0x6f17('0x11')]){_0x40fa45['push'](_[_0x6f17('0xa')]({'app':_0x6f17('0x12'),'appdata':_0xc7aa85[_0x6f17('0x13')],'priority':_0xc388c8++},_0x44a3a9));}_0x40fa45[_0x6f17('0x9')](_[_0x6f17('0xa')]({'app':_0x6f17('0x14'),'appdata':util['format']('SIP/%s,%s',_0x225e95[_0x6f17('0x15')],_0xc7aa85[_0x6f17('0x16')]?_0xc7aa85[_0x6f17('0x16')][_0x6f17('0x17')](''):''),'priority':_0xc388c8++},_0x44a3a9));if(_0xc7aa85[_0x6f17('0xe')]){_0x40fa45[_0x6f17('0x9')](_[_0x6f17('0xa')]({'app':_0x6f17('0x18'),'priority':_0xc388c8++},_0x44a3a9));}return _0x40fa45;};var getChanSpyApplications=function(_0x312bce,_0x341daf){var _0x18f042=[];for(var _0x3a93fa=0x0,_0xa1dd44=0x1;_0x3a93fa<_0x341daf[_0x6f17('0x19')];_0x3a93fa++,_0xa1dd44=0x1){_0x18f042=_0x18f042[_0x6f17('0x1a')](getUserApplications(_0x312bce,_0x341daf[_0x3a93fa],_0x341daf[_0x3a93fa][_0x6f17('0x1b')]));if(_0x341daf[_0x3a93fa]['internal']!=_0x341daf[_0x3a93fa][_0x6f17('0x15')]){_0x18f042=_0x18f042[_0x6f17('0x1a')](getUserApplications(_0x312bce,_0x341daf[_0x3a93fa],_0x341daf[_0x3a93fa][_0x6f17('0x15')]));}}return _0x18f042;};var getChanSpyPromise=function(_0x1b195a,_0x53e14d){return new BPromise(function(_0x35e359,_0x5b8858){return _0x1b195a['User'][_0x6f17('0x1c')]({'attributes':['id',_0x6f17('0x15'),_0x6f17('0x1b')],'where':{'role':_0x6f17('0x1d'),'chanspy':!![]},'raw':!![]})[_0x6f17('0x1e')](function(_0xf8ac30){if(_0xf8ac30){return _0x35e359(getChanSpyApplications(_0x53e14d,_0xf8ac30));}return _0x35e359([]);})[_0x6f17('0x1f')](function(_0x3d356c){_0x5b8858(_0x3d356c);});});};module[_0x6f17('0x20')]=function(_0x5b942f,_0x4b9c6d){var _0xe29792=_0x5b942f[_0x6f17('0x21')];return _0x5b942f[_0x6f17('0x22')](_0x6f17('0x23'),attributes,{'tableName':_0x6f17('0x24'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x3d5616,_0x8bb112,_0x5d576a){return getChanSpyPromise(_0xe29792,_0x3d5616)[_0x6f17('0x1e')](function(_0x2dab23){if(_0x2dab23&&_0x2dab23[_0x6f17('0x19')]){return _0xe29792[_0x6f17('0x25')][_0x6f17('0x26')](_0x2dab23);}})[_0x6f17('0x1e')](function(){_0x5d576a();})[_0x6f17('0x1f')](function(_0x4b1953){_0x5d576a(_0x4b1953);});},'afterUpdate':function(_0x4fc88f,_0xab874f,_0x24ccf6){return _0xe29792[_0x6f17('0x25')][_0x6f17('0x27')]({'where':{'ChanSpyId':_0x4fc88f['id']}})[_0x6f17('0x1e')](function(){return getChanSpyPromise(_0xe29792,_0x4fc88f);})[_0x6f17('0x1e')](function(_0x2b05f9){if(_0x2b05f9&&_0x2b05f9[_0x6f17('0x19')]){return _0xe29792[_0x6f17('0x25')][_0x6f17('0x26')](_0x2b05f9);}})[_0x6f17('0x1e')](function(){_0x24ccf6();})[_0x6f17('0x1f')](function(_0x6ec8da){_0x24ccf6(_0x6ec8da);});},'afterDestroy':function(_0x24c528,_0x14a142,_0x130a9e){return _0xe29792[_0x6f17('0x25')][_0x6f17('0x27')]({'where':{'ChanSpyId':_0x24c528['id']}})['then'](function(){_0x130a9e();})[_0x6f17('0x1f')](function(_0x5ababa){_0x130a9e(_0x5ababa);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index db33722..b81e45f 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 _0x2f68=['VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug'];(function(_0x17dad1,_0x3e752b){var _0x356aa0=function(_0xe62e61){while(--_0xe62e61){_0x17dad1['push'](_0x17dad1['shift']());}};_0x356aa0(++_0x3e752b);}(_0x2f68,0x9a));var _0x82f6=function(_0x4340a8,_0xb205ec){_0x4340a8=_0x4340a8-0x0;var _0x2ffe76=_0x2f68[_0x4340a8];return _0x2ffe76;};'use strict';var _=require('lodash');var util=require(_0x82f6('0x0'));var moment=require(_0x82f6('0x1'));var BPromise=require(_0x82f6('0x2'));var rs=require(_0x82f6('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x82f6('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x82f6('0x5'))(_0x82f6('0x6'));var config=require('../../config/environment');var jayson=require(_0x82f6('0x7'));var client=jayson[_0x82f6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5a8089,_0x1bc0be,_0x5660bf){return new BPromise(function(_0x5daa3c,_0x864400){return client[_0x82f6('0x9')](_0x5a8089,_0x5660bf)[_0x82f6('0xa')](function(_0x5ee0e5){logger[_0x82f6('0xb')](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');logger[_0x82f6('0xd')](_0x82f6('0xe'),_0x1bc0be,_0x82f6('0xf'),JSON[_0x82f6('0x10')](_0x5ee0e5));if(_0x5ee0e5[_0x82f6('0x11')]){if(_0x5ee0e5[_0x82f6('0x11')]['code']===0x1f4){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5['error'][_0x82f6('0x12')]);return _0x864400(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);return _0x5daa3c(_0x5ee0e5[_0x82f6('0x11')][_0x82f6('0x12')]);}else{logger['info'](_0x82f6('0xc'),_0x1bc0be,'request\x20sent');_0x5daa3c(_0x5ee0e5[_0x82f6('0x13')][_0x82f6('0x12')]);}})[_0x82f6('0x14')](function(_0x1033d3){logger[_0x82f6('0x11')](_0x82f6('0xc'),_0x1bc0be,_0x1033d3);_0x864400(_0x1033d3);});});} \ No newline at end of file +var _0x1152=['ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request','then','info','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','VoiceChanSpy,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x54dc9a,_0xd98dae){var _0x239053=function(_0x3c8419){while(--_0x3c8419){_0x54dc9a['push'](_0x54dc9a['shift']());}};_0x239053(++_0xd98dae);}(_0x1152,0x182));var _0x2115=function(_0x5c6c64,_0x12d4cb){_0x5c6c64=_0x5c6c64-0x0;var _0x172174=_0x1152[_0x5c6c64];return _0x172174;};'use strict';var _=require(_0x2115('0x0'));var util=require(_0x2115('0x1'));var moment=require(_0x2115('0x2'));var BPromise=require(_0x2115('0x3'));var rs=require(_0x2115('0x4'));var fs=require('fs');var Redis=require(_0x2115('0x5'));var db=require(_0x2115('0x6'))['db'];var utils=require(_0x2115('0x7'));var logger=require('../../config/logger')(_0x2115('0x8'));var config=require('../../config/environment');var jayson=require(_0x2115('0x9'));var client=jayson[_0x2115('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x564071,_0x54cdd0,_0x5dbb85){return new BPromise(function(_0x5df6db,_0x158711){return client[_0x2115('0xb')](_0x564071,_0x5dbb85)[_0x2115('0xc')](function(_0x5156f2){logger[_0x2115('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x54cdd0,'request\x20sent');logger[_0x2115('0xe')](_0x2115('0xf'),_0x54cdd0,_0x2115('0x10'),JSON['stringify'](_0x5156f2));if(_0x5156f2[_0x2115('0x11')]){if(_0x5156f2['error'][_0x2115('0x12')]===0x1f4){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x158711(_0x5156f2['error'][_0x2115('0x14')]);}logger['error'](_0x2115('0x13'),_0x54cdd0,_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);return _0x5df6db(_0x5156f2[_0x2115('0x11')][_0x2115('0x14')]);}else{logger[_0x2115('0xd')](_0x2115('0x13'),_0x54cdd0,'request\x20sent');_0x5df6db(_0x5156f2[_0x2115('0x15')][_0x2115('0x14')]);}})[_0x2115('0x16')](function(_0x184c05){logger[_0x2115('0x11')](_0x2115('0x13'),_0x54cdd0,_0x184c05);_0x158711(_0x184c05);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 4f706a4..7968153 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 _0x67fc=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','isAuthenticated','show','post','create','put','update','destroy','exports','multer'];(function(_0x5f2acc,_0x47fcfd){var _0x1ec79c=function(_0xe1d16b){while(--_0xe1d16b){_0x5f2acc['push'](_0x5f2acc['shift']());}};_0x1ec79c(++_0x47fcfd);}(_0x67fc,0x6b));var _0xc67f=function(_0x563d77,_0x305794){_0x563d77=_0x563d77-0x0;var _0x24cfdf=_0x67fc[_0x563d77];return _0x24cfdf;};'use strict';var multer=require(_0xc67f('0x0'));var util=require(_0xc67f('0x1'));var path=require(_0xc67f('0x2'));var timeout=require(_0xc67f('0x3'));var express=require(_0xc67f('0x4'));var router=express['Router']();var fs_extra=require(_0xc67f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xc67f('0x6'));var config=require(_0xc67f('0x7'));var controller=require(_0xc67f('0x8'));router[_0xc67f('0x9')]('/',auth[_0xc67f('0xa')](),controller['index']);router[_0xc67f('0x9')]('/:id',auth[_0xc67f('0xa')](),controller[_0xc67f('0xb')]);router[_0xc67f('0xc')]('/',auth[_0xc67f('0xa')](),controller[_0xc67f('0xd')]);router[_0xc67f('0xe')]('/:id',auth[_0xc67f('0xa')](),controller[_0xc67f('0xf')]);router['delete']('/:id',auth[_0xc67f('0xa')](),controller[_0xc67f('0x10')]);module[_0xc67f('0x11')]=router; \ No newline at end of file +var _0xccba=['express','../../components/interaction/service','../../config/environment','./voiceContext.controller','get','index','isAuthenticated','show','post','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0xbab954,_0x5d80ca){var _0x4697ed=function(_0x2b314f){while(--_0x2b314f){_0xbab954['push'](_0xbab954['shift']());}};_0x4697ed(++_0x5d80ca);}(_0xccba,0x178));var _0xaccb=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0xccba[_0x3227c1];return _0x31fd48;};'use strict';var multer=require(_0xaccb('0x0'));var util=require(_0xaccb('0x1'));var path=require(_0xaccb('0x2'));var timeout=require(_0xaccb('0x3'));var express=require(_0xaccb('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xaccb('0x5'));var config=require(_0xaccb('0x6'));var controller=require(_0xaccb('0x7'));router[_0xaccb('0x8')]('/',auth['isAuthenticated'](),controller[_0xaccb('0x9')]);router['get']('/:id',auth[_0xaccb('0xa')](),controller[_0xaccb('0xb')]);router[_0xaccb('0xc')]('/',auth[_0xaccb('0xa')](),controller['create']);router[_0xaccb('0xd')](_0xaccb('0xe'),auth[_0xaccb('0xa')](),controller[_0xaccb('0xf')]);router[_0xaccb('0x10')]('/:id',auth[_0xaccb('0xa')](),controller[_0xaccb('0x11')]);module[_0xaccb('0x12')]=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index 541ef37..d0ff629 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 _0x1ad9=['name','BOOLEAN','sequelize','STRING'];(function(_0x290781,_0x53d542){var _0x1ef41f=function(_0x2940a5){while(--_0x2940a5){_0x290781['push'](_0x290781['shift']());}};_0x1ef41f(++_0x53d542);}(_0x1ad9,0x18a));var _0x91ad=function(_0x43d11d,_0xccff91){_0x43d11d=_0x43d11d-0x0;var _0x38cd08=_0x1ad9[_0x43d11d];return _0x38cd08;};'use strict';var Sequelize=require(_0x91ad('0x0'));module['exports']={'name':{'type':Sequelize[_0x91ad('0x1')],'unique':_0x91ad('0x2')},'description':{'type':Sequelize[_0x91ad('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x91ad('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xa38f=['STRING','BOOLEAN','sequelize','exports','name'];(function(_0x152a7e,_0x5e30d7){var _0x539c1a=function(_0x46a1d7){while(--_0x46a1d7){_0x152a7e['push'](_0x152a7e['shift']());}};_0x539c1a(++_0x5e30d7);}(_0xa38f,0x70));var _0xfa38=function(_0x583477,_0x42fae3){_0x583477=_0x583477-0x0;var _0x16d1be=_0xa38f[_0x583477];return _0x16d1be;};'use strict';var Sequelize=require(_0xfa38('0x0'));module[_0xfa38('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xfa38('0x2')},'description':{'type':Sequelize[_0xfa38('0x3')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xfa38('0x4')],'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 25635f7..dc47c0d 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 _0x05ae=['utf8','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','jayson/promise','client','http','info','VoiceContext,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','then','destroy','Contexts','UserProfileResource','name','index','map','VoiceContext','rawAttributes','type','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','intersection','create','body','join','root','server/files/templates/context.ejs','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','params','readFileSync'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x05ae,0x6b));var _0xe05a=function(_0x54a92d,_0x2a4edc){_0x54a92d=_0x54a92d-0x0;var _0x37fd93=_0x05ae[_0x54a92d];return _0x37fd93;};'use strict';var emlformat=require(_0xe05a('0x0'));var rimraf=require(_0xe05a('0x1'));var zipdir=require(_0xe05a('0x2'));var jsonpatch=require(_0xe05a('0x3'));var rp=require(_0xe05a('0x4'));var moment=require(_0xe05a('0x5'));var BPromise=require(_0xe05a('0x6'));var Mustache=require(_0xe05a('0x7'));var util=require('util');var path=require(_0xe05a('0x8'));var sox=require(_0xe05a('0x9'));var csv=require(_0xe05a('0xa'));var ejs=require(_0xe05a('0xb'));var fs=require('fs');var fs_extra=require(_0xe05a('0xc'));var _=require(_0xe05a('0xd'));var squel=require(_0xe05a('0xe'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe05a('0xf'));var toCsv=require('to-csv');var querystring=require(_0xe05a('0x10'));var Papa=require(_0xe05a('0x11'));var Redis=require(_0xe05a('0x12'));var authService=require(_0xe05a('0x13'));var qs=require(_0xe05a('0x14'));var as=require(_0xe05a('0x15'));var hardwareService=require(_0xe05a('0x16'));var logger=require(_0xe05a('0x17'))('api');var utils=require(_0xe05a('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xe05a('0x19'));var db=require('../../mysqldb')['db'];var jayson=require(_0xe05a('0x1a'));var client=jayson[_0xe05a('0x1b')][_0xe05a('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x26db28,_0x4b9f87,_0x33b8cd,_0x467901){return new BPromise(function(_0x2f7256,_0x150128){var _0x536c99=_0x467901||client;return _0x536c99['request'](_0x26db28,_0x33b8cd)['then'](function(_0x24d8ba){logger[_0xe05a('0x1d')](_0xe05a('0x1e'),_0x4b9f87,_0xe05a('0x1f'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4b9f87,_0xe05a('0x1f'),JSON[_0xe05a('0x20')](_0x24d8ba));if(_0x24d8ba[_0xe05a('0x21')]){if(_0x24d8ba[_0xe05a('0x21')][_0xe05a('0x22')]===0x1f4){logger[_0xe05a('0x21')](_0xe05a('0x1e'),_0x4b9f87,_0x24d8ba[_0xe05a('0x21')][_0xe05a('0x23')]);return _0x150128(_0x24d8ba['error']['message']);}logger[_0xe05a('0x21')](_0xe05a('0x1e'),_0x4b9f87,_0x24d8ba[_0xe05a('0x21')]['message']);return _0x2f7256(_0x24d8ba[_0xe05a('0x21')][_0xe05a('0x23')]);}else{logger[_0xe05a('0x1d')]('VoiceContext,\x20%s,\x20%s',_0x4b9f87,_0xe05a('0x1f'));_0x2f7256(_0x24d8ba[_0xe05a('0x24')][_0xe05a('0x23')]);}})['catch'](function(_0x2cf002){logger['error'](_0xe05a('0x1e'),_0x4b9f87,_0x2cf002);_0x150128(_0x2cf002);});});}function respondWithStatusCode(_0x2c4356,_0x3bd51d){_0x3bd51d=_0x3bd51d||0xcc;return function(_0x412c77){if(_0x412c77){return _0x2c4356[_0xe05a('0x25')](_0x3bd51d);}return _0x2c4356['status'](_0x3bd51d)[_0xe05a('0x26')]();};}function respondWithResult(_0x459694,_0x3c8763){_0x3c8763=_0x3c8763||0xc8;return function(_0x2cb860){if(_0x2cb860){return _0x459694[_0xe05a('0x27')](_0x3c8763)[_0xe05a('0x28')](_0x2cb860);}};}function respondWithFilteredResult(_0x4f1297,_0x3f10f8){return function(_0x5eb47e){if(_0x5eb47e){var _0x39cbb0=typeof _0x3f10f8[_0xe05a('0x29')]===_0xe05a('0x2a')&&typeof _0x3f10f8[_0xe05a('0x2b')]===_0xe05a('0x2a');var _0x8b3e5e=_0x5eb47e['count'];var _0x44fa1e=_0x39cbb0?0x0:_0x3f10f8[_0xe05a('0x29')];var _0x64173c=_0x39cbb0?_0x5eb47e[_0xe05a('0x2c')]:_0x3f10f8[_0xe05a('0x29')]+_0x3f10f8[_0xe05a('0x2b')];var _0xd43b34;if(_0x64173c>=_0x8b3e5e){_0x64173c=_0x8b3e5e;_0xd43b34=0xc8;}else{_0xd43b34=0xce;}_0x4f1297[_0xe05a('0x27')](_0xd43b34);return _0x4f1297[_0xe05a('0x2d')](_0xe05a('0x2e'),_0x44fa1e+'-'+_0x64173c+'/'+_0x8b3e5e)[_0xe05a('0x28')](_0x5eb47e);}return null;};}function patchUpdates(_0x42776b){return function(_0x543f49){try{jsonpatch['apply'](_0x543f49,_0x42776b,!![]);}catch(_0x1c8de0){return BPromise[_0xe05a('0x2f')](_0x1c8de0);}return _0x543f49[_0xe05a('0x30')]();};}function saveUpdates(_0x75da85,_0x15baf3){return function(_0x13c4a5){if(_0x13c4a5){return _0x13c4a5['update'](_0x75da85)[_0xe05a('0x31')](function(_0x3b53f7){return _0x3b53f7;});}return null;};}function removeEntity(_0x205f27,_0x327545){return function(_0x4c66d4){if(_0x4c66d4){return _0x4c66d4[_0xe05a('0x32')]()[_0xe05a('0x31')](function(){var _0x5b798f=_0x4c66d4['get']({'plain':!![]});var _0xcb30f1=_0xe05a('0x33');return db[_0xe05a('0x34')]['destroy']({'where':{'type':_0xcb30f1,'resourceId':_0x5b798f['id']}})[_0xe05a('0x31')](function(){return _0x4c66d4;});})[_0xe05a('0x31')](function(){_0x205f27[_0xe05a('0x27')](0xcc)[_0xe05a('0x26')]();});}};}function handleEntityNotFound(_0x3217b1,_0x27c8a0){return function(_0x476f21){if(!_0x476f21){_0x3217b1[_0xe05a('0x25')](0x194);}return _0x476f21;};}function handleError(_0x43c6df,_0x52375e){_0x52375e=_0x52375e||0x1f4;return function(_0x528c2d){logger[_0xe05a('0x21')](_0x528c2d['stack']);if(_0x528c2d['name']){delete _0x528c2d[_0xe05a('0x35')];}_0x43c6df[_0xe05a('0x27')](_0x52375e)['send'](_0x528c2d);};}exports[_0xe05a('0x36')]=function(_0x641e04,_0x35c7cf){var _0x4a5c54={},_0x47eebf={},_0x43ecf4={'count':0x0,'rows':[]};var _0x26daa4=_[_0xe05a('0x37')](db[_0xe05a('0x38')][_0xe05a('0x39')],function(_0x1b2d6b){return{'name':_0x1b2d6b['fieldName'],'type':_0x1b2d6b[_0xe05a('0x3a')][_0xe05a('0x3b')]};});_0x47eebf[_0xe05a('0x3c')]=_[_0xe05a('0x37')](_0x26daa4,_0xe05a('0x35'));_0x47eebf[_0xe05a('0x3d')]=_['keys'](_0x641e04[_0xe05a('0x3d')]);_0x47eebf[_0xe05a('0x3e')]=_['intersection'](_0x47eebf[_0xe05a('0x3c')],_0x47eebf[_0xe05a('0x3d')]);_0x4a5c54[_0xe05a('0x3f')]=_['intersection'](_0x47eebf[_0xe05a('0x3c')],qs[_0xe05a('0x40')](_0x641e04[_0xe05a('0x3d')][_0xe05a('0x40')]));_0x4a5c54[_0xe05a('0x3f')]=_0x4a5c54[_0xe05a('0x3f')][_0xe05a('0x41')]?_0x4a5c54[_0xe05a('0x3f')]:_0x47eebf[_0xe05a('0x3c')];if(!_0x641e04[_0xe05a('0x3d')][_0xe05a('0x42')](_0xe05a('0x43'))){_0x4a5c54[_0xe05a('0x2b')]=qs['limit'](_0x641e04['query'][_0xe05a('0x2b')]);_0x4a5c54[_0xe05a('0x29')]=qs[_0xe05a('0x29')](_0x641e04['query'][_0xe05a('0x29')]);}_0x4a5c54[_0xe05a('0x44')]=qs[_0xe05a('0x45')](_0x641e04[_0xe05a('0x3d')][_0xe05a('0x45')]);_0x4a5c54[_0xe05a('0x46')]=qs[_0xe05a('0x3e')](_[_0xe05a('0x47')](_0x641e04[_0xe05a('0x3d')],_0x47eebf['filters']),_0x26daa4);if(_0x641e04[_0xe05a('0x3d')][_0xe05a('0x48')]){_0x4a5c54['where']=_[_0xe05a('0x49')](_0x4a5c54[_0xe05a('0x46')],{'$or':_[_0xe05a('0x37')](_0x26daa4,function(_0x589d9a){if(_0x589d9a[_0xe05a('0x3a')]!==_0xe05a('0x4a')){var _0x8157ec={};_0x8157ec[_0x589d9a[_0xe05a('0x35')]]={'$like':'%'+_0x641e04[_0xe05a('0x3d')][_0xe05a('0x48')]+'%'};return _0x8157ec;}})});}_0x4a5c54=_[_0xe05a('0x49')]({},_0x4a5c54,_0x641e04[_0xe05a('0x4b')]);var _0x5b2f1d={'where':_0x4a5c54[_0xe05a('0x46')]};return db[_0xe05a('0x38')]['count'](_0x5b2f1d)[_0xe05a('0x31')](function(_0x265dda){_0x43ecf4[_0xe05a('0x2c')]=_0x265dda;if(_0x641e04[_0xe05a('0x3d')][_0xe05a('0x4c')]){_0x4a5c54[_0xe05a('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0xe05a('0x4e')](_0x4a5c54);})[_0xe05a('0x31')](function(_0x29f7f8){_0x43ecf4[_0xe05a('0x4f')]=_0x29f7f8;return _0x43ecf4;})[_0xe05a('0x31')](respondWithFilteredResult(_0x35c7cf,_0x4a5c54))[_0xe05a('0x50')](handleError(_0x35c7cf,null));};exports[_0xe05a('0x51')]=function(_0x4b241c,_0xdb5159){var _0x4ac87c={'raw':![],'where':{'id':_0x4b241c['params']['id']}},_0x1efbb2={};_0x1efbb2['model']=_[_0xe05a('0x52')](db[_0xe05a('0x38')][_0xe05a('0x39')]);_0x1efbb2['query']=_[_0xe05a('0x52')](_0x4b241c[_0xe05a('0x3d')]);_0x1efbb2['filters']=_[_0xe05a('0x53')](_0x1efbb2[_0xe05a('0x3c')],_0x1efbb2['query']);_0x4ac87c[_0xe05a('0x3f')]=_['intersection'](_0x1efbb2[_0xe05a('0x3c')],qs['fields'](_0x4b241c[_0xe05a('0x3d')]['fields']));_0x4ac87c[_0xe05a('0x3f')]=_0x4ac87c[_0xe05a('0x3f')][_0xe05a('0x41')]?_0x4ac87c[_0xe05a('0x3f')]:_0x1efbb2[_0xe05a('0x3c')];if(_0x4b241c[_0xe05a('0x3d')][_0xe05a('0x4c')]){_0x4ac87c[_0xe05a('0x4d')]=[{'all':!![]}];}_0x4ac87c=_[_0xe05a('0x49')]({},_0x4ac87c,_0x4b241c['options']);return db[_0xe05a('0x38')]['find'](_0x4ac87c)[_0xe05a('0x31')](handleEntityNotFound(_0xdb5159,null))['then'](respondWithResult(_0xdb5159,null))[_0xe05a('0x50')](handleError(_0xdb5159,null));};exports['create']=function(_0x1180c9,_0x38e146,_0x29bfb8){var _0x21cf8c;return db[_0xe05a('0x38')][_0xe05a('0x54')](_0x1180c9[_0xe05a('0x55')],{'raw':!![]})[_0xe05a('0x31')](function(_0x19bb6a){_0x21cf8c=_0x19bb6a;return db[_0xe05a('0x38')]['findAll']({'raw':!![]});})[_0xe05a('0x31')](function(_0x12344d){var _0x3c87f5=fs['readFileSync'](path[_0xe05a('0x56')](config[_0xe05a('0x57')],_0xe05a('0x58')),'utf8');var _0x312880=ejs[_0xe05a('0x59')](_0x3c87f5,{'contexts':_0x12344d||[]});fs[_0xe05a('0x5a')](_0xe05a('0x5b'),_0x312880);})[_0xe05a('0x31')](function(){return respondWithRpcPromise(_0xe05a('0x5c'),'create',{'module':_0xe05a('0x5d')});})['then'](function(){var _0x158c91=_0x1180c9[_0xe05a('0x5e')][_0xe05a('0x5f')]({'plain':!![]});if(!_0x158c91)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x158c91[_0xe05a('0x60')]===_0xe05a('0x5e')){var _0x5508d8=_0x21cf8c[_0xe05a('0x5f')]({'plain':!![]});return db[_0xe05a('0x61')][_0xe05a('0x62')]({'where':{'name':_0xe05a('0x33'),'userProfileId':_0x158c91[_0xe05a('0x63')]},'raw':!![]})[_0xe05a('0x31')](function(_0x1a67db){if(_0x1a67db&&_0x1a67db[_0xe05a('0x64')]===0x0){return db[_0xe05a('0x34')][_0xe05a('0x54')]({'name':_0x5508d8[_0xe05a('0x35')],'resourceId':_0x5508d8['id'],'type':_0x1a67db[_0xe05a('0x35')],'sectionId':_0x1a67db['id']},{})[_0xe05a('0x31')](function(){return _0x21cf8c;});}else{return _0x21cf8c;}})[_0xe05a('0x50')](function(_0x350230){logger[_0xe05a('0x21')](_0xe05a('0x65'),_0x350230);throw _0x350230;});}return _0x21cf8c;})[_0xe05a('0x31')](respondWithResult(_0x38e146,0xc9))[_0xe05a('0x50')](handleError(_0x38e146,null));};exports[_0xe05a('0x66')]=function(_0x581639,_0x39a107,_0x43b12a){var _0x235201;return db[_0xe05a('0x38')][_0xe05a('0x62')]({'where':{'id':_0x581639[_0xe05a('0x67')]['id']}})[_0xe05a('0x31')](handleEntityNotFound(_0x39a107,null))[_0xe05a('0x31')](saveUpdates(_0x581639[_0xe05a('0x55')],null))[_0xe05a('0x31')](function(_0x19a48b){if(_0x19a48b){_0x235201=_0x19a48b;return db[_0xe05a('0x38')][_0xe05a('0x4e')]({'raw':!![]});}})[_0xe05a('0x31')](function(_0x290834){var _0x3d6117=fs[_0xe05a('0x68')](path['join'](config[_0xe05a('0x57')],_0xe05a('0x58')),_0xe05a('0x69'));var _0x4f8bc3=ejs[_0xe05a('0x59')](_0x3d6117,{'contexts':_0x290834||[]});fs[_0xe05a('0x5a')](_0xe05a('0x5b'),_0x4f8bc3);})[_0xe05a('0x31')](function(){return respondWithRpcPromise(_0xe05a('0x5c'),_0xe05a('0x66'),{'module':_0xe05a('0x5d')});})[_0xe05a('0x31')](function(){return _0x235201;})[_0xe05a('0x31')](respondWithResult(_0x39a107,null))['catch'](handleError(_0x39a107,null));};exports['destroy']=function(_0x1de1f7,_0x25640d,_0x39d62a){var _0x232864;return db[_0xe05a('0x38')][_0xe05a('0x62')]({'where':{'id':_0x1de1f7['params']['id']}})['then'](handleEntityNotFound(_0x25640d,null))[_0xe05a('0x31')](removeEntity(_0x25640d,null))[_0xe05a('0x31')](function(){return db[_0xe05a('0x38')][_0xe05a('0x4e')]({'raw':!![]});})[_0xe05a('0x31')](function(_0x28e48e){var _0x80be95=fs['readFileSync'](path['join'](config['root'],'server/files/templates/context.ejs'),_0xe05a('0x69'));var _0x4ab5b5=ejs[_0xe05a('0x59')](_0x80be95,{'contexts':_0x28e48e});fs[_0xe05a('0x5a')](_0xe05a('0x5b'),_0x4ab5b5);return respondWithRpcPromise(_0xe05a('0x5c'),_0xe05a('0x32'),{'module':'chan_sip.so'});})[_0xe05a('0x50')](handleError(_0x25640d,null));}; \ No newline at end of file +var _0x635a=['create','body','readFileSync','root','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','Reload','chan_sip.so','join','server/files/templates/context.ejs','writeFileSync','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','VoiceContext,\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','update','destroy','get','Contexts','stack','name','send','index','map','VoiceContext','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','findAll','rows','show','find'];(function(_0xaf5bf0,_0x1d1fee){var _0x58d9a3=function(_0x4b6606){while(--_0x4b6606){_0xaf5bf0['push'](_0xaf5bf0['shift']());}};_0x58d9a3(++_0x1d1fee);}(_0x635a,0xeb));var _0xa635=function(_0x2f720f,_0x4e9ce1){_0x2f720f=_0x2f720f-0x0;var _0x57227d=_0x635a[_0x2f720f];return _0x57227d;};'use strict';var emlformat=require(_0xa635('0x0'));var rimraf=require(_0xa635('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa635('0x2'));var moment=require(_0xa635('0x3'));var BPromise=require(_0xa635('0x4'));var Mustache=require(_0xa635('0x5'));var util=require(_0xa635('0x6'));var path=require(_0xa635('0x7'));var sox=require(_0xa635('0x8'));var csv=require(_0xa635('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa635('0xa'));var _=require('lodash');var squel=require(_0xa635('0xb'));var crypto=require('crypto');var jsforce=require(_0xa635('0xc'));var deskjs=require(_0xa635('0xd'));var toCsv=require(_0xa635('0x9'));var querystring=require(_0xa635('0xe'));var Papa=require(_0xa635('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa635('0x10'));var as=require(_0xa635('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa635('0x12'))('api');var utils=require('../../config/utils');var config=require(_0xa635('0x13'));var licenseUtil=require(_0xa635('0x14'));var db=require(_0xa635('0x15'))['db'];var jayson=require(_0xa635('0x16'));var client=jayson[_0xa635('0x17')][_0xa635('0x18')]({'port':0x232a});function respondWithRpcPromise(_0x61dd7b,_0x432d98,_0x224929,_0x3d0f5c){return new BPromise(function(_0x5bf4e8,_0x93a095){var _0xb82554=_0x3d0f5c||client;return _0xb82554[_0xa635('0x19')](_0x61dd7b,_0x224929)[_0xa635('0x1a')](function(_0x34fd78){logger[_0xa635('0x1b')](_0xa635('0x1c'),_0x432d98,_0xa635('0x1d'));logger[_0xa635('0x1e')](_0xa635('0x1f'),_0x432d98,_0xa635('0x1d'),JSON[_0xa635('0x20')](_0x34fd78));if(_0x34fd78[_0xa635('0x21')]){if(_0x34fd78['error'][_0xa635('0x22')]===0x1f4){logger[_0xa635('0x21')]('VoiceContext,\x20%s,\x20%s',_0x432d98,_0x34fd78[_0xa635('0x21')][_0xa635('0x23')]);return _0x93a095(_0x34fd78['error']['message']);}logger[_0xa635('0x21')](_0xa635('0x1c'),_0x432d98,_0x34fd78['error'][_0xa635('0x23')]);return _0x5bf4e8(_0x34fd78[_0xa635('0x21')]['message']);}else{logger[_0xa635('0x1b')](_0xa635('0x1c'),_0x432d98,_0xa635('0x1d'));_0x5bf4e8(_0x34fd78[_0xa635('0x24')]['message']);}})[_0xa635('0x25')](function(_0x1d5c22){logger['error'](_0xa635('0x1c'),_0x432d98,_0x1d5c22);_0x93a095(_0x1d5c22);});});}function respondWithStatusCode(_0x11422d,_0xbac104){_0xbac104=_0xbac104||0xcc;return function(_0x3a915c){if(_0x3a915c){return _0x11422d[_0xa635('0x26')](_0xbac104);}return _0x11422d[_0xa635('0x27')](_0xbac104)[_0xa635('0x28')]();};}function respondWithResult(_0xee2828,_0x5d1913){_0x5d1913=_0x5d1913||0xc8;return function(_0x35a198){if(_0x35a198){return _0xee2828[_0xa635('0x27')](_0x5d1913)[_0xa635('0x29')](_0x35a198);}};}function respondWithFilteredResult(_0x6260bf,_0x30a3ba){return function(_0x55cc85){if(_0x55cc85){var _0x3f93c2=typeof _0x30a3ba[_0xa635('0x2a')]===_0xa635('0x2b')&&typeof _0x30a3ba[_0xa635('0x2c')]===_0xa635('0x2b');var _0x421694=_0x55cc85[_0xa635('0x2d')];var _0x1e0539=_0x3f93c2?0x0:_0x30a3ba[_0xa635('0x2a')];var _0x5ec4e9=_0x3f93c2?_0x55cc85[_0xa635('0x2d')]:_0x30a3ba[_0xa635('0x2a')]+_0x30a3ba['limit'];var _0x2377ec;if(_0x5ec4e9>=_0x421694){_0x5ec4e9=_0x421694;_0x2377ec=0xc8;}else{_0x2377ec=0xce;}_0x6260bf[_0xa635('0x27')](_0x2377ec);return _0x6260bf[_0xa635('0x2e')](_0xa635('0x2f'),_0x1e0539+'-'+_0x5ec4e9+'/'+_0x421694)[_0xa635('0x29')](_0x55cc85);}return null;};}function patchUpdates(_0x30b313){return function(_0x52fe36){try{jsonpatch[_0xa635('0x30')](_0x52fe36,_0x30b313,!![]);}catch(_0x236b72){return BPromise[_0xa635('0x31')](_0x236b72);}return _0x52fe36[_0xa635('0x32')]();};}function saveUpdates(_0x4958c4,_0x437935){return function(_0x4f7aba){if(_0x4f7aba){return _0x4f7aba[_0xa635('0x33')](_0x4958c4)[_0xa635('0x1a')](function(_0x7f97da){return _0x7f97da;});}return null;};}function removeEntity(_0x440094,_0x2c1a88){return function(_0x1f9a18){if(_0x1f9a18){return _0x1f9a18[_0xa635('0x34')]()['then'](function(){var _0x5b6af3=_0x1f9a18[_0xa635('0x35')]({'plain':!![]});var _0x148399=_0xa635('0x36');return db['UserProfileResource'][_0xa635('0x34')]({'where':{'type':_0x148399,'resourceId':_0x5b6af3['id']}})[_0xa635('0x1a')](function(){return _0x1f9a18;});})[_0xa635('0x1a')](function(){_0x440094[_0xa635('0x27')](0xcc)[_0xa635('0x28')]();});}};}function handleEntityNotFound(_0x1e4932,_0x46f69d){return function(_0x46915f){if(!_0x46915f){_0x1e4932[_0xa635('0x26')](0x194);}return _0x46915f;};}function handleError(_0x3572ef,_0x5beac2){_0x5beac2=_0x5beac2||0x1f4;return function(_0x235960){logger[_0xa635('0x21')](_0x235960[_0xa635('0x37')]);if(_0x235960[_0xa635('0x38')]){delete _0x235960[_0xa635('0x38')];}_0x3572ef['status'](_0x5beac2)[_0xa635('0x39')](_0x235960);};}exports[_0xa635('0x3a')]=function(_0x1e91f9,_0x2d3275){var _0x4150a4={},_0x4de7fd={},_0x2c425b={'count':0x0,'rows':[]};var _0x5b7e02=_[_0xa635('0x3b')](db[_0xa635('0x3c')][_0xa635('0x3d')],function(_0x3ddb4f){return{'name':_0x3ddb4f['fieldName'],'type':_0x3ddb4f[_0xa635('0x3e')][_0xa635('0x3f')]};});_0x4de7fd[_0xa635('0x40')]=_['map'](_0x5b7e02,_0xa635('0x38'));_0x4de7fd[_0xa635('0x41')]=_[_0xa635('0x42')](_0x1e91f9[_0xa635('0x41')]);_0x4de7fd[_0xa635('0x43')]=_[_0xa635('0x44')](_0x4de7fd[_0xa635('0x40')],_0x4de7fd[_0xa635('0x41')]);_0x4150a4[_0xa635('0x45')]=_[_0xa635('0x44')](_0x4de7fd[_0xa635('0x40')],qs[_0xa635('0x46')](_0x1e91f9[_0xa635('0x41')]['fields']));_0x4150a4[_0xa635('0x45')]=_0x4150a4['attributes'][_0xa635('0x47')]?_0x4150a4[_0xa635('0x45')]:_0x4de7fd[_0xa635('0x40')];if(!_0x1e91f9[_0xa635('0x41')][_0xa635('0x48')](_0xa635('0x49'))){_0x4150a4[_0xa635('0x2c')]=qs[_0xa635('0x2c')](_0x1e91f9[_0xa635('0x41')]['limit']);_0x4150a4[_0xa635('0x2a')]=qs[_0xa635('0x2a')](_0x1e91f9[_0xa635('0x41')]['offset']);}_0x4150a4['order']=qs[_0xa635('0x4a')](_0x1e91f9[_0xa635('0x41')][_0xa635('0x4a')]);_0x4150a4['where']=qs['filters'](_[_0xa635('0x4b')](_0x1e91f9[_0xa635('0x41')],_0x4de7fd[_0xa635('0x43')]),_0x5b7e02);if(_0x1e91f9[_0xa635('0x41')][_0xa635('0x4c')]){_0x4150a4[_0xa635('0x4d')]=_['merge'](_0x4150a4['where'],{'$or':_[_0xa635('0x3b')](_0x5b7e02,function(_0x4ce258){if(_0x4ce258[_0xa635('0x3e')]!==_0xa635('0x4e')){var _0x4fd064={};_0x4fd064[_0x4ce258[_0xa635('0x38')]]={'$like':'%'+_0x1e91f9[_0xa635('0x41')][_0xa635('0x4c')]+'%'};return _0x4fd064;}})});}_0x4150a4=_[_0xa635('0x4f')]({},_0x4150a4,_0x1e91f9[_0xa635('0x50')]);var _0x1e8714={'where':_0x4150a4['where']};return db[_0xa635('0x3c')]['count'](_0x1e8714)[_0xa635('0x1a')](function(_0x766509){_0x2c425b[_0xa635('0x2d')]=_0x766509;if(_0x1e91f9[_0xa635('0x41')][_0xa635('0x51')]){_0x4150a4['include']=[{'all':!![]}];}return db[_0xa635('0x3c')][_0xa635('0x52')](_0x4150a4);})['then'](function(_0x1d68eb){_0x2c425b[_0xa635('0x53')]=_0x1d68eb;return _0x2c425b;})[_0xa635('0x1a')](respondWithFilteredResult(_0x2d3275,_0x4150a4))[_0xa635('0x25')](handleError(_0x2d3275,null));};exports[_0xa635('0x54')]=function(_0x260ff9,_0x2ac824){var _0xd5cb71={'raw':![],'where':{'id':_0x260ff9['params']['id']}},_0x372d66={};_0x372d66[_0xa635('0x40')]=_['keys'](db['VoiceContext'][_0xa635('0x3d')]);_0x372d66[_0xa635('0x41')]=_[_0xa635('0x42')](_0x260ff9[_0xa635('0x41')]);_0x372d66[_0xa635('0x43')]=_[_0xa635('0x44')](_0x372d66[_0xa635('0x40')],_0x372d66[_0xa635('0x41')]);_0xd5cb71[_0xa635('0x45')]=_['intersection'](_0x372d66[_0xa635('0x40')],qs['fields'](_0x260ff9['query'][_0xa635('0x46')]));_0xd5cb71['attributes']=_0xd5cb71['attributes'][_0xa635('0x47')]?_0xd5cb71[_0xa635('0x45')]:_0x372d66[_0xa635('0x40')];if(_0x260ff9[_0xa635('0x41')]['includeAll']){_0xd5cb71['include']=[{'all':!![]}];}_0xd5cb71=_[_0xa635('0x4f')]({},_0xd5cb71,_0x260ff9['options']);return db[_0xa635('0x3c')][_0xa635('0x55')](_0xd5cb71)['then'](handleEntityNotFound(_0x2ac824,null))[_0xa635('0x1a')](respondWithResult(_0x2ac824,null))[_0xa635('0x25')](handleError(_0x2ac824,null));};exports[_0xa635('0x56')]=function(_0x1e8c5f,_0x40c5ab,_0x4149e0){var _0x4e6f9f;return db[_0xa635('0x3c')][_0xa635('0x56')](_0x1e8c5f[_0xa635('0x57')],{'raw':!![]})['then'](function(_0x417bcc){_0x4e6f9f=_0x417bcc;return db['VoiceContext']['findAll']({'raw':!![]});})[_0xa635('0x1a')](function(_0x1a2520){var _0x1e65ca=fs[_0xa635('0x58')](path['join'](config[_0xa635('0x59')],'server/files/templates/context.ejs'),_0xa635('0x5a'));var _0x50dbce=ejs[_0xa635('0x5b')](_0x1e65ca,{'contexts':_0x1a2520||[]});fs['writeFileSync'](_0xa635('0x5c'),_0x50dbce);})[_0xa635('0x1a')](function(){return respondWithRpcPromise('Reload',_0xa635('0x56'),{'module':'chan_sip.so'});})[_0xa635('0x1a')](function(){var _0x1aa9db=_0x1e8c5f[_0xa635('0x5d')][_0xa635('0x35')]({'plain':!![]});if(!_0x1aa9db)throw new Error(_0xa635('0x5e'));if(_0x1aa9db[_0xa635('0x5f')]===_0xa635('0x5d')){var _0x372884=_0x4e6f9f[_0xa635('0x35')]({'plain':!![]});return db[_0xa635('0x60')][_0xa635('0x55')]({'where':{'name':'Contexts','userProfileId':_0x1aa9db[_0xa635('0x61')]},'raw':!![]})[_0xa635('0x1a')](function(_0x507fe5){if(_0x507fe5&&_0x507fe5[_0xa635('0x62')]===0x0){return db[_0xa635('0x63')][_0xa635('0x56')]({'name':_0x372884[_0xa635('0x38')],'resourceId':_0x372884['id'],'type':_0x507fe5[_0xa635('0x38')],'sectionId':_0x507fe5['id']},{})[_0xa635('0x1a')](function(){return _0x4e6f9f;});}else{return _0x4e6f9f;}})[_0xa635('0x25')](function(_0x59694f){logger[_0xa635('0x21')](_0xa635('0x64'),_0x59694f);throw _0x59694f;});}return _0x4e6f9f;})['then'](respondWithResult(_0x40c5ab,0xc9))['catch'](handleError(_0x40c5ab,null));};exports[_0xa635('0x33')]=function(_0x17d018,_0x3a28db,_0x424fb0){var _0xee5be7;return db['VoiceContext']['find']({'where':{'id':_0x17d018[_0xa635('0x65')]['id']}})[_0xa635('0x1a')](handleEntityNotFound(_0x3a28db,null))[_0xa635('0x1a')](saveUpdates(_0x17d018[_0xa635('0x57')],null))[_0xa635('0x1a')](function(_0x452562){if(_0x452562){_0xee5be7=_0x452562;return db[_0xa635('0x3c')][_0xa635('0x52')]({'raw':!![]});}})[_0xa635('0x1a')](function(_0x6c0718){var _0x2ec5a3=fs[_0xa635('0x58')](path['join'](config[_0xa635('0x59')],'server/files/templates/context.ejs'),_0xa635('0x5a'));var _0x30565e=ejs['render'](_0x2ec5a3,{'contexts':_0x6c0718||[]});fs['writeFileSync'](_0xa635('0x5c'),_0x30565e);})[_0xa635('0x1a')](function(){return respondWithRpcPromise(_0xa635('0x66'),'update',{'module':_0xa635('0x67')});})[_0xa635('0x1a')](function(){return _0xee5be7;})[_0xa635('0x1a')](respondWithResult(_0x3a28db,null))[_0xa635('0x25')](handleError(_0x3a28db,null));};exports['destroy']=function(_0x219f44,_0x2e01e4,_0x404181){var _0x35056b;return db[_0xa635('0x3c')][_0xa635('0x55')]({'where':{'id':_0x219f44['params']['id']}})['then'](handleEntityNotFound(_0x2e01e4,null))[_0xa635('0x1a')](removeEntity(_0x2e01e4,null))['then'](function(){return db['VoiceContext'][_0xa635('0x52')]({'raw':!![]});})[_0xa635('0x1a')](function(_0x1386f3){var _0x57333f=fs[_0xa635('0x58')](path[_0xa635('0x68')](config['root'],_0xa635('0x69')),_0xa635('0x5a'));var _0x5e9666=ejs['render'](_0x57333f,{'contexts':_0x1386f3});fs[_0xa635('0x6a')](_0xa635('0x5c'),_0x5e9666);return respondWithRpcPromise(_0xa635('0x66'),_0xa635('0x34'),{'module':_0xa635('0x67')});})[_0xa635('0x25')](handleError(_0x2e01e4,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index 9f02dae..db06b90 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 _0xf651=['voice_contexts','../../config/logger','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x300499,_0x40cdb5){var _0x406e63=function(_0x54b505){while(--_0x54b505){_0x300499['push'](_0x300499['shift']());}};_0x406e63(++_0x40cdb5);}(_0xf651,0xac));var _0x1f65=function(_0x2064e5,_0x4f6fa2){_0x2064e5=_0x2064e5-0x0;var _0x21a233=_0xf651[_0x2064e5];return _0x21a233;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f65('0x0'))('api');var moment=require(_0x1f65('0x1'));var BPromise=require('bluebird');var rp=require(_0x1f65('0x2'));var fs=require('fs');var path=require(_0x1f65('0x3'));var rimraf=require(_0x1f65('0x4'));var config=require(_0x1f65('0x5'));var attributes=require('./voiceContext.attributes');module[_0x1f65('0x6')]=function(_0x5d74ac,_0x179aa3){return _0x5d74ac[_0x1f65('0x7')]('VoiceContext',attributes,{'tableName':_0x1f65('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5314=['util','../../config/logger','api','moment','path','../../config/environment','exports','define','lodash'];(function(_0x4ba5d0,_0x52d7a5){var _0x502bd7=function(_0x3e8a05){while(--_0x3e8a05){_0x4ba5d0['push'](_0x4ba5d0['shift']());}};_0x502bd7(++_0x52d7a5);}(_0x5314,0x74));var _0x4531=function(_0x3d17b7,_0x2474ec){_0x3d17b7=_0x3d17b7-0x0;var _0xa08a79=_0x5314[_0x3d17b7];return _0xa08a79;};'use strict';var _=require(_0x4531('0x0'));var util=require(_0x4531('0x1'));var logger=require(_0x4531('0x2'))(_0x4531('0x3'));var moment=require(_0x4531('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4531('0x5'));var rimraf=require('rimraf');var config=require(_0x4531('0x6'));var attributes=require('./voiceContext.attributes');module[_0x4531('0x7')]=function(_0x5580b4,_0x1cac3a){return _0x5580b4[_0x4531('0x8')]('VoiceContext',attributes,{'tableName':'voice_contexts','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 0c82761..6ed79de 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 _0x4046=['request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/environment','jayson/promise','client','http','request','then','info','debug','VoiceContext,\x20%s,\x20%s,\x20%s'];(function(_0x1d16b3,_0x198237){var _0x37e344=function(_0xaacd74){while(--_0xaacd74){_0x1d16b3['push'](_0x1d16b3['shift']());}};_0x37e344(++_0x198237);}(_0x4046,0x126));var _0x6404=function(_0x59d866,_0x27f8c9){_0x59d866=_0x59d866-0x0;var _0x4f3ca3=_0x4046[_0x59d866];return _0x4f3ca3;};'use strict';var _=require('lodash');var util=require(_0x6404('0x0'));var moment=require(_0x6404('0x1'));var BPromise=require(_0x6404('0x2'));var rs=require(_0x6404('0x3'));var fs=require('fs');var Redis=require(_0x6404('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x6404('0x5'));var jayson=require(_0x6404('0x6'));var client=jayson[_0x6404('0x7')][_0x6404('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2eba27,_0x5cd47b,_0x4cbc18){return new BPromise(function(_0x21b3d6,_0x509ad2){return client[_0x6404('0x9')](_0x2eba27,_0x4cbc18)[_0x6404('0xa')](function(_0x17d76e){logger[_0x6404('0xb')]('VoiceContext,\x20%s,\x20%s',_0x5cd47b,'request\x20sent');logger[_0x6404('0xc')](_0x6404('0xd'),_0x5cd47b,_0x6404('0xe'),JSON[_0x6404('0xf')](_0x17d76e));if(_0x17d76e[_0x6404('0x10')]){if(_0x17d76e[_0x6404('0x10')][_0x6404('0x11')]===0x1f4){logger[_0x6404('0x10')](_0x6404('0x12'),_0x5cd47b,_0x17d76e[_0x6404('0x10')][_0x6404('0x13')]);return _0x509ad2(_0x17d76e['error'][_0x6404('0x13')]);}logger[_0x6404('0x10')](_0x6404('0x12'),_0x5cd47b,_0x17d76e['error'][_0x6404('0x13')]);return _0x21b3d6(_0x17d76e['error'][_0x6404('0x13')]);}else{logger[_0x6404('0xb')]('VoiceContext,\x20%s,\x20%s',_0x5cd47b,_0x6404('0xe'));_0x21b3d6(_0x17d76e[_0x6404('0x14')]['message']);}})[_0x6404('0x15')](function(_0x42234c){logger[_0x6404('0x10')](_0x6404('0x12'),_0x5cd47b,_0x42234c);_0x509ad2(_0x42234c);});});} \ No newline at end of file +var _0x8307=['error','code','VoiceContext,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','jayson/promise','http','request','info','request\x20sent','stringify'];(function(_0x37a07d,_0x5c55be){var _0x306c05=function(_0x3767ee){while(--_0x3767ee){_0x37a07d['push'](_0x37a07d['shift']());}};_0x306c05(++_0x5c55be);}(_0x8307,0xc4));var _0x7830=function(_0x9fd0d3,_0x321b81){_0x9fd0d3=_0x9fd0d3-0x0;var _0x5b292d=_0x8307[_0x9fd0d3];return _0x5b292d;};'use strict';var _=require(_0x7830('0x0'));var util=require(_0x7830('0x1'));var moment=require('moment');var BPromise=require(_0x7830('0x2'));var rs=require(_0x7830('0x3'));var fs=require('fs');var Redis=require(_0x7830('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7830('0x5'));var logger=require(_0x7830('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7830('0x7'));var client=jayson['client'][_0x7830('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ab50a,_0x55e969,_0x20ed52){return new BPromise(function(_0x595074,_0x19c4b1){return client[_0x7830('0x9')](_0x5ab50a,_0x20ed52)['then'](function(_0x44992c){logger[_0x7830('0xa')]('VoiceContext,\x20%s,\x20%s',_0x55e969,_0x7830('0xb'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x55e969,_0x7830('0xb'),JSON[_0x7830('0xc')](_0x44992c));if(_0x44992c[_0x7830('0xd')]){if(_0x44992c[_0x7830('0xd')][_0x7830('0xe')]===0x1f4){logger[_0x7830('0xd')](_0x7830('0xf'),_0x55e969,_0x44992c[_0x7830('0xd')]['message']);return _0x19c4b1(_0x44992c[_0x7830('0xd')][_0x7830('0x10')]);}logger[_0x7830('0xd')]('VoiceContext,\x20%s,\x20%s',_0x55e969,_0x44992c['error']['message']);return _0x595074(_0x44992c[_0x7830('0xd')]['message']);}else{logger[_0x7830('0xa')](_0x7830('0xf'),_0x55e969,_0x7830('0xb'));_0x595074(_0x44992c[_0x7830('0x11')][_0x7830('0x10')]);}})[_0x7830('0x12')](function(_0x36f583){logger[_0x7830('0xd')](_0x7830('0xf'),_0x55e969,_0x36f583);_0x19c4b1(_0x36f583);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index c103ab5..f51d7f9 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 _0x0ea9=['path','connect-timeout','express','Router','./voiceDialReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update','destroy','multer','util'];(function(_0x2df2af,_0x41c1e3){var _0x308f55=function(_0x4d5bb1){while(--_0x4d5bb1){_0x2df2af['push'](_0x2df2af['shift']());}};_0x308f55(++_0x41c1e3);}(_0x0ea9,0xd6));var _0x90ea=function(_0x1436d4,_0xfe299b){_0x1436d4=_0x1436d4-0x0;var _0x52e137=_0x0ea9[_0x1436d4];return _0x52e137;};'use strict';var multer=require(_0x90ea('0x0'));var util=require(_0x90ea('0x1'));var path=require(_0x90ea('0x2'));var timeout=require(_0x90ea('0x3'));var express=require(_0x90ea('0x4'));var router=express[_0x90ea('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x90ea('0x6'));router[_0x90ea('0x7')]('/',auth[_0x90ea('0x8')](),controller[_0x90ea('0x9')]);router['get']('/describe',auth[_0x90ea('0x8')](),controller[_0x90ea('0xa')]);router[_0x90ea('0x7')]('/:id',auth[_0x90ea('0x8')](),controller[_0x90ea('0xb')]);router[_0x90ea('0xc')]('/',auth[_0x90ea('0x8')](),controller[_0x90ea('0xd')]);router[_0x90ea('0xe')](_0x90ea('0xf'),auth[_0x90ea('0x8')](),controller[_0x90ea('0x10')]);router['delete'](_0x90ea('0xf'),auth[_0x90ea('0x8')](),controller[_0x90ea('0x11')]);module['exports']=router; \ No newline at end of file +var _0xc4f5=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy','exports','path','express','Router'];(function(_0x2a4ae1,_0x3dde22){var _0x245f80=function(_0x543b43){while(--_0x543b43){_0x2a4ae1['push'](_0x2a4ae1['shift']());}};_0x245f80(++_0x3dde22);}(_0xc4f5,0x75));var _0x5c4f=function(_0x5a30fb,_0x206270){_0x5a30fb=_0x5a30fb-0x0;var _0x3b86aa=_0xc4f5[_0x5a30fb];return _0x3b86aa;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5c4f('0x0'));var timeout=require('connect-timeout');var express=require(_0x5c4f('0x1'));var router=express[_0x5c4f('0x2')]();var fs_extra=require(_0x5c4f('0x3'));var auth=require(_0x5c4f('0x4'));var interaction=require(_0x5c4f('0x5'));var config=require(_0x5c4f('0x6'));var controller=require(_0x5c4f('0x7'));router[_0x5c4f('0x8')]('/',auth[_0x5c4f('0x9')](),controller['index']);router[_0x5c4f('0x8')](_0x5c4f('0xa'),auth['isAuthenticated'](),controller[_0x5c4f('0xb')]);router[_0x5c4f('0x8')](_0x5c4f('0xc'),auth[_0x5c4f('0x9')](),controller['show']);router[_0x5c4f('0xd')]('/',auth[_0x5c4f('0x9')](),controller[_0x5c4f('0xe')]);router[_0x5c4f('0xf')](_0x5c4f('0xc'),auth[_0x5c4f('0x9')](),controller[_0x5c4f('0x10')]);router[_0x5c4f('0x11')](_0x5c4f('0xc'),auth[_0x5c4f('0x9')](),controller[_0x5c4f('0x12')]);module[_0x5c4f('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index ffb2123..8c6d7ac 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 _0x9957=['INTEGER','DATE','called,connect,complete','sequelize','exports','STRING'];(function(_0x4cb207,_0x43f38d){var _0x4a822a=function(_0x36d231){while(--_0x36d231){_0x4cb207['push'](_0x4cb207['shift']());}};_0x4a822a(++_0x43f38d);}(_0x9957,0x93));var _0x7995=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x9957[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'privilege':{'type':Sequelize[_0x7995('0x2')]},'channel':{'type':Sequelize[_0x7995('0x2')]},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x7995('0x2')]},'calleridnum':{'type':Sequelize[_0x7995('0x2')]},'calleridname':{'type':Sequelize[_0x7995('0x2')]},'connectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x7995('0x2')]},'accountcode':{'type':Sequelize[_0x7995('0x2')]},'context':{'type':Sequelize[_0x7995('0x2')]},'exten':{'type':Sequelize[_0x7995('0x2')]},'priority':{'type':Sequelize[_0x7995('0x3')]},'uniqueid':{'type':Sequelize[_0x7995('0x2')]},'linkedid':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0x7995('0x2')]},'destchannelstate':{'type':Sequelize[_0x7995('0x3')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x7995('0x2')]},'destcalleridname':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x7995('0x2')]},'destconnectedlinename':{'type':Sequelize[_0x7995('0x2')]},'destlanguage':{'type':Sequelize[_0x7995('0x2')]},'destaccountcode':{'type':Sequelize[_0x7995('0x2')]},'destcontext':{'type':Sequelize[_0x7995('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x7995('0x3')]},'destuniqueid':{'type':Sequelize[_0x7995('0x2')]},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize[_0x7995('0x2')]},'dialstatus':{'type':Sequelize[_0x7995('0x2')]},'starttime':{'type':Sequelize[_0x7995('0x4')]},'answertime':{'type':Sequelize[_0x7995('0x4')]},'endtime':{'type':Sequelize[_0x7995('0x4')]},'lastevent':{'type':Sequelize[_0x7995('0x2')],'comment':_0x7995('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize[_0x7995('0x3')]},'billableseconds':{'type':Sequelize[_0x7995('0x3')]}}; \ No newline at end of file +var _0x00bb=['STRING','INTEGER','DATE','called,connect,complete','sequelize','exports'];(function(_0x12c7d5,_0xf8e6a0){var _0x34b516=function(_0xd73373){while(--_0xd73373){_0x12c7d5['push'](_0x12c7d5['shift']());}};_0x34b516(++_0xf8e6a0);}(_0x00bb,0x1d8));var _0xb00b=function(_0x4e9628,_0x250573){_0x4e9628=_0x4e9628-0x0;var _0x27bc8c=_0x00bb[_0x4e9628];return _0x27bc8c;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'privilege':{'type':Sequelize[_0xb00b('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xb00b('0x3')]},'channelstatedesc':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xb00b('0x2')]},'calleridname':{'type':Sequelize[_0xb00b('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'language':{'type':Sequelize[_0xb00b('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize[_0xb00b('0x3')]},'uniqueid':{'type':Sequelize[_0xb00b('0x2')]},'linkedid':{'type':Sequelize[_0xb00b('0x2')]},'destchannel':{'type':Sequelize[_0xb00b('0x2')]},'destchannelstate':{'type':Sequelize[_0xb00b('0x3')]},'destchannelstatedesc':{'type':Sequelize[_0xb00b('0x2')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xb00b('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xb00b('0x2')]},'destlanguage':{'type':Sequelize[_0xb00b('0x2')]},'destaccountcode':{'type':Sequelize[_0xb00b('0x2')]},'destcontext':{'type':Sequelize[_0xb00b('0x2')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0xb00b('0x3')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize['STRING']},'dialstring':{'type':Sequelize['STRING']},'dialstatus':{'type':Sequelize[_0xb00b('0x2')]},'starttime':{'type':Sequelize[_0xb00b('0x4')]},'answertime':{'type':Sequelize[_0xb00b('0x4')]},'endtime':{'type':Sequelize[_0xb00b('0x4')]},'lastevent':{'type':Sequelize[_0xb00b('0x2')],'comment':_0xb00b('0x5')},'routeId':{'type':Sequelize['INTEGER']},'duration':{'type':Sequelize[_0xb00b('0x3')]},'holdtime':{'type':Sequelize[_0xb00b('0x3')]},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 2481f83..b0ad02a 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 _0x29f8=['key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','includeAll','rows','catch','show','params','include','options','create','update','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','end','error','stack','name','index','map','VoiceDialReport','rawAttributes','fieldName','type'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_0x29f8,0x106));var _0x829f=function(_0x2df507,_0x553862){_0x2df507=_0x2df507-0x0;var _0x1f7167=_0x29f8[_0x2df507];return _0x1f7167;};'use strict';var emlformat=require(_0x829f('0x0'));var rimraf=require(_0x829f('0x1'));var zipdir=require(_0x829f('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x829f('0x3'));var moment=require(_0x829f('0x4'));var BPromise=require(_0x829f('0x5'));var Mustache=require(_0x829f('0x6'));var util=require('util');var path=require(_0x829f('0x7'));var sox=require(_0x829f('0x8'));var csv=require('to-csv');var ejs=require(_0x829f('0x9'));var fs=require('fs');var fs_extra=require(_0x829f('0xa'));var _=require('lodash');var squel=require(_0x829f('0xb'));var crypto=require(_0x829f('0xc'));var jsforce=require(_0x829f('0xd'));var deskjs=require(_0x829f('0xe'));var toCsv=require(_0x829f('0xf'));var querystring=require(_0x829f('0x10'));var Papa=require(_0x829f('0x11'));var Redis=require(_0x829f('0x12'));var authService=require(_0x829f('0x13'));var qs=require(_0x829f('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x829f('0x15'));var logger=require(_0x829f('0x16'))(_0x829f('0x17'));var utils=require(_0x829f('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x829f('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x169ebf,_0x35b638){_0x35b638=_0x35b638||0xcc;return function(_0x5c9508){if(_0x5c9508){return _0x169ebf[_0x829f('0x1a')](_0x35b638);}return _0x169ebf[_0x829f('0x1b')](_0x35b638)['end']();};}function respondWithResult(_0x3ab066,_0x47c5c0){_0x47c5c0=_0x47c5c0||0xc8;return function(_0xc9942d){if(_0xc9942d){return _0x3ab066[_0x829f('0x1b')](_0x47c5c0)[_0x829f('0x1c')](_0xc9942d);}};}function respondWithFilteredResult(_0x4cf290,_0x1a1d26){return function(_0x5a07f0){if(_0x5a07f0){var _0x11e2a5=typeof _0x1a1d26[_0x829f('0x1d')]===_0x829f('0x1e')&&typeof _0x1a1d26[_0x829f('0x1f')]===_0x829f('0x1e');var _0x392a85=_0x5a07f0['count'];var _0x35959d=_0x11e2a5?0x0:_0x1a1d26[_0x829f('0x1d')];var _0x277c6b=_0x11e2a5?_0x5a07f0[_0x829f('0x20')]:_0x1a1d26[_0x829f('0x1d')]+_0x1a1d26[_0x829f('0x1f')];var _0x247716;if(_0x277c6b>=_0x392a85){_0x277c6b=_0x392a85;_0x247716=0xc8;}else{_0x247716=0xce;}_0x4cf290[_0x829f('0x1b')](_0x247716);return _0x4cf290[_0x829f('0x21')](_0x829f('0x22'),_0x35959d+'-'+_0x277c6b+'/'+_0x392a85)['json'](_0x5a07f0);}return null;};}function patchUpdates(_0x51c5e9){return function(_0x48ad62){try{jsonpatch[_0x829f('0x23')](_0x48ad62,_0x51c5e9,!![]);}catch(_0x571339){return BPromise[_0x829f('0x24')](_0x571339);}return _0x48ad62[_0x829f('0x25')]();};}function saveUpdates(_0x414bab,_0x2cb610){return function(_0x1483cb){if(_0x1483cb){return _0x1483cb['update'](_0x414bab)[_0x829f('0x26')](function(_0x140e9d){return _0x140e9d;});}return null;};}function removeEntity(_0x3ba228,_0x411a1d){return function(_0x118c72){if(_0x118c72){return _0x118c72[_0x829f('0x27')]()['then'](function(){_0x3ba228['status'](0xcc)[_0x829f('0x28')]();});}};}function handleEntityNotFound(_0x2cedcd,_0x564571){return function(_0x4fde68){if(!_0x4fde68){_0x2cedcd[_0x829f('0x1a')](0x194);}return _0x4fde68;};}function handleError(_0x15b29c,_0x174dbc){_0x174dbc=_0x174dbc||0x1f4;return function(_0x5f3cc6){logger[_0x829f('0x29')](_0x5f3cc6[_0x829f('0x2a')]);if(_0x5f3cc6[_0x829f('0x2b')]){delete _0x5f3cc6[_0x829f('0x2b')];}_0x15b29c['status'](_0x174dbc)['send'](_0x5f3cc6);};}exports[_0x829f('0x2c')]=function(_0x41f56d,_0x2a696c){var _0x2a37ad={},_0x426990={},_0x50910e={'count':0x0,'rows':[]};var _0x44782c=_[_0x829f('0x2d')](db[_0x829f('0x2e')][_0x829f('0x2f')],function(_0x31d1ab){return{'name':_0x31d1ab[_0x829f('0x30')],'type':_0x31d1ab[_0x829f('0x31')][_0x829f('0x32')]};});_0x426990[_0x829f('0x33')]=_[_0x829f('0x2d')](_0x44782c,'name');_0x426990[_0x829f('0x34')]=_[_0x829f('0x35')](_0x41f56d['query']);_0x426990[_0x829f('0x36')]=_[_0x829f('0x37')](_0x426990[_0x829f('0x33')],_0x426990[_0x829f('0x34')]);_0x2a37ad['attributes']=_[_0x829f('0x37')](_0x426990['model'],qs[_0x829f('0x38')](_0x41f56d['query'][_0x829f('0x38')]));_0x2a37ad['attributes']=_0x2a37ad[_0x829f('0x39')][_0x829f('0x3a')]?_0x2a37ad['attributes']:_0x426990[_0x829f('0x33')];if(!_0x41f56d[_0x829f('0x34')][_0x829f('0x3b')](_0x829f('0x3c'))){_0x2a37ad[_0x829f('0x1f')]=qs[_0x829f('0x1f')](_0x41f56d['query']['limit']);_0x2a37ad[_0x829f('0x1d')]=qs[_0x829f('0x1d')](_0x41f56d[_0x829f('0x34')]['offset']);}_0x2a37ad[_0x829f('0x3d')]=qs['sort'](_0x41f56d['query']['sort']);_0x2a37ad[_0x829f('0x3e')]=qs[_0x829f('0x36')](_[_0x829f('0x3f')](_0x41f56d[_0x829f('0x34')],_0x426990['filters']),_0x44782c);if(_0x41f56d[_0x829f('0x34')][_0x829f('0x40')]){_0x2a37ad[_0x829f('0x3e')]=_['merge'](_0x2a37ad[_0x829f('0x3e')],{'$or':_[_0x829f('0x2d')](_0x44782c,function(_0x1e51bc){if(_0x1e51bc[_0x829f('0x31')]!=='VIRTUAL'){var _0xf3f994={};_0xf3f994[_0x1e51bc[_0x829f('0x2b')]]={'$like':'%'+_0x41f56d[_0x829f('0x34')][_0x829f('0x40')]+'%'};return _0xf3f994;}})});}_0x2a37ad=_[_0x829f('0x41')]({},_0x2a37ad,_0x41f56d['options']);var _0x47e52c={'where':_0x2a37ad[_0x829f('0x3e')]};return db[_0x829f('0x2e')][_0x829f('0x20')](_0x47e52c)[_0x829f('0x26')](function(_0x536efa){_0x50910e['count']=_0x536efa;if(_0x41f56d[_0x829f('0x34')][_0x829f('0x42')]){_0x2a37ad['include']=[{'all':!![]}];}return db['VoiceDialReport']['findAll'](_0x2a37ad);})[_0x829f('0x26')](function(_0x5eb8a7){_0x50910e[_0x829f('0x43')]=_0x5eb8a7;return _0x50910e;})[_0x829f('0x26')](respondWithFilteredResult(_0x2a696c,_0x2a37ad))[_0x829f('0x44')](handleError(_0x2a696c,null));};exports[_0x829f('0x45')]=function(_0x383b1a,_0x503cc4){var _0x71f2b8={'raw':!![],'where':{'id':_0x383b1a[_0x829f('0x46')]['id']}},_0x1f1d5b={};_0x1f1d5b[_0x829f('0x33')]=_[_0x829f('0x35')](db[_0x829f('0x2e')][_0x829f('0x2f')]);_0x1f1d5b['query']=_[_0x829f('0x35')](_0x383b1a[_0x829f('0x34')]);_0x1f1d5b['filters']=_[_0x829f('0x37')](_0x1f1d5b['model'],_0x1f1d5b[_0x829f('0x34')]);_0x71f2b8['attributes']=_[_0x829f('0x37')](_0x1f1d5b['model'],qs[_0x829f('0x38')](_0x383b1a[_0x829f('0x34')][_0x829f('0x38')]));_0x71f2b8['attributes']=_0x71f2b8[_0x829f('0x39')][_0x829f('0x3a')]?_0x71f2b8[_0x829f('0x39')]:_0x1f1d5b['model'];if(_0x383b1a[_0x829f('0x34')][_0x829f('0x42')]){_0x71f2b8[_0x829f('0x47')]=[{'all':!![]}];}_0x71f2b8=_[_0x829f('0x41')]({},_0x71f2b8,_0x383b1a[_0x829f('0x48')]);return db['VoiceDialReport']['find'](_0x71f2b8)[_0x829f('0x26')](handleEntityNotFound(_0x503cc4,null))[_0x829f('0x26')](respondWithResult(_0x503cc4,null))[_0x829f('0x44')](handleError(_0x503cc4,null));};exports[_0x829f('0x49')]=function(_0x69baff,_0xddbef){return db[_0x829f('0x2e')][_0x829f('0x49')](_0x69baff['body'],{})['then'](respondWithResult(_0xddbef,0xc9))[_0x829f('0x44')](handleError(_0xddbef,null));};exports[_0x829f('0x4a')]=function(_0x387e6c,_0x2f9da9){if(_0x387e6c['body']['id']){delete _0x387e6c[_0x829f('0x4b')]['id'];}return db['VoiceDialReport'][_0x829f('0x4c')]({'where':{'id':_0x387e6c[_0x829f('0x46')]['id']}})[_0x829f('0x26')](handleEntityNotFound(_0x2f9da9,null))[_0x829f('0x26')](saveUpdates(_0x387e6c['body'],null))[_0x829f('0x26')](respondWithResult(_0x2f9da9,null))[_0x829f('0x44')](handleError(_0x2f9da9,null));};exports[_0x829f('0x27')]=function(_0x5b7a90,_0x2480c7){return db[_0x829f('0x2e')]['find']({'where':{'id':_0x5b7a90['params']['id']}})[_0x829f('0x26')](handleEntityNotFound(_0x2480c7,null))[_0x829f('0x26')](removeEntity(_0x2480c7,null))[_0x829f('0x44')](handleError(_0x2480c7,null));};exports['describe']=function(_0x4700cd,_0x3fae3f){return db['VoiceDialReport'][_0x829f('0x4d')]()[_0x829f('0x26')](respondWithResult(_0x3fae3f,null))[_0x829f('0x44')](handleError(_0x3fae3f,null));}; \ No newline at end of file +var _0xea13=['sort','pick','filter','where','merge','map','type','VIRTUAL','options','includeAll','findAll','catch','show','params','intersection','find','create','body','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','VoiceDialReport','rawAttributes','fieldName','key','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0xea13,0x19e));var _0x3ea1=function(_0x9d2bdc,_0x4f2b6a){_0x9d2bdc=_0x9d2bdc-0x0;var _0x410615=_0xea13[_0x9d2bdc];return _0x410615;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3ea1('0x0'));var jsonpatch=require(_0x3ea1('0x1'));var rp=require(_0x3ea1('0x2'));var moment=require('moment');var BPromise=require(_0x3ea1('0x3'));var Mustache=require(_0x3ea1('0x4'));var util=require(_0x3ea1('0x5'));var path=require(_0x3ea1('0x6'));var sox=require(_0x3ea1('0x7'));var csv=require('to-csv');var ejs=require(_0x3ea1('0x8'));var fs=require('fs');var fs_extra=require(_0x3ea1('0x9'));var _=require('lodash');var squel=require(_0x3ea1('0xa'));var crypto=require(_0x3ea1('0xb'));var jsforce=require(_0x3ea1('0xc'));var deskjs=require(_0x3ea1('0xd'));var toCsv=require(_0x3ea1('0xe'));var querystring=require('querystring');var Papa=require(_0x3ea1('0xf'));var Redis=require(_0x3ea1('0x10'));var authService=require(_0x3ea1('0x11'));var qs=require(_0x3ea1('0x12'));var as=require(_0x3ea1('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x3ea1('0x14'))(_0x3ea1('0x15'));var utils=require(_0x3ea1('0x16'));var config=require(_0x3ea1('0x17'));var licenseUtil=require(_0x3ea1('0x18'));var db=require(_0x3ea1('0x19'))['db'];function respondWithStatusCode(_0x141d15,_0x589b1c){_0x589b1c=_0x589b1c||0xcc;return function(_0x27a275){if(_0x27a275){return _0x141d15[_0x3ea1('0x1a')](_0x589b1c);}return _0x141d15['status'](_0x589b1c)[_0x3ea1('0x1b')]();};}function respondWithResult(_0x47b191,_0x327c99){_0x327c99=_0x327c99||0xc8;return function(_0x310904){if(_0x310904){return _0x47b191[_0x3ea1('0x1c')](_0x327c99)[_0x3ea1('0x1d')](_0x310904);}};}function respondWithFilteredResult(_0x42350a,_0x2031e8){return function(_0x4ad791){if(_0x4ad791){var _0x5587f8=typeof _0x2031e8[_0x3ea1('0x1e')]===_0x3ea1('0x1f')&&typeof _0x2031e8[_0x3ea1('0x20')]===_0x3ea1('0x1f');var _0x147167=_0x4ad791[_0x3ea1('0x21')];var _0x1a6d58=_0x5587f8?0x0:_0x2031e8['offset'];var _0x37b48f=_0x5587f8?_0x4ad791['count']:_0x2031e8[_0x3ea1('0x1e')]+_0x2031e8[_0x3ea1('0x20')];var _0x39e202;if(_0x37b48f>=_0x147167){_0x37b48f=_0x147167;_0x39e202=0xc8;}else{_0x39e202=0xce;}_0x42350a['status'](_0x39e202);return _0x42350a[_0x3ea1('0x22')](_0x3ea1('0x23'),_0x1a6d58+'-'+_0x37b48f+'/'+_0x147167)[_0x3ea1('0x1d')](_0x4ad791);}return null;};}function patchUpdates(_0x4f503c){return function(_0x47db52){try{jsonpatch[_0x3ea1('0x24')](_0x47db52,_0x4f503c,!![]);}catch(_0x15f4c1){return BPromise[_0x3ea1('0x25')](_0x15f4c1);}return _0x47db52[_0x3ea1('0x26')]();};}function saveUpdates(_0x2e4d88,_0x27dab0){return function(_0x56dc7d){if(_0x56dc7d){return _0x56dc7d[_0x3ea1('0x27')](_0x2e4d88)[_0x3ea1('0x28')](function(_0x1f2303){return _0x1f2303;});}return null;};}function removeEntity(_0x4d9ac2,_0xdf0b1d){return function(_0x14bd4e){if(_0x14bd4e){return _0x14bd4e[_0x3ea1('0x29')]()[_0x3ea1('0x28')](function(){_0x4d9ac2[_0x3ea1('0x1c')](0xcc)[_0x3ea1('0x1b')]();});}};}function handleEntityNotFound(_0x4ff65a,_0x2c681a){return function(_0x423aaf){if(!_0x423aaf){_0x4ff65a['sendStatus'](0x194);}return _0x423aaf;};}function handleError(_0x329667,_0x1ee2c0){_0x1ee2c0=_0x1ee2c0||0x1f4;return function(_0xae4a34){logger[_0x3ea1('0x2a')](_0xae4a34[_0x3ea1('0x2b')]);if(_0xae4a34[_0x3ea1('0x2c')]){delete _0xae4a34[_0x3ea1('0x2c')];}_0x329667[_0x3ea1('0x1c')](_0x1ee2c0)[_0x3ea1('0x2d')](_0xae4a34);};}exports[_0x3ea1('0x2e')]=function(_0x416a43,_0x29ceec){var _0x34cdaa={},_0xdac7b4={},_0x2170b5={'count':0x0,'rows':[]};var _0x4fa657=_['map'](db[_0x3ea1('0x2f')][_0x3ea1('0x30')],function(_0x3a75c0){return{'name':_0x3a75c0[_0x3ea1('0x31')],'type':_0x3a75c0['type'][_0x3ea1('0x32')]};});_0xdac7b4['model']=_['map'](_0x4fa657,_0x3ea1('0x2c'));_0xdac7b4[_0x3ea1('0x33')]=_[_0x3ea1('0x34')](_0x416a43[_0x3ea1('0x33')]);_0xdac7b4[_0x3ea1('0x35')]=_['intersection'](_0xdac7b4[_0x3ea1('0x36')],_0xdac7b4[_0x3ea1('0x33')]);_0x34cdaa[_0x3ea1('0x37')]=_['intersection'](_0xdac7b4[_0x3ea1('0x36')],qs[_0x3ea1('0x38')](_0x416a43['query'][_0x3ea1('0x38')]));_0x34cdaa['attributes']=_0x34cdaa['attributes'][_0x3ea1('0x39')]?_0x34cdaa[_0x3ea1('0x37')]:_0xdac7b4[_0x3ea1('0x36')];if(!_0x416a43['query'][_0x3ea1('0x3a')](_0x3ea1('0x3b'))){_0x34cdaa[_0x3ea1('0x20')]=qs[_0x3ea1('0x20')](_0x416a43[_0x3ea1('0x33')][_0x3ea1('0x20')]);_0x34cdaa[_0x3ea1('0x1e')]=qs['offset'](_0x416a43[_0x3ea1('0x33')][_0x3ea1('0x1e')]);}_0x34cdaa['order']=qs[_0x3ea1('0x3c')](_0x416a43[_0x3ea1('0x33')][_0x3ea1('0x3c')]);_0x34cdaa['where']=qs[_0x3ea1('0x35')](_[_0x3ea1('0x3d')](_0x416a43[_0x3ea1('0x33')],_0xdac7b4['filters']),_0x4fa657);if(_0x416a43[_0x3ea1('0x33')][_0x3ea1('0x3e')]){_0x34cdaa[_0x3ea1('0x3f')]=_[_0x3ea1('0x40')](_0x34cdaa[_0x3ea1('0x3f')],{'$or':_[_0x3ea1('0x41')](_0x4fa657,function(_0x5d096a){if(_0x5d096a[_0x3ea1('0x42')]!==_0x3ea1('0x43')){var _0x2b2f4d={};_0x2b2f4d[_0x5d096a['name']]={'$like':'%'+_0x416a43[_0x3ea1('0x33')][_0x3ea1('0x3e')]+'%'};return _0x2b2f4d;}})});}_0x34cdaa=_[_0x3ea1('0x40')]({},_0x34cdaa,_0x416a43[_0x3ea1('0x44')]);var _0x1042d1={'where':_0x34cdaa['where']};return db[_0x3ea1('0x2f')][_0x3ea1('0x21')](_0x1042d1)[_0x3ea1('0x28')](function(_0x9270f7){_0x2170b5[_0x3ea1('0x21')]=_0x9270f7;if(_0x416a43[_0x3ea1('0x33')][_0x3ea1('0x45')]){_0x34cdaa['include']=[{'all':!![]}];}return db[_0x3ea1('0x2f')][_0x3ea1('0x46')](_0x34cdaa);})[_0x3ea1('0x28')](function(_0x5689f2){_0x2170b5['rows']=_0x5689f2;return _0x2170b5;})[_0x3ea1('0x28')](respondWithFilteredResult(_0x29ceec,_0x34cdaa))[_0x3ea1('0x47')](handleError(_0x29ceec,null));};exports[_0x3ea1('0x48')]=function(_0x5dd463,_0x3fddc7){var _0x32dc9e={'raw':!![],'where':{'id':_0x5dd463[_0x3ea1('0x49')]['id']}},_0x432400={};_0x432400[_0x3ea1('0x36')]=_[_0x3ea1('0x34')](db['VoiceDialReport'][_0x3ea1('0x30')]);_0x432400[_0x3ea1('0x33')]=_[_0x3ea1('0x34')](_0x5dd463['query']);_0x432400['filters']=_['intersection'](_0x432400['model'],_0x432400[_0x3ea1('0x33')]);_0x32dc9e[_0x3ea1('0x37')]=_[_0x3ea1('0x4a')](_0x432400[_0x3ea1('0x36')],qs[_0x3ea1('0x38')](_0x5dd463['query'][_0x3ea1('0x38')]));_0x32dc9e[_0x3ea1('0x37')]=_0x32dc9e['attributes'][_0x3ea1('0x39')]?_0x32dc9e['attributes']:_0x432400['model'];if(_0x5dd463[_0x3ea1('0x33')][_0x3ea1('0x45')]){_0x32dc9e['include']=[{'all':!![]}];}_0x32dc9e=_[_0x3ea1('0x40')]({},_0x32dc9e,_0x5dd463[_0x3ea1('0x44')]);return db[_0x3ea1('0x2f')][_0x3ea1('0x4b')](_0x32dc9e)[_0x3ea1('0x28')](handleEntityNotFound(_0x3fddc7,null))[_0x3ea1('0x28')](respondWithResult(_0x3fddc7,null))[_0x3ea1('0x47')](handleError(_0x3fddc7,null));};exports[_0x3ea1('0x4c')]=function(_0x3b62c6,_0x131895){return db['VoiceDialReport'][_0x3ea1('0x4c')](_0x3b62c6[_0x3ea1('0x4d')],{})[_0x3ea1('0x28')](respondWithResult(_0x131895,0xc9))[_0x3ea1('0x47')](handleError(_0x131895,null));};exports[_0x3ea1('0x27')]=function(_0x4baff5,_0x8ce54d){if(_0x4baff5['body']['id']){delete _0x4baff5[_0x3ea1('0x4d')]['id'];}return db[_0x3ea1('0x2f')][_0x3ea1('0x4b')]({'where':{'id':_0x4baff5[_0x3ea1('0x49')]['id']}})[_0x3ea1('0x28')](handleEntityNotFound(_0x8ce54d,null))[_0x3ea1('0x28')](saveUpdates(_0x4baff5[_0x3ea1('0x4d')],null))[_0x3ea1('0x28')](respondWithResult(_0x8ce54d,null))[_0x3ea1('0x47')](handleError(_0x8ce54d,null));};exports[_0x3ea1('0x29')]=function(_0x12042b,_0xa3b63a){return db[_0x3ea1('0x2f')][_0x3ea1('0x4b')]({'where':{'id':_0x12042b[_0x3ea1('0x49')]['id']}})[_0x3ea1('0x28')](handleEntityNotFound(_0xa3b63a,null))[_0x3ea1('0x28')](removeEntity(_0xa3b63a,null))['catch'](handleError(_0xa3b63a,null));};exports['describe']=function(_0x1aad33,_0x2cdf7c){return db[_0x3ea1('0x2f')][_0x3ea1('0x4e')]()[_0x3ea1('0x28')](respondWithResult(_0x2cdf7c,null))['catch'](handleError(_0x2cdf7c,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index e7a7af2..376783f 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 _0xdfea=['../../config/environment','exports','define','VoiceDialReport','report_dial','lodash','util','api','moment','request-promise','path','rimraf'];(function(_0x2c8ca5,_0xa2cef8){var _0x3d4343=function(_0x1d4650){while(--_0x1d4650){_0x2c8ca5['push'](_0x2c8ca5['shift']());}};_0x3d4343(++_0xa2cef8);}(_0xdfea,0x1cd));var _0xadfe=function(_0x5f0e1c,_0x3b9c21){_0x5f0e1c=_0x5f0e1c-0x0;var _0x4fd429=_0xdfea[_0x5f0e1c];return _0x4fd429;};'use strict';var _=require(_0xadfe('0x0'));var util=require(_0xadfe('0x1'));var logger=require('../../config/logger')(_0xadfe('0x2'));var moment=require(_0xadfe('0x3'));var BPromise=require('bluebird');var rp=require(_0xadfe('0x4'));var fs=require('fs');var path=require(_0xadfe('0x5'));var rimraf=require(_0xadfe('0x6'));var config=require(_0xadfe('0x7'));var attributes=require('./voiceDialReport.attributes');module[_0xadfe('0x8')]=function(_0x5670a9,_0x8b20ad){return _0x5670a9[_0xadfe('0x9')](_0xadfe('0xa'),attributes,{'tableName':_0xadfe('0xb'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0xae63=['path','../../config/environment','./voiceDialReport.attributes','VoiceDialReport','lodash','util','../../config/logger','bluebird','request-promise'];(function(_0x4cdcb9,_0x39b0e8){var _0x2a5445=function(_0x4f10af){while(--_0x4f10af){_0x4cdcb9['push'](_0x4cdcb9['shift']());}};_0x2a5445(++_0x39b0e8);}(_0xae63,0x16c));var _0x3ae6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xae63[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3ae6('0x0'));var util=require(_0x3ae6('0x1'));var logger=require(_0x3ae6('0x2'))('api');var moment=require('moment');var BPromise=require(_0x3ae6('0x3'));var rp=require(_0x3ae6('0x4'));var fs=require('fs');var path=require(_0x3ae6('0x5'));var rimraf=require('rimraf');var config=require(_0x3ae6('0x6'));var attributes=require(_0x3ae6('0x7'));module['exports']=function(_0x2c2da0,_0x162b04){return _0x2c2da0['define'](_0x3ae6('0x8'),attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 0bdb3d9..906303c 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 _0x25c7=['then','info','VoiceDialReport,\x20%s,\x20%s','request\x20sent','VoiceDialReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','body','options','raw','CreateVoiceDialReport','debug','stringify','VoiceDialReport','update','where','attributes','UpdateVoiceDialReport','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','request'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x25c7,0x10d));var _0x725c=function(_0x3b813c,_0x2c46a8){_0x3b813c=_0x3b813c-0x0;var _0x25a46c=_0x25c7[_0x3b813c];return _0x25a46c;};'use strict';var _=require(_0x725c('0x0'));var util=require(_0x725c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x725c('0x2'));var fs=require('fs');var Redis=require(_0x725c('0x3'));var db=require(_0x725c('0x4'))['db'];var utils=require(_0x725c('0x5'));var logger=require('../../config/logger')(_0x725c('0x6'));var config=require('../../config/environment');var jayson=require(_0x725c('0x7'));var client=jayson[_0x725c('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x208a55,_0x139cd2,_0x3e322f){return new BPromise(function(_0x2d4be1,_0xdfe864){return client[_0x725c('0x9')](_0x208a55,_0x3e322f)[_0x725c('0xa')](function(_0x3e6f5e){logger[_0x725c('0xb')](_0x725c('0xc'),_0x139cd2,_0x725c('0xd'));logger['debug'](_0x725c('0xe'),_0x139cd2,_0x725c('0xd'),JSON['stringify'](_0x3e6f5e));if(_0x3e6f5e[_0x725c('0xf')]){if(_0x3e6f5e[_0x725c('0xf')][_0x725c('0x10')]===0x1f4){logger[_0x725c('0xf')](_0x725c('0xc'),_0x139cd2,_0x3e6f5e[_0x725c('0xf')][_0x725c('0x11')]);return _0xdfe864(_0x3e6f5e[_0x725c('0xf')][_0x725c('0x11')]);}logger['error'](_0x725c('0xc'),_0x139cd2,_0x3e6f5e[_0x725c('0xf')][_0x725c('0x11')]);return _0x2d4be1(_0x3e6f5e['error'][_0x725c('0x11')]);}else{logger[_0x725c('0xb')]('VoiceDialReport,\x20%s,\x20%s',_0x139cd2,'request\x20sent');_0x2d4be1(_0x3e6f5e[_0x725c('0x12')][_0x725c('0x11')]);}})[_0x725c('0x13')](function(_0x48b06c){logger[_0x725c('0xf')](_0x725c('0xc'),_0x139cd2,_0x48b06c);_0xdfe864(_0x48b06c);});});}exports['CreateVoiceDialReport']=function(_0x249d6e){var _0x34b5a3=this;return new Promise(function(_0x54a1b8,_0x1a8dad){return db['VoiceDialReport']['create'](_0x249d6e[_0x725c('0x14')],{'raw':_0x249d6e[_0x725c('0x15')]?_0x249d6e[_0x725c('0x15')][_0x725c('0x16')]===undefined?!![]:![]:!![]})[_0x725c('0xa')](function(_0x16f3a4){logger[_0x725c('0xb')](_0x725c('0x17'),_0x249d6e);logger[_0x725c('0x18')](_0x725c('0x17'),_0x249d6e,JSON[_0x725c('0x19')](_0x16f3a4));_0x54a1b8(_0x16f3a4);})[_0x725c('0x13')](function(_0x4724ac){logger[_0x725c('0xf')](_0x725c('0x17'),_0x4724ac[_0x725c('0x11')],_0x249d6e);_0x1a8dad(_0x34b5a3[_0x725c('0xf')](0x1f4,_0x4724ac['message']));});});};exports['UpdateVoiceDialReport']=function(_0x3baf92){var _0x279195=this;return new Promise(function(_0x5bc216,_0x12b360){return db[_0x725c('0x1a')][_0x725c('0x1b')](_0x3baf92[_0x725c('0x14')],{'raw':_0x3baf92[_0x725c('0x15')]?_0x3baf92[_0x725c('0x15')][_0x725c('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3baf92[_0x725c('0x15')]?_0x3baf92['options'][_0x725c('0x1c')]||null:null,'attributes':_0x3baf92[_0x725c('0x15')]?_0x3baf92[_0x725c('0x15')][_0x725c('0x1d')]||null:null,'limit':_0x3baf92['options']?_0x3baf92[_0x725c('0x15')]['limit']||null:null})[_0x725c('0xa')](function(_0xe8554e){logger['info'](_0x725c('0x1e'),_0x3baf92);logger['debug'](_0x725c('0x1e'),_0x3baf92,JSON['stringify'](_0xe8554e));_0x5bc216(_0xe8554e);})[_0x725c('0x13')](function(_0x4d4d49){logger[_0x725c('0xf')](_0x725c('0x1e'),_0x4d4d49[_0x725c('0x11')],_0x3baf92);_0x12b360(_0x279195[_0x725c('0xf')](0x1f4,_0x4d4d49[_0x725c('0x11')]));});});}; \ No newline at end of file +var _0xac61=['../../config/logger','../../config/environment','jayson/promise','client','request','then','VoiceDialReport,\x20%s,\x20%s','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','options','raw','CreateVoiceDialReport','UpdateVoiceDialReport','VoiceDialReport','update','where','attributes','limit','lodash','moment','randomstring','../../mysqldb','../../config/utils'];(function(_0x7633c,_0x1e45bf){var _0x1b77e2=function(_0x4c3e7f){while(--_0x4c3e7f){_0x7633c['push'](_0x7633c['shift']());}};_0x1b77e2(++_0x1e45bf);}(_0xac61,0x1eb));var _0x1ac6=function(_0x575630,_0x110254){_0x575630=_0x575630-0x0;var _0x5c5305=_0xac61[_0x575630];return _0x5c5305;};'use strict';var _=require(_0x1ac6('0x0'));var util=require('util');var moment=require(_0x1ac6('0x1'));var BPromise=require('bluebird');var rs=require(_0x1ac6('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1ac6('0x3'))['db'];var utils=require(_0x1ac6('0x4'));var logger=require(_0x1ac6('0x5'))('rpc');var config=require(_0x1ac6('0x6'));var jayson=require(_0x1ac6('0x7'));var client=jayson[_0x1ac6('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x24ed75,_0xce3e1f,_0x2a2a8a){return new BPromise(function(_0x4699d0,_0x5a4fd4){return client[_0x1ac6('0x9')](_0x24ed75,_0x2a2a8a)[_0x1ac6('0xa')](function(_0x530dca){logger['info'](_0x1ac6('0xb'),_0xce3e1f,_0x1ac6('0xc'));logger[_0x1ac6('0xd')](_0x1ac6('0xe'),_0xce3e1f,_0x1ac6('0xc'),JSON[_0x1ac6('0xf')](_0x530dca));if(_0x530dca[_0x1ac6('0x10')]){if(_0x530dca['error'][_0x1ac6('0x11')]===0x1f4){logger['error'](_0x1ac6('0xb'),_0xce3e1f,_0x530dca['error'][_0x1ac6('0x12')]);return _0x5a4fd4(_0x530dca[_0x1ac6('0x10')][_0x1ac6('0x12')]);}logger[_0x1ac6('0x10')]('VoiceDialReport,\x20%s,\x20%s',_0xce3e1f,_0x530dca['error'][_0x1ac6('0x12')]);return _0x4699d0(_0x530dca[_0x1ac6('0x10')][_0x1ac6('0x12')]);}else{logger[_0x1ac6('0x13')](_0x1ac6('0xb'),_0xce3e1f,'request\x20sent');_0x4699d0(_0x530dca[_0x1ac6('0x14')][_0x1ac6('0x12')]);}})[_0x1ac6('0x15')](function(_0x4ec781){logger[_0x1ac6('0x10')](_0x1ac6('0xb'),_0xce3e1f,_0x4ec781);_0x5a4fd4(_0x4ec781);});});}exports['CreateVoiceDialReport']=function(_0x14baf0){var _0x16be29=this;return new Promise(function(_0x1c836e,_0xfc55db){return db['VoiceDialReport']['create'](_0x14baf0['body'],{'raw':_0x14baf0[_0x1ac6('0x16')]?_0x14baf0['options'][_0x1ac6('0x17')]===undefined?!![]:![]:!![]})[_0x1ac6('0xa')](function(_0x5d0b08){logger[_0x1ac6('0x13')](_0x1ac6('0x18'),_0x14baf0);logger['debug']('CreateVoiceDialReport',_0x14baf0,JSON['stringify'](_0x5d0b08));_0x1c836e(_0x5d0b08);})['catch'](function(_0x45159e){logger[_0x1ac6('0x10')](_0x1ac6('0x18'),_0x45159e['message'],_0x14baf0);_0xfc55db(_0x16be29[_0x1ac6('0x10')](0x1f4,_0x45159e[_0x1ac6('0x12')]));});});};exports[_0x1ac6('0x19')]=function(_0x4874c1){var _0x319ef6=this;return new Promise(function(_0x504b4e,_0x3a929c){return db[_0x1ac6('0x1a')][_0x1ac6('0x1b')](_0x4874c1['body'],{'raw':_0x4874c1[_0x1ac6('0x16')]?_0x4874c1[_0x1ac6('0x16')][_0x1ac6('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4874c1[_0x1ac6('0x16')]?_0x4874c1['options'][_0x1ac6('0x1c')]||null:null,'attributes':_0x4874c1[_0x1ac6('0x16')]?_0x4874c1[_0x1ac6('0x16')][_0x1ac6('0x1d')]||null:null,'limit':_0x4874c1['options']?_0x4874c1[_0x1ac6('0x16')][_0x1ac6('0x1e')]||null:null})['then'](function(_0x1177c7){logger[_0x1ac6('0x13')](_0x1ac6('0x19'),_0x4874c1);logger['debug'](_0x1ac6('0x19'),_0x4874c1,JSON['stringify'](_0x1177c7));_0x504b4e(_0x1177c7);})[_0x1ac6('0x15')](function(_0x42af01){logger[_0x1ac6('0x10')](_0x1ac6('0x19'),_0x42af01['message'],_0x4874c1);_0x3a929c(_0x319ef6[_0x1ac6('0x10')](0x1f4,_0x42af01['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index 044b6ca..3c01b7b 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 _0xcfc8=['../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','/:id','show','create','post','/:id/applications','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra'];(function(_0x27c102,_0x5ed674){var _0x2a0cf6=function(_0x24bb3f){while(--_0x24bb3f){_0x27c102['push'](_0x27c102['shift']());}};_0x2a0cf6(++_0x5ed674);}(_0xcfc8,0x113));var _0x8cfc=function(_0x1f12e8,_0x433310){_0x1f12e8=_0x1f12e8-0x0;var _0x221f06=_0xcfc8[_0x1f12e8];return _0x221f06;};'use strict';var multer=require(_0x8cfc('0x0'));var util=require(_0x8cfc('0x1'));var path=require('path');var timeout=require(_0x8cfc('0x2'));var express=require('express');var router=express[_0x8cfc('0x3')]();var fs_extra=require(_0x8cfc('0x4'));var auth=require(_0x8cfc('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x8cfc('0x6'));var controller=require(_0x8cfc('0x7'));router[_0x8cfc('0x8')]('/',auth[_0x8cfc('0x9')](),controller['index']);router[_0x8cfc('0x8')](_0x8cfc('0xa'),auth['isAuthenticated'](),controller[_0x8cfc('0xb')]);router['post']('/',auth[_0x8cfc('0x9')](),controller[_0x8cfc('0xc')]);router[_0x8cfc('0xd')](_0x8cfc('0xe'),auth[_0x8cfc('0x9')](),controller['addApplications']);router[_0x8cfc('0xf')]('/:id',auth[_0x8cfc('0x9')](),controller[_0x8cfc('0x10')]);router[_0x8cfc('0x11')](_0x8cfc('0xa'),auth[_0x8cfc('0x9')](),controller[_0x8cfc('0x12')]);module[_0x8cfc('0x13')]=router; \ No newline at end of file +var _0x7dbf=['put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','create','post','addApplications'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7dbf,0x1e8));var _0xf7db=function(_0x35c48c,_0x41d038){_0x35c48c=_0x35c48c-0x0;var _0x556dc6=_0x7dbf[_0x35c48c];return _0x556dc6;};'use strict';var multer=require(_0xf7db('0x0'));var util=require(_0xf7db('0x1'));var path=require(_0xf7db('0x2'));var timeout=require(_0xf7db('0x3'));var express=require(_0xf7db('0x4'));var router=express[_0xf7db('0x5')]();var fs_extra=require(_0xf7db('0x6'));var auth=require(_0xf7db('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf7db('0x8'));var controller=require(_0xf7db('0x9'));router[_0xf7db('0xa')]('/',auth[_0xf7db('0xb')](),controller[_0xf7db('0xc')]);router[_0xf7db('0xa')](_0xf7db('0xd'),auth[_0xf7db('0xb')](),controller[_0xf7db('0xe')]);router['post']('/',auth[_0xf7db('0xb')](),controller[_0xf7db('0xf')]);router[_0xf7db('0x10')]('/:id/applications',auth[_0xf7db('0xb')](),controller[_0xf7db('0x11')]);router[_0xf7db('0x12')]('/:id',auth[_0xf7db('0xb')](),controller[_0xf7db('0x13')]);router['delete'](_0xf7db('0xd'),auth[_0xf7db('0xb')](),controller[_0xf7db('0x14')]);module[_0xf7db('0x15')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 640ea0d..0c07f3d 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 _0xd8b0=['VIRTUAL','getDataValue','exten','sequelize','exports','compositeIndex','STRING','ENUM','inbound','outbound','inbound-fax','outbound-fax','any','*,*,*,*','INTEGER','BOOLEAN','wav'];(function(_0x41c003,_0x3c8ff9){var _0x3c5259=function(_0x2f50e3){while(--_0x2f50e3){_0x41c003['push'](_0x41c003['shift']());}};_0x3c5259(++_0x3c8ff9);}(_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')]={'context':{'type':Sequelize['STRING'],'allowNull':![],'unique':'compositeIndex','validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x0d8b('0x2')},'priority':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'1','unique':_0x0d8b('0x2')},'tag':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize['STRING'](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x0d8b('0x4')](_0x0d8b('0x5'),_0x0d8b('0x6'),'internal',_0x0d8b('0x7'),_0x0d8b('0x8'),'system',_0x0d8b('0x9')),'allowNull':![]},'description':{'type':Sequelize[_0x0d8b('0x3')]},'interval':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':![],'defaultValue':_0x0d8b('0xa')},'IntervalId':{'type':Sequelize[_0x0d8b('0xb')]},'isApp':{'type':Sequelize[_0x0d8b('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x0d8b('0x3')],'defaultValue':null},'callerID':{'type':Sequelize[_0x0d8b('0x3')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x0d8b('0xb')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x0d8b('0xd')},'answer':{'type':Sequelize[_0x0d8b('0xc')],'defaultValue':!![]},'name':{'type':Sequelize[_0x0d8b('0xe')],'get':function(_0x92cdd8){return this[_0x0d8b('0xf')](_0x0d8b('0x10'));}}}; \ No newline at end of file +var _0x0713=['STRING','compositeIndex','NoOp','ENUM','inbound','outbound','internal','inbound-fax','outbound-fax','system','any','*,*,*,*','INTEGER','BOOLEAN','wav','VIRTUAL','exten'];(function(_0x23a58e,_0x5ddede){var _0xa88f4a=function(_0x248d2e){while(--_0x248d2e){_0x23a58e['push'](_0x23a58e['shift']());}};_0xa88f4a(++_0x5ddede);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');module['exports']={'context':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'unique':_0x3071('0x1')},'priority':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'1','unique':'compositeIndex'},'tag':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x3071('0x0')],'allowNull':![],'defaultValue':_0x3071('0x2')},'appdata':{'type':Sequelize[_0x3071('0x0')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0x3071('0x3')](_0x3071('0x4'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa')),'allowNull':![]},'description':{'type':Sequelize[_0x3071('0x0')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x3071('0xb')},'IntervalId':{'type':Sequelize[_0x3071('0xc')]},'isApp':{'type':Sequelize[_0x3071('0xd')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x3071('0x0')],'defaultValue':null},'callerID':{'type':Sequelize[_0x3071('0x0')],'allowNull':!![]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x3071('0xc')]},'recordingFormat':{'type':Sequelize[_0x3071('0x0')],'defaultValue':_0x3071('0xe')},'answer':{'type':Sequelize[_0x3071('0xd')],'defaultValue':!![]},'name':{'type':Sequelize[_0x3071('0xf')],'get':function(_0x4a8cc7){return this['getDataValue'](_0x3071('0x10'));}}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 3fbdee0..2f0bc5e 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 _0x7a72=['internal','filter','ignore','value','type','find','UserProfileResource','name','send','index','map','VoiceExtension','rawAttributes','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','include','findAll','catch','params','options','create','body','startsWith','exten','concat','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','recordingFormat','mandatoryDisposition','findOne','sequelize','transaction','bulkCreate','cast(priority\x20as\x20unsigned)','rimraf','zip-dir','request-promise','bluebird','util','sox','ejs','fs-extra','crypto','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','update','then','destroy','get','InboundRoutes','inbound','OutboundRoutes','outbound','InternalRoutes'];(function(_0x3e5086,_0x48f4a2){var _0xfeb102=function(_0x5a945f){while(--_0x5a945f){_0x3e5086['push'](_0x3e5086['shift']());}};_0xfeb102(++_0x48f4a2);}(_0x7a72,0x1be));var _0x27a7=function(_0x97d83d,_0x15d475){_0x97d83d=_0x97d83d-0x0;var _0x43d7eb=_0x7a72[_0x97d83d];return _0x43d7eb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x27a7('0x0'));var zipdir=require(_0x27a7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x27a7('0x2'));var moment=require('moment');var BPromise=require(_0x27a7('0x3'));var Mustache=require('mustache');var util=require(_0x27a7('0x4'));var path=require('path');var sox=require(_0x27a7('0x5'));var csv=require('to-csv');var ejs=require(_0x27a7('0x6'));var fs=require('fs');var fs_extra=require(_0x27a7('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x27a7('0x8'));var jsforce=require('jsforce');var deskjs=require(_0x27a7('0x9'));var toCsv=require(_0x27a7('0xa'));var querystring=require(_0x27a7('0xb'));var Papa=require(_0x27a7('0xc'));var Redis=require('ioredis');var authService=require(_0x27a7('0xd'));var qs=require(_0x27a7('0xe'));var as=require(_0x27a7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x27a7('0x10'))(_0x27a7('0x11'));var utils=require('../../config/utils');var config=require(_0x27a7('0x12'));var licenseUtil=require(_0x27a7('0x13'));var db=require('../../mysqldb')['db'];config[_0x27a7('0x14')]=_[_0x27a7('0x15')](config[_0x27a7('0x14')],{'host':_0x27a7('0x16'),'port':0x18eb});var socket=require(_0x27a7('0x17'))(new Redis(config[_0x27a7('0x14')]));require('./voiceExtension.socket')['register'](socket);function respondWithStatusCode(_0x33881a,_0x50ae9f){_0x50ae9f=_0x50ae9f||0xcc;return function(_0x17b031){if(_0x17b031){return _0x33881a['sendStatus'](_0x50ae9f);}return _0x33881a[_0x27a7('0x18')](_0x50ae9f)[_0x27a7('0x19')]();};}function respondWithResult(_0xcd9791,_0xb1663d){_0xb1663d=_0xb1663d||0xc8;return function(_0x54b4cf){if(_0x54b4cf){return _0xcd9791['status'](_0xb1663d)[_0x27a7('0x1a')](_0x54b4cf);}};}function respondWithFilteredResult(_0x432080,_0x4ad772){return function(_0x41074f){if(_0x41074f){var _0x2c82ab=typeof _0x4ad772[_0x27a7('0x1b')]===_0x27a7('0x1c')&&typeof _0x4ad772[_0x27a7('0x1d')]==='undefined';var _0x113e8a=_0x41074f['count'];var _0x37ee7f=_0x2c82ab?0x0:_0x4ad772[_0x27a7('0x1b')];var _0x4de342=_0x2c82ab?_0x41074f[_0x27a7('0x1e')]:_0x4ad772['offset']+_0x4ad772[_0x27a7('0x1d')];var _0x5d5031;if(_0x4de342>=_0x113e8a){_0x4de342=_0x113e8a;_0x5d5031=0xc8;}else{_0x5d5031=0xce;}_0x432080[_0x27a7('0x18')](_0x5d5031);return _0x432080[_0x27a7('0x1f')](_0x27a7('0x20'),_0x37ee7f+'-'+_0x4de342+'/'+_0x113e8a)[_0x27a7('0x1a')](_0x41074f);}return null;};}function patchUpdates(_0x47b93c){return function(_0x5e143d){try{jsonpatch[_0x27a7('0x21')](_0x5e143d,_0x47b93c,!![]);}catch(_0xde9e67){return BPromise[_0x27a7('0x22')](_0xde9e67);}return _0x5e143d['save']();};}function saveUpdates(_0x2540e5,_0x351ef4){return function(_0x153bc7){if(_0x153bc7){return _0x153bc7[_0x27a7('0x23')](_0x2540e5)[_0x27a7('0x24')](function(_0x1b5128){return _0x1b5128;});}return null;};}function removeEntity(_0x39781f,_0x2c77ae){return function(_0x722f2b){if(_0x722f2b){return _0x722f2b[_0x27a7('0x25')]()[_0x27a7('0x24')](function(){var _0x517b8f=_0x722f2b[_0x27a7('0x26')]({'plain':!![]});var _0x439066=[{'name':_0x27a7('0x27'),'value':_0x27a7('0x28'),'ignore':![]},{'name':_0x27a7('0x29'),'value':_0x27a7('0x2a'),'ignore':![]},{'name':_0x27a7('0x2b'),'value':_0x27a7('0x2c'),'ignore':![]}];var _0x7fafc2=_(_0x439066)[_0x27a7('0x2d')](_0x27a7('0x2e'))['map'](_0x27a7('0x2f'))[_0x27a7('0x2f')]();if(_['includes'](_0x7fafc2,_0x517b8f[_0x27a7('0x30')])){return;}var _0x4dee69=_[_0x27a7('0x31')](_0x439066,[_0x27a7('0x2f'),_0x517b8f['type']])['name'];return db[_0x27a7('0x32')][_0x27a7('0x25')]({'where':{'type':_0x4dee69,'resourceId':_0x517b8f['id']}})[_0x27a7('0x24')](function(){return _0x722f2b;});})['then'](function(){_0x39781f[_0x27a7('0x18')](0xcc)[_0x27a7('0x19')]();});}};}function handleEntityNotFound(_0x4eab5d,_0x7eb84f){return function(_0x182d56){if(!_0x182d56){_0x4eab5d['sendStatus'](0x194);}return _0x182d56;};}function handleError(_0x53bdce,_0x2e4a43){_0x2e4a43=_0x2e4a43||0x1f4;return function(_0x5d6206){logger['error'](_0x5d6206['stack']);if(_0x5d6206['name']){delete _0x5d6206[_0x27a7('0x33')];}_0x53bdce['status'](_0x2e4a43)[_0x27a7('0x34')](_0x5d6206);};}exports[_0x27a7('0x35')]=function(_0x5a0d44,_0x55bd36){var _0x45c93c={},_0x50c61e={},_0x44d7c0={'count':0x0,'rows':[]};var _0x506c55=_[_0x27a7('0x36')](db[_0x27a7('0x37')][_0x27a7('0x38')],function(_0x3260af){return{'name':_0x3260af['fieldName'],'type':_0x3260af[_0x27a7('0x30')][_0x27a7('0x39')]};});_0x50c61e['model']=_[_0x27a7('0x36')](_0x506c55,_0x27a7('0x33'));_0x50c61e[_0x27a7('0x3a')]=_[_0x27a7('0x3b')](_0x5a0d44[_0x27a7('0x3a')]);_0x50c61e['filters']=_[_0x27a7('0x3c')](_0x50c61e['model'],_0x50c61e[_0x27a7('0x3a')]);_0x45c93c['attributes']=_[_0x27a7('0x3c')](_0x50c61e[_0x27a7('0x3d')],qs[_0x27a7('0x3e')](_0x5a0d44[_0x27a7('0x3a')][_0x27a7('0x3e')]));_0x45c93c['attributes']=_0x45c93c[_0x27a7('0x3f')][_0x27a7('0x40')]?_0x45c93c[_0x27a7('0x3f')]:_0x50c61e[_0x27a7('0x3d')];if(!_0x5a0d44[_0x27a7('0x3a')][_0x27a7('0x41')](_0x27a7('0x42'))){_0x45c93c[_0x27a7('0x1d')]=qs[_0x27a7('0x1d')](_0x5a0d44['query']['limit']);_0x45c93c[_0x27a7('0x1b')]=qs[_0x27a7('0x1b')](_0x5a0d44[_0x27a7('0x3a')]['offset']);}_0x45c93c[_0x27a7('0x43')]=qs[_0x27a7('0x44')](_0x5a0d44[_0x27a7('0x3a')][_0x27a7('0x44')]);_0x45c93c[_0x27a7('0x45')]=qs['filters'](_[_0x27a7('0x46')](_0x5a0d44[_0x27a7('0x3a')],_0x50c61e[_0x27a7('0x47')]),_0x506c55);if(_0x5a0d44['query'][_0x27a7('0x2d')]){_0x45c93c[_0x27a7('0x45')]=_[_0x27a7('0x48')](_0x45c93c[_0x27a7('0x45')],{'$or':_[_0x27a7('0x36')](_0x506c55,function(_0x365ce8){if(_0x365ce8[_0x27a7('0x30')]!=='VIRTUAL'){var _0x34f1af={};_0x34f1af[_0x365ce8[_0x27a7('0x33')]]={'$like':'%'+_0x5a0d44[_0x27a7('0x3a')][_0x27a7('0x2d')]+'%'};return _0x34f1af;}})});}_0x45c93c=_[_0x27a7('0x48')]({},_0x45c93c,_0x5a0d44['options']);var _0xe4703f={'where':_0x45c93c['where']};return db[_0x27a7('0x37')][_0x27a7('0x1e')](_0xe4703f)['then'](function(_0x1b2faa){_0x44d7c0[_0x27a7('0x1e')]=_0x1b2faa;if(_0x5a0d44['query']['includeAll']){_0x45c93c[_0x27a7('0x49')]=[{'all':!![]}];}return db[_0x27a7('0x37')][_0x27a7('0x4a')](_0x45c93c);})[_0x27a7('0x24')](function(_0x1a9891){_0x44d7c0['rows']=_0x1a9891;return _0x44d7c0;})['then'](respondWithFilteredResult(_0x55bd36,_0x45c93c))[_0x27a7('0x4b')](handleError(_0x55bd36,null));};exports['show']=function(_0x2c126b,_0x18edfb){var _0x2a99b4={'raw':![],'where':{'id':_0x2c126b[_0x27a7('0x4c')]['id']}},_0x2987e8={};_0x2987e8[_0x27a7('0x3d')]=_['keys'](db[_0x27a7('0x37')]['rawAttributes']);_0x2987e8[_0x27a7('0x3a')]=_[_0x27a7('0x3b')](_0x2c126b[_0x27a7('0x3a')]);_0x2987e8[_0x27a7('0x47')]=_[_0x27a7('0x3c')](_0x2987e8['model'],_0x2987e8['query']);_0x2a99b4[_0x27a7('0x3f')]=_['intersection'](_0x2987e8[_0x27a7('0x3d')],qs[_0x27a7('0x3e')](_0x2c126b['query'][_0x27a7('0x3e')]));_0x2a99b4[_0x27a7('0x3f')]=_0x2a99b4['attributes'][_0x27a7('0x40')]?_0x2a99b4['attributes']:_0x2987e8[_0x27a7('0x3d')];if(_0x2c126b[_0x27a7('0x3a')]['includeAll']){_0x2a99b4['include']=[{'all':!![]}];}_0x2a99b4=_[_0x27a7('0x48')]({},_0x2a99b4,_0x2c126b[_0x27a7('0x4d')]);return db[_0x27a7('0x37')][_0x27a7('0x31')](_0x2a99b4)[_0x27a7('0x24')](handleEntityNotFound(_0x18edfb,null))[_0x27a7('0x24')](respondWithResult(_0x18edfb,null))[_0x27a7('0x4b')](handleError(_0x18edfb,null));};exports[_0x27a7('0x25')]=function(_0x48f0ed,_0x4ab6e0){return db[_0x27a7('0x37')][_0x27a7('0x31')]({'where':{'id':_0x48f0ed[_0x27a7('0x4c')]['id']}})[_0x27a7('0x24')](handleEntityNotFound(_0x4ab6e0,null))[_0x27a7('0x24')](removeEntity(_0x4ab6e0,null))[_0x27a7('0x4b')](handleError(_0x4ab6e0,null));};exports[_0x27a7('0x4e')]=function(_0x1a7686,_0x228908){if(_0x1a7686[_0x27a7('0x4f')]['type']==='outbound'&&!_[_0x27a7('0x50')](_0x1a7686[_0x27a7('0x4f')][_0x27a7('0x51')],'_')){_0x1a7686[_0x27a7('0x4f')]['exten']='_'[_0x27a7('0x52')](_0x1a7686[_0x27a7('0x4f')][_0x27a7('0x51')]);}return db[_0x27a7('0x37')][_0x27a7('0x4e')](_0x1a7686[_0x27a7('0x4f')],{'raw':![]})[_0x27a7('0x24')](function(_0x175d6f){var _0x56efe3=_0x1a7686[_0x27a7('0x53')][_0x27a7('0x26')]({'plain':!![]});if(!_0x56efe3)throw new Error(_0x27a7('0x54'));if(_0x56efe3[_0x27a7('0x55')]===_0x27a7('0x53')){var _0x3fbfb4=_0x175d6f[_0x27a7('0x26')]({'plain':!![]});var _0x5514b5=[{'name':_0x27a7('0x27'),'value':'inbound'},{'name':_0x27a7('0x29'),'value':_0x27a7('0x2a')},{'name':'InternalRoutes','value':_0x27a7('0x2c')}];var _0x1b6892=_[_0x27a7('0x31')](_0x5514b5,[_0x27a7('0x2f'),_0x3fbfb4[_0x27a7('0x30')]])[_0x27a7('0x33')];return db[_0x27a7('0x56')][_0x27a7('0x31')]({'where':{'name':_0x1b6892,'userProfileId':_0x56efe3['userProfileId']},'raw':!![]})[_0x27a7('0x24')](function(_0x5cfd87){if(_0x5cfd87&&_0x5cfd87[_0x27a7('0x57')]===0x0){return db[_0x27a7('0x32')]['create']({'name':_0x3fbfb4[_0x27a7('0x33')],'resourceId':_0x3fbfb4['id'],'type':_0x5cfd87['name'],'sectionId':_0x5cfd87['id']},{})[_0x27a7('0x24')](function(){return _0x175d6f;});}else{return _0x175d6f;}})['catch'](function(_0x2aeedc){logger[_0x27a7('0x58')](_0x27a7('0x59'),_0x2aeedc);throw _0x2aeedc;});}return _0x175d6f;})[_0x27a7('0x24')](respondWithResult(_0x228908,0xc9))[_0x27a7('0x4b')](handleError(_0x228908,null));};exports[_0x27a7('0x23')]=function(_0x4cb430,_0x3178f4){if(_0x4cb430['body']['id']){delete _0x4cb430[_0x27a7('0x4f')]['id'];}return db[_0x27a7('0x37')][_0x27a7('0x31')]({'where':{'id':_0x4cb430[_0x27a7('0x4c')]['id']}})[_0x27a7('0x24')](handleEntityNotFound(_0x3178f4,null))[_0x27a7('0x24')](function(_0xc5b400){if(_0xc5b400){return db[_0x27a7('0x37')][_0x27a7('0x23')](_[_0x27a7('0x46')](_0x4cb430[_0x27a7('0x4f')],[_0x27a7('0x51'),_0x27a7('0x5a'),'description',_0x27a7('0x5b'),'cutdigits',_0x27a7('0x5c')]),{'where':{'context':_0xc5b400[_0x27a7('0x5a')],'exten':_0xc5b400[_0x27a7('0x51')]},'individualHooks':!![]})[_0x27a7('0x24')](function(_0x592659){return _0x592659;});}return null;})[_0x27a7('0x24')](respondWithStatusCode(_0x3178f4,null))[_0x27a7('0x4b')](handleError(_0x3178f4,null));};exports['addApplications']=function(_0x47b142,_0xe30a90,_0x471f41){return db['VoiceExtension'][_0x27a7('0x5d')]({'where':{'id':_0x47b142[_0x27a7('0x4c')]['id']}})[_0x27a7('0x24')](handleEntityNotFound(_0xe30a90,null))['then'](function(_0x3dfd6c){if(_0x3dfd6c){return db[_0x27a7('0x5e')][_0x27a7('0x5f')](function(_0xaf38f1){return db[_0x27a7('0x37')][_0x27a7('0x25')]({'where':{'VoiceExtensionId':_0x47b142['params']['id']},'transaction':_0xaf38f1})[_0x27a7('0x24')](function(_0x51102b){var _0x5a69cb=_[_0x27a7('0x36')](_0x47b142[_0x27a7('0x4f')],function(_0x4281aa){_0x4281aa['VoiceExtensionId']=_0x47b142[_0x27a7('0x4c')]['id'];return _0x4281aa;});return db[_0x27a7('0x37')][_0x27a7('0x60')](_0x5a69cb,{'transaction':_0xaf38f1});});})[_0x27a7('0x24')](function(){return db[_0x27a7('0x37')]['findAndCountAll']({'where':{'isApp':!![],'VoiceExtensionId':_0x47b142['params']['id']},'order':_0x27a7('0x61')});});}})[_0x27a7('0x24')](respondWithResult(_0xe30a90,null))['catch'](handleError(_0xe30a90,null));}; \ No newline at end of file +var _0xfc76=['offset','undefined','count','set','json','save','update','then','destroy','get','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','name','UserProfileResource','end','error','stack','send','index','rawAttributes','fieldName','model','filters','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','sort','where','pick','merge','VIRTUAL','options','VoiceExtension','includeAll','include','catch','show','params','keys','find','create','body','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','InboundRoutes','internal','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','description','recordingFormat','cutdigits','mandatoryDisposition','addApplications','findOne','transaction','findAndCountAll','cast(priority\x20as\x20unsigned)','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status'];(function(_0x195afb,_0x32eeb1){var _0x4321ce=function(_0x9dc2a1){while(--_0x9dc2a1){_0x195afb['push'](_0x195afb['shift']());}};_0x4321ce(++_0x32eeb1);}(_0xfc76,0xb5));var _0x6fc7=function(_0x73a382,_0x1bbf98){_0x73a382=_0x73a382-0x0;var _0x15088d=_0xfc76[_0x73a382];return _0x15088d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6fc7('0x0'));var zipdir=require(_0x6fc7('0x1'));var jsonpatch=require(_0x6fc7('0x2'));var rp=require(_0x6fc7('0x3'));var moment=require(_0x6fc7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x6fc7('0x5'));var util=require(_0x6fc7('0x6'));var path=require('path');var sox=require(_0x6fc7('0x7'));var csv=require('to-csv');var ejs=require(_0x6fc7('0x8'));var fs=require('fs');var fs_extra=require(_0x6fc7('0x9'));var _=require(_0x6fc7('0xa'));var squel=require('squel');var crypto=require(_0x6fc7('0xb'));var jsforce=require(_0x6fc7('0xc'));var deskjs=require(_0x6fc7('0xd'));var toCsv=require(_0x6fc7('0xe'));var querystring=require(_0x6fc7('0xf'));var Papa=require(_0x6fc7('0x10'));var Redis=require('ioredis');var authService=require(_0x6fc7('0x11'));var qs=require(_0x6fc7('0x12'));var as=require(_0x6fc7('0x13'));var hardwareService=require(_0x6fc7('0x14'));var logger=require(_0x6fc7('0x15'))(_0x6fc7('0x16'));var utils=require('../../config/utils');var config=require(_0x6fc7('0x17'));var licenseUtil=require(_0x6fc7('0x18'));var db=require('../../mysqldb')['db'];config[_0x6fc7('0x19')]=_[_0x6fc7('0x1a')](config['redis'],{'host':_0x6fc7('0x1b'),'port':0x18eb});var socket=require(_0x6fc7('0x1c'))(new Redis(config['redis']));require(_0x6fc7('0x1d'))[_0x6fc7('0x1e')](socket);function respondWithStatusCode(_0x10a482,_0x4faed7){_0x4faed7=_0x4faed7||0xcc;return function(_0x556e28){if(_0x556e28){return _0x10a482[_0x6fc7('0x1f')](_0x4faed7);}return _0x10a482[_0x6fc7('0x20')](_0x4faed7)['end']();};}function respondWithResult(_0x2b0122,_0x15e4db){_0x15e4db=_0x15e4db||0xc8;return function(_0x124cd6){if(_0x124cd6){return _0x2b0122[_0x6fc7('0x20')](_0x15e4db)['json'](_0x124cd6);}};}function respondWithFilteredResult(_0x816704,_0x69ea70){return function(_0x280c69){if(_0x280c69){var _0x62ec76=typeof _0x69ea70[_0x6fc7('0x21')]===_0x6fc7('0x22')&&typeof _0x69ea70['limit']===_0x6fc7('0x22');var _0x124893=_0x280c69[_0x6fc7('0x23')];var _0x3bd771=_0x62ec76?0x0:_0x69ea70[_0x6fc7('0x21')];var _0x526dba=_0x62ec76?_0x280c69[_0x6fc7('0x23')]:_0x69ea70[_0x6fc7('0x21')]+_0x69ea70['limit'];var _0x17b9e3;if(_0x526dba>=_0x124893){_0x526dba=_0x124893;_0x17b9e3=0xc8;}else{_0x17b9e3=0xce;}_0x816704['status'](_0x17b9e3);return _0x816704[_0x6fc7('0x24')]('Content-Range',_0x3bd771+'-'+_0x526dba+'/'+_0x124893)[_0x6fc7('0x25')](_0x280c69);}return null;};}function patchUpdates(_0xdb5974){return function(_0x1bfa75){try{jsonpatch['apply'](_0x1bfa75,_0xdb5974,!![]);}catch(_0x45e53e){return BPromise['reject'](_0x45e53e);}return _0x1bfa75[_0x6fc7('0x26')]();};}function saveUpdates(_0xdd4827,_0x2229a1){return function(_0x1e79b9){if(_0x1e79b9){return _0x1e79b9[_0x6fc7('0x27')](_0xdd4827)[_0x6fc7('0x28')](function(_0x190680){return _0x190680;});}return null;};}function removeEntity(_0x817221,_0x2b6b55){return function(_0x2759ad){if(_0x2759ad){return _0x2759ad[_0x6fc7('0x29')]()[_0x6fc7('0x28')](function(){var _0x4612d4=_0x2759ad[_0x6fc7('0x2a')]({'plain':!![]});var _0x232324=[{'name':'InboundRoutes','value':_0x6fc7('0x2b'),'ignore':![]},{'name':_0x6fc7('0x2c'),'value':_0x6fc7('0x2d'),'ignore':![]},{'name':_0x6fc7('0x2e'),'value':'internal','ignore':![]}];var _0xfff989=_(_0x232324)[_0x6fc7('0x2f')](_0x6fc7('0x30'))[_0x6fc7('0x31')](_0x6fc7('0x32'))[_0x6fc7('0x32')]();if(_[_0x6fc7('0x33')](_0xfff989,_0x4612d4[_0x6fc7('0x34')])){return;}var _0x59a70e=_['find'](_0x232324,[_0x6fc7('0x32'),_0x4612d4[_0x6fc7('0x34')]])[_0x6fc7('0x35')];return db[_0x6fc7('0x36')][_0x6fc7('0x29')]({'where':{'type':_0x59a70e,'resourceId':_0x4612d4['id']}})[_0x6fc7('0x28')](function(){return _0x2759ad;});})['then'](function(){_0x817221[_0x6fc7('0x20')](0xcc)[_0x6fc7('0x37')]();});}};}function handleEntityNotFound(_0x16c514,_0x197a54){return function(_0x5a6355){if(!_0x5a6355){_0x16c514['sendStatus'](0x194);}return _0x5a6355;};}function handleError(_0x4973d6,_0xb80178){_0xb80178=_0xb80178||0x1f4;return function(_0x23bd52){logger[_0x6fc7('0x38')](_0x23bd52[_0x6fc7('0x39')]);if(_0x23bd52[_0x6fc7('0x35')]){delete _0x23bd52[_0x6fc7('0x35')];}_0x4973d6[_0x6fc7('0x20')](_0xb80178)[_0x6fc7('0x3a')](_0x23bd52);};}exports[_0x6fc7('0x3b')]=function(_0x54e5d5,_0x13c800){var _0x549b27={},_0x40ee9c={},_0x10ea08={'count':0x0,'rows':[]};var _0x3c2167=_[_0x6fc7('0x31')](db['VoiceExtension'][_0x6fc7('0x3c')],function(_0x3245a8){return{'name':_0x3245a8[_0x6fc7('0x3d')],'type':_0x3245a8[_0x6fc7('0x34')]['key']};});_0x40ee9c[_0x6fc7('0x3e')]=_['map'](_0x3c2167,_0x6fc7('0x35'));_0x40ee9c['query']=_['keys'](_0x54e5d5['query']);_0x40ee9c[_0x6fc7('0x3f')]=_['intersection'](_0x40ee9c[_0x6fc7('0x3e')],_0x40ee9c[_0x6fc7('0x40')]);_0x549b27[_0x6fc7('0x41')]=_[_0x6fc7('0x42')](_0x40ee9c[_0x6fc7('0x3e')],qs[_0x6fc7('0x43')](_0x54e5d5[_0x6fc7('0x40')][_0x6fc7('0x43')]));_0x549b27[_0x6fc7('0x41')]=_0x549b27[_0x6fc7('0x41')][_0x6fc7('0x44')]?_0x549b27[_0x6fc7('0x41')]:_0x40ee9c[_0x6fc7('0x3e')];if(!_0x54e5d5[_0x6fc7('0x40')][_0x6fc7('0x45')](_0x6fc7('0x46'))){_0x549b27[_0x6fc7('0x47')]=qs[_0x6fc7('0x47')](_0x54e5d5['query']['limit']);_0x549b27[_0x6fc7('0x21')]=qs[_0x6fc7('0x21')](_0x54e5d5[_0x6fc7('0x40')][_0x6fc7('0x21')]);}_0x549b27['order']=qs[_0x6fc7('0x48')](_0x54e5d5[_0x6fc7('0x40')][_0x6fc7('0x48')]);_0x549b27[_0x6fc7('0x49')]=qs[_0x6fc7('0x3f')](_[_0x6fc7('0x4a')](_0x54e5d5[_0x6fc7('0x40')],_0x40ee9c[_0x6fc7('0x3f')]),_0x3c2167);if(_0x54e5d5[_0x6fc7('0x40')][_0x6fc7('0x2f')]){_0x549b27[_0x6fc7('0x49')]=_[_0x6fc7('0x4b')](_0x549b27['where'],{'$or':_[_0x6fc7('0x31')](_0x3c2167,function(_0x4426aa){if(_0x4426aa['type']!==_0x6fc7('0x4c')){var _0x33fe8f={};_0x33fe8f[_0x4426aa[_0x6fc7('0x35')]]={'$like':'%'+_0x54e5d5[_0x6fc7('0x40')][_0x6fc7('0x2f')]+'%'};return _0x33fe8f;}})});}_0x549b27=_[_0x6fc7('0x4b')]({},_0x549b27,_0x54e5d5[_0x6fc7('0x4d')]);var _0x201621={'where':_0x549b27[_0x6fc7('0x49')]};return db[_0x6fc7('0x4e')]['count'](_0x201621)[_0x6fc7('0x28')](function(_0x338f45){_0x10ea08['count']=_0x338f45;if(_0x54e5d5['query'][_0x6fc7('0x4f')]){_0x549b27[_0x6fc7('0x50')]=[{'all':!![]}];}return db[_0x6fc7('0x4e')]['findAll'](_0x549b27);})[_0x6fc7('0x28')](function(_0xfe850e){_0x10ea08['rows']=_0xfe850e;return _0x10ea08;})[_0x6fc7('0x28')](respondWithFilteredResult(_0x13c800,_0x549b27))[_0x6fc7('0x51')](handleError(_0x13c800,null));};exports[_0x6fc7('0x52')]=function(_0x36f67c,_0x322fc4){var _0x2b24e8={'raw':![],'where':{'id':_0x36f67c[_0x6fc7('0x53')]['id']}},_0x10bc97={};_0x10bc97[_0x6fc7('0x3e')]=_[_0x6fc7('0x54')](db[_0x6fc7('0x4e')]['rawAttributes']);_0x10bc97['query']=_['keys'](_0x36f67c['query']);_0x10bc97[_0x6fc7('0x3f')]=_['intersection'](_0x10bc97[_0x6fc7('0x3e')],_0x10bc97[_0x6fc7('0x40')]);_0x2b24e8[_0x6fc7('0x41')]=_[_0x6fc7('0x42')](_0x10bc97[_0x6fc7('0x3e')],qs[_0x6fc7('0x43')](_0x36f67c['query'][_0x6fc7('0x43')]));_0x2b24e8[_0x6fc7('0x41')]=_0x2b24e8['attributes'][_0x6fc7('0x44')]?_0x2b24e8[_0x6fc7('0x41')]:_0x10bc97[_0x6fc7('0x3e')];if(_0x36f67c[_0x6fc7('0x40')][_0x6fc7('0x4f')]){_0x2b24e8[_0x6fc7('0x50')]=[{'all':!![]}];}_0x2b24e8=_[_0x6fc7('0x4b')]({},_0x2b24e8,_0x36f67c[_0x6fc7('0x4d')]);return db[_0x6fc7('0x4e')][_0x6fc7('0x55')](_0x2b24e8)['then'](handleEntityNotFound(_0x322fc4,null))[_0x6fc7('0x28')](respondWithResult(_0x322fc4,null))[_0x6fc7('0x51')](handleError(_0x322fc4,null));};exports[_0x6fc7('0x29')]=function(_0x4d8b75,_0x44105e){return db['VoiceExtension'][_0x6fc7('0x55')]({'where':{'id':_0x4d8b75['params']['id']}})[_0x6fc7('0x28')](handleEntityNotFound(_0x44105e,null))[_0x6fc7('0x28')](removeEntity(_0x44105e,null))[_0x6fc7('0x51')](handleError(_0x44105e,null));};exports[_0x6fc7('0x56')]=function(_0x3e37d6,_0x3b6fe4){if(_0x3e37d6[_0x6fc7('0x57')][_0x6fc7('0x34')]==='outbound'&&!_[_0x6fc7('0x58')](_0x3e37d6[_0x6fc7('0x57')][_0x6fc7('0x59')],'_')){_0x3e37d6[_0x6fc7('0x57')][_0x6fc7('0x59')]='_'['concat'](_0x3e37d6[_0x6fc7('0x57')][_0x6fc7('0x59')]);}return db[_0x6fc7('0x4e')][_0x6fc7('0x56')](_0x3e37d6[_0x6fc7('0x57')],{'raw':![]})[_0x6fc7('0x28')](function(_0x2c0966){var _0x43e462=_0x3e37d6[_0x6fc7('0x5a')][_0x6fc7('0x2a')]({'plain':!![]});if(!_0x43e462)throw new Error(_0x6fc7('0x5b'));if(_0x43e462['role']===_0x6fc7('0x5a')){var _0x150963=_0x2c0966[_0x6fc7('0x2a')]({'plain':!![]});var _0xb3d8d3=[{'name':_0x6fc7('0x5c'),'value':_0x6fc7('0x2b')},{'name':_0x6fc7('0x2c'),'value':_0x6fc7('0x2d')},{'name':'InternalRoutes','value':_0x6fc7('0x5d')}];var _0x578c08=_['find'](_0xb3d8d3,['value',_0x150963[_0x6fc7('0x34')]])[_0x6fc7('0x35')];return db[_0x6fc7('0x5e')]['find']({'where':{'name':_0x578c08,'userProfileId':_0x43e462['userProfileId']},'raw':!![]})[_0x6fc7('0x28')](function(_0x5a6411){if(_0x5a6411&&_0x5a6411[_0x6fc7('0x5f')]===0x0){return db[_0x6fc7('0x36')][_0x6fc7('0x56')]({'name':_0x150963[_0x6fc7('0x35')],'resourceId':_0x150963['id'],'type':_0x5a6411[_0x6fc7('0x35')],'sectionId':_0x5a6411['id']},{})[_0x6fc7('0x28')](function(){return _0x2c0966;});}else{return _0x2c0966;}})[_0x6fc7('0x51')](function(_0x22e569){logger[_0x6fc7('0x38')](_0x6fc7('0x60'),_0x22e569);throw _0x22e569;});}return _0x2c0966;})['then'](respondWithResult(_0x3b6fe4,0xc9))[_0x6fc7('0x51')](handleError(_0x3b6fe4,null));};exports[_0x6fc7('0x27')]=function(_0x4abd97,_0x4bdf0c){if(_0x4abd97['body']['id']){delete _0x4abd97[_0x6fc7('0x57')]['id'];}return db[_0x6fc7('0x4e')][_0x6fc7('0x55')]({'where':{'id':_0x4abd97[_0x6fc7('0x53')]['id']}})[_0x6fc7('0x28')](handleEntityNotFound(_0x4bdf0c,null))[_0x6fc7('0x28')](function(_0x4a484e){if(_0x4a484e){return db[_0x6fc7('0x4e')][_0x6fc7('0x27')](_['pick'](_0x4abd97['body'],[_0x6fc7('0x59'),_0x6fc7('0x61'),_0x6fc7('0x62'),_0x6fc7('0x63'),_0x6fc7('0x64'),_0x6fc7('0x65')]),{'where':{'context':_0x4a484e[_0x6fc7('0x61')],'exten':_0x4a484e[_0x6fc7('0x59')]},'individualHooks':!![]})[_0x6fc7('0x28')](function(_0xbeec61){return _0xbeec61;});}return null;})['then'](respondWithStatusCode(_0x4bdf0c,null))[_0x6fc7('0x51')](handleError(_0x4bdf0c,null));};exports[_0x6fc7('0x66')]=function(_0xa1fb1d,_0x51c9c5,_0x5ea113){return db[_0x6fc7('0x4e')][_0x6fc7('0x67')]({'where':{'id':_0xa1fb1d[_0x6fc7('0x53')]['id']}})[_0x6fc7('0x28')](handleEntityNotFound(_0x51c9c5,null))[_0x6fc7('0x28')](function(_0xf0bf9d){if(_0xf0bf9d){return db['sequelize'][_0x6fc7('0x68')](function(_0x52d6bf){return db[_0x6fc7('0x4e')][_0x6fc7('0x29')]({'where':{'VoiceExtensionId':_0xa1fb1d['params']['id']},'transaction':_0x52d6bf})[_0x6fc7('0x28')](function(_0xfc441e){var _0x22e023=_[_0x6fc7('0x31')](_0xa1fb1d[_0x6fc7('0x57')],function(_0x1dc338){_0x1dc338['VoiceExtensionId']=_0xa1fb1d['params']['id'];return _0x1dc338;});return db[_0x6fc7('0x4e')]['bulkCreate'](_0x22e023,{'transaction':_0x52d6bf});});})[_0x6fc7('0x28')](function(){return db['VoiceExtension'][_0x6fc7('0x69')]({'where':{'isApp':!![],'VoiceExtensionId':_0xa1fb1d[_0x6fc7('0x53')]['id']},'order':_0x6fc7('0x6a')});});}})[_0x6fc7('0x28')](respondWithResult(_0x51c9c5,null))[_0x6fc7('0x51')](handleError(_0x51c9c5,null));}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index 4a12c4c..a645a2d 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 _0xf3b6=['update','emit','hook','exports','../../mysqldb','setMaxListeners','save'];(function(_0x3fb300,_0x391a56){var _0x35c2a3=function(_0xc6cee8){while(--_0xc6cee8){_0x3fb300['push'](_0x3fb300['shift']());}};_0x35c2a3(++_0x391a56);}(_0xf3b6,0x170));var _0x6f3b=function(_0x3914bd,_0x19a8f3){_0x3914bd=_0x3914bd-0x0;var _0x2a9edd=_0xf3b6[_0x3914bd];return _0x2a9edd;};'use strict';var EventEmitter=require('events');var VoiceExtension=require(_0x6f3b('0x0'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x6f3b('0x1')](0x0);var events={'afterCreate':_0x6f3b('0x2'),'afterUpdate':_0x6f3b('0x3'),'afterDestroy':'remove'};function emitEvent(_0x241836){return function(_0x47d89f,_0x26ac22,_0x461586){VoiceExtensionEvents[_0x6f3b('0x4')](_0x241836+':'+_0x47d89f['id'],_0x47d89f);VoiceExtensionEvents[_0x6f3b('0x4')](_0x241836,_0x47d89f);_0x461586(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x6f3b('0x5')](e,emitEvent(event));}}module[_0x6f3b('0x6')]=VoiceExtensionEvents; \ No newline at end of file +var _0x8a58=['hook','exports','events','../../mysqldb','VoiceExtension','remove','emit'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x8a58,0x152));var _0x88a5=function(_0x2640bd,_0x25fbb7){_0x2640bd=_0x2640bd-0x0;var _0x1ceece=_0x8a58[_0x2640bd];return _0x1ceece;};'use strict';var EventEmitter=require(_0x88a5('0x0'));var VoiceExtension=require(_0x88a5('0x1'))['db'][_0x88a5('0x2')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x88a5('0x3')};function emitEvent(_0x316173){return function(_0x40b206,_0x131bde,_0x53d6c3){VoiceExtensionEvents[_0x88a5('0x4')](_0x316173+':'+_0x40b206['id'],_0x40b206);VoiceExtensionEvents[_0x88a5('0x4')](_0x316173,_0x40b206);_0x53d6c3(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceExtension[_0x88a5('0x5')](e,emitEvent(event));}}module[_0x88a5('0x6')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 8909627..8e22c61 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 _0x18fb=['rimraf','./voiceExtension.attributes','exports','define','voice_extensions','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x226c9a,_0x94983e){var _0x35c45e=function(_0x4222f6){while(--_0x4222f6){_0x226c9a['push'](_0x226c9a['shift']());}};_0x35c45e(++_0x94983e);}(_0x18fb,0x119));var _0xb18f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x18fb[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb18f('0x0'));var logger=require(_0xb18f('0x1'))(_0xb18f('0x2'));var moment=require(_0xb18f('0x3'));var BPromise=require(_0xb18f('0x4'));var rp=require(_0xb18f('0x5'));var fs=require('fs');var path=require(_0xb18f('0x6'));var rimraf=require(_0xb18f('0x7'));var config=require('../../config/environment');var attributes=require(_0xb18f('0x8'));module[_0xb18f('0x9')]=function(_0x14e241,_0x23332d){return _0x14e241[_0xb18f('0xa')]('VoiceExtension',attributes,{'tableName':_0xb18f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd200=['define','VoiceExtension','voice_extensions','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceExtension.attributes','exports'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd200,0x1bd));var _0x0d20=function(_0x5f09c5,_0x2bfca0){_0x5f09c5=_0x5f09c5-0x0;var _0x426ad9=_0xd200[_0x5f09c5];return _0x426ad9;};'use strict';var _=require(_0x0d20('0x0'));var util=require('util');var logger=require(_0x0d20('0x1'))(_0x0d20('0x2'));var moment=require(_0x0d20('0x3'));var BPromise=require(_0x0d20('0x4'));var rp=require(_0x0d20('0x5'));var fs=require('fs');var path=require(_0x0d20('0x6'));var rimraf=require(_0x0d20('0x7'));var config=require('../../config/environment');var attributes=require(_0x0d20('0x8'));module[_0x0d20('0x9')]=function(_0x13a14a,_0x467c9e){return _0x13a14a[_0x0d20('0xa')](_0x0d20('0xb'),attributes,{'tableName':_0x0d20('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 323ab88..631768a 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 _0xfb8f=['util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceExtension.socket','request','info','VoiceExtension,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','GetVoiceExtension','findAll','options','raw','where','attributes','include','map','model','then'];(function(_0x433098,_0x5c9515){var _0x49111e=function(_0x3fc54c){while(--_0x3fc54c){_0x433098['push'](_0x433098['shift']());}};_0x49111e(++_0x5c9515);}(_0xfb8f,0x18c));var _0xffb8=function(_0x314802,_0x1f9faa){_0x314802=_0x314802-0x0;var _0x1babf0=_0xfb8f[_0x314802];return _0x1babf0;};'use strict';var _=require('lodash');var util=require(_0xffb8('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xffb8('0x1'));var fs=require('fs');var Redis=require(_0xffb8('0x2'));var db=require(_0xffb8('0x3'))['db'];var utils=require(_0xffb8('0x4'));var logger=require(_0xffb8('0x5'))('rpc');var config=require(_0xffb8('0x6'));var jayson=require(_0xffb8('0x7'));var client=jayson[_0xffb8('0x8')][_0xffb8('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0xffb8('0xa')],{'host':_0xffb8('0xb'),'port':0x18eb});var socket=require(_0xffb8('0xc'))(new Redis(config[_0xffb8('0xa')]));require(_0xffb8('0xd'))['register'](socket);function respondWithRpcPromise(_0x4e3508,_0x3dbb54,_0x2fcc2f){return new BPromise(function(_0x1614b5,_0x2b2197){return client[_0xffb8('0xe')](_0x4e3508,_0x2fcc2f)['then'](function(_0x1eabeb){logger[_0xffb8('0xf')](_0xffb8('0x10'),_0x3dbb54,_0xffb8('0x11'));logger[_0xffb8('0x12')]('VoiceExtension,\x20%s,\x20%s,\x20%s',_0x3dbb54,_0xffb8('0x11'),JSON[_0xffb8('0x13')](_0x1eabeb));if(_0x1eabeb[_0xffb8('0x14')]){if(_0x1eabeb['error'][_0xffb8('0x15')]===0x1f4){logger['error']('VoiceExtension,\x20%s,\x20%s',_0x3dbb54,_0x1eabeb[_0xffb8('0x14')][_0xffb8('0x16')]);return _0x2b2197(_0x1eabeb[_0xffb8('0x14')][_0xffb8('0x16')]);}logger[_0xffb8('0x14')](_0xffb8('0x10'),_0x3dbb54,_0x1eabeb[_0xffb8('0x14')][_0xffb8('0x16')]);return _0x1614b5(_0x1eabeb[_0xffb8('0x14')]['message']);}else{logger['info'](_0xffb8('0x10'),_0x3dbb54,'request\x20sent');_0x1614b5(_0x1eabeb['result']['message']);}})['catch'](function(_0x377463){logger[_0xffb8('0x14')](_0xffb8('0x10'),_0x3dbb54,_0x377463);_0x2b2197(_0x377463);});});}exports[_0xffb8('0x17')]=function(_0x4bc00e){var _0x44dd67=this;return new Promise(function(_0x2f7863,_0x2c9e1c){return db['VoiceExtension'][_0xffb8('0x18')]({'raw':_0x4bc00e['options']?_0x4bc00e[_0xffb8('0x19')][_0xffb8('0x1a')]===undefined?!![]:![]:!![],'where':_0x4bc00e['options']?_0x4bc00e[_0xffb8('0x19')][_0xffb8('0x1b')]||null:null,'attributes':_0x4bc00e[_0xffb8('0x19')]?_0x4bc00e[_0xffb8('0x19')][_0xffb8('0x1c')]||null:null,'limit':_0x4bc00e[_0xffb8('0x19')]?_0x4bc00e[_0xffb8('0x19')]['limit']||null:null,'include':_0x4bc00e[_0xffb8('0x19')]?_0x4bc00e['options'][_0xffb8('0x1d')]?_[_0xffb8('0x1e')](_0x4bc00e['options']['include'],function(_0x10927d){return{'model':db[_0x10927d[_0xffb8('0x1f')]],'as':_0x10927d['as'],'attributes':_0x10927d['attributes'],'include':_0x10927d[_0xffb8('0x1d')]?_[_0xffb8('0x1e')](_0x10927d['include'],function(_0x454ecf){return{'model':db[_0x454ecf['model']],'as':_0x454ecf['as'],'attributes':_0x454ecf['attributes'],'include':_0x454ecf[_0xffb8('0x1d')]?_[_0xffb8('0x1e')](_0x454ecf[_0xffb8('0x1d')],function(_0x52e150){return{'model':db[_0x52e150['model']],'as':_0x52e150['as'],'attributes':_0x52e150[_0xffb8('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xffb8('0x20')](function(_0xe77a39){logger[_0xffb8('0xf')](_0xffb8('0x17'),_0x4bc00e);logger[_0xffb8('0x12')]('GetVoiceExtension',_0x4bc00e,JSON[_0xffb8('0x13')](_0xe77a39));_0x2f7863(_0xe77a39);})['catch'](function(_0x14680d){logger[_0xffb8('0x14')]('GetVoiceExtension',_0x14680d[_0xffb8('0x16')],_0x4bc00e);_0x2c9e1c(_0x44dd67[_0xffb8('0x14')](0x1f4,_0x14680d[_0xffb8('0x16')]));});});}; \ No newline at end of file +var _0x37a7=['VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','findAll','options','where','attributes','map','include','model','lodash','util','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x46d8ba,_0x56079d){var _0x4e3f17=function(_0xe1b512){while(--_0xe1b512){_0x46d8ba['push'](_0x46d8ba['shift']());}};_0x4e3f17(++_0x56079d);}(_0x37a7,0x6f));var _0x737a=function(_0x2d9c8b,_0x528c12){_0x2d9c8b=_0x2d9c8b-0x0;var _0x58252d=_0x37a7[_0x2d9c8b];return _0x58252d;};'use strict';var _=require(_0x737a('0x0'));var util=require(_0x737a('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x737a('0x2'));var db=require(_0x737a('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x737a('0x4'));var jayson=require(_0x737a('0x5'));var client=jayson[_0x737a('0x6')][_0x737a('0x7')]({'port':0x232a});config[_0x737a('0x8')]=_['defaults'](config[_0x737a('0x8')],{'host':_0x737a('0x9'),'port':0x18eb});var socket=require(_0x737a('0xa'))(new Redis(config[_0x737a('0x8')]));require('./voiceExtension.socket')[_0x737a('0xb')](socket);function respondWithRpcPromise(_0x862e5c,_0x5ad258,_0x2b1c32){return new BPromise(function(_0x192e18,_0x27a721){return client[_0x737a('0xc')](_0x862e5c,_0x2b1c32)[_0x737a('0xd')](function(_0x27ccd9){logger[_0x737a('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x5ad258,_0x737a('0xf'));logger[_0x737a('0x10')](_0x737a('0x11'),_0x5ad258,_0x737a('0xf'),JSON[_0x737a('0x12')](_0x27ccd9));if(_0x27ccd9[_0x737a('0x13')]){if(_0x27ccd9[_0x737a('0x13')][_0x737a('0x14')]===0x1f4){logger['error'](_0x737a('0x15'),_0x5ad258,_0x27ccd9[_0x737a('0x13')]['message']);return _0x27a721(_0x27ccd9['error'][_0x737a('0x16')]);}logger[_0x737a('0x13')](_0x737a('0x15'),_0x5ad258,_0x27ccd9[_0x737a('0x13')][_0x737a('0x16')]);return _0x192e18(_0x27ccd9[_0x737a('0x13')]['message']);}else{logger[_0x737a('0xe')]('VoiceExtension,\x20%s,\x20%s',_0x5ad258,_0x737a('0xf'));_0x192e18(_0x27ccd9[_0x737a('0x17')]['message']);}})[_0x737a('0x18')](function(_0x4c015f){logger['error'](_0x737a('0x15'),_0x5ad258,_0x4c015f);_0x27a721(_0x4c015f);});});}exports[_0x737a('0x19')]=function(_0x4eed38){var _0x470d2d=this;return new Promise(function(_0x295fe1,_0x8d8378){return db['VoiceExtension'][_0x737a('0x1a')]({'raw':_0x4eed38['options']?_0x4eed38[_0x737a('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x4eed38[_0x737a('0x1b')]?_0x4eed38[_0x737a('0x1b')][_0x737a('0x1c')]||null:null,'attributes':_0x4eed38[_0x737a('0x1b')]?_0x4eed38[_0x737a('0x1b')][_0x737a('0x1d')]||null:null,'limit':_0x4eed38[_0x737a('0x1b')]?_0x4eed38[_0x737a('0x1b')]['limit']||null:null,'include':_0x4eed38['options']?_0x4eed38[_0x737a('0x1b')]['include']?_[_0x737a('0x1e')](_0x4eed38['options'][_0x737a('0x1f')],function(_0x1d1642){return{'model':db[_0x1d1642[_0x737a('0x20')]],'as':_0x1d1642['as'],'attributes':_0x1d1642[_0x737a('0x1d')],'include':_0x1d1642[_0x737a('0x1f')]?_['map'](_0x1d1642[_0x737a('0x1f')],function(_0xff0afc){return{'model':db[_0xff0afc[_0x737a('0x20')]],'as':_0xff0afc['as'],'attributes':_0xff0afc[_0x737a('0x1d')],'include':_0xff0afc[_0x737a('0x1f')]?_[_0x737a('0x1e')](_0xff0afc[_0x737a('0x1f')],function(_0x5a3590){return{'model':db[_0x5a3590[_0x737a('0x20')]],'as':_0x5a3590['as'],'attributes':_0x5a3590[_0x737a('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x737a('0xd')](function(_0x34d20e){logger[_0x737a('0xe')]('GetVoiceExtension',_0x4eed38);logger[_0x737a('0x10')](_0x737a('0x19'),_0x4eed38,JSON[_0x737a('0x12')](_0x34d20e));_0x295fe1(_0x34d20e);})[_0x737a('0x18')](function(_0x50b09f){logger[_0x737a('0x13')](_0x737a('0x19'),_0x50b09f[_0x737a('0x16')],_0x4eed38);_0x8d8378(_0x470d2d[_0x737a('0x13')](0x1f4,_0x50b09f[_0x737a('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 415ed49..a8bc8aa 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 _0xf494=['save','remove','emit','removeListener','register','voiceExtension:','./voiceExtension.events'];(function(_0x1aecfa,_0x3d92cc){var _0x23b6ba=function(_0x27b452){while(--_0x27b452){_0x1aecfa['push'](_0x1aecfa['shift']());}};_0x23b6ba(++_0x3d92cc);}(_0xf494,0x1c6));var _0x4f49=function(_0x530a4d,_0x325c2e){_0x530a4d=_0x530a4d-0x0;var _0x361dd1=_0xf494[_0x530a4d];return _0x361dd1;};'use strict';var VoiceExtensionEvents=require(_0x4f49('0x0'));var events=[_0x4f49('0x1'),_0x4f49('0x2'),'update'];function createListener(_0x3aeeb8,_0x1d54cc){return function(_0x423b25){_0x1d54cc[_0x4f49('0x3')](_0x3aeeb8,_0x423b25);};}function removeListener(_0x20c0d7,_0x2a15fb){return function(){VoiceExtensionEvents[_0x4f49('0x4')](_0x20c0d7,_0x2a15fb);};}exports[_0x4f49('0x5')]=function(_0xc5e778){for(var _0x413530=0x0,_0x42b0e8=events['length'];_0x413530<_0x42b0e8;_0x413530++){var _0x58e9a0=events[_0x413530];var _0x169c95=createListener(_0x4f49('0x6')+_0x58e9a0,_0xc5e778);VoiceExtensionEvents['on'](_0x58e9a0,_0x169c95);}}; \ No newline at end of file +var _0x7a54=['remove','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save'];(function(_0x2488d1,_0x44b1cd){var _0x4b005b=function(_0x895663){while(--_0x895663){_0x2488d1['push'](_0x2488d1['shift']());}};_0x4b005b(++_0x44b1cd);}(_0x7a54,0x106));var _0x47a5=function(_0x5dc387,_0x3d16cb){_0x5dc387=_0x5dc387-0x0;var _0xbe0f9e=_0x7a54[_0x5dc387];return _0xbe0f9e;};'use strict';var VoiceExtensionEvents=require(_0x47a5('0x0'));var events=[_0x47a5('0x1'),_0x47a5('0x2'),'update'];function createListener(_0x1d33e,_0x4086cd){return function(_0x4880bf){_0x4086cd[_0x47a5('0x3')](_0x1d33e,_0x4880bf);};}function removeListener(_0x11bf85,_0x2a1a7e){return function(){VoiceExtensionEvents[_0x47a5('0x4')](_0x11bf85,_0x2a1a7e);};}exports[_0x47a5('0x5')]=function(_0x545a97){for(var _0x3d5629=0x0,_0x59199c=events[_0x47a5('0x6')];_0x3d5629<_0x59199c;_0x3d5629++){var _0x30e405=events[_0x3d5629];var _0x506eda=createListener(_0x47a5('0x7')+_0x30e405,_0x545a97);VoiceExtensionEvents['on'](_0x30e405,_0x506eda);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index f83b9fa..c7ea229 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 _0x6d11=['put','update','delete','destroy','multer','util','path','express','fs-extra','../../components/auth/service','./voiceMail.controller','get','isAuthenticated','index','/:id','getMessages','post'];(function(_0x2a40b3,_0xe1c253){var _0x4ac6cb=function(_0x5083fe){while(--_0x5083fe){_0x2a40b3['push'](_0x2a40b3['shift']());}};_0x4ac6cb(++_0xe1c253);}(_0x6d11,0xbf));var _0x16d1=function(_0x2990d9,_0xc3fcb6){_0x2990d9=_0x2990d9-0x0;var _0x1303cb=_0x6d11[_0x2990d9];return _0x1303cb;};'use strict';var multer=require(_0x16d1('0x0'));var util=require(_0x16d1('0x1'));var path=require(_0x16d1('0x2'));var timeout=require('connect-timeout');var express=require(_0x16d1('0x3'));var router=express['Router']();var fs_extra=require(_0x16d1('0x4'));var auth=require(_0x16d1('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x16d1('0x6'));router[_0x16d1('0x7')]('/',auth[_0x16d1('0x8')](),controller[_0x16d1('0x9')]);router[_0x16d1('0x7')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller['show']);router['get']('/:id/messages',auth[_0x16d1('0x8')](),controller[_0x16d1('0xb')]);router[_0x16d1('0xc')]('/',auth[_0x16d1('0x8')](),controller['create']);router[_0x16d1('0xd')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller[_0x16d1('0xe')]);router[_0x16d1('0xf')](_0x16d1('0xa'),auth[_0x16d1('0x8')](),controller[_0x16d1('0x10')]);module['exports']=router; \ No newline at end of file +var _0x4888=['/:id/messages','post','create','put','update','delete','/:id','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x4888,0x198));var _0x8488=function(_0x159b6b,_0x52d23f){_0x159b6b=_0x159b6b-0x0;var _0x2dceb3=_0x4888[_0x159b6b];return _0x2dceb3;};'use strict';var multer=require('multer');var util=require(_0x8488('0x0'));var path=require(_0x8488('0x1'));var timeout=require(_0x8488('0x2'));var express=require(_0x8488('0x3'));var router=express[_0x8488('0x4')]();var fs_extra=require(_0x8488('0x5'));var auth=require(_0x8488('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x8488('0x7'));var controller=require(_0x8488('0x8'));router[_0x8488('0x9')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xb')]);router[_0x8488('0x9')]('/:id',auth['isAuthenticated'](),controller['show']);router['get'](_0x8488('0xc'),auth[_0x8488('0xa')](),controller['getMessages']);router[_0x8488('0xd')]('/',auth[_0x8488('0xa')](),controller[_0x8488('0xe')]);router[_0x8488('0xf')]('/:id',auth[_0x8488('0xa')](),controller[_0x8488('0x10')]);router[_0x8488('0x11')](_0x8488('0x12'),auth[_0x8488('0xa')](),controller['destroy']);module[_0x8488('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 b0387ca..3a71395 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 _0xa0bf=['contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','exports','STRING','from-voicemail'];(function(_0x14f031,_0x45b753){var _0x43363e=function(_0x5eb78b){while(--_0x5eb78b){_0x14f031['push'](_0x14f031['shift']());}};_0x43363e(++_0x45b753);}(_0xa0bf,0x74));var _0xfa0b=function(_0x52a3c8,_0x5bbfef){_0x52a3c8=_0x52a3c8-0x0;var _0x360827=_0xa0bf[_0x52a3c8];return _0x360827;};'use strict';var Sequelize=require('sequelize');module[_0xfa0b('0x0')]={'customer_id':{'type':Sequelize[_0xfa0b('0x1')]},'context':{'type':Sequelize[_0xfa0b('0x1')],'defaultValue':_0xfa0b('0x2'),'unique':'contest_mailbox'},'mailbox':{'type':Sequelize[_0xfa0b('0x1')],'defaultValue':'','allowNull':![],'unique':_0xfa0b('0x3')},'password':{'type':Sequelize[_0xfa0b('0x1')]},'fullname':{'type':Sequelize[_0xfa0b('0x1')]},'email':{'type':Sequelize[_0xfa0b('0x1')],'validate':{'isEmail':!![]},'set':function(_0x3ff369){this[_0xfa0b('0x4')]('email',typeof _0x3ff369===_0xfa0b('0x5')&&_0x3ff369[_0xfa0b('0x6')]()?_0x3ff369[_0xfa0b('0x6')]():null);}},'pager':{'type':Sequelize[_0xfa0b('0x1')]},'tz':{'type':Sequelize[_0xfa0b('0x1')],'defaultValue':_0xfa0b('0x7')},'attach':{'type':Sequelize[_0xfa0b('0x8')](_0xfa0b('0x9'),'no'),'defaultValue':_0xfa0b('0x9'),'allowNull':![]},'saycid':{'type':Sequelize[_0xfa0b('0x8')](_0xfa0b('0x9'),'no'),'defaultValue':_0xfa0b('0x9'),'allowNull':![]},'dialout':{'type':Sequelize[_0xfa0b('0x1')]},'callback':{'type':Sequelize[_0xfa0b('0x1')]},'review':{'type':Sequelize['ENUM'](_0xfa0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xfa0b('0x8')](_0xfa0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM'](_0xfa0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xfa0b('0x8')](_0xfa0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xfa0b('0xa'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xfa0b('0x8')](_0xfa0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xfa0b('0x8')](_0xfa0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xfa0b('0x8')]('yes','no'),'defaultValue':_0xfa0b('0x9'),'allowNull':![]},'forcename':{'type':Sequelize['ENUM'](_0xfa0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0xfa0b('0x8')](_0xfa0b('0x9'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xfa0b('0x8')](_0xfa0b('0x9'),'no'),'defaultValue':_0xfa0b('0x9'),'allowNull':![]},'stamp':{'type':_0xfa0b('0xb')},'emailsubject':{'type':Sequelize['STRING']},'emailbody':{'type':Sequelize[_0xfa0b('0x1')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xfa0b('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xfa0b('0xd')],'get':function(){return this[_0xfa0b('0xe')](_0xfa0b('0xf'))+_0xfa0b('0x10')+this['getDataValue']('mailbox');}}}; \ No newline at end of file +var _0x7f02=['contest_mailbox','setDataValue','string','trim','central','ENUM','yes','TINYINT(4)','TIMESTAMP','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','mailbox','sequelize','exports','STRING','from-voicemail'];(function(_0x3d887d,_0x55d1eb){var _0x4b7a75=function(_0x2df584){while(--_0x2df584){_0x3d887d['push'](_0x3d887d['shift']());}};_0x4b7a75(++_0x55d1eb);}(_0x7f02,0xf3));var _0x27f0=function(_0x35decb,_0x2c7932){_0x35decb=_0x35decb-0x0;var _0xca0580=_0x7f02[_0x35decb];return _0xca0580;};'use strict';var Sequelize=require(_0x27f0('0x0'));module[_0x27f0('0x1')]={'customer_id':{'type':Sequelize[_0x27f0('0x2')]},'context':{'type':Sequelize[_0x27f0('0x2')],'defaultValue':_0x27f0('0x3'),'unique':_0x27f0('0x4')},'mailbox':{'type':Sequelize[_0x27f0('0x2')],'defaultValue':'','allowNull':![],'unique':_0x27f0('0x4')},'password':{'type':Sequelize[_0x27f0('0x2')]},'fullname':{'type':Sequelize[_0x27f0('0x2')]},'email':{'type':Sequelize[_0x27f0('0x2')],'validate':{'isEmail':!![]},'set':function(_0x1e9eee){this[_0x27f0('0x5')]('email',typeof _0x1e9eee===_0x27f0('0x6')&&_0x1e9eee[_0x27f0('0x7')]()?_0x1e9eee['trim']():null);}},'pager':{'type':Sequelize[_0x27f0('0x2')]},'tz':{'type':Sequelize['STRING'],'defaultValue':_0x27f0('0x8')},'attach':{'type':Sequelize[_0x27f0('0x9')](_0x27f0('0xa'),'no'),'defaultValue':_0x27f0('0xa'),'allowNull':![]},'saycid':{'type':Sequelize['ENUM'](_0x27f0('0xa'),'no'),'defaultValue':_0x27f0('0xa'),'allowNull':![]},'dialout':{'type':Sequelize[_0x27f0('0x2')]},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize['ENUM'](_0x27f0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0x27f0('0x9')](_0x27f0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0x27f0('0x9')](_0x27f0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0x27f0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0x27f0('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0x27f0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0x27f0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize['ENUM'](_0x27f0('0xa'),'no'),'defaultValue':_0x27f0('0xa'),'allowNull':![]},'forcename':{'type':Sequelize[_0x27f0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize[_0x27f0('0x9')]('yes','no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0x27f0('0x9')](_0x27f0('0xa'),'no'),'defaultValue':_0x27f0('0xa'),'allowNull':![]},'stamp':{'type':_0x27f0('0xc')},'emailsubject':{'type':Sequelize[_0x27f0('0x2')]},'emailbody':{'type':Sequelize[_0x27f0('0x2')]},'maxsecs':{'type':Sequelize[_0x27f0('0xd')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0x27f0('0xd')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0x27f0('0xe')],'get':function(){return this[_0x27f0('0xf')](_0x27f0('0x10'))+_0x27f0('0x11')+this[_0x27f0('0xf')](_0x27f0('0x12'));}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index cc6f508..466cb40 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 _0x3266=['create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Voicemails','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getMessages','findOne','nolimit','mailbox','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','get','error','stack','name','send','index','VoiceMail','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','length','find'];(function(_0x1a2748,_0x58fdb4){var _0x51d3ae=function(_0x1c1685){while(--_0x1c1685){_0x1a2748['push'](_0x1a2748['shift']());}};_0x51d3ae(++_0x58fdb4);}(_0x3266,0x6a));var _0x6326=function(_0x4ff09b,_0x53f67d){_0x4ff09b=_0x4ff09b-0x0;var _0x3f5c2e=_0x3266[_0x4ff09b];return _0x3f5c2e;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){var _0x72d020=_0x2d0d00[_0x6326('0x27')]({'plain':!![]});var _0x575701='Voicemails';return db['UserProfileResource'][_0x6326('0x26')]({'where':{'type':_0x575701,'resourceId':_0x72d020['id']}})['then'](function(){return _0x2d0d00;});})[_0x6326('0x25')](function(){_0x429bb0[_0x6326('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x15e33d,_0x21ec69){return function(_0xb68fec){if(!_0xb68fec){_0x15e33d[_0x6326('0x1c')](0x194);}return _0xb68fec;};}function handleError(_0x2d2180,_0x45d037){_0x45d037=_0x45d037||0x1f4;return function(_0x40e036){logger[_0x6326('0x28')](_0x40e036[_0x6326('0x29')]);if(_0x40e036[_0x6326('0x2a')]){delete _0x40e036[_0x6326('0x2a')];}_0x2d2180[_0x6326('0x1d')](_0x45d037)[_0x6326('0x2b')](_0x40e036);};}exports[_0x6326('0x2c')]=function(_0x2e0445,_0x20c5ab){var _0x520e57={},_0x2bf5ef={},_0x47303c={'count':0x0,'rows':[]};var _0x1f8982=_['map'](db[_0x6326('0x2d')]['rawAttributes'],function(_0x4e703a){return{'name':_0x4e703a[_0x6326('0x2e')],'type':_0x4e703a[_0x6326('0x2f')][_0x6326('0x30')]};});_0x2bf5ef[_0x6326('0x31')]=_[_0x6326('0x32')](_0x1f8982,_0x6326('0x2a'));_0x2bf5ef[_0x6326('0x33')]=_[_0x6326('0x34')](_0x2e0445[_0x6326('0x33')]);_0x2bf5ef[_0x6326('0x35')]=_[_0x6326('0x36')](_0x2bf5ef[_0x6326('0x31')],_0x2bf5ef['query']);_0x520e57[_0x6326('0x37')]=_[_0x6326('0x36')](_0x2bf5ef['model'],qs[_0x6326('0x38')](_0x2e0445[_0x6326('0x33')][_0x6326('0x38')]));_0x520e57['attributes']=_0x520e57[_0x6326('0x37')]['length']?_0x520e57['attributes']:_0x2bf5ef[_0x6326('0x31')];if(!_0x2e0445[_0x6326('0x33')][_0x6326('0x39')]('nolimit')){_0x520e57[_0x6326('0x3a')]=qs['limit'](_0x2e0445[_0x6326('0x33')]['limit']);_0x520e57[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x2e0445[_0x6326('0x33')][_0x6326('0x1f')]);}_0x520e57[_0x6326('0x3b')]=qs[_0x6326('0x3c')](_0x2e0445['query'][_0x6326('0x3c')]);_0x520e57[_0x6326('0x3d')]=qs['filters'](_[_0x6326('0x3e')](_0x2e0445['query'],_0x2bf5ef['filters']),_0x1f8982);if(_0x2e0445[_0x6326('0x33')][_0x6326('0x3f')]){_0x520e57[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x520e57[_0x6326('0x3d')],{'$or':_[_0x6326('0x32')](_0x1f8982,function(_0x5de1c3){if(_0x5de1c3['type']!==_0x6326('0x41')){var _0x5b68af={};_0x5b68af[_0x5de1c3[_0x6326('0x2a')]]={'$like':'%'+_0x2e0445['query'][_0x6326('0x3f')]+'%'};return _0x5b68af;}})});}_0x520e57=_[_0x6326('0x40')]({},_0x520e57,_0x2e0445[_0x6326('0x42')]);var _0x1da798={'where':_0x520e57[_0x6326('0x3d')]};return db[_0x6326('0x2d')][_0x6326('0x20')](_0x1da798)[_0x6326('0x25')](function(_0x3b089b){_0x47303c[_0x6326('0x20')]=_0x3b089b;if(_0x2e0445[_0x6326('0x33')]['includeAll']){_0x520e57[_0x6326('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x6326('0x44')](_0x520e57);})[_0x6326('0x25')](function(_0x16fc33){_0x47303c[_0x6326('0x45')]=_0x16fc33;return _0x47303c;})['then'](respondWithFilteredResult(_0x20c5ab,_0x520e57))[_0x6326('0x46')](handleError(_0x20c5ab,null));};exports[_0x6326('0x47')]=function(_0x562d5f,_0x12703d){var _0xe6a992={'raw':!![],'where':{'id':_0x562d5f[_0x6326('0x48')]['id']}},_0x7a5057={};_0x7a5057['model']=_[_0x6326('0x34')](db[_0x6326('0x2d')][_0x6326('0x49')]);_0x7a5057[_0x6326('0x33')]=_[_0x6326('0x34')](_0x562d5f[_0x6326('0x33')]);_0x7a5057[_0x6326('0x35')]=_['intersection'](_0x7a5057[_0x6326('0x31')],_0x7a5057[_0x6326('0x33')]);_0xe6a992[_0x6326('0x37')]=_[_0x6326('0x36')](_0x7a5057['model'],qs[_0x6326('0x38')](_0x562d5f['query'][_0x6326('0x38')]));_0xe6a992[_0x6326('0x37')]=_0xe6a992[_0x6326('0x37')][_0x6326('0x4a')]?_0xe6a992[_0x6326('0x37')]:_0x7a5057['model'];if(_0x562d5f[_0x6326('0x33')]['includeAll']){_0xe6a992['include']=[{'all':!![]}];}_0xe6a992=_[_0x6326('0x40')]({},_0xe6a992,_0x562d5f[_0x6326('0x42')]);return db['VoiceMail'][_0x6326('0x4b')](_0xe6a992)[_0x6326('0x25')](handleEntityNotFound(_0x12703d,null))[_0x6326('0x25')](respondWithResult(_0x12703d,null))[_0x6326('0x46')](handleError(_0x12703d,null));};exports[_0x6326('0x4c')]=function(_0x4f8dc0,_0x4af0ee){return db[_0x6326('0x2d')][_0x6326('0x4c')](_0x4f8dc0[_0x6326('0x4d')],{})[_0x6326('0x25')](function(_0x210a1b){var _0x318d19=_0x4f8dc0[_0x6326('0x4e')]['get']({'plain':!![]});if(!_0x318d19)throw new Error(_0x6326('0x4f'));if(_0x318d19[_0x6326('0x50')]===_0x6326('0x4e')){var _0x3e7674=_0x210a1b[_0x6326('0x27')]({'plain':!![]});var _0x4ff8e6=_0x6326('0x51');return db['UserProfileSection'][_0x6326('0x4b')]({'where':{'name':_0x4ff8e6,'userProfileId':_0x318d19[_0x6326('0x52')]},'raw':!![]})['then'](function(_0x37b045){if(_0x37b045&&_0x37b045['autoAssociation']===0x0){return db[_0x6326('0x53')][_0x6326('0x4c')]({'name':_0x3e7674[_0x6326('0x2a')],'resourceId':_0x3e7674['id'],'type':_0x37b045[_0x6326('0x2a')],'sectionId':_0x37b045['id']},{})['then'](function(){return _0x210a1b;});}else{return _0x210a1b;}})[_0x6326('0x46')](function(_0xbe6b3e){logger['error'](_0x6326('0x54'),_0xbe6b3e);throw _0xbe6b3e;});}return _0x210a1b;})[_0x6326('0x25')](respondWithResult(_0x4af0ee,0xc9))[_0x6326('0x46')](handleError(_0x4af0ee,null));};exports['update']=function(_0x2bece1,_0x2ac64b){if(_0x2bece1['body']['id']){delete _0x2bece1[_0x6326('0x4d')]['id'];}return db['VoiceMail'][_0x6326('0x4b')]({'where':{'id':_0x2bece1[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x2ac64b,null))[_0x6326('0x25')](saveUpdates(_0x2bece1[_0x6326('0x4d')],null))[_0x6326('0x25')](respondWithResult(_0x2ac64b,null))[_0x6326('0x46')](handleError(_0x2ac64b,null));};exports['destroy']=function(_0x51adce,_0x4d4de7){return db[_0x6326('0x2d')]['find']({'where':{'id':_0x51adce[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4d4de7,null))[_0x6326('0x25')](removeEntity(_0x4d4de7,null))[_0x6326('0x46')](handleError(_0x4d4de7,null));};exports[_0x6326('0x55')]=function(_0x4b5bc6,_0x23bf64,_0x2e4244){return db['VoiceMail'][_0x6326('0x56')]({'where':{'id':_0x4b5bc6[_0x6326('0x48')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x23bf64,null))[_0x6326('0x25')](function(_0x45e3d5){var _0x36f2f5;var _0x320d43={},_0x2f624f={};_0x2f624f[_0x6326('0x31')]=_[_0x6326('0x34')](db['VoiceMailMessage'][_0x6326('0x49')]);_0x2f624f[_0x6326('0x33')]=_[_0x6326('0x34')](_0x4b5bc6[_0x6326('0x33')]);_0x2f624f['filters']=_['intersection'](_0x2f624f[_0x6326('0x31')],_0x2f624f[_0x6326('0x33')]);_0x320d43[_0x6326('0x37')]=_[_0x6326('0x36')](_0x2f624f[_0x6326('0x31')],qs['fields'](_0x4b5bc6['query'][_0x6326('0x38')]));_0x320d43[_0x6326('0x37')]=_0x320d43[_0x6326('0x37')][_0x6326('0x4a')]?_0x320d43['attributes']:_0x2f624f[_0x6326('0x31')];if(!_0x4b5bc6[_0x6326('0x33')][_0x6326('0x39')](_0x6326('0x57'))){_0x320d43[_0x6326('0x3a')]=qs[_0x6326('0x3a')](_0x4b5bc6['query'][_0x6326('0x3a')]);_0x320d43['offset']=qs[_0x6326('0x1f')](_0x4b5bc6[_0x6326('0x33')]['offset']);}_0x320d43[_0x6326('0x3b')]=qs[_0x6326('0x3c')](_0x4b5bc6[_0x6326('0x33')][_0x6326('0x3c')]);_0x320d43[_0x6326('0x3d')]=qs[_0x6326('0x35')](_[_0x6326('0x3e')](_0x4b5bc6[_0x6326('0x33')],_0x2f624f[_0x6326('0x35')]));if(_0x4b5bc6[_0x6326('0x33')]['filter']){_0x320d43[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x320d43[_0x6326('0x3d')],{'$or':_[_0x6326('0x32')](_0x320d43[_0x6326('0x37')],function(_0x5599da){var _0x299795={};_0x299795[_0x5599da]={'$like':'%'+_0x4b5bc6[_0x6326('0x33')][_0x6326('0x3f')]+'%'};return _0x299795;})});}_0x320d43[_0x6326('0x3d')]=_[_0x6326('0x40')](_0x320d43['where'],{'mailboxuser':_0x45e3d5[_0x6326('0x58')]});_0x320d43=_['merge']({},_0x320d43,_0x4b5bc6['options']);return db[_0x6326('0x59')][_0x6326('0x5a')](_0x320d43)[_0x6326('0x25')](respondWithFilteredResult(_0x23bf64,_0x320d43));})[_0x6326('0x46')](handleError(_0x23bf64,null));}; \ No newline at end of file +var _0x6cb4=['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','get','Voicemails','UserProfileResource','sendStatus','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filter','VIRTUAL','merge','includeAll','include','findAll','rows','options','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','destroy','getMessages','findOne','VoiceMailMessage','findAndCountAll','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0x6cb4,0xff));var _0x46cb=function(_0x14304c,_0x2a9190){_0x14304c=_0x14304c-0x0;var _0x5893be=_0x6cb4[_0x14304c];return _0x5893be;};'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(){var _0x6588f3=_0x40e0e5[_0x46cb('0x26')]({'plain':!![]});var _0x2711ac=_0x46cb('0x27');return db[_0x46cb('0x28')]['destroy']({'where':{'type':_0x2711ac,'resourceId':_0x6588f3['id']}})[_0x46cb('0x25')](function(){return _0x40e0e5;});})['then'](function(){_0x309e4b['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x180ce1,_0x119bf6){return function(_0x2242e7){if(!_0x2242e7){_0x180ce1[_0x46cb('0x29')](0x194);}return _0x2242e7;};}function handleError(_0x7cd177,_0x33218b){_0x33218b=_0x33218b||0x1f4;return function(_0x378dc7){logger[_0x46cb('0x2a')](_0x378dc7[_0x46cb('0x2b')]);if(_0x378dc7[_0x46cb('0x2c')]){delete _0x378dc7[_0x46cb('0x2c')];}_0x7cd177['status'](_0x33218b)[_0x46cb('0x2d')](_0x378dc7);};}exports[_0x46cb('0x2e')]=function(_0x4c73bd,_0x49e0bc){var _0x15f5cf={},_0x5cbb22={},_0x27c22d={'count':0x0,'rows':[]};var _0x6f7953=_[_0x46cb('0x2f')](db[_0x46cb('0x30')][_0x46cb('0x31')],function(_0x33c248){return{'name':_0x33c248['fieldName'],'type':_0x33c248[_0x46cb('0x32')]['key']};});_0x5cbb22[_0x46cb('0x33')]=_[_0x46cb('0x2f')](_0x6f7953,'name');_0x5cbb22[_0x46cb('0x34')]=_[_0x46cb('0x35')](_0x4c73bd[_0x46cb('0x34')]);_0x5cbb22[_0x46cb('0x36')]=_[_0x46cb('0x37')](_0x5cbb22['model'],_0x5cbb22[_0x46cb('0x34')]);_0x15f5cf['attributes']=_[_0x46cb('0x37')](_0x5cbb22[_0x46cb('0x33')],qs[_0x46cb('0x38')](_0x4c73bd['query'][_0x46cb('0x38')]));_0x15f5cf[_0x46cb('0x39')]=_0x15f5cf['attributes'][_0x46cb('0x3a')]?_0x15f5cf[_0x46cb('0x39')]:_0x5cbb22[_0x46cb('0x33')];if(!_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x3b')](_0x46cb('0x3c'))){_0x15f5cf[_0x46cb('0x1e')]=qs[_0x46cb('0x1e')](_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x1e')]);_0x15f5cf[_0x46cb('0x1c')]=qs['offset'](_0x4c73bd['query']['offset']);}_0x15f5cf[_0x46cb('0x3d')]=qs[_0x46cb('0x3e')](_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x3e')]);_0x15f5cf[_0x46cb('0x3f')]=qs[_0x46cb('0x36')](_['pick'](_0x4c73bd[_0x46cb('0x34')],_0x5cbb22['filters']),_0x6f7953);if(_0x4c73bd['query'][_0x46cb('0x40')]){_0x15f5cf['where']=_['merge'](_0x15f5cf[_0x46cb('0x3f')],{'$or':_['map'](_0x6f7953,function(_0x5cf8be){if(_0x5cf8be[_0x46cb('0x32')]!==_0x46cb('0x41')){var _0x4680bc={};_0x4680bc[_0x5cf8be[_0x46cb('0x2c')]]={'$like':'%'+_0x4c73bd[_0x46cb('0x34')][_0x46cb('0x40')]+'%'};return _0x4680bc;}})});}_0x15f5cf=_[_0x46cb('0x42')]({},_0x15f5cf,_0x4c73bd['options']);var _0x358ed4={'where':_0x15f5cf['where']};return db[_0x46cb('0x30')]['count'](_0x358ed4)[_0x46cb('0x25')](function(_0x2fbad9){_0x27c22d[_0x46cb('0x1d')]=_0x2fbad9;if(_0x4c73bd['query'][_0x46cb('0x43')]){_0x15f5cf[_0x46cb('0x44')]=[{'all':!![]}];}return db['VoiceMail'][_0x46cb('0x45')](_0x15f5cf);})[_0x46cb('0x25')](function(_0x1f67af){_0x27c22d[_0x46cb('0x46')]=_0x1f67af;return _0x27c22d;})[_0x46cb('0x25')](respondWithFilteredResult(_0x49e0bc,_0x15f5cf))['catch'](handleError(_0x49e0bc,null));};exports['show']=function(_0x10bada,_0x4c8ac3){var _0x1a9959={'raw':!![],'where':{'id':_0x10bada['params']['id']}},_0x41f76c={};_0x41f76c[_0x46cb('0x33')]=_[_0x46cb('0x35')](db[_0x46cb('0x30')]['rawAttributes']);_0x41f76c['query']=_['keys'](_0x10bada['query']);_0x41f76c[_0x46cb('0x36')]=_[_0x46cb('0x37')](_0x41f76c[_0x46cb('0x33')],_0x41f76c[_0x46cb('0x34')]);_0x1a9959[_0x46cb('0x39')]=_['intersection'](_0x41f76c['model'],qs[_0x46cb('0x38')](_0x10bada[_0x46cb('0x34')]['fields']));_0x1a9959[_0x46cb('0x39')]=_0x1a9959[_0x46cb('0x39')][_0x46cb('0x3a')]?_0x1a9959[_0x46cb('0x39')]:_0x41f76c[_0x46cb('0x33')];if(_0x10bada[_0x46cb('0x34')][_0x46cb('0x43')]){_0x1a9959['include']=[{'all':!![]}];}_0x1a9959=_['merge']({},_0x1a9959,_0x10bada[_0x46cb('0x47')]);return db['VoiceMail'][_0x46cb('0x48')](_0x1a9959)[_0x46cb('0x25')](handleEntityNotFound(_0x4c8ac3,null))[_0x46cb('0x25')](respondWithResult(_0x4c8ac3,null))['catch'](handleError(_0x4c8ac3,null));};exports[_0x46cb('0x49')]=function(_0x5c1665,_0x5c02c9){return db[_0x46cb('0x30')][_0x46cb('0x49')](_0x5c1665[_0x46cb('0x4a')],{})[_0x46cb('0x25')](function(_0x1b2072){var _0x26adb4=_0x5c1665[_0x46cb('0x4b')]['get']({'plain':!![]});if(!_0x26adb4)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x26adb4[_0x46cb('0x4c')]===_0x46cb('0x4b')){var _0x52e479=_0x1b2072[_0x46cb('0x26')]({'plain':!![]});var _0x33ab2e=_0x46cb('0x27');return db[_0x46cb('0x4d')][_0x46cb('0x48')]({'where':{'name':_0x33ab2e,'userProfileId':_0x26adb4['userProfileId']},'raw':!![]})[_0x46cb('0x25')](function(_0x202910){if(_0x202910&&_0x202910[_0x46cb('0x4e')]===0x0){return db['UserProfileResource'][_0x46cb('0x49')]({'name':_0x52e479['name'],'resourceId':_0x52e479['id'],'type':_0x202910['name'],'sectionId':_0x202910['id']},{})[_0x46cb('0x25')](function(){return _0x1b2072;});}else{return _0x1b2072;}})[_0x46cb('0x4f')](function(_0x2fe0b1){logger[_0x46cb('0x2a')](_0x46cb('0x50'),_0x2fe0b1);throw _0x2fe0b1;});}return _0x1b2072;})['then'](respondWithResult(_0x5c02c9,0xc9))[_0x46cb('0x4f')](handleError(_0x5c02c9,null));};exports[_0x46cb('0x24')]=function(_0x5701c0,_0x51a103){if(_0x5701c0[_0x46cb('0x4a')]['id']){delete _0x5701c0[_0x46cb('0x4a')]['id'];}return db[_0x46cb('0x30')]['find']({'where':{'id':_0x5701c0[_0x46cb('0x51')]['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x51a103,null))[_0x46cb('0x25')](saveUpdates(_0x5701c0[_0x46cb('0x4a')],null))[_0x46cb('0x25')](respondWithResult(_0x51a103,null))[_0x46cb('0x4f')](handleError(_0x51a103,null));};exports[_0x46cb('0x52')]=function(_0x287147,_0x2ba8b5){return db['VoiceMail'][_0x46cb('0x48')]({'where':{'id':_0x287147['params']['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x2ba8b5,null))[_0x46cb('0x25')](removeEntity(_0x2ba8b5,null))[_0x46cb('0x4f')](handleError(_0x2ba8b5,null));};exports[_0x46cb('0x53')]=function(_0x532aa2,_0x67fb77,_0x13d25f){return db[_0x46cb('0x30')][_0x46cb('0x54')]({'where':{'id':_0x532aa2[_0x46cb('0x51')]['id']}})[_0x46cb('0x25')](handleEntityNotFound(_0x67fb77,null))[_0x46cb('0x25')](function(_0x2e55f4){var _0x57c29b;var _0x4a0606={},_0x5a4b11={};_0x5a4b11['model']=_[_0x46cb('0x35')](db[_0x46cb('0x55')]['rawAttributes']);_0x5a4b11[_0x46cb('0x34')]=_[_0x46cb('0x35')](_0x532aa2[_0x46cb('0x34')]);_0x5a4b11['filters']=_['intersection'](_0x5a4b11[_0x46cb('0x33')],_0x5a4b11['query']);_0x4a0606[_0x46cb('0x39')]=_[_0x46cb('0x37')](_0x5a4b11[_0x46cb('0x33')],qs[_0x46cb('0x38')](_0x532aa2[_0x46cb('0x34')][_0x46cb('0x38')]));_0x4a0606[_0x46cb('0x39')]=_0x4a0606[_0x46cb('0x39')][_0x46cb('0x3a')]?_0x4a0606[_0x46cb('0x39')]:_0x5a4b11[_0x46cb('0x33')];if(!_0x532aa2[_0x46cb('0x34')][_0x46cb('0x3b')]('nolimit')){_0x4a0606[_0x46cb('0x1e')]=qs['limit'](_0x532aa2[_0x46cb('0x34')][_0x46cb('0x1e')]);_0x4a0606[_0x46cb('0x1c')]=qs[_0x46cb('0x1c')](_0x532aa2[_0x46cb('0x34')][_0x46cb('0x1c')]);}_0x4a0606[_0x46cb('0x3d')]=qs['sort'](_0x532aa2[_0x46cb('0x34')][_0x46cb('0x3e')]);_0x4a0606[_0x46cb('0x3f')]=qs[_0x46cb('0x36')](_['pick'](_0x532aa2[_0x46cb('0x34')],_0x5a4b11[_0x46cb('0x36')]));if(_0x532aa2[_0x46cb('0x34')][_0x46cb('0x40')]){_0x4a0606[_0x46cb('0x3f')]=_['merge'](_0x4a0606[_0x46cb('0x3f')],{'$or':_[_0x46cb('0x2f')](_0x4a0606[_0x46cb('0x39')],function(_0x2625e4){var _0x38b4a6={};_0x38b4a6[_0x2625e4]={'$like':'%'+_0x532aa2[_0x46cb('0x34')][_0x46cb('0x40')]+'%'};return _0x38b4a6;})});}_0x4a0606[_0x46cb('0x3f')]=_['merge'](_0x4a0606['where'],{'mailboxuser':_0x2e55f4['mailbox']});_0x4a0606=_[_0x46cb('0x42')]({},_0x4a0606,_0x532aa2[_0x46cb('0x47')]);return db[_0x46cb('0x55')][_0x46cb('0x56')](_0x4a0606)[_0x46cb('0x25')](respondWithFilteredResult(_0x67fb77,_0x4a0606));})[_0x46cb('0x4f')](handleError(_0x67fb77,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index ff2257b..32d647d 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 _0xd65e=['context','lodash','util','../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./voiceMail.attributes','VoiceMail','mailbox'];(function(_0xdf59b6,_0x2d7a75){var _0x1fdd82=function(_0x141dd7){while(--_0x141dd7){_0xdf59b6['push'](_0xdf59b6['shift']());}};_0x1fdd82(++_0x2d7a75);}(_0xd65e,0x91));var _0xed65=function(_0x4d1998,_0x4d99cc){_0x4d1998=_0x4d1998-0x0;var _0x39ae74=_0xd65e[_0x4d1998];return _0x39ae74;};'use strict';var _=require(_0xed65('0x0'));var util=require(_0xed65('0x1'));var logger=require(_0xed65('0x2'))(_0xed65('0x3'));var moment=require(_0xed65('0x4'));var BPromise=require(_0xed65('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xed65('0x6'));var config=require(_0xed65('0x7'));var attributes=require(_0xed65('0x8'));module['exports']=function(_0x109571,_0x3dd68f){return _0x109571['define'](_0xed65('0x9'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0xed65('0xa'),_0xed65('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x811d=['api','moment','request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','voice_voicemail','mailbox_context','lodash','util','../../config/logger'];(function(_0x2e33d3,_0x4375d2){var _0x5cd87d=function(_0x2ae53c){while(--_0x2ae53c){_0x2e33d3['push'](_0x2e33d3['shift']());}};_0x5cd87d(++_0x4375d2);}(_0x811d,0x156));var _0xd811=function(_0x3c539d,_0x37b884){_0x3c539d=_0x3c539d-0x0;var _0x2e608c=_0x811d[_0x3c539d];return _0x2e608c;};'use strict';var _=require(_0xd811('0x0'));var util=require(_0xd811('0x1'));var logger=require(_0xd811('0x2'))(_0xd811('0x3'));var moment=require(_0xd811('0x4'));var BPromise=require('bluebird');var rp=require(_0xd811('0x5'));var fs=require('fs');var path=require(_0xd811('0x6'));var rimraf=require(_0xd811('0x7'));var config=require(_0xd811('0x8'));var attributes=require(_0xd811('0x9'));module[_0xd811('0xa')]=function(_0x412e33,_0x8a5f6d){return _0x412e33[_0xd811('0xb')](_0xd811('0xc'),attributes,{'tableName':_0xd811('0xd'),'paranoid':![],'indexes':[{'name':_0xd811('0xe'),'fields':['mailbox','context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index bfb599e..e56f9b4 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 _0x451b=['http','request','then','VoiceMail,\x20%s,\x20%s','debug','VoiceMail,\x20%s,\x20%s,\x20%s','error','message','info','request\x20sent','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x1700c2,_0x13ffee){var _0x4a4dad=function(_0x170fa7){while(--_0x170fa7){_0x1700c2['push'](_0x1700c2['shift']());}};_0x4a4dad(++_0x13ffee);}(_0x451b,0xbe));var _0xb451=function(_0x31bde4,_0x11863f){_0x31bde4=_0x31bde4-0x0;var _0x190e1b=_0x451b[_0x31bde4];return _0x190e1b;};'use strict';var _=require(_0xb451('0x0'));var util=require('util');var moment=require(_0xb451('0x1'));var BPromise=require('bluebird');var rs=require(_0xb451('0x2'));var fs=require('fs');var Redis=require(_0xb451('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb451('0x4'));var logger=require(_0xb451('0x5'))(_0xb451('0x6'));var config=require(_0xb451('0x7'));var jayson=require(_0xb451('0x8'));var client=jayson[_0xb451('0x9')][_0xb451('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x26117d,_0x5185ed,_0x32a5ef){return new BPromise(function(_0x3dc4a6,_0x11b35f){return client[_0xb451('0xb')](_0x26117d,_0x32a5ef)[_0xb451('0xc')](function(_0xe38bec){logger['info'](_0xb451('0xd'),_0x5185ed,'request\x20sent');logger[_0xb451('0xe')](_0xb451('0xf'),_0x5185ed,'request\x20sent',JSON['stringify'](_0xe38bec));if(_0xe38bec[_0xb451('0x10')]){if(_0xe38bec['error']['code']===0x1f4){logger[_0xb451('0x10')](_0xb451('0xd'),_0x5185ed,_0xe38bec[_0xb451('0x10')]['message']);return _0x11b35f(_0xe38bec['error'][_0xb451('0x11')]);}logger[_0xb451('0x10')](_0xb451('0xd'),_0x5185ed,_0xe38bec[_0xb451('0x10')][_0xb451('0x11')]);return _0x3dc4a6(_0xe38bec[_0xb451('0x10')][_0xb451('0x11')]);}else{logger[_0xb451('0x12')](_0xb451('0xd'),_0x5185ed,_0xb451('0x13'));_0x3dc4a6(_0xe38bec['result'][_0xb451('0x11')]);}})['catch'](function(_0x5d3276){logger[_0xb451('0x10')](_0xb451('0xd'),_0x5185ed,_0x5d3276);_0x11b35f(_0x5d3276);});});} \ No newline at end of file +var _0x25f8=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceMail,\x20%s,\x20%s','request\x20sent','debug','VoiceMail,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x56af09,_0x4fcf12){var _0x290aa3=function(_0x4ba74c){while(--_0x4ba74c){_0x56af09['push'](_0x56af09['shift']());}};_0x290aa3(++_0x4fcf12);}(_0x25f8,0x172));var _0x825f=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0x25f8[_0x2c91e9];return _0x13f0ff;};'use strict';var _=require('lodash');var util=require(_0x825f('0x0'));var moment=require(_0x825f('0x1'));var BPromise=require(_0x825f('0x2'));var rs=require(_0x825f('0x3'));var fs=require('fs');var Redis=require(_0x825f('0x4'));var db=require(_0x825f('0x5'))['db'];var utils=require(_0x825f('0x6'));var logger=require(_0x825f('0x7'))(_0x825f('0x8'));var config=require(_0x825f('0x9'));var jayson=require(_0x825f('0xa'));var client=jayson[_0x825f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4163b3,_0x823acf,_0x2d58e4){return new BPromise(function(_0x5b9891,_0x1fc792){return client[_0x825f('0xc')](_0x4163b3,_0x2d58e4)[_0x825f('0xd')](function(_0x8ab63a){logger['info'](_0x825f('0xe'),_0x823acf,_0x825f('0xf'));logger[_0x825f('0x10')](_0x825f('0x11'),_0x823acf,'request\x20sent',JSON[_0x825f('0x12')](_0x8ab63a));if(_0x8ab63a[_0x825f('0x13')]){if(_0x8ab63a[_0x825f('0x13')][_0x825f('0x14')]===0x1f4){logger[_0x825f('0x13')](_0x825f('0xe'),_0x823acf,_0x8ab63a['error'][_0x825f('0x15')]);return _0x1fc792(_0x8ab63a[_0x825f('0x13')][_0x825f('0x15')]);}logger[_0x825f('0x13')](_0x825f('0xe'),_0x823acf,_0x8ab63a[_0x825f('0x13')]['message']);return _0x5b9891(_0x8ab63a[_0x825f('0x13')][_0x825f('0x15')]);}else{logger[_0x825f('0x16')](_0x825f('0xe'),_0x823acf,_0x825f('0xf'));_0x5b9891(_0x8ab63a[_0x825f('0x17')][_0x825f('0x15')]);}})[_0x825f('0x18')](function(_0x2025c7){logger['error'](_0x825f('0xe'),_0x823acf,_0x2025c7);_0x1fc792(_0x2025c7);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index e4634c2..fa81461 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 _0xb874=['path','connect-timeout','express','Router','./voiceMailMessage.controller','get','isAuthenticated','index','show','/:id/download','put','delete','/:id','destroy','exports','multer','util'];(function(_0x1bab95,_0x64048a){var _0x1621f0=function(_0x31433d){while(--_0x31433d){_0x1bab95['push'](_0x1bab95['shift']());}};_0x1621f0(++_0x64048a);}(_0xb874,0x152));var _0x4b87=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb874[_0x2c91e9];return _0x13f0ff;};'use strict';var multer=require(_0x4b87('0x0'));var util=require(_0x4b87('0x1'));var path=require(_0x4b87('0x2'));var timeout=require(_0x4b87('0x3'));var express=require(_0x4b87('0x4'));var router=express[_0x4b87('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x4b87('0x6'));router[_0x4b87('0x7')]('/',auth[_0x4b87('0x8')](),controller[_0x4b87('0x9')]);router[_0x4b87('0x7')]('/:id',auth['isAuthenticated'](),controller[_0x4b87('0xa')]);router[_0x4b87('0x7')](_0x4b87('0xb'),auth['isAuthenticated'](),controller['download']);router['post']('/',auth['isAuthenticated'](),controller['create']);router[_0x4b87('0xc')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0x4b87('0xd')](_0x4b87('0xe'),auth[_0x4b87('0x8')](),controller[_0x4b87('0xf')]);module[_0x4b87('0x10')]=router; \ No newline at end of file +var _0xa157=['post','put','/:id','delete','destroy','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','show','/:id/download','download'];(function(_0x230d54,_0x53cb6c){var _0x54ff3f=function(_0x3ae11a){while(--_0x3ae11a){_0x230d54['push'](_0x230d54['shift']());}};_0x54ff3f(++_0x53cb6c);}(_0xa157,0x84));var _0x7a15=function(_0x5a687b,_0x326ec5){_0x5a687b=_0x5a687b-0x0;var _0x16a546=_0xa157[_0x5a687b];return _0x16a546;};'use strict';var multer=require('multer');var util=require(_0x7a15('0x0'));var path=require('path');var timeout=require(_0x7a15('0x1'));var express=require(_0x7a15('0x2'));var router=express['Router']();var fs_extra=require(_0x7a15('0x3'));var auth=require(_0x7a15('0x4'));var interaction=require(_0x7a15('0x5'));var config=require('../../config/environment');var controller=require('./voiceMailMessage.controller');router[_0x7a15('0x6')]('/',auth[_0x7a15('0x7')](),controller[_0x7a15('0x8')]);router['get']('/:id',auth[_0x7a15('0x7')](),controller[_0x7a15('0x9')]);router['get'](_0x7a15('0xa'),auth[_0x7a15('0x7')](),controller[_0x7a15('0xb')]);router[_0x7a15('0xc')]('/',auth[_0x7a15('0x7')](),controller['create']);router[_0x7a15('0xd')](_0x7a15('0xe'),auth[_0x7a15('0x7')](),controller['update']);router[_0x7a15('0xf')](_0x7a15('0xe'),auth[_0x7a15('0x7')](),controller[_0x7a15('0x10')]);module[_0x7a15('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 23944a5..8491c35 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 _0x1168=['TIMESTAMP','literal','sequelize','VIRTUAL','getDataValue','INTEGER','STRING','long'];(function(_0x4b2269,_0x2f1076){var _0x5d3984=function(_0x4d73a2){while(--_0x4d73a2){_0x4b2269['push'](_0x4b2269['shift']());}};_0x5d3984(++_0x2f1076);}(_0x1168,0x1ba));var _0x8116=function(_0x174202,_0x5c5292){_0x174202=_0x174202-0x0;var _0x4daa4a=_0x1168[_0x174202];return _0x4daa4a;};'use strict';var Sequelize=require(_0x8116('0x0'));module['exports']={'name':{'type':Sequelize[_0x8116('0x1')],'get':function(_0xf36c9a){return this[_0x8116('0x2')]('id');}},'msgnum':{'type':Sequelize[_0x8116('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x8116('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x8116('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x8116('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0x8116('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x8116('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x8116('0x4')],'defaultValue':''},'recording':{'type':Sequelize['BLOB'](_0x8116('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x8116('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0x8116('0x4')],'defaultValue':''},'stamp':{'type':_0x8116('0x6'),'defaultValue':Sequelize[_0x8116('0x7')]('CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP')}}; \ No newline at end of file +var _0xe813=['VIRTUAL','getDataValue','STRING','BLOB','long','TIMESTAMP','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports'];(function(_0x56d99a,_0x35aedb){var _0x53a7d4=function(_0x537b7a){while(--_0x537b7a){_0x56d99a['push'](_0x56d99a['shift']());}};_0x53a7d4(++_0x35aedb);}(_0xe813,0x13e));var _0x3e81=function(_0x547ff4,_0x416fa1){_0x547ff4=_0x547ff4-0x0;var _0xe41057=_0xe813[_0x547ff4];return _0xe41057;};'use strict';var Sequelize=require(_0x3e81('0x0'));module[_0x3e81('0x1')]={'name':{'type':Sequelize[_0x3e81('0x2')],'get':function(_0x1ca12c){return this[_0x3e81('0x3')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x3e81('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0x3e81('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize['STRING'],'defaultValue':''},'callerid':{'type':Sequelize[_0x3e81('0x4')],'defaultValue':''},'origtime':{'type':Sequelize['STRING'],'defaultValue':''},'duration':{'type':Sequelize[_0x3e81('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize['STRING'],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x3e81('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0x3e81('0x5')](_0x3e81('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0x3e81('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x3e81('0x7'),'defaultValue':Sequelize[_0x3e81('0x8')](_0x3e81('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 7fac36e..fb53c7a 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 _0x0643=['msg_id','ValidationError','VoiceMailMessage\x20not\x20found','attachment;\x20filename=\x22','.wav\x22','zip-dir','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','update','then','stack','name','send','map','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','download','recording'];(function(_0x158f47,_0x1b68c6){var _0x100a67=function(_0x2fe096){while(--_0x2fe096){_0x158f47['push'](_0x158f47['shift']());}};_0x100a67(++_0x1b68c6);}(_0x0643,0x145));var _0x3064=function(_0x3b6778,_0x57ddd4){_0x3b6778=_0x3b6778-0x0;var _0x4061de=_0x0643[_0x3b6778];return _0x4061de;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x3064('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x3064('0x1'));var BPromise=require(_0x3064('0x2'));var Mustache=require('mustache');var util=require(_0x3064('0x3'));var path=require(_0x3064('0x4'));var sox=require(_0x3064('0x5'));var csv=require(_0x3064('0x6'));var ejs=require(_0x3064('0x7'));var fs=require('fs');var fs_extra=require(_0x3064('0x8'));var _=require(_0x3064('0x9'));var squel=require(_0x3064('0xa'));var crypto=require(_0x3064('0xb'));var jsforce=require(_0x3064('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x3064('0x6'));var querystring=require(_0x3064('0xd'));var Papa=require(_0x3064('0xe'));var Redis=require('ioredis');var authService=require(_0x3064('0xf'));var qs=require(_0x3064('0x10'));var as=require(_0x3064('0x11'));var hardwareService=require(_0x3064('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3064('0x13'));var config=require(_0x3064('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3fdda0,_0x258e04){_0x258e04=_0x258e04||0xcc;return function(_0x550f6d){if(_0x550f6d){return _0x3fdda0[_0x3064('0x15')](_0x258e04);}return _0x3fdda0[_0x3064('0x16')](_0x258e04)[_0x3064('0x17')]();};}function respondWithResult(_0x337e81,_0x2fcfe6){_0x2fcfe6=_0x2fcfe6||0xc8;return function(_0xb2ca3f){if(_0xb2ca3f){return _0x337e81[_0x3064('0x16')](_0x2fcfe6)[_0x3064('0x18')](_0xb2ca3f);}};}function respondWithFilteredResult(_0x51e1c9,_0x4cf129){return function(_0x5b2d8b){if(_0x5b2d8b){var _0x51f72b=typeof _0x4cf129[_0x3064('0x19')]==='undefined'&&typeof _0x4cf129[_0x3064('0x1a')]===_0x3064('0x1b');var _0x2e73aa=_0x5b2d8b[_0x3064('0x1c')];var _0x492dde=_0x51f72b?0x0:_0x4cf129[_0x3064('0x19')];var _0x5165c0=_0x51f72b?_0x5b2d8b[_0x3064('0x1c')]:_0x4cf129['offset']+_0x4cf129['limit'];var _0x34194a;if(_0x5165c0>=_0x2e73aa){_0x5165c0=_0x2e73aa;_0x34194a=0xc8;}else{_0x34194a=0xce;}_0x51e1c9[_0x3064('0x16')](_0x34194a);return _0x51e1c9[_0x3064('0x1d')]('Content-Range',_0x492dde+'-'+_0x5165c0+'/'+_0x2e73aa)['json'](_0x5b2d8b);}return null;};}function patchUpdates(_0x315ad1){return function(_0x2746ad){try{jsonpatch[_0x3064('0x1e')](_0x2746ad,_0x315ad1,!![]);}catch(_0x462898){return BPromise[_0x3064('0x1f')](_0x462898);}return _0x2746ad['save']();};}function saveUpdates(_0x6d62de,_0x144948){return function(_0xa7a741){if(_0xa7a741){return _0xa7a741[_0x3064('0x20')](_0x6d62de)[_0x3064('0x21')](function(_0x1e3a4c){return _0x1e3a4c;});}return null;};}function removeEntity(_0x44ac3a,_0x4742a6){return function(_0x408059){if(_0x408059){return _0x408059['destroy']()['then'](function(){_0x44ac3a['status'](0xcc)[_0x3064('0x17')]();});}};}function handleEntityNotFound(_0x4afa01,_0x1d3063){return function(_0x4d2c7c){if(!_0x4d2c7c){_0x4afa01[_0x3064('0x15')](0x194);}return _0x4d2c7c;};}function handleError(_0x5166ee,_0x4cc017){_0x4cc017=_0x4cc017||0x1f4;return function(_0x5147ab){logger['error'](_0x5147ab[_0x3064('0x22')]);if(_0x5147ab[_0x3064('0x23')]){delete _0x5147ab[_0x3064('0x23')];}_0x5166ee[_0x3064('0x16')](_0x4cc017)[_0x3064('0x24')](_0x5147ab);};}exports['index']=function(_0x210131,_0x57e351){var _0x1956b9={},_0x10fa5c={},_0x5ee0e9={'count':0x0,'rows':[]};var _0x55434d=_[_0x3064('0x25')](db[_0x3064('0x26')][_0x3064('0x27')],function(_0x5a92ad){return{'name':_0x5a92ad[_0x3064('0x28')],'type':_0x5a92ad[_0x3064('0x29')][_0x3064('0x2a')]};});_0x10fa5c[_0x3064('0x2b')]=_[_0x3064('0x2c')](_[_0x3064('0x25')](_0x55434d,'name'),[_0x3064('0x23')]);_0x10fa5c[_0x3064('0x2d')]=_[_0x3064('0x2e')](_0x210131['query']);_0x10fa5c[_0x3064('0x2f')]=_[_0x3064('0x30')](_0x10fa5c[_0x3064('0x2b')],_0x10fa5c[_0x3064('0x2d')]);_0x1956b9[_0x3064('0x31')]=_[_0x3064('0x30')](_0x10fa5c['model'],qs[_0x3064('0x32')](_0x210131[_0x3064('0x2d')][_0x3064('0x32')]));_0x1956b9[_0x3064('0x31')]=_0x1956b9[_0x3064('0x31')][_0x3064('0x33')]?_0x1956b9[_0x3064('0x31')]:_0x10fa5c[_0x3064('0x2b')];if(!_0x210131[_0x3064('0x2d')][_0x3064('0x34')](_0x3064('0x35'))){_0x1956b9[_0x3064('0x1a')]=qs[_0x3064('0x1a')](_0x210131[_0x3064('0x2d')][_0x3064('0x1a')]);_0x1956b9[_0x3064('0x19')]=qs['offset'](_0x210131[_0x3064('0x2d')][_0x3064('0x19')]);}_0x1956b9[_0x3064('0x36')]=qs[_0x3064('0x37')](_0x210131[_0x3064('0x2d')][_0x3064('0x37')]);_0x1956b9[_0x3064('0x38')]=qs['filters'](_[_0x3064('0x39')](_0x210131['query'],_0x10fa5c[_0x3064('0x2f')]),_0x55434d);if(_0x210131[_0x3064('0x2d')][_0x3064('0x3a')]){_0x1956b9[_0x3064('0x38')]=_['merge'](_0x1956b9[_0x3064('0x38')],{'$or':_[_0x3064('0x25')](_0x55434d,function(_0x129cc6){if(_0x129cc6[_0x3064('0x29')]!==_0x3064('0x3b')){var _0x2530a8={};_0x2530a8[_0x129cc6['name']]={'$like':'%'+_0x210131[_0x3064('0x2d')][_0x3064('0x3a')]+'%'};return _0x2530a8;}})});}_0x1956b9=_[_0x3064('0x3c')]({},_0x1956b9,_0x210131[_0x3064('0x3d')]);var _0x14d55f={'where':_0x1956b9[_0x3064('0x38')]};return db[_0x3064('0x26')][_0x3064('0x1c')](_0x14d55f)[_0x3064('0x21')](function(_0x5b7a67){_0x5ee0e9[_0x3064('0x1c')]=_0x5b7a67;if(_0x210131[_0x3064('0x2d')][_0x3064('0x3e')]){_0x1956b9[_0x3064('0x3f')]=[{'all':!![]}];}return db[_0x3064('0x26')][_0x3064('0x40')](_0x1956b9);})[_0x3064('0x21')](function(_0x596489){_0x5ee0e9[_0x3064('0x41')]=_0x596489;return _0x5ee0e9;})['then'](respondWithFilteredResult(_0x57e351,_0x1956b9))[_0x3064('0x42')](handleError(_0x57e351,null));};exports[_0x3064('0x43')]=function(_0x1a3260,_0x3df470){var _0x2f6bbf={'raw':!![],'where':{'id':_0x1a3260[_0x3064('0x44')]['id']}},_0x975f6c={};_0x975f6c[_0x3064('0x2b')]=_[_0x3064('0x2e')](db[_0x3064('0x26')]['rawAttributes']);_0x975f6c[_0x3064('0x2d')]=_[_0x3064('0x2e')](_0x1a3260['query']);_0x975f6c['filters']=_[_0x3064('0x30')](_0x975f6c[_0x3064('0x2b')],_0x975f6c[_0x3064('0x2d')]);_0x2f6bbf[_0x3064('0x31')]=_['intersection'](_0x975f6c['model'],qs[_0x3064('0x32')](_0x1a3260[_0x3064('0x2d')][_0x3064('0x32')]));_0x2f6bbf[_0x3064('0x31')]=_0x2f6bbf[_0x3064('0x31')][_0x3064('0x33')]?_0x2f6bbf[_0x3064('0x31')]:_0x975f6c[_0x3064('0x2b')];if(_0x1a3260[_0x3064('0x2d')][_0x3064('0x3e')]){_0x2f6bbf['include']=[{'all':!![]}];}_0x2f6bbf=_[_0x3064('0x3c')]({},_0x2f6bbf,_0x1a3260['options']);return db[_0x3064('0x26')][_0x3064('0x45')](_0x2f6bbf)['then'](handleEntityNotFound(_0x3df470,null))[_0x3064('0x21')](respondWithResult(_0x3df470,null))[_0x3064('0x42')](handleError(_0x3df470,null));};exports[_0x3064('0x46')]=function(_0x1a041c,_0x3d54ec){return db['VoiceMailMessage'][_0x3064('0x46')](_0x1a041c[_0x3064('0x47')],{})[_0x3064('0x21')](respondWithResult(_0x3d54ec,0xc9))[_0x3064('0x42')](handleError(_0x3d54ec,null));};exports[_0x3064('0x20')]=function(_0x4949c7,_0x16ab8b){if(_0x4949c7[_0x3064('0x47')]['id']){delete _0x4949c7[_0x3064('0x47')]['id'];}return db[_0x3064('0x26')][_0x3064('0x45')]({'where':{'id':_0x4949c7[_0x3064('0x44')]['id']}})['then'](handleEntityNotFound(_0x16ab8b,null))['then'](saveUpdates(_0x4949c7[_0x3064('0x47')],null))[_0x3064('0x21')](respondWithResult(_0x16ab8b,null))[_0x3064('0x42')](handleError(_0x16ab8b,null));};exports[_0x3064('0x48')]=function(_0x3b25c3,_0x5cc57b){return db[_0x3064('0x26')][_0x3064('0x45')]({'where':{'id':_0x3b25c3[_0x3064('0x44')]['id']}})[_0x3064('0x21')](handleEntityNotFound(_0x5cc57b,null))['then'](removeEntity(_0x5cc57b,null))[_0x3064('0x42')](handleError(_0x5cc57b,null));};exports[_0x3064('0x49')]=function(_0x1fd30e,_0x50e304,_0x43ce9e){return db['VoiceMailMessage'][_0x3064('0x45')]({'where':{'id':_0x1fd30e['params']['id']},'attributes':['id',_0x3064('0x4a'),_0x3064('0x4b')]})[_0x3064('0x21')](handleEntityNotFound(_0x50e304,null))['then'](function(_0x5b0cc9){if(_0x5b0cc9){if(!_0x5b0cc9[_0x3064('0x4a')]){throw new db['Sequelize'][(_0x3064('0x4c'))](_0x3064('0x4d'));}var _0x28bed8={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x5b0cc9[_0x3064('0x4b')]){_0x28bed8['Content-Disposition']=_0x3064('0x4e')+_0x5b0cc9[_0x3064('0x4b')]+_0x3064('0x4f');}_0x50e304['set'](_0x28bed8);return _0x50e304[_0x3064('0x24')](new Buffer(_0x5b0cc9[_0x3064('0x4a')]));}})[_0x3064('0x42')](handleError(_0x50e304,null));}; \ No newline at end of file +var _0x0efc=['sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','update','destroy','stack','name','send','VoiceMailMessage','rawAttributes','fieldName','type','key','model','differenceBy','map','query','keys','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','merge','options','then','include','rows','catch','params','fields','find','create','body','recording','msg_id','ValidationError','VoiceMailMessage\x20not\x20found','attachment','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x136619,_0x31c9b2){var _0x38c4a5=function(_0x10b74d){while(--_0x10b74d){_0x136619['push'](_0x136619['shift']());}};_0x38c4a5(++_0x31c9b2);}(_0x0efc,0xd8));var _0xc0ef=function(_0x49949e,_0x5b8339){_0x49949e=_0x49949e-0x0;var _0x3cd1c4=_0x0efc[_0x49949e];return _0x3cd1c4;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc0ef('0x0'));var zipdir=require(_0xc0ef('0x1'));var jsonpatch=require(_0xc0ef('0x2'));var rp=require(_0xc0ef('0x3'));var moment=require(_0xc0ef('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc0ef('0x5'));var util=require(_0xc0ef('0x6'));var path=require(_0xc0ef('0x7'));var sox=require(_0xc0ef('0x8'));var csv=require(_0xc0ef('0x9'));var ejs=require(_0xc0ef('0xa'));var fs=require('fs');var fs_extra=require(_0xc0ef('0xb'));var _=require('lodash');var squel=require(_0xc0ef('0xc'));var crypto=require(_0xc0ef('0xd'));var jsforce=require(_0xc0ef('0xe'));var deskjs=require(_0xc0ef('0xf'));var toCsv=require(_0xc0ef('0x9'));var querystring=require(_0xc0ef('0x10'));var Papa=require(_0xc0ef('0x11'));var Redis=require(_0xc0ef('0x12'));var authService=require(_0xc0ef('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xc0ef('0x14'));var hardwareService=require(_0xc0ef('0x15'));var logger=require(_0xc0ef('0x16'))(_0xc0ef('0x17'));var utils=require(_0xc0ef('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xc0ef('0x19'));var db=require(_0xc0ef('0x1a'))['db'];function respondWithStatusCode(_0x822aad,_0x27c62e){_0x27c62e=_0x27c62e||0xcc;return function(_0xfadf59){if(_0xfadf59){return _0x822aad[_0xc0ef('0x1b')](_0x27c62e);}return _0x822aad[_0xc0ef('0x1c')](_0x27c62e)[_0xc0ef('0x1d')]();};}function respondWithResult(_0xa2f3d5,_0x30764e){_0x30764e=_0x30764e||0xc8;return function(_0x15acbb){if(_0x15acbb){return _0xa2f3d5[_0xc0ef('0x1c')](_0x30764e)[_0xc0ef('0x1e')](_0x15acbb);}};}function respondWithFilteredResult(_0x424d35,_0x1764c1){return function(_0x1d7bd7){if(_0x1d7bd7){var _0x48d9ef=typeof _0x1764c1[_0xc0ef('0x1f')]===_0xc0ef('0x20')&&typeof _0x1764c1[_0xc0ef('0x21')]===_0xc0ef('0x20');var _0x3fafbb=_0x1d7bd7[_0xc0ef('0x22')];var _0x4f1f29=_0x48d9ef?0x0:_0x1764c1['offset'];var _0x196206=_0x48d9ef?_0x1d7bd7[_0xc0ef('0x22')]:_0x1764c1[_0xc0ef('0x1f')]+_0x1764c1[_0xc0ef('0x21')];var _0x5cf7b7;if(_0x196206>=_0x3fafbb){_0x196206=_0x3fafbb;_0x5cf7b7=0xc8;}else{_0x5cf7b7=0xce;}_0x424d35[_0xc0ef('0x1c')](_0x5cf7b7);return _0x424d35['set']('Content-Range',_0x4f1f29+'-'+_0x196206+'/'+_0x3fafbb)['json'](_0x1d7bd7);}return null;};}function patchUpdates(_0x409474){return function(_0x140109){try{jsonpatch[_0xc0ef('0x23')](_0x140109,_0x409474,!![]);}catch(_0x5f2bf3){return BPromise[_0xc0ef('0x24')](_0x5f2bf3);}return _0x140109['save']();};}function saveUpdates(_0x5c0183,_0x4cf990){return function(_0x1c0c92){if(_0x1c0c92){return _0x1c0c92[_0xc0ef('0x25')](_0x5c0183)['then'](function(_0x13beea){return _0x13beea;});}return null;};}function removeEntity(_0x14ef1e,_0x5a2919){return function(_0x159d09){if(_0x159d09){return _0x159d09[_0xc0ef('0x26')]()['then'](function(){_0x14ef1e['status'](0xcc)[_0xc0ef('0x1d')]();});}};}function handleEntityNotFound(_0x524566,_0x3d76c9){return function(_0x5bd6cd){if(!_0x5bd6cd){_0x524566['sendStatus'](0x194);}return _0x5bd6cd;};}function handleError(_0xafcdef,_0x5b580){_0x5b580=_0x5b580||0x1f4;return function(_0x58463b){logger['error'](_0x58463b[_0xc0ef('0x27')]);if(_0x58463b[_0xc0ef('0x28')]){delete _0x58463b[_0xc0ef('0x28')];}_0xafcdef['status'](_0x5b580)[_0xc0ef('0x29')](_0x58463b);};}exports['index']=function(_0x57c2d9,_0x22c344){var _0x15c81e={},_0x34deb1={},_0x3252c2={'count':0x0,'rows':[]};var _0x1378a7=_['map'](db[_0xc0ef('0x2a')][_0xc0ef('0x2b')],function(_0x51a404){return{'name':_0x51a404[_0xc0ef('0x2c')],'type':_0x51a404[_0xc0ef('0x2d')][_0xc0ef('0x2e')]};});_0x34deb1[_0xc0ef('0x2f')]=_[_0xc0ef('0x30')](_[_0xc0ef('0x31')](_0x1378a7,_0xc0ef('0x28')),[_0xc0ef('0x28')]);_0x34deb1[_0xc0ef('0x32')]=_[_0xc0ef('0x33')](_0x57c2d9['query']);_0x34deb1['filters']=_[_0xc0ef('0x34')](_0x34deb1[_0xc0ef('0x2f')],_0x34deb1[_0xc0ef('0x32')]);_0x15c81e[_0xc0ef('0x35')]=_[_0xc0ef('0x34')](_0x34deb1[_0xc0ef('0x2f')],qs['fields'](_0x57c2d9[_0xc0ef('0x32')]['fields']));_0x15c81e['attributes']=_0x15c81e[_0xc0ef('0x35')][_0xc0ef('0x36')]?_0x15c81e['attributes']:_0x34deb1[_0xc0ef('0x2f')];if(!_0x57c2d9['query'][_0xc0ef('0x37')](_0xc0ef('0x38'))){_0x15c81e[_0xc0ef('0x21')]=qs['limit'](_0x57c2d9['query']['limit']);_0x15c81e['offset']=qs[_0xc0ef('0x1f')](_0x57c2d9[_0xc0ef('0x32')][_0xc0ef('0x1f')]);}_0x15c81e[_0xc0ef('0x39')]=qs[_0xc0ef('0x3a')](_0x57c2d9['query'][_0xc0ef('0x3a')]);_0x15c81e[_0xc0ef('0x3b')]=qs[_0xc0ef('0x3c')](_['pick'](_0x57c2d9['query'],_0x34deb1[_0xc0ef('0x3c')]),_0x1378a7);if(_0x57c2d9[_0xc0ef('0x32')][_0xc0ef('0x3d')]){_0x15c81e[_0xc0ef('0x3b')]=_['merge'](_0x15c81e['where'],{'$or':_['map'](_0x1378a7,function(_0x16f072){if(_0x16f072[_0xc0ef('0x2d')]!=='VIRTUAL'){var _0x157f9e={};_0x157f9e[_0x16f072['name']]={'$like':'%'+_0x57c2d9[_0xc0ef('0x32')][_0xc0ef('0x3d')]+'%'};return _0x157f9e;}})});}_0x15c81e=_[_0xc0ef('0x3e')]({},_0x15c81e,_0x57c2d9[_0xc0ef('0x3f')]);var _0x4af951={'where':_0x15c81e[_0xc0ef('0x3b')]};return db['VoiceMailMessage']['count'](_0x4af951)[_0xc0ef('0x40')](function(_0x15f968){_0x3252c2[_0xc0ef('0x22')]=_0x15f968;if(_0x57c2d9['query']['includeAll']){_0x15c81e[_0xc0ef('0x41')]=[{'all':!![]}];}return db[_0xc0ef('0x2a')]['findAll'](_0x15c81e);})['then'](function(_0x3cb21d){_0x3252c2[_0xc0ef('0x42')]=_0x3cb21d;return _0x3252c2;})[_0xc0ef('0x40')](respondWithFilteredResult(_0x22c344,_0x15c81e))[_0xc0ef('0x43')](handleError(_0x22c344,null));};exports['show']=function(_0x48b8a1,_0x594c5a){var _0x323c77={'raw':!![],'where':{'id':_0x48b8a1[_0xc0ef('0x44')]['id']}},_0x5bc703={};_0x5bc703[_0xc0ef('0x2f')]=_['keys'](db[_0xc0ef('0x2a')][_0xc0ef('0x2b')]);_0x5bc703['query']=_['keys'](_0x48b8a1[_0xc0ef('0x32')]);_0x5bc703[_0xc0ef('0x3c')]=_['intersection'](_0x5bc703['model'],_0x5bc703[_0xc0ef('0x32')]);_0x323c77[_0xc0ef('0x35')]=_[_0xc0ef('0x34')](_0x5bc703[_0xc0ef('0x2f')],qs[_0xc0ef('0x45')](_0x48b8a1[_0xc0ef('0x32')]['fields']));_0x323c77[_0xc0ef('0x35')]=_0x323c77[_0xc0ef('0x35')][_0xc0ef('0x36')]?_0x323c77['attributes']:_0x5bc703[_0xc0ef('0x2f')];if(_0x48b8a1['query']['includeAll']){_0x323c77[_0xc0ef('0x41')]=[{'all':!![]}];}_0x323c77=_[_0xc0ef('0x3e')]({},_0x323c77,_0x48b8a1['options']);return db[_0xc0ef('0x2a')][_0xc0ef('0x46')](_0x323c77)[_0xc0ef('0x40')](handleEntityNotFound(_0x594c5a,null))[_0xc0ef('0x40')](respondWithResult(_0x594c5a,null))[_0xc0ef('0x43')](handleError(_0x594c5a,null));};exports[_0xc0ef('0x47')]=function(_0x385aba,_0x2abd55){return db['VoiceMailMessage'][_0xc0ef('0x47')](_0x385aba[_0xc0ef('0x48')],{})[_0xc0ef('0x40')](respondWithResult(_0x2abd55,0xc9))[_0xc0ef('0x43')](handleError(_0x2abd55,null));};exports[_0xc0ef('0x25')]=function(_0x9b41ad,_0x4e90d3){if(_0x9b41ad[_0xc0ef('0x48')]['id']){delete _0x9b41ad[_0xc0ef('0x48')]['id'];}return db['VoiceMailMessage'][_0xc0ef('0x46')]({'where':{'id':_0x9b41ad[_0xc0ef('0x44')]['id']}})[_0xc0ef('0x40')](handleEntityNotFound(_0x4e90d3,null))[_0xc0ef('0x40')](saveUpdates(_0x9b41ad['body'],null))[_0xc0ef('0x40')](respondWithResult(_0x4e90d3,null))[_0xc0ef('0x43')](handleError(_0x4e90d3,null));};exports[_0xc0ef('0x26')]=function(_0x46f4f8,_0xe7d10a){return db[_0xc0ef('0x2a')][_0xc0ef('0x46')]({'where':{'id':_0x46f4f8['params']['id']}})['then'](handleEntityNotFound(_0xe7d10a,null))[_0xc0ef('0x40')](removeEntity(_0xe7d10a,null))[_0xc0ef('0x43')](handleError(_0xe7d10a,null));};exports['download']=function(_0x48bd56,_0x1af964,_0x3b0ffc){return db[_0xc0ef('0x2a')][_0xc0ef('0x46')]({'where':{'id':_0x48bd56[_0xc0ef('0x44')]['id']},'attributes':['id',_0xc0ef('0x49'),_0xc0ef('0x4a')]})['then'](handleEntityNotFound(_0x1af964,null))['then'](function(_0xe3c5f0){if(_0xe3c5f0){if(!_0xe3c5f0[_0xc0ef('0x49')]){throw new db['Sequelize'][(_0xc0ef('0x4b'))](_0xc0ef('0x4c'));}var _0xe0dceb={'Content-Type':'audio/wav','Content-Disposition':_0xc0ef('0x4d')};if(_0xe3c5f0['msg_id']){_0xe0dceb[_0xc0ef('0x4e')]=_0xc0ef('0x4f')+_0xe3c5f0[_0xc0ef('0x4a')]+_0xc0ef('0x50');}_0x1af964['set'](_0xe0dceb);return _0x1af964['send'](new Buffer(_0xe3c5f0[_0xc0ef('0x49')]));}})[_0xc0ef('0x43')](handleError(_0x1af964,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index c391d44..52f45f4 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 _0xda37=['moment','bluebird','request-promise','path','exports','define','VoiceMailMessage','lodash','util','../../config/logger'];(function(_0x9c2427,_0x17c865){var _0x51984f=function(_0x177af6){while(--_0x177af6){_0x9c2427['push'](_0x9c2427['shift']());}};_0x51984f(++_0x17c865);}(_0xda37,0xed));var _0x7da3=function(_0x3089fd,_0x13d913){_0x3089fd=_0x3089fd-0x0;var _0x317712=_0xda37[_0x3089fd];return _0x317712;};'use strict';var _=require(_0x7da3('0x0'));var util=require(_0x7da3('0x1'));var logger=require(_0x7da3('0x2'))('api');var moment=require(_0x7da3('0x3'));var BPromise=require(_0x7da3('0x4'));var rp=require(_0x7da3('0x5'));var fs=require('fs');var path=require(_0x7da3('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceMailMessage.attributes');module[_0x7da3('0x7')]=function(_0x150de3,_0x293286){return _0x150de3[_0x7da3('0x8')](_0x7da3('0x9'),attributes,{'tableName':'voice_voicemail_messages','paranoid':![],'indexes':[{'name':'dir','fields':['dir']}],'timestamps':![]});}; \ No newline at end of file +var _0x66ac=['util','api','bluebird','request-promise','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash'];(function(_0x4237b8,_0x1c6ff6){var _0x1e1dbd=function(_0x144ab5){while(--_0x144ab5){_0x4237b8['push'](_0x4237b8['shift']());}};_0x1e1dbd(++_0x1c6ff6);}(_0x66ac,0x185));var _0xc66a=function(_0x21e547,_0xec29b5){_0x21e547=_0x21e547-0x0;var _0x3d50ce=_0x66ac[_0x21e547];return _0x3d50ce;};'use strict';var _=require(_0xc66a('0x0'));var util=require(_0xc66a('0x1'));var logger=require('../../config/logger')(_0xc66a('0x2'));var moment=require('moment');var BPromise=require(_0xc66a('0x3'));var rp=require(_0xc66a('0x4'));var fs=require('fs');var path=require(_0xc66a('0x5'));var rimraf=require('rimraf');var config=require(_0xc66a('0x6'));var attributes=require(_0xc66a('0x7'));module[_0xc66a('0x8')]=function(_0x33019f,_0xb047de){return _0x33019f[_0xc66a('0x9')](_0xc66a('0xa'),attributes,{'tableName':_0xc66a('0xb'),'paranoid':![],'indexes':[{'name':_0xc66a('0xc'),'fields':[_0xc66a('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index 26e17c9..c88e079 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 _0x0c8e=['request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x0c8e,0x178));var _0xe0c8=function(_0x2b904e,_0x44ed7c){_0x2b904e=_0x2b904e-0x0;var _0x4f34cb=_0x0c8e[_0x2b904e];return _0x4f34cb;};'use strict';var _=require(_0xe0c8('0x0'));var util=require(_0xe0c8('0x1'));var moment=require(_0xe0c8('0x2'));var BPromise=require(_0xe0c8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe0c8('0x4'));var db=require(_0xe0c8('0x5'))['db'];var utils=require(_0xe0c8('0x6'));var logger=require(_0xe0c8('0x7'))('rpc');var config=require(_0xe0c8('0x8'));var jayson=require(_0xe0c8('0x9'));var client=jayson[_0xe0c8('0xa')][_0xe0c8('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x18d271,_0x1363e5,_0x1db0d0){return new BPromise(function(_0x20a0e7,_0x3b7a7c){return client['request'](_0x18d271,_0x1db0d0)[_0xe0c8('0xc')](function(_0x26e7fa){logger[_0xe0c8('0xd')](_0xe0c8('0xe'),_0x1363e5,_0xe0c8('0xf'));logger[_0xe0c8('0x10')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1363e5,'request\x20sent',JSON[_0xe0c8('0x11')](_0x26e7fa));if(_0x26e7fa['error']){if(_0x26e7fa[_0xe0c8('0x12')][_0xe0c8('0x13')]===0x1f4){logger[_0xe0c8('0x12')](_0xe0c8('0xe'),_0x1363e5,_0x26e7fa[_0xe0c8('0x12')][_0xe0c8('0x14')]);return _0x3b7a7c(_0x26e7fa[_0xe0c8('0x12')]['message']);}logger[_0xe0c8('0x12')]('VoiceMailMessage,\x20%s,\x20%s',_0x1363e5,_0x26e7fa[_0xe0c8('0x12')][_0xe0c8('0x14')]);return _0x20a0e7(_0x26e7fa[_0xe0c8('0x12')][_0xe0c8('0x14')]);}else{logger['info'](_0xe0c8('0xe'),_0x1363e5,'request\x20sent');_0x20a0e7(_0x26e7fa[_0xe0c8('0x15')][_0xe0c8('0x14')]);}})[_0xe0c8('0x16')](function(_0x1f3aad){logger[_0xe0c8('0x12')](_0xe0c8('0xe'),_0x1363e5,_0x1f3aad);_0x3b7a7c(_0x1f3aad);});});} \ No newline at end of file +var _0xb884=['debug','request\x20sent','stringify','error','code','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','then','info','VoiceMailMessage,\x20%s,\x20%s'];(function(_0xaa4fb7,_0x44f417){var _0x15215b=function(_0x2fca13){while(--_0x2fca13){_0xaa4fb7['push'](_0xaa4fb7['shift']());}};_0x15215b(++_0x44f417);}(_0xb884,0x197));var _0x4b88=function(_0x386247,_0x5dcfa9){_0x386247=_0x386247-0x0;var _0x3abf65=_0xb884[_0x386247];return _0x3abf65;};'use strict';var _=require(_0x4b88('0x0'));var util=require('util');var moment=require(_0x4b88('0x1'));var BPromise=require('bluebird');var rs=require(_0x4b88('0x2'));var fs=require('fs');var Redis=require(_0x4b88('0x3'));var db=require(_0x4b88('0x4'))['db'];var utils=require(_0x4b88('0x5'));var logger=require(_0x4b88('0x6'))('rpc');var config=require(_0x4b88('0x7'));var jayson=require(_0x4b88('0x8'));var client=jayson[_0x4b88('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4086ce,_0x1322a2,_0x1f60fe){return new BPromise(function(_0x5e3c7f,_0x31cb25){return client['request'](_0x4086ce,_0x1f60fe)[_0x4b88('0xa')](function(_0x54e000){logger[_0x4b88('0xb')](_0x4b88('0xc'),_0x1322a2,'request\x20sent');logger[_0x4b88('0xd')]('VoiceMailMessage,\x20%s,\x20%s,\x20%s',_0x1322a2,_0x4b88('0xe'),JSON[_0x4b88('0xf')](_0x54e000));if(_0x54e000['error']){if(_0x54e000[_0x4b88('0x10')][_0x4b88('0x11')]===0x1f4){logger[_0x4b88('0x10')](_0x4b88('0xc'),_0x1322a2,_0x54e000[_0x4b88('0x10')]['message']);return _0x31cb25(_0x54e000[_0x4b88('0x10')][_0x4b88('0x12')]);}logger[_0x4b88('0x10')](_0x4b88('0xc'),_0x1322a2,_0x54e000[_0x4b88('0x10')][_0x4b88('0x12')]);return _0x5e3c7f(_0x54e000[_0x4b88('0x10')]['message']);}else{logger['info']('VoiceMailMessage,\x20%s,\x20%s',_0x1322a2,'request\x20sent');_0x5e3c7f(_0x54e000[_0x4b88('0x13')][_0x4b88('0x12')]);}})['catch'](function(_0x250e3c){logger[_0x4b88('0x10')](_0x4b88('0xc'),_0x1322a2,_0x250e3c);_0x31cb25(_0x250e3c);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 0e0335d..c8bc7f4 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 _0x00fc=['isAuthenticated','index','/:id','show','get','/:id/sounds','getSounds','post','addSound','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller'];(function(_0x3db928,_0x462f81){var _0x18793b=function(_0x33f62a){while(--_0x33f62a){_0x3db928['push'](_0x3db928['shift']());}};_0x18793b(++_0x462f81);}(_0x00fc,0xce));var _0xc00f=function(_0x59befa,_0x4af99b){_0x59befa=_0x59befa-0x0;var _0x1dd63d=_0x00fc[_0x59befa];return _0x1dd63d;};'use strict';var multer=require(_0xc00f('0x0'));var util=require(_0xc00f('0x1'));var path=require(_0xc00f('0x2'));var timeout=require(_0xc00f('0x3'));var express=require(_0xc00f('0x4'));var router=express['Router']();var fs_extra=require(_0xc00f('0x5'));var auth=require(_0xc00f('0x6'));var interaction=require(_0xc00f('0x7'));var config=require(_0xc00f('0x8'));var controller=require(_0xc00f('0x9'));router['get']('/',auth[_0xc00f('0xa')](),controller[_0xc00f('0xb')]);router['get'](_0xc00f('0xc'),auth[_0xc00f('0xa')](),controller[_0xc00f('0xd')]);router[_0xc00f('0xe')](_0xc00f('0xf'),auth[_0xc00f('0xa')](),controller[_0xc00f('0x10')]);router[_0xc00f('0x11')]('/',auth[_0xc00f('0xa')](),controller['create']);router[_0xc00f('0x11')](_0xc00f('0xf'),auth[_0xc00f('0xa')](),controller[_0xc00f('0x12')]);router[_0xc00f('0x13')](_0xc00f('0xc'),auth[_0xc00f('0xa')](),controller[_0xc00f('0x14')]);router[_0xc00f('0x15')](_0xc00f('0xc'),auth['isAuthenticated'](),controller[_0xc00f('0x16')]);router['delete']('/:id/sounds/:id2',auth[_0xc00f('0xa')](),controller['removeSound']);module[_0xc00f('0x17')]=router; \ No newline at end of file +var _0x73da=['isAuthenticated','index','/:id','post','create','/:id/sounds','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get'];(function(_0x214a25,_0x15071d){var _0x405988=function(_0x5c6fc1){while(--_0x5c6fc1){_0x214a25['push'](_0x214a25['shift']());}};_0x405988(++_0x15071d);}(_0x73da,0x15c));var _0xa73d=function(_0x1179f3,_0x100df5){_0x1179f3=_0x1179f3-0x0;var _0x8a9a2b=_0x73da[_0x1179f3];return _0x8a9a2b;};'use strict';var multer=require(_0xa73d('0x0'));var util=require(_0xa73d('0x1'));var path=require(_0xa73d('0x2'));var timeout=require(_0xa73d('0x3'));var express=require(_0xa73d('0x4'));var router=express[_0xa73d('0x5')]();var fs_extra=require(_0xa73d('0x6'));var auth=require(_0xa73d('0x7'));var interaction=require(_0xa73d('0x8'));var config=require(_0xa73d('0x9'));var controller=require(_0xa73d('0xa'));router[_0xa73d('0xb')]('/',auth[_0xa73d('0xc')](),controller[_0xa73d('0xd')]);router['get'](_0xa73d('0xe'),auth[_0xa73d('0xc')](),controller['show']);router['get']('/:id/sounds',auth['isAuthenticated'](),controller['getSounds']);router[_0xa73d('0xf')]('/',auth['isAuthenticated'](),controller[_0xa73d('0x10')]);router['post'](_0xa73d('0x11'),auth[_0xa73d('0xc')](),controller['addSound']);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0xa73d('0x12')](_0xa73d('0xe'),auth[_0xa73d('0xc')](),controller['destroy']);router[_0xa73d('0x12')]('/:id/sounds/:id2',auth[_0xa73d('0xc')](),controller['removeSound']);module[_0xa73d('0x13')]=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 340d3c4..184bc7e 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 _0xf8be=['STRING','name','ENUM','custom','files','mp3nb','quietmp3nb','alpha','BOOLEAN','sequelize'];(function(_0x1f5750,_0x4c1ba1){var _0x25105=function(_0x4a41a0){while(--_0x4a41a0){_0x1f5750['push'](_0x1f5750['shift']());}};_0x25105(++_0x4c1ba1);}(_0xf8be,0x12b));var _0xef8b=function(_0x279678,_0xe2ba12){_0x279678=_0x279678-0x0;var _0x2e85a7=_0xf8be[_0x279678];return _0x2e85a7;};'use strict';var Sequelize=require(_0xef8b('0x0'));module['exports']={'name':{'type':Sequelize[_0xef8b('0x1')],'allowNull':![],'unique':_0xef8b('0x2')},'mode':{'type':Sequelize[_0xef8b('0x3')](_0xef8b('0x4'),_0xef8b('0x5'),_0xef8b('0x6'),_0xef8b('0x7'),'quietmp3','mp3'),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize[_0xef8b('0x1')],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize[_0xef8b('0x1')],'allowNull':!![]},'sort':{'type':Sequelize[_0xef8b('0x1')],'allowNull':!![],'defaultValue':_0xef8b('0x8')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize[_0xef8b('0x9')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7d9d=['ENUM','files','mp3nb','quietmp3nb','quietmp3','mp3','alpha','TIMESTAMP','BOOLEAN','sequelize','STRING','name'];(function(_0x47f262,_0x3ba68a){var _0x50263f=function(_0x3757f7){while(--_0x3757f7){_0x47f262['push'](_0x47f262['shift']());}};_0x50263f(++_0x3ba68a);}(_0x7d9d,0x129));var _0xd7d9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7d9d[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd7d9('0x0'));module['exports']={'name':{'type':Sequelize[_0xd7d9('0x1')],'allowNull':![],'unique':_0xd7d9('0x2')},'mode':{'type':Sequelize[_0xd7d9('0x3')]('custom',_0xd7d9('0x4'),_0xd7d9('0x5'),_0xd7d9('0x6'),_0xd7d9('0x7'),_0xd7d9('0x8')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize['STRING'],'allowNull':!![]},'digit':{'type':Sequelize['STRING'],'allowNull':!![]},'sort':{'type':Sequelize[_0xd7d9('0x1')],'allowNull':!![],'defaultValue':_0xd7d9('0x9')},'format':{'type':Sequelize[_0xd7d9('0x1')],'allowNull':!![]},'stamp':{'type':_0xd7d9('0xa')},'defaultEntry':{'type':Sequelize[_0xd7d9('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 30137eb..899407c 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 _0x0146=['extname','converted_format','symlinkSync','removeSound','id2','Sound','findOne','format','%s.%s','Sequelize','getSounds','order','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','crypto','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','sendStatus','end','status','offset','undefined','limit','count','set','Content-Range','json','reject','update','then','get','MusicOnHolds','UserProfileResource','destroy','error','stack','send','VoiceMusicOnHold','rawAttributes','fieldName','model','map','name','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','type','VIRTUAL','options','includeAll','findAll','rows','catch','params','include','body','transaction','mode','files','directory','join','root','server/files/moh','create','mkdirSync','0777','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','readdirSync','forEach','unlinkSync','rmdirSync','ValidationError','message','addSound','sequelize','save_name','createdAt','server/files/sounds/converted'];(function(_0x946518,_0x22816f){var _0x909b69=function(_0x2fa5a4){while(--_0x2fa5a4){_0x946518['push'](_0x946518['shift']());}};_0x909b69(++_0x22816f);}(_0x0146,0x7f));var _0x6014=function(_0x269ee8,_0x477226){_0x269ee8=_0x269ee8-0x0;var _0x4d98bd=_0x0146[_0x269ee8];return _0x4d98bd;};'use strict';var emlformat=require(_0x6014('0x0'));var rimraf=require(_0x6014('0x1'));var zipdir=require(_0x6014('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6014('0x3'));var moment=require(_0x6014('0x4'));var BPromise=require(_0x6014('0x5'));var Mustache=require(_0x6014('0x6'));var util=require(_0x6014('0x7'));var path=require('path');var sox=require(_0x6014('0x8'));var csv=require(_0x6014('0x9'));var ejs=require(_0x6014('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6014('0xb'));var squel=require('squel');var crypto=require(_0x6014('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x6014('0xd'));var toCsv=require(_0x6014('0x9'));var querystring=require(_0x6014('0xe'));var Papa=require(_0x6014('0xf'));var Redis=require('ioredis');var authService=require(_0x6014('0x10'));var qs=require(_0x6014('0x11'));var as=require(_0x6014('0x12'));var hardwareService=require(_0x6014('0x13'));var logger=require(_0x6014('0x14'))('api');var utils=require(_0x6014('0x15'));var config=require(_0x6014('0x16'));var licenseUtil=require(_0x6014('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5c374a,_0x4abdd0){_0x4abdd0=_0x4abdd0||0xcc;return function(_0x53cf86){if(_0x53cf86){return _0x5c374a[_0x6014('0x18')](_0x4abdd0);}return _0x5c374a['status'](_0x4abdd0)[_0x6014('0x19')]();};}function respondWithResult(_0x1094bd,_0x329c22){_0x329c22=_0x329c22||0xc8;return function(_0x3c370c){if(_0x3c370c){return _0x1094bd[_0x6014('0x1a')](_0x329c22)['json'](_0x3c370c);}};}function respondWithFilteredResult(_0x61d135,_0x463065){return function(_0x265143){if(_0x265143){var _0x38816f=typeof _0x463065[_0x6014('0x1b')]===_0x6014('0x1c')&&typeof _0x463065[_0x6014('0x1d')]===_0x6014('0x1c');var _0x42a4eb=_0x265143[_0x6014('0x1e')];var _0x3c4ee5=_0x38816f?0x0:_0x463065[_0x6014('0x1b')];var _0x23a5ae=_0x38816f?_0x265143['count']:_0x463065[_0x6014('0x1b')]+_0x463065[_0x6014('0x1d')];var _0x4895e0;if(_0x23a5ae>=_0x42a4eb){_0x23a5ae=_0x42a4eb;_0x4895e0=0xc8;}else{_0x4895e0=0xce;}_0x61d135[_0x6014('0x1a')](_0x4895e0);return _0x61d135[_0x6014('0x1f')](_0x6014('0x20'),_0x3c4ee5+'-'+_0x23a5ae+'/'+_0x42a4eb)[_0x6014('0x21')](_0x265143);}return null;};}function patchUpdates(_0x41c6ff){return function(_0x5c4f88){try{jsonpatch['apply'](_0x5c4f88,_0x41c6ff,!![]);}catch(_0x3a9684){return BPromise[_0x6014('0x22')](_0x3a9684);}return _0x5c4f88['save']();};}function saveUpdates(_0x10c9ea,_0x58f073){return function(_0x486441){if(_0x486441){return _0x486441[_0x6014('0x23')](_0x10c9ea)[_0x6014('0x24')](function(_0x1de535){return _0x1de535;});}return null;};}function removeEntity(_0x59fb03,_0x3cc729){return function(_0x397491){if(_0x397491){return _0x397491['destroy']()['then'](function(){var _0x3049e0=_0x397491[_0x6014('0x25')]({'plain':!![]});var _0x470190=_0x6014('0x26');return db[_0x6014('0x27')][_0x6014('0x28')]({'where':{'type':_0x470190,'resourceId':_0x3049e0['id']}})[_0x6014('0x24')](function(){return _0x397491;});})['then'](function(){_0x59fb03['status'](0xcc)[_0x6014('0x19')]();});}};}function handleEntityNotFound(_0x5b740e,_0x3f6ee1){return function(_0x2d3d9e){if(!_0x2d3d9e){_0x5b740e[_0x6014('0x18')](0x194);}return _0x2d3d9e;};}function handleError(_0x2e9b1f,_0x40e498){_0x40e498=_0x40e498||0x1f4;return function(_0x1c6d0b){logger[_0x6014('0x29')](_0x1c6d0b[_0x6014('0x2a')]);if(_0x1c6d0b['name']){delete _0x1c6d0b['name'];}_0x2e9b1f[_0x6014('0x1a')](_0x40e498)[_0x6014('0x2b')](_0x1c6d0b);};}exports['index']=function(_0x93a94a,_0x4e1bc9){var _0xf952a={},_0x1fa4fc={},_0x399db9={'count':0x0,'rows':[]};var _0x538e30=_['map'](db[_0x6014('0x2c')][_0x6014('0x2d')],function(_0x4930a4){return{'name':_0x4930a4[_0x6014('0x2e')],'type':_0x4930a4['type']['key']};});_0x1fa4fc[_0x6014('0x2f')]=_[_0x6014('0x30')](_0x538e30,_0x6014('0x31'));_0x1fa4fc[_0x6014('0x32')]=_[_0x6014('0x33')](_0x93a94a['query']);_0x1fa4fc['filters']=_[_0x6014('0x34')](_0x1fa4fc[_0x6014('0x2f')],_0x1fa4fc[_0x6014('0x32')]);_0xf952a[_0x6014('0x35')]=_[_0x6014('0x34')](_0x1fa4fc[_0x6014('0x2f')],qs[_0x6014('0x36')](_0x93a94a['query'][_0x6014('0x36')]));_0xf952a[_0x6014('0x35')]=_0xf952a['attributes'][_0x6014('0x37')]?_0xf952a[_0x6014('0x35')]:_0x1fa4fc[_0x6014('0x2f')];if(!_0x93a94a['query'][_0x6014('0x38')](_0x6014('0x39'))){_0xf952a[_0x6014('0x1d')]=qs[_0x6014('0x1d')](_0x93a94a['query'][_0x6014('0x1d')]);_0xf952a[_0x6014('0x1b')]=qs[_0x6014('0x1b')](_0x93a94a[_0x6014('0x32')][_0x6014('0x1b')]);}_0xf952a['order']=qs['sort'](_0x93a94a['query'][_0x6014('0x3a')]);delete _0x93a94a[_0x6014('0x32')]['sort'];_0xf952a[_0x6014('0x3b')]=qs[_0x6014('0x3c')](_[_0x6014('0x3d')](_0x93a94a[_0x6014('0x32')],_0x1fa4fc[_0x6014('0x3c')]),_0x538e30);if(_0x93a94a[_0x6014('0x32')][_0x6014('0x3e')]){_0xf952a[_0x6014('0x3b')]=_[_0x6014('0x3f')](_0xf952a['where'],{'$or':_[_0x6014('0x30')](_0x538e30,function(_0x2f1681){if(_0x2f1681[_0x6014('0x40')]!==_0x6014('0x41')){var _0x30c218={};_0x30c218[_0x2f1681[_0x6014('0x31')]]={'$like':'%'+_0x93a94a[_0x6014('0x32')][_0x6014('0x3e')]+'%'};return _0x30c218;}})});}_0xf952a=_['merge']({},_0xf952a,_0x93a94a[_0x6014('0x42')]);var _0x4d47dc={'where':_0xf952a['where']};return db[_0x6014('0x2c')][_0x6014('0x1e')](_0x4d47dc)[_0x6014('0x24')](function(_0x1a972c){_0x399db9['count']=_0x1a972c;if(_0x93a94a[_0x6014('0x32')][_0x6014('0x43')]){_0xf952a['include']=[{'all':!![]}];}return db[_0x6014('0x2c')][_0x6014('0x44')](_0xf952a);})['then'](function(_0x36c9d9){_0x399db9[_0x6014('0x45')]=_0x36c9d9;return _0x399db9;})[_0x6014('0x24')](respondWithFilteredResult(_0x4e1bc9,_0xf952a))[_0x6014('0x46')](handleError(_0x4e1bc9,null));};exports['show']=function(_0x2390fe,_0x27e3e2){var _0x3d16af={'raw':![],'where':{'id':_0x2390fe[_0x6014('0x47')]['id']}},_0x26f12d={};_0x26f12d[_0x6014('0x2f')]=_[_0x6014('0x33')](db[_0x6014('0x2c')][_0x6014('0x2d')]);_0x26f12d[_0x6014('0x32')]=_['keys'](_0x2390fe['query']);_0x26f12d[_0x6014('0x3c')]=_['intersection'](_0x26f12d[_0x6014('0x2f')],_0x26f12d[_0x6014('0x32')]);_0x3d16af[_0x6014('0x35')]=_[_0x6014('0x34')](_0x26f12d[_0x6014('0x2f')],qs['fields'](_0x2390fe[_0x6014('0x32')][_0x6014('0x36')]));_0x3d16af[_0x6014('0x35')]=_0x3d16af[_0x6014('0x35')][_0x6014('0x37')]?_0x3d16af[_0x6014('0x35')]:_0x26f12d[_0x6014('0x2f')];if(_0x2390fe['query'][_0x6014('0x43')]){_0x3d16af[_0x6014('0x48')]=[{'all':!![]}];}_0x3d16af=_[_0x6014('0x3f')]({},_0x3d16af,_0x2390fe[_0x6014('0x42')]);return db[_0x6014('0x2c')]['find'](_0x3d16af)[_0x6014('0x24')](handleEntityNotFound(_0x27e3e2,null))[_0x6014('0x24')](respondWithResult(_0x27e3e2,null))[_0x6014('0x46')](handleError(_0x27e3e2,null));};exports['update']=function(_0x33b4d5,_0x42a460){if(_0x33b4d5[_0x6014('0x49')]['id']){delete _0x33b4d5[_0x6014('0x49')]['id'];}return db[_0x6014('0x2c')]['find']({'where':{'id':_0x33b4d5[_0x6014('0x47')]['id']}})[_0x6014('0x24')](handleEntityNotFound(_0x42a460,null))[_0x6014('0x24')](saveUpdates(_0x33b4d5[_0x6014('0x49')],null))[_0x6014('0x24')](respondWithResult(_0x42a460,null))[_0x6014('0x46')](handleError(_0x42a460,null));};exports['create']=function(_0x269f61,_0x16acbd,_0x1b7016){return db['sequelize'][_0x6014('0x4a')](function(_0x4d48a3){if(_0x269f61['body'][_0x6014('0x4b')]===_0x6014('0x4c')){_0x269f61[_0x6014('0x49')][_0x6014('0x4d')]=path[_0x6014('0x4e')](config[_0x6014('0x4f')],_0x6014('0x50'),_0x269f61[_0x6014('0x49')][_0x6014('0x31')]);}return db[_0x6014('0x2c')][_0x6014('0x51')](_0x269f61[_0x6014('0x49')],{'transaction':_0x4d48a3})[_0x6014('0x24')](function(_0xf604cd){if(_0x269f61[_0x6014('0x49')][_0x6014('0x4b')]===_0x6014('0x4c')){fs[_0x6014('0x52')](_0xf604cd['directory'],parseInt(_0x6014('0x53'),0x8));}var _0x2d79cf=_0x269f61[_0x6014('0x54')]['get']({'plain':!![]});if(!_0x2d79cf)throw new Error(_0x6014('0x55'));if(_0x2d79cf[_0x6014('0x56')]===_0x6014('0x54')){var _0x12d5a4=_0xf604cd['get']({'plain':!![]});return db[_0x6014('0x57')][_0x6014('0x58')]({'where':{'name':_0x6014('0x26'),'userProfileId':_0x2d79cf[_0x6014('0x59')]},'raw':!![]})['then'](function(_0x4b3985){if(_0x4b3985&&_0x4b3985[_0x6014('0x5a')]===0x0){return db[_0x6014('0x27')]['create']({'name':_0x12d5a4[_0x6014('0x31')],'resourceId':_0x12d5a4['id'],'type':_0x4b3985[_0x6014('0x31')],'sectionId':_0x4b3985['id']},{})[_0x6014('0x24')](function(){return _0xf604cd;});}else{return _0xf604cd;}})['catch'](function(_0x225889){logger[_0x6014('0x29')](_0x6014('0x5b'),_0x225889);});}return _0xf604cd;});})[_0x6014('0x24')](respondWithResult(_0x16acbd,0xc9))['catch'](handleError(_0x16acbd,null));};exports[_0x6014('0x28')]=function(_0x3d63fe,_0x32377b,_0x38e7ac){var _0x2ced8f;return db[_0x6014('0x2c')][_0x6014('0x58')]({'where':{'id':_0x3d63fe['params']['id']}})[_0x6014('0x24')](function(_0xc5887d){if(_0xc5887d){return db['sequelize']['transaction'](function(_0x157887){return _0xc5887d[_0x6014('0x28')]({'transaction':_0x157887,'raw':!![]})[_0x6014('0x24')](function(_0x49d97e){if(_0x49d97e[_0x6014('0x4d')]){fs[_0x6014('0x5c')](_0x49d97e['directory'])[_0x6014('0x5d')](function(_0x5c0810){fs[_0x6014('0x5e')](path['join'](_0x49d97e[_0x6014('0x4d')],_0x5c0810));});fs[_0x6014('0x5f')](_0x49d97e[_0x6014('0x4d')]);}return _0x49d97e;});})[_0x6014('0x46')](function(_0x5d8ab6){throw new db['Sequelize'][(_0x6014('0x60'))](_0x5d8ab6[_0x6014('0x61')]);});}})[_0x6014('0x24')](handleEntityNotFound(_0x32377b,null))['then'](removeEntity(_0x32377b,null))[_0x6014('0x46')](handleError(_0x32377b,null));};exports[_0x6014('0x62')]=function(_0x2e1d7c,_0x47be16,_0x2589b2){return db[_0x6014('0x63')][_0x6014('0x4a')](function(_0x4a2cde){var _0xba55db;return db[_0x6014('0x2c')]['find']({'where':{'id':_0x2e1d7c[_0x6014('0x47')]['id']}})[_0x6014('0x24')](function(_0x139b69){if(_0x139b69){_0xba55db=_0x139b69;return _0x139b69[_0x6014('0x62')](_0x2e1d7c[_0x6014('0x49')]['id'],{'transaction':_0x4a2cde});}})['then'](function(_0x247f5a){if(_0x247f5a){return db['Sound']['findOne']({'where':{'id':_0x2e1d7c['body']['id']},'attributes':['id',_0x6014('0x31'),_0x6014('0x64'),'converted_format',_0x6014('0x65')],'raw':!![]});}})[_0x6014('0x24')](function(_0x15838d){if(_0x15838d){var _0x40c458=path['join'](config['root'],_0x6014('0x66'),util['format']('%s.%s',path['basename'](_0x15838d['save_name'],path[_0x6014('0x67')](_0x15838d[_0x6014('0x64')])),_0x15838d[_0x6014('0x68')]));var _0x30d2f8=path[_0x6014('0x4e')](config[_0x6014('0x4f')],_0x6014('0x50'),_0xba55db[_0x6014('0x31')],util['format']('%s.%s',_0x15838d['name'],_0x15838d[_0x6014('0x68')]));fs[_0x6014('0x69')](_0x40c458,_0x30d2f8);return _0x15838d;}})[_0x6014('0x46')](function(_0x272a68){throw new db['Sequelize'][(_0x6014('0x60'))](_0x272a68[_0x6014('0x61')]);});})[_0x6014('0x24')](handleEntityNotFound(_0x47be16,null))[_0x6014('0x24')](respondWithResult(_0x47be16,0xc9))[_0x6014('0x46')](handleError(_0x47be16,null));};exports[_0x6014('0x6a')]=function(_0x8ad932,_0x2e6a73,_0x319761){return db[_0x6014('0x63')][_0x6014('0x4a')](function(_0x3d723e){var _0x5712dd;return db[_0x6014('0x2c')]['findOne']({'where':{'id':_0x8ad932[_0x6014('0x47')]['id']}})[_0x6014('0x24')](handleEntityNotFound(_0x2e6a73,null))['then'](function(_0x381b78){if(_0x381b78){_0x5712dd=_0x381b78;return _0x381b78[_0x6014('0x6a')](_0x8ad932[_0x6014('0x47')][_0x6014('0x6b')]);}})[_0x6014('0x24')](function(_0xb16769){if(_0xb16769){return db[_0x6014('0x6c')][_0x6014('0x6d')]({'where':{'id':_0x8ad932[_0x6014('0x47')][_0x6014('0x6b')]},'attributes':['id',_0x6014('0x31'),_0x6014('0x64'),_0x6014('0x68'),_0x6014('0x65')],'raw':!![]});}})[_0x6014('0x24')](function(_0x1a222d){if(_0x1a222d){fs[_0x6014('0x5e')](path['join'](_0x5712dd['directory'],util[_0x6014('0x6e')](_0x6014('0x6f'),_0x1a222d[_0x6014('0x31')],_0x1a222d[_0x6014('0x68')])));return _0x1a222d;}})[_0x6014('0x46')](function(_0xced03e){throw new db[(_0x6014('0x70'))][(_0x6014('0x60'))](_0xced03e[_0x6014('0x61')]);});})[_0x6014('0x24')](handleEntityNotFound(_0x2e6a73,null))[_0x6014('0x24')](respondWithStatusCode(_0x2e6a73,0xcc))[_0x6014('0x46')](handleError(_0x2e6a73,null));};exports[_0x6014('0x71')]=function(_0x4b5deb,_0x3be071,_0x3bbe08){var _0x351daf={};var _0x327a4b={};var _0x27a9b8;var _0x763211;return db[_0x6014('0x2c')]['findOne']({'where':{'id':_0x4b5deb[_0x6014('0x47')]['id']}})[_0x6014('0x24')](handleEntityNotFound(_0x3be071,null))[_0x6014('0x24')](function(_0x461eb8){if(_0x461eb8){_0x27a9b8=_0x461eb8;_0x327a4b[_0x6014('0x2f')]=_[_0x6014('0x33')](db[_0x6014('0x6c')][_0x6014('0x2d')]);_0x327a4b[_0x6014('0x32')]=_[_0x6014('0x33')](_0x4b5deb[_0x6014('0x32')]);_0x327a4b[_0x6014('0x3c')]=_[_0x6014('0x34')](_0x327a4b[_0x6014('0x2f')],_0x327a4b[_0x6014('0x32')]);_0x351daf[_0x6014('0x35')]=_[_0x6014('0x34')](_0x327a4b[_0x6014('0x2f')],qs[_0x6014('0x36')](_0x4b5deb[_0x6014('0x32')][_0x6014('0x36')]));_0x351daf[_0x6014('0x35')]=_0x351daf[_0x6014('0x35')]['length']?_0x351daf[_0x6014('0x35')]:_0x327a4b['model'];_0x351daf[_0x6014('0x72')]=qs['sort'](_0x4b5deb[_0x6014('0x32')]['sort']);_0x351daf[_0x6014('0x3b')]=qs[_0x6014('0x3c')](_[_0x6014('0x3d')](_0x4b5deb[_0x6014('0x32')],_0x327a4b[_0x6014('0x3c')]));if(_0x4b5deb[_0x6014('0x32')][_0x6014('0x3e')]){_0x351daf['where']=_[_0x6014('0x3f')](_0x351daf[_0x6014('0x3b')],{'$or':_[_0x6014('0x30')](_0x351daf['attributes'],function(_0x473c16){var _0x443017={};_0x443017[_0x473c16]={'$like':'%'+_0x4b5deb[_0x6014('0x32')][_0x6014('0x3e')]+'%'};return _0x443017;})});}_0x351daf=_[_0x6014('0x3f')]({},_0x351daf,_0x4b5deb[_0x6014('0x42')]);return _0x27a9b8[_0x6014('0x71')](_0x351daf);}})['then'](function(_0x9d6c53){if(_0x9d6c53){_0x763211=_0x9d6c53[_0x6014('0x37')];if(!_0x4b5deb['query'][_0x6014('0x38')](_0x6014('0x39'))){_0x351daf['limit']=qs[_0x6014('0x1d')](_0x4b5deb[_0x6014('0x32')][_0x6014('0x1d')]);_0x351daf['offset']=qs[_0x6014('0x1b')](_0x4b5deb['query']['offset']);}return _0x27a9b8[_0x6014('0x71')](_0x351daf);}})[_0x6014('0x24')](function(_0x2c74ff){if(_0x2c74ff){return _0x2c74ff?{'count':_0x763211,'rows':_0x2c74ff}:null;}})[_0x6014('0x24')](respondWithResult(_0x3be071,null))[_0x6014('0x46')](handleError(_0x3be071,null));}; \ No newline at end of file +var _0x0059=['sox','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','end','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','then','MusicOnHolds','UserProfileResource','sendStatus','error','stack','name','send','index','VoiceMusicOnHold','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','where','map','VIRTUAL','merge','options','findAll','rows','includeAll','include','find','catch','body','create','transaction','files','directory','join','root','server/files/moh','mode','mkdirSync','0777','user','role','get','UserProfileSection','userProfileId','autoAssociation','params','sequelize','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','save_name','converted_format','server/files/sounds/converted','format','%s.%s','basename','extname','symlinkSync','removeSound','id2','createdAt','getSounds','filter','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path'];(function(_0x2563d4,_0x52e6f8){var _0x141444=function(_0xea6309){while(--_0xea6309){_0x2563d4['push'](_0x2563d4['shift']());}};_0x141444(++_0x52e6f8);}(_0x0059,0x1dc));var _0x9005=function(_0x3b7b8a,_0x52c3b0){_0x3b7b8a=_0x3b7b8a-0x0;var _0x441206=_0x0059[_0x3b7b8a];return _0x441206;};'use strict';var emlformat=require(_0x9005('0x0'));var rimraf=require(_0x9005('0x1'));var zipdir=require(_0x9005('0x2'));var jsonpatch=require(_0x9005('0x3'));var rp=require('request-promise');var moment=require(_0x9005('0x4'));var BPromise=require(_0x9005('0x5'));var Mustache=require('mustache');var util=require(_0x9005('0x6'));var path=require(_0x9005('0x7'));var sox=require(_0x9005('0x8'));var csv=require(_0x9005('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9005('0xa'));var _=require(_0x9005('0xb'));var squel=require(_0x9005('0xc'));var crypto=require(_0x9005('0xd'));var jsforce=require(_0x9005('0xe'));var deskjs=require(_0x9005('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x9005('0x10'));var Redis=require(_0x9005('0x11'));var authService=require(_0x9005('0x12'));var qs=require(_0x9005('0x13'));var as=require(_0x9005('0x14'));var hardwareService=require(_0x9005('0x15'));var logger=require(_0x9005('0x16'))(_0x9005('0x17'));var utils=require(_0x9005('0x18'));var config=require(_0x9005('0x19'));var licenseUtil=require(_0x9005('0x1a'));var db=require(_0x9005('0x1b'))['db'];function respondWithStatusCode(_0x32cf4c,_0x2e4b57){_0x2e4b57=_0x2e4b57||0xcc;return function(_0x4bdd40){if(_0x4bdd40){return _0x32cf4c['sendStatus'](_0x2e4b57);}return _0x32cf4c[_0x9005('0x1c')](_0x2e4b57)[_0x9005('0x1d')]();};}function respondWithResult(_0x45b37d,_0x1d928c){_0x1d928c=_0x1d928c||0xc8;return function(_0x19e9bc){if(_0x19e9bc){return _0x45b37d[_0x9005('0x1c')](_0x1d928c)[_0x9005('0x1e')](_0x19e9bc);}};}function respondWithFilteredResult(_0x46b9fe,_0xc5d665){return function(_0x312a1e){if(_0x312a1e){var _0x1d664e=typeof _0xc5d665[_0x9005('0x1f')]===_0x9005('0x20')&&typeof _0xc5d665['limit']===_0x9005('0x20');var _0x568484=_0x312a1e[_0x9005('0x21')];var _0x504cfa=_0x1d664e?0x0:_0xc5d665[_0x9005('0x1f')];var _0x5a2acc=_0x1d664e?_0x312a1e['count']:_0xc5d665[_0x9005('0x1f')]+_0xc5d665[_0x9005('0x22')];var _0x37a38e;if(_0x5a2acc>=_0x568484){_0x5a2acc=_0x568484;_0x37a38e=0xc8;}else{_0x37a38e=0xce;}_0x46b9fe['status'](_0x37a38e);return _0x46b9fe['set'](_0x9005('0x23'),_0x504cfa+'-'+_0x5a2acc+'/'+_0x568484)[_0x9005('0x1e')](_0x312a1e);}return null;};}function patchUpdates(_0x2d16fc){return function(_0x1c8fde){try{jsonpatch[_0x9005('0x24')](_0x1c8fde,_0x2d16fc,!![]);}catch(_0x473df7){return BPromise[_0x9005('0x25')](_0x473df7);}return _0x1c8fde[_0x9005('0x26')]();};}function saveUpdates(_0x2f3297,_0x24ba39){return function(_0x58d720){if(_0x58d720){return _0x58d720[_0x9005('0x27')](_0x2f3297)['then'](function(_0x3f1e58){return _0x3f1e58;});}return null;};}function removeEntity(_0x40ee73,_0x484d63){return function(_0x16abcf){if(_0x16abcf){return _0x16abcf[_0x9005('0x28')]()[_0x9005('0x29')](function(){var _0x133763=_0x16abcf['get']({'plain':!![]});var _0x25abea=_0x9005('0x2a');return db[_0x9005('0x2b')][_0x9005('0x28')]({'where':{'type':_0x25abea,'resourceId':_0x133763['id']}})[_0x9005('0x29')](function(){return _0x16abcf;});})[_0x9005('0x29')](function(){_0x40ee73['status'](0xcc)[_0x9005('0x1d')]();});}};}function handleEntityNotFound(_0x233dff,_0x489f96){return function(_0x1992a6){if(!_0x1992a6){_0x233dff[_0x9005('0x2c')](0x194);}return _0x1992a6;};}function handleError(_0x3050d8,_0x48898b){_0x48898b=_0x48898b||0x1f4;return function(_0x214473){logger[_0x9005('0x2d')](_0x214473[_0x9005('0x2e')]);if(_0x214473[_0x9005('0x2f')]){delete _0x214473['name'];}_0x3050d8[_0x9005('0x1c')](_0x48898b)[_0x9005('0x30')](_0x214473);};}exports[_0x9005('0x31')]=function(_0x4b1d00,_0x527ef4){var _0x357527={},_0x2f0a45={},_0xd48afb={'count':0x0,'rows':[]};var _0x592c78=_['map'](db[_0x9005('0x32')][_0x9005('0x33')],function(_0x2e0fb1){return{'name':_0x2e0fb1[_0x9005('0x34')],'type':_0x2e0fb1[_0x9005('0x35')][_0x9005('0x36')]};});_0x2f0a45[_0x9005('0x37')]=_['map'](_0x592c78,_0x9005('0x2f'));_0x2f0a45['query']=_[_0x9005('0x38')](_0x4b1d00[_0x9005('0x39')]);_0x2f0a45[_0x9005('0x3a')]=_[_0x9005('0x3b')](_0x2f0a45[_0x9005('0x37')],_0x2f0a45[_0x9005('0x39')]);_0x357527['attributes']=_[_0x9005('0x3b')](_0x2f0a45[_0x9005('0x37')],qs[_0x9005('0x3c')](_0x4b1d00[_0x9005('0x39')][_0x9005('0x3c')]));_0x357527[_0x9005('0x3d')]=_0x357527['attributes'][_0x9005('0x3e')]?_0x357527['attributes']:_0x2f0a45[_0x9005('0x37')];if(!_0x4b1d00[_0x9005('0x39')][_0x9005('0x3f')](_0x9005('0x40'))){_0x357527['limit']=qs[_0x9005('0x22')](_0x4b1d00['query']['limit']);_0x357527[_0x9005('0x1f')]=qs[_0x9005('0x1f')](_0x4b1d00[_0x9005('0x39')][_0x9005('0x1f')]);}_0x357527[_0x9005('0x41')]=qs[_0x9005('0x42')](_0x4b1d00[_0x9005('0x39')][_0x9005('0x42')]);delete _0x4b1d00[_0x9005('0x39')]['sort'];_0x357527['where']=qs[_0x9005('0x3a')](_[_0x9005('0x43')](_0x4b1d00[_0x9005('0x39')],_0x2f0a45['filters']),_0x592c78);if(_0x4b1d00[_0x9005('0x39')]['filter']){_0x357527[_0x9005('0x44')]=_['merge'](_0x357527[_0x9005('0x44')],{'$or':_[_0x9005('0x45')](_0x592c78,function(_0x213ae4){if(_0x213ae4[_0x9005('0x35')]!==_0x9005('0x46')){var _0x13099b={};_0x13099b[_0x213ae4[_0x9005('0x2f')]]={'$like':'%'+_0x4b1d00[_0x9005('0x39')]['filter']+'%'};return _0x13099b;}})});}_0x357527=_[_0x9005('0x47')]({},_0x357527,_0x4b1d00[_0x9005('0x48')]);var _0x5d69bd={'where':_0x357527['where']};return db[_0x9005('0x32')][_0x9005('0x21')](_0x5d69bd)[_0x9005('0x29')](function(_0x4c3d40){_0xd48afb[_0x9005('0x21')]=_0x4c3d40;if(_0x4b1d00['query']['includeAll']){_0x357527['include']=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0x9005('0x49')](_0x357527);})[_0x9005('0x29')](function(_0x46ba56){_0xd48afb[_0x9005('0x4a')]=_0x46ba56;return _0xd48afb;})[_0x9005('0x29')](respondWithFilteredResult(_0x527ef4,_0x357527))['catch'](handleError(_0x527ef4,null));};exports['show']=function(_0x84a87a,_0x415ee1){var _0x3ae72a={'raw':![],'where':{'id':_0x84a87a['params']['id']}},_0x201c1a={};_0x201c1a[_0x9005('0x37')]=_[_0x9005('0x38')](db[_0x9005('0x32')][_0x9005('0x33')]);_0x201c1a[_0x9005('0x39')]=_[_0x9005('0x38')](_0x84a87a[_0x9005('0x39')]);_0x201c1a[_0x9005('0x3a')]=_[_0x9005('0x3b')](_0x201c1a[_0x9005('0x37')],_0x201c1a[_0x9005('0x39')]);_0x3ae72a[_0x9005('0x3d')]=_[_0x9005('0x3b')](_0x201c1a['model'],qs[_0x9005('0x3c')](_0x84a87a[_0x9005('0x39')]['fields']));_0x3ae72a[_0x9005('0x3d')]=_0x3ae72a['attributes'][_0x9005('0x3e')]?_0x3ae72a[_0x9005('0x3d')]:_0x201c1a[_0x9005('0x37')];if(_0x84a87a[_0x9005('0x39')][_0x9005('0x4b')]){_0x3ae72a[_0x9005('0x4c')]=[{'all':!![]}];}_0x3ae72a=_[_0x9005('0x47')]({},_0x3ae72a,_0x84a87a[_0x9005('0x48')]);return db[_0x9005('0x32')][_0x9005('0x4d')](_0x3ae72a)[_0x9005('0x29')](handleEntityNotFound(_0x415ee1,null))[_0x9005('0x29')](respondWithResult(_0x415ee1,null))[_0x9005('0x4e')](handleError(_0x415ee1,null));};exports[_0x9005('0x27')]=function(_0x5a8f2c,_0x50a463){if(_0x5a8f2c[_0x9005('0x4f')]['id']){delete _0x5a8f2c[_0x9005('0x4f')]['id'];}return db[_0x9005('0x32')][_0x9005('0x4d')]({'where':{'id':_0x5a8f2c['params']['id']}})[_0x9005('0x29')](handleEntityNotFound(_0x50a463,null))[_0x9005('0x29')](saveUpdates(_0x5a8f2c['body'],null))[_0x9005('0x29')](respondWithResult(_0x50a463,null))[_0x9005('0x4e')](handleError(_0x50a463,null));};exports[_0x9005('0x50')]=function(_0xf23939,_0x2a7cb9,_0x5a4a1f){return db['sequelize'][_0x9005('0x51')](function(_0x5664f5){if(_0xf23939[_0x9005('0x4f')]['mode']===_0x9005('0x52')){_0xf23939[_0x9005('0x4f')][_0x9005('0x53')]=path[_0x9005('0x54')](config[_0x9005('0x55')],_0x9005('0x56'),_0xf23939[_0x9005('0x4f')][_0x9005('0x2f')]);}return db[_0x9005('0x32')][_0x9005('0x50')](_0xf23939['body'],{'transaction':_0x5664f5})[_0x9005('0x29')](function(_0x329e58){if(_0xf23939[_0x9005('0x4f')][_0x9005('0x57')]==='files'){fs[_0x9005('0x58')](_0x329e58[_0x9005('0x53')],parseInt(_0x9005('0x59'),0x8));}var _0x5e1538=_0xf23939[_0x9005('0x5a')]['get']({'plain':!![]});if(!_0x5e1538)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5e1538[_0x9005('0x5b')]===_0x9005('0x5a')){var _0x1a915a=_0x329e58[_0x9005('0x5c')]({'plain':!![]});return db[_0x9005('0x5d')][_0x9005('0x4d')]({'where':{'name':_0x9005('0x2a'),'userProfileId':_0x5e1538[_0x9005('0x5e')]},'raw':!![]})[_0x9005('0x29')](function(_0x2bd6ac){if(_0x2bd6ac&&_0x2bd6ac[_0x9005('0x5f')]===0x0){return db[_0x9005('0x2b')]['create']({'name':_0x1a915a['name'],'resourceId':_0x1a915a['id'],'type':_0x2bd6ac[_0x9005('0x2f')],'sectionId':_0x2bd6ac['id']},{})[_0x9005('0x29')](function(){return _0x329e58;});}else{return _0x329e58;}})[_0x9005('0x4e')](function(_0x3abede){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3abede);});}return _0x329e58;});})[_0x9005('0x29')](respondWithResult(_0x2a7cb9,0xc9))[_0x9005('0x4e')](handleError(_0x2a7cb9,null));};exports['destroy']=function(_0x1f5c7e,_0x57a549,_0x4599ab){var _0x3f9a78;return db[_0x9005('0x32')][_0x9005('0x4d')]({'where':{'id':_0x1f5c7e[_0x9005('0x60')]['id']}})[_0x9005('0x29')](function(_0x2b0eb7){if(_0x2b0eb7){return db[_0x9005('0x61')][_0x9005('0x51')](function(_0x32407e){return _0x2b0eb7['destroy']({'transaction':_0x32407e,'raw':!![]})['then'](function(_0x411585){if(_0x411585['directory']){fs[_0x9005('0x62')](_0x411585[_0x9005('0x53')])[_0x9005('0x63')](function(_0x3cf5e6){fs[_0x9005('0x64')](path[_0x9005('0x54')](_0x411585[_0x9005('0x53')],_0x3cf5e6));});fs[_0x9005('0x65')](_0x411585[_0x9005('0x53')]);}return _0x411585;});})['catch'](function(_0x47b067){throw new db[(_0x9005('0x66'))][(_0x9005('0x67'))](_0x47b067[_0x9005('0x68')]);});}})[_0x9005('0x29')](handleEntityNotFound(_0x57a549,null))['then'](removeEntity(_0x57a549,null))['catch'](handleError(_0x57a549,null));};exports[_0x9005('0x69')]=function(_0x2d755f,_0x1e5ea8,_0x49995d){return db[_0x9005('0x61')][_0x9005('0x51')](function(_0x19fb66){var _0x19a230;return db[_0x9005('0x32')]['find']({'where':{'id':_0x2d755f['params']['id']}})[_0x9005('0x29')](function(_0x14796d){if(_0x14796d){_0x19a230=_0x14796d;return _0x14796d[_0x9005('0x69')](_0x2d755f['body']['id'],{'transaction':_0x19fb66});}})[_0x9005('0x29')](function(_0xca4081){if(_0xca4081){return db[_0x9005('0x6a')][_0x9005('0x6b')]({'where':{'id':_0x2d755f['body']['id']},'attributes':['id',_0x9005('0x2f'),_0x9005('0x6c'),_0x9005('0x6d'),'createdAt'],'raw':!![]});}})[_0x9005('0x29')](function(_0x5ea3d2){if(_0x5ea3d2){var _0xb5c452=path[_0x9005('0x54')](config[_0x9005('0x55')],_0x9005('0x6e'),util[_0x9005('0x6f')](_0x9005('0x70'),path[_0x9005('0x71')](_0x5ea3d2[_0x9005('0x6c')],path[_0x9005('0x72')](_0x5ea3d2[_0x9005('0x6c')])),_0x5ea3d2[_0x9005('0x6d')]));var _0x158f11=path[_0x9005('0x54')](config['root'],_0x9005('0x56'),_0x19a230[_0x9005('0x2f')],util[_0x9005('0x6f')](_0x9005('0x70'),_0x5ea3d2[_0x9005('0x2f')],_0x5ea3d2[_0x9005('0x6d')]));fs[_0x9005('0x73')](_0xb5c452,_0x158f11);return _0x5ea3d2;}})[_0x9005('0x4e')](function(_0x21858d){throw new db['Sequelize'][(_0x9005('0x67'))](_0x21858d[_0x9005('0x68')]);});})[_0x9005('0x29')](handleEntityNotFound(_0x1e5ea8,null))[_0x9005('0x29')](respondWithResult(_0x1e5ea8,0xc9))[_0x9005('0x4e')](handleError(_0x1e5ea8,null));};exports[_0x9005('0x74')]=function(_0x151b5f,_0x3fb0c4,_0x1e1974){return db[_0x9005('0x61')][_0x9005('0x51')](function(_0x5b70a5){var _0x46fa9e;return db[_0x9005('0x32')][_0x9005('0x6b')]({'where':{'id':_0x151b5f[_0x9005('0x60')]['id']}})[_0x9005('0x29')](handleEntityNotFound(_0x3fb0c4,null))['then'](function(_0x2d8466){if(_0x2d8466){_0x46fa9e=_0x2d8466;return _0x2d8466[_0x9005('0x74')](_0x151b5f[_0x9005('0x60')][_0x9005('0x75')]);}})[_0x9005('0x29')](function(_0x49c391){if(_0x49c391){return db['Sound']['findOne']({'where':{'id':_0x151b5f['params'][_0x9005('0x75')]},'attributes':['id',_0x9005('0x2f'),_0x9005('0x6c'),'converted_format',_0x9005('0x76')],'raw':!![]});}})['then'](function(_0x1f7bf1){if(_0x1f7bf1){fs[_0x9005('0x64')](path[_0x9005('0x54')](_0x46fa9e[_0x9005('0x53')],util['format'](_0x9005('0x70'),_0x1f7bf1[_0x9005('0x2f')],_0x1f7bf1[_0x9005('0x6d')])));return _0x1f7bf1;}})[_0x9005('0x4e')](function(_0x28e222){throw new db['Sequelize'][(_0x9005('0x67'))](_0x28e222[_0x9005('0x68')]);});})[_0x9005('0x29')](handleEntityNotFound(_0x3fb0c4,null))[_0x9005('0x29')](respondWithStatusCode(_0x3fb0c4,0xcc))[_0x9005('0x4e')](handleError(_0x3fb0c4,null));};exports[_0x9005('0x77')]=function(_0x29d68,_0x450bd8,_0x3a8d23){var _0x1f3a0f={};var _0x2f128d={};var _0x389f8f;var _0x276b28;return db[_0x9005('0x32')]['findOne']({'where':{'id':_0x29d68[_0x9005('0x60')]['id']}})[_0x9005('0x29')](handleEntityNotFound(_0x450bd8,null))[_0x9005('0x29')](function(_0x324836){if(_0x324836){_0x389f8f=_0x324836;_0x2f128d[_0x9005('0x37')]=_[_0x9005('0x38')](db[_0x9005('0x6a')][_0x9005('0x33')]);_0x2f128d[_0x9005('0x39')]=_[_0x9005('0x38')](_0x29d68[_0x9005('0x39')]);_0x2f128d[_0x9005('0x3a')]=_[_0x9005('0x3b')](_0x2f128d['model'],_0x2f128d[_0x9005('0x39')]);_0x1f3a0f[_0x9005('0x3d')]=_['intersection'](_0x2f128d[_0x9005('0x37')],qs[_0x9005('0x3c')](_0x29d68[_0x9005('0x39')][_0x9005('0x3c')]));_0x1f3a0f['attributes']=_0x1f3a0f[_0x9005('0x3d')][_0x9005('0x3e')]?_0x1f3a0f[_0x9005('0x3d')]:_0x2f128d[_0x9005('0x37')];_0x1f3a0f[_0x9005('0x41')]=qs[_0x9005('0x42')](_0x29d68['query']['sort']);_0x1f3a0f[_0x9005('0x44')]=qs[_0x9005('0x3a')](_[_0x9005('0x43')](_0x29d68[_0x9005('0x39')],_0x2f128d[_0x9005('0x3a')]));if(_0x29d68[_0x9005('0x39')][_0x9005('0x78')]){_0x1f3a0f[_0x9005('0x44')]=_[_0x9005('0x47')](_0x1f3a0f[_0x9005('0x44')],{'$or':_['map'](_0x1f3a0f[_0x9005('0x3d')],function(_0x473f8d){var _0x227035={};_0x227035[_0x473f8d]={'$like':'%'+_0x29d68['query'][_0x9005('0x78')]+'%'};return _0x227035;})});}_0x1f3a0f=_[_0x9005('0x47')]({},_0x1f3a0f,_0x29d68[_0x9005('0x48')]);return _0x389f8f['getSounds'](_0x1f3a0f);}})[_0x9005('0x29')](function(_0x37e94e){if(_0x37e94e){_0x276b28=_0x37e94e[_0x9005('0x3e')];if(!_0x29d68['query'][_0x9005('0x3f')](_0x9005('0x40'))){_0x1f3a0f[_0x9005('0x22')]=qs[_0x9005('0x22')](_0x29d68[_0x9005('0x39')][_0x9005('0x22')]);_0x1f3a0f[_0x9005('0x1f')]=qs[_0x9005('0x1f')](_0x29d68[_0x9005('0x39')]['offset']);}return _0x389f8f[_0x9005('0x77')](_0x1f3a0f);}})[_0x9005('0x29')](function(_0x5d9aa7){if(_0x5d9aa7){return _0x5d9aa7?{'count':_0x276b28,'rows':_0x5d9aa7}:null;}})[_0x9005('0x29')](respondWithResult(_0x450bd8,null))[_0x9005('0x4e')](handleError(_0x450bd8,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index 89bf28c..7de4b6c 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 _0xcf89=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./voiceMusicOnHold.attributes','exports','define','VoiceMusicOnHold','voice_musiconhold','../../config/logger'];(function(_0x9b9666,_0x5195f8){var _0x54ce5f=function(_0x5e2482){while(--_0x5e2482){_0x9b9666['push'](_0x9b9666['shift']());}};_0x54ce5f(++_0x5195f8);}(_0xcf89,0x18b));var _0x9cf8=function(_0xaf459e,_0x78fc9){_0xaf459e=_0xaf459e-0x0;var _0x4b5a2d=_0xcf89[_0xaf459e];return _0x4b5a2d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9cf8('0x0'))(_0x9cf8('0x1'));var moment=require(_0x9cf8('0x2'));var BPromise=require(_0x9cf8('0x3'));var rp=require(_0x9cf8('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x9cf8('0x5'));var config=require(_0x9cf8('0x6'));var attributes=require(_0x9cf8('0x7'));module[_0x9cf8('0x8')]=function(_0x184ae9,_0x31a4ba){return _0x184ae9[_0x9cf8('0x9')](_0x9cf8('0xa'),attributes,{'tableName':_0x9cf8('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8455=['request-promise','path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','define','VoiceMusicOnHold','lodash','util','moment','bluebird'];(function(_0xf93a12,_0x186f62){var _0xeabcf2=function(_0x18e5eb){while(--_0x18e5eb){_0xf93a12['push'](_0xf93a12['shift']());}};_0xeabcf2(++_0x186f62);}(_0x8455,0x6a));var _0x5845=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8455[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x5845('0x0'));var util=require(_0x5845('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x5845('0x2'));var BPromise=require(_0x5845('0x3'));var rp=require(_0x5845('0x4'));var fs=require('fs');var path=require(_0x5845('0x5'));var rimraf=require(_0x5845('0x6'));var config=require(_0x5845('0x7'));var attributes=require(_0x5845('0x8'));module['exports']=function(_0x4572b5,_0x14385c){return _0x4572b5[_0x5845('0x9')](_0x5845('0xa'),attributes,{'tableName':'voice_musiconhold','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 083fdc2..155a422 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 _0x9c44=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','request','then','request\x20sent','debug','stringify','code','error','message','VoiceMusicOnHold,\x20%s,\x20%s','info','result','catch','moment','bluebird'];(function(_0x267872,_0x3abcf5){var _0x351ea2=function(_0x124367){while(--_0x124367){_0x267872['push'](_0x267872['shift']());}};_0x351ea2(++_0x3abcf5);}(_0x9c44,0x178));var _0x49c4=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x9c44[_0x3511d3];return _0x5d6321;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var BPromise=require(_0x49c4('0x1'));var rs=require(_0x49c4('0x2'));var fs=require('fs');var Redis=require(_0x49c4('0x3'));var db=require(_0x49c4('0x4'))['db'];var utils=require(_0x49c4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x49c4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x49c4('0x7')][_0x49c4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x69bc41,_0x2c4e2e,_0x436234){return new BPromise(function(_0x511d53,_0x11c586){return client[_0x49c4('0x9')](_0x69bc41,_0x436234)[_0x49c4('0xa')](function(_0x4487ca){logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));logger[_0x49c4('0xc')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'),JSON[_0x49c4('0xd')](_0x4487ca));if(_0x4487ca['error']){if(_0x4487ca['error'][_0x49c4('0xe')]===0x1f4){logger[_0x49c4('0xf')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x11c586(_0x4487ca['error'][_0x49c4('0x10')]);}logger[_0x49c4('0xf')](_0x49c4('0x11'),_0x2c4e2e,_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);return _0x511d53(_0x4487ca[_0x49c4('0xf')][_0x49c4('0x10')]);}else{logger[_0x49c4('0x12')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x2c4e2e,_0x49c4('0xb'));_0x511d53(_0x4487ca[_0x49c4('0x13')][_0x49c4('0x10')]);}})[_0x49c4('0x14')](function(_0x2abc78){logger['error'](_0x49c4('0x11'),_0x2c4e2e,_0x2abc78);_0x11c586(_0x2abc78);});});} \ No newline at end of file +var _0x70e0=['code','VoiceMusicOnHold,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x36c963,_0x210171){var _0x26fd37=function(_0x344307){while(--_0x344307){_0x36c963['push'](_0x36c963['shift']());}};_0x26fd37(++_0x210171);}(_0x70e0,0x17b));var _0x070e=function(_0x16aad5,_0x22baf7){_0x16aad5=_0x16aad5-0x0;var _0x3c0c69=_0x70e0[_0x16aad5];return _0x3c0c69;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var moment=require(_0x070e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x070e('0x3'));var db=require(_0x070e('0x4'))['db'];var utils=require(_0x070e('0x5'));var logger=require(_0x070e('0x6'))('rpc');var config=require(_0x070e('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x070e('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x56e420,_0x5032e5,_0x35ab0c){return new BPromise(function(_0x1e11f0,_0x604664){return client[_0x070e('0x9')](_0x56e420,_0x35ab0c)[_0x070e('0xa')](function(_0x68a09e){logger[_0x070e('0xb')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,'request\x20sent');logger[_0x070e('0xc')](_0x070e('0xd'),_0x5032e5,_0x070e('0xe'),JSON[_0x070e('0xf')](_0x68a09e));if(_0x68a09e[_0x070e('0x10')]){if(_0x68a09e[_0x070e('0x10')][_0x070e('0x11')]===0x1f4){logger[_0x070e('0x10')](_0x070e('0x12'),_0x5032e5,_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);return _0x604664(_0x68a09e['error']['message']);}logger[_0x070e('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x68a09e['error']['message']);return _0x1e11f0(_0x68a09e[_0x070e('0x10')][_0x070e('0x13')]);}else{logger['info']('VoiceMusicOnHold,\x20%s,\x20%s',_0x5032e5,_0x070e('0xe'));_0x1e11f0(_0x68a09e[_0x070e('0x14')][_0x070e('0x13')]);}})[_0x070e('0x15')](function(_0x5bc71e){logger['error'](_0x070e('0x12'),_0x5032e5,_0x5bc71e);_0x604664(_0x5bc71e);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/index.js b/server/api/voicePrefix/index.js index 03f9a64..0c919d3 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 _0x2966=['removeAgents','util','path','express','Router','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','index','get','/describe','/:id','/:id/users','getAgents','post','create','addAgents','put','update','delete','destroy'];(function(_0x3195af,_0x536c46){var _0x358a02=function(_0x3bec6f){while(--_0x3bec6f){_0x3195af['push'](_0x3195af['shift']());}};_0x358a02(++_0x536c46);}(_0x2966,0x11f));var _0x6296=function(_0x11893e,_0x330ea2){_0x11893e=_0x11893e-0x0;var _0x24d206=_0x2966[_0x11893e];return _0x24d206;};'use strict';var multer=require('multer');var util=require(_0x6296('0x0'));var path=require(_0x6296('0x1'));var timeout=require('connect-timeout');var express=require(_0x6296('0x2'));var router=express[_0x6296('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x6296('0x4'));var config=require(_0x6296('0x5'));var controller=require(_0x6296('0x6'));router['get']('/',auth[_0x6296('0x7')](),controller[_0x6296('0x8')]);router[_0x6296('0x9')](_0x6296('0xa'),auth[_0x6296('0x7')](),controller['describe']);router['get'](_0x6296('0xb'),auth[_0x6296('0x7')](),controller['show']);router[_0x6296('0x9')](_0x6296('0xc'),auth[_0x6296('0x7')](),controller[_0x6296('0xd')]);router[_0x6296('0xe')]('/',auth['isAuthenticated'](),controller[_0x6296('0xf')]);router[_0x6296('0xe')](_0x6296('0xc'),auth['isAuthenticated'](),controller[_0x6296('0x10')]);router[_0x6296('0x11')](_0x6296('0xb'),auth['isAuthenticated'](),controller[_0x6296('0x12')]);router[_0x6296('0x13')](_0x6296('0xb'),auth['isAuthenticated'](),controller[_0x6296('0x14')]);router[_0x6296('0x13')](_0x6296('0xc'),auth['isAuthenticated'](),controller[_0x6296('0x15')]);module['exports']=router; \ No newline at end of file +var _0xd6f2=['/:id/users','create','post','addAgents','/:id','update','destroy','delete','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x303b25,_0x2f5867){var _0x57bfde=function(_0x33e594){while(--_0x33e594){_0x303b25['push'](_0x303b25['shift']());}};_0x57bfde(++_0x2f5867);}(_0xd6f2,0x1cc));var _0x2d6f=function(_0x36de7a,_0x3c06f2){_0x36de7a=_0x36de7a-0x0;var _0x22c981=_0xd6f2[_0x36de7a];return _0x22c981;};'use strict';var multer=require(_0x2d6f('0x0'));var util=require(_0x2d6f('0x1'));var path=require(_0x2d6f('0x2'));var timeout=require(_0x2d6f('0x3'));var express=require('express');var router=express[_0x2d6f('0x4')]();var fs_extra=require(_0x2d6f('0x5'));var auth=require(_0x2d6f('0x6'));var interaction=require(_0x2d6f('0x7'));var config=require(_0x2d6f('0x8'));var controller=require(_0x2d6f('0x9'));router[_0x2d6f('0xa')]('/',auth[_0x2d6f('0xb')](),controller[_0x2d6f('0xc')]);router[_0x2d6f('0xa')](_0x2d6f('0xd'),auth[_0x2d6f('0xb')](),controller[_0x2d6f('0xe')]);router[_0x2d6f('0xa')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2d6f('0xa')](_0x2d6f('0xf'),auth['isAuthenticated'](),controller['getAgents']);router['post']('/',auth['isAuthenticated'](),controller[_0x2d6f('0x10')]);router[_0x2d6f('0x11')]('/:id/users',auth['isAuthenticated'](),controller[_0x2d6f('0x12')]);router['put'](_0x2d6f('0x13'),auth['isAuthenticated'](),controller[_0x2d6f('0x14')]);router['delete'](_0x2d6f('0x13'),auth[_0x2d6f('0xb')](),controller[_0x2d6f('0x15')]);router[_0x2d6f('0x16')]('/:id/users',auth['isAuthenticated'](),controller[_0x2d6f('0x17')]);module[_0x2d6f('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 10c2e72..7e56826 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 _0x5df5=['system-','INTEGER','exports','STRING','name','VIRTUAL'];(function(_0x218b5c,_0x592983){var _0x37f9d3=function(_0x14aef0){while(--_0x14aef0){_0x218b5c['push'](_0x218b5c['shift']());}};_0x37f9d3(++_0x592983);}(_0x5df5,0x1be));var _0x55df=function(_0x37981a,_0xc7fb16){_0x37981a=_0x37981a-0x0;var _0x156f2=_0x5df5[_0x37981a];return _0x156f2;};'use strict';var Sequelize=require('sequelize');module[_0x55df('0x0')]={'name':{'type':Sequelize[_0x55df('0x1')],'allowNull':![],'unique':_0x55df('0x2')},'prefix':{'type':Sequelize[_0x55df('0x3')],'get':function(_0x2c37e2){return _0x55df('0x4')+this['getDataValue'](_0x55df('0x2'))+'-';}},'description':{'type':Sequelize[_0x55df('0x1')]},'callerIdAll':{'type':Sequelize[_0x55df('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0x55df('0x5')]}}; \ No newline at end of file +var _0x064e=['INTEGER','sequelize','STRING','name','VIRTUAL','system-','getDataValue'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x064e,0x6a));var _0xe064=function(_0x5e8f4e,_0x12af6e){_0x5e8f4e=_0x5e8f4e-0x0;var _0x34df6d=_0x064e[_0x5e8f4e];return _0x34df6d;};'use strict';var Sequelize=require(_0xe064('0x0'));module['exports']={'name':{'type':Sequelize[_0xe064('0x1')],'allowNull':![],'unique':_0xe064('0x2')},'prefix':{'type':Sequelize[_0xe064('0x3')],'get':function(_0x50b96a){return _0xe064('0x4')+this[_0xe064('0x5')](_0xe064('0x2'))+'-';}},'description':{'type':Sequelize[_0xe064('0x1')]},'callerIdAll':{'type':Sequelize[_0xe064('0x1')]},'VoiceExtensionId':{'type':Sequelize[_0xe064('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 14cd1c8..53bff53 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 _0x9e63=['../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','get','UserProfileResource','destroy','stack','name','send','index','map','VoicePrefix','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','show','intersection','merge','find','params','create','transaction','body','VoiceExtensionId','user','role','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','VoicePrefixId','VoiceExtension','bulkCreate','Extensions\x20creation\x20failed','push','Set','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','system-','findById','addAgents','ids','omit','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3bbb49,_0xdce097){var _0x4cb590=function(_0x2cdafa){while(--_0x2cdafa){_0x3bbb49['push'](_0x3bbb49['shift']());}};_0x4cb590(++_0xdce097);}(_0x9e63,0x65));var _0x39e6=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x9e63[_0x4154a6];return _0x3b2786;};'use strict';var emlformat=require(_0x39e6('0x0'));var rimraf=require(_0x39e6('0x1'));var zipdir=require(_0x39e6('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x39e6('0x3'));var moment=require(_0x39e6('0x4'));var BPromise=require(_0x39e6('0x5'));var Mustache=require(_0x39e6('0x6'));var util=require(_0x39e6('0x7'));var path=require(_0x39e6('0x8'));var sox=require(_0x39e6('0x9'));var csv=require(_0x39e6('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x39e6('0xb'));var _=require(_0x39e6('0xc'));var squel=require(_0x39e6('0xd'));var crypto=require('crypto');var jsforce=require(_0x39e6('0xe'));var deskjs=require(_0x39e6('0xf'));var toCsv=require('to-csv');var querystring=require(_0x39e6('0x10'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x39e6('0x11'));var qs=require(_0x39e6('0x12'));var as=require(_0x39e6('0x13'));var hardwareService=require(_0x39e6('0x14'));var logger=require(_0x39e6('0x15'))('api');var utils=require('../../config/utils');var config=require(_0x39e6('0x16'));var licenseUtil=require(_0x39e6('0x17'));var db=require(_0x39e6('0x18'))['db'];config[_0x39e6('0x19')]=_[_0x39e6('0x1a')](config['redis'],{'host':_0x39e6('0x1b'),'port':0x18eb});var socket=require(_0x39e6('0x1c'))(new Redis(config[_0x39e6('0x19')]));require(_0x39e6('0x1d'))['register'](socket);function respondWithStatusCode(_0x4ed79d,_0x4ffa4d){_0x4ffa4d=_0x4ffa4d||0xcc;return function(_0x24ac12){if(_0x24ac12){return _0x4ed79d[_0x39e6('0x1e')](_0x4ffa4d);}return _0x4ed79d[_0x39e6('0x1f')](_0x4ffa4d)[_0x39e6('0x20')]();};}function respondWithResult(_0x5a86e3,_0x215096){_0x215096=_0x215096||0xc8;return function(_0x124e05){if(_0x124e05){return _0x5a86e3[_0x39e6('0x1f')](_0x215096)[_0x39e6('0x21')](_0x124e05);}};}function respondWithFilteredResult(_0x18d076,_0xc6497b){return function(_0x1a3adf){if(_0x1a3adf){var _0x512279=typeof _0xc6497b[_0x39e6('0x22')]===_0x39e6('0x23')&&typeof _0xc6497b[_0x39e6('0x24')]==='undefined';var _0x47e94b=_0x1a3adf[_0x39e6('0x25')];var _0x445f12=_0x512279?0x0:_0xc6497b[_0x39e6('0x22')];var _0x2d9a98=_0x512279?_0x1a3adf[_0x39e6('0x25')]:_0xc6497b['offset']+_0xc6497b[_0x39e6('0x24')];var _0x59c532;if(_0x2d9a98>=_0x47e94b){_0x2d9a98=_0x47e94b;_0x59c532=0xc8;}else{_0x59c532=0xce;}_0x18d076[_0x39e6('0x1f')](_0x59c532);return _0x18d076[_0x39e6('0x26')]('Content-Range',_0x445f12+'-'+_0x2d9a98+'/'+_0x47e94b)[_0x39e6('0x21')](_0x1a3adf);}return null;};}function patchUpdates(_0x1c626a){return function(_0x2e4890){try{jsonpatch[_0x39e6('0x27')](_0x2e4890,_0x1c626a,!![]);}catch(_0x314c7d){return BPromise[_0x39e6('0x28')](_0x314c7d);}return _0x2e4890[_0x39e6('0x29')]();};}function saveUpdates(_0x4619ee,_0x302f77){return function(_0x47704f){if(_0x47704f){return _0x47704f[_0x39e6('0x2a')](_0x4619ee)[_0x39e6('0x2b')](function(_0x3dce4d){return _0x3dce4d;});}return null;};}function removeEntity(_0x5102d8,_0x537462){return function(_0x5e45cd){if(_0x5e45cd){return _0x5e45cd['destroy']()[_0x39e6('0x2b')](function(){var _0x22b820=_0x5e45cd[_0x39e6('0x2c')]({'plain':!![]});var _0x19f780='VoicePrefixes';return db[_0x39e6('0x2d')][_0x39e6('0x2e')]({'where':{'type':_0x19f780,'resourceId':_0x22b820['id']}})['then'](function(){return _0x5e45cd;});})[_0x39e6('0x2b')](function(){_0x5102d8[_0x39e6('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x1acc77,_0x2117d0){return function(_0xc3c7fe){if(!_0xc3c7fe){_0x1acc77[_0x39e6('0x1e')](0x194);}return _0xc3c7fe;};}function handleError(_0x296aef,_0x5d8faa){_0x5d8faa=_0x5d8faa||0x1f4;return function(_0x21fce8){logger['error'](_0x21fce8[_0x39e6('0x2f')]);if(_0x21fce8[_0x39e6('0x30')]){delete _0x21fce8[_0x39e6('0x30')];}_0x296aef[_0x39e6('0x1f')](_0x5d8faa)[_0x39e6('0x31')](_0x21fce8);};}exports[_0x39e6('0x32')]=function(_0x458e7b,_0x373f95){var _0x3ff99c={},_0x1ac113={},_0x32a2ca={'count':0x0,'rows':[]};var _0x251568=_[_0x39e6('0x33')](db[_0x39e6('0x34')][_0x39e6('0x35')],function(_0x120c8b){return{'name':_0x120c8b['fieldName'],'type':_0x120c8b[_0x39e6('0x36')][_0x39e6('0x37')]};});_0x1ac113[_0x39e6('0x38')]=_['map'](_0x251568,_0x39e6('0x30'));_0x1ac113[_0x39e6('0x39')]=_[_0x39e6('0x3a')](_0x458e7b['query']);_0x1ac113[_0x39e6('0x3b')]=_['intersection'](_0x1ac113[_0x39e6('0x38')],_0x1ac113[_0x39e6('0x39')]);_0x3ff99c[_0x39e6('0x3c')]=_['intersection'](_0x1ac113[_0x39e6('0x38')],qs[_0x39e6('0x3d')](_0x458e7b[_0x39e6('0x39')][_0x39e6('0x3d')]));_0x3ff99c['attributes']=_0x3ff99c['attributes'][_0x39e6('0x3e')]?_0x3ff99c[_0x39e6('0x3c')]:_0x1ac113[_0x39e6('0x38')];if(!_0x458e7b[_0x39e6('0x39')][_0x39e6('0x3f')](_0x39e6('0x40'))){_0x3ff99c[_0x39e6('0x24')]=qs['limit'](_0x458e7b[_0x39e6('0x39')]['limit']);_0x3ff99c['offset']=qs[_0x39e6('0x22')](_0x458e7b[_0x39e6('0x39')][_0x39e6('0x22')]);}_0x3ff99c[_0x39e6('0x41')]=qs[_0x39e6('0x42')](_0x458e7b[_0x39e6('0x39')][_0x39e6('0x42')]);_0x3ff99c[_0x39e6('0x43')]=qs['filters'](_[_0x39e6('0x44')](_0x458e7b[_0x39e6('0x39')],_0x1ac113[_0x39e6('0x3b')]),_0x251568);if(_0x458e7b[_0x39e6('0x39')][_0x39e6('0x45')]){_0x3ff99c['where']=_['merge'](_0x3ff99c[_0x39e6('0x43')],{'$or':_[_0x39e6('0x33')](_0x251568,function(_0x581e43){if(_0x581e43[_0x39e6('0x36')]!==_0x39e6('0x46')){var _0x5a440c={};_0x5a440c[_0x581e43['name']]={'$like':'%'+_0x458e7b[_0x39e6('0x39')][_0x39e6('0x45')]+'%'};return _0x5a440c;}})});}_0x3ff99c=_['merge']({},_0x3ff99c,_0x458e7b[_0x39e6('0x47')]);var _0x208acf={'where':_0x3ff99c[_0x39e6('0x43')]};return db[_0x39e6('0x34')][_0x39e6('0x25')](_0x208acf)[_0x39e6('0x2b')](function(_0x28397d){_0x32a2ca[_0x39e6('0x25')]=_0x28397d;if(_0x458e7b['query'][_0x39e6('0x48')]){_0x3ff99c[_0x39e6('0x49')]=[{'all':!![]}];}return db[_0x39e6('0x34')]['findAll'](_0x3ff99c);})['then'](function(_0x149463){_0x32a2ca[_0x39e6('0x4a')]=_0x149463;return _0x32a2ca;})[_0x39e6('0x2b')](respondWithFilteredResult(_0x373f95,_0x3ff99c))[_0x39e6('0x4b')](handleError(_0x373f95,null));};exports[_0x39e6('0x4c')]=function(_0x1b4846,_0x1230c6){var _0x4790ca={'raw':![],'where':{'id':_0x1b4846['params']['id']}},_0x59a8a5={};_0x59a8a5[_0x39e6('0x38')]=_['keys'](db[_0x39e6('0x34')][_0x39e6('0x35')]);_0x59a8a5[_0x39e6('0x39')]=_[_0x39e6('0x3a')](_0x1b4846[_0x39e6('0x39')]);_0x59a8a5[_0x39e6('0x3b')]=_[_0x39e6('0x4d')](_0x59a8a5[_0x39e6('0x38')],_0x59a8a5[_0x39e6('0x39')]);_0x4790ca[_0x39e6('0x3c')]=_['intersection'](_0x59a8a5[_0x39e6('0x38')],qs[_0x39e6('0x3d')](_0x1b4846[_0x39e6('0x39')][_0x39e6('0x3d')]));_0x4790ca['attributes']=_0x4790ca['attributes'][_0x39e6('0x3e')]?_0x4790ca['attributes']:_0x59a8a5[_0x39e6('0x38')];if(_0x1b4846[_0x39e6('0x39')]['includeAll']){_0x4790ca[_0x39e6('0x49')]=[{'all':!![]}];}_0x4790ca=_[_0x39e6('0x4e')]({},_0x4790ca,_0x1b4846[_0x39e6('0x47')]);return db[_0x39e6('0x34')][_0x39e6('0x4f')](_0x4790ca)[_0x39e6('0x2b')](handleEntityNotFound(_0x1230c6,null))[_0x39e6('0x2b')](respondWithResult(_0x1230c6,null))[_0x39e6('0x4b')](handleError(_0x1230c6,null));};exports[_0x39e6('0x2e')]=function(_0x1bb029,_0x389b8c){return db[_0x39e6('0x34')][_0x39e6('0x4f')]({'where':{'id':_0x1bb029[_0x39e6('0x50')]['id']}})[_0x39e6('0x2b')](handleEntityNotFound(_0x389b8c,null))[_0x39e6('0x2b')](removeEntity(_0x389b8c,null))[_0x39e6('0x4b')](handleError(_0x389b8c,null));};exports['describe']=function(_0x1eaead,_0x549aa9){return db['VoicePrefix']['describe']()[_0x39e6('0x2b')](respondWithResult(_0x549aa9,null))[_0x39e6('0x4b')](handleError(_0x549aa9,null));};exports[_0x39e6('0x51')]=function(_0x47fa16,_0x54ae4b){var _0x2d79d6;return db['sequelize'][_0x39e6('0x52')](function(_0x42e4e9){return db[_0x39e6('0x34')]['create'](_0x47fa16[_0x39e6('0x53')],{'transaction':_0x42e4e9})[_0x39e6('0x2b')](function(_0x4edeb3){_0x2d79d6=_0x4edeb3[_0x39e6('0x2c')]({'plain':!![]});return db['VoiceExtension'][_0x39e6('0x4f')]({'where':{'id':_0x2d79d6[_0x39e6('0x54')]},'raw':!![]})[_0x39e6('0x2b')](function(_0x481a9a){return createVoicePrefixExtensions(_0x2d79d6,_0x481a9a,_0x42e4e9);});});})[_0x39e6('0x2b')](function(){var _0x628a23=_0x47fa16[_0x39e6('0x55')][_0x39e6('0x2c')]({'plain':!![]});if(!_0x628a23)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x628a23[_0x39e6('0x56')]===_0x39e6('0x55')){var _0x34c885=_0x2d79d6;return db['UserProfileSection']['find']({'where':{'name':'VoicePrefixes','userProfileId':_0x628a23['userProfileId']},'raw':!![]})[_0x39e6('0x2b')](function(_0x2f47c7){if(_0x2f47c7&&_0x2f47c7[_0x39e6('0x57')]===0x0){return db[_0x39e6('0x2d')][_0x39e6('0x51')]({'name':_0x34c885[_0x39e6('0x30')],'resourceId':_0x34c885['id'],'type':_0x2f47c7[_0x39e6('0x30')],'sectionId':_0x2f47c7['id']},{})[_0x39e6('0x2b')](function(){return _0x2d79d6;});}else{return _0x2d79d6;}})['catch'](function(_0x7f7a9){logger['error'](_0x39e6('0x58'),_0x7f7a9);throw _0x7f7a9;});}return _0x2d79d6;})[_0x39e6('0x2b')](respondWithResult(_0x54ae4b,null))[_0x39e6('0x4b')](handleError(_0x54ae4b,null));};function Extension(_0x371a4c,_0xbdf5e6,_0x5d4298,_0x5ad7d5){this[_0x39e6('0x59')]=_0x39e6('0x5a');this[_0x39e6('0x5b')]=_0x371a4c;this['app']=_0x5d4298;this[_0x39e6('0x36')]='system';this[_0x39e6('0x5c')]=_0x39e6('0x5d');this[_0x39e6('0x5e')]=_0xbdf5e6;this[_0x39e6('0x5f')]=_0x5ad7d5;}function createVoicePrefixExtensions(_0x87f9c3,_0xaf818c,_0x3554b0){return new BPromise(function(_0x4020d2,_0x14a611){var _0x2eed53=new Extension(formatPrefixName(_0x87f9c3[_0x39e6('0x60')]),0x1,_0x39e6('0x61'),'Voice\x20Prefix');_0x2eed53[_0x39e6('0x62')]=_0x87f9c3['id'];return db[_0x39e6('0x63')][_0x39e6('0x51')](_0x2eed53,{'transaction':_0x3554b0})[_0x39e6('0x2b')](function(_0x87c53c){var _0x420f60=_0x87c53c[_0x39e6('0x2c')]({'plain':!![]});var _0x479d16=_['map'](addVoicePrefixExtensions(_0x87f9c3,_0xaf818c),function(_0x3b7cdd){_0x3b7cdd[_0x39e6('0x54')]=_0x420f60['id'];_0x3b7cdd[_0x39e6('0x62')]=_0x87f9c3['id'];return _0x3b7cdd;});return db['VoiceExtension'][_0x39e6('0x64')](_0x479d16,{'transaction':_0x3554b0})[_0x39e6('0x2b')](function(_0x220ee7){if(!_0x220ee7){return _0x14a611(_0x39e6('0x65'));}else{return _0x4020d2(_0x220ee7);}})[_0x39e6('0x4b')](function(_0xec6132){return _0x14a611(_0xec6132);});});;});};function addVoicePrefixExtensions(_0x521485,_0x191234){var _0x23dfc9=[];var _0x1acced=formatPrefixName(_0x521485[_0x39e6('0x60')]);_0x23dfc9[_0x39e6('0x66')](new Extension(_0x1acced,0x2,_0x39e6('0x67'),'CDR(prefix)='+_0x521485[_0x39e6('0x30')]));if(_0x521485[_0x39e6('0x68')]){_0x23dfc9[_0x39e6('0x66')](new Extension(_0x1acced,0x3,_0x39e6('0x67'),_0x39e6('0x69')+_0x521485['callerIdAll']));}else{_0x23dfc9['push'](new Extension(_0x1acced,0x3,_0x39e6('0x61'),_0x39e6('0x6a')));}_0x23dfc9[_0x39e6('0x66')](new Extension(_0x1acced,0x4,_0x39e6('0x6b'),_0x191234[_0x39e6('0x59')]+','+_0x39e6('0x6c')+(0x8+_0x521485[_0x39e6('0x30')][_0x39e6('0x3e')])+'}'+','+0x1));return _0x23dfc9;}function formatPrefixName(_0x24ddf0){var _0xc326cd='_';for(var _0x1c7374=0x0;_0x1c7374<_0x24ddf0[_0x39e6('0x3e')];_0x1c7374++){if(_0x24ddf0['charAt'](_0x1c7374)=='-'){_0xc326cd+=_0x24ddf0[_0x39e6('0x6d')](_0x1c7374);}else{_0xc326cd+='['+_0x24ddf0[_0x39e6('0x6d')](_0x1c7374)+']';}}_0xc326cd+='.';return _0xc326cd;}exports[_0x39e6('0x2a')]=function(_0x5461a8,_0x1a1a1f,_0x29a8c3){var _0x4f7ab0=_0x5461a8[_0x39e6('0x53')];_0x4f7ab0[_0x39e6('0x60')]=_0x39e6('0x6e')+_0x4f7ab0[_0x39e6('0x30')]+'-';return db['sequelize'][_0x39e6('0x52')](function(_0x14114c){return db['VoicePrefix']['update'](_0x4f7ab0,{'where':{'id':_0x4f7ab0['id']},'transaction':_0x14114c})[_0x39e6('0x2b')](function(){return db[_0x39e6('0x63')][_0x39e6('0x2e')]({'where':{'VoicePrefixId':_0x4f7ab0['id']},'transaction':_0x14114c})[_0x39e6('0x2b')](function(){return db['VoiceExtension'][_0x39e6('0x4f')]({'where':{'id':_0x4f7ab0[_0x39e6('0x54')]},'raw':!![]})[_0x39e6('0x2b')](function(_0x1405df){return createVoicePrefixExtensions(_0x4f7ab0,_0x1405df,_0x14114c);});});});})[_0x39e6('0x2b')](function(){return db['VoicePrefix'][_0x39e6('0x6f')](_0x4f7ab0['id']);})[_0x39e6('0x2b')](respondWithResult(_0x1a1a1f,null))[_0x39e6('0x4b')](handleError(_0x1a1a1f,null));};exports[_0x39e6('0x70')]=function(_0x24f720,_0x333ac2,_0xbfe2d2){return db[_0x39e6('0x34')][_0x39e6('0x4f')]({'where':{'id':_0x24f720[_0x39e6('0x50')]['id']}})[_0x39e6('0x2b')](handleEntityNotFound(_0x333ac2,null))[_0x39e6('0x2b')](function(_0x2e8e45){if(_0x2e8e45){return _0x2e8e45['addAgents'](_0x24f720[_0x39e6('0x53')][_0x39e6('0x71')],_[_0x39e6('0x72')](_0x24f720[_0x39e6('0x53')],[_0x39e6('0x71'),'id'])||{})['spread'](function(_0x3bdd22){for(var _0x1a01e7=0x0;_0x1a01e7<_0x24f720[_0x39e6('0x53')]['ids'][_0x39e6('0x3e')];_0x1a01e7+=0x1){socket[_0x39e6('0x73')](_0x39e6('0x74'),{'UserId':Number(_0x24f720['body'][_0x39e6('0x71')][_0x1a01e7]),'VoicePrefixId':Number(_0x24f720[_0x39e6('0x50')]['id'])});}return _0x3bdd22;});}})[_0x39e6('0x2b')](respondWithResult(_0x333ac2,null))[_0x39e6('0x4b')](handleError(_0x333ac2,null));};exports[_0x39e6('0x75')]=function(_0x43b233,_0x11753c,_0x229430){return db['VoicePrefix'][_0x39e6('0x4f')]({'where':{'id':_0x43b233[_0x39e6('0x50')]['id']}})[_0x39e6('0x2b')](handleEntityNotFound(_0x11753c,null))[_0x39e6('0x2b')](function(_0x138486){if(_0x138486){return _0x138486[_0x39e6('0x75')](_0x43b233[_0x39e6('0x39')][_0x39e6('0x71')])[_0x39e6('0x2b')](function(){if(_[_0x39e6('0x76')](_0x43b233[_0x39e6('0x39')]['ids'])){for(var _0x4ac85f=0x0;_0x4ac85f<_0x43b233['query'][_0x39e6('0x71')][_0x39e6('0x3e')];_0x4ac85f+=0x1){socket[_0x39e6('0x73')]('userVoicePrefix:remove',{'UserId':Number(_0x43b233[_0x39e6('0x39')][_0x39e6('0x71')][_0x4ac85f]),'VoicePrefixId':Number(_0x43b233[_0x39e6('0x50')]['id'])});}}else{socket[_0x39e6('0x73')](_0x39e6('0x77'),{'UserId':Number(_0x43b233[_0x39e6('0x39')][_0x39e6('0x71')]),'VoicePrefixId':Number(_0x43b233[_0x39e6('0x50')]['id'])});}});}})[_0x39e6('0x2b')](respondWithStatusCode(_0x11753c,null))['catch'](handleError(_0x11753c,null));};exports[_0x39e6('0x78')]=function(_0x5950a9,_0x2527aa,_0x35475b){var _0x54af4a={};var _0x2a04c0={};var _0x5726ba;var _0x203f6a;return db[_0x39e6('0x34')][_0x39e6('0x79')]({'where':{'id':_0x5950a9[_0x39e6('0x50')]['id']}})[_0x39e6('0x2b')](handleEntityNotFound(_0x2527aa,null))['then'](function(_0x4ffb05){if(_0x4ffb05){_0x5726ba=_0x4ffb05;_0x2a04c0['model']=_[_0x39e6('0x3a')](db[_0x39e6('0x7a')][_0x39e6('0x35')]);_0x2a04c0[_0x39e6('0x39')]=_[_0x39e6('0x3a')](_0x5950a9[_0x39e6('0x39')]);_0x2a04c0[_0x39e6('0x3b')]=_['intersection'](_0x2a04c0[_0x39e6('0x38')],_0x2a04c0[_0x39e6('0x39')]);_0x54af4a[_0x39e6('0x3c')]=_[_0x39e6('0x4d')](_0x2a04c0['model'],qs[_0x39e6('0x3d')](_0x5950a9[_0x39e6('0x39')]['fields']));_0x54af4a[_0x39e6('0x3c')]=_0x54af4a[_0x39e6('0x3c')][_0x39e6('0x3e')]?_0x54af4a['attributes']:_0x2a04c0[_0x39e6('0x38')];_0x54af4a[_0x39e6('0x41')]=qs[_0x39e6('0x42')](_0x5950a9['query']['sort']);_0x54af4a[_0x39e6('0x43')]=qs[_0x39e6('0x3b')](_[_0x39e6('0x44')](_0x5950a9[_0x39e6('0x39')],_0x2a04c0['filters']));if(_0x5950a9[_0x39e6('0x39')]['filter']){_0x54af4a['where']=_[_0x39e6('0x4e')](_0x54af4a[_0x39e6('0x43')],{'$or':_[_0x39e6('0x33')](_0x54af4a['attributes'],function(_0x25af8b){var _0x2fa31a={};_0x2fa31a[_0x25af8b]={'$like':'%'+_0x5950a9[_0x39e6('0x39')]['filter']+'%'};return _0x2fa31a;})});}_0x54af4a=_[_0x39e6('0x4e')]({},_0x54af4a,_0x5950a9[_0x39e6('0x47')]);return _0x5726ba[_0x39e6('0x78')](_0x54af4a);}})['then'](function(_0x51e679){if(_0x51e679){_0x203f6a=_0x51e679[_0x39e6('0x3e')];if(!_0x5950a9['query'][_0x39e6('0x3f')](_0x39e6('0x40'))){_0x54af4a[_0x39e6('0x24')]=qs[_0x39e6('0x24')](_0x5950a9[_0x39e6('0x39')][_0x39e6('0x24')]);_0x54af4a[_0x39e6('0x22')]=qs[_0x39e6('0x22')](_0x5950a9['query'][_0x39e6('0x22')]);}return _0x5726ba['getAgents'](_0x54af4a);}})[_0x39e6('0x2b')](function(_0x54782f){if(_0x54782f){return _0x54782f?{'count':_0x203f6a,'rows':_0x54782f}:null;}})[_0x39e6('0x2b')](respondWithResult(_0x2527aa,null))[_0x39e6('0x4b')](handleError(_0x2527aa,null));}; \ No newline at end of file +var _0xe35d=['count','limit','set','apply','save','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','name','send','map','VoicePrefix','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','find','params','transaction','create','body','get','VoiceExtension','VoiceExtensionId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','prefix','push','Set','CDR(prefix)=','callerIdAll','PREFIX-CALLERIDALL=','No\x20callerid\x20available','goto','${EXTEN:','charAt','sequelize','findById','addAgents','ids','omit','spread','emit','removeAgents','isArray','userVoicePrefix:remove','getAgents','User','order','options','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../mysqldb','redis','./voicePrefix.socket','sendStatus','status','end','json','offset'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xe35d,0xd5));var _0xde35=function(_0x4d8639,_0x3548a8){_0x4d8639=_0x4d8639-0x0;var _0x12ed60=_0xe35d[_0x4d8639];return _0x12ed60;};'use strict';var emlformat=require(_0xde35('0x0'));var rimraf=require(_0xde35('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xde35('0x2'));var moment=require(_0xde35('0x3'));var BPromise=require(_0xde35('0x4'));var Mustache=require(_0xde35('0x5'));var util=require(_0xde35('0x6'));var path=require(_0xde35('0x7'));var sox=require(_0xde35('0x8'));var csv=require(_0xde35('0x9'));var ejs=require(_0xde35('0xa'));var fs=require('fs');var fs_extra=require(_0xde35('0xb'));var _=require('lodash');var squel=require(_0xde35('0xc'));var crypto=require(_0xde35('0xd'));var jsforce=require(_0xde35('0xe'));var deskjs=require(_0xde35('0xf'));var toCsv=require(_0xde35('0x9'));var querystring=require('querystring');var Papa=require(_0xde35('0x10'));var Redis=require(_0xde35('0x11'));var authService=require(_0xde35('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xde35('0x13'));var hardwareService=require(_0xde35('0x14'));var logger=require('../../config/logger')(_0xde35('0x15'));var utils=require('../../config/utils');var config=require(_0xde35('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xde35('0x17'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xde35('0x18')]));require(_0xde35('0x19'))['register'](socket);function respondWithStatusCode(_0x560d70,_0x8c9864){_0x8c9864=_0x8c9864||0xcc;return function(_0x325201){if(_0x325201){return _0x560d70[_0xde35('0x1a')](_0x8c9864);}return _0x560d70[_0xde35('0x1b')](_0x8c9864)[_0xde35('0x1c')]();};}function respondWithResult(_0x5d8c6e,_0x1c87c6){_0x1c87c6=_0x1c87c6||0xc8;return function(_0x16956e){if(_0x16956e){return _0x5d8c6e[_0xde35('0x1b')](_0x1c87c6)[_0xde35('0x1d')](_0x16956e);}};}function respondWithFilteredResult(_0x1f7d7f,_0x46d3d6){return function(_0x19ec9e){if(_0x19ec9e){var _0x5a90de=typeof _0x46d3d6[_0xde35('0x1e')]==='undefined'&&typeof _0x46d3d6['limit']==='undefined';var _0x408829=_0x19ec9e['count'];var _0x2941ab=_0x5a90de?0x0:_0x46d3d6[_0xde35('0x1e')];var _0x73c782=_0x5a90de?_0x19ec9e[_0xde35('0x1f')]:_0x46d3d6[_0xde35('0x1e')]+_0x46d3d6[_0xde35('0x20')];var _0x441657;if(_0x73c782>=_0x408829){_0x73c782=_0x408829;_0x441657=0xc8;}else{_0x441657=0xce;}_0x1f7d7f[_0xde35('0x1b')](_0x441657);return _0x1f7d7f[_0xde35('0x21')]('Content-Range',_0x2941ab+'-'+_0x73c782+'/'+_0x408829)['json'](_0x19ec9e);}return null;};}function patchUpdates(_0x560c11){return function(_0x5a67f6){try{jsonpatch[_0xde35('0x22')](_0x5a67f6,_0x560c11,!![]);}catch(_0x394129){return BPromise['reject'](_0x394129);}return _0x5a67f6[_0xde35('0x23')]();};}function saveUpdates(_0x126248,_0xbbb922){return function(_0x560f3a){if(_0x560f3a){return _0x560f3a[_0xde35('0x24')](_0x126248)[_0xde35('0x25')](function(_0x740ab8){return _0x740ab8;});}return null;};}function removeEntity(_0x3af90d,_0x256277){return function(_0x1b3a37){if(_0x1b3a37){return _0x1b3a37[_0xde35('0x26')]()[_0xde35('0x25')](function(){var _0x31a61d=_0x1b3a37['get']({'plain':!![]});var _0x2ff922=_0xde35('0x27');return db[_0xde35('0x28')][_0xde35('0x26')]({'where':{'type':_0x2ff922,'resourceId':_0x31a61d['id']}})['then'](function(){return _0x1b3a37;});})[_0xde35('0x25')](function(){_0x3af90d[_0xde35('0x1b')](0xcc)[_0xde35('0x1c')]();});}};}function handleEntityNotFound(_0x17da4e,_0x459d29){return function(_0x45ca01){if(!_0x45ca01){_0x17da4e[_0xde35('0x1a')](0x194);}return _0x45ca01;};}function handleError(_0x4b251d,_0x15fa11){_0x15fa11=_0x15fa11||0x1f4;return function(_0x2ddfe1){logger[_0xde35('0x29')](_0x2ddfe1[_0xde35('0x2a')]);if(_0x2ddfe1[_0xde35('0x2b')]){delete _0x2ddfe1[_0xde35('0x2b')];}_0x4b251d[_0xde35('0x1b')](_0x15fa11)[_0xde35('0x2c')](_0x2ddfe1);};}exports['index']=function(_0x32ed0d,_0xda7689){var _0x457c11={},_0x3a8a56={},_0x54135f={'count':0x0,'rows':[]};var _0x54bc2f=_[_0xde35('0x2d')](db[_0xde35('0x2e')][_0xde35('0x2f')],function(_0x4ee0b3){return{'name':_0x4ee0b3[_0xde35('0x30')],'type':_0x4ee0b3[_0xde35('0x31')][_0xde35('0x32')]};});_0x3a8a56[_0xde35('0x33')]=_[_0xde35('0x2d')](_0x54bc2f,'name');_0x3a8a56[_0xde35('0x34')]=_[_0xde35('0x35')](_0x32ed0d['query']);_0x3a8a56[_0xde35('0x36')]=_[_0xde35('0x37')](_0x3a8a56[_0xde35('0x33')],_0x3a8a56[_0xde35('0x34')]);_0x457c11[_0xde35('0x38')]=_[_0xde35('0x37')](_0x3a8a56['model'],qs['fields'](_0x32ed0d[_0xde35('0x34')][_0xde35('0x39')]));_0x457c11[_0xde35('0x38')]=_0x457c11['attributes'][_0xde35('0x3a')]?_0x457c11[_0xde35('0x38')]:_0x3a8a56['model'];if(!_0x32ed0d[_0xde35('0x34')][_0xde35('0x3b')](_0xde35('0x3c'))){_0x457c11['limit']=qs[_0xde35('0x20')](_0x32ed0d[_0xde35('0x34')][_0xde35('0x20')]);_0x457c11[_0xde35('0x1e')]=qs[_0xde35('0x1e')](_0x32ed0d[_0xde35('0x34')][_0xde35('0x1e')]);}_0x457c11['order']=qs[_0xde35('0x3d')](_0x32ed0d[_0xde35('0x34')][_0xde35('0x3d')]);_0x457c11[_0xde35('0x3e')]=qs['filters'](_[_0xde35('0x3f')](_0x32ed0d[_0xde35('0x34')],_0x3a8a56[_0xde35('0x36')]),_0x54bc2f);if(_0x32ed0d[_0xde35('0x34')]['filter']){_0x457c11[_0xde35('0x3e')]=_[_0xde35('0x40')](_0x457c11[_0xde35('0x3e')],{'$or':_[_0xde35('0x2d')](_0x54bc2f,function(_0x3bf806){if(_0x3bf806['type']!==_0xde35('0x41')){var _0x12fb63={};_0x12fb63[_0x3bf806[_0xde35('0x2b')]]={'$like':'%'+_0x32ed0d[_0xde35('0x34')][_0xde35('0x42')]+'%'};return _0x12fb63;}})});}_0x457c11=_['merge']({},_0x457c11,_0x32ed0d['options']);var _0x4b4803={'where':_0x457c11[_0xde35('0x3e')]};return db['VoicePrefix'][_0xde35('0x1f')](_0x4b4803)[_0xde35('0x25')](function(_0x4adfbf){_0x54135f[_0xde35('0x1f')]=_0x4adfbf;if(_0x32ed0d[_0xde35('0x34')][_0xde35('0x43')]){_0x457c11['include']=[{'all':!![]}];}return db[_0xde35('0x2e')][_0xde35('0x44')](_0x457c11);})[_0xde35('0x25')](function(_0x3ae9fb){_0x54135f[_0xde35('0x45')]=_0x3ae9fb;return _0x54135f;})[_0xde35('0x25')](respondWithFilteredResult(_0xda7689,_0x457c11))[_0xde35('0x46')](handleError(_0xda7689,null));};exports[_0xde35('0x47')]=function(_0x59d402,_0x44e267){var _0x22a228={'raw':![],'where':{'id':_0x59d402['params']['id']}},_0x274806={};_0x274806[_0xde35('0x33')]=_[_0xde35('0x35')](db[_0xde35('0x2e')][_0xde35('0x2f')]);_0x274806[_0xde35('0x34')]=_[_0xde35('0x35')](_0x59d402['query']);_0x274806[_0xde35('0x36')]=_['intersection'](_0x274806['model'],_0x274806['query']);_0x22a228[_0xde35('0x38')]=_[_0xde35('0x37')](_0x274806[_0xde35('0x33')],qs[_0xde35('0x39')](_0x59d402[_0xde35('0x34')][_0xde35('0x39')]));_0x22a228[_0xde35('0x38')]=_0x22a228[_0xde35('0x38')][_0xde35('0x3a')]?_0x22a228[_0xde35('0x38')]:_0x274806['model'];if(_0x59d402[_0xde35('0x34')][_0xde35('0x43')]){_0x22a228['include']=[{'all':!![]}];}_0x22a228=_[_0xde35('0x40')]({},_0x22a228,_0x59d402['options']);return db[_0xde35('0x2e')][_0xde35('0x48')](_0x22a228)[_0xde35('0x25')](handleEntityNotFound(_0x44e267,null))[_0xde35('0x25')](respondWithResult(_0x44e267,null))['catch'](handleError(_0x44e267,null));};exports[_0xde35('0x26')]=function(_0x1d5838,_0x52206a){return db[_0xde35('0x2e')][_0xde35('0x48')]({'where':{'id':_0x1d5838[_0xde35('0x49')]['id']}})[_0xde35('0x25')](handleEntityNotFound(_0x52206a,null))[_0xde35('0x25')](removeEntity(_0x52206a,null))['catch'](handleError(_0x52206a,null));};exports['describe']=function(_0x1d6a64,_0x3840cc){return db[_0xde35('0x2e')]['describe']()[_0xde35('0x25')](respondWithResult(_0x3840cc,null))[_0xde35('0x46')](handleError(_0x3840cc,null));};exports['create']=function(_0x135b92,_0x3203d8){var _0x2671dd;return db['sequelize'][_0xde35('0x4a')](function(_0x108bec){return db['VoicePrefix'][_0xde35('0x4b')](_0x135b92[_0xde35('0x4c')],{'transaction':_0x108bec})['then'](function(_0x46ca6d){_0x2671dd=_0x46ca6d[_0xde35('0x4d')]({'plain':!![]});return db[_0xde35('0x4e')][_0xde35('0x48')]({'where':{'id':_0x2671dd[_0xde35('0x4f')]},'raw':!![]})[_0xde35('0x25')](function(_0x35d5f5){return createVoicePrefixExtensions(_0x2671dd,_0x35d5f5,_0x108bec);});});})[_0xde35('0x25')](function(){var _0x4c9f94=_0x135b92['user']['get']({'plain':!![]});if(!_0x4c9f94)throw new Error(_0xde35('0x50'));if(_0x4c9f94['role']===_0xde35('0x51')){var _0x5b72b2=_0x2671dd;return db['UserProfileSection'][_0xde35('0x48')]({'where':{'name':_0xde35('0x27'),'userProfileId':_0x4c9f94[_0xde35('0x52')]},'raw':!![]})['then'](function(_0xaeee74){if(_0xaeee74&&_0xaeee74[_0xde35('0x53')]===0x0){return db[_0xde35('0x28')][_0xde35('0x4b')]({'name':_0x5b72b2['name'],'resourceId':_0x5b72b2['id'],'type':_0xaeee74[_0xde35('0x2b')],'sectionId':_0xaeee74['id']},{})[_0xde35('0x25')](function(){return _0x2671dd;});}else{return _0x2671dd;}})[_0xde35('0x46')](function(_0x5f0bc9){logger[_0xde35('0x29')](_0xde35('0x54'),_0x5f0bc9);throw _0x5f0bc9;});}return _0x2671dd;})[_0xde35('0x25')](respondWithResult(_0x3203d8,null))[_0xde35('0x46')](handleError(_0x3203d8,null));};function Extension(_0x5c2855,_0x56e93b,_0x174636,_0x3a9c1d){this[_0xde35('0x55')]=_0xde35('0x56');this['exten']=_0x5c2855;this[_0xde35('0x57')]=_0x174636;this[_0xde35('0x31')]=_0xde35('0x58');this[_0xde35('0x59')]=_0xde35('0x5a');this[_0xde35('0x5b')]=_0x56e93b;this[_0xde35('0x5c')]=_0x3a9c1d;}function createVoicePrefixExtensions(_0x32d906,_0x212a70,_0x253248){return new BPromise(function(_0x275292,_0x3e7a1d){var _0x326504=new Extension(formatPrefixName(_0x32d906['prefix']),0x1,_0xde35('0x5d'),_0xde35('0x5e'));_0x326504['VoicePrefixId']=_0x32d906['id'];return db[_0xde35('0x4e')][_0xde35('0x4b')](_0x326504,{'transaction':_0x253248})[_0xde35('0x25')](function(_0xbda258){var _0x5c7cba=_0xbda258[_0xde35('0x4d')]({'plain':!![]});var _0x48ab37=_[_0xde35('0x2d')](addVoicePrefixExtensions(_0x32d906,_0x212a70),function(_0x332660){_0x332660[_0xde35('0x4f')]=_0x5c7cba['id'];_0x332660[_0xde35('0x5f')]=_0x32d906['id'];return _0x332660;});return db['VoiceExtension'][_0xde35('0x60')](_0x48ab37,{'transaction':_0x253248})[_0xde35('0x25')](function(_0x5f4419){if(!_0x5f4419){return _0x3e7a1d(_0xde35('0x61'));}else{return _0x275292(_0x5f4419);}})['catch'](function(_0x135b9e){return _0x3e7a1d(_0x135b9e);});});;});};function addVoicePrefixExtensions(_0x4eba58,_0x1ac05d){var _0x1f9896=[];var _0x396f80=formatPrefixName(_0x4eba58[_0xde35('0x62')]);_0x1f9896[_0xde35('0x63')](new Extension(_0x396f80,0x2,_0xde35('0x64'),_0xde35('0x65')+_0x4eba58[_0xde35('0x2b')]));if(_0x4eba58[_0xde35('0x66')]){_0x1f9896[_0xde35('0x63')](new Extension(_0x396f80,0x3,_0xde35('0x64'),_0xde35('0x67')+_0x4eba58['callerIdAll']));}else{_0x1f9896[_0xde35('0x63')](new Extension(_0x396f80,0x3,_0xde35('0x5d'),_0xde35('0x68')));}_0x1f9896[_0xde35('0x63')](new Extension(_0x396f80,0x4,_0xde35('0x69'),_0x1ac05d[_0xde35('0x55')]+','+_0xde35('0x6a')+(0x8+_0x4eba58[_0xde35('0x2b')][_0xde35('0x3a')])+'}'+','+0x1));return _0x1f9896;}function formatPrefixName(_0xb8559c){var _0x495bcc='_';for(var _0x57a8c9=0x0;_0x57a8c9<_0xb8559c[_0xde35('0x3a')];_0x57a8c9++){if(_0xb8559c['charAt'](_0x57a8c9)=='-'){_0x495bcc+=_0xb8559c[_0xde35('0x6b')](_0x57a8c9);}else{_0x495bcc+='['+_0xb8559c[_0xde35('0x6b')](_0x57a8c9)+']';}}_0x495bcc+='.';return _0x495bcc;}exports[_0xde35('0x24')]=function(_0x570a87,_0x1592ef,_0x4302b9){var _0x5637a1=_0x570a87['body'];_0x5637a1[_0xde35('0x62')]='system-'+_0x5637a1['name']+'-';return db[_0xde35('0x6c')]['transaction'](function(_0x4c99a6){return db[_0xde35('0x2e')][_0xde35('0x24')](_0x5637a1,{'where':{'id':_0x5637a1['id']},'transaction':_0x4c99a6})[_0xde35('0x25')](function(){return db[_0xde35('0x4e')]['destroy']({'where':{'VoicePrefixId':_0x5637a1['id']},'transaction':_0x4c99a6})[_0xde35('0x25')](function(){return db[_0xde35('0x4e')][_0xde35('0x48')]({'where':{'id':_0x5637a1[_0xde35('0x4f')]},'raw':!![]})[_0xde35('0x25')](function(_0x269dff){return createVoicePrefixExtensions(_0x5637a1,_0x269dff,_0x4c99a6);});});});})['then'](function(){return db[_0xde35('0x2e')][_0xde35('0x6d')](_0x5637a1['id']);})[_0xde35('0x25')](respondWithResult(_0x1592ef,null))['catch'](handleError(_0x1592ef,null));};exports['addAgents']=function(_0x2329b7,_0x5467ad,_0x4e90be){return db[_0xde35('0x2e')][_0xde35('0x48')]({'where':{'id':_0x2329b7[_0xde35('0x49')]['id']}})['then'](handleEntityNotFound(_0x5467ad,null))['then'](function(_0x3bf9ca){if(_0x3bf9ca){return _0x3bf9ca[_0xde35('0x6e')](_0x2329b7[_0xde35('0x4c')][_0xde35('0x6f')],_[_0xde35('0x70')](_0x2329b7[_0xde35('0x4c')],['ids','id'])||{})[_0xde35('0x71')](function(_0x13ca15){for(var _0x3008a0=0x0;_0x3008a0<_0x2329b7[_0xde35('0x4c')][_0xde35('0x6f')][_0xde35('0x3a')];_0x3008a0+=0x1){socket[_0xde35('0x72')]('userVoicePrefix:save',{'UserId':Number(_0x2329b7[_0xde35('0x4c')][_0xde35('0x6f')][_0x3008a0]),'VoicePrefixId':Number(_0x2329b7['params']['id'])});}return _0x13ca15;});}})[_0xde35('0x25')](respondWithResult(_0x5467ad,null))[_0xde35('0x46')](handleError(_0x5467ad,null));};exports[_0xde35('0x73')]=function(_0x237027,_0x1a5683,_0x116f9f){return db[_0xde35('0x2e')][_0xde35('0x48')]({'where':{'id':_0x237027['params']['id']}})[_0xde35('0x25')](handleEntityNotFound(_0x1a5683,null))['then'](function(_0x434022){if(_0x434022){return _0x434022[_0xde35('0x73')](_0x237027[_0xde35('0x34')][_0xde35('0x6f')])[_0xde35('0x25')](function(){if(_[_0xde35('0x74')](_0x237027[_0xde35('0x34')][_0xde35('0x6f')])){for(var _0xc69852=0x0;_0xc69852<_0x237027[_0xde35('0x34')][_0xde35('0x6f')][_0xde35('0x3a')];_0xc69852+=0x1){socket[_0xde35('0x72')](_0xde35('0x75'),{'UserId':Number(_0x237027['query'][_0xde35('0x6f')][_0xc69852]),'VoicePrefixId':Number(_0x237027[_0xde35('0x49')]['id'])});}}else{socket[_0xde35('0x72')](_0xde35('0x75'),{'UserId':Number(_0x237027[_0xde35('0x34')][_0xde35('0x6f')]),'VoicePrefixId':Number(_0x237027[_0xde35('0x49')]['id'])});}});}})['then'](respondWithStatusCode(_0x1a5683,null))['catch'](handleError(_0x1a5683,null));};exports[_0xde35('0x76')]=function(_0x320c50,_0xeb57bf,_0x3da410){var _0x5ffb6={};var _0x4f284c={};var _0x3dbb8a;var _0x5df20d;return db['VoicePrefix']['findOne']({'where':{'id':_0x320c50[_0xde35('0x49')]['id']}})[_0xde35('0x25')](handleEntityNotFound(_0xeb57bf,null))[_0xde35('0x25')](function(_0x478585){if(_0x478585){_0x3dbb8a=_0x478585;_0x4f284c[_0xde35('0x33')]=_[_0xde35('0x35')](db[_0xde35('0x77')][_0xde35('0x2f')]);_0x4f284c['query']=_[_0xde35('0x35')](_0x320c50[_0xde35('0x34')]);_0x4f284c['filters']=_['intersection'](_0x4f284c['model'],_0x4f284c[_0xde35('0x34')]);_0x5ffb6[_0xde35('0x38')]=_[_0xde35('0x37')](_0x4f284c[_0xde35('0x33')],qs[_0xde35('0x39')](_0x320c50[_0xde35('0x34')][_0xde35('0x39')]));_0x5ffb6['attributes']=_0x5ffb6[_0xde35('0x38')]['length']?_0x5ffb6[_0xde35('0x38')]:_0x4f284c[_0xde35('0x33')];_0x5ffb6[_0xde35('0x78')]=qs[_0xde35('0x3d')](_0x320c50['query'][_0xde35('0x3d')]);_0x5ffb6[_0xde35('0x3e')]=qs[_0xde35('0x36')](_[_0xde35('0x3f')](_0x320c50[_0xde35('0x34')],_0x4f284c[_0xde35('0x36')]));if(_0x320c50[_0xde35('0x34')][_0xde35('0x42')]){_0x5ffb6['where']=_[_0xde35('0x40')](_0x5ffb6[_0xde35('0x3e')],{'$or':_[_0xde35('0x2d')](_0x5ffb6['attributes'],function(_0x1a243b){var _0x1e5965={};_0x1e5965[_0x1a243b]={'$like':'%'+_0x320c50[_0xde35('0x34')][_0xde35('0x42')]+'%'};return _0x1e5965;})});}_0x5ffb6=_[_0xde35('0x40')]({},_0x5ffb6,_0x320c50[_0xde35('0x79')]);return _0x3dbb8a[_0xde35('0x76')](_0x5ffb6);}})[_0xde35('0x25')](function(_0x5b09b3){if(_0x5b09b3){_0x5df20d=_0x5b09b3[_0xde35('0x3a')];if(!_0x320c50[_0xde35('0x34')][_0xde35('0x3b')](_0xde35('0x3c'))){_0x5ffb6[_0xde35('0x20')]=qs[_0xde35('0x20')](_0x320c50[_0xde35('0x34')][_0xde35('0x20')]);_0x5ffb6[_0xde35('0x1e')]=qs[_0xde35('0x1e')](_0x320c50[_0xde35('0x34')][_0xde35('0x1e')]);}return _0x3dbb8a[_0xde35('0x76')](_0x5ffb6);}})[_0xde35('0x25')](function(_0x20eab8){if(_0x20eab8){return _0x20eab8?{'count':_0x5df20d,'rows':_0x20eab8}:null;}})[_0xde35('0x25')](respondWithResult(_0xeb57bf,null))[_0xde35('0x46')](handleError(_0xeb57bf,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 4829994..aa90ea2 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 _0xf51e=['hook','exports','events','../../mysqldb','setMaxListeners','remove','emit','hasOwnProperty'];(function(_0x221ba2,_0x79208){var _0x47d08e=function(_0xaf14ee){while(--_0xaf14ee){_0x221ba2['push'](_0x221ba2['shift']());}};_0x47d08e(++_0x79208);}(_0xf51e,0x1c2));var _0xef51=function(_0x36679b,_0x11e5ca){_0x36679b=_0x36679b-0x0;var _0xdc3dd5=_0xf51e[_0x36679b];return _0xdc3dd5;};'use strict';var EventEmitter=require(_0xef51('0x0'));var VoicePrefix=require(_0xef51('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0xef51('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0xef51('0x3')};function emitEvent(_0x3a6250){return function(_0x233024,_0x3910b6,_0x4b39a4){VoicePrefixEvents[_0xef51('0x4')](_0x3a6250+':'+_0x233024['id'],_0x233024);VoicePrefixEvents['emit'](_0x3a6250,_0x233024);_0x4b39a4(null);};}for(var e in events){if(events[_0xef51('0x5')](e)){var event=events[e];VoicePrefix[_0xef51('0x6')](e,emitEvent(event));}}module[_0xef51('0x7')]=VoicePrefixEvents; \ No newline at end of file +var _0xdd47=['hasOwnProperty','hook','events','../../mysqldb','setMaxListeners','save','update','remove','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xdd47,0x110));var _0x7dd4=function(_0x216d45,_0x4989fe){_0x216d45=_0x216d45-0x0;var _0xbaac0b=_0xdd47[_0x216d45];return _0xbaac0b;};'use strict';var EventEmitter=require(_0x7dd4('0x0'));var VoicePrefix=require(_0x7dd4('0x1'))['db']['VoicePrefix'];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x7dd4('0x2')](0x0);var events={'afterCreate':_0x7dd4('0x3'),'afterUpdate':_0x7dd4('0x4'),'afterDestroy':_0x7dd4('0x5')};function emitEvent(_0x556906){return function(_0x3496c6,_0x523685,_0x4c2b0c){VoicePrefixEvents[_0x7dd4('0x6')](_0x556906+':'+_0x3496c6['id'],_0x3496c6);VoicePrefixEvents[_0x7dd4('0x6')](_0x556906,_0x3496c6);_0x4c2b0c(null);};}for(var e in events){if(events[_0x7dd4('0x7')](e)){var event=events[e];VoicePrefix[_0x7dd4('0x8')](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 ab3d821..eefb271 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 _0x3ce8=['../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define','VoicePrefix','lodash','util'];(function(_0x367d5f,_0x146df9){var _0x158cf3=function(_0x34ec23){while(--_0x34ec23){_0x367d5f['push'](_0x367d5f['shift']());}};_0x158cf3(++_0x146df9);}(_0x3ce8,0x14e));var _0x83ce=function(_0x16bda8,_0x366474){_0x16bda8=_0x16bda8-0x0;var _0x30ff0b=_0x3ce8[_0x16bda8];return _0x30ff0b;};'use strict';var _=require(_0x83ce('0x0'));var util=require(_0x83ce('0x1'));var logger=require(_0x83ce('0x2'))('api');var moment=require('moment');var BPromise=require(_0x83ce('0x3'));var rp=require(_0x83ce('0x4'));var fs=require('fs');var path=require(_0x83ce('0x5'));var rimraf=require(_0x83ce('0x6'));var config=require(_0x83ce('0x7'));var attributes=require(_0x83ce('0x8'));module[_0x83ce('0x9')]=function(_0x1c7f87,_0x302609){return _0x1c7f87[_0x83ce('0xa')](_0x83ce('0xb'),attributes,{'tableName':'voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfc60=['voice_prefixes','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voicePrefix.attributes','exports','define'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xfc60,0xeb));var _0x0fc6=function(_0x13610a,_0x4f866c){_0x13610a=_0x13610a-0x0;var _0x150ecc=_0xfc60[_0x13610a];return _0x150ecc;};'use strict';var _=require('lodash');var util=require(_0x0fc6('0x0'));var logger=require(_0x0fc6('0x1'))(_0x0fc6('0x2'));var moment=require(_0x0fc6('0x3'));var BPromise=require(_0x0fc6('0x4'));var rp=require(_0x0fc6('0x5'));var fs=require('fs');var path=require(_0x0fc6('0x6'));var rimraf=require(_0x0fc6('0x7'));var config=require(_0x0fc6('0x8'));var attributes=require(_0x0fc6('0x9'));module[_0x0fc6('0xa')]=function(_0x1df45c,_0x42ec41){return _0x1df45c[_0x0fc6('0xb')]('VoicePrefix',attributes,{'tableName':_0x0fc6('0xc'),'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 cf7f4f3..d09aae9 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 _0x2087=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','register','request','then','info','VoicePrefix,\x20%s,\x20%s','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','error','code','message','catch'];(function(_0x3e44fa,_0x75ed2a){var _0x2a0aba=function(_0x1db6a7){while(--_0x1db6a7){_0x3e44fa['push'](_0x3e44fa['shift']());}};_0x2a0aba(++_0x75ed2a);}(_0x2087,0xf3));var _0x7208=function(_0x22ccd5,_0x5ac590){_0x22ccd5=_0x22ccd5-0x0;var _0x2c79ee=_0x2087[_0x22ccd5];return _0x2c79ee;};'use strict';var _=require(_0x7208('0x0'));var util=require(_0x7208('0x1'));var moment=require(_0x7208('0x2'));var BPromise=require(_0x7208('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7208('0x4'));var db=require(_0x7208('0x5'))['db'];var utils=require(_0x7208('0x6'));var logger=require(_0x7208('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7208('0x8'));var client=jayson['client'][_0x7208('0x9')]({'port':0x232a});config['redis']=_[_0x7208('0xa')](config[_0x7208('0xb')],{'host':_0x7208('0xc'),'port':0x18eb});var socket=require(_0x7208('0xd'))(new Redis(config[_0x7208('0xb')]));require(_0x7208('0xe'))[_0x7208('0xf')](socket);function respondWithRpcPromise(_0x533d6a,_0x1949bc,_0x17e320){return new BPromise(function(_0x92a88e,_0x32db48){return client[_0x7208('0x10')](_0x533d6a,_0x17e320)[_0x7208('0x11')](function(_0x5b30f8){logger[_0x7208('0x12')](_0x7208('0x13'),_0x1949bc,_0x7208('0x14'));logger[_0x7208('0x15')](_0x7208('0x16'),_0x1949bc,_0x7208('0x14'),JSON['stringify'](_0x5b30f8));if(_0x5b30f8[_0x7208('0x17')]){if(_0x5b30f8[_0x7208('0x17')][_0x7208('0x18')]===0x1f4){logger[_0x7208('0x17')](_0x7208('0x13'),_0x1949bc,_0x5b30f8[_0x7208('0x17')][_0x7208('0x19')]);return _0x32db48(_0x5b30f8[_0x7208('0x17')][_0x7208('0x19')]);}logger[_0x7208('0x17')](_0x7208('0x13'),_0x1949bc,_0x5b30f8['error']['message']);return _0x92a88e(_0x5b30f8[_0x7208('0x17')][_0x7208('0x19')]);}else{logger['info'](_0x7208('0x13'),_0x1949bc,_0x7208('0x14'));_0x92a88e(_0x5b30f8['result'][_0x7208('0x19')]);}})[_0x7208('0x1a')](function(_0x18f0e2){logger[_0x7208('0x17')](_0x7208('0x13'),_0x1949bc,_0x18f0e2);_0x32db48(_0x18f0e2);});});} \ No newline at end of file +var _0xe5af=['stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./voicePrefix.socket','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s'];(function(_0x580b15,_0x28afa4){var _0x1adb1b=function(_0x47a01f){while(--_0x47a01f){_0x580b15['push'](_0x580b15['shift']());}};_0x1adb1b(++_0x28afa4);}(_0xe5af,0x9c));var _0xfe5a=function(_0x5913b4,_0x240b15){_0x5913b4=_0x5913b4-0x0;var _0x595d5b=_0xe5af[_0x5913b4];return _0x595d5b;};'use strict';var _=require('lodash');var util=require(_0xfe5a('0x0'));var moment=require(_0xfe5a('0x1'));var BPromise=require('bluebird');var rs=require(_0xfe5a('0x2'));var fs=require('fs');var Redis=require(_0xfe5a('0x3'));var db=require(_0xfe5a('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xfe5a('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0xfe5a('0x6'));var client=jayson[_0xfe5a('0x7')]['http']({'port':0x232a});config['redis']=_[_0xfe5a('0x8')](config[_0xfe5a('0x9')],{'host':_0xfe5a('0xa'),'port':0x18eb});var socket=require(_0xfe5a('0xb'))(new Redis(config['redis']));require(_0xfe5a('0xc'))['register'](socket);function respondWithRpcPromise(_0x51718e,_0x259e8a,_0x2cb946){return new BPromise(function(_0x543619,_0xb51e47){return client[_0xfe5a('0xd')](_0x51718e,_0x2cb946)[_0xfe5a('0xe')](function(_0x50024c){logger[_0xfe5a('0xf')]('VoicePrefix,\x20%s,\x20%s',_0x259e8a,_0xfe5a('0x10'));logger[_0xfe5a('0x11')](_0xfe5a('0x12'),_0x259e8a,_0xfe5a('0x10'),JSON[_0xfe5a('0x13')](_0x50024c));if(_0x50024c['error']){if(_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x15')]===0x1f4){logger[_0xfe5a('0x14')](_0xfe5a('0x16'),_0x259e8a,_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x17')]);return _0xb51e47(_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x17')]);}logger[_0xfe5a('0x14')](_0xfe5a('0x16'),_0x259e8a,_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x17')]);return _0x543619(_0x50024c[_0xfe5a('0x14')][_0xfe5a('0x17')]);}else{logger[_0xfe5a('0xf')](_0xfe5a('0x16'),_0x259e8a,'request\x20sent');_0x543619(_0x50024c[_0xfe5a('0x18')][_0xfe5a('0x17')]);}})['catch'](function(_0x3b0101){logger[_0xfe5a('0x14')](_0xfe5a('0x16'),_0x259e8a,_0x3b0101);_0xb51e47(_0x3b0101);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 68c2c3f..04aab5c 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 _0x8efc=['emit','removeListener','register','length','save','remove','update'];(function(_0x1c7280,_0x1deb84){var _0x3164a6=function(_0x5494e9){while(--_0x5494e9){_0x1c7280['push'](_0x1c7280['shift']());}};_0x3164a6(++_0x1deb84);}(_0x8efc,0xb3));var _0xc8ef=function(_0x5ad220,_0x27407e){_0x5ad220=_0x5ad220-0x0;var _0xdec77d=_0x8efc[_0x5ad220];return _0xdec77d;};'use strict';var VoicePrefixEvents=require('./voicePrefix.events');var events=[_0xc8ef('0x0'),_0xc8ef('0x1'),_0xc8ef('0x2')];function createListener(_0x1753d9,_0x517faf){return function(_0x2e2c8f){_0x517faf[_0xc8ef('0x3')](_0x1753d9,_0x2e2c8f);};}function removeListener(_0x33b9c9,_0x50d1f6){return function(){VoicePrefixEvents[_0xc8ef('0x4')](_0x33b9c9,_0x50d1f6);};}exports[_0xc8ef('0x5')]=function(_0x1cd466){for(var _0x13b433=0x0,_0x576ff9=events[_0xc8ef('0x6')];_0x13b433<_0x576ff9;_0x13b433++){var _0x3d06cd=events[_0x13b433];var _0x1c8931=createListener('voicePrefix:'+_0x3d06cd,_0x1cd466);VoicePrefixEvents['on'](_0x3d06cd,_0x1c8931);}}; \ No newline at end of file +var _0xe205=['save','remove','update','emit','removeListener','register','./voicePrefix.events'];(function(_0x4c23d0,_0x47580a){var _0x135c8b=function(_0x1e8f8b){while(--_0x1e8f8b){_0x4c23d0['push'](_0x4c23d0['shift']());}};_0x135c8b(++_0x47580a);}(_0xe205,0xa7));var _0x5e20=function(_0x18049a,_0x46f00e){_0x18049a=_0x18049a-0x0;var _0x59d80a=_0xe205[_0x18049a];return _0x59d80a;};'use strict';var VoicePrefixEvents=require(_0x5e20('0x0'));var events=[_0x5e20('0x1'),_0x5e20('0x2'),_0x5e20('0x3')];function createListener(_0x6c1585,_0x1620fb){return function(_0x13bace){_0x1620fb[_0x5e20('0x4')](_0x6c1585,_0x13bace);};}function removeListener(_0x37c5e9,_0x4ac934){return function(){VoicePrefixEvents[_0x5e20('0x5')](_0x37c5e9,_0x4ac934);};}exports[_0x5e20('0x6')]=function(_0x44dbb3){for(var _0x3c4203=0x0,_0x5eca5c=events['length'];_0x3c4203<_0x5eca5c;_0x3c4203++){var _0x3a382f=events[_0x3c4203];var _0x4c9332=createListener('voicePrefix:'+_0x3a382f,_0x44dbb3);VoicePrefixEvents['on'](_0x3a382f,_0x4c9332);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 81be29d..dbe51b4 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 _0x36fc=['post','clone','addTeams','addAgents','/:id/lists','addLists','addBlackLists','put','update','delete','destroy','removeAgents','removeBlackLists','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','/:id/members','getMembers','getLists','/:id/blacklists'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x36fc,0x79));var _0xc36f=function(_0x211da3,_0x1ce2cc){_0x211da3=_0x211da3-0x0;var _0x55fa53=_0x36fc[_0x211da3];return _0x55fa53;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xc36f('0x0'));var express=require(_0xc36f('0x1'));var router=express[_0xc36f('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xc36f('0x3'));var interaction=require(_0xc36f('0x4'));var config=require(_0xc36f('0x5'));var controller=require('./voiceQueue.controller');router[_0xc36f('0x6')]('/',auth[_0xc36f('0x7')](),controller[_0xc36f('0x8')]);router['get'](_0xc36f('0x9'),auth['isAuthenticated'](),controller[_0xc36f('0xa')]);router['get'](_0xc36f('0xb'),auth[_0xc36f('0x7')](),controller[_0xc36f('0xc')]);router[_0xc36f('0x6')](_0xc36f('0xd'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xc36f('0x6')](_0xc36f('0xe'),auth[_0xc36f('0x7')](),controller['getHopperFinals']);router[_0xc36f('0x6')]('/:id/hopper_black',auth[_0xc36f('0x7')](),controller[_0xc36f('0xf')]);router[_0xc36f('0x6')](_0xc36f('0x10'),auth[_0xc36f('0x7')](),controller[_0xc36f('0x11')]);router['get'](_0xc36f('0x12'),auth['isAuthenticated'](),controller['getAgents']);router['get'](_0xc36f('0x13'),auth[_0xc36f('0x7')](),controller[_0xc36f('0x14')]);router[_0xc36f('0x6')]('/:id/lists',auth[_0xc36f('0x7')](),controller[_0xc36f('0x15')]);router[_0xc36f('0x6')](_0xc36f('0x16'),auth['isAuthenticated'](),controller['getBlackLists']);router[_0xc36f('0x17')]('/',auth[_0xc36f('0x7')](),controller['create']);router[_0xc36f('0x17')]('/:id/clone',auth[_0xc36f('0x7')](),controller[_0xc36f('0x18')]);router[_0xc36f('0x17')]('/:id/teams',auth[_0xc36f('0x7')](),controller[_0xc36f('0x19')]);router[_0xc36f('0x17')](_0xc36f('0x12'),auth['isAuthenticated'](),controller[_0xc36f('0x1a')]);router['post'](_0xc36f('0x1b'),auth[_0xc36f('0x7')](),controller[_0xc36f('0x1c')]);router[_0xc36f('0x17')](_0xc36f('0x16'),auth['isAuthenticated'](),controller[_0xc36f('0x1d')]);router[_0xc36f('0x1e')](_0xc36f('0x9'),auth[_0xc36f('0x7')](),controller[_0xc36f('0x1f')]);router[_0xc36f('0x20')](_0xc36f('0x9'),auth['isAuthenticated'](),controller[_0xc36f('0x21')]);router[_0xc36f('0x20')](_0xc36f('0x10'),auth[_0xc36f('0x7')](),controller['removeTeams']);router[_0xc36f('0x20')](_0xc36f('0x12'),auth[_0xc36f('0x7')](),controller[_0xc36f('0x22')]);router['delete'](_0xc36f('0x1b'),auth[_0xc36f('0x7')](),controller['removeLists']);router[_0xc36f('0x20')](_0xc36f('0x16'),auth[_0xc36f('0x7')](),controller[_0xc36f('0x23')]);module['exports']=router; \ No newline at end of file +var _0x9ae5=['/:id/users','/:id/lists','addLists','/:id/blacklists','put','/:id','update','delete','destroy','removeTeams','removeAgents','util','connect-timeout','express','Router','fs-extra','../../config/environment','get','index','show','/:id/hoppers','isAuthenticated','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/hopper_black','/:id/teams','getAgents','/:id/members','getMembers','getLists','getBlackLists','post','/:id/clone','clone','addTeams'];(function(_0xc8f5a3,_0x4a02a5){var _0x55041a=function(_0x43fe7d){while(--_0x43fe7d){_0xc8f5a3['push'](_0xc8f5a3['shift']());}};_0x55041a(++_0x4a02a5);}(_0x9ae5,0x7a));var _0x59ae=function(_0x546f79,_0x1b204){_0x546f79=_0x546f79-0x0;var _0x5b0bbb=_0x9ae5[_0x546f79];return _0x5b0bbb;};'use strict';var multer=require('multer');var util=require(_0x59ae('0x0'));var path=require('path');var timeout=require(_0x59ae('0x1'));var express=require(_0x59ae('0x2'));var router=express[_0x59ae('0x3')]();var fs_extra=require(_0x59ae('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x59ae('0x5'));var controller=require('./voiceQueue.controller');router[_0x59ae('0x6')]('/',auth['isAuthenticated'](),controller[_0x59ae('0x7')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x59ae('0x8')]);router['get'](_0x59ae('0x9'),auth[_0x59ae('0xa')](),controller[_0x59ae('0xb')]);router[_0x59ae('0x6')](_0x59ae('0xc'),auth[_0x59ae('0xa')](),controller['getHopperHistories']);router[_0x59ae('0x6')](_0x59ae('0xd'),auth[_0x59ae('0xa')](),controller[_0x59ae('0xe')]);router[_0x59ae('0x6')](_0x59ae('0xf'),auth['isAuthenticated'](),controller['getHopperBlacks']);router[_0x59ae('0x6')](_0x59ae('0x10'),auth['isAuthenticated'](),controller['getTeams']);router[_0x59ae('0x6')]('/:id/users',auth[_0x59ae('0xa')](),controller[_0x59ae('0x11')]);router[_0x59ae('0x6')](_0x59ae('0x12'),auth[_0x59ae('0xa')](),controller[_0x59ae('0x13')]);router[_0x59ae('0x6')]('/:id/lists',auth[_0x59ae('0xa')](),controller[_0x59ae('0x14')]);router[_0x59ae('0x6')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x59ae('0x15')]);router[_0x59ae('0x16')]('/',auth['isAuthenticated'](),controller['create']);router[_0x59ae('0x16')](_0x59ae('0x17'),auth['isAuthenticated'](),controller[_0x59ae('0x18')]);router[_0x59ae('0x16')](_0x59ae('0x10'),auth[_0x59ae('0xa')](),controller[_0x59ae('0x19')]);router['post'](_0x59ae('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0x59ae('0x16')](_0x59ae('0x1b'),auth[_0x59ae('0xa')](),controller[_0x59ae('0x1c')]);router[_0x59ae('0x16')](_0x59ae('0x1d'),auth['isAuthenticated'](),controller['addBlackLists']);router[_0x59ae('0x1e')](_0x59ae('0x1f'),auth[_0x59ae('0xa')](),controller[_0x59ae('0x20')]);router[_0x59ae('0x21')](_0x59ae('0x1f'),auth['isAuthenticated'](),controller[_0x59ae('0x22')]);router[_0x59ae('0x21')](_0x59ae('0x10'),auth['isAuthenticated'](),controller[_0x59ae('0x23')]);router[_0x59ae('0x21')](_0x59ae('0x1a'),auth[_0x59ae('0xa')](),controller[_0x59ae('0x24')]);router[_0x59ae('0x21')]('/:id/lists',auth['isAuthenticated'](),controller['removeLists']);router[_0x59ae('0x21')](_0x59ae('0x1d'),auth[_0x59ae('0xa')](),controller['removeBlackLists']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index e428f45..def4f34 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 _0xef7c=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','ENUM','inbound','outbound','default','leastrecent','random','rrmemory','rrordered','ringall','setDataValue','getDataValue','type','dialMethod','strategy','booked','roundrobin','predictive','power','INTEGER','yes','all','periodic_announce','join','split','leavewhenempty','BOOLEAN','acw','wrapuptime','preview','progressive','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','#Congestion\x20Retry\x20(min:1,\x20max:999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','never','onlyIfOpen','always','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','ASC','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','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)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','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)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x558a68,_0x30fe17){var _0x51bb67=function(_0x1b22a4){while(--_0x1b22a4){_0x558a68['push'](_0x558a68['shift']());}};_0x51bb67(++_0x30fe17);}(_0xef7c,0xa5));var _0xcef7=function(_0x325c3d,_0x3a4033){_0x325c3d=_0x325c3d-0x0;var _0x292d36=_0xef7c[_0x325c3d];return _0x292d36;};'use strict';var Sequelize=require(_0xcef7('0x0'));module[_0xcef7('0x1')]={'name':{'type':Sequelize[_0xcef7('0x2')],'allowNull':![],'unique':_0xcef7('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x5'),_0xcef7('0x6')),'allowNull':![],'defaultValue':_0xcef7('0x5')},'musiconhold':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':_0xcef7('0x7')},'announce':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':''},'strategy':{'type':Sequelize[_0xcef7('0x4')]('rr','ringall',_0xcef7('0x8'),'fewestcalls',_0xcef7('0x9'),_0xcef7('0xa'),'linear','wrandom',_0xcef7('0xb')),'allowNull':![],'defaultValue':_0xcef7('0xc'),'set':function(_0x1a1d34){this[_0xcef7('0xd')]('strategy',_0x1a1d34?_0x1a1d34:'rrmemory');},'get':function(){var _0x16e18f=this[_0xcef7('0xe')](_0xcef7('0xf'));var _0x17a3b7=this['getDataValue'](_0xcef7('0x10'));var _0xf917e3=this[_0xcef7('0xe')](_0xcef7('0x11'));if(_0x16e18f===_0xcef7('0x5')){return _0xf917e3;}if(_0x17a3b7===_0xcef7('0x12')&&_0xf917e3==='rrmemory'||_0x17a3b7==='booked'&&_0xf917e3===_0xcef7('0x13')){return _0xf917e3;}if(_0x17a3b7==='progressive'||_0x17a3b7===_0xcef7('0x14')||_0x17a3b7===_0xcef7('0x15')){return _0xf917e3;}return null;}},'servicelevel':{'type':Sequelize[_0xcef7('0x16')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0xcef7('0x16')](0xb)},'timeout':{'type':Sequelize[_0xcef7('0x16')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0xcef7('0x16')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0xcef7('0x16')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0xcef7('0x16')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x17'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x17'),'no',_0xcef7('0x18')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0xcef7('0x16')](0xb)},'autopausebusy':{'type':Sequelize['ENUM'](_0xcef7('0x17'),'no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x17'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0xcef7('0x4')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM']('yes','no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0xcef7('0x4')]('yes','no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x17'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0xcef7('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0xcef7('0x16')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0xcef7('0x16')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x17'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0xcef7('0x17'),'no'),'defaultValue':_0xcef7('0x17')},'announce_holdtime':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x17'),'no','once'),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x17'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0xcef7('0x4')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0xcef7('0x2')]},'queue_youarenext':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0xcef7('0x2')]},'queue_quantity1':{'type':Sequelize[_0xcef7('0x2')]},'queue_quantity2':{'type':Sequelize[_0xcef7('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0xcef7('0x2')]},'queue_less_than':{'type':Sequelize[_0xcef7('0x2')]},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x21616a){this[_0xcef7('0xd')](_0xcef7('0x19'),_0x21616a?_0x21616a[_0xcef7('0x1a')](','):[]);},'get':function(){return this[_0xcef7('0xe')]('periodic_announce')?this[_0xcef7('0xe')](_0xcef7('0x19'))[_0xcef7('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':'yes','set':function(_0x38dec0){this[_0xcef7('0xd')]('joinempty',_0x38dec0?_0x38dec0[_0xcef7('0x1a')](','):undefined);},'get':function(){return this['getDataValue']('joinempty')?this['getDataValue']('joinempty')[_0xcef7('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':'no','set':function(_0x29d629){this[_0xcef7('0xd')](_0xcef7('0x1c'),_0x29d629?_0x29d629[_0xcef7('0x1a')](','):undefined);},'get':function(){return this['getDataValue'](_0xcef7('0x1c'))?this['getDataValue'](_0xcef7('0x1c'))[_0xcef7('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0xcef7('0x16')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xcef7('0x2')]},'acw':{'type':Sequelize[_0xcef7('0x1d')],'defaultValue':0x0,'set':function(_0x5f3c57){this[_0xcef7('0xd')](_0xcef7('0x1e'),_0x5f3c57);if(_0x5f3c57){if(this['getDataValue'](_0xcef7('0x1f'))<0x2){this[_0xcef7('0xd')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0xcef7('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x20'),_0xcef7('0x21'),'power',_0xcef7('0x14'),_0xcef7('0x12')),'defaultValue':_0xcef7('0x21'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0xcef7('0x16')](0x4)[_0xcef7('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xcef7('0x23')},'dialLimitQueue':{'type':Sequelize[_0xcef7('0x16')](0x4)[_0xcef7('0x22')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0xcef7('0x24')},'dialPowerLevel':{'type':Sequelize['FLOAT'](0x2)[_0xcef7('0x22')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0xcef7('0x25')},'dialPredictiveOptimization':{'type':Sequelize['ENUM'](_0xcef7('0x26'),_0xcef7('0x27')),'defaultValue':_0xcef7('0x27'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0xcef7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0xcef7('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0xcef7('0x16')](0x3)[_0xcef7('0x22')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize['STRING']},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xcef7('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0xcef7('0x16')](0x3)[_0xcef7('0x22')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcef7('0x29')},'dialQueueOptions':{'type':Sequelize['STRING'],'defaultValue':_0xcef7('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0xcef7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcef7('0x2b')},'dialQueueProject':{'type':Sequelize[_0xcef7('0x2')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialCongestionMaxRetry':{'type':Sequelize[_0xcef7('0x16')](0x3)[_0xcef7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcef7('0x2c')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xcef7('0x16')](0x5)[_0xcef7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0xcef7('0x16')](0x3)[_0xcef7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcef7('0x2d')},'dialBusyRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcef7('0x2e')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xcef7('0x16')](0x3)[_0xcef7('0x22')],'defaultValue':0x3,'comment':_0xcef7('0x2f')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xcef7('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialGlobalMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0xcef7('0x30')},'dialTimezone':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':'07:00-22:00,*,*,*'},'dialPrefix':{'type':Sequelize[_0xcef7('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM']('always',_0xcef7('0x31'),_0xcef7('0x32')),'defaultValue':_0xcef7('0x33')},'dialAMDActive':{'type':Sequelize[_0xcef7('0x1d')],'defaultValue':0x0,'comment':_0xcef7('0x34')},'dialAMDInitialSilence':{'type':Sequelize[_0xcef7('0x16')](0x9)[_0xcef7('0x22')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xcef7('0x35')},'dialAMDGreeting':{'type':Sequelize[_0xcef7('0x16')](0x9)[_0xcef7('0x22')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xcef7('0x36')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xcef7('0x16')](0x9)[_0xcef7('0x22')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xcef7('0x37')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xcef7('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcef7('0x38')},'dialAMDMinWordLength':{'type':Sequelize['INTEGER'](0x9)[_0xcef7('0x22')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xcef7('0x39')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xcef7('0x16')](0x9)['UNSIGNED'],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xcef7('0x3a')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xcef7('0x16')](0x9)[_0xcef7('0x22')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xcef7('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xcef7('0x3b')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xcef7('0x16')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xcef7('0x3c')},'dialRecallMeTimeout':{'type':Sequelize[_0xcef7('0x16')](0x5)[_0xcef7('0x22')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0xcef7('0x3d')},'dialRecallInQueue':{'type':Sequelize[_0xcef7('0x1d')],'defaultValue':0x0,'comment':_0xcef7('0x3e')},'dialOrderByScheduledAt':{'type':Sequelize[_0xcef7('0x4')](_0xcef7('0x3f'),_0xcef7('0x40')),'defaultValue':_0xcef7('0x3f')},'dialQueueProject2':{'type':Sequelize['STRING'],'comment':_0xcef7('0x41')},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)[_0xcef7('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcef7('0x42')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)[_0xcef7('0x22')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xcef7('0x43')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xcef7('0x16')](0x3)[_0xcef7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcef7('0x44')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xcef7('0x16')](0x5)[_0xcef7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcef7('0x45')},'dialDropMaxRetry':{'type':Sequelize[_0xcef7('0x16')](0x3)[_0xcef7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcef7('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0xcef7('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcef7('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xcef7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcef7('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xcef7('0x16')](0x5)[_0xcef7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcef7('0x49')},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xcef7('0x22')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Machine\x20Retry\x20(min:1,\x20max:999)'},'dialMachineRetryFrequency':{'type':Sequelize[_0xcef7('0x16')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcef7('0x4a')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xcef7('0x16')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xcef7('0x4b')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xcef7('0x16')](0x5)[_0xcef7('0x22')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xcef7('0x4c')},'mandatoryDispositionPauseId':{'type':Sequelize[_0xcef7('0x16')],'allowNull':!![],'comment':_0xcef7('0x4d')},'mandatoryDisposition':{'type':Sequelize[_0xcef7('0x1d')],'defaultValue':![],'comment':_0xcef7('0x4e'),'set':function(_0x4a7d6a){if(!_0x4a7d6a)this[_0xcef7('0xd')](_0xcef7('0x4f'),null);this[_0xcef7('0xd')](_0xcef7('0x50'),_0x4a7d6a);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0xcef7('0x22')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0xcef7('0x16')](0x3)[_0xcef7('0x22')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}}}; \ No newline at end of file +var _0xae24=['#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','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)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','sequelize','STRING','ENUM','inbound','ringall','leastrecent','fewestcalls','random','wrandom','setDataValue','rrmemory','getDataValue','type','dialMethod','strategy','booked','roundrobin','progressive','predictive','power','INTEGER','yes','all','once','join','periodic_announce','split','joinempty','leavewhenempty','BOOLEAN','wrapuptime','preview','Dial\x20Method.','UNSIGNED','Max\x209999\x20channels,\x200\x20means\x20unlimited.','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','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,)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'];(function(_0x51d0b0,_0x27ffe3){var _0x9d0ff2=function(_0x161032){while(--_0x161032){_0x51d0b0['push'](_0x51d0b0['shift']());}};_0x9d0ff2(++_0x27ffe3);}(_0xae24,0x182));var _0x4ae2=function(_0x48e5ea,_0x1f8d6f){_0x48e5ea=_0x48e5ea-0x0;var _0x3d1e19=_0xae24[_0x48e5ea];return _0x3d1e19;};'use strict';var Sequelize=require(_0x4ae2('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x3'),'outbound'),'allowNull':![],'defaultValue':'inbound'},'musiconhold':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':'default'},'announce':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':''},'strategy':{'type':Sequelize[_0x4ae2('0x2')]('rr',_0x4ae2('0x4'),_0x4ae2('0x5'),_0x4ae2('0x6'),_0x4ae2('0x7'),'rrmemory','linear',_0x4ae2('0x8'),'rrordered'),'allowNull':![],'defaultValue':'ringall','set':function(_0xb5587a){this[_0x4ae2('0x9')]('strategy',_0xb5587a?_0xb5587a:_0x4ae2('0xa'));},'get':function(){var _0x449e1a=this[_0x4ae2('0xb')](_0x4ae2('0xc'));var _0x52458f=this[_0x4ae2('0xb')](_0x4ae2('0xd'));var _0x4163ce=this['getDataValue'](_0x4ae2('0xe'));if(_0x449e1a===_0x4ae2('0x3')){return _0x4163ce;}if(_0x52458f===_0x4ae2('0xf')&&_0x4163ce===_0x4ae2('0xa')||_0x52458f===_0x4ae2('0xf')&&_0x4163ce===_0x4ae2('0x10')){return _0x4163ce;}if(_0x52458f===_0x4ae2('0x11')||_0x52458f===_0x4ae2('0x12')||_0x52458f===_0x4ae2('0x13')){return _0x4163ce;}return null;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x4ae2('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x4ae2('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize['STRING']},'weight':{'type':Sequelize[_0x4ae2('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x4ae2('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x15'),'no'),'defaultValue':_0x4ae2('0x15')},'autopause':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x15'),'no',_0x4ae2('0x16')),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x4ae2('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x4ae2('0x2')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize['ENUM'](_0x4ae2('0x15'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x4ae2('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize['ENUM'](_0x4ae2('0x15'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x15'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x15'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize['ENUM'](_0x4ae2('0x15'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize['STRING'],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x4ae2('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x4ae2('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x4ae2('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x15'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize['ENUM'](_0x4ae2('0x15'),'no'),'defaultValue':'yes'},'announce_holdtime':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x15'),'no',_0x4ae2('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize['STRING'],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x15'),'no')},'announce_position_limit':{'type':Sequelize[_0x4ae2('0x14')](0xb)},'announce_round_seconds':{'type':Sequelize[_0x4ae2('0x2')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x4ae2('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize['STRING'],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x4ae2('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize['STRING']},'queue_quantity1':{'type':Sequelize['STRING']},'queue_quantity2':{'type':Sequelize[_0x4ae2('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x1e2b2d){this[_0x4ae2('0x9')]('periodic_announce',_0x1e2b2d?_0x1e2b2d[_0x4ae2('0x18')](','):[]);},'get':function(){return this[_0x4ae2('0xb')](_0x4ae2('0x19'))?this[_0x4ae2('0xb')](_0x4ae2('0x19'))[_0x4ae2('0x1a')](','):[];}},'joinempty':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':_0x4ae2('0x15'),'set':function(_0x2904f1){this[_0x4ae2('0x9')](_0x4ae2('0x1b'),_0x2904f1?_0x2904f1[_0x4ae2('0x18')](','):undefined);},'get':function(){return this[_0x4ae2('0xb')](_0x4ae2('0x1b'))?this[_0x4ae2('0xb')](_0x4ae2('0x1b'))[_0x4ae2('0x1a')](','):undefined;}},'leavewhenempty':{'type':Sequelize['STRING'],'defaultValue':'no','set':function(_0xdcd11e){this['setDataValue'](_0x4ae2('0x1c'),_0xdcd11e?_0xdcd11e[_0x4ae2('0x18')](','):undefined);},'get':function(){return this['getDataValue'](_0x4ae2('0x1c'))?this[_0x4ae2('0xb')](_0x4ae2('0x1c'))[_0x4ae2('0x1a')](','):undefined;}},'reportholdtime':{'type':Sequelize['ENUM'](_0x4ae2('0x15'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x15'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x4ae2('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x15'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x4ae2('0x1')]},'description':{'type':Sequelize[_0x4ae2('0x1')]},'acw':{'type':Sequelize[_0x4ae2('0x1d')],'defaultValue':0x0,'set':function(_0x5c5c7d){this[_0x4ae2('0x9')]('acw',_0x5c5c7d);if(_0x5c5c7d){if(this[_0x4ae2('0xb')](_0x4ae2('0x1e'))<0x2){this[_0x4ae2('0x9')](_0x4ae2('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x4ae2('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x4ae2('0x1d')],'defaultValue':0x0,'comment':'Active/Disactive\x20Campaign'},'dialMethod':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x1f'),_0x4ae2('0x11'),_0x4ae2('0x13'),'predictive',_0x4ae2('0xf')),'defaultValue':_0x4ae2('0x11'),'comment':_0x4ae2('0x20')},'dialLimitChannel':{'type':Sequelize[_0x4ae2('0x14')](0x4)[_0x4ae2('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4ae2('0x22')},'dialLimitQueue':{'type':Sequelize[_0x4ae2('0x14')](0x4)[_0x4ae2('0x21')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x4ae2('0x23')},'dialPowerLevel':{'type':Sequelize[_0x4ae2('0x24')](0x2)[_0x4ae2('0x21')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':'Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).'},'dialPredictiveOptimization':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x25'),_0x4ae2('0x26')),'defaultValue':_0x4ae2('0x26'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x4ae2('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x4ae2('0x27')},'dialPredictiveInterval':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x4ae2('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x4ae2('0x1')]},'dialOriginateTimeout':{'type':Sequelize['INTEGER'](0x3)[_0x4ae2('0x21')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ae2('0x28')},'dialQueueOptions':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':'tTxX','comment':_0x4ae2('0x29')},'dialQueueTimeout':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ae2('0x2a')},'dialQueueProject':{'type':Sequelize[_0x4ae2('0x1')],'comment':_0x4ae2('0x2b')},'dialCongestionMaxRetry':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x4ae2('0x14')](0x5)[_0x4ae2('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x4ae2('0x14')](0x5)[_0x4ae2('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'defaultValue':0x3,'comment':_0x4ae2('0x2c')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ae2('0x2d')},'dialGlobalMaxRetry':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x4ae2('0x2e')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':_0x4ae2('0x2f')},'dialPrefix':{'type':Sequelize[_0x4ae2('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize['ENUM'](_0x4ae2('0x30'),_0x4ae2('0x31'),_0x4ae2('0x32')),'defaultValue':'always'},'dialAMDActive':{'type':Sequelize[_0x4ae2('0x1d')],'defaultValue':0x0,'comment':_0x4ae2('0x33')},'dialAMDInitialSilence':{'type':Sequelize[_0x4ae2('0x14')](0x9)[_0x4ae2('0x21')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x4ae2('0x34')},'dialAMDGreeting':{'type':Sequelize[_0x4ae2('0x14')](0x9)[_0x4ae2('0x21')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x4ae2('0x35')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x4ae2('0x14')](0x9)[_0x4ae2('0x21')],'defaultValue':0x320,'validate':{'min':0x0},'comment':'#AMD\x20After\x20Greeting\x20Silence'},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x4ae2('0x14')](0x9)[_0x4ae2('0x21')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4ae2('0x36')},'dialAMDMinWordLength':{'type':Sequelize[_0x4ae2('0x14')](0x9)[_0x4ae2('0x21')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x4ae2('0x37')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x4ae2('0x14')](0x9)[_0x4ae2('0x21')],'defaultValue':0x32,'validate':{'min':0x0},'comment':'#AMD\x20Between\x20Words\x20Silence'},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x4ae2('0x14')](0x9)[_0x4ae2('0x21')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x4ae2('0x14')](0x5)[_0x4ae2('0x21')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':'#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)'},'dialAMDMaximumWordLength':{'type':Sequelize[_0x4ae2('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x4ae2('0x38')},'dialRecallMeTimeout':{'type':Sequelize['INTEGER'](0x5)[_0x4ae2('0x21')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x4ae2('0x39')},'dialRecallInQueue':{'type':Sequelize[_0x4ae2('0x1d')],'defaultValue':0x0,'comment':_0x4ae2('0x3a')},'dialOrderByScheduledAt':{'type':Sequelize[_0x4ae2('0x2')](_0x4ae2('0x3b'),_0x4ae2('0x3c')),'defaultValue':_0x4ae2('0x3b')},'dialQueueProject2':{'type':Sequelize[_0x4ae2('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize[_0x4ae2('0x1d')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x4ae2('0x1d')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Random\x20Last\x20Digit\x20(min:1,\x20max:15)'},'dialCutDigit':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x4ae2('0x3d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ae2('0x3e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x4ae2('0x14')](0x5)[_0x4ae2('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ae2('0x3f')},'dialDropMaxRetry':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ae2('0x40')},'dialDropRetryFrequency':{'type':Sequelize[_0x4ae2('0x14')](0x5)[_0x4ae2('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAbandonedMaxRetry':{'type':Sequelize[_0x4ae2('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ae2('0x41')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x4ae2('0x14')](0x5)[_0x4ae2('0x21')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ae2('0x42')},'dialMachineMaxRetry':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ae2('0x43')},'dialMachineRetryFrequency':{'type':Sequelize[_0x4ae2('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x4ae2('0x14')](0x3)[_0x4ae2('0x21')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x4ae2('0x44')},'dialAgentRejectRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x4ae2('0x45')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4ae2('0x14')],'allowNull':!![],'comment':_0x4ae2('0x46')},'mandatoryDisposition':{'type':Sequelize[_0x4ae2('0x1d')],'defaultValue':![],'comment':_0x4ae2('0x47'),'set':function(_0x4edaf3){if(!_0x4edaf3)this['setDataValue']('mandatoryDispositionPauseId',null);this[_0x4ae2('0x9')]('mandatoryDisposition',_0x4edaf3);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x4ae2('0x21')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x4ae2('0x21')],'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 7f59e9d..7a64058 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 _0x9db0=['userVoiceQueue:remove','addAgents','ids','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','scheduledAt','ListId','phone','NOW()','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','cm_hopper_final','COALESCE(phone,\x27\x27)','onlyIfOpen','deletedAt\x20IS\x20NULL','ContactId','phone\x20IS\x20NOT\x20NULL','all','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','get','inbound','QueueCampaigns','outbound','ignore','map','value','includes','find','destroy','then','error','stack','name','send','index','VoiceQueue','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','create','body','role','VoiceQueues','UserProfileSection','userProfileId','UserProfileResource','rawAttributes','omit','createdAt','updatedAt','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','findOne','CmHopper','rows','getHopperHistories','CmHopperHistory','VoiceQueueId','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','online','voicePause','interface','flatMap','forEach','sequelize','each','TeamVoiceQueue','upsert','penalty','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_voice_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','union','transaction','isEmpty','removeAgents'];(function(_0x5b8295,_0x1f1341){var _0x54f990=function(_0x27d1e1){while(--_0x27d1e1){_0x5b8295['push'](_0x5b8295['shift']());}};_0x54f990(++_0x1f1341);}(_0x9db0,0x19b));var _0x09db=function(_0x20fdab,_0x5618f0){_0x20fdab=_0x20fdab-0x0;var _0x188405=_0x9db0[_0x20fdab];return _0x188405;};'use strict';var emlformat=require(_0x09db('0x0'));var rimraf=require(_0x09db('0x1'));var zipdir=require(_0x09db('0x2'));var jsonpatch=require(_0x09db('0x3'));var rp=require(_0x09db('0x4'));var moment=require(_0x09db('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x09db('0x6'));var util=require(_0x09db('0x7'));var path=require('path');var sox=require(_0x09db('0x8'));var csv=require(_0x09db('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x09db('0xa'));var squel=require('squel');var crypto=require(_0x09db('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x09db('0xc'));var toCsv=require('to-csv');var querystring=require(_0x09db('0xd'));var Papa=require(_0x09db('0xe'));var Redis=require('ioredis');var authService=require(_0x09db('0xf'));var qs=require(_0x09db('0x10'));var as=require(_0x09db('0x11'));var hardwareService=require(_0x09db('0x12'));var logger=require('../../config/logger')(_0x09db('0x13'));var utils=require(_0x09db('0x14'));var config=require(_0x09db('0x15'));var licenseUtil=require(_0x09db('0x16'));var db=require('../../mysqldb')['db'];config[_0x09db('0x17')]=_[_0x09db('0x18')](config[_0x09db('0x17')],{'host':_0x09db('0x19'),'port':0x18eb});var socket=require(_0x09db('0x1a'))(new Redis(config[_0x09db('0x17')]));require(_0x09db('0x1b'))[_0x09db('0x1c')](socket);function respondWithStatusCode(_0x484531,_0x4533b0){_0x4533b0=_0x4533b0||0xcc;return function(_0x4939b0){if(_0x4939b0){return _0x484531[_0x09db('0x1d')](_0x4533b0);}return _0x484531[_0x09db('0x1e')](_0x4533b0)[_0x09db('0x1f')]();};}function respondWithResult(_0x59301f,_0x4eadbb){_0x4eadbb=_0x4eadbb||0xc8;return function(_0x2a9f59){if(_0x2a9f59){return _0x59301f[_0x09db('0x1e')](_0x4eadbb)[_0x09db('0x20')](_0x2a9f59);}};}function respondWithFilteredResult(_0x217d31,_0x27d657){return function(_0x4daad5){if(_0x4daad5){var _0x18a750=typeof _0x27d657[_0x09db('0x21')]===_0x09db('0x22')&&typeof _0x27d657[_0x09db('0x23')]===_0x09db('0x22');var _0x5ed9f8=_0x4daad5[_0x09db('0x24')];var _0xb66178=_0x18a750?0x0:_0x27d657[_0x09db('0x21')];var _0x349e4b=_0x18a750?_0x4daad5[_0x09db('0x24')]:_0x27d657[_0x09db('0x21')]+_0x27d657[_0x09db('0x23')];var _0x520a8b;if(_0x349e4b>=_0x5ed9f8){_0x349e4b=_0x5ed9f8;_0x520a8b=0xc8;}else{_0x520a8b=0xce;}_0x217d31[_0x09db('0x1e')](_0x520a8b);return _0x217d31[_0x09db('0x25')]('Content-Range',_0xb66178+'-'+_0x349e4b+'/'+_0x5ed9f8)['json'](_0x4daad5);}return null;};}function patchUpdates(_0x41a4ea){return function(_0x3c8c24){try{jsonpatch[_0x09db('0x26')](_0x3c8c24,_0x41a4ea,!![]);}catch(_0x2566c9){return BPromise[_0x09db('0x27')](_0x2566c9);}return _0x3c8c24[_0x09db('0x28')]();};}function saveUpdates(_0x20c190,_0x255399){return function(_0x15760d){if(_0x15760d){return _0x15760d['update'](_0x20c190)['then'](function(_0xc02f20){return _0xc02f20;});}return null;};}function removeEntity(_0x29167e,_0x1dd88a){return function(_0x233b01){if(_0x233b01){return _0x233b01['destroy']()['then'](function(){var _0x2d7795=_0x233b01[_0x09db('0x29')]({'plain':!![]});var _0x5f20b3=[{'name':'VoiceQueues','value':_0x09db('0x2a'),'ignore':![]},{'name':_0x09db('0x2b'),'value':_0x09db('0x2c'),'ignore':![]}];var _0x376200=_(_0x5f20b3)['filter'](_0x09db('0x2d'))[_0x09db('0x2e')](_0x09db('0x2f'))[_0x09db('0x2f')]();if(_[_0x09db('0x30')](_0x376200,_0x2d7795['type'])){return;}var _0xae52df=_[_0x09db('0x31')](_0x5f20b3,[_0x09db('0x2f'),_0x2d7795['type']])['name'];return db['UserProfileResource'][_0x09db('0x32')]({'where':{'type':_0xae52df,'resourceId':_0x2d7795['id']}})[_0x09db('0x33')](function(){return _0x233b01;});})[_0x09db('0x33')](function(){_0x29167e[_0x09db('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x50a977,_0x5deea9){return function(_0x52326c){if(!_0x52326c){_0x50a977[_0x09db('0x1d')](0x194);}return _0x52326c;};}function handleError(_0x4f2dd3,_0x2eb2de){_0x2eb2de=_0x2eb2de||0x1f4;return function(_0x1d717e){logger[_0x09db('0x34')](_0x1d717e[_0x09db('0x35')]);if(_0x1d717e[_0x09db('0x36')]){delete _0x1d717e[_0x09db('0x36')];}_0x4f2dd3[_0x09db('0x1e')](_0x2eb2de)[_0x09db('0x37')](_0x1d717e);};}exports[_0x09db('0x38')]=function(_0x19f466,_0x485ecf){var _0x53a1bd={},_0x1c4ba4={},_0x74d986={'count':0x0,'rows':[]};var _0x456a60=_[_0x09db('0x2e')](db[_0x09db('0x39')]['rawAttributes'],function(_0x3fc862){return{'name':_0x3fc862['fieldName'],'type':_0x3fc862[_0x09db('0x3a')]['key']};});_0x1c4ba4[_0x09db('0x3b')]=_[_0x09db('0x2e')](_0x456a60,_0x09db('0x36'));_0x1c4ba4[_0x09db('0x3c')]=_[_0x09db('0x3d')](_0x19f466['query']);_0x1c4ba4[_0x09db('0x3e')]=_[_0x09db('0x3f')](_0x1c4ba4['model'],_0x1c4ba4[_0x09db('0x3c')]);_0x53a1bd[_0x09db('0x40')]=_['intersection'](_0x1c4ba4['model'],qs[_0x09db('0x41')](_0x19f466[_0x09db('0x3c')][_0x09db('0x41')]));_0x53a1bd[_0x09db('0x40')]=_0x53a1bd[_0x09db('0x40')][_0x09db('0x42')]?_0x53a1bd[_0x09db('0x40')]:_0x1c4ba4[_0x09db('0x3b')];if(!_0x19f466[_0x09db('0x3c')][_0x09db('0x43')](_0x09db('0x44'))){_0x53a1bd[_0x09db('0x23')]=qs[_0x09db('0x23')](_0x19f466[_0x09db('0x3c')][_0x09db('0x23')]);_0x53a1bd[_0x09db('0x21')]=qs['offset'](_0x19f466['query']['offset']);}_0x53a1bd[_0x09db('0x45')]=qs[_0x09db('0x46')](_0x19f466[_0x09db('0x3c')][_0x09db('0x46')]);_0x53a1bd['where']=qs[_0x09db('0x3e')](_[_0x09db('0x47')](_0x19f466[_0x09db('0x3c')],_0x1c4ba4[_0x09db('0x3e')]),_0x456a60);if(_0x19f466[_0x09db('0x3c')][_0x09db('0x48')]){_0x53a1bd[_0x09db('0x49')]=_[_0x09db('0x4a')](_0x53a1bd['where'],{'$or':_[_0x09db('0x2e')](_0x456a60,function(_0x4c6ea8){if(_0x4c6ea8['type']!==_0x09db('0x4b')){var _0x5a62b7={};_0x5a62b7[_0x4c6ea8[_0x09db('0x36')]]={'$like':'%'+_0x19f466[_0x09db('0x3c')]['filter']+'%'};return _0x5a62b7;}})});}_0x53a1bd=_[_0x09db('0x4a')]({},_0x53a1bd,_0x19f466[_0x09db('0x4c')]);var _0x49b1f4={'where':_0x53a1bd[_0x09db('0x49')]};return db[_0x09db('0x39')][_0x09db('0x24')](_0x49b1f4)[_0x09db('0x33')](function(_0x3bdddd){_0x74d986['count']=_0x3bdddd;if(_0x19f466[_0x09db('0x3c')][_0x09db('0x4d')]){_0x53a1bd[_0x09db('0x4e')]=[{'all':!![]}];}return db['VoiceQueue'][_0x09db('0x4f')](_0x53a1bd);})[_0x09db('0x33')](function(_0x25a632){_0x74d986['rows']=_0x25a632;return _0x74d986;})[_0x09db('0x33')](respondWithFilteredResult(_0x485ecf,_0x53a1bd))[_0x09db('0x50')](handleError(_0x485ecf,null));};exports[_0x09db('0x51')]=function(_0x3d06d9,_0x2a5faa){var _0x4e7fd1={'raw':![],'where':{'id':_0x3d06d9[_0x09db('0x52')]['id']}},_0x369727={};_0x369727[_0x09db('0x3b')]=_[_0x09db('0x3d')](db[_0x09db('0x39')]['rawAttributes']);_0x369727[_0x09db('0x3c')]=_[_0x09db('0x3d')](_0x3d06d9[_0x09db('0x3c')]);_0x369727[_0x09db('0x3e')]=_[_0x09db('0x3f')](_0x369727['model'],_0x369727[_0x09db('0x3c')]);_0x4e7fd1[_0x09db('0x40')]=_[_0x09db('0x3f')](_0x369727[_0x09db('0x3b')],qs[_0x09db('0x41')](_0x3d06d9[_0x09db('0x3c')][_0x09db('0x41')]));_0x4e7fd1[_0x09db('0x40')]=_0x4e7fd1[_0x09db('0x40')][_0x09db('0x42')]?_0x4e7fd1[_0x09db('0x40')]:_0x369727['model'];if(_0x3d06d9[_0x09db('0x3c')][_0x09db('0x4d')]){_0x4e7fd1[_0x09db('0x4e')]=[{'all':!![]}];}_0x4e7fd1=_[_0x09db('0x4a')]({},_0x4e7fd1,_0x3d06d9[_0x09db('0x4c')]);return db[_0x09db('0x39')]['find'](_0x4e7fd1)[_0x09db('0x33')](handleEntityNotFound(_0x2a5faa,null))[_0x09db('0x33')](respondWithResult(_0x2a5faa,null))[_0x09db('0x50')](handleError(_0x2a5faa,null));};exports[_0x09db('0x53')]=function(_0x30d65e,_0x6be71d){return db['VoiceQueue'][_0x09db('0x53')](_0x30d65e[_0x09db('0x54')],{})['then'](function(_0x2b8182){var _0x462281=_0x30d65e['user'][_0x09db('0x29')]({'plain':!![]});if(!_0x462281)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x462281[_0x09db('0x55')]==='user'){var _0x564bf6=_0x2b8182[_0x09db('0x29')]({'plain':!![]});var _0x5d7790=[{'name':_0x09db('0x56'),'value':_0x09db('0x2a')},{'name':_0x09db('0x2b'),'value':_0x09db('0x2c')}];var _0x40548a=_[_0x09db('0x31')](_0x5d7790,[_0x09db('0x2f'),_0x564bf6[_0x09db('0x3a')]])[_0x09db('0x36')];return db[_0x09db('0x57')][_0x09db('0x31')]({'where':{'name':_0x40548a,'userProfileId':_0x462281[_0x09db('0x58')]},'raw':!![]})[_0x09db('0x33')](function(_0xcfa357){if(_0xcfa357&&_0xcfa357['autoAssociation']===0x0){return db[_0x09db('0x59')][_0x09db('0x53')]({'name':_0x564bf6[_0x09db('0x36')],'resourceId':_0x564bf6['id'],'type':_0xcfa357[_0x09db('0x36')],'sectionId':_0xcfa357['id']},{})[_0x09db('0x33')](function(){return _0x2b8182;});}else{return _0x2b8182;}})[_0x09db('0x50')](function(_0x43baa9){logger[_0x09db('0x34')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43baa9);throw _0x43baa9;});}return _0x2b8182;})[_0x09db('0x33')](respondWithResult(_0x6be71d,0xc9))[_0x09db('0x50')](handleError(_0x6be71d,null));};exports['clone']=function(_0x4bf154,_0xa419bd){var _0x41e4b8={'where':{'id':_0x4bf154['params']['id']}},_0x280467={};_0x280467[_0x09db('0x3b')]=_[_0x09db('0x3d')](db['VoiceQueue'][_0x09db('0x5a')]);_0x41e4b8[_0x09db('0x40')]=_[_0x09db('0x3f')](_0x280467[_0x09db('0x3b')],qs[_0x09db('0x41')](_0x4bf154[_0x09db('0x3c')][_0x09db('0x41')]));_0x41e4b8[_0x09db('0x40')]=_0x41e4b8['attributes'][_0x09db('0x42')]?_0x41e4b8['attributes']:_0x280467[_0x09db('0x3b')];if(_0x4bf154[_0x09db('0x3c')]['includeAll']){_0x41e4b8[_0x09db('0x4e')]=[{'all':!![]}];}_0x41e4b8=_['merge']({},_0x41e4b8,_0x4bf154[_0x09db('0x4c')]);return db[_0x09db('0x39')]['find'](_0x41e4b8)[_0x09db('0x33')](handleEntityNotFound(_0xa419bd,null))[_0x09db('0x33')](function(_0x349892){if(_0x349892){var _0x5f1973=_0x349892[_0x09db('0x29')]({'plain':!![]});_0x5f1973=qs[_0x09db('0x5b')](_0x5f1973,['id',_0x09db('0x5c'),_0x09db('0x5d')]);_0x4bf154['body']=_['omit'](_0x4bf154[_0x09db('0x54')],['id',_0x09db('0x5c'),_0x09db('0x5d')]);return db['VoiceQueue'][_0x09db('0x53')](_[_0x09db('0x4a')](_0x5f1973,_0x4bf154[_0x09db('0x54')]),{'include':_0x4bf154[_0x09db('0x3c')][_0x09db('0x4d')]?[{'all':!![]}]:undefined})[_0x09db('0x33')](function(_0x52afe6){var _0x319b97=_0x4bf154['user']['get']({'plain':!![]});if(!_0x319b97)throw new Error(_0x09db('0x5e'));if(_0x319b97[_0x09db('0x55')]===_0x09db('0x5f')){var _0x5dc69b=_0x52afe6['get']({'plain':!![]});var _0x4707f6=[{'name':_0x09db('0x56'),'value':_0x09db('0x2a')},{'name':_0x09db('0x2b'),'value':_0x09db('0x2c')}];var _0x5298ed=_[_0x09db('0x31')](_0x4707f6,[_0x09db('0x2f'),_0x5dc69b[_0x09db('0x3a')]])['name'];return db[_0x09db('0x57')]['find']({'where':{'name':_0x5298ed,'userProfileId':_0x319b97[_0x09db('0x58')]},'raw':!![]})['then'](function(_0x3a81ec){if(_0x3a81ec&&_0x3a81ec[_0x09db('0x60')]===0x0){return db[_0x09db('0x59')][_0x09db('0x53')]({'name':_0x5dc69b[_0x09db('0x36')],'resourceId':_0x5dc69b['id'],'type':_0x3a81ec[_0x09db('0x36')],'sectionId':_0x3a81ec['id']},{})[_0x09db('0x33')](function(){return _0x52afe6;});}else{return _0x52afe6;}})['catch'](function(_0x8792d5){logger[_0x09db('0x34')](_0x09db('0x61'),_0x8792d5);throw _0x8792d5;});}return _0x52afe6;});}})['then'](respondWithResult(_0xa419bd,0xc9))[_0x09db('0x50')](handleError(_0xa419bd,null));};exports['update']=function(_0x39b2de,_0x34711f){if(_0x39b2de[_0x09db('0x54')]['id']){delete _0x39b2de[_0x09db('0x54')]['id'];}return db[_0x09db('0x39')]['find']({'where':{'id':_0x39b2de[_0x09db('0x52')]['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x34711f,null))[_0x09db('0x33')](saveUpdates(_0x39b2de['body'],null))[_0x09db('0x33')](respondWithResult(_0x34711f,null))[_0x09db('0x50')](handleError(_0x34711f,null));};exports[_0x09db('0x32')]=function(_0x127310,_0x230fae){return db[_0x09db('0x39')][_0x09db('0x31')]({'where':{'id':_0x127310[_0x09db('0x52')]['id']}})['then'](handleEntityNotFound(_0x230fae,null))[_0x09db('0x33')](removeEntity(_0x230fae,null))['catch'](handleError(_0x230fae,null));};exports['getHoppers']=function(_0x1dbd4a,_0xd358d6,_0x4c89cc){var _0x5eaa0e={'raw':![],'where':{}};var _0x1e5406={};var _0x59a23f={'count':0x0,'rows':[]};return db[_0x09db('0x39')][_0x09db('0x62')]({'where':{'id':_0x1dbd4a['params']['id']}})['then'](handleEntityNotFound(_0xd358d6,null))[_0x09db('0x33')](function(_0x3d6414){if(_0x3d6414){_0x1e5406[_0x09db('0x3b')]=_[_0x09db('0x3d')](db['CmHopper'][_0x09db('0x5a')]);_0x1e5406[_0x09db('0x3c')]=_[_0x09db('0x3d')](_0x1dbd4a['query']);_0x1e5406[_0x09db('0x3e')]=_[_0x09db('0x3f')](_0x1e5406[_0x09db('0x3b')],_0x1e5406[_0x09db('0x3c')]);_0x5eaa0e['attributes']=_[_0x09db('0x3f')](_0x1e5406[_0x09db('0x3b')],qs[_0x09db('0x41')](_0x1dbd4a[_0x09db('0x3c')][_0x09db('0x41')]));_0x5eaa0e[_0x09db('0x40')]=_0x5eaa0e[_0x09db('0x40')][_0x09db('0x42')]?_0x5eaa0e[_0x09db('0x40')]:_0x1e5406[_0x09db('0x3b')];if(!_0x1dbd4a[_0x09db('0x3c')][_0x09db('0x43')]('nolimit')){_0x5eaa0e[_0x09db('0x23')]=qs[_0x09db('0x23')](_0x1dbd4a[_0x09db('0x3c')][_0x09db('0x23')]);_0x5eaa0e[_0x09db('0x21')]=qs['offset'](_0x1dbd4a[_0x09db('0x3c')][_0x09db('0x21')]);}_0x5eaa0e[_0x09db('0x45')]=qs[_0x09db('0x46')](_0x1dbd4a[_0x09db('0x3c')]['sort']);_0x5eaa0e[_0x09db('0x49')]=qs[_0x09db('0x3e')](_['pick'](_0x1dbd4a[_0x09db('0x3c')],_0x1e5406[_0x09db('0x3e')]));_0x5eaa0e[_0x09db('0x49')]['VoiceQueueId']=_0x3d6414['id'];if(_0x1dbd4a[_0x09db('0x3c')][_0x09db('0x48')]){_0x5eaa0e[_0x09db('0x49')]=_['merge'](_0x5eaa0e['where'],{'$or':_[_0x09db('0x2e')](_0x5eaa0e[_0x09db('0x40')],function(_0x231d54){var _0xa29c7a={};_0xa29c7a[_0x231d54]={'$like':'%'+_0x1dbd4a['query'][_0x09db('0x48')]+'%'};return _0xa29c7a;})});}_0x5eaa0e=_[_0x09db('0x4a')]({},_0x5eaa0e,_0x1dbd4a[_0x09db('0x4c')]);return db[_0x09db('0x63')][_0x09db('0x24')]({'where':_0x5eaa0e[_0x09db('0x49')]})[_0x09db('0x33')](function(_0x325fd4){_0x59a23f['count']=_0x325fd4;if(_0x1dbd4a[_0x09db('0x3c')]['includeAll']){_0x5eaa0e['include']=[{'all':!![]}];}return db[_0x09db('0x63')][_0x09db('0x4f')](_0x5eaa0e);})['then'](function(_0x54a12b){_0x59a23f[_0x09db('0x64')]=_0x54a12b;return _0x59a23f;});}})[_0x09db('0x33')](respondWithFilteredResult(_0xd358d6,_0x5eaa0e))[_0x09db('0x50')](handleError(_0xd358d6,null));};exports[_0x09db('0x65')]=function(_0x58bc18,_0x51e2e1,_0x3dc957){var _0x549463={'raw':!![],'where':{}};var _0x704417={};var _0x1f1c15={'count':0x0,'rows':[]};return db[_0x09db('0x39')][_0x09db('0x62')]({'where':{'id':_0x58bc18['params']['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x51e2e1,null))[_0x09db('0x33')](function(_0xa30098){if(_0xa30098){_0x704417[_0x09db('0x3b')]=_['keys'](db[_0x09db('0x66')]['rawAttributes']);_0x704417[_0x09db('0x3c')]=_['keys'](_0x58bc18[_0x09db('0x3c')]);_0x704417[_0x09db('0x3e')]=_[_0x09db('0x3f')](_0x704417[_0x09db('0x3b')],_0x704417[_0x09db('0x3c')]);_0x549463['attributes']=_[_0x09db('0x3f')](_0x704417['model'],qs[_0x09db('0x41')](_0x58bc18[_0x09db('0x3c')][_0x09db('0x41')]));_0x549463[_0x09db('0x40')]=_0x549463[_0x09db('0x40')]['length']?_0x549463[_0x09db('0x40')]:_0x704417[_0x09db('0x3b')];if(!_0x58bc18['query'][_0x09db('0x43')]('nolimit')){_0x549463[_0x09db('0x23')]=qs['limit'](_0x58bc18[_0x09db('0x3c')][_0x09db('0x23')]);_0x549463[_0x09db('0x21')]=qs[_0x09db('0x21')](_0x58bc18[_0x09db('0x3c')][_0x09db('0x21')]);}_0x549463[_0x09db('0x45')]=qs[_0x09db('0x46')](_0x58bc18['query'][_0x09db('0x46')]);_0x549463[_0x09db('0x49')]=qs[_0x09db('0x3e')](_[_0x09db('0x47')](_0x58bc18[_0x09db('0x3c')],_0x704417['filters']));_0x549463['where'][_0x09db('0x67')]=_0xa30098['id'];if(_0x58bc18['query']['filter']){_0x549463['where']=_['merge'](_0x549463['where'],{'$or':_[_0x09db('0x2e')](_0x549463['attributes'],function(_0x41bf23){var _0x8fa071={};_0x8fa071[_0x41bf23]={'$like':'%'+_0x58bc18[_0x09db('0x3c')][_0x09db('0x48')]+'%'};return _0x8fa071;})});}_0x549463=_['merge']({},_0x549463,_0x58bc18['options']);return db[_0x09db('0x66')]['count']({'where':_0x549463[_0x09db('0x49')]})[_0x09db('0x33')](function(_0x40edf0){_0x1f1c15['count']=_0x40edf0;if(_0x58bc18[_0x09db('0x3c')][_0x09db('0x4d')]){_0x549463[_0x09db('0x4e')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x09db('0x4f')](_0x549463);})['then'](function(_0x3fc76a){_0x1f1c15[_0x09db('0x64')]=_0x3fc76a;return _0x1f1c15;});}})[_0x09db('0x33')](respondWithFilteredResult(_0x51e2e1,_0x549463))[_0x09db('0x50')](handleError(_0x51e2e1,null));};exports[_0x09db('0x68')]=function(_0x71d611,_0x29c6c5,_0x41d2ce){var _0x1e4328={'raw':!![],'where':{}};var _0x1c203c={};var _0x5003eb={'count':0x0,'rows':[]};return db['VoiceQueue'][_0x09db('0x62')]({'where':{'id':_0x71d611[_0x09db('0x52')]['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x29c6c5,null))[_0x09db('0x33')](function(_0xa077c5){if(_0xa077c5){_0x1c203c[_0x09db('0x3b')]=_[_0x09db('0x3d')](db[_0x09db('0x69')]['rawAttributes']);_0x1c203c[_0x09db('0x3c')]=_[_0x09db('0x3d')](_0x71d611['query']);_0x1c203c[_0x09db('0x3e')]=_['intersection'](_0x1c203c['model'],_0x1c203c[_0x09db('0x3c')]);_0x1e4328[_0x09db('0x40')]=_[_0x09db('0x3f')](_0x1c203c[_0x09db('0x3b')],qs[_0x09db('0x41')](_0x71d611[_0x09db('0x3c')][_0x09db('0x41')]));_0x1e4328[_0x09db('0x40')]=_0x1e4328[_0x09db('0x40')]['length']?_0x1e4328['attributes']:_0x1c203c[_0x09db('0x3b')];if(!_0x71d611[_0x09db('0x3c')][_0x09db('0x43')](_0x09db('0x44'))){_0x1e4328[_0x09db('0x23')]=qs[_0x09db('0x23')](_0x71d611[_0x09db('0x3c')]['limit']);_0x1e4328[_0x09db('0x21')]=qs['offset'](_0x71d611[_0x09db('0x3c')][_0x09db('0x21')]);}_0x1e4328[_0x09db('0x45')]=qs[_0x09db('0x46')](_0x71d611[_0x09db('0x3c')][_0x09db('0x46')]);_0x1e4328['where']=qs[_0x09db('0x3e')](_[_0x09db('0x47')](_0x71d611[_0x09db('0x3c')],_0x1c203c['filters']));_0x1e4328[_0x09db('0x49')][_0x09db('0x67')]=_0xa077c5['id'];if(_0x71d611[_0x09db('0x3c')]['filter']){_0x1e4328[_0x09db('0x49')]=_['merge'](_0x1e4328[_0x09db('0x49')],{'$or':_[_0x09db('0x2e')](_0x1e4328['attributes'],function(_0x5169d6){var _0x3b341f={};_0x3b341f[_0x5169d6]={'$like':'%'+_0x71d611[_0x09db('0x3c')][_0x09db('0x48')]+'%'};return _0x3b341f;})});}_0x1e4328=_[_0x09db('0x4a')]({},_0x1e4328,_0x71d611['options']);return db[_0x09db('0x69')][_0x09db('0x24')]({'where':_0x1e4328[_0x09db('0x49')]})[_0x09db('0x33')](function(_0x2b111e){_0x5003eb[_0x09db('0x24')]=_0x2b111e;if(_0x71d611[_0x09db('0x3c')][_0x09db('0x4d')]){_0x1e4328['include']=[{'all':!![]}];}return db[_0x09db('0x69')][_0x09db('0x4f')](_0x1e4328);})[_0x09db('0x33')](function(_0x1c42f9){_0x5003eb['rows']=_0x1c42f9;return _0x5003eb;});}})[_0x09db('0x33')](respondWithFilteredResult(_0x29c6c5,_0x1e4328))[_0x09db('0x50')](handleError(_0x29c6c5,null));};exports[_0x09db('0x6a')]=function(_0x48c193,_0x2c12a6,_0x4bde51){var _0x754dbf={'raw':!![],'where':{}};var _0x43598b={};var _0x5e2669={'count':0x0,'rows':[]};return db[_0x09db('0x39')][_0x09db('0x62')]({'where':{'id':_0x48c193[_0x09db('0x52')]['id']}})['then'](handleEntityNotFound(_0x2c12a6,null))[_0x09db('0x33')](function(_0x5f34af){if(_0x5f34af){_0x43598b[_0x09db('0x3b')]=_[_0x09db('0x3d')](db[_0x09db('0x6b')][_0x09db('0x5a')]);_0x43598b['query']=_['keys'](_0x48c193[_0x09db('0x3c')]);_0x43598b['filters']=_['intersection'](_0x43598b[_0x09db('0x3b')],_0x43598b[_0x09db('0x3c')]);_0x754dbf[_0x09db('0x40')]=_[_0x09db('0x3f')](_0x43598b[_0x09db('0x3b')],qs[_0x09db('0x41')](_0x48c193[_0x09db('0x3c')][_0x09db('0x41')]));_0x754dbf[_0x09db('0x40')]=_0x754dbf[_0x09db('0x40')][_0x09db('0x42')]?_0x754dbf[_0x09db('0x40')]:_0x43598b['model'];if(!_0x48c193[_0x09db('0x3c')][_0x09db('0x43')]('nolimit')){_0x754dbf[_0x09db('0x23')]=qs['limit'](_0x48c193[_0x09db('0x3c')][_0x09db('0x23')]);_0x754dbf[_0x09db('0x21')]=qs[_0x09db('0x21')](_0x48c193['query']['offset']);}_0x754dbf[_0x09db('0x45')]=qs[_0x09db('0x46')](_0x48c193['query'][_0x09db('0x46')]);_0x754dbf[_0x09db('0x49')]=qs[_0x09db('0x3e')](_[_0x09db('0x47')](_0x48c193['query'],_0x43598b[_0x09db('0x3e')]));_0x754dbf[_0x09db('0x49')][_0x09db('0x67')]=_0x5f34af['id'];if(_0x48c193['query']['filter']){_0x754dbf['where']=_['merge'](_0x754dbf[_0x09db('0x49')],{'$or':_[_0x09db('0x2e')](_0x754dbf['attributes'],function(_0xe76639){var _0x408194={};_0x408194[_0xe76639]={'$like':'%'+_0x48c193[_0x09db('0x3c')][_0x09db('0x48')]+'%'};return _0x408194;})});}_0x754dbf=_['merge']({},_0x754dbf,_0x48c193[_0x09db('0x4c')]);return db[_0x09db('0x6b')][_0x09db('0x24')]({'where':_0x754dbf[_0x09db('0x49')]})[_0x09db('0x33')](function(_0x5cdac3){_0x5e2669[_0x09db('0x24')]=_0x5cdac3;if(_0x48c193['query'][_0x09db('0x4d')]){_0x754dbf[_0x09db('0x4e')]=[{'all':!![]}];}return db[_0x09db('0x6b')][_0x09db('0x4f')](_0x754dbf);})[_0x09db('0x33')](function(_0x4b1aee){_0x5e2669['rows']=_0x4b1aee;return _0x5e2669;});}})[_0x09db('0x33')](respondWithFilteredResult(_0x2c12a6,_0x754dbf))[_0x09db('0x50')](handleError(_0x2c12a6,null));};exports[_0x09db('0x6c')]=function(_0x4b810c,_0x1d0670,_0x158981){var _0x1e03e8={};var _0x5c68d0={};var _0x14059e;var _0x651e6a;return db['VoiceQueue']['findOne']({'where':{'id':_0x4b810c[_0x09db('0x52')]['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x1d0670,null))[_0x09db('0x33')](function(_0x52868d){if(_0x52868d){_0x14059e=_0x52868d;_0x5c68d0[_0x09db('0x3b')]=_['keys'](db['Team']['rawAttributes']);_0x5c68d0[_0x09db('0x3c')]=_[_0x09db('0x3d')](_0x4b810c[_0x09db('0x3c')]);_0x5c68d0[_0x09db('0x3e')]=_[_0x09db('0x3f')](_0x5c68d0[_0x09db('0x3b')],_0x5c68d0[_0x09db('0x3c')]);_0x1e03e8[_0x09db('0x40')]=_[_0x09db('0x3f')](_0x5c68d0['model'],qs['fields'](_0x4b810c[_0x09db('0x3c')][_0x09db('0x41')]));_0x1e03e8[_0x09db('0x40')]=_0x1e03e8[_0x09db('0x40')][_0x09db('0x42')]?_0x1e03e8[_0x09db('0x40')]:_0x5c68d0[_0x09db('0x3b')];_0x1e03e8[_0x09db('0x45')]=qs[_0x09db('0x46')](_0x4b810c['query'][_0x09db('0x46')]);_0x1e03e8[_0x09db('0x49')]=qs[_0x09db('0x3e')](_[_0x09db('0x47')](_0x4b810c[_0x09db('0x3c')],_0x5c68d0['filters']));if(_0x4b810c['query']['filter']){_0x1e03e8['where']=_[_0x09db('0x4a')](_0x1e03e8[_0x09db('0x49')],{'$or':_['map'](_0x1e03e8[_0x09db('0x40')],function(_0x25d295){var _0x2b5dd1={};_0x2b5dd1[_0x25d295]={'$like':'%'+_0x4b810c['query'][_0x09db('0x48')]+'%'};return _0x2b5dd1;})});}_0x1e03e8=_[_0x09db('0x4a')]({},_0x1e03e8,_0x4b810c[_0x09db('0x4c')]);return _0x14059e[_0x09db('0x6c')](_0x1e03e8);}})[_0x09db('0x33')](function(_0x3c5f17){if(_0x3c5f17){_0x651e6a=_0x3c5f17[_0x09db('0x42')];if(!_0x4b810c[_0x09db('0x3c')][_0x09db('0x43')]('nolimit')){_0x1e03e8[_0x09db('0x23')]=qs[_0x09db('0x23')](_0x4b810c[_0x09db('0x3c')]['limit']);_0x1e03e8[_0x09db('0x21')]=qs[_0x09db('0x21')](_0x4b810c[_0x09db('0x3c')]['offset']);}return _0x14059e[_0x09db('0x6c')](_0x1e03e8);}})[_0x09db('0x33')](function(_0x39a8c0){if(_0x39a8c0){return _0x39a8c0?{'count':_0x651e6a,'rows':_0x39a8c0}:null;}})[_0x09db('0x33')](respondWithResult(_0x1d0670,null))[_0x09db('0x50')](handleError(_0x1d0670,null));};exports[_0x09db('0x6d')]=function(_0x58ee93,_0x269c98,_0x346865){var _0x5d2418=_0x58ee93['body'][_0x09db('0x6e')];var _0x21ca2c=_[_0x09db('0x2e')](_0x5d2418,'id');return db[_0x09db('0x6f')]['findAll']({'where':{'id':_0x21ca2c},'attributes':['id'],'include':[{'model':db[_0x09db('0x70')],'as':_0x09db('0x71'),'attributes':['id',_0x09db('0x36'),_0x09db('0x72'),_0x09db('0x73'),_0x09db('0x74')],'raw':!![]}]})['then'](function(_0x32966b){if(_0x32966b){var _0x2081f2=_[_0x09db('0x75')](_0x32966b,function(_0x545ec6){var _0x5b5c5c=_0x545ec6['get']({'plain':!![]});_0x5b5c5c[_0x09db('0x71')][_0x09db('0x76')](function(_0x300b85){_0x300b85['penalty']=_[_0x09db('0x31')](_0x5d2418,{'id':_0x5b5c5c['id']})['penalty'];});return _0x5b5c5c[_0x09db('0x71')];});return db[_0x09db('0x39')]['find']({'where':{'id':_0x58ee93[_0x09db('0x52')]['id']}})['then'](function(_0x7e8b5d){return db[_0x09db('0x77')]['transaction'](function(_0x12e57f){return _0x7e8b5d['addTeams'](_0x21ca2c,{'transaction':_0x12e57f})['then'](function(){return BPromise[_0x09db('0x78')](_0x5d2418,function(_0x1084f1){return db[_0x09db('0x79')][_0x09db('0x7a')]({'TeamId':_0x1084f1['id'],'VoiceQueueId':_0x58ee93['params']['id'],'penalty':_0x1084f1[_0x09db('0x7b')]},{'transaction':_0x12e57f});});})[_0x09db('0x33')](function(){return BPromise[_0x09db('0x78')](_0x2081f2,function(_0x4498b5){return db['UserVoiceQueue'][_0x09db('0x7c')]({'where':{'UserId':_0x4498b5['id'],'VoiceQueueId':_0x58ee93[_0x09db('0x52')]['id']},'defaults':{'penalty':_0x4498b5[_0x09db('0x7b')]},'transaction':_0x12e57f});});})[_0x09db('0x33')](function(){return BPromise[_0x09db('0x78')](_[_0x09db('0x48')](_0x2081f2,{'online':!![]}),function(_0x4ce3d6){return db[_0x09db('0x7d')][_0x09db('0x7a')]({'membername':_0x4ce3d6[_0x09db('0x36')],'UserId':_0x4ce3d6['id'],'queue_name':_0x7e8b5d[_0x09db('0x36')],'VoiceQueueId':_0x7e8b5d['id'],'interface':_[_0x09db('0x7e')](_0x4ce3d6['interface'])?util[_0x09db('0x7f')](_0x09db('0x80'),_0x4ce3d6[_0x09db('0x36')]):_0x4ce3d6[_0x09db('0x74')],'paused':_0x4ce3d6['voicePause']||![],'penalty':_0x4ce3d6[_0x09db('0x7b')]},{'transaction':_0x12e57f});});})[_0x09db('0x33')](function(){_0x2081f2[_0x09db('0x76')](function(_0x26ded6){socket[_0x09db('0x81')](_0x09db('0x82'),{'UserId':_0x26ded6['id'],'VoiceQueueId':_0x7e8b5d['id']});});});});});}})[_0x09db('0x33')](respondWithStatusCode(_0x269c98,null))[_0x09db('0x50')](handleError(_0x269c98,null));};exports[_0x09db('0x83')]=function(_0x86e953,_0x2c7d08,_0x4b6967){return db[_0x09db('0x6f')][_0x09db('0x4f')]({'where':{'id':_0x86e953['query']['ids']},'attributes':['id'],'include':[{'model':db[_0x09db('0x70')],'as':_0x09db('0x71'),'attributes':['id'],'raw':!![]}]})[_0x09db('0x33')](handleEntityNotFound(_0x2c7d08,null))[_0x09db('0x33')](function(_0xa0960){var _0xdb7297=_[_0x09db('0x2e')](_0xa0960,'id');var _0x4b44ac=[];var _0x530f63=[];var _0x53377e=squel[_0x09db('0x84')]();_0x53377e[_0x09db('0x85')](_0x09db('0x86'))[_0x09db('0x87')](_0x09db('0x88'),'tq')[_0x09db('0x89')](_0x09db('0x8a'),'ut',_0x09db('0x8b'))[_0x09db('0x49')](_0x09db('0x8c'),_0x86e953[_0x09db('0x52')]['id']);for(var _0x4e763f=0x0;_0x4e763f<_0xa0960[_0x09db('0x42')];_0x4e763f+=0x1){let _0x5ebb0a=_0xa0960[_0x4e763f];for(var _0x436c87=0x0;_0x436c87<_0x5ebb0a[_0x09db('0x71')][_0x09db('0x42')];_0x436c87+=0x1){let _0x33d04f=_0x5ebb0a[_0x09db('0x71')][_0x436c87];var _0x171a19=_0x53377e['clone']();_0x171a19[_0x09db('0x49')]('ut.UserId\x20=\x20?',_0x33d04f['id']);_0x530f63[_0x09db('0x8d')](db[_0x09db('0x77')]['query'](_0x171a19['toString'](),{'type':db[_0x09db('0x77')][_0x09db('0x8e')][_0x09db('0x8f')]})['then'](function(_0x162889){if(_0x162889[_0x09db('0x42')]===0x1){return _0x33d04f['id'];}else{var _0x2b261d=_[_0x09db('0x90')](_[_0x09db('0x2e')](_0x162889,_0x09db('0x91')),function(_0x3bdd6f){return _[_0x09db('0x30')](_0xdb7297,_0x3bdd6f);});if(_0x2b261d){return _0x33d04f['id'];}}}));}}return BPromise['all'](_0x530f63)['then'](function(_0x102898){_0x4b44ac=_(_0x4b44ac)[_0x09db('0x92')](_0x102898)['compact']()[_0x09db('0x2f')]();return db['VoiceQueue'][_0x09db('0x31')]({'where':{'id':_0x86e953['params']['id']}})[_0x09db('0x33')](function(_0x4154b3){return db[_0x09db('0x77')][_0x09db('0x93')](function(_0x1b9d6b){return _0x4154b3['removeTeams'](_0x86e953[_0x09db('0x3c')]['ids'],{'transaction':_0x1b9d6b})[_0x09db('0x33')](function(){if(!_[_0x09db('0x94')](_0x4b44ac)){return _0x4154b3[_0x09db('0x95')](_0x4b44ac,{'transaction':_0x1b9d6b})[_0x09db('0x33')](function(){return db[_0x09db('0x7d')][_0x09db('0x32')]({'where':{'VoiceQueueId':_0x86e953['params']['id'],'UserId':_0x4b44ac},'transaction':_0x1b9d6b});});}})[_0x09db('0x33')](function(){_0x4b44ac['forEach'](function(_0x4edc8f){socket[_0x09db('0x81')](_0x09db('0x96'),{'UserId':_0x4edc8f,'VoiceQueueId':_0x4154b3['id']});});});});});});})[_0x09db('0x33')](respondWithStatusCode(_0x2c7d08,null))[_0x09db('0x50')](handleError(_0x2c7d08,null));};exports[_0x09db('0x97')]=function(_0x2e1cc5,_0x34357d,_0x56b63d){var _0xcc1272,_0x3488e8;return db[_0x09db('0x39')][_0x09db('0x31')]({'where':{'id':_0x2e1cc5['params']['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x34357d,null))[_0x09db('0x33')](function(_0x2574ea){if(_0x2574ea){_0x3488e8=_0x2574ea;return _0x2574ea[_0x09db('0x97')](_0x2e1cc5[_0x09db('0x54')]['ids'],_[_0x09db('0x5b')](_0x2e1cc5['body'],['ids','id'])||{})['spread'](function(_0xa2de6c){for(var _0x2bdd6c=0x0;_0x2bdd6c<_0x2e1cc5[_0x09db('0x54')][_0x09db('0x98')][_0x09db('0x42')];_0x2bdd6c+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x2e1cc5['body'][_0x09db('0x98')][_0x2bdd6c]),'VoiceQueueId':Number(_0x2e1cc5['params']['id'])});}return _0xa2de6c;});}})[_0x09db('0x33')](function(_0x5b3da1){_0xcc1272=_0x5b3da1||[];if(_0x3488e8){return db[_0x09db('0x70')][_0x09db('0x4f')]({'where':{'id':_0x2e1cc5[_0x09db('0x54')]['ids']},'attributes':['id','name',_0x09db('0x72'),_0x09db('0x73'),'interface'],'raw':!![]});}})[_0x09db('0x33')](function(_0x5ba495){if(!_[_0x09db('0x94')](_0x5ba495)){var _0x176bfa=[];for(var _0x168f69=0x0;_0x168f69<_0x5ba495[_0x09db('0x42')];_0x168f69++){if(_0x5ba495[_0x168f69][_0x09db('0x72')]){_0x176bfa['push'](db['UserVoiceQueueRt'][_0x09db('0x7a')]({'membername':_0x5ba495[_0x168f69][_0x09db('0x36')],'UserId':_0x5ba495[_0x168f69]['id'],'queue_name':_0x3488e8[_0x09db('0x36')],'VoiceQueueId':_0x3488e8['id'],'interface':_[_0x09db('0x7e')](_0x5ba495[_0x168f69][_0x09db('0x74')])?util[_0x09db('0x7f')]('SIP/%s',_0x5ba495[_0x168f69][_0x09db('0x36')]):_0x5ba495[_0x168f69][_0x09db('0x74')],'paused':_0x5ba495[_0x168f69][_0x09db('0x73')]||![],'penalty':_0x2e1cc5[_0x09db('0x54')][_0x09db('0x7b')]||0x0}));}}return BPromise['all'](_0x176bfa);}})[_0x09db('0x33')](function(){return _0xcc1272;})['then'](respondWithResult(_0x34357d,null))[_0x09db('0x50')](handleError(_0x34357d,null));};exports[_0x09db('0x95')]=function(_0x19c0bc,_0x2716e9,_0x1fdb31){return db[_0x09db('0x39')][_0x09db('0x31')]({'where':{'id':_0x19c0bc['params']['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x2716e9,null))[_0x09db('0x33')](function(_0x4b453e){if(_0x4b453e){return _0x4b453e['removeAgents'](_0x19c0bc['query'][_0x09db('0x98')])[_0x09db('0x33')](function(){if(_[_0x09db('0x99')](_0x19c0bc[_0x09db('0x3c')][_0x09db('0x98')])){for(var _0x2fcf9a=0x0;_0x2fcf9a<_0x19c0bc['query'][_0x09db('0x98')]['length'];_0x2fcf9a+=0x1){socket[_0x09db('0x81')](_0x09db('0x96'),{'UserId':Number(_0x19c0bc[_0x09db('0x3c')]['ids'][_0x2fcf9a]),'VoiceQueueId':Number(_0x19c0bc[_0x09db('0x52')]['id'])});}}else{socket[_0x09db('0x81')](_0x09db('0x96'),{'UserId':Number(_0x19c0bc[_0x09db('0x3c')]['ids']),'VoiceQueueId':Number(_0x19c0bc[_0x09db('0x52')]['id'])});}});}})['then'](function(_0x1152fa){return db[_0x09db('0x7d')]['destroy']({'where':{'VoiceQueueId':_0x19c0bc[_0x09db('0x52')]['id'],'UserId':_0x19c0bc[_0x09db('0x3c')]['ids']}})['then'](function(){return _0x1152fa;});})[_0x09db('0x33')](respondWithStatusCode(_0x2716e9,null))[_0x09db('0x50')](handleError(_0x2716e9,null));};exports[_0x09db('0x9a')]=function(_0xd5cf30,_0x2b2625,_0x5ce2fb){var _0x31a05a={};var _0x180075={};var _0x21e41f;var _0xf71883;return db['VoiceQueue'][_0x09db('0x62')]({'where':{'id':_0xd5cf30[_0x09db('0x52')]['id']}})['then'](handleEntityNotFound(_0x2b2625,null))[_0x09db('0x33')](function(_0x5da39e){if(_0x5da39e){_0x21e41f=_0x5da39e;_0x180075[_0x09db('0x3b')]=_['keys'](db[_0x09db('0x70')][_0x09db('0x5a')]);_0x180075['query']=_[_0x09db('0x3d')](_0xd5cf30['query']);_0x180075[_0x09db('0x3e')]=_[_0x09db('0x3f')](_0x180075['model'],_0x180075[_0x09db('0x3c')]);_0x31a05a[_0x09db('0x40')]=_[_0x09db('0x3f')](_0x180075['model'],qs['fields'](_0xd5cf30['query'][_0x09db('0x41')]));_0x31a05a['attributes']=_0x31a05a[_0x09db('0x40')][_0x09db('0x42')]?_0x31a05a['attributes']:_0x180075[_0x09db('0x3b')];_0x31a05a[_0x09db('0x45')]=qs['sort'](_0xd5cf30['query'][_0x09db('0x46')]);_0x31a05a[_0x09db('0x49')]=qs[_0x09db('0x3e')](_[_0x09db('0x47')](_0xd5cf30[_0x09db('0x3c')],_0x180075['filters']));if(_0xd5cf30[_0x09db('0x3c')][_0x09db('0x48')]){_0x31a05a[_0x09db('0x49')]=_['merge'](_0x31a05a[_0x09db('0x49')],{'$or':_['map'](_0x31a05a[_0x09db('0x40')],function(_0xfa47b){var _0x1cb0a5={};_0x1cb0a5[_0xfa47b]={'$like':'%'+_0xd5cf30[_0x09db('0x3c')]['filter']+'%'};return _0x1cb0a5;})});}_0x31a05a=_['merge']({},_0x31a05a,_0xd5cf30[_0x09db('0x4c')]);return _0x21e41f[_0x09db('0x9a')](_0x31a05a);}})[_0x09db('0x33')](function(_0x289500){if(_0x289500){_0xf71883=_0x289500[_0x09db('0x42')];if(!_0xd5cf30[_0x09db('0x3c')][_0x09db('0x43')](_0x09db('0x44'))){_0x31a05a[_0x09db('0x23')]=qs[_0x09db('0x23')](_0xd5cf30[_0x09db('0x3c')][_0x09db('0x23')]);_0x31a05a['offset']=qs[_0x09db('0x21')](_0xd5cf30[_0x09db('0x3c')]['offset']);}return _0x21e41f['getAgents'](_0x31a05a);}})['then'](function(_0x281959){if(_0x281959){return _0x281959?{'count':_0xf71883,'rows':_0x281959}:null;}})['then'](respondWithResult(_0x2b2625,null))['catch'](handleError(_0x2b2625,null));};exports[_0x09db('0x9b')]=function(_0x2a97c8,_0x4ed1aa,_0x44d3f8){var _0xa8927c={};var _0x4caecd={};var _0x5c614b;var _0x58da6f;return db[_0x09db('0x39')][_0x09db('0x62')]({'where':{'id':_0x2a97c8[_0x09db('0x52')]['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x4ed1aa,null))['then'](function(_0x50c29f){if(_0x50c29f){_0x5c614b=_0x50c29f;_0x4caecd[_0x09db('0x3b')]=_[_0x09db('0x3d')](db['UserVoiceQueueRt'][_0x09db('0x5a')]);_0x4caecd[_0x09db('0x3c')]=_[_0x09db('0x3d')](_0x2a97c8['query']);_0x4caecd['filters']=_[_0x09db('0x3f')](_0x4caecd[_0x09db('0x3b')],_0x4caecd['query']);_0xa8927c[_0x09db('0x40')]=_[_0x09db('0x3f')](_0x4caecd[_0x09db('0x3b')],qs[_0x09db('0x41')](_0x2a97c8[_0x09db('0x3c')][_0x09db('0x41')]));_0xa8927c[_0x09db('0x40')]=_0xa8927c['attributes']['length']?_0xa8927c[_0x09db('0x40')]:_0x4caecd[_0x09db('0x3b')];_0xa8927c[_0x09db('0x45')]=qs[_0x09db('0x46')](_0x2a97c8['query'][_0x09db('0x46')]);_0xa8927c['where']=qs[_0x09db('0x3e')](_['pick'](_0x2a97c8[_0x09db('0x3c')],_0x4caecd[_0x09db('0x3e')]));if(_0x2a97c8[_0x09db('0x3c')][_0x09db('0x48')]){_0xa8927c[_0x09db('0x49')]=_['merge'](_0xa8927c['where'],{'$or':_[_0x09db('0x2e')](_0xa8927c[_0x09db('0x40')],function(_0x2d2112){var _0x135adc={};_0x135adc[_0x2d2112]={'$like':'%'+_0x2a97c8[_0x09db('0x3c')][_0x09db('0x48')]+'%'};return _0x135adc;})});}_0xa8927c=_[_0x09db('0x4a')]({},_0xa8927c,_0x2a97c8[_0x09db('0x4c')]);return _0x5c614b[_0x09db('0x9b')](_0xa8927c);}})[_0x09db('0x33')](function(_0x544a2b){if(_0x544a2b){_0x58da6f=_0x544a2b[_0x09db('0x42')];if(!_0x2a97c8[_0x09db('0x3c')][_0x09db('0x43')]('nolimit')){_0xa8927c[_0x09db('0x23')]=qs[_0x09db('0x23')](_0x2a97c8[_0x09db('0x3c')][_0x09db('0x23')]);_0xa8927c['offset']=qs['offset'](_0x2a97c8[_0x09db('0x3c')]['offset']);}return _0x5c614b[_0x09db('0x9b')](_0xa8927c);}})[_0x09db('0x33')](function(_0x45011b){return _0x45011b?{'count':_0x58da6f,'rows':_0x45011b}:null;})['then'](respondWithResult(_0x4ed1aa,null))['catch'](handleError(_0x4ed1aa,null));};exports[_0x09db('0x9c')]=function(_0x3e15dc,_0x2c84b2,_0x37e715){var _0x530e8a={};var _0x2cc43b={};var _0x3bd75a;var _0x40fd77;return db[_0x09db('0x39')][_0x09db('0x62')]({'where':{'id':_0x3e15dc[_0x09db('0x52')]['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x2c84b2,null))[_0x09db('0x33')](function(_0x22149d){if(_0x22149d){_0x3bd75a=_0x22149d;_0x2cc43b[_0x09db('0x3b')]=_[_0x09db('0x3d')](db[_0x09db('0x9d')][_0x09db('0x5a')]);_0x2cc43b[_0x09db('0x3c')]=_[_0x09db('0x3d')](_0x3e15dc[_0x09db('0x3c')]);_0x2cc43b['filters']=_[_0x09db('0x3f')](_0x2cc43b['model'],_0x2cc43b[_0x09db('0x3c')]);_0x530e8a['attributes']=_[_0x09db('0x3f')](_0x2cc43b[_0x09db('0x3b')],qs[_0x09db('0x41')](_0x3e15dc[_0x09db('0x3c')][_0x09db('0x41')]));_0x530e8a[_0x09db('0x40')]=_0x530e8a['attributes'][_0x09db('0x42')]?_0x530e8a['attributes']:_0x2cc43b[_0x09db('0x3b')];_0x530e8a['order']=qs['sort'](_0x3e15dc[_0x09db('0x3c')]['sort']);_0x530e8a['where']=qs[_0x09db('0x3e')](_[_0x09db('0x47')](_0x3e15dc[_0x09db('0x3c')],_0x2cc43b['filters']));if(_0x3e15dc[_0x09db('0x3c')][_0x09db('0x48')]){_0x530e8a[_0x09db('0x49')]=_[_0x09db('0x4a')](_0x530e8a[_0x09db('0x49')],{'$or':_[_0x09db('0x2e')](_0x530e8a[_0x09db('0x40')],function(_0xedd527){var _0x4be853={};_0x4be853[_0xedd527]={'$like':'%'+_0x3e15dc[_0x09db('0x3c')]['filter']+'%'};return _0x4be853;})});}_0x530e8a=_[_0x09db('0x4a')]({},_0x530e8a,_0x3e15dc[_0x09db('0x4c')]);return _0x3bd75a[_0x09db('0x9c')](_0x530e8a);}})[_0x09db('0x33')](function(_0x15c1ac){if(_0x15c1ac){_0x40fd77=_0x15c1ac[_0x09db('0x42')];if(!_0x3e15dc[_0x09db('0x3c')][_0x09db('0x43')](_0x09db('0x44'))){_0x530e8a[_0x09db('0x23')]=qs['limit'](_0x3e15dc['query'][_0x09db('0x23')]);_0x530e8a[_0x09db('0x21')]=qs[_0x09db('0x21')](_0x3e15dc[_0x09db('0x3c')]['offset']);}return _0x3bd75a[_0x09db('0x9c')](_0x530e8a);}})[_0x09db('0x33')](function(_0xb56e0){if(_0xb56e0){return _0xb56e0?{'count':_0x40fd77,'rows':_0xb56e0}:null;}})[_0x09db('0x33')](respondWithResult(_0x2c84b2,null))['catch'](handleError(_0x2c84b2,null));};exports[_0x09db('0x9e')]=function(_0x183745,_0x11169a,_0x29438a){var _0x520a13,_0x969d34;return db[_0x09db('0x39')][_0x09db('0x31')]({'where':{'id':_0x183745[_0x09db('0x52')]['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x11169a,null))[_0x09db('0x33')](function(_0x10dee9){if(_0x10dee9){_0x969d34=_0x10dee9;return _0x10dee9[_0x09db('0x9e')](_0x183745[_0x09db('0x54')]['ids'],_[_0x09db('0x5b')](_0x183745[_0x09db('0x54')],[_0x09db('0x98'),'id'])||{});}return null;})['spread'](function(_0x371491){var _0x45ae77;_0x520a13=_0x371491||[];var _0x1ca33e=[];if(_0x371491){for(var _0xcc11f0=0x0;_0xcc11f0<_0x371491[_0x09db('0x42')];_0xcc11f0+=0x1){var _0x9eee4e=_0x371491[_0xcc11f0]['get']({'plain':!![]});_0x969d34[_0x09db('0x9f')]=_0x183745[_0x09db('0x54')][_0x09db('0x9f')]?_0x183745[_0x09db('0x54')][_0x09db('0x9f')]:_0x969d34['dialCheckDuplicateType'];switch(_0x969d34[_0x09db('0x9f')]){case _0x09db('0xa0'):_0x45ae77=squel[_0x09db('0xa1')]()[_0x09db('0xa2')](_0x09db('0xa3'))[_0x09db('0xa4')](['phone',_0x09db('0xa5'),'ContactId',_0x09db('0xa6'),_0x09db('0x67'),_0x09db('0x5c'),'updatedAt'],squel['select']()[_0x09db('0x85')](_0x09db('0xa7'),_0x09db('0xa7'))[_0x09db('0x85')](_0x09db('0xa8'),_0x09db('0xa5'))[_0x09db('0x85')]('id','ContactId')[_0x09db('0x85')](_0x9eee4e[_0x09db('0xa9')][_0x09db('0xaa')](),_0x09db('0xa6'))[_0x09db('0x85')](_0x183745[_0x09db('0x52')]['id'][_0x09db('0xaa')](),_0x09db('0x67'))[_0x09db('0x85')]('NOW()','createdAt')[_0x09db('0x85')]('NOW()',_0x09db('0x5d'))[_0x09db('0x87')](_0x09db('0xab'))[_0x09db('0x49')]('deletedAt\x20IS\x20NULL')[_0x09db('0x49')](_0x09db('0xac'),_0x9eee4e[_0x09db('0xa9')][_0x09db('0xaa')]())[_0x09db('0x49')]('phone\x20IS\x20NOT\x20NULL')[_0x09db('0x49')](_0x09db('0xad'),squel[_0x09db('0x84')]()[_0x09db('0x85')]('COALESCE(calleridnum,\x27\x27)')[_0x09db('0x87')](_0x09db('0xae'))[_0x09db('0x49')](_0x09db('0x8c'),_0x183745['params']['id'][_0x09db('0xaa')]()))[_0x09db('0x49')](_0x09db('0xad'),squel['select']()[_0x09db('0x85')](_0x09db('0xaf'))['from']('cm_hopper')[_0x09db('0x49')]('VoiceQueueId\x20=\x20?',_0x183745['params']['id'][_0x09db('0xaa')]())))[_0x09db('0xaa')]();break;case _0x09db('0xb0'):_0x45ae77=squel[_0x09db('0xa1')]()[_0x09db('0xa2')](_0x09db('0xa3'))[_0x09db('0xa4')]([_0x09db('0xa7'),_0x09db('0xa5'),'ContactId',_0x09db('0xa6'),_0x09db('0x67'),_0x09db('0x5c'),_0x09db('0x5d')],squel[_0x09db('0x84')]()[_0x09db('0x85')](_0x09db('0xa7'),_0x09db('0xa7'))[_0x09db('0x85')](_0x09db('0xa8'),'scheduledAt')[_0x09db('0x85')]('id','ContactId')[_0x09db('0x85')](_0x9eee4e[_0x09db('0xa9')][_0x09db('0xaa')](),_0x09db('0xa6'))['field'](_0x183745[_0x09db('0x52')]['id']['toString'](),'VoiceQueueId')[_0x09db('0x85')](_0x09db('0xa8'),_0x09db('0x5c'))['field'](_0x09db('0xa8'),_0x09db('0x5d'))[_0x09db('0x87')](_0x09db('0xab'))[_0x09db('0x49')](_0x09db('0xb1'))[_0x09db('0x49')](_0x09db('0xac'),_0x9eee4e[_0x09db('0xa9')][_0x09db('0xaa')]())['where']('phone\x20IS\x20NOT\x20NULL')[_0x09db('0x49')](_0x09db('0xad'),squel[_0x09db('0x84')]()[_0x09db('0x85')](_0x09db('0xaf'))[_0x09db('0x87')](_0x09db('0xa3'))[_0x09db('0x49')](_0x09db('0x8c'),_0x183745[_0x09db('0x52')]['id'][_0x09db('0xaa')]())))[_0x09db('0xaa')]();break;default:_0x45ae77=squel[_0x09db('0xa1')]()[_0x09db('0xa2')]('cm_hopper')[_0x09db('0xa4')](['phone',_0x09db('0xa5'),_0x09db('0xb2'),'ListId',_0x09db('0x67'),_0x09db('0x5c'),'updatedAt'],squel[_0x09db('0x84')]()[_0x09db('0x85')]('phone','phone')['field'](_0x09db('0xa8'),_0x09db('0xa5'))['field']('id',_0x09db('0xb2'))[_0x09db('0x85')](_0x9eee4e[_0x09db('0xa9')][_0x09db('0xaa')](),_0x09db('0xa6'))[_0x09db('0x85')](_0x183745[_0x09db('0x52')]['id']['toString'](),'VoiceQueueId')[_0x09db('0x85')](_0x09db('0xa8'),_0x09db('0x5c'))[_0x09db('0x85')](_0x09db('0xa8'),_0x09db('0x5d'))[_0x09db('0x87')](_0x09db('0xab'))[_0x09db('0x49')](_0x09db('0xb1'))[_0x09db('0x49')](_0x09db('0xac'),_0x9eee4e[_0x09db('0xa9')][_0x09db('0xaa')]())[_0x09db('0x49')](_0x09db('0xb3')))[_0x09db('0xaa')]();}_0x1ca33e[_0x09db('0x8d')](db[_0x09db('0x77')]['query'](_0x45ae77));}return BPromise[_0x09db('0xb4')](_0x1ca33e);}})['then'](function(){return _0x520a13;})[_0x09db('0x33')](respondWithResult(_0x11169a,null))[_0x09db('0x50')](handleError(_0x11169a,null));};exports['removeLists']=function(_0x448f69,_0x566d8b,_0x257838){return db[_0x09db('0x39')]['find']({'where':{'id':_0x448f69[_0x09db('0x52')]['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x566d8b,null))['then'](function(_0x2b8115){if(_0x2b8115){return _0x2b8115[_0x09db('0xb5')](_0x448f69[_0x09db('0x3c')][_0x09db('0x98')]);}})['then'](function(_0x44fde4){if(_0x44fde4){return db['CmHopper'][_0x09db('0x32')]({'where':{'ListId':_0x448f69[_0x09db('0x3c')][_0x09db('0x98')],'VoiceQueueId':_0x448f69[_0x09db('0x52')]['id']}})[_0x09db('0x33')](function(){return _0x44fde4;});}})[_0x09db('0x33')](respondWithStatusCode(_0x566d8b,null))[_0x09db('0x50')](handleError(_0x566d8b,null));};exports['getBlackLists']=function(_0x308aaf,_0xeb7d94,_0x1b93ef){var _0x2c6f65={};var _0x56d4de={};var _0x5f0632;var _0x3979f5;return db[_0x09db('0x39')]['findOne']({'where':{'id':_0x308aaf[_0x09db('0x52')]['id']}})['then'](handleEntityNotFound(_0xeb7d94,null))['then'](function(_0x1049b3){if(_0x1049b3){_0x5f0632=_0x1049b3;_0x56d4de[_0x09db('0x3b')]=_[_0x09db('0x3d')](db[_0x09db('0x9d')][_0x09db('0x5a')]);_0x56d4de['query']=_[_0x09db('0x3d')](_0x308aaf[_0x09db('0x3c')]);_0x56d4de[_0x09db('0x3e')]=_[_0x09db('0x3f')](_0x56d4de[_0x09db('0x3b')],_0x56d4de[_0x09db('0x3c')]);_0x2c6f65[_0x09db('0x40')]=_[_0x09db('0x3f')](_0x56d4de[_0x09db('0x3b')],qs['fields'](_0x308aaf[_0x09db('0x3c')][_0x09db('0x41')]));_0x2c6f65[_0x09db('0x40')]=_0x2c6f65[_0x09db('0x40')][_0x09db('0x42')]?_0x2c6f65[_0x09db('0x40')]:_0x56d4de[_0x09db('0x3b')];_0x2c6f65['order']=qs[_0x09db('0x46')](_0x308aaf['query'][_0x09db('0x46')]);_0x2c6f65[_0x09db('0x49')]=qs[_0x09db('0x3e')](_[_0x09db('0x47')](_0x308aaf['query'],_0x56d4de[_0x09db('0x3e')]));if(_0x308aaf[_0x09db('0x3c')][_0x09db('0x48')]){_0x2c6f65[_0x09db('0x49')]=_[_0x09db('0x4a')](_0x2c6f65['where'],{'$or':_[_0x09db('0x2e')](_0x2c6f65['attributes'],function(_0x2c4682){var _0x177fbb={};_0x177fbb[_0x2c4682]={'$like':'%'+_0x308aaf['query'][_0x09db('0x48')]+'%'};return _0x177fbb;})});}_0x2c6f65=_[_0x09db('0x4a')]({},_0x2c6f65,_0x308aaf[_0x09db('0x4c')]);return _0x5f0632[_0x09db('0xb6')](_0x2c6f65);}})[_0x09db('0x33')](function(_0x48a3dc){if(_0x48a3dc){_0x3979f5=_0x48a3dc['length'];if(!_0x308aaf['query'][_0x09db('0x43')]('nolimit')){_0x2c6f65['limit']=qs[_0x09db('0x23')](_0x308aaf[_0x09db('0x3c')][_0x09db('0x23')]);_0x2c6f65[_0x09db('0x21')]=qs['offset'](_0x308aaf[_0x09db('0x3c')][_0x09db('0x21')]);}return _0x5f0632[_0x09db('0xb6')](_0x2c6f65);}})[_0x09db('0x33')](function(_0x2f29f0){if(_0x2f29f0){return _0x2f29f0?{'count':_0x3979f5,'rows':_0x2f29f0}:null;}})[_0x09db('0x33')](respondWithResult(_0xeb7d94,null))[_0x09db('0x50')](handleError(_0xeb7d94,null));};exports[_0x09db('0xb7')]=function(_0x17a671,_0xfdea52,_0x3bd9c1){var _0x3b42c1,_0x5c1efc;return db['VoiceQueue'][_0x09db('0x31')]({'where':{'id':_0x17a671[_0x09db('0x52')]['id']}})[_0x09db('0x33')](handleEntityNotFound(_0xfdea52,null))[_0x09db('0x33')](function(_0x1060d9){if(_0x1060d9){_0x5c1efc=_0x1060d9;return _0x1060d9[_0x09db('0xb7')](_0x17a671[_0x09db('0x54')]['ids'],_[_0x09db('0x5b')](_0x17a671['body'],[_0x09db('0x98'),'id'])||{});}return null;})[_0x09db('0xb8')](function(_0x36a7f5){var _0x96f607;_0x3b42c1=_0x36a7f5||[];var _0x1f2d95=[];if(_0x36a7f5){for(var _0x4237f3=0x0;_0x4237f3<_0x36a7f5[_0x09db('0x42')];_0x4237f3+=0x1){var _0x1e4cee=_0x36a7f5[_0x4237f3][_0x09db('0x29')]({'plain':!![]});_0x96f607=squel[_0x09db('0xa1')]()[_0x09db('0xa2')](_0x09db('0xb9'))[_0x09db('0xa4')](['phone',_0x09db('0xb2'),_0x09db('0xa6'),_0x09db('0x67'),'createdAt',_0x09db('0x5d')],squel[_0x09db('0x84')]()['field'](_0x09db('0xa7'),_0x09db('0xa7'))[_0x09db('0x85')]('id','ContactId')[_0x09db('0x85')](_0x1e4cee[_0x09db('0xa9')]['toString'](),'ListId')[_0x09db('0x85')](_0x17a671[_0x09db('0x52')]['id'][_0x09db('0xaa')](),_0x09db('0x67'))[_0x09db('0x85')]('NOW()',_0x09db('0x5c'))[_0x09db('0x85')](_0x09db('0xa8'),'updatedAt')[_0x09db('0x87')](_0x09db('0xab'))['where']('deletedAt\x20IS\x20NULL')[_0x09db('0x49')]('ListId\x20=\x20?',_0x1e4cee[_0x09db('0xa9')][_0x09db('0xaa')]())[_0x09db('0x49')](_0x09db('0xb3')))[_0x09db('0xaa')]();_0x1f2d95[_0x09db('0x8d')](db[_0x09db('0x77')]['query'](_0x96f607));}return BPromise['all'](_0x1f2d95);}})['then'](function(){return _0x3b42c1;})[_0x09db('0x33')](respondWithResult(_0xfdea52,null))[_0x09db('0x50')](handleError(_0xfdea52,null));};exports[_0x09db('0xba')]=function(_0xf48c06,_0x31ce70,_0x837963){return db[_0x09db('0x39')]['find']({'where':{'id':_0xf48c06[_0x09db('0x52')]['id']}})[_0x09db('0x33')](handleEntityNotFound(_0x31ce70,null))[_0x09db('0x33')](function(_0x3e421c){if(_0x3e421c){return _0x3e421c[_0x09db('0xba')](_0xf48c06['query'][_0x09db('0x98')]);}})[_0x09db('0x33')](function(_0x2101af){if(_0x2101af){return db['CmHopperBlack'][_0x09db('0x32')]({'where':{'ListId':_0xf48c06[_0x09db('0x3c')][_0x09db('0x98')],'VoiceQueueId':_0xf48c06[_0x09db('0x52')]['id']}})[_0x09db('0x33')](function(){return _0x2101af;});}})[_0x09db('0x33')](respondWithStatusCode(_0x31ce70,null))[_0x09db('0x50')](handleError(_0x31ce70,null));}; \ No newline at end of file +var _0x8ee4=['each','TeamVoiceQueue','upsert','findOrCreate','UserVoiceQueueRt','SIP/%s','voicePause','userVoiceQueue:save','removeTeams','ids','select','field','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','push','sequelize','toString','QueryTypes','every','all','union','transaction','emit','userVoiceQueue:remove','addAgents','spread','isEmpty','isNil','format','isArray','getAgents','getMembers','getLists','CmList','addLists','dialCheckDuplicateType','phone','scheduledAt','ListId','NOW()','ContactId','CmListId','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','cm_hopper_final','COALESCE(phone,\x27\x27)','cm_hopper','VoiceQueueId\x20=\x20?','onlyIfOpen','insert','fromQuery','deletedAt\x20IS\x20NULL','into','removeLists','getBlackLists','addBlackLists','removeBlackLists','eml-format','rimraf','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/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','get','VoiceQueues','QueueCampaigns','outbound','filter','map','value','includes','type','find','name','UserProfileResource','end','error','index','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','includeAll','findAll','rows','catch','show','params','options','create','body','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','omit','updatedAt','inbound','findOne','CmHopper','include','getHopperHistories','CmHopperHistory','VoiceQueueId','CmHopperFinal','CmHopperBlack','teams','User','online','interface','flatMap','Agents','forEach','penalty'];(function(_0x42f009,_0x5e27b1){var _0x22a1e0=function(_0x297993){while(--_0x297993){_0x42f009['push'](_0x42f009['shift']());}};_0x22a1e0(++_0x5e27b1);}(_0x8ee4,0xef));var _0x48ee=function(_0x15795e,_0x4dc0f7){_0x15795e=_0x15795e-0x0;var _0x52fbf4=_0x8ee4[_0x15795e];return _0x52fbf4;};'use strict';var emlformat=require(_0x48ee('0x0'));var rimraf=require(_0x48ee('0x1'));var zipdir=require(_0x48ee('0x2'));var jsonpatch=require(_0x48ee('0x3'));var rp=require(_0x48ee('0x4'));var moment=require(_0x48ee('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x48ee('0x6'));var util=require(_0x48ee('0x7'));var path=require(_0x48ee('0x8'));var sox=require(_0x48ee('0x9'));var csv=require(_0x48ee('0xa'));var ejs=require(_0x48ee('0xb'));var fs=require('fs');var fs_extra=require(_0x48ee('0xc'));var _=require('lodash');var squel=require(_0x48ee('0xd'));var crypto=require('crypto');var jsforce=require(_0x48ee('0xe'));var deskjs=require(_0x48ee('0xf'));var toCsv=require(_0x48ee('0xa'));var querystring=require(_0x48ee('0x10'));var Papa=require(_0x48ee('0x11'));var Redis=require(_0x48ee('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x48ee('0x13'));var as=require(_0x48ee('0x14'));var hardwareService=require(_0x48ee('0x15'));var logger=require(_0x48ee('0x16'))(_0x48ee('0x17'));var utils=require(_0x48ee('0x18'));var config=require(_0x48ee('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x48ee('0x1a'))['db'];config[_0x48ee('0x1b')]=_[_0x48ee('0x1c')](config['redis'],{'host':_0x48ee('0x1d'),'port':0x18eb});var socket=require(_0x48ee('0x1e'))(new Redis(config[_0x48ee('0x1b')]));require(_0x48ee('0x1f'))['register'](socket);function respondWithStatusCode(_0x1ef09d,_0x54cd71){_0x54cd71=_0x54cd71||0xcc;return function(_0x103886){if(_0x103886){return _0x1ef09d['sendStatus'](_0x54cd71);}return _0x1ef09d[_0x48ee('0x20')](_0x54cd71)['end']();};}function respondWithResult(_0x45c95f,_0x4e4c76){_0x4e4c76=_0x4e4c76||0xc8;return function(_0x4ea913){if(_0x4ea913){return _0x45c95f[_0x48ee('0x20')](_0x4e4c76)['json'](_0x4ea913);}};}function respondWithFilteredResult(_0x54b6dc,_0x3827a3){return function(_0x228c5a){if(_0x228c5a){var _0x1cf4ba=typeof _0x3827a3['offset']===_0x48ee('0x21')&&typeof _0x3827a3[_0x48ee('0x22')]===_0x48ee('0x21');var _0x3a3b26=_0x228c5a[_0x48ee('0x23')];var _0x5ac22c=_0x1cf4ba?0x0:_0x3827a3[_0x48ee('0x24')];var _0x3c9cf1=_0x1cf4ba?_0x228c5a[_0x48ee('0x23')]:_0x3827a3[_0x48ee('0x24')]+_0x3827a3[_0x48ee('0x22')];var _0x30ad8f;if(_0x3c9cf1>=_0x3a3b26){_0x3c9cf1=_0x3a3b26;_0x30ad8f=0xc8;}else{_0x30ad8f=0xce;}_0x54b6dc['status'](_0x30ad8f);return _0x54b6dc[_0x48ee('0x25')](_0x48ee('0x26'),_0x5ac22c+'-'+_0x3c9cf1+'/'+_0x3a3b26)[_0x48ee('0x27')](_0x228c5a);}return null;};}function patchUpdates(_0x9b357f){return function(_0x334686){try{jsonpatch[_0x48ee('0x28')](_0x334686,_0x9b357f,!![]);}catch(_0x7c300a){return BPromise[_0x48ee('0x29')](_0x7c300a);}return _0x334686[_0x48ee('0x2a')]();};}function saveUpdates(_0x22cea6,_0x1f1185){return function(_0x27a006){if(_0x27a006){return _0x27a006[_0x48ee('0x2b')](_0x22cea6)[_0x48ee('0x2c')](function(_0x5c644e){return _0x5c644e;});}return null;};}function removeEntity(_0x50bd15,_0x216151){return function(_0x9b881f){if(_0x9b881f){return _0x9b881f[_0x48ee('0x2d')]()['then'](function(){var _0x34751d=_0x9b881f[_0x48ee('0x2e')]({'plain':!![]});var _0x28fe4=[{'name':_0x48ee('0x2f'),'value':'inbound','ignore':![]},{'name':_0x48ee('0x30'),'value':_0x48ee('0x31'),'ignore':![]}];var _0x4d2286=_(_0x28fe4)[_0x48ee('0x32')]('ignore')[_0x48ee('0x33')](_0x48ee('0x34'))[_0x48ee('0x34')]();if(_[_0x48ee('0x35')](_0x4d2286,_0x34751d[_0x48ee('0x36')])){return;}var _0x22f02e=_[_0x48ee('0x37')](_0x28fe4,[_0x48ee('0x34'),_0x34751d['type']])[_0x48ee('0x38')];return db[_0x48ee('0x39')][_0x48ee('0x2d')]({'where':{'type':_0x22f02e,'resourceId':_0x34751d['id']}})[_0x48ee('0x2c')](function(){return _0x9b881f;});})[_0x48ee('0x2c')](function(){_0x50bd15[_0x48ee('0x20')](0xcc)[_0x48ee('0x3a')]();});}};}function handleEntityNotFound(_0x58eec4,_0x1d76f2){return function(_0x49b4e8){if(!_0x49b4e8){_0x58eec4['sendStatus'](0x194);}return _0x49b4e8;};}function handleError(_0x45a302,_0x4b417a){_0x4b417a=_0x4b417a||0x1f4;return function(_0x207b2d){logger[_0x48ee('0x3b')](_0x207b2d['stack']);if(_0x207b2d[_0x48ee('0x38')]){delete _0x207b2d[_0x48ee('0x38')];}_0x45a302[_0x48ee('0x20')](_0x4b417a)['send'](_0x207b2d);};}exports[_0x48ee('0x3c')]=function(_0xe8eca5,_0x226858){var _0x465d43={},_0x34b86d={},_0x4ee7e0={'count':0x0,'rows':[]};var _0x33658d=_[_0x48ee('0x33')](db[_0x48ee('0x3d')][_0x48ee('0x3e')],function(_0x5a0052){return{'name':_0x5a0052[_0x48ee('0x3f')],'type':_0x5a0052[_0x48ee('0x36')][_0x48ee('0x40')]};});_0x34b86d[_0x48ee('0x41')]=_[_0x48ee('0x33')](_0x33658d,_0x48ee('0x38'));_0x34b86d[_0x48ee('0x42')]=_[_0x48ee('0x43')](_0xe8eca5['query']);_0x34b86d[_0x48ee('0x44')]=_[_0x48ee('0x45')](_0x34b86d[_0x48ee('0x41')],_0x34b86d['query']);_0x465d43[_0x48ee('0x46')]=_[_0x48ee('0x45')](_0x34b86d[_0x48ee('0x41')],qs[_0x48ee('0x47')](_0xe8eca5[_0x48ee('0x42')][_0x48ee('0x47')]));_0x465d43[_0x48ee('0x46')]=_0x465d43[_0x48ee('0x46')][_0x48ee('0x48')]?_0x465d43['attributes']:_0x34b86d[_0x48ee('0x41')];if(!_0xe8eca5['query'][_0x48ee('0x49')](_0x48ee('0x4a'))){_0x465d43[_0x48ee('0x22')]=qs[_0x48ee('0x22')](_0xe8eca5[_0x48ee('0x42')][_0x48ee('0x22')]);_0x465d43[_0x48ee('0x24')]=qs['offset'](_0xe8eca5[_0x48ee('0x42')][_0x48ee('0x24')]);}_0x465d43[_0x48ee('0x4b')]=qs[_0x48ee('0x4c')](_0xe8eca5[_0x48ee('0x42')][_0x48ee('0x4c')]);_0x465d43[_0x48ee('0x4d')]=qs[_0x48ee('0x44')](_[_0x48ee('0x4e')](_0xe8eca5[_0x48ee('0x42')],_0x34b86d['filters']),_0x33658d);if(_0xe8eca5[_0x48ee('0x42')][_0x48ee('0x32')]){_0x465d43[_0x48ee('0x4d')]=_[_0x48ee('0x4f')](_0x465d43[_0x48ee('0x4d')],{'$or':_[_0x48ee('0x33')](_0x33658d,function(_0xce5895){if(_0xce5895[_0x48ee('0x36')]!=='VIRTUAL'){var _0x3c3f75={};_0x3c3f75[_0xce5895[_0x48ee('0x38')]]={'$like':'%'+_0xe8eca5[_0x48ee('0x42')][_0x48ee('0x32')]+'%'};return _0x3c3f75;}})});}_0x465d43=_['merge']({},_0x465d43,_0xe8eca5['options']);var _0x2987a9={'where':_0x465d43[_0x48ee('0x4d')]};return db[_0x48ee('0x3d')][_0x48ee('0x23')](_0x2987a9)[_0x48ee('0x2c')](function(_0x4fd0cb){_0x4ee7e0[_0x48ee('0x23')]=_0x4fd0cb;if(_0xe8eca5[_0x48ee('0x42')][_0x48ee('0x50')]){_0x465d43['include']=[{'all':!![]}];}return db[_0x48ee('0x3d')][_0x48ee('0x51')](_0x465d43);})[_0x48ee('0x2c')](function(_0x2478e1){_0x4ee7e0[_0x48ee('0x52')]=_0x2478e1;return _0x4ee7e0;})[_0x48ee('0x2c')](respondWithFilteredResult(_0x226858,_0x465d43))[_0x48ee('0x53')](handleError(_0x226858,null));};exports[_0x48ee('0x54')]=function(_0x55f732,_0xd4d765){var _0x4b85ee={'raw':![],'where':{'id':_0x55f732[_0x48ee('0x55')]['id']}},_0x77b104={};_0x77b104[_0x48ee('0x41')]=_[_0x48ee('0x43')](db[_0x48ee('0x3d')][_0x48ee('0x3e')]);_0x77b104[_0x48ee('0x42')]=_[_0x48ee('0x43')](_0x55f732[_0x48ee('0x42')]);_0x77b104[_0x48ee('0x44')]=_[_0x48ee('0x45')](_0x77b104[_0x48ee('0x41')],_0x77b104[_0x48ee('0x42')]);_0x4b85ee[_0x48ee('0x46')]=_['intersection'](_0x77b104[_0x48ee('0x41')],qs[_0x48ee('0x47')](_0x55f732[_0x48ee('0x42')][_0x48ee('0x47')]));_0x4b85ee['attributes']=_0x4b85ee[_0x48ee('0x46')][_0x48ee('0x48')]?_0x4b85ee[_0x48ee('0x46')]:_0x77b104['model'];if(_0x55f732[_0x48ee('0x42')][_0x48ee('0x50')]){_0x4b85ee['include']=[{'all':!![]}];}_0x4b85ee=_[_0x48ee('0x4f')]({},_0x4b85ee,_0x55f732[_0x48ee('0x56')]);return db[_0x48ee('0x3d')][_0x48ee('0x37')](_0x4b85ee)[_0x48ee('0x2c')](handleEntityNotFound(_0xd4d765,null))[_0x48ee('0x2c')](respondWithResult(_0xd4d765,null))[_0x48ee('0x53')](handleError(_0xd4d765,null));};exports[_0x48ee('0x57')]=function(_0x51c41d,_0x533571){return db[_0x48ee('0x3d')][_0x48ee('0x57')](_0x51c41d[_0x48ee('0x58')],{})['then'](function(_0xa4d9ba){var _0x326268=_0x51c41d['user'][_0x48ee('0x2e')]({'plain':!![]});if(!_0x326268)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x326268['role']===_0x48ee('0x59')){var _0x339ad8=_0xa4d9ba[_0x48ee('0x2e')]({'plain':!![]});var _0x576718=[{'name':_0x48ee('0x2f'),'value':'inbound'},{'name':_0x48ee('0x30'),'value':_0x48ee('0x31')}];var _0x2b9f32=_[_0x48ee('0x37')](_0x576718,[_0x48ee('0x34'),_0x339ad8[_0x48ee('0x36')]])['name'];return db[_0x48ee('0x5a')][_0x48ee('0x37')]({'where':{'name':_0x2b9f32,'userProfileId':_0x326268[_0x48ee('0x5b')]},'raw':!![]})['then'](function(_0x1c6104){if(_0x1c6104&&_0x1c6104[_0x48ee('0x5c')]===0x0){return db[_0x48ee('0x39')][_0x48ee('0x57')]({'name':_0x339ad8[_0x48ee('0x38')],'resourceId':_0x339ad8['id'],'type':_0x1c6104[_0x48ee('0x38')],'sectionId':_0x1c6104['id']},{})[_0x48ee('0x2c')](function(){return _0xa4d9ba;});}else{return _0xa4d9ba;}})[_0x48ee('0x53')](function(_0x4e3a35){logger[_0x48ee('0x3b')](_0x48ee('0x5d'),_0x4e3a35);throw _0x4e3a35;});}return _0xa4d9ba;})['then'](respondWithResult(_0x533571,0xc9))['catch'](handleError(_0x533571,null));};exports[_0x48ee('0x5e')]=function(_0xf661d5,_0x41f99f){var _0x57c3b7={'where':{'id':_0xf661d5[_0x48ee('0x55')]['id']}},_0x567163={};_0x567163[_0x48ee('0x41')]=_[_0x48ee('0x43')](db[_0x48ee('0x3d')][_0x48ee('0x3e')]);_0x57c3b7[_0x48ee('0x46')]=_[_0x48ee('0x45')](_0x567163[_0x48ee('0x41')],qs['fields'](_0xf661d5[_0x48ee('0x42')][_0x48ee('0x47')]));_0x57c3b7[_0x48ee('0x46')]=_0x57c3b7[_0x48ee('0x46')][_0x48ee('0x48')]?_0x57c3b7[_0x48ee('0x46')]:_0x567163[_0x48ee('0x41')];if(_0xf661d5[_0x48ee('0x42')][_0x48ee('0x50')]){_0x57c3b7['include']=[{'all':!![]}];}_0x57c3b7=_[_0x48ee('0x4f')]({},_0x57c3b7,_0xf661d5[_0x48ee('0x56')]);return db['VoiceQueue'][_0x48ee('0x37')](_0x57c3b7)[_0x48ee('0x2c')](handleEntityNotFound(_0x41f99f,null))[_0x48ee('0x2c')](function(_0x1b47fb){if(_0x1b47fb){var _0x239522=_0x1b47fb[_0x48ee('0x2e')]({'plain':!![]});_0x239522=qs['omit'](_0x239522,['id',_0x48ee('0x5f'),'updatedAt']);_0xf661d5[_0x48ee('0x58')]=_[_0x48ee('0x60')](_0xf661d5[_0x48ee('0x58')],['id',_0x48ee('0x5f'),_0x48ee('0x61')]);return db[_0x48ee('0x3d')][_0x48ee('0x57')](_[_0x48ee('0x4f')](_0x239522,_0xf661d5['body']),{'include':_0xf661d5['query'][_0x48ee('0x50')]?[{'all':!![]}]:undefined})['then'](function(_0x5bfe2f){var _0x31cc6a=_0xf661d5['user'][_0x48ee('0x2e')]({'plain':!![]});if(!_0x31cc6a)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x31cc6a['role']===_0x48ee('0x59')){var _0x544b71=_0x5bfe2f['get']({'plain':!![]});var _0x2f1714=[{'name':'VoiceQueues','value':_0x48ee('0x62')},{'name':'QueueCampaigns','value':'outbound'}];var _0x30c916=_[_0x48ee('0x37')](_0x2f1714,[_0x48ee('0x34'),_0x544b71[_0x48ee('0x36')]])['name'];return db[_0x48ee('0x5a')][_0x48ee('0x37')]({'where':{'name':_0x30c916,'userProfileId':_0x31cc6a[_0x48ee('0x5b')]},'raw':!![]})[_0x48ee('0x2c')](function(_0x5bdd1c){if(_0x5bdd1c&&_0x5bdd1c[_0x48ee('0x5c')]===0x0){return db[_0x48ee('0x39')][_0x48ee('0x57')]({'name':_0x544b71[_0x48ee('0x38')],'resourceId':_0x544b71['id'],'type':_0x5bdd1c[_0x48ee('0x38')],'sectionId':_0x5bdd1c['id']},{})[_0x48ee('0x2c')](function(){return _0x5bfe2f;});}else{return _0x5bfe2f;}})[_0x48ee('0x53')](function(_0x5c75b6){logger[_0x48ee('0x3b')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5c75b6);throw _0x5c75b6;});}return _0x5bfe2f;});}})[_0x48ee('0x2c')](respondWithResult(_0x41f99f,0xc9))[_0x48ee('0x53')](handleError(_0x41f99f,null));};exports[_0x48ee('0x2b')]=function(_0x321904,_0x513ef4){if(_0x321904[_0x48ee('0x58')]['id']){delete _0x321904[_0x48ee('0x58')]['id'];}return db[_0x48ee('0x3d')]['find']({'where':{'id':_0x321904[_0x48ee('0x55')]['id']}})['then'](handleEntityNotFound(_0x513ef4,null))[_0x48ee('0x2c')](saveUpdates(_0x321904[_0x48ee('0x58')],null))['then'](respondWithResult(_0x513ef4,null))[_0x48ee('0x53')](handleError(_0x513ef4,null));};exports['destroy']=function(_0x7837c9,_0x5b2f1c){return db['VoiceQueue']['find']({'where':{'id':_0x7837c9[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x5b2f1c,null))[_0x48ee('0x2c')](removeEntity(_0x5b2f1c,null))['catch'](handleError(_0x5b2f1c,null));};exports['getHoppers']=function(_0x47f1d6,_0x2cd16d,_0x434be9){var _0x2fa838={'raw':![],'where':{}};var _0x53621d={};var _0x2bad6f={'count':0x0,'rows':[]};return db[_0x48ee('0x3d')][_0x48ee('0x63')]({'where':{'id':_0x47f1d6[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x2cd16d,null))['then'](function(_0x35c339){if(_0x35c339){_0x53621d[_0x48ee('0x41')]=_[_0x48ee('0x43')](db[_0x48ee('0x64')][_0x48ee('0x3e')]);_0x53621d['query']=_['keys'](_0x47f1d6[_0x48ee('0x42')]);_0x53621d[_0x48ee('0x44')]=_[_0x48ee('0x45')](_0x53621d[_0x48ee('0x41')],_0x53621d[_0x48ee('0x42')]);_0x2fa838[_0x48ee('0x46')]=_[_0x48ee('0x45')](_0x53621d[_0x48ee('0x41')],qs[_0x48ee('0x47')](_0x47f1d6[_0x48ee('0x42')]['fields']));_0x2fa838[_0x48ee('0x46')]=_0x2fa838['attributes'][_0x48ee('0x48')]?_0x2fa838[_0x48ee('0x46')]:_0x53621d[_0x48ee('0x41')];if(!_0x47f1d6['query'][_0x48ee('0x49')](_0x48ee('0x4a'))){_0x2fa838['limit']=qs[_0x48ee('0x22')](_0x47f1d6[_0x48ee('0x42')][_0x48ee('0x22')]);_0x2fa838[_0x48ee('0x24')]=qs[_0x48ee('0x24')](_0x47f1d6[_0x48ee('0x42')][_0x48ee('0x24')]);}_0x2fa838['order']=qs['sort'](_0x47f1d6[_0x48ee('0x42')][_0x48ee('0x4c')]);_0x2fa838[_0x48ee('0x4d')]=qs[_0x48ee('0x44')](_[_0x48ee('0x4e')](_0x47f1d6[_0x48ee('0x42')],_0x53621d[_0x48ee('0x44')]));_0x2fa838['where']['VoiceQueueId']=_0x35c339['id'];if(_0x47f1d6[_0x48ee('0x42')][_0x48ee('0x32')]){_0x2fa838[_0x48ee('0x4d')]=_[_0x48ee('0x4f')](_0x2fa838[_0x48ee('0x4d')],{'$or':_[_0x48ee('0x33')](_0x2fa838[_0x48ee('0x46')],function(_0x265519){var _0x4eb8a={};_0x4eb8a[_0x265519]={'$like':'%'+_0x47f1d6[_0x48ee('0x42')][_0x48ee('0x32')]+'%'};return _0x4eb8a;})});}_0x2fa838=_[_0x48ee('0x4f')]({},_0x2fa838,_0x47f1d6[_0x48ee('0x56')]);return db[_0x48ee('0x64')][_0x48ee('0x23')]({'where':_0x2fa838[_0x48ee('0x4d')]})[_0x48ee('0x2c')](function(_0x5275fb){_0x2bad6f[_0x48ee('0x23')]=_0x5275fb;if(_0x47f1d6['query'][_0x48ee('0x50')]){_0x2fa838[_0x48ee('0x65')]=[{'all':!![]}];}return db[_0x48ee('0x64')][_0x48ee('0x51')](_0x2fa838);})['then'](function(_0x2a76e6){_0x2bad6f[_0x48ee('0x52')]=_0x2a76e6;return _0x2bad6f;});}})[_0x48ee('0x2c')](respondWithFilteredResult(_0x2cd16d,_0x2fa838))[_0x48ee('0x53')](handleError(_0x2cd16d,null));};exports[_0x48ee('0x66')]=function(_0x9804d,_0x195f91,_0x257c18){var _0x4ffd81={'raw':!![],'where':{}};var _0x50ba06={};var _0x54d961={'count':0x0,'rows':[]};return db[_0x48ee('0x3d')][_0x48ee('0x63')]({'where':{'id':_0x9804d[_0x48ee('0x55')]['id']}})['then'](handleEntityNotFound(_0x195f91,null))[_0x48ee('0x2c')](function(_0x36905f){if(_0x36905f){_0x50ba06[_0x48ee('0x41')]=_[_0x48ee('0x43')](db[_0x48ee('0x67')][_0x48ee('0x3e')]);_0x50ba06[_0x48ee('0x42')]=_[_0x48ee('0x43')](_0x9804d[_0x48ee('0x42')]);_0x50ba06['filters']=_[_0x48ee('0x45')](_0x50ba06[_0x48ee('0x41')],_0x50ba06[_0x48ee('0x42')]);_0x4ffd81[_0x48ee('0x46')]=_[_0x48ee('0x45')](_0x50ba06[_0x48ee('0x41')],qs[_0x48ee('0x47')](_0x9804d[_0x48ee('0x42')][_0x48ee('0x47')]));_0x4ffd81[_0x48ee('0x46')]=_0x4ffd81[_0x48ee('0x46')][_0x48ee('0x48')]?_0x4ffd81[_0x48ee('0x46')]:_0x50ba06['model'];if(!_0x9804d[_0x48ee('0x42')][_0x48ee('0x49')](_0x48ee('0x4a'))){_0x4ffd81[_0x48ee('0x22')]=qs[_0x48ee('0x22')](_0x9804d[_0x48ee('0x42')][_0x48ee('0x22')]);_0x4ffd81[_0x48ee('0x24')]=qs['offset'](_0x9804d[_0x48ee('0x42')][_0x48ee('0x24')]);}_0x4ffd81[_0x48ee('0x4b')]=qs[_0x48ee('0x4c')](_0x9804d[_0x48ee('0x42')]['sort']);_0x4ffd81[_0x48ee('0x4d')]=qs[_0x48ee('0x44')](_['pick'](_0x9804d[_0x48ee('0x42')],_0x50ba06[_0x48ee('0x44')]));_0x4ffd81['where'][_0x48ee('0x68')]=_0x36905f['id'];if(_0x9804d[_0x48ee('0x42')][_0x48ee('0x32')]){_0x4ffd81[_0x48ee('0x4d')]=_[_0x48ee('0x4f')](_0x4ffd81[_0x48ee('0x4d')],{'$or':_[_0x48ee('0x33')](_0x4ffd81[_0x48ee('0x46')],function(_0x36ff31){var _0x2cf34c={};_0x2cf34c[_0x36ff31]={'$like':'%'+_0x9804d['query'][_0x48ee('0x32')]+'%'};return _0x2cf34c;})});}_0x4ffd81=_[_0x48ee('0x4f')]({},_0x4ffd81,_0x9804d[_0x48ee('0x56')]);return db['CmHopperHistory'][_0x48ee('0x23')]({'where':_0x4ffd81['where']})['then'](function(_0x1de0f0){_0x54d961[_0x48ee('0x23')]=_0x1de0f0;if(_0x9804d[_0x48ee('0x42')][_0x48ee('0x50')]){_0x4ffd81[_0x48ee('0x65')]=[{'all':!![]}];}return db[_0x48ee('0x67')]['findAll'](_0x4ffd81);})[_0x48ee('0x2c')](function(_0x86e224){_0x54d961[_0x48ee('0x52')]=_0x86e224;return _0x54d961;});}})['then'](respondWithFilteredResult(_0x195f91,_0x4ffd81))[_0x48ee('0x53')](handleError(_0x195f91,null));};exports['getHopperFinals']=function(_0x58080f,_0x16575f,_0x16cfc6){var _0x217365={'raw':!![],'where':{}};var _0x23e17d={};var _0x17d2a5={'count':0x0,'rows':[]};return db[_0x48ee('0x3d')][_0x48ee('0x63')]({'where':{'id':_0x58080f[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x16575f,null))['then'](function(_0x2f709d){if(_0x2f709d){_0x23e17d[_0x48ee('0x41')]=_[_0x48ee('0x43')](db[_0x48ee('0x69')][_0x48ee('0x3e')]);_0x23e17d[_0x48ee('0x42')]=_[_0x48ee('0x43')](_0x58080f['query']);_0x23e17d['filters']=_[_0x48ee('0x45')](_0x23e17d[_0x48ee('0x41')],_0x23e17d[_0x48ee('0x42')]);_0x217365[_0x48ee('0x46')]=_[_0x48ee('0x45')](_0x23e17d[_0x48ee('0x41')],qs[_0x48ee('0x47')](_0x58080f[_0x48ee('0x42')][_0x48ee('0x47')]));_0x217365[_0x48ee('0x46')]=_0x217365[_0x48ee('0x46')][_0x48ee('0x48')]?_0x217365['attributes']:_0x23e17d['model'];if(!_0x58080f[_0x48ee('0x42')][_0x48ee('0x49')](_0x48ee('0x4a'))){_0x217365[_0x48ee('0x22')]=qs[_0x48ee('0x22')](_0x58080f['query'][_0x48ee('0x22')]);_0x217365['offset']=qs[_0x48ee('0x24')](_0x58080f[_0x48ee('0x42')][_0x48ee('0x24')]);}_0x217365[_0x48ee('0x4b')]=qs[_0x48ee('0x4c')](_0x58080f[_0x48ee('0x42')][_0x48ee('0x4c')]);_0x217365[_0x48ee('0x4d')]=qs[_0x48ee('0x44')](_['pick'](_0x58080f[_0x48ee('0x42')],_0x23e17d['filters']));_0x217365[_0x48ee('0x4d')][_0x48ee('0x68')]=_0x2f709d['id'];if(_0x58080f['query'][_0x48ee('0x32')]){_0x217365[_0x48ee('0x4d')]=_['merge'](_0x217365[_0x48ee('0x4d')],{'$or':_[_0x48ee('0x33')](_0x217365['attributes'],function(_0x1096b8){var _0x11c772={};_0x11c772[_0x1096b8]={'$like':'%'+_0x58080f[_0x48ee('0x42')][_0x48ee('0x32')]+'%'};return _0x11c772;})});}_0x217365=_[_0x48ee('0x4f')]({},_0x217365,_0x58080f[_0x48ee('0x56')]);return db[_0x48ee('0x69')][_0x48ee('0x23')]({'where':_0x217365[_0x48ee('0x4d')]})[_0x48ee('0x2c')](function(_0x40f8cc){_0x17d2a5[_0x48ee('0x23')]=_0x40f8cc;if(_0x58080f[_0x48ee('0x42')]['includeAll']){_0x217365[_0x48ee('0x65')]=[{'all':!![]}];}return db[_0x48ee('0x69')][_0x48ee('0x51')](_0x217365);})[_0x48ee('0x2c')](function(_0x3f4f83){_0x17d2a5[_0x48ee('0x52')]=_0x3f4f83;return _0x17d2a5;});}})[_0x48ee('0x2c')](respondWithFilteredResult(_0x16575f,_0x217365))['catch'](handleError(_0x16575f,null));};exports['getHopperBlacks']=function(_0x52f528,_0x46fc2a,_0x51b507){var _0x3dbab9={'raw':!![],'where':{}};var _0x58282b={};var _0x499510={'count':0x0,'rows':[]};return db[_0x48ee('0x3d')]['findOne']({'where':{'id':_0x52f528['params']['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x46fc2a,null))[_0x48ee('0x2c')](function(_0x2411dd){if(_0x2411dd){_0x58282b[_0x48ee('0x41')]=_[_0x48ee('0x43')](db[_0x48ee('0x6a')][_0x48ee('0x3e')]);_0x58282b[_0x48ee('0x42')]=_['keys'](_0x52f528['query']);_0x58282b[_0x48ee('0x44')]=_['intersection'](_0x58282b[_0x48ee('0x41')],_0x58282b[_0x48ee('0x42')]);_0x3dbab9[_0x48ee('0x46')]=_[_0x48ee('0x45')](_0x58282b[_0x48ee('0x41')],qs[_0x48ee('0x47')](_0x52f528[_0x48ee('0x42')][_0x48ee('0x47')]));_0x3dbab9[_0x48ee('0x46')]=_0x3dbab9['attributes'][_0x48ee('0x48')]?_0x3dbab9[_0x48ee('0x46')]:_0x58282b[_0x48ee('0x41')];if(!_0x52f528[_0x48ee('0x42')]['hasOwnProperty'](_0x48ee('0x4a'))){_0x3dbab9['limit']=qs[_0x48ee('0x22')](_0x52f528[_0x48ee('0x42')][_0x48ee('0x22')]);_0x3dbab9[_0x48ee('0x24')]=qs[_0x48ee('0x24')](_0x52f528[_0x48ee('0x42')][_0x48ee('0x24')]);}_0x3dbab9[_0x48ee('0x4b')]=qs[_0x48ee('0x4c')](_0x52f528[_0x48ee('0x42')]['sort']);_0x3dbab9['where']=qs['filters'](_[_0x48ee('0x4e')](_0x52f528[_0x48ee('0x42')],_0x58282b[_0x48ee('0x44')]));_0x3dbab9['where']['VoiceQueueId']=_0x2411dd['id'];if(_0x52f528[_0x48ee('0x42')][_0x48ee('0x32')]){_0x3dbab9['where']=_['merge'](_0x3dbab9[_0x48ee('0x4d')],{'$or':_[_0x48ee('0x33')](_0x3dbab9['attributes'],function(_0x3a0994){var _0x1d983a={};_0x1d983a[_0x3a0994]={'$like':'%'+_0x52f528[_0x48ee('0x42')]['filter']+'%'};return _0x1d983a;})});}_0x3dbab9=_[_0x48ee('0x4f')]({},_0x3dbab9,_0x52f528[_0x48ee('0x56')]);return db[_0x48ee('0x6a')]['count']({'where':_0x3dbab9['where']})[_0x48ee('0x2c')](function(_0x4dcacb){_0x499510[_0x48ee('0x23')]=_0x4dcacb;if(_0x52f528[_0x48ee('0x42')]['includeAll']){_0x3dbab9[_0x48ee('0x65')]=[{'all':!![]}];}return db[_0x48ee('0x6a')][_0x48ee('0x51')](_0x3dbab9);})[_0x48ee('0x2c')](function(_0x3caa8d){_0x499510[_0x48ee('0x52')]=_0x3caa8d;return _0x499510;});}})[_0x48ee('0x2c')](respondWithFilteredResult(_0x46fc2a,_0x3dbab9))['catch'](handleError(_0x46fc2a,null));};exports['getTeams']=function(_0x2925f6,_0x22b8d3,_0x1394b7){var _0x5b355a={};var _0x2304ed={};var _0x5203af;var _0x2c1aba;return db[_0x48ee('0x3d')]['findOne']({'where':{'id':_0x2925f6['params']['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x22b8d3,null))[_0x48ee('0x2c')](function(_0x1f9751){if(_0x1f9751){_0x5203af=_0x1f9751;_0x2304ed[_0x48ee('0x41')]=_[_0x48ee('0x43')](db['Team'][_0x48ee('0x3e')]);_0x2304ed[_0x48ee('0x42')]=_[_0x48ee('0x43')](_0x2925f6[_0x48ee('0x42')]);_0x2304ed[_0x48ee('0x44')]=_[_0x48ee('0x45')](_0x2304ed[_0x48ee('0x41')],_0x2304ed[_0x48ee('0x42')]);_0x5b355a['attributes']=_['intersection'](_0x2304ed[_0x48ee('0x41')],qs['fields'](_0x2925f6[_0x48ee('0x42')][_0x48ee('0x47')]));_0x5b355a[_0x48ee('0x46')]=_0x5b355a[_0x48ee('0x46')][_0x48ee('0x48')]?_0x5b355a[_0x48ee('0x46')]:_0x2304ed[_0x48ee('0x41')];_0x5b355a['order']=qs[_0x48ee('0x4c')](_0x2925f6[_0x48ee('0x42')][_0x48ee('0x4c')]);_0x5b355a[_0x48ee('0x4d')]=qs['filters'](_[_0x48ee('0x4e')](_0x2925f6[_0x48ee('0x42')],_0x2304ed['filters']));if(_0x2925f6[_0x48ee('0x42')][_0x48ee('0x32')]){_0x5b355a['where']=_[_0x48ee('0x4f')](_0x5b355a['where'],{'$or':_[_0x48ee('0x33')](_0x5b355a[_0x48ee('0x46')],function(_0x113661){var _0x31f72d={};_0x31f72d[_0x113661]={'$like':'%'+_0x2925f6[_0x48ee('0x42')][_0x48ee('0x32')]+'%'};return _0x31f72d;})});}_0x5b355a=_[_0x48ee('0x4f')]({},_0x5b355a,_0x2925f6[_0x48ee('0x56')]);return _0x5203af['getTeams'](_0x5b355a);}})[_0x48ee('0x2c')](function(_0x9a54ba){if(_0x9a54ba){_0x2c1aba=_0x9a54ba[_0x48ee('0x48')];if(!_0x2925f6['query'][_0x48ee('0x49')](_0x48ee('0x4a'))){_0x5b355a[_0x48ee('0x22')]=qs[_0x48ee('0x22')](_0x2925f6[_0x48ee('0x42')]['limit']);_0x5b355a[_0x48ee('0x24')]=qs['offset'](_0x2925f6[_0x48ee('0x42')][_0x48ee('0x24')]);}return _0x5203af['getTeams'](_0x5b355a);}})['then'](function(_0x60886){if(_0x60886){return _0x60886?{'count':_0x2c1aba,'rows':_0x60886}:null;}})[_0x48ee('0x2c')](respondWithResult(_0x22b8d3,null))['catch'](handleError(_0x22b8d3,null));};exports['addTeams']=function(_0x10722b,_0x23ce71,_0x5ced42){var _0x101a96=_0x10722b[_0x48ee('0x58')][_0x48ee('0x6b')];var _0x3cf81f=_[_0x48ee('0x33')](_0x101a96,'id');return db['Team']['findAll']({'where':{'id':_0x3cf81f},'attributes':['id'],'include':[{'model':db[_0x48ee('0x6c')],'as':'Agents','attributes':['id',_0x48ee('0x38'),_0x48ee('0x6d'),'voicePause',_0x48ee('0x6e')],'raw':!![]}]})[_0x48ee('0x2c')](function(_0x1c06e4){if(_0x1c06e4){var _0x156ff8=_[_0x48ee('0x6f')](_0x1c06e4,function(_0x5db863){var _0x1f177f=_0x5db863[_0x48ee('0x2e')]({'plain':!![]});_0x1f177f[_0x48ee('0x70')][_0x48ee('0x71')](function(_0x5a7f0f){_0x5a7f0f[_0x48ee('0x72')]=_[_0x48ee('0x37')](_0x101a96,{'id':_0x1f177f['id']})[_0x48ee('0x72')];});return _0x1f177f[_0x48ee('0x70')];});return db[_0x48ee('0x3d')][_0x48ee('0x37')]({'where':{'id':_0x10722b[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](function(_0x471967){return db['sequelize']['transaction'](function(_0x27bfe3){return _0x471967['addTeams'](_0x3cf81f,{'transaction':_0x27bfe3})[_0x48ee('0x2c')](function(){return BPromise[_0x48ee('0x73')](_0x101a96,function(_0x5527a2){return db[_0x48ee('0x74')][_0x48ee('0x75')]({'TeamId':_0x5527a2['id'],'VoiceQueueId':_0x10722b[_0x48ee('0x55')]['id'],'penalty':_0x5527a2[_0x48ee('0x72')]},{'transaction':_0x27bfe3});});})[_0x48ee('0x2c')](function(){return BPromise[_0x48ee('0x73')](_0x156ff8,function(_0x49d76d){return db['UserVoiceQueue'][_0x48ee('0x76')]({'where':{'UserId':_0x49d76d['id'],'VoiceQueueId':_0x10722b[_0x48ee('0x55')]['id']},'defaults':{'penalty':_0x49d76d['penalty']},'transaction':_0x27bfe3});});})[_0x48ee('0x2c')](function(){return BPromise[_0x48ee('0x73')](_[_0x48ee('0x32')](_0x156ff8,{'online':!![]}),function(_0x2d4f59){return db[_0x48ee('0x77')][_0x48ee('0x75')]({'membername':_0x2d4f59['name'],'UserId':_0x2d4f59['id'],'queue_name':_0x471967[_0x48ee('0x38')],'VoiceQueueId':_0x471967['id'],'interface':_['isNil'](_0x2d4f59[_0x48ee('0x6e')])?util['format'](_0x48ee('0x78'),_0x2d4f59['name']):_0x2d4f59[_0x48ee('0x6e')],'paused':_0x2d4f59[_0x48ee('0x79')]||![],'penalty':_0x2d4f59[_0x48ee('0x72')]},{'transaction':_0x27bfe3});});})['then'](function(){_0x156ff8[_0x48ee('0x71')](function(_0xcfa973){socket['emit'](_0x48ee('0x7a'),{'UserId':_0xcfa973['id'],'VoiceQueueId':_0x471967['id']});});});});});}})['then'](respondWithStatusCode(_0x23ce71,null))[_0x48ee('0x53')](handleError(_0x23ce71,null));};exports[_0x48ee('0x7b')]=function(_0x18c6dd,_0x1e1c23,_0x4f7006){return db['Team']['findAll']({'where':{'id':_0x18c6dd['query'][_0x48ee('0x7c')]},'attributes':['id'],'include':[{'model':db[_0x48ee('0x6c')],'as':_0x48ee('0x70'),'attributes':['id'],'raw':!![]}]})[_0x48ee('0x2c')](handleEntityNotFound(_0x1e1c23,null))[_0x48ee('0x2c')](function(_0x28babe){var _0x2204aa=_[_0x48ee('0x33')](_0x28babe,'id');var _0x2aaae6=[];var _0x2467d9=[];var _0x3a72ba=squel[_0x48ee('0x7d')]();_0x3a72ba[_0x48ee('0x7e')](_0x48ee('0x7f'))[_0x48ee('0x80')]('team_has_voice_queues','tq')['join'](_0x48ee('0x81'),'ut',_0x48ee('0x82'))[_0x48ee('0x4d')]('VoiceQueueId\x20=\x20?',_0x18c6dd[_0x48ee('0x55')]['id']);for(var _0xd2144a=0x0;_0xd2144a<_0x28babe[_0x48ee('0x48')];_0xd2144a+=0x1){let _0x78355f=_0x28babe[_0xd2144a];for(var _0xb8087d=0x0;_0xb8087d<_0x78355f[_0x48ee('0x70')][_0x48ee('0x48')];_0xb8087d+=0x1){let _0x37013e=_0x78355f[_0x48ee('0x70')][_0xb8087d];var _0x631188=_0x3a72ba['clone']();_0x631188[_0x48ee('0x4d')]('ut.UserId\x20=\x20?',_0x37013e['id']);_0x2467d9[_0x48ee('0x83')](db[_0x48ee('0x84')][_0x48ee('0x42')](_0x631188[_0x48ee('0x85')](),{'type':db[_0x48ee('0x84')][_0x48ee('0x86')]['SELECT']})[_0x48ee('0x2c')](function(_0x67aafb){if(_0x67aafb[_0x48ee('0x48')]===0x1){return _0x37013e['id'];}else{var _0x9ad740=_[_0x48ee('0x87')](_[_0x48ee('0x33')](_0x67aafb,'TeamId'),function(_0x25facf){return _[_0x48ee('0x35')](_0x2204aa,_0x25facf);});if(_0x9ad740){return _0x37013e['id'];}}}));}}return BPromise[_0x48ee('0x88')](_0x2467d9)['then'](function(_0x3b792a){_0x2aaae6=_(_0x2aaae6)[_0x48ee('0x89')](_0x3b792a)['compact']()[_0x48ee('0x34')]();return db[_0x48ee('0x3d')][_0x48ee('0x37')]({'where':{'id':_0x18c6dd[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](function(_0x54bb39){return db['sequelize'][_0x48ee('0x8a')](function(_0x1a1d65){return _0x54bb39['removeTeams'](_0x18c6dd[_0x48ee('0x42')][_0x48ee('0x7c')],{'transaction':_0x1a1d65})[_0x48ee('0x2c')](function(){if(!_['isEmpty'](_0x2aaae6)){return _0x54bb39['removeAgents'](_0x2aaae6,{'transaction':_0x1a1d65})[_0x48ee('0x2c')](function(){return db['UserVoiceQueueRt'][_0x48ee('0x2d')]({'where':{'VoiceQueueId':_0x18c6dd[_0x48ee('0x55')]['id'],'UserId':_0x2aaae6},'transaction':_0x1a1d65});});}})[_0x48ee('0x2c')](function(){_0x2aaae6[_0x48ee('0x71')](function(_0xca107d){socket[_0x48ee('0x8b')](_0x48ee('0x8c'),{'UserId':_0xca107d,'VoiceQueueId':_0x54bb39['id']});});});});});});})[_0x48ee('0x2c')](respondWithStatusCode(_0x1e1c23,null))[_0x48ee('0x53')](handleError(_0x1e1c23,null));};exports[_0x48ee('0x8d')]=function(_0x3607d4,_0x50f58c,_0x2e9227){var _0x2c36d0,_0x4f537a;return db['VoiceQueue'][_0x48ee('0x37')]({'where':{'id':_0x3607d4[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x50f58c,null))[_0x48ee('0x2c')](function(_0x25c9f6){if(_0x25c9f6){_0x4f537a=_0x25c9f6;return _0x25c9f6[_0x48ee('0x8d')](_0x3607d4[_0x48ee('0x58')][_0x48ee('0x7c')],_[_0x48ee('0x60')](_0x3607d4[_0x48ee('0x58')],['ids','id'])||{})[_0x48ee('0x8e')](function(_0x32a70a){for(var _0xeb8b41=0x0;_0xeb8b41<_0x3607d4[_0x48ee('0x58')]['ids'][_0x48ee('0x48')];_0xeb8b41+=0x1){socket['emit']('userVoiceQueue:save',{'UserId':Number(_0x3607d4[_0x48ee('0x58')][_0x48ee('0x7c')][_0xeb8b41]),'VoiceQueueId':Number(_0x3607d4[_0x48ee('0x55')]['id'])});}return _0x32a70a;});}})['then'](function(_0x39e7cf){_0x2c36d0=_0x39e7cf||[];if(_0x4f537a){return db[_0x48ee('0x6c')][_0x48ee('0x51')]({'where':{'id':_0x3607d4[_0x48ee('0x58')][_0x48ee('0x7c')]},'attributes':['id','name',_0x48ee('0x6d'),'voicePause',_0x48ee('0x6e')],'raw':!![]});}})['then'](function(_0x20a543){if(!_[_0x48ee('0x8f')](_0x20a543)){var _0x59c96f=[];for(var _0x14e54e=0x0;_0x14e54e<_0x20a543[_0x48ee('0x48')];_0x14e54e++){if(_0x20a543[_0x14e54e]['online']){_0x59c96f[_0x48ee('0x83')](db['UserVoiceQueueRt'][_0x48ee('0x75')]({'membername':_0x20a543[_0x14e54e][_0x48ee('0x38')],'UserId':_0x20a543[_0x14e54e]['id'],'queue_name':_0x4f537a[_0x48ee('0x38')],'VoiceQueueId':_0x4f537a['id'],'interface':_[_0x48ee('0x90')](_0x20a543[_0x14e54e][_0x48ee('0x6e')])?util[_0x48ee('0x91')](_0x48ee('0x78'),_0x20a543[_0x14e54e][_0x48ee('0x38')]):_0x20a543[_0x14e54e]['interface'],'paused':_0x20a543[_0x14e54e][_0x48ee('0x79')]||![],'penalty':_0x3607d4[_0x48ee('0x58')][_0x48ee('0x72')]||0x0}));}}return BPromise['all'](_0x59c96f);}})[_0x48ee('0x2c')](function(){return _0x2c36d0;})[_0x48ee('0x2c')](respondWithResult(_0x50f58c,null))[_0x48ee('0x53')](handleError(_0x50f58c,null));};exports['removeAgents']=function(_0x3da79a,_0x4d35ac,_0x2c9892){return db['VoiceQueue'][_0x48ee('0x37')]({'where':{'id':_0x3da79a[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x4d35ac,null))[_0x48ee('0x2c')](function(_0x2d78e3){if(_0x2d78e3){return _0x2d78e3['removeAgents'](_0x3da79a[_0x48ee('0x42')]['ids'])[_0x48ee('0x2c')](function(){if(_[_0x48ee('0x92')](_0x3da79a[_0x48ee('0x42')]['ids'])){for(var _0x2908c2=0x0;_0x2908c2<_0x3da79a[_0x48ee('0x42')][_0x48ee('0x7c')][_0x48ee('0x48')];_0x2908c2+=0x1){socket[_0x48ee('0x8b')](_0x48ee('0x8c'),{'UserId':Number(_0x3da79a[_0x48ee('0x42')][_0x48ee('0x7c')][_0x2908c2]),'VoiceQueueId':Number(_0x3da79a['params']['id'])});}}else{socket['emit']('userVoiceQueue:remove',{'UserId':Number(_0x3da79a[_0x48ee('0x42')][_0x48ee('0x7c')]),'VoiceQueueId':Number(_0x3da79a['params']['id'])});}});}})['then'](function(_0x5e7968){return db[_0x48ee('0x77')]['destroy']({'where':{'VoiceQueueId':_0x3da79a[_0x48ee('0x55')]['id'],'UserId':_0x3da79a[_0x48ee('0x42')][_0x48ee('0x7c')]}})['then'](function(){return _0x5e7968;});})[_0x48ee('0x2c')](respondWithStatusCode(_0x4d35ac,null))['catch'](handleError(_0x4d35ac,null));};exports['getAgents']=function(_0x36c5d1,_0xd6ddd2,_0xc1c2c4){var _0x57b1e9={};var _0x1b5d2c={};var _0x21121a;var _0xeb0576;return db[_0x48ee('0x3d')][_0x48ee('0x63')]({'where':{'id':_0x36c5d1['params']['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0xd6ddd2,null))['then'](function(_0x156ab2){if(_0x156ab2){_0x21121a=_0x156ab2;_0x1b5d2c['model']=_[_0x48ee('0x43')](db[_0x48ee('0x6c')]['rawAttributes']);_0x1b5d2c[_0x48ee('0x42')]=_['keys'](_0x36c5d1[_0x48ee('0x42')]);_0x1b5d2c[_0x48ee('0x44')]=_[_0x48ee('0x45')](_0x1b5d2c[_0x48ee('0x41')],_0x1b5d2c[_0x48ee('0x42')]);_0x57b1e9[_0x48ee('0x46')]=_['intersection'](_0x1b5d2c[_0x48ee('0x41')],qs[_0x48ee('0x47')](_0x36c5d1[_0x48ee('0x42')][_0x48ee('0x47')]));_0x57b1e9[_0x48ee('0x46')]=_0x57b1e9[_0x48ee('0x46')][_0x48ee('0x48')]?_0x57b1e9[_0x48ee('0x46')]:_0x1b5d2c[_0x48ee('0x41')];_0x57b1e9['order']=qs[_0x48ee('0x4c')](_0x36c5d1[_0x48ee('0x42')]['sort']);_0x57b1e9['where']=qs['filters'](_[_0x48ee('0x4e')](_0x36c5d1[_0x48ee('0x42')],_0x1b5d2c[_0x48ee('0x44')]));if(_0x36c5d1['query'][_0x48ee('0x32')]){_0x57b1e9['where']=_[_0x48ee('0x4f')](_0x57b1e9[_0x48ee('0x4d')],{'$or':_[_0x48ee('0x33')](_0x57b1e9['attributes'],function(_0x826b3c){var _0x4196b3={};_0x4196b3[_0x826b3c]={'$like':'%'+_0x36c5d1[_0x48ee('0x42')]['filter']+'%'};return _0x4196b3;})});}_0x57b1e9=_[_0x48ee('0x4f')]({},_0x57b1e9,_0x36c5d1[_0x48ee('0x56')]);return _0x21121a[_0x48ee('0x93')](_0x57b1e9);}})[_0x48ee('0x2c')](function(_0xa13c86){if(_0xa13c86){_0xeb0576=_0xa13c86[_0x48ee('0x48')];if(!_0x36c5d1['query']['hasOwnProperty'](_0x48ee('0x4a'))){_0x57b1e9['limit']=qs[_0x48ee('0x22')](_0x36c5d1[_0x48ee('0x42')][_0x48ee('0x22')]);_0x57b1e9[_0x48ee('0x24')]=qs['offset'](_0x36c5d1[_0x48ee('0x42')][_0x48ee('0x24')]);}return _0x21121a[_0x48ee('0x93')](_0x57b1e9);}})[_0x48ee('0x2c')](function(_0x1e6805){if(_0x1e6805){return _0x1e6805?{'count':_0xeb0576,'rows':_0x1e6805}:null;}})[_0x48ee('0x2c')](respondWithResult(_0xd6ddd2,null))[_0x48ee('0x53')](handleError(_0xd6ddd2,null));};exports[_0x48ee('0x94')]=function(_0x5711cd,_0x3500e9,_0x4617e8){var _0x1da0f8={};var _0x4d06f7={};var _0x141063;var _0x277a49;return db[_0x48ee('0x3d')]['findOne']({'where':{'id':_0x5711cd[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x3500e9,null))[_0x48ee('0x2c')](function(_0x3ece50){if(_0x3ece50){_0x141063=_0x3ece50;_0x4d06f7[_0x48ee('0x41')]=_[_0x48ee('0x43')](db[_0x48ee('0x77')][_0x48ee('0x3e')]);_0x4d06f7[_0x48ee('0x42')]=_[_0x48ee('0x43')](_0x5711cd['query']);_0x4d06f7[_0x48ee('0x44')]=_['intersection'](_0x4d06f7[_0x48ee('0x41')],_0x4d06f7['query']);_0x1da0f8[_0x48ee('0x46')]=_['intersection'](_0x4d06f7['model'],qs[_0x48ee('0x47')](_0x5711cd[_0x48ee('0x42')][_0x48ee('0x47')]));_0x1da0f8[_0x48ee('0x46')]=_0x1da0f8['attributes'][_0x48ee('0x48')]?_0x1da0f8[_0x48ee('0x46')]:_0x4d06f7[_0x48ee('0x41')];_0x1da0f8[_0x48ee('0x4b')]=qs[_0x48ee('0x4c')](_0x5711cd[_0x48ee('0x42')][_0x48ee('0x4c')]);_0x1da0f8[_0x48ee('0x4d')]=qs[_0x48ee('0x44')](_['pick'](_0x5711cd[_0x48ee('0x42')],_0x4d06f7[_0x48ee('0x44')]));if(_0x5711cd[_0x48ee('0x42')][_0x48ee('0x32')]){_0x1da0f8['where']=_[_0x48ee('0x4f')](_0x1da0f8[_0x48ee('0x4d')],{'$or':_['map'](_0x1da0f8[_0x48ee('0x46')],function(_0x1fd174){var _0x376395={};_0x376395[_0x1fd174]={'$like':'%'+_0x5711cd[_0x48ee('0x42')][_0x48ee('0x32')]+'%'};return _0x376395;})});}_0x1da0f8=_[_0x48ee('0x4f')]({},_0x1da0f8,_0x5711cd[_0x48ee('0x56')]);return _0x141063[_0x48ee('0x94')](_0x1da0f8);}})['then'](function(_0x293895){if(_0x293895){_0x277a49=_0x293895[_0x48ee('0x48')];if(!_0x5711cd[_0x48ee('0x42')]['hasOwnProperty']('nolimit')){_0x1da0f8['limit']=qs[_0x48ee('0x22')](_0x5711cd[_0x48ee('0x42')][_0x48ee('0x22')]);_0x1da0f8[_0x48ee('0x24')]=qs[_0x48ee('0x24')](_0x5711cd[_0x48ee('0x42')][_0x48ee('0x24')]);}return _0x141063[_0x48ee('0x94')](_0x1da0f8);}})[_0x48ee('0x2c')](function(_0x316c0f){return _0x316c0f?{'count':_0x277a49,'rows':_0x316c0f}:null;})[_0x48ee('0x2c')](respondWithResult(_0x3500e9,null))['catch'](handleError(_0x3500e9,null));};exports[_0x48ee('0x95')]=function(_0x23b718,_0x353a8d,_0x1570c5){var _0xdd4214={};var _0x27aaca={};var _0x500059;var _0x451590;return db[_0x48ee('0x3d')]['findOne']({'where':{'id':_0x23b718[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x353a8d,null))[_0x48ee('0x2c')](function(_0x31b9eb){if(_0x31b9eb){_0x500059=_0x31b9eb;_0x27aaca['model']=_[_0x48ee('0x43')](db[_0x48ee('0x96')][_0x48ee('0x3e')]);_0x27aaca[_0x48ee('0x42')]=_['keys'](_0x23b718[_0x48ee('0x42')]);_0x27aaca[_0x48ee('0x44')]=_[_0x48ee('0x45')](_0x27aaca['model'],_0x27aaca['query']);_0xdd4214[_0x48ee('0x46')]=_[_0x48ee('0x45')](_0x27aaca[_0x48ee('0x41')],qs['fields'](_0x23b718[_0x48ee('0x42')][_0x48ee('0x47')]));_0xdd4214[_0x48ee('0x46')]=_0xdd4214[_0x48ee('0x46')]['length']?_0xdd4214[_0x48ee('0x46')]:_0x27aaca[_0x48ee('0x41')];_0xdd4214[_0x48ee('0x4b')]=qs[_0x48ee('0x4c')](_0x23b718[_0x48ee('0x42')][_0x48ee('0x4c')]);_0xdd4214[_0x48ee('0x4d')]=qs[_0x48ee('0x44')](_[_0x48ee('0x4e')](_0x23b718[_0x48ee('0x42')],_0x27aaca[_0x48ee('0x44')]));if(_0x23b718['query'][_0x48ee('0x32')]){_0xdd4214[_0x48ee('0x4d')]=_[_0x48ee('0x4f')](_0xdd4214[_0x48ee('0x4d')],{'$or':_[_0x48ee('0x33')](_0xdd4214[_0x48ee('0x46')],function(_0x2f419b){var _0x353a82={};_0x353a82[_0x2f419b]={'$like':'%'+_0x23b718['query'][_0x48ee('0x32')]+'%'};return _0x353a82;})});}_0xdd4214=_[_0x48ee('0x4f')]({},_0xdd4214,_0x23b718[_0x48ee('0x56')]);return _0x500059['getLists'](_0xdd4214);}})[_0x48ee('0x2c')](function(_0x1b3137){if(_0x1b3137){_0x451590=_0x1b3137[_0x48ee('0x48')];if(!_0x23b718[_0x48ee('0x42')][_0x48ee('0x49')](_0x48ee('0x4a'))){_0xdd4214[_0x48ee('0x22')]=qs[_0x48ee('0x22')](_0x23b718[_0x48ee('0x42')][_0x48ee('0x22')]);_0xdd4214['offset']=qs[_0x48ee('0x24')](_0x23b718['query'][_0x48ee('0x24')]);}return _0x500059[_0x48ee('0x95')](_0xdd4214);}})['then'](function(_0x4f274f){if(_0x4f274f){return _0x4f274f?{'count':_0x451590,'rows':_0x4f274f}:null;}})['then'](respondWithResult(_0x353a8d,null))['catch'](handleError(_0x353a8d,null));};exports[_0x48ee('0x97')]=function(_0x226e54,_0x56f185,_0x3591f0){var _0x211699,_0x5f32f9;return db['VoiceQueue'][_0x48ee('0x37')]({'where':{'id':_0x226e54[_0x48ee('0x55')]['id']}})['then'](handleEntityNotFound(_0x56f185,null))[_0x48ee('0x2c')](function(_0x2cc1fc){if(_0x2cc1fc){_0x5f32f9=_0x2cc1fc;return _0x2cc1fc[_0x48ee('0x97')](_0x226e54[_0x48ee('0x58')][_0x48ee('0x7c')],_[_0x48ee('0x60')](_0x226e54[_0x48ee('0x58')],['ids','id'])||{});}return null;})[_0x48ee('0x8e')](function(_0x35acfd){var _0x355f53;_0x211699=_0x35acfd||[];var _0x57a1c3=[];if(_0x35acfd){for(var _0x1f0e55=0x0;_0x1f0e55<_0x35acfd['length'];_0x1f0e55+=0x1){var _0x4bdb3f=_0x35acfd[_0x1f0e55]['get']({'plain':!![]});_0x5f32f9[_0x48ee('0x98')]=_0x226e54['body']['dialCheckDuplicateType']?_0x226e54[_0x48ee('0x58')][_0x48ee('0x98')]:_0x5f32f9[_0x48ee('0x98')];switch(_0x5f32f9['dialCheckDuplicateType']){case'always':_0x355f53=squel['insert']()['into']('cm_hopper')['fromQuery']([_0x48ee('0x99'),_0x48ee('0x9a'),'ContactId',_0x48ee('0x9b'),'VoiceQueueId','createdAt',_0x48ee('0x61')],squel['select']()['field']('phone',_0x48ee('0x99'))[_0x48ee('0x7e')](_0x48ee('0x9c'),_0x48ee('0x9a'))['field']('id',_0x48ee('0x9d'))[_0x48ee('0x7e')](_0x4bdb3f[_0x48ee('0x9e')][_0x48ee('0x85')](),'ListId')[_0x48ee('0x7e')](_0x226e54[_0x48ee('0x55')]['id'][_0x48ee('0x85')](),_0x48ee('0x68'))[_0x48ee('0x7e')](_0x48ee('0x9c'),_0x48ee('0x5f'))[_0x48ee('0x7e')]('NOW()',_0x48ee('0x61'))['from'](_0x48ee('0x9f'))[_0x48ee('0x4d')]('deletedAt\x20IS\x20NULL')[_0x48ee('0x4d')](_0x48ee('0xa0'),_0x4bdb3f['CmListId'][_0x48ee('0x85')]())['where'](_0x48ee('0xa1'))[_0x48ee('0x4d')](_0x48ee('0xa2'),squel[_0x48ee('0x7d')]()[_0x48ee('0x7e')](_0x48ee('0xa3'))['from'](_0x48ee('0xa4'))[_0x48ee('0x4d')]('VoiceQueueId\x20=\x20?',_0x226e54[_0x48ee('0x55')]['id'][_0x48ee('0x85')]()))[_0x48ee('0x4d')]('phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x48ee('0x7e')](_0x48ee('0xa5'))[_0x48ee('0x80')](_0x48ee('0xa6'))[_0x48ee('0x4d')](_0x48ee('0xa7'),_0x226e54[_0x48ee('0x55')]['id'][_0x48ee('0x85')]())))[_0x48ee('0x85')]();break;case _0x48ee('0xa8'):_0x355f53=squel[_0x48ee('0xa9')]()['into']('cm_hopper')[_0x48ee('0xaa')](['phone',_0x48ee('0x9a'),_0x48ee('0x9d'),_0x48ee('0x9b'),'VoiceQueueId','createdAt','updatedAt'],squel[_0x48ee('0x7d')]()[_0x48ee('0x7e')](_0x48ee('0x99'),_0x48ee('0x99'))[_0x48ee('0x7e')](_0x48ee('0x9c'),'scheduledAt')[_0x48ee('0x7e')]('id',_0x48ee('0x9d'))[_0x48ee('0x7e')](_0x4bdb3f['CmListId'][_0x48ee('0x85')](),_0x48ee('0x9b'))[_0x48ee('0x7e')](_0x226e54['params']['id'][_0x48ee('0x85')](),_0x48ee('0x68'))[_0x48ee('0x7e')]('NOW()',_0x48ee('0x5f'))[_0x48ee('0x7e')]('NOW()',_0x48ee('0x61'))[_0x48ee('0x80')](_0x48ee('0x9f'))[_0x48ee('0x4d')](_0x48ee('0xab'))['where'](_0x48ee('0xa0'),_0x4bdb3f['CmListId'][_0x48ee('0x85')]())[_0x48ee('0x4d')](_0x48ee('0xa1'))[_0x48ee('0x4d')](_0x48ee('0xa2'),squel[_0x48ee('0x7d')]()[_0x48ee('0x7e')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0x48ee('0xa7'),_0x226e54[_0x48ee('0x55')]['id'][_0x48ee('0x85')]())))[_0x48ee('0x85')]();break;default:_0x355f53=squel[_0x48ee('0xa9')]()[_0x48ee('0xac')](_0x48ee('0xa6'))[_0x48ee('0xaa')](['phone',_0x48ee('0x9a'),'ContactId',_0x48ee('0x9b'),_0x48ee('0x68'),_0x48ee('0x5f'),_0x48ee('0x61')],squel[_0x48ee('0x7d')]()['field'](_0x48ee('0x99'),_0x48ee('0x99'))[_0x48ee('0x7e')](_0x48ee('0x9c'),_0x48ee('0x9a'))['field']('id',_0x48ee('0x9d'))[_0x48ee('0x7e')](_0x4bdb3f[_0x48ee('0x9e')][_0x48ee('0x85')](),_0x48ee('0x9b'))[_0x48ee('0x7e')](_0x226e54[_0x48ee('0x55')]['id'][_0x48ee('0x85')](),'VoiceQueueId')[_0x48ee('0x7e')](_0x48ee('0x9c'),_0x48ee('0x5f'))[_0x48ee('0x7e')]('NOW()',_0x48ee('0x61'))[_0x48ee('0x80')](_0x48ee('0x9f'))['where']('deletedAt\x20IS\x20NULL')['where'](_0x48ee('0xa0'),_0x4bdb3f[_0x48ee('0x9e')][_0x48ee('0x85')]())[_0x48ee('0x4d')](_0x48ee('0xa1')))[_0x48ee('0x85')]();}_0x57a1c3[_0x48ee('0x83')](db[_0x48ee('0x84')]['query'](_0x355f53));}return BPromise[_0x48ee('0x88')](_0x57a1c3);}})['then'](function(){return _0x211699;})['then'](respondWithResult(_0x56f185,null))['catch'](handleError(_0x56f185,null));};exports[_0x48ee('0xad')]=function(_0x1e0421,_0x49ce9b,_0x360c81){return db[_0x48ee('0x3d')][_0x48ee('0x37')]({'where':{'id':_0x1e0421[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x49ce9b,null))['then'](function(_0x3f412d){if(_0x3f412d){return _0x3f412d[_0x48ee('0xad')](_0x1e0421[_0x48ee('0x42')][_0x48ee('0x7c')]);}})[_0x48ee('0x2c')](function(_0x199794){if(_0x199794){return db[_0x48ee('0x64')][_0x48ee('0x2d')]({'where':{'ListId':_0x1e0421['query'][_0x48ee('0x7c')],'VoiceQueueId':_0x1e0421[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](function(){return _0x199794;});}})[_0x48ee('0x2c')](respondWithStatusCode(_0x49ce9b,null))['catch'](handleError(_0x49ce9b,null));};exports['getBlackLists']=function(_0x1f872d,_0x3786d1,_0x4ff630){var _0x5de744={};var _0x629515={};var _0xed4618;var _0x23c1ff;return db['VoiceQueue'][_0x48ee('0x63')]({'where':{'id':_0x1f872d[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x3786d1,null))[_0x48ee('0x2c')](function(_0x27732a){if(_0x27732a){_0xed4618=_0x27732a;_0x629515[_0x48ee('0x41')]=_[_0x48ee('0x43')](db['CmList'][_0x48ee('0x3e')]);_0x629515['query']=_[_0x48ee('0x43')](_0x1f872d[_0x48ee('0x42')]);_0x629515['filters']=_[_0x48ee('0x45')](_0x629515[_0x48ee('0x41')],_0x629515['query']);_0x5de744['attributes']=_[_0x48ee('0x45')](_0x629515[_0x48ee('0x41')],qs[_0x48ee('0x47')](_0x1f872d[_0x48ee('0x42')][_0x48ee('0x47')]));_0x5de744[_0x48ee('0x46')]=_0x5de744[_0x48ee('0x46')][_0x48ee('0x48')]?_0x5de744[_0x48ee('0x46')]:_0x629515[_0x48ee('0x41')];_0x5de744[_0x48ee('0x4b')]=qs['sort'](_0x1f872d[_0x48ee('0x42')][_0x48ee('0x4c')]);_0x5de744[_0x48ee('0x4d')]=qs[_0x48ee('0x44')](_[_0x48ee('0x4e')](_0x1f872d['query'],_0x629515['filters']));if(_0x1f872d[_0x48ee('0x42')][_0x48ee('0x32')]){_0x5de744['where']=_[_0x48ee('0x4f')](_0x5de744[_0x48ee('0x4d')],{'$or':_[_0x48ee('0x33')](_0x5de744[_0x48ee('0x46')],function(_0x189d37){var _0x33eb1f={};_0x33eb1f[_0x189d37]={'$like':'%'+_0x1f872d[_0x48ee('0x42')]['filter']+'%'};return _0x33eb1f;})});}_0x5de744=_[_0x48ee('0x4f')]({},_0x5de744,_0x1f872d['options']);return _0xed4618['getBlackLists'](_0x5de744);}})[_0x48ee('0x2c')](function(_0x5bb220){if(_0x5bb220){_0x23c1ff=_0x5bb220['length'];if(!_0x1f872d[_0x48ee('0x42')][_0x48ee('0x49')](_0x48ee('0x4a'))){_0x5de744[_0x48ee('0x22')]=qs[_0x48ee('0x22')](_0x1f872d[_0x48ee('0x42')]['limit']);_0x5de744[_0x48ee('0x24')]=qs[_0x48ee('0x24')](_0x1f872d['query'][_0x48ee('0x24')]);}return _0xed4618[_0x48ee('0xae')](_0x5de744);}})['then'](function(_0x26aa84){if(_0x26aa84){return _0x26aa84?{'count':_0x23c1ff,'rows':_0x26aa84}:null;}})[_0x48ee('0x2c')](respondWithResult(_0x3786d1,null))[_0x48ee('0x53')](handleError(_0x3786d1,null));};exports['addBlackLists']=function(_0x1360ab,_0x5defcc,_0x10d70c){var _0x355a08,_0x584f1e;return db[_0x48ee('0x3d')][_0x48ee('0x37')]({'where':{'id':_0x1360ab[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x5defcc,null))['then'](function(_0x4f6d2f){if(_0x4f6d2f){_0x584f1e=_0x4f6d2f;return _0x4f6d2f[_0x48ee('0xaf')](_0x1360ab[_0x48ee('0x58')][_0x48ee('0x7c')],_['omit'](_0x1360ab['body'],['ids','id'])||{});}return null;})['spread'](function(_0x211c8b){var _0xf3753;_0x355a08=_0x211c8b||[];var _0x2dd4bc=[];if(_0x211c8b){for(var _0x15b3c9=0x0;_0x15b3c9<_0x211c8b['length'];_0x15b3c9+=0x1){var _0x95fb11=_0x211c8b[_0x15b3c9]['get']({'plain':!![]});_0xf3753=squel[_0x48ee('0xa9')]()['into']('cm_hopper_black')[_0x48ee('0xaa')]([_0x48ee('0x99'),'ContactId',_0x48ee('0x9b'),_0x48ee('0x68'),_0x48ee('0x5f'),_0x48ee('0x61')],squel[_0x48ee('0x7d')]()['field'](_0x48ee('0x99'),_0x48ee('0x99'))[_0x48ee('0x7e')]('id',_0x48ee('0x9d'))['field'](_0x95fb11['CmListId']['toString'](),_0x48ee('0x9b'))[_0x48ee('0x7e')](_0x1360ab[_0x48ee('0x55')]['id'][_0x48ee('0x85')](),_0x48ee('0x68'))['field'](_0x48ee('0x9c'),_0x48ee('0x5f'))[_0x48ee('0x7e')](_0x48ee('0x9c'),_0x48ee('0x61'))['from'](_0x48ee('0x9f'))[_0x48ee('0x4d')](_0x48ee('0xab'))['where'](_0x48ee('0xa0'),_0x95fb11[_0x48ee('0x9e')][_0x48ee('0x85')]())[_0x48ee('0x4d')](_0x48ee('0xa1')))[_0x48ee('0x85')]();_0x2dd4bc[_0x48ee('0x83')](db[_0x48ee('0x84')][_0x48ee('0x42')](_0xf3753));}return BPromise['all'](_0x2dd4bc);}})['then'](function(){return _0x355a08;})[_0x48ee('0x2c')](respondWithResult(_0x5defcc,null))['catch'](handleError(_0x5defcc,null));};exports[_0x48ee('0xb0')]=function(_0x49f7d2,_0x4a842a,_0x371a9c){return db[_0x48ee('0x3d')][_0x48ee('0x37')]({'where':{'id':_0x49f7d2[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](handleEntityNotFound(_0x4a842a,null))[_0x48ee('0x2c')](function(_0x439b2f){if(_0x439b2f){return _0x439b2f[_0x48ee('0xb0')](_0x49f7d2[_0x48ee('0x42')][_0x48ee('0x7c')]);}})[_0x48ee('0x2c')](function(_0x5d23dd){if(_0x5d23dd){return db[_0x48ee('0x6a')][_0x48ee('0x2d')]({'where':{'ListId':_0x49f7d2[_0x48ee('0x42')][_0x48ee('0x7c')],'VoiceQueueId':_0x49f7d2[_0x48ee('0x55')]['id']}})[_0x48ee('0x2c')](function(){return _0x5d23dd;});}})[_0x48ee('0x2c')](respondWithStatusCode(_0x4a842a,null))[_0x48ee('0x53')](handleError(_0x4a842a,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 05acf9d..b370c8a 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 _0x3b57=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoiceQueue','setMaxListeners'];(function(_0x30861a,_0x337deb){var _0xa37ad6=function(_0x4dad90){while(--_0x4dad90){_0x30861a['push'](_0x30861a['shift']());}};_0xa37ad6(++_0x337deb);}(_0x3b57,0x130));var _0x73b5=function(_0xf738ad,_0x5e1d7f){_0xf738ad=_0xf738ad-0x0;var _0x598570=_0x3b57[_0xf738ad];return _0x598570;};'use strict';var EventEmitter=require(_0x73b5('0x0'));var VoiceQueue=require(_0x73b5('0x1'))['db'][_0x73b5('0x2')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x73b5('0x3')](0x0);var events={'afterCreate':_0x73b5('0x4'),'afterUpdate':_0x73b5('0x5'),'afterDestroy':_0x73b5('0x6')};function emitEvent(_0x5cc17a){return function(_0x2452ab,_0x3f5838,_0x20bbf6){VoiceQueueEvents[_0x73b5('0x7')](_0x5cc17a+':'+_0x2452ab['id'],_0x2452ab);VoiceQueueEvents[_0x73b5('0x7')](_0x5cc17a,_0x2452ab);_0x20bbf6(null);};}for(var e in events){if(events[_0x73b5('0x8')](e)){var event=events[e];VoiceQueue[_0x73b5('0x9')](e,emitEvent(event));}}module[_0x73b5('0xa')]=VoiceQueueEvents; \ No newline at end of file +var _0x1158=['setMaxListeners','save','update','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x35e768,_0xbe0d60){var _0x58cc5f=function(_0x1b12fb){while(--_0x1b12fb){_0x35e768['push'](_0x35e768['shift']());}};_0x58cc5f(++_0xbe0d60);}(_0x1158,0xce));var _0x8115=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x1158[_0x47aa64];return _0x549c7a;};'use strict';var EventEmitter=require(_0x8115('0x0'));var VoiceQueue=require(_0x8115('0x1'))['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x8115('0x2')](0x0);var events={'afterCreate':_0x8115('0x3'),'afterUpdate':_0x8115('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5e6f83){return function(_0x164b13,_0x8a4752,_0x290f5a){VoiceQueueEvents[_0x8115('0x5')](_0x5e6f83+':'+_0x164b13['id'],_0x164b13);VoiceQueueEvents[_0x8115('0x5')](_0x5e6f83,_0x164b13);_0x290f5a(null);};}for(var e in events){if(events[_0x8115('0x6')](e)){var event=events[e];VoiceQueue[_0x8115('0x7')](e,emitEvent(event));}}module['exports']=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index c508c52..bd6fb86 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 _0x70e0=['voice_queues','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','./voiceQueue.attributes'];(function(_0x3f6b67,_0x2736d1){var _0x3d2b4c=function(_0x402dd4){while(--_0x402dd4){_0x3f6b67['push'](_0x3f6b67['shift']());}};_0x3d2b4c(++_0x2736d1);}(_0x70e0,0x17b));var _0x070e=function(_0x5060d3,_0x83297f){_0x5060d3=_0x5060d3-0x0;var _0x44ca3e=_0x70e0[_0x5060d3];return _0x44ca3e;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('VoiceQueue',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x008c=['define','voice_queues','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceQueue.attributes','exports'];(function(_0x25d386,_0x108d0d){var _0x857f4a=function(_0x3eb98d){while(--_0x3eb98d){_0x25d386['push'](_0x25d386['shift']());}};_0x857f4a(++_0x108d0d);}(_0x008c,0x188));var _0xc008=function(_0x166146,_0x1f34c6){_0x166146=_0x166146-0x0;var _0x9c7390=_0x008c[_0x166146];return _0x9c7390;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var logger=require(_0xc008('0x2'))(_0xc008('0x3'));var moment=require(_0xc008('0x4'));var BPromise=require('bluebird');var rp=require(_0xc008('0x5'));var fs=require('fs');var path=require(_0xc008('0x6'));var rimraf=require(_0xc008('0x7'));var config=require(_0xc008('0x8'));var attributes=require(_0xc008('0x9'));module[_0xc008('0xa')]=function(_0x13aa7,_0x39bb5e){return _0x13aa7[_0xc008('0xb')]('VoiceQueue',attributes,{'tableName':_0xc008('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 a5c5408..e42a24a 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 _0xd473=['code','message','GetVoiceQueue','VoiceQueue','findAll','options','raw','limit','include','map','model','attributes','debug','catch','ShowVoiceQueue','find','where','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','redis','defaults','socket.io-emitter','request','then','info','VoiceQueue,\x20%s,\x20%s','request\x20sent','error'];(function(_0x4eb2fc,_0x5c7e4a){var _0x536273=function(_0x597e56){while(--_0x597e56){_0x4eb2fc['push'](_0x4eb2fc['shift']());}};_0x536273(++_0x5c7e4a);}(_0xd473,0xf6));var _0x3d47=function(_0x1a0233,_0x5ee72f){_0x1a0233=_0x1a0233-0x0;var _0xc0c38=_0xd473[_0x1a0233];return _0xc0c38;};'use strict';var _=require(_0x3d47('0x0'));var util=require(_0x3d47('0x1'));var moment=require(_0x3d47('0x2'));var BPromise=require(_0x3d47('0x3'));var rs=require(_0x3d47('0x4'));var fs=require('fs');var Redis=require(_0x3d47('0x5'));var db=require(_0x3d47('0x6'))['db'];var utils=require(_0x3d47('0x7'));var logger=require(_0x3d47('0x8'))('rpc');var config=require(_0x3d47('0x9'));var jayson=require(_0x3d47('0xa'));var client=jayson['client']['http']({'port':0x232a});config[_0x3d47('0xb')]=_[_0x3d47('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3d47('0xd'))(new Redis(config[_0x3d47('0xb')]));require('./voiceQueue.socket')['register'](socket);function respondWithRpcPromise(_0x2d33ae,_0xdc0420,_0x54212b){return new BPromise(function(_0xc0e472,_0x27571f){return client[_0x3d47('0xe')](_0x2d33ae,_0x54212b)[_0x3d47('0xf')](function(_0x14ed54){logger[_0x3d47('0x10')](_0x3d47('0x11'),_0xdc0420,'request\x20sent');logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0xdc0420,_0x3d47('0x12'),JSON['stringify'](_0x14ed54));if(_0x14ed54[_0x3d47('0x13')]){if(_0x14ed54[_0x3d47('0x13')][_0x3d47('0x14')]===0x1f4){logger[_0x3d47('0x13')]('VoiceQueue,\x20%s,\x20%s',_0xdc0420,_0x14ed54[_0x3d47('0x13')][_0x3d47('0x15')]);return _0x27571f(_0x14ed54[_0x3d47('0x13')][_0x3d47('0x15')]);}logger[_0x3d47('0x13')](_0x3d47('0x11'),_0xdc0420,_0x14ed54[_0x3d47('0x13')][_0x3d47('0x15')]);return _0xc0e472(_0x14ed54[_0x3d47('0x13')][_0x3d47('0x15')]);}else{logger[_0x3d47('0x10')]('VoiceQueue,\x20%s,\x20%s',_0xdc0420,_0x3d47('0x12'));_0xc0e472(_0x14ed54['result'][_0x3d47('0x15')]);}})['catch'](function(_0x5059da){logger[_0x3d47('0x13')]('VoiceQueue,\x20%s,\x20%s',_0xdc0420,_0x5059da);_0x27571f(_0x5059da);});});}exports[_0x3d47('0x16')]=function(_0x4dbca9){var _0x81620e=this;return new Promise(function(_0x570f70,_0x106fee){return db[_0x3d47('0x17')][_0x3d47('0x18')]({'raw':_0x4dbca9[_0x3d47('0x19')]?_0x4dbca9[_0x3d47('0x19')][_0x3d47('0x1a')]===undefined?!![]:![]:!![],'where':_0x4dbca9[_0x3d47('0x19')]?_0x4dbca9[_0x3d47('0x19')]['where']||null:null,'attributes':_0x4dbca9[_0x3d47('0x19')]?_0x4dbca9['options']['attributes']||null:null,'limit':_0x4dbca9[_0x3d47('0x19')]?_0x4dbca9[_0x3d47('0x19')][_0x3d47('0x1b')]||null:null,'include':_0x4dbca9[_0x3d47('0x19')]?_0x4dbca9[_0x3d47('0x19')][_0x3d47('0x1c')]?_[_0x3d47('0x1d')](_0x4dbca9[_0x3d47('0x19')][_0x3d47('0x1c')],function(_0x2afb36){return{'model':db[_0x2afb36[_0x3d47('0x1e')]],'as':_0x2afb36['as'],'attributes':_0x2afb36[_0x3d47('0x1f')],'include':_0x2afb36[_0x3d47('0x1c')]?_[_0x3d47('0x1d')](_0x2afb36[_0x3d47('0x1c')],function(_0x3e86d2){return{'model':db[_0x3e86d2[_0x3d47('0x1e')]],'as':_0x3e86d2['as'],'attributes':_0x3e86d2[_0x3d47('0x1f')],'include':_0x3e86d2['include']?_[_0x3d47('0x1d')](_0x3e86d2['include'],function(_0x11ca15){return{'model':db[_0x11ca15[_0x3d47('0x1e')]],'as':_0x11ca15['as'],'attributes':_0x11ca15[_0x3d47('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3d47('0xf')](function(_0x4353f3){logger['info'](_0x3d47('0x16'),_0x4dbca9);logger[_0x3d47('0x20')](_0x3d47('0x16'),_0x4dbca9,JSON['stringify'](_0x4353f3));_0x570f70(_0x4353f3);})[_0x3d47('0x21')](function(_0x2c4e85){logger[_0x3d47('0x13')](_0x3d47('0x16'),_0x2c4e85[_0x3d47('0x15')],_0x4dbca9);_0x106fee(_0x81620e[_0x3d47('0x13')](0x1f4,_0x2c4e85['message']));});});};exports[_0x3d47('0x22')]=function(_0x4c5544){var _0x1a2341=this;return new Promise(function(_0x291c6a,_0x51d8cf){return db[_0x3d47('0x17')][_0x3d47('0x23')]({'raw':_0x4c5544[_0x3d47('0x19')]?_0x4c5544[_0x3d47('0x19')][_0x3d47('0x1a')]===undefined?!![]:![]:!![],'where':_0x4c5544['options']?_0x4c5544[_0x3d47('0x19')][_0x3d47('0x24')]||null:null,'attributes':_0x4c5544[_0x3d47('0x19')]?_0x4c5544[_0x3d47('0x19')][_0x3d47('0x1f')]||null:null,'include':_0x4c5544[_0x3d47('0x19')]?_0x4c5544[_0x3d47('0x19')]['include']?_[_0x3d47('0x1d')](_0x4c5544[_0x3d47('0x19')][_0x3d47('0x1c')],function(_0x3adde7){return{'model':db[_0x3adde7[_0x3d47('0x1e')]],'as':_0x3adde7['as'],'attributes':_0x3adde7[_0x3d47('0x1f')],'include':_0x3adde7[_0x3d47('0x1c')]?_['map'](_0x3adde7[_0x3d47('0x1c')],function(_0x2531e0){return{'model':db[_0x2531e0[_0x3d47('0x1e')]],'as':_0x2531e0['as'],'attributes':_0x2531e0[_0x3d47('0x1f')],'include':_0x2531e0[_0x3d47('0x1c')]?_[_0x3d47('0x1d')](_0x2531e0[_0x3d47('0x1c')],function(_0x46bb74){return{'model':db[_0x46bb74[_0x3d47('0x1e')]],'as':_0x46bb74['as'],'attributes':_0x46bb74[_0x3d47('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x3d47('0xf')](function(_0x3fd347){logger[_0x3d47('0x10')](_0x3d47('0x22'),_0x4c5544);logger['debug'](_0x3d47('0x22'),_0x4c5544,JSON[_0x3d47('0x25')](_0x3fd347));_0x291c6a(_0x3fd347);})[_0x3d47('0x21')](function(_0x3536b6){logger[_0x3d47('0x13')](_0x3d47('0x22'),_0x3536b6[_0x3d47('0x15')],_0x4c5544);_0x51d8cf(_0x1a2341[_0x3d47('0x13')](0x1f4,_0x3536b6[_0x3d47('0x15')]));});});}; \ No newline at end of file +var _0x0f11=['VoiceQueue,\x20%s,\x20%s','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','limit','map','include','attributes','model','info','debug','catch','ShowVoiceQueue','find','stringify','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','redis','defaults','localhost','socket.io-emitter','./voiceQueue.socket','then','request\x20sent','error','code','message'];(function(_0x467266,_0x30d2a6){var _0x494894=function(_0x5b2f56){while(--_0x5b2f56){_0x467266['push'](_0x467266['shift']());}};_0x494894(++_0x30d2a6);}(_0x0f11,0x19e));var _0x10f1=function(_0x455b00,_0x1ea176){_0x455b00=_0x455b00-0x0;var _0x42e209=_0x0f11[_0x455b00];return _0x42e209;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x10f1('0x0'));var BPromise=require(_0x10f1('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x10f1('0x2'));var db=require(_0x10f1('0x3'))['db'];var utils=require(_0x10f1('0x4'));var logger=require('../../config/logger')(_0x10f1('0x5'));var config=require(_0x10f1('0x6'));var jayson=require(_0x10f1('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x10f1('0x8')]=_[_0x10f1('0x9')](config[_0x10f1('0x8')],{'host':_0x10f1('0xa'),'port':0x18eb});var socket=require(_0x10f1('0xb'))(new Redis(config[_0x10f1('0x8')]));require(_0x10f1('0xc'))['register'](socket);function respondWithRpcPromise(_0x26ea3d,_0x57dacb,_0x12d0a9){return new BPromise(function(_0x137025,_0x174e10){return client['request'](_0x26ea3d,_0x12d0a9)[_0x10f1('0xd')](function(_0x1431eb){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x57dacb,'request\x20sent');logger['debug']('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x57dacb,_0x10f1('0xe'),JSON['stringify'](_0x1431eb));if(_0x1431eb[_0x10f1('0xf')]){if(_0x1431eb[_0x10f1('0xf')][_0x10f1('0x10')]===0x1f4){logger[_0x10f1('0xf')]('VoiceQueue,\x20%s,\x20%s',_0x57dacb,_0x1431eb[_0x10f1('0xf')][_0x10f1('0x11')]);return _0x174e10(_0x1431eb[_0x10f1('0xf')][_0x10f1('0x11')]);}logger[_0x10f1('0xf')](_0x10f1('0x12'),_0x57dacb,_0x1431eb[_0x10f1('0xf')]['message']);return _0x137025(_0x1431eb[_0x10f1('0xf')][_0x10f1('0x11')]);}else{logger['info'](_0x10f1('0x12'),_0x57dacb,_0x10f1('0xe'));_0x137025(_0x1431eb['result'][_0x10f1('0x11')]);}})['catch'](function(_0x5266ba){logger[_0x10f1('0xf')](_0x10f1('0x12'),_0x57dacb,_0x5266ba);_0x174e10(_0x5266ba);});});}exports[_0x10f1('0x13')]=function(_0x253ec3){var _0x27f561=this;return new Promise(function(_0x210bf1,_0x34ade5){return db[_0x10f1('0x14')][_0x10f1('0x15')]({'raw':_0x253ec3[_0x10f1('0x16')]?_0x253ec3[_0x10f1('0x16')][_0x10f1('0x17')]===undefined?!![]:![]:!![],'where':_0x253ec3[_0x10f1('0x16')]?_0x253ec3[_0x10f1('0x16')][_0x10f1('0x18')]||null:null,'attributes':_0x253ec3[_0x10f1('0x16')]?_0x253ec3[_0x10f1('0x16')]['attributes']||null:null,'limit':_0x253ec3[_0x10f1('0x16')]?_0x253ec3[_0x10f1('0x16')][_0x10f1('0x19')]||null:null,'include':_0x253ec3[_0x10f1('0x16')]?_0x253ec3['options']['include']?_[_0x10f1('0x1a')](_0x253ec3['options'][_0x10f1('0x1b')],function(_0x5d9026){return{'model':db[_0x5d9026['model']],'as':_0x5d9026['as'],'attributes':_0x5d9026[_0x10f1('0x1c')],'include':_0x5d9026[_0x10f1('0x1b')]?_[_0x10f1('0x1a')](_0x5d9026[_0x10f1('0x1b')],function(_0x2365d4){return{'model':db[_0x2365d4['model']],'as':_0x2365d4['as'],'attributes':_0x2365d4[_0x10f1('0x1c')],'include':_0x2365d4[_0x10f1('0x1b')]?_['map'](_0x2365d4[_0x10f1('0x1b')],function(_0x116fa5){return{'model':db[_0x116fa5[_0x10f1('0x1d')]],'as':_0x116fa5['as'],'attributes':_0x116fa5[_0x10f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x10f1('0xd')](function(_0xfe7571){logger[_0x10f1('0x1e')]('GetVoiceQueue',_0x253ec3);logger[_0x10f1('0x1f')](_0x10f1('0x13'),_0x253ec3,JSON['stringify'](_0xfe7571));_0x210bf1(_0xfe7571);})[_0x10f1('0x20')](function(_0x13da0a){logger[_0x10f1('0xf')]('GetVoiceQueue',_0x13da0a['message'],_0x253ec3);_0x34ade5(_0x27f561[_0x10f1('0xf')](0x1f4,_0x13da0a[_0x10f1('0x11')]));});});};exports[_0x10f1('0x21')]=function(_0x16d135){var _0x509354=this;return new Promise(function(_0x7dc6ba,_0x306869){return db[_0x10f1('0x14')][_0x10f1('0x22')]({'raw':_0x16d135[_0x10f1('0x16')]?_0x16d135[_0x10f1('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x16d135[_0x10f1('0x16')]?_0x16d135[_0x10f1('0x16')][_0x10f1('0x18')]||null:null,'attributes':_0x16d135[_0x10f1('0x16')]?_0x16d135[_0x10f1('0x16')][_0x10f1('0x1c')]||null:null,'include':_0x16d135[_0x10f1('0x16')]?_0x16d135[_0x10f1('0x16')][_0x10f1('0x1b')]?_['map'](_0x16d135[_0x10f1('0x16')]['include'],function(_0xd430ee){return{'model':db[_0xd430ee[_0x10f1('0x1d')]],'as':_0xd430ee['as'],'attributes':_0xd430ee[_0x10f1('0x1c')],'include':_0xd430ee[_0x10f1('0x1b')]?_[_0x10f1('0x1a')](_0xd430ee[_0x10f1('0x1b')],function(_0x395e9f){return{'model':db[_0x395e9f['model']],'as':_0x395e9f['as'],'attributes':_0x395e9f[_0x10f1('0x1c')],'include':_0x395e9f[_0x10f1('0x1b')]?_[_0x10f1('0x1a')](_0x395e9f['include'],function(_0x38a871){return{'model':db[_0x38a871[_0x10f1('0x1d')]],'as':_0x38a871['as'],'attributes':_0x38a871[_0x10f1('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x10f1('0xd')](function(_0x4a2300){logger[_0x10f1('0x1e')]('ShowVoiceQueue',_0x16d135);logger[_0x10f1('0x1f')](_0x10f1('0x21'),_0x16d135,JSON[_0x10f1('0x23')](_0x4a2300));_0x7dc6ba(_0x4a2300);})[_0x10f1('0x20')](function(_0x16e006){logger[_0x10f1('0xf')]('ShowVoiceQueue',_0x16e006[_0x10f1('0x11')],_0x16d135);_0x306869(_0x509354[_0x10f1('0xf')](0x1f4,_0x16e006[_0x10f1('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index c64dc7a..fa3198d 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 _0xf3db=['voiceQueue:','./voiceQueue.events','save','remove','update','removeListener','length'];(function(_0x1b7edf,_0x24d1ab){var _0x26492b=function(_0x4445f0){while(--_0x4445f0){_0x1b7edf['push'](_0x1b7edf['shift']());}};_0x26492b(++_0x24d1ab);}(_0xf3db,0x1c8));var _0xbf3d=function(_0x1a0cf3,_0x3a9e50){_0x1a0cf3=_0x1a0cf3-0x0;var _0x3b8742=_0xf3db[_0x1a0cf3];return _0x3b8742;};'use strict';var VoiceQueueEvents=require(_0xbf3d('0x0'));var events=[_0xbf3d('0x1'),_0xbf3d('0x2'),_0xbf3d('0x3')];function createListener(_0x470d99,_0x43c3b6){return function(_0x5d270b){_0x43c3b6['emit'](_0x470d99,_0x5d270b);};}function removeListener(_0x3c328b,_0x1e0ce3){return function(){VoiceQueueEvents[_0xbf3d('0x4')](_0x3c328b,_0x1e0ce3);};}exports['register']=function(_0x203626){for(var _0x4011be=0x0,_0x49a4a8=events[_0xbf3d('0x5')];_0x4011be<_0x49a4a8;_0x4011be++){var _0x2418b9=events[_0x4011be];var _0x12a23f=createListener(_0xbf3d('0x6')+_0x2418b9,_0x203626);VoiceQueueEvents['on'](_0x2418b9,_0x12a23f);}}; \ No newline at end of file +var _0x98e0=['voiceQueue:','./voiceQueue.events','update','emit','removeListener','register','length'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x98e0,0x71));var _0x098e=function(_0x11f1bd,_0x5a448a){_0x11f1bd=_0x11f1bd-0x0;var _0x4ce7a0=_0x98e0[_0x11f1bd];return _0x4ce7a0;};'use strict';var VoiceQueueEvents=require(_0x098e('0x0'));var events=['save','remove',_0x098e('0x1')];function createListener(_0x181851,_0x10bbfc){return function(_0x11064f){_0x10bbfc[_0x098e('0x2')](_0x181851,_0x11064f);};}function removeListener(_0x365e43,_0x2f60be){return function(){VoiceQueueEvents[_0x098e('0x3')](_0x365e43,_0x2f60be);};}exports[_0x098e('0x4')]=function(_0x286c70){for(var _0x106b56=0x0,_0x5662a6=events[_0x098e('0x5')];_0x106b56<_0x5662a6;_0x106b56++){var _0xb7c811=events[_0x106b56];var _0x53c317=createListener(_0x098e('0x6')+_0xb7c811,_0x286c70);VoiceQueueEvents['on'](_0xb7c811,_0x53c317);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 707dec0..b10c6fd 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 _0x9236=['get','isAuthenticated','index','/describe','describe','getVoiceQueuesReport','/:id','show','post','create','put','update','destroy','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0xd816e2,_0x5edac2){var _0x1f5924=function(_0x1bcbf0){while(--_0x1bcbf0){_0xd816e2['push'](_0xd816e2['shift']());}};_0x1f5924(++_0x5edac2);}(_0x9236,0x184));var _0x6923=function(_0x5101a4,_0x2c37fc){_0x5101a4=_0x5101a4-0x0;var _0x1994e8=_0x9236[_0x5101a4];return _0x1994e8;};'use strict';var multer=require(_0x6923('0x0'));var util=require(_0x6923('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x6923('0x2'));var router=express[_0x6923('0x3')]();var fs_extra=require(_0x6923('0x4'));var auth=require(_0x6923('0x5'));var interaction=require(_0x6923('0x6'));var config=require(_0x6923('0x7'));var controller=require('./voiceQueueReport.controller');router[_0x6923('0x8')]('/',auth[_0x6923('0x9')](),controller[_0x6923('0xa')]);router[_0x6923('0x8')](_0x6923('0xb'),auth['isAuthenticated'](),controller[_0x6923('0xc')]);router[_0x6923('0x8')]('/index',auth[_0x6923('0x9')](),controller[_0x6923('0xd')]);router['get'](_0x6923('0xe'),auth[_0x6923('0x9')](),controller[_0x6923('0xf')]);router[_0x6923('0x10')]('/',auth['isAuthenticated'](),controller[_0x6923('0x11')]);router[_0x6923('0x12')](_0x6923('0xe'),auth[_0x6923('0x9')](),controller[_0x6923('0x13')]);router['delete'](_0x6923('0xe'),auth[_0x6923('0x9')](),controller[_0x6923('0x14')]);module[_0x6923('0x15')]=router; \ No newline at end of file +var _0x5ebe=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceQueueReport.controller','get','isAuthenticated','index','/describe','describe','/index','getVoiceQueuesReport','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x699944,_0x2a2218){var _0x21f85c=function(_0x2fbbf7){while(--_0x2fbbf7){_0x699944['push'](_0x699944['shift']());}};_0x21f85c(++_0x2a2218);}(_0x5ebe,0xab));var _0xe5eb=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x5ebe[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0xe5eb('0x0'));var util=require(_0xe5eb('0x1'));var path=require(_0xe5eb('0x2'));var timeout=require(_0xe5eb('0x3'));var express=require(_0xe5eb('0x4'));var router=express[_0xe5eb('0x5')]();var fs_extra=require(_0xe5eb('0x6'));var auth=require(_0xe5eb('0x7'));var interaction=require(_0xe5eb('0x8'));var config=require('../../config/environment');var controller=require(_0xe5eb('0x9'));router[_0xe5eb('0xa')]('/',auth[_0xe5eb('0xb')](),controller[_0xe5eb('0xc')]);router[_0xe5eb('0xa')](_0xe5eb('0xd'),auth[_0xe5eb('0xb')](),controller[_0xe5eb('0xe')]);router[_0xe5eb('0xa')](_0xe5eb('0xf'),auth[_0xe5eb('0xb')](),controller[_0xe5eb('0x10')]);router[_0xe5eb('0xa')](_0xe5eb('0x11'),auth['isAuthenticated'](),controller[_0xe5eb('0x12')]);router[_0xe5eb('0x13')]('/',auth[_0xe5eb('0xb')](),controller[_0xe5eb('0x14')]);router['put'](_0xe5eb('0x11'),auth[_0xe5eb('0xb')](),controller[_0xe5eb('0x15')]);router[_0xe5eb('0x16')](_0xe5eb('0x11'),auth[_0xe5eb('0xb')](),controller[_0xe5eb('0x17')]);module[_0xe5eb('0x18')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index f603e7b..451535f 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 _0x87c5=['moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x482598,_0x54c1cf){var _0x4c9aae=function(_0xd8a837){while(--_0xd8a837){_0x482598['push'](_0x482598['shift']());}};_0x4c9aae(++_0x54c1cf);}(_0x87c5,0x190));var _0x587c=function(_0x360b9b,_0x2063c6){_0x360b9b=_0x360b9b-0x0;var _0xee456a=_0x87c5[_0x360b9b];return _0xee456a;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x587c('0x0'));module[_0x587c('0x1')]={'type':{'type':Sequelize[_0x587c('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x587c('0x2')]},'queue':{'type':Sequelize[_0x587c('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0x587c('0x3')]},'queuecallerleaveAt':{'type':Sequelize['DATE'],'set':function(_0x521450){var _0x30154f=moment(_0x521450);var _0xa4e8c9=moment(this[_0x587c('0x4')](_0x587c('0x5')))[_0x587c('0x6')](_0x587c('0x7'));var _0x4a201a=_0x30154f[_0x587c('0x8')](_0xa4e8c9,'seconds');this[_0x587c('0x9')](_0x587c('0xa'),_0x521450);this[_0x587c('0x9')](_0x587c('0xb'),_0x4a201a||null);}},'position':{'type':Sequelize[_0x587c('0xc')]},'count':{'type':Sequelize[_0x587c('0xc')]},'queuecallerabandon':{'type':Sequelize[_0x587c('0xd')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x587c('0x3')]},'queuecallercomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x587c('0xd')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x587c('0x3')]},'queuecallerexitreason':{'type':Sequelize[_0x587c('0x2')],'comment':_0x587c('0xe')},'originalposition':{'type':Sequelize[_0x587c('0xc')]},'channel':{'type':Sequelize[_0x587c('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x587c('0x2')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x587c('0x2')]},'exten':{'type':Sequelize[_0x587c('0x2')]},'priority':{'type':Sequelize[_0x587c('0x2')]},'holdtime':{'type':Sequelize[_0x587c('0xc')]},'mohtime':{'type':Sequelize[_0x587c('0xc')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x587c('0xd')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x587c('0x2')]},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x587c('0xf')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize[_0x587c('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0x587c('0x2')]},'thirdDisposition':{'type':Sequelize[_0x587c('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0x587c('0xc')],'defaultValue':0x0}}; \ No newline at end of file +var _0x9a18=['INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','setDataValue','queuecallerleaveAt','holdtime'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x9a18,0x154));var _0x89a1=function(_0x5970be,_0xa7e6b){_0x5970be=_0x5970be-0x0;var _0x4e7cc7=_0x9a18[_0x5970be];return _0x4e7cc7;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');module['exports']={'type':{'type':Sequelize[_0x89a1('0x0')]},'uniqueid':{'type':Sequelize[_0x89a1('0x0')]},'calleridnum':{'type':Sequelize[_0x89a1('0x0')]},'calleridname':{'type':Sequelize[_0x89a1('0x0')]},'queue':{'type':Sequelize[_0x89a1('0x0')]},'queuecallerjoinAt':{'type':Sequelize[_0x89a1('0x1')]},'queuecallerleaveAt':{'type':Sequelize[_0x89a1('0x1')],'set':function(_0xc95cb){var _0x5b3fe7=moment(_0xc95cb);var _0x4bbb42=moment(this[_0x89a1('0x2')](_0x89a1('0x3')))[_0x89a1('0x4')](_0x89a1('0x5'));var _0x421e0c=_0x5b3fe7['diff'](_0x4bbb42,_0x89a1('0x6'));this[_0x89a1('0x7')](_0x89a1('0x8'),_0xc95cb);this[_0x89a1('0x7')](_0x89a1('0x9'),_0x421e0c||null);}},'position':{'type':Sequelize[_0x89a1('0xa')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x89a1('0xb')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x89a1('0x1')]},'queuecallercomplete':{'type':Sequelize[_0x89a1('0xb')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0x89a1('0x1')]},'queuecallerexit':{'type':Sequelize[_0x89a1('0xb')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x89a1('0x1')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x89a1('0xc')},'originalposition':{'type':Sequelize[_0x89a1('0xa')]},'channel':{'type':Sequelize[_0x89a1('0x0')]},'connectedlinenum':{'type':Sequelize[_0x89a1('0x0')]},'connectedlinename':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x89a1('0x0')]},'exten':{'type':Sequelize[_0x89a1('0x0')]},'priority':{'type':Sequelize[_0x89a1('0x0')]},'holdtime':{'type':Sequelize[_0x89a1('0xa')]},'mohtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x89a1('0xb')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0x89a1('0xd')},'transferexten':{'type':Sequelize['STRING']},'transferuniqueid':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x89a1('0x0')]},'secondDisposition':{'type':Sequelize[_0x89a1('0x0')]},'thirdDisposition':{'type':Sequelize[_0x89a1('0x0')]},'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 d9ac5ec..2a28763 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 _0x9172=['includeAll','include','findAll','rows','catch','find','create','body','params','describe','getVoiceQueuesReport','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','ejs','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','sendStatus','status','end','json','offset','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','index','VoiceQueueReport','rawAttributes','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','map','type','VIRTUAL','options'];(function(_0x26490c,_0x20daaa){var _0x55feaf=function(_0x5c94ef){while(--_0x5c94ef){_0x26490c['push'](_0x26490c['shift']());}};_0x55feaf(++_0x20daaa);}(_0x9172,0x1f1));var _0x2917=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0x9172[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require(_0x2917('0x0'));var rimraf=require(_0x2917('0x1'));var zipdir=require(_0x2917('0x2'));var jsonpatch=require(_0x2917('0x3'));var rp=require(_0x2917('0x4'));var moment=require('moment');var BPromise=require(_0x2917('0x5'));var Mustache=require(_0x2917('0x6'));var util=require('util');var path=require(_0x2917('0x7'));var sox=require(_0x2917('0x8'));var csv=require(_0x2917('0x9'));var ejs=require(_0x2917('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x2917('0xb'));var jsforce=require(_0x2917('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x2917('0x9'));var querystring=require(_0x2917('0xd'));var Papa=require(_0x2917('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x2917('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2917('0x10'));var logger=require(_0x2917('0x11'))(_0x2917('0x12'));var utils=require('../../config/utils');var config=require(_0x2917('0x13'));var licenseUtil=require(_0x2917('0x14'));var db=require(_0x2917('0x15'))['db'];config[_0x2917('0x16')]=_[_0x2917('0x17')](config['redis'],{'host':_0x2917('0x18'),'port':0x18eb});var socket=require(_0x2917('0x19'))(new Redis(config[_0x2917('0x16')]));require(_0x2917('0x1a'))[_0x2917('0x1b')](socket);function respondWithStatusCode(_0x37f0c8,_0x19c423){_0x19c423=_0x19c423||0xcc;return function(_0x3f5631){if(_0x3f5631){return _0x37f0c8[_0x2917('0x1c')](_0x19c423);}return _0x37f0c8[_0x2917('0x1d')](_0x19c423)[_0x2917('0x1e')]();};}function respondWithResult(_0x1995e1,_0xc1389){_0xc1389=_0xc1389||0xc8;return function(_0x3dd2d1){if(_0x3dd2d1){return _0x1995e1[_0x2917('0x1d')](_0xc1389)[_0x2917('0x1f')](_0x3dd2d1);}};}function respondWithFilteredResult(_0x493867,_0x315137){return function(_0x42633a){if(_0x42633a){var _0x373392=typeof _0x315137[_0x2917('0x20')]===_0x2917('0x21')&&typeof _0x315137['limit']==='undefined';var _0x206a59=_0x42633a[_0x2917('0x22')];var _0x442c63=_0x373392?0x0:_0x315137[_0x2917('0x20')];var _0xcc49e1=_0x373392?_0x42633a[_0x2917('0x22')]:_0x315137[_0x2917('0x20')]+_0x315137['limit'];var _0x3cbd18;if(_0xcc49e1>=_0x206a59){_0xcc49e1=_0x206a59;_0x3cbd18=0xc8;}else{_0x3cbd18=0xce;}_0x493867[_0x2917('0x1d')](_0x3cbd18);return _0x493867[_0x2917('0x23')](_0x2917('0x24'),_0x442c63+'-'+_0xcc49e1+'/'+_0x206a59)[_0x2917('0x1f')](_0x42633a);}return null;};}function patchUpdates(_0x2c1af5){return function(_0x405619){try{jsonpatch[_0x2917('0x25')](_0x405619,_0x2c1af5,!![]);}catch(_0x12c05f){return BPromise['reject'](_0x12c05f);}return _0x405619[_0x2917('0x26')]();};}function saveUpdates(_0x5a3b3c,_0x3db2bb){return function(_0x589685){if(_0x589685){return _0x589685[_0x2917('0x27')](_0x5a3b3c)[_0x2917('0x28')](function(_0x2f0942){return _0x2f0942;});}return null;};}function removeEntity(_0x161e8e,_0x336969){return function(_0x423bc8){if(_0x423bc8){return _0x423bc8[_0x2917('0x29')]()[_0x2917('0x28')](function(){_0x161e8e[_0x2917('0x1d')](0xcc)[_0x2917('0x1e')]();});}};}function handleEntityNotFound(_0x2c4296,_0x372f75){return function(_0x42d392){if(!_0x42d392){_0x2c4296[_0x2917('0x1c')](0x194);}return _0x42d392;};}function handleError(_0x51a623,_0x2f67ec){_0x2f67ec=_0x2f67ec||0x1f4;return function(_0x1d99a4){logger[_0x2917('0x2a')](_0x1d99a4[_0x2917('0x2b')]);if(_0x1d99a4[_0x2917('0x2c')]){delete _0x1d99a4['name'];}_0x51a623['status'](_0x2f67ec)['send'](_0x1d99a4);};}exports[_0x2917('0x2d')]=function(_0x5a1f24,_0x532c30){var _0xbacbcb={},_0x4b8add={},_0x232f10={'count':0x0,'rows':[]};var _0xdd188b=_['map'](db[_0x2917('0x2e')][_0x2917('0x2f')],function(_0x47221a){return{'name':_0x47221a['fieldName'],'type':_0x47221a['type'][_0x2917('0x30')]};});_0x4b8add[_0x2917('0x31')]=_['map'](_0xdd188b,_0x2917('0x2c'));_0x4b8add['query']=_[_0x2917('0x32')](_0x5a1f24[_0x2917('0x33')]);_0x4b8add[_0x2917('0x34')]=_['intersection'](_0x4b8add[_0x2917('0x31')],_0x4b8add['query']);_0xbacbcb['attributes']=_[_0x2917('0x35')](_0x4b8add[_0x2917('0x31')],qs[_0x2917('0x36')](_0x5a1f24[_0x2917('0x33')][_0x2917('0x36')]));_0xbacbcb['attributes']=_0xbacbcb[_0x2917('0x37')][_0x2917('0x38')]?_0xbacbcb[_0x2917('0x37')]:_0x4b8add[_0x2917('0x31')];if(!_0x5a1f24[_0x2917('0x33')][_0x2917('0x39')](_0x2917('0x3a'))){_0xbacbcb['limit']=qs[_0x2917('0x3b')](_0x5a1f24[_0x2917('0x33')][_0x2917('0x3b')]);_0xbacbcb[_0x2917('0x20')]=qs[_0x2917('0x20')](_0x5a1f24[_0x2917('0x33')]['offset']);}_0xbacbcb[_0x2917('0x3c')]=qs[_0x2917('0x3d')](_0x5a1f24['query'][_0x2917('0x3d')]);_0xbacbcb[_0x2917('0x3e')]=qs[_0x2917('0x34')](_[_0x2917('0x3f')](_0x5a1f24[_0x2917('0x33')],_0x4b8add[_0x2917('0x34')]),_0xdd188b);if(_0x5a1f24['query'][_0x2917('0x40')]){_0xbacbcb[_0x2917('0x3e')]=_[_0x2917('0x41')](_0xbacbcb[_0x2917('0x3e')],{'$or':_[_0x2917('0x42')](_0xdd188b,function(_0x428558){if(_0x428558[_0x2917('0x43')]!==_0x2917('0x44')){var _0x563abe={};_0x563abe[_0x428558[_0x2917('0x2c')]]={'$like':'%'+_0x5a1f24[_0x2917('0x33')][_0x2917('0x40')]+'%'};return _0x563abe;}})});}_0xbacbcb=_[_0x2917('0x41')]({},_0xbacbcb,_0x5a1f24[_0x2917('0x45')]);var _0x108dda={'where':_0xbacbcb[_0x2917('0x3e')]};return db['VoiceQueueReport']['count'](_0x108dda)[_0x2917('0x28')](function(_0x4ab818){_0x232f10['count']=_0x4ab818;if(_0x5a1f24[_0x2917('0x33')][_0x2917('0x46')]){_0xbacbcb[_0x2917('0x47')]=[{'all':!![]}];}return db[_0x2917('0x2e')][_0x2917('0x48')](_0xbacbcb);})[_0x2917('0x28')](function(_0x3ec697){_0x232f10[_0x2917('0x49')]=_0x3ec697;return _0x232f10;})['then'](respondWithFilteredResult(_0x532c30,_0xbacbcb))[_0x2917('0x4a')](handleError(_0x532c30,null));};exports['show']=function(_0x4da04b,_0x34e192){var _0xa1e873={'raw':![],'where':{'id':_0x4da04b['params']['id']}},_0x4c6786={};_0x4c6786[_0x2917('0x31')]=_['keys'](db['VoiceQueueReport'][_0x2917('0x2f')]);_0x4c6786[_0x2917('0x33')]=_[_0x2917('0x32')](_0x4da04b[_0x2917('0x33')]);_0x4c6786['filters']=_[_0x2917('0x35')](_0x4c6786[_0x2917('0x31')],_0x4c6786[_0x2917('0x33')]);_0xa1e873[_0x2917('0x37')]=_[_0x2917('0x35')](_0x4c6786['model'],qs[_0x2917('0x36')](_0x4da04b[_0x2917('0x33')][_0x2917('0x36')]));_0xa1e873['attributes']=_0xa1e873[_0x2917('0x37')]['length']?_0xa1e873[_0x2917('0x37')]:_0x4c6786[_0x2917('0x31')];if(_0x4da04b[_0x2917('0x33')][_0x2917('0x46')]){_0xa1e873[_0x2917('0x47')]=[{'all':!![]}];}_0xa1e873=_[_0x2917('0x41')]({},_0xa1e873,_0x4da04b[_0x2917('0x45')]);return db[_0x2917('0x2e')][_0x2917('0x4b')](_0xa1e873)[_0x2917('0x28')](handleEntityNotFound(_0x34e192,null))[_0x2917('0x28')](respondWithResult(_0x34e192,null))[_0x2917('0x4a')](handleError(_0x34e192,null));};exports[_0x2917('0x4c')]=function(_0x534ddf,_0x4669c4){return db[_0x2917('0x2e')][_0x2917('0x4c')](_0x534ddf['body'],{})[_0x2917('0x28')](respondWithResult(_0x4669c4,0xc9))[_0x2917('0x4a')](handleError(_0x4669c4,null));};exports['update']=function(_0x4e41d9,_0x43c7c3){if(_0x4e41d9[_0x2917('0x4d')]['id']){delete _0x4e41d9[_0x2917('0x4d')]['id'];}return db[_0x2917('0x2e')][_0x2917('0x4b')]({'where':{'id':_0x4e41d9[_0x2917('0x4e')]['id']}})[_0x2917('0x28')](handleEntityNotFound(_0x43c7c3,null))[_0x2917('0x28')](saveUpdates(_0x4e41d9['body'],null))[_0x2917('0x28')](respondWithResult(_0x43c7c3,null))['catch'](handleError(_0x43c7c3,null));};exports['destroy']=function(_0x9691c2,_0x55cf95){return db['VoiceQueueReport'][_0x2917('0x4b')]({'where':{'id':_0x9691c2['params']['id']}})[_0x2917('0x28')](handleEntityNotFound(_0x55cf95,null))[_0x2917('0x28')](removeEntity(_0x55cf95,null))['catch'](handleError(_0x55cf95,null));};exports[_0x2917('0x4f')]=function(_0x294094,_0xa6cc93){return db['VoiceQueueReport'][_0x2917('0x4f')]()[_0x2917('0x28')](respondWithResult(_0xa6cc93,null))[_0x2917('0x4a')](handleError(_0xa6cc93,null));};exports[_0x2917('0x50')]=function(_0x48feca,_0x15b4e3){var _0x3d7e99={},_0x6488d3={},_0x854920={'count':0x0,'rows':[]};_0x6488d3['model']=_[_0x2917('0x32')](db[_0x2917('0x2e')][_0x2917('0x2f')]);_0x6488d3[_0x2917('0x33')]=_[_0x2917('0x32')](_0x48feca[_0x2917('0x33')]);_0x6488d3['filters']=_[_0x2917('0x35')](_0x6488d3[_0x2917('0x31')],_0x6488d3['query']);_0x3d7e99[_0x2917('0x37')]=_[_0x2917('0x35')](_0x6488d3[_0x2917('0x31')],qs[_0x2917('0x36')](_0x48feca[_0x2917('0x33')][_0x2917('0x36')]));_0x3d7e99[_0x2917('0x37')]=_0x3d7e99[_0x2917('0x37')][_0x2917('0x38')]?_0x3d7e99[_0x2917('0x37')]:_0x6488d3[_0x2917('0x31')];if(!_0x48feca[_0x2917('0x33')]['hasOwnProperty'](_0x2917('0x3a'))){_0x3d7e99[_0x2917('0x3b')]=qs[_0x2917('0x3b')](_0x48feca['query'][_0x2917('0x3b')]);_0x3d7e99['offset']=qs['offset'](_0x48feca['query'][_0x2917('0x20')]);}_0x3d7e99[_0x2917('0x3c')]=qs[_0x2917('0x3d')](_0x48feca['query'][_0x2917('0x3d')]);_0x3d7e99['where']=qs[_0x2917('0x34')](_[_0x2917('0x3f')](_0x48feca['query'],_0x6488d3[_0x2917('0x34')]));if(_0x48feca[_0x2917('0x33')][_0x2917('0x40')]){_0x3d7e99[_0x2917('0x3e')]=_['merge'](_0x3d7e99[_0x2917('0x3e')],{'$or':_['map'](_0x3d7e99[_0x2917('0x37')],function(_0x11c76f){var _0x2f2e81={};_0x2f2e81[_0x11c76f]={'$like':'%'+_0x48feca[_0x2917('0x33')]['filter']+'%'};return _0x2f2e81;})});}_0x3d7e99=_[_0x2917('0x41')]({},_0x3d7e99,_0x48feca[_0x2917('0x45')]);var _0x30b15f={'where':_0x3d7e99['where']};return db[_0x2917('0x2e')]['count'](_0x30b15f)[_0x2917('0x28')](function(_0x207cf4){_0x854920[_0x2917('0x22')]=_0x207cf4;if(_0x48feca[_0x2917('0x33')]['includeAll']){_0x3d7e99[_0x2917('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x2917('0x48')](_0x3d7e99);})['then'](function(_0x2a5935){_0x854920[_0x2917('0x49')]=_0x2a5935;return _0x854920;})[_0x2917('0x28')](respondWithFilteredResult(_0x15b4e3,_0x3d7e99,_0x2917('0x50')))[_0x2917('0x4a')](handleError(_0x15b4e3,null,_0x2917('0x50')));}; \ No newline at end of file +var _0xe58c=['ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','reject','save','then','destroy','name','send','map','VoiceQueueReport','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','rows','params','rawAttributes','include','find','catch','create','body','update','getVoiceQueuesReport','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring'];(function(_0x502330,_0x4e20ba){var _0x5339fc=function(_0x52085d){while(--_0x52085d){_0x502330['push'](_0x502330['shift']());}};_0x5339fc(++_0x4e20ba);}(_0xe58c,0x12b));var _0xce58=function(_0xc4001c,_0x1bf8f0){_0xc4001c=_0xc4001c-0x0;var _0x49f7bc=_0xe58c[_0xc4001c];return _0x49f7bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xce58('0x0'));var zipdir=require(_0xce58('0x1'));var jsonpatch=require(_0xce58('0x2'));var rp=require(_0xce58('0x3'));var moment=require(_0xce58('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xce58('0x5'));var util=require('util');var path=require(_0xce58('0x6'));var sox=require(_0xce58('0x7'));var csv=require(_0xce58('0x8'));var ejs=require(_0xce58('0x9'));var fs=require('fs');var fs_extra=require(_0xce58('0xa'));var _=require(_0xce58('0xb'));var squel=require(_0xce58('0xc'));var crypto=require(_0xce58('0xd'));var jsforce=require(_0xce58('0xe'));var deskjs=require(_0xce58('0xf'));var toCsv=require('to-csv');var querystring=require(_0xce58('0x10'));var Papa=require('papaparse');var Redis=require(_0xce58('0x11'));var authService=require(_0xce58('0x12'));var qs=require(_0xce58('0x13'));var as=require(_0xce58('0x14'));var hardwareService=require(_0xce58('0x15'));var logger=require(_0xce58('0x16'))('api');var utils=require(_0xce58('0x17'));var config=require(_0xce58('0x18'));var licenseUtil=require(_0xce58('0x19'));var db=require(_0xce58('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xce58('0x1b'))(new Redis(config['redis']));require('./voiceQueueReport.socket')[_0xce58('0x1c')](socket);function respondWithStatusCode(_0x39bc59,_0x27bf52){_0x27bf52=_0x27bf52||0xcc;return function(_0x4e77ad){if(_0x4e77ad){return _0x39bc59[_0xce58('0x1d')](_0x27bf52);}return _0x39bc59[_0xce58('0x1e')](_0x27bf52)[_0xce58('0x1f')]();};}function respondWithResult(_0xc6fab8,_0x1e36a1){_0x1e36a1=_0x1e36a1||0xc8;return function(_0x9b1803){if(_0x9b1803){return _0xc6fab8[_0xce58('0x1e')](_0x1e36a1)[_0xce58('0x20')](_0x9b1803);}};}function respondWithFilteredResult(_0x9c4c04,_0x234202){return function(_0x918f4d){if(_0x918f4d){var _0x24c388=typeof _0x234202[_0xce58('0x21')]===_0xce58('0x22')&&typeof _0x234202['limit']===_0xce58('0x22');var _0xf5c187=_0x918f4d[_0xce58('0x23')];var _0x4d56a4=_0x24c388?0x0:_0x234202[_0xce58('0x21')];var _0x2cba59=_0x24c388?_0x918f4d[_0xce58('0x23')]:_0x234202['offset']+_0x234202[_0xce58('0x24')];var _0x259d33;if(_0x2cba59>=_0xf5c187){_0x2cba59=_0xf5c187;_0x259d33=0xc8;}else{_0x259d33=0xce;}_0x9c4c04['status'](_0x259d33);return _0x9c4c04['set'](_0xce58('0x25'),_0x4d56a4+'-'+_0x2cba59+'/'+_0xf5c187)[_0xce58('0x20')](_0x918f4d);}return null;};}function patchUpdates(_0x40bf4c){return function(_0x23a4db){try{jsonpatch['apply'](_0x23a4db,_0x40bf4c,!![]);}catch(_0x1904cb){return BPromise[_0xce58('0x26')](_0x1904cb);}return _0x23a4db[_0xce58('0x27')]();};}function saveUpdates(_0x29bd08,_0x208236){return function(_0x56b471){if(_0x56b471){return _0x56b471['update'](_0x29bd08)[_0xce58('0x28')](function(_0x4da7c7){return _0x4da7c7;});}return null;};}function removeEntity(_0x3b49ec,_0x4667ad){return function(_0x115c11){if(_0x115c11){return _0x115c11[_0xce58('0x29')]()[_0xce58('0x28')](function(){_0x3b49ec[_0xce58('0x1e')](0xcc)[_0xce58('0x1f')]();});}};}function handleEntityNotFound(_0x545cd8,_0x1b205e){return function(_0x4049dc){if(!_0x4049dc){_0x545cd8['sendStatus'](0x194);}return _0x4049dc;};}function handleError(_0x52aa93,_0x26afa1){_0x26afa1=_0x26afa1||0x1f4;return function(_0x4d1dd8){logger['error'](_0x4d1dd8['stack']);if(_0x4d1dd8['name']){delete _0x4d1dd8[_0xce58('0x2a')];}_0x52aa93['status'](_0x26afa1)[_0xce58('0x2b')](_0x4d1dd8);};}exports['index']=function(_0x489f5f,_0x3607c5){var _0x47bd63={},_0x20627a={},_0x582d0e={'count':0x0,'rows':[]};var _0x4a6a9c=_[_0xce58('0x2c')](db[_0xce58('0x2d')]['rawAttributes'],function(_0x108b15){return{'name':_0x108b15[_0xce58('0x2e')],'type':_0x108b15[_0xce58('0x2f')][_0xce58('0x30')]};});_0x20627a[_0xce58('0x31')]=_[_0xce58('0x2c')](_0x4a6a9c,_0xce58('0x2a'));_0x20627a[_0xce58('0x32')]=_[_0xce58('0x33')](_0x489f5f['query']);_0x20627a[_0xce58('0x34')]=_['intersection'](_0x20627a[_0xce58('0x31')],_0x20627a[_0xce58('0x32')]);_0x47bd63['attributes']=_[_0xce58('0x35')](_0x20627a['model'],qs[_0xce58('0x36')](_0x489f5f[_0xce58('0x32')][_0xce58('0x36')]));_0x47bd63[_0xce58('0x37')]=_0x47bd63[_0xce58('0x37')][_0xce58('0x38')]?_0x47bd63[_0xce58('0x37')]:_0x20627a[_0xce58('0x31')];if(!_0x489f5f['query'][_0xce58('0x39')](_0xce58('0x3a'))){_0x47bd63[_0xce58('0x24')]=qs[_0xce58('0x24')](_0x489f5f['query'][_0xce58('0x24')]);_0x47bd63['offset']=qs['offset'](_0x489f5f[_0xce58('0x32')][_0xce58('0x21')]);}_0x47bd63[_0xce58('0x3b')]=qs[_0xce58('0x3c')](_0x489f5f[_0xce58('0x32')][_0xce58('0x3c')]);_0x47bd63[_0xce58('0x3d')]=qs['filters'](_[_0xce58('0x3e')](_0x489f5f[_0xce58('0x32')],_0x20627a[_0xce58('0x34')]),_0x4a6a9c);if(_0x489f5f[_0xce58('0x32')]['filter']){_0x47bd63[_0xce58('0x3d')]=_[_0xce58('0x3f')](_0x47bd63[_0xce58('0x3d')],{'$or':_[_0xce58('0x2c')](_0x4a6a9c,function(_0x1d54a8){if(_0x1d54a8[_0xce58('0x2f')]!==_0xce58('0x40')){var _0x29fc1f={};_0x29fc1f[_0x1d54a8[_0xce58('0x2a')]]={'$like':'%'+_0x489f5f[_0xce58('0x32')][_0xce58('0x41')]+'%'};return _0x29fc1f;}})});}_0x47bd63=_[_0xce58('0x3f')]({},_0x47bd63,_0x489f5f[_0xce58('0x42')]);var _0x115adc={'where':_0x47bd63[_0xce58('0x3d')]};return db[_0xce58('0x2d')][_0xce58('0x23')](_0x115adc)[_0xce58('0x28')](function(_0x30af42){_0x582d0e['count']=_0x30af42;if(_0x489f5f[_0xce58('0x32')][_0xce58('0x43')]){_0x47bd63['include']=[{'all':!![]}];}return db[_0xce58('0x2d')]['findAll'](_0x47bd63);})[_0xce58('0x28')](function(_0x3d8de6){_0x582d0e[_0xce58('0x44')]=_0x3d8de6;return _0x582d0e;})[_0xce58('0x28')](respondWithFilteredResult(_0x3607c5,_0x47bd63))['catch'](handleError(_0x3607c5,null));};exports['show']=function(_0x49b15e,_0x2d2e4c){var _0x3f5c71={'raw':![],'where':{'id':_0x49b15e[_0xce58('0x45')]['id']}},_0x1262b0={};_0x1262b0[_0xce58('0x31')]=_['keys'](db[_0xce58('0x2d')][_0xce58('0x46')]);_0x1262b0['query']=_[_0xce58('0x33')](_0x49b15e[_0xce58('0x32')]);_0x1262b0[_0xce58('0x34')]=_[_0xce58('0x35')](_0x1262b0[_0xce58('0x31')],_0x1262b0[_0xce58('0x32')]);_0x3f5c71[_0xce58('0x37')]=_['intersection'](_0x1262b0[_0xce58('0x31')],qs[_0xce58('0x36')](_0x49b15e[_0xce58('0x32')][_0xce58('0x36')]));_0x3f5c71[_0xce58('0x37')]=_0x3f5c71[_0xce58('0x37')][_0xce58('0x38')]?_0x3f5c71[_0xce58('0x37')]:_0x1262b0[_0xce58('0x31')];if(_0x49b15e[_0xce58('0x32')][_0xce58('0x43')]){_0x3f5c71[_0xce58('0x47')]=[{'all':!![]}];}_0x3f5c71=_[_0xce58('0x3f')]({},_0x3f5c71,_0x49b15e[_0xce58('0x42')]);return db[_0xce58('0x2d')][_0xce58('0x48')](_0x3f5c71)[_0xce58('0x28')](handleEntityNotFound(_0x2d2e4c,null))[_0xce58('0x28')](respondWithResult(_0x2d2e4c,null))[_0xce58('0x49')](handleError(_0x2d2e4c,null));};exports['create']=function(_0x2338e6,_0x101129){return db[_0xce58('0x2d')][_0xce58('0x4a')](_0x2338e6[_0xce58('0x4b')],{})[_0xce58('0x28')](respondWithResult(_0x101129,0xc9))['catch'](handleError(_0x101129,null));};exports[_0xce58('0x4c')]=function(_0x4f8892,_0xc4818b){if(_0x4f8892['body']['id']){delete _0x4f8892['body']['id'];}return db[_0xce58('0x2d')]['find']({'where':{'id':_0x4f8892['params']['id']}})[_0xce58('0x28')](handleEntityNotFound(_0xc4818b,null))['then'](saveUpdates(_0x4f8892[_0xce58('0x4b')],null))[_0xce58('0x28')](respondWithResult(_0xc4818b,null))[_0xce58('0x49')](handleError(_0xc4818b,null));};exports[_0xce58('0x29')]=function(_0x2bdf6b,_0x5c7ff5){return db['VoiceQueueReport'][_0xce58('0x48')]({'where':{'id':_0x2bdf6b[_0xce58('0x45')]['id']}})[_0xce58('0x28')](handleEntityNotFound(_0x5c7ff5,null))[_0xce58('0x28')](removeEntity(_0x5c7ff5,null))['catch'](handleError(_0x5c7ff5,null));};exports['describe']=function(_0x8367e1,_0x247259){return db[_0xce58('0x2d')]['describe']()[_0xce58('0x28')](respondWithResult(_0x247259,null))[_0xce58('0x49')](handleError(_0x247259,null));};exports[_0xce58('0x4d')]=function(_0x5c89db,_0x10ec6b){var _0x40461d={},_0x98f793={},_0x3f4421={'count':0x0,'rows':[]};_0x98f793[_0xce58('0x31')]=_[_0xce58('0x33')](db[_0xce58('0x2d')][_0xce58('0x46')]);_0x98f793['query']=_['keys'](_0x5c89db[_0xce58('0x32')]);_0x98f793[_0xce58('0x34')]=_[_0xce58('0x35')](_0x98f793[_0xce58('0x31')],_0x98f793[_0xce58('0x32')]);_0x40461d[_0xce58('0x37')]=_[_0xce58('0x35')](_0x98f793[_0xce58('0x31')],qs[_0xce58('0x36')](_0x5c89db['query'][_0xce58('0x36')]));_0x40461d[_0xce58('0x37')]=_0x40461d[_0xce58('0x37')]['length']?_0x40461d[_0xce58('0x37')]:_0x98f793[_0xce58('0x31')];if(!_0x5c89db['query'][_0xce58('0x39')]('nolimit')){_0x40461d[_0xce58('0x24')]=qs[_0xce58('0x24')](_0x5c89db[_0xce58('0x32')][_0xce58('0x24')]);_0x40461d[_0xce58('0x21')]=qs[_0xce58('0x21')](_0x5c89db[_0xce58('0x32')][_0xce58('0x21')]);}_0x40461d[_0xce58('0x3b')]=qs[_0xce58('0x3c')](_0x5c89db[_0xce58('0x32')][_0xce58('0x3c')]);_0x40461d[_0xce58('0x3d')]=qs[_0xce58('0x34')](_['pick'](_0x5c89db[_0xce58('0x32')],_0x98f793[_0xce58('0x34')]));if(_0x5c89db[_0xce58('0x32')]['filter']){_0x40461d[_0xce58('0x3d')]=_[_0xce58('0x3f')](_0x40461d[_0xce58('0x3d')],{'$or':_['map'](_0x40461d[_0xce58('0x37')],function(_0x5cbd87){var _0x4e94d2={};_0x4e94d2[_0x5cbd87]={'$like':'%'+_0x5c89db[_0xce58('0x32')][_0xce58('0x41')]+'%'};return _0x4e94d2;})});}_0x40461d=_[_0xce58('0x3f')]({},_0x40461d,_0x5c89db[_0xce58('0x42')]);var _0x2b130b={'where':_0x40461d[_0xce58('0x3d')]};return db[_0xce58('0x2d')][_0xce58('0x23')](_0x2b130b)['then'](function(_0x545a95){_0x3f4421[_0xce58('0x23')]=_0x545a95;if(_0x5c89db[_0xce58('0x32')][_0xce58('0x43')]){_0x40461d[_0xce58('0x47')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0xce58('0x4e')](_0x40461d);})['then'](function(_0x87aeb5){_0x3f4421[_0xce58('0x44')]=_0x87aeb5;return _0x3f4421;})[_0xce58('0x28')](respondWithFilteredResult(_0x10ec6b,_0x40461d,_0xce58('0x4d')))[_0xce58('0x49')](handleError(_0x10ec6b,null,_0xce58('0x4d')));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 8765c6c..76c5039 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 _0x47ec=['remove','emit','hasOwnProperty','exports','events','../../mysqldb','VoiceQueueReport','setMaxListeners','update'];(function(_0x14aa05,_0x49b87a){var _0x5ed694=function(_0x17d75d){while(--_0x17d75d){_0x14aa05['push'](_0x14aa05['shift']());}};_0x5ed694(++_0x49b87a);}(_0x47ec,0x12d));var _0xc47e=function(_0x5c3e07,_0x386337){_0x5c3e07=_0x5c3e07-0x0;var _0x8dc4b=_0x47ec[_0x5c3e07];return _0x8dc4b;};'use strict';var EventEmitter=require(_0xc47e('0x0'));var VoiceQueueReport=require(_0xc47e('0x1'))['db'][_0xc47e('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0xc47e('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc47e('0x4'),'afterDestroy':_0xc47e('0x5')};function emitEvent(_0x2f284e){return function(_0x54b0d5,_0x5be84b,_0x53e440){VoiceQueueReportEvents[_0xc47e('0x6')](_0x2f284e+':'+_0x54b0d5['id'],_0x54b0d5);VoiceQueueReportEvents['emit'](_0x2f284e,_0x54b0d5);_0x53e440(null);};}for(var e in events){if(events[_0xc47e('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0xc47e('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0xe9e2=['VoiceQueueReport','setMaxListeners','save','remove','emit','exports','events','../../mysqldb'];(function(_0x4070eb,_0x3dbe65){var _0x6602f4=function(_0x3c5f86){while(--_0x3c5f86){_0x4070eb['push'](_0x4070eb['shift']());}};_0x6602f4(++_0x3dbe65);}(_0xe9e2,0xc6));var _0x2e9e=function(_0x4a7843,_0x24f6d1){_0x4a7843=_0x4a7843-0x0;var _0x2c57fe=_0xe9e2[_0x4a7843];return _0x2c57fe;};'use strict';var EventEmitter=require(_0x2e9e('0x0'));var VoiceQueueReport=require(_0x2e9e('0x1'))['db'][_0x2e9e('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x2e9e('0x3')](0x0);var events={'afterCreate':_0x2e9e('0x4'),'afterUpdate':'update','afterDestroy':_0x2e9e('0x5')};function emitEvent(_0x27d13c){return function(_0x5f2982,_0x7e25d2,_0x39d2b8){VoiceQueueReportEvents[_0x2e9e('0x6')](_0x27d13c+':'+_0x5f2982['id'],_0x5f2982);VoiceQueueReportEvents[_0x2e9e('0x6')](_0x27d13c,_0x5f2982);_0x39d2b8(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x2e9e('0x7')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index c272e95..e43bf30 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 _0xfb67=['define','report_queue','uniqueid','lodash','util','../../config/logger','moment','bluebird','rimraf','./voiceQueueReport.attributes','exports'];(function(_0x4a19e0,_0x320dc3){var _0x36c035=function(_0x54b746){while(--_0x54b746){_0x4a19e0['push'](_0x4a19e0['shift']());}};_0x36c035(++_0x320dc3);}(_0xfb67,0x1f2));var _0x7fb6=function(_0x5c0cbb,_0x9c1e5b){_0x5c0cbb=_0x5c0cbb-0x0;var _0x4598cf=_0xfb67[_0x5c0cbb];return _0x4598cf;};'use strict';var _=require(_0x7fb6('0x0'));var util=require(_0x7fb6('0x1'));var logger=require(_0x7fb6('0x2'))('api');var moment=require(_0x7fb6('0x3'));var BPromise=require(_0x7fb6('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x7fb6('0x5'));var config=require('../../config/environment');var attributes=require(_0x7fb6('0x6'));module[_0x7fb6('0x7')]=function(_0x5a9177,_0x249818){return _0x5a9177[_0x7fb6('0x8')]('VoiceQueueReport',attributes,{'tableName':_0x7fb6('0x9'),'paranoid':![],'indexes':[{'fields':[_0x7fb6('0xa')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4360=['moment','bluebird','request-promise','../../config/environment','./voiceQueueReport.attributes','exports','VoiceQueueReport','report_queue','uniqueid','calleridnum','lodash','util','../../config/logger','api'];(function(_0x40e83f,_0x4f467a){var _0x17207f=function(_0xbeb1f0){while(--_0xbeb1f0){_0x40e83f['push'](_0x40e83f['shift']());}};_0x17207f(++_0x4f467a);}(_0x4360,0xf8));var _0x0436=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4360[_0x5b644e];return _0x49c6bf;};'use strict';var _=require(_0x0436('0x0'));var util=require(_0x0436('0x1'));var logger=require(_0x0436('0x2'))(_0x0436('0x3'));var moment=require(_0x0436('0x4'));var BPromise=require(_0x0436('0x5'));var rp=require(_0x0436('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x0436('0x7'));var attributes=require(_0x0436('0x8'));module[_0x0436('0x9')]=function(_0x4c7607,_0x4a81a0){return _0x4c7607['define'](_0x0436('0xa'),attributes,{'tableName':_0x0436('0xb'),'paranoid':![],'indexes':[{'fields':[_0x0436('0xc')]},{'fields':[_0x0436('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index c5812c9..e681a27 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 _0x8426=['request','then','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','attributes','limit','include','map','model','CreateVoiceQueueReport','create','body','update','where','UpdateVoiceQueueReport','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','redis','defaults','socket.io-emitter','register'];(function(_0x64a51,_0x1c61b7){var _0x1eba45=function(_0x230cf8){while(--_0x230cf8){_0x64a51['push'](_0x64a51['shift']());}};_0x1eba45(++_0x1c61b7);}(_0x8426,0x142));var _0x6842=function(_0x465028,_0x4570ac){_0x465028=_0x465028-0x0;var _0xb783d4=_0x8426[_0x465028];return _0xb783d4;};'use strict';var _=require(_0x6842('0x0'));var util=require(_0x6842('0x1'));var moment=require(_0x6842('0x2'));var BPromise=require(_0x6842('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6842('0x4'));var db=require(_0x6842('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6842('0x6'))(_0x6842('0x7'));var config=require(_0x6842('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x6842('0x9')]({'port':0x232a});config[_0x6842('0xa')]=_[_0x6842('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6842('0xc'))(new Redis(config[_0x6842('0xa')]));require('./voiceQueueReport.socket')[_0x6842('0xd')](socket);function respondWithRpcPromise(_0x30b245,_0x316237,_0x3a23ad){return new BPromise(function(_0x2894ae,_0x3b1d3e){return client[_0x6842('0xe')](_0x30b245,_0x3a23ad)[_0x6842('0xf')](function(_0x2d2fec){logger[_0x6842('0x10')](_0x6842('0x11'),_0x316237,'request\x20sent');logger[_0x6842('0x12')](_0x6842('0x13'),_0x316237,'request\x20sent',JSON[_0x6842('0x14')](_0x2d2fec));if(_0x2d2fec[_0x6842('0x15')]){if(_0x2d2fec['error'][_0x6842('0x16')]===0x1f4){logger['error'](_0x6842('0x11'),_0x316237,_0x2d2fec['error'][_0x6842('0x17')]);return _0x3b1d3e(_0x2d2fec[_0x6842('0x15')][_0x6842('0x17')]);}logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x316237,_0x2d2fec[_0x6842('0x15')][_0x6842('0x17')]);return _0x2894ae(_0x2d2fec[_0x6842('0x15')]['message']);}else{logger[_0x6842('0x10')](_0x6842('0x11'),_0x316237,_0x6842('0x18'));_0x2894ae(_0x2d2fec[_0x6842('0x19')]['message']);}})[_0x6842('0x1a')](function(_0x340bba){logger['error'](_0x6842('0x11'),_0x316237,_0x340bba);_0x3b1d3e(_0x340bba);});});}exports[_0x6842('0x1b')]=function(_0xbc1814){var _0x56d95f=this;return new Promise(function(_0x3cb5df,_0x1b5357){return db[_0x6842('0x1c')]['findAll']({'raw':_0xbc1814[_0x6842('0x1d')]?_0xbc1814[_0x6842('0x1d')][_0x6842('0x1e')]===undefined?!![]:![]:!![],'where':_0xbc1814[_0x6842('0x1d')]?_0xbc1814[_0x6842('0x1d')]['where']||null:null,'attributes':_0xbc1814[_0x6842('0x1d')]?_0xbc1814['options'][_0x6842('0x1f')]||null:null,'limit':_0xbc1814[_0x6842('0x1d')]?_0xbc1814['options'][_0x6842('0x20')]||null:null,'include':_0xbc1814[_0x6842('0x1d')]?_0xbc1814[_0x6842('0x1d')][_0x6842('0x21')]?_[_0x6842('0x22')](_0xbc1814[_0x6842('0x1d')][_0x6842('0x21')],function(_0x26e113){return{'model':db[_0x26e113[_0x6842('0x23')]],'as':_0x26e113['as'],'attributes':_0x26e113[_0x6842('0x1f')],'include':_0x26e113[_0x6842('0x21')]?_[_0x6842('0x22')](_0x26e113[_0x6842('0x21')],function(_0x5284e5){return{'model':db[_0x5284e5[_0x6842('0x23')]],'as':_0x5284e5['as'],'attributes':_0x5284e5[_0x6842('0x1f')],'include':_0x5284e5['include']?_[_0x6842('0x22')](_0x5284e5[_0x6842('0x21')],function(_0x3aa765){return{'model':db[_0x3aa765[_0x6842('0x23')]],'as':_0x3aa765['as'],'attributes':_0x3aa765[_0x6842('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x44bbcd){logger[_0x6842('0x10')](_0x6842('0x1b'),_0xbc1814);logger[_0x6842('0x12')](_0x6842('0x1b'),_0xbc1814,JSON[_0x6842('0x14')](_0x44bbcd));_0x3cb5df(_0x44bbcd);})[_0x6842('0x1a')](function(_0x58084e){logger[_0x6842('0x15')](_0x6842('0x1b'),_0x58084e['message'],_0xbc1814);_0x1b5357(_0x56d95f['error'](0x1f4,_0x58084e[_0x6842('0x17')]));});});};exports[_0x6842('0x24')]=function(_0x202e8a){var _0x11d83f=this;return new Promise(function(_0x55ecce,_0x575393){return db[_0x6842('0x1c')][_0x6842('0x25')](_0x202e8a[_0x6842('0x26')],{'raw':_0x202e8a[_0x6842('0x1d')]?_0x202e8a[_0x6842('0x1d')][_0x6842('0x1e')]===undefined?!![]:![]:!![]})[_0x6842('0xf')](function(_0x3eddc3){logger[_0x6842('0x10')](_0x6842('0x24'),_0x202e8a);logger[_0x6842('0x12')]('CreateVoiceQueueReport',_0x202e8a,JSON[_0x6842('0x14')](_0x3eddc3));_0x55ecce(_0x3eddc3);})['catch'](function(_0x20fea9){logger[_0x6842('0x15')](_0x6842('0x24'),_0x20fea9['message'],_0x202e8a);_0x575393(_0x11d83f[_0x6842('0x15')](0x1f4,_0x20fea9[_0x6842('0x17')]));});});};exports['UpdateVoiceQueueReport']=function(_0x3aea48){var _0x2c30fd=this;return new Promise(function(_0x217c42,_0x589deb){return db[_0x6842('0x1c')][_0x6842('0x27')](_0x3aea48['body'],{'raw':_0x3aea48[_0x6842('0x1d')]?_0x3aea48[_0x6842('0x1d')][_0x6842('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3aea48[_0x6842('0x1d')]?_0x3aea48['options'][_0x6842('0x28')]||null:null,'attributes':_0x3aea48[_0x6842('0x1d')]?_0x3aea48[_0x6842('0x1d')][_0x6842('0x1f')]||null:null,'limit':_0x3aea48[_0x6842('0x1d')]?_0x3aea48['options'][_0x6842('0x20')]||null:null})[_0x6842('0xf')](function(_0x13786b){logger[_0x6842('0x10')]('UpdateVoiceQueueReport',_0x3aea48);logger[_0x6842('0x12')](_0x6842('0x29'),_0x3aea48,JSON[_0x6842('0x14')](_0x13786b));_0x217c42(_0x13786b);})[_0x6842('0x1a')](function(_0x7330a9){logger[_0x6842('0x15')]('UpdateVoiceQueueReport',_0x7330a9[_0x6842('0x17')],_0x3aea48);_0x589deb(_0x2c30fd[_0x6842('0x15')](0x1f4,_0x7330a9[_0x6842('0x17')]));});});}; \ No newline at end of file +var _0x184e=['jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','VoiceQueueReport,\x20%s,\x20%s','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options','raw','where','attributes','limit','map','include','model','then','CreateVoiceQueueReport','create','body','debug','UpdateVoiceQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x184e,0xd3));var _0xe184=function(_0x289874,_0x1b6752){_0x289874=_0x289874-0x0;var _0x2f8bbb=_0x184e[_0x289874];return _0x2f8bbb;};'use strict';var _=require(_0xe184('0x0'));var util=require('util');var moment=require(_0xe184('0x1'));var BPromise=require(_0xe184('0x2'));var rs=require(_0xe184('0x3'));var fs=require('fs');var Redis=require(_0xe184('0x4'));var db=require(_0xe184('0x5'))['db'];var utils=require(_0xe184('0x6'));var logger=require(_0xe184('0x7'))('rpc');var config=require(_0xe184('0x8'));var jayson=require(_0xe184('0x9'));var client=jayson['client'][_0xe184('0xa')]({'port':0x232a});config[_0xe184('0xb')]=_[_0xe184('0xc')](config['redis'],{'host':_0xe184('0xd'),'port':0x18eb});var socket=require(_0xe184('0xe'))(new Redis(config[_0xe184('0xb')]));require(_0xe184('0xf'))[_0xe184('0x10')](socket);function respondWithRpcPromise(_0x5cbfa1,_0x1a83d1,_0x4f7e03){return new BPromise(function(_0xbfa0b2,_0x14ae43){return client[_0xe184('0x11')](_0x5cbfa1,_0x4f7e03)['then'](function(_0x3d7c91){logger[_0xe184('0x12')]('VoiceQueueReport,\x20%s,\x20%s',_0x1a83d1,'request\x20sent');logger['debug'](_0xe184('0x13'),_0x1a83d1,_0xe184('0x14'),JSON[_0xe184('0x15')](_0x3d7c91));if(_0x3d7c91[_0xe184('0x16')]){if(_0x3d7c91[_0xe184('0x16')][_0xe184('0x17')]===0x1f4){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1a83d1,_0x3d7c91[_0xe184('0x16')]['message']);return _0x14ae43(_0x3d7c91[_0xe184('0x16')]['message']);}logger[_0xe184('0x16')](_0xe184('0x18'),_0x1a83d1,_0x3d7c91[_0xe184('0x16')][_0xe184('0x19')]);return _0xbfa0b2(_0x3d7c91['error'][_0xe184('0x19')]);}else{logger[_0xe184('0x12')](_0xe184('0x18'),_0x1a83d1,'request\x20sent');_0xbfa0b2(_0x3d7c91[_0xe184('0x1a')][_0xe184('0x19')]);}})[_0xe184('0x1b')](function(_0x254995){logger['error']('VoiceQueueReport,\x20%s,\x20%s',_0x1a83d1,_0x254995);_0x14ae43(_0x254995);});});}exports[_0xe184('0x1c')]=function(_0x39c35a){var _0x10a6b7=this;return new Promise(function(_0x7189d8,_0x39cab4){return db[_0xe184('0x1d')]['findAll']({'raw':_0x39c35a[_0xe184('0x1e')]?_0x39c35a['options'][_0xe184('0x1f')]===undefined?!![]:![]:!![],'where':_0x39c35a['options']?_0x39c35a['options'][_0xe184('0x20')]||null:null,'attributes':_0x39c35a['options']?_0x39c35a[_0xe184('0x1e')][_0xe184('0x21')]||null:null,'limit':_0x39c35a['options']?_0x39c35a[_0xe184('0x1e')][_0xe184('0x22')]||null:null,'include':_0x39c35a[_0xe184('0x1e')]?_0x39c35a['options']['include']?_[_0xe184('0x23')](_0x39c35a[_0xe184('0x1e')][_0xe184('0x24')],function(_0xbe58f4){return{'model':db[_0xbe58f4[_0xe184('0x25')]],'as':_0xbe58f4['as'],'attributes':_0xbe58f4['attributes'],'include':_0xbe58f4[_0xe184('0x24')]?_[_0xe184('0x23')](_0xbe58f4[_0xe184('0x24')],function(_0x53ac6c){return{'model':db[_0x53ac6c['model']],'as':_0x53ac6c['as'],'attributes':_0x53ac6c['attributes'],'include':_0x53ac6c[_0xe184('0x24')]?_[_0xe184('0x23')](_0x53ac6c[_0xe184('0x24')],function(_0x32a319){return{'model':db[_0x32a319['model']],'as':_0x32a319['as'],'attributes':_0x32a319[_0xe184('0x21')]};}):[]};}):[]};}):[]:[]})[_0xe184('0x26')](function(_0x3790ed){logger[_0xe184('0x12')](_0xe184('0x1c'),_0x39c35a);logger['debug'](_0xe184('0x1c'),_0x39c35a,JSON[_0xe184('0x15')](_0x3790ed));_0x7189d8(_0x3790ed);})[_0xe184('0x1b')](function(_0x1ecb05){logger[_0xe184('0x16')](_0xe184('0x1c'),_0x1ecb05[_0xe184('0x19')],_0x39c35a);_0x39cab4(_0x10a6b7['error'](0x1f4,_0x1ecb05[_0xe184('0x19')]));});});};exports[_0xe184('0x27')]=function(_0x26abcb){var _0x1f303d=this;return new Promise(function(_0x198b9d,_0x3f2c7a){return db[_0xe184('0x1d')][_0xe184('0x28')](_0x26abcb[_0xe184('0x29')],{'raw':_0x26abcb['options']?_0x26abcb[_0xe184('0x1e')][_0xe184('0x1f')]===undefined?!![]:![]:!![]})[_0xe184('0x26')](function(_0x20d9d5){logger[_0xe184('0x12')]('CreateVoiceQueueReport',_0x26abcb);logger[_0xe184('0x2a')](_0xe184('0x27'),_0x26abcb,JSON[_0xe184('0x15')](_0x20d9d5));_0x198b9d(_0x20d9d5);})[_0xe184('0x1b')](function(_0x4d1c20){logger[_0xe184('0x16')](_0xe184('0x27'),_0x4d1c20[_0xe184('0x19')],_0x26abcb);_0x3f2c7a(_0x1f303d[_0xe184('0x16')](0x1f4,_0x4d1c20[_0xe184('0x19')]));});});};exports[_0xe184('0x2b')]=function(_0x2ef3e0){var _0x4a470d=this;return new Promise(function(_0x4674b4,_0x2c541c){return db[_0xe184('0x1d')]['update'](_0x2ef3e0[_0xe184('0x29')],{'raw':_0x2ef3e0[_0xe184('0x1e')]?_0x2ef3e0['options'][_0xe184('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2ef3e0[_0xe184('0x1e')]?_0x2ef3e0['options'][_0xe184('0x20')]||null:null,'attributes':_0x2ef3e0[_0xe184('0x1e')]?_0x2ef3e0[_0xe184('0x1e')]['attributes']||null:null,'limit':_0x2ef3e0[_0xe184('0x1e')]?_0x2ef3e0[_0xe184('0x1e')][_0xe184('0x22')]||null:null})['then'](function(_0x493e83){logger[_0xe184('0x12')](_0xe184('0x2b'),_0x2ef3e0);logger[_0xe184('0x2a')](_0xe184('0x2b'),_0x2ef3e0,JSON[_0xe184('0x15')](_0x493e83));_0x4674b4(_0x493e83);})[_0xe184('0x1b')](function(_0x2b5620){logger[_0xe184('0x16')]('UpdateVoiceQueueReport',_0x2b5620[_0xe184('0x19')],_0x2ef3e0);_0x2c541c(_0x4a470d[_0xe184('0x16')](0x1f4,_0x2b5620[_0xe184('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index 1a41558..8c13792 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 _0xf483=['length','voiceQueueReport:','save','update','emit'];(function(_0x3be952,_0xed0533){var _0x7b075e=function(_0x5f154f){while(--_0x5f154f){_0x3be952['push'](_0x3be952['shift']());}};_0x7b075e(++_0xed0533);}(_0xf483,0xf2));var _0x3f48=function(_0x1f78cb,_0x58e9f3){_0x1f78cb=_0x1f78cb-0x0;var _0x2cf6b8=_0xf483[_0x1f78cb];return _0x2cf6b8;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x3f48('0x0'),'remove',_0x3f48('0x1')];function createListener(_0x1a8c22,_0x2f4d00){return function(_0x413bf0){_0x2f4d00[_0x3f48('0x2')](_0x1a8c22,_0x413bf0);};}function removeListener(_0x312d9c,_0x5deb61){return function(){VoiceQueueReportEvents['removeListener'](_0x312d9c,_0x5deb61);};}exports['register']=function(_0x1a3447){for(var _0x16905e=0x0,_0x524a4f=events[_0x3f48('0x3')];_0x16905e<_0x524a4f;_0x16905e++){var _0x2f1ca5=events[_0x16905e];var _0x1746fd=createListener(_0x3f48('0x4')+_0x2f1ca5,_0x1a3447);VoiceQueueReportEvents['on'](_0x2f1ca5,_0x1746fd);}}; \ No newline at end of file +var _0x128c=['update','emit','removeListener','register','length','voiceQueueReport:','./voiceQueueReport.events','save','remove'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x128c,0x96));var _0xc128=function(_0x3692f0,_0x1b2678){_0x3692f0=_0x3692f0-0x0;var _0x55e809=_0x128c[_0x3692f0];return _0x55e809;};'use strict';var VoiceQueueReportEvents=require(_0xc128('0x0'));var events=[_0xc128('0x1'),_0xc128('0x2'),_0xc128('0x3')];function createListener(_0x5f5d92,_0x5d70dd){return function(_0x45632e){_0x5d70dd[_0xc128('0x4')](_0x5f5d92,_0x45632e);};}function removeListener(_0x1afdb0,_0x495b17){return function(){VoiceQueueReportEvents[_0xc128('0x5')](_0x1afdb0,_0x495b17);};}exports[_0xc128('0x6')]=function(_0x579f44){for(var _0x40690d=0x0,_0x515c2b=events[_0xc128('0x7')];_0x40690d<_0x515c2b;_0x40690d++){var _0x4e671f=events[_0x40690d];var _0x450a9c=createListener(_0xc128('0x8')+_0x4e671f,_0x579f44);VoiceQueueReportEvents['on'](_0x4e671f,_0x450a9c);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 83e48bb..00c9979 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 _0x4559=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','show','create','delete'];(function(_0x31b88d,_0x32e9ef){var _0x1128c9=function(_0x243665){while(--_0x243665){_0x31b88d['push'](_0x31b88d['shift']());}};_0x1128c9(++_0x32e9ef);}(_0x4559,0xfe));var _0x9455=function(_0x1200e9,_0x1a23a4){_0x1200e9=_0x1200e9-0x0;var _0x2c1ac4=_0x4559[_0x1200e9];return _0x2c1ac4;};'use strict';var multer=require(_0x9455('0x0'));var util=require('util');var path=require(_0x9455('0x1'));var timeout=require(_0x9455('0x2'));var express=require(_0x9455('0x3'));var router=express[_0x9455('0x4')]();var fs_extra=require(_0x9455('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9455('0x6'));var config=require(_0x9455('0x7'));var controller=require(_0x9455('0x8'));router[_0x9455('0x9')]('/',auth[_0x9455('0xa')](),controller[_0x9455('0xb')]);router[_0x9455('0x9')](_0x9455('0xc'),auth[_0x9455('0xa')](),controller[_0x9455('0xd')]);router['post']('/',auth[_0x9455('0xa')](),controller[_0x9455('0xe')]);router['put']('/:id',auth[_0x9455('0xa')](),controller['update']);router[_0x9455('0xf')]('/:id',auth[_0x9455('0xa')](),controller[_0x9455('0x10')]);module[_0x9455('0x11')]=router; \ No newline at end of file +var _0xf6ad=['../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','post','create','put','update','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x9bff75,_0x3e051f){var _0x121481=function(_0x4c72bc){while(--_0x4c72bc){_0x9bff75['push'](_0x9bff75['shift']());}};_0x121481(++_0x3e051f);}(_0xf6ad,0x1c5));var _0xdf6a=function(_0x14b2cf,_0x5167e0){_0x14b2cf=_0x14b2cf-0x0;var _0x53acf5=_0xf6ad[_0x14b2cf];return _0x53acf5;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xdf6a('0x0'));var express=require(_0xdf6a('0x1'));var router=express[_0xdf6a('0x2')]();var fs_extra=require(_0xdf6a('0x3'));var auth=require(_0xdf6a('0x4'));var interaction=require(_0xdf6a('0x5'));var config=require(_0xdf6a('0x6'));var controller=require(_0xdf6a('0x7'));router[_0xdf6a('0x8')]('/',auth[_0xdf6a('0x9')](),controller[_0xdf6a('0xa')]);router[_0xdf6a('0x8')](_0xdf6a('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xdf6a('0xc')]('/',auth[_0xdf6a('0x9')](),controller[_0xdf6a('0xd')]);router[_0xdf6a('0xe')](_0xdf6a('0xb'),auth[_0xdf6a('0x9')](),controller[_0xdf6a('0xf')]);router['delete'](_0xdf6a('0xb'),auth[_0xdf6a('0x9')](),controller['destroy']);module[_0xdf6a('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 e6db508..db50162 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 _0xb389=['moment','STRING','DATE','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x2318fd,_0xdaf589){var _0x1bda12=function(_0x312280){while(--_0x312280){_0x2318fd['push'](_0x2318fd['shift']());}};_0x1bda12(++_0xdaf589);}(_0xb389,0x13b));var _0x9b38=function(_0x330723,_0x8de382){_0x330723=_0x330723-0x0;var _0x60c546=_0xb389[_0x330723];return _0x60c546;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x9b38('0x0'));module['exports']={'time':{'type':Sequelize[_0x9b38('0x1')]},'callid':{'type':Sequelize[_0x9b38('0x1')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x9b38('0x1')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x9b38('0x1')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x9b38('0x1')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x9b38('0x1')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x9b38('0x1')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x9b38('0x1')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x9b38('0x2')],'allowNull':![],'defaultValue':moment()[_0x9b38('0x3')](_0x9b38('0x4'))}}; \ No newline at end of file +var _0x7c05=['sequelize','moment','STRING','format'];(function(_0xc1a4cf,_0x17141b){var _0x2930d1=function(_0x2e6e7a){while(--_0x2e6e7a){_0xc1a4cf['push'](_0xc1a4cf['shift']());}};_0x2930d1(++_0x17141b);}(_0x7c05,0x154));var _0x57c0=function(_0x2a5b3b,_0x4ebe31){_0x2a5b3b=_0x2a5b3b-0x0;var _0xae665a=_0x7c05[_0x2a5b3b];return _0xae665a;};'use strict';var Sequelize=require(_0x57c0('0x0'));var moment=require(_0x57c0('0x1'));module['exports']={'time':{'type':Sequelize[_0x57c0('0x2')]},'callid':{'type':Sequelize[_0x57c0('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x57c0('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize[_0x57c0('0x2')],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x57c0('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x57c0('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x57c0('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x57c0('0x2')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':moment()[_0x57c0('0x3')]('YYYY-MM-DD\x20HH:mm:ss')}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 2730b90..b042528 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 _0x5c4e=['fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','undefined','limit','count','set','apply','save','update','then','destroy','sendStatus','name','send','map','VoiceQueuesLog','fieldName','type','key','model','query','keys','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','show','rawAttributes','intersection','include','find','catch','body','params','rimraf','zip-dir'];(function(_0x38998c,_0x43757a){var _0x4652df=function(_0x28ea26){while(--_0x28ea26){_0x38998c['push'](_0x38998c['shift']());}};_0x4652df(++_0x43757a);}(_0x5c4e,0x170));var _0xe5c4=function(_0x589e45,_0x4587cf){_0x589e45=_0x589e45-0x0;var _0x3e4538=_0x5c4e[_0x589e45];return _0x3e4538;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5c4('0x0'));var zipdir=require(_0xe5c4('0x1'));var jsonpatch=require(_0xe5c4('0x2'));var rp=require(_0xe5c4('0x3'));var moment=require(_0xe5c4('0x4'));var BPromise=require(_0xe5c4('0x5'));var Mustache=require(_0xe5c4('0x6'));var util=require(_0xe5c4('0x7'));var path=require(_0xe5c4('0x8'));var sox=require(_0xe5c4('0x9'));var csv=require(_0xe5c4('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe5c4('0xb'));var _=require(_0xe5c4('0xc'));var squel=require(_0xe5c4('0xd'));var crypto=require(_0xe5c4('0xe'));var jsforce=require(_0xe5c4('0xf'));var deskjs=require(_0xe5c4('0x10'));var toCsv=require(_0xe5c4('0xa'));var querystring=require('querystring');var Papa=require(_0xe5c4('0x11'));var Redis=require(_0xe5c4('0x12'));var authService=require(_0xe5c4('0x13'));var qs=require(_0xe5c4('0x14'));var as=require(_0xe5c4('0x15'));var hardwareService=require(_0xe5c4('0x16'));var logger=require('../../config/logger')(_0xe5c4('0x17'));var utils=require(_0xe5c4('0x18'));var config=require(_0xe5c4('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe5c4('0x1a'))['db'];function respondWithStatusCode(_0x38ae55,_0x170478){_0x170478=_0x170478||0xcc;return function(_0x58e1af){if(_0x58e1af){return _0x38ae55['sendStatus'](_0x170478);}return _0x38ae55[_0xe5c4('0x1b')](_0x170478)[_0xe5c4('0x1c')]();};}function respondWithResult(_0x237be0,_0x56ffab){_0x56ffab=_0x56ffab||0xc8;return function(_0x541380){if(_0x541380){return _0x237be0[_0xe5c4('0x1b')](_0x56ffab)[_0xe5c4('0x1d')](_0x541380);}};}function respondWithFilteredResult(_0x417222,_0x27987c){return function(_0x11cc5e){if(_0x11cc5e){var _0x2fe1f6=typeof _0x27987c[_0xe5c4('0x1e')]===_0xe5c4('0x1f')&&typeof _0x27987c[_0xe5c4('0x20')]===_0xe5c4('0x1f');var _0x389ad9=_0x11cc5e['count'];var _0x196385=_0x2fe1f6?0x0:_0x27987c['offset'];var _0x41ed54=_0x2fe1f6?_0x11cc5e[_0xe5c4('0x21')]:_0x27987c['offset']+_0x27987c['limit'];var _0x14cf88;if(_0x41ed54>=_0x389ad9){_0x41ed54=_0x389ad9;_0x14cf88=0xc8;}else{_0x14cf88=0xce;}_0x417222[_0xe5c4('0x1b')](_0x14cf88);return _0x417222[_0xe5c4('0x22')]('Content-Range',_0x196385+'-'+_0x41ed54+'/'+_0x389ad9)[_0xe5c4('0x1d')](_0x11cc5e);}return null;};}function patchUpdates(_0x5f8bda){return function(_0x4db9b4){try{jsonpatch[_0xe5c4('0x23')](_0x4db9b4,_0x5f8bda,!![]);}catch(_0x64d046){return BPromise['reject'](_0x64d046);}return _0x4db9b4[_0xe5c4('0x24')]();};}function saveUpdates(_0x4e6186,_0x2d6463){return function(_0x49fa95){if(_0x49fa95){return _0x49fa95[_0xe5c4('0x25')](_0x4e6186)[_0xe5c4('0x26')](function(_0x597f85){return _0x597f85;});}return null;};}function removeEntity(_0x10cb1a,_0x520eb6){return function(_0x105d0){if(_0x105d0){return _0x105d0[_0xe5c4('0x27')]()['then'](function(){_0x10cb1a[_0xe5c4('0x1b')](0xcc)[_0xe5c4('0x1c')]();});}};}function handleEntityNotFound(_0x4b3139,_0x5eb824){return function(_0x1a804c){if(!_0x1a804c){_0x4b3139[_0xe5c4('0x28')](0x194);}return _0x1a804c;};}function handleError(_0x57a915,_0x2e17a3){_0x2e17a3=_0x2e17a3||0x1f4;return function(_0x31407b){logger['error'](_0x31407b['stack']);if(_0x31407b[_0xe5c4('0x29')]){delete _0x31407b[_0xe5c4('0x29')];}_0x57a915[_0xe5c4('0x1b')](_0x2e17a3)[_0xe5c4('0x2a')](_0x31407b);};}exports['index']=function(_0x4a80b0,_0x3f2369){var _0x295c1f={},_0x4506c6={},_0x4bf9d6={'count':0x0,'rows':[]};var _0x39c065=_[_0xe5c4('0x2b')](db[_0xe5c4('0x2c')]['rawAttributes'],function(_0x33dc0e){return{'name':_0x33dc0e[_0xe5c4('0x2d')],'type':_0x33dc0e[_0xe5c4('0x2e')][_0xe5c4('0x2f')]};});_0x4506c6[_0xe5c4('0x30')]=_['map'](_0x39c065,_0xe5c4('0x29'));_0x4506c6[_0xe5c4('0x31')]=_[_0xe5c4('0x32')](_0x4a80b0[_0xe5c4('0x31')]);_0x4506c6[_0xe5c4('0x33')]=_['intersection'](_0x4506c6[_0xe5c4('0x30')],_0x4506c6[_0xe5c4('0x31')]);_0x295c1f['attributes']=_['intersection'](_0x4506c6['model'],qs[_0xe5c4('0x34')](_0x4a80b0[_0xe5c4('0x31')][_0xe5c4('0x34')]));_0x295c1f[_0xe5c4('0x35')]=_0x295c1f[_0xe5c4('0x35')][_0xe5c4('0x36')]?_0x295c1f[_0xe5c4('0x35')]:_0x4506c6[_0xe5c4('0x30')];if(!_0x4a80b0[_0xe5c4('0x31')][_0xe5c4('0x37')](_0xe5c4('0x38'))){_0x295c1f[_0xe5c4('0x20')]=qs[_0xe5c4('0x20')](_0x4a80b0[_0xe5c4('0x31')][_0xe5c4('0x20')]);_0x295c1f[_0xe5c4('0x1e')]=qs[_0xe5c4('0x1e')](_0x4a80b0[_0xe5c4('0x31')]['offset']);}_0x295c1f[_0xe5c4('0x39')]=qs[_0xe5c4('0x3a')](_0x4a80b0['query']['sort']);_0x295c1f[_0xe5c4('0x3b')]=qs[_0xe5c4('0x33')](_[_0xe5c4('0x3c')](_0x4a80b0['query'],_0x4506c6[_0xe5c4('0x33')]),_0x39c065);if(_0x4a80b0[_0xe5c4('0x31')][_0xe5c4('0x3d')]){_0x295c1f[_0xe5c4('0x3b')]=_[_0xe5c4('0x3e')](_0x295c1f['where'],{'$or':_[_0xe5c4('0x2b')](_0x39c065,function(_0x10eaea){if(_0x10eaea[_0xe5c4('0x2e')]!==_0xe5c4('0x3f')){var _0x1414af={};_0x1414af[_0x10eaea['name']]={'$like':'%'+_0x4a80b0[_0xe5c4('0x31')][_0xe5c4('0x3d')]+'%'};return _0x1414af;}})});}_0x295c1f=_[_0xe5c4('0x3e')]({},_0x295c1f,_0x4a80b0[_0xe5c4('0x40')]);var _0x210c42={'where':_0x295c1f[_0xe5c4('0x3b')]};return db['VoiceQueuesLog'][_0xe5c4('0x21')](_0x210c42)[_0xe5c4('0x26')](function(_0x3019d1){_0x4bf9d6['count']=_0x3019d1;if(_0x4a80b0[_0xe5c4('0x31')][_0xe5c4('0x41')]){_0x295c1f['include']=[{'all':!![]}];}return db[_0xe5c4('0x2c')]['findAll'](_0x295c1f);})[_0xe5c4('0x26')](function(_0x4e60e9){_0x4bf9d6['rows']=_0x4e60e9;return _0x4bf9d6;})['then'](respondWithFilteredResult(_0x3f2369,_0x295c1f))['catch'](handleError(_0x3f2369,null));};exports[_0xe5c4('0x42')]=function(_0xa5713a,_0x920363){var _0x4de139={'raw':!![],'where':{'id':_0xa5713a['params']['id']}},_0x4141ba={};_0x4141ba[_0xe5c4('0x30')]=_[_0xe5c4('0x32')](db[_0xe5c4('0x2c')][_0xe5c4('0x43')]);_0x4141ba[_0xe5c4('0x31')]=_['keys'](_0xa5713a[_0xe5c4('0x31')]);_0x4141ba[_0xe5c4('0x33')]=_['intersection'](_0x4141ba[_0xe5c4('0x30')],_0x4141ba[_0xe5c4('0x31')]);_0x4de139['attributes']=_[_0xe5c4('0x44')](_0x4141ba[_0xe5c4('0x30')],qs[_0xe5c4('0x34')](_0xa5713a[_0xe5c4('0x31')]['fields']));_0x4de139[_0xe5c4('0x35')]=_0x4de139['attributes']['length']?_0x4de139[_0xe5c4('0x35')]:_0x4141ba[_0xe5c4('0x30')];if(_0xa5713a[_0xe5c4('0x31')][_0xe5c4('0x41')]){_0x4de139[_0xe5c4('0x45')]=[{'all':!![]}];}_0x4de139=_['merge']({},_0x4de139,_0xa5713a['options']);return db[_0xe5c4('0x2c')][_0xe5c4('0x46')](_0x4de139)['then'](handleEntityNotFound(_0x920363,null))[_0xe5c4('0x26')](respondWithResult(_0x920363,null))[_0xe5c4('0x47')](handleError(_0x920363,null));};exports['create']=function(_0x57a18a,_0x57e87b){return db[_0xe5c4('0x2c')]['create'](_0x57a18a[_0xe5c4('0x48')],{})['then'](respondWithResult(_0x57e87b,0xc9))['catch'](handleError(_0x57e87b,null));};exports[_0xe5c4('0x25')]=function(_0x5dae28,_0x37a40f){if(_0x5dae28[_0xe5c4('0x48')]['id']){delete _0x5dae28[_0xe5c4('0x48')]['id'];}return db[_0xe5c4('0x2c')][_0xe5c4('0x46')]({'where':{'id':_0x5dae28[_0xe5c4('0x49')]['id']}})[_0xe5c4('0x26')](handleEntityNotFound(_0x37a40f,null))[_0xe5c4('0x26')](saveUpdates(_0x5dae28[_0xe5c4('0x48')],null))[_0xe5c4('0x26')](respondWithResult(_0x37a40f,null))[_0xe5c4('0x47')](handleError(_0x37a40f,null));};exports['destroy']=function(_0x10aef,_0x4c0697){return db[_0xe5c4('0x2c')][_0xe5c4('0x46')]({'where':{'id':_0x10aef['params']['id']}})[_0xe5c4('0x26')](handleEntityNotFound(_0x4c0697,null))[_0xe5c4('0x26')](removeEntity(_0x4c0697,null))[_0xe5c4('0x47')](handleError(_0x4c0697,null));}; \ No newline at end of file +var _0x8ce0=['apply','reject','save','then','error','stack','name','send','index','VoiceQueuesLog','rawAttributes','fieldName','type','key','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create','body','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','lodash','squel','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','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range'];(function(_0x64b31d,_0x393b36){var _0x42c45b=function(_0x2d2323){while(--_0x2d2323){_0x64b31d['push'](_0x64b31d['shift']());}};_0x42c45b(++_0x393b36);}(_0x8ce0,0xbb));var _0x08ce=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x8ce0[_0x4ae829];return _0x256b31;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x08ce('0x0'));var zipdir=require(_0x08ce('0x1'));var jsonpatch=require(_0x08ce('0x2'));var rp=require('request-promise');var moment=require(_0x08ce('0x3'));var BPromise=require(_0x08ce('0x4'));var Mustache=require(_0x08ce('0x5'));var util=require(_0x08ce('0x6'));var path=require('path');var sox=require(_0x08ce('0x7'));var csv=require('to-csv');var ejs=require(_0x08ce('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x08ce('0x9'));var squel=require(_0x08ce('0xa'));var crypto=require(_0x08ce('0xb'));var jsforce=require(_0x08ce('0xc'));var deskjs=require(_0x08ce('0xd'));var toCsv=require(_0x08ce('0xe'));var querystring=require(_0x08ce('0xf'));var Papa=require(_0x08ce('0x10'));var Redis=require(_0x08ce('0x11'));var authService=require(_0x08ce('0x12'));var qs=require(_0x08ce('0x13'));var as=require(_0x08ce('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x08ce('0x15'))(_0x08ce('0x16'));var utils=require(_0x08ce('0x17'));var config=require(_0x08ce('0x18'));var licenseUtil=require(_0x08ce('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d1db1,_0x5224b1){_0x5224b1=_0x5224b1||0xcc;return function(_0x5779a5){if(_0x5779a5){return _0x4d1db1[_0x08ce('0x1a')](_0x5224b1);}return _0x4d1db1['status'](_0x5224b1)['end']();};}function respondWithResult(_0x21d183,_0x37e358){_0x37e358=_0x37e358||0xc8;return function(_0x151810){if(_0x151810){return _0x21d183[_0x08ce('0x1b')](_0x37e358)[_0x08ce('0x1c')](_0x151810);}};}function respondWithFilteredResult(_0x4fea23,_0x1ffddc){return function(_0x175710){if(_0x175710){var _0x53b950=typeof _0x1ffddc['offset']===_0x08ce('0x1d')&&typeof _0x1ffddc[_0x08ce('0x1e')]===_0x08ce('0x1d');var _0x564834=_0x175710[_0x08ce('0x1f')];var _0x5a777a=_0x53b950?0x0:_0x1ffddc[_0x08ce('0x20')];var _0x16c7e7=_0x53b950?_0x175710['count']:_0x1ffddc[_0x08ce('0x20')]+_0x1ffddc[_0x08ce('0x1e')];var _0x1458b6;if(_0x16c7e7>=_0x564834){_0x16c7e7=_0x564834;_0x1458b6=0xc8;}else{_0x1458b6=0xce;}_0x4fea23[_0x08ce('0x1b')](_0x1458b6);return _0x4fea23[_0x08ce('0x21')](_0x08ce('0x22'),_0x5a777a+'-'+_0x16c7e7+'/'+_0x564834)[_0x08ce('0x1c')](_0x175710);}return null;};}function patchUpdates(_0x367b35){return function(_0x9ee216){try{jsonpatch[_0x08ce('0x23')](_0x9ee216,_0x367b35,!![]);}catch(_0x171738){return BPromise[_0x08ce('0x24')](_0x171738);}return _0x9ee216[_0x08ce('0x25')]();};}function saveUpdates(_0x1909d3,_0x50f8dd){return function(_0x447658){if(_0x447658){return _0x447658['update'](_0x1909d3)[_0x08ce('0x26')](function(_0x297d41){return _0x297d41;});}return null;};}function removeEntity(_0x3085ef,_0x2b014a){return function(_0x31f772){if(_0x31f772){return _0x31f772['destroy']()[_0x08ce('0x26')](function(){_0x3085ef[_0x08ce('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x6769cd,_0x53075d){return function(_0x41379c){if(!_0x41379c){_0x6769cd[_0x08ce('0x1a')](0x194);}return _0x41379c;};}function handleError(_0x3059bf,_0x244371){_0x244371=_0x244371||0x1f4;return function(_0x546625){logger[_0x08ce('0x27')](_0x546625[_0x08ce('0x28')]);if(_0x546625[_0x08ce('0x29')]){delete _0x546625[_0x08ce('0x29')];}_0x3059bf[_0x08ce('0x1b')](_0x244371)[_0x08ce('0x2a')](_0x546625);};}exports[_0x08ce('0x2b')]=function(_0x425713,_0x313855){var _0x5e5c79={},_0xab6152={},_0x15a59b={'count':0x0,'rows':[]};var _0x37284c=_['map'](db[_0x08ce('0x2c')][_0x08ce('0x2d')],function(_0x5a5e02){return{'name':_0x5a5e02[_0x08ce('0x2e')],'type':_0x5a5e02[_0x08ce('0x2f')][_0x08ce('0x30')]};});_0xab6152['model']=_[_0x08ce('0x31')](_0x37284c,'name');_0xab6152[_0x08ce('0x32')]=_['keys'](_0x425713['query']);_0xab6152[_0x08ce('0x33')]=_[_0x08ce('0x34')](_0xab6152[_0x08ce('0x35')],_0xab6152[_0x08ce('0x32')]);_0x5e5c79[_0x08ce('0x36')]=_[_0x08ce('0x34')](_0xab6152['model'],qs[_0x08ce('0x37')](_0x425713[_0x08ce('0x32')][_0x08ce('0x37')]));_0x5e5c79['attributes']=_0x5e5c79['attributes'][_0x08ce('0x38')]?_0x5e5c79[_0x08ce('0x36')]:_0xab6152[_0x08ce('0x35')];if(!_0x425713[_0x08ce('0x32')][_0x08ce('0x39')]('nolimit')){_0x5e5c79['limit']=qs['limit'](_0x425713[_0x08ce('0x32')][_0x08ce('0x1e')]);_0x5e5c79[_0x08ce('0x20')]=qs[_0x08ce('0x20')](_0x425713[_0x08ce('0x32')][_0x08ce('0x20')]);}_0x5e5c79['order']=qs['sort'](_0x425713['query']['sort']);_0x5e5c79[_0x08ce('0x3a')]=qs[_0x08ce('0x33')](_[_0x08ce('0x3b')](_0x425713['query'],_0xab6152[_0x08ce('0x33')]),_0x37284c);if(_0x425713['query'][_0x08ce('0x3c')]){_0x5e5c79[_0x08ce('0x3a')]=_[_0x08ce('0x3d')](_0x5e5c79['where'],{'$or':_[_0x08ce('0x31')](_0x37284c,function(_0x1e5102){if(_0x1e5102[_0x08ce('0x2f')]!=='VIRTUAL'){var _0x40192b={};_0x40192b[_0x1e5102['name']]={'$like':'%'+_0x425713[_0x08ce('0x32')][_0x08ce('0x3c')]+'%'};return _0x40192b;}})});}_0x5e5c79=_[_0x08ce('0x3d')]({},_0x5e5c79,_0x425713['options']);var _0x4a8733={'where':_0x5e5c79[_0x08ce('0x3a')]};return db[_0x08ce('0x2c')]['count'](_0x4a8733)[_0x08ce('0x26')](function(_0x5495cb){_0x15a59b[_0x08ce('0x1f')]=_0x5495cb;if(_0x425713[_0x08ce('0x32')][_0x08ce('0x3e')]){_0x5e5c79[_0x08ce('0x3f')]=[{'all':!![]}];}return db[_0x08ce('0x2c')][_0x08ce('0x40')](_0x5e5c79);})[_0x08ce('0x26')](function(_0x1d9884){_0x15a59b[_0x08ce('0x41')]=_0x1d9884;return _0x15a59b;})['then'](respondWithFilteredResult(_0x313855,_0x5e5c79))[_0x08ce('0x42')](handleError(_0x313855,null));};exports[_0x08ce('0x43')]=function(_0x2e483e,_0x4268e3){var _0x64aff0={'raw':!![],'where':{'id':_0x2e483e[_0x08ce('0x44')]['id']}},_0x1b651f={};_0x1b651f[_0x08ce('0x35')]=_['keys'](db[_0x08ce('0x2c')][_0x08ce('0x2d')]);_0x1b651f[_0x08ce('0x32')]=_[_0x08ce('0x45')](_0x2e483e[_0x08ce('0x32')]);_0x1b651f[_0x08ce('0x33')]=_[_0x08ce('0x34')](_0x1b651f[_0x08ce('0x35')],_0x1b651f[_0x08ce('0x32')]);_0x64aff0[_0x08ce('0x36')]=_[_0x08ce('0x34')](_0x1b651f[_0x08ce('0x35')],qs['fields'](_0x2e483e['query'][_0x08ce('0x37')]));_0x64aff0[_0x08ce('0x36')]=_0x64aff0['attributes'][_0x08ce('0x38')]?_0x64aff0['attributes']:_0x1b651f['model'];if(_0x2e483e[_0x08ce('0x32')][_0x08ce('0x3e')]){_0x64aff0[_0x08ce('0x3f')]=[{'all':!![]}];}_0x64aff0=_['merge']({},_0x64aff0,_0x2e483e[_0x08ce('0x46')]);return db[_0x08ce('0x2c')][_0x08ce('0x47')](_0x64aff0)[_0x08ce('0x26')](handleEntityNotFound(_0x4268e3,null))[_0x08ce('0x26')](respondWithResult(_0x4268e3,null))[_0x08ce('0x42')](handleError(_0x4268e3,null));};exports[_0x08ce('0x48')]=function(_0x537a31,_0x234598){return db[_0x08ce('0x2c')][_0x08ce('0x48')](_0x537a31['body'],{})[_0x08ce('0x26')](respondWithResult(_0x234598,0xc9))['catch'](handleError(_0x234598,null));};exports['update']=function(_0x1fcf85,_0x5153f3){if(_0x1fcf85['body']['id']){delete _0x1fcf85[_0x08ce('0x49')]['id'];}return db[_0x08ce('0x2c')][_0x08ce('0x47')]({'where':{'id':_0x1fcf85[_0x08ce('0x44')]['id']}})['then'](handleEntityNotFound(_0x5153f3,null))['then'](saveUpdates(_0x1fcf85[_0x08ce('0x49')],null))[_0x08ce('0x26')](respondWithResult(_0x5153f3,null))[_0x08ce('0x42')](handleError(_0x5153f3,null));};exports['destroy']=function(_0x23a270,_0x4f8de3){return db[_0x08ce('0x2c')]['find']({'where':{'id':_0x23a270[_0x08ce('0x44')]['id']}})['then'](handleEntityNotFound(_0x4f8de3,null))['then'](removeEntity(_0x4f8de3,null))['catch'](handleError(_0x4f8de3,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index b04c636..a4f14c8 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 _0x67bb=['path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','event_dtm','event','dtm','lodash','util','api','moment','bluebird','request-promise'];(function(_0x461645,_0xc686ba){var _0x2a9173=function(_0xf57dd5){while(--_0xf57dd5){_0x461645['push'](_0x461645['shift']());}};_0x2a9173(++_0xc686ba);}(_0x67bb,0x11a));var _0xb67b=function(_0x1e45cf,_0x4853f0){_0x1e45cf=_0x1e45cf-0x0;var _0xbc0bf5=_0x67bb[_0x1e45cf];return _0xbc0bf5;};'use strict';var _=require(_0xb67b('0x0'));var util=require(_0xb67b('0x1'));var logger=require('../../config/logger')(_0xb67b('0x2'));var moment=require(_0xb67b('0x3'));var BPromise=require(_0xb67b('0x4'));var rp=require(_0xb67b('0x5'));var fs=require('fs');var path=require(_0xb67b('0x6'));var rimraf=require(_0xb67b('0x7'));var config=require(_0xb67b('0x8'));var attributes=require(_0xb67b('0x9'));module[_0xb67b('0xa')]=function(_0x2f3869,_0x55bc1b){return _0x2f3869[_0xb67b('0xb')](_0xb67b('0xc'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0xb67b('0xd'),'fields':[_0xb67b('0xe'),_0xb67b('0xf')]}],'timestamps':![]});}; \ No newline at end of file +var _0xf5f9=['event_dtm','dtm','lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','VoiceQueuesLog','voice_queues_log'];(function(_0x4d8666,_0x2ff19d){var _0x37175b=function(_0x1b8de6){while(--_0x1b8de6){_0x4d8666['push'](_0x4d8666['shift']());}};_0x37175b(++_0x2ff19d);}(_0xf5f9,0x6a));var _0x9f5f=function(_0x3326e5,_0x35dfd4){_0x3326e5=_0x3326e5-0x0;var _0x4ad0b7=_0xf5f9[_0x3326e5];return _0x4ad0b7;};'use strict';var _=require(_0x9f5f('0x0'));var util=require(_0x9f5f('0x1'));var logger=require('../../config/logger')(_0x9f5f('0x2'));var moment=require(_0x9f5f('0x3'));var BPromise=require(_0x9f5f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9f5f('0x5'));var rimraf=require(_0x9f5f('0x6'));var config=require(_0x9f5f('0x7'));var attributes=require(_0x9f5f('0x8'));module['exports']=function(_0x1992f6,_0x3a4855){return _0x1992f6['define'](_0x9f5f('0x9'),attributes,{'tableName':_0x9f5f('0xa'),'paranoid':![],'indexes':[{'name':_0x9f5f('0xb'),'fields':['event',_0x9f5f('0xc')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index cbd84bd..e061fb8 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 _0xf2f3=['client','http','request','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise'];(function(_0x451310,_0x5b7ae1){var _0x5a9498=function(_0x393b35){while(--_0x393b35){_0x451310['push'](_0x451310['shift']());}};_0x5a9498(++_0x5b7ae1);}(_0xf2f3,0x15d));var _0x3f2f=function(_0x2f5191,_0x26a24a){_0x2f5191=_0x2f5191-0x0;var _0x5f4927=_0xf2f3[_0x2f5191];return _0x5f4927;};'use strict';var _=require('lodash');var util=require(_0x3f2f('0x0'));var moment=require(_0x3f2f('0x1'));var BPromise=require(_0x3f2f('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f2f('0x3'));var db=require(_0x3f2f('0x4'))['db'];var utils=require(_0x3f2f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x3f2f('0x6'));var jayson=require(_0x3f2f('0x7'));var client=jayson[_0x3f2f('0x8')][_0x3f2f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xbcd687,_0x4650c5,_0x401c52){return new BPromise(function(_0x19fe4a,_0xc83ca3){return client[_0x3f2f('0xa')](_0xbcd687,_0x401c52)[_0x3f2f('0xb')](function(_0x438f59){logger[_0x3f2f('0xc')](_0x3f2f('0xd'),_0x4650c5,_0x3f2f('0xe'));logger['debug'](_0x3f2f('0xf'),_0x4650c5,_0x3f2f('0xe'),JSON[_0x3f2f('0x10')](_0x438f59));if(_0x438f59['error']){if(_0x438f59[_0x3f2f('0x11')][_0x3f2f('0x12')]===0x1f4){logger['error']('VoiceQueuesLog,\x20%s,\x20%s',_0x4650c5,_0x438f59[_0x3f2f('0x11')]['message']);return _0xc83ca3(_0x438f59['error'][_0x3f2f('0x13')]);}logger[_0x3f2f('0x11')](_0x3f2f('0xd'),_0x4650c5,_0x438f59['error']['message']);return _0x19fe4a(_0x438f59[_0x3f2f('0x11')][_0x3f2f('0x13')]);}else{logger[_0x3f2f('0xc')](_0x3f2f('0xd'),_0x4650c5,_0x3f2f('0xe'));_0x19fe4a(_0x438f59[_0x3f2f('0x14')][_0x3f2f('0x13')]);}})['catch'](function(_0x474ed2){logger[_0x3f2f('0x11')](_0x3f2f('0xd'),_0x4650c5,_0x474ed2);_0xc83ca3(_0x474ed2);});});} \ No newline at end of file +var _0x4c1f=['jayson/promise','client','http','then','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x4c1f,0x14f));var _0xf4c1=function(_0x59c76e,_0x5a5666){_0x59c76e=_0x59c76e-0x0;var _0x5a4566=_0x4c1f[_0x59c76e];return _0x5a4566;};'use strict';var _=require(_0xf4c1('0x0'));var util=require(_0xf4c1('0x1'));var moment=require(_0xf4c1('0x2'));var BPromise=require(_0xf4c1('0x3'));var rs=require(_0xf4c1('0x4'));var fs=require('fs');var Redis=require(_0xf4c1('0x5'));var db=require(_0xf4c1('0x6'))['db'];var utils=require(_0xf4c1('0x7'));var logger=require(_0xf4c1('0x8'))(_0xf4c1('0x9'));var config=require('../../config/environment');var jayson=require(_0xf4c1('0xa'));var client=jayson[_0xf4c1('0xb')][_0xf4c1('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x3f2ae6,_0x4139e9,_0x43cbfb){return new BPromise(function(_0x3dec35,_0x35eaab){return client['request'](_0x3f2ae6,_0x43cbfb)[_0xf4c1('0xd')](function(_0x174076){logger['info'](_0xf4c1('0xe'),_0x4139e9,_0xf4c1('0xf'));logger[_0xf4c1('0x10')](_0xf4c1('0x11'),_0x4139e9,_0xf4c1('0xf'),JSON['stringify'](_0x174076));if(_0x174076[_0xf4c1('0x12')]){if(_0x174076[_0xf4c1('0x12')]['code']===0x1f4){logger[_0xf4c1('0x12')](_0xf4c1('0xe'),_0x4139e9,_0x174076['error'][_0xf4c1('0x13')]);return _0x35eaab(_0x174076[_0xf4c1('0x12')][_0xf4c1('0x13')]);}logger[_0xf4c1('0x12')](_0xf4c1('0xe'),_0x4139e9,_0x174076['error']['message']);return _0x3dec35(_0x174076[_0xf4c1('0x12')][_0xf4c1('0x13')]);}else{logger[_0xf4c1('0x14')](_0xf4c1('0xe'),_0x4139e9,'request\x20sent');_0x3dec35(_0x174076[_0xf4c1('0x15')][_0xf4c1('0x13')]);}})[_0xf4c1('0x16')](function(_0x1b533c){logger[_0xf4c1('0x12')](_0xf4c1('0xe'),_0x4139e9,_0x1b533c);_0x35eaab(_0x1b533c);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index eaf1574..05dd56c 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 _0x2090=['/:id','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','post','create','runTranscribe','delete','destroy','multer','path','connect-timeout','express','Router','../../config/environment','./voiceRecording.controller','get','isAuthenticated','/describe','describe'];(function(_0xa388a2,_0x40bde6){var _0x7ce7f6=function(_0x5a242a){while(--_0x5a242a){_0xa388a2['push'](_0xa388a2['shift']());}};_0x7ce7f6(++_0x40bde6);}(_0x2090,0xe7));var _0x0209=function(_0x15e665,_0xde50dc){_0x15e665=_0x15e665-0x0;var _0x4b4c97=_0x2090[_0x15e665];return _0x4b4c97;};'use strict';var multer=require(_0x0209('0x0'));var util=require('util');var path=require(_0x0209('0x1'));var timeout=require(_0x0209('0x2'));var express=require(_0x0209('0x3'));var router=express[_0x0209('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x0209('0x5'));var controller=require(_0x0209('0x6'));router[_0x0209('0x7')]('/',auth[_0x0209('0x8')](),controller['index']);router[_0x0209('0x7')](_0x0209('0x9'),auth[_0x0209('0x8')](),controller[_0x0209('0xa')]);router[_0x0209('0x7')](_0x0209('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0209('0x7')](_0x0209('0xc'),auth[_0x0209('0x8')](),controller[_0x0209('0xd')]);router[_0x0209('0x7')](_0x0209('0xe'),controller[_0x0209('0xf')]);router[_0x0209('0x7')](_0x0209('0x10'),auth[_0x0209('0x8')](),controller['downloadTranscribe']);router[_0x0209('0x11')]('/',auth[_0x0209('0x8')](),controller[_0x0209('0x12')]);router[_0x0209('0x11')](_0x0209('0x10'),auth[_0x0209('0x8')](),controller[_0x0209('0x13')]);router['put']('/:id',auth[_0x0209('0x8')](),controller['update']);router[_0x0209('0x14')](_0x0209('0xb'),auth[_0x0209('0x8')](),controller[_0x0209('0x15')]);module['exports']=router; \ No newline at end of file +var _0x1ca2=['delete','destroy','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','downloads','/:id/transcribe','downloadTranscribe','post','create','runTranscribe','put'];(function(_0xcf4e9b,_0x124815){var _0x47de9e=function(_0x36753e){while(--_0x36753e){_0xcf4e9b['push'](_0xcf4e9b['shift']());}};_0x47de9e(++_0x124815);}(_0x1ca2,0x1f1));var _0x21ca=function(_0x4fc4e7,_0x16bfc4){_0x4fc4e7=_0x4fc4e7-0x0;var _0x297133=_0x1ca2[_0x4fc4e7];return _0x297133;};'use strict';var multer=require(_0x21ca('0x0'));var util=require(_0x21ca('0x1'));var path=require(_0x21ca('0x2'));var timeout=require('connect-timeout');var express=require(_0x21ca('0x3'));var router=express['Router']();var fs_extra=require(_0x21ca('0x4'));var auth=require(_0x21ca('0x5'));var interaction=require(_0x21ca('0x6'));var config=require('../../config/environment');var controller=require('./voiceRecording.controller');router[_0x21ca('0x7')]('/',auth[_0x21ca('0x8')](),controller[_0x21ca('0x9')]);router['get'](_0x21ca('0xa'),auth[_0x21ca('0x8')](),controller[_0x21ca('0xb')]);router[_0x21ca('0x7')](_0x21ca('0xc'),auth[_0x21ca('0x8')](),controller[_0x21ca('0xd')]);router['get'](_0x21ca('0xe'),auth[_0x21ca('0x8')](),controller[_0x21ca('0xf')]);router[_0x21ca('0x7')]('/:id/downloads',controller[_0x21ca('0x10')]);router[_0x21ca('0x7')](_0x21ca('0x11'),auth[_0x21ca('0x8')](),controller[_0x21ca('0x12')]);router[_0x21ca('0x13')]('/',auth[_0x21ca('0x8')](),controller[_0x21ca('0x14')]);router[_0x21ca('0x13')](_0x21ca('0x11'),auth['isAuthenticated'](),controller[_0x21ca('0x15')]);router[_0x21ca('0x16')](_0x21ca('0xc'),auth[_0x21ca('0x8')](),controller['update']);router[_0x21ca('0x17')]('/:id',auth['isAuthenticated'](),controller[_0x21ca('0x18')]);module[_0x21ca('0x19')]=router; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.attributes.js b/server/api/voiceRecording/voiceRecording.attributes.js index 8dd7b99..6f5ac04 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 _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index db89a86..39b2efe 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 _0x9f3c=['runTranscribe','findOne','transcribe','transcribeAccountId','transcribeRegion','language','runSentiment','sentiment','sentimentAccountId','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data2','Cloud\x20Provider\x20not\x20configured','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeStatus','NEW','data1','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','Transcript\x20not\x20available','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','jsforce','desk.js','to-csv','querystring','papaparse','aws-sdk','uuid/v4','ioredis','../../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','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','rawAttributes','fieldName','type','key','map','format','keys','filters','intersection','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','VoiceRecording','findAll','rows','catch','params','find','create','body','describe','download','../../components/encryptor','uniqueid','value','%s.cypher','decryptFile','secrets','recording','existsSync','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','sequelize','col','token','$and','push','isNil','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','listBuckets','createBucket','TranscribeService','startTranscriptionJob','basename','readFileSync','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','TranscriptionJobStatus'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x9f3c,0x1ea));var _0xc9f3=function(_0x5697f5,_0xaca14){_0x5697f5=_0x5697f5-0x0;var _0x43afc8=_0x9f3c[_0x5697f5];return _0x43afc8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xc9f3('0x0'));var jsonpatch=require(_0xc9f3('0x1'));var rp=require(_0xc9f3('0x2'));var moment=require(_0xc9f3('0x3'));var BPromise=require(_0xc9f3('0x4'));var Mustache=require(_0xc9f3('0x5'));var util=require(_0xc9f3('0x6'));var path=require(_0xc9f3('0x7'));var sox=require(_0xc9f3('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('squel');var crypto=require('crypto');var jsforce=require(_0xc9f3('0x9'));var deskjs=require(_0xc9f3('0xa'));var toCsv=require(_0xc9f3('0xb'));var querystring=require(_0xc9f3('0xc'));var Papa=require(_0xc9f3('0xd'));var AWS=require(_0xc9f3('0xe'));var uuidv4=require(_0xc9f3('0xf'));var Redis=require(_0xc9f3('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xc9f3('0x11'));var as=require(_0xc9f3('0x12'));var hardwareService=require(_0xc9f3('0x13'));var logger=require(_0xc9f3('0x14'))(_0xc9f3('0x15'));var utils=require(_0xc9f3('0x16'));var config=require(_0xc9f3('0x17'));var licenseUtil=require(_0xc9f3('0x18'));var db=require(_0xc9f3('0x19'))['db'];function respondWithStatusCode(_0x5bfb4f,_0x5dfc0b){_0x5dfc0b=_0x5dfc0b||0xcc;return function(_0x3682a7){if(_0x3682a7){return _0x5bfb4f[_0xc9f3('0x1a')](_0x5dfc0b);}return _0x5bfb4f['status'](_0x5dfc0b)[_0xc9f3('0x1b')]();};}function respondWithResult(_0x32dd1a,_0x3714a9){_0x3714a9=_0x3714a9||0xc8;return function(_0x5aab1a){if(_0x5aab1a){return _0x32dd1a[_0xc9f3('0x1c')](_0x3714a9)[_0xc9f3('0x1d')](_0x5aab1a);}};}function respondWithFilteredResult(_0x552ea4,_0x360b94){return function(_0x2a9b53){if(_0x2a9b53){var _0x4a7686=typeof _0x360b94['offset']===_0xc9f3('0x1e')&&typeof _0x360b94[_0xc9f3('0x1f')]===_0xc9f3('0x1e');var _0x1541c7=_0x2a9b53['count'];var _0x46e16c=_0x4a7686?0x0:_0x360b94['offset'];var _0x305911=_0x4a7686?_0x2a9b53[_0xc9f3('0x20')]:_0x360b94[_0xc9f3('0x21')]+_0x360b94[_0xc9f3('0x1f')];var _0x1f7108;if(_0x305911>=_0x1541c7){_0x305911=_0x1541c7;_0x1f7108=0xc8;}else{_0x1f7108=0xce;}_0x552ea4['status'](_0x1f7108);return _0x552ea4[_0xc9f3('0x22')](_0xc9f3('0x23'),_0x46e16c+'-'+_0x305911+'/'+_0x1541c7)[_0xc9f3('0x1d')](_0x2a9b53);}return null;};}function patchUpdates(_0x3441d7){return function(_0x4b991b){try{jsonpatch[_0xc9f3('0x24')](_0x4b991b,_0x3441d7,!![]);}catch(_0x324e13){return BPromise[_0xc9f3('0x25')](_0x324e13);}return _0x4b991b[_0xc9f3('0x26')]();};}function saveUpdates(_0x2ab9e8,_0xc9b241){return function(_0x380cd4){if(_0x380cd4){return _0x380cd4[_0xc9f3('0x27')](_0x2ab9e8)['then'](function(_0x190c13){return _0x190c13;});}return null;};}function removeEntity(_0x2cca7b,_0x2e0d92){return function(_0x5ebd31){if(_0x5ebd31){return _0x5ebd31[_0xc9f3('0x28')]()[_0xc9f3('0x29')](function(){_0x2cca7b[_0xc9f3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xa566a8,_0x35fd3e){return function(_0x44c99f){if(!_0x44c99f){_0xa566a8[_0xc9f3('0x1a')](0x194);}return _0x44c99f;};}function handleError(_0x17c635,_0x20b320){_0x20b320=_0x20b320||0x1f4;return function(_0x191f6c){logger[_0xc9f3('0x2a')](_0x191f6c[_0xc9f3('0x2b')]);if(_0x191f6c[_0xc9f3('0x2c')]){delete _0x191f6c[_0xc9f3('0x2c')];}_0x17c635['status'](_0x20b320)[_0xc9f3('0x2d')](_0x191f6c);};}exports[_0xc9f3('0x2e')]=function(_0x481526,_0xa92f98){var _0x1c83c7={},_0x40a6cb={},_0x524f85={'count':0x0,'rows':[]};var _0x22a063=_['map'](db['VoiceRecording'][_0xc9f3('0x2f')],function(_0x17e058){return{'name':_0x17e058[_0xc9f3('0x30')],'type':_0x17e058[_0xc9f3('0x31')][_0xc9f3('0x32')]};});_0x40a6cb['model']=_['differenceBy'](_[_0xc9f3('0x33')](_0x22a063,_0xc9f3('0x2c')),[_0xc9f3('0x34')]);_0x40a6cb['query']=_[_0xc9f3('0x35')](_0x481526['query']);_0x40a6cb[_0xc9f3('0x36')]=_[_0xc9f3('0x37')](_0x40a6cb[_0xc9f3('0x38')],_0x40a6cb[_0xc9f3('0x39')]);_0x1c83c7[_0xc9f3('0x3a')]=_['intersection'](_0x40a6cb['model'],qs[_0xc9f3('0x3b')](_0x481526['query'][_0xc9f3('0x3b')]));_0x1c83c7['attributes']=_0x1c83c7[_0xc9f3('0x3a')][_0xc9f3('0x3c')]?_0x1c83c7['attributes']:_0x40a6cb[_0xc9f3('0x38')];if(!_0x481526[_0xc9f3('0x39')][_0xc9f3('0x3d')](_0xc9f3('0x3e'))){_0x1c83c7[_0xc9f3('0x1f')]=qs[_0xc9f3('0x1f')](_0x481526[_0xc9f3('0x39')][_0xc9f3('0x1f')]);_0x1c83c7['offset']=qs[_0xc9f3('0x21')](_0x481526[_0xc9f3('0x39')][_0xc9f3('0x21')]);}_0x1c83c7[_0xc9f3('0x3f')]=qs[_0xc9f3('0x40')](_0x481526[_0xc9f3('0x39')][_0xc9f3('0x40')]);_0x1c83c7[_0xc9f3('0x41')]=qs[_0xc9f3('0x36')](_[_0xc9f3('0x42')](_0x481526[_0xc9f3('0x39')],_0x40a6cb[_0xc9f3('0x36')]),_0x22a063);if(_0x481526[_0xc9f3('0x39')][_0xc9f3('0x43')]){_0x1c83c7[_0xc9f3('0x41')]=_[_0xc9f3('0x44')](_0x1c83c7[_0xc9f3('0x41')],{'$or':_[_0xc9f3('0x33')](_0x22a063,function(_0x5af2a2){if(_0x5af2a2['type']!==_0xc9f3('0x45')){var _0x406d9e={};_0x406d9e[_0x5af2a2[_0xc9f3('0x2c')]]={'$like':'%'+_0x481526['query'][_0xc9f3('0x43')]+'%'};return _0x406d9e;}})});}_0x1c83c7=_[_0xc9f3('0x44')]({},_0x1c83c7,_0x481526[_0xc9f3('0x46')]);var _0x3eee09={'where':_0x1c83c7['where']};return db['VoiceRecording'][_0xc9f3('0x20')](_0x3eee09)[_0xc9f3('0x29')](function(_0xab7bab){_0x524f85[_0xc9f3('0x20')]=_0xab7bab;if(_0x481526['query'][_0xc9f3('0x47')]){_0x1c83c7[_0xc9f3('0x48')]=[{'all':!![]}];}return db[_0xc9f3('0x49')][_0xc9f3('0x4a')](_0x1c83c7);})[_0xc9f3('0x29')](function(_0x2dc9d0){_0x524f85[_0xc9f3('0x4b')]=_0x2dc9d0;return _0x524f85;})[_0xc9f3('0x29')](respondWithFilteredResult(_0xa92f98,_0x1c83c7))[_0xc9f3('0x4c')](handleError(_0xa92f98,null));};exports['show']=function(_0x44e64f,_0x352f50){var _0xda25a4={'raw':![],'where':{'id':_0x44e64f[_0xc9f3('0x4d')]['id']}},_0x2b789c={};_0x2b789c[_0xc9f3('0x38')]=_[_0xc9f3('0x35')](db[_0xc9f3('0x49')][_0xc9f3('0x2f')]);_0x2b789c['query']=_['keys'](_0x44e64f[_0xc9f3('0x39')]);_0x2b789c[_0xc9f3('0x36')]=_[_0xc9f3('0x37')](_0x2b789c['model'],_0x2b789c[_0xc9f3('0x39')]);_0xda25a4[_0xc9f3('0x3a')]=_[_0xc9f3('0x37')](_0x2b789c['model'],qs[_0xc9f3('0x3b')](_0x44e64f[_0xc9f3('0x39')]['fields']));_0xda25a4[_0xc9f3('0x3a')]=_0xda25a4[_0xc9f3('0x3a')][_0xc9f3('0x3c')]?_0xda25a4[_0xc9f3('0x3a')]:_0x2b789c['model'];if(_0x44e64f['query']['includeAll']){_0xda25a4[_0xc9f3('0x48')]=[{'all':!![]}];}_0xda25a4=_['merge']({},_0xda25a4,_0x44e64f['options']);return db['VoiceRecording'][_0xc9f3('0x4e')](_0xda25a4)[_0xc9f3('0x29')](handleEntityNotFound(_0x352f50,null))[_0xc9f3('0x29')](respondWithResult(_0x352f50,null))[_0xc9f3('0x4c')](handleError(_0x352f50,null));};exports['create']=function(_0x3b3126,_0x4ce408){return db[_0xc9f3('0x49')][_0xc9f3('0x4f')](_0x3b3126[_0xc9f3('0x50')],{})[_0xc9f3('0x29')](respondWithResult(_0x4ce408,0xc9))['catch'](handleError(_0x4ce408,null));};exports[_0xc9f3('0x27')]=function(_0x57c622,_0x5a5e03){if(_0x57c622[_0xc9f3('0x50')]['id']){delete _0x57c622['body']['id'];}return db[_0xc9f3('0x49')][_0xc9f3('0x4e')]({'where':{'id':_0x57c622['params']['id']}})[_0xc9f3('0x29')](handleEntityNotFound(_0x5a5e03,null))['then'](saveUpdates(_0x57c622['body'],null))[_0xc9f3('0x29')](respondWithResult(_0x5a5e03,null))[_0xc9f3('0x4c')](handleError(_0x5a5e03,null));};exports[_0xc9f3('0x51')]=function(_0x24aa5c,_0x56a688){return db[_0xc9f3('0x49')][_0xc9f3('0x51')]()[_0xc9f3('0x29')](respondWithResult(_0x56a688,null))[_0xc9f3('0x4c')](handleError(_0x56a688,null));};exports[_0xc9f3('0x52')]=function(_0x4c0371,_0x18f6d1,_0x1b7f13){var _0x17b856=require(_0xc9f3('0x53'));var _0x4602a0=![];var _0x30b89e={};if(_0x4c0371['query'][_0xc9f3('0x31')]&&_0x4c0371[_0xc9f3('0x39')][_0xc9f3('0x31')]===_0xc9f3('0x54')){_0x30b89e[_0xc9f3('0x54')]=_0x4c0371[_0xc9f3('0x4d')]['id'];}else{_0x30b89e['id']=_0x4c0371[_0xc9f3('0x4d')]['id'];}return db[_0xc9f3('0x49')][_0xc9f3('0x4e')]({'where':_0x30b89e,'attributes':['id',_0xc9f3('0x55')],'raw':!![]})[_0xc9f3('0x29')](handleEntityNotFound(_0x18f6d1,null))['then'](function(_0x594f59){if(_0x594f59){var _0xcb9933=_0x594f59[_0xc9f3('0x55')];var _0x15db65=util['format'](_0xc9f3('0x56'),_0xcb9933);if(fs['existsSync'](_0x15db65)){_0x4602a0=!![];return _0x17b856[_0xc9f3('0x57')](_0x15db65,_0xcb9933,config[_0xc9f3('0x58')][_0xc9f3('0x59')])['then'](function(){return _0x594f59;});}return _0x594f59;}})['then'](function(_0x433254){if(_0x433254){var _0x4ddef5=_0x433254[_0xc9f3('0x55')];if(!fs[_0xc9f3('0x5a')](_0x4ddef5)){throw new db[(_0xc9f3('0x5b'))][(_0xc9f3('0x5c'))](_0xc9f3('0x5d'));}if(_0x433254['filename']){return _0x18f6d1[_0xc9f3('0x52')](_0x4ddef5,_0x433254[_0xc9f3('0x5e')]+path[_0xc9f3('0x5f')](_0x4ddef5),function(){if(_0x4602a0){fs[_0xc9f3('0x60')](_0x4ddef5);}});}else{return _0x18f6d1['download'](_0x4ddef5,function(_0x42feee){if(_0x4602a0){fs[_0xc9f3('0x60')](_0x4ddef5);}});}}})['catch'](function(_0x14a245){if(_0x14a245[_0xc9f3('0x61')]===_0xc9f3('0x5d')){_0x18f6d1[_0xc9f3('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x18f6d1,null);}});};exports['downloads']=function(_0x4d90d7,_0x18ae17,_0xa1e0c3){var _0x11f601=require(_0xc9f3('0x53'));var _0xe9c4ed=![];var _0x1c1781={'$and':[db[_0xc9f3('0x62')]['where'](db['sequelize']['fn']('MD5',db[_0xc9f3('0x62')][_0xc9f3('0x63')](_0xc9f3('0x54'))),_0x4d90d7['query'][_0xc9f3('0x64')])]};if(_0x4d90d7['query']['type']&&_0x4d90d7[_0xc9f3('0x39')][_0xc9f3('0x31')]===_0xc9f3('0x54')){_0x1c1781[_0xc9f3('0x65')][_0xc9f3('0x66')]({'uniqueid':_0x4d90d7[_0xc9f3('0x4d')]['id']});}else{_0x1c1781['$and'][_0xc9f3('0x66')]({'id':_0x4d90d7['params']['id']});}return db[_0xc9f3('0x49')][_0xc9f3('0x4e')]({'where':_0x1c1781,'attributes':['id',_0xc9f3('0x55')],'raw':!![]})[_0xc9f3('0x29')](handleEntityNotFound(_0x18ae17,null))[_0xc9f3('0x29')](function(_0x6b91c3){if(_0x6b91c3){var _0x45bd79=util[_0xc9f3('0x34')](_0xc9f3('0x56'),_0x6b91c3[_0xc9f3('0x55')]);if(fs['existsSync'](_0x45bd79)){_0xe9c4ed=!![];return _0x11f601[_0xc9f3('0x57')](_0x45bd79,_0x6b91c3['value'],config['secrets'][_0xc9f3('0x59')])[_0xc9f3('0x29')](function(){return _0x6b91c3;});}return _0x6b91c3;}})[_0xc9f3('0x29')](function(_0x144695){if(_0x144695){if(!fs[_0xc9f3('0x5a')](_0x144695[_0xc9f3('0x55')])){throw new db[(_0xc9f3('0x5b'))][(_0xc9f3('0x5c'))](_0xc9f3('0x5d'));}if(_0x144695[_0xc9f3('0x5e')]){return _0x18ae17[_0xc9f3('0x52')](_0x144695[_0xc9f3('0x55')],_0x144695['filename']+path[_0xc9f3('0x5f')](_0x144695[_0xc9f3('0x55')]),function(){if(_0xe9c4ed){fs[_0xc9f3('0x60')](_0x144695['value']);}});}else{return _0x18ae17[_0xc9f3('0x52')](_0x144695['value'],function(_0x563f5f){if(_0xe9c4ed){fs['unlink'](_0x144695[_0xc9f3('0x55')]);}});}}})[_0xc9f3('0x4c')](handleError(_0x18ae17,null));};exports['destroy']=function(_0x19dac8,_0x5e59fa){return db[_0xc9f3('0x49')][_0xc9f3('0x4e')]({'where':{'id':_0x19dac8[_0xc9f3('0x4d')]['id']}})[_0xc9f3('0x29')](function(_0x11f8fc){if(_[_0xc9f3('0x67')](_0x11f8fc)){throw new ReferenceError('Entity\x20not\x20found');}return _0x11f8fc;})[_0xc9f3('0x29')](function(_0x56545f){var _0x3ee4ae=_0x56545f[_0xc9f3('0x55')];logger['info'](_0xc9f3('0x68'),_0x3ee4ae);if(!_[_0xc9f3('0x67')](_0x56545f[_0xc9f3('0x55')])&&fs[_0xc9f3('0x5a')](_0x3ee4ae)){logger['info'](_0xc9f3('0x69')+_0x3ee4ae+_0xc9f3('0x6a'));fs[_0xc9f3('0x6b')](_0x3ee4ae);}_0x3ee4ae=_0x3ee4ae+_0xc9f3('0x6c');if(!_[_0xc9f3('0x67')](_0x56545f['value'])&&fs['existsSync'](_0x3ee4ae)){logger[_0xc9f3('0x6d')]('File:\x20\x22'+_0x3ee4ae+_0xc9f3('0x6a'));fs[_0xc9f3('0x6b')](_0x3ee4ae);}return _0x56545f;})[_0xc9f3('0x29')](function(_0x4358ed){if(!_0x4358ed)throw new InternalError();return _0x4358ed[_0xc9f3('0x28')]();})[_0xc9f3('0x29')](function(){_0x5e59fa[_0xc9f3('0x1c')](0xcc)['end']();})[_0xc9f3('0x4c')](handleError(_0x5e59fa,null));};function getBucketslist(_0x22e264,_0x57cdb5,_0x5708c9){return new Promise(function(_0x42ca71,_0x3153ce){var _0x4dceb9=new AWS['S3']({'accessKeyId':_0x57cdb5,'secretAccessKey':_0x22e264,'region':_0x5708c9});_0x4dceb9[_0xc9f3('0x6e')]({},function(_0x154356,_0x195c9b){if(_0x154356){return _0x3153ce(_0x154356);}else{return _0x42ca71(_0x195c9b);}});});}function createBucket(_0x2c50f0,_0x575500,_0x47beb3,_0x55ca13){return new Promise(function(_0x102377,_0x53eb08){var _0x37e399=new AWS['S3']({'accessKeyId':_0x575500,'secretAccessKey':_0x2c50f0,'region':_0x47beb3});_0x37e399[_0xc9f3('0x6f')]({'Bucket':_0x55ca13},function(_0x27a0e2,_0x5eded6){if(_0x27a0e2){return _0x53eb08(_0x27a0e2);}else{return _0x102377(_0x5eded6);}});});}function uploadFile(_0x497950,_0x50666a,_0x8f6763,_0x3d7c2f,_0x1c26b7,_0x382249){return new Promise(function(_0x2ed431,_0x3894e5){var _0x255198=new AWS['S3']({'accessKeyId':_0x50666a,'secretAccessKey':_0x497950,'region':_0x8f6763});_0x255198['upload']({'Bucket':_0x3d7c2f,'Key':_0x1c26b7,'Body':_0x382249},function(_0x3aa198,_0xc93be7){if(_0x3aa198){return _0x3894e5(_0x3aa198);}else{return _0x2ed431(_0xc93be7);}});});}function startTranscribe(_0x2c6527,_0x55f6b5,_0x2bb31d,_0x1044d7,_0x5118e0,_0x143b51){return new Promise(function(_0x399a23,_0x47104c){var _0x52eb70=new AWS[(_0xc9f3('0x70'))]({'accessKeyId':_0x55f6b5,'secretAccessKey':_0x2c6527,'region':_0x2bb31d});_0x52eb70[_0xc9f3('0x71')]({'TranscriptionJobName':_0x1044d7,'LanguageCode':_0x5118e0,'Media':{'MediaFileUri':_0x143b51}},function(_0x5d32b4,_0x2e42d1){if(_0x5d32b4){return _0x47104c(_0x5d32b4);}else{return _0x399a23(_0x2e42d1);}});});}function transcribe(_0x82f497,_0x2128da,_0x28c5bc,_0x10e252,_0x318c5e,_0x3a770d,_0x264396){return new Promise(function(_0x4efb56,_0x20fe8f){var _0x39c990={};logger['info'](util[_0xc9f3('0x34')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x82f497,_0x318c5e));return uploadFile(_0x2128da,_0x28c5bc,_0x10e252,_0x318c5e,path[_0xc9f3('0x72')](_0x3a770d),fs[_0xc9f3('0x73')](_0x3a770d))[_0xc9f3('0x29')](function(_0x57d4c0){logger['info'](util[_0xc9f3('0x34')]('[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)',_0x82f497,_0x318c5e,_0x57d4c0['Location']));_0x39c990[_0xc9f3('0x74')]=_0x57d4c0[_0xc9f3('0x75')];_0x39c990[_0xc9f3('0x76')]=_0x57d4c0[_0xc9f3('0x77')];logger[_0xc9f3('0x6d')](util['format'](_0xc9f3('0x78'),_0x82f497));return startTranscribe(_0x2128da,_0x28c5bc,_0x10e252,uuidv4(),_0x264396,_0x57d4c0[_0xc9f3('0x77')]);})['then'](function(_0x531d82){logger[_0xc9f3('0x6d')](util[_0xc9f3('0x34')](_0xc9f3('0x79'),_0x82f497,_0x531d82[_0xc9f3('0x7a')][_0xc9f3('0x7b')]));_0x39c990[_0xc9f3('0x7c')]=_0x531d82[_0xc9f3('0x7a')]['TranscriptionJobName'];_0x39c990['transcribeStatus']=_0x531d82[_0xc9f3('0x7a')][_0xc9f3('0x7d')];return _0x4efb56(_0x39c990);})[_0xc9f3('0x4c')](function(_0x36b18b){return _0x20fe8f(_0x36b18b);});});}exports[_0xc9f3('0x7e')]=function(_0x3f03de,_0x59e860,_0x1d87ae){var _0x484641;var _0x261fd9;var _0x57b824;var _0x42dcd8=require(_0xc9f3('0x53'));return db['VoiceRecording'][_0xc9f3('0x7f')]({'where':{'id':_0x3f03de[_0xc9f3('0x4d')]['id']}})[_0xc9f3('0x29')](function(_0x8df4da){if(_0x8df4da){var _0x32a06a=util[_0xc9f3('0x34')](_0xc9f3('0x56'),_0x8df4da[_0xc9f3('0x55')]);if(fs['existsSync'](_0x32a06a)){cypher=!![];return _0x42dcd8[_0xc9f3('0x57')](_0x32a06a,_0x8df4da[_0xc9f3('0x55')],config[_0xc9f3('0x58')][_0xc9f3('0x59')])[_0xc9f3('0x29')](function(){return _0x8df4da;});}return _0x8df4da;}})['then'](function(_0x28130a){if(!_0x28130a){throw new db[(_0xc9f3('0x5b'))][(_0xc9f3('0x5c'))]('Voice\x20Recording\x20not\x20found');}_0x261fd9=_0x28130a;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0xc9f3('0x29')](handleEntityNotFound(_0x59e860,null))['then'](function(_0x5c1f88){if(_0x5c1f88){_0x484641=_0x5c1f88;if(!_0x484641[_0xc9f3('0x80')]||!_0x484641[_0xc9f3('0x81')]||!_0x484641[_0xc9f3('0x82')]||!_0x484641[_0xc9f3('0x83')]||!_0x484641[_0xc9f3('0x74')]){throw new db[(_0xc9f3('0x5b'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x3f03de[_0xc9f3('0x50')][_0xc9f3('0x84')]&&(!_0x484641[_0xc9f3('0x85')]||!_0x484641[_0xc9f3('0x86')]||!_0x484641[_0xc9f3('0x87')]||!_0x484641[_0xc9f3('0x83')]||!_0x484641[_0xc9f3('0x74')])){throw new db['Sequelize'][(_0xc9f3('0x5c'))](_0xc9f3('0x88'));}return db['CloudProvider']['findOne']({'where':{'id':_0x484641[_0xc9f3('0x81')]}});}})[_0xc9f3('0x29')](function(_0x568742){if(!_0x568742){throw new db[(_0xc9f3('0x5b'))][(_0xc9f3('0x5c'))](_0xc9f3('0x89'));}if(!_0x568742['data1']||!_0x568742[_0xc9f3('0x8a')]){throw new db['Sequelize']['ValidationError'](_0xc9f3('0x8b'));}_0x57b824=_0x568742;return getBucketslist(_0x57b824['data1'],_0x57b824[_0xc9f3('0x8a')],_0x484641[_0xc9f3('0x82')]);})[_0xc9f3('0x29')](function(_0x26473e){if(_0x26473e&&_0x26473e[_0xc9f3('0x8c')]){var _0x17327e=_[_0xc9f3('0x4e')](_0x26473e['Buckets'],function(_0x114e9e){return _0x114e9e[_0xc9f3('0x8d')]===_0x484641[_0xc9f3('0x74')];});if(!_0x17327e){logger[_0xc9f3('0x6d')](util['format'](_0xc9f3('0x8e'),_0x3f03de['params']['id'],_0x484641['bucket']));return createBucket(_0x57b824['data1'],_0x57b824[_0xc9f3('0x8a')],_0x484641[_0xc9f3('0x82')],_0x484641[_0xc9f3('0x74')]);}logger[_0xc9f3('0x6d')](util[_0xc9f3('0x34')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x3f03de[_0xc9f3('0x4d')]['id'],_0x484641[_0xc9f3('0x74')]));return;}})['then'](function(_0x1f9f39){if(_0x261fd9[_0xc9f3('0x8f')]===_0xc9f3('0x90')){return transcribe(_0x3f03de['params']['id'],_0x57b824[_0xc9f3('0x91')],_0x57b824[_0xc9f3('0x8a')],_0x484641[_0xc9f3('0x82')],_0x484641[_0xc9f3('0x74')],_0x261fd9[_0xc9f3('0x55')],_0x484641[_0xc9f3('0x83')]);}else{logger[_0xc9f3('0x6d')](util[_0xc9f3('0x34')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x3f03de[_0xc9f3('0x4d')]['id']));return{'transcribeStatus':_0xc9f3('0x92')};}})['then'](function(_0x30bf22){if(_0x30bf22){_0x30bf22[_0xc9f3('0x93')]=_0x3f03de[_0xc9f3('0x50')][_0xc9f3('0x84')];return _0x261fd9[_0xc9f3('0x94')](_0x30bf22);}})['then'](respondWithResult(_0x59e860,null))[_0xc9f3('0x4c')](handleError(_0x59e860,null));};function writeFile(_0x364d96,_0x69fab5){return new Promise(function(_0xdc99e9,_0x520192){fs[_0xc9f3('0x95')](_0x69fab5,_0x364d96,function(_0x1066c6,_0x9ab83b){if(_0x1066c6){return _0x520192(_0x1066c6);}else{return _0xdc99e9(_0x9ab83b);}});});}exports[_0xc9f3('0x96')]=function(_0x2c82bd,_0x7074d8,_0x22c458){return db[_0xc9f3('0x49')]['findOne']({'where':{'id':_0x2c82bd[_0xc9f3('0x4d')]['id']}})[_0xc9f3('0x29')](handleEntityNotFound(_0x7074d8))[_0xc9f3('0x29')](function(_0x55b82e){if(_0x55b82e&&_0x55b82e['fileText']){var _0x57cf4f=_0x55b82e[_0xc9f3('0x97')];var _0x1de84a=config[_0xc9f3('0x98')]+'/server/files/transcribes/transcribe_'+_0x55b82e['id']+'.txt';if(fs[_0xc9f3('0x5a')](_0x1de84a)){return _0x1de84a;}return writeFile(_0x57cf4f,_0x1de84a)[_0xc9f3('0x29')](function(){return _0x1de84a;});}else{throw new db[(_0xc9f3('0x5b'))][(_0xc9f3('0x5c'))](_0xc9f3('0x99'));}})[_0xc9f3('0x29')](function(_0x184b13){return _0x7074d8[_0xc9f3('0x52')](_0x184b13);})[_0xc9f3('0x4c')](handleError(_0x7074d8));}; \ No newline at end of file +var _0xcfcf=['merge','VoiceRecording','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','describe','download','uniqueid','value','%s.cypher','existsSync','decryptFile','secrets','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','unlink','message','Not\x20found','downloads','../../components/encryptor','sequelize','MD5','col','token','$and','push','recording','extname','isNil','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','listBuckets','createBucket','upload','TranscribeService','startTranscriptionJob','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob','TranscriptionJobName','transcribeName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','Setting','transcribe','transcribeAccountId','bucket','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentAccountId','sentimentRegion','language','CloudProvider','data1','data2','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available','transcribeRegion','NEW','[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested','tempSentiment','writeFile','downloadTranscribe','fileText','root','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','uuid/v4','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','format','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL'];(function(_0x342a18,_0x2830dd){var _0x2473f4=function(_0x233ff7){while(--_0x233ff7){_0x342a18['push'](_0x342a18['shift']());}};_0x2473f4(++_0x2830dd);}(_0xcfcf,0x198));var _0xfcfc=function(_0x259d84,_0x99d2a1){_0x259d84=_0x259d84-0x0;var _0x28b1c1=_0xcfcf[_0x259d84];return _0x28b1c1;};'use strict';var emlformat=require(_0xfcfc('0x0'));var rimraf=require(_0xfcfc('0x1'));var zipdir=require(_0xfcfc('0x2'));var jsonpatch=require(_0xfcfc('0x3'));var rp=require(_0xfcfc('0x4'));var moment=require(_0xfcfc('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xfcfc('0x6'));var util=require(_0xfcfc('0x7'));var path=require(_0xfcfc('0x8'));var sox=require(_0xfcfc('0x9'));var csv=require(_0xfcfc('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfcfc('0xb'));var _=require('lodash');var squel=require(_0xfcfc('0xc'));var crypto=require(_0xfcfc('0xd'));var jsforce=require(_0xfcfc('0xe'));var deskjs=require(_0xfcfc('0xf'));var toCsv=require(_0xfcfc('0xa'));var querystring=require(_0xfcfc('0x10'));var Papa=require('papaparse');var AWS=require('aws-sdk');var uuidv4=require(_0xfcfc('0x11'));var Redis=require(_0xfcfc('0x12'));var authService=require(_0xfcfc('0x13'));var qs=require(_0xfcfc('0x14'));var as=require(_0xfcfc('0x15'));var hardwareService=require(_0xfcfc('0x16'));var logger=require('../../config/logger')(_0xfcfc('0x17'));var utils=require(_0xfcfc('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0xfcfc('0x19'));var db=require(_0xfcfc('0x1a'))['db'];function respondWithStatusCode(_0x596028,_0x4fbbc2){_0x4fbbc2=_0x4fbbc2||0xcc;return function(_0xb524c){if(_0xb524c){return _0x596028[_0xfcfc('0x1b')](_0x4fbbc2);}return _0x596028[_0xfcfc('0x1c')](_0x4fbbc2)[_0xfcfc('0x1d')]();};}function respondWithResult(_0x163afb,_0xf974ec){_0xf974ec=_0xf974ec||0xc8;return function(_0x47da16){if(_0x47da16){return _0x163afb[_0xfcfc('0x1c')](_0xf974ec)[_0xfcfc('0x1e')](_0x47da16);}};}function respondWithFilteredResult(_0x536f46,_0x4e9233){return function(_0x50f7ef){if(_0x50f7ef){var _0x318d66=typeof _0x4e9233[_0xfcfc('0x1f')]===_0xfcfc('0x20')&&typeof _0x4e9233[_0xfcfc('0x21')]==='undefined';var _0x5543ef=_0x50f7ef[_0xfcfc('0x22')];var _0x3abe7a=_0x318d66?0x0:_0x4e9233[_0xfcfc('0x1f')];var _0x40709e=_0x318d66?_0x50f7ef[_0xfcfc('0x22')]:_0x4e9233[_0xfcfc('0x1f')]+_0x4e9233[_0xfcfc('0x21')];var _0x17c694;if(_0x40709e>=_0x5543ef){_0x40709e=_0x5543ef;_0x17c694=0xc8;}else{_0x17c694=0xce;}_0x536f46[_0xfcfc('0x1c')](_0x17c694);return _0x536f46[_0xfcfc('0x23')]('Content-Range',_0x3abe7a+'-'+_0x40709e+'/'+_0x5543ef)[_0xfcfc('0x1e')](_0x50f7ef);}return null;};}function patchUpdates(_0x3ce2b5){return function(_0x1697f7){try{jsonpatch[_0xfcfc('0x24')](_0x1697f7,_0x3ce2b5,!![]);}catch(_0x260eb9){return BPromise[_0xfcfc('0x25')](_0x260eb9);}return _0x1697f7[_0xfcfc('0x26')]();};}function saveUpdates(_0x47340a,_0x51ac14){return function(_0x12353d){if(_0x12353d){return _0x12353d[_0xfcfc('0x27')](_0x47340a)['then'](function(_0x223629){return _0x223629;});}return null;};}function removeEntity(_0x11bf79,_0x435784){return function(_0x412084){if(_0x412084){return _0x412084[_0xfcfc('0x28')]()[_0xfcfc('0x29')](function(){_0x11bf79[_0xfcfc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12696a,_0x37e02c){return function(_0x5d39bf){if(!_0x5d39bf){_0x12696a[_0xfcfc('0x1b')](0x194);}return _0x5d39bf;};}function handleError(_0x31e0ad,_0x5eb8de){_0x5eb8de=_0x5eb8de||0x1f4;return function(_0x23c005){logger[_0xfcfc('0x2a')](_0x23c005[_0xfcfc('0x2b')]);if(_0x23c005['name']){delete _0x23c005[_0xfcfc('0x2c')];}_0x31e0ad[_0xfcfc('0x1c')](_0x5eb8de)[_0xfcfc('0x2d')](_0x23c005);};}exports[_0xfcfc('0x2e')]=function(_0x4846d8,_0x333f0f){var _0x17c979={},_0x5b8455={},_0x1f11ae={'count':0x0,'rows':[]};var _0x4efe14=_[_0xfcfc('0x2f')](db['VoiceRecording'][_0xfcfc('0x30')],function(_0x1496c1){return{'name':_0x1496c1[_0xfcfc('0x31')],'type':_0x1496c1[_0xfcfc('0x32')][_0xfcfc('0x33')]};});_0x5b8455[_0xfcfc('0x34')]=_['differenceBy'](_[_0xfcfc('0x2f')](_0x4efe14,_0xfcfc('0x2c')),[_0xfcfc('0x35')]);_0x5b8455[_0xfcfc('0x36')]=_[_0xfcfc('0x37')](_0x4846d8[_0xfcfc('0x36')]);_0x5b8455[_0xfcfc('0x38')]=_[_0xfcfc('0x39')](_0x5b8455[_0xfcfc('0x34')],_0x5b8455[_0xfcfc('0x36')]);_0x17c979['attributes']=_[_0xfcfc('0x39')](_0x5b8455[_0xfcfc('0x34')],qs[_0xfcfc('0x3a')](_0x4846d8['query']['fields']));_0x17c979[_0xfcfc('0x3b')]=_0x17c979[_0xfcfc('0x3b')][_0xfcfc('0x3c')]?_0x17c979[_0xfcfc('0x3b')]:_0x5b8455['model'];if(!_0x4846d8[_0xfcfc('0x36')][_0xfcfc('0x3d')](_0xfcfc('0x3e'))){_0x17c979[_0xfcfc('0x21')]=qs[_0xfcfc('0x21')](_0x4846d8['query'][_0xfcfc('0x21')]);_0x17c979['offset']=qs[_0xfcfc('0x1f')](_0x4846d8[_0xfcfc('0x36')][_0xfcfc('0x1f')]);}_0x17c979[_0xfcfc('0x3f')]=qs[_0xfcfc('0x40')](_0x4846d8[_0xfcfc('0x36')]['sort']);_0x17c979['where']=qs[_0xfcfc('0x38')](_[_0xfcfc('0x41')](_0x4846d8[_0xfcfc('0x36')],_0x5b8455['filters']),_0x4efe14);if(_0x4846d8[_0xfcfc('0x36')][_0xfcfc('0x42')]){_0x17c979[_0xfcfc('0x43')]=_['merge'](_0x17c979[_0xfcfc('0x43')],{'$or':_[_0xfcfc('0x2f')](_0x4efe14,function(_0x4b2efe){if(_0x4b2efe[_0xfcfc('0x32')]!==_0xfcfc('0x44')){var _0x8031f3={};_0x8031f3[_0x4b2efe['name']]={'$like':'%'+_0x4846d8['query']['filter']+'%'};return _0x8031f3;}})});}_0x17c979=_[_0xfcfc('0x45')]({},_0x17c979,_0x4846d8['options']);var _0x22f6ce={'where':_0x17c979['where']};return db[_0xfcfc('0x46')][_0xfcfc('0x22')](_0x22f6ce)[_0xfcfc('0x29')](function(_0x6884e5){_0x1f11ae[_0xfcfc('0x22')]=_0x6884e5;if(_0x4846d8[_0xfcfc('0x36')][_0xfcfc('0x47')]){_0x17c979[_0xfcfc('0x48')]=[{'all':!![]}];}return db[_0xfcfc('0x46')][_0xfcfc('0x49')](_0x17c979);})[_0xfcfc('0x29')](function(_0x35f6d2){_0x1f11ae[_0xfcfc('0x4a')]=_0x35f6d2;return _0x1f11ae;})['then'](respondWithFilteredResult(_0x333f0f,_0x17c979))[_0xfcfc('0x4b')](handleError(_0x333f0f,null));};exports[_0xfcfc('0x4c')]=function(_0x477a76,_0x116d13){var _0x5c0c30={'raw':![],'where':{'id':_0x477a76[_0xfcfc('0x4d')]['id']}},_0x2af512={};_0x2af512['model']=_[_0xfcfc('0x37')](db[_0xfcfc('0x46')][_0xfcfc('0x30')]);_0x2af512[_0xfcfc('0x36')]=_[_0xfcfc('0x37')](_0x477a76[_0xfcfc('0x36')]);_0x2af512['filters']=_['intersection'](_0x2af512[_0xfcfc('0x34')],_0x2af512[_0xfcfc('0x36')]);_0x5c0c30[_0xfcfc('0x3b')]=_[_0xfcfc('0x39')](_0x2af512[_0xfcfc('0x34')],qs[_0xfcfc('0x3a')](_0x477a76[_0xfcfc('0x36')][_0xfcfc('0x3a')]));_0x5c0c30[_0xfcfc('0x3b')]=_0x5c0c30[_0xfcfc('0x3b')][_0xfcfc('0x3c')]?_0x5c0c30['attributes']:_0x2af512[_0xfcfc('0x34')];if(_0x477a76[_0xfcfc('0x36')][_0xfcfc('0x47')]){_0x5c0c30['include']=[{'all':!![]}];}_0x5c0c30=_['merge']({},_0x5c0c30,_0x477a76[_0xfcfc('0x4e')]);return db['VoiceRecording'][_0xfcfc('0x4f')](_0x5c0c30)[_0xfcfc('0x29')](handleEntityNotFound(_0x116d13,null))[_0xfcfc('0x29')](respondWithResult(_0x116d13,null))[_0xfcfc('0x4b')](handleError(_0x116d13,null));};exports[_0xfcfc('0x50')]=function(_0x4765ed,_0x585851){return db[_0xfcfc('0x46')][_0xfcfc('0x50')](_0x4765ed[_0xfcfc('0x51')],{})[_0xfcfc('0x29')](respondWithResult(_0x585851,0xc9))['catch'](handleError(_0x585851,null));};exports[_0xfcfc('0x27')]=function(_0x56726b,_0x3fe8fe){if(_0x56726b[_0xfcfc('0x51')]['id']){delete _0x56726b[_0xfcfc('0x51')]['id'];}return db[_0xfcfc('0x46')][_0xfcfc('0x4f')]({'where':{'id':_0x56726b[_0xfcfc('0x4d')]['id']}})[_0xfcfc('0x29')](handleEntityNotFound(_0x3fe8fe,null))[_0xfcfc('0x29')](saveUpdates(_0x56726b[_0xfcfc('0x51')],null))[_0xfcfc('0x29')](respondWithResult(_0x3fe8fe,null))[_0xfcfc('0x4b')](handleError(_0x3fe8fe,null));};exports[_0xfcfc('0x52')]=function(_0x5863e8,_0x6c2506){return db[_0xfcfc('0x46')]['describe']()[_0xfcfc('0x29')](respondWithResult(_0x6c2506,null))[_0xfcfc('0x4b')](handleError(_0x6c2506,null));};exports[_0xfcfc('0x53')]=function(_0x212e26,_0x2477a7,_0x5adab5){var _0x590a3c=require('../../components/encryptor');var _0x114cc2=![];var _0x53c8b1={};if(_0x212e26[_0xfcfc('0x36')][_0xfcfc('0x32')]&&_0x212e26[_0xfcfc('0x36')][_0xfcfc('0x32')]===_0xfcfc('0x54')){_0x53c8b1['uniqueid']=_0x212e26[_0xfcfc('0x4d')]['id'];}else{_0x53c8b1['id']=_0x212e26['params']['id'];}return db[_0xfcfc('0x46')][_0xfcfc('0x4f')]({'where':_0x53c8b1,'attributes':['id',_0xfcfc('0x55')],'raw':!![]})[_0xfcfc('0x29')](handleEntityNotFound(_0x2477a7,null))['then'](function(_0x373389){if(_0x373389){var _0x169e4=_0x373389['value'];var _0x648520=util[_0xfcfc('0x35')](_0xfcfc('0x56'),_0x169e4);if(fs[_0xfcfc('0x57')](_0x648520)){_0x114cc2=!![];return _0x590a3c[_0xfcfc('0x58')](_0x648520,_0x169e4,config[_0xfcfc('0x59')]['recording'])[_0xfcfc('0x29')](function(){return _0x373389;});}return _0x373389;}})[_0xfcfc('0x29')](function(_0x577fcf){if(_0x577fcf){var _0x5103b8=_0x577fcf[_0xfcfc('0x55')];if(!fs[_0xfcfc('0x57')](_0x5103b8)){throw new db[(_0xfcfc('0x5a'))][(_0xfcfc('0x5b'))](_0xfcfc('0x5c'));}if(_0x577fcf[_0xfcfc('0x5d')]){return _0x2477a7['download'](_0x5103b8,_0x577fcf[_0xfcfc('0x5d')]+path['extname'](_0x5103b8),function(){if(_0x114cc2){fs['unlink'](_0x5103b8);}});}else{return _0x2477a7[_0xfcfc('0x53')](_0x5103b8,function(_0x40ca3b){if(_0x114cc2){fs[_0xfcfc('0x5e')](_0x5103b8);}});}}})['catch'](function(_0x48d2e3){if(_0x48d2e3[_0xfcfc('0x5f')]===_0xfcfc('0x5c')){_0x2477a7[_0xfcfc('0x1c')](0x194)[_0xfcfc('0x2d')](_0xfcfc('0x60'));}else{return handleError(_0x2477a7,null);}});};exports[_0xfcfc('0x61')]=function(_0x46ac7a,_0x18f69b,_0x5ba763){var _0x1b4bfb=require(_0xfcfc('0x62'));var _0x1bd3c8=![];var _0x178a9d={'$and':[db[_0xfcfc('0x63')][_0xfcfc('0x43')](db[_0xfcfc('0x63')]['fn'](_0xfcfc('0x64'),db['sequelize'][_0xfcfc('0x65')](_0xfcfc('0x54'))),_0x46ac7a[_0xfcfc('0x36')][_0xfcfc('0x66')])]};if(_0x46ac7a[_0xfcfc('0x36')][_0xfcfc('0x32')]&&_0x46ac7a[_0xfcfc('0x36')]['type']===_0xfcfc('0x54')){_0x178a9d[_0xfcfc('0x67')]['push']({'uniqueid':_0x46ac7a[_0xfcfc('0x4d')]['id']});}else{_0x178a9d[_0xfcfc('0x67')][_0xfcfc('0x68')]({'id':_0x46ac7a[_0xfcfc('0x4d')]['id']});}return db['VoiceRecording'][_0xfcfc('0x4f')]({'where':_0x178a9d,'attributes':['id','value'],'raw':!![]})['then'](handleEntityNotFound(_0x18f69b,null))[_0xfcfc('0x29')](function(_0x25d228){if(_0x25d228){var _0x203226=util[_0xfcfc('0x35')](_0xfcfc('0x56'),_0x25d228[_0xfcfc('0x55')]);if(fs[_0xfcfc('0x57')](_0x203226)){_0x1bd3c8=!![];return _0x1b4bfb[_0xfcfc('0x58')](_0x203226,_0x25d228['value'],config[_0xfcfc('0x59')][_0xfcfc('0x69')])['then'](function(){return _0x25d228;});}return _0x25d228;}})['then'](function(_0x2f4d89){if(_0x2f4d89){if(!fs[_0xfcfc('0x57')](_0x2f4d89[_0xfcfc('0x55')])){throw new db['Sequelize'][(_0xfcfc('0x5b'))](_0xfcfc('0x5c'));}if(_0x2f4d89[_0xfcfc('0x5d')]){return _0x18f69b[_0xfcfc('0x53')](_0x2f4d89['value'],_0x2f4d89[_0xfcfc('0x5d')]+path[_0xfcfc('0x6a')](_0x2f4d89[_0xfcfc('0x55')]),function(){if(_0x1bd3c8){fs['unlink'](_0x2f4d89['value']);}});}else{return _0x18f69b[_0xfcfc('0x53')](_0x2f4d89[_0xfcfc('0x55')],function(_0x2f982a){if(_0x1bd3c8){fs[_0xfcfc('0x5e')](_0x2f4d89[_0xfcfc('0x55')]);}});}}})[_0xfcfc('0x4b')](handleError(_0x18f69b,null));};exports[_0xfcfc('0x28')]=function(_0x110823,_0x1a7cac){return db[_0xfcfc('0x46')]['find']({'where':{'id':_0x110823[_0xfcfc('0x4d')]['id']}})[_0xfcfc('0x29')](function(_0x120e0c){if(_[_0xfcfc('0x6b')](_0x120e0c)){throw new ReferenceError(_0xfcfc('0x6c'));}return _0x120e0c;})[_0xfcfc('0x29')](function(_0x1d019b){var _0x363300=_0x1d019b[_0xfcfc('0x55')];logger['info'](_0xfcfc('0x6d'),_0x363300);if(!_['isNil'](_0x1d019b[_0xfcfc('0x55')])&&fs[_0xfcfc('0x57')](_0x363300)){logger['info'](_0xfcfc('0x6e')+_0x363300+_0xfcfc('0x6f'));fs[_0xfcfc('0x70')](_0x363300);}_0x363300=_0x363300+_0xfcfc('0x71');if(!_['isNil'](_0x1d019b[_0xfcfc('0x55')])&&fs[_0xfcfc('0x57')](_0x363300)){logger[_0xfcfc('0x72')](_0xfcfc('0x6e')+_0x363300+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x363300);}return _0x1d019b;})[_0xfcfc('0x29')](function(_0x278609){if(!_0x278609)throw new InternalError();return _0x278609[_0xfcfc('0x28')]();})[_0xfcfc('0x29')](function(){_0x1a7cac['status'](0xcc)[_0xfcfc('0x1d')]();})['catch'](handleError(_0x1a7cac,null));};function getBucketslist(_0x48e646,_0x15f629,_0x264bc2){return new Promise(function(_0x17d988,_0x2cb216){var _0x5d475c=new AWS['S3']({'accessKeyId':_0x15f629,'secretAccessKey':_0x48e646,'region':_0x264bc2});_0x5d475c[_0xfcfc('0x73')]({},function(_0x8f8b61,_0x3a9690){if(_0x8f8b61){return _0x2cb216(_0x8f8b61);}else{return _0x17d988(_0x3a9690);}});});}function createBucket(_0x474320,_0x1d4c6d,_0x14b918,_0x9bf685){return new Promise(function(_0x489c47,_0x2f60a4){var _0x4b3f12=new AWS['S3']({'accessKeyId':_0x1d4c6d,'secretAccessKey':_0x474320,'region':_0x14b918});_0x4b3f12[_0xfcfc('0x74')]({'Bucket':_0x9bf685},function(_0x45c5d9,_0x3b7475){if(_0x45c5d9){return _0x2f60a4(_0x45c5d9);}else{return _0x489c47(_0x3b7475);}});});}function uploadFile(_0x54bdfe,_0x237f01,_0x57d414,_0x5c9114,_0x5eff1b,_0x58ce65){return new Promise(function(_0x1f184f,_0x9126a8){var _0x3bb2b8=new AWS['S3']({'accessKeyId':_0x237f01,'secretAccessKey':_0x54bdfe,'region':_0x57d414});_0x3bb2b8[_0xfcfc('0x75')]({'Bucket':_0x5c9114,'Key':_0x5eff1b,'Body':_0x58ce65},function(_0x325cfb,_0x3dbed5){if(_0x325cfb){return _0x9126a8(_0x325cfb);}else{return _0x1f184f(_0x3dbed5);}});});}function startTranscribe(_0x13159e,_0xc79bb7,_0x425105,_0x5f4f26,_0x459ed0,_0x1814e4){return new Promise(function(_0xabf2ad,_0x6bea66){var _0x3b2149=new AWS[(_0xfcfc('0x76'))]({'accessKeyId':_0xc79bb7,'secretAccessKey':_0x13159e,'region':_0x425105});_0x3b2149[_0xfcfc('0x77')]({'TranscriptionJobName':_0x5f4f26,'LanguageCode':_0x459ed0,'Media':{'MediaFileUri':_0x1814e4}},function(_0x4e2a0a,_0x23e2a1){if(_0x4e2a0a){return _0x6bea66(_0x4e2a0a);}else{return _0xabf2ad(_0x23e2a1);}});});}function transcribe(_0x53137e,_0x5c15a6,_0x2cbb63,_0x448cb8,_0xff10e,_0x80ff33,_0x139f66){return new Promise(function(_0x2b2c39,_0x43ccdf){var _0x3d5c19={};logger[_0xfcfc('0x72')](util[_0xfcfc('0x35')]('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x53137e,_0xff10e));return uploadFile(_0x5c15a6,_0x2cbb63,_0x448cb8,_0xff10e,path[_0xfcfc('0x78')](_0x80ff33),fs[_0xfcfc('0x79')](_0x80ff33))[_0xfcfc('0x29')](function(_0x490b4a){logger['info'](util[_0xfcfc('0x35')](_0xfcfc('0x7a'),_0x53137e,_0xff10e,_0x490b4a[_0xfcfc('0x7b')]));_0x3d5c19['bucket']=_0x490b4a[_0xfcfc('0x7c')];_0x3d5c19[_0xfcfc('0x7d')]=_0x490b4a[_0xfcfc('0x7b')];logger[_0xfcfc('0x72')](util[_0xfcfc('0x35')](_0xfcfc('0x7e'),_0x53137e));return startTranscribe(_0x5c15a6,_0x2cbb63,_0x448cb8,uuidv4(),_0x139f66,_0x490b4a[_0xfcfc('0x7b')]);})[_0xfcfc('0x29')](function(_0xcfa8cc){logger[_0xfcfc('0x72')](util[_0xfcfc('0x35')](_0xfcfc('0x7f'),_0x53137e,_0xcfa8cc[_0xfcfc('0x80')][_0xfcfc('0x81')]));_0x3d5c19[_0xfcfc('0x82')]=_0xcfa8cc[_0xfcfc('0x80')][_0xfcfc('0x81')];_0x3d5c19[_0xfcfc('0x83')]=_0xcfa8cc[_0xfcfc('0x80')][_0xfcfc('0x84')];return _0x2b2c39(_0x3d5c19);})['catch'](function(_0xaa5fb8){return _0x43ccdf(_0xaa5fb8);});});}exports[_0xfcfc('0x85')]=function(_0x4613fa,_0x49c6e7,_0x4a4867){var _0x2a1419;var _0x3c8688;var _0x1d883f;var _0x1055cf=require('../../components/encryptor');return db[_0xfcfc('0x46')][_0xfcfc('0x86')]({'where':{'id':_0x4613fa[_0xfcfc('0x4d')]['id']}})['then'](function(_0x34724b){if(_0x34724b){var _0xf5db8a=util[_0xfcfc('0x35')](_0xfcfc('0x56'),_0x34724b[_0xfcfc('0x55')]);if(fs[_0xfcfc('0x57')](_0xf5db8a)){cypher=!![];return _0x1055cf['decryptFile'](_0xf5db8a,_0x34724b[_0xfcfc('0x55')],config[_0xfcfc('0x59')][_0xfcfc('0x69')])[_0xfcfc('0x29')](function(){return _0x34724b;});}return _0x34724b;}})[_0xfcfc('0x29')](function(_0x31f3aa){if(!_0x31f3aa){throw new db[(_0xfcfc('0x5a'))][(_0xfcfc('0x5b'))](_0xfcfc('0x87'));}_0x3c8688=_0x31f3aa;return db[_0xfcfc('0x88')][_0xfcfc('0x86')]({'where':{'id':0x1}});})['then'](handleEntityNotFound(_0x49c6e7,null))[_0xfcfc('0x29')](function(_0x224083){if(_0x224083){_0x2a1419=_0x224083;if(!_0x2a1419[_0xfcfc('0x89')]||!_0x2a1419[_0xfcfc('0x8a')]||!_0x2a1419['transcribeRegion']||!_0x2a1419['language']||!_0x2a1419[_0xfcfc('0x8b')]){throw new db['Sequelize']['ValidationError'](_0xfcfc('0x8c'));}if(_0x4613fa[_0xfcfc('0x51')][_0xfcfc('0x8d')]&&(!_0x2a1419[_0xfcfc('0x8e')]||!_0x2a1419[_0xfcfc('0x8f')]||!_0x2a1419[_0xfcfc('0x90')]||!_0x2a1419[_0xfcfc('0x91')]||!_0x2a1419[_0xfcfc('0x8b')])){throw new db[(_0xfcfc('0x5a'))][(_0xfcfc('0x5b'))]('Sentiment\x20Analysis\x20not\x20configured');}return db[_0xfcfc('0x92')][_0xfcfc('0x86')]({'where':{'id':_0x2a1419['transcribeAccountId']}});}})[_0xfcfc('0x29')](function(_0x2434e3){if(!_0x2434e3){throw new db['Sequelize'][(_0xfcfc('0x5b'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x2434e3[_0xfcfc('0x93')]||!_0x2434e3[_0xfcfc('0x94')]){throw new db['Sequelize'][(_0xfcfc('0x5b'))]('Cloud\x20Provider\x20not\x20configured');}_0x1d883f=_0x2434e3;return getBucketslist(_0x1d883f['data1'],_0x1d883f[_0xfcfc('0x94')],_0x2a1419['transcribeRegion']);})[_0xfcfc('0x29')](function(_0x4491eb){if(_0x4491eb&&_0x4491eb[_0xfcfc('0x95')]){var _0x18f1bc=_[_0xfcfc('0x4f')](_0x4491eb[_0xfcfc('0x95')],function(_0x14d5a5){return _0x14d5a5['Name']===_0x2a1419[_0xfcfc('0x8b')];});if(!_0x18f1bc){logger[_0xfcfc('0x72')](util[_0xfcfc('0x35')](_0xfcfc('0x96'),_0x4613fa['params']['id'],_0x2a1419['bucket']));return createBucket(_0x1d883f[_0xfcfc('0x93')],_0x1d883f[_0xfcfc('0x94')],_0x2a1419[_0xfcfc('0x97')],_0x2a1419[_0xfcfc('0x8b')]);}logger['info'](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available',_0x4613fa[_0xfcfc('0x4d')]['id'],_0x2a1419[_0xfcfc('0x8b')]));return;}})[_0xfcfc('0x29')](function(_0x416906){if(_0x3c8688[_0xfcfc('0x83')]===_0xfcfc('0x98')){return transcribe(_0x4613fa['params']['id'],_0x1d883f[_0xfcfc('0x93')],_0x1d883f[_0xfcfc('0x94')],_0x2a1419['transcribeRegion'],_0x2a1419['bucket'],_0x3c8688[_0xfcfc('0x55')],_0x2a1419[_0xfcfc('0x91')]);}else{logger[_0xfcfc('0x72')](util[_0xfcfc('0x35')](_0xfcfc('0x99'),_0x4613fa[_0xfcfc('0x4d')]['id']));return{'transcribeStatus':'IN_PROGRESS'};}})[_0xfcfc('0x29')](function(_0x383f73){if(_0x383f73){_0x383f73[_0xfcfc('0x9a')]=_0x4613fa[_0xfcfc('0x51')][_0xfcfc('0x8d')];return _0x3c8688['updateAttributes'](_0x383f73);}})[_0xfcfc('0x29')](respondWithResult(_0x49c6e7,null))[_0xfcfc('0x4b')](handleError(_0x49c6e7,null));};function writeFile(_0x23b2ed,_0x227127){return new Promise(function(_0x53886a,_0x5a4a52){fs[_0xfcfc('0x9b')](_0x227127,_0x23b2ed,function(_0x24761f,_0x45c826){if(_0x24761f){return _0x5a4a52(_0x24761f);}else{return _0x53886a(_0x45c826);}});});}exports[_0xfcfc('0x9c')]=function(_0x21d894,_0x562138,_0x159fd6){return db[_0xfcfc('0x46')]['findOne']({'where':{'id':_0x21d894[_0xfcfc('0x4d')]['id']}})[_0xfcfc('0x29')](handleEntityNotFound(_0x562138))[_0xfcfc('0x29')](function(_0xef128f){if(_0xef128f&&_0xef128f[_0xfcfc('0x9d')]){var _0x10393b=_0xef128f[_0xfcfc('0x9d')];var _0x5e5250=config[_0xfcfc('0x9e')]+'/server/files/transcribes/transcribe_'+_0xef128f['id']+'.txt';if(fs[_0xfcfc('0x57')](_0x5e5250)){return _0x5e5250;}return writeFile(_0x10393b,_0x5e5250)[_0xfcfc('0x29')](function(){return _0x5e5250;});}else{throw new db['Sequelize'][(_0xfcfc('0x5b'))]('Transcript\x20not\x20available');}})['then'](function(_0x422e95){return _0x562138[_0xfcfc('0x53')](_0x422e95);})[_0xfcfc('0x4b')](handleError(_0x562138));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 8db4b8c..4c0ed73 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 _0x657e=['request-promise','path','rimraf','exports','define','VoiceRecording','voice_recordings','uniqueid','lodash','util','../../config/logger','api','bluebird'];(function(_0x41c428,_0x49f81f){var _0x1c7afa=function(_0x1d8032){while(--_0x1d8032){_0x41c428['push'](_0x41c428['shift']());}};_0x1c7afa(++_0x49f81f);}(_0x657e,0x1c2));var _0xe657=function(_0x11e30d,_0x5584aa){_0x11e30d=_0x11e30d-0x0;var _0x2d4e29=_0x657e[_0x11e30d];return _0x2d4e29;};'use strict';var _=require(_0xe657('0x0'));var util=require(_0xe657('0x1'));var logger=require(_0xe657('0x2'))(_0xe657('0x3'));var moment=require('moment');var BPromise=require(_0xe657('0x4'));var rp=require(_0xe657('0x5'));var fs=require('fs');var path=require(_0xe657('0x6'));var rimraf=require(_0xe657('0x7'));var config=require('../../config/environment');var attributes=require('./voiceRecording.attributes');module[_0xe657('0x8')]=function(_0x44054a,_0x50ae3b){return _0x44054a[_0xe657('0x9')](_0xe657('0xa'),attributes,{'tableName':_0xe657('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0xe657('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5a1b=['voice_recordings','uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','./voiceRecording.attributes','define'];(function(_0x147084,_0xbf6d38){var _0x4c8e2d=function(_0x18816d){while(--_0x18816d){_0x147084['push'](_0x147084['shift']());}};_0x4c8e2d(++_0xbf6d38);}(_0x5a1b,0xe6));var _0xb5a1=function(_0x2baac5,_0x40b13c){_0x2baac5=_0x2baac5-0x0;var _0x120192=_0x5a1b[_0x2baac5];return _0x120192;};'use strict';var _=require(_0xb5a1('0x0'));var util=require(_0xb5a1('0x1'));var logger=require(_0xb5a1('0x2'))(_0xb5a1('0x3'));var moment=require(_0xb5a1('0x4'));var BPromise=require('bluebird');var rp=require(_0xb5a1('0x5'));var fs=require('fs');var path=require(_0xb5a1('0x6'));var rimraf=require(_0xb5a1('0x7'));var config=require('../../config/environment');var attributes=require(_0xb5a1('0x8'));module['exports']=function(_0x1fbb20,_0x123910){return _0x1fbb20[_0xb5a1('0x9')]('VoiceRecording',attributes,{'tableName':_0xb5a1('0xa'),'paranoid':![],'indexes':[{'name':_0xb5a1('0xb'),'fields':[_0xb5a1('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index be49b28..d8e4a91 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 _0x2272=['client','http','request','then','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','CreateVoiceRecording','Setting','findOne','callRecordingEncryption','format','%s.cypher','encryptFile','secrets','recording','unlink','value','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise'];(function(_0x36ffd5,_0x130ede){var _0x22bd77=function(_0x1db7ae){while(--_0x1db7ae){_0x36ffd5['push'](_0x36ffd5['shift']());}};_0x22bd77(++_0x130ede);}(_0x2272,0xd8));var _0x2227=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x2272[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2227('0x0'));var util=require(_0x2227('0x1'));var moment=require(_0x2227('0x2'));var BPromise=require(_0x2227('0x3'));var rs=require(_0x2227('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2227('0x5'))['db'];var utils=require(_0x2227('0x6'));var logger=require(_0x2227('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x2227('0x8'));var client=jayson[_0x2227('0x9')][_0x2227('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2591db,_0xaec623,_0x1413d2){return new BPromise(function(_0x41fc3f,_0x34bdd0){return client[_0x2227('0xb')](_0x2591db,_0x1413d2)[_0x2227('0xc')](function(_0x496bbd){logger[_0x2227('0xd')]('VoiceRecording,\x20%s,\x20%s',_0xaec623,_0x2227('0xe'));logger[_0x2227('0xf')](_0x2227('0x10'),_0xaec623,_0x2227('0xe'),JSON[_0x2227('0x11')](_0x496bbd));if(_0x496bbd['error']){if(_0x496bbd[_0x2227('0x12')][_0x2227('0x13')]===0x1f4){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x496bbd[_0x2227('0x12')][_0x2227('0x15')]);return _0x34bdd0(_0x496bbd['error']['message']);}logger['error'](_0x2227('0x14'),_0xaec623,_0x496bbd['error'][_0x2227('0x15')]);return _0x41fc3f(_0x496bbd[_0x2227('0x12')]['message']);}else{logger[_0x2227('0xd')](_0x2227('0x14'),_0xaec623,_0x2227('0xe'));_0x41fc3f(_0x496bbd[_0x2227('0x16')][_0x2227('0x15')]);}})[_0x2227('0x17')](function(_0x508e92){logger[_0x2227('0x12')](_0x2227('0x14'),_0xaec623,_0x508e92);_0x34bdd0(_0x508e92);});});}exports[_0x2227('0x18')]=function(_0x531f75){var _0x11bf80=this;return new Promise(function(_0x620012,_0x65e3b6){return db[_0x2227('0x19')][_0x2227('0x1a')](_0x531f75[_0x2227('0x1b')],{'raw':_0x531f75[_0x2227('0x1c')]?_0x531f75['options'][_0x2227('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x531f75['options']?_0x531f75[_0x2227('0x1c')][_0x2227('0x1e')]||null:null,'attributes':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x1f')]||null:null,'limit':_0x531f75[_0x2227('0x1c')]?_0x531f75[_0x2227('0x1c')][_0x2227('0x20')]||null:null})[_0x2227('0xc')](function(_0x34c090){logger[_0x2227('0xd')]('UpdateVoiceRecording',_0x531f75);logger[_0x2227('0xf')](_0x2227('0x18'),_0x531f75,JSON['stringify'](_0x34c090));_0x620012(_0x34c090);})[_0x2227('0x17')](function(_0xbfdce1){logger['error']('UpdateVoiceRecording',_0xbfdce1[_0x2227('0x15')],_0x531f75);_0x65e3b6(_0x11bf80[_0x2227('0x12')](0x1f4,_0xbfdce1[_0x2227('0x15')]));});});};exports[_0x2227('0x21')]=function(_0x5be889){var _0x191a3e=this;return new Promise(function(_0x301304,_0x2d8ea0){var _0x1957ee=require('../../components/encryptor');var _0x204def;return db[_0x2227('0x22')][_0x2227('0x23')]({'attributes':['id',_0x2227('0x24')],'where':{'id':0x1},'raw':!![]})[_0x2227('0xc')](function(_0x4789eb){_0x204def=_0x4789eb;return db['VoiceRecording']['create'](_0x5be889[_0x2227('0x1b')]);})['then'](function(_0x2ba581){if(_0x204def[_0x2227('0x24')]&&fs['existsSync'](_0x2ba581['value'])){var _0x1f1ba7=util[_0x2227('0x25')](_0x2227('0x26'),_0x2ba581['value']);return _0x1957ee[_0x2227('0x27')](_0x2ba581['value'],_0x1f1ba7,config[_0x2227('0x28')][_0x2227('0x29')])[_0x2227('0xc')](function(){fs[_0x2227('0x2a')](_0x2ba581[_0x2227('0x2b')]);logger[_0x2227('0xd')](_0x2227('0x2c'));return _0x2ba581;});}return _0x2ba581;})[_0x2227('0xc')](function(_0xd38f59){logger[_0x2227('0xd')](_0x2227('0x21'),_0x5be889);logger['debug'](_0x2227('0x21'),_0x5be889,JSON[_0x2227('0x11')](_0xd38f59));_0x301304(_0xd38f59);})[_0x2227('0x17')](function(_0x6cd5d7){logger['error'](_0x2227('0x21'),_0x6cd5d7[_0x2227('0x15')],_0x5be889);_0x2d8ea0(_0x191a3e[_0x2227('0x12')](0x1f4,_0x6cd5d7[_0x2227('0x15')]));});});}; \ No newline at end of file +var _0x4137=['attributes','catch','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','then','VoiceRecording','existsSync','value','format','%s.cypher','encryptFile','secrets','recording','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceRecording,\x20%s,\x20%s','message','UpdateVoiceRecording','update','body','options','where'];(function(_0x540133,_0x41783f){var _0x26b6e9=function(_0x10ebe3){while(--_0x10ebe3){_0x540133['push'](_0x540133['shift']());}};_0x26b6e9(++_0x41783f);}(_0x4137,0xf8));var _0x7413=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0x4137[_0x40a045];return _0x1a687c;};'use strict';var _=require(_0x7413('0x0'));var util=require(_0x7413('0x1'));var moment=require(_0x7413('0x2'));var BPromise=require(_0x7413('0x3'));var rs=require(_0x7413('0x4'));var fs=require('fs');var Redis=require(_0x7413('0x5'));var db=require(_0x7413('0x6'))['db'];var utils=require(_0x7413('0x7'));var logger=require(_0x7413('0x8'))(_0x7413('0x9'));var config=require(_0x7413('0xa'));var jayson=require(_0x7413('0xb'));var client=jayson['client'][_0x7413('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x188d89,_0x5b39ac,_0x15af0d){return new BPromise(function(_0x5f4cd0,_0x3236ec){return client[_0x7413('0xd')](_0x188d89,_0x15af0d)['then'](function(_0x422bf5){logger[_0x7413('0xe')]('VoiceRecording,\x20%s,\x20%s',_0x5b39ac,_0x7413('0xf'));logger[_0x7413('0x10')](_0x7413('0x11'),_0x5b39ac,_0x7413('0xf'),JSON[_0x7413('0x12')](_0x422bf5));if(_0x422bf5['error']){if(_0x422bf5[_0x7413('0x13')][_0x7413('0x14')]===0x1f4){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);return _0x3236ec(_0x422bf5['error']['message']);}logger['error'](_0x7413('0x15'),_0x5b39ac,_0x422bf5[_0x7413('0x13')]['message']);return _0x5f4cd0(_0x422bf5[_0x7413('0x13')][_0x7413('0x16')]);}else{logger['info'](_0x7413('0x15'),_0x5b39ac,'request\x20sent');_0x5f4cd0(_0x422bf5['result'][_0x7413('0x16')]);}})['catch'](function(_0x195c72){logger['error'](_0x7413('0x15'),_0x5b39ac,_0x195c72);_0x3236ec(_0x195c72);});});}exports[_0x7413('0x17')]=function(_0x19157f){var _0x12a01e=this;return new Promise(function(_0x2a3417,_0x26dafe){return db['VoiceRecording'][_0x7413('0x18')](_0x19157f[_0x7413('0x19')],{'raw':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')][_0x7413('0x1b')]||null:null,'attributes':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')][_0x7413('0x1c')]||null:null,'limit':_0x19157f[_0x7413('0x1a')]?_0x19157f[_0x7413('0x1a')]['limit']||null:null})['then'](function(_0x138508){logger['info'](_0x7413('0x17'),_0x19157f);logger[_0x7413('0x10')](_0x7413('0x17'),_0x19157f,JSON[_0x7413('0x12')](_0x138508));_0x2a3417(_0x138508);})[_0x7413('0x1d')](function(_0x346ce8){logger[_0x7413('0x13')](_0x7413('0x17'),_0x346ce8[_0x7413('0x16')],_0x19157f);_0x26dafe(_0x12a01e['error'](0x1f4,_0x346ce8['message']));});});};exports[_0x7413('0x1e')]=function(_0x48c2dc){var _0x46c895=this;return new Promise(function(_0x71cbb4,_0x463b21){var _0x4c2e90=require(_0x7413('0x1f'));var _0x896552;return db[_0x7413('0x20')][_0x7413('0x21')]({'attributes':['id',_0x7413('0x22')],'where':{'id':0x1},'raw':!![]})[_0x7413('0x23')](function(_0x5eb4d9){_0x896552=_0x5eb4d9;return db[_0x7413('0x24')]['create'](_0x48c2dc[_0x7413('0x19')]);})[_0x7413('0x23')](function(_0xae2969){if(_0x896552[_0x7413('0x22')]&&fs[_0x7413('0x25')](_0xae2969[_0x7413('0x26')])){var _0x5bb3ea=util[_0x7413('0x27')](_0x7413('0x28'),_0xae2969[_0x7413('0x26')]);return _0x4c2e90[_0x7413('0x29')](_0xae2969[_0x7413('0x26')],_0x5bb3ea,config[_0x7413('0x2a')][_0x7413('0x2b')])['then'](function(){fs[_0x7413('0x2c')](_0xae2969[_0x7413('0x26')]);logger[_0x7413('0xe')](_0x7413('0x2d'));return _0xae2969;});}return _0xae2969;})[_0x7413('0x23')](function(_0x51d676){logger[_0x7413('0xe')]('CreateVoiceRecording',_0x48c2dc);logger[_0x7413('0x10')](_0x7413('0x1e'),_0x48c2dc,JSON[_0x7413('0x12')](_0x51d676));_0x71cbb4(_0x51d676);})['catch'](function(_0xe6b096){logger['error'](_0x7413('0x1e'),_0xe6b096[_0x7413('0x16')],_0x48c2dc);_0x463b21(_0x46c895['error'](0x1f4,_0xe6b096['message']));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index 854e590..ce49e40 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 _0x31db=['exports','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','create','put','delete','destroy'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x31db,0xeb));var _0xb31d=function(_0x41ee16,_0xfa94c3){_0x41ee16=_0x41ee16-0x0;var _0x1f60de=_0x31db[_0x41ee16];return _0x1f60de;};'use strict';var multer=require(_0xb31d('0x0'));var util=require(_0xb31d('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb31d('0x2'));var router=express['Router']();var fs_extra=require(_0xb31d('0x3'));var auth=require(_0xb31d('0x4'));var interaction=require(_0xb31d('0x5'));var config=require(_0xb31d('0x6'));var controller=require('./voiceTransferReport.controller');router[_0xb31d('0x7')]('/',auth[_0xb31d('0x8')](),controller['index']);router[_0xb31d('0x7')](_0xb31d('0x9'),auth['isAuthenticated'](),controller[_0xb31d('0xa')]);router[_0xb31d('0x7')](_0xb31d('0xb'),auth['isAuthenticated'](),controller[_0xb31d('0xc')]);router['post']('/',auth[_0xb31d('0x8')](),controller[_0xb31d('0xd')]);router[_0xb31d('0xe')](_0xb31d('0xb'),auth[_0xb31d('0x8')](),controller['update']);router[_0xb31d('0xf')](_0xb31d('0xb'),auth[_0xb31d('0x8')](),controller[_0xb31d('0x10')]);module[_0xb31d('0x11')]=router; \ No newline at end of file +var _0x00ef=['describe','/:id','show','create','put','update','destroy','exports','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','index','/describe','isAuthenticated'];(function(_0x34cf54,_0x1367ec){var _0x221267=function(_0x56bfaf){while(--_0x56bfaf){_0x34cf54['push'](_0x34cf54['shift']());}};_0x221267(++_0x1367ec);}(_0x00ef,0x86));var _0xf00e=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x00ef[_0x46e363];return _0x3fb059;};'use strict';var multer=require(_0xf00e('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf00e('0x1'));var express=require(_0xf00e('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xf00e('0x3'));var interaction=require(_0xf00e('0x4'));var config=require('../../config/environment');var controller=require(_0xf00e('0x5'));router[_0xf00e('0x6')]('/',auth['isAuthenticated'](),controller[_0xf00e('0x7')]);router[_0xf00e('0x6')](_0xf00e('0x8'),auth[_0xf00e('0x9')](),controller[_0xf00e('0xa')]);router[_0xf00e('0x6')](_0xf00e('0xb'),auth[_0xf00e('0x9')](),controller[_0xf00e('0xc')]);router['post']('/',auth[_0xf00e('0x9')](),controller[_0xf00e('0xd')]);router[_0xf00e('0xe')](_0xf00e('0xb'),auth['isAuthenticated'](),controller[_0xf00e('0xf')]);router['delete'](_0xf00e('0xb'),auth[_0xf00e('0x9')](),controller[_0xf00e('0x10')]);module[_0xf00e('0x11')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 2e5b1ef..8c7c080 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 _0x0d45=['Yes','sequelize','moment','exports','ENUM','attended','STRING'];(function(_0x4d5937,_0x3f11c0){var _0x3ee313=function(_0x1b6656){while(--_0x1b6656){_0x4d5937['push'](_0x4d5937['shift']());}};_0x3ee313(++_0x3f11c0);}(_0x0d45,0xe1));var _0x50d4=function(_0x59c24e,_0x53c9f4){_0x59c24e=_0x59c24e-0x0;var _0x3fa0a9=_0x0d45[_0x59c24e];return _0x3fa0a9;};'use strict';var Sequelize=require(_0x50d4('0x0'));var moment=require(_0x50d4('0x1'));module[_0x50d4('0x2')]={'type':{'type':Sequelize[_0x50d4('0x3')]('blind',_0x50d4('0x4'))},'result':{'type':Sequelize[_0x50d4('0x5')]},'transfererchannel':{'type':Sequelize[_0x50d4('0x5')]},'transferercalleridnum':{'type':Sequelize[_0x50d4('0x5')]},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize[_0x50d4('0x5')]},'transfererconnectedlinename':{'type':Sequelize[_0x50d4('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x50d4('0x5')]},'transferercontext':{'type':Sequelize[_0x50d4('0x5')]},'transfererexten':{'type':Sequelize['STRING']},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x50d4('0x5')]},'transfereecalleridnum':{'type':Sequelize[_0x50d4('0x5')]},'transfereecalleridname':{'type':Sequelize[_0x50d4('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x50d4('0x5')]},'transfereeconnectedlinename':{'type':Sequelize[_0x50d4('0x5')]},'transfereeaccountcode':{'type':Sequelize[_0x50d4('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x50d4('0x5')]},'transfereelinkedid':{'type':Sequelize[_0x50d4('0x5')]},'isexternal':{'type':Sequelize['ENUM'](_0x50d4('0x6'),'No')},'context':{'type':Sequelize[_0x50d4('0x5')]},'extension':{'type':Sequelize[_0x50d4('0x5')]}}; \ No newline at end of file +var _0xca66=['STRING','Yes','sequelize','moment','exports','ENUM','blind','attended'];(function(_0x26ae9e,_0x38b4ee){var _0x20c5e7=function(_0x521219){while(--_0x521219){_0x26ae9e['push'](_0x26ae9e['shift']());}};_0x20c5e7(++_0x38b4ee);}(_0xca66,0x17a));var _0x6ca6=function(_0x41e227,_0x185c7f){_0x41e227=_0x41e227-0x0;var _0x5cf279=_0xca66[_0x41e227];return _0x5cf279;};'use strict';var Sequelize=require(_0x6ca6('0x0'));var moment=require(_0x6ca6('0x1'));module[_0x6ca6('0x2')]={'type':{'type':Sequelize[_0x6ca6('0x3')](_0x6ca6('0x4'),_0x6ca6('0x5'))},'result':{'type':Sequelize[_0x6ca6('0x6')]},'transfererchannel':{'type':Sequelize[_0x6ca6('0x6')]},'transferercalleridnum':{'type':Sequelize[_0x6ca6('0x6')]},'transferercalleridname':{'type':Sequelize[_0x6ca6('0x6')]},'transfererconnectedlinenum':{'type':Sequelize[_0x6ca6('0x6')]},'transfererconnectedlinename':{'type':Sequelize[_0x6ca6('0x6')]},'transfereraccountcode':{'type':Sequelize[_0x6ca6('0x6')]},'transferercontext':{'type':Sequelize['STRING']},'transfererexten':{'type':Sequelize[_0x6ca6('0x6')]},'transfererlinkedid':{'type':Sequelize[_0x6ca6('0x6')]},'transfereechannel':{'type':Sequelize[_0x6ca6('0x6')]},'transfereecalleridnum':{'type':Sequelize[_0x6ca6('0x6')]},'transfereecalleridname':{'type':Sequelize[_0x6ca6('0x6')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x6ca6('0x6')]},'transfereeconnectedlinename':{'type':Sequelize[_0x6ca6('0x6')]},'transfereeaccountcode':{'type':Sequelize['STRING']},'transfereecontext':{'type':Sequelize[_0x6ca6('0x6')]},'transfereeexten':{'type':Sequelize[_0x6ca6('0x6')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x6ca6('0x7'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x6ca6('0x6')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index 2b9d9a7..b1fb12c 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 _0x1b19=['sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','reject','then','sendStatus','stack','name','send','map','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','filter','merge','type','VoiceTransferReport','includeAll','include','findAll','rows','catch','show','params','keys','fields','options','find','create','body','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util'];(function(_0x4c2a12,_0x30d89e){var _0x481505=function(_0x29d4b3){while(--_0x29d4b3){_0x4c2a12['push'](_0x4c2a12['shift']());}};_0x481505(++_0x30d89e);}(_0x1b19,0xd3));var _0x91b1=function(_0x2fffa5,_0x1abb7a){_0x2fffa5=_0x2fffa5-0x0;var _0x42e0cb=_0x1b19[_0x2fffa5];return _0x42e0cb;};'use strict';var emlformat=require(_0x91b1('0x0'));var rimraf=require(_0x91b1('0x1'));var zipdir=require(_0x91b1('0x2'));var jsonpatch=require(_0x91b1('0x3'));var rp=require(_0x91b1('0x4'));var moment=require('moment');var BPromise=require(_0x91b1('0x5'));var Mustache=require(_0x91b1('0x6'));var util=require(_0x91b1('0x7'));var path=require('path');var sox=require(_0x91b1('0x8'));var csv=require(_0x91b1('0x9'));var ejs=require(_0x91b1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x91b1('0xb'));var squel=require(_0x91b1('0xc'));var crypto=require('crypto');var jsforce=require(_0x91b1('0xd'));var deskjs=require(_0x91b1('0xe'));var toCsv=require(_0x91b1('0x9'));var querystring=require(_0x91b1('0xf'));var Papa=require('papaparse');var Redis=require(_0x91b1('0x10'));var authService=require(_0x91b1('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x91b1('0x12'));var logger=require(_0x91b1('0x13'))(_0x91b1('0x14'));var utils=require(_0x91b1('0x15'));var config=require(_0x91b1('0x16'));var licenseUtil=require(_0x91b1('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x38fdc2,_0x4e7dd8){_0x4e7dd8=_0x4e7dd8||0xcc;return function(_0x1cf5db){if(_0x1cf5db){return _0x38fdc2['sendStatus'](_0x4e7dd8);}return _0x38fdc2[_0x91b1('0x18')](_0x4e7dd8)[_0x91b1('0x19')]();};}function respondWithResult(_0xbc5a25,_0x4cadf1){_0x4cadf1=_0x4cadf1||0xc8;return function(_0x37df60){if(_0x37df60){return _0xbc5a25['status'](_0x4cadf1)['json'](_0x37df60);}};}function respondWithFilteredResult(_0x43e2b4,_0x11a1d8){return function(_0x3586aa){if(_0x3586aa){var _0x381941=typeof _0x11a1d8[_0x91b1('0x1a')]===_0x91b1('0x1b')&&typeof _0x11a1d8['limit']===_0x91b1('0x1b');var _0x418395=_0x3586aa[_0x91b1('0x1c')];var _0x534966=_0x381941?0x0:_0x11a1d8[_0x91b1('0x1a')];var _0x815d03=_0x381941?_0x3586aa[_0x91b1('0x1c')]:_0x11a1d8[_0x91b1('0x1a')]+_0x11a1d8[_0x91b1('0x1d')];var _0x170e7e;if(_0x815d03>=_0x418395){_0x815d03=_0x418395;_0x170e7e=0xc8;}else{_0x170e7e=0xce;}_0x43e2b4[_0x91b1('0x18')](_0x170e7e);return _0x43e2b4[_0x91b1('0x1e')](_0x91b1('0x1f'),_0x534966+'-'+_0x815d03+'/'+_0x418395)[_0x91b1('0x20')](_0x3586aa);}return null;};}function patchUpdates(_0x1b5ff7){return function(_0x5cf687){try{jsonpatch[_0x91b1('0x21')](_0x5cf687,_0x1b5ff7,!![]);}catch(_0x56d6dd){return BPromise[_0x91b1('0x22')](_0x56d6dd);}return _0x5cf687['save']();};}function saveUpdates(_0x353e89,_0x38a7be){return function(_0x216377){if(_0x216377){return _0x216377['update'](_0x353e89)[_0x91b1('0x23')](function(_0x54178a){return _0x54178a;});}return null;};}function removeEntity(_0x23d783,_0x1ed74c){return function(_0x16e86a){if(_0x16e86a){return _0x16e86a['destroy']()[_0x91b1('0x23')](function(){_0x23d783[_0x91b1('0x18')](0xcc)[_0x91b1('0x19')]();});}};}function handleEntityNotFound(_0x19e8e5,_0x53fab1){return function(_0x5b5474){if(!_0x5b5474){_0x19e8e5[_0x91b1('0x24')](0x194);}return _0x5b5474;};}function handleError(_0x318989,_0x16ad0e){_0x16ad0e=_0x16ad0e||0x1f4;return function(_0x7a4942){logger['error'](_0x7a4942[_0x91b1('0x25')]);if(_0x7a4942['name']){delete _0x7a4942[_0x91b1('0x26')];}_0x318989[_0x91b1('0x18')](_0x16ad0e)[_0x91b1('0x27')](_0x7a4942);};}exports['index']=function(_0x692834,_0x2a751b){var _0x504b30={},_0x38204a={},_0x4a615f={'count':0x0,'rows':[]};var _0x31f284=_[_0x91b1('0x28')](db['VoiceTransferReport'][_0x91b1('0x29')],function(_0x56ef0d){return{'name':_0x56ef0d[_0x91b1('0x2a')],'type':_0x56ef0d['type'][_0x91b1('0x2b')]};});_0x38204a[_0x91b1('0x2c')]=_[_0x91b1('0x28')](_0x31f284,_0x91b1('0x26'));_0x38204a[_0x91b1('0x2d')]=_['keys'](_0x692834['query']);_0x38204a[_0x91b1('0x2e')]=_[_0x91b1('0x2f')](_0x38204a[_0x91b1('0x2c')],_0x38204a['query']);_0x504b30[_0x91b1('0x30')]=_[_0x91b1('0x2f')](_0x38204a[_0x91b1('0x2c')],qs['fields'](_0x692834[_0x91b1('0x2d')]['fields']));_0x504b30[_0x91b1('0x30')]=_0x504b30[_0x91b1('0x30')][_0x91b1('0x31')]?_0x504b30[_0x91b1('0x30')]:_0x38204a['model'];if(!_0x692834[_0x91b1('0x2d')][_0x91b1('0x32')]('nolimit')){_0x504b30[_0x91b1('0x1d')]=qs['limit'](_0x692834[_0x91b1('0x2d')][_0x91b1('0x1d')]);_0x504b30['offset']=qs['offset'](_0x692834['query']['offset']);}_0x504b30[_0x91b1('0x33')]=qs['sort'](_0x692834[_0x91b1('0x2d')][_0x91b1('0x34')]);_0x504b30[_0x91b1('0x35')]=qs['filters'](_['pick'](_0x692834['query'],_0x38204a[_0x91b1('0x2e')]),_0x31f284);if(_0x692834[_0x91b1('0x2d')][_0x91b1('0x36')]){_0x504b30[_0x91b1('0x35')]=_[_0x91b1('0x37')](_0x504b30[_0x91b1('0x35')],{'$or':_[_0x91b1('0x28')](_0x31f284,function(_0x2393ec){if(_0x2393ec[_0x91b1('0x38')]!=='VIRTUAL'){var _0x4f1933={};_0x4f1933[_0x2393ec[_0x91b1('0x26')]]={'$like':'%'+_0x692834[_0x91b1('0x2d')][_0x91b1('0x36')]+'%'};return _0x4f1933;}})});}_0x504b30=_[_0x91b1('0x37')]({},_0x504b30,_0x692834['options']);var _0x203431={'where':_0x504b30[_0x91b1('0x35')]};return db[_0x91b1('0x39')][_0x91b1('0x1c')](_0x203431)['then'](function(_0x497da6){_0x4a615f['count']=_0x497da6;if(_0x692834[_0x91b1('0x2d')][_0x91b1('0x3a')]){_0x504b30[_0x91b1('0x3b')]=[{'all':!![]}];}return db[_0x91b1('0x39')][_0x91b1('0x3c')](_0x504b30);})['then'](function(_0x175dd3){_0x4a615f[_0x91b1('0x3d')]=_0x175dd3;return _0x4a615f;})[_0x91b1('0x23')](respondWithFilteredResult(_0x2a751b,_0x504b30))[_0x91b1('0x3e')](handleError(_0x2a751b,null));};exports[_0x91b1('0x3f')]=function(_0x2809ac,_0x5cfc43){var _0x4cbf3f={'raw':!![],'where':{'id':_0x2809ac[_0x91b1('0x40')]['id']}},_0x71ce2f={};_0x71ce2f[_0x91b1('0x2c')]=_[_0x91b1('0x41')](db[_0x91b1('0x39')][_0x91b1('0x29')]);_0x71ce2f[_0x91b1('0x2d')]=_['keys'](_0x2809ac[_0x91b1('0x2d')]);_0x71ce2f['filters']=_[_0x91b1('0x2f')](_0x71ce2f['model'],_0x71ce2f[_0x91b1('0x2d')]);_0x4cbf3f[_0x91b1('0x30')]=_[_0x91b1('0x2f')](_0x71ce2f[_0x91b1('0x2c')],qs[_0x91b1('0x42')](_0x2809ac[_0x91b1('0x2d')][_0x91b1('0x42')]));_0x4cbf3f[_0x91b1('0x30')]=_0x4cbf3f[_0x91b1('0x30')][_0x91b1('0x31')]?_0x4cbf3f[_0x91b1('0x30')]:_0x71ce2f[_0x91b1('0x2c')];if(_0x2809ac['query'][_0x91b1('0x3a')]){_0x4cbf3f[_0x91b1('0x3b')]=[{'all':!![]}];}_0x4cbf3f=_['merge']({},_0x4cbf3f,_0x2809ac[_0x91b1('0x43')]);return db[_0x91b1('0x39')][_0x91b1('0x44')](_0x4cbf3f)[_0x91b1('0x23')](handleEntityNotFound(_0x5cfc43,null))[_0x91b1('0x23')](respondWithResult(_0x5cfc43,null))['catch'](handleError(_0x5cfc43,null));};exports[_0x91b1('0x45')]=function(_0x126f75,_0x2cf043){return db[_0x91b1('0x39')][_0x91b1('0x45')](_0x126f75['body'],{})[_0x91b1('0x23')](respondWithResult(_0x2cf043,0xc9))['catch'](handleError(_0x2cf043,null));};exports['update']=function(_0x1063b0,_0x14eaec){if(_0x1063b0[_0x91b1('0x46')]['id']){delete _0x1063b0[_0x91b1('0x46')]['id'];}return db[_0x91b1('0x39')]['find']({'where':{'id':_0x1063b0[_0x91b1('0x40')]['id']}})[_0x91b1('0x23')](handleEntityNotFound(_0x14eaec,null))[_0x91b1('0x23')](saveUpdates(_0x1063b0[_0x91b1('0x46')],null))[_0x91b1('0x23')](respondWithResult(_0x14eaec,null))[_0x91b1('0x3e')](handleError(_0x14eaec,null));};exports[_0x91b1('0x47')]=function(_0x161d09,_0x16f76f){return db['VoiceTransferReport']['find']({'where':{'id':_0x161d09[_0x91b1('0x40')]['id']}})[_0x91b1('0x23')](handleEntityNotFound(_0x16f76f,null))['then'](removeEntity(_0x16f76f,null))['catch'](handleError(_0x16f76f,null));};exports[_0x91b1('0x48')]=function(_0x218eee,_0x28a3d9){return db['VoiceTransferReport']['describe']()['then'](respondWithResult(_0x28a3d9,null))[_0x91b1('0x3e')](handleError(_0x28a3d9,null));}; \ No newline at end of file +var _0xee5f=['zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','end','status','json','offset','undefined','limit','count','set','apply','save','then','destroy','stack','name','send','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','merge','VIRTUAL','options','includeAll','include','rows','params','VoiceTransferReport','find','catch','create','body','describe','eml-format','rimraf'];(function(_0x28d905,_0x133991){var _0x1158db=function(_0x3b32ee){while(--_0x3b32ee){_0x28d905['push'](_0x28d905['shift']());}};_0x1158db(++_0x133991);}(_0xee5f,0x1ae));var _0xfee5=function(_0x5e7e74,_0x1f7713){_0x5e7e74=_0x5e7e74-0x0;var _0x26a60c=_0xee5f[_0x5e7e74];return _0x26a60c;};'use strict';var emlformat=require(_0xfee5('0x0'));var rimraf=require(_0xfee5('0x1'));var zipdir=require(_0xfee5('0x2'));var jsonpatch=require(_0xfee5('0x3'));var rp=require(_0xfee5('0x4'));var moment=require(_0xfee5('0x5'));var BPromise=require(_0xfee5('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xfee5('0x7'));var sox=require(_0xfee5('0x8'));var csv=require(_0xfee5('0x9'));var ejs=require(_0xfee5('0xa'));var fs=require('fs');var fs_extra=require(_0xfee5('0xb'));var _=require('lodash');var squel=require(_0xfee5('0xc'));var crypto=require(_0xfee5('0xd'));var jsforce=require(_0xfee5('0xe'));var deskjs=require(_0xfee5('0xf'));var toCsv=require('to-csv');var querystring=require(_0xfee5('0x10'));var Papa=require('papaparse');var Redis=require(_0xfee5('0x11'));var authService=require(_0xfee5('0x12'));var qs=require(_0xfee5('0x13'));var as=require(_0xfee5('0x14'));var hardwareService=require(_0xfee5('0x15'));var logger=require(_0xfee5('0x16'))(_0xfee5('0x17'));var utils=require('../../config/utils');var config=require(_0xfee5('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xfee5('0x19'))['db'];function respondWithStatusCode(_0x257cc0,_0x4f73cf){_0x4f73cf=_0x4f73cf||0xcc;return function(_0x98cb4f){if(_0x98cb4f){return _0x257cc0['sendStatus'](_0x4f73cf);}return _0x257cc0['status'](_0x4f73cf)[_0xfee5('0x1a')]();};}function respondWithResult(_0x5745be,_0x13ce96){_0x13ce96=_0x13ce96||0xc8;return function(_0x4c2fcb){if(_0x4c2fcb){return _0x5745be[_0xfee5('0x1b')](_0x13ce96)[_0xfee5('0x1c')](_0x4c2fcb);}};}function respondWithFilteredResult(_0x51e2dc,_0x134322){return function(_0x4873ac){if(_0x4873ac){var _0xa87703=typeof _0x134322[_0xfee5('0x1d')]===_0xfee5('0x1e')&&typeof _0x134322[_0xfee5('0x1f')]===_0xfee5('0x1e');var _0x29e136=_0x4873ac[_0xfee5('0x20')];var _0x1bbe5e=_0xa87703?0x0:_0x134322[_0xfee5('0x1d')];var _0x536927=_0xa87703?_0x4873ac[_0xfee5('0x20')]:_0x134322['offset']+_0x134322[_0xfee5('0x1f')];var _0x13a99a;if(_0x536927>=_0x29e136){_0x536927=_0x29e136;_0x13a99a=0xc8;}else{_0x13a99a=0xce;}_0x51e2dc[_0xfee5('0x1b')](_0x13a99a);return _0x51e2dc[_0xfee5('0x21')]('Content-Range',_0x1bbe5e+'-'+_0x536927+'/'+_0x29e136)[_0xfee5('0x1c')](_0x4873ac);}return null;};}function patchUpdates(_0x37791e){return function(_0x188d25){try{jsonpatch[_0xfee5('0x22')](_0x188d25,_0x37791e,!![]);}catch(_0x373a5e){return BPromise['reject'](_0x373a5e);}return _0x188d25[_0xfee5('0x23')]();};}function saveUpdates(_0x5120bb,_0xdd6c50){return function(_0x5c9f98){if(_0x5c9f98){return _0x5c9f98['update'](_0x5120bb)[_0xfee5('0x24')](function(_0xfb7fc0){return _0xfb7fc0;});}return null;};}function removeEntity(_0x2510e1,_0x20bae6){return function(_0x3eef3d){if(_0x3eef3d){return _0x3eef3d[_0xfee5('0x25')]()[_0xfee5('0x24')](function(){_0x2510e1[_0xfee5('0x1b')](0xcc)[_0xfee5('0x1a')]();});}};}function handleEntityNotFound(_0x22ea62,_0x548a6){return function(_0x57b043){if(!_0x57b043){_0x22ea62['sendStatus'](0x194);}return _0x57b043;};}function handleError(_0xa7f6b7,_0x3d026c){_0x3d026c=_0x3d026c||0x1f4;return function(_0x20e23d){logger['error'](_0x20e23d[_0xfee5('0x26')]);if(_0x20e23d[_0xfee5('0x27')]){delete _0x20e23d[_0xfee5('0x27')];}_0xa7f6b7[_0xfee5('0x1b')](_0x3d026c)[_0xfee5('0x28')](_0x20e23d);};}exports['index']=function(_0x434fce,_0x1e8ff3){var _0x4b436a={},_0x5035af={},_0x27ade1={'count':0x0,'rows':[]};var _0x4ecb13=_[_0xfee5('0x29')](db['VoiceTransferReport'][_0xfee5('0x2a')],function(_0x195746){return{'name':_0x195746[_0xfee5('0x2b')],'type':_0x195746[_0xfee5('0x2c')][_0xfee5('0x2d')]};});_0x5035af['model']=_[_0xfee5('0x29')](_0x4ecb13,_0xfee5('0x27'));_0x5035af[_0xfee5('0x2e')]=_[_0xfee5('0x2f')](_0x434fce[_0xfee5('0x2e')]);_0x5035af[_0xfee5('0x30')]=_[_0xfee5('0x31')](_0x5035af[_0xfee5('0x32')],_0x5035af[_0xfee5('0x2e')]);_0x4b436a[_0xfee5('0x33')]=_[_0xfee5('0x31')](_0x5035af[_0xfee5('0x32')],qs[_0xfee5('0x34')](_0x434fce['query'][_0xfee5('0x34')]));_0x4b436a[_0xfee5('0x33')]=_0x4b436a[_0xfee5('0x33')][_0xfee5('0x35')]?_0x4b436a[_0xfee5('0x33')]:_0x5035af[_0xfee5('0x32')];if(!_0x434fce[_0xfee5('0x2e')][_0xfee5('0x36')](_0xfee5('0x37'))){_0x4b436a[_0xfee5('0x1f')]=qs['limit'](_0x434fce[_0xfee5('0x2e')][_0xfee5('0x1f')]);_0x4b436a[_0xfee5('0x1d')]=qs[_0xfee5('0x1d')](_0x434fce[_0xfee5('0x2e')][_0xfee5('0x1d')]);}_0x4b436a[_0xfee5('0x38')]=qs['sort'](_0x434fce['query']['sort']);_0x4b436a[_0xfee5('0x39')]=qs[_0xfee5('0x30')](_[_0xfee5('0x3a')](_0x434fce[_0xfee5('0x2e')],_0x5035af[_0xfee5('0x30')]),_0x4ecb13);if(_0x434fce[_0xfee5('0x2e')]['filter']){_0x4b436a[_0xfee5('0x39')]=_[_0xfee5('0x3b')](_0x4b436a[_0xfee5('0x39')],{'$or':_['map'](_0x4ecb13,function(_0x2664a4){if(_0x2664a4[_0xfee5('0x2c')]!==_0xfee5('0x3c')){var _0x367797={};_0x367797[_0x2664a4[_0xfee5('0x27')]]={'$like':'%'+_0x434fce['query']['filter']+'%'};return _0x367797;}})});}_0x4b436a=_[_0xfee5('0x3b')]({},_0x4b436a,_0x434fce[_0xfee5('0x3d')]);var _0x1e9481={'where':_0x4b436a[_0xfee5('0x39')]};return db['VoiceTransferReport'][_0xfee5('0x20')](_0x1e9481)[_0xfee5('0x24')](function(_0x28d469){_0x27ade1['count']=_0x28d469;if(_0x434fce[_0xfee5('0x2e')][_0xfee5('0x3e')]){_0x4b436a[_0xfee5('0x3f')]=[{'all':!![]}];}return db['VoiceTransferReport']['findAll'](_0x4b436a);})[_0xfee5('0x24')](function(_0x47c495){_0x27ade1[_0xfee5('0x40')]=_0x47c495;return _0x27ade1;})[_0xfee5('0x24')](respondWithFilteredResult(_0x1e8ff3,_0x4b436a))['catch'](handleError(_0x1e8ff3,null));};exports['show']=function(_0x383bd1,_0xe6c9cc){var _0x40b41f={'raw':!![],'where':{'id':_0x383bd1[_0xfee5('0x41')]['id']}},_0x48e91b={};_0x48e91b[_0xfee5('0x32')]=_[_0xfee5('0x2f')](db[_0xfee5('0x42')][_0xfee5('0x2a')]);_0x48e91b[_0xfee5('0x2e')]=_[_0xfee5('0x2f')](_0x383bd1[_0xfee5('0x2e')]);_0x48e91b[_0xfee5('0x30')]=_['intersection'](_0x48e91b[_0xfee5('0x32')],_0x48e91b[_0xfee5('0x2e')]);_0x40b41f['attributes']=_[_0xfee5('0x31')](_0x48e91b[_0xfee5('0x32')],qs[_0xfee5('0x34')](_0x383bd1[_0xfee5('0x2e')][_0xfee5('0x34')]));_0x40b41f[_0xfee5('0x33')]=_0x40b41f[_0xfee5('0x33')][_0xfee5('0x35')]?_0x40b41f['attributes']:_0x48e91b[_0xfee5('0x32')];if(_0x383bd1[_0xfee5('0x2e')]['includeAll']){_0x40b41f[_0xfee5('0x3f')]=[{'all':!![]}];}_0x40b41f=_['merge']({},_0x40b41f,_0x383bd1[_0xfee5('0x3d')]);return db['VoiceTransferReport'][_0xfee5('0x43')](_0x40b41f)['then'](handleEntityNotFound(_0xe6c9cc,null))[_0xfee5('0x24')](respondWithResult(_0xe6c9cc,null))[_0xfee5('0x44')](handleError(_0xe6c9cc,null));};exports[_0xfee5('0x45')]=function(_0x4e8317,_0x382509){return db[_0xfee5('0x42')][_0xfee5('0x45')](_0x4e8317[_0xfee5('0x46')],{})[_0xfee5('0x24')](respondWithResult(_0x382509,0xc9))[_0xfee5('0x44')](handleError(_0x382509,null));};exports['update']=function(_0x5edef3,_0x2a18df){if(_0x5edef3['body']['id']){delete _0x5edef3[_0xfee5('0x46')]['id'];}return db['VoiceTransferReport'][_0xfee5('0x43')]({'where':{'id':_0x5edef3['params']['id']}})[_0xfee5('0x24')](handleEntityNotFound(_0x2a18df,null))[_0xfee5('0x24')](saveUpdates(_0x5edef3['body'],null))['then'](respondWithResult(_0x2a18df,null))[_0xfee5('0x44')](handleError(_0x2a18df,null));};exports['destroy']=function(_0x57ef08,_0xe0d53b){return db[_0xfee5('0x42')][_0xfee5('0x43')]({'where':{'id':_0x57ef08[_0xfee5('0x41')]['id']}})[_0xfee5('0x24')](handleEntityNotFound(_0xe0d53b,null))[_0xfee5('0x24')](removeEntity(_0xe0d53b,null))[_0xfee5('0x44')](handleError(_0xe0d53b,null));};exports[_0xfee5('0x47')]=function(_0x45e686,_0x4684d2){return db['VoiceTransferReport']['describe']()[_0xfee5('0x24')](respondWithResult(_0x4684d2,null))['catch'](handleError(_0x4684d2,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 25c548b..4e8d48a 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 _0x637b=['bluebird','request-promise','path','rimraf','./voiceTransferReport.attributes','define','VoiceTransferReport','report_call_transfer','lodash','../../config/logger','api','moment'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x637b,0xd4));var _0xb637=function(_0x1365f3,_0x51399f){_0x1365f3=_0x1365f3-0x0;var _0x4e7d1f=_0x637b[_0x1365f3];return _0x4e7d1f;};'use strict';var _=require(_0xb637('0x0'));var util=require('util');var logger=require(_0xb637('0x1'))(_0xb637('0x2'));var moment=require(_0xb637('0x3'));var BPromise=require(_0xb637('0x4'));var rp=require(_0xb637('0x5'));var fs=require('fs');var path=require(_0xb637('0x6'));var rimraf=require(_0xb637('0x7'));var config=require('../../config/environment');var attributes=require(_0xb637('0x8'));module['exports']=function(_0x46bb2c,_0x3701c2){return _0x46bb2c[_0xb637('0x9')](_0xb637('0xa'),attributes,{'tableName':_0xb637('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x671b=['api','moment','bluebird','request-promise','path','exports','define','VoiceTransferReport','lodash','../../config/logger'];(function(_0x516927,_0xb4aad0){var _0x30749b=function(_0x2ca6cc){while(--_0x2ca6cc){_0x516927['push'](_0x516927['shift']());}};_0x30749b(++_0xb4aad0);}(_0x671b,0x18e));var _0xb671=function(_0x3031d7,_0x3f22b5){_0x3031d7=_0x3031d7-0x0;var _0xe3650b=_0x671b[_0x3031d7];return _0xe3650b;};'use strict';var _=require(_0xb671('0x0'));var util=require('util');var logger=require(_0xb671('0x1'))(_0xb671('0x2'));var moment=require(_0xb671('0x3'));var BPromise=require(_0xb671('0x4'));var rp=require(_0xb671('0x5'));var fs=require('fs');var path=require(_0xb671('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./voiceTransferReport.attributes');module[_0xb671('0x7')]=function(_0x5b590c,_0x5a0e23){return _0x5b590c[_0xb671('0x8')](_0xb671('0x9'),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 a137fcf..60dd972 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 _0xdc42=['VoiceTransferReport,\x20%s,\x20%s','request\x20sent','VoiceTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','VoiceTransferReport','create','body','options','CreateVoiceTransferReport','debug','stringify','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','request','then','info'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0xdc42,0x76));var _0x2dc4=function(_0x514c5f,_0x4a7757){_0x514c5f=_0x514c5f-0x0;var _0x41b31b=_0xdc42[_0x514c5f];return _0x41b31b;};'use strict';var _=require('lodash');var util=require(_0x2dc4('0x0'));var moment=require('moment');var BPromise=require(_0x2dc4('0x1'));var rs=require(_0x2dc4('0x2'));var fs=require('fs');var Redis=require(_0x2dc4('0x3'));var db=require(_0x2dc4('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2dc4('0x5'));var config=require(_0x2dc4('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x2dc4('0x7')][_0x2dc4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2f8b34,_0x43ddf5,_0x460215){return new BPromise(function(_0x44fdcb,_0x2b3730){return client[_0x2dc4('0x9')](_0x2f8b34,_0x460215)[_0x2dc4('0xa')](function(_0x3cd98a){logger[_0x2dc4('0xb')](_0x2dc4('0xc'),_0x43ddf5,_0x2dc4('0xd'));logger['debug'](_0x2dc4('0xe'),_0x43ddf5,_0x2dc4('0xd'),JSON['stringify'](_0x3cd98a));if(_0x3cd98a[_0x2dc4('0xf')]){if(_0x3cd98a[_0x2dc4('0xf')]['code']===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x43ddf5,_0x3cd98a[_0x2dc4('0xf')][_0x2dc4('0x10')]);return _0x2b3730(_0x3cd98a[_0x2dc4('0xf')][_0x2dc4('0x10')]);}logger[_0x2dc4('0xf')]('VoiceTransferReport,\x20%s,\x20%s',_0x43ddf5,_0x3cd98a[_0x2dc4('0xf')][_0x2dc4('0x10')]);return _0x44fdcb(_0x3cd98a[_0x2dc4('0xf')][_0x2dc4('0x10')]);}else{logger[_0x2dc4('0xb')]('VoiceTransferReport,\x20%s,\x20%s',_0x43ddf5,'request\x20sent');_0x44fdcb(_0x3cd98a[_0x2dc4('0x11')][_0x2dc4('0x10')]);}})[_0x2dc4('0x12')](function(_0x3685ac){logger[_0x2dc4('0xf')](_0x2dc4('0xc'),_0x43ddf5,_0x3685ac);_0x2b3730(_0x3685ac);});});}exports['CreateVoiceTransferReport']=function(_0x455ba9){var _0x5e7a74=this;return new Promise(function(_0x2da254,_0x302563){return db[_0x2dc4('0x13')][_0x2dc4('0x14')](_0x455ba9[_0x2dc4('0x15')],{'raw':_0x455ba9[_0x2dc4('0x16')]?_0x455ba9[_0x2dc4('0x16')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x36bf6d){logger[_0x2dc4('0xb')](_0x2dc4('0x17'),_0x455ba9);logger[_0x2dc4('0x18')]('CreateVoiceTransferReport',_0x455ba9,JSON[_0x2dc4('0x19')](_0x36bf6d));_0x2da254(_0x36bf6d);})[_0x2dc4('0x12')](function(_0x1bd7be){logger['error'](_0x2dc4('0x17'),_0x1bd7be['message'],_0x455ba9);_0x302563(_0x5e7a74[_0x2dc4('0xf')](0x1f4,_0x1bd7be[_0x2dc4('0x10')]));});});}; \ No newline at end of file +var _0xdfdd=['options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','request\x20sent','debug','stringify','error','code','message','VoiceTransferReport,\x20%s,\x20%s','catch','CreateVoiceTransferReport','VoiceTransferReport','create','body'];(function(_0x6e92c0,_0x3fe76a){var _0x3d4b10=function(_0x57a45a){while(--_0x57a45a){_0x6e92c0['push'](_0x6e92c0['shift']());}};_0x3d4b10(++_0x3fe76a);}(_0xdfdd,0x1ef));var _0xddfd=function(_0x34f04c,_0x2215d4){_0x34f04c=_0x34f04c-0x0;var _0x149f34=_0xdfdd[_0x34f04c];return _0x149f34;};'use strict';var _=require(_0xddfd('0x0'));var util=require(_0xddfd('0x1'));var moment=require(_0xddfd('0x2'));var BPromise=require(_0xddfd('0x3'));var rs=require(_0xddfd('0x4'));var fs=require('fs');var Redis=require(_0xddfd('0x5'));var db=require(_0xddfd('0x6'))['db'];var utils=require(_0xddfd('0x7'));var logger=require('../../config/logger')(_0xddfd('0x8'));var config=require(_0xddfd('0x9'));var jayson=require(_0xddfd('0xa'));var client=jayson[_0xddfd('0xb')][_0xddfd('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9451ed,_0x119528,_0x546c6a){return new BPromise(function(_0x1bffbf,_0x1fdd79){return client['request'](_0x9451ed,_0x546c6a)[_0xddfd('0xd')](function(_0x617a9e){logger[_0xddfd('0xe')]('VoiceTransferReport,\x20%s,\x20%s',_0x119528,_0xddfd('0xf'));logger[_0xddfd('0x10')]('VoiceTransferReport,\x20%s,\x20%s,\x20%s',_0x119528,_0xddfd('0xf'),JSON[_0xddfd('0x11')](_0x617a9e));if(_0x617a9e[_0xddfd('0x12')]){if(_0x617a9e['error'][_0xddfd('0x13')]===0x1f4){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x119528,_0x617a9e[_0xddfd('0x12')]['message']);return _0x1fdd79(_0x617a9e[_0xddfd('0x12')]['message']);}logger[_0xddfd('0x12')]('VoiceTransferReport,\x20%s,\x20%s',_0x119528,_0x617a9e[_0xddfd('0x12')]['message']);return _0x1bffbf(_0x617a9e[_0xddfd('0x12')][_0xddfd('0x14')]);}else{logger['info'](_0xddfd('0x15'),_0x119528,_0xddfd('0xf'));_0x1bffbf(_0x617a9e['result'][_0xddfd('0x14')]);}})[_0xddfd('0x16')](function(_0x58b9dc){logger['error'](_0xddfd('0x15'),_0x119528,_0x58b9dc);_0x1fdd79(_0x58b9dc);});});}exports[_0xddfd('0x17')]=function(_0x4a6659){var _0x303273=this;return new Promise(function(_0x5908ac,_0x19afab){return db[_0xddfd('0x18')][_0xddfd('0x19')](_0x4a6659[_0xddfd('0x1a')],{'raw':_0x4a6659[_0xddfd('0x1b')]?_0x4a6659[_0xddfd('0x1b')][_0xddfd('0x1c')]===undefined?!![]:![]:!![]})[_0xddfd('0xd')](function(_0x55a210){logger[_0xddfd('0xe')](_0xddfd('0x17'),_0x4a6659);logger[_0xddfd('0x10')]('CreateVoiceTransferReport',_0x4a6659,JSON[_0xddfd('0x11')](_0x55a210));_0x5908ac(_0x55a210);})['catch'](function(_0x1c0d3c){logger[_0xddfd('0x12')](_0xddfd('0x17'),_0x1c0d3c[_0xddfd('0x14')],_0x4a6659);_0x19afab(_0x303273[_0xddfd('0x12')](0x1f4,_0x1c0d3c[_0xddfd('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index f3536cd..8adf600 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 _0x4e10=['isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','/hold','hold','/unhold','unhold','/calls','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate'];(function(_0xe50b9c,_0xf0bb42){var _0x319d96=function(_0x5c675f){while(--_0x5c675f){_0xe50b9c['push'](_0xe50b9c['shift']());}};_0x319d96(++_0xf0bb42);}(_0x4e10,0x163));var _0x04e1=function(_0x1d4a49,_0x23f749){_0x1d4a49=_0x1d4a49-0x0;var _0x2a3b3e=_0x4e10[_0x1d4a49];return _0x2a3b3e;};'use strict';var express=require(_0x04e1('0x0'));var router=express[_0x04e1('0x1')]();var auth=require(_0x04e1('0x2'));var controller=require(_0x04e1('0x3'));router[_0x04e1('0x4')](_0x04e1('0x5'),auth[_0x04e1('0x6')](),auth[_0x04e1('0x7')](),controller[_0x04e1('0x8')]);router[_0x04e1('0x4')](_0x04e1('0x9'),auth['isAuthenticated'](),auth[_0x04e1('0x7')](),controller[_0x04e1('0xa')]);router['post'](_0x04e1('0xb'),auth[_0x04e1('0x6')](),auth['canUpdate'](),controller['answer']);router[_0x04e1('0x4')](_0x04e1('0xc'),auth['isAuthenticated'](),auth[_0x04e1('0x7')](),controller[_0x04e1('0xd')]);router[_0x04e1('0x4')](_0x04e1('0xe'),auth[_0x04e1('0x6')](),auth['canUpdate'](),controller[_0x04e1('0xf')]);router[_0x04e1('0x4')](_0x04e1('0x10'),auth[_0x04e1('0x6')](),auth[_0x04e1('0x7')](),controller['calls']);router[_0x04e1('0x4')]('/transfer',auth['isAuthenticated'](),auth[_0x04e1('0x7')](),controller[_0x04e1('0x11')]);module[_0x04e1('0x12')]=router; \ No newline at end of file +var _0x33ea=['unhold','/calls','calls','/transfer','transfer','exports','express','Router','../../components/auth/service','./webbar.controller','post','/originate','isAuthenticated','canUpdate','originate','/hangup','hangup','/answer','/unhold'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x33ea,0xfd));var _0xa33e=function(_0x6bc7c3,_0x1c78cd){_0x6bc7c3=_0x6bc7c3-0x0;var _0xbe3a=_0x33ea[_0x6bc7c3];return _0xbe3a;};'use strict';var express=require(_0xa33e('0x0'));var router=express[_0xa33e('0x1')]();var auth=require(_0xa33e('0x2'));var controller=require(_0xa33e('0x3'));router[_0xa33e('0x4')](_0xa33e('0x5'),auth[_0xa33e('0x6')](),auth[_0xa33e('0x7')](),controller[_0xa33e('0x8')]);router['post'](_0xa33e('0x9'),auth['isAuthenticated'](),auth[_0xa33e('0x7')](),controller[_0xa33e('0xa')]);router[_0xa33e('0x4')](_0xa33e('0xb'),auth[_0xa33e('0x6')](),auth[_0xa33e('0x7')](),controller['answer']);router[_0xa33e('0x4')]('/hold',auth['isAuthenticated'](),auth['canUpdate'](),controller['hold']);router[_0xa33e('0x4')](_0xa33e('0xc'),auth[_0xa33e('0x6')](),auth[_0xa33e('0x7')](),controller[_0xa33e('0xd')]);router[_0xa33e('0x4')](_0xa33e('0xe'),auth[_0xa33e('0x6')](),auth['canUpdate'](),controller[_0xa33e('0xf')]);router[_0xa33e('0x4')](_0xa33e('0x10'),auth[_0xa33e('0x6')](),auth[_0xa33e('0x7')](),controller[_0xa33e('0x11')]);module[_0xa33e('0x12')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 8498fb2..2dc28d3 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 _0xe130=['jayson/promise','client','../../config/logger','webbarapi','ioredis','redis','validate','number','callNumber\x20is\x20required','string','userId\x20is\x20required','transferNumber\x20is\x20required','info','emit','handleError:','stack','name','status','send','NotFound','request','error','code','message','result','catch','User','findOne','agent','then','all','filter','rows','UserId','sessionId','length','\x20not\x20found!','originate','originate\x20fired:','body','json','userId','callNumber','callerId','callbackUrl','format','user:%s','webbar:originate','hangup','webbar:hangup','answer\x20fired:','webbar:answer','answer\x20executed!','hold','hold\x20fired:','entityFound:','webbar:hold','hold\x20executed!','unhold','webbar:unhold','calls','VoiceChannels','conference','conference\x20fired:','webbar:conference','conference\x20executed!','transfer','transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird'];(function(_0xf6615a,_0x1d6e2c){var _0x362f2e=function(_0xbbe4f3){while(--_0xbbe4f3){_0xf6615a['push'](_0xf6615a['shift']());}};_0x362f2e(++_0x1d6e2c);}(_0xe130,0x127));var _0x0e13=function(_0x3353ec,_0x4f1455){_0x3353ec=_0x3353ec-0x0;var _0x4296bc=_0xe130[_0x3353ec];return _0x4296bc;};'use strict';var path=require(_0x0e13('0x0'));var fs=require('fs');var _=require(_0x0e13('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0x0e13('0x2'));var util=require(_0x0e13('0x3'));var BPromise=require(_0x0e13('0x4'));var jayson=require(_0x0e13('0x5'));var amiClient=jayson[_0x0e13('0x6')]['http']({'port':0x232a});var logger=require(_0x0e13('0x7'))(_0x0e13('0x8'));var Redis=require(_0x0e13('0x9'));config[_0x0e13('0xa')]=_['defaults'](config[_0x0e13('0xa')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var Schema=require(_0x0e13('0xb'));var originateValidation=new Schema({'userId':{'type':_0x0e13('0xc'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':'string','required':[!![],_0x0e13('0xd')]},'callerId':{'type':_0x0e13('0xe')},'callbackUrl':{'type':_0x0e13('0xe')}});var hangupValidation=new Schema({'userId':{'type':_0x0e13('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0x0e13('0xc'),'required':[!![],_0x0e13('0xf')]},'sessionId':{'type':_0x0e13('0xe'),'required':![]}});var transferValidation=new Schema({'userId':{'type':_0x0e13('0xc'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0x0e13('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0x0e13('0xe'),'required':[!![],_0x0e13('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0x0e13('0xc'),'required':[!![],_0x0e13('0xf')]},'sessionId':{'type':_0x0e13('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0x0e13('0xc'),'required':[!![],_0x0e13('0xf')]},'sessionId':{'type':_0x0e13('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0x0e13('0xc'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0x0e13('0xc'),'required':[!![],_0x0e13('0xf')]}});function emit(_0x2057fe,_0x433965,_0x38bfb3){logger[_0x0e13('0x11')](_0x2057fe,_0x433965,JSON['stringify'](_0x38bfb3));io['to'](_0x2057fe)[_0x0e13('0x12')](_0x433965,_0x38bfb3);}function handleError(_0x2964d3){return function(_0x510a2b){console['log'](_0x0e13('0x13'),_0x510a2b,_0x510a2b instanceof RangeError);logger['error'](_0x510a2b[_0x0e13('0x14')]);if(_0x510a2b instanceof RangeError){if(_0x510a2b['name']){delete _0x510a2b[_0x0e13('0x15')];}_0x2964d3[_0x0e13('0x16')](0x194)[_0x0e13('0x17')](_0x510a2b);}else{if(_0x510a2b[_0x0e13('0x15')]){delete _0x510a2b[_0x0e13('0x15')];}_0x2964d3['status'](0x1f4)['send'](_0x510a2b);}};}function checkError(){return function(_0x580d43){if(!_0x580d43){throw new RangeError(_0x0e13('0x18'));}return _0x580d43;};}function respondWithRpcPromise(_0x141c84,_0x505d53){return new BPromise(function(_0x515222,_0x295eb0){var _0x296ed3=amiClient;return _0x296ed3[_0x0e13('0x19')](_0x141c84,_0x505d53)['then'](function(_0x400e87){if(_0x400e87[_0x0e13('0x1a')]){if(_0x400e87[_0x0e13('0x1a')][_0x0e13('0x1b')]===0x1f4){return _0x295eb0(_0x400e87[_0x0e13('0x1a')][_0x0e13('0x1c')]);}return _0x515222(_0x400e87[_0x0e13('0x1a')][_0x0e13('0x1c')]);}else{_0x515222(_0x400e87[_0x0e13('0x1d')]);}})[_0x0e13('0x1e')](function(_0x9621e2){_0x295eb0(_0x9621e2);});});}function getAgent(_0x443a85){return db[_0x0e13('0x1f')][_0x0e13('0x20')]({'where':{'id':_0x443a85,'role':_0x0e13('0x21')}})[_0x0e13('0x22')](checkError());}function getAgentCheckSession(_0x1edc48,_0x59ae33){return new BPromise(function(_0x37fe42,_0x3e8c13){var _0x3684bb=respondWithRpcPromise('VoiceChannels');var _0x2182ae=getAgent(_0x1edc48);Promise[_0x0e13('0x23')]([_0x3684bb,_0x2182ae])[_0x0e13('0x22')](function(_0x4606de){var _0x5d41c3=_0x4606de[0x0];var _0xe9151f=_0x4606de[0x1];var _0x3867d5=_[_0x0e13('0x24')](_0x5d41c3[_0x0e13('0x25')],function(_0x2e65e2){return _0x2e65e2[_0x0e13('0x26')]==_0xe9151f['id']&&_0x2e65e2[_0x0e13('0x27')]==_0x59ae33;});if(_0x3867d5[_0x0e13('0x28')]==0x1){_0x37fe42(_0xe9151f);}else{_0x3e8c13(new RangeError('sessionId\x20'+_0x59ae33+_0x0e13('0x29')));}});});}exports[_0x0e13('0x2a')]=function(_0x325003,_0x53ef0a){logger[_0x0e13('0x11')](_0x0e13('0x2b'),_0x325003[_0x0e13('0x2c')]);var _0x4311da=originateValidation[_0x0e13('0xb')](_0x325003[_0x0e13('0x2c')]);if(_0x4311da[_0x0e13('0x28')]>0x0){return _0x53ef0a[_0x0e13('0x16')](0x190)[_0x0e13('0x2d')](_0x4311da);}var _0x4a5cc1=_0x325003[_0x0e13('0x2c')][_0x0e13('0x2e')];var _0x29e017=_0x325003['body'][_0x0e13('0x2f')];var _0x560bee=_0x325003[_0x0e13('0x2c')][_0x0e13('0x30')];var _0x33d819=_0x325003[_0x0e13('0x2c')][_0x0e13('0x31')];return getAgent(_0x4a5cc1)[_0x0e13('0x22')](function(_0x110b37){logger['info']('entityFound:',_0x110b37[_0x0e13('0x15')]);emit(util[_0x0e13('0x32')](_0x0e13('0x33'),_0x110b37[_0x0e13('0x15')]),_0x0e13('0x34'),{'callNumber':_0x29e017,'callerId':_0x560bee,'callbackUrl':_0x33d819});return _0x53ef0a[_0x0e13('0x16')](0xc8)[_0x0e13('0x2d')]({'error':![],'message':'originate\x20executed!'});})[_0x0e13('0x1e')](handleError(_0x53ef0a));};exports[_0x0e13('0x35')]=function(_0x476c6e,_0x4729da){logger[_0x0e13('0x11')]('hangup\x20fired:',_0x476c6e[_0x0e13('0x2c')]);var _0x2dd946=hangupValidation[_0x0e13('0xb')](_0x476c6e['body']);if(_0x2dd946[_0x0e13('0x28')]>0x0){return _0x4729da['status'](0x190)[_0x0e13('0x2d')](_0x2dd946);}var _0x5557e6=_0x476c6e[_0x0e13('0x2c')]['userId'];var _0x411b44=_0x476c6e[_0x0e13('0x2c')][_0x0e13('0x27')];return getAgent(_0x5557e6)[_0x0e13('0x22')](function(_0x11e209){logger[_0x0e13('0x11')]('entityFound:',_0x11e209[_0x0e13('0x15')]);emit(util[_0x0e13('0x32')](_0x0e13('0x33'),_0x11e209[_0x0e13('0x15')]),_0x0e13('0x36'),{'sessionId':_0x411b44});return _0x4729da[_0x0e13('0x16')](0xc8)[_0x0e13('0x2d')]({'error':![],'message':'hangup\x20executed!'});})[_0x0e13('0x1e')](handleError(_0x4729da));};exports['answer']=function(_0x54da3f,_0x4ba4ec){logger[_0x0e13('0x11')](_0x0e13('0x37'),_0x54da3f[_0x0e13('0x2c')]);var _0x14ab2a=answerValidation[_0x0e13('0xb')](_0x54da3f[_0x0e13('0x2c')]);if(_0x14ab2a[_0x0e13('0x28')]>0x0){return _0x4ba4ec['status'](0x190)[_0x0e13('0x2d')](_0x14ab2a);}var _0x4f9f28=_0x54da3f['body'][_0x0e13('0x2e')];var _0x3bacaf=_0x54da3f[_0x0e13('0x2c')][_0x0e13('0x27')];return getAgent(_0x4f9f28)['then'](function(_0xa8f369){logger[_0x0e13('0x11')]('entityFound:',_0xa8f369[_0x0e13('0x15')]);emit(util[_0x0e13('0x32')](_0x0e13('0x33'),_0xa8f369[_0x0e13('0x15')]),_0x0e13('0x38'),{'sessionId':_0x3bacaf});return _0x4ba4ec[_0x0e13('0x16')](0xc8)[_0x0e13('0x2d')]({'error':![],'message':_0x0e13('0x39')});})[_0x0e13('0x1e')](handleError(_0x4ba4ec));};exports[_0x0e13('0x3a')]=function(_0x4b2a3b,_0x514b1d){logger[_0x0e13('0x11')](_0x0e13('0x3b'),_0x4b2a3b[_0x0e13('0x2c')]);var _0x18bc94=holdValidation[_0x0e13('0xb')](_0x4b2a3b['body']);if(_0x18bc94[_0x0e13('0x28')]>0x0){return _0x514b1d[_0x0e13('0x16')](0x190)[_0x0e13('0x2d')](_0x18bc94);}var _0x548259=_0x4b2a3b[_0x0e13('0x2c')]['userId'];var _0x17b5c4=_0x4b2a3b[_0x0e13('0x2c')][_0x0e13('0x27')];return getAgent(_0x548259)[_0x0e13('0x22')](function(_0x35249c){logger['info'](_0x0e13('0x3c'),_0x35249c['name']);emit(util[_0x0e13('0x32')](_0x0e13('0x33'),_0x35249c['name']),_0x0e13('0x3d'),{'sessionId':_0x17b5c4});return _0x514b1d[_0x0e13('0x16')](0xc8)[_0x0e13('0x2d')]({'error':![],'message':_0x0e13('0x3e')});})['catch'](handleError(_0x514b1d));};exports[_0x0e13('0x3f')]=function(_0x359de5,_0x4d9afd){logger[_0x0e13('0x11')]('unhold\x20fired:',_0x359de5['body']);var _0x56b589=unholdValidation[_0x0e13('0xb')](_0x359de5['body']);if(_0x56b589[_0x0e13('0x28')]>0x0){return _0x4d9afd[_0x0e13('0x16')](0x190)[_0x0e13('0x2d')](_0x56b589);}var _0x417a31=_0x359de5[_0x0e13('0x2c')]['userId'];var _0x39cdc8=_0x359de5[_0x0e13('0x2c')][_0x0e13('0x27')];return getAgent(_0x417a31)[_0x0e13('0x22')](function(_0x4539f6){logger[_0x0e13('0x11')](_0x0e13('0x3c'),_0x4539f6[_0x0e13('0x15')]);emit(util[_0x0e13('0x32')](_0x0e13('0x33'),_0x4539f6[_0x0e13('0x15')]),_0x0e13('0x40'),{'sessionId':_0x39cdc8});return _0x4d9afd['status'](0xc8)[_0x0e13('0x2d')]({'error':![],'message':'unhold\x20executed!'});})[_0x0e13('0x1e')](handleError(_0x4d9afd));};exports[_0x0e13('0x41')]=function(_0x509c31,_0x10799f){logger[_0x0e13('0x11')]('calls\x20fired:',_0x10799f[_0x0e13('0x2c')]);var _0x65111c=callsValidation[_0x0e13('0xb')](_0x509c31[_0x0e13('0x2c')]);if(_0x65111c['length']>0x0){return _0x10799f[_0x0e13('0x16')](0x190)[_0x0e13('0x2d')](_0x65111c);}var _0x348ea5=_0x509c31[_0x0e13('0x2c')][_0x0e13('0x2e')];var _0x27df87=respondWithRpcPromise(_0x0e13('0x42'));var _0x1132ac=getAgent(_0x348ea5);return Promise[_0x0e13('0x23')]([_0x27df87,_0x1132ac])['then'](function(_0x3d5c20){var _0xa3db49=_0x3d5c20[0x0];var _0x15ad8f=_0x3d5c20[0x1];var _0x1d670f=_[_0x0e13('0x24')](_0xa3db49[_0x0e13('0x25')],function(_0x17f680){return _0x17f680[_0x0e13('0x26')]==_0x15ad8f['id'];});return _0x10799f[_0x0e13('0x16')](0xc8)[_0x0e13('0x2d')]({'count':_0x1d670f[_0x0e13('0x28')],'rows':_0x1d670f});})['catch'](handleError(_0x10799f));};exports[_0x0e13('0x43')]=function(_0x15ddfa,_0x35b1ea){logger[_0x0e13('0x11')](_0x0e13('0x44'),_0x15ddfa[_0x0e13('0x2c')]);var _0x2e17e7=conferenceValidation['validate'](_0x15ddfa[_0x0e13('0x2c')]);if(_0x2e17e7[_0x0e13('0x28')]>0x0){return _0x35b1ea[_0x0e13('0x16')](0x190)[_0x0e13('0x2d')](_0x2e17e7);}var _0x36b553=_0x15ddfa[_0x0e13('0x2c')][_0x0e13('0x2e')];return getAgent(_0x36b553)['then'](function(_0x49774c){logger[_0x0e13('0x11')](_0x0e13('0x3c'),_0x49774c[_0x0e13('0x15')]);emit(util[_0x0e13('0x32')](_0x0e13('0x33'),_0x49774c[_0x0e13('0x15')]),_0x0e13('0x45'));return _0x35b1ea[_0x0e13('0x16')](0xc8)[_0x0e13('0x2d')]({'error':![],'message':_0x0e13('0x46')});})[_0x0e13('0x1e')](handleError(_0x35b1ea));};exports[_0x0e13('0x47')]=function(_0x4d3468,_0x378649){logger[_0x0e13('0x11')]('transfer\x20fired:',_0x4d3468['body']);var _0x343275=transferValidation['validate'](_0x4d3468[_0x0e13('0x2c')]);if(_0x343275[_0x0e13('0x28')]>0x0){return _0x378649['status'](0x190)[_0x0e13('0x2d')](_0x343275);}var _0x882e6b=_0x4d3468['body'][_0x0e13('0x2e')];var _0x24329f=_0x4d3468[_0x0e13('0x2c')][_0x0e13('0x27')];var _0xc9d498=_0x4d3468['body'][_0x0e13('0x48')];return getAgent(_0x882e6b)[_0x0e13('0x22')](function(_0x37252e){logger[_0x0e13('0x11')](_0x0e13('0x3c'),_0x37252e[_0x0e13('0x15')]);emit(util[_0x0e13('0x32')]('user:%s',_0x37252e[_0x0e13('0x15')]),_0x0e13('0x49'),{'sessionId':_0x24329f,'transferNumber':_0xc9d498});return _0x378649[_0x0e13('0x16')](0xc8)[_0x0e13('0x2d')]({'error':![],'message':_0x0e13('0x4a')});})[_0x0e13('0x1e')](handleError(_0x378649));}; \ No newline at end of file +var _0x7a2c=['answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','unhold','webbar:unhold','unhold\x20executed!','all','conference','webbar:conference','conference\x20executed!','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','../../mysqldb','../../config/environment','util','bluebird','jayson/promise','client','http','../../config/logger','ioredis','redis','socket.io-emitter','validate','number','string','callNumber\x20is\x20required','userId\x20is\x20required','transferNumber\x20is\x20required','stringify','log','handleError:','name','send','request','then','error','code','message','result','catch','User','agent','VoiceChannels','filter','rows','UserId','sessionId','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','status','userId','body','callNumber','callerId','callbackUrl','info','format','user:%s','webbar:originate','json','hangup','hangup\x20fired:','length','entityFound:','webbar:hangup','hangup\x20executed!','answer'];(function(_0x8d8e80,_0x52918b){var _0x1675ed=function(_0x308770){while(--_0x308770){_0x8d8e80['push'](_0x8d8e80['shift']());}};_0x1675ed(++_0x52918b);}(_0x7a2c,0x17b));var _0xc7a2=function(_0x3aa01e,_0x2c0a0d){_0x3aa01e=_0x3aa01e-0x0;var _0x1b9a67=_0x7a2c[_0x3aa01e];return _0x1b9a67;};'use strict';var path=require(_0xc7a2('0x0'));var fs=require('fs');var _=require('lodash');var db=require(_0xc7a2('0x1'))['db'];var config=require(_0xc7a2('0x2'));var util=require(_0xc7a2('0x3'));var BPromise=require(_0xc7a2('0x4'));var jayson=require(_0xc7a2('0x5'));var amiClient=jayson[_0xc7a2('0x6')][_0xc7a2('0x7')]({'port':0x232a});var logger=require(_0xc7a2('0x8'))('webbarapi');var Redis=require(_0xc7a2('0x9'));config[_0xc7a2('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xc7a2('0xb'))(new Redis(config[_0xc7a2('0xa')]));var Schema=require(_0xc7a2('0xc'));var originateValidation=new Schema({'userId':{'type':_0xc7a2('0xd'),'required':[!![],'userId\x20is\x20required']},'callNumber':{'type':_0xc7a2('0xe'),'required':[!![],_0xc7a2('0xf')]},'callerId':{'type':_0xc7a2('0xe')},'callbackUrl':{'type':'string'}});var hangupValidation=new Schema({'userId':{'type':_0xc7a2('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xc7a2('0xe'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xc7a2('0xd'),'required':[!![],_0xc7a2('0x10')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xc7a2('0xd'),'required':[!![],_0xc7a2('0x10')]},'sessionId':{'type':_0xc7a2('0xe'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xc7a2('0xe'),'required':[!![],_0xc7a2('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xc7a2('0xd'),'required':[!![],_0xc7a2('0x10')]},'sessionId':{'type':_0xc7a2('0xe'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xc7a2('0xd'),'required':[!![],_0xc7a2('0x10')]},'sessionId':{'type':_0xc7a2('0xe'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xc7a2('0xd'),'required':[!![],_0xc7a2('0x10')]}});var conferenceValidation=new Schema({'userId':{'type':_0xc7a2('0xd'),'required':[!![],_0xc7a2('0x10')]}});function emit(_0x26d678,_0x2c3338,_0x2bc321){logger['info'](_0x26d678,_0x2c3338,JSON[_0xc7a2('0x12')](_0x2bc321));io['to'](_0x26d678)['emit'](_0x2c3338,_0x2bc321);}function handleError(_0x2414f4){return function(_0x302d54){console[_0xc7a2('0x13')](_0xc7a2('0x14'),_0x302d54,_0x302d54 instanceof RangeError);logger['error'](_0x302d54['stack']);if(_0x302d54 instanceof RangeError){if(_0x302d54[_0xc7a2('0x15')]){delete _0x302d54[_0xc7a2('0x15')];}_0x2414f4['status'](0x194)['send'](_0x302d54);}else{if(_0x302d54['name']){delete _0x302d54[_0xc7a2('0x15')];}_0x2414f4['status'](0x1f4)[_0xc7a2('0x16')](_0x302d54);}};}function checkError(){return function(_0x260be1){if(!_0x260be1){throw new RangeError('NotFound');}return _0x260be1;};}function respondWithRpcPromise(_0x40f3c4,_0x2dff1d){return new BPromise(function(_0x1b51a1,_0x35e0f6){var _0x337bdb=amiClient;return _0x337bdb[_0xc7a2('0x17')](_0x40f3c4,_0x2dff1d)[_0xc7a2('0x18')](function(_0x4a05e1){if(_0x4a05e1['error']){if(_0x4a05e1[_0xc7a2('0x19')][_0xc7a2('0x1a')]===0x1f4){return _0x35e0f6(_0x4a05e1['error'][_0xc7a2('0x1b')]);}return _0x1b51a1(_0x4a05e1[_0xc7a2('0x19')][_0xc7a2('0x1b')]);}else{_0x1b51a1(_0x4a05e1[_0xc7a2('0x1c')]);}})[_0xc7a2('0x1d')](function(_0x35584a){_0x35e0f6(_0x35584a);});});}function getAgent(_0x1beecd){return db[_0xc7a2('0x1e')]['findOne']({'where':{'id':_0x1beecd,'role':_0xc7a2('0x1f')}})['then'](checkError());}function getAgentCheckSession(_0x206eb7,_0x4cc3a8){return new BPromise(function(_0x20404b,_0x14182f){var _0xd93f19=respondWithRpcPromise(_0xc7a2('0x20'));var _0x4977f0=getAgent(_0x206eb7);Promise['all']([_0xd93f19,_0x4977f0])[_0xc7a2('0x18')](function(_0x2f3097){var _0x272c6b=_0x2f3097[0x0];var _0x305efb=_0x2f3097[0x1];var _0x3be88c=_[_0xc7a2('0x21')](_0x272c6b[_0xc7a2('0x22')],function(_0x5e970e){return _0x5e970e[_0xc7a2('0x23')]==_0x305efb['id']&&_0x5e970e[_0xc7a2('0x24')]==_0x4cc3a8;});if(_0x3be88c['length']==0x1){_0x20404b(_0x305efb);}else{_0x14182f(new RangeError(_0xc7a2('0x25')+_0x4cc3a8+_0xc7a2('0x26')));}});});}exports[_0xc7a2('0x27')]=function(_0x517df7,_0x2820a9){logger['info'](_0xc7a2('0x28'),_0x517df7['body']);var _0x5cd5ef=originateValidation[_0xc7a2('0xc')](_0x517df7['body']);if(_0x5cd5ef['length']>0x0){return _0x2820a9[_0xc7a2('0x29')](0x190)['json'](_0x5cd5ef);}var _0x3df1d2=_0x517df7['body'][_0xc7a2('0x2a')];var _0x2a8a26=_0x517df7[_0xc7a2('0x2b')][_0xc7a2('0x2c')];var _0x3d5d7e=_0x517df7[_0xc7a2('0x2b')][_0xc7a2('0x2d')];var _0x2a3bfb=_0x517df7[_0xc7a2('0x2b')][_0xc7a2('0x2e')];return getAgent(_0x3df1d2)['then'](function(_0x30234f){logger[_0xc7a2('0x2f')]('entityFound:',_0x30234f[_0xc7a2('0x15')]);emit(util[_0xc7a2('0x30')](_0xc7a2('0x31'),_0x30234f[_0xc7a2('0x15')]),_0xc7a2('0x32'),{'callNumber':_0x2a8a26,'callerId':_0x3d5d7e,'callbackUrl':_0x2a3bfb});return _0x2820a9[_0xc7a2('0x29')](0xc8)[_0xc7a2('0x33')]({'error':![],'message':'originate\x20executed!'});})[_0xc7a2('0x1d')](handleError(_0x2820a9));};exports[_0xc7a2('0x34')]=function(_0x468151,_0x49ad1f){logger[_0xc7a2('0x2f')](_0xc7a2('0x35'),_0x468151['body']);var _0x366706=hangupValidation[_0xc7a2('0xc')](_0x468151[_0xc7a2('0x2b')]);if(_0x366706[_0xc7a2('0x36')]>0x0){return _0x49ad1f[_0xc7a2('0x29')](0x190)[_0xc7a2('0x33')](_0x366706);}var _0x8559fe=_0x468151[_0xc7a2('0x2b')]['userId'];var _0xd418ee=_0x468151['body'][_0xc7a2('0x24')];return getAgent(_0x8559fe)[_0xc7a2('0x18')](function(_0x2cd014){logger[_0xc7a2('0x2f')](_0xc7a2('0x37'),_0x2cd014[_0xc7a2('0x15')]);emit(util[_0xc7a2('0x30')](_0xc7a2('0x31'),_0x2cd014['name']),_0xc7a2('0x38'),{'sessionId':_0xd418ee});return _0x49ad1f[_0xc7a2('0x29')](0xc8)[_0xc7a2('0x33')]({'error':![],'message':_0xc7a2('0x39')});})[_0xc7a2('0x1d')](handleError(_0x49ad1f));};exports[_0xc7a2('0x3a')]=function(_0x4c99de,_0x5ebb9c){logger['info'](_0xc7a2('0x3b'),_0x4c99de[_0xc7a2('0x2b')]);var _0x28ed1c=answerValidation[_0xc7a2('0xc')](_0x4c99de[_0xc7a2('0x2b')]);if(_0x28ed1c[_0xc7a2('0x36')]>0x0){return _0x5ebb9c[_0xc7a2('0x29')](0x190)[_0xc7a2('0x33')](_0x28ed1c);}var _0x246482=_0x4c99de['body']['userId'];var _0x4bcb42=_0x4c99de[_0xc7a2('0x2b')][_0xc7a2('0x24')];return getAgent(_0x246482)['then'](function(_0x44f2e9){logger[_0xc7a2('0x2f')](_0xc7a2('0x37'),_0x44f2e9['name']);emit(util[_0xc7a2('0x30')]('user:%s',_0x44f2e9[_0xc7a2('0x15')]),_0xc7a2('0x3c'),{'sessionId':_0x4bcb42});return _0x5ebb9c['status'](0xc8)['json']({'error':![],'message':_0xc7a2('0x3d')});})[_0xc7a2('0x1d')](handleError(_0x5ebb9c));};exports['hold']=function(_0x8b8cc2,_0x404e48){logger[_0xc7a2('0x2f')](_0xc7a2('0x3e'),_0x8b8cc2[_0xc7a2('0x2b')]);var _0xa81aa3=holdValidation['validate'](_0x8b8cc2[_0xc7a2('0x2b')]);if(_0xa81aa3[_0xc7a2('0x36')]>0x0){return _0x404e48[_0xc7a2('0x29')](0x190)[_0xc7a2('0x33')](_0xa81aa3);}var _0x54fc41=_0x8b8cc2[_0xc7a2('0x2b')][_0xc7a2('0x2a')];var _0x2adcc6=_0x8b8cc2[_0xc7a2('0x2b')][_0xc7a2('0x24')];return getAgent(_0x54fc41)[_0xc7a2('0x18')](function(_0x7378ed){logger[_0xc7a2('0x2f')]('entityFound:',_0x7378ed[_0xc7a2('0x15')]);emit(util[_0xc7a2('0x30')](_0xc7a2('0x31'),_0x7378ed[_0xc7a2('0x15')]),'webbar:hold',{'sessionId':_0x2adcc6});return _0x404e48[_0xc7a2('0x29')](0xc8)[_0xc7a2('0x33')]({'error':![],'message':'hold\x20executed!'});})[_0xc7a2('0x1d')](handleError(_0x404e48));};exports[_0xc7a2('0x3f')]=function(_0xb09c6f,_0x457318){logger[_0xc7a2('0x2f')]('unhold\x20fired:',_0xb09c6f[_0xc7a2('0x2b')]);var _0x44716e=unholdValidation[_0xc7a2('0xc')](_0xb09c6f['body']);if(_0x44716e['length']>0x0){return _0x457318[_0xc7a2('0x29')](0x190)['json'](_0x44716e);}var _0x4944b7=_0xb09c6f[_0xc7a2('0x2b')][_0xc7a2('0x2a')];var _0x4a6cb2=_0xb09c6f['body'][_0xc7a2('0x24')];return getAgent(_0x4944b7)[_0xc7a2('0x18')](function(_0x119355){logger[_0xc7a2('0x2f')](_0xc7a2('0x37'),_0x119355['name']);emit(util[_0xc7a2('0x30')](_0xc7a2('0x31'),_0x119355['name']),_0xc7a2('0x40'),{'sessionId':_0x4a6cb2});return _0x457318[_0xc7a2('0x29')](0xc8)[_0xc7a2('0x33')]({'error':![],'message':_0xc7a2('0x41')});})[_0xc7a2('0x1d')](handleError(_0x457318));};exports['calls']=function(_0xd91777,_0x40afd2){logger[_0xc7a2('0x2f')]('calls\x20fired:',_0x40afd2[_0xc7a2('0x2b')]);var _0x3174ef=callsValidation[_0xc7a2('0xc')](_0xd91777[_0xc7a2('0x2b')]);if(_0x3174ef[_0xc7a2('0x36')]>0x0){return _0x40afd2[_0xc7a2('0x29')](0x190)['json'](_0x3174ef);}var _0x458ee7=_0xd91777[_0xc7a2('0x2b')][_0xc7a2('0x2a')];var _0x332e8e=respondWithRpcPromise(_0xc7a2('0x20'));var _0x1f0762=getAgent(_0x458ee7);return Promise[_0xc7a2('0x42')]([_0x332e8e,_0x1f0762])['then'](function(_0x2b1bb3){var _0x4e51a8=_0x2b1bb3[0x0];var _0x4e1efa=_0x2b1bb3[0x1];var _0x38df09=_[_0xc7a2('0x21')](_0x4e51a8[_0xc7a2('0x22')],function(_0x4b3045){return _0x4b3045[_0xc7a2('0x23')]==_0x4e1efa['id'];});return _0x40afd2['status'](0xc8)['json']({'count':_0x38df09[_0xc7a2('0x36')],'rows':_0x38df09});})[_0xc7a2('0x1d')](handleError(_0x40afd2));};exports[_0xc7a2('0x43')]=function(_0x1c915b,_0x2fd2b2){logger[_0xc7a2('0x2f')]('conference\x20fired:',_0x1c915b['body']);var _0x5a91d1=conferenceValidation[_0xc7a2('0xc')](_0x1c915b['body']);if(_0x5a91d1['length']>0x0){return _0x2fd2b2['status'](0x190)['json'](_0x5a91d1);}var _0x100b1f=_0x1c915b[_0xc7a2('0x2b')][_0xc7a2('0x2a')];return getAgent(_0x100b1f)[_0xc7a2('0x18')](function(_0x52c83a){logger[_0xc7a2('0x2f')](_0xc7a2('0x37'),_0x52c83a[_0xc7a2('0x15')]);emit(util[_0xc7a2('0x30')](_0xc7a2('0x31'),_0x52c83a[_0xc7a2('0x15')]),_0xc7a2('0x44'));return _0x2fd2b2[_0xc7a2('0x29')](0xc8)[_0xc7a2('0x33')]({'error':![],'message':_0xc7a2('0x45')});})[_0xc7a2('0x1d')](handleError(_0x2fd2b2));};exports['transfer']=function(_0x531924,_0x3613be){logger['info'](_0xc7a2('0x46'),_0x531924[_0xc7a2('0x2b')]);var _0x3dc131=transferValidation[_0xc7a2('0xc')](_0x531924['body']);if(_0x3dc131[_0xc7a2('0x36')]>0x0){return _0x3613be[_0xc7a2('0x29')](0x190)[_0xc7a2('0x33')](_0x3dc131);}var _0xc7ce86=_0x531924[_0xc7a2('0x2b')]['userId'];var _0x1d387c=_0x531924[_0xc7a2('0x2b')][_0xc7a2('0x24')];var _0x45044a=_0x531924[_0xc7a2('0x2b')]['transferNumber'];return getAgent(_0xc7ce86)[_0xc7a2('0x18')](function(_0x4ce8d0){logger['info'](_0xc7a2('0x37'),_0x4ce8d0[_0xc7a2('0x15')]);emit(util[_0xc7a2('0x30')]('user:%s',_0x4ce8d0[_0xc7a2('0x15')]),_0xc7a2('0x47'),{'sessionId':_0x1d387c,'transferNumber':_0x45044a});return _0x3613be['status'](0xc8)[_0xc7a2('0x33')]({'error':![],'message':_0xc7a2('0x48')});})[_0xc7a2('0x1d')](handleError(_0x3613be));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index db5d106..f0eb1f2 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 _0xd943=['show','get','/:id/canned_answers','getAnswers','/:id/users','getAgents','/:id/applications','getApplications','create','post','addDisposition','addAnswer','addAgents','addApplications','/:id/notify','send','put','/:id','destroy','/:id/dispositions','removeDispositions','delete','removeAnswers','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','describe'];(function(_0x527693,_0x9579ec){var _0x234a85=function(_0xc93d87){while(--_0xc93d87){_0x527693['push'](_0x527693['shift']());}};_0x234a85(++_0x9579ec);}(_0xd943,0x15d));var _0x3d94=function(_0x566320,_0x464777){_0x566320=_0x566320-0x0;var _0x3a265b=_0xd943[_0x566320];return _0x3a265b;};'use strict';var multer=require(_0x3d94('0x0'));var util=require(_0x3d94('0x1'));var path=require(_0x3d94('0x2'));var timeout=require(_0x3d94('0x3'));var express=require('express');var router=express[_0x3d94('0x4')]();var fs_extra=require(_0x3d94('0x5'));var auth=require(_0x3d94('0x6'));var interaction=require(_0x3d94('0x7'));var config=require(_0x3d94('0x8'));var controller=require('./whatsappAccount.controller');router['get']('/',auth[_0x3d94('0x9')](),controller['index']);router['get']('/describe',auth[_0x3d94('0x9')](),controller[_0x3d94('0xa')]);router['get']('/:id',auth[_0x3d94('0x9')](),controller[_0x3d94('0xb')]);router[_0x3d94('0xc')]('/:id/dispositions',auth[_0x3d94('0x9')](),controller['getDispositions']);router[_0x3d94('0xc')](_0x3d94('0xd'),auth['isAuthenticated'](),controller[_0x3d94('0xe')]);router[_0x3d94('0xc')](_0x3d94('0xf'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x10')]);router['get'](_0x3d94('0x11'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x12')]);router['post']('/',auth[_0x3d94('0x9')](),controller[_0x3d94('0x13')]);router[_0x3d94('0x14')]('/:id/dispositions',auth[_0x3d94('0x9')](),controller[_0x3d94('0x15')]);router[_0x3d94('0x14')](_0x3d94('0xd'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x16')]);router[_0x3d94('0x14')](_0x3d94('0xf'),auth['isAuthenticated'](),controller[_0x3d94('0x17')]);router[_0x3d94('0x14')](_0x3d94('0x11'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x18')]);router[_0x3d94('0x14')](_0x3d94('0x19'),controller['notify']);router[_0x3d94('0x14')]('/:id/send',auth[_0x3d94('0x9')](),controller[_0x3d94('0x1a')]);router[_0x3d94('0x1b')](_0x3d94('0x1c'),auth[_0x3d94('0x9')](),controller['update']);router['delete'](_0x3d94('0x1c'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x1d')]);router['delete'](_0x3d94('0x1e'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x1f')]);router[_0x3d94('0x20')](_0x3d94('0xd'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x21')]);router[_0x3d94('0x20')](_0x3d94('0xf'),auth[_0x3d94('0x9')](),controller[_0x3d94('0x22')]);module[_0x3d94('0x23')]=router; \ No newline at end of file +var _0x430c=['Router','./whatsappAccount.controller','get','index','/describe','isAuthenticated','describe','/:id','show','/:id/dispositions','getDispositions','getAgents','/:id/applications','getApplications','post','addDisposition','/:id/users','addAgents','send','put','delete','destroy','removeDispositions','/:id/canned_answers','removeAgents','multer','connect-timeout','express'];(function(_0x1a8192,_0x3453f2){var _0x131de2=function(_0x50ab1c){while(--_0x50ab1c){_0x1a8192['push'](_0x1a8192['shift']());}};_0x131de2(++_0x3453f2);}(_0x430c,0x1a1));var _0xc430=function(_0x5b3b9b,_0x1c71b0){_0x5b3b9b=_0x5b3b9b-0x0;var _0x47c1d7=_0x430c[_0x5b3b9b];return _0x47c1d7;};'use strict';var multer=require(_0xc430('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xc430('0x1'));var express=require(_0xc430('0x2'));var router=express[_0xc430('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xc430('0x4'));router[_0xc430('0x5')]('/',auth['isAuthenticated'](),controller[_0xc430('0x6')]);router['get'](_0xc430('0x7'),auth[_0xc430('0x8')](),controller[_0xc430('0x9')]);router[_0xc430('0x5')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller[_0xc430('0xb')]);router[_0xc430('0x5')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0xd')]);router[_0xc430('0x5')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['getAnswers']);router[_0xc430('0x5')]('/:id/users',auth[_0xc430('0x8')](),controller[_0xc430('0xe')]);router[_0xc430('0x5')](_0xc430('0xf'),auth[_0xc430('0x8')](),controller[_0xc430('0x10')]);router[_0xc430('0x11')]('/',auth['isAuthenticated'](),controller['create']);router[_0xc430('0x11')](_0xc430('0xc'),auth[_0xc430('0x8')](),controller[_0xc430('0x12')]);router[_0xc430('0x11')]('/:id/canned_answers',auth[_0xc430('0x8')](),controller['addAnswer']);router['post'](_0xc430('0x13'),auth[_0xc430('0x8')](),controller[_0xc430('0x14')]);router['post']('/:id/applications',auth[_0xc430('0x8')](),controller['addApplications']);router[_0xc430('0x11')]('/:id/notify',controller['notify']);router[_0xc430('0x11')]('/:id/send',auth[_0xc430('0x8')](),controller[_0xc430('0x15')]);router[_0xc430('0x16')](_0xc430('0xa'),auth[_0xc430('0x8')](),controller['update']);router[_0xc430('0x17')]('/:id',auth['isAuthenticated'](),controller[_0xc430('0x18')]);router[_0xc430('0x17')](_0xc430('0xc'),auth['isAuthenticated'](),controller[_0xc430('0x19')]);router['delete'](_0xc430('0x1a'),auth[_0xc430('0x8')](),controller['removeAnswers']);router[_0xc430('0x17')](_0xc430('0x13'),auth['isAuthenticated'](),controller[_0xc430('0x1b')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index e88c36f..dcb5202 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 _0x9cf5=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','randomstring','STRING','name','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x533e4e,_0x4eba54){var _0x1f14bb=function(_0x33a485){while(--_0x33a485){_0x533e4e['push'](_0x533e4e['shift']());}};_0x1f14bb(++_0x4eba54);}(_0x9cf5,0x1f4));var _0x59cf=function(_0x1628b8,_0x574798){_0x1628b8=_0x1628b8-0x0;var _0x39ec46=_0x9cf5[_0x1628b8];return _0x39ec46;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x59cf('0x0'));module['exports']={'name':{'type':Sequelize[_0x59cf('0x1')],'unique':_0x59cf('0x2'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x59cf('0x1')],'allowNull':![]},'token':{'type':Sequelize[_0x59cf('0x1')],'defaultValue':function(){return rs[_0x59cf('0x3')]();}},'phone':{'type':Sequelize[_0x59cf('0x1')]},'type':{'type':Sequelize[_0x59cf('0x4')](_0x59cf('0x5'))},'accountSid':{'type':Sequelize[_0x59cf('0x1')]},'authToken':{'type':Sequelize[_0x59cf('0x1')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x59cf('0x6');}},'notificationSound':{'type':Sequelize[_0x59cf('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x59cf('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x59cf('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x59cf('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x59cf('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x59cf('0x8')],'comment':_0x59cf('0x9')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x59cf('0xa'),'set':function(_0x60abe9){if(!_0x60abe9){this[_0x59cf('0xb')](_0x59cf('0xc'),null);}this[_0x59cf('0xb')]('mandatoryDisposition',_0x60abe9);}},'description':{'type':Sequelize[_0x59cf('0x1')]}}; \ No newline at end of file +var _0x6f9a=['mandatoryDispositionPauseId','sequelize','randomstring','exports','STRING','name','ENUM','twilio','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0x6f9a,0x1b3));var _0xa6f9=function(_0x15a59e,_0x9689d4){_0x15a59e=_0x15a59e-0x0;var _0x5f00ce=_0x6f9a[_0x15a59e];return _0x5f00ce;};'use strict';var Sequelize=require(_0xa6f9('0x0'));var rs=require(_0xa6f9('0x1'));module[_0xa6f9('0x2')]={'name':{'type':Sequelize[_0xa6f9('0x3')],'unique':_0xa6f9('0x4'),'allowNull':![]},'key':{'type':Sequelize[_0xa6f9('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0xa6f9('0x3')],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs['generate']();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xa6f9('0x5')](_0xa6f9('0x6'))},'accountSid':{'type':Sequelize[_0xa6f9('0x3')]},'authToken':{'type':Sequelize[_0xa6f9('0x3')]},'notificationTemplate':{'type':Sequelize[_0xa6f9('0x7')],'defaultValue':function(){return _0xa6f9('0x8');}},'notificationSound':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xa6f9('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xa6f9('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xa6f9('0x9')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xa6f9('0xa')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xa6f9('0xa')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0xa6f9('0xb'),'set':function(_0x13bf96){if(!_0x13bf96){this[_0xa6f9('0xc')](_0xa6f9('0xd'),null);}this[_0xa6f9('0xc')]('mandatoryDisposition',_0x13bf96);}},'description':{'type':Sequelize[_0xa6f9('0x3')]}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index 240b9d7..62b3c5f 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 _0x122c=['intersection','query','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addAgents','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','emit','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','bulkCreate','findAndCountAll','priority','getApplications','notify','Applications','account','applications','CmContact','Sequelize','difference','createdAt','updatedAt','CompanyId','ListId','mobile','from','replace','whatsapp:','Body','messageId','MessageSid','isNil','ValidationError','from\x20is\x20mandatory','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','Contacts','DESC','omit','contact','WhatsappInteraction','spread','interaction','created','autoclose','push','close','*,*,*,*','WhatsappMessage','ContactId','UserId','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','stringify','twilio','text/xml','\x0a','json','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','eml-format','rimraf','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./whatsappAccount.socket','register','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','error','code','message','catch','sendStatus','status','offset','undefined','limit','count','set','apply','reject','update','destroy','get','WhatsappAccounts','UserProfileResource','name','send','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','type','model','map','filters'];(function(_0x3b1914,_0x5bf3d4){var _0x37ab9c=function(_0x2e3749){while(--_0x2e3749){_0x3b1914['push'](_0x3b1914['shift']());}};_0x37ab9c(++_0x5bf3d4);}(_0x122c,0x1dd));var _0xc122=function(_0x31b98c,_0x2a4b1b){_0x31b98c=_0x31b98c-0x0;var _0x2e2490=_0x122c[_0x31b98c];return _0x2e2490;};'use strict';var emlformat=require(_0xc122('0x0'));var rimraf=require(_0xc122('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xc122('0x2'));var moment=require(_0xc122('0x3'));var BPromise=require(_0xc122('0x4'));var Mustache=require(_0xc122('0x5'));var util=require('util');var path=require(_0xc122('0x6'));var sox=require(_0xc122('0x7'));var csv=require(_0xc122('0x8'));var ejs=require(_0xc122('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc122('0xa'));var squel=require(_0xc122('0xb'));var crypto=require('crypto');var jsforce=require(_0xc122('0xc'));var deskjs=require(_0xc122('0xd'));var toCsv=require(_0xc122('0x8'));var querystring=require(_0xc122('0xe'));var Papa=require('papaparse');var Redis=require(_0xc122('0xf'));var authService=require(_0xc122('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc122('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xc122('0x12'))('api');var utils=require(_0xc122('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xc122('0x14'));var db=require(_0xc122('0x15'))['db'];config[_0xc122('0x16')]=_[_0xc122('0x17')](config[_0xc122('0x16')],{'host':'localhost','port':0x18eb});var socket=require(_0xc122('0x18'))(new Redis(config[_0xc122('0x16')]));require(_0xc122('0x19'))[_0xc122('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson[_0xc122('0x1b')][_0xc122('0x1c')]({'port':0x232c});function respondWithRpcPromise(_0x386f4c,_0x3dd0cb,_0x4ea839,_0x5972b7){return new BPromise(function(_0x1e6675,_0x5087c5){var _0xade2cb=_0x5972b7||client;return _0xade2cb[_0xc122('0x1d')](_0x386f4c,_0x4ea839)[_0xc122('0x1e')](function(_0x36e4bb){logger[_0xc122('0x1f')](_0xc122('0x20'),_0x3dd0cb,_0xc122('0x21'));logger['debug'](_0xc122('0x22'),_0x3dd0cb,'request\x20sent',JSON['stringify'](_0x36e4bb));if(_0x36e4bb[_0xc122('0x23')]){if(_0x36e4bb[_0xc122('0x23')][_0xc122('0x24')]===0x1f4){logger[_0xc122('0x23')](_0xc122('0x20'),_0x3dd0cb,_0x36e4bb['error'][_0xc122('0x25')]);return _0x5087c5(_0x36e4bb[_0xc122('0x23')]['message']);}logger[_0xc122('0x23')](_0xc122('0x20'),_0x3dd0cb,_0x36e4bb[_0xc122('0x23')][_0xc122('0x25')]);return _0x1e6675(_0x36e4bb[_0xc122('0x23')][_0xc122('0x25')]);}else{logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x3dd0cb,_0xc122('0x21'));_0x1e6675(_0x36e4bb['result'][_0xc122('0x25')]);}})[_0xc122('0x26')](function(_0x4c517d){logger[_0xc122('0x23')]('WhatsappAccount,\x20%s,\x20%s',_0x3dd0cb,_0x4c517d);_0x5087c5(_0x4c517d);});});}function respondWithStatusCode(_0x16b203,_0x179801){_0x179801=_0x179801||0xcc;return function(_0x48a52b){if(_0x48a52b){return _0x16b203[_0xc122('0x27')](_0x179801);}return _0x16b203[_0xc122('0x28')](_0x179801)['end']();};}function respondWithResult(_0x3eb3af,_0x4e4e40){_0x4e4e40=_0x4e4e40||0xc8;return function(_0x563cd1){if(_0x563cd1){return _0x3eb3af[_0xc122('0x28')](_0x4e4e40)['json'](_0x563cd1);}};}function respondWithFilteredResult(_0x5cc03b,_0x489262){return function(_0x1c9eb7){if(_0x1c9eb7){var _0x4d1806=typeof _0x489262[_0xc122('0x29')]===_0xc122('0x2a')&&typeof _0x489262[_0xc122('0x2b')]==='undefined';var _0x34f704=_0x1c9eb7[_0xc122('0x2c')];var _0x30da30=_0x4d1806?0x0:_0x489262[_0xc122('0x29')];var _0x5a9b12=_0x4d1806?_0x1c9eb7[_0xc122('0x2c')]:_0x489262[_0xc122('0x29')]+_0x489262['limit'];var _0x2fa404;if(_0x5a9b12>=_0x34f704){_0x5a9b12=_0x34f704;_0x2fa404=0xc8;}else{_0x2fa404=0xce;}_0x5cc03b['status'](_0x2fa404);return _0x5cc03b[_0xc122('0x2d')]('Content-Range',_0x30da30+'-'+_0x5a9b12+'/'+_0x34f704)['json'](_0x1c9eb7);}return null;};}function patchUpdates(_0x525059){return function(_0x3f6f27){try{jsonpatch[_0xc122('0x2e')](_0x3f6f27,_0x525059,!![]);}catch(_0x185f36){return BPromise[_0xc122('0x2f')](_0x185f36);}return _0x3f6f27['save']();};}function saveUpdates(_0x1e84c6,_0x432dd0){return function(_0x19afed){if(_0x19afed){return _0x19afed[_0xc122('0x30')](_0x1e84c6)[_0xc122('0x1e')](function(_0x2f25a1){return _0x2f25a1;});}return null;};}function removeEntity(_0x4ee2d7,_0x4d9b51){return function(_0x5ff622){if(_0x5ff622){return _0x5ff622[_0xc122('0x31')]()[_0xc122('0x1e')](function(){var _0x5bba4d=_0x5ff622[_0xc122('0x32')]({'plain':!![]});var _0x301b9c=_0xc122('0x33');return db[_0xc122('0x34')][_0xc122('0x31')]({'where':{'type':_0x301b9c,'resourceId':_0x5bba4d['id']}})['then'](function(){return _0x5ff622;});})[_0xc122('0x1e')](function(){_0x4ee2d7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3754be,_0x1f1266){return function(_0x326cac){if(!_0x326cac){_0x3754be[_0xc122('0x27')](0x194);}return _0x326cac;};}function handleError(_0x34fa16,_0x16fc3c){_0x16fc3c=_0x16fc3c||0x1f4;return function(_0x4568c6){logger['error'](_0x4568c6['stack']);if(_0x4568c6[_0xc122('0x35')]){delete _0x4568c6[_0xc122('0x35')];}_0x34fa16[_0xc122('0x28')](_0x16fc3c)[_0xc122('0x36')](_0x4568c6);};}exports[_0xc122('0x37')]=function(_0xcb45d2,_0x4faafd){var _0x55e310={'include':[{'model':db['Pause'],'as':_0xc122('0x38')}]},_0x5523dc={},_0x11eea9={'count':0x0,'rows':[]};var _0x56fe4a=_['map'](db[_0xc122('0x39')][_0xc122('0x3a')],function(_0x4bc2cb){return{'name':_0x4bc2cb['fieldName'],'type':_0x4bc2cb[_0xc122('0x3b')]['key']};});_0x5523dc[_0xc122('0x3c')]=_[_0xc122('0x3d')](_0x56fe4a,_0xc122('0x35'));_0x5523dc['query']=_['keys'](_0xcb45d2['query']);_0x5523dc[_0xc122('0x3e')]=_[_0xc122('0x3f')](_0x5523dc[_0xc122('0x3c')],_0x5523dc[_0xc122('0x40')]);_0x55e310[_0xc122('0x41')]=_[_0xc122('0x3f')](_0x5523dc[_0xc122('0x3c')],qs[_0xc122('0x42')](_0xcb45d2[_0xc122('0x40')][_0xc122('0x42')]));_0x55e310[_0xc122('0x41')]=_0x55e310[_0xc122('0x41')]['length']?_0x55e310['attributes']:_0x5523dc[_0xc122('0x3c')];if(!_0xcb45d2[_0xc122('0x40')][_0xc122('0x43')](_0xc122('0x44'))){_0x55e310[_0xc122('0x2b')]=qs[_0xc122('0x2b')](_0xcb45d2[_0xc122('0x40')]['limit']);_0x55e310[_0xc122('0x29')]=qs['offset'](_0xcb45d2['query']['offset']);}_0x55e310[_0xc122('0x45')]=qs[_0xc122('0x46')](_0xcb45d2[_0xc122('0x40')][_0xc122('0x46')]);_0x55e310[_0xc122('0x47')]=qs[_0xc122('0x3e')](_[_0xc122('0x48')](_0xcb45d2[_0xc122('0x40')],_0x5523dc['filters']),_0x56fe4a);if(_0xcb45d2[_0xc122('0x40')][_0xc122('0x49')]){_0x55e310[_0xc122('0x47')]=_[_0xc122('0x4a')](_0x55e310[_0xc122('0x47')],{'$or':_['map'](_0x56fe4a,function(_0x3fcabb){if(_0x3fcabb[_0xc122('0x3b')]!==_0xc122('0x4b')){var _0x3e0053={};_0x3e0053[_0x3fcabb[_0xc122('0x35')]]={'$like':'%'+_0xcb45d2[_0xc122('0x40')][_0xc122('0x49')]+'%'};return _0x3e0053;}})});}_0x55e310=_[_0xc122('0x4a')]({},_0x55e310,_0xcb45d2[_0xc122('0x4c')]);var _0x2e9a22={'where':_0x55e310[_0xc122('0x47')]};return db[_0xc122('0x39')][_0xc122('0x2c')](_0x2e9a22)['then'](function(_0x38dacb){_0x11eea9[_0xc122('0x2c')]=_0x38dacb;if(_0xcb45d2[_0xc122('0x40')][_0xc122('0x4d')]){_0x55e310[_0xc122('0x4e')]=[{'all':!![]}];}return db[_0xc122('0x39')][_0xc122('0x4f')](_0x55e310);})[_0xc122('0x1e')](function(_0x26c4f6){_0x11eea9[_0xc122('0x50')]=_0x26c4f6;return _0x11eea9;})[_0xc122('0x1e')](respondWithFilteredResult(_0x4faafd,_0x55e310))['catch'](handleError(_0x4faafd,null));};exports[_0xc122('0x51')]=function(_0x56a503,_0x33dcea){var _0x14cb90={'raw':![],'where':{'id':_0x56a503[_0xc122('0x52')]['id']},'include':[{'model':db['Pause'],'as':_0xc122('0x38')}]},_0x26b405={};_0x26b405[_0xc122('0x3c')]=_[_0xc122('0x53')](db['WhatsappAccount'][_0xc122('0x3a')]);_0x26b405[_0xc122('0x40')]=_[_0xc122('0x53')](_0x56a503[_0xc122('0x40')]);_0x26b405['filters']=_['intersection'](_0x26b405[_0xc122('0x3c')],_0x26b405[_0xc122('0x40')]);_0x14cb90['attributes']=_[_0xc122('0x3f')](_0x26b405[_0xc122('0x3c')],qs[_0xc122('0x42')](_0x56a503[_0xc122('0x40')][_0xc122('0x42')]));_0x14cb90[_0xc122('0x41')]=_0x14cb90[_0xc122('0x41')][_0xc122('0x54')]?_0x14cb90[_0xc122('0x41')]:_0x26b405['model'];if(_0x56a503['query'][_0xc122('0x4d')]){_0x14cb90['include']=[{'all':!![]}];}_0x14cb90=_[_0xc122('0x4a')]({},_0x14cb90,_0x56a503[_0xc122('0x4c')]);return db[_0xc122('0x39')][_0xc122('0x55')](_0x14cb90)[_0xc122('0x1e')](handleEntityNotFound(_0x33dcea,null))[_0xc122('0x1e')](respondWithResult(_0x33dcea,null))['catch'](handleError(_0x33dcea,null));};exports[_0xc122('0x56')]=function(_0x434df6,_0x36ce2e){return db[_0xc122('0x39')][_0xc122('0x56')](_0x434df6[_0xc122('0x57')],{})['then'](function(_0x52bff5){var _0x36d9bd=_0x434df6[_0xc122('0x58')][_0xc122('0x32')]({'plain':!![]});if(!_0x36d9bd)throw new Error(_0xc122('0x59'));if(_0x36d9bd[_0xc122('0x5a')]===_0xc122('0x58')){var _0x19a3f8=_0x52bff5[_0xc122('0x32')]({'plain':!![]});var _0x4d41f8=_0xc122('0x33');return db[_0xc122('0x5b')][_0xc122('0x55')]({'where':{'name':_0x4d41f8,'userProfileId':_0x36d9bd[_0xc122('0x5c')]},'raw':!![]})['then'](function(_0x4d6966){if(_0x4d6966&&_0x4d6966['autoAssociation']===0x0){return db[_0xc122('0x34')][_0xc122('0x56')]({'name':_0x19a3f8['name'],'resourceId':_0x19a3f8['id'],'type':_0x4d6966[_0xc122('0x35')],'sectionId':_0x4d6966['id']},{})['then'](function(){return _0x52bff5;});}else{return _0x52bff5;}})[_0xc122('0x26')](function(_0xec3643){logger[_0xc122('0x23')](_0xc122('0x5d'),_0xec3643);throw _0xec3643;});}return _0x52bff5;})[_0xc122('0x1e')](respondWithResult(_0x36ce2e,0xc9))[_0xc122('0x26')](handleError(_0x36ce2e,null));};exports[_0xc122('0x30')]=function(_0x27b9eb,_0x4fdfe8){if(_0x27b9eb['body']['id']){delete _0x27b9eb['body']['id'];}return db[_0xc122('0x39')][_0xc122('0x55')]({'where':{'id':_0x27b9eb['params']['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xc122('0x1e')](handleEntityNotFound(_0x4fdfe8,null))[_0xc122('0x1e')](saveUpdates(_0x27b9eb[_0xc122('0x57')],null))['then'](respondWithResult(_0x4fdfe8,null))['catch'](handleError(_0x4fdfe8,null));};exports['destroy']=function(_0x1feecb,_0x95ce04){return db[_0xc122('0x39')][_0xc122('0x55')]({'where':{'id':_0x1feecb['params']['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x95ce04,null))['then'](removeEntity(_0x95ce04,null))[_0xc122('0x26')](handleError(_0x95ce04,null));};exports[_0xc122('0x5e')]=function(_0x49ed6d,_0x3c94b4){return db[_0xc122('0x39')]['describe']()[_0xc122('0x1e')](respondWithResult(_0x3c94b4,null))[_0xc122('0x26')](handleError(_0x3c94b4,null));};exports[_0xc122('0x5f')]=function(_0x35764a,_0x3e0faf,_0x5ed04f){if(_0x35764a[_0xc122('0x57')]['id']){delete _0x35764a[_0xc122('0x57')]['id'];}return db['WhatsappAccount']['find']({'where':{'id':_0x35764a['params']['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x3e0faf,null))[_0xc122('0x1e')](function(_0x2f4031){if(_0x2f4031){_0x35764a[_0xc122('0x57')][_0xc122('0x60')]=_0x2f4031['id'];return db[_0xc122('0x61')]['create'](_0x35764a[_0xc122('0x57')]);}})[_0xc122('0x1e')](respondWithResult(_0x3e0faf,null))[_0xc122('0x26')](handleError(_0x3e0faf,null));};exports[_0xc122('0x62')]=function(_0x21267a,_0x4f0965,_0x237e52){var _0x1b5005={'raw':![],'where':{}};var _0x228fbf={};var _0x42c724={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0xc122('0x63')]({'where':{'id':_0x21267a[_0xc122('0x52')]['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x4f0965,null))['then'](function(_0x4cc2b2){if(_0x4cc2b2){_0x228fbf[_0xc122('0x3c')]=_[_0xc122('0x53')](db[_0xc122('0x61')][_0xc122('0x3a')]);_0x228fbf[_0xc122('0x40')]=_['keys'](_0x21267a[_0xc122('0x40')]);_0x228fbf[_0xc122('0x3e')]=_[_0xc122('0x3f')](_0x228fbf[_0xc122('0x3c')],_0x228fbf[_0xc122('0x40')]);_0x1b5005[_0xc122('0x41')]=_[_0xc122('0x3f')](_0x228fbf[_0xc122('0x3c')],qs[_0xc122('0x42')](_0x21267a[_0xc122('0x40')][_0xc122('0x42')]));_0x1b5005[_0xc122('0x41')]=_0x1b5005[_0xc122('0x41')]['length']?_0x1b5005[_0xc122('0x41')]:_0x228fbf[_0xc122('0x3c')];if(!_0x21267a['query']['hasOwnProperty']('nolimit')){_0x1b5005['limit']=qs[_0xc122('0x2b')](_0x21267a[_0xc122('0x40')]['limit']);_0x1b5005[_0xc122('0x29')]=qs['offset'](_0x21267a[_0xc122('0x40')][_0xc122('0x29')]);}_0x1b5005[_0xc122('0x45')]=qs['sort'](_0x21267a[_0xc122('0x40')][_0xc122('0x46')]);_0x1b5005[_0xc122('0x47')]=qs[_0xc122('0x3e')](_[_0xc122('0x48')](_0x21267a['query'],_0x228fbf[_0xc122('0x3e')]));_0x1b5005['where'][_0xc122('0x60')]=_0x4cc2b2['id'];if(_0x21267a[_0xc122('0x40')][_0xc122('0x49')]){_0x1b5005[_0xc122('0x47')]=_[_0xc122('0x4a')](_0x1b5005[_0xc122('0x47')],{'$or':_[_0xc122('0x3d')](_0x1b5005[_0xc122('0x41')],function(_0xe2a035){var _0x295815={};_0x295815[_0xe2a035]={'$like':'%'+_0x21267a[_0xc122('0x40')][_0xc122('0x49')]+'%'};return _0x295815;})});}_0x1b5005=_[_0xc122('0x4a')]({},_0x1b5005,_0x21267a[_0xc122('0x4c')]);return db[_0xc122('0x61')][_0xc122('0x2c')]({'where':_0x1b5005[_0xc122('0x47')]})[_0xc122('0x1e')](function(_0x2751e2){_0x42c724[_0xc122('0x2c')]=_0x2751e2;if(_0x21267a['query'][_0xc122('0x4d')]){_0x1b5005[_0xc122('0x4e')]=[{'all':!![]}];}return db['Disposition'][_0xc122('0x4f')](_0x1b5005);})['then'](function(_0x578e29){_0x42c724[_0xc122('0x50')]=_0x578e29;return _0x42c724;});}})[_0xc122('0x1e')](respondWithFilteredResult(_0x4f0965,_0x1b5005))[_0xc122('0x26')](handleError(_0x4f0965,null));};exports['removeDispositions']=function(_0x4ea097,_0x55510d,_0xdb1549){return db[_0xc122('0x39')][_0xc122('0x55')]({'where':{'id':_0x4ea097[_0xc122('0x52')]['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x55510d,null))[_0xc122('0x1e')](function(_0x1bdd4f){if(_0x1bdd4f){return _0x1bdd4f[_0xc122('0x64')](_0x4ea097['query']['ids']);}})[_0xc122('0x1e')](respondWithStatusCode(_0x55510d,null))[_0xc122('0x26')](handleError(_0x55510d,null));};exports[_0xc122('0x65')]=function(_0x2bcc20,_0x3b5842,_0x7b71f8){if(_0x2bcc20[_0xc122('0x57')]['id']){delete _0x2bcc20[_0xc122('0x57')]['id'];}return db['WhatsappAccount'][_0xc122('0x55')]({'where':{'id':_0x2bcc20['params']['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x3b5842,null))[_0xc122('0x1e')](function(_0x14187e){if(_0x14187e){_0x2bcc20[_0xc122('0x57')][_0xc122('0x60')]=_0x14187e['id'];return db[_0xc122('0x66')][_0xc122('0x56')](_0x2bcc20[_0xc122('0x57')]);}})[_0xc122('0x1e')](respondWithResult(_0x3b5842,null))[_0xc122('0x26')](handleError(_0x3b5842,null));};exports[_0xc122('0x67')]=function(_0x22e23d,_0xf2aa79,_0x585b70){var _0x1f5790={'raw':![],'where':{}};var _0x5522f9={};var _0x28efd1={'count':0x0,'rows':[]};return db[_0xc122('0x39')][_0xc122('0x63')]({'where':{'id':_0x22e23d['params']['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0xf2aa79,null))[_0xc122('0x1e')](function(_0xff1dec){if(_0xff1dec){_0x5522f9[_0xc122('0x3c')]=_[_0xc122('0x53')](db[_0xc122('0x66')]['rawAttributes']);_0x5522f9['query']=_[_0xc122('0x53')](_0x22e23d['query']);_0x5522f9[_0xc122('0x3e')]=_['intersection'](_0x5522f9[_0xc122('0x3c')],_0x5522f9[_0xc122('0x40')]);_0x1f5790['attributes']=_[_0xc122('0x3f')](_0x5522f9['model'],qs[_0xc122('0x42')](_0x22e23d[_0xc122('0x40')][_0xc122('0x42')]));_0x1f5790[_0xc122('0x41')]=_0x1f5790['attributes'][_0xc122('0x54')]?_0x1f5790[_0xc122('0x41')]:_0x5522f9[_0xc122('0x3c')];if(!_0x22e23d[_0xc122('0x40')][_0xc122('0x43')](_0xc122('0x44'))){_0x1f5790['limit']=qs['limit'](_0x22e23d[_0xc122('0x40')][_0xc122('0x2b')]);_0x1f5790[_0xc122('0x29')]=qs[_0xc122('0x29')](_0x22e23d[_0xc122('0x40')][_0xc122('0x29')]);}_0x1f5790['order']=qs['sort'](_0x22e23d[_0xc122('0x40')][_0xc122('0x46')]);_0x1f5790['where']=qs['filters'](_[_0xc122('0x48')](_0x22e23d[_0xc122('0x40')],_0x5522f9[_0xc122('0x3e')]));_0x1f5790[_0xc122('0x47')][_0xc122('0x60')]=_0xff1dec['id'];if(_0x22e23d[_0xc122('0x40')][_0xc122('0x49')]){_0x1f5790[_0xc122('0x47')]=_[_0xc122('0x4a')](_0x1f5790['where'],{'$or':_[_0xc122('0x3d')](_0x1f5790[_0xc122('0x41')],function(_0x5c737d){var _0x2a8a6e={};_0x2a8a6e[_0x5c737d]={'$like':'%'+_0x22e23d[_0xc122('0x40')][_0xc122('0x49')]+'%'};return _0x2a8a6e;})});}_0x1f5790=_[_0xc122('0x4a')]({},_0x1f5790,_0x22e23d[_0xc122('0x4c')]);return db[_0xc122('0x66')]['count']({'where':_0x1f5790[_0xc122('0x47')]})[_0xc122('0x1e')](function(_0x261fbc){_0x28efd1[_0xc122('0x2c')]=_0x261fbc;if(_0x22e23d['query'][_0xc122('0x4d')]){_0x1f5790[_0xc122('0x4e')]=[{'all':!![]}];}return db[_0xc122('0x66')][_0xc122('0x4f')](_0x1f5790);})[_0xc122('0x1e')](function(_0x1ff15d){_0x28efd1[_0xc122('0x50')]=_0x1ff15d;return _0x28efd1;});}})[_0xc122('0x1e')](respondWithFilteredResult(_0xf2aa79,_0x1f5790))['catch'](handleError(_0xf2aa79,null));};exports[_0xc122('0x68')]=function(_0xce317c,_0x4493df,_0x5964a1){return db['WhatsappAccount']['find']({'where':{'id':_0xce317c[_0xc122('0x52')]['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x4493df,null))[_0xc122('0x1e')](function(_0x259838){if(_0x259838){return _0x259838[_0xc122('0x68')](_0xce317c[_0xc122('0x40')][_0xc122('0x69')]);}})[_0xc122('0x1e')](respondWithStatusCode(_0x4493df,null))[_0xc122('0x26')](handleError(_0x4493df,null));};exports[_0xc122('0x6a')]=function(_0x2eb3ed,_0x2f2b06,_0x4e87ed){return db[_0xc122('0x39')][_0xc122('0x55')]({'where':{'id':_0x2eb3ed[_0xc122('0x52')]['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x2f2b06,null))['then'](function(_0x4628f0){if(_0x4628f0){return _0x4628f0[_0xc122('0x6a')](_0x2eb3ed[_0xc122('0x57')]['ids'],_['omit'](_0x2eb3ed['body'],[_0xc122('0x69'),'id'])||{})['spread'](function(_0x2e8b99){for(var _0x43398d=0x0;_0x43398d<_0x2eb3ed['body']['ids']['length'];_0x43398d+=0x1){socket['emit'](_0xc122('0x6b'),{'UserId':Number(_0x2eb3ed[_0xc122('0x57')][_0xc122('0x69')][_0x43398d]),'WhatsappAccountId':Number(_0x2eb3ed[_0xc122('0x52')]['id'])});}return _0x2e8b99;});}})['then'](respondWithResult(_0x2f2b06,null))[_0xc122('0x26')](handleError(_0x2f2b06,null));};exports[_0xc122('0x6c')]=function(_0x321d20,_0x21ed2e,_0x2291a2){return db[_0xc122('0x39')][_0xc122('0x55')]({'where':{'id':_0x321d20[_0xc122('0x52')]['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x21ed2e,null))[_0xc122('0x1e')](function(_0x1e3c8d){if(_0x1e3c8d){return _0x1e3c8d[_0xc122('0x6c')](_0x321d20[_0xc122('0x40')][_0xc122('0x69')])[_0xc122('0x1e')](function(){if(_[_0xc122('0x6d')](_0x321d20[_0xc122('0x40')]['ids'])){for(var _0x25df21=0x0;_0x25df21<_0x321d20['query'][_0xc122('0x69')][_0xc122('0x54')];_0x25df21+=0x1){socket['emit'](_0xc122('0x6e'),{'UserId':Number(_0x321d20[_0xc122('0x40')]['ids'][_0x25df21]),'WhatsappAccountId':Number(_0x321d20[_0xc122('0x52')]['id'])});}}else{socket[_0xc122('0x6f')](_0xc122('0x6e'),{'UserId':Number(_0x321d20[_0xc122('0x40')][_0xc122('0x69')]),'WhatsappAccountId':Number(_0x321d20[_0xc122('0x52')]['id'])});}});}})[_0xc122('0x1e')](respondWithStatusCode(_0x21ed2e,null))[_0xc122('0x26')](handleError(_0x21ed2e,null));};exports[_0xc122('0x70')]=function(_0x5c1c94,_0x511941,_0x234101){var _0x498cf4={};var _0x20d13f={};var _0x2749c3;var _0x53289e;return db[_0xc122('0x39')]['findOne']({'where':{'id':_0x5c1c94['params']['id']}})['then'](handleEntityNotFound(_0x511941,null))[_0xc122('0x1e')](function(_0x3909e7){if(_0x3909e7){_0x2749c3=_0x3909e7;_0x20d13f[_0xc122('0x3c')]=_[_0xc122('0x53')](db[_0xc122('0x71')][_0xc122('0x3a')]);_0x20d13f['query']=_[_0xc122('0x53')](_0x5c1c94[_0xc122('0x40')]);_0x20d13f[_0xc122('0x3e')]=_['intersection'](_0x20d13f[_0xc122('0x3c')],_0x20d13f[_0xc122('0x40')]);_0x498cf4[_0xc122('0x41')]=_['intersection'](_0x20d13f[_0xc122('0x3c')],qs[_0xc122('0x42')](_0x5c1c94[_0xc122('0x40')][_0xc122('0x42')]));_0x498cf4[_0xc122('0x41')]=_0x498cf4['attributes'][_0xc122('0x54')]?_0x498cf4[_0xc122('0x41')]:_0x20d13f[_0xc122('0x3c')];_0x498cf4['order']=qs[_0xc122('0x46')](_0x5c1c94['query']['sort']);_0x498cf4[_0xc122('0x47')]=qs[_0xc122('0x3e')](_['pick'](_0x5c1c94[_0xc122('0x40')],_0x20d13f[_0xc122('0x3e')]));if(_0x5c1c94['query'][_0xc122('0x49')]){_0x498cf4[_0xc122('0x47')]=_[_0xc122('0x4a')](_0x498cf4[_0xc122('0x47')],{'$or':_[_0xc122('0x3d')](_0x498cf4['attributes'],function(_0x1cf62){var _0x220a69={};_0x220a69[_0x1cf62]={'$like':'%'+_0x5c1c94[_0xc122('0x40')][_0xc122('0x49')]+'%'};return _0x220a69;})});}_0x498cf4=_['merge']({},_0x498cf4,_0x5c1c94[_0xc122('0x4c')]);return _0x2749c3[_0xc122('0x70')](_0x498cf4);}})[_0xc122('0x1e')](function(_0x177d95){if(_0x177d95){_0x53289e=_0x177d95[_0xc122('0x54')];if(!_0x5c1c94['query'][_0xc122('0x43')](_0xc122('0x44'))){_0x498cf4[_0xc122('0x2b')]=qs[_0xc122('0x2b')](_0x5c1c94[_0xc122('0x40')]['limit']);_0x498cf4[_0xc122('0x29')]=qs['offset'](_0x5c1c94[_0xc122('0x40')][_0xc122('0x29')]);}return _0x2749c3[_0xc122('0x70')](_0x498cf4);}})['then'](function(_0x20e604){if(_0x20e604){return _0x20e604?{'count':_0x53289e,'rows':_0x20e604}:null;}})['then'](respondWithResult(_0x511941,null))[_0xc122('0x26')](handleError(_0x511941,null));};exports[_0xc122('0x72')]=function(_0x43a76b,_0x1fb650,_0x3392a8){return db['WhatsappAccount'][_0xc122('0x63')]({'where':{'id':_0x43a76b[_0xc122('0x52')]['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x1fb650,null))[_0xc122('0x1e')](function(_0x2bae7e){if(_0x2bae7e){return db[_0xc122('0x73')][_0xc122('0x74')](function(_0x4613d1){return db[_0xc122('0x75')][_0xc122('0x31')]({'where':{'WhatsappAccountId':_0x43a76b[_0xc122('0x52')]['id']},'transaction':_0x4613d1})[_0xc122('0x1e')](function(_0x1fa449){var _0x496e94=_[_0xc122('0x3d')](_0x43a76b[_0xc122('0x57')],function(_0x2560ac){_0x2560ac[_0xc122('0x60')]=_0x43a76b[_0xc122('0x52')]['id'];return _0x2560ac;});return db['WhatsappApplication'][_0xc122('0x76')](_0x496e94,{'transaction':_0x4613d1});});})['then'](function(){return db['WhatsappApplication'][_0xc122('0x77')]({'where':{'WhatsappAccountId':_0x43a76b[_0xc122('0x52')]['id']},'order':_0xc122('0x78')});});}})[_0xc122('0x1e')](respondWithResult(_0x1fb650,null))[_0xc122('0x26')](handleError(_0x1fb650,null));};exports[_0xc122('0x79')]=function(_0x34f6ab,_0x2555ac,_0x527958){var _0x588f50={};var _0x2b1174={};var _0x4607f8;var _0x19c77e;return db['WhatsappAccount']['findOne']({'where':{'id':_0x34f6ab['params']['id']}})[_0xc122('0x1e')](handleEntityNotFound(_0x2555ac,null))['then'](function(_0x24fa9a){if(_0x24fa9a){_0x4607f8=_0x24fa9a;_0x2b1174['model']=_[_0xc122('0x53')](db[_0xc122('0x75')]['rawAttributes']);_0x2b1174[_0xc122('0x40')]=_[_0xc122('0x53')](_0x34f6ab[_0xc122('0x40')]);_0x2b1174[_0xc122('0x3e')]=_[_0xc122('0x3f')](_0x2b1174['model'],_0x2b1174[_0xc122('0x40')]);_0x588f50['attributes']=_[_0xc122('0x3f')](_0x2b1174[_0xc122('0x3c')],qs['fields'](_0x34f6ab['query'][_0xc122('0x42')]));_0x588f50[_0xc122('0x41')]=_0x588f50['attributes'][_0xc122('0x54')]?_0x588f50[_0xc122('0x41')]:_0x2b1174[_0xc122('0x3c')];_0x588f50[_0xc122('0x45')]=qs[_0xc122('0x46')](_0x34f6ab[_0xc122('0x40')][_0xc122('0x46')]);_0x588f50[_0xc122('0x47')]=qs[_0xc122('0x3e')](_[_0xc122('0x48')](_0x34f6ab[_0xc122('0x40')],_0x2b1174[_0xc122('0x3e')]));if(_0x34f6ab[_0xc122('0x40')][_0xc122('0x49')]){_0x588f50[_0xc122('0x47')]=_[_0xc122('0x4a')](_0x588f50['where'],{'$or':_[_0xc122('0x3d')](_0x588f50[_0xc122('0x41')],function(_0x52636d){var _0x24e682={};_0x24e682[_0x52636d]={'$like':'%'+_0x34f6ab[_0xc122('0x40')][_0xc122('0x49')]+'%'};return _0x24e682;})});}_0x588f50=_[_0xc122('0x4a')]({},_0x588f50,_0x34f6ab[_0xc122('0x4c')]);return _0x4607f8[_0xc122('0x79')](_0x588f50);}})[_0xc122('0x1e')](function(_0xf7212c){if(_0xf7212c){_0x19c77e=_0xf7212c[_0xc122('0x54')];if(!_0x34f6ab[_0xc122('0x40')]['hasOwnProperty']('nolimit')){_0x588f50[_0xc122('0x2b')]=qs['limit'](_0x34f6ab[_0xc122('0x40')]['limit']);_0x588f50[_0xc122('0x29')]=qs[_0xc122('0x29')](_0x34f6ab['query']['offset']);}return _0x4607f8['getApplications'](_0x588f50);}})[_0xc122('0x1e')](function(_0x270b7c){if(_0x270b7c){return _0x270b7c?{'count':_0x19c77e,'rows':_0x270b7c}:null;}})[_0xc122('0x1e')](respondWithResult(_0x2555ac,null))[_0xc122('0x26')](handleError(_0x2555ac,null));};exports[_0xc122('0x7a')]=function(_0x13cd39,_0x449f58,_0x4a68ef){var _0x16df36={'channel':'whatsapp'};var _0xe2fbb2=[];var _0x491bbe=[];var _0x5036aa={};return db[_0xc122('0x39')][_0xc122('0x55')]({'where':{'id':_0x13cd39[_0xc122('0x52')]['id']},'include':[{'model':db[_0xc122('0x75')],'as':_0xc122('0x7b')}]})['then'](handleEntityNotFound(_0x449f58,null))['then'](function(_0x4ccd03){_0x16df36[_0xc122('0x7c')]=_0x4ccd03;_0x16df36[_0xc122('0x7d')]=_['orderBy'](_0x4ccd03[_0xc122('0x7b')],[_0xc122('0x78')],['asc']);if(_0x16df36[_0xc122('0x7c')][_0xc122('0x7b')]){delete _0x16df36[_0xc122('0x7c')]['Applications'];}return db[_0xc122('0x7e')][_0xc122('0x5e')]();})[_0xc122('0x1e')](function(_0x645979){if(!_0x645979){throw new db[(_0xc122('0x7f'))]['ValidationError']('no\x20available\x20attributes');}_0xe2fbb2=_[_0xc122('0x80')](_[_0xc122('0x53')](_0x645979),[_0xc122('0x81'),'updatedAt']);_0x491bbe=_[_0xc122('0x80')](_[_0xc122('0x53')](_0x645979),[_0xc122('0x81'),_0xc122('0x82'),_0xc122('0x83'),_0xc122('0x84')]);_0x16df36[_0xc122('0x57')]={'mapKey':_0xc122('0x85')};if(_0x16df36[_0xc122('0x7c')]['type']&&_0x16df36[_0xc122('0x7c')][_0xc122('0x3b')]==='twilio'){_0x16df36[_0xc122('0x57')][_0xc122('0x86')]=_0x13cd39[_0xc122('0x57')]['From'][_0xc122('0x87')](_0xc122('0x88'),'');_0x16df36['body']['body']=_0x13cd39[_0xc122('0x57')][_0xc122('0x89')];_0x16df36[_0xc122('0x57')][_0xc122('0x8a')]=_0x13cd39[_0xc122('0x57')][_0xc122('0x8b')];}if(_0x16df36[_0xc122('0x57')]['id']){delete _0x16df36['body']['id'];}if(_[_0xc122('0x8c')](_0x16df36[_0xc122('0x57')][_0xc122('0x86')])){throw new db[(_0xc122('0x7f'))][(_0xc122('0x8d'))](_0xc122('0x8e'));}if(_[_0xc122('0x8c')](_0x16df36[_0xc122('0x57')][_0xc122('0x57')])||_0x16df36[_0xc122('0x57')][_0xc122('0x57')]===''){throw new db[(_0xc122('0x7f'))][(_0xc122('0x8d'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x16df36[_0xc122('0x57')]['mapKey'])){throw new db[(_0xc122('0x7f'))][(_0xc122('0x8d'))](_0xc122('0x8f')+_0x491bbe);}if(!_[_0xc122('0x90')](_0x491bbe,_0x16df36[_0xc122('0x57')][_0xc122('0x91')])){throw new db[(_0xc122('0x7f'))][(_0xc122('0x8d'))](_0xc122('0x92')+_0x491bbe);}_0x5036aa[_0x16df36[_0xc122('0x57')][_0xc122('0x91')]]=_0x16df36['body'][_0xc122('0x86')];return db[_0xc122('0x93')][_0xc122('0x55')]({'where':{'id':_0x16df36[_0xc122('0x7c')][_0xc122('0x84')]},'include':[{'model':db[_0xc122('0x7e')],'as':_0xc122('0x94'),'where':_0x5036aa,'limit':0x1,'order':[[_0xc122('0x82'),_0xc122('0x95')]]}]});})[_0xc122('0x1e')](handleEntityNotFound(_0x449f58,null))[_0xc122('0x1e')](function(_0x3f0622){if(_0x3f0622){_0x16df36['list']=_[_0xc122('0x96')](_0x3f0622,[_0xc122('0x94')]);if(_0x3f0622[_0xc122('0x94')][_0xc122('0x54')]){return _0x3f0622[_0xc122('0x94')][0x0];}var _0x3a7eec=_['defaults'](_0x16df36[_0xc122('0x57')],{'firstName':_0x16df36[_0xc122('0x57')][_0xc122('0x86')],'ListId':_0x3f0622['id']});_0x3a7eec[_0x16df36[_0xc122('0x57')][_0xc122('0x91')]]=_0x16df36[_0xc122('0x57')][_0xc122('0x86')];return db[_0xc122('0x7e')][_0xc122('0x56')](_0x3a7eec,{'fields':_0xe2fbb2,'raw':!![]});}})[_0xc122('0x1e')](handleEntityNotFound(_0x449f58,null))[_0xc122('0x1e')](function(_0x5f3a02){if(_0x5f3a02){_0x16df36[_0xc122('0x97')]=_0x5f3a02;var _0x8bc8a6={'ContactId':_0x5f3a02['id'],'phone':_0x16df36['body'][_0xc122('0x86')],'WhatsappAccountId':_0x13cd39[_0xc122('0x52')]['id']};var _0x15882d={'ContactId':_0x5f3a02['id'],'WhatsappAccountId':_0x13cd39[_0xc122('0x52')]['id'],'closed':![]};return db['WhatsappInteraction'][_0xc122('0x55')]({'where':_0x15882d})[_0xc122('0x1e')](function(_0x5c725b){if(_0x5c725b){return[_0x5c725b,![]];}return db[_0xc122('0x98')][_0xc122('0x56')](_0x8bc8a6)[_0xc122('0x1e')](function(_0x5972c8){return[_0x5972c8,!![]];});});}})[_0xc122('0x99')](function(_0x320435,_0x1eaf3a){_0x16df36['interaction']=_0x320435[_0xc122('0x32')]({'plain':!![]});_0x16df36[_0xc122('0x9a')][_0xc122('0x9b')]=![];if(_0x1eaf3a){if(_0x16df36[_0xc122('0x7c')][_0xc122('0x9c')]){_0x16df36[_0xc122('0x7d')][_0xc122('0x9d')]({'id':0x0,'priority':_0x16df36[_0xc122('0x7d')][_0xc122('0x54')]+0x1,'app':_0xc122('0x9e'),'appdata':'unmanaged','interval':_0xc122('0x9f')});}_0x16df36['interaction'][_0xc122('0x9b')]=!![];}return db[_0xc122('0xa0')][_0xc122('0x56')]({'phone':_0x16df36[_0xc122('0x57')][_0xc122('0x86')],'messageId':_0x16df36[_0xc122('0x57')][_0xc122('0x8a')],'body':_0x16df36[_0xc122('0x57')][_0xc122('0x57')],'WhatsappAccountId':_0x13cd39[_0xc122('0x52')]['id'],'WhatsappInteractionId':_0x320435['id'],'direction':'in','ContactId':_0x320435[_0xc122('0xa1')],'AttachmentId':_0x16df36['body']['AttachmentId']});})[_0xc122('0x1e')](function(_0x3158d5){_0x16df36[_0xc122('0x25')]=_0x3158d5;if(_0x16df36[_0xc122('0x9a')][_0xc122('0xa2')]){return db[_0xc122('0x71')][_0xc122('0x55')]({'attributes':['id',_0xc122('0x35')],'where':{'id':_0x16df36[_0xc122('0x9a')][_0xc122('0xa2')]}})['then'](function(_0x10df6a){if(_0x10df6a){_0x16df36['applications']['unshift']({'id':0x0,'priority':0x0,'app':_0xc122('0xa3'),'appdata':_0x10df6a[_0xc122('0x35')]+','+(_0x16df36[_0xc122('0x7c')][_0xc122('0xa4')]||0xa),'interval':_0xc122('0x9f')});}return respondWithRpcPromise(_0xc122('0xa5'),_0xc122('0xa6'),_0x16df36);});}return respondWithRpcPromise(_0xc122('0xa5'),'startRouting',_0x16df36);})[_0xc122('0x1e')](function(_0x38047c){if(_0x38047c){var _0x313175=0xc8;var _0x4d9115=_0xc122('0xa7');logger[_0xc122('0x1f')](_0xc122('0x22'),_0x4d9115,_0x313175,'entity\x20found');logger['debug'](_0xc122('0xa8'),_0x4d9115,_0x313175,'entity\x20found',JSON[_0xc122('0xa9')](_0x38047c));if(_0x16df36[_0xc122('0x7c')][_0xc122('0x3b')]===_0xc122('0xaa')){return _0x449f58['status'](_0x313175)[_0xc122('0x2d')]('Content-Type',_0xc122('0xab'))[_0xc122('0x36')](_0xc122('0xac'));}else{return _0x449f58['status'](_0x313175)[_0xc122('0xad')](_0x38047c);}}})[_0xc122('0x26')](handleError(_0x449f58,null));};exports[_0xc122('0x36')]=function(_0xfe10b3,_0x47c9d6,_0x1a9b97){var _0x35e486,_0x4ba5ca,_0x496fcc;if(_['isNil'](_0xfe10b3['body'][_0xc122('0x57')])||_0xfe10b3['body']['body']===''){throw new db['Sequelize'][(_0xc122('0x8d'))](_0xc122('0xae'));}if(_[_0xc122('0x8c')](_0xfe10b3[_0xc122('0x57')]['to'])){throw new db['Sequelize'][(_0xc122('0x8d'))](_0xc122('0xaf'));}_0x35e486=_0xfe10b3[_0xc122('0x57')]['to'];return db[_0xc122('0x39')][_0xc122('0x55')]({'where':{'id':_0xfe10b3[_0xc122('0x52')]['id']},'include':[{'model':db['CmList'],'as':'List','include':[{'model':db['CmContact'],'as':_0xc122('0x94'),'where':{'mobile':_0x35e486},'limit':0x1,'order':[[_0xc122('0x82'),_0xc122('0x95')]]}]}]})[_0xc122('0x1e')](handleEntityNotFound(_0x47c9d6,null))[_0xc122('0x1e')](function(_0x4a6161){if(_0x4a6161&&_0x4a6161[_0xc122('0xb0')]){_0x4ba5ca=_0x4a6161[_0xc122('0x32')]({'plain':!![]});if(_0x4ba5ca[_0xc122('0xb0')]&&_0x4ba5ca[_0xc122('0xb0')][_0xc122('0x94')]['length']){return _0x4ba5ca['List'][_0xc122('0x94')][0x0];}return db['CmContact'][_0xc122('0x56')](_[_0xc122('0x17')](_0xfe10b3[_0xc122('0x57')],{'firstName':_0x35e486,'mobile':_0x35e486,'phone':_0x35e486,'ListId':_0x4ba5ca[_0xc122('0x84')]}));}})[_0xc122('0x1e')](handleEntityNotFound(_0x47c9d6,null))[_0xc122('0x1e')](function(_0x4eae9a){if(_0x4eae9a){_0x496fcc=_0x4eae9a;return db['WhatsappInteraction'][_0xc122('0x55')]({'where':{'ContactId':_0x496fcc['id'],'closed':![],'WhatsappAccountId':_0x4ba5ca['id']}})[_0xc122('0x1e')](function(_0x4cea95){if(_0x4cea95){return[_0x4cea95,![]];}return db['WhatsappInteraction'][_0xc122('0x56')]({'UserId':_0xfe10b3[_0xc122('0x58')]['id'],'ContactId':_0x496fcc['id'],'WhatsappAccountId':_0x4ba5ca['id'],'phone':_0x35e486,'firstMsgDirection':_0xc122('0xb1'),'Messages':[_[_0xc122('0x4a')](_0xfe10b3[_0xc122('0x57')],{'read':![],'body':_0xfe10b3[_0xc122('0x57')]['body'],'phone':_0x35e486,'WhatsappAccountId':_0x4ba5ca['id'],'UserId':_0xfe10b3[_0xc122('0x58')]['id'],'ContactId':_0x496fcc['id']})]},{'include':[{'model':db[_0xc122('0xa0')],'as':_0xc122('0xb2')}]})[_0xc122('0x1e')](function(_0x325865){return[_0x325865,!![]];});});}})[_0xc122('0x99')](function(_0x3c45ea,_0x16889e){if(_0x16889e){return _0x3c45ea;}return db[_0xc122('0xa0')][_0xc122('0x56')](_['merge'](_0xfe10b3[_0xc122('0x57')],{'read':![],'body':_0xfe10b3[_0xc122('0x57')][_0xc122('0x57')],'phone':_0x35e486,'WhatsappAccountId':_0x4ba5ca['id'],'WhatsappInteractionId':_0x3c45ea['id'],'UserId':_0xfe10b3[_0xc122('0x58')]['id'],'ContactId':_0x496fcc['id']}))[_0xc122('0x1e')](function(_0x55092d){_0x3c45ea[_0xc122('0xb3')]['Messages']=[];_0x3c45ea[_0xc122('0xb3')][_0xc122('0xb2')]['push'](_0x55092d['dataValues']);return _0x3c45ea;});})[_0xc122('0x1e')](respondWithResult(_0x47c9d6,null))[_0xc122('0x26')](handleError(_0x47c9d6,null));}; \ No newline at end of file +var _0xc326=['CmList','Contacts','DESC','list','defaults','contact','WhatsappInteraction','interaction','created','autoclose','close','unmanaged','*,*,*,*','WhatsappMessage','ContactId','UserId','unshift','waitForTheAssignedAgent','Start','startRouting','receiveMessage','entity\x20found','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','Content-Type','text/xml','\x0a','List','out','spread','Messages','dataValues','push','eml-format','rimraf','zip-dir','request-promise','moment','util','path','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','http','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','end','status','json','offset','undefined','count','limit','Content-Range','apply','reject','save','update','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','send','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','options','includeAll','include','rows','catch','show','params','Pause','mandatoryDispositionPause','WhatsappAccount','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','WhatsappAccountId','Disposition','removeDispositions','addAnswer','CannedAnswer','getAnswers','findOne','findAll','removeAnswers','ids','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','isArray','userWhatsappAccount:remove','getAgents','User','addApplications','sequelize','transaction','WhatsappApplication','getApplications','notify','whatsapp','Applications','account','applications','orderBy','priority','asc','CmContact','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','ListId','mobile','twilio','From','whatsapp:','Body','messageId','MessageSid','isNil','from\x20is\x20mandatory','Sequelize','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from'];(function(_0x1c60ef,_0x51da79){var _0x5b6b80=function(_0x1df436){while(--_0x1df436){_0x1c60ef['push'](_0x1c60ef['shift']());}};_0x5b6b80(++_0x51da79);}(_0xc326,0x198));var _0x6c32=function(_0x1b1564,_0x19c47c){_0x1b1564=_0x1b1564-0x0;var _0x58ded3=_0xc326[_0x1b1564];return _0x58ded3;};'use strict';var emlformat=require(_0x6c32('0x0'));var rimraf=require(_0x6c32('0x1'));var zipdir=require(_0x6c32('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c32('0x3'));var moment=require(_0x6c32('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6c32('0x5'));var path=require(_0x6c32('0x6'));var sox=require(_0x6c32('0x7'));var csv=require('to-csv');var ejs=require(_0x6c32('0x8'));var fs=require('fs');var fs_extra=require(_0x6c32('0x9'));var _=require('lodash');var squel=require(_0x6c32('0xa'));var crypto=require('crypto');var jsforce=require(_0x6c32('0xb'));var deskjs=require(_0x6c32('0xc'));var toCsv=require(_0x6c32('0xd'));var querystring=require('querystring');var Papa=require(_0x6c32('0xe'));var Redis=require('ioredis');var authService=require(_0x6c32('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x6c32('0x10'))('api');var utils=require('../../config/utils');var config=require(_0x6c32('0x11'));var licenseUtil=require(_0x6c32('0x12'));var db=require(_0x6c32('0x13'))['db'];config[_0x6c32('0x14')]=_['defaults'](config[_0x6c32('0x14')],{'host':_0x6c32('0x15'),'port':0x18eb});var socket=require(_0x6c32('0x16'))(new Redis(config['redis']));require(_0x6c32('0x17'))[_0x6c32('0x18')](socket);var jayson=require(_0x6c32('0x19'));var client=jayson[_0x6c32('0x1a')][_0x6c32('0x1b')]({'port':0x232c});function respondWithRpcPromise(_0x3104be,_0x36c6e0,_0x5d695e,_0x1c5643){return new BPromise(function(_0x3db2ef,_0x55af71){var _0x34a01d=_0x1c5643||client;return _0x34a01d[_0x6c32('0x1c')](_0x3104be,_0x5d695e)[_0x6c32('0x1d')](function(_0x4a7ebc){logger[_0x6c32('0x1e')](_0x6c32('0x1f'),_0x36c6e0,_0x6c32('0x20'));logger[_0x6c32('0x21')](_0x6c32('0x22'),_0x36c6e0,'request\x20sent',JSON[_0x6c32('0x23')](_0x4a7ebc));if(_0x4a7ebc['error']){if(_0x4a7ebc[_0x6c32('0x24')][_0x6c32('0x25')]===0x1f4){logger['error'](_0x6c32('0x1f'),_0x36c6e0,_0x4a7ebc[_0x6c32('0x24')][_0x6c32('0x26')]);return _0x55af71(_0x4a7ebc[_0x6c32('0x24')][_0x6c32('0x26')]);}logger[_0x6c32('0x24')](_0x6c32('0x1f'),_0x36c6e0,_0x4a7ebc[_0x6c32('0x24')][_0x6c32('0x26')]);return _0x3db2ef(_0x4a7ebc[_0x6c32('0x24')][_0x6c32('0x26')]);}else{logger[_0x6c32('0x1e')](_0x6c32('0x1f'),_0x36c6e0,_0x6c32('0x20'));_0x3db2ef(_0x4a7ebc[_0x6c32('0x27')]['message']);}})['catch'](function(_0x5a7d51){logger[_0x6c32('0x24')](_0x6c32('0x1f'),_0x36c6e0,_0x5a7d51);_0x55af71(_0x5a7d51);});});}function respondWithStatusCode(_0x4ef029,_0x5a0a35){_0x5a0a35=_0x5a0a35||0xcc;return function(_0x2bcd69){if(_0x2bcd69){return _0x4ef029['sendStatus'](_0x5a0a35);}return _0x4ef029['status'](_0x5a0a35)[_0x6c32('0x28')]();};}function respondWithResult(_0x58346c,_0x1eb4d3){_0x1eb4d3=_0x1eb4d3||0xc8;return function(_0x274795){if(_0x274795){return _0x58346c[_0x6c32('0x29')](_0x1eb4d3)[_0x6c32('0x2a')](_0x274795);}};}function respondWithFilteredResult(_0x4cdfa9,_0x2c9ec3){return function(_0x12556e){if(_0x12556e){var _0x183fb5=typeof _0x2c9ec3[_0x6c32('0x2b')]===_0x6c32('0x2c')&&typeof _0x2c9ec3['limit']===_0x6c32('0x2c');var _0x1124bf=_0x12556e[_0x6c32('0x2d')];var _0xd1d54f=_0x183fb5?0x0:_0x2c9ec3[_0x6c32('0x2b')];var _0x5a1110=_0x183fb5?_0x12556e[_0x6c32('0x2d')]:_0x2c9ec3[_0x6c32('0x2b')]+_0x2c9ec3[_0x6c32('0x2e')];var _0xacee64;if(_0x5a1110>=_0x1124bf){_0x5a1110=_0x1124bf;_0xacee64=0xc8;}else{_0xacee64=0xce;}_0x4cdfa9[_0x6c32('0x29')](_0xacee64);return _0x4cdfa9['set'](_0x6c32('0x2f'),_0xd1d54f+'-'+_0x5a1110+'/'+_0x1124bf)['json'](_0x12556e);}return null;};}function patchUpdates(_0x3092c2){return function(_0x160fd1){try{jsonpatch[_0x6c32('0x30')](_0x160fd1,_0x3092c2,!![]);}catch(_0x5a1e3d){return BPromise[_0x6c32('0x31')](_0x5a1e3d);}return _0x160fd1[_0x6c32('0x32')]();};}function saveUpdates(_0x40d7d8,_0x179075){return function(_0x3e3001){if(_0x3e3001){return _0x3e3001[_0x6c32('0x33')](_0x40d7d8)[_0x6c32('0x1d')](function(_0x4a9853){return _0x4a9853;});}return null;};}function removeEntity(_0x243bee,_0x1b073a){return function(_0x125314){if(_0x125314){return _0x125314[_0x6c32('0x34')]()[_0x6c32('0x1d')](function(){var _0x43c1a7=_0x125314[_0x6c32('0x35')]({'plain':!![]});var _0x21cc3b=_0x6c32('0x36');return db[_0x6c32('0x37')][_0x6c32('0x34')]({'where':{'type':_0x21cc3b,'resourceId':_0x43c1a7['id']}})['then'](function(){return _0x125314;});})['then'](function(){_0x243bee[_0x6c32('0x29')](0xcc)[_0x6c32('0x28')]();});}};}function handleEntityNotFound(_0x38aeb8,_0x179895){return function(_0x2ae2b9){if(!_0x2ae2b9){_0x38aeb8[_0x6c32('0x38')](0x194);}return _0x2ae2b9;};}function handleError(_0x28f549,_0x559882){_0x559882=_0x559882||0x1f4;return function(_0x124862){logger[_0x6c32('0x24')](_0x124862[_0x6c32('0x39')]);if(_0x124862[_0x6c32('0x3a')]){delete _0x124862[_0x6c32('0x3a')];}_0x28f549[_0x6c32('0x29')](_0x559882)[_0x6c32('0x3b')](_0x124862);};}exports['index']=function(_0x43df3e,_0x544e3a){var _0x200ef3={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x27bb42={},_0x33fb2a={'count':0x0,'rows':[]};var _0x4d286b=_['map'](db['WhatsappAccount'][_0x6c32('0x3c')],function(_0xe99145){return{'name':_0xe99145[_0x6c32('0x3d')],'type':_0xe99145['type'][_0x6c32('0x3e')]};});_0x27bb42[_0x6c32('0x3f')]=_[_0x6c32('0x40')](_0x4d286b,_0x6c32('0x3a'));_0x27bb42[_0x6c32('0x41')]=_[_0x6c32('0x42')](_0x43df3e[_0x6c32('0x41')]);_0x27bb42[_0x6c32('0x43')]=_[_0x6c32('0x44')](_0x27bb42['model'],_0x27bb42[_0x6c32('0x41')]);_0x200ef3[_0x6c32('0x45')]=_[_0x6c32('0x44')](_0x27bb42['model'],qs[_0x6c32('0x46')](_0x43df3e[_0x6c32('0x41')]['fields']));_0x200ef3[_0x6c32('0x45')]=_0x200ef3['attributes'][_0x6c32('0x47')]?_0x200ef3[_0x6c32('0x45')]:_0x27bb42[_0x6c32('0x3f')];if(!_0x43df3e['query'][_0x6c32('0x48')](_0x6c32('0x49'))){_0x200ef3[_0x6c32('0x2e')]=qs[_0x6c32('0x2e')](_0x43df3e['query'][_0x6c32('0x2e')]);_0x200ef3[_0x6c32('0x2b')]=qs[_0x6c32('0x2b')](_0x43df3e[_0x6c32('0x41')][_0x6c32('0x2b')]);}_0x200ef3[_0x6c32('0x4a')]=qs[_0x6c32('0x4b')](_0x43df3e['query']['sort']);_0x200ef3[_0x6c32('0x4c')]=qs[_0x6c32('0x43')](_[_0x6c32('0x4d')](_0x43df3e[_0x6c32('0x41')],_0x27bb42[_0x6c32('0x43')]),_0x4d286b);if(_0x43df3e[_0x6c32('0x41')][_0x6c32('0x4e')]){_0x200ef3['where']=_[_0x6c32('0x4f')](_0x200ef3[_0x6c32('0x4c')],{'$or':_[_0x6c32('0x40')](_0x4d286b,function(_0x3ff1a7){if(_0x3ff1a7[_0x6c32('0x50')]!=='VIRTUAL'){var _0x22485f={};_0x22485f[_0x3ff1a7[_0x6c32('0x3a')]]={'$like':'%'+_0x43df3e[_0x6c32('0x41')][_0x6c32('0x4e')]+'%'};return _0x22485f;}})});}_0x200ef3=_[_0x6c32('0x4f')]({},_0x200ef3,_0x43df3e[_0x6c32('0x51')]);var _0x257b1d={'where':_0x200ef3[_0x6c32('0x4c')]};return db['WhatsappAccount'][_0x6c32('0x2d')](_0x257b1d)['then'](function(_0x10e047){_0x33fb2a[_0x6c32('0x2d')]=_0x10e047;if(_0x43df3e[_0x6c32('0x41')][_0x6c32('0x52')]){_0x200ef3[_0x6c32('0x53')]=[{'all':!![]}];}return db['WhatsappAccount']['findAll'](_0x200ef3);})[_0x6c32('0x1d')](function(_0xee9beb){_0x33fb2a[_0x6c32('0x54')]=_0xee9beb;return _0x33fb2a;})[_0x6c32('0x1d')](respondWithFilteredResult(_0x544e3a,_0x200ef3))[_0x6c32('0x55')](handleError(_0x544e3a,null));};exports[_0x6c32('0x56')]=function(_0x4d2260,_0x44f22c){var _0x33a2e5={'raw':![],'where':{'id':_0x4d2260[_0x6c32('0x57')]['id']},'include':[{'model':db[_0x6c32('0x58')],'as':_0x6c32('0x59')}]},_0x3baf21={};_0x3baf21[_0x6c32('0x3f')]=_[_0x6c32('0x42')](db[_0x6c32('0x5a')]['rawAttributes']);_0x3baf21[_0x6c32('0x41')]=_[_0x6c32('0x42')](_0x4d2260[_0x6c32('0x41')]);_0x3baf21['filters']=_[_0x6c32('0x44')](_0x3baf21['model'],_0x3baf21[_0x6c32('0x41')]);_0x33a2e5[_0x6c32('0x45')]=_[_0x6c32('0x44')](_0x3baf21['model'],qs['fields'](_0x4d2260[_0x6c32('0x41')][_0x6c32('0x46')]));_0x33a2e5[_0x6c32('0x45')]=_0x33a2e5['attributes']['length']?_0x33a2e5['attributes']:_0x3baf21[_0x6c32('0x3f')];if(_0x4d2260[_0x6c32('0x41')][_0x6c32('0x52')]){_0x33a2e5['include']=[{'all':!![]}];}_0x33a2e5=_[_0x6c32('0x4f')]({},_0x33a2e5,_0x4d2260[_0x6c32('0x51')]);return db[_0x6c32('0x5a')][_0x6c32('0x5b')](_0x33a2e5)[_0x6c32('0x1d')](handleEntityNotFound(_0x44f22c,null))[_0x6c32('0x1d')](respondWithResult(_0x44f22c,null))['catch'](handleError(_0x44f22c,null));};exports['create']=function(_0x24b754,_0x3ca23f){return db[_0x6c32('0x5a')][_0x6c32('0x5c')](_0x24b754['body'],{})[_0x6c32('0x1d')](function(_0x4746f3){var _0x1ef63f=_0x24b754[_0x6c32('0x5d')][_0x6c32('0x35')]({'plain':!![]});if(!_0x1ef63f)throw new Error(_0x6c32('0x5e'));if(_0x1ef63f[_0x6c32('0x5f')]===_0x6c32('0x5d')){var _0x3dd787=_0x4746f3['get']({'plain':!![]});var _0xacb886=_0x6c32('0x36');return db['UserProfileSection'][_0x6c32('0x5b')]({'where':{'name':_0xacb886,'userProfileId':_0x1ef63f[_0x6c32('0x60')]},'raw':!![]})[_0x6c32('0x1d')](function(_0x404ec0){if(_0x404ec0&&_0x404ec0[_0x6c32('0x61')]===0x0){return db[_0x6c32('0x37')]['create']({'name':_0x3dd787[_0x6c32('0x3a')],'resourceId':_0x3dd787['id'],'type':_0x404ec0['name'],'sectionId':_0x404ec0['id']},{})[_0x6c32('0x1d')](function(){return _0x4746f3;});}else{return _0x4746f3;}})[_0x6c32('0x55')](function(_0x1a70f4){logger[_0x6c32('0x24')](_0x6c32('0x62'),_0x1a70f4);throw _0x1a70f4;});}return _0x4746f3;})[_0x6c32('0x1d')](respondWithResult(_0x3ca23f,0xc9))[_0x6c32('0x55')](handleError(_0x3ca23f,null));};exports['update']=function(_0x39500a,_0x464784){if(_0x39500a[_0x6c32('0x63')]['id']){delete _0x39500a['body']['id'];}return db['WhatsappAccount'][_0x6c32('0x5b')]({'where':{'id':_0x39500a[_0x6c32('0x57')]['id']},'include':[{'model':db['Pause'],'as':_0x6c32('0x59')}]})[_0x6c32('0x1d')](handleEntityNotFound(_0x464784,null))[_0x6c32('0x1d')](saveUpdates(_0x39500a[_0x6c32('0x63')],null))[_0x6c32('0x1d')](respondWithResult(_0x464784,null))['catch'](handleError(_0x464784,null));};exports[_0x6c32('0x34')]=function(_0xce7fb8,_0x73c866){return db[_0x6c32('0x5a')][_0x6c32('0x5b')]({'where':{'id':_0xce7fb8['params']['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x73c866,null))['then'](removeEntity(_0x73c866,null))[_0x6c32('0x55')](handleError(_0x73c866,null));};exports[_0x6c32('0x64')]=function(_0x28581c,_0x22ad09){return db['WhatsappAccount']['describe']()[_0x6c32('0x1d')](respondWithResult(_0x22ad09,null))[_0x6c32('0x55')](handleError(_0x22ad09,null));};exports['addDisposition']=function(_0x41bf76,_0x2c8da5,_0x477cd7){if(_0x41bf76[_0x6c32('0x63')]['id']){delete _0x41bf76[_0x6c32('0x63')]['id'];}return db[_0x6c32('0x5a')][_0x6c32('0x5b')]({'where':{'id':_0x41bf76[_0x6c32('0x57')]['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x2c8da5,null))['then'](function(_0x220784){if(_0x220784){_0x41bf76['body'][_0x6c32('0x65')]=_0x220784['id'];return db[_0x6c32('0x66')][_0x6c32('0x5c')](_0x41bf76['body']);}})['then'](respondWithResult(_0x2c8da5,null))[_0x6c32('0x55')](handleError(_0x2c8da5,null));};exports['getDispositions']=function(_0xca56b3,_0x827aeb,_0x4ee4b6){var _0x1002b9={'raw':![],'where':{}};var _0x3dafba={};var _0x1a389d={'count':0x0,'rows':[]};return db[_0x6c32('0x5a')]['findOne']({'where':{'id':_0xca56b3[_0x6c32('0x57')]['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x827aeb,null))['then'](function(_0x17ed04){if(_0x17ed04){_0x3dafba['model']=_['keys'](db[_0x6c32('0x66')][_0x6c32('0x3c')]);_0x3dafba[_0x6c32('0x41')]=_['keys'](_0xca56b3[_0x6c32('0x41')]);_0x3dafba[_0x6c32('0x43')]=_[_0x6c32('0x44')](_0x3dafba[_0x6c32('0x3f')],_0x3dafba[_0x6c32('0x41')]);_0x1002b9[_0x6c32('0x45')]=_[_0x6c32('0x44')](_0x3dafba[_0x6c32('0x3f')],qs[_0x6c32('0x46')](_0xca56b3['query'][_0x6c32('0x46')]));_0x1002b9['attributes']=_0x1002b9[_0x6c32('0x45')][_0x6c32('0x47')]?_0x1002b9[_0x6c32('0x45')]:_0x3dafba[_0x6c32('0x3f')];if(!_0xca56b3['query'][_0x6c32('0x48')](_0x6c32('0x49'))){_0x1002b9[_0x6c32('0x2e')]=qs[_0x6c32('0x2e')](_0xca56b3['query'][_0x6c32('0x2e')]);_0x1002b9['offset']=qs['offset'](_0xca56b3[_0x6c32('0x41')]['offset']);}_0x1002b9[_0x6c32('0x4a')]=qs[_0x6c32('0x4b')](_0xca56b3[_0x6c32('0x41')][_0x6c32('0x4b')]);_0x1002b9[_0x6c32('0x4c')]=qs['filters'](_['pick'](_0xca56b3[_0x6c32('0x41')],_0x3dafba[_0x6c32('0x43')]));_0x1002b9['where'][_0x6c32('0x65')]=_0x17ed04['id'];if(_0xca56b3[_0x6c32('0x41')]['filter']){_0x1002b9['where']=_[_0x6c32('0x4f')](_0x1002b9['where'],{'$or':_[_0x6c32('0x40')](_0x1002b9[_0x6c32('0x45')],function(_0x1533ea){var _0x278220={};_0x278220[_0x1533ea]={'$like':'%'+_0xca56b3[_0x6c32('0x41')]['filter']+'%'};return _0x278220;})});}_0x1002b9=_[_0x6c32('0x4f')]({},_0x1002b9,_0xca56b3[_0x6c32('0x51')]);return db[_0x6c32('0x66')][_0x6c32('0x2d')]({'where':_0x1002b9[_0x6c32('0x4c')]})[_0x6c32('0x1d')](function(_0x5e60e2){_0x1a389d[_0x6c32('0x2d')]=_0x5e60e2;if(_0xca56b3[_0x6c32('0x41')][_0x6c32('0x52')]){_0x1002b9[_0x6c32('0x53')]=[{'all':!![]}];}return db[_0x6c32('0x66')]['findAll'](_0x1002b9);})[_0x6c32('0x1d')](function(_0x54711b){_0x1a389d[_0x6c32('0x54')]=_0x54711b;return _0x1a389d;});}})[_0x6c32('0x1d')](respondWithFilteredResult(_0x827aeb,_0x1002b9))['catch'](handleError(_0x827aeb,null));};exports['removeDispositions']=function(_0xf52f79,_0x18cbc5,_0x52fb16){return db['WhatsappAccount'][_0x6c32('0x5b')]({'where':{'id':_0xf52f79[_0x6c32('0x57')]['id']}})['then'](handleEntityNotFound(_0x18cbc5,null))[_0x6c32('0x1d')](function(_0x3ca19f){if(_0x3ca19f){return _0x3ca19f[_0x6c32('0x67')](_0xf52f79['query']['ids']);}})[_0x6c32('0x1d')](respondWithStatusCode(_0x18cbc5,null))['catch'](handleError(_0x18cbc5,null));};exports[_0x6c32('0x68')]=function(_0x966978,_0x351d95,_0x5d91c6){if(_0x966978[_0x6c32('0x63')]['id']){delete _0x966978[_0x6c32('0x63')]['id'];}return db[_0x6c32('0x5a')]['find']({'where':{'id':_0x966978[_0x6c32('0x57')]['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x351d95,null))[_0x6c32('0x1d')](function(_0x4e28dc){if(_0x4e28dc){_0x966978['body']['WhatsappAccountId']=_0x4e28dc['id'];return db[_0x6c32('0x69')][_0x6c32('0x5c')](_0x966978[_0x6c32('0x63')]);}})['then'](respondWithResult(_0x351d95,null))[_0x6c32('0x55')](handleError(_0x351d95,null));};exports[_0x6c32('0x6a')]=function(_0x43ac72,_0x174c76,_0x3f65d6){var _0x30b9b3={'raw':![],'where':{}};var _0x70367b={};var _0x75b240={'count':0x0,'rows':[]};return db[_0x6c32('0x5a')][_0x6c32('0x6b')]({'where':{'id':_0x43ac72[_0x6c32('0x57')]['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x174c76,null))[_0x6c32('0x1d')](function(_0xb2cfe3){if(_0xb2cfe3){_0x70367b['model']=_[_0x6c32('0x42')](db[_0x6c32('0x69')][_0x6c32('0x3c')]);_0x70367b[_0x6c32('0x41')]=_[_0x6c32('0x42')](_0x43ac72['query']);_0x70367b[_0x6c32('0x43')]=_[_0x6c32('0x44')](_0x70367b[_0x6c32('0x3f')],_0x70367b[_0x6c32('0x41')]);_0x30b9b3['attributes']=_[_0x6c32('0x44')](_0x70367b['model'],qs['fields'](_0x43ac72['query'][_0x6c32('0x46')]));_0x30b9b3['attributes']=_0x30b9b3[_0x6c32('0x45')]['length']?_0x30b9b3[_0x6c32('0x45')]:_0x70367b[_0x6c32('0x3f')];if(!_0x43ac72['query']['hasOwnProperty'](_0x6c32('0x49'))){_0x30b9b3[_0x6c32('0x2e')]=qs[_0x6c32('0x2e')](_0x43ac72[_0x6c32('0x41')]['limit']);_0x30b9b3[_0x6c32('0x2b')]=qs[_0x6c32('0x2b')](_0x43ac72[_0x6c32('0x41')][_0x6c32('0x2b')]);}_0x30b9b3[_0x6c32('0x4a')]=qs[_0x6c32('0x4b')](_0x43ac72[_0x6c32('0x41')][_0x6c32('0x4b')]);_0x30b9b3['where']=qs['filters'](_[_0x6c32('0x4d')](_0x43ac72[_0x6c32('0x41')],_0x70367b['filters']));_0x30b9b3[_0x6c32('0x4c')]['WhatsappAccountId']=_0xb2cfe3['id'];if(_0x43ac72[_0x6c32('0x41')]['filter']){_0x30b9b3[_0x6c32('0x4c')]=_[_0x6c32('0x4f')](_0x30b9b3[_0x6c32('0x4c')],{'$or':_['map'](_0x30b9b3[_0x6c32('0x45')],function(_0x2bf866){var _0x51304d={};_0x51304d[_0x2bf866]={'$like':'%'+_0x43ac72['query'][_0x6c32('0x4e')]+'%'};return _0x51304d;})});}_0x30b9b3=_['merge']({},_0x30b9b3,_0x43ac72['options']);return db[_0x6c32('0x69')][_0x6c32('0x2d')]({'where':_0x30b9b3[_0x6c32('0x4c')]})[_0x6c32('0x1d')](function(_0x244dae){_0x75b240[_0x6c32('0x2d')]=_0x244dae;if(_0x43ac72[_0x6c32('0x41')]['includeAll']){_0x30b9b3['include']=[{'all':!![]}];}return db[_0x6c32('0x69')][_0x6c32('0x6c')](_0x30b9b3);})[_0x6c32('0x1d')](function(_0x52b797){_0x75b240[_0x6c32('0x54')]=_0x52b797;return _0x75b240;});}})[_0x6c32('0x1d')](respondWithFilteredResult(_0x174c76,_0x30b9b3))[_0x6c32('0x55')](handleError(_0x174c76,null));};exports['removeAnswers']=function(_0x5ce98d,_0x77f508,_0x3204c0){return db['WhatsappAccount'][_0x6c32('0x5b')]({'where':{'id':_0x5ce98d[_0x6c32('0x57')]['id']}})['then'](handleEntityNotFound(_0x77f508,null))['then'](function(_0x572b7a){if(_0x572b7a){return _0x572b7a[_0x6c32('0x6d')](_0x5ce98d['query'][_0x6c32('0x6e')]);}})[_0x6c32('0x1d')](respondWithStatusCode(_0x77f508,null))[_0x6c32('0x55')](handleError(_0x77f508,null));};exports['addAgents']=function(_0x1622b4,_0x10c764,_0x36bb9c){return db[_0x6c32('0x5a')][_0x6c32('0x5b')]({'where':{'id':_0x1622b4[_0x6c32('0x57')]['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x10c764,null))['then'](function(_0x3d884e){if(_0x3d884e){return _0x3d884e[_0x6c32('0x6f')](_0x1622b4[_0x6c32('0x63')][_0x6c32('0x6e')],_[_0x6c32('0x70')](_0x1622b4[_0x6c32('0x63')],[_0x6c32('0x6e'),'id'])||{})['spread'](function(_0xe99957){for(var _0x27a8b1=0x0;_0x27a8b1<_0x1622b4[_0x6c32('0x63')][_0x6c32('0x6e')][_0x6c32('0x47')];_0x27a8b1+=0x1){socket[_0x6c32('0x71')](_0x6c32('0x72'),{'UserId':Number(_0x1622b4[_0x6c32('0x63')][_0x6c32('0x6e')][_0x27a8b1]),'WhatsappAccountId':Number(_0x1622b4[_0x6c32('0x57')]['id'])});}return _0xe99957;});}})[_0x6c32('0x1d')](respondWithResult(_0x10c764,null))['catch'](handleError(_0x10c764,null));};exports[_0x6c32('0x73')]=function(_0x4e2f19,_0x484e07,_0x4d7e4e){return db[_0x6c32('0x5a')]['find']({'where':{'id':_0x4e2f19[_0x6c32('0x57')]['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x484e07,null))['then'](function(_0x38b01a){if(_0x38b01a){return _0x38b01a[_0x6c32('0x73')](_0x4e2f19[_0x6c32('0x41')]['ids'])[_0x6c32('0x1d')](function(){if(_[_0x6c32('0x74')](_0x4e2f19[_0x6c32('0x41')][_0x6c32('0x6e')])){for(var _0x124f04=0x0;_0x124f04<_0x4e2f19[_0x6c32('0x41')][_0x6c32('0x6e')]['length'];_0x124f04+=0x1){socket[_0x6c32('0x71')](_0x6c32('0x75'),{'UserId':Number(_0x4e2f19['query']['ids'][_0x124f04]),'WhatsappAccountId':Number(_0x4e2f19[_0x6c32('0x57')]['id'])});}}else{socket['emit']('userWhatsappAccount:remove',{'UserId':Number(_0x4e2f19[_0x6c32('0x41')][_0x6c32('0x6e')]),'WhatsappAccountId':Number(_0x4e2f19[_0x6c32('0x57')]['id'])});}});}})[_0x6c32('0x1d')](respondWithStatusCode(_0x484e07,null))['catch'](handleError(_0x484e07,null));};exports[_0x6c32('0x76')]=function(_0x1ccf4d,_0x2c84fc,_0x3e0ce8){var _0x27e7fc={};var _0x584853={};var _0x2fea07;var _0x1dcd0f;return db[_0x6c32('0x5a')][_0x6c32('0x6b')]({'where':{'id':_0x1ccf4d[_0x6c32('0x57')]['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x2c84fc,null))[_0x6c32('0x1d')](function(_0x244723){if(_0x244723){_0x2fea07=_0x244723;_0x584853['model']=_[_0x6c32('0x42')](db[_0x6c32('0x77')][_0x6c32('0x3c')]);_0x584853[_0x6c32('0x41')]=_['keys'](_0x1ccf4d[_0x6c32('0x41')]);_0x584853['filters']=_[_0x6c32('0x44')](_0x584853[_0x6c32('0x3f')],_0x584853['query']);_0x27e7fc[_0x6c32('0x45')]=_[_0x6c32('0x44')](_0x584853[_0x6c32('0x3f')],qs[_0x6c32('0x46')](_0x1ccf4d[_0x6c32('0x41')][_0x6c32('0x46')]));_0x27e7fc[_0x6c32('0x45')]=_0x27e7fc[_0x6c32('0x45')]['length']?_0x27e7fc[_0x6c32('0x45')]:_0x584853['model'];_0x27e7fc[_0x6c32('0x4a')]=qs[_0x6c32('0x4b')](_0x1ccf4d['query'][_0x6c32('0x4b')]);_0x27e7fc[_0x6c32('0x4c')]=qs[_0x6c32('0x43')](_[_0x6c32('0x4d')](_0x1ccf4d[_0x6c32('0x41')],_0x584853[_0x6c32('0x43')]));if(_0x1ccf4d[_0x6c32('0x41')][_0x6c32('0x4e')]){_0x27e7fc[_0x6c32('0x4c')]=_[_0x6c32('0x4f')](_0x27e7fc[_0x6c32('0x4c')],{'$or':_[_0x6c32('0x40')](_0x27e7fc[_0x6c32('0x45')],function(_0x358c74){var _0x432fb0={};_0x432fb0[_0x358c74]={'$like':'%'+_0x1ccf4d['query'][_0x6c32('0x4e')]+'%'};return _0x432fb0;})});}_0x27e7fc=_[_0x6c32('0x4f')]({},_0x27e7fc,_0x1ccf4d['options']);return _0x2fea07['getAgents'](_0x27e7fc);}})[_0x6c32('0x1d')](function(_0x113243){if(_0x113243){_0x1dcd0f=_0x113243[_0x6c32('0x47')];if(!_0x1ccf4d[_0x6c32('0x41')][_0x6c32('0x48')]('nolimit')){_0x27e7fc['limit']=qs['limit'](_0x1ccf4d['query'][_0x6c32('0x2e')]);_0x27e7fc[_0x6c32('0x2b')]=qs['offset'](_0x1ccf4d['query'][_0x6c32('0x2b')]);}return _0x2fea07[_0x6c32('0x76')](_0x27e7fc);}})[_0x6c32('0x1d')](function(_0x56b87b){if(_0x56b87b){return _0x56b87b?{'count':_0x1dcd0f,'rows':_0x56b87b}:null;}})['then'](respondWithResult(_0x2c84fc,null))[_0x6c32('0x55')](handleError(_0x2c84fc,null));};exports[_0x6c32('0x78')]=function(_0x3d9cfb,_0x5b85ce,_0x40baed){return db['WhatsappAccount'][_0x6c32('0x6b')]({'where':{'id':_0x3d9cfb['params']['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x5b85ce,null))[_0x6c32('0x1d')](function(_0x5297e3){if(_0x5297e3){return db[_0x6c32('0x79')][_0x6c32('0x7a')](function(_0x16d445){return db[_0x6c32('0x7b')][_0x6c32('0x34')]({'where':{'WhatsappAccountId':_0x3d9cfb[_0x6c32('0x57')]['id']},'transaction':_0x16d445})[_0x6c32('0x1d')](function(_0x53159a){var _0x550528=_[_0x6c32('0x40')](_0x3d9cfb[_0x6c32('0x63')],function(_0x224cba){_0x224cba[_0x6c32('0x65')]=_0x3d9cfb['params']['id'];return _0x224cba;});return db[_0x6c32('0x7b')]['bulkCreate'](_0x550528,{'transaction':_0x16d445});});})[_0x6c32('0x1d')](function(){return db[_0x6c32('0x7b')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x3d9cfb[_0x6c32('0x57')]['id']},'order':'priority'});});}})['then'](respondWithResult(_0x5b85ce,null))[_0x6c32('0x55')](handleError(_0x5b85ce,null));};exports[_0x6c32('0x7c')]=function(_0x1a659b,_0x27354f,_0x2127ee){var _0x3aab09={};var _0x577d70={};var _0x414e4d;var _0x4fa2ff;return db[_0x6c32('0x5a')][_0x6c32('0x6b')]({'where':{'id':_0x1a659b['params']['id']}})[_0x6c32('0x1d')](handleEntityNotFound(_0x27354f,null))[_0x6c32('0x1d')](function(_0x3aea01){if(_0x3aea01){_0x414e4d=_0x3aea01;_0x577d70[_0x6c32('0x3f')]=_['keys'](db['WhatsappApplication']['rawAttributes']);_0x577d70[_0x6c32('0x41')]=_[_0x6c32('0x42')](_0x1a659b[_0x6c32('0x41')]);_0x577d70[_0x6c32('0x43')]=_[_0x6c32('0x44')](_0x577d70[_0x6c32('0x3f')],_0x577d70[_0x6c32('0x41')]);_0x3aab09['attributes']=_[_0x6c32('0x44')](_0x577d70['model'],qs[_0x6c32('0x46')](_0x1a659b[_0x6c32('0x41')]['fields']));_0x3aab09['attributes']=_0x3aab09[_0x6c32('0x45')][_0x6c32('0x47')]?_0x3aab09['attributes']:_0x577d70[_0x6c32('0x3f')];_0x3aab09[_0x6c32('0x4a')]=qs[_0x6c32('0x4b')](_0x1a659b[_0x6c32('0x41')]['sort']);_0x3aab09[_0x6c32('0x4c')]=qs['filters'](_['pick'](_0x1a659b[_0x6c32('0x41')],_0x577d70[_0x6c32('0x43')]));if(_0x1a659b[_0x6c32('0x41')][_0x6c32('0x4e')]){_0x3aab09['where']=_[_0x6c32('0x4f')](_0x3aab09[_0x6c32('0x4c')],{'$or':_[_0x6c32('0x40')](_0x3aab09['attributes'],function(_0x222154){var _0x7d131f={};_0x7d131f[_0x222154]={'$like':'%'+_0x1a659b[_0x6c32('0x41')][_0x6c32('0x4e')]+'%'};return _0x7d131f;})});}_0x3aab09=_[_0x6c32('0x4f')]({},_0x3aab09,_0x1a659b[_0x6c32('0x51')]);return _0x414e4d[_0x6c32('0x7c')](_0x3aab09);}})[_0x6c32('0x1d')](function(_0x589aa4){if(_0x589aa4){_0x4fa2ff=_0x589aa4[_0x6c32('0x47')];if(!_0x1a659b['query'][_0x6c32('0x48')](_0x6c32('0x49'))){_0x3aab09[_0x6c32('0x2e')]=qs[_0x6c32('0x2e')](_0x1a659b['query']['limit']);_0x3aab09[_0x6c32('0x2b')]=qs['offset'](_0x1a659b[_0x6c32('0x41')][_0x6c32('0x2b')]);}return _0x414e4d['getApplications'](_0x3aab09);}})[_0x6c32('0x1d')](function(_0x3afd03){if(_0x3afd03){return _0x3afd03?{'count':_0x4fa2ff,'rows':_0x3afd03}:null;}})[_0x6c32('0x1d')](respondWithResult(_0x27354f,null))[_0x6c32('0x55')](handleError(_0x27354f,null));};exports[_0x6c32('0x7d')]=function(_0x4a6108,_0x3594df,_0x8824dd){var _0x132a0a={'channel':_0x6c32('0x7e')};var _0x9e4ad9=[];var _0x361b54=[];var _0x361cbb={};return db[_0x6c32('0x5a')]['find']({'where':{'id':_0x4a6108[_0x6c32('0x57')]['id']},'include':[{'model':db['WhatsappApplication'],'as':_0x6c32('0x7f')}]})[_0x6c32('0x1d')](handleEntityNotFound(_0x3594df,null))['then'](function(_0x5d7c4e){_0x132a0a[_0x6c32('0x80')]=_0x5d7c4e;_0x132a0a[_0x6c32('0x81')]=_[_0x6c32('0x82')](_0x5d7c4e['Applications'],[_0x6c32('0x83')],[_0x6c32('0x84')]);if(_0x132a0a[_0x6c32('0x80')][_0x6c32('0x7f')]){delete _0x132a0a[_0x6c32('0x80')]['Applications'];}return db[_0x6c32('0x85')][_0x6c32('0x64')]();})['then'](function(_0x52fb08){if(!_0x52fb08){throw new db['Sequelize'][(_0x6c32('0x86'))](_0x6c32('0x87'));}_0x9e4ad9=_[_0x6c32('0x88')](_[_0x6c32('0x42')](_0x52fb08),[_0x6c32('0x89'),_0x6c32('0x8a')]);_0x361b54=_[_0x6c32('0x88')](_[_0x6c32('0x42')](_0x52fb08),[_0x6c32('0x89'),_0x6c32('0x8a'),'CompanyId',_0x6c32('0x8b')]);_0x132a0a[_0x6c32('0x63')]={'mapKey':_0x6c32('0x8c')};if(_0x132a0a['account'][_0x6c32('0x50')]&&_0x132a0a['account'][_0x6c32('0x50')]===_0x6c32('0x8d')){_0x132a0a['body']['from']=_0x4a6108[_0x6c32('0x63')][_0x6c32('0x8e')]['replace'](_0x6c32('0x8f'),'');_0x132a0a[_0x6c32('0x63')][_0x6c32('0x63')]=_0x4a6108[_0x6c32('0x63')][_0x6c32('0x90')];_0x132a0a[_0x6c32('0x63')][_0x6c32('0x91')]=_0x4a6108[_0x6c32('0x63')][_0x6c32('0x92')];}if(_0x132a0a[_0x6c32('0x63')]['id']){delete _0x132a0a[_0x6c32('0x63')]['id'];}if(_[_0x6c32('0x93')](_0x132a0a[_0x6c32('0x63')]['from'])){throw new db['Sequelize']['ValidationError'](_0x6c32('0x94'));}if(_[_0x6c32('0x93')](_0x132a0a[_0x6c32('0x63')]['body'])||_0x132a0a['body']['body']===''){throw new db[(_0x6c32('0x95'))][(_0x6c32('0x86'))](_0x6c32('0x96'));}if(_[_0x6c32('0x93')](_0x132a0a[_0x6c32('0x63')]['mapKey'])){throw new db[(_0x6c32('0x95'))][(_0x6c32('0x86'))](_0x6c32('0x97')+_0x361b54);}if(!_[_0x6c32('0x98')](_0x361b54,_0x132a0a[_0x6c32('0x63')][_0x6c32('0x99')])){throw new db[(_0x6c32('0x95'))][(_0x6c32('0x86'))](_0x6c32('0x9a')+_0x361b54);}_0x361cbb[_0x132a0a[_0x6c32('0x63')]['mapKey']]=_0x132a0a['body'][_0x6c32('0x9b')];return db[_0x6c32('0x9c')]['find']({'where':{'id':_0x132a0a[_0x6c32('0x80')]['ListId']},'include':[{'model':db[_0x6c32('0x85')],'as':_0x6c32('0x9d'),'where':_0x361cbb,'limit':0x1,'order':[['updatedAt',_0x6c32('0x9e')]]}]});})[_0x6c32('0x1d')](handleEntityNotFound(_0x3594df,null))[_0x6c32('0x1d')](function(_0x3c0110){if(_0x3c0110){_0x132a0a[_0x6c32('0x9f')]=_[_0x6c32('0x70')](_0x3c0110,[_0x6c32('0x9d')]);if(_0x3c0110['Contacts'][_0x6c32('0x47')]){return _0x3c0110[_0x6c32('0x9d')][0x0];}var _0x2b6f5f=_[_0x6c32('0xa0')](_0x132a0a['body'],{'firstName':_0x132a0a['body'][_0x6c32('0x9b')],'ListId':_0x3c0110['id']});_0x2b6f5f[_0x132a0a[_0x6c32('0x63')][_0x6c32('0x99')]]=_0x132a0a['body'][_0x6c32('0x9b')];return db['CmContact']['create'](_0x2b6f5f,{'fields':_0x9e4ad9,'raw':!![]});}})[_0x6c32('0x1d')](handleEntityNotFound(_0x3594df,null))[_0x6c32('0x1d')](function(_0x10591e){if(_0x10591e){_0x132a0a[_0x6c32('0xa1')]=_0x10591e;var _0x1e8982={'ContactId':_0x10591e['id'],'phone':_0x132a0a[_0x6c32('0x63')][_0x6c32('0x9b')],'WhatsappAccountId':_0x4a6108[_0x6c32('0x57')]['id']};var _0x308d92={'ContactId':_0x10591e['id'],'WhatsappAccountId':_0x4a6108[_0x6c32('0x57')]['id'],'closed':![]};return db[_0x6c32('0xa2')][_0x6c32('0x5b')]({'where':_0x308d92})[_0x6c32('0x1d')](function(_0x2bef3c){if(_0x2bef3c){return[_0x2bef3c,![]];}return db[_0x6c32('0xa2')][_0x6c32('0x5c')](_0x1e8982)[_0x6c32('0x1d')](function(_0x29a6f9){return[_0x29a6f9,!![]];});});}})['spread'](function(_0x895190,_0x5b1c17){_0x132a0a[_0x6c32('0xa3')]=_0x895190[_0x6c32('0x35')]({'plain':!![]});_0x132a0a[_0x6c32('0xa3')][_0x6c32('0xa4')]=![];if(_0x5b1c17){if(_0x132a0a['account'][_0x6c32('0xa5')]){_0x132a0a[_0x6c32('0x81')]['push']({'id':0x0,'priority':_0x132a0a[_0x6c32('0x81')]['length']+0x1,'app':_0x6c32('0xa6'),'appdata':_0x6c32('0xa7'),'interval':_0x6c32('0xa8')});}_0x132a0a[_0x6c32('0xa3')]['created']=!![];}return db[_0x6c32('0xa9')][_0x6c32('0x5c')]({'phone':_0x132a0a[_0x6c32('0x63')][_0x6c32('0x9b')],'messageId':_0x132a0a['body'][_0x6c32('0x91')],'body':_0x132a0a['body']['body'],'WhatsappAccountId':_0x4a6108[_0x6c32('0x57')]['id'],'WhatsappInteractionId':_0x895190['id'],'direction':'in','ContactId':_0x895190[_0x6c32('0xaa')],'AttachmentId':_0x132a0a[_0x6c32('0x63')]['AttachmentId']});})[_0x6c32('0x1d')](function(_0x4c52ef){_0x132a0a[_0x6c32('0x26')]=_0x4c52ef;if(_0x132a0a['interaction'][_0x6c32('0xab')]){return db[_0x6c32('0x77')][_0x6c32('0x5b')]({'attributes':['id','name'],'where':{'id':_0x132a0a['interaction']['UserId']}})[_0x6c32('0x1d')](function(_0x35e893){if(_0x35e893){_0x132a0a[_0x6c32('0x81')][_0x6c32('0xac')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x35e893[_0x6c32('0x3a')]+','+(_0x132a0a[_0x6c32('0x80')][_0x6c32('0xad')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x6c32('0xae'),_0x6c32('0xaf'),_0x132a0a);});}return respondWithRpcPromise('Start',_0x6c32('0xaf'),_0x132a0a);})[_0x6c32('0x1d')](function(_0x3f6fba){if(_0x3f6fba){var _0x205fba=0xc8;var _0x4cc7de=_0x6c32('0xb0');logger[_0x6c32('0x1e')](_0x6c32('0x22'),_0x4cc7de,_0x205fba,_0x6c32('0xb1'));logger[_0x6c32('0x21')](_0x6c32('0xb2'),_0x4cc7de,_0x205fba,_0x6c32('0xb1'),JSON['stringify'](_0x3f6fba));if(_0x132a0a[_0x6c32('0x80')]['type']===_0x6c32('0x8d')){return _0x3594df['status'](_0x205fba)['set'](_0x6c32('0xb3'),_0x6c32('0xb4'))[_0x6c32('0x3b')](_0x6c32('0xb5'));}else{return _0x3594df[_0x6c32('0x29')](_0x205fba)['json'](_0x3f6fba);}}})[_0x6c32('0x55')](handleError(_0x3594df,null));};exports[_0x6c32('0x3b')]=function(_0x270516,_0xc9b69f,_0x47852c){var _0x41ce80,_0x11c3a1,_0x447684;if(_[_0x6c32('0x93')](_0x270516[_0x6c32('0x63')][_0x6c32('0x63')])||_0x270516[_0x6c32('0x63')][_0x6c32('0x63')]===''){throw new db[(_0x6c32('0x95'))][(_0x6c32('0x86'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x270516[_0x6c32('0x63')]['to'])){throw new db[(_0x6c32('0x95'))][(_0x6c32('0x86'))]('to\x20is\x20mandatory');}_0x41ce80=_0x270516[_0x6c32('0x63')]['to'];return db[_0x6c32('0x5a')][_0x6c32('0x5b')]({'where':{'id':_0x270516[_0x6c32('0x57')]['id']},'include':[{'model':db[_0x6c32('0x9c')],'as':_0x6c32('0xb6'),'include':[{'model':db[_0x6c32('0x85')],'as':_0x6c32('0x9d'),'where':{'mobile':_0x41ce80},'limit':0x1,'order':[[_0x6c32('0x8a'),_0x6c32('0x9e')]]}]}]})['then'](handleEntityNotFound(_0xc9b69f,null))[_0x6c32('0x1d')](function(_0x394048){if(_0x394048&&_0x394048[_0x6c32('0xb6')]){_0x11c3a1=_0x394048[_0x6c32('0x35')]({'plain':!![]});if(_0x11c3a1[_0x6c32('0xb6')]&&_0x11c3a1[_0x6c32('0xb6')][_0x6c32('0x9d')][_0x6c32('0x47')]){return _0x11c3a1[_0x6c32('0xb6')][_0x6c32('0x9d')][0x0];}return db[_0x6c32('0x85')][_0x6c32('0x5c')](_['defaults'](_0x270516[_0x6c32('0x63')],{'firstName':_0x41ce80,'mobile':_0x41ce80,'phone':_0x41ce80,'ListId':_0x11c3a1['ListId']}));}})[_0x6c32('0x1d')](handleEntityNotFound(_0xc9b69f,null))[_0x6c32('0x1d')](function(_0x43873f){if(_0x43873f){_0x447684=_0x43873f;return db[_0x6c32('0xa2')][_0x6c32('0x5b')]({'where':{'ContactId':_0x447684['id'],'closed':![],'WhatsappAccountId':_0x11c3a1['id']}})[_0x6c32('0x1d')](function(_0x40d0da){if(_0x40d0da){return[_0x40d0da,![]];}return db[_0x6c32('0xa2')]['create']({'UserId':_0x270516[_0x6c32('0x5d')]['id'],'ContactId':_0x447684['id'],'WhatsappAccountId':_0x11c3a1['id'],'phone':_0x41ce80,'firstMsgDirection':_0x6c32('0xb7'),'Messages':[_[_0x6c32('0x4f')](_0x270516[_0x6c32('0x63')],{'read':![],'body':_0x270516[_0x6c32('0x63')][_0x6c32('0x63')],'phone':_0x41ce80,'WhatsappAccountId':_0x11c3a1['id'],'UserId':_0x270516[_0x6c32('0x5d')]['id'],'ContactId':_0x447684['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':'Messages'}]})[_0x6c32('0x1d')](function(_0x39a7c5){return[_0x39a7c5,!![]];});});}})[_0x6c32('0xb8')](function(_0xe70efd,_0x1e9ddc){if(_0x1e9ddc){return _0xe70efd;}return db[_0x6c32('0xa9')][_0x6c32('0x5c')](_[_0x6c32('0x4f')](_0x270516[_0x6c32('0x63')],{'read':![],'body':_0x270516[_0x6c32('0x63')][_0x6c32('0x63')],'phone':_0x41ce80,'WhatsappAccountId':_0x11c3a1['id'],'WhatsappInteractionId':_0xe70efd['id'],'UserId':_0x270516[_0x6c32('0x5d')]['id'],'ContactId':_0x447684['id']}))[_0x6c32('0x1d')](function(_0x1168c5){_0xe70efd['dataValues'][_0x6c32('0xb9')]=[];_0xe70efd[_0x6c32('0xba')][_0x6c32('0xb9')][_0x6c32('0xbb')](_0x1168c5[_0x6c32('0xba')]);return _0xe70efd;});})[_0x6c32('0x1d')](respondWithResult(_0xc9b69f,null))[_0x6c32('0x55')](handleError(_0xc9b69f,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index f8980ef..1802710 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 _0x4736=['events','../../mysqldb','WhatsappAccount','setMaxListeners','save','remove','emit','hasOwnProperty','exports'];(function(_0x1e0f06,_0x26aeca){var _0x2a1ebc=function(_0x589a4a){while(--_0x589a4a){_0x1e0f06['push'](_0x1e0f06['shift']());}};_0x2a1ebc(++_0x26aeca);}(_0x4736,0x1a7));var _0x6473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4736[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x6473('0x0'));var WhatsappAccount=require(_0x6473('0x1'))['db'][_0x6473('0x2')];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x6473('0x3')](0x0);var events={'afterCreate':_0x6473('0x4'),'afterUpdate':'update','afterDestroy':_0x6473('0x5')};function emitEvent(_0x997227){return function(_0x2fd26b,_0x538172,_0x4eb725){WhatsappAccountEvents[_0x6473('0x6')](_0x997227+':'+_0x2fd26b['id'],_0x2fd26b);WhatsappAccountEvents[_0x6473('0x6')](_0x997227,_0x2fd26b);_0x4eb725(null);};}for(var e in events){if(events[_0x6473('0x7')](e)){var event=events[e];WhatsappAccount['hook'](e,emitEvent(event));}}module[_0x6473('0x8')]=WhatsappAccountEvents; \ No newline at end of file +var _0xd40c=['exports','events','setMaxListeners','emit','hook'];(function(_0x294cb0,_0x243b87){var _0x1836f1=function(_0x2ccc5f){while(--_0x2ccc5f){_0x294cb0['push'](_0x294cb0['shift']());}};_0x1836f1(++_0x243b87);}(_0xd40c,0xb0));var _0xcd40=function(_0x4eafe0,_0x1624c3){_0x4eafe0=_0x4eafe0-0x0;var _0x2f1a3b=_0xd40c[_0x4eafe0];return _0x2f1a3b;};'use strict';var EventEmitter=require(_0xcd40('0x0'));var WhatsappAccount=require('../../mysqldb')['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0xcd40('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1a16f0){return function(_0x24687d,_0x4bc4fd,_0x2c8612){WhatsappAccountEvents[_0xcd40('0x2')](_0x1a16f0+':'+_0x24687d['id'],_0x24687d);WhatsappAccountEvents[_0xcd40('0x2')](_0x1a16f0,_0x24687d);_0x2c8612(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0xcd40('0x3')](e,emitEvent(event));}}module[_0xcd40('0x4')]=WhatsappAccountEvents; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.model.js b/server/api/whatsappAccount/whatsappAccount.model.js index f6c9a65..99bc79a 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 _0xfa87=['moment','bluebird','request-promise','path','../../config/environment','./whatsappAccount.attributes','whatsapp_accounts','lodash','util','../../config/logger'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0xfa87,0x1a1));var _0x7fa8=function(_0x5c27b6,_0x4a3c28){_0x5c27b6=_0x5c27b6-0x0;var _0x284ce4=_0xfa87[_0x5c27b6];return _0x284ce4;};'use strict';var _=require(_0x7fa8('0x0'));var util=require(_0x7fa8('0x1'));var logger=require(_0x7fa8('0x2'))('api');var moment=require(_0x7fa8('0x3'));var BPromise=require(_0x7fa8('0x4'));var rp=require(_0x7fa8('0x5'));var fs=require('fs');var path=require(_0x7fa8('0x6'));var rimraf=require('rimraf');var config=require(_0x7fa8('0x7'));var attributes=require(_0x7fa8('0x8'));module['exports']=function(_0x3743d1,_0x287fb5){return _0x3743d1['define']('WhatsappAccount',attributes,{'tableName':_0x7fa8('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7df7=['define','WhatsappAccount','whatsapp_accounts','lodash','../../config/logger','api','moment','request-promise','path','../../config/environment','./whatsappAccount.attributes','exports'];(function(_0x535463,_0x586188){var _0x3877b7=function(_0x54d722){while(--_0x54d722){_0x535463['push'](_0x535463['shift']());}};_0x3877b7(++_0x586188);}(_0x7df7,0x87));var _0x77df=function(_0x14b748,_0x598b8b){_0x14b748=_0x14b748-0x0;var _0x3c351c=_0x7df7[_0x14b748];return _0x3c351c;};'use strict';var _=require(_0x77df('0x0'));var util=require('util');var logger=require(_0x77df('0x1'))(_0x77df('0x2'));var moment=require(_0x77df('0x3'));var BPromise=require('bluebird');var rp=require(_0x77df('0x4'));var fs=require('fs');var path=require(_0x77df('0x5'));var rimraf=require('rimraf');var config=require(_0x77df('0x6'));var attributes=require(_0x77df('0x7'));module[_0x77df('0x8')]=function(_0x4b7b65,_0x4f7eeb){return _0x4b7b65[_0x77df('0x9')](_0x77df('0xa'),attributes,{'tableName':_0x77df('0xb'),'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 290853c..9d1c486 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 _0x5797=['WhatsappAccount,\x20%s,\x20%s','request\x20sent','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','where','attributes','include','map','model','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','request','info'];(function(_0x562d36,_0x50e8b3){var _0xf58429=function(_0x510f76){while(--_0x510f76){_0x562d36['push'](_0x562d36['shift']());}};_0xf58429(++_0x50e8b3);}(_0x5797,0x89));var _0x7579=function(_0x11005e,_0x20c3d2){_0x11005e=_0x11005e-0x0;var _0x29338f=_0x5797[_0x11005e];return _0x29338f;};'use strict';var _=require(_0x7579('0x0'));var util=require(_0x7579('0x1'));var moment=require(_0x7579('0x2'));var BPromise=require(_0x7579('0x3'));var rs=require(_0x7579('0x4'));var fs=require('fs');var Redis=require(_0x7579('0x5'));var db=require(_0x7579('0x6'))['db'];var utils=require(_0x7579('0x7'));var logger=require(_0x7579('0x8'))('rpc');var config=require(_0x7579('0x9'));var jayson=require(_0x7579('0xa'));var client=jayson[_0x7579('0xb')][_0x7579('0xc')]({'port':0x232a});config['redis']=_[_0x7579('0xd')](config[_0x7579('0xe')],{'host':_0x7579('0xf'),'port':0x18eb});var socket=require(_0x7579('0x10'))(new Redis(config[_0x7579('0xe')]));require('./whatsappAccount.socket')['register'](socket);function respondWithRpcPromise(_0xa09342,_0x4ffa76,_0x10f6ec){return new BPromise(function(_0x5237ab,_0x65e972){return client[_0x7579('0x11')](_0xa09342,_0x10f6ec)['then'](function(_0x51a600){logger[_0x7579('0x12')](_0x7579('0x13'),_0x4ffa76,_0x7579('0x14'));logger[_0x7579('0x15')](_0x7579('0x16'),_0x4ffa76,_0x7579('0x14'),JSON[_0x7579('0x17')](_0x51a600));if(_0x51a600[_0x7579('0x18')]){if(_0x51a600[_0x7579('0x18')][_0x7579('0x19')]===0x1f4){logger[_0x7579('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x4ffa76,_0x51a600['error'][_0x7579('0x1a')]);return _0x65e972(_0x51a600[_0x7579('0x18')][_0x7579('0x1a')]);}logger[_0x7579('0x18')]('WhatsappAccount,\x20%s,\x20%s',_0x4ffa76,_0x51a600[_0x7579('0x18')][_0x7579('0x1a')]);return _0x5237ab(_0x51a600[_0x7579('0x18')][_0x7579('0x1a')]);}else{logger[_0x7579('0x12')](_0x7579('0x13'),_0x4ffa76,'request\x20sent');_0x5237ab(_0x51a600[_0x7579('0x1b')][_0x7579('0x1a')]);}})[_0x7579('0x1c')](function(_0x43521f){logger[_0x7579('0x18')](_0x7579('0x13'),_0x4ffa76,_0x43521f);_0x65e972(_0x43521f);});});}exports[_0x7579('0x1d')]=function(_0x338905){var _0xfbe863=this;return new Promise(function(_0x50c616,_0x52735a){return db[_0x7579('0x1e')][_0x7579('0x1f')]({'raw':_0x338905[_0x7579('0x20')]?_0x338905[_0x7579('0x20')]['raw']===undefined?!![]:![]:!![],'where':_0x338905[_0x7579('0x20')]?_0x338905[_0x7579('0x20')][_0x7579('0x21')]||null:null,'attributes':_0x338905[_0x7579('0x20')]?_0x338905['options'][_0x7579('0x22')]||null:null,'include':_0x338905[_0x7579('0x20')]?_0x338905[_0x7579('0x20')][_0x7579('0x23')]?_[_0x7579('0x24')](_0x338905[_0x7579('0x20')][_0x7579('0x23')],function(_0x288375){return{'model':db[_0x288375[_0x7579('0x25')]],'as':_0x288375['as'],'attributes':_0x288375[_0x7579('0x22')],'include':_0x288375['include']?_[_0x7579('0x24')](_0x288375[_0x7579('0x23')],function(_0x1cde9a){return{'model':db[_0x1cde9a[_0x7579('0x25')]],'as':_0x1cde9a['as'],'attributes':_0x1cde9a[_0x7579('0x22')],'include':_0x1cde9a['include']?_[_0x7579('0x24')](_0x1cde9a['include'],function(_0x4d9d0c){return{'model':db[_0x4d9d0c[_0x7579('0x25')]],'as':_0x4d9d0c['as'],'attributes':_0x4d9d0c[_0x7579('0x22')]};}):[]};}):[]};}):[]:[]})[_0x7579('0x26')](function(_0x379ef9){logger[_0x7579('0x12')]('ShowWhatsappAccount',_0x338905);logger['debug']('ShowWhatsappAccount',_0x338905,JSON[_0x7579('0x17')](_0x379ef9));_0x50c616(_0x379ef9);})[_0x7579('0x1c')](function(_0x56cfab){logger[_0x7579('0x18')](_0x7579('0x1d'),_0x56cfab[_0x7579('0x1a')],_0x338905);_0x52735a(_0xfbe863[_0x7579('0x18')](0x1f4,_0x56cfab[_0x7579('0x1a')]));});});}; \ No newline at end of file +var _0x8ecd=['attributes','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','localhost','./whatsappAccount.socket','register','request','then','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','info','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','include','map'];(function(_0x13cb7e,_0x336d29){var _0x4bb919=function(_0x392309){while(--_0x392309){_0x13cb7e['push'](_0x13cb7e['shift']());}};_0x4bb919(++_0x336d29);}(_0x8ecd,0xf7));var _0xd8ec=function(_0x1b3463,_0x43e1f5){_0x1b3463=_0x1b3463-0x0;var _0x29d544=_0x8ecd[_0x1b3463];return _0x29d544;};'use strict';var _=require('lodash');var util=require(_0xd8ec('0x0'));var moment=require(_0xd8ec('0x1'));var BPromise=require(_0xd8ec('0x2'));var rs=require(_0xd8ec('0x3'));var fs=require('fs');var Redis=require(_0xd8ec('0x4'));var db=require(_0xd8ec('0x5'))['db'];var utils=require(_0xd8ec('0x6'));var logger=require(_0xd8ec('0x7'))('rpc');var config=require(_0xd8ec('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8ec('0x9')][_0xd8ec('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0xd8ec('0xb')],{'host':_0xd8ec('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xd8ec('0xb')]));require(_0xd8ec('0xd'))[_0xd8ec('0xe')](socket);function respondWithRpcPromise(_0x3c5f59,_0x43abb6,_0x1f4571){return new BPromise(function(_0x3792bc,_0x2da4f2){return client[_0xd8ec('0xf')](_0x3c5f59,_0x1f4571)[_0xd8ec('0x10')](function(_0x3292d9){logger['info']('WhatsappAccount,\x20%s,\x20%s',_0x43abb6,_0xd8ec('0x11'));logger['debug'](_0xd8ec('0x12'),_0x43abb6,_0xd8ec('0x11'),JSON[_0xd8ec('0x13')](_0x3292d9));if(_0x3292d9[_0xd8ec('0x14')]){if(_0x3292d9[_0xd8ec('0x14')][_0xd8ec('0x15')]===0x1f4){logger[_0xd8ec('0x14')](_0xd8ec('0x16'),_0x43abb6,_0x3292d9[_0xd8ec('0x14')][_0xd8ec('0x17')]);return _0x2da4f2(_0x3292d9[_0xd8ec('0x14')][_0xd8ec('0x17')]);}logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x43abb6,_0x3292d9['error'][_0xd8ec('0x17')]);return _0x3792bc(_0x3292d9['error'][_0xd8ec('0x17')]);}else{logger[_0xd8ec('0x18')](_0xd8ec('0x16'),_0x43abb6,'request\x20sent');_0x3792bc(_0x3292d9['result'][_0xd8ec('0x17')]);}})[_0xd8ec('0x19')](function(_0xc9e0da){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x43abb6,_0xc9e0da);_0x2da4f2(_0xc9e0da);});});}exports[_0xd8ec('0x1a')]=function(_0x3becd4){var _0x45fc5f=this;return new Promise(function(_0x13c1ba,_0x258623){return db[_0xd8ec('0x1b')][_0xd8ec('0x1c')]({'raw':_0x3becd4['options']?_0x3becd4[_0xd8ec('0x1d')][_0xd8ec('0x1e')]===undefined?!![]:![]:!![],'where':_0x3becd4[_0xd8ec('0x1d')]?_0x3becd4['options']['where']||null:null,'attributes':_0x3becd4['options']?_0x3becd4['options']['attributes']||null:null,'include':_0x3becd4['options']?_0x3becd4[_0xd8ec('0x1d')][_0xd8ec('0x1f')]?_[_0xd8ec('0x20')](_0x3becd4[_0xd8ec('0x1d')]['include'],function(_0x377d66){return{'model':db[_0x377d66['model']],'as':_0x377d66['as'],'attributes':_0x377d66[_0xd8ec('0x21')],'include':_0x377d66['include']?_[_0xd8ec('0x20')](_0x377d66['include'],function(_0x365579){return{'model':db[_0x365579[_0xd8ec('0x22')]],'as':_0x365579['as'],'attributes':_0x365579['attributes'],'include':_0x365579['include']?_[_0xd8ec('0x20')](_0x365579[_0xd8ec('0x1f')],function(_0x2511aa){return{'model':db[_0x2511aa[_0xd8ec('0x22')]],'as':_0x2511aa['as'],'attributes':_0x2511aa['attributes']};}):[]};}):[]};}):[]:[]})[_0xd8ec('0x10')](function(_0x378024){logger[_0xd8ec('0x18')](_0xd8ec('0x1a'),_0x3becd4);logger['debug'](_0xd8ec('0x1a'),_0x3becd4,JSON[_0xd8ec('0x13')](_0x378024));_0x13c1ba(_0x378024);})[_0xd8ec('0x19')](function(_0x3fa272){logger[_0xd8ec('0x14')](_0xd8ec('0x1a'),_0x3fa272[_0xd8ec('0x17')],_0x3becd4);_0x258623(_0x45fc5f[_0xd8ec('0x14')](0x1f4,_0x3fa272[_0xd8ec('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 034fda7..a649d6f 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 _0xdaa5=['length','whatsappAccount:','./whatsappAccount.events','save','remove','update','emit','removeListener'];(function(_0x13f73c,_0x9a5352){var _0x19ada4=function(_0x2802a5){while(--_0x2802a5){_0x13f73c['push'](_0x13f73c['shift']());}};_0x19ada4(++_0x9a5352);}(_0xdaa5,0x7a));var _0x5daa=function(_0x32d004,_0x5d13e8){_0x32d004=_0x32d004-0x0;var _0x3881ed=_0xdaa5[_0x32d004];return _0x3881ed;};'use strict';var WhatsappAccountEvents=require(_0x5daa('0x0'));var events=[_0x5daa('0x1'),_0x5daa('0x2'),_0x5daa('0x3')];function createListener(_0x31f2be,_0x5bcd20){return function(_0x3bea26){_0x5bcd20[_0x5daa('0x4')](_0x31f2be,_0x3bea26);};}function removeListener(_0x5b6805,_0x34210c){return function(){WhatsappAccountEvents[_0x5daa('0x5')](_0x5b6805,_0x34210c);};}exports['register']=function(_0x10ec77){for(var _0x5279c9=0x0,_0xae3420=events[_0x5daa('0x6')];_0x5279c9<_0xae3420;_0x5279c9++){var _0x436e78=events[_0x5279c9];var _0x39094a=createListener(_0x5daa('0x7')+_0x436e78,_0x10ec77);WhatsappAccountEvents['on'](_0x436e78,_0x39094a);}}; \ No newline at end of file +var _0x9db8=['length','whatsappAccount:','./whatsappAccount.events','save','remove','removeListener'];(function(_0x4260d0,_0x73ac34){var _0x5f34c2=function(_0x1c28ca){while(--_0x1c28ca){_0x4260d0['push'](_0x4260d0['shift']());}};_0x5f34c2(++_0x73ac34);}(_0x9db8,0xaa));var _0x89db=function(_0x180237,_0xfd4959){_0x180237=_0x180237-0x0;var _0x56fa74=_0x9db8[_0x180237];return _0x56fa74;};'use strict';var WhatsappAccountEvents=require(_0x89db('0x0'));var events=[_0x89db('0x1'),_0x89db('0x2'),'update'];function createListener(_0xd909d9,_0x13de27){return function(_0x3ee156){_0x13de27['emit'](_0xd909d9,_0x3ee156);};}function removeListener(_0xdaec8c,_0x1d9843){return function(){WhatsappAccountEvents[_0x89db('0x3')](_0xdaec8c,_0x1d9843);};}exports['register']=function(_0x35b484){for(var _0x2576dc=0x0,_0x169bf9=events[_0x89db('0x4')];_0x2576dc<_0x169bf9;_0x2576dc++){var _0x5acc76=events[_0x2576dc];var _0x534284=createListener(_0x89db('0x5')+_0x5acc76,_0x35b484);WhatsappAccountEvents['on'](_0x5acc76,_0x534284);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index b0249ce..95e22d9 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 _0x80ad=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','exports'];(function(_0x529a0f,_0x328763){var _0x187a88=function(_0x1ea706){while(--_0x1ea706){_0x529a0f['push'](_0x529a0f['shift']());}};_0x187a88(++_0x328763);}(_0x80ad,0x140));var _0xd80a=function(_0x9cbfe0,_0x56aada){_0x9cbfe0=_0x9cbfe0-0x0;var _0x1f1534=_0x80ad[_0x9cbfe0];return _0x1f1534;};'use strict';var multer=require(_0xd80a('0x0'));var util=require(_0xd80a('0x1'));var path=require(_0xd80a('0x2'));var timeout=require(_0xd80a('0x3'));var express=require(_0xd80a('0x4'));var router=express[_0xd80a('0x5')]();var fs_extra=require(_0xd80a('0x6'));var auth=require(_0xd80a('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd80a('0x8'));var controller=require(_0xd80a('0x9'));router[_0xd80a('0xa')]('/',auth[_0xd80a('0xb')](),controller[_0xd80a('0xc')]);router[_0xd80a('0xa')]('/:id',auth[_0xd80a('0xb')](),controller[_0xd80a('0xd')]);router[_0xd80a('0xe')]('/',auth['isAuthenticated'](),controller[_0xd80a('0xf')]);router[_0xd80a('0x10')](_0xd80a('0x11'),auth['isAuthenticated'](),controller['update']);router[_0xd80a('0x12')](_0xd80a('0x11'),auth[_0xd80a('0xb')](),controller['destroy']);module[_0xd80a('0x13')]=router; \ No newline at end of file +var _0xb706=['post','create','put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappApplication.controller','isAuthenticated','index','get','/:id','show'];(function(_0x221464,_0x4f286f){var _0xa6fca1=function(_0x1297c4){while(--_0x1297c4){_0x221464['push'](_0x221464['shift']());}};_0xa6fca1(++_0x4f286f);}(_0xb706,0x7e));var _0x6b70=function(_0x3e949c,_0x2b06fa){_0x3e949c=_0x3e949c-0x0;var _0x5e1321=_0xb706[_0x3e949c];return _0x5e1321;};'use strict';var multer=require(_0x6b70('0x0'));var util=require(_0x6b70('0x1'));var path=require(_0x6b70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6b70('0x3'));var router=express[_0x6b70('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6b70('0x5'));var interaction=require(_0x6b70('0x6'));var config=require(_0x6b70('0x7'));var controller=require(_0x6b70('0x8'));router['get']('/',auth[_0x6b70('0x9')](),controller[_0x6b70('0xa')]);router[_0x6b70('0xb')](_0x6b70('0xc'),auth[_0x6b70('0x9')](),controller[_0x6b70('0xd')]);router[_0x6b70('0xe')]('/',auth[_0x6b70('0x9')](),controller[_0x6b70('0xf')]);router[_0x6b70('0x10')](_0x6b70('0xc'),auth['isAuthenticated'](),controller[_0x6b70('0x11')]);router[_0x6b70('0x12')]('/:id',auth[_0x6b70('0x9')](),controller['destroy']);module[_0x6b70('0x13')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index 0e5584a..bd9d5f6 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 _0xed8f=['sequelize','exports','INTEGER','STRING','noop','TEXT'];(function(_0x3e686f,_0x19b04c){var _0x1a9f24=function(_0x32b2f7){while(--_0x32b2f7){_0x3e686f['push'](_0x3e686f['shift']());}};_0x1a9f24(++_0x19b04c);}(_0xed8f,0x1ce));var _0xfed8=function(_0x78628a,_0x356ba8){_0x78628a=_0x78628a-0x0;var _0xec46d3=_0xed8f[_0x78628a];return _0xec46d3;};'use strict';var Sequelize=require(_0xfed8('0x0'));module[_0xfed8('0x1')]={'priority':{'type':Sequelize[_0xfed8('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xfed8('0x3')],'allowNull':![],'defaultValue':_0xfed8('0x4')},'appdata':{'type':Sequelize[_0xfed8('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xfed8('0x3')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x209b=['STRING','noop','TEXT','*,*,*,*','sequelize','exports','INTEGER'];(function(_0x2f4752,_0x2c3fa1){var _0x529cd9=function(_0x108c3a){while(--_0x108c3a){_0x2f4752['push'](_0x2f4752['shift']());}};_0x529cd9(++_0x2c3fa1);}(_0x209b,0x13f));var _0xb209=function(_0x4cdcdc,_0x34eac7){_0x4cdcdc=_0x4cdcdc-0x0;var _0x4704ce=_0x209b[_0x4cdcdc];return _0x4704ce;};'use strict';var Sequelize=require(_0xb209('0x0'));module[_0xb209('0x1')]={'priority':{'type':Sequelize[_0xb209('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xb209('0x3')],'allowNull':![],'defaultValue':_0xb209('0x4')},'appdata':{'type':Sequelize[_0xb209('0x5')]()},'description':{'type':Sequelize[_0xb209('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0xb209('0x6')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index bc65c3c..4ace135 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 _0xf55c=['request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','apply','reject','save','update','destroy','then','name','index','map','WhatsappApplication','type','key','model','query','keys','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','catch','params','rawAttributes','options','find','body','eml-format','zip-dir','fast-json-patch'];(function(_0xed9297,_0x59f94b){var _0x30afde=function(_0x467ba8){while(--_0x467ba8){_0xed9297['push'](_0xed9297['shift']());}};_0x30afde(++_0x59f94b);}(_0xf55c,0x1e7));var _0xcf55=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xf55c[_0x481bf7];return _0x461787;};'use strict';var emlformat=require(_0xcf55('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf55('0x1'));var jsonpatch=require(_0xcf55('0x2'));var rp=require(_0xcf55('0x3'));var moment=require(_0xcf55('0x4'));var BPromise=require(_0xcf55('0x5'));var Mustache=require(_0xcf55('0x6'));var util=require(_0xcf55('0x7'));var path=require('path');var sox=require(_0xcf55('0x8'));var csv=require(_0xcf55('0x9'));var ejs=require(_0xcf55('0xa'));var fs=require('fs');var fs_extra=require(_0xcf55('0xb'));var _=require('lodash');var squel=require(_0xcf55('0xc'));var crypto=require(_0xcf55('0xd'));var jsforce=require(_0xcf55('0xe'));var deskjs=require(_0xcf55('0xf'));var toCsv=require('to-csv');var querystring=require(_0xcf55('0x10'));var Papa=require(_0xcf55('0x11'));var Redis=require(_0xcf55('0x12'));var authService=require(_0xcf55('0x13'));var qs=require(_0xcf55('0x14'));var as=require(_0xcf55('0x15'));var hardwareService=require(_0xcf55('0x16'));var logger=require('../../config/logger')(_0xcf55('0x17'));var utils=require(_0xcf55('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xcf55('0x19'))['db'];function respondWithStatusCode(_0x7cf19f,_0x742392){_0x742392=_0x742392||0xcc;return function(_0x46fa7a){if(_0x46fa7a){return _0x7cf19f[_0xcf55('0x1a')](_0x742392);}return _0x7cf19f[_0xcf55('0x1b')](_0x742392)[_0xcf55('0x1c')]();};}function respondWithResult(_0x32f03f,_0x111e5e){_0x111e5e=_0x111e5e||0xc8;return function(_0x40d4fe){if(_0x40d4fe){return _0x32f03f[_0xcf55('0x1b')](_0x111e5e)[_0xcf55('0x1d')](_0x40d4fe);}};}function respondWithFilteredResult(_0x547a5a,_0x410f47){return function(_0xfba091){if(_0xfba091){var _0x26c004=typeof _0x410f47[_0xcf55('0x1e')]===_0xcf55('0x1f')&&typeof _0x410f47['limit']===_0xcf55('0x1f');var _0x4a7a55=_0xfba091[_0xcf55('0x20')];var _0xeed93=_0x26c004?0x0:_0x410f47[_0xcf55('0x1e')];var _0x52195b=_0x26c004?_0xfba091[_0xcf55('0x20')]:_0x410f47['offset']+_0x410f47[_0xcf55('0x21')];var _0x1511ba;if(_0x52195b>=_0x4a7a55){_0x52195b=_0x4a7a55;_0x1511ba=0xc8;}else{_0x1511ba=0xce;}_0x547a5a[_0xcf55('0x1b')](_0x1511ba);return _0x547a5a['set']('Content-Range',_0xeed93+'-'+_0x52195b+'/'+_0x4a7a55)['json'](_0xfba091);}return null;};}function patchUpdates(_0x4562af){return function(_0x9cd5d5){try{jsonpatch[_0xcf55('0x22')](_0x9cd5d5,_0x4562af,!![]);}catch(_0x5df9e9){return BPromise[_0xcf55('0x23')](_0x5df9e9);}return _0x9cd5d5[_0xcf55('0x24')]();};}function saveUpdates(_0x5630ff,_0x4ad708){return function(_0x1283cc){if(_0x1283cc){return _0x1283cc[_0xcf55('0x25')](_0x5630ff)['then'](function(_0x1891d1){return _0x1891d1;});}return null;};}function removeEntity(_0x6dbf56,_0x1bb5cf){return function(_0x3c0723){if(_0x3c0723){return _0x3c0723[_0xcf55('0x26')]()[_0xcf55('0x27')](function(){_0x6dbf56[_0xcf55('0x1b')](0xcc)[_0xcf55('0x1c')]();});}};}function handleEntityNotFound(_0x524828,_0x37e734){return function(_0x51df33){if(!_0x51df33){_0x524828[_0xcf55('0x1a')](0x194);}return _0x51df33;};}function handleError(_0x1ecc93,_0x3c08f7){_0x3c08f7=_0x3c08f7||0x1f4;return function(_0x51471f){logger['error'](_0x51471f['stack']);if(_0x51471f[_0xcf55('0x28')]){delete _0x51471f[_0xcf55('0x28')];}_0x1ecc93['status'](_0x3c08f7)['send'](_0x51471f);};}exports[_0xcf55('0x29')]=function(_0x4a81cc,_0xeddf9){var _0x4128c0={},_0x1f9ed9={},_0xb98b74={'count':0x0,'rows':[]};var _0x2540c7=_[_0xcf55('0x2a')](db[_0xcf55('0x2b')]['rawAttributes'],function(_0x163f5f){return{'name':_0x163f5f['fieldName'],'type':_0x163f5f[_0xcf55('0x2c')][_0xcf55('0x2d')]};});_0x1f9ed9[_0xcf55('0x2e')]=_['map'](_0x2540c7,_0xcf55('0x28'));_0x1f9ed9[_0xcf55('0x2f')]=_[_0xcf55('0x30')](_0x4a81cc[_0xcf55('0x2f')]);_0x1f9ed9['filters']=_[_0xcf55('0x31')](_0x1f9ed9['model'],_0x1f9ed9['query']);_0x4128c0['attributes']=_[_0xcf55('0x31')](_0x1f9ed9['model'],qs['fields'](_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x32')]));_0x4128c0['attributes']=_0x4128c0[_0xcf55('0x33')][_0xcf55('0x34')]?_0x4128c0['attributes']:_0x1f9ed9['model'];if(!_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x35')](_0xcf55('0x36'))){_0x4128c0[_0xcf55('0x21')]=qs['limit'](_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x21')]);_0x4128c0[_0xcf55('0x1e')]=qs[_0xcf55('0x1e')](_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x1e')]);}_0x4128c0['order']=qs[_0xcf55('0x37')](_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x37')]);_0x4128c0[_0xcf55('0x38')]=qs['filters'](_[_0xcf55('0x39')](_0x4a81cc[_0xcf55('0x2f')],_0x1f9ed9['filters']),_0x2540c7);if(_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x3a')]){_0x4128c0[_0xcf55('0x38')]=_[_0xcf55('0x3b')](_0x4128c0[_0xcf55('0x38')],{'$or':_[_0xcf55('0x2a')](_0x2540c7,function(_0x1ce402){if(_0x1ce402[_0xcf55('0x2c')]!==_0xcf55('0x3c')){var _0x44df88={};_0x44df88[_0x1ce402['name']]={'$like':'%'+_0x4a81cc[_0xcf55('0x2f')][_0xcf55('0x3a')]+'%'};return _0x44df88;}})});}_0x4128c0=_[_0xcf55('0x3b')]({},_0x4128c0,_0x4a81cc['options']);var _0x47d7da={'where':_0x4128c0[_0xcf55('0x38')]};return db[_0xcf55('0x2b')][_0xcf55('0x20')](_0x47d7da)['then'](function(_0x113949){_0xb98b74['count']=_0x113949;if(_0x4a81cc['query'][_0xcf55('0x3d')]){_0x4128c0[_0xcf55('0x3e')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xcf55('0x3f')](_0x4128c0);})[_0xcf55('0x27')](function(_0x5349e7){_0xb98b74['rows']=_0x5349e7;return _0xb98b74;})[_0xcf55('0x27')](respondWithFilteredResult(_0xeddf9,_0x4128c0))[_0xcf55('0x40')](handleError(_0xeddf9,null));};exports['show']=function(_0x43ac3d,_0x38f079){var _0x18a918={'raw':!![],'where':{'id':_0x43ac3d[_0xcf55('0x41')]['id']}},_0x386c57={};_0x386c57['model']=_[_0xcf55('0x30')](db['WhatsappApplication'][_0xcf55('0x42')]);_0x386c57[_0xcf55('0x2f')]=_[_0xcf55('0x30')](_0x43ac3d[_0xcf55('0x2f')]);_0x386c57['filters']=_['intersection'](_0x386c57[_0xcf55('0x2e')],_0x386c57[_0xcf55('0x2f')]);_0x18a918[_0xcf55('0x33')]=_[_0xcf55('0x31')](_0x386c57['model'],qs[_0xcf55('0x32')](_0x43ac3d['query']['fields']));_0x18a918[_0xcf55('0x33')]=_0x18a918[_0xcf55('0x33')][_0xcf55('0x34')]?_0x18a918[_0xcf55('0x33')]:_0x386c57[_0xcf55('0x2e')];if(_0x43ac3d[_0xcf55('0x2f')][_0xcf55('0x3d')]){_0x18a918['include']=[{'all':!![]}];}_0x18a918=_['merge']({},_0x18a918,_0x43ac3d[_0xcf55('0x43')]);return db[_0xcf55('0x2b')][_0xcf55('0x44')](_0x18a918)[_0xcf55('0x27')](handleEntityNotFound(_0x38f079,null))[_0xcf55('0x27')](respondWithResult(_0x38f079,null))[_0xcf55('0x40')](handleError(_0x38f079,null));};exports['create']=function(_0xebc7c2,_0x41d4a5){return db[_0xcf55('0x2b')]['create'](_0xebc7c2[_0xcf55('0x45')],{})[_0xcf55('0x27')](respondWithResult(_0x41d4a5,0xc9))['catch'](handleError(_0x41d4a5,null));};exports['update']=function(_0x9859f,_0x6db4b5){if(_0x9859f[_0xcf55('0x45')]['id']){delete _0x9859f[_0xcf55('0x45')]['id'];}return db[_0xcf55('0x2b')]['find']({'where':{'id':_0x9859f[_0xcf55('0x41')]['id']}})[_0xcf55('0x27')](handleEntityNotFound(_0x6db4b5,null))[_0xcf55('0x27')](saveUpdates(_0x9859f[_0xcf55('0x45')],null))[_0xcf55('0x27')](respondWithResult(_0x6db4b5,null))['catch'](handleError(_0x6db4b5,null));};exports[_0xcf55('0x26')]=function(_0x5a5d6d,_0x50072f){return db[_0xcf55('0x2b')][_0xcf55('0x44')]({'where':{'id':_0x5a5d6d[_0xcf55('0x41')]['id']}})[_0xcf55('0x27')](handleEntityNotFound(_0x50072f,null))[_0xcf55('0x27')](removeEntity(_0x50072f,null))['catch'](handleError(_0x50072f,null));}; \ No newline at end of file +var _0xa3eb=['save','update','then','destroy','sendStatus','stack','name','send','map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','catch','body','find','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','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/environment','../../config/license/util','../../mysqldb','end','status','json','limit','count','offset','set','Content-Range','apply','reject'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa3eb,0x1ed));var _0xba3e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa3eb[_0x5ddb1c];return _0x354adc;};'use strict';var emlformat=require(_0xba3e('0x0'));var rimraf=require(_0xba3e('0x1'));var zipdir=require(_0xba3e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xba3e('0x3'));var moment=require(_0xba3e('0x4'));var BPromise=require(_0xba3e('0x5'));var Mustache=require(_0xba3e('0x6'));var util=require(_0xba3e('0x7'));var path=require(_0xba3e('0x8'));var sox=require(_0xba3e('0x9'));var csv=require(_0xba3e('0xa'));var ejs=require(_0xba3e('0xb'));var fs=require('fs');var fs_extra=require(_0xba3e('0xc'));var _=require(_0xba3e('0xd'));var squel=require(_0xba3e('0xe'));var crypto=require(_0xba3e('0xf'));var jsforce=require(_0xba3e('0x10'));var deskjs=require(_0xba3e('0x11'));var toCsv=require(_0xba3e('0xa'));var querystring=require(_0xba3e('0x12'));var Papa=require(_0xba3e('0x13'));var Redis=require(_0xba3e('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xba3e('0x15'));var as=require(_0xba3e('0x16'));var hardwareService=require(_0xba3e('0x17'));var logger=require('../../config/logger')(_0xba3e('0x18'));var utils=require(_0xba3e('0x19'));var config=require(_0xba3e('0x1a'));var licenseUtil=require(_0xba3e('0x1b'));var db=require(_0xba3e('0x1c'))['db'];function respondWithStatusCode(_0x4bf734,_0x730291){_0x730291=_0x730291||0xcc;return function(_0x159739){if(_0x159739){return _0x4bf734['sendStatus'](_0x730291);}return _0x4bf734['status'](_0x730291)[_0xba3e('0x1d')]();};}function respondWithResult(_0x16399c,_0x1a9cd2){_0x1a9cd2=_0x1a9cd2||0xc8;return function(_0x4ac37d){if(_0x4ac37d){return _0x16399c[_0xba3e('0x1e')](_0x1a9cd2)[_0xba3e('0x1f')](_0x4ac37d);}};}function respondWithFilteredResult(_0x578d23,_0x20ccd2){return function(_0x395965){if(_0x395965){var _0x1cb29c=typeof _0x20ccd2['offset']==='undefined'&&typeof _0x20ccd2[_0xba3e('0x20')]==='undefined';var _0x1cb884=_0x395965[_0xba3e('0x21')];var _0x37c8c9=_0x1cb29c?0x0:_0x20ccd2[_0xba3e('0x22')];var _0x241606=_0x1cb29c?_0x395965[_0xba3e('0x21')]:_0x20ccd2[_0xba3e('0x22')]+_0x20ccd2[_0xba3e('0x20')];var _0x498735;if(_0x241606>=_0x1cb884){_0x241606=_0x1cb884;_0x498735=0xc8;}else{_0x498735=0xce;}_0x578d23[_0xba3e('0x1e')](_0x498735);return _0x578d23[_0xba3e('0x23')](_0xba3e('0x24'),_0x37c8c9+'-'+_0x241606+'/'+_0x1cb884)[_0xba3e('0x1f')](_0x395965);}return null;};}function patchUpdates(_0x342c25){return function(_0x3e7e8c){try{jsonpatch[_0xba3e('0x25')](_0x3e7e8c,_0x342c25,!![]);}catch(_0x4f6d50){return BPromise[_0xba3e('0x26')](_0x4f6d50);}return _0x3e7e8c[_0xba3e('0x27')]();};}function saveUpdates(_0x51607e,_0x5ed12e){return function(_0x519c3e){if(_0x519c3e){return _0x519c3e[_0xba3e('0x28')](_0x51607e)[_0xba3e('0x29')](function(_0x4a1368){return _0x4a1368;});}return null;};}function removeEntity(_0xa774f9,_0x570fc9){return function(_0x1c261f){if(_0x1c261f){return _0x1c261f[_0xba3e('0x2a')]()[_0xba3e('0x29')](function(){_0xa774f9[_0xba3e('0x1e')](0xcc)[_0xba3e('0x1d')]();});}};}function handleEntityNotFound(_0x4190ab,_0x347118){return function(_0x42c30a){if(!_0x42c30a){_0x4190ab[_0xba3e('0x2b')](0x194);}return _0x42c30a;};}function handleError(_0x328aaf,_0x2df8e0){_0x2df8e0=_0x2df8e0||0x1f4;return function(_0xbb2a3c){logger['error'](_0xbb2a3c[_0xba3e('0x2c')]);if(_0xbb2a3c[_0xba3e('0x2d')]){delete _0xbb2a3c[_0xba3e('0x2d')];}_0x328aaf['status'](_0x2df8e0)[_0xba3e('0x2e')](_0xbb2a3c);};}exports['index']=function(_0x4fb8a0,_0x11318e){var _0x4cd364={},_0x26a025={},_0x544ca9={'count':0x0,'rows':[]};var _0x25bad7=_[_0xba3e('0x2f')](db[_0xba3e('0x30')][_0xba3e('0x31')],function(_0x10e076){return{'name':_0x10e076[_0xba3e('0x32')],'type':_0x10e076[_0xba3e('0x33')][_0xba3e('0x34')]};});_0x26a025[_0xba3e('0x35')]=_[_0xba3e('0x2f')](_0x25bad7,_0xba3e('0x2d'));_0x26a025[_0xba3e('0x36')]=_[_0xba3e('0x37')](_0x4fb8a0['query']);_0x26a025[_0xba3e('0x38')]=_[_0xba3e('0x39')](_0x26a025[_0xba3e('0x35')],_0x26a025['query']);_0x4cd364[_0xba3e('0x3a')]=_['intersection'](_0x26a025[_0xba3e('0x35')],qs[_0xba3e('0x3b')](_0x4fb8a0['query'][_0xba3e('0x3b')]));_0x4cd364[_0xba3e('0x3a')]=_0x4cd364[_0xba3e('0x3a')][_0xba3e('0x3c')]?_0x4cd364['attributes']:_0x26a025[_0xba3e('0x35')];if(!_0x4fb8a0['query']['hasOwnProperty']('nolimit')){_0x4cd364[_0xba3e('0x20')]=qs['limit'](_0x4fb8a0[_0xba3e('0x36')]['limit']);_0x4cd364['offset']=qs['offset'](_0x4fb8a0[_0xba3e('0x36')]['offset']);}_0x4cd364['order']=qs[_0xba3e('0x3d')](_0x4fb8a0[_0xba3e('0x36')][_0xba3e('0x3d')]);_0x4cd364['where']=qs[_0xba3e('0x38')](_[_0xba3e('0x3e')](_0x4fb8a0['query'],_0x26a025[_0xba3e('0x38')]),_0x25bad7);if(_0x4fb8a0[_0xba3e('0x36')][_0xba3e('0x3f')]){_0x4cd364[_0xba3e('0x40')]=_[_0xba3e('0x41')](_0x4cd364[_0xba3e('0x40')],{'$or':_[_0xba3e('0x2f')](_0x25bad7,function(_0x48f3c3){if(_0x48f3c3[_0xba3e('0x33')]!==_0xba3e('0x42')){var _0x517176={};_0x517176[_0x48f3c3['name']]={'$like':'%'+_0x4fb8a0[_0xba3e('0x36')][_0xba3e('0x3f')]+'%'};return _0x517176;}})});}_0x4cd364=_[_0xba3e('0x41')]({},_0x4cd364,_0x4fb8a0[_0xba3e('0x43')]);var _0x1e22c3={'where':_0x4cd364['where']};return db['WhatsappApplication'][_0xba3e('0x21')](_0x1e22c3)[_0xba3e('0x29')](function(_0x5dfb1e){_0x544ca9['count']=_0x5dfb1e;if(_0x4fb8a0[_0xba3e('0x36')][_0xba3e('0x44')]){_0x4cd364[_0xba3e('0x45')]=[{'all':!![]}];}return db['WhatsappApplication'][_0xba3e('0x46')](_0x4cd364);})[_0xba3e('0x29')](function(_0x396376){_0x544ca9['rows']=_0x396376;return _0x544ca9;})[_0xba3e('0x29')](respondWithFilteredResult(_0x11318e,_0x4cd364))['catch'](handleError(_0x11318e,null));};exports[_0xba3e('0x47')]=function(_0x2280d0,_0x59a34d){var _0x2ef22f={'raw':!![],'where':{'id':_0x2280d0[_0xba3e('0x48')]['id']}},_0x286031={};_0x286031[_0xba3e('0x35')]=_['keys'](db[_0xba3e('0x30')]['rawAttributes']);_0x286031['query']=_[_0xba3e('0x37')](_0x2280d0[_0xba3e('0x36')]);_0x286031['filters']=_[_0xba3e('0x39')](_0x286031['model'],_0x286031[_0xba3e('0x36')]);_0x2ef22f[_0xba3e('0x3a')]=_['intersection'](_0x286031[_0xba3e('0x35')],qs[_0xba3e('0x3b')](_0x2280d0[_0xba3e('0x36')][_0xba3e('0x3b')]));_0x2ef22f['attributes']=_0x2ef22f[_0xba3e('0x3a')][_0xba3e('0x3c')]?_0x2ef22f[_0xba3e('0x3a')]:_0x286031[_0xba3e('0x35')];if(_0x2280d0[_0xba3e('0x36')][_0xba3e('0x44')]){_0x2ef22f[_0xba3e('0x45')]=[{'all':!![]}];}_0x2ef22f=_[_0xba3e('0x41')]({},_0x2ef22f,_0x2280d0[_0xba3e('0x43')]);return db[_0xba3e('0x30')]['find'](_0x2ef22f)[_0xba3e('0x29')](handleEntityNotFound(_0x59a34d,null))[_0xba3e('0x29')](respondWithResult(_0x59a34d,null))[_0xba3e('0x49')](handleError(_0x59a34d,null));};exports['create']=function(_0x57498e,_0x25f43b){return db['WhatsappApplication']['create'](_0x57498e[_0xba3e('0x4a')],{})[_0xba3e('0x29')](respondWithResult(_0x25f43b,0xc9))[_0xba3e('0x49')](handleError(_0x25f43b,null));};exports[_0xba3e('0x28')]=function(_0x1b79fd,_0x50772d){if(_0x1b79fd[_0xba3e('0x4a')]['id']){delete _0x1b79fd['body']['id'];}return db['WhatsappApplication'][_0xba3e('0x4b')]({'where':{'id':_0x1b79fd[_0xba3e('0x48')]['id']}})[_0xba3e('0x29')](handleEntityNotFound(_0x50772d,null))[_0xba3e('0x29')](saveUpdates(_0x1b79fd[_0xba3e('0x4a')],null))['then'](respondWithResult(_0x50772d,null))[_0xba3e('0x49')](handleError(_0x50772d,null));};exports[_0xba3e('0x2a')]=function(_0x22aa22,_0x45d289){return db[_0xba3e('0x30')][_0xba3e('0x4b')]({'where':{'id':_0x22aa22['params']['id']}})[_0xba3e('0x29')](handleEntityNotFound(_0x45d289,null))[_0xba3e('0x29')](removeEntity(_0x45d289,null))[_0xba3e('0x49')](handleError(_0x45d289,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index f7ea890..a92a8ee 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 _0xbd50=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','define','WhatsappApplication','whatsapp_applications','lodash'];(function(_0x530d46,_0x2876e){var _0x4d221a=function(_0x591176){while(--_0x591176){_0x530d46['push'](_0x530d46['shift']());}};_0x4d221a(++_0x2876e);}(_0xbd50,0x196));var _0x0bd5=function(_0x268303,_0x45fcef){_0x268303=_0x268303-0x0;var _0x53cc1e=_0xbd50[_0x268303];return _0x53cc1e;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var logger=require(_0x0bd5('0x2'))('api');var moment=require(_0x0bd5('0x3'));var BPromise=require(_0x0bd5('0x4'));var rp=require(_0x0bd5('0x5'));var fs=require('fs');var path=require(_0x0bd5('0x6'));var rimraf=require(_0x0bd5('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappApplication.attributes');module['exports']=function(_0x376024,_0x2ef1d0){return _0x376024[_0x0bd5('0x8')](_0x0bd5('0x9'),attributes,{'tableName':_0x0bd5('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x55ca=['request-promise','rimraf','../../config/environment','./whatsappApplication.attributes','exports','define','whatsapp_applications','utf8mb4','lodash','util','bluebird'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0x55ca,0x126));var _0xa55c=function(_0xd27ded,_0x1164e2){_0xd27ded=_0xd27ded-0x0;var _0x5ef850=_0x55ca[_0xd27ded];return _0x5ef850;};'use strict';var _=require(_0xa55c('0x0'));var util=require(_0xa55c('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xa55c('0x2'));var rp=require(_0xa55c('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa55c('0x4'));var config=require(_0xa55c('0x5'));var attributes=require(_0xa55c('0x6'));module[_0xa55c('0x7')]=function(_0x3c97c8,_0x279caa){return _0x3c97c8[_0xa55c('0x8')]('WhatsappApplication',attributes,{'tableName':_0xa55c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xa55c('0xa'),'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 df7bf0b..6453ed4 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 _0x032e=['code','message','result','catch','lodash','moment','bluebird','../../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','request\x20sent','stringify','error'];(function(_0x1b801a,_0x361869){var _0x369776=function(_0x3862fb){while(--_0x3862fb){_0x1b801a['push'](_0x1b801a['shift']());}};_0x369776(++_0x361869);}(_0x032e,0x124));var _0xe032=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x032e[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0xe032('0x0'));var util=require('util');var moment=require(_0xe032('0x1'));var BPromise=require(_0xe032('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe032('0x3'))['db'];var utils=require(_0xe032('0x4'));var logger=require(_0xe032('0x5'))(_0xe032('0x6'));var config=require(_0xe032('0x7'));var jayson=require(_0xe032('0x8'));var client=jayson[_0xe032('0x9')][_0xe032('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37432f,_0x1576c8,_0x3289b0){return new BPromise(function(_0xd84027,_0xaf3907){return client[_0xe032('0xb')](_0x37432f,_0x3289b0)[_0xe032('0xc')](function(_0x2d8a14){logger[_0xe032('0xd')](_0xe032('0xe'),_0x1576c8,'request\x20sent');logger[_0xe032('0xf')](_0xe032('0x10'),_0x1576c8,_0xe032('0x11'),JSON[_0xe032('0x12')](_0x2d8a14));if(_0x2d8a14[_0xe032('0x13')]){if(_0x2d8a14[_0xe032('0x13')][_0xe032('0x14')]===0x1f4){logger['error'](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xaf3907(_0x2d8a14[_0xe032('0x13')]['message']);}logger[_0xe032('0x13')](_0xe032('0xe'),_0x1576c8,_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);return _0xd84027(_0x2d8a14[_0xe032('0x13')][_0xe032('0x15')]);}else{logger[_0xe032('0xd')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0xe032('0x11'));_0xd84027(_0x2d8a14[_0xe032('0x16')][_0xe032('0x15')]);}})[_0xe032('0x17')](function(_0x1938c4){logger[_0xe032('0x13')]('WhatsappApplication,\x20%s,\x20%s',_0x1576c8,_0x1938c4);_0xaf3907(_0x1938c4);});});} \ No newline at end of file +var _0x8d0e=['info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','request','then'];(function(_0xdeb251,_0x1d1e6b){var _0x27a9f2=function(_0x5c9580){while(--_0x5c9580){_0xdeb251['push'](_0xdeb251['shift']());}};_0x27a9f2(++_0x1d1e6b);}(_0x8d0e,0x1d7));var _0xe8d0=function(_0x52deca,_0x13fbaf){_0x52deca=_0x52deca-0x0;var _0x41dcbe=_0x8d0e[_0x52deca];return _0x41dcbe;};'use strict';var _=require(_0xe8d0('0x0'));var util=require(_0xe8d0('0x1'));var moment=require(_0xe8d0('0x2'));var BPromise=require(_0xe8d0('0x3'));var rs=require(_0xe8d0('0x4'));var fs=require('fs');var Redis=require(_0xe8d0('0x5'));var db=require(_0xe8d0('0x6'))['db'];var utils=require(_0xe8d0('0x7'));var logger=require(_0xe8d0('0x8'))('rpc');var config=require(_0xe8d0('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xe8d0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x92483d,_0x469d37,_0xcc03d0){return new BPromise(function(_0x2b6dce,_0x13aa63){return client[_0xe8d0('0xb')](_0x92483d,_0xcc03d0)[_0xe8d0('0xc')](function(_0x5605a0){logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,_0xe8d0('0xf'));logger['debug']('WhatsappApplication,\x20%s,\x20%s,\x20%s',_0x469d37,_0xe8d0('0xf'),JSON[_0xe8d0('0x10')](_0x5605a0));if(_0x5605a0[_0xe8d0('0x11')]){if(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x12')]===0x1f4){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x13aa63(_0x5605a0['error'][_0xe8d0('0x13')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);return _0x2b6dce(_0x5605a0[_0xe8d0('0x11')][_0xe8d0('0x13')]);}else{logger[_0xe8d0('0xd')](_0xe8d0('0xe'),_0x469d37,'request\x20sent');_0x2b6dce(_0x5605a0[_0xe8d0('0x14')]['message']);}})[_0xe8d0('0x15')](function(_0x3c526c){logger[_0xe8d0('0x11')]('WhatsappApplication,\x20%s,\x20%s',_0x469d37,_0x3c526c);_0x13aa63(_0x3c526c);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index e89f5bb..85cb032 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 _0xc4aa=['put','whatsappinteraction:update','update','delete','exports','multer','util','path','connect-timeout','express','Router','../../config/environment','./whatsappInteraction.controller','get','isAuthenticated','index','/describe','/:id','show','/:id/messages','getMessages','/:id/download','download','create','post','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags'];(function(_0x29e865,_0x16b90a){var _0x2c6e6d=function(_0x201eb6){while(--_0x201eb6){_0x29e865['push'](_0x29e865['shift']());}};_0x2c6e6d(++_0x16b90a);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x4d613c,_0x55f220){_0x4d613c=_0x4d613c-0x0;var _0x301fe3=_0xc4aa[_0x4d613c];return _0x301fe3;};'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')]('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0xa')]);router[_0xac4a('0x8')](_0xac4a('0xb'),auth[_0xac4a('0x9')](),controller['describe']);router['get'](_0xac4a('0xc'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xd')]);router['get'](_0xac4a('0xe'),auth[_0xac4a('0x9')](),controller[_0xac4a('0xf')]);router['get'](_0xac4a('0x10'),auth['isAuthenticated'](),controller[_0xac4a('0x11')]);router['post']('/',auth[_0xac4a('0x9')](),controller[_0xac4a('0x12')]);router[_0xac4a('0x13')]('/:id/messages',auth[_0xac4a('0x9')](),controller[_0xac4a('0x14')]);router[_0xac4a('0x13')](_0xac4a('0x15'),auth[_0xac4a('0x9')](),interaction[_0xac4a('0x16')](_0xac4a('0x17'),_0xac4a('0x18')),controller[_0xac4a('0x19')]);router[_0xac4a('0x1a')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),interaction['tracked'](_0xac4a('0x17'),_0xac4a('0x1b')),controller[_0xac4a('0x1c')]);router[_0xac4a('0x1d')](_0xac4a('0xc'),auth[_0xac4a('0x9')](),interaction[_0xac4a('0x16')](_0xac4a('0x17'),'whatsappinteraction:destroy'),controller['destroy']);router[_0xac4a('0x1d')](_0xac4a('0x15'),auth[_0xac4a('0x9')](),controller['removeTags']);module[_0xac4a('0x1e')]=router; \ No newline at end of file +var _0xfdbd=['getMessages','download','create','post','addMessage','/:id/tags','whatsapp','addTags','put','/:id','tracked','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','isAuthenticated','index','describe','get','show','/:id/messages'];(function(_0x112107,_0x3e2694){var _0x2aba63=function(_0x4daa14){while(--_0x4daa14){_0x112107['push'](_0x112107['shift']());}};_0x2aba63(++_0x3e2694);}(_0xfdbd,0xf0));var _0xdfdb=function(_0x5805d7,_0x3d584a){_0x5805d7=_0x5805d7-0x0;var _0x170fe4=_0xfdbd[_0x5805d7];return _0x170fe4;};'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('0xd')]('/:id/download',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x11')]);router['post']('/',auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x12')]);router[_0xdfdb('0x13')](_0xdfdb('0xf'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x14')]);router[_0xdfdb('0x13')](_0xdfdb('0x15'),auth['isAuthenticated'](),interaction['tracked'](_0xdfdb('0x16'),'whatsappinteraction:addtags'),controller[_0xdfdb('0x17')]);router[_0xdfdb('0x18')](_0xdfdb('0x19'),auth[_0xdfdb('0xa')](),interaction[_0xdfdb('0x1a')](_0xdfdb('0x16'),'whatsappinteraction:update'),controller['update']);router[_0xdfdb('0x1b')](_0xdfdb('0x19'),auth[_0xdfdb('0xa')](),interaction['tracked'](_0xdfdb('0x16'),_0xdfdb('0x1c')),controller[_0xdfdb('0x1d')]);router[_0xdfdb('0x1b')](_0xdfdb('0x15'),auth[_0xdfdb('0xa')](),controller[_0xdfdb('0x1e')]);module[_0xdfdb('0x1f')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index efe2776..fb10176 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 _0x99c9=['DATE','STRING','ENUM','out','sequelize','moment','exports','BOOLEAN'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x99c9,0x13c));var _0x999c=function(_0x2c7618,_0x26be9c){_0x2c7618=_0x2c7618-0x0;var _0x5ce3f0=_0x99c9[_0x2c7618];return _0x5ce3f0;};'use strict';var Sequelize=require(_0x999c('0x0'));var moment=require(_0x999c('0x1'));module[_0x999c('0x2')]={'closed':{'type':Sequelize[_0x999c('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x999c('0x4')]},'disposition':{'type':Sequelize[_0x999c('0x5')]},'secondDisposition':{'type':Sequelize[_0x999c('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x999c('0x5')]},'phone':{'type':Sequelize[_0x999c('0x5')]},'read1stAt':{'type':Sequelize[_0x999c('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x999c('0x6')]('in',_0x999c('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x999c('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x999c('0x6')]('in',_0x999c('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x999c('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0xdb70=['sequelize','moment','exports','DATE','STRING','ENUM','out','BOOLEAN'];(function(_0x193a6e,_0x45dd00){var _0x599a9b=function(_0x37a9e2){while(--_0x37a9e2){_0x193a6e['push'](_0x193a6e['shift']());}};_0x599a9b(++_0x45dd00);}(_0xdb70,0xa0));var _0x0db7=function(_0x5bffe6,_0x178e0c){_0x5bffe6=_0x5bffe6-0x0;var _0x50f34c=_0xdb70[_0x5bffe6];return _0x50f34c;};'use strict';var Sequelize=require(_0x0db7('0x0'));var moment=require(_0x0db7('0x1'));module[_0x0db7('0x2')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x0db7('0x3')]},'disposition':{'type':Sequelize[_0x0db7('0x4')]},'secondDisposition':{'type':Sequelize[_0x0db7('0x4')]},'thirdDisposition':{'type':Sequelize[_0x0db7('0x4')]},'note':{'type':Sequelize[_0x0db7('0x4')]},'phone':{'type':Sequelize[_0x0db7('0x4')]},'read1stAt':{'type':Sequelize[_0x0db7('0x3')]},'firstMsgDirection':{'type':Sequelize[_0x0db7('0x5')]('in',_0x0db7('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x0db7('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x0db7('0x5')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x0db7('0x7')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index 3f1e1ae..816125c 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 _0x2263=['null','read','`unreadMessages`\x20=\x200','`unreadMessages`\x20>\x200','tag','isArray','filter','replace','isNumeric','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','i.id','QueryTypes','SELECT','clone','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','contactName','DESC','t.id\x20IN\x20?','resolve','role','agent','getWhatsappAccounts','i.WhatsappAccountId\x20IS\x20NULL','user','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','i.*','c.firstName','Contact.firstName','c.lastName','Contact.lastName','Contact.email','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','WhatsappInteractionId','all','show','params','includeAll','include','options','create','update','destroy','describe','WhatsappMessage','addMessage','ids','omit','getMessages','findOne','pick','format','findAll','rows','addTags','setTags','spread','whatsappInteractionTags:save','removeTags','download','root','server','files','tmp','join','CmContact','firstName','Attachment','Messages','direction','secret','Account','Owner','get','mkdirSync','Whatsapp','closed','YYYY-MM-DD\x20HH:mm:ss','disposition','existsSync','pipe','createWriteStream','basename','out','lastName','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../components/export/pdf','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','apply','reject','save','then','stack','name','send','Users','map','fullname','Tags','TagIds','split','forEach','push','catch','index','WhatsappInteraction','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','select','field','color','from','u.id','ui.WhatsappInteractionId','user_has_whatsapp_interactions','users','u.id\x20=\x20ui.UserId','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','parseSearch','search','sqlOperator','conditions','find','unreadMessages','value','having','`\x20>\x200','Contact','operator','$substring','getFullTextValue','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','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','some','compact','isEmpty','WhatsappAccountId','i.WhatsappAccountId\x20IN\x20?','concat','createdAt','parse','$gte','$lte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?'];(function(_0x285824,_0x3da647){var _0x311d7e=function(_0x2f3de0){while(--_0x2f3de0){_0x285824['push'](_0x285824['shift']());}};_0x311d7e(++_0x3da647);}(_0x2263,0x6e));var _0x3226=function(_0x179b53,_0x31f6fe){_0x179b53=_0x179b53-0x0;var _0x38a146=_0x2263[_0x179b53];return _0x38a146;};'use strict';var emlformat=require(_0x3226('0x0'));var rimraf=require(_0x3226('0x1'));var zipdir=require(_0x3226('0x2'));var jsonpatch=require(_0x3226('0x3'));var rp=require(_0x3226('0x4'));var moment=require(_0x3226('0x5'));var BPromise=require(_0x3226('0x6'));var Mustache=require(_0x3226('0x7'));var util=require('util');var path=require(_0x3226('0x8'));var sox=require(_0x3226('0x9'));var csv=require(_0x3226('0xa'));var ejs=require(_0x3226('0xb'));var fs=require('fs');var fs_extra=require(_0x3226('0xc'));var _=require('lodash');var squel=require(_0x3226('0xd'));var crypto=require(_0x3226('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x3226('0xa'));var querystring=require(_0x3226('0xf'));var Papa=require('papaparse');var Redis=require(_0x3226('0x10'));var authService=require(_0x3226('0x11'));var qs=require(_0x3226('0x12'));var as=require(_0x3226('0x13'));var pdf=require(_0x3226('0x14'));var hardwareService=require(_0x3226('0x15'));var logger=require(_0x3226('0x16'))('api');var utils=require(_0x3226('0x17'));var config=require(_0x3226('0x18'));var licenseUtil=require(_0x3226('0x19'));var db=require(_0x3226('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3226('0x1b')]));require(_0x3226('0x1c'))[_0x3226('0x1d')](socket);function respondWithStatusCode(_0x1b8552,_0x56d64c){_0x56d64c=_0x56d64c||0xcc;return function(_0x5b5c77){if(_0x5b5c77){return _0x1b8552[_0x3226('0x1e')](_0x56d64c);}return _0x1b8552[_0x3226('0x1f')](_0x56d64c)[_0x3226('0x20')]();};}function respondWithResult(_0x5eb4a8,_0x2fd0e5){_0x2fd0e5=_0x2fd0e5||0xc8;return function(_0x20f66c){if(_0x20f66c){return _0x5eb4a8[_0x3226('0x1f')](_0x2fd0e5)[_0x3226('0x21')](_0x20f66c);}};}function respondWithFilteredResult(_0x1d62b6,_0x4113a1){return function(_0x51bba9){if(_0x51bba9){var _0x4b3521=typeof _0x4113a1[_0x3226('0x22')]==='undefined'&&typeof _0x4113a1[_0x3226('0x23')]===_0x3226('0x24');var _0x1210ec=_0x51bba9[_0x3226('0x25')];var _0x1170f6=_0x4b3521?0x0:_0x4113a1[_0x3226('0x22')];var _0x4d4cd8=_0x4b3521?_0x51bba9[_0x3226('0x25')]:_0x4113a1[_0x3226('0x22')]+_0x4113a1['limit'];var _0x411f2e;if(_0x4d4cd8>=_0x1210ec){_0x4d4cd8=_0x1210ec;_0x411f2e=0xc8;}else{_0x411f2e=0xce;}_0x1d62b6[_0x3226('0x1f')](_0x411f2e);return _0x1d62b6[_0x3226('0x26')]('Content-Range',_0x1170f6+'-'+_0x4d4cd8+'/'+_0x1210ec)[_0x3226('0x21')](_0x51bba9);}return null;};}function patchUpdates(_0x39e273){return function(_0x25f867){try{jsonpatch[_0x3226('0x27')](_0x25f867,_0x39e273,!![]);}catch(_0x3191f8){return BPromise[_0x3226('0x28')](_0x3191f8);}return _0x25f867[_0x3226('0x29')]();};}function saveUpdates(_0x3b2ad0,_0x5850c9){return function(_0x45fc39){if(_0x45fc39){return _0x45fc39['update'](_0x3b2ad0)[_0x3226('0x2a')](function(_0x5b8d32){return _0x5b8d32;});}return null;};}function removeEntity(_0x26c845,_0x5e4d85){return function(_0x1d7689){if(_0x1d7689){return _0x1d7689['destroy']()[_0x3226('0x2a')](function(){_0x26c845[_0x3226('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x41377c,_0x366e71){return function(_0x3a4af0){if(!_0x3a4af0){_0x41377c[_0x3226('0x1e')](0x194);}return _0x3a4af0;};}function handleError(_0x1e6181,_0x38c83c){_0x38c83c=_0x38c83c||0x1f4;return function(_0x12e26d){logger['error'](_0x12e26d[_0x3226('0x2b')]);if(_0x12e26d['name']){delete _0x12e26d[_0x3226('0x2c')];}_0x1e6181[_0x3226('0x1f')](_0x38c83c)[_0x3226('0x2d')](_0x12e26d);};}function getInteractionUsers(_0x52598b,_0x3012ee){return new BPromise(function(_0x4ab35a,_0x51c14d){try{if(_0x3012ee[_0x52598b['id']]){_0x52598b[_0x3226('0x2e')]=_[_0x3226('0x2f')](_0x3012ee[_0x52598b['id']],function(_0x14b8b3){return{'id':_0x14b8b3['id'],'fullname':_0x14b8b3[_0x3226('0x30')]};});}}catch(_0x2fee1d){_0x51c14d(_0x2fee1d);}_0x4ab35a(_0x52598b);});}function getInteractionTags(_0x148ee5,_0xf482d4){return new BPromise(function(_0x1dafc8,_0x4048a4){try{if(_0x148ee5['TagIds']){_0x148ee5[_0x3226('0x31')]=[];_0x148ee5[_0x3226('0x32')][_0x3226('0x33')](',')[_0x3226('0x34')](function(_0x3f439a){_0x148ee5[_0x3226('0x31')][_0x3226('0x35')](_0xf482d4[_0x3f439a]);});}delete _0x148ee5[_0x3226('0x32')];}catch(_0x2fc4d7){_0x4048a4(_0x2fc4d7);}_0x1dafc8(_0x148ee5);});}function updateWhatsappInteraction(_0x2e53bb,_0x1a4195,_0x55df69){return new BPromise(function(_0x346cc6,_0xc7e1a1){return getInteractionUsers(_0x2e53bb,_0x55df69)['then'](function(_0x4fa28c){return getInteractionTags(_0x4fa28c,_0x1a4195);})[_0x3226('0x2a')](function(_0x49cb32){_0x346cc6(_0x49cb32);})[_0x3226('0x36')](function(_0x55ea4f){_0xc7e1a1(_0x55ea4f);});});}exports[_0x3226('0x37')]=function(_0x2e511a,_0x46d7bc){var _0x1bb5f2={},_0x32438f={},_0x4df2a9={'count':0x0,'rows':[]};var _0x20715=_['map'](db[_0x3226('0x38')]['rawAttributes'],function(_0x29493a){return{'name':_0x29493a[_0x3226('0x39')],'type':_0x29493a[_0x3226('0x3a')]['key']};});_0x32438f[_0x3226('0x3b')]=_[_0x3226('0x2f')](_0x20715,_0x3226('0x2c'));_0x32438f[_0x3226('0x3c')]=_[_0x3226('0x3d')](_0x2e511a[_0x3226('0x3c')]);_0x32438f[_0x3226('0x3e')]=_[_0x3226('0x3f')](_0x32438f[_0x3226('0x3b')],_0x32438f[_0x3226('0x3c')]);_0x1bb5f2[_0x3226('0x40')]=_[_0x3226('0x3f')](_0x32438f[_0x3226('0x3b')],qs[_0x3226('0x41')](_0x2e511a[_0x3226('0x3c')]['fields']));_0x1bb5f2[_0x3226('0x40')]=_0x1bb5f2[_0x3226('0x40')][_0x3226('0x42')]?_0x1bb5f2[_0x3226('0x40')]:_0x32438f['model'];if(!_0x2e511a[_0x3226('0x3c')][_0x3226('0x43')](_0x3226('0x44'))){_0x1bb5f2[_0x3226('0x23')]=qs[_0x3226('0x23')](_0x2e511a[_0x3226('0x3c')][_0x3226('0x23')]);_0x1bb5f2[_0x3226('0x22')]=qs[_0x3226('0x22')](_0x2e511a['query'][_0x3226('0x22')]);}_0x1bb5f2[_0x3226('0x45')]=qs[_0x3226('0x46')](_0x2e511a[_0x3226('0x3c')][_0x3226('0x46')]);_0x1bb5f2[_0x3226('0x47')]=qs['filters'](_['pick'](_0x2e511a[_0x3226('0x3c')],_0x32438f[_0x3226('0x3e')]),_0x20715);var _0x4eabb5=[];var _0xf05e66=squel[_0x3226('0x48')]()[_0x3226('0x49')]('id')[_0x3226('0x49')](_0x3226('0x2c'))[_0x3226('0x49')](_0x3226('0x4a'))[_0x3226('0x4b')]('tools_tags');var _0xc63c19=squel['select']()[_0x3226('0x49')](_0x3226('0x4c'))['field']('u.fullname')[_0x3226('0x49')](_0x3226('0x4d'))[_0x3226('0x4b')](_0x3226('0x4e'),'ui')['left_join'](_0x3226('0x4f'),'u',_0x3226('0x50'));var _0x5aee1b=squel[_0x3226('0x48')]()[_0x3226('0x4b')]('whatsapp_interactions','i')[_0x3226('0x51')](_0x3226('0x52'),'c',_0x3226('0x53'))[_0x3226('0x51')](_0x3226('0x4f'),'o','o.id\x20=\x20i.UserId')[_0x3226('0x51')](_0x3226('0x54'),'a',_0x3226('0x55'))[_0x3226('0x51')](_0x3226('0x56'),'me','me.WhatsappInteractionId\x20=\x20i.id')[_0x3226('0x51')](_0x3226('0x57'),'it',_0x3226('0x58'))[_0x3226('0x51')](_0x3226('0x59'),'t',_0x3226('0x5a'));var _0x2b172d=squel[_0x3226('0x5b')]();var _0x1016e6=[];var _0x1a545d=squel[_0x3226('0x5b')]();var _0x3f555b;if(_0x2e511a[_0x3226('0x3c')]['search']){_0x3f555b=as[_0x3226('0x5c')](_0x2e511a['query'][_0x3226('0x5d')]);var _0x4e5527=_0x3f555b[_0x3226('0x5e')];for(var _0x222a6d=0x0;_0x222a6d<_0x3f555b['conditions'][_0x3226('0x42')];_0x222a6d++){var _0x454144=_0x3f555b[_0x3226('0x5f')][_0x222a6d];var _0x4ca7f4='i';var _0x165609=_[_0x3226('0x60')](_0x20715,[_0x3226('0x2c'),_0x454144['field']]);if(!_0x165609){switch(_0x454144[_0x3226('0x49')]){case _0x3226('0x61'):if(_0x454144[_0x3226('0x62')]==0x1){_0x5aee1b[_0x3226('0x63')]('`'+_0x454144['field']+'`\x20=\x200');}else{_0x5aee1b[_0x3226('0x63')]('`'+_0x454144[_0x3226('0x49')]+_0x3226('0x64'));}break;case _0x3226('0x65'):if(_0x454144[_0x3226('0x66')]===_0x3226('0x67')){if(_0x454144[_0x3226('0x62')][_0x3226('0x33')]('\x20')[_0x3226('0x42')]>0x1){_0x2b172d[_0x4e5527]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x3226('0x68')](_0x454144[_0x3226('0x62')]),null);}else{var _0x50a249='%'+_0x454144[_0x3226('0x62')]+'%';_0x2b172d[_0x4e5527](_0x3226('0x69'),_0x50a249,_0x50a249,_0x50a249);}}else{_0x165609=_[_0x3226('0x60')](_0x20715,['name',_0x3226('0x6a')]);_0x454144[_0x3226('0x49')]='ContactId';_0x266c62=as[_0x3226('0x6b')](_0x4ca7f4,_0x165609['type'],_0x454144);_0x2b172d[_0x4e5527](_0x266c62[_0x3226('0x6c')],_0x266c62[_0x3226('0x62')][_0x3226('0x6d')],_0x266c62['value']['end']);}break;case'Tag':var _0x19e604=_0x454144[_0x3226('0x62')][_0x3226('0x33')](',')[_0x3226('0x2f')](function(_0x479b95){return Number(_0x479b95);});_0x19e604['forEach'](function(_0x34ec6f){_0x1a545d['or'](_0x3226('0x6e'),'%,'+_0x34ec6f+',%');});_0x1016e6=_[_0x3226('0x6f')](_0x1016e6,_0x19e604);break;case _0x3226('0x70'):if(_0x454144[_0x3226('0x66')]===_0x3226('0x67')){_0x2b172d[_0x4e5527](_0x3226('0x71'),'%'+_0x454144[_0x3226('0x62')]+'%',null);}else{_0x165609=_['find'](_0x20715,[_0x3226('0x2c'),_0x3226('0x72')]);_0x454144[_0x3226('0x49')]=_0x3226('0x72');_0x266c62=as['buildExpression'](_0x4ca7f4,_0x165609[_0x3226('0x3a')],_0x454144);_0x2b172d[_0x4e5527](_0x266c62[_0x3226('0x6c')],_0x266c62[_0x3226('0x62')][_0x3226('0x6d')],_0x266c62['value']['end']);}break;case _0x3226('0x73'):_0x266c62=as['buildExpression']('me',null,_0x454144);_0x2b172d[_0x4e5527](_0x266c62[_0x3226('0x6c')],_0x266c62[_0x3226('0x62')][_0x3226('0x6d')],_0x266c62[_0x3226('0x62')]['end']);break;}}else{var _0x266c62=as[_0x3226('0x6b')](_0x4ca7f4,_0x165609[_0x3226('0x3a')],_0x454144);_0x2b172d[_0x4e5527](_0x266c62['text'],_0x266c62[_0x3226('0x62')][_0x3226('0x6d')],_0x266c62['value'][_0x3226('0x20')]);}}}else{var _0x450531=_(_0x2e511a[_0x3226('0x3c')])[_0x3226('0x3d')]()[_0x3226('0x2f')](function(_0x15624b){return _[_0x3226('0x74')](_0x20715,[_0x3226('0x2c'),_0x15624b])?_0x15624b:undefined;})[_0x3226('0x75')]()['value']();if(!_[_0x3226('0x76')](_0x450531)){_0x450531['forEach'](function(_0x5e78ff){if(_0x5e78ff===_0x3226('0x77')){_0x5aee1b[_0x3226('0x47')](_0x3226('0x78'),[][_0x3226('0x79')](_0x2e511a[_0x3226('0x3c')][_0x5e78ff]));}else if(_0x5e78ff===_0x3226('0x7a')){var _0x38a051=JSON[_0x3226('0x7b')](_0x2e511a[_0x3226('0x3c')][_0x5e78ff])[_0x3226('0x7c')];var _0x3fa075=JSON['parse'](_0x2e511a[_0x3226('0x3c')][_0x5e78ff])[_0x3226('0x7d')];_0x5aee1b['where'](_0x3226('0x7e'),_0x38a051,_0x3fa075);}else{if(_0x2e511a['query'][_0x5e78ff]===_0x3226('0x7f')){_0x5aee1b[_0x3226('0x47')]('i.'+_0x5e78ff+'\x20IS\x20NULL');}else{_0x5aee1b['where']('i.'+_0x5e78ff+'\x20=\x20?',_0x2e511a[_0x3226('0x3c')][_0x5e78ff]);}}});}if(_0x2e511a[_0x3226('0x3c')][_0x3226('0x80')]){if(_0x2e511a[_0x3226('0x3c')][_0x3226('0x80')]==0x1){_0x5aee1b['having'](_0x3226('0x81'));}else{_0x5aee1b[_0x3226('0x63')](_0x3226('0x82'));}}if(_0x2e511a[_0x3226('0x3c')][_0x3226('0x83')]){_0x1016e6=_[_0x3226('0x84')](_0x2e511a[_0x3226('0x3c')][_0x3226('0x83')])?_0x2e511a['query'][_0x3226('0x83')]:new Array(_0x2e511a[_0x3226('0x3c')][_0x3226('0x83')]);_0x1016e6['forEach'](function(_0x359f94){_0x1a545d['or']('CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x359f94+',%');});}if(_0x2e511a[_0x3226('0x3c')][_0x3226('0x85')]){var _0x1ee90c=_0x2e511a[_0x3226('0x3c')]['filter']['replace']('\x5c','\x5c\x5c')[_0x3226('0x86')](/'/g,'\x27\x27');if(qs[_0x3226('0x87')](_0x1ee90c)){_0x2b172d['or']('i.id\x20LIKE\x20?',_0x1ee90c+'%')['or'](_0x3226('0x88'),_0x1ee90c+'%');}else{_0x2b172d['or'](_0x3226('0x89'),qs[_0x3226('0x68')](_0x1ee90c))['or'](_0x3226('0x8a'),_0x1ee90c+'%');}}}_0x5aee1b[_0x3226('0x47')](_0x2b172d);_0x5aee1b['group'](_0x3226('0x8b'));var _0x1ace81={'type':db['Sequelize'][_0x3226('0x8c')][_0x3226('0x8d')],'raw':!![]};var _0x42fd7b=_0x5aee1b[_0x3226('0x8e')]();_0x42fd7b['field']('i.id');_0x42fd7b[_0x3226('0x49')](_0x3226('0x8f'),_0x3226('0x61'));if(_0x1bb5f2['order']){_0x1bb5f2[_0x3226('0x45')][_0x3226('0x34')](function(_0x4665c2){var _0xb7958f=_0x4665c2[0x0]===_0x3226('0x90')?_0x4665c2[0x0]:'i.'+_0x4665c2[0x0];_0x5aee1b[_0x3226('0x45')](_0xb7958f,_0x4665c2[0x1]===_0x3226('0x91')?![]:!![]);});}if(!_[_0x3226('0x76')](_0x1016e6)){_0x5aee1b[_0x3226('0x63')](_0x1a545d);_0x42fd7b['where'](_0x3226('0x92'),_0x1016e6);}BPromise[_0x3226('0x93')]()[_0x3226('0x2a')](function(){if(!_0x3f555b){if(_0x2e511a['query'][_0x3226('0x77')])return;_0x42fd7b[_0x3226('0x47')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');_0x5aee1b[_0x3226('0x47')]('i.WhatsappAccountId\x20IS\x20NOT\x20NULL');return;}if(_0x2e511a['user'][_0x3226('0x94')]!==_0x3226('0x95'))return;return _0x2e511a['user'][_0x3226('0x96')]({'attributes':['id'],'raw':!![]})[_0x3226('0x2a')](function(_0x1c293d){if(_[_0x3226('0x76')](_0x1c293d)){_0x42fd7b[_0x3226('0x47')](_0x3226('0x97'));_0x5aee1b[_0x3226('0x47')](_0x3226('0x97'));}else{_0x42fd7b['where'](_0x3226('0x78'),_[_0x3226('0x2f')](_0x1c293d,'id'));_0x5aee1b[_0x3226('0x47')]('i.WhatsappAccountId\x20IN\x20?',_[_0x3226('0x2f')](_0x1c293d,'id'));}});})[_0x3226('0x2a')](function(){if(_0x2e511a[_0x3226('0x98')][_0x3226('0x94')]==='agent'&&!_0x3f555b&&!_0x2e511a[_0x3226('0x3c')]['WhatsappAccountId'])return[];return db['sequelize'][_0x3226('0x3c')](_0x42fd7b[_0x3226('0x99')](),_0x1ace81);})[_0x3226('0x2a')](function(_0xd96479){_0x4df2a9[_0x3226('0x25')]=_0xd96479[_0x3226('0x42')];if(_0x4df2a9['count']===0x0)return[];return db[_0x3226('0x9a')][_0x3226('0x3c')](_0xf05e66[_0x3226('0x99')](),_0x1ace81)[_0x3226('0x2a')](function(_0x2b1a60){_0x4eabb5=_[_0x3226('0x9b')](_0x2b1a60,'id');_0x1ace81=_[_0x3226('0x9c')](_0x1ace81,{'model':db['WhatsappInteraction'],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x2e511a[_0x3226('0x3c')][_0x3226('0x41')]){_0x1bb5f2['attributes']['forEach'](function(_0x55a05e){_0x5aee1b[_0x3226('0x49')]('i.'+_0x55a05e);});}else{_0x5aee1b[_0x3226('0x49')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x3226('0x61'));_0x5aee1b['field'](_0x3226('0x9d'),_0x3226('0x9e'));_0x5aee1b[_0x3226('0x49')](_0x3226('0x9f'),_0x3226('0xa0'));_0x5aee1b[_0x3226('0x49')](_0x3226('0xa1'),'contactName');_0x5aee1b['field'](_0x3226('0xa2'));_0x5aee1b[_0x3226('0x49')](_0x3226('0xa3'),_0x3226('0xa4'));_0x5aee1b['field'](_0x3226('0xa5'),_0x3226('0xa6'));_0x5aee1b[_0x3226('0x49')]('c.email',_0x3226('0xa7'));_0x5aee1b[_0x3226('0x49')]('c.phone',_0x3226('0xa8'));_0x5aee1b[_0x3226('0x49')](_0x3226('0xa9'),_0x3226('0xaa'));_0x5aee1b['field'](_0x3226('0xab'),_0x3226('0xac'));_0x5aee1b[_0x3226('0x49')](_0x3226('0xad'),'Owner.fullname');_0x5aee1b[_0x3226('0x49')]('o.internal','Owner.internal');_0x5aee1b[_0x3226('0x49')](_0x3226('0xae'),'TagIds');}if(_0x1bb5f2[_0x3226('0x23')])_0x5aee1b[_0x3226('0x23')](_0x1bb5f2['limit']);if(_0x1bb5f2[_0x3226('0x22')])_0x5aee1b[_0x3226('0x22')](_0x1bb5f2[_0x3226('0x22')]);return db[_0x3226('0x9a')][_0x3226('0x3c')](_0x5aee1b[_0x3226('0x99')](),_0x1ace81);})['then'](function(_0x453676){if(_0x453676[_0x3226('0x42')]>0x0)_0xc63c19[_0x3226('0x47')](_0x3226('0xaf'),_[_0x3226('0x2f')](_0x453676,'id'));return db['sequelize'][_0x3226('0x3c')](_0xc63c19['toString'](),_0x1ace81)[_0x3226('0x2a')](function(_0x27c831){var _0x3b0f3f=_['groupBy'](_0x27c831,_0x3226('0xb0'));var _0x21879f=[];_0x453676['forEach'](function(_0x5948db){_0x21879f[_0x3226('0x35')](updateWhatsappInteraction(_0x5948db,_0x4eabb5,_0x3b0f3f));});return BPromise[_0x3226('0xb1')](_0x21879f);});});})[_0x3226('0x2a')](function(_0x25ac97){_0x4df2a9['rows']=_0x25ac97;return _0x4df2a9;})[_0x3226('0x2a')](respondWithFilteredResult(_0x46d7bc,_0x1bb5f2))[_0x3226('0x36')](handleError(_0x46d7bc,null));};exports[_0x3226('0xb2')]=function(_0x1c99d6,_0x1f821c){var _0x8945ac={'raw':![],'where':{'id':_0x1c99d6[_0x3226('0xb3')]['id']}},_0x3eceec={};_0x3eceec['model']=_[_0x3226('0x3d')](db[_0x3226('0x38')]['rawAttributes']);_0x3eceec['query']=_['keys'](_0x1c99d6[_0x3226('0x3c')]);_0x3eceec['filters']=_[_0x3226('0x3f')](_0x3eceec[_0x3226('0x3b')],_0x3eceec[_0x3226('0x3c')]);_0x8945ac[_0x3226('0x40')]=_[_0x3226('0x3f')](_0x3eceec[_0x3226('0x3b')],qs[_0x3226('0x41')](_0x1c99d6[_0x3226('0x3c')][_0x3226('0x41')]));_0x8945ac[_0x3226('0x40')]=_0x8945ac[_0x3226('0x40')][_0x3226('0x42')]?_0x8945ac['attributes']:_0x3eceec[_0x3226('0x3b')];if(_0x1c99d6['query'][_0x3226('0xb4')]){_0x8945ac[_0x3226('0xb5')]=[{'all':!![]}];}_0x8945ac=_['merge']({},_0x8945ac,_0x1c99d6[_0x3226('0xb6')]);return db[_0x3226('0x38')][_0x3226('0x60')](_0x8945ac)['then'](handleEntityNotFound(_0x1f821c,null))[_0x3226('0x2a')](respondWithResult(_0x1f821c,null))[_0x3226('0x36')](handleError(_0x1f821c,null));};exports[_0x3226('0xb7')]=function(_0x5eacf6,_0x10c192){return db[_0x3226('0x38')][_0x3226('0xb7')](_0x5eacf6[_0x3226('0x73')],{})[_0x3226('0x2a')](respondWithResult(_0x10c192,0xc9))['catch'](handleError(_0x10c192,null));};exports[_0x3226('0xb8')]=function(_0x390479,_0x3573de){if(_0x390479[_0x3226('0x73')]['id']){delete _0x390479['body']['id'];}return db[_0x3226('0x38')]['find']({'where':{'id':_0x390479['params']['id']}})[_0x3226('0x2a')](handleEntityNotFound(_0x3573de,null))[_0x3226('0x2a')](saveUpdates(_0x390479['body'],null))[_0x3226('0x2a')](respondWithResult(_0x3573de,null))['catch'](handleError(_0x3573de,null));};exports[_0x3226('0xb9')]=function(_0x44d894,_0x691c86){return db['WhatsappInteraction'][_0x3226('0x60')]({'where':{'id':_0x44d894[_0x3226('0xb3')]['id']}})['then'](handleEntityNotFound(_0x691c86,null))[_0x3226('0x2a')](removeEntity(_0x691c86,null))[_0x3226('0x36')](handleError(_0x691c86,null));};exports[_0x3226('0xba')]=function(_0x4bc8c4,_0x561128){return db[_0x3226('0x38')][_0x3226('0xba')]()['then'](respondWithResult(_0x561128,null))[_0x3226('0x36')](handleError(_0x561128,null));};exports['addMessage']=function(_0x293f23,_0x331052,_0x560788){return db[_0x3226('0xbb')]['find']({'where':{'id':_0x293f23[_0x3226('0xb3')]['id']}})[_0x3226('0x2a')](handleEntityNotFound(_0x331052,null))[_0x3226('0x2a')](function(_0x4094a0){if(_0x4094a0){return _0x4094a0[_0x3226('0xbc')](_0x293f23[_0x3226('0x73')][_0x3226('0xbd')],_[_0x3226('0xbe')](_0x293f23[_0x3226('0x73')],[_0x3226('0xbd'),'id'])||{});}})[_0x3226('0x2a')](respondWithResult(_0x331052,null))[_0x3226('0x36')](handleError(_0x331052,null));};exports[_0x3226('0xbf')]=function(_0x23de10,_0x4fe766,_0x7d1d94){var _0xfa59bc={'raw':![],'where':{}};var _0x513ad6={};var _0x2e4f13={'count':0x0,'rows':[]};return db[_0x3226('0x38')][_0x3226('0xc0')]({'where':{'id':_0x23de10['params']['id']}})['then'](handleEntityNotFound(_0x4fe766,null))[_0x3226('0x2a')](function(_0x36c6e7){if(_0x36c6e7){_0x513ad6['model']=_[_0x3226('0x3d')](db[_0x3226('0xbb')]['rawAttributes']);_0x513ad6['query']=_[_0x3226('0x3d')](_0x23de10[_0x3226('0x3c')]);_0x513ad6[_0x3226('0x3e')]=_[_0x3226('0x3f')](_0x513ad6[_0x3226('0x3b')],_0x513ad6[_0x3226('0x3c')]);_0xfa59bc[_0x3226('0x40')]=_[_0x3226('0x3f')](_0x513ad6[_0x3226('0x3b')],qs[_0x3226('0x41')](_0x23de10[_0x3226('0x3c')]['fields']));_0xfa59bc['attributes']=_0xfa59bc[_0x3226('0x40')]['length']?_0xfa59bc[_0x3226('0x40')]:_0x513ad6['model'];if(!_0x23de10[_0x3226('0x3c')][_0x3226('0x43')](_0x3226('0x44'))){_0xfa59bc[_0x3226('0x23')]=qs['limit'](_0x23de10['query'][_0x3226('0x23')]);_0xfa59bc[_0x3226('0x22')]=qs[_0x3226('0x22')](_0x23de10[_0x3226('0x3c')][_0x3226('0x22')]);}_0xfa59bc[_0x3226('0x45')]=qs[_0x3226('0x46')](_0x23de10[_0x3226('0x3c')]['sort']);_0xfa59bc[_0x3226('0x47')]=qs['filters'](_[_0x3226('0xc1')](_0x23de10[_0x3226('0x3c')],_0x513ad6[_0x3226('0x3e')]));_0xfa59bc[_0x3226('0x47')]['WhatsappInteractionId']=_0x36c6e7['id'];if(_0x23de10[_0x3226('0x3c')][_0x3226('0x85')]){_0xfa59bc[_0x3226('0x47')]=_['merge'](_0xfa59bc['where'],{'$or':_[_0x3226('0x2f')](_0xfa59bc[_0x3226('0x40')],function(_0x35b6da){var _0x4f6628={};_0x4f6628[_0x35b6da]={'$like':'%'+_0x23de10[_0x3226('0x3c')][_0x3226('0x85')]+'%'};return _0x4f6628;})});}if(_0x23de10[_0x3226('0x3c')][_0x3226('0x7c')]){var _0x2fb2f3=_0x23de10['query'][_0x3226('0x7c')]['split'](',');var _0x3bac02={};_0x3bac02[_0x2fb2f3[0x0]]={'$gte':moment(_0x2fb2f3[0x1])[_0x3226('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')};_0xfa59bc[_0x3226('0x47')]=_['merge'](_0xfa59bc[_0x3226('0x47')],_0x3bac02);}_0xfa59bc=_[_0x3226('0x9c')]({},_0xfa59bc,_0x23de10[_0x3226('0xb6')]);return db[_0x3226('0xbb')][_0x3226('0x25')]({'where':_0xfa59bc[_0x3226('0x47')]})[_0x3226('0x2a')](function(_0x567076){_0x2e4f13[_0x3226('0x25')]=_0x567076;if(_0x23de10[_0x3226('0x3c')][_0x3226('0xb4')]){_0xfa59bc[_0x3226('0xb5')]=[{'all':!![]}];}return db[_0x3226('0xbb')][_0x3226('0xc3')](_0xfa59bc);})[_0x3226('0x2a')](function(_0x23a743){_0x2e4f13[_0x3226('0xc4')]=_0x23a743;return _0x2e4f13;});}})[_0x3226('0x2a')](respondWithFilteredResult(_0x4fe766,_0xfa59bc))[_0x3226('0x36')](handleError(_0x4fe766,null));};exports[_0x3226('0xc5')]=function(_0x33a126,_0x4d553e,_0x127bf8){return db[_0x3226('0x38')][_0x3226('0x60')]({'where':{'id':_0x33a126['params']['id']}})[_0x3226('0x2a')](handleEntityNotFound(_0x4d553e,null))[_0x3226('0x2a')](function(_0x58065a){if(_0x58065a){return _0x58065a[_0x3226('0xc6')](_0x33a126['body']['ids'],_['omit'](_0x33a126[_0x3226('0x73')],[_0x3226('0xbd'),'id'])||{})[_0x3226('0xc7')](function(){return db['Tag'][_0x3226('0xc3')]({'attributes':['id','name',_0x3226('0x4a')],'where':{'id':_0x33a126['body'][_0x3226('0xbd')]}});})[_0x3226('0x2a')](function(_0x3b0a9b){socket['emit'](_0x3226('0xc8'),{'id':Number(_0x33a126[_0x3226('0xb3')]['id']),'tags':_0x3b0a9b||[]});return{'id':Number(_0x33a126['params']['id']),'tags':_0x3b0a9b||[]};});}})[_0x3226('0x2a')](respondWithResult(_0x4d553e,null))['catch'](handleError(_0x4d553e,null));};exports['removeTags']=function(_0xce6ca,_0x4272e8,_0x556303){return db[_0x3226('0x38')][_0x3226('0x60')]({'where':{'id':_0xce6ca[_0x3226('0xb3')]['id']}})['then'](handleEntityNotFound(_0x4272e8,null))['then'](function(_0x4ed636){if(_0x4ed636){return _0x4ed636[_0x3226('0xc9')](_0xce6ca['query'][_0x3226('0xbd')]);}})[_0x3226('0x2a')](respondWithStatusCode(_0x4272e8,null))[_0x3226('0x36')](handleError(_0x4272e8,null));};exports[_0x3226('0xca')]=function(_0x197193,_0x35a03a){var _0x911078=moment()['unix']()[_0x3226('0x99')]();var _0x2223b9=path['join'](config[_0x3226('0xcb')],_0x3226('0xcc'),_0x3226('0xcd'),_0x3226('0xce'));var _0xddc9dc=path['join'](config[_0x3226('0xcb')],_0x3226('0xcc'),'files','attachments');var _0x12d587=path[_0x3226('0xcf')](_0x2223b9,_0x911078);var _0x596c58=util[_0x3226('0xc2')]('transcript-%d-%s.zip',_0x197193['params']['id'],_0x911078);var _0x2f429d=path[_0x3226('0xcf')](_0x2223b9,_0x596c58);var _0x2d3f51=[];_0x2d3f51[_0x3226('0x35')]({'model':db[_0x3226('0x70')],'as':_0x3226('0x70'),'attributes':['id',_0x3226('0x30')],'raw':!![]});_0x2d3f51[_0x3226('0x35')]({'model':db[_0x3226('0xd0')],'as':_0x3226('0x65'),'attributes':['id',_0x3226('0xd1'),'lastName'],'raw':!![]});if(_0x197193[_0x3226('0x3c')]['attachments']){_0x2d3f51[_0x3226('0x35')]({'model':db[_0x3226('0xd2')],'as':_0x3226('0xd2'),'raw':!![]});}var _0x42a948=[{'model':db[_0x3226('0xbb')],'as':_0x3226('0xd3'),'attributes':['id',_0x3226('0x73'),_0x3226('0x7a'),_0x3226('0xd4'),_0x3226('0xd5'),_0x3226('0x80')],'include':_0x2d3f51}];_0x42a948[_0x3226('0x35')]({'model':db['WhatsappAccount'],'as':_0x3226('0xd6'),'attributes':['id',_0x3226('0x2c')]});_0x42a948['push']({'model':db['User'],'as':_0x3226('0xd7'),'attributes':['id',_0x3226('0x30')]});return db['WhatsappInteraction'][_0x3226('0x60')]({'where':{'id':_0x197193[_0x3226('0xb3')]['id']},'include':_0x42a948})[_0x3226('0x2a')](handleEntityNotFound(_0x35a03a,null))[_0x3226('0x2a')](function(_0x52876f){if(_0x52876f){var _0x33fa48=_0x52876f[_0x3226('0xd8')]({'plain':!![]});fs[_0x3226('0xd9')](_0x12d587);var _0x2468b4={'channel':_0x3226('0xda'),'account':_0x33fa48['Account'][_0x3226('0x2c')],'agent':_0x33fa48[_0x3226('0xd7')]?_0x33fa48[_0x3226('0xd7')][_0x3226('0x30')]:'N.A.','createdAt':moment(_0x33fa48[_0x3226('0x7a')])[_0x3226('0xc2')]('YYYY-MM-DD\x20HH:mm:ss')[_0x3226('0x99')](),'closedAt':_0x33fa48[_0x3226('0xdb')]?moment(_0x33fa48['closedAt'])[_0x3226('0xc2')](_0x3226('0xdc'))['toString']():'','disposition':_0x33fa48[_0x3226('0xdd')],'messages':_(_0x33fa48['Messages'])['filter']({'secret':![]})['map'](function(_0x10d063){if(_0x10d063[_0x3226('0xd2')]){var _0x385296=path['join'](_0xddc9dc,_0x10d063[_0x3226('0xd2')]['basename']);if(fs[_0x3226('0xde')](_0x385296)){fs['createReadStream'](_0x385296)[_0x3226('0xdf')](fs[_0x3226('0xe0')](path['join'](_0x12d587,_0x10d063[_0x3226('0xd2')][_0x3226('0xe1')])));}}return{'date':moment(_0x10d063[_0x3226('0x7a')])['format'](_0x3226('0xdc'))[_0x3226('0x99')](),'sender':_0x10d063[_0x3226('0xd4')]===_0x3226('0xe2')?_0x10d063[_0x3226('0x70')]?_0x10d063['User'][_0x3226('0x30')]:'System':_0x10d063['Contact'][_0x3226('0xd1')]+(_0x10d063[_0x3226('0x65')][_0x3226('0xe3')]?'\x20'+_0x10d063[_0x3226('0x65')]['lastName']:''),'body':_0x10d063[_0x3226('0xd2')]?_0x10d063[_0x3226('0xd2')][_0x3226('0xe1')]:_0x10d063[_0x3226('0x73')],'direction':_0x10d063[_0x3226('0xd4')]===_0x3226('0xe2')?'A':'C','secret':_0x10d063[_0x3226('0xd5')],'read':_0x10d063[_0x3226('0x80')],'attachment':_0x10d063[_0x3226('0xd2')]};})[_0x3226('0x62')]()};return ejs[_0x3226('0xe4')](path['join'](config[_0x3226('0xcb')],'server',_0x3226('0xe5'),_0x3226('0xe6')),{'interaction':_0x2468b4})['then'](function(_0xb923b6){var _0x3e0f1a=path[_0x3226('0xcf')](_0x12d587,_0x3226('0xe7')+_0x33fa48['id']+'-'+_0x911078+_0x3226('0xe8'));var _0x2410fa={'path':_0x3e0f1a,'channel':'Whatsapp','interactionId':_0x33fa48['id']};return pdf[_0x3226('0xe9')](_0xb923b6,_0x2410fa);})[_0x3226('0x2a')](function(){return new BPromise(function(_0x7abea6,_0x63180e){zipdir(_0x12d587,{'saveTo':_0x2f429d},function(_0x475b05,_0x1d13d0){if(_0x475b05)return _0x63180e(_0x475b05);return _0x7abea6(_0x1d13d0);});})[_0x3226('0x2a')](function(){return new BPromise(function(_0x87f7ad,_0x31b33f){rimraf(_0x12d587,function(_0x2a5844){if(_0x2a5844)_0x31b33f(_0x2a5844);return _0x87f7ad();});});})['then'](function(){return _0x35a03a['download'](_0x2f429d,_0x596c58,function(_0x3dd831){if(_0x3dd831){console[_0x3226('0xea')](_0x3226('0xeb'),_0x3dd831);}else{fs[_0x3226('0xec')](_0x2f429d);}});});});}else{return _0x35a03a[_0x3226('0x1e')](0xc8);}})[_0x3226('0x36')](handleError(_0x35a03a,null));}; \ No newline at end of file +var _0x66e5=['map','WhatsappInteraction','rawAttributes','fieldName','type','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','field','color','from','select','users','u.id\x20=\x20ui.UserId','whatsapp_interactions','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','left_join','o.id\x20=\x20i.UserId','whatsapp_accounts','a.id\x20=\x20i.WhatsappAccountId','whatsapp_messages','me.WhatsappInteractionId\x20=\x20i.id','whatsapp_interaction_has_tags','it.WhatsappInteractionId\x20=\x20i.id','tools_tags','t.id\x20=\x20it.TagId','expr','search','sqlOperator','conditions','find','unreadMessages','value','`\x20=\x200','`\x20>\x200','Contact','operator','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','$substring','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','body','keys','some','compact','i.WhatsappAccountId\x20IN\x20?','concat','parse','$gte','null','\x20IS\x20NULL','\x20=\x20?','having','`unreadMessages`\x20>\x200','tag','filter','replace','isNumeric','i.id\x20LIKE\x20?','i.phone\x20LIKE\x20?','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','CONCAT(c.firstName,\x20\x27\x20\x27,\x20c.lastName)\x20LIKE\x20?','group','i.id','QueryTypes','SELECT','order','contactName','DESC','t.id\x20IN\x20?','resolve','i.WhatsappAccountId\x20IS\x20NOT\x20NULL','role','agent','user','isEmpty','i.WhatsappAccountId\x20IS\x20NULL','WhatsappAccountId','toString','sequelize','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','c.firstName','Contact.firstName','Contact.email','c.phone','Contact.phone','c.mobile','Contact.mobile','c.fax','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','ui.WhatsappInteractionId\x20IN\x20?','groupBy','all','rows','show','params','includeAll','include','merge','options','create','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','WhatsappInteractionId','YYYY-MM-DD\x20HH:mm:ss','findAll','addTags','setTags','spread','whatsappInteractionTags:save','removeTags','download','root','server','files','join','attachments','format','transcript-%d-%s.zip','CmContact','firstName','lastName','Attachment','Messages','createdAt','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','closed','closedAt','disposition','basename','existsSync','createReadStream','pipe','out','System','renderFile','views','downloadInteraction.ejs','.pdf','log','err','unlinkSync','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','status','json','offset','undefined','limit','count','Content-Range','save','update','destroy','then','end','sendStatus','name','send','Users','fullname','TagIds','split','Tags','push','catch','index'];(function(_0x2acc06,_0x3f9dcf){var _0x18ad24=function(_0x440536){while(--_0x440536){_0x2acc06['push'](_0x2acc06['shift']());}};_0x18ad24(++_0x3f9dcf);}(_0x66e5,0x1a2));var _0x566e=function(_0x5b2e3d,_0x2d7f7b){_0x5b2e3d=_0x5b2e3d-0x0;var _0x35a13c=_0x66e5[_0x5b2e3d];return _0x35a13c;};'use strict';var emlformat=require(_0x566e('0x0'));var rimraf=require(_0x566e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x566e('0x2'));var rp=require('request-promise');var moment=require(_0x566e('0x3'));var BPromise=require(_0x566e('0x4'));var Mustache=require(_0x566e('0x5'));var util=require(_0x566e('0x6'));var path=require(_0x566e('0x7'));var sox=require('sox');var csv=require(_0x566e('0x8'));var ejs=require(_0x566e('0x9'));var fs=require('fs');var fs_extra=require(_0x566e('0xa'));var _=require(_0x566e('0xb'));var squel=require(_0x566e('0xc'));var crypto=require(_0x566e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x566e('0xe'));var toCsv=require(_0x566e('0x8'));var querystring=require(_0x566e('0xf'));var Papa=require('papaparse');var Redis=require(_0x566e('0x10'));var authService=require(_0x566e('0x11'));var qs=require(_0x566e('0x12'));var as=require(_0x566e('0x13'));var pdf=require('../../components/export/pdf');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x566e('0x14'));var utils=require(_0x566e('0x15'));var config=require(_0x566e('0x16'));var licenseUtil=require(_0x566e('0x17'));var db=require(_0x566e('0x18'))['db'];config[_0x566e('0x19')]=_['defaults'](config['redis'],{'host':_0x566e('0x1a'),'port':0x18eb});var socket=require(_0x566e('0x1b'))(new Redis(config[_0x566e('0x19')]));require('./whatsappInteraction.socket')[_0x566e('0x1c')](socket);function respondWithStatusCode(_0x2a44e8,_0x50300c){_0x50300c=_0x50300c||0xcc;return function(_0x141f07){if(_0x141f07){return _0x2a44e8['sendStatus'](_0x50300c);}return _0x2a44e8[_0x566e('0x1d')](_0x50300c)['end']();};}function respondWithResult(_0x3ae804,_0xdb7230){_0xdb7230=_0xdb7230||0xc8;return function(_0x35ebcb){if(_0x35ebcb){return _0x3ae804[_0x566e('0x1d')](_0xdb7230)[_0x566e('0x1e')](_0x35ebcb);}};}function respondWithFilteredResult(_0x53323a,_0x214496){return function(_0x177a2b){if(_0x177a2b){var _0x1290cc=typeof _0x214496[_0x566e('0x1f')]===_0x566e('0x20')&&typeof _0x214496[_0x566e('0x21')]==='undefined';var _0x34f0ed=_0x177a2b[_0x566e('0x22')];var _0x38d936=_0x1290cc?0x0:_0x214496['offset'];var _0x17ae78=_0x1290cc?_0x177a2b[_0x566e('0x22')]:_0x214496[_0x566e('0x1f')]+_0x214496[_0x566e('0x21')];var _0x47074e;if(_0x17ae78>=_0x34f0ed){_0x17ae78=_0x34f0ed;_0x47074e=0xc8;}else{_0x47074e=0xce;}_0x53323a[_0x566e('0x1d')](_0x47074e);return _0x53323a['set'](_0x566e('0x23'),_0x38d936+'-'+_0x17ae78+'/'+_0x34f0ed)[_0x566e('0x1e')](_0x177a2b);}return null;};}function patchUpdates(_0xc2122f){return function(_0x556c2d){try{jsonpatch['apply'](_0x556c2d,_0xc2122f,!![]);}catch(_0x1fea0b){return BPromise['reject'](_0x1fea0b);}return _0x556c2d[_0x566e('0x24')]();};}function saveUpdates(_0x316f69,_0x36a9ea){return function(_0x4c731f){if(_0x4c731f){return _0x4c731f[_0x566e('0x25')](_0x316f69)['then'](function(_0xcf1888){return _0xcf1888;});}return null;};}function removeEntity(_0x4d4200,_0x46b72c){return function(_0x347ce1){if(_0x347ce1){return _0x347ce1[_0x566e('0x26')]()[_0x566e('0x27')](function(){_0x4d4200[_0x566e('0x1d')](0xcc)[_0x566e('0x28')]();});}};}function handleEntityNotFound(_0x29c8bb,_0x20605b){return function(_0x1546f2){if(!_0x1546f2){_0x29c8bb[_0x566e('0x29')](0x194);}return _0x1546f2;};}function handleError(_0x56f93e,_0x31e4ea){_0x31e4ea=_0x31e4ea||0x1f4;return function(_0x523dc4){logger['error'](_0x523dc4['stack']);if(_0x523dc4[_0x566e('0x2a')]){delete _0x523dc4[_0x566e('0x2a')];}_0x56f93e['status'](_0x31e4ea)[_0x566e('0x2b')](_0x523dc4);};}function getInteractionUsers(_0x5935fc,_0xda9961){return new BPromise(function(_0x1fd4ea,_0x453f5e){try{if(_0xda9961[_0x5935fc['id']]){_0x5935fc[_0x566e('0x2c')]=_['map'](_0xda9961[_0x5935fc['id']],function(_0x17072c){return{'id':_0x17072c['id'],'fullname':_0x17072c[_0x566e('0x2d')]};});}}catch(_0x13782d){_0x453f5e(_0x13782d);}_0x1fd4ea(_0x5935fc);});}function getInteractionTags(_0x2df0c5,_0x8da128){return new BPromise(function(_0x4b75a2,_0x4048f3){try{if(_0x2df0c5[_0x566e('0x2e')]){_0x2df0c5['Tags']=[];_0x2df0c5[_0x566e('0x2e')][_0x566e('0x2f')](',')['forEach'](function(_0x4b9c40){_0x2df0c5[_0x566e('0x30')][_0x566e('0x31')](_0x8da128[_0x4b9c40]);});}delete _0x2df0c5[_0x566e('0x2e')];}catch(_0x27844f){_0x4048f3(_0x27844f);}_0x4b75a2(_0x2df0c5);});}function updateWhatsappInteraction(_0x5e7f78,_0x166d95,_0x416b3a){return new BPromise(function(_0x420139,_0x449ffa){return getInteractionUsers(_0x5e7f78,_0x416b3a)['then'](function(_0xffeda5){return getInteractionTags(_0xffeda5,_0x166d95);})[_0x566e('0x27')](function(_0x43c1fb){_0x420139(_0x43c1fb);})[_0x566e('0x32')](function(_0x15ee39){_0x449ffa(_0x15ee39);});});}exports[_0x566e('0x33')]=function(_0x3b7b12,_0x150ffc){var _0x3d676e={},_0x1389ce={},_0x57f3c3={'count':0x0,'rows':[]};var _0x55f7a9=_[_0x566e('0x34')](db[_0x566e('0x35')][_0x566e('0x36')],function(_0x5eae25){return{'name':_0x5eae25[_0x566e('0x37')],'type':_0x5eae25[_0x566e('0x38')]['key']};});_0x1389ce['model']=_[_0x566e('0x34')](_0x55f7a9,_0x566e('0x2a'));_0x1389ce[_0x566e('0x39')]=_['keys'](_0x3b7b12[_0x566e('0x39')]);_0x1389ce[_0x566e('0x3a')]=_[_0x566e('0x3b')](_0x1389ce[_0x566e('0x3c')],_0x1389ce[_0x566e('0x39')]);_0x3d676e[_0x566e('0x3d')]=_[_0x566e('0x3b')](_0x1389ce[_0x566e('0x3c')],qs[_0x566e('0x3e')](_0x3b7b12['query'][_0x566e('0x3e')]));_0x3d676e['attributes']=_0x3d676e[_0x566e('0x3d')][_0x566e('0x3f')]?_0x3d676e[_0x566e('0x3d')]:_0x1389ce[_0x566e('0x3c')];if(!_0x3b7b12['query'][_0x566e('0x40')](_0x566e('0x41'))){_0x3d676e[_0x566e('0x21')]=qs[_0x566e('0x21')](_0x3b7b12['query']['limit']);_0x3d676e[_0x566e('0x1f')]=qs[_0x566e('0x1f')](_0x3b7b12[_0x566e('0x39')]['offset']);}_0x3d676e['order']=qs['sort'](_0x3b7b12[_0x566e('0x39')][_0x566e('0x42')]);_0x3d676e[_0x566e('0x43')]=qs[_0x566e('0x3a')](_[_0x566e('0x44')](_0x3b7b12[_0x566e('0x39')],_0x1389ce[_0x566e('0x3a')]),_0x55f7a9);var _0x1b9f4c=[];var _0x2069d2=squel['select']()['field']('id')[_0x566e('0x45')](_0x566e('0x2a'))['field'](_0x566e('0x46'))[_0x566e('0x47')]('tools_tags');var _0x1deac8=squel[_0x566e('0x48')]()[_0x566e('0x45')]('u.id')[_0x566e('0x45')]('u.fullname')[_0x566e('0x45')]('ui.WhatsappInteractionId')[_0x566e('0x47')]('user_has_whatsapp_interactions','ui')['left_join'](_0x566e('0x49'),'u',_0x566e('0x4a'));var _0x44d76c=squel[_0x566e('0x48')]()[_0x566e('0x47')](_0x566e('0x4b'),'i')['left_join']('cm_contacts','c',_0x566e('0x4c'))[_0x566e('0x4d')](_0x566e('0x49'),'o',_0x566e('0x4e'))[_0x566e('0x4d')](_0x566e('0x4f'),'a',_0x566e('0x50'))[_0x566e('0x4d')](_0x566e('0x51'),'me',_0x566e('0x52'))[_0x566e('0x4d')](_0x566e('0x53'),'it',_0x566e('0x54'))[_0x566e('0x4d')](_0x566e('0x55'),'t',_0x566e('0x56'));var _0x4e2bea=squel[_0x566e('0x57')]();var _0x1ad6c0=[];var _0x47577e=squel[_0x566e('0x57')]();var _0x28f8c2;if(_0x3b7b12[_0x566e('0x39')]['search']){_0x28f8c2=as['parseSearch'](_0x3b7b12[_0x566e('0x39')][_0x566e('0x58')]);var _0x29ab83=_0x28f8c2[_0x566e('0x59')];for(var _0x1ca2a0=0x0;_0x1ca2a0<_0x28f8c2[_0x566e('0x5a')][_0x566e('0x3f')];_0x1ca2a0++){var _0x3c1e71=_0x28f8c2[_0x566e('0x5a')][_0x1ca2a0];var _0xb8ef53='i';var _0x259dfe=_[_0x566e('0x5b')](_0x55f7a9,[_0x566e('0x2a'),_0x3c1e71[_0x566e('0x45')]]);if(!_0x259dfe){switch(_0x3c1e71[_0x566e('0x45')]){case _0x566e('0x5c'):if(_0x3c1e71[_0x566e('0x5d')]==0x1){_0x44d76c['having']('`'+_0x3c1e71[_0x566e('0x45')]+_0x566e('0x5e'));}else{_0x44d76c['having']('`'+_0x3c1e71[_0x566e('0x45')]+_0x566e('0x5f'));}break;case _0x566e('0x60'):if(_0x3c1e71[_0x566e('0x61')]==='$substring'){if(_0x3c1e71[_0x566e('0x5d')]['split']('\x20')[_0x566e('0x3f')]>0x1){_0x4e2bea[_0x29ab83]('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs['getFullTextValue'](_0x3c1e71['value']),null);}else{var _0x1f0c62='%'+_0x3c1e71['value']+'%';_0x4e2bea[_0x29ab83](_0x566e('0x62'),_0x1f0c62,_0x1f0c62,_0x1f0c62);}}else{_0x259dfe=_[_0x566e('0x5b')](_0x55f7a9,[_0x566e('0x2a'),_0x566e('0x63')]);_0x3c1e71['field']=_0x566e('0x63');_0x3198f6=as[_0x566e('0x64')](_0xb8ef53,_0x259dfe[_0x566e('0x38')],_0x3c1e71);_0x4e2bea[_0x29ab83](_0x3198f6[_0x566e('0x65')],_0x3198f6[_0x566e('0x5d')][_0x566e('0x66')],_0x3198f6[_0x566e('0x5d')][_0x566e('0x28')]);}break;case _0x566e('0x67'):var _0x3ec4d7=_0x3c1e71[_0x566e('0x5d')]['split'](',')[_0x566e('0x34')](function(_0x2aa1ff){return Number(_0x2aa1ff);});_0x3ec4d7[_0x566e('0x68')](function(_0x58dfcb){_0x47577e['or'](_0x566e('0x69'),'%,'+_0x58dfcb+',%');});_0x1ad6c0=_[_0x566e('0x6a')](_0x1ad6c0,_0x3ec4d7);break;case _0x566e('0x6b'):if(_0x3c1e71[_0x566e('0x61')]===_0x566e('0x6c')){_0x4e2bea[_0x29ab83](_0x566e('0x6d'),'%'+_0x3c1e71[_0x566e('0x5d')]+'%',null);}else{_0x259dfe=_['find'](_0x55f7a9,[_0x566e('0x2a'),_0x566e('0x6e')]);_0x3c1e71[_0x566e('0x45')]=_0x566e('0x6e');_0x3198f6=as['buildExpression'](_0xb8ef53,_0x259dfe[_0x566e('0x38')],_0x3c1e71);_0x4e2bea[_0x29ab83](_0x3198f6[_0x566e('0x65')],_0x3198f6[_0x566e('0x5d')][_0x566e('0x66')],_0x3198f6['value'][_0x566e('0x28')]);}break;case _0x566e('0x6f'):_0x3198f6=as[_0x566e('0x64')]('me',null,_0x3c1e71);_0x4e2bea[_0x29ab83](_0x3198f6[_0x566e('0x65')],_0x3198f6[_0x566e('0x5d')][_0x566e('0x66')],_0x3198f6['value'][_0x566e('0x28')]);break;}}else{var _0x3198f6=as[_0x566e('0x64')](_0xb8ef53,_0x259dfe['type'],_0x3c1e71);_0x4e2bea[_0x29ab83](_0x3198f6[_0x566e('0x65')],_0x3198f6['value']['start'],_0x3198f6[_0x566e('0x5d')][_0x566e('0x28')]);}}}else{var _0x3c4af6=_(_0x3b7b12[_0x566e('0x39')])[_0x566e('0x70')]()[_0x566e('0x34')](function(_0x405f7e){return _[_0x566e('0x71')](_0x55f7a9,[_0x566e('0x2a'),_0x405f7e])?_0x405f7e:undefined;})[_0x566e('0x72')]()[_0x566e('0x5d')]();if(!_['isEmpty'](_0x3c4af6)){_0x3c4af6['forEach'](function(_0x12ef81){if(_0x12ef81==='WhatsappAccountId'){_0x44d76c['where'](_0x566e('0x73'),[][_0x566e('0x74')](_0x3b7b12[_0x566e('0x39')][_0x12ef81]));}else if(_0x12ef81==='createdAt'){var _0x2dbb40=JSON[_0x566e('0x75')](_0x3b7b12[_0x566e('0x39')][_0x12ef81])[_0x566e('0x76')];var _0xa859cf=JSON['parse'](_0x3b7b12['query'][_0x12ef81])['$lte'];_0x44d76c[_0x566e('0x43')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2dbb40,_0xa859cf);}else{if(_0x3b7b12[_0x566e('0x39')][_0x12ef81]===_0x566e('0x77')){_0x44d76c[_0x566e('0x43')]('i.'+_0x12ef81+_0x566e('0x78'));}else{_0x44d76c[_0x566e('0x43')]('i.'+_0x12ef81+_0x566e('0x79'),_0x3b7b12[_0x566e('0x39')][_0x12ef81]);}}});}if(_0x3b7b12[_0x566e('0x39')]['read']){if(_0x3b7b12[_0x566e('0x39')]['read']==0x1){_0x44d76c[_0x566e('0x7a')]('`unreadMessages`\x20=\x200');}else{_0x44d76c[_0x566e('0x7a')](_0x566e('0x7b'));}}if(_0x3b7b12[_0x566e('0x39')][_0x566e('0x7c')]){_0x1ad6c0=_['isArray'](_0x3b7b12[_0x566e('0x39')]['tag'])?_0x3b7b12[_0x566e('0x39')]['tag']:new Array(_0x3b7b12[_0x566e('0x39')][_0x566e('0x7c')]);_0x1ad6c0['forEach'](function(_0x537dff){_0x47577e['or'](_0x566e('0x69'),'%,'+_0x537dff+',%');});}if(_0x3b7b12[_0x566e('0x39')][_0x566e('0x7d')]){var _0x525d93=_0x3b7b12['query'][_0x566e('0x7d')][_0x566e('0x7e')]('\x5c','\x5c\x5c')[_0x566e('0x7e')](/'/g,'\x27\x27');if(qs[_0x566e('0x7f')](_0x525d93)){_0x4e2bea['or'](_0x566e('0x80'),_0x525d93+'%')['or'](_0x566e('0x81'),_0x525d93+'%');}else{_0x4e2bea['or'](_0x566e('0x82'),qs['getFullTextValue'](_0x525d93))['or'](_0x566e('0x83'),_0x525d93+'%');}}}_0x44d76c[_0x566e('0x43')](_0x4e2bea);_0x44d76c[_0x566e('0x84')](_0x566e('0x85'));var _0x4fa4f6={'type':db['Sequelize'][_0x566e('0x86')][_0x566e('0x87')],'raw':!![]};var _0x573e1c=_0x44d76c['clone']();_0x573e1c[_0x566e('0x45')](_0x566e('0x85'));_0x573e1c['field']('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x566e('0x5c'));if(_0x3d676e[_0x566e('0x88')]){_0x3d676e['order'][_0x566e('0x68')](function(_0x30eae2){var _0x19f2a7=_0x30eae2[0x0]===_0x566e('0x89')?_0x30eae2[0x0]:'i.'+_0x30eae2[0x0];_0x44d76c[_0x566e('0x88')](_0x19f2a7,_0x30eae2[0x1]===_0x566e('0x8a')?![]:!![]);});}if(!_['isEmpty'](_0x1ad6c0)){_0x44d76c[_0x566e('0x7a')](_0x47577e);_0x573e1c[_0x566e('0x43')](_0x566e('0x8b'),_0x1ad6c0);}BPromise[_0x566e('0x8c')]()['then'](function(){if(!_0x28f8c2){if(_0x3b7b12[_0x566e('0x39')]['WhatsappAccountId'])return;_0x573e1c[_0x566e('0x43')](_0x566e('0x8d'));_0x44d76c[_0x566e('0x43')](_0x566e('0x8d'));return;}if(_0x3b7b12['user'][_0x566e('0x8e')]!==_0x566e('0x8f'))return;return _0x3b7b12[_0x566e('0x90')]['getWhatsappAccounts']({'attributes':['id'],'raw':!![]})[_0x566e('0x27')](function(_0x7b4e1a){if(_[_0x566e('0x91')](_0x7b4e1a)){_0x573e1c[_0x566e('0x43')](_0x566e('0x92'));_0x44d76c['where']('i.WhatsappAccountId\x20IS\x20NULL');}else{_0x573e1c[_0x566e('0x43')](_0x566e('0x73'),_[_0x566e('0x34')](_0x7b4e1a,'id'));_0x44d76c[_0x566e('0x43')](_0x566e('0x73'),_['map'](_0x7b4e1a,'id'));}});})['then'](function(){if(_0x3b7b12[_0x566e('0x90')]['role']===_0x566e('0x8f')&&!_0x28f8c2&&!_0x3b7b12[_0x566e('0x39')][_0x566e('0x93')])return[];return db['sequelize'][_0x566e('0x39')](_0x573e1c[_0x566e('0x94')](),_0x4fa4f6);})[_0x566e('0x27')](function(_0x349284){_0x57f3c3[_0x566e('0x22')]=_0x349284[_0x566e('0x3f')];if(_0x57f3c3['count']===0x0)return[];return db[_0x566e('0x95')][_0x566e('0x39')](_0x2069d2[_0x566e('0x94')](),_0x4fa4f6)['then'](function(_0x98794b){_0x1b9f4c=_[_0x566e('0x96')](_0x98794b,'id');_0x4fa4f6=_['merge'](_0x4fa4f6,{'model':db[_0x566e('0x35')],'mapToModel':!![],'raw':!![],'nest':!![]});if(_0x3b7b12['query'][_0x566e('0x3e')]){_0x3d676e['attributes'][_0x566e('0x68')](function(_0x173e7d){_0x44d76c[_0x566e('0x45')]('i.'+_0x173e7d);});}else{_0x44d76c[_0x566e('0x45')](_0x566e('0x97'),_0x566e('0x5c'));_0x44d76c['field'](_0x566e('0x98'),_0x566e('0x99'));_0x44d76c[_0x566e('0x45')]('a.mandatoryDisposition',_0x566e('0x9a'));_0x44d76c[_0x566e('0x45')](_0x566e('0x9b'),'contactName');_0x44d76c['field']('i.*');_0x44d76c[_0x566e('0x45')](_0x566e('0x9c'),_0x566e('0x9d'));_0x44d76c['field']('c.lastName','Contact.lastName');_0x44d76c[_0x566e('0x45')]('c.email',_0x566e('0x9e'));_0x44d76c[_0x566e('0x45')](_0x566e('0x9f'),_0x566e('0xa0'));_0x44d76c[_0x566e('0x45')](_0x566e('0xa1'),_0x566e('0xa2'));_0x44d76c[_0x566e('0x45')](_0x566e('0xa3'),_0x566e('0xa4'));_0x44d76c[_0x566e('0x45')](_0x566e('0xa5'),_0x566e('0xa6'));_0x44d76c[_0x566e('0x45')](_0x566e('0xa7'),'Owner.internal');_0x44d76c[_0x566e('0x45')](_0x566e('0xa8'),'TagIds');}if(_0x3d676e[_0x566e('0x21')])_0x44d76c[_0x566e('0x21')](_0x3d676e[_0x566e('0x21')]);if(_0x3d676e[_0x566e('0x1f')])_0x44d76c[_0x566e('0x1f')](_0x3d676e[_0x566e('0x1f')]);return db[_0x566e('0x95')][_0x566e('0x39')](_0x44d76c[_0x566e('0x94')](),_0x4fa4f6);})[_0x566e('0x27')](function(_0x59b61b){if(_0x59b61b[_0x566e('0x3f')]>0x0)_0x1deac8[_0x566e('0x43')](_0x566e('0xa9'),_[_0x566e('0x34')](_0x59b61b,'id'));return db[_0x566e('0x95')][_0x566e('0x39')](_0x1deac8[_0x566e('0x94')](),_0x4fa4f6)['then'](function(_0x57b6fe){var _0x3df5cb=_[_0x566e('0xaa')](_0x57b6fe,'WhatsappInteractionId');var _0xbc137e=[];_0x59b61b[_0x566e('0x68')](function(_0x4c7cd5){_0xbc137e[_0x566e('0x31')](updateWhatsappInteraction(_0x4c7cd5,_0x1b9f4c,_0x3df5cb));});return BPromise[_0x566e('0xab')](_0xbc137e);});});})[_0x566e('0x27')](function(_0x40abc0){_0x57f3c3[_0x566e('0xac')]=_0x40abc0;return _0x57f3c3;})[_0x566e('0x27')](respondWithFilteredResult(_0x150ffc,_0x3d676e))[_0x566e('0x32')](handleError(_0x150ffc,null));};exports[_0x566e('0xad')]=function(_0x4ff032,_0x2fda9c){var _0x43f177={'raw':![],'where':{'id':_0x4ff032[_0x566e('0xae')]['id']}},_0x23ce51={};_0x23ce51[_0x566e('0x3c')]=_[_0x566e('0x70')](db[_0x566e('0x35')][_0x566e('0x36')]);_0x23ce51[_0x566e('0x39')]=_[_0x566e('0x70')](_0x4ff032[_0x566e('0x39')]);_0x23ce51[_0x566e('0x3a')]=_[_0x566e('0x3b')](_0x23ce51[_0x566e('0x3c')],_0x23ce51[_0x566e('0x39')]);_0x43f177[_0x566e('0x3d')]=_[_0x566e('0x3b')](_0x23ce51[_0x566e('0x3c')],qs[_0x566e('0x3e')](_0x4ff032[_0x566e('0x39')]['fields']));_0x43f177[_0x566e('0x3d')]=_0x43f177[_0x566e('0x3d')][_0x566e('0x3f')]?_0x43f177[_0x566e('0x3d')]:_0x23ce51[_0x566e('0x3c')];if(_0x4ff032[_0x566e('0x39')][_0x566e('0xaf')]){_0x43f177[_0x566e('0xb0')]=[{'all':!![]}];}_0x43f177=_[_0x566e('0xb1')]({},_0x43f177,_0x4ff032[_0x566e('0xb2')]);return db[_0x566e('0x35')][_0x566e('0x5b')](_0x43f177)[_0x566e('0x27')](handleEntityNotFound(_0x2fda9c,null))[_0x566e('0x27')](respondWithResult(_0x2fda9c,null))[_0x566e('0x32')](handleError(_0x2fda9c,null));};exports['create']=function(_0x486423,_0x1e09fd){return db['WhatsappInteraction'][_0x566e('0xb3')](_0x486423[_0x566e('0x6f')],{})[_0x566e('0x27')](respondWithResult(_0x1e09fd,0xc9))[_0x566e('0x32')](handleError(_0x1e09fd,null));};exports[_0x566e('0x25')]=function(_0x26e1cc,_0x5193b6){if(_0x26e1cc[_0x566e('0x6f')]['id']){delete _0x26e1cc[_0x566e('0x6f')]['id'];}return db[_0x566e('0x35')][_0x566e('0x5b')]({'where':{'id':_0x26e1cc[_0x566e('0xae')]['id']}})[_0x566e('0x27')](handleEntityNotFound(_0x5193b6,null))[_0x566e('0x27')](saveUpdates(_0x26e1cc[_0x566e('0x6f')],null))[_0x566e('0x27')](respondWithResult(_0x5193b6,null))[_0x566e('0x32')](handleError(_0x5193b6,null));};exports[_0x566e('0x26')]=function(_0x38965f,_0x5891b5){return db[_0x566e('0x35')][_0x566e('0x5b')]({'where':{'id':_0x38965f[_0x566e('0xae')]['id']}})[_0x566e('0x27')](handleEntityNotFound(_0x5891b5,null))[_0x566e('0x27')](removeEntity(_0x5891b5,null))['catch'](handleError(_0x5891b5,null));};exports['describe']=function(_0x3f7ade,_0x569d2a){return db[_0x566e('0x35')][_0x566e('0xb4')]()[_0x566e('0x27')](respondWithResult(_0x569d2a,null))[_0x566e('0x32')](handleError(_0x569d2a,null));};exports[_0x566e('0xb5')]=function(_0x34181e,_0x2db283,_0x376f1a){return db[_0x566e('0xb6')][_0x566e('0x5b')]({'where':{'id':_0x34181e[_0x566e('0xae')]['id']}})[_0x566e('0x27')](handleEntityNotFound(_0x2db283,null))[_0x566e('0x27')](function(_0x7b5c74){if(_0x7b5c74){return _0x7b5c74['addMessage'](_0x34181e[_0x566e('0x6f')][_0x566e('0xb7')],_[_0x566e('0xb8')](_0x34181e['body'],[_0x566e('0xb7'),'id'])||{});}})[_0x566e('0x27')](respondWithResult(_0x2db283,null))[_0x566e('0x32')](handleError(_0x2db283,null));};exports[_0x566e('0xb9')]=function(_0x449657,_0x2578f0,_0x1fb05f){var _0x587052={'raw':![],'where':{}};var _0x5bd01c={};var _0x2e35c2={'count':0x0,'rows':[]};return db[_0x566e('0x35')][_0x566e('0xba')]({'where':{'id':_0x449657[_0x566e('0xae')]['id']}})['then'](handleEntityNotFound(_0x2578f0,null))[_0x566e('0x27')](function(_0x5b8865){if(_0x5b8865){_0x5bd01c['model']=_[_0x566e('0x70')](db['WhatsappMessage'][_0x566e('0x36')]);_0x5bd01c[_0x566e('0x39')]=_[_0x566e('0x70')](_0x449657[_0x566e('0x39')]);_0x5bd01c['filters']=_[_0x566e('0x3b')](_0x5bd01c[_0x566e('0x3c')],_0x5bd01c[_0x566e('0x39')]);_0x587052[_0x566e('0x3d')]=_['intersection'](_0x5bd01c[_0x566e('0x3c')],qs[_0x566e('0x3e')](_0x449657[_0x566e('0x39')]['fields']));_0x587052[_0x566e('0x3d')]=_0x587052[_0x566e('0x3d')][_0x566e('0x3f')]?_0x587052[_0x566e('0x3d')]:_0x5bd01c[_0x566e('0x3c')];if(!_0x449657['query']['hasOwnProperty']('nolimit')){_0x587052['limit']=qs[_0x566e('0x21')](_0x449657[_0x566e('0x39')]['limit']);_0x587052[_0x566e('0x1f')]=qs[_0x566e('0x1f')](_0x449657[_0x566e('0x39')][_0x566e('0x1f')]);}_0x587052[_0x566e('0x88')]=qs[_0x566e('0x42')](_0x449657[_0x566e('0x39')][_0x566e('0x42')]);_0x587052[_0x566e('0x43')]=qs[_0x566e('0x3a')](_[_0x566e('0x44')](_0x449657['query'],_0x5bd01c[_0x566e('0x3a')]));_0x587052[_0x566e('0x43')][_0x566e('0xbb')]=_0x5b8865['id'];if(_0x449657[_0x566e('0x39')][_0x566e('0x7d')]){_0x587052[_0x566e('0x43')]=_[_0x566e('0xb1')](_0x587052['where'],{'$or':_['map'](_0x587052[_0x566e('0x3d')],function(_0x3d805b){var _0x27bd87={};_0x27bd87[_0x3d805b]={'$like':'%'+_0x449657[_0x566e('0x39')][_0x566e('0x7d')]+'%'};return _0x27bd87;})});}if(_0x449657['query']['$gte']){var _0x114185=_0x449657[_0x566e('0x39')][_0x566e('0x76')][_0x566e('0x2f')](',');var _0xc3b52e={};_0xc3b52e[_0x114185[0x0]]={'$gte':moment(_0x114185[0x1])['format'](_0x566e('0xbc'))};_0x587052[_0x566e('0x43')]=_[_0x566e('0xb1')](_0x587052[_0x566e('0x43')],_0xc3b52e);}_0x587052=_[_0x566e('0xb1')]({},_0x587052,_0x449657[_0x566e('0xb2')]);return db[_0x566e('0xb6')]['count']({'where':_0x587052[_0x566e('0x43')]})[_0x566e('0x27')](function(_0x26abbe){_0x2e35c2['count']=_0x26abbe;if(_0x449657[_0x566e('0x39')][_0x566e('0xaf')]){_0x587052[_0x566e('0xb0')]=[{'all':!![]}];}return db[_0x566e('0xb6')][_0x566e('0xbd')](_0x587052);})['then'](function(_0xc15e52){_0x2e35c2[_0x566e('0xac')]=_0xc15e52;return _0x2e35c2;});}})[_0x566e('0x27')](respondWithFilteredResult(_0x2578f0,_0x587052))[_0x566e('0x32')](handleError(_0x2578f0,null));};exports[_0x566e('0xbe')]=function(_0x455746,_0x5a8fc3,_0x5d7310){return db[_0x566e('0x35')]['find']({'where':{'id':_0x455746['params']['id']}})[_0x566e('0x27')](handleEntityNotFound(_0x5a8fc3,null))[_0x566e('0x27')](function(_0x449ecc){if(_0x449ecc){return _0x449ecc[_0x566e('0xbf')](_0x455746[_0x566e('0x6f')][_0x566e('0xb7')],_[_0x566e('0xb8')](_0x455746[_0x566e('0x6f')],[_0x566e('0xb7'),'id'])||{})[_0x566e('0xc0')](function(){return db[_0x566e('0x67')][_0x566e('0xbd')]({'attributes':['id',_0x566e('0x2a'),'color'],'where':{'id':_0x455746['body']['ids']}});})['then'](function(_0x9199c0){socket['emit'](_0x566e('0xc1'),{'id':Number(_0x455746[_0x566e('0xae')]['id']),'tags':_0x9199c0||[]});return{'id':Number(_0x455746[_0x566e('0xae')]['id']),'tags':_0x9199c0||[]};});}})[_0x566e('0x27')](respondWithResult(_0x5a8fc3,null))[_0x566e('0x32')](handleError(_0x5a8fc3,null));};exports[_0x566e('0xc2')]=function(_0x56076b,_0x1dfb7d,_0x448e72){return db['WhatsappInteraction'][_0x566e('0x5b')]({'where':{'id':_0x56076b[_0x566e('0xae')]['id']}})['then'](handleEntityNotFound(_0x1dfb7d,null))['then'](function(_0x5f25fb){if(_0x5f25fb){return _0x5f25fb[_0x566e('0xc2')](_0x56076b[_0x566e('0x39')]['ids']);}})['then'](respondWithStatusCode(_0x1dfb7d,null))[_0x566e('0x32')](handleError(_0x1dfb7d,null));};exports[_0x566e('0xc3')]=function(_0x5730da,_0x1267ba){var _0x3ef23f=moment()['unix']()['toString']();var _0x5216f8=path['join'](config[_0x566e('0xc4')],_0x566e('0xc5'),_0x566e('0xc6'),'tmp');var _0x5e7dae=path[_0x566e('0xc7')](config[_0x566e('0xc4')],_0x566e('0xc5'),_0x566e('0xc6'),_0x566e('0xc8'));var _0xf7184d=path[_0x566e('0xc7')](_0x5216f8,_0x3ef23f);var _0x353da1=util[_0x566e('0xc9')](_0x566e('0xca'),_0x5730da[_0x566e('0xae')]['id'],_0x3ef23f);var _0x45b009=path[_0x566e('0xc7')](_0x5216f8,_0x353da1);var _0x4fc216=[];_0x4fc216[_0x566e('0x31')]({'model':db['User'],'as':'User','attributes':['id',_0x566e('0x2d')],'raw':!![]});_0x4fc216['push']({'model':db[_0x566e('0xcb')],'as':'Contact','attributes':['id',_0x566e('0xcc'),_0x566e('0xcd')],'raw':!![]});if(_0x5730da['query'][_0x566e('0xc8')]){_0x4fc216['push']({'model':db[_0x566e('0xce')],'as':_0x566e('0xce'),'raw':!![]});}var _0x40e8ad=[{'model':db[_0x566e('0xb6')],'as':_0x566e('0xcf'),'attributes':['id',_0x566e('0x6f'),_0x566e('0xd0'),_0x566e('0xd1'),_0x566e('0xd2'),_0x566e('0xd3')],'include':_0x4fc216}];_0x40e8ad[_0x566e('0x31')]({'model':db[_0x566e('0xd4')],'as':_0x566e('0xd5'),'attributes':['id',_0x566e('0x2a')]});_0x40e8ad[_0x566e('0x31')]({'model':db[_0x566e('0x6b')],'as':_0x566e('0xd6'),'attributes':['id',_0x566e('0x2d')]});return db[_0x566e('0x35')][_0x566e('0x5b')]({'where':{'id':_0x5730da[_0x566e('0xae')]['id']},'include':_0x40e8ad})[_0x566e('0x27')](handleEntityNotFound(_0x1267ba,null))[_0x566e('0x27')](function(_0x2af092){if(_0x2af092){var _0x3e2b7e=_0x2af092[_0x566e('0xd7')]({'plain':!![]});fs[_0x566e('0xd8')](_0xf7184d);var _0x9a5705={'channel':_0x566e('0xd9'),'account':_0x3e2b7e[_0x566e('0xd5')]['name'],'agent':_0x3e2b7e[_0x566e('0xd6')]?_0x3e2b7e['Owner'][_0x566e('0x2d')]:_0x566e('0xda'),'createdAt':moment(_0x3e2b7e['createdAt'])[_0x566e('0xc9')](_0x566e('0xbc'))['toString'](),'closedAt':_0x3e2b7e[_0x566e('0xdb')]?moment(_0x3e2b7e[_0x566e('0xdc')])[_0x566e('0xc9')](_0x566e('0xbc'))['toString']():'','disposition':_0x3e2b7e[_0x566e('0xdd')],'messages':_(_0x3e2b7e[_0x566e('0xcf')])[_0x566e('0x7d')]({'secret':![]})[_0x566e('0x34')](function(_0x5b9345){if(_0x5b9345[_0x566e('0xce')]){var _0x3223c5=path[_0x566e('0xc7')](_0x5e7dae,_0x5b9345[_0x566e('0xce')][_0x566e('0xde')]);if(fs[_0x566e('0xdf')](_0x3223c5)){fs[_0x566e('0xe0')](_0x3223c5)[_0x566e('0xe1')](fs['createWriteStream'](path['join'](_0xf7184d,_0x5b9345[_0x566e('0xce')][_0x566e('0xde')])));}}return{'date':moment(_0x5b9345['createdAt'])[_0x566e('0xc9')](_0x566e('0xbc'))[_0x566e('0x94')](),'sender':_0x5b9345[_0x566e('0xd1')]===_0x566e('0xe2')?_0x5b9345[_0x566e('0x6b')]?_0x5b9345[_0x566e('0x6b')][_0x566e('0x2d')]:_0x566e('0xe3'):_0x5b9345[_0x566e('0x60')][_0x566e('0xcc')]+(_0x5b9345['Contact'][_0x566e('0xcd')]?'\x20'+_0x5b9345[_0x566e('0x60')][_0x566e('0xcd')]:''),'body':_0x5b9345['Attachment']?_0x5b9345[_0x566e('0xce')][_0x566e('0xde')]:_0x5b9345[_0x566e('0x6f')],'direction':_0x5b9345[_0x566e('0xd1')]===_0x566e('0xe2')?'A':'C','secret':_0x5b9345[_0x566e('0xd2')],'read':_0x5b9345[_0x566e('0xd3')],'attachment':_0x5b9345[_0x566e('0xce')]};})['value']()};return ejs[_0x566e('0xe4')](path[_0x566e('0xc7')](config[_0x566e('0xc4')],_0x566e('0xc5'),_0x566e('0xe5'),_0x566e('0xe6')),{'interaction':_0x9a5705})[_0x566e('0x27')](function(_0x2b50d0){var _0x120da0=path[_0x566e('0xc7')](_0xf7184d,'transcript-'+_0x3e2b7e['id']+'-'+_0x3ef23f+_0x566e('0xe7'));var _0x51de8a={'path':_0x120da0,'channel':_0x566e('0xd9'),'interactionId':_0x3e2b7e['id']};return pdf['createPdfFromHTML'](_0x2b50d0,_0x51de8a);})[_0x566e('0x27')](function(){return new BPromise(function(_0x2279ab,_0xce85e){zipdir(_0xf7184d,{'saveTo':_0x45b009},function(_0x145a7c,_0x2cf3d1){if(_0x145a7c)return _0xce85e(_0x145a7c);return _0x2279ab(_0x2cf3d1);});})['then'](function(){return new BPromise(function(_0x951bbb,_0x5216c8){rimraf(_0xf7184d,function(_0x11c747){if(_0x11c747)_0x5216c8(_0x11c747);return _0x951bbb();});});})[_0x566e('0x27')](function(){return _0x1267ba[_0x566e('0xc3')](_0x45b009,_0x353da1,function(_0x2c705f){if(_0x2c705f){console[_0x566e('0xe8')](_0x566e('0xe9'),_0x2c705f);}else{fs[_0x566e('0xea')](_0x45b009);}});});});}else{return _0x1267ba['sendStatus'](0xc8);}})['catch'](handleError(_0x1267ba,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index 6f6583d..8ff58cb 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 _0xac7f=['hasOwnProperty','hook','events','WhatsappInteraction','../../mysqldb','WhatsappMessage','save','update','remove','getUsers','setDataValue','map','findAll','emit','catch'];(function(_0x228abd,_0x1a2168){var _0x2de6ee=function(_0x2a508c){while(--_0x2a508c){_0x228abd['push'](_0x228abd['shift']());}};_0x2de6ee(++_0x1a2168);}(_0xac7f,0x1e2));var _0xfac7=function(_0x1f9f37,_0x18776e){_0x1f9f37=_0x1f9f37-0x0;var _0x21c080=_0xac7f[_0x1f9f37];return _0x21c080;};'use strict';var EventEmitter=require(_0xfac7('0x0'));var WhatsappInteraction=require('../../mysqldb')['db'][_0xfac7('0x1')];var WhatsappMessage=require(_0xfac7('0x2'))['db'][_0xfac7('0x3')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xfac7('0x4'),'afterUpdate':_0xfac7('0x5'),'afterDestroy':_0xfac7('0x6')};function emitEvent(_0x297313){return function(_0x46ee9b,_0x3aaeef,_0x523494){_0x46ee9b[_0xfac7('0x7')]({'attributes':['id'],'raw':!![]})['then'](function(_0x100c9c){_0x46ee9b[_0xfac7('0x8')]('Users',_0x100c9c[_0xfac7('0x9')](function(_0x1a5768){return{'id':_0x1a5768['id']};}));return WhatsappMessage[_0xfac7('0xa')]({'where':{'WhatsappInteractionId':_0x46ee9b['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x3e464d){_0x46ee9b[_0xfac7('0x8')]('unreadMessages',_0x3e464d['length']);WhatsappInteractionEvents[_0xfac7('0xb')](_0x297313+':'+_0x46ee9b['id'],_0x46ee9b);WhatsappInteractionEvents[_0xfac7('0xb')](_0x297313,_0x46ee9b);_0x523494(null);})[_0xfac7('0xc')](_0x523494(null));};}for(var e in events){if(events[_0xfac7('0xd')](e)){var event=events[e];WhatsappInteraction[_0xfac7('0xe')](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file +var _0xc2e8=['then','setDataValue','unreadMessages','length','emit','catch','hasOwnProperty','events','../../mysqldb','WhatsappMessage','save','update','remove','map','findAll'];(function(_0x3b8697,_0x73e8d9){var _0x1197bc=function(_0x4b23a1){while(--_0x4b23a1){_0x3b8697['push'](_0x3b8697['shift']());}};_0x1197bc(++_0x73e8d9);}(_0xc2e8,0x70));var _0x8c2e=function(_0x46b838,_0x31e3bf){_0x46b838=_0x46b838-0x0;var _0x49d971=_0xc2e8[_0x46b838];return _0x49d971;};'use strict';var EventEmitter=require(_0x8c2e('0x0'));var WhatsappInteraction=require(_0x8c2e('0x1'))['db']['WhatsappInteraction'];var WhatsappMessage=require('../../mysqldb')['db'][_0x8c2e('0x2')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8c2e('0x3'),'afterUpdate':_0x8c2e('0x4'),'afterDestroy':_0x8c2e('0x5')};function emitEvent(_0x52b6a0){return function(_0xa32f1f,_0x24aa7b,_0x2b784d){_0xa32f1f['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x4b8f44){_0xa32f1f['setDataValue']('Users',_0x4b8f44[_0x8c2e('0x6')](function(_0x20293f){return{'id':_0x20293f['id']};}));return WhatsappMessage[_0x8c2e('0x7')]({'where':{'WhatsappInteractionId':_0xa32f1f['id'],'direction':'in','read':![]},'raw':!![]});})[_0x8c2e('0x8')](function(_0x41771b){_0xa32f1f[_0x8c2e('0x9')](_0x8c2e('0xa'),_0x41771b[_0x8c2e('0xb')]);WhatsappInteractionEvents['emit'](_0x52b6a0+':'+_0xa32f1f['id'],_0xa32f1f);WhatsappInteractionEvents[_0x8c2e('0xc')](_0x52b6a0,_0xa32f1f);_0x2b784d(null);})[_0x8c2e('0xd')](_0x2b784d(null));};}for(var e in events){if(events[_0x8c2e('0xe')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module['exports']=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index 7ebe712..762824f 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 _0x187d=['../../config/environment','./whatsappInteraction.attributes','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','util','api','moment','bluebird','request-promise','rimraf'];(function(_0x20589d,_0x55d5bf){var _0x422de9=function(_0x44cbbb){while(--_0x44cbbb){_0x20589d['push'](_0x20589d['shift']());}};_0x422de9(++_0x55d5bf);}(_0x187d,0xa4));var _0xd187=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x187d[_0x3947c9];return _0x2e7871;};'use strict';var _=require('lodash');var util=require(_0xd187('0x0'));var logger=require('../../config/logger')(_0xd187('0x1'));var moment=require(_0xd187('0x2'));var BPromise=require(_0xd187('0x3'));var rp=require(_0xd187('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd187('0x5'));var config=require(_0xd187('0x6'));var attributes=require(_0xd187('0x7'));module[_0xd187('0x8')]=function(_0x40f1d0,_0x46fd75){return _0x40f1d0[_0xd187('0x9')](_0xd187('0xa'),attributes,{'tableName':_0xd187('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x457197,_0x405193,_0x256e49){if(_0x457197[_0xd187('0xc')](_0xd187('0xd'))){_0x457197[_0xd187('0xe')]=moment()[_0xd187('0xf')](_0xd187('0x10'));}_0x256e49(null,_0x457197);}}});}; \ No newline at end of file +var _0x2c12=['api','request-promise','rimraf','exports','define','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger'];(function(_0x95266a,_0x316bc3){var _0x5786b9=function(_0x26bc51){while(--_0x26bc51){_0x95266a['push'](_0x95266a['shift']());}};_0x5786b9(++_0x316bc3);}(_0x2c12,0x107));var _0x22c1=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0x2c12[_0x433a86];return _0x23000c;};'use strict';var _=require(_0x22c1('0x0'));var util=require(_0x22c1('0x1'));var logger=require(_0x22c1('0x2'))(_0x22c1('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x22c1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x22c1('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x22c1('0x6')]=function(_0x217427,_0x1ff270){return _0x217427[_0x22c1('0x7')](_0x22c1('0x8'),attributes,{'tableName':_0x22c1('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x42fab1,_0xee2585,_0x3693ed){if(_0x42fab1[_0x22c1('0xa')](_0x22c1('0xb'))){_0x42fab1['closedAt']=moment()[_0x22c1('0xc')](_0x22c1('0xd'));}_0x3693ed(null,_0x42fab1);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 62f1dba..9115a7c 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 _0xe7a1=['../../config/logger','rpc','../../config/environment','jayson/promise','redis','localhost','socket.io-emitter','./whatsappInteraction.socket','register','request','then','info','debug','request\x20sent','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','find','addTags','ids','spread','AddTags','bluebird','randomstring','../../config/utils'];(function(_0x469cd9,_0x141ec6){var _0x27e942=function(_0x319d46){while(--_0x319d46){_0x469cd9['push'](_0x469cd9['shift']());}};_0x27e942(++_0x141ec6);}(_0xe7a1,0x1d1));var _0x1e7a=function(_0xa148b7,_0x2f3eb2){_0xa148b7=_0xa148b7-0x0;var _0x51efd3=_0xe7a1[_0xa148b7];return _0x51efd3;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x1e7a('0x0'));var rs=require(_0x1e7a('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1e7a('0x2'));var logger=require(_0x1e7a('0x3'))(_0x1e7a('0x4'));var config=require(_0x1e7a('0x5'));var jayson=require(_0x1e7a('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1e7a('0x7')]=_['defaults'](config['redis'],{'host':_0x1e7a('0x8'),'port':0x18eb});var socket=require(_0x1e7a('0x9'))(new Redis(config[_0x1e7a('0x7')]));require(_0x1e7a('0xa'))[_0x1e7a('0xb')](socket);function respondWithRpcPromise(_0xc0f328,_0x499db5,_0x191e30){return new BPromise(function(_0x32df1d,_0x49fbe8){return client[_0x1e7a('0xc')](_0xc0f328,_0x191e30)[_0x1e7a('0xd')](function(_0x17ed1c){logger[_0x1e7a('0xe')]('WhatsappInteraction,\x20%s,\x20%s',_0x499db5,'request\x20sent');logger[_0x1e7a('0xf')]('WhatsappInteraction,\x20%s,\x20%s,\x20%s',_0x499db5,_0x1e7a('0x10'),JSON[_0x1e7a('0x11')](_0x17ed1c));if(_0x17ed1c[_0x1e7a('0x12')]){if(_0x17ed1c[_0x1e7a('0x12')][_0x1e7a('0x13')]===0x1f4){logger['error'](_0x1e7a('0x14'),_0x499db5,_0x17ed1c[_0x1e7a('0x12')][_0x1e7a('0x15')]);return _0x49fbe8(_0x17ed1c[_0x1e7a('0x12')]['message']);}logger[_0x1e7a('0x12')](_0x1e7a('0x14'),_0x499db5,_0x17ed1c[_0x1e7a('0x12')][_0x1e7a('0x15')]);return _0x32df1d(_0x17ed1c[_0x1e7a('0x12')][_0x1e7a('0x15')]);}else{logger[_0x1e7a('0xe')](_0x1e7a('0x14'),_0x499db5,_0x1e7a('0x10'));_0x32df1d(_0x17ed1c[_0x1e7a('0x16')][_0x1e7a('0x15')]);}})[_0x1e7a('0x17')](function(_0x434065){logger['error']('WhatsappInteraction,\x20%s,\x20%s',_0x499db5,_0x434065);_0x49fbe8(_0x434065);});});}exports[_0x1e7a('0x18')]=function(_0x29ffed){var _0x37fbbf=this;return new Promise(function(_0x58b090,_0x5c4559){return db[_0x1e7a('0x19')][_0x1e7a('0x1a')](_0x29ffed[_0x1e7a('0x1b')],{'raw':_0x29ffed[_0x1e7a('0x1c')]?_0x29ffed[_0x1e7a('0x1c')][_0x1e7a('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x29ffed['options']?_0x29ffed[_0x1e7a('0x1c')][_0x1e7a('0x1e')]||null:null,'attributes':_0x29ffed[_0x1e7a('0x1c')]?_0x29ffed[_0x1e7a('0x1c')][_0x1e7a('0x1f')]||null:null,'limit':_0x29ffed[_0x1e7a('0x1c')]?_0x29ffed[_0x1e7a('0x1c')][_0x1e7a('0x20')]||null:null})[_0x1e7a('0xd')](function(_0xca3da5){logger[_0x1e7a('0xe')]('UpdateWhatsappInteraction',_0x29ffed);logger[_0x1e7a('0xf')](_0x1e7a('0x18'),_0x29ffed,JSON['stringify'](_0xca3da5));_0x58b090(_0xca3da5);})[_0x1e7a('0x17')](function(_0x1d8631){logger[_0x1e7a('0x12')]('UpdateWhatsappInteraction',_0x1d8631[_0x1e7a('0x15')],_0x29ffed);_0x5c4559(_0x37fbbf[_0x1e7a('0x12')](0x1f4,_0x1d8631[_0x1e7a('0x15')]));});});};exports[_0x1e7a('0x21')]=function(_0x1e7546){return new Promise(function(_0xcd22a0,_0x3ad97f){return db[_0x1e7a('0x19')][_0x1e7a('0x22')]({'where':_0x1e7546[_0x1e7a('0x1c')]?_0x1e7546['options'][_0x1e7a('0x1e')]||null:null})[_0x1e7a('0xd')](function(_0x131b0b){if(_0x131b0b){return _0x131b0b[_0x1e7a('0x23')](_0x1e7546[_0x1e7a('0x1b')][_0x1e7a('0x24')],_['omit'](_0x1e7546['body'],[_0x1e7a('0x24'),'id'])||{});}})[_0x1e7a('0x25')](function(_0x274b34){logger[_0x1e7a('0xe')](_0x1e7a('0x26'),_0x1e7546);logger[_0x1e7a('0xf')]('AddTags',_0x1e7546,JSON[_0x1e7a('0x11')](_0x274b34));_0xcd22a0(_0x274b34);})[_0x1e7a('0x17')](function(_0x577a13){logger['error'](_0x1e7a('0x26'),_0x577a13[_0x1e7a('0x15')],_0x1e7546);_0x3ad97f(_this[_0x1e7a('0x12')](0x1f4,_0x577a13[_0x1e7a('0x15')]));});});}; \ No newline at end of file +var _0xdf77=['util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','./whatsappInteraction.socket','register','request','then','info','WhatsappInteraction,\x20%s,\x20%s','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','UpdateWhatsappInteraction','options','raw','where','attributes','limit','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','body','ids','omit','spread','AddTags','stringify'];(function(_0x30543f,_0x3b09f4){var _0x1f49ad=function(_0x194427){while(--_0x194427){_0x30543f['push'](_0x30543f['shift']());}};_0x1f49ad(++_0x3b09f4);}(_0xdf77,0x171));var _0x7df7=function(_0x3f6b02,_0x530ef0){_0x3f6b02=_0x3f6b02-0x0;var _0xb973af=_0xdf77[_0x3f6b02];return _0xb973af;};'use strict';var _=require('lodash');var util=require(_0x7df7('0x0'));var moment=require('moment');var BPromise=require(_0x7df7('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7df7('0x2'));var db=require(_0x7df7('0x3'))['db'];var utils=require(_0x7df7('0x4'));var logger=require(_0x7df7('0x5'))(_0x7df7('0x6'));var config=require(_0x7df7('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x7df7('0x8')][_0x7df7('0x9')]({'port':0x232a});config[_0x7df7('0xa')]=_[_0x7df7('0xb')](config[_0x7df7('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x7df7('0xc'))[_0x7df7('0xd')](socket);function respondWithRpcPromise(_0x4f9258,_0x3c0b18,_0xec0500){return new BPromise(function(_0x2bd5af,_0x225eed){return client[_0x7df7('0xe')](_0x4f9258,_0xec0500)[_0x7df7('0xf')](function(_0x2c3d5f){logger[_0x7df7('0x10')](_0x7df7('0x11'),_0x3c0b18,'request\x20sent');logger[_0x7df7('0x12')](_0x7df7('0x13'),_0x3c0b18,_0x7df7('0x14'),JSON['stringify'](_0x2c3d5f));if(_0x2c3d5f[_0x7df7('0x15')]){if(_0x2c3d5f[_0x7df7('0x15')][_0x7df7('0x16')]===0x1f4){logger[_0x7df7('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c0b18,_0x2c3d5f[_0x7df7('0x15')][_0x7df7('0x17')]);return _0x225eed(_0x2c3d5f[_0x7df7('0x15')]['message']);}logger[_0x7df7('0x15')](_0x7df7('0x11'),_0x3c0b18,_0x2c3d5f[_0x7df7('0x15')][_0x7df7('0x17')]);return _0x2bd5af(_0x2c3d5f[_0x7df7('0x15')][_0x7df7('0x17')]);}else{logger[_0x7df7('0x10')](_0x7df7('0x11'),_0x3c0b18,'request\x20sent');_0x2bd5af(_0x2c3d5f['result']['message']);}})[_0x7df7('0x18')](function(_0x3ec107){logger[_0x7df7('0x15')]('WhatsappInteraction,\x20%s,\x20%s',_0x3c0b18,_0x3ec107);_0x225eed(_0x3ec107);});});}exports[_0x7df7('0x19')]=function(_0x2e522f){var _0x25e81b=this;return new Promise(function(_0x4b4583,_0x4a56fa){return db['WhatsappInteraction']['update'](_0x2e522f['body'],{'raw':_0x2e522f[_0x7df7('0x1a')]?_0x2e522f[_0x7df7('0x1a')][_0x7df7('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2e522f['options']?_0x2e522f[_0x7df7('0x1a')][_0x7df7('0x1c')]||null:null,'attributes':_0x2e522f['options']?_0x2e522f[_0x7df7('0x1a')][_0x7df7('0x1d')]||null:null,'limit':_0x2e522f[_0x7df7('0x1a')]?_0x2e522f[_0x7df7('0x1a')][_0x7df7('0x1e')]||null:null})[_0x7df7('0xf')](function(_0x2ad738){logger['info'](_0x7df7('0x19'),_0x2e522f);logger[_0x7df7('0x12')](_0x7df7('0x19'),_0x2e522f,JSON['stringify'](_0x2ad738));_0x4b4583(_0x2ad738);})[_0x7df7('0x18')](function(_0x5e01c3){logger['error'](_0x7df7('0x19'),_0x5e01c3['message'],_0x2e522f);_0x4a56fa(_0x25e81b[_0x7df7('0x15')](0x1f4,_0x5e01c3[_0x7df7('0x17')]));});});};exports[_0x7df7('0x1f')]=function(_0x3f86e0){return new Promise(function(_0x390b02,_0x463f7e){return db[_0x7df7('0x20')][_0x7df7('0x21')]({'where':_0x3f86e0[_0x7df7('0x1a')]?_0x3f86e0[_0x7df7('0x1a')][_0x7df7('0x1c')]||null:null})[_0x7df7('0xf')](function(_0x57ee35){if(_0x57ee35){return _0x57ee35[_0x7df7('0x22')](_0x3f86e0[_0x7df7('0x23')][_0x7df7('0x24')],_[_0x7df7('0x25')](_0x3f86e0[_0x7df7('0x23')],[_0x7df7('0x24'),'id'])||{});}})[_0x7df7('0x26')](function(_0x5a935b){logger[_0x7df7('0x10')](_0x7df7('0x27'),_0x3f86e0);logger[_0x7df7('0x12')]('AddTags',_0x3f86e0,JSON[_0x7df7('0x28')](_0x5a935b));_0x390b02(_0x5a935b);})[_0x7df7('0x18')](function(_0x3900d6){logger[_0x7df7('0x15')]('AddTags',_0x3900d6[_0x7df7('0x17')],_0x3f86e0);_0x463f7e(_this[_0x7df7('0x15')](0x1f4,_0x3900d6['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index d1d84f3..3e60176 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 _0x24de=['update','emit','removeListener','register','length','whatsappInteraction:','./whatsappInteraction.events','save'];(function(_0x26d000,_0x3e7c7e){var _0x37c3ac=function(_0x30333c){while(--_0x30333c){_0x26d000['push'](_0x26d000['shift']());}};_0x37c3ac(++_0x3e7c7e);}(_0x24de,0x176));var _0xe24d=function(_0x1a9b62,_0x4f000a){_0x1a9b62=_0x1a9b62-0x0;var _0x38d0ff=_0x24de[_0x1a9b62];return _0x38d0ff;};'use strict';var WhatsappInteractionEvents=require(_0xe24d('0x0'));var events=[_0xe24d('0x1'),'remove',_0xe24d('0x2')];function createListener(_0x386a13,_0x59e3be){return function(_0x4f6355){_0x59e3be[_0xe24d('0x3')](_0x386a13,_0x4f6355);};}function removeListener(_0x12e30e,_0x217885){return function(){WhatsappInteractionEvents[_0xe24d('0x4')](_0x12e30e,_0x217885);};}exports[_0xe24d('0x5')]=function(_0x40374e){for(var _0x2f9dc4=0x0,_0xbaaed2=events[_0xe24d('0x6')];_0x2f9dc4<_0xbaaed2;_0x2f9dc4++){var _0x5e8915=events[_0x2f9dc4];var _0x2843e2=createListener(_0xe24d('0x7')+_0x5e8915,_0x40374e);WhatsappInteractionEvents['on'](_0x5e8915,_0x2843e2);}}; \ No newline at end of file +var _0xd5ba=['emit','register','whatsappInteraction:','./whatsappInteraction.events','save','remove','update'];(function(_0x5eca50,_0xc1e3f8){var _0x41fb84=function(_0x4ce3f3){while(--_0x4ce3f3){_0x5eca50['push'](_0x5eca50['shift']());}};_0x41fb84(++_0xc1e3f8);}(_0xd5ba,0x1a0));var _0xad5b=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xd5ba[_0x4b369d];return _0x571a98;};'use strict';var WhatsappInteractionEvents=require(_0xad5b('0x0'));var events=[_0xad5b('0x1'),_0xad5b('0x2'),_0xad5b('0x3')];function createListener(_0x15d46d,_0x2126fd){return function(_0x539820){_0x2126fd[_0xad5b('0x4')](_0x15d46d,_0x539820);};}function removeListener(_0x37e4c7,_0xe4d0f8){return function(){WhatsappInteractionEvents['removeListener'](_0x37e4c7,_0xe4d0f8);};}exports[_0xad5b('0x5')]=function(_0x40544e){for(var _0x20a2d5=0x0,_0x4be4be=events['length'];_0x20a2d5<_0x4be4be;_0x20a2d5++){var _0x550e60=events[_0x20a2d5];var _0x268d29=createListener(_0xad5b('0x6')+_0x550e60,_0x40544e);WhatsappInteractionEvents['on'](_0x550e60,_0x268d29);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index 6749ed2..95d7457 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 _0x714d=['status','update','put','/:id/accept','accept','delete','destroy','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','index','/describe','isAuthenticated','describe','/:id','tracked','whatsapp','whatsappmessage:create','create','post','/:id/status'];(function(_0x3edcd6,_0xa464c2){var _0xc64623=function(_0x3056c6){while(--_0x3056c6){_0x3edcd6['push'](_0x3edcd6['shift']());}};_0xc64623(++_0xa464c2);}(_0x714d,0xc4));var _0xd714=function(_0x594b98,_0x9205a){_0x594b98=_0x594b98-0x0;var _0x3d9d51=_0x714d[_0x594b98];return _0x3d9d51;};'use strict';var multer=require('multer');var util=require(_0xd714('0x0'));var path=require(_0xd714('0x1'));var timeout=require(_0xd714('0x2'));var express=require(_0xd714('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd714('0x4'));var interaction=require(_0xd714('0x5'));var config=require(_0xd714('0x6'));var controller=require(_0xd714('0x7'));router[_0xd714('0x8')]('/',auth['isAuthenticated'](),controller[_0xd714('0x9')]);router[_0xd714('0x8')](_0xd714('0xa'),auth[_0xd714('0xb')](),controller[_0xd714('0xc')]);router[_0xd714('0x8')](_0xd714('0xd'),auth[_0xd714('0xb')](),controller['show']);router['post']('/',auth[_0xd714('0xb')](),interaction[_0xd714('0xe')](_0xd714('0xf'),_0xd714('0x10')),controller[_0xd714('0x11')]);router[_0xd714('0x12')](_0xd714('0x13'),controller[_0xd714('0x14')]);router['put'](_0xd714('0xd'),auth[_0xd714('0xb')](),controller[_0xd714('0x15')]);router[_0xd714('0x16')](_0xd714('0x17'),auth['isAuthenticated'](),controller[_0xd714('0x18')]);router[_0xd714('0x16')]('/:id/reject',auth['isAuthenticated'](),controller['reject']);router[_0xd714('0x19')](_0xd714('0xd'),auth[_0xd714('0xb')](),controller[_0xd714('0x1a')]);module['exports']=router; \ No newline at end of file +var _0x990c=['whatsappmessage:create','/:id/status','status','update','/:id/accept','accept','put','reject','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated','/describe','describe','/:id','tracked'];(function(_0xfcdda0,_0x32479b){var _0x17ebe3=function(_0x5bfaa3){while(--_0x5bfaa3){_0xfcdda0['push'](_0xfcdda0['shift']());}};_0x17ebe3(++_0x32479b);}(_0x990c,0xd3));var _0xc990=function(_0x1d2b4d,_0x2118ff){_0x1d2b4d=_0x1d2b4d-0x0;var _0x24e2e3=_0x990c[_0x1d2b4d];return _0x24e2e3;};'use strict';var multer=require(_0xc990('0x0'));var util=require(_0xc990('0x1'));var path=require(_0xc990('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xc990('0x3')]();var fs_extra=require(_0xc990('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xc990('0x5'));var config=require(_0xc990('0x6'));var controller=require(_0xc990('0x7'));router[_0xc990('0x8')]('/',auth[_0xc990('0x9')](),controller['index']);router['get'](_0xc990('0xa'),auth[_0xc990('0x9')](),controller[_0xc990('0xb')]);router[_0xc990('0x8')](_0xc990('0xc'),auth[_0xc990('0x9')](),controller['show']);router['post']('/',auth[_0xc990('0x9')](),interaction[_0xc990('0xd')]('whatsapp',_0xc990('0xe')),controller['create']);router['post'](_0xc990('0xf'),controller[_0xc990('0x10')]);router['put'](_0xc990('0xc'),auth[_0xc990('0x9')](),controller[_0xc990('0x11')]);router['put'](_0xc990('0x12'),auth[_0xc990('0x9')](),controller[_0xc990('0x13')]);router[_0xc990('0x14')]('/:id/reject',auth['isAuthenticated'](),controller[_0xc990('0x15')]);router[_0xc990('0x16')]('/:id',auth[_0xc990('0x9')](),controller[_0xc990('0x17')]);module[_0xc990('0x18')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index edb0368..90b4017 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 _0xf6ad=['STRING','sequelize','exports','TEXT','BOOLEAN','ENUM','out'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf6ad,0x1f2));var _0xdf6a=function(_0x234116,_0x43a29d){_0x234116=_0x234116-0x0;var _0x3626b9=_0xf6ad[_0x234116];return _0x3626b9;};'use strict';var Sequelize=require(_0xdf6a('0x0'));module[_0xdf6a('0x1')]={'body':{'type':Sequelize[_0xdf6a('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xdf6a('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xdf6a('0x4')]('in',_0xdf6a('0x5')),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0xdf6a('0x6')](0xbe)},'phone':{'type':Sequelize[_0xdf6a('0x6')]},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xdf6a('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0x88ff=['TEXT','medium','BOOLEAN','ENUM','out','STRING','sequelize','exports'];(function(_0x2c8ea3,_0x497c17){var _0x1dc54f=function(_0x2ec3b4){while(--_0x2ec3b4){_0x2c8ea3['push'](_0x2c8ea3['shift']());}};_0x1dc54f(++_0x497c17);}(_0x88ff,0x196));var _0xf88f=function(_0x2a3cfe,_0x561bb7){_0x2a3cfe=_0x2a3cfe-0x0;var _0x4ca67c=_0x88ff[_0x2a3cfe];return _0x4ca67c;};'use strict';var Sequelize=require(_0xf88f('0x0'));module[_0xf88f('0x1')]={'body':{'type':Sequelize[_0xf88f('0x2')](_0xf88f('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0xf88f('0x4')],'defaultValue':![]},'direction':{'type':Sequelize[_0xf88f('0x5')]('in','out'),'defaultValue':_0xf88f('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize['STRING']},'readAt':{'type':Sequelize['DATE']},'secret':{'type':Sequelize[_0xf88f('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xf88f('0x7')]},'providerResponse':{'type':Sequelize[_0xf88f('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 6c964dc..5da7342 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 _0x1d64=['find','create','body','update','describe','whatsapp-interactions','accept','whatsapp','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','isNil','role','interaction','AcceptMessage','acceptMessage','ContactId','Sequelize','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','event','EventManager','WhatsappInteractionId','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','stringify','null','rejectMessage','sequelize','QueryTypes','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','inspect','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappMessage.socket','register','jayson/promise','client','http','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','status','end','json','undefined','limit','count','apply','reject','save','destroy','sendStatus','stack','name','send','index','map','fieldName','type','key','model','query','filters','intersection','fields','attributes','hasOwnProperty','offset','sort','where','pick','filter','VIRTUAL','options','WhatsappMessage','includeAll','include','rows','show','params','keys','rawAttributes','length'];(function(_0x389355,_0x4d867b){var _0x2b2a6b=function(_0x446b2e){while(--_0x446b2e){_0x389355['push'](_0x389355['shift']());}};_0x2b2a6b(++_0x4d867b);}(_0x1d64,0x1cd));var _0x41d6=function(_0x51020b,_0x38c2c7){_0x51020b=_0x51020b-0x0;var _0x371e47=_0x1d64[_0x51020b];return _0x371e47;};'use strict';var emlformat=require(_0x41d6('0x0'));var rimraf=require(_0x41d6('0x1'));var zipdir=require(_0x41d6('0x2'));var jsonpatch=require(_0x41d6('0x3'));var rp=require(_0x41d6('0x4'));var moment=require('moment');var BPromise=require(_0x41d6('0x5'));var Mustache=require(_0x41d6('0x6'));var util=require(_0x41d6('0x7'));var path=require(_0x41d6('0x8'));var sox=require('sox');var csv=require(_0x41d6('0x9'));var ejs=require(_0x41d6('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x41d6('0xb'));var crypto=require('crypto');var jsforce=require(_0x41d6('0xc'));var deskjs=require(_0x41d6('0xd'));var toCsv=require('to-csv');var querystring=require(_0x41d6('0xe'));var Papa=require('papaparse');var Redis=require(_0x41d6('0xf'));var authService=require(_0x41d6('0x10'));var qs=require(_0x41d6('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x41d6('0x12'))('api');var utils=require('../../config/utils');var config=require(_0x41d6('0x13'));var licenseUtil=require(_0x41d6('0x14'));var db=require(_0x41d6('0x15'))['db'];config[_0x41d6('0x16')]=_[_0x41d6('0x17')](config['redis'],{'host':_0x41d6('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x41d6('0x16')]));require(_0x41d6('0x19'))[_0x41d6('0x1a')](socket);var jayson=require(_0x41d6('0x1b'));var client=jayson[_0x41d6('0x1c')][_0x41d6('0x1d')]({'port':0x232c});var client9002=jayson[_0x41d6('0x1c')][_0x41d6('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x549e28,_0x1bf1db,_0x4a1764,_0x325ea2){return new BPromise(function(_0x1426be,_0x3189f6){var _0xd4e592=_0x325ea2||client;return _0xd4e592[_0x41d6('0x1e')](_0x549e28,_0x4a1764)[_0x41d6('0x1f')](function(_0x146ba2){logger[_0x41d6('0x20')](_0x41d6('0x21'),_0x1bf1db,_0x41d6('0x22'));logger[_0x41d6('0x23')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x1bf1db,_0x41d6('0x22'),JSON['stringify'](_0x146ba2));if(_0x146ba2[_0x41d6('0x24')]){if(_0x146ba2[_0x41d6('0x24')][_0x41d6('0x25')]===0x1f4){logger[_0x41d6('0x24')](_0x41d6('0x21'),_0x1bf1db,_0x146ba2['error'][_0x41d6('0x26')]);return _0x3189f6(_0x146ba2['error'][_0x41d6('0x26')]);}logger[_0x41d6('0x24')](_0x41d6('0x21'),_0x1bf1db,_0x146ba2['error'][_0x41d6('0x26')]);return _0x1426be(_0x146ba2['error'][_0x41d6('0x26')]);}else{logger['info'](_0x41d6('0x21'),_0x1bf1db,'request\x20sent');_0x1426be(_0x146ba2[_0x41d6('0x27')][_0x41d6('0x26')]);}})[_0x41d6('0x28')](function(_0x2370c0){logger[_0x41d6('0x24')](_0x41d6('0x21'),_0x1bf1db,_0x2370c0);_0x3189f6(_0x2370c0);});});}function respondWithStatusCode(_0x1e7a91,_0x5e803c){_0x5e803c=_0x5e803c||0xcc;return function(_0x24462a){if(_0x24462a){return _0x1e7a91['sendStatus'](_0x5e803c);}return _0x1e7a91[_0x41d6('0x29')](_0x5e803c)[_0x41d6('0x2a')]();};}function respondWithResult(_0x47a801,_0x8ff89e){_0x8ff89e=_0x8ff89e||0xc8;return function(_0x460373){if(_0x460373){return _0x47a801[_0x41d6('0x29')](_0x8ff89e)[_0x41d6('0x2b')](_0x460373);}};}function respondWithFilteredResult(_0x6175ad,_0x1861d4){return function(_0x39ce14){if(_0x39ce14){var _0x34ad66=typeof _0x1861d4['offset']===_0x41d6('0x2c')&&typeof _0x1861d4[_0x41d6('0x2d')]==='undefined';var _0x42308e=_0x39ce14[_0x41d6('0x2e')];var _0x26badf=_0x34ad66?0x0:_0x1861d4['offset'];var _0x1015b0=_0x34ad66?_0x39ce14[_0x41d6('0x2e')]:_0x1861d4['offset']+_0x1861d4[_0x41d6('0x2d')];var _0x5eccf4;if(_0x1015b0>=_0x42308e){_0x1015b0=_0x42308e;_0x5eccf4=0xc8;}else{_0x5eccf4=0xce;}_0x6175ad[_0x41d6('0x29')](_0x5eccf4);return _0x6175ad['set']('Content-Range',_0x26badf+'-'+_0x1015b0+'/'+_0x42308e)[_0x41d6('0x2b')](_0x39ce14);}return null;};}function patchUpdates(_0x3faae5){return function(_0x4efd4a){try{jsonpatch[_0x41d6('0x2f')](_0x4efd4a,_0x3faae5,!![]);}catch(_0x28cc82){return BPromise[_0x41d6('0x30')](_0x28cc82);}return _0x4efd4a[_0x41d6('0x31')]();};}function saveUpdates(_0x2adece,_0x38de84){return function(_0x21ee17){if(_0x21ee17){return _0x21ee17['update'](_0x2adece)[_0x41d6('0x1f')](function(_0x5b829f){return _0x5b829f;});}return null;};}function removeEntity(_0x1fc643,_0x3956ab){return function(_0x529875){if(_0x529875){return _0x529875[_0x41d6('0x32')]()[_0x41d6('0x1f')](function(){_0x1fc643[_0x41d6('0x29')](0xcc)[_0x41d6('0x2a')]();});}};}function handleEntityNotFound(_0x2d9cc6,_0x4f2556){return function(_0x4b7934){if(!_0x4b7934){_0x2d9cc6[_0x41d6('0x33')](0x194);}return _0x4b7934;};}function handleError(_0x1aca64,_0x185b0c){_0x185b0c=_0x185b0c||0x1f4;return function(_0xfb9167){logger[_0x41d6('0x24')](_0xfb9167[_0x41d6('0x34')]);if(_0xfb9167['name']){delete _0xfb9167[_0x41d6('0x35')];}_0x1aca64[_0x41d6('0x29')](_0x185b0c)[_0x41d6('0x36')](_0xfb9167);};}exports[_0x41d6('0x37')]=function(_0x5990b6,_0xa84e0e){var _0x16ad2b={},_0x440c2a={},_0x2f318a={'count':0x0,'rows':[]};var _0xc68184=_[_0x41d6('0x38')](db['WhatsappMessage']['rawAttributes'],function(_0x20096e){return{'name':_0x20096e[_0x41d6('0x39')],'type':_0x20096e[_0x41d6('0x3a')][_0x41d6('0x3b')]};});_0x440c2a[_0x41d6('0x3c')]=_[_0x41d6('0x38')](_0xc68184,_0x41d6('0x35'));_0x440c2a[_0x41d6('0x3d')]=_['keys'](_0x5990b6['query']);_0x440c2a[_0x41d6('0x3e')]=_[_0x41d6('0x3f')](_0x440c2a[_0x41d6('0x3c')],_0x440c2a['query']);_0x16ad2b['attributes']=_[_0x41d6('0x3f')](_0x440c2a[_0x41d6('0x3c')],qs[_0x41d6('0x40')](_0x5990b6[_0x41d6('0x3d')][_0x41d6('0x40')]));_0x16ad2b['attributes']=_0x16ad2b[_0x41d6('0x41')]['length']?_0x16ad2b['attributes']:_0x440c2a[_0x41d6('0x3c')];if(!_0x5990b6[_0x41d6('0x3d')][_0x41d6('0x42')]('nolimit')){_0x16ad2b['limit']=qs[_0x41d6('0x2d')](_0x5990b6[_0x41d6('0x3d')][_0x41d6('0x2d')]);_0x16ad2b[_0x41d6('0x43')]=qs[_0x41d6('0x43')](_0x5990b6[_0x41d6('0x3d')][_0x41d6('0x43')]);}_0x16ad2b['order']=qs['sort'](_0x5990b6[_0x41d6('0x3d')][_0x41d6('0x44')]);_0x16ad2b[_0x41d6('0x45')]=qs[_0x41d6('0x3e')](_[_0x41d6('0x46')](_0x5990b6[_0x41d6('0x3d')],_0x440c2a[_0x41d6('0x3e')]),_0xc68184);if(_0x5990b6[_0x41d6('0x3d')][_0x41d6('0x47')]){_0x16ad2b[_0x41d6('0x45')]=_['merge'](_0x16ad2b[_0x41d6('0x45')],{'$or':_[_0x41d6('0x38')](_0xc68184,function(_0x9b75d3){if(_0x9b75d3[_0x41d6('0x3a')]!==_0x41d6('0x48')){var _0x108842={};_0x108842[_0x9b75d3[_0x41d6('0x35')]]={'$like':'%'+_0x5990b6['query']['filter']+'%'};return _0x108842;}})});}_0x16ad2b=_['merge']({},_0x16ad2b,_0x5990b6[_0x41d6('0x49')]);var _0x155af0={'where':_0x16ad2b[_0x41d6('0x45')]};return db[_0x41d6('0x4a')]['count'](_0x155af0)[_0x41d6('0x1f')](function(_0x5d583c){_0x2f318a[_0x41d6('0x2e')]=_0x5d583c;if(_0x5990b6[_0x41d6('0x3d')][_0x41d6('0x4b')]){_0x16ad2b[_0x41d6('0x4c')]=[{'all':!![]}];}return db[_0x41d6('0x4a')]['findAll'](_0x16ad2b);})['then'](function(_0x382abc){_0x2f318a[_0x41d6('0x4d')]=_0x382abc;return _0x2f318a;})[_0x41d6('0x1f')](respondWithFilteredResult(_0xa84e0e,_0x16ad2b))[_0x41d6('0x28')](handleError(_0xa84e0e,null));};exports[_0x41d6('0x4e')]=function(_0x5cc40c,_0x4905a1){var _0x1713be={'raw':!![],'where':{'id':_0x5cc40c[_0x41d6('0x4f')]['id']}},_0x306d9a={};_0x306d9a['model']=_[_0x41d6('0x50')](db[_0x41d6('0x4a')][_0x41d6('0x51')]);_0x306d9a[_0x41d6('0x3d')]=_[_0x41d6('0x50')](_0x5cc40c[_0x41d6('0x3d')]);_0x306d9a[_0x41d6('0x3e')]=_[_0x41d6('0x3f')](_0x306d9a['model'],_0x306d9a[_0x41d6('0x3d')]);_0x1713be[_0x41d6('0x41')]=_[_0x41d6('0x3f')](_0x306d9a[_0x41d6('0x3c')],qs[_0x41d6('0x40')](_0x5cc40c['query'][_0x41d6('0x40')]));_0x1713be[_0x41d6('0x41')]=_0x1713be[_0x41d6('0x41')][_0x41d6('0x52')]?_0x1713be['attributes']:_0x306d9a[_0x41d6('0x3c')];if(_0x5cc40c[_0x41d6('0x3d')]['includeAll']){_0x1713be[_0x41d6('0x4c')]=[{'all':!![]}];}_0x1713be=_['merge']({},_0x1713be,_0x5cc40c[_0x41d6('0x49')]);return db[_0x41d6('0x4a')][_0x41d6('0x53')](_0x1713be)[_0x41d6('0x1f')](handleEntityNotFound(_0x4905a1,null))['then'](respondWithResult(_0x4905a1,null))[_0x41d6('0x28')](handleError(_0x4905a1,null));};exports[_0x41d6('0x54')]=function(_0x55aa8b,_0x59cb63){return db['WhatsappMessage'][_0x41d6('0x54')](_0x55aa8b[_0x41d6('0x55')],{})[_0x41d6('0x1f')](respondWithResult(_0x59cb63,0xc9))[_0x41d6('0x28')](handleError(_0x59cb63,null));};exports[_0x41d6('0x56')]=function(_0x128790,_0x5f4c70){if(_0x128790['body']['id']){delete _0x128790[_0x41d6('0x55')]['id'];}return db[_0x41d6('0x4a')]['find']({'where':{'id':_0x128790[_0x41d6('0x4f')]['id']}})[_0x41d6('0x1f')](handleEntityNotFound(_0x5f4c70,null))[_0x41d6('0x1f')](saveUpdates(_0x128790[_0x41d6('0x55')],null))[_0x41d6('0x1f')](respondWithResult(_0x5f4c70,null))[_0x41d6('0x28')](handleError(_0x5f4c70,null));};exports['destroy']=function(_0x5c3e99,_0x141992){return db[_0x41d6('0x4a')]['find']({'where':{'id':_0x5c3e99[_0x41d6('0x4f')]['id']}})[_0x41d6('0x1f')](handleEntityNotFound(_0x141992,null))[_0x41d6('0x1f')](removeEntity(_0x141992,null))['catch'](handleError(_0x141992,null));};exports[_0x41d6('0x57')]=function(_0x2dca16,_0x3bed71){return db['WhatsappMessage']['describe']()['then'](respondWithResult(_0x3bed71,null))[_0x41d6('0x28')](handleError(_0x3bed71,null));};var interaction_log=require(_0x41d6('0x12'))(_0x41d6('0x58'));exports[_0x41d6('0x59')]=function(_0x3e056c,_0x53ec40,_0x30fd67){var _0x14561a={'agent':{},'channel':_0x41d6('0x5a')};if(_0x3e056c['body']['id']){delete _0x3e056c[_0x41d6('0x55')]['id'];}_0x3e056c['body']['read']=!![];_0x3e056c['body'][_0x41d6('0x5b')]=moment()[_0x41d6('0x5c')](_0x41d6('0x5d'));_0x3e056c[_0x41d6('0x55')][_0x41d6('0x5e')]=_0x3e056c['body'][_0x41d6('0x5e')]||_0x3e056c[_0x41d6('0x5f')]['id'];_0x14561a[_0x41d6('0x60')]['id']=_0x3e056c[_0x41d6('0x55')]['UserId'];return db[_0x41d6('0x4a')]['find']({'where':{'id':_0x3e056c[_0x41d6('0x4f')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x53ec40,null))[_0x41d6('0x1f')](saveUpdates(_0x3e056c[_0x41d6('0x55')],null))[_0x41d6('0x1f')](function(_0x4bc404){if(_0x4bc404){_0x14561a[_0x41d6('0x26')]=_0x4bc404[_0x41d6('0x61')]({'plain':!![]});return db[_0x41d6('0x62')]['find']({'where':{'id':_0x4bc404['WhatsappInteractionId']}});}return null;})[_0x41d6('0x1f')](handleEntityNotFound(_0x53ec40,null))['then'](function(_0xb62ff1){if(_0xb62ff1){return _0xb62ff1[_0x41d6('0x56')]({'UserId':_0x3e056c[_0x41d6('0x55')][_0x41d6('0x5e')],'read1stAt':_[_0x41d6('0x63')](_0xb62ff1['read1stAt'])?moment()[_0x41d6('0x5c')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x41d6('0x1f')](function(_0x4d5c90){if(_0x4d5c90){_0x14561a['interaction']=_0x4d5c90[_0x41d6('0x61')]({'plain':!![]});interaction_log[_0x41d6('0x20')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3e056c[_0x41d6('0x5f')]['id'],_0x3e056c[_0x41d6('0x5f')]['name'],_0x3e056c[_0x41d6('0x5f')][_0x41d6('0x64')],_0x14561a[_0x41d6('0x65')]['id'],_0x3e056c[_0x41d6('0x55')]?JSON['stringify'](_0x3e056c[_0x41d6('0x55')]):'null');return respondWithRpcPromise(_0x41d6('0x66'),_0x41d6('0x67'),_0x14561a);}return null;})[_0x41d6('0x1f')](function(_0x5bad26){var _0x3f6ea4='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5bad26[_0x41d6('0x26')][_0x41d6('0x68')];return db['sequelize'][_0x41d6('0x3d')](_0x3f6ea4,{'type':db[_0x41d6('0x69')]['QueryTypes'][_0x41d6('0x6a')],'raw':!![]})[_0x41d6('0x1f')](function(_0x5bbe83){return _0x5bbe83;});})['then'](function(_0x1a96cd){if(_0x1a96cd){_0x14561a[_0x41d6('0x26')][_0x41d6('0x6b')]=_0x1a96cd[0x0];if(!_0x3e056c[_0x41d6('0x55')][_0x41d6('0x5e')])return;return db[_0x41d6('0x6c')][_0x41d6('0x53')]({'where':{'id':_0x3e056c[_0x41d6('0x55')][_0x41d6('0x5e')],'role':'agent'},'attributes':['id','name',_0x41d6('0x6d'),_0x41d6('0x6e'),_0x41d6('0x6f')],'raw':!![]});}return null;})['then'](function(_0xc44b56){if(!_0xc44b56)return null;_0x14561a[_0x41d6('0x26')][_0x41d6('0x60')]=_0xc44b56;return _0x14561a;})['then'](function(_0x1fa50c){if(_0x1fa50c){if(_0x3e056c[_0x41d6('0x55')][_0x41d6('0x70')]){_0x14561a[_0x41d6('0x26')][_0x41d6('0x71')]=util[_0x41d6('0x5c')](_0x41d6('0x72'),_0x3e056c[_0x41d6('0x5f')]['name']);_0x14561a['message'][_0x41d6('0x73')]=_0x14561a[_0x41d6('0x73')];_0x14561a['message'][_0x41d6('0x74')]=_0x41d6('0x59');return respondWithRpcPromise(_0x41d6('0x75'),'EventManager',{'event':'acceptmessage','message':_0x14561a[_0x41d6('0x26')]},client9002)['then'](function(){return _0x14561a;});}return _0x14561a;}return null;})[_0x41d6('0x1f')](respondWithResult(_0x53ec40,null))['catch'](handleError(_0x53ec40,null));};var interaction_log=require(_0x41d6('0x12'))(_0x41d6('0x58'));exports['reject']=function(_0x6cc6ed,_0x3bd31f,_0x471c40){var _0xda2928={'agent':{},'channel':'whatsapp'};if(_0x6cc6ed[_0x41d6('0x55')]['id']){delete _0x6cc6ed[_0x41d6('0x55')]['id'];}_0x6cc6ed['body'][_0x41d6('0x5e')]=_0x6cc6ed['body'][_0x41d6('0x5e')]||_0x6cc6ed[_0x41d6('0x5f')]['id'];_0xda2928[_0x41d6('0x60')]['id']=_0x6cc6ed[_0x41d6('0x55')]['UserId'];return db['WhatsappMessage'][_0x41d6('0x53')]({'where':{'id':_0x6cc6ed[_0x41d6('0x4f')]['id'],'UserId':null}})[_0x41d6('0x1f')](handleEntityNotFound(_0x3bd31f,null))[_0x41d6('0x1f')](function(_0x3caa59){if(_0x3caa59){_0xda2928[_0x41d6('0x26')]=_0x3caa59['get']({'plain':!![]});return db[_0x41d6('0x62')][_0x41d6('0x53')]({'where':{'id':_0x3caa59[_0x41d6('0x76')]}});}return null;})[_0x41d6('0x1f')](handleEntityNotFound(_0x3bd31f,null))['then'](function(_0x309cdb){if(_0x309cdb){_0xda2928[_0x41d6('0x65')]=_0x309cdb[_0x41d6('0x61')]({'plain':!![]});interaction_log[_0x41d6('0x20')](_0x41d6('0x77'),_0x6cc6ed[_0x41d6('0x5f')]['id'],_0x6cc6ed[_0x41d6('0x5f')][_0x41d6('0x35')],_0x6cc6ed['user'][_0x41d6('0x64')],_0xda2928['interaction']['id'],_0x6cc6ed[_0x41d6('0x55')]?JSON[_0x41d6('0x78')](_0x6cc6ed[_0x41d6('0x55')]):_0x41d6('0x79'));return respondWithRpcPromise('RejectMessage',_0x41d6('0x7a'),_0xda2928);}return null;})[_0x41d6('0x1f')](function(_0x11b4f7){var _0x25a840='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x11b4f7[_0x41d6('0x26')][_0x41d6('0x68')];return db[_0x41d6('0x7b')]['query'](_0x25a840,{'type':db[_0x41d6('0x69')][_0x41d6('0x7c')][_0x41d6('0x6a')],'raw':!![]})[_0x41d6('0x1f')](function(_0x1f5f59){return _0x1f5f59;});})[_0x41d6('0x1f')](function(_0x34bc9f){if(_0x34bc9f){_0xda2928[_0x41d6('0x26')][_0x41d6('0x6b')]=_0x34bc9f[0x0];if(!_0x6cc6ed[_0x41d6('0x55')]['UserId'])return;return db[_0x41d6('0x6c')][_0x41d6('0x53')]({'where':{'id':_0x6cc6ed[_0x41d6('0x55')][_0x41d6('0x5e')],'role':_0x41d6('0x60')},'attributes':['id',_0x41d6('0x35'),'fullname',_0x41d6('0x6e'),_0x41d6('0x6f')],'raw':!![]});}return null;})[_0x41d6('0x1f')](function(_0x4d75e2){if(!_0x4d75e2)return null;_0xda2928[_0x41d6('0x26')]['agent']=_0x4d75e2;return _0xda2928;})[_0x41d6('0x1f')](function(_0x22696b){if(_0x22696b){_0x22696b[_0x41d6('0x26')][_0x41d6('0x71')]=util['format']('SIP/%s',_0x6cc6ed[_0x41d6('0x5f')][_0x41d6('0x35')]);_0x22696b[_0x41d6('0x26')]['channel']=_0xda2928[_0x41d6('0x73')];_0x22696b[_0x41d6('0x26')][_0x41d6('0x74')]=_0x41d6('0x30');respondWithRpcPromise(_0x41d6('0x75'),_0x41d6('0x75'),{'event':_0x41d6('0x7d'),'message':_0x22696b['message']},client9002);return _0xda2928;}return null;})[_0x41d6('0x1f')](respondWithResult(_0x3bd31f,null))['catch'](handleError(_0x3bd31f,null));};exports[_0x41d6('0x29')]=function(_0x19676f,_0x4f29ba,_0x3f7644){if(_0x19676f['body']['id']){delete _0x19676f['body']['id'];}var _0x30e561;return db[_0x41d6('0x4a')][_0x41d6('0x53')]({'where':{'id':_0x19676f[_0x41d6('0x4f')]['id']}})[_0x41d6('0x1f')](handleEntityNotFound(_0x4f29ba,null))[_0x41d6('0x1f')](function(_0x2f781c){if(_0x2f781c){_0x30e561=_0x2f781c;return db[_0x41d6('0x7e')][_0x41d6('0x53')]({'where':{'id':_0x2f781c[_0x41d6('0x7f')]}});}})[_0x41d6('0x1f')](handleEntityNotFound(_0x4f29ba,null))[_0x41d6('0x1f')](function(_0x471668){if(_0x471668){logger[_0x41d6('0x23')](_0x41d6('0x80'),'status','received\x20delivery\x20report\x20from',_0x471668[_0x41d6('0x3a')],util[_0x41d6('0x81')](_0x19676f[_0x41d6('0x55')],{'showHidden':![],'depth':null}));switch(_0x471668[_0x41d6('0x3a')]){case _0x41d6('0x82'):if(_0x19676f['body'][_0x41d6('0x83')]&&_0x19676f['body'][_0x41d6('0x83')]===_0x30e561[_0x41d6('0x84')]&&_0x19676f[_0x41d6('0x55')]['MessageStatus']&&_0x19676f['body'][_0x41d6('0x85')]===_0x41d6('0x86')){return _0x30e561['update']({'read':!![]});}else{logger[_0x41d6('0x24')](_0x41d6('0x87'),_0x41d6('0x29'),_0x41d6('0x82'),util[_0x41d6('0x81')](_0x19676f[_0x41d6('0x55')],{'showHidden':![],'depth':null}));}break;}return _0x30e561;}})[_0x41d6('0x1f')](respondWithResult(_0x4f29ba,null))['catch'](handleError(_0x4f29ba,null));}; \ No newline at end of file +var _0xffd6=['SIP/%s','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','twilio','MessageSid','messageId','MessageStatus','read','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','moment','bluebird','mustache','path','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','api','../../config/utils','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./whatsappMessage.socket','jayson/promise','http','client','request','then','info','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','WhatsappMessage,\x20%s,\x20%s','message','request\x20sent','result','catch','sendStatus','undefined','limit','count','offset','status','apply','reject','save','update','destroy','stack','name','send','index','map','WhatsappMessage','rawAttributes','fieldName','key','model','keys','filters','intersection','attributes','fields','query','nolimit','order','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','rows','params','length','merge','create','body','find','describe','whatsapp-interactions','accept','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','interaction','role','null','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','SELECT','User','email','internal','manual','channel','event','EventManager','acceptmessage','whatsapp','[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','ContactId','sequelize','QueryTypes','contact'];(function(_0x505fc1,_0x4364ac){var _0x3ce14c=function(_0x54979e){while(--_0x54979e){_0x505fc1['push'](_0x505fc1['shift']());}};_0x3ce14c(++_0x4364ac);}(_0xffd6,0x97));var _0x6ffd=function(_0xa388a2,_0x40bde6){_0xa388a2=_0xa388a2-0x0;var _0x7ce7f6=_0xffd6[_0xa388a2];return _0x7ce7f6;};'use strict';var emlformat=require(_0x6ffd('0x0'));var rimraf=require(_0x6ffd('0x1'));var zipdir=require(_0x6ffd('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x6ffd('0x3'));var BPromise=require(_0x6ffd('0x4'));var Mustache=require(_0x6ffd('0x5'));var util=require('util');var path=require(_0x6ffd('0x6'));var sox=require(_0x6ffd('0x7'));var csv=require(_0x6ffd('0x8'));var ejs=require(_0x6ffd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6ffd('0xa'));var squel=require(_0x6ffd('0xb'));var crypto=require(_0x6ffd('0xc'));var jsforce=require(_0x6ffd('0xd'));var deskjs=require(_0x6ffd('0xe'));var toCsv=require('to-csv');var querystring=require(_0x6ffd('0xf'));var Papa=require(_0x6ffd('0x10'));var Redis=require('ioredis');var authService=require(_0x6ffd('0x11'));var qs=require(_0x6ffd('0x12'));var as=require(_0x6ffd('0x13'));var hardwareService=require(_0x6ffd('0x14'));var logger=require(_0x6ffd('0x15'))(_0x6ffd('0x16'));var utils=require(_0x6ffd('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x6ffd('0x18'));var db=require(_0x6ffd('0x19'))['db'];config['redis']=_[_0x6ffd('0x1a')](config[_0x6ffd('0x1b')],{'host':_0x6ffd('0x1c'),'port':0x18eb});var socket=require(_0x6ffd('0x1d'))(new Redis(config['redis']));require(_0x6ffd('0x1e'))['register'](socket);var jayson=require(_0x6ffd('0x1f'));var client=jayson['client'][_0x6ffd('0x20')]({'port':0x232c});var client9002=jayson[_0x6ffd('0x21')][_0x6ffd('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x5d8aff,_0x15fca6,_0x9d2f93,_0x350c94){return new BPromise(function(_0x3394b2,_0x29293a){var _0x19a772=_0x350c94||client;return _0x19a772[_0x6ffd('0x22')](_0x5d8aff,_0x9d2f93)[_0x6ffd('0x23')](function(_0x545576){logger[_0x6ffd('0x24')]('WhatsappMessage,\x20%s,\x20%s',_0x15fca6,'request\x20sent');logger[_0x6ffd('0x25')](_0x6ffd('0x26'),_0x15fca6,'request\x20sent',JSON[_0x6ffd('0x27')](_0x545576));if(_0x545576[_0x6ffd('0x28')]){if(_0x545576['error']['code']===0x1f4){logger[_0x6ffd('0x28')](_0x6ffd('0x29'),_0x15fca6,_0x545576['error'][_0x6ffd('0x2a')]);return _0x29293a(_0x545576[_0x6ffd('0x28')][_0x6ffd('0x2a')]);}logger['error'](_0x6ffd('0x29'),_0x15fca6,_0x545576[_0x6ffd('0x28')]['message']);return _0x3394b2(_0x545576[_0x6ffd('0x28')][_0x6ffd('0x2a')]);}else{logger['info'](_0x6ffd('0x29'),_0x15fca6,_0x6ffd('0x2b'));_0x3394b2(_0x545576[_0x6ffd('0x2c')]['message']);}})[_0x6ffd('0x2d')](function(_0x3e5726){logger[_0x6ffd('0x28')]('WhatsappMessage,\x20%s,\x20%s',_0x15fca6,_0x3e5726);_0x29293a(_0x3e5726);});});}function respondWithStatusCode(_0x153364,_0x5a55e2){_0x5a55e2=_0x5a55e2||0xcc;return function(_0x41ab4a){if(_0x41ab4a){return _0x153364[_0x6ffd('0x2e')](_0x5a55e2);}return _0x153364['status'](_0x5a55e2)['end']();};}function respondWithResult(_0x252201,_0x2a0391){_0x2a0391=_0x2a0391||0xc8;return function(_0x1934d4){if(_0x1934d4){return _0x252201['status'](_0x2a0391)['json'](_0x1934d4);}};}function respondWithFilteredResult(_0x32c399,_0x48feb4){return function(_0x470021){if(_0x470021){var _0x20c007=typeof _0x48feb4['offset']===_0x6ffd('0x2f')&&typeof _0x48feb4[_0x6ffd('0x30')]===_0x6ffd('0x2f');var _0x11a5cb=_0x470021[_0x6ffd('0x31')];var _0x31c609=_0x20c007?0x0:_0x48feb4[_0x6ffd('0x32')];var _0xccb8c=_0x20c007?_0x470021[_0x6ffd('0x31')]:_0x48feb4[_0x6ffd('0x32')]+_0x48feb4[_0x6ffd('0x30')];var _0x352656;if(_0xccb8c>=_0x11a5cb){_0xccb8c=_0x11a5cb;_0x352656=0xc8;}else{_0x352656=0xce;}_0x32c399[_0x6ffd('0x33')](_0x352656);return _0x32c399['set']('Content-Range',_0x31c609+'-'+_0xccb8c+'/'+_0x11a5cb)['json'](_0x470021);}return null;};}function patchUpdates(_0x2bd692){return function(_0x2bbb6e){try{jsonpatch[_0x6ffd('0x34')](_0x2bbb6e,_0x2bd692,!![]);}catch(_0x528a3f){return BPromise[_0x6ffd('0x35')](_0x528a3f);}return _0x2bbb6e[_0x6ffd('0x36')]();};}function saveUpdates(_0x1cf1d0,_0x2b81de){return function(_0x403e72){if(_0x403e72){return _0x403e72[_0x6ffd('0x37')](_0x1cf1d0)[_0x6ffd('0x23')](function(_0x159bad){return _0x159bad;});}return null;};}function removeEntity(_0x43dc0c,_0x4efa12){return function(_0x46e447){if(_0x46e447){return _0x46e447[_0x6ffd('0x38')]()[_0x6ffd('0x23')](function(){_0x43dc0c[_0x6ffd('0x33')](0xcc)['end']();});}};}function handleEntityNotFound(_0x221a28,_0x4cd93a){return function(_0x5b6f9b){if(!_0x5b6f9b){_0x221a28[_0x6ffd('0x2e')](0x194);}return _0x5b6f9b;};}function handleError(_0xec347a,_0x25bc7c){_0x25bc7c=_0x25bc7c||0x1f4;return function(_0x2ad43d){logger['error'](_0x2ad43d[_0x6ffd('0x39')]);if(_0x2ad43d['name']){delete _0x2ad43d[_0x6ffd('0x3a')];}_0xec347a[_0x6ffd('0x33')](_0x25bc7c)[_0x6ffd('0x3b')](_0x2ad43d);};}exports[_0x6ffd('0x3c')]=function(_0x23fae4,_0x5a24d0){var _0x5983c0={},_0x28042b={},_0x58e1f1={'count':0x0,'rows':[]};var _0x2a7278=_[_0x6ffd('0x3d')](db[_0x6ffd('0x3e')][_0x6ffd('0x3f')],function(_0x6ee6f0){return{'name':_0x6ee6f0[_0x6ffd('0x40')],'type':_0x6ee6f0['type'][_0x6ffd('0x41')]};});_0x28042b[_0x6ffd('0x42')]=_[_0x6ffd('0x3d')](_0x2a7278,_0x6ffd('0x3a'));_0x28042b['query']=_[_0x6ffd('0x43')](_0x23fae4['query']);_0x28042b[_0x6ffd('0x44')]=_[_0x6ffd('0x45')](_0x28042b[_0x6ffd('0x42')],_0x28042b['query']);_0x5983c0[_0x6ffd('0x46')]=_[_0x6ffd('0x45')](_0x28042b[_0x6ffd('0x42')],qs[_0x6ffd('0x47')](_0x23fae4[_0x6ffd('0x48')][_0x6ffd('0x47')]));_0x5983c0[_0x6ffd('0x46')]=_0x5983c0['attributes']['length']?_0x5983c0['attributes']:_0x28042b[_0x6ffd('0x42')];if(!_0x23fae4[_0x6ffd('0x48')]['hasOwnProperty'](_0x6ffd('0x49'))){_0x5983c0[_0x6ffd('0x30')]=qs[_0x6ffd('0x30')](_0x23fae4[_0x6ffd('0x48')]['limit']);_0x5983c0[_0x6ffd('0x32')]=qs[_0x6ffd('0x32')](_0x23fae4[_0x6ffd('0x48')][_0x6ffd('0x32')]);}_0x5983c0[_0x6ffd('0x4a')]=qs[_0x6ffd('0x4b')](_0x23fae4[_0x6ffd('0x48')][_0x6ffd('0x4b')]);_0x5983c0[_0x6ffd('0x4c')]=qs[_0x6ffd('0x44')](_[_0x6ffd('0x4d')](_0x23fae4['query'],_0x28042b['filters']),_0x2a7278);if(_0x23fae4['query'][_0x6ffd('0x4e')]){_0x5983c0[_0x6ffd('0x4c')]=_['merge'](_0x5983c0[_0x6ffd('0x4c')],{'$or':_[_0x6ffd('0x3d')](_0x2a7278,function(_0x22c1ba){if(_0x22c1ba[_0x6ffd('0x4f')]!==_0x6ffd('0x50')){var _0x57e547={};_0x57e547[_0x22c1ba[_0x6ffd('0x3a')]]={'$like':'%'+_0x23fae4[_0x6ffd('0x48')][_0x6ffd('0x4e')]+'%'};return _0x57e547;}})});}_0x5983c0=_['merge']({},_0x5983c0,_0x23fae4[_0x6ffd('0x51')]);var _0x15bc35={'where':_0x5983c0[_0x6ffd('0x4c')]};return db[_0x6ffd('0x3e')][_0x6ffd('0x31')](_0x15bc35)[_0x6ffd('0x23')](function(_0x563f20){_0x58e1f1[_0x6ffd('0x31')]=_0x563f20;if(_0x23fae4[_0x6ffd('0x48')][_0x6ffd('0x52')]){_0x5983c0[_0x6ffd('0x53')]=[{'all':!![]}];}return db[_0x6ffd('0x3e')][_0x6ffd('0x54')](_0x5983c0);})[_0x6ffd('0x23')](function(_0x4a6e0b){_0x58e1f1[_0x6ffd('0x55')]=_0x4a6e0b;return _0x58e1f1;})[_0x6ffd('0x23')](respondWithFilteredResult(_0x5a24d0,_0x5983c0))['catch'](handleError(_0x5a24d0,null));};exports['show']=function(_0x5aea31,_0x3362ba){var _0x58a3d5={'raw':!![],'where':{'id':_0x5aea31[_0x6ffd('0x56')]['id']}},_0x398fd5={};_0x398fd5[_0x6ffd('0x42')]=_[_0x6ffd('0x43')](db['WhatsappMessage'][_0x6ffd('0x3f')]);_0x398fd5[_0x6ffd('0x48')]=_[_0x6ffd('0x43')](_0x5aea31['query']);_0x398fd5[_0x6ffd('0x44')]=_[_0x6ffd('0x45')](_0x398fd5['model'],_0x398fd5['query']);_0x58a3d5[_0x6ffd('0x46')]=_[_0x6ffd('0x45')](_0x398fd5[_0x6ffd('0x42')],qs[_0x6ffd('0x47')](_0x5aea31[_0x6ffd('0x48')][_0x6ffd('0x47')]));_0x58a3d5[_0x6ffd('0x46')]=_0x58a3d5['attributes'][_0x6ffd('0x57')]?_0x58a3d5[_0x6ffd('0x46')]:_0x398fd5[_0x6ffd('0x42')];if(_0x5aea31['query']['includeAll']){_0x58a3d5[_0x6ffd('0x53')]=[{'all':!![]}];}_0x58a3d5=_[_0x6ffd('0x58')]({},_0x58a3d5,_0x5aea31[_0x6ffd('0x51')]);return db[_0x6ffd('0x3e')]['find'](_0x58a3d5)[_0x6ffd('0x23')](handleEntityNotFound(_0x3362ba,null))[_0x6ffd('0x23')](respondWithResult(_0x3362ba,null))[_0x6ffd('0x2d')](handleError(_0x3362ba,null));};exports[_0x6ffd('0x59')]=function(_0x24876b,_0x2a12f8){return db['WhatsappMessage'][_0x6ffd('0x59')](_0x24876b[_0x6ffd('0x5a')],{})[_0x6ffd('0x23')](respondWithResult(_0x2a12f8,0xc9))[_0x6ffd('0x2d')](handleError(_0x2a12f8,null));};exports[_0x6ffd('0x37')]=function(_0x4b87fc,_0x1f06c0){if(_0x4b87fc[_0x6ffd('0x5a')]['id']){delete _0x4b87fc[_0x6ffd('0x5a')]['id'];}return db[_0x6ffd('0x3e')][_0x6ffd('0x5b')]({'where':{'id':_0x4b87fc['params']['id']}})[_0x6ffd('0x23')](handleEntityNotFound(_0x1f06c0,null))[_0x6ffd('0x23')](saveUpdates(_0x4b87fc[_0x6ffd('0x5a')],null))['then'](respondWithResult(_0x1f06c0,null))[_0x6ffd('0x2d')](handleError(_0x1f06c0,null));};exports[_0x6ffd('0x38')]=function(_0x5284d5,_0x42ce2a){return db['WhatsappMessage'][_0x6ffd('0x5b')]({'where':{'id':_0x5284d5[_0x6ffd('0x56')]['id']}})['then'](handleEntityNotFound(_0x42ce2a,null))[_0x6ffd('0x23')](removeEntity(_0x42ce2a,null))['catch'](handleError(_0x42ce2a,null));};exports[_0x6ffd('0x5c')]=function(_0x186f1e,_0x196b4a){return db[_0x6ffd('0x3e')][_0x6ffd('0x5c')]()['then'](respondWithResult(_0x196b4a,null))[_0x6ffd('0x2d')](handleError(_0x196b4a,null));};var interaction_log=require(_0x6ffd('0x15'))(_0x6ffd('0x5d'));exports[_0x6ffd('0x5e')]=function(_0x4b34cf,_0x38a627,_0x183ac7){var _0x46f9bc={'agent':{},'channel':'whatsapp'};if(_0x4b34cf[_0x6ffd('0x5a')]['id']){delete _0x4b34cf['body']['id'];}_0x4b34cf[_0x6ffd('0x5a')]['read']=!![];_0x4b34cf[_0x6ffd('0x5a')][_0x6ffd('0x5f')]=moment()[_0x6ffd('0x60')](_0x6ffd('0x61'));_0x4b34cf['body'][_0x6ffd('0x62')]=_0x4b34cf[_0x6ffd('0x5a')][_0x6ffd('0x62')]||_0x4b34cf[_0x6ffd('0x63')]['id'];_0x46f9bc[_0x6ffd('0x64')]['id']=_0x4b34cf[_0x6ffd('0x5a')][_0x6ffd('0x62')];return db[_0x6ffd('0x3e')][_0x6ffd('0x5b')]({'where':{'id':_0x4b34cf[_0x6ffd('0x56')]['id'],'UserId':null}})[_0x6ffd('0x23')](handleEntityNotFound(_0x38a627,null))[_0x6ffd('0x23')](saveUpdates(_0x4b34cf[_0x6ffd('0x5a')],null))[_0x6ffd('0x23')](function(_0x338f37){if(_0x338f37){_0x46f9bc[_0x6ffd('0x2a')]=_0x338f37[_0x6ffd('0x65')]({'plain':!![]});return db[_0x6ffd('0x66')][_0x6ffd('0x5b')]({'where':{'id':_0x338f37[_0x6ffd('0x67')]}});}return null;})[_0x6ffd('0x23')](handleEntityNotFound(_0x38a627,null))[_0x6ffd('0x23')](function(_0x2f9e47){if(_0x2f9e47){return _0x2f9e47[_0x6ffd('0x37')]({'UserId':_0x4b34cf[_0x6ffd('0x5a')]['UserId'],'read1stAt':_[_0x6ffd('0x68')](_0x2f9e47['read1stAt'])?moment()[_0x6ffd('0x60')](_0x6ffd('0x61')):undefined});}return null;})[_0x6ffd('0x23')](function(_0x39718e){if(_0x39718e){_0x46f9bc[_0x6ffd('0x69')]=_0x39718e[_0x6ffd('0x65')]({'plain':!![]});interaction_log[_0x6ffd('0x24')]('[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x4b34cf[_0x6ffd('0x63')]['id'],_0x4b34cf[_0x6ffd('0x63')][_0x6ffd('0x3a')],_0x4b34cf[_0x6ffd('0x63')][_0x6ffd('0x6a')],_0x46f9bc[_0x6ffd('0x69')]['id'],_0x4b34cf[_0x6ffd('0x5a')]?JSON[_0x6ffd('0x27')](_0x4b34cf[_0x6ffd('0x5a')]):_0x6ffd('0x6b'));return respondWithRpcPromise('AcceptMessage',_0x6ffd('0x6c'),_0x46f9bc);}return null;})[_0x6ffd('0x23')](function(_0x18ac12){var _0x3b546c=_0x6ffd('0x6d')+_0x18ac12[_0x6ffd('0x2a')]['ContactId'];return db['sequelize'][_0x6ffd('0x48')](_0x3b546c,{'type':db[_0x6ffd('0x6e')]['QueryTypes'][_0x6ffd('0x6f')],'raw':!![]})['then'](function(_0x2a385e){return _0x2a385e;});})['then'](function(_0x272e61){if(_0x272e61){_0x46f9bc[_0x6ffd('0x2a')]['contact']=_0x272e61[0x0];if(!_0x4b34cf[_0x6ffd('0x5a')]['UserId'])return;return db[_0x6ffd('0x70')][_0x6ffd('0x5b')]({'where':{'id':_0x4b34cf['body'][_0x6ffd('0x62')],'role':_0x6ffd('0x64')},'attributes':['id',_0x6ffd('0x3a'),'fullname',_0x6ffd('0x71'),_0x6ffd('0x72')],'raw':!![]});}return null;})[_0x6ffd('0x23')](function(_0x418b48){if(!_0x418b48)return null;_0x46f9bc[_0x6ffd('0x2a')][_0x6ffd('0x64')]=_0x418b48;return _0x46f9bc;})[_0x6ffd('0x23')](function(_0x463df2){if(_0x463df2){if(_0x4b34cf['body'][_0x6ffd('0x73')]){_0x46f9bc[_0x6ffd('0x2a')]['interface']=util['format']('SIP/%s',_0x4b34cf[_0x6ffd('0x63')][_0x6ffd('0x3a')]);_0x46f9bc[_0x6ffd('0x2a')][_0x6ffd('0x74')]=_0x46f9bc[_0x6ffd('0x74')];_0x46f9bc[_0x6ffd('0x2a')][_0x6ffd('0x75')]=_0x6ffd('0x5e');return respondWithRpcPromise('EventManager',_0x6ffd('0x76'),{'event':_0x6ffd('0x77'),'message':_0x46f9bc['message']},client9002)[_0x6ffd('0x23')](function(){return _0x46f9bc;});}return _0x46f9bc;}return null;})[_0x6ffd('0x23')](respondWithResult(_0x38a627,null))[_0x6ffd('0x2d')](handleError(_0x38a627,null));};var interaction_log=require(_0x6ffd('0x15'))('whatsapp-interactions');exports['reject']=function(_0x3084f9,_0x53cece,_0x5db7ac){var _0x3e89d6={'agent':{},'channel':_0x6ffd('0x78')};if(_0x3084f9[_0x6ffd('0x5a')]['id']){delete _0x3084f9[_0x6ffd('0x5a')]['id'];}_0x3084f9[_0x6ffd('0x5a')][_0x6ffd('0x62')]=_0x3084f9[_0x6ffd('0x5a')][_0x6ffd('0x62')]||_0x3084f9[_0x6ffd('0x63')]['id'];_0x3e89d6[_0x6ffd('0x64')]['id']=_0x3084f9[_0x6ffd('0x5a')][_0x6ffd('0x62')];return db['WhatsappMessage']['find']({'where':{'id':_0x3084f9[_0x6ffd('0x56')]['id'],'UserId':null}})[_0x6ffd('0x23')](handleEntityNotFound(_0x53cece,null))[_0x6ffd('0x23')](function(_0x1a3747){if(_0x1a3747){_0x3e89d6[_0x6ffd('0x2a')]=_0x1a3747['get']({'plain':!![]});return db[_0x6ffd('0x66')][_0x6ffd('0x5b')]({'where':{'id':_0x1a3747[_0x6ffd('0x67')]}});}return null;})[_0x6ffd('0x23')](handleEntityNotFound(_0x53cece,null))['then'](function(_0xc27551){if(_0xc27551){_0x3e89d6[_0x6ffd('0x69')]=_0xc27551['get']({'plain':!![]});interaction_log[_0x6ffd('0x24')](_0x6ffd('0x79'),_0x3084f9[_0x6ffd('0x63')]['id'],_0x3084f9[_0x6ffd('0x63')][_0x6ffd('0x3a')],_0x3084f9[_0x6ffd('0x63')]['role'],_0x3e89d6[_0x6ffd('0x69')]['id'],_0x3084f9['body']?JSON['stringify'](_0x3084f9[_0x6ffd('0x5a')]):_0x6ffd('0x6b'));return respondWithRpcPromise('RejectMessage',_0x6ffd('0x7a'),_0x3e89d6);}return null;})[_0x6ffd('0x23')](function(_0x416342){var _0xb30598=_0x6ffd('0x6d')+_0x416342[_0x6ffd('0x2a')][_0x6ffd('0x7b')];return db[_0x6ffd('0x7c')][_0x6ffd('0x48')](_0xb30598,{'type':db[_0x6ffd('0x6e')][_0x6ffd('0x7d')]['SELECT'],'raw':!![]})[_0x6ffd('0x23')](function(_0x153f2d){return _0x153f2d;});})['then'](function(_0xad693e){if(_0xad693e){_0x3e89d6[_0x6ffd('0x2a')][_0x6ffd('0x7e')]=_0xad693e[0x0];if(!_0x3084f9[_0x6ffd('0x5a')]['UserId'])return;return db[_0x6ffd('0x70')][_0x6ffd('0x5b')]({'where':{'id':_0x3084f9['body'][_0x6ffd('0x62')],'role':_0x6ffd('0x64')},'attributes':['id','name','fullname',_0x6ffd('0x71'),_0x6ffd('0x72')],'raw':!![]});}return null;})['then'](function(_0x113f5e){if(!_0x113f5e)return null;_0x3e89d6['message']['agent']=_0x113f5e;return _0x3e89d6;})[_0x6ffd('0x23')](function(_0x24df0d){if(_0x24df0d){_0x24df0d['message']['interface']=util['format'](_0x6ffd('0x7f'),_0x3084f9[_0x6ffd('0x63')][_0x6ffd('0x3a')]);_0x24df0d['message'][_0x6ffd('0x74')]=_0x3e89d6[_0x6ffd('0x74')];_0x24df0d[_0x6ffd('0x2a')][_0x6ffd('0x75')]=_0x6ffd('0x35');respondWithRpcPromise('EventManager',_0x6ffd('0x76'),{'event':_0x6ffd('0x80'),'message':_0x24df0d['message']},client9002);return _0x3e89d6;}return null;})['then'](respondWithResult(_0x53cece,null))[_0x6ffd('0x2d')](handleError(_0x53cece,null));};exports[_0x6ffd('0x33')]=function(_0x19915c,_0x558b5a,_0x48a82a){if(_0x19915c[_0x6ffd('0x5a')]['id']){delete _0x19915c[_0x6ffd('0x5a')]['id'];}var _0x59dcaa;return db[_0x6ffd('0x3e')][_0x6ffd('0x5b')]({'where':{'id':_0x19915c[_0x6ffd('0x56')]['id']}})['then'](handleEntityNotFound(_0x558b5a,null))[_0x6ffd('0x23')](function(_0x3df19f){if(_0x3df19f){_0x59dcaa=_0x3df19f;return db[_0x6ffd('0x81')][_0x6ffd('0x5b')]({'where':{'id':_0x3df19f[_0x6ffd('0x82')]}});}})[_0x6ffd('0x23')](handleEntityNotFound(_0x558b5a,null))[_0x6ffd('0x23')](function(_0x49bb61){if(_0x49bb61){logger[_0x6ffd('0x25')](_0x6ffd('0x83'),_0x6ffd('0x33'),'received\x20delivery\x20report\x20from',_0x49bb61[_0x6ffd('0x4f')],util['inspect'](_0x19915c[_0x6ffd('0x5a')],{'showHidden':![],'depth':null}));switch(_0x49bb61[_0x6ffd('0x4f')]){case _0x6ffd('0x84'):if(_0x19915c[_0x6ffd('0x5a')][_0x6ffd('0x85')]&&_0x19915c[_0x6ffd('0x5a')]['MessageSid']===_0x59dcaa[_0x6ffd('0x86')]&&_0x19915c[_0x6ffd('0x5a')][_0x6ffd('0x87')]&&_0x19915c[_0x6ffd('0x5a')][_0x6ffd('0x87')]===_0x6ffd('0x88')){return _0x59dcaa['update']({'read':!![]});}else{logger[_0x6ffd('0x28')](_0x6ffd('0x89'),_0x6ffd('0x33'),_0x6ffd('0x84'),util[_0x6ffd('0x8a')](_0x19915c[_0x6ffd('0x5a')],{'showHidden':![],'depth':null}));}break;}return _0x59dcaa;}})['then'](respondWithResult(_0x558b5a,null))['catch'](handleError(_0x558b5a,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 582758b..f9a7a80 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 _0xb7e7=['hook','exports','events','WhatsappMessage','save','remove','hasOwnProperty'];(function(_0x5e4adc,_0x32003c){var _0x4f6ca7=function(_0x4736fd){while(--_0x4736fd){_0x5e4adc['push'](_0x5e4adc['shift']());}};_0x4f6ca7(++_0x32003c);}(_0xb7e7,0x121));var _0x7b7e=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xb7e7[_0x2f5ac5];return _0x37c9a8;};'use strict';var EventEmitter=require(_0x7b7e('0x0'));var WhatsappMessage=require('../../mysqldb')['db'][_0x7b7e('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7b7e('0x2'),'afterUpdate':'update','afterDestroy':_0x7b7e('0x3')};function emitEvent(_0x556d68){return function(_0x31d0ed,_0x118577,_0x1d9384){WhatsappMessageEvents['emit'](_0x556d68+':'+_0x31d0ed['id'],_0x31d0ed);WhatsappMessageEvents['emit'](_0x556d68,_0x31d0ed);_0x1d9384(null);};}for(var e in events){if(events[_0x7b7e('0x4')](e)){var event=events[e];WhatsappMessage[_0x7b7e('0x5')](e,emitEvent(event));}}module[_0x7b7e('0x6')]=WhatsappMessageEvents; \ No newline at end of file +var _0x7794=['save','remove','hasOwnProperty','hook','../../mysqldb','WhatsappMessage','setMaxListeners'];(function(_0x4c80d7,_0x2bef29){var _0x3c5095=function(_0x1b0e67){while(--_0x1b0e67){_0x4c80d7['push'](_0x4c80d7['shift']());}};_0x3c5095(++_0x2bef29);}(_0x7794,0x7b));var _0x4779=function(_0x50b9e5,_0x2d9462){_0x50b9e5=_0x50b9e5-0x0;var _0x45e46f=_0x7794[_0x50b9e5];return _0x45e46f;};'use strict';var EventEmitter=require('events');var WhatsappMessage=require(_0x4779('0x0'))['db'][_0x4779('0x1')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x4779('0x2')](0x0);var events={'afterCreate':_0x4779('0x3'),'afterUpdate':'update','afterDestroy':_0x4779('0x4')};function emitEvent(_0x1e9fdc){return function(_0x4d3b05,_0x40e5f9,_0x54dc7f){WhatsappMessageEvents['emit'](_0x1e9fdc+':'+_0x4d3b05['id'],_0x4d3b05);WhatsappMessageEvents['emit'](_0x1e9fdc,_0x4d3b05);_0x54dc7f(null);};}for(var e in events){if(events[_0x4779('0x5')](e)){var event=events[e];WhatsappMessage[_0x4779('0x6')](e,emitEvent(event));}}module['exports']=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index 9df3dee..100e97d 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 _0x78a8=['WhatsappInteractionId','update','createdAt','catch','error','out','WhatsappAccount','find','then','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','WhatsappMessage','messageId','fti_whatsapp_messages','body','FULLTEXT','toLowerCase','direction','secret','isNil','UserId','findOne'];(function(_0x2bc7cb,_0x2af9a2){var _0x5cfe0d=function(_0x4c265a){while(--_0x4c265a){_0x2bc7cb['push'](_0x2bc7cb['shift']());}};_0x5cfe0d(++_0x2af9a2);}(_0x78a8,0xda));var _0x878a=function(_0xaa0aa1,_0x333ad5){_0xaa0aa1=_0xaa0aa1-0x0;var _0x119d49=_0x78a8[_0xaa0aa1];return _0x119d49;};'use strict';var _=require(_0x878a('0x0'));var util=require(_0x878a('0x1'));var logger=require(_0x878a('0x2'))('api');var moment=require('moment');var BPromise=require(_0x878a('0x3'));var rp=require(_0x878a('0x4'));var fs=require('fs');var path=require(_0x878a('0x5'));var rimraf=require(_0x878a('0x6'));var config=require(_0x878a('0x7'));var attributes=require(_0x878a('0x8'));module[_0x878a('0x9')]=function(_0x41c466,_0x1f6a01){return _0x41c466[_0x878a('0xa')](_0x878a('0xb'),attributes,{'tableName':'whatsapp_messages','paranoid':![],'indexes':[{'name':_0x878a('0xc'),'fields':['messageId']},{'name':_0x878a('0xd'),'fields':[_0x878a('0xe')],'type':_0x878a('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0xa69e5a,_0x5328d5,_0x3ebceb){var _0x1a6acf=_0x41c466['models'];var _0x30cef1=_0xa69e5a['get']({'plain':!![]});if(_0x30cef1['direction'][_0x878a('0x10')]()==='in'||_0x30cef1[_0x878a('0x11')][_0x878a('0x10')]()==='out'&&!_0x30cef1[_0x878a('0x12')]&&!_[_0x878a('0x13')](_0x30cef1[_0x878a('0x14')])){_0x1a6acf['WhatsappInteraction'][_0x878a('0x15')]({'where':{'id':_0x30cef1[_0x878a('0x16')]}})['then'](function(_0x46e624){if(_0x46e624){_0x46e624[_0x878a('0x17')]({'lastMsgAt':_0x30cef1[_0x878a('0x18')],'lastMsgDirection':_0x30cef1[_0x878a('0x11')]['toLowerCase']()});}})[_0x878a('0x19')](function(_0x191b59){console[_0x878a('0x1a')](_0x191b59);});}if(_0x30cef1[_0x878a('0x11')]===_0x878a('0x1b')&&!_0x30cef1['secret']){var _0x5a69d8;_0x1a6acf[_0x878a('0x1c')][_0x878a('0x1d')]({'where':{'id':_0x30cef1['WhatsappAccountId']},'raw':!![]})[_0x878a('0x1e')](function(_0xa832c2){_0x5a69d8=_0xa832c2;if(_0x5a69d8&&_0x5a69d8[_0x878a('0x1f')]){switch(_0x5a69d8[_0x878a('0x1f')]){case _0x878a('0x20'):var _0x31c83d=require('twilio');if(_0x5a69d8[_0x878a('0x21')]&&_0x5a69d8[_0x878a('0x22')]&&_0x5a69d8[_0x878a('0x23')]){var _0x1967d3=new _0x31c83d(_0x5a69d8[_0x878a('0x21')],_0x5a69d8['authToken']);_0x1967d3[_0x878a('0x24')]['create']({'body':_0x30cef1[_0x878a('0xe')],'to':_0x878a('0x25')+_0x30cef1['phone'],'from':_0x878a('0x25')+_0x5a69d8[_0x878a('0x23')],'statusCallback':_0x5a69d8[_0x878a('0x26')]+_0x878a('0x27')+_0x30cef1['id']+'/status?token='+_0x5a69d8[_0x878a('0x28')]})[_0x878a('0x1e')](function(_0x44eebc){if(_0x44eebc['sid']){return _0xa69e5a[_0x878a('0x17')]({'messageId':_0x44eebc[_0x878a('0x29')]});}})[_0x878a('0x19')](function(_0x31e437){logger[_0x878a('0x1a')](_0x878a('0x2a'),_0x878a('0x2b'),_0x878a('0x20'),util['inspect'](_0x31e437,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x878a('0x2a'),_0x878a('0x2b'),_0x878a('0x20'),_0x878a('0x2c'));}break;}}})[_0x878a('0x2d')](function(){_0x3ebceb();});}else{_0x3ebceb();}}},'charset':_0x878a('0x2e'),'collate':_0x878a('0x2f')});}; \ No newline at end of file +var _0x4977=['body','FULLTEXT','models','direction','toLowerCase','out','secret','isNil','UserId','WhatsappInteraction','then','catch','error','find','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','update','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','finally','utf8mb4','utf8mb4_unicode_ci','util','../../config/logger','bluebird','request-promise','path','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages'];(function(_0x3c0ab0,_0x1015b6){var _0x35db88=function(_0x3dbd1d){while(--_0x3dbd1d){_0x3c0ab0['push'](_0x3c0ab0['shift']());}};_0x35db88(++_0x1015b6);}(_0x4977,0x103));var _0x7497=function(_0x30ab93,_0x4ea6a5){_0x30ab93=_0x30ab93-0x0;var _0xa93eea=_0x4977[_0x30ab93];return _0xa93eea;};'use strict';var _=require('lodash');var util=require(_0x7497('0x0'));var logger=require(_0x7497('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7497('0x2'));var rp=require(_0x7497('0x3'));var fs=require('fs');var path=require(_0x7497('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7497('0x5'));module[_0x7497('0x6')]=function(_0x144e45,_0x1a4215){return _0x144e45['define'](_0x7497('0x7'),attributes,{'tableName':_0x7497('0x8'),'paranoid':![],'indexes':[{'name':_0x7497('0x9'),'fields':[_0x7497('0x9')]},{'name':_0x7497('0xa'),'fields':[_0x7497('0xb')],'type':_0x7497('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x196820,_0x2c05a6,_0x221e4d){var _0x2dff0d=_0x144e45[_0x7497('0xd')];var _0x4714f5=_0x196820['get']({'plain':!![]});if(_0x4714f5[_0x7497('0xe')][_0x7497('0xf')]()==='in'||_0x4714f5[_0x7497('0xe')][_0x7497('0xf')]()===_0x7497('0x10')&&!_0x4714f5[_0x7497('0x11')]&&!_[_0x7497('0x12')](_0x4714f5[_0x7497('0x13')])){_0x2dff0d[_0x7497('0x14')]['findOne']({'where':{'id':_0x4714f5['WhatsappInteractionId']}})[_0x7497('0x15')](function(_0x30448b){if(_0x30448b){_0x30448b['update']({'lastMsgAt':_0x4714f5['createdAt'],'lastMsgDirection':_0x4714f5[_0x7497('0xe')][_0x7497('0xf')]()});}})[_0x7497('0x16')](function(_0x107cf7){console[_0x7497('0x17')](_0x107cf7);});}if(_0x4714f5[_0x7497('0xe')]===_0x7497('0x10')&&!_0x4714f5[_0x7497('0x11')]){var _0x271f61;_0x2dff0d['WhatsappAccount'][_0x7497('0x18')]({'where':{'id':_0x4714f5[_0x7497('0x19')]},'raw':!![]})[_0x7497('0x15')](function(_0x21a09c){_0x271f61=_0x21a09c;if(_0x271f61&&_0x271f61[_0x7497('0x1a')]){switch(_0x271f61[_0x7497('0x1a')]){case _0x7497('0x1b'):var _0x1eafd8=require('twilio');if(_0x271f61[_0x7497('0x1c')]&&_0x271f61[_0x7497('0x1d')]&&_0x271f61[_0x7497('0x1e')]){var _0x3b5a0e=new _0x1eafd8(_0x271f61[_0x7497('0x1c')],_0x271f61[_0x7497('0x1d')]);_0x3b5a0e[_0x7497('0x1f')]['create']({'body':_0x4714f5[_0x7497('0xb')],'to':_0x7497('0x20')+_0x4714f5[_0x7497('0x1e')],'from':_0x7497('0x20')+_0x271f61[_0x7497('0x1e')],'statusCallback':_0x271f61[_0x7497('0x21')]+_0x7497('0x22')+_0x4714f5['id']+_0x7497('0x23')+_0x271f61[_0x7497('0x24')]})[_0x7497('0x15')](function(_0x2f6c87){if(_0x2f6c87['sid']){return _0x196820[_0x7497('0x25')]({'messageId':_0x2f6c87['sid']});}})[_0x7497('0x16')](function(_0x392289){logger[_0x7497('0x17')](_0x7497('0x26'),_0x7497('0x27'),_0x7497('0x1b'),util[_0x7497('0x28')](_0x392289,{'showHidden':![],'depth':null}));});}else{logger[_0x7497('0x17')](_0x7497('0x26'),_0x7497('0x27'),_0x7497('0x1b'),_0x7497('0x29'));}break;}}})[_0x7497('0x2a')](function(){_0x221e4d();});}else{_0x221e4d();}}},'charset':_0x7497('0x2b'),'collate':_0x7497('0x2c')});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index a1d6256..ebdfb32 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 _0x119f=['info','result','WhatsappMessage','create','body','options','raw','CreateWhatsappMessage','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message'];(function(_0x31afb1,_0x42cc07){var _0x52b869=function(_0x5b1b5e){while(--_0x5b1b5e){_0x31afb1['push'](_0x31afb1['shift']());}};_0x52b869(++_0x42cc07);}(_0x119f,0x15c));var _0xf119=function(_0x41905e,_0x3c6bbf){_0x41905e=_0x41905e-0x0;var _0x9c7264=_0x119f[_0x41905e];return _0x9c7264;};'use strict';var _=require(_0xf119('0x0'));var util=require(_0xf119('0x1'));var moment=require(_0xf119('0x2'));var BPromise=require(_0xf119('0x3'));var rs=require(_0xf119('0x4'));var fs=require('fs');var Redis=require(_0xf119('0x5'));var db=require(_0xf119('0x6'))['db'];var utils=require(_0xf119('0x7'));var logger=require(_0xf119('0x8'))(_0xf119('0x9'));var config=require('../../config/environment');var jayson=require(_0xf119('0xa'));var client=jayson['client'][_0xf119('0xb')]({'port':0x232a});config[_0xf119('0xc')]=_[_0xf119('0xd')](config['redis'],{'host':_0xf119('0xe'),'port':0x18eb});var socket=require(_0xf119('0xf'))(new Redis(config[_0xf119('0xc')]));require('./whatsappMessage.socket')[_0xf119('0x10')](socket);function respondWithRpcPromise(_0x5a8405,_0x2cc3b8,_0x17b20a){return new BPromise(function(_0x20a64b,_0x46eda4){return client[_0xf119('0x11')](_0x5a8405,_0x17b20a)[_0xf119('0x12')](function(_0x4d2eb7){logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x2cc3b8,_0xf119('0x13'));logger[_0xf119('0x14')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x2cc3b8,'request\x20sent',JSON[_0xf119('0x15')](_0x4d2eb7));if(_0x4d2eb7[_0xf119('0x16')]){if(_0x4d2eb7[_0xf119('0x16')][_0xf119('0x17')]===0x1f4){logger[_0xf119('0x16')](_0xf119('0x18'),_0x2cc3b8,_0x4d2eb7[_0xf119('0x16')][_0xf119('0x19')]);return _0x46eda4(_0x4d2eb7[_0xf119('0x16')][_0xf119('0x19')]);}logger[_0xf119('0x16')](_0xf119('0x18'),_0x2cc3b8,_0x4d2eb7[_0xf119('0x16')][_0xf119('0x19')]);return _0x20a64b(_0x4d2eb7[_0xf119('0x16')][_0xf119('0x19')]);}else{logger[_0xf119('0x1a')]('WhatsappMessage,\x20%s,\x20%s',_0x2cc3b8,_0xf119('0x13'));_0x20a64b(_0x4d2eb7[_0xf119('0x1b')][_0xf119('0x19')]);}})['catch'](function(_0x33e3a1){logger[_0xf119('0x16')](_0xf119('0x18'),_0x2cc3b8,_0x33e3a1);_0x46eda4(_0x33e3a1);});});}exports['CreateWhatsappMessage']=function(_0x4188df){var _0x434e48=this;return new Promise(function(_0x50fa5a,_0x5120d6){return db[_0xf119('0x1c')][_0xf119('0x1d')](_0x4188df[_0xf119('0x1e')],{'raw':_0x4188df['options']?_0x4188df[_0xf119('0x1f')][_0xf119('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x180b2e){logger['info'](_0xf119('0x21'),_0x4188df);logger['debug']('CreateWhatsappMessage',_0x4188df,JSON['stringify'](_0x180b2e));_0x50fa5a(_0x180b2e);})['catch'](function(_0x5a414d){logger[_0xf119('0x16')](_0xf119('0x21'),_0x5a414d[_0xf119('0x19')],_0x4188df);_0x5120d6(_0x434e48[_0xf119('0x16')](0x1f4,_0x5a414d[_0xf119('0x19')]));});});}; \ No newline at end of file +var _0x6ac6=['defaults','localhost','socket.io-emitter','request','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','CreateWhatsappMessage','WhatsappMessage','body','options','raw','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','redis'];(function(_0x1ca3e2,_0x403f48){var _0xffa57e=function(_0xb79f38){while(--_0xb79f38){_0x1ca3e2['push'](_0x1ca3e2['shift']());}};_0xffa57e(++_0x403f48);}(_0x6ac6,0x1e6));var _0x66ac=function(_0x414f1f,_0x1ffb48){_0x414f1f=_0x414f1f-0x0;var _0x170a64=_0x6ac6[_0x414f1f];return _0x170a64;};'use strict';var _=require(_0x66ac('0x0'));var util=require('util');var moment=require(_0x66ac('0x1'));var BPromise=require(_0x66ac('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x66ac('0x3'));var db=require(_0x66ac('0x4'))['db'];var utils=require(_0x66ac('0x5'));var logger=require(_0x66ac('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x66ac('0x7'));var client=jayson[_0x66ac('0x8')]['http']({'port':0x232a});config[_0x66ac('0x9')]=_[_0x66ac('0xa')](config[_0x66ac('0x9')],{'host':_0x66ac('0xb'),'port':0x18eb});var socket=require(_0x66ac('0xc'))(new Redis(config[_0x66ac('0x9')]));require('./whatsappMessage.socket')['register'](socket);function respondWithRpcPromise(_0x43475e,_0x2a6ee9,_0x419f40){return new BPromise(function(_0x3d268b,_0x58ca43){return client[_0x66ac('0xd')](_0x43475e,_0x419f40)[_0x66ac('0xe')](function(_0x4ad277){logger['info'](_0x66ac('0xf'),_0x2a6ee9,_0x66ac('0x10'));logger[_0x66ac('0x11')](_0x66ac('0x12'),_0x2a6ee9,'request\x20sent',JSON[_0x66ac('0x13')](_0x4ad277));if(_0x4ad277[_0x66ac('0x14')]){if(_0x4ad277[_0x66ac('0x14')][_0x66ac('0x15')]===0x1f4){logger[_0x66ac('0x14')](_0x66ac('0xf'),_0x2a6ee9,_0x4ad277['error']['message']);return _0x58ca43(_0x4ad277['error'][_0x66ac('0x16')]);}logger[_0x66ac('0x14')](_0x66ac('0xf'),_0x2a6ee9,_0x4ad277[_0x66ac('0x14')][_0x66ac('0x16')]);return _0x3d268b(_0x4ad277[_0x66ac('0x14')][_0x66ac('0x16')]);}else{logger[_0x66ac('0x17')](_0x66ac('0xf'),_0x2a6ee9,_0x66ac('0x10'));_0x3d268b(_0x4ad277[_0x66ac('0x18')][_0x66ac('0x16')]);}})['catch'](function(_0x39521f){logger[_0x66ac('0x14')](_0x66ac('0xf'),_0x2a6ee9,_0x39521f);_0x58ca43(_0x39521f);});});}exports[_0x66ac('0x19')]=function(_0xd9b73f){var _0x392826=this;return new Promise(function(_0x523aab,_0x110601){return db[_0x66ac('0x1a')]['create'](_0xd9b73f[_0x66ac('0x1b')],{'raw':_0xd9b73f['options']?_0xd9b73f[_0x66ac('0x1c')][_0x66ac('0x1d')]===undefined?!![]:![]:!![]})[_0x66ac('0xe')](function(_0xfb4143){logger[_0x66ac('0x17')](_0x66ac('0x19'),_0xd9b73f);logger[_0x66ac('0x11')](_0x66ac('0x19'),_0xd9b73f,JSON[_0x66ac('0x13')](_0xfb4143));_0x523aab(_0xfb4143);})[_0x66ac('0x1e')](function(_0x8a5f85){logger['error']('CreateWhatsappMessage',_0x8a5f85['message'],_0xd9b73f);_0x110601(_0x392826['error'](0x1f4,_0x8a5f85[_0x66ac('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index bc046e8..e35aac5 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 _0x8370=['emit','removeListener','register','length','whatsappMessage:','remove','update'];(function(_0x172d1f,_0xfc1a36){var _0x3d1619=function(_0xc21df2){while(--_0xc21df2){_0x172d1f['push'](_0x172d1f['shift']());}};_0x3d1619(++_0xfc1a36);}(_0x8370,0x1b0));var _0x0837=function(_0x4af39a,_0x403b71){_0x4af39a=_0x4af39a-0x0;var _0x2a66a7=_0x8370[_0x4af39a];return _0x2a66a7;};'use strict';var WhatsappMessageEvents=require('./whatsappMessage.events');var events=['save',_0x0837('0x0'),_0x0837('0x1')];function createListener(_0x4477fb,_0x5023d5){return function(_0x246a68){_0x5023d5[_0x0837('0x2')](_0x4477fb,_0x246a68);};}function removeListener(_0x3689b9,_0x5c2068){return function(){WhatsappMessageEvents[_0x0837('0x3')](_0x3689b9,_0x5c2068);};}exports[_0x0837('0x4')]=function(_0x92d6ca){for(var _0x4b4308=0x0,_0x3febda=events[_0x0837('0x5')];_0x4b4308<_0x3febda;_0x4b4308++){var _0x21b249=events[_0x4b4308];var _0x1db25a=createListener(_0x0837('0x6')+_0x21b249,_0x92d6ca);WhatsappMessageEvents['on'](_0x21b249,_0x1db25a);}}; \ No newline at end of file +var _0x5d9f=['update','emit','register','length','whatsappMessage:','./whatsappMessage.events','save','remove'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x5d9f,0x135));var _0xf5d9=function(_0x55b650,_0x20f665){_0x55b650=_0x55b650-0x0;var _0x4b98f6=_0x5d9f[_0x55b650];return _0x4b98f6;};'use strict';var WhatsappMessageEvents=require(_0xf5d9('0x0'));var events=[_0xf5d9('0x1'),_0xf5d9('0x2'),_0xf5d9('0x3')];function createListener(_0x106287,_0x5cc492){return function(_0x5857c9){_0x5cc492[_0xf5d9('0x4')](_0x106287,_0x5857c9);};}function removeListener(_0x53b3fb,_0x238698){return function(){WhatsappMessageEvents['removeListener'](_0x53b3fb,_0x238698);};}exports[_0xf5d9('0x5')]=function(_0x1fea39){for(var _0x43c6b5=0x0,_0x2fc09e=events[_0xf5d9('0x6')];_0x43c6b5<_0x2fc09e;_0x43c6b5++){var _0x16cd56=events[_0x43c6b5];var _0x5e12a8=createListener(_0xf5d9('0x7')+_0x16cd56,_0x1fea39);WhatsappMessageEvents['on'](_0x16cd56,_0x5e12a8);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 7db6571..14f9c40 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 _0x946c=['/:id','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','create','addAgents','put','delete','destroy','removeTeams','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./whatsappQueue.controller','isAuthenticated','index','get','/describe','describe'];(function(_0x1567b4,_0x596d44){var _0x194caf=function(_0x49f099){while(--_0x49f099){_0x1567b4['push'](_0x1567b4['shift']());}};_0x194caf(++_0x596d44);}(_0x946c,0x17a));var _0xc946=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x946c[_0x1e7b16];return _0x37fadc;};'use strict';var multer=require(_0xc946('0x0'));var util=require(_0xc946('0x1'));var path=require(_0xc946('0x2'));var timeout=require(_0xc946('0x3'));var express=require(_0xc946('0x4'));var router=express[_0xc946('0x5')]();var fs_extra=require(_0xc946('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc946('0x7'));var config=require('../../config/environment');var controller=require(_0xc946('0x8'));router['get']('/',auth[_0xc946('0x9')](),controller[_0xc946('0xa')]);router[_0xc946('0xb')](_0xc946('0xc'),auth['isAuthenticated'](),controller[_0xc946('0xd')]);router[_0xc946('0xb')](_0xc946('0xe'),auth[_0xc946('0x9')](),controller[_0xc946('0xf')]);router[_0xc946('0xb')](_0xc946('0x10'),auth[_0xc946('0x9')](),controller[_0xc946('0x11')]);router[_0xc946('0xb')](_0xc946('0x12'),auth[_0xc946('0x9')](),controller[_0xc946('0x13')]);router[_0xc946('0xb')](_0xc946('0x14'),auth[_0xc946('0x9')](),controller['getAgents']);router[_0xc946('0x15')]('/',auth[_0xc946('0x9')](),controller[_0xc946('0x16')]);router[_0xc946('0x15')](_0xc946('0x12'),auth[_0xc946('0x9')](),controller['addTeams']);router['post'](_0xc946('0x14'),auth[_0xc946('0x9')](),controller[_0xc946('0x17')]);router[_0xc946('0x18')]('/:id',auth['isAuthenticated'](),controller['update']);router[_0xc946('0x19')](_0xc946('0xe'),auth[_0xc946('0x9')](),controller[_0xc946('0x1a')]);router[_0xc946('0x19')](_0xc946('0x12'),auth[_0xc946('0x9')](),controller[_0xc946('0x1b')]);router['delete'](_0xc946('0x14'),auth[_0xc946('0x9')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x8124=['update','delete','removeTeams','removeAgents','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappQueue.controller','get','isAuthenticated','index','/describe','describe','show','/:id/members','getMembers','/:id/teams','getTeams','/:id/users','post','addTeams','addAgents','put','/:id'];(function(_0x304199,_0x665fda){var _0x4673a9=function(_0x360248){while(--_0x360248){_0x304199['push'](_0x304199['shift']());}};_0x4673a9(++_0x665fda);}(_0x8124,0x79));var _0x4812=function(_0x2181fc,_0x7283aa){_0x2181fc=_0x2181fc-0x0;var _0x315da1=_0x8124[_0x2181fc];return _0x315da1;};'use strict';var multer=require(_0x4812('0x0'));var util=require(_0x4812('0x1'));var path=require('path');var timeout=require(_0x4812('0x2'));var express=require(_0x4812('0x3'));var router=express[_0x4812('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x4812('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x4812('0x6'));var controller=require(_0x4812('0x7'));router[_0x4812('0x8')]('/',auth[_0x4812('0x9')](),controller[_0x4812('0xa')]);router[_0x4812('0x8')](_0x4812('0xb'),auth[_0x4812('0x9')](),controller[_0x4812('0xc')]);router['get']('/:id',auth[_0x4812('0x9')](),controller[_0x4812('0xd')]);router[_0x4812('0x8')](_0x4812('0xe'),auth['isAuthenticated'](),controller[_0x4812('0xf')]);router[_0x4812('0x8')](_0x4812('0x10'),auth[_0x4812('0x9')](),controller[_0x4812('0x11')]);router['get'](_0x4812('0x12'),auth[_0x4812('0x9')](),controller['getAgents']);router[_0x4812('0x13')]('/',auth[_0x4812('0x9')](),controller['create']);router[_0x4812('0x13')](_0x4812('0x10'),auth['isAuthenticated'](),controller[_0x4812('0x14')]);router[_0x4812('0x13')](_0x4812('0x12'),auth[_0x4812('0x9')](),controller[_0x4812('0x15')]);router[_0x4812('0x16')](_0x4812('0x17'),auth[_0x4812('0x9')](),controller[_0x4812('0x18')]);router['delete'](_0x4812('0x17'),auth['isAuthenticated'](),controller['destroy']);router[_0x4812('0x19')](_0x4812('0x10'),auth[_0x4812('0x9')](),controller[_0x4812('0x1a')]);router[_0x4812('0x19')](_0x4812('0x12'),auth[_0x4812('0x9')](),controller[_0x4812('0x1b')]);module[_0x4812('0x1c')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.attributes.js b/server/api/whatsappQueue/whatsappQueue.attributes.js index 0d37672..d661104 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 _0xb74d=['sequelize','STRING','INTEGER','rrmemory','beepall','roundrobin'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0xb74d,0x16e));var _0xdb74=function(_0x5a2d95,_0xb362e5){_0x5a2d95=_0x5a2d95-0x0;var _0x2c3986=_0xb74d[_0x5a2d95];return _0x2c3986;};'use strict';var Sequelize=require(_0xdb74('0x0'));module['exports']={'name':{'type':Sequelize[_0xdb74('0x1')],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0xdb74('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdb74('0x3'),_0xdb74('0x4'),_0xdb74('0x5'))},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x2209=['rrmemory','roundrobin','sequelize','exports','STRING','name','INTEGER'];(function(_0x54d4a8,_0x585a59){var _0x3b321b=function(_0x245c6a){while(--_0x245c6a){_0x54d4a8['push'](_0x54d4a8['shift']());}};_0x3b321b(++_0x585a59);}(_0x2209,0x95));var _0x9220=function(_0x2a78ba,_0x473455){_0x2a78ba=_0x2a78ba-0x0;var _0x4746eb=_0x2209[_0x2a78ba];return _0x4746eb;};'use strict';var Sequelize=require(_0x9220('0x0'));module[_0x9220('0x1')]={'name':{'type':Sequelize[_0x9220('0x2')],'unique':_0x9220('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x9220('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0x9220('0x5'),'beepall',_0x9220('0x6'))},'description':{'type':Sequelize[_0x9220('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index a32c219..910c54c 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 _0xecaa=['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','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','set','reject','update','then','destroy','get','WhatsappQueues','UserProfileResource','stack','name','send','map','WhatsappQueue','rawAttributes','fieldName','type','key','model','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','options','where','count','includeAll','findAll','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','WhatsappQueueId','UserWhatsappQueue','User','UserId','agent','whatsappPause','updatedAt','createdAt','%s/%s','getTeams','Team','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','removeAgents','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x13e741,_0x5d3c24){var _0x3f8bb3=function(_0x4440a0){while(--_0x4440a0){_0x13e741['push'](_0x13e741['shift']());}};_0x3f8bb3(++_0x5d3c24);}(_0xecaa,0x1ab));var _0xaeca=function(_0x22e481,_0x162bd9){_0x22e481=_0x22e481-0x0;var _0x5899d9=_0xecaa[_0x22e481];return _0x5899d9;};'use strict';var emlformat=require(_0xaeca('0x0'));var rimraf=require(_0xaeca('0x1'));var zipdir=require(_0xaeca('0x2'));var jsonpatch=require(_0xaeca('0x3'));var rp=require(_0xaeca('0x4'));var moment=require('moment');var BPromise=require(_0xaeca('0x5'));var Mustache=require('mustache');var util=require(_0xaeca('0x6'));var path=require('path');var sox=require(_0xaeca('0x7'));var csv=require(_0xaeca('0x8'));var ejs=require(_0xaeca('0x9'));var fs=require('fs');var fs_extra=require(_0xaeca('0xa'));var _=require(_0xaeca('0xb'));var squel=require(_0xaeca('0xc'));var crypto=require(_0xaeca('0xd'));var jsforce=require(_0xaeca('0xe'));var deskjs=require(_0xaeca('0xf'));var toCsv=require('to-csv');var querystring=require(_0xaeca('0x10'));var Papa=require(_0xaeca('0x11'));var Redis=require(_0xaeca('0x12'));var authService=require(_0xaeca('0x13'));var qs=require(_0xaeca('0x14'));var as=require(_0xaeca('0x15'));var hardwareService=require(_0xaeca('0x16'));var logger=require('../../config/logger')(_0xaeca('0x17'));var utils=require(_0xaeca('0x18'));var config=require(_0xaeca('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xaeca('0x1a'))['db'];config[_0xaeca('0x1b')]=_[_0xaeca('0x1c')](config['redis'],{'host':_0xaeca('0x1d'),'port':0x18eb});var socket=require(_0xaeca('0x1e'))(new Redis(config['redis']));require('./whatsappQueue.socket')['register'](socket);function respondWithStatusCode(_0x54c6fa,_0x1d9991){_0x1d9991=_0x1d9991||0xcc;return function(_0x4e7b21){if(_0x4e7b21){return _0x54c6fa[_0xaeca('0x1f')](_0x1d9991);}return _0x54c6fa[_0xaeca('0x20')](_0x1d9991)[_0xaeca('0x21')]();};}function respondWithResult(_0x411f06,_0x4ef1da){_0x4ef1da=_0x4ef1da||0xc8;return function(_0x3dc19b){if(_0x3dc19b){return _0x411f06['status'](_0x4ef1da)[_0xaeca('0x22')](_0x3dc19b);}};}function respondWithFilteredResult(_0x25cc19,_0x5b5360){return function(_0x4a6b6b){if(_0x4a6b6b){var _0x30ab5d=typeof _0x5b5360[_0xaeca('0x23')]==='undefined'&&typeof _0x5b5360[_0xaeca('0x24')]==='undefined';var _0x5e9543=_0x4a6b6b['count'];var _0x44d7cc=_0x30ab5d?0x0:_0x5b5360[_0xaeca('0x23')];var _0x57bdca=_0x30ab5d?_0x4a6b6b['count']:_0x5b5360['offset']+_0x5b5360[_0xaeca('0x24')];var _0x370698;if(_0x57bdca>=_0x5e9543){_0x57bdca=_0x5e9543;_0x370698=0xc8;}else{_0x370698=0xce;}_0x25cc19['status'](_0x370698);return _0x25cc19[_0xaeca('0x25')]('Content-Range',_0x44d7cc+'-'+_0x57bdca+'/'+_0x5e9543)[_0xaeca('0x22')](_0x4a6b6b);}return null;};}function patchUpdates(_0x3a3260){return function(_0x32cea0){try{jsonpatch['apply'](_0x32cea0,_0x3a3260,!![]);}catch(_0x146b67){return BPromise[_0xaeca('0x26')](_0x146b67);}return _0x32cea0['save']();};}function saveUpdates(_0x51b72a,_0x5c8c67){return function(_0x44dbed){if(_0x44dbed){return _0x44dbed[_0xaeca('0x27')](_0x51b72a)[_0xaeca('0x28')](function(_0x431ee9){return _0x431ee9;});}return null;};}function removeEntity(_0x28b5ad,_0x340a52){return function(_0x5df5f1){if(_0x5df5f1){return _0x5df5f1[_0xaeca('0x29')]()[_0xaeca('0x28')](function(){var _0x74cc6e=_0x5df5f1[_0xaeca('0x2a')]({'plain':!![]});var _0x241b4b=_0xaeca('0x2b');return db[_0xaeca('0x2c')][_0xaeca('0x29')]({'where':{'type':_0x241b4b,'resourceId':_0x74cc6e['id']}})['then'](function(){return _0x5df5f1;});})[_0xaeca('0x28')](function(){_0x28b5ad[_0xaeca('0x20')](0xcc)[_0xaeca('0x21')]();});}};}function handleEntityNotFound(_0x398bd2,_0x3620d9){return function(_0x5c8b89){if(!_0x5c8b89){_0x398bd2[_0xaeca('0x1f')](0x194);}return _0x5c8b89;};}function handleError(_0x4977a4,_0x24d0e6){_0x24d0e6=_0x24d0e6||0x1f4;return function(_0x2d6487){logger['error'](_0x2d6487[_0xaeca('0x2d')]);if(_0x2d6487['name']){delete _0x2d6487[_0xaeca('0x2e')];}_0x4977a4[_0xaeca('0x20')](_0x24d0e6)[_0xaeca('0x2f')](_0x2d6487);};}exports['index']=function(_0x4f25fe,_0x223213){var _0x35a028={},_0x9cdc8a={},_0x25bcf8={'count':0x0,'rows':[]};var _0x483f93=_[_0xaeca('0x30')](db[_0xaeca('0x31')][_0xaeca('0x32')],function(_0x1a8198){return{'name':_0x1a8198[_0xaeca('0x33')],'type':_0x1a8198[_0xaeca('0x34')][_0xaeca('0x35')]};});_0x9cdc8a[_0xaeca('0x36')]=_['map'](_0x483f93,'name');_0x9cdc8a['query']=_['keys'](_0x4f25fe[_0xaeca('0x37')]);_0x9cdc8a['filters']=_[_0xaeca('0x38')](_0x9cdc8a['model'],_0x9cdc8a[_0xaeca('0x37')]);_0x35a028['attributes']=_[_0xaeca('0x38')](_0x9cdc8a['model'],qs['fields'](_0x4f25fe[_0xaeca('0x37')]['fields']));_0x35a028[_0xaeca('0x39')]=_0x35a028[_0xaeca('0x39')][_0xaeca('0x3a')]?_0x35a028[_0xaeca('0x39')]:_0x9cdc8a[_0xaeca('0x36')];if(!_0x4f25fe[_0xaeca('0x37')][_0xaeca('0x3b')](_0xaeca('0x3c'))){_0x35a028[_0xaeca('0x24')]=qs[_0xaeca('0x24')](_0x4f25fe[_0xaeca('0x37')][_0xaeca('0x24')]);_0x35a028[_0xaeca('0x23')]=qs[_0xaeca('0x23')](_0x4f25fe['query'][_0xaeca('0x23')]);}_0x35a028[_0xaeca('0x3d')]=qs[_0xaeca('0x3e')](_0x4f25fe[_0xaeca('0x37')][_0xaeca('0x3e')]);_0x35a028['where']=qs[_0xaeca('0x3f')](_[_0xaeca('0x40')](_0x4f25fe[_0xaeca('0x37')],_0x9cdc8a['filters']),_0x483f93);if(_0x4f25fe['query'][_0xaeca('0x41')]){_0x35a028['where']=_[_0xaeca('0x42')](_0x35a028['where'],{'$or':_['map'](_0x483f93,function(_0x3fc7e1){if(_0x3fc7e1[_0xaeca('0x34')]!=='VIRTUAL'){var _0x420999={};_0x420999[_0x3fc7e1[_0xaeca('0x2e')]]={'$like':'%'+_0x4f25fe[_0xaeca('0x37')][_0xaeca('0x41')]+'%'};return _0x420999;}})});}_0x35a028=_[_0xaeca('0x42')]({},_0x35a028,_0x4f25fe[_0xaeca('0x43')]);var _0x110a39={'where':_0x35a028[_0xaeca('0x44')]};return db[_0xaeca('0x31')]['count'](_0x110a39)[_0xaeca('0x28')](function(_0x4641ef){_0x25bcf8[_0xaeca('0x45')]=_0x4641ef;if(_0x4f25fe[_0xaeca('0x37')][_0xaeca('0x46')]){_0x35a028['include']=[{'all':!![]}];}return db[_0xaeca('0x31')][_0xaeca('0x47')](_0x35a028);})[_0xaeca('0x28')](function(_0x389cb9){_0x25bcf8[_0xaeca('0x48')]=_0x389cb9;return _0x25bcf8;})[_0xaeca('0x28')](respondWithFilteredResult(_0x223213,_0x35a028))[_0xaeca('0x49')](handleError(_0x223213,null));};exports[_0xaeca('0x4a')]=function(_0x431930,_0x5dec44){var _0x4ffe2d={'raw':!![],'where':{'id':_0x431930[_0xaeca('0x4b')]['id']}},_0x35b7f9={};_0x35b7f9[_0xaeca('0x36')]=_[_0xaeca('0x4c')](db[_0xaeca('0x31')]['rawAttributes']);_0x35b7f9[_0xaeca('0x37')]=_[_0xaeca('0x4c')](_0x431930[_0xaeca('0x37')]);_0x35b7f9['filters']=_[_0xaeca('0x38')](_0x35b7f9[_0xaeca('0x36')],_0x35b7f9[_0xaeca('0x37')]);_0x4ffe2d['attributes']=_[_0xaeca('0x38')](_0x35b7f9['model'],qs[_0xaeca('0x4d')](_0x431930[_0xaeca('0x37')][_0xaeca('0x4d')]));_0x4ffe2d[_0xaeca('0x39')]=_0x4ffe2d[_0xaeca('0x39')][_0xaeca('0x3a')]?_0x4ffe2d[_0xaeca('0x39')]:_0x35b7f9[_0xaeca('0x36')];if(_0x431930['query'][_0xaeca('0x46')]){_0x4ffe2d['include']=[{'all':!![]}];}_0x4ffe2d=_[_0xaeca('0x42')]({},_0x4ffe2d,_0x431930['options']);return db[_0xaeca('0x31')][_0xaeca('0x4e')](_0x4ffe2d)[_0xaeca('0x28')](handleEntityNotFound(_0x5dec44,null))[_0xaeca('0x28')](respondWithResult(_0x5dec44,null))['catch'](handleError(_0x5dec44,null));};exports[_0xaeca('0x4f')]=function(_0x33b9b9,_0x5ae452){return db['WhatsappQueue'][_0xaeca('0x4f')](_0x33b9b9[_0xaeca('0x50')],{})['then'](function(_0x46e300){var _0x2d5e2a=_0x33b9b9[_0xaeca('0x51')][_0xaeca('0x2a')]({'plain':!![]});if(!_0x2d5e2a)throw new Error(_0xaeca('0x52'));if(_0x2d5e2a[_0xaeca('0x53')]===_0xaeca('0x51')){var _0x38e523=_0x46e300[_0xaeca('0x2a')]({'plain':!![]});var _0x5cdd5e='WhatsappQueues';return db[_0xaeca('0x54')]['find']({'where':{'name':_0x5cdd5e,'userProfileId':_0x2d5e2a[_0xaeca('0x55')]},'raw':!![]})[_0xaeca('0x28')](function(_0x4c22df){if(_0x4c22df&&_0x4c22df[_0xaeca('0x56')]===0x0){return db[_0xaeca('0x2c')][_0xaeca('0x4f')]({'name':_0x38e523[_0xaeca('0x2e')],'resourceId':_0x38e523['id'],'type':_0x4c22df['name'],'sectionId':_0x4c22df['id']},{})[_0xaeca('0x28')](function(){return _0x46e300;});}else{return _0x46e300;}})[_0xaeca('0x49')](function(_0x56450f){logger[_0xaeca('0x57')](_0xaeca('0x58'),_0x56450f);throw _0x56450f;});}return _0x46e300;})[_0xaeca('0x28')](respondWithResult(_0x5ae452,0xc9))[_0xaeca('0x49')](handleError(_0x5ae452,null));};exports[_0xaeca('0x27')]=function(_0x2a3ec6,_0x5ba9cc){if(_0x2a3ec6[_0xaeca('0x50')]['id']){delete _0x2a3ec6[_0xaeca('0x50')]['id'];}return db['WhatsappQueue'][_0xaeca('0x4e')]({'where':{'id':_0x2a3ec6[_0xaeca('0x4b')]['id']}})[_0xaeca('0x28')](handleEntityNotFound(_0x5ba9cc,null))[_0xaeca('0x28')](saveUpdates(_0x2a3ec6[_0xaeca('0x50')],null))[_0xaeca('0x28')](respondWithResult(_0x5ba9cc,null))['catch'](handleError(_0x5ba9cc,null));};exports[_0xaeca('0x29')]=function(_0x5004b7,_0x1c9703){return db['WhatsappQueue'][_0xaeca('0x4e')]({'where':{'id':_0x5004b7[_0xaeca('0x4b')]['id']}})[_0xaeca('0x28')](handleEntityNotFound(_0x1c9703,null))[_0xaeca('0x28')](removeEntity(_0x1c9703,null))['catch'](handleError(_0x1c9703,null));};exports[_0xaeca('0x59')]=function(_0x5f549b,_0x3cd59c){return db[_0xaeca('0x31')]['describe']()['then'](respondWithResult(_0x3cd59c,null))['catch'](handleError(_0x3cd59c,null));};exports[_0xaeca('0x5a')]=function(_0xbd29ae,_0x347dff,_0x19de67){var _0x5d7be3={'raw':!![],'where':{}},_0x1d4877={},_0x339e0c;return db[_0xaeca('0x31')][_0xaeca('0x5b')]({'where':{'id':_0xbd29ae['params']['id']}})['then'](handleEntityNotFound(_0x347dff,null))[_0xaeca('0x28')](function(_0x13c117){if(_0x13c117){_0x339e0c=_0x13c117['get']({'plain':!![]});_0x1d4877[_0xaeca('0x36')]=_[_0xaeca('0x4c')](db['UserWhatsappQueue'][_0xaeca('0x32')]);_0x1d4877['query']=_['keys'](_0xbd29ae[_0xaeca('0x37')]);_0x1d4877['filters']=_[_0xaeca('0x38')](_0x1d4877[_0xaeca('0x36')],_0x1d4877[_0xaeca('0x37')]);_0x5d7be3[_0xaeca('0x39')]=_['intersection'](_0x1d4877[_0xaeca('0x36')],qs[_0xaeca('0x4d')](_0xbd29ae[_0xaeca('0x37')][_0xaeca('0x4d')]));_0x5d7be3[_0xaeca('0x39')]=_0x5d7be3[_0xaeca('0x39')]['length']?_0x5d7be3[_0xaeca('0x39')]:_0x1d4877[_0xaeca('0x36')];if(!_0xbd29ae[_0xaeca('0x37')][_0xaeca('0x3b')](_0xaeca('0x3c'))){_0x5d7be3[_0xaeca('0x24')]=qs[_0xaeca('0x24')](_0xbd29ae[_0xaeca('0x37')]['limit']);_0x5d7be3[_0xaeca('0x23')]=qs[_0xaeca('0x23')](_0xbd29ae[_0xaeca('0x37')][_0xaeca('0x23')]);}_0x5d7be3[_0xaeca('0x3d')]=qs['sort'](_0xbd29ae[_0xaeca('0x37')]['sort']);_0x5d7be3[_0xaeca('0x44')]=qs['filters'](_[_0xaeca('0x40')](_0xbd29ae[_0xaeca('0x37')],_0x1d4877['filters']));_0x5d7be3[_0xaeca('0x44')][_0xaeca('0x5c')]=_0x13c117['id'];if(_0xbd29ae['query']['filter']){_0x5d7be3['where']=_[_0xaeca('0x42')](_0x5d7be3['where'],{'$or':_['map'](_0x5d7be3[_0xaeca('0x39')],function(_0x2a7ab0){var _0x2ccaa1={};_0x2ccaa1[_0x2a7ab0]={'$like':'%'+_0xbd29ae[_0xaeca('0x37')][_0xaeca('0x41')]+'%'};return _0x2ccaa1;})});}_0x5d7be3=_[_0xaeca('0x42')]({},_0x5d7be3,_0xbd29ae[_0xaeca('0x43')]);return db[_0xaeca('0x5d')][_0xaeca('0x47')](_0x5d7be3);}})[_0xaeca('0x28')](function(_0x51431a){if(_0x51431a){return db[_0xaeca('0x5e')]['findAndCountAll']({'where':{'id':_['map'](_0x51431a,_0xaeca('0x5f')),'role':_0xaeca('0x60')},'attributes':['id',_0xaeca('0x2e'),_0xaeca('0x61'),_0xaeca('0x62'),_0xaeca('0x63')]});}})[_0xaeca('0x28')](function(_0x452f98){if(_0x452f98){return{'count':_0x452f98[_0xaeca('0x45')],'rows':_['map'](_0x452f98['rows'],function(_0x50a8cb){return{'membername':_0x50a8cb[_0xaeca('0x2e')],'UserId':_0x50a8cb['id'],'queue_name':_0x339e0c[_0xaeca('0x2e')],'WhatsappQueueId':_0x339e0c['id'],'interface':util['format'](_0xaeca('0x64'),'SIP',_0x50a8cb['name']),'penalty':0x0,'paused':_0x50a8cb[_0xaeca('0x61')],'createdAt':_0x50a8cb[_0xaeca('0x63')],'updatedAt':_0x50a8cb[_0xaeca('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x347dff,_0x5d7be3))[_0xaeca('0x49')](handleError(_0x347dff,null));};exports[_0xaeca('0x65')]=function(_0x4133b2,_0x50cb26,_0x4c3bef){var _0x553449={};var _0x58cd72={};var _0x5ee3cf;var _0x2dad5e;return db[_0xaeca('0x31')][_0xaeca('0x5b')]({'where':{'id':_0x4133b2[_0xaeca('0x4b')]['id']}})['then'](handleEntityNotFound(_0x50cb26,null))['then'](function(_0x47d279){if(_0x47d279){_0x5ee3cf=_0x47d279;_0x58cd72['model']=_[_0xaeca('0x4c')](db[_0xaeca('0x66')]['rawAttributes']);_0x58cd72[_0xaeca('0x37')]=_[_0xaeca('0x4c')](_0x4133b2[_0xaeca('0x37')]);_0x58cd72[_0xaeca('0x3f')]=_[_0xaeca('0x38')](_0x58cd72[_0xaeca('0x36')],_0x58cd72[_0xaeca('0x37')]);_0x553449[_0xaeca('0x39')]=_['intersection'](_0x58cd72['model'],qs[_0xaeca('0x4d')](_0x4133b2[_0xaeca('0x37')][_0xaeca('0x4d')]));_0x553449['attributes']=_0x553449[_0xaeca('0x39')][_0xaeca('0x3a')]?_0x553449[_0xaeca('0x39')]:_0x58cd72[_0xaeca('0x36')];_0x553449[_0xaeca('0x3d')]=qs[_0xaeca('0x3e')](_0x4133b2[_0xaeca('0x37')]['sort']);_0x553449[_0xaeca('0x44')]=qs[_0xaeca('0x3f')](_[_0xaeca('0x40')](_0x4133b2[_0xaeca('0x37')],_0x58cd72[_0xaeca('0x3f')]));if(_0x4133b2['query'][_0xaeca('0x41')]){_0x553449[_0xaeca('0x44')]=_[_0xaeca('0x42')](_0x553449[_0xaeca('0x44')],{'$or':_['map'](_0x553449[_0xaeca('0x39')],function(_0xa97a90){var _0x438add={};_0x438add[_0xa97a90]={'$like':'%'+_0x4133b2[_0xaeca('0x37')][_0xaeca('0x41')]+'%'};return _0x438add;})});}_0x553449=_[_0xaeca('0x42')]({},_0x553449,_0x4133b2['options']);return _0x5ee3cf[_0xaeca('0x65')](_0x553449);}})[_0xaeca('0x28')](function(_0x3573f7){if(_0x3573f7){_0x2dad5e=_0x3573f7[_0xaeca('0x3a')];if(!_0x4133b2[_0xaeca('0x37')]['hasOwnProperty'](_0xaeca('0x3c'))){_0x553449['limit']=qs[_0xaeca('0x24')](_0x4133b2[_0xaeca('0x37')][_0xaeca('0x24')]);_0x553449[_0xaeca('0x23')]=qs[_0xaeca('0x23')](_0x4133b2[_0xaeca('0x37')][_0xaeca('0x23')]);}return _0x5ee3cf[_0xaeca('0x65')](_0x553449);}})[_0xaeca('0x28')](function(_0x5737dd){if(_0x5737dd){return _0x5737dd?{'count':_0x2dad5e,'rows':_0x5737dd}:null;}})[_0xaeca('0x28')](respondWithResult(_0x50cb26,null))[_0xaeca('0x49')](handleError(_0x50cb26,null));};exports[_0xaeca('0x67')]=function(_0x4e0459,_0xb398ee,_0x5061f5){var _0x4ec20e=_0x4e0459[_0xaeca('0x50')][_0xaeca('0x68')];return db[_0xaeca('0x66')][_0xaeca('0x47')]({'where':{'id':_0x4ec20e},'attributes':['id'],'include':[{'model':db[_0xaeca('0x5e')],'as':_0xaeca('0x69'),'attributes':['id',_0xaeca('0x2e'),_0xaeca('0x6a'),_0xaeca('0x6b'),_0xaeca('0x6c')],'raw':!![]}]})[_0xaeca('0x28')](function(_0x4380b9){if(_0x4380b9){var _0x5e075b=_[_0xaeca('0x6d')](_0x4380b9,function(_0x58c381){var _0x4a9555=_0x58c381[_0xaeca('0x2a')]({'plain':!![]});return _0x4a9555[_0xaeca('0x69')];});return db[_0xaeca('0x31')][_0xaeca('0x4e')]({'where':{'id':_0x4e0459['params']['id']}})[_0xaeca('0x28')](function(_0x5cad16){return db[_0xaeca('0x6e')][_0xaeca('0x6f')](function(_0x3a5c8b){return _0x5cad16[_0xaeca('0x67')](_0x4ec20e,{'transaction':_0x3a5c8b})[_0xaeca('0x28')](function(){return BPromise[_0xaeca('0x70')](_0x5e075b,function(_0x42e03b){return db[_0xaeca('0x5d')][_0xaeca('0x71')]({'where':{'UserId':_0x42e03b['id'],'WhatsappQueueId':_0x4e0459[_0xaeca('0x4b')]['id']},'transaction':_0x3a5c8b});});})['then'](function(){_0x5e075b[_0xaeca('0x72')](function(_0x5ef241){socket[_0xaeca('0x73')](_0xaeca('0x74'),{'UserId':_0x5ef241['id'],'WhatsappQueueId':_0x5cad16['id']});});});});});}})['then'](respondWithStatusCode(_0xb398ee,null))['catch'](handleError(_0xb398ee,null));};exports[_0xaeca('0x75')]=function(_0x4860d1,_0x35fcde,_0x20d731){return db[_0xaeca('0x66')][_0xaeca('0x47')]({'where':{'id':_0x4860d1[_0xaeca('0x37')]['ids']},'attributes':['id'],'include':[{'model':db[_0xaeca('0x5e')],'as':_0xaeca('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x35fcde,null))[_0xaeca('0x28')](function(_0x45be93){var _0x1acf69=_[_0xaeca('0x30')](_0x45be93,'id');var _0x4ea3af=[];var _0x326105=[];var _0x18300b=squel[_0xaeca('0x76')]();_0x18300b[_0xaeca('0x77')](_0xaeca('0x78'))[_0xaeca('0x79')](_0xaeca('0x7a'),'tq')[_0xaeca('0x7b')](_0xaeca('0x7c'),'ut',_0xaeca('0x7d'))[_0xaeca('0x44')](_0xaeca('0x7e'),_0x4860d1[_0xaeca('0x4b')]['id']);for(var _0x3870a7=0x0;_0x3870a7<_0x45be93[_0xaeca('0x3a')];_0x3870a7+=0x1){let _0x266ea5=_0x45be93[_0x3870a7];for(var _0xb424=0x0;_0xb424<_0x266ea5[_0xaeca('0x69')]['length'];_0xb424+=0x1){let _0x5230c7=_0x266ea5['Agents'][_0xb424];var _0x24edaa=_0x18300b[_0xaeca('0x7f')]();_0x24edaa[_0xaeca('0x44')](_0xaeca('0x80'),_0x5230c7['id']);_0x326105[_0xaeca('0x81')](db['sequelize'][_0xaeca('0x37')](_0x24edaa[_0xaeca('0x82')](),{'type':db[_0xaeca('0x6e')][_0xaeca('0x83')][_0xaeca('0x84')]})[_0xaeca('0x28')](function(_0x3dd955){if(_0x3dd955[_0xaeca('0x3a')]===0x1){return _0x5230c7['id'];}else{var _0x7539d7=_[_0xaeca('0x85')](_[_0xaeca('0x30')](_0x3dd955,'TeamId'),function(_0x46aaec){return _[_0xaeca('0x86')](_0x1acf69,_0x46aaec);});if(_0x7539d7){return _0x5230c7['id'];}}}));}}return BPromise[_0xaeca('0x87')](_0x326105)[_0xaeca('0x28')](function(_0x434257){_0x4ea3af=_(_0x4ea3af)[_0xaeca('0x88')](_0x434257)['compact']()['value']();return db[_0xaeca('0x31')][_0xaeca('0x4e')]({'where':{'id':_0x4860d1[_0xaeca('0x4b')]['id']}})[_0xaeca('0x28')](function(_0xbfeb8b){return db[_0xaeca('0x6e')][_0xaeca('0x6f')](function(_0x519972){return _0xbfeb8b[_0xaeca('0x75')](_0x4860d1['query'][_0xaeca('0x68')],{'transaction':_0x519972})[_0xaeca('0x28')](function(){if(!_['isEmpty'](_0x4ea3af)){return _0xbfeb8b[_0xaeca('0x89')](_0x4ea3af,{'transaction':_0x519972});}})[_0xaeca('0x28')](function(){_0x4ea3af[_0xaeca('0x72')](function(_0x2e22b5){socket[_0xaeca('0x73')](_0xaeca('0x8a'),{'UserId':_0x2e22b5,'WhatsappQueueId':_0xbfeb8b['id']});});});});});});})[_0xaeca('0x28')](respondWithStatusCode(_0x35fcde,null))[_0xaeca('0x49')](handleError(_0x35fcde,null));};exports[_0xaeca('0x8b')]=function(_0x39cbcb,_0xad692a,_0x1b8bb3){return db[_0xaeca('0x31')][_0xaeca('0x4e')]({'where':{'id':_0x39cbcb[_0xaeca('0x4b')]['id']}})[_0xaeca('0x28')](handleEntityNotFound(_0xad692a,null))['then'](function(_0x266fff){if(_0x266fff){return _0x266fff[_0xaeca('0x8b')](_0x39cbcb[_0xaeca('0x50')]['ids'],_[_0xaeca('0x8c')](_0x39cbcb[_0xaeca('0x50')],['ids','id'])||{})[_0xaeca('0x8d')](function(_0x401bed){for(var _0x17d0c4=0x0;_0x17d0c4<_0x39cbcb[_0xaeca('0x50')][_0xaeca('0x68')]['length'];_0x17d0c4+=0x1){socket[_0xaeca('0x73')](_0xaeca('0x74'),{'UserId':Number(_0x39cbcb[_0xaeca('0x50')][_0xaeca('0x68')][_0x17d0c4]),'WhatsappQueueId':Number(_0x39cbcb[_0xaeca('0x4b')]['id'])});}return _0x401bed;});}})['then'](respondWithResult(_0xad692a,null))[_0xaeca('0x49')](handleError(_0xad692a,null));};exports[_0xaeca('0x89')]=function(_0x3b86e2,_0x48fbd5,_0x5c9835){return db[_0xaeca('0x31')][_0xaeca('0x4e')]({'where':{'id':_0x3b86e2['params']['id']}})['then'](handleEntityNotFound(_0x48fbd5,null))[_0xaeca('0x28')](function(_0x2ce6e0){if(_0x2ce6e0){return _0x2ce6e0[_0xaeca('0x89')](_0x3b86e2[_0xaeca('0x37')]['ids'])[_0xaeca('0x28')](function(){if(_[_0xaeca('0x8e')](_0x3b86e2[_0xaeca('0x37')]['ids'])){for(var _0x3cd972=0x0;_0x3cd972<_0x3b86e2[_0xaeca('0x37')]['ids'][_0xaeca('0x3a')];_0x3cd972+=0x1){socket['emit'](_0xaeca('0x8a'),{'UserId':Number(_0x3b86e2[_0xaeca('0x37')][_0xaeca('0x68')][_0x3cd972]),'WhatsappQueueId':Number(_0x3b86e2[_0xaeca('0x4b')]['id'])});}}else{socket[_0xaeca('0x73')](_0xaeca('0x8a'),{'UserId':Number(_0x3b86e2[_0xaeca('0x37')]['ids']),'WhatsappQueueId':Number(_0x3b86e2[_0xaeca('0x4b')]['id'])});}});}})[_0xaeca('0x28')](respondWithStatusCode(_0x48fbd5,null))[_0xaeca('0x49')](handleError(_0x48fbd5,null));};exports[_0xaeca('0x8f')]=function(_0x6b85f1,_0x3c58b7,_0x5d0ab9){var _0x21d16b={};var _0x1b79a7={};var _0x34ae84;var _0x22bb9f;return db['WhatsappQueue']['findOne']({'where':{'id':_0x6b85f1['params']['id']}})[_0xaeca('0x28')](handleEntityNotFound(_0x3c58b7,null))[_0xaeca('0x28')](function(_0x1087b3){if(_0x1087b3){_0x34ae84=_0x1087b3;_0x1b79a7[_0xaeca('0x36')]=_[_0xaeca('0x4c')](db['User'][_0xaeca('0x32')]);_0x1b79a7[_0xaeca('0x37')]=_[_0xaeca('0x4c')](_0x6b85f1['query']);_0x1b79a7[_0xaeca('0x3f')]=_[_0xaeca('0x38')](_0x1b79a7[_0xaeca('0x36')],_0x1b79a7[_0xaeca('0x37')]);_0x21d16b['attributes']=_[_0xaeca('0x38')](_0x1b79a7['model'],qs[_0xaeca('0x4d')](_0x6b85f1[_0xaeca('0x37')][_0xaeca('0x4d')]));_0x21d16b[_0xaeca('0x39')]=_0x21d16b[_0xaeca('0x39')][_0xaeca('0x3a')]?_0x21d16b[_0xaeca('0x39')]:_0x1b79a7[_0xaeca('0x36')];_0x21d16b[_0xaeca('0x3d')]=qs[_0xaeca('0x3e')](_0x6b85f1[_0xaeca('0x37')][_0xaeca('0x3e')]);_0x21d16b['where']=qs[_0xaeca('0x3f')](_[_0xaeca('0x40')](_0x6b85f1[_0xaeca('0x37')],_0x1b79a7[_0xaeca('0x3f')]));if(_0x6b85f1['query'][_0xaeca('0x41')]){_0x21d16b[_0xaeca('0x44')]=_[_0xaeca('0x42')](_0x21d16b[_0xaeca('0x44')],{'$or':_['map'](_0x21d16b['attributes'],function(_0x4b7192){var _0x6b693={};_0x6b693[_0x4b7192]={'$like':'%'+_0x6b85f1[_0xaeca('0x37')][_0xaeca('0x41')]+'%'};return _0x6b693;})});}_0x21d16b=_[_0xaeca('0x42')]({},_0x21d16b,_0x6b85f1[_0xaeca('0x43')]);return _0x34ae84[_0xaeca('0x8f')](_0x21d16b);}})[_0xaeca('0x28')](function(_0xa13bc){if(_0xa13bc){_0x22bb9f=_0xa13bc[_0xaeca('0x3a')];if(!_0x6b85f1[_0xaeca('0x37')][_0xaeca('0x3b')](_0xaeca('0x3c'))){_0x21d16b['limit']=qs[_0xaeca('0x24')](_0x6b85f1[_0xaeca('0x37')][_0xaeca('0x24')]);_0x21d16b[_0xaeca('0x23')]=qs[_0xaeca('0x23')](_0x6b85f1['query'][_0xaeca('0x23')]);}return _0x34ae84[_0xaeca('0x8f')](_0x21d16b);}})[_0xaeca('0x28')](function(_0x25d54b){if(_0x25d54b){return _0x25d54b?{'count':_0x22bb9f,'rows':_0x25d54b}:null;}})['then'](respondWithResult(_0x3c58b7,null))['catch'](handleError(_0x3c58b7,null));}; \ No newline at end of file +var _0x315e=['UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','getMembers','findOne','UserWhatsappQueue','hasOwnProperty','WhatsappQueueId','User','UserId','createdAt','rows','format','%s/%s','SIP','updatedAt','getTeams','addTeams','ids','Team','online','voicePause','interface','flatMap','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','userWhatsappQueue:save','removeTeams','select','field','tq.TeamId','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','compact','value','isEmpty','removeAgents','userWhatsappQueue:remove','addAgents','omit','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','./whatsappQueue.socket','register','sendStatus','end','offset','undefined','limit','count','status','set','Content-Range','json','reject','save','then','destroy','WhatsappQueues','UserProfileResource','stack','name','index','rawAttributes','fieldName','type','model','map','query','keys','attributes','fields','length','nolimit','order','sort','where','pick','filters','filter','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','findAll','catch','show','params','intersection','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role'];(function(_0x1a9895,_0x232de5){var _0x18441e=function(_0x3f7316){while(--_0x3f7316){_0x1a9895['push'](_0x1a9895['shift']());}};_0x18441e(++_0x232de5);}(_0x315e,0x15a));var _0xe315=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x315e[_0x3b380d];return _0x54502b;};'use strict';var emlformat=require(_0xe315('0x0'));var rimraf=require(_0xe315('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe315('0x2'));var rp=require(_0xe315('0x3'));var moment=require(_0xe315('0x4'));var BPromise=require(_0xe315('0x5'));var Mustache=require(_0xe315('0x6'));var util=require(_0xe315('0x7'));var path=require('path');var sox=require(_0xe315('0x8'));var csv=require(_0xe315('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe315('0xa'));var _=require(_0xe315('0xb'));var squel=require(_0xe315('0xc'));var crypto=require(_0xe315('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xe315('0xe'));var Papa=require(_0xe315('0xf'));var Redis=require(_0xe315('0x10'));var authService=require(_0xe315('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xe315('0x12'));var hardwareService=require(_0xe315('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xe315('0x14'));var config=require(_0xe315('0x15'));var licenseUtil=require(_0xe315('0x16'));var db=require(_0xe315('0x17'))['db'];config[_0xe315('0x18')]=_[_0xe315('0x19')](config[_0xe315('0x18')],{'host':_0xe315('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe315('0x1b'))[_0xe315('0x1c')](socket);function respondWithStatusCode(_0x145b4d,_0x25cebd){_0x25cebd=_0x25cebd||0xcc;return function(_0x255c93){if(_0x255c93){return _0x145b4d[_0xe315('0x1d')](_0x25cebd);}return _0x145b4d['status'](_0x25cebd)[_0xe315('0x1e')]();};}function respondWithResult(_0x5166fd,_0x59a6a7){_0x59a6a7=_0x59a6a7||0xc8;return function(_0x330ef8){if(_0x330ef8){return _0x5166fd['status'](_0x59a6a7)['json'](_0x330ef8);}};}function respondWithFilteredResult(_0x2320bd,_0x40081f){return function(_0x206d2c){if(_0x206d2c){var _0x3f73f3=typeof _0x40081f[_0xe315('0x1f')]===_0xe315('0x20')&&typeof _0x40081f[_0xe315('0x21')]==='undefined';var _0x3b1a7d=_0x206d2c[_0xe315('0x22')];var _0x56e012=_0x3f73f3?0x0:_0x40081f['offset'];var _0x310132=_0x3f73f3?_0x206d2c[_0xe315('0x22')]:_0x40081f[_0xe315('0x1f')]+_0x40081f[_0xe315('0x21')];var _0x4afe0c;if(_0x310132>=_0x3b1a7d){_0x310132=_0x3b1a7d;_0x4afe0c=0xc8;}else{_0x4afe0c=0xce;}_0x2320bd[_0xe315('0x23')](_0x4afe0c);return _0x2320bd[_0xe315('0x24')](_0xe315('0x25'),_0x56e012+'-'+_0x310132+'/'+_0x3b1a7d)[_0xe315('0x26')](_0x206d2c);}return null;};}function patchUpdates(_0x11ba47){return function(_0x440301){try{jsonpatch['apply'](_0x440301,_0x11ba47,!![]);}catch(_0x3c09f7){return BPromise[_0xe315('0x27')](_0x3c09f7);}return _0x440301[_0xe315('0x28')]();};}function saveUpdates(_0x33c09a,_0x28a2ee){return function(_0x4ba551){if(_0x4ba551){return _0x4ba551['update'](_0x33c09a)[_0xe315('0x29')](function(_0x108576){return _0x108576;});}return null;};}function removeEntity(_0x15dc02,_0x565e15){return function(_0x1b0eb0){if(_0x1b0eb0){return _0x1b0eb0[_0xe315('0x2a')]()[_0xe315('0x29')](function(){var _0x32e5d5=_0x1b0eb0['get']({'plain':!![]});var _0x3d3a4d=_0xe315('0x2b');return db[_0xe315('0x2c')][_0xe315('0x2a')]({'where':{'type':_0x3d3a4d,'resourceId':_0x32e5d5['id']}})[_0xe315('0x29')](function(){return _0x1b0eb0;});})[_0xe315('0x29')](function(){_0x15dc02[_0xe315('0x23')](0xcc)[_0xe315('0x1e')]();});}};}function handleEntityNotFound(_0x5a49b7,_0x517973){return function(_0x585dfa){if(!_0x585dfa){_0x5a49b7['sendStatus'](0x194);}return _0x585dfa;};}function handleError(_0xcb4c4f,_0x4020a1){_0x4020a1=_0x4020a1||0x1f4;return function(_0x253f20){logger['error'](_0x253f20[_0xe315('0x2d')]);if(_0x253f20[_0xe315('0x2e')]){delete _0x253f20[_0xe315('0x2e')];}_0xcb4c4f[_0xe315('0x23')](_0x4020a1)['send'](_0x253f20);};}exports[_0xe315('0x2f')]=function(_0x53e383,_0x360ecf){var _0x587749={},_0x12f773={},_0x54f028={'count':0x0,'rows':[]};var _0x22cc5b=_['map'](db['WhatsappQueue'][_0xe315('0x30')],function(_0x3e96a5){return{'name':_0x3e96a5[_0xe315('0x31')],'type':_0x3e96a5[_0xe315('0x32')]['key']};});_0x12f773[_0xe315('0x33')]=_[_0xe315('0x34')](_0x22cc5b,_0xe315('0x2e'));_0x12f773[_0xe315('0x35')]=_[_0xe315('0x36')](_0x53e383[_0xe315('0x35')]);_0x12f773['filters']=_['intersection'](_0x12f773[_0xe315('0x33')],_0x12f773['query']);_0x587749[_0xe315('0x37')]=_['intersection'](_0x12f773[_0xe315('0x33')],qs[_0xe315('0x38')](_0x53e383[_0xe315('0x35')][_0xe315('0x38')]));_0x587749['attributes']=_0x587749['attributes'][_0xe315('0x39')]?_0x587749[_0xe315('0x37')]:_0x12f773['model'];if(!_0x53e383[_0xe315('0x35')]['hasOwnProperty'](_0xe315('0x3a'))){_0x587749['limit']=qs[_0xe315('0x21')](_0x53e383['query'][_0xe315('0x21')]);_0x587749[_0xe315('0x1f')]=qs[_0xe315('0x1f')](_0x53e383[_0xe315('0x35')][_0xe315('0x1f')]);}_0x587749[_0xe315('0x3b')]=qs[_0xe315('0x3c')](_0x53e383[_0xe315('0x35')][_0xe315('0x3c')]);_0x587749[_0xe315('0x3d')]=qs['filters'](_[_0xe315('0x3e')](_0x53e383[_0xe315('0x35')],_0x12f773[_0xe315('0x3f')]),_0x22cc5b);if(_0x53e383['query'][_0xe315('0x40')]){_0x587749[_0xe315('0x3d')]=_[_0xe315('0x41')](_0x587749[_0xe315('0x3d')],{'$or':_[_0xe315('0x34')](_0x22cc5b,function(_0x55dcfa){if(_0x55dcfa['type']!==_0xe315('0x42')){var _0xba00ec={};_0xba00ec[_0x55dcfa['name']]={'$like':'%'+_0x53e383['query'][_0xe315('0x40')]+'%'};return _0xba00ec;}})});}_0x587749=_[_0xe315('0x41')]({},_0x587749,_0x53e383[_0xe315('0x43')]);var _0x214956={'where':_0x587749['where']};return db[_0xe315('0x44')][_0xe315('0x22')](_0x214956)[_0xe315('0x29')](function(_0x20b2f7){_0x54f028[_0xe315('0x22')]=_0x20b2f7;if(_0x53e383['query'][_0xe315('0x45')]){_0x587749[_0xe315('0x46')]=[{'all':!![]}];}return db[_0xe315('0x44')][_0xe315('0x47')](_0x587749);})[_0xe315('0x29')](function(_0x2d9bbe){_0x54f028['rows']=_0x2d9bbe;return _0x54f028;})[_0xe315('0x29')](respondWithFilteredResult(_0x360ecf,_0x587749))[_0xe315('0x48')](handleError(_0x360ecf,null));};exports[_0xe315('0x49')]=function(_0x5cc957,_0x584971){var _0xfee38c={'raw':!![],'where':{'id':_0x5cc957[_0xe315('0x4a')]['id']}},_0x4150bc={};_0x4150bc[_0xe315('0x33')]=_[_0xe315('0x36')](db[_0xe315('0x44')][_0xe315('0x30')]);_0x4150bc[_0xe315('0x35')]=_[_0xe315('0x36')](_0x5cc957[_0xe315('0x35')]);_0x4150bc[_0xe315('0x3f')]=_[_0xe315('0x4b')](_0x4150bc[_0xe315('0x33')],_0x4150bc['query']);_0xfee38c['attributes']=_[_0xe315('0x4b')](_0x4150bc[_0xe315('0x33')],qs[_0xe315('0x38')](_0x5cc957['query'][_0xe315('0x38')]));_0xfee38c[_0xe315('0x37')]=_0xfee38c[_0xe315('0x37')][_0xe315('0x39')]?_0xfee38c[_0xe315('0x37')]:_0x4150bc['model'];if(_0x5cc957['query']['includeAll']){_0xfee38c[_0xe315('0x46')]=[{'all':!![]}];}_0xfee38c=_['merge']({},_0xfee38c,_0x5cc957[_0xe315('0x43')]);return db[_0xe315('0x44')][_0xe315('0x4c')](_0xfee38c)['then'](handleEntityNotFound(_0x584971,null))[_0xe315('0x29')](respondWithResult(_0x584971,null))[_0xe315('0x48')](handleError(_0x584971,null));};exports[_0xe315('0x4d')]=function(_0x3ccefc,_0x27e664){return db[_0xe315('0x44')][_0xe315('0x4d')](_0x3ccefc[_0xe315('0x4e')],{})[_0xe315('0x29')](function(_0x5f121d){var _0x1762d0=_0x3ccefc[_0xe315('0x4f')][_0xe315('0x50')]({'plain':!![]});if(!_0x1762d0)throw new Error(_0xe315('0x51'));if(_0x1762d0[_0xe315('0x52')]===_0xe315('0x4f')){var _0x4b06a0=_0x5f121d['get']({'plain':!![]});var _0x3f7efc='WhatsappQueues';return db[_0xe315('0x53')][_0xe315('0x4c')]({'where':{'name':_0x3f7efc,'userProfileId':_0x1762d0['userProfileId']},'raw':!![]})[_0xe315('0x29')](function(_0x5cdd2e){if(_0x5cdd2e&&_0x5cdd2e[_0xe315('0x54')]===0x0){return db[_0xe315('0x2c')][_0xe315('0x4d')]({'name':_0x4b06a0[_0xe315('0x2e')],'resourceId':_0x4b06a0['id'],'type':_0x5cdd2e[_0xe315('0x2e')],'sectionId':_0x5cdd2e['id']},{})[_0xe315('0x29')](function(){return _0x5f121d;});}else{return _0x5f121d;}})[_0xe315('0x48')](function(_0x1f4919){logger[_0xe315('0x55')](_0xe315('0x56'),_0x1f4919);throw _0x1f4919;});}return _0x5f121d;})[_0xe315('0x29')](respondWithResult(_0x27e664,0xc9))[_0xe315('0x48')](handleError(_0x27e664,null));};exports['update']=function(_0xce764f,_0x15360f){if(_0xce764f[_0xe315('0x4e')]['id']){delete _0xce764f[_0xe315('0x4e')]['id'];}return db[_0xe315('0x44')]['find']({'where':{'id':_0xce764f[_0xe315('0x4a')]['id']}})['then'](handleEntityNotFound(_0x15360f,null))[_0xe315('0x29')](saveUpdates(_0xce764f['body'],null))[_0xe315('0x29')](respondWithResult(_0x15360f,null))[_0xe315('0x48')](handleError(_0x15360f,null));};exports[_0xe315('0x2a')]=function(_0x26e98f,_0x2e2c30){return db[_0xe315('0x44')][_0xe315('0x4c')]({'where':{'id':_0x26e98f['params']['id']}})[_0xe315('0x29')](handleEntityNotFound(_0x2e2c30,null))[_0xe315('0x29')](removeEntity(_0x2e2c30,null))[_0xe315('0x48')](handleError(_0x2e2c30,null));};exports[_0xe315('0x57')]=function(_0x12dea7,_0x50084f){return db[_0xe315('0x44')]['describe']()[_0xe315('0x29')](respondWithResult(_0x50084f,null))[_0xe315('0x48')](handleError(_0x50084f,null));};exports[_0xe315('0x58')]=function(_0x2d4fda,_0x3239b1,_0x11b5cc){var _0x34a8a6={'raw':!![],'where':{}},_0xd2da2f={},_0x142dbb;return db[_0xe315('0x44')][_0xe315('0x59')]({'where':{'id':_0x2d4fda[_0xe315('0x4a')]['id']}})['then'](handleEntityNotFound(_0x3239b1,null))[_0xe315('0x29')](function(_0x50a36c){if(_0x50a36c){_0x142dbb=_0x50a36c[_0xe315('0x50')]({'plain':!![]});_0xd2da2f[_0xe315('0x33')]=_[_0xe315('0x36')](db[_0xe315('0x5a')]['rawAttributes']);_0xd2da2f[_0xe315('0x35')]=_['keys'](_0x2d4fda[_0xe315('0x35')]);_0xd2da2f[_0xe315('0x3f')]=_[_0xe315('0x4b')](_0xd2da2f[_0xe315('0x33')],_0xd2da2f[_0xe315('0x35')]);_0x34a8a6['attributes']=_['intersection'](_0xd2da2f['model'],qs['fields'](_0x2d4fda['query'][_0xe315('0x38')]));_0x34a8a6[_0xe315('0x37')]=_0x34a8a6[_0xe315('0x37')][_0xe315('0x39')]?_0x34a8a6[_0xe315('0x37')]:_0xd2da2f[_0xe315('0x33')];if(!_0x2d4fda[_0xe315('0x35')][_0xe315('0x5b')](_0xe315('0x3a'))){_0x34a8a6[_0xe315('0x21')]=qs[_0xe315('0x21')](_0x2d4fda[_0xe315('0x35')][_0xe315('0x21')]);_0x34a8a6['offset']=qs[_0xe315('0x1f')](_0x2d4fda['query'][_0xe315('0x1f')]);}_0x34a8a6[_0xe315('0x3b')]=qs[_0xe315('0x3c')](_0x2d4fda[_0xe315('0x35')][_0xe315('0x3c')]);_0x34a8a6['where']=qs['filters'](_[_0xe315('0x3e')](_0x2d4fda[_0xe315('0x35')],_0xd2da2f[_0xe315('0x3f')]));_0x34a8a6[_0xe315('0x3d')][_0xe315('0x5c')]=_0x50a36c['id'];if(_0x2d4fda[_0xe315('0x35')]['filter']){_0x34a8a6[_0xe315('0x3d')]=_[_0xe315('0x41')](_0x34a8a6[_0xe315('0x3d')],{'$or':_['map'](_0x34a8a6[_0xe315('0x37')],function(_0x2d4ebf){var _0x564d07={};_0x564d07[_0x2d4ebf]={'$like':'%'+_0x2d4fda[_0xe315('0x35')]['filter']+'%'};return _0x564d07;})});}_0x34a8a6=_[_0xe315('0x41')]({},_0x34a8a6,_0x2d4fda[_0xe315('0x43')]);return db['UserWhatsappQueue'][_0xe315('0x47')](_0x34a8a6);}})[_0xe315('0x29')](function(_0x521d6b){if(_0x521d6b){return db[_0xe315('0x5d')]['findAndCountAll']({'where':{'id':_[_0xe315('0x34')](_0x521d6b,_0xe315('0x5e')),'role':'agent'},'attributes':['id','name','whatsappPause','updatedAt',_0xe315('0x5f')]});}})[_0xe315('0x29')](function(_0x4543ad){if(_0x4543ad){return{'count':_0x4543ad[_0xe315('0x22')],'rows':_['map'](_0x4543ad[_0xe315('0x60')],function(_0x225147){return{'membername':_0x225147[_0xe315('0x2e')],'UserId':_0x225147['id'],'queue_name':_0x142dbb['name'],'WhatsappQueueId':_0x142dbb['id'],'interface':util[_0xe315('0x61')](_0xe315('0x62'),_0xe315('0x63'),_0x225147[_0xe315('0x2e')]),'penalty':0x0,'paused':_0x225147['whatsappPause'],'createdAt':_0x225147[_0xe315('0x5f')],'updatedAt':_0x225147[_0xe315('0x64')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x3239b1,_0x34a8a6))['catch'](handleError(_0x3239b1,null));};exports[_0xe315('0x65')]=function(_0x31641f,_0x20ee77,_0xbb920c){var _0x244fd7={};var _0x576d5b={};var _0x3da04b;var _0x14d0cb;return db['WhatsappQueue'][_0xe315('0x59')]({'where':{'id':_0x31641f['params']['id']}})[_0xe315('0x29')](handleEntityNotFound(_0x20ee77,null))[_0xe315('0x29')](function(_0x26959e){if(_0x26959e){_0x3da04b=_0x26959e;_0x576d5b['model']=_[_0xe315('0x36')](db['Team']['rawAttributes']);_0x576d5b['query']=_[_0xe315('0x36')](_0x31641f['query']);_0x576d5b[_0xe315('0x3f')]=_[_0xe315('0x4b')](_0x576d5b[_0xe315('0x33')],_0x576d5b['query']);_0x244fd7['attributes']=_[_0xe315('0x4b')](_0x576d5b[_0xe315('0x33')],qs['fields'](_0x31641f['query'][_0xe315('0x38')]));_0x244fd7[_0xe315('0x37')]=_0x244fd7[_0xe315('0x37')][_0xe315('0x39')]?_0x244fd7[_0xe315('0x37')]:_0x576d5b[_0xe315('0x33')];_0x244fd7['order']=qs[_0xe315('0x3c')](_0x31641f[_0xe315('0x35')][_0xe315('0x3c')]);_0x244fd7['where']=qs[_0xe315('0x3f')](_[_0xe315('0x3e')](_0x31641f['query'],_0x576d5b[_0xe315('0x3f')]));if(_0x31641f[_0xe315('0x35')][_0xe315('0x40')]){_0x244fd7['where']=_[_0xe315('0x41')](_0x244fd7[_0xe315('0x3d')],{'$or':_[_0xe315('0x34')](_0x244fd7['attributes'],function(_0x5835e3){var _0xfb49d7={};_0xfb49d7[_0x5835e3]={'$like':'%'+_0x31641f[_0xe315('0x35')][_0xe315('0x40')]+'%'};return _0xfb49d7;})});}_0x244fd7=_[_0xe315('0x41')]({},_0x244fd7,_0x31641f[_0xe315('0x43')]);return _0x3da04b[_0xe315('0x65')](_0x244fd7);}})['then'](function(_0x2e982f){if(_0x2e982f){_0x14d0cb=_0x2e982f[_0xe315('0x39')];if(!_0x31641f[_0xe315('0x35')][_0xe315('0x5b')](_0xe315('0x3a'))){_0x244fd7[_0xe315('0x21')]=qs[_0xe315('0x21')](_0x31641f[_0xe315('0x35')][_0xe315('0x21')]);_0x244fd7[_0xe315('0x1f')]=qs['offset'](_0x31641f[_0xe315('0x35')]['offset']);}return _0x3da04b[_0xe315('0x65')](_0x244fd7);}})[_0xe315('0x29')](function(_0x5cc374){if(_0x5cc374){return _0x5cc374?{'count':_0x14d0cb,'rows':_0x5cc374}:null;}})['then'](respondWithResult(_0x20ee77,null))[_0xe315('0x48')](handleError(_0x20ee77,null));};exports[_0xe315('0x66')]=function(_0x2a79ef,_0x21f9c1,_0x5b190c){var _0x54b789=_0x2a79ef[_0xe315('0x4e')][_0xe315('0x67')];return db[_0xe315('0x68')][_0xe315('0x47')]({'where':{'id':_0x54b789},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0xe315('0x2e'),_0xe315('0x69'),_0xe315('0x6a'),_0xe315('0x6b')],'raw':!![]}]})[_0xe315('0x29')](function(_0x272823){if(_0x272823){var _0x11b8bd=_[_0xe315('0x6c')](_0x272823,function(_0x1752a7){var _0x5e7562=_0x1752a7[_0xe315('0x50')]({'plain':!![]});return _0x5e7562[_0xe315('0x6d')];});return db[_0xe315('0x44')][_0xe315('0x4c')]({'where':{'id':_0x2a79ef['params']['id']}})[_0xe315('0x29')](function(_0x4b367d){return db[_0xe315('0x6e')][_0xe315('0x6f')](function(_0x512abb){return _0x4b367d['addTeams'](_0x54b789,{'transaction':_0x512abb})[_0xe315('0x29')](function(){return BPromise[_0xe315('0x70')](_0x11b8bd,function(_0x4a1b1c){return db[_0xe315('0x5a')][_0xe315('0x71')]({'where':{'UserId':_0x4a1b1c['id'],'WhatsappQueueId':_0x2a79ef[_0xe315('0x4a')]['id']},'transaction':_0x512abb});});})['then'](function(){_0x11b8bd[_0xe315('0x72')](function(_0x31e07e){socket[_0xe315('0x73')](_0xe315('0x74'),{'UserId':_0x31e07e['id'],'WhatsappQueueId':_0x4b367d['id']});});});});});}})[_0xe315('0x29')](respondWithStatusCode(_0x21f9c1,null))[_0xe315('0x48')](handleError(_0x21f9c1,null));};exports[_0xe315('0x75')]=function(_0x5171af,_0x2c1cd6,_0x58c0bc){return db[_0xe315('0x68')][_0xe315('0x47')]({'where':{'id':_0x5171af[_0xe315('0x35')][_0xe315('0x67')]},'attributes':['id'],'include':[{'model':db[_0xe315('0x5d')],'as':_0xe315('0x6d'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x2c1cd6,null))[_0xe315('0x29')](function(_0x42f201){var _0x28e887=_[_0xe315('0x34')](_0x42f201,'id');var _0x3b78ee=[];var _0x57a5f2=[];var _0x2f625c=squel[_0xe315('0x76')]();_0x2f625c[_0xe315('0x77')](_0xe315('0x78'))[_0xe315('0x79')](_0xe315('0x7a'),'tq')[_0xe315('0x7b')](_0xe315('0x7c'),'ut',_0xe315('0x7d'))['where']('WhatsappQueueId\x20=\x20?',_0x5171af[_0xe315('0x4a')]['id']);for(var _0x5b517b=0x0;_0x5b517b<_0x42f201['length'];_0x5b517b+=0x1){let _0x451a55=_0x42f201[_0x5b517b];for(var _0xaf2d6d=0x0;_0xaf2d6d<_0x451a55[_0xe315('0x6d')][_0xe315('0x39')];_0xaf2d6d+=0x1){let _0x577e4e=_0x451a55[_0xe315('0x6d')][_0xaf2d6d];var _0x4eef44=_0x2f625c[_0xe315('0x7e')]();_0x4eef44[_0xe315('0x3d')](_0xe315('0x7f'),_0x577e4e['id']);_0x57a5f2[_0xe315('0x80')](db[_0xe315('0x6e')][_0xe315('0x35')](_0x4eef44[_0xe315('0x81')](),{'type':db[_0xe315('0x6e')][_0xe315('0x82')][_0xe315('0x83')]})[_0xe315('0x29')](function(_0x480469){if(_0x480469[_0xe315('0x39')]===0x1){return _0x577e4e['id'];}else{var _0xe85578=_[_0xe315('0x84')](_['map'](_0x480469,_0xe315('0x85')),function(_0x5d6c24){return _[_0xe315('0x86')](_0x28e887,_0x5d6c24);});if(_0xe85578){return _0x577e4e['id'];}}}));}}return BPromise['all'](_0x57a5f2)[_0xe315('0x29')](function(_0x221fc1){_0x3b78ee=_(_0x3b78ee)['union'](_0x221fc1)[_0xe315('0x87')]()[_0xe315('0x88')]();return db[_0xe315('0x44')][_0xe315('0x4c')]({'where':{'id':_0x5171af[_0xe315('0x4a')]['id']}})[_0xe315('0x29')](function(_0x54c9ba){return db['sequelize'][_0xe315('0x6f')](function(_0x1ba25a){return _0x54c9ba[_0xe315('0x75')](_0x5171af['query'][_0xe315('0x67')],{'transaction':_0x1ba25a})[_0xe315('0x29')](function(){if(!_[_0xe315('0x89')](_0x3b78ee)){return _0x54c9ba[_0xe315('0x8a')](_0x3b78ee,{'transaction':_0x1ba25a});}})['then'](function(){_0x3b78ee['forEach'](function(_0x5cd844){socket['emit'](_0xe315('0x8b'),{'UserId':_0x5cd844,'WhatsappQueueId':_0x54c9ba['id']});});});});});});})[_0xe315('0x29')](respondWithStatusCode(_0x2c1cd6,null))[_0xe315('0x48')](handleError(_0x2c1cd6,null));};exports[_0xe315('0x8c')]=function(_0x5d83a9,_0x2f6c0b,_0x473935){return db[_0xe315('0x44')]['find']({'where':{'id':_0x5d83a9[_0xe315('0x4a')]['id']}})[_0xe315('0x29')](handleEntityNotFound(_0x2f6c0b,null))['then'](function(_0x5e0bf7){if(_0x5e0bf7){return _0x5e0bf7[_0xe315('0x8c')](_0x5d83a9[_0xe315('0x4e')][_0xe315('0x67')],_[_0xe315('0x8d')](_0x5d83a9[_0xe315('0x4e')],[_0xe315('0x67'),'id'])||{})['spread'](function(_0x35880e){for(var _0x4a7b1f=0x0;_0x4a7b1f<_0x5d83a9[_0xe315('0x4e')][_0xe315('0x67')][_0xe315('0x39')];_0x4a7b1f+=0x1){socket['emit'](_0xe315('0x74'),{'UserId':Number(_0x5d83a9[_0xe315('0x4e')][_0xe315('0x67')][_0x4a7b1f]),'WhatsappQueueId':Number(_0x5d83a9[_0xe315('0x4a')]['id'])});}return _0x35880e;});}})['then'](respondWithResult(_0x2f6c0b,null))[_0xe315('0x48')](handleError(_0x2f6c0b,null));};exports[_0xe315('0x8a')]=function(_0x5bf7d9,_0x48cdb6,_0x526524){return db[_0xe315('0x44')][_0xe315('0x4c')]({'where':{'id':_0x5bf7d9[_0xe315('0x4a')]['id']}})[_0xe315('0x29')](handleEntityNotFound(_0x48cdb6,null))[_0xe315('0x29')](function(_0x1d1029){if(_0x1d1029){return _0x1d1029[_0xe315('0x8a')](_0x5bf7d9[_0xe315('0x35')][_0xe315('0x67')])[_0xe315('0x29')](function(){if(_['isArray'](_0x5bf7d9[_0xe315('0x35')][_0xe315('0x67')])){for(var _0x3e52d0=0x0;_0x3e52d0<_0x5bf7d9[_0xe315('0x35')][_0xe315('0x67')][_0xe315('0x39')];_0x3e52d0+=0x1){socket[_0xe315('0x73')]('userWhatsappQueue:remove',{'UserId':Number(_0x5bf7d9[_0xe315('0x35')][_0xe315('0x67')][_0x3e52d0]),'WhatsappQueueId':Number(_0x5bf7d9[_0xe315('0x4a')]['id'])});}}else{socket[_0xe315('0x73')](_0xe315('0x8b'),{'UserId':Number(_0x5bf7d9[_0xe315('0x35')][_0xe315('0x67')]),'WhatsappQueueId':Number(_0x5bf7d9[_0xe315('0x4a')]['id'])});}});}})[_0xe315('0x29')](respondWithStatusCode(_0x48cdb6,null))[_0xe315('0x48')](handleError(_0x48cdb6,null));};exports['getAgents']=function(_0x4b52ac,_0x36d07e,_0x3b1b09){var _0x3bfe39={};var _0x51c99f={};var _0x17f789;var _0x4e249b;return db[_0xe315('0x44')][_0xe315('0x59')]({'where':{'id':_0x4b52ac[_0xe315('0x4a')]['id']}})[_0xe315('0x29')](handleEntityNotFound(_0x36d07e,null))[_0xe315('0x29')](function(_0x10f0cc){if(_0x10f0cc){_0x17f789=_0x10f0cc;_0x51c99f['model']=_[_0xe315('0x36')](db['User']['rawAttributes']);_0x51c99f[_0xe315('0x35')]=_[_0xe315('0x36')](_0x4b52ac[_0xe315('0x35')]);_0x51c99f['filters']=_[_0xe315('0x4b')](_0x51c99f[_0xe315('0x33')],_0x51c99f[_0xe315('0x35')]);_0x3bfe39[_0xe315('0x37')]=_[_0xe315('0x4b')](_0x51c99f['model'],qs[_0xe315('0x38')](_0x4b52ac[_0xe315('0x35')][_0xe315('0x38')]));_0x3bfe39[_0xe315('0x37')]=_0x3bfe39[_0xe315('0x37')][_0xe315('0x39')]?_0x3bfe39[_0xe315('0x37')]:_0x51c99f['model'];_0x3bfe39[_0xe315('0x3b')]=qs[_0xe315('0x3c')](_0x4b52ac[_0xe315('0x35')][_0xe315('0x3c')]);_0x3bfe39[_0xe315('0x3d')]=qs['filters'](_[_0xe315('0x3e')](_0x4b52ac['query'],_0x51c99f[_0xe315('0x3f')]));if(_0x4b52ac[_0xe315('0x35')][_0xe315('0x40')]){_0x3bfe39[_0xe315('0x3d')]=_[_0xe315('0x41')](_0x3bfe39[_0xe315('0x3d')],{'$or':_[_0xe315('0x34')](_0x3bfe39['attributes'],function(_0x14059e){var _0x28d124={};_0x28d124[_0x14059e]={'$like':'%'+_0x4b52ac[_0xe315('0x35')][_0xe315('0x40')]+'%'};return _0x28d124;})});}_0x3bfe39=_[_0xe315('0x41')]({},_0x3bfe39,_0x4b52ac[_0xe315('0x43')]);return _0x17f789[_0xe315('0x8e')](_0x3bfe39);}})[_0xe315('0x29')](function(_0x133731){if(_0x133731){_0x4e249b=_0x133731[_0xe315('0x39')];if(!_0x4b52ac[_0xe315('0x35')][_0xe315('0x5b')](_0xe315('0x3a'))){_0x3bfe39[_0xe315('0x21')]=qs[_0xe315('0x21')](_0x4b52ac[_0xe315('0x35')][_0xe315('0x21')]);_0x3bfe39[_0xe315('0x1f')]=qs[_0xe315('0x1f')](_0x4b52ac[_0xe315('0x35')][_0xe315('0x1f')]);}return _0x17f789[_0xe315('0x8e')](_0x3bfe39);}})['then'](function(_0x4cef77){if(_0x4cef77){return _0x4cef77?{'count':_0x4e249b,'rows':_0x4cef77}:null;}})['then'](respondWithResult(_0x36d07e,null))['catch'](handleError(_0x36d07e,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 8ae7898..9baf10a 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 _0x2599=['save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappQueue','setMaxListeners'];(function(_0x1dba66,_0xf61bcf){var _0x4274e2=function(_0x346c46){while(--_0x346c46){_0x1dba66['push'](_0x1dba66['shift']());}};_0x4274e2(++_0xf61bcf);}(_0x2599,0xe3));var _0x9259=function(_0x47b228,_0x22ee0b){_0x47b228=_0x47b228-0x0;var _0x251fdb=_0x2599[_0x47b228];return _0x251fdb;};'use strict';var EventEmitter=require(_0x9259('0x0'));var WhatsappQueue=require(_0x9259('0x1'))['db'][_0x9259('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0x9259('0x3')](0x0);var events={'afterCreate':_0x9259('0x4'),'afterUpdate':_0x9259('0x5'),'afterDestroy':_0x9259('0x6')};function emitEvent(_0x3d10c7){return function(_0x2acd20,_0x1461a0,_0x5d9126){WhatsappQueueEvents['emit'](_0x3d10c7+':'+_0x2acd20['id'],_0x2acd20);WhatsappQueueEvents[_0x9259('0x7')](_0x3d10c7,_0x2acd20);_0x5d9126(null);};}for(var e in events){if(events[_0x9259('0x8')](e)){var event=events[e];WhatsappQueue[_0x9259('0x9')](e,emitEvent(event));}}module[_0x9259('0xa')]=WhatsappQueueEvents; \ No newline at end of file +var _0x0e0b=['save','remove','emit','hasOwnProperty','hook','exports','events','WhatsappQueue','setMaxListeners'];(function(_0x4b4f24,_0x5654a8){var _0x1c13d4=function(_0x4940bf){while(--_0x4940bf){_0x4b4f24['push'](_0x4b4f24['shift']());}};_0x1c13d4(++_0x5654a8);}(_0x0e0b,0x153));var _0xb0e0=function(_0x4e783c,_0x51a362){_0x4e783c=_0x4e783c-0x0;var _0x2fbd6d=_0x0e0b[_0x4e783c];return _0x2fbd6d;};'use strict';var EventEmitter=require(_0xb0e0('0x0'));var WhatsappQueue=require('../../mysqldb')['db'][_0xb0e0('0x1')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xb0e0('0x2')](0x0);var events={'afterCreate':_0xb0e0('0x3'),'afterUpdate':'update','afterDestroy':_0xb0e0('0x4')};function emitEvent(_0x21bb08){return function(_0x7f83dd,_0x42d479,_0x5987c8){WhatsappQueueEvents[_0xb0e0('0x5')](_0x21bb08+':'+_0x7f83dd['id'],_0x7f83dd);WhatsappQueueEvents['emit'](_0x21bb08,_0x7f83dd);_0x5987c8(null);};}for(var e in events){if(events[_0xb0e0('0x6')](e)){var event=events[e];WhatsappQueue[_0xb0e0('0x7')](e,emitEvent(event));}}module[_0xb0e0('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 ae05626..7e97f09 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 _0xce15=['bluebird','path','rimraf','../../config/environment','./whatsappQueue.attributes','exports','define','WhatsappQueue','whatsapp_queues','lodash','api','moment'];(function(_0x25d2fb,_0x18a774){var _0x1ded53=function(_0x4c0715){while(--_0x4c0715){_0x25d2fb['push'](_0x25d2fb['shift']());}};_0x1ded53(++_0x18a774);}(_0xce15,0x81));var _0x5ce1=function(_0xfff039,_0x18b801){_0xfff039=_0xfff039-0x0;var _0x44365f=_0xce15[_0xfff039];return _0x44365f;};'use strict';var _=require(_0x5ce1('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x5ce1('0x1'));var moment=require(_0x5ce1('0x2'));var BPromise=require(_0x5ce1('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x5ce1('0x4'));var rimraf=require(_0x5ce1('0x5'));var config=require(_0x5ce1('0x6'));var attributes=require(_0x5ce1('0x7'));module[_0x5ce1('0x8')]=function(_0x162722,_0x5449b1){return _0x162722[_0x5ce1('0x9')](_0x5ce1('0xa'),attributes,{'tableName':_0x5ce1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb5e4=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','WhatsappQueue','whatsapp_queues'];(function(_0x39c734,_0x2f3e06){var _0xb2a2f9=function(_0x502f3f){while(--_0x502f3f){_0x39c734['push'](_0x39c734['shift']());}};_0xb2a2f9(++_0x2f3e06);}(_0xb5e4,0x13f));var _0x4b5e=function(_0xa45f68,_0x290e16){_0xa45f68=_0xa45f68-0x0;var _0x3e48dd=_0xb5e4[_0xa45f68];return _0x3e48dd;};'use strict';var _=require(_0x4b5e('0x0'));var util=require('util');var logger=require(_0x4b5e('0x1'))(_0x4b5e('0x2'));var moment=require(_0x4b5e('0x3'));var BPromise=require(_0x4b5e('0x4'));var rp=require(_0x4b5e('0x5'));var fs=require('fs');var path=require(_0x4b5e('0x6'));var rimraf=require(_0x4b5e('0x7'));var config=require(_0x4b5e('0x8'));var attributes=require('./whatsappQueue.attributes');module['exports']=function(_0x9bd59,_0x5e29f4){return _0x9bd59['define'](_0x4b5e('0x9'),attributes,{'tableName':_0x4b5e('0xa'),'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 5b155ae..061ef00 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 _0xfada=['request','then','info','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','WhatsappQueue,\x20%s,\x20%s','message','result','catch','GetWhatsappQueue','WhatsappQueue','findAll','options','where','model','attributes','include','map','ShowWhatsappQueue','find','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register'];(function(_0x5beebe,_0x9b979b){var _0x303523=function(_0xfc94a9){while(--_0xfc94a9){_0x5beebe['push'](_0x5beebe['shift']());}};_0x303523(++_0x9b979b);}(_0xfada,0x16e));var _0xafad=function(_0x517346,_0x4d9cd1){_0x517346=_0x517346-0x0;var _0x34a5b3=_0xfada[_0x517346];return _0x34a5b3;};'use strict';var _=require(_0xafad('0x0'));var util=require(_0xafad('0x1'));var moment=require(_0xafad('0x2'));var BPromise=require(_0xafad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xafad('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xafad('0x5'))('rpc');var config=require(_0xafad('0x6'));var jayson=require(_0xafad('0x7'));var client=jayson['client'][_0xafad('0x8')]({'port':0x232a});config[_0xafad('0x9')]=_['defaults'](config['redis'],{'host':_0xafad('0xa'),'port':0x18eb});var socket=require(_0xafad('0xb'))(new Redis(config[_0xafad('0x9')]));require(_0xafad('0xc'))[_0xafad('0xd')](socket);function respondWithRpcPromise(_0x202284,_0x11b341,_0x4edfd4){return new BPromise(function(_0x3c06ec,_0x62c11c){return client[_0xafad('0xe')](_0x202284,_0x4edfd4)[_0xafad('0xf')](function(_0x25c094){logger[_0xafad('0x10')]('WhatsappQueue,\x20%s,\x20%s',_0x11b341,'request\x20sent');logger[_0xafad('0x11')](_0xafad('0x12'),_0x11b341,_0xafad('0x13'),JSON[_0xafad('0x14')](_0x25c094));if(_0x25c094[_0xafad('0x15')]){if(_0x25c094[_0xafad('0x15')][_0xafad('0x16')]===0x1f4){logger[_0xafad('0x15')](_0xafad('0x17'),_0x11b341,_0x25c094[_0xafad('0x15')][_0xafad('0x18')]);return _0x62c11c(_0x25c094['error']['message']);}logger[_0xafad('0x15')](_0xafad('0x17'),_0x11b341,_0x25c094[_0xafad('0x15')]['message']);return _0x3c06ec(_0x25c094[_0xafad('0x15')][_0xafad('0x18')]);}else{logger[_0xafad('0x10')](_0xafad('0x17'),_0x11b341,'request\x20sent');_0x3c06ec(_0x25c094[_0xafad('0x19')][_0xafad('0x18')]);}})[_0xafad('0x1a')](function(_0x107b72){logger['error']('WhatsappQueue,\x20%s,\x20%s',_0x11b341,_0x107b72);_0x62c11c(_0x107b72);});});}exports[_0xafad('0x1b')]=function(_0x213b4e){var _0x9bcd78=this;return new Promise(function(_0x33fc9b,_0x236985){return db[_0xafad('0x1c')][_0xafad('0x1d')]({'raw':_0x213b4e[_0xafad('0x1e')]?_0x213b4e[_0xafad('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x213b4e[_0xafad('0x1e')]?_0x213b4e['options'][_0xafad('0x1f')]||null:null,'attributes':_0x213b4e[_0xafad('0x1e')]?_0x213b4e[_0xafad('0x1e')]['attributes']||null:null,'limit':_0x213b4e[_0xafad('0x1e')]?_0x213b4e[_0xafad('0x1e')]['limit']||null:null,'include':_0x213b4e['options']?_0x213b4e['options']['include']?_['map'](_0x213b4e[_0xafad('0x1e')]['include'],function(_0xf9aa13){return{'model':db[_0xf9aa13[_0xafad('0x20')]],'as':_0xf9aa13['as'],'attributes':_0xf9aa13[_0xafad('0x21')],'include':_0xf9aa13[_0xafad('0x22')]?_[_0xafad('0x23')](_0xf9aa13['include'],function(_0x1252d3){return{'model':db[_0x1252d3['model']],'as':_0x1252d3['as'],'attributes':_0x1252d3[_0xafad('0x21')],'include':_0x1252d3['include']?_[_0xafad('0x23')](_0x1252d3[_0xafad('0x22')],function(_0x277b6d){return{'model':db[_0x277b6d[_0xafad('0x20')]],'as':_0x277b6d['as'],'attributes':_0x277b6d[_0xafad('0x21')]};}):[]};}):[]};}):[]:[]})[_0xafad('0xf')](function(_0x4ef7e7){logger[_0xafad('0x10')](_0xafad('0x1b'),_0x213b4e);logger[_0xafad('0x11')](_0xafad('0x1b'),_0x213b4e,JSON['stringify'](_0x4ef7e7));_0x33fc9b(_0x4ef7e7);})['catch'](function(_0x5b0732){logger[_0xafad('0x15')](_0xafad('0x1b'),_0x5b0732[_0xafad('0x18')],_0x213b4e);_0x236985(_0x9bcd78[_0xafad('0x15')](0x1f4,_0x5b0732[_0xafad('0x18')]));});});};exports[_0xafad('0x24')]=function(_0x176b5b){var _0x5f1f7b=this;return new Promise(function(_0x1e16b6,_0x34b2f6){return db[_0xafad('0x1c')][_0xafad('0x25')]({'raw':_0x176b5b[_0xafad('0x1e')]?_0x176b5b[_0xafad('0x1e')]['raw']===undefined?!![]:![]:!![],'where':_0x176b5b[_0xafad('0x1e')]?_0x176b5b[_0xafad('0x1e')][_0xafad('0x1f')]||null:null,'attributes':_0x176b5b['options']?_0x176b5b['options'][_0xafad('0x21')]||null:null,'include':_0x176b5b[_0xafad('0x1e')]?_0x176b5b['options'][_0xafad('0x22')]?_[_0xafad('0x23')](_0x176b5b[_0xafad('0x1e')][_0xafad('0x22')],function(_0x5e0249){return{'model':db[_0x5e0249['model']],'as':_0x5e0249['as'],'attributes':_0x5e0249[_0xafad('0x21')],'include':_0x5e0249['include']?_['map'](_0x5e0249[_0xafad('0x22')],function(_0x40b280){return{'model':db[_0x40b280[_0xafad('0x20')]],'as':_0x40b280['as'],'attributes':_0x40b280[_0xafad('0x21')],'include':_0x40b280[_0xafad('0x22')]?_[_0xafad('0x23')](_0x40b280[_0xafad('0x22')],function(_0x449b48){return{'model':db[_0x449b48[_0xafad('0x20')]],'as':_0x449b48['as'],'attributes':_0x449b48[_0xafad('0x21')]};}):[]};}):[]};}):[]:[]})[_0xafad('0xf')](function(_0x1d8c33){logger['info'](_0xafad('0x24'),_0x176b5b);logger[_0xafad('0x11')](_0xafad('0x24'),_0x176b5b,JSON[_0xafad('0x14')](_0x1d8c33));_0x1e16b6(_0x1d8c33);})['catch'](function(_0x7d6e27){logger[_0xafad('0x15')](_0xafad('0x24'),_0x7d6e27[_0xafad('0x18')],_0x176b5b);_0x34b2f6(_0x5f1f7b[_0xafad('0x15')](0x1f4,_0x7d6e27[_0xafad('0x18')]));});});}; \ No newline at end of file +var _0xc4f0=['limit','include','map','model','attributes','GetWhatsappQueue','ShowWhatsappQueue','find','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueue','options','raw','where'];(function(_0x342baa,_0x4a110f){var _0x1208f3=function(_0x56a645){while(--_0x56a645){_0x342baa['push'](_0x342baa['shift']());}};_0x1208f3(++_0x4a110f);}(_0xc4f0,0x1dc));var _0x0c4f=function(_0x140cd3,_0x1bc779){_0x140cd3=_0x140cd3-0x0;var _0x6bb9df=_0xc4f0[_0x140cd3];return _0x6bb9df;};'use strict';var _=require(_0x0c4f('0x0'));var util=require(_0x0c4f('0x1'));var moment=require(_0x0c4f('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c4f('0x3'));var db=require(_0x0c4f('0x4'))['db'];var utils=require(_0x0c4f('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x0c4f('0x6'));var client=jayson['client'][_0x0c4f('0x7')]({'port':0x232a});config[_0x0c4f('0x8')]=_[_0x0c4f('0x9')](config[_0x0c4f('0x8')],{'host':_0x0c4f('0xa'),'port':0x18eb});var socket=require(_0x0c4f('0xb'))(new Redis(config[_0x0c4f('0x8')]));require(_0x0c4f('0xc'))[_0x0c4f('0xd')](socket);function respondWithRpcPromise(_0x381820,_0x1341ac,_0x5163cc){return new BPromise(function(_0x39354b,_0x496dea){return client[_0x0c4f('0xe')](_0x381820,_0x5163cc)[_0x0c4f('0xf')](function(_0x1a7257){logger[_0x0c4f('0x10')](_0x0c4f('0x11'),_0x1341ac,_0x0c4f('0x12'));logger[_0x0c4f('0x13')](_0x0c4f('0x14'),_0x1341ac,_0x0c4f('0x12'),JSON[_0x0c4f('0x15')](_0x1a7257));if(_0x1a7257[_0x0c4f('0x16')]){if(_0x1a7257[_0x0c4f('0x16')][_0x0c4f('0x17')]===0x1f4){logger[_0x0c4f('0x16')](_0x0c4f('0x11'),_0x1341ac,_0x1a7257[_0x0c4f('0x16')][_0x0c4f('0x18')]);return _0x496dea(_0x1a7257[_0x0c4f('0x16')][_0x0c4f('0x18')]);}logger[_0x0c4f('0x16')](_0x0c4f('0x11'),_0x1341ac,_0x1a7257['error'][_0x0c4f('0x18')]);return _0x39354b(_0x1a7257[_0x0c4f('0x16')]['message']);}else{logger[_0x0c4f('0x10')](_0x0c4f('0x11'),_0x1341ac,_0x0c4f('0x12'));_0x39354b(_0x1a7257[_0x0c4f('0x19')]['message']);}})[_0x0c4f('0x1a')](function(_0x3bb7f6){logger[_0x0c4f('0x16')]('WhatsappQueue,\x20%s,\x20%s',_0x1341ac,_0x3bb7f6);_0x496dea(_0x3bb7f6);});});}exports['GetWhatsappQueue']=function(_0x584962){var _0x3d9e38=this;return new Promise(function(_0x38db2f,_0x350125){return db[_0x0c4f('0x1b')]['findAll']({'raw':_0x584962[_0x0c4f('0x1c')]?_0x584962['options'][_0x0c4f('0x1d')]===undefined?!![]:![]:!![],'where':_0x584962['options']?_0x584962['options'][_0x0c4f('0x1e')]||null:null,'attributes':_0x584962[_0x0c4f('0x1c')]?_0x584962[_0x0c4f('0x1c')]['attributes']||null:null,'limit':_0x584962[_0x0c4f('0x1c')]?_0x584962[_0x0c4f('0x1c')][_0x0c4f('0x1f')]||null:null,'include':_0x584962[_0x0c4f('0x1c')]?_0x584962['options'][_0x0c4f('0x20')]?_[_0x0c4f('0x21')](_0x584962[_0x0c4f('0x1c')]['include'],function(_0x3182e6){return{'model':db[_0x3182e6[_0x0c4f('0x22')]],'as':_0x3182e6['as'],'attributes':_0x3182e6['attributes'],'include':_0x3182e6[_0x0c4f('0x20')]?_[_0x0c4f('0x21')](_0x3182e6[_0x0c4f('0x20')],function(_0x1c3dcc){return{'model':db[_0x1c3dcc[_0x0c4f('0x22')]],'as':_0x1c3dcc['as'],'attributes':_0x1c3dcc[_0x0c4f('0x23')],'include':_0x1c3dcc[_0x0c4f('0x20')]?_[_0x0c4f('0x21')](_0x1c3dcc['include'],function(_0x4de41e){return{'model':db[_0x4de41e[_0x0c4f('0x22')]],'as':_0x4de41e['as'],'attributes':_0x4de41e[_0x0c4f('0x23')]};}):[]};}):[]};}):[]:[]})[_0x0c4f('0xf')](function(_0x312a8a){logger[_0x0c4f('0x10')](_0x0c4f('0x24'),_0x584962);logger[_0x0c4f('0x13')]('GetWhatsappQueue',_0x584962,JSON[_0x0c4f('0x15')](_0x312a8a));_0x38db2f(_0x312a8a);})[_0x0c4f('0x1a')](function(_0x1c0a4f){logger[_0x0c4f('0x16')](_0x0c4f('0x24'),_0x1c0a4f['message'],_0x584962);_0x350125(_0x3d9e38[_0x0c4f('0x16')](0x1f4,_0x1c0a4f[_0x0c4f('0x18')]));});});};exports[_0x0c4f('0x25')]=function(_0x29ff08){var _0x3aa2ac=this;return new Promise(function(_0x48cdcf,_0x21a64a){return db[_0x0c4f('0x1b')][_0x0c4f('0x26')]({'raw':_0x29ff08[_0x0c4f('0x1c')]?_0x29ff08[_0x0c4f('0x1c')][_0x0c4f('0x1d')]===undefined?!![]:![]:!![],'where':_0x29ff08['options']?_0x29ff08['options'][_0x0c4f('0x1e')]||null:null,'attributes':_0x29ff08['options']?_0x29ff08['options'][_0x0c4f('0x23')]||null:null,'include':_0x29ff08[_0x0c4f('0x1c')]?_0x29ff08[_0x0c4f('0x1c')]['include']?_['map'](_0x29ff08['options'][_0x0c4f('0x20')],function(_0x3a6343){return{'model':db[_0x3a6343['model']],'as':_0x3a6343['as'],'attributes':_0x3a6343[_0x0c4f('0x23')],'include':_0x3a6343[_0x0c4f('0x20')]?_[_0x0c4f('0x21')](_0x3a6343[_0x0c4f('0x20')],function(_0x36c78c){return{'model':db[_0x36c78c[_0x0c4f('0x22')]],'as':_0x36c78c['as'],'attributes':_0x36c78c[_0x0c4f('0x23')],'include':_0x36c78c[_0x0c4f('0x20')]?_[_0x0c4f('0x21')](_0x36c78c[_0x0c4f('0x20')],function(_0x2b50b3){return{'model':db[_0x2b50b3[_0x0c4f('0x22')]],'as':_0x2b50b3['as'],'attributes':_0x2b50b3[_0x0c4f('0x23')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x49770a){logger[_0x0c4f('0x10')](_0x0c4f('0x25'),_0x29ff08);logger[_0x0c4f('0x13')]('ShowWhatsappQueue',_0x29ff08,JSON[_0x0c4f('0x15')](_0x49770a));_0x48cdcf(_0x49770a);})[_0x0c4f('0x1a')](function(_0x55eea8){logger[_0x0c4f('0x16')]('ShowWhatsappQueue',_0x55eea8[_0x0c4f('0x18')],_0x29ff08);_0x21a64a(_0x3aa2ac[_0x0c4f('0x16')](0x1f4,_0x55eea8['message']));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index b94a0d0..682cdf5 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 _0x4613=['removeListener','whatsappQueue:','./whatsappQueue.events','remove','update','emit'];(function(_0xc4001c,_0x1bf8f0){var _0x49f7bc=function(_0x1059b8){while(--_0x1059b8){_0xc4001c['push'](_0xc4001c['shift']());}};_0x49f7bc(++_0x1bf8f0);}(_0x4613,0x164));var _0x3461=function(_0x2af805,_0x1e1025){_0x2af805=_0x2af805-0x0;var _0x20fcd0=_0x4613[_0x2af805];return _0x20fcd0;};'use strict';var WhatsappQueueEvents=require(_0x3461('0x0'));var events=['save',_0x3461('0x1'),_0x3461('0x2')];function createListener(_0x27df44,_0x10bc5e){return function(_0x2130df){_0x10bc5e[_0x3461('0x3')](_0x27df44,_0x2130df);};}function removeListener(_0x40f796,_0x4a4c70){return function(){WhatsappQueueEvents[_0x3461('0x4')](_0x40f796,_0x4a4c70);};}exports['register']=function(_0x171830){for(var _0x346832=0x0,_0x166c7a=events['length'];_0x346832<_0x166c7a;_0x346832++){var _0x8e3c5=events[_0x346832];var _0x46f59e=createListener(_0x3461('0x5')+_0x8e3c5,_0x171830);WhatsappQueueEvents['on'](_0x8e3c5,_0x46f59e);}}; \ No newline at end of file +var _0x42bb=['./whatsappQueue.events','save','remove','update','emit','removeListener','register','length','whatsappQueue:'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x42bb,0xc6));var _0xb42b=function(_0x4d8ed9,_0x2ae284){_0x4d8ed9=_0x4d8ed9-0x0;var _0x1e2140=_0x42bb[_0x4d8ed9];return _0x1e2140;};'use strict';var WhatsappQueueEvents=require(_0xb42b('0x0'));var events=[_0xb42b('0x1'),_0xb42b('0x2'),_0xb42b('0x3')];function createListener(_0x1ecca1,_0x588694){return function(_0x3904c3){_0x588694[_0xb42b('0x4')](_0x1ecca1,_0x3904c3);};}function removeListener(_0x2f7513,_0x1b5750){return function(){WhatsappQueueEvents[_0xb42b('0x5')](_0x2f7513,_0x1b5750);};}exports[_0xb42b('0x6')]=function(_0xd8a7ad){for(var _0x368c91=0x0,_0x53fb16=events[_0xb42b('0x7')];_0x368c91<_0x53fb16;_0x368c91++){var _0x4c1d1c=events[_0x368c91];var _0x1a3b60=createListener(_0xb42b('0x8')+_0x4c1d1c,_0xd8a7ad);WhatsappQueueEvents['on'](_0x4c1d1c,_0x1a3b60);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 70c4719..4cdc271 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 _0xf889=['describe','show','post','put','/:id','delete','destroy','exports','multer','path','connect-timeout','express','Router','../../config/environment','./whatsappQueueReport.controller','get','index','/describe','isAuthenticated'];(function(_0x4de1b1,_0x18c64c){var _0x639f27=function(_0x635e03){while(--_0x635e03){_0x4de1b1['push'](_0x4de1b1['shift']());}};_0x639f27(++_0x18c64c);}(_0xf889,0x1aa));var _0x9f88=function(_0x379b35,_0x1b7f01){_0x379b35=_0x379b35-0x0;var _0x4cca23=_0xf889[_0x379b35];return _0x4cca23;};'use strict';var multer=require(_0x9f88('0x0'));var util=require('util');var path=require(_0x9f88('0x1'));var timeout=require(_0x9f88('0x2'));var express=require(_0x9f88('0x3'));var router=express[_0x9f88('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x9f88('0x5'));var controller=require(_0x9f88('0x6'));router[_0x9f88('0x7')]('/',auth['isAuthenticated'](),controller[_0x9f88('0x8')]);router[_0x9f88('0x7')](_0x9f88('0x9'),auth[_0x9f88('0xa')](),controller[_0x9f88('0xb')]);router[_0x9f88('0x7')]('/:id',auth[_0x9f88('0xa')](),controller[_0x9f88('0xc')]);router[_0x9f88('0xd')]('/',auth[_0x9f88('0xa')](),controller['create']);router[_0x9f88('0xe')](_0x9f88('0xf'),auth[_0x9f88('0xa')](),controller['update']);router[_0x9f88('0x10')](_0x9f88('0xf'),auth['isAuthenticated'](),controller[_0x9f88('0x11')]);module[_0x9f88('0x12')]=router; \ No newline at end of file +var _0xea28=['path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x126bad,_0xfe6c31){var _0x33c5b6=function(_0xe2424d){while(--_0xe2424d){_0x126bad['push'](_0x126bad['shift']());}};_0x33c5b6(++_0xfe6c31);}(_0xea28,0x132));var _0x8ea2=function(_0x242d77,_0x17ccd0){_0x242d77=_0x242d77-0x0;var _0x57433f=_0xea28[_0x242d77];return _0x57433f;};'use strict';var multer=require(_0x8ea2('0x0'));var util=require(_0x8ea2('0x1'));var path=require(_0x8ea2('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8ea2('0x3')]();var fs_extra=require(_0x8ea2('0x4'));var auth=require(_0x8ea2('0x5'));var interaction=require(_0x8ea2('0x6'));var config=require(_0x8ea2('0x7'));var controller=require(_0x8ea2('0x8'));router[_0x8ea2('0x9')]('/',auth[_0x8ea2('0xa')](),controller['index']);router['get'](_0x8ea2('0xb'),auth[_0x8ea2('0xa')](),controller[_0x8ea2('0xc')]);router[_0x8ea2('0x9')](_0x8ea2('0xd'),auth['isAuthenticated'](),controller[_0x8ea2('0xe')]);router[_0x8ea2('0xf')]('/',auth[_0x8ea2('0xa')](),controller[_0x8ea2('0x10')]);router[_0x8ea2('0x11')](_0x8ea2('0xd'),auth['isAuthenticated'](),controller[_0x8ea2('0x12')]);router[_0x8ea2('0x13')]('/:id',auth[_0x8ea2('0xa')](),controller[_0x8ea2('0x14')]);module[_0x8ea2('0x15')]=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index 8ce53ea..6952377 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 _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x4f3b46,_0x4e7138){var _0x296380=function(_0x54caeb){while(--_0x54caeb){_0x4f3b46['push'](_0x4f3b46['shift']());}};_0x296380(++_0x4e7138);}(_0x7a54,0x106));var _0x47a5=function(_0x53e7b6,_0x1ad458){_0x53e7b6=_0x53e7b6-0x0;var _0x74da36=_0x7a54[_0x53e7b6];return _0x74da36;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file +var _0x7a54=['STRING','DATE','sequelize','exports'];(function(_0x1afd60,_0x5c7899){var _0xcb9925=function(_0x3180d3){while(--_0x3180d3){_0x1afd60['push'](_0x1afd60['shift']());}};_0xcb9925(++_0x5c7899);}(_0x7a54,0x106));var _0x47a5=function(_0x556612,_0x3e2a91){_0x556612=_0x556612-0x0;var _0x3f9bb2=_0x7a54[_0x556612];return _0x3f9bb2;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'uniqueid':{'type':Sequelize[_0x47a5('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x47a5('0x3')]},'leaveAt':{'type':Sequelize[_0x47a5('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0x47a5('0x3')]},'reason':{'type':Sequelize[_0x47a5('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 1964591..8e2277a 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 _0x3266=['query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','show','params','keys','options','find','create','body','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','fs-extra','lodash','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','save','update','then','destroy','end','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type','key','model'];(function(_0xce2400,_0xe48ed8){var _0x1b6f97=function(_0x103dd9){while(--_0x103dd9){_0xce2400['push'](_0xce2400['shift']());}};_0x1b6f97(++_0xe48ed8);}(_0x3266,0x6a));var _0x6326=function(_0x1928c9,_0x13a6d1){_0x1928c9=_0x1928c9-0x0;var _0x51b5fb=_0x3266[_0x1928c9];return _0x51b5fb;};'use strict';var emlformat=require(_0x6326('0x0'));var rimraf=require(_0x6326('0x1'));var zipdir=require(_0x6326('0x2'));var jsonpatch=require(_0x6326('0x3'));var rp=require(_0x6326('0x4'));var moment=require(_0x6326('0x5'));var BPromise=require(_0x6326('0x6'));var Mustache=require(_0x6326('0x7'));var util=require(_0x6326('0x8'));var path=require('path');var sox=require(_0x6326('0x9'));var csv=require('to-csv');var ejs=require(_0x6326('0xa'));var fs=require('fs');var fs_extra=require(_0x6326('0xb'));var _=require(_0x6326('0xc'));var squel=require('squel');var crypto=require(_0x6326('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x6326('0xe'));var toCsv=require(_0x6326('0xf'));var querystring=require(_0x6326('0x10'));var Papa=require(_0x6326('0x11'));var Redis=require(_0x6326('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x6326('0x13'));var as=require(_0x6326('0x14'));var hardwareService=require(_0x6326('0x15'));var logger=require(_0x6326('0x16'))(_0x6326('0x17'));var utils=require(_0x6326('0x18'));var config=require(_0x6326('0x19'));var licenseUtil=require(_0x6326('0x1a'));var db=require(_0x6326('0x1b'))['db'];function respondWithStatusCode(_0x379358,_0x5c07e1){_0x5c07e1=_0x5c07e1||0xcc;return function(_0x5381d0){if(_0x5381d0){return _0x379358[_0x6326('0x1c')](_0x5c07e1);}return _0x379358[_0x6326('0x1d')](_0x5c07e1)['end']();};}function respondWithResult(_0x425878,_0x4caef3){_0x4caef3=_0x4caef3||0xc8;return function(_0x2d2d9b){if(_0x2d2d9b){return _0x425878[_0x6326('0x1d')](_0x4caef3)[_0x6326('0x1e')](_0x2d2d9b);}};}function respondWithFilteredResult(_0x41c352,_0x1ed3a3){return function(_0x2c1879){if(_0x2c1879){var _0x55923a=typeof _0x1ed3a3[_0x6326('0x1f')]==='undefined'&&typeof _0x1ed3a3['limit']==='undefined';var _0x51e7b9=_0x2c1879['count'];var _0x58e960=_0x55923a?0x0:_0x1ed3a3[_0x6326('0x1f')];var _0x1f4c11=_0x55923a?_0x2c1879[_0x6326('0x20')]:_0x1ed3a3['offset']+_0x1ed3a3['limit'];var _0x954ed5;if(_0x1f4c11>=_0x51e7b9){_0x1f4c11=_0x51e7b9;_0x954ed5=0xc8;}else{_0x954ed5=0xce;}_0x41c352[_0x6326('0x1d')](_0x954ed5);return _0x41c352[_0x6326('0x21')](_0x6326('0x22'),_0x58e960+'-'+_0x1f4c11+'/'+_0x51e7b9)[_0x6326('0x1e')](_0x2c1879);}return null;};}function patchUpdates(_0x25957a){return function(_0x21ee7d){try{jsonpatch['apply'](_0x21ee7d,_0x25957a,!![]);}catch(_0x22307f){return BPromise['reject'](_0x22307f);}return _0x21ee7d[_0x6326('0x23')]();};}function saveUpdates(_0x3c6cfa,_0x2482ef){return function(_0x24fb78){if(_0x24fb78){return _0x24fb78[_0x6326('0x24')](_0x3c6cfa)[_0x6326('0x25')](function(_0x225555){return _0x225555;});}return null;};}function removeEntity(_0x429bb0,_0x4781cc){return function(_0x2d0d00){if(_0x2d0d00){return _0x2d0d00[_0x6326('0x26')]()['then'](function(){_0x429bb0[_0x6326('0x1d')](0xcc)[_0x6326('0x27')]();});}};}function handleEntityNotFound(_0x575701,_0x4e272b){return function(_0x4d28fd){if(!_0x4d28fd){_0x575701[_0x6326('0x1c')](0x194);}return _0x4d28fd;};}function handleError(_0x4dae28,_0x33c466){_0x33c466=_0x33c466||0x1f4;return function(_0x1a48da){logger['error'](_0x1a48da[_0x6326('0x28')]);if(_0x1a48da[_0x6326('0x29')]){delete _0x1a48da[_0x6326('0x29')];}_0x4dae28[_0x6326('0x1d')](_0x33c466)[_0x6326('0x2a')](_0x1a48da);};}exports[_0x6326('0x2b')]=function(_0x40e036,_0x27802c){var _0x461e0f={},_0x127744={},_0x4980f6={'count':0x0,'rows':[]};var _0x2a8873=_[_0x6326('0x2c')](db[_0x6326('0x2d')][_0x6326('0x2e')],function(_0x20c5ab){return{'name':_0x20c5ab['fieldName'],'type':_0x20c5ab[_0x6326('0x2f')][_0x6326('0x30')]};});_0x127744[_0x6326('0x31')]=_['map'](_0x2a8873,_0x6326('0x29'));_0x127744['query']=_['keys'](_0x40e036[_0x6326('0x32')]);_0x127744[_0x6326('0x33')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],_0x127744[_0x6326('0x32')]);_0x461e0f[_0x6326('0x35')]=_[_0x6326('0x34')](_0x127744[_0x6326('0x31')],qs[_0x6326('0x36')](_0x40e036[_0x6326('0x32')][_0x6326('0x36')]));_0x461e0f[_0x6326('0x35')]=_0x461e0f['attributes'][_0x6326('0x37')]?_0x461e0f[_0x6326('0x35')]:_0x127744['model'];if(!_0x40e036[_0x6326('0x32')][_0x6326('0x38')](_0x6326('0x39'))){_0x461e0f['limit']=qs[_0x6326('0x3a')](_0x40e036['query']['limit']);_0x461e0f[_0x6326('0x1f')]=qs[_0x6326('0x1f')](_0x40e036[_0x6326('0x32')]['offset']);}_0x461e0f[_0x6326('0x3b')]=qs['sort'](_0x40e036[_0x6326('0x32')]['sort']);_0x461e0f[_0x6326('0x3c')]=qs[_0x6326('0x33')](_[_0x6326('0x3d')](_0x40e036[_0x6326('0x32')],_0x127744[_0x6326('0x33')]),_0x2a8873);if(_0x40e036[_0x6326('0x32')]['filter']){_0x461e0f[_0x6326('0x3c')]=_[_0x6326('0x3e')](_0x461e0f['where'],{'$or':_[_0x6326('0x2c')](_0x2a8873,function(_0x5ae140){if(_0x5ae140['type']!==_0x6326('0x3f')){var _0x1f8dcf={};_0x1f8dcf[_0x5ae140[_0x6326('0x29')]]={'$like':'%'+_0x40e036[_0x6326('0x32')][_0x6326('0x40')]+'%'};return _0x1f8dcf;}})});}_0x461e0f=_[_0x6326('0x3e')]({},_0x461e0f,_0x40e036['options']);var _0x485bed={'where':_0x461e0f[_0x6326('0x3c')]};return db['WhatsappQueueReport'][_0x6326('0x20')](_0x485bed)['then'](function(_0x282f33){_0x4980f6[_0x6326('0x20')]=_0x282f33;if(_0x40e036[_0x6326('0x32')][_0x6326('0x41')]){_0x461e0f[_0x6326('0x42')]=[{'all':!![]}];}return db[_0x6326('0x2d')][_0x6326('0x43')](_0x461e0f);})[_0x6326('0x25')](function(_0x3b089b){_0x4980f6[_0x6326('0x44')]=_0x3b089b;return _0x4980f6;})[_0x6326('0x25')](respondWithFilteredResult(_0x27802c,_0x461e0f))['catch'](handleError(_0x27802c,null));};exports[_0x6326('0x45')]=function(_0x5ce03a,_0x29f2fd){var _0x1d9d4c={'raw':!![],'where':{'id':_0x5ce03a[_0x6326('0x46')]['id']}},_0x16fc33={};_0x16fc33['model']=_[_0x6326('0x47')](db[_0x6326('0x2d')]['rawAttributes']);_0x16fc33[_0x6326('0x32')]=_[_0x6326('0x47')](_0x5ce03a[_0x6326('0x32')]);_0x16fc33[_0x6326('0x33')]=_['intersection'](_0x16fc33[_0x6326('0x31')],_0x16fc33[_0x6326('0x32')]);_0x1d9d4c[_0x6326('0x35')]=_[_0x6326('0x34')](_0x16fc33[_0x6326('0x31')],qs[_0x6326('0x36')](_0x5ce03a[_0x6326('0x32')]['fields']));_0x1d9d4c[_0x6326('0x35')]=_0x1d9d4c[_0x6326('0x35')][_0x6326('0x37')]?_0x1d9d4c[_0x6326('0x35')]:_0x16fc33['model'];if(_0x5ce03a[_0x6326('0x32')]['includeAll']){_0x1d9d4c[_0x6326('0x42')]=[{'all':!![]}];}_0x1d9d4c=_[_0x6326('0x3e')]({},_0x1d9d4c,_0x5ce03a[_0x6326('0x48')]);return db[_0x6326('0x2d')][_0x6326('0x49')](_0x1d9d4c)['then'](handleEntityNotFound(_0x29f2fd,null))[_0x6326('0x25')](respondWithResult(_0x29f2fd,null))['catch'](handleError(_0x29f2fd,null));};exports['create']=function(_0x2bca12,_0x44cf9d){return db['WhatsappQueueReport'][_0x6326('0x4a')](_0x2bca12[_0x6326('0x4b')],{})[_0x6326('0x25')](respondWithResult(_0x44cf9d,0xc9))[_0x6326('0x4c')](handleError(_0x44cf9d,null));};exports[_0x6326('0x24')]=function(_0x4f8dc0,_0x4af0ee){if(_0x4f8dc0[_0x6326('0x4b')]['id']){delete _0x4f8dc0[_0x6326('0x4b')]['id'];}return db[_0x6326('0x2d')][_0x6326('0x49')]({'where':{'id':_0x4f8dc0[_0x6326('0x46')]['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x4af0ee,null))[_0x6326('0x25')](saveUpdates(_0x4f8dc0['body'],null))[_0x6326('0x25')](respondWithResult(_0x4af0ee,null))[_0x6326('0x4c')](handleError(_0x4af0ee,null));};exports[_0x6326('0x26')]=function(_0x3e7674,_0x1b5e9a){return db['WhatsappQueueReport'][_0x6326('0x49')]({'where':{'id':_0x3e7674['params']['id']}})[_0x6326('0x25')](handleEntityNotFound(_0x1b5e9a,null))[_0x6326('0x25')](removeEntity(_0x1b5e9a,null))['catch'](handleError(_0x1b5e9a,null));};exports[_0x6326('0x4d')]=function(_0x5040b1,_0xaa4c9d){return db[_0x6326('0x2d')][_0x6326('0x4d')]()[_0x6326('0x25')](respondWithResult(_0xaa4c9d,null))['catch'](handleError(_0xaa4c9d,null));}; \ No newline at end of file +var _0xda3f=['fields','nolimit','sort','filter','where','merge','type','VIRTUAL','options','WhatsappQueueReport','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','describe','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','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','map','key','model','query','keys','filters','intersection','attributes'];(function(_0xe7c736,_0x5b5fcc){var _0x406670=function(_0x60dc8b){while(--_0x60dc8b){_0xe7c736['push'](_0xe7c736['shift']());}};_0x406670(++_0x5b5fcc);}(_0xda3f,0xec));var _0xfda3=function(_0x521a80,_0xc9eb53){_0x521a80=_0x521a80-0x0;var _0x1f22ae=_0xda3f[_0x521a80];return _0x1f22ae;};'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);};}exports['index']=function(_0x3c1549,_0x4101b1){var _0x301509={},_0x474992={},_0xe21ec6={'count':0x0,'rows':[]};var _0x3cfeb2=_[_0xfda3('0x28')](db['WhatsappQueueReport']['rawAttributes'],function(_0x3aef3c){return{'name':_0x3aef3c['fieldName'],'type':_0x3aef3c['type'][_0xfda3('0x29')]};});_0x474992[_0xfda3('0x2a')]=_[_0xfda3('0x28')](_0x3cfeb2,_0xfda3('0x26'));_0x474992[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x3c1549[_0xfda3('0x2b')]);_0x474992[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x474992['model'],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2f')]=_[_0xfda3('0x2e')](_0x474992[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x301509[_0xfda3('0x2f')]=_0x301509[_0xfda3('0x2f')]['length']?_0x301509['attributes']:_0x474992[_0xfda3('0x2a')];if(!_0x3c1549[_0xfda3('0x2b')]['hasOwnProperty'](_0xfda3('0x31'))){_0x301509[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3c1549['query'][_0xfda3('0x1b')]);_0x301509[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x19')]);}_0x301509['order']=qs[_0xfda3('0x32')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x32')]);_0x301509['where']=qs[_0xfda3('0x2d')](_['pick'](_0x3c1549[_0xfda3('0x2b')],_0x474992[_0xfda3('0x2d')]),_0x3cfeb2);if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x33')]){_0x301509[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x301509[_0xfda3('0x34')],{'$or':_[_0xfda3('0x28')](_0x3cfeb2,function(_0x577be8){if(_0x577be8[_0xfda3('0x36')]!==_0xfda3('0x37')){var _0xd2dde0={};_0xd2dde0[_0x577be8[_0xfda3('0x26')]]={'$like':'%'+_0x3c1549['query'][_0xfda3('0x33')]+'%'};return _0xd2dde0;}})});}_0x301509=_[_0xfda3('0x35')]({},_0x301509,_0x3c1549[_0xfda3('0x38')]);var _0x5bad90={'where':_0x301509['where']};return db[_0xfda3('0x39')][_0xfda3('0x1c')](_0x5bad90)[_0xfda3('0x23')](function(_0x1aaa6c){_0xe21ec6[_0xfda3('0x1c')]=_0x1aaa6c;if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x301509[_0xfda3('0x3b')]=[{'all':!![]}];}return db[_0xfda3('0x39')][_0xfda3('0x3c')](_0x301509);})['then'](function(_0x27200f){_0xe21ec6[_0xfda3('0x3d')]=_0x27200f;return _0xe21ec6;})['then'](respondWithFilteredResult(_0x4101b1,_0x301509))[_0xfda3('0x3e')](handleError(_0x4101b1,null));};exports['show']=function(_0x51a314,_0x4e6886){var _0x2208bc={'raw':!![],'where':{'id':_0x51a314[_0xfda3('0x3f')]['id']}},_0x107fb1={};_0x107fb1[_0xfda3('0x2a')]=_['keys'](db[_0xfda3('0x39')][_0xfda3('0x40')]);_0x107fb1[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x51a314['query']);_0x107fb1[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],_0x107fb1['query']);_0x2208bc['attributes']=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x51a314[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x2208bc[_0xfda3('0x2f')]=_0x2208bc[_0xfda3('0x2f')][_0xfda3('0x41')]?_0x2208bc[_0xfda3('0x2f')]:_0x107fb1[_0xfda3('0x2a')];if(_0x51a314[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x2208bc[_0xfda3('0x3b')]=[{'all':!![]}];}_0x2208bc=_[_0xfda3('0x35')]({},_0x2208bc,_0x51a314['options']);return db['WhatsappQueueReport'][_0xfda3('0x42')](_0x2208bc)[_0xfda3('0x23')](handleEntityNotFound(_0x4e6886,null))[_0xfda3('0x23')](respondWithResult(_0x4e6886,null))[_0xfda3('0x3e')](handleError(_0x4e6886,null));};exports[_0xfda3('0x43')]=function(_0x60a89d,_0x192133){return db[_0xfda3('0x39')][_0xfda3('0x43')](_0x60a89d[_0xfda3('0x44')],{})['then'](respondWithResult(_0x192133,0xc9))[_0xfda3('0x3e')](handleError(_0x192133,null));};exports[_0xfda3('0x22')]=function(_0x481356,_0x36aa3a){if(_0x481356[_0xfda3('0x44')]['id']){delete _0x481356['body']['id'];}return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x481356[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x23')](saveUpdates(_0x481356[_0xfda3('0x44')],null))[_0xfda3('0x23')](respondWithResult(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x45')]=function(_0x33565d,_0x2f54eb){return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x33565d['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2f54eb,null))['then'](removeEntity(_0x2f54eb,null))[_0xfda3('0x3e')](handleError(_0x2f54eb,null));};exports['describe']=function(_0x1b5e89,_0x6447){return db[_0xfda3('0x39')][_0xfda3('0x46')]()['then'](respondWithResult(_0x6447,null))[_0xfda3('0x3e')](handleError(_0x6447,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 3d12a12..0c37561 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 _0xe96e=['bluebird','request-promise','path','rimraf','exports','define','WhatsappQueueReport','uniqueid','util','../../config/logger','api','moment'];(function(_0x4c6626,_0x2d7e7a){var _0x326b03=function(_0x1b0f32){while(--_0x1b0f32){_0x4c6626['push'](_0x4c6626['shift']());}};_0x326b03(++_0x2d7e7a);}(_0xe96e,0x110));var _0xee96=function(_0x1762fd,_0x3774d1){_0x1762fd=_0x1762fd-0x0;var _0x1a1329=_0xe96e[_0x1762fd];return _0x1a1329;};'use strict';var _=require('lodash');var util=require(_0xee96('0x0'));var logger=require(_0xee96('0x1'))(_0xee96('0x2'));var moment=require(_0xee96('0x3'));var BPromise=require(_0xee96('0x4'));var rp=require(_0xee96('0x5'));var fs=require('fs');var path=require(_0xee96('0x6'));var rimraf=require(_0xee96('0x7'));var config=require('../../config/environment');var attributes=require('./whatsappQueueReport.attributes');module[_0xee96('0x8')]=function(_0x390cd8,_0x724b31){return _0x390cd8[_0xee96('0x9')](_0xee96('0xa'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0xee96('0xb'),'fields':[_0xee96('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd7c8=['api','moment','request-promise','path','../../config/environment','./whatsappQueueReport.attributes','exports','define','report_whatsapp_queue','uniqueid','lodash','util'];(function(_0x4e54b8,_0x24ff6f){var _0x50e1b0=function(_0x463098){while(--_0x463098){_0x4e54b8['push'](_0x4e54b8['shift']());}};_0x50e1b0(++_0x24ff6f);}(_0xd7c8,0x18a));var _0x8d7c=function(_0x547a75,_0x5003ff){_0x547a75=_0x547a75-0x0;var _0x58b951=_0xd7c8[_0x547a75];return _0x58b951;};'use strict';var _=require(_0x8d7c('0x0'));var util=require(_0x8d7c('0x1'));var logger=require('../../config/logger')(_0x8d7c('0x2'));var moment=require(_0x8d7c('0x3'));var BPromise=require('bluebird');var rp=require(_0x8d7c('0x4'));var fs=require('fs');var path=require(_0x8d7c('0x5'));var rimraf=require('rimraf');var config=require(_0x8d7c('0x6'));var attributes=require(_0x8d7c('0x7'));module[_0x8d7c('0x8')]=function(_0xd11dc0,_0x289c42){return _0xd11dc0[_0x8d7c('0x9')]('WhatsappQueueReport',attributes,{'tableName':_0x8d7c('0xa'),'paranoid':![],'indexes':[{'name':_0x8d7c('0xb'),'fields':[_0x8d7c('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index a22be39..e7a110d 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 _0xe8d7=['code','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','options','debug','raw','UpdateWhatsappQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xaca348,_0x4d3993){var _0x560057=function(_0x41e145){while(--_0x41e145){_0xaca348['push'](_0xaca348['shift']());}};_0x560057(++_0x4d3993);}(_0xe8d7,0x167));var _0x7e8d=function(_0x34ff0b,_0x3432a3){_0x34ff0b=_0x34ff0b-0x0;var _0x1b0d1d=_0xe8d7[_0x34ff0b];return _0x1b0d1d;};'use strict';var _=require(_0x7e8d('0x0'));var util=require('util');var moment=require(_0x7e8d('0x1'));var BPromise=require(_0x7e8d('0x2'));var rs=require(_0x7e8d('0x3'));var fs=require('fs');var Redis=require(_0x7e8d('0x4'));var db=require(_0x7e8d('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x7e8d('0x6'));var config=require(_0x7e8d('0x7'));var jayson=require(_0x7e8d('0x8'));var client=jayson[_0x7e8d('0x9')][_0x7e8d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3136f1,_0x325772,_0x546745){return new BPromise(function(_0x4ac0a7,_0x42eb23){return client['request'](_0x3136f1,_0x546745)[_0x7e8d('0xb')](function(_0x515084){logger[_0x7e8d('0xc')](_0x7e8d('0xd'),_0x325772,_0x7e8d('0xe'));logger['debug'](_0x7e8d('0xf'),_0x325772,_0x7e8d('0xe'),JSON[_0x7e8d('0x10')](_0x515084));if(_0x515084[_0x7e8d('0x11')]){if(_0x515084[_0x7e8d('0x11')][_0x7e8d('0x12')]===0x1f4){logger[_0x7e8d('0x11')](_0x7e8d('0xd'),_0x325772,_0x515084[_0x7e8d('0x11')]['message']);return _0x42eb23(_0x515084['error'][_0x7e8d('0x13')]);}logger[_0x7e8d('0x11')](_0x7e8d('0xd'),_0x325772,_0x515084[_0x7e8d('0x11')][_0x7e8d('0x13')]);return _0x4ac0a7(_0x515084[_0x7e8d('0x11')][_0x7e8d('0x13')]);}else{logger[_0x7e8d('0xc')](_0x7e8d('0xd'),_0x325772,_0x7e8d('0xe'));_0x4ac0a7(_0x515084[_0x7e8d('0x14')][_0x7e8d('0x13')]);}})[_0x7e8d('0x15')](function(_0x1f0248){logger[_0x7e8d('0x11')](_0x7e8d('0xd'),_0x325772,_0x1f0248);_0x42eb23(_0x1f0248);});});}exports[_0x7e8d('0x16')]=function(_0x30d021){var _0x33fca3=this;return new Promise(function(_0x56d325,_0x4606b7){return db[_0x7e8d('0x17')][_0x7e8d('0x18')](_0x30d021['body'],{'raw':_0x30d021['options']?_0x30d021[_0x7e8d('0x19')]['raw']===undefined?!![]:![]:!![]})[_0x7e8d('0xb')](function(_0x1b5488){logger[_0x7e8d('0xc')](_0x7e8d('0x16'),_0x30d021);logger[_0x7e8d('0x1a')](_0x7e8d('0x16'),_0x30d021,JSON['stringify'](_0x1b5488));_0x56d325(_0x1b5488);})[_0x7e8d('0x15')](function(_0x5efad9){logger['error'](_0x7e8d('0x16'),_0x5efad9['message'],_0x30d021);_0x4606b7(_0x33fca3[_0x7e8d('0x11')](0x1f4,_0x5efad9[_0x7e8d('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x233aa2){var _0x11f397=this;return new Promise(function(_0x109d5a,_0x4ec572){return db[_0x7e8d('0x17')]['update'](_0x233aa2['body'],{'raw':_0x233aa2['options']?_0x233aa2[_0x7e8d('0x19')][_0x7e8d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x233aa2[_0x7e8d('0x19')]?_0x233aa2[_0x7e8d('0x19')]['where']||null:null,'attributes':_0x233aa2[_0x7e8d('0x19')]?_0x233aa2[_0x7e8d('0x19')]['attributes']||null:null,'limit':_0x233aa2[_0x7e8d('0x19')]?_0x233aa2['options']['limit']||null:null})[_0x7e8d('0xb')](function(_0x2ca816){logger[_0x7e8d('0xc')](_0x7e8d('0x1c'),_0x233aa2);logger[_0x7e8d('0x1a')](_0x7e8d('0x1c'),_0x233aa2,JSON['stringify'](_0x2ca816));_0x109d5a(_0x2ca816);})[_0x7e8d('0x15')](function(_0x3b7fa4){logger[_0x7e8d('0x11')](_0x7e8d('0x1c'),_0x3b7fa4[_0x7e8d('0x13')],_0x233aa2);_0x4ec572(_0x11f397['error'](0x1f4,_0x3b7fa4['message']));});});}; \ No newline at end of file +var _0xa22b=['body','debug','stringify','UpdateWhatsappQueueReport','update','options','raw','limit','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','then','info','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappQueueReport,\x20%s,\x20%s','message','result','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create'];(function(_0x28aea5,_0x3bb12e){var _0x6a55f9=function(_0xf6ece8){while(--_0xf6ece8){_0x28aea5['push'](_0x28aea5['shift']());}};_0x6a55f9(++_0x3bb12e);}(_0xa22b,0x128));var _0xba22=function(_0x1274df,_0x1cfd7b){_0x1274df=_0x1274df-0x0;var _0x5b389c=_0xa22b[_0x1274df];return _0x5b389c;};'use strict';var _=require(_0xba22('0x0'));var util=require(_0xba22('0x1'));var moment=require('moment');var BPromise=require(_0xba22('0x2'));var rs=require(_0xba22('0x3'));var fs=require('fs');var Redis=require(_0xba22('0x4'));var db=require(_0xba22('0x5'))['db'];var utils=require(_0xba22('0x6'));var logger=require(_0xba22('0x7'))(_0xba22('0x8'));var config=require(_0xba22('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xba22('0xa')][_0xba22('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x44c0e9,_0x8dfe25,_0x2d16f5){return new BPromise(function(_0x50db0e,_0x41252c){return client['request'](_0x44c0e9,_0x2d16f5)[_0xba22('0xc')](function(_0x265d5b){logger[_0xba22('0xd')]('WhatsappQueueReport,\x20%s,\x20%s',_0x8dfe25,'request\x20sent');logger['debug'](_0xba22('0xe'),_0x8dfe25,_0xba22('0xf'),JSON['stringify'](_0x265d5b));if(_0x265d5b[_0xba22('0x10')]){if(_0x265d5b[_0xba22('0x10')]['code']===0x1f4){logger[_0xba22('0x10')](_0xba22('0x11'),_0x8dfe25,_0x265d5b[_0xba22('0x10')][_0xba22('0x12')]);return _0x41252c(_0x265d5b[_0xba22('0x10')][_0xba22('0x12')]);}logger[_0xba22('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x8dfe25,_0x265d5b[_0xba22('0x10')][_0xba22('0x12')]);return _0x50db0e(_0x265d5b[_0xba22('0x10')][_0xba22('0x12')]);}else{logger[_0xba22('0xd')](_0xba22('0x11'),_0x8dfe25,_0xba22('0xf'));_0x50db0e(_0x265d5b[_0xba22('0x13')][_0xba22('0x12')]);}})[_0xba22('0x14')](function(_0x2c5a63){logger[_0xba22('0x10')]('WhatsappQueueReport,\x20%s,\x20%s',_0x8dfe25,_0x2c5a63);_0x41252c(_0x2c5a63);});});}exports[_0xba22('0x15')]=function(_0x7ea09b){var _0x4c04a8=this;return new Promise(function(_0x10d74a,_0x55c164){return db[_0xba22('0x16')][_0xba22('0x17')](_0x7ea09b[_0xba22('0x18')],{'raw':_0x7ea09b['options']?_0x7ea09b['options']['raw']===undefined?!![]:![]:!![]})[_0xba22('0xc')](function(_0x6e8181){logger[_0xba22('0xd')](_0xba22('0x15'),_0x7ea09b);logger[_0xba22('0x19')]('CreateWhatsappQueueReport',_0x7ea09b,JSON[_0xba22('0x1a')](_0x6e8181));_0x10d74a(_0x6e8181);})[_0xba22('0x14')](function(_0x31bdcb){logger['error'](_0xba22('0x15'),_0x31bdcb['message'],_0x7ea09b);_0x55c164(_0x4c04a8['error'](0x1f4,_0x31bdcb[_0xba22('0x12')]));});});};exports[_0xba22('0x1b')]=function(_0xde495e){var _0x63d230=this;return new Promise(function(_0x5f39b0,_0x2812cd){return db[_0xba22('0x16')][_0xba22('0x1c')](_0xde495e[_0xba22('0x18')],{'raw':_0xde495e[_0xba22('0x1d')]?_0xde495e['options'][_0xba22('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xde495e[_0xba22('0x1d')]?_0xde495e['options']['where']||null:null,'attributes':_0xde495e[_0xba22('0x1d')]?_0xde495e[_0xba22('0x1d')]['attributes']||null:null,'limit':_0xde495e[_0xba22('0x1d')]?_0xde495e['options'][_0xba22('0x1f')]||null:null})[_0xba22('0xc')](function(_0x1ca57d){logger[_0xba22('0xd')]('UpdateWhatsappQueueReport',_0xde495e);logger[_0xba22('0x19')](_0xba22('0x1b'),_0xde495e,JSON[_0xba22('0x1a')](_0x1ca57d));_0x5f39b0(_0x1ca57d);})['catch'](function(_0x314127){logger[_0xba22('0x10')](_0xba22('0x1b'),_0x314127['message'],_0xde495e);_0x2812cd(_0x63d230['error'](0x1f4,_0x314127[_0xba22('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 3629d87..f42c409 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 _0xf717=['/:id','show','post','create','update','delete','exports','multer','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe'];(function(_0x233fa7,_0x54277a){var _0xf86b84=function(_0x2e8e41){while(--_0x2e8e41){_0x233fa7['push'](_0x233fa7['shift']());}};_0xf86b84(++_0x54277a);}(_0xf717,0x170));var _0x7f71=function(_0x2b6448,_0x4fa425){_0x2b6448=_0x2b6448-0x0;var _0x5cc0f1=_0xf717[_0x2b6448];return _0x5cc0f1;};'use strict';var multer=require(_0x7f71('0x0'));var util=require('util');var path=require(_0x7f71('0x1'));var timeout=require(_0x7f71('0x2'));var express=require('express');var router=express[_0x7f71('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x7f71('0x4'));var interaction=require(_0x7f71('0x5'));var config=require(_0x7f71('0x6'));var controller=require(_0x7f71('0x7'));router[_0x7f71('0x8')]('/',auth[_0x7f71('0x9')](),controller[_0x7f71('0xa')]);router[_0x7f71('0x8')](_0x7f71('0xb'),auth[_0x7f71('0x9')](),controller['describe']);router[_0x7f71('0x8')](_0x7f71('0xc'),auth[_0x7f71('0x9')](),controller[_0x7f71('0xd')]);router[_0x7f71('0xe')]('/',auth[_0x7f71('0x9')](),controller[_0x7f71('0xf')]);router['put'](_0x7f71('0xc'),auth['isAuthenticated'](),controller[_0x7f71('0x10')]);router[_0x7f71('0x11')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x7f71('0x12')]=router; \ No newline at end of file +var _0x211d=['exports','multer','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','show','post','destroy'];(function(_0x37d0fa,_0x38275b){var _0xd0656c=function(_0x2fb25d){while(--_0x2fb25d){_0x37d0fa['push'](_0x37d0fa['shift']());}};_0xd0656c(++_0x38275b);}(_0x211d,0x11e));var _0xd211=function(_0x4520a8,_0x25f48f){_0x4520a8=_0x4520a8-0x0;var _0x5d72ba=_0x211d[_0x4520a8];return _0x5d72ba;};'use strict';var multer=require(_0xd211('0x0'));var util=require('util');var path=require(_0xd211('0x1'));var timeout=require('connect-timeout');var express=require(_0xd211('0x2'));var router=express[_0xd211('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xd211('0x4'));var interaction=require(_0xd211('0x5'));var config=require(_0xd211('0x6'));var controller=require('./whatsappTransferReport.controller');router[_0xd211('0x7')]('/',auth[_0xd211('0x8')](),controller['index']);router[_0xd211('0x7')](_0xd211('0x9'),auth[_0xd211('0x8')](),controller[_0xd211('0xa')]);router[_0xd211('0x7')]('/:id',auth[_0xd211('0x8')](),controller[_0xd211('0xb')]);router[_0xd211('0xc')]('/',auth[_0xd211('0x8')](),controller['create']);router['put']('/:id',auth[_0xd211('0x8')](),controller['update']);router['delete']('/:id',auth[_0xd211('0x8')](),controller[_0xd211('0xd')]);module[_0xd211('0xe')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index 705cacc..a13d849 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 _0xf682=['ENUM','queue','DATE','sequelize','exports','STRING'];(function(_0x65c597,_0x39e7e0){var _0x1ec368=function(_0x42efb8){while(--_0x42efb8){_0x65c597['push'](_0x65c597['shift']());}};_0x1ec368(++_0x39e7e0);}(_0xf682,0x12f));var _0x2f68=function(_0x53f110,_0x320abf){_0x53f110=_0x53f110-0x0;var _0x26570d=_0xf682[_0x53f110];return _0x26570d;};'use strict';var Sequelize=require(_0x2f68('0x0'));module[_0x2f68('0x1')]={'uniqueid':{'type':Sequelize[_0x2f68('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2f68('0x3')]('account','agent',_0x2f68('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x2f68('0x5')]}}; \ No newline at end of file +var _0x2dd8=['exports','account','agent','queue','DATE','sequelize'];(function(_0x33593e,_0x22ddd3){var _0x53db1a=function(_0x499ee5){while(--_0x499ee5){_0x33593e['push'](_0x33593e['shift']());}};_0x53db1a(++_0x22ddd3);}(_0x2dd8,0x143));var _0x82dd=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x2dd8[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x82dd('0x0'));module[_0x82dd('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x82dd('0x2'),_0x82dd('0x3'),_0x82dd('0x4')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0x82dd('0x5')]}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index c046b7e..96bf9a9 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 _0x3eef=['options','includeAll','findAll','rows','catch','params','include','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','apply','reject','save','then','destroy','stack','name','send','index','map','WhatsappTransferReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','sort','where','filter','merge','VIRTUAL'];(function(_0x214393,_0x243463){var _0x38be1a=function(_0x3e46b0){while(--_0x3e46b0){_0x214393['push'](_0x214393['shift']());}};_0x38be1a(++_0x243463);}(_0x3eef,0xe0));var _0xf3ee=function(_0xbf1156,_0xa699bf){_0xbf1156=_0xbf1156-0x0;var _0x4e0a04=_0x3eef[_0xbf1156];return _0x4e0a04;};'use strict';var emlformat=require(_0xf3ee('0x0'));var rimraf=require(_0xf3ee('0x1'));var zipdir=require(_0xf3ee('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf3ee('0x3'));var moment=require('moment');var BPromise=require(_0xf3ee('0x4'));var Mustache=require(_0xf3ee('0x5'));var util=require(_0xf3ee('0x6'));var path=require(_0xf3ee('0x7'));var sox=require(_0xf3ee('0x8'));var csv=require(_0xf3ee('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3ee('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xf3ee('0xb'));var jsforce=require(_0xf3ee('0xc'));var deskjs=require(_0xf3ee('0xd'));var toCsv=require(_0xf3ee('0x9'));var querystring=require(_0xf3ee('0xe'));var Papa=require(_0xf3ee('0xf'));var Redis=require(_0xf3ee('0x10'));var authService=require(_0xf3ee('0x11'));var qs=require(_0xf3ee('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf3ee('0x13'));var logger=require('../../config/logger')(_0xf3ee('0x14'));var utils=require(_0xf3ee('0x15'));var config=require(_0xf3ee('0x16'));var licenseUtil=require(_0xf3ee('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5468f4,_0x572c87){_0x572c87=_0x572c87||0xcc;return function(_0x21b639){if(_0x21b639){return _0x5468f4[_0xf3ee('0x18')](_0x572c87);}return _0x5468f4[_0xf3ee('0x19')](_0x572c87)[_0xf3ee('0x1a')]();};}function respondWithResult(_0x56c746,_0x585fe1){_0x585fe1=_0x585fe1||0xc8;return function(_0x275bcc){if(_0x275bcc){return _0x56c746['status'](_0x585fe1)[_0xf3ee('0x1b')](_0x275bcc);}};}function respondWithFilteredResult(_0x19df14,_0x845e2){return function(_0x2450f4){if(_0x2450f4){var _0x15626c=typeof _0x845e2[_0xf3ee('0x1c')]===_0xf3ee('0x1d')&&typeof _0x845e2[_0xf3ee('0x1e')]===_0xf3ee('0x1d');var _0x416ab8=_0x2450f4['count'];var _0x4afeed=_0x15626c?0x0:_0x845e2[_0xf3ee('0x1c')];var _0x1eb2c2=_0x15626c?_0x2450f4[_0xf3ee('0x1f')]:_0x845e2['offset']+_0x845e2[_0xf3ee('0x1e')];var _0x3569c9;if(_0x1eb2c2>=_0x416ab8){_0x1eb2c2=_0x416ab8;_0x3569c9=0xc8;}else{_0x3569c9=0xce;}_0x19df14['status'](_0x3569c9);return _0x19df14['set']('Content-Range',_0x4afeed+'-'+_0x1eb2c2+'/'+_0x416ab8)[_0xf3ee('0x1b')](_0x2450f4);}return null;};}function patchUpdates(_0x3dc141){return function(_0x561799){try{jsonpatch[_0xf3ee('0x20')](_0x561799,_0x3dc141,!![]);}catch(_0x3bd68b){return BPromise[_0xf3ee('0x21')](_0x3bd68b);}return _0x561799[_0xf3ee('0x22')]();};}function saveUpdates(_0x229c4c,_0x4d6e8a){return function(_0x234c95){if(_0x234c95){return _0x234c95['update'](_0x229c4c)[_0xf3ee('0x23')](function(_0x78d260){return _0x78d260;});}return null;};}function removeEntity(_0x39ef41,_0x6b5fa2){return function(_0x14f443){if(_0x14f443){return _0x14f443[_0xf3ee('0x24')]()[_0xf3ee('0x23')](function(){_0x39ef41[_0xf3ee('0x19')](0xcc)[_0xf3ee('0x1a')]();});}};}function handleEntityNotFound(_0x356e01,_0xcdd4f6){return function(_0x243cfa){if(!_0x243cfa){_0x356e01[_0xf3ee('0x18')](0x194);}return _0x243cfa;};}function handleError(_0x530607,_0xa9e644){_0xa9e644=_0xa9e644||0x1f4;return function(_0x1314c3){logger['error'](_0x1314c3[_0xf3ee('0x25')]);if(_0x1314c3[_0xf3ee('0x26')]){delete _0x1314c3[_0xf3ee('0x26')];}_0x530607[_0xf3ee('0x19')](_0xa9e644)[_0xf3ee('0x27')](_0x1314c3);};}exports[_0xf3ee('0x28')]=function(_0x2c3744,_0x1eba58){var _0xa45069={},_0x53c17c={},_0x525b56={'count':0x0,'rows':[]};var _0x517fc6=_[_0xf3ee('0x29')](db[_0xf3ee('0x2a')][_0xf3ee('0x2b')],function(_0x5adcfe){return{'name':_0x5adcfe[_0xf3ee('0x2c')],'type':_0x5adcfe[_0xf3ee('0x2d')][_0xf3ee('0x2e')]};});_0x53c17c[_0xf3ee('0x2f')]=_[_0xf3ee('0x29')](_0x517fc6,_0xf3ee('0x26'));_0x53c17c[_0xf3ee('0x30')]=_[_0xf3ee('0x31')](_0x2c3744[_0xf3ee('0x30')]);_0x53c17c[_0xf3ee('0x32')]=_[_0xf3ee('0x33')](_0x53c17c['model'],_0x53c17c[_0xf3ee('0x30')]);_0xa45069[_0xf3ee('0x34')]=_['intersection'](_0x53c17c['model'],qs[_0xf3ee('0x35')](_0x2c3744[_0xf3ee('0x30')][_0xf3ee('0x35')]));_0xa45069[_0xf3ee('0x34')]=_0xa45069[_0xf3ee('0x34')][_0xf3ee('0x36')]?_0xa45069['attributes']:_0x53c17c['model'];if(!_0x2c3744[_0xf3ee('0x30')]['hasOwnProperty']('nolimit')){_0xa45069[_0xf3ee('0x1e')]=qs[_0xf3ee('0x1e')](_0x2c3744[_0xf3ee('0x30')][_0xf3ee('0x1e')]);_0xa45069[_0xf3ee('0x1c')]=qs[_0xf3ee('0x1c')](_0x2c3744[_0xf3ee('0x30')][_0xf3ee('0x1c')]);}_0xa45069['order']=qs[_0xf3ee('0x37')](_0x2c3744[_0xf3ee('0x30')]['sort']);_0xa45069[_0xf3ee('0x38')]=qs[_0xf3ee('0x32')](_['pick'](_0x2c3744[_0xf3ee('0x30')],_0x53c17c[_0xf3ee('0x32')]),_0x517fc6);if(_0x2c3744[_0xf3ee('0x30')][_0xf3ee('0x39')]){_0xa45069[_0xf3ee('0x38')]=_[_0xf3ee('0x3a')](_0xa45069[_0xf3ee('0x38')],{'$or':_[_0xf3ee('0x29')](_0x517fc6,function(_0x2060cb){if(_0x2060cb[_0xf3ee('0x2d')]!==_0xf3ee('0x3b')){var _0x279cbc={};_0x279cbc[_0x2060cb[_0xf3ee('0x26')]]={'$like':'%'+_0x2c3744[_0xf3ee('0x30')]['filter']+'%'};return _0x279cbc;}})});}_0xa45069=_['merge']({},_0xa45069,_0x2c3744[_0xf3ee('0x3c')]);var _0x10d8b2={'where':_0xa45069[_0xf3ee('0x38')]};return db[_0xf3ee('0x2a')][_0xf3ee('0x1f')](_0x10d8b2)[_0xf3ee('0x23')](function(_0x3778cd){_0x525b56[_0xf3ee('0x1f')]=_0x3778cd;if(_0x2c3744[_0xf3ee('0x30')][_0xf3ee('0x3d')]){_0xa45069['include']=[{'all':!![]}];}return db[_0xf3ee('0x2a')][_0xf3ee('0x3e')](_0xa45069);})['then'](function(_0x3a2089){_0x525b56[_0xf3ee('0x3f')]=_0x3a2089;return _0x525b56;})[_0xf3ee('0x23')](respondWithFilteredResult(_0x1eba58,_0xa45069))[_0xf3ee('0x40')](handleError(_0x1eba58,null));};exports['show']=function(_0x51e87e,_0x26e9f7){var _0x55e3ab={'raw':!![],'where':{'id':_0x51e87e[_0xf3ee('0x41')]['id']}},_0x2e8b93={};_0x2e8b93[_0xf3ee('0x2f')]=_[_0xf3ee('0x31')](db[_0xf3ee('0x2a')][_0xf3ee('0x2b')]);_0x2e8b93[_0xf3ee('0x30')]=_[_0xf3ee('0x31')](_0x51e87e['query']);_0x2e8b93['filters']=_[_0xf3ee('0x33')](_0x2e8b93['model'],_0x2e8b93[_0xf3ee('0x30')]);_0x55e3ab[_0xf3ee('0x34')]=_[_0xf3ee('0x33')](_0x2e8b93['model'],qs['fields'](_0x51e87e[_0xf3ee('0x30')][_0xf3ee('0x35')]));_0x55e3ab[_0xf3ee('0x34')]=_0x55e3ab[_0xf3ee('0x34')]['length']?_0x55e3ab[_0xf3ee('0x34')]:_0x2e8b93[_0xf3ee('0x2f')];if(_0x51e87e[_0xf3ee('0x30')][_0xf3ee('0x3d')]){_0x55e3ab[_0xf3ee('0x42')]=[{'all':!![]}];}_0x55e3ab=_['merge']({},_0x55e3ab,_0x51e87e['options']);return db[_0xf3ee('0x2a')][_0xf3ee('0x43')](_0x55e3ab)[_0xf3ee('0x23')](handleEntityNotFound(_0x26e9f7,null))[_0xf3ee('0x23')](respondWithResult(_0x26e9f7,null))[_0xf3ee('0x40')](handleError(_0x26e9f7,null));};exports[_0xf3ee('0x44')]=function(_0x196615,_0x2b0cd1){return db[_0xf3ee('0x2a')][_0xf3ee('0x44')](_0x196615['body'],{})[_0xf3ee('0x23')](respondWithResult(_0x2b0cd1,0xc9))[_0xf3ee('0x40')](handleError(_0x2b0cd1,null));};exports['update']=function(_0x303fc7,_0x5f7d6a){if(_0x303fc7[_0xf3ee('0x45')]['id']){delete _0x303fc7['body']['id'];}return db['WhatsappTransferReport']['find']({'where':{'id':_0x303fc7[_0xf3ee('0x41')]['id']}})[_0xf3ee('0x23')](handleEntityNotFound(_0x5f7d6a,null))[_0xf3ee('0x23')](saveUpdates(_0x303fc7[_0xf3ee('0x45')],null))[_0xf3ee('0x23')](respondWithResult(_0x5f7d6a,null))[_0xf3ee('0x40')](handleError(_0x5f7d6a,null));};exports[_0xf3ee('0x24')]=function(_0x50cd90,_0x3ee9e6){return db[_0xf3ee('0x2a')][_0xf3ee('0x43')]({'where':{'id':_0x50cd90[_0xf3ee('0x41')]['id']}})['then'](handleEntityNotFound(_0x3ee9e6,null))[_0xf3ee('0x23')](removeEntity(_0x3ee9e6,null))['catch'](handleError(_0x3ee9e6,null));};exports[_0xf3ee('0x46')]=function(_0x59a119,_0x523e14){return db['WhatsappTransferReport'][_0xf3ee('0x46')]()[_0xf3ee('0x23')](respondWithResult(_0x523e14,null))[_0xf3ee('0x40')](handleError(_0x523e14,null));}; \ No newline at end of file +var _0xcc87=['save','update','then','destroy','error','name','send','index','rawAttributes','fieldName','type','key','model','map','query','keys','attributes','intersection','fields','length','nolimit','sort','where','filters','pick','filter','VIRTUAL','merge','includeAll','include','WhatsappTransferReport','findAll','rows','catch','show','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../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','reject'];(function(_0x1d930e,_0x20d8b8){var _0x5bbd66=function(_0x3c7488){while(--_0x3c7488){_0x1d930e['push'](_0x1d930e['shift']());}};_0x5bbd66(++_0x20d8b8);}(_0xcc87,0x158));var _0x7cc8=function(_0x5a0bd2,_0x38c982){_0x5a0bd2=_0x5a0bd2-0x0;var _0x12879b=_0xcc87[_0x5a0bd2];return _0x12879b;};'use strict';var emlformat=require(_0x7cc8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x7cc8('0x1'));var jsonpatch=require(_0x7cc8('0x2'));var rp=require(_0x7cc8('0x3'));var moment=require(_0x7cc8('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x7cc8('0x5'));var util=require(_0x7cc8('0x6'));var path=require(_0x7cc8('0x7'));var sox=require(_0x7cc8('0x8'));var csv=require(_0x7cc8('0x9'));var ejs=require(_0x7cc8('0xa'));var fs=require('fs');var fs_extra=require(_0x7cc8('0xb'));var _=require(_0x7cc8('0xc'));var squel=require('squel');var crypto=require(_0x7cc8('0xd'));var jsforce=require(_0x7cc8('0xe'));var deskjs=require(_0x7cc8('0xf'));var toCsv=require(_0x7cc8('0x9'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x7cc8('0x10'));var authService=require(_0x7cc8('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x7cc8('0x12'));var hardwareService=require(_0x7cc8('0x13'));var logger=require(_0x7cc8('0x14'))(_0x7cc8('0x15'));var utils=require(_0x7cc8('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x7cc8('0x17'));var db=require(_0x7cc8('0x18'))['db'];function respondWithStatusCode(_0x8dcd17,_0x2f14b6){_0x2f14b6=_0x2f14b6||0xcc;return function(_0x2cb720){if(_0x2cb720){return _0x8dcd17[_0x7cc8('0x19')](_0x2f14b6);}return _0x8dcd17['status'](_0x2f14b6)[_0x7cc8('0x1a')]();};}function respondWithResult(_0x3a45a6,_0x197a10){_0x197a10=_0x197a10||0xc8;return function(_0x23faff){if(_0x23faff){return _0x3a45a6[_0x7cc8('0x1b')](_0x197a10)[_0x7cc8('0x1c')](_0x23faff);}};}function respondWithFilteredResult(_0xfe983e,_0x15ac4c){return function(_0x4af693){if(_0x4af693){var _0x3ad2eb=typeof _0x15ac4c[_0x7cc8('0x1d')]==='undefined'&&typeof _0x15ac4c[_0x7cc8('0x1e')]===_0x7cc8('0x1f');var _0x485180=_0x4af693['count'];var _0x475522=_0x3ad2eb?0x0:_0x15ac4c[_0x7cc8('0x1d')];var _0x552da4=_0x3ad2eb?_0x4af693[_0x7cc8('0x20')]:_0x15ac4c[_0x7cc8('0x1d')]+_0x15ac4c['limit'];var _0x4c8116;if(_0x552da4>=_0x485180){_0x552da4=_0x485180;_0x4c8116=0xc8;}else{_0x4c8116=0xce;}_0xfe983e['status'](_0x4c8116);return _0xfe983e[_0x7cc8('0x21')](_0x7cc8('0x22'),_0x475522+'-'+_0x552da4+'/'+_0x485180)['json'](_0x4af693);}return null;};}function patchUpdates(_0x553312){return function(_0x2ed0b1){try{jsonpatch['apply'](_0x2ed0b1,_0x553312,!![]);}catch(_0x4b1be2){return BPromise[_0x7cc8('0x23')](_0x4b1be2);}return _0x2ed0b1[_0x7cc8('0x24')]();};}function saveUpdates(_0x1c18c7,_0x3129f0){return function(_0x3aa89e){if(_0x3aa89e){return _0x3aa89e[_0x7cc8('0x25')](_0x1c18c7)[_0x7cc8('0x26')](function(_0x3403fa){return _0x3403fa;});}return null;};}function removeEntity(_0x2e5958,_0x4e4680){return function(_0x37788b){if(_0x37788b){return _0x37788b[_0x7cc8('0x27')]()['then'](function(){_0x2e5958['status'](0xcc)[_0x7cc8('0x1a')]();});}};}function handleEntityNotFound(_0x5d0757,_0x3ffe2e){return function(_0x81352f){if(!_0x81352f){_0x5d0757['sendStatus'](0x194);}return _0x81352f;};}function handleError(_0x57a7b1,_0x239855){_0x239855=_0x239855||0x1f4;return function(_0x2ab212){logger[_0x7cc8('0x28')](_0x2ab212['stack']);if(_0x2ab212['name']){delete _0x2ab212[_0x7cc8('0x29')];}_0x57a7b1[_0x7cc8('0x1b')](_0x239855)[_0x7cc8('0x2a')](_0x2ab212);};}exports[_0x7cc8('0x2b')]=function(_0x3e86aa,_0x540450){var _0x313752={},_0x5c1aa1={},_0x3ea0ea={'count':0x0,'rows':[]};var _0x399fa6=_['map'](db['WhatsappTransferReport'][_0x7cc8('0x2c')],function(_0x2789ee){return{'name':_0x2789ee[_0x7cc8('0x2d')],'type':_0x2789ee[_0x7cc8('0x2e')][_0x7cc8('0x2f')]};});_0x5c1aa1[_0x7cc8('0x30')]=_[_0x7cc8('0x31')](_0x399fa6,_0x7cc8('0x29'));_0x5c1aa1[_0x7cc8('0x32')]=_[_0x7cc8('0x33')](_0x3e86aa['query']);_0x5c1aa1['filters']=_['intersection'](_0x5c1aa1[_0x7cc8('0x30')],_0x5c1aa1[_0x7cc8('0x32')]);_0x313752[_0x7cc8('0x34')]=_[_0x7cc8('0x35')](_0x5c1aa1[_0x7cc8('0x30')],qs[_0x7cc8('0x36')](_0x3e86aa[_0x7cc8('0x32')]['fields']));_0x313752['attributes']=_0x313752[_0x7cc8('0x34')][_0x7cc8('0x37')]?_0x313752[_0x7cc8('0x34')]:_0x5c1aa1[_0x7cc8('0x30')];if(!_0x3e86aa[_0x7cc8('0x32')]['hasOwnProperty'](_0x7cc8('0x38'))){_0x313752[_0x7cc8('0x1e')]=qs['limit'](_0x3e86aa[_0x7cc8('0x32')][_0x7cc8('0x1e')]);_0x313752[_0x7cc8('0x1d')]=qs[_0x7cc8('0x1d')](_0x3e86aa[_0x7cc8('0x32')][_0x7cc8('0x1d')]);}_0x313752['order']=qs[_0x7cc8('0x39')](_0x3e86aa['query'][_0x7cc8('0x39')]);_0x313752[_0x7cc8('0x3a')]=qs[_0x7cc8('0x3b')](_[_0x7cc8('0x3c')](_0x3e86aa[_0x7cc8('0x32')],_0x5c1aa1[_0x7cc8('0x3b')]),_0x399fa6);if(_0x3e86aa['query'][_0x7cc8('0x3d')]){_0x313752['where']=_['merge'](_0x313752['where'],{'$or':_[_0x7cc8('0x31')](_0x399fa6,function(_0x53ed7b){if(_0x53ed7b[_0x7cc8('0x2e')]!==_0x7cc8('0x3e')){var _0x1d6e85={};_0x1d6e85[_0x53ed7b[_0x7cc8('0x29')]]={'$like':'%'+_0x3e86aa[_0x7cc8('0x32')][_0x7cc8('0x3d')]+'%'};return _0x1d6e85;}})});}_0x313752=_[_0x7cc8('0x3f')]({},_0x313752,_0x3e86aa['options']);var _0x2e62e6={'where':_0x313752[_0x7cc8('0x3a')]};return db['WhatsappTransferReport'][_0x7cc8('0x20')](_0x2e62e6)['then'](function(_0x2269be){_0x3ea0ea[_0x7cc8('0x20')]=_0x2269be;if(_0x3e86aa[_0x7cc8('0x32')][_0x7cc8('0x40')]){_0x313752[_0x7cc8('0x41')]=[{'all':!![]}];}return db[_0x7cc8('0x42')][_0x7cc8('0x43')](_0x313752);})[_0x7cc8('0x26')](function(_0x1dd1cc){_0x3ea0ea[_0x7cc8('0x44')]=_0x1dd1cc;return _0x3ea0ea;})[_0x7cc8('0x26')](respondWithFilteredResult(_0x540450,_0x313752))[_0x7cc8('0x45')](handleError(_0x540450,null));};exports[_0x7cc8('0x46')]=function(_0x43e05c,_0x46b52a){var _0x3cbedd={'raw':!![],'where':{'id':_0x43e05c['params']['id']}},_0x5eafc5={};_0x5eafc5['model']=_[_0x7cc8('0x33')](db[_0x7cc8('0x42')][_0x7cc8('0x2c')]);_0x5eafc5[_0x7cc8('0x32')]=_[_0x7cc8('0x33')](_0x43e05c['query']);_0x5eafc5[_0x7cc8('0x3b')]=_[_0x7cc8('0x35')](_0x5eafc5['model'],_0x5eafc5[_0x7cc8('0x32')]);_0x3cbedd[_0x7cc8('0x34')]=_[_0x7cc8('0x35')](_0x5eafc5[_0x7cc8('0x30')],qs[_0x7cc8('0x36')](_0x43e05c[_0x7cc8('0x32')][_0x7cc8('0x36')]));_0x3cbedd[_0x7cc8('0x34')]=_0x3cbedd['attributes'][_0x7cc8('0x37')]?_0x3cbedd[_0x7cc8('0x34')]:_0x5eafc5[_0x7cc8('0x30')];if(_0x43e05c[_0x7cc8('0x32')][_0x7cc8('0x40')]){_0x3cbedd[_0x7cc8('0x41')]=[{'all':!![]}];}_0x3cbedd=_[_0x7cc8('0x3f')]({},_0x3cbedd,_0x43e05c['options']);return db['WhatsappTransferReport'][_0x7cc8('0x47')](_0x3cbedd)['then'](handleEntityNotFound(_0x46b52a,null))[_0x7cc8('0x26')](respondWithResult(_0x46b52a,null))['catch'](handleError(_0x46b52a,null));};exports['create']=function(_0x52bc07,_0x5cbac0){return db[_0x7cc8('0x42')][_0x7cc8('0x48')](_0x52bc07[_0x7cc8('0x49')],{})['then'](respondWithResult(_0x5cbac0,0xc9))[_0x7cc8('0x45')](handleError(_0x5cbac0,null));};exports[_0x7cc8('0x25')]=function(_0x287188,_0x83ed26){if(_0x287188[_0x7cc8('0x49')]['id']){delete _0x287188['body']['id'];}return db[_0x7cc8('0x42')][_0x7cc8('0x47')]({'where':{'id':_0x287188['params']['id']}})['then'](handleEntityNotFound(_0x83ed26,null))[_0x7cc8('0x26')](saveUpdates(_0x287188['body'],null))[_0x7cc8('0x26')](respondWithResult(_0x83ed26,null))[_0x7cc8('0x45')](handleError(_0x83ed26,null));};exports[_0x7cc8('0x27')]=function(_0x38139f,_0x4d64ba){return db['WhatsappTransferReport'][_0x7cc8('0x47')]({'where':{'id':_0x38139f[_0x7cc8('0x4a')]['id']}})[_0x7cc8('0x26')](handleEntityNotFound(_0x4d64ba,null))['then'](removeEntity(_0x4d64ba,null))[_0x7cc8('0x45')](handleError(_0x4d64ba,null));};exports[_0x7cc8('0x4b')]=function(_0x16a81d,_0x150507){return db['WhatsappTransferReport']['describe']()['then'](respondWithResult(_0x150507,null))['catch'](handleError(_0x150507,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 22599ff..bafa79e 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 _0x3376=['request-promise','path','exports','define','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3376,0x192));var _0x6337=function(_0x240026,_0x1a1cdc){_0x240026=_0x240026-0x0;var _0x19e434=_0x3376[_0x240026];return _0x19e434;};'use strict';var _=require(_0x6337('0x0'));var util=require(_0x6337('0x1'));var logger=require(_0x6337('0x2'))(_0x6337('0x3'));var moment=require(_0x6337('0x4'));var BPromise=require(_0x6337('0x5'));var rp=require(_0x6337('0x6'));var fs=require('fs');var path=require(_0x6337('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./whatsappTransferReport.attributes');module[_0x6337('0x8')]=function(_0x261edf,_0x2d7586){return _0x261edf[_0x6337('0x9')]('WhatsappTransferReport',attributes,{'tableName':_0x6337('0xa'),'paranoid':![],'indexes':[{'name':_0x6337('0xb'),'fields':[_0x6337('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xed99=['util','../../config/logger','api','moment','bluebird','request-promise','path','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0xed99,0x195));var _0x9ed9=function(_0xca95ee,_0x4ec853){_0xca95ee=_0xca95ee-0x0;var _0xe642fa=_0xed99[_0xca95ee];return _0xe642fa;};'use strict';var _=require(_0x9ed9('0x0'));var util=require(_0x9ed9('0x1'));var logger=require(_0x9ed9('0x2'))(_0x9ed9('0x3'));var moment=require(_0x9ed9('0x4'));var BPromise=require(_0x9ed9('0x5'));var rp=require(_0x9ed9('0x6'));var fs=require('fs');var path=require(_0x9ed9('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x9ed9('0x8'));module[_0x9ed9('0x9')]=function(_0x15573f,_0x3a4b75){return _0x15573f[_0x9ed9('0xa')](_0x9ed9('0xb'),attributes,{'tableName':_0x9ed9('0xc'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':[_0x9ed9('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index 01acdfb..e41d386 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 _0xca82=['randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','WhatsappTransferReport,\x20%s,\x20%s','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','bluebird'];(function(_0x567edd,_0x22c8de){var _0x5933f3=function(_0x229df9){while(--_0x229df9){_0x567edd['push'](_0x567edd['shift']());}};_0x5933f3(++_0x22c8de);}(_0xca82,0x18d));var _0x2ca8=function(_0x222472,_0x33ea87){_0x222472=_0x222472-0x0;var _0x5d601f=_0xca82[_0x222472];return _0x5d601f;};'use strict';var _=require(_0x2ca8('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x2ca8('0x1'));var rs=require(_0x2ca8('0x2'));var fs=require('fs');var Redis=require(_0x2ca8('0x3'));var db=require(_0x2ca8('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2ca8('0x5'))('rpc');var config=require(_0x2ca8('0x6'));var jayson=require(_0x2ca8('0x7'));var client=jayson[_0x2ca8('0x8')][_0x2ca8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4bb67b,_0x39a51c,_0x5f3135){return new BPromise(function(_0x10288d,_0x1f921){return client[_0x2ca8('0xa')](_0x4bb67b,_0x5f3135)['then'](function(_0x624fbc){logger[_0x2ca8('0xb')](_0x2ca8('0xc'),_0x39a51c,'request\x20sent');logger[_0x2ca8('0xd')](_0x2ca8('0xe'),_0x39a51c,'request\x20sent',JSON[_0x2ca8('0xf')](_0x624fbc));if(_0x624fbc[_0x2ca8('0x10')]){if(_0x624fbc[_0x2ca8('0x10')][_0x2ca8('0x11')]===0x1f4){logger[_0x2ca8('0x10')]('WhatsappTransferReport,\x20%s,\x20%s',_0x39a51c,_0x624fbc[_0x2ca8('0x10')]['message']);return _0x1f921(_0x624fbc[_0x2ca8('0x10')][_0x2ca8('0x12')]);}logger[_0x2ca8('0x10')](_0x2ca8('0xc'),_0x39a51c,_0x624fbc[_0x2ca8('0x10')][_0x2ca8('0x12')]);return _0x10288d(_0x624fbc[_0x2ca8('0x10')][_0x2ca8('0x12')]);}else{logger['info'](_0x2ca8('0xc'),_0x39a51c,'request\x20sent');_0x10288d(_0x624fbc[_0x2ca8('0x13')][_0x2ca8('0x12')]);}})[_0x2ca8('0x14')](function(_0x2931bd){logger['error'](_0x2ca8('0xc'),_0x39a51c,_0x2931bd);_0x1f921(_0x2931bd);});});} \ No newline at end of file +var _0xc8a0=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappTransferReport,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','moment'];(function(_0x23478e,_0x11c9ff){var _0x44a0cd=function(_0x4dae6c){while(--_0x4dae6c){_0x23478e['push'](_0x23478e['shift']());}};_0x44a0cd(++_0x11c9ff);}(_0xc8a0,0x109));var _0x0c8a=function(_0x5d7176,_0x49c591){_0x5d7176=_0x5d7176-0x0;var _0x24c157=_0xc8a0[_0x5d7176];return _0x24c157;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x0c8a('0x0'));var BPromise=require(_0x0c8a('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0c8a('0x2'));var db=require(_0x0c8a('0x3'))['db'];var utils=require(_0x0c8a('0x4'));var logger=require(_0x0c8a('0x5'))(_0x0c8a('0x6'));var config=require(_0x0c8a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x0c8a('0x8')][_0x0c8a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f3aa2,_0xc4f748,_0x302e1c){return new BPromise(function(_0x215b89,_0x3289c1){return client['request'](_0x2f3aa2,_0x302e1c)['then'](function(_0x56d66a){logger['info'](_0x0c8a('0xa'),_0xc4f748,_0x0c8a('0xb'));logger[_0x0c8a('0xc')](_0x0c8a('0xd'),_0xc4f748,_0x0c8a('0xb'),JSON['stringify'](_0x56d66a));if(_0x56d66a[_0x0c8a('0xe')]){if(_0x56d66a[_0x0c8a('0xe')][_0x0c8a('0xf')]===0x1f4){logger[_0x0c8a('0xe')](_0x0c8a('0xa'),_0xc4f748,_0x56d66a[_0x0c8a('0xe')]['message']);return _0x3289c1(_0x56d66a[_0x0c8a('0xe')][_0x0c8a('0x10')]);}logger['error'](_0x0c8a('0xa'),_0xc4f748,_0x56d66a[_0x0c8a('0xe')][_0x0c8a('0x10')]);return _0x215b89(_0x56d66a['error'][_0x0c8a('0x10')]);}else{logger[_0x0c8a('0x11')](_0x0c8a('0xa'),_0xc4f748,_0x0c8a('0xb'));_0x215b89(_0x56d66a['result']['message']);}})[_0x0c8a('0x12')](function(_0x2116f6){logger[_0x0c8a('0xe')](_0x0c8a('0xa'),_0xc4f748,_0x2116f6);_0x3289c1(_0x2116f6);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index f9f48c1..e679b2d 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbf6e=['status','None','seedDB','./config/seedDB','./config/license','catch','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','./mysqldb','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','sync','then','listen','info','start','Online\x20apps:','map','filter','online','name','join','Offline\x20apps:'];(function(_0x3e112d,_0x2bb132){var _0x531c31=function(_0x1954bc){while(--_0x1954bc){_0x3e112d['push'](_0x3e112d['shift']());}};_0x531c31(++_0x2bb132);}(_0xbf6e,0xf9));var _0xebf6=function(_0xa4486b,_0x573f1e){_0xa4486b=_0xa4486b-0x0;var _0x5dabeb=_0xbf6e[_0xa4486b];return _0x5dabeb;};'use strict';var _=require('lodash');var mysqldb=require(_0xebf6('0x0'));var rpc=require(_0xebf6('0x1'));var config=require(_0xebf6('0x2'));var logger=require(_0xebf6('0x3'))('app');var pm2=require(_0xebf6('0x4'));var pm2Config=require(_0xebf6('0x5'));var schedule=require(_0xebf6('0x6'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xebf6('0x7'));var transcribe=require(_0xebf6('0x8'));function main(){return mysqldb['db']['sequelize'][_0xebf6('0x9')]()[_0xebf6('0xa')](function(){return rpc[_0xebf6('0xb')]();})[_0xebf6('0xa')](function(_0x19faac){logger[_0xebf6('0xc')](_0x19faac);return chat[_0xebf6('0xd')]();})['then'](function(){return whatsapp[_0xebf6('0xd')]();})[_0xebf6('0xa')](function(){return schedule['start']();})[_0xebf6('0xa')](function(){return transcribe[_0xebf6('0xd')]();})[_0xebf6('0xa')](function(_0x2aa097){logger[_0xebf6('0xc')](_0x2aa097);return pm2[_0xebf6('0xd')](pm2Config);})[_0xebf6('0xa')](function(_0x59d0f1){logger[_0xebf6('0xc')](_0xebf6('0xe'),_[_0xebf6('0xf')](_[_0xebf6('0x10')](_0x59d0f1,{'status':_0xebf6('0x11')}),_0xebf6('0x12'))[_0xebf6('0x13')]());logger[_0xebf6('0xc')](_0xebf6('0x14'),_[_0xebf6('0xf')](_[_0xebf6('0x10')](_0x59d0f1,function(_0x3c1686){return _0x3c1686[_0xebf6('0x15')]!=='online';}),'name')['join']()||_0xebf6('0x16'));config[_0xebf6('0x17')]&&require(_0xebf6('0x18'))['default']();require(_0xebf6('0x19'))['default']();})[_0xebf6('0x1a')](function(_0xdb0d35){logger[_0xebf6('0x1b')](_0xebf6('0x1c'),_0xdb0d35);process[_0xebf6('0x1d')](0x1);});}main(); \ No newline at end of file +var _0xab5b=['start','Online\x20apps:','map','online','name','join','filter','status','None','seedDB','default','./config/license','catch','error','exit','lodash','./mysqldb','./rpc','./config/logger','./config/pm2/config','./config/schedule','./config/schedule/transcribe','sequelize','then','listen','info'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0xab5b,0x17b));var _0xbab5=function(_0x2ae8e6,_0xd596a0){_0x2ae8e6=_0x2ae8e6-0x0;var _0x419306=_0xab5b[_0x2ae8e6];return _0x419306;};'use strict';var _=require(_0xbab5('0x0'));var mysqldb=require(_0xbab5('0x1'));var rpc=require(_0xbab5('0x2'));var config=require('./config/environment');var logger=require(_0xbab5('0x3'))('app');var pm2=require('./config/pm2');var pm2Config=require(_0xbab5('0x4'));var schedule=require(_0xbab5('0x5'));var chat=require('./config/schedule/chat');var whatsapp=require('./config/schedule/whatsapp');var transcribe=require(_0xbab5('0x6'));function main(){return mysqldb['db'][_0xbab5('0x7')]['sync']()[_0xbab5('0x8')](function(){return rpc[_0xbab5('0x9')]();})[_0xbab5('0x8')](function(_0x3e5473){logger[_0xbab5('0xa')](_0x3e5473);return chat[_0xbab5('0xb')]();})[_0xbab5('0x8')](function(){return whatsapp[_0xbab5('0xb')]();})[_0xbab5('0x8')](function(){return schedule[_0xbab5('0xb')]();})[_0xbab5('0x8')](function(){return transcribe[_0xbab5('0xb')]();})[_0xbab5('0x8')](function(_0x1e92be){logger['info'](_0x1e92be);return pm2[_0xbab5('0xb')](pm2Config);})['then'](function(_0x141f81){logger[_0xbab5('0xa')](_0xbab5('0xc'),_[_0xbab5('0xd')](_['filter'](_0x141f81,{'status':_0xbab5('0xe')}),_0xbab5('0xf'))[_0xbab5('0x10')]());logger[_0xbab5('0xa')]('Offline\x20apps:',_['map'](_[_0xbab5('0x11')](_0x141f81,function(_0x3b5d53){return _0x3b5d53[_0xbab5('0x12')]!==_0xbab5('0xe');}),_0xbab5('0xf'))[_0xbab5('0x10')]()||_0xbab5('0x13'));config[_0xbab5('0x14')]&&require('./config/seedDB')[_0xbab5('0x15')]();require(_0xbab5('0x16'))[_0xbab5('0x15')]();})[_0xbab5('0x17')](function(_0x371d8a){logger[_0xbab5('0x18')]('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x371d8a);process[_0xbab5('0x19')](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index 652003d..430be47 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 _0xab73=['hex','floor','now','../../mysqldb','../../config/license/hardware','../encryptor','lodash','express-jwt','crypto','bluebird','util','moment','secrets','role','name','internal','email','userpic','permissions','md5secret','voicePause','mailPause','smsPause','pauseType','showWebBar','lastLoginAt','allowmessenger','phoneBarAutoAnswer','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','ChatInteraction','findOne','params','closed','disposition','then','unmanaged','json','Unmanaged.','Forbidden.','catch','headers','authorization','Basic','User','find','authenticate','pass','status','Wrong\x20credentials.','user','startsWith','Bearer','query','apikey','getUuid','allowedLoginAttempts','blockDuration','apiKeyNonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','add','minutes','Unknown\x20authorization\x20format','User\x20object\x20not\x20found.','canUpdate','update','Forbidden','isMiddleware','signToken','setTokenCookie','cookie','motion.token','redirect','/dashboards/general','send','retrieveApiKey','isNil','apiKeyIat','generateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','updatePasswordsHistory','length','splice','encryptString','sign','secret','session','payload','options','promisify','verify','randomBytes','toString'];(function(_0x55cbb6,_0x3e6663){var _0x3ef83a=function(_0x4a6f9e){while(--_0x4a6f9e){_0x55cbb6['push'](_0x55cbb6['shift']());}};_0x3ef83a(++_0x3e6663);}(_0xab73,0x1df));var _0x3ab7=function(_0x3beb1f,_0x48a47f){_0x3beb1f=_0x3beb1f-0x0;var _0x56a76a=_0xab73[_0x3beb1f];return _0x56a76a;};'use strict';var db=require(_0x3ab7('0x0'))['db'];var config=require('../../config/environment');var hardwareConf=require(_0x3ab7('0x1'));var licenseUtil=require('../../config/license/util');var encryptor=require(_0x3ab7('0x2'));var _=require(_0x3ab7('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0x3ab7('0x4'));var compose=require('composable-middleware');var basicAuth=require('basic-auth');var crypto=require(_0x3ab7('0x5'));var BPromise=require(_0x3ab7('0x6'));var util=require(_0x3ab7('0x7'));var moment=require(_0x3ab7('0x8'));var validateJwt=expressJwt({'secret':config[_0x3ab7('0x9')]['session']});var userAttributes=['id',_0x3ab7('0xa'),'fullname',_0x3ab7('0xb'),_0x3ab7('0xc'),_0x3ab7('0xd'),_0x3ab7('0xe'),_0x3ab7('0xf'),_0x3ab7('0x10'),_0x3ab7('0x11'),'chatPause',_0x3ab7('0x12'),'faxPause',_0x3ab7('0x13'),'openchannelPause',_0x3ab7('0x14'),_0x3ab7('0x15'),_0x3ab7('0x16'),'lastPauseAt','crudPermissions',_0x3ab7('0x17'),'passwordResetAt','alias',_0x3ab7('0x18'),'phoneBarAutoAnswerDelay',_0x3ab7('0x19'),_0x3ab7('0x1a'),_0x3ab7('0x1b'),_0x3ab7('0x1c'),_0x3ab7('0x1d'),'phoneBarPrefixRequired',_0x3ab7('0x1e'),_0x3ab7('0x1f'),_0x3ab7('0x20'),'interface','userProfileId',_0x3ab7('0x21'),'settingsEnabled',_0x3ab7('0x22'),_0x3ab7('0x23'),_0x3ab7('0x24'),_0x3ab7('0x25')];exports[_0x3ab7('0x26')]=function(){return this[_0x3ab7('0x27')](!![])[_0x3ab7('0x28')](function(_0x2fcc88,_0x54778f,_0x353d73){if(_0x2fcc88['user']){_0x353d73();}else{return db[_0x3ab7('0x29')][_0x3ab7('0x2a')]({'where':{'id':_0x2fcc88[_0x3ab7('0x2b')]['id']},'attributes':['id',_0x3ab7('0x2c'),_0x3ab7('0x2d')],'raw':!![]})[_0x3ab7('0x2e')](function(_0x18840e){if(_0x18840e&&_0x18840e[_0x3ab7('0x2c')]){return _0x54778f['status'](_0x18840e[_0x3ab7('0x2d')]===_0x3ab7('0x2f')?0x195:0x193)[_0x3ab7('0x30')]({'message':_0x18840e[_0x3ab7('0x2d')]==='unmanaged'?_0x3ab7('0x31'):_0x3ab7('0x32')});}else{_0x353d73();}})[_0x3ab7('0x33')](function(_0x2e10aa){_0x353d73(_0x2e10aa);});}});};exports[_0x3ab7('0x27')]=function isAuthenticated(_0x215a97){return compose()['use'](function(_0x3e8e45,_0x6e0f9b,_0x328f81){var _0x23bdc8;if(_0x3e8e45[_0x3ab7('0x34')][_0x3ab7('0x35')]){if(_['startsWith'](_0x3e8e45['headers'][_0x3ab7('0x35')],_0x3ab7('0x36'))){var _0x447583=basicAuth(_0x3e8e45);db[_0x3ab7('0x37')][_0x3ab7('0x38')]({'where':{'name':_0x447583['name']}})['then'](function(_0x2a63eb){if(!_0x2a63eb||!_0x2a63eb[_0x3ab7('0x39')](_0x447583[_0x3ab7('0x3a')])){return _0x6e0f9b[_0x3ab7('0x3b')](0x191)['json']({'message':_0x3ab7('0x3c')});}_0x3e8e45[_0x3ab7('0x3d')]={'id':_0x2a63eb['id']};_0x328f81();})[_0x3ab7('0x33')](function(_0x4920ba){_0x328f81(_0x4920ba);});}else if(_[_0x3ab7('0x3e')](_0x3e8e45[_0x3ab7('0x34')][_0x3ab7('0x35')],_0x3ab7('0x3f'))){validateJwt(_0x3e8e45,_0x6e0f9b,_0x328f81);}else{if(_0x215a97){_0x328f81();}else{return _0x6e0f9b['status'](0x193)['json']({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x3e8e45[_0x3ab7('0x40')][_0x3ab7('0x41')]){try{var _0x42570c={'audience':hardwareConf[_0x3ab7('0x42')](),'issuer':hardwareConf[_0x3ab7('0x42')]()};verifyJwt(_0x3e8e45['query']['apikey'],_0x42570c)[_0x3ab7('0x2e')](function(_0x14ca91){return db[_0x3ab7('0x37')]['find']({'where':{'id':_0x14ca91['sub']}})['then'](function(_0x42d72b){_0x23bdc8=_0x42d72b;return db['Setting'][_0x3ab7('0x2a')]({'where':{'id':0x1},'attributes':[_0x3ab7('0x43'),_0x3ab7('0x44')],'raw':!![]});})[_0x3ab7('0x2e')](function(_0x1d6dff){if(!_0x23bdc8||!_['isEqual'](_0x23bdc8[_0x3ab7('0x45')],_0x14ca91['nonce'])){return _0x6e0f9b[_0x3ab7('0x3b')](0x191)[_0x3ab7('0x30')]({'message':_0x3ab7('0x46')});}if(_0x23bdc8[_0x3ab7('0x47')]){return _0x6e0f9b[_0x3ab7('0x3b')](0x191)[_0x3ab7('0x30')]({'message':_0x3ab7('0x48')});}if(_0x23bdc8['blocked']){if(_0x1d6dff[_0x3ab7('0x44')]>0x0){if(moment(_0x23bdc8[_0x3ab7('0x49')])[_0x3ab7('0x4a')](_0x1d6dff[_0x3ab7('0x44')],_0x3ab7('0x4b'))>moment()){return _0x6e0f9b[_0x3ab7('0x3b')](0x191)[_0x3ab7('0x30')]({'message':_0x3ab7('0x48')});}}else{return _0x6e0f9b[_0x3ab7('0x3b')](0x191)[_0x3ab7('0x30')]({'message':_0x3ab7('0x48')});}}_0x3e8e45[_0x3ab7('0x3d')]={'id':_0x23bdc8['id']};_0x328f81();});})[_0x3ab7('0x33')](function(){return _0x6e0f9b[_0x3ab7('0x3b')](0x191)[_0x3ab7('0x30')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x4aa25d){_0x328f81(_0x4aa25d);}}else if(_0x215a97){_0x328f81();}else{return _0x6e0f9b[_0x3ab7('0x3b')](0x193)['json']({'message':_0x3ab7('0x4c')});}})['use'](function(_0x340322,_0x802aa3,_0x222c07){if(_0x340322[_0x3ab7('0x3d')]){db['User'][_0x3ab7('0x38')]({'where':{'id':_0x340322[_0x3ab7('0x3d')]['id']},'attributes':userAttributes})['then'](function(_0x5e1348){if(!_0x5e1348){return _0x802aa3[_0x3ab7('0x3b')](0x194)[_0x3ab7('0x30')]({'message':'User\x20not\x20found.'});}_0x340322['user']=_0x5e1348;_0x222c07();})['catch'](function(_0x3c8d9f){_0x222c07(_0x3c8d9f);});}else if(_0x215a97){_0x222c07();}else{return _0x802aa3[_0x3ab7('0x3b')](0x194)[_0x3ab7('0x30')]({'message':_0x3ab7('0x4d')});}});};exports[_0x3ab7('0x4e')]=function canUpdate(){return compose()[_0x3ab7('0x28')](function(_0x31a429,_0x5b9555,_0x298a92){return licenseUtil['getLicense']()['then'](function(_0x3f67c1){if(_0x3f67c1[_0x3ab7('0x4f')]){_0x298a92();}else{return _0x5b9555['status'](0x193)[_0x3ab7('0x30')]({'message':_0x3ab7('0x50')});}})[_0x3ab7('0x33')](function(_0x364954){_0x298a92(_0x364954);});});};exports[_0x3ab7('0x51')]=function(_0xeeb945,_0x4c7363,_0x42fc9c){_0xeeb945[_0x3ab7('0x51')]=!![];return _0x42fc9c();};exports[_0x3ab7('0x52')]=function signToken(_0x13287f){return signJwt(_0x13287f);};exports[_0x3ab7('0x53')]=function(_0x1c299d,_0x475861){if(!_0x1c299d['user']){return _0x475861[_0x3ab7('0x3b')](0x194)[_0x3ab7('0x30')]({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4cc6c1={'payload':{'id':_0x1c299d['user']['id'],'role':_0x1c299d[_0x3ab7('0x3d')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4cc6c1)[_0x3ab7('0x2e')](function(_0x4b307b){_0x475861[_0x3ab7('0x54')](_0x3ab7('0x55'),_0x4b307b);_0x475861[_0x3ab7('0x56')](_0x3ab7('0x57'));})[_0x3ab7('0x33')](function(_0x4ddfd2){return _0x475861[_0x3ab7('0x3b')](0x1f4)[_0x3ab7('0x58')](_0x4ddfd2);});};exports[_0x3ab7('0x59')]=function(_0x2caa8c){if(_[_0x3ab7('0x5a')](_0x2caa8c[_0x3ab7('0x45')])||_[_0x3ab7('0x5a')](_0x2caa8c[_0x3ab7('0x5b')])){return null;}else{return createJwt(_0x2caa8c);}};exports[_0x3ab7('0x5c')]=function(_0x2b44dc){_0x2b44dc[_0x3ab7('0x45')]=generateNonce();_0x2b44dc[_0x3ab7('0x5b')]=generateIssuedAt();return createJwt(_0x2b44dc);};exports['regenerateApiKey']=function(_0x4f1a0b,_0xcfe1e0){var _0x211a71=_0x4f1a0b[_0x3ab7('0x40')][_0x3ab7('0x41')];if(_0x211a71){var _0x4dc620={'nonce':_0xcfe1e0['apiKeyNonce'],'iat':_0xcfe1e0[_0x3ab7('0x5b')],'audience':hardwareConf[_0x3ab7('0x42')](),'issuer':hardwareConf[_0x3ab7('0x42')]()};return verifyJwt(_0x211a71,_0x4dc620)[_0x3ab7('0x2e')](function(){return generateApiKey(_0xcfe1e0);});}else{throw{'message':_0x3ab7('0x5d')};}};exports[_0x3ab7('0x5e')]=function(_0x8a3b5){var _0x987946=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x987946[_0x3ab7('0x5f')](_0x8a3b5))throw new db[(_0x3ab7('0x60'))][(_0x3ab7('0x61'))]('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[_0x3ab7('0x62')]=function(_0x6e4e5f,_0x434f96,_0x5b960b){var _0x59940f=encryptor[_0x3ab7('0x63')](_0x434f96)[_0x3ab7('0x64')](',');for(var _0x167b60=0x0;_0x167b60<_0x5b960b;_0x167b60++){if(!_0x59940f[_0x167b60])break;if(_0x6e4e5f[_0x3ab7('0x65')]()===_0x59940f[_0x167b60]['toLowerCase']()){var _0x53c565=util['format']('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x5b960b);if(_0x5b960b===0x1){_0x53c565=_0x3ab7('0x66');}throw new db[(_0x3ab7('0x60'))][(_0x3ab7('0x61'))](_0x53c565);}}return;};exports[_0x3ab7('0x67')]=function(_0x5491d5,_0x56e213){var _0x3f0a94=_0x56e213?encryptor[_0x3ab7('0x63')](_0x56e213)[_0x3ab7('0x64')](','):[];if(_0x3f0a94[_0x3ab7('0x68')]===0x5){_0x3f0a94[_0x3ab7('0x69')](-0x1,0x1);}_0x3f0a94['unshift'](_0x5491d5);return encryptor[_0x3ab7('0x6a')](_0x3f0a94['join'](','));};function signJwt(_0x3b6aa6){var _0x56a290=BPromise['promisify'](jwt[_0x3ab7('0x6b')],{'context':jwt});var _0x24e8e1=_0x3b6aa6[_0x3ab7('0x6c')]||config[_0x3ab7('0x9')][_0x3ab7('0x6d')];return new BPromise(function(_0x554930,_0x45e4e9){_0x56a290(_0x3b6aa6[_0x3ab7('0x6e')],_0x24e8e1,_0x3b6aa6[_0x3ab7('0x6f')])[_0x3ab7('0x2e')](function(_0x89b2ca){_0x554930(_0x89b2ca);})[_0x3ab7('0x33')](function(_0x9e6ebb){_0x45e4e9(_0x9e6ebb);});});}function verifyJwt(_0x27cb37,_0x4ca207,_0x4563a6){var _0x3687ea=BPromise[_0x3ab7('0x70')](jwt[_0x3ab7('0x71')],{'context':jwt});var _0x36e7e4=_0x4563a6||config[_0x3ab7('0x9')][_0x3ab7('0x6d')];return new BPromise(function(_0x585c59,_0x142cb0){_0x3687ea(_0x27cb37,_0x36e7e4,_0x4ca207)[_0x3ab7('0x2e')](function(_0x428b69){_0x585c59(_0x428b69);})[_0x3ab7('0x33')](function(_0x5042ba){_0x142cb0(_0x5042ba);});});}function generateNonce(){return crypto[_0x3ab7('0x72')](0x10)[_0x3ab7('0x73')](_0x3ab7('0x74'));}function generateIssuedAt(){return Math[_0x3ab7('0x75')](Date[_0x3ab7('0x76')]()/0x3e8)[_0x3ab7('0x73')]();}function createJwt(_0x4ae6ef){var _0xb01752={'payload':{'iat':_0x4ae6ef[_0x3ab7('0x5b')],'nonce':_0x4ae6ef[_0x3ab7('0x45')]},'options':{'algorithm':'HS512','subject':_0x4ae6ef['id'][_0x3ab7('0x73')](),'issuer':hardwareConf['getUuid'](),'audience':hardwareConf[_0x3ab7('0x42')]()}};return signJwt(_0xb01752)[_0x3ab7('0x2e')](function(_0x1e811b){return{'iat':_0x4ae6ef[_0x3ab7('0x5b')],'nonce':_0x4ae6ef[_0x3ab7('0x45')],'token':_0x1e811b};});} \ No newline at end of file +var _0x550b=['User','authenticate','status','Wrong\x20credentials.','startsWith','Bearer','Unknown\x20authorization\x20format','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','nonce','disabled','blocked','blockDuration','blockedAt','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','canUpdate','update','isMiddleware','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','cookie','motion.token','send','retrieveApiKey','apiKeyNonce','isNil','apiKeyIat','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one','validatePasswordPattern','test','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.','Sequelize','updatePasswordsHistory','length','splice','unshift','encryptString','join','promisify','sign','secret','randomBytes','toString','now','HS512','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','express-jwt','composable-middleware','crypto','bluebird','util','moment','secrets','session','role','fullname','name','internal','userpic','permissions','md5secret','voicePause','chatPause','smsPause','openchannelPause','pauseType','lastPauseAt','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','settingsEnabled','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','closed','disposition','then','unmanaged','json','catch','authorization','Basic'];(function(_0x5c54bf,_0x46b2fe){var _0x4d9cec=function(_0x10dbfa){while(--_0x10dbfa){_0x5c54bf['push'](_0x5c54bf['shift']());}};_0x4d9cec(++_0x46b2fe);}(_0x550b,0xb0));var _0xb550=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0x550b[_0x101e7b];return _0x4995c0;};'use strict';var db=require('../../mysqldb')['db'];var config=require(_0xb550('0x0'));var hardwareConf=require(_0xb550('0x1'));var licenseUtil=require(_0xb550('0x2'));var encryptor=require('../encryptor');var _=require(_0xb550('0x3'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xb550('0x4'));var compose=require(_0xb550('0x5'));var basicAuth=require('basic-auth');var crypto=require(_0xb550('0x6'));var BPromise=require(_0xb550('0x7'));var util=require(_0xb550('0x8'));var moment=require(_0xb550('0x9'));var validateJwt=expressJwt({'secret':config[_0xb550('0xa')][_0xb550('0xb')]});var userAttributes=['id',_0xb550('0xc'),_0xb550('0xd'),_0xb550('0xe'),_0xb550('0xf'),'email',_0xb550('0x10'),_0xb550('0x11'),_0xb550('0x12'),_0xb550('0x13'),_0xb550('0x14'),'mailPause','faxPause',_0xb550('0x15'),_0xb550('0x16'),_0xb550('0x17'),'showWebBar','lastLoginAt',_0xb550('0x18'),'crudPermissions',_0xb550('0x19'),_0xb550('0x1a'),'alias',_0xb550('0x1b'),_0xb550('0x1c'),_0xb550('0x1d'),_0xb550('0x1e'),_0xb550('0x1f'),'phoneBarEnableSettings',_0xb550('0x20'),_0xb550('0x21'),_0xb550('0x22'),_0xb550('0x23'),_0xb550('0x24'),_0xb550('0x25'),_0xb550('0x26'),_0xb550('0x27'),_0xb550('0x28'),'wssPort',_0xb550('0x29'),_0xb550('0x2a'),_0xb550('0x2b')];exports[_0xb550('0x2c')]=function(){return this[_0xb550('0x2d')](!![])[_0xb550('0x2e')](function(_0x52e795,_0x2c0b83,_0x8a0cc7){if(_0x52e795[_0xb550('0x2f')]){_0x8a0cc7();}else{return db[_0xb550('0x30')][_0xb550('0x31')]({'where':{'id':_0x52e795['params']['id']},'attributes':['id',_0xb550('0x32'),_0xb550('0x33')],'raw':!![]})[_0xb550('0x34')](function(_0xae4b7){if(_0xae4b7&&_0xae4b7[_0xb550('0x32')]){return _0x2c0b83['status'](_0xae4b7[_0xb550('0x33')]===_0xb550('0x35')?0x195:0x193)[_0xb550('0x36')]({'message':_0xae4b7[_0xb550('0x33')]===_0xb550('0x35')?'Unmanaged.':'Forbidden.'});}else{_0x8a0cc7();}})[_0xb550('0x37')](function(_0x142589){_0x8a0cc7(_0x142589);});}});};exports['isAuthenticated']=function isAuthenticated(_0x40828b){return compose()[_0xb550('0x2e')](function(_0x59f535,_0x4a1170,_0x584c8f){var _0x1a574a;if(_0x59f535['headers'][_0xb550('0x38')]){if(_['startsWith'](_0x59f535['headers'][_0xb550('0x38')],_0xb550('0x39'))){var _0x57a3e3=basicAuth(_0x59f535);db[_0xb550('0x3a')]['find']({'where':{'name':_0x57a3e3[_0xb550('0xe')]}})[_0xb550('0x34')](function(_0x3b222e){if(!_0x3b222e||!_0x3b222e[_0xb550('0x3b')](_0x57a3e3['pass'])){return _0x4a1170[_0xb550('0x3c')](0x191)[_0xb550('0x36')]({'message':_0xb550('0x3d')});}_0x59f535[_0xb550('0x2f')]={'id':_0x3b222e['id']};_0x584c8f();})[_0xb550('0x37')](function(_0x26e3ca){_0x584c8f(_0x26e3ca);});}else if(_[_0xb550('0x3e')](_0x59f535['headers'][_0xb550('0x38')],_0xb550('0x3f'))){validateJwt(_0x59f535,_0x4a1170,_0x584c8f);}else{if(_0x40828b){_0x584c8f();}else{return _0x4a1170[_0xb550('0x3c')](0x193)[_0xb550('0x36')]({'message':_0xb550('0x40')});}}}else if(_0x59f535[_0xb550('0x41')][_0xb550('0x42')]){try{var _0x32ea4a={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xb550('0x43')]()};verifyJwt(_0x59f535[_0xb550('0x41')][_0xb550('0x42')],_0x32ea4a)[_0xb550('0x34')](function(_0x5b16d0){return db[_0xb550('0x3a')][_0xb550('0x44')]({'where':{'id':_0x5b16d0[_0xb550('0x45')]}})[_0xb550('0x34')](function(_0x863c2d){_0x1a574a=_0x863c2d;return db['Setting'][_0xb550('0x31')]({'where':{'id':0x1},'attributes':[_0xb550('0x46'),'blockDuration'],'raw':!![]});})['then'](function(_0x9e5460){if(!_0x1a574a||!_[_0xb550('0x47')](_0x1a574a['apiKeyNonce'],_0x5b16d0[_0xb550('0x48')])){return _0x4a1170[_0xb550('0x3c')](0x191)['json']({'message':'API\x20access\x20key\x20is\x20not\x20valid\x20anymore'});}if(_0x1a574a[_0xb550('0x49')]){return _0x4a1170[_0xb550('0x3c')](0x191)[_0xb550('0x36')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1a574a[_0xb550('0x4a')]){if(_0x9e5460[_0xb550('0x4b')]>0x0){if(moment(_0x1a574a[_0xb550('0x4c')])['add'](_0x9e5460[_0xb550('0x4b')],_0xb550('0x4d'))>moment()){return _0x4a1170[_0xb550('0x3c')](0x191)[_0xb550('0x36')]({'message':'Invalid\x20API\x20access\x20key'});}}else{return _0x4a1170[_0xb550('0x3c')](0x191)['json']({'message':_0xb550('0x4e')});}}_0x59f535[_0xb550('0x2f')]={'id':_0x1a574a['id']};_0x584c8f();});})[_0xb550('0x37')](function(){return _0x4a1170[_0xb550('0x3c')](0x191)[_0xb550('0x36')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x4b5f8e){_0x584c8f(_0x4b5f8e);}}else if(_0x40828b){_0x584c8f();}else{return _0x4a1170[_0xb550('0x3c')](0x193)[_0xb550('0x36')]({'message':_0xb550('0x40')});}})['use'](function(_0x43c44b,_0x34e892,_0x1898d4){if(_0x43c44b[_0xb550('0x2f')]){db[_0xb550('0x3a')][_0xb550('0x44')]({'where':{'id':_0x43c44b[_0xb550('0x2f')]['id']},'attributes':userAttributes})[_0xb550('0x34')](function(_0x555c4c){if(!_0x555c4c){return _0x34e892[_0xb550('0x3c')](0x194)[_0xb550('0x36')]({'message':_0xb550('0x4f')});}_0x43c44b[_0xb550('0x2f')]=_0x555c4c;_0x1898d4();})['catch'](function(_0x2c4dea){_0x1898d4(_0x2c4dea);});}else if(_0x40828b){_0x1898d4();}else{return _0x34e892['status'](0x194)[_0xb550('0x36')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0xb550('0x50')]=function canUpdate(){return compose()[_0xb550('0x2e')](function(_0x399097,_0x586624,_0x147135){return licenseUtil['getLicense']()[_0xb550('0x34')](function(_0x3e1505){if(_0x3e1505[_0xb550('0x51')]){_0x147135();}else{return _0x586624[_0xb550('0x3c')](0x193)['json']({'message':'Forbidden'});}})[_0xb550('0x37')](function(_0x9b2cf0){_0x147135(_0x9b2cf0);});});};exports['isMiddleware']=function(_0x4cd53a,_0x4d554d,_0x11cada){_0x4cd53a[_0xb550('0x52')]=!![];return _0x11cada();};exports['signToken']=function signToken(_0x234c3a){return signJwt(_0x234c3a);};exports['setTokenCookie']=function(_0x218641,_0x5374af){if(!_0x218641[_0xb550('0x2f')]){return _0x5374af[_0xb550('0x3c')](0x194)['json']({'message':_0xb550('0x53')});}var _0x34c66d={'payload':{'id':_0x218641[_0xb550('0x2f')]['id'],'role':_0x218641['user']['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x34c66d)[_0xb550('0x34')](function(_0x446005){_0x5374af[_0xb550('0x54')](_0xb550('0x55'),_0x446005);_0x5374af['redirect']('/dashboards/general');})[_0xb550('0x37')](function(_0x7cb0de){return _0x5374af[_0xb550('0x3c')](0x1f4)[_0xb550('0x56')](_0x7cb0de);});};exports[_0xb550('0x57')]=function(_0x1f623a){if(_['isNil'](_0x1f623a[_0xb550('0x58')])||_[_0xb550('0x59')](_0x1f623a[_0xb550('0x5a')])){return null;}else{return createJwt(_0x1f623a);}};exports['generateApiKey']=function(_0x5c53f4){_0x5c53f4[_0xb550('0x58')]=generateNonce();_0x5c53f4[_0xb550('0x5a')]=generateIssuedAt();return createJwt(_0x5c53f4);};exports[_0xb550('0x5b')]=function(_0x1fbb42,_0x1776c0){var _0x4c337a=_0x1fbb42[_0xb550('0x41')]['apikey'];if(_0x4c337a){var _0x32252e={'nonce':_0x1776c0[_0xb550('0x58')],'iat':_0x1776c0[_0xb550('0x5a')],'audience':hardwareConf[_0xb550('0x43')](),'issuer':hardwareConf[_0xb550('0x43')]()};return verifyJwt(_0x4c337a,_0x32252e)[_0xb550('0x34')](function(){return generateApiKey(_0x1776c0);});}else{throw{'message':_0xb550('0x5c')};}};exports[_0xb550('0x5d')]=function(_0x7ac12){var _0x474d6b=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x474d6b[_0xb550('0x5e')](_0x7ac12))throw new db['Sequelize'][(_0xb550('0x5f'))](_0xb550('0x60'));return;};exports[_0xb550('0x61')]=function(_0x14add5,_0x54e5f1,_0x337028){var _0x5927ef=encryptor[_0xb550('0x62')](_0x54e5f1)[_0xb550('0x63')](',');for(var _0x277d56=0x0;_0x277d56<_0x337028;_0x277d56++){if(!_0x5927ef[_0x277d56])break;if(_0x14add5[_0xb550('0x64')]()===_0x5927ef[_0x277d56][_0xb550('0x64')]()){var _0x5913ed=util[_0xb550('0x65')](_0xb550('0x66'),_0x337028);if(_0x337028===0x1){_0x5913ed='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xb550('0x67'))]['ValidationError'](_0x5913ed);}}return;};exports[_0xb550('0x68')]=function(_0x26bbd4,_0x29803b){var _0x440389=_0x29803b?encryptor[_0xb550('0x62')](_0x29803b)[_0xb550('0x63')](','):[];if(_0x440389[_0xb550('0x69')]===0x5){_0x440389[_0xb550('0x6a')](-0x1,0x1);}_0x440389[_0xb550('0x6b')](_0x26bbd4);return encryptor[_0xb550('0x6c')](_0x440389[_0xb550('0x6d')](','));};function signJwt(_0x2f1a03){var _0x3dd931=BPromise[_0xb550('0x6e')](jwt[_0xb550('0x6f')],{'context':jwt});var _0x2b33cf=_0x2f1a03[_0xb550('0x70')]||config['secrets'][_0xb550('0xb')];return new BPromise(function(_0x4e9764,_0x27d4e2){_0x3dd931(_0x2f1a03['payload'],_0x2b33cf,_0x2f1a03['options'])[_0xb550('0x34')](function(_0x23849b){_0x4e9764(_0x23849b);})[_0xb550('0x37')](function(_0x37d78f){_0x27d4e2(_0x37d78f);});});}function verifyJwt(_0x218c99,_0x3e41a8,_0x2a5c8f){var _0x37a680=BPromise[_0xb550('0x6e')](jwt['verify'],{'context':jwt});var _0x335ba4=_0x2a5c8f||config[_0xb550('0xa')]['session'];return new BPromise(function(_0x43ad9a,_0x10cd51){_0x37a680(_0x218c99,_0x335ba4,_0x3e41a8)[_0xb550('0x34')](function(_0x328c8d){_0x43ad9a(_0x328c8d);})[_0xb550('0x37')](function(_0x4c9dbe){_0x10cd51(_0x4c9dbe);});});}function generateNonce(){return crypto[_0xb550('0x71')](0x10)[_0xb550('0x72')]('hex');}function generateIssuedAt(){return Math['floor'](Date[_0xb550('0x73')]()/0x3e8)['toString']();}function createJwt(_0x88f9d5){var _0x16091d={'payload':{'iat':_0x88f9d5[_0xb550('0x5a')],'nonce':_0x88f9d5[_0xb550('0x58')]},'options':{'algorithm':_0xb550('0x74'),'subject':_0x88f9d5['id']['toString'](),'issuer':hardwareConf[_0xb550('0x43')](),'audience':hardwareConf[_0xb550('0x43')]()}};return signJwt(_0x16091d)[_0xb550('0x34')](function(_0x12d6c9){return{'iat':_0x88f9d5[_0xb550('0x5a')],'nonce':_0x88f9d5['apiKeyNonce'],'token':_0x12d6c9};});} \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 2225f68..b4a471b 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 _0x46e1=['decryptFile','createWriteStream','createDecipher','update','write','encryptString','utf8','secret','base64','bluebird','../../config/logger','app','secrets','session','aes192','encrypt','algorithm','join','error','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','getCiphers','filter','hasOwnProperty','encryptFile','createReadStream','createCipher','data','binary','final','end','close','unlink'];(function(_0x47063a,_0x5f08f1){var _0x28863c=function(_0x4ab6d4){while(--_0x4ab6d4){_0x47063a['push'](_0x47063a['shift']());}};_0x28863c(++_0x5f08f1);}(_0x46e1,0x1e9));var _0x146e=function(_0x977256,_0x1d678c){_0x977256=_0x977256-0x0;var _0x8bebaf=_0x46e1[_0x977256];return _0x8bebaf;};'use strict';var crypto=require('crypto');var fs=require('fs');var BPromise=require(_0x146e('0x0'));var _=require('lodash');var config=require('../../config/environment');var logger=require(_0x146e('0x1'))(_0x146e('0x2'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x146e('0x3')][_0x146e('0x4')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x146e('0x5')};if(config[_0x146e('0x6')]&&config['encrypt'][_0x146e('0x7')]){var isSupported=isAlgorithmSupported(config[_0x146e('0x6')][_0x146e('0x7')]);if(isSupported){fileOptions['algorithm']=config[_0x146e('0x6')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x146e('0x8')](',\x20');logger[_0x146e('0x9')](config[_0x146e('0x6')][_0x146e('0x7')],_0x146e('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x4ae5e6){return AES_SUPPORTED_RX['test'](_0x4ae5e6);}function getSupportedCiphers(){return crypto[_0x146e('0xb')]()[_0x146e('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x23704d){return getSupportedCiphers()['indexOf'](_0x23704d)>-0x1;}function combineOptions(_0x28b137){var _0x55274d={};for(var _0x2a486e in fileOptions){if(fileOptions[_0x146e('0xd')](_0x2a486e)){_0x55274d[_0x2a486e]=fileOptions[_0x2a486e];}}if(_0x28b137){for(var _0x638aaa in _0x28b137){if(_0x28b137['hasOwnProperty'](_0x638aaa)){_0x55274d[_0x638aaa]=_0x28b137[_0x638aaa];}}}return _0x55274d;}exports[_0x146e('0xe')]=function(_0x29794c,_0x49d0c7,_0x109782,_0x28fa44){return new BPromise(function(_0x7b2aff,_0x2d87c3){_0x28fa44=combineOptions(_0x28fa44);var _0x75710f=new Buffer(_0x109782);var _0xc010ce=fs[_0x146e('0xf')](_0x29794c);var _0x24ecea=fs['createWriteStream'](_0x49d0c7);var _0x5d1da1=crypto[_0x146e('0x10')](_0x28fa44[_0x146e('0x7')],_0x75710f);_0xc010ce['on'](_0x146e('0x11'),function(_0x477e5f){var _0x503d6e=new Buffer(_0x5d1da1['update'](_0x477e5f),_0x146e('0x12'));_0x24ecea['write'](_0x503d6e);});_0xc010ce['on']('end',function(){try{var _0x33e4e3=new Buffer(_0x5d1da1[_0x146e('0x13')]('binary'),'binary');_0x24ecea['write'](_0x33e4e3);_0x24ecea[_0x146e('0x14')]();_0x24ecea['on'](_0x146e('0x15'),function(){return _0x7b2aff(_0x49d0c7);});}catch(_0xa9f7){fs[_0x146e('0x16')](_0x49d0c7);return _0x2d87c3(_0xa9f7);}});});};exports[_0x146e('0x17')]=function(_0x3f1f26,_0x26d92e,_0x1a141e,_0x25f8a5){return new BPromise(function(_0x452a6a,_0x3e89b4){_0x25f8a5=combineOptions(_0x25f8a5);var _0x4f5749=new Buffer(_0x1a141e);var _0x1a6438=fs[_0x146e('0xf')](_0x3f1f26);var _0x39cf61=fs[_0x146e('0x18')](_0x26d92e);var _0x2ae9c3=crypto[_0x146e('0x19')](_0x25f8a5[_0x146e('0x7')],_0x4f5749);_0x1a6438['on'](_0x146e('0x11'),function(_0x2dbda6){var _0x4ea8de=new Buffer(_0x2ae9c3[_0x146e('0x1a')](_0x2dbda6),_0x146e('0x12'));_0x39cf61[_0x146e('0x1b')](_0x4ea8de);});_0x1a6438['on'](_0x146e('0x14'),function(){try{var _0x483014=new Buffer(_0x2ae9c3[_0x146e('0x13')](_0x146e('0x12')),_0x146e('0x12'));_0x39cf61[_0x146e('0x1b')](_0x483014);_0x39cf61[_0x146e('0x14')]();_0x39cf61['on'](_0x146e('0x15'),function(){return _0x452a6a(_0x26d92e);});}catch(_0x582e64){fs['unlink'](_0x26d92e);return _0x3e89b4(_0x582e64);}});});};exports[_0x146e('0x1c')]=function(_0x11441a,_0x764832,_0x130100){var _0x3238cb=_0x130100||stringOptions[_0x146e('0x7')];var _0x4d625a=_0x764832||stringOptions['secret'];var _0x146ced=crypto['createCipher'](_0x3238cb,_0x4d625a);var _0xba354f=_0x146ced[_0x146e('0x1a')](_0x11441a,_0x146e('0x1d'),'base64');_0xba354f+=_0x146ced['final']('base64');return _0xba354f;};exports['decryptString']=function(_0x20366b,_0x212a2f,_0x2de162){var _0x4e7272=_0x2de162||stringOptions[_0x146e('0x7')];var _0x289b35=_0x212a2f||stringOptions[_0x146e('0x1e')];var _0xf95496=crypto[_0x146e('0x19')](_0x4e7272,_0x289b35);var _0x127c9c=_0xf95496[_0x146e('0x1a')](_0x20366b,_0x146e('0x1f'),_0x146e('0x1d'));_0x127c9c+=_0xf95496[_0x146e('0x13')](_0x146e('0x1d'));return _0x127c9c;}; \ No newline at end of file +var _0x2485=['final','encryptString','secret','utf8','base64','decryptString','createDecipher','crypto','lodash','../../config/environment','../../config/logger','app','secrets','aes-256-ctr','aes192','encrypt','algorithm','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','createCipher','data','update','binary','write','end','close','unlink','decryptFile'];(function(_0x4ccff5,_0x316fd1){var _0x57adb0=function(_0xf984d0){while(--_0xf984d0){_0x4ccff5['push'](_0x4ccff5['shift']());}};_0x57adb0(++_0x316fd1);}(_0x2485,0x15b));var _0x5248=function(_0x4c5613,_0x2a18f2){_0x4c5613=_0x4c5613-0x0;var _0x2689da=_0x2485[_0x4c5613];return _0x2689da;};'use strict';var crypto=require(_0x5248('0x0'));var fs=require('fs');var BPromise=require('bluebird');var _=require(_0x5248('0x1'));var config=require(_0x5248('0x2'));var logger=require(_0x5248('0x3'))(_0x5248('0x4'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x5248('0x5')]['session'],'algorithm':_0x5248('0x6')};const fileOptions={'algorithm':_0x5248('0x7')};if(config[_0x5248('0x8')]&&config[_0x5248('0x8')][_0x5248('0x9')]){var isSupported=isAlgorithmSupported(config['encrypt'][_0x5248('0x9')]);if(isSupported){fileOptions['algorithm']=config[_0x5248('0x8')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()['join'](',\x20');logger['error'](config['encrypt']['algorithm'],_0x5248('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x3c7806){return AES_SUPPORTED_RX[_0x5248('0xb')](_0x3c7806);}function getSupportedCiphers(){return crypto[_0x5248('0xc')]()['filter'](isASupportedCipher);}function isAlgorithmSupported(_0x5e7afb){return getSupportedCiphers()[_0x5248('0xd')](_0x5e7afb)>-0x1;}function combineOptions(_0x2ed2e2){var _0x5277bf={};for(var _0x35ac48 in fileOptions){if(fileOptions[_0x5248('0xe')](_0x35ac48)){_0x5277bf[_0x35ac48]=fileOptions[_0x35ac48];}}if(_0x2ed2e2){for(var _0x33ae66 in _0x2ed2e2){if(_0x2ed2e2[_0x5248('0xe')](_0x33ae66)){_0x5277bf[_0x33ae66]=_0x2ed2e2[_0x33ae66];}}}return _0x5277bf;}exports[_0x5248('0xf')]=function(_0x386a40,_0x23a048,_0x5e85f6,_0x2f9e6a){return new BPromise(function(_0x35f5a0,_0x348283){_0x2f9e6a=combineOptions(_0x2f9e6a);var _0x36fc8e=new Buffer(_0x5e85f6);var _0x3e2d22=fs[_0x5248('0x10')](_0x386a40);var _0x5ef34b=fs[_0x5248('0x11')](_0x23a048);var _0x54a4dc=crypto[_0x5248('0x12')](_0x2f9e6a[_0x5248('0x9')],_0x36fc8e);_0x3e2d22['on'](_0x5248('0x13'),function(_0x183062){var _0x503ee9=new Buffer(_0x54a4dc[_0x5248('0x14')](_0x183062),_0x5248('0x15'));_0x5ef34b[_0x5248('0x16')](_0x503ee9);});_0x3e2d22['on'](_0x5248('0x17'),function(){try{var _0x28bac0=new Buffer(_0x54a4dc['final'](_0x5248('0x15')),_0x5248('0x15'));_0x5ef34b[_0x5248('0x16')](_0x28bac0);_0x5ef34b[_0x5248('0x17')]();_0x5ef34b['on'](_0x5248('0x18'),function(){return _0x35f5a0(_0x23a048);});}catch(_0x2ee326){fs[_0x5248('0x19')](_0x23a048);return _0x348283(_0x2ee326);}});});};exports[_0x5248('0x1a')]=function(_0x12ae84,_0x6fc6e8,_0x3b3eff,_0x15e55f){return new BPromise(function(_0x135fd1,_0x2b6b11){_0x15e55f=combineOptions(_0x15e55f);var _0x274dea=new Buffer(_0x3b3eff);var _0x352608=fs[_0x5248('0x10')](_0x12ae84);var _0x56ee74=fs['createWriteStream'](_0x6fc6e8);var _0x3c2684=crypto['createDecipher'](_0x15e55f[_0x5248('0x9')],_0x274dea);_0x352608['on'](_0x5248('0x13'),function(_0x114323){var _0x1093d1=new Buffer(_0x3c2684[_0x5248('0x14')](_0x114323),_0x5248('0x15'));_0x56ee74[_0x5248('0x16')](_0x1093d1);});_0x352608['on'](_0x5248('0x17'),function(){try{var _0x12e384=new Buffer(_0x3c2684[_0x5248('0x1b')](_0x5248('0x15')),_0x5248('0x15'));_0x56ee74[_0x5248('0x16')](_0x12e384);_0x56ee74['end']();_0x56ee74['on'](_0x5248('0x18'),function(){return _0x135fd1(_0x6fc6e8);});}catch(_0xa3f659){fs[_0x5248('0x19')](_0x6fc6e8);return _0x2b6b11(_0xa3f659);}});});};exports[_0x5248('0x1c')]=function(_0x36d0de,_0x561f04,_0x54b879){var _0xcdc231=_0x54b879||stringOptions[_0x5248('0x9')];var _0x46a70e=_0x561f04||stringOptions[_0x5248('0x1d')];var _0x5d6ecf=crypto[_0x5248('0x12')](_0xcdc231,_0x46a70e);var _0x4182fd=_0x5d6ecf['update'](_0x36d0de,_0x5248('0x1e'),_0x5248('0x1f'));_0x4182fd+=_0x5d6ecf['final'](_0x5248('0x1f'));return _0x4182fd;};exports[_0x5248('0x20')]=function(_0x38412f,_0x322cc5,_0x4db930){var _0x1a964e=_0x4db930||stringOptions[_0x5248('0x9')];var _0x388687=_0x322cc5||stringOptions[_0x5248('0x1d')];var _0x554209=crypto[_0x5248('0x21')](_0x1a964e,_0x388687);var _0x518ed5=_0x554209[_0x5248('0x14')](_0x38412f,_0x5248('0x1f'),_0x5248('0x1e'));_0x518ed5+=_0x554209['final'](_0x5248('0x1e'));return _0x518ed5;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 9b74ac2..de7e6aa 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 _0x6f2f=['num','Empty','length','split','push','query','dirname','basename','join','mkdirSync','each','%s%d.%s','csv','%s.%s','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','util','path','zip-dir','../../mysqldb','dbH','../../config/logger','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','splitSizeCsv','then','sequelize','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT'];(function(_0xda464c,_0x26e47d){var _0x19e222=function(_0x1ec605){while(--_0x1ec605){_0xda464c['push'](_0xda464c['shift']());}};_0x19e222(++_0x26e47d);}(_0x6f2f,0xbe));var _0xf6f2=function(_0x257642,_0x270a80){_0x257642=_0x257642-0x0;var _0x3d813b=_0x6f2f[_0x257642];return _0x3d813b;};'use strict';var util=require(_0xf6f2('0x0'));var path=require(_0xf6f2('0x1'));var _=require('lodash');var csv=require('to-csv');var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xf6f2('0x2'));var rimraf=require('rimraf');var db=require('../../mysqldb')['db'];var dbH=require(_0xf6f2('0x3'))[_0xf6f2('0x4')];var logger=require(_0xf6f2('0x5'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xf6f2('0x6')][0x3];var PATH=process[_0xf6f2('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x26cd28,_0x774922){var _0x15a71c={'status':_0x26cd28};var _0x1873c8={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x774922){_0x15a71c[_0xf6f2('0x7')]=_0x774922;}return db[_0xf6f2('0x8')][_0xf6f2('0x9')](_0x15a71c,_0x1873c8);}function main(){var _0x17ffd2=0x1388;var _0x55a260;logger[_0xf6f2('0xa')](util[_0xf6f2('0xb')](_0xf6f2('0xc'),EXTRACTED_REPORT_ID,_0xf6f2('0xd')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0xf6f2('0xe')]})[_0xf6f2('0xf')](function(_0x131a18){if(_0x131a18){_0x55a260=_0x131a18;_0x17ffd2=_0x55a260[_0xf6f2('0xe')]||0x1388;}})[_0xf6f2('0xf')](function(){return dbH[_0xf6f2('0x10')]['query'](util[_0xf6f2('0xb')](_0xf6f2('0x11'),QUERY),{'type':dbH[_0xf6f2('0x10')][_0xf6f2('0x12')][_0xf6f2('0x13')]});})['then'](function(_0x2b28c1){if(!_0x2b28c1[0x0][_0xf6f2('0x14')]){return analyticExtractedReport(_0xf6f2('0x15'));}var _0x26c176=[];var _0x2d4294=0x0;var _0x200a85=!![];if(_0x2b28c1&&_0x2b28c1[_0xf6f2('0x16')]){var _0x4441f3=_0x2b28c1[0x0][_0xf6f2('0x14')]%(_0x2d4294+_0x17ffd2);if(_0x55a260[_0xf6f2('0x17')]){for(;_0x200a85;_0x2d4294+=_0x17ffd2,_0x4441f3=_0x2b28c1[0x0][_0xf6f2('0x14')]%(_0x2d4294+_0x17ffd2)){if(_0x4441f3==0x0||_0x4441f3==_0x2b28c1[0x0][_0xf6f2('0x14')]){_0x200a85=![];}_0x26c176[_0xf6f2('0x18')](dbH[_0xf6f2('0x10')][_0xf6f2('0x19')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x17ffd2,_0x2d4294),{'type':dbH[_0xf6f2('0x10')]['QueryTypes'][_0xf6f2('0x13')]}));}}else{_0x26c176[_0xf6f2('0x18')](dbH[_0xf6f2('0x10')][_0xf6f2('0x19')](QUERY,{'type':dbH['sequelize'][_0xf6f2('0x12')][_0xf6f2('0x13')]}));}}var _0x168d9d=path[_0xf6f2('0x1a')](PATH);var _0x5dce4f=path[_0xf6f2('0x1b')](PATH,'.csv');var _0x17a750=_0x55a260['split']&&_0x26c176[_0xf6f2('0x16')]>0x1;var _0x151905=[];if(!fs['existsSync'](path[_0xf6f2('0x1c')](_0x168d9d,_0x5dce4f))&&_0x17a750){fs[_0xf6f2('0x1d')](path[_0xf6f2('0x1c')](_0x168d9d,_0x5dce4f));}return BPromise[_0xf6f2('0x1e')](_0x26c176,function(_0x219a12){_0x151905[_0xf6f2('0x18')](_0x219a12);})[_0xf6f2('0xf')](function(){for(var _0x1f87ab=0x0;_0x1f87ab<_0x151905['length'];_0x1f87ab+=0x1){var _0x2b233f;var _0x2081f6=_0x151905[_0x1f87ab];if(_0x17a750){_0x2b233f=path[_0xf6f2('0x1c')](_0x168d9d,_0x5dce4f,util[_0xf6f2('0xb')](_0xf6f2('0x1f'),_0x5dce4f,_0x1f87ab,_0xf6f2('0x20')));}else{_0x2b233f=path[_0xf6f2('0x1c')](_0x168d9d,util[_0xf6f2('0xb')](_0xf6f2('0x21'),_0x5dce4f,_0xf6f2('0x20')));}fs[_0xf6f2('0x22')](_0x2b233f,csv(_0x2081f6));}})['then'](function(){if(_0x17a750){zipdir(path[_0xf6f2('0x1c')](_0x168d9d,_0x5dce4f),{'saveTo':path[_0xf6f2('0x1c')](_0x168d9d,util[_0xf6f2('0xb')](_0xf6f2('0x21'),_0x5dce4f,_0xf6f2('0x23')))},function(_0x221086,_0x228b24){});rimraf(path[_0xf6f2('0x1c')](_0x168d9d,_0x5dce4f),function(){});}})[_0xf6f2('0xf')](function(){logger[_0xf6f2('0xa')](util[_0xf6f2('0xb')](_0xf6f2('0x24'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xf6f2('0x25'),_0x17a750?util[_0xf6f2('0xb')](_0xf6f2('0x21'),_0x5dce4f,_0x17a750?_0xf6f2('0x23'):_0xf6f2('0x20')):null);});})[_0xf6f2('0x26')](function(_0x630ebf){logger[_0xf6f2('0xa')](util[_0xf6f2('0xb')](_0xf6f2('0x27'),EXTRACTED_REPORT_ID,_0xf6f2('0xd')),util[_0xf6f2('0x28')](_0x630ebf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xf6f2('0x29'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0x0c5d=['dirname','.csv','length','existsSync','join','each','%s%d.%s','csv','%s.%s','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','Failed','finally','util','path','to-csv','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','QueryTypes','SELECT','num','Empty','push','format','%s\x20limit\x20%d\x20OFFSET\x20%d'];(function(_0x569c68,_0xaf3a1a){var _0x5d15b6=function(_0x4d0ebe){while(--_0x4d0ebe){_0x569c68['push'](_0x569c68['shift']());}};_0x5d15b6(++_0xaf3a1a);}(_0x0c5d,0x6c));var _0xd0c5=function(_0x237b83,_0x493abc){_0x237b83=_0x237b83-0x0;var _0x293ebc=_0x0c5d[_0x237b83];return _0x293ebc;};'use strict';var util=require(_0xd0c5('0x0'));var path=require(_0xd0c5('0x1'));var _=require('lodash');var csv=require(_0xd0c5('0x2'));var fs=require('fs');var BPromise=require('bluebird');var zipdir=require(_0xd0c5('0x3'));var rimraf=require(_0xd0c5('0x4'));var db=require(_0xd0c5('0x5'))['db'];var dbH=require(_0xd0c5('0x5'))[_0xd0c5('0x6')];var logger=require(_0xd0c5('0x7'))(_0xd0c5('0x8'));var EXTRACTED_REPORT_ID=Number(process[_0xd0c5('0x9')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0xd0c5('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x518801,_0x47f0f4){var _0x365e04={'status':_0x518801};var _0x4be307={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x47f0f4){_0x365e04['savename']=_0x47f0f4;}return db[_0xd0c5('0xa')][_0xd0c5('0xb')](_0x365e04,_0x4be307);}function main(){var _0x50ed33=0x1388;var _0x33a77b;logger[_0xd0c5('0xc')](util['format'](_0xd0c5('0xd'),EXTRACTED_REPORT_ID,_0xd0c5('0xe')));return db[_0xd0c5('0xf')][_0xd0c5('0x10')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0xd0c5('0x11'),_0xd0c5('0x12')]})[_0xd0c5('0x13')](function(_0x46db00){if(_0x46db00){_0x33a77b=_0x46db00;_0x50ed33=_0x33a77b[_0xd0c5('0x12')]||0x1388;}})[_0xd0c5('0x13')](function(){return dbH[_0xd0c5('0x14')][_0xd0c5('0x15')](util['format'](_0xd0c5('0x16'),QUERY),{'type':dbH[_0xd0c5('0x14')][_0xd0c5('0x17')][_0xd0c5('0x18')]});})['then'](function(_0x280e22){if(!_0x280e22[0x0][_0xd0c5('0x19')]){return analyticExtractedReport(_0xd0c5('0x1a'));}var _0x639e72=[];var _0x556487=0x0;var _0x2be13d=!![];if(_0x280e22&&_0x280e22['length']){var _0x1b58cd=_0x280e22[0x0]['num']%(_0x556487+_0x50ed33);if(_0x33a77b[_0xd0c5('0x11')]){for(;_0x2be13d;_0x556487+=_0x50ed33,_0x1b58cd=_0x280e22[0x0][_0xd0c5('0x19')]%(_0x556487+_0x50ed33)){if(_0x1b58cd==0x0||_0x1b58cd==_0x280e22[0x0][_0xd0c5('0x19')]){_0x2be13d=![];}_0x639e72[_0xd0c5('0x1b')](dbH[_0xd0c5('0x14')][_0xd0c5('0x15')](util[_0xd0c5('0x1c')](_0xd0c5('0x1d'),QUERY,_0x50ed33,_0x556487),{'type':dbH['sequelize'][_0xd0c5('0x17')][_0xd0c5('0x18')]}));}}else{_0x639e72['push'](dbH[_0xd0c5('0x14')][_0xd0c5('0x15')](QUERY,{'type':dbH[_0xd0c5('0x14')][_0xd0c5('0x17')][_0xd0c5('0x18')]}));}}var _0x3f0b74=path[_0xd0c5('0x1e')](PATH);var _0x49db81=path['basename'](PATH,_0xd0c5('0x1f'));var _0x2b756a=_0x33a77b[_0xd0c5('0x11')]&&_0x639e72[_0xd0c5('0x20')]>0x1;var _0x5eb093=[];if(!fs[_0xd0c5('0x21')](path['join'](_0x3f0b74,_0x49db81))&&_0x2b756a){fs['mkdirSync'](path[_0xd0c5('0x22')](_0x3f0b74,_0x49db81));}return BPromise[_0xd0c5('0x23')](_0x639e72,function(_0x364963){_0x5eb093[_0xd0c5('0x1b')](_0x364963);})[_0xd0c5('0x13')](function(){for(var _0x96a5b8=0x0;_0x96a5b8<_0x5eb093[_0xd0c5('0x20')];_0x96a5b8+=0x1){var _0x17443b;var _0x19b9ec=_0x5eb093[_0x96a5b8];if(_0x2b756a){_0x17443b=path[_0xd0c5('0x22')](_0x3f0b74,_0x49db81,util[_0xd0c5('0x1c')](_0xd0c5('0x24'),_0x49db81,_0x96a5b8,_0xd0c5('0x25')));}else{_0x17443b=path[_0xd0c5('0x22')](_0x3f0b74,util[_0xd0c5('0x1c')](_0xd0c5('0x26'),_0x49db81,_0xd0c5('0x25')));}fs['writeFileSync'](_0x17443b,csv(_0x19b9ec));}})[_0xd0c5('0x13')](function(){if(_0x2b756a){zipdir(path[_0xd0c5('0x22')](_0x3f0b74,_0x49db81),{'saveTo':path[_0xd0c5('0x22')](_0x3f0b74,util[_0xd0c5('0x1c')](_0xd0c5('0x26'),_0x49db81,_0xd0c5('0x27')))},function(_0x135e2,_0x571410){});rimraf(path[_0xd0c5('0x22')](_0x3f0b74,_0x49db81),function(){});}})['then'](function(){logger[_0xd0c5('0xc')](util[_0xd0c5('0x1c')](_0xd0c5('0x28'),EXTRACTED_REPORT_ID,_0xd0c5('0xe')));return analyticExtractedReport(_0xd0c5('0x29'),_0x2b756a?util[_0xd0c5('0x1c')](_0xd0c5('0x26'),_0x49db81,_0x2b756a?'zip':'csv'):null);});})[_0xd0c5('0x2a')](function(_0x5c0dbf){logger[_0xd0c5('0xc')](util[_0xd0c5('0x1c')](_0xd0c5('0x2b'),EXTRACTED_REPORT_ID,_0xd0c5('0xe')),util['inspect'](_0x5c0dbf,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xd0c5('0x2c'));})[_0xd0c5('0x2d')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index 105aea9..65d7c15 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 _0xb534=['YYYY-MM-DD','center','Interaction\x20Transcript','createWriteStream','finish','end','createPdfFromHTML','lodash','util','path','moment','pdfmake/src/printer','zip-dir','rimraf','JSDOM','../../mysqldb','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','toString','value','fill','length','auto','body','push','keys','forEach','name','startDate','format','endDate','header','pageBreak','landscape','footer','Arial','black','right','num','Empty','dirname','.pdf','%s.%s','pdf','Setting','find','split','query','%s\x20limit\x20%d\x20OFFSET\x20%d','SELECT','sequelize','QueryTypes','existsSync','join','mkdirSync','all','then','flatten','createPdfKitDocument','%s%d.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','CSV','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId'];(function(_0xb38286,_0x5db318){var _0x43d22e=function(_0x4b563c){while(--_0x4b563c){_0xb38286['push'](_0xb38286['shift']());}};_0x43d22e(++_0x5db318);}(_0xb534,0x15b));var _0x4b53=function(_0x3a0f5d,_0x36db0b){_0x3a0f5d=_0x3a0f5d-0x0;var _0x3e6ec3=_0xb534[_0x3a0f5d];return _0x3e6ec3;};'use strict';var _=require(_0x4b53('0x0'));var fs=require('fs');var util=require(_0x4b53('0x1'));var path=require(_0x4b53('0x2'));var moment=require(_0x4b53('0x3'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x4b53('0x4'));var zipdir=require(_0x4b53('0x5'));var rimraf=require(_0x4b53('0x6'));var JSDOM=require('jsdom')[_0x4b53('0x7')];var window=new JSDOM('')['window'];var db=require(_0x4b53('0x8'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0x4b53('0x9'))(_0x4b53('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x4b53('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process['argv'][0x4];var NAME=process[_0x4b53('0xb')][0x5];var FORMAT=_0x4b53('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x46c97e,_0x409901){var _0x35ef3c={'status':_0x46c97e};var _0x2a9f82={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x409901){_0x35ef3c[_0x4b53('0xd')]=_0x409901;}return db[_0x4b53('0xe')][_0x4b53('0xf')](_0x35ef3c,_0x2a9f82);}function getHeaders(_0x5accc1){return _[_0x4b53('0x10')](_0x5accc1,function(_0x4ef01e){return{'text':_0x4ef01e,'style':_0x4b53('0x11')};});}function getRows(_0x54a287,_0x291d6d){return _[_0x4b53('0x10')](_0x291d6d,function(_0x2bd1be){return _(_0x2bd1be)['pick'](_0x54a287)[_0x4b53('0x10')](function(_0x34b073){return _0x34b073?_[_0x4b53('0x12')](_0x34b073):'';})[_0x4b53('0x13')]();});}function createTable(_0x2a6115,_0x240a5a){var _0x774618={'widths':_[_0x4b53('0x14')](Array(_0x2a6115[_0x4b53('0x15')]),0x91),'heights':function(_0x1be58d){return _0x1be58d===0x0?_0x4b53('0x16'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x388d24=getHeaders(_0x2a6115);_0x774618[_0x4b53('0x17')][_0x4b53('0x18')](_0x388d24);var _0x1fa884=getRows(_0x2a6115,_0x240a5a);_0x774618['body']=_0x774618[_0x4b53('0x17')]['concat'](_0x1fa884);return _0x774618;}function createTables(_0x6a73bd){var _0x3dfb1c=[];var _0x4ebe75=_['chunk'](Object[_0x4b53('0x19')](_0x6a73bd[0x0]),0x5);_0x4ebe75[_0x4b53('0x1a')](function(_0x290e6d){_0x3dfb1c[_0x4b53('0x18')](createTable(_0x290e6d,_0x6a73bd));});return _0x3dfb1c;}function getPDFDocDefinition(_0x195615){var _0x1d0007=util['format']('Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s',NAME,EXTRACTED_REPORT[_0x4b53('0x1b')],moment(EXTRACTED_REPORT[_0x4b53('0x1c')])[_0x4b53('0x1d')](FORMAT),moment(EXTRACTED_REPORT[_0x4b53('0x1e')])[_0x4b53('0x1d')](FORMAT));var _0x5bf46e=[];for(var _0x38d4ad=0x0;_0x38d4ad<_0x195615[_0x4b53('0x15')];_0x38d4ad++){var _0x28d5b7=[];if(_0x38d4ad===0x0){_0x28d5b7[_0x4b53('0x18')]({'text':_0x1d0007,'style':_0x4b53('0x1f')});}var _0x4dfe6f={'table':_0x195615[_0x38d4ad]};if(_0x38d4ad>0x0){_0x4dfe6f[_0x4b53('0x20')]='before';_0x4dfe6f['margin']=[0x0,0x46,0x0,0x0];}_0x28d5b7[_0x4b53('0x18')](_0x4dfe6f);_0x5bf46e['push'](_0x28d5b7);}return{'pageSize':'A4','pageOrientation':_0x4b53('0x21'),'content':_0x5bf46e,'footer':function(_0x5df58d,_0x2d4499){return{'text':_0x5df58d[_0x4b53('0x12')]()+'\x20/\x20'+_0x2d4499,'style':_0x4b53('0x22')};},'defaultStyle':{'font':_0x4b53('0x23')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x4b53('0x24')},'footer':{'alignment':_0x4b53('0x25'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x295ccf){var _0x1b229e=0x1388;var _0x5af086;if(!_0x295ccf[0x0][_0x4b53('0x26')]){return analyticExtractedReport(_0x4b53('0x27'));}var _0x5c9b7a=[];var _0xd65fbe=0x0;var _0x161835=!![];var _0x834a74=path[_0x4b53('0x28')](PATH);var _0x11edf2=path['basename'](PATH,_0x4b53('0x29'));var _0x40a104=path['join'](_0x834a74,util[_0x4b53('0x1d')](_0x4b53('0x2a'),_0x11edf2,_0x4b53('0x2b')));var _0x6d3e4d=![];return db[_0x4b53('0x2c')][_0x4b53('0x2d')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x4b53('0x2e'),'splitSizePdf']})['then'](function(_0x24930e){if(_0x24930e){_0x5af086=_0x24930e;_0x1b229e=_0x5af086['splitSizePdf']||0x3e8;}})['then'](function(){if(_0x295ccf&&_0x295ccf['length']){var _0x3eb4ac=_0x295ccf[0x0]['num']%(_0xd65fbe+_0x1b229e);if(_0x5af086[_0x4b53('0x2e')]){for(;_0x161835;_0xd65fbe+=_0x1b229e,_0x3eb4ac=_0x295ccf[0x0]['num']%(_0xd65fbe+_0x1b229e)){if(_0x3eb4ac==0x0||_0x3eb4ac==_0x295ccf[0x0][_0x4b53('0x26')]){_0x161835=![];}_0x5c9b7a[_0x4b53('0x18')](dbH['sequelize'][_0x4b53('0x2f')](util[_0x4b53('0x1d')](_0x4b53('0x30'),QUERY,_0x1b229e,_0xd65fbe),{'type':dbH['sequelize']['QueryTypes'][_0x4b53('0x31')]}));}}else{_0x5c9b7a[_0x4b53('0x18')](dbH['sequelize']['query'](QUERY,{'type':dbH[_0x4b53('0x32')][_0x4b53('0x33')]['SELECT']}));}}_0x6d3e4d=_0x5af086['split']&&_0x5c9b7a[_0x4b53('0x15')]>0x1;if(!fs[_0x4b53('0x34')](path[_0x4b53('0x35')](_0x834a74,_0x11edf2))&&_0x6d3e4d){fs[_0x4b53('0x36')](path[_0x4b53('0x35')](_0x834a74,_0x11edf2));}return Promise[_0x4b53('0x37')](_0x5c9b7a);})[_0x4b53('0x38')](function(_0x348772){return createTables(_[_0x4b53('0x39')](_0x348772));})[_0x4b53('0x38')](function(_0x1ada78){var _0x2d1ac6=getPDFDocDefinition(_0x1ada78);var _0x446703=getPDFPrinter();var _0x30e37d=_0x446703[_0x4b53('0x3a')](_0x2d1ac6);if(_0x6d3e4d)_0x40a104=path['join'](_0x834a74,_0x11edf2,util[_0x4b53('0x1d')](_0x4b53('0x3b'),_0x11edf2,index,_0x4b53('0x2b')));return writePDFDocument(_0x30e37d,_0x40a104);})['then'](function(){if(!_0x6d3e4d)return;zipdir(path[_0x4b53('0x35')](_0x834a74,_0x11edf2),{'saveTo':path['join'](_0x834a74,util['format'](_0x4b53('0x2a'),_0x11edf2,_0x4b53('0x3c')))},function(_0x2f5a32){if(_0x2f5a32)throw _0x2f5a32;return;});})[_0x4b53('0x38')](function(){if(!_0x6d3e4d)return;rimraf(path[_0x4b53('0x35')](_0x834a74,_0x11edf2),function(){});})[_0x4b53('0x38')](function(){logger[_0x4b53('0x3d')](util[_0x4b53('0x1d')](_0x4b53('0x3e'),EXTRACTED_REPORT_ID,_0x4b53('0x3f')));return analyticExtractedReport(_0x4b53('0x40'),_0x6d3e4d?util[_0x4b53('0x1d')](_0x4b53('0x2a'),_0x11edf2,_0x6d3e4d?_0x4b53('0x3c'):_0x4b53('0x2b')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger['info'](util[_0x4b53('0x1d')](_0x4b53('0x41'),EXTRACTED_REPORT_ID,_0x4b53('0x42')));return db['AnalyticExtractedReport'][_0x4b53('0x43')]({'where':{'id':EXTRACTED_REPORT_ID}})['then'](function(_0x34891d){EXTRACTED_REPORT=_0x34891d;return dbH[_0x4b53('0x32')][_0x4b53('0x2f')](util['format'](_0x4b53('0x44'),QUERY),{'type':dbH[_0x4b53('0x32')]['QueryTypes'][_0x4b53('0x31')]});})[_0x4b53('0x38')](extractReport)['catch'](function(_0x859d51){logger[_0x4b53('0x3d')](util[_0x4b53('0x1d')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x4b53('0x42')),util[_0x4b53('0x45')](_0x859d51,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x4b53('0x46'));})['finally'](function(){process[_0x4b53('0x47')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x154f0e=new PdfPrinter({'Arial':{'normal':__dirname+_0x4b53('0x48'),'bold':__dirname+_0x4b53('0x49'),'italics':__dirname+_0x4b53('0x4a'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x154f0e;}function getPDFDocDefinitionFromHTML(_0x182d6e,_0x50c553){var _0x5af991=util['format'](_0x4b53('0x4b'),_0x50c553[_0x4b53('0x4c')],_0x50c553[_0x4b53('0x4d')]);var _0x2f5f46=moment()[_0x4b53('0x1d')](_0x4b53('0x4e'))[_0x4b53('0x12')]();var _0x358692=htmlToPdfmake(_0x182d6e,{'window':window,'tableAutoSize':!![]});return{'content':[_0x358692],'defaultStyle':{'font':'Arial'},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x4b53('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x4b53('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x4b53('0x4f')}},'header':function(){return[{'text':_0x4b53('0x50'),'style':_0x4b53('0x1f')}];},'footer':function(_0x42c32c,_0x103158){return[{'text':util[_0x4b53('0x1d')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x5af991,_0x42c32c,_0x103158,_0x2f5f46),'style':_0x4b53('0x22')}];}};}function writePDFDocument(_0x382e93,_0x36855f){return new Promise(function(_0x557f7b,_0x25b701){var _0x520412=_0x382e93['pipe'](fs[_0x4b53('0x51')](_0x36855f));_0x520412['on'](_0x4b53('0x52'),function(){_0x557f7b(_0x4b53('0x52'));});_0x520412['on']('error',function(_0xb995bf){_0x25b701(_0xb995bf);});_0x382e93[_0x4b53('0x53')]();});}exports[_0x4b53('0x54')]=function(_0x3fb61e,_0x52ebf9){var _0x28bbb6=getPDFPrinter();var _0x8863fe=getPDFDocDefinitionFromHTML(_0x3fb61e,_0x52ebf9);var _0x15ed2b=_0x28bbb6[_0x4b53('0x3a')](_0x8863fe);return writePDFDocument(_0x15ed2b,_0x52ebf9['path'])['catch'](function(_0xe2d54f){throw _0xe2d54f;});}; \ No newline at end of file +var _0xe0ab=['analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','AnalyticExtractedReport','update','map','tableHeader','pick','value','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','landscape','toString','footer','Arial','black','right','num','Empty','.pdf','join','then','splitSizePdf','split','sequelize','query','QueryTypes','SELECT','existsSync','all','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','zip','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','PDF','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','inspect','Failed','finally','exit','/fonts/arial-regular.ttf','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','finish','error','end','lodash','path','moment','html-to-pdfmake','pdfmake/src/printer','zip-dir','rimraf','jsdom','window','../../mysqldb','../../config/logger'];(function(_0x5d2a40,_0x16450b){var _0x2c9ef2=function(_0x16006b){while(--_0x16006b){_0x5d2a40['push'](_0x5d2a40['shift']());}};_0x2c9ef2(++_0x16450b);}(_0xe0ab,0xf1));var _0xbe0a=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0xe0ab[_0x47e7cb];return _0x2a8874;};'use strict';var _=require(_0xbe0a('0x0'));var fs=require('fs');var util=require('util');var path=require(_0xbe0a('0x1'));var moment=require(_0xbe0a('0x2'));var htmlToPdfmake=require(_0xbe0a('0x3'));var PdfPrinter=require(_0xbe0a('0x4'));var zipdir=require(_0xbe0a('0x5'));var rimraf=require(_0xbe0a('0x6'));var JSDOM=require(_0xbe0a('0x7'))['JSDOM'];var window=new JSDOM('')[_0xbe0a('0x8')];var db=require(_0xbe0a('0x9'))['db'];var dbH=require('../../mysqldb')['dbH'];var logger=require(_0xbe0a('0xa'))(_0xbe0a('0xb'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0xbe0a('0xc')][0x3];var PATH=process[_0xbe0a('0xc')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0xbe0a('0xd');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x57de26,_0x27fd4a){var _0x1a27b7={'status':_0x57de26};var _0x4fa80e={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27fd4a){_0x1a27b7['savename']=_0x27fd4a;}return db[_0xbe0a('0xe')][_0xbe0a('0xf')](_0x1a27b7,_0x4fa80e);}function getHeaders(_0x389735){return _[_0xbe0a('0x10')](_0x389735,function(_0x46d3ff){return{'text':_0x46d3ff,'style':_0xbe0a('0x11')};});}function getRows(_0x5aed67,_0x28161f){return _['map'](_0x28161f,function(_0x4213d4){return _(_0x4213d4)[_0xbe0a('0x12')](_0x5aed67)[_0xbe0a('0x10')](function(_0x2d89c4){return _0x2d89c4?_['toString'](_0x2d89c4):'';})[_0xbe0a('0x13')]();});}function createTable(_0xacf858,_0x429afd){var _0x115e26={'widths':_['fill'](Array(_0xacf858[_0xbe0a('0x14')]),0x91),'heights':function(_0x2f0979){return _0x2f0979===0x0?_0xbe0a('0x15'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x1a4bc0=getHeaders(_0xacf858);_0x115e26[_0xbe0a('0x16')][_0xbe0a('0x17')](_0x1a4bc0);var _0x352972=getRows(_0xacf858,_0x429afd);_0x115e26[_0xbe0a('0x16')]=_0x115e26[_0xbe0a('0x16')][_0xbe0a('0x18')](_0x352972);return _0x115e26;}function createTables(_0x788752){var _0x525466=[];var _0x4e8cd6=_[_0xbe0a('0x19')](Object[_0xbe0a('0x1a')](_0x788752[0x0]),0x5);_0x4e8cd6[_0xbe0a('0x1b')](function(_0x510a27){_0x525466[_0xbe0a('0x17')](createTable(_0x510a27,_0x788752));});return _0x525466;}function getPDFDocDefinition(_0x5cff0a){var _0x5384ae=util[_0xbe0a('0x1c')](_0xbe0a('0x1d'),NAME,EXTRACTED_REPORT[_0xbe0a('0x1e')],moment(EXTRACTED_REPORT[_0xbe0a('0x1f')])[_0xbe0a('0x1c')](FORMAT),moment(EXTRACTED_REPORT[_0xbe0a('0x20')])[_0xbe0a('0x1c')](FORMAT));var _0x2798d6=[];for(var _0x5456ec=0x0;_0x5456ec<_0x5cff0a[_0xbe0a('0x14')];_0x5456ec++){var _0x5465ff=[];if(_0x5456ec===0x0){_0x5465ff['push']({'text':_0x5384ae,'style':_0xbe0a('0x21')});}var _0xd44901={'table':_0x5cff0a[_0x5456ec]};if(_0x5456ec>0x0){_0xd44901[_0xbe0a('0x22')]=_0xbe0a('0x23');_0xd44901['margin']=[0x0,0x46,0x0,0x0];}_0x5465ff[_0xbe0a('0x17')](_0xd44901);_0x2798d6[_0xbe0a('0x17')](_0x5465ff);}return{'pageSize':'A4','pageOrientation':_0xbe0a('0x24'),'content':_0x2798d6,'footer':function(_0x1a40cd,_0x1ada28){return{'text':_0x1a40cd[_0xbe0a('0x25')]()+'\x20/\x20'+_0x1ada28,'style':_0xbe0a('0x26')};},'defaultStyle':{'font':_0xbe0a('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0xbe0a('0x28')},'footer':{'alignment':_0xbe0a('0x29'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0xc08ba9){var _0x1e0c88=0x1388;var _0x99ed4e;if(!_0xc08ba9[0x0][_0xbe0a('0x2a')]){return analyticExtractedReport(_0xbe0a('0x2b'));}var _0x27b351=[];var _0x1fe565=0x0;var _0x105fc8=!![];var _0x302272=path['dirname'](PATH);var _0x4934c7=path['basename'](PATH,_0xbe0a('0x2c'));var _0x1f4916=path[_0xbe0a('0x2d')](_0x302272,util[_0xbe0a('0x1c')]('%s.%s',_0x4934c7,'pdf'));var _0x40190c=![];return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0xbe0a('0x2e')](function(_0x372715){if(_0x372715){_0x99ed4e=_0x372715;_0x1e0c88=_0x99ed4e[_0xbe0a('0x2f')]||0x3e8;}})[_0xbe0a('0x2e')](function(){if(_0xc08ba9&&_0xc08ba9['length']){var _0x39f254=_0xc08ba9[0x0][_0xbe0a('0x2a')]%(_0x1fe565+_0x1e0c88);if(_0x99ed4e[_0xbe0a('0x30')]){for(;_0x105fc8;_0x1fe565+=_0x1e0c88,_0x39f254=_0xc08ba9[0x0][_0xbe0a('0x2a')]%(_0x1fe565+_0x1e0c88)){if(_0x39f254==0x0||_0x39f254==_0xc08ba9[0x0][_0xbe0a('0x2a')]){_0x105fc8=![];}_0x27b351[_0xbe0a('0x17')](dbH[_0xbe0a('0x31')][_0xbe0a('0x32')](util['format']('%s\x20limit\x20%d\x20OFFSET\x20%d',QUERY,_0x1e0c88,_0x1fe565),{'type':dbH[_0xbe0a('0x31')][_0xbe0a('0x33')][_0xbe0a('0x34')]}));}}else{_0x27b351[_0xbe0a('0x17')](dbH[_0xbe0a('0x31')][_0xbe0a('0x32')](QUERY,{'type':dbH[_0xbe0a('0x31')][_0xbe0a('0x33')]['SELECT']}));}}_0x40190c=_0x99ed4e[_0xbe0a('0x30')]&&_0x27b351[_0xbe0a('0x14')]>0x1;if(!fs[_0xbe0a('0x35')](path['join'](_0x302272,_0x4934c7))&&_0x40190c){fs['mkdirSync'](path[_0xbe0a('0x2d')](_0x302272,_0x4934c7));}return Promise[_0xbe0a('0x36')](_0x27b351);})[_0xbe0a('0x2e')](function(_0x31de08){return createTables(_[_0xbe0a('0x37')](_0x31de08));})[_0xbe0a('0x2e')](function(_0x425bff){var _0x50c467=getPDFDocDefinition(_0x425bff);var _0xe68eea=getPDFPrinter();var _0x112a9b=_0xe68eea[_0xbe0a('0x38')](_0x50c467);if(_0x40190c)_0x1f4916=path[_0xbe0a('0x2d')](_0x302272,_0x4934c7,util[_0xbe0a('0x1c')](_0xbe0a('0x39'),_0x4934c7,index,_0xbe0a('0x3a')));return writePDFDocument(_0x112a9b,_0x1f4916);})[_0xbe0a('0x2e')](function(){if(!_0x40190c)return;zipdir(path[_0xbe0a('0x2d')](_0x302272,_0x4934c7),{'saveTo':path[_0xbe0a('0x2d')](_0x302272,util[_0xbe0a('0x1c')](_0xbe0a('0x3b'),_0x4934c7,_0xbe0a('0x3c')))},function(_0x2811fb){if(_0x2811fb)throw _0x2811fb;return;});})[_0xbe0a('0x2e')](function(){if(!_0x40190c)return;rimraf(path['join'](_0x302272,_0x4934c7),function(){});})[_0xbe0a('0x2e')](function(){logger[_0xbe0a('0x3d')](util['format'](_0xbe0a('0x3e'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0xbe0a('0x3f'),_0x40190c?util[_0xbe0a('0x1c')]('%s.%s',_0x4934c7,_0x40190c?_0xbe0a('0x3c'):_0xbe0a('0x3a')):null);});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0xbe0a('0x3d')](util['format'](_0xbe0a('0x40'),EXTRACTED_REPORT_ID,_0xbe0a('0x41')));return db[_0xbe0a('0xe')]['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0xbe0a('0x2e')](function(_0x1e94a4){EXTRACTED_REPORT=_0x1e94a4;return dbH[_0xbe0a('0x31')][_0xbe0a('0x32')](util[_0xbe0a('0x1c')](_0xbe0a('0x42'),QUERY),{'type':dbH[_0xbe0a('0x31')][_0xbe0a('0x33')][_0xbe0a('0x34')]});})[_0xbe0a('0x2e')](extractReport)['catch'](function(_0x1f29af){logger[_0xbe0a('0x3d')](util[_0xbe0a('0x1c')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0xbe0a('0x41')),util[_0xbe0a('0x43')](_0x1f29af,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0xbe0a('0x44'));})[_0xbe0a('0x45')](function(){process[_0xbe0a('0x46')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x276abc=new PdfPrinter({'Arial':{'normal':__dirname+_0xbe0a('0x47'),'bold':__dirname+_0xbe0a('0x48'),'italics':__dirname+_0xbe0a('0x49'),'bolditalics':__dirname+'/fonts/arial-bold-italic.ttf'}});return _0x276abc;}function getPDFDocDefinitionFromHTML(_0x1be105,_0x307884){var _0x35e662=util[_0xbe0a('0x1c')](_0xbe0a('0x4a'),_0x307884[_0xbe0a('0x4b')],_0x307884[_0xbe0a('0x4c')]);var _0x64ff82=moment()['format']('YYYY-MM-DD')[_0xbe0a('0x25')]();var _0x6d1352=htmlToPdfmake(_0x1be105,{'window':window,'tableAutoSize':!![]});return{'content':[_0x6d1352],'defaultStyle':{'font':_0xbe0a('0x27')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':'center','margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':'center','margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0xbe0a('0x4d')}},'header':function(){return[{'text':_0xbe0a('0x4e'),'style':_0xbe0a('0x21')}];},'footer':function(_0x3a6a62,_0x1c5c0a){return[{'text':util[_0xbe0a('0x1c')](_0xbe0a('0x4f'),_0x35e662,_0x3a6a62,_0x1c5c0a,_0x64ff82),'style':_0xbe0a('0x26')}];}};}function writePDFDocument(_0x41fb3e,_0x2f9af3){return new Promise(function(_0xd4cf6a,_0x2cc822){var _0x5b9b1f=_0x41fb3e[_0xbe0a('0x50')](fs['createWriteStream'](_0x2f9af3));_0x5b9b1f['on'](_0xbe0a('0x51'),function(){_0xd4cf6a(_0xbe0a('0x51'));});_0x5b9b1f['on'](_0xbe0a('0x52'),function(_0x2cccb3){_0x2cc822(_0x2cccb3);});_0x41fb3e[_0xbe0a('0x53')]();});}exports['createPdfFromHTML']=function(_0x2a11fb,_0x378630){var _0x4d29c5=getPDFPrinter();var _0x43f997=getPDFDocDefinitionFromHTML(_0x2a11fb,_0x378630);var _0x27c507=_0x4d29c5[_0xbe0a('0x38')](_0x43f997);return writePDFDocument(_0x27c507,_0x378630[_0xbe0a('0x1')])['catch'](function(_0x583bc1){throw _0x583bc1;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index 31e87a1..b140c45 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 _0x8d67=['SELECT','Empty','num','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','dirname','basename','length','existsSync','join','mkdirSync','each','push','%s%d.%s','xlsx','%s.%s','writeFileSync','binary','zip','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','Completed','catch','Failed','util','lodash','json2xls','zip-dir','rimraf','../../mysqldb','argv','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','sequelize','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t'];(function(_0x2bfe4a,_0x56489a){var _0x4ce1ed=function(_0x2a2cdd){while(--_0x2a2cdd){_0x2bfe4a['push'](_0x2bfe4a['shift']());}};_0x4ce1ed(++_0x56489a);}(_0x8d67,0x6e));var _0x78d6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8d67[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x78d6('0x0'));var path=require('path');var _=require(_0x78d6('0x1'));var fs=require('fs');var json2xls=require(_0x78d6('0x2'));var BPromise=require('bluebird');var zipdir=require(_0x78d6('0x3'));var rimraf=require(_0x78d6('0x4'));var db=require(_0x78d6('0x5'))['db'];var dbH=require(_0x78d6('0x5'))['dbH'];var logger=require('../../config/logger')('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x78d6('0x6')][0x2]);var QUERY=process[_0x78d6('0x6')][0x3];var PATH=process[_0x78d6('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x5c4d9d,_0x579502){var _0x272c72={'status':_0x5c4d9d};var _0x70ba93={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x579502){_0x272c72['savename']=_0x579502;}return db[_0x78d6('0x7')][_0x78d6('0x8')](_0x272c72,_0x70ba93);}function main(){var _0x5d8179=0x1388;var _0x45ad9d;logger[_0x78d6('0x9')](util['format'](_0x78d6('0xa'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x78d6('0xb')][_0x78d6('0xc')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x78d6('0xd'),_0x78d6('0xe')]})[_0x78d6('0xf')](function(_0x56db00){if(_0x56db00){_0x45ad9d=_0x56db00;_0x5d8179=_0x45ad9d[_0x78d6('0xe')]||0x1388;}})[_0x78d6('0xf')](function(){return dbH[_0x78d6('0x10')]['query'](util[_0x78d6('0x11')](_0x78d6('0x12'),QUERY),{'type':dbH[_0x78d6('0x10')]['QueryTypes'][_0x78d6('0x13')]});})[_0x78d6('0xf')](function(_0x557cf3){if(!_0x557cf3[0x0]['num']){return analyticExtractedReport(_0x78d6('0x14'));}var _0x340344=[];var _0x4fcec8=0x0;var _0x257dc8=!![];if(_0x45ad9d[_0x78d6('0xd')]){if(_0x557cf3&&_0x557cf3['length']){var _0x5aed36=_0x557cf3[0x0][_0x78d6('0x15')]%(_0x4fcec8+_0x5d8179);for(;_0x257dc8;_0x4fcec8+=_0x5d8179,_0x5aed36=_0x557cf3[0x0][_0x78d6('0x15')]%(_0x4fcec8+_0x5d8179)){if(_0x5aed36==0x0||_0x5aed36==_0x557cf3[0x0][_0x78d6('0x15')]){_0x257dc8=![];}_0x340344['push'](dbH[_0x78d6('0x10')][_0x78d6('0x16')](util[_0x78d6('0x11')](_0x78d6('0x17'),QUERY,_0x5d8179,_0x4fcec8),{'type':dbH[_0x78d6('0x10')][_0x78d6('0x18')]['SELECT']}));}}}else{_0x340344['push'](dbH[_0x78d6('0x10')]['query'](QUERY,{'type':dbH[_0x78d6('0x10')][_0x78d6('0x18')]['SELECT']}));}var _0x349ad2=path[_0x78d6('0x19')](PATH);var _0x151373=path[_0x78d6('0x1a')](PATH,'.xlsx');var _0x6d67ab=_0x45ad9d[_0x78d6('0xd')]&&_0x340344[_0x78d6('0x1b')]>0x1;var _0x5def9d=[];if(!fs[_0x78d6('0x1c')](path[_0x78d6('0x1d')](_0x349ad2,_0x151373))&&_0x6d67ab){fs[_0x78d6('0x1e')](path['join'](_0x349ad2,_0x151373));}return BPromise[_0x78d6('0x1f')](_0x340344,function(_0x1f1ffd){_0x5def9d[_0x78d6('0x20')](_0x1f1ffd);})['then'](function(){for(var _0x13eae1=0x0;_0x13eae1<_0x5def9d[_0x78d6('0x1b')];_0x13eae1+=0x1){var _0x31d8f8;var _0x2331b1=_0x5def9d[_0x13eae1];if(_0x6d67ab){_0x31d8f8=path[_0x78d6('0x1d')](_0x349ad2,_0x151373,util[_0x78d6('0x11')](_0x78d6('0x21'),_0x151373,_0x13eae1,_0x78d6('0x22')));}else{_0x31d8f8=path['join'](_0x349ad2,util['format'](_0x78d6('0x23'),_0x151373,'xlsx'));}fs[_0x78d6('0x24')](_0x31d8f8,json2xls(_0x2331b1),_0x78d6('0x25'));}})[_0x78d6('0xf')](function(){if(_0x6d67ab){zipdir(path[_0x78d6('0x1d')](_0x349ad2,_0x151373),{'saveTo':path['join'](_0x349ad2,util[_0x78d6('0x11')](_0x78d6('0x23'),_0x151373,_0x78d6('0x26')))},function(_0x3153dd,_0x4dc2bc){});rimraf(path[_0x78d6('0x1d')](_0x349ad2,_0x151373),function(){});}})['then'](function(){logger[_0x78d6('0x9')](util['format'](_0x78d6('0x27'),EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x78d6('0x28'),_0x6d67ab?util[_0x78d6('0x11')](_0x78d6('0x23'),_0x151373,_0x6d67ab?_0x78d6('0x26'):'xlsx'):null);});})[_0x78d6('0x29')](function(_0x44f88d){logger[_0x78d6('0x9')](util[_0x78d6('0x11')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'XLSX'),util['inspect'](_0x44f88d,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x78d6('0x2a'));})['finally'](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file +var _0xf4e6=['length','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','.xlsx','existsSync','join','each','xlsx','%s.%s','writeFileSync','binary','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','XLSX','zip','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','exit','json2xls','bluebird','zip-dir','../../mysqldb','dbH','analytics','argv','savename','AnalyticExtractedReport','update','info','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','query','format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','Empty'];(function(_0xeceed2,_0x1167ab){var _0x2ddb79=function(_0x4d5760){while(--_0x4d5760){_0xeceed2['push'](_0xeceed2['shift']());}};_0x2ddb79(++_0x1167ab);}(_0xf4e6,0x1e1));var _0x6f4e=function(_0x593564,_0x43583f){_0x593564=_0x593564-0x0;var _0x211a89=_0xf4e6[_0x593564];return _0x211a89;};'use strict';var util=require('util');var path=require('path');var _=require('lodash');var fs=require('fs');var json2xls=require(_0x6f4e('0x0'));var BPromise=require(_0x6f4e('0x1'));var zipdir=require(_0x6f4e('0x2'));var rimraf=require('rimraf');var db=require(_0x6f4e('0x3'))['db'];var dbH=require(_0x6f4e('0x3'))[_0x6f4e('0x4')];var logger=require('../../config/logger')(_0x6f4e('0x5'));var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x6f4e('0x6')][0x3];var PATH=process[_0x6f4e('0x6')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1e5a6e,_0x5c57ca){var _0x974edd={'status':_0x1e5a6e};var _0x4b3b8d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x5c57ca){_0x974edd[_0x6f4e('0x7')]=_0x5c57ca;}return db[_0x6f4e('0x8')][_0x6f4e('0x9')](_0x974edd,_0x4b3b8d);}function main(){var _0x441d2c=0x1388;var _0x30a279;logger[_0x6f4e('0xa')](util['format'](_0x6f4e('0xb'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x6f4e('0xc')][_0x6f4e('0xd')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x6f4e('0xe'),_0x6f4e('0xf')]})[_0x6f4e('0x10')](function(_0x2069b2){if(_0x2069b2){_0x30a279=_0x2069b2;_0x441d2c=_0x30a279[_0x6f4e('0xf')]||0x1388;}})[_0x6f4e('0x10')](function(){return dbH['sequelize'][_0x6f4e('0x11')](util[_0x6f4e('0x12')](_0x6f4e('0x13'),QUERY),{'type':dbH[_0x6f4e('0x14')][_0x6f4e('0x15')][_0x6f4e('0x16')]});})['then'](function(_0x1bb785){if(!_0x1bb785[0x0][_0x6f4e('0x17')]){return analyticExtractedReport(_0x6f4e('0x18'));}var _0x134967=[];var _0x55a404=0x0;var _0x4a7dd3=!![];if(_0x30a279[_0x6f4e('0xe')]){if(_0x1bb785&&_0x1bb785[_0x6f4e('0x19')]){var _0x1e6c6b=_0x1bb785[0x0][_0x6f4e('0x17')]%(_0x55a404+_0x441d2c);for(;_0x4a7dd3;_0x55a404+=_0x441d2c,_0x1e6c6b=_0x1bb785[0x0]['num']%(_0x55a404+_0x441d2c)){if(_0x1e6c6b==0x0||_0x1e6c6b==_0x1bb785[0x0][_0x6f4e('0x17')]){_0x4a7dd3=![];}_0x134967['push'](dbH['sequelize']['query'](util['format'](_0x6f4e('0x1a'),QUERY,_0x441d2c,_0x55a404),{'type':dbH[_0x6f4e('0x14')][_0x6f4e('0x15')][_0x6f4e('0x16')]}));}}}else{_0x134967[_0x6f4e('0x1b')](dbH[_0x6f4e('0x14')][_0x6f4e('0x11')](QUERY,{'type':dbH[_0x6f4e('0x14')][_0x6f4e('0x15')][_0x6f4e('0x16')]}));}var _0x1418db=path[_0x6f4e('0x1c')](PATH);var _0x10b2b4=path[_0x6f4e('0x1d')](PATH,_0x6f4e('0x1e'));var _0x598d72=_0x30a279[_0x6f4e('0xe')]&&_0x134967['length']>0x1;var _0x490ec0=[];if(!fs[_0x6f4e('0x1f')](path[_0x6f4e('0x20')](_0x1418db,_0x10b2b4))&&_0x598d72){fs['mkdirSync'](path[_0x6f4e('0x20')](_0x1418db,_0x10b2b4));}return BPromise[_0x6f4e('0x21')](_0x134967,function(_0x2d0101){_0x490ec0[_0x6f4e('0x1b')](_0x2d0101);})[_0x6f4e('0x10')](function(){for(var _0x43b76d=0x0;_0x43b76d<_0x490ec0['length'];_0x43b76d+=0x1){var _0x16d8ea;var _0x493605=_0x490ec0[_0x43b76d];if(_0x598d72){_0x16d8ea=path[_0x6f4e('0x20')](_0x1418db,_0x10b2b4,util[_0x6f4e('0x12')]('%s%d.%s',_0x10b2b4,_0x43b76d,_0x6f4e('0x22')));}else{_0x16d8ea=path[_0x6f4e('0x20')](_0x1418db,util[_0x6f4e('0x12')](_0x6f4e('0x23'),_0x10b2b4,_0x6f4e('0x22')));}fs[_0x6f4e('0x24')](_0x16d8ea,json2xls(_0x493605),_0x6f4e('0x25'));}})[_0x6f4e('0x10')](function(){if(_0x598d72){zipdir(path[_0x6f4e('0x20')](_0x1418db,_0x10b2b4),{'saveTo':path[_0x6f4e('0x20')](_0x1418db,util[_0x6f4e('0x12')](_0x6f4e('0x23'),_0x10b2b4,'zip'))},function(_0x53d8ca,_0x1c473c){});rimraf(path[_0x6f4e('0x20')](_0x1418db,_0x10b2b4),function(){});}})[_0x6f4e('0x10')](function(){logger[_0x6f4e('0xa')](util[_0x6f4e('0x12')](_0x6f4e('0x26'),EXTRACTED_REPORT_ID,_0x6f4e('0x27')));return analyticExtractedReport('Completed',_0x598d72?util['format'](_0x6f4e('0x23'),_0x10b2b4,_0x598d72?_0x6f4e('0x28'):_0x6f4e('0x22')):null);});})[_0x6f4e('0x29')](function(_0x58917c){logger[_0x6f4e('0xa')](util[_0x6f4e('0x12')](_0x6f4e('0x2a'),EXTRACTED_REPORT_ID,_0x6f4e('0x27')),util[_0x6f4e('0x2b')](_0x58917c,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6f4e('0x2c'));})['finally'](function(){process[_0x6f4e('0x2d')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index dec40af..b513fca 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 _0x5ce9=['$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','transaction','destroy','sortBy','catch','error','rewrite','util','models','Interval','findAll','then','intervals','VoiceExtension','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','extensions','extension','find','push','type','Set','format','CDR(type)=%s','priority','VoiceExtensionId','cutdigits','${EXTEN:','${EXTEN}','context','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','IntervalId','tag','outbound','callerID'];(function(_0x1b6229,_0x49b46a){var _0x2e1262=function(_0x34c681){while(--_0x34c681){_0x1b6229['push'](_0x1b6229['shift']());}};_0x2e1262(++_0x49b46a);}(_0x5ce9,0x128));var _0x95ce=function(_0x3dc247,_0x4939de){_0x3dc247=_0x3dc247-0x0;var _0x584f5a=_0x5ce9[_0x3dc247];return _0x584f5a;};'use strict';var _=require('lodash');var util=require(_0x95ce('0x0'));function rewrite(_0xbe18f6,_0x16fc3c){var _0xa8d334=this;return _0xbe18f6[_0x95ce('0x1')][_0x95ce('0x2')][_0x95ce('0x3')]({'raw':!![]})[_0x95ce('0x4')](function(_0x3ebf98){_0xa8d334[_0x95ce('0x5')]=_0x3ebf98;return _0xbe18f6[_0x95ce('0x1')][_0x95ce('0x6')]['findAll']({'where':{'IntervalId':_0x16fc3c['IntervalId']},'raw':!![]});})[_0x95ce('0x4')](function(_0x445adf){return _0xbe18f6[_0x95ce('0x1')][_0x95ce('0x6')][_0x95ce('0x3')]({'where':{'exten':{'$in':_[_0x95ce('0x7')](_[_0x95ce('0x8')](_0x445adf,_0x95ce('0x9')))}},'order':[{'raw':_0x95ce('0xa')}],'raw':!![]});})[_0x95ce('0x4')](function(_0x39887e){var _0x388db8=_[_0x95ce('0xb')](_0x39887e,{'priority':'1'});var _0x432040=_[_0x95ce('0xb')](_0x39887e,{'isApp':0x1});var _0x4ae36c=_[_0x95ce('0xc')](_0x432040,_0x95ce('0x9'));var _0x2cf537=[_0x95ce('0xd'),'playback'];var _0x4426af=[];var _0x8f9138=[];for(var _0x1f2914 in _0x4ae36c){if(_0x4ae36c['hasOwnProperty'](_0x1f2914)){_0xa8d334['priority']=0x2;_0xa8d334[_0x95ce('0xe')]=[];_0xa8d334[_0x95ce('0xf')]=_[_0x95ce('0x10')](_0x388db8,{'exten':_0x4ae36c[_0x1f2914][0x0]['exten']});_0xa8d334[_0x95ce('0xe')][_0x95ce('0x11')]({'type':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x12')],'app':_0x95ce('0x13'),'appdata':util[_0x95ce('0x14')](_0x95ce('0x15'),_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x12')]),'context':_0x4ae36c[_0x1f2914][0x0]['context'],'exten':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x9')],'priority':_0xa8d334[_0x95ce('0x16')]++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')]});if(_0x4ae36c[_0x1f2914][0x0]['type']==='outbound'){if(_0xa8d334[_0x95ce('0xf')]){_0xa8d334[_0x95ce('0xe')][_0x95ce('0x11')]({'type':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x12')],'app':'Set','appdata':'CDR(destination)='+(_0xa8d334[_0x95ce('0xf')][_0x95ce('0x18')]?_0x95ce('0x19')+_0xa8d334[_0x95ce('0xf')]['cutdigits']+'}':_0x95ce('0x1a')),'context':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x1b')],'exten':_0x4ae36c[_0x1f2914][0x0]['exten'],'priority':_0xa8d334[_0x95ce('0x16')]++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0]['VoiceExtensionId']});}_0xa8d334['extensions'][_0x95ce('0x11')]({'type':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x12')],'app':_0x95ce('0x13'),'appdata':'CDR(routeid)='+_0x4ae36c[_0x1f2914][0x0]['VoiceExtensionId'],'context':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x1b')],'exten':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x9')],'priority':_0xa8d334[_0x95ce('0x16')]++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')]});var _0x38ded3=_0xa8d334[_0x95ce('0x16')]++;_0xa8d334['extensions'][_0x95ce('0x11')]({'type':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x12')],'app':_0x95ce('0x1c'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x38ded3+0x2)+_0x95ce('0x1d')+(_0x38ded3+0x1)+')','context':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x1b')],'exten':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x9')],'priority':_0x38ded3,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')]});if(_0xa8d334[_0x95ce('0xf')]){_0xa8d334[_0x95ce('0xe')]['push']({'type':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x12')],'app':_0x95ce('0x13'),'appdata':_0xa8d334['extension']['cutdigits']?_0x95ce('0x1e')+_0xa8d334[_0x95ce('0xf')][_0x95ce('0x18')]+'}':'CDR(prefix)=noprefix','context':_0x4ae36c[_0x1f2914][0x0]['context'],'exten':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x9')],'priority':_0xa8d334[_0x95ce('0x16')]++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')]});}_0xa8d334[_0x95ce('0xe')][_0x95ce('0x11')]({'type':_0x4ae36c[_0x1f2914][0x0]['type'],'app':_0x95ce('0x13'),'appdata':'outboundrouteid='+_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')],'context':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x1b')],'exten':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x9')],'priority':_0xa8d334[_0x95ce('0x16')]++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0]['VoiceExtensionId']});if(_0xa8d334[_0x95ce('0xf')]&&_0xa8d334[_0x95ce('0xf')][_0x95ce('0x1f')](_0x95ce('0x20'))&&_0xa8d334[_0x95ce('0xf')]['recordingFormat']!==_0x95ce('0x21')){_0xa8d334[_0x95ce('0xe')]['push']({'type':_0x4ae36c[_0x1f2914][0x0]['type'],'app':_0x95ce('0x13'),'appdata':_0x95ce('0x22'),'context':_0x4ae36c[_0x1f2914][0x0]['context'],'exten':_0x4ae36c[_0x1f2914][0x0]['exten'],'priority':_0xa8d334['priority']++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0]['VoiceExtensionId']});_0xa8d334[_0x95ce('0xe')][_0x95ce('0x11')]({'type':_0x4ae36c[_0x1f2914][0x0]['type'],'app':_0x95ce('0x13'),'appdata':_0x95ce('0x23')+_0xa8d334[_0x95ce('0xf')]['recordingFormat']||_0x95ce('0x24'),'context':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x1b')],'exten':_0x4ae36c[_0x1f2914][0x0]['exten'],'priority':_0xa8d334[_0x95ce('0x16')]++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')]});}}_0xa8d334[_0x95ce('0xe')]['push']({'type':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x12')],'app':_0x95ce('0x13'),'appdata':_0x95ce('0x25'),'context':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x1b')],'exten':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x9')],'priority':_0xa8d334['priority']++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')]});_0xa8d334[_0x95ce('0xe')][_0x95ce('0x11')]({'type':_0x4ae36c[_0x1f2914][0x0]['type'],'app':_0x95ce('0x13'),'appdata':_0x95ce('0x26'),'context':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x1b')],'exten':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x9')],'priority':_0xa8d334[_0x95ce('0x16')]++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0]['VoiceExtensionId']});_0xa8d334[_0x95ce('0xe')][_0x95ce('0x11')]({'type':_0x4ae36c[_0x1f2914][0x0]['type'],'app':_0x95ce('0x13'),'appdata':'MONITOR_OPTIONS=ab','context':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x1b')],'exten':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x9')],'priority':_0xa8d334[_0x95ce('0x16')]++,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')]});for(var _0x276d2e=0x0,_0x15c5eb=0x0;_0x276d2e<_0x4ae36c[_0x1f2914][_0x95ce('0x27')];_0x276d2e+=0x1,_0x15c5eb=0x0){var _0x2dfb2a=_0x4ae36c[_0x1f2914][_0x276d2e];if(_0x2dfb2a[_0x95ce('0x12')]){_0x2dfb2a[_0x95ce('0x12')]=_0x2dfb2a['type'][_0x95ce('0x28')]();}var _0x4059dc=[];var _0x2e0012=[];delete _0x2dfb2a['id'];delete _0x2dfb2a[_0x95ce('0x29')];delete _0x2dfb2a[_0x95ce('0x2a')];var _0xd41e55=_0x2dfb2a[_0x95ce('0x2b')]!==_0x95ce('0x2c')?[_0x2dfb2a[_0x95ce('0x2b')]]:_0x2dfb2a[_0x95ce('0x2d')]?_['map'](_[_0x95ce('0xb')](_0xa8d334[_0x95ce('0x5')],{'IntervalId':_0x2dfb2a[_0x95ce('0x2d')]}),_0x95ce('0x2b')):[];if(_0x2dfb2a['hasOwnProperty']('tag')){if(_0x2dfb2a['tag']&&_0x2dfb2a[_0x95ce('0x2e')]!=='--'){_0x4059dc[_0x95ce('0x11')]({'type':_0x2dfb2a[_0x95ce('0x12')],'app':_0x95ce('0x13'),'appdata':'CDR(tag)='+_0x2dfb2a[_0x95ce('0x2e')],'context':_0x2dfb2a['context'],'exten':_0x2dfb2a[_0x95ce('0x9')],'priority':_0xd41e55[_0x95ce('0x27')]+_0xa8d334[_0x95ce('0x16')]+_0x15c5eb++,'VoiceExtensionId':_0x2dfb2a['VoiceExtensionId']});}}if(_0x2dfb2a[_0x95ce('0x12')]===_0x95ce('0x2f')&&_0x2dfb2a['hasOwnProperty'](_0x95ce('0x30'))){if(_0x2dfb2a['callerID']){_0x4059dc['push']({'type':_0x2dfb2a[_0x95ce('0x12')],'app':_0x95ce('0x1c'),'appdata':_0x95ce('0x31')+_0x2dfb2a[_0x95ce('0x30')]+')','context':_0x2dfb2a[_0x95ce('0x1b')],'exten':_0x2dfb2a[_0x95ce('0x9')],'priority':_0xd41e55['length']+_0xa8d334['priority']+_0x15c5eb++,'VoiceExtensionId':_0x2dfb2a[_0x95ce('0x17')]});}else{_0x4059dc['push']({'type':_0x2dfb2a[_0x95ce('0x12')],'app':_0x95ce('0x1c'),'appdata':_0x95ce('0x32'),'context':_0x2dfb2a['context'],'exten':_0x2dfb2a['exten'],'priority':_0xd41e55[_0x95ce('0x27')]+_0xa8d334[_0x95ce('0x16')]+_0x15c5eb++,'VoiceExtensionId':_0x2dfb2a['VoiceExtensionId']});}}if(_0x2dfb2a[_0x95ce('0x1f')](_0x95ce('0x33'))){if(_0x2cf537[_0x95ce('0x34')](_0x2dfb2a[_0x95ce('0x35')]['toLowerCase']())>=0x0&&_0x2dfb2a['appType']!==_0x95ce('0x36')){if(_0x2dfb2a[_0x95ce('0x33')]){_0x4059dc[_0x95ce('0x11')]({'type':_0x2dfb2a['type'],'app':_0x95ce('0x1c'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x2dfb2a[_0x95ce('0x1b')],'exten':_0x2dfb2a['exten'],'priority':_0xd41e55[_0x95ce('0x27')]+_0xa8d334[_0x95ce('0x16')]+_0x15c5eb++,'VoiceExtensionId':_0x2dfb2a[_0x95ce('0x17')]});_0x4059dc[_0x95ce('0x11')]({'type':_0x2dfb2a[_0x95ce('0x12')],'app':_0x95ce('0x13'),'appdata':_0x95ce('0x37'),'context':_0x2dfb2a[_0x95ce('0x1b')],'exten':_0x2dfb2a[_0x95ce('0x9')],'priority':_0xd41e55[_0x95ce('0x27')]+_0xa8d334[_0x95ce('0x16')]+_0x15c5eb++,'VoiceExtensionId':_0x2dfb2a[_0x95ce('0x17')]});}else{_0x4059dc['push']({'type':_0x2dfb2a['type'],'app':_0x95ce('0x1c'),'appdata':_0x95ce('0x38'),'context':_0x2dfb2a['context'],'exten':_0x2dfb2a[_0x95ce('0x9')],'priority':_0xd41e55[_0x95ce('0x27')]+_0xa8d334[_0x95ce('0x16')]+_0x15c5eb++,'VoiceExtensionId':_0x2dfb2a['VoiceExtensionId']});_0x4059dc[_0x95ce('0x11')]({'type':_0x2dfb2a['type'],'app':_0x95ce('0x13'),'appdata':'XCALLY-MOTION-PROGRESS=1','context':_0x2dfb2a[_0x95ce('0x1b')],'exten':_0x2dfb2a[_0x95ce('0x9')],'priority':_0xd41e55[_0x95ce('0x27')]+_0xa8d334['priority']+_0x15c5eb++,'VoiceExtensionId':_0x2dfb2a[_0x95ce('0x17')]});}}}for(var _0x2e4f32=0x0;_0x2e4f32<_0xd41e55[_0x95ce('0x27')];_0x2e4f32+=0x1){var _0x55a8e7=_0xa8d334['priority']+_0xd41e55[_0x95ce('0x27')];var _0x294ef6=_0x2e4f32===_0xd41e55[_0x95ce('0x27')]-0x1?_0xa8d334[_0x95ce('0x16')]+_0x4059dc[_0x95ce('0x27')]+_0x2e0012[_0x95ce('0x27')]+0x2:_0xa8d334[_0x95ce('0x16')]+_0x2e4f32+0x1;_0x4059dc[_0x95ce('0x39')](_0x2e4f32,0x0,{'type':_0x2dfb2a[_0x95ce('0x12')],'app':_0x95ce('0x3a'),'appdata':_0xd41e55[_0x2e4f32]+'?'+_0x2dfb2a[_0x95ce('0x1b')]+_0x95ce('0x3b')+_0x55a8e7+':'+_0x2dfb2a[_0x95ce('0x1b')]+_0x95ce('0x3b')+_0x294ef6,'exten':_0x2dfb2a[_0x95ce('0x9')],'context':_0x2dfb2a[_0x95ce('0x1b')],'priority':_0xa8d334[_0x95ce('0x16')]+_0x2e4f32,'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')]});}_0x2dfb2a['priority']=_0x4059dc[_0x95ce('0x27')]?_[_0x95ce('0x3c')](_0x4059dc)['priority']+0x1:_0xa8d334[_0x95ce('0x16')];_0xa8d334[_0x95ce('0x16')]=(_0x2e0012['length']?_['last'](_0x2e0012)[_0x95ce('0x16')]:_0x2dfb2a[_0x95ce('0x16')])+0x1;_0xa8d334[_0x95ce('0xe')]=_[_0x95ce('0x3d')](_0xa8d334['extensions'],_0x4059dc,[_0x2dfb2a],_0x2e0012);}_0xa8d334['extensions'][_0x95ce('0x11')]({'type':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x12')],'app':_0x95ce('0x3e'),'exten':_0x4ae36c[_0x1f2914][0x0]['exten'],'context':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x1b')],'priority':_0xa8d334[_0x95ce('0x16')],'VoiceExtensionId':_0x4ae36c[_0x1f2914][0x0][_0x95ce('0x17')]});_0x4426af['push'](_0x4ae36c[_0x1f2914][0x0]['VoiceExtensionId']);_0x8f9138=_['concat'](_0x8f9138,_0xa8d334[_0x95ce('0xe')]);}}return _0xbe18f6[_0x95ce('0x3f')](function(_0x253ae4){return _0xbe18f6[_0x95ce('0x1')][_0x95ce('0x6')][_0x95ce('0x40')]({'where':{'VoiceExtensionId':{'$in':_0x4426af}},'transaction':_0x253ae4})['then'](function(_0x561e84){return _0xbe18f6[_0x95ce('0x1')][_0x95ce('0x6')]['bulkCreate'](_[_0x95ce('0x41')](_0x8f9138,_0x95ce('0x16')),{'transaction':_0x253ae4});});});})[_0x95ce('0x42')](function(_0x225a65){console[_0x95ce('0x43')](_0x225a65);});}exports[_0x95ce('0x44')]=rewrite; \ No newline at end of file +var _0x7c71=['intervals','VoiceExtension','IntervalId','findAll','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','extension','find','push','type','Set','format','CDR(type)=%s','context','outbound','${EXTEN:','cutdigits','${EXTEN}','VoiceExtensionId','CDR(routeid)=','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','length','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','answer','indexOf','app','appType','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','bulkCreate','sortBy','error','rewrite','lodash','util','models','Interval','then'];(function(_0x782a7d,_0x1533e5){var _0x2f4c5d=function(_0x382788){while(--_0x382788){_0x782a7d['push'](_0x782a7d['shift']());}};_0x2f4c5d(++_0x1533e5);}(_0x7c71,0x8d));var _0x17c7=function(_0x401d67,_0xeb1592){_0x401d67=_0x401d67-0x0;var _0x25076b=_0x7c71[_0x401d67];return _0x25076b;};'use strict';var _=require(_0x17c7('0x0'));var util=require(_0x17c7('0x1'));function rewrite(_0x11076d,_0x1522ea){var _0x57270a=this;return _0x11076d[_0x17c7('0x2')][_0x17c7('0x3')]['findAll']({'raw':!![]})[_0x17c7('0x4')](function(_0x4354eb){_0x57270a[_0x17c7('0x5')]=_0x4354eb;return _0x11076d[_0x17c7('0x2')][_0x17c7('0x6')]['findAll']({'where':{'IntervalId':_0x1522ea[_0x17c7('0x7')]},'raw':!![]});})[_0x17c7('0x4')](function(_0x14fb59){return _0x11076d['models'][_0x17c7('0x6')][_0x17c7('0x8')]({'where':{'exten':{'$in':_[_0x17c7('0x9')](_[_0x17c7('0xa')](_0x14fb59,_0x17c7('0xb')))}},'order':[{'raw':_0x17c7('0xc')}],'raw':!![]});})[_0x17c7('0x4')](function(_0x4cf524){var _0x51ffce=_[_0x17c7('0xd')](_0x4cf524,{'priority':'1'});var _0xf1326c=_[_0x17c7('0xd')](_0x4cf524,{'isApp':0x1});var _0x31c313=_[_0x17c7('0xe')](_0xf1326c,_0x17c7('0xb'));var _0x4fdc2c=[_0x17c7('0xf'),_0x17c7('0x10')];var _0x9343bd=[];var _0x3f8034=[];for(var _0x576a13 in _0x31c313){if(_0x31c313['hasOwnProperty'](_0x576a13)){_0x57270a[_0x17c7('0x11')]=0x2;_0x57270a[_0x17c7('0x12')]=[];_0x57270a[_0x17c7('0x13')]=_[_0x17c7('0x14')](_0x51ffce,{'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')]});_0x57270a[_0x17c7('0x12')][_0x17c7('0x15')]({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':util[_0x17c7('0x18')](_0x17c7('0x19'),_0x31c313[_0x576a13][0x0][_0x17c7('0x16')]),'context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a[_0x17c7('0x11')]++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0]['VoiceExtensionId']});if(_0x31c313[_0x576a13][0x0]['type']===_0x17c7('0x1b')){if(_0x57270a[_0x17c7('0x13')]){_0x57270a[_0x17c7('0x12')]['push']({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':'CDR(destination)='+(_0x57270a['extension']['cutdigits']?_0x17c7('0x1c')+_0x57270a['extension'][_0x17c7('0x1d')]+'}':_0x17c7('0x1e')),'context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a['priority']++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')]});}_0x57270a['extensions'][_0x17c7('0x15')]({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':_0x17c7('0x20')+_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')],'context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a[_0x17c7('0x11')]++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0]['VoiceExtensionId']});var _0x3e99e2=_0x57270a[_0x17c7('0x11')]++;_0x57270a[_0x17c7('0x12')]['push']({'type':_0x31c313[_0x576a13][0x0]['type'],'app':_0x17c7('0x21'),'appdata':_0x17c7('0x22')+(_0x3e99e2+0x2)+_0x17c7('0x23')+(_0x3e99e2+0x1)+')','context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x3e99e2,'VoiceExtensionId':_0x31c313[_0x576a13][0x0]['VoiceExtensionId']});if(_0x57270a[_0x17c7('0x13')]){_0x57270a[_0x17c7('0x12')][_0x17c7('0x15')]({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':_0x57270a[_0x17c7('0x13')][_0x17c7('0x1d')]?_0x17c7('0x24')+_0x57270a['extension']['cutdigits']+'}':_0x17c7('0x25'),'context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a[_0x17c7('0x11')]++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0]['VoiceExtensionId']});}_0x57270a['extensions'][_0x17c7('0x15')]({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':_0x17c7('0x26')+_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')],'context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a[_0x17c7('0x11')]++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0]['VoiceExtensionId']});if(_0x57270a[_0x17c7('0x13')]&&_0x57270a['extension'][_0x17c7('0x27')](_0x17c7('0x28'))&&_0x57270a['extension'][_0x17c7('0x28')]!=='none'){_0x57270a['extensions'][_0x17c7('0x15')]({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':_0x17c7('0x29'),'context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a['priority']++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')]});_0x57270a[_0x17c7('0x12')][_0x17c7('0x15')]({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':_0x17c7('0x2a')+_0x57270a[_0x17c7('0x13')]['recordingFormat']||'wav','context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a[_0x17c7('0x11')]++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')]});}}_0x57270a[_0x17c7('0x12')][_0x17c7('0x15')]({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':_0x17c7('0x2b'),'context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a[_0x17c7('0x11')]++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')]});_0x57270a[_0x17c7('0x12')][_0x17c7('0x15')]({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':'Set','appdata':_0x17c7('0x2c'),'context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a[_0x17c7('0x11')]++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0]['VoiceExtensionId']});_0x57270a['extensions']['push']({'type':_0x31c313[_0x576a13][0x0][_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':_0x17c7('0x2d'),'context':_0x31c313[_0x576a13][0x0]['context'],'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'priority':_0x57270a[_0x17c7('0x11')]++,'VoiceExtensionId':_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')]});for(var _0x14888f=0x0,_0x53aba2=0x0;_0x14888f<_0x31c313[_0x576a13][_0x17c7('0x2e')];_0x14888f+=0x1,_0x53aba2=0x0){var _0x3e2caa=_0x31c313[_0x576a13][_0x14888f];if(_0x3e2caa[_0x17c7('0x16')]){_0x3e2caa[_0x17c7('0x16')]=_0x3e2caa[_0x17c7('0x16')][_0x17c7('0x2f')]();}var _0x517b9f=[];var _0x3f2ba5=[];delete _0x3e2caa['id'];delete _0x3e2caa[_0x17c7('0x30')];delete _0x3e2caa[_0x17c7('0x31')];var _0x382283=_0x3e2caa[_0x17c7('0x32')]!==_0x17c7('0x33')?[_0x3e2caa[_0x17c7('0x32')]]:_0x3e2caa[_0x17c7('0x7')]?_[_0x17c7('0xa')](_['filter'](_0x57270a[_0x17c7('0x5')],{'IntervalId':_0x3e2caa[_0x17c7('0x7')]}),_0x17c7('0x32')):[];if(_0x3e2caa[_0x17c7('0x27')](_0x17c7('0x34'))){if(_0x3e2caa[_0x17c7('0x34')]&&_0x3e2caa['tag']!=='--'){_0x517b9f[_0x17c7('0x15')]({'type':_0x3e2caa[_0x17c7('0x16')],'app':'Set','appdata':_0x17c7('0x35')+_0x3e2caa[_0x17c7('0x34')],'context':_0x3e2caa['context'],'exten':_0x3e2caa[_0x17c7('0xb')],'priority':_0x382283[_0x17c7('0x2e')]+_0x57270a[_0x17c7('0x11')]+_0x53aba2++,'VoiceExtensionId':_0x3e2caa[_0x17c7('0x1f')]});}}if(_0x3e2caa['type']==='outbound'&&_0x3e2caa[_0x17c7('0x27')](_0x17c7('0x36'))){if(_0x3e2caa[_0x17c7('0x36')]){_0x517b9f[_0x17c7('0x15')]({'type':_0x3e2caa['type'],'app':_0x17c7('0x21'),'appdata':_0x17c7('0x37')+_0x3e2caa[_0x17c7('0x36')]+')','context':_0x3e2caa['context'],'exten':_0x3e2caa['exten'],'priority':_0x382283[_0x17c7('0x2e')]+_0x57270a[_0x17c7('0x11')]+_0x53aba2++,'VoiceExtensionId':_0x3e2caa[_0x17c7('0x1f')]});}else{_0x517b9f[_0x17c7('0x15')]({'type':_0x3e2caa[_0x17c7('0x16')],'app':'ExecIf','appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','context':_0x3e2caa[_0x17c7('0x1a')],'exten':_0x3e2caa[_0x17c7('0xb')],'priority':_0x382283[_0x17c7('0x2e')]+_0x57270a['priority']+_0x53aba2++,'VoiceExtensionId':_0x3e2caa['VoiceExtensionId']});}}if(_0x3e2caa[_0x17c7('0x27')](_0x17c7('0x38'))){if(_0x4fdc2c[_0x17c7('0x39')](_0x3e2caa[_0x17c7('0x3a')][_0x17c7('0x2f')]())>=0x0&&_0x3e2caa[_0x17c7('0x3b')]!==_0x17c7('0x3c')){if(_0x3e2caa[_0x17c7('0x38')]){_0x517b9f[_0x17c7('0x15')]({'type':_0x3e2caa[_0x17c7('0x16')],'app':_0x17c7('0x21'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x3e2caa[_0x17c7('0x1a')],'exten':_0x3e2caa[_0x17c7('0xb')],'priority':_0x382283['length']+_0x57270a[_0x17c7('0x11')]+_0x53aba2++,'VoiceExtensionId':_0x3e2caa[_0x17c7('0x1f')]});_0x517b9f[_0x17c7('0x15')]({'type':_0x3e2caa['type'],'app':_0x17c7('0x17'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0x3e2caa['context'],'exten':_0x3e2caa[_0x17c7('0xb')],'priority':_0x382283[_0x17c7('0x2e')]+_0x57270a[_0x17c7('0x11')]+_0x53aba2++,'VoiceExtensionId':_0x3e2caa['VoiceExtensionId']});}else{_0x517b9f[_0x17c7('0x15')]({'type':_0x3e2caa[_0x17c7('0x16')],'app':_0x17c7('0x21'),'appdata':_0x17c7('0x3d'),'context':_0x3e2caa[_0x17c7('0x1a')],'exten':_0x3e2caa[_0x17c7('0xb')],'priority':_0x382283['length']+_0x57270a[_0x17c7('0x11')]+_0x53aba2++,'VoiceExtensionId':_0x3e2caa[_0x17c7('0x1f')]});_0x517b9f[_0x17c7('0x15')]({'type':_0x3e2caa[_0x17c7('0x16')],'app':_0x17c7('0x17'),'appdata':_0x17c7('0x3e'),'context':_0x3e2caa[_0x17c7('0x1a')],'exten':_0x3e2caa['exten'],'priority':_0x382283[_0x17c7('0x2e')]+_0x57270a['priority']+_0x53aba2++,'VoiceExtensionId':_0x3e2caa['VoiceExtensionId']});}}}for(var _0x18a82b=0x0;_0x18a82b<_0x382283[_0x17c7('0x2e')];_0x18a82b+=0x1){var _0x565c42=_0x57270a[_0x17c7('0x11')]+_0x382283[_0x17c7('0x2e')];var _0x5f1d24=_0x18a82b===_0x382283[_0x17c7('0x2e')]-0x1?_0x57270a[_0x17c7('0x11')]+_0x517b9f[_0x17c7('0x2e')]+_0x3f2ba5[_0x17c7('0x2e')]+0x2:_0x57270a[_0x17c7('0x11')]+_0x18a82b+0x1;_0x517b9f[_0x17c7('0x3f')](_0x18a82b,0x0,{'type':_0x3e2caa[_0x17c7('0x16')],'app':_0x17c7('0x40'),'appdata':_0x382283[_0x18a82b]+'?'+_0x3e2caa[_0x17c7('0x1a')]+_0x17c7('0x41')+_0x565c42+':'+_0x3e2caa[_0x17c7('0x1a')]+',${EXTEN},'+_0x5f1d24,'exten':_0x3e2caa[_0x17c7('0xb')],'context':_0x3e2caa['context'],'priority':_0x57270a['priority']+_0x18a82b,'VoiceExtensionId':_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')]});}_0x3e2caa[_0x17c7('0x11')]=_0x517b9f[_0x17c7('0x2e')]?_[_0x17c7('0x42')](_0x517b9f)[_0x17c7('0x11')]+0x1:_0x57270a['priority'];_0x57270a[_0x17c7('0x11')]=(_0x3f2ba5[_0x17c7('0x2e')]?_['last'](_0x3f2ba5)[_0x17c7('0x11')]:_0x3e2caa['priority'])+0x1;_0x57270a[_0x17c7('0x12')]=_['concat'](_0x57270a[_0x17c7('0x12')],_0x517b9f,[_0x3e2caa],_0x3f2ba5);}_0x57270a['extensions']['push']({'type':_0x31c313[_0x576a13][0x0]['type'],'app':_0x17c7('0x43'),'exten':_0x31c313[_0x576a13][0x0][_0x17c7('0xb')],'context':_0x31c313[_0x576a13][0x0][_0x17c7('0x1a')],'priority':_0x57270a['priority'],'VoiceExtensionId':_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')]});_0x9343bd[_0x17c7('0x15')](_0x31c313[_0x576a13][0x0][_0x17c7('0x1f')]);_0x3f8034=_[_0x17c7('0x44')](_0x3f8034,_0x57270a[_0x17c7('0x12')]);}}return _0x11076d['transaction'](function(_0x2264c8){return _0x11076d[_0x17c7('0x2')][_0x17c7('0x6')]['destroy']({'where':{'VoiceExtensionId':{'$in':_0x9343bd}},'transaction':_0x2264c8})[_0x17c7('0x4')](function(_0x10d728){return _0x11076d[_0x17c7('0x2')][_0x17c7('0x6')][_0x17c7('0x45')](_[_0x17c7('0x46')](_0x3f8034,_0x17c7('0x11')),{'transaction':_0x2264c8});});});})['catch'](function(_0x175a32){console[_0x17c7('0x47')](_0x175a32);});}exports[_0x17c7('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index 7fc8134..3930102 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 _0x54ba=['bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/logger','api','redis','defaults','localhost','../../../api/cmContact/cmContact.socket','argv','null','Missing\x20filepath\x20parameter!','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','contact','index','test','isNil','error','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','map','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','birthDate','YYYY-MM-DD','isValid','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','duplicate','Duplicate\x20Contact','create','push','pick','stringify','checkHopper','inspect','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','id\x20IN\x20?','str','calleridnum','cm_hopper_final','VoiceQueue','findAll','outbound','Lists','then','dialCheckDuplicateType','always','sequelize','query','VoiceQueueId','onlyIfOpen','catch','all','CmList','BlackLists','get','Campaign','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','emit','contact:csv_','resume','exit','info','CSV\x20import\x20process\x20stopped!','resolve','CmContact','createReadStream','parse','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54ba,0x6e));var _0xa54b=function(_0x2e7ac4,_0x289171){_0x2e7ac4=_0x2e7ac4-0x0;var _0x49a4a8=_0x54ba[_0x2e7ac4];return _0x49a4a8;};'use strict';var BPromise=require(_0xa54b('0x0'));var util=require(_0xa54b('0x1'));var _=require(_0xa54b('0x2'));var fs=require('fs');var squel=require(_0xa54b('0x3'));var Papa=require(_0xa54b('0x4'));var Redis=require('ioredis');var db=require(_0xa54b('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0xa54b('0x6'))(_0xa54b('0x7'));config[_0xa54b('0x8')]=_[_0xa54b('0x9')](config[_0xa54b('0x8')],{'host':_0xa54b('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xa54b('0xb'))['register'](socket);try{if(!process[_0xa54b('0xc')][0x2]||process[_0xa54b('0xc')][0x2]==='undefined'||process[_0xa54b('0xc')][0x2]===_0xa54b('0xd')){throw new Error(_0xa54b('0xe'));}var FILEPATH=process[_0xa54b('0xc')][0x2];if(!process['argv'][0x3]||process[_0xa54b('0xc')][0x3]===_0xa54b('0xf')||process['argv'][0x3]===_0xa54b('0xd')||!process[_0xa54b('0xc')][0x4]||process[_0xa54b('0xc')][0x4]===_0xa54b('0xf')||process[_0xa54b('0xc')][0x4]===_0xa54b('0xd')){throw new Error(_0xa54b('0x10'));}var FIELDS=_[_0xa54b('0x11')](process[_0xa54b('0xc')][0x3][_0xa54b('0x12')](','),process[_0xa54b('0xc')][0x4][_0xa54b('0x12')](','));if(!process[_0xa54b('0xc')][0x5]||process[_0xa54b('0xc')][0x5]===_0xa54b('0xf')||process['argv'][0x5]==='null'){throw new Error(_0xa54b('0x13'));}var LISTID=process[_0xa54b('0xc')][0x5];var COMPANYID=process['argv'][0x6]&&process['argv'][0x6]!=='undefined'&&process['argv'][0x6]!=='null'?process[_0xa54b('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process['argv'][0x7]!==_0xa54b('0xf')&&process['argv'][0x7]!=='null'?process['argv'][0x7]:null;if(!process[_0xa54b('0xc')][0x8]||process['argv'][0x8]===_0xa54b('0xf')||process[_0xa54b('0xc')][0x8]===_0xa54b('0xd')){throw new Error(_0xa54b('0x14'));}var SOCKET_TIMESTAMP=process[_0xa54b('0xc')][0x8];}catch(_0x50fccd){logger['error'](_0x50fccd);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(_0x3be621,_0x271c8b,_0x1171e3,_0x24ab3b){var _0x347807={'message':_0x271c8b};_0x347807[_0x3be621]=!![];if(_0x1171e3){_0x347807[_0xa54b('0x15')]=_0x1171e3;}if(_0x24ab3b){_0x347807[_0xa54b('0x16')]=_0x24ab3b;}return _0x347807;}function isEmail(_0x4cbad5){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))*$/[_0xa54b('0x17')](_0x4cbad5);}function checkRow(_0x8d35fd,_0x2fe9c2,_0x165fc3){return new BPromise(function(_0x371b94,_0x15b0a4){if(_[_0xa54b('0x18')](_0x8d35fd)){return _0x15b0a4(handleCheckRowError(_0xa54b('0x19'),_0xa54b('0x1a'),null,_0x165fc3));}if(_0x8d35fd[_0xa54b('0x1b')]&&_0x8d35fd[_0xa54b('0x1b')]['length']){var _0x4c3bb3=_[_0xa54b('0x1c')](_0x8d35fd[_0xa54b('0x1b')],_0xa54b('0x1d'))[_0xa54b('0x1e')](';');return _0x15b0a4(handleCheckRowError('error',_0x4c3bb3,null,_0x165fc3));}var _0x5e2e5b={};for(var _0x222017 in FIELDS){if(FIELDS[_0xa54b('0x1f')](_0x222017)&&FIELDS[_0x222017]){_0x5e2e5b[_0x222017]=_0x8d35fd[_0xa54b('0x20')][0x0][FIELDS[_0x222017]]||_0x8d35fd[_0xa54b('0x20')][0x0]['\ufeff'+FIELDS[_0x222017]];}}if(!_0x5e2e5b[_0xa54b('0x21')]){return _0x15b0a4(handleCheckRowError('error',_0xa54b('0x22'),null,_0x165fc3));}if(!_0x5e2e5b[_0xa54b('0x23')]){return _0x15b0a4(handleCheckRowError('error',_0xa54b('0x24'),null,_0x165fc3));}if(_0x5e2e5b['birthDate']){var _0x2ffeff=moment(_0x5e2e5b[_0xa54b('0x25')],_0xa54b('0x26'));if(!_0x2ffeff[_0xa54b('0x27')]()){return _0x15b0a4(handleCheckRowError('error','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!',null,_0x165fc3));}}if(_0x5e2e5b['email']){if(!isEmail(_0x5e2e5b[_0xa54b('0x28')])){return _0x15b0a4(handleCheckRowError('error',_0xa54b('0x29'),null,_0x165fc3));}}_0x5e2e5b[_0xa54b('0x2a')]=LISTID;_0x5e2e5b[_0xa54b('0x2b')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xa54b('0x2c')]&&_0x2fe9c2){var _0x382515={};for(var _0x2cd81a=0x0,_0x183bf7=DUPLICATES[_0xa54b('0x2c')];_0x2cd81a<_0x183bf7;_0x2cd81a+=0x1){_0x382515[DUPLICATES[_0x2cd81a]]=_0x5e2e5b[DUPLICATES[_0x2cd81a]];}var _0x33e88c=_[_0xa54b('0x2d')](_0x2fe9c2,_0x382515);if(_0x33e88c){return _0x15b0a4(handleCheckRowError(_0xa54b('0x2e'),_0xa54b('0x2f'),_0x33e88c,_0x165fc3));}}return db['CmContact'][_0xa54b('0x30')](_0x5e2e5b,{'raw':!![],'hooks':![],'fields':_['keys'](_0x5e2e5b)})['then'](function(_0x1654fc){if(DUPLICATES&&DUPLICATES[_0xa54b('0x2c')]&&_0x2fe9c2){_0x2fe9c2[_0xa54b('0x31')](_[_0xa54b('0x32')](_0x5e2e5b,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1654fc['id'];return _0x371b94();})['catch'](function(_0x5dd1a6){return _0x15b0a4(handleCheckRowError(_0xa54b('0x19'),'Error\x20while\x20creating\x20contact:\x20'+(_0x5dd1a6[_0xa54b('0x1d')]||JSON[_0xa54b('0x33')](_0x5dd1a6)),null,_0x165fc3));});});}function checkHopper(){function _0x4ce958(){return function(_0x3c313c){logger['error']('cmContact',_0xa54b('0x34'),util[_0xa54b('0x35')](_0x3c313c,{'showHidden':![],'depth':null}));};}var _0x57212e=function(_0x147df5,_0x2e76e2){var _0x1e254e=squel[_0xa54b('0x36')]()[_0xa54b('0x37')](_0xa54b('0x38'))['fromQuery']([_0xa54b('0x23'),_0xa54b('0x39'),_0xa54b('0x3a'),_0xa54b('0x2a'),_0x2e76e2,_0xa54b('0x3b'),_0xa54b('0x3c')],squel[_0xa54b('0x3d')]()[_0xa54b('0x3e')](_0xa54b('0x23'),_0xa54b('0x23'))[_0xa54b('0x3e')](_0xa54b('0x3f'),_0xa54b('0x39'))['field']('id',_0xa54b('0x3a'))[_0xa54b('0x3e')](LISTID[_0xa54b('0x40')](),_0xa54b('0x2a'))['field'](_0x147df5['id'][_0xa54b('0x40')](),_0x2e76e2)['field'](_0xa54b('0x3f'),'createdAt')[_0xa54b('0x3e')](_0xa54b('0x3f'),'updatedAt')[_0xa54b('0x41')](_0xa54b('0x42'))[_0xa54b('0x43')](_0xa54b('0x44'))[_0xa54b('0x43')](_0xa54b('0x45'),LISTID['toString']())[_0xa54b('0x43')](_0xa54b('0x46'))['where'](_0xa54b('0x47'),squel[_0xa54b('0x3d')]()[_0xa54b('0x3e')](_0xa54b('0x23'))['from'](_0xa54b('0x38'))[_0xa54b('0x43')](_0x2e76e2+_0xa54b('0x48'),_0x147df5['id'][_0xa54b('0x40')]())))['toString']();return _0x1e254e;};var _0x1c7a94=function(_0x2a4c82,_0xf56cb9){var _0x190b4b=squel['insert']()[_0xa54b('0x37')](_0xa54b('0x38'))[_0xa54b('0x49')](['phone',_0xa54b('0x39'),_0xa54b('0x3a'),_0xa54b('0x2a'),_0xf56cb9,'createdAt',_0xa54b('0x3c')],squel['select']()[_0xa54b('0x3e')](_0xa54b('0x23'),'phone')[_0xa54b('0x3e')]('NOW()',_0xa54b('0x39'))[_0xa54b('0x3e')]('id','ContactId')[_0xa54b('0x3e')](LISTID[_0xa54b('0x40')](),_0xa54b('0x2a'))[_0xa54b('0x3e')](_0x2a4c82['id'][_0xa54b('0x40')](),_0xf56cb9)[_0xa54b('0x3e')]('NOW()',_0xa54b('0x3b'))['field'](_0xa54b('0x3f'),_0xa54b('0x3c'))[_0xa54b('0x41')](_0xa54b('0x42'))[_0xa54b('0x43')](_0xa54b('0x44'))[_0xa54b('0x43')]('ListId\x20=\x20?',LISTID[_0xa54b('0x40')]())['where'](_0xa54b('0x4a'),squel[_0xa54b('0x4b')](hopperContacts))[_0xa54b('0x43')](_0xa54b('0x46'))['where'](_0xa54b('0x47'),squel[_0xa54b('0x3d')]()[_0xa54b('0x3e')](_0xa54b('0x4c'))[_0xa54b('0x41')](_0xa54b('0x4d'))[_0xa54b('0x43')](_0xf56cb9+_0xa54b('0x48'),_0x2a4c82['id'][_0xa54b('0x40')]()))[_0xa54b('0x43')](_0xa54b('0x47'),squel['select']()[_0xa54b('0x3e')](_0xa54b('0x23'))[_0xa54b('0x41')]('cm_hopper')[_0xa54b('0x43')](_0xf56cb9+'\x20=\x20?',_0x2a4c82['id']['toString']())))[_0xa54b('0x40')]();return _0x190b4b;};function _0x462695(_0x27b6a5,_0x3ed39f){var _0x5f1aa9=squel['insert']()['into'](_0xa54b('0x38'))[_0xa54b('0x49')](['phone','scheduledAt',_0xa54b('0x3a'),_0xa54b('0x2a'),_0x3ed39f,_0xa54b('0x3b'),_0xa54b('0x3c')],squel[_0xa54b('0x3d')]()['field'](_0xa54b('0x23'),_0xa54b('0x23'))[_0xa54b('0x3e')](_0xa54b('0x3f'),'scheduledAt')['field']('id','ContactId')['field'](LISTID[_0xa54b('0x40')](),'ListId')[_0xa54b('0x3e')](_0x27b6a5['id'][_0xa54b('0x40')](),_0x3ed39f)['field'](_0xa54b('0x3f'),_0xa54b('0x3b'))['field']('NOW()',_0xa54b('0x3c'))['from']('cm_contacts')[_0xa54b('0x43')](_0xa54b('0x44'))['where'](_0xa54b('0x45'),LISTID[_0xa54b('0x40')]())['where'](_0xa54b('0x4a'),squel[_0xa54b('0x4b')](hopperContacts))['where'](_0xa54b('0x46')))[_0xa54b('0x40')]();return _0x5f1aa9;}function _0xc7650b(_0x1c6b5c,_0x40b43c){var _0x5f43dd=squel[_0xa54b('0x36')]()[_0xa54b('0x37')]('cm_hopper_black')[_0xa54b('0x49')]([_0xa54b('0x23'),_0xa54b('0x3a'),_0xa54b('0x2a'),_0x40b43c,'createdAt',_0xa54b('0x3c')],squel[_0xa54b('0x3d')]()[_0xa54b('0x3e')]('phone',_0xa54b('0x23'))[_0xa54b('0x3e')]('id',_0xa54b('0x3a'))[_0xa54b('0x3e')](LISTID[_0xa54b('0x40')](),_0xa54b('0x2a'))[_0xa54b('0x3e')](_0x1c6b5c['id'][_0xa54b('0x40')](),_0x40b43c)[_0xa54b('0x3e')](_0xa54b('0x3f'),_0xa54b('0x3b'))['field'](_0xa54b('0x3f'),'updatedAt')[_0xa54b('0x41')]('cm_contacts')[_0xa54b('0x43')](_0xa54b('0x44'))[_0xa54b('0x43')]('ListId\x20=\x20?',LISTID[_0xa54b('0x40')]())['where'](_0xa54b('0x4a'),squel[_0xa54b('0x4b')](hopperContacts))[_0xa54b('0x43')](_0xa54b('0x46')))['toString']();return _0x5f43dd;}return db[_0xa54b('0x4e')][_0xa54b('0x4f')]({'where':{'type':_0xa54b('0x50')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xa54b('0x51'),'where':{'id':LISTID}}]})[_0xa54b('0x52')](function(_0x3959bb){var _0x139694=[];if(_0x3959bb){var _0x312cbe;for(var _0x350f26=0x0,_0x47fd31;_0x350f26<_0x3959bb['length'];_0x350f26+=0x1){_0x47fd31=_0x3959bb[_0x350f26]['get']({'plain':!![]});switch(_0x47fd31[_0xa54b('0x53')]){case _0xa54b('0x54'):_0x139694[_0xa54b('0x31')](db[_0xa54b('0x55')][_0xa54b('0x56')](_0x1c7a94(_0x47fd31,_0xa54b('0x57')))[_0xa54b('0x52')](function(){})['catch'](_0x4ce958()));break;case _0xa54b('0x58'):_0x139694['push'](db['sequelize'][_0xa54b('0x56')](_0x57212e(_0x47fd31,_0xa54b('0x57')))[_0xa54b('0x52')](function(){})[_0xa54b('0x59')](_0x4ce958()));break;default:_0x139694[_0xa54b('0x31')](db[_0xa54b('0x55')]['query'](_0x462695(_0x47fd31,'VoiceQueueId'))[_0xa54b('0x52')](function(){})[_0xa54b('0x59')](_0x4ce958()));}}}return _0x139694;})[_0xa54b('0x5a')]()[_0xa54b('0x52')](function(){return db[_0xa54b('0x4e')][_0xa54b('0x4f')]({'where':{'type':_0xa54b('0x50')},'attributes':['id'],'include':[{'model':db[_0xa54b('0x5b')],'as':_0xa54b('0x5c'),'where':{'id':LISTID}}]})[_0xa54b('0x52')](function(_0x9d656b){var _0x3d78c8=[];if(_0x9d656b){var _0xacbad4;for(var _0x78ae75=0x0,_0x40ad4f;_0x78ae75<_0x9d656b[_0xa54b('0x2c')];_0x78ae75+=0x1){_0x40ad4f=_0x9d656b[_0x78ae75][_0xa54b('0x5d')]({'plain':!![]});_0x3d78c8[_0xa54b('0x31')](db['sequelize'][_0xa54b('0x56')](_0xc7650b(_0x40ad4f,_0xa54b('0x57')))[_0xa54b('0x52')](function(){})[_0xa54b('0x59')](_0x4ce958()));}}return _0x3d78c8;})[_0xa54b('0x5a')]();})[_0xa54b('0x52')](function(){return db[_0xa54b('0x5e')][_0xa54b('0x4f')]({'attributes':['id',_0xa54b('0x53')],'include':[{'model':db['CmList'],'as':_0xa54b('0x51'),'where':{'id':LISTID}}]})['then'](function(_0x49c6e8){var _0xe7a302=[];if(_0x49c6e8){for(var _0xc8259=0x0,_0x350e28;_0xc8259<_0x49c6e8[_0xa54b('0x2c')];_0xc8259+=0x1){_0x350e28=_0x49c6e8[_0xc8259][_0xa54b('0x5d')]({'plain':!![]});switch(_0x350e28['dialCheckDuplicateType']){case _0xa54b('0x54'):_0xe7a302[_0xa54b('0x31')](db[_0xa54b('0x55')][_0xa54b('0x56')](_0x1c7a94(_0x350e28,_0xa54b('0x5f')))['then'](function(){})[_0xa54b('0x59')](_0x4ce958()));break;case'onlyIfOpen':_0xe7a302[_0xa54b('0x31')](db[_0xa54b('0x55')][_0xa54b('0x56')](_0x57212e(_0x350e28,'CampaignId'))['then'](function(){})[_0xa54b('0x59')](_0x4ce958()));break;default:_0xe7a302[_0xa54b('0x31')](db[_0xa54b('0x55')][_0xa54b('0x56')](_0x462695(_0x350e28,'CampaignId'))['then'](function(){})[_0xa54b('0x59')](_0x4ce958()));}}}return _0xe7a302;})[_0xa54b('0x5a')]();})[_0xa54b('0x52')](function(){return db[_0xa54b('0x5e')][_0xa54b('0x4f')]({'attributes':['id'],'include':[{'model':db['CmList'],'as':_0xa54b('0x5c'),'where':{'id':LISTID}}]})['then'](function(_0x5e6e85){var _0x5459f2=[];if(_0x5e6e85){for(var _0x529265=0x0,_0x1f2173;_0x529265<_0x5e6e85[_0xa54b('0x2c')];_0x529265+=0x1){_0x1f2173=_0x5e6e85[_0x529265][_0xa54b('0x5d')]({'plain':!![]});_0x5459f2['push'](db[_0xa54b('0x55')]['query'](_0xc7650b(_0x1f2173,_0xa54b('0x5f')))[_0xa54b('0x52')](function(){})[_0xa54b('0x59')](_0x4ce958()));}}return _0x5459f2;})[_0xa54b('0x5a')]();})[_0xa54b('0x59')](function(_0x224593){logger['error'](_0xa54b('0x60'),_0xa54b('0x61'),_0x224593['message']);});}var processPromises=function(_0x4af506){return BPromise[_0xa54b('0x5a')](promises)[_0xa54b('0x52')](function(_0x220b77){})[_0xa54b('0x59')](function(_0x167907){logger[_0xa54b('0x19')]('Error\x20processing\x20rows\x20block:',JSON[_0xa54b('0x33')](_0x167907));})['finally'](function(){socket[_0xa54b('0x62')](_0xa54b('0x63')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4af506){return _0x4af506[_0xa54b('0x64')]();}});};var endCsv=function(){return BPromise['resolve']()[_0xa54b('0x52')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket['emit']('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x496da5){logger[_0xa54b('0x19')]('Unable\x20to\x20delete\x20temp\x20file:',JSON[_0xa54b('0x33')](_0x496da5));}finally{process[_0xa54b('0x65')](0x0);}});};process['on']('SIGINT',function(){logger[_0xa54b('0x66')](_0xa54b('0x67'));endCsv();});function main(){return BPromise[_0xa54b('0x68')]()[_0xa54b('0x52')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xa54b('0x69')][_0xa54b('0x4f')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xa54b('0x52')](function(_0x4cbb59){var _0x593328=fs[_0xa54b('0x6a')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xa54b('0x6b')](_0x593328,{'header':!![],'skipEmptyLines':!![],'step':function(_0x466116,_0x6f8225){total+=0x1;var _0x408912=total;promises[_0xa54b('0x31')](checkRow(_0x466116,_0x4cbb59,_0x408912)[_0xa54b('0x52')](function(){success+=0x1;})['catch'](function(_0x330dc6){if(_0x330dc6[_0xa54b('0x19')]){errors+=0x1;delete _0x330dc6['error'];}else if(_0x330dc6['duplicate']){duplicates+=0x1;delete _0x330dc6[_0xa54b('0x2e')];}rows[_0xa54b('0x31')](_0x330dc6);}));if(total%0xc8===0x0){_0x6f8225['pause']();return processPromises(_0x6f8225);}},'complete':function(){return processPromises()[_0xa54b('0x52')](function(){logger[_0xa54b('0x66')](_0xa54b('0x6c'));endCsv();});},'error':function(_0x1709cb,_0x1f799b){logger[_0xa54b('0x66')](_0xa54b('0x6d'),JSON[_0xa54b('0x33')](_0x1709cb));endCsv();}});})[_0xa54b('0x59')](function(_0x17dddd){logger['error']('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0xa54b('0x33')](_0x17dddd));});}main(); \ No newline at end of file +var _0x2fec=['CompanyId','find','duplicate','CmContact','create','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','cmContact','inspect','insert','cm_hopper','scheduledAt','ContactId','createdAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','into','id\x20IN\x20?','str','calleridnum','cm_hopper_final','\x20=\x20?','updatedAt','ListId\x20=\x20?','cm_hopper_black','fromQuery','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','sequelize','then','onlyIfOpen','query','VoiceQueueId','BlackLists','always','CampaignId','all','Campaign','Error\x20processing\x20rows\x20block:','emit','contact:csv_','resume','unlinkSync','Unable\x20to\x20delete\x20temp\x20file:','exit','SIGINT','createReadStream','parse','pause','info','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','../../../mysqldb','../../../config/environment','../../../config/logger','redis','localhost','socket.io-emitter','../../../api/cmContact/cmContact.socket','register','argv','null','undefined','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','errors','length','map','message','hasOwnProperty','data','firstName\x20not\x20specified!','phone','phone\x20not\x20specified!','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId'];(function(_0x474313,_0x50048d){var _0x185aa2=function(_0x2a1609){while(--_0x2a1609){_0x474313['push'](_0x474313['shift']());}};_0x185aa2(++_0x50048d);}(_0x2fec,0x192));var _0xc2fe=function(_0x34a846,_0x28fffd){_0x34a846=_0x34a846-0x0;var _0x232c1f=_0x2fec[_0x34a846];return _0x232c1f;};'use strict';var BPromise=require(_0xc2fe('0x0'));var util=require(_0xc2fe('0x1'));var _=require(_0xc2fe('0x2'));var fs=require('fs');var squel=require(_0xc2fe('0x3'));var Papa=require(_0xc2fe('0x4'));var Redis=require('ioredis');var db=require(_0xc2fe('0x5'))['db'];var config=require(_0xc2fe('0x6'));var logger=require(_0xc2fe('0x7'))('api');config[_0xc2fe('0x8')]=_['defaults'](config[_0xc2fe('0x8')],{'host':_0xc2fe('0x9'),'port':0x18eb});var socket=require(_0xc2fe('0xa'))(new Redis(config[_0xc2fe('0x8')]));require(_0xc2fe('0xb'))[_0xc2fe('0xc')](socket);try{if(!process[_0xc2fe('0xd')][0x2]||process[_0xc2fe('0xd')][0x2]==='undefined'||process[_0xc2fe('0xd')][0x2]===_0xc2fe('0xe')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0xc2fe('0xd')][0x2];if(!process[_0xc2fe('0xd')][0x3]||process[_0xc2fe('0xd')][0x3]===_0xc2fe('0xf')||process[_0xc2fe('0xd')][0x3]===_0xc2fe('0xe')||!process[_0xc2fe('0xd')][0x4]||process[_0xc2fe('0xd')][0x4]==='undefined'||process[_0xc2fe('0xd')][0x4]===_0xc2fe('0xe')){throw new Error(_0xc2fe('0x10'));}var FIELDS=_[_0xc2fe('0x11')](process['argv'][0x3][_0xc2fe('0x12')](','),process[_0xc2fe('0xd')][0x4][_0xc2fe('0x12')](','));if(!process[_0xc2fe('0xd')][0x5]||process[_0xc2fe('0xd')][0x5]===_0xc2fe('0xf')||process['argv'][0x5]===_0xc2fe('0xe')){throw new Error(_0xc2fe('0x13'));}var LISTID=process[_0xc2fe('0xd')][0x5];var COMPANYID=process[_0xc2fe('0xd')][0x6]&&process[_0xc2fe('0xd')][0x6]!==_0xc2fe('0xf')&&process[_0xc2fe('0xd')][0x6]!==_0xc2fe('0xe')?process[_0xc2fe('0xd')][0x6]:null;var DUPLICATES=process[_0xc2fe('0xd')][0x7]&&process[_0xc2fe('0xd')][0x7]!==_0xc2fe('0xf')&&process[_0xc2fe('0xd')][0x7]!==_0xc2fe('0xe')?process['argv'][0x7]:null;if(!process[_0xc2fe('0xd')][0x8]||process[_0xc2fe('0xd')][0x8]==='undefined'||process['argv'][0x8]===_0xc2fe('0xe')){throw new Error(_0xc2fe('0x14'));}var SOCKET_TIMESTAMP=process[_0xc2fe('0xd')][0x8];}catch(_0xc71c65){logger[_0xc2fe('0x15')](_0xc71c65);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(_0x5f3088,_0x5f3824,_0x17dcd4,_0x33e9cd){var _0x77fae9={'message':_0x5f3824};_0x77fae9[_0x5f3088]=!![];if(_0x17dcd4){_0x77fae9[_0xc2fe('0x16')]=_0x17dcd4;}if(_0x33e9cd){_0x77fae9[_0xc2fe('0x17')]=_0x33e9cd;}return _0x77fae9;}function isEmail(_0x1481c8){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))*$/[_0xc2fe('0x18')](_0x1481c8);}function checkRow(_0x2ae9d9,_0x518732,_0x3c3831){return new BPromise(function(_0x4ec928,_0x56074c){if(_[_0xc2fe('0x19')](_0x2ae9d9)){return _0x56074c(handleCheckRowError(_0xc2fe('0x15'),_0xc2fe('0x1a'),null,_0x3c3831));}if(_0x2ae9d9[_0xc2fe('0x1b')]&&_0x2ae9d9[_0xc2fe('0x1b')][_0xc2fe('0x1c')]){var _0x14cd54=_[_0xc2fe('0x1d')](_0x2ae9d9[_0xc2fe('0x1b')],_0xc2fe('0x1e'))['join'](';');return _0x56074c(handleCheckRowError(_0xc2fe('0x15'),_0x14cd54,null,_0x3c3831));}var _0xdc334c={};for(var _0x517e3a in FIELDS){if(FIELDS[_0xc2fe('0x1f')](_0x517e3a)&&FIELDS[_0x517e3a]){_0xdc334c[_0x517e3a]=_0x2ae9d9[_0xc2fe('0x20')][0x0][FIELDS[_0x517e3a]]||_0x2ae9d9[_0xc2fe('0x20')][0x0]['\ufeff'+FIELDS[_0x517e3a]];}}if(!_0xdc334c['firstName']){return _0x56074c(handleCheckRowError(_0xc2fe('0x15'),_0xc2fe('0x21'),null,_0x3c3831));}if(!_0xdc334c[_0xc2fe('0x22')]){return _0x56074c(handleCheckRowError(_0xc2fe('0x15'),_0xc2fe('0x23'),null,_0x3c3831));}if(_0xdc334c['birthDate']){var _0x25634a=moment(_0xdc334c['birthDate'],_0xc2fe('0x24'));if(!_0x25634a[_0xc2fe('0x25')]()){return _0x56074c(handleCheckRowError(_0xc2fe('0x15'),_0xc2fe('0x26'),null,_0x3c3831));}}if(_0xdc334c[_0xc2fe('0x27')]){if(!isEmail(_0xdc334c[_0xc2fe('0x27')])){return _0x56074c(handleCheckRowError(_0xc2fe('0x15'),_0xc2fe('0x28'),null,_0x3c3831));}}_0xdc334c[_0xc2fe('0x29')]=LISTID;_0xdc334c[_0xc2fe('0x2a')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES[_0xc2fe('0x1c')]&&_0x518732){var _0x3f20a2={};for(var _0x36e654=0x0,_0x27f3b2=DUPLICATES[_0xc2fe('0x1c')];_0x36e654<_0x27f3b2;_0x36e654+=0x1){_0x3f20a2[DUPLICATES[_0x36e654]]=_0xdc334c[DUPLICATES[_0x36e654]];}var _0x2a1d71=_[_0xc2fe('0x2b')](_0x518732,_0x3f20a2);if(_0x2a1d71){return _0x56074c(handleCheckRowError(_0xc2fe('0x2c'),'Duplicate\x20Contact',_0x2a1d71,_0x3c3831));}}return db[_0xc2fe('0x2d')][_0xc2fe('0x2e')](_0xdc334c,{'raw':!![],'hooks':![],'fields':_['keys'](_0xdc334c)})['then'](function(_0x56557a){if(DUPLICATES&&DUPLICATES[_0xc2fe('0x1c')]&&_0x518732){_0x518732[_0xc2fe('0x2f')](_[_0xc2fe('0x30')](_0xdc334c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x56557a['id'];return _0x4ec928();})[_0xc2fe('0x31')](function(_0x4f93f9){return _0x56074c(handleCheckRowError(_0xc2fe('0x15'),_0xc2fe('0x32')+(_0x4f93f9[_0xc2fe('0x1e')]||JSON[_0xc2fe('0x33')](_0x4f93f9)),null,_0x3c3831));});});}function checkHopper(){function _0x591d01(){return function(_0x15b461){logger['error'](_0xc2fe('0x34'),'checkHopper',util[_0xc2fe('0x35')](_0x15b461,{'showHidden':![],'depth':null}));};}var _0xb8e27e=function(_0x408ca8,_0x202cfb){var _0x574946=squel[_0xc2fe('0x36')]()['into'](_0xc2fe('0x37'))['fromQuery'](['phone',_0xc2fe('0x38'),_0xc2fe('0x39'),_0xc2fe('0x29'),_0x202cfb,_0xc2fe('0x3a'),'updatedAt'],squel[_0xc2fe('0x3b')]()[_0xc2fe('0x3c')](_0xc2fe('0x22'),'phone')[_0xc2fe('0x3c')](_0xc2fe('0x3d'),_0xc2fe('0x38'))[_0xc2fe('0x3c')]('id','ContactId')[_0xc2fe('0x3c')](LISTID[_0xc2fe('0x3e')](),_0xc2fe('0x29'))[_0xc2fe('0x3c')](_0x408ca8['id'][_0xc2fe('0x3e')](),_0x202cfb)['field'](_0xc2fe('0x3d'),'createdAt')[_0xc2fe('0x3c')](_0xc2fe('0x3d'),'updatedAt')[_0xc2fe('0x3f')](_0xc2fe('0x40'))[_0xc2fe('0x41')](_0xc2fe('0x42'))[_0xc2fe('0x41')]('ListId\x20=\x20?',LISTID['toString']())[_0xc2fe('0x41')](_0xc2fe('0x43'))['where'](_0xc2fe('0x44'),squel[_0xc2fe('0x3b')]()[_0xc2fe('0x3c')](_0xc2fe('0x22'))[_0xc2fe('0x3f')](_0xc2fe('0x37'))[_0xc2fe('0x41')](_0x202cfb+'\x20=\x20?',_0x408ca8['id'][_0xc2fe('0x3e')]())))['toString']();return _0x574946;};var _0x2a7625=function(_0x55aa27,_0x5e2c19){var _0x585eb6=squel[_0xc2fe('0x36')]()[_0xc2fe('0x45')](_0xc2fe('0x37'))['fromQuery']([_0xc2fe('0x22'),_0xc2fe('0x38'),'ContactId','ListId',_0x5e2c19,_0xc2fe('0x3a'),'updatedAt'],squel[_0xc2fe('0x3b')]()[_0xc2fe('0x3c')](_0xc2fe('0x22'),'phone')[_0xc2fe('0x3c')]('NOW()','scheduledAt')[_0xc2fe('0x3c')]('id',_0xc2fe('0x39'))[_0xc2fe('0x3c')](LISTID['toString'](),_0xc2fe('0x29'))[_0xc2fe('0x3c')](_0x55aa27['id'][_0xc2fe('0x3e')](),_0x5e2c19)[_0xc2fe('0x3c')](_0xc2fe('0x3d'),_0xc2fe('0x3a'))[_0xc2fe('0x3c')](_0xc2fe('0x3d'),'updatedAt')[_0xc2fe('0x3f')](_0xc2fe('0x40'))[_0xc2fe('0x41')]('deletedAt\x20IS\x20NULL')[_0xc2fe('0x41')]('ListId\x20=\x20?',LISTID[_0xc2fe('0x3e')]())['where'](_0xc2fe('0x46'),squel[_0xc2fe('0x47')](hopperContacts))['where'](_0xc2fe('0x43'))[_0xc2fe('0x41')](_0xc2fe('0x44'),squel[_0xc2fe('0x3b')]()[_0xc2fe('0x3c')](_0xc2fe('0x48'))['from'](_0xc2fe('0x49'))['where'](_0x5e2c19+'\x20=\x20?',_0x55aa27['id'][_0xc2fe('0x3e')]()))[_0xc2fe('0x41')](_0xc2fe('0x44'),squel['select']()[_0xc2fe('0x3c')]('phone')[_0xc2fe('0x3f')](_0xc2fe('0x37'))[_0xc2fe('0x41')](_0x5e2c19+_0xc2fe('0x4a'),_0x55aa27['id'][_0xc2fe('0x3e')]())))['toString']();return _0x585eb6;};function _0x14c3c0(_0x1f619f,_0x41ff32){var _0x4ee7dc=squel[_0xc2fe('0x36')]()['into'](_0xc2fe('0x37'))['fromQuery'](['phone',_0xc2fe('0x38'),_0xc2fe('0x39'),_0xc2fe('0x29'),_0x41ff32,_0xc2fe('0x3a'),_0xc2fe('0x4b')],squel[_0xc2fe('0x3b')]()[_0xc2fe('0x3c')]('phone',_0xc2fe('0x22'))[_0xc2fe('0x3c')](_0xc2fe('0x3d'),'scheduledAt')['field']('id',_0xc2fe('0x39'))[_0xc2fe('0x3c')](LISTID[_0xc2fe('0x3e')](),_0xc2fe('0x29'))[_0xc2fe('0x3c')](_0x1f619f['id'][_0xc2fe('0x3e')](),_0x41ff32)['field']('NOW()',_0xc2fe('0x3a'))['field'](_0xc2fe('0x3d'),'updatedAt')['from']('cm_contacts')[_0xc2fe('0x41')]('deletedAt\x20IS\x20NULL')[_0xc2fe('0x41')](_0xc2fe('0x4c'),LISTID[_0xc2fe('0x3e')]())['where'](_0xc2fe('0x46'),squel[_0xc2fe('0x47')](hopperContacts))[_0xc2fe('0x41')](_0xc2fe('0x43')))[_0xc2fe('0x3e')]();return _0x4ee7dc;}function _0x46feb6(_0x252d73,_0x39a957){var _0x30814b=squel[_0xc2fe('0x36')]()[_0xc2fe('0x45')](_0xc2fe('0x4d'))[_0xc2fe('0x4e')](['phone',_0xc2fe('0x39'),'ListId',_0x39a957,_0xc2fe('0x3a'),_0xc2fe('0x4b')],squel['select']()['field'](_0xc2fe('0x22'),_0xc2fe('0x22'))[_0xc2fe('0x3c')]('id',_0xc2fe('0x39'))[_0xc2fe('0x3c')](LISTID[_0xc2fe('0x3e')](),_0xc2fe('0x29'))[_0xc2fe('0x3c')](_0x252d73['id'][_0xc2fe('0x3e')](),_0x39a957)['field'](_0xc2fe('0x3d'),_0xc2fe('0x3a'))[_0xc2fe('0x3c')](_0xc2fe('0x3d'),_0xc2fe('0x4b'))[_0xc2fe('0x3f')]('cm_contacts')[_0xc2fe('0x41')]('deletedAt\x20IS\x20NULL')[_0xc2fe('0x41')]('ListId\x20=\x20?',LISTID[_0xc2fe('0x3e')]())['where'](_0xc2fe('0x46'),squel[_0xc2fe('0x47')](hopperContacts))['where']('phone\x20IS\x20NOT\x20NULL'))[_0xc2fe('0x3e')]();return _0x30814b;}return db[_0xc2fe('0x4f')][_0xc2fe('0x50')]({'where':{'type':_0xc2fe('0x51')},'attributes':['id',_0xc2fe('0x52')],'include':[{'model':db[_0xc2fe('0x53')],'as':_0xc2fe('0x54'),'where':{'id':LISTID}}]})['then'](function(_0x1b81bd){var _0x3b6793=[];if(_0x1b81bd){var _0x462b4c;for(var _0x5b9738=0x0,_0x57dd8f;_0x5b9738<_0x1b81bd[_0xc2fe('0x1c')];_0x5b9738+=0x1){_0x57dd8f=_0x1b81bd[_0x5b9738][_0xc2fe('0x55')]({'plain':!![]});switch(_0x57dd8f['dialCheckDuplicateType']){case'always':_0x3b6793[_0xc2fe('0x2f')](db[_0xc2fe('0x56')]['query'](_0x2a7625(_0x57dd8f,'VoiceQueueId'))[_0xc2fe('0x57')](function(){})['catch'](_0x591d01()));break;case _0xc2fe('0x58'):_0x3b6793[_0xc2fe('0x2f')](db[_0xc2fe('0x56')][_0xc2fe('0x59')](_0xb8e27e(_0x57dd8f,_0xc2fe('0x5a')))[_0xc2fe('0x57')](function(){})[_0xc2fe('0x31')](_0x591d01()));break;default:_0x3b6793[_0xc2fe('0x2f')](db['sequelize'][_0xc2fe('0x59')](_0x14c3c0(_0x57dd8f,'VoiceQueueId'))[_0xc2fe('0x57')](function(){})[_0xc2fe('0x31')](_0x591d01()));}}}return _0x3b6793;})['all']()['then'](function(){return db[_0xc2fe('0x4f')][_0xc2fe('0x50')]({'where':{'type':_0xc2fe('0x51')},'attributes':['id'],'include':[{'model':db[_0xc2fe('0x53')],'as':_0xc2fe('0x5b'),'where':{'id':LISTID}}]})[_0xc2fe('0x57')](function(_0x419770){var _0x3693d1=[];if(_0x419770){var _0x33edb6;for(var _0x1636f3=0x0,_0x48bced;_0x1636f3<_0x419770[_0xc2fe('0x1c')];_0x1636f3+=0x1){_0x48bced=_0x419770[_0x1636f3][_0xc2fe('0x55')]({'plain':!![]});_0x3693d1[_0xc2fe('0x2f')](db[_0xc2fe('0x56')][_0xc2fe('0x59')](_0x46feb6(_0x48bced,_0xc2fe('0x5a')))[_0xc2fe('0x57')](function(){})[_0xc2fe('0x31')](_0x591d01()));}}return _0x3693d1;})['all']();})[_0xc2fe('0x57')](function(){return db['Campaign'][_0xc2fe('0x50')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':_0xc2fe('0x54'),'where':{'id':LISTID}}]})[_0xc2fe('0x57')](function(_0x2f84a2){var _0x5dde73=[];if(_0x2f84a2){for(var _0x1e3dee=0x0,_0x2ebd69;_0x1e3dee<_0x2f84a2[_0xc2fe('0x1c')];_0x1e3dee+=0x1){_0x2ebd69=_0x2f84a2[_0x1e3dee][_0xc2fe('0x55')]({'plain':!![]});switch(_0x2ebd69[_0xc2fe('0x52')]){case _0xc2fe('0x5c'):_0x5dde73[_0xc2fe('0x2f')](db['sequelize']['query'](_0x2a7625(_0x2ebd69,_0xc2fe('0x5d')))['then'](function(){})[_0xc2fe('0x31')](_0x591d01()));break;case _0xc2fe('0x58'):_0x5dde73[_0xc2fe('0x2f')](db[_0xc2fe('0x56')]['query'](_0xb8e27e(_0x2ebd69,_0xc2fe('0x5d')))[_0xc2fe('0x57')](function(){})[_0xc2fe('0x31')](_0x591d01()));break;default:_0x5dde73[_0xc2fe('0x2f')](db[_0xc2fe('0x56')][_0xc2fe('0x59')](_0x14c3c0(_0x2ebd69,'CampaignId'))['then'](function(){})[_0xc2fe('0x31')](_0x591d01()));}}}return _0x5dde73;})[_0xc2fe('0x5e')]();})[_0xc2fe('0x57')](function(){return db[_0xc2fe('0x5f')][_0xc2fe('0x50')]({'attributes':['id'],'include':[{'model':db[_0xc2fe('0x53')],'as':'BlackLists','where':{'id':LISTID}}]})[_0xc2fe('0x57')](function(_0x5d9d5f){var _0x387710=[];if(_0x5d9d5f){for(var _0x5548d6=0x0,_0x5eaf52;_0x5548d6<_0x5d9d5f['length'];_0x5548d6+=0x1){_0x5eaf52=_0x5d9d5f[_0x5548d6][_0xc2fe('0x55')]({'plain':!![]});_0x387710['push'](db[_0xc2fe('0x56')][_0xc2fe('0x59')](_0x46feb6(_0x5eaf52,'CampaignId'))['then'](function(){})[_0xc2fe('0x31')](_0x591d01()));}}return _0x387710;})['all']();})[_0xc2fe('0x31')](function(_0x4e065c){logger['error']('cmContact,\x20%s,\x20%s','generalCheckHopper',_0x4e065c[_0xc2fe('0x1e')]);});}var processPromises=function(_0x14c60f){return BPromise[_0xc2fe('0x5e')](promises)['then'](function(_0xf94d6){})[_0xc2fe('0x31')](function(_0x300c02){logger[_0xc2fe('0x15')](_0xc2fe('0x60'),JSON[_0xc2fe('0x33')](_0x300c02));})['finally'](function(){socket[_0xc2fe('0x61')](_0xc2fe('0x62')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x14c60f){return _0x14c60f[_0xc2fe('0x63')]();}});};var endCsv=function(){return BPromise['resolve']()['then'](function(){if(hopperContacts){return checkHopper();}})[_0xc2fe('0x57')](function(){socket[_0xc2fe('0x61')]('contact:csv_'+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0xc2fe('0x64')](FILEPATH);}catch(_0x4231b9){logger['error'](_0xc2fe('0x65'),JSON['stringify'](_0x4231b9));}finally{process[_0xc2fe('0x66')](0x0);}});};process['on'](_0xc2fe('0x67'),function(){logger['info']('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise['resolve']()[_0xc2fe('0x57')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES[_0xc2fe('0x12')](',');return db[_0xc2fe('0x2d')][_0xc2fe('0x50')]({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xc2fe('0x57')](function(_0x57c3eb){var _0x9cc193=fs[_0xc2fe('0x68')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xc2fe('0x69')](_0x9cc193,{'header':!![],'skipEmptyLines':!![],'step':function(_0x4290c5,_0x384e6b){total+=0x1;var _0x2db056=total;promises[_0xc2fe('0x2f')](checkRow(_0x4290c5,_0x57c3eb,_0x2db056)[_0xc2fe('0x57')](function(){success+=0x1;})[_0xc2fe('0x31')](function(_0x1b3c78){if(_0x1b3c78[_0xc2fe('0x15')]){errors+=0x1;delete _0x1b3c78['error'];}else if(_0x1b3c78[_0xc2fe('0x2c')]){duplicates+=0x1;delete _0x1b3c78[_0xc2fe('0x2c')];}rows[_0xc2fe('0x2f')](_0x1b3c78);}));if(total%0xc8===0x0){_0x384e6b[_0xc2fe('0x6a')]();return processPromises(_0x384e6b);}},'complete':function(){return processPromises()['then'](function(){logger[_0xc2fe('0x6b')](_0xc2fe('0x6c'));endCsv();});},'error':function(_0x5dbbc9,_0x298b8c){logger[_0xc2fe('0x6b')](_0xc2fe('0x6d'),JSON[_0xc2fe('0x33')](_0x5dbbc9));endCsv();}});})[_0xc2fe('0x31')](function(_0x5d2fd9){logger[_0xc2fe('0x15')](_0xc2fe('0x6e'),JSON[_0xc2fe('0x33')](_0x5d2fd9));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 67e1b6e..d40159b 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 _0xf44a=['stringify','send','start','binding','socket_timestamp','root','server/files/tmp','writeFileSync','parse','createReadStream','data','length','trim','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','priority','isNaN','UserId','isNumber','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','isValid','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','\x20not\x20specified','SystemRow','rows','emit','contact:import:','Abort\x20parser','abort','SystemError','step','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','VoiceQueueId','campaigns_has_cm_lists','CampaignId','campaigns','each','affectedRows','unlink','exit','complete','argv','arguments\x20\x20\x20','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','body\x20id\x20mandatory','map','SIGINT','uncaughtException','papaparse','bluebird','moment','ioredis','../../../config/environment','../../../config/logger','import','redis','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','phone','join','.id\x20=\x20','where','\x20=\x20','cm_contacts.phone','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ContactId','ListId','createdAt','updatedAt','recallme','select','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22onlyIfOpen\x22','toString','cm_contacts.id','into','cm_hopper_black','fields','ListId\x20=\x20?','\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','field','MIN(id)','min_id','group','info','Received\x20SIGINT','error','message','errors','push','sequelize','query','spread','catch','main'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf44a,0xbb));var _0xaf44=function(_0x4ba3de,_0x44d777){_0x4ba3de=_0x4ba3de-0x0;var _0x32c87a=_0xf44a[_0x4ba3de];return _0x32c87a;};'use strict';var fs=require('fs');var path=require('path');var _=require('lodash');var Papa=require(_0xaf44('0x0'));var util=require('util');var BPromise=require(_0xaf44('0x1'));var moment=require(_0xaf44('0x2'));var squel=require('squel');var Redis=require(_0xaf44('0x3'));var db=require('../../../mysqldb')['db'];var config=require(_0xaf44('0x4'));var logger=require(_0xaf44('0x5'))(_0xaf44('0x6'));config[_0xaf44('0x7')]=_['defaults'](config[_0xaf44('0x7')],{'host':_0xaf44('0x8'),'port':0x18eb});var socket=require(_0xaf44('0x9'))(new Redis(config[_0xaf44('0x7')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0xaf44('0xa')](_0xaf44('0xb'));function isEmail(_0x2485e8){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))*$/[_0xaf44('0xc')](_0x2485e8);}function selectNotIn(_0x24eb8f,_0x53793c,_0x5de300,_0x21b5f2,_0x241bb4){return squel['select']()['field'](_0xaf44('0xd'))['from'](_0x21b5f2)[_0xaf44('0xe')](_0x53793c,null,_0x53793c+_0xaf44('0xf')+_0x21b5f2+'.'+_0x5de300)[_0xaf44('0x10')](_0x21b5f2+'.'+_0x5de300+_0xaf44('0x11')+_0x24eb8f+'.'+_0x5de300)[_0xaf44('0x10')](_0x53793c+'.dialCheckDuplicateType\x20IN\x20('+_0x241bb4['join']()+')');}function insertCmHopper(_0x28eae8,_0x539395,_0x6b23e0,_0x1405c9,_0x5c9323){var _0x205eb2=[_0xaf44('0x12'),'cm_contacts.scheduledat','cm_contacts.id',_0xaf44('0x13'),_0x539395+'.'+_0x1405c9,_0xaf44('0x14'),_0xaf44('0x15'),_0xaf44('0x16'),_0xaf44('0x17'),'\x22'+_0x5c9323+'\x22'];return squel[_0xaf44('0x18')]()['into'](_0xaf44('0x19'))[_0xaf44('0x1a')]([_0xaf44('0xd'),_0xaf44('0x1b'),_0xaf44('0x1c'),_0xaf44('0x1d'),_0x1405c9,_0xaf44('0x1e'),_0xaf44('0x1f'),'priority','UserId',_0xaf44('0x20')],squel[_0xaf44('0x21')]()['fields'](_0x205eb2)[_0xaf44('0x22')](_0x539395)['join'](_0xaf44('0x23'),null,_0xaf44('0x24')+_0x539395+_0xaf44('0x25'))[_0xaf44('0xe')](_0x6b23e0,null,_0x6b23e0+_0xaf44('0xf')+_0x539395+'.'+_0x1405c9)[_0xaf44('0x10')](_0x539395+'.CmListId\x20=\x20?',_0x28eae8)[_0xaf44('0x10')](_0xaf44('0x26'),NOW)[_0xaf44('0x10')](_0xaf44('0x27'),selectNotIn(_0x539395,_0x6b23e0,_0x1405c9,_0xaf44('0x19'),['\x22always\x22',_0xaf44('0x28')]))['where'](_0xaf44('0x27'),selectNotIn(_0x539395,_0x6b23e0,_0x1405c9,_0xaf44('0x19'),['\x22always\x22'])))[_0xaf44('0x29')]();}function insertCmHopperBlack(_0x1f0021,_0x2dbc7f,_0x2a212e,_0x2fac90){var _0x2fff5c=['cm_contacts.phone',_0xaf44('0x2a'),_0xaf44('0x13'),_0x2dbc7f+'.'+_0x2fac90,_0xaf44('0x14'),'cm_contacts.updatedAt'];return squel['insert']()[_0xaf44('0x2b')](_0xaf44('0x2c'))[_0xaf44('0x1a')](['phone',_0xaf44('0x1c'),_0xaf44('0x1d'),_0x2fac90,'createdAt','updatedAt'],squel[_0xaf44('0x21')]()[_0xaf44('0x2d')](_0x2fff5c)[_0xaf44('0x22')](_0x2dbc7f)[_0xaf44('0xe')](_0xaf44('0x23'),null,_0xaf44('0x24')+_0x2dbc7f+'.CmListId')['join'](_0x2a212e,null,_0x2a212e+'.id\x20=\x20'+_0x2dbc7f+'.'+_0x2fac90)[_0xaf44('0x10')](_0x2dbc7f+'.CmListId\x20=\x20?',_0x1f0021)[_0xaf44('0x10')](_0xaf44('0x26'),NOW)[_0xaf44('0x10')](_0xaf44('0x27'),squel[_0xaf44('0x21')]()['field']('phone')['from'](_0xaf44('0x2c'))[_0xaf44('0x10')](_0xaf44('0x2e'),_0x1f0021)[_0xaf44('0x10')](_0x2fac90+_0xaf44('0x2f'),_0x2dbc7f+'.'+_0x2fac90)))[_0xaf44('0x29')]();}function insertCmContact(_0x2e95fa,_0x4090a4,_0x5da8d5,_0x3def90){var _0x585eb5=_[_0xaf44('0x30')](_[_0xaf44('0x31')](_0x3def90),[_0xaf44('0x1d'),_0xaf44('0x32'),_0xaf44('0x1e'),_0xaf44('0x1f')]);return squel[_0xaf44('0x18')]()[_0xaf44('0x2b')](_0xaf44('0x23'))['fromQuery'](_0x585eb5,squel[_0xaf44('0x21')]()[_0xaf44('0x2d')](_0x585eb5)['from'](_0x4090a4)[_0xaf44('0x10')]('('+_0x5da8d5[_0xaf44('0xe')](',')+_0xaf44('0x33'),squel[_0xaf44('0x21')]()[_0xaf44('0x2d')](_0x5da8d5)[_0xaf44('0x22')](_0xaf44('0x23'))[_0xaf44('0x10')](_0xaf44('0x2e'),_0x2e95fa)[_0xaf44('0x10')](_0xaf44('0x34')))[_0xaf44('0x10')](_0xaf44('0x35'),squel['select']()[_0xaf44('0x36')](_0xaf44('0x37'),_0xaf44('0x38'))['from'](_0x4090a4)[_0xaf44('0x39')](_0x5da8d5[_0xaf44('0xe')](','))))['toString']();}function handleStop(){logger[_0xaf44('0x3a')](_0xaf44('0x3b'));stopped=!![];}function handleUncaughtException(_0x4d327e){logger[_0xaf44('0x3c')](_0x4d327e[_0xaf44('0x3d')]);process['exit'](0x1);}function handleError(_0x210c71,_0x193566){stats[_0xaf44('0x3e')][_0xaf44('0x3f')]({'name':_0x193566['code'],'message':_0x193566[_0xaf44('0x3d')],'row':_0x210c71});}function handleQuery(_0x10aabf){logger['info'](_0x10aabf);return db[_0xaf44('0x40')][_0xaf44('0x41')](_0x10aabf)[_0xaf44('0x42')](function(_0x108be2){results[_0xaf44('0x3f')](_0x108be2);})[_0xaf44('0x43')](function(_0x366eff){logger[_0xaf44('0x3c')](_0x366eff['message']);});}function main(_0x3de8d0,_0x5059b7,_0x525910,_0x1111c1){logger[_0xaf44('0x3a')](_0xaf44('0x44'),_0x3de8d0,JSON[_0xaf44('0x45')](_0x5059b7));process[_0xaf44('0x46')](_0xaf44('0x47'));var _0x5e6d4e=_0x5059b7[_0xaf44('0x48')];var _0x1fbc7a=_0x5059b7[_0xaf44('0x49')];var _0x1f587a=path['join'](config[_0xaf44('0x4a')],_0xaf44('0x4b'),_0x1fbc7a+'.csv');var _0x263d98=_[_0xaf44('0x31')](_0x5e6d4e)['join']();logger[_0xaf44('0x3a')]('header',_0x263d98);fs[_0xaf44('0x4c')](_0x1f587a,_0x263d98+'\x0a');Papa[_0xaf44('0x4d')](fs[_0xaf44('0x4e')](_0x3de8d0),{'header':!![],'skipEmptyLines':!![],'step':function(_0x2128b2,_0x4cdb3c){try{for(var _0x46fbe7=0x0,_0x247f02=[];_0x46fbe7<_0x2128b2[_0xaf44('0x4f')][_0xaf44('0x50')];_0x46fbe7++){stats['rows']+=0x1;if(_0x2128b2['errors'][_0x46fbe7]){handleError(_0x2128b2[_0xaf44('0x4f')][_0x46fbe7],_0x2128b2['errors'][_0x46fbe7]);}else{var _0x35cf77=[];for(var _0x37d8bd in _0x5e6d4e){if(_0x5e6d4e['hasOwnProperty'](_0x37d8bd)){if(_0x2128b2[_0xaf44('0x4f')][_0x46fbe7][_0x5e6d4e[_0x37d8bd]]){var _0x5cd524=_[_0xaf44('0x51')](_0x2128b2['data'][_0x46fbe7][_0x5e6d4e[_0x37d8bd]]['replace'](/"/g,'\x27'));switch(_0x37d8bd){case _0xaf44('0x1b'):var _0x147c1c=moment(_0x5cd524,_0xaf44('0xb'),!![]);if(_0x147c1c['isValid']()){_0x247f02[_0xaf44('0x3f')]('\x22'+_0x5cd524+'\x22');}else{_0x35cf77[_0xaf44('0x3f')](_0xaf44('0x52'));}break;case _0xaf44('0x53'):var _0x329f7c=parseInt(_0x5cd524);_0x5cd524=_[_0xaf44('0x54')](_0x329f7c)||_0x329f7c<0x0||_0x329f7c>0x4?_0x1111c1?0x3:0x2:_0x329f7c;_0x247f02[_0xaf44('0x3f')]('\x22'+_0x5cd524+'\x22');break;case _0xaf44('0x55'):var _0x4f556b=parseInt(_0x5cd524);if(_[_0xaf44('0x56')](_0x4f556b)&&_['includes'](_0x525910,_0x4f556b)){_0x247f02[_0xaf44('0x3f')]('\x22'+_0x4f556b+'\x22');}else{_0x35cf77['push'](_0xaf44('0x57'));}break;case _0xaf44('0x58'):if(isEmail(_0x5cd524)){_0x247f02[_0xaf44('0x3f')]('\x22'+_0x5cd524+'\x22');}else{_0x35cf77[_0xaf44('0x3f')]('email\x20wrong\x20format');}break;case _0xaf44('0x59'):var _0x459080=moment(_0x5cd524,_0xaf44('0x5a'),!![]);if(_0x459080[_0xaf44('0x5b')]()){_0x247f02[_0xaf44('0x3f')]('\x22'+_0x5cd524+'\x22');}else{_0x35cf77[_0xaf44('0x3f')](_0xaf44('0x5c'));}break;default:_0x247f02['push']('\x22'+_0x5cd524+'\x22');}}else{switch(_0x37d8bd){case'firstName':case _0xaf44('0xd'):_0x35cf77[_0xaf44('0x3f')](_0x37d8bd+_0xaf44('0x5d'));break;default:_0x247f02[_0xaf44('0x3f')]('\x22\x22');}}}}if(_0x35cf77[_0xaf44('0x50')]){handleError(_0x2128b2[_0xaf44('0x4f')][_0x46fbe7],{'code':_0xaf44('0x5e'),'message':_0x35cf77['join']()});}else{fs['appendFileSync'](_0x1f587a,_0x247f02['join']()+'\x0a');}_0x247f02=[];}if(!(stats[_0xaf44('0x5f')]%0xc8)){socket[_0xaf44('0x60')](_0xaf44('0x61')+_0x1fbc7a,stats);stats[_0xaf44('0x3e')]=[];}}if(stopped){logger[_0xaf44('0x3a')](_0xaf44('0x62'));_0x4cdb3c[_0xaf44('0x63')]();}}catch(_0x5c3481){handleError(_0x2128b2[_0xaf44('0x4f')][_0x46fbe7],{'code':_0xaf44('0x64'),'message':_0x5c3481[_0xaf44('0x3d')]});logger[_0xaf44('0x3c')](_0xaf44('0x65'),_0x5c3481[_0xaf44('0x3d')]);}},'complete':function(){try{var _0x517886=[];var _0x251769='cm_contacts';if(_0x5059b7[_0xaf44('0x66')]&&_0x5059b7['duplicates'][_0xaf44('0x50')]){_0x251769=_0xaf44('0x67')+_0x1fbc7a;_0x517886[_0xaf44('0x3f')]('CREATE\x20TABLE\x20'+_0x251769+_0xaf44('0x68'));}var _0x306ea1=util[_0xaf44('0xa')](_0xaf44('0x69'),_0x1f587a,_0x251769,_0x263d98,_0x5059b7[_0xaf44('0x1d')],_0x5059b7[_0xaf44('0x32')]||null,NOW,NOW);if(_[_0xaf44('0x6a')](_0x5e6d4e[_0xaf44('0x1b')])){_0x306ea1+=_0xaf44('0x6b');}_0x517886[_0xaf44('0x3f')](_0x306ea1);if(_0x5059b7[_0xaf44('0x66')]&&_0x5059b7[_0xaf44('0x66')][_0xaf44('0x50')]){_0x517886[_0xaf44('0x3f')](insertCmContact(_0x5059b7[_0xaf44('0x1d')],_0x251769,_0x5059b7['duplicates'],_0x5e6d4e));_0x517886[_0xaf44('0x3f')]('DROP\x20TABLE\x20'+_0x251769+';');}_0x517886[_0xaf44('0x3f')](insertCmHopper(_0x5059b7[_0xaf44('0x1d')],'voice_queues_has_cm_lists',_0xaf44('0x6c'),_0xaf44('0x6d'),_0x1111c1));_0x517886[_0xaf44('0x3f')](insertCmHopperBlack(_0x5059b7[_0xaf44('0x1d')],'voice_queues_has_cm_blacklists',_0xaf44('0x6c'),'VoiceQueueId'));_0x517886[_0xaf44('0x3f')](insertCmHopper(_0x5059b7['ListId'],_0xaf44('0x6e'),'campaigns',_0xaf44('0x6f'),_0x1111c1));_0x517886['push'](insertCmHopperBlack(_0x5059b7['ListId'],'campaigns_has_cm_blacklists',_0xaf44('0x70'),_0xaf44('0x6f')));BPromise[_0xaf44('0x71')](_0x517886,handleQuery)['then'](function(_0x3dd475){stats['finish']=!![];stats['affectedRows']=_0x5059b7[_0xaf44('0x66')]&&_0x5059b7['duplicates']['length']?results[0x2][_0xaf44('0x72')]:results[0x0][_0xaf44('0x72')];socket[_0xaf44('0x60')](_0xaf44('0x61')+_0x1fbc7a,stats);fs[_0xaf44('0x73')](_0x3de8d0);fs[_0xaf44('0x73')](_0x1f587a);process[_0xaf44('0x74')](0x0);})[_0xaf44('0x43')](function(_0x2252e1){logger[_0xaf44('0x3c')](_0x2252e1[_0xaf44('0x3d')]);process['exit'](0x1);});}catch(_0xe3e0a4){logger[_0xaf44('0x3c')](_0xaf44('0x75'),_0xe3e0a4['message']);process[_0xaf44('0x74')](0x1);}},'error':function(_0x2300e8,_0x27bf36,_0x10e36b,_0x5e9596){throw new Error(_0x5e9596);}});}function validate(){if(process[_0xaf44('0x76')]&&process['argv'][_0xaf44('0x50')]<0x4){throw new Error(_0xaf44('0x77'));}var _0x433097=path[_0xaf44('0xe')](config[_0xaf44('0x4a')],_0xaf44('0x4b'),process['argv'][0x2]);if(!fs['existsSync'](_0x433097)){throw new Error(_0xaf44('0x78'));}var _0x135936={};try{_0x135936=JSON[_0xaf44('0x4d')](process[_0xaf44('0x76')][0x3]);if(!_0x135936[_0xaf44('0x48')]){throw new Error(_0xaf44('0x79'));}if(!_0x135936[_0xaf44('0x48')]['phone']){throw new Error(_0xaf44('0x7a'));}if(!_0x135936[_0xaf44('0x48')]['firstName']){throw new Error(_0xaf44('0x7b'));}var _0x196517=0x0;if(_0x135936[_0xaf44('0x48')]['UserId']){_0x196517=0x1;}if(!_0x135936[_0xaf44('0x1d')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0x8bb06f){throw new Error(_0xaf44('0x7c'));}var _0x4429f5=[];try{_0x4429f5=_[_0xaf44('0x7d')](JSON[_0xaf44('0x4d')](process[_0xaf44('0x76')][0x4]),'id');}catch(_0x37a10a){logger[_0xaf44('0x3a')]('No\x20agent\x20available');}main(_0x433097,_0x135936,_0x4429f5,_0x196517);}validate();process['on'](_0xaf44('0x7e'),handleStop);process['on'](_0xaf44('0x7f'),handleUncaughtException); \ No newline at end of file +var _0x1606=['select','fields','from','cm_contacts','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','cm_hopper','\x22always\x22','\x22onlyIfOpen\x22','cm_hopper_black','updatedAt','\x20=\x20?','toString','concat','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','group','info','error','message','exit','push','code','sequelize','query','stringify','send','start','socket_timestamp','server/files/tmp','.csv','keys','header','writeFileSync','parse','data','rows','errors','hasOwnProperty','trim','replace','scheduledat','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNaN','isNumber','includes','agent\x20not\x20exists','email','dateOfBirth','YYYY-MM-DD','SystemRow','Abort\x20parser','abort','step','duplicates','cm_contacts_','CREATE\x20TABLE\x20','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()','length','DROP\x20TABLE\x20','VoiceQueueId','voice_queues_has_cm_blacklists','campaigns_has_cm_lists','campaigns','CampaignId','campaigns_has_cm_blacklists','each','finish','affectedRows','contact:import:','catch','complete','argv','arguments\x20\x20\x20','root','existsSync','file\x20doesn\x27t\x20exists','binding','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','path','lodash','util','bluebird','moment','../../../mysqldb','../../../config/logger','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','field','phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','fromQuery','ContactId','ListId','createdAt','priority','UserId','recallme'];(function(_0x9f721,_0x14bcc5){var _0x20052d=function(_0xba8047){while(--_0xba8047){_0x9f721['push'](_0x9f721['shift']());}};_0x20052d(++_0x14bcc5);}(_0x1606,0x162));var _0x6160=function(_0x34e066,_0x521ed3){_0x34e066=_0x34e066-0x0;var _0x280b0c=_0x1606[_0x34e066];return _0x280b0c;};'use strict';var fs=require('fs');var path=require(_0x6160('0x0'));var _=require(_0x6160('0x1'));var Papa=require('papaparse');var util=require(_0x6160('0x2'));var BPromise=require(_0x6160('0x3'));var moment=require(_0x6160('0x4'));var squel=require('squel');var Redis=require('ioredis');var db=require(_0x6160('0x5'))['db'];var config=require('../../../config/environment');var logger=require(_0x6160('0x6'))(_0x6160('0x7'));config[_0x6160('0x8')]=_[_0x6160('0x9')](config[_0x6160('0x8')],{'host':_0x6160('0xa'),'port':0x18eb});var socket=require(_0x6160('0xb'))(new Redis(config[_0x6160('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var stopped=![];var NOW=moment()[_0x6160('0xc')](_0x6160('0xd'));function isEmail(_0x2ea22c){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'](_0x2ea22c);}function selectNotIn(_0x45beaf,_0x4f94de,_0x2de19c,_0x3b0f03,_0x3a66b4){return squel['select']()[_0x6160('0xe')](_0x6160('0xf'))['from'](_0x3b0f03)[_0x6160('0x10')](_0x4f94de,null,_0x4f94de+_0x6160('0x11')+_0x3b0f03+'.'+_0x2de19c)[_0x6160('0x12')](_0x3b0f03+'.'+_0x2de19c+_0x6160('0x13')+_0x45beaf+'.'+_0x2de19c)[_0x6160('0x12')](_0x4f94de+_0x6160('0x14')+_0x3a66b4[_0x6160('0x10')]()+')');}function insertCmHopper(_0x3fe8cb,_0x4265bc,_0x357818,_0x885135,_0x14d3c9){var _0x49ac65=[_0x6160('0x15'),'cm_contacts.scheduledat',_0x6160('0x16'),_0x6160('0x17'),_0x4265bc+'.'+_0x885135,_0x6160('0x18'),_0x6160('0x19'),_0x6160('0x1a'),'cm_contacts.UserId','\x22'+_0x14d3c9+'\x22'];return squel[_0x6160('0x1b')]()[_0x6160('0x1c')]('cm_hopper')[_0x6160('0x1d')]([_0x6160('0xf'),'scheduledat',_0x6160('0x1e'),_0x6160('0x1f'),_0x885135,_0x6160('0x20'),'updatedAt',_0x6160('0x21'),_0x6160('0x22'),_0x6160('0x23')],squel[_0x6160('0x24')]()[_0x6160('0x25')](_0x49ac65)[_0x6160('0x26')](_0x4265bc)['join'](_0x6160('0x27'),null,_0x6160('0x28')+_0x4265bc+_0x6160('0x29'))[_0x6160('0x10')](_0x357818,null,_0x357818+_0x6160('0x11')+_0x4265bc+'.'+_0x885135)[_0x6160('0x12')](_0x4265bc+_0x6160('0x2a'),_0x3fe8cb)['where'](_0x6160('0x2b'),NOW)[_0x6160('0x12')](_0x6160('0x2c'),selectNotIn(_0x4265bc,_0x357818,_0x885135,_0x6160('0x2d'),[_0x6160('0x2e'),_0x6160('0x2f')]))[_0x6160('0x12')](_0x6160('0x2c'),selectNotIn(_0x4265bc,_0x357818,_0x885135,_0x6160('0x2d'),[_0x6160('0x2e')])))['toString']();}function insertCmHopperBlack(_0x86d51c,_0x34b29a,_0x51cf9c,_0x44099e){var _0x1211cc=[_0x6160('0x15'),_0x6160('0x16'),'cm_contacts.ListId',_0x34b29a+'.'+_0x44099e,_0x6160('0x18'),'cm_contacts.updatedAt'];return squel[_0x6160('0x1b')]()[_0x6160('0x1c')](_0x6160('0x30'))['fromQuery']([_0x6160('0xf'),_0x6160('0x1e'),_0x6160('0x1f'),_0x44099e,_0x6160('0x20'),_0x6160('0x31')],squel[_0x6160('0x24')]()[_0x6160('0x25')](_0x1211cc)[_0x6160('0x26')](_0x34b29a)[_0x6160('0x10')](_0x6160('0x27'),null,_0x6160('0x28')+_0x34b29a+'.CmListId')[_0x6160('0x10')](_0x51cf9c,null,_0x51cf9c+'.id\x20=\x20'+_0x34b29a+'.'+_0x44099e)[_0x6160('0x12')](_0x34b29a+_0x6160('0x2a'),_0x86d51c)['where']('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x6160('0x2c'),squel[_0x6160('0x24')]()[_0x6160('0xe')](_0x6160('0xf'))[_0x6160('0x26')]('cm_hopper_black')[_0x6160('0x12')]('ListId\x20=\x20?',_0x86d51c)[_0x6160('0x12')](_0x44099e+_0x6160('0x32'),_0x34b29a+'.'+_0x44099e)))[_0x6160('0x33')]();}function insertCmContact(_0x379324,_0x5f5332,_0x30ffa9,_0x5ca49a){var _0x6202d1=_[_0x6160('0x34')](_['keys'](_0x5ca49a),[_0x6160('0x1f'),_0x6160('0x35'),'createdAt',_0x6160('0x31')]);return squel[_0x6160('0x1b')]()['into'](_0x6160('0x27'))[_0x6160('0x1d')](_0x6202d1,squel[_0x6160('0x24')]()[_0x6160('0x25')](_0x6202d1)[_0x6160('0x26')](_0x5f5332)[_0x6160('0x12')]('('+_0x30ffa9['join'](',')+_0x6160('0x36'),squel[_0x6160('0x24')]()[_0x6160('0x25')](_0x30ffa9)['from'](_0x6160('0x27'))[_0x6160('0x12')]('ListId\x20=\x20?',_0x379324)[_0x6160('0x12')](_0x6160('0x37')))[_0x6160('0x12')](_0x6160('0x38'),squel[_0x6160('0x24')]()[_0x6160('0xe')]('MIN(id)',_0x6160('0x39'))[_0x6160('0x26')](_0x5f5332)[_0x6160('0x3a')](_0x30ffa9[_0x6160('0x10')](','))))['toString']();}function handleStop(){logger[_0x6160('0x3b')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x5eee64){logger[_0x6160('0x3c')](_0x5eee64[_0x6160('0x3d')]);process[_0x6160('0x3e')](0x1);}function handleError(_0x5c3f59,_0x268141){stats['errors'][_0x6160('0x3f')]({'name':_0x268141[_0x6160('0x40')],'message':_0x268141[_0x6160('0x3d')],'row':_0x5c3f59});}function handleQuery(_0x86a43d){logger[_0x6160('0x3b')](_0x86a43d);return db[_0x6160('0x41')][_0x6160('0x42')](_0x86a43d)['spread'](function(_0x145096){results['push'](_0x145096);})['catch'](function(_0x401cce){logger[_0x6160('0x3c')](_0x401cce[_0x6160('0x3d')]);});}function main(_0x2706e2,_0x122704,_0x1e3c2d,_0x10dec7){logger['info']('main',_0x2706e2,JSON[_0x6160('0x43')](_0x122704));process[_0x6160('0x44')](_0x6160('0x45'));var _0x3107e7=_0x122704['binding'];var _0x5a43ee=_0x122704[_0x6160('0x46')];var _0x4c0362=path[_0x6160('0x10')](config['root'],_0x6160('0x47'),_0x5a43ee+_0x6160('0x48'));var _0x18d30e=_[_0x6160('0x49')](_0x3107e7)['join']();logger['info'](_0x6160('0x4a'),_0x18d30e);fs[_0x6160('0x4b')](_0x4c0362,_0x18d30e+'\x0a');Papa[_0x6160('0x4c')](fs['createReadStream'](_0x2706e2),{'header':!![],'skipEmptyLines':!![],'step':function(_0x5efa75,_0x12dcaf){try{for(var _0x1a8bd0=0x0,_0x2cf5a2=[];_0x1a8bd0<_0x5efa75[_0x6160('0x4d')]['length'];_0x1a8bd0++){stats[_0x6160('0x4e')]+=0x1;if(_0x5efa75['errors'][_0x1a8bd0]){handleError(_0x5efa75[_0x6160('0x4d')][_0x1a8bd0],_0x5efa75[_0x6160('0x4f')][_0x1a8bd0]);}else{var _0x486825=[];for(var _0x359368 in _0x3107e7){if(_0x3107e7[_0x6160('0x50')](_0x359368)){if(_0x5efa75[_0x6160('0x4d')][_0x1a8bd0][_0x3107e7[_0x359368]]){var _0x35467b=_[_0x6160('0x51')](_0x5efa75[_0x6160('0x4d')][_0x1a8bd0][_0x3107e7[_0x359368]][_0x6160('0x52')](/"/g,'\x27'));switch(_0x359368){case _0x6160('0x53'):var _0x2a34c2=moment(_0x35467b,_0x6160('0xd'),!![]);if(_0x2a34c2[_0x6160('0x54')]()){_0x2cf5a2[_0x6160('0x3f')]('\x22'+_0x35467b+'\x22');}else{_0x486825['push'](_0x6160('0x55'));}break;case _0x6160('0x21'):var _0xca5416=parseInt(_0x35467b);_0x35467b=_[_0x6160('0x56')](_0xca5416)||_0xca5416<0x0||_0xca5416>0x4?_0x10dec7?0x3:0x2:_0xca5416;_0x2cf5a2[_0x6160('0x3f')]('\x22'+_0x35467b+'\x22');break;case _0x6160('0x22'):var _0xe1c823=parseInt(_0x35467b);if(_[_0x6160('0x57')](_0xe1c823)&&_[_0x6160('0x58')](_0x1e3c2d,_0xe1c823)){_0x2cf5a2[_0x6160('0x3f')]('\x22'+_0xe1c823+'\x22');}else{_0x486825[_0x6160('0x3f')](_0x6160('0x59'));}break;case _0x6160('0x5a'):if(isEmail(_0x35467b)){_0x2cf5a2[_0x6160('0x3f')]('\x22'+_0x35467b+'\x22');}else{_0x486825[_0x6160('0x3f')]('email\x20wrong\x20format');}break;case _0x6160('0x5b'):var _0x1638eb=moment(_0x35467b,_0x6160('0x5c'),!![]);if(_0x1638eb[_0x6160('0x54')]()){_0x2cf5a2[_0x6160('0x3f')]('\x22'+_0x35467b+'\x22');}else{_0x486825[_0x6160('0x3f')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2cf5a2[_0x6160('0x3f')]('\x22'+_0x35467b+'\x22');}}else{switch(_0x359368){case'firstName':case'phone':_0x486825[_0x6160('0x3f')](_0x359368+'\x20not\x20specified');break;default:_0x2cf5a2[_0x6160('0x3f')]('\x22\x22');}}}}if(_0x486825['length']){handleError(_0x5efa75[_0x6160('0x4d')][_0x1a8bd0],{'code':_0x6160('0x5d'),'message':_0x486825['join']()});}else{fs['appendFileSync'](_0x4c0362,_0x2cf5a2[_0x6160('0x10')]()+'\x0a');}_0x2cf5a2=[];}if(!(stats[_0x6160('0x4e')]%0xc8)){socket['emit']('contact:import:'+_0x5a43ee,stats);stats[_0x6160('0x4f')]=[];}}if(stopped){logger['info'](_0x6160('0x5e'));_0x12dcaf[_0x6160('0x5f')]();}}catch(_0x2f8d11){handleError(_0x5efa75[_0x6160('0x4d')][_0x1a8bd0],{'code':'SystemError','message':_0x2f8d11[_0x6160('0x3d')]});logger[_0x6160('0x3c')](_0x6160('0x60'),_0x2f8d11[_0x6160('0x3d')]);}},'complete':function(){try{var _0x282660=[];var _0x4592a7='cm_contacts';if(_0x122704['duplicates']&&_0x122704[_0x6160('0x61')]['length']){_0x4592a7=_0x6160('0x62')+_0x5a43ee;_0x282660['push'](_0x6160('0x63')+_0x4592a7+'\x20LIKE\x20cm_contacts;');}var _0x148169=util['format'](_0x6160('0x64'),_0x4c0362,_0x4592a7,_0x18d30e,_0x122704[_0x6160('0x1f')],_0x122704[_0x6160('0x35')]||null,NOW,NOW);if(_[_0x6160('0x65')](_0x3107e7[_0x6160('0x53')])){_0x148169+=_0x6160('0x66');}_0x282660['push'](_0x148169);if(_0x122704['duplicates']&&_0x122704[_0x6160('0x61')][_0x6160('0x67')]){_0x282660['push'](insertCmContact(_0x122704[_0x6160('0x1f')],_0x4592a7,_0x122704[_0x6160('0x61')],_0x3107e7));_0x282660[_0x6160('0x3f')](_0x6160('0x68')+_0x4592a7+';');}_0x282660[_0x6160('0x3f')](insertCmHopper(_0x122704[_0x6160('0x1f')],'voice_queues_has_cm_lists','voice_queues',_0x6160('0x69'),_0x10dec7));_0x282660[_0x6160('0x3f')](insertCmHopperBlack(_0x122704[_0x6160('0x1f')],_0x6160('0x6a'),'voice_queues',_0x6160('0x69')));_0x282660[_0x6160('0x3f')](insertCmHopper(_0x122704[_0x6160('0x1f')],_0x6160('0x6b'),_0x6160('0x6c'),_0x6160('0x6d'),_0x10dec7));_0x282660['push'](insertCmHopperBlack(_0x122704[_0x6160('0x1f')],_0x6160('0x6e'),_0x6160('0x6c'),_0x6160('0x6d')));BPromise[_0x6160('0x6f')](_0x282660,handleQuery)['then'](function(_0x4bff6e){stats[_0x6160('0x70')]=!![];stats['affectedRows']=_0x122704['duplicates']&&_0x122704[_0x6160('0x61')][_0x6160('0x67')]?results[0x2][_0x6160('0x71')]:results[0x0][_0x6160('0x71')];socket['emit'](_0x6160('0x72')+_0x5a43ee,stats);fs['unlink'](_0x2706e2);fs['unlink'](_0x4c0362);process[_0x6160('0x3e')](0x0);})[_0x6160('0x73')](function(_0xc1e1fa){logger['error'](_0xc1e1fa['message']);process[_0x6160('0x3e')](0x1);});}catch(_0x1c5999){logger[_0x6160('0x3c')](_0x6160('0x74'),_0x1c5999[_0x6160('0x3d')]);process[_0x6160('0x3e')](0x1);}},'error':function(_0x421889,_0x15fed4,_0x296f7a,_0x5a720e){throw new Error(_0x5a720e);}});}function validate(){if(process[_0x6160('0x75')]&&process['argv'][_0x6160('0x67')]<0x4){throw new Error(_0x6160('0x76'));}var _0x45a150=path['join'](config[_0x6160('0x77')],'server/files/tmp',process['argv'][0x2]);if(!fs[_0x6160('0x78')](_0x45a150)){throw new Error(_0x6160('0x79'));}var _0x341a21={};try{_0x341a21=JSON[_0x6160('0x4c')](process[_0x6160('0x75')][0x3]);if(!_0x341a21[_0x6160('0x7a')]){throw new Error(_0x6160('0x7b'));}if(!_0x341a21[_0x6160('0x7a')]['phone']){throw new Error(_0x6160('0x7c'));}if(!_0x341a21[_0x6160('0x7a')][_0x6160('0x7d')]){throw new Error('firstName\x20is\x20mandatory');}var _0x3acb0f=0x0;if(_0x341a21[_0x6160('0x7a')][_0x6160('0x22')]){_0x3acb0f=0x1;}if(!_0x341a21[_0x6160('0x1f')]){throw new Error('ListId\x20is\x20mandatory');}}catch(_0xe6901){throw new Error(_0x6160('0x7e'));}var _0x3b8011=[];try{_0x3b8011=_[_0x6160('0x7f')](JSON[_0x6160('0x4c')](process['argv'][0x4]),'id');}catch(_0x12d93a){logger[_0x6160('0x3b')](_0x6160('0x80'));}main(_0x45a150,_0x341a21,_0x3b8011,_0x3acb0f);}validate();process['on'](_0x6160('0x81'),handleStop);process['on']('uncaughtException',handleUncaughtException); \ No newline at end of file diff --git a/server/components/integrations/configuration.js b/server/components/integrations/configuration.js index 16eeac0..f289e0f 100644 --- a/server/components/integrations/configuration.js +++ b/server/components/integrations/configuration.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9cdc=['agentcompleteAt','Hold\x20Time','holdtime','Talk\x20Time','talktime','Member\x20Name','membername','uniqueid','starttime','***\x20Time\x20Info\x20***','endtime','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','toLowerCase','voice','inbound','push','variable','queue','calleridnum','outbound','Outbound\x20Call','***\x20Call\x20Info\x20***','keyValue','Caller\x20Number','Caller\x20Name','Call\x20To','destexten','UniqueId','Date','agentcalledAt','Agent\x20Name','destcalleridnum','Agent\x20Connect','agentconnectAt','Agent\x20Complete'];(function(_0x4c8a2f,_0x404273){var _0x35d25f=function(_0x368393){while(--_0x368393){_0x4c8a2f['push'](_0x4c8a2f['shift']());}};_0x35d25f(++_0x404273);}(_0x9cdc,0x193));var _0xc9cd=function(_0x1e4600,_0xfc60f9){_0x1e4600=_0x1e4600-0x0;var _0x51007f=_0x9cdc[_0x1e4600];return _0x51007f;};'use strict';exports[_0xc9cd('0x0')]=function(_0x4631ec,_0x27d10b){var _0x5af8c6=[{'type':_0xc9cd('0x1'),'content':_0xc9cd('0x2'),'variableName':null}];switch(_0x4631ec[_0xc9cd('0x3')]()){case _0xc9cd('0x4'):switch(_0x27d10b[_0xc9cd('0x3')]()){case _0xc9cd('0x5'):_0x5af8c6[_0xc9cd('0x6')]({'type':_0xc9cd('0x7'),'content':'','variableName':_0xc9cd('0x8')});_0x5af8c6[_0xc9cd('0x6')]({'type':_0xc9cd('0x7'),'content':'','variableName':_0xc9cd('0x9')});break;case _0xc9cd('0xa'):_0x5af8c6['push']({'type':_0xc9cd('0x1'),'content':_0xc9cd('0xb'),'variableName':null});_0x5af8c6[_0xc9cd('0x6')]({'type':_0xc9cd('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x5af8c6;};exports['getDescriptions']=function(_0xd85015,_0x49ebc0){var _0x1170cc=[];switch(_0xd85015[_0xc9cd('0x3')]()){case _0xc9cd('0x4'):switch(_0x49ebc0[_0xc9cd('0x3')]()){case'inbound':_0x1170cc=[{'type':_0xc9cd('0x1'),'content':_0xc9cd('0xc'),'key':null,'keyType':null,'variableName':null},{'type':_0xc9cd('0xd'),'content':'','key':_0xc9cd('0xe'),'keyType':'variable','variableName':_0xc9cd('0x9')},{'type':'keyValue','content':'','key':_0xc9cd('0xf'),'keyType':_0xc9cd('0x7'),'variableName':'calleridname'},{'type':_0xc9cd('0xd'),'content':'','key':_0xc9cd('0x10'),'keyType':'variable','variableName':_0xc9cd('0x11')},{'type':_0xc9cd('0xd'),'content':'','key':'Queue','keyType':_0xc9cd('0x7'),'variableName':'queue'},{'type':_0xc9cd('0xd'),'content':'','key':_0xc9cd('0x12'),'keyType':_0xc9cd('0x7'),'variableName':'uniqueid'},{'type':_0xc9cd('0xd'),'content':'','key':_0xc9cd('0x13'),'keyType':'variable','variableName':_0xc9cd('0x14')},{'type':_0xc9cd('0x1'),'content':'***\x20Agent\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':_0xc9cd('0x15'),'keyType':'variable','variableName':'destcalleridname'},{'type':'keyValue','content':'','key':'Agent\x20Number','keyType':'variable','variableName':_0xc9cd('0x16')},{'type':'string','content':'***\x20Time\x20Info\x20***','key':null,'keyType':null,'variableName':null},{'type':_0xc9cd('0xd'),'content':'','key':'Agent\x20Ring','keyType':_0xc9cd('0x7'),'variableName':'agentcalledAt'},{'type':_0xc9cd('0xd'),'content':'','key':_0xc9cd('0x17'),'keyType':_0xc9cd('0x7'),'variableName':_0xc9cd('0x18')},{'type':'keyValue','content':'','key':_0xc9cd('0x19'),'keyType':_0xc9cd('0x7'),'variableName':_0xc9cd('0x1a')},{'type':_0xc9cd('0xd'),'content':'','key':_0xc9cd('0x1b'),'keyType':_0xc9cd('0x7'),'variableName':_0xc9cd('0x1c')},{'type':'keyValue','content':'','key':_0xc9cd('0x1d'),'keyType':_0xc9cd('0x7'),'variableName':_0xc9cd('0x1e')}];break;case'outbound':_0x1170cc=[{'type':_0xc9cd('0x1'),'content':_0xc9cd('0xc'),'variableName':null},{'type':'keyValue','content':'','key':'Called\x20Number','keyType':_0xc9cd('0x7'),'keyContent':'','variableName':'destcalleridnum'},{'type':_0xc9cd('0xd'),'content':'','key':_0xc9cd('0x1f'),'keyType':_0xc9cd('0x7'),'keyContent':'','variableName':_0xc9cd('0x20')},{'type':_0xc9cd('0xd'),'content':'','key':_0xc9cd('0x12'),'keyType':_0xc9cd('0x7'),'keyContent':'','variableName':_0xc9cd('0x21')},{'type':_0xc9cd('0xd'),'content':'','key':_0xc9cd('0x13'),'keyType':_0xc9cd('0x7'),'keyContent':'','variableName':_0xc9cd('0x22')},{'type':'string','content':_0xc9cd('0x23')},{'type':_0xc9cd('0xd'),'content':'','key':'Answer\x20Time','keyType':'variable','keyContent':'','variableName':'answertime'},{'type':_0xc9cd('0xd'),'content':'','key':'Complete\x20Time','keyType':'variable','keyContent':'','variableName':_0xc9cd('0x24')},{'type':_0xc9cd('0xd'),'content':'','key':'Duration','keyType':_0xc9cd('0x7'),'keyContent':'','variableName':'duration'},{'type':'keyValue','content':'','key':_0xc9cd('0x25'),'keyType':_0xc9cd('0x7'),'keyContent':'','variableName':_0xc9cd('0x26')}];break;}}return _0x1170cc;}; \ No newline at end of file +var _0x1758=['toLowerCase','push','queue','variable','calleridnum','outbound','Outbound\x20Call','getDescriptions','***\x20Call\x20Info\x20***','keyValue','Caller\x20Name','calleridname','Call\x20To','destexten','Queue','UniqueId','uniqueid','Date','***\x20Agent\x20Info\x20***','Agent\x20Name','destcalleridname','destcalleridnum','***\x20Time\x20Info\x20***','Agent\x20Ring','agentcalledAt','agentconnectAt','Agent\x20Complete','agentcompleteAt','Hold\x20Time','Member\x20Name','Answer\x20Time','answertime','Complete\x20Time','endtime','Duration','Billable\x20Time','billableseconds','getSubjects','string','[xCALLY\x20Ticket]','voice'];(function(_0x4d14a5,_0x51e86a){var _0x29793f=function(_0xbe2914){while(--_0xbe2914){_0x4d14a5['push'](_0x4d14a5['shift']());}};_0x29793f(++_0x51e86a);}(_0x1758,0x144));var _0x8175=function(_0x56bf2b,_0x36cb19){_0x56bf2b=_0x56bf2b-0x0;var _0x426de5=_0x1758[_0x56bf2b];return _0x426de5;};'use strict';exports[_0x8175('0x0')]=function(_0x4cf38a,_0x2f86f7){var _0x32526f=[{'type':_0x8175('0x1'),'content':_0x8175('0x2'),'variableName':null}];switch(_0x4cf38a['toLowerCase']()){case _0x8175('0x3'):switch(_0x2f86f7[_0x8175('0x4')]()){case'inbound':_0x32526f[_0x8175('0x5')]({'type':'variable','content':'','variableName':_0x8175('0x6')});_0x32526f[_0x8175('0x5')]({'type':_0x8175('0x7'),'content':'','variableName':_0x8175('0x8')});break;case _0x8175('0x9'):_0x32526f[_0x8175('0x5')]({'type':_0x8175('0x1'),'content':_0x8175('0xa'),'variableName':null});_0x32526f[_0x8175('0x5')]({'type':_0x8175('0x7'),'content':'','variableName':'destcalleridnum'});break;}}return _0x32526f;};exports[_0x8175('0xb')]=function(_0x1a17a4,_0x41f411){var _0x5954a0=[];switch(_0x1a17a4[_0x8175('0x4')]()){case'voice':switch(_0x41f411['toLowerCase']()){case'inbound':_0x5954a0=[{'type':'string','content':_0x8175('0xc'),'key':null,'keyType':null,'variableName':null},{'type':'keyValue','content':'','key':'Caller\x20Number','keyType':_0x8175('0x7'),'variableName':'calleridnum'},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0xe'),'keyType':'variable','variableName':_0x8175('0xf')},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x10'),'keyType':_0x8175('0x7'),'variableName':_0x8175('0x11')},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x12'),'keyType':_0x8175('0x7'),'variableName':_0x8175('0x6')},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x13'),'keyType':_0x8175('0x7'),'variableName':_0x8175('0x14')},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x15'),'keyType':_0x8175('0x7'),'variableName':'agentcalledAt'},{'type':_0x8175('0x1'),'content':_0x8175('0x16'),'key':null,'keyType':null,'variableName':null},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x17'),'keyType':'variable','variableName':_0x8175('0x18')},{'type':_0x8175('0xd'),'content':'','key':'Agent\x20Number','keyType':_0x8175('0x7'),'variableName':_0x8175('0x19')},{'type':_0x8175('0x1'),'content':_0x8175('0x1a'),'key':null,'keyType':null,'variableName':null},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x1b'),'keyType':_0x8175('0x7'),'variableName':_0x8175('0x1c')},{'type':_0x8175('0xd'),'content':'','key':'Agent\x20Connect','keyType':_0x8175('0x7'),'variableName':_0x8175('0x1d')},{'type':'keyValue','content':'','key':_0x8175('0x1e'),'keyType':_0x8175('0x7'),'variableName':_0x8175('0x1f')},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x20'),'keyType':_0x8175('0x7'),'variableName':'holdtime'},{'type':_0x8175('0xd'),'content':'','key':'Talk\x20Time','keyType':'variable','variableName':'talktime'}];break;case _0x8175('0x9'):_0x5954a0=[{'type':_0x8175('0x1'),'content':_0x8175('0xc'),'variableName':null},{'type':_0x8175('0xd'),'content':'','key':'Called\x20Number','keyType':_0x8175('0x7'),'keyContent':'','variableName':_0x8175('0x19')},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x21'),'keyType':_0x8175('0x7'),'keyContent':'','variableName':'membername'},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x13'),'keyType':_0x8175('0x7'),'keyContent':'','variableName':_0x8175('0x14')},{'type':'keyValue','content':'','key':'Date','keyType':'variable','keyContent':'','variableName':'starttime'},{'type':_0x8175('0x1'),'content':'***\x20Time\x20Info\x20***'},{'type':'keyValue','content':'','key':_0x8175('0x22'),'keyType':'variable','keyContent':'','variableName':_0x8175('0x23')},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x24'),'keyType':'variable','keyContent':'','variableName':_0x8175('0x25')},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x26'),'keyType':'variable','keyContent':'','variableName':'duration'},{'type':_0x8175('0xd'),'content':'','key':_0x8175('0x27'),'keyType':'variable','keyContent':'','variableName':_0x8175('0x28')}];break;}}return _0x5954a0;}; \ No newline at end of file diff --git a/server/components/interaction/service.js b/server/components/interaction/service.js index 15033d3..9076c09 100644 --- a/server/components/interaction/service.js +++ b/server/components/interaction/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd4e1=['body','omit','html','phone','fax','mobile','lodash','../../mysqldb','openchannel-interactions','../../config/logger','mail-interactions','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','InteractionId','upperFirst','unknown','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','role','stringify','null','findOne','then','update','error','tracked','user','clone'];(function(_0x4002d9,_0x26bfca){var _0x474042=function(_0x250be4){while(--_0x250be4){_0x4002d9['push'](_0x4002d9['shift']());}};_0x474042(++_0x26bfca);}(_0xd4e1,0x1b8));var _0x1d4e=function(_0x35d4fd,_0x1a054a){_0x35d4fd=_0x35d4fd-0x0;var _0x174d86=_0xd4e1[_0x35d4fd];return _0x174d86;};'use strict';var _=require(_0x1d4e('0x0'));var db=require(_0x1d4e('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0x1d4e('0x2')),'mail':require(_0x1d4e('0x3'))(_0x1d4e('0x4')),'fax':require(_0x1d4e('0x3'))(_0x1d4e('0x5')),'sms':require('../../config/logger')(_0x1d4e('0x6')),'chat':require(_0x1d4e('0x3'))(_0x1d4e('0x7')),'whatsapp':require('../../config/logger')(_0x1d4e('0x8'))};function getInteractionId(_0x3b166b,_0x4816ee,_0x565302){if(_0x3b166b&&_0x3b166b[_['upperFirst'](_0x565302)+_0x1d4e('0x9')]){return _0x3b166b[_[_0x1d4e('0xa')](_0x565302)+'InteractionId'];}else if(_0x3b166b&&_0x3b166b['id']){return _0x3b166b['id'];}else if(_0x4816ee&&_0x4816ee['id']){return _0x4816ee['id'];}else{return _0x1d4e('0xb');}}function log(_0x3175ab,_0x48dae5,_0x40383f,_0x8a45aa,_0x4cb58d,_0x1a87ba){loggers[_0x4cb58d[_0x1d4e('0xc')]()][_0x3175ab](_0x1d4e('0xd'),_0x1a87ba[_0x1d4e('0xe')](),_0x48dae5?_0x48dae5['id']:null,_0x48dae5?_0x48dae5['name']:null,_0x48dae5?_0x48dae5[_0x1d4e('0xf')]:null,getInteractionId(_0x40383f,_0x8a45aa,_0x4cb58d),_0x40383f?JSON[_0x1d4e('0x10')](_0x40383f):_0x1d4e('0x11'));}function updateUser(_0xed0da,_0xc3c918,_0x1cff2c,_0x4a8d88,_0x220f2d){db[_[_0x1d4e('0xa')](_0x4a8d88)+'Interaction'][_0x1d4e('0x12')]({'where':{'id':getInteractionId(_0xc3c918,_0x1cff2c,_0x4a8d88)}})[_0x1d4e('0x13')](function(_0x39ea32){if(_0x39ea32){return _0x39ea32[_0x1d4e('0x14')]({'UserId':_0xed0da?_0xed0da['id']:null});}})['then'](function(_0x10a545){if(_0x10a545){log('info',_0xed0da,_0xc3c918,_0x1cff2c,_0x4a8d88,_0x220f2d);}})['catch'](function(){log(_0x1d4e('0x15'),_0xed0da,_0xc3c918,_0x1cff2c,_0x4a8d88,_0x220f2d);});}exports[_0x1d4e('0x16')]=function(_0x43604c,_0xe90940){return function(_0x30bcb2,_0x19c4cc,_0x5efffd){var _0x484ee1=_0x30bcb2[_0x1d4e('0x17')];var _0x5b03d8={};var _0x2bc2d4=_0x30bcb2['query'];if(_0x5b03d8){_0x5b03d8=_[_0x1d4e('0x18')](_0x30bcb2[_0x1d4e('0x19')]);_0x5b03d8=_[_0x1d4e('0x1a')](_0x5b03d8,[_0x1d4e('0x19'),_0x1d4e('0x1b'),_0x1d4e('0x1c'),_0x1d4e('0x1d'),_0x1d4e('0x1e')]);}updateUser(_0x484ee1,_0x5b03d8,_0x2bc2d4,_0x43604c,_0xe90940);_0x5efffd(null);};}; \ No newline at end of file +var _0xdc89=['body','omit','html','phone','mobile','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','fax-interactions','sms-interactions','whatsapp-interactions','upperFirst','InteractionId','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','null','Interaction','findOne','then','update','info','catch','error','tracked','user','clone'];(function(_0x14893c,_0x32c1b1){var _0xc47df0=function(_0x6b65aa){while(--_0x6b65aa){_0x14893c['push'](_0x14893c['shift']());}};_0xc47df0(++_0x32c1b1);}(_0xdc89,0xd7));var _0x9dc8=function(_0x338c8c,_0x19df14){_0x338c8c=_0x338c8c-0x0;var _0x371a9a=_0xdc89[_0x338c8c];return _0x371a9a;};'use strict';var _=require('lodash');var db=require(_0x9dc8('0x0'))['db'];var loggers={'openchannel':require(_0x9dc8('0x1'))(_0x9dc8('0x2')),'mail':require(_0x9dc8('0x1'))(_0x9dc8('0x3')),'fax':require(_0x9dc8('0x1'))(_0x9dc8('0x4')),'sms':require(_0x9dc8('0x1'))(_0x9dc8('0x5')),'chat':require(_0x9dc8('0x1'))('chat-interactions'),'whatsapp':require(_0x9dc8('0x1'))(_0x9dc8('0x6'))};function getInteractionId(_0x4d991e,_0x1aff7a,_0x56aed4){if(_0x4d991e&&_0x4d991e[_[_0x9dc8('0x7')](_0x56aed4)+'InteractionId']){return _0x4d991e[_[_0x9dc8('0x7')](_0x56aed4)+_0x9dc8('0x8')];}else if(_0x4d991e&&_0x4d991e['id']){return _0x4d991e['id'];}else if(_0x1aff7a&&_0x1aff7a['id']){return _0x1aff7a['id'];}else{return'unknown';}}function log(_0x529cc6,_0x536736,_0x1bcb5f,_0x19875d,_0xb087f3,_0x26e010){loggers[_0xb087f3[_0x9dc8('0x9')]()][_0x529cc6](_0x9dc8('0xa'),_0x26e010[_0x9dc8('0xb')](),_0x536736?_0x536736['id']:null,_0x536736?_0x536736[_0x9dc8('0xc')]:null,_0x536736?_0x536736[_0x9dc8('0xd')]:null,getInteractionId(_0x1bcb5f,_0x19875d,_0xb087f3),_0x1bcb5f?JSON['stringify'](_0x1bcb5f):_0x9dc8('0xe'));}function updateUser(_0x390e4a,_0x1e0e3b,_0x5a8f86,_0x82eebb,_0x3c6d1b){db[_[_0x9dc8('0x7')](_0x82eebb)+_0x9dc8('0xf')][_0x9dc8('0x10')]({'where':{'id':getInteractionId(_0x1e0e3b,_0x5a8f86,_0x82eebb)}})[_0x9dc8('0x11')](function(_0x2d07a7){if(_0x2d07a7){return _0x2d07a7[_0x9dc8('0x12')]({'UserId':_0x390e4a?_0x390e4a['id']:null});}})['then'](function(_0x12dcf1){if(_0x12dcf1){log(_0x9dc8('0x13'),_0x390e4a,_0x1e0e3b,_0x5a8f86,_0x82eebb,_0x3c6d1b);}})[_0x9dc8('0x14')](function(){log(_0x9dc8('0x15'),_0x390e4a,_0x1e0e3b,_0x5a8f86,_0x82eebb,_0x3c6d1b);});}exports[_0x9dc8('0x16')]=function(_0x8f2498,_0x12043c){return function(_0x47d2e5,_0x2beb8c,_0x59ec00){var _0x326cd1=_0x47d2e5[_0x9dc8('0x17')];var _0x3c3614={};var _0x2480cb=_0x47d2e5['query'];if(_0x3c3614){_0x3c3614=_[_0x9dc8('0x18')](_0x47d2e5[_0x9dc8('0x19')]);_0x3c3614=_[_0x9dc8('0x1a')](_0x3c3614,[_0x9dc8('0x19'),_0x9dc8('0x1b'),_0x9dc8('0x1c'),'fax',_0x9dc8('0x1d')]);}updateUser(_0x326cd1,_0x3c3614,_0x2480cb,_0x8f2498,_0x12043c);_0x59ec00(null);};}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 659749f..5f23478 100644 --- a/server/components/license/service.js +++ b/server/components/license/service.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4796=['final','parse','hasOwnProperty','use','License','then','json','catch','User','admin','user','isUserLimit','crypto','util','../../config/environment','data1','license','split','createDecipher','aes-256-ctr','format','%s:%s:%s','update','base64','utf8'];(function(_0x27141c,_0x25ff8d){var _0x5a9b58=function(_0x2b5d51){while(--_0x2b5d51){_0x27141c['push'](_0x27141c['shift']());}};_0x5a9b58(++_0x25ff8d);}(_0x4796,0x70));var _0x6479=function(_0x53280e,_0x20522a){_0x53280e=_0x53280e-0x0;var _0x5aa3db=_0x4796[_0x53280e];return _0x5aa3db;};'use strict';var crypto=require(_0x6479('0x0'));var util=require(_0x6479('0x1'));var compose=require('composable-middleware');var db=require('../../mysqldb')['db'];var config=require(_0x6479('0x2'));function getValueFromLicense(_0x56977b,_0x14d2f2){if(_0x56977b&&_0x14d2f2){if(_0x14d2f2[_0x6479('0x3')]&&_0x14d2f2['license']){var _0x780439=_0x14d2f2['data1'];var _0x36862e=_0x14d2f2[_0x6479('0x4')];var _0x61e0fc=_0x780439[_0x6479('0x5')]('-')[0x4];var _0x47315a=_0x780439['split']('-')[0x0];var _0x56a354=crypto[_0x6479('0x6')](_0x6479('0x7'),util[_0x6479('0x8')](_0x6479('0x9'),_0x61e0fc,_0x780439,_0x47315a));var _0x1cdc2e=_0x56a354[_0x6479('0xa')](_0x36862e,_0x6479('0xb'),_0x6479('0xc'));_0x1cdc2e+=_0x56a354[_0x6479('0xd')]('utf8');var _0x65eb6c=JSON[_0x6479('0xe')](_0x1cdc2e);return _0x65eb6c[_0x6479('0xf')](_0x56977b)?_0x65eb6c[_0x56977b]:null;}}return null;}function isLimit(_0x18aaba,_0x4c7c08,_0x4d5ff7,_0x66c2b8){var _0x1b9101=_0x4c7c08;return compose()[_0x6479('0x10')](function(_0x5c2569,_0x4964ab,_0x30cb57){return db[_0x6479('0x11')]['findOne']({'where':{'id':0x1},'raw':!![]})[_0x6479('0x12')](function(_0x43f5be){var _0x106a93=getValueFromLicense(_0x18aaba,_0x43f5be);return _0x106a93?_0x106a93:_0x1b9101;})['then'](function(_0x59d63d){_0x1b9101=_0x59d63d;return _0x4d5ff7['count'](_0x66c2b8);})['then'](function(_0x1a5bae){if(_0x1a5bae>=_0x1b9101){return _0x4964ab['status'](0x193)[_0x6479('0x13')]({'message':util[_0x6479('0x8')]('Maximum\x20%s\x20limit\x20have\x20been\x20reached',_0x18aaba)});}_0x30cb57();})[_0x6479('0x14')](function(_0x576702){_0x30cb57(_0x576702);});});}function isUserLimit(){return isLimit('users',0x1,db[_0x6479('0x15')],{'where':{'$or':[{'role':_0x6479('0x16')},{'role':_0x6479('0x17')}]}});}exports[_0x6479('0x18')]=isUserLimit; \ No newline at end of file +var _0x7659=['findOne','then','Maximum\x20%s\x20limit\x20have\x20been\x20reached','users','User','user','isUserLimit','crypto','util','composable-middleware','../../mysqldb','../../config/environment','data1','license','split','aes-256-ctr','format','update','utf8','final','hasOwnProperty','use','License'];(function(_0x1f3a94,_0x563851){var _0x5a4296=function(_0x47c749){while(--_0x47c749){_0x1f3a94['push'](_0x1f3a94['shift']());}};_0x5a4296(++_0x563851);}(_0x7659,0x132));var _0x9765=function(_0x178619,_0x8acdca){_0x178619=_0x178619-0x0;var _0x5d16a0=_0x7659[_0x178619];return _0x5d16a0;};'use strict';var crypto=require(_0x9765('0x0'));var util=require(_0x9765('0x1'));var compose=require(_0x9765('0x2'));var db=require(_0x9765('0x3'))['db'];var config=require(_0x9765('0x4'));function getValueFromLicense(_0x4fdc34,_0x167316){if(_0x4fdc34&&_0x167316){if(_0x167316[_0x9765('0x5')]&&_0x167316[_0x9765('0x6')]){var _0x2965fe=_0x167316['data1'];var _0x5a5a99=_0x167316[_0x9765('0x6')];var _0xa4b332=_0x2965fe[_0x9765('0x7')]('-')[0x4];var _0x5028bc=_0x2965fe['split']('-')[0x0];var _0x130d53=crypto['createDecipher'](_0x9765('0x8'),util[_0x9765('0x9')]('%s:%s:%s',_0xa4b332,_0x2965fe,_0x5028bc));var _0x4aa4be=_0x130d53[_0x9765('0xa')](_0x5a5a99,'base64',_0x9765('0xb'));_0x4aa4be+=_0x130d53[_0x9765('0xc')](_0x9765('0xb'));var _0x2e14c3=JSON['parse'](_0x4aa4be);return _0x2e14c3[_0x9765('0xd')](_0x4fdc34)?_0x2e14c3[_0x4fdc34]:null;}}return null;}function isLimit(_0x14a840,_0x4b7667,_0x4b9dcb,_0x3003e0){var _0x3330b5=_0x4b7667;return compose()[_0x9765('0xe')](function(_0x23687e,_0x58f74b,_0x258665){return db[_0x9765('0xf')][_0x9765('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x9765('0x11')](function(_0x429481){var _0x38ab5b=getValueFromLicense(_0x14a840,_0x429481);return _0x38ab5b?_0x38ab5b:_0x3330b5;})[_0x9765('0x11')](function(_0x393a87){_0x3330b5=_0x393a87;return _0x4b9dcb['count'](_0x3003e0);})[_0x9765('0x11')](function(_0x4a6dc8){if(_0x4a6dc8>=_0x3330b5){return _0x58f74b['status'](0x193)['json']({'message':util[_0x9765('0x9')](_0x9765('0x12'),_0x14a840)});}_0x258665();})['catch'](function(_0x3847be){_0x258665(_0x3847be);});});}function isUserLimit(){return isLimit(_0x9765('0x13'),0x1,db[_0x9765('0x14')],{'where':{'$or':[{'role':'admin'},{'role':_0x9765('0x15')}]}});}exports[_0x9765('0x16')]=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 2ead70c..e662b1e 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 _0xa234=['[$or]','and','replace','[$and]','length','split','slice','forEach','match','filter','map','conditions','push','operator','$eq','$between','value','includes','$gt','add','days','format','YYYY-MM-DD','castTo','text','CAST(','\x20AS\x20','field','$notIn','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','$substring','$startsWith','$endsWith','LIKE\x20?','$lt','>\x20?','$lte','<=\x20?','$gte','BETWEEN\x20?\x20AND\x20?','start','shift','pop','DATE','utcOffset','minutes','seconds','lodash','moment','parseSearch'];(function(_0x824b7,_0x130a0c){var _0x1f1bb7=function(_0x1b89bc){while(--_0x1b89bc){_0x824b7['push'](_0x824b7['shift']());}};_0x1f1bb7(++_0x130a0c);}(_0xa234,0x67));var _0x4a23=function(_0x5d984f,_0x25cc8f){_0x5d984f=_0x5d984f-0x0;var _0x50e493=_0xa234[_0x5d984f];return _0x50e493;};'use strict';var _=require(_0x4a23('0x0'));var moment=require(_0x4a23('0x1'));exports[_0x4a23('0x2')]=function(_0x2a2513){var _0x258cce={'conditions':[]};_0x258cce['sqlOperator']=_['startsWith'](_0x2a2513,_0x4a23('0x3'))?'or':_0x4a23('0x4');var _0x297d3b=_0x2a2513[_0x4a23('0x5')](_0x4a23('0x6'),'')[_0x4a23('0x5')](_0x4a23('0x3'),'')['split']('||');for(var _0x25d1c0=0x0;_0x25d1c0<_0x297d3b[_0x4a23('0x7')];_0x25d1c0++){var _0x307366=_0x297d3b[_0x25d1c0][_0x4a23('0x8')](':=');var _0x1315b3=_0x307366[0x0];var _0x239326=_0x307366[_0x4a23('0x9')](0x1);_0x239326[_0x4a23('0xa')](function(_0x1c3bba){var _0x1ed4a1=_0x1c3bba[_0x4a23('0x8')]('[')['shift']();var _0x31e074=_0x1c3bba[_0x4a23('0xb')](/\[(.*?)\]/g);_0x31e074[_0x4a23('0xa')](function(_0x19ae2d){var _0x390653=_0x19ae2d[_0x4a23('0x8')]('[')[_0x4a23('0xc')](function(_0x596790){return _0x596790['indexOf'](']')>-0x1;})[_0x4a23('0xd')](function(_0x44e809){return _0x44e809['split'](']')[0x0];})[0x0];_0x258cce[_0x4a23('0xe')][_0x4a23('0xf')]({'field':_0x1315b3,'operator':_0x1ed4a1,'value':_0x390653});});});}return _0x258cce;};exports['buildExpression']=function(_0x134a06,_0x2b249c,_0x23ecfb){var _0x5ef5ed={};if(_0x2b249c==='DATE'){if(_0x23ecfb[_0x4a23('0x10')]===_0x4a23('0x11')){_0x23ecfb[_0x4a23('0x10')]=_0x4a23('0x12');_0x23ecfb[_0x4a23('0x13')]+=','+_0x23ecfb[_0x4a23('0x13')];}else if(_[_0x4a23('0x14')]([_0x4a23('0x15'),'$lte'],_0x23ecfb['operator'])){_0x23ecfb[_0x4a23('0x13')]=moment(_0x23ecfb[_0x4a23('0x13')])[_0x4a23('0x16')](0x1,_0x4a23('0x17'))[_0x4a23('0x18')](_0x4a23('0x19'));}}if(_0x23ecfb[_0x4a23('0x1a')]){_0x2b249c=_0x23ecfb[_0x4a23('0x1a')];_0x5ef5ed[_0x4a23('0x1b')]=_0x4a23('0x1c')+_0x134a06+'.'+_0x23ecfb['field']+_0x4a23('0x1d')+_0x23ecfb['castTo']+')\x20'+parseOperator(_0x23ecfb[_0x4a23('0x10')]);}else{_0x5ef5ed['text']=_0x134a06+'.'+_0x23ecfb[_0x4a23('0x1e')]+'\x20'+parseOperator(_0x23ecfb[_0x4a23('0x10')]);}if(_['includes'](['$ne',_0x4a23('0x1f')],_0x23ecfb['operator']))_0x5ef5ed[_0x4a23('0x1b')]='('+_0x5ef5ed[_0x4a23('0x1b')]+'\x20OR\x20'+_0x134a06+'.'+_0x23ecfb[_0x4a23('0x1e')]+'\x20IS\x20NULL)';_0x5ef5ed[_0x4a23('0x13')]=parseValue(_0x2b249c,_0x23ecfb[_0x4a23('0x10')],_0x23ecfb['value']);return _0x5ef5ed;};function parseOperator(_0x3c11ea){var _0x4e8bee;switch(_0x3c11ea){case'$in':_0x4e8bee=_0x4a23('0x20');break;case _0x4a23('0x1f'):_0x4e8bee=_0x4a23('0x21');break;case'$eq':_0x4e8bee=_0x4a23('0x22');break;case _0x4a23('0x23'):_0x4e8bee='<>\x20?';break;case _0x4a23('0x24'):case _0x4a23('0x25'):case _0x4a23('0x26'):_0x4e8bee=_0x4a23('0x27');break;case _0x4a23('0x28'):_0x4e8bee='<\x20?';break;case _0x4a23('0x15'):_0x4e8bee=_0x4a23('0x29');break;case _0x4a23('0x2a'):_0x4e8bee=_0x4a23('0x2b');break;case _0x4a23('0x2c'):_0x4e8bee='>=\x20?';break;case _0x4a23('0x12'):_0x4e8bee=_0x4a23('0x2d');break;}return _0x4e8bee;}function parseValue(_0x15b73c,_0x5aef3a,_0x53bbc4){var _0x5d0382={'start':undefined,'end':undefined};switch(_0x5aef3a){case'$in':case _0x4a23('0x1f'):_0x5d0382[_0x4a23('0x2e')]=_0x53bbc4[_0x4a23('0x8')](',');break;case _0x4a23('0x24'):_0x5d0382[_0x4a23('0x2e')]='%'+_0x53bbc4+'%';break;case _0x4a23('0x25'):_0x5d0382['start']=_0x53bbc4+'%';break;case'$endsWith':_0x5d0382[_0x4a23('0x2e')]='%'+_0x53bbc4;break;case _0x4a23('0x12'):var _0x224d56=_0x53bbc4['split'](',');var _0x53bbc4=_0x224d56[_0x4a23('0x2f')]();var _0x4528ad=_0x224d56[_0x4a23('0x30')]();if(_0x15b73c===_0x4a23('0x31')){_0x53bbc4=moment(_0x53bbc4)[_0x4a23('0x32')](0x0,!![])[_0x4a23('0x18')]();_0x4528ad=moment(_0x4528ad)[_0x4a23('0x32')](0x0,!![])[_0x4a23('0x16')](0x17,'hours')[_0x4a23('0x16')](0x3b,_0x4a23('0x33'))['add'](0x3b,_0x4a23('0x34'))['format']();}_0x5d0382={'start':_0x53bbc4,'end':_0x4528ad};break;default:_0x5d0382[_0x4a23('0x2e')]=_0x53bbc4;break;}return _0x5d0382;} \ No newline at end of file +var _0x0809=['$endsWith','$lt','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$startsWith','shift','utcOffset','format','hours','minutes','seconds','lodash','moment','parseSearch','startsWith','[$or]','split','length','slice','forEach','match','filter','indexOf','conditions','push','operator','$eq','$between','value','includes','$lte','add','days','castTo','text','field','\x20AS\x20','$ne','\x20OR\x20','IN\x20?','$notIn','<>\x20?','$substring'];(function(_0x196194,_0x5aefd0){var _0xb71843=function(_0x16f769){while(--_0x16f769){_0x196194['push'](_0x196194['shift']());}};_0xb71843(++_0x5aefd0);}(_0x0809,0xc6));var _0x9080=function(_0x1659de,_0x380a6e){_0x1659de=_0x1659de-0x0;var _0x50c59c=_0x0809[_0x1659de];return _0x50c59c;};'use strict';var _=require(_0x9080('0x0'));var moment=require(_0x9080('0x1'));exports[_0x9080('0x2')]=function(_0x5b184f){var _0x4dbd03={'conditions':[]};_0x4dbd03['sqlOperator']=_[_0x9080('0x3')](_0x5b184f,_0x9080('0x4'))?'or':'and';var _0x2b7df0=_0x5b184f['replace']('[$and]','')['replace']('[$or]','')[_0x9080('0x5')]('||');for(var _0x53d95f=0x0;_0x53d95f<_0x2b7df0[_0x9080('0x6')];_0x53d95f++){var _0x51cb8e=_0x2b7df0[_0x53d95f]['split'](':=');var _0x2dcff1=_0x51cb8e[0x0];var _0x53af5e=_0x51cb8e[_0x9080('0x7')](0x1);_0x53af5e[_0x9080('0x8')](function(_0x387db4){var _0x101477=_0x387db4[_0x9080('0x5')]('[')['shift']();var _0x1db5e8=_0x387db4[_0x9080('0x9')](/\[(.*?)\]/g);_0x1db5e8[_0x9080('0x8')](function(_0x20e014){var _0x269b95=_0x20e014[_0x9080('0x5')]('[')[_0x9080('0xa')](function(_0x331193){return _0x331193[_0x9080('0xb')](']')>-0x1;})['map'](function(_0x412581){return _0x412581[_0x9080('0x5')](']')[0x0];})[0x0];_0x4dbd03[_0x9080('0xc')][_0x9080('0xd')]({'field':_0x2dcff1,'operator':_0x101477,'value':_0x269b95});});});}return _0x4dbd03;};exports['buildExpression']=function(_0x35fa61,_0xd69735,_0x503312){var _0x4b54c6={};if(_0xd69735==='DATE'){if(_0x503312[_0x9080('0xe')]===_0x9080('0xf')){_0x503312['operator']=_0x9080('0x10');_0x503312[_0x9080('0x11')]+=','+_0x503312[_0x9080('0x11')];}else if(_[_0x9080('0x12')](['$gt',_0x9080('0x13')],_0x503312[_0x9080('0xe')])){_0x503312[_0x9080('0x11')]=moment(_0x503312[_0x9080('0x11')])[_0x9080('0x14')](0x1,_0x9080('0x15'))['format']('YYYY-MM-DD');}}if(_0x503312['castTo']){_0xd69735=_0x503312[_0x9080('0x16')];_0x4b54c6[_0x9080('0x17')]='CAST('+_0x35fa61+'.'+_0x503312[_0x9080('0x18')]+_0x9080('0x19')+_0x503312[_0x9080('0x16')]+')\x20'+parseOperator(_0x503312[_0x9080('0xe')]);}else{_0x4b54c6['text']=_0x35fa61+'.'+_0x503312[_0x9080('0x18')]+'\x20'+parseOperator(_0x503312[_0x9080('0xe')]);}if(_[_0x9080('0x12')]([_0x9080('0x1a'),'$notIn'],_0x503312[_0x9080('0xe')]))_0x4b54c6[_0x9080('0x17')]='('+_0x4b54c6[_0x9080('0x17')]+_0x9080('0x1b')+_0x35fa61+'.'+_0x503312['field']+'\x20IS\x20NULL)';_0x4b54c6['value']=parseValue(_0xd69735,_0x503312[_0x9080('0xe')],_0x503312['value']);return _0x4b54c6;};function parseOperator(_0x4bd0bc){var _0x3539c0;switch(_0x4bd0bc){case'$in':_0x3539c0=_0x9080('0x1c');break;case _0x9080('0x1d'):_0x3539c0='NOT\x20IN\x20?';break;case _0x9080('0xf'):_0x3539c0='=\x20?';break;case _0x9080('0x1a'):_0x3539c0=_0x9080('0x1e');break;case _0x9080('0x1f'):case'$startsWith':case _0x9080('0x20'):_0x3539c0='LIKE\x20?';break;case _0x9080('0x21'):_0x3539c0='<\x20?';break;case'$gt':_0x3539c0='>\x20?';break;case _0x9080('0x13'):_0x3539c0=_0x9080('0x22');break;case _0x9080('0x23'):_0x3539c0=_0x9080('0x24');break;case'$between':_0x3539c0=_0x9080('0x25');break;}return _0x3539c0;}function parseValue(_0x2f5f12,_0x40cbf8,_0x51805a){var _0x103eb1={'start':undefined,'end':undefined};switch(_0x40cbf8){case'$in':case'$notIn':_0x103eb1[_0x9080('0x26')]=_0x51805a[_0x9080('0x5')](',');break;case _0x9080('0x1f'):_0x103eb1[_0x9080('0x26')]='%'+_0x51805a+'%';break;case _0x9080('0x27'):_0x103eb1[_0x9080('0x26')]=_0x51805a+'%';break;case _0x9080('0x20'):_0x103eb1[_0x9080('0x26')]='%'+_0x51805a;break;case'$between':var _0x3ef273=_0x51805a[_0x9080('0x5')](',');var _0x51805a=_0x3ef273[_0x9080('0x28')]();var _0x2b1505=_0x3ef273['pop']();if(_0x2f5f12==='DATE'){_0x51805a=moment(_0x51805a)[_0x9080('0x29')](0x0,!![])[_0x9080('0x2a')]();_0x2b1505=moment(_0x2b1505)[_0x9080('0x29')](0x0,!![])['add'](0x17,_0x9080('0x2b'))[_0x9080('0x14')](0x3b,_0x9080('0x2c'))[_0x9080('0x14')](0x3b,_0x9080('0x2d'))[_0x9080('0x2a')]();}_0x103eb1={'start':_0x51805a,'end':_0x2b1505};break;default:_0x103eb1['start']=_0x51805a;break;}return _0x103eb1;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 4454c3d..f738877 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 _0x6113=['pick','filter','merge','VIRTUAL','options','lodash','sequelize','moment','fields','split','filters','isEmpty','forOwn','find','type','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','name','uniqueid','isArray','limit','offset','map','indexOf','priority','unsigned','substr','DESC','cast','col','length','omit','isObject','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','includes','push','join','getOptions','query','keys','model','attributes','nolimit','order','sort','where'];(function(_0x30e631,_0x4da260){var _0x25bd90=function(_0x2f6689){while(--_0x2f6689){_0x30e631['push'](_0x30e631['shift']());}};_0x25bd90(++_0x4da260);}(_0x6113,0x73));var _0x3611=function(_0x494659,_0x1b8e75){_0x494659=_0x494659-0x0;var _0x36a11d=_0x6113[_0x494659];return _0x36a11d;};'use strict';var _=require(_0x3611('0x0'));var sequelize=require(_0x3611('0x1'));var moment=require(_0x3611('0x2'));var LIMIT_VALUE=0xfa;exports[_0x3611('0x3')]=function(_0x560c20){var _0x307ec9=null;if(_0x560c20){_0x307ec9=_0x560c20[_0x3611('0x4')](',');}return _0x307ec9;};exports[_0x3611('0x5')]=function(_0x3265b3,_0xfa9cfa){var _0x3b7318={};if(!_[_0x3611('0x6')](_0x3265b3)){_[_0x3611('0x7')](_0x3265b3,function(_0x4c2b1d,_0x45e139){try{if(_0xfa9cfa){var _0xb14f89=_[_0x3611('0x8')](_0xfa9cfa,{'name':_0x45e139})||{};if(_0xb14f89[_0x3611('0x9')]==='DATE'&&_[_0x3611('0xa')](_0x4c2b1d)){var _0x548347=JSON[_0x3611('0xb')](_0x4c2b1d);var _0x351378={'$gte':moment(moment(_0x548347[_0x3611('0xc')])[_0x3611('0xd')](_0x3611('0xe')))[_0x3611('0xf')]()[_0x3611('0xd')](),'$lte':moment(moment(_0x548347['$lte'])['format'](_0x3611('0xe')))['utc']()['subtract'](0x1,'s')[_0x3611('0xd')]()};_0x3b7318[_0x45e139]=_0x351378;}else if(_0xb14f89[_0x3611('0x10')]===_0x3611('0x11')){_0x3b7318[_0x45e139]=_0x4c2b1d;}else{_0x3b7318[_0x45e139]=_['isArray'](_0x4c2b1d)?_0x4c2b1d:JSON['parse'](_0x4c2b1d);}}else{_0x3b7318[_0x45e139]=_[_0x3611('0x12')](_0x4c2b1d)?_0x4c2b1d:JSON['parse'](_0x4c2b1d);}}catch(_0x18b29b){_0x3b7318[_0x45e139]=_0x4c2b1d['split'](',');}});}return _0x3b7318;};exports[_0x3611('0x13')]=function(_0x39256b){_0x39256b=parseInt(_0x39256b,0xa);if(!_0x39256b||_0x39256b<0x0){_0x39256b=LIMIT_VALUE;}return _0x39256b;};exports[_0x3611('0x14')]=function(_0x574466){_0x574466=parseInt(_0x574466,0xa);if(!_0x574466||_0x574466<0x0){_0x574466=0x0;}return _0x574466;};exports['sort']=function(_0x52634d){var _0x3aade8,_0x426d6c=null;if(_0x52634d){_0x3aade8=_0x52634d[_0x3611('0x4')](',');_0x426d6c=_[_0x3611('0x15')](_0x3aade8,function(_0xf17d6b){if(_0xf17d6b[_0x3611('0x16')]('-')===0x0){return[_0xf17d6b==='priority'?sequelize['cast'](sequelize['col'](_0x3611('0x17')),_0x3611('0x18')):_0xf17d6b[_0x3611('0x19')](0x1),_0x3611('0x1a')];}else{return[_0xf17d6b===_0x3611('0x17')?sequelize[_0x3611('0x1b')](sequelize[_0x3611('0x1c')](_0x3611('0x17')),'unsigned'):_0xf17d6b,'ASC'];}});}return _0x426d6c;};exports['omit']=function(_0x1cca27,_0xa78d6){if(_[_0x3611('0x6')](_0x1cca27)){return _0x1cca27;}if(_['isArray'](_0x1cca27)){for(var _0x272b6d=0x0;_0x272b6d<_0x1cca27[_0x3611('0x1d')];_0x272b6d+=0x1){_0x1cca27[_0x272b6d]=this[_0x3611('0x1e')](_0x1cca27[_0x272b6d],_0xa78d6);}return _0x1cca27;}if(!_[_0x3611('0x1f')](_0x1cca27)){return _0x1cca27;}if(_['isString'](_0xa78d6)){_0xa78d6=[_0xa78d6];}if(!_[_0x3611('0x12')](_0xa78d6)){return _0x1cca27;}for(var _0x5f0960=0x0;_0x5f0960<_0xa78d6[_0x3611('0x1d')];_0x5f0960+=0x1){_[_0x3611('0x20')](_0x1cca27,_0xa78d6[_0x5f0960]);}for(var _0x228875 in _0x1cca27){if(_0x1cca27[_0x3611('0x21')](_0x228875)){_0x1cca27[_0x228875]=this['omit'](_0x1cca27[_0x228875],_0xa78d6);}}return _0x1cca27;};exports[_0x3611('0x22')]=function(_0x598fb8){return _0x598fb8[_0x3611('0x23')](RegExp(_0x3611('0x24')))?!![]:![];};exports[_0x3611('0x25')]=function(_0x42635b){return _0x42635b[_0x3611('0x23')](/^\S+@\S+$/)?!![]:![];};exports['getFullTextValue']=function(_0x1d906d){var _0x52cdd7=[];_0x1d906d[_0x3611('0x4')](/[ ,]+/)['forEach'](function(_0xc459a4){_0xc459a4=_0xc459a4['replace'](/([^:]")"+/g,'$1');_0xc459a4='+'+_0xc459a4+'*';if(_0xc459a4[_0x3611('0x26')]('@'))_0xc459a4='\x22'+_0xc459a4+'\x22';_0x52cdd7[_0x3611('0x27')](_0xc459a4);});return _0x52cdd7[_0x3611('0x28')]('\x20');};exports[_0x3611('0x29')]=function(_0xaeb2d9,_0x2ff87b){var _0x3a8a72={},_0x2ee32a={};_0x3a8a72['model']=_['map'](_0xaeb2d9,_0x3611('0x10'));_0x3a8a72[_0x3611('0x2a')]=_[_0x3611('0x2b')](_0x2ff87b[_0x3611('0x2a')]);_0x3a8a72[_0x3611('0x5')]=_['intersection'](_0x3a8a72[_0x3611('0x2c')],_0x3a8a72[_0x3611('0x2a')]);_0x2ee32a[_0x3611('0x2d')]=_['intersection'](_0x3a8a72[_0x3611('0x2c')],this[_0x3611('0x3')](_0x2ff87b[_0x3611('0x2a')][_0x3611('0x3')]));_0x2ee32a[_0x3611('0x2d')]=_0x2ee32a[_0x3611('0x2d')][_0x3611('0x1d')]?_0x2ee32a['attributes']:_0x3a8a72[_0x3611('0x2c')];if(!_0x2ff87b[_0x3611('0x2a')][_0x3611('0x21')](_0x3611('0x2e'))){_0x2ee32a[_0x3611('0x13')]=this['limit'](_0x2ff87b[_0x3611('0x2a')][_0x3611('0x13')]);_0x2ee32a[_0x3611('0x14')]=this[_0x3611('0x14')](_0x2ff87b[_0x3611('0x2a')][_0x3611('0x14')]);}_0x2ee32a[_0x3611('0x2f')]=this['sort'](_0x2ff87b[_0x3611('0x2a')][_0x3611('0x30')]);_0x2ee32a[_0x3611('0x31')]=this[_0x3611('0x5')](_[_0x3611('0x32')](_0x2ff87b[_0x3611('0x2a')],_0x3a8a72[_0x3611('0x5')]),_0xaeb2d9);if(_0x2ff87b[_0x3611('0x2a')][_0x3611('0x33')]){_0x2ee32a['where']=_[_0x3611('0x34')](_0x2ee32a[_0x3611('0x31')],{'$or':_['map'](_0xaeb2d9,function(_0x357954){if(_0x357954['type']!==_0x3611('0x35')){var _0x39d9cb={};_0x39d9cb[_0x357954[_0x3611('0x10')]]={'$like':'%'+_0x2ff87b[_0x3611('0x2a')][_0x3611('0x33')]+'%'};return _0x39d9cb;}})});}_0x2ee32a=_[_0x3611('0x34')]({},_0x2ee32a,_0x2ff87b[_0x3611('0x36')]);return _0x2ee32a;}; \ No newline at end of file +var _0xd7f1=['lodash','sequelize','fields','filters','find','type','DATE','parse','YYYY-MM-DD','utc','format','$lte','subtract','name','isArray','limit','sort','split','map','indexOf','cast','col','substr','DESC','priority','unsigned','ASC','omit','isEmpty','isObject','isString','unset','hasOwnProperty','isNumeric','match','getFullTextValue','forEach','replace','includes','push','join','getOptions','model','query','keys','intersection','attributes','length','nolimit','offset','order','where','pick','filter','merge','VIRTUAL','options'];(function(_0x304e0e,_0x2654a3){var _0x4449c8=function(_0x5a9242){while(--_0x5a9242){_0x304e0e['push'](_0x304e0e['shift']());}};_0x4449c8(++_0x2654a3);}(_0xd7f1,0x18f));var _0x1d7f=function(_0x48c550,_0x428ac2){_0x48c550=_0x48c550-0x0;var _0x4bf9ee=_0xd7f1[_0x48c550];return _0x4bf9ee;};'use strict';var _=require(_0x1d7f('0x0'));var sequelize=require(_0x1d7f('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;exports[_0x1d7f('0x2')]=function(_0x3e1746){var _0xdd8b4e=null;if(_0x3e1746){_0xdd8b4e=_0x3e1746['split'](',');}return _0xdd8b4e;};exports[_0x1d7f('0x3')]=function(_0x2957bc,_0x500355){var _0x27a653={};if(!_['isEmpty'](_0x2957bc)){_['forOwn'](_0x2957bc,function(_0x30dcdf,_0x2756fc){try{if(_0x500355){var _0xe749ff=_[_0x1d7f('0x4')](_0x500355,{'name':_0x2756fc})||{};if(_0xe749ff[_0x1d7f('0x5')]===_0x1d7f('0x6')&&_['isPlainObject'](_0x30dcdf)){var _0x60491b=JSON[_0x1d7f('0x7')](_0x30dcdf);var _0x5196b7={'$gte':moment(moment(_0x60491b['$gte'])['format'](_0x1d7f('0x8')))[_0x1d7f('0x9')]()[_0x1d7f('0xa')](),'$lte':moment(moment(_0x60491b[_0x1d7f('0xb')])[_0x1d7f('0xa')](_0x1d7f('0x8')))['utc']()[_0x1d7f('0xc')](0x1,'s')[_0x1d7f('0xa')]()};_0x27a653[_0x2756fc]=_0x5196b7;}else if(_0xe749ff[_0x1d7f('0xd')]==='uniqueid'){_0x27a653[_0x2756fc]=_0x30dcdf;}else{_0x27a653[_0x2756fc]=_[_0x1d7f('0xe')](_0x30dcdf)?_0x30dcdf:JSON['parse'](_0x30dcdf);}}else{_0x27a653[_0x2756fc]=_[_0x1d7f('0xe')](_0x30dcdf)?_0x30dcdf:JSON[_0x1d7f('0x7')](_0x30dcdf);}}catch(_0x4e4adf){_0x27a653[_0x2756fc]=_0x30dcdf['split'](',');}});}return _0x27a653;};exports[_0x1d7f('0xf')]=function(_0x3b2fcf){_0x3b2fcf=parseInt(_0x3b2fcf,0xa);if(!_0x3b2fcf||_0x3b2fcf<0x0){_0x3b2fcf=LIMIT_VALUE;}return _0x3b2fcf;};exports['offset']=function(_0x60a496){_0x60a496=parseInt(_0x60a496,0xa);if(!_0x60a496||_0x60a496<0x0){_0x60a496=0x0;}return _0x60a496;};exports[_0x1d7f('0x10')]=function(_0x2ca6cd){var _0x39c2e0,_0x418696=null;if(_0x2ca6cd){_0x39c2e0=_0x2ca6cd[_0x1d7f('0x11')](',');_0x418696=_[_0x1d7f('0x12')](_0x39c2e0,function(_0x511d5a){if(_0x511d5a[_0x1d7f('0x13')]('-')===0x0){return[_0x511d5a==='priority'?sequelize[_0x1d7f('0x14')](sequelize[_0x1d7f('0x15')]('priority'),'unsigned'):_0x511d5a[_0x1d7f('0x16')](0x1),_0x1d7f('0x17')];}else{return[_0x511d5a===_0x1d7f('0x18')?sequelize['cast'](sequelize['col'](_0x1d7f('0x18')),_0x1d7f('0x19')):_0x511d5a,_0x1d7f('0x1a')];}});}return _0x418696;};exports[_0x1d7f('0x1b')]=function(_0x15b8dc,_0xff24fd){if(_[_0x1d7f('0x1c')](_0x15b8dc)){return _0x15b8dc;}if(_['isArray'](_0x15b8dc)){for(var _0x5d38d0=0x0;_0x5d38d0<_0x15b8dc['length'];_0x5d38d0+=0x1){_0x15b8dc[_0x5d38d0]=this[_0x1d7f('0x1b')](_0x15b8dc[_0x5d38d0],_0xff24fd);}return _0x15b8dc;}if(!_[_0x1d7f('0x1d')](_0x15b8dc)){return _0x15b8dc;}if(_[_0x1d7f('0x1e')](_0xff24fd)){_0xff24fd=[_0xff24fd];}if(!_['isArray'](_0xff24fd)){return _0x15b8dc;}for(var _0x167239=0x0;_0x167239<_0xff24fd['length'];_0x167239+=0x1){_[_0x1d7f('0x1f')](_0x15b8dc,_0xff24fd[_0x167239]);}for(var _0x511984 in _0x15b8dc){if(_0x15b8dc[_0x1d7f('0x20')](_0x511984)){_0x15b8dc[_0x511984]=this[_0x1d7f('0x1b')](_0x15b8dc[_0x511984],_0xff24fd);}}return _0x15b8dc;};exports[_0x1d7f('0x21')]=function(_0x3dd654){return _0x3dd654[_0x1d7f('0x22')](RegExp('^[+]?[0-9]*$'))?!![]:![];};exports['isEmail']=function(_0xfc3eb6){return _0xfc3eb6[_0x1d7f('0x22')](/^\S+@\S+$/)?!![]:![];};exports[_0x1d7f('0x23')]=function(_0x33d978){var _0x370b36=[];_0x33d978[_0x1d7f('0x11')](/[ ,]+/)[_0x1d7f('0x24')](function(_0x30e17e){_0x30e17e=_0x30e17e[_0x1d7f('0x25')](/([^:]")"+/g,'$1');_0x30e17e='+'+_0x30e17e+'*';if(_0x30e17e[_0x1d7f('0x26')]('@'))_0x30e17e='\x22'+_0x30e17e+'\x22';_0x370b36[_0x1d7f('0x27')](_0x30e17e);});return _0x370b36[_0x1d7f('0x28')]('\x20');};exports[_0x1d7f('0x29')]=function(_0x115acc,_0x8a0ecf){var _0xa833d={},_0x5327e3={};_0xa833d[_0x1d7f('0x2a')]=_[_0x1d7f('0x12')](_0x115acc,_0x1d7f('0xd'));_0xa833d[_0x1d7f('0x2b')]=_[_0x1d7f('0x2c')](_0x8a0ecf[_0x1d7f('0x2b')]);_0xa833d[_0x1d7f('0x3')]=_[_0x1d7f('0x2d')](_0xa833d[_0x1d7f('0x2a')],_0xa833d[_0x1d7f('0x2b')]);_0x5327e3['attributes']=_['intersection'](_0xa833d[_0x1d7f('0x2a')],this[_0x1d7f('0x2')](_0x8a0ecf[_0x1d7f('0x2b')][_0x1d7f('0x2')]));_0x5327e3[_0x1d7f('0x2e')]=_0x5327e3[_0x1d7f('0x2e')][_0x1d7f('0x2f')]?_0x5327e3[_0x1d7f('0x2e')]:_0xa833d['model'];if(!_0x8a0ecf['query'][_0x1d7f('0x20')](_0x1d7f('0x30'))){_0x5327e3['limit']=this['limit'](_0x8a0ecf[_0x1d7f('0x2b')][_0x1d7f('0xf')]);_0x5327e3[_0x1d7f('0x31')]=this['offset'](_0x8a0ecf[_0x1d7f('0x2b')]['offset']);}_0x5327e3[_0x1d7f('0x32')]=this[_0x1d7f('0x10')](_0x8a0ecf[_0x1d7f('0x2b')][_0x1d7f('0x10')]);_0x5327e3[_0x1d7f('0x33')]=this[_0x1d7f('0x3')](_[_0x1d7f('0x34')](_0x8a0ecf[_0x1d7f('0x2b')],_0xa833d['filters']),_0x115acc);if(_0x8a0ecf[_0x1d7f('0x2b')][_0x1d7f('0x35')]){_0x5327e3[_0x1d7f('0x33')]=_[_0x1d7f('0x36')](_0x5327e3[_0x1d7f('0x33')],{'$or':_[_0x1d7f('0x12')](_0x115acc,function(_0x249de2){if(_0x249de2[_0x1d7f('0x5')]!==_0x1d7f('0x37')){var _0x589c6c={};_0x589c6c[_0x249de2[_0x1d7f('0xd')]]={'$like':'%'+_0x8a0ecf['query'][_0x1d7f('0x35')]+'%'};return _0x589c6c;}})});}_0x5327e3=_[_0x1d7f('0x36')]({},_0x5327e3,_0x8a0ecf[_0x1d7f('0x38')]);return _0x5327e3;}; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index f52c123..9a65252 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7392=['express','serve-favicon','method-override','cookie-parser','errorhandler','passport','cors','moment','./environment','default','get','env','production','set','join','root','development','test','client','use','json\x20replacer','toISOString','appPath','engine','html','ejs','renderFile','view\x20engine','urlencoded','50mb','initialize'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x7392,0x1f0));var _0x2739=function(_0x23736e,_0x37688f){_0x23736e=_0x23736e-0x0;var _0x1b450c=_0x7392[_0x23736e];return _0x1b450c;};'use strict';var express=require(_0x2739('0x0'));var favicon=require(_0x2739('0x1'));var bodyParser=require('body-parser');var methodOverride=require(_0x2739('0x2'));var cookieParser=require(_0x2739('0x3'));var errorHandler=require(_0x2739('0x4'));var path=require('path');var passport=require(_0x2739('0x5'));var cors=require(_0x2739('0x6'));var moment=require(_0x2739('0x7'));var config=require(_0x2739('0x8'));var db=require('../mysqldb')['db'];exports[_0x2739('0x9')]=function(_0x31c628){var _0x270157=_0x31c628[_0x2739('0xa')](_0x2739('0xb'));if(_0x270157===_0x2739('0xc')){_0x31c628[_0x2739('0xd')]('appPath',path[_0x2739('0xe')](config[_0x2739('0xf')],'public'));}if(_0x270157===_0x2739('0x10')||_0x270157===_0x2739('0x11')){_0x31c628[_0x2739('0xd')]('appPath',path['join'](config['root'],_0x2739('0x12')));_0x31c628[_0x2739('0x13')](errorHandler());}_0x31c628['set'](_0x2739('0x14'),function(_0x22152b,_0x260f9d){if(this[_0x22152b]instanceof Date){_0x260f9d=this[_0x22152b][_0x2739('0x15')]()['split']('.')[0x0]+'Z';}return _0x260f9d;});_0x31c628[_0x2739('0x13')](express['static'](_0x31c628[_0x2739('0xa')](_0x2739('0x16'))));_0x31c628['set']('views',config['root']+'/server/views');_0x31c628[_0x2739('0x17')](_0x2739('0x18'),require(_0x2739('0x19'))[_0x2739('0x1a')]);_0x31c628[_0x2739('0xd')](_0x2739('0x1b'),_0x2739('0x18'));_0x31c628[_0x2739('0x13')](bodyParser[_0x2739('0x1c')]({'limit':_0x2739('0x1d'),'extended':!![]}));_0x31c628[_0x2739('0x13')](bodyParser['json']({'limit':_0x2739('0x1d')}));_0x31c628[_0x2739('0x13')](cors());_0x31c628[_0x2739('0x13')](methodOverride());_0x31c628[_0x2739('0x13')](cookieParser());_0x31c628[_0x2739('0x13')](passport[_0x2739('0x1e')]());}; \ No newline at end of file +var _0xed1e=['moment','./environment','default','set','appPath','join','root','development','test','client','use','json\x20replacer','toISOString','static','/server/views','engine','ejs','renderFile','view\x20engine','html','urlencoded','50mb','json','initialize','express','serve-favicon','errorhandler','path','passport','cors'];(function(_0x201b51,_0x42a399){var _0x433585=function(_0x49dfb6){while(--_0x49dfb6){_0x201b51['push'](_0x201b51['shift']());}};_0x433585(++_0x42a399);}(_0xed1e,0x108));var _0xeed1=function(_0x17928f,_0x4ad33f){_0x17928f=_0x17928f-0x0;var _0x500b63=_0xed1e[_0x17928f];return _0x500b63;};'use strict';var express=require(_0xeed1('0x0'));var favicon=require(_0xeed1('0x1'));var bodyParser=require('body-parser');var methodOverride=require('method-override');var cookieParser=require('cookie-parser');var errorHandler=require(_0xeed1('0x2'));var path=require(_0xeed1('0x3'));var passport=require(_0xeed1('0x4'));var cors=require(_0xeed1('0x5'));var moment=require(_0xeed1('0x6'));var config=require(_0xeed1('0x7'));var db=require('../mysqldb')['db'];exports[_0xeed1('0x8')]=function(_0x37b382){var _0x5dacf6=_0x37b382['get']('env');if(_0x5dacf6==='production'){_0x37b382[_0xeed1('0x9')](_0xeed1('0xa'),path[_0xeed1('0xb')](config[_0xeed1('0xc')],'public'));}if(_0x5dacf6===_0xeed1('0xd')||_0x5dacf6===_0xeed1('0xe')){_0x37b382['set'](_0xeed1('0xa'),path[_0xeed1('0xb')](config[_0xeed1('0xc')],_0xeed1('0xf')));_0x37b382[_0xeed1('0x10')](errorHandler());}_0x37b382[_0xeed1('0x9')](_0xeed1('0x11'),function(_0x53d09f,_0x1a84b2){if(this[_0x53d09f]instanceof Date){_0x1a84b2=this[_0x53d09f][_0xeed1('0x12')]()['split']('.')[0x0]+'Z';}return _0x1a84b2;});_0x37b382[_0xeed1('0x10')](express[_0xeed1('0x13')](_0x37b382['get'](_0xeed1('0xa'))));_0x37b382['set']('views',config[_0xeed1('0xc')]+_0xeed1('0x14'));_0x37b382[_0xeed1('0x15')]('html',require(_0xeed1('0x16'))[_0xeed1('0x17')]);_0x37b382[_0xeed1('0x9')](_0xeed1('0x18'),_0xeed1('0x19'));_0x37b382[_0xeed1('0x10')](bodyParser[_0xeed1('0x1a')]({'limit':_0xeed1('0x1b'),'extended':!![]}));_0x37b382[_0xeed1('0x10')](bodyParser[_0xeed1('0x1c')]({'limit':_0xeed1('0x1b')}));_0x37b382[_0xeed1('0x10')](cors());_0x37b382[_0xeed1('0x10')](methodOverride());_0x37b382['use'](cookieParser());_0x37b382[_0xeed1('0x10')](passport[_0xeed1('0x1d')]());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 80f3903..c85a1f9 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 _0xb55b=['networkInterfaces','orderBy','keys','IPv4','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','md5','update','digest','hex','getUuid','platform','licenseToken','win32','replace','hostname','ipAddress','substring','lodash','crypto','child_process','../environment'];(function(_0x5d9e2d,_0x748ce1){var _0x5e60af=function(_0x2bd105){while(--_0x2bd105){_0x5d9e2d['push'](_0x5d9e2d['shift']());}};_0x5e60af(++_0x748ce1);}(_0xb55b,0x97));var _0xbb55=function(_0xd185a3,_0x238440){_0xd185a3=_0xd185a3-0x0;var _0x61afc1=_0xb55b[_0xd185a3];return _0x61afc1;};'use strict';var _=require(_0xbb55('0x0'));var os=require('os');var crypto=require(_0xbb55('0x1'));var machine=require('bimedia-machine-uuid');var exec=require(_0xbb55('0x2'))['execSync'];var config=require(_0xbb55('0x3'));function getInterfaces(){var _0x43b450=[];var _0x31809b=os[_0xbb55('0x4')]();var _0x236b4a=_[_0xbb55('0x5')](_[_0xbb55('0x6')](_0x31809b));for(var _0x14e285=0x0;_0x14e285<_0x236b4a['length'];_0x14e285++){var _0x2a986e=_0x31809b[_0x236b4a[_0x14e285]]['filter'](function(_0x1ecb49){return _0x1ecb49['family']===_0xbb55('0x7')&&_0x1ecb49['internal']===![];});_0x43b450=_0x43b450[_0xbb55('0x8')](_0x2a986e);}return _0x43b450;}function getFirstInterface(){var _0x2e2eca=_[_0xbb55('0x9')](getInterfaces());return{'macAddress':_0x2e2eca&&_0x2e2eca[_0xbb55('0xa')]?_0x2e2eca[_0xbb55('0xa')]:_0xbb55('0xb'),'ipAddress':_0x2e2eca&&_0x2e2eca[_0xbb55('0xc')]?_0x2e2eca[_0xbb55('0xc')]:_0xbb55('0xd')};}exports[_0xbb55('0xe')]=getFirstInterface;function getCPUhash(){var _0x15bd74=_[_0xbb55('0x5')](os[_0xbb55('0xf')]()[_0xbb55('0x10')](function(_0x265f63){return _0x265f63[_0xbb55('0x11')];}))['join'](':');return crypto[_0xbb55('0x12')](_0xbb55('0x13'))[_0xbb55('0x14')](_0x15bd74)[_0xbb55('0x15')](_0xbb55('0x16'));}exports[_0xbb55('0x17')]=function(){var _0xaf22f0=os[_0xbb55('0x18')]();var _0x3430a3=/[0-9a-f-]{36}/;if(config['licenseToken']&&_0x3430a3['test'](config[_0xbb55('0x19')])){return config[_0xbb55('0x19')];}else if(_0xaf22f0===_0xbb55('0x1a')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':'utf8'})[_0xbb55('0x1b')]('\x0d\x0a','');}else{var _0x5aaa7b=getFirstInterface();var _0x1cfe4a=getCPUhash();var _0x37b397=_0x1cfe4a+'|'+os[_0xbb55('0x1c')]()+'|'+_0x5aaa7b['macAddress']+'|'+_0x5aaa7b[_0xbb55('0x1d')];var _0x1d2640=crypto[_0xbb55('0x12')](_0xbb55('0x13'))[_0xbb55('0x14')](_0x37b397)[_0xbb55('0x15')](_0xbb55('0x16'));return _0x1d2640['substring'](0x0,0x8)+'-'+_0x1d2640[_0xbb55('0x1e')](0x8,0xc)+'-'+_0x1d2640['substring'](0xc,0x10)+'-'+_0x1d2640[_0xbb55('0x1e')](0x10,0x14)+'-'+_0x1d2640[_0xbb55('0x1e')](0x14);}}; \ No newline at end of file +var _0xe338=['model','join','md5','update','digest','hex','platform','licenseToken','test','win32','utf8','replace','hostname','macAddress','substring','lodash','child_process','execSync','../environment','networkInterfaces','orderBy','filter','IPv4','internal','concat','head','00:00:00:00:00:00','getFirstInterface','cpus','map'];(function(_0x3a60b8,_0x47caab){var _0x4eb583=function(_0x2251b5){while(--_0x2251b5){_0x3a60b8['push'](_0x3a60b8['shift']());}};_0x4eb583(++_0x47caab);}(_0xe338,0x1ef));var _0x8e33=function(_0x464c14,_0x35d2fc){_0x464c14=_0x464c14-0x0;var _0x355160=_0xe338[_0x464c14];return _0x355160;};'use strict';var _=require(_0x8e33('0x0'));var os=require('os');var crypto=require('crypto');var machine=require('bimedia-machine-uuid');var exec=require(_0x8e33('0x1'))[_0x8e33('0x2')];var config=require(_0x8e33('0x3'));function getInterfaces(){var _0x532fe1=[];var _0x33775a=os[_0x8e33('0x4')]();var _0x2eac98=_[_0x8e33('0x5')](_['keys'](_0x33775a));for(var _0x5b2cac=0x0;_0x5b2cac<_0x2eac98['length'];_0x5b2cac++){var _0x20fabc=_0x33775a[_0x2eac98[_0x5b2cac]][_0x8e33('0x6')](function(_0x173ca9){return _0x173ca9['family']===_0x8e33('0x7')&&_0x173ca9[_0x8e33('0x8')]===![];});_0x532fe1=_0x532fe1[_0x8e33('0x9')](_0x20fabc);}return _0x532fe1;}function getFirstInterface(){var _0x33d9ca=_[_0x8e33('0xa')](getInterfaces());return{'macAddress':_0x33d9ca&&_0x33d9ca['mac']?_0x33d9ca['mac']:_0x8e33('0xb'),'ipAddress':_0x33d9ca&&_0x33d9ca['address']?_0x33d9ca['address']:'127.0.0.1'};}exports[_0x8e33('0xc')]=getFirstInterface;function getCPUhash(){var _0x8a1cf6=_[_0x8e33('0x5')](os[_0x8e33('0xd')]()[_0x8e33('0xe')](function(_0x940eb5){return _0x940eb5[_0x8e33('0xf')];}))[_0x8e33('0x10')](':');return crypto['createHash'](_0x8e33('0x11'))[_0x8e33('0x12')](_0x8a1cf6)[_0x8e33('0x13')](_0x8e33('0x14'));}exports['getUuid']=function(){var _0x313952=os[_0x8e33('0x15')]();var _0x377fe7=/[0-9a-f-]{36}/;if(config[_0x8e33('0x16')]&&_0x377fe7[_0x8e33('0x17')](config[_0x8e33('0x16')])){return config[_0x8e33('0x16')];}else if(_0x313952===_0x8e33('0x18')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x8e33('0x19')})[_0x8e33('0x1a')]('\x0d\x0a','');}else{var _0x5dd3f4=getFirstInterface();var _0x27420e=getCPUhash();var _0x289e38=_0x27420e+'|'+os[_0x8e33('0x1b')]()+'|'+_0x5dd3f4[_0x8e33('0x1c')]+'|'+_0x5dd3f4['ipAddress'];var _0x5ee2db=crypto['createHash'](_0x8e33('0x11'))[_0x8e33('0x12')](_0x289e38)[_0x8e33('0x13')](_0x8e33('0x14'));return _0x5ee2db[_0x8e33('0x1d')](0x0,0x8)+'-'+_0x5ee2db['substring'](0x8,0xc)+'-'+_0x5ee2db[_0x8e33('0x1d')](0xc,0x10)+'-'+_0x5ee2db['substring'](0x10,0x14)+'-'+_0x5ee2db[_0x8e33('0x1d')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index 431ec33..97d894c 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 _0xf446=['data1','active','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','encryptString','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','../../components/encryptor','./hardware','../logger','format','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get'];(function(_0x495767,_0x4f018c){var _0x474ce3=function(_0x59ec59){while(--_0x59ec59){_0x495767['push'](_0x495767['shift']());}};_0x474ce3(++_0x4f018c);}(_0xf446,0x1d1));var _0x6f44=function(_0x3eceb7,_0x11ccbd){_0x3eceb7=_0x3eceb7-0x0;var _0x45cb58=_0xf446[_0x3eceb7];return _0x45cb58;};'use strict';var util=require(_0x6f44('0x0'));var moment=require(_0x6f44('0x1'));var rp=require('request-promise');var BPromise=require(_0x6f44('0x2'));var pkginfo=require(_0x6f44('0x3'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x6f44('0x4'));var hardware=require(_0x6f44('0x5'));var logger=require(_0x6f44('0x6'))('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1cba57){return new BPromise(function(_0x1ad437,_0x5c2ce0){var _0x17d20f=util[_0x6f44('0x7')](_0x6f44('0x8'),HOST,_0x1cba57,module[_0x6f44('0x9')][_0x6f44('0xa')]);if(oldToken){_0x17d20f=util[_0x6f44('0x7')](_0x6f44('0xb'),HOST,_0x1cba57,module[_0x6f44('0x9')][_0x6f44('0xa')],oldToken);}var _0x367cd9={'uri':_0x17d20f,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x367cd9)[_0x6f44('0xc')](function(_0x2bac60){_0x1ad437(_0x2bac60);})[_0x6f44('0xd')](function(_0x1ceec9){_0x5c2ce0(_0x1ceec9);});});}function manageLicense(_0x3921ae,_0x5a415d){var _0x2019d9=_0x5a415d[_0x6f44('0xe')]({'plain':!![]});if(!isOldTokenSent&&_0x2019d9[_0x6f44('0xf')]!==_0x3921ae&&!_0x2019d9['data2']){oldToken=_0x2019d9[_0x6f44('0xf')];}httpRequest(_0x3921ae)[_0x6f44('0xc')](function(_0x139654){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x139654[_0x6f44('0x10')]){isOldTokenSent=![];if(!_0x2019d9[_0x6f44('0x11')]&&_0x2019d9['license']!=_0x139654[_0x6f44('0x11')]||_0x2019d9['license']&&_0x2019d9[_0x6f44('0x12')]){logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED');}if(_0x2019d9[_0x6f44('0x11')]&&!_0x2019d9[_0x6f44('0x12')]&&_0x2019d9[_0x6f44('0x11')]!=_0x139654['license']){logger[_0x6f44('0x13')](_0x6f44('0x14'));}if(_0x2019d9['license']&&!_0x2019d9[_0x6f44('0x12')]&&_0x2019d9[_0x6f44('0x11')]==_0x139654[_0x6f44('0x11')]){return _0x5a415d;}return _0x5a415d[_0x6f44('0x15')]({'data1':_0x3921ae,'data2':null,'license':_0x139654[_0x6f44('0x11')]});}else{if(_0x139654[_0x6f44('0x11')]||_0x2019d9[_0x6f44('0x11')]){if(!_0x2019d9[_0x6f44('0x12')]){if(_0x2019d9[_0x6f44('0xf')]==_0x3921ae){GRAY_PERIOD_REASON='Disabled';logger['info']('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON=_0x6f44('0x16');logger['info'](_0x6f44('0x17'),_0x2019d9[_0x6f44('0xf')],_0x3921ae);}logger[_0x6f44('0x13')](_0x6f44('0x18'),GRAY_PERIOD_REASON[_0x6f44('0x19')](),moment()['format'](_0x6f44('0x1a')));return _0x5a415d[_0x6f44('0x15')]({'data2':encryptor[_0x6f44('0x1b')](moment()[_0x6f44('0x7')](_0x6f44('0x1a')))});}else{if(moment()[_0x6f44('0x1c')](encryptor[_0x6f44('0x1d')](_0x2019d9[_0x6f44('0x12')]),_0x6f44('0x1e'))>DAYS){logger['info'](_0x6f44('0x1f'),moment()[_0x6f44('0x7')](_0x6f44('0x1a')));isOldTokenSent=![];return _0x5a415d[_0x6f44('0x15')]({'data1':_0x3921ae,'data2':null,'license':null});}}}else{if(_0x2019d9['data1']!=_0x3921ae){logger['info'](_0x6f44('0x17'),_0x2019d9['data1'],_0x3921ae);return _0x5a415d['update']({'data1':_0x3921ae,'data2':null,'license':null});}}}return _0x5a415d;})[_0x6f44('0xc')](function(_0x5e8054){_0x5a415d=_0x5e8054;})[_0x6f44('0xd')](function(_0x414cdc){logger['error'](_0x414cdc[_0x6f44('0x20')]);})[_0x6f44('0x21')](function(){setTimeout(function(){manageLicense(hardware[_0x6f44('0x22')](),_0x5a415d);},TIME);});}function defaultLicense(){var _0x56904a=hardware[_0x6f44('0x22')]();if(_0x56904a){return db[_0x6f44('0x23')][_0x6f44('0x24')]({'where':{'id':0x1},'defaults':{'data1':_0x56904a}})[_0x6f44('0x25')](function(_0x29b8f3,_0x5398a8){logger['info'](_0x6f44('0x26'),_0x56904a);manageLicense(_0x56904a,_0x29b8f3);})[_0x6f44('0xd')](function(_0x538388){logger['error'](_0x538388['message']);});}}exports[_0x6f44('0x27')]=defaultLicense; \ No newline at end of file +var _0x0a82=['THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','catch','error','message','finally','getUuid','License','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','version','../../mysqldb','../../components/encryptor','./hardware','exports','format','GET','then','data2','data1','active','license','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x0a82,0x1da));var _0x20a8=function(_0x288d18,_0x5c0d06){_0x288d18=_0x288d18-0x0;var _0xa659ae=_0x0a82[_0x288d18];return _0xa659ae;};'use strict';var util=require(_0x20a8('0x0'));var moment=require(_0x20a8('0x1'));var rp=require('request-promise');var BPromise=require(_0x20a8('0x2'));var pkginfo=require(_0x20a8('0x3'))(module,_0x20a8('0x4'));var db=require(_0x20a8('0x5'))['db'];var encryptor=require(_0x20a8('0x6'));var hardware=require(_0x20a8('0x7'));var logger=require('../logger')('license');var HOST='https://www.xcallymotion.com';var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x3234ea){return new BPromise(function(_0x47228c,_0x49f062){var _0x4bc534=util['format']('%s/api/servers/%s/check?version=%s',HOST,_0x3234ea,module[_0x20a8('0x8')][_0x20a8('0x4')]);if(oldToken){_0x4bc534=util[_0x20a8('0x9')]('%s/api/servers/%s/check?version=%s&oldtoken=%s',HOST,_0x3234ea,module[_0x20a8('0x8')][_0x20a8('0x4')],oldToken);}var _0x490c75={'uri':_0x4bc534,'method':_0x20a8('0xa'),'timeout':0xea60,'json':!![]};return rp(_0x490c75)[_0x20a8('0xb')](function(_0x4098e3){_0x47228c(_0x4098e3);})['catch'](function(_0xd1604b){_0x49f062(_0xd1604b);});});}function manageLicense(_0x1fb189,_0x101f53){var _0x3b2cd6=_0x101f53['get']({'plain':!![]});if(!isOldTokenSent&&_0x3b2cd6['data1']!==_0x1fb189&&!_0x3b2cd6[_0x20a8('0xc')]){oldToken=_0x3b2cd6[_0x20a8('0xd')];}httpRequest(_0x1fb189)[_0x20a8('0xb')](function(_0x1cb215){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x1cb215[_0x20a8('0xe')]){isOldTokenSent=![];if(!_0x3b2cd6[_0x20a8('0xf')]&&_0x3b2cd6[_0x20a8('0xf')]!=_0x1cb215[_0x20a8('0xf')]||_0x3b2cd6[_0x20a8('0xf')]&&_0x3b2cd6[_0x20a8('0xc')]){logger[_0x20a8('0x10')](_0x20a8('0x11'));}if(_0x3b2cd6['license']&&!_0x3b2cd6['data2']&&_0x3b2cd6['license']!=_0x1cb215['license']){logger[_0x20a8('0x10')](_0x20a8('0x12'));}if(_0x3b2cd6[_0x20a8('0xf')]&&!_0x3b2cd6[_0x20a8('0xc')]&&_0x3b2cd6[_0x20a8('0xf')]==_0x1cb215[_0x20a8('0xf')]){return _0x101f53;}return _0x101f53[_0x20a8('0x13')]({'data1':_0x1fb189,'data2':null,'license':_0x1cb215['license']});}else{if(_0x1cb215[_0x20a8('0xf')]||_0x3b2cd6[_0x20a8('0xf')]){if(!_0x3b2cd6[_0x20a8('0xc')]){if(_0x3b2cd6['data1']==_0x1fb189){GRAY_PERIOD_REASON='Disabled';logger[_0x20a8('0x10')](_0x20a8('0x14'));}else{GRAY_PERIOD_REASON=_0x20a8('0x15');logger[_0x20a8('0x10')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x3b2cd6[_0x20a8('0xd')],_0x1fb189);}logger[_0x20a8('0x10')]('%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s',GRAY_PERIOD_REASON[_0x20a8('0x16')](),moment()[_0x20a8('0x9')](_0x20a8('0x17')));return _0x101f53[_0x20a8('0x13')]({'data2':encryptor['encryptString'](moment()[_0x20a8('0x9')](_0x20a8('0x17')))});}else{if(moment()[_0x20a8('0x18')](encryptor[_0x20a8('0x19')](_0x3b2cd6[_0x20a8('0xc')]),_0x20a8('0x1a'))>DAYS){logger[_0x20a8('0x10')](_0x20a8('0x1b'),moment()[_0x20a8('0x9')](_0x20a8('0x17')));isOldTokenSent=![];return _0x101f53[_0x20a8('0x13')]({'data1':_0x1fb189,'data2':null,'license':null});}}}else{if(_0x3b2cd6[_0x20a8('0xd')]!=_0x1fb189){logger['info'](_0x20a8('0x1c'),_0x3b2cd6[_0x20a8('0xd')],_0x1fb189);return _0x101f53[_0x20a8('0x13')]({'data1':_0x1fb189,'data2':null,'license':null});}}}return _0x101f53;})[_0x20a8('0xb')](function(_0x481940){_0x101f53=_0x481940;})[_0x20a8('0x1d')](function(_0x10a1a6){logger[_0x20a8('0x1e')](_0x10a1a6[_0x20a8('0x1f')]);})[_0x20a8('0x20')](function(){setTimeout(function(){manageLicense(hardware[_0x20a8('0x21')](),_0x101f53);},TIME);});}function defaultLicense(){var _0x4d019a=hardware[_0x20a8('0x21')]();if(_0x4d019a){return db[_0x20a8('0x22')]['findOrCreate']({'where':{'id':0x1},'defaults':{'data1':_0x4d019a}})[_0x20a8('0x23')](function(_0x31eeb7,_0x1dce4c){logger[_0x20a8('0x10')](_0x20a8('0x24'),_0x4d019a);manageLicense(_0x4d019a,_0x31eeb7);})[_0x20a8('0x1d')](function(_0x2803ef){logger[_0x20a8('0x1e')](_0x2803ef['message']);});}}exports[_0x20a8('0x25')]=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 5b02a2d..b73ea34 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 _0x0ffd=['machineUuid','gray','deadline','add','days','grayReason','changed','message','role','sequelize','COUNT','col','user','telephone','users','telephones','forEach','admin','pick','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','License\x20key\x20value\x20not\x20found','data1','split','decryptString','format','%s:%s:%s','parse','demo'];(function(_0x112578,_0x37b647){var _0x497366=function(_0x22fcf1){while(--_0x22fcf1){_0x112578['push'](_0x112578['shift']());}};_0x497366(++_0x37b647);}(_0x0ffd,0x175));var _0xd0ff=function(_0x4243a3,_0x447337){_0x4243a3=_0x4243a3-0x0;var _0x1b2a33=_0x0ffd[_0x4243a3];return _0x1b2a33;};'use strict';var util=require(_0xd0ff('0x0'));var _=require('lodash');var moment=require(_0xd0ff('0x1'));var BPromise=require(_0xd0ff('0x2'));var hardware=require('./hardware');var encryptor=require(_0xd0ff('0x3'));var db=require(_0xd0ff('0x4'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd0ff('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xd0ff('0x6'),'machineUuid':hardware[_0xd0ff('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xd0ff('0x5'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xd0ff('0x8'),'machineUuid':hardware['getUuid'](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x3c3d62){return new BPromise(function(_0x59b6d8,_0x364f80){return db[_0xd0ff('0x9')][_0xd0ff('0xa')](_[_0xd0ff('0xb')](_0x3c3d62,{'raw':!![],'where':{'id':0x1}}))[_0xd0ff('0xc')](function(_0x5ca8b9){return checkLicense(_0x5ca8b9,null);})['then'](function(_0xddf66c){_0x59b6d8(_0xddf66c);return;})[_0xd0ff('0xd')](function(_0x48cedb){_0x364f80(_0x48cedb);});});}function checkLicense(_0x1743f5,_0x4269d8){if(!_0x1743f5){demoLicense[_0xd0ff('0xe')]=_0x1743f5['data1'];return demoLicense;}try{var _0x502755=_0x4269d8||_0x1743f5['license'];if(_['isEmpty'](_0x502755)){throw new Error(_0xd0ff('0xf'));}var _0x465421=_0x1743f5[_0xd0ff('0x10')];var _0x345714=_0x1743f5['data2'];var _0x267c02=_0x465421[_0xd0ff('0x11')]('-')[0x4];var _0x5a21c5=_0x465421[_0xd0ff('0x11')]('-')[0x0];var _0x17134c=encryptor[_0xd0ff('0x12')](_0x502755,util[_0xd0ff('0x13')](_0xd0ff('0x14'),_0x267c02,_0x465421,_0x5a21c5));var _0x39e571=JSON[_0xd0ff('0x15')](_0x17134c);_0x39e571[_0xd0ff('0x16')]=![];_0x39e571[_0xd0ff('0xe')]=_0x465421;_0x39e571[_0xd0ff('0x17')]=hardware[_0xd0ff('0x7')]();if(_0x345714){var _0x495623=encryptor[_0xd0ff('0x12')](_0x345714);_0x39e571[_0xd0ff('0x18')]=_0x495623;_0x39e571[_0xd0ff('0x19')]=moment(_0x495623)[_0xd0ff('0x1a')](0x7,_0xd0ff('0x1b'))[_0xd0ff('0x13')]();_0x39e571[_0xd0ff('0x1c')]=_0x39e571['uuid']!=_0x39e571[_0xd0ff('0x17')]?_0xd0ff('0x1d'):'disabled';}return _0x39e571;}catch(_0x58a92f){breakingLicense[_0xd0ff('0xe')]=_0x1743f5[_0xd0ff('0x10')];breakingLicense[_0xd0ff('0x1e')]=_0x58a92f[_0xd0ff('0x1e')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2e73d6,_0x5301ad){getLicense()[_0xd0ff('0xc')](function(_0x2651e1){return db['User']['findAll']({'attributes':[_0xd0ff('0x1f'),[db[_0xd0ff('0x20')]['fn'](_0xd0ff('0x21'),db['sequelize'][_0xd0ff('0x22')](_0xd0ff('0x1f'))),'count']],'group':_0xd0ff('0x1f'),'where':{'role':{'$or':['admin',_0xd0ff('0x23'),_0xd0ff('0x24')]}},'raw':!![]})['then'](function(_0x37cb2d){var _0x1dcdf4={'user':_0x2651e1[_0xd0ff('0x25')]||0x0,'telephone':_0x2651e1[_0xd0ff('0x26')]||0x0};_0x37cb2d[_0xd0ff('0x27')](function(_0x14732c){var _0x5ad978=_0x14732c[_0xd0ff('0x1f')]===_0xd0ff('0x28')?'user':_0x14732c[_0xd0ff('0x1f')];_0x1dcdf4[_0x5ad978]-=_0x14732c['count'];if(_0x1dcdf4[_0x5ad978]<0x0)_0x1dcdf4[_0x5ad978]=0x0;});_0x2e73d6(_0x1dcdf4);return;});})[_0xd0ff('0xd')](function(_0x5e24df){_0x5301ad(_0x5e24df);});});}function checkUserLimits(_0x56bfa1){return new BPromise(function(_0x42d730,_0x4f1149){getLimits()[_0xd0ff('0xc')](function(_0x37bb2d){var _0x5d3cb1=_[_0xd0ff('0x29')](_['countBy'](_0x56bfa1,_0xd0ff('0x1f')),[_0xd0ff('0x28'),_0xd0ff('0x23'),_0xd0ff('0x24')]);var _0x2c4fd7=(_0x5d3cb1['admin']||0x0)+(_0x5d3cb1[_0xd0ff('0x23')]||0x0);var _0x4f8b50=_0x5d3cb1[_0xd0ff('0x24')]||0x0;if(_0x2c4fd7>_0x37bb2d['user'])return _0x4f1149('License\x20limit\x20reached\x20for\x20users');if(_0x4f8b50>_0x37bb2d['telephone'])return _0x4f1149(_0xd0ff('0x2a'));return _0x42d730();})['catch'](function(_0x1a3ff1){_0x4f1149(_0x1a3ff1);});});}module[_0xd0ff('0x2b')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x7afc=['message','User','findAll','col','role','count','telephone','users','telephones','forEach','user','catch','pick','admin','License\x20limit\x20reached\x20for\x20users','License\x20limit\x20reached\x20for\x20telephones','exports','util','moment','bluebird','./hardware','../../components/encryptor','../../mysqldb','2027-01-01T00:00:00.000Z','getUuid','Breaking\x20license','License','find','then','uuid','data1','license','isEmpty','License\x20key\x20value\x20not\x20found','split','decryptString','format','demo','gray','deadline','add','grayReason','machineUuid','changed','disabled'];(function(_0x13b392,_0x3481f2){var _0x39db24=function(_0xab91e5){while(--_0xab91e5){_0x13b392['push'](_0x13b392['shift']());}};_0x39db24(++_0x3481f2);}(_0x7afc,0xf2));var _0xc7af=function(_0x109dbd,_0x290d2b){_0x109dbd=_0x109dbd-0x0;var _0x395644=_0x7afc[_0x109dbd];return _0x395644;};'use strict';var util=require(_0xc7af('0x0'));var _=require('lodash');var moment=require(_0xc7af('0x1'));var BPromise=require(_0xc7af('0x2'));var hardware=require(_0xc7af('0x3'));var encryptor=require(_0xc7af('0x4'));var db=require(_0xc7af('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc7af('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':'Demo\x20license','machineUuid':hardware[_0xc7af('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xc7af('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xc7af('0x8'),'machineUuid':hardware[_0xc7af('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x524e76){return new BPromise(function(_0x3f4abb,_0x244118){return db[_0xc7af('0x9')][_0xc7af('0xa')](_['defaults'](_0x524e76,{'raw':!![],'where':{'id':0x1}}))[_0xc7af('0xb')](function(_0x482caf){return checkLicense(_0x482caf,null);})[_0xc7af('0xb')](function(_0x3ba084){_0x3f4abb(_0x3ba084);return;})['catch'](function(_0x454bb8){_0x244118(_0x454bb8);});});}function checkLicense(_0x43c8b0,_0x56323e){if(!_0x43c8b0){demoLicense[_0xc7af('0xc')]=_0x43c8b0[_0xc7af('0xd')];return demoLicense;}try{var _0x589c61=_0x56323e||_0x43c8b0[_0xc7af('0xe')];if(_[_0xc7af('0xf')](_0x589c61)){throw new Error(_0xc7af('0x10'));}var _0x5a534f=_0x43c8b0[_0xc7af('0xd')];var _0x4654f7=_0x43c8b0['data2'];var _0x395857=_0x5a534f['split']('-')[0x4];var _0x48ed71=_0x5a534f[_0xc7af('0x11')]('-')[0x0];var _0x4ea6b8=encryptor[_0xc7af('0x12')](_0x589c61,util[_0xc7af('0x13')]('%s:%s:%s',_0x395857,_0x5a534f,_0x48ed71));var _0x1963db=JSON['parse'](_0x4ea6b8);_0x1963db[_0xc7af('0x14')]=![];_0x1963db[_0xc7af('0xc')]=_0x5a534f;_0x1963db['machineUuid']=hardware[_0xc7af('0x7')]();if(_0x4654f7){var _0x5314c7=encryptor[_0xc7af('0x12')](_0x4654f7);_0x1963db[_0xc7af('0x15')]=_0x5314c7;_0x1963db[_0xc7af('0x16')]=moment(_0x5314c7)[_0xc7af('0x17')](0x7,'days')['format']();_0x1963db[_0xc7af('0x18')]=_0x1963db[_0xc7af('0xc')]!=_0x1963db[_0xc7af('0x19')]?_0xc7af('0x1a'):_0xc7af('0x1b');}return _0x1963db;}catch(_0x5ebad6){breakingLicense[_0xc7af('0xc')]=_0x43c8b0[_0xc7af('0xd')];breakingLicense[_0xc7af('0x1c')]=_0x5ebad6[_0xc7af('0x1c')];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x51c003,_0x1c06ee){getLicense()[_0xc7af('0xb')](function(_0x27c43e){return db[_0xc7af('0x1d')][_0xc7af('0x1e')]({'attributes':['role',[db['sequelize']['fn']('COUNT',db['sequelize'][_0xc7af('0x1f')](_0xc7af('0x20'))),_0xc7af('0x21')]],'group':_0xc7af('0x20'),'where':{'role':{'$or':['admin','user',_0xc7af('0x22')]}},'raw':!![]})[_0xc7af('0xb')](function(_0x5b96a4){var _0x4fd282={'user':_0x27c43e[_0xc7af('0x23')]||0x0,'telephone':_0x27c43e[_0xc7af('0x24')]||0x0};_0x5b96a4[_0xc7af('0x25')](function(_0x4680cc){var _0x3ff23e=_0x4680cc['role']==='admin'?_0xc7af('0x26'):_0x4680cc[_0xc7af('0x20')];_0x4fd282[_0x3ff23e]-=_0x4680cc['count'];if(_0x4fd282[_0x3ff23e]<0x0)_0x4fd282[_0x3ff23e]=0x0;});_0x51c003(_0x4fd282);return;});})[_0xc7af('0x27')](function(_0xabcee){_0x1c06ee(_0xabcee);});});}function checkUserLimits(_0x1c7f95){return new BPromise(function(_0x638b1,_0x3403ec){getLimits()[_0xc7af('0xb')](function(_0x587444){var _0x47d437=_[_0xc7af('0x28')](_['countBy'](_0x1c7f95,_0xc7af('0x20')),[_0xc7af('0x29'),_0xc7af('0x26'),_0xc7af('0x22')]);var _0x4bd464=(_0x47d437[_0xc7af('0x29')]||0x0)+(_0x47d437[_0xc7af('0x26')]||0x0);var _0x4c5721=_0x47d437[_0xc7af('0x22')]||0x0;if(_0x4bd464>_0x587444['user'])return _0x3403ec(_0xc7af('0x2a'));if(_0x4c5721>_0x587444[_0xc7af('0x22')])return _0x3403ec(_0xc7af('0x2b'));return _0x638b1();})[_0xc7af('0x27')](function(_0x147eaf){_0x3403ec(_0x147eaf);});});}module[_0xc7af('0x2c')]={'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 1e9cf91..d3651d9 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 _0xfb11=['exports','myappanuglar-secret','app-id'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0xfb11,0x1ad));var _0x1fb1=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xfb11[_0x1ac595];return _0x455fff;};'use strict';module[_0x1fb1('0x0')]={'DOMAIN':'http://localhost:9000','SESSION_SECRET':_0x1fb1('0x1'),'GOOGLE_ID':_0x1fb1('0x2'),'GOOGLE_SECRET':'secret','DEBUG':''}; \ No newline at end of file +var _0x93e9=['http://localhost:9000','myappanuglar-secret','app-id','secret','exports'];(function(_0x556927,_0x34b53f){var _0x5f1235=function(_0x4f4e44){while(--_0x4f4e44){_0x556927['push'](_0x556927['shift']());}};_0x5f1235(++_0x34b53f);}(_0x93e9,0xcc));var _0x993e=function(_0x5ce35e,_0x4d32df){_0x5ce35e=_0x5ce35e-0x0;var _0x3ac113=_0x93e9[_0x5ce35e];return _0x3ac113;};'use strict';module[_0x993e('0x0')]={'DOMAIN':_0x993e('0x1'),'SESSION_SECRET':_0x993e('0x2'),'GOOGLE_ID':_0x993e('0x3'),'GOOGLE_SECRET':_0x993e('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index ed45bf2..4b3517c 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x31fd=['}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','toUpperCase','exports','Logger','File','%s-%s','error','info','transports','Console','env','debugLevel','winston','util','path','INFO','join','/var','xcally','format','%s-%s.log','message','replace','{{{'];(function(_0x1e3ff2,_0x294739){var _0x14594b=function(_0x591966){while(--_0x591966){_0x1e3ff2['push'](_0x1e3ff2['shift']());}};_0x14594b(++_0x294739);}(_0x31fd,0x112));var _0xd31f=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x31fd[_0xa464c9];return _0x3d73c4;};'use strict';var moment=require('moment');var winston=require(_0xd31f('0x0'));var util=require(_0xd31f('0x1'));var path=require(_0xd31f('0x2'));var debugLevel=_0xd31f('0x3');function filename(_0x467dbb,_0x49a21c){return path[_0xd31f('0x4')](_0xd31f('0x5'),'log',_0xd31f('0x6'),util[_0xd31f('0x7')](_0xd31f('0x8'),_0x467dbb,_0x49a21c));}function formatter(_0x7a6cc0,_0x5d272c){_0x5d272c['message']=_0x5d272c[_0xd31f('0x9')][_0xd31f('0xa')](/@@{/g,_0xd31f('0xb'))[_0xd31f('0xa')](/}@@/g,_0xd31f('0xc'))['replace'](/@{/g,'{{')[_0xd31f('0xa')](/}@/g,'}}');return util['format'](_0xd31f('0xd'),moment()[_0xd31f('0x7')](_0xd31f('0xe')),_0x5d272c['level'][_0xd31f('0xf')](),_0x7a6cc0,_0x5d272c['message']);}module[_0xd31f('0x10')]=function(_0xd0dcc8){return new winston[(_0xd31f('0x11'))]({'transports':[new winston['transports'][(_0xd31f('0x12'))]({'name':util['format'](_0xd31f('0x13'),_0xd0dcc8,_0xd31f('0x14')),'filename':filename(_0xd0dcc8,_0xd31f('0x14')),'level':_0xd31f('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x548fb4){return formatter(_0xd0dcc8,_0x548fb4);}}),new winston['transports']['File']({'name':util[_0xd31f('0x7')](_0xd31f('0x13'),_0xd0dcc8,_0xd31f('0x15')),'filename':filename(_0xd0dcc8,_0xd31f('0x15')),'level':_0xd31f('0x15'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x3f89f9){return formatter(_0xd0dcc8,_0x3f89f9);}}),new winston[(_0xd31f('0x16'))][(_0xd31f('0x17'))]({'level':process[_0xd31f('0x18')][_0xd31f('0x19')]||debugLevel,'json':![],'formatter':function(_0x1c698c){return formatter(_0xd0dcc8,_0x1c698c);}})]});}; \ No newline at end of file +var _0x3d33=['{{{','}}}','format','[%s]\x20[%s]\x20%s\x20-\x20%s','level','exports','transports','File','error','%s-%s','info','debugLevel','moment','util','path','INFO','/var','log','xcally','%s-%s.log','message','replace'];(function(_0x36e557,_0x582535){var _0x4072f7=function(_0x552ed5){while(--_0x552ed5){_0x36e557['push'](_0x36e557['shift']());}};_0x4072f7(++_0x582535);}(_0x3d33,0x1ae));var _0x33d3=function(_0x145454,_0x153353){_0x145454=_0x145454-0x0;var _0x369e53=_0x3d33[_0x145454];return _0x369e53;};'use strict';var moment=require(_0x33d3('0x0'));var winston=require('winston');var util=require(_0x33d3('0x1'));var path=require(_0x33d3('0x2'));var debugLevel=_0x33d3('0x3');function filename(_0x55699d,_0x241f71){return path['join'](_0x33d3('0x4'),_0x33d3('0x5'),_0x33d3('0x6'),util['format'](_0x33d3('0x7'),_0x55699d,_0x241f71));}function formatter(_0x3ab00c,_0x53dbcb){_0x53dbcb[_0x33d3('0x8')]=_0x53dbcb[_0x33d3('0x8')][_0x33d3('0x9')](/@@{/g,_0x33d3('0xa'))[_0x33d3('0x9')](/}@@/g,_0x33d3('0xb'))['replace'](/@{/g,'{{')[_0x33d3('0x9')](/}@/g,'}}');return util[_0x33d3('0xc')](_0x33d3('0xd'),moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),_0x53dbcb[_0x33d3('0xe')]['toUpperCase'](),_0x3ab00c,_0x53dbcb[_0x33d3('0x8')]);}module[_0x33d3('0xf')]=function(_0x31d9d2){return new winston['Logger']({'transports':[new winston[(_0x33d3('0x10'))][(_0x33d3('0x11'))]({'name':util[_0x33d3('0xc')]('%s-%s',_0x31d9d2,_0x33d3('0x12')),'filename':filename(_0x31d9d2,_0x33d3('0x12')),'level':_0x33d3('0x12'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x433628){return formatter(_0x31d9d2,_0x433628);}}),new winston[(_0x33d3('0x10'))][(_0x33d3('0x11'))]({'name':util['format'](_0x33d3('0x13'),_0x31d9d2,_0x33d3('0x14')),'filename':filename(_0x31d9d2,_0x33d3('0x14')),'level':_0x33d3('0x14'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4ed383){return formatter(_0x31d9d2,_0x4ed383);}}),new winston[(_0x33d3('0x10'))]['Console']({'level':process['env'][_0x33d3('0x15')]||debugLevel,'json':![],'formatter':function(_0x13107e){return formatter(_0x31d9d2,_0x13107e);}})]});}; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 2b6af4a..86a8bd6 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 _0xd7ea=['xdr','exports','express','join','routing','../../services/routing/index.js'];(function(_0x11f562,_0x241b9b){var _0x208454=function(_0x115a3e){while(--_0x115a3e){_0x11f562['push'](_0x11f562['shift']());}};_0x208454(++_0x241b9b);}(_0xd7ea,0x68));var _0xad7e=function(_0x58c7e3,_0x174013){_0x58c7e3=_0x58c7e3-0x0;var _0x5af6ed=_0xd7ea[_0x58c7e3];return _0x5af6ed;};'use strict';var path=require('path');var os=require('os');var config={'apps':[{'name':_0xad7e('0x0'),'script':path['join'](__dirname,'../../services/express/index.js')},{'name':'ami','script':path[_0xad7e('0x1')](__dirname,'../../services/ami/index.js')},{'name':'agi','script':path['join'](__dirname,'../../services/agi/index.js')},{'name':'email','script':path[_0xad7e('0x1')](__dirname,'../../services/email/index.js')},{'name':_0xad7e('0x2'),'script':path['join'](__dirname,_0xad7e('0x3'))},{'name':_0xad7e('0x4'),'script':path[_0xad7e('0x1')](__dirname,'../../services/xdr/index.js')}]};module[_0xad7e('0x5')]=config; \ No newline at end of file +var _0xd5d3=['agi','../../services/agi/index.js','email','../../services/email/index.js','routing','xdr','../../services/xdr/index.js','exports','path','join','ami','../../services/ami/index.js'];(function(_0x1f8d14,_0x3c1e5d){var _0x123430=function(_0x14a4ce){while(--_0x14a4ce){_0x1f8d14['push'](_0x1f8d14['shift']());}};_0x123430(++_0x3c1e5d);}(_0xd5d3,0x11c));var _0x3d5d=function(_0x12c6c4,_0x120ea7){_0x12c6c4=_0x12c6c4-0x0;var _0x18289b=_0xd5d3[_0x12c6c4];return _0x18289b;};'use strict';var path=require(_0x3d5d('0x0'));var os=require('os');var config={'apps':[{'name':'express','script':path[_0x3d5d('0x1')](__dirname,'../../services/express/index.js')},{'name':_0x3d5d('0x2'),'script':path[_0x3d5d('0x1')](__dirname,_0x3d5d('0x3'))},{'name':_0x3d5d('0x4'),'script':path['join'](__dirname,_0x3d5d('0x5'))},{'name':_0x3d5d('0x6'),'script':path[_0x3d5d('0x1')](__dirname,_0x3d5d('0x7'))},{'name':_0x3d5d('0x8'),'script':path[_0x3d5d('0x1')](__dirname,'../../services/routing/index.js')},{'name':_0x3d5d('0x9'),'script':path['join'](__dirname,_0x3d5d('0xa'))}]};module[_0x3d5d('0xb')]=config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index 4d6419b..f2594e5 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 _0xca4e=['then','disconnect','stop','restart','list','describe','delete','dump','saved','pm2','bluebird','connect','connected','start'];(function(_0x58be60,_0x3150e9){var _0x126469=function(_0x5b26b8){while(--_0x5b26b8){_0x58be60['push'](_0x58be60['shift']());}};_0x126469(++_0x3150e9);}(_0xca4e,0x87));var _0xeca4=function(_0x667361,_0x17e246){_0x667361=_0x667361-0x0;var _0xe83d80=_0xca4e[_0x667361];return _0xe83d80;};'use strict';var pm2=require(_0xeca4('0x0'));var BPromise=require(_0xeca4('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x4c5932,_0xc49549){return pm2[_0xeca4('0x2')](function(_0xd96b60){if(_0xd96b60){return _0xc49549(_0xd96b60);}return _0x4c5932(_0xeca4('0x3'));});});};exports[_0xeca4('0x4')]=function(_0x27735a){return connect()[_0xeca4('0x5')](function(){return new BPromise(function(_0x47523a,_0x3880e7){return pm2[_0xeca4('0x4')](_0x27735a,function(_0x17f98a,_0x251608){if(_0x17f98a){return _0x3880e7(_0x17f98a);}pm2[_0xeca4('0x6')]();return _0x47523a(_0x251608);});});});};exports[_0xeca4('0x7')]=function(_0x411053){return connect()[_0xeca4('0x5')](function(){return new BPromise(function(_0x379470,_0x7385a2){return pm2['stop'](_0x411053,function(_0x5a8d4d,_0x832e0a){if(_0x5a8d4d){return _0x7385a2(_0x5a8d4d);}pm2[_0xeca4('0x6')]();return _0x379470(_0x832e0a);});});});};exports['restart']=function(_0x4efc58){return connect()[_0xeca4('0x5')](function(){return new BPromise(function(_0x171c20,_0x20449b){return pm2[_0xeca4('0x8')](_0x4efc58,function(_0x411bc1,_0x279e2a){if(_0x411bc1){return _0x20449b(_0x411bc1);}pm2[_0xeca4('0x6')]();return _0x171c20(_0x279e2a);});});});};exports[_0xeca4('0x9')]=function(){return connect()[_0xeca4('0x5')](function(){return new BPromise(function(_0x256538,_0x492f0a){return pm2[_0xeca4('0x9')](function(_0x252ae8,_0x27af39){if(_0x252ae8){return _0x492f0a(_0x252ae8);}pm2['disconnect']();return _0x256538(_0x27af39);});});});};exports[_0xeca4('0xa')]=function(_0x4cc60a){return connect()[_0xeca4('0x5')](function(){return new BPromise(function(_0x2a63e1,_0x58f5ca){return pm2[_0xeca4('0xa')](_0x4cc60a,function(_0x26929e,_0x13f2cd){if(_0x26929e){return _0x58f5ca(_0x26929e);}pm2[_0xeca4('0x6')]();return _0x2a63e1(_0x13f2cd);});});});};exports[_0xeca4('0xb')]=function(_0x49402d){return connect()['then'](function(){return new BPromise(function(_0x2a6ca8,_0x3e1ac4){return pm2[_0xeca4('0xb')](_0x49402d,function(_0x461421,_0x1b3ceb){if(_0x461421){return _0x3e1ac4(_0x461421);}pm2[_0xeca4('0x6')]();return _0x2a6ca8(_0x1b3ceb);});});});};exports[_0xeca4('0xc')]=function(){return connect()[_0xeca4('0x5')](function(){return new BPromise(function(_0x51f05d,_0x3f6e43){return pm2[_0xeca4('0xc')](function(_0x19957a){if(_0x19957a){return _0x3f6e43(_0x19957a);}return _0x51f05d(_0xeca4('0xd'));});});});}; \ No newline at end of file +var _0xa9b3=['pm2','bluebird','connected','start','disconnect','stop','then','restart','list','describe','delete','dump','saved'];(function(_0x435dde,_0x2a2fa3){var _0x4aca2d=function(_0x283a96){while(--_0x283a96){_0x435dde['push'](_0x435dde['shift']());}};_0x4aca2d(++_0x2a2fa3);}(_0xa9b3,0x1d4));var _0x3a9b=function(_0x422994,_0x99047b){_0x422994=_0x422994-0x0;var _0x43ad8f=_0xa9b3[_0x422994];return _0x43ad8f;};'use strict';var pm2=require(_0x3a9b('0x0'));var BPromise=require(_0x3a9b('0x1'));var config=require('./config');function connect(){return new BPromise(function(_0x2a7ef3,_0x3003a1){return pm2['connect'](function(_0x1b68b5){if(_0x1b68b5){return _0x3003a1(_0x1b68b5);}return _0x2a7ef3(_0x3a9b('0x2'));});});};exports[_0x3a9b('0x3')]=function(_0xf32c64){return connect()['then'](function(){return new BPromise(function(_0x5cefb5,_0x93a80e){return pm2['start'](_0xf32c64,function(_0x598850,_0x302ad8){if(_0x598850){return _0x93a80e(_0x598850);}pm2[_0x3a9b('0x4')]();return _0x5cefb5(_0x302ad8);});});});};exports[_0x3a9b('0x5')]=function(_0xee78b){return connect()[_0x3a9b('0x6')](function(){return new BPromise(function(_0x1c9383,_0x11348b){return pm2[_0x3a9b('0x5')](_0xee78b,function(_0x440b0e,_0x1c821e){if(_0x440b0e){return _0x11348b(_0x440b0e);}pm2['disconnect']();return _0x1c9383(_0x1c821e);});});});};exports[_0x3a9b('0x7')]=function(_0x1a8e5c){return connect()[_0x3a9b('0x6')](function(){return new BPromise(function(_0x309aa6,_0x4eedaf){return pm2['restart'](_0x1a8e5c,function(_0xc38e46,_0x296b19){if(_0xc38e46){return _0x4eedaf(_0xc38e46);}pm2['disconnect']();return _0x309aa6(_0x296b19);});});});};exports['list']=function(){return connect()['then'](function(){return new BPromise(function(_0x5af449,_0x1884eb){return pm2[_0x3a9b('0x8')](function(_0x36282a,_0x439d20){if(_0x36282a){return _0x1884eb(_0x36282a);}pm2[_0x3a9b('0x4')]();return _0x5af449(_0x439d20);});});});};exports[_0x3a9b('0x9')]=function(_0x181fbc){return connect()[_0x3a9b('0x6')](function(){return new BPromise(function(_0x5e9f1c,_0x4207a3){return pm2[_0x3a9b('0x9')](_0x181fbc,function(_0x3c6d8a,_0x15a26c){if(_0x3c6d8a){return _0x4207a3(_0x3c6d8a);}pm2['disconnect']();return _0x5e9f1c(_0x15a26c);});});});};exports[_0x3a9b('0xa')]=function(_0x4f1528){return connect()['then'](function(){return new BPromise(function(_0x43a4a5,_0x364e53){return pm2[_0x3a9b('0xa')](_0x4f1528,function(_0x44813c,_0x24037e){if(_0x44813c){return _0x364e53(_0x44813c);}pm2[_0x3a9b('0x4')]();return _0x43a4a5(_0x24037e);});});});};exports[_0x3a9b('0xb')]=function(){return connect()[_0x3a9b('0x6')](function(){return new BPromise(function(_0x41822b,_0x2584de){return pm2[_0x3a9b('0xb')](function(_0x292c7c){if(_0x292c7c){return _0x2584de(_0x292c7c);}return _0x41822b(_0x3a9b('0xc'));});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index fc71f56..a188574 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 _0x8e0b=['findAll','lastMsgAt','subtract','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','../logger','schedule','redis','localhost','socket.io-emitter','Setting','find','chatTimeout','then'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8e0b,0x174));var _0xb8e0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x8e0b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb8e0('0x0'));var moment=require('moment');var Redis=require(_0xb8e0('0x1'));var util=require('util');var config=require(_0xb8e0('0x2'));var db=require(_0xb8e0('0x3'))['db'];var logger=require(_0xb8e0('0x4'))(_0xb8e0('0x5'));config[_0xb8e0('0x6')]=_['defaults'](config[_0xb8e0('0x6')],{'host':_0xb8e0('0x7'),'port':0x18eb});var io=require(_0xb8e0('0x8'))(new Redis(config[_0xb8e0('0x6')]));function closeInteractions(){var _0x29342a=0x0;var _0xb55eaf=[];return db[_0xb8e0('0x9')][_0xb8e0('0xa')]({'raw':!![],'attributes':['id',_0xb8e0('0xb')],'where':{'id':0x1}})[_0xb8e0('0xc')](function(_0x14c50b){_0x29342a=_0x14c50b[_0xb8e0('0xb')];if(_0x29342a){return db['ChatInteraction'][_0xb8e0('0xd')]({'raw':!![],'attributes':['id',_0xb8e0('0xe')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xb8e0('0xf')](_0x14c50b['chatTimeout'],'minutes')}}});}else{return[];}})[_0xb8e0('0xc')](function(_0x14ef32){if(_0x14ef32&&_0x14ef32[_0xb8e0('0x10')]){_0xb55eaf=_[_0xb8e0('0x11')](_0x14ef32||[],'id');logger[_0xb8e0('0x12')](_0xb8e0('0x13'),_0xb55eaf[_0xb8e0('0x14')]());return db[_0xb8e0('0x15')][_0xb8e0('0x16')]({'closeReason':_0xb8e0('0x17'),'disposition':_0xb8e0('0x18'),'closed':!![],'closedAt':moment()[_0xb8e0('0x19')](_0xb8e0('0x1a'))},{'where':{'id':_0xb55eaf}});}})[_0xb8e0('0xc')](function(){if(_0xb55eaf&&_0xb55eaf[_0xb8e0('0x10')]){logger[_0xb8e0('0x12')](_0xb8e0('0x1b'),_0xb55eaf[_0xb8e0('0x14')]());for(var _0x1ff11d=0x0;_0x1ff11d<_0xb55eaf[_0xb8e0('0x10')];_0x1ff11d++){io[_0xb8e0('0x1c')](_0xb8e0('0x1d'),{'id':_0xb55eaf[_0x1ff11d],'closed':!![]});}}})[_0xb8e0('0x1e')](function(_0x3601da){logger[_0xb8e0('0x1f')](_0xb8e0('0x20'),_0x3601da?util[_0xb8e0('0x21')](_0x3601da,{'showHidden':![],'depth':null}):'');});}exports[_0xb8e0('0x22')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x6aea=['emit','chatInteraction:update','catch','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','lodash','moment','ioredis','util','../../mysqldb','../logger','redis','defaults','socket.io-emitter','Setting','find','then','findAll','lastMsgAt','chatTimeout','minutes','length','map','info','[CHAT]\x20Interactions\x20to\x20close:','join','ChatInteraction','system','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x46dc85,_0x462745){var _0x403918=function(_0xc1f168){while(--_0xc1f168){_0x46dc85['push'](_0x46dc85['shift']());}};_0x403918(++_0x462745);}(_0x6aea,0xc7));var _0xa6ae=function(_0x4fdd14,_0x2fbb4f){_0x4fdd14=_0x4fdd14-0x0;var _0x49df33=_0x6aea[_0x4fdd14];return _0x49df33;};'use strict';var _=require(_0xa6ae('0x0'));var moment=require(_0xa6ae('0x1'));var Redis=require(_0xa6ae('0x2'));var util=require(_0xa6ae('0x3'));var config=require('../../config/environment');var db=require(_0xa6ae('0x4'))['db'];var logger=require(_0xa6ae('0x5'))('schedule');config[_0xa6ae('0x6')]=_[_0xa6ae('0x7')](config[_0xa6ae('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0xa6ae('0x8'))(new Redis(config[_0xa6ae('0x6')]));function closeInteractions(){var _0x336cbc=0x0;var _0x5f5cd7=[];return db[_0xa6ae('0x9')][_0xa6ae('0xa')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0xa6ae('0xb')](function(_0x373ae6){_0x336cbc=_0x373ae6['chatTimeout'];if(_0x336cbc){return db['ChatInteraction'][_0xa6ae('0xc')]({'raw':!![],'attributes':['id',_0xa6ae('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x373ae6[_0xa6ae('0xe')],_0xa6ae('0xf'))}}});}else{return[];}})['then'](function(_0x58009f){if(_0x58009f&&_0x58009f[_0xa6ae('0x10')]){_0x5f5cd7=_[_0xa6ae('0x11')](_0x58009f||[],'id');logger[_0xa6ae('0x12')](_0xa6ae('0x13'),_0x5f5cd7[_0xa6ae('0x14')]());return db[_0xa6ae('0x15')]['update']({'closeReason':_0xa6ae('0x16'),'disposition':'timeout','closed':!![],'closedAt':moment()[_0xa6ae('0x17')](_0xa6ae('0x18'))},{'where':{'id':_0x5f5cd7}});}})[_0xa6ae('0xb')](function(){if(_0x5f5cd7&&_0x5f5cd7[_0xa6ae('0x10')]){logger['info']('[CHAT]\x20Sending\x20updates\x20for\x20interactions:',_0x5f5cd7['join']());for(var _0xd32428=0x0;_0xd32428<_0x5f5cd7['length'];_0xd32428++){io[_0xa6ae('0x19')](_0xa6ae('0x1a'),{'id':_0x5f5cd7[_0xd32428],'closed':!![]});}}})[_0xa6ae('0x1b')](function(_0x1d09c2){logger[_0xa6ae('0x1c')](_0xa6ae('0x1d'),_0x1d09c2?util[_0xa6ae('0x1e')](_0x1d09c2,{'showHidden':![],'depth':null}):'');});}exports[_0xa6ae('0x1f')]=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 d142564..d8166bb 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 _0x5c10=['email\x20sent','data','isNil','subtractNumber\x20null\x20or\x20undefined','subtractUnit','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','then','CustomReportId','catch','MailServerOut','keys','jobs','map','keyBy','toString','difference','intersection','length','exists','stop','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','startAt','endAt','add','add\x20cron','stop\x20cron','update','deleteJob','run','start','path','../logger','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','MailAccount','service','Smtp','host','port','secure','auth','user','format','name','email','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','Sent','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','text','sendIfEmpty','empty\x20file,\x20email\x20not\x20sent','request','error','error\x20mail'];(function(_0x103e03,_0x53d940){var _0x5e1741=function(_0x4c9f74){while(--_0x4c9f74){_0x103e03['push'](_0x103e03['shift']());}};_0x5e1741(++_0x53d940);}(_0x5c10,0x12e));var _0x05c1=function(_0x25f0a8,_0x13eb86){_0x25f0a8=_0x25f0a8-0x0;var _0x4e8574=_0x5c10[_0x25f0a8];return _0x4e8574;};'use strict';var fs=require('fs');var util=require('util');var path=require(_0x05c1('0x0'));var _=require('lodash');var moment=require('moment');var CronJobManager=require('cron-job-manager');var jayson=require('jayson/promise');var BPromise=require('bluebird');var logger=require(_0x05c1('0x1'))('schedule');var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x05c1('0x2'));var analyticDefaultReportController=require(_0x05c1('0x3'));var client=jayson[_0x05c1('0x4')][_0x05c1('0x5')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x500853,_0x5a3f4f){return function(){logger[_0x05c1('0x6')](_0x05c1('0x7'),_0x500853['email']);var _0x5ecf3c=!![];var _0x36def0={'tls':{'rejectUnauthorized':![]}};if(_0x500853[_0x05c1('0x8')]['Smtp'][_0x05c1('0x9')]){_0x36def0[_0x05c1('0x9')]=_0x500853[_0x05c1('0x8')][_0x05c1('0xa')][_0x05c1('0x9')];}else{_0x36def0[_0x05c1('0xb')]=_0x500853[_0x05c1('0x8')]['Smtp'][_0x05c1('0xb')];_0x36def0[_0x05c1('0xc')]=_0x500853[_0x05c1('0x8')][_0x05c1('0xa')][_0x05c1('0xc')];_0x36def0[_0x05c1('0xd')]=_0x500853['MailAccount'][_0x05c1('0xa')]['secure'];}if(_0x500853['MailAccount'][_0x05c1('0xa')]['authentication']){_0x36def0[_0x05c1('0xe')]={'user':_0x500853[_0x05c1('0x8')]['Smtp'][_0x05c1('0xf')],'pass':_0x500853[_0x05c1('0x8')][_0x05c1('0xa')]['pass']};}var _0x1d0259={'account':_0x36def0,'message':{'from':util[_0x05c1('0x10')]('\x22%s\x22\x20<%s>',_0x500853['MailAccount'][_0x05c1('0x11')],_0x500853[_0x05c1('0x8')][_0x05c1('0x12')]||_0x500853[_0x05c1('0x8')]['Smtp']['user']),'to':_0x500853['email'],'cc':_0x500853['cc'],'bcc':_0x500853[_0x05c1('0x13')],'subject':util[_0x05c1('0x10')](_0x05c1('0x14'),_0x5a3f4f[_0x05c1('0x11')],_0x500853[_0x05c1('0x15')],_0x500853['subtractUnit'])}};var _0x3d3343=path[_0x05c1('0x16')](__dirname,_0x05c1('0x17'));var _0x3e7bad=_0x5a3f4f[_0x05c1('0x18')];var _0x645664=util[_0x05c1('0x10')](_0x05c1('0x19'),path[_0x05c1('0x1a')](_0x5a3f4f['savename'],path[_0x05c1('0x1b')](_0x5a3f4f['savename'])),_0x05c1('0x1c'));var _0x5436aa=path['join'](_0x3d3343,_0x3e7bad);var _0x279167=path['join'](_0x3d3343,_0x645664);if(fs[_0x05c1('0x1d')](_0x5436aa)){_0x5a3f4f[_0x05c1('0x1e')]=_0x05c1('0x1f');_0x1d0259['message']['attachments']=[{'filename':_0x3e7bad,'path':_0x5436aa}];_0x1d0259[_0x05c1('0x20')]['text']=util['format'](_0x05c1('0x21'),JSON[_0x05c1('0x22')](_0x5a3f4f,null,0x2));}else if(fs[_0x05c1('0x1d')](_0x279167)){_0x5a3f4f[_0x05c1('0x1e')]=_0x05c1('0x1f');_0x1d0259[_0x05c1('0x20')][_0x05c1('0x23')]=[{'filename':_0x645664,'path':_0x279167}];}else{_0x1d0259[_0x05c1('0x20')][_0x05c1('0x24')]='Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a';if(!_0x500853[_0x05c1('0x25')]){_0x5ecf3c=![];logger[_0x05c1('0x6')](_0x05c1('0x26'));}}if(_0x5ecf3c){return client[_0x05c1('0x27')]('SendMail',_0x1d0259)['then'](function(_0x12e672){if(_0x12e672[_0x05c1('0x28')]){return logger[_0x05c1('0x28')](_0x05c1('0x29'),JSON[_0x05c1('0x22')](_0x12e672));}return logger[_0x05c1('0x6')](_0x05c1('0x2a'));})['catch'](function(_0x3b387c){return logger[_0x05c1('0x28')](_0x05c1('0x29'),JSON['stringify'](_0x3b387c));});}};}function handleError(){return function(_0x4bd2cb){return logger['error'](JSON['stringify'](_0x4bd2cb));};}function handleResult(_0x4c3f16){return function(_0x1a9f5f){logger[_0x05c1('0x6')](_0x05c1('0x2b'),JSON[_0x05c1('0x22')](_0x1a9f5f));if(_0x4c3f16[_0x05c1('0x8')]&&_0x4c3f16[_0x05c1('0x8')][_0x05c1('0xa')]&&!_['isNil'](_0x4c3f16[_0x05c1('0x12')])){setTimeout(handleSendEmail(_0x4c3f16,_0x1a9f5f),0x3c*0x3e8);}};}function handleJob(_0x3d9627){return function(){try{if(_[_0x05c1('0x2c')](_0x3d9627[_0x05c1('0x15')])){return logger[_0x05c1('0x6')](_0x05c1('0x2d'));}if(_[_0x05c1('0x2c')](_0x3d9627[_0x05c1('0x2e')])){return logger[_0x05c1('0x6')](_0x05c1('0x2f'));}var _0xb2f3af={'startDate':moment()[_0x05c1('0x30')](_0x3d9627[_0x05c1('0x15')],_0x3d9627[_0x05c1('0x2e')])['format'](_0x05c1('0x31')),'endDate':moment()[_0x05c1('0x10')]('YYYY-MM-DD\x20HH:mm:ss'),'type':_0x05c1('0x32'),'output':_0x3d9627[_0x05c1('0x33')],'name':_0x3d9627['name']};if(!_[_0x05c1('0x2c')](_0x3d9627['DefaultReportId'])){logger[_0x05c1('0x6')]('exec\x20defaul\x20report\x20id:%s',_0x3d9627[_0x05c1('0x34')]);return analyticDefaultReportController[_0x05c1('0x35')]({'id':_0x3d9627[_0x05c1('0x34')]},_0xb2f3af)[_0x05c1('0x36')](handleResult(_0x3d9627))['catch'](handleError());}if(!_[_0x05c1('0x2c')](_0x3d9627[_0x05c1('0x37')])){logger['info']('exec\x20custom\x20report\x20id:%s',_0x3d9627[_0x05c1('0x37')]);return analyticCustomReportController[_0x05c1('0x35')]({'id':_0x3d9627[_0x05c1('0x37')]},_0xb2f3af)[_0x05c1('0x36')](handleResult(_0x3d9627))[_0x05c1('0x38')](handleError());}}catch(_0x4dba40){logger['error'](JSON[_0x05c1('0x22')](_0x4dba40));}return logger[_0x05c1('0x6')]('no\x20report\x20id');};}function getJobs(_0x26d9d1){var _0x3a7855={};if(_0x26d9d1){_0x3a7855['id']=_0x26d9d1;}return db['Schedule']['findAll']({'where':_0x3a7855,'include':[{'model':db['MailAccount'],'attributes':['id','name','email'],'include':[{'model':db[_0x05c1('0x39')],'as':_0x05c1('0xa')}]}]})[_0x05c1('0x36')](function(_0x399051){var _0x1bf073=_[_0x05c1('0x3a')](manager[_0x05c1('0x3b')]);var _0xf2d7d6=_[_0x05c1('0x3c')](_0x399051,function(_0x39e772){return _0x39e772['id']['toString']();});var _0x170867=_[_0x05c1('0x3d')](_0x399051,function(_0x29fb9e){return _0x29fb9e['id'][_0x05c1('0x3e')]();});var _0x5717fb=_0x26d9d1?_0xf2d7d6:_[_0x05c1('0x3f')](_0xf2d7d6,_0x1bf073);var _0x256a7a=_[_0x05c1('0x40')](_0xf2d7d6,_0x1bf073);var _0x2a02d0=_[_0x05c1('0x3f')](_0x1bf073,_0xf2d7d6);var _0x3df2b5;var _0xe9b5f8;for(_0x3df2b5=0x0;_0x3df2b5<_0x2a02d0[_0x05c1('0x41')]&&!_0x26d9d1;_0x3df2b5+=0x1){_0xe9b5f8=_0x2a02d0[_0x3df2b5]['toString']();if(manager[_0x05c1('0x42')](_0xe9b5f8)){manager[_0x05c1('0x43')](_0xe9b5f8);manager['deleteJob'](_0xe9b5f8);logger[_0x05c1('0x6')](_0x05c1('0x44'),_0xe9b5f8);}}logger[_0x05c1('0x6')](_0x05c1('0x45'),JSON[_0x05c1('0x22')](_0x5717fb));for(_0x3df2b5=0x0;_0x3df2b5<_0x5717fb['length'];_0x3df2b5+=0x1){_0xe9b5f8=_0x5717fb[_0x3df2b5][_0x05c1('0x3e')]();logger[_0x05c1('0x6')](_0x05c1('0x46'),_0xe9b5f8);if(_0x26d9d1){logger[_0x05c1('0x6')](_0x05c1('0x47'),_0x26d9d1);logger[_0x05c1('0x6')](JSON[_0x05c1('0x22')](_0x170867[_0xe9b5f8]));BPromise[_0x05c1('0x48')]()['then'](handleJob(_0x170867[_0xe9b5f8]));logger['info'](_0x05c1('0x49'),_0x170867[_0xe9b5f8][_0x05c1('0x11')],_0x170867[_0xe9b5f8][_0x05c1('0x4a')]);}else if(_0x170867[_0xe9b5f8]['cron']&&_0x170867[_0xe9b5f8][_0x05c1('0x4b')]&&moment()[_0x05c1('0x4c')](_0x170867[_0xe9b5f8][_0x05c1('0x4d')],_0x170867[_0xe9b5f8][_0x05c1('0x4e')])){manager[_0x05c1('0x4f')](_0xe9b5f8,_0x170867[_0xe9b5f8][_0x05c1('0x4a')],handleJob(_0x170867[_0xe9b5f8]));manager['start'](_0xe9b5f8);logger[_0x05c1('0x6')](_0x05c1('0x50'),_0x170867[_0xe9b5f8]['name'],_0x170867[_0xe9b5f8][_0x05c1('0x4a')]);}else if(manager[_0x05c1('0x42')](_0xe9b5f8)){manager[_0x05c1('0x43')](_0xe9b5f8);manager['deleteJob'](_0xe9b5f8);logger[_0x05c1('0x6')](_0x05c1('0x51'),_0x170867[_0xe9b5f8][_0x05c1('0x11')],_0x170867[_0xe9b5f8][_0x05c1('0x4a')]);}}for(_0x3df2b5=0x0,_0xe9b5f8;_0x3df2b5<_0x256a7a['length']&&!_0x26d9d1;_0x3df2b5+=0x1){_0xe9b5f8=_0x256a7a[_0x3df2b5][_0x05c1('0x3e')]();if(manager['exists'](_0xe9b5f8)){if(_0x170867[_0xe9b5f8][_0x05c1('0x4a')]&&_0x170867[_0xe9b5f8]['active']&&moment()[_0x05c1('0x4c')](_0x170867[_0xe9b5f8][_0x05c1('0x4d')],_0x170867[_0xe9b5f8][_0x05c1('0x4e')])){manager[_0x05c1('0x52')](_0xe9b5f8,_0x170867[_0xe9b5f8]['cron'],handleJob(_0x170867[_0xe9b5f8]));logger['info']('update\x20cron',_0x170867[_0xe9b5f8][_0x05c1('0x11')],_0x170867[_0xe9b5f8][_0x05c1('0x4a')]);}else{manager['stop'](_0xe9b5f8);manager[_0x05c1('0x53')](_0xe9b5f8);logger[_0x05c1('0x6')](_0x05c1('0x51'),_0x170867[_0xe9b5f8][_0x05c1('0x11')],_0x170867[_0xe9b5f8][_0x05c1('0x4a')]);}}}})[_0x05c1('0x38')](function(_0x1daeac){logger['error'](JSON[_0x05c1('0x22')](_0x1daeac));});}exports[_0x05c1('0x54')]=function(_0x33b874){return getJobs(_0x33b874);};exports[_0x05c1('0x55')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0xca0d=['Schedule','findAll','MailServerOut','keys','jobs','toString','keyBy','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','active','isBetween','endAt','add\x20cron','stop\x20cron','startAt','update','update\x20cron','run','start','util','path','lodash','moment','cron-job-manager','bluebird','../logger','schedule','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','info','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','service','Smtp','host','port','secure','auth','user','pass','format','\x22%s\x22\x20<%s>','name','bcc','subtractNumber','subtractUnit','join','savename','%s.%s','basename','extname','zip','existsSync','Sent','message','attachments','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','status','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','error\x20mail','email\x20sent','catch','isNil','subtractUnit\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','DefaultReportId','runReport','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0xca0d,0xd3));var _0xdca0=function(_0x3ce3bc,_0x3530af){_0x3ce3bc=_0x3ce3bc-0x0;var _0x31100b=_0xca0d[_0x3ce3bc];return _0x31100b;};'use strict';var fs=require('fs');var util=require(_0xdca0('0x0'));var path=require(_0xdca0('0x1'));var _=require(_0xdca0('0x2'));var moment=require(_0xdca0('0x3'));var CronJobManager=require(_0xdca0('0x4'));var jayson=require('jayson/promise');var BPromise=require(_0xdca0('0x5'));var logger=require(_0xdca0('0x6'))(_0xdca0('0x7'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require('../../api/analyticCustomReport/analyticCustomReport.controller');var analyticDefaultReportController=require(_0xdca0('0x8'));var client=jayson[_0xdca0('0x9')][_0xdca0('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x2c3154,_0x28f98c){return function(){logger[_0xdca0('0xb')](_0xdca0('0xc'),_0x2c3154[_0xdca0('0xd')]);var _0x86b98c=!![];var _0x2301ba={'tls':{'rejectUnauthorized':![]}};if(_0x2c3154[_0xdca0('0xe')]['Smtp'][_0xdca0('0xf')]){_0x2301ba[_0xdca0('0xf')]=_0x2c3154[_0xdca0('0xe')][_0xdca0('0x10')][_0xdca0('0xf')];}else{_0x2301ba[_0xdca0('0x11')]=_0x2c3154[_0xdca0('0xe')]['Smtp'][_0xdca0('0x11')];_0x2301ba[_0xdca0('0x12')]=_0x2c3154[_0xdca0('0xe')]['Smtp'][_0xdca0('0x12')];_0x2301ba[_0xdca0('0x13')]=_0x2c3154[_0xdca0('0xe')]['Smtp'][_0xdca0('0x13')];}if(_0x2c3154[_0xdca0('0xe')]['Smtp']['authentication']){_0x2301ba[_0xdca0('0x14')]={'user':_0x2c3154['MailAccount']['Smtp'][_0xdca0('0x15')],'pass':_0x2c3154['MailAccount'][_0xdca0('0x10')][_0xdca0('0x16')]};}var _0x4a0d4f={'account':_0x2301ba,'message':{'from':util[_0xdca0('0x17')](_0xdca0('0x18'),_0x2c3154[_0xdca0('0xe')][_0xdca0('0x19')],_0x2c3154[_0xdca0('0xe')]['email']||_0x2c3154[_0xdca0('0xe')][_0xdca0('0x10')]['user']),'to':_0x2c3154['email'],'cc':_0x2c3154['cc'],'bcc':_0x2c3154[_0xdca0('0x1a')],'subject':util[_0xdca0('0x17')]('Report\x20%s\x20last\x20%s\x20%s',_0x28f98c[_0xdca0('0x19')],_0x2c3154[_0xdca0('0x1b')],_0x2c3154[_0xdca0('0x1c')])}};var _0x1894a5=path[_0xdca0('0x1d')](__dirname,'../../files/reports');var _0x42577c=_0x28f98c[_0xdca0('0x1e')];var _0x30f594=util[_0xdca0('0x17')](_0xdca0('0x1f'),path[_0xdca0('0x20')](_0x28f98c[_0xdca0('0x1e')],path[_0xdca0('0x21')](_0x28f98c[_0xdca0('0x1e')])),_0xdca0('0x22'));var _0x535508=path[_0xdca0('0x1d')](_0x1894a5,_0x42577c);var _0x236150=path[_0xdca0('0x1d')](_0x1894a5,_0x30f594);if(fs[_0xdca0('0x23')](_0x535508)){_0x28f98c['status']=_0xdca0('0x24');_0x4a0d4f[_0xdca0('0x25')][_0xdca0('0x26')]=[{'filename':_0x42577c,'path':_0x535508}];_0x4a0d4f[_0xdca0('0x25')]['text']=util['format'](_0xdca0('0x27'),JSON[_0xdca0('0x28')](_0x28f98c,null,0x2));}else if(fs[_0xdca0('0x23')](_0x236150)){_0x28f98c[_0xdca0('0x29')]=_0xdca0('0x24');_0x4a0d4f[_0xdca0('0x25')][_0xdca0('0x26')]=[{'filename':_0x30f594,'path':_0x236150}];}else{_0x4a0d4f[_0xdca0('0x25')]['text']=_0xdca0('0x2a');if(!_0x2c3154[_0xdca0('0x2b')]){_0x86b98c=![];logger[_0xdca0('0xb')](_0xdca0('0x2c'));}}if(_0x86b98c){return client[_0xdca0('0x2d')](_0xdca0('0x2e'),_0x4a0d4f)[_0xdca0('0x2f')](function(_0x3f3bfc){if(_0x3f3bfc[_0xdca0('0x30')]){return logger['error'](_0xdca0('0x31'),JSON[_0xdca0('0x28')](_0x3f3bfc));}return logger['info'](_0xdca0('0x32'));})[_0xdca0('0x33')](function(_0x3e9140){return logger['error'](_0xdca0('0x31'),JSON[_0xdca0('0x28')](_0x3e9140));});}};}function handleError(){return function(_0x127cc1){return logger[_0xdca0('0x30')](JSON[_0xdca0('0x28')](_0x127cc1));};}function handleResult(_0x5714c3){return function(_0x32eda7){logger['info']('data',JSON['stringify'](_0x32eda7));if(_0x5714c3[_0xdca0('0xe')]&&_0x5714c3[_0xdca0('0xe')][_0xdca0('0x10')]&&!_[_0xdca0('0x34')](_0x5714c3[_0xdca0('0xd')])){setTimeout(handleSendEmail(_0x5714c3,_0x32eda7),0x3c*0x3e8);}};}function handleJob(_0x4fda80){return function(){try{if(_['isNil'](_0x4fda80[_0xdca0('0x1b')])){return logger[_0xdca0('0xb')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xdca0('0x34')](_0x4fda80['subtractUnit'])){return logger[_0xdca0('0xb')](_0xdca0('0x35'));}var _0x23e7f2={'startDate':moment()['subtract'](_0x4fda80['subtractNumber'],_0x4fda80['subtractUnit'])[_0xdca0('0x17')](_0xdca0('0x36')),'endDate':moment()[_0xdca0('0x17')](_0xdca0('0x36')),'type':_0xdca0('0x37'),'output':_0x4fda80[_0xdca0('0x38')],'name':_0x4fda80[_0xdca0('0x19')]};if(!_[_0xdca0('0x34')](_0x4fda80[_0xdca0('0x39')])){logger[_0xdca0('0xb')]('exec\x20defaul\x20report\x20id:%s',_0x4fda80[_0xdca0('0x39')]);return analyticDefaultReportController[_0xdca0('0x3a')]({'id':_0x4fda80[_0xdca0('0x39')]},_0x23e7f2)[_0xdca0('0x2f')](handleResult(_0x4fda80))[_0xdca0('0x33')](handleError());}if(!_[_0xdca0('0x34')](_0x4fda80['CustomReportId'])){logger[_0xdca0('0xb')](_0xdca0('0x3b'),_0x4fda80[_0xdca0('0x3c')]);return analyticCustomReportController['runReport']({'id':_0x4fda80[_0xdca0('0x3c')]},_0x23e7f2)[_0xdca0('0x2f')](handleResult(_0x4fda80))[_0xdca0('0x33')](handleError());}}catch(_0x573a3d){logger[_0xdca0('0x30')](JSON[_0xdca0('0x28')](_0x573a3d));}return logger[_0xdca0('0xb')](_0xdca0('0x3d'));};}function getJobs(_0x259b41){var _0x5aafa6={};if(_0x259b41){_0x5aafa6['id']=_0x259b41;}return db[_0xdca0('0x3e')][_0xdca0('0x3f')]({'where':_0x5aafa6,'include':[{'model':db[_0xdca0('0xe')],'attributes':['id',_0xdca0('0x19'),_0xdca0('0xd')],'include':[{'model':db[_0xdca0('0x40')],'as':_0xdca0('0x10')}]}]})[_0xdca0('0x2f')](function(_0x190a28){var _0x1f0fdf=_[_0xdca0('0x41')](manager[_0xdca0('0x42')]);var _0x57623e=_['map'](_0x190a28,function(_0x42bed0){return _0x42bed0['id'][_0xdca0('0x43')]();});var _0xfa6837=_[_0xdca0('0x44')](_0x190a28,function(_0x19b6fd){return _0x19b6fd['id']['toString']();});var _0x46ce96=_0x259b41?_0x57623e:_[_0xdca0('0x45')](_0x57623e,_0x1f0fdf);var _0x165459=_['intersection'](_0x57623e,_0x1f0fdf);var _0x51e81c=_[_0xdca0('0x45')](_0x1f0fdf,_0x57623e);var _0x5bd047;var _0x5cd6ee;for(_0x5bd047=0x0;_0x5bd047<_0x51e81c[_0xdca0('0x46')]&&!_0x259b41;_0x5bd047+=0x1){_0x5cd6ee=_0x51e81c[_0x5bd047][_0xdca0('0x43')]();if(manager[_0xdca0('0x47')](_0x5cd6ee)){manager[_0xdca0('0x48')](_0x5cd6ee);manager[_0xdca0('0x49')](_0x5cd6ee);logger[_0xdca0('0xb')](_0xdca0('0x4a'),_0x5cd6ee);}}logger[_0xdca0('0xb')](_0xdca0('0x4b'),JSON[_0xdca0('0x28')](_0x46ce96));for(_0x5bd047=0x0;_0x5bd047<_0x46ce96['length'];_0x5bd047+=0x1){_0x5cd6ee=_0x46ce96[_0x5bd047][_0xdca0('0x43')]();logger['info'](_0xdca0('0x4c'),_0x5cd6ee);if(_0x259b41){logger['info'](_0xdca0('0x4d'),_0x259b41);logger[_0xdca0('0xb')](JSON[_0xdca0('0x28')](_0xfa6837[_0x5cd6ee]));BPromise[_0xdca0('0x4e')]()[_0xdca0('0x2f')](handleJob(_0xfa6837[_0x5cd6ee]));logger['info'](_0xdca0('0x4f'),_0xfa6837[_0x5cd6ee][_0xdca0('0x19')],_0xfa6837[_0x5cd6ee][_0xdca0('0x50')]);}else if(_0xfa6837[_0x5cd6ee][_0xdca0('0x50')]&&_0xfa6837[_0x5cd6ee][_0xdca0('0x51')]&&moment()[_0xdca0('0x52')](_0xfa6837[_0x5cd6ee]['startAt'],_0xfa6837[_0x5cd6ee][_0xdca0('0x53')])){manager['add'](_0x5cd6ee,_0xfa6837[_0x5cd6ee][_0xdca0('0x50')],handleJob(_0xfa6837[_0x5cd6ee]));manager['start'](_0x5cd6ee);logger[_0xdca0('0xb')](_0xdca0('0x54'),_0xfa6837[_0x5cd6ee][_0xdca0('0x19')],_0xfa6837[_0x5cd6ee]['cron']);}else if(manager[_0xdca0('0x47')](_0x5cd6ee)){manager[_0xdca0('0x48')](_0x5cd6ee);manager[_0xdca0('0x49')](_0x5cd6ee);logger[_0xdca0('0xb')](_0xdca0('0x55'),_0xfa6837[_0x5cd6ee][_0xdca0('0x19')],_0xfa6837[_0x5cd6ee][_0xdca0('0x50')]);}}for(_0x5bd047=0x0,_0x5cd6ee;_0x5bd047<_0x165459[_0xdca0('0x46')]&&!_0x259b41;_0x5bd047+=0x1){_0x5cd6ee=_0x165459[_0x5bd047][_0xdca0('0x43')]();if(manager[_0xdca0('0x47')](_0x5cd6ee)){if(_0xfa6837[_0x5cd6ee]['cron']&&_0xfa6837[_0x5cd6ee][_0xdca0('0x51')]&&moment()[_0xdca0('0x52')](_0xfa6837[_0x5cd6ee][_0xdca0('0x56')],_0xfa6837[_0x5cd6ee][_0xdca0('0x53')])){manager[_0xdca0('0x57')](_0x5cd6ee,_0xfa6837[_0x5cd6ee][_0xdca0('0x50')],handleJob(_0xfa6837[_0x5cd6ee]));logger[_0xdca0('0xb')](_0xdca0('0x58'),_0xfa6837[_0x5cd6ee][_0xdca0('0x19')],_0xfa6837[_0x5cd6ee][_0xdca0('0x50')]);}else{manager[_0xdca0('0x48')](_0x5cd6ee);manager['deleteJob'](_0x5cd6ee);logger[_0xdca0('0xb')](_0xdca0('0x55'),_0xfa6837[_0x5cd6ee]['name'],_0xfa6837[_0x5cd6ee]['cron']);}}}})['catch'](function(_0x1e452a){logger[_0xdca0('0x30')](JSON[_0xdca0('0x28')](_0x1e452a));});}exports[_0xdca0('0x59')]=function(_0x4d7ebc){return getJobs(_0x4d7ebc);};exports[_0xdca0('0x5a')]=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 228f0b6..c8a323b 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 _0x93e6=['FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','bucket','CloudProvider','name','SequelizeValidationError','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','Setting','Settings\x20not\x20available','Transcribe\x20not\x20configured','transcribeAccountId','forEach','push','lodash','util','../../mysqldb','transcribe','Comprehend','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','transcribeName','data2','transcribeRegion','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','then','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','Sequelize','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','findOne','ValidationError','Cloud\x20Provider\x20not\x20available','data1','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Negative','Mixed','Neutral','FAILED'];(function(_0x4bcc16,_0x3ab575){var _0x30454c=function(_0x39a467){while(--_0x39a467){_0x4bcc16['push'](_0x4bcc16['shift']());}};_0x30454c(++_0x3ab575);}(_0x93e6,0x11e));var _0x693e=function(_0x38441d,_0x12e5f5){_0x38441d=_0x38441d-0x0;var _0x23c0a0=_0x93e6[_0x38441d];return _0x23c0a0;};var _=require(_0x693e('0x0'));var AWS=require('aws-sdk');var rp=require('request-promise');var util=require(_0x693e('0x1'));var BPromise=require('bluebird');var db=require(_0x693e('0x2'))['db'];var logger=require('../../config/logger')(_0x693e('0x3'));function getTranscriptionJob(_0x3fb653,_0x17cf23,_0x53e728,_0x1d2b99){return new Promise(function(_0x388eb6,_0x2569a4){var _0x520113=new AWS['TranscribeService']({'accessKeyId':_0x17cf23,'secretAccessKey':_0x3fb653,'region':_0x53e728});_0x520113['getTranscriptionJob']({'TranscriptionJobName':_0x1d2b99},function(_0x155601,_0x4b30f6){if(_0x155601){return _0x2569a4(_0x155601);}else{return _0x388eb6(_0x4b30f6);}});});}function sentiment(_0x216d7e,_0x1e53e2,_0x14b901,_0x546dc7,_0x47438b){return new Promise(function(_0x4bba81,_0x1b5922){var _0x5cefdb=new AWS[(_0x693e('0x4'))]({'accessKeyId':_0x1e53e2,'secretAccessKey':_0x216d7e,'region':_0x14b901});_0x5cefdb['detectSentiment']({'Text':_0x546dc7,'LanguageCode':_0x47438b['substring'](0x0,0x2)},function(_0x3ece3e,_0x3aa887){if(_0x3ece3e){return _0x1b5922(_0x3ece3e);}else{return _0x4bba81(_0x3aa887);}});});}function checkTranscribeJob(_0x121fb9,_0x2d894b,_0x5bc8a3){var _0x256143;return new BPromise(function(_0x172b79,_0x25c4a7){logger[_0x693e('0x5')](util[_0x693e('0x6')](_0x693e('0x7'),_0x121fb9['id'],_0x121fb9[_0x693e('0x8')]));return getTranscriptionJob(_0x5bc8a3['data1'],_0x5bc8a3[_0x693e('0x9')],_0x2d894b[_0x693e('0xa')],_0x121fb9[_0x693e('0x8')])['then'](function(_0x18b748){logger[_0x693e('0x5')](util[_0x693e('0x6')](_0x693e('0xb'),_0x121fb9['id'],_0x121fb9[_0x693e('0x8')],_0x18b748[_0x693e('0xc')][_0x693e('0xd')]));if(!_0x121fb9['fileText']){switch(_0x18b748['TranscriptionJob']['TranscriptionJobStatus']){case _0x693e('0xe'):var _0x11407a={'transcribeStatus':_0x18b748['TranscriptionJob']['TranscriptionJobStatus'],'fileUri':_0x18b748[_0x693e('0xc')][_0x693e('0xf')][_0x693e('0x10')]};logger[_0x693e('0x5')](util['format'](_0x693e('0x11'),_0x121fb9['id']));return rp({'uri':_0x18b748[_0x693e('0xc')][_0x693e('0xf')]['TranscriptFileUri'],'json':!![]})[_0x693e('0x12')](function(_0x35d033){logger['info'](util[_0x693e('0x6')](_0x693e('0x13'),_0x121fb9['id']));if(_0x35d033&&_0x35d033['results']&&_0x35d033[_0x693e('0x14')][_0x693e('0x15')]&&_0x35d033['results'][_0x693e('0x15')][_0x693e('0x16')]){_0x11407a[_0x693e('0x17')]='';for(var _0x32b552=0x0;_0x32b552<_0x35d033[_0x693e('0x14')][_0x693e('0x15')][_0x693e('0x16')];_0x32b552++){_0x11407a[_0x693e('0x17')]+=_0x35d033[_0x693e('0x14')][_0x693e('0x15')][_0x32b552][_0x693e('0x18')]+'';}}return _0x121fb9[_0x693e('0x19')](_0x11407a);})[_0x693e('0x12')](function(){logger[_0x693e('0x5')](util[_0x693e('0x6')](_0x693e('0x1a'),_0x121fb9['id']));if(!_0x121fb9[_0x693e('0x1b')]){throw new db[(_0x693e('0x1c'))]['ValidationError'](_0x693e('0x1d'));}if(!_0x2d894b[_0x693e('0x1e')]||!_0x2d894b[_0x693e('0x1f')]||!_0x2d894b[_0x693e('0x20')]||!_0x2d894b[_0x693e('0x21')]||!_0x2d894b['bucket']){throw new db[(_0x693e('0x1c'))]['ValidationError'](_0x693e('0x22'));}if(!_0x11407a['fileText']){throw new Error(_0x693e('0x23'));}if(_0x2d894b[_0x693e('0x1f')]===_0x5bc8a3['id']){return _0x5bc8a3;}else{return db['CloudProvider'][_0x693e('0x24')]({'where':{'id':_settings[_0x693e('0x1f')]}});}})['then'](function(_0xd45e41){if(!_0xd45e41){throw new db[(_0x693e('0x1c'))][(_0x693e('0x25'))](_0x693e('0x26'));}if(!_0xd45e41[_0x693e('0x27')]||!_0xd45e41[_0x693e('0x9')]){throw new db[(_0x693e('0x1c'))][(_0x693e('0x25'))](_0x693e('0x28'));}_0x256143=_0xd45e41;logger[_0x693e('0x5')](util[_0x693e('0x6')](_0x693e('0x29'),_0x121fb9['id']));return sentiment(_0x256143[_0x693e('0x27')],_0x256143[_0x693e('0x9')],_0x2d894b[_0x693e('0x20')],_0x11407a[_0x693e('0x17')],_0x2d894b[_0x693e('0x21')]);})[_0x693e('0x12')](function(_0x686a7){logger['info'](util[_0x693e('0x6')](_0x693e('0x2a'),_0x121fb9['id']));return _0x121fb9['update']({'sentiment':_0x686a7[_0x693e('0x2b')],'sPositive':_0x686a7[_0x693e('0x2c')]['Positive'],'sNegative':_0x686a7['SentimentScore'][_0x693e('0x2d')],'sMixed':_0x686a7[_0x693e('0x2c')][_0x693e('0x2e')],'sNeutral':_0x686a7[_0x693e('0x2c')][_0x693e('0x2f')]});})[_0x693e('0x12')](function(){logger[_0x693e('0x5')](util[_0x693e('0x6')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x121fb9['id']));_0x172b79();});case _0x693e('0x30'):return _0x121fb9[_0x693e('0x19')]({'transcribeStatus':'FAILED','failureReason':_0x18b748[_0x693e('0xc')][_0x693e('0x31')]})[_0x693e('0x12')](function(){logger[_0x693e('0x5')](util[_0x693e('0x6')](_0x693e('0x1a'),_0x121fb9['id']));_0x172b79();});default:logger[_0x693e('0x5')](util['format'](_0x693e('0x32'),_0x121fb9['id']));break;}}else{return BPromise[_0x693e('0x33')]()[_0x693e('0x12')](function(){if(!_0x121fb9['tempSentiment']){throw new db[(_0x693e('0x1c'))]['ValidationError'](_0x693e('0x1d'));}if(!_0x2d894b[_0x693e('0x1e')]||!_0x2d894b['sentimentAccountId']||!_0x2d894b['sentimentRegion']||!_0x2d894b[_0x693e('0x21')]||!_0x2d894b[_0x693e('0x34')]){throw new db[(_0x693e('0x1c'))][(_0x693e('0x25'))](_0x693e('0x22'));}if(!_0x121fb9[_0x693e('0x17')]){throw new Error(_0x693e('0x23'));}if(_0x2d894b[_0x693e('0x1f')]===_0x5bc8a3['id']){return _0x5bc8a3;}else{return db[_0x693e('0x35')][_0x693e('0x24')]({'where':{'id':_settings[_0x693e('0x1f')]}});}})[_0x693e('0x12')](function(_0x56a4da){if(!_0x56a4da){throw new db['Sequelize'][(_0x693e('0x25'))](_0x693e('0x26'));}if(!_0x56a4da[_0x693e('0x27')]||!_0x56a4da[_0x693e('0x9')]){throw new db[(_0x693e('0x1c'))]['ValidationError'](_0x693e('0x28'));}_0x256143=_0x56a4da;logger[_0x693e('0x5')](util[_0x693e('0x6')](_0x693e('0x29'),_0x121fb9['id']));return sentiment(_0x256143[_0x693e('0x27')],_0x256143[_0x693e('0x9')],_0x2d894b[_0x693e('0x20')],_0x121fb9[_0x693e('0x17')],_0x2d894b['language']);})[_0x693e('0x12')](function(_0x53c676){logger[_0x693e('0x5')](util[_0x693e('0x6')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x121fb9['id']));return _0x121fb9[_0x693e('0x19')]({'sentiment':_0x53c676[_0x693e('0x2b')],'sPositive':_0x53c676[_0x693e('0x2c')]['Positive'],'sNegative':_0x53c676[_0x693e('0x2c')][_0x693e('0x2d')],'sMixed':_0x53c676[_0x693e('0x2c')][_0x693e('0x2e')],'sNeutral':_0x53c676[_0x693e('0x2c')][_0x693e('0x2f')],'transcribeStatus':_0x693e('0xe')});})[_0x693e('0x12')](function(){logger[_0x693e('0x5')](util[_0x693e('0x6')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x121fb9['id']));_0x172b79();});}})['catch'](function(_0x2f026b){if(_0x2f026b){if(!_0x2f026b[_0x693e('0x36')]||_0x2f026b[_0x693e('0x36')]!==_0x693e('0x37')){logger[_0x693e('0x38')](util['format'](_0x693e('0x39'),_0x121fb9['id']),util[_0x693e('0x3a')](_0x2f026b,{'showHidden':![],'depth':null}));}}_0x172b79();});});}function checkTranscribe(){var _0x108ac2;var _0x44f45e;var _0x1fbcd8;return db[_0x693e('0x3b')]['findAll']({'where':{'transcribeStatus':_0x693e('0x3c')}})[_0x693e('0x12')](function(_0x3a57a6){if(!_0x3a57a6||!_0x3a57a6[_0x693e('0x16')]){throw new db['Sequelize'][(_0x693e('0x25'))]('No\x20transcribe\x20job\x20to\x20check');}_0x108ac2=_0x3a57a6;return db[_0x693e('0x3d')][_0x693e('0x24')]({'where':{'id':0x1}});})[_0x693e('0x12')](function(_0x3503d2){if(!_0x3503d2){throw new db[(_0x693e('0x1c'))][(_0x693e('0x25'))](_0x693e('0x3e'));}_0x44f45e=_0x3503d2;if(!_0x44f45e[_0x693e('0x3')]||!_0x44f45e['transcribeAccountId']||!_0x44f45e['transcribeRegion']||!_0x44f45e[_0x693e('0x21')]||!_0x44f45e[_0x693e('0x34')]){throw new db[(_0x693e('0x1c'))][(_0x693e('0x25'))](_0x693e('0x3f'));}return db['CloudProvider'][_0x693e('0x24')]({'where':{'id':_0x44f45e[_0x693e('0x40')]}});})['then'](function(_0x2c2406){if(!_0x2c2406){throw new db[(_0x693e('0x1c'))][(_0x693e('0x25'))](_0x693e('0x26'));}if(!_0x2c2406[_0x693e('0x27')]||!_0x2c2406[_0x693e('0x9')]){throw new db[(_0x693e('0x1c'))][(_0x693e('0x25'))](_0x693e('0x28'));}_0x1fbcd8=_0x2c2406;var _0x129a75=[];_0x108ac2[_0x693e('0x41')](function(_0x234d23){_0x129a75[_0x693e('0x42')](checkTranscribeJob(_0x234d23,_0x44f45e,_0x1fbcd8));});return BPromise['all'](_0x129a75);})['catch'](function(_0x480702){if(_0x480702){if(!_0x480702[_0x693e('0x36')]||_0x480702[_0x693e('0x36')]!==_0x693e('0x37')){logger[_0x693e('0x38')](util[_0x693e('0x3a')](_0x480702,{'showHidden':![],'depth':null}));}}});}exports['start']=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0xf3aa=['sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','update','Sentiment','SentimentScore','Positive','Negative','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','language','catch','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','SequelizeValidationError','lodash','aws-sdk','request-promise','util','../../mysqldb','TranscribeService','Comprehend','substring','format','data1','data2','transcribeName','then','info','[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s','TranscriptionJobStatus','fileText','COMPLETED','TranscriptionJob','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','results','transcripts','length','transcript','tempSentiment','Sequelize','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentimentAccountId','bucket','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','Cloud\x20Provider\x20not\x20available','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0xf3aa,0xf1));var _0xaf3a=function(_0x482d73,_0x58f50c){_0x482d73=_0x482d73-0x0;var _0x5725bd=_0xf3aa[_0x482d73];return _0x5725bd;};var _=require(_0xaf3a('0x0'));var AWS=require(_0xaf3a('0x1'));var rp=require(_0xaf3a('0x2'));var util=require(_0xaf3a('0x3'));var BPromise=require('bluebird');var db=require(_0xaf3a('0x4'))['db'];var logger=require('../../config/logger')('transcribe');function getTranscriptionJob(_0x33b1f6,_0x1e1199,_0x2f62d2,_0x41395c){return new Promise(function(_0x3050e3,_0x141196){var _0xb009f0=new AWS[(_0xaf3a('0x5'))]({'accessKeyId':_0x1e1199,'secretAccessKey':_0x33b1f6,'region':_0x2f62d2});_0xb009f0['getTranscriptionJob']({'TranscriptionJobName':_0x41395c},function(_0x4e5041,_0x3c304e){if(_0x4e5041){return _0x141196(_0x4e5041);}else{return _0x3050e3(_0x3c304e);}});});}function sentiment(_0x3d4bd8,_0x2bfc6f,_0x499643,_0x4a490f,_0x2aeea3){return new Promise(function(_0x1eadef,_0x7ba7b0){var _0x1fe67f=new AWS[(_0xaf3a('0x6'))]({'accessKeyId':_0x2bfc6f,'secretAccessKey':_0x3d4bd8,'region':_0x499643});_0x1fe67f['detectSentiment']({'Text':_0x4a490f,'LanguageCode':_0x2aeea3[_0xaf3a('0x7')](0x0,0x2)},function(_0x3550ed,_0x4bd80c){if(_0x3550ed){return _0x7ba7b0(_0x3550ed);}else{return _0x1eadef(_0x4bd80c);}});});}function checkTranscribeJob(_0x3f5a7f,_0xc980d1,_0x1948c2){var _0x5cd95e;return new BPromise(function(_0x1111f8,_0x4439f6){logger['info'](util[_0xaf3a('0x8')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3f5a7f['id'],_0x3f5a7f['transcribeName']));return getTranscriptionJob(_0x1948c2[_0xaf3a('0x9')],_0x1948c2[_0xaf3a('0xa')],_0xc980d1['transcribeRegion'],_0x3f5a7f[_0xaf3a('0xb')])[_0xaf3a('0xc')](function(_0x48bc54){logger[_0xaf3a('0xd')](util[_0xaf3a('0x8')](_0xaf3a('0xe'),_0x3f5a7f['id'],_0x3f5a7f[_0xaf3a('0xb')],_0x48bc54['TranscriptionJob'][_0xaf3a('0xf')]));if(!_0x3f5a7f[_0xaf3a('0x10')]){switch(_0x48bc54['TranscriptionJob']['TranscriptionJobStatus']){case _0xaf3a('0x11'):var _0x4858df={'transcribeStatus':_0x48bc54[_0xaf3a('0x12')][_0xaf3a('0xf')],'fileUri':_0x48bc54[_0xaf3a('0x12')][_0xaf3a('0x13')][_0xaf3a('0x14')]};logger['info'](util[_0xaf3a('0x8')](_0xaf3a('0x15'),_0x3f5a7f['id']));return rp({'uri':_0x48bc54[_0xaf3a('0x12')][_0xaf3a('0x13')][_0xaf3a('0x14')],'json':!![]})[_0xaf3a('0xc')](function(_0x8878e3){logger[_0xaf3a('0xd')](util['format']('[RECORDING:%d]\x20Transcript\x20downloaded',_0x3f5a7f['id']));if(_0x8878e3&&_0x8878e3[_0xaf3a('0x16')]&&_0x8878e3[_0xaf3a('0x16')][_0xaf3a('0x17')]&&_0x8878e3['results'][_0xaf3a('0x17')][_0xaf3a('0x18')]){_0x4858df['fileText']='';for(var _0x2d3972=0x0;_0x2d3972<_0x8878e3[_0xaf3a('0x16')][_0xaf3a('0x17')][_0xaf3a('0x18')];_0x2d3972++){_0x4858df[_0xaf3a('0x10')]+=_0x8878e3[_0xaf3a('0x16')][_0xaf3a('0x17')][_0x2d3972][_0xaf3a('0x19')]+'';}}return _0x3f5a7f['update'](_0x4858df);})['then'](function(){logger['info'](util[_0xaf3a('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3f5a7f['id']));if(!_0x3f5a7f[_0xaf3a('0x1a')]){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))](_0xaf3a('0x1d'));}if(!_0xc980d1['sentiment']||!_0xc980d1[_0xaf3a('0x1e')]||!_0xc980d1['sentimentRegion']||!_0xc980d1['language']||!_0xc980d1[_0xaf3a('0x1f')]){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))](_0xaf3a('0x20'));}if(!_0x4858df[_0xaf3a('0x10')]){throw new Error(_0xaf3a('0x21'));}if(_0xc980d1[_0xaf3a('0x1e')]===_0x1948c2['id']){return _0x1948c2;}else{return db[_0xaf3a('0x22')][_0xaf3a('0x23')]({'where':{'id':_settings[_0xaf3a('0x1e')]}});}})[_0xaf3a('0xc')](function(_0x151d98){if(!_0x151d98){throw new db[(_0xaf3a('0x1b'))]['ValidationError'](_0xaf3a('0x24'));}if(!_0x151d98[_0xaf3a('0x9')]||!_0x151d98['data2']){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))](_0xaf3a('0x25'));}_0x5cd95e=_0x151d98;logger[_0xaf3a('0xd')](util[_0xaf3a('0x8')](_0xaf3a('0x26'),_0x3f5a7f['id']));return sentiment(_0x5cd95e[_0xaf3a('0x9')],_0x5cd95e[_0xaf3a('0xa')],_0xc980d1[_0xaf3a('0x27')],_0x4858df[_0xaf3a('0x10')],_0xc980d1['language']);})[_0xaf3a('0xc')](function(_0x124e72){logger[_0xaf3a('0xd')](util[_0xaf3a('0x8')](_0xaf3a('0x28'),_0x3f5a7f['id']));return _0x3f5a7f[_0xaf3a('0x29')]({'sentiment':_0x124e72[_0xaf3a('0x2a')],'sPositive':_0x124e72[_0xaf3a('0x2b')][_0xaf3a('0x2c')],'sNegative':_0x124e72[_0xaf3a('0x2b')][_0xaf3a('0x2d')],'sMixed':_0x124e72[_0xaf3a('0x2b')]['Mixed'],'sNeutral':_0x124e72[_0xaf3a('0x2b')]['Neutral']});})[_0xaf3a('0xc')](function(){logger[_0xaf3a('0xd')](util[_0xaf3a('0x8')](_0xaf3a('0x2e'),_0x3f5a7f['id']));_0x1111f8();});case _0xaf3a('0x2f'):return _0x3f5a7f[_0xaf3a('0x29')]({'transcribeStatus':_0xaf3a('0x2f'),'failureReason':_0x48bc54[_0xaf3a('0x12')][_0xaf3a('0x30')]})['then'](function(){logger[_0xaf3a('0xd')](util[_0xaf3a('0x8')](_0xaf3a('0x2e'),_0x3f5a7f['id']));_0x1111f8();});default:logger[_0xaf3a('0xd')](util['format'](_0xaf3a('0x31'),_0x3f5a7f['id']));break;}}else{return BPromise[_0xaf3a('0x32')]()[_0xaf3a('0xc')](function(){if(!_0x3f5a7f[_0xaf3a('0x1a')]){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))](_0xaf3a('0x1d'));}if(!_0xc980d1[_0xaf3a('0x33')]||!_0xc980d1['sentimentAccountId']||!_0xc980d1['sentimentRegion']||!_0xc980d1[_0xaf3a('0x34')]||!_0xc980d1['bucket']){throw new db['Sequelize'][(_0xaf3a('0x1c'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x3f5a7f[_0xaf3a('0x10')]){throw new Error(_0xaf3a('0x21'));}if(_0xc980d1[_0xaf3a('0x1e')]===_0x1948c2['id']){return _0x1948c2;}else{return db[_0xaf3a('0x22')]['findOne']({'where':{'id':_settings['sentimentAccountId']}});}})[_0xaf3a('0xc')](function(_0x505333){if(!_0x505333){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x505333[_0xaf3a('0x9')]||!_0x505333[_0xaf3a('0xa')]){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))](_0xaf3a('0x25'));}_0x5cd95e=_0x505333;logger[_0xaf3a('0xd')](util[_0xaf3a('0x8')](_0xaf3a('0x26'),_0x3f5a7f['id']));return sentiment(_0x5cd95e['data1'],_0x5cd95e[_0xaf3a('0xa')],_0xc980d1[_0xaf3a('0x27')],_0x3f5a7f['fileText'],_0xc980d1[_0xaf3a('0x34')]);})['then'](function(_0x2f4b33){logger['info'](util[_0xaf3a('0x8')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3f5a7f['id']));return _0x3f5a7f[_0xaf3a('0x29')]({'sentiment':_0x2f4b33[_0xaf3a('0x2a')],'sPositive':_0x2f4b33[_0xaf3a('0x2b')][_0xaf3a('0x2c')],'sNegative':_0x2f4b33[_0xaf3a('0x2b')][_0xaf3a('0x2d')],'sMixed':_0x2f4b33[_0xaf3a('0x2b')]['Mixed'],'sNeutral':_0x2f4b33['SentimentScore']['Neutral'],'transcribeStatus':_0xaf3a('0x11')});})['then'](function(){logger[_0xaf3a('0xd')](util[_0xaf3a('0x8')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3f5a7f['id']));_0x1111f8();});}})[_0xaf3a('0x35')](function(_0x2fa8c8){if(_0x2fa8c8){if(!_0x2fa8c8[_0xaf3a('0x36')]||_0x2fa8c8[_0xaf3a('0x36')]!=='SequelizeValidationError'){logger[_0xaf3a('0x37')](util[_0xaf3a('0x8')](_0xaf3a('0x38'),_0x3f5a7f['id']),util[_0xaf3a('0x39')](_0x2fa8c8,{'showHidden':![],'depth':null}));}}_0x1111f8();});});}function checkTranscribe(){var _0xc3551d;var _0x466d41;var _0x3616bf;return db[_0xaf3a('0x3a')][_0xaf3a('0x3b')]({'where':{'transcribeStatus':_0xaf3a('0x3c')}})[_0xaf3a('0xc')](function(_0x4705e3){if(!_0x4705e3||!_0x4705e3[_0xaf3a('0x18')]){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))](_0xaf3a('0x3d'));}_0xc3551d=_0x4705e3;return db[_0xaf3a('0x3e')][_0xaf3a('0x23')]({'where':{'id':0x1}});})['then'](function(_0x10cb74){if(!_0x10cb74){throw new db[(_0xaf3a('0x1b'))]['ValidationError'](_0xaf3a('0x3f'));}_0x466d41=_0x10cb74;if(!_0x466d41['transcribe']||!_0x466d41[_0xaf3a('0x40')]||!_0x466d41[_0xaf3a('0x41')]||!_0x466d41[_0xaf3a('0x34')]||!_0x466d41[_0xaf3a('0x1f')]){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))](_0xaf3a('0x42'));}return db[_0xaf3a('0x22')][_0xaf3a('0x23')]({'where':{'id':_0x466d41['transcribeAccountId']}});})[_0xaf3a('0xc')](function(_0x549502){if(!_0x549502){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))]('Cloud\x20Provider\x20not\x20available');}if(!_0x549502[_0xaf3a('0x9')]||!_0x549502[_0xaf3a('0xa')]){throw new db[(_0xaf3a('0x1b'))][(_0xaf3a('0x1c'))](_0xaf3a('0x25'));}_0x3616bf=_0x549502;var _0x3351c3=[];_0xc3551d[_0xaf3a('0x43')](function(_0x3cb7e1){_0x3351c3[_0xaf3a('0x44')](checkTranscribeJob(_0x3cb7e1,_0x466d41,_0x3616bf));});return BPromise['all'](_0x3351c3);})['catch'](function(_0x48f63e){if(_0x48f63e){if(!_0x48f63e[_0xaf3a('0x36')]||_0x48f63e['name']!==_0xaf3a('0x45')){logger[_0xaf3a('0x37')](util[_0xaf3a('0x39')](_0x48f63e,{'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 4772acd..42c7c20 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 _0x9158=['timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','lodash','ioredis','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','map','info','join','update'];(function(_0x3a9a3f,_0x4a7974){var _0x4964e5=function(_0x147d15){while(--_0x147d15){_0x3a9a3f['push'](_0x3a9a3f['shift']());}};_0x4964e5(++_0x4a7974);}(_0x9158,0xe9));var _0x8915=function(_0x43de85,_0x1e437f){_0x43de85=_0x43de85-0x0;var _0x100ed6=_0x9158[_0x43de85];return _0x100ed6;};'use strict';var _=require(_0x8915('0x0'));var moment=require('moment');var Redis=require(_0x8915('0x1'));var util=require('util');var config=require(_0x8915('0x2'));var db=require(_0x8915('0x3'))['db'];var logger=require('../logger')(_0x8915('0x4'));config[_0x8915('0x5')]=_['defaults'](config[_0x8915('0x5')],{'host':_0x8915('0x6'),'port':0x18eb});var io=require(_0x8915('0x7'))(new Redis(config[_0x8915('0x5')]));function closeInteractions(){var _0x500945=[];return db[_0x8915('0x8')][_0x8915('0x9')]({'raw':!![],'attributes':['id',_0x8915('0xa')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8915('0xb')](0x18,_0x8915('0xc'))}}})[_0x8915('0xd')](function(_0x574256){if(_0x574256&&_0x574256[_0x8915('0xe')]){_0x500945=_[_0x8915('0xf')](_0x574256||[],'id');logger[_0x8915('0x10')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x500945[_0x8915('0x11')]());return db[_0x8915('0x8')][_0x8915('0x12')]({'closeReason':'system','disposition':_0x8915('0x13'),'closed':!![],'closedAt':moment()['format'](_0x8915('0x14'))},{'where':{'id':_0x500945}});}})[_0x8915('0xd')](function(){if(_0x500945&&_0x500945['length']){logger[_0x8915('0x10')](_0x8915('0x15'),_0x500945[_0x8915('0x11')]());for(var _0x4d2c83=0x0;_0x4d2c83<_0x500945['length'];_0x4d2c83++){io[_0x8915('0x16')](_0x8915('0x17'),{'id':_0x500945[_0x4d2c83],'closed':!![]});}}})['catch'](function(_0x256c0a){logger[_0x8915('0x18')](_0x8915('0x19'),_0x256c0a?util[_0x8915('0x1a')](_0x256c0a,{'showHidden':![],'depth':null}):'');});}exports[_0x8915('0x1b')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x274e=['YYYY-MM-DD\x20HH:mm:ss','then','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','start','lodash','moment','ioredis','util','../../config/environment','../logger','schedule','redis','defaults','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','length','map','info','update','system','timeout','format'];(function(_0x3167b1,_0x5ad266){var _0x362152=function(_0xc49d4a){while(--_0xc49d4a){_0x3167b1['push'](_0x3167b1['shift']());}};_0x362152(++_0x5ad266);}(_0x274e,0x100));var _0xe274=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x274e[_0xdea41a];return _0x15d0d8;};'use strict';var _=require(_0xe274('0x0'));var moment=require(_0xe274('0x1'));var Redis=require(_0xe274('0x2'));var util=require(_0xe274('0x3'));var config=require(_0xe274('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0xe274('0x5'))(_0xe274('0x6'));config[_0xe274('0x7')]=_[_0xe274('0x8')](config[_0xe274('0x7')],{'host':_0xe274('0x9'),'port':0x18eb});var io=require(_0xe274('0xa'))(new Redis(config['redis']));function closeInteractions(){var _0x4c61a8=[];return db[_0xe274('0xb')][_0xe274('0xc')]({'raw':!![],'attributes':['id',_0xe274('0xd')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xe274('0xe')](0x18,_0xe274('0xf'))}}})['then'](function(_0x432843){if(_0x432843&&_0x432843[_0xe274('0x10')]){_0x4c61a8=_[_0xe274('0x11')](_0x432843||[],'id');logger[_0xe274('0x12')]('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x4c61a8['join']());return db[_0xe274('0xb')][_0xe274('0x13')]({'closeReason':_0xe274('0x14'),'disposition':_0xe274('0x15'),'closed':!![],'closedAt':moment()[_0xe274('0x16')](_0xe274('0x17'))},{'where':{'id':_0x4c61a8}});}})[_0xe274('0x18')](function(){if(_0x4c61a8&&_0x4c61a8['length']){logger[_0xe274('0x12')](_0xe274('0x19'),_0x4c61a8['join']());for(var _0x82fc0c=0x0;_0x82fc0c<_0x4c61a8['length'];_0x82fc0c++){io[_0xe274('0x1a')](_0xe274('0x1b'),{'id':_0x4c61a8[_0x82fc0c],'closed':!![]});}}})[_0xe274('0x1c')](function(_0x35b17b){logger[_0xe274('0x1d')]('[WHATSAPP]\x20Error\x20closing\x20interactions',_0x35b17b?util['inspect'](_0x35b17b,{'showHidden':![],'depth':null}):'');});}exports[_0xe274('0x1e')]=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 a30ae66..8bd7a00 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x58b9=['Biondo','innocenzo.biondo','@xcally.com','now','Innocenzo','CmContact','destroy','then','bulkCreate','log','contacts1','CmHopper','finished\x20populating','hopper1','contacts2','catch','../mysqldb','push'];(function(_0x172747,_0x1732bd){var _0x509692=function(_0x448c56){while(--_0x448c56){_0x172747['push'](_0x172747['shift']());}};_0x509692(++_0x1732bd);}(_0x58b9,0x130));var _0x958b=function(_0x4874c1,_0x579a96){_0x4874c1=_0x4874c1-0x0;var _0x47b8b6=_0x58b9[_0x4874c1];return _0x47b8b6;};'use strict';var util=require('util');var db=require(_0x958b('0x0'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0x958b('0x1')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0x958b('0x2')+i,'phone':0xf879fb460+i,'email':_0x958b('0x3')+i+_0x958b('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x958b('0x5')](),'updatedAt':Date[_0x958b('0x5')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0x958b('0x1')]({'id':i,'firstName':_0x958b('0x6')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':'innocenzo.biondo'+i+_0x958b('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0x958b('0x5')](),'updatedAt':Date[_0x958b('0x5')]()});}db[_0x958b('0x7')][_0x958b('0x8')]({'where':{}})[_0x958b('0x9')](function(){return db[_0x958b('0x7')][_0x958b('0xa')](contacts);})['then'](function(){console[_0x958b('0xb')]('finished\x20populating',_0x958b('0xc'));return db['CmHopper'][_0x958b('0x8')]({'where':{}});})[_0x958b('0x9')](function(){return db[_0x958b('0xd')]['bulkCreate'](hopper);})[_0x958b('0x9')](function(){console[_0x958b('0xb')](_0x958b('0xe'),_0x958b('0xf'));return db[_0x958b('0x7')][_0x958b('0xa')](contacts2);})[_0x958b('0x9')](function(){console[_0x958b('0xb')](_0x958b('0xe'),_0x958b('0x10'));return db['CmHopper'][_0x958b('0xa')](hopper2);})[_0x958b('0x9')](function(){console[_0x958b('0xb')](_0x958b('0xe'),'hopper2');})[_0x958b('0x11')](function(_0x59b498){console['log'](_0x59b498);}); \ No newline at end of file +var _0xa51a=['log','CmHopper','hopper1','contacts2','finished\x20populating','hopper2','catch','util','../mysqldb','push','Innocenzo','innocenzo.biondo','@xcally.com','now','Biondo','CmContact','destroy','then','bulkCreate'];(function(_0x49d105,_0x509486){var _0x5449e1=function(_0xf7d17){while(--_0xf7d17){_0x49d105['push'](_0x49d105['shift']());}};_0x5449e1(++_0x509486);}(_0xa51a,0x170));var _0xaa51=function(_0x24259d,_0x64a194){_0x24259d=_0x24259d-0x0;var _0x5a701=_0xa51a[_0x24259d];return _0x5a701;};'use strict';var util=require(_0xaa51('0x0'));var db=require(_0xaa51('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xaa51('0x2')]({'id':i,'firstName':_0xaa51('0x3')+i,'lastName':'Biondo'+i,'phone':0xf879fb460+i,'email':_0xaa51('0x4')+i+_0xaa51('0x5')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xaa51('0x2')]({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaa51('0x6')](),'updatedAt':Date[_0xaa51('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xaa51('0x2')]({'id':i,'firstName':_0xaa51('0x3')+i,'lastName':_0xaa51('0x7')+i,'phone':0xf879fb460+i,'email':_0xaa51('0x4')+i+_0xaa51('0x5')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2['push']({'id':i,'active':![],'scheduledat':Date['now'](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xaa51('0x6')](),'updatedAt':Date['now']()});}db[_0xaa51('0x8')][_0xaa51('0x9')]({'where':{}})[_0xaa51('0xa')](function(){return db[_0xaa51('0x8')][_0xaa51('0xb')](contacts);})[_0xaa51('0xa')](function(){console[_0xaa51('0xc')]('finished\x20populating','contacts1');return db['CmHopper'][_0xaa51('0x9')]({'where':{}});})[_0xaa51('0xa')](function(){return db[_0xaa51('0xd')][_0xaa51('0xb')](hopper);})[_0xaa51('0xa')](function(){console[_0xaa51('0xc')]('finished\x20populating',_0xaa51('0xe'));return db[_0xaa51('0x8')]['bulkCreate'](contacts2);})[_0xaa51('0xa')](function(){console[_0xaa51('0xc')]('finished\x20populating',_0xaa51('0xf'));return db[_0xaa51('0xd')][_0xaa51('0xb')](hopper2);})['then'](function(){console[_0xaa51('0xc')](_0xaa51('0x10'),_0xaa51('0x11'));})[_0xaa51('0x12')](function(_0x5d7f46){console[_0xaa51('0xc')](_0x5d7f46);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 50ea148..81f9056 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x94af=['\x22%s\x22\x20<%s>','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','friend','udp','wss','all','yes','/etc/pki/tls/private/motion.key','actpass'];(function(_0x4653f7,_0x3d3ae3){var _0x5454da=function(_0x448f55){while(--_0x448f55){_0x4653f7['push'](_0x4653f7['shift']());}};_0x5454da(++_0x3d3ae3);}(_0x94af,0x1ab));var _0xf94a=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0x94af[_0x220dbb];return _0x2b77de;};'use strict';var util=require(_0xf94a('0x0'));var db=require(_0xf94a('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0xf94a('0x2')]({'name':util[_0xf94a('0x3')](_0xf94a('0x4'),_0xf94a('0x5'),i),'fullname':util['format'](_0xf94a('0x4'),'agent',i),'email':util[_0xf94a('0x3')](_0xf94a('0x6'),_0xf94a('0x5'),i),'role':_0xf94a('0x5'),'password':'password','internal':0xfa0+i,'type':_0xf94a('0x7'),'transport':[_0xf94a('0x8'),'ws',_0xf94a('0x9')],'disallow':[_0xf94a('0xa')],'allow':['ulaw'],'defaultuser':util['format'](_0xf94a('0x4'),'agent',i),'encryption':_0xf94a('0xb'),'avpf':_0xf94a('0xb'),'force_avp':'yes','icesupport':_0xf94a('0xb'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':'/etc/pki/tls/certs/motion.crt','dtlsprivatekey':_0xf94a('0xc'),'dtlssetup':_0xf94a('0xd'),'callerid':util['format'](_0xf94a('0xe'),util[_0xf94a('0x3')](_0xf94a('0x4'),_0xf94a('0x5'),i),0xfa0+i)});}db[_0xf94a('0xf')][_0xf94a('0x10')](users)[_0xf94a('0x11')](function(){console[_0xf94a('0x12')](_0xf94a('0x13'));})[_0xf94a('0x14')](function(_0x9891c3){console['log'](_0x9891c3);}); \ No newline at end of file +var _0x2813=['%s%s','agent','udp','wss','ulaw','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','log','add\x20user','catch','util','../mysqldb','push','format'];(function(_0x5f0968,_0x31fb3){var _0x2f66f8=function(_0x507afb){while(--_0x507afb){_0x5f0968['push'](_0x5f0968['shift']());}};_0x2f66f8(++_0x31fb3);}(_0x2813,0xe6));var _0x3281=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2813[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x3281('0x0'));var db=require(_0x3281('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x3281('0x2')]({'name':util[_0x3281('0x3')](_0x3281('0x4'),_0x3281('0x5'),i),'fullname':util['format'](_0x3281('0x4'),_0x3281('0x5'),i),'email':util[_0x3281('0x3')]('%s%s@xcally.com',_0x3281('0x5'),i),'role':_0x3281('0x5'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0x3281('0x6'),'ws',_0x3281('0x7')],'disallow':['all'],'allow':[_0x3281('0x8')],'defaultuser':util[_0x3281('0x3')](_0x3281('0x4'),_0x3281('0x5'),i),'encryption':_0x3281('0x9'),'avpf':'yes','force_avp':'yes','icesupport':'yes','dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x3281('0xa'),'dtlsprivatekey':_0x3281('0xb'),'dtlssetup':_0x3281('0xc'),'callerid':util[_0x3281('0x3')]('\x22%s\x22\x20<%s>',util['format'](_0x3281('0x4'),_0x3281('0x5'),i),0xfa0+i)});}db[_0x3281('0xd')][_0x3281('0xe')](users)['then'](function(){console[_0x3281('0xf')](_0x3281('0x10'));})[_0x3281('0x11')](function(_0x5b3156){console[_0x3281('0xf')](_0x5b3156);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index e23a8b5..899d9e2 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xceef=['SmsQueue','OpenchannelQueue','WhatsappQueue','Trunk','voice:inbound','MailQueue','getVoiceQueues','getChatQueues','getFaxQueues','getSmsQueues','getOpenchannelQueues','all','chat','fax','sms','openchannel','telephone:%s','trunk:%s','campaign:%s:%s','type','leave','map','ChatInteractions','removeChatInteractions','user_has_chat_interactions:remove','removeMailInteractions','emit','user_has_mail_interactions:remove','removeFaxInteractions','user_has_fax_interactions:remove','removeSmsInteractions','user_has_sms_interactions:remove','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','SocketIO\x20','DISCONNECTED','CONNECTED','bluebird','../mysqldb','name','User','agent','UserProfileSection','findOne','then','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','UserProfileResource','resourceId','where','telephone','Campaign','ivr','format','%s:queue:%s','Agents','length','handshake','query','find','role','userProfileId','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','OpenchannelInteractions','WhatsappInteraction','WhatsappInteractions','user:%s','admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue'];(function(_0xc9a251,_0x52dac8){var _0x563b44=function(_0x3d3225){while(--_0x3d3225){_0xc9a251['push'](_0xc9a251['shift']());}};_0x563b44(++_0x52dac8);}(_0xceef,0xf6));var _0xfcee=function(_0x434d68,_0xcbdfed){_0x434d68=_0x434d68-0x0;var _0x56f3ce=_0xceef[_0x434d68];return _0x56f3ce;};'use strict';var _=require('lodash');var util=require('util');var BPromise=require(_0xfcee('0x0'));var db=require(_0xfcee('0x1'))['db'];var config=require('./environment');var queryQueues={'attributes':['id',_0xfcee('0x2')],'include':[{'as':'Agents','model':db[_0xfcee('0x3')],'attributes':['id',_0xfcee('0x2'),'role'],'raw':!![],'where':{'role':_0xfcee('0x4')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0xfcee('0x2')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0xfcee('0x2')],'where':{'role':_0xfcee('0x4')}};var queryCampaigns={'raw':!![],'attributes':['id',_0xfcee('0x2'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x2f8ae6,_0xe4c6a7,_0xcea858){return db[_0xfcee('0x5')][_0xfcee('0x6')]({'where':{'name':_0x2f8ae6,'userProfileId':_0xe4c6a7},'raw':!![]})[_0xfcee('0x7')](function(_0x3d58c5){if(_0x3d58c5){if(_0x3d58c5['autoAssociation']){switch(_0x2f8ae6){case _0xfcee('0x8'):case _0xfcee('0x9'):case _0xfcee('0xa'):case _0xfcee('0xb'):case _0xfcee('0xc'):case _0xfcee('0xd'):case _0xfcee('0xe'):return db[_0xcea858][_0xfcee('0xf')](queryQueues);case _0xfcee('0x10'):return db[_0xcea858]['findAll'](queryTelephones);case _0xfcee('0x11'):return db[_0xcea858][_0xfcee('0xf')](queryTrunks);case'IvrCampaigns':return db[_0xcea858]['findAll'](queryCampaigns);}}else{return db[_0xfcee('0x12')][_0xfcee('0xf')]({'attributes':[_0xfcee('0x13')],'where':{'sectionId':_0x3d58c5['id']},'raw':!![]})[_0xfcee('0x7')](function(_0x264bed){if(_0x264bed){var _0x2dded0={'where':{'id':_['map'](_0x264bed,_0xfcee('0x13'))},'raw':!![]};switch(_0xcea858){case _0xfcee('0x3'):_0x2dded0[_0xfcee('0x14')]['role']=_0xfcee('0x15');break;case _0xfcee('0x16'):_0x2dded0[_0xfcee('0x14')]['type']=_0xfcee('0x17');break;}return db[_0xcea858][_0xfcee('0xf')](_0x2dded0);}else{return[];}});}}else{return[];}})[_0xfcee('0x7')](function(_0x3edc67){return _0x3edc67;});}function joinOrLeaveQueues(_0x50ae0e,_0x50bbb5,_0x130b96,_0x2cabf7){_0x50ae0e[_0x50bbb5](util[_0xfcee('0x18')](_0xfcee('0x19'),_0x130b96,_0x2cabf7[_0xfcee('0x2')]));if(_0x2cabf7[_0xfcee('0x1a')]){for(var _0x13d08d=0x0;_0x13d08d<_0x2cabf7['Agents'][_0xfcee('0x1b')];_0x13d08d+=0x1){_0x50ae0e[_0x50bbb5](util['format']('user:%s',_0x2cabf7[_0xfcee('0x1a')][_0x13d08d][_0xfcee('0x2')]));}}}function joinOrLeave(_0x2d68d8,_0xaef3e6,_0x4fb8cb){var _0x463df4;if(_0x2d68d8[_0xfcee('0x1c')][_0xfcee('0x1d')]['id']){db[_0xfcee('0x3')][_0xfcee('0x1e')]({'attributes':['id',_0xfcee('0x2'),_0xfcee('0x1f'),_0xfcee('0x20')],'where':{'id':_0x2d68d8[_0xfcee('0x1c')][_0xfcee('0x1d')]['id']},'include':[{'model':db['ChatInteraction'],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db['MailInteraction'],'as':_0xfcee('0x21'),'attributes':['id'],'raw':!![]},{'model':db[_0xfcee('0x22')],'as':_0xfcee('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0xfcee('0x24')],'as':_0xfcee('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0xfcee('0x26')],'as':_0xfcee('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0xfcee('0x28')],'as':_0xfcee('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2dc32){if(_0x2dc32){_0x463df4=_0x2dc32;_0x2d68d8[_0xaef3e6](util[_0xfcee('0x18')](_0xfcee('0x2a'),_0x2dc32[_0xfcee('0x2')]));var _0x235d7f=[];switch(_0x2dc32[_0xfcee('0x1f')]){case _0xfcee('0x2b'):_0x2d68d8[_0xaef3e6]('voice:inbound');_0x2d68d8[_0xaef3e6](_0xfcee('0x2c'));if(queryQueues[_0xfcee('0x2d')](_0xfcee('0x2e'))){delete queryQueues[_0xfcee('0x2e')];}_0x235d7f[_0xfcee('0x2f')](db[_0xfcee('0x30')][_0xfcee('0xf')](queryQueues));_0x235d7f[_0xfcee('0x2f')](db[_0xfcee('0x31')][_0xfcee('0xf')](queryQueues));_0x235d7f['push'](db[_0xfcee('0x32')]['findAll'](queryQueues));_0x235d7f[_0xfcee('0x2f')](db[_0xfcee('0x33')][_0xfcee('0xf')](queryQueues));_0x235d7f['push'](db['MailQueue'][_0xfcee('0xf')](queryQueues));_0x235d7f['push'](db[_0xfcee('0x34')][_0xfcee('0xf')](queryQueues));_0x235d7f[_0xfcee('0x2f')](db[_0xfcee('0x35')][_0xfcee('0xf')](queryQueues));_0x235d7f[_0xfcee('0x2f')](db[_0xfcee('0x3')]['findAll'](queryTelephones));_0x235d7f['push'](db[_0xfcee('0x36')]['findAll'](queryTrunks));_0x235d7f[_0xfcee('0x2f')](db[_0xfcee('0x16')][_0xfcee('0xf')](queryCampaigns));_0x235d7f[_0xfcee('0x2f')](db[_0xfcee('0x3')]['findAll'](queryAgents));break;case'user':_0x2d68d8[_0xaef3e6](_0xfcee('0x37'));_0x2d68d8[_0xaef3e6](_0xfcee('0x2c'));_0x235d7f[_0xfcee('0x2f')](getAssociatedResources(_0xfcee('0x8'),_0x2dc32[_0xfcee('0x20')],_0xfcee('0x30')));_0x235d7f[_0xfcee('0x2f')](getAssociatedResources('ChatQueues',_0x2dc32['userProfileId'],_0xfcee('0x31')));_0x235d7f[_0xfcee('0x2f')](getAssociatedResources('FaxQueues',_0x2dc32['userProfileId'],_0xfcee('0x32')));_0x235d7f[_0xfcee('0x2f')](getAssociatedResources(_0xfcee('0xb'),_0x2dc32[_0xfcee('0x20')],_0xfcee('0x33')));_0x235d7f[_0xfcee('0x2f')](getAssociatedResources('MailQueues',_0x2dc32[_0xfcee('0x20')],_0xfcee('0x38')));_0x235d7f[_0xfcee('0x2f')](getAssociatedResources(_0xfcee('0xd'),_0x2dc32[_0xfcee('0x20')],_0xfcee('0x34')));_0x235d7f['push'](getAssociatedResources('WhatsappQueues',_0x2dc32[_0xfcee('0x20')],_0xfcee('0x35')));_0x235d7f[_0xfcee('0x2f')](getAssociatedResources(_0xfcee('0x10'),_0x2dc32['userProfileId'],_0xfcee('0x3')));_0x235d7f[_0xfcee('0x2f')](getAssociatedResources(_0xfcee('0x11'),_0x2dc32[_0xfcee('0x20')],_0xfcee('0x36')));_0x235d7f[_0xfcee('0x2f')](getAssociatedResources('IvrCampaigns',_0x2dc32[_0xfcee('0x20')],_0xfcee('0x16')));_0x235d7f['push'](db[_0xfcee('0x3')][_0xfcee('0xf')](queryAgents));break;case _0xfcee('0x4'):_0x2d68d8[_0xaef3e6]('voice:inbound');_0x2d68d8[_0xaef3e6](_0xfcee('0x2c'));_0x235d7f[_0xfcee('0x2f')](_0x2dc32[_0xfcee('0x39')]({'attributes':['id','name']}));_0x235d7f[_0xfcee('0x2f')](_0x2dc32[_0xfcee('0x3a')]({'attributes':['id',_0xfcee('0x2')]}));_0x235d7f[_0xfcee('0x2f')](_0x2dc32[_0xfcee('0x3b')]({'attributes':['id','name']}));_0x235d7f['push'](_0x2dc32[_0xfcee('0x3c')]({'attributes':['id','name']}));_0x235d7f[_0xfcee('0x2f')](_0x2dc32['getMailQueues']({'attributes':['id',_0xfcee('0x2')]}));_0x235d7f[_0xfcee('0x2f')](_0x2dc32[_0xfcee('0x3d')]({'attributes':['id',_0xfcee('0x2')]}));_0x235d7f[_0xfcee('0x2f')](_0x2dc32['getWhatsappQueues']({'attributes':['id',_0xfcee('0x2')]}));break;}return BPromise[_0xfcee('0x3e')](_0x235d7f);}})['then'](function(_0x15828c){if(_0x15828c&&_0x15828c[_0xfcee('0x1b')]){for(var _0x4553d6=0x0;_0x4553d6<_0x15828c[_0xfcee('0x1b')];_0x4553d6+=0x1){for(var _0x5b3d3b=0x0;_0x5b3d3b<_0x15828c[_0x4553d6][_0xfcee('0x1b')];_0x5b3d3b+=0x1){switch(_0x4553d6){case 0x0:joinOrLeaveQueues(_0x2d68d8,_0xaef3e6,'voice',_0x15828c[_0x4553d6][_0x5b3d3b]);break;case 0x1:joinOrLeaveQueues(_0x2d68d8,_0xaef3e6,_0xfcee('0x3f'),_0x15828c[_0x4553d6][_0x5b3d3b]);break;case 0x2:joinOrLeaveQueues(_0x2d68d8,_0xaef3e6,_0xfcee('0x40'),_0x15828c[_0x4553d6][_0x5b3d3b]);break;case 0x3:joinOrLeaveQueues(_0x2d68d8,_0xaef3e6,_0xfcee('0x41'),_0x15828c[_0x4553d6][_0x5b3d3b]);break;case 0x4:joinOrLeaveQueues(_0x2d68d8,_0xaef3e6,'mail',_0x15828c[_0x4553d6][_0x5b3d3b]);break;case 0x5:joinOrLeaveQueues(_0x2d68d8,_0xaef3e6,_0xfcee('0x42'),_0x15828c[_0x4553d6][_0x5b3d3b]);break;case 0x6:joinOrLeaveQueues(_0x2d68d8,_0xaef3e6,'whatsapp',_0x15828c[_0x4553d6][_0x5b3d3b]);break;case 0x7:if(_0x463df4[_0xfcee('0x1f')]!==_0xfcee('0x4'))_0x2d68d8[_0xaef3e6](util[_0xfcee('0x18')](_0xfcee('0x43'),_0x15828c[_0x4553d6][_0x5b3d3b][_0xfcee('0x2')]));break;case 0x8:if(_0x463df4['role']!==_0xfcee('0x4'))_0x2d68d8[_0xaef3e6](util['format'](_0xfcee('0x44'),_0x15828c[_0x4553d6][_0x5b3d3b]['name']));break;case 0x9:if(_0x463df4['role']!==_0xfcee('0x4'))_0x2d68d8[_0xaef3e6](util[_0xfcee('0x18')](_0xfcee('0x45'),_0x15828c[_0x4553d6][_0x5b3d3b][_0xfcee('0x46')],_0x15828c[_0x4553d6][_0x5b3d3b]['name']));break;case 0xa:_0x2d68d8[_0xaef3e6](util[_0xfcee('0x18')](_0xfcee('0x2a'),_0x15828c[_0x4553d6][_0x5b3d3b][_0xfcee('0x2')]));break;}}}}})['then'](function(){if(_0xaef3e6===_0xfcee('0x47')){var _0x39f8ee=_[_0xfcee('0x48')](_0x463df4[_0xfcee('0x49')],'id');return _0x463df4[_0xfcee('0x4a')](_0x39f8ee)[_0xfcee('0x7')](function(){for(var _0x217c9e=0x0;_0x217c9e<_0x39f8ee[_0xfcee('0x1b')];_0x217c9e+=0x1){_0x4fb8cb['emit'](_0xfcee('0x4b'),{'ChatInteractionId':Number(_0x39f8ee[_0x217c9e]),'UserId':Number(_0x463df4['id'])});}});}})[_0xfcee('0x7')](function(){if(_0xaef3e6===_0xfcee('0x47')){var _0x496bb5=_[_0xfcee('0x48')](_0x463df4[_0xfcee('0x21')],'id');return _0x463df4[_0xfcee('0x4c')](_0x496bb5)[_0xfcee('0x7')](function(){for(var _0x1bc1c9=0x0;_0x1bc1c9<_0x496bb5['length'];_0x1bc1c9+=0x1){_0x4fb8cb[_0xfcee('0x4d')](_0xfcee('0x4e'),{'MailInteractionId':Number(_0x496bb5[_0x1bc1c9]),'UserId':Number(_0x463df4['id'])});}});}})[_0xfcee('0x7')](function(){if(_0xaef3e6===_0xfcee('0x47')){var _0xc5ac80=_[_0xfcee('0x48')](_0x463df4[_0xfcee('0x23')],'id');return _0x463df4[_0xfcee('0x4f')](_0xc5ac80)[_0xfcee('0x7')](function(){for(var _0x17a564=0x0;_0x17a564<_0xc5ac80[_0xfcee('0x1b')];_0x17a564+=0x1){_0x4fb8cb[_0xfcee('0x4d')](_0xfcee('0x50'),{'FaxInteractionId':Number(_0xc5ac80[_0x17a564]),'UserId':Number(_0x463df4['id'])});}});}})[_0xfcee('0x7')](function(){if(_0xaef3e6===_0xfcee('0x47')){var _0x3571ea=_['map'](_0x463df4[_0xfcee('0x25')],'id');return _0x463df4[_0xfcee('0x51')](_0x3571ea)[_0xfcee('0x7')](function(){for(var _0x9955da=0x0;_0x9955da<_0x3571ea[_0xfcee('0x1b')];_0x9955da+=0x1){_0x4fb8cb[_0xfcee('0x4d')](_0xfcee('0x52'),{'SmsInteractionId':Number(_0x3571ea[_0x9955da]),'UserId':Number(_0x463df4['id'])});}});}})['then'](function(){if(_0xaef3e6===_0xfcee('0x47')){var _0x1981fc=_['map'](_0x463df4[_0xfcee('0x27')],'id');return _0x463df4['removeOpenchannelInteractions'](_0x1981fc)[_0xfcee('0x7')](function(){for(var _0x33eb00=0x0;_0x33eb00<_0x1981fc[_0xfcee('0x1b')];_0x33eb00+=0x1){_0x4fb8cb[_0xfcee('0x4d')](_0xfcee('0x53'),{'OpenchannelInteractionId':Number(_0x1981fc[_0x33eb00]),'UserId':Number(_0x463df4['id'])});}});}})['then'](function(){if(_0xaef3e6==='leave'){var _0x13d3eb=_[_0xfcee('0x48')](_0x463df4[_0xfcee('0x29')],'id');return _0x463df4[_0xfcee('0x54')](_0x13d3eb)['then'](function(){for(var _0x38f439=0x0;_0x38f439<_0x13d3eb[_0xfcee('0x1b')];_0x38f439+=0x1){_0x4fb8cb[_0xfcee('0x4d')](_0xfcee('0x55'),{'WhatsappInteractionId':Number(_0x13d3eb[_0x38f439]),'UserId':Number(_0x463df4['id'])});}});}})[_0xfcee('0x56')](function(_0x1b6dbe){_0x2d68d8[_0xfcee('0x57')](_0x1b6dbe);});}}function onDisconnect(_0x2283f3,_0x32b86a){joinOrLeave(_0x2283f3,_0xfcee('0x47'),_0x32b86a);}function onConnect(_0x226817){joinOrLeave(_0x226817,_0xfcee('0x58'));}exports['default']=function(_0x2ad182){_0x2ad182['on']('connection',function(_0x2c4a65){_0x2c4a65[_0xfcee('0x59')](0x0);_0x2c4a65[_0xfcee('0x5a')]=_0x2c4a65[_0xfcee('0x5b')][_0xfcee('0x5c')][_0xfcee('0x5d')]+':'+_0x2c4a65['request'][_0xfcee('0x5c')][_0xfcee('0x5e')];_0x2c4a65[_0xfcee('0x5f')]=new Date();_0x2c4a65[_0xfcee('0x57')]=function(_0x4a2bfd){console[_0xfcee('0x57')](_0xfcee('0x60')+_0x2c4a65['nsp']['name']+'['+_0x2c4a65[_0xfcee('0x5a')]+']',_0x4a2bfd);};_0x2c4a65['on']('disconnect',function(){onDisconnect(_0x2c4a65,_0x2ad182);_0x2c4a65[_0xfcee('0x57')](_0xfcee('0x61'));});onConnect(_0x2c4a65);_0x2c4a65[_0xfcee('0x57')](_0xfcee('0x62'));});}; \ No newline at end of file +var _0xcd40=['admin','voice:outbound','hasOwnProperty','include','push','VoiceQueue','ChatQueue','FaxQueue','SmsQueue','WhatsappQueue','Trunk','user','VoiceQueues','userProfileId','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueue','voice:inbound','getVoiceQueues','getChatQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','mail','openchannel','whatsapp','trunk:%s','type','leave','ChatInteractions','user_has_chat_interactions:remove','MailInteractions','emit','removeFaxInteractions','user_has_fax_interactions:remove','SmsInteractions','removeSmsInteractions','user_has_sms_interactions:remove','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','WhatsappInteractions','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','log','join','connection','setMaxListeners','request','remoteAddress','nsp','address','DISCONNECTED','lodash','util','bluebird','./environment','name','Agents','User','role','agent','ivr','UserProfileSection','findOne','then','autoAssociation','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','map','where','telephone','Campaign','format','length','user:%s','handshake','query','find','ChatInteraction','MailInteraction','FaxInteraction','FaxInteractions','SmsInteraction','OpenchannelInteraction','OpenchannelInteractions'];(function(_0x3d21f3,_0xf21aee){var _0x288b7c=function(_0x431523){while(--_0x431523){_0x3d21f3['push'](_0x3d21f3['shift']());}};_0x288b7c(++_0xf21aee);}(_0xcd40,0x101));var _0x0cd4=function(_0x22d334,_0x57f1e6){_0x22d334=_0x22d334-0x0;var _0x52d3d4=_0xcd40[_0x22d334];return _0x52d3d4;};'use strict';var _=require(_0x0cd4('0x0'));var util=require(_0x0cd4('0x1'));var BPromise=require(_0x0cd4('0x2'));var db=require('../mysqldb')['db'];var config=require(_0x0cd4('0x3'));var queryQueues={'attributes':['id',_0x0cd4('0x4')],'include':[{'as':_0x0cd4('0x5'),'model':db[_0x0cd4('0x6')],'attributes':['id','name',_0x0cd4('0x7')],'raw':!![],'where':{'role':_0x0cd4('0x8')},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x0cd4('0x4')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id',_0x0cd4('0x4')]};var queryAgents={'raw':!![],'attributes':['id','name'],'where':{'role':_0x0cd4('0x8')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x0cd4('0x4'),'type'],'where':{'type':_0x0cd4('0x9')}};function getAssociatedResources(_0x4a7688,_0x241c46,_0x5bff93){return db[_0x0cd4('0xa')][_0x0cd4('0xb')]({'where':{'name':_0x4a7688,'userProfileId':_0x241c46},'raw':!![]})[_0x0cd4('0xc')](function(_0x292639){if(_0x292639){if(_0x292639[_0x0cd4('0xd')]){switch(_0x4a7688){case'VoiceQueues':case'ChatQueues':case'FaxQueues':case'SmsQueues':case _0x0cd4('0xe'):case _0x0cd4('0xf'):case _0x0cd4('0x10'):return db[_0x5bff93][_0x0cd4('0x11')](queryQueues);case _0x0cd4('0x12'):return db[_0x5bff93]['findAll'](queryTelephones);case _0x0cd4('0x13'):return db[_0x5bff93]['findAll'](queryTrunks);case _0x0cd4('0x14'):return db[_0x5bff93][_0x0cd4('0x11')](queryCampaigns);}}else{return db[_0x0cd4('0x15')][_0x0cd4('0x11')]({'attributes':[_0x0cd4('0x16')],'where':{'sectionId':_0x292639['id']},'raw':!![]})[_0x0cd4('0xc')](function(_0x4fe84a){if(_0x4fe84a){var _0x5dcad7={'where':{'id':_[_0x0cd4('0x17')](_0x4fe84a,_0x0cd4('0x16'))},'raw':!![]};switch(_0x5bff93){case'User':_0x5dcad7[_0x0cd4('0x18')]['role']=_0x0cd4('0x19');break;case _0x0cd4('0x1a'):_0x5dcad7[_0x0cd4('0x18')]['type']=_0x0cd4('0x9');break;}return db[_0x5bff93]['findAll'](_0x5dcad7);}else{return[];}});}}else{return[];}})['then'](function(_0x258ba1){return _0x258ba1;});}function joinOrLeaveQueues(_0x286637,_0x14a2c9,_0x316f5a,_0x231d95){_0x286637[_0x14a2c9](util[_0x0cd4('0x1b')]('%s:queue:%s',_0x316f5a,_0x231d95[_0x0cd4('0x4')]));if(_0x231d95[_0x0cd4('0x5')]){for(var _0x9ce984=0x0;_0x9ce984<_0x231d95[_0x0cd4('0x5')][_0x0cd4('0x1c')];_0x9ce984+=0x1){_0x286637[_0x14a2c9](util[_0x0cd4('0x1b')](_0x0cd4('0x1d'),_0x231d95['Agents'][_0x9ce984]['name']));}}}function joinOrLeave(_0x34bfd7,_0x3a0fe9,_0x43739d){var _0xdb8d78;if(_0x34bfd7[_0x0cd4('0x1e')][_0x0cd4('0x1f')]['id']){db[_0x0cd4('0x6')][_0x0cd4('0x20')]({'attributes':['id',_0x0cd4('0x4'),_0x0cd4('0x7'),'userProfileId'],'where':{'id':_0x34bfd7[_0x0cd4('0x1e')][_0x0cd4('0x1f')]['id']},'include':[{'model':db[_0x0cd4('0x21')],'as':'ChatInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0cd4('0x22')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0cd4('0x23')],'as':_0x0cd4('0x24'),'attributes':['id'],'raw':!![]},{'model':db[_0x0cd4('0x25')],'as':'SmsInteractions','attributes':['id'],'raw':!![]},{'model':db[_0x0cd4('0x26')],'as':_0x0cd4('0x27'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':'WhatsappInteractions','attributes':['id'],'raw':!![]}]})[_0x0cd4('0xc')](function(_0x6a806d){if(_0x6a806d){_0xdb8d78=_0x6a806d;_0x34bfd7[_0x3a0fe9](util[_0x0cd4('0x1b')](_0x0cd4('0x1d'),_0x6a806d['name']));var _0x1b8e2c=[];switch(_0x6a806d[_0x0cd4('0x7')]){case _0x0cd4('0x28'):_0x34bfd7[_0x3a0fe9]('voice:inbound');_0x34bfd7[_0x3a0fe9](_0x0cd4('0x29'));if(queryQueues[_0x0cd4('0x2a')](_0x0cd4('0x2b'))){delete queryQueues[_0x0cd4('0x2b')];}_0x1b8e2c[_0x0cd4('0x2c')](db[_0x0cd4('0x2d')][_0x0cd4('0x11')](queryQueues));_0x1b8e2c[_0x0cd4('0x2c')](db[_0x0cd4('0x2e')][_0x0cd4('0x11')](queryQueues));_0x1b8e2c[_0x0cd4('0x2c')](db[_0x0cd4('0x2f')][_0x0cd4('0x11')](queryQueues));_0x1b8e2c[_0x0cd4('0x2c')](db[_0x0cd4('0x30')][_0x0cd4('0x11')](queryQueues));_0x1b8e2c[_0x0cd4('0x2c')](db['MailQueue'][_0x0cd4('0x11')](queryQueues));_0x1b8e2c[_0x0cd4('0x2c')](db['OpenchannelQueue'][_0x0cd4('0x11')](queryQueues));_0x1b8e2c[_0x0cd4('0x2c')](db[_0x0cd4('0x31')]['findAll'](queryQueues));_0x1b8e2c[_0x0cd4('0x2c')](db['User'][_0x0cd4('0x11')](queryTelephones));_0x1b8e2c[_0x0cd4('0x2c')](db[_0x0cd4('0x32')][_0x0cd4('0x11')](queryTrunks));_0x1b8e2c[_0x0cd4('0x2c')](db[_0x0cd4('0x1a')][_0x0cd4('0x11')](queryCampaigns));_0x1b8e2c['push'](db['User'][_0x0cd4('0x11')](queryAgents));break;case _0x0cd4('0x33'):_0x34bfd7[_0x3a0fe9]('voice:inbound');_0x34bfd7[_0x3a0fe9](_0x0cd4('0x29'));_0x1b8e2c['push'](getAssociatedResources(_0x0cd4('0x34'),_0x6a806d[_0x0cd4('0x35')],_0x0cd4('0x2d')));_0x1b8e2c[_0x0cd4('0x2c')](getAssociatedResources(_0x0cd4('0x36'),_0x6a806d[_0x0cd4('0x35')],_0x0cd4('0x2e')));_0x1b8e2c[_0x0cd4('0x2c')](getAssociatedResources(_0x0cd4('0x37'),_0x6a806d[_0x0cd4('0x35')],_0x0cd4('0x2f')));_0x1b8e2c[_0x0cd4('0x2c')](getAssociatedResources(_0x0cd4('0x38'),_0x6a806d[_0x0cd4('0x35')],_0x0cd4('0x30')));_0x1b8e2c[_0x0cd4('0x2c')](getAssociatedResources('MailQueues',_0x6a806d[_0x0cd4('0x35')],'MailQueue'));_0x1b8e2c['push'](getAssociatedResources(_0x0cd4('0xf'),_0x6a806d[_0x0cd4('0x35')],_0x0cd4('0x39')));_0x1b8e2c['push'](getAssociatedResources(_0x0cd4('0x10'),_0x6a806d[_0x0cd4('0x35')],_0x0cd4('0x31')));_0x1b8e2c[_0x0cd4('0x2c')](getAssociatedResources(_0x0cd4('0x12'),_0x6a806d[_0x0cd4('0x35')],_0x0cd4('0x6')));_0x1b8e2c[_0x0cd4('0x2c')](getAssociatedResources(_0x0cd4('0x13'),_0x6a806d[_0x0cd4('0x35')],_0x0cd4('0x32')));_0x1b8e2c[_0x0cd4('0x2c')](getAssociatedResources('IvrCampaigns',_0x6a806d['userProfileId'],_0x0cd4('0x1a')));_0x1b8e2c[_0x0cd4('0x2c')](db[_0x0cd4('0x6')]['findAll'](queryAgents));break;case'agent':_0x34bfd7[_0x3a0fe9](_0x0cd4('0x3a'));_0x34bfd7[_0x3a0fe9](_0x0cd4('0x29'));_0x1b8e2c[_0x0cd4('0x2c')](_0x6a806d[_0x0cd4('0x3b')]({'attributes':['id',_0x0cd4('0x4')]}));_0x1b8e2c[_0x0cd4('0x2c')](_0x6a806d[_0x0cd4('0x3c')]({'attributes':['id',_0x0cd4('0x4')]}));_0x1b8e2c[_0x0cd4('0x2c')](_0x6a806d['getFaxQueues']({'attributes':['id',_0x0cd4('0x4')]}));_0x1b8e2c[_0x0cd4('0x2c')](_0x6a806d[_0x0cd4('0x3d')]({'attributes':['id',_0x0cd4('0x4')]}));_0x1b8e2c[_0x0cd4('0x2c')](_0x6a806d[_0x0cd4('0x3e')]({'attributes':['id',_0x0cd4('0x4')]}));_0x1b8e2c['push'](_0x6a806d[_0x0cd4('0x3f')]({'attributes':['id',_0x0cd4('0x4')]}));_0x1b8e2c[_0x0cd4('0x2c')](_0x6a806d[_0x0cd4('0x40')]({'attributes':['id','name']}));break;}return BPromise['all'](_0x1b8e2c);}})[_0x0cd4('0xc')](function(_0x52b8e5){if(_0x52b8e5&&_0x52b8e5[_0x0cd4('0x1c')]){for(var _0x405fcb=0x0;_0x405fcb<_0x52b8e5[_0x0cd4('0x1c')];_0x405fcb+=0x1){for(var _0x2aa03c=0x0;_0x2aa03c<_0x52b8e5[_0x405fcb][_0x0cd4('0x1c')];_0x2aa03c+=0x1){switch(_0x405fcb){case 0x0:joinOrLeaveQueues(_0x34bfd7,_0x3a0fe9,_0x0cd4('0x41'),_0x52b8e5[_0x405fcb][_0x2aa03c]);break;case 0x1:joinOrLeaveQueues(_0x34bfd7,_0x3a0fe9,_0x0cd4('0x42'),_0x52b8e5[_0x405fcb][_0x2aa03c]);break;case 0x2:joinOrLeaveQueues(_0x34bfd7,_0x3a0fe9,_0x0cd4('0x43'),_0x52b8e5[_0x405fcb][_0x2aa03c]);break;case 0x3:joinOrLeaveQueues(_0x34bfd7,_0x3a0fe9,_0x0cd4('0x44'),_0x52b8e5[_0x405fcb][_0x2aa03c]);break;case 0x4:joinOrLeaveQueues(_0x34bfd7,_0x3a0fe9,_0x0cd4('0x45'),_0x52b8e5[_0x405fcb][_0x2aa03c]);break;case 0x5:joinOrLeaveQueues(_0x34bfd7,_0x3a0fe9,_0x0cd4('0x46'),_0x52b8e5[_0x405fcb][_0x2aa03c]);break;case 0x6:joinOrLeaveQueues(_0x34bfd7,_0x3a0fe9,_0x0cd4('0x47'),_0x52b8e5[_0x405fcb][_0x2aa03c]);break;case 0x7:if(_0xdb8d78['role']!=='agent')_0x34bfd7[_0x3a0fe9](util['format']('telephone:%s',_0x52b8e5[_0x405fcb][_0x2aa03c][_0x0cd4('0x4')]));break;case 0x8:if(_0xdb8d78[_0x0cd4('0x7')]!==_0x0cd4('0x8'))_0x34bfd7[_0x3a0fe9](util[_0x0cd4('0x1b')](_0x0cd4('0x48'),_0x52b8e5[_0x405fcb][_0x2aa03c]['name']));break;case 0x9:if(_0xdb8d78[_0x0cd4('0x7')]!==_0x0cd4('0x8'))_0x34bfd7[_0x3a0fe9](util[_0x0cd4('0x1b')]('campaign:%s:%s',_0x52b8e5[_0x405fcb][_0x2aa03c][_0x0cd4('0x49')],_0x52b8e5[_0x405fcb][_0x2aa03c][_0x0cd4('0x4')]));break;case 0xa:_0x34bfd7[_0x3a0fe9](util[_0x0cd4('0x1b')](_0x0cd4('0x1d'),_0x52b8e5[_0x405fcb][_0x2aa03c][_0x0cd4('0x4')]));break;}}}}})[_0x0cd4('0xc')](function(){if(_0x3a0fe9===_0x0cd4('0x4a')){var _0x3c95bf=_[_0x0cd4('0x17')](_0xdb8d78[_0x0cd4('0x4b')],'id');return _0xdb8d78['removeChatInteractions'](_0x3c95bf)[_0x0cd4('0xc')](function(){for(var _0x284dc3=0x0;_0x284dc3<_0x3c95bf[_0x0cd4('0x1c')];_0x284dc3+=0x1){_0x43739d['emit'](_0x0cd4('0x4c'),{'ChatInteractionId':Number(_0x3c95bf[_0x284dc3]),'UserId':Number(_0xdb8d78['id'])});}});}})[_0x0cd4('0xc')](function(){if(_0x3a0fe9===_0x0cd4('0x4a')){var _0x56cdce=_[_0x0cd4('0x17')](_0xdb8d78[_0x0cd4('0x4d')],'id');return _0xdb8d78['removeMailInteractions'](_0x56cdce)['then'](function(){for(var _0x15720=0x0;_0x15720<_0x56cdce['length'];_0x15720+=0x1){_0x43739d[_0x0cd4('0x4e')]('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x56cdce[_0x15720]),'UserId':Number(_0xdb8d78['id'])});}});}})[_0x0cd4('0xc')](function(){if(_0x3a0fe9===_0x0cd4('0x4a')){var _0xac89c2=_[_0x0cd4('0x17')](_0xdb8d78[_0x0cd4('0x24')],'id');return _0xdb8d78[_0x0cd4('0x4f')](_0xac89c2)[_0x0cd4('0xc')](function(){for(var _0x5a0b50=0x0;_0x5a0b50<_0xac89c2['length'];_0x5a0b50+=0x1){_0x43739d['emit'](_0x0cd4('0x50'),{'FaxInteractionId':Number(_0xac89c2[_0x5a0b50]),'UserId':Number(_0xdb8d78['id'])});}});}})[_0x0cd4('0xc')](function(){if(_0x3a0fe9==='leave'){var _0x5b8d7a=_['map'](_0xdb8d78[_0x0cd4('0x51')],'id');return _0xdb8d78[_0x0cd4('0x52')](_0x5b8d7a)[_0x0cd4('0xc')](function(){for(var _0x4ee249=0x0;_0x4ee249<_0x5b8d7a[_0x0cd4('0x1c')];_0x4ee249+=0x1){_0x43739d[_0x0cd4('0x4e')](_0x0cd4('0x53'),{'SmsInteractionId':Number(_0x5b8d7a[_0x4ee249]),'UserId':Number(_0xdb8d78['id'])});}});}})['then'](function(){if(_0x3a0fe9===_0x0cd4('0x4a')){var _0x34593e=_[_0x0cd4('0x17')](_0xdb8d78[_0x0cd4('0x27')],'id');return _0xdb8d78[_0x0cd4('0x54')](_0x34593e)[_0x0cd4('0xc')](function(){for(var _0x2570a0=0x0;_0x2570a0<_0x34593e[_0x0cd4('0x1c')];_0x2570a0+=0x1){_0x43739d[_0x0cd4('0x4e')](_0x0cd4('0x55'),{'OpenchannelInteractionId':Number(_0x34593e[_0x2570a0]),'UserId':Number(_0xdb8d78['id'])});}});}})[_0x0cd4('0xc')](function(){if(_0x3a0fe9==='leave'){var _0x4e5947=_[_0x0cd4('0x17')](_0xdb8d78[_0x0cd4('0x56')],'id');return _0xdb8d78[_0x0cd4('0x57')](_0x4e5947)['then'](function(){for(var _0x5ed431=0x0;_0x5ed431<_0x4e5947[_0x0cd4('0x1c')];_0x5ed431+=0x1){_0x43739d[_0x0cd4('0x4e')](_0x0cd4('0x58'),{'WhatsappInteractionId':Number(_0x4e5947[_0x5ed431]),'UserId':Number(_0xdb8d78['id'])});}});}})[_0x0cd4('0x59')](function(_0x4886b4){_0x34bfd7[_0x0cd4('0x5a')](_0x4886b4);});}}function onDisconnect(_0xda3902,_0x2ec70c){joinOrLeave(_0xda3902,'leave',_0x2ec70c);}function onConnect(_0x47eac4){joinOrLeave(_0x47eac4,_0x0cd4('0x5b'));}exports['default']=function(_0x2ab09f){_0x2ab09f['on'](_0x0cd4('0x5c'),function(_0x12e638){_0x12e638[_0x0cd4('0x5d')](0x0);_0x12e638['address']=_0x12e638[_0x0cd4('0x5e')][_0x0cd4('0x5c')][_0x0cd4('0x5f')]+':'+_0x12e638[_0x0cd4('0x5e')][_0x0cd4('0x5c')]['remotePort'];_0x12e638['connectedAt']=new Date();_0x12e638[_0x0cd4('0x5a')]=function(_0x2de2fc){console[_0x0cd4('0x5a')]('SocketIO\x20'+_0x12e638[_0x0cd4('0x60')][_0x0cd4('0x4')]+'['+_0x12e638[_0x0cd4('0x61')]+']',_0x2de2fc);};_0x12e638['on']('disconnect',function(){onDisconnect(_0x12e638,_0x2ab09f);_0x12e638['log'](_0x0cd4('0x62'));});onConnect(_0x12e638);_0x12e638[_0x0cd4('0x5a')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index 4d9d92c..5d9318c 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 _0xa7dd=['QueryTypes','closed','interface','format','default','length','hasOwnProperty','model','hook','toLowerCase','condition','../../mysqldb','jayson/promise','../logger','triggers','lodash','client','Chat','ChatInteraction','newinteraction','afterUpdate','closedinteraction','ChatMessage','afterCreate','Sms','SmsInteraction','SmsMessage','newmessage','Whatsapp','WhatsappInteraction','FaxInteraction','Fax','FaxMessage','MailInteraction','Mail','MailMessage','Openchannel','OpenchannelInteraction','EventManager','then','info','Trigger,\x20%s','error','code','catch','get','event','direction','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','query','Sequelize','SELECT','contact','UserId','User','find','fullname','email','SIP/%s','name','incomingmessage','outgoingmessage','channel','opened'];(function(_0x5458a6,_0x1688c5){var _0x2669fc=function(_0x54ed83){while(--_0x54ed83){_0x5458a6['push'](_0x5458a6['shift']());}};_0x2669fc(++_0x1688c5);}(_0xa7dd,0x1d9));var _0xda7d=function(_0x5355fa,_0x4d2122){_0x5355fa=_0x5355fa-0x0;var _0x8434b0=_0xa7dd[_0x5355fa];return _0x8434b0;};'use strict';var util=require('util');var db=require(_0xda7d('0x0'))['db'];var jayson=require(_0xda7d('0x1'));var logger=require(_0xda7d('0x2'))(_0xda7d('0x3'));var _=require(_0xda7d('0x4'));var client=jayson[_0xda7d('0x5')]['http']({'port':0x232a});var triggers=[{'channel':_0xda7d('0x6'),'model':_0xda7d('0x7'),'event':'afterCreate','condition':_0xda7d('0x8'),'callback':afterCreate},{'channel':_0xda7d('0x6'),'model':_0xda7d('0x7'),'event':_0xda7d('0x9'),'condition':_0xda7d('0xa'),'callback':afterUpdate},{'channel':'Chat','model':_0xda7d('0xb'),'event':_0xda7d('0xc'),'condition':'newmessage','callback':afterCreateMessage},{'channel':_0xda7d('0xd'),'model':_0xda7d('0xe'),'event':_0xda7d('0xc'),'condition':_0xda7d('0x8'),'callback':afterCreate},{'channel':_0xda7d('0xd'),'model':_0xda7d('0xe'),'event':_0xda7d('0x9'),'condition':_0xda7d('0xa'),'callback':afterUpdate},{'channel':_0xda7d('0xd'),'model':_0xda7d('0xf'),'event':_0xda7d('0xc'),'condition':_0xda7d('0x10'),'callback':afterCreateMessage},{'channel':_0xda7d('0x11'),'model':_0xda7d('0x12'),'event':_0xda7d('0xc'),'condition':_0xda7d('0x8'),'callback':afterCreate},{'channel':_0xda7d('0x11'),'model':_0xda7d('0x12'),'event':_0xda7d('0x9'),'condition':_0xda7d('0xa'),'callback':afterUpdate},{'channel':'Whatsapp','model':'WhatsappMessage','event':'afterCreate','condition':_0xda7d('0x10'),'callback':afterCreateMessage},{'channel':'Fax','model':_0xda7d('0x13'),'event':'afterCreate','condition':_0xda7d('0x8'),'callback':afterCreate},{'channel':_0xda7d('0x14'),'model':'FaxInteraction','event':_0xda7d('0x9'),'condition':_0xda7d('0xa'),'callback':afterUpdate},{'channel':_0xda7d('0x14'),'model':_0xda7d('0x15'),'event':_0xda7d('0xc'),'condition':_0xda7d('0x10'),'callback':afterCreateMessage},{'channel':'Mail','model':_0xda7d('0x16'),'event':'afterCreate','condition':_0xda7d('0x8'),'callback':afterCreate},{'channel':_0xda7d('0x17'),'model':_0xda7d('0x16'),'event':'afterUpdate','condition':'closedinteraction','callback':afterUpdate},{'channel':'Mail','model':_0xda7d('0x18'),'event':_0xda7d('0xc'),'condition':_0xda7d('0x10'),'callback':afterCreateMessage},{'channel':_0xda7d('0x19'),'model':_0xda7d('0x1a'),'event':'afterCreate','condition':_0xda7d('0x8'),'callback':afterCreate},{'channel':'Openchannel','model':_0xda7d('0x1a'),'event':'afterUpdate','condition':_0xda7d('0xa'),'callback':afterUpdate},{'channel':_0xda7d('0x19'),'model':'OpenchannelMessage','event':_0xda7d('0xc'),'condition':_0xda7d('0x10'),'callback':afterCreateMessage}];function request(_0xe6a3c2){return client['request'](_0xda7d('0x1b'),_0xe6a3c2)[_0xda7d('0x1c')](function(_0x5f5d25){logger[_0xda7d('0x1d')](_0xda7d('0x1e'),_0xda7d('0x1b'),_0x5f5d25);if(_0x5f5d25['error']){if(_0x5f5d25[_0xda7d('0x1f')][_0xda7d('0x20')]===0x1f4){logger['error'](_0xda7d('0x1e'),_0xda7d('0x1b'),_0x5f5d25[_0xda7d('0x1f')]);}}})[_0xda7d('0x21')](function(_0x349c82){logger['error'](_0xda7d('0x1e'),_0xda7d('0x1b'),_0x349c82);});}function afterCreateMessage(_0x39e22c,_0x447547){return function(_0x44c9a6,_0x3ff404){_0x44c9a6=_0x44c9a6[_0xda7d('0x22')]({'plain':!![]});_0x44c9a6['channel']=_0x39e22c;_0x44c9a6[_0xda7d('0x23')]=_0x44c9a6[_0xda7d('0x24')];var _0x3b81b4=_0xda7d('0x25')+_0x44c9a6[_0xda7d('0x26')];return db[_0xda7d('0x27')][_0xda7d('0x28')](_0x3b81b4,{'type':db[_0xda7d('0x29')]['QueryTypes'][_0xda7d('0x2a')],'raw':!![]})[_0xda7d('0x1c')](function(_0x32b6a4){return _0x32b6a4;})['then'](function(_0x4836b3){if(_0x4836b3){_0x44c9a6[_0xda7d('0x2b')]=_0x4836b3[0x0];}if(_0x44c9a6[_0xda7d('0x2c')]){return db[_0xda7d('0x2d')][_0xda7d('0x2e')]({'where':{'id':_0x44c9a6[_0xda7d('0x2c')]},'attributes':['id','name',_0xda7d('0x2f'),_0xda7d('0x30'),'internal'],'raw':!![]})[_0xda7d('0x1c')](function(_0x505ded){_0x44c9a6['interface']=util['format'](_0xda7d('0x31'),_0x505ded[_0xda7d('0x32')]);_0x44c9a6['channel']=_0x39e22c;_0x44c9a6['agent']=_0x505ded;return request({'event':_0xda7d('0x33'),'message':_0x44c9a6});})['catch'](function(_0x10e1b5){console[_0xda7d('0x1f')](_0x10e1b5);});}else{return request({'event':_0xda7d('0x34'),'message':_0x44c9a6});}});};}function afterCreate(_0x3e231e,_0x4e6ba8){return function(_0x43134e,_0x3b41a3){_0x43134e=_0x43134e[_0xda7d('0x22')]({'plain':!![]});_0x43134e[_0xda7d('0x35')]=_0x3e231e;_0x43134e[_0xda7d('0x23')]=_0xda7d('0x36');var _0x18a7ea=_0xda7d('0x25')+_0x43134e['ContactId'];return db[_0xda7d('0x27')][_0xda7d('0x28')](_0x18a7ea,{'type':db[_0xda7d('0x29')][_0xda7d('0x37')][_0xda7d('0x2a')],'raw':!![]})['then'](function(_0x1699d8){return _0x1699d8;})['then'](function(_0x41b2a8){if(_0x41b2a8){_0x43134e[_0xda7d('0x2b')]=_0x41b2a8[0x0];}return request({'event':_0x4e6ba8,'message':_0x43134e});});};}function afterUpdate(_0x2bf9ae,_0x23967d){return function(_0x3cf07c,_0x25d930){if(_0x3cf07c['changed'](_0xda7d('0x38'))&&_0x3cf07c[_0xda7d('0x38')]){_0x3cf07c=_0x3cf07c['get']({'plain':!![]});_0x3cf07c['channel']=_0x2bf9ae;_0x3cf07c[_0xda7d('0x23')]='closed';var _0x58919b=_0xda7d('0x25')+_0x3cf07c['ContactId'];return db[_0xda7d('0x27')][_0xda7d('0x28')](_0x58919b,{'type':db[_0xda7d('0x29')][_0xda7d('0x37')]['SELECT'],'raw':!![]})[_0xda7d('0x1c')](function(_0x55ac60){return _0x55ac60;})[_0xda7d('0x1c')](function(_0x4c5423){if(_0x4c5423){_0x3cf07c[_0xda7d('0x2b')]=_0x4c5423[0x0];}if(_0x3cf07c[_0xda7d('0x2c')]){return db[_0xda7d('0x2d')]['find']({'where':{'id':_0x3cf07c['UserId']},'attributes':['id',_0xda7d('0x32'),_0xda7d('0x2f'),_0xda7d('0x30'),'internal'],'raw':!![]})[_0xda7d('0x1c')](function(_0x56d303){_0x3cf07c[_0xda7d('0x39')]=util[_0xda7d('0x3a')](_0xda7d('0x31'),_0x56d303[_0xda7d('0x32')]);_0x3cf07c['agent']=_0x56d303;return request({'event':_0x23967d,'message':_0x3cf07c});})[_0xda7d('0x21')](function(_0x6705d0){console[_0xda7d('0x1f')](_0x6705d0);});}else{return request({'event':_0x23967d,'message':_0x3cf07c});}});}};}exports[_0xda7d('0x3b')]=function(){for(var _0x47f8f7=0x0;_0x47f8f7=_0x2bf017['agents']){throw Error(_0x4376('0x14'));}_0x5e9279(_0x135cb0);})[_0x4376('0x15')](function(_0x6ec47c){_0x372a3b(_0x6ec47c);});});}; \ No newline at end of file +var _0xf10c=['getChannels','isValidChannel','toLowerCase','includes','clearBlockUser','isUndefined','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','bluebird','../mysqldb','./license/util','voice','mail','chat','fax','whatsapp','openchannel'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xf10c,0xc6));var _0xcf10=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xf10c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcf10('0x0'));var BPromise=require(_0xcf10('0x1'));var db=require(_0xcf10('0x2'))['db'];var util=require(_0xcf10('0x3'));var channels=[_0xcf10('0x4'),_0xcf10('0x5'),_0xcf10('0x6'),_0xcf10('0x7'),'sms',_0xcf10('0x8'),_0xcf10('0x9')];exports[_0xcf10('0xa')]=function(){return channels;};exports[_0xcf10('0xb')]=function(_0x596963){_0x596963=_0x596963[_0xcf10('0xc')]();return _[_0xcf10('0xd')](channels,_0x596963);};exports[_0xcf10('0xe')]=function(_0x54154a,_0x29757c,_0x2dc91d,_0x4add7d){var _0xd1f2bb={'loginAttempts':_0x29757c,'blocked':_0x2dc91d};if(!_[_0xcf10('0xf')](_0x4add7d)){_0xd1f2bb['blockedAt']=_0x4add7d;}return _0x54154a[_0xcf10('0x10')](_0xd1f2bb);};exports[_0xcf10('0x11')]=function(_0x4c0e5b){return new BPromise(function(_0x1197a0,_0x1e0e75){var _0x9e50ba=0x0;if(_0x4c0e5b[_0xcf10('0x12')]!==_0xcf10('0x13')){_0x1197a0(_0x4c0e5b);}db[_0xcf10('0x14')][_0xcf10('0x15')]({'where':{'role':_0xcf10('0x13'),'online':!![],'id':{'$ne':_0x4c0e5b['id']}}})[_0xcf10('0x16')](function(_0x583931){_0x9e50ba=_0x583931;return util[_0xcf10('0x11')]();})['then'](function(_0x390af0){if(_0x390af0&&_0x390af0[_0xcf10('0x17')]&&_0x9e50ba>=_0x390af0[_0xcf10('0x17')]){throw Error(_0xcf10('0x18'));}_0x1197a0(_0x4c0e5b);})[_0xcf10('0x19')](function(_0x3312d9){_0x1e0e75(_0x3312d9);});});}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 7046d95..b78620d 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbb5f=['json','send','404','status','render'];(function(_0x45f2ce,_0x1445c8){var _0x1a9974=function(_0x1577cb){while(--_0x1577cb){_0x45f2ce['push'](_0x45f2ce['shift']());}};_0x1a9974(++_0x1445c8);}(_0xbb5f,0x16a));var _0xfbb5=function(_0x51f455,_0x55c84c){_0x51f455=_0x51f455-0x0;var _0x387f3e=_0xbb5f[_0x51f455];return _0x387f3e;};'use strict';module['exports'][0x194]=function pageNotFound(_0x5c27f4,_0x30285d){var _0x4b0f04=_0xfbb5('0x0');var _0x169506=0x194;var _0x335d8b={'status':_0x169506};_0x30285d[_0xfbb5('0x1')](_0x335d8b[_0xfbb5('0x1')]);_0x30285d[_0xfbb5('0x2')](_0x4b0f04,{},function(_0x32639c,_0x361eeb){if(_0x32639c){return _0x30285d['status'](_0x335d8b['status'])[_0xfbb5('0x3')](_0x335d8b);}_0x30285d[_0xfbb5('0x4')](_0x361eeb);});}; \ No newline at end of file +var _0x6c76=['status','render','json','exports','404'];(function(_0x4015b1,_0x5dc35a){var _0x3a4e7d=function(_0x11f9d2){while(--_0x11f9d2){_0x4015b1['push'](_0x4015b1['shift']());}};_0x3a4e7d(++_0x5dc35a);}(_0x6c76,0x184));var _0x66c7=function(_0xffad3e,_0x2941f8){_0xffad3e=_0xffad3e-0x0;var _0x5b2c58=_0x6c76[_0xffad3e];return _0x5b2c58;};'use strict';module[_0x66c7('0x0')][0x194]=function pageNotFound(_0x3a34ba,_0x10a050){var _0x55604c=_0x66c7('0x1');var _0xd49f21=0x194;var _0x519756={'status':_0xd49f21};_0x10a050['status'](_0x519756[_0x66c7('0x2')]);_0x10a050[_0x66c7('0x3')](_0x55604c,{},function(_0x49d437,_0x175da0){if(_0x49d437){return _0x10a050[_0x66c7('0x2')](_0x519756['status'])[_0x66c7('0x4')](_0x519756);}_0x10a050['send'](_0x175da0);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 14259cf..83f896a 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2d0b=['../api/squareMessage/squareMessage.model','Team','../api/team/team.model','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','../api/attachment/attachment.model','Plugin','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','OpenchannelTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','VoicePrefix','UserProfile','../api/userProfile/userProfile.model','UserProfileSection','../api/userProfileSection/userProfileSection.model','../api/userProfileResource/userProfileResource.model','WhatsappAccount','WhatsappApplication','WhatsappMessage','../api/whatsappMessage/whatsappMessage.model','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','Realtime','../api/realtime/realtime.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','cascade','UserId','hasMany','Recordings','VoiceQueuesRt','Extensions','HopperFinals','OpenchannelInteractions','ChatInteraction','ChatInteractions','SmsInteractions','FaxInteractions','MailInteractions','WhatsappInteraction','UserNotification','UserNotifications','SenderId','belongsTo','userProfileId','belongsToMany','chat_group_has_users','cm_user_has_contacts','Lists','user_has_chat_interactions','user_has_fax_interactions','SmsInteraction','user_has_openchannel_interactions','VoiceQueues','ChatQueue','ChatQueues','FaxQueues','UserSmsQueue','OpenchannelQueues','WhatsappQueues','cm_user_has_lists','VoicePrefixes','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccount','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','WhatsappAccounts','SquareProject','SpiedAgents','ChanSpyId','Applications','Sounds','moh_has_sounds','Members','Hoppers','VoiceQueueId','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackup','TrunkBackupId','mandatoryDispositionPauseId','voice_queues_has_cm_lists','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailboxuser','mailbox','QueueCalls','uniqueid','Contact','MailAccountId','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','ListId','TemplateId','Agents','team_has_mail_queues','MailInteractionId','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','user_has_mail_interactions','Attachments','Interaction','Account','ChatWebsiteId','ChatOfflineMessageId','restrict','IntervalId','TagId','List','FaxAccountId','Exntensions','mandatoryDispositionPause','FaxInteractionId','Owner','fax_interaction_has_tags','Attachment','AttachmentId','UserFaxQueue','SmsAccountId','user_has_sms_accounts','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','openchannel_interaction_has_tags','OpenchannelInteractionId','OpenchannelQueueId','team_has_openchannel_queues','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','Contacts','CompanyId','JscriptySessionReport','Company','cm_contact_has_tags','All','OneAll','AutomationAllId','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','ChatApplications','FaxApplications','Schedule','DefaultReportId','Mohs','whatsapp_interaction_has_tags','AllConditions','AllCondition','AnyCondition','TriggerId','CustomReportId','Fields','AnalyticMetric','Configurations','AccountId','Subjects','SubjectId','FieldId','Subject','Description','Field','Variable','VariableId','DescriptionId','Descriptions','ZohoConfiguration','ZohoField','int_zendesk_configuration_has_tags','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerConfiguration','VtigerField','ServicenowConfiguration','ToId','JscriptyQuestionReport','SessionId','ProjectId','user_has_square_projects','MailQueues','team_has_fax_queues','team_has_whatsapp_queues','CampaignId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromUserId','FromAgent','ToMailQueueId','ToQueue','ToMailAccountId','ToAccount','FromChatWebsiteId','ToUserId','ToAgent','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxAccountId','FromOpenchannelAccountId','SmsTransferReport','FromSmsAccountId','ToSmsAccountId','CmHopperHistory','HopperHistory','Queues','user_has_voice_prefixes','UserProfileSections','UserProfileResource','sectionId','WhatsappAccountId','user_has_whatsapp_interactions','WhatsappInteractionId','FromWhatsappAccountId','WhatsappQueueId','../config/environment','sequelize','lodash','determine','defaultsDeep','xcall','127.0.0.1','mysql','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','motion2','database','options','username','password','User','import','../api/user/user.model','VoiceChanSpy','VoiceContext','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','../api/memberReport/memberReport.model','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','../api/userFaxQueue/userFaxQueue.model','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerOut','../api/mailServerOut/mailServerOut.model','../api/mailAccount/mailAccount.model','MailQueue','../api/mailQueue/mailQueue.model','MailSubstatus','../api/mailSubstatus/mailSubstatus.model','MailInteraction','MailMessage','../api/mailMessage/mailMessage.model','MailApplication','../api/mailApplication/mailApplication.model','MailQueueReport','../api/mailQueueReport/mailQueueReport.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','FaxInteraction','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsInteraction/smsInteraction.model','SmsMessage','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','ChatMessage','../api/chatMessage/chatMessage.model','ChatOfflineMessage','../api/chatQueue/chatQueue.model','ChatGroup','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','CmContact','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','../api/action/action.model','Automation','../api/automation/automation.model','CannedAnswer','../api/cannedAnswer/cannedAnswer.model','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','Template','../api/template/template.model','Trigger','../api/trigger/trigger.model','../api/variable/variable.model','Integration','IntegrationReport','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskAccount','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','../api/intZohoField/intZohoField.model','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','ZendeskConfiguration','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intVtigerAccount/intVtigerAccount.model','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/integration/integration.model','Network','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','JscriptyProject','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model','../api/squareProject/squareProject.model','SquareMessage'];(function(_0x18c0ca,_0x1f4c22){var _0x2e9c71=function(_0x42ab40){while(--_0x42ab40){_0x18c0ca['push'](_0x18c0ca['shift']());}};_0x2e9c71(++_0x1f4c22);}(_0x2d0b,0x102));var _0xb2d0=function(_0x3fa95a,_0x228299){_0x3fa95a=_0x3fa95a-0x0;var _0x2f9b15=_0x2d0b[_0x3fa95a];return _0x2f9b15;};'use strict';var path=require('path');var config=require(_0xb2d0('0x0'));var Sequelize=require(_0xb2d0('0x1'));var _=require(_0xb2d0('0x2'));var jstz=require('jstz');var timezone=jstz[_0xb2d0('0x3')]();config[_0xb2d0('0x1')]=_[_0xb2d0('0x4')](config[_0xb2d0('0x1')],{'database':'motion2','username':_0xb2d0('0x5'),'password':'xC@LL1234','options':{'host':_0xb2d0('0x6'),'port':0xcea,'dialect':_0xb2d0('0x7'),'dialectOptions':{'charset':_0xb2d0('0x8')},'logging':![],'timezone':timezone[_0xb2d0('0x9')](),'define':{'charset':_0xb2d0('0xa'),'collate':_0xb2d0('0xb')}}});config[_0xb2d0('0xc')]=_[_0xb2d0('0x4')](config[_0xb2d0('0xc')],{'database':_0xb2d0('0xd'),'username':_0xb2d0('0x5'),'password':'xC@LL1234','options':{'host':'127.0.0.1','port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0xb2d0('0x8')},'logging':![],'timezone':timezone['name'](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb2d0('0x1')][_0xb2d0('0xe')],config[_0xb2d0('0x1')]['username'],config[_0xb2d0('0x1')]['password'],config[_0xb2d0('0x1')][_0xb2d0('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0xb2d0('0xc')][_0xb2d0('0xe')],config[_0xb2d0('0xc')][_0xb2d0('0x10')],config[_0xb2d0('0xc')][_0xb2d0('0x11')],config[_0xb2d0('0xc')][_0xb2d0('0xf')])};db[_0xb2d0('0x12')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x14'));db[_0xb2d0('0x15')]=db['sequelize'][_0xb2d0('0x13')]('../api/voiceChanSpy/voiceChanSpy.model');db[_0xb2d0('0x16')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x17'));db[_0xb2d0('0x18')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x19'));db[_0xb2d0('0x1a')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x1b'));db[_0xb2d0('0x1c')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x1d'));db[_0xb2d0('0x1e')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x1f'));db[_0xb2d0('0x20')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x21'));db[_0xb2d0('0x22')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x23'));db[_0xb2d0('0x24')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x25'));db[_0xb2d0('0x26')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x27'));db[_0xb2d0('0x28')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x29'));db[_0xb2d0('0x2a')]=db['sequelize']['import'](_0xb2d0('0x2b'));db[_0xb2d0('0x2c')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x2d'));db[_0xb2d0('0x2e')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x2f'));db[_0xb2d0('0x30')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x31'));db['VoiceTransferReport']=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x32'));db[_0xb2d0('0x33')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0xb2d0('0x34')]=db['sequelize']['import'](_0xb2d0('0x35'));db[_0xb2d0('0x36')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x37'));db[_0xb2d0('0x38')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x39'));db['UserFaxQueue']=db[_0xb2d0('0x1')]['import'](_0xb2d0('0x3a'));db['UserSmsQueue']=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x3b'));db[_0xb2d0('0x3c')]=db[_0xb2d0('0x1')]['import']('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0xb2d0('0x3d')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x3e'));db['MailServerIn']=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/mailServerIn/mailServerIn.model');db[_0xb2d0('0x3f')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x40'));db['MailAccount']=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x41'));db[_0xb2d0('0x42')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x43'));db[_0xb2d0('0x44')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x45'));db[_0xb2d0('0x46')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/mailInteraction/mailInteraction.model');db[_0xb2d0('0x47')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x48'));db[_0xb2d0('0x49')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x4a'));db[_0xb2d0('0x4b')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x4c'));db[_0xb2d0('0x4d')]=db['sequelize']['import'](_0xb2d0('0x4e'));db[_0xb2d0('0x4f')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0x50'));db[_0xb2d0('0x51')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/faxAccount/faxAccount.model');db[_0xb2d0('0x52')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/faxApplication/faxApplication.model');db[_0xb2d0('0x53')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/faxInteraction/faxInteraction.model');db[_0xb2d0('0x54')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x55'));db[_0xb2d0('0x56')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x57'));db[_0xb2d0('0x58')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x59'));db[_0xb2d0('0x5a')]=db['sequelize']['import'](_0xb2d0('0x5b'));db[_0xb2d0('0x5c')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/smsApplication/smsApplication.model');db['SmsInteraction']=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x5d'));db[_0xb2d0('0x5e')]=db['sequelize'][_0xb2d0('0x13')]('../api/smsMessage/smsMessage.model');db[_0xb2d0('0x5f')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x60'));db[_0xb2d0('0x61')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x62'));db[_0xb2d0('0x63')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/openchannelApplication/openchannelApplication.model');db[_0xb2d0('0x64')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0x65'));db[_0xb2d0('0x66')]=db['sequelize']['import'](_0xb2d0('0x67'));db[_0xb2d0('0x68')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x69'));db[_0xb2d0('0x6a')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/chatWebsite/chatWebsite.model');db[_0xb2d0('0x6b')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0x6c'));db[_0xb2d0('0x6d')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0x6e'));db['ChatInteraction']=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/chatInteraction/chatInteraction.model');db[_0xb2d0('0x6f')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x70'));db[_0xb2d0('0x71')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/chatOfflineMessage/chatOfflineMessage.model');db['ChatQueue']=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x72'));db[_0xb2d0('0x73')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x74'));db[_0xb2d0('0x75')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x76'));db[_0xb2d0('0x77')]=db[_0xb2d0('0x1')]['import']('../api/cmCompany/cmCompany.model');db[_0xb2d0('0x78')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0x79'));db[_0xb2d0('0x7a')]=db['sequelize']['import'](_0xb2d0('0x7b'));db[_0xb2d0('0x7c')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x7d'));db[_0xb2d0('0x7e')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x7f'));db['CmHopperHistory']=db['sequelize'][_0xb2d0('0x13')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0xb2d0('0x80')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x81'));db[_0xb2d0('0x82')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x83'));db[_0xb2d0('0x84')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0x85'));db[_0xb2d0('0x86')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x87'));db[_0xb2d0('0x88')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x89'));db['Disposition']=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/disposition/disposition.model');db[_0xb2d0('0x8a')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x8b'));db[_0xb2d0('0x8c')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/interval/interval.model');db[_0xb2d0('0x8d')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/pause/pause.model');db[_0xb2d0('0x8e')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x8f'));db['VoiceQueuesLog']=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x90'));db['Schedule']=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/schedule/schedule.model');db[_0xb2d0('0x91')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x92'));db[_0xb2d0('0x93')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x94'));db[_0xb2d0('0x95')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0x96'));db[_0xb2d0('0x97')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x98'));db['Variable']=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x99'));db[_0xb2d0('0x9a')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/integration/integration.model');db[_0xb2d0('0x9b')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x9c'));db[_0xb2d0('0x9d')]=db[_0xb2d0('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0xb2d0('0x9e')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x9f'));db[_0xb2d0('0xa0')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xa1'));db['AnalyticMetric']=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0xa2'));db[_0xb2d0('0xa3')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xa4'));db[_0xb2d0('0xa5')]=db['sequelize'][_0xb2d0('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0xb2d0('0xa6')]=db['sequelize']['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db[_0xb2d0('0xa7')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0xa8'));db[_0xb2d0('0xa9')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xaa'));db[_0xb2d0('0xab')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0xb2d0('0xac')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xad'));db[_0xb2d0('0xae')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xaf'));db[_0xb2d0('0xb0')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xb1'));db[_0xb2d0('0xb2')]=db['sequelize'][_0xb2d0('0x13')]('../api/intDeskConfiguration/intDeskConfiguration.model');db[_0xb2d0('0xb3')]=db['sequelize']['import'](_0xb2d0('0xb4'));db[_0xb2d0('0xb5')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xb6'));db['ZohoConfiguration']=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xb7'));db[_0xb2d0('0xb8')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0xb9'));db[_0xb2d0('0xba')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xbb'));db[_0xb2d0('0xbc')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0xbd'));db[_0xb2d0('0xbe')]=db['sequelize'][_0xb2d0('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize']['import'](_0xb2d0('0xbf'));db[_0xb2d0('0xc0')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db['VtigerAccount']=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xc1'));db['VtigerConfiguration']=db['sequelize'][_0xb2d0('0x13')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db['VtigerField']=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0xc2'));db[_0xb2d0('0xc3')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0xc4'));db['ServicenowConfiguration']=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0xc5'));db[_0xb2d0('0xc6')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xc7'));db[_0xb2d0('0xc8')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xc9'));db[_0xb2d0('0xca')]=db[_0xb2d0('0x1')]['import']('../api/intDynamics365Configuration/intDynamics365Configuration.model');db[_0xb2d0('0xcb')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xcc'));db[_0xb2d0('0xcd')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0xce'));db[_0xb2d0('0xcf')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xd0'));db[_0xb2d0('0xd1')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xd2'));db['Integration']=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xd3'));db[_0xb2d0('0xd4')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0xd5'));db[_0xb2d0('0xd6')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xd7'));db[_0xb2d0('0xd8')]=db['sequelize'][_0xb2d0('0x13')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0xb2d0('0xd9')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xda'));db['JscriptyQuestionReport']=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db['JscriptySessionReport']=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xdb'));db[_0xb2d0('0xdc')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xdd'));db[_0xb2d0('0xde')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xdf'));db[_0xb2d0('0xe0')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0xe1'));db[_0xb2d0('0xe2')]=db[_0xb2d0('0x1')]['import']('../api/jscriptyProject/jscriptyProject.model');db[_0xb2d0('0xe3')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xe4'));db[_0xb2d0('0xe5')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0xe6'));db['SquareProject']=db[_0xb2d0('0x1')]['import'](_0xb2d0('0xe7'));db['SquareRecording']=db['sequelize'][_0xb2d0('0x13')]('../api/squareRecording/squareRecording.model');db[_0xb2d0('0xe8')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0xe9'));db[_0xb2d0('0xea')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xeb'));db[_0xb2d0('0xec')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xed'));db[_0xb2d0('0xee')]=db[_0xb2d0('0x1')]['import'](_0xb2d0('0xef'));db[_0xb2d0('0xf0')]=db['sequelize']['import'](_0xb2d0('0xf1'));db['Attachment']=db['sequelize']['import'](_0xb2d0('0xf2'));db[_0xb2d0('0xf3')]=db[_0xb2d0('0x1')]['import']('../api/plugin/plugin.model');db['MailTransferReport']=db['sequelize'][_0xb2d0('0x13')]('../api/mailTransferReport/mailTransferReport.model');db[_0xb2d0('0xf4')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xf5'));db[_0xb2d0('0xf6')]=db['sequelize'][_0xb2d0('0x13')]('../api/faxTransferReport/faxTransferReport.model');db[_0xb2d0('0xf7')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/openchannelTransferReport/openchannelTransferReport.model');db['SmsTransferReport']=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0xf8'));db[_0xb2d0('0xf9')]=db['sequelize'][_0xb2d0('0x13')]('../api/cmList/cmList.model');db[_0xb2d0('0xfa')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/voicePrefix/voicePrefix.model');db[_0xb2d0('0xfb')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xfc'));db[_0xb2d0('0xfd')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0xfe'));db['UserProfileResource']=db[_0xb2d0('0x1')]['import'](_0xb2d0('0xff'));db['UserNotification']=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/userNotification/userNotification.model');db[_0xb2d0('0x100')]=db['sequelize']['import']('../api/whatsappAccount/whatsappAccount.model');db[_0xb2d0('0x101')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')]('../api/whatsappApplication/whatsappApplication.model');db['WhatsappInteraction']=db[_0xb2d0('0x1')]['import']('../api/whatsappInteraction/whatsappInteraction.model');db[_0xb2d0('0x102')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x103'));db[_0xb2d0('0x104')]=db['sequelize'][_0xb2d0('0x13')](_0xb2d0('0x105'));db[_0xb2d0('0x106')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x107'));db[_0xb2d0('0x108')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x109'));db[_0xb2d0('0x10a')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x10b'));db[_0xb2d0('0x10c')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x10d'));db[_0xb2d0('0x10e')]=db[_0xb2d0('0x1')][_0xb2d0('0x13')](_0xb2d0('0x10f'));db['User'][_0xb2d0('0x110')](db[_0xb2d0('0x22')],{'as':_0xb2d0('0x22'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x12')][_0xb2d0('0x113')](db['VoiceRecording'],{'as':_0xb2d0('0x114'),'foreignKey':'UserId'});db['User'][_0xb2d0('0x113')](db[_0xb2d0('0x33')],{'as':_0xb2d0('0x115'),'foreignKey':_0xb2d0('0x112')});db['User']['hasMany'](db[_0xb2d0('0x18')],{'as':_0xb2d0('0x116'),'onDelete':_0xb2d0('0x111'),'hooks':!![]});db['User'][_0xb2d0('0x113')](db[_0xb2d0('0x7e')],{'as':_0xb2d0('0x117'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x12')][_0xb2d0('0x113')](db['CmHopperHistory'],{'as':'HopperHistory','foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x12')][_0xb2d0('0x113')](db[_0xb2d0('0x80')],{'as':_0xb2d0('0x80'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x12')][_0xb2d0('0x113')](db[_0xb2d0('0x64')],{'as':_0xb2d0('0x118'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x12')][_0xb2d0('0x113')](db[_0xb2d0('0x119')],{'as':_0xb2d0('0x11a'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x12')][_0xb2d0('0x113')](db['SmsInteraction'],{'as':_0xb2d0('0x11b'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x12')][_0xb2d0('0x113')](db[_0xb2d0('0x53')],{'as':_0xb2d0('0x11c'),'foreignKey':'UserId'});db['User']['hasMany'](db[_0xb2d0('0x46')],{'as':_0xb2d0('0x11d'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x12')][_0xb2d0('0x113')](db[_0xb2d0('0x11e')],{'as':'WhatsappInteractions','foreignKey':'UserId'});db[_0xb2d0('0x12')]['hasMany'](db[_0xb2d0('0x11f')],{'as':_0xb2d0('0x120'),'foreignKey':_0xb2d0('0x121')});db['User'][_0xb2d0('0x122')](db[_0xb2d0('0xfb')],{'as':'UserProfile','foreignKey':_0xb2d0('0x123')});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x73')],{'as':'Groups','through':_0xb2d0('0x125')});db[_0xb2d0('0x12')]['belongsToMany'](db[_0xb2d0('0x78')],{'as':'Contacts','through':_0xb2d0('0x126')});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db['CmList'],{'as':_0xb2d0('0x127'),'through':'cm_user_has_lists'});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0xea')],{'through':'user_has_teams'});db['User'][_0xb2d0('0x124')](db[_0xb2d0('0x46')],{'as':_0xb2d0('0x11d'),'through':'user_has_mail_interactions'});db[_0xb2d0('0x12')]['belongsToMany'](db[_0xb2d0('0x119')],{'as':'ChatInteractions','through':_0xb2d0('0x128')});db['User'][_0xb2d0('0x124')](db[_0xb2d0('0x53')],{'as':_0xb2d0('0x11c'),'through':_0xb2d0('0x129')});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x12a')],{'as':_0xb2d0('0x11b'),'through':'user_has_sms_interactions'});db[_0xb2d0('0x12')]['belongsToMany'](db['OpenchannelInteraction'],{'as':_0xb2d0('0x118'),'through':_0xb2d0('0x12b')});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x11e')],{'as':'WhatsappInteractions','through':'user_has_whatsapp_interactions'});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x1c')],{'as':_0xb2d0('0x12c'),'through':_0xb2d0('0x34'),'required':![]});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x42')],{'as':'MailQueues','through':_0xb2d0('0x38'),'required':![]});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x12d')],{'as':_0xb2d0('0x12e'),'through':_0xb2d0('0x36'),'required':![],'hooks':!![]});db['User'][_0xb2d0('0x124')](db['FaxQueue'],{'as':_0xb2d0('0x12f'),'through':'UserFaxQueue','required':![]});db[_0xb2d0('0x12')]['belongsToMany'](db[_0xb2d0('0x5f')],{'as':'SmsQueues','through':_0xb2d0('0x130'),'required':![]});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x68')],{'as':_0xb2d0('0x131'),'through':_0xb2d0('0x3c'),'required':![]});db[_0xb2d0('0x12')]['belongsToMany'](db[_0xb2d0('0x108')],{'as':_0xb2d0('0x132'),'through':'UserWhatsappQueue','required':![]});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db['CmList'],{'through':_0xb2d0('0x133')});db['User']['belongsToMany'](db[_0xb2d0('0xfa')],{'as':_0xb2d0('0x134'),'through':'user_has_voice_prefixes','required':![]});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x6a')],{'as':_0xb2d0('0x135'),'through':_0xb2d0('0x136')});db['User'][_0xb2d0('0x124')](db[_0xb2d0('0x51')],{'as':'FaxAccounts','through':_0xb2d0('0x137')});db['User'][_0xb2d0('0x124')](db[_0xb2d0('0x138')],{'as':'MailAccounts','through':_0xb2d0('0x139')});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x61')],{'as':_0xb2d0('0x13a'),'through':_0xb2d0('0x13b')});db[_0xb2d0('0x12')]['belongsToMany'](db['SmsAccount'],{'as':_0xb2d0('0x13c'),'through':'user_has_sms_accounts'});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db['WhatsappAccount'],{'as':_0xb2d0('0x13d'),'through':'user_has_whatsapp_accounts'});db[_0xb2d0('0x12')][_0xb2d0('0x124')](db[_0xb2d0('0x13e')],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0xb2d0('0x15')]['hasMany'](db['VoiceExtension'],{'as':_0xb2d0('0x13f'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x140')});db[_0xb2d0('0x16')][_0xb2d0('0x113')](db[_0xb2d0('0x18')],{'onDelete':_0xb2d0('0x111')});db['VoiceExtension'][_0xb2d0('0x113')](db['VoiceExtension'],{'as':_0xb2d0('0x141'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x1a')][_0xb2d0('0x124')](db[_0xb2d0('0x91')],{'as':_0xb2d0('0x142'),'through':_0xb2d0('0x143')});db[_0xb2d0('0x1c')][_0xb2d0('0x113')](db[_0xb2d0('0x33')],{'as':_0xb2d0('0x144'),'foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0xb2d0('0x113')](db['CmHopper'],{'as':_0xb2d0('0x145'),'foreignKey':_0xb2d0('0x146')});db[_0xb2d0('0x1c')]['hasMany'](db[_0xb2d0('0x7e')],{'as':_0xb2d0('0x117'),'foreignKey':_0xb2d0('0x146')});db['VoiceQueue']['hasMany'](db['CmHopperHistory'],{'as':_0xb2d0('0x147'),'foreignKey':'VoiceQueueId'});db[_0xb2d0('0x1c')]['hasMany'](db[_0xb2d0('0x80')],{'as':'ReportAgentPreview','foreignKey':_0xb2d0('0x146')});db[_0xb2d0('0x1c')][_0xb2d0('0x113')](db[_0xb2d0('0x7c')],{'as':_0xb2d0('0x148'),'foreignKey':_0xb2d0('0x146')});db[_0xb2d0('0x1c')][_0xb2d0('0x113')](db['JscriptySessionReport'],{'as':_0xb2d0('0x149'),'foreignKey':_0xb2d0('0x146')});db[_0xb2d0('0x1c')][_0xb2d0('0x122')](db['Trunk'],{'as':_0xb2d0('0x30'),'foreignKey':_0xb2d0('0x14a')});db[_0xb2d0('0x1c')][_0xb2d0('0x122')](db[_0xb2d0('0x30')],{'as':_0xb2d0('0x14b'),'foreignKey':_0xb2d0('0x14c')});db['VoiceQueue'][_0xb2d0('0x122')](db[_0xb2d0('0x8c')],{'as':_0xb2d0('0x8c'),'foreignKey':'IntervalId'});db[_0xb2d0('0x1c')][_0xb2d0('0x122')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0xb2d0('0x14d')});db[_0xb2d0('0x1c')][_0xb2d0('0x124')](db['CmList'],{'as':_0xb2d0('0x127'),'through':_0xb2d0('0x14e')});db[_0xb2d0('0x1c')][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':'Agents','through':_0xb2d0('0x34')});db[_0xb2d0('0x1c')][_0xb2d0('0x124')](db[_0xb2d0('0xea')],{'as':_0xb2d0('0x14f'),'through':'TeamVoiceQueue'});db['VoiceQueue'][_0xb2d0('0x124')](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x150'),'through':_0xb2d0('0x151')});db[_0xb2d0('0x1e')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x12'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x20')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'as':'User','foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x22')][_0xb2d0('0x113')](db[_0xb2d0('0x24')],{'as':_0xb2d0('0x152'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x153'),'sourceKey':_0xb2d0('0x154')});db[_0xb2d0('0x24')][_0xb2d0('0x122')](db[_0xb2d0('0x22')],{'foreignKey':'mailboxuser','targetKey':_0xb2d0('0x154')});db[_0xb2d0('0x26')][_0xb2d0('0x113')](db[_0xb2d0('0x2c')],{'as':_0xb2d0('0x155'),'foreignKey':_0xb2d0('0x156'),'constraints':![]});db[_0xb2d0('0x26')][_0xb2d0('0x113')](db[_0xb2d0('0x2a')],{'as':'AgentReports','foreignKey':'uniqueid','constraints':![]});db[_0xb2d0('0x26')][_0xb2d0('0x122')](db['User'],{'as':_0xb2d0('0x12'),'foreignKey':'UserId'});db[_0xb2d0('0x26')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':'ContactId'});db['MailServerIn'][_0xb2d0('0x122')](db[_0xb2d0('0x138')],{'as':_0xb2d0('0x138'),'foreignKey':_0xb2d0('0x158')});db['MailServerOut'][_0xb2d0('0x122')](db[_0xb2d0('0x138')],{'as':_0xb2d0('0x138'),'foreignKey':_0xb2d0('0x158')});db[_0xb2d0('0x138')][_0xb2d0('0x110')](db['MailServerIn'],{'as':_0xb2d0('0x159'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x138')][_0xb2d0('0x110')](db[_0xb2d0('0x3f')],{'as':_0xb2d0('0x15a'),'onDelete':'cascade'});db[_0xb2d0('0x138')][_0xb2d0('0x113')](db[_0xb2d0('0x15b')],{'as':_0xb2d0('0x15c'),'foreignKey':_0xb2d0('0x158')});db['MailAccount'][_0xb2d0('0x113')](db[_0xb2d0('0x88')],{'as':_0xb2d0('0x15d'),'foreignKey':_0xb2d0('0x158')});db[_0xb2d0('0x138')][_0xb2d0('0x113')](db[_0xb2d0('0x47')],{'as':_0xb2d0('0x152'),'foreignKey':_0xb2d0('0x158')});db['MailAccount']['hasMany'](db['MailInteraction'],{'as':_0xb2d0('0x15e')});db[_0xb2d0('0x138')][_0xb2d0('0x113')](db[_0xb2d0('0x49')],{'as':_0xb2d0('0x141')});db['MailAccount'][_0xb2d0('0x122')](db[_0xb2d0('0xf9')],{'as':'List','foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0x138')][_0xb2d0('0x122')](db[_0xb2d0('0x95')],{'as':'Template','foreignKey':_0xb2d0('0x160')});db[_0xb2d0('0x138')][_0xb2d0('0x122')](db[_0xb2d0('0x8d')],{'as':'mandatoryDispositionPause','foreignKey':_0xb2d0('0x14d')});db[_0xb2d0('0x138')][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x161'),'through':_0xb2d0('0x139')});db[_0xb2d0('0x42')]['belongsToMany'](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x161'),'through':_0xb2d0('0x38')});db[_0xb2d0('0x42')][_0xb2d0('0x124')](db[_0xb2d0('0xea')],{'through':_0xb2d0('0x162'),'as':_0xb2d0('0x14f')});db['MailInteraction'][_0xb2d0('0x113')](db[_0xb2d0('0x47')],{'as':_0xb2d0('0x152'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x163')});db[_0xb2d0('0x46')]['belongsTo'](db[_0xb2d0('0x138')],{'as':'Account','foreignKey':_0xb2d0('0x158')});db['MailInteraction']['belongsTo'](db['CmContact'],{'as':_0xb2d0('0x157'),'foreignKey':_0xb2d0('0x164')});db['MailInteraction']['belongsTo'](db[_0xb2d0('0x12')],{'as':'Owner','foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x46')][_0xb2d0('0x124')](db[_0xb2d0('0x93')],{'through':_0xb2d0('0x165'),'as':_0xb2d0('0x166')});db[_0xb2d0('0x46')][_0xb2d0('0x124')](db['Tag'],{'through':_0xb2d0('0x165'),'as':_0xb2d0('0x167')});db[_0xb2d0('0x46')][_0xb2d0('0x124')](db['User'],{'as':_0xb2d0('0x168'),'through':_0xb2d0('0x169'),'foreignKey':_0xb2d0('0x163')});db[_0xb2d0('0x47')]['hasMany'](db['Attachment'],{'as':_0xb2d0('0x16a'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x47')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x12')});db[_0xb2d0('0x47')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'onDelete':_0xb2d0('0x111'),'as':_0xb2d0('0x157')});db['MailMessage']['belongsTo'](db[_0xb2d0('0x46')],{'as':_0xb2d0('0x16b'),'foreignKey':_0xb2d0('0x163')});db['MailMessage'][_0xb2d0('0x122')](db[_0xb2d0('0x138')],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x158')});db[_0xb2d0('0x47')][_0xb2d0('0x122')](db[_0xb2d0('0x6a')],{'as':'ChatWebsite','foreignKey':_0xb2d0('0x16d')});db[_0xb2d0('0x47')][_0xb2d0('0x122')](db['ChatOfflineMessage'],{'as':_0xb2d0('0x71'),'foreignKey':_0xb2d0('0x16e')});db[_0xb2d0('0x49')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x49')][_0xb2d0('0x122')](db[_0xb2d0('0x42')],{'onDelete':_0xb2d0('0x16f')});db['MailApplication']['belongsTo'](db[_0xb2d0('0x138')],{'onDelete':'restrict'});db['MailApplication'][_0xb2d0('0x122')](db[_0xb2d0('0x8c')],{'onDelete':_0xb2d0('0x16f'),'foreignKey':_0xb2d0('0x170')});db[_0xb2d0('0x49')][_0xb2d0('0x122')](db[_0xb2d0('0x93')],{'onDelete':_0xb2d0('0x16f'),'foreignKey':_0xb2d0('0x171')});db[_0xb2d0('0x4b')][_0xb2d0('0x122')](db[_0xb2d0('0x138')],{});db[_0xb2d0('0x4b')]['belongsTo'](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f')});db['MailQueueReport'][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':_0xb2d0('0x164')});db['MailQueueReport'][_0xb2d0('0x122')](db[_0xb2d0('0x46')],{});db[_0xb2d0('0x4b')][_0xb2d0('0x122')](db[_0xb2d0('0x47')],{});db['MailQueueReport'][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{});db[_0xb2d0('0x4b')][_0xb2d0('0x122')](db[_0xb2d0('0x42')],{});db[_0xb2d0('0x4d')][_0xb2d0('0x113')](db[_0xb2d0('0x4f')],{'as':'Items','onDelete':'cascade'});db[_0xb2d0('0x51')][_0xb2d0('0x113')](db['Disposition'],{'as':_0xb2d0('0x15c'),'foreignKey':_0xb2d0('0x173')});db[_0xb2d0('0x51')][_0xb2d0('0x113')](db[_0xb2d0('0x88')],{'as':_0xb2d0('0x15d'),'foreignKey':_0xb2d0('0x173')});db[_0xb2d0('0x51')][_0xb2d0('0x113')](db[_0xb2d0('0x53')],{'as':'Interactions'});db[_0xb2d0('0x51')][_0xb2d0('0x113')](db[_0xb2d0('0x52')],{'as':_0xb2d0('0x141')});db[_0xb2d0('0x51')][_0xb2d0('0x113')](db[_0xb2d0('0x18')],{'as':_0xb2d0('0x174'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x51')][_0xb2d0('0x113')](db[_0xb2d0('0x54')],{'as':_0xb2d0('0x152')});db[_0xb2d0('0x51')][_0xb2d0('0x122')](db[_0xb2d0('0x30')],{'as':_0xb2d0('0x30')});db[_0xb2d0('0x51')][_0xb2d0('0x122')](db[_0xb2d0('0xf9')],{'as':'List','foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0x51')][_0xb2d0('0x122')](db[_0xb2d0('0x8d')],{'as':_0xb2d0('0x175'),'foreignKey':_0xb2d0('0x14d')});db['FaxAccount']['belongsToMany'](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x161'),'through':_0xb2d0('0x137')});db[_0xb2d0('0x52')]['belongsTo'](db[_0xb2d0('0x12')],{'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x52')][_0xb2d0('0x122')](db[_0xb2d0('0x56')],{'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x52')][_0xb2d0('0x122')](db[_0xb2d0('0x51')],{'onDelete':'restrict'});db[_0xb2d0('0x52')][_0xb2d0('0x122')](db['Tag'],{'onDelete':_0xb2d0('0x16f'),'foreignKey':_0xb2d0('0x171')});db[_0xb2d0('0x53')]['hasMany'](db[_0xb2d0('0x54')],{'as':_0xb2d0('0x152'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x176')});db[_0xb2d0('0x53')]['belongsTo'](db['FaxAccount'],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x173')});db[_0xb2d0('0x53')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':'Contact','foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x53')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x177'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x53')][_0xb2d0('0x124')](db[_0xb2d0('0x93')],{'through':_0xb2d0('0x178'),'as':_0xb2d0('0x166')});db[_0xb2d0('0x53')][_0xb2d0('0x124')](db[_0xb2d0('0x93')],{'through':_0xb2d0('0x178'),'as':'ThroughTags'});db[_0xb2d0('0x53')][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x168'),'through':_0xb2d0('0x129'),'foreignKey':_0xb2d0('0x176')});db['FaxMessage'][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'onDelete':_0xb2d0('0x111'),'as':_0xb2d0('0x12')});db[_0xb2d0('0x54')]['belongsTo'](db[_0xb2d0('0x53')],{'as':'Interaction','foreignKey':_0xb2d0('0x176')});db[_0xb2d0('0x54')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'onDelete':'cascade','as':_0xb2d0('0x157')});db[_0xb2d0('0x54')]['belongsTo'](db[_0xb2d0('0x179')],{'as':_0xb2d0('0x179'),'foreignKey':_0xb2d0('0x17a')});db[_0xb2d0('0x54')]['belongsTo'](db[_0xb2d0('0x51')],{'as':'Account','foreignKey':_0xb2d0('0x173')});db['FaxQueue'][_0xb2d0('0x124')](db['User'],{'as':_0xb2d0('0x161'),'through':_0xb2d0('0x17b')});db[_0xb2d0('0x56')][_0xb2d0('0x124')](db[_0xb2d0('0xea')],{'through':'team_has_fax_queues','as':_0xb2d0('0x14f')});db[_0xb2d0('0x58')]['belongsTo'](db[_0xb2d0('0x51')],{});db[_0xb2d0('0x58')][_0xb2d0('0x122')](db['CmList'],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0x58')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':'ContactId'});db[_0xb2d0('0x58')][_0xb2d0('0x122')](db[_0xb2d0('0x53')],{});db[_0xb2d0('0x58')][_0xb2d0('0x122')](db[_0xb2d0('0x54')],{});db[_0xb2d0('0x58')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{});db['FaxQueueReport'][_0xb2d0('0x122')](db[_0xb2d0('0x56')],{});db['SmsAccount']['hasMany'](db[_0xb2d0('0x15b')],{'as':'Dispositions','foreignKey':'SmsAccountId'});db[_0xb2d0('0x5a')][_0xb2d0('0x113')](db[_0xb2d0('0x88')],{'as':_0xb2d0('0x15d'),'foreignKey':'SmsAccountId'});db[_0xb2d0('0x5a')][_0xb2d0('0x113')](db['SmsMessage'],{'as':_0xb2d0('0x152'),'foreignKey':_0xb2d0('0x17c')});db[_0xb2d0('0x5a')][_0xb2d0('0x113')](db['SmsInteraction'],{'as':_0xb2d0('0x15e')});db['SmsAccount'][_0xb2d0('0x113')](db['SmsApplication'],{'as':_0xb2d0('0x141')});db[_0xb2d0('0x5a')][_0xb2d0('0x122')](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f')});db['SmsAccount'][_0xb2d0('0x122')](db['Pause'],{'as':_0xb2d0('0x175'),'foreignKey':_0xb2d0('0x14d')});db[_0xb2d0('0x5a')][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':'Agents','through':_0xb2d0('0x17d')});db['SmsApplication'][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'onDelete':_0xb2d0('0x16f')});db['SmsApplication']['belongsTo'](db[_0xb2d0('0x5f')],{'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x5c')][_0xb2d0('0x122')](db[_0xb2d0('0x5a')],{'onDelete':_0xb2d0('0x16f')});db['SmsApplication'][_0xb2d0('0x122')](db[_0xb2d0('0x8c')],{'onDelete':_0xb2d0('0x16f'),'foreignKey':_0xb2d0('0x170')});db[_0xb2d0('0x5c')][_0xb2d0('0x122')](db[_0xb2d0('0x93')],{'onDelete':'restrict','foreignKey':_0xb2d0('0x171')});db[_0xb2d0('0x12a')][_0xb2d0('0x113')](db[_0xb2d0('0x5e')],{'as':'Messages','onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x17e')});db[_0xb2d0('0x12a')][_0xb2d0('0x122')](db[_0xb2d0('0x5a')],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x17c')});db['SmsInteraction'][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x12a')]['belongsTo'](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x177'),'foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x12a')][_0xb2d0('0x124')](db['Tag'],{'through':_0xb2d0('0x17f'),'as':_0xb2d0('0x166')});db[_0xb2d0('0x12a')]['belongsToMany'](db['Tag'],{'through':_0xb2d0('0x17f'),'as':_0xb2d0('0x167')});db['SmsInteraction']['belongsToMany'](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x168'),'through':_0xb2d0('0x180'),'foreignKey':_0xb2d0('0x17e')});db[_0xb2d0('0x5e')]['belongsTo'](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x12')});db[_0xb2d0('0x5e')][_0xb2d0('0x122')](db['CmContact'],{'onDelete':_0xb2d0('0x111'),'as':_0xb2d0('0x157')});db[_0xb2d0('0x5e')][_0xb2d0('0x122')](db[_0xb2d0('0x12a')],{'onDelete':_0xb2d0('0x111'),'as':_0xb2d0('0x16b'),'foreignKey':_0xb2d0('0x17e')});db['SmsMessage'][_0xb2d0('0x122')](db[_0xb2d0('0x5a')],{'as':_0xb2d0('0x16c'),'foreignKey':'SmsAccountId'});db[_0xb2d0('0x5f')][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x161'),'through':_0xb2d0('0x130'),'foreignKey':_0xb2d0('0x181')});db[_0xb2d0('0x5f')][_0xb2d0('0x124')](db[_0xb2d0('0xea')],{'through':_0xb2d0('0x182'),'as':'Teams'});db[_0xb2d0('0x61')]['hasMany'](db['Disposition'],{'as':_0xb2d0('0x15c'),'foreignKey':_0xb2d0('0x183')});db[_0xb2d0('0x61')][_0xb2d0('0x113')](db[_0xb2d0('0x88')],{'as':_0xb2d0('0x15d'),'foreignKey':_0xb2d0('0x183')});db[_0xb2d0('0x61')][_0xb2d0('0x113')](db[_0xb2d0('0x64')],{'as':_0xb2d0('0x15e'),'foreignKey':_0xb2d0('0x183')});db[_0xb2d0('0x61')][_0xb2d0('0x113')](db[_0xb2d0('0x66')],{'as':_0xb2d0('0x152'),'foreignKey':_0xb2d0('0x183')});db[_0xb2d0('0x61')][_0xb2d0('0x113')](db[_0xb2d0('0x63')],{'as':_0xb2d0('0x141'),'foreignKey':_0xb2d0('0x183')});db[_0xb2d0('0x61')][_0xb2d0('0x122')](db['CmList'],{'as':'List','foreignKey':_0xb2d0('0x15f')});db['OpenchannelAccount'][_0xb2d0('0x122')](db[_0xb2d0('0x8d')],{'as':_0xb2d0('0x175'),'foreignKey':'mandatoryDispositionPauseId'});db['OpenchannelAccount'][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':'Agents','through':_0xb2d0('0x13b')});db[_0xb2d0('0x63')]['belongsTo'](db['User'],{'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x63')][_0xb2d0('0x122')](db[_0xb2d0('0x68')],{'onDelete':_0xb2d0('0x16f'),'foreignKey':'OpenchannelQueueId'});db[_0xb2d0('0x63')][_0xb2d0('0x122')](db['OpenchannelAccount'],{'onDelete':_0xb2d0('0x16f'),'foreignKey':_0xb2d0('0x183')});db[_0xb2d0('0x63')][_0xb2d0('0x122')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xb2d0('0x170')});db[_0xb2d0('0x63')]['belongsTo'](db[_0xb2d0('0x93')],{'onDelete':_0xb2d0('0x16f'),'foreignKey':_0xb2d0('0x171')});db[_0xb2d0('0x64')][_0xb2d0('0x113')](db[_0xb2d0('0x66')],{'as':'Messages','onDelete':_0xb2d0('0x111'),'foreignKey':'OpenchannelInteractionId'});db['OpenchannelInteraction'][_0xb2d0('0x122')](db[_0xb2d0('0x61')],{'as':'Account','foreignKey':_0xb2d0('0x183')});db['OpenchannelInteraction'][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x64')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'as':'Owner','foreignKey':_0xb2d0('0x112')});db[_0xb2d0('0x64')]['belongsToMany'](db[_0xb2d0('0x93')],{'through':_0xb2d0('0x184'),'as':_0xb2d0('0x166')});db[_0xb2d0('0x64')][_0xb2d0('0x124')](db[_0xb2d0('0x93')],{'through':'openchannel_interaction_has_tags','as':_0xb2d0('0x167')});db[_0xb2d0('0x64')]['belongsToMany'](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x168'),'through':'user_has_openchannel_interactions','foreignKey':_0xb2d0('0x185')});db['OpenchannelMessage'][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'onDelete':_0xb2d0('0x111'),'as':'User'});db['OpenchannelMessage'][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'onDelete':_0xb2d0('0x111'),'as':_0xb2d0('0x157')});db['OpenchannelMessage'][_0xb2d0('0x122')](db[_0xb2d0('0x64')],{'onDelete':'cascade','as':_0xb2d0('0x16b'),'foreignKey':'OpenchannelInteractionId'});db[_0xb2d0('0x66')][_0xb2d0('0x122')](db[_0xb2d0('0x179')],{'as':_0xb2d0('0x179'),'foreignKey':_0xb2d0('0x17a')});db[_0xb2d0('0x66')][_0xb2d0('0x122')](db[_0xb2d0('0x61')],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x183')});db['OpenchannelQueue'][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':'Agents','through':_0xb2d0('0x3c'),'foreignKey':_0xb2d0('0x186')});db[_0xb2d0('0x68')][_0xb2d0('0x124')](db[_0xb2d0('0xea')],{'through':_0xb2d0('0x187'),'as':'Teams'});db[_0xb2d0('0x6a')][_0xb2d0('0x113')](db[_0xb2d0('0x15b')],{'as':_0xb2d0('0x15c'),'foreignKey':_0xb2d0('0x16d')});db[_0xb2d0('0x6a')]['hasMany'](db[_0xb2d0('0x88')],{'as':_0xb2d0('0x15d'),'foreignKey':'ChatWebsiteId'});db['ChatWebsite']['hasMany'](db[_0xb2d0('0x75')],{'as':_0xb2d0('0x188')});db[_0xb2d0('0x6a')][_0xb2d0('0x113')](db[_0xb2d0('0x119')],{'as':_0xb2d0('0x15e')});db[_0xb2d0('0x6a')][_0xb2d0('0x113')](db['ChatApplication'],{'as':_0xb2d0('0x141')});db['ChatWebsite']['hasMany'](db[_0xb2d0('0x6f')],{'as':_0xb2d0('0x152')});db[_0xb2d0('0x6a')]['belongsTo'](db[_0xb2d0('0xf9')],{'as':'List','foreignKey':'ListId'});db[_0xb2d0('0x6a')]['belongsTo'](db[_0xb2d0('0x8c')],{'as':_0xb2d0('0x8c'),'foreignKey':_0xb2d0('0x170')});db[_0xb2d0('0x6a')][_0xb2d0('0x122')](db[_0xb2d0('0x138')],{'as':_0xb2d0('0x138'),'foreignKey':_0xb2d0('0x158')});db['ChatWebsite'][_0xb2d0('0x122')](db[_0xb2d0('0x8d')],{'as':_0xb2d0('0x175'),'foreignKey':_0xb2d0('0x14d')});db[_0xb2d0('0x6a')][_0xb2d0('0x124')](db['User'],{'as':_0xb2d0('0x161'),'through':'user_has_chat_websites'});db['OpenchannelQueueReport'][_0xb2d0('0x122')](db['OpenchannelAccount'],{});db[_0xb2d0('0x6b')][_0xb2d0('0x122')](db['CmList'],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0x6b')]['belongsTo'](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x6b')][_0xb2d0('0x122')](db[_0xb2d0('0x64')],{});db[_0xb2d0('0x6b')][_0xb2d0('0x122')](db[_0xb2d0('0x66')],{});db['OpenchannelQueueReport']['belongsTo'](db['User'],{});db['OpenchannelQueueReport'][_0xb2d0('0x122')](db[_0xb2d0('0x68')],{});db[_0xb2d0('0x6d')][_0xb2d0('0x122')](db['User'],{'as':_0xb2d0('0x189'),'foreignKey':_0xb2d0('0x112'),'onDelete':'restrict'});db[_0xb2d0('0x6d')][_0xb2d0('0x122')](db['ChatQueue'],{'as':_0xb2d0('0x18a'),'foreignKey':_0xb2d0('0x18b'),'onDelete':'restrict'});db['ChatApplication'][_0xb2d0('0x122')](db[_0xb2d0('0x6a')],{'as':_0xb2d0('0x18c'),'foreignKey':_0xb2d0('0x16d'),'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x6d')][_0xb2d0('0x122')](db[_0xb2d0('0x93')],{'onDelete':_0xb2d0('0x16f'),'foreignKey':_0xb2d0('0x171')});db[_0xb2d0('0x119')]['hasMany'](db[_0xb2d0('0x6f')],{'as':_0xb2d0('0x152'),'onDelete':'cascade','foreignKey':_0xb2d0('0x18d')});db[_0xb2d0('0x119')][_0xb2d0('0x122')](db['ChatWebsite'],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x16d')});db[_0xb2d0('0x119')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':'ContactId'});db[_0xb2d0('0x119')][_0xb2d0('0x122')](db['User'],{'as':_0xb2d0('0x177'),'foreignKey':_0xb2d0('0x112')});db['ChatInteraction']['belongsToMany'](db[_0xb2d0('0x93')],{'through':'chat_interaction_has_tags','as':_0xb2d0('0x166')});db[_0xb2d0('0x119')]['belongsToMany'](db[_0xb2d0('0x93')],{'through':_0xb2d0('0x18e'),'as':'ThroughTags'});db[_0xb2d0('0x119')][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x168'),'through':_0xb2d0('0x128'),'foreignKey':'ChatInteractionId'});db[_0xb2d0('0x6f')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'onDelete':_0xb2d0('0x111'),'as':'User'});db[_0xb2d0('0x6f')][_0xb2d0('0x122')](db['CmContact'],{'onDelete':'cascade','as':_0xb2d0('0x157'),'foreignKey':'ContactId'});db[_0xb2d0('0x6f')]['belongsTo'](db['ChatInteraction'],{'onDelete':_0xb2d0('0x111'),'as':'Interaction','foreignKey':_0xb2d0('0x18d')});db[_0xb2d0('0x6f')][_0xb2d0('0x122')](db['Attachment'],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0xb2d0('0x6f')]['belongsTo'](db['ChatWebsite'],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x16d')});db['ChatOfflineMessage']['hasMany'](db[_0xb2d0('0x179')],{'as':_0xb2d0('0x16a'),'foreignKey':_0xb2d0('0x16e'),'onDelete':_0xb2d0('0x111'),'hooks':!![]});db[_0xb2d0('0x71')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'onDelete':_0xb2d0('0x111'),'as':_0xb2d0('0x157'),'foreignKey':'ContactId'});db[_0xb2d0('0x71')][_0xb2d0('0x122')](db[_0xb2d0('0x6a')],{'as':_0xb2d0('0x16c'),'foreignKey':'ChatWebsiteId'});db[_0xb2d0('0x12d')]['belongsToMany'](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x161'),'through':_0xb2d0('0x36'),'hooks':!![]});db['ChatQueue'][_0xb2d0('0x124')](db[_0xb2d0('0xea')],{'through':_0xb2d0('0x18f'),'as':_0xb2d0('0x14f')});db[_0xb2d0('0x73')][_0xb2d0('0x113')](db[_0xb2d0('0xd8')],{'as':'Messages','foreignKey':_0xb2d0('0x190'),'onDelete':'cascade'});db[_0xb2d0('0x73')][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x144'),'through':'chat_group_has_users'});db[_0xb2d0('0x75')][_0xb2d0('0x122')](db[_0xb2d0('0x6a')],{'as':_0xb2d0('0x18c'),'foreignKey':_0xb2d0('0x16d')});db[_0xb2d0('0x77')][_0xb2d0('0x113')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x191'),'foreignKey':_0xb2d0('0x192')});db[_0xb2d0('0x78')][_0xb2d0('0x113')](db[_0xb2d0('0x7a')],{'as':_0xb2d0('0x145'),'foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x78')][_0xb2d0('0x113')](db[_0xb2d0('0x7e')],{'as':_0xb2d0('0x117'),'foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x78')][_0xb2d0('0x113')](db['CmHopperHistory'],{'as':_0xb2d0('0x147'),'foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x78')][_0xb2d0('0x113')](db[_0xb2d0('0x80')],{'as':_0xb2d0('0x80'),'foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x78')][_0xb2d0('0x113')](db[_0xb2d0('0x193')],{'as':_0xb2d0('0x149'),'foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x78')][_0xb2d0('0x113')](db['OpenchannelInteraction'],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':'restrict'});db['CmContact'][_0xb2d0('0x113')](db[_0xb2d0('0x119')],{'as':_0xb2d0('0x11a'),'foreignKey':_0xb2d0('0x164'),'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x78')][_0xb2d0('0x113')](db[_0xb2d0('0x12a')],{'as':_0xb2d0('0x11b'),'foreignKey':_0xb2d0('0x164'),'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x78')][_0xb2d0('0x113')](db[_0xb2d0('0x53')],{'as':_0xb2d0('0x11c'),'foreignKey':_0xb2d0('0x164'),'onDelete':_0xb2d0('0x16f')});db['CmContact']['hasMany'](db[_0xb2d0('0x46')],{'as':'MailInteractions','foreignKey':'ContactId','onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x78')]['belongsTo'](db[_0xb2d0('0x77')],{'as':_0xb2d0('0x194'),'foreignKey':_0xb2d0('0x192')});db['CmContact'][_0xb2d0('0x122')](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f'),'onDelete':'cascade'});db[_0xb2d0('0x78')][_0xb2d0('0x124')](db['User'],{'as':_0xb2d0('0x168'),'through':_0xb2d0('0x126')});db[_0xb2d0('0x78')]['belongsToMany'](db['Tag'],{'as':_0xb2d0('0x166'),'through':_0xb2d0('0x195')});db['CmContact'][_0xb2d0('0x124')](db[_0xb2d0('0x93')],{'through':_0xb2d0('0x195'),'as':_0xb2d0('0x167')});db[_0xb2d0('0x7a')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':'ContactId','onDelete':'cascade'});db[_0xb2d0('0x7a')][_0xb2d0('0x122')](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x7a')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x189'),'foreignKey':'UserId'});db[_0xb2d0('0x7a')][_0xb2d0('0x122')](db['VoiceQueue'],{'as':_0xb2d0('0x18a'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0xb2d0('0x7a')]['belongsTo'](db[_0xb2d0('0xee')],{'as':_0xb2d0('0xee'),'foreignKey':'CampaignId','onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x7a')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'as':'Owner','foreignKey':'OwnerId'});db[_0xb2d0('0x7c')]['belongsTo'](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':_0xb2d0('0x164'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x7c')][_0xb2d0('0x122')](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x172'),'foreignKey':'ListId','onDelete':'cascade'});db[_0xb2d0('0x7c')]['belongsTo'](db[_0xb2d0('0x1c')],{'as':_0xb2d0('0x18a'),'foreignKey':_0xb2d0('0x146'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x7c')]['belongsTo'](db[_0xb2d0('0xee')],{'as':_0xb2d0('0xee'),'foreignKey':'CampaignId','onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x86')]['hasMany'](db[_0xb2d0('0x8a')],{'as':{'plural':_0xb2d0('0x196'),'singular':_0xb2d0('0x197')},'foreignKey':_0xb2d0('0x198'),'onDelete':_0xb2d0('0x111'),'hooks':!![]});db['Automation'][_0xb2d0('0x113')](db[_0xb2d0('0x8a')],{'as':{'plural':'Any','singular':_0xb2d0('0x199')},'foreignKey':_0xb2d0('0x19a'),'onDelete':_0xb2d0('0x111'),'hooks':!![]});db[_0xb2d0('0x86')][_0xb2d0('0x113')](db['Action'],{'as':_0xb2d0('0x19b'),'foreignKey':_0xb2d0('0x19c'),'onDelete':_0xb2d0('0x111'),'hooks':!![]});db[_0xb2d0('0x15b')][_0xb2d0('0x113')](db['Disposition'],{'as':_0xb2d0('0x15c'),'foreignKey':_0xb2d0('0x19d'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x8c')][_0xb2d0('0x113')](db[_0xb2d0('0x8c')],{'as':_0xb2d0('0x19e'),'foreignKey':_0xb2d0('0x170'),'onDelete':_0xb2d0('0x111'),'hooks':!![],'required':![]});db[_0xb2d0('0x8c')][_0xb2d0('0x113')](db['VoiceExtension'],{'as':'Extensions','foreignKey':_0xb2d0('0x170'),'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x8c')]['hasMany'](db[_0xb2d0('0x49')],{'as':'MailApplications','foreignKey':_0xb2d0('0x170')});db[_0xb2d0('0x8c')][_0xb2d0('0x113')](db['ChatApplication'],{'as':_0xb2d0('0x19f'),'foreignKey':_0xb2d0('0x170')});db[_0xb2d0('0x8c')][_0xb2d0('0x113')](db[_0xb2d0('0x52')],{'as':_0xb2d0('0x1a0'),'foreignKey':'IntervalId'});db[_0xb2d0('0x8c')][_0xb2d0('0x113')](db['SmsApplication'],{'as':'SmsApplications','foreignKey':_0xb2d0('0x170')});db[_0xb2d0('0x1a1')][_0xb2d0('0x122')](db[_0xb2d0('0x138')],{});db['Schedule']['belongsTo'](db['AnalyticDefaultReport'],{'foreignKey':_0xb2d0('0x1a2')});db['Schedule']['belongsTo'](db[_0xb2d0('0x9d')],{'foreignKey':'CustomReportId'});db['Sound'][_0xb2d0('0x124')](db[_0xb2d0('0x1a')],{'as':_0xb2d0('0x1a3'),'through':_0xb2d0('0x143'),'onDelete':'restrict'});db[_0xb2d0('0x93')][_0xb2d0('0x124')](db['CmContact'],{'through':'cm_contact_has_tags'});db[_0xb2d0('0x93')][_0xb2d0('0x124')](db['ChatInteraction'],{'through':'chat_interaction_has_tags'});db['Tag'][_0xb2d0('0x124')](db['MailInteraction'],{'through':_0xb2d0('0x165')});db[_0xb2d0('0x93')][_0xb2d0('0x124')](db[_0xb2d0('0x12a')],{'through':_0xb2d0('0x17f')});db[_0xb2d0('0x93')]['belongsToMany'](db[_0xb2d0('0x53')],{'through':_0xb2d0('0x178')});db[_0xb2d0('0x93')][_0xb2d0('0x124')](db[_0xb2d0('0x64')],{'through':_0xb2d0('0x184')});db[_0xb2d0('0x93')]['belongsToMany'](db[_0xb2d0('0x11e')],{'through':_0xb2d0('0x1a4')});db[_0xb2d0('0x97')][_0xb2d0('0x113')](db[_0xb2d0('0x8a')],{'as':{'plural':_0xb2d0('0x1a5'),'singular':_0xb2d0('0x1a6')},'foreignKey':'TriggerAllId','onDelete':_0xb2d0('0x111'),'hooks':!![]});db['Trigger'][_0xb2d0('0x113')](db['Condition'],{'as':{'plural':'AnyConditions','singular':_0xb2d0('0x1a7')},'foreignKey':'TriggerAnyId','onDelete':'cascade','hooks':!![]});db[_0xb2d0('0x97')][_0xb2d0('0x113')](db['Action'],{'as':_0xb2d0('0x19b'),'foreignKey':_0xb2d0('0x1a8'),'onDelete':_0xb2d0('0x111'),'hooks':!![]});db[_0xb2d0('0x9d')][_0xb2d0('0x113')](db['AnalyticFieldReport'],{'as':'Fields','onDelete':'cascade','foreignKey':_0xb2d0('0x1a9'),'hooks':!![]});db[_0xb2d0('0x9e')][_0xb2d0('0x113')](db[_0xb2d0('0xa3')],{'as':_0xb2d0('0x1aa'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1a2')});db['AnalyticMetric']['hasMany'](db[_0xb2d0('0xa3')],{'as':_0xb2d0('0x1aa'),'onDelete':_0xb2d0('0x111'),'foreignKey':'MetricId'});db[_0xb2d0('0xa3')]['belongsTo'](db[_0xb2d0('0x1ab')],{'foreignKey':'MetricId'});db[_0xb2d0('0xa6')][_0xb2d0('0x113')](db['SalesforceConfiguration'],{'as':_0xb2d0('0x1ac'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1ad')});db['SalesforceConfiguration'][_0xb2d0('0x113')](db[_0xb2d0('0xa9')],{'as':_0xb2d0('0x1ae'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xa7')]['hasMany'](db[_0xb2d0('0xa9')],{'as':'Descriptions','onDelete':_0xb2d0('0x111'),'foreignKey':'DescriptionId'});db[_0xb2d0('0xa7')]['hasMany'](db[_0xb2d0('0xa9')],{'as':_0xb2d0('0x1aa'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xa7')]['belongsTo'](db['SalesforceAccount'],{'as':_0xb2d0('0x16c'),'foreignKey':'AccountId'});db[_0xb2d0('0xa9')][_0xb2d0('0x113')](db[_0xb2d0('0xa9')],{'as':_0xb2d0('0x1b1'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xa9')][_0xb2d0('0x113')](db[_0xb2d0('0xa9')],{'as':_0xb2d0('0x1b2'),'foreignKey':'DescriptionId'});db[_0xb2d0('0xa9')][_0xb2d0('0x113')](db[_0xb2d0('0xa9')],{'as':_0xb2d0('0x1b3'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xa9')]['belongsTo'](db[_0xb2d0('0x1b4')],{'as':_0xb2d0('0x1b4'),'foreignKey':_0xb2d0('0x1b5')});db[_0xb2d0('0xab')][_0xb2d0('0x113')](db[_0xb2d0('0xac')],{'as':_0xb2d0('0x1ac'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0xac')][_0xb2d0('0x113')](db['SugarcrmField'],{'as':'Subjects','onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xac')]['hasMany'](db['SugarcrmField'],{'as':'Descriptions','onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0xac')]['hasMany'](db['SugarcrmField'],{'as':_0xb2d0('0x1aa'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xac')]['belongsTo'](db[_0xb2d0('0xab')],{'as':'Account','foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0xae')]['hasMany'](db[_0xb2d0('0xae')],{'as':_0xb2d0('0x1b1'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xae')][_0xb2d0('0x113')](db[_0xb2d0('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0xb2d0('0xae')][_0xb2d0('0x113')](db[_0xb2d0('0xae')],{'as':_0xb2d0('0x1b3'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xae')]['belongsTo'](db[_0xb2d0('0x1b4')],{'as':'Variable','foreignKey':_0xb2d0('0x1b5')});db[_0xb2d0('0xb0')]['hasMany'](db[_0xb2d0('0xb2')],{'as':_0xb2d0('0x1ac'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0xb2')]['hasMany'](db['DeskField'],{'as':'Subjects','onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1af')});db['DeskConfiguration'][_0xb2d0('0x113')](db['DeskField'],{'as':_0xb2d0('0x1b7'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0xb2')][_0xb2d0('0x113')](db[_0xb2d0('0xb3')],{'as':'Fields','onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xb2')][_0xb2d0('0x122')](db[_0xb2d0('0xb0')],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0xb2')][_0xb2d0('0x124')](db[_0xb2d0('0x93')],{'through':'int_desk_configuration_has_tags'});db[_0xb2d0('0xb3')][_0xb2d0('0x113')](db[_0xb2d0('0xb3')],{'as':_0xb2d0('0x1b1'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xb3')][_0xb2d0('0x113')](db[_0xb2d0('0xb3')],{'as':_0xb2d0('0x1b2'),'foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0xb3')]['hasMany'](db[_0xb2d0('0xb3')],{'as':_0xb2d0('0x1b3'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xb3')][_0xb2d0('0x122')](db['Variable'],{'as':_0xb2d0('0x1b4'),'foreignKey':'VariableId'});db[_0xb2d0('0xb5')][_0xb2d0('0x113')](db[_0xb2d0('0x1b8')],{'as':_0xb2d0('0x1ac'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0x1b8')][_0xb2d0('0x113')](db[_0xb2d0('0x1b9')],{'as':_0xb2d0('0x1ae'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1af')});db['ZohoConfiguration']['hasMany'](db[_0xb2d0('0x1b9')],{'as':_0xb2d0('0x1b7'),'onDelete':_0xb2d0('0x111'),'foreignKey':'DescriptionId'});db[_0xb2d0('0x1b8')][_0xb2d0('0x113')](db[_0xb2d0('0x1b9')],{'as':'Fields','onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0x1b8')][_0xb2d0('0x122')](db[_0xb2d0('0xb5')],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0x1b9')][_0xb2d0('0x113')](db[_0xb2d0('0x1b9')],{'as':_0xb2d0('0x1b1'),'foreignKey':'SubjectId'});db[_0xb2d0('0x1b9')]['hasMany'](db[_0xb2d0('0x1b9')],{'as':_0xb2d0('0x1b2'),'foreignKey':'DescriptionId'});db[_0xb2d0('0x1b9')][_0xb2d0('0x113')](db[_0xb2d0('0x1b9')],{'as':_0xb2d0('0x1b3'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0x1b9')][_0xb2d0('0x122')](db[_0xb2d0('0x1b4')],{'as':_0xb2d0('0x1b4'),'foreignKey':_0xb2d0('0x1b5')});db[_0xb2d0('0xb8')][_0xb2d0('0x113')](db[_0xb2d0('0xba')],{'as':_0xb2d0('0x1ac'),'onDelete':'cascade','foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0xba')]['hasMany'](db[_0xb2d0('0xbc')],{'as':_0xb2d0('0x1ae'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xba')][_0xb2d0('0x113')](db[_0xb2d0('0xbc')],{'as':'Descriptions','foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0xba')][_0xb2d0('0x113')](db[_0xb2d0('0xbc')],{'as':_0xb2d0('0x1aa'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xba')][_0xb2d0('0x122')](db[_0xb2d0('0xb8')],{'as':'Account','foreignKey':_0xb2d0('0x1ad')});db['ZendeskConfiguration'][_0xb2d0('0x124')](db['Tag'],{'through':_0xb2d0('0x1ba')});db[_0xb2d0('0xbc')][_0xb2d0('0x113')](db[_0xb2d0('0xbc')],{'as':'Subject','foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xbc')][_0xb2d0('0x113')](db[_0xb2d0('0xbc')],{'as':_0xb2d0('0x1b2'),'foreignKey':'DescriptionId'});db['ZendeskField'][_0xb2d0('0x113')](db[_0xb2d0('0xbc')],{'as':_0xb2d0('0x1b3'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xbc')][_0xb2d0('0x122')](db['Variable'],{'as':_0xb2d0('0x1b4'),'foreignKey':_0xb2d0('0x1b5')});db[_0xb2d0('0xbe')]['hasMany'](db['FreshdeskConfiguration'],{'as':_0xb2d0('0x1ac'),'onDelete':'cascade','foreignKey':_0xb2d0('0x1ad')});db['FreshdeskConfiguration'][_0xb2d0('0x113')](db[_0xb2d0('0xc0')],{'as':_0xb2d0('0x1ae'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0x1bb')][_0xb2d0('0x113')](db[_0xb2d0('0xc0')],{'as':_0xb2d0('0x1b7'),'onDelete':'cascade','foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0x1bb')][_0xb2d0('0x113')](db[_0xb2d0('0xc0')],{'as':_0xb2d0('0x1aa'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1b0')});db['FreshdeskConfiguration'][_0xb2d0('0x122')](db[_0xb2d0('0xbe')],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0x1bb')]['belongsToMany'](db[_0xb2d0('0x93')],{'through':_0xb2d0('0x1bc')});db['FreshdeskField'][_0xb2d0('0x113')](db[_0xb2d0('0xc0')],{'as':_0xb2d0('0x1b1'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xc0')][_0xb2d0('0x113')](db[_0xb2d0('0xc0')],{'as':_0xb2d0('0x1b2'),'foreignKey':'DescriptionId'});db['FreshdeskField'][_0xb2d0('0x113')](db['FreshdeskField'],{'as':_0xb2d0('0x1b3'),'foreignKey':'FieldId'});db[_0xb2d0('0xc0')][_0xb2d0('0x122')](db[_0xb2d0('0x1b4')],{'as':_0xb2d0('0x1b4'),'foreignKey':_0xb2d0('0x1b5')});db['VtigerAccount']['hasMany'](db[_0xb2d0('0x1bd')],{'as':_0xb2d0('0x1ac'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1ad')});db['VtigerConfiguration']['hasMany'](db[_0xb2d0('0x1be')],{'as':_0xb2d0('0x1ae'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0x1bd')][_0xb2d0('0x113')](db[_0xb2d0('0x1be')],{'as':_0xb2d0('0x1b7'),'foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0x1bd')][_0xb2d0('0x113')](db[_0xb2d0('0x1be')],{'as':_0xb2d0('0x1aa'),'foreignKey':'FieldId'});db[_0xb2d0('0x1bd')]['belongsTo'](db['VtigerAccount'],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x1ad')});db['VtigerField'][_0xb2d0('0x113')](db['VtigerField'],{'as':_0xb2d0('0x1b1'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0x1be')][_0xb2d0('0x113')](db[_0xb2d0('0x1be')],{'as':_0xb2d0('0x1b2'),'foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0x1be')][_0xb2d0('0x113')](db[_0xb2d0('0x1be')],{'as':_0xb2d0('0x1b3'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0x1be')][_0xb2d0('0x122')](db[_0xb2d0('0x1b4')],{'as':_0xb2d0('0x1b4'),'foreignKey':_0xb2d0('0x1b5')});db[_0xb2d0('0xc3')][_0xb2d0('0x113')](db[_0xb2d0('0x1bf')],{'as':_0xb2d0('0x1ac'),'onDelete':_0xb2d0('0x111'),'foreignKey':'AccountId'});db[_0xb2d0('0x1bf')][_0xb2d0('0x113')](db[_0xb2d0('0xc6')],{'as':'Subjects','foreignKey':'SubjectId'});db['ServicenowConfiguration'][_0xb2d0('0x113')](db[_0xb2d0('0xc6')],{'as':_0xb2d0('0x1b7'),'foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0x1bf')][_0xb2d0('0x113')](db[_0xb2d0('0xc6')],{'as':'Fields','foreignKey':'FieldId'});db[_0xb2d0('0x1bf')]['belongsTo'](db[_0xb2d0('0xc3')],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0xc6')][_0xb2d0('0x113')](db[_0xb2d0('0xc6')],{'as':_0xb2d0('0x1b1'),'foreignKey':'SubjectId'});db['ServicenowField']['hasMany'](db[_0xb2d0('0xc6')],{'as':_0xb2d0('0x1b2'),'foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0xc6')]['hasMany'](db[_0xb2d0('0xc6')],{'as':_0xb2d0('0x1b3'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xc6')]['belongsTo'](db[_0xb2d0('0x1b4')],{'as':'Variable','foreignKey':'VariableId'});db[_0xb2d0('0xc8')]['hasMany'](db[_0xb2d0('0xca')],{'as':_0xb2d0('0x1ac'),'onDelete':'cascade','foreignKey':'AccountId'});db[_0xb2d0('0xca')]['hasMany'](db['Dynamics365Field'],{'as':_0xb2d0('0x1ae'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xca')][_0xb2d0('0x113')](db['Dynamics365Field'],{'as':'Descriptions','onDelete':'cascade','foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0xca')]['hasMany'](db[_0xb2d0('0xcb')],{'as':_0xb2d0('0x1aa'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xca')][_0xb2d0('0x122')](db[_0xb2d0('0xc8')],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0xcb')][_0xb2d0('0x113')](db[_0xb2d0('0xcb')],{'as':_0xb2d0('0x1b1'),'foreignKey':_0xb2d0('0x1af')});db['Dynamics365Field'][_0xb2d0('0x113')](db[_0xb2d0('0xcb')],{'as':_0xb2d0('0x1b2'),'foreignKey':_0xb2d0('0x1b6')});db['Dynamics365Field']['hasMany'](db[_0xb2d0('0xcb')],{'as':'Field','foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xcb')][_0xb2d0('0x122')](db['Variable'],{'as':_0xb2d0('0x1b4'),'foreignKey':_0xb2d0('0x1b5')});db[_0xb2d0('0xcd')][_0xb2d0('0x113')](db[_0xb2d0('0xcf')],{'as':'Configurations','onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1ad')});db[_0xb2d0('0xcf')][_0xb2d0('0x113')](db[_0xb2d0('0xd1')],{'as':_0xb2d0('0x1ae'),'foreignKey':'SubjectId'});db[_0xb2d0('0xcf')][_0xb2d0('0x113')](db[_0xb2d0('0xd1')],{'as':'Descriptions','foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0xcf')][_0xb2d0('0x113')](db[_0xb2d0('0xd1')],{'as':_0xb2d0('0x1aa'),'foreignKey':'FieldId'});db[_0xb2d0('0xcf')][_0xb2d0('0x122')](db[_0xb2d0('0xcd')],{'as':_0xb2d0('0x16c'),'foreignKey':'AccountId'});db[_0xb2d0('0xd1')][_0xb2d0('0x113')](db[_0xb2d0('0xd1')],{'as':_0xb2d0('0x1b1'),'foreignKey':_0xb2d0('0x1af')});db[_0xb2d0('0xd1')]['hasMany'](db[_0xb2d0('0xd1')],{'as':_0xb2d0('0x1b2'),'foreignKey':_0xb2d0('0x1b6')});db[_0xb2d0('0xd1')][_0xb2d0('0x113')](db['FreshsalesField'],{'as':'Field','foreignKey':_0xb2d0('0x1b0')});db[_0xb2d0('0xd1')][_0xb2d0('0x122')](db[_0xb2d0('0x1b4')],{'as':_0xb2d0('0x1b4'),'foreignKey':_0xb2d0('0x1b5')});db['ChatQueueReport'][_0xb2d0('0x122')](db[_0xb2d0('0x6a')],{});db[_0xb2d0('0xd6')]['belongsTo'](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0xd6')][_0xb2d0('0x122')](db['CmContact'],{'as':'Contact','foreignKey':_0xb2d0('0x164')});db['ChatQueueReport'][_0xb2d0('0x122')](db[_0xb2d0('0x119')],{});db[_0xb2d0('0xd6')][_0xb2d0('0x122')](db[_0xb2d0('0x6f')],{});db[_0xb2d0('0xd6')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{});db[_0xb2d0('0xd6')][_0xb2d0('0x122')](db[_0xb2d0('0x12d')],{});db[_0xb2d0('0xd8')]['belongsTo'](db[_0xb2d0('0x12')],{'onDelete':'cascade','foreignKey':'FromId'});db[_0xb2d0('0xd8')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x1c0')});db['JscriptySessionReport'][_0xb2d0('0x113')](db[_0xb2d0('0x1c1')],{'foreignKey':_0xb2d0('0x1c2'),'onDelete':'cascade'});db['JscriptySessionReport']['hasMany'](db['JscriptyAnswerReport'],{'foreignKey':_0xb2d0('0x1c2'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0xdc')][_0xb2d0('0x122')](db[_0xb2d0('0x5a')],{});db[_0xb2d0('0xdc')][_0xb2d0('0x122')](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0xdc')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':_0xb2d0('0x164')});db['SmsQueueReport'][_0xb2d0('0x122')](db[_0xb2d0('0x12a')],{});db[_0xb2d0('0xdc')][_0xb2d0('0x122')](db['SmsMessage'],{});db[_0xb2d0('0xdc')]['belongsTo'](db[_0xb2d0('0x12')],{});db[_0xb2d0('0xdc')][_0xb2d0('0x122')](db['SmsQueue'],{});db[_0xb2d0('0xe2')][_0xb2d0('0x113')](db[_0xb2d0('0x193')],{'foreignKey':_0xb2d0('0x1c3')});db['JscriptyProject'][_0xb2d0('0x113')](db[_0xb2d0('0x1c1')],{'foreignKey':_0xb2d0('0x1c3')});db[_0xb2d0('0xe2')][_0xb2d0('0x113')](db['JscriptyAnswerReport'],{'foreignKey':_0xb2d0('0x1c3')});db[_0xb2d0('0x13e')][_0xb2d0('0x124')](db['User'],{'as':_0xb2d0('0x168'),'through':_0xb2d0('0x1c4')});db[_0xb2d0('0xea')]['belongsToMany'](db['User'],{'as':_0xb2d0('0x161'),'through':'user_has_teams'});db[_0xb2d0('0xea')][_0xb2d0('0x124')](db[_0xb2d0('0x1c')],{'through':'TeamVoiceQueue','as':_0xb2d0('0x12c')});db['Team'][_0xb2d0('0x124')](db[_0xb2d0('0x42')],{'through':_0xb2d0('0x162'),'as':_0xb2d0('0x1c5')});db[_0xb2d0('0xea')][_0xb2d0('0x124')](db[_0xb2d0('0x12d')],{'through':'team_has_chat_queues','as':'ChatQueues'});db['Team']['belongsToMany'](db['FaxQueue'],{'through':_0xb2d0('0x1c6'),'as':'FaxQueues'});db[_0xb2d0('0xea')][_0xb2d0('0x124')](db['SmsQueue'],{'through':_0xb2d0('0x182'),'as':'SmsQueues'});db[_0xb2d0('0xea')][_0xb2d0('0x124')](db[_0xb2d0('0x68')],{'through':_0xb2d0('0x187'),'as':_0xb2d0('0x131')});db['Team']['belongsToMany'](db['WhatsappQueue'],{'through':_0xb2d0('0x1c7'),'as':_0xb2d0('0x132')});db[_0xb2d0('0xee')][_0xb2d0('0x113')](db[_0xb2d0('0x7a')],{'as':'Hoppers','foreignKey':_0xb2d0('0x1c8')});db[_0xb2d0('0xee')]['hasMany'](db[_0xb2d0('0x7e')],{'as':'HopperFinals','foreignKey':'CampaignId'});db[_0xb2d0('0xee')][_0xb2d0('0x113')](db['CmHopperHistory'],{'as':_0xb2d0('0x147'),'foreignKey':_0xb2d0('0x1c8')});db[_0xb2d0('0xee')][_0xb2d0('0x113')](db[_0xb2d0('0x7c')],{'as':_0xb2d0('0x148'),'foreignKey':_0xb2d0('0x1c8')});db[_0xb2d0('0xee')][_0xb2d0('0x122')](db[_0xb2d0('0x30')],{'as':_0xb2d0('0x30'),'foreignKey':_0xb2d0('0x14a')});db[_0xb2d0('0xee')]['belongsTo'](db[_0xb2d0('0x30')],{'as':_0xb2d0('0x14b'),'foreignKey':_0xb2d0('0x14c')});db['Campaign'][_0xb2d0('0x122')](db[_0xb2d0('0x8c')],{'as':_0xb2d0('0x8c'),'foreignKey':_0xb2d0('0x170')});db[_0xb2d0('0xee')][_0xb2d0('0x122')](db[_0xb2d0('0x13e')],{'as':_0xb2d0('0x13e'),'foreignKey':'SquareProjectId'});db[_0xb2d0('0xee')][_0xb2d0('0x124')](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x127'),'through':_0xb2d0('0x1c9')});db[_0xb2d0('0xee')][_0xb2d0('0x124')](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x150'),'through':_0xb2d0('0x1ca')});db['Attachment'][_0xb2d0('0x122')](db[_0xb2d0('0x71')],{'as':_0xb2d0('0x71'),'foreignKey':_0xb2d0('0x16e')});db[_0xb2d0('0x1cb')][_0xb2d0('0x122')](db[_0xb2d0('0x47')],{});db[_0xb2d0('0x1cb')][_0xb2d0('0x122')](db['MailInteraction'],{});db[_0xb2d0('0x1cb')]['belongsTo'](db[_0xb2d0('0x138')],{'foreignKey':_0xb2d0('0x1cc'),'as':_0xb2d0('0x1cd')});db[_0xb2d0('0x1cb')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'foreignKey':_0xb2d0('0x1ce'),'as':_0xb2d0('0x1cf')});db[_0xb2d0('0x1cb')]['belongsTo'](db['User'],{'foreignKey':'ToUserId','as':'ToAgent'});db['MailTransferReport'][_0xb2d0('0x122')](db[_0xb2d0('0x42')],{'foreignKey':_0xb2d0('0x1d0'),'as':_0xb2d0('0x1d1')});db[_0xb2d0('0x1cb')][_0xb2d0('0x122')](db[_0xb2d0('0x138')],{'foreignKey':_0xb2d0('0x1d2'),'as':_0xb2d0('0x1d3')});db[_0xb2d0('0xf4')][_0xb2d0('0x122')](db[_0xb2d0('0x6f')],{});db[_0xb2d0('0xf4')]['belongsTo'](db[_0xb2d0('0x119')],{});db['ChatTransferReport'][_0xb2d0('0x122')](db[_0xb2d0('0x6a')],{'foreignKey':_0xb2d0('0x1d4'),'as':'FromAccount'});db[_0xb2d0('0xf4')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'foreignKey':_0xb2d0('0x1ce'),'as':_0xb2d0('0x1cf')});db[_0xb2d0('0xf4')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'foreignKey':_0xb2d0('0x1d5'),'as':_0xb2d0('0x1d6')});db[_0xb2d0('0xf4')][_0xb2d0('0x122')](db[_0xb2d0('0x12d')],{'foreignKey':_0xb2d0('0x1d7'),'as':_0xb2d0('0x1d1')});db['ChatTransferReport'][_0xb2d0('0x122')](db[_0xb2d0('0x6a')],{'foreignKey':_0xb2d0('0x1d8'),'as':_0xb2d0('0x1d3')});db[_0xb2d0('0xf6')][_0xb2d0('0x122')](db[_0xb2d0('0x54')],{});db[_0xb2d0('0xf6')][_0xb2d0('0x122')](db[_0xb2d0('0x53')],{});db[_0xb2d0('0xf6')][_0xb2d0('0x122')](db['FaxAccount'],{'foreignKey':_0xb2d0('0x1d9'),'as':_0xb2d0('0x1cd')});db['FaxTransferReport']['belongsTo'](db[_0xb2d0('0x12')],{'foreignKey':_0xb2d0('0x1ce'),'as':_0xb2d0('0x1cf')});db[_0xb2d0('0xf6')][_0xb2d0('0x122')](db['User'],{'foreignKey':'ToUserId','as':_0xb2d0('0x1d6')});db[_0xb2d0('0xf6')][_0xb2d0('0x122')](db[_0xb2d0('0x56')],{'foreignKey':'ToFaxQueueId','as':_0xb2d0('0x1d1')});db['FaxTransferReport'][_0xb2d0('0x122')](db[_0xb2d0('0x51')],{'foreignKey':_0xb2d0('0x1da'),'as':'ToAccount'});db[_0xb2d0('0xf7')][_0xb2d0('0x122')](db[_0xb2d0('0x66')],{});db[_0xb2d0('0xf7')][_0xb2d0('0x122')](db[_0xb2d0('0x64')],{});db['OpenchannelTransferReport'][_0xb2d0('0x122')](db['OpenchannelAccount'],{'foreignKey':_0xb2d0('0x1db'),'as':'FromAccount'});db['OpenchannelTransferReport']['belongsTo'](db[_0xb2d0('0x12')],{'foreignKey':_0xb2d0('0x1ce'),'as':_0xb2d0('0x1cf')});db[_0xb2d0('0xf7')][_0xb2d0('0x122')](db['User'],{'foreignKey':'ToUserId','as':_0xb2d0('0x1d6')});db[_0xb2d0('0xf7')][_0xb2d0('0x122')](db[_0xb2d0('0x68')],{'foreignKey':'ToOpenchannelQueueId','as':_0xb2d0('0x1d1')});db[_0xb2d0('0xf7')][_0xb2d0('0x122')](db[_0xb2d0('0x61')],{'foreignKey':'ToOpenchannelAccountId','as':_0xb2d0('0x1d3')});db[_0xb2d0('0x1dc')]['belongsTo'](db[_0xb2d0('0x5e')],{});db['SmsTransferReport'][_0xb2d0('0x122')](db[_0xb2d0('0x12a')],{});db[_0xb2d0('0x1dc')][_0xb2d0('0x122')](db['SmsAccount'],{'foreignKey':_0xb2d0('0x1dd'),'as':_0xb2d0('0x1cd')});db['SmsTransferReport']['belongsTo'](db[_0xb2d0('0x12')],{'foreignKey':'FromUserId','as':'FromAgent'});db[_0xb2d0('0x1dc')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'foreignKey':'ToUserId','as':'ToAgent'});db['SmsTransferReport'][_0xb2d0('0x122')](db[_0xb2d0('0x5f')],{'foreignKey':'ToSmsQueueId','as':'ToQueue'});db[_0xb2d0('0x1dc')][_0xb2d0('0x122')](db[_0xb2d0('0x5a')],{'foreignKey':_0xb2d0('0x1de'),'as':_0xb2d0('0x1d3')});db['CmList'][_0xb2d0('0x113')](db[_0xb2d0('0x15b')],{'as':_0xb2d0('0x15c'),'foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0xf9')][_0xb2d0('0x113')](db[_0xb2d0('0x82')],{'as':'CustomFields','foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0xf9')][_0xb2d0('0x113')](db['CmContact'],{'as':_0xb2d0('0x191'),'onDelete':_0xb2d0('0x111'),'foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0xf9')][_0xb2d0('0x113')](db['CmHopperFinal'],{'as':_0xb2d0('0x117'),'foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0xf9')][_0xb2d0('0x113')](db[_0xb2d0('0x1df')],{'as':_0xb2d0('0x1e0'),'foreignKey':_0xb2d0('0x15f')});db['CmList'][_0xb2d0('0x113')](db[_0xb2d0('0x80')],{'as':'ReportAgentPreview','foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0xf9')]['belongsToMany'](db[_0xb2d0('0x1c')],{'as':_0xb2d0('0x1e1'),'through':_0xb2d0('0x14e')});db['CmList']['belongsToMany'](db[_0xb2d0('0x12')],{'as':'Agents','through':_0xb2d0('0x133')});db[_0xb2d0('0xfa')][_0xb2d0('0x113')](db['VoiceExtension'],{'as':_0xb2d0('0x116'),'onDelete':'cascade'});db[_0xb2d0('0xfa')][_0xb2d0('0x124')](db[_0xb2d0('0x12')],{'as':'Agents','through':_0xb2d0('0x1e2')});db[_0xb2d0('0xfb')][_0xb2d0('0x113')](db['User'],{'as':'Users','foreignKey':_0xb2d0('0x123')});db['UserProfile'][_0xb2d0('0x113')](db[_0xb2d0('0xfd')],{'as':_0xb2d0('0x1e3'),'foreignKey':_0xb2d0('0x123'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0xfd')][_0xb2d0('0x113')](db[_0xb2d0('0x1e4')],{'as':'Resources','foreignKey':_0xb2d0('0x1e5'),'onDelete':_0xb2d0('0x111')});db[_0xb2d0('0x100')][_0xb2d0('0x113')](db[_0xb2d0('0x15b')],{'as':_0xb2d0('0x15c'),'foreignKey':_0xb2d0('0x1e6')});db[_0xb2d0('0x100')][_0xb2d0('0x113')](db[_0xb2d0('0x88')],{'as':_0xb2d0('0x15d'),'foreignKey':_0xb2d0('0x1e6')});db[_0xb2d0('0x100')][_0xb2d0('0x113')](db[_0xb2d0('0x102')],{'as':_0xb2d0('0x152'),'foreignKey':'WhatsappAccountId'});db[_0xb2d0('0x100')][_0xb2d0('0x113')](db['WhatsappInteraction'],{'as':'Interactions'});db['WhatsappAccount'][_0xb2d0('0x113')](db[_0xb2d0('0x101')],{'as':_0xb2d0('0x141')});db['WhatsappAccount']['belongsTo'](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0x100')][_0xb2d0('0x122')](db[_0xb2d0('0x8d')],{'as':_0xb2d0('0x175'),'foreignKey':_0xb2d0('0x14d')});db['WhatsappAccount']['belongsToMany'](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x161'),'through':'user_has_whatsapp_accounts'});db[_0xb2d0('0x101')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x101')][_0xb2d0('0x122')](db[_0xb2d0('0x108')],{'onDelete':'restrict'});db[_0xb2d0('0x101')][_0xb2d0('0x122')](db['WhatsappAccount'],{'onDelete':_0xb2d0('0x16f')});db[_0xb2d0('0x101')][_0xb2d0('0x122')](db['Interval'],{'onDelete':'restrict','foreignKey':_0xb2d0('0x170')});db[_0xb2d0('0x101')][_0xb2d0('0x122')](db[_0xb2d0('0x93')],{'onDelete':_0xb2d0('0x16f'),'foreignKey':_0xb2d0('0x171')});db[_0xb2d0('0x11e')][_0xb2d0('0x113')](db[_0xb2d0('0x102')],{'as':_0xb2d0('0x152'),'onDelete':_0xb2d0('0x111'),'foreignKey':'WhatsappInteractionId'});db[_0xb2d0('0x11e')][_0xb2d0('0x122')](db['WhatsappAccount'],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x1e6')});db[_0xb2d0('0x11e')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':_0xb2d0('0x164')});db[_0xb2d0('0x11e')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'as':'Owner','foreignKey':'UserId'});db[_0xb2d0('0x11e')]['belongsToMany'](db['Tag'],{'through':_0xb2d0('0x1a4'),'as':_0xb2d0('0x166')});db[_0xb2d0('0x11e')][_0xb2d0('0x124')](db['Tag'],{'through':_0xb2d0('0x1a4'),'as':_0xb2d0('0x167')});db[_0xb2d0('0x11e')]['belongsToMany'](db[_0xb2d0('0x12')],{'as':'Users','through':_0xb2d0('0x1e7'),'foreignKey':_0xb2d0('0x1e8')});db[_0xb2d0('0x102')]['belongsTo'](db[_0xb2d0('0x12')],{'as':_0xb2d0('0x12')});db[_0xb2d0('0x102')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'onDelete':_0xb2d0('0x111'),'as':_0xb2d0('0x157')});db[_0xb2d0('0x102')][_0xb2d0('0x122')](db[_0xb2d0('0x11e')],{'onDelete':_0xb2d0('0x111'),'as':_0xb2d0('0x16b'),'foreignKey':_0xb2d0('0x1e8')});db[_0xb2d0('0x102')][_0xb2d0('0x122')](db[_0xb2d0('0x100')],{'as':_0xb2d0('0x16c'),'foreignKey':_0xb2d0('0x1e6')});db[_0xb2d0('0x104')][_0xb2d0('0x122')](db[_0xb2d0('0x100')],{});db[_0xb2d0('0x104')][_0xb2d0('0x122')](db[_0xb2d0('0xf9')],{'as':_0xb2d0('0x172'),'foreignKey':_0xb2d0('0x15f')});db[_0xb2d0('0x104')][_0xb2d0('0x122')](db[_0xb2d0('0x78')],{'as':_0xb2d0('0x157'),'foreignKey':_0xb2d0('0x164')});db['WhatsappQueueReport'][_0xb2d0('0x122')](db['WhatsappInteraction'],{});db[_0xb2d0('0x104')][_0xb2d0('0x122')](db['WhatsappQueue'],{});db[_0xb2d0('0x104')][_0xb2d0('0x122')](db[_0xb2d0('0x102')],{});db[_0xb2d0('0x104')]['belongsTo'](db[_0xb2d0('0x12')],{});db['WhatsappTransferReport'][_0xb2d0('0x122')](db[_0xb2d0('0x102')],{});db[_0xb2d0('0x106')][_0xb2d0('0x122')](db['WhatsappInteraction'],{});db[_0xb2d0('0x106')]['belongsTo'](db[_0xb2d0('0x100')],{'foreignKey':_0xb2d0('0x1e9'),'as':_0xb2d0('0x1cd')});db[_0xb2d0('0x106')][_0xb2d0('0x122')](db[_0xb2d0('0x100')],{'foreignKey':'ToWhatsappAccountId','as':_0xb2d0('0x1d3')});db[_0xb2d0('0x106')][_0xb2d0('0x122')](db[_0xb2d0('0x108')],{'foreignKey':'ToQueueId','as':_0xb2d0('0x1d1')});db['WhatsappTransferReport']['belongsTo'](db[_0xb2d0('0x12')],{'foreignKey':_0xb2d0('0x1ce'),'as':'FromAgent'});db[_0xb2d0('0x106')][_0xb2d0('0x122')](db[_0xb2d0('0x12')],{'foreignKey':_0xb2d0('0x1d5'),'as':_0xb2d0('0x1d6')});db[_0xb2d0('0x108')][_0xb2d0('0x124')](db['User'],{'as':_0xb2d0('0x161'),'through':_0xb2d0('0x3d'),'foreignKey':_0xb2d0('0x1ea')});db[_0xb2d0('0x108')]['belongsToMany'](db[_0xb2d0('0xea')],{'through':_0xb2d0('0x1c7'),'as':_0xb2d0('0x14f')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xf0f1=['SquareProject','../api/squareProject/squareProject.model','SquareRecording','../api/squareRecording/squareRecording.model','Team','License','../api/license/license.model','Campaign','../api/campaign/campaign.model','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','../api/plugin/plugin.model','MailTransferReport','../api/mailTransferReport/mailTransferReport.model','../api/chatTransferReport/chatTransferReport.model','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','CmList','../api/cmList/cmList.model','VoicePrefix','../api/voicePrefix/voicePrefix.model','UserProfile','UserProfileSection','UserProfileResource','../api/userProfileResource/userProfileResource.model','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappInteraction','WhatsappMessage','../api/whatsappQueueReport/whatsappQueueReport.model','WhatsappTransferReport','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','Realtime','../api/realtime/realtime.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','hasOne','hasMany','Recordings','UserId','VoiceExtension','Extensions','cascade','HopperFinals','HopperHistory','OpenchannelInteractions','ChatInteraction','SmsInteractions','MailInteractions','WhatsappInteractions','belongsTo','belongsToMany','ChatGroup','Groups','CmContact','cm_user_has_contacts','Lists','cm_user_has_lists','user_has_teams','user_has_mail_interactions','ChatInteractions','user_has_chat_interactions','FaxInteractions','user_has_fax_interactions','user_has_whatsapp_interactions','VoiceQueue','VoiceQueues','MailQueue','MailQueues','ChatQueues','FaxQueues','SmsQueues','OpenchannelQueues','WhatsappQueue','WhatsappQueues','VoicePrefixes','ChatWebsite','ChatWebsites','user_has_chat_websites','MailAccounts','user_has_mail_accounts','OpenchannelAccount','SmsAccounts','user_has_sms_accounts','user_has_whatsapp_accounts','SpiedAgents','ChanSpyId','Applications','moh_has_sounds','Members','VoiceQueueId','CmHopper','Hoppers','CmHopperFinal','CmHopperHistory','HopperHistories','HopperBlacks','JscriptySessions','TrunkId','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','voice_queues_has_cm_blacklists','mailboxuser','mailbox','uniqueid','AgentReports','Contact','MailAccountId','Imap','Smtp','Dispositions','Answers','Messages','List','ListId','Template','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','MailInteractionId','Account','ContactId','Owner','mail_interaction_has_tags','Tags','ThroughTags','Users','Attachments','Interaction','ChatOfflineMessageId','MailApplication','restrict','TagId','MailQueueReport','Items','FaxAccountId','Interactions','Exntensions','user_has_fax_accounts','FaxMessage','fax_interaction_has_tags','FaxInteractionId','AttachmentId','UserFaxQueue','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','user_has_sms_interactions','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','user_has_openchannel_accounts','OpenchannelInteractionId','openchannel_interaction_has_tags','OpenchannelQueueId','team_has_openchannel_queues','ChatWebsiteId','ProactiveActions','Agent','Queue','ChatQueueId','ChatInteractionId','chat_interaction_has_tags','team_has_chat_queues','ChatGroupId','chat_group_has_users','Website','Contacts','CompanyId','OwnerId','All','AutomationAllId','Any','OneAny','AutomationAnyId','Actions','AutomationId','ParentId','Intervals','MailApplications','FaxApplications','SmsApplications','DefaultReportId','Mohs','cm_contact_has_tags','whatsapp_interaction_has_tags','AllConditions','AllCondition','TriggerAllId','TriggerAnyId','TriggerId','CustomReportId','Fields','MetricId','SalesforceConfiguration','Configurations','AccountId','Subjects','SubjectId','Descriptions','DescriptionId','FieldId','Subject','Field','Description','VariableId','DeskAccount','ZohoField','ZendeskAccount','ZendeskConfiguration','ZendeskField','int_zendesk_configuration_has_tags','FreshdeskField','int_freshdesk_configuration_has_tags','ServicenowConfiguration','FromId','ToId','JscriptyQuestionReport','SessionId','ProjectId','CampaignId','TrunkBackup','campaigns_has_cm_lists','BlackLists','campaigns_has_cm_blacklists','FromMailAccountId','FromUserId','FromAgent','ToAgent','ToMailQueueId','ToQueue','ToMailAccountId','ChatTransferReport','FromAccount','ToUserId','FaxTransferReport','FromFaxAccountId','ToFaxQueueId','ToFaxAccountId','ToAccount','FromOpenchannelAccountId','ToOpenchannelQueueId','ToOpenchannelAccountId','ToSmsQueueId','ToSmsAccountId','CustomFields','Queues','user_has_voice_prefixes','userProfileId','UserProfileSections','sectionId','WhatsappAccountId','WhatsappApplication','WhatsappInteractionId','WhatsappQueueReport','FromWhatsappAccountId','ToQueueId','WhatsappQueueId','team_has_whatsapp_queues','exports','../config/environment','sequelize','lodash','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','utf8_general_ci','sequelizeHistory','defaultsDeep','database','username','password','options','User','../api/user/user.model','VoiceChanSpy','import','../api/voiceChanSpy/voiceChanSpy.model','VoiceContext','../api/voiceMusicOnHold/voiceMusicOnHold.model','../api/voiceQueue/voiceQueue.model','VoiceRecording','../api/voiceRecording/voiceRecording.model','ScreenRecording','../api/screenRecording/screenRecording.model','VoiceMail','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','VoiceCallReport','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','VoiceAgentReport','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','UserChatQueue','UserMailQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','../api/userSmsQueue/userSmsQueue.model','UserOpenchannelQueue','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerIn/mailServerIn.model','MailServerOut','../api/mailServerOut/mailServerOut.model','MailAccount','../api/mailAccount/mailAccount.model','../api/mailQueue/mailQueue.model','../api/mailSubstatus/mailSubstatus.model','MailInteraction','../api/mailInteraction/mailInteraction.model','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','Dashboard','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','FaxApplication','../api/faxApplication/faxApplication.model','FaxInteraction','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','../api/smsApplication/smsApplication.model','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','../api/openchannelInteraction/openchannelInteraction.model','OpenchannelMessage','../api/openchannelMessage/openchannelMessage.model','OpenchannelQueue','../api/openchannelQueue/openchannelQueue.model','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','../api/openchannelQueueReport/openchannelQueueReport.model','ChatApplication','../api/chatApplication/chatApplication.model','../api/chatInteraction/chatInteraction.model','ChatMessage','ChatOfflineMessage','../api/chatOfflineMessage/chatOfflineMessage.model','ChatQueue','../api/chatQueue/chatQueue.model','../api/chatGroup/chatGroup.model','ChatProactiveAction','../api/chatProactiveAction/chatProactiveAction.model','CmCompany','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','../api/cmHopperHistory/cmHopperHistory.model','ReportAgentPreview','../api/reportAgentPreview/reportAgentPreview.model','CmCustomField','../api/cmCustomField/cmCustomField.model','Action','Automation','CannedAnswer','Disposition','../api/disposition/disposition.model','Condition','../api/condition/condition.model','Interval','Pause','Cdr','../api/cdr/cdr.model','VoiceQueuesLog','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','AnalyticCustomReport','AnalyticDefaultReport','AnalyticExtractedReport','AnalyticMetric','../api/analyticMetric/analyticMetric.model','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','AnalyticTreeReport','SalesforceAccount','SalesforceField','../api/intSalesforceField/intSalesforceField.model','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','SugarcrmField','../api/intSugarcrmField/intSugarcrmField.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','ZohoAccount','ZohoConfiguration','../api/intZohoField/intZohoField.model','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','../api/intZendeskField/intZendeskField.model','FreshdeskAccount','FreshdeskConfiguration','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','VtigerAccount','VtigerConfiguration','../api/intVtigerConfiguration/intVtigerConfiguration.model','VtigerField','../api/intVtigerField/intVtigerField.model','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','../api/intServicenowConfiguration/intServicenowConfiguration.model','ServicenowField','../api/intServicenowField/intServicenowField.model','Dynamics365Account','../api/intDynamics365Account/intDynamics365Account.model','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','FreshsalesAccount','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','../api/chatInternalMessage/chatInternalMessage.model','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','JscriptyProject','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','SquareOdbc','../api/squareOdbc/squareOdbc.model'];(function(_0xe51596,_0x314d5b){var _0x22c705=function(_0x4c6f94){while(--_0x4c6f94){_0xe51596['push'](_0xe51596['shift']());}};_0x22c705(++_0x314d5b);}(_0xf0f1,0x110));var _0x1f0f=function(_0x12d812,_0x496bb7){_0x12d812=_0x12d812-0x0;var _0x3711ab=_0xf0f1[_0x12d812];return _0x3711ab;};'use strict';var path=require('path');var config=require(_0x1f0f('0x0'));var Sequelize=require(_0x1f0f('0x1'));var _=require(_0x1f0f('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x1f0f('0x1')]=_['defaultsDeep'](config[_0x1f0f('0x1')],{'database':'motion2','username':_0x1f0f('0x3'),'password':_0x1f0f('0x4'),'options':{'host':_0x1f0f('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x1f0f('0x6')},'logging':![],'timezone':timezone[_0x1f0f('0x7')](),'define':{'charset':_0x1f0f('0x8'),'collate':_0x1f0f('0x9')}}});config[_0x1f0f('0xa')]=_[_0x1f0f('0xb')](config[_0x1f0f('0xa')],{'database':'motion2','username':'xcall','password':_0x1f0f('0x4'),'options':{'host':_0x1f0f('0x5'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x1f0f('0x6')},'logging':![],'timezone':timezone[_0x1f0f('0x7')](),'define':{'charset':_0x1f0f('0x8'),'collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize'][_0x1f0f('0xc')],config['sequelize'][_0x1f0f('0xd')],config[_0x1f0f('0x1')][_0x1f0f('0xe')],config[_0x1f0f('0x1')][_0x1f0f('0xf')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config[_0x1f0f('0xa')][_0x1f0f('0xc')],config[_0x1f0f('0xa')][_0x1f0f('0xd')],config[_0x1f0f('0xa')][_0x1f0f('0xe')],config[_0x1f0f('0xa')][_0x1f0f('0xf')])};db[_0x1f0f('0x10')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x11'));db[_0x1f0f('0x12')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x14'));db[_0x1f0f('0x15')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/voiceContext/voiceContext.model');db['VoiceExtension']=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/voiceExtension/voiceExtension.model');db['VoiceMusicOnHold']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x16'));db['VoiceQueue']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x17'));db[_0x1f0f('0x18')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x19'));db[_0x1f0f('0x1a')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x1b'));db[_0x1f0f('0x1c')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x1d'));db[_0x1f0f('0x1e')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x1f'));db[_0x1f0f('0x20')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x21'));db[_0x1f0f('0x22')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x23'));db[_0x1f0f('0x24')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x25'));db[_0x1f0f('0x26')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x27'));db[_0x1f0f('0x28')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/memberReport/memberReport.model');db[_0x1f0f('0x29')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x2a'));db['VoiceTransferReport']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x2b'));db[_0x1f0f('0x2c')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/userVoiceQueueRt/userVoiceQueueRt.model');db[_0x1f0f('0x2d')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x2e'));db[_0x1f0f('0x2f')]=db['sequelize'][_0x1f0f('0x13')]('../api/userChatQueue/userChatQueue.model');db[_0x1f0f('0x30')]=db[_0x1f0f('0x1')]['import']('../api/userMailQueue/userMailQueue.model');db['UserFaxQueue']=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x31'));db[_0x1f0f('0x32')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x33'));db[_0x1f0f('0x34')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/userOpenchannelQueue/userOpenchannelQueue.model');db[_0x1f0f('0x35')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x36'));db[_0x1f0f('0x37')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x38'));db[_0x1f0f('0x39')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x3a'));db[_0x1f0f('0x3b')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x3c'));db['MailQueue']=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x3d'));db['MailSubstatus']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x3e'));db[_0x1f0f('0x3f')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x40'));db[_0x1f0f('0x41')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x42'));db['MailApplication']=db['sequelize']['import'](_0x1f0f('0x43'));db['MailQueueReport']=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/mailQueueReport/mailQueueReport.model');db[_0x1f0f('0x44')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x45'));db[_0x1f0f('0x46')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x47'));db[_0x1f0f('0x48')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/faxAccount/faxAccount.model');db[_0x1f0f('0x49')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x4a'));db[_0x1f0f('0x4b')]=db['sequelize']['import']('../api/faxInteraction/faxInteraction.model');db['FaxMessage']=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x4c'));db[_0x1f0f('0x4d')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x4e'));db[_0x1f0f('0x4f')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x50'));db[_0x1f0f('0x51')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x52'));db[_0x1f0f('0x53')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x54'));db[_0x1f0f('0x55')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x56'));db[_0x1f0f('0x57')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x58'));db[_0x1f0f('0x59')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/smsQueue/smsQueue.model');db['OpenchannelAccount']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x5a'));db[_0x1f0f('0x5b')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x5c'));db[_0x1f0f('0x5d')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x5e'));db[_0x1f0f('0x5f')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x60'));db[_0x1f0f('0x61')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x62'));db['ChatWebsite']=db['sequelize']['import'](_0x1f0f('0x63'));db[_0x1f0f('0x64')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x65'));db[_0x1f0f('0x66')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x67'));db['ChatInteraction']=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x68'));db[_0x1f0f('0x69')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/chatMessage/chatMessage.model');db[_0x1f0f('0x6a')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x6b'));db[_0x1f0f('0x6c')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x6d'));db['ChatGroup']=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x6e'));db[_0x1f0f('0x6f')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x70'));db[_0x1f0f('0x71')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/cmCompany/cmCompany.model');db['CmContact']=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/cmContact/cmContact.model');db['CmHopper']=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x72'));db[_0x1f0f('0x73')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x74'));db['CmHopperFinal']=db['sequelize']['import']('../api/cmHopperFinal/cmHopperFinal.model');db['CmHopperHistory']=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x75'));db[_0x1f0f('0x76')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x77'));db[_0x1f0f('0x78')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x79'));db[_0x1f0f('0x7a')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/action/action.model');db[_0x1f0f('0x7b')]=db[_0x1f0f('0x1')]['import']('../api/automation/automation.model');db[_0x1f0f('0x7c')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/cannedAnswer/cannedAnswer.model');db[_0x1f0f('0x7d')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x7e'));db[_0x1f0f('0x7f')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x80'));db[_0x1f0f('0x81')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/interval/interval.model');db[_0x1f0f('0x82')]=db['sequelize']['import']('../api/pause/pause.model');db[_0x1f0f('0x83')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x84'));db[_0x1f0f('0x85')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/voiceQueuesLog/voiceQueuesLog.model');db[_0x1f0f('0x86')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x87'));db[_0x1f0f('0x88')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x89'));db[_0x1f0f('0x8a')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x8b'));db['Template']=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x8c'));db[_0x1f0f('0x8d')]=db['sequelize'][_0x1f0f('0x13')]('../api/trigger/trigger.model');db[_0x1f0f('0x8e')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x8f'));db[_0x1f0f('0x90')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x91'));db['IntegrationReport']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x92'));db[_0x1f0f('0x93')]=db[_0x1f0f('0x1')]['import']('../api/analyticCustomReport/analyticCustomReport.model');db[_0x1f0f('0x94')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/analyticDefaultReport/analyticDefaultReport.model');db[_0x1f0f('0x95')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/analyticExtractedReport/analyticExtractedReport.model');db[_0x1f0f('0x96')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x97'));db[_0x1f0f('0x98')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0x99'));db[_0x1f0f('0x9a')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/analyticTreeReport/analyticTreeReport.model');db[_0x1f0f('0x9b')]=db[_0x1f0f('0x1')]['import']('../api/intSalesforceAccount/intSalesforceAccount.model');db['SalesforceConfiguration']=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/intSalesforceConfiguration/intSalesforceConfiguration.model');db[_0x1f0f('0x9c')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x9d'));db[_0x1f0f('0x9e')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x1f0f('0x9f')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xa0'));db[_0x1f0f('0xa1')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xa2'));db['DeskAccount']=db['sequelize']['import']('../api/intDeskAccount/intDeskAccount.model');db[_0x1f0f('0xa3')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xa4'));db[_0x1f0f('0xa5')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/intDeskField/intDeskField.model');db[_0x1f0f('0xa6')]=db['sequelize'][_0x1f0f('0x13')]('../api/intZohoAccount/intZohoAccount.model');db[_0x1f0f('0xa7')]=db[_0x1f0f('0x1')]['import']('../api/intZohoConfiguration/intZohoConfiguration.model');db['ZohoField']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xa8'));db['ZendeskAccount']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xa9'));db['ZendeskConfiguration']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xaa'));db['ZendeskField']=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xab'));db[_0x1f0f('0xac')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db[_0x1f0f('0xad')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xae'));db['FreshdeskField']=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/intFreshdeskField/intFreshdeskField.model');db[_0x1f0f('0xaf')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/intVtigerAccount/intVtigerAccount.model');db[_0x1f0f('0xb0')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xb1'));db[_0x1f0f('0xb2')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xb3'));db[_0x1f0f('0xb4')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0xb5'));db['ServicenowConfiguration']=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xb6'));db[_0x1f0f('0xb7')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xb8'));db[_0x1f0f('0xb9')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xba'));db[_0x1f0f('0xbb')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0xbc'));db[_0x1f0f('0xbd')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/intDynamics365Field/intDynamics365Field.model');db[_0x1f0f('0xbe')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/intFreshsalesAccount/intFreshsalesAccount.model');db[_0x1f0f('0xbf')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0xc0'));db[_0x1f0f('0xc1')]=db['sequelize']['import'](_0x1f0f('0xc2'));db['Integration']=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/integration/integration.model');db['Network']=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xc3'));db[_0x1f0f('0xc4')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xc5'));db[_0x1f0f('0xc6')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xc7'));db[_0x1f0f('0xc8')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xc9'));db['JscriptyQuestionReport']=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/jscriptyQuestionReport/jscriptyQuestionReport.model');db[_0x1f0f('0xca')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xcb'));db[_0x1f0f('0xcc')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xcd'));db[_0x1f0f('0xce')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0xcf'));db[_0x1f0f('0xd0')]=db['sequelize'][_0x1f0f('0x13')]('../api/squareReportDetail/squareReportDetail.model');db[_0x1f0f('0xd1')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xd2'));db[_0x1f0f('0xd3')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xd4'));db[_0x1f0f('0xd5')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xd6'));db[_0x1f0f('0xd7')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xd8'));db[_0x1f0f('0xd9')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xda'));db['SquareMessage']=db[_0x1f0f('0x1')]['import']('../api/squareMessage/squareMessage.model');db[_0x1f0f('0xdb')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/team/team.model');db[_0x1f0f('0xdc')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0xdd'));db[_0x1f0f('0xde')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xdf'));db[_0x1f0f('0xe0')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xe1'));db[_0x1f0f('0xe2')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xe3'));db['Plugin']=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xe4'));db[_0x1f0f('0xe5')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xe6'));db['ChatTransferReport']=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xe7'));db['FaxTransferReport']=db[_0x1f0f('0x1')]['import'](_0x1f0f('0xe8'));db[_0x1f0f('0xe9')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xea'));db[_0x1f0f('0xeb')]=db[_0x1f0f('0x1')]['import'](_0x1f0f('0xec'));db[_0x1f0f('0xed')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xee'));db[_0x1f0f('0xef')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xf0'));db[_0x1f0f('0xf1')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/userProfile/userProfile.model');db[_0x1f0f('0xf2')]=db[_0x1f0f('0x1')]['import']('../api/userProfileSection/userProfileSection.model');db[_0x1f0f('0xf3')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xf4'));db[_0x1f0f('0xf5')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xf6'));db[_0x1f0f('0xf7')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xf8'));db['WhatsappApplication']=db['sequelize'][_0x1f0f('0x13')]('../api/whatsappApplication/whatsappApplication.model');db[_0x1f0f('0xf9')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/whatsappInteraction/whatsappInteraction.model');db[_0x1f0f('0xfa')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/whatsappMessage/whatsappMessage.model');db['WhatsappQueueReport']=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0xfb'));db[_0x1f0f('0xfc')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')]('../api/whatsappTransferReport/whatsappTransferReport.model');db['WhatsappQueue']=db['sequelize']['import'](_0x1f0f('0xfd'));db[_0x1f0f('0xfe')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0xff'));db[_0x1f0f('0x100')]=db['sequelize'][_0x1f0f('0x13')](_0x1f0f('0x101'));db[_0x1f0f('0x102')]=db[_0x1f0f('0x1')][_0x1f0f('0x13')](_0x1f0f('0x103'));db[_0x1f0f('0x10')][_0x1f0f('0x104')](db[_0x1f0f('0x1c')],{'as':_0x1f0f('0x1c'),'onDelete':'cascade','foreignKey':'UserId'});db[_0x1f0f('0x10')][_0x1f0f('0x105')](db['VoiceRecording'],{'as':_0x1f0f('0x106'),'foreignKey':_0x1f0f('0x107')});db['User'][_0x1f0f('0x105')](db[_0x1f0f('0x2c')],{'as':'VoiceQueuesRt','foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10')][_0x1f0f('0x105')](db[_0x1f0f('0x108')],{'as':_0x1f0f('0x109'),'onDelete':_0x1f0f('0x10a'),'hooks':!![]});db['User'][_0x1f0f('0x105')](db['CmHopperFinal'],{'as':_0x1f0f('0x10b'),'foreignKey':'UserId'});db[_0x1f0f('0x10')][_0x1f0f('0x105')](db['CmHopperHistory'],{'as':_0x1f0f('0x10c'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10')]['hasMany'](db[_0x1f0f('0x76')],{'as':_0x1f0f('0x76'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10')][_0x1f0f('0x105')](db[_0x1f0f('0x5d')],{'as':_0x1f0f('0x10d'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10')][_0x1f0f('0x105')](db[_0x1f0f('0x10e')],{'as':'ChatInteractions','foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10')]['hasMany'](db[_0x1f0f('0x55')],{'as':_0x1f0f('0x10f'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10')][_0x1f0f('0x105')](db[_0x1f0f('0x4b')],{'as':'FaxInteractions','foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10')][_0x1f0f('0x105')](db[_0x1f0f('0x3f')],{'as':_0x1f0f('0x110'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10')][_0x1f0f('0x105')](db[_0x1f0f('0xf9')],{'as':_0x1f0f('0x111'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10')][_0x1f0f('0x105')](db[_0x1f0f('0xf5')],{'as':'UserNotifications','foreignKey':'SenderId'});db[_0x1f0f('0x10')][_0x1f0f('0x112')](db[_0x1f0f('0xf1')],{'as':_0x1f0f('0xf1'),'foreignKey':'userProfileId'});db['User'][_0x1f0f('0x113')](db[_0x1f0f('0x114')],{'as':_0x1f0f('0x115'),'through':'chat_group_has_users'});db[_0x1f0f('0x10')]['belongsToMany'](db[_0x1f0f('0x116')],{'as':'Contacts','through':_0x1f0f('0x117')});db['User'][_0x1f0f('0x113')](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x118'),'through':_0x1f0f('0x119')});db['User'][_0x1f0f('0x113')](db[_0x1f0f('0xdb')],{'through':_0x1f0f('0x11a')});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db['MailInteraction'],{'as':_0x1f0f('0x110'),'through':_0x1f0f('0x11b')});db['User'][_0x1f0f('0x113')](db[_0x1f0f('0x10e')],{'as':_0x1f0f('0x11c'),'through':_0x1f0f('0x11d')});db['User'][_0x1f0f('0x113')](db[_0x1f0f('0x4b')],{'as':_0x1f0f('0x11e'),'through':_0x1f0f('0x11f')});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db[_0x1f0f('0x55')],{'as':_0x1f0f('0x10f'),'through':'user_has_sms_interactions'});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db['OpenchannelInteraction'],{'as':_0x1f0f('0x10d'),'through':'user_has_openchannel_interactions'});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db[_0x1f0f('0xf9')],{'as':_0x1f0f('0x111'),'through':_0x1f0f('0x120')});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db[_0x1f0f('0x121')],{'as':_0x1f0f('0x122'),'through':_0x1f0f('0x2d'),'required':![]});db[_0x1f0f('0x10')]['belongsToMany'](db[_0x1f0f('0x123')],{'as':_0x1f0f('0x124'),'through':_0x1f0f('0x30'),'required':![]});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db['ChatQueue'],{'as':_0x1f0f('0x125'),'through':_0x1f0f('0x2f'),'required':![],'hooks':!![]});db['User'][_0x1f0f('0x113')](db['FaxQueue'],{'as':_0x1f0f('0x126'),'through':'UserFaxQueue','required':![]});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db['SmsQueue'],{'as':_0x1f0f('0x127'),'through':_0x1f0f('0x32'),'required':![]});db[_0x1f0f('0x10')]['belongsToMany'](db[_0x1f0f('0x61')],{'as':_0x1f0f('0x128'),'through':'UserOpenchannelQueue','required':![]});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db[_0x1f0f('0x129')],{'as':_0x1f0f('0x12a'),'through':_0x1f0f('0x35'),'required':![]});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db['CmList'],{'through':'cm_user_has_lists'});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db[_0x1f0f('0xef')],{'as':_0x1f0f('0x12b'),'through':'user_has_voice_prefixes','required':![]});db['User'][_0x1f0f('0x113')](db[_0x1f0f('0x12c')],{'as':_0x1f0f('0x12d'),'through':_0x1f0f('0x12e')});db['User'][_0x1f0f('0x113')](db[_0x1f0f('0x48')],{'as':'FaxAccounts','through':'user_has_fax_accounts'});db[_0x1f0f('0x10')]['belongsToMany'](db[_0x1f0f('0x3b')],{'as':_0x1f0f('0x12f'),'through':_0x1f0f('0x130')});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db[_0x1f0f('0x131')],{'as':'OpenchannelAccounts','through':'user_has_openchannel_accounts'});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db[_0x1f0f('0x51')],{'as':_0x1f0f('0x132'),'through':_0x1f0f('0x133')});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db['WhatsappAccount'],{'as':'WhatsappAccounts','through':_0x1f0f('0x134')});db[_0x1f0f('0x10')][_0x1f0f('0x113')](db['SquareProject'],{'as':'SquareProjects','through':'user_has_square_projects'});db[_0x1f0f('0x12')]['hasMany'](db[_0x1f0f('0x108')],{'as':_0x1f0f('0x135'),'onDelete':'cascade','foreignKey':_0x1f0f('0x136')});db[_0x1f0f('0x15')][_0x1f0f('0x105')](db[_0x1f0f('0x108')],{'onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0x108')][_0x1f0f('0x105')](db[_0x1f0f('0x108')],{'as':_0x1f0f('0x137'),'onDelete':_0x1f0f('0x10a')});db['VoiceMusicOnHold'][_0x1f0f('0x113')](db[_0x1f0f('0x88')],{'as':'Sounds','through':_0x1f0f('0x138')});db['VoiceQueue'][_0x1f0f('0x105')](db[_0x1f0f('0x2c')],{'as':_0x1f0f('0x139'),'foreignKey':_0x1f0f('0x13a')});db['VoiceQueue'][_0x1f0f('0x105')](db[_0x1f0f('0x13b')],{'as':_0x1f0f('0x13c'),'foreignKey':_0x1f0f('0x13a')});db['VoiceQueue']['hasMany'](db[_0x1f0f('0x13d')],{'as':_0x1f0f('0x10b'),'foreignKey':_0x1f0f('0x13a')});db[_0x1f0f('0x121')][_0x1f0f('0x105')](db[_0x1f0f('0x13e')],{'as':_0x1f0f('0x13f'),'foreignKey':_0x1f0f('0x13a')});db['VoiceQueue'][_0x1f0f('0x105')](db[_0x1f0f('0x76')],{'as':'ReportAgentPreview','foreignKey':_0x1f0f('0x13a')});db[_0x1f0f('0x121')]['hasMany'](db[_0x1f0f('0x73')],{'as':_0x1f0f('0x140'),'foreignKey':_0x1f0f('0x13a')});db[_0x1f0f('0x121')][_0x1f0f('0x105')](db['JscriptySessionReport'],{'as':_0x1f0f('0x141'),'foreignKey':_0x1f0f('0x13a')});db['VoiceQueue']['belongsTo'](db['Trunk'],{'as':'Trunk','foreignKey':_0x1f0f('0x142')});db[_0x1f0f('0x121')]['belongsTo'](db[_0x1f0f('0x29')],{'as':'TrunkBackup','foreignKey':_0x1f0f('0x143')});db[_0x1f0f('0x121')][_0x1f0f('0x112')](db[_0x1f0f('0x81')],{'as':'Interval','foreignKey':_0x1f0f('0x144')});db[_0x1f0f('0x121')][_0x1f0f('0x112')](db[_0x1f0f('0x82')],{'as':'mandatoryDispositionPause','foreignKey':_0x1f0f('0x145')});db['VoiceQueue'][_0x1f0f('0x113')](db[_0x1f0f('0xed')],{'as':'Lists','through':'voice_queues_has_cm_lists'});db['VoiceQueue'][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':'Agents','through':_0x1f0f('0x2d')});db[_0x1f0f('0x121')]['belongsToMany'](db[_0x1f0f('0xdb')],{'as':_0x1f0f('0x146'),'through':_0x1f0f('0x102')});db[_0x1f0f('0x121')]['belongsToMany'](db[_0x1f0f('0xed')],{'as':'BlackLists','through':_0x1f0f('0x147')});db[_0x1f0f('0x18')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x10'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x1a')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x10'),'foreignKey':'UserId'});db[_0x1f0f('0x1c')]['hasMany'](db['VoiceMailMessage'],{'as':'Messages','onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x148'),'sourceKey':_0x1f0f('0x149')});db[_0x1f0f('0x1e')]['belongsTo'](db[_0x1f0f('0x1c')],{'foreignKey':'mailboxuser','targetKey':_0x1f0f('0x149')});db['VoiceCallReport'][_0x1f0f('0x105')](db[_0x1f0f('0x26')],{'as':'QueueCalls','foreignKey':_0x1f0f('0x14a'),'constraints':![]});db[_0x1f0f('0x20')]['hasMany'](db[_0x1f0f('0x24')],{'as':_0x1f0f('0x14b'),'foreignKey':'uniqueid','constraints':![]});db[_0x1f0f('0x20')][_0x1f0f('0x112')](db['User'],{'as':'User','foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x20')][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x14c'),'foreignKey':'ContactId'});db['MailServerIn'][_0x1f0f('0x112')](db[_0x1f0f('0x3b')],{'as':'MailAccount','foreignKey':_0x1f0f('0x14d')});db['MailServerOut'][_0x1f0f('0x112')](db[_0x1f0f('0x3b')],{'as':_0x1f0f('0x3b'),'foreignKey':_0x1f0f('0x14d')});db[_0x1f0f('0x3b')][_0x1f0f('0x104')](db[_0x1f0f('0x37')],{'as':_0x1f0f('0x14e'),'onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0x3b')][_0x1f0f('0x104')](db['MailServerOut'],{'as':_0x1f0f('0x14f'),'onDelete':'cascade'});db['MailAccount']['hasMany'](db[_0x1f0f('0x7d')],{'as':_0x1f0f('0x150'),'foreignKey':_0x1f0f('0x14d')});db[_0x1f0f('0x3b')][_0x1f0f('0x105')](db[_0x1f0f('0x7c')],{'as':_0x1f0f('0x151'),'foreignKey':'MailAccountId'});db[_0x1f0f('0x3b')][_0x1f0f('0x105')](db[_0x1f0f('0x41')],{'as':_0x1f0f('0x152'),'foreignKey':_0x1f0f('0x14d')});db[_0x1f0f('0x3b')][_0x1f0f('0x105')](db[_0x1f0f('0x3f')],{'as':'Interactions'});db[_0x1f0f('0x3b')][_0x1f0f('0x105')](db['MailApplication'],{'as':_0x1f0f('0x137')});db[_0x1f0f('0x3b')][_0x1f0f('0x112')](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0x3b')]['belongsTo'](db[_0x1f0f('0x155')],{'as':_0x1f0f('0x155'),'foreignKey':_0x1f0f('0x156')});db[_0x1f0f('0x3b')][_0x1f0f('0x112')](db['Pause'],{'as':_0x1f0f('0x157'),'foreignKey':_0x1f0f('0x145')});db[_0x1f0f('0x3b')]['belongsToMany'](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x130')});db[_0x1f0f('0x123')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x30')});db[_0x1f0f('0x123')][_0x1f0f('0x113')](db[_0x1f0f('0xdb')],{'through':_0x1f0f('0x159'),'as':_0x1f0f('0x146')});db[_0x1f0f('0x3f')][_0x1f0f('0x105')](db[_0x1f0f('0x41')],{'as':'Messages','onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x15a')});db[_0x1f0f('0x3f')][_0x1f0f('0x112')](db[_0x1f0f('0x3b')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x14d')});db[_0x1f0f('0x3f')]['belongsTo'](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x14c'),'foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0x3f')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x15d'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x3f')][_0x1f0f('0x113')](db[_0x1f0f('0x8a')],{'through':_0x1f0f('0x15e'),'as':_0x1f0f('0x15f')});db[_0x1f0f('0x3f')]['belongsToMany'](db[_0x1f0f('0x8a')],{'through':_0x1f0f('0x15e'),'as':_0x1f0f('0x160')});db[_0x1f0f('0x3f')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x161'),'through':_0x1f0f('0x11b'),'foreignKey':_0x1f0f('0x15a')});db[_0x1f0f('0x41')][_0x1f0f('0x105')](db[_0x1f0f('0xe2')],{'as':_0x1f0f('0x162'),'onDelete':'cascade'});db['MailMessage'][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'as':'User'});db[_0x1f0f('0x41')][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'onDelete':_0x1f0f('0x10a'),'as':_0x1f0f('0x14c')});db[_0x1f0f('0x41')][_0x1f0f('0x112')](db[_0x1f0f('0x3f')],{'as':_0x1f0f('0x163'),'foreignKey':_0x1f0f('0x15a')});db['MailMessage'][_0x1f0f('0x112')](db[_0x1f0f('0x3b')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x14d')});db[_0x1f0f('0x41')][_0x1f0f('0x112')](db[_0x1f0f('0x12c')],{'as':_0x1f0f('0x12c'),'foreignKey':'ChatWebsiteId'});db['MailMessage'][_0x1f0f('0x112')](db[_0x1f0f('0x6a')],{'as':_0x1f0f('0x6a'),'foreignKey':_0x1f0f('0x164')});db[_0x1f0f('0x165')][_0x1f0f('0x112')](db['User'],{'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x165')][_0x1f0f('0x112')](db[_0x1f0f('0x123')],{'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x165')][_0x1f0f('0x112')](db[_0x1f0f('0x3b')],{'onDelete':'restrict'});db[_0x1f0f('0x165')][_0x1f0f('0x112')](db[_0x1f0f('0x81')],{'onDelete':_0x1f0f('0x166'),'foreignKey':_0x1f0f('0x144')});db[_0x1f0f('0x165')][_0x1f0f('0x112')](db[_0x1f0f('0x8a')],{'onDelete':_0x1f0f('0x166'),'foreignKey':_0x1f0f('0x167')});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db['MailQueueReport'][_0x1f0f('0x112')](db[_0x1f0f('0xed')],{'as':'List','foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0x168')]['belongsTo'](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x14c'),'foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0x168')]['belongsTo'](db[_0x1f0f('0x3f')],{});db[_0x1f0f('0x168')][_0x1f0f('0x112')](db[_0x1f0f('0x41')],{});db['MailQueueReport'][_0x1f0f('0x112')](db['User'],{});db['MailQueueReport']['belongsTo'](db[_0x1f0f('0x123')],{});db['Dashboard'][_0x1f0f('0x105')](db[_0x1f0f('0x46')],{'as':_0x1f0f('0x169'),'onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0x48')]['hasMany'](db[_0x1f0f('0x7d')],{'as':_0x1f0f('0x150'),'foreignKey':_0x1f0f('0x16a')});db[_0x1f0f('0x48')]['hasMany'](db[_0x1f0f('0x7c')],{'as':_0x1f0f('0x151'),'foreignKey':_0x1f0f('0x16a')});db[_0x1f0f('0x48')][_0x1f0f('0x105')](db['FaxInteraction'],{'as':_0x1f0f('0x16b')});db[_0x1f0f('0x48')][_0x1f0f('0x105')](db[_0x1f0f('0x49')],{'as':_0x1f0f('0x137')});db[_0x1f0f('0x48')][_0x1f0f('0x105')](db['VoiceExtension'],{'as':_0x1f0f('0x16c'),'onDelete':_0x1f0f('0x10a')});db['FaxAccount'][_0x1f0f('0x105')](db['FaxMessage'],{'as':_0x1f0f('0x152')});db[_0x1f0f('0x48')]['belongsTo'](db[_0x1f0f('0x29')],{'as':'Trunk'});db['FaxAccount'][_0x1f0f('0x112')](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154')});db['FaxAccount']['belongsTo'](db[_0x1f0f('0x82')],{'as':_0x1f0f('0x157'),'foreignKey':_0x1f0f('0x145')});db[_0x1f0f('0x48')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x16d')});db[_0x1f0f('0x49')][_0x1f0f('0x112')](db['User'],{'onDelete':'restrict'});db[_0x1f0f('0x49')]['belongsTo'](db[_0x1f0f('0x4d')],{'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x49')][_0x1f0f('0x112')](db[_0x1f0f('0x48')],{'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x49')][_0x1f0f('0x112')](db['Tag'],{'onDelete':_0x1f0f('0x166'),'foreignKey':'TagId'});db[_0x1f0f('0x4b')][_0x1f0f('0x105')](db[_0x1f0f('0x16e')],{'as':_0x1f0f('0x152'),'onDelete':_0x1f0f('0x10a'),'foreignKey':'FaxInteractionId'});db['FaxInteraction']['belongsTo'](db[_0x1f0f('0x48')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x16a')});db[_0x1f0f('0x4b')][_0x1f0f('0x112')](db['CmContact'],{'as':_0x1f0f('0x14c'),'foreignKey':'ContactId'});db[_0x1f0f('0x4b')][_0x1f0f('0x112')](db['User'],{'as':_0x1f0f('0x15d'),'foreignKey':'UserId'});db['FaxInteraction']['belongsToMany'](db[_0x1f0f('0x8a')],{'through':_0x1f0f('0x16f'),'as':_0x1f0f('0x15f')});db['FaxInteraction'][_0x1f0f('0x113')](db[_0x1f0f('0x8a')],{'through':_0x1f0f('0x16f'),'as':_0x1f0f('0x160')});db['FaxInteraction'][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':'Users','through':_0x1f0f('0x11f'),'foreignKey':_0x1f0f('0x170')});db[_0x1f0f('0x16e')][_0x1f0f('0x112')](db['User'],{'onDelete':_0x1f0f('0x10a'),'as':'User'});db[_0x1f0f('0x16e')][_0x1f0f('0x112')](db['FaxInteraction'],{'as':_0x1f0f('0x163'),'foreignKey':_0x1f0f('0x170')});db['FaxMessage'][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'onDelete':_0x1f0f('0x10a'),'as':_0x1f0f('0x14c')});db['FaxMessage'][_0x1f0f('0x112')](db[_0x1f0f('0xe2')],{'as':_0x1f0f('0xe2'),'foreignKey':_0x1f0f('0x171')});db[_0x1f0f('0x16e')][_0x1f0f('0x112')](db['FaxAccount'],{'as':_0x1f0f('0x15b'),'foreignKey':'FaxAccountId'});db[_0x1f0f('0x4d')]['belongsToMany'](db['User'],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x172')});db[_0x1f0f('0x4d')][_0x1f0f('0x113')](db[_0x1f0f('0xdb')],{'through':'team_has_fax_queues','as':'Teams'});db['FaxQueueReport'][_0x1f0f('0x112')](db[_0x1f0f('0x48')],{});db['FaxQueueReport'][_0x1f0f('0x112')](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0x4f')]['belongsTo'](db['CmContact'],{'as':_0x1f0f('0x14c'),'foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0x4f')][_0x1f0f('0x112')](db['FaxInteraction'],{});db['FaxQueueReport'][_0x1f0f('0x112')](db[_0x1f0f('0x16e')],{});db['FaxQueueReport'][_0x1f0f('0x112')](db['User'],{});db[_0x1f0f('0x4f')][_0x1f0f('0x112')](db[_0x1f0f('0x4d')],{});db[_0x1f0f('0x51')]['hasMany'](db[_0x1f0f('0x7d')],{'as':_0x1f0f('0x150'),'foreignKey':_0x1f0f('0x173')});db['SmsAccount']['hasMany'](db[_0x1f0f('0x7c')],{'as':_0x1f0f('0x151'),'foreignKey':'SmsAccountId'});db[_0x1f0f('0x51')][_0x1f0f('0x105')](db['SmsMessage'],{'as':'Messages','foreignKey':_0x1f0f('0x173')});db['SmsAccount']['hasMany'](db[_0x1f0f('0x55')],{'as':'Interactions'});db[_0x1f0f('0x51')]['hasMany'](db[_0x1f0f('0x53')],{'as':'Applications'});db['SmsAccount'][_0x1f0f('0x112')](db['CmList'],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154')});db['SmsAccount'][_0x1f0f('0x112')](db['Pause'],{'as':_0x1f0f('0x157'),'foreignKey':_0x1f0f('0x145')});db['SmsAccount'][_0x1f0f('0x113')](db['User'],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x133')});db[_0x1f0f('0x53')][_0x1f0f('0x112')](db['User'],{'onDelete':_0x1f0f('0x166')});db['SmsApplication']['belongsTo'](db['SmsQueue'],{'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x53')][_0x1f0f('0x112')](db[_0x1f0f('0x51')],{'onDelete':_0x1f0f('0x166')});db['SmsApplication'][_0x1f0f('0x112')](db['Interval'],{'onDelete':_0x1f0f('0x166'),'foreignKey':_0x1f0f('0x144')});db[_0x1f0f('0x53')][_0x1f0f('0x112')](db[_0x1f0f('0x8a')],{'onDelete':_0x1f0f('0x166'),'foreignKey':_0x1f0f('0x167')});db['SmsInteraction'][_0x1f0f('0x105')](db['SmsMessage'],{'as':_0x1f0f('0x152'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x174')});db['SmsInteraction'][_0x1f0f('0x112')](db[_0x1f0f('0x51')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x173')});db['SmsInteraction']['belongsTo'](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x14c'),'foreignKey':'ContactId'});db[_0x1f0f('0x55')]['belongsTo'](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x15d'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x55')]['belongsToMany'](db[_0x1f0f('0x8a')],{'through':'sms_interaction_has_tags','as':_0x1f0f('0x15f')});db[_0x1f0f('0x55')]['belongsToMany'](db['Tag'],{'through':_0x1f0f('0x175'),'as':_0x1f0f('0x160')});db['SmsInteraction']['belongsToMany'](db['User'],{'as':_0x1f0f('0x161'),'through':_0x1f0f('0x176'),'foreignKey':_0x1f0f('0x174')});db[_0x1f0f('0x57')]['belongsTo'](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x10')});db[_0x1f0f('0x57')][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'onDelete':_0x1f0f('0x10a'),'as':'Contact'});db[_0x1f0f('0x57')][_0x1f0f('0x112')](db[_0x1f0f('0x55')],{'onDelete':_0x1f0f('0x10a'),'as':'Interaction','foreignKey':_0x1f0f('0x174')});db[_0x1f0f('0x57')][_0x1f0f('0x112')](db[_0x1f0f('0x51')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x173')});db[_0x1f0f('0x59')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x32'),'foreignKey':_0x1f0f('0x177')});db[_0x1f0f('0x59')][_0x1f0f('0x113')](db[_0x1f0f('0xdb')],{'through':_0x1f0f('0x178'),'as':_0x1f0f('0x146')});db[_0x1f0f('0x131')][_0x1f0f('0x105')](db[_0x1f0f('0x7d')],{'as':_0x1f0f('0x150'),'foreignKey':'OpenchannelAccountId'});db[_0x1f0f('0x131')][_0x1f0f('0x105')](db[_0x1f0f('0x7c')],{'as':_0x1f0f('0x151'),'foreignKey':_0x1f0f('0x179')});db['OpenchannelAccount']['hasMany'](db[_0x1f0f('0x5d')],{'as':_0x1f0f('0x16b'),'foreignKey':'OpenchannelAccountId'});db[_0x1f0f('0x131')]['hasMany'](db['OpenchannelMessage'],{'as':_0x1f0f('0x152'),'foreignKey':_0x1f0f('0x179')});db[_0x1f0f('0x131')][_0x1f0f('0x105')](db[_0x1f0f('0x5b')],{'as':'Applications','foreignKey':_0x1f0f('0x179')});db[_0x1f0f('0x131')][_0x1f0f('0x112')](db[_0x1f0f('0xed')],{'as':'List','foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0x131')][_0x1f0f('0x112')](db['Pause'],{'as':_0x1f0f('0x157'),'foreignKey':_0x1f0f('0x145')});db[_0x1f0f('0x131')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x17a')});db[_0x1f0f('0x5b')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'onDelete':'restrict'});db['OpenchannelApplication'][_0x1f0f('0x112')](db[_0x1f0f('0x61')],{'onDelete':_0x1f0f('0x166'),'foreignKey':'OpenchannelQueueId'});db[_0x1f0f('0x5b')][_0x1f0f('0x112')](db['OpenchannelAccount'],{'onDelete':'restrict','foreignKey':_0x1f0f('0x179')});db['OpenchannelApplication']['belongsTo'](db[_0x1f0f('0x81')],{'onDelete':_0x1f0f('0x166'),'foreignKey':'IntervalId'});db[_0x1f0f('0x5b')][_0x1f0f('0x112')](db[_0x1f0f('0x8a')],{'onDelete':_0x1f0f('0x166'),'foreignKey':_0x1f0f('0x167')});db[_0x1f0f('0x5d')][_0x1f0f('0x105')](db['OpenchannelMessage'],{'as':_0x1f0f('0x152'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x17b')});db[_0x1f0f('0x5d')][_0x1f0f('0x112')](db[_0x1f0f('0x131')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x179')});db['OpenchannelInteraction']['belongsTo'](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x14c'),'foreignKey':'ContactId'});db[_0x1f0f('0x5d')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x15d'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x5d')]['belongsToMany'](db[_0x1f0f('0x8a')],{'through':'openchannel_interaction_has_tags','as':_0x1f0f('0x15f')});db[_0x1f0f('0x5d')][_0x1f0f('0x113')](db[_0x1f0f('0x8a')],{'through':_0x1f0f('0x17c'),'as':_0x1f0f('0x160')});db[_0x1f0f('0x5d')][_0x1f0f('0x113')](db['User'],{'as':_0x1f0f('0x161'),'through':'user_has_openchannel_interactions','foreignKey':_0x1f0f('0x17b')});db['OpenchannelMessage']['belongsTo'](db[_0x1f0f('0x10')],{'onDelete':_0x1f0f('0x10a'),'as':_0x1f0f('0x10')});db[_0x1f0f('0x5f')][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'onDelete':_0x1f0f('0x10a'),'as':_0x1f0f('0x14c')});db[_0x1f0f('0x5f')][_0x1f0f('0x112')](db[_0x1f0f('0x5d')],{'onDelete':'cascade','as':_0x1f0f('0x163'),'foreignKey':_0x1f0f('0x17b')});db['OpenchannelMessage'][_0x1f0f('0x112')](db[_0x1f0f('0xe2')],{'as':_0x1f0f('0xe2'),'foreignKey':_0x1f0f('0x171')});db[_0x1f0f('0x5f')][_0x1f0f('0x112')](db[_0x1f0f('0x131')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x179')});db[_0x1f0f('0x61')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x34'),'foreignKey':_0x1f0f('0x17d')});db[_0x1f0f('0x61')][_0x1f0f('0x113')](db[_0x1f0f('0xdb')],{'through':_0x1f0f('0x17e'),'as':'Teams'});db[_0x1f0f('0x12c')][_0x1f0f('0x105')](db[_0x1f0f('0x7d')],{'as':'Dispositions','foreignKey':'ChatWebsiteId'});db[_0x1f0f('0x12c')][_0x1f0f('0x105')](db[_0x1f0f('0x7c')],{'as':_0x1f0f('0x151'),'foreignKey':_0x1f0f('0x17f')});db[_0x1f0f('0x12c')][_0x1f0f('0x105')](db[_0x1f0f('0x6f')],{'as':_0x1f0f('0x180')});db['ChatWebsite'][_0x1f0f('0x105')](db[_0x1f0f('0x10e')],{'as':_0x1f0f('0x16b')});db[_0x1f0f('0x12c')][_0x1f0f('0x105')](db[_0x1f0f('0x66')],{'as':_0x1f0f('0x137')});db[_0x1f0f('0x12c')][_0x1f0f('0x105')](db[_0x1f0f('0x69')],{'as':_0x1f0f('0x152')});db['ChatWebsite']['belongsTo'](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0x12c')][_0x1f0f('0x112')](db[_0x1f0f('0x81')],{'as':_0x1f0f('0x81'),'foreignKey':_0x1f0f('0x144')});db[_0x1f0f('0x12c')][_0x1f0f('0x112')](db[_0x1f0f('0x3b')],{'as':_0x1f0f('0x3b'),'foreignKey':_0x1f0f('0x14d')});db[_0x1f0f('0x12c')][_0x1f0f('0x112')](db['Pause'],{'as':_0x1f0f('0x157'),'foreignKey':_0x1f0f('0x145')});db[_0x1f0f('0x12c')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':'Agents','through':_0x1f0f('0x12e')});db[_0x1f0f('0x64')][_0x1f0f('0x112')](db[_0x1f0f('0x131')],{});db[_0x1f0f('0x64')]['belongsTo'](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154')});db['OpenchannelQueueReport'][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x14c'),'foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0x64')]['belongsTo'](db[_0x1f0f('0x5d')],{});db['OpenchannelQueueReport'][_0x1f0f('0x112')](db[_0x1f0f('0x5f')],{});db[_0x1f0f('0x64')]['belongsTo'](db['User'],{});db[_0x1f0f('0x64')]['belongsTo'](db['OpenchannelQueue'],{});db[_0x1f0f('0x66')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x181'),'foreignKey':_0x1f0f('0x107'),'onDelete':_0x1f0f('0x166')});db['ChatApplication'][_0x1f0f('0x112')](db[_0x1f0f('0x6c')],{'as':_0x1f0f('0x182'),'foreignKey':_0x1f0f('0x183'),'onDelete':'restrict'});db[_0x1f0f('0x66')][_0x1f0f('0x112')](db['ChatWebsite'],{'as':'Website','foreignKey':'ChatWebsiteId','onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x66')][_0x1f0f('0x112')](db[_0x1f0f('0x8a')],{'onDelete':'restrict','foreignKey':_0x1f0f('0x167')});db[_0x1f0f('0x10e')][_0x1f0f('0x105')](db[_0x1f0f('0x69')],{'as':_0x1f0f('0x152'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x184')});db[_0x1f0f('0x10e')][_0x1f0f('0x112')](db[_0x1f0f('0x12c')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x17f')});db[_0x1f0f('0x10e')][_0x1f0f('0x112')](db['CmContact'],{'as':_0x1f0f('0x14c'),'foreignKey':'ContactId'});db['ChatInteraction'][_0x1f0f('0x112')](db['User'],{'as':_0x1f0f('0x15d'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0x10e')][_0x1f0f('0x113')](db[_0x1f0f('0x8a')],{'through':_0x1f0f('0x185'),'as':_0x1f0f('0x15f')});db[_0x1f0f('0x10e')]['belongsToMany'](db[_0x1f0f('0x8a')],{'through':_0x1f0f('0x185'),'as':_0x1f0f('0x160')});db[_0x1f0f('0x10e')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x161'),'through':_0x1f0f('0x11d'),'foreignKey':_0x1f0f('0x184')});db[_0x1f0f('0x69')]['belongsTo'](db[_0x1f0f('0x10')],{'onDelete':'cascade','as':'User'});db[_0x1f0f('0x69')][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'onDelete':_0x1f0f('0x10a'),'as':_0x1f0f('0x14c'),'foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0x69')][_0x1f0f('0x112')](db[_0x1f0f('0x10e')],{'onDelete':_0x1f0f('0x10a'),'as':_0x1f0f('0x163'),'foreignKey':_0x1f0f('0x184')});db['ChatMessage'][_0x1f0f('0x112')](db[_0x1f0f('0xe2')],{'as':'Attachment','foreignKey':_0x1f0f('0x171')});db['ChatMessage']['belongsTo'](db['ChatWebsite'],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x17f')});db['ChatOfflineMessage'][_0x1f0f('0x105')](db[_0x1f0f('0xe2')],{'as':'Attachments','foreignKey':_0x1f0f('0x164'),'onDelete':_0x1f0f('0x10a'),'hooks':!![]});db['ChatOfflineMessage'][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'onDelete':_0x1f0f('0x10a'),'as':_0x1f0f('0x14c'),'foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0x6a')][_0x1f0f('0x112')](db[_0x1f0f('0x12c')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x17f')});db['ChatQueue'][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':'Agents','through':_0x1f0f('0x2f'),'hooks':!![]});db[_0x1f0f('0x6c')][_0x1f0f('0x113')](db[_0x1f0f('0xdb')],{'through':_0x1f0f('0x186'),'as':_0x1f0f('0x146')});db[_0x1f0f('0x114')]['hasMany'](db[_0x1f0f('0xc6')],{'as':_0x1f0f('0x152'),'foreignKey':_0x1f0f('0x187'),'onDelete':_0x1f0f('0x10a')});db['ChatGroup'][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':'Members','through':_0x1f0f('0x188')});db[_0x1f0f('0x6f')][_0x1f0f('0x112')](db[_0x1f0f('0x12c')],{'as':_0x1f0f('0x189'),'foreignKey':_0x1f0f('0x17f')});db[_0x1f0f('0x71')][_0x1f0f('0x105')](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x18a'),'foreignKey':'CompanyId'});db[_0x1f0f('0x116')][_0x1f0f('0x105')](db[_0x1f0f('0x13b')],{'as':_0x1f0f('0x13c'),'foreignKey':'ContactId'});db['CmContact'][_0x1f0f('0x105')](db[_0x1f0f('0x13d')],{'as':_0x1f0f('0x10b'),'foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0x116')][_0x1f0f('0x105')](db[_0x1f0f('0x13e')],{'as':_0x1f0f('0x13f'),'foreignKey':_0x1f0f('0x15c')});db['CmContact']['hasMany'](db[_0x1f0f('0x76')],{'as':_0x1f0f('0x76'),'foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0x116')][_0x1f0f('0x105')](db[_0x1f0f('0xca')],{'as':_0x1f0f('0x141'),'foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0x116')]['hasMany'](db[_0x1f0f('0x5d')],{'as':_0x1f0f('0x10d'),'foreignKey':_0x1f0f('0x15c'),'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x116')][_0x1f0f('0x105')](db[_0x1f0f('0x10e')],{'as':'ChatInteractions','foreignKey':_0x1f0f('0x15c'),'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x116')]['hasMany'](db[_0x1f0f('0x55')],{'as':_0x1f0f('0x10f'),'foreignKey':_0x1f0f('0x15c'),'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x116')][_0x1f0f('0x105')](db['FaxInteraction'],{'as':_0x1f0f('0x11e'),'foreignKey':_0x1f0f('0x15c'),'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x116')][_0x1f0f('0x105')](db[_0x1f0f('0x3f')],{'as':'MailInteractions','foreignKey':_0x1f0f('0x15c'),'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x116')][_0x1f0f('0x112')](db[_0x1f0f('0x71')],{'as':'Company','foreignKey':_0x1f0f('0x18b')});db['CmContact'][_0x1f0f('0x112')](db['CmList'],{'as':'List','foreignKey':_0x1f0f('0x154'),'onDelete':'cascade'});db[_0x1f0f('0x116')]['belongsToMany'](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x161'),'through':_0x1f0f('0x117')});db[_0x1f0f('0x116')][_0x1f0f('0x113')](db[_0x1f0f('0x8a')],{'as':_0x1f0f('0x15f'),'through':'cm_contact_has_tags'});db[_0x1f0f('0x116')][_0x1f0f('0x113')](db['Tag'],{'through':'cm_contact_has_tags','as':_0x1f0f('0x160')});db[_0x1f0f('0x13b')][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x14c'),'foreignKey':_0x1f0f('0x15c'),'onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0x13b')][_0x1f0f('0x112')](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x153'),'foreignKey':'ListId','onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0x13b')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x181'),'foreignKey':_0x1f0f('0x107')});db['CmHopper'][_0x1f0f('0x112')](db[_0x1f0f('0x121')],{'as':_0x1f0f('0x182'),'foreignKey':_0x1f0f('0x13a'),'onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0x13b')][_0x1f0f('0x112')](db['Campaign'],{'as':_0x1f0f('0xde'),'foreignKey':'CampaignId','onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0x13b')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x15d'),'foreignKey':_0x1f0f('0x18c')});db[_0x1f0f('0x73')]['belongsTo'](db[_0x1f0f('0x116')],{'as':'Contact','foreignKey':'ContactId','onDelete':_0x1f0f('0x10a')});db['CmHopperBlack'][_0x1f0f('0x112')](db['CmList'],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154'),'onDelete':'cascade'});db['CmHopperBlack'][_0x1f0f('0x112')](db[_0x1f0f('0x121')],{'as':_0x1f0f('0x182'),'foreignKey':_0x1f0f('0x13a'),'onDelete':_0x1f0f('0x10a')});db['CmHopperBlack'][_0x1f0f('0x112')](db['Campaign'],{'as':'Campaign','foreignKey':'CampaignId','onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0x7b')][_0x1f0f('0x105')](db[_0x1f0f('0x7f')],{'as':{'plural':_0x1f0f('0x18d'),'singular':'OneAll'},'foreignKey':_0x1f0f('0x18e'),'onDelete':_0x1f0f('0x10a'),'hooks':!![]});db[_0x1f0f('0x7b')][_0x1f0f('0x105')](db[_0x1f0f('0x7f')],{'as':{'plural':_0x1f0f('0x18f'),'singular':_0x1f0f('0x190')},'foreignKey':_0x1f0f('0x191'),'onDelete':_0x1f0f('0x10a'),'hooks':!![]});db[_0x1f0f('0x7b')][_0x1f0f('0x105')](db[_0x1f0f('0x7a')],{'as':_0x1f0f('0x192'),'foreignKey':_0x1f0f('0x193'),'onDelete':_0x1f0f('0x10a'),'hooks':!![]});db[_0x1f0f('0x7d')]['hasMany'](db[_0x1f0f('0x7d')],{'as':'Dispositions','foreignKey':_0x1f0f('0x194'),'onDelete':_0x1f0f('0x10a')});db['Interval'][_0x1f0f('0x105')](db[_0x1f0f('0x81')],{'as':_0x1f0f('0x195'),'foreignKey':'IntervalId','onDelete':_0x1f0f('0x10a'),'hooks':!![],'required':![]});db['Interval']['hasMany'](db[_0x1f0f('0x108')],{'as':'Extensions','foreignKey':_0x1f0f('0x144'),'onDelete':'restrict'});db[_0x1f0f('0x81')][_0x1f0f('0x105')](db[_0x1f0f('0x165')],{'as':_0x1f0f('0x196'),'foreignKey':'IntervalId'});db[_0x1f0f('0x81')][_0x1f0f('0x105')](db['ChatApplication'],{'as':'ChatApplications','foreignKey':'IntervalId'});db[_0x1f0f('0x81')]['hasMany'](db['FaxApplication'],{'as':_0x1f0f('0x197'),'foreignKey':_0x1f0f('0x144')});db[_0x1f0f('0x81')][_0x1f0f('0x105')](db[_0x1f0f('0x53')],{'as':_0x1f0f('0x198'),'foreignKey':'IntervalId'});db['Schedule']['belongsTo'](db['MailAccount'],{});db[_0x1f0f('0x86')][_0x1f0f('0x112')](db['AnalyticDefaultReport'],{'foreignKey':_0x1f0f('0x199')});db[_0x1f0f('0x86')]['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':'CustomReportId'});db[_0x1f0f('0x88')][_0x1f0f('0x113')](db['VoiceMusicOnHold'],{'as':_0x1f0f('0x19a'),'through':'moh_has_sounds','onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x8a')][_0x1f0f('0x113')](db[_0x1f0f('0x116')],{'through':_0x1f0f('0x19b')});db['Tag'][_0x1f0f('0x113')](db[_0x1f0f('0x10e')],{'through':_0x1f0f('0x185')});db[_0x1f0f('0x8a')][_0x1f0f('0x113')](db['MailInteraction'],{'through':_0x1f0f('0x15e')});db[_0x1f0f('0x8a')][_0x1f0f('0x113')](db[_0x1f0f('0x55')],{'through':_0x1f0f('0x175')});db[_0x1f0f('0x8a')][_0x1f0f('0x113')](db[_0x1f0f('0x4b')],{'through':_0x1f0f('0x16f')});db[_0x1f0f('0x8a')][_0x1f0f('0x113')](db[_0x1f0f('0x5d')],{'through':'openchannel_interaction_has_tags'});db[_0x1f0f('0x8a')]['belongsToMany'](db[_0x1f0f('0xf9')],{'through':_0x1f0f('0x19c')});db['Trigger'][_0x1f0f('0x105')](db[_0x1f0f('0x7f')],{'as':{'plural':_0x1f0f('0x19d'),'singular':_0x1f0f('0x19e')},'foreignKey':_0x1f0f('0x19f'),'onDelete':'cascade','hooks':!![]});db[_0x1f0f('0x8d')]['hasMany'](db[_0x1f0f('0x7f')],{'as':{'plural':'AnyConditions','singular':'AnyCondition'},'foreignKey':_0x1f0f('0x1a0'),'onDelete':_0x1f0f('0x10a'),'hooks':!![]});db[_0x1f0f('0x8d')][_0x1f0f('0x105')](db[_0x1f0f('0x7a')],{'as':_0x1f0f('0x192'),'foreignKey':_0x1f0f('0x1a1'),'onDelete':'cascade','hooks':!![]});db['AnalyticCustomReport'][_0x1f0f('0x105')](db[_0x1f0f('0x98')],{'as':'Fields','onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a2'),'hooks':!![]});db['AnalyticDefaultReport'][_0x1f0f('0x105')](db['AnalyticFieldReport'],{'as':_0x1f0f('0x1a3'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x199')});db['AnalyticMetric'][_0x1f0f('0x105')](db[_0x1f0f('0x98')],{'as':'Fields','onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a4')});db[_0x1f0f('0x98')]['belongsTo'](db[_0x1f0f('0x96')],{'foreignKey':_0x1f0f('0x1a4')});db[_0x1f0f('0x9b')][_0x1f0f('0x105')](db[_0x1f0f('0x1a5')],{'as':_0x1f0f('0x1a6'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0x1a5')][_0x1f0f('0x105')](db[_0x1f0f('0x9c')],{'as':_0x1f0f('0x1a8'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0x1a5')]['hasMany'](db[_0x1f0f('0x9c')],{'as':_0x1f0f('0x1aa'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1ab')});db['SalesforceConfiguration']['hasMany'](db['SalesforceField'],{'as':_0x1f0f('0x1a3'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0x1a5')][_0x1f0f('0x112')](db[_0x1f0f('0x9b')],{'as':'Account','foreignKey':_0x1f0f('0x1a7')});db['SalesforceField'][_0x1f0f('0x105')](db[_0x1f0f('0x9c')],{'as':_0x1f0f('0x1ad'),'foreignKey':_0x1f0f('0x1a9')});db['SalesforceField'][_0x1f0f('0x105')](db[_0x1f0f('0x9c')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x1f0f('0x9c')][_0x1f0f('0x105')](db['SalesforceField'],{'as':_0x1f0f('0x1ae'),'foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0x9c')][_0x1f0f('0x112')](db['Variable'],{'as':_0x1f0f('0x8e'),'foreignKey':'VariableId'});db['SugarcrmAccount'][_0x1f0f('0x105')](db['SugarcrmConfiguration'],{'as':_0x1f0f('0x1a6'),'onDelete':_0x1f0f('0x10a'),'foreignKey':'AccountId'});db[_0x1f0f('0x9f')]['hasMany'](db[_0x1f0f('0xa1')],{'as':_0x1f0f('0x1a8'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a9')});db['SugarcrmConfiguration']['hasMany'](db[_0x1f0f('0xa1')],{'as':_0x1f0f('0x1aa'),'onDelete':'cascade','foreignKey':_0x1f0f('0x1ab')});db['SugarcrmConfiguration'][_0x1f0f('0x105')](db[_0x1f0f('0xa1')],{'as':_0x1f0f('0x1a3'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0x9f')]['belongsTo'](db[_0x1f0f('0x9e')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0xa1')]['hasMany'](db[_0x1f0f('0xa1')],{'as':_0x1f0f('0x1ad'),'foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0xa1')][_0x1f0f('0x105')](db[_0x1f0f('0xa1')],{'as':_0x1f0f('0x1af'),'foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0xa1')][_0x1f0f('0x105')](db[_0x1f0f('0xa1')],{'as':_0x1f0f('0x1ae'),'foreignKey':'FieldId'});db[_0x1f0f('0xa1')][_0x1f0f('0x112')](db[_0x1f0f('0x8e')],{'as':_0x1f0f('0x8e'),'foreignKey':_0x1f0f('0x1b0')});db[_0x1f0f('0x1b1')][_0x1f0f('0x105')](db['DeskConfiguration'],{'as':_0x1f0f('0x1a6'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a7')});db['DeskConfiguration'][_0x1f0f('0x105')](db[_0x1f0f('0xa5')],{'as':_0x1f0f('0x1a8'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0xa3')][_0x1f0f('0x105')](db[_0x1f0f('0xa5')],{'as':'Descriptions','onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1ab')});db['DeskConfiguration'][_0x1f0f('0x105')](db[_0x1f0f('0xa5')],{'as':_0x1f0f('0x1a3'),'onDelete':_0x1f0f('0x10a'),'foreignKey':'FieldId'});db[_0x1f0f('0xa3')][_0x1f0f('0x112')](db[_0x1f0f('0x1b1')],{'as':_0x1f0f('0x15b'),'foreignKey':'AccountId'});db[_0x1f0f('0xa3')]['belongsToMany'](db[_0x1f0f('0x8a')],{'through':'int_desk_configuration_has_tags'});db[_0x1f0f('0xa5')][_0x1f0f('0x105')](db['DeskField'],{'as':_0x1f0f('0x1ad'),'foreignKey':'SubjectId'});db['DeskField'][_0x1f0f('0x105')](db['DeskField'],{'as':'Description','foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0xa5')][_0x1f0f('0x105')](db[_0x1f0f('0xa5')],{'as':_0x1f0f('0x1ae'),'foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0xa5')][_0x1f0f('0x112')](db[_0x1f0f('0x8e')],{'as':_0x1f0f('0x8e'),'foreignKey':'VariableId'});db[_0x1f0f('0xa6')][_0x1f0f('0x105')](db[_0x1f0f('0xa7')],{'as':_0x1f0f('0x1a6'),'onDelete':'cascade','foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0xa7')][_0x1f0f('0x105')](db[_0x1f0f('0x1b2')],{'as':'Subjects','onDelete':'cascade','foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0xa7')][_0x1f0f('0x105')](db[_0x1f0f('0x1b2')],{'as':_0x1f0f('0x1aa'),'onDelete':'cascade','foreignKey':_0x1f0f('0x1ab')});db['ZohoConfiguration'][_0x1f0f('0x105')](db[_0x1f0f('0x1b2')],{'as':_0x1f0f('0x1a3'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1ac')});db['ZohoConfiguration']['belongsTo'](db[_0x1f0f('0xa6')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0x1b2')][_0x1f0f('0x105')](db[_0x1f0f('0x1b2')],{'as':_0x1f0f('0x1ad'),'foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0x1b2')][_0x1f0f('0x105')](db['ZohoField'],{'as':_0x1f0f('0x1af'),'foreignKey':'DescriptionId'});db['ZohoField'][_0x1f0f('0x105')](db[_0x1f0f('0x1b2')],{'as':_0x1f0f('0x1ae'),'foreignKey':'FieldId'});db[_0x1f0f('0x1b2')][_0x1f0f('0x112')](db[_0x1f0f('0x8e')],{'as':_0x1f0f('0x8e'),'foreignKey':'VariableId'});db[_0x1f0f('0x1b3')][_0x1f0f('0x105')](db['ZendeskConfiguration'],{'as':'Configurations','onDelete':'cascade','foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0x1b4')][_0x1f0f('0x105')](db[_0x1f0f('0x1b5')],{'as':_0x1f0f('0x1a8'),'foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0x1b4')]['hasMany'](db[_0x1f0f('0x1b5')],{'as':_0x1f0f('0x1aa'),'foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0x1b4')][_0x1f0f('0x105')](db[_0x1f0f('0x1b5')],{'as':_0x1f0f('0x1a3'),'foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0x1b4')]['belongsTo'](db['ZendeskAccount'],{'as':_0x1f0f('0x15b'),'foreignKey':'AccountId'});db[_0x1f0f('0x1b4')][_0x1f0f('0x113')](db[_0x1f0f('0x8a')],{'through':_0x1f0f('0x1b6')});db[_0x1f0f('0x1b5')][_0x1f0f('0x105')](db[_0x1f0f('0x1b5')],{'as':'Subject','foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0x1b5')][_0x1f0f('0x105')](db[_0x1f0f('0x1b5')],{'as':_0x1f0f('0x1af'),'foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0x1b5')][_0x1f0f('0x105')](db['ZendeskField'],{'as':_0x1f0f('0x1ae'),'foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0x1b5')]['belongsTo'](db[_0x1f0f('0x8e')],{'as':_0x1f0f('0x8e'),'foreignKey':'VariableId'});db[_0x1f0f('0xac')]['hasMany'](db['FreshdeskConfiguration'],{'as':'Configurations','onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a7')});db['FreshdeskConfiguration']['hasMany'](db[_0x1f0f('0x1b7')],{'as':'Subjects','onDelete':_0x1f0f('0x10a'),'foreignKey':'SubjectId'});db['FreshdeskConfiguration'][_0x1f0f('0x105')](db['FreshdeskField'],{'as':_0x1f0f('0x1aa'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0xad')][_0x1f0f('0x105')](db[_0x1f0f('0x1b7')],{'as':_0x1f0f('0x1a3'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0xad')]['belongsTo'](db[_0x1f0f('0xac')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0xad')][_0x1f0f('0x113')](db['Tag'],{'through':_0x1f0f('0x1b8')});db[_0x1f0f('0x1b7')]['hasMany'](db['FreshdeskField'],{'as':_0x1f0f('0x1ad'),'foreignKey':_0x1f0f('0x1a9')});db['FreshdeskField']['hasMany'](db[_0x1f0f('0x1b7')],{'as':_0x1f0f('0x1af'),'foreignKey':_0x1f0f('0x1ab')});db['FreshdeskField'][_0x1f0f('0x105')](db[_0x1f0f('0x1b7')],{'as':_0x1f0f('0x1ae'),'foreignKey':'FieldId'});db[_0x1f0f('0x1b7')][_0x1f0f('0x112')](db[_0x1f0f('0x8e')],{'as':_0x1f0f('0x8e'),'foreignKey':_0x1f0f('0x1b0')});db['VtigerAccount'][_0x1f0f('0x105')](db[_0x1f0f('0xb0')],{'as':'Configurations','onDelete':_0x1f0f('0x10a'),'foreignKey':'AccountId'});db[_0x1f0f('0xb0')]['hasMany'](db[_0x1f0f('0xb2')],{'as':_0x1f0f('0x1a8'),'foreignKey':_0x1f0f('0x1a9')});db['VtigerConfiguration'][_0x1f0f('0x105')](db[_0x1f0f('0xb2')],{'as':'Descriptions','foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0xb0')][_0x1f0f('0x105')](db[_0x1f0f('0xb2')],{'as':_0x1f0f('0x1a3'),'foreignKey':_0x1f0f('0x1ac')});db['VtigerConfiguration'][_0x1f0f('0x112')](db[_0x1f0f('0xaf')],{'as':_0x1f0f('0x15b'),'foreignKey':'AccountId'});db[_0x1f0f('0xb2')]['hasMany'](db[_0x1f0f('0xb2')],{'as':_0x1f0f('0x1ad'),'foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0xb2')]['hasMany'](db[_0x1f0f('0xb2')],{'as':_0x1f0f('0x1af'),'foreignKey':_0x1f0f('0x1ab')});db['VtigerField'][_0x1f0f('0x105')](db[_0x1f0f('0xb2')],{'as':_0x1f0f('0x1ae'),'foreignKey':'FieldId'});db[_0x1f0f('0xb2')][_0x1f0f('0x112')](db[_0x1f0f('0x8e')],{'as':'Variable','foreignKey':_0x1f0f('0x1b0')});db[_0x1f0f('0xb4')][_0x1f0f('0x105')](db[_0x1f0f('0x1b9')],{'as':_0x1f0f('0x1a6'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0x1b9')]['hasMany'](db['ServicenowField'],{'as':_0x1f0f('0x1a8'),'foreignKey':_0x1f0f('0x1a9')});db['ServicenowConfiguration'][_0x1f0f('0x105')](db[_0x1f0f('0xb7')],{'as':'Descriptions','foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0x1b9')][_0x1f0f('0x105')](db[_0x1f0f('0xb7')],{'as':'Fields','foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0x1b9')][_0x1f0f('0x112')](db[_0x1f0f('0xb4')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0xb7')][_0x1f0f('0x105')](db['ServicenowField'],{'as':'Subject','foreignKey':'SubjectId'});db['ServicenowField'][_0x1f0f('0x105')](db[_0x1f0f('0xb7')],{'as':'Description','foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0xb7')][_0x1f0f('0x105')](db['ServicenowField'],{'as':_0x1f0f('0x1ae'),'foreignKey':_0x1f0f('0x1ac')});db['ServicenowField'][_0x1f0f('0x112')](db[_0x1f0f('0x8e')],{'as':'Variable','foreignKey':_0x1f0f('0x1b0')});db[_0x1f0f('0xb9')]['hasMany'](db['Dynamics365Configuration'],{'as':_0x1f0f('0x1a6'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0xbb')][_0x1f0f('0x105')](db[_0x1f0f('0xbd')],{'as':_0x1f0f('0x1a8'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0xbb')][_0x1f0f('0x105')](db[_0x1f0f('0xbd')],{'as':_0x1f0f('0x1aa'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1ab')});db['Dynamics365Configuration'][_0x1f0f('0x105')](db['Dynamics365Field'],{'as':_0x1f0f('0x1a3'),'onDelete':'cascade','foreignKey':'FieldId'});db['Dynamics365Configuration']['belongsTo'](db[_0x1f0f('0xb9')],{'as':'Account','foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0xbd')][_0x1f0f('0x105')](db[_0x1f0f('0xbd')],{'as':_0x1f0f('0x1ad'),'foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0xbd')][_0x1f0f('0x105')](db[_0x1f0f('0xbd')],{'as':_0x1f0f('0x1af'),'foreignKey':_0x1f0f('0x1ab')});db['Dynamics365Field'][_0x1f0f('0x105')](db['Dynamics365Field'],{'as':_0x1f0f('0x1ae'),'foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0xbd')][_0x1f0f('0x112')](db[_0x1f0f('0x8e')],{'as':_0x1f0f('0x8e'),'foreignKey':_0x1f0f('0x1b0')});db[_0x1f0f('0xbe')]['hasMany'](db['FreshsalesConfiguration'],{'as':_0x1f0f('0x1a6'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0xbf')][_0x1f0f('0x105')](db[_0x1f0f('0xc1')],{'as':'Subjects','foreignKey':_0x1f0f('0x1a9')});db['FreshsalesConfiguration'][_0x1f0f('0x105')](db[_0x1f0f('0xc1')],{'as':_0x1f0f('0x1aa'),'foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0xbf')][_0x1f0f('0x105')](db[_0x1f0f('0xc1')],{'as':'Fields','foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0xbf')][_0x1f0f('0x112')](db[_0x1f0f('0xbe')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x1a7')});db[_0x1f0f('0xc1')][_0x1f0f('0x105')](db[_0x1f0f('0xc1')],{'as':_0x1f0f('0x1ad'),'foreignKey':_0x1f0f('0x1a9')});db[_0x1f0f('0xc1')][_0x1f0f('0x105')](db[_0x1f0f('0xc1')],{'as':_0x1f0f('0x1af'),'foreignKey':_0x1f0f('0x1ab')});db[_0x1f0f('0xc1')][_0x1f0f('0x105')](db[_0x1f0f('0xc1')],{'as':'Field','foreignKey':_0x1f0f('0x1ac')});db[_0x1f0f('0xc1')][_0x1f0f('0x112')](db[_0x1f0f('0x8e')],{'as':_0x1f0f('0x8e'),'foreignKey':_0x1f0f('0x1b0')});db[_0x1f0f('0xc4')][_0x1f0f('0x112')](db['ChatWebsite'],{});db['ChatQueueReport']['belongsTo'](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0xc4')][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'as':'Contact','foreignKey':_0x1f0f('0x15c')});db[_0x1f0f('0xc4')]['belongsTo'](db[_0x1f0f('0x10e')],{});db[_0x1f0f('0xc4')][_0x1f0f('0x112')](db[_0x1f0f('0x69')],{});db[_0x1f0f('0xc4')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{});db[_0x1f0f('0xc4')][_0x1f0f('0x112')](db[_0x1f0f('0x6c')],{});db[_0x1f0f('0xc6')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'onDelete':'cascade','foreignKey':_0x1f0f('0x1ba')});db[_0x1f0f('0xc6')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'onDelete':'cascade','foreignKey':_0x1f0f('0x1bb')});db[_0x1f0f('0xca')][_0x1f0f('0x105')](db[_0x1f0f('0x1bc')],{'foreignKey':_0x1f0f('0x1bd'),'onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0xca')][_0x1f0f('0x105')](db[_0x1f0f('0xc8')],{'foreignKey':_0x1f0f('0x1bd'),'onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0xcc')][_0x1f0f('0x112')](db['SmsAccount'],{});db[_0x1f0f('0xcc')][_0x1f0f('0x112')](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0xcc')][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x14c'),'foreignKey':_0x1f0f('0x15c')});db['SmsQueueReport']['belongsTo'](db[_0x1f0f('0x55')],{});db['SmsQueueReport'][_0x1f0f('0x112')](db[_0x1f0f('0x57')],{});db[_0x1f0f('0xcc')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{});db[_0x1f0f('0xcc')][_0x1f0f('0x112')](db['SmsQueue'],{});db['JscriptyProject']['hasMany'](db[_0x1f0f('0xca')],{'foreignKey':_0x1f0f('0x1be')});db[_0x1f0f('0xd1')][_0x1f0f('0x105')](db['JscriptyQuestionReport'],{'foreignKey':'ProjectId'});db[_0x1f0f('0xd1')][_0x1f0f('0x105')](db['JscriptyAnswerReport'],{'foreignKey':_0x1f0f('0x1be')});db['SquareProject'][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x161'),'through':'user_has_square_projects'});db[_0x1f0f('0xdb')]['belongsToMany'](db[_0x1f0f('0x10')],{'as':'Agents','through':_0x1f0f('0x11a')});db['Team'][_0x1f0f('0x113')](db[_0x1f0f('0x121')],{'through':'TeamVoiceQueue','as':_0x1f0f('0x122')});db[_0x1f0f('0xdb')][_0x1f0f('0x113')](db[_0x1f0f('0x123')],{'through':_0x1f0f('0x159'),'as':_0x1f0f('0x124')});db[_0x1f0f('0xdb')][_0x1f0f('0x113')](db[_0x1f0f('0x6c')],{'through':_0x1f0f('0x186'),'as':_0x1f0f('0x125')});db[_0x1f0f('0xdb')][_0x1f0f('0x113')](db[_0x1f0f('0x4d')],{'through':'team_has_fax_queues','as':_0x1f0f('0x126')});db[_0x1f0f('0xdb')][_0x1f0f('0x113')](db[_0x1f0f('0x59')],{'through':_0x1f0f('0x178'),'as':_0x1f0f('0x127')});db['Team'][_0x1f0f('0x113')](db[_0x1f0f('0x61')],{'through':_0x1f0f('0x17e'),'as':'OpenchannelQueues'});db['Team'][_0x1f0f('0x113')](db['WhatsappQueue'],{'through':'team_has_whatsapp_queues','as':_0x1f0f('0x12a')});db['Campaign'][_0x1f0f('0x105')](db[_0x1f0f('0x13b')],{'as':_0x1f0f('0x13c'),'foreignKey':'CampaignId'});db[_0x1f0f('0xde')][_0x1f0f('0x105')](db['CmHopperFinal'],{'as':_0x1f0f('0x10b'),'foreignKey':_0x1f0f('0x1bf')});db['Campaign'][_0x1f0f('0x105')](db[_0x1f0f('0x13e')],{'as':'HopperHistories','foreignKey':_0x1f0f('0x1bf')});db[_0x1f0f('0xde')]['hasMany'](db['CmHopperBlack'],{'as':_0x1f0f('0x140'),'foreignKey':_0x1f0f('0x1bf')});db[_0x1f0f('0xde')][_0x1f0f('0x112')](db[_0x1f0f('0x29')],{'as':_0x1f0f('0x29'),'foreignKey':_0x1f0f('0x142')});db[_0x1f0f('0xde')][_0x1f0f('0x112')](db['Trunk'],{'as':_0x1f0f('0x1c0'),'foreignKey':_0x1f0f('0x143')});db[_0x1f0f('0xde')][_0x1f0f('0x112')](db[_0x1f0f('0x81')],{'as':_0x1f0f('0x81'),'foreignKey':_0x1f0f('0x144')});db[_0x1f0f('0xde')][_0x1f0f('0x112')](db[_0x1f0f('0xd7')],{'as':_0x1f0f('0xd7'),'foreignKey':'SquareProjectId'});db[_0x1f0f('0xde')][_0x1f0f('0x113')](db['CmList'],{'as':_0x1f0f('0x118'),'through':_0x1f0f('0x1c1')});db['Campaign'][_0x1f0f('0x113')](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x1c2'),'through':_0x1f0f('0x1c3')});db['Attachment']['belongsTo'](db[_0x1f0f('0x6a')],{'as':_0x1f0f('0x6a'),'foreignKey':_0x1f0f('0x164')});db[_0x1f0f('0xe5')][_0x1f0f('0x112')](db[_0x1f0f('0x41')],{});db[_0x1f0f('0xe5')]['belongsTo'](db['MailInteraction'],{});db[_0x1f0f('0xe5')][_0x1f0f('0x112')](db[_0x1f0f('0x3b')],{'foreignKey':_0x1f0f('0x1c4'),'as':'FromAccount'});db[_0x1f0f('0xe5')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'foreignKey':_0x1f0f('0x1c5'),'as':_0x1f0f('0x1c6')});db[_0x1f0f('0xe5')][_0x1f0f('0x112')](db['User'],{'foreignKey':'ToUserId','as':_0x1f0f('0x1c7')});db[_0x1f0f('0xe5')]['belongsTo'](db[_0x1f0f('0x123')],{'foreignKey':_0x1f0f('0x1c8'),'as':_0x1f0f('0x1c9')});db['MailTransferReport'][_0x1f0f('0x112')](db[_0x1f0f('0x3b')],{'foreignKey':_0x1f0f('0x1ca'),'as':'ToAccount'});db[_0x1f0f('0x1cb')][_0x1f0f('0x112')](db[_0x1f0f('0x69')],{});db[_0x1f0f('0x1cb')][_0x1f0f('0x112')](db[_0x1f0f('0x10e')],{});db[_0x1f0f('0x1cb')][_0x1f0f('0x112')](db['ChatWebsite'],{'foreignKey':'FromChatWebsiteId','as':_0x1f0f('0x1cc')});db[_0x1f0f('0x1cb')]['belongsTo'](db[_0x1f0f('0x10')],{'foreignKey':'FromUserId','as':_0x1f0f('0x1c6')});db[_0x1f0f('0x1cb')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'foreignKey':_0x1f0f('0x1cd'),'as':_0x1f0f('0x1c7')});db[_0x1f0f('0x1cb')][_0x1f0f('0x112')](db[_0x1f0f('0x6c')],{'foreignKey':'ToChatQueueId','as':_0x1f0f('0x1c9')});db[_0x1f0f('0x1cb')]['belongsTo'](db[_0x1f0f('0x12c')],{'foreignKey':'ToChatWebsiteId','as':'ToAccount'});db[_0x1f0f('0x1ce')][_0x1f0f('0x112')](db[_0x1f0f('0x16e')],{});db[_0x1f0f('0x1ce')][_0x1f0f('0x112')](db['FaxInteraction'],{});db['FaxTransferReport'][_0x1f0f('0x112')](db[_0x1f0f('0x48')],{'foreignKey':_0x1f0f('0x1cf'),'as':_0x1f0f('0x1cc')});db[_0x1f0f('0x1ce')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'foreignKey':_0x1f0f('0x1c5'),'as':_0x1f0f('0x1c6')});db[_0x1f0f('0x1ce')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'foreignKey':_0x1f0f('0x1cd'),'as':_0x1f0f('0x1c7')});db[_0x1f0f('0x1ce')][_0x1f0f('0x112')](db['FaxQueue'],{'foreignKey':_0x1f0f('0x1d0'),'as':_0x1f0f('0x1c9')});db[_0x1f0f('0x1ce')][_0x1f0f('0x112')](db[_0x1f0f('0x48')],{'foreignKey':_0x1f0f('0x1d1'),'as':_0x1f0f('0x1d2')});db[_0x1f0f('0xe9')][_0x1f0f('0x112')](db[_0x1f0f('0x5f')],{});db[_0x1f0f('0xe9')][_0x1f0f('0x112')](db[_0x1f0f('0x5d')],{});db[_0x1f0f('0xe9')][_0x1f0f('0x112')](db[_0x1f0f('0x131')],{'foreignKey':_0x1f0f('0x1d3'),'as':'FromAccount'});db[_0x1f0f('0xe9')]['belongsTo'](db[_0x1f0f('0x10')],{'foreignKey':_0x1f0f('0x1c5'),'as':'FromAgent'});db[_0x1f0f('0xe9')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'foreignKey':'ToUserId','as':'ToAgent'});db['OpenchannelTransferReport'][_0x1f0f('0x112')](db['OpenchannelQueue'],{'foreignKey':_0x1f0f('0x1d4'),'as':_0x1f0f('0x1c9')});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelAccount'],{'foreignKey':_0x1f0f('0x1d5'),'as':_0x1f0f('0x1d2')});db[_0x1f0f('0xeb')][_0x1f0f('0x112')](db[_0x1f0f('0x57')],{});db[_0x1f0f('0xeb')][_0x1f0f('0x112')](db[_0x1f0f('0x55')],{});db[_0x1f0f('0xeb')][_0x1f0f('0x112')](db[_0x1f0f('0x51')],{'foreignKey':'FromSmsAccountId','as':_0x1f0f('0x1cc')});db[_0x1f0f('0xeb')]['belongsTo'](db[_0x1f0f('0x10')],{'foreignKey':_0x1f0f('0x1c5'),'as':_0x1f0f('0x1c6')});db[_0x1f0f('0xeb')]['belongsTo'](db[_0x1f0f('0x10')],{'foreignKey':_0x1f0f('0x1cd'),'as':_0x1f0f('0x1c7')});db[_0x1f0f('0xeb')][_0x1f0f('0x112')](db[_0x1f0f('0x59')],{'foreignKey':_0x1f0f('0x1d6'),'as':_0x1f0f('0x1c9')});db[_0x1f0f('0xeb')]['belongsTo'](db['SmsAccount'],{'foreignKey':_0x1f0f('0x1d7'),'as':'ToAccount'});db[_0x1f0f('0xed')][_0x1f0f('0x105')](db[_0x1f0f('0x7d')],{'as':_0x1f0f('0x150'),'foreignKey':_0x1f0f('0x154')});db['CmList'][_0x1f0f('0x105')](db[_0x1f0f('0x78')],{'as':_0x1f0f('0x1d8'),'foreignKey':_0x1f0f('0x154')});db['CmList'][_0x1f0f('0x105')](db['CmContact'],{'as':_0x1f0f('0x18a'),'onDelete':'cascade','foreignKey':_0x1f0f('0x154')});db['CmList'][_0x1f0f('0x105')](db[_0x1f0f('0x13d')],{'as':'HopperFinals','foreignKey':_0x1f0f('0x154')});db['CmList'][_0x1f0f('0x105')](db[_0x1f0f('0x13e')],{'as':_0x1f0f('0x10c'),'foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0xed')]['hasMany'](db[_0x1f0f('0x76')],{'as':_0x1f0f('0x76'),'foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0xed')][_0x1f0f('0x113')](db[_0x1f0f('0x121')],{'as':_0x1f0f('0x1d9'),'through':'voice_queues_has_cm_lists'});db[_0x1f0f('0xed')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x119')});db['VoicePrefix']['hasMany'](db[_0x1f0f('0x108')],{'as':'Extensions','onDelete':_0x1f0f('0x10a')});db['VoicePrefix'][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x158'),'through':_0x1f0f('0x1da')});db[_0x1f0f('0xf1')][_0x1f0f('0x105')](db[_0x1f0f('0x10')],{'as':'Users','foreignKey':_0x1f0f('0x1db')});db[_0x1f0f('0xf1')]['hasMany'](db['UserProfileSection'],{'as':_0x1f0f('0x1dc'),'foreignKey':'userProfileId','onDelete':_0x1f0f('0x10a')});db['UserProfileSection'][_0x1f0f('0x105')](db['UserProfileResource'],{'as':'Resources','foreignKey':_0x1f0f('0x1dd'),'onDelete':_0x1f0f('0x10a')});db[_0x1f0f('0xf7')][_0x1f0f('0x105')](db['Disposition'],{'as':_0x1f0f('0x150'),'foreignKey':_0x1f0f('0x1de')});db['WhatsappAccount'][_0x1f0f('0x105')](db[_0x1f0f('0x7c')],{'as':_0x1f0f('0x151'),'foreignKey':_0x1f0f('0x1de')});db['WhatsappAccount'][_0x1f0f('0x105')](db[_0x1f0f('0xfa')],{'as':_0x1f0f('0x152'),'foreignKey':_0x1f0f('0x1de')});db[_0x1f0f('0xf7')][_0x1f0f('0x105')](db['WhatsappInteraction'],{'as':_0x1f0f('0x16b')});db['WhatsappAccount'][_0x1f0f('0x105')](db[_0x1f0f('0x1df')],{'as':'Applications'});db[_0x1f0f('0xf7')][_0x1f0f('0x112')](db[_0x1f0f('0xed')],{'as':'List','foreignKey':_0x1f0f('0x154')});db[_0x1f0f('0xf7')][_0x1f0f('0x112')](db['Pause'],{'as':_0x1f0f('0x157'),'foreignKey':_0x1f0f('0x145')});db[_0x1f0f('0xf7')][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x158'),'through':'user_has_whatsapp_accounts'});db[_0x1f0f('0x1df')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'onDelete':'restrict'});db[_0x1f0f('0x1df')][_0x1f0f('0x112')](db[_0x1f0f('0x129')],{'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x1df')][_0x1f0f('0x112')](db[_0x1f0f('0xf7')],{'onDelete':_0x1f0f('0x166')});db[_0x1f0f('0x1df')][_0x1f0f('0x112')](db[_0x1f0f('0x81')],{'onDelete':_0x1f0f('0x166'),'foreignKey':_0x1f0f('0x144')});db['WhatsappApplication'][_0x1f0f('0x112')](db[_0x1f0f('0x8a')],{'onDelete':_0x1f0f('0x166'),'foreignKey':_0x1f0f('0x167')});db[_0x1f0f('0xf9')][_0x1f0f('0x105')](db['WhatsappMessage'],{'as':_0x1f0f('0x152'),'onDelete':_0x1f0f('0x10a'),'foreignKey':_0x1f0f('0x1e0')});db[_0x1f0f('0xf9')][_0x1f0f('0x112')](db[_0x1f0f('0xf7')],{'as':_0x1f0f('0x15b'),'foreignKey':'WhatsappAccountId'});db[_0x1f0f('0xf9')]['belongsTo'](db[_0x1f0f('0x116')],{'as':_0x1f0f('0x14c'),'foreignKey':'ContactId'});db[_0x1f0f('0xf9')][_0x1f0f('0x112')](db['User'],{'as':_0x1f0f('0x15d'),'foreignKey':_0x1f0f('0x107')});db[_0x1f0f('0xf9')][_0x1f0f('0x113')](db['Tag'],{'through':_0x1f0f('0x19c'),'as':_0x1f0f('0x15f')});db[_0x1f0f('0xf9')][_0x1f0f('0x113')](db[_0x1f0f('0x8a')],{'through':_0x1f0f('0x19c'),'as':_0x1f0f('0x160')});db['WhatsappInteraction'][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x161'),'through':'user_has_whatsapp_interactions','foreignKey':_0x1f0f('0x1e0')});db[_0x1f0f('0xfa')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'as':_0x1f0f('0x10')});db[_0x1f0f('0xfa')][_0x1f0f('0x112')](db['CmContact'],{'onDelete':_0x1f0f('0x10a'),'as':_0x1f0f('0x14c')});db['WhatsappMessage'][_0x1f0f('0x112')](db[_0x1f0f('0xf9')],{'onDelete':_0x1f0f('0x10a'),'as':'Interaction','foreignKey':_0x1f0f('0x1e0')});db[_0x1f0f('0xfa')]['belongsTo'](db[_0x1f0f('0xf7')],{'as':_0x1f0f('0x15b'),'foreignKey':_0x1f0f('0x1de')});db['WhatsappQueueReport'][_0x1f0f('0x112')](db['WhatsappAccount'],{});db[_0x1f0f('0x1e1')][_0x1f0f('0x112')](db[_0x1f0f('0xed')],{'as':_0x1f0f('0x153'),'foreignKey':_0x1f0f('0x154')});db['WhatsappQueueReport'][_0x1f0f('0x112')](db[_0x1f0f('0x116')],{'as':'Contact','foreignKey':_0x1f0f('0x15c')});db['WhatsappQueueReport'][_0x1f0f('0x112')](db[_0x1f0f('0xf9')],{});db[_0x1f0f('0x1e1')][_0x1f0f('0x112')](db[_0x1f0f('0x129')],{});db[_0x1f0f('0x1e1')][_0x1f0f('0x112')](db[_0x1f0f('0xfa')],{});db[_0x1f0f('0x1e1')][_0x1f0f('0x112')](db['User'],{});db[_0x1f0f('0xfc')][_0x1f0f('0x112')](db[_0x1f0f('0xfa')],{});db['WhatsappTransferReport']['belongsTo'](db[_0x1f0f('0xf9')],{});db[_0x1f0f('0xfc')][_0x1f0f('0x112')](db[_0x1f0f('0xf7')],{'foreignKey':_0x1f0f('0x1e2'),'as':_0x1f0f('0x1cc')});db[_0x1f0f('0xfc')]['belongsTo'](db[_0x1f0f('0xf7')],{'foreignKey':'ToWhatsappAccountId','as':_0x1f0f('0x1d2')});db[_0x1f0f('0xfc')]['belongsTo'](db[_0x1f0f('0x129')],{'foreignKey':_0x1f0f('0x1e3'),'as':_0x1f0f('0x1c9')});db[_0x1f0f('0xfc')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'foreignKey':_0x1f0f('0x1c5'),'as':_0x1f0f('0x1c6')});db[_0x1f0f('0xfc')][_0x1f0f('0x112')](db[_0x1f0f('0x10')],{'foreignKey':_0x1f0f('0x1cd'),'as':_0x1f0f('0x1c7')});db['WhatsappQueue'][_0x1f0f('0x113')](db[_0x1f0f('0x10')],{'as':'Agents','through':'UserWhatsappQueue','foreignKey':_0x1f0f('0x1e4')});db['WhatsappQueue'][_0x1f0f('0x113')](db[_0x1f0f('0xdb')],{'through':_0x1f0f('0x1e5'),'as':_0x1f0f('0x146')});module[_0x1f0f('0x1e6')]={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index a33d019..91c838f 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcd64=['/api/voice/chanspy','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','./api/voiceMailMessage','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','/api/members/reports','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','/api/mail/substatuses','./api/mailSubstatus','/api/mail/interactions','./api/mailInteraction','/api/mail/applications','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/fax/accounts','./api/faxApplication','./api/faxInteraction','/api/fax/messages','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','/api/sms/accounts','/api/sms/applications','/api/sms/interactions','./api/smsInteraction','/api/sms/messages','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','./api/cmContact','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','./api/action','/api/automations','./api/automation','/api/canned_answers','./api/disposition','/api/conditions','./api/condition','/api/intervals','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','/api/tags','./api/tag','/api/triggers','./api/trigger','/api/variables','./api/variable','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','./api/analyticCustomReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','/api/analytics/field_reports','./api/analyticFieldReport','/api/analytics/tree_reports','./api/analyticTreeReport','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','./api/intSugarcrmConfiguration','/api/integrations/sugarcrm/fields','./api/intDeskAccount','/api/integrations/desk/configurations','./api/intDeskConfiguration','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','./api/intZohoField','/api/integrations/zendesk/accounts','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./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/accounts','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','/api/chat/reports/queue','./api/chatQueueReport','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/details/reports','./api/squareReportDetail','/api/square/odbc','./api/squareOdbc','./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/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','./api/faxTransferReport','/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/userProfileResource','/api/userNotifications','./api/userNotification','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','./api/cloudProvider','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/authGoogle','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/pm2','/api/webbar','./api/webbar','/apidoc','join','root','/www','static','/demo','/snippet','snippet','/plugins','/server/files/plugins','route','get','sendFile','resolve','appPath','/index.html','username','newPassword','firstName','lastName','phone','mobile','fax','email','clientId','clientSecret','securityToken','tenantId','token','channelSecret','accessToken','accessTokenSecret','authToken','membername','calleridname','exten','clientEmail','privateKey','accesskeyid','secretaccesskey','key','accountSid','localstationid','dsn','secret','registry','isArray','length','isString','replace','@@{','}@@','includes','path','express','express-winston','util','./errors','./config/environment','./config/logger','api','auth','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','\x20body=%s','body','format','method','connection','url','user','inspect','%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)','headers','x-forwarded-for','remoteAddress','name','role','other','agent_name','./api/user'];(function(_0x43a2f9,_0x2e42e7){var _0x459298=function(_0x5cf173){while(--_0x5cf173){_0x43a2f9['push'](_0x43a2f9['shift']());}};_0x459298(++_0x2e42e7);}(_0xcd64,0x123));var _0x4cd6=function(_0xd988de,_0x151618){_0xd988de=_0xd988de-0x0;var _0x54c95a=_0xcd64[_0xd988de];return _0x54c95a;};'use strict';var _=require('lodash');var path=require(_0x4cd6('0x0'));var express=require(_0x4cd6('0x1'));var ewinston=require(_0x4cd6('0x2'));var util=require(_0x4cd6('0x3'));var errors=require(_0x4cd6('0x4'));var config=require(_0x4cd6('0x5'));var logger=require(_0x4cd6('0x6'))(_0x4cd6('0x7'));var authLogger=require(_0x4cd6('0x6'))(_0x4cd6('0x8'));exports['default']=function(_0x4a2785){_0x4a2785[_0x4cd6('0x9')](ewinston[_0x4cd6('0xa')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x275a1e,_0x5e3a72){var _0x23ebb4=_0x4cd6('0xb');if(!_[_0x4cd6('0xc')](_0x275a1e['body'])){_0x23ebb4+=_0x4cd6('0xd');var _0x250dc8=_0x275a1e[_0x4cd6('0xe')];maskSensitiveData(_0x250dc8);}return util[_0x4cd6('0xf')](_0x23ebb4,_0x275a1e[_0x4cd6('0x10')],_0x275a1e['headers']['x-forwarded-for']?_0x275a1e['headers']['x-forwarded-for']:_0x275a1e[_0x4cd6('0x11')]['remoteAddress']||_0x275a1e['ip'],_0x275a1e[_0x4cd6('0x12')],_0x5e3a72['statusCode'],_0x5e3a72['responseTime'],_0x275a1e[_0x4cd6('0x13')]?_0x275a1e[_0x4cd6('0x13')]['id']:null,_0x275a1e[_0x4cd6('0x13')]?_0x275a1e[_0x4cd6('0x13')]['name']:null,_0x275a1e[_0x4cd6('0x13')]?_0x275a1e[_0x4cd6('0x13')]['role']:null,_0x250dc8?util[_0x4cd6('0x14')](_0x250dc8,![],null):'');}}));_0x4a2785[_0x4cd6('0x9')](ewinston[_0x4cd6('0xa')]({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x2ae7a3,_0x37247d){var _0x4ce92c=_0x4cd6('0x15');if(_0x2ae7a3[_0x4cd6('0xe')]&&_0x2ae7a3['body'][_0x4cd6('0x16')]&&_0x2ae7a3['body'][_0x4cd6('0x17')]){_0x4ce92c=_0x4cd6('0x18');}return util[_0x4cd6('0xf')](_0x4ce92c,_0x2ae7a3[_0x4cd6('0x10')],_0x2ae7a3[_0x4cd6('0x19')]['x-forwarded-for']?_0x2ae7a3[_0x4cd6('0x19')][_0x4cd6('0x1a')]:_0x2ae7a3[_0x4cd6('0x11')][_0x4cd6('0x1b')]||_0x2ae7a3['ip'],_0x2ae7a3[_0x4cd6('0x12')],_0x37247d['statusCode'],_0x37247d['responseTime'],_0x2ae7a3[_0x4cd6('0x13')]?_0x2ae7a3[_0x4cd6('0x13')]['id']:null,_0x2ae7a3[_0x4cd6('0x13')]?_0x2ae7a3['user'][_0x4cd6('0x1c')]:null,_0x2ae7a3[_0x4cd6('0x13')]?_0x2ae7a3[_0x4cd6('0x13')][_0x4cd6('0x1d')]:null,_0x2ae7a3[_0x4cd6('0xe')]&&_0x2ae7a3[_0x4cd6('0xe')]['device']?_0x2ae7a3['body'][_0x4cd6('0x16')]:_0x4cd6('0x1e'),_0x2ae7a3[_0x4cd6('0xe')]&&_0x2ae7a3[_0x4cd6('0xe')]['agent_id']?_0x2ae7a3[_0x4cd6('0xe')][_0x4cd6('0x17')]:'',_0x2ae7a3[_0x4cd6('0xe')]&&_0x2ae7a3[_0x4cd6('0xe')][_0x4cd6('0x1f')]?_0x2ae7a3['body'][_0x4cd6('0x1f')]:'');},'ignoreRoute':function(_0x16348d){var _0xae137e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0xae137e['test'](_0x16348d[_0x4cd6('0x12')]);}}));_0x4a2785[_0x4cd6('0x9')]('/api/users',require(_0x4cd6('0x20')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x21'),require(_0x4cd6('0x22')));_0x4a2785['use'](_0x4cd6('0x23'),require(_0x4cd6('0x24')));_0x4a2785[_0x4cd6('0x9')]('/api/voice/extensions',require('./api/voiceExtension'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x25'),require(_0x4cd6('0x26')));_0x4a2785['use']('/api/voice/queues',require('./api/voiceQueue'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x27'),require(_0x4cd6('0x28')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x29'),require(_0x4cd6('0x2a')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x2b'),require(_0x4cd6('0x2c')));_0x4a2785['use']('/api/voice/mails/messages',require(_0x4cd6('0x2d')));_0x4a2785[_0x4cd6('0x9')]('/api/voice/calls/reports',require(_0x4cd6('0x2e')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x2f'),require(_0x4cd6('0x30')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x31'),require(_0x4cd6('0x32')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x33'),require(_0x4cd6('0x34')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x35'),require('./api/memberReport'));_0x4a2785[_0x4cd6('0x9')]('/api/trunks',require(_0x4cd6('0x36')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x37'),require(_0x4cd6('0x38')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x39'),require('./api/mailServerOut'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x3a'),require(_0x4cd6('0x3b')));_0x4a2785['use'](_0x4cd6('0x3c'),require(_0x4cd6('0x3d')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x3e'),require(_0x4cd6('0x3f')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x40'),require(_0x4cd6('0x41')));_0x4a2785[_0x4cd6('0x9')]('/api/mail/messages',require('./api/mailMessage'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x42'),require(_0x4cd6('0x43')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x44'),require(_0x4cd6('0x45')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x46'),require(_0x4cd6('0x47')));_0x4a2785[_0x4cd6('0x9')]('/api/dashboards/items',require('./api/dashboardItem'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x48'),require('./api/faxAccount'));_0x4a2785[_0x4cd6('0x9')]('/api/fax/applications',require(_0x4cd6('0x49')));_0x4a2785[_0x4cd6('0x9')]('/api/fax/interactions',require(_0x4cd6('0x4a')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x4b'),require('./api/faxMessage'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x4c'),require(_0x4cd6('0x4d')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x4e'),require(_0x4cd6('0x4f')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x50'),require('./api/smsAccount'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x51'),require('./api/smsApplication'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x52'),require(_0x4cd6('0x53')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x54'),require('./api/smsMessage'));_0x4a2785[_0x4cd6('0x9')]('/api/sms/queues',require(_0x4cd6('0x55')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x56'),require(_0x4cd6('0x57')));_0x4a2785['use']('/api/openchannel/applications',require('./api/openchannelApplication'));_0x4a2785['use'](_0x4cd6('0x58'),require(_0x4cd6('0x59')));_0x4a2785['use'](_0x4cd6('0x5a'),require('./api/openchannelMessage'));_0x4a2785[_0x4cd6('0x9')]('/api/openchannel/queues',require('./api/openchannelQueue'));_0x4a2785['use'](_0x4cd6('0x5b'),require(_0x4cd6('0x5c')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x5d'),require(_0x4cd6('0x5e')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x5f'),require(_0x4cd6('0x60')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x61'),require(_0x4cd6('0x62')));_0x4a2785[_0x4cd6('0x9')]('/api/chat/messages',require('./api/chatMessage'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x63'),require(_0x4cd6('0x64')));_0x4a2785[_0x4cd6('0x9')]('/api/chat/queues',require('./api/chatQueue'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x65'),require(_0x4cd6('0x66')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x67'),require(_0x4cd6('0x68')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x69'),require(_0x4cd6('0x6a')));_0x4a2785[_0x4cd6('0x9')]('/api/cm/contacts',require(_0x4cd6('0x6b')));_0x4a2785[_0x4cd6('0x9')]('/api/cm/hopper',require(_0x4cd6('0x6c')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x6d'),require(_0x4cd6('0x6e')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x6f'),require(_0x4cd6('0x70')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x71'),require(_0x4cd6('0x72')));_0x4a2785[_0x4cd6('0x9')]('/api/cm/custom_fields',require('./api/cmCustomField'));_0x4a2785[_0x4cd6('0x9')]('/api/actions',require(_0x4cd6('0x73')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x74'),require(_0x4cd6('0x75')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x76'),require('./api/cannedAnswer'));_0x4a2785[_0x4cd6('0x9')]('/api/dispositions',require(_0x4cd6('0x77')));_0x4a2785['use'](_0x4cd6('0x78'),require(_0x4cd6('0x79')));_0x4a2785['use'](_0x4cd6('0x7a'),require(_0x4cd6('0x7b')));_0x4a2785[_0x4cd6('0x9')]('/api/pauses',require(_0x4cd6('0x7c')));_0x4a2785['use'](_0x4cd6('0x7d'),require('./api/cdr'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x7e'),require(_0x4cd6('0x7f')));_0x4a2785[_0x4cd6('0x9')]('/api/schedules',require(_0x4cd6('0x80')));_0x4a2785[_0x4cd6('0x9')]('/api/sounds',require('./api/sound'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x81'),require(_0x4cd6('0x82')));_0x4a2785['use']('/api/templates',require('./api/template'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x83'),require(_0x4cd6('0x84')));_0x4a2785['use'](_0x4cd6('0x85'),require(_0x4cd6('0x86')));_0x4a2785[_0x4cd6('0x9')]('/api/integrations',require(_0x4cd6('0x87')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x88'),require(_0x4cd6('0x89')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x8a'),require(_0x4cd6('0x8b')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x8c'),require('./api/analyticDefaultReport'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x8d'),require(_0x4cd6('0x8e')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x8f'),require(_0x4cd6('0x90')));_0x4a2785['use'](_0x4cd6('0x91'),require(_0x4cd6('0x92')));_0x4a2785['use'](_0x4cd6('0x93'),require(_0x4cd6('0x94')));_0x4a2785[_0x4cd6('0x9')]('/api/integrations/salesforce/accounts',require('./api/intSalesforceAccount'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x95'),require(_0x4cd6('0x96')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x97'),require(_0x4cd6('0x98')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x99'),require(_0x4cd6('0x9a')));_0x4a2785[_0x4cd6('0x9')]('/api/integrations/sugarcrm/configurations',require(_0x4cd6('0x9b')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x9c'),require('./api/intSugarcrmField'));_0x4a2785[_0x4cd6('0x9')]('/api/integrations/desk/accounts',require(_0x4cd6('0x9d')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x9e'),require(_0x4cd6('0x9f')));_0x4a2785['use']('/api/integrations/desk/fields',require(_0x4cd6('0xa0')));_0x4a2785[_0x4cd6('0x9')]('/api/integrations/zoho/accounts',require(_0x4cd6('0xa1')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xa2'),require('./api/intZohoConfiguration'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xa3'),require(_0x4cd6('0xa4')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xa5'),require(_0x4cd6('0xa6')));_0x4a2785['use'](_0x4cd6('0xa7'),require(_0x4cd6('0xa8')));_0x4a2785['use'](_0x4cd6('0xa9'),require(_0x4cd6('0xaa')));_0x4a2785['use']('/api/integrations/freshdesk/accounts',require('./api/intFreshdeskAccount'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xab'),require(_0x4cd6('0xac')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xad'),require(_0x4cd6('0xae')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xaf'),require(_0x4cd6('0xb0')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xb1'),require(_0x4cd6('0xb2')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xb3'),require(_0x4cd6('0xb4')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xb5'),require(_0x4cd6('0xb6')));_0x4a2785['use'](_0x4cd6('0xb7'),require(_0x4cd6('0xb8')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xb9'),require(_0x4cd6('0xba')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xbb'),require('./api/intDynamics365Account'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xbc'),require(_0x4cd6('0xbd')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xbe'),require(_0x4cd6('0xbf')));_0x4a2785['use'](_0x4cd6('0xc0'),require('./api/intFreshsalesAccount'));_0x4a2785[_0x4cd6('0x9')]('/api/integrations/freshsales/configurations',require(_0x4cd6('0xc1')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xc2'),require(_0x4cd6('0xc3')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xc4'),require('./api/network'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xc5'),require(_0x4cd6('0xc6')));_0x4a2785[_0x4cd6('0x9')]('/api/chat/internal/messages',require('./api/chatInternalMessage'));_0x4a2785[_0x4cd6('0x9')]('/api/jscripty/answers/reports',require(_0x4cd6('0xc7')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xc8'),require(_0x4cd6('0xc9')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xca'),require(_0x4cd6('0xcb')));_0x4a2785['use'](_0x4cd6('0xcc'),require(_0x4cd6('0xcd')));_0x4a2785['use']('/api/square/reports',require('./api/squareReport'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xce'),require(_0x4cd6('0xcf')));_0x4a2785[_0x4cd6('0x9')]('/api/jscripty/projects',require('./api/jscriptyProject'));_0x4a2785['use']('/api/settings',require('./api/setting'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xd0'),require(_0x4cd6('0xd1')));_0x4a2785[_0x4cd6('0x9')]('/api/square/projects',require(_0x4cd6('0xd2')));_0x4a2785['use'](_0x4cd6('0xd3'),require(_0x4cd6('0xd4')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xd5'),require(_0x4cd6('0xd6')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xd7'),require(_0x4cd6('0xd8')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xd9'),require(_0x4cd6('0xda')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xdb'),require(_0x4cd6('0xdc')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xdd'),require(_0x4cd6('0xde')));_0x4a2785[_0x4cd6('0x9')]('/api/attachments',require(_0x4cd6('0xdf')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xe0'),require(_0x4cd6('0xe1')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xe2'),require(_0x4cd6('0xe3')));_0x4a2785['use'](_0x4cd6('0xe4'),require(_0x4cd6('0xe5')));_0x4a2785[_0x4cd6('0x9')]('/api/fax/reports/transfer',require(_0x4cd6('0xe6')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xe7'),require(_0x4cd6('0xe8')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xe9'),require(_0x4cd6('0xea')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xeb'),require(_0x4cd6('0xec')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xed'),require(_0x4cd6('0xee')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xef'),require(_0x4cd6('0xf0')));_0x4a2785['use'](_0x4cd6('0xf1'),require('./api/userProfileSection'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xf2'),require(_0x4cd6('0xf3')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xf4'),require(_0x4cd6('0xf5')));_0x4a2785[_0x4cd6('0x9')]('/api/whatsapp/accounts',require(_0x4cd6('0xf6')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xf7'),require(_0x4cd6('0xf8')));_0x4a2785['use']('/api/whatsapp/interactions',require(_0x4cd6('0xf9')));_0x4a2785['use'](_0x4cd6('0xfa'),require(_0x4cd6('0xfb')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xfc'),require(_0x4cd6('0xfd')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0xfe'),require(_0x4cd6('0xff')));_0x4a2785['use']('/api/whatsapp/queues',require(_0x4cd6('0x100')));_0x4a2785[_0x4cd6('0x9')]('/api/cloudProviders',require(_0x4cd6('0x101')));_0x4a2785[_0x4cd6('0x9')]('/api/realtime',require(_0x4cd6('0x102')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x103'),require(_0x4cd6('0x104')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x105'),require(_0x4cd6('0x106')));_0x4a2785[_0x4cd6('0x9')]('/api/jira',require(_0x4cd6('0x107')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x108'),require('./api/rpc'));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x109'),require(_0x4cd6('0x10a')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x10b'),require('./api/system'));_0x4a2785['use']('/api/pm2',require(_0x4cd6('0x10c')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x10d'),require(_0x4cd6('0x10e')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x10f'),express['static'](path[_0x4cd6('0x110')](config[_0x4cd6('0x111')],_0x4cd6('0x10f'))));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x112'),express[_0x4cd6('0x113')](path['join'](config[_0x4cd6('0x111')],'/www')));_0x4a2785['use'](_0x4cd6('0x114'),express[_0x4cd6('0x113')](path[_0x4cd6('0x110')](config[_0x4cd6('0x111')],_0x4cd6('0x114'))));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x115'),express[_0x4cd6('0x113')](path[_0x4cd6('0x110')](config[_0x4cd6('0x111')],_0x4cd6('0x116'),'3.0.0')));_0x4a2785[_0x4cd6('0x9')](_0x4cd6('0x117'),express[_0x4cd6('0x113')](path[_0x4cd6('0x110')](config[_0x4cd6('0x111')],_0x4cd6('0x118'))));_0x4a2785[_0x4cd6('0x119')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0x4cd6('0x11a')](errors[0x194]);_0x4a2785[_0x4cd6('0x119')]('/*')['get'](function(_0x1417c5,_0x579bd0){_0x579bd0[_0x4cd6('0x11b')](path[_0x4cd6('0x11c')](_0x4a2785[_0x4cd6('0x11a')](_0x4cd6('0x11d'))+_0x4cd6('0x11e')));});};var sensitiveFields=[_0x4cd6('0x11f'),'password',_0x4cd6('0x120'),'apiKey',_0x4cd6('0x121'),_0x4cd6('0x122'),'street',_0x4cd6('0x123'),_0x4cd6('0x124'),_0x4cd6('0x125'),_0x4cd6('0x126'),_0x4cd6('0x127'),_0x4cd6('0x128'),_0x4cd6('0x129'),'code','accessKey',_0x4cd6('0x12a'),_0x4cd6('0x12b'),_0x4cd6('0x12c'),_0x4cd6('0x12d'),_0x4cd6('0x12e'),_0x4cd6('0x12f'),'consumerKey','consumerSecret',_0x4cd6('0x130'),_0x4cd6('0x131'),'calleridnum',_0x4cd6('0x132'),'vidaooApiKey',_0x4cd6('0x133'),_0x4cd6('0x134'),_0x4cd6('0x135'),_0x4cd6('0x136'),_0x4cd6('0x137'),_0x4cd6('0x13'),'pass',_0x4cd6('0x138'),_0x4cd6('0x139'),_0x4cd6('0x13a'),_0x4cd6('0x13b'),_0x4cd6('0x13c'),'oldPassword'];function maskSensitiveData(_0x40e624){var _0x438778=/(?!^)[\s\S](?!$)/g;if(!_['isPlainObject'](_0x40e624))return;for(var _0x220b01 in _0x40e624){if(_[_0x4cd6('0x13d')](_0x40e624[_0x220b01])){for(var _0x2f345e=0x0;_0x2f345e<_0x40e624[_0x220b01][_0x4cd6('0x13e')];_0x2f345e++){maskSensitiveData(_0x40e624[_0x220b01][_0x2f345e]);}}else if(_['isPlainObject'](_0x40e624[_0x220b01])){maskSensitiveData(_0x40e624[_0x220b01]);}else if(_[_0x4cd6('0x13f')](_0x40e624[_0x220b01])){_0x40e624[_0x220b01]=_0x40e624[_0x220b01][_0x4cd6('0x140')](/{{{/g,_0x4cd6('0x141'))['replace'](/}}}/g,_0x4cd6('0x142'))[_0x4cd6('0x140')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x4cd6('0x143')](sensitiveFields,_0x220b01)){_0x40e624[_0x220b01]=_0x40e624[_0x220b01][_0x4cd6('0x140')](_0x438778,'*');}}}} \ No newline at end of file +var _0xf6b7=['/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','./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/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','/api/integrations/sugarcrm/fields','/api/integrations/desk/accounts','./api/intDeskAccount','/api/integrations/desk/configurations','/api/integrations/desk/fields','./api/intDeskField','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','/api/integrations/zendesk/fields','./api/intZendeskField','./api/intFreshdeskAccount','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','/api/integrations/vtiger/accounts','/api/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','./api/intDynamics365Account','/api/integrations/dynamics365/fields','./api/intDynamics365Field','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','./api/intFreshsalesField','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','./api/squareReport','/api/square/details/reports','/api/jscripty/projects','./api/jscriptyProject','./api/setting','./api/squareOdbc','/api/square/projects','./api/squareProject','./api/squareRecording','/api/square/messages','./api/squareMessage','./api/team','/api/license','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/mail/reports/transfer','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/userNotifications','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/realtime','/api/auth/local','./api/authLocal','/api/auth/google','./api/jira','/api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/apidoc','static','join','/www','/demo','/snippet','root','3.0.0','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','appPath','/index.html','username','password','newPassword','apiKey','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','tenantId','channelSecret','accessToken','accessTokenSecret','authToken','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','privateKey','key','localstationid','dsn','isPlainObject','isArray','length','@@{','replace','}@@','includes','path','express','express-winston','util','./errors','api','./config/logger','auth','logger','isEmpty','\x20body=%s','body','format','method','connection','remoteAddress','url','statusCode','responseTime','user','role','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)','headers','x-forwarded-for','agent_name','test','./api/user','/api/voice/chanspy','./api/voiceChanSpy','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','./api/screenRecording','./api/voiceMail','./api/voiceMailMessage','/api/voice/calls/reports','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/members/reports','./api/memberReport','/api/trunks','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','./api/mailServerOut','/api/mail/accounts','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','/api/mail/messages','./api/mailMessage','./api/mailApplication','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','./api/faxAccount','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','/api/sms/accounts','./api/smsAccount','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/interactions','./api/chatMessage','./api/chatOfflineMessage','/api/chat/queues','/api/chat/groups','./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','/api/cm/companies','./api/cmCompany','/api/cm/contacts','./api/cmContact','./api/cmHopper','./api/cmHopperBlack','/api/cm/hopper_final','./api/cmHopperFinal','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','/api/automations','/api/canned_answers','/api/dispositions','./api/disposition','./api/condition','./api/interval','./api/pause','/api/cdr','/api/voiceQueuesLog','/api/schedules','./api/schedule','/api/sounds','./api/sound','/api/tags'];(function(_0x3ce3d0,_0x597f99){var _0x23cbe9=function(_0x5dd39b){while(--_0x5dd39b){_0x3ce3d0['push'](_0x3ce3d0['shift']());}};_0x23cbe9(++_0x597f99);}(_0xf6b7,0x1eb));var _0x7f6b=function(_0xfeddf5,_0x2b4e4c){_0xfeddf5=_0xfeddf5-0x0;var _0x1240dd=_0xf6b7[_0xfeddf5];return _0x1240dd;};'use strict';var _=require('lodash');var path=require(_0x7f6b('0x0'));var express=require(_0x7f6b('0x1'));var ewinston=require(_0x7f6b('0x2'));var util=require(_0x7f6b('0x3'));var errors=require(_0x7f6b('0x4'));var config=require('./config/environment');var logger=require('./config/logger')(_0x7f6b('0x5'));var authLogger=require(_0x7f6b('0x6'))(_0x7f6b('0x7'));exports['default']=function(_0x256209){_0x256209['use'](ewinston[_0x7f6b('0x8')]({'winstonInstance':logger,'meta':![],'statusLevels':!![],'msg':function(_0x2cc2b1,_0x5e7181){var _0x114f20='%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s';if(!_[_0x7f6b('0x9')](_0x2cc2b1['body'])){_0x114f20+=_0x7f6b('0xa');var _0x35259a=_0x2cc2b1[_0x7f6b('0xb')];maskSensitiveData(_0x35259a);}return util[_0x7f6b('0xc')](_0x114f20,_0x2cc2b1[_0x7f6b('0xd')],_0x2cc2b1['headers']['x-forwarded-for']?_0x2cc2b1['headers']['x-forwarded-for']:_0x2cc2b1[_0x7f6b('0xe')][_0x7f6b('0xf')]||_0x2cc2b1['ip'],_0x2cc2b1[_0x7f6b('0x10')],_0x5e7181[_0x7f6b('0x11')],_0x5e7181[_0x7f6b('0x12')],_0x2cc2b1[_0x7f6b('0x13')]?_0x2cc2b1['user']['id']:null,_0x2cc2b1[_0x7f6b('0x13')]?_0x2cc2b1[_0x7f6b('0x13')]['name']:null,_0x2cc2b1[_0x7f6b('0x13')]?_0x2cc2b1[_0x7f6b('0x13')][_0x7f6b('0x14')]:null,_0x35259a?util['inspect'](_0x35259a,![],null):'');}}));_0x256209[_0x7f6b('0x15')](ewinston['logger']({'winstonInstance':authLogger,'meta':![],'statusLevels':!![],'msg':function(_0x42eb00,_0x5eb9b3){var _0x4f2dc3=_0x7f6b('0x16');if(_0x42eb00['body']&&_0x42eb00[_0x7f6b('0xb')][_0x7f6b('0x17')]&&_0x42eb00[_0x7f6b('0xb')][_0x7f6b('0x18')]){_0x4f2dc3=_0x7f6b('0x19');}return util[_0x7f6b('0xc')](_0x4f2dc3,_0x42eb00[_0x7f6b('0xd')],_0x42eb00[_0x7f6b('0x1a')][_0x7f6b('0x1b')]?_0x42eb00[_0x7f6b('0x1a')][_0x7f6b('0x1b')]:_0x42eb00[_0x7f6b('0xe')][_0x7f6b('0xf')]||_0x42eb00['ip'],_0x42eb00[_0x7f6b('0x10')],_0x5eb9b3[_0x7f6b('0x11')],_0x5eb9b3[_0x7f6b('0x12')],_0x42eb00[_0x7f6b('0x13')]?_0x42eb00['user']['id']:null,_0x42eb00[_0x7f6b('0x13')]?_0x42eb00[_0x7f6b('0x13')]['name']:null,_0x42eb00[_0x7f6b('0x13')]?_0x42eb00['user'][_0x7f6b('0x14')]:null,_0x42eb00[_0x7f6b('0xb')]&&_0x42eb00[_0x7f6b('0xb')][_0x7f6b('0x17')]?_0x42eb00['body'][_0x7f6b('0x17')]:'other',_0x42eb00['body']&&_0x42eb00[_0x7f6b('0xb')][_0x7f6b('0x18')]?_0x42eb00[_0x7f6b('0xb')][_0x7f6b('0x18')]:'',_0x42eb00[_0x7f6b('0xb')]&&_0x42eb00[_0x7f6b('0xb')][_0x7f6b('0x1c')]?_0x42eb00[_0x7f6b('0xb')]['agent_name']:'');},'ignoreRoute':function(_0x3ab9b0){var _0x89a8a=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x89a8a[_0x7f6b('0x1d')](_0x3ab9b0[_0x7f6b('0x10')]);}}));_0x256209[_0x7f6b('0x15')]('/api/users',require(_0x7f6b('0x1e')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x1f'),require(_0x7f6b('0x20')));_0x256209[_0x7f6b('0x15')]('/api/voice/contexts',require(_0x7f6b('0x21')));_0x256209[_0x7f6b('0x15')]('/api/voice/extensions',require('./api/voiceExtension'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x22'),require(_0x7f6b('0x23')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x24'),require(_0x7f6b('0x25')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x26'),require(_0x7f6b('0x27')));_0x256209[_0x7f6b('0x15')]('/api/screen/recordings',require(_0x7f6b('0x28')));_0x256209[_0x7f6b('0x15')]('/api/voice/mails',require(_0x7f6b('0x29')));_0x256209['use']('/api/voice/mails/messages',require(_0x7f6b('0x2a')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x2b'),require('./api/voiceCallReport'));_0x256209['use'](_0x7f6b('0x2c'),require(_0x7f6b('0x2d')));_0x256209[_0x7f6b('0x15')]('/api/voice/agents/reports',require(_0x7f6b('0x2e')));_0x256209[_0x7f6b('0x15')]('/api/voice/queues/reports',require('./api/voiceQueueReport'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x2f'),require(_0x7f6b('0x30')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x31'),require('./api/trunk'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x32'),require(_0x7f6b('0x33')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x34'),require(_0x7f6b('0x35')));_0x256209['use'](_0x7f6b('0x36'),require('./api/mailAccount'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x37'),require('./api/mailQueue'));_0x256209['use'](_0x7f6b('0x38'),require(_0x7f6b('0x39')));_0x256209[_0x7f6b('0x15')]('/api/mail/interactions',require('./api/mailInteraction'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x3a'),require(_0x7f6b('0x3b')));_0x256209[_0x7f6b('0x15')]('/api/mail/applications',require(_0x7f6b('0x3c')));_0x256209[_0x7f6b('0x15')]('/api/mail/reports/queue',require('./api/mailQueueReport'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x3d'),require(_0x7f6b('0x3e')));_0x256209['use'](_0x7f6b('0x3f'),require(_0x7f6b('0x40')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x41'),require(_0x7f6b('0x42')));_0x256209['use']('/api/fax/applications',require(_0x7f6b('0x43')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x44'),require(_0x7f6b('0x45')));_0x256209['use'](_0x7f6b('0x46'),require(_0x7f6b('0x47')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x48'),require(_0x7f6b('0x49')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x4a'),require('./api/faxQueueReport'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x4b'),require(_0x7f6b('0x4c')));_0x256209['use']('/api/sms/applications',require(_0x7f6b('0x4d')));_0x256209['use'](_0x7f6b('0x4e'),require(_0x7f6b('0x4f')));_0x256209[_0x7f6b('0x15')]('/api/sms/messages',require('./api/smsMessage'));_0x256209[_0x7f6b('0x15')]('/api/sms/queues',require(_0x7f6b('0x50')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x51'),require(_0x7f6b('0x52')));_0x256209['use'](_0x7f6b('0x53'),require(_0x7f6b('0x54')));_0x256209[_0x7f6b('0x15')]('/api/openchannel/interactions',require(_0x7f6b('0x55')));_0x256209['use'](_0x7f6b('0x56'),require(_0x7f6b('0x57')));_0x256209['use'](_0x7f6b('0x58'),require(_0x7f6b('0x59')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x5a'),require('./api/chatWebsite'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x5b'),require(_0x7f6b('0x5c')));_0x256209['use']('/api/chat/applications',require('./api/chatApplication'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x5d'),require('./api/chatInteraction'));_0x256209[_0x7f6b('0x15')]('/api/chat/messages',require(_0x7f6b('0x5e')));_0x256209[_0x7f6b('0x15')]('/api/chat/offline_messages',require(_0x7f6b('0x5f')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x60'),require('./api/chatQueue'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x61'),require(_0x7f6b('0x62')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x63'),require(_0x7f6b('0x64')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x65'),require(_0x7f6b('0x66')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x67'),require(_0x7f6b('0x68')));_0x256209[_0x7f6b('0x15')]('/api/cm/hopper',require(_0x7f6b('0x69')));_0x256209['use']('/api/cm/hopper_black',require(_0x7f6b('0x6a')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x6b'),require(_0x7f6b('0x6c')));_0x256209[_0x7f6b('0x15')]('/api/cm/hopper_history',require(_0x7f6b('0x6d')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x6e'),require(_0x7f6b('0x6f')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x70'),require('./api/action'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x71'),require('./api/automation'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x72'),require('./api/cannedAnswer'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x73'),require(_0x7f6b('0x74')));_0x256209[_0x7f6b('0x15')]('/api/conditions',require(_0x7f6b('0x75')));_0x256209[_0x7f6b('0x15')]('/api/intervals',require(_0x7f6b('0x76')));_0x256209[_0x7f6b('0x15')]('/api/pauses',require(_0x7f6b('0x77')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x78'),require('./api/cdr'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x79'),require('./api/voiceQueuesLog'));_0x256209['use'](_0x7f6b('0x7a'),require(_0x7f6b('0x7b')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x7c'),require(_0x7f6b('0x7d')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x7e'),require('./api/tag'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x7f'),require(_0x7f6b('0x80')));_0x256209[_0x7f6b('0x15')]('/api/triggers',require(_0x7f6b('0x81')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x82'),require(_0x7f6b('0x83')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x84'),require(_0x7f6b('0x85')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x86'),require(_0x7f6b('0x87')));_0x256209[_0x7f6b('0x15')]('/api/analytics/custom_reports',require('./api/analyticCustomReport'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x88'),require('./api/analyticDefaultReport'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x89'),require(_0x7f6b('0x8a')));_0x256209[_0x7f6b('0x15')]('/api/analytics/metrics',require(_0x7f6b('0x8b')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x8c'),require(_0x7f6b('0x8d')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x8e'),require(_0x7f6b('0x8f')));_0x256209[_0x7f6b('0x15')]('/api/integrations/salesforce/accounts',require(_0x7f6b('0x90')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x91'),require(_0x7f6b('0x92')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x93'),require(_0x7f6b('0x94')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x95'),require(_0x7f6b('0x96')));_0x256209['use'](_0x7f6b('0x97'),require('./api/intSugarcrmConfiguration'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x98'),require('./api/intSugarcrmField'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x99'),require(_0x7f6b('0x9a')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x9b'),require('./api/intDeskConfiguration'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x9c'),require(_0x7f6b('0x9d')));_0x256209[_0x7f6b('0x15')]('/api/integrations/zoho/accounts',require(_0x7f6b('0x9e')));_0x256209['use'](_0x7f6b('0x9f'),require(_0x7f6b('0xa0')));_0x256209[_0x7f6b('0x15')]('/api/integrations/zoho/fields',require('./api/intZohoField'));_0x256209[_0x7f6b('0x15')]('/api/integrations/zendesk/accounts',require('./api/intZendeskAccount'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xa1'),require(_0x7f6b('0xa2')));_0x256209['use'](_0x7f6b('0xa3'),require(_0x7f6b('0xa4')));_0x256209[_0x7f6b('0x15')]('/api/integrations/freshdesk/accounts',require(_0x7f6b('0xa5')));_0x256209[_0x7f6b('0x15')]('/api/integrations/freshdesk/configurations',require(_0x7f6b('0xa6')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xa7'),require(_0x7f6b('0xa8')));_0x256209['use'](_0x7f6b('0xa9'),require('./api/intVtigerAccount'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xaa'),require(_0x7f6b('0xab')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xac'),require('./api/intVtigerField'));_0x256209['use']('/api/integrations/servicenow/accounts',require(_0x7f6b('0xad')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xae'),require(_0x7f6b('0xaf')));_0x256209[_0x7f6b('0x15')]('/api/integrations/servicenow/fields',require(_0x7f6b('0xb0')));_0x256209[_0x7f6b('0x15')]('/api/integrations/dynamics365/accounts',require(_0x7f6b('0xb1')));_0x256209[_0x7f6b('0x15')]('/api/integrations/dynamics365/configurations',require('./api/intDynamics365Configuration'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xb2'),require(_0x7f6b('0xb3')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xb4'),require(_0x7f6b('0xb5')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xb6'),require(_0x7f6b('0xb7')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xb8'),require(_0x7f6b('0xb9')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xba'),require(_0x7f6b('0xbb')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xbc'),require('./api/chatQueueReport'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xbd'),require(_0x7f6b('0xbe')));_0x256209['use'](_0x7f6b('0xbf'),require('./api/jscriptyAnswerReport'));_0x256209['use'](_0x7f6b('0xc0'),require(_0x7f6b('0xc1')));_0x256209['use'](_0x7f6b('0xc2'),require(_0x7f6b('0xc3')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xc4'),require(_0x7f6b('0xc5')));_0x256209[_0x7f6b('0x15')]('/api/square/reports',require(_0x7f6b('0xc6')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xc7'),require('./api/squareReportDetail'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xc8'),require(_0x7f6b('0xc9')));_0x256209['use']('/api/settings',require(_0x7f6b('0xca')));_0x256209['use']('/api/square/odbc',require(_0x7f6b('0xcb')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xcc'),require(_0x7f6b('0xcd')));_0x256209[_0x7f6b('0x15')]('/api/square/recordings',require(_0x7f6b('0xce')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xcf'),require(_0x7f6b('0xd0')));_0x256209[_0x7f6b('0x15')]('/api/teams',require(_0x7f6b('0xd1')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xd2'),require(_0x7f6b('0xd3')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xd4'),require(_0x7f6b('0xd5')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xd6'),require(_0x7f6b('0xd7')));_0x256209[_0x7f6b('0x15')]('/api/attachments',require('./api/attachment'));_0x256209[_0x7f6b('0x15')]('/api/plugins',require('./api/plugin'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xd8'),require('./api/mailTransferReport'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xd9'),require(_0x7f6b('0xda')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xdb'),require(_0x7f6b('0xdc')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xdd'),require('./api/openchannelTransferReport'));_0x256209['use'](_0x7f6b('0xde'),require(_0x7f6b('0xdf')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xe0'),require(_0x7f6b('0xe1')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xe2'),require(_0x7f6b('0xe3')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xe4'),require(_0x7f6b('0xe5')));_0x256209['use'](_0x7f6b('0xe6'),require(_0x7f6b('0xe7')));_0x256209['use'](_0x7f6b('0xe8'),require(_0x7f6b('0xe9')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xea'),require('./api/userNotification'));_0x256209[_0x7f6b('0x15')]('/api/whatsapp/accounts',require(_0x7f6b('0xeb')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xec'),require(_0x7f6b('0xed')));_0x256209[_0x7f6b('0x15')]('/api/whatsapp/interactions',require('./api/whatsappInteraction'));_0x256209[_0x7f6b('0x15')]('/api/whatsapp/messages',require('./api/whatsappMessage'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xee'),require('./api/whatsappQueueReport'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xef'),require(_0x7f6b('0xf0')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xf1'),require(_0x7f6b('0xf2')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xf3'),require('./api/cloudProvider'));_0x256209[_0x7f6b('0x15')]('/api/realtime',require(_0x7f6b('0xf4')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xf5'),require(_0x7f6b('0xf6')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xf7'),require('./api/authGoogle'));_0x256209[_0x7f6b('0x15')]('/api/jira',require(_0x7f6b('0xf8')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xf9'),require('./api/rpc'));_0x256209['use'](_0x7f6b('0xfa'),require(_0x7f6b('0xfb')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xfc'),require(_0x7f6b('0xfd')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0xfe'),require(_0x7f6b('0xff')));_0x256209['use'](_0x7f6b('0x100'),require('./api/webbar'));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x101'),express[_0x7f6b('0x102')](path[_0x7f6b('0x103')](config['root'],_0x7f6b('0x101'))));_0x256209[_0x7f6b('0x15')]('/www',express[_0x7f6b('0x102')](path[_0x7f6b('0x103')](config['root'],_0x7f6b('0x104'))));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x105'),express[_0x7f6b('0x102')](path[_0x7f6b('0x103')](config['root'],'/demo')));_0x256209[_0x7f6b('0x15')](_0x7f6b('0x106'),express[_0x7f6b('0x102')](path[_0x7f6b('0x103')](config[_0x7f6b('0x107')],'snippet',_0x7f6b('0x108'))));_0x256209[_0x7f6b('0x15')]('/plugins',express[_0x7f6b('0x102')](path[_0x7f6b('0x103')](config['root'],_0x7f6b('0x109'))));_0x256209[_0x7f6b('0x10a')](_0x7f6b('0x10b'))[_0x7f6b('0x10c')](errors[0x194]);_0x256209[_0x7f6b('0x10a')]('/*')[_0x7f6b('0x10c')](function(_0xf9be03,_0x100aa7){_0x100aa7[_0x7f6b('0x10d')](path[_0x7f6b('0x10e')](_0x256209[_0x7f6b('0x10c')](_0x7f6b('0x10f'))+_0x7f6b('0x110')));});};var sensitiveFields=[_0x7f6b('0x111'),_0x7f6b('0x112'),_0x7f6b('0x113'),_0x7f6b('0x114'),'firstName',_0x7f6b('0x115'),_0x7f6b('0x116'),_0x7f6b('0x117'),_0x7f6b('0x118'),'fax','email',_0x7f6b('0x119'),_0x7f6b('0x11a'),_0x7f6b('0x11b'),_0x7f6b('0x11c'),'accessKey',_0x7f6b('0x11d'),'token',_0x7f6b('0x11e'),_0x7f6b('0x11f'),_0x7f6b('0x120'),_0x7f6b('0x121'),_0x7f6b('0x122'),_0x7f6b('0x123'),_0x7f6b('0x124'),_0x7f6b('0x125'),_0x7f6b('0x126'),_0x7f6b('0x127'),_0x7f6b('0x128'),_0x7f6b('0x129'),_0x7f6b('0x12a'),'accesskeyid','secretaccesskey',_0x7f6b('0x12b'),_0x7f6b('0x13'),'pass','accountSid',_0x7f6b('0x12c'),_0x7f6b('0x12d'),'secret','registry','oldPassword'];function maskSensitiveData(_0x5147ac){var _0x5bd0ea=/(?!^)[\s\S](?!$)/g;if(!_[_0x7f6b('0x12e')](_0x5147ac))return;for(var _0x1961f8 in _0x5147ac){if(_[_0x7f6b('0x12f')](_0x5147ac[_0x1961f8])){for(var _0x2d1171=0x0;_0x2d1171<_0x5147ac[_0x1961f8][_0x7f6b('0x130')];_0x2d1171++){maskSensitiveData(_0x5147ac[_0x1961f8][_0x2d1171]);}}else if(_[_0x7f6b('0x12e')](_0x5147ac[_0x1961f8])){maskSensitiveData(_0x5147ac[_0x1961f8]);}else if(_['isString'](_0x5147ac[_0x1961f8])){_0x5147ac[_0x1961f8]=_0x5147ac[_0x1961f8]['replace'](/{{{/g,_0x7f6b('0x131'))[_0x7f6b('0x132')](/}}}/g,_0x7f6b('0x133'))[_0x7f6b('0x132')](/{{/g,'@{')['replace'](/}}/g,'}@');if(_[_0x7f6b('0x134')](sensitiveFields,_0x1961f8)){_0x5147ac[_0x1961f8]=_0x5147ac[_0x1961f8][_0x7f6b('0x132')](_0x5bd0ea,'*');}}}} \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index fbc442d..8bd339d 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0f44=['../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intZendeskAccount/intZendeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.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','listen','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','RPC\x20listening\x20on\x20','jayson/promise','bluebird','lodash','merge','../api/voiceExtension/voiceExtension.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/userVoiceQueueRt/userVoiceQueueRt.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.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/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc'];(function(_0x5f5359,_0x114f7f){var _0x337608=function(_0x5e7ba4){while(--_0x5e7ba4){_0x5f5359['push'](_0x5f5359['shift']());}};_0x337608(++_0x114f7f);}(_0x0f44,0x18f));var _0x40f4=function(_0x2ca50a,_0x5394d1){_0x2ca50a=_0x2ca50a-0x0;var _0xd0c2e0=_0x0f44[_0x2ca50a];return _0xd0c2e0;};'use strict';var jayson=require(_0x40f4('0x0'));var BPromise=require(_0x40f4('0x1'));var _=require(_0x40f4('0x2'));var config=require('../config/environment');exports['listen']=function(){return new BPromise(function(_0x1f3759,_0x1c4a84){var _0xdf1656={};_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/user/user.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x4')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/voiceQueue/voiceQueue.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x5')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x6')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x7')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x8')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x9')));_0xdf1656=_['merge'](_0xdf1656,require('../api/memberReport/memberReport.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0xa')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0xb')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0xc')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0xd')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/mailAccount/mailAccount.rpc'));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0xe')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0xf')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x10')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x11')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/mailQueueReport/mailQueueReport.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/faxAccount/faxAccount.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x12')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x13')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x14')));_0xdf1656=_['merge'](_0xdf1656,require('../api/faxQueue/faxQueue.rpc'));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x15')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x16')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x17')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x18')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/smsQueue/smsQueue.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x19')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x1a')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x1b')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x1c')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x1d')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x1e')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x1f')));_0xdf1656=_['merge'](_0xdf1656,require('../api/chatQueue/chatQueue.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x20')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x21')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x22')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x23')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x24')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x25')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x26')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x27')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x28')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x29')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x2a')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x2b')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/intDeskAccount/intDeskAccount.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x2c')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x2d')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x2e')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/intVtigerAccount/intVtigerAccount.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x2f')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x30')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x31')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x32')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x33')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x34')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x35')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/setting/setting.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x36')));_0xdf1656=_['merge'](_0xdf1656,require('../api/squareProject/squareProject.rpc'));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x37')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x38')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/campaign/campaign.rpc'));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x39')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x3a')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x3b')));_0xdf1656=_['merge'](_0xdf1656,require(_0x40f4('0x3c')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x3d')));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require('../api/whatsappQueueReport/whatsappQueueReport.rpc'));_0xdf1656=_[_0x40f4('0x3')](_0xdf1656,require(_0x40f4('0x3e')));var _0x125ef3=jayson[_0x40f4('0x3f')](_0xdf1656)[_0x40f4('0x40')]();var _0x85b4f9=config['rpc'][_0x40f4('0x41')]||config[_0x40f4('0x41')]+0x1;var _0x2d842b=config[_0x40f4('0x42')]['ip']||_0x40f4('0x43');_0x125ef3['on'](_0x40f4('0x44'),function(_0x453865){return _0x1c4a84(_0x453865);});_0x125ef3[_0x40f4('0x45')](_0x85b4f9,_0x2d842b,function(){console['log'](_0x40f4('0x46'),_0x2d842b,_0x85b4f9);require(_0x40f4('0x47'))['default']();return _0x1f3759(_0x40f4('0x48')+_0x2d842b+':'+_0x85b4f9);});});}; \ No newline at end of file +var _0xdaa4=['../api/squareReport/squareReport.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/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','bluebird','../config/environment','listen','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','merge','../api/voiceCallReport/voiceCallReport.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/memberReport/memberReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/openchannelApplication/openchannelApplication.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/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.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/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc'];(function(_0x4206aa,_0x4aa7eb){var _0x344e26=function(_0x2efe3c){while(--_0x2efe3c){_0x4206aa['push'](_0x4206aa['shift']());}};_0x344e26(++_0x4aa7eb);}(_0xdaa4,0xfa));var _0x4daa=function(_0x1917f4,_0x164409){_0x1917f4=_0x1917f4-0x0;var _0x52b8ff=_0xdaa4[_0x1917f4];return _0x52b8ff;};'use strict';var jayson=require(_0x4daa('0x0'));var BPromise=require(_0x4daa('0x1'));var _=require('lodash');var config=require(_0x4daa('0x2'));exports[_0x4daa('0x3')]=function(){return new BPromise(function(_0x2154fd,_0x4c039d){var _0x5e9c9b={};_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x4')));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x5')));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x6')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/voiceRecording/voiceRecording.rpc'));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x8')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x9')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0xa')));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0xb')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0xc')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0xd')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/mailServerIn/mailServerIn.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0xe')));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0xf')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/mailInteraction/mailInteraction.rpc'));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x10')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x11')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x12')));_0x5e9c9b=_['merge'](_0x5e9c9b,require('../api/faxAccount/faxAccount.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x13')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x14')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x15')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x16')));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x17')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x18')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x19')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/smsMessage/smsMessage.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/smsQueue/smsQueue.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x1a')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x1b')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x1c')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x1d')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x1e')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x1f')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x20')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x21')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/cmContact/cmContact.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x22')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x23')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x24')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x25')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x26')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/pause/pause.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x27')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x28')));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x29')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x2a')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x2b')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/intSugarcrmAccount/intSugarcrmAccount.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x2c')));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x2d')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x2e')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x2f')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x30')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x31')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x32')));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x33')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x34')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x35')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x36')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/squareReportDetail/squareReportDetail.rpc'));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x37')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x38')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x39')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x3a')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/squareMessage/squareMessage.rpc'));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x3b')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x3c')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x3d')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x3e')));_0x5e9c9b=_['merge'](_0x5e9c9b,require(_0x4daa('0x3f')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x40')));_0x5e9c9b=_[_0x4daa('0x7')](_0x5e9c9b,require(_0x4daa('0x41')));var _0x193447=jayson[_0x4daa('0x42')](_0x5e9c9b)[_0x4daa('0x43')]();var _0x4a94eb=config['rpc'][_0x4daa('0x44')]||config[_0x4daa('0x44')]+0x1;var _0x3af0e3=config['rpc']['ip']||_0x4daa('0x45');_0x193447['on'](_0x4daa('0x46'),function(_0x1a48c4){return _0x4c039d(_0x1a48c4);});_0x193447[_0x4daa('0x3')](_0x4a94eb,_0x3af0e3,function(){console[_0x4daa('0x47')](_0x4daa('0x48'),_0x3af0e3,_0x4a94eb);require(_0x4daa('0x49'))[_0x4daa('0x4a')]();return _0x2154fd(_0x4daa('0x4b')+_0x3af0e3+':'+_0x4a94eb);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index b136849..54358e2 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 _0x8077=['emit','ready','line','hangup','substring','520-Invalid','search','520\x20End\x20of\x20proper','result=','indexOf','substr','startsWith','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','pipe','command','function','write','destroy','inherits','prototype','sendRequest','sync','getData','beep','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','setContext','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','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','AGI','wait','WAIT','exports','util','lodash','events','EventEmitter','./reply','./error','call','setEncoding','utf8'];(function(_0x3778a8,_0x41a366){var _0x16cd17=function(_0x39634f){while(--_0x39634f){_0x3778a8['push'](_0x3778a8['shift']());}};_0x16cd17(++_0x41a366);}(_0x8077,0x133));var _0x7807=function(_0x2b3959,_0x1aa5c0){_0x2b3959=_0x2b3959-0x0;var _0x35ab6d=_0x8077[_0x2b3959];return _0x35ab6d;};'use strict';var util=require(_0x7807('0x0'));var _=require(_0x7807('0x1'));var EventEmitter=require(_0x7807('0x2'))[_0x7807('0x3')];var AGIReply=require(_0x7807('0x4'));var AGIError=require(_0x7807('0x5'));function AGIChannel(_0x4b2554){var _0x24d61e=this,_0x4897df=new AGIReply(),_0x170262=![],_0x554b02={};EventEmitter[_0x7807('0x6')](_0x24d61e);_0x4b2554[_0x7807('0x7')](_0x7807('0x8'));_0x4b2554['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x4897df[_0x7807('0x7')](_0x7807('0x8'));_0x4897df['on']('headers',function(_0x45fdbb){for(var _0x5d7c8f in _0x45fdbb){_0x24d61e[_0x5d7c8f]=_0x45fdbb[_0x5d7c8f];}_0x24d61e[_0x7807('0x9')](_0x7807('0xa'));});_0x4897df['on'](_0x7807('0xb'),function(_0x52f3d2){if(_0x52f3d2['toLowerCase']()==_0x7807('0xc')){_0x24d61e[_0x7807('0x9')](_0x7807('0xc'));return;}if(_0x52f3d2[_0x7807('0xd')](0x0,0xb)==_0x7807('0xe')){_0x170262=!![];}if(_0x170262){_0x554b02['rx']+=_0x52f3d2+'\x0a';if(_0x52f3d2[_0x7807('0xf')](_0x7807('0x10'))!=-0x1){_0x170262=![];}}else{_0x554b02['rx']=_0x52f3d2;}if(_0x170262){return;}if(typeof _0x554b02['cb']=='function'){var _0x874e3d=_0x554b02['rx'][_0x7807('0xd')](0x0,0x3),_0x80980a=null,_0x366020=null;_0x874e3d=parseInt(_0x874e3d);if(isNaN(_0x874e3d)){_0x554b02['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x874e3d!=0xc8){_0x554b02['cb'](null,{'code':_0x874e3d,'result':-0x1,'extra':'KO'});return;}_0x80980a=_0x554b02['rx']['substring'](0x4)['replace'](_0x7807('0x11'),'');if(_0x80980a[_0x7807('0x12')]('\x20')!=-0x1){_0x80980a=_0x80980a[_0x7807('0x13')](0x0,_0x80980a[_0x7807('0x12')]('\x20'));}if(_[_0x7807('0x14')](_0x80980a,'-1')){_0x80980a=parseInt(_0x80980a);}_0x366020=_0x554b02['rx']['split']('\x20');if(_0x366020[_0x7807('0x15')]==0x3){_0x366020=_0x366020[0x2]['substring'](0x1,_0x366020[0x2][_0x7807('0x15')]-0x1);}else if(_0x366020[_0x7807('0x15')]>0x3){var _0x279717=/\((.+)\)/;var _0x2a126c=_0x554b02['rx'][_0x7807('0x16')](_0x279717);if(_0x2a126c){_0x366020=_0x2a126c[0x1];}else{_0x366020=null;}}else{_0x366020=null;}_0x554b02['cb'](null,{'code':_0x874e3d,'result':_0x80980a,'extra':_0x366020});}});_0x4b2554['on'](_0x7807('0x17'),function(_0x5ce9f4){_0x24d61e[_0x7807('0x9')]('error',new AGIError(_0x7807('0x18'),_0x5ce9f4[_0x7807('0x19')]));});_0x4b2554['on'](_0x7807('0x1a'),function(){_0x24d61e['emit'](_0x7807('0x1a'),new AGIError(_0x7807('0x1b')));});_0x4b2554['on'](_0x7807('0x1c'),function(){_0x24d61e[_0x7807('0x9')]('timeout',new AGIError(_0x7807('0x1d')));_0x4b2554['destroy']();});_0x4b2554[_0x7807('0x1e')](_0x4897df);this[_0x7807('0x1f')]=function(_0x56926a,_0xae056){var _0x56926a=_0x56926a||'',_0xae056=typeof _0xae056==_0x7807('0x20')?_0xae056:new Function();_0x554b02={'tx':_0x56926a,'rx':'','cb':_0xae056};_0x4b2554[_0x7807('0x21')](_0x56926a+'\x0a');},this[_0x7807('0x1a')]=function(){_0x4b2554[_0x7807('0x22')]();};}util[_0x7807('0x23')](AGIChannel,EventEmitter);AGIChannel[_0x7807('0x24')][_0x7807('0x25')]=function(_0x5de9a5){return this[_0x7807('0x1f')][_0x7807('0x26')](this,_0x5de9a5);};AGIChannel[_0x7807('0x24')]['answer']=function(){return this[_0x7807('0x25')]('ANSWER');};AGIChannel['prototype'][_0x7807('0x27')]=function(_0x21e090,_0x2cad20,_0x4a88aa){_0x21e090=_0x21e090===undefined?_0x7807('0x28'):_0x21e090;_0x2cad20=_0x2cad20===undefined?'5':_0x2cad20;_0x4a88aa=_0x4a88aa===undefined?'1':_0x4a88aa;return this[_0x7807('0x25')](util[_0x7807('0x29')](_0x7807('0x2a'),_0x21e090,_0x2cad20*0x3e8,_0x4a88aa));};AGIChannel[_0x7807('0x24')][_0x7807('0x2b')]=function(_0x41b9cf){_0x41b9cf=_0x41b9cf||_0x7807('0x2c');return this[_0x7807('0x25')](util[_0x7807('0x29')](_0x7807('0x2d'),_0x41b9cf));};AGIChannel[_0x7807('0x24')][_0x7807('0x2e')]=function(_0x31a434,_0x10d2da){if(_[_0x7807('0x2f')](_0x10d2da)){return this['sendRequest'](util[_0x7807('0x29')]('EXEC\x20%s\x20%s',_0x31a434,_0x10d2da[_0x7807('0x30')](',')));}return this[_0x7807('0x25')](util[_0x7807('0x29')](_0x7807('0x31'),_0x31a434,_0x10d2da));};AGIChannel[_0x7807('0x24')][_0x7807('0x32')]=function(_0x31ff7f){return this[_0x7807('0x25')](util[_0x7807('0x29')](_0x7807('0x33'),_0x31ff7f));};AGIChannel[_0x7807('0x24')][_0x7807('0x34')]=function(_0x105fc7){return this[_0x7807('0x25')](util[_0x7807('0x29')]('SET\x20EXTENSION\x20%s',_0x105fc7));};AGIChannel[_0x7807('0x24')][_0x7807('0x35')]=function(_0x34f210){return this[_0x7807('0x25')](util[_0x7807('0x29')](_0x7807('0x36'),_0x34f210));};AGIChannel[_0x7807('0x24')][_0x7807('0xc')]=function(){return this[_0x7807('0x25')](_0x7807('0x37'));};AGIChannel['prototype'][_0x7807('0x38')]=function(_0x3542a4,_0x514ca5){var _0x809f01=_[_0x7807('0x39')](_0x514ca5)||_[_0x7807('0x3a')](_0x514ca5)?_0x514ca5[_0x7807('0x3b')]():_0x514ca5;return this[_0x7807('0x25')](util['format']('SET\x20VARIABLE\x20%s\x20\x22%s\x22',_0x3542a4,_0x809f01?_0x809f01[_0x7807('0x3b')]()['replace'](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x7807('0x24')][_0x7807('0x3c')]=function(_0x538ba5,_0x4376d6){return this[_0x7807('0x25')](util[_0x7807('0x29')](_0x7807('0x3d'),_0x538ba5,_0x4376d6));};AGIChannel['prototype']['sayDigits']=function(_0x330d25,_0x533b18){return this['sendRequest'](util['format'](_0x7807('0x3e'),_0x330d25,_0x533b18));};AGIChannel[_0x7807('0x24')][_0x7807('0x3f')]=function(_0x257d88,_0xf5402c){return this[_0x7807('0x25')](util[_0x7807('0x29')](_0x7807('0x40'),_0x257d88,_0xf5402c));};AGIChannel[_0x7807('0x24')][_0x7807('0x41')]=function(_0x4da374,_0x3c1fb4,_0x4b9fcc){_0x3c1fb4=_0x3c1fb4||this['extension'];_0x4b9fcc=_0x4b9fcc||0x1;this[_0x7807('0x32')](_0x4da374);this[_0x7807('0x34')](_0x3c1fb4);this[_0x7807('0x35')](_0x4b9fcc);return this['noop'](util[_0x7807('0x29')](_0x7807('0x42'),_0x4da374,_0x3c1fb4,_0x4b9fcc));};AGIChannel[_0x7807('0x24')]['getVariable']=function(_0x4ac5ab){return this['sendRequest'](util['format'](_0x7807('0x43'),_0x4ac5ab));};AGIChannel[_0x7807('0x24')][_0x7807('0x44')]=function(_0x47d126,_0x1bd709,_0x2a67c4,_0xaeed4e,_0x1815a0,_0x36b03a){_0x1bd709=_0x1bd709||_0x7807('0x45');_0x2a67c4=_0x2a67c4||'';_0xaeed4e=_0xaeed4e===undefined?-0x1:_0xaeed4e==='-1'?-0x1:_0xaeed4e*0x3e8;_0x1815a0=_0x1815a0===undefined?'':'s='+_0x1815a0;_0x36b03a=_0x36b03a?_0x7807('0x46'):'';return this['sendRequest'](util[_0x7807('0x29')](_0x7807('0x47'),_0x47d126,_0x1bd709,_0x2a67c4,_0xaeed4e,_0x36b03a,_0x1815a0));};AGIChannel[_0x7807('0x24')][_0x7807('0x48')]=function(_0x5b2ca0,_0x346db3){_0x346db3=_0x346db3||'';return this[_0x7807('0x25')](util['format'](_0x7807('0x49'),_0x5b2ca0,_0x346db3));};AGIChannel[_0x7807('0x24')][_0x7807('0x4a')]=function(_0x1bde79){return this[_0x7807('0x2e')](_0x7807('0x4b'),_0x1bde79);};AGIChannel[_0x7807('0x24')][_0x7807('0x4c')]=function(_0x559b1a){return this['exec'](_0x7807('0x4d'),_0x559b1a);};AGIChannel[_0x7807('0x24')]['error']=function(_0x498069,_0x5cee64){this['noop'](util[_0x7807('0x29')]('ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s',_0x498069['id'],_0x498069['label'],_0x5cee64));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x7807('0x4e')]=AGIChannel; \ No newline at end of file +var _0xf62d=['AGI','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','setTimeout','utf8','headers','emit','ready','line','toLowerCase','substring','search','520\x20End\x20of\x20proper','function','no\x20code','replace','result=','indexOf','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','write','inherits','prototype','sendRequest','sync','answer','ANSWER','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','join','setContext','SET\x20CONTEXT\x20%s','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','isBoolean','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','SAY\x20NUMBER\x20%s\x20%s','sayDigits','SAY\x20DIGITS\x20%s\x20%s','sayPhonetic','extension','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','agi'];(function(_0x2ff4c8,_0x29c0e6){var _0x31b7a5=function(_0x92997d){while(--_0x92997d){_0x2ff4c8['push'](_0x2ff4c8['shift']());}};_0x31b7a5(++_0x29c0e6);}(_0xf62d,0x1c0));var _0xdf62=function(_0x4b3cb5,_0x5c48f3){_0x4b3cb5=_0x4b3cb5-0x0;var _0x36d8e3=_0xf62d[_0x4b3cb5];return _0x36d8e3;};'use strict';var util=require(_0xdf62('0x0'));var _=require(_0xdf62('0x1'));var EventEmitter=require('events')[_0xdf62('0x2')];var AGIReply=require(_0xdf62('0x3'));var AGIError=require(_0xdf62('0x4'));function AGIChannel(_0x44cd45){var _0x2f7d73=this,_0x451a23=new AGIReply(),_0x3fcfc7=![],_0x76ca4={};EventEmitter['call'](_0x2f7d73);_0x44cd45['setEncoding']('utf8');_0x44cd45[_0xdf62('0x5')](0x8*0x3c*0x3c*0x3e8);_0x451a23['setEncoding'](_0xdf62('0x6'));_0x451a23['on'](_0xdf62('0x7'),function(_0xfcbcc1){for(var _0x27182d in _0xfcbcc1){_0x2f7d73[_0x27182d]=_0xfcbcc1[_0x27182d];}_0x2f7d73[_0xdf62('0x8')](_0xdf62('0x9'));});_0x451a23['on'](_0xdf62('0xa'),function(_0x1316f3){if(_0x1316f3[_0xdf62('0xb')]()=='hangup'){_0x2f7d73[_0xdf62('0x8')]('hangup');return;}if(_0x1316f3[_0xdf62('0xc')](0x0,0xb)=='520-Invalid'){_0x3fcfc7=!![];}if(_0x3fcfc7){_0x76ca4['rx']+=_0x1316f3+'\x0a';if(_0x1316f3[_0xdf62('0xd')](_0xdf62('0xe'))!=-0x1){_0x3fcfc7=![];}}else{_0x76ca4['rx']=_0x1316f3;}if(_0x3fcfc7){return;}if(typeof _0x76ca4['cb']==_0xdf62('0xf')){var _0x1e2a6c=_0x76ca4['rx']['substring'](0x0,0x3),_0x855b8a=null,_0x4774c4=null;_0x1e2a6c=parseInt(_0x1e2a6c);if(isNaN(_0x1e2a6c)){_0x76ca4['cb'](null,{'code':0x1f4,'result':-0x1,'extra':_0xdf62('0x10')});return;}if(_0x1e2a6c!=0xc8){_0x76ca4['cb'](null,{'code':_0x1e2a6c,'result':-0x1,'extra':'KO'});return;}_0x855b8a=_0x76ca4['rx'][_0xdf62('0xc')](0x4)[_0xdf62('0x11')](_0xdf62('0x12'),'');if(_0x855b8a['indexOf']('\x20')!=-0x1){_0x855b8a=_0x855b8a['substr'](0x0,_0x855b8a[_0xdf62('0x13')]('\x20'));}if(_['startsWith'](_0x855b8a,'-1')){_0x855b8a=parseInt(_0x855b8a);}_0x4774c4=_0x76ca4['rx'][_0xdf62('0x14')]('\x20');if(_0x4774c4[_0xdf62('0x15')]==0x3){_0x4774c4=_0x4774c4[0x2][_0xdf62('0xc')](0x1,_0x4774c4[0x2][_0xdf62('0x15')]-0x1);}else if(_0x4774c4['length']>0x3){var _0x47cb3a=/\((.+)\)/;var _0x159ff1=_0x76ca4['rx'][_0xdf62('0x16')](_0x47cb3a);if(_0x159ff1){_0x4774c4=_0x159ff1[0x1];}else{_0x4774c4=null;}}else{_0x4774c4=null;}_0x76ca4['cb'](null,{'code':_0x1e2a6c,'result':_0x855b8a,'extra':_0x4774c4});}});_0x44cd45['on']('error',function(_0x55b943){_0x2f7d73[_0xdf62('0x8')](_0xdf62('0x17'),new AGIError(_0xdf62('0x18'),_0x55b943[_0xdf62('0x19')]));});_0x44cd45['on'](_0xdf62('0x1a'),function(){_0x2f7d73[_0xdf62('0x8')](_0xdf62('0x1a'),new AGIError('E_AGI_SOCKET_CLOSE'));});_0x44cd45['on'](_0xdf62('0x1b'),function(){_0x2f7d73['emit'](_0xdf62('0x1b'),new AGIError(_0xdf62('0x1c')));_0x44cd45[_0xdf62('0x1d')]();});_0x44cd45[_0xdf62('0x1e')](_0x451a23);this[_0xdf62('0x1f')]=function(_0x57f177,_0x302458){var _0x57f177=_0x57f177||'',_0x302458=typeof _0x302458==_0xdf62('0xf')?_0x302458:new Function();_0x76ca4={'tx':_0x57f177,'rx':'','cb':_0x302458};_0x44cd45[_0xdf62('0x20')](_0x57f177+'\x0a');},this[_0xdf62('0x1a')]=function(){_0x44cd45['destroy']();};}util[_0xdf62('0x21')](AGIChannel,EventEmitter);AGIChannel[_0xdf62('0x22')][_0xdf62('0x23')]=function(_0x562510){return this['command'][_0xdf62('0x24')](this,_0x562510);};AGIChannel[_0xdf62('0x22')][_0xdf62('0x25')]=function(){return this[_0xdf62('0x23')](_0xdf62('0x26'));};AGIChannel[_0xdf62('0x22')]['getData']=function(_0xfd2900,_0x2f8bda,_0x3a1944){_0xfd2900=_0xfd2900===undefined?_0xdf62('0x27'):_0xfd2900;_0x2f8bda=_0x2f8bda===undefined?'5':_0x2f8bda;_0x3a1944=_0x3a1944===undefined?'1':_0x3a1944;return this['sendRequest'](util[_0xdf62('0x28')](_0xdf62('0x29'),_0xfd2900,_0x2f8bda*0x3e8,_0x3a1944));};AGIChannel[_0xdf62('0x22')][_0xdf62('0x2a')]=function(_0x4c4273){_0x4c4273=_0x4c4273||'NO\x20MESSAGE';return this['sendRequest'](util['format'](_0xdf62('0x2b'),_0x4c4273));};AGIChannel['prototype'][_0xdf62('0x2c')]=function(_0x109302,_0x3795ab){if(_[_0xdf62('0x2d')](_0x3795ab)){return this['sendRequest'](util['format'](_0xdf62('0x2e'),_0x109302,_0x3795ab[_0xdf62('0x2f')](',')));}return this[_0xdf62('0x23')](util[_0xdf62('0x28')]('EXEC\x20%s\x20%s',_0x109302,_0x3795ab));};AGIChannel[_0xdf62('0x22')][_0xdf62('0x30')]=function(_0x32ac66){return this[_0xdf62('0x23')](util[_0xdf62('0x28')](_0xdf62('0x31'),_0x32ac66));};AGIChannel[_0xdf62('0x22')][_0xdf62('0x32')]=function(_0x1c5c6c){return this[_0xdf62('0x23')](util[_0xdf62('0x28')](_0xdf62('0x33'),_0x1c5c6c));};AGIChannel[_0xdf62('0x22')][_0xdf62('0x34')]=function(_0x23cd16){return this['sendRequest'](util[_0xdf62('0x28')](_0xdf62('0x35'),_0x23cd16));};AGIChannel[_0xdf62('0x22')]['hangup']=function(){return this[_0xdf62('0x23')]('HANGUP');};AGIChannel['prototype']['setVariable']=function(_0x2a0783,_0x3ab39f){var _0x373a07=_[_0xdf62('0x36')](_0x3ab39f)||_['isNumber'](_0x3ab39f)?_0x3ab39f['toString']():_0x3ab39f;return this['sendRequest'](util[_0xdf62('0x28')](_0xdf62('0x37'),_0x2a0783,_0x373a07?_0x373a07[_0xdf62('0x38')]()[_0xdf62('0x11')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0xdf62('0x22')]['sayNumber']=function(_0x386912,_0x258f0f){return this[_0xdf62('0x23')](util[_0xdf62('0x28')](_0xdf62('0x39'),_0x386912,_0x258f0f));};AGIChannel[_0xdf62('0x22')][_0xdf62('0x3a')]=function(_0x387354,_0x35d9fe){return this[_0xdf62('0x23')](util[_0xdf62('0x28')](_0xdf62('0x3b'),_0x387354,_0x35d9fe));};AGIChannel[_0xdf62('0x22')][_0xdf62('0x3c')]=function(_0x2b51e4,_0x392776){return this['sendRequest'](util[_0xdf62('0x28')]('SAY\x20PHONETIC\x20\x22%s\x22\x20%s',_0x2b51e4,_0x392776));};AGIChannel[_0xdf62('0x22')]['continueAt']=function(_0x5d4512,_0x261370,_0x2a9053){_0x261370=_0x261370||this[_0xdf62('0x3d')];_0x2a9053=_0x2a9053||0x1;this[_0xdf62('0x30')](_0x5d4512);this[_0xdf62('0x32')](_0x261370);this[_0xdf62('0x34')](_0x2a9053);return this['noop'](util['format'](_0xdf62('0x3e'),_0x5d4512,_0x261370,_0x2a9053));};AGIChannel['prototype'][_0xdf62('0x3f')]=function(_0x88f73d){return this[_0xdf62('0x23')](util['format'](_0xdf62('0x40'),_0x88f73d));};AGIChannel[_0xdf62('0x22')][_0xdf62('0x41')]=function(_0x52c0da,_0x303612,_0x572c7b,_0x1364af,_0x20a9d9,_0x431fcc){_0x303612=_0x303612||_0xdf62('0x42');_0x572c7b=_0x572c7b||'';_0x1364af=_0x1364af===undefined?-0x1:_0x1364af==='-1'?-0x1:_0x1364af*0x3e8;_0x20a9d9=_0x20a9d9===undefined?'':'s='+_0x20a9d9;_0x431fcc=_0x431fcc?'BEEP':'';return this[_0xdf62('0x23')](util[_0xdf62('0x28')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x52c0da,_0x303612,_0x572c7b,_0x1364af,_0x431fcc,_0x20a9d9));};AGIChannel[_0xdf62('0x22')][_0xdf62('0x43')]=function(_0x5ec592,_0x47a6a1){_0x47a6a1=_0x47a6a1||'';return this[_0xdf62('0x23')](util['format'](_0xdf62('0x44'),_0x5ec592,_0x47a6a1));};AGIChannel[_0xdf62('0x22')][_0xdf62('0x45')]=function(_0x52ede5){return this[_0xdf62('0x2c')](_0xdf62('0x46'),_0x52ede5);};AGIChannel[_0xdf62('0x22')]['wait']=function(_0x556091){return this[_0xdf62('0x2c')]('WAIT',_0x556091);};AGIChannel[_0xdf62('0x22')][_0xdf62('0x17')]=function(_0x35b8c2,_0x2ab556){this['noop'](util[_0xdf62('0x28')](_0xdf62('0x47'),_0x35b8c2['id'],_0x35b8c2[_0xdf62('0x48')],_0x2ab556));return{'code':0x1f4,'result':'-1','extra':''};};module[_0xdf62('0x49')]=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index e577bca..e37c45d 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 _0xb361=['[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','name','exports','util','Undefined\x20error.','Server\x20closed.'];(function(_0x104789,_0x57bd85){var _0x2d27ea=function(_0x2d142b){while(--_0x2d142b){_0x104789['push'](_0x104789['shift']());}};_0x2d27ea(++_0x57bd85);}(_0xb361,0x13f));var _0x1b36=function(_0x576e16,_0x30212f){_0x576e16=_0x576e16-0x0;var _0x4aca69=_0xb361[_0x576e16];return _0x4aca69;};'use strict';var util=require(_0x1b36('0x0'));var error={'E_AGI_UNDEFINED':_0x1b36('0x1'),'E_AGI_ARGUMENT_PORT':'Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x1b36('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x1b36('0x3'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x1b36('0x4'),'E_AGI_SOCKET_CLOSE':_0x1b36('0x5'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':'Empty\x20command.','E_AGI_IVR_AGI_NETWORK_SCRIPT':_0x1b36('0x6'),'E_AGI_IVR_ENTRY':_0x1b36('0x7')};function AGIError(_0x2f6736){var _0x2f6736=_0x2f6736||null,_0x775569=_0x775569||[],_0x11a557=0x1,_0x5d8671='';if(!error[_0x2f6736]){_0x2f6736=_0x1b36('0x8');}_0x775569[_0x1b36('0x9')](error[_0x2f6736]);while(arguments[_0x11a557]){_0x775569['push'](arguments[_0x11a557]);_0x11a557++;}_0x5d8671=util[_0x1b36('0xa')][_0x1b36('0xb')](util,_0x775569);this['message']=_0x5d8671;this[_0x1b36('0xc')]=_0x2f6736;}module[_0x1b36('0xd')]=AGIError; \ No newline at end of file +var _0x2720=['Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','format','apply','message','name','exports','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','Socket\x20error.\x20Code:\x20%s.'];(function(_0x4992be,_0x555abf){var _0x39e44e=function(_0x286e9f){while(--_0x286e9f){_0x4992be['push'](_0x4992be['shift']());}};_0x39e44e(++_0x555abf);}(_0x2720,0xd7));var _0x0272=function(_0x3efbdf,_0x11698b){_0x3efbdf=_0x3efbdf-0x0;var _0x3de879=_0x2720[_0x3efbdf];return _0x3de879;};'use strict';var util=require('util');var error={'E_AGI_UNDEFINED':_0x0272('0x0'),'E_AGI_ARGUMENT_PORT':_0x0272('0x1'),'E_AGI_SERVER_ERROR':'Server\x20error.\x20Code:\x20%s.','E_AGI_SERVER_CLOSE':_0x0272('0x2'),'E_AGI_SERVER_MAXCONNECTION':_0x0272('0x3'),'E_AGI_SERVER_VOICE_DISABLED':_0x0272('0x4'),'E_AGI_SOCKET_ERROR':_0x0272('0x5'),'E_AGI_SOCKET_CLOSE':_0x0272('0x6'),'E_AGI_SOCKET_TIMEOUT':_0x0272('0x7'),'E_AGI_COMMAND_EMPTY':_0x0272('0x8'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x0272('0x9')};function AGIError(_0xccfce2){var _0xccfce2=_0xccfce2||null,_0x1deb0b=_0x1deb0b||[],_0x5be012=0x1,_0x3f3cbf='';if(!error[_0xccfce2]){_0xccfce2=_0x0272('0xa');}_0x1deb0b[_0x0272('0xb')](error[_0xccfce2]);while(arguments[_0x5be012]){_0x1deb0b[_0x0272('0xb')](arguments[_0x5be012]);_0x5be012++;}_0x3f3cbf=util[_0x0272('0xc')][_0x0272('0xd')](util,_0x1deb0b);this[_0x0272('0xe')]=_0x3f3cbf;this[_0x0272('0xf')]=_0xccfce2;}module[_0x0272('0x10')]=AGIError; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 1b8c83a..46feda9 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 _0xcab2=['exports','lodash','getsecretdigits','vertices','numberOfEdges','addVertex','edges','prototype','addEdge','size','getVertex','traverseBFS','info','no\x20vertex\x20found','stop\x20traverse','length','no\x20edge/s\x20available','condition','split','agicommand','vswitch','default','target','menu','default\x20on\x20switch\x20not\x20found','includes','condition\x20not\x20found'];(function(_0x49da81,_0xaa4b01){var _0x354d7a=function(_0x4f4dfa){while(--_0x4f4dfa){_0x49da81['push'](_0x49da81['shift']());}};_0x354d7a(++_0xaa4b01);}(_0xcab2,0x17b));var _0x2cab=function(_0x370c00,_0xf98ce){_0x370c00=_0x370c00-0x0;var _0x52e89a=_0xcab2[_0x370c00];return _0x52e89a;};'use strict';var _=require(_0x2cab('0x0'));var logger=require('../../../config/logger')('agi');var verticesWithRetry=['menu','getdigits',_0x2cab('0x1')];var Graph=function(){this[_0x2cab('0x2')]={};this['edges']={};this[_0x2cab('0x3')]=0x0;};Graph['prototype'][_0x2cab('0x4')]=function(_0x25ee8c){this[_0x2cab('0x2')][_0x25ee8c['id']]=_0x25ee8c;this[_0x2cab('0x5')][_0x25ee8c['id']]=[];};Graph[_0x2cab('0x6')][_0x2cab('0x7')]=function(_0x247a0f,_0x2b1e7a,_0x36a686){this[_0x2cab('0x5')][_0x247a0f]['push']({'target':_0x2b1e7a,'condition':_0x36a686});this[_0x2cab('0x3')]+=0x1;};Graph[_0x2cab('0x6')][_0x2cab('0x8')]=function(){return _[_0x2cab('0x8')](this['vertices']);};Graph['prototype']['relations']=function(){return this['numberOfEdges'];};Graph[_0x2cab('0x6')][_0x2cab('0x9')]=function(_0x1fba73){return this[_0x2cab('0x2')][_0x1fba73];};Graph[_0x2cab('0x6')][_0x2cab('0xa')]=function(_0x568c04,_0x24d3f8){if(!this[_0x2cab('0x2')][_0x568c04]){return logger[_0x2cab('0xb')](_0x2cab('0xc'));}var _0x15ee02=_0x24d3f8(this[_0x2cab('0x2')][_0x568c04]);if(!_0x15ee02){return logger[_0x2cab('0xb')](_0x2cab('0xd'));}if(this[_0x2cab('0x5')][_0x568c04][_0x2cab('0xe')]===0x0){return logger['info'](_0x2cab('0xf'));}for(var _0x47aac7=0x0,_0x4db58e=[],_0x1af0fc=![];_0x47aac7\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[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','Project\x20%s\x20not\x20published','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','[LICENSE]','finally','./server','listening','connection','xml2json','lodash','syncho','moment','../../config/environment','../../config/license/util','./rpc','./mailRpc','./vertices','agi','defaults','127.0.0.1','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','format','port','[%s]\x20%s','name','message','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[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','toJson','hasOwnProperty','mxCell','isArray','length','source','target','value','then','catch','indexOf','agi_','substring','inspect','debug','variables','[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','stringify','joinAt','omit','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','traverseBFS','clear','vertex','agicommand','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xb557,0x17d));var _0x7b55=function(_0x47bcf3,_0x10529d){_0x47bcf3=_0x47bcf3-0x0;var _0x41c3d6=_0xb557[_0x47bcf3];return _0x41c3d6;};'use strict';var parser=require(_0x7b55('0x0'));var _=require(_0x7b55('0x1'));var syncho=require(_0x7b55('0x2'));var util=require('util');var moment=require(_0x7b55('0x3'));var config=require(_0x7b55('0x4'));var logger=require('../../config/logger')('agi');var utilLicense=require(_0x7b55('0x5'));var rpc=require(_0x7b55('0x6'));var mailRpc=require(_0x7b55('0x7'));var Graph=require('./graph');var Vertices=require(_0x7b55('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0x7b55('0x9')]=_[_0x7b55('0xa')](config[_0x7b55('0x9')],{'ip':_0x7b55('0xb'),'port':0x11dd});function connectionHandler(_0x68bef9){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x68bef9);agiHandler(_0x68bef9);}catch(_0x265287){logger[_0x7b55('0xc')](_0x265287[_0x7b55('0xd')]);}});});}function listeningHandler(){console[_0x7b55('0xe')](_0x7b55('0xf'),config['agi']['port']);logger[_0x7b55('0x10')](util[_0x7b55('0x11')]('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0x7b55('0x9')]['ip'],config[_0x7b55('0x9')][_0x7b55('0x12')]));}function errorHandler(_0x48a337){if(_0x48a337&&_0x48a337['name']&&_0x48a337['message']){logger[_0x7b55('0xc')](util[_0x7b55('0x11')](_0x7b55('0x13'),_0x48a337[_0x7b55('0x14')],_0x48a337[_0x7b55('0x15')]));}else{logger['error'](util[_0x7b55('0x11')](_0x7b55('0x16'),_0x48a337['stack']));}}function closeHandler(){logger['info'](util[_0x7b55('0x11')](_0x7b55('0x17'),this[_0x7b55('0x18')],this[_0x7b55('0x19')],this[_0x7b55('0x1a')],this[_0x7b55('0x1b')],this[_0x7b55('0x1c')]));try{createSquareReport(this);}catch(_0x3de53b){logger[_0x7b55('0xc')](_0x3de53b['stack']);}}function timeoutHandler(){logger[_0x7b55('0x10')](util[_0x7b55('0x11')](_0x7b55('0x1d'),this['arg_1'],this[_0x7b55('0x19')],this['callerid'],this[_0x7b55('0x1b')],this[_0x7b55('0x1c')]));}function hangupHandler(){logger[_0x7b55('0x10')](util[_0x7b55('0x11')](_0x7b55('0x1e'),this[_0x7b55('0x18')],this[_0x7b55('0x19')],this[_0x7b55('0x1a')],this[_0x7b55('0x1b')],this[_0x7b55('0x1c')]));this['evtHangup']=!![];}function getRoot(_0x4a3a69){return parser[_0x7b55('0x1f')](_0x4a3a69,{'object':!![]})['mxGraphModel']['root'];}function addVertex(_0x30a349,_0x33b5d2,_0x3641f4){_0x33b5d2['agicommand']=_0x3641f4;if(_0x33b5d2[_0x7b55('0x20')]('retry')){_0x33b5d2['maxRetry']=parseInt(_0x33b5d2['retry'],0xa);}_0x30a349['addVertex'](_['omit'](_0x33b5d2,_0x7b55('0x21')));}function initGraph(_0x4408aa,_0x2cc828){var _0x17a652=new Graph();for(var _0x3da084 in _0x4408aa){if(_0x4408aa[_0x7b55('0x20')](_0x3da084)){if(_[_0x7b55('0x22')](_0x4408aa[_0x3da084])){for(var _0xb14ede=0x0;_0xb14ede<_0x4408aa[_0x3da084][_0x7b55('0x23')];_0xb14ede+=0x1){addVertex(_0x17a652,_0x4408aa[_0x3da084][_0xb14ede],_0x3da084);}}else{addVertex(_0x17a652,_0x4408aa[_0x3da084],_0x3da084);}}}for(var _0xf867e3=0x0;_0xf867e3<_0x2cc828['length'];_0xf867e3+=0x1){if(_0x2cc828[_0xf867e3][_0x7b55('0x24')]&&_0x2cc828[_0xf867e3][_0x7b55('0x25')]){_0x17a652['addEdge'](_0x2cc828[_0xf867e3]['source'],_0x2cc828[_0xf867e3][_0x7b55('0x25')],_0x2cc828[_0xf867e3][_0x7b55('0x26')]);}}return _0x17a652;}function getSquareProject(_0xe57c29,_0x2ad3e2){rpc['getSquareProject'](_0xe57c29)[_0x7b55('0x27')](function(_0x47f2b8){_0x2ad3e2(null,_0x47f2b8);})[_0x7b55('0x28')](function(_0xe998c4){_0x2ad3e2(null,_0xe998c4);});}function createSquareReport(_0x4246af,_0x38b380){rpc['createSquareReport'](_0x4246af)[_0x7b55('0x27')](function(_0x3ded3a){if(_0x38b380){_0x38b380(null,_0x3ded3a);}})['catch'](function(_0x59db68){if(_0x38b380){_0x38b380(null,_0x59db68);}});}function setChannelVariables(_0x1b7894){for(var _0x587abd in _0x1b7894){if(_0x1b7894[_0x7b55('0x20')](_0x587abd)){if(_0x587abd[_0x7b55('0x29')](_0x7b55('0x2a'))===0x0){_0x1b7894[_0x587abd[_0x7b55('0x2b')](0x4)]=_0x1b7894[_0x587abd];delete _0x1b7894[_0x587abd];}}}}function getLogFromObject(_0x1203f){return util[_0x7b55('0x2c')](_0x1203f,{'showHidden':![],'depth':null});}function agiHandler(_0x149a03){var _0x8ff83d,_0x1473ee,_0x4448fe,_0x3af500,_0x443cd9;logger[_0x7b55('0x2d')](_0x7b55('0x2e'),JSON['stringify'](_0x149a03,null,0x2));logger['info'](util[_0x7b55('0x11')](_0x7b55('0x2f'),_0x149a03[_0x7b55('0x18')],_0x149a03['calleridname'],_0x149a03[_0x7b55('0x1a')],_0x149a03[_0x7b55('0x1b')],_0x149a03[_0x7b55('0x1c')]));_0x149a03['on'](_0x7b55('0xc'),errorHandler);_0x149a03['on'](_0x7b55('0x30'),closeHandler);_0x149a03['on'](_0x7b55('0x31'),timeoutHandler);_0x149a03[_0x7b55('0x32')]=![];_0x149a03['on'](_0x7b55('0x33'),hangupHandler);var _0x486b4c=getSquareProject['sync'](null,_0x149a03[_0x7b55('0x18')]);if(_0x486b4c){if(_0x486b4c[_0x7b55('0x34')]){_0x8ff83d=getRoot(_0x486b4c[_0x7b55('0x34')]);if(_0x8ff83d&&_0x8ff83d[_0x7b55('0x35')]){logger['debug'](_0x7b55('0x36'),JSON[_0x7b55('0x37')](_0x8ff83d,null,0x2));_0x149a03[_0x7b55('0x38')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x1473ee=initGraph(_[_0x7b55('0x39')](_0x8ff83d,_0x7b55('0x21')),_0x8ff83d['mxCell']);_0x4448fe=new Vertices(_0x149a03,rpc,mailRpc);logger[_0x7b55('0x10')](util[_0x7b55('0x11')](_0x7b55('0x3a'),_0x149a03[_0x7b55('0x18')],_0x149a03['calleridname'],_0x149a03[_0x7b55('0x1a')],_0x149a03['dnid'],_0x149a03[_0x7b55('0x1c')]));_0x1473ee[_0x7b55('0x3b')](_0x8ff83d['start']['id'],function(_0x1cc94b){try{_0x1cc94b=_0x4448fe[_0x7b55('0x3c')](_0x1cc94b);logger[_0x7b55('0x2d')](_0x7b55('0x3d'),JSON[_0x7b55('0x37')](_0x1cc94b,null,0x2));if(_0x1cc94b[_0x7b55('0x3e')]==='gotoc'){logger[_0x7b55('0x10')](_0x7b55('0x3f'));_0x149a03[_0x7b55('0x40')]=_0x1cc94b[_0x7b55('0x40')]||_0x149a03[_0x7b55('0x40')];_0x149a03[_0x7b55('0x41')]=_0x1cc94b[_0x7b55('0x41')];_0x149a03['priority']=_0x1cc94b[_0x7b55('0x42')]?_0x1cc94b[_0x7b55('0x42')]-0x1:0x1;return null;}else if(_0x1cc94b&&_0x4448fe[_0x1cc94b[_0x7b55('0x3e')]]){_0x443cd9=_0x4448fe[_0x1cc94b[_0x7b55('0x3e')]](_0x1cc94b);logger[_0x7b55('0x10')](_0x7b55('0x43'),JSON[_0x7b55('0x37')](_0x443cd9,null,0x2));if(_0x443cd9&&_0x443cd9[_0x7b55('0x44')]===AGI_CODE_SUCCESS&&_0x443cd9[_0x7b55('0x45')]!==AGI_RESULT_ERROR&&!_0x149a03[_0x7b55('0x32')]){logger[_0x7b55('0x2d')]('response',getLogFromObject(_0x443cd9));return _[_0x7b55('0x46')](_0x443cd9[_0x7b55('0x45')])?null:_0x443cd9[_0x7b55('0x45')][_0x7b55('0x47')]();}else{logger[_0x7b55('0xc')](_0x7b55('0x43'),getLogFromObject(_0x443cd9));return null;}}else{logger[_0x7b55('0xc')](_0x7b55('0x48'));return null;}}catch(_0x40baba){logger[_0x7b55('0xc')](_0x40baba[_0x7b55('0xd')]);return null;}});if(_0x8ff83d['finally']){logger['info'](util[_0x7b55('0x11')](_0x7b55('0x49'),_0x149a03[_0x7b55('0x18')],_0x149a03['calleridname'],_0x149a03[_0x7b55('0x1a')],_0x149a03[_0x7b55('0x1b')],_0x149a03[_0x7b55('0x1c')]));_0x1473ee[_0x7b55('0x3b')](_0x8ff83d['finally']['id'],function(_0x5d28f7){try{_0x5d28f7=_0x4448fe['clear'](_0x5d28f7);logger[_0x7b55('0x2d')](_0x7b55('0x3d'),JSON[_0x7b55('0x37')](_0x5d28f7,null,0x2));if(_0x5d28f7&&_0x4448fe[_0x5d28f7['agicommand']]){_0x443cd9=_0x4448fe[_0x5d28f7[_0x7b55('0x3e')]](_0x5d28f7);if(_0x443cd9){logger['debug'](_0x7b55('0x43'),getLogFromObject(_0x443cd9));return _[_0x7b55('0x46')](_0x443cd9['result'])?null:_0x443cd9['result'][_0x7b55('0x47')]();}else{logger['error']('response',getLogFromObject(_0x443cd9));return null;}}else{logger[_0x7b55('0xc')](_0x7b55('0x48'));return null;}}catch(_0x45c54b){logger[_0x7b55('0xc')](_0x45c54b['stack']);return null;}});}logger[_0x7b55('0x10')](util['format'](_0x7b55('0x4a'),_0x149a03[_0x7b55('0x18')],_0x149a03[_0x7b55('0x19')],_0x149a03[_0x7b55('0x1a')],_0x149a03['dnid'],_0x149a03[_0x7b55('0x1c')]));logger['info'](util[_0x7b55('0x11')](_0x7b55('0x4b'),_0x149a03['context'],_0x149a03[_0x7b55('0x41')],parseInt(_0x149a03[_0x7b55('0x42')],0xa)+0x1));_0x149a03[_0x7b55('0x4c')](_0x149a03['context'],_0x149a03['extension'],parseInt(_0x149a03['priority'],0xa)+0x1);_0x149a03['close']();}}else{logger[_0x7b55('0xc')](util[_0x7b55('0x11')](_0x7b55('0x4d'),_0x149a03['arg_1']));_0x149a03[_0x7b55('0x4c')](_0x149a03[_0x7b55('0x40')],_0x149a03['extension'],parseInt(_0x149a03[_0x7b55('0x42')],0xa)+0x1);_0x149a03['close']();}}else{logger[_0x7b55('0xc')](util[_0x7b55('0x11')](_0x7b55('0x4e'),_0x149a03['arg_1']));_0x149a03['continueAt'](_0x149a03['context'],_0x149a03[_0x7b55('0x41')],parseInt(_0x149a03[_0x7b55('0x42')],0xa)+0x1);_0x149a03[_0x7b55('0x30')]();}}function main(){var _0x1b8bef;return utilLicense[_0x7b55('0x4f')]()['then'](function(_0x42721a){if(_0x42721a){if(_0x42721a[_0x7b55('0x50')]){if(_0x42721a[_0x7b55('0x51')]&&_0x42721a[_0x7b55('0x51')]>0x0){logger['info'](util[_0x7b55('0x11')](_0x7b55('0x52'),_0x42721a[_0x7b55('0x51')]));_0x1b8bef=_0x42721a[_0x7b55('0x51')];}else{logger['info']('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0x7b55('0x10')](_0x7b55('0x53'));_0x1b8bef=-0x1;}}})['catch'](function(_0x1b7cc8){logger[_0x7b55('0xc')](_0x7b55('0x54'),_0x1b7cc8[_0x7b55('0xd')]);})[_0x7b55('0x55')](function(){var _0x10f4fe=require(_0x7b55('0x56'))(config[_0x7b55('0x9')][_0x7b55('0x12')],config[_0x7b55('0x9')]['ip'],_0x1b8bef);_0x10f4fe['on']('error',errorHandler);_0x10f4fe['on'](_0x7b55('0x57'),listeningHandler);_0x10f4fe['on'](_0x7b55('0x58'),connectionHandler);_0x10f4fe['on']('close',closeHandler);});}main(); \ No newline at end of file +var _0x0ffa=['./vertices','defaults','error','stack','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','message','format','[ERROR]\x20%s','arg_1','calleridname','callerid','dnid','uniqueid','[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','toJson','root','agicommand','hasOwnProperty','retry','addVertex','isArray','length','target','addEdge','value','getSquareProject','then','catch','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','timeout','evtHangup','sync','production','start','joinAt','YYYY-MM-DD\x20HH:mm:ss','mxCell','clear','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','code','result','isUndefined','toString','agicommand\x20not\x20found','finally','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','Project\x20%s\x20not\x20published','close','Project\x20%s\x20not\x20found','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]','port','listening','connection','xml2json','lodash','syncho','util','moment','agi','./rpc','./graph'];(function(_0x13ea00,_0x12f610){var _0x1f7347=function(_0x34ae63){while(--_0x34ae63){_0x13ea00['push'](_0x13ea00['shift']());}};_0x1f7347(++_0x12f610);}(_0x0ffa,0x9a));var _0xa0ff=function(_0x11bc02,_0x1be28e){_0x11bc02=_0x11bc02-0x0;var _0x421a70=_0x0ffa[_0x11bc02];return _0x421a70;};'use strict';var parser=require(_0xa0ff('0x0'));var _=require(_0xa0ff('0x1'));var syncho=require(_0xa0ff('0x2'));var util=require(_0xa0ff('0x3'));var moment=require(_0xa0ff('0x4'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0xa0ff('0x5'));var utilLicense=require('../../config/license/util');var rpc=require(_0xa0ff('0x6'));var mailRpc=require('./mailRpc');var Graph=require(_0xa0ff('0x7'));var Vertices=require(_0xa0ff('0x8'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;config[_0xa0ff('0x5')]=_[_0xa0ff('0x9')](config[_0xa0ff('0x5')],{'ip':'127.0.0.1','port':0x11dd});function connectionHandler(_0x2dd92a){process['nextTick'](function(){syncho(function(){try{setChannelVariables(_0x2dd92a);agiHandler(_0x2dd92a);}catch(_0x207f55){logger[_0xa0ff('0xa')](_0x207f55[_0xa0ff('0xb')]);}});});}function listeningHandler(){console[_0xa0ff('0xc')](_0xa0ff('0xd'),config['agi']['port']);logger[_0xa0ff('0xe')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config['agi']['ip'],config['agi']['port']));}function errorHandler(_0x4276b1){if(_0x4276b1&&_0x4276b1['name']&&_0x4276b1[_0xa0ff('0xf')]){logger['error'](util[_0xa0ff('0x10')]('[%s]\x20%s',_0x4276b1['name'],_0x4276b1[_0xa0ff('0xf')]));}else{logger[_0xa0ff('0xa')](util[_0xa0ff('0x10')](_0xa0ff('0x11'),_0x4276b1['stack']));}}function closeHandler(){logger['info'](util['format']('[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa0ff('0x12')],this[_0xa0ff('0x13')],this[_0xa0ff('0x14')],this[_0xa0ff('0x15')],this[_0xa0ff('0x16')]));try{createSquareReport(this);}catch(_0x2af212){logger[_0xa0ff('0xa')](_0x2af212['stack']);}}function timeoutHandler(){logger[_0xa0ff('0xe')](util[_0xa0ff('0x10')](_0xa0ff('0x17'),this[_0xa0ff('0x12')],this[_0xa0ff('0x13')],this[_0xa0ff('0x14')],this[_0xa0ff('0x15')],this[_0xa0ff('0x16')]));}function hangupHandler(){logger['info'](util['format']('[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa0ff('0x12')],this['calleridname'],this[_0xa0ff('0x14')],this[_0xa0ff('0x15')],this[_0xa0ff('0x16')]));this['evtHangup']=!![];}function getRoot(_0x243de9){return parser[_0xa0ff('0x18')](_0x243de9,{'object':!![]})['mxGraphModel'][_0xa0ff('0x19')];}function addVertex(_0x58a219,_0x365ae4,_0x4e5bbd){_0x365ae4[_0xa0ff('0x1a')]=_0x4e5bbd;if(_0x365ae4[_0xa0ff('0x1b')](_0xa0ff('0x1c'))){_0x365ae4['maxRetry']=parseInt(_0x365ae4[_0xa0ff('0x1c')],0xa);}_0x58a219[_0xa0ff('0x1d')](_['omit'](_0x365ae4,'mxCell'));}function initGraph(_0x180152,_0x33541a){var _0x253be1=new Graph();for(var _0x36e01b in _0x180152){if(_0x180152[_0xa0ff('0x1b')](_0x36e01b)){if(_[_0xa0ff('0x1e')](_0x180152[_0x36e01b])){for(var _0x5d05aa=0x0;_0x5d05aa<_0x180152[_0x36e01b][_0xa0ff('0x1f')];_0x5d05aa+=0x1){addVertex(_0x253be1,_0x180152[_0x36e01b][_0x5d05aa],_0x36e01b);}}else{addVertex(_0x253be1,_0x180152[_0x36e01b],_0x36e01b);}}}for(var _0x19a826=0x0;_0x19a826<_0x33541a['length'];_0x19a826+=0x1){if(_0x33541a[_0x19a826]['source']&&_0x33541a[_0x19a826][_0xa0ff('0x20')]){_0x253be1[_0xa0ff('0x21')](_0x33541a[_0x19a826]['source'],_0x33541a[_0x19a826]['target'],_0x33541a[_0x19a826][_0xa0ff('0x22')]);}}return _0x253be1;}function getSquareProject(_0x5139ab,_0x4f55f0){rpc[_0xa0ff('0x23')](_0x5139ab)[_0xa0ff('0x24')](function(_0x54c8fe){_0x4f55f0(null,_0x54c8fe);})[_0xa0ff('0x25')](function(_0x4c5e55){_0x4f55f0(null,_0x4c5e55);});}function createSquareReport(_0x525074,_0x3e3e39){rpc['createSquareReport'](_0x525074)[_0xa0ff('0x24')](function(_0x25a5dd){if(_0x3e3e39){_0x3e3e39(null,_0x25a5dd);}})[_0xa0ff('0x25')](function(_0x3e11af){if(_0x3e3e39){_0x3e3e39(null,_0x3e11af);}});}function setChannelVariables(_0x2fd8df){for(var _0x40dbf8 in _0x2fd8df){if(_0x2fd8df[_0xa0ff('0x1b')](_0x40dbf8)){if(_0x40dbf8[_0xa0ff('0x26')](_0xa0ff('0x27'))===0x0){_0x2fd8df[_0x40dbf8[_0xa0ff('0x28')](0x4)]=_0x2fd8df[_0x40dbf8];delete _0x2fd8df[_0x40dbf8];}}}}function getLogFromObject(_0xeadb99){return util[_0xa0ff('0x29')](_0xeadb99,{'showHidden':![],'depth':null});}function agiHandler(_0x5bf6ca){var _0x2cbd61,_0x33f8b2,_0xd9a643,_0x16352b,_0x39f994;logger[_0xa0ff('0x2a')](_0xa0ff('0x2b'),JSON[_0xa0ff('0x2c')](_0x5bf6ca,null,0x2));logger['info'](util[_0xa0ff('0x10')](_0xa0ff('0x2d'),_0x5bf6ca[_0xa0ff('0x12')],_0x5bf6ca[_0xa0ff('0x13')],_0x5bf6ca[_0xa0ff('0x14')],_0x5bf6ca['dnid'],_0x5bf6ca[_0xa0ff('0x16')]));_0x5bf6ca['on'](_0xa0ff('0xa'),errorHandler);_0x5bf6ca['on']('close',closeHandler);_0x5bf6ca['on'](_0xa0ff('0x2e'),timeoutHandler);_0x5bf6ca[_0xa0ff('0x2f')]=![];_0x5bf6ca['on']('hangup',hangupHandler);var _0x30555b=getSquareProject[_0xa0ff('0x30')](null,_0x5bf6ca['arg_1']);if(_0x30555b){if(_0x30555b[_0xa0ff('0x31')]){_0x2cbd61=getRoot(_0x30555b[_0xa0ff('0x31')]);if(_0x2cbd61&&_0x2cbd61[_0xa0ff('0x32')]){logger[_0xa0ff('0x2a')](_0xa0ff('0x19'),JSON[_0xa0ff('0x2c')](_0x2cbd61,null,0x2));_0x5bf6ca[_0xa0ff('0x33')]=moment()[_0xa0ff('0x10')](_0xa0ff('0x34'));_0x33f8b2=initGraph(_['omit'](_0x2cbd61,'mxCell'),_0x2cbd61[_0xa0ff('0x35')]);_0xd9a643=new Vertices(_0x5bf6ca,rpc,mailRpc);logger[_0xa0ff('0xe')](util[_0xa0ff('0x10')]('[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5bf6ca['arg_1'],_0x5bf6ca[_0xa0ff('0x13')],_0x5bf6ca[_0xa0ff('0x14')],_0x5bf6ca[_0xa0ff('0x15')],_0x5bf6ca[_0xa0ff('0x16')]));_0x33f8b2['traverseBFS'](_0x2cbd61[_0xa0ff('0x32')]['id'],function(_0x1ee93c){try{_0x1ee93c=_0xd9a643[_0xa0ff('0x36')](_0x1ee93c);logger[_0xa0ff('0x2a')](_0xa0ff('0x37'),JSON[_0xa0ff('0x2c')](_0x1ee93c,null,0x2));if(_0x1ee93c['agicommand']===_0xa0ff('0x38')){logger[_0xa0ff('0xe')](_0xa0ff('0x39'));_0x5bf6ca[_0xa0ff('0x3a')]=_0x1ee93c[_0xa0ff('0x3a')]||_0x5bf6ca[_0xa0ff('0x3a')];_0x5bf6ca[_0xa0ff('0x3b')]=_0x1ee93c['extension'];_0x5bf6ca[_0xa0ff('0x3c')]=_0x1ee93c['priority']?_0x1ee93c['priority']-0x1:0x1;return null;}else if(_0x1ee93c&&_0xd9a643[_0x1ee93c[_0xa0ff('0x1a')]]){_0x39f994=_0xd9a643[_0x1ee93c['agicommand']](_0x1ee93c);logger[_0xa0ff('0xe')](_0xa0ff('0x3d'),JSON[_0xa0ff('0x2c')](_0x39f994,null,0x2));if(_0x39f994&&_0x39f994[_0xa0ff('0x3e')]===AGI_CODE_SUCCESS&&_0x39f994[_0xa0ff('0x3f')]!==AGI_RESULT_ERROR&&!_0x5bf6ca[_0xa0ff('0x2f')]){logger[_0xa0ff('0x2a')](_0xa0ff('0x3d'),getLogFromObject(_0x39f994));return _[_0xa0ff('0x40')](_0x39f994['result'])?null:_0x39f994[_0xa0ff('0x3f')][_0xa0ff('0x41')]();}else{logger[_0xa0ff('0xa')](_0xa0ff('0x3d'),getLogFromObject(_0x39f994));return null;}}else{logger[_0xa0ff('0xa')](_0xa0ff('0x42'));return null;}}catch(_0x2423c7){logger[_0xa0ff('0xa')](_0x2423c7[_0xa0ff('0xb')]);return null;}});if(_0x2cbd61[_0xa0ff('0x43')]){logger[_0xa0ff('0xe')](util[_0xa0ff('0x10')]('[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5bf6ca[_0xa0ff('0x12')],_0x5bf6ca[_0xa0ff('0x13')],_0x5bf6ca[_0xa0ff('0x14')],_0x5bf6ca['dnid'],_0x5bf6ca[_0xa0ff('0x16')]));_0x33f8b2['traverseBFS'](_0x2cbd61[_0xa0ff('0x43')]['id'],function(_0x16bf23){try{_0x16bf23=_0xd9a643[_0xa0ff('0x36')](_0x16bf23);logger[_0xa0ff('0x2a')]('vertex',JSON['stringify'](_0x16bf23,null,0x2));if(_0x16bf23&&_0xd9a643[_0x16bf23[_0xa0ff('0x1a')]]){_0x39f994=_0xd9a643[_0x16bf23[_0xa0ff('0x1a')]](_0x16bf23);if(_0x39f994){logger[_0xa0ff('0x2a')](_0xa0ff('0x3d'),getLogFromObject(_0x39f994));return _[_0xa0ff('0x40')](_0x39f994[_0xa0ff('0x3f')])?null:_0x39f994[_0xa0ff('0x3f')][_0xa0ff('0x41')]();}else{logger['error']('response',getLogFromObject(_0x39f994));return null;}}else{logger[_0xa0ff('0xa')]('agicommand\x20not\x20found');return null;}}catch(_0x8619ff){logger[_0xa0ff('0xa')](_0x8619ff[_0xa0ff('0xb')]);return null;}});}logger[_0xa0ff('0xe')](util[_0xa0ff('0x10')]('[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',_0x5bf6ca[_0xa0ff('0x12')],_0x5bf6ca[_0xa0ff('0x13')],_0x5bf6ca[_0xa0ff('0x14')],_0x5bf6ca['dnid'],_0x5bf6ca[_0xa0ff('0x16')]));logger[_0xa0ff('0xe')](util[_0xa0ff('0x10')](_0xa0ff('0x44'),_0x5bf6ca[_0xa0ff('0x3a')],_0x5bf6ca['extension'],parseInt(_0x5bf6ca[_0xa0ff('0x3c')],0xa)+0x1));_0x5bf6ca[_0xa0ff('0x45')](_0x5bf6ca[_0xa0ff('0x3a')],_0x5bf6ca['extension'],parseInt(_0x5bf6ca['priority'],0xa)+0x1);_0x5bf6ca['close']();}}else{logger[_0xa0ff('0xa')](util[_0xa0ff('0x10')](_0xa0ff('0x46'),_0x5bf6ca[_0xa0ff('0x12')]));_0x5bf6ca[_0xa0ff('0x45')](_0x5bf6ca[_0xa0ff('0x3a')],_0x5bf6ca[_0xa0ff('0x3b')],parseInt(_0x5bf6ca[_0xa0ff('0x3c')],0xa)+0x1);_0x5bf6ca[_0xa0ff('0x47')]();}}else{logger['error'](util['format'](_0xa0ff('0x48'),_0x5bf6ca[_0xa0ff('0x12')]));_0x5bf6ca[_0xa0ff('0x45')](_0x5bf6ca[_0xa0ff('0x3a')],_0x5bf6ca[_0xa0ff('0x3b')],parseInt(_0x5bf6ca[_0xa0ff('0x3c')],0xa)+0x1);_0x5bf6ca[_0xa0ff('0x47')]();}}function main(){var _0x1b8520;return utilLicense[_0xa0ff('0x49')]()['then'](function(_0x451d73){if(_0x451d73){if(_0x451d73[_0xa0ff('0x4a')]){if(_0x451d73[_0xa0ff('0x4b')]&&_0x451d73[_0xa0ff('0x4b')]>0x0){logger[_0xa0ff('0xe')](util[_0xa0ff('0x10')]('[LICENSE]\x20CHANNELS:\x20%s',_0x451d73['callysquare']));_0x1b8520=_0x451d73[_0xa0ff('0x4b')];}else{logger[_0xa0ff('0xe')](_0xa0ff('0x4c'));}}else{logger[_0xa0ff('0xe')]('[LICENSE]\x20VOICE\x20IS\x20DISABLED');_0x1b8520=-0x1;}}})[_0xa0ff('0x25')](function(_0x2798dd){logger[_0xa0ff('0xa')](_0xa0ff('0x4d'),_0x2798dd[_0xa0ff('0xb')]);})[_0xa0ff('0x43')](function(){var _0x261e34=require('./server')(config[_0xa0ff('0x5')][_0xa0ff('0x4e')],config[_0xa0ff('0x5')]['ip'],_0x1b8520);_0x261e34['on'](_0xa0ff('0xa'),errorHandler);_0x261e34['on'](_0xa0ff('0x4f'),listeningHandler);_0x261e34['on'](_0xa0ff('0x50'),connectionHandler);_0x261e34['on'](_0xa0ff('0x47'),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 ebbb5f3..2d9b32b 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 _0x2e7f=['sendMailMessage','SendMail','bluebird','jayson/promise','request','then','error','message','result','catch'];(function(_0x148e39,_0x157a51){var _0x1c20cf=function(_0x297137){while(--_0x297137){_0x148e39['push'](_0x148e39['shift']());}};_0x1c20cf(++_0x157a51);}(_0x2e7f,0x19c));var _0xf2e7=function(_0x185611,_0x568a37){_0x185611=_0x185611-0x0;var _0x3be6bb=_0x2e7f[_0x185611];return _0x3be6bb;};'use strict';var BPromise=require(_0xf2e7('0x0'));var jayson=require(_0xf2e7('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x46b763,_0x538f35){return new BPromise(function(_0x44ec15,_0x1c6529){return client[_0xf2e7('0x2')](_0x46b763,_0x538f35)[_0xf2e7('0x3')](function(_0x277329){if(_0x277329[_0xf2e7('0x4')]){return _0x1c6529(_0x277329[_0xf2e7('0x4')][_0xf2e7('0x5')]);}else{return _0x44ec15(_0x277329[_0xf2e7('0x6')]);}})[_0xf2e7('0x7')](function(_0x433dc9){return _0x1c6529(_0x433dc9);});});}exports[_0xf2e7('0x8')]=function(_0x41ca8b,_0xb9a5ca){return request(_0xf2e7('0x9'),{'account':_0x41ca8b,'message':_0xb9a5ca});}; \ No newline at end of file +var _0xe925=['request','then','error','message','sendMailMessage','bluebird','client','http'];(function(_0x35db70,_0x258f5b){var _0x2b9d62=function(_0x4be2ba){while(--_0x4be2ba){_0x35db70['push'](_0x35db70['shift']());}};_0x2b9d62(++_0x258f5b);}(_0xe925,0xcd));var _0x5e92=function(_0x458f8d,_0x45e3ec){_0x458f8d=_0x458f8d-0x0;var _0x52f3b0=_0xe925[_0x458f8d];return _0x52f3b0;};'use strict';var BPromise=require(_0x5e92('0x0'));var jayson=require('jayson/promise');var client=jayson[_0x5e92('0x1')][_0x5e92('0x2')]({'port':0x232b});function request(_0x5b4c0c,_0x2703e8){return new BPromise(function(_0x274744,_0x1397e1){return client[_0x5e92('0x3')](_0x5b4c0c,_0x2703e8)[_0x5e92('0x4')](function(_0x3bcc1f){if(_0x3bcc1f[_0x5e92('0x5')]){return _0x1397e1(_0x3bcc1f[_0x5e92('0x5')][_0x5e92('0x6')]);}else{return _0x274744(_0x3bcc1f['result']);}})['catch'](function(_0x2453c3){return _0x1397e1(_0x2453c3);});});}exports[_0x5e92('0x7')]=function(_0x1f4c25,_0x503ad7){return request('SendMail',{'account':_0x1f4c25,'message':_0x503ad7});}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index be107ce..69d027f 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 _0x16bf=['exports','stream','_localBuffer','_inBody','prototype','_transform','\x0d\x0a\x0d\x0a','toString','indexOf','substring','length','split','trim','slice','emit'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x16bf,0x178));var _0xf16b=function(_0x4239e1,_0x5d42b7){_0x4239e1=_0x4239e1-0x0;var _0x3610b2=_0x16bf[_0x4239e1];return _0x3610b2;};'use strict';var util=require('util');var Transform=require(_0xf16b('0x0'))['Transform'];function AGIReply(_0x2229cb){Transform['call'](this,_0x2229cb);this[_0xf16b('0x1')]='';this[_0xf16b('0x2')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0xf16b('0x3')][_0xf16b('0x4')]=function(_0x1cb7b6,_0x103901,_0x39c518){var _0x5e5802='\x0a',_0x418bf7=['\x0a\x0a',_0xf16b('0x5')],_0x9236a7=-0x1,_0x543f02=-0x1,_0x3337ce='',_0x2a2000=0x0,_0x2cff6f='',_0x275700='';this['_localBuffer']+=_0x1cb7b6[_0xf16b('0x6')]();_0x2cff6f=this[_0xf16b('0x1')];if(!this[_0xf16b('0x2')]){_0x2a2000=0x0;while(_0x418bf7[_0x2a2000]){while((_0x543f02=_0x2cff6f[_0xf16b('0x7')](_0x418bf7[_0x2a2000]))!=-0x1){_0x3337ce=_0x418bf7[_0x2a2000];_0x275700=_0x2cff6f['substring'](0x0,_0x543f02);_0x2cff6f=_0x2cff6f[_0xf16b('0x8')](_0x543f02+_0x3337ce[_0xf16b('0x9')]);var _0x1a6615=_0x275700[_0xf16b('0xa')](_0x5e5802),_0x2d3e3d=0x0,_0x25a640={},_0x370d85='',_0x2f76da='',_0x53040c=-0x1;while(_0x1a6615[_0x2d3e3d]){_0x53040c=_0x1a6615[_0x2d3e3d][_0xf16b('0x7')](':');if(_0x53040c!=-0x1){_0x370d85=_0x1a6615[_0x2d3e3d]['slice'](0x0,_0x53040c)[_0xf16b('0xb')]();_0x2f76da=_0x1a6615[_0x2d3e3d][_0xf16b('0xc')](_0x53040c+0x1)['trim']();if(_0x370d85['length']>0x0){_0x25a640[_0x370d85]=_0x2f76da;}}else{}_0x2d3e3d++;}this[_0xf16b('0xd')]('headers',_0x25a640);this[_0xf16b('0x2')]=!![];}_0x2a2000++;}this[_0xf16b('0x1')]=_0x2cff6f;}else{while((_0x9236a7=_0x2cff6f[_0xf16b('0x7')](_0x5e5802))!=-0x1){_0x275700=_0x2cff6f[_0xf16b('0x8')](0x0,_0x9236a7);this[_0xf16b('0xd')]('line',_0x275700);_0x2cff6f=_0x2cff6f['substring'](_0x9236a7+_0x5e5802['length']);}this[_0xf16b('0x1')]=_0x2cff6f;}_0x39c518();};module[_0xf16b('0xe')]=AGIReply; \ No newline at end of file +var _0x7f28=['_inBody','prototype','toString','indexOf','substring','length','split','slice','trim','headers','emit','line','exports','util','Transform','call','_localBuffer'];(function(_0x5bc6cb,_0x861f52){var _0x8a731a=function(_0x2d4d18){while(--_0x2d4d18){_0x5bc6cb['push'](_0x5bc6cb['shift']());}};_0x8a731a(++_0x861f52);}(_0x7f28,0x84));var _0x87f2=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x7f28[_0x432682];return _0x463d05;};'use strict';var util=require(_0x87f2('0x0'));var Transform=require('stream')[_0x87f2('0x1')];function AGIReply(_0x1b22f7){Transform[_0x87f2('0x2')](this,_0x1b22f7);this[_0x87f2('0x3')]='';this[_0x87f2('0x4')]=![];}util['inherits'](AGIReply,Transform);AGIReply[_0x87f2('0x5')]['_transform']=function(_0xc967b7,_0x35fb6a,_0x32b623){var _0x43d5b2='\x0a',_0x2ca2d3=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x5c3ec1=-0x1,_0x36e62b=-0x1,_0x217d05='',_0x3852c6=0x0,_0x587be3='',_0x58aa8e='';this['_localBuffer']+=_0xc967b7[_0x87f2('0x6')]();_0x587be3=this[_0x87f2('0x3')];if(!this[_0x87f2('0x4')]){_0x3852c6=0x0;while(_0x2ca2d3[_0x3852c6]){while((_0x36e62b=_0x587be3[_0x87f2('0x7')](_0x2ca2d3[_0x3852c6]))!=-0x1){_0x217d05=_0x2ca2d3[_0x3852c6];_0x58aa8e=_0x587be3[_0x87f2('0x8')](0x0,_0x36e62b);_0x587be3=_0x587be3['substring'](_0x36e62b+_0x217d05[_0x87f2('0x9')]);var _0x3a58bf=_0x58aa8e[_0x87f2('0xa')](_0x43d5b2),_0x453e78=0x0,_0x532dbe={},_0xb410f6='',_0x41e408='',_0x4242d6=-0x1;while(_0x3a58bf[_0x453e78]){_0x4242d6=_0x3a58bf[_0x453e78]['indexOf'](':');if(_0x4242d6!=-0x1){_0xb410f6=_0x3a58bf[_0x453e78][_0x87f2('0xb')](0x0,_0x4242d6)[_0x87f2('0xc')]();_0x41e408=_0x3a58bf[_0x453e78]['slice'](_0x4242d6+0x1)[_0x87f2('0xc')]();if(_0xb410f6['length']>0x0){_0x532dbe[_0xb410f6]=_0x41e408;}}else{}_0x453e78++;}this['emit'](_0x87f2('0xd'),_0x532dbe);this[_0x87f2('0x4')]=!![];}_0x3852c6++;}this[_0x87f2('0x3')]=_0x587be3;}else{while((_0x5c3ec1=_0x587be3[_0x87f2('0x7')](_0x43d5b2))!=-0x1){_0x58aa8e=_0x587be3[_0x87f2('0x8')](0x0,_0x5c3ec1);this[_0x87f2('0xe')](_0x87f2('0xf'),_0x58aa8e);_0x587be3=_0x587be3[_0x87f2('0x8')](_0x5c3ec1+_0x43d5b2[_0x87f2('0x9')]);}this[_0x87f2('0x3')]=_0x587be3;}_0x32b623();};module[_0x87f2('0x10')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index c1764bc..c63a88c 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 _0x58f0=['PauseUser','agentUnpause','UnpauseUser','agentLogout','LogoutUser','bluebird','moment','util','http','request','then','error','message','production','getMailAccountById','MailServerOut','Smtp','name','email','getSquareProjectById','ShowSquareProject','getVoiceQueueById','ShowVariable','dsn','getUserById','ShowTrunk','ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','CreateSquareRecording','createSquareMessage','createCmContact','getPauseById','agentLogin','LoginUser','agentPause'];(function(_0x41f08e,_0x2ef40f){var _0x1c3579=function(_0x42c01f){while(--_0x42c01f){_0x41f08e['push'](_0x41f08e['shift']());}};_0x1c3579(++_0x2ef40f);}(_0x58f0,0x163));var _0x058f=function(_0x114b67,_0x2d449a){_0x114b67=_0x114b67-0x0;var _0x665dbb=_0x58f0[_0x114b67];return _0x665dbb;};'use strict';var BPromise=require(_0x058f('0x0'));var moment=require(_0x058f('0x1'));var _=require('lodash');var util=require(_0x058f('0x2'));var jayson=require('jayson/promise');var client=jayson['client'][_0x058f('0x3')]({'port':0x2329});function request(_0x5526e1,_0xc782ab){return new BPromise(function(_0x25bc5b,_0x5073ba){return client[_0x058f('0x4')](_0x5526e1,_0xc782ab)[_0x058f('0x5')](function(_0x1a4827){if(_0x1a4827[_0x058f('0x6')]){return _0x5073ba(_0x1a4827[_0x058f('0x6')][_0x058f('0x7')]);}else{return _0x25bc5b(_0x1a4827['result']);}})['catch'](function(_0x2226e1){return _0x5073ba(_0x2226e1);});});}exports['getSquareProject']=function(_0x36270b){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x36270b},'attributes':[_0x058f('0x8')]}});};exports[_0x058f('0x9')]=function(_0x107f24){return request('ShowMailAccount',{'options':{'raw':![],'where':{'id':_0x107f24},'include':[{'model':_0x058f('0xa'),'as':_0x058f('0xb')}],'attributes':['id',_0x058f('0xc'),_0x058f('0xd')]}});};exports[_0x058f('0xe')]=function(_0x7c49f7){return request(_0x058f('0xf'),{'options':{'where':{'id':_0x7c49f7},'attributes':[_0x058f('0xc')]}});};exports[_0x058f('0x10')]=function(_0x17e501){return request('ShowVoiceQueue',{'options':{'where':{'id':_0x17e501},'attributes':[_0x058f('0xc')]}});};exports['getVariableById']=function(_0x46864c){return request(_0x058f('0x11'),{'options':{'where':{'id':_0x46864c},'attributes':[_0x058f('0xc')]}});};exports['getSquareOdbcById']=function(_0x16dfd3){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x16dfd3},'attributes':[_0x058f('0x12')]}});};exports[_0x058f('0x13')]=function(_0x18a0ef){return request('ShowUser',{'options':{'where':{'id':_0x18a0ef},'attributes':['name']}});};exports['getTrunkById']=function(_0x173429){return request(_0x058f('0x14'),{'options':{'where':{'id':_0x173429},'attributes':[_0x058f('0xc')]}});};exports['getSoundById']=function(_0x1d0b90){return request(_0x058f('0x15'),{'options':{'where':{'id':_0x1d0b90},'attributes':[_0x058f('0x16')]}});};exports[_0x058f('0x17')]=function(_0x24a469){return request(_0x058f('0x18'),{'options':{'raw':![],'where':{'id':_0x24a469},'include':[{'model':_0x058f('0x19'),'as':_0x058f('0x1a')}]}});};exports[_0x058f('0x1b')]=function(_0x3524dd){return request(_0x058f('0x1c'),{'options':{'where':{'id':_0x3524dd},'attributes':['id',_0x058f('0xc')]}});};exports[_0x058f('0x1d')]=function(_0x17e376){return request(_0x058f('0x1e'),{'body':_0x17e376});};exports[_0x058f('0x1f')]=function(_0x5b1b2d){return request(_0x058f('0x20'),{'body':_0x5b1b2d});};exports['createSquareReport']=function(_0x4265eb){return request(_0x058f('0x21'),{'body':_[_0x058f('0x22')](_0x4265eb,{'project_name':_0x4265eb[_0x058f('0x23')],'prev_project_name':_0x4265eb[_0x058f('0x24')]||'','is_subproject':_0x4265eb[_0x058f('0x24')]?!![]:![],'leaveAt':moment()[_0x058f('0x25')]('YYYY-MM-DD\x20HH:mm:ss')})});};exports['createSquareRecording']=function(_0x591415){return request(_0x058f('0x26'),{'body':_0x591415});};exports[_0x058f('0x27')]=function(_0x4ebffc){return request('CreateSquareMessage',{'body':_0x4ebffc});};exports[_0x058f('0x28')]=function(_0x388021){return request('ShowCmHopper',{'options':{'raw':![],'where':{'phone':_0x388021['phone'],'ListId':_0x388021['ListId']}}})['then'](function(_0x1f927a){if(_0x1f927a){return _0x1f927a;}return request('CreateCmContact',{'body':_0x388021});});};exports[_0x058f('0x29')]=function(_0x1f95de){return request('ShowPause',{'options':{'where':{'id':_0x1f95de},'attributes':['name']}});};exports[_0x058f('0x2a')]=function(_0x3dfcfc,_0x417c2b){return request(_0x058f('0x2b'),{'body':{'interface':_0x417c2b},'options':{'where':_0x3dfcfc}});};exports[_0x058f('0x2c')]=function(_0x1987f0,_0x26a0b6,_0x3e95fe){return request(_0x058f('0x2d'),{'body':{'type':_0x26a0b6,'uniqueid':_0x3e95fe},'options':{'where':_0x1987f0}});};exports[_0x058f('0x2e')]=function(_0xc69acb){return request(_0x058f('0x2f'),{'body':{},'options':{'where':_0xc69acb}});};exports[_0x058f('0x30')]=function(_0x27b6f2){return request(_0x058f('0x31'),{'body':{},'options':{'where':_0x27b6f2}});}; \ No newline at end of file +var _0xdf75=['Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','getTrunkById','ShowTrunk','ShowSound','save_name','getIntervalById','Interval','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','CreateSquareDetailsReport','createSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareMessage','CreateSquareMessage','createCmContact','ShowCmHopper','phone','ShowPause','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','bluebird','moment','lodash','util','client','http','request','then','error','message','result','catch','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount'];(function(_0x34933a,_0x327378){var _0x36abb4=function(_0x2d6814){while(--_0x2d6814){_0x34933a['push'](_0x34933a['shift']());}};_0x36abb4(++_0x327378);}(_0xdf75,0x98));var _0x5df7=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xdf75[_0x432682];return _0x463d05;};'use strict';var BPromise=require(_0x5df7('0x0'));var moment=require(_0x5df7('0x1'));var _=require(_0x5df7('0x2'));var util=require(_0x5df7('0x3'));var jayson=require('jayson/promise');var client=jayson[_0x5df7('0x4')][_0x5df7('0x5')]({'port':0x2329});function request(_0x1e2748,_0x2ce5e8){return new BPromise(function(_0x2b8095,_0x27986c){return client[_0x5df7('0x6')](_0x1e2748,_0x2ce5e8)[_0x5df7('0x7')](function(_0x30bf7e){if(_0x30bf7e['error']){return _0x27986c(_0x30bf7e[_0x5df7('0x8')][_0x5df7('0x9')]);}else{return _0x2b8095(_0x30bf7e[_0x5df7('0xa')]);}})[_0x5df7('0xb')](function(_0x1649fa){return _0x27986c(_0x1649fa);});});}exports[_0x5df7('0xc')]=function(_0x4c6ca9){return request(_0x5df7('0xd'),{'options':{'raw':![],'where':{'name':_0x4c6ca9},'attributes':['production']}});};exports[_0x5df7('0xe')]=function(_0x2c25be){return request(_0x5df7('0xf'),{'options':{'raw':![],'where':{'id':_0x2c25be},'include':[{'model':'MailServerOut','as':_0x5df7('0x10')}],'attributes':['id',_0x5df7('0x11'),_0x5df7('0x12')]}});};exports[_0x5df7('0x13')]=function(_0x564878){return request(_0x5df7('0xd'),{'options':{'where':{'id':_0x564878},'attributes':[_0x5df7('0x11')]}});};exports[_0x5df7('0x14')]=function(_0x2eef49){return request(_0x5df7('0x15'),{'options':{'where':{'id':_0x2eef49},'attributes':['name']}});};exports[_0x5df7('0x16')]=function(_0xc2ddf9){return request('ShowVariable',{'options':{'where':{'id':_0xc2ddf9},'attributes':[_0x5df7('0x11')]}});};exports[_0x5df7('0x17')]=function(_0x4f187c){return request(_0x5df7('0x18'),{'options':{'where':{'id':_0x4f187c},'attributes':[_0x5df7('0x19')]}});};exports[_0x5df7('0x1a')]=function(_0x4e96ac){return request(_0x5df7('0x1b'),{'options':{'where':{'id':_0x4e96ac},'attributes':[_0x5df7('0x11')]}});};exports[_0x5df7('0x1c')]=function(_0x1d6214){return request(_0x5df7('0x1d'),{'options':{'where':{'id':_0x1d6214},'attributes':['name']}});};exports['getSoundById']=function(_0x28b47e){return request(_0x5df7('0x1e'),{'options':{'where':{'id':_0x28b47e},'attributes':[_0x5df7('0x1f')]}});};exports[_0x5df7('0x20')]=function(_0x57f65a){return request('ShowInterval',{'options':{'raw':![],'where':{'id':_0x57f65a},'include':[{'model':_0x5df7('0x21'),'as':'Intervals'}]}});};exports[_0x5df7('0x22')]=function(_0x4afd91){return request(_0x5df7('0x23'),{'options':{'where':{'id':_0x4afd91},'attributes':['id',_0x5df7('0x11')]}});};exports[_0x5df7('0x24')]=function(_0xd3186c){return request(_0x5df7('0x25'),{'body':_0xd3186c});};exports['createSquareDetailsReport']=function(_0x22f89a){return request(_0x5df7('0x26'),{'body':_0x22f89a});};exports[_0x5df7('0x27')]=function(_0x296ef4){return request('CreateSquareReport',{'body':_[_0x5df7('0x28')](_0x296ef4,{'project_name':_0x296ef4[_0x5df7('0x29')],'prev_project_name':_0x296ef4[_0x5df7('0x2a')]||'','is_subproject':_0x296ef4[_0x5df7('0x2a')]?!![]:![],'leaveAt':moment()[_0x5df7('0x2b')](_0x5df7('0x2c'))})});};exports['createSquareRecording']=function(_0x992c25){return request('CreateSquareRecording',{'body':_0x992c25});};exports[_0x5df7('0x2d')]=function(_0x2b19f6){return request(_0x5df7('0x2e'),{'body':_0x2b19f6});};exports[_0x5df7('0x2f')]=function(_0x468cae){return request(_0x5df7('0x30'),{'options':{'raw':![],'where':{'phone':_0x468cae[_0x5df7('0x31')],'ListId':_0x468cae['ListId']}}})['then'](function(_0x217b84){if(_0x217b84){return _0x217b84;}return request('CreateCmContact',{'body':_0x468cae});});};exports['getPauseById']=function(_0x13ffad){return request(_0x5df7('0x32'),{'options':{'where':{'id':_0x13ffad},'attributes':[_0x5df7('0x11')]}});};exports['agentLogin']=function(_0x4c8601,_0x599d42){return request(_0x5df7('0x33'),{'body':{'interface':_0x599d42},'options':{'where':_0x4c8601}});};exports[_0x5df7('0x34')]=function(_0x385b0e,_0x57d2e4,_0x146af5){return request(_0x5df7('0x35'),{'body':{'type':_0x57d2e4,'uniqueid':_0x146af5},'options':{'where':_0x385b0e}});};exports['agentUnpause']=function(_0x1824f7){return request(_0x5df7('0x36'),{'body':{},'options':{'where':_0x1824f7}});};exports[_0x5df7('0x37')]=function(_0x38b74d){return request('LogoutUser',{'body':{},'options':{'where':_0x38b74d}});}; \ 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 5fd381c..b491d54 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 _0xf1c6=['exports','./polly','./lex'];(function(_0x913871,_0x3382ea){var _0x4ffdc2=function(_0x32ea2b){while(--_0x32ea2b){_0x913871['push'](_0x913871['shift']());}};_0x4ffdc2(++_0x3382ea);}(_0xf1c6,0xf4));var _0x6f1c=function(_0x210121,_0x2b4493){_0x210121=_0x210121-0x0;var _0x3508ec=_0xf1c6[_0x210121];return _0x3508ec;};var polly=require(_0x6f1c('0x0'));var lex=require(_0x6f1c('0x1'));module[_0x6f1c('0x2')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0x3e4d=['exports','./polly'];(function(_0x43425b,_0x22b5b9){var _0x25747f=function(_0x449117){while(--_0x449117){_0x43425b['push'](_0x43425b['shift']());}};_0x25747f(++_0x22b5b9);}(_0x3e4d,0x16d));var _0xd3e4=function(_0x57f112,_0x179447){_0x57f112=_0x57f112-0x0;var _0x310358=_0x3e4d[_0x57f112];return _0x310358;};var polly=require(_0xd3e4('0x0'));var lex=require('./lex');module[_0xd3e4('0x1')]={'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 070f12d..6b71f61 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 _0xaa88=['exports','./lib/api'];(function(_0x59c900,_0x19f9a5){var _0x59301f=function(_0x21ad1a){while(--_0x21ad1a){_0x59c900['push'](_0x59c900['shift']());}};_0x59301f(++_0x19f9a5);}(_0xaa88,0x137));var _0x8aa8=function(_0x32f6b9,_0x2d4aa9){_0x32f6b9=_0x32f6b9-0x0;var _0x267d52=_0xaa88[_0x32f6b9];return _0x267d52;};'use strict';var lex=require(_0x8aa8('0x0'));module[_0x8aa8('0x1')]=function(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4){return lex(_0x1643a6,_0x51c79b,_0x4aee38,_0x4ba9dd,_0x3a5b12,_0x43f7e4);}; \ No newline at end of file +var _0x55e0=['./lib/api','exports'];(function(_0x54e25f,_0x57a308){var _0x54025f=function(_0x157e3c){while(--_0x157e3c){_0x54e25f['push'](_0x54e25f['shift']());}};_0x54025f(++_0x57a308);}(_0x55e0,0xdc));var _0x055e=function(_0x31db1b,_0x579273){_0x31db1b=_0x31db1b-0x0;var _0x53115f=_0x55e0[_0x31db1b];return _0x53115f;};'use strict';var lex=require(_0x055e('0x0'));module[_0x055e('0x1')]=function(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5){return lex(_0x2e09a6,_0x414740,_0x5b82b9,_0x578882,_0x3a2ee6,_0x2d9bd5);}; \ 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 8a0c1d1..4c7cc88 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 _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x352f22,_0x84e43b){var _0x1d4361=function(_0x16a29c){while(--_0x16a29c){_0x352f22['push'](_0x352f22['shift']());}};_0x1d4361(++_0x84e43b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x4141cc,_0x3e9d17){var _0x2e96c7=function(_0x7e13f9){while(--_0x7e13f9){_0x4141cc['push'](_0x4141cc['shift']());}};_0x2e96c7(++_0x3e9d17);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3899d1,_0x4aa04c){_0x3899d1=_0x3899d1-0x0;var _0xeb4a7d=_0xa9e0[_0x3899d1];return _0xeb4a7d;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ 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 2c10460..5585d4a 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 _0xf6ec=['exports','./lib/api'];(function(_0x4057ec,_0x425f09){var _0xe062c=function(_0x4a9644){while(--_0x4a9644){_0x4057ec['push'](_0x4057ec['shift']());}};_0xe062c(++_0x425f09);}(_0xf6ec,0x183));var _0xcf6e=function(_0x586b6b,_0x5a125f){_0x586b6b=_0x586b6b-0x0;var _0x495762=_0xf6ec[_0x586b6b];return _0x495762;};'use strict';var polly=require(_0xcf6e('0x0'));module[_0xcf6e('0x1')]=function(_0x4f5647,_0x2e572f,_0x36f8f6,_0x135421,_0x573d99,_0x1a766a,_0x1e28d6){return polly(_0x4f5647,_0x2e572f,_0x36f8f6,_0x135421,_0x573d99,_0x1a766a,_0x1e28d6);}; \ No newline at end of file +var _0xac76=['exports'];(function(_0x4ed4d2,_0x47acf7){var _0x15ae2e=function(_0x3199f0){while(--_0x3199f0){_0x4ed4d2['push'](_0x4ed4d2['shift']());}};_0x15ae2e(++_0x47acf7);}(_0xac76,0xd6));var _0x6ac7=function(_0x4c1078,_0x279c61){_0x4c1078=_0x4c1078-0x0;var _0x164ffe=_0xac76[_0x4c1078];return _0x164ffe;};'use strict';var polly=require('./lib/api');module[_0x6ac7('0x0')]=function(_0x267d3a,_0x28598,_0x593b3a,_0x53e723,_0xff159f,_0x557eab,_0x2fc50f){return polly(_0x267d3a,_0x28598,_0x593b3a,_0x53e723,_0xff159f,_0x557eab,_0x2fc50f);}; \ 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 b7012e3..77d02f3 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 _0xdf81=['mp3','path','bluebird','randomstring','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','Polly','text'];(function(_0x1a316f,_0x2bcc36){var _0x4fe85d=function(_0x140abc){while(--_0x140abc){_0x1a316f['push'](_0x1a316f['shift']());}};_0x4fe85d(++_0x2bcc36);}(_0xdf81,0x157));var _0x1df8=function(_0x5627e1,_0x1b2dbf){_0x5627e1=_0x5627e1-0x0;var _0x2f013f=_0xdf81[_0x5627e1];return _0x2f013f;};'use strict';var fs=require('fs');var path=require(_0x1df8('0x0'));var BPromise=require(_0x1df8('0x1'));var rs=require(_0x1df8('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x3b104f,_0x201f14,_0x1669e8){return new BPromise(function(_0x176514,_0x78fb1c){_0x3b104f['synthesizeSpeech'](_0x201f14,function(_0x5164b6,_0x3c1125){if(_0x5164b6){_0x78fb1c(_0x5164b6);}else if(_0x3c1125){if(_0x3c1125['AudioStream']instanceof Buffer){fs[_0x1df8('0x3')](_0x1669e8,_0x3c1125['AudioStream'],function(_0x13d4d4){if(_0x13d4d4){_0x78fb1c(_0x13d4d4);}else{_0x176514();}});}else{_0x78fb1c(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x78fb1c(new Error(_0x1df8('0x4')));}});});}module[_0x1df8('0x5')]=function(_0x1003e9,_0x37b760,_0x5db2e0,_0x30c813,_0x50a8b1,_0xdcc82b,_0x1db0a9){var _0x4b4a2f=new AWS[(_0x1df8('0x6'))]({'accessKeyId':_0x1003e9,'secretAccessKey':_0x37b760,'region':_0x5db2e0});var _0x251a7b={'Text':_0x50a8b1,'TextType':_0xdcc82b||_0x1df8('0x7'),'OutputFormat':_0x1df8('0x8'),'VoiceId':_0x30c813};return pollyResult(_0x4b4a2f,_0x251a7b,_0x1db0a9);}; \ No newline at end of file +var _0x0892=['mp3','path','bluebird','randomstring','synthesizeSpeech','AudioStream','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text'];(function(_0x45e323,_0x58621e){var _0x38f1c0=function(_0x38071b){while(--_0x38071b){_0x45e323['push'](_0x45e323['shift']());}};_0x38f1c0(++_0x58621e);}(_0x0892,0xf3));var _0x2089=function(_0x5ccab2,_0x356497){_0x5ccab2=_0x5ccab2-0x0;var _0xa1a627=_0x0892[_0x5ccab2];return _0xa1a627;};'use strict';var fs=require('fs');var path=require(_0x2089('0x0'));var BPromise=require(_0x2089('0x1'));var rs=require(_0x2089('0x2'));var AWS=require('aws-sdk');function pollyResult(_0x4a03f2,_0x5f5b8b,_0x4bf8e9){return new BPromise(function(_0x510aba,_0x4779e5){_0x4a03f2[_0x2089('0x3')](_0x5f5b8b,function(_0x30e8c0,_0x2001ee){if(_0x30e8c0){_0x4779e5(_0x30e8c0);}else if(_0x2001ee){if(_0x2001ee[_0x2089('0x4')]instanceof Buffer){fs[_0x2089('0x5')](_0x4bf8e9,_0x2001ee[_0x2089('0x4')],function(_0x151513){if(_0x151513){_0x4779e5(_0x151513);}else{_0x510aba();}});}else{_0x4779e5(new Error(_0x2089('0x6')));}}else{_0x4779e5(new Error(_0x2089('0x7')));}});});}module[_0x2089('0x8')]=function(_0x3714fe,_0xcccb95,_0x4171d9,_0x5e77d1,_0x14d7a4,_0x3316a2,_0x183454){var _0x48c643=new AWS['Polly']({'accessKeyId':_0x3714fe,'secretAccessKey':_0xcccb95,'region':_0x4171d9});var _0x4a172a={'Text':_0x14d7a4,'TextType':_0x3316a2||_0x2089('0x9'),'OutputFormat':_0x2089('0xa'),'VoiceId':_0x5e77d1};return pollyResult(_0x48c643,_0x4a172a,_0x183454);}; \ 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 cee2a14..242a284 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 _0xc7dc=['./lib/api'];(function(_0x149f32,_0x4273f7){var _0x11f475=function(_0x18eeef){while(--_0x18eeef){_0x149f32['push'](_0x149f32['shift']());}};_0x11f475(++_0x4273f7);}(_0xc7dc,0xe1));var _0xcc7d=function(_0x48affa,_0x52ed60){_0x48affa=_0x48affa-0x0;var _0x4ee41d=_0xc7dc[_0x48affa];return _0x4ee41d;};'use strict';var asr=require(_0xcc7d('0x0'));module['exports']=function(_0x50dd86,_0xb4a896,_0x43b3c5,_0x27fcbd){return asr(_0x50dd86,_0xb4a896,_0x43b3c5);}; \ No newline at end of file +var _0x56b0=['exports'];(function(_0x1b5762,_0x2e592e){var _0x3e40aa=function(_0x3a6a32){while(--_0x3a6a32){_0x1b5762['push'](_0x1b5762['shift']());}};_0x3e40aa(++_0x2e592e);}(_0x56b0,0x9d));var _0x056b=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x56b0[_0x3dd15e];return _0x231fd0;};'use strict';var asr=require('./lib/api');module[_0x056b('0x0')]=function(_0x320445,_0x1e90d7,_0x56f619,_0x2f2069){return asr(_0x320445,_0x1e90d7,_0x56f619);}; \ 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 585457b..8b8b49f 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 _0x4a47=['base64','POST','/v1/speech:recognize?key=','LINEAR16','8000','url','bluebird','https://speech.googleapis.com','exports','length','filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','lang\x20should\x20be\x20a\x20string','readFileSync','toString'];(function(_0x2b699c,_0x50b891){var _0x54425f=function(_0x4c5941){while(--_0x4c5941){_0x2b699c['push'](_0x2b699c['shift']());}};_0x54425f(++_0x50b891);}(_0x4a47,0xb5));var _0x74a4=function(_0x4a05e7,_0x22f0df){_0x4a05e7=_0x4a05e7-0x0;var _0x126423=_0x4a47[_0x4a05e7];return _0x126423;};'use strict';var url=require(_0x74a4('0x0'));var BPromise=require(_0x74a4('0x1'));var fs=require('fs');var host=_0x74a4('0x2');module[_0x74a4('0x3')]=function(_0x43adbe,_0x54d63a,_0x24cff9){return new BPromise(function(_0x55c541,_0x2aa3d1){var _0x450c10;if(typeof _0x43adbe!=='string'||_0x43adbe[_0x74a4('0x4')]===0x0){return _0x2aa3d1(_0x74a4('0x5'));}if(typeof _0x54d63a!==_0x74a4('0x6')||_0x54d63a['length']===0x0){return _0x2aa3d1(_0x74a4('0x7'));}if(typeof _0x24cff9!=='undefined'&&(typeof _0x24cff9!==_0x74a4('0x6')||_0x24cff9['length']===0x0)){return _0x2aa3d1(_0x74a4('0x8'));}try{_0x450c10=fs[_0x74a4('0x9')](_0x43adbe)[_0x74a4('0xa')](_0x74a4('0xb'));}catch(_0x56a17a){return _0x2aa3d1(_0x56a17a);}return _0x55c541({'method':_0x74a4('0xc'),'uri':host+_0x74a4('0xd')+_0x54d63a,'body':{'config':{'encoding':_0x74a4('0xe'),'sampleRateHertz':_0x74a4('0xf'),'languageCode':_0x24cff9},'audio':{'content':_0x450c10}},'json':!![]});});}; \ No newline at end of file +var _0xb0d9=['filepath\x20should\x20be\x20a\x20string','string','key\x20should\x20be\x20a\x20string','undefined','lang\x20should\x20be\x20a\x20string','base64','/v1/speech:recognize?key=','LINEAR16','url','bluebird','https://speech.googleapis.com','exports','length'];(function(_0x3479fb,_0x55137f){var _0x3e8d4f=function(_0xfa755f){while(--_0xfa755f){_0x3479fb['push'](_0x3479fb['shift']());}};_0x3e8d4f(++_0x55137f);}(_0xb0d9,0x10c));var _0x9b0d=function(_0x3b6fa7,_0x25f608){_0x3b6fa7=_0x3b6fa7-0x0;var _0x47197d=_0xb0d9[_0x3b6fa7];return _0x47197d;};'use strict';var url=require(_0x9b0d('0x0'));var BPromise=require(_0x9b0d('0x1'));var fs=require('fs');var host=_0x9b0d('0x2');module[_0x9b0d('0x3')]=function(_0x23ff60,_0x168bd9,_0x595212){return new BPromise(function(_0x201946,_0x5dd128){var _0x4d327a;if(typeof _0x23ff60!=='string'||_0x23ff60[_0x9b0d('0x4')]===0x0){return _0x5dd128(_0x9b0d('0x5'));}if(typeof _0x168bd9!==_0x9b0d('0x6')||_0x168bd9[_0x9b0d('0x4')]===0x0){return _0x5dd128(_0x9b0d('0x7'));}if(typeof _0x595212!==_0x9b0d('0x8')&&(typeof _0x595212!==_0x9b0d('0x6')||_0x595212[_0x9b0d('0x4')]===0x0)){return _0x5dd128(_0x9b0d('0x9'));}try{_0x4d327a=fs['readFileSync'](_0x23ff60)['toString'](_0x9b0d('0xa'));}catch(_0x76dc19){return _0x5dd128(_0x76dc19);}return _0x201946({'method':'POST','uri':host+_0x9b0d('0xb')+_0x168bd9,'body':{'config':{'encoding':_0x9b0d('0xc'),'sampleRateHertz':'8000','languageCode':_0x595212},'audio':{'content':_0x4d327a}},'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 71e1e2f..796ffc5 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 _0x3d80=['./asr','exports'];(function(_0x1cc8fe,_0x105328){var _0x230054=function(_0x1a1b56){while(--_0x1a1b56){_0x1cc8fe['push'](_0x1cc8fe['shift']());}};_0x230054(++_0x105328);}(_0x3d80,0x1ec));var _0x03d8=function(_0x4427e8,_0x3e4a3d){_0x4427e8=_0x4427e8-0x0;var _0x5a053a=_0x3d80[_0x4427e8];return _0x5a053a;};var asr=require(_0x03d8('0x0'));module[_0x03d8('0x1')]={'asr':asr}; \ No newline at end of file +var _0x8006=['exports'];(function(_0x382a96,_0x355b26){var _0x17d1ee=function(_0x484fe4){while(--_0x484fe4){_0x382a96['push'](_0x382a96['shift']());}};_0x17d1ee(++_0x355b26);}(_0x8006,0x119));var _0x6800=function(_0x1b6eaa,_0x5baa2c){_0x1b6eaa=_0x1b6eaa-0x0;var _0x1f565a=_0x8006[_0x1b6eaa];return _0x1f565a;};var asr=require('./asr');module[_0x6800('0x0')]={'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 9dfa634..e1111b6 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 _0x0f7f=['Data','audiofile','dirName','apiai-promise','bluebird','dialogflow','querystring','request-promise','randomstring','google-tts-api','url','parse','./aws','./sestek','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','path','WHAT_EVER','get','statusCode','error','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','finish\x20download\x20file','unlink','download\x20error','pipe','end','host','request\x20to\x20','transcode','wav','error\x20convert','info','finish\x20to\x20convert','resolve','tmp','generate','.wav','writeFileSync','base64','then','chmodSync','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','voice','audioConfig','MP3','text:synthesize','POST','.mp3','audioContent','writeFile','777','split','googleTTS','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','stringify','null','slice','parse\x20response\x20failed:\x0a','data','lang\x20\x22','\x22\x20might\x20not\x20exist','asr','results','map','alternatives','transcript','join','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','resolvedQuery','action','actionIncomplete','score','status','code','metadata','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','queryResult','allRequiredParamsPresent','fields','diagnosticInfo','end_conversation','boolValue','fulfillmentText','intent','displayName','isFallback','languageCode','responseId','intentDetectionConfidence','tildeASR','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','confidence','awsPolly','polly','awsLex','lex','ispeechTTS','ispeechASR','format','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','model=%s','freeform=3','nda','text','CustomAction','channelData','AudioFromTts'];(function(_0x5a0d19,_0x55381f){var _0x404289=function(_0x4de3de){while(--_0x4de3de){_0x5a0d19['push'](_0x5a0d19['shift']());}};_0x404289(++_0x55381f);}(_0x0f7f,0x111));var _0xf0f7=function(_0x2f6615,_0x423ba7){_0x2f6615=_0x2f6615-0x0;var _0x7aa1dc=_0x0f7f[_0x2f6615];return _0x7aa1dc;};'use strict';var apiai=require(_0xf0f7('0x0'));var BPromise=require(_0xf0f7('0x1'));var dialogflow=require(_0xf0f7('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require('md5');var path=require('path');var querystring=require(_0xf0f7('0x3'));var rp=require(_0xf0f7('0x4'));var rs=require(_0xf0f7('0x5'));var sox=require('sox');var tts=require(_0xf0f7('0x6'));var urlParse=require(_0xf0f7('0x7'))[_0xf0f7('0x8')];var util=require('util');var aws=require(_0xf0f7('0x9'));var google=require('./google');var sestek=require(_0xf0f7('0xa'));var tilde=require('./tilde');var logger=require(_0xf0f7('0xb'))(_0xf0f7('0xc'));var ISPEECH_API=_0xf0f7('0xd');function downloadFile(_0xcea7fc,_0x20580f){return new BPromise(function(_0x12aaad,_0x2d80aa){var _0x581185=urlParse(_0xcea7fc);var _0x8cfce1=_0x581185[_0xf0f7('0xe')]===_0xf0f7('0xf')?https:http;var _0x2481d3={'host':_0x581185['host'],'path':_0x581185[_0xf0f7('0x10')],'headers':{'user-agent':_0xf0f7('0x11')}};_0x8cfce1[_0xf0f7('0x12')](_0x2481d3,function(_0x12a9ea){if(_0x12a9ea[_0xf0f7('0x13')]!==0xc8){logger[_0xf0f7('0x14')]('request\x20to\x20'+_0xcea7fc+_0xf0f7('0x15')+_0x12a9ea['statusCode']+'\x20('+_0x12a9ea['statusMessage']+')');_0x2d80aa(new Error('request\x20to\x20'+_0xcea7fc+_0xf0f7('0x15')+_0x12a9ea[_0xf0f7('0x13')]+'\x20('+_0x12a9ea['statusMessage']+')'));return;}var _0x13f935=fs[_0xf0f7('0x16')](_0x20580f);_0x13f935['on'](_0xf0f7('0x17'),function(){logger['info'](_0xf0f7('0x18'));_0x13f935['close'](_0x12aaad);});_0x13f935['on']('error',function(_0x1cf707){fs[_0xf0f7('0x19')](_0x20580f);logger[_0xf0f7('0x14')](_0xf0f7('0x1a'),_0x1cf707);_0x2d80aa(_0x1cf707);});_0x12a9ea[_0xf0f7('0x1b')](_0x13f935);})['on']('error',function(_0x446c39){logger['error'](_0x446c39);_0x2d80aa(_0x446c39);})[_0xf0f7('0x1c')]();});}function uploadFile(_0x38079d){return new BPromise(function(_0x5d39c0,_0x2b269b){var _0x5a1dac=urlParse(_0x38079d);var _0x44b9ef=_0x5a1dac[_0xf0f7('0xe')]==='https:'?https:http;var _0x2656c7={'host':_0x5a1dac[_0xf0f7('0x1d')],'path':_0x5a1dac[_0xf0f7('0x10')],'headers':{'user-agent':_0xf0f7('0x11')}};_0x44b9ef[_0xf0f7('0x12')](_0x2656c7,function(_0x49b14d){if(_0x49b14d[_0xf0f7('0x13')]!==0xc8){_0x2b269b(new Error(_0xf0f7('0x1e')+_0x38079d+_0xf0f7('0x15')+_0x49b14d['statusCode']+'\x20('+_0x49b14d['statusMessage']+')'));return;}var _0x2b1412='';_0x49b14d['on']('data',function(_0xa6f14c){_0x2b1412+=_0xa6f14c;});_0x49b14d['on'](_0xf0f7('0x1c'),function(){_0x5d39c0(_0x2b1412);});})['on'](_0xf0f7('0x14'),function(_0x173a59){_0x2b269b(_0x173a59);})[_0xf0f7('0x1c')]();});}function convertFile(_0x2fed5a,_0x62c642){return new BPromise(function(_0x8fd5de,_0x27eb54){var _0x24bb95=sox[_0xf0f7('0x1f')](_0x2fed5a,_0x62c642,{'sampleRate':0x1f40,'format':_0xf0f7('0x20'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x24bb95['on']('error',function(_0x452cc6){logger[_0xf0f7('0x14')](_0xf0f7('0x21'),_0x452cc6);_0x27eb54(_0x452cc6);});_0x24bb95['on'](_0xf0f7('0x1c'),function(){logger[_0xf0f7('0x22')](_0xf0f7('0x23'));_0x8fd5de();});_0x24bb95['start']();});}function base64Decode(_0x3bcffe,_0xfb02ad){var _0x5d5632=path[_0xf0f7('0x24')](__dirname,_0xf0f7('0x25'),rs[_0xf0f7('0x26')](0x4)+_0xf0f7('0x27'));fs[_0xf0f7('0x28')](_0x5d5632,_0x3bcffe,_0xf0f7('0x29'));return convertFile(_0x5d5632,_0xfb02ad)[_0xf0f7('0x2a')](function(){try{fs['unlink'](_0x5d5632);fs[_0xf0f7('0x2b')](_0xfb02ad,'777');}catch(_0x7f7eaf){logger[_0xf0f7('0x14')](_0x7f7eaf);}return _0xfb02ad['split']('.')[0x0];});}function base64Encode(_0x4af6e7){var _0x58aadf=fs[_0xf0f7('0x2c')](_0x4af6e7);return new Buffer(_0x58aadf)[_0xf0f7('0x2d')](_0xf0f7('0x29'));}exports[_0xf0f7('0x2e')]=function(_0x3f0233,_0x53ec7d,_0x54ffed,_0x908bd6,_0xccd6c3,_0x39ae3a){var _0x2cb56c,_0x438ffd;var _0x21507b=_0xf0f7('0x2f');var _0x2a8770=_0xf0f7('0x30')+_0x3f0233;var _0x27c4aa={};if(_0x53ec7d===_0xf0f7('0x31')){_0x27c4aa['input']={'ssml':_0x54ffed};}else{_0x27c4aa['input']={'text':_0x54ffed};};_0x27c4aa[_0xf0f7('0x32')]={'languageCode':_0x908bd6,'ssmlGender':_0xccd6c3};_0x27c4aa[_0xf0f7('0x33')]={'audioEncoding':_0xf0f7('0x34'),'sampleRateHertz':0x1f40};var _0x17c6d7={'url':_0x21507b+_0xf0f7('0x35')+_0x2a8770,'method':_0xf0f7('0x36'),'json':!![],'body':_0x27c4aa};return rp(_0x17c6d7)[_0xf0f7('0x2a')](function(_0x447651){return new BPromise(function(_0x2409aa,_0x5911df){_0x2cb56c=path[_0xf0f7('0x24')](__dirname,_0xf0f7('0x25'),rs[_0xf0f7('0x26')](0x4)+_0xf0f7('0x37'));var _0x3539b6=Buffer['from'](_0x447651[_0xf0f7('0x38')],_0xf0f7('0x29'));return fs[_0xf0f7('0x39')](_0x2cb56c,_0x3539b6,function(_0x35020c){_0x5911df(_0x35020c);},function(_0x1dcab2){fs[_0xf0f7('0x2b')](_0x2cb56c,_0xf0f7('0x3a'));_0x2409aa(_0x1dcab2);});});})[_0xf0f7('0x2a')](function(_0x327773){_0x438ffd=path['resolve'](__dirname,'tmp',rs[_0xf0f7('0x26')](0x4)+_0xf0f7('0x27'));return convertFile(_0x2cb56c,_0x438ffd);})['then'](function(){try{fs[_0xf0f7('0x19')](_0x2cb56c);fs[_0xf0f7('0x2b')](_0x438ffd,'777');}catch(_0x2417dd){logger[_0xf0f7('0x14')](_0x2417dd);}logger[_0xf0f7('0x22')]('googleCloudTTS\x20path',_0x438ffd[_0xf0f7('0x3b')]('.')[0x0]);return _0x438ffd[_0xf0f7('0x3b')]('.')[0x0];});};exports[_0xf0f7('0x3c')]=function(_0x45a20b,_0x425ef3){var _0x3241a3=_0xf0f7('0x3d');var _0x26bb6e,_0x4ce1ce;var _0x11de33;var _0x62bd2a={'encoding':_0xf0f7('0x3e'),'method':_0xf0f7('0x36'),'timeout':0x2710,'url':_0x3241a3,'headers':{'Content-Type':_0xf0f7('0x3f')},'body':'f.req='+encodeURIComponent(JSON[_0xf0f7('0x40')]([[['jQ1olc',JSON[_0xf0f7('0x40')]([_0x45a20b,_0x425ef3||'en',![],_0xf0f7('0x41')]),null,'generic']]]))};return rp(_0x62bd2a)[_0xf0f7('0x2a')](function(_0x182bdf){try{_0x11de33=eval(_0x182bdf[_0xf0f7('0x42')](0x5))[0x0][0x2];}catch(_0x688bd2){throw new Error(_0xf0f7('0x43')+_0x182bdf[_0xf0f7('0x44')]);}if(!_0x11de33){if(_0x45a20b['length']>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0xf0f7('0x45')+_0x425ef3+_0xf0f7('0x46'));}}try{_0x11de33=eval(_0x11de33)[0x0];}catch(_0x5d7505){throw new Error(_0xf0f7('0x43')+res['data']);}const _0x56b154=_0x11de33;_0x26bb6e=path[_0xf0f7('0x24')](__dirname,'tmp',rs['generate'](0x4)+_0xf0f7('0x37'));fs[_0xf0f7('0x28')](_0x26bb6e,_0x11de33,{'encoding':_0xf0f7('0x29')});_0x4ce1ce=path[_0xf0f7('0x24')](__dirname,_0xf0f7('0x25'),rs[_0xf0f7('0x26')](0x4)+'.wav');return convertFile(_0x26bb6e,_0x4ce1ce);})[_0xf0f7('0x2a')](function(){try{fs['unlink'](_0x26bb6e);fs[_0xf0f7('0x2b')](_0x4ce1ce,_0xf0f7('0x3a'));}catch(_0x4e30ca){logger['error'](_0x4e30ca);}logger['info']('goggleTTS\x20path',_0x4ce1ce['split']('.')[0x0]);return _0x4ce1ce[_0xf0f7('0x3b')]('.')[0x0];});};exports['googleASR']=function(_0x1d89ab,_0x582bf6,_0x5ad7c0){return google[_0xf0f7('0x47')](_0x1d89ab,_0x582bf6,_0x5ad7c0)['then'](function(_0x21021b){logger[_0xf0f7('0x22')](_0x21021b['uri']);return rp(_0x21021b);})[_0xf0f7('0x2a')](function(_0x24ecc3){var _0x556581='';var _0x574e4e=0x0;try{fs[_0xf0f7('0x19')](_0x1d89ab);}catch(_0x4b4f2b){logger[_0xf0f7('0x14')](_0x4b4f2b);}if(_0x24ecc3&&_0x24ecc3['results']){_0x556581=_0x24ecc3[_0xf0f7('0x48')][_0xf0f7('0x49')](function(_0x1b2461){return _0x1b2461&&_0x1b2461[_0xf0f7('0x4a')][0x0]&&_0x1b2461[_0xf0f7('0x4a')][0x0][_0xf0f7('0x4b')]?_0x1b2461[_0xf0f7('0x4a')][0x0]['transcript']:'';})['join']('\x0a');_0x574e4e=_0x24ecc3[_0xf0f7('0x48')][_0xf0f7('0x49')](function(_0x38ca8d){return _0x38ca8d&&_0x38ca8d['alternatives'][0x0]&&_0x38ca8d[_0xf0f7('0x4a')][0x0]['confidence']?_0x38ca8d['alternatives'][0x0]['confidence']:0x0;})[_0xf0f7('0x4c')]('\x0a');}logger[_0xf0f7('0x22')](_0xf0f7('0x4d'),_0x556581);logger[_0xf0f7('0x22')](_0xf0f7('0x4e'),_0x574e4e);return{'transcript':_0x556581,'confidence':_0x574e4e};})[_0xf0f7('0x4f')](function(_0x47588e){logger[_0xf0f7('0x14')](_0xf0f7('0x50'),_0x47588e[_0xf0f7('0x13')],_0x47588e[_0xf0f7('0x51')],_0x47588e[_0xf0f7('0x52')]);});};exports[_0xf0f7('0x53')]=function(_0xf7fc53,_0x22bcc0,_0x1c39c9,_0x1644a0){var _0x394942=apiai(_0x22bcc0,{'language':_0x1644a0||'en'});return _0x394942[_0xf0f7('0x54')](_0x1c39c9,{'sessionId':md5(_0xf7fc53)})[_0xf0f7('0x2a')](function(_0x564ee0){logger[_0xf0f7('0x22')](JSON['stringify'](_0x564ee0));return{'source':_0x564ee0[_0xf0f7('0x55')]['source'],'resolvedQuery':_0x564ee0['result'][_0xf0f7('0x56')],'action':_0x564ee0['result'][_0xf0f7('0x57')],'actionIncomplete':_0x564ee0['result'][_0xf0f7('0x58')],'speech':_0x564ee0[_0xf0f7('0x55')]['fulfillment']['speech'],'score':_0x564ee0['result'][_0xf0f7('0x59')],'statusCode':_0x564ee0[_0xf0f7('0x5a')][_0xf0f7('0x5b')],'endConversation':_0x564ee0[_0xf0f7('0x55')][_0xf0f7('0x5c')]['endConversation']||![],'isFallbackIntent':_0x564ee0[_0xf0f7('0x55')]['metadata'][_0xf0f7('0x5d')]};});};exports[_0xf0f7('0x5e')]=function(_0x544280,_0x529ca3,_0x572493,_0x8e1262,_0x48f678,_0x5eed52){var _0x6db49=_0x8e1262[_0xf0f7('0x5f')](/\\n/g,'\x0a');var _0x5733a1={'credentials':{'private_key':_0x6db49,'client_email':_0x572493}};var _0x365e2e=new dialogflow[(_0xf0f7('0x60'))](_0x5733a1);var _0x1b02d6=_0x365e2e[_0xf0f7('0x61')](_0x529ca3,md5(_0x544280));var _0x3a491={'session':_0x1b02d6,'queryInput':{'text':{'text':_0x48f678,'languageCode':_0x5eed52}}};return _0x365e2e[_0xf0f7('0x62')](_0x3a491)[_0xf0f7('0x2a')](function(_0x56d24d){if(_0x56d24d&&_0x56d24d[_0xf0f7('0x63')]){logger['info']('Dialogflow\x20V2\x20response:',JSON[_0xf0f7('0x40')](_0x56d24d));var _0x279a7f=_0x56d24d[0x0];if(_0x279a7f){var _0x243365={'action':_0x279a7f[_0xf0f7('0x64')]['action'],'allRequiredParamsPresent':_0x279a7f['queryResult'][_0xf0f7('0x65')],'endConversation':_0x279a7f[_0xf0f7('0x64')]['diagnosticInfo']&&_0x279a7f[_0xf0f7('0x64')]['diagnosticInfo'][_0xf0f7('0x66')]?_0x279a7f[_0xf0f7('0x64')][_0xf0f7('0x67')][_0xf0f7('0x66')][_0xf0f7('0x68')][_0xf0f7('0x69')]:![],'fulfillmentText':_0x279a7f[_0xf0f7('0x64')][_0xf0f7('0x6a')],'intentName':_0x279a7f[_0xf0f7('0x64')][_0xf0f7('0x6b')][_0xf0f7('0x51')],'intentDisplayName':_0x279a7f[_0xf0f7('0x64')]['intent'][_0xf0f7('0x6c')],'isFallbackIntent':_0x279a7f['queryResult'][_0xf0f7('0x6b')][_0xf0f7('0x6d')],'languageCode':_0x279a7f[_0xf0f7('0x64')][_0xf0f7('0x6e')],'queryText':_0x279a7f[_0xf0f7('0x64')]['queryText'],'responseId':_0x279a7f[_0xf0f7('0x6f')],'score':_0x279a7f[_0xf0f7('0x64')][_0xf0f7('0x70')],'speech':_0x279a7f[_0xf0f7('0x64')][_0xf0f7('0x6a')],'providerResponse':JSON[_0xf0f7('0x40')](_0x56d24d)};return _0x243365;}}});};exports[_0xf0f7('0x71')]=function(_0x556564,_0x3ecffa,_0x56112b,_0x2a6775){return tilde[_0xf0f7('0x47')](_0x556564,_0x3ecffa,_0x56112b,_0x2a6775)[_0xf0f7('0x2a')](function(_0x2d1a0b){try{fs[_0xf0f7('0x19')](_0x556564);}catch(_0x2f0162){logger['error'](_0x2f0162);}logger['info'](_0xf0f7('0x72'),_0x2d1a0b[_0xf0f7('0x4b')]);logger[_0xf0f7('0x22')](_0xf0f7('0x73'),_0x2d1a0b[_0xf0f7('0x74')]);return _0x2d1a0b;});};exports[_0xf0f7('0x75')]=function(_0x66cc33,_0x46403d,_0x338faa,_0x829ee1,_0x5152be,_0x3b0dbf){var _0x5e7631=path['resolve'](__dirname,'tmp',rs[_0xf0f7('0x26')](0x4)+_0xf0f7('0x37'));var _0x49ef16;return aws[_0xf0f7('0x76')](_0x66cc33,_0x46403d,_0x338faa,_0x829ee1,_0x5152be,_0x3b0dbf,_0x5e7631)[_0xf0f7('0x2a')](function(){_0x49ef16=path[_0xf0f7('0x24')](__dirname,'tmp',rs[_0xf0f7('0x26')](0x4)+'.wav');return convertFile(_0x5e7631,_0x49ef16);})[_0xf0f7('0x2a')](function(){try{fs[_0xf0f7('0x19')](_0x5e7631);fs[_0xf0f7('0x2b')](_0x49ef16,_0xf0f7('0x3a'));}catch(_0x51da13){logger[_0xf0f7('0x14')](_0x51da13);}return _0x49ef16['split']('.')[0x0];});};exports[_0xf0f7('0x77')]=function(_0x3b2954,_0x2e6671,_0x268369,_0x55f4b1,_0x3e0855,_0x5f3a77){return aws[_0xf0f7('0x78')](_0x3b2954,_0x2e6671,_0x268369,_0x55f4b1,_0x3e0855,_0x5f3a77)[_0xf0f7('0x2a')](function(_0x1fa54f){logger['info'](JSON['stringify'](_0x1fa54f));return _0x1fa54f;});};exports[_0xf0f7('0x79')]=function(_0x2a5266,_0x37a818,_0x1b3417,_0x52a07b){var _0x2076f7=util['format']('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x2a5266,encodeURIComponent(_0x37a818),_0x1b3417,_0x52a07b);var _0x5564a8=path[_0xf0f7('0x24')](__dirname,_0xf0f7('0x25'),rs[_0xf0f7('0x26')](0x4)+_0xf0f7('0x37'));var _0x2f4ad2;return downloadFile(_0x2076f7,_0x5564a8)[_0xf0f7('0x2a')](function(){_0x2f4ad2=path[_0xf0f7('0x24')](__dirname,'tmp',rs[_0xf0f7('0x26')](0x4)+_0xf0f7('0x27'));return convertFile(_0x5564a8,_0x2f4ad2);})['then'](function(){try{fs[_0xf0f7('0x19')](_0x5564a8);fs[_0xf0f7('0x2b')](_0x2f4ad2,'777');}catch(_0x1ffee1){logger[_0xf0f7('0x14')](_0x1ffee1);}return _0x2f4ad2[_0xf0f7('0x3b')]('.')[0x0];});};exports[_0xf0f7('0x7a')]=function(_0x521cb3,_0x2fa926,_0x42a541,_0x1f0dfc){var _0x237c4c=util[_0xf0f7('0x7b')](_0xf0f7('0x7c'),ISPEECH_API,_0x2fa926,_0x42a541,base64Encode(_0x521cb3),_0x1f0dfc?util[_0xf0f7('0x7b')](_0xf0f7('0x7d'),encodeURIComponent(_0x1f0dfc)):_0xf0f7('0x7e'));return uploadFile(_0x237c4c)[_0xf0f7('0x2a')](function(_0x395892){return querystring[_0xf0f7('0x8')](_0x395892);});};exports['sestekNDA']=function(_0x249125,_0x531af7){return sestek[_0xf0f7('0x7f')](_0x249125,_0x531af7)[_0xf0f7('0x2a')](function(_0x34725b){logger[_0xf0f7('0x22')](JSON[_0xf0f7('0x40')](_0x34725b));var _0x527424={'speech':_0x34725b[_0xf0f7('0x80')],'action':_0x34725b['channelData']?_0x34725b['channelData'][_0xf0f7('0x81')]:undefined,'actiondata':_0x34725b['channelData']?_0x34725b[_0xf0f7('0x82')]['CustomActionData']:undefined};if(_0x34725b[_0xf0f7('0x82')]&&_0x34725b[_0xf0f7('0x82')]['AudioFromTts']){return base64Decode(_0x34725b[_0xf0f7('0x82')][_0xf0f7('0x83')][_0xf0f7('0x84')],path['resolve'](__dirname,_0xf0f7('0x25'),rs[_0xf0f7('0x26')](0x4)+_0xf0f7('0x27')))[_0xf0f7('0x2a')](function(_0x158159){_0x527424[_0xf0f7('0x85')]=_0x158159;return _0x527424;});}return _0x527424;});};exports[_0xf0f7('0x86')]=function(){return __dirname;}; \ No newline at end of file +var _0x3483=['MP3','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','POST','application/x-www-form-urlencoded','f.req=','stringify','null','generic','slice','parse\x20response\x20failed:\x0a','data','length','lang\x20\x22','\x22\x20might\x20not\x20exist','.mp3','uri','results','map','alternatives','transcript','join','confidence','googleASR\x20transcription','googleASR\x20confidence','catch','[%s]\x20%s:%s','message','googleDialogflow','textRequest','source','result','resolvedQuery','action','actionIncomplete','speech','score','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','fulfillmentText','intent','name','languageCode','queryText','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','polly','awsLex','lex','ispeechTTS','format','ispeechASR','freeform=3','nda','text','channelData','CustomAction','AudioFromTts','Data','audiofile','dirName','apiai-promise','dialogflow','md5','path','querystring','request-promise','randomstring','google-tts-api','url','parse','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','protocol','https:','host','WHAT_EVER','get','error','request\x20to\x20','\x20failed,\x20status\x20code\x20=\x20','statusCode','statusMessage','createWriteStream','finish','info','finish\x20download\x20file','pipe','end','transcode','wav','error\x20convert','finish\x20to\x20convert','start','resolve','tmp','generate','.wav','writeFileSync','base64','then','unlink','chmodSync','777','split','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','ssml','input','audioConfig'];(function(_0x48168a,_0xf9dfe5){var _0x346d98=function(_0x22e41f){while(--_0x22e41f){_0x48168a['push'](_0x48168a['shift']());}};_0x346d98(++_0xf9dfe5);}(_0x3483,0xd2));var _0x3348=function(_0x21a64b,_0x5d3053){_0x21a64b=_0x21a64b-0x0;var _0x37e612=_0x3483[_0x21a64b];return _0x37e612;};'use strict';var apiai=require(_0x3348('0x0'));var BPromise=require('bluebird');var dialogflow=require(_0x3348('0x1'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require(_0x3348('0x2'));var path=require(_0x3348('0x3'));var querystring=require(_0x3348('0x4'));var rp=require(_0x3348('0x5'));var rs=require(_0x3348('0x6'));var sox=require('sox');var tts=require(_0x3348('0x7'));var urlParse=require(_0x3348('0x8'))[_0x3348('0x9')];var util=require(_0x3348('0xa'));var aws=require(_0x3348('0xb'));var google=require(_0x3348('0xc'));var sestek=require(_0x3348('0xd'));var tilde=require(_0x3348('0xe'));var logger=require(_0x3348('0xf'))(_0x3348('0x10'));var ISPEECH_API=_0x3348('0x11');function downloadFile(_0xe3f12d,_0x3b8564){return new BPromise(function(_0xa56425,_0xb51a67){var _0x1ead5c=urlParse(_0xe3f12d);var _0x48f053=_0x1ead5c[_0x3348('0x12')]===_0x3348('0x13')?https:http;var _0x18a043={'host':_0x1ead5c[_0x3348('0x14')],'path':_0x1ead5c[_0x3348('0x3')],'headers':{'user-agent':_0x3348('0x15')}};_0x48f053[_0x3348('0x16')](_0x18a043,function(_0x3e71f1){if(_0x3e71f1['statusCode']!==0xc8){logger[_0x3348('0x17')](_0x3348('0x18')+_0xe3f12d+_0x3348('0x19')+_0x3e71f1[_0x3348('0x1a')]+'\x20('+_0x3e71f1['statusMessage']+')');_0xb51a67(new Error(_0x3348('0x18')+_0xe3f12d+_0x3348('0x19')+_0x3e71f1['statusCode']+'\x20('+_0x3e71f1[_0x3348('0x1b')]+')'));return;}var _0x3cd282=fs[_0x3348('0x1c')](_0x3b8564);_0x3cd282['on'](_0x3348('0x1d'),function(){logger[_0x3348('0x1e')](_0x3348('0x1f'));_0x3cd282['close'](_0xa56425);});_0x3cd282['on'](_0x3348('0x17'),function(_0xdad683){fs['unlink'](_0x3b8564);logger['error']('download\x20error',_0xdad683);_0xb51a67(_0xdad683);});_0x3e71f1[_0x3348('0x20')](_0x3cd282);})['on'](_0x3348('0x17'),function(_0x5ae396){logger[_0x3348('0x17')](_0x5ae396);_0xb51a67(_0x5ae396);})[_0x3348('0x21')]();});}function uploadFile(_0x7b6e54){return new BPromise(function(_0x43daa2,_0x4d55b4){var _0x1187e9=urlParse(_0x7b6e54);var _0x412c26=_0x1187e9[_0x3348('0x12')]===_0x3348('0x13')?https:http;var _0x4cc7be={'host':_0x1187e9['host'],'path':_0x1187e9[_0x3348('0x3')],'headers':{'user-agent':_0x3348('0x15')}};_0x412c26['get'](_0x4cc7be,function(_0x9d9d8c){if(_0x9d9d8c['statusCode']!==0xc8){_0x4d55b4(new Error(_0x3348('0x18')+_0x7b6e54+'\x20failed,\x20status\x20code\x20=\x20'+_0x9d9d8c[_0x3348('0x1a')]+'\x20('+_0x9d9d8c[_0x3348('0x1b')]+')'));return;}var _0x89f063='';_0x9d9d8c['on']('data',function(_0x3f090b){_0x89f063+=_0x3f090b;});_0x9d9d8c['on'](_0x3348('0x21'),function(){_0x43daa2(_0x89f063);});})['on'](_0x3348('0x17'),function(_0x10afa8){_0x4d55b4(_0x10afa8);})[_0x3348('0x21')]();});}function convertFile(_0xac8fe2,_0xe0e71b){return new BPromise(function(_0x51593c,_0x36655b){var _0x296c48=sox[_0x3348('0x22')](_0xac8fe2,_0xe0e71b,{'sampleRate':0x1f40,'format':_0x3348('0x23'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x296c48['on'](_0x3348('0x17'),function(_0x582cf8){logger[_0x3348('0x17')](_0x3348('0x24'),_0x582cf8);_0x36655b(_0x582cf8);});_0x296c48['on'](_0x3348('0x21'),function(){logger['info'](_0x3348('0x25'));_0x51593c();});_0x296c48[_0x3348('0x26')]();});}function base64Decode(_0x46686c,_0x146db6){var _0x3cf949=path[_0x3348('0x27')](__dirname,_0x3348('0x28'),rs[_0x3348('0x29')](0x4)+_0x3348('0x2a'));fs[_0x3348('0x2b')](_0x3cf949,_0x46686c,_0x3348('0x2c'));return convertFile(_0x3cf949,_0x146db6)[_0x3348('0x2d')](function(){try{fs[_0x3348('0x2e')](_0x3cf949);fs[_0x3348('0x2f')](_0x146db6,_0x3348('0x30'));}catch(_0x216d19){logger[_0x3348('0x17')](_0x216d19);}return _0x146db6[_0x3348('0x31')]('.')[0x0];});}function base64Encode(_0x4baba9){var _0x52f72d=fs[_0x3348('0x32')](_0x4baba9);return new Buffer(_0x52f72d)[_0x3348('0x33')](_0x3348('0x2c'));}exports[_0x3348('0x34')]=function(_0x3e563d,_0x24193a,_0x12ee4e,_0x36c815,_0x44b65c,_0x5736e8){var _0x587a32,_0x1fb5a2;var _0x12a88f=_0x3348('0x35');var _0x36bff4=_0x3348('0x36')+_0x3e563d;var _0xc3d66e={};if(_0x24193a===_0x3348('0x37')){_0xc3d66e[_0x3348('0x38')]={'ssml':_0x12ee4e};}else{_0xc3d66e['input']={'text':_0x12ee4e};};_0xc3d66e['voice']={'languageCode':_0x36c815,'ssmlGender':_0x44b65c};_0xc3d66e[_0x3348('0x39')]={'audioEncoding':_0x3348('0x3a'),'sampleRateHertz':0x1f40};var _0x5d894b={'url':_0x12a88f+'text:synthesize'+_0x36bff4,'method':'POST','json':!![],'body':_0xc3d66e};return rp(_0x5d894b)[_0x3348('0x2d')](function(_0x1dfb8f){return new BPromise(function(_0x3d3620,_0x438238){_0x587a32=path[_0x3348('0x27')](__dirname,_0x3348('0x28'),rs[_0x3348('0x29')](0x4)+'.mp3');var _0x3ef25e=Buffer[_0x3348('0x3b')](_0x1dfb8f[_0x3348('0x3c')],_0x3348('0x2c'));return fs[_0x3348('0x3d')](_0x587a32,_0x3ef25e,function(_0x2e0994){_0x438238(_0x2e0994);},function(_0xcb74fa){fs[_0x3348('0x2f')](_0x587a32,_0x3348('0x30'));_0x3d3620(_0xcb74fa);});});})[_0x3348('0x2d')](function(_0x112dce){_0x1fb5a2=path[_0x3348('0x27')](__dirname,_0x3348('0x28'),rs['generate'](0x4)+'.wav');return convertFile(_0x587a32,_0x1fb5a2);})['then'](function(){try{fs[_0x3348('0x2e')](_0x587a32);fs[_0x3348('0x2f')](_0x1fb5a2,_0x3348('0x30'));}catch(_0xa9dbe8){logger[_0x3348('0x17')](_0xa9dbe8);}logger[_0x3348('0x1e')](_0x3348('0x3e'),_0x1fb5a2[_0x3348('0x31')]('.')[0x0]);return _0x1fb5a2[_0x3348('0x31')]('.')[0x0];});};exports['googleTTS']=function(_0xa6568c,_0x68ab2f){var _0x188fa6=_0x3348('0x3f');var _0x3d34d9,_0x1c3647;var _0x3aeb2b;var _0x5b392a={'encoding':_0x3348('0x40'),'method':_0x3348('0x41'),'timeout':0x2710,'url':_0x188fa6,'headers':{'Content-Type':_0x3348('0x42')},'body':_0x3348('0x43')+encodeURIComponent(JSON[_0x3348('0x44')]([[['jQ1olc',JSON[_0x3348('0x44')]([_0xa6568c,_0x68ab2f||'en',![],_0x3348('0x45')]),null,_0x3348('0x46')]]]))};return rp(_0x5b392a)['then'](function(_0x3c1c10){try{_0x3aeb2b=eval(_0x3c1c10[_0x3348('0x47')](0x5))[0x0][0x2];}catch(_0x433772){throw new Error(_0x3348('0x48')+_0x3c1c10[_0x3348('0x49')]);}if(!_0x3aeb2b){if(_0xa6568c[_0x3348('0x4a')]>0xc8){throw new Error('text\x20length\x20limit\x20reached');}else{throw new Error(_0x3348('0x4b')+_0x68ab2f+_0x3348('0x4c'));}}try{_0x3aeb2b=eval(_0x3aeb2b)[0x0];}catch(_0x281257){throw new Error(_0x3348('0x48')+res[_0x3348('0x49')]);}const _0x588608=_0x3aeb2b;_0x3d34d9=path[_0x3348('0x27')](__dirname,_0x3348('0x28'),rs['generate'](0x4)+_0x3348('0x4d'));fs[_0x3348('0x2b')](_0x3d34d9,_0x3aeb2b,{'encoding':'base64'});_0x1c3647=path[_0x3348('0x27')](__dirname,'tmp',rs[_0x3348('0x29')](0x4)+_0x3348('0x2a'));return convertFile(_0x3d34d9,_0x1c3647);})[_0x3348('0x2d')](function(){try{fs[_0x3348('0x2e')](_0x3d34d9);fs[_0x3348('0x2f')](_0x1c3647,_0x3348('0x30'));}catch(_0x543547){logger['error'](_0x543547);}logger[_0x3348('0x1e')]('goggleTTS\x20path',_0x1c3647['split']('.')[0x0]);return _0x1c3647[_0x3348('0x31')]('.')[0x0];});};exports['googleASR']=function(_0xf06737,_0x4e98ea,_0x2335a7){return google['asr'](_0xf06737,_0x4e98ea,_0x2335a7)[_0x3348('0x2d')](function(_0x29a2f1){logger[_0x3348('0x1e')](_0x29a2f1[_0x3348('0x4e')]);return rp(_0x29a2f1);})['then'](function(_0x52c4c2){var _0x3aeb47='';var _0x325e72=0x0;try{fs[_0x3348('0x2e')](_0xf06737);}catch(_0x5a01f4){logger[_0x3348('0x17')](_0x5a01f4);}if(_0x52c4c2&&_0x52c4c2[_0x3348('0x4f')]){_0x3aeb47=_0x52c4c2[_0x3348('0x4f')][_0x3348('0x50')](function(_0x3edb47){return _0x3edb47&&_0x3edb47[_0x3348('0x51')][0x0]&&_0x3edb47[_0x3348('0x51')][0x0][_0x3348('0x52')]?_0x3edb47['alternatives'][0x0][_0x3348('0x52')]:'';})[_0x3348('0x53')]('\x0a');_0x325e72=_0x52c4c2[_0x3348('0x4f')]['map'](function(_0x58f7a5){return _0x58f7a5&&_0x58f7a5[_0x3348('0x51')][0x0]&&_0x58f7a5[_0x3348('0x51')][0x0]['confidence']?_0x58f7a5[_0x3348('0x51')][0x0][_0x3348('0x54')]:0x0;})[_0x3348('0x53')]('\x0a');}logger[_0x3348('0x1e')](_0x3348('0x55'),_0x3aeb47);logger[_0x3348('0x1e')](_0x3348('0x56'),_0x325e72);return{'transcript':_0x3aeb47,'confidence':_0x325e72};})[_0x3348('0x57')](function(_0x12df44){logger[_0x3348('0x17')](_0x3348('0x58'),_0x12df44[_0x3348('0x1a')],_0x12df44['name'],_0x12df44[_0x3348('0x59')]);});};exports[_0x3348('0x5a')]=function(_0x3e55c6,_0x47f5b7,_0x26c99d,_0x2d3a48){var _0x1f049c=apiai(_0x47f5b7,{'language':_0x2d3a48||'en'});return _0x1f049c[_0x3348('0x5b')](_0x26c99d,{'sessionId':md5(_0x3e55c6)})[_0x3348('0x2d')](function(_0x5c895d){logger[_0x3348('0x1e')](JSON[_0x3348('0x44')](_0x5c895d));return{'source':_0x5c895d['result'][_0x3348('0x5c')],'resolvedQuery':_0x5c895d[_0x3348('0x5d')][_0x3348('0x5e')],'action':_0x5c895d[_0x3348('0x5d')][_0x3348('0x5f')],'actionIncomplete':_0x5c895d['result'][_0x3348('0x60')],'speech':_0x5c895d['result']['fulfillment'][_0x3348('0x61')],'score':_0x5c895d[_0x3348('0x5d')][_0x3348('0x62')],'statusCode':_0x5c895d['status']['code'],'endConversation':_0x5c895d[_0x3348('0x5d')][_0x3348('0x63')][_0x3348('0x64')]||![],'isFallbackIntent':_0x5c895d[_0x3348('0x5d')][_0x3348('0x63')][_0x3348('0x65')]};});};exports[_0x3348('0x66')]=function(_0x404d80,_0x1fe90f,_0x55235a,_0x6f9ed4,_0x4238b8,_0x447f59){var _0x197e78=_0x6f9ed4[_0x3348('0x67')](/\\n/g,'\x0a');var _0x2fa6fe={'credentials':{'private_key':_0x197e78,'client_email':_0x55235a}};var _0x578e43=new dialogflow[(_0x3348('0x68'))](_0x2fa6fe);var _0x1ad1fc=_0x578e43['sessionPath'](_0x1fe90f,md5(_0x404d80));var _0x334694={'session':_0x1ad1fc,'queryInput':{'text':{'text':_0x4238b8,'languageCode':_0x447f59}}};return _0x578e43['detectIntent'](_0x334694)[_0x3348('0x2d')](function(_0x1fcc9d){if(_0x1fcc9d&&_0x1fcc9d[_0x3348('0x4a')]){logger['info'](_0x3348('0x69'),JSON[_0x3348('0x44')](_0x1fcc9d));var _0x384e5b=_0x1fcc9d[0x0];if(_0x384e5b){var _0x486c79={'action':_0x384e5b['queryResult'][_0x3348('0x5f')],'allRequiredParamsPresent':_0x384e5b[_0x3348('0x6a')][_0x3348('0x6b')],'endConversation':_0x384e5b['queryResult'][_0x3348('0x6c')]&&_0x384e5b[_0x3348('0x6a')][_0x3348('0x6c')][_0x3348('0x6d')]?_0x384e5b[_0x3348('0x6a')][_0x3348('0x6c')][_0x3348('0x6d')]['end_conversation'][_0x3348('0x6e')]:![],'fulfillmentText':_0x384e5b[_0x3348('0x6a')][_0x3348('0x6f')],'intentName':_0x384e5b['queryResult'][_0x3348('0x70')][_0x3348('0x71')],'intentDisplayName':_0x384e5b[_0x3348('0x6a')][_0x3348('0x70')]['displayName'],'isFallbackIntent':_0x384e5b[_0x3348('0x6a')][_0x3348('0x70')]['isFallback'],'languageCode':_0x384e5b['queryResult'][_0x3348('0x72')],'queryText':_0x384e5b[_0x3348('0x6a')][_0x3348('0x73')],'responseId':_0x384e5b['responseId'],'score':_0x384e5b[_0x3348('0x6a')]['intentDetectionConfidence'],'speech':_0x384e5b[_0x3348('0x6a')][_0x3348('0x6f')],'providerResponse':JSON['stringify'](_0x1fcc9d)};return _0x486c79;}}});};exports['tildeASR']=function(_0x275961,_0x3b4615,_0x3921ab,_0x47e32b){return tilde[_0x3348('0x74')](_0x275961,_0x3b4615,_0x3921ab,_0x47e32b)['then'](function(_0x4a46a7){try{fs[_0x3348('0x2e')](_0x275961);}catch(_0x4d0303){logger[_0x3348('0x17')](_0x4d0303);}logger[_0x3348('0x1e')](_0x3348('0x75'),_0x4a46a7[_0x3348('0x52')]);logger[_0x3348('0x1e')](_0x3348('0x76'),_0x4a46a7['confidence']);return _0x4a46a7;});};exports['awsPolly']=function(_0x403809,_0x4ca899,_0x8b6ec2,_0x2a783a,_0x2ec715,_0x5818c3){var _0x219ea3=path[_0x3348('0x27')](__dirname,_0x3348('0x28'),rs[_0x3348('0x29')](0x4)+_0x3348('0x4d'));var _0x3f36bd;return aws[_0x3348('0x77')](_0x403809,_0x4ca899,_0x8b6ec2,_0x2a783a,_0x2ec715,_0x5818c3,_0x219ea3)[_0x3348('0x2d')](function(){_0x3f36bd=path['resolve'](__dirname,'tmp',rs[_0x3348('0x29')](0x4)+'.wav');return convertFile(_0x219ea3,_0x3f36bd);})['then'](function(){try{fs[_0x3348('0x2e')](_0x219ea3);fs[_0x3348('0x2f')](_0x3f36bd,_0x3348('0x30'));}catch(_0x325349){logger['error'](_0x325349);}return _0x3f36bd[_0x3348('0x31')]('.')[0x0];});};exports[_0x3348('0x78')]=function(_0x378918,_0x132ae8,_0x55f4c3,_0x1e4e81,_0x5762f7,_0x163db7){return aws[_0x3348('0x79')](_0x378918,_0x132ae8,_0x55f4c3,_0x1e4e81,_0x5762f7,_0x163db7)[_0x3348('0x2d')](function(_0xec7c0b){logger[_0x3348('0x1e')](JSON['stringify'](_0xec7c0b));return _0xec7c0b;});};exports[_0x3348('0x7a')]=function(_0x35422e,_0x4599ef,_0x43b497,_0x11c07e){var _0x4442c9=util[_0x3348('0x7b')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x35422e,encodeURIComponent(_0x4599ef),_0x43b497,_0x11c07e);var _0xdb6b97=path['resolve'](__dirname,_0x3348('0x28'),rs[_0x3348('0x29')](0x4)+'.mp3');var _0x584d58;return downloadFile(_0x4442c9,_0xdb6b97)[_0x3348('0x2d')](function(){_0x584d58=path[_0x3348('0x27')](__dirname,_0x3348('0x28'),rs[_0x3348('0x29')](0x4)+'.wav');return convertFile(_0xdb6b97,_0x584d58);})[_0x3348('0x2d')](function(){try{fs['unlink'](_0xdb6b97);fs[_0x3348('0x2f')](_0x584d58,_0x3348('0x30'));}catch(_0x23d1bf){logger['error'](_0x23d1bf);}return _0x584d58[_0x3348('0x31')]('.')[0x0];});};exports[_0x3348('0x7c')]=function(_0x2f249a,_0x41170a,_0x17864f,_0x592fac){var _0x38ed5c=util[_0x3348('0x7b')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x41170a,_0x17864f,base64Encode(_0x2f249a),_0x592fac?util['format']('model=%s',encodeURIComponent(_0x592fac)):_0x3348('0x7d'));return uploadFile(_0x38ed5c)[_0x3348('0x2d')](function(_0x2685b0){return querystring[_0x3348('0x9')](_0x2685b0);});};exports['sestekNDA']=function(_0x5bd5ba,_0x2665ab){return sestek[_0x3348('0x7e')](_0x5bd5ba,_0x2665ab)[_0x3348('0x2d')](function(_0x26f6c9){logger[_0x3348('0x1e')](JSON[_0x3348('0x44')](_0x26f6c9));var _0x3930ad={'speech':_0x26f6c9[_0x3348('0x7f')],'action':_0x26f6c9[_0x3348('0x80')]?_0x26f6c9[_0x3348('0x80')][_0x3348('0x81')]:undefined,'actiondata':_0x26f6c9['channelData']?_0x26f6c9['channelData']['CustomActionData']:undefined};if(_0x26f6c9[_0x3348('0x80')]&&_0x26f6c9[_0x3348('0x80')][_0x3348('0x82')]){return base64Decode(_0x26f6c9[_0x3348('0x80')][_0x3348('0x82')][_0x3348('0x83')],path[_0x3348('0x27')](__dirname,_0x3348('0x28'),rs[_0x3348('0x29')](0x4)+_0x3348('0x2a')))[_0x3348('0x2d')](function(_0x7fa365){_0x3930ad[_0x3348('0x84')]=_0x7fa365;return _0x3930ad;});}return _0x3930ad;});};exports[_0x3348('0x85')]=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 0ea6899..1e7e311 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 _0x72eb=['./nda','exports'];(function(_0x34e9df,_0x297e62){var _0x1b04cb=function(_0x5dee0a){while(--_0x5dee0a){_0x34e9df['push'](_0x34e9df['shift']());}};_0x1b04cb(++_0x297e62);}(_0x72eb,0x1f4));var _0xb72e=function(_0x1af0b7,_0x4e1239){_0x1af0b7=_0x1af0b7-0x0;var _0x151a55=_0x72eb[_0x1af0b7];return _0x151a55;};var nda=require(_0xb72e('0x0'));module[_0xb72e('0x1')]={'nda':nda}; \ No newline at end of file +var _0xf311=['exports'];(function(_0x358b53,_0xb4f9bf){var _0x300236=function(_0x2caa20){while(--_0x2caa20){_0x358b53['push'](_0x358b53['shift']());}};_0x300236(++_0xb4f9bf);}(_0xf311,0x1c8));var _0x1f31=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0xf311[_0x59ee6f];return _0x4c0979;};var nda=require('./nda');module[_0x1f31('0x0')]={'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 2624d2a..c8b27b7 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 _0xefe3=['POST','ndassistant_url','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','text','Bearer\x20','access_token','project','body','channelData','ProjectName','ndagenerate_audio','audio/wav','custom_action','custom_action_data','info','stringify','request-promise','exports','resolve','/token','username','password','then'];(function(_0x4cfbc4,_0x50dfeb){var _0x338447=function(_0x58774b){while(--_0x58774b){_0x4cfbc4['push'](_0x4cfbc4['shift']());}};_0x338447(++_0x50dfeb);}(_0xefe3,0xf5));var _0x3efe=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xefe3[_0x20a584];return _0x4b41a8;};'use strict';var rp=require(_0x3efe('0x0'));var url=require('url');var logger=require('../../../../../config/logger')('agi');module[_0x3efe('0x1')]=function(_0xcd5959,_0x28c2d6){var _0x31dfff={'method':'POST','uri':url[_0x3efe('0x2')](_0x28c2d6['ndauth_url'],_0x3efe('0x3')),'form':{'grant_type':'password','username':_0x28c2d6[_0x3efe('0x4')],'password':_0x28c2d6[_0x3efe('0x5')]},'json':!![]};return rp(_0x31dfff)[_0x3efe('0x6')](function(_0x195d5d){var _0x30d2e8={'method':_0x3efe('0x7'),'uri':url['resolve'](_0x28c2d6[_0x3efe('0x8')],'/api/NaturalDialogAssistant/v1/Run'),'body':{'type':_0x28c2d6[_0x3efe('0x9')]||_0x3efe('0xa'),'channelId':_0x3efe('0xb'),'conversation':{'id':_0xcd5959[_0x3efe('0xc')]},'from':{'id':_0xcd5959[_0x3efe('0xd')],'name':_0xcd5959[_0x3efe('0xe')]},'recipient':{'id':_0xcd5959['dnid'],'name':_0xcd5959['extension']},'text':_0x28c2d6[_0x3efe('0xf')],'channelData':{}},'headers':{'Authorization':_0x3efe('0x10')+_0x195d5d[_0x3efe('0x11')]},'json':!![]};if(_0x28c2d6[_0x3efe('0x12')]){_0x30d2e8[_0x3efe('0x13')][_0x3efe('0x14')][_0x3efe('0x15')]=_0x28c2d6[_0x3efe('0x12')];}if(_0x28c2d6[_0x3efe('0x16')]=='1'){_0x30d2e8[_0x3efe('0x13')][_0x3efe('0x14')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x3efe('0x17')};}if(_0x28c2d6[_0x3efe('0x18')]){_0x30d2e8[_0x3efe('0x13')][_0x3efe('0x14')]['CustomAction']=_0x28c2d6[_0x3efe('0x18')];if(_0x28c2d6[_0x3efe('0x19')]){_0x30d2e8[_0x3efe('0x13')]['channelData']['CustomActionData']=_0x28c2d6[_0x3efe('0x19')];}}logger[_0x3efe('0x1a')](JSON[_0x3efe('0x1b')](_0x30d2e8));return rp(_0x30d2e8);});}; \ No newline at end of file +var _0x6be1=['AudioOutputSettings','custom_action','custom_action_data','CustomActionData','info','stringify','request-promise','url','POST','resolve','ndauth_url','/token','password','username','then','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','Bearer\x20','access_token','body','channelData','ProjectName','project','ndagenerate_audio'];(function(_0x257983,_0x4d3987){var _0x3c2e2f=function(_0x20de9e){while(--_0x20de9e){_0x257983['push'](_0x257983['shift']());}};_0x3c2e2f(++_0x4d3987);}(_0x6be1,0x12f));var _0x16be=function(_0x4de7b6,_0x41d616){_0x4de7b6=_0x4de7b6-0x0;var _0x320651=_0x6be1[_0x4de7b6];return _0x320651;};'use strict';var rp=require(_0x16be('0x0'));var url=require(_0x16be('0x1'));var logger=require('../../../../../config/logger')('agi');module['exports']=function(_0x55a2b9,_0x15a4a9){var _0x688136={'method':_0x16be('0x2'),'uri':url[_0x16be('0x3')](_0x15a4a9[_0x16be('0x4')],_0x16be('0x5')),'form':{'grant_type':_0x16be('0x6'),'username':_0x15a4a9[_0x16be('0x7')],'password':_0x15a4a9[_0x16be('0x6')]},'json':!![]};return rp(_0x688136)[_0x16be('0x8')](function(_0x4eaedb){var _0x36438c={'method':_0x16be('0x2'),'uri':url[_0x16be('0x3')](_0x15a4a9[_0x16be('0x9')],_0x16be('0xa')),'body':{'type':_0x15a4a9[_0x16be('0xb')]||_0x16be('0xc'),'channelId':_0x16be('0xd'),'conversation':{'id':_0x55a2b9[_0x16be('0xe')]},'from':{'id':_0x55a2b9[_0x16be('0xf')],'name':_0x55a2b9[_0x16be('0x10')]},'recipient':{'id':_0x55a2b9[_0x16be('0x11')],'name':_0x55a2b9[_0x16be('0x12')]},'text':_0x15a4a9[_0x16be('0x13')],'channelData':{}},'headers':{'Authorization':_0x16be('0x14')+_0x4eaedb[_0x16be('0x15')]},'json':!![]};if(_0x15a4a9['project']){_0x36438c[_0x16be('0x16')][_0x16be('0x17')][_0x16be('0x18')]=_0x15a4a9[_0x16be('0x19')];}if(_0x15a4a9[_0x16be('0x1a')]=='1'){_0x36438c['body'][_0x16be('0x17')][_0x16be('0x1b')]={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x15a4a9[_0x16be('0x1c')]){_0x36438c['body']['channelData']['CustomAction']=_0x15a4a9[_0x16be('0x1c')];if(_0x15a4a9[_0x16be('0x1d')]){_0x36438c[_0x16be('0x16')]['channelData'][_0x16be('0x1e')]=_0x15a4a9['custom_action_data'];}}logger[_0x16be('0x1f')](JSON[_0x16be('0x20')](_0x36438c));return rp(_0x36438c);});}; \ 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 614722b..b1c6be4 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 _0xb445=['exports'];(function(_0x21017a,_0x57f5c5){var _0x561a74=function(_0x471f05){while(--_0x471f05){_0x21017a['push'](_0x21017a['shift']());}};_0x561a74(++_0x57f5c5);}(_0xb445,0xe0));var _0x5b44=function(_0x1a0a9b,_0x375ec6){_0x1a0a9b=_0x1a0a9b-0x0;var _0x57305b=_0xb445[_0x1a0a9b];return _0x57305b;};'use strict';var asr=require('./lib/api');module[_0x5b44('0x0')]=function(_0x14077c,_0x4bdecb,_0x189aab,_0x50f076){return asr(_0x14077c,_0x4bdecb,_0x189aab,_0x50f076);}; \ No newline at end of file +var _0xa9ec=['./lib/api','exports'];(function(_0x4102ef,_0x39db75){var _0x1585b5=function(_0x43f642){while(--_0x43f642){_0x4102ef['push'](_0x4102ef['shift']());}};_0x1585b5(++_0x39db75);}(_0xa9ec,0x148));var _0xca9e=function(_0x1d90cd,_0x1d2745){_0x1d90cd=_0x1d90cd-0x0;var _0x81bbac=_0xa9ec[_0x1d90cd];return _0x81bbac;};'use strict';var asr=require(_0xca9e('0x0'));module[_0xca9e('0x1')]=function(_0x20d280,_0x44fa47,_0x4e6894,_0x35e974){return asr(_0x20d280,_0x44fa47,_0x4e6894,_0x35e974);}; \ 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 4d9b4b2..78fb991 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 _0x6b53=['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','createHash','sha1','update','hex','Open\x20Tilde\x20ASR\x20socket','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','final','Tilde\x20ASR\x20hypoteses','result','hypotheses','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x6b53,0xfb));var _0x36b5=function(_0x215cd1,_0x52fec8){_0x215cd1=_0x215cd1-0x0;var _0x2870ee=_0x6b53[_0x215cd1];return _0x2870ee;};'use strict';var BPromise=require(_0x36b5('0x0'));var _=require(_0x36b5('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x36b5('0x2'));var crypto=require(_0x36b5('0x3'));var logger=require(_0x36b5('0x4'))(_0x36b5('0x5'));module[_0x36b5('0x6')]=function(_0x3d5d95,_0x3ce8dc,_0x262023,_0x113605){return new BPromise(function(_0x471e19,_0x4dc237){logger[_0x36b5('0x7')](_0x36b5('0x8'),_0x113605||_0x36b5('0x9'));var _0x1d88d5=new WebSocket(_0x113605||'wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE',{'perMessageDeflate':![]});var _0x4dc02b='';var _0x3e64be='0';var _0x3dc242='1';var _0x2b6277=_0x36b5('0xa');function _0x1226b9(_0xcb1477){var _0x9d240b=crypto[_0x36b5('0xb')](_0x36b5('0xc'));_0x9d240b[_0x36b5('0xd')](_0xcb1477);return _0x9d240b['digest'](_0x36b5('0xe'));}function _0xf652ab(){try{logger[_0x36b5('0x7')](_0x36b5('0xf'));var _0x59844e=moment()['unix']();var _0x4e857c=_0x1226b9(_0x59844e+_0x3ce8dc+_0x262023);_0x1d88d5[_0x36b5('0x10')](JSON[_0x36b5('0x11')]({'appID':_0x3ce8dc,'timestamp':_0x59844e,'appKey':_0x4e857c}));var _0x1974e2=fs[_0x36b5('0x12')](_0x3d5d95);_0x1974e2['on'](_0x36b5('0x13'),function(_0x48e577){_0x1d88d5[_0x36b5('0x10')](_0x48e577);});_0x1974e2['on'](_0x36b5('0x14'),function(){_0x1d88d5[_0x36b5('0x10')](_0x36b5('0x15'));});}catch(_0x5d1454){logger[_0x36b5('0x16')](_0x36b5('0x17'),JSON[_0x36b5('0x11')](_0x5d1454));_0x1d88d5[_0x36b5('0x18')]();}}function _0x449909(_0x8200ca){try{if(_0x8200ca){var _0x46f6f1=JSON[_0x36b5('0x19')](_0x8200ca);switch(_0x46f6f1[_0x36b5('0x1a')]){case 0x0:if(_0x46f6f1['result']){if(_0x46f6f1['result'][_0x36b5('0x1b')]){logger[_0x36b5('0x7')](_0x36b5('0x1c'),JSON[_0x36b5('0x11')](_0x46f6f1[_0x36b5('0x1d')]['hypotheses']));_0x4dc02b=_0x46f6f1['result'][_0x36b5('0x1e')][0x0]['transcript'];_0x3e64be=_0x46f6f1['result'][_0x36b5('0x1e')][0x0][_0x36b5('0x1f')];_0x3dc242='0';_0x2b6277=_0x36b5('0x20');_0x1d88d5['terminate']();}}break;case 0x1:logger['info'](_0x36b5('0xa'));_0x3dc242='1';_0x2b6277=_0x36b5('0xa');break;case 0x2:logger[_0x36b5('0x7')](_0x36b5('0x21'));_0x3dc242='2';_0x2b6277=_0x36b5('0x21');break;case 0x9:logger[_0x36b5('0x7')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x3dc242='9';_0x2b6277='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x36b5('0x7')](_0x36b5('0x22'));_0x3dc242='10';_0x2b6277=_0x36b5('0x22');break;case 0xb:logger[_0x36b5('0x7')]('All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.');_0x3dc242='11';_0x2b6277=_0x36b5('0x23');}}}catch(_0x20e7ca){logger[_0x36b5('0x16')](_0x36b5('0x24'),JSON[_0x36b5('0x11')](_0x20e7ca));_0x1d88d5['terminate']();}}function _0x510888(){logger[_0x36b5('0x7')](_0x36b5('0x25'));_0x471e19({'transcript':_0x4dc02b,'confidence':_0x3e64be,'status':_0x3dc242,'status_message':_0x2b6277});}function _0x50c793(_0x383035){logger[_0x36b5('0x16')](_0x36b5('0x26'));if(!_[_0x36b5('0x27')](_0x383035)){logger[_0x36b5('0x16')](_[_0x36b5('0x28')](_0x383035)?JSON['stringify'](_0x383035):_0x383035);}}_0x1d88d5['on'](_0x36b5('0x29'),_0xf652ab);_0x1d88d5['on'](_0x36b5('0x2a'),_0x449909);_0x1d88d5['on'](_0x36b5('0x14'),_0x510888);_0x1d88d5['on'](_0x36b5('0x16'),_0x50c793);});}; \ No newline at end of file +var _0x7f20=['EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','transcript','likelihood','Success.','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','open','message','bluebird','lodash','moment','crypto','../../../../../../config/logger','agi','exports','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','hex','info','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','data'];(function(_0x3d178d,_0x45a307){var _0x7e4274=function(_0xa9595d){while(--_0xa9595d){_0x3d178d['push'](_0x3d178d['shift']());}};_0x7e4274(++_0x45a307);}(_0x7f20,0x160));var _0x07f2=function(_0x26107b,_0x30a728){_0x26107b=_0x26107b-0x0;var _0xfbcef7=_0x7f20[_0x26107b];return _0xfbcef7;};'use strict';var BPromise=require(_0x07f2('0x0'));var _=require(_0x07f2('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x07f2('0x2'));var crypto=require(_0x07f2('0x3'));var logger=require(_0x07f2('0x4'))(_0x07f2('0x5'));module[_0x07f2('0x6')]=function(_0x389f4f,_0xbbd2b6,_0x21289b,_0xfd4f1f){return new BPromise(function(_0x47c963,_0x37c89d){logger['info']('Tilde\x20URI',_0xfd4f1f||_0x07f2('0x7'));var _0x38c8d4=new WebSocket(_0xfd4f1f||_0x07f2('0x7'),{'perMessageDeflate':![]});var _0xb22802='';var _0x43db0='0';var _0x26349a='1';var _0x1df547=_0x07f2('0x8');function _0x476858(_0x1b9c2c){var _0x546ee1=crypto['createHash'](_0x07f2('0x9'));_0x546ee1[_0x07f2('0xa')](_0x1b9c2c);return _0x546ee1['digest'](_0x07f2('0xb'));}function _0x4ed93d(){try{logger[_0x07f2('0xc')](_0x07f2('0xd'));var _0x5d5509=moment()[_0x07f2('0xe')]();var _0x4f3563=_0x476858(_0x5d5509+_0xbbd2b6+_0x21289b);_0x38c8d4[_0x07f2('0xf')](JSON[_0x07f2('0x10')]({'appID':_0xbbd2b6,'timestamp':_0x5d5509,'appKey':_0x4f3563}));var _0x73eac5=fs['createReadStream'](_0x389f4f);_0x73eac5['on'](_0x07f2('0x11'),function(_0x1f9acb){_0x38c8d4[_0x07f2('0xf')](_0x1f9acb);});_0x73eac5['on']('close',function(){_0x38c8d4[_0x07f2('0xf')](_0x07f2('0x12'));});}catch(_0x3302be){logger[_0x07f2('0x13')](_0x07f2('0x14'),JSON[_0x07f2('0x10')](_0x3302be));_0x38c8d4[_0x07f2('0x15')]();}}function _0x13f6e5(_0x5ee141){try{if(_0x5ee141){var _0x16504c=JSON[_0x07f2('0x16')](_0x5ee141);switch(_0x16504c[_0x07f2('0x17')]){case 0x0:if(_0x16504c[_0x07f2('0x18')]){if(_0x16504c[_0x07f2('0x18')][_0x07f2('0x19')]){logger[_0x07f2('0xc')]('Tilde\x20ASR\x20hypoteses',JSON[_0x07f2('0x10')](_0x16504c[_0x07f2('0x18')]['hypotheses']));_0xb22802=_0x16504c[_0x07f2('0x18')][_0x07f2('0x1a')][0x0][_0x07f2('0x1b')];_0x43db0=_0x16504c[_0x07f2('0x18')][_0x07f2('0x1a')][0x0][_0x07f2('0x1c')];_0x26349a='0';_0x1df547=_0x07f2('0x1d');_0x38c8d4['terminate']();}}break;case 0x1:logger[_0x07f2('0xc')](_0x07f2('0x8'));_0x26349a='1';_0x1df547='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger['info'](_0x07f2('0x1e'));_0x26349a='2';_0x1df547=_0x07f2('0x1e');break;case 0x9:logger[_0x07f2('0xc')]('Not\x20available.\x20Max\x20load\x20limit\x20reached.');_0x26349a='9';_0x1df547='Not\x20available.\x20Max\x20load\x20limit\x20reached.';break;case 0xa:logger[_0x07f2('0xc')](_0x07f2('0x1f'));_0x26349a='10';_0x1df547=_0x07f2('0x1f');break;case 0xb:logger[_0x07f2('0xc')](_0x07f2('0x20'));_0x26349a='11';_0x1df547=_0x07f2('0x20');}}}catch(_0x47ad33){logger[_0x07f2('0x13')](_0x07f2('0x21'),JSON[_0x07f2('0x10')](_0x47ad33));_0x38c8d4['terminate']();}}function _0x485d8f(){logger[_0x07f2('0xc')](_0x07f2('0x22'));_0x47c963({'transcript':_0xb22802,'confidence':_0x43db0,'status':_0x26349a,'status_message':_0x1df547});}function _0x528aee(_0x407a59){logger[_0x07f2('0x13')]('Error\x20Tilde\x20ASR\x20socket');if(!_['isNil'](_0x407a59)){logger[_0x07f2('0x13')](_['isObject'](_0x407a59)?JSON['stringify'](_0x407a59):_0x407a59);}}_0x38c8d4['on'](_0x07f2('0x23'),_0x4ed93d);_0x38c8d4['on'](_0x07f2('0x24'),_0x13f6e5);_0x38c8d4['on']('close',_0x485d8f);_0x38c8d4['on']('error',_0x528aee);});}; \ 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 b0939e3..85975c5 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 _0x2d25=['exports'];(function(_0x333b44,_0x241b90){var _0x295bd5=function(_0x116c15){while(--_0x116c15){_0x333b44['push'](_0x333b44['shift']());}};_0x295bd5(++_0x241b90);}(_0x2d25,0x137));var _0x52d2=function(_0xbec814,_0x1b0e0f){_0xbec814=_0xbec814-0x0;var _0x9421ef=_0x2d25[_0xbec814];return _0x9421ef;};var asr=require('./asr');module[_0x52d2('0x0')]={'asr':asr}; \ No newline at end of file +var _0x1381=['exports'];(function(_0x297b74,_0x178ef7){var _0x5158ba=function(_0x2efcbf){while(--_0x2efcbf){_0x297b74['push'](_0x297b74['shift']());}};_0x5158ba(++_0x178ef7);}(_0x1381,0x1ef));var _0x1138=function(_0x2ac995,_0x429aaa){_0x2ac995=_0x2ac995-0x0;var _0x493283=_0x1381[_0x2ac995];return _0x493283;};var asr=require('./asr');module[_0x1138('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index da5aba0..ecbe0dc 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 _0xa3f1=['destroy','code','E_AGI_SERVER_CLOSE','nextTick','inherits','exports','util','net','EventEmitter','./channel','call','emit','error','E_AGI_ARGUMENT_PORT','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xa3f1,0x132));var _0x1a3f=function(_0x2abb66,_0x2d9ce0){_0x2abb66=_0x2abb66-0x0;var _0x26a6d6=_0xa3f1[_0x2abb66];return _0x26a6d6;};'use strict';var util=require(_0x1a3f('0x0'));var net=require(_0x1a3f('0x1'));var EventEmitter=require('events')[_0x1a3f('0x2')];var AGIError=require('./error');var AGIChannel=require(_0x1a3f('0x3'));var AGIServer=function(_0x54e4b9,_0x48a26d,_0x59c035){var _0x172acc=this,_0x54e4b9=_0x54e4b9||0x11dd,_0x48a26d=_0x48a26d||'127.0.0.1',_0x5f1034=null,_0x1f1bb4=0x0;EventEmitter[_0x1a3f('0x4')](_0x172acc);function _0x40d18f(){if(!_0x54e4b9){_0x172acc[_0x1a3f('0x5')](_0x1a3f('0x6'),new AGIError(_0x1a3f('0x7')));return![];}_0x5f1034=net['createServer']();_0x5f1034[_0x1a3f('0x8')](_0x54e4b9,_0x48a26d);_0x5f1034['on'](_0x1a3f('0x9'),function(){_0x172acc[_0x1a3f('0x5')](_0x1a3f('0x9'));});_0x5f1034['on'](_0x1a3f('0xa'),function(_0x4beb51){_0x5f1034[_0x1a3f('0xb')](function(_0x2b736c,_0x408db1){if(_0x2b736c){_0x172acc[_0x1a3f('0x5')]('error',new AGIError(_0x1a3f('0xc'),_0x2b736c));}else if(_0x59c035&&_0x59c035<0x0){_0x172acc['emit'](_0x1a3f('0x6'),new AGIError(_0x1a3f('0xd')));_0x4beb51[_0x1a3f('0xe')]();}else if(_0x59c035&&_0x59c035>0x0&&_0x59c035<_0x408db1){_0x1f1bb4+=0x1;_0x172acc[_0x1a3f('0x5')](_0x1a3f('0x6'),new AGIError('E_AGI_SERVER_MAXCONNECTION',_0x1f1bb4));_0x4beb51[_0x1a3f('0xe')]();}else{var _0x4f8f4b=new AGIChannel(_0x4beb51);_0x4f8f4b['on']('ready',function(){_0x172acc[_0x1a3f('0x5')](_0x1a3f('0xa'),_0x4f8f4b);});}});});_0x5f1034['on']('error',function(_0xb30073){_0x172acc[_0x1a3f('0x5')](_0x1a3f('0x6'),new AGIError(_0x1a3f('0xc'),_0xb30073[_0x1a3f('0xf')]));});_0x5f1034['on']('close',function(){_0x172acc[_0x1a3f('0x5')]('close',new AGIError(_0x1a3f('0x10')));});}process[_0x1a3f('0x11')](function(){_0x40d18f();});};util[_0x1a3f('0x12')](AGIServer,EventEmitter);module[_0x1a3f('0x13')]=function(_0x53179c,_0x52b220,_0x1ef36f){return new AGIServer(_0x53179c,_0x52b220,_0x1ef36f);}; \ No newline at end of file +var _0xe36a=['destroy','E_AGI_SERVER_MAXCONNECTION','connection','E_AGI_SERVER_ERROR','code','close','nextTick','inherits','exports','events','EventEmitter','./error','./channel','127.0.0.1','call','error','E_AGI_ARGUMENT_PORT','listen','listening','emit','getConnections','E_AGI_SERVER_VOICE_DISABLED'];(function(_0xef89d,_0x287047){var _0x23d599=function(_0x20ebad){while(--_0x20ebad){_0xef89d['push'](_0xef89d['shift']());}};_0x23d599(++_0x287047);}(_0xe36a,0xb9));var _0xae36=function(_0x440030,_0xaeec43){_0x440030=_0x440030-0x0;var _0x40d6b4=_0xe36a[_0x440030];return _0x40d6b4;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0xae36('0x0'))[_0xae36('0x1')];var AGIError=require(_0xae36('0x2'));var AGIChannel=require(_0xae36('0x3'));var AGIServer=function(_0x168fc9,_0x42348b,_0x679580){var _0x1222c0=this,_0x168fc9=_0x168fc9||0x11dd,_0x42348b=_0x42348b||_0xae36('0x4'),_0x27fa14=null,_0x307c4d=0x0;EventEmitter[_0xae36('0x5')](_0x1222c0);function _0x2573d8(){if(!_0x168fc9){_0x1222c0['emit'](_0xae36('0x6'),new AGIError(_0xae36('0x7')));return![];}_0x27fa14=net['createServer']();_0x27fa14[_0xae36('0x8')](_0x168fc9,_0x42348b);_0x27fa14['on'](_0xae36('0x9'),function(){_0x1222c0[_0xae36('0xa')](_0xae36('0x9'));});_0x27fa14['on']('connection',function(_0x335d8f){_0x27fa14[_0xae36('0xb')](function(_0x3ffefb,_0x97b285){if(_0x3ffefb){_0x1222c0[_0xae36('0xa')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x3ffefb));}else if(_0x679580&&_0x679580<0x0){_0x1222c0[_0xae36('0xa')](_0xae36('0x6'),new AGIError(_0xae36('0xc')));_0x335d8f[_0xae36('0xd')]();}else if(_0x679580&&_0x679580>0x0&&_0x679580<_0x97b285){_0x307c4d+=0x1;_0x1222c0[_0xae36('0xa')](_0xae36('0x6'),new AGIError(_0xae36('0xe'),_0x307c4d));_0x335d8f['destroy']();}else{var _0x2fca5b=new AGIChannel(_0x335d8f);_0x2fca5b['on']('ready',function(){_0x1222c0['emit'](_0xae36('0xf'),_0x2fca5b);});}});});_0x27fa14['on'](_0xae36('0x6'),function(_0x2438a2){_0x1222c0[_0xae36('0xa')]('error',new AGIError(_0xae36('0x10'),_0x2438a2[_0xae36('0x11')]));});_0x27fa14['on'](_0xae36('0x12'),function(){_0x1222c0['emit']('close',new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0xae36('0x13')](function(){_0x2573d8();});};util[_0xae36('0x14')](AGIServer,EventEmitter);module[_0xae36('0x15')]=function(_0x4dcae4,_0x3bb127,_0x181759){return new AGIServer(_0x4dcae4,_0x3bb127,_0x181759);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index 09a8260..a7a70c4 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 _0x33cd=['createSquareRecording','uniqueid','calleridname','extension','priority','accountcode','dnid','file','createSquareMessage','createCmContact','isEmpty','isNil','random','lastName','list_id','callback','scheduledAt','callback_priority','getPauseById','agentPause','agent','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','googleDialogflowV2','dialogflowV2_project_id','private_key','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeech_asr_language','en-US','isConfigured','model','aws_access_key_id','aws_secret_access_key','aws_polly_region','aws_polly_voice','Amy','aws_text_type','awsLex','aws_lex_region','aws_bot_name','googleASR','appid','appsecret','clone','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','hasOwnProperty','isPlainObject','isArray','isString','saveRestApiResult','%s.%s','length','setVariable','split','replaceAll','extra','getAndSetVariable','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','maxRetry','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','RECOG_INSTANCE()','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','args','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','answer','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','custom_app','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20odbc\x20database\x20found','query','no\x20query\x20configured','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','keys','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','no\x20user\x20selected','getUser','opts','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','dialogflowV2_language','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','username','no\x20password\x20configured','ndassistant_url','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','streamFile','.wav','SestekNDA\x20Result\x20%s','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','DIAL','SIP/%s/%s','phone','Executed\x20command\x20%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','toString','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','Enter\x20in\x20GOAL\x20(%s)\x20block','goalname','awspolly','unlink','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20valid\x20credentials\x20configured','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','beep','NOBEEP','intKey','google\x20%s\x20file\x20created','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','wav','recordFile','tildeASR','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','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','%s/recordings/%s','ISPEECH_ASR_%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','findBy','no\x20find\x20by\x20configured','FIND\x20AGENT\x20%s\x20BY\x20%s','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','failure','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','success','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','response','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','getPause','pause_id','playback','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20selected','no\x20queue\x20found','indexOf','toLowerCase','QUEUE','macro','position','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','service','host','port','authentication','auth','pass','template_id','Trying\x20SendMail\x20with\x20account\x20%s','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','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','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','variable_value','start','Enter\x20in\x20START\x20(%s)\x20block','START\x20CALLY\x20SQUARE','yes','Answer','subproject','project_id','no\x20subproject\x20selected','agi://%s/square,\x22%s\x22,\x22%s\x22','127.0.0.1','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','join','exports','path','util','lodash','shelljs','odbc','randomstring','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','menu','getdigits','getsecretdigits','channel','mailRpc','prototype','getVariable','rpc','getVariableById','then','name','catch','getVoiceQueue','getVoiceQueueById','getSquareProject','getSquareProjectById','getSquareOdbc','dsn','getTrunk','getTrunkById','getSound','getSoundById','getSoundPath','save_name','getMailAccountById','sendMailMessage','getIntervals','getIntervalById','interval','map','Intervals','format','%s/sounds/converted/%s','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','label','agicommand','arg_1','callerid'];(function(_0x56c80b,_0x30d735){var _0x5ddba6=function(_0x4e6115){while(--_0x4e6115){_0x56c80b['push'](_0x56c80b['shift']());}};_0x5ddba6(++_0x30d735);}(_0x33cd,0x180));var _0xd33c=function(_0x58f1ae,_0x3d2fdf){_0x58f1ae=_0x58f1ae-0x0;var _0x525c44=_0x33cd[_0x58f1ae];return _0x525c44;};'use strict';var fs=require('fs');var path=require(_0xd33c('0x0'));var util=require(_0xd33c('0x1'));var _=require(_0xd33c('0x2'));var sh=require(_0xd33c('0x3'));var odbc=require(_0xd33c('0x4'))();var rs=require(_0xd33c('0x5'));var moment=require('moment');var Mustache=require('mustache');var rp=require(_0xd33c('0x6'));var logger=require(_0xd33c('0x7'))(_0xd33c('0x8'));var config=require(_0xd33c('0x9'));var scripts=require(_0xd33c('0xa'));var FILES_PATH=_0xd33c('0xb');var recursiveMapAttributes=[_0xd33c('0xc'),_0xd33c('0xd')];var verticesWithRetry=[_0xd33c('0xe'),_0xd33c('0xf'),_0xd33c('0x10')];var AGIVertices=function(_0x55ffaa,_0x4f1d04,_0xe48b2e){this[_0xd33c('0x11')]=_0x55ffaa;this['rpc']=_0x4f1d04;this[_0xd33c('0x12')]=_0xe48b2e;};AGIVertices[_0xd33c('0x13')][_0xd33c('0x14')]=function(_0x14272f,_0x3bfe85){this[_0xd33c('0x15')][_0xd33c('0x16')](_0x14272f)[_0xd33c('0x17')](function(_0x8fe175){_0x3bfe85(null,_0x8fe175?_0x8fe175[_0xd33c('0x18')]:![]);})[_0xd33c('0x19')](function(_0x3a38af){_0x3bfe85(_0x3a38af);});};AGIVertices['prototype'][_0xd33c('0x1a')]=function(_0x546e43,_0x4ca174){this[_0xd33c('0x15')][_0xd33c('0x1b')](_0x546e43)[_0xd33c('0x17')](function(_0x164674){_0x4ca174(null,_0x164674?_0x164674['name']:![]);})[_0xd33c('0x19')](function(_0x1a1b24){_0x4ca174(_0x1a1b24);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x1c')]=function(_0x57c0b1,_0x5bce71){this[_0xd33c('0x15')][_0xd33c('0x1d')](_0x57c0b1)[_0xd33c('0x17')](function(_0x140c79){_0x5bce71(null,_0x140c79?_0x140c79[_0xd33c('0x18')]:![]);})[_0xd33c('0x19')](function(_0x153a8a){_0x5bce71(_0x153a8a);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x1e')]=function(_0x4d551,_0x65be7c){this[_0xd33c('0x15')]['getSquareOdbcById'](_0x4d551)[_0xd33c('0x17')](function(_0x1bdd52){_0x65be7c(null,_0x1bdd52?_0x1bdd52[_0xd33c('0x1f')]:![]);})[_0xd33c('0x19')](function(_0x973bc5){_0x65be7c(_0x973bc5);});};AGIVertices['prototype']['getUser']=function(_0x156acb,_0xe07e1a){this[_0xd33c('0x15')]['getUserById'](_0x156acb)[_0xd33c('0x17')](function(_0xc36199){_0xe07e1a(null,_0xc36199?_0xc36199[_0xd33c('0x18')]:![]);})[_0xd33c('0x19')](function(_0x119713){_0xe07e1a(_0x119713);});};AGIVertices['prototype'][_0xd33c('0x20')]=function(_0x56e625,_0x340ef9){this[_0xd33c('0x15')][_0xd33c('0x21')](_0x56e625)[_0xd33c('0x17')](function(_0x167396){_0x340ef9(null,_0x167396?_0x167396[_0xd33c('0x18')]:![]);})[_0xd33c('0x19')](function(_0x327e17){_0x340ef9(_0x327e17);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x22')]=function(_0x1125ec,_0x2ecb27){var _0x48951d=this;this[_0xd33c('0x15')][_0xd33c('0x23')](_0x1125ec)[_0xd33c('0x17')](function(_0x2d5a12){_0x2ecb27(null,_0x2d5a12?_0x48951d[_0xd33c('0x24')](_0x2d5a12[_0xd33c('0x25')]):![]);})[_0xd33c('0x19')](function(_0x3b0ef8){_0x2ecb27(_0x3b0ef8);});};AGIVertices[_0xd33c('0x13')]['getMailAccount']=function(_0x48996a,_0x27cb65){this[_0xd33c('0x15')][_0xd33c('0x26')](_0x48996a)['then'](function(_0x355126){_0x27cb65(null,_0x355126?_0x355126:![]);})['catch'](function(_0x8c9636){_0x27cb65(_0x8c9636);});};AGIVertices['prototype'][_0xd33c('0x27')]=function(_0x2592e4,_0x33796b,_0x50650a){this['mailRpc'][_0xd33c('0x27')](_0x2592e4,_0x33796b)[_0xd33c('0x17')](function(){_0x50650a(null);})['catch'](function(_0xf87cba){_0x50650a(_0xf87cba);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x28')]=function(_0x211dc7,_0x4010e0){this[_0xd33c('0x15')][_0xd33c('0x29')](_0x211dc7)[_0xd33c('0x17')](function(_0x554aa6){if(_0x554aa6){if(_0x554aa6['IntervalId']){_0x4010e0(null,[_0x554aa6[_0xd33c('0x2a')]]);}else{_0x4010e0(null,_[_0xd33c('0x2b')](_0x554aa6[_0xd33c('0x2c')],_0xd33c('0x2a')));}}else{_0x4010e0(null,![]);}})[_0xd33c('0x19')](function(_0x186cee){_0x4010e0(_0x186cee);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x24')]=function(_0x4eebd6){return util[_0xd33c('0x2d')](_0xd33c('0x2e'),FILES_PATH,_0x4eebd6);};AGIVertices[_0xd33c('0x13')]['getQueryOdbc']=function(_0x28ad66,_0x28b171,_0x30c3ed){odbc[_0xd33c('0x2f')](_0x28ad66,function(_0x3fcc80){if(_0x3fcc80){logger[_0xd33c('0x30')](_0xd33c('0x31'),_0x3fcc80);_0x30c3ed(_0x3fcc80);}else{logger[_0xd33c('0x32')](_0xd33c('0x33'));odbc['query'](_0x28b171,function(_0x3f323c,_0x3bb77f){if(_0x3f323c){logger[_0xd33c('0x32')](_0xd33c('0x34'),_0x28b171);_0x30c3ed(_0x3f323c);}else{logger[_0xd33c('0x32')](_0xd33c('0x35'),_0x28b171);odbc['close'](function(_0x11ccc9){if(_0x11ccc9){logger[_0xd33c('0x30')](_0xd33c('0x36'),_0x11ccc9);}_0x30c3ed(null,_0x3bb77f);});}});}});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x37')]=function(_0x1ecbc4,_0x95fa61){this[_0xd33c('0x15')][_0xd33c('0x38')](_0x1ecbc4)[_0xd33c('0x17')](function(_0x4d324d){_0x95fa61(null,_0x4d324d?_0x4d324d:![]);})[_0xd33c('0x19')](function(_0xc2e92c){_0x95fa61(_0xc2e92c);});};AGIVertices[_0xd33c('0x13')]['createSmsMessage']=function(_0x25ea63,_0x123938){this['rpc'][_0xd33c('0x39')](_0x25ea63)['then'](function(_0x4ba853){_0x123938(null,_0x4ba853);})[_0xd33c('0x19')](function(_0xb0dc83){_0x123938(_0xb0dc83);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x3a')]=function(_0x16d8f4,_0x1263f0,_0x4df5d7){this[_0xd33c('0x15')][_0xd33c('0x3a')]({'uniqueid':this['channel']['uniqueid'],'node':_0x16d8f4[_0xd33c('0x3b')],'application':_0x16d8f4[_0xd33c('0x3c')],'data':_0x1263f0||null,'project_name':this[_0xd33c('0x11')][_0xd33c('0x3d')],'callerid':this['channel'][_0xd33c('0x3e')]})[_0xd33c('0x17')](function(_0x5b95b7){if(_0x4df5d7){_0x4df5d7(null,_0x5b95b7);}})[_0xd33c('0x19')](function(_0x21a633){if(_0x4df5d7){_0x4df5d7(_0x21a633);}});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x3f')]=function(_0x2e3ec2,_0xdaa6ce,_0x50f211,_0x63e513){this[_0xd33c('0x15')][_0xd33c('0x3f')]({'uniqueid':this['channel'][_0xd33c('0x40')],'callerid':this['channel'][_0xd33c('0x3e')],'calleridname':this[_0xd33c('0x11')][_0xd33c('0x41')],'context':this[_0xd33c('0x11')]['context'],'extension':this['channel'][_0xd33c('0x42')],'priority':this[_0xd33c('0x11')][_0xd33c('0x43')],'accountcode':this[_0xd33c('0x11')][_0xd33c('0x44')],'dnid':this[_0xd33c('0x11')][_0xd33c('0x45')],'projectName':this[_0xd33c('0x11')][_0xd33c('0x3d')],'saveName':_0xdaa6ce,'filename':_0x2e3ec2[_0xd33c('0x46')]||_0xdaa6ce,'savePath':_0x50f211})[_0xd33c('0x17')](function(_0x15810d){_0x63e513(null,_0x15810d);})[_0xd33c('0x19')](function(_0x58dc82){_0x63e513(_0x58dc82);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x47')]=function(_0x129e4f,_0xfa17d5,_0x4893e5,_0x4b5219,_0x1e7c63){this[_0xd33c('0x15')][_0xd33c('0x47')]({'uniqueid':this['channel']['uniqueid'],'body':_0x129e4f,'direction':_0xfa17d5,'providerName':_0x4893e5,'providerResponse':_0x4b5219})[_0xd33c('0x17')](function(_0x118206){if(_0x1e7c63){_0x1e7c63(null,_0x118206);}})[_0xd33c('0x19')](function(_0x55b9a3){if(_0x1e7c63){_0x1e7c63(_0x55b9a3);}});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x48')]=function(_0x1f195e,_0x547f56){this[_0xd33c('0x15')][_0xd33c('0x48')]({'firstName':_[_0xd33c('0x49')](_0x1f195e['name'])||_[_0xd33c('0x4a')](_0x1f195e[_0xd33c('0x18')])?'callback_'+Math[_0xd33c('0x4b')]():_0x1f195e[_0xd33c('0x18')],'lastName':_[_0xd33c('0x49')](_0x1f195e[_0xd33c('0x4c')])||_['isNil'](_0x1f195e[_0xd33c('0x4c')])?null:_0x1f195e['lastName'],'phone':_0x1f195e['phone'],'ListId':_0x1f195e[_0xd33c('0x4d')],'scheduledat':_0x1f195e['scheduledAt'],'callbackUniqueid':this['channel'][_0xd33c('0x40')],'tags':_0xd33c('0x4e'),'description':'Callback\x20scheduled\x20at\x20'+_0x1f195e[_0xd33c('0x4f')]['toString'](),'priority':_0x1f195e[_0xd33c('0x50')]})[_0xd33c('0x17')](function(_0x1c61b1){_0x547f56(null,_0x1c61b1);})['catch'](function(_0x1c05f7){_0x547f56(_0x1c05f7);});};AGIVertices[_0xd33c('0x13')]['getPause']=function(_0x4956a7,_0x2b50d4){this[_0xd33c('0x15')][_0xd33c('0x51')](_0x4956a7)['then'](function(_0x23ff14){_0x2b50d4(null,_0x23ff14?_0x23ff14[_0xd33c('0x18')]:![]);})['catch'](function(_0x57c738){_0x2b50d4(_0x57c738);});};AGIVertices['prototype'][_0xd33c('0x52')]=function(_0x3fca43,_0x4e59a4,_0x2d359b){var _0x10c5f6={'role':_0xd33c('0x53')};_0x10c5f6[_0x3fca43]=this['channel'][_0xd33c('0x3e')];this[_0xd33c('0x15')]['agentPause'](_0x10c5f6,_0x4e59a4,this['channel'][_0xd33c('0x40')])[_0xd33c('0x17')](function(_0x2e6d82){_0x2d359b(null,_[_0xd33c('0x4a')](_0x2e6d82)?![]:!![]);})['catch'](function(_0x4bfe92){logger[_0xd33c('0x30')](_0x4bfe92);_0x2d359b(null,![]);});};AGIVertices['prototype'][_0xd33c('0x54')]=function(_0x196b2d,_0x254b47){var _0x2e4a85={'role':_0xd33c('0x53')};_0x2e4a85[_0x196b2d]=this['channel']['callerid'];this[_0xd33c('0x15')][_0xd33c('0x54')](_0x2e4a85)[_0xd33c('0x17')](function(_0x16ecf5){_0x254b47(null,_[_0xd33c('0x4a')](_0x16ecf5)?![]:!![]);})[_0xd33c('0x19')](function(_0x4add77){logger[_0xd33c('0x30')](_0x4add77);_0x254b47(null,![]);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x55')]=function(_0x3de702,_0x391fc4){var _0x54dcf9={'role':_0xd33c('0x53')};_0x54dcf9[_0x3de702]=this[_0xd33c('0x11')][_0xd33c('0x3e')];this[_0xd33c('0x15')][_0xd33c('0x55')](_0x54dcf9)[_0xd33c('0x17')](function(_0x3d4622){_0x391fc4(null,_['isNil'](_0x3d4622)?![]:!![]);})[_0xd33c('0x19')](function(_0x1fc55a){logger[_0xd33c('0x30')](_0x1fc55a);_0x391fc4(null,![]);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x56')]=function(_0x288d1a,_0x870621){var _0x2fb37c={'role':_0xd33c('0x53')};_0x2fb37c[_0x288d1a]=this[_0xd33c('0x11')][_0xd33c('0x3e')];var _0x191c4c=_0x288d1a!=_0xd33c('0x57')?util[_0xd33c('0x2d')](_0xd33c('0x58'),_0xd33c('0x59'),this[_0xd33c('0x11')][_0xd33c('0x3e')]):undefined;this[_0xd33c('0x15')][_0xd33c('0x56')](_0x2fb37c,_0x191c4c)[_0xd33c('0x17')](function(_0x572e6e){_0x870621(null,_['isNil'](_0x572e6e)?![]:!![]);})[_0xd33c('0x19')](function(_0x21175b){logger[_0xd33c('0x30')](_0x21175b);_0x870621(null,![]);});};AGIVertices[_0xd33c('0x13')]['shellCommand']=function(_0x313ae2,_0x4a59dd){sh[_0xd33c('0x5a')](_['trim'](_0x313ae2),function(_0x349902,_0x56bb2e){var _0x258751=_0x56bb2e[_0xd33c('0x5b')](/(\r\n|\n|\r)/gm,'');_0x4a59dd(null,_0x258751);});};AGIVertices[_0xd33c('0x13')]['googleCloudTTS']=function(_0x170fe6,_0x60669){scripts[_0xd33c('0x5c')](_0x170fe6[_0xd33c('0x5d')],_0x170fe6[_0xd33c('0x5e')]||_0xd33c('0x5f'),_0x170fe6[_0xd33c('0x5f')],_0x170fe6[_0xd33c('0x60')]||'en-US',_0x170fe6['ssmlGender']||_0xd33c('0x61'),_0x170fe6[_0xd33c('0x62')]||_0xd33c('0x63'))[_0xd33c('0x17')](function(_0x154a6c){_0x60669(null,_0x154a6c);})[_0xd33c('0x19')](function(_0x431a43){_0x60669(_0x431a43);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x64')]=function(_0x5a3f19,_0x36398e){scripts['googleTTS'](_0x5a3f19[_0xd33c('0x5f')],_0x5a3f19[_0xd33c('0x65')]||'en',0x1)[_0xd33c('0x17')](function(_0x21e213){_0x36398e(null,_0x21e213);})[_0xd33c('0x19')](function(_0xe72a0a){_0x36398e(_0xe72a0a);});};AGIVertices['prototype'][_0xd33c('0x66')]=function(_0x258eb1,_0x3019c1){var _0x1e758d={'uri':_0x258eb1[_0xd33c('0x67')],'method':_0x258eb1[_0xd33c('0x68')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x258eb1[_0xd33c('0x69')])===_0xd33c('0x6a')&&parseInt(_0x258eb1[_0xd33c('0x69')])>=0x1?parseInt(_0x258eb1['timeout'])*0x3e8:0x5*0x3e8};if(_[_0xd33c('0x6b')](['POST','PUT'],_0x1e758d[_0xd33c('0x68')][_0xd33c('0x6c')]())){try{_0x1e758d[_0xd33c('0x6d')]=_0x258eb1['rawBody']?JSON[_0xd33c('0x6e')](_0x258eb1[_0xd33c('0xd')]):{};}catch(_0x4229cb){logger[_0xd33c('0x30')](_0xd33c('0x6f'),_0x4229cb);}}try{_0x1e758d[_0xd33c('0x70')]=_0x258eb1[_0xd33c('0xc')]?JSON[_0xd33c('0x6e')](_0x258eb1[_0xd33c('0xc')]):{};}catch(_0x14c582){logger[_0xd33c('0x30')](_0xd33c('0x71'),_0x14c582);}if(_0x258eb1['computedVariables']){try{var _0x17dc72=require(_0x258eb1['computedVariables'])[_0xd33c('0x72')](this,_0x1e758d);_0x1e758d[_0xd33c('0x73')]=Mustache[_0xd33c('0x74')](_0x258eb1[_0xd33c('0x67')],_0x17dc72,{},['$$','$$']);if(_0x1e758d[_0xd33c('0x70')]){_0x1e758d[_0xd33c('0x70')]=JSON[_0xd33c('0x6e')](Mustache[_0xd33c('0x74')](JSON[_0xd33c('0x75')](_0x1e758d['headers']),_0x17dc72,{},['$$','$$']));}if(_0x1e758d[_0xd33c('0x6d')]){_0x1e758d[_0xd33c('0x6d')]=JSON[_0xd33c('0x6e')](Mustache['render'](JSON[_0xd33c('0x75')](_0x1e758d[_0xd33c('0x6d')]),_0x17dc72,{},['$$','$$']));}}catch(_0x1cb2f8){logger[_0xd33c('0x30')](_0xd33c('0x76'),_0x1cb2f8);}}rp(_0x1e758d)[_0xd33c('0x17')](function(_0x196f2a){var _0x1b3360={'statusCode':_0x196f2a[_0xd33c('0x77')]||0xc8,'statusMessage':_0x196f2a[_0xd33c('0x78')]||'OK','headers':_0x196f2a[_0xd33c('0x70')]||{},'body':_0x196f2a[_0xd33c('0x6d')]||{}};_0x3019c1(null,_0x1b3360);})[_0xd33c('0x19')](function(_0x288c80){var _0x39aa13={'statusCode':_0x288c80[_0xd33c('0x77')]||0x1f4,'statusMessage':_0x288c80[_0xd33c('0x79')]||_0xd33c('0x7a'),'headers':_0x288c80[_0xd33c('0x7b')][_0xd33c('0x70')]||{},'body':_0x288c80[_0xd33c('0x7b')][_0xd33c('0x6d')]||{}};_0x3019c1(null,_0x39aa13);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x7c')]=function(_0x1098cf,_0x33ab46){scripts[_0xd33c('0x7c')](this[_0xd33c('0x11')][_0xd33c('0x40')],_0x1098cf[_0xd33c('0x7d')],_0x1098cf[_0xd33c('0x5f')],_0x1098cf['dialogflow_language']||'en')[_0xd33c('0x17')](function(_0x47cd1c){_0x33ab46(null,_0x47cd1c);})['catch'](function(_0x1bae10){_0x33ab46(_0x1bae10);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x7e')]=function(_0x28336c,_0x29cb01){scripts[_0xd33c('0x7e')](this['channel'][_0xd33c('0x40')],_0x28336c[_0xd33c('0x7f')],_0x28336c['client_email'],_0x28336c[_0xd33c('0x80')],_0x28336c['text'],_0x28336c['dialogflowV2_language']||'en')['then'](function(_0x166375){_0x29cb01(null,_0x166375);})[_0xd33c('0x19')](function(_0x4f0b44){_0x29cb01(_0x4f0b44);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x81')]=function(_0x16fa5b,_0x20c05b){scripts[_0xd33c('0x81')](this[_0xd33c('0x11')],_0x16fa5b)[_0xd33c('0x17')](function(_0x5f5db2){_0x20c05b(null,_0x5f5db2);})['catch'](function(_0x4712be){_0x20c05b(_0x4712be);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x82')]=function(_0x2f3a2f,_0x2d6264){scripts[_0xd33c('0x82')](_0x2f3a2f['key'],_0x2f3a2f[_0xd33c('0x5f')],_0x2f3a2f[_0xd33c('0x83')]||'en-US',_0x2f3a2f[_0xd33c('0x84')])[_0xd33c('0x17')](function(_0x1044e3){_0x2d6264(null,_0x1044e3);})[_0xd33c('0x19')](function(_0x121558){_0x2d6264(_0x121558);});};AGIVertices[_0xd33c('0x13')]['ispeechASR']=function(_0x5d7f14,_0x39ef6f,_0x29879a){scripts['ispeechASR'](_0x39ef6f,_0x5d7f14['key'],_0x5d7f14[_0xd33c('0x85')]||_0xd33c('0x86'),this[_0xd33c('0x87')](_0x5d7f14['model'])?_0x5d7f14[_0xd33c('0x88')]:undefined)[_0xd33c('0x17')](function(_0x198dcb){_0x29879a(null,_0x198dcb);})[_0xd33c('0x19')](function(_0x3a4ae2){_0x29879a(_0x3a4ae2);});};AGIVertices[_0xd33c('0x13')]['awsPolly']=function(_0x3d0db0,_0x2e9c7d){scripts['awsPolly'](_0x3d0db0[_0xd33c('0x89')],_0x3d0db0[_0xd33c('0x8a')],_0x3d0db0[_0xd33c('0x8b')],_0x3d0db0[_0xd33c('0x8c')]||_0xd33c('0x8d'),_0x3d0db0[_0xd33c('0x5f')],_0x3d0db0[_0xd33c('0x8e')]||_0xd33c('0x5f'))[_0xd33c('0x17')](function(_0x4a2d94){_0x2e9c7d(null,_0x4a2d94);})[_0xd33c('0x19')](function(_0x414e9d){_0x2e9c7d(_0x414e9d);});};AGIVertices[_0xd33c('0x13')][_0xd33c('0x8f')]=function(_0x1f9423,_0x36fdba){scripts[_0xd33c('0x8f')](this[_0xd33c('0x11')][_0xd33c('0x40')],_0x1f9423[_0xd33c('0x89')],_0x1f9423['aws_secret_access_key'],_0x1f9423[_0xd33c('0x90')],_0x1f9423[_0xd33c('0x5f')],_0x1f9423[_0xd33c('0x91')])['then'](function(_0x526bf3){_0x36fdba(null,_0x526bf3);})['catch'](function(_0x587a7e){_0x36fdba(_0x587a7e);});};AGIVertices[_0xd33c('0x13')]['googleASR']=function(_0x41ec56,_0x3d2984,_0x487518){scripts[_0xd33c('0x92')](_0x3d2984,_0x41ec56[_0xd33c('0x7d')],_0x41ec56['google_asr_language']||_0xd33c('0x86'))[_0xd33c('0x17')](function(_0x498c6b){_0x487518(null,_0x498c6b);})[_0xd33c('0x19')](function(_0x1eac3a){_0x487518(_0x1eac3a);});};AGIVertices['prototype']['tildeASR']=function(_0x41f610,_0x31648a,_0x300753){scripts['tildeASR'](_0x31648a,_0x41f610[_0xd33c('0x93')],_0x41f610[_0xd33c('0x94')],_0x41f610[_0xd33c('0x73')])[_0xd33c('0x17')](function(_0x32ade0){_0x300753(null,_0x32ade0);})[_0xd33c('0x19')](function(_0x2b537e){_0x300753(_0x2b537e);});};AGIVertices['prototype']['clear']=function(_0x4d67ce){var _0x52b940=_['includes'](verticesWithRetry,_0x4d67ce[_0xd33c('0x3c')])?_0x4d67ce:_[_0xd33c('0x95')](_0x4d67ce);for(var _0xa5d6c4 in _0x52b940){if(_0x52b940['hasOwnProperty'](_0xa5d6c4)){if(_0x52b940[_0xa5d6c4]&&_['isString'](_0x52b940[_0xa5d6c4])){if(_['includes'](recursiveMapAttributes,_0xa5d6c4)){_0x52b940[_0xa5d6c4]=this[_0xd33c('0x96')](_0x52b940[_0xa5d6c4]);}else{_0x52b940[_0xa5d6c4]=this[_0xd33c('0x97')](_0x52b940[_0xa5d6c4]);}}}}return _0x52b940;};AGIVertices[_0xd33c('0x13')][_0xd33c('0x98')]=function(_0x1cbcc7){for(var _0x3483cf in _0x1cbcc7){if(_0x1cbcc7[_0xd33c('0x99')](_0x3483cf)){if(_[_0xd33c('0x9a')](_0x1cbcc7[_0x3483cf])){this[_0xd33c('0x98')](_0x1cbcc7[_0x3483cf]);}else if(_[_0xd33c('0x9b')](_0x1cbcc7[_0x3483cf])){for(var _0x4d5dd8=0x0;_0x4d5dd8<_0x1cbcc7[_0x3483cf]['length'];_0x4d5dd8++){this['recursiveNodeIndex'](_0x1cbcc7[_0x3483cf][_0x4d5dd8]);}}else if(_[_0xd33c('0x9c')](_0x1cbcc7[_0x3483cf])){_0x1cbcc7[_0x3483cf]=this[_0xd33c('0x97')](_0x1cbcc7[_0x3483cf]);}}}};AGIVertices[_0xd33c('0x13')][_0xd33c('0x9d')]=function(_0x520528,_0x8d2426){for(var _0x35f052 in _0x520528){if(_0x520528['hasOwnProperty'](_0x35f052)){if(_[_0xd33c('0x9a')](_0x520528[_0x35f052])){if(!_[_0xd33c('0x49')](_0x520528[_0x35f052])){this['saveRestApiResult'](_0x520528[_0x35f052],util[_0xd33c('0x2d')](_0xd33c('0x9e'),_0x8d2426,_0x35f052));}}else if(_[_0xd33c('0x9b')](_0x520528[_0x35f052])){for(var _0x2ca855=0x0;_0x2ca855<_0x520528[_0x35f052][_0xd33c('0x9f')];_0x2ca855++){this[_0xd33c('0x9d')](_0x520528[_0x35f052][_0x2ca855],util[_0xd33c('0x2d')](_0xd33c('0x9e'),_0x8d2426,_0x35f052+'['+_0x2ca855+']'));}}else{if(!_[_0xd33c('0x4a')](_0x520528[_0x35f052])){this['channel'][_0xd33c('0xa0')](util['format']('%s.%s',_0x8d2426,_0x35f052),_0x520528[_0x35f052]);}}}}};AGIVertices['prototype']['replaceObjectAllVariables']=function(_0x514f10){try{var _0x4322f6=JSON[_0xd33c('0x6e')](_0x514f10);this[_0xd33c('0x98')](_0x4322f6);return JSON['stringify'](_0x4322f6);}catch(_0xf2875d){return this['replaceAllVariables'](_0x514f10);}};AGIVertices[_0xd33c('0x13')][_0xd33c('0x97')]=function(_0x1576a8){var _0x367b8a=_0x1576a8['split']('{');for(var _0x1784c4=0x1;_0x1784c4<_0x367b8a[_0xd33c('0x9f')];_0x1784c4+=0x1){var _0x4bf356=_0x367b8a[_0x1784c4][_0xd33c('0xa1')]('}');if(_0x4bf356[_0xd33c('0x9f')]>0x1){_0x1576a8=_0x1576a8[_0xd33c('0xa2')]('{'+_0x4bf356[0x0]+'}',this[_0xd33c('0x11')][_0xd33c('0x14')](_0x4bf356[0x0])[_0xd33c('0xa3')]||_0x4bf356[0x0]);}}if(_0x367b8a['length']===0x1){return _0x1576a8['toString']();}return this['replaceAllVariables'](_0x1576a8);};AGIVertices[_0xd33c('0x13')][_0xd33c('0xa4')]=function(_0x4c604a,_0x179e5b){var _0x520924=this[_0xd33c('0x11')][_0xd33c('0x14')](_0x4c604a);if(_0x520924[_0xd33c('0xa5')]===-0x1){return _0x520924;}logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0xa6'),_0x179e5b,_0x520924[_0xd33c('0xa3')]));return this[_0xd33c('0x11')][_0xd33c('0xa0')](_0x179e5b,_0x520924[_0xd33c('0xa3')]);};AGIVertices[_0xd33c('0x13')][_0xd33c('0x87')]=function(_0x41b400){return _0x41b400&&_0x41b400!=='0'&&_0x41b400!=='-1'&&_0x41b400!=='';};AGIVertices[_0xd33c('0x13')][_0xd33c('0xa7')]=function(_0x1a52c6){this[_0xd33c('0x3a')][_0xd33c('0x72')](this,_0x1a52c6,'-');_0x1a52c6['retry']=_0x1a52c6[_0xd33c('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd33c('0x13')]['mrcpsynth']=function(_0x2ad19e){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0xa8'),_0x2ad19e[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x2ad19e['text'])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xaa'));}var _0xceaa29='\x22'+_0x2ad19e['text']+'\x22';if(this[_0xd33c('0x87')](_0x2ad19e[_0xd33c('0x7b')])){_0xceaa29+=','+_0x2ad19e[_0xd33c('0x7b')];}var _0x57e3b9=this[_0xd33c('0x11')][_0xd33c('0x5a')](_0xd33c('0xab'),_0xceaa29);if(_0x57e3b9[_0xd33c('0xa5')]===-0x1){return _0x57e3b9;}return this['channel']['noop'](util[_0xd33c('0x2d')](_0xd33c('0xac'),_0xceaa29));};AGIVertices[_0xd33c('0x13')][_0xd33c('0xad')]=function(_0x268cd5){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0xae'),_0x268cd5[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x268cd5[_0xd33c('0xaf')])){return this['channel']['noop'](_0xd33c('0xb0'));}var _0x3d3067=_0x268cd5['grammar'];if(this[_0xd33c('0x87')](_0x268cd5[_0xd33c('0x7b')])){_0x3d3067+=','+_0x268cd5['options'];}var _0x47a1d6=this[_0xd33c('0x11')][_0xd33c('0x5a')](_0xd33c('0xb1'),_0x3d3067);if(_0x47a1d6[_0xd33c('0xa5')]===-0x1){return _0x47a1d6;}var _0x327a64=this['getAndSetVariable'](_0xd33c('0xb2'),_0xd33c('0xb3'));if(_0x327a64['result']===-0x1){return _0x327a64;}var _0x3373f0=this[_0xd33c('0xa4')](_0xd33c('0xb4'),'MRCP_RECOG_TRANSCRIPT');if(_0x3373f0[_0xd33c('0xa5')]===-0x1){return _0x3373f0;}var _0x148ad3=this[_0xd33c('0xa4')](_0xd33c('0xb5'),'MRCP_RECOG_INSTANCE');if(_0x148ad3[_0xd33c('0xa5')]===-0x1){return _0x148ad3;}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format'](_0xd33c('0xb6'),_0x3d3067));};AGIVertices[_0xd33c('0x13')]['agi']=function(_0x4591dd){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0xb7'),_0x4591dd[_0xd33c('0x3b')]));return this[_0xd33c('0x11')]['agi']([_0x4591dd[_0xd33c('0xb8')],_0x4591dd[_0xd33c('0xb9')]]);};AGIVertices['prototype']['answer']=function(_0x2b86a3){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0xba'),_0x2b86a3[_0xd33c('0x3b')]));if(this['isConfigured'](_0x2b86a3[_0xd33c('0x69')])){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0xbb'),_0x2b86a3[_0xd33c('0x69')]));var _0x9aadad=this[_0xd33c('0x11')]['wait'](_0x2b86a3[_0xd33c('0x69')]);if(_0x9aadad['result']===-0x1){return _0x9aadad;}}return this['channel'][_0xd33c('0xbc')]();};AGIVertices[_0xd33c('0x13')][_0xd33c('0x4e')]=function(_0x418b35){logger['info'](util['format'](_0xd33c('0xbd'),_0x418b35[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x418b35['list_id'])){return this['channel'][_0xd33c('0x30')](_0x418b35,_0xd33c('0xbe'));}_0x418b35[_0xd33c('0x4f')]=moment();if(this[_0xd33c('0x87')](_0x418b35['delay'])){_0x418b35[_0xd33c('0x4f')]=moment()[_0xd33c('0xbf')](_0x418b35[_0xd33c('0xc0')],'minutes');}if(!this['isConfigured'](_0x418b35['callback_priority'])){_0x418b35[_0xd33c('0x50')]=0x2;}this['createCmContact'][_0xd33c('0x72')](this,_0x418b35);return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s',_0x418b35['phone'],_0x418b35[_0xd33c('0x4d')],_0x418b35[_0xd33c('0x4f')]));};AGIVertices[_0xd33c('0x13')][_0xd33c('0xc1')]=function(_0x3d4879){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0xc2'),_0x3d4879[_0xd33c('0x3b')]));var _0x1def31=this[_0xd33c('0x11')][_0xd33c('0x5a')](_0x3d4879[_0xd33c('0xc3')],_0x3d4879[_0xd33c('0x7b')]);if(_0x1def31['result']===-0x1){return _0x1def31;}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format'](_0xd33c('0xc4'),_0x3d4879[_0xd33c('0xc3')],_0x3d4879['options']));};AGIVertices['prototype']['lumenvoxtts']=function(_0x54ab8e){logger[_0xd33c('0x32')](util['format'](_0xd33c('0xc5'),_0x54ab8e[_0xd33c('0x3b')]));if(!this['isConfigured'](_0x54ab8e[_0xd33c('0x5f')])){return this[_0xd33c('0x11')]['noop'](_0xd33c('0xaa'));}var _0x43c78d='\x22'+_0x54ab8e[_0xd33c('0x5f')]+'\x22';if(this[_0xd33c('0x87')](_0x54ab8e[_0xd33c('0x7b')])){_0x43c78d+=','+_0x54ab8e[_0xd33c('0x7b')];}var _0x246f6a=this[_0xd33c('0x11')][_0xd33c('0x5a')]('MRCPSynth',_0x43c78d);if(_0x246f6a[_0xd33c('0xa5')]===-0x1){return _0x246f6a;}return this[_0xd33c('0x11')]['noop'](util[_0xd33c('0x2d')](_0xd33c('0xac'),_0x43c78d));};AGIVertices['prototype'][_0xd33c('0xc6')]=function(_0x233340){logger['info'](util[_0xd33c('0x2d')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x233340[_0xd33c('0x3b')]));if(!this['isConfigured'](_0x233340['text'])){return this['channel']['noop'](_0xd33c('0xaa'));}var _0x27da76='\x22'+_0x233340['text']+'\x22';if(this[_0xd33c('0x87')](_0x233340[_0xd33c('0x7b')])){_0x27da76+=','+_0x233340['options'];}var _0x3a614b=this[_0xd33c('0x11')][_0xd33c('0x5a')]('MRCPSynth',_0x27da76);if(_0x3a614b[_0xd33c('0xa5')]===-0x1){return _0x3a614b;}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0xac'),_0x27da76));};AGIVertices[_0xd33c('0x13')][_0xd33c('0xc7')]=function(_0x110c9e){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0xc8'),_0x110c9e[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x110c9e[_0xd33c('0xaf')])){return this['channel'][_0xd33c('0xa9')](_0xd33c('0xb0'));}var _0x2f1bd9=_0x110c9e[_0xd33c('0xaf')];if(this['isConfigured'](_0x110c9e[_0xd33c('0x7b')])){_0x2f1bd9+=','+_0x110c9e['options'];}var _0xca7958=this[_0xd33c('0x11')][_0xd33c('0x5a')](_0xd33c('0xb1'),_0x2f1bd9);if(_0xca7958[_0xd33c('0xa5')]===-0x1){return _0xca7958;}var _0x4e4f51=this[_0xd33c('0xa4')]('RECOG_CONFIDENCE()',_0xd33c('0xc9'));if(_0x4e4f51[_0xd33c('0xa5')]===-0x1){return _0x4e4f51;}var _0x8c6254=this[_0xd33c('0xa4')](_0xd33c('0xb4'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x8c6254[_0xd33c('0xa5')]===-0x1){return _0x8c6254;}var _0x15e125=this[_0xd33c('0xa4')](_0xd33c('0xb5'),'LUMENVOX_ASR_INSTANCE');if(_0x15e125[_0xd33c('0xa5')]===-0x1){return _0x15e125;}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format'](_0xd33c('0xb6'),_0x2f1bd9));};AGIVertices[_0xd33c('0x13')]['sestekasr']=function(_0x1367c5){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x1367c5[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x1367c5['grammar'])){return this[_0xd33c('0x11')][_0xd33c('0xa9')]('no\x20grammar\x20configured');}var _0x384a79=_0x1367c5[_0xd33c('0xaf')];if(this[_0xd33c('0x87')](_0x1367c5[_0xd33c('0x7b')])){_0x384a79+=','+_0x1367c5[_0xd33c('0x7b')];}var _0x5cca16=this[_0xd33c('0x11')][_0xd33c('0x5a')](_0xd33c('0xb1'),_0x384a79);if(_0x5cca16[_0xd33c('0xa5')]===-0x1){return _0x5cca16;}var _0x1ddb43=this[_0xd33c('0xa4')]('RECOG_CONFIDENCE()','SESTEK_ASR_CONFIDENCE');if(_0x1ddb43[_0xd33c('0xa5')]===-0x1){return _0x1ddb43;}var _0x47ab65=this[_0xd33c('0xa4')](_0xd33c('0xb4'),_0xd33c('0xca'));if(_0x47ab65['result']===-0x1){return _0x47ab65;}var _0xf6c6d0=this[_0xd33c('0xa4')](_0xd33c('0xb5'),_0xd33c('0xcb'));if(_0xf6c6d0[_0xd33c('0xa5')]===-0x1){return _0xf6c6d0;}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format'](_0xd33c('0xb6'),_0x384a79));};AGIVertices[_0xd33c('0x13')]['database']=function(_0x23891a){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0xcc'),_0x23891a[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x23891a[_0xd33c('0xcd')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x23891a,'no\x20database\x20selected');}var _0x3bbcce=this[_0xd33c('0x1e')][_0xd33c('0x72')](this,_0x23891a[_0xd33c('0xcd')]);if(!_0x3bbcce){return this[_0xd33c('0x11')]['error'](_0x23891a,_0xd33c('0xce'));}if(!this[_0xd33c('0x87')](_0x23891a[_0xd33c('0xcf')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x23891a,_0xd33c('0xd0'));}var _0x54c141=_0x23891a[_0xd33c('0xcf')][_0xd33c('0x5b')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('query:\x20%s',_0x54c141));var _0x3b9849=this['getQueryOdbc'][_0xd33c('0x72')](this,_0x3bbcce,_0x54c141);this['createSquareDetailsReport'][_0xd33c('0x72')](this,_0x23891a,_0x54c141);if(!this[_0xd33c('0x87')](_0x23891a[_0xd33c('0xd1')])){return this[_0xd33c('0x11')]['noop'](_0xd33c('0xd2'));}var _0x4ae22d=this[_0xd33c('0x14')][_0xd33c('0x72')](this,_0x23891a['variable_id']);if(!_0x4ae22d){return this[_0xd33c('0x11')]['error'](_0x23891a,_0xd33c('0xd3'));}var _0x36990b=this;_0x3b9849[_0xd33c('0xd4')](function(_0x4ddf74,_0x2d9a2d){Object[_0xd33c('0xd5')](_0x4ddf74)[_0xd33c('0xd4')](function(_0x530b0d){_0x36990b[_0xd33c('0x11')][_0xd33c('0xa0')](util[_0xd33c('0x2d')]('%s[%s][%s]',_0x4ae22d,_0x2d9a2d,_0x530b0d),_0x4ddf74[_0x530b0d]);});});this[_0xd33c('0x11')][_0xd33c('0xa0')](util[_0xd33c('0x2d')](_0xd33c('0xd6'),_0x4ae22d),_0x3b9849[_0xd33c('0x9f')]);return this[_0xd33c('0x11')]['noop'](util[_0xd33c('0x2d')](_0xd33c('0xd7'),_0x4ae22d));};AGIVertices[_0xd33c('0x13')][_0xd33c('0xd8')]=function(_0x3011ab){logger[_0xd33c('0xd9')](util[_0xd33c('0x2d')](_0xd33c('0xda'),_0x3011ab['label']));if(!this[_0xd33c('0x87')](_0x3011ab[_0xd33c('0xdb')])){return this['channel'][_0xd33c('0x30')](_0x3011ab,_0xd33c('0xdc'));}var _0x3a17f5=this[_0xd33c('0xdd')][_0xd33c('0x72')](this,_0x3011ab[_0xd33c('0xdb')]);if(!_0x3a17f5){return this[_0xd33c('0x11')]['error'](_0x3011ab,'no\x20user\x20found');}var _0x248547=this[_0xd33c('0x11')][_0xd33c('0x5a')]('DIAL',[util[_0xd33c('0x2d')]('SIP/%s',_0x3a17f5),_0x3011ab[_0xd33c('0x69')],_0x3011ab[_0xd33c('0xde')],_0x3011ab[_0xd33c('0x67')]]);if(_0x248547[_0xd33c('0xa5')]===-0x1){return _0x248547;}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('Executed\x20command\x20%s','DIAL'));};AGIVertices['prototype'][_0xd33c('0xdf')]=function(_0x129529){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0xe0'),_0x129529[_0xd33c('0x3b')]));if(!this['isConfigured'](_0x129529[_0xd33c('0x7d')])){return this['channel'][_0xd33c('0xa9')](_0xd33c('0xe1'));}if(!this[_0xd33c('0x87')](_0x129529['text'])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xaa'));}this[_0xd33c('0x11')][_0xd33c('0xe2')]=!![];this[_0xd33c('0x3a')](_0x129529);this[_0xd33c('0x47')](_0x129529[_0xd33c('0x5f')],'in','','');this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0xe3'),_0x129529['text']));var _0x1b04c0=this[_0xd33c('0x7c')][_0xd33c('0x72')](this,_0x129529);if(_0x1b04c0){for(var _0x1c45d8 in _0x1b04c0){if(_0x1b04c0[_0xd33c('0x99')](_0x1c45d8)){this[_0xd33c('0x11')]['setVariable'](util[_0xd33c('0x2d')]('DIALOGFLOW_%s',_0x1c45d8['toUpperCase']()),_0x1b04c0[_0x1c45d8]);}}this[_0xd33c('0x47')](_0x1b04c0[_0xd33c('0xe4')],_0xd33c('0xe5'),'dialogflow','');return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('Dialogflow\x20Result\x20%s',_0x1b04c0[_0xd33c('0xe4')]));}return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x129529,_0xd33c('0xe6'));};AGIVertices[_0xd33c('0x13')][_0xd33c('0xe7')]=function(_0x595970){logger[_0xd33c('0x32')](util['format'](_0xd33c('0xe8'),_0x595970['label']));if(!this[_0xd33c('0x87')](_0x595970[_0xd33c('0x7f')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xe9'));}if(!this['isConfigured'](_0x595970['client_email'])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xea'));}if(!this[_0xd33c('0x87')](_0x595970[_0xd33c('0x80')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')]('no\x20private_key\x20configured');}if(!this[_0xd33c('0x87')](_0x595970[_0xd33c('0xeb')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xec'));}if(!this[_0xd33c('0x87')](_0x595970[_0xd33c('0x5f')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xaa'));}this[_0xd33c('0x11')][_0xd33c('0xe2')]=!![];this[_0xd33c('0x3a')](_0x595970);this[_0xd33c('0x47')](_0x595970[_0xd33c('0x5f')],'in','','');this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0xed'),_0x595970[_0xd33c('0x5f')]));var _0x1e2550=this[_0xd33c('0x7e')][_0xd33c('0x72')](this,_0x595970);if(_0x1e2550){for(var _0x1a695a in _0x1e2550){if(_0x1e2550[_0xd33c('0x99')](_0x1a695a)){if(_0x1a695a!=='providerResponse'){this[_0xd33c('0x11')][_0xd33c('0xa0')](util[_0xd33c('0x2d')](_0xd33c('0xee'),_0x1a695a[_0xd33c('0x6c')]()),_0x1e2550[_0x1a695a]);}}}this[_0xd33c('0x47')](_0x1e2550['speech'],_0xd33c('0xe5'),'dialogflowV2',_0x1e2550['providerResponse']);return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0xef'),_0x1e2550[_0xd33c('0xe4')]));}return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x595970,_0xd33c('0xf0'));};AGIVertices[_0xd33c('0x13')][_0xd33c('0xf1')]=function(_0x273748){logger[_0xd33c('0x32')](util['format'](_0xd33c('0xf2'),_0x273748[_0xd33c('0x3b')]));if(!this['isConfigured'](_0x273748['ndauth_url'])){return this[_0xd33c('0x11')][_0xd33c('0xa9')]('no\x20ndauth\x20url\x20configured');}if(!this[_0xd33c('0x87')](_0x273748[_0xd33c('0xf3')])){return this[_0xd33c('0x11')]['noop']('no\x20username\x20configured');}if(!this[_0xd33c('0x87')](_0x273748['password'])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xf4'));}if(!this['isConfigured'](_0x273748[_0xd33c('0xf5')])){return this['channel'][_0xd33c('0xa9')]('no\x20text\x20configured');}this['channel'][_0xd33c('0xe2')]=!![];this[_0xd33c('0x3a')](_0x273748);this[_0xd33c('0x47')](_0x273748['text'],'in','','');this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('Trying\x20SestekNDA:\x20%s',_0x273748[_0xd33c('0x5f')]));var _0x686375=this[_0xd33c('0x81')][_0xd33c('0x72')](this,_0x273748);if(_0x686375){for(var _0xda660 in _0x686375){if(_0x686375[_0xd33c('0x99')](_0xda660)){this['channel'][_0xd33c('0xa0')](util[_0xd33c('0x2d')](_0xd33c('0xf6'),_0xda660['toUpperCase']()),_0x686375[_0xda660]);}}this[_0xd33c('0x47')](_0x686375[_0xd33c('0xe4')],_0xd33c('0xe5'),_0xd33c('0xf1'),'');if(_0x686375[_0xd33c('0xf7')]){this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0xf8'),_0x686375[_0xd33c('0xf7')]));var _0x3320ea=this[_0xd33c('0x11')][_0xd33c('0xf9')](_0x686375[_0xd33c('0xf7')]);try{fs['unlink'](_0x686375[_0xd33c('0xf7')]+_0xd33c('0xfa'));}catch(_0x7437aa){logger[_0xd33c('0x30')](_0x7437aa);}return _0x3320ea;}else{return this[_0xd33c('0x11')]['noop'](util['format'](_0xd33c('0xfb'),_0x686375['speech']));}}return this['channel'][_0xd33c('0x30')](_0x273748,'SestekNDA\x20is\x20unreachable');};AGIVertices[_0xd33c('0x13')][_0xd33c('0xfc')]=function(_0x5d277a){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0xfd'),_0x5d277a['label']));return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xfc'));};AGIVertices[_0xd33c('0x13')][_0xd33c('0xfe')]=function(_0x546a90){logger['info'](util[_0xd33c('0x2d')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x546a90['label']));var _0x371820='';if(_0x546a90[_0xd33c('0xff')]){if(!this[_0xd33c('0x87')](_0x546a90[_0xd33c('0xff')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x546a90,_0xd33c('0x100'));}else{var _0x58038f=parseInt(_0x546a90[_0xd33c('0xff')],0xa);if(isNaN(_0x58038f)){_0x371820=_0x546a90[_0xd33c('0xff')];}else{_0x371820=this['getTrunk']['sync'](this,_0x546a90[_0xd33c('0xff')]);if(!_0x371820){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x546a90,_0xd33c('0x101'));}}}}else if(_0x546a90['trunk_name']){_0x371820=_0x546a90['trunk_name'];}else{return this['channel']['error'](_0x546a90,'no\x20trunk\x20selected');}var _0x10392e=this['channel'][_0xd33c('0x5a')](_0xd33c('0x102'),[util[_0xd33c('0x2d')](_0xd33c('0x103'),_0x371820,_0x546a90[_0xd33c('0x104')]),_0x546a90['timeout'],_0x546a90[_0xd33c('0xde')],_0x546a90['url']]);if(_0x10392e[_0xd33c('0xa5')]===-0x1){return _0x10392e;}return this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x105'),_0xd33c('0x102')));};AGIVertices[_0xd33c('0x13')][_0xd33c('0x106')]=function(_0x3a4c55){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x107'),_0x3a4c55['label']));return this[_0xd33c('0x11')]['noop']('finally');};AGIVertices[_0xd33c('0x13')][_0xd33c('0xf')]=function(_0x482f66){logger[_0xd33c('0x32')](util['format'](_0xd33c('0x108'),_0x482f66['label']));if(_0x482f66[_0xd33c('0x109')]===0x0){return this[_0xd33c('0xa7')](_0x482f66);}_0x482f66[_0xd33c('0x109')]-=0x1;if(!this[_0xd33c('0x87')](_0x482f66['file_id'])){return this['channel']['error'](_0x482f66,_0xd33c('0x10a'));}var _0xa516f2=this['getSound']['sync'](this,_0x482f66[_0xd33c('0x10b')]);if(!_0xa516f2){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x482f66,_0xd33c('0x10c'));}if(!this[_0xd33c('0x87')](_0x482f66['variable_id'])){return this[_0xd33c('0x11')]['error']('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x210fd6=this[_0xd33c('0x11')][_0xd33c('0x10d')](_0xa516f2,_0x482f66['response'],_0x482f66[_0xd33c('0x10e')]);var _0x3eb46c=_0x210fd6[_0xd33c('0xa5')]?_0x210fd6[_0xd33c('0xa5')][_0xd33c('0x10f')]():'';logger[_0xd33c('0x32')](_0xd33c('0x110'),JSON[_0xd33c('0x75')](_0x210fd6));if(_0x210fd6[_0xd33c('0xa5')]===-0x1){this[_0xd33c('0x3a')]['sync'](this,_0x482f66,_0x3eb46c);return _0x210fd6;}else if(_0x210fd6[_0xd33c('0xa3')]===_0xd33c('0x69')){_0x210fd6[_0xd33c('0xa5')]=_0x3eb46c['length']>=parseInt(_0x482f66[_0xd33c('0x111')])?'x':'i';}else{_0x210fd6['result']=_0x3eb46c[_0xd33c('0x9f')]>=parseInt(_0x482f66['mindigit'])&&_0x3eb46c['length']<=parseInt(_0x482f66['maxdigit'])?'x':'i';}var _0x115581=this[_0xd33c('0x14')][_0xd33c('0x72')](this,_0x482f66[_0xd33c('0xd1')]);if(!_0x115581){return this[_0xd33c('0x11')]['error'](_0x482f66,'no\x20variable\x20found');}this['channel']['setVariable'](_0x115581,_0x3eb46c);if(this[_0xd33c('0x87')](_0x482f66[_0xd33c('0x112')])){var _0x546a68=parseInt(_0x482f66['hiddendigitsnum'],0xa);var _0x4dd9a7=rs[_0xd33c('0x113')]({'charset':'*','length':_0x546a68});var _0x50d71b=_0x3eb46c[_0xd33c('0x9f')];if(_0x50d71b>0x0){if(_0x50d71b>_0x546a68){this[_0xd33c('0x3a')][_0xd33c('0x72')](this,_0x482f66,_0x482f66[_0xd33c('0x114')]===_0xd33c('0x115')?_0x4dd9a7+_0x3eb46c['substr'](_0x546a68):_0x3eb46c['substr'](0x0,_0x50d71b-_0x546a68)+_0x4dd9a7);}else{this['createSquareDetailsReport'][_0xd33c('0x72')](this,_0x482f66,rs[_0xd33c('0x113')]({'charset':'*','length':_0x50d71b}));}}else{this[_0xd33c('0x3a')][_0xd33c('0x72')](this,_0x482f66,'');}}else{this[_0xd33c('0x3a')]['sync'](this,_0x482f66,_0x3eb46c);}return _0x210fd6;};AGIVertices[_0xd33c('0x13')][_0xd33c('0x10')]=function(_0x22db57){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x116'),_0x22db57[_0xd33c('0x3b')]));return this['getdigits'](_0x22db57);};AGIVertices[_0xd33c('0x13')]['goal']=function(_0x3f9d74){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x117'),_0x3f9d74[_0xd33c('0x3b')]));this[_0xd33c('0x3a')][_0xd33c('0x72')](this,_0x3f9d74,_0x3f9d74[_0xd33c('0x118')]);return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('GOAL\x20%s',_0x3f9d74['goalname']));};AGIVertices['prototype'][_0xd33c('0x119')]=function(_0x361d89){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x361d89[_0xd33c('0x3b')]));if(!this['isConfigured'](_0x361d89[_0xd33c('0x89')])||!this[_0xd33c('0x87')](_0x361d89[_0xd33c('0x8a')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')]('no\x20valid\x20credentials\x20configured');}if(!this[_0xd33c('0x87')](_0x361d89['text'])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xaa'));}this['channel'][_0xd33c('0xa9')](util['format']('Trying\x20aws\x20Polly\x20%s',_0x361d89[_0xd33c('0x5f')]));var _0x589bb0=this['awsPolly'][_0xd33c('0x72')](this,_0x361d89);if(_0x589bb0){this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('aws\x20Polly\x20%s\x20file\x20created',_0x589bb0));var _0x5a099d=this[_0xd33c('0x11')]['streamFile'](_0x589bb0);try{fs[_0xd33c('0x11a')](_0x589bb0+_0xd33c('0xfa'));}catch(_0x3fae99){logger['error'](_0x3fae99);}return _0x5a099d;}return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x361d89,_0xd33c('0x11b'));};AGIVertices[_0xd33c('0x13')]['awslex']=function(_0x16f1c3){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x11c'),_0x16f1c3['label']));if(!this[_0xd33c('0x87')](_0x16f1c3[_0xd33c('0x89')])||!this[_0xd33c('0x87')](_0x16f1c3[_0xd33c('0x8a')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x11d'));}if(!this[_0xd33c('0x87')](_0x16f1c3[_0xd33c('0x91')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')]('no\x20bot\x20name\x20configured');}if(!this[_0xd33c('0x87')](_0x16f1c3[_0xd33c('0x5f')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xaa'));}this[_0xd33c('0x11')][_0xd33c('0xe2')]=!![];this[_0xd33c('0x3a')](_0x16f1c3);this['createSquareMessage'](_0x16f1c3[_0xd33c('0x5f')],'in','','');this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('Trying\x20Amazon\x20Lex:\x20%s',_0x16f1c3[_0xd33c('0x5f')]));var _0x137785=this[_0xd33c('0x8f')][_0xd33c('0x72')](this,_0x16f1c3);if(_0x137785){for(var _0x4f31bf in _0x137785){if(_0x137785[_0xd33c('0x99')](_0x4f31bf)&&_[_0xd33c('0x9c')](_0x137785[_0x4f31bf])){this[_0xd33c('0x11')][_0xd33c('0xa0')](util[_0xd33c('0x2d')](_0xd33c('0x11e'),_0x4f31bf['toUpperCase']()),_0x137785[_0x4f31bf]);}}if(_[_0xd33c('0x4a')](_0x137785[_0xd33c('0x79')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x11f'));}else{this['createSquareMessage'](_0x137785['message'],_0xd33c('0xe5'),'amazonlex','');return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x120'),_0x137785[_0xd33c('0x79')]));}}return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x16f1c3,_0xd33c('0x121'));};AGIVertices[_0xd33c('0x13')][_0xd33c('0x122')]=function(_0x16b4de){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x123'),_0x16b4de[_0xd33c('0x3b')],_0x16b4de[_0xd33c('0x69')]));if(!this['isConfigured'](_0x16b4de[_0xd33c('0x7d')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xe1'));}var _0x17fb88='wav';var _0x4ab875=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xd33c('0x113')](0x4));var _0x4e78d3=util[_0xd33c('0x2d')](_0xd33c('0x9e'),_0x4ab875,_0x17fb88);var _0x4d8c62=!![];if(_0x16b4de[_0xd33c('0x124')]===_0xd33c('0x125')){_0x4d8c62=![];}var _0x5cb7f1=this[_0xd33c('0x11')]['recordFile'](_0x4ab875,_0x17fb88,_0x16b4de[_0xd33c('0x126')],_0x16b4de[_0xd33c('0x69')],undefined,_0x4d8c62);if(_0x5cb7f1[_0xd33c('0xa5')]!==-0x1){this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x127'),_0x4e78d3));var _0x3a190b=this['googleASR'][_0xd33c('0x72')](this,_0x16b4de,_0x4e78d3);if(_0x3a190b){for(var _0x3e30a7 in _0x3a190b){if(_0x3a190b[_0xd33c('0x99')](_0x3e30a7)){this[_0xd33c('0x11')][_0xd33c('0xa0')](util[_0xd33c('0x2d')]('GOOGLE_ASR_%s',_0x3e30a7[_0xd33c('0x6c')]()),_0x3a190b[_0x3e30a7]);}}return this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x128'),JSON[_0xd33c('0x75')](_0x3a190b)));}}return _0x5cb7f1;};AGIVertices['prototype'][_0xd33c('0x129')]=function(_0x4ca44d){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x12a'),_0x4ca44d[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x4ca44d[_0xd33c('0x93')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x12b'));}if(!this[_0xd33c('0x87')](_0x4ca44d[_0xd33c('0x94')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x12c'));}var _0x1b954e=_0xd33c('0x12d');var _0x26c434=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xd33c('0x113')](0x4));var _0x2d9028=util['format'](_0xd33c('0x9e'),_0x26c434,_0x1b954e);var _0x19bf58=!![];if(_0x4ca44d['beep']===_0xd33c('0x125')){_0x19bf58=![];}var _0x2a1884=this[_0xd33c('0x11')][_0xd33c('0x12e')](_0x26c434,_0x1b954e,_0x4ca44d[_0xd33c('0x126')],_0x4ca44d[_0xd33c('0x69')],undefined,_0x19bf58);if(_0x2a1884['result']!==-0x1){this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('tilde\x20%s\x20file\x20created',_0x2d9028));var _0x1be048=this[_0xd33c('0x12f')]['sync'](this,_0x4ca44d,_0x2d9028);if(_0x1be048){for(var _0x504b39 in _0x1be048){if(_0x1be048[_0xd33c('0x99')](_0x504b39)){this[_0xd33c('0x11')][_0xd33c('0xa0')](util[_0xd33c('0x2d')]('TILDE_ASR_%s',_0x504b39['toUpperCase']()),_0x1be048[_0x504b39]);}}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x130'),JSON[_0xd33c('0x75')](_0x1be048)));}}return _0x2a1884;};AGIVertices[_0xd33c('0x13')][_0xd33c('0x131')]=function(_0x2dbf97){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x132'),_0x2dbf97[_0xd33c('0x3b')]));return this[_0xd33c('0x11')]['continueAt'](_0x2dbf97['context'],_0x2dbf97[_0xd33c('0x42')],_0x2dbf97[_0xd33c('0x43')]);};AGIVertices[_0xd33c('0x13')]['gotoif']=function(_0x2e8222){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x133'),_0x2e8222[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x2e8222[_0xd33c('0x134')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x2e8222,_0xd33c('0x135'));}try{var _0x16cba5=eval(_0x2e8222[_0xd33c('0x134')])?_0xd33c('0x136'):_0xd33c('0x137');this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x138'),_0x2e8222[_0xd33c('0x134')],_0x16cba5));return{'code':0xc8,'result':_0x16cba5};}catch(_0x3c4bba){return{'code':0xc8,'result':_0xd33c('0x137')};}};AGIVertices[_0xd33c('0x13')][_0xd33c('0x139')]=function(_0x1e4292){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x13a'),_0x1e4292[_0xd33c('0x3b')]));if(!this['isConfigured'](_0x1e4292[_0xd33c('0x13b')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x1e4292,_0xd33c('0x13c'));}var _0x10617e=this['getIntervals'][_0xd33c('0x72')](this,_0x1e4292[_0xd33c('0x13b')]);if(!_0x10617e){return this['channel'][_0xd33c('0x30')](_0x1e4292,_0xd33c('0x13d'));}for(var _0xc8d831=0x0;_0xc8d831<_0x10617e[_0xd33c('0x9f')];_0xc8d831+=0x1){var _0x4c73ba=this[_0xd33c('0x11')]['getVariable'](util[_0xd33c('0x2d')](_0xd33c('0x13e'),_0x10617e[_0xc8d831]));if(_0x4c73ba[_0xd33c('0xa5')]===-0x1){return _0x4c73ba;}logger['info'](util[_0xd33c('0x2d')]('IFTIME\x20%s\x20%s',_0x10617e[_0xc8d831],_0x4c73ba['extra']));if(_0x4c73ba[_0xd33c('0xa3')]===_0xd33c('0x136')){logger['info'](util['format'](_0xd33c('0x13f'),_0x10617e[_0xc8d831],_0xd33c('0x136')));this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x13f'),_0x10617e[_0xc8d831],'true'));return{'code':0xc8,'result':_0xd33c('0x136')};}else{logger[_0xd33c('0x32')](util[_0xd33c('0x2d')]('IFTIME\x20%s\x20%s',_0x10617e[_0xc8d831],_0xd33c('0x137')));this[_0xd33c('0x11')]['noop'](util['format'](_0xd33c('0x13f'),_0x10617e[_0xc8d831],'false'));}}return{'code':0xc8,'result':_0xd33c('0x137')};};AGIVertices[_0xd33c('0x13')][_0xd33c('0x140')]=function(_0x1c4110){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x141'),_0x1c4110['label']));return this['channel'][_0xd33c('0x140')]();};AGIVertices[_0xd33c('0x13')][_0xd33c('0x142')]=function(_0x4839b8){logger[_0xd33c('0x32')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x4839b8[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x4839b8[_0xd33c('0x7d')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xe1'));}var _0x1f7b2f=_0xd33c('0x12d');var _0x1b6568=util[_0xd33c('0x2d')](_0xd33c('0x143'),FILES_PATH,rs[_0xd33c('0x113')](0x4));var _0x3ca591=util[_0xd33c('0x2d')](_0xd33c('0x9e'),_0x1b6568,_0x1f7b2f);var _0x535b40=!![];if(_0x4839b8['beep']===_0xd33c('0x125')){_0x535b40=![];}var _0x5a4f0e=this['channel']['recordFile'](_0x1b6568,_0x1f7b2f,_0x4839b8[_0xd33c('0x126')],_0x4839b8[_0xd33c('0x69')],undefined,_0x535b40);if(_0x5a4f0e[_0xd33c('0xa5')]!==-0x1){this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format']('ispeech\x20%s\x20file\x20created',_0x3ca591));var _0x32f9ad=this['ispeechASR'][_0xd33c('0x72')](this,_0x4839b8,_0x3ca591);if(_0x32f9ad){for(var _0x37a89b in _0x32f9ad){if(_0x32f9ad[_0xd33c('0x99')](_0x37a89b)){this[_0xd33c('0x11')][_0xd33c('0xa0')](util[_0xd33c('0x2d')](_0xd33c('0x144'),_0x37a89b['toUpperCase']()),_0x32f9ad[_0x37a89b]);}}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('IspeechASR\x20Result\x20%s',JSON[_0xd33c('0x75')](_0x32f9ad)));}}return _0x5a4f0e;};AGIVertices[_0xd33c('0x13')][_0xd33c('0x145')]=function(_0x23bfa9){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x146'),_0x23bfa9[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x23bfa9[_0xd33c('0x7d')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xe1'));}if(!this['isConfigured'](_0x23bfa9[_0xd33c('0x5f')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xaa'));}this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('Trying\x20ispeech\x20TTS\x20%s',_0x23bfa9['text']));var _0x25e58b=this[_0xd33c('0x82')][_0xd33c('0x72')](this,_0x23bfa9);if(_0x25e58b){this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format'](_0xd33c('0x147'),_0x25e58b));var _0x54fad8=this[_0xd33c('0x11')][_0xd33c('0xf9')](_0x25e58b,_0x23bfa9[_0xd33c('0x126')]);try{fs[_0xd33c('0x11a')](_0x25e58b+_0xd33c('0xfa'));}catch(_0x6d47bf){logger['error'](_0x6d47bf);}return _0x54fad8;}return this['channel'][_0xd33c('0x30')](_0x23bfa9,_0xd33c('0x148'));};AGIVertices[_0xd33c('0x13')][_0xd33c('0x149')]=function(_0x52f957){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x14a'),_0x52f957[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x52f957[_0xd33c('0x14b')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x52f957,_0xd33c('0x14c'));}logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x14d'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x52f957['findBy']));var _0x5ad04f=this[_0xd33c('0x56')]['sync'](this,_0x52f957[_0xd33c('0x14b')]);if(_0x5ad04f){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x14e'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x52f957[_0xd33c('0x14b')]));this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x52f957['findBy']));return{'code':0xc8,'result':'success'};}else{logger[_0xd33c('0x32')](util['format'](_0xd33c('0x14f'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x52f957['findBy']));this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xd33c('0x11')]['callerid'],_0x52f957['findBy']));return{'code':0xc8,'result':_0xd33c('0x150')};}};AGIVertices['prototype'][_0xd33c('0x151')]=function(_0x1b7b08){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x152'),_0x1b7b08['label']));if(!this['isConfigured'](_0x1b7b08[_0xd33c('0x14b')])){return this['channel'][_0xd33c('0x30')](_0x1b7b08,_0xd33c('0x14c'));}logger[_0xd33c('0x32')](util[_0xd33c('0x2d')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x1b7b08[_0xd33c('0x14b')]));var _0xb91749=this[_0xd33c('0x55')][_0xd33c('0x72')](this,_0x1b7b08[_0xd33c('0x14b')]);if(_0xb91749){logger['info'](util['format'](_0xd33c('0x14e'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x1b7b08[_0xd33c('0x14b')]));this[_0xd33c('0x11')]['noop'](util[_0xd33c('0x2d')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x1b7b08[_0xd33c('0x14b')]));return{'code':0xc8,'result':_0xd33c('0x153')};}else{logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x14f'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x1b7b08[_0xd33c('0x14b')]));this['channel'][_0xd33c('0xa9')](util['format'](_0xd33c('0x14f'),this[_0xd33c('0x11')]['callerid'],_0x1b7b08['findBy']));return{'code':0xc8,'result':_0xd33c('0x150')};}};AGIVertices[_0xd33c('0x13')][_0xd33c('0x154')]=function(_0x3187c0){logger[_0xd33c('0x32')](util['format'](_0xd33c('0x155'),_0x3187c0['label']));if(!this[_0xd33c('0x87')](_0x3187c0[_0xd33c('0x156')])){return this[_0xd33c('0x11')]['error'](_0x3187c0,_0xd33c('0x157'));}this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')]('math\x20%s',_0x3187c0[_0xd33c('0x156')]));var _0x43783d=eval(_0x3187c0['operation']);if(!this['isConfigured'](_0x3187c0[_0xd33c('0xd1')])){return this['channel'][_0xd33c('0xa9')](_0xd33c('0xd2'));}var _0x41aede=this[_0xd33c('0x14')][_0xd33c('0x72')](this,_0x3187c0[_0xd33c('0xd1')]);if(!_0x41aede){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x3187c0,'no\x20variable\x20found');}if(_['isArray'](_0x43783d)){var _0x100b97=this;_0x43783d[_0xd33c('0xd4')](function(_0x1381ae,_0x38edd4){_0x100b97['channel'][_0xd33c('0xa0')](util[_0xd33c('0x2d')](_0xd33c('0x158'),_0x41aede,_0x38edd4),_0x1381ae);});return this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x159'),_0x41aede));}else{return this[_0xd33c('0x11')][_0xd33c('0xa0')](_0x41aede,_0x43783d);}};AGIVertices[_0xd33c('0x13')][_0xd33c('0xe')]=function(_0x2e9a49){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x15a'),_0x2e9a49[_0xd33c('0x3b')]));if(_0x2e9a49['retry']===0x0){return this[_0xd33c('0xa7')](_0x2e9a49);}_0x2e9a49[_0xd33c('0x109')]-=0x1;if(!this['isConfigured'](_0x2e9a49['file_id'])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x2e9a49,_0xd33c('0x10a'));}var _0x533a03=this[_0xd33c('0x22')][_0xd33c('0x72')](this,_0x2e9a49[_0xd33c('0x10b')]);if(!_0x533a03){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x2e9a49,'no\x20file\x20audio\x20found');}var _0x5de9eb=this[_0xd33c('0x11')][_0xd33c('0x10d')](_0x533a03,_0x2e9a49[_0xd33c('0x15b')],_0x2e9a49[_0xd33c('0x15c')]);var _0xf6c8f=_0x5de9eb[_0xd33c('0xa5')];if(_0x5de9eb[_0xd33c('0xa5')]===-0x1){this[_0xd33c('0x3a')][_0xd33c('0x72')](this,_0x2e9a49,'-1');return _0x5de9eb;}else if(_0x5de9eb[_0xd33c('0xa3')]==='timeout'){_0x5de9eb[_0xd33c('0xa5')]=_0x5de9eb[_0xd33c('0xa5')][_0xd33c('0x9f')]>0x0?_0x5de9eb[_0xd33c('0xa5')]:'t';}else if(_['isEmpty'](_0x5de9eb['result'])){_0x5de9eb[_0xd33c('0xa5')]='#';_0xf6c8f='#';}if(!this['isConfigured'](_0x2e9a49[_0xd33c('0xd1')])){this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xd2'));}else{var _0x502979=this[_0xd33c('0x14')]['sync'](this,_0x2e9a49[_0xd33c('0xd1')]);if(!_0x502979){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x2e9a49,_0xd33c('0xd3'));}this[_0xd33c('0x11')][_0xd33c('0xa0')](_0x502979,_0xf6c8f);}this['createSquareDetailsReport'][_0xd33c('0x72')](this,_0x2e9a49,_0xf6c8f);return _0x5de9eb;};AGIVertices[_0xd33c('0x13')]['noop']=function(_0xe6822d){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x15d'),_0xe6822d[_0xd33c('0x3b')]));return this[_0xd33c('0x11')]['noop'](_0xe6822d['output']||_0xe6822d[_0xd33c('0x3b')]);};AGIVertices[_0xd33c('0x13')][_0xd33c('0x15e')]=function(_0x1f15e4){logger[_0xd33c('0x32')](util['format'](_0xd33c('0x15f'),_0x1f15e4[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x1f15e4[_0xd33c('0x14b')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x1f15e4,_0xd33c('0x14c'));}logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x14d'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x1f15e4[_0xd33c('0x14b')]));var _0x27ec05=this[_0xd33c('0x160')][_0xd33c('0x72')](this,_0x1f15e4[_0xd33c('0x161')]);var _0x128e6a=this[_0xd33c('0x52')]['sync'](this,_0x1f15e4[_0xd33c('0x14b')],_0x27ec05);if(_0x128e6a){logger[_0xd33c('0x32')](util['format'](_0xd33c('0x14e'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x1f15e4[_0xd33c('0x14b')]));this['channel']['noop'](util[_0xd33c('0x2d')](_0xd33c('0x14e'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x1f15e4[_0xd33c('0x14b')]));return{'code':0xc8,'result':_0xd33c('0x153')};}else{logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x14f'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x1f15e4[_0xd33c('0x14b')]));this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format'](_0xd33c('0x14e'),this['channel'][_0xd33c('0x3e')],_0x1f15e4[_0xd33c('0x14b')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xd33c('0x13')][_0xd33c('0x162')]=function(_0x2da5db){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x163'),_0x2da5db[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x2da5db[_0xd33c('0x10b')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x2da5db,_0xd33c('0x10a'));}var _0x41437f=this['getSound'][_0xd33c('0x72')](this,_0x2da5db[_0xd33c('0x10b')]);if(!_0x41437f){return this[_0xd33c('0x11')]['error'](_0x2da5db,_0xd33c('0x10c'));}var _0x349e5b=this[_0xd33c('0x11')][_0xd33c('0x5a')](_0xd33c('0x164'),[_0x41437f,_0x2da5db[_0xd33c('0xde')]]);if(_0x349e5b[_0xd33c('0xa5')]===-0x1){return _0x349e5b;}return this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0xc4'),'PLAYBACK',_0x41437f));};AGIVertices[_0xd33c('0x13')]['queue']=function(_0x3beb0d){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x165'),_0x3beb0d[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x3beb0d[_0xd33c('0x166')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x3beb0d,_0xd33c('0x167'));}var _0x5bb47e='';var _0x53dc47=parseInt(_0x3beb0d[_0xd33c('0x166')],0xa);if(isNaN(_0x53dc47)){_0x5bb47e=_0x3beb0d[_0xd33c('0x166')];}else{_0x5bb47e=this['getVoiceQueue'][_0xd33c('0x72')](this,_0x3beb0d[_0xd33c('0x166')]);if(!_0x5bb47e){return this[_0xd33c('0x11')]['error'](_0x3beb0d,_0xd33c('0x168'));}}var _0x43f88b='';if(this[_0xd33c('0x87')](_0x3beb0d[_0xd33c('0x10b')])){var _0x222532=this[_0xd33c('0x22')][_0xd33c('0x72')](this,_0x3beb0d[_0xd33c('0x10b')]);if(_0x222532){_0x43f88b=_0x222532;}}this[_0xd33c('0x3a')][_0xd33c('0x72')](this,_0x3beb0d,_0x5bb47e);if(_0x3beb0d[_0xd33c('0xde')][_0xd33c('0x169')]('x')<0x0){_0x3beb0d[_0xd33c('0xde')]+='x';}if(_0x3beb0d[_0xd33c('0xde')][_0xd33c('0x169')]('X')<0x0){_0x3beb0d['opts']+='X';}this['channel']['setVariable']('XMCS-QUEUE',_0x5bb47e?_0x5bb47e[_0xd33c('0x16a')]():'');var _0x3be2f9=this[_0xd33c('0x11')]['exec'](_0xd33c('0x16b'),[_0x5bb47e,_0x3beb0d[_0xd33c('0xde')],_0x3beb0d['url'],_0x43f88b,_0x3beb0d[_0xd33c('0x69')],_0x3beb0d[_0xd33c('0x8')],_0x3beb0d[_0xd33c('0x16c')],_0x3beb0d['gosub'],'',_0x3beb0d[_0xd33c('0x16d')]]);if(_0x3be2f9['result']===-0x1){return _0x3be2f9;}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format']('Executed\x20command\x20%s\x20%s',_0xd33c('0x16b'),_0x5bb47e));};AGIVertices[_0xd33c('0x13')][_0xd33c('0x16e')]=function(_0x5896cd){logger[_0xd33c('0x32')](util['format'](_0xd33c('0x16f'),_0x5896cd[_0xd33c('0x3b')]));var _0x2b9c14=_0x5896cd[_0xd33c('0x170')]||_0xd33c('0x12d');var _0x21a7b2=util['format'](_0xd33c('0x171'),this[_0xd33c('0x11')][_0xd33c('0x40')],rs['generate'](0x5));var _0x25fcb2=util['format']('%s/recordings/%s.%s',FILES_PATH,_0x21a7b2,_0x2b9c14);var _0x4a04e5=util['format']('%s/recordings/%s',FILES_PATH,_0x21a7b2);this[_0xd33c('0x3f')][_0xd33c('0x72')](this,_0x5896cd,_0x21a7b2,_0x25fcb2);this[_0xd33c('0x11')][_0xd33c('0xa0')](_0xd33c('0x172'),_0x21a7b2);logger['info'](_0xd33c('0x173'),_0x4a04e5,_0x2b9c14,_0x5896cd[_0xd33c('0x174')],_0x5896cd[_0xd33c('0x69')]);return this[_0xd33c('0x11')][_0xd33c('0x12e')](_0x4a04e5,_0x2b9c14,_0x5896cd['escape_digits'],_0x5896cd[_0xd33c('0x69')],undefined,!![]);};AGIVertices[_0xd33c('0x13')][_0xd33c('0x175')]=function(_0x5b8b71){logger['info'](util['format'](_0xd33c('0x176'),_0x5b8b71[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x5b8b71[_0xd33c('0x67')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')]('no\x20url\x20configured');}var _0x4c0227=this['restAPI'][_0xd33c('0x72')](this,_0x5b8b71);logger['info'](util[_0xd33c('0x2d')]('Response:',util['inspect'](_0x4c0227,{'showHidden':![],'depth':null})));if(!this['isConfigured'](_0x5b8b71[_0xd33c('0xd1')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x177'));}var _0x22191a=this[_0xd33c('0x14')]['sync'](this,_0x5b8b71[_0xd33c('0xd1')]);if(!_0x22191a){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x5b8b71,_0xd33c('0xd3'));}this[_0xd33c('0x11')]['setVariable'](util[_0xd33c('0x2d')]('%s_STATUS_CODE',_0x22191a),_0x4c0227[_0xd33c('0x77')]?_0x4c0227[_0xd33c('0x77')]:'200');this[_0xd33c('0x11')][_0xd33c('0xa0')](util['format'](_0xd33c('0x178'),_0x22191a),_0x4c0227[_0xd33c('0x78')]?_0x4c0227[_0xd33c('0x78')]:'OK');if(_0x4c0227[_0xd33c('0x6d')]){try{this[_0xd33c('0x9d')](_0x4c0227[_0xd33c('0x6d')],_0x22191a);}catch(_0x33c7b9){logger[_0xd33c('0x30')](util['format'](_0xd33c('0x179'),_0x22191a));}}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format'](_0xd33c('0xd7'),_0x22191a));};AGIVertices[_0xd33c('0x13')][_0xd33c('0x17a')]=function(_0xc89c2e){logger[_0xd33c('0x32')](util['format'](_0xd33c('0x17b'),_0xc89c2e[_0xd33c('0x3b')]));return this[_0xd33c('0x11')][_0xd33c('0x17c')](_0xc89c2e['digits'][_0xd33c('0x5b')](/\s+/g,''),_0xc89c2e[_0xd33c('0x174')]);};AGIVertices[_0xd33c('0x13')][_0xd33c('0x17d')]=function(_0x399ab2){logger[_0xd33c('0x32')](util['format'](_0xd33c('0x17e'),_0x399ab2['label']));return this[_0xd33c('0x11')][_0xd33c('0x17f')](_0x399ab2['number'][_0xd33c('0x5b')](/\s+/g,''),_0x399ab2['escape_digits']);};AGIVertices[_0xd33c('0x13')][_0xd33c('0x180')]=function(_0xf3084d){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x181'),_0xf3084d[_0xd33c('0x3b')]));return this['channel']['sayPhonetic'](_0xf3084d[_0xd33c('0x5f')],_0xf3084d[_0xd33c('0x174')]);};AGIVertices[_0xd33c('0x13')]['sendMail']=function(_0x1fa033){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x182'),_0x1fa033[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x1fa033[_0xd33c('0x183')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')]('no\x20mail\x20account\x20configured');}var _0x4b2153=this['getMailAccount'][_0xd33c('0x72')](this,_0x1fa033[_0xd33c('0x183')]);if(!_0x4b2153||!_0x4b2153[_0xd33c('0x184')]){return this['channel'][_0xd33c('0x30')](_0x1fa033,_0xd33c('0x185'));}var _0x186de4={'from':util[_0xd33c('0x2d')](_0xd33c('0x186'),_0x4b2153[_0xd33c('0x18')],_0x4b2153[_0xd33c('0x187')]||_0x4b2153[_0xd33c('0x184')][_0xd33c('0x188')]),'to':_0x1fa033['to']||'','cc':_0x1fa033['cc']||'','bcc':_0x1fa033[_0xd33c('0x189')]||'','subject':_0x1fa033['subject'],'html':_0x1fa033[_0xd33c('0x5f')],'text':_0x1fa033[_0xd33c('0x5f')]};var _0x5b0654={'tls':{'rejectUnauthorized':![]}};if(_0x4b2153[_0xd33c('0x184')][_0xd33c('0x18a')]){_0x5b0654['service']=_0x4b2153[_0xd33c('0x184')][_0xd33c('0x18a')];}else{_0x5b0654[_0xd33c('0x18b')]=_0x4b2153[_0xd33c('0x184')][_0xd33c('0x18b')];_0x5b0654['port']=_0x4b2153[_0xd33c('0x184')][_0xd33c('0x18c')];_0x5b0654['secure']=_0x4b2153['Smtp']['secure'];}if(_0x4b2153[_0xd33c('0x184')][_0xd33c('0x18d')]){_0x5b0654[_0xd33c('0x18e')]={'user':_0x4b2153[_0xd33c('0x184')]['user'],'pass':_0x4b2153[_0xd33c('0x184')][_0xd33c('0x18f')]};}if(this['isConfigured'](_0x1fa033[_0xd33c('0x190')])){}logger[_0xd33c('0xd9')]('sendMail\x20message',JSON['stringify'](_0x186de4));this[_0xd33c('0x3a')][_0xd33c('0x72')](this,_0x1fa033,_0x1fa033[_0xd33c('0x183')]);this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x191'),_0x4b2153[_0xd33c('0x18')]));this['sendMailMessage']['sync'](this,_0x5b0654,_0x186de4);return this[_0xd33c('0x11')]['noop'](_0xd33c('0x192'));};AGIVertices[_0xd33c('0x13')]['sendFax']=function(_0x2bdea9){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x193'),_0x2bdea9[_0xd33c('0x3b')]));return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x194'));};AGIVertices[_0xd33c('0x13')]['sendSMS']=function(_0x5af1d1){logger['info'](util[_0xd33c('0x2d')]('Enter\x20in\x20SENDSMS\x20(%s)\x20block',_0x5af1d1[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x5af1d1[_0xd33c('0x195')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x196'));}var _0x119378=this[_0xd33c('0x37')]['sync'](this,_0x5af1d1[_0xd33c('0x195')]);if(!_0x119378){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x5af1d1,_0xd33c('0x197'));}var _0x211c98={'body':_0x5af1d1[_0xd33c('0x198')],'phone':_0x5af1d1['to']||'','SmsAccountId':_0x119378['id']};logger[_0xd33c('0xd9')](_0xd33c('0x199'),JSON[_0xd33c('0x75')](_0x211c98));this['createSquareDetailsReport'][_0xd33c('0x72')](this,_0x5af1d1,_0x5af1d1['sms_account_id']);this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x19a'),_0x119378[_0xd33c('0x18')]));this[_0xd33c('0x39')][_0xd33c('0x72')](this,_0x211c98);return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x19b'));};AGIVertices['prototype'][_0xd33c('0x19c')]=function(_0x4d37a3){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x19d'),_0x4d37a3[_0xd33c('0x3b')]));if(!this['isConfigured'](_0x4d37a3['variable_id'])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x4d37a3,_0xd33c('0x19e'));}var _0x4e37c6=this[_0xd33c('0x14')]['sync'](this,_0x4d37a3[_0xd33c('0xd1')]);if(!_0x4e37c6){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x4d37a3,_0xd33c('0xd3'));}return this[_0xd33c('0x11')][_0xd33c('0xa0')](_0x4e37c6,_0x4d37a3[_0xd33c('0x19f')]);};AGIVertices[_0xd33c('0x13')][_0xd33c('0x1a0')]=function(_0x548345){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x1a1'),_0x548345[_0xd33c('0x3b')]));this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x1a2'));if(_0x548345[_0xd33c('0xbc')]===_0xd33c('0x1a3')){this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x1a4'));return this[_0xd33c('0x11')][_0xd33c('0xbc')]();}return this['channel'][_0xd33c('0xa9')]('Skipped\x20Answer');};AGIVertices[_0xd33c('0x13')][_0xd33c('0x1a5')]=function(_0x356f63){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')]('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x356f63[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x356f63[_0xd33c('0x1a6')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x356f63,_0xd33c('0x1a7'));}var _0x14a526=this[_0xd33c('0x1c')][_0xd33c('0x72')](this,_0x356f63['project_id']);if(!this[_0xd33c('0x87')](_0x14a526)){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x356f63,util['format']('no\x20subproject\x20found\x20with\x20id\x20%d',_0x356f63[_0xd33c('0x1a6')]));}if(_0x14a526===this[_0xd33c('0x11')]['arg_1']){return this['channel'][_0xd33c('0x30')](_0x356f63,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0xd33c('0x3a')]['sync'](this,_0x356f63,_0x14a526);var _0xa0c5af=this[_0xd33c('0x11')][_0xd33c('0x5a')]('AGI',util['format'](_0xd33c('0x1a8'),config[_0xd33c('0x8')][_0xd33c('0x18b')]||_0xd33c('0x1a9'),_0x14a526,this[_0xd33c('0x11')]['arg_1']));if(_0xa0c5af[_0xd33c('0xa5')]===-0x1){return _0xa0c5af;}return this[_0xd33c('0x11')][_0xd33c('0xa9')](util['format'](_0xd33c('0xc4'),'AGI',_0x14a526));};AGIVertices[_0xd33c('0x13')][_0xd33c('0x1aa')]=function(_0x5283ef){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x1ab'),_0x5283ef[_0xd33c('0x3b')]));var _0x47280c=this[_0xd33c('0x1ac')][_0xd33c('0x72')](this,_0x5283ef[_0xd33c('0xb8')]);this[_0xd33c('0x3a')][_0xd33c('0x72')](this,_0x5283ef,_0x5283ef[_0xd33c('0xb8')]);if(this[_0xd33c('0x87')](_0x5283ef[_0xd33c('0xd1')])){var _0x250b1f=this[_0xd33c('0x14')][_0xd33c('0x72')](this,_0x5283ef[_0xd33c('0xd1')]);if(_0x250b1f){this[_0xd33c('0x11')]['setVariable'](_0x250b1f,_0x47280c);return this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x1ad'),_0x5283ef[_0xd33c('0xb8')],_0x250b1f));}}return this[_0xd33c('0x11')]['noop'](util[_0xd33c('0x2d')](_0xd33c('0x1ae'),_0x5283ef[_0xd33c('0xb8')]));};AGIVertices[_0xd33c('0x13')][_0xd33c('0x1af')]=function(_0x11114c){logger['info'](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x11114c[_0xd33c('0x3b')]));_0x11114c['text']=_0x11114c[_0xd33c('0x5f')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd33c('0x87')](_0x11114c[_0xd33c('0x5d')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0x1b0'));}if(!this['isConfigured'](_0x11114c[_0xd33c('0x5f')])){return this[_0xd33c('0x11')]['noop'](_0xd33c('0xaa'));}this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x1b1'),_0x11114c['text']));var _0x32db8b=this['googleCloudTTS'][_0xd33c('0x72')](this,_0x11114c);if(_0x32db8b){this['channel'][_0xd33c('0xa9')](util['format'](_0xd33c('0x1b2'),_0x32db8b));var _0xf691e4=this[_0xd33c('0x11')]['streamFile'](_0x32db8b);try{fs[_0xd33c('0x11a')](_0x32db8b+_0xd33c('0xfa'));}catch(_0x47329b){logger[_0xd33c('0x30')](_0x47329b);}return _0xf691e4;}return this[_0xd33c('0x11')]['error'](_0x11114c,_0xd33c('0x1b3'));};AGIVertices['prototype'][_0xd33c('0x1b4')]=function(_0x4ff449){logger['info'](util[_0xd33c('0x2d')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4ff449[_0xd33c('0x3b')]));_0x4ff449['text']=_0x4ff449[_0xd33c('0x5f')][_0xd33c('0x5b')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd33c('0x87')](_0x4ff449[_0xd33c('0x5f')])){return this[_0xd33c('0x11')][_0xd33c('0xa9')](_0xd33c('0xaa'));}this[_0xd33c('0x11')]['noop'](util['format'](_0xd33c('0x1b5'),_0x4ff449['text']));var _0x5ffdac=this[_0xd33c('0x64')][_0xd33c('0x72')](this,_0x4ff449);if(_0x5ffdac){this[_0xd33c('0x11')]['noop'](util['format'](_0xd33c('0x1b6'),_0x5ffdac));var _0x1578f3=this[_0xd33c('0x11')][_0xd33c('0xf9')](_0x5ffdac);try{fs['unlink'](_0x5ffdac+_0xd33c('0xfa'));}catch(_0x2f65a7){logger[_0xd33c('0x30')](_0x2f65a7);}return _0x1578f3;}return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x4ff449,_0xd33c('0x1b7'));};AGIVertices[_0xd33c('0x13')][_0xd33c('0x1b8')]=function(_0x4a7fbb){logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x1b9'),_0x4a7fbb[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x4a7fbb['findBy'])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x4a7fbb,'no\x20find\x20by\x20configured');}logger['info'](util[_0xd33c('0x2d')](_0xd33c('0x14d'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x4a7fbb[_0xd33c('0x14b')]));var _0xb893ef=this['agentUnpause'][_0xd33c('0x72')](this,_0x4a7fbb[_0xd33c('0x14b')]);if(_0xb893ef){logger[_0xd33c('0x32')](util['format'](_0xd33c('0x14e'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x4a7fbb[_0xd33c('0x14b')]));this[_0xd33c('0x11')][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x14e'),this['channel'][_0xd33c('0x3e')],_0x4a7fbb[_0xd33c('0x14b')]));return{'code':0xc8,'result':_0xd33c('0x153')};}else{logger[_0xd33c('0x32')](util['format'](_0xd33c('0x14f'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x4a7fbb['findBy']));this['channel'][_0xd33c('0xa9')](util[_0xd33c('0x2d')](_0xd33c('0x14f'),this[_0xd33c('0x11')][_0xd33c('0x3e')],_0x4a7fbb[_0xd33c('0x14b')]));return{'code':0xc8,'result':_0xd33c('0x150')};}};AGIVertices[_0xd33c('0x13')][_0xd33c('0x1ba')]=function(_0x58fdfa){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')](_0xd33c('0x1bb'),_0x58fdfa[_0xd33c('0x3b')]));var _0x273890=this[_0xd33c('0x11')]['exec'](_0xd33c('0x1bc'),[_0x58fdfa['mailbox'],_0x58fdfa[_0xd33c('0x7b')]]);if(_0x273890['result']===-0x1){return _0x273890;}return this[_0xd33c('0x11')]['noop'](util[_0xd33c('0x2d')](_0xd33c('0xc4'),_0xd33c('0x1bc'),_0x58fdfa['mailbox']));};AGIVertices[_0xd33c('0x13')]['vswitch']=function(_0x29d9ab){logger[_0xd33c('0x32')](util[_0xd33c('0x2d')]('Enter\x20in\x20SWITCH\x20(%s)\x20block',_0x29d9ab[_0xd33c('0x3b')]));if(!this[_0xd33c('0x87')](_0x29d9ab[_0xd33c('0xd1')])){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x29d9ab,'no\x20variable\x20selected');}var _0x336326=this[_0xd33c('0x14')]['sync'](this,_0x29d9ab[_0xd33c('0xd1')]);if(!_0x336326){return this[_0xd33c('0x11')][_0xd33c('0x30')](_0x29d9ab,'no\x20variable\x20found');}var _0x23c2ce=this['channel'][_0xd33c('0x14')](_0x336326);return{'code':0xc8,'result':_0x23c2ce[_0xd33c('0xa3')]?_0x23c2ce[_0xd33c('0xa3')]:'-'};};String[_0xd33c('0x13')][_0xd33c('0xa2')]=function(_0x342b20,_0x1b1968){return this[_0xd33c('0xa1')](_0x342b20)[_0xd33c('0x1bd')](_0x1b1968);};module[_0xd33c('0x1be')]=AGIVertices; \ No newline at end of file +var _0x3d40=['Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20found\x20with\x20id\x20%d','project_id','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','Enter\x20in\x20SYSTEM\x20(%s)\x20block','shellCommand','sh\x20command:\x20%s\x20result\x20no\x20stored','no\x20apiKey\x20configured','Trying\x20Google\x20Cloud\x20TTS\x20%s','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','Trying\x20Google\x20TTS\x20%s','Google\x20TTS\x20%s\x20file\x20created','Google\x20TTS\x20is\x20unreachable','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','no\x20variable\x20selected','join','lodash','randomstring','moment','mustache','request-promise','../../config/logger','agi','../../config/environment','./scripts','/var/opt/motion2/server/files','rawHeaders','rawBody','getdigits','getsecretdigits','channel','rpc','prototype','getVariable','getVariableById','name','catch','getVoiceQueueById','getSquareProject','getSquareProjectById','then','getSquareOdbc','getSquareOdbcById','getUser','getUserById','getTrunkById','getSoundById','getSoundPath','save_name','sendMailMessage','mailRpc','getIntervals','getIntervalById','IntervalId','interval','map','format','%s/sounds/converted/%s','getQueryOdbc','open','error','Error\x20getting\x20ODBC\x20connection\x20%s','ODBC\x20connection\x20successfully','query','info','Error\x20executing\x20query\x20%s','Query\x20executed\x20correctly\x20%s','close','Error\x20closing\x20connection\x20to\x20odbc\x20%s','createSmsMessage','createSquareDetailsReport','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','list_id','scheduledAt','toString','callback_priority','getPause','getPauseById','agent','agentPause','agentUnpause','agentLogout','agentLogin','internal','%s/%s@from-sip/n','LOCAL','exec','replace','googleCloudTTS','apiKey','text','en-US','ssmlGender','MALE','audioEncoding','MP3','googleTTS','google_tts_language','restAPI','url','method','timeout','number','includes','POST','PUT','toUpperCase','body','parse','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','dialogflow_language','googleDialogflowV2','dialogflowV2_project_id','client_email','dialogflowV2_language','sestekNDA','key','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','model','awsPolly','aws_polly_voice','Amy','aws_secret_access_key','aws_lex_region','aws_bot_name','googleASR','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','result','The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s','retry','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','noop','no\x20text\x20configured','MRCPSynth','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','MRCPRecog','RECOG_CONFIDENCE()','MRCP_RECOG_CONFIDENCE','getAndSetVariable','RECOG_INPUT()','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','callback','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','add','delay','minutes','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','Executed\x20command\x20MRCPSynth\x20%s','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','lumenvoxasr','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20odbc\x20database\x20found','no\x20query\x20configured','query:\x20%s','no\x20variable\x20selected\x20for\x20the\x20result','variable_id','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20selected','no\x20user\x20found','DIAL','SIP/%s','Executed\x20command\x20%s','dialogflow','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','out','Dialogflow\x20Result\x20%s','speech','Dialogflow\x20is\x20unreachable','no\x20project_id\x20configured','no\x20client_email\x20configured','private_key','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','providerResponse','dialogflowV2','DialogflowV2\x20is\x20unreachable','sesteknda','ndauth_url','no\x20ndauth\x20url\x20configured','no\x20username\x20configured','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','audiofile','unlink','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','end','Enter\x20in\x20END\x20(%s)\x20block','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20selected','getTrunk','no\x20trunk\x20found','trunk_name','SIP/%s/%s','opts','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','file_id','no\x20file\x20audio\x20selected','getSound','no\x20file\x20audio\x20found','getData','response','maxdigit','test','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','awspolly','[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block','aws_access_key_id','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','.wav','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','beep','intKey','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','NOBEEP','recordFile','tilde\x20%s\x20file\x20created','TILDE_ASR_%s','gotoc','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','false','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','no\x20intervals\x20found','IFTIME(%s?true:false)','IFTIME\x20%s\x20%s','hangup','Enter\x20in\x20HANGUP\x20(%s)\x20block','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeechTTS','streamFile','ispeech\x20TTS\x20is\x20unreachable','Enter\x20in\x20LOGIN\x20(%s)\x20block','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','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','math','Enter\x20in\x20MATH\x20(%s)\x20block','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','menu','Enter\x20in\x20MENU\x20(%s)\x20block','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','pause_id','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','getVoiceQueue','indexOf','XMCS-QUEUE','QUEUE','macro','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','RECORDING_SAVENAME','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','inspect','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','sayDigits','digits','saynumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','sendMail','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','getMailAccount','Smtp','no\x20mail\x20account\x20found','\x22%s\x22\x20<%s>','email','user','bcc','subject','service','host','port','secure','authentication','auth','pass','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20configured','getSmsAccount','sendSMS\x20message','Sms\x20message\x20added\x20to\x20outgoing\x20process','set','variable_value','start','yes'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x3d40,0x1e9));var _0x03d4=function(_0x372f00,_0x37e9b0){_0x372f00=_0x372f00-0x0;var _0x272572=_0x3d40[_0x372f00];return _0x272572;};'use strict';var fs=require('fs');var path=require('path');var util=require('util');var _=require(_0x03d4('0x0'));var sh=require('shelljs');var odbc=require('odbc')();var rs=require(_0x03d4('0x1'));var moment=require(_0x03d4('0x2'));var Mustache=require(_0x03d4('0x3'));var rp=require(_0x03d4('0x4'));var logger=require(_0x03d4('0x5'))(_0x03d4('0x6'));var config=require(_0x03d4('0x7'));var scripts=require(_0x03d4('0x8'));var FILES_PATH=_0x03d4('0x9');var recursiveMapAttributes=[_0x03d4('0xa'),_0x03d4('0xb')];var verticesWithRetry=['menu',_0x03d4('0xc'),_0x03d4('0xd')];var AGIVertices=function(_0x4c5e98,_0x58a2ea,_0x13941b){this[_0x03d4('0xe')]=_0x4c5e98;this[_0x03d4('0xf')]=_0x58a2ea;this['mailRpc']=_0x13941b;};AGIVertices[_0x03d4('0x10')][_0x03d4('0x11')]=function(_0x2690b2,_0x3b2013){this[_0x03d4('0xf')][_0x03d4('0x12')](_0x2690b2)['then'](function(_0x3149b8){_0x3b2013(null,_0x3149b8?_0x3149b8[_0x03d4('0x13')]:![]);})[_0x03d4('0x14')](function(_0xf1f786){_0x3b2013(_0xf1f786);});};AGIVertices[_0x03d4('0x10')]['getVoiceQueue']=function(_0x1ea0b0,_0x48df46){this[_0x03d4('0xf')][_0x03d4('0x15')](_0x1ea0b0)['then'](function(_0x4bd1a4){_0x48df46(null,_0x4bd1a4?_0x4bd1a4[_0x03d4('0x13')]:![]);})[_0x03d4('0x14')](function(_0x35ccd8){_0x48df46(_0x35ccd8);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x16')]=function(_0x19dc7e,_0x5983bb){this[_0x03d4('0xf')][_0x03d4('0x17')](_0x19dc7e)[_0x03d4('0x18')](function(_0x4ad143){_0x5983bb(null,_0x4ad143?_0x4ad143[_0x03d4('0x13')]:![]);})['catch'](function(_0x767902){_0x5983bb(_0x767902);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x19')]=function(_0x42c664,_0x1294d7){this[_0x03d4('0xf')][_0x03d4('0x1a')](_0x42c664)[_0x03d4('0x18')](function(_0x388cb3){_0x1294d7(null,_0x388cb3?_0x388cb3['dsn']:![]);})[_0x03d4('0x14')](function(_0x5b8abf){_0x1294d7(_0x5b8abf);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x1b')]=function(_0x3edd3f,_0x315308){this['rpc'][_0x03d4('0x1c')](_0x3edd3f)[_0x03d4('0x18')](function(_0x371bfc){_0x315308(null,_0x371bfc?_0x371bfc[_0x03d4('0x13')]:![]);})[_0x03d4('0x14')](function(_0x39b839){_0x315308(_0x39b839);});};AGIVertices[_0x03d4('0x10')]['getTrunk']=function(_0x3b68e7,_0x2fcab0){this[_0x03d4('0xf')][_0x03d4('0x1d')](_0x3b68e7)[_0x03d4('0x18')](function(_0x2be290){_0x2fcab0(null,_0x2be290?_0x2be290['name']:![]);})[_0x03d4('0x14')](function(_0x256c35){_0x2fcab0(_0x256c35);});};AGIVertices['prototype']['getSound']=function(_0x2ec01a,_0x7de09c){var _0x4b3919=this;this[_0x03d4('0xf')][_0x03d4('0x1e')](_0x2ec01a)[_0x03d4('0x18')](function(_0x523a14){_0x7de09c(null,_0x523a14?_0x4b3919[_0x03d4('0x1f')](_0x523a14[_0x03d4('0x20')]):![]);})[_0x03d4('0x14')](function(_0x1720ea){_0x7de09c(_0x1720ea);});};AGIVertices[_0x03d4('0x10')]['getMailAccount']=function(_0x6d7e6d,_0x315521){this[_0x03d4('0xf')]['getMailAccountById'](_0x6d7e6d)[_0x03d4('0x18')](function(_0xee6e0d){_0x315521(null,_0xee6e0d?_0xee6e0d:![]);})[_0x03d4('0x14')](function(_0xf1830c){_0x315521(_0xf1830c);});};AGIVertices['prototype'][_0x03d4('0x21')]=function(_0x45427d,_0x1b67a4,_0x7e71a){this[_0x03d4('0x22')][_0x03d4('0x21')](_0x45427d,_0x1b67a4)[_0x03d4('0x18')](function(){_0x7e71a(null);})['catch'](function(_0x4f2898){_0x7e71a(_0x4f2898);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x23')]=function(_0x40b263,_0x43919c){this[_0x03d4('0xf')][_0x03d4('0x24')](_0x40b263)[_0x03d4('0x18')](function(_0x304d53){if(_0x304d53){if(_0x304d53[_0x03d4('0x25')]){_0x43919c(null,[_0x304d53[_0x03d4('0x26')]]);}else{_0x43919c(null,_[_0x03d4('0x27')](_0x304d53['Intervals'],_0x03d4('0x26')));}}else{_0x43919c(null,![]);}})[_0x03d4('0x14')](function(_0x128fa2){_0x43919c(_0x128fa2);});};AGIVertices['prototype']['getSoundPath']=function(_0x16f5e9){return util[_0x03d4('0x28')](_0x03d4('0x29'),FILES_PATH,_0x16f5e9);};AGIVertices[_0x03d4('0x10')][_0x03d4('0x2a')]=function(_0x237043,_0x5a209d,_0x243d54){odbc[_0x03d4('0x2b')](_0x237043,function(_0x2ff605){if(_0x2ff605){logger[_0x03d4('0x2c')](_0x03d4('0x2d'),_0x2ff605);_0x243d54(_0x2ff605);}else{logger['info'](_0x03d4('0x2e'));odbc[_0x03d4('0x2f')](_0x5a209d,function(_0x248710,_0x3eaca0){if(_0x248710){logger[_0x03d4('0x30')](_0x03d4('0x31'),_0x5a209d);_0x243d54(_0x248710);}else{logger[_0x03d4('0x30')](_0x03d4('0x32'),_0x5a209d);odbc[_0x03d4('0x33')](function(_0x227d99){if(_0x227d99){logger[_0x03d4('0x2c')](_0x03d4('0x34'),_0x227d99);}_0x243d54(null,_0x3eaca0);});}});}});};AGIVertices[_0x03d4('0x10')]['getSmsAccount']=function(_0x1ee862,_0x238471){this[_0x03d4('0xf')]['getSmsAccountById'](_0x1ee862)[_0x03d4('0x18')](function(_0x10ef6d){_0x238471(null,_0x10ef6d?_0x10ef6d:![]);})[_0x03d4('0x14')](function(_0x322dda){_0x238471(_0x322dda);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x35')]=function(_0x450a0c,_0x13d85b){this['rpc']['createSmsMessage'](_0x450a0c)['then'](function(_0x555e9b){_0x13d85b(null,_0x555e9b);})[_0x03d4('0x14')](function(_0x1ff253){_0x13d85b(_0x1ff253);});};AGIVertices['prototype'][_0x03d4('0x36')]=function(_0x27522c,_0x240c77,_0x4e1226){this[_0x03d4('0xf')][_0x03d4('0x36')]({'uniqueid':this['channel'][_0x03d4('0x37')],'node':_0x27522c[_0x03d4('0x38')],'application':_0x27522c[_0x03d4('0x39')],'data':_0x240c77||null,'project_name':this[_0x03d4('0xe')][_0x03d4('0x3a')],'callerid':this[_0x03d4('0xe')][_0x03d4('0x3b')]})['then'](function(_0x43dd44){if(_0x4e1226){_0x4e1226(null,_0x43dd44);}})[_0x03d4('0x14')](function(_0x221b3b){if(_0x4e1226){_0x4e1226(_0x221b3b);}});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x3c')]=function(_0x16db98,_0x5f0229,_0x5c1ff3,_0x4e9107){this[_0x03d4('0xf')][_0x03d4('0x3c')]({'uniqueid':this[_0x03d4('0xe')]['uniqueid'],'callerid':this[_0x03d4('0xe')][_0x03d4('0x3b')],'calleridname':this[_0x03d4('0xe')]['calleridname'],'context':this['channel'][_0x03d4('0x3d')],'extension':this[_0x03d4('0xe')][_0x03d4('0x3e')],'priority':this[_0x03d4('0xe')][_0x03d4('0x3f')],'accountcode':this[_0x03d4('0xe')][_0x03d4('0x40')],'dnid':this['channel'][_0x03d4('0x41')],'projectName':this[_0x03d4('0xe')][_0x03d4('0x3a')],'saveName':_0x5f0229,'filename':_0x16db98['file']||_0x5f0229,'savePath':_0x5c1ff3})['then'](function(_0x7ea10d){_0x4e9107(null,_0x7ea10d);})[_0x03d4('0x14')](function(_0x5e50da){_0x4e9107(_0x5e50da);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x42')]=function(_0x2be5ea,_0x15a77f,_0x22ab1f,_0x3be9c7,_0x3b8053){this[_0x03d4('0xf')][_0x03d4('0x42')]({'uniqueid':this[_0x03d4('0xe')]['uniqueid'],'body':_0x2be5ea,'direction':_0x15a77f,'providerName':_0x22ab1f,'providerResponse':_0x3be9c7})[_0x03d4('0x18')](function(_0x45916d){if(_0x3b8053){_0x3b8053(null,_0x45916d);}})[_0x03d4('0x14')](function(_0x5343c3){if(_0x3b8053){_0x3b8053(_0x5343c3);}});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x43')]=function(_0x176a2c,_0x2782de){this[_0x03d4('0xf')][_0x03d4('0x43')]({'firstName':_[_0x03d4('0x44')](_0x176a2c[_0x03d4('0x13')])||_[_0x03d4('0x45')](_0x176a2c['name'])?_0x03d4('0x46')+Math[_0x03d4('0x47')]():_0x176a2c[_0x03d4('0x13')],'lastName':_[_0x03d4('0x44')](_0x176a2c['lastName'])||_[_0x03d4('0x45')](_0x176a2c[_0x03d4('0x48')])?null:_0x176a2c[_0x03d4('0x48')],'phone':_0x176a2c[_0x03d4('0x49')],'ListId':_0x176a2c[_0x03d4('0x4a')],'scheduledat':_0x176a2c[_0x03d4('0x4b')],'callbackUniqueid':this['channel'][_0x03d4('0x37')],'tags':'callback','description':'Callback\x20scheduled\x20at\x20'+_0x176a2c[_0x03d4('0x4b')][_0x03d4('0x4c')](),'priority':_0x176a2c[_0x03d4('0x4d')]})[_0x03d4('0x18')](function(_0x11a7d4){_0x2782de(null,_0x11a7d4);})[_0x03d4('0x14')](function(_0xb11932){_0x2782de(_0xb11932);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x4e')]=function(_0xb44e88,_0x4381aa){this['rpc'][_0x03d4('0x4f')](_0xb44e88)[_0x03d4('0x18')](function(_0x46d130){_0x4381aa(null,_0x46d130?_0x46d130['name']:![]);})[_0x03d4('0x14')](function(_0x5d37e1){_0x4381aa(_0x5d37e1);});};AGIVertices['prototype']['agentPause']=function(_0x4c1afa,_0x17aa64,_0x5ebdae){var _0x33d00e={'role':_0x03d4('0x50')};_0x33d00e[_0x4c1afa]=this[_0x03d4('0xe')][_0x03d4('0x3b')];this[_0x03d4('0xf')][_0x03d4('0x51')](_0x33d00e,_0x17aa64,this[_0x03d4('0xe')][_0x03d4('0x37')])[_0x03d4('0x18')](function(_0x7d428c){_0x5ebdae(null,_['isNil'](_0x7d428c)?![]:!![]);})[_0x03d4('0x14')](function(_0x2b97e0){logger[_0x03d4('0x2c')](_0x2b97e0);_0x5ebdae(null,![]);});};AGIVertices[_0x03d4('0x10')]['agentUnpause']=function(_0x198c80,_0x311f0a){var _0x5aa2ce={'role':_0x03d4('0x50')};_0x5aa2ce[_0x198c80]=this['channel']['callerid'];this[_0x03d4('0xf')][_0x03d4('0x52')](_0x5aa2ce)[_0x03d4('0x18')](function(_0x2e9029){_0x311f0a(null,_[_0x03d4('0x45')](_0x2e9029)?![]:!![]);})['catch'](function(_0x502562){logger[_0x03d4('0x2c')](_0x502562);_0x311f0a(null,![]);});};AGIVertices[_0x03d4('0x10')]['agentLogout']=function(_0x2f55f1,_0x5f1c28){var _0x3ffc51={'role':_0x03d4('0x50')};_0x3ffc51[_0x2f55f1]=this[_0x03d4('0xe')][_0x03d4('0x3b')];this[_0x03d4('0xf')][_0x03d4('0x53')](_0x3ffc51)[_0x03d4('0x18')](function(_0x5e3369){_0x5f1c28(null,_[_0x03d4('0x45')](_0x5e3369)?![]:!![]);})[_0x03d4('0x14')](function(_0x5f06f6){logger['error'](_0x5f06f6);_0x5f1c28(null,![]);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x54')]=function(_0x4ee921,_0x3f72cb){var _0x59d042={'role':_0x03d4('0x50')};_0x59d042[_0x4ee921]=this[_0x03d4('0xe')][_0x03d4('0x3b')];var _0x2bb408=_0x4ee921!=_0x03d4('0x55')?util[_0x03d4('0x28')](_0x03d4('0x56'),_0x03d4('0x57'),this[_0x03d4('0xe')][_0x03d4('0x3b')]):undefined;this[_0x03d4('0xf')]['agentLogin'](_0x59d042,_0x2bb408)[_0x03d4('0x18')](function(_0x3b8a57){_0x3f72cb(null,_[_0x03d4('0x45')](_0x3b8a57)?![]:!![]);})[_0x03d4('0x14')](function(_0x3df734){logger[_0x03d4('0x2c')](_0x3df734);_0x3f72cb(null,![]);});};AGIVertices['prototype']['shellCommand']=function(_0x53aaa3,_0x20501a){sh[_0x03d4('0x58')](_['trim'](_0x53aaa3),function(_0xbf7dfc,_0xee1f8){var _0x4843fa=_0xee1f8[_0x03d4('0x59')](/(\r\n|\n|\r)/gm,'');_0x20501a(null,_0x4843fa);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x5a')]=function(_0x5317e5,_0x188dbf){scripts['googleCloudTTS'](_0x5317e5[_0x03d4('0x5b')],_0x5317e5['google_cloud_tts_text_type']||_0x03d4('0x5c'),_0x5317e5[_0x03d4('0x5c')],_0x5317e5['languageCode']||_0x03d4('0x5d'),_0x5317e5[_0x03d4('0x5e')]||_0x03d4('0x5f'),_0x5317e5[_0x03d4('0x60')]||_0x03d4('0x61'))[_0x03d4('0x18')](function(_0x1f6c39){_0x188dbf(null,_0x1f6c39);})['catch'](function(_0xe9d16){_0x188dbf(_0xe9d16);});};AGIVertices[_0x03d4('0x10')]['googleTTS']=function(_0x43e259,_0x59f884){scripts[_0x03d4('0x62')](_0x43e259[_0x03d4('0x5c')],_0x43e259[_0x03d4('0x63')]||'en',0x1)[_0x03d4('0x18')](function(_0x1cf3ae){_0x59f884(null,_0x1cf3ae);})[_0x03d4('0x14')](function(_0x1296a4){_0x59f884(_0x1296a4);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x64')]=function(_0xe539ef,_0x1fd6b8){var _0x5b256c={'uri':_0xe539ef[_0x03d4('0x65')],'method':_0xe539ef[_0x03d4('0x66')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0xe539ef[_0x03d4('0x67')])===_0x03d4('0x68')&&parseInt(_0xe539ef[_0x03d4('0x67')])>=0x1?parseInt(_0xe539ef[_0x03d4('0x67')])*0x3e8:0x5*0x3e8};if(_[_0x03d4('0x69')]([_0x03d4('0x6a'),_0x03d4('0x6b')],_0x5b256c['method'][_0x03d4('0x6c')]())){try{_0x5b256c[_0x03d4('0x6d')]=_0xe539ef['rawBody']?JSON[_0x03d4('0x6e')](_0xe539ef[_0x03d4('0xb')]):{};}catch(_0x270604){logger['error'](_0x03d4('0x6f'),_0x270604);}}try{_0x5b256c[_0x03d4('0x70')]=_0xe539ef[_0x03d4('0xa')]?JSON[_0x03d4('0x6e')](_0xe539ef[_0x03d4('0xa')]):{};}catch(_0x38b9a9){logger[_0x03d4('0x2c')]('An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function',_0x38b9a9);}if(_0xe539ef['computedVariables']){try{var _0x488d16=require(_0xe539ef[_0x03d4('0x71')])[_0x03d4('0x72')](this,_0x5b256c);_0x5b256c[_0x03d4('0x73')]=Mustache[_0x03d4('0x74')](_0xe539ef['url'],_0x488d16,{},['$$','$$']);if(_0x5b256c[_0x03d4('0x70')]){_0x5b256c[_0x03d4('0x70')]=JSON[_0x03d4('0x6e')](Mustache['render'](JSON[_0x03d4('0x75')](_0x5b256c[_0x03d4('0x70')]),_0x488d16,{},['$$','$$']));}if(_0x5b256c[_0x03d4('0x6d')]){_0x5b256c[_0x03d4('0x6d')]=JSON[_0x03d4('0x6e')](Mustache['render'](JSON[_0x03d4('0x75')](_0x5b256c[_0x03d4('0x6d')]),_0x488d16,{},['$$','$$']));}}catch(_0xb7ad42){logger[_0x03d4('0x2c')](_0x03d4('0x76'),_0xb7ad42);}}rp(_0x5b256c)[_0x03d4('0x18')](function(_0x5bdb21){var _0xa0fea0={'statusCode':_0x5bdb21[_0x03d4('0x77')]||0xc8,'statusMessage':_0x5bdb21[_0x03d4('0x78')]||'OK','headers':_0x5bdb21[_0x03d4('0x70')]||{},'body':_0x5bdb21['body']||{}};_0x1fd6b8(null,_0xa0fea0);})['catch'](function(_0x2805a1){var _0x14fa0c={'statusCode':_0x2805a1[_0x03d4('0x77')]||0x1f4,'statusMessage':_0x2805a1[_0x03d4('0x79')]||_0x03d4('0x7a'),'headers':_0x2805a1[_0x03d4('0x7b')]['headers']||{},'body':_0x2805a1['options'][_0x03d4('0x6d')]||{}};_0x1fd6b8(null,_0x14fa0c);});};AGIVertices['prototype'][_0x03d4('0x7c')]=function(_0x4b5049,_0xdcb014){scripts[_0x03d4('0x7c')](this[_0x03d4('0xe')][_0x03d4('0x37')],_0x4b5049['key'],_0x4b5049[_0x03d4('0x5c')],_0x4b5049[_0x03d4('0x7d')]||'en')[_0x03d4('0x18')](function(_0x17a5b4){_0xdcb014(null,_0x17a5b4);})['catch'](function(_0x55edf7){_0xdcb014(_0x55edf7);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x7e')]=function(_0x4454f5,_0x43aedc){scripts[_0x03d4('0x7e')](this[_0x03d4('0xe')]['uniqueid'],_0x4454f5[_0x03d4('0x7f')],_0x4454f5[_0x03d4('0x80')],_0x4454f5['private_key'],_0x4454f5[_0x03d4('0x5c')],_0x4454f5[_0x03d4('0x81')]||'en')[_0x03d4('0x18')](function(_0x12a31e){_0x43aedc(null,_0x12a31e);})['catch'](function(_0x5e9616){_0x43aedc(_0x5e9616);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x82')]=function(_0x42e56c,_0x5e473e){scripts[_0x03d4('0x82')](this['channel'],_0x42e56c)[_0x03d4('0x18')](function(_0x550af7){_0x5e473e(null,_0x550af7);})[_0x03d4('0x14')](function(_0x55896f){_0x5e473e(_0x55896f);});};AGIVertices[_0x03d4('0x10')]['ispeechTTS']=function(_0x26d7b5,_0x5ca354){scripts['ispeechTTS'](_0x26d7b5[_0x03d4('0x83')],_0x26d7b5['text'],_0x26d7b5[_0x03d4('0x84')]||_0x03d4('0x5d'),_0x26d7b5[_0x03d4('0x85')])['then'](function(_0x43613d){_0x5ca354(null,_0x43613d);})['catch'](function(_0x4d629e){_0x5ca354(_0x4d629e);});};AGIVertices[_0x03d4('0x10')]['ispeechASR']=function(_0x312778,_0x1aefc3,_0xb7feee){scripts[_0x03d4('0x86')](_0x1aefc3,_0x312778[_0x03d4('0x83')],_0x312778[_0x03d4('0x87')]||'en-US',this[_0x03d4('0x88')](_0x312778[_0x03d4('0x89')])?_0x312778['model']:undefined)[_0x03d4('0x18')](function(_0x497ce5){_0xb7feee(null,_0x497ce5);})[_0x03d4('0x14')](function(_0x1f18cc){_0xb7feee(_0x1f18cc);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x8a')]=function(_0x4c2ba7,_0x5a839e){scripts['awsPolly'](_0x4c2ba7['aws_access_key_id'],_0x4c2ba7['aws_secret_access_key'],_0x4c2ba7['aws_polly_region'],_0x4c2ba7[_0x03d4('0x8b')]||_0x03d4('0x8c'),_0x4c2ba7[_0x03d4('0x5c')],_0x4c2ba7['aws_text_type']||_0x03d4('0x5c'))[_0x03d4('0x18')](function(_0x115ec2){_0x5a839e(null,_0x115ec2);})[_0x03d4('0x14')](function(_0x1c2345){_0x5a839e(_0x1c2345);});};AGIVertices[_0x03d4('0x10')]['awsLex']=function(_0x473712,_0x2ed08b){scripts['awsLex'](this[_0x03d4('0xe')][_0x03d4('0x37')],_0x473712['aws_access_key_id'],_0x473712[_0x03d4('0x8d')],_0x473712[_0x03d4('0x8e')],_0x473712[_0x03d4('0x5c')],_0x473712[_0x03d4('0x8f')])[_0x03d4('0x18')](function(_0x7974b2){_0x2ed08b(null,_0x7974b2);})[_0x03d4('0x14')](function(_0x44177e){_0x2ed08b(_0x44177e);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x90')]=function(_0x5359dc,_0x497ea3,_0x220c1c){scripts[_0x03d4('0x90')](_0x497ea3,_0x5359dc[_0x03d4('0x83')],_0x5359dc['google_asr_language']||_0x03d4('0x5d'))[_0x03d4('0x18')](function(_0x21c7d1){_0x220c1c(null,_0x21c7d1);})[_0x03d4('0x14')](function(_0x81019d){_0x220c1c(_0x81019d);});};AGIVertices[_0x03d4('0x10')][_0x03d4('0x91')]=function(_0x5cd563,_0x115e3a,_0x23354b){scripts[_0x03d4('0x91')](_0x115e3a,_0x5cd563[_0x03d4('0x92')],_0x5cd563[_0x03d4('0x93')],_0x5cd563['uri'])['then'](function(_0x449819){_0x23354b(null,_0x449819);})[_0x03d4('0x14')](function(_0x1bc421){_0x23354b(_0x1bc421);});};AGIVertices['prototype'][_0x03d4('0x94')]=function(_0x3ea1e8){var _0x453075=_[_0x03d4('0x69')](verticesWithRetry,_0x3ea1e8[_0x03d4('0x39')])?_0x3ea1e8:_[_0x03d4('0x95')](_0x3ea1e8);for(var _0x3d9243 in _0x453075){if(_0x453075[_0x03d4('0x96')](_0x3d9243)){if(_0x453075[_0x3d9243]&&_['isString'](_0x453075[_0x3d9243])){if(_[_0x03d4('0x69')](recursiveMapAttributes,_0x3d9243)){_0x453075[_0x3d9243]=this[_0x03d4('0x97')](_0x453075[_0x3d9243]);}else{_0x453075[_0x3d9243]=this['replaceAllVariables'](_0x453075[_0x3d9243]);}}}}return _0x453075;};AGIVertices[_0x03d4('0x10')][_0x03d4('0x98')]=function(_0x4c9f03){for(var _0x5e5fc7 in _0x4c9f03){if(_0x4c9f03['hasOwnProperty'](_0x5e5fc7)){if(_[_0x03d4('0x99')](_0x4c9f03[_0x5e5fc7])){this[_0x03d4('0x98')](_0x4c9f03[_0x5e5fc7]);}else if(_[_0x03d4('0x9a')](_0x4c9f03[_0x5e5fc7])){for(var _0x12fe5c=0x0;_0x12fe5c<_0x4c9f03[_0x5e5fc7][_0x03d4('0x9b')];_0x12fe5c++){this[_0x03d4('0x98')](_0x4c9f03[_0x5e5fc7][_0x12fe5c]);}}else if(_[_0x03d4('0x9c')](_0x4c9f03[_0x5e5fc7])){_0x4c9f03[_0x5e5fc7]=this[_0x03d4('0x9d')](_0x4c9f03[_0x5e5fc7]);}}}};AGIVertices['prototype'][_0x03d4('0x9e')]=function(_0x49b5a8,_0x2547c0){for(var _0xfb43a in _0x49b5a8){if(_0x49b5a8[_0x03d4('0x96')](_0xfb43a)){if(_['isPlainObject'](_0x49b5a8[_0xfb43a])){if(!_[_0x03d4('0x44')](_0x49b5a8[_0xfb43a])){this[_0x03d4('0x9e')](_0x49b5a8[_0xfb43a],util[_0x03d4('0x28')](_0x03d4('0x9f'),_0x2547c0,_0xfb43a));}}else if(_['isArray'](_0x49b5a8[_0xfb43a])){for(var _0x21fad5=0x0;_0x21fad5<_0x49b5a8[_0xfb43a][_0x03d4('0x9b')];_0x21fad5++){this[_0x03d4('0x9e')](_0x49b5a8[_0xfb43a][_0x21fad5],util[_0x03d4('0x28')](_0x03d4('0x9f'),_0x2547c0,_0xfb43a+'['+_0x21fad5+']'));}}else{if(!_['isNil'](_0x49b5a8[_0xfb43a])){this['channel'][_0x03d4('0xa0')](util[_0x03d4('0x28')]('%s.%s',_0x2547c0,_0xfb43a),_0x49b5a8[_0xfb43a]);}}}}};AGIVertices['prototype'][_0x03d4('0x97')]=function(_0x49da32){try{var _0x1ec31f=JSON['parse'](_0x49da32);this['recursiveNodeIndex'](_0x1ec31f);return JSON[_0x03d4('0x75')](_0x1ec31f);}catch(_0x22daeb){return this[_0x03d4('0x9d')](_0x49da32);}};AGIVertices['prototype'][_0x03d4('0x9d')]=function(_0x4572b3){var _0x447120=_0x4572b3[_0x03d4('0xa1')]('{');for(var _0x528616=0x1;_0x528616<_0x447120[_0x03d4('0x9b')];_0x528616+=0x1){var _0x6c1f10=_0x447120[_0x528616][_0x03d4('0xa1')]('}');if(_0x6c1f10['length']>0x1){_0x4572b3=_0x4572b3[_0x03d4('0xa2')]('{'+_0x6c1f10[0x0]+'}',this[_0x03d4('0xe')][_0x03d4('0x11')](_0x6c1f10[0x0])[_0x03d4('0xa3')]||_0x6c1f10[0x0]);}}if(_0x447120[_0x03d4('0x9b')]===0x1){return _0x4572b3[_0x03d4('0x4c')]();}return this['replaceAllVariables'](_0x4572b3);};AGIVertices[_0x03d4('0x10')]['getAndSetVariable']=function(_0x8a7c04,_0x5b28dc){var _0x18d161=this['channel'][_0x03d4('0x11')](_0x8a7c04);if(_0x18d161[_0x03d4('0xa4')]===-0x1){return _0x18d161;}logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0xa5'),_0x5b28dc,_0x18d161['extra']));return this[_0x03d4('0xe')]['setVariable'](_0x5b28dc,_0x18d161['extra']);};AGIVertices[_0x03d4('0x10')]['isConfigured']=function(_0x596859){return _0x596859&&_0x596859!=='0'&&_0x596859!=='-1'&&_0x596859!=='';};AGIVertices[_0x03d4('0x10')]['maxRetry']=function(_0x4877e1){this[_0x03d4('0x36')]['sync'](this,_0x4877e1,'-');_0x4877e1[_0x03d4('0xa6')]=_0x4877e1[_0x03d4('0xa7')];return{'code':0xc8,'result':'-'};};AGIVertices[_0x03d4('0x10')][_0x03d4('0xa8')]=function(_0x2767a9){logger[_0x03d4('0x30')](util['format'](_0x03d4('0xa9'),_0x2767a9[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x2767a9[_0x03d4('0x5c')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xab'));}var _0x455e92='\x22'+_0x2767a9[_0x03d4('0x5c')]+'\x22';if(this[_0x03d4('0x88')](_0x2767a9[_0x03d4('0x7b')])){_0x455e92+=','+_0x2767a9[_0x03d4('0x7b')];}var _0xe1752c=this[_0x03d4('0xe')]['exec'](_0x03d4('0xac'),_0x455e92);if(_0xe1752c['result']===-0x1){return _0xe1752c;}return this['channel'][_0x03d4('0xaa')](util[_0x03d4('0x28')]('Executed\x20command\x20MRCPSynth\x20%s',_0x455e92));};AGIVertices[_0x03d4('0x10')][_0x03d4('0xad')]=function(_0x2a312a){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0xae'),_0x2a312a['label']));if(!this[_0x03d4('0x88')](_0x2a312a[_0x03d4('0xaf')])){return this['channel']['noop'](_0x03d4('0xb0'));}var _0x541023=_0x2a312a[_0x03d4('0xaf')];if(this[_0x03d4('0x88')](_0x2a312a[_0x03d4('0x7b')])){_0x541023+=','+_0x2a312a[_0x03d4('0x7b')];}var _0x5d90d7=this['channel'][_0x03d4('0x58')](_0x03d4('0xb1'),_0x541023);if(_0x5d90d7['result']===-0x1){return _0x5d90d7;}var _0x52da19=this['getAndSetVariable'](_0x03d4('0xb2'),_0x03d4('0xb3'));if(_0x52da19[_0x03d4('0xa4')]===-0x1){return _0x52da19;}var _0x5620b6=this[_0x03d4('0xb4')](_0x03d4('0xb5'),'MRCP_RECOG_TRANSCRIPT');if(_0x5620b6[_0x03d4('0xa4')]===-0x1){return _0x5620b6;}var _0x188ce9=this[_0x03d4('0xb4')](_0x03d4('0xb6'),_0x03d4('0xb7'));if(_0x188ce9[_0x03d4('0xa4')]===-0x1){return _0x188ce9;}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xb8'),_0x541023));};AGIVertices[_0x03d4('0x10')][_0x03d4('0x6')]=function(_0x28a187){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0xb9'),_0x28a187[_0x03d4('0x38')]));return this[_0x03d4('0xe')][_0x03d4('0x6')]([_0x28a187[_0x03d4('0xba')],_0x28a187['args']]);};AGIVertices[_0x03d4('0x10')][_0x03d4('0xbb')]=function(_0x1e8c0e){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0xbc'),_0x1e8c0e[_0x03d4('0x38')]));if(this[_0x03d4('0x88')](_0x1e8c0e[_0x03d4('0x67')])){logger[_0x03d4('0x30')](util['format'](_0x03d4('0xbd'),_0x1e8c0e[_0x03d4('0x67')]));var _0x4a1556=this[_0x03d4('0xe')][_0x03d4('0xbe')](_0x1e8c0e[_0x03d4('0x67')]);if(_0x4a1556[_0x03d4('0xa4')]===-0x1){return _0x4a1556;}}return this['channel']['answer']();};AGIVertices[_0x03d4('0x10')][_0x03d4('0xbf')]=function(_0x37ac17){logger['info'](util[_0x03d4('0x28')](_0x03d4('0xc0'),_0x37ac17[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x37ac17[_0x03d4('0x4a')])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x37ac17,_0x03d4('0xc1'));}_0x37ac17['scheduledAt']=moment();if(this['isConfigured'](_0x37ac17['delay'])){_0x37ac17[_0x03d4('0x4b')]=moment()[_0x03d4('0xc2')](_0x37ac17[_0x03d4('0xc3')],_0x03d4('0xc4'));}if(!this[_0x03d4('0x88')](_0x37ac17['callback_priority'])){_0x37ac17[_0x03d4('0x4d')]=0x2;}this[_0x03d4('0x43')]['sync'](this,_0x37ac17);return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xc5'),_0x37ac17[_0x03d4('0x49')],_0x37ac17[_0x03d4('0x4a')],_0x37ac17[_0x03d4('0x4b')]));};AGIVertices['prototype']['custom_app']=function(_0x135675){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0xc6'),_0x135675['label']));var _0x10dae8=this['channel'][_0x03d4('0x58')](_0x135675[_0x03d4('0xc7')],_0x135675[_0x03d4('0x7b')]);if(_0x10dae8[_0x03d4('0xa4')]===-0x1){return _0x10dae8;}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util['format'](_0x03d4('0xc8'),_0x135675['application'],_0x135675['options']));};AGIVertices['prototype'][_0x03d4('0xc9')]=function(_0x4d9ae4){logger[_0x03d4('0x30')](util['format'](_0x03d4('0xca'),_0x4d9ae4[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x4d9ae4[_0x03d4('0x5c')])){return this['channel'][_0x03d4('0xaa')](_0x03d4('0xab'));}var _0x15b41f='\x22'+_0x4d9ae4[_0x03d4('0x5c')]+'\x22';if(this[_0x03d4('0x88')](_0x4d9ae4[_0x03d4('0x7b')])){_0x15b41f+=','+_0x4d9ae4[_0x03d4('0x7b')];}var _0x2e71b2=this[_0x03d4('0xe')]['exec'](_0x03d4('0xac'),_0x15b41f);if(_0x2e71b2[_0x03d4('0xa4')]===-0x1){return _0x2e71b2;}return this['channel'][_0x03d4('0xaa')](util['format'](_0x03d4('0xcb'),_0x15b41f));};AGIVertices['prototype'][_0x03d4('0xcc')]=function(_0x2e6211){logger['info'](util[_0x03d4('0x28')](_0x03d4('0xcd'),_0x2e6211[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x2e6211['text'])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xab'));}var _0x5a792d='\x22'+_0x2e6211[_0x03d4('0x5c')]+'\x22';if(this['isConfigured'](_0x2e6211[_0x03d4('0x7b')])){_0x5a792d+=','+_0x2e6211[_0x03d4('0x7b')];}var _0x134b75=this['channel'][_0x03d4('0x58')](_0x03d4('0xac'),_0x5a792d);if(_0x134b75[_0x03d4('0xa4')]===-0x1){return _0x134b75;}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xcb'),_0x5a792d));};AGIVertices[_0x03d4('0x10')][_0x03d4('0xce')]=function(_0x2a681a){logger[_0x03d4('0x30')](util['format'](_0x03d4('0xcf'),_0x2a681a[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x2a681a[_0x03d4('0xaf')])){return this['channel']['noop'](_0x03d4('0xb0'));}var _0x21d421=_0x2a681a[_0x03d4('0xaf')];if(this['isConfigured'](_0x2a681a[_0x03d4('0x7b')])){_0x21d421+=','+_0x2a681a[_0x03d4('0x7b')];}var _0x1d86ed=this[_0x03d4('0xe')][_0x03d4('0x58')](_0x03d4('0xb1'),_0x21d421);if(_0x1d86ed[_0x03d4('0xa4')]===-0x1){return _0x1d86ed;}var _0xe9198=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0x03d4('0xd0'));if(_0xe9198[_0x03d4('0xa4')]===-0x1){return _0xe9198;}var _0x11399e=this['getAndSetVariable'](_0x03d4('0xb5'),'LUMENVOX_ASR_TRANSCRIPT');if(_0x11399e[_0x03d4('0xa4')]===-0x1){return _0x11399e;}var _0x2b62d8=this['getAndSetVariable'](_0x03d4('0xb6'),_0x03d4('0xd1'));if(_0x2b62d8[_0x03d4('0xa4')]===-0x1){return _0x2b62d8;}return this['channel'][_0x03d4('0xaa')](util['format'](_0x03d4('0xb8'),_0x21d421));};AGIVertices['prototype'][_0x03d4('0xd2')]=function(_0x354440){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x354440[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x354440[_0x03d4('0xaf')])){return this['channel'][_0x03d4('0xaa')](_0x03d4('0xb0'));}var _0x1303db=_0x354440[_0x03d4('0xaf')];if(this[_0x03d4('0x88')](_0x354440['options'])){_0x1303db+=','+_0x354440[_0x03d4('0x7b')];}var _0x31fd28=this[_0x03d4('0xe')][_0x03d4('0x58')](_0x03d4('0xb1'),_0x1303db);if(_0x31fd28['result']===-0x1){return _0x31fd28;}var _0x422f85=this[_0x03d4('0xb4')](_0x03d4('0xb2'),_0x03d4('0xd3'));if(_0x422f85[_0x03d4('0xa4')]===-0x1){return _0x422f85;}var _0x3bff54=this[_0x03d4('0xb4')](_0x03d4('0xb5'),_0x03d4('0xd4'));if(_0x3bff54[_0x03d4('0xa4')]===-0x1){return _0x3bff54;}var _0x120e89=this[_0x03d4('0xb4')]('RECOG_INSTANCE()',_0x03d4('0xd5'));if(_0x120e89[_0x03d4('0xa4')]===-0x1){return _0x120e89;}return this['channel'][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xb8'),_0x1303db));};AGIVertices[_0x03d4('0x10')]['database']=function(_0x28ed92){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0xd6'),_0x28ed92[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x28ed92[_0x03d4('0xd7')])){return this[_0x03d4('0xe')]['error'](_0x28ed92,_0x03d4('0xd8'));}var _0x2d36f4=this[_0x03d4('0x19')][_0x03d4('0x72')](this,_0x28ed92['odbc_id']);if(!_0x2d36f4){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x28ed92,_0x03d4('0xd9'));}if(!this[_0x03d4('0x88')](_0x28ed92[_0x03d4('0x2f')])){return this['channel'][_0x03d4('0x2c')](_0x28ed92,_0x03d4('0xda'));}var _0x2f8075=_0x28ed92[_0x03d4('0x2f')][_0x03d4('0x59')](/(\r\n|\n|\r)/gm,'\x20');this['channel']['noop'](util[_0x03d4('0x28')](_0x03d4('0xdb'),_0x2f8075));var _0x373dcb=this['getQueryOdbc'][_0x03d4('0x72')](this,_0x2d36f4,_0x2f8075);this[_0x03d4('0x36')]['sync'](this,_0x28ed92,_0x2f8075);if(!this[_0x03d4('0x88')](_0x28ed92['variable_id'])){return this['channel']['noop'](_0x03d4('0xdc'));}var _0x5ce4d9=this[_0x03d4('0x11')]['sync'](this,_0x28ed92[_0x03d4('0xdd')]);if(!_0x5ce4d9){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x28ed92,_0x03d4('0xde'));}var _0x5c0aba=this;_0x373dcb[_0x03d4('0xdf')](function(_0x1332cc,_0x184059){Object[_0x03d4('0xe0')](_0x1332cc)['forEach'](function(_0x3f8ed0){_0x5c0aba[_0x03d4('0xe')]['setVariable'](util[_0x03d4('0x28')](_0x03d4('0xe1'),_0x5ce4d9,_0x184059,_0x3f8ed0),_0x1332cc[_0x3f8ed0]);});});this[_0x03d4('0xe')][_0x03d4('0xa0')](util[_0x03d4('0x28')](_0x03d4('0xe2'),_0x5ce4d9),_0x373dcb[_0x03d4('0x9b')]);return this[_0x03d4('0xe')]['noop'](util[_0x03d4('0x28')](_0x03d4('0xe3'),_0x5ce4d9));};AGIVertices[_0x03d4('0x10')][_0x03d4('0xe4')]=function(_0x56df36){logger[_0x03d4('0xe5')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0x56df36[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x56df36[_0x03d4('0xe6')])){return this['channel'][_0x03d4('0x2c')](_0x56df36,_0x03d4('0xe7'));}var _0x1f00ef=this[_0x03d4('0x1b')][_0x03d4('0x72')](this,_0x56df36['sip_id']);if(!_0x1f00ef){return this['channel']['error'](_0x56df36,_0x03d4('0xe8'));}var _0xe0975b=this[_0x03d4('0xe')][_0x03d4('0x58')](_0x03d4('0xe9'),[util['format'](_0x03d4('0xea'),_0x1f00ef),_0x56df36[_0x03d4('0x67')],_0x56df36['opts'],_0x56df36[_0x03d4('0x65')]]);if(_0xe0975b['result']===-0x1){return _0xe0975b;}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xeb'),_0x03d4('0xe9')));};AGIVertices[_0x03d4('0x10')][_0x03d4('0xec')]=function(_0x6755e1){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0xed'),_0x6755e1[_0x03d4('0x38')]));if(!this['isConfigured'](_0x6755e1[_0x03d4('0x83')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xee'));}if(!this['isConfigured'](_0x6755e1['text'])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xab'));}this[_0x03d4('0xe')][_0x03d4('0xef')]=!![];this[_0x03d4('0x36')](_0x6755e1);this['createSquareMessage'](_0x6755e1[_0x03d4('0x5c')],'in','','');this['channel'][_0x03d4('0xaa')](util['format'](_0x03d4('0xf0'),_0x6755e1['text']));var _0x377325=this[_0x03d4('0x7c')][_0x03d4('0x72')](this,_0x6755e1);if(_0x377325){for(var _0x5aba4e in _0x377325){if(_0x377325[_0x03d4('0x96')](_0x5aba4e)){this['channel']['setVariable'](util['format'](_0x03d4('0xf1'),_0x5aba4e[_0x03d4('0x6c')]()),_0x377325[_0x5aba4e]);}}this[_0x03d4('0x42')](_0x377325['speech'],_0x03d4('0xf2'),_0x03d4('0xec'),'');return this['channel'][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xf3'),_0x377325[_0x03d4('0xf4')]));}return this['channel'][_0x03d4('0x2c')](_0x6755e1,_0x03d4('0xf5'));};AGIVertices[_0x03d4('0x10')]['dialogflowV2']=function(_0x140768){logger['info'](util[_0x03d4('0x28')]('Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block',_0x140768[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x140768[_0x03d4('0x7f')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xf6'));}if(!this[_0x03d4('0x88')](_0x140768[_0x03d4('0x80')])){return this[_0x03d4('0xe')]['noop'](_0x03d4('0xf7'));}if(!this[_0x03d4('0x88')](_0x140768[_0x03d4('0xf8')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xf9'));}if(!this[_0x03d4('0x88')](_0x140768[_0x03d4('0x81')])){return this['channel'][_0x03d4('0xaa')](_0x03d4('0xfa'));}if(!this[_0x03d4('0x88')](_0x140768[_0x03d4('0x5c')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xab'));}this['channel'][_0x03d4('0xef')]=!![];this[_0x03d4('0x36')](_0x140768);this['createSquareMessage'](_0x140768['text'],'in','','');this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xfb'),_0x140768[_0x03d4('0x5c')]));var _0x289b55=this[_0x03d4('0x7e')]['sync'](this,_0x140768);if(_0x289b55){for(var _0x2ce7f8 in _0x289b55){if(_0x289b55['hasOwnProperty'](_0x2ce7f8)){if(_0x2ce7f8!==_0x03d4('0xfc')){this[_0x03d4('0xe')][_0x03d4('0xa0')](util['format'](_0x03d4('0xf1'),_0x2ce7f8[_0x03d4('0x6c')]()),_0x289b55[_0x2ce7f8]);}}}this['createSquareMessage'](_0x289b55[_0x03d4('0xf4')],_0x03d4('0xf2'),_0x03d4('0xfd'),_0x289b55[_0x03d4('0xfc')]);return this[_0x03d4('0xe')][_0x03d4('0xaa')](util['format']('DialogflowV2\x20Result\x20%s',_0x289b55[_0x03d4('0xf4')]));}return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x140768,_0x03d4('0xfe'));};AGIVertices[_0x03d4('0x10')][_0x03d4('0xff')]=function(_0xe862a4){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('Enter\x20in\x20SESTEKNDA\x20(%s)\x20block',_0xe862a4[_0x03d4('0x38')]));if(!this['isConfigured'](_0xe862a4[_0x03d4('0x100')])){return this['channel'][_0x03d4('0xaa')](_0x03d4('0x101'));}if(!this[_0x03d4('0x88')](_0xe862a4['username'])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0x102'));}if(!this['isConfigured'](_0xe862a4[_0x03d4('0x103')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0x104'));}if(!this[_0x03d4('0x88')](_0xe862a4[_0x03d4('0x105')])){return this[_0x03d4('0xe')]['noop'](_0x03d4('0xab'));}this['channel']['bot']=!![];this['createSquareDetailsReport'](_0xe862a4);this[_0x03d4('0x42')](_0xe862a4[_0x03d4('0x5c')],'in','','');this['channel'][_0x03d4('0xaa')](util['format'](_0x03d4('0x106'),_0xe862a4[_0x03d4('0x5c')]));var _0x3db2ce=this[_0x03d4('0x82')][_0x03d4('0x72')](this,_0xe862a4);if(_0x3db2ce){for(var _0x2b8d27 in _0x3db2ce){if(_0x3db2ce[_0x03d4('0x96')](_0x2b8d27)){this[_0x03d4('0xe')][_0x03d4('0xa0')](util[_0x03d4('0x28')]('SESTEK_NDA_%s',_0x2b8d27[_0x03d4('0x6c')]()),_0x3db2ce[_0x2b8d27]);}}this[_0x03d4('0x42')](_0x3db2ce[_0x03d4('0xf4')],_0x03d4('0xf2'),_0x03d4('0xff'),'');if(_0x3db2ce[_0x03d4('0x107')]){this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x3db2ce[_0x03d4('0x107')]));var _0x2f02f1=this['channel']['streamFile'](_0x3db2ce['audiofile']);try{fs[_0x03d4('0x108')](_0x3db2ce[_0x03d4('0x107')]+'.wav');}catch(_0xa40d1){logger[_0x03d4('0x2c')](_0xa40d1);}return _0x2f02f1;}else{return this[_0x03d4('0xe')]['noop'](util[_0x03d4('0x28')](_0x03d4('0x109'),_0x3db2ce[_0x03d4('0xf4')]));}}return this['channel'][_0x03d4('0x2c')](_0xe862a4,_0x03d4('0x10a'));};AGIVertices['prototype'][_0x03d4('0x10b')]=function(_0x3f0436){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x10c'),_0x3f0436[_0x03d4('0x38')]));return this[_0x03d4('0xe')]['noop'](_0x03d4('0x10b'));};AGIVertices[_0x03d4('0x10')][_0x03d4('0x10d')]=function(_0x586e61){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x10e'),_0x586e61[_0x03d4('0x38')]));var _0x395a5f='';if(_0x586e61[_0x03d4('0x10f')]){if(!this['isConfigured'](_0x586e61[_0x03d4('0x10f')])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x586e61,_0x03d4('0x110'));}else{var _0x542e7f=parseInt(_0x586e61['trunk_id'],0xa);if(isNaN(_0x542e7f)){_0x395a5f=_0x586e61[_0x03d4('0x10f')];}else{_0x395a5f=this[_0x03d4('0x111')][_0x03d4('0x72')](this,_0x586e61[_0x03d4('0x10f')]);if(!_0x395a5f){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x586e61,_0x03d4('0x112'));}}}}else if(_0x586e61[_0x03d4('0x113')]){_0x395a5f=_0x586e61[_0x03d4('0x113')];}else{return this['channel'][_0x03d4('0x2c')](_0x586e61,_0x03d4('0x110'));}var _0x490b38=this['channel']['exec'](_0x03d4('0xe9'),[util[_0x03d4('0x28')](_0x03d4('0x114'),_0x395a5f,_0x586e61[_0x03d4('0x49')]),_0x586e61[_0x03d4('0x67')],_0x586e61[_0x03d4('0x115')],_0x586e61[_0x03d4('0x65')]]);if(_0x490b38['result']===-0x1){return _0x490b38;}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xeb'),'DIAL'));};AGIVertices[_0x03d4('0x10')][_0x03d4('0x116')]=function(_0x264d2a){logger['info'](util[_0x03d4('0x28')](_0x03d4('0x117'),_0x264d2a[_0x03d4('0x38')]));return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0x116'));};AGIVertices[_0x03d4('0x10')][_0x03d4('0xc')]=function(_0x2eac2d){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x118'),_0x2eac2d['label']));if(_0x2eac2d[_0x03d4('0xa6')]===0x0){return this['maxRetry'](_0x2eac2d);}_0x2eac2d['retry']-=0x1;if(!this['isConfigured'](_0x2eac2d[_0x03d4('0x119')])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x2eac2d,_0x03d4('0x11a'));}var _0x3d8bb3=this[_0x03d4('0x11b')][_0x03d4('0x72')](this,_0x2eac2d['file_id']);if(!_0x3d8bb3){return this[_0x03d4('0xe')]['error'](_0x2eac2d,_0x03d4('0x11c'));}if(!this[_0x03d4('0x88')](_0x2eac2d['variable_id'])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x03d4('0xdc'));}var _0x5cff15=this[_0x03d4('0xe')][_0x03d4('0x11d')](_0x3d8bb3,_0x2eac2d[_0x03d4('0x11e')],_0x2eac2d[_0x03d4('0x11f')]);var _0x3795bd=_0x5cff15[_0x03d4('0xa4')]?_0x5cff15[_0x03d4('0xa4')][_0x03d4('0x4c')]():'';logger[_0x03d4('0x30')](_0x03d4('0x120'),JSON[_0x03d4('0x75')](_0x5cff15));if(_0x5cff15[_0x03d4('0xa4')]===-0x1){this[_0x03d4('0x36')][_0x03d4('0x72')](this,_0x2eac2d,_0x3795bd);return _0x5cff15;}else if(_0x5cff15[_0x03d4('0xa3')]===_0x03d4('0x67')){_0x5cff15[_0x03d4('0xa4')]=_0x3795bd[_0x03d4('0x9b')]>=parseInt(_0x2eac2d[_0x03d4('0x121')])?'x':'i';}else{_0x5cff15[_0x03d4('0xa4')]=_0x3795bd[_0x03d4('0x9b')]>=parseInt(_0x2eac2d[_0x03d4('0x121')])&&_0x3795bd[_0x03d4('0x9b')]<=parseInt(_0x2eac2d['maxdigit'])?'x':'i';}var _0x5efec1=this[_0x03d4('0x11')][_0x03d4('0x72')](this,_0x2eac2d[_0x03d4('0xdd')]);if(!_0x5efec1){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x2eac2d,_0x03d4('0xde'));}this[_0x03d4('0xe')][_0x03d4('0xa0')](_0x5efec1,_0x3795bd);if(this[_0x03d4('0x88')](_0x2eac2d[_0x03d4('0x122')])){var _0x255f9f=parseInt(_0x2eac2d[_0x03d4('0x122')],0xa);var _0x50794c=rs[_0x03d4('0x123')]({'charset':'*','length':_0x255f9f});var _0x571a55=_0x3795bd[_0x03d4('0x9b')];if(_0x571a55>0x0){if(_0x571a55>_0x255f9f){this[_0x03d4('0x36')]['sync'](this,_0x2eac2d,_0x2eac2d[_0x03d4('0x124')]===_0x03d4('0x125')?_0x50794c+_0x3795bd['substr'](_0x255f9f):_0x3795bd['substr'](0x0,_0x571a55-_0x255f9f)+_0x50794c);}else{this[_0x03d4('0x36')][_0x03d4('0x72')](this,_0x2eac2d,rs['generate']({'charset':'*','length':_0x571a55}));}}else{this[_0x03d4('0x36')]['sync'](this,_0x2eac2d,'');}}else{this[_0x03d4('0x36')]['sync'](this,_0x2eac2d,_0x3795bd);}return _0x5cff15;};AGIVertices['prototype']['getsecretdigits']=function(_0x43fc18){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x126'),_0x43fc18[_0x03d4('0x38')]));return this[_0x03d4('0xc')](_0x43fc18);};AGIVertices[_0x03d4('0x10')][_0x03d4('0x127')]=function(_0x27f51b){logger['info'](util[_0x03d4('0x28')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0x27f51b[_0x03d4('0x38')]));this[_0x03d4('0x36')]['sync'](this,_0x27f51b,_0x27f51b[_0x03d4('0x128')]);return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('GOAL\x20%s',_0x27f51b[_0x03d4('0x128')]));};AGIVertices[_0x03d4('0x10')][_0x03d4('0x129')]=function(_0x5d16df){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x12a'),_0x5d16df[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x5d16df[_0x03d4('0x12b')])||!this['isConfigured'](_0x5d16df[_0x03d4('0x8d')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0x12c'));}if(!this[_0x03d4('0x88')](_0x5d16df[_0x03d4('0x5c')])){return this['channel']['noop'](_0x03d4('0xab'));}this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x12d'),_0x5d16df[_0x03d4('0x5c')]));var _0x835a52=this[_0x03d4('0x8a')][_0x03d4('0x72')](this,_0x5d16df);if(_0x835a52){this['channel'][_0x03d4('0xaa')](util[_0x03d4('0x28')]('aws\x20Polly\x20%s\x20file\x20created',_0x835a52));var _0x44a81c=this['channel']['streamFile'](_0x835a52);try{fs[_0x03d4('0x108')](_0x835a52+_0x03d4('0x12e'));}catch(_0x24064c){logger[_0x03d4('0x2c')](_0x24064c);}return _0x44a81c;}return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x5d16df,_0x03d4('0x12f'));};AGIVertices['prototype'][_0x03d4('0x130')]=function(_0x4fba57){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x131'),_0x4fba57[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x4fba57[_0x03d4('0x12b')])||!this[_0x03d4('0x88')](_0x4fba57[_0x03d4('0x8d')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0x12c'));}if(!this[_0x03d4('0x88')](_0x4fba57['aws_bot_name'])){return this[_0x03d4('0xe')]['noop'](_0x03d4('0x132'));}if(!this['isConfigured'](_0x4fba57[_0x03d4('0x5c')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xab'));}this['channel'][_0x03d4('0xef')]=!![];this['createSquareDetailsReport'](_0x4fba57);this[_0x03d4('0x42')](_0x4fba57[_0x03d4('0x5c')],'in','','');this['channel'][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x133'),_0x4fba57[_0x03d4('0x5c')]));var _0x31c909=this['awsLex'][_0x03d4('0x72')](this,_0x4fba57);if(_0x31c909){for(var _0x45fb7e in _0x31c909){if(_0x31c909[_0x03d4('0x96')](_0x45fb7e)&&_[_0x03d4('0x9c')](_0x31c909[_0x45fb7e])){this[_0x03d4('0xe')][_0x03d4('0xa0')](util['format'](_0x03d4('0x134'),_0x45fb7e['toUpperCase']()),_0x31c909[_0x45fb7e]);}}if(_['isNil'](_0x31c909['message'])){return this[_0x03d4('0xe')][_0x03d4('0xaa')]('Amazon\x20Lex\x20ready\x20for\x20fulfillment');}else{this[_0x03d4('0x42')](_0x31c909[_0x03d4('0x79')],_0x03d4('0xf2'),_0x03d4('0x135'),'');return this['channel'][_0x03d4('0xaa')](util['format'](_0x03d4('0x136'),_0x31c909['message']));}}return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x4fba57,_0x03d4('0x137'));};AGIVertices['prototype']['googleasr']=function(_0x23046a){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x138'),_0x23046a[_0x03d4('0x38')],_0x23046a['timeout']));if(!this[_0x03d4('0x88')](_0x23046a[_0x03d4('0x83')])){return this[_0x03d4('0xe')]['noop']('no\x20key\x20configured');}var _0x4cb587=_0x03d4('0x139');var _0x3ccaea=util[_0x03d4('0x28')](_0x03d4('0x13a'),FILES_PATH,rs[_0x03d4('0x123')](0x4));var _0x57c994=util[_0x03d4('0x28')](_0x03d4('0x9f'),_0x3ccaea,_0x4cb587);var _0x1e1541=!![];if(_0x23046a[_0x03d4('0x13b')]==='NOBEEP'){_0x1e1541=![];}var _0x558904=this['channel']['recordFile'](_0x3ccaea,_0x4cb587,_0x23046a[_0x03d4('0x13c')],_0x23046a[_0x03d4('0x67')],undefined,_0x1e1541);if(_0x558904[_0x03d4('0xa4')]!==-0x1){this['channel']['noop'](util[_0x03d4('0x28')]('google\x20%s\x20file\x20created',_0x57c994));var _0x36e812=this[_0x03d4('0x90')][_0x03d4('0x72')](this,_0x23046a,_0x57c994);if(_0x36e812){for(var _0x14015f in _0x36e812){if(_0x36e812[_0x03d4('0x96')](_0x14015f)){this[_0x03d4('0xe')][_0x03d4('0xa0')](util['format']('GOOGLE_ASR_%s',_0x14015f[_0x03d4('0x6c')]()),_0x36e812[_0x14015f]);}}return this['channel'][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x13d'),JSON[_0x03d4('0x75')](_0x36e812)));}}return _0x558904;};AGIVertices[_0x03d4('0x10')][_0x03d4('0x13e')]=function(_0x661197){logger['info'](util[_0x03d4('0x28')](_0x03d4('0x13f'),_0x661197[_0x03d4('0x38')]));if(!this['isConfigured'](_0x661197[_0x03d4('0x92')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')]('no\x20appid\x20configured');}if(!this['isConfigured'](_0x661197[_0x03d4('0x93')])){return this[_0x03d4('0xe')]['noop']('no\x20appsecret\x20configured');}var _0xe412f0=_0x03d4('0x139');var _0x594090=util[_0x03d4('0x28')]('%s/recordings/%s',FILES_PATH,rs['generate'](0x4));var _0x2b676f=util['format']('%s.%s',_0x594090,_0xe412f0);var _0x189bd0=!![];if(_0x661197[_0x03d4('0x13b')]===_0x03d4('0x140')){_0x189bd0=![];}var _0x376e0a=this[_0x03d4('0xe')][_0x03d4('0x141')](_0x594090,_0xe412f0,_0x661197['intKey'],_0x661197[_0x03d4('0x67')],undefined,_0x189bd0);if(_0x376e0a[_0x03d4('0xa4')]!==-0x1){this['channel'][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x142'),_0x2b676f));var _0x5cc7a6=this[_0x03d4('0x91')][_0x03d4('0x72')](this,_0x661197,_0x2b676f);if(_0x5cc7a6){for(var _0x107a20 in _0x5cc7a6){if(_0x5cc7a6[_0x03d4('0x96')](_0x107a20)){this[_0x03d4('0xe')]['setVariable'](util[_0x03d4('0x28')](_0x03d4('0x143'),_0x107a20[_0x03d4('0x6c')]()),_0x5cc7a6[_0x107a20]);}}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('TildeASR\x20Result\x20%s',JSON[_0x03d4('0x75')](_0x5cc7a6)));}}return _0x376e0a;};AGIVertices['prototype'][_0x03d4('0x144')]=function(_0x17105f){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('Enter\x20in\x20GOTO\x20(%s)\x20block',_0x17105f[_0x03d4('0x38')]));return this['channel'][_0x03d4('0x145')](_0x17105f['context'],_0x17105f['extension'],_0x17105f['priority']);};AGIVertices[_0x03d4('0x10')][_0x03d4('0x146')]=function(_0x4f39ea){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x147'),_0x4f39ea[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x4f39ea[_0x03d4('0x148')])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x4f39ea,_0x03d4('0x149'));}try{var _0x3f9cb9=eval(_0x4f39ea[_0x03d4('0x148')])?_0x03d4('0x14a'):'false';this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('EVAL\x20CONDITION\x20%s\x20%s',_0x4f39ea[_0x03d4('0x148')],_0x3f9cb9));return{'code':0xc8,'result':_0x3f9cb9};}catch(_0x4e0c81){return{'code':0xc8,'result':_0x03d4('0x14b')};}};AGIVertices[_0x03d4('0x10')][_0x03d4('0x14c')]=function(_0x324b11){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x14d'),_0x324b11[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x324b11['interval_id'])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x324b11,'no\x20interval\x20configured');}var _0x38277c=this[_0x03d4('0x23')][_0x03d4('0x72')](this,_0x324b11['interval_id']);if(!_0x38277c){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x324b11,_0x03d4('0x14e'));}for(var _0xfab10b=0x0;_0xfab10b<_0x38277c[_0x03d4('0x9b')];_0xfab10b+=0x1){var _0x38b3f1=this[_0x03d4('0xe')][_0x03d4('0x11')](util[_0x03d4('0x28')](_0x03d4('0x14f'),_0x38277c[_0xfab10b]));if(_0x38b3f1[_0x03d4('0xa4')]===-0x1){return _0x38b3f1;}logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x150'),_0x38277c[_0xfab10b],_0x38b3f1[_0x03d4('0xa3')]));if(_0x38b3f1['extra']==='true'){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('IFTIME\x20%s\x20%s',_0x38277c[_0xfab10b],_0x03d4('0x14a')));this[_0x03d4('0xe')][_0x03d4('0xaa')](util['format'](_0x03d4('0x150'),_0x38277c[_0xfab10b],_0x03d4('0x14a')));return{'code':0xc8,'result':'true'};}else{logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x150'),_0x38277c[_0xfab10b],'false'));this[_0x03d4('0xe')]['noop'](util['format'](_0x03d4('0x150'),_0x38277c[_0xfab10b],_0x03d4('0x14b')));}}return{'code':0xc8,'result':_0x03d4('0x14b')};};AGIVertices[_0x03d4('0x10')][_0x03d4('0x151')]=function(_0x4f8ce1){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x152'),_0x4f8ce1[_0x03d4('0x38')]));return this[_0x03d4('0xe')][_0x03d4('0x151')]();};AGIVertices[_0x03d4('0x10')]['ispeechasr']=function(_0x570c59){logger[_0x03d4('0x30')](util['format'](_0x03d4('0x153'),_0x570c59[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x570c59[_0x03d4('0x83')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xee'));}var _0x415d69=_0x03d4('0x139');var _0x2b6cd2=util[_0x03d4('0x28')]('%s/recordings/%s',FILES_PATH,rs[_0x03d4('0x123')](0x4));var _0x10cd2c=util[_0x03d4('0x28')](_0x03d4('0x9f'),_0x2b6cd2,_0x415d69);var _0x59d5d0=!![];if(_0x570c59[_0x03d4('0x13b')]===_0x03d4('0x140')){_0x59d5d0=![];}var _0x9a0765=this['channel']['recordFile'](_0x2b6cd2,_0x415d69,_0x570c59[_0x03d4('0x13c')],_0x570c59[_0x03d4('0x67')],undefined,_0x59d5d0);if(_0x9a0765[_0x03d4('0xa4')]!==-0x1){this['channel'][_0x03d4('0xaa')](util['format'](_0x03d4('0x154'),_0x10cd2c));var _0x5b5b73=this[_0x03d4('0x86')][_0x03d4('0x72')](this,_0x570c59,_0x10cd2c);if(_0x5b5b73){for(var _0x102f38 in _0x5b5b73){if(_0x5b5b73[_0x03d4('0x96')](_0x102f38)){this[_0x03d4('0xe')][_0x03d4('0xa0')](util[_0x03d4('0x28')](_0x03d4('0x155'),_0x102f38[_0x03d4('0x6c')]()),_0x5b5b73[_0x102f38]);}}return this['channel'][_0x03d4('0xaa')](util['format'](_0x03d4('0x156'),JSON[_0x03d4('0x75')](_0x5b5b73)));}}return _0x9a0765;};AGIVertices[_0x03d4('0x10')]['ispeechtts']=function(_0x5ed123){logger['info'](util['format'](_0x03d4('0x157'),_0x5ed123['label']));if(!this[_0x03d4('0x88')](_0x5ed123[_0x03d4('0x83')])){return this[_0x03d4('0xe')]['noop'](_0x03d4('0xee'));}if(!this['isConfigured'](_0x5ed123[_0x03d4('0x5c')])){return this['channel'][_0x03d4('0xaa')](_0x03d4('0xab'));}this[_0x03d4('0xe')]['noop'](util[_0x03d4('0x28')](_0x03d4('0x158'),_0x5ed123[_0x03d4('0x5c')]));var _0x40243e=this[_0x03d4('0x159')][_0x03d4('0x72')](this,_0x5ed123);if(_0x40243e){this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x154'),_0x40243e));var _0x561878=this[_0x03d4('0xe')][_0x03d4('0x15a')](_0x40243e,_0x5ed123['intKey']);try{fs[_0x03d4('0x108')](_0x40243e+'.wav');}catch(_0x574614){logger['error'](_0x574614);}return _0x561878;}return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x5ed123,_0x03d4('0x15b'));};AGIVertices[_0x03d4('0x10')]['login']=function(_0x511c1c){logger[_0x03d4('0x30')](util['format'](_0x03d4('0x15c'),_0x511c1c['label']));if(!this[_0x03d4('0x88')](_0x511c1c[_0x03d4('0x15d')])){return this[_0x03d4('0xe')]['error'](_0x511c1c,_0x03d4('0x15e'));}logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x15f'),this[_0x03d4('0xe')]['callerid'],_0x511c1c[_0x03d4('0x15d')]));var _0x289148=this['agentLogin'][_0x03d4('0x72')](this,_0x511c1c[_0x03d4('0x15d')]);if(_0x289148){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x160'),this['channel']['callerid'],_0x511c1c[_0x03d4('0x15d')]));this['channel']['noop'](util['format'](_0x03d4('0x160'),this[_0x03d4('0xe')][_0x03d4('0x3b')],_0x511c1c[_0x03d4('0x15d')]));return{'code':0xc8,'result':_0x03d4('0x161')};}else{logger[_0x03d4('0x30')](util['format'](_0x03d4('0x162'),this[_0x03d4('0xe')][_0x03d4('0x3b')],_0x511c1c['findBy']));this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x03d4('0xe')][_0x03d4('0x3b')],_0x511c1c[_0x03d4('0x15d')]));return{'code':0xc8,'result':_0x03d4('0x163')};}};AGIVertices[_0x03d4('0x10')][_0x03d4('0x164')]=function(_0x38ddd6){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x165'),_0x38ddd6[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x38ddd6[_0x03d4('0x15d')])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x38ddd6,_0x03d4('0x15e'));}logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x15f'),this[_0x03d4('0xe')][_0x03d4('0x3b')],_0x38ddd6[_0x03d4('0x15d')]));var _0x29cbd9=this[_0x03d4('0x53')][_0x03d4('0x72')](this,_0x38ddd6[_0x03d4('0x15d')]);if(_0x29cbd9){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x160'),this[_0x03d4('0xe')]['callerid'],_0x38ddd6[_0x03d4('0x15d')]));this['channel']['noop'](util[_0x03d4('0x28')](_0x03d4('0x160'),this['channel']['callerid'],_0x38ddd6['findBy']));return{'code':0xc8,'result':_0x03d4('0x161')};}else{logger['info'](util[_0x03d4('0x28')](_0x03d4('0x162'),this['channel'][_0x03d4('0x3b')],_0x38ddd6['findBy']));this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x162'),this['channel']['callerid'],_0x38ddd6['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x03d4('0x10')][_0x03d4('0x166')]=function(_0x18809f){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x167'),_0x18809f[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x18809f[_0x03d4('0x168')])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x18809f,_0x03d4('0x169'));}this['channel']['noop'](util[_0x03d4('0x28')](_0x03d4('0x16a'),_0x18809f[_0x03d4('0x168')]));var _0x473737=eval(_0x18809f[_0x03d4('0x168')]);if(!this['isConfigured'](_0x18809f[_0x03d4('0xdd')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0xdc'));}var _0x22dbb9=this[_0x03d4('0x11')][_0x03d4('0x72')](this,_0x18809f[_0x03d4('0xdd')]);if(!_0x22dbb9){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x18809f,_0x03d4('0xde'));}if(_[_0x03d4('0x9a')](_0x473737)){var _0x1da928=this;_0x473737[_0x03d4('0xdf')](function(_0x1ab2ec,_0x4c84de){_0x1da928[_0x03d4('0xe')][_0x03d4('0xa0')](util[_0x03d4('0x28')](_0x03d4('0x16b'),_0x22dbb9,_0x4c84de),_0x1ab2ec);});return this[_0x03d4('0xe')]['noop'](util[_0x03d4('0x28')]('variable\x20%s[key]\x20set',_0x22dbb9));}else{return this[_0x03d4('0xe')][_0x03d4('0xa0')](_0x22dbb9,_0x473737);}};AGIVertices[_0x03d4('0x10')][_0x03d4('0x16c')]=function(_0x269c34){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x16d'),_0x269c34['label']));if(_0x269c34[_0x03d4('0xa6')]===0x0){return this[_0x03d4('0xa7')](_0x269c34);}_0x269c34['retry']-=0x1;if(!this[_0x03d4('0x88')](_0x269c34['file_id'])){return this['channel'][_0x03d4('0x2c')](_0x269c34,_0x03d4('0x11a'));}var _0x8daacc=this[_0x03d4('0x11b')][_0x03d4('0x72')](this,_0x269c34['file_id']);if(!_0x8daacc){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x269c34,'no\x20file\x20audio\x20found');}var _0x335fe0=this[_0x03d4('0xe')][_0x03d4('0x11d')](_0x8daacc,_0x269c34[_0x03d4('0x11e')],_0x269c34['digit']);var _0x321435=_0x335fe0[_0x03d4('0xa4')];if(_0x335fe0[_0x03d4('0xa4')]===-0x1){this[_0x03d4('0x36')][_0x03d4('0x72')](this,_0x269c34,'-1');return _0x335fe0;}else if(_0x335fe0[_0x03d4('0xa3')]==='timeout'){_0x335fe0[_0x03d4('0xa4')]=_0x335fe0['result'][_0x03d4('0x9b')]>0x0?_0x335fe0['result']:'t';}else if(_[_0x03d4('0x44')](_0x335fe0['result'])){_0x335fe0['result']='#';_0x321435='#';}if(!this[_0x03d4('0x88')](_0x269c34[_0x03d4('0xdd')])){this['channel'][_0x03d4('0xaa')](_0x03d4('0xdc'));}else{var _0x49db90=this['getVariable'][_0x03d4('0x72')](this,_0x269c34[_0x03d4('0xdd')]);if(!_0x49db90){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x269c34,'no\x20variable\x20found');}this[_0x03d4('0xe')]['setVariable'](_0x49db90,_0x321435);}this[_0x03d4('0x36')][_0x03d4('0x72')](this,_0x269c34,_0x321435);return _0x335fe0;};AGIVertices['prototype'][_0x03d4('0xaa')]=function(_0x3832d6){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x16e'),_0x3832d6['label']));return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x3832d6[_0x03d4('0x16f')]||_0x3832d6[_0x03d4('0x38')]);};AGIVertices[_0x03d4('0x10')][_0x03d4('0x170')]=function(_0x15368c){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('Enter\x20in\x20PAUSE\x20(%s)\x20block',_0x15368c[_0x03d4('0x38')]));if(!this['isConfigured'](_0x15368c['findBy'])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x15368c,_0x03d4('0x15e'));}logger[_0x03d4('0x30')](util['format'](_0x03d4('0x15f'),this[_0x03d4('0xe')][_0x03d4('0x3b')],_0x15368c[_0x03d4('0x15d')]));var _0x26b176=this[_0x03d4('0x4e')][_0x03d4('0x72')](this,_0x15368c[_0x03d4('0x171')]);var _0x27391f=this[_0x03d4('0x51')][_0x03d4('0x72')](this,_0x15368c[_0x03d4('0x15d')],_0x26b176);if(_0x27391f){logger['info'](util['format'](_0x03d4('0x160'),this['channel'][_0x03d4('0x3b')],_0x15368c[_0x03d4('0x15d')]));this[_0x03d4('0xe')][_0x03d4('0xaa')](util['format'](_0x03d4('0x160'),this[_0x03d4('0xe')]['callerid'],_0x15368c[_0x03d4('0x15d')]));return{'code':0xc8,'result':_0x03d4('0x161')};}else{logger['info'](util[_0x03d4('0x28')](_0x03d4('0x162'),this[_0x03d4('0xe')]['callerid'],_0x15368c[_0x03d4('0x15d')]));this[_0x03d4('0xe')]['noop'](util[_0x03d4('0x28')](_0x03d4('0x160'),this[_0x03d4('0xe')][_0x03d4('0x3b')],_0x15368c[_0x03d4('0x15d')]));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0x03d4('0x10')]['playback']=function(_0x30886f){logger[_0x03d4('0x30')](util['format']('Enter\x20in\x20PLAYBACK\x20(%s)\x20block',_0x30886f['label']));if(!this['isConfigured'](_0x30886f[_0x03d4('0x119')])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x30886f,'no\x20file\x20audio\x20selected');}var _0x2d8b9f=this['getSound'][_0x03d4('0x72')](this,_0x30886f[_0x03d4('0x119')]);if(!_0x2d8b9f){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x30886f,_0x03d4('0x11c'));}var _0x4992f0=this[_0x03d4('0xe')][_0x03d4('0x58')](_0x03d4('0x172'),[_0x2d8b9f,_0x30886f['opts']]);if(_0x4992f0[_0x03d4('0xa4')]===-0x1){return _0x4992f0;}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('Executed\x20command\x20%s\x20%s',_0x03d4('0x172'),_0x2d8b9f));};AGIVertices['prototype'][_0x03d4('0x173')]=function(_0x50ad89){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x174'),_0x50ad89[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x50ad89[_0x03d4('0x175')])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x50ad89,'no\x20queue\x20selected');}var _0x161d73='';var _0x42dfd6=parseInt(_0x50ad89[_0x03d4('0x175')],0xa);if(isNaN(_0x42dfd6)){_0x161d73=_0x50ad89[_0x03d4('0x175')];}else{_0x161d73=this[_0x03d4('0x176')]['sync'](this,_0x50ad89[_0x03d4('0x175')]);if(!_0x161d73){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x50ad89,'no\x20queue\x20found');}}var _0x5df795='';if(this[_0x03d4('0x88')](_0x50ad89[_0x03d4('0x119')])){var _0x52c669=this[_0x03d4('0x11b')]['sync'](this,_0x50ad89[_0x03d4('0x119')]);if(_0x52c669){_0x5df795=_0x52c669;}}this[_0x03d4('0x36')]['sync'](this,_0x50ad89,_0x161d73);if(_0x50ad89['opts'][_0x03d4('0x177')]('x')<0x0){_0x50ad89[_0x03d4('0x115')]+='x';}if(_0x50ad89[_0x03d4('0x115')][_0x03d4('0x177')]('X')<0x0){_0x50ad89[_0x03d4('0x115')]+='X';}this['channel'][_0x03d4('0xa0')](_0x03d4('0x178'),_0x161d73?_0x161d73['toLowerCase']():'');var _0x252b19=this[_0x03d4('0xe')][_0x03d4('0x58')](_0x03d4('0x179'),[_0x161d73,_0x50ad89['opts'],_0x50ad89[_0x03d4('0x65')],_0x5df795,_0x50ad89['timeout'],_0x50ad89[_0x03d4('0x6')],_0x50ad89[_0x03d4('0x17a')],_0x50ad89['gosub'],'',_0x50ad89[_0x03d4('0x17b')]]);if(_0x252b19[_0x03d4('0xa4')]===-0x1){return _0x252b19;}return this['channel']['noop'](util[_0x03d4('0x28')]('Executed\x20command\x20%s\x20%s',_0x03d4('0x179'),_0x161d73));};AGIVertices['prototype'][_0x03d4('0x17c')]=function(_0x165484){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x165484['label']));var _0x58ea57=_0x165484[_0x03d4('0x17d')]||_0x03d4('0x139');var _0x3031ae=util[_0x03d4('0x28')](_0x03d4('0x17e'),this[_0x03d4('0xe')]['uniqueid'],rs[_0x03d4('0x123')](0x5));var _0x21d111=util[_0x03d4('0x28')](_0x03d4('0x17f'),FILES_PATH,_0x3031ae,_0x58ea57);var _0x2a0bc7=util['format'](_0x03d4('0x13a'),FILES_PATH,_0x3031ae);this[_0x03d4('0x3c')][_0x03d4('0x72')](this,_0x165484,_0x3031ae,_0x21d111);this['channel'][_0x03d4('0xa0')](_0x03d4('0x180'),_0x3031ae);logger[_0x03d4('0x30')](_0x03d4('0x181'),_0x2a0bc7,_0x58ea57,_0x165484['escape_digits'],_0x165484['timeout']);return this[_0x03d4('0xe')]['recordFile'](_0x2a0bc7,_0x58ea57,_0x165484[_0x03d4('0x182')],_0x165484[_0x03d4('0x67')],undefined,!![]);};AGIVertices[_0x03d4('0x10')][_0x03d4('0x183')]=function(_0x72acfd){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('Enter\x20in\x20RESTAPI\x20(%s)\x20block',_0x72acfd[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x72acfd['url'])){return this['channel'][_0x03d4('0xaa')]('no\x20url\x20configured');}var _0x133287=this[_0x03d4('0x64')][_0x03d4('0x72')](this,_0x72acfd);logger[_0x03d4('0x30')](util['format']('Response:',util[_0x03d4('0x184')](_0x133287,{'showHidden':![],'depth':null})));if(!this[_0x03d4('0x88')](_0x72acfd[_0x03d4('0xdd')])){return this['channel'][_0x03d4('0xaa')]('no\x20variable\x20selected\x20for\x20the\x20response');}var _0x13ee12=this[_0x03d4('0x11')][_0x03d4('0x72')](this,_0x72acfd[_0x03d4('0xdd')]);if(!_0x13ee12){return this['channel'][_0x03d4('0x2c')](_0x72acfd,'no\x20variable\x20found');}this[_0x03d4('0xe')][_0x03d4('0xa0')](util['format'](_0x03d4('0x185'),_0x13ee12),_0x133287[_0x03d4('0x77')]?_0x133287['statusCode']:_0x03d4('0x186'));this[_0x03d4('0xe')][_0x03d4('0xa0')](util[_0x03d4('0x28')](_0x03d4('0x187'),_0x13ee12),_0x133287[_0x03d4('0x78')]?_0x133287[_0x03d4('0x78')]:'OK');if(_0x133287['body']){try{this['saveRestApiResult'](_0x133287[_0x03d4('0x6d')],_0x13ee12);}catch(_0x423feb){logger[_0x03d4('0x2c')](util['format'](_0x03d4('0x188'),_0x13ee12));}}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xe3'),_0x13ee12));};AGIVertices['prototype']['saydigits']=function(_0x5e52d8){logger[_0x03d4('0x30')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5e52d8[_0x03d4('0x38')]));return this[_0x03d4('0xe')][_0x03d4('0x189')](_0x5e52d8[_0x03d4('0x18a')]['replace'](/\s+/g,''),_0x5e52d8[_0x03d4('0x182')]);};AGIVertices['prototype'][_0x03d4('0x18b')]=function(_0x470a70){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x470a70[_0x03d4('0x38')]));return this['channel']['sayNumber'](_0x470a70['number']['replace'](/\s+/g,''),_0x470a70[_0x03d4('0x182')]);};AGIVertices['prototype'][_0x03d4('0x18c')]=function(_0x1a7950){logger['info'](util[_0x03d4('0x28')](_0x03d4('0x18d'),_0x1a7950[_0x03d4('0x38')]));return this[_0x03d4('0xe')][_0x03d4('0x18e')](_0x1a7950[_0x03d4('0x5c')],_0x1a7950[_0x03d4('0x182')]);};AGIVertices[_0x03d4('0x10')][_0x03d4('0x18f')]=function(_0xe51625){logger[_0x03d4('0x30')](util['format'](_0x03d4('0x190'),_0xe51625['label']));if(!this[_0x03d4('0x88')](_0xe51625[_0x03d4('0x191')])){return this['channel'][_0x03d4('0xaa')](_0x03d4('0x192'));}var _0xcf8096=this[_0x03d4('0x193')][_0x03d4('0x72')](this,_0xe51625[_0x03d4('0x191')]);if(!_0xcf8096||!_0xcf8096[_0x03d4('0x194')]){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0xe51625,_0x03d4('0x195'));}var _0x1e730c={'from':util['format'](_0x03d4('0x196'),_0xcf8096['name'],_0xcf8096[_0x03d4('0x197')]||_0xcf8096[_0x03d4('0x194')][_0x03d4('0x198')]),'to':_0xe51625['to']||'','cc':_0xe51625['cc']||'','bcc':_0xe51625[_0x03d4('0x199')]||'','subject':_0xe51625[_0x03d4('0x19a')],'html':_0xe51625[_0x03d4('0x5c')],'text':_0xe51625[_0x03d4('0x5c')]};var _0x16afd5={'tls':{'rejectUnauthorized':![]}};if(_0xcf8096['Smtp'][_0x03d4('0x19b')]){_0x16afd5[_0x03d4('0x19b')]=_0xcf8096[_0x03d4('0x194')]['service'];}else{_0x16afd5['host']=_0xcf8096[_0x03d4('0x194')][_0x03d4('0x19c')];_0x16afd5[_0x03d4('0x19d')]=_0xcf8096[_0x03d4('0x194')][_0x03d4('0x19d')];_0x16afd5[_0x03d4('0x19e')]=_0xcf8096['Smtp']['secure'];}if(_0xcf8096[_0x03d4('0x194')][_0x03d4('0x19f')]){_0x16afd5[_0x03d4('0x1a0')]={'user':_0xcf8096[_0x03d4('0x194')][_0x03d4('0x198')],'pass':_0xcf8096[_0x03d4('0x194')][_0x03d4('0x1a1')]};}if(this['isConfigured'](_0xe51625['template_id'])){}logger[_0x03d4('0xe5')]('sendMail\x20message',JSON[_0x03d4('0x75')](_0x1e730c));this[_0x03d4('0x36')][_0x03d4('0x72')](this,_0xe51625,_0xe51625[_0x03d4('0x191')]);this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('Trying\x20SendMail\x20with\x20account\x20%s',_0xcf8096[_0x03d4('0x13')]));this[_0x03d4('0x21')][_0x03d4('0x72')](this,_0x16afd5,_0x1e730c);return this[_0x03d4('0xe')]['noop'](_0x03d4('0x1a2'));};AGIVertices[_0x03d4('0x10')]['sendFax']=function(_0x53dc53){logger['info'](util['format'](_0x03d4('0x1a3'),_0x53dc53[_0x03d4('0x38')]));return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0x1a4'));};AGIVertices['prototype']['sendSMS']=function(_0x357091){logger['info'](util[_0x03d4('0x28')](_0x03d4('0x1a5'),_0x357091[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x357091[_0x03d4('0x1a6')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0x1a7'));}var _0x46857f=this[_0x03d4('0x1a8')][_0x03d4('0x72')](this,_0x357091[_0x03d4('0x1a6')]);if(!_0x46857f){return this[_0x03d4('0xe')]['error'](_0x357091,'no\x20sms\x20account\x20found');}var _0x29ac4e={'body':_0x357091['sms_text'],'phone':_0x357091['to']||'','SmsAccountId':_0x46857f['id']};logger[_0x03d4('0xe5')](_0x03d4('0x1a9'),JSON[_0x03d4('0x75')](_0x29ac4e));this[_0x03d4('0x36')][_0x03d4('0x72')](this,_0x357091,_0x357091[_0x03d4('0x1a6')]);this[_0x03d4('0xe')][_0x03d4('0xaa')](util['format']('Trying\x20SendSMS\x20with\x20account\x20%s',_0x46857f['name']));this[_0x03d4('0x35')][_0x03d4('0x72')](this,_0x29ac4e);return this['channel'][_0x03d4('0xaa')](_0x03d4('0x1aa'));};AGIVertices[_0x03d4('0x10')][_0x03d4('0x1ab')]=function(_0xb21588){logger['info'](util[_0x03d4('0x28')]('Enter\x20in\x20SET\x20(%s)\x20block',_0xb21588[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0xb21588[_0x03d4('0xdd')])){return this['channel'][_0x03d4('0x2c')](_0xb21588,'no\x20variable\x20selected');}var _0x216990=this[_0x03d4('0x11')][_0x03d4('0x72')](this,_0xb21588['variable_id']);if(!_0x216990){return this['channel'][_0x03d4('0x2c')](_0xb21588,_0x03d4('0xde'));}return this[_0x03d4('0xe')][_0x03d4('0xa0')](_0x216990,_0xb21588[_0x03d4('0x1ac')]);};AGIVertices[_0x03d4('0x10')][_0x03d4('0x1ad')]=function(_0x2f3c2f){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('Enter\x20in\x20START\x20(%s)\x20block',_0x2f3c2f[_0x03d4('0x38')]));this[_0x03d4('0xe')][_0x03d4('0xaa')]('START\x20CALLY\x20SQUARE');if(_0x2f3c2f['answer']===_0x03d4('0x1ae')){this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0x1af'));return this['channel']['answer']();}return this[_0x03d4('0xe')]['noop'](_0x03d4('0x1b0'));};AGIVertices[_0x03d4('0x10')][_0x03d4('0x1b1')]=function(_0x3aa476){logger[_0x03d4('0x30')](util['format'](_0x03d4('0x1b2'),_0x3aa476[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x3aa476['project_id'])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x3aa476,'no\x20subproject\x20selected');}var _0x24f835=this[_0x03d4('0x16')][_0x03d4('0x72')](this,_0x3aa476['project_id']);if(!this[_0x03d4('0x88')](_0x24f835)){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x3aa476,util[_0x03d4('0x28')](_0x03d4('0x1b3'),_0x3aa476[_0x03d4('0x1b4')]));}if(_0x24f835===this['channel'][_0x03d4('0x3a')]){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x3aa476,'project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project');}this[_0x03d4('0x36')]['sync'](this,_0x3aa476,_0x24f835);var _0x425b8b=this[_0x03d4('0xe')][_0x03d4('0x58')](_0x03d4('0x1b5'),util[_0x03d4('0x28')](_0x03d4('0x1b6'),config[_0x03d4('0x6')][_0x03d4('0x19c')]||'127.0.0.1',_0x24f835,this[_0x03d4('0xe')][_0x03d4('0x3a')]));if(_0x425b8b[_0x03d4('0xa4')]===-0x1){return _0x425b8b;}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0xc8'),_0x03d4('0x1b5'),_0x24f835));};AGIVertices[_0x03d4('0x10')]['system']=function(_0x26181e){logger['info'](util[_0x03d4('0x28')](_0x03d4('0x1b7'),_0x26181e[_0x03d4('0x38')]));var _0x3f269d=this[_0x03d4('0x1b8')][_0x03d4('0x72')](this,_0x26181e['command']);this['createSquareDetailsReport']['sync'](this,_0x26181e,_0x26181e['command']);if(this[_0x03d4('0x88')](_0x26181e[_0x03d4('0xdd')])){var _0x182e07=this[_0x03d4('0x11')]['sync'](this,_0x26181e[_0x03d4('0xdd')]);if(_0x182e07){this[_0x03d4('0xe')][_0x03d4('0xa0')](_0x182e07,_0x3f269d);return this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s',_0x26181e[_0x03d4('0xba')],_0x182e07));}}return this['channel'][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x1b9'),_0x26181e[_0x03d4('0xba')]));};AGIVertices[_0x03d4('0x10')]['google_cloud_tts']=function(_0x159e4e){logger[_0x03d4('0x30')](util['format']('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x159e4e[_0x03d4('0x38')]));_0x159e4e[_0x03d4('0x5c')]=_0x159e4e[_0x03d4('0x5c')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x03d4('0x88')](_0x159e4e[_0x03d4('0x5b')])){return this[_0x03d4('0xe')][_0x03d4('0xaa')](_0x03d4('0x1ba'));}if(!this[_0x03d4('0x88')](_0x159e4e[_0x03d4('0x5c')])){return this[_0x03d4('0xe')]['noop'](_0x03d4('0xab'));}this['channel']['noop'](util[_0x03d4('0x28')](_0x03d4('0x1bb'),_0x159e4e[_0x03d4('0x5c')]));var _0x473c60=this['googleCloudTTS']['sync'](this,_0x159e4e);if(_0x473c60){this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x1bc'),_0x473c60));var _0x974520=this[_0x03d4('0xe')][_0x03d4('0x15a')](_0x473c60);try{fs[_0x03d4('0x108')](_0x473c60+_0x03d4('0x12e'));}catch(_0x4f07d5){logger['error'](_0x4f07d5);}return _0x974520;}return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x159e4e,_0x03d4('0x1bd'));};AGIVertices[_0x03d4('0x10')][_0x03d4('0x1be')]=function(_0x4af9b2){logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x4af9b2[_0x03d4('0x38')]));_0x4af9b2[_0x03d4('0x5c')]=_0x4af9b2[_0x03d4('0x5c')][_0x03d4('0x59')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0x03d4('0x88')](_0x4af9b2['text'])){return this['channel'][_0x03d4('0xaa')](_0x03d4('0xab'));}this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x1bf'),_0x4af9b2[_0x03d4('0x5c')]));var _0x5a75f7=this[_0x03d4('0x62')][_0x03d4('0x72')](this,_0x4af9b2);if(_0x5a75f7){this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')](_0x03d4('0x1c0'),_0x5a75f7));var _0x4291da=this['channel'][_0x03d4('0x15a')](_0x5a75f7);try{fs[_0x03d4('0x108')](_0x5a75f7+_0x03d4('0x12e'));}catch(_0x83fd28){logger[_0x03d4('0x2c')](_0x83fd28);}return _0x4291da;}return this[_0x03d4('0xe')]['error'](_0x4af9b2,_0x03d4('0x1c1'));};AGIVertices[_0x03d4('0x10')][_0x03d4('0x1c2')]=function(_0x2d3458){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x1c3'),_0x2d3458[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x2d3458['findBy'])){return this[_0x03d4('0xe')][_0x03d4('0x2c')](_0x2d3458,_0x03d4('0x15e'));}logger[_0x03d4('0x30')](util[_0x03d4('0x28')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0x03d4('0x3b')],_0x2d3458['findBy']));var _0x37e7b3=this[_0x03d4('0x52')][_0x03d4('0x72')](this,_0x2d3458[_0x03d4('0x15d')]);if(_0x37e7b3){logger['info'](util[_0x03d4('0x28')](_0x03d4('0x160'),this[_0x03d4('0xe')][_0x03d4('0x3b')],_0x2d3458['findBy']));this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('AGENT\x20%s\x20FOUND\x20BY',this[_0x03d4('0xe')]['callerid'],_0x2d3458[_0x03d4('0x15d')]));return{'code':0xc8,'result':_0x03d4('0x161')};}else{logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x162'),this[_0x03d4('0xe')][_0x03d4('0x3b')],_0x2d3458['findBy']));this[_0x03d4('0xe')][_0x03d4('0xaa')](util[_0x03d4('0x28')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0x03d4('0xe')][_0x03d4('0x3b')],_0x2d3458[_0x03d4('0x15d')]));return{'code':0xc8,'result':_0x03d4('0x163')};}};AGIVertices[_0x03d4('0x10')][_0x03d4('0x1c4')]=function(_0x21ab5){logger[_0x03d4('0x30')](util[_0x03d4('0x28')](_0x03d4('0x1c5'),_0x21ab5[_0x03d4('0x38')]));var _0x7dd202=this[_0x03d4('0xe')][_0x03d4('0x58')](_0x03d4('0x1c6'),[_0x21ab5[_0x03d4('0x1c7')],_0x21ab5[_0x03d4('0x7b')]]);if(_0x7dd202['result']===-0x1){return _0x7dd202;}return this[_0x03d4('0xe')][_0x03d4('0xaa')](util['format']('Executed\x20command\x20%s\x20%s',_0x03d4('0x1c6'),_0x21ab5[_0x03d4('0x1c7')]));};AGIVertices['prototype'][_0x03d4('0x1c8')]=function(_0x438c21){logger['info'](util[_0x03d4('0x28')](_0x03d4('0x1c9'),_0x438c21[_0x03d4('0x38')]));if(!this[_0x03d4('0x88')](_0x438c21['variable_id'])){return this[_0x03d4('0xe')]['error'](_0x438c21,_0x03d4('0x1ca'));}var _0x10bf6f=this[_0x03d4('0x11')][_0x03d4('0x72')](this,_0x438c21[_0x03d4('0xdd')]);if(!_0x10bf6f){return this['channel'][_0x03d4('0x2c')](_0x438c21,_0x03d4('0xde'));}var _0x28fe95=this['channel']['getVariable'](_0x10bf6f);return{'code':0xc8,'result':_0x28fe95['extra']?_0x28fe95[_0x03d4('0xa3')]:'-'};};String[_0x03d4('0x10')][_0x03d4('0xa2')]=function(_0x34c33d,_0x568253){return this[_0x03d4('0xa1')](_0x34c33d)[_0x03d4('0x1cb')](_0x568253);};module['exports']=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index 5b11eff..368ee62 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 _0x664e=['stopAcw','lastPauseAt','YYYY-MM-DD\x20HH:mm:ss','uniqueid','timer','[%s][UPDATE][ACWTIME:%s]','catch','error','finally','[ACW][START]\x20%s','message','saveUnpause','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','syncAgentConnectPreview','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','attended','[%s][HANGUP:UNIQUEID]','[%s][HANGUP:LINKEDID]','linkedid','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','util','lodash','moment','../ami','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','syncHangupRequest','bind','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','milliseconds','diff','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','getAgent','then','voicePause','info','destlinkedid','savePause','acwTimeout'];(function(_0x1a9a40,_0x2c3e46){var _0x4f0664=function(_0x11c3e6){while(--_0x11c3e6){_0x1a9a40['push'](_0x1a9a40['shift']());}};_0x4f0664(++_0x2c3e46);}(_0x664e,0x170));var _0xe664=function(_0x183d63,_0x399147){_0x183d63=_0x183d63-0x0;var _0x5e4a1d=_0x664e[_0x183d63];return _0x5e4a1d;};'use strict';var util=require(_0xe664('0x0'));var _=require(_0xe664('0x1'));var moment=require(_0xe664('0x2'));var ami=require(_0xe664('0x3'));var logger=require('../../../config/logger')(_0xe664('0x4'));var RpcUser=require(_0xe664('0x5'));var RpcVoiceAgentReport=require(_0xe664('0x6'));function Acw(_0x8ab287){this['voiceQueues']=_0x8ab287[_0xe664('0x7')];this[_0xe664('0x8')]=_0x8ab287['agents'];this[_0xe664('0x9')]=_0x8ab287[_0xe664('0x9')];this[_0xe664('0xa')]={};ami['on'](_0xe664('0xb'),this[_0xe664('0xc')]['bind'](this));ami['on']('hanguprequest',this[_0xe664('0xd')][_0xe664('0xe')](this));ami['on'](_0xe664('0xf'),this[_0xe664('0x10')][_0xe664('0xe')](this));ami['on'](_0xe664('0x11'),this[_0xe664('0x12')]['bind'](this));ami['on'](_0xe664('0x13'),this[_0xe664('0x14')][_0xe664('0xe')](this));ami['on'](_0xe664('0x15'),this[_0xe664('0x16')][_0xe664('0xe')](this));ami['on'](_0xe664('0x17'),this['syncAgentConnectPreview'][_0xe664('0xe')](this));}function getDiff(_0x1d714a){var _0x5d0a86=moment()[_0xe664('0x18')](0x0);var _0x1d770f=moment(_0x1d714a)[_0xe664('0x18')](0x0);return _0x5d0a86[_0xe664('0x19')](_0x1d770f,_0xe664('0x1a'));}Acw[_0xe664('0x1b')][_0xe664('0x1c')]=function(_0x57aa87){try{var _0x50bbe9=this;var _0x375a0d=this[_0xe664('0xa')][_0x57aa87][_0xe664('0x1d')];var _0x4e4b02=this[_0xe664('0xa')][_0x57aa87][_0xe664('0x1e')];var _0x42931f=this[_0xe664('0x7')][_0x4e4b02];var _0x2aee70=![];var _0x4f7791=_0xe664('0x1f');if(_0x42931f[_0xe664('0x20')]){if(_0x42931f[_0xe664('0x21')][_0xe664('0x22')]){_0x2aee70=!![];_0x4f7791=_0x42931f[_0xe664('0x21')][_0xe664('0x22')];}}ami['Action']({'action':'QueuePause','interface':_0x375a0d,'paused':!![],'reason':_0x4f7791})['then'](function(_0x1fd2ac){if(_0x50bbe9[_0xe664('0x8')][_0x375a0d]){return RpcUser[_0xe664('0x23')](_0x50bbe9[_0xe664('0x8')][_0x375a0d]['id'])[_0xe664('0x24')](function(_0x4bfd76){if(_0x4bfd76&&!_0x4bfd76[_0xe664('0x25')]){logger[_0xe664('0x26')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x57aa87,_0x375a0d,_0x4e4b02);var _0xdc80c0=_0x50bbe9[_0xe664('0xa')][_0x57aa87]['attended']&&_0x50bbe9[_0xe664('0xa')][_0x57aa87][_0xe664('0x27')]?_0x50bbe9[_0xe664('0xa')][_0x57aa87][_0xe664('0x27')]:_0x57aa87;return RpcUser[_0xe664('0x28')](_0x50bbe9[_0xe664('0x8')][_0x375a0d],_0x4f7791,_0xdc80c0)[_0xe664('0x24')](function(_0x31a381){if(!_0x2aee70){_0x50bbe9[_0xe664('0x9')][_0x375a0d]={};logger['info']('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x57aa87,_0x50bbe9[_0xe664('0x7')][_0x4e4b02][_0xe664('0x29')],_0x375a0d,_0x4e4b02);_0x50bbe9[_0xe664('0x9')][_0x375a0d]['timer']=setTimeout(_0x50bbe9[_0xe664('0x2a')]['bind'](_0x50bbe9,_0x375a0d),_0x50bbe9[_0xe664('0x7')][_0x4e4b02][_0xe664('0x29')]*0x3e8);_0x50bbe9[_0xe664('0x9')][_0x375a0d][_0xe664('0x2b')]=moment()['format'](_0xe664('0x2c'));_0x50bbe9['timers'][_0x375a0d][_0xe664('0x2d')]=_0x57aa87;_0x50bbe9[_0xe664('0x9')][_0x375a0d][_0xe664('0x1e')]=_0x4e4b02;_0x50bbe9[_0xe664('0x9')][_0x375a0d]['updateAcw']=function(){var _0x2584b0=getDiff(_0x50bbe9['timers'][_0x375a0d][_0xe664('0x2b')]);clearTimeout(_0x50bbe9[_0xe664('0x9')][_0x375a0d][_0xe664('0x2e')]);_0x50bbe9['timers'][_0x375a0d]['timer']=![];RpcVoiceAgentReport['update']({'acwtime':_0x2584b0},_0x50bbe9[_0xe664('0x9')][_0x375a0d][_0xe664('0x2d')],_0x375a0d)[_0xe664('0x24')](function(_0x44b6bc){logger[_0xe664('0x26')](_0xe664('0x2f'),_0x57aa87,_0x2584b0,_0x44b6bc);})[_0xe664('0x30')](function(_0x11c4f1){logger[_0xe664('0x31')]('[%s][UPDATE][ERRORS:%s]',_0x57aa87,_0x11c4f1);});delete _0x50bbe9[_0xe664('0x9')][_0x375a0d];};}});}else{logger['info']('[%s][INPAUSE][AGENT:%s][QUEUE:%s]',_0x57aa87,_0x375a0d,_0x4e4b02);}});}})[_0xe664('0x30')](function(_0x28656e){logger[_0xe664('0x31')]('[%s][TIMER:%s][AGENT:%s][QUEUE:%s]',_0x57aa87,_0x50bbe9[_0xe664('0x7')][_0x4e4b02][_0xe664('0x29')],_0x375a0d,_0x4e4b02);})[_0xe664('0x32')](function(){delete _0x50bbe9[_0xe664('0xa')][_0x57aa87];});}catch(_0x295a6d){logger[_0xe664('0x31')](_0xe664('0x33'),_0x295a6d[_0xe664('0x34')]);}};Acw[_0xe664('0x1b')]['stopAcw']=function(_0x46e505){try{var _0x217680=this;if(_0x217680[_0xe664('0x9')][_0x46e505]){_0x217680[_0xe664('0x9')][_0x46e505][_0xe664('0x2e')]=![];var _0x135d82=_0x217680[_0xe664('0x9')][_0x46e505][_0xe664('0x2d')];var _0x2943fd=_0x217680[_0xe664('0x9')][_0x46e505][_0xe664('0x1e')];var _0x2a59f3=_0x217680[_0xe664('0x7')][_0x2943fd][_0xe664('0x29')];logger[_0xe664('0x26')]('[%s][TIMER][STOP][AGENT:%s]',_0x135d82,_0x46e505);RpcUser[_0xe664('0x35')](this['agents'][_0x46e505]);RpcVoiceAgentReport['update']({'acwtime':_0x2a59f3,'agentacw':!![]},_0x135d82,_0x46e505)[_0xe664('0x24')](function(_0x332752){logger[_0xe664('0x26')](_0xe664('0x2f'),_0x135d82,_0x2a59f3,_0x332752);})[_0xe664('0x30')](function(_0x41efb2){logger[_0xe664('0x31')](_0xe664('0x36'),_0x135d82,_0x41efb2);});}else{logger[_0xe664('0x31')](_0xe664('0x37'),_0x46e505);if(_0x217680[_0xe664('0x9')]){logger['info']('[ACW][TIMERS]',JSON[_0xe664('0x38')](_0x217680[_0xe664('0x9')]));}}}catch(_0x218fad){logger[_0xe664('0x31')](_0xe664('0x39'),_0x218fad['message']);}};Acw['prototype'][_0xe664('0xc')]=function(_0x2e8188){try{if(this[_0xe664('0x7')][_0x2e8188[_0xe664('0x1e')]]&&(this[_0xe664('0x7')][_0x2e8188[_0xe664('0x1e')]]['acw']||this[_0xe664('0x7')][_0x2e8188[_0xe664('0x1e')]][_0xe664('0x20')])){if(this[_0xe664('0x8')][_0x2e8188['interface']]){this['channels'][_0x2e8188[_0xe664('0x2d')]]={'queue':_0x2e8188[_0xe664('0x1e')],'interface':_0x2e8188[_0xe664('0x1d')],'destlinkedid':_0x2e8188[_0xe664('0x27')]};}}}catch(_0x5872e5){logger['error'](_0xe664('0x3a'),_0x5872e5[_0xe664('0x34')]);}};Acw[_0xe664('0x1b')][_0xe664('0x3b')]=function(_0x3bfca1){try{if(this[_0xe664('0x7')][_0x3bfca1[_0xe664('0x1e')]]&&(this['voiceQueues'][_0x3bfca1[_0xe664('0x1e')]][_0xe664('0x4')]||this[_0xe664('0x7')][_0x3bfca1[_0xe664('0x1e')]]['mandatoryDisposition'])){if(this['agents'][_0x3bfca1[_0xe664('0x1d')]]){this[_0xe664('0xa')][_0x3bfca1[_0xe664('0x2d')]]={'queue':_0x3bfca1[_0xe664('0x1e')],'interface':_0x3bfca1[_0xe664('0x1d')]};}}}catch(_0xfccc41){logger[_0xe664('0x31')](_0xe664('0x3c'),_0xfccc41[_0xe664('0x34')]);}};Acw[_0xe664('0x1b')][_0xe664('0xd')]=function(_0x2955bc){try{if(this['channels'][_0x2955bc[_0xe664('0x2d')]]&&_[_0xe664('0x3d')](this[_0xe664('0xa')][_0x2955bc[_0xe664('0x2d')]][_0xe664('0x3e')])){logger[_0xe664('0x26')](_0xe664('0x3f'),_0x2955bc[_0xe664('0x2d')]);this[_0xe664('0x1c')](_0x2955bc[_0xe664('0x2d')]);}else if(this['channels'][_0x2955bc['linkedid']]&&_[_0xe664('0x3d')](this[_0xe664('0xa')][_0x2955bc['linkedid']][_0xe664('0x3e')])){logger[_0xe664('0x26')](_0xe664('0x40'),_0x2955bc[_0xe664('0x41')]);this[_0xe664('0x1c')](_0x2955bc[_0xe664('0x41')]);}}catch(_0x151594){logger[_0xe664('0x31')](_0xe664('0x42'),_0x151594['message']);}};Acw[_0xe664('0x1b')][_0xe664('0x10')]=function(_0x501884){try{if(this[_0xe664('0xa')][_0x501884[_0xe664('0x2d')]]&&this[_0xe664('0xa')][_0x501884['uniqueid']][_0xe664('0x3e')]){logger['info']('[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]',_0x501884['uniqueid']);this['startAcw'](_0x501884[_0xe664('0x2d')]);}else if(this[_0xe664('0xa')][_0x501884[_0xe664('0x41')]]&&this[_0xe664('0xa')][_0x501884['linkedid']][_0xe664('0x3e')]){logger[_0xe664('0x26')](_0xe664('0x43'),_0x501884[_0xe664('0x41')]);this[_0xe664('0x1c')](_0x501884[_0xe664('0x41')]);}}catch(_0x282974){logger[_0xe664('0x31')](_0xe664('0x44'),_0x282974[_0xe664('0x34')]);}};Acw[_0xe664('0x1b')][_0xe664('0x14')]=function(_0x3c733e){try{if(!_[_0xe664('0x45')](this[_0xe664('0xa')][_0x3c733e['transfereeuniqueid']])){this[_0xe664('0x1c')](_0x3c733e['transfereeuniqueid']);if(this['channels'][_0x3c733e[_0xe664('0x46')]]){this[_0xe664('0xa')][_0x3c733e['secondtransfereruniqueid']][_0xe664('0x3e')]=!![];this[_0xe664('0xa')][_0x3c733e[_0xe664('0x47')]]=this[_0xe664('0xa')][_0x3c733e['secondtransfereruniqueid']];delete this['channels'][_0x3c733e[_0xe664('0x46')]];}}else if(!_['isNil'](this[_0xe664('0xa')][_0x3c733e['transfertargetuniqueid']])){this[_0xe664('0x1c')](_0x3c733e[_0xe664('0x47')]);if(this[_0xe664('0xa')][_0x3c733e['origtransfereruniqueid']]){this['channels'][_0x3c733e['origtransfereruniqueid']]['attended']=!![];this[_0xe664('0xa')][_0x3c733e['transfereeuniqueid']]=this[_0xe664('0xa')][_0x3c733e[_0xe664('0x48')]];delete this[_0xe664('0xa')][_0x3c733e[_0xe664('0x48')]];}}}catch(_0xc842d2){logger[_0xe664('0x31')](_0xe664('0x49'),_0xc842d2[_0xe664('0x34')]);}};Acw[_0xe664('0x1b')][_0xe664('0x16')]=function(_0x455dbd){try{if(this[_0xe664('0xa')][_0x455dbd['transfereruniqueid']]){logger[_0xe664('0x26')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON['stringify'](_0x455dbd[_0xe664('0x4a')]));this['startAcw'](_0x455dbd['transfereruniqueid']);}else if(this[_0xe664('0xa')][_0x455dbd[_0xe664('0x4b')]]){logger[_0xe664('0x26')](_0xe664('0x4c'),JSON[_0xe664('0x38')](_0x455dbd[_0xe664('0x4b')]));this[_0xe664('0x1c')](_0x455dbd[_0xe664('0x4b')]);}}catch(_0x5a0916){logger['error']('[ACW][syncBlindTransfer]\x20%s',_0x5a0916[_0xe664('0x34')]);}};Acw[_0xe664('0x1b')]['syncAgentRingNoAnswer']=function(_0xc63f87){try{if(this[_0xe664('0x7')][_0xc63f87[_0xe664('0x1e')]]&&this[_0xe664('0x7')][_0xc63f87['queue']][_0xe664('0x4d')]==='all'){if(this[_0xe664('0x8')][_0xc63f87['interface']]){logger[_0xe664('0x26')](_0xe664('0x4e'),_0xc63f87[_0xe664('0x2d')],_0xc63f87['interface'],_0xc63f87[_0xe664('0x1e')]);return RpcUser[_0xe664('0x28')](this['agents'][_0xc63f87[_0xe664('0x1d')]],_0xe664('0x4f'),_0xc63f87['uniqueid']);}}}catch(_0x266f23){logger['error'](_0xe664('0x50'),_0x266f23[_0xe664('0x34')]);}};module[_0xe664('0x51')]=Acw; \ No newline at end of file +var _0x1131=['isUndefined','[%s][HANGUP:UNIQUEID]','linkedid','[%s][HANGUP:LINKEDID]','startAcw','[ACW][syncHangupRequest]\x20%s','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','isNil','origtransfereruniqueid','[ACW][syncAttendedTransfer]\x20%s','[%s][BLINDTRANSFER:UNIQUEID]','transfereruniqueid','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','Auto-Pause','exports','util','lodash','moment','../../../config/logger','acw','../rpc/user','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','queue','ACW','mandatoryDisposition','mandatoryDispositionPause','name','Action','then','getAgent','[%s][START][AGENT:%s][QUEUE:%s]','attended','destlinkedid','savePause','info','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','stopAcw','format','timer','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','error','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','finally','message','prototype','saveUnpause','update','[%s][UPDATE][ERRORS:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','interface','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s'];(function(_0x4e969d,_0x111c9b){var _0x44a5fa=function(_0x42cdf5){while(--_0x42cdf5){_0x4e969d['push'](_0x4e969d['shift']());}};_0x44a5fa(++_0x111c9b);}(_0x1131,0xc2));var _0x1113=function(_0xb5556b,_0x3cb6e7){_0xb5556b=_0xb5556b-0x0;var _0x39c106=_0x1131[_0xb5556b];return _0x39c106;};'use strict';var util=require(_0x1113('0x0'));var _=require(_0x1113('0x1'));var moment=require(_0x1113('0x2'));var ami=require('../ami');var logger=require(_0x1113('0x3'))(_0x1113('0x4'));var RpcUser=require(_0x1113('0x5'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');function Acw(_0x30abac){this['voiceQueues']=_0x30abac[_0x1113('0x6')];this[_0x1113('0x7')]=_0x30abac[_0x1113('0x7')];this[_0x1113('0x8')]=_0x30abac[_0x1113('0x8')];this[_0x1113('0x9')]={};ami['on'](_0x1113('0xa'),this[_0x1113('0xb')][_0x1113('0xc')](this));ami['on']('hanguprequest',this[_0x1113('0xd')][_0x1113('0xc')](this));ami['on'](_0x1113('0xe'),this[_0x1113('0xf')][_0x1113('0xc')](this));ami['on'](_0x1113('0x10'),this[_0x1113('0x11')][_0x1113('0xc')](this));ami['on'](_0x1113('0x12'),this[_0x1113('0x13')][_0x1113('0xc')](this));ami['on'](_0x1113('0x14'),this[_0x1113('0x15')]['bind'](this));ami['on'](_0x1113('0x16'),this[_0x1113('0x17')]['bind'](this));}function getDiff(_0x28b43a){var _0x202a40=moment()[_0x1113('0x18')](0x0);var _0x271be9=moment(_0x28b43a)[_0x1113('0x18')](0x0);return _0x202a40[_0x1113('0x19')](_0x271be9,'seconds');}Acw['prototype']['startAcw']=function(_0x36290f){try{var _0x698edc=this;var _0x8ecd99=this[_0x1113('0x9')][_0x36290f]['interface'];var _0x253673=this[_0x1113('0x9')][_0x36290f][_0x1113('0x1a')];var _0x5a61fc=this[_0x1113('0x6')][_0x253673];var _0x1e4975=![];var _0x240dd2=_0x1113('0x1b');if(_0x5a61fc[_0x1113('0x1c')]){if(_0x5a61fc[_0x1113('0x1d')]['name']){_0x1e4975=!![];_0x240dd2=_0x5a61fc[_0x1113('0x1d')][_0x1113('0x1e')];}}ami[_0x1113('0x1f')]({'action':'QueuePause','interface':_0x8ecd99,'paused':!![],'reason':_0x240dd2})[_0x1113('0x20')](function(_0x1f8257){if(_0x698edc[_0x1113('0x7')][_0x8ecd99]){return RpcUser[_0x1113('0x21')](_0x698edc[_0x1113('0x7')][_0x8ecd99]['id'])[_0x1113('0x20')](function(_0xf04fbb){if(_0xf04fbb&&!_0xf04fbb['voicePause']){logger['info'](_0x1113('0x22'),_0x36290f,_0x8ecd99,_0x253673);var _0x34a268=_0x698edc[_0x1113('0x9')][_0x36290f][_0x1113('0x23')]&&_0x698edc[_0x1113('0x9')][_0x36290f][_0x1113('0x24')]?_0x698edc[_0x1113('0x9')][_0x36290f]['destlinkedid']:_0x36290f;return RpcUser[_0x1113('0x25')](_0x698edc[_0x1113('0x7')][_0x8ecd99],_0x240dd2,_0x34a268)['then'](function(_0x5970a8){if(!_0x1e4975){_0x698edc[_0x1113('0x8')][_0x8ecd99]={};logger[_0x1113('0x26')](_0x1113('0x27'),_0x36290f,_0x698edc['voiceQueues'][_0x253673][_0x1113('0x28')],_0x8ecd99,_0x253673);_0x698edc[_0x1113('0x8')][_0x8ecd99]['timer']=setTimeout(_0x698edc[_0x1113('0x29')]['bind'](_0x698edc,_0x8ecd99),_0x698edc[_0x1113('0x6')][_0x253673][_0x1113('0x28')]*0x3e8);_0x698edc[_0x1113('0x8')][_0x8ecd99]['lastPauseAt']=moment()[_0x1113('0x2a')]('YYYY-MM-DD\x20HH:mm:ss');_0x698edc[_0x1113('0x8')][_0x8ecd99]['uniqueid']=_0x36290f;_0x698edc[_0x1113('0x8')][_0x8ecd99][_0x1113('0x1a')]=_0x253673;_0x698edc[_0x1113('0x8')][_0x8ecd99]['updateAcw']=function(){var _0x5ad560=getDiff(_0x698edc[_0x1113('0x8')][_0x8ecd99]['lastPauseAt']);clearTimeout(_0x698edc['timers'][_0x8ecd99][_0x1113('0x2b')]);_0x698edc[_0x1113('0x8')][_0x8ecd99][_0x1113('0x2b')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x5ad560},_0x698edc['timers'][_0x8ecd99][_0x1113('0x2c')],_0x8ecd99)[_0x1113('0x20')](function(_0x226c86){logger['info'](_0x1113('0x2d'),_0x36290f,_0x5ad560,_0x226c86);})[_0x1113('0x2e')](function(_0x5d8ba9){logger[_0x1113('0x2f')]('[%s][UPDATE][ERRORS:%s]',_0x36290f,_0x5d8ba9);});delete _0x698edc[_0x1113('0x8')][_0x8ecd99];};}});}else{logger['info'](_0x1113('0x30'),_0x36290f,_0x8ecd99,_0x253673);}});}})[_0x1113('0x2e')](function(_0x233046){logger[_0x1113('0x2f')](_0x1113('0x27'),_0x36290f,_0x698edc[_0x1113('0x6')][_0x253673]['acwTimeout'],_0x8ecd99,_0x253673);})[_0x1113('0x31')](function(){delete _0x698edc[_0x1113('0x9')][_0x36290f];});}catch(_0x232631){logger[_0x1113('0x2f')]('[ACW][START]\x20%s',_0x232631[_0x1113('0x32')]);}};Acw[_0x1113('0x33')][_0x1113('0x29')]=function(_0x365243){try{var _0x356c60=this;if(_0x356c60['timers'][_0x365243]){_0x356c60[_0x1113('0x8')][_0x365243]['timer']=![];var _0x94873e=_0x356c60['timers'][_0x365243][_0x1113('0x2c')];var _0x327267=_0x356c60[_0x1113('0x8')][_0x365243]['queue'];var _0x228b65=_0x356c60['voiceQueues'][_0x327267][_0x1113('0x28')];logger['info']('[%s][TIMER][STOP][AGENT:%s]',_0x94873e,_0x365243);RpcUser[_0x1113('0x34')](this[_0x1113('0x7')][_0x365243]);RpcVoiceAgentReport[_0x1113('0x35')]({'acwtime':_0x228b65,'agentacw':!![]},_0x94873e,_0x365243)[_0x1113('0x20')](function(_0x26ccee){logger[_0x1113('0x26')](_0x1113('0x2d'),_0x94873e,_0x228b65,_0x26ccee);})[_0x1113('0x2e')](function(_0x424a08){logger[_0x1113('0x2f')](_0x1113('0x36'),_0x94873e,_0x424a08);});}else{logger[_0x1113('0x2f')](_0x1113('0x37'),_0x365243);if(_0x356c60[_0x1113('0x8')]){logger[_0x1113('0x26')](_0x1113('0x38'),JSON[_0x1113('0x39')](_0x356c60[_0x1113('0x8')]));}}}catch(_0x38319b){logger['error']('[ACW][STOP]\x20%s',_0x38319b[_0x1113('0x32')]);}};Acw[_0x1113('0x33')][_0x1113('0xb')]=function(_0x1b9a19){try{if(this[_0x1113('0x6')][_0x1b9a19[_0x1113('0x1a')]]&&(this['voiceQueues'][_0x1b9a19['queue']][_0x1113('0x4')]||this[_0x1113('0x6')][_0x1b9a19['queue']][_0x1113('0x1c')])){if(this[_0x1113('0x7')][_0x1b9a19['interface']]){this[_0x1113('0x9')][_0x1b9a19[_0x1113('0x2c')]]={'queue':_0x1b9a19['queue'],'interface':_0x1b9a19[_0x1113('0x3a')],'destlinkedid':_0x1b9a19[_0x1113('0x24')]};}}}catch(_0x3035df){logger[_0x1113('0x2f')](_0x1113('0x3b'),_0x3035df[_0x1113('0x32')]);}};Acw[_0x1113('0x33')][_0x1113('0x17')]=function(_0x542688){try{if(this['voiceQueues'][_0x542688[_0x1113('0x1a')]]&&(this['voiceQueues'][_0x542688[_0x1113('0x1a')]][_0x1113('0x4')]||this['voiceQueues'][_0x542688[_0x1113('0x1a')]][_0x1113('0x1c')])){if(this[_0x1113('0x7')][_0x542688[_0x1113('0x3a')]]){this[_0x1113('0x9')][_0x542688[_0x1113('0x2c')]]={'queue':_0x542688[_0x1113('0x1a')],'interface':_0x542688['interface']};}}}catch(_0x4698c7){logger['error'](_0x1113('0x3c'),_0x4698c7[_0x1113('0x32')]);}};Acw[_0x1113('0x33')][_0x1113('0xd')]=function(_0x3e27b0){try{if(this[_0x1113('0x9')][_0x3e27b0[_0x1113('0x2c')]]&&_[_0x1113('0x3d')](this['channels'][_0x3e27b0['uniqueid']]['attended'])){logger[_0x1113('0x26')](_0x1113('0x3e'),_0x3e27b0['uniqueid']);this['startAcw'](_0x3e27b0[_0x1113('0x2c')]);}else if(this[_0x1113('0x9')][_0x3e27b0[_0x1113('0x3f')]]&&_[_0x1113('0x3d')](this[_0x1113('0x9')][_0x3e27b0[_0x1113('0x3f')]][_0x1113('0x23')])){logger['info'](_0x1113('0x40'),_0x3e27b0[_0x1113('0x3f')]);this[_0x1113('0x41')](_0x3e27b0[_0x1113('0x3f')]);}}catch(_0x46f287){logger[_0x1113('0x2f')](_0x1113('0x42'),_0x46f287[_0x1113('0x32')]);}};Acw[_0x1113('0x33')][_0x1113('0xf')]=function(_0x36ff9d){try{if(this[_0x1113('0x9')][_0x36ff9d['uniqueid']]&&this['channels'][_0x36ff9d['uniqueid']][_0x1113('0x23')]){logger['info'](_0x1113('0x43'),_0x36ff9d['uniqueid']);this[_0x1113('0x41')](_0x36ff9d[_0x1113('0x2c')]);}else if(this[_0x1113('0x9')][_0x36ff9d['linkedid']]&&this[_0x1113('0x9')][_0x36ff9d[_0x1113('0x3f')]][_0x1113('0x23')]){logger[_0x1113('0x26')](_0x1113('0x44'),_0x36ff9d[_0x1113('0x3f')]);this[_0x1113('0x41')](_0x36ff9d['linkedid']);}}catch(_0x13b196){logger[_0x1113('0x2f')](_0x1113('0x45'),_0x13b196['message']);}};Acw[_0x1113('0x33')]['syncAttendedTransfer']=function(_0x1ec1d8){try{if(!_['isNil'](this[_0x1113('0x9')][_0x1ec1d8['transfereeuniqueid']])){this[_0x1113('0x41')](_0x1ec1d8[_0x1113('0x46')]);if(this['channels'][_0x1ec1d8[_0x1113('0x47')]]){this[_0x1113('0x9')][_0x1ec1d8[_0x1113('0x47')]]['attended']=!![];this[_0x1113('0x9')][_0x1ec1d8[_0x1113('0x48')]]=this['channels'][_0x1ec1d8[_0x1113('0x47')]];delete this[_0x1113('0x9')][_0x1ec1d8[_0x1113('0x47')]];}}else if(!_[_0x1113('0x49')](this[_0x1113('0x9')][_0x1ec1d8[_0x1113('0x48')]])){this[_0x1113('0x41')](_0x1ec1d8[_0x1113('0x48')]);if(this[_0x1113('0x9')][_0x1ec1d8['origtransfereruniqueid']]){this['channels'][_0x1ec1d8[_0x1113('0x4a')]][_0x1113('0x23')]=!![];this[_0x1113('0x9')][_0x1ec1d8['transfereeuniqueid']]=this[_0x1113('0x9')][_0x1ec1d8[_0x1113('0x4a')]];delete this[_0x1113('0x9')][_0x1ec1d8[_0x1113('0x4a')]];}}}catch(_0x1effa7){logger[_0x1113('0x2f')](_0x1113('0x4b'),_0x1effa7[_0x1113('0x32')]);}};Acw['prototype'][_0x1113('0x15')]=function(_0x5d7d4c){try{if(this[_0x1113('0x9')][_0x5d7d4c['transfereruniqueid']]){logger[_0x1113('0x26')](_0x1113('0x4c'),JSON[_0x1113('0x39')](_0x5d7d4c['transfereruniqueid']));this[_0x1113('0x41')](_0x5d7d4c[_0x1113('0x4d')]);}else if(this['channels'][_0x5d7d4c[_0x1113('0x4e')]]){logger[_0x1113('0x26')](_0x1113('0x4f'),JSON[_0x1113('0x39')](_0x5d7d4c[_0x1113('0x4e')]));this[_0x1113('0x41')](_0x5d7d4c[_0x1113('0x4e')]);}}catch(_0x17cf00){logger[_0x1113('0x2f')]('[ACW][syncBlindTransfer]\x20%s',_0x17cf00['message']);}};Acw[_0x1113('0x33')][_0x1113('0x11')]=function(_0x573645){try{if(this[_0x1113('0x6')][_0x573645[_0x1113('0x1a')]]&&this['voiceQueues'][_0x573645[_0x1113('0x1a')]][_0x1113('0x50')]===_0x1113('0x51')){if(this[_0x1113('0x7')][_0x573645[_0x1113('0x3a')]]){logger['info'](_0x1113('0x52'),_0x573645[_0x1113('0x2c')],_0x573645[_0x1113('0x3a')],_0x573645['queue']);return RpcUser[_0x1113('0x25')](this[_0x1113('0x7')][_0x573645[_0x1113('0x3a')]],_0x1113('0x53'),_0x573645[_0x1113('0x2c')]);}}}catch(_0x429de5){logger[_0x1113('0x2f')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x429de5['message']);}};module[_0x1113('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index fe67c53..88ab6e9 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 _0x3338=['inspect','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','port','resolve','then','actionSipPeerStatus','catch','log','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','keepConnected','Action','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','actionDeviceStateList','devicestatelist','sippeerstatus','actionQueueSummary','queuesummary','actionCoreShowChannels','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x38de33,_0x4361bb){var _0x40f16d=function(_0x25975c){while(--_0x25975c){_0x38de33['push'](_0x38de33['shift']());}};_0x40f16d(++_0x4361bb);}(_0x3338,0xa5));var _0x8333=function(_0xc54c54,_0x59053b){_0xc54c54=_0xc54c54-0x0;var _0x476786=_0x3338[_0xc54c54];return _0x476786;};'use strict';var Manager=require('asterisk-manager');var BPromise=require('bluebird');var moment=require(_0x8333('0x0'));var util=require(_0x8333('0x1'));var _=require(_0x8333('0x2'));var logger=require(_0x8333('0x3'))(_0x8333('0x4'));var config=require(_0x8333('0x5'));var ami=new Manager(config[_0x8333('0x6')]['port'],config[_0x8333('0x6')]['ip'],config[_0x8333('0x6')][_0x8333('0x7')],config[_0x8333('0x6')]['password'],!![]);ami[_0x8333('0x8')]();ami[_0x8333('0x9')]=BPromise['promisify'](ami[_0x8333('0xa')]);function error(_0x2e863a){logger[_0x8333('0xb')](util[_0x8333('0xc')](_0x8333('0xd'),config[_0x8333('0x6')][_0x8333('0x7')],config[_0x8333('0x6')]['ip'],config['asterisk']['port'],util['inspect'](_0x2e863a,![],null)));}function close(){logger[_0x8333('0xb')](util[_0x8333('0xc')](_0x8333('0xe'),config[_0x8333('0x6')]['username'],config[_0x8333('0x6')]['ip'],config[_0x8333('0x6')]['port']));}ami[_0x8333('0xf')]=function(){return function(){return ami[_0x8333('0x9')]({'action':'sipshowregistry'});};};ami[_0x8333('0x10')]=function(){return function(){return ami[_0x8333('0x9')]({'action':_0x8333('0x11')});};};ami['actionSipPeerStatus']=function(){return function(){return ami['Action']({'action':_0x8333('0x12')});};};ami[_0x8333('0x13')]=function(){return function(){return ami[_0x8333('0x9')]({'action':_0x8333('0x14')});};};ami[_0x8333('0x15')]=function(){return function(){return ami[_0x8333('0x9')]({'action':_0x8333('0x16')});};};function connect(_0x486f19){logger[_0x8333('0x17')](util[_0x8333('0xc')](_0x8333('0x18'),config[_0x8333('0x6')][_0x8333('0x7')],config[_0x8333('0x6')]['ip'],config[_0x8333('0x6')]['port']));ami['once'](_0x8333('0xb'),error);ami[_0x8333('0x19')](_0x8333('0x1a'),close);}ami['on'](_0x8333('0x1b'),connect);ami['on'](_0x8333('0x1c'),function(_0x14e7fb){logger[_0x8333('0x17')](util[_0x8333('0xc')](_0x8333('0x1d'),config[_0x8333('0x6')][_0x8333('0x7')],config['asterisk']['ip'],config[_0x8333('0x6')]['port'],util[_0x8333('0x1e')](_0x14e7fb,![],null)));});ami['on'](_0x8333('0x1f'),function(_0xd38be7){logger[_0x8333('0x17')](util[_0x8333('0xc')](_0x8333('0x20'),config['asterisk'][_0x8333('0x7')],config[_0x8333('0x6')]['ip'],config['asterisk'][_0x8333('0x21')]));return BPromise[_0x8333('0x22')]()['then'](ami[_0x8333('0xf')]())[_0x8333('0x23')](ami[_0x8333('0x10')]())[_0x8333('0x23')](ami[_0x8333('0x24')]())[_0x8333('0x23')](ami[_0x8333('0x13')]())[_0x8333('0x23')](ami[_0x8333('0x15')]())[_0x8333('0x25')](function(_0x2ca9cf){console[_0x8333('0x26')](_0x2ca9cf);});});ami[_0x8333('0x19')](_0x8333('0xb'),error);ami[_0x8333('0x19')](_0x8333('0x1a'),close);module['exports']=ami; \ No newline at end of file +var _0xb408=['actionDeviceStateList','devicestatelist','queuesummary','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','connect','inspect','fullybooted','then','actionSipPeerStatus','actionCoreShowChannels','log','exports','bluebird','moment','util','lodash','../../config/logger','ami','../../config/environment','asterisk','username','password','keepConnected','Action','promisify','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','port','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry'];(function(_0x2ca7fd,_0x4e3737){var _0x41f6e5=function(_0x32203a){while(--_0x32203a){_0x2ca7fd['push'](_0x2ca7fd['shift']());}};_0x41f6e5(++_0x4e3737);}(_0xb408,0x16d));var _0x8b40=function(_0x4a2707,_0x56a7aa){_0x4a2707=_0x4a2707-0x0;var _0x2eb468=_0xb408[_0x4a2707];return _0x2eb468;};'use strict';var Manager=require('asterisk-manager');var BPromise=require(_0x8b40('0x0'));var moment=require(_0x8b40('0x1'));var util=require(_0x8b40('0x2'));var _=require(_0x8b40('0x3'));var logger=require(_0x8b40('0x4'))(_0x8b40('0x5'));var config=require(_0x8b40('0x6'));var ami=new Manager(config['asterisk']['port'],config[_0x8b40('0x7')]['ip'],config[_0x8b40('0x7')][_0x8b40('0x8')],config[_0x8b40('0x7')][_0x8b40('0x9')],!![]);ami[_0x8b40('0xa')]();ami[_0x8b40('0xb')]=BPromise[_0x8b40('0xc')](ami['action']);function error(_0x18dd38){logger[_0x8b40('0xd')](util[_0x8b40('0xe')](_0x8b40('0xf'),config[_0x8b40('0x7')][_0x8b40('0x8')],config[_0x8b40('0x7')]['ip'],config[_0x8b40('0x7')][_0x8b40('0x10')],util['inspect'](_0x18dd38,![],null)));}function close(){logger['error'](util[_0x8b40('0xe')](_0x8b40('0x11'),config[_0x8b40('0x7')][_0x8b40('0x8')],config[_0x8b40('0x7')]['ip'],config[_0x8b40('0x7')][_0x8b40('0x10')]));}ami[_0x8b40('0x12')]=function(){return function(){return ami['Action']({'action':_0x8b40('0x13')});};};ami[_0x8b40('0x14')]=function(){return function(){return ami[_0x8b40('0xb')]({'action':_0x8b40('0x15')});};};ami['actionSipPeerStatus']=function(){return function(){return ami[_0x8b40('0xb')]({'action':'sippeerstatus'});};};ami['actionQueueSummary']=function(){return function(){return ami[_0x8b40('0xb')]({'action':_0x8b40('0x16')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0x8b40('0xb')]({'action':'coreshowchannels'});};};function connect(_0xf5b300){logger[_0x8b40('0x17')](util['format'](_0x8b40('0x18'),config[_0x8b40('0x7')][_0x8b40('0x8')],config[_0x8b40('0x7')]['ip'],config[_0x8b40('0x7')]['port']));ami[_0x8b40('0x19')]('error',error);ami[_0x8b40('0x19')](_0x8b40('0x1a'),close);}ami['on'](_0x8b40('0x1b'),connect);ami['on']('shutdown',function(_0x5e1a28){logger[_0x8b40('0x17')](util['format']('Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s',config[_0x8b40('0x7')][_0x8b40('0x8')],config[_0x8b40('0x7')]['ip'],config['asterisk'][_0x8b40('0x10')],util[_0x8b40('0x1c')](_0x5e1a28,![],null)));});ami['on'](_0x8b40('0x1d'),function(_0x3fe7cd){logger[_0x8b40('0x17')](util[_0x8b40('0xe')]('Fullybooted\x20\x22%s\x22\x20to\x20%s:%s',config[_0x8b40('0x7')][_0x8b40('0x8')],config['asterisk']['ip'],config[_0x8b40('0x7')][_0x8b40('0x10')]));return BPromise['resolve']()[_0x8b40('0x1e')](ami[_0x8b40('0x12')]())[_0x8b40('0x1e')](ami[_0x8b40('0x14')]())[_0x8b40('0x1e')](ami[_0x8b40('0x1f')]())[_0x8b40('0x1e')](ami['actionQueueSummary']())[_0x8b40('0x1e')](ami[_0x8b40('0x20')]())['catch'](function(_0x338d0c){console[_0x8b40('0x21')](_0x338d0c);});});ami[_0x8b40('0x19')](_0x8b40('0xd'),error);ami[_0x8b40('0x19')](_0x8b40('0x1a'),close);module[_0x8b40('0x22')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 1c51b2f..a345ffb 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 _0xac4a=['ami','client','http','then','debug','memberReport','error','message','result','catch','rpc','jayson/promise','bluebird','../../config/logger'];(function(_0x334f9a,_0x542f01){var _0x2b219d=function(_0x25bb3e){while(--_0x25bb3e){_0x334f9a['push'](_0x334f9a['shift']());}};_0x2b219d(++_0x542f01);}(_0xac4a,0x13f));var _0xaac4=function(_0x375835,_0x342f9c){_0x375835=_0x375835-0x0;var _0x60258a=_0xac4a[_0x375835];return _0x60258a;};'use strict';var jayson=require(_0xaac4('0x0'));var BPromise=require(_0xaac4('0x1'));var logger=require(_0xaac4('0x2'))(_0xaac4('0x3'));var client=jayson[_0xaac4('0x4')][_0xaac4('0x5')]({'port':0x2329});client['Request']=function(_0x58626e,_0x2af0f6){return new BPromise(function(_0x2a5762,_0x32d34c){return client['request'](_0x58626e,_0x2af0f6)[_0xaac4('0x6')](function(_0x53d03a){logger[_0xaac4('0x7')]('rpc',_0xaac4('0x8'),_0x58626e,_0x2af0f6,_0x53d03a);if(_0x53d03a[_0xaac4('0x9')]){logger['error']('rpc',_0xaac4('0x8'),_0x58626e,_0x53d03a['error'][_0xaac4('0xa')],_0x2af0f6);return _0x32d34c(_0x53d03a['error']['message']);}else{return _0x2a5762(_0x53d03a[_0xaac4('0xb')]);}})[_0xaac4('0xc')](function(_0x38d1d0){logger[_0xaac4('0x9')](_0xaac4('0xd'),'memberReport',_0x58626e,_0x38d1d0,_0x2af0f6);return _0x32d34c(_0x38d1d0);});});};module['exports']=client; \ No newline at end of file +var _0xb43b=['catch','exports','jayson/promise','bluebird','ami','client','http','rpc','memberReport','error','message','result'];(function(_0x5534ce,_0x26ef5e){var _0x33042b=function(_0x48c033){while(--_0x48c033){_0x5534ce['push'](_0x5534ce['shift']());}};_0x33042b(++_0x26ef5e);}(_0xb43b,0x1b2));var _0xbb43=function(_0x50b44b,_0x1c51f3){_0x50b44b=_0x50b44b-0x0;var _0x453632=_0xb43b[_0x50b44b];return _0x453632;};'use strict';var jayson=require(_0xbb43('0x0'));var BPromise=require(_0xbb43('0x1'));var logger=require('../../config/logger')(_0xbb43('0x2'));var client=jayson[_0xbb43('0x3')][_0xbb43('0x4')]({'port':0x2329});client['Request']=function(_0x131e9e,_0x41aff6){return new BPromise(function(_0x351254,_0x16432a){return client['request'](_0x131e9e,_0x41aff6)['then'](function(_0x378df5){logger['debug'](_0xbb43('0x5'),_0xbb43('0x6'),_0x131e9e,_0x41aff6,_0x378df5);if(_0x378df5[_0xbb43('0x7')]){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x378df5[_0xbb43('0x7')][_0xbb43('0x8')],_0x41aff6);return _0x16432a(_0x378df5['error'][_0xbb43('0x8')]);}else{return _0x351254(_0x378df5[_0xbb43('0x9')]);}})[_0xbb43('0xa')](function(_0x5e3611){logger[_0xbb43('0x7')](_0xbb43('0x5'),'memberReport',_0x131e9e,_0x5e3611,_0x41aff6);return _0x16432a(_0x5e3611);});});};module[_0xbb43('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 51f3f3a..3377dad 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 _0x54f8=['name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','format','callback','callbackuniqueid','callbackat','recallme','prototype','getCaller','\x22%s\x22\x20<%s>','number','substring','getQueue','exports','util','lodash','moment','isNil','voiceQueue','Contact','firstName','lastName','queue'];(function(_0x2cc999,_0x20a3ab){var _0x246dd1=function(_0x4e7d93){while(--_0x4e7d93){_0x2cc999['push'](_0x2cc999['shift']());}};_0x246dd1(++_0x20a3ab);}(_0x54f8,0x1d7));var _0x854f=function(_0x192ee4,_0x337d9f){_0x192ee4=_0x192ee4-0x0;var _0x5ba8ec=_0x54f8[_0x192ee4];return _0x5ba8ec;};'use strict';var util=require(_0x854f('0x0'));var _=require(_0x854f('0x1'));var moment=require(_0x854f('0x2'));function checkNameSurname(_0x1cff57,_0x5e5f6d,_0x15d13a){var _0x45d3c0='';if(!_[_0x854f('0x3')](_0x5e5f6d)&&'string'===typeof _0x5e5f6d){_0x45d3c0+=_0x5e5f6d;}if(!_[_0x854f('0x3')](_0x15d13a)&&'string'===typeof _0x15d13a){_0x45d3c0+='\x20'+_0x15d13a;}if(_0x45d3c0!==''){return _0x45d3c0;}return _0x1cff57;}function Action(_0x32d5aa,_0x495672,_0x491bbf){this[_0x854f('0x4')]=_0x32d5aa;this['uniqueid']=_0x491bbf||undefined;this['name']=checkNameSurname(_0x495672[_0x854f('0x5')]['phone'],_0x495672[_0x854f('0x5')][_0x854f('0x6')],_0x495672['Contact'][_0x854f('0x7')]);this['number']=_0x495672[_0x854f('0x5')]['phone'];this[_0x854f('0x8')]=_0x32d5aa[_0x854f('0x9')];this[_0x854f('0xa')]=_0x495672[_0x854f('0xa')]||![];this[_0x854f('0xb')]=_0x32d5aa['type'];this[_0x854f('0xc')]=_0x32d5aa[_0x854f('0xc')]||0x3;this[_0x854f('0xd')]=_0x495672[_0x854f('0xd')];this['countbusyretry']=_0x495672[_0x854f('0xe')];this[_0x854f('0xf')]=_0x495672[_0x854f('0xf')];this[_0x854f('0x10')]=_0x495672[_0x854f('0x10')];this[_0x854f('0x11')]=_0x495672['countnosuchnumberretry'];this[_0x854f('0x12')]=_0x495672[_0x854f('0x12')];this['countabandonedretry']=_0x495672[_0x854f('0x13')];this[_0x854f('0x14')]=_0x495672[_0x854f('0x14')];this[_0x854f('0x15')]=_0x495672[_0x854f('0x15')];this[_0x854f('0x16')]=_0x495672[_0x854f('0x16')];this['ListId']=_0x495672[_0x854f('0x17')];this[_0x854f('0x18')]=_0x495672['UserId'];this['VoiceQueueId']=_0x495672[_0x854f('0x19')];this[_0x854f('0x1a')]=_0x495672['CampaignId'];this[_0x854f('0x1b')]=_0x495672['id'];this['ContactFirstName']=_0x495672[_0x854f('0x5')][_0x854f('0x6')]||'';this['starttime']=moment()[_0x854f('0x1c')]('YYYY-MM-DD\x20HH:mm:ss');this[_0x854f('0x1d')]=_0x495672[_0x854f('0x1d')];this[_0x854f('0x1e')]=_0x495672['callbackuniqueid'];this[_0x854f('0x1f')]=_0x495672['callbackat'];this['recallme']=_0x495672[_0x854f('0x20')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0x854f('0x21')][_0x854f('0x22')]=function(){return util[_0x854f('0x1c')](_0x854f('0x23'),this['name'],this[_0x854f('0x4')]['dialCutDigit']>0x0?this[_0x854f('0x24')][_0x854f('0x25')](this['voiceQueue']['dialCutDigit']):this[_0x854f('0x24')]);};Action[_0x854f('0x21')][_0x854f('0x26')]=function(){return this[_0x854f('0x8')];};module[_0x854f('0x27')]=Action; \ No newline at end of file +var _0xb7b9=['idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','getQueue','util','lodash','isNil','string','voiceQueue','Contact','phone','firstName','lastName','number','queue','name','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x341ca2,_0x62cd5){var _0x3b347f=function(_0x87028f){while(--_0x87028f){_0x341ca2['push'](_0x341ca2['shift']());}};_0x3b347f(++_0x62cd5);}(_0xb7b9,0x68));var _0x9b7b=function(_0x195f8e,_0x20a586){_0x195f8e=_0x195f8e-0x0;var _0x531805=_0xb7b9[_0x195f8e];return _0x531805;};'use strict';var util=require(_0x9b7b('0x0'));var _=require(_0x9b7b('0x1'));var moment=require('moment');function checkNameSurname(_0x1864be,_0x1c0ce0,_0x22a6d3){var _0x316646='';if(!_[_0x9b7b('0x2')](_0x1c0ce0)&&_0x9b7b('0x3')===typeof _0x1c0ce0){_0x316646+=_0x1c0ce0;}if(!_['isNil'](_0x22a6d3)&&_0x9b7b('0x3')===typeof _0x22a6d3){_0x316646+='\x20'+_0x22a6d3;}if(_0x316646!==''){return _0x316646;}return _0x1864be;}function Action(_0x318602,_0x48eeca,_0x30fef4){this[_0x9b7b('0x4')]=_0x318602;this['uniqueid']=_0x30fef4||undefined;this['name']=checkNameSurname(_0x48eeca[_0x9b7b('0x5')][_0x9b7b('0x6')],_0x48eeca['Contact'][_0x9b7b('0x7')],_0x48eeca[_0x9b7b('0x5')][_0x9b7b('0x8')]);this[_0x9b7b('0x9')]=_0x48eeca[_0x9b7b('0x5')][_0x9b7b('0x6')];this[_0x9b7b('0xa')]=_0x318602[_0x9b7b('0xb')];this[_0x9b7b('0xc')]=_0x48eeca[_0x9b7b('0xc')]||![];this[_0x9b7b('0xd')]=_0x318602[_0x9b7b('0xd')];this[_0x9b7b('0xe')]=_0x318602[_0x9b7b('0xe')]||0x3;this[_0x9b7b('0xf')]=_0x48eeca[_0x9b7b('0xf')];this[_0x9b7b('0x10')]=_0x48eeca['countbusyretry'];this[_0x9b7b('0x11')]=_0x48eeca['countcongestionretry'];this[_0x9b7b('0x12')]=_0x48eeca[_0x9b7b('0x12')];this[_0x9b7b('0x13')]=_0x48eeca[_0x9b7b('0x13')];this[_0x9b7b('0x14')]=_0x48eeca['countdropretry'];this['countabandonedretry']=_0x48eeca[_0x9b7b('0x15')];this['countmachineretry']=_0x48eeca['countmachineretry'];this[_0x9b7b('0x16')]=_0x48eeca[_0x9b7b('0x16')];this[_0x9b7b('0x17')]=_0x48eeca[_0x9b7b('0x17')];this[_0x9b7b('0x18')]=_0x48eeca[_0x9b7b('0x18')];this[_0x9b7b('0x19')]=_0x48eeca[_0x9b7b('0x19')];this['VoiceQueueId']=_0x48eeca[_0x9b7b('0x1a')];this[_0x9b7b('0x1b')]=_0x48eeca[_0x9b7b('0x1b')];this[_0x9b7b('0x1c')]=_0x48eeca['id'];this[_0x9b7b('0x1d')]=_0x48eeca[_0x9b7b('0x5')][_0x9b7b('0x7')]||'';this[_0x9b7b('0x1e')]=moment()[_0x9b7b('0x1f')](_0x9b7b('0x20'));this['callback']=_0x48eeca[_0x9b7b('0x21')];this[_0x9b7b('0x22')]=_0x48eeca[_0x9b7b('0x22')];this[_0x9b7b('0x23')]=_0x48eeca[_0x9b7b('0x23')];this['recallme']=_0x48eeca[_0x9b7b('0x24')];this[_0x9b7b('0x25')]='';this[_0x9b7b('0x26')]='';}Action[_0x9b7b('0x27')][_0x9b7b('0x28')]=function(){return util[_0x9b7b('0x1f')](_0x9b7b('0x29'),this[_0x9b7b('0xb')],this[_0x9b7b('0x4')][_0x9b7b('0x2a')]>0x0?this[_0x9b7b('0x9')]['substring'](this[_0x9b7b('0x4')][_0x9b7b('0x2a')]):this[_0x9b7b('0x9')]);};Action['prototype'][_0x9b7b('0x2b')]=function(){return this[_0x9b7b('0xa')];};module['exports']=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/agentComplete.js b/server/services/ami/dialer/agentComplete.js index b02978f..15d2519 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 _0xff52=['endtime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','responsetime','answertime'];(function(_0x431d25,_0x1bc9f3){var _0x2bc77c=function(_0x5d2fef){while(--_0x5d2fef){_0x431d25['push'](_0x431d25['shift']());}};_0x2bc77c(++_0x1bc9f3);}(_0xff52,0x1c2));var _0x2ff5=function(_0x53f5eb,_0x585522){_0x53f5eb=_0x53f5eb-0x0;var _0x3a7230=_0xff52[_0x53f5eb];return _0x3a7230;};'use strict';var util=require(_0x2ff5('0x0'));var _=require(_0x2ff5('0x1'));var moment=require(_0x2ff5('0x2'));function getSeconds(_0x525427,_0x4e32dc){var _0x2774aa=moment(_0x525427)[_0x2ff5('0x3')](0x0);var _0x6b35e3=moment(_0x4e32dc)[_0x2ff5('0x3')](0x0);return _0x2774aa[_0x2ff5('0x4')](_0x6b35e3,_0x2ff5('0x5'));}function AgentComplete(_0x3f2ddb,_0x1dba10){this[_0x2ff5('0x6')]=0x4;this[_0x2ff5('0x7')]=_0x2ff5('0x8');this[_0x2ff5('0x9')]=_0x3f2ddb['scheduledat'];this[_0x2ff5('0xa')]=_0x3f2ddb[_0x2ff5('0xa')];this[_0x2ff5('0xb')]=_0x3f2ddb[_0x2ff5('0xa')]===_0x2ff5('0xc')?_0x2ff5('0xd'):_0x3f2ddb[_0x2ff5('0xa')];this[_0x2ff5('0xe')]=_0x3f2ddb[_0x2ff5('0xe')];this['countcongestionretry']=_0x3f2ddb[_0x2ff5('0xf')];this[_0x2ff5('0x10')]=_0x3f2ddb[_0x2ff5('0x10')];this[_0x2ff5('0x11')]=_0x3f2ddb[_0x2ff5('0xe')]+_0x3f2ddb[_0x2ff5('0xf')]+_0x3f2ddb[_0x2ff5('0x10')]+_0x3f2ddb[_0x2ff5('0x12')]+_0x3f2ddb[_0x2ff5('0x13')]+_0x3f2ddb[_0x2ff5('0x14')]+_0x3f2ddb[_0x2ff5('0x15')]+_0x3f2ddb[_0x2ff5('0x16')];this[_0x2ff5('0x12')]=_0x3f2ddb[_0x2ff5('0x12')];this[_0x2ff5('0x13')]=_0x3f2ddb[_0x2ff5('0x13')];this[_0x2ff5('0x14')]=_0x3f2ddb['countabandonedretry'];this[_0x2ff5('0x15')]=_0x3f2ddb[_0x2ff5('0x15')];this['countagentrejectretry']=_0x3f2ddb['countagentrejectretry'];this[_0x2ff5('0x17')]=_0x1dba10[_0x2ff5('0x17')];this[_0x2ff5('0x18')]=_0x3f2ddb[_0x2ff5('0x19')];this[_0x2ff5('0x1a')]=_0x3f2ddb['number'];this[_0x2ff5('0x1b')]=_0x3f2ddb[_0x2ff5('0x1b')];this[_0x2ff5('0x1c')]=_0x3f2ddb[_0x2ff5('0x1c')];this[_0x2ff5('0x1d')]=_0x3f2ddb[_0x2ff5('0x1d')];this[_0x2ff5('0x1e')]=moment()[_0x2ff5('0x1f')](_0x2ff5('0x20'));this[_0x2ff5('0x21')]=getSeconds(_0x3f2ddb[_0x2ff5('0x1c')],_0x3f2ddb[_0x2ff5('0x1b')]);this['holdtime']=getSeconds(_0x3f2ddb[_0x2ff5('0x1d')],_0x3f2ddb['responsetime']);this[_0x2ff5('0x22')]=getSeconds(this[_0x2ff5('0x1e')],_0x3f2ddb['answertime']);this['queue']=_0x1dba10['queue'];this[_0x2ff5('0x23')]=_0x1dba10[_0x2ff5('0x23')];this[_0x2ff5('0x24')]=_0x1dba10['reason'];this[_0x2ff5('0x25')]=_0x3f2ddb[_0x2ff5('0x25')];this[_0x2ff5('0x26')]=_0x3f2ddb[_0x2ff5('0x26')];this[_0x2ff5('0x27')]=_0x3f2ddb[_0x2ff5('0x27')];this[_0x2ff5('0x28')]=_0x3f2ddb[_0x2ff5('0x28')];this[_0x2ff5('0x29')]=_0x3f2ddb[_0x2ff5('0x29')];this[_0x2ff5('0x2a')]=_0x3f2ddb[_0x2ff5('0x2a')];this[_0x2ff5('0x2b')]=_0x3f2ddb[_0x2ff5('0x2b')];this['VoiceQueueId']=_0x3f2ddb[_0x2ff5('0x2c')];this['CampaignId']=_0x3f2ddb['CampaignId'];this[_0x2ff5('0x2d')]=_0x3f2ddb[_0x2ff5('0x2d')]||'';this[_0x2ff5('0x2e')]=_0x3f2ddb[_0x2ff5('0x2e')]||'';}module[_0x2ff5('0x2f')]=AgentComplete; \ No newline at end of file +var _0x95b5=['recallme','ContactId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','util','lodash','moment','milliseconds','seconds','state','Answer','type','campaigntype','outbound','queue','countcongestionretry','countnoanswerretry','countglobal','countbusyretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','calleridnum','number','starttime','answertime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','holdtime','responsetime','talktime','membername','reason','callback','callbackuniqueid','callbackat'];(function(_0x332cb3,_0x4ed69a){var _0x2a4926=function(_0x2cc83d){while(--_0x2cc83d){_0x332cb3['push'](_0x332cb3['shift']());}};_0x2a4926(++_0x4ed69a);}(_0x95b5,0xe3));var _0x595b=function(_0x5a36d3,_0xf6f5d1){_0x5a36d3=_0x5a36d3-0x0;var _0x5bf7c3=_0x95b5[_0x5a36d3];return _0x5bf7c3;};'use strict';var util=require(_0x595b('0x0'));var _=require(_0x595b('0x1'));var moment=require(_0x595b('0x2'));function getSeconds(_0x199236,_0x198ed8){var _0x3ac3af=moment(_0x199236)['milliseconds'](0x0);var _0x1a8cab=moment(_0x198ed8)[_0x595b('0x3')](0x0);return _0x3ac3af['diff'](_0x1a8cab,_0x595b('0x4'));}function AgentComplete(_0x1d2aa2,_0x1d5e5f){this[_0x595b('0x5')]=0x4;this['statedesc']=_0x595b('0x6');this['scheduledat']=_0x1d2aa2['scheduledat'];this[_0x595b('0x7')]=_0x1d2aa2[_0x595b('0x7')];this[_0x595b('0x8')]=_0x1d2aa2[_0x595b('0x7')]===_0x595b('0x9')?_0x595b('0xa'):_0x1d2aa2[_0x595b('0x7')];this['countbusyretry']=_0x1d2aa2['countbusyretry'];this[_0x595b('0xb')]=_0x1d2aa2[_0x595b('0xb')];this[_0x595b('0xc')]=_0x1d2aa2[_0x595b('0xc')];this[_0x595b('0xd')]=_0x1d2aa2[_0x595b('0xe')]+_0x1d2aa2[_0x595b('0xb')]+_0x1d2aa2['countnoanswerretry']+_0x1d2aa2['countnosuchnumberretry']+_0x1d2aa2[_0x595b('0xf')]+_0x1d2aa2['countabandonedretry']+_0x1d2aa2[_0x595b('0x10')]+_0x1d2aa2[_0x595b('0x11')];this[_0x595b('0x12')]=_0x1d2aa2[_0x595b('0x12')];this[_0x595b('0xf')]=_0x1d2aa2['countdropretry'];this['countabandonedretry']=_0x1d2aa2['countabandonedretry'];this[_0x595b('0x10')]=_0x1d2aa2['countmachineretry'];this[_0x595b('0x11')]=_0x1d2aa2[_0x595b('0x11')];this[_0x595b('0x13')]=_0x1d5e5f[_0x595b('0x13')];this[_0x595b('0x14')]=_0x1d2aa2[_0x595b('0x15')];this[_0x595b('0x16')]=_0x1d2aa2[_0x595b('0x17')];this[_0x595b('0x18')]=_0x1d2aa2['starttime'];this['responsetime']=_0x1d2aa2['responsetime'];this[_0x595b('0x19')]=_0x1d2aa2[_0x595b('0x19')];this['endtime']=moment()[_0x595b('0x1a')](_0x595b('0x1b'));this[_0x595b('0x1c')]=getSeconds(_0x1d2aa2['responsetime'],_0x1d2aa2['starttime']);this[_0x595b('0x1d')]=getSeconds(_0x1d2aa2[_0x595b('0x19')],_0x1d2aa2[_0x595b('0x1e')]);this[_0x595b('0x1f')]=getSeconds(this['endtime'],_0x1d2aa2[_0x595b('0x19')]);this['queue']=_0x1d5e5f['queue'];this[_0x595b('0x20')]=_0x1d5e5f[_0x595b('0x20')];this['reason']=_0x1d5e5f[_0x595b('0x21')];this[_0x595b('0x22')]=_0x1d2aa2['callback'];this[_0x595b('0x23')]=_0x1d2aa2[_0x595b('0x23')];this[_0x595b('0x24')]=_0x1d2aa2[_0x595b('0x24')];this['recallme']=_0x1d2aa2[_0x595b('0x25')];this[_0x595b('0x26')]=_0x1d2aa2[_0x595b('0x26')];this['ListId']=_0x1d2aa2['ListId'];this['UserId']=_0x1d2aa2[_0x595b('0x27')];this['VoiceQueueId']=_0x1d2aa2[_0x595b('0x28')];this[_0x595b('0x29')]=_0x1d2aa2['CampaignId'];this[_0x595b('0x2a')]=_0x1d2aa2[_0x595b('0x2a')]||'';this[_0x595b('0x2b')]=_0x1d2aa2['originatecalleridname']||'';}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/final.js b/server/services/ami/dialer/final.js index 5401af5..d6c1438 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 _0x46ed=['countcongestionretry','countnoanswerretry','countglobal','countabandonedretry','countmachineretry','countnosuchnumberretry','countdropretry','countagentrejectretry','queue','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','exports','util','lodash','milliseconds','seconds','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry'];(function(_0x49c5d2,_0x34e7e2){var _0x108278=function(_0xc79688){while(--_0xc79688){_0x49c5d2['push'](_0x49c5d2['shift']());}};_0x108278(++_0x34e7e2);}(_0x46ed,0x168));var _0xd46e=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x46ed[_0x19950b];return _0x3c6b41;};'use strict';var util=require(_0xd46e('0x0'));var _=require(_0xd46e('0x1'));var moment=require('moment');function getSeconds(_0x392bc1,_0x1df30e){var _0x1f15e7=moment(_0x392bc1)['milliseconds'](0x0);var _0x2e6b84=moment(_0x1df30e)[_0xd46e('0x2')](0x0);return _0x1f15e7['diff'](_0x2e6b84,_0xd46e('0x3'));}function Final(_0x1926d9){this[_0xd46e('0x4')]=_0x1926d9[_0xd46e('0x4')];this[_0xd46e('0x5')]=_0x1926d9[_0xd46e('0x5')];this[_0xd46e('0x6')]=_0x1926d9[_0xd46e('0x6')];this[_0xd46e('0x7')]=_0x1926d9[_0xd46e('0x6')]===_0xd46e('0x8')?'queue':_0x1926d9[_0xd46e('0x6')];this[_0xd46e('0x9')]=_0x1926d9['countbusyretry'];this[_0xd46e('0xa')]=_0x1926d9[_0xd46e('0xa')];this[_0xd46e('0xb')]=_0x1926d9[_0xd46e('0xb')];this[_0xd46e('0xc')]=_0x1926d9[_0xd46e('0x9')]+_0x1926d9['countcongestionretry']+_0x1926d9[_0xd46e('0xb')]+_0x1926d9['countnosuchnumberretry']+_0x1926d9['countdropretry']+_0x1926d9[_0xd46e('0xd')]+_0x1926d9[_0xd46e('0xe')]+_0x1926d9['countagentrejectretry'];this['countnosuchnumberretry']=_0x1926d9[_0xd46e('0xf')];this[_0xd46e('0x10')]=_0x1926d9[_0xd46e('0x10')];this[_0xd46e('0xd')]=_0x1926d9['countabandonedretry'];this[_0xd46e('0xe')]=_0x1926d9[_0xd46e('0xe')];this[_0xd46e('0x11')]=_0x1926d9[_0xd46e('0x11')];this[_0xd46e('0x12')]=_0x1926d9['queue'];this[_0xd46e('0x13')]=_0x1926d9[_0xd46e('0x13')];this[_0xd46e('0x14')]=_0x1926d9['calleridnum'];this['starttime']=_0x1926d9[_0xd46e('0x15')];this[_0xd46e('0x16')]=_0x1926d9['responsetime'];this['endtime']=_0x1926d9[_0xd46e('0x16')];this[_0xd46e('0x17')]=_0x1926d9[_0xd46e('0x17')]||0x0;this[_0xd46e('0x18')]=_0x1926d9[_0xd46e('0x18')]||0x0;this[_0xd46e('0x19')]=_0x1926d9[_0xd46e('0x19')]||0x0;this[_0xd46e('0x1a')]=_0x1926d9[_0xd46e('0x1a')];this[_0xd46e('0x1b')]=_0x1926d9[_0xd46e('0x1b')];this['callbackat']=_0x1926d9[_0xd46e('0x1c')];this[_0xd46e('0x1d')]=_0x1926d9[_0xd46e('0x1d')];this[_0xd46e('0x1e')]=_0x1926d9[_0xd46e('0x1e')];this[_0xd46e('0x1f')]=_0x1926d9[_0xd46e('0x1f')];this[_0xd46e('0x20')]=_0x1926d9[_0xd46e('0x20')];this['VoiceQueueId']=_0x1926d9[_0xd46e('0x21')];this['CampaignId']=_0x1926d9['CampaignId'];this[_0xd46e('0x22')]=_0x1926d9[_0xd46e('0x22')]||'';this[_0xd46e('0x23')]=_0x1926d9[_0xd46e('0x23')]||'';}module[_0xd46e('0x24')]=Final; \ No newline at end of file +var _0xf725=['recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','uniqueid','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','calleridname','calleridnum','starttime','endtime','responsetime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x48956d,_0x1fbad8){var _0x49615c=function(_0x2ecf2d){while(--_0x2ecf2d){_0x48956d['push'](_0x48956d['shift']());}};_0x49615c(++_0x1fbad8);}(_0xf725,0x7e));var _0x5f72=function(_0xe03eb5,_0x190cc3){_0xe03eb5=_0xe03eb5-0x0;var _0x3d8fa7=_0xf725[_0xe03eb5];return _0x3d8fa7;};'use strict';var util=require(_0x5f72('0x0'));var _=require(_0x5f72('0x1'));var moment=require(_0x5f72('0x2'));function getSeconds(_0x3ccab6,_0x1ab380){var _0x2fb465=moment(_0x3ccab6)[_0x5f72('0x3')](0x0);var _0x172588=moment(_0x1ab380)[_0x5f72('0x3')](0x0);return _0x2fb465[_0x5f72('0x4')](_0x172588,'seconds');}function Final(_0x453992){this[_0x5f72('0x5')]=_0x453992[_0x5f72('0x5')];this[_0x5f72('0x6')]=_0x453992[_0x5f72('0x6')];this[_0x5f72('0x7')]=_0x453992[_0x5f72('0x7')];this['campaigntype']=_0x453992['type']===_0x5f72('0x8')?_0x5f72('0x9'):_0x453992['type'];this[_0x5f72('0xa')]=_0x453992[_0x5f72('0xa')];this['countcongestionretry']=_0x453992[_0x5f72('0xb')];this[_0x5f72('0xc')]=_0x453992[_0x5f72('0xc')];this[_0x5f72('0xd')]=_0x453992[_0x5f72('0xa')]+_0x453992[_0x5f72('0xb')]+_0x453992[_0x5f72('0xc')]+_0x453992['countnosuchnumberretry']+_0x453992[_0x5f72('0xe')]+_0x453992[_0x5f72('0xf')]+_0x453992[_0x5f72('0x10')]+_0x453992[_0x5f72('0x11')];this[_0x5f72('0x12')]=_0x453992['countnosuchnumberretry'];this[_0x5f72('0xe')]=_0x453992['countdropretry'];this['countabandonedretry']=_0x453992[_0x5f72('0xf')];this['countmachineretry']=_0x453992[_0x5f72('0x10')];this['countagentrejectretry']=_0x453992[_0x5f72('0x11')];this['queue']=_0x453992[_0x5f72('0x9')];this[_0x5f72('0x13')]=_0x453992['calleridname'];this[_0x5f72('0x14')]=_0x453992[_0x5f72('0x14')];this[_0x5f72('0x15')]=_0x453992['starttime'];this['responsetime']=_0x453992['responsetime'];this[_0x5f72('0x16')]=_0x453992[_0x5f72('0x17')];this[_0x5f72('0x18')]=_0x453992[_0x5f72('0x18')]||0x0;this[_0x5f72('0x19')]=_0x453992[_0x5f72('0x19')]||0x0;this[_0x5f72('0x1a')]=_0x453992['talktime']||0x0;this[_0x5f72('0x1b')]=_0x453992[_0x5f72('0x1b')];this[_0x5f72('0x1c')]=_0x453992[_0x5f72('0x1c')];this[_0x5f72('0x1d')]=_0x453992[_0x5f72('0x1d')];this[_0x5f72('0x1e')]=_0x453992[_0x5f72('0x1e')];this[_0x5f72('0x1f')]=_0x453992[_0x5f72('0x1f')];this[_0x5f72('0x20')]=_0x453992['ListId'];this[_0x5f72('0x21')]=_0x453992[_0x5f72('0x21')];this[_0x5f72('0x22')]=_0x453992[_0x5f72('0x22')];this['CampaignId']=_0x453992[_0x5f72('0x23')];this[_0x5f72('0x24')]=_0x453992['originatecalleridnum']||'';this[_0x5f72('0x25')]=_0x453992[_0x5f72('0x25')]||'';}module[_0x5f72('0x26')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/hangup.js b/server/services/ami/dialer/hangup.js index 9d7c05f..57e0acf 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 _0xb1f7=['countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','name','number','starttime','responsetime','format','YYYY-MM-DD\x20HH:mm:ss','ringtime','talktime','endtime','queue','membername','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','lodash','moment','milliseconds','diff','seconds','statedesc','Answer','scheduledat','type','outbound'];(function(_0x342129,_0x1f4808){var _0xad3343=function(_0x5c6d47){while(--_0x5c6d47){_0x342129['push'](_0x342129['shift']());}};_0xad3343(++_0x1f4808);}(_0xb1f7,0x1b9));var _0x7b1f=function(_0x59dfbb,_0x55174d){_0x59dfbb=_0x59dfbb-0x0;var _0x2ea4c6=_0xb1f7[_0x59dfbb];return _0x2ea4c6;};'use strict';var util=require('util');var _=require(_0x7b1f('0x0'));var moment=require(_0x7b1f('0x1'));function getSeconds(_0x4997d8,_0x3bd117){var _0xcf84e5=moment(_0x4997d8)[_0x7b1f('0x2')](0x0);var _0x217c07=moment(_0x3bd117)[_0x7b1f('0x2')](0x0);return _0xcf84e5[_0x7b1f('0x3')](_0x217c07,_0x7b1f('0x4'));}function Hangup(_0x3ec6ba,_0x4dd1df){this['state']=0x4;this[_0x7b1f('0x5')]=_0x7b1f('0x6');this[_0x7b1f('0x7')]=_0x3ec6ba[_0x7b1f('0x7')];this[_0x7b1f('0x8')]=_0x3ec6ba[_0x7b1f('0x8')];this['campaigntype']=_0x3ec6ba['type']===_0x7b1f('0x9')?'queue':_0x3ec6ba['type'];this[_0x7b1f('0xa')]=_0x3ec6ba['countbusyretry'];this[_0x7b1f('0xb')]=_0x3ec6ba['countcongestionretry'];this[_0x7b1f('0xc')]=_0x3ec6ba['countnoanswerretry'];this[_0x7b1f('0xd')]=_0x3ec6ba[_0x7b1f('0xa')]+_0x3ec6ba[_0x7b1f('0xb')]+_0x3ec6ba[_0x7b1f('0xc')]+_0x3ec6ba[_0x7b1f('0xe')]+_0x3ec6ba[_0x7b1f('0xf')]+_0x3ec6ba[_0x7b1f('0x10')]+_0x3ec6ba[_0x7b1f('0x11')]+_0x3ec6ba[_0x7b1f('0x12')];this['countnosuchnumberretry']=_0x3ec6ba[_0x7b1f('0xe')];this[_0x7b1f('0xf')]=_0x3ec6ba[_0x7b1f('0xf')];this[_0x7b1f('0x10')]=_0x3ec6ba['countabandonedretry'];this[_0x7b1f('0x11')]=_0x3ec6ba[_0x7b1f('0x11')];this[_0x7b1f('0x12')]=_0x3ec6ba[_0x7b1f('0x12')];this['uniqueid']=_0x4dd1df['uniqueid'];this['calleridname']=_0x3ec6ba[_0x7b1f('0x13')];this['calleridnum']=_0x3ec6ba[_0x7b1f('0x14')];this[_0x7b1f('0x15')]=_0x3ec6ba[_0x7b1f('0x15')];this[_0x7b1f('0x16')]=_0x3ec6ba[_0x7b1f('0x16')];this['endtime']=moment()[_0x7b1f('0x17')](_0x7b1f('0x18'));this[_0x7b1f('0x19')]=getSeconds(_0x3ec6ba[_0x7b1f('0x16')],_0x3ec6ba[_0x7b1f('0x15')]);this['holdtime']=0x0;this[_0x7b1f('0x1a')]=getSeconds(this[_0x7b1f('0x1b')],_0x3ec6ba[_0x7b1f('0x16')]);this[_0x7b1f('0x1c')]=_0x3ec6ba[_0x7b1f('0x1c')];this[_0x7b1f('0x1d')]='IVR';this[_0x7b1f('0x1e')]=_0x4dd1df[_0x7b1f('0x1f')];this['callback']=_0x3ec6ba[_0x7b1f('0x20')];this[_0x7b1f('0x21')]=_0x3ec6ba[_0x7b1f('0x21')];this[_0x7b1f('0x22')]=_0x3ec6ba[_0x7b1f('0x22')];this[_0x7b1f('0x23')]=_0x3ec6ba[_0x7b1f('0x23')];this['ContactId']=_0x3ec6ba[_0x7b1f('0x24')];this[_0x7b1f('0x25')]=_0x3ec6ba[_0x7b1f('0x25')];this['UserId']=_0x3ec6ba[_0x7b1f('0x26')];this['VoiceQueueId']=_0x3ec6ba[_0x7b1f('0x27')];this[_0x7b1f('0x28')]=_0x3ec6ba[_0x7b1f('0x28')];}module['exports']=Hangup; \ No newline at end of file +var _0x14c4=['ListId','UserId','VoiceQueueId','CampaignId','exports','util','lodash','milliseconds','seconds','state','statedesc','Answer','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','uniqueid','calleridname','name','calleridnum','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','responsetime','talktime','IVR','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId'];(function(_0x36c175,_0x42057c){var _0x2883e4=function(_0x43d63d){while(--_0x43d63d){_0x36c175['push'](_0x36c175['shift']());}};_0x2883e4(++_0x42057c);}(_0x14c4,0x83));var _0x414c=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x14c4[_0x406696];return _0x10e35c;};'use strict';var util=require(_0x414c('0x0'));var _=require(_0x414c('0x1'));var moment=require('moment');function getSeconds(_0x366356,_0x59ee07){var _0x9f959b=moment(_0x366356)[_0x414c('0x2')](0x0);var _0xeeef8c=moment(_0x59ee07)[_0x414c('0x2')](0x0);return _0x9f959b['diff'](_0xeeef8c,_0x414c('0x3'));}function Hangup(_0x3223ff,_0x3cb54d){this[_0x414c('0x4')]=0x4;this[_0x414c('0x5')]=_0x414c('0x6');this[_0x414c('0x7')]=_0x3223ff[_0x414c('0x7')];this['type']=_0x3223ff[_0x414c('0x8')];this[_0x414c('0x9')]=_0x3223ff[_0x414c('0x8')]==='outbound'?_0x414c('0xa'):_0x3223ff[_0x414c('0x8')];this[_0x414c('0xb')]=_0x3223ff[_0x414c('0xb')];this[_0x414c('0xc')]=_0x3223ff[_0x414c('0xc')];this[_0x414c('0xd')]=_0x3223ff['countnoanswerretry'];this[_0x414c('0xe')]=_0x3223ff[_0x414c('0xb')]+_0x3223ff['countcongestionretry']+_0x3223ff[_0x414c('0xd')]+_0x3223ff[_0x414c('0xf')]+_0x3223ff[_0x414c('0x10')]+_0x3223ff[_0x414c('0x11')]+_0x3223ff[_0x414c('0x12')]+_0x3223ff[_0x414c('0x13')];this[_0x414c('0xf')]=_0x3223ff[_0x414c('0xf')];this[_0x414c('0x10')]=_0x3223ff[_0x414c('0x10')];this[_0x414c('0x11')]=_0x3223ff['countabandonedretry'];this['countmachineretry']=_0x3223ff[_0x414c('0x12')];this['countagentrejectretry']=_0x3223ff[_0x414c('0x13')];this[_0x414c('0x14')]=_0x3cb54d[_0x414c('0x14')];this[_0x414c('0x15')]=_0x3223ff[_0x414c('0x16')];this[_0x414c('0x17')]=_0x3223ff['number'];this['starttime']=_0x3223ff[_0x414c('0x18')];this['responsetime']=_0x3223ff['responsetime'];this[_0x414c('0x19')]=moment()[_0x414c('0x1a')](_0x414c('0x1b'));this['ringtime']=getSeconds(_0x3223ff[_0x414c('0x1c')],_0x3223ff['starttime']);this['holdtime']=0x0;this[_0x414c('0x1d')]=getSeconds(this[_0x414c('0x19')],_0x3223ff[_0x414c('0x1c')]);this[_0x414c('0xa')]=_0x3223ff['queue'];this['membername']=_0x414c('0x1e');this['reason']=_0x3cb54d[_0x414c('0x1f')];this[_0x414c('0x20')]=_0x3223ff['callback'];this['callbackuniqueid']=_0x3223ff[_0x414c('0x21')];this[_0x414c('0x22')]=_0x3223ff[_0x414c('0x22')];this[_0x414c('0x23')]=_0x3223ff['recallme'];this[_0x414c('0x24')]=_0x3223ff['ContactId'];this[_0x414c('0x25')]=_0x3223ff[_0x414c('0x25')];this['UserId']=_0x3223ff[_0x414c('0x26')];this[_0x414c('0x27')]=_0x3223ff[_0x414c('0x27')];this[_0x414c('0x28')]=_0x3223ff[_0x414c('0x28')];}module[_0x414c('0x29')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/history.js b/server/services/ami/dialer/history.js index 3152a2a..c955ab6 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 _0xff80=['name','calleridnum','number','starttime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util','lodash','moment','milliseconds','diff','seconds','uniqueid','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname'];(function(_0xe863f1,_0x24dbb5){var _0x3cc836=function(_0x301703){while(--_0x301703){_0xe863f1['push'](_0xe863f1['shift']());}};_0x3cc836(++_0x24dbb5);}(_0xff80,0x14a));var _0x0ff8=function(_0x571750,_0x41f188){_0x571750=_0x571750-0x0;var _0x547ccc=_0xff80[_0x571750];return _0x547ccc;};'use strict';var util=require(_0x0ff8('0x0'));var _=require(_0x0ff8('0x1'));var moment=require(_0x0ff8('0x2'));function getSeconds(_0x88c08f,_0x581c69){var _0x34da76=moment(_0x88c08f)[_0x0ff8('0x3')](0x0);var _0x2c103b=moment(_0x581c69)[_0x0ff8('0x3')](0x0);return _0x34da76[_0x0ff8('0x4')](_0x2c103b,_0x0ff8('0x5'));}function History(_0x187840){this['uniqueid']=_0x187840[_0x0ff8('0x6')];this['scheduledat']=_0x187840['scheduledat']||undefined;this['type']=_0x187840[_0x0ff8('0x7')];this[_0x0ff8('0x8')]=_0x187840[_0x0ff8('0x7')]===_0x0ff8('0x9')?_0x0ff8('0xa'):_0x187840[_0x0ff8('0x7')];this[_0x0ff8('0xb')]=_0x187840[_0x0ff8('0xb')];this['countcongestionretry']=_0x187840[_0x0ff8('0xc')];this[_0x0ff8('0xd')]=_0x187840[_0x0ff8('0xd')];this[_0x0ff8('0xe')]=_0x187840[_0x0ff8('0xb')]+_0x187840['countcongestionretry']+_0x187840[_0x0ff8('0xd')]+_0x187840[_0x0ff8('0xf')]+_0x187840[_0x0ff8('0x10')]+_0x187840[_0x0ff8('0x11')]+_0x187840[_0x0ff8('0x12')]+_0x187840['countagentrejectretry'];this[_0x0ff8('0xf')]=_0x187840[_0x0ff8('0xf')];this['countdropretry']=_0x187840[_0x0ff8('0x10')];this['countabandonedretry']=_0x187840[_0x0ff8('0x11')];this[_0x0ff8('0x12')]=_0x187840[_0x0ff8('0x12')];this[_0x0ff8('0x13')]=_0x187840[_0x0ff8('0x13')];this[_0x0ff8('0xa')]=_0x187840[_0x0ff8('0xa')];this[_0x0ff8('0x14')]=_0x187840[_0x0ff8('0x15')];this[_0x0ff8('0x16')]=_0x187840[_0x0ff8('0x17')];this[_0x0ff8('0x18')]=_0x187840[_0x0ff8('0x18')];this['responsetime']=_0x187840['responsetime'];this['endtime']=_0x187840['responsetime'];this[_0x0ff8('0x19')]=getSeconds(_0x187840['responsetime'],_0x187840[_0x0ff8('0x18')]);this[_0x0ff8('0x1a')]=0x0;this['talktime']=0x0;this[_0x0ff8('0x1b')]=_0x187840[_0x0ff8('0x1b')];this[_0x0ff8('0x1c')]=_0x187840[_0x0ff8('0x1c')];this['callbackat']=_0x187840[_0x0ff8('0x1d')];this[_0x0ff8('0x1e')]=_0x187840[_0x0ff8('0x1e')];this[_0x0ff8('0x1f')]=_0x187840['ContactId'];this[_0x0ff8('0x20')]=_0x187840[_0x0ff8('0x20')];this[_0x0ff8('0x21')]=_0x187840['UserId'];this['VoiceQueueId']=_0x187840[_0x0ff8('0x22')];this[_0x0ff8('0x23')]=_0x187840[_0x0ff8('0x23')];this[_0x0ff8('0x24')]=_0x187840['originatecalleridnum']||'';this['originatecalleridname']=_0x187840[_0x0ff8('0x25')]||'';}module[_0x0ff8('0x26')]=History; \ No newline at end of file +var _0xfb44=['milliseconds','diff','seconds','uniqueid','type','campaigntype','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','util'];(function(_0x3b5e07,_0x32085f){var _0x3210af=function(_0x5ee5da){while(--_0x5ee5da){_0x3b5e07['push'](_0x3b5e07['shift']());}};_0x3210af(++_0x32085f);}(_0xfb44,0x97));var _0x4fb4=function(_0x4122d3,_0x19d982){_0x4122d3=_0x4122d3-0x0;var _0xc85d2=_0xfb44[_0x4122d3];return _0xc85d2;};'use strict';var util=require(_0x4fb4('0x0'));var _=require('lodash');var moment=require('moment');function getSeconds(_0x462edc,_0xedfcc3){var _0x4c3f3c=moment(_0x462edc)[_0x4fb4('0x1')](0x0);var _0x5ee01c=moment(_0xedfcc3)[_0x4fb4('0x1')](0x0);return _0x4c3f3c[_0x4fb4('0x2')](_0x5ee01c,_0x4fb4('0x3'));}function History(_0x2ed414){this[_0x4fb4('0x4')]=_0x2ed414[_0x4fb4('0x4')];this['scheduledat']=_0x2ed414['scheduledat']||undefined;this[_0x4fb4('0x5')]=_0x2ed414[_0x4fb4('0x5')];this[_0x4fb4('0x6')]=_0x2ed414['type']==='outbound'?'queue':_0x2ed414['type'];this['countbusyretry']=_0x2ed414[_0x4fb4('0x7')];this[_0x4fb4('0x8')]=_0x2ed414[_0x4fb4('0x8')];this[_0x4fb4('0x9')]=_0x2ed414[_0x4fb4('0x9')];this[_0x4fb4('0xa')]=_0x2ed414['countbusyretry']+_0x2ed414[_0x4fb4('0x8')]+_0x2ed414[_0x4fb4('0x9')]+_0x2ed414[_0x4fb4('0xb')]+_0x2ed414[_0x4fb4('0xc')]+_0x2ed414[_0x4fb4('0xd')]+_0x2ed414[_0x4fb4('0xe')]+_0x2ed414['countagentrejectretry'];this['countnosuchnumberretry']=_0x2ed414[_0x4fb4('0xb')];this[_0x4fb4('0xc')]=_0x2ed414['countdropretry'];this[_0x4fb4('0xd')]=_0x2ed414['countabandonedretry'];this[_0x4fb4('0xe')]=_0x2ed414[_0x4fb4('0xe')];this['countagentrejectretry']=_0x2ed414['countagentrejectretry'];this[_0x4fb4('0xf')]=_0x2ed414[_0x4fb4('0xf')];this[_0x4fb4('0x10')]=_0x2ed414[_0x4fb4('0x11')];this[_0x4fb4('0x12')]=_0x2ed414[_0x4fb4('0x13')];this[_0x4fb4('0x14')]=_0x2ed414[_0x4fb4('0x14')];this['responsetime']=_0x2ed414[_0x4fb4('0x15')];this[_0x4fb4('0x16')]=_0x2ed414[_0x4fb4('0x15')];this[_0x4fb4('0x17')]=getSeconds(_0x2ed414[_0x4fb4('0x15')],_0x2ed414['starttime']);this[_0x4fb4('0x18')]=0x0;this[_0x4fb4('0x19')]=0x0;this[_0x4fb4('0x1a')]=_0x2ed414[_0x4fb4('0x1a')];this[_0x4fb4('0x1b')]=_0x2ed414[_0x4fb4('0x1b')];this[_0x4fb4('0x1c')]=_0x2ed414[_0x4fb4('0x1c')];this[_0x4fb4('0x1d')]=_0x2ed414[_0x4fb4('0x1d')];this[_0x4fb4('0x1e')]=_0x2ed414['ContactId'];this[_0x4fb4('0x1f')]=_0x2ed414['ListId'];this[_0x4fb4('0x20')]=_0x2ed414[_0x4fb4('0x20')];this[_0x4fb4('0x21')]=_0x2ed414['VoiceQueueId'];this[_0x4fb4('0x22')]=_0x2ed414[_0x4fb4('0x22')];this[_0x4fb4('0x23')]=_0x2ed414['originatecalleridnum']||'';this['originatecalleridname']=_0x2ed414[_0x4fb4('0x24')]||'';}module[_0x4fb4('0x25')]=History; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index e28b8cd..9d12418 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 _0x847d=['moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','emptyContact','saveInDb','pick','ContactId','ListId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','Success','isTrunkReachable','SIP/%s','reachable','unmonitored','uniqueid','isNil','variable','exten','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','state','HangupInAMD','membername','AMD','amd','[syncHangupInAMD][createHistory]','Machine','countmachineretry','custom:amd','buildObj','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countagentrejectretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','reason\x2019\x20machine....','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','statedesc','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','[syncAgentComplete][createHistory][0]','countabandonedretry','[rescheduleContact][Machine]','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','cause-txt','Unknow','syncAgentComplete','agent','dialQueueProject2','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','answertime','queueCallerAbandonCreateState','[syncQueueCallerAbandon]\x20[Drop]','droptime','outboundDropCallsDayTimeout','dropreason','[rescheduleContact][Drop]','Drop','calleridname','calleridnum','CALLEREXIT','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[rescheduleContact][Abandoned]','Abandoned','strategy','actionid','paused','stateinterface','locked','push','[unlockQueueStatus][undefined]','queueStatusComplete','[booked][unlockQueueStatus]','idHopper','[unlock][syncQueueStatusComplete]','_rr','length','unlockRR','[booked][RR]','Agent:\x20','contactAgent-idHopper:\x20','run','[Catch][Preview][syncQueueStatusComplete]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ifTime','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','\x20Timezone\x20unknow\x20','interval','timezones','indexOf','true','command','iftime\x20%s,%s','all','INTERVAL_IS_OVERTIME','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','progressive','handlePower','power','dialPowerLevel','Queue','launchHandleIvr','checkIfTime','dialGlobalInterval','dialTimezone','[syncQueueSummary]','active','\x5cw{0,','replace','match','actionOriginate','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','contact\x20is\x20undefine','getCaller','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','ACTIVE','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDMINWORDLENGTH','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','dialAMDMaximumWordLength','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','updatedAt','%s%s','toUpper','callerid','XMD-ORIGINATECALLERIDNAME','XMD-ORIGINATECALLERIDNUM','originatecalleridnum','SIP/%s/%s%s','trim','dialCutDigit','substring','[originateError]:\x20%s','[originate][error]','originate\x20action\x20Error','responsetime','getQueue','isSuccess','response','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','[rescheduleContact][NoAnswer]','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','dialDropRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','reason','outboundNoSuchCallsDay','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','createStateFinal','reason\x200\x20no\x20such\x20number....','NoAnswer','countglobal','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','Busy','busy','[syncAgentComplete][createHistory][5]','dialBusyMaxRetry','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','custom:agentreject','agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','Global','[moveContactManagedDialer][0]','predictive','dialPredictiveOptimizationPercentage','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','[startMethodPredictive][StartProgressive][Loop]','dialPredictiveOptimization','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','dropRate','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','started\x20in\x20predictive\x20at','getDataPredictive','Predictive\x20after\x20first\x20interval','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','getDataPredictiveOld','outboundQueuePauses','agentBusyFactor','check\x20failure','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','UserId','recallme','[booked][checkContactBlack]','queueStatusComplete:\x20','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','dialRecallMeTimeout','Agent','voicePause','[rescheduleContact][dialRecallInQueue]','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','[Originate][HistoryRecallClose][historyCatch]','Blacklist','[Originate][historyBlacklist]','inBlackList','handleIvr','limitCalls','dialOrderByScheduledAt','RUNNING','ivrTotalCallsDays','Contact.phone','[actionOriginateIvr]\x20','dialLimitQueue','not_inuse','[actionOriginate]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\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','[abandonmentRate]','m\x20=\x20','Ts\x20=\x20','Amax\x20=\x20','----\x20Agent\x20Busy\x20Factor\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','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','[busyFactor]','p\x20=\x20','interval\x20=\x20','lodash','bluebird','uuid','md5','../preview/util/util','../../../config/environment/','dialer','../../../config/logger','booked','predictiveCalls','syncQueueSummary','../ami','redis','defaults','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','./history','./final','./agentComplete','./queueCallerAbandon','./hangup','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','uniqueId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','queueBookedRR','agentconnect','syncAgentConnect','bind','queuecallerabandon','syncQueueCallerAbandon','syncOriginateResponse','agentcomplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','isUndefined','message','AGENTS_NOT_LOGGED','name','\x20AGENTS\x20NOT\x20LOGGED','\x20NOT\x20Active','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','Intervals','isEmpty','[ifTime][Action]','Error','diff','seconds','emit','outbound','answered','available','loggedIn','pTalking','sumBillable','sumDuration','talking','type','abandoned','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangAbandonmentRate','erlangBusyFactor','Trunk','stringify','voice_queue:save','ivr','format','campaign:ivr:%s','campaign:save','info','-----\x20Stats\x20Predictive\x20---','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','milliseconds','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','clearing\x20variable\x20handle\x20predictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','undefined','originated','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','sendMessageOneNotActive','NOT_ACTIVE','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','IS_DISACTIVED','is\x20disactive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','endtime','starttime','loopClearZombieChannels','clearZombieChannels','actions','[actions]','Action','status','channel','catch','updateOriginated','queue','[Dialer][checkChannel]','countReScheduled','resolve','then','[countReScheduled]\x20','checkIsBlackList','[checkIsBlackList]\x20','checkIsBlackListIvr','averageHandleTime','[averageHandleTime]\x20','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20'];(function(_0x3cabb0,_0x4477f7){var _0x28de0d=function(_0x4bc8ac){while(--_0x4bc8ac){_0x3cabb0['push'](_0x3cabb0['shift']());}};_0x28de0d(++_0x4477f7);}(_0x847d,0x14a));var _0xd847=function(_0x483102,_0x54e93d){_0x483102=_0x483102-0x0;var _0x5cc885=_0x847d[_0x483102];return _0x5cc885;};'use strict';var util=require('util');var _=require(_0xd847('0x0'));var BPromise=require(_0xd847('0x1'));var uuid=require(_0xd847('0x2'));var moment=require('moment');var rr=require('rr');var md5=require(_0xd847('0x3'));var Redis=require('ioredis');var ut=require(_0xd847('0x4'));var config=require(_0xd847('0x5'));var logger=require('../../../config/logger')(_0xd847('0x6'));var loggerBooked=require(_0xd847('0x7'))(_0xd847('0x8'));var loggerPredictive=require(_0xd847('0x7'))('predictive');var loggerPredictiveCalls=require(_0xd847('0x7'))(_0xd847('0x9'));var loggerSyncQueueSummary=require(_0xd847('0x7'))(_0xd847('0xa'));var ami=require(_0xd847('0xb'));config[_0xd847('0xc')]=_[_0xd847('0xd')](config['redis'],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var cmHopper=require(_0xd847('0xe'));var cmHopperHistory=require(_0xd847('0xf'));var cmHopperBlack=require(_0xd847('0x10'));var voiceQueueRt=require('../rpc/voiceQueueRt');var Action=require('./action');var History=require(_0xd847('0x11'));var Final=require(_0xd847('0x12'));var AgentComplete=require(_0xd847('0x13'));var QueueCallerAbandon=require(_0xd847('0x14'));var Hangup=require(_0xd847('0x15'));var ipAgi=process[_0xd847('0x16')][_0xd847('0x17')]||_0xd847('0x18');var strategy={'rrmemory':_0xd847('0x19'),'roundrobin':_0xd847('0x1a')};var Sequence=function(){};Sequence[_0xd847('0x1b')]['enqueue']=function(_0x304333){this[_0xd847('0x1c')]=this[_0xd847('0x1c')]?this[_0xd847('0x1c')][_0xd847('0x1d')](_0x304333):_0x304333();};function Dialer(_0x586c6e,_0x39e11b){this[_0xd847('0x1e')]=new Sequence();this[_0xd847('0x1f')]=_0x39e11b;this[_0xd847('0x20')]=_0x586c6e['voiceQueues'];this[_0xd847('0x21')]=_0x586c6e['campaigns'];this[_0xd847('0x22')]=_0x586c6e[_0xd847('0x22')];this[_0xd847('0x23')]=_0x586c6e[_0xd847('0x23')];this[_0xd847('0x24')]=config['maxNumberOriginate']||0x2;this[_0xd847('0x25')]={};this['actions']={};this['contactsId']={};this[_0xd847('0x26')]={};this[_0xd847('0x27')]={};this[_0xd847('0x28')]={};this[_0xd847('0x29')]={};this[_0xd847('0x2a')]={};this[_0xd847('0x2b')]={};this[_0xd847('0x2c')]={};ami['on'](_0xd847('0x2d'),this[_0xd847('0x2e')][_0xd847('0x2f')](this));ami['on'](_0xd847('0x30'),this[_0xd847('0x31')]['bind'](this));ami['on']('originateresponse',this[_0xd847('0x32')][_0xd847('0x2f')](this));ami['on'](_0xd847('0x33'),this['syncAgentComplete'][_0xd847('0x2f')](this));ami['on'](_0xd847('0x34'),this[_0xd847('0xa')][_0xd847('0x2f')](this));ami['on'](_0xd847('0x35'),this[_0xd847('0x36')][_0xd847('0x2f')](this));ami['on'](_0xd847('0x37'),this[_0xd847('0x38')]['bind'](this));ami['on'](_0xd847('0x39'),this[_0xd847('0x3a')][_0xd847('0x2f')](this));ami['on'](_0xd847('0x3b'),this[_0xd847('0x3c')][_0xd847('0x2f')](this));ami['on']('queuestatuscomplete',this[_0xd847('0x3d')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x184513){return _0x184513!==null&&!_[_0xd847('0x3e')](_0x184513);}function checkIsLoggedIn(_0x2678dc,_0x18d162){return function(){if(_0x18d162<=0x0){_0x2678dc[_0xd847('0x3f')]=_0xd847('0x40');throw _0x2678dc[_0xd847('0x41')]+_0xd847('0x42');}};}function isActive(_0x3d7082){return _0x3d7082;}function checkIsActive(_0x15263b,_0x319af4){return function(){if(!isActive(_0x319af4)){_0x15263b[_0xd847('0x3f')]='NOT_ACTIVE';throw _0x15263b['name']+_0xd847('0x43');}};}function checkInterval(_0x248cdf){return function(){if(!isNotNull(_0x248cdf[_0xd847('0x44')])){_0x248cdf[_0xd847('0x3f')]=_0xd847('0x45');throw _0x248cdf['name']+_0xd847('0x46');}if(!isNotNull(_0x248cdf['Interval'][_0xd847('0x47')])){_0x248cdf['message']=_0xd847('0x45');throw _0x248cdf['name']+_0xd847('0x46');}if(!isNotNull(_[_0xd847('0x48')](_0x248cdf['Interval']['Intervals']))){_0x248cdf[_0xd847('0x3f')]=_0xd847('0x45');throw _0x248cdf[_0xd847('0x41')]+_0xd847('0x46');}};}function msgResponse(_0x472e9e,_0x1514a3,_0x4801cc){return{'action':_0x472e9e,'response':_0x1514a3,'message':_0x4801cc,'stack':_0x4801cc};}function myreject(_0x5331b3){return function(_0x38150c){return _0x5331b3(msgResponse(_0xd847('0x49'),_0xd847('0x4a'),JSON['stringify'](_0x38150c)));};}function getSeconds(_0x21ffe0,_0x3b2696){var _0x4ffe1c=moment(_0x21ffe0)['milliseconds'](0x0);var _0x3e5590=moment(_0x3b2696)['milliseconds'](0x0);return _0x4ffe1c[_0xd847('0x4b')](_0x3e5590,_0xd847('0x4c'));}function emit(_0x93ea85,_0x4abe5f,_0x4a1073){io['to'](_0x93ea85)[_0xd847('0x4d')](_0x4abe5f,_0x4a1073);}function emitVoiceQueueSummary(_0x4e6b4f){if(_0x4e6b4f['type']===_0xd847('0x4e')){var _0x5b5a61={'id':_0x4e6b4f['id'],'name':_0x4e6b4f['name'],'strategy':_0x4e6b4f['strategy'],'answered':_0x4e6b4f[_0xd847('0x4f')],'available':_0x4e6b4f[_0xd847('0x50')],'loggedIn':_0x4e6b4f[_0xd847('0x51')],'pTalking':_0x4e6b4f[_0xd847('0x52')],'sumBillable':_0x4e6b4f[_0xd847('0x53')],'sumDuration':_0x4e6b4f[_0xd847('0x54')],'sumHoldTime':_0x4e6b4f['sumHoldTime']||0x0,'talking':_0x4e6b4f[_0xd847('0x55')],'total':_0x4e6b4f['total'],'type':_0x4e6b4f[_0xd847('0x56')],'unmanaged':_0x4e6b4f['unmanaged'],'abandoned':_0x4e6b4f[_0xd847('0x57')],'waiting':_0x4e6b4f[_0xd847('0x58')],'loggedInDb':_0x4e6b4f['loggedInDb'],'dialActive':_0x4e6b4f[_0xd847('0x59')],'dialMethod':_0x4e6b4f[_0xd847('0x5a')],'dialOriginateCallerIdName':_0x4e6b4f[_0xd847('0x5b')],'dialOriginateCallerIdNumber':_0x4e6b4f[_0xd847('0x5c')],'dialOriginateTimeout':_0x4e6b4f[_0xd847('0x5d')],'dialPrefix':_0x4e6b4f[_0xd847('0x5e')],'outboundAnswerAgiCallsDay':_0x4e6b4f['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x4e6b4f[_0xd847('0x5f')],'outboundBlacklistCallsDay':_0x4e6b4f[_0xd847('0x60')],'outboundBusyCallsDay':_0x4e6b4f[_0xd847('0x61')],'outboundCongestionCallsDay':_0x4e6b4f['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x4e6b4f[_0xd847('0x62')],'outboundDropCallsDayCallersExit':_0x4e6b4f[_0xd847('0x63')],'outboundDropCallsDayTimeout':_0x4e6b4f['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x4e6b4f[_0xd847('0x64')],'outboundNoSuchCallsDay':_0x4e6b4f['outboundNoSuchCallsDay'],'outboundOriginateFailureCallsDay':_0x4e6b4f[_0xd847('0x65')],'outboundReCallsDay':_0x4e6b4f[_0xd847('0x66')],'outboundRejectCallsDay':_0x4e6b4f[_0xd847('0x67')],'outboundUnknownCallsDay':_0x4e6b4f[_0xd847('0x68')],'predictiveIntervalAnsweredCalls':_0x4e6b4f['predictiveIntervalAnsweredCalls'],'predictiveIntervalAvgHoldtime':_0x4e6b4f[_0xd847('0x69')],'predictiveIntervalAvgTalktime':_0x4e6b4f[_0xd847('0x6a')],'predictiveIntervalDroppedCallsCallersExit':_0x4e6b4f[_0xd847('0x6b')],'predictiveIntervalDroppedCallsTimeout':_0x4e6b4f['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x4e6b4f[_0xd847('0x6c')],'predictiveIntervalErlangCallsDroppedCalls':_0x4e6b4f[_0xd847('0x6d')],'predictiveIntervalHitRate':_0x4e6b4f[_0xd847('0x6e')],'predictiveIntervalMultiplicativeFactor':_0x4e6b4f['predictiveIntervalMultiplicativeFactor'],'predictiveIntervalPauses':_0x4e6b4f[_0xd847('0x6f')],'predictiveIntervalAvailable':_0x4e6b4f[_0xd847('0x70')],'predictiveIntervalTotalCalls':_0x4e6b4f[_0xd847('0x71')],'message':_0x4e6b4f[_0xd847('0x3f')],'originated':_0x4e6b4f['originated'],'erlangCalls':_0x4e6b4f['erlangCalls'],'erlangCallToSecond':_0x4e6b4f['erlangCallToSecond'],'erlangAbandonmentRate':_0x4e6b4f[_0xd847('0x72')],'erlangBusyFactor':_0x4e6b4f[_0xd847('0x73')],'startPredictive':_0x4e6b4f[_0xd847('0x28')],'startProgressive':_0x4e6b4f[_0xd847('0x29')]};if(_0x4e6b4f['Trunk']){_0x5b5a61[_0xd847('0x74')]={'id':_0x4e6b4f['Trunk']['id'],'name':_0x4e6b4f[_0xd847('0x74')]['name'],'active':_0x4e6b4f[_0xd847('0x74')]['active'],'callerid':_0x4e6b4f[_0xd847('0x74')]['callerid']};}if(_0x4e6b4f[_0xd847('0x44')]){_0x5b5a61[_0xd847('0x44')]={'id':_0x4e6b4f[_0xd847('0x44')]['id'],'name':_0x4e6b4f['Interval'][_0xd847('0x41')]};}var _0x465158=md5(JSON[_0xd847('0x75')](_0x5b5a61));if(_0x4e6b4f[_0xd847('0x3')]!==_0x465158){_0x4e6b4f['md5']=_0x465158;emit(util['format']('voice:queue:%s',_0x5b5a61[_0xd847('0x41')]),_0xd847('0x76'),_0x5b5a61);}}}function emitCampaignSummary(_0x1f6139){if(_0x1f6139[_0xd847('0x56')]===_0xd847('0x77')){emit(util[_0xd847('0x78')](_0xd847('0x79'),_0x1f6139[_0xd847('0x41')]),_0xd847('0x7a'),_0x1f6139);}}function checkGetDataPredictive(_0x4793d9){if(isNotNull(_0x4793d9)&&!_[_0xd847('0x48')](_0x4793d9)){loggerPredictive[_0xd847('0x7b')](_0xd847('0x7c'));loggerPredictive[_0xd847('0x7b')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x4793d9[_0xd847('0x71')]);loggerPredictive[_0xd847('0x7b')](_0xd847('0x7d'),_0x4793d9[_0xd847('0x7e')]);loggerPredictive[_0xd847('0x7b')](_0xd847('0x7f'),_0x4793d9[_0xd847('0x80')]);loggerPredictive[_0xd847('0x7b')](_0xd847('0x81'),_0x4793d9[_0xd847('0x6b')]);loggerPredictive[_0xd847('0x7b')](_0xd847('0x82'),_0x4793d9[_0xd847('0x69')]);loggerPredictive[_0xd847('0x7b')](_0xd847('0x83'),_0x4793d9[_0xd847('0x6a')]);loggerPredictive['info'](_0xd847('0x84'));if(_0x4793d9[_0xd847('0x71')]>0x0){if(!_[_0xd847('0x3e')](_0x4793d9['predictiveIntervalAvgTalktime'])&&_0x4793d9[_0xd847('0x6a')]>0x0){return!![];}loggerPredictive[_0xd847('0x7b')](_0xd847('0x85'));if(!_[_0xd847('0x3e')](_0x4793d9[_0xd847('0x69')])&&_0x4793d9[_0xd847('0x69')]>0x0){return!![];}loggerPredictive[_0xd847('0x7b')]('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0xd847('0x7b')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0xd847('0x7b')](_0xd847('0x86'));}return![];}function mergeDataErlangB(_0x3395c9){return function(_0x10076e){loggerPredictive['info'](_0xd847('0x87'));loggerPredictive[_0xd847('0x7b')](_0xd847('0x88'),_0x10076e[_0xd847('0x89')]);loggerPredictive[_0xd847('0x7b')](_0xd847('0x8a'),_0x10076e[_0xd847('0x8b')]);loggerPredictive[_0xd847('0x7b')](_0xd847('0x8c'),_0x10076e[_0xd847('0x72')]);loggerPredictive['info']('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x10076e[_0xd847('0x73')]);loggerPredictive[_0xd847('0x7b')](_0xd847('0x8c'),_0x10076e[_0xd847('0x72')]);loggerPredictive[_0xd847('0x7b')](_0xd847('0x84'));_[_0xd847('0x8d')](_0x3395c9,_0x10076e);};}function getDiff(_0x1f23e5){var _0x23a3c3=moment()[_0xd847('0x8e')](0x0);var _0xeb1fc4=moment(_0x1f23e5)['milliseconds'](0x0);return _0x23a3c3[_0xd847('0x4b')](_0xeb1fc4,'seconds');}function ifInterval(_0x51ab71,_0x284016){if(_['isUndefined'](_0x284016)){return![];}return getDiff(_0x284016)<_0x51ab71*0x3c;}function freeVariablesPredictive(_0x2af2bb){if(isNotNull(_0x2af2bb)){if(!_[_0xd847('0x3e')](_0x2af2bb[_0xd847('0x29')])){_0x2af2bb[_0xd847('0x29')]=undefined;loggerPredictive[_0xd847('0x7b')](_0x2af2bb[_0xd847('0x41')],_0xd847('0x8f'));}if(!_[_0xd847('0x3e')](_0x2af2bb['startPredictive'])){_0x2af2bb[_0xd847('0x28')]=undefined;loggerPredictive[_0xd847('0x7b')](_0x2af2bb[_0xd847('0x41')],_0xd847('0x90'));}if(!_['isUndefined'](_0x2af2bb[_0xd847('0x91')])){clearInterval(_0x2af2bb['handlePredictive']);_0x2af2bb['handlePredictive']=undefined;loggerPredictive[_0xd847('0x7b')](_0x2af2bb['name'],_0xd847('0x92'));}}}function erlangb(_0xb24979,_0x1161c4){if(_0x1161c4===0x0){return 0x0;}var _0x403588=0x1;for(var _0x27e79b=0x1;_0x27e79b<=_0x1161c4;_0x27e79b+=0x1){_0x403588=0x1+_0x403588*_0x27e79b/_0xb24979;}return 0x1/_0x403588;}function isVoiceQueueOutbound(_0xf7db54){return _0xf7db54===_0xd847('0x4e');}function isNotPreview(_0x41e770){return _0x41e770!==_0xd847('0x1f');}function isCampaignIvr(_0x22588c){return _0x22588c==='ivr';}function getCallerId(_0x107e16,_0x535555,_0x2fc98a){if(!_[_0xd847('0x3e')](_0x2fc98a)&&typeof _0x2fc98a==='string'&&!_[_0xd847('0x48')](_0x2fc98a)){if(!_[_0xd847('0x3e')](_0x535555)&&typeof _0x535555===_0xd847('0x93')&&!_[_0xd847('0x48')](_0x535555)){return util['format'](_0xd847('0x94'),_0x535555,_0x2fc98a);}return util[_0xd847('0x78')](_0xd847('0x94'),_0x2fc98a,_0x2fc98a);}if(!_[_0xd847('0x3e')](_0x107e16)&&typeof _0x107e16===_0xd847('0x93')&&!_[_0xd847('0x48')](_0x107e16)){return _0x107e16;}return _0xd847('0x95');}function loggerCatchQueueSummary(_0x27dfa9,_0x32e0b1){return function(_0x5020f4){freeVariablesPredictive(_0x32e0b1);emitVoiceQueueSummary(_0x32e0b1);emitCampaignSummary(_0x32e0b1);loggerSyncQueueSummary[_0xd847('0x96')](_0x27dfa9,util['inspect'](_0x5020f4,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x2fdfb4,_0x9eca4d){return function(_0x814699){loggerPredictive['error'](_0x9eca4d[_0xd847('0x41')],_0x2fdfb4);loggerPredictive[_0xd847('0x96')](_0x814699[_0xd847('0x97')]);freeVariablesPredictive(_0x9eca4d);};}function loggerCatch(_0x1398e3){return function(_0x91eb68){logger[_0xd847('0x96')](_0x1398e3,util[_0xd847('0x98')](_0x91eb68,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x5c4f20){return _0x5c4f20&&!_['isUndefined'](_0x5c4f20)&&_0x5c4f20['length']>0x0;}function decremetOriginate(_0x49cfdc){if(!_['isUndefined'](_0x49cfdc)&&_0x49cfdc!==null){if(typeof _0x49cfdc['originated']!==_0xd847('0x99')){if(_0x49cfdc[_0xd847('0x9a')]>0x0){_0x49cfdc['originated']-=0x1;}else{logger['error'](_0xd847('0x9b'));}}}else{logger[_0xd847('0x96')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x236241,_0x5e48b1,_0x348c99){if(_0x5e48b1>_0x348c99){for(var _0x1c93c8=0x0;_0x1c93c8<_0x5e48b1-_0x348c99;_0x1c93c8+=0x1){decremetOriginate(_0x236241);}}}function loggerGetContactDialer(_0x2978fd,_0x5e46b8,_0x37fed0){return function(_0x35be19){checkContactLowerLimitOriginate(_0x5e46b8,_0x37fed0,0x0);logger[_0xd847('0x96')](_0x2978fd,util[_0xd847('0x98')](_0x35be19,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5d9d16){return function(_0x7d3353){if(isNotNull(_0x7d3353)&&isNotNull(_0x7d3353[0x0])){if(_0x7d3353[0x0][_0xd847('0x9c')]>0x0){_0x5d9d16[_0xd847('0x3f')]=_0xd847('0x9d');logger[_0xd847('0x7b')]('[getContactDialer2][ReScheduled]'+_0x5d9d16[_0xd847('0x41')],_0x7d3353[0x0]['contactsRescheduled'],_0xd847('0x9e'));}else{_0x5d9d16[_0xd847('0x3f')]=_0xd847('0x9f');logger[_0xd847('0x7b')](_0xd847('0xa0')+_0x5d9d16['name']);}}};}function notSendMessagesQueue(_0x25ce7a){if(_0x25ce7a[_0xd847('0xa1')]){freeVariablesPredictive(_0x25ce7a);if(_0x25ce7a[_0xd847('0x9a')]===0x0&&_0x25ce7a[_0xd847('0x55')]===0x0&&_0x25ce7a['waiting']===0x0&&(_0x25ce7a['pTalking']||0x0)===0x0){_0x25ce7a[_0xd847('0xa1')]=![];_0x25ce7a[_0xd847('0x50')]=0x0;_0x25ce7a[_0xd847('0x3f')]=_0xd847('0xa2');loggerSyncQueueSummary[_0xd847('0x96')](_0xd847('0xa3'),_0x25ce7a[_0xd847('0x41')],_0xd847('0xa4'));}else{_0x25ce7a[_0xd847('0x3f')]=_0xd847('0xa5');loggerSyncQueueSummary[_0xd847('0x96')](_0xd847('0xa3'),_0x25ce7a[_0xd847('0x41')],_0xd847('0xa6'));}emitVoiceQueueSummary(_0x25ce7a);}}function notSendMessagesCampaign(_0x57fabe){if(_0x57fabe[_0xd847('0xa1')]){if(_0x57fabe[_0xd847('0x9a')]===0x0){_0x57fabe[_0xd847('0xa1')]=![];_0x57fabe[_0xd847('0x3f')]=_0xd847('0xa2');loggerSyncQueueSummary[_0xd847('0x96')](_0xd847('0xa7'),_0x57fabe[_0xd847('0x41')],_0xd847('0xa4'));}else{_0x57fabe['message']=_0xd847('0xa5');loggerSyncQueueSummary['error'](_0xd847('0xa7'),_0x57fabe[_0xd847('0x41')],_0xd847('0xa6'));}emitCampaignSummary(_0x57fabe);}}function createObjHistory(_0x4e0726,_0x1523d1,_0x4836f7,_0x5cd161,_0x43f383){_0x4e0726[_0xd847('0x3f')]=_0x4836f7;var _0x49d0f7=new Action(_0x4e0726,_0x1523d1);var _0x34369f=new History(_0x49d0f7);_0x34369f['state']=_0x5cd161;_0x34369f['statedesc']=_0x43f383;_0x34369f[_0xd847('0xa8')]=_0x49d0f7[_0xd847('0xa9')];return _0x34369f;}Dialer[_0xd847('0x1b')][_0xd847('0xaa')]=function(){var _0x13a2ed=this;setInterval(function(){_0x13a2ed[_0xd847('0xab')](_0x13a2ed[_0xd847('0x26')],'[uniqueid]');_0x13a2ed[_0xd847('0xab')](_0x13a2ed[_0xd847('0xac')],_0xd847('0xad'));},0x32c8);};Dialer[_0xd847('0x1b')]['clearZombieChannels']=function(_0x3fde40,_0xcbaccb){var _0x3fc0c2=this;for(var _0x439988 in _0x3fde40){if(typeof _0x3fde40[_0x439988]!=='undefined'){this[_0xd847('0x1e')]['enqueue'](function(){if(!_['isNil'](_0x3fde40[_0x439988])){return ami[_0xd847('0xae')]({'action':_0xd847('0xaf'),'channel':_0x3fde40[_0x439988][_0xd847('0xb0')]})[_0xd847('0xb1')](function(_0x3088be){if(_0x3088be[_0xd847('0x3f')]==='No\x20such\x20channel'){setTimeout(function(){if(_0x3fde40[_0x439988]&&_0x3fde40[_0x439988][_0xd847('0x56')]!=='ivr'){_0x3fc0c2[_0xd847('0xb2')](_0x3fc0c2['voiceQueues'][_0x3fde40[_0x439988][_0xd847('0xb3')]]);logger['error'](_0xd847('0xb4'),_0xcbaccb,_0x439988,_0x3fde40[_0x439988][_0xd847('0xb3')]);delete _0x3fde40[_0x439988];}if(_0x3fde40[_0x439988]&&_0x3fde40[_0x439988][_0xd847('0x56')]===_0xd847('0x77')){_0x3fc0c2[_0xd847('0xb2')](_0x3fc0c2[_0xd847('0x21')][_0x3fde40[_0x439988][_0xd847('0xb3')]]);logger['error']('[Dialer][checkChannel][ivr]',_0xcbaccb,_0x439988,_0x3fde40[_0x439988][_0xd847('0xb3')]);delete _0x3fde40[_0x439988];}},0x2328);}});}});}}};Dialer[_0xd847('0x1b')][_0xd847('0xb5')]=function(_0x4f52f9){return BPromise[_0xd847('0xb6')]()[_0xd847('0xb7')](cmHopper['countReScheduled'](_0x4f52f9))['catch'](loggerCatch(_0xd847('0xb8')));};Dialer['prototype'][_0xd847('0xb9')]=function(_0x4076ee){return BPromise['resolve']()[_0xd847('0xb7')](cmHopperBlack[_0xd847('0xb9')](_0x4076ee))['catch'](loggerCatch(_0xd847('0xba')));};Dialer[_0xd847('0x1b')][_0xd847('0xbb')]=function(_0x4c2b3e){return BPromise[_0xd847('0xb6')]()['then'](cmHopperBlack['checkIsBlackListIvr'](_0x4c2b3e))[_0xd847('0xb1')](loggerCatch('[checkIsBlackListIvr]\x20'));};Dialer[_0xd847('0x1b')][_0xd847('0xbc')]=function(_0x38b622){return BPromise['resolve']()[_0xd847('0xb7')](cmHopperHistory['avgHandleTime'](_0x38b622))[_0xd847('0xb1')](loggerCatch(_0xd847('0xbd')));};Dialer[_0xd847('0x1b')]['rescheduleContact']=function(_0x3647db){return BPromise[_0xd847('0xb6')]()['then'](cmHopper[_0xd847('0xbe')](_0x3647db))[_0xd847('0xb1')](loggerCatch(_0xd847('0xbf')));};Dialer[_0xd847('0x1b')][_0xd847('0xc0')]=function(_0x3fd1a3,_0x4360ef,_0x4cd392){return BPromise[_0xd847('0xb6')]()[_0xd847('0xb7')](cmHopper[_0xd847('0xc0')](_0x3fd1a3,_0x4360ef,_0x4cd392))[_0xd847('0xb1')](loggerCatch(_0xd847('0xc1')));};Dialer[_0xd847('0x1b')][_0xd847('0xc2')]=function(_0x37dba5,_0x3783e2,_0x13ad61,_0x11045c,_0x2d5e61){return BPromise['resolve']()[_0xd847('0xb7')](cmHopper['getContactDialer'](_0x37dba5,_0x3783e2,_0x13ad61,_0x11045c))[_0xd847('0xb1')](function(_0x17527f){_0x2d5e61['temp']-=_0x13ad61;_0x2d5e61[_0xd847('0xc3')]=_0x2d5e61[_0xd847('0xc3')]>0x0?_0x2d5e61['temp']:0x0;loggerCatch(_0xd847('0xc4'))(_0x17527f);});};Dialer['prototype'][_0xd847('0xc5')]=function(_0x3e52c8,_0x308558,_0x212f72,_0x1f78ff){return BPromise[_0xd847('0xb6')]()['then'](cmHopper[_0xd847('0xc5')](_0x3e52c8,_0x308558,_0x212f72))[_0xd847('0xb1')](function(_0x559208){_0x1f78ff['temp']-=_0x308558;_0x1f78ff[_0xd847('0xc3')]=_0x1f78ff['temp']>0x0?_0x1f78ff[_0xd847('0xc3')]:0x0;loggerCatch(_0xd847('0xc6'))(_0x559208);});};Dialer[_0xd847('0x1b')][_0xd847('0xc7')]=function(_0x2b01ed){return BPromise[_0xd847('0xb6')]()[_0xd847('0xb7')](voiceQueueRt[_0xd847('0xc7')](_0x2b01ed))[_0xd847('0xb1')](loggerCatch(_0xd847('0xc8')));};Dialer['prototype'][_0xd847('0xc9')]=function(_0x33438c){return BPromise[_0xd847('0xb6')]()[_0xd847('0xb7')](cmHopper[_0xd847('0xc9')](_0x33438c))[_0xd847('0xb1')](loggerCatch(_0xd847('0xca')));};Dialer[_0xd847('0x1b')][_0xd847('0xcb')]=function(_0x480c65){return BPromise['resolve']()['then'](cmHopperHistory[_0xd847('0xcb')](_0x480c65))[_0xd847('0xb1')](loggerCatch(_0xd847('0xcc')));};Dialer[_0xd847('0x1b')][_0xd847('0xb2')]=function(_0x532a8f){if(!_[_0xd847('0x3e')](_0x532a8f)&&_0x532a8f!==null){if(typeof _0x532a8f['originated']!==_0xd847('0x99')){if(_0x532a8f[_0xd847('0x9a')]>0x0){_0x532a8f[_0xd847('0x9a')]-=0x1;}else{logger[_0xd847('0x96')](_0xd847('0xcd'));}}}else{logger['error'](_0xd847('0xce'));}};Dialer[_0xd847('0x1b')][_0xd847('0xcf')]=function(_0x5aed17,_0x29de5c){var _0x266068=this;return function(_0x4fdd4b){_0x266068[_0xd847('0xb2')](_0x29de5c);logger[_0xd847('0x96')](_0x5aed17,util[_0xd847('0x98')](_0x4fdd4b,{'showHidden':![],'depth':null}));};};Dialer[_0xd847('0x1b')][_0xd847('0xd0')]=function(_0x4ebc93,_0xdd5866,_0x12233e){var _0x3fb04d={'state':0x19,'statedesc':'notFound'};this[_0xd847('0xb2')](_0xdd5866);this[_0xd847('0xd1')](_[_0xd847('0x8d')](_0x3fb04d,_[_0xd847('0xd2')](_0x12233e,[_0xd847('0xd3'),_0xd847('0xd4'),'UserId',_0xd847('0xd5'),_0xd847('0xd6')])),_0xd847('0xd7'),_0xd847('0xd8'));logger[_0xd847('0x96')](_0x4ebc93);};Dialer['prototype']['isSuccess']=function(_0x1357cc){return _0x1357cc===_0xd847('0xd9');};Dialer[_0xd847('0x1b')][_0xd847('0xda')]=function(_0x15f25d){return!_[_0xd847('0x3e')](_0x15f25d)&&_0x15f25d&&!_['isUndefined'](_0x15f25d[_0xd847('0x41')])&&!_[_0xd847('0x3e')](_0x15f25d['active'])&&_0x15f25d['active']&&(this[_0xd847('0x23')][util['format'](_0xd847('0xdb'),_0x15f25d[_0xd847('0x41')])]['status']===_0xd847('0xdc')||this[_0xd847('0x23')][util[_0xd847('0x78')]('SIP/%s',_0x15f25d['name'])]['status']===_0xd847('0xdd'));};Dialer['prototype'][_0xd847('0xd1')]=function(_0x561c94,_0x2e23d7,_0x661631){this[_0xd847('0xcb')](_0x561c94)['catch'](loggerCatch(_0x2e23d7));this[_0xd847('0xc9')](_0x561c94)[_0xd847('0xb1')](loggerCatch(_0x661631));};Dialer['prototype'][_0xd847('0x3a')]=function(_0x40ab67){var _0x3ab985=this[_0xd847('0x26')][_0x40ab67[_0xd847('0xde')]];var _0xf38ddc;if(!_[_0xd847('0xdf')](_0x40ab67)&&!_['isNil'](_0x40ab67['variable'])&&!_['isNil'](_0x40ab67[_0xd847('0xe0')]['amdstatus'])&&_0x40ab67[_0xd847('0xe1')]===_0xd847('0xe2')&&_0x3ab985){if(_0x3ab985[_0xd847('0x56')]!=='ivr'&&this[_0xd847('0x20')][_0x3ab985[_0xd847('0xb3')]][_0xd847('0xe3')]&&_0x40ab67[_0xd847('0xe4')]===_0xd847('0xe5')){delete this[_0xd847('0x26')][_0x40ab67[_0xd847('0xde')]];this['updateOriginated'](this[_0xd847('0x20')][_0x3ab985[_0xd847('0xb3')]]);this[_0xd847('0x20')][_0x3ab985['queue']][_0xd847('0x5f')]+=0x1;this[_0xd847('0x20')][_0x3ab985[_0xd847('0xb3')]][_0xd847('0xe6')]+=0x1;_0xf38ddc=new Hangup(_0x3ab985,_0x40ab67);_0xf38ddc[_0xd847('0xe7')]=0x12;_0xf38ddc['statedesc']=_0xd847('0xe8');_0xf38ddc[_0xd847('0xe9')]=_0xd847('0xea');ami[_0xd847('0x4d')]('custom:amd',ut['buildObj'](_0xf38ddc,_0xd847('0xeb')));this[_0xd847('0xd1')](_0xf38ddc,_0xd847('0xec'),'[syncHangupInAMD]');}if(_0x3ab985[_0xd847('0x56')]!==_0xd847('0x77')&&this[_0xd847('0x20')][_0x3ab985[_0xd847('0xb3')]][_0xd847('0xe3')]&&_0x40ab67[_0xd847('0xe4')]==='MACHINE'){var _0x55abed=this;return new BPromise(function(_0xb0d0c9,_0xedcce5){delete _0x55abed[_0xd847('0x26')][_0x40ab67['uniqueid']];_0x55abed[_0xd847('0xb2')](_0x55abed[_0xd847('0x20')][_0x3ab985[_0xd847('0xb3')]]);_0x55abed[_0xd847('0x20')][_0x3ab985['queue']][_0xd847('0x5f')]+=0x1;_0x55abed[_0xd847('0x20')][_0x3ab985[_0xd847('0xb3')]][_0xd847('0xe6')]+=0x1;var _0xabd376=_0x55abed[_0xd847('0x20')][_0x3ab985['queue']];var _0x484a1d=new Hangup(_0x3ab985,_0x40ab67);_0x484a1d[_0xd847('0xe7')]=0x13;_0x484a1d['statedesc']=_0xd847('0xed');_0x484a1d[_0xd847('0xe9')]='AMD';_0x484a1d[_0xd847('0xee')]+=0x1;_0x484a1d['countglobal']+=0x1;_0x484a1d[_0xd847('0xeb')]=!![];ami[_0xd847('0x4d')](_0xd847('0xef'),ut[_0xd847('0xf0')](_0x484a1d,'amd'));_0x55abed[_0xd847('0xcb')](_0x484a1d)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x484a1d[_0xd847('0xf1')]+_0x484a1d[_0xd847('0xf2')]+_0x484a1d[_0xd847('0xf3')]+_0x484a1d[_0xd847('0xf4')]+_0x484a1d[_0xd847('0xf5')]+_0x484a1d['countabandonedretry']+_0x484a1d[_0xd847('0xee')]+_0x484a1d[_0xd847('0xf6')]>=_0xabd376[_0xd847('0xf7')]){_0x55abed[_0xd847('0xf8')](_0x484a1d,_0xb0d0c9,_0xedcce5,_0xd847('0xf9'));}else{if(_0x484a1d[_0xd847('0xee')]>=_0xabd376[_0xd847('0xfa')]){_0x55abed['createStateFinal'](_0x484a1d,_0xb0d0c9,_0xedcce5,_0xd847('0xfb'));}else{_0x55abed[_0xd847('0xbe')]({'active':![],'countmachineretry':_0x484a1d['countmachineretry'],'scheduledat':moment()[_0xd847('0xfc')](_0xabd376[_0xd847('0xfd')],_0xd847('0xfe'))[_0xd847('0x78')](_0xd847('0xff')),'ContactId':_0x484a1d['ContactId'],'ListId':_0x484a1d[_0xd847('0xd4')],'VoiceQueueId':_0x484a1d['VoiceQueueId']||undefined,'CampaignId':_0x484a1d[_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch('[rescheduleContact][Machine]'));_0xb0d0c9({'reschedule':0x1});}}});}if(_0x3ab985['type']===_0xd847('0x77')&&this['campaigns'][_0x3ab985['queue']][_0xd847('0xe3')]&&_0x40ab67[_0xd847('0xe4')]===_0xd847('0xe5')){delete this[_0xd847('0x26')][_0x40ab67[_0xd847('0xde')]];this['updateOriginated'](this[_0xd847('0x21')][_0x3ab985[_0xd847('0xb3')]]);_0xf38ddc=new Hangup(_0x3ab985,_0x40ab67);_0xf38ddc['state']=0x12;_0xf38ddc[_0xd847('0x100')]=_0xd847('0xe8');_0xf38ddc['membername']='AMD';ami[_0xd847('0x4d')](_0xd847('0xef'),ut['buildObj'](_0xf38ddc,_0xd847('0xeb')));this[_0xd847('0xd1')](_0xf38ddc,_0xd847('0x101'),_0xd847('0x102'));}if(_0x3ab985['type']===_0xd847('0x77')&&this['campaigns'][_0x3ab985[_0xd847('0xb3')]]['dialAMDActive']&&_0x40ab67[_0xd847('0xe4')]==='MACHINE'){var _0x55abed=this;return new BPromise(function(_0x110cb1,_0x1405c5){delete _0x55abed[_0xd847('0x26')][_0x40ab67[_0xd847('0xde')]];_0x55abed['updateOriginated'](_0x55abed['campaigns'][_0x3ab985['queue']]);_0x55abed[_0xd847('0x21')][_0x3ab985[_0xd847('0xb3')]]['outboundAnswerCallsDay']+=0x1;_0x55abed[_0xd847('0x21')][_0x3ab985[_0xd847('0xb3')]][_0xd847('0xe6')]+=0x1;var _0x175e0e=_0x55abed['campaigns'][_0x3ab985['queue']];var _0x499f0f=new Hangup(_0x3ab985,_0x40ab67);_0x499f0f[_0xd847('0xe7')]=0x13;_0x499f0f[_0xd847('0x100')]=_0xd847('0xed');_0x499f0f[_0xd847('0xe9')]=_0xd847('0xea');_0x499f0f[_0xd847('0xee')]+=0x1;_0x499f0f['countglobal']+=0x1;_0x499f0f['amd']=!![];ami['emit'](_0xd847('0xef'),ut['buildObj'](_0x499f0f,_0xd847('0xeb')));_0x55abed[_0xd847('0xcb')](_0x499f0f)[_0xd847('0xb1')](loggerCatch(_0xd847('0x103')));if(_0x499f0f[_0xd847('0xf1')]+_0x499f0f[_0xd847('0xf2')]+_0x499f0f[_0xd847('0xf3')]+_0x499f0f[_0xd847('0xf4')]+_0x499f0f[_0xd847('0xf5')]+_0x499f0f[_0xd847('0x104')]+_0x499f0f[_0xd847('0xee')]+_0x499f0f[_0xd847('0xf6')]>=_0x175e0e[_0xd847('0xf7')]){_0x55abed[_0xd847('0xf8')](_0x499f0f,_0x110cb1,_0x1405c5,_0xd847('0xf9'));}else{if(_0x499f0f[_0xd847('0xee')]>=_0x175e0e['dialMachineMaxRetry']){_0x55abed['createStateFinal'](_0x499f0f,_0x110cb1,_0x1405c5,_0xd847('0xfb'));}else{_0x55abed[_0xd847('0xbe')]({'active':![],'countmachineretry':_0x499f0f[_0xd847('0xee')],'scheduledat':moment()[_0xd847('0xfc')](_0x175e0e[_0xd847('0xfd')],'minutes')[_0xd847('0x78')](_0xd847('0xff')),'ContactId':_0x499f0f[_0xd847('0xd3')],'ListId':_0x499f0f[_0xd847('0xd4')],'VoiceQueueId':_0x499f0f[_0xd847('0xd5')]||undefined,'CampaignId':_0x499f0f[_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x105')));_0x110cb1({'reschedule':0x1});}}});}}};Dialer[_0xd847('0x1b')]['syncHangup']=function(_0x433699){var _0x2882d3=this[_0xd847('0x26')][_0x433699[_0xd847('0xde')]];var _0x74d092=this;var _0x46cce5;if(_0x2882d3&&_0x2882d3['type']===_0xd847('0x77')){delete this[_0xd847('0x26')][_0x433699[_0xd847('0xde')]];this[_0xd847('0xb2')](this[_0xd847('0x21')][_0x2882d3[_0xd847('0xb3')]]);this[_0xd847('0x21')][_0x2882d3[_0xd847('0xb3')]][_0xd847('0x106')]+=0x1;_0x46cce5=new Hangup(_0x2882d3,_0x433699);this[_0xd847('0xcb')](_0x46cce5)[_0xd847('0xb1')](loggerCatch(_0xd847('0x107')));this[_0xd847('0xc9')](_0x46cce5)[_0xd847('0xb1')](loggerCatch(_0xd847('0x108')));}if(_0x2882d3&&_0x2882d3[_0xd847('0x56')]!==_0xd847('0x77')&&isNotNull(this['voiceQueues'][_0x2882d3[_0xd847('0xb3')]][_0xd847('0x109')])){delete this[_0xd847('0x26')][_0x433699[_0xd847('0xde')]];this[_0xd847('0xb2')](this['voiceQueues'][_0x2882d3[_0xd847('0xb3')]]);this[_0xd847('0x20')][_0x2882d3[_0xd847('0xb3')]]['outboundAnswerCallsDay']+=0x1;this[_0xd847('0x20')][_0x2882d3[_0xd847('0xb3')]][_0xd847('0xe6')]+=0x1;_0x46cce5=new Hangup(_0x2882d3,_0x433699);_0x46cce5[_0xd847('0xe7')]=0x10;_0x46cce5[_0xd847('0x100')]=_0xd847('0x10a');_0x46cce5[_0xd847('0xe9')]=_0xd847('0x10b');this[_0xd847('0xcb')](_0x46cce5)[_0xd847('0xb1')](loggerCatch(_0xd847('0x107')));this[_0xd847('0xc9')](_0x46cce5)[_0xd847('0xb1')](loggerCatch(_0xd847('0x108')));}if(_0x2882d3&&_0x2882d3[_0xd847('0x56')]!==_0xd847('0x77')&&!isNotNull(this['voiceQueues'][_0x2882d3[_0xd847('0xb3')]]['dialQueueProject'])){delete this[_0xd847('0x26')][_0x433699[_0xd847('0xde')]];this[_0xd847('0xb2')](this[_0xd847('0x20')][_0x2882d3['queue']]);this[_0xd847('0x20')][_0x2882d3[_0xd847('0xb3')]][_0xd847('0x68')]+=0x1;_0x46cce5=new Hangup(_0x2882d3,_0x433699);_0x46cce5[_0xd847('0xe7')]=0xc;_0x46cce5[_0xd847('0x100')]=_0x433699[_0xd847('0x10c')];_0x46cce5[_0xd847('0xe9')]=_0xd847('0x10d');this[_0xd847('0xcb')](_0x46cce5)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));this[_0xd847('0xc9')](_0x46cce5)[_0xd847('0xb1')](loggerCatch(_0xd847('0x108')));}};Dialer[_0xd847('0x1b')][_0xd847('0x10e')]=function(_0x5f4afa){var _0x1b215c=this[_0xd847('0x26')][_0x5f4afa[_0xd847('0xde')]];var _0x4b3eef=this;if(this['voiceQueues'][_0x5f4afa[_0xd847('0xb3')]]){if(_0x1b215c&&_0x1b215c[_0xd847('0x56')]!=='ivr'){delete this[_0xd847('0x26')][_0x5f4afa['uniqueid']];this['voiceQueues'][_0x5f4afa['queue']]['outboundAnswerCallsDay']+=0x1;var _0x5ea7ee=new AgentComplete(_0x1b215c,_0x5f4afa);if(_0x5f4afa['reason']===_0xd847('0x10f')){_0x5ea7ee['agiafterat']=this[_0xd847('0x20')][_0x5f4afa['queue']][_0xd847('0x110')]&&this[_0xd847('0x20')][_0x5f4afa[_0xd847('0xb3')]][_0xd847('0x111')]?moment()['format'](_0xd847('0xff')):undefined;}this['createHistory'](_0x5ea7ee)['catch'](loggerCatch(_0xd847('0x112')));this['moveContactManagedDialer'](_0x5ea7ee)[_0xd847('0xb1')](loggerCatch('[syncAgentComplete]'));}}};Dialer['prototype'][_0xd847('0x2e')]=function(_0x46aee6){if(this[_0xd847('0x20')][_0x46aee6[_0xd847('0xb3')]]){if(this[_0xd847('0x26')][_0x46aee6[_0xd847('0xde')]]&&this[_0xd847('0x26')][_0x46aee6[_0xd847('0xde')]][_0xd847('0x56')]!==_0xd847('0x77')){this[_0xd847('0xb2')](this[_0xd847('0x20')][_0x46aee6[_0xd847('0xb3')]]);this[_0xd847('0x26')][_0x46aee6[_0xd847('0xde')]][_0xd847('0x113')]=moment()[_0xd847('0x78')](_0xd847('0xff'));}}};Dialer[_0xd847('0x1b')][_0xd847('0x114')]=function(_0x584982){this[_0xd847('0xcb')](_0x584982)['catch'](loggerCatch(_0xd847('0x112')));this[_0xd847('0xc9')](_0x584982)[_0xd847('0xb1')](loggerCatch(_0xd847('0x115')));};Dialer[_0xd847('0x1b')][_0xd847('0x31')]=function(_0x2782a9){var _0x3dddda=this['uniqueId'][_0x2782a9[_0xd847('0xde')]];var _0x5395e8=this;if(this['voiceQueues'][_0x2782a9[_0xd847('0xb3')]]){if(_0x3dddda&&_0x3dddda[_0xd847('0x56')]!=='ivr'){delete this[_0xd847('0x26')][_0x2782a9[_0xd847('0xde')]];this[_0xd847('0xb2')](this[_0xd847('0x20')][_0x2782a9[_0xd847('0xb3')]]);_0x3dddda[_0xd847('0x116')]=moment()[_0xd847('0x78')]('YYYY-MM-DD\x20HH:mm:ss');var _0x2c8d41=new QueueCallerAbandon(_0x3dddda,_0x2782a9);if(getSeconds(_0x3dddda[_0xd847('0x116')],_0x3dddda['responsetime'])>=_0x3dddda['dialQueueTimeout']){this[_0xd847('0x20')][_0x2782a9[_0xd847('0xb3')]]['predictiveIntervalDroppedCallsTimeout']+=0x1;this['voiceQueues'][_0x2782a9[_0xd847('0xb3')]][_0xd847('0x117')]+=0x1;this[_0xd847('0x20')][_0x2782a9['queue']][_0xd847('0x6d')]+=0x1;_0x2c8d41['state']=0xa;_0x2c8d41[_0xd847('0x100')]='Drop';_0x2c8d41[_0xd847('0x118')]='TIMEOUT';_0x2c8d41['agiafterat']=this['voiceQueues'][_0x2782a9['queue']]['dialQueueProject2']?moment()[_0xd847('0x78')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x2c8d41['countdropretry']+=0x1;_0x2c8d41['countglobal']+=0x1;if(_0x2c8d41[_0xd847('0xf5')]>=this[_0xd847('0x20')][_0x2782a9[_0xd847('0xb3')]]['dialDropMaxRetry']){this[_0xd847('0x114')](_0x2c8d41);}else{this[_0xd847('0xbe')]({'active':![],'countdropretry':_0x2c8d41['countdropretry'],'scheduledat':moment()['add'](this[_0xd847('0x20')][_0x2782a9[_0xd847('0xb3')]]['dialDropRetryFrequency'],_0xd847('0xfe'))['format'](_0xd847('0xff')),'ContactId':_0x3dddda['ContactId'],'ListId':_0x3dddda[_0xd847('0xd4')],'VoiceQueueId':_0x3dddda[_0xd847('0xd5')]||undefined,'CampaignId':_0x3dddda['CampaignId']||undefined})['catch'](loggerCatch(_0xd847('0x119')));var _0x2c4e04=new History(_0x2c8d41);_0x2c4e04['state']=0xa;_0x2c4e04['statedesc']=_0xd847('0x11a');_0x2c4e04[_0xd847('0xa9')]=moment()[_0xd847('0x78')](_0xd847('0xff'));_0x2c4e04[_0xd847('0xa8')]=_0x2c4e04['starttime'];_0x2c4e04[_0xd847('0x11b')]=_0x2c8d41['calleridname'];_0x2c4e04[_0xd847('0x11c')]=_0x2c8d41['calleridnum'];this[_0xd847('0xcb')](_0x2c4e04)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}}else{this[_0xd847('0x20')][_0x2782a9[_0xd847('0xb3')]][_0xd847('0x6b')]+=0x1;this['voiceQueues'][_0x2782a9[_0xd847('0xb3')]][_0xd847('0x63')]+=0x1;_0x2c8d41[_0xd847('0xe7')]=0xb;_0x2c8d41[_0xd847('0x100')]='Abandoned';_0x2c8d41[_0xd847('0x118')]=_0xd847('0x11d');_0x2c8d41['countabandonedretry']+=0x1;_0x2c8d41['countglobal']+=0x1;if(_0x2c8d41[_0xd847('0x104')]>=this[_0xd847('0x20')][_0x2782a9[_0xd847('0xb3')]][_0xd847('0x11e')]){this[_0xd847('0x114')](_0x2c8d41);}else{this[_0xd847('0xbe')]({'active':![],'countabandonedretry':_0x2c8d41['countabandonedretry'],'scheduledat':moment()[_0xd847('0xfc')](this['voiceQueues'][_0x2782a9[_0xd847('0xb3')]][_0xd847('0x11f')],_0xd847('0xfe'))[_0xd847('0x78')](_0xd847('0xff')),'ContactId':_0x3dddda[_0xd847('0xd3')],'ListId':_0x3dddda['ListId'],'VoiceQueueId':_0x3dddda[_0xd847('0xd5')]||undefined,'CampaignId':_0x3dddda[_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x120')));var _0x2c4e04=new History(_0x2c8d41);_0x2c4e04['state']=0xb;_0x2c4e04[_0xd847('0x100')]=_0xd847('0x121');_0x2c4e04['starttime']=moment()[_0xd847('0x78')]('YYYY-MM-DD\x20HH:mm:ss');_0x2c4e04[_0xd847('0xa8')]=_0x2c4e04[_0xd847('0xa9')];_0x2c4e04[_0xd847('0x11b')]=_0x2c8d41['calleridname'];_0x2c4e04[_0xd847('0x11c')]=_0x2c8d41['calleridnum'];this['createHistory'](_0x2c4e04)[_0xd847('0xb1')](loggerCatch('[syncAgentComplete][createHistory][11]'));}}}}};Dialer[_0xd847('0x1b')][_0xd847('0x38')]=function(_0x3e1838){if(this[_0xd847('0xac')][_0x3e1838['uniqueid']]){this[_0xd847('0xac')][_0x3e1838[_0xd847('0xde')]][_0xd847('0xb0')]=_0x3e1838[_0xd847('0xb0')];}if(this[_0xd847('0x26')][_0x3e1838[_0xd847('0xde')]]){this[_0xd847('0x26')][_0x3e1838[_0xd847('0xde')]][_0xd847('0xb0')]=_0x3e1838[_0xd847('0xb0')];}};Dialer[_0xd847('0x1b')][_0xd847('0x3c')]=function(_0x551818){if(strategy[this[_0xd847('0x20')][this[_0xd847('0xac')][_0x551818['actionid']][_0xd847('0xb3')]][_0xd847('0x122')]]==='roundrobin'){if(this[_0xd847('0xac')][_0x551818[_0xd847('0x123')]]&&_[_0xd847('0xdf')](this[_0xd847('0xac')][_0x551818[_0xd847('0x123')]]['locked'])&&_0x551818[_0xd847('0xaf')]==='1'&&_0x551818[_0xd847('0x124')]==='0'){if(this[_0xd847('0x22')][_0x551818[_0xd847('0x125')]]){if(!this[_0xd847('0x22')][_0x551818['stateinterface']][_0xd847('0x126')]){this['agents'][_0x551818['stateinterface']][_0xd847('0x126')]=!![];this['actions'][_0x551818[_0xd847('0x123')]][_0xd847('0x126')]=!![];this[_0xd847('0xac')][_0x551818[_0xd847('0x123')]][_0xd847('0x125')]=_0x551818[_0xd847('0x125')];}}}}else if((strategy[this[_0xd847('0x20')][this[_0xd847('0xac')][_0x551818[_0xd847('0x123')]][_0xd847('0xb3')]]['strategy']]||_0xd847('0x19'))===_0xd847('0x19')){if(this['actions'][_0x551818[_0xd847('0x123')]]){if(this[_0xd847('0x22')][_0x551818[_0xd847('0x125')]]){this[_0xd847('0xac')][_0x551818[_0xd847('0x123')]][_0xd847('0x125')]=_0x551818['stateinterface'];if(_[_0xd847('0xdf')](this[_0xd847('0x2b')][this[_0xd847('0xac')][_0x551818[_0xd847('0x123')]][_0xd847('0xb3')]])){this['queueBooked'][this[_0xd847('0xac')][_0x551818['actionid']][_0xd847('0xb3')]]=[];}this[_0xd847('0x2b')][this[_0xd847('0xac')][_0x551818[_0xd847('0x123')]][_0xd847('0xb3')]][_0xd847('0x127')](_['merge'](_['pick'](this[_0xd847('0xac')][_0x551818[_0xd847('0x123')]],['idHopper','stateinterface']),{'status':_0x551818[_0xd847('0xaf')],'paused':_0x551818['paused']}));}}}};function unlockQueueStatus(_0x2c015d,_0x4b1fa3){setTimeout(function(){if(_[_0xd847('0x3e')](_0x2c015d['queueStatusComplete'])){loggerBooked[_0xd847('0x96')](_0xd847('0x128'),_0x4b1fa3);}_0x2c015d[_0xd847('0x129')]=!![];loggerBooked[_0xd847('0x7b')](_0xd847('0x12a'),_0x4b1fa3,JSON['stringify'](_[_0xd847('0xd2')](_0x2c015d,[_0xd847('0x41'),_0xd847('0x129')])));},0x1f3);}Dialer['prototype']['syncQueueStatusComplete']=function(_0x2600ee){var _0x5ecbc6=this;var _0x3ec06e=_0x5ecbc6['voiceQueues'][_0x5ecbc6[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0xb3')]];if(strategy[this[_0xd847('0x20')][this['actions'][_0x2600ee['actionid']][_0xd847('0xb3')]][_0xd847('0x122')]]==='roundrobin'){if(this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]]&&this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0x125')]){this[_0xd847('0x1f')]['run'](this['actions'][_0x2600ee[_0xd847('0x123')]][_0xd847('0x12b')],this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0x125')])[_0xd847('0xb1')](function(_0x4f1347){logger[_0xd847('0x96')]('[Catch][Preview][syncQueueStatusComplete]',util[_0xd847('0x98')](_0x4f1347,{'showHidden':![],'depth':null}));})[_0xd847('0x1d')](function(){_0x5ecbc6[_0xd847('0xb2')](_0x5ecbc6['voiceQueues'][_0x5ecbc6[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0xb3')]]);_0x5ecbc6[_0xd847('0x22')][_0x5ecbc6[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]]['stateinterface']][_0xd847('0x126')]=![];delete _0x5ecbc6['actions'][_0x2600ee['actionid']];unlockQueueStatus(_0x3ec06e);});}else{this['updateOriginated'](this['voiceQueues'][this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0xb3')]]);this[_0xd847('0xbe')]({'active':![],'ContactId':this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0xd3')],'ListId':this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0xd4')],'VoiceQueueId':this['actions'][_0x2600ee['actionid']][_0xd847('0xd5')]||undefined,'CampaignId':this['actions'][_0x2600ee[_0xd847('0x123')]][_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x12c')));delete this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]];unlockQueueStatus(_0x3ec06e);}}else if((strategy[this['voiceQueues'][this['actions'][_0x2600ee[_0xd847('0x123')]]['queue']][_0xd847('0x122')]]||_0xd847('0x19'))===_0xd847('0x19')){var _0x41b4e7;if(this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]]&&!_[_0xd847('0x48')](this[_0xd847('0x2b')][this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0xb3')]])){if(this['queueBookedRR'][_0x5ecbc6[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]]['queue']]){this[_0xd847('0x2c')][_0x5ecbc6[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0xb3')]]=this[_0xd847('0x2c')][this['actions'][_0x2600ee[_0xd847('0x123')]][_0xd847('0xb3')]]?this['queueBookedRR'][this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]][_0xd847('0xb3')]]:this[_0xd847('0x2b')][this[_0xd847('0xac')][_0x2600ee['actionid']][_0xd847('0xb3')]]?this['queueBooked'][this['actions'][_0x2600ee[_0xd847('0x123')]][_0xd847('0xb3')]][_0xd847('0x12d')]||0x0:0x0;}this['queueBooked'][this['actions'][_0x2600ee[_0xd847('0x123')]][_0xd847('0xb3')]][_0xd847('0x12d')]=this[_0xd847('0x2c')][this[_0xd847('0xac')][_0x2600ee[_0xd847('0x123')]]['queue']];for(var _0x504378=0x0;_0x504378=0x0;})[_0xd847('0xb1')](myreject(_0x25b228)));}}else{_0x23358a[_0xd847('0x127')](ami[_0xd847('0xae')]({'action':_0xd847('0x148'),'command':util[_0xd847('0x78')](_0xd847('0x149'),_0x3ac361,!_[_0xd847('0x3e')](config[_0xd847('0x145')][_0x4b8f83])?_0x4b8f83:'')})['then'](function(_0x69d3c1){return _0x69d3c1['content']['indexOf'](_0xd847('0x147'))>=0x0;})['catch'](myreject(_0x25b228)));}BPromise[_0xd847('0x14a')](_0x23358a)[_0xd847('0xb7')](function(_0x968fb4){var _0x42f5af=_['some'](_0x968fb4);if(_0x42f5af){return _0x57b406(_0x42f5af);}else{_0x14a343[_0xd847('0x3f')]=_0x56bf48?'GLOBAL_INTERVAL_IS_OVERTIME':_0xd847('0x14b');return _0x25b228(msgResponse('[ifTime][promiseAll]','Failure',_0xd847('0x14c')+_0x56bf48+'\x20'+_0x314193+_0xd847('0x14d')+util[_0xd847('0x98')](_0x3ac361,{'showHidden':![],'depth':null})+_0xd847('0x14e')+_0x4b8f83));}})['catch'](function(_0x28b204){return _0x25b228(msgResponse('ifTime','Failure',JSON[_0xd847('0x75')](_0x28b204)));});});};Dialer['prototype']['checkDialMethod']=function(_0x40db15){var _0x1a3f7a=this;return function(){switch(_0x40db15[_0xd847('0x5a')]){case _0xd847('0x14f'):freeVariablesPredictive(_0x40db15);_0x1a3f7a[_0xd847('0x150')](_0x40db15,0x1);break;case _0xd847('0x151'):freeVariablesPredictive(_0x40db15);_0x1a3f7a[_0xd847('0x150')](_0x40db15,_0x40db15[_0xd847('0x152')]);break;case'predictive':_0x1a3f7a['predictive'](_0x40db15);break;case _0xd847('0x8'):freeVariablesPredictive(_0x40db15);_0x1a3f7a[_0xd847('0x150')](_0x40db15,0x1);break;default:freeVariablesPredictive(_0x40db15);logger[_0xd847('0x96')](_0xd847('0x153'),_0x40db15['name'],'method\x20not\x20recognized');}};};Dialer[_0xd847('0x1b')][_0xd847('0x154')]=function(_0xab6b7c){var _0x51b771=this;return function(){_0x51b771['handleIvr'](_0xab6b7c);};};Dialer[_0xd847('0x1b')]['syncQueueSummary']=function(_0x2f583c){var _0x14e675=this;if(isNotPreview(_0x2f583c['dialMethod'])){if(isVoiceQueueOutbound(_0x2f583c[_0xd847('0x56')])&&isActive(_0x2f583c[_0xd847('0x59')])){_0x2f583c[_0xd847('0xa1')]=!![];BPromise[_0xd847('0xb6')]()[_0xd847('0xb7')](checkIsLoggedIn(_0x2f583c,_0x2f583c[_0xd847('0x51')]))[_0xd847('0xb7')](checkIsActive(_0x2f583c,_0x2f583c[_0xd847('0x59')]))[_0xd847('0xb7')](checkInterval(_0x2f583c))[_0xd847('0xb7')](_0x14e675[_0xd847('0x13b')](_0x2f583c))[_0xd847('0xb7')](_0x14e675[_0xd847('0x155')](_0x2f583c[_0xd847('0x156')],_0x2f583c['dialTimezone'],_0x2f583c['name'],_0x2f583c))[_0xd847('0xb7')](_0x14e675['checkIfTimeIntervals'](_0x2f583c[_0xd847('0x44')],_0x2f583c[_0xd847('0x157')],_0x2f583c[_0xd847('0x41')],_0x2f583c))[_0xd847('0xb7')](_0x14e675['checkDialMethod'](_0x2f583c))[_0xd847('0xb1')](loggerCatchQueueSummary(_0xd847('0x158'),_0x2f583c));}else{notSendMessagesQueue(_0x2f583c);}}else{freeVariablesPredictive(_0x2f583c);}};Dialer[_0xd847('0x1b')][_0xd847('0x13a')]=function(){var _0x4471a8=this;var _0x30493e;for(var _0x5e1c1 in this[_0xd847('0x21')]){if(typeof this[_0xd847('0x21')][_0x5e1c1]!==_0xd847('0x99')){_0x30493e=this[_0xd847('0x21')][_0x5e1c1];if(isCampaignIvr(_0x30493e[_0xd847('0x56')])&&isActive(_0x30493e[_0xd847('0x159')])){_0x30493e['sendMessageOneNotActive']=!![];BPromise[_0xd847('0xb6')]()[_0xd847('0xb7')](checkIsActive(_0x30493e,_0x30493e[_0xd847('0x159')]))[_0xd847('0xb7')](checkInterval(_0x30493e))[_0xd847('0xb7')](_0x4471a8['checkIsTrunkReachable'](_0x30493e))[_0xd847('0xb7')](_0x4471a8[_0xd847('0x155')](_0x30493e[_0xd847('0x156')],_0x30493e[_0xd847('0x157')],_0x30493e[_0xd847('0x41')],_0x30493e))[_0xd847('0xb7')](_0x4471a8['checkIfTimeIntervals'](_0x30493e['Interval'],_0x30493e[_0xd847('0x157')],_0x30493e['name'],_0x30493e))[_0xd847('0xb7')](_0x4471a8[_0xd847('0x154')](_0x30493e))[_0xd847('0xb1')](loggerCatchQueueSummary('[syncCampaigns]',_0x30493e));}else{notSendMessagesCampaign(_0x30493e);}}}};function getCallerIdRandom(_0x2b90f7,_0x128fe2){var _0x3da744;var _0x51ca00;var _0x3877e1;if(_0x128fe2<=0x0){_0x128fe2=0x1;}_0x3da744=new RegExp(_0xd847('0x15a')+_0x128fe2+'}$');_0x51ca00=Math['pow'](0xa,_0x128fe2-0x1);_0x3877e1=Math['pow'](0xa,_0x128fe2)-0x1;return util[_0xd847('0x78')]('%s',_[_0xd847('0x15b')](_0x2b90f7,_0x3da744,_['random'](_0x51ca00,_0x3877e1)));}function extractCalleridName(_0x457389){var _0x1c2b86=_0x457389['match'](/"(.*?)"/);return _0x1c2b86?_0x1c2b86[0x1]:_0x457389;}function extractCalleridNumber(_0x2c12d6){var _0x53044d=_0x2c12d6[_0xd847('0x15c')](/<(.*?)>/);return _0x53044d?_0x53044d[0x1]:_0x2c12d6;}Dialer[_0xd847('0x1b')][_0xd847('0x15d')]=function(_0x3ad4e4,_0x527428){var _0x3792d9=this;var _0x5cae1e=uuid['v4']();this['actions'][_0x5cae1e]=new Action(_0x3ad4e4,_0x527428,_0x5cae1e);return new BPromise(function(_0x1caa61,_0x4ef8f7){if(_['isUndefined'](_0x3ad4e4)&&typeof _0x3ad4e4!==_0xd847('0x15e')){return _0x4ef8f7(msgResponse(_0xd847('0x15f'),'Failure',_0xd847('0x160')));}if(_[_0xd847('0x3e')](_0x527428['Contact']['phone'])||_0x527428[_0xd847('0x161')][_0xd847('0x162')]===null){return _0x4ef8f7(msgResponse(_0xd847('0x15f'),_0xd847('0x141'),_0xd847('0x163')));}var _0x4c5c28={'XMD-CALLERID':_0x3792d9['actions'][_0x5cae1e][_0xd847('0x164')](),'XMD-AGI':_0x3ad4e4[_0xd847('0x109')]?util[_0xd847('0x78')](_0xd847('0x165'),ipAgi,_0x3ad4e4[_0xd847('0x109')]):_0xd847('0x166'),'XMD-AGIAFTER':_0x3ad4e4['dialQueueProject2']?util[_0xd847('0x78')](_0xd847('0x165'),ipAgi,_0x3ad4e4[_0xd847('0x110')]):_0xd847('0x166'),'XMD-QUEUE':_0x3ad4e4['type']==='outbound'?util[_0xd847('0x78')](_0xd847('0x167'),_0x3ad4e4[_0xd847('0x41')],_0x3ad4e4[_0xd847('0x168')]||'',_0x3ad4e4[_0xd847('0x111')]?'c':'',_0x3ad4e4['dialQueueTimeout']||0x3):_0xd847('0x166'),'XMD-CONTACTID':_0x527428[_0xd847('0xd3')],'XMD-CDRTYPE':_0xd847('0x6'),'CALLERID(all)':_0x3792d9[_0xd847('0xac')][_0x5cae1e][_0xd847('0x164')](),'XMD-AMD':_0x3ad4e4[_0xd847('0xe3')]?_0xd847('0x169'):_0xd847('0x166'),'XMD-DESTINATION':_0xd847('0xe2')};if(_0x3ad4e4[_0xd847('0xe3')]){_0x4c5c28[_0xd847('0x16a')]=_0x3ad4e4[_0xd847('0x16b')]||0x9c4;_0x4c5c28[_0xd847('0x16c')]=_0x3ad4e4[_0xd847('0x16d')]||0x5dc;_0x4c5c28['XMD-AMDAFTERGREETINGSILENCE']=_0x3ad4e4[_0xd847('0x16e')]||0x320;_0x4c5c28[_0xd847('0x16f')]=_0x3ad4e4[_0xd847('0x170')]||0x1388;_0x4c5c28[_0xd847('0x171')]=_0x3ad4e4['dialAMDMinWordLength']||0x64;_0x4c5c28[_0xd847('0x172')]=_0x3ad4e4[_0xd847('0x173')]||0x32;_0x4c5c28[_0xd847('0x174')]=_0x3ad4e4[_0xd847('0x175')]||0x3;_0x4c5c28[_0xd847('0x176')]=_0x3ad4e4[_0xd847('0x177')]||0x100;_0x4c5c28['XMD-AMDMAXIMUMWORDLENGTH']=_0x3ad4e4[_0xd847('0x178')]||0x1388;}if(_0x3ad4e4['type']===_0xd847('0x4e')){_0x4c5c28[_0xd847('0x179')]=_0x527428[_0xd847('0xd5')];}else{_0x4c5c28[_0xd847('0x17a')]=_0x527428['CampaignId'];}for(var _0x2142ac in _0x527428[_0xd847('0x161')]){if(typeof _0x527428[_0xd847('0x161')][_0x2142ac]!==_0xd847('0x99')){if(isNotNull(_0x527428['Contact'][_0x2142ac])&&_0x2142ac!=='id'&&_0x2142ac!==_0xd847('0x17b')&&_0x2142ac!==_0xd847('0x17c')&&_0x2142ac!==_0xd847('0x17d')){_0x4c5c28[util['format'](_0xd847('0x17e'),'XMD-',_[_0xd847('0x17f')](_0x2142ac))]=_0x527428[_0xd847('0x161')][_0x2142ac];}}}var _0x102530=_0x3792d9['isTrunkReachable'](_0x3ad4e4['Trunk'])?getCallerId(_0x3ad4e4[_0xd847('0x74')][_0xd847('0x180')],_0x3ad4e4[_0xd847('0x5b')],_0x3ad4e4['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3ad4e4[_0xd847('0x5c')],_0x3ad4e4['dialRandomLastDigitCallerIdNumber']):_0x3ad4e4[_0xd847('0x5c')]):getCallerId(_[_0xd847('0xdf')](_0x3ad4e4[_0xd847('0x13c')])?_0x3ad4e4[_0xd847('0x74')]['callerid']:_0x3ad4e4[_0xd847('0x13c')]['callerid'],_0x3ad4e4[_0xd847('0x5b')],_0x3ad4e4['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x3ad4e4[_0xd847('0x5c')],_0x3ad4e4['dialRandomLastDigitCallerIdNumber']):_0x3ad4e4[_0xd847('0x5c')]);if(_0x102530){_0x4c5c28[_0xd847('0x181')]=_0x3792d9[_0xd847('0xac')][_0x5cae1e]['originatecalleridname']=extractCalleridName(_0x102530);_0x4c5c28[_0xd847('0x182')]=_0x3792d9[_0xd847('0xac')][_0x5cae1e][_0xd847('0x183')]=extractCalleridNumber(_0x102530);}return ami['Action']({'actionid':_0x5cae1e,'action':_0xd847('0x15f'),'channel':_0x3792d9[_0xd847('0xda')](_0x3ad4e4['Trunk'])?util[_0xd847('0x78')](_0xd847('0x184'),_0x3ad4e4[_0xd847('0x74')]['name'],isNotNull(_0x3ad4e4['dialPrefix'])?_0x3ad4e4['dialPrefix'][_0xd847('0x185')]()||'':'',_0x3ad4e4[_0xd847('0x186')]>0x0?_0x527428[_0xd847('0x161')][_0xd847('0x162')]['substring'](_0x3ad4e4[_0xd847('0x186')]):_0x527428[_0xd847('0x161')][_0xd847('0x162')]):util[_0xd847('0x78')](_0xd847('0x184'),_[_0xd847('0xdf')](_0x3ad4e4['TrunkBackup'])?_0x3ad4e4[_0xd847('0x74')][_0xd847('0x41')]:_0x3ad4e4[_0xd847('0x13c')][_0xd847('0x41')],isNotNull(_0x3ad4e4[_0xd847('0x5e')])?_0x3ad4e4[_0xd847('0x5e')][_0xd847('0x185')]()||'':'',_0x3ad4e4['dialCutDigit']>0x0?_0x527428[_0xd847('0x161')][_0xd847('0x162')][_0xd847('0x187')](_0x3ad4e4['dialCutDigit']):_0x527428[_0xd847('0x161')][_0xd847('0x162')]),'callerid':_0x102530,'Exten':_0xd847('0xe2'),'Context':'from-sip','Priority':'1','variable':_0x4c5c28,'timeout':(_0x3ad4e4[_0xd847('0x5d')]||0x1e)*0x3e8,'async':!![],'channelid':_0x5cae1e})[_0xd847('0xb7')](function(_0x340bd7){return _0x1caa61(_0x340bd7);})['catch'](function(_0x1f2d4c){_0x3ad4e4[_0xd847('0x65')]+=0x1;var _0x456785=new History(_0x3792d9[_0xd847('0xac')][_0x5cae1e]);logger[_0xd847('0x96')](util[_0xd847('0x78')](_0xd847('0x188'),JSON['stringify'](_0x1f2d4c)));_0x456785[_0xd847('0xe7')]=0xe;_0x456785[_0xd847('0x100')]='OriginateError';_0x456785[_0xd847('0xa9')]=moment()[_0xd847('0x78')](_0xd847('0xff'));_0x456785['endtime']=_0x456785['starttime'];_0x3792d9[_0xd847('0xcb')](_0x456785)[_0xd847('0xb1')](loggerCatch('[originate][error]'));_0x3792d9[_0xd847('0xc9')](_0x456785)[_0xd847('0xb1')](loggerCatch(_0xd847('0x189')))[_0xd847('0x1d')](function(){delete _0x3792d9[_0xd847('0xac')][_0x5cae1e];return _0x4ef8f7(msgResponse(_0xd847('0x15f'),_0xd847('0x4a'),_0xd847('0x18a')));});});});};Dialer[_0xd847('0x1b')][_0xd847('0x32')]=function(_0x1cd23e){var _0x55dcb5=this[_0xd847('0xac')][_0x1cd23e[_0xd847('0x123')]];if(_0x55dcb5){delete this[_0xd847('0xac')][_0x1cd23e[_0xd847('0x123')]];_0x55dcb5[_0xd847('0x18b')]=moment()[_0xd847('0x78')](_0xd847('0xff'));var _0x10ae81=_0x55dcb5[_0xd847('0x56')]===_0xd847('0x77')?this[_0xd847('0x21')][_0x55dcb5[_0xd847('0xb3')]]:this[_0xd847('0x20')][_0x55dcb5[_0xd847('0x18c')]()];if(!this[_0xd847('0x18d')](_0x1cd23e[_0xd847('0x18e')])){this[_0xd847('0xb2')](_0x10ae81);return this['callProgressDetecting'](_0x55dcb5,_0x10ae81,_0x1cd23e)[_0xd847('0xb1')](loggerCatch(_0xd847('0x18f')));}this['uniqueId'][_0x1cd23e[_0xd847('0xde')]]=_0x55dcb5;}};Dialer[_0xd847('0x1b')][_0xd847('0x190')]=function(_0x2a0497,_0xe11f8f,_0x35f316){var _0x4bb76a=new History(_0xe11f8f);if(_0x4bb76a[_0xd847('0xf1')]+_0x4bb76a[_0xd847('0xf2')]+_0x4bb76a[_0xd847('0xf3')]+_0x4bb76a[_0xd847('0xf4')]+_0x4bb76a[_0xd847('0xf5')]+_0x4bb76a[_0xd847('0x104')]+_0x4bb76a[_0xd847('0xee')]+_0x4bb76a[_0xd847('0xf6')]>=_0x35f316['dialGlobalMaxRetry']-0x1){return!![];}switch(_0x2a0497){case 0x3:if(_0x4bb76a['countnoanswerretry']>=_0x35f316[_0xd847('0x191')]-0x1){return!![];}this[_0xd847('0xbe')]({'active':![],'countnoanswerretry':_0x4bb76a['countnoanswerretry']+=0x1,'scheduledat':moment()[_0xd847('0xfc')](_0x35f316['dialNoAnswerRetryFrequency'],'minutes')[_0xd847('0x78')](_0xd847('0xff')),'ContactId':_0x4bb76a[_0xd847('0xd3')],'ListId':_0x4bb76a[_0xd847('0xd4')],'VoiceQueueId':_0x4bb76a['VoiceQueueId']||undefined,'CampaignId':_0x4bb76a[_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x192')));break;case 0x5:if(_0x4bb76a[_0xd847('0xf1')]>=_0x35f316['dialBusyMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x4bb76a[_0xd847('0xf1')]+=0x1,'scheduledat':moment()['add'](_0x35f316[_0xd847('0x193')],_0xd847('0xfe'))[_0xd847('0x78')](_0xd847('0xff')),'ContactId':_0x4bb76a[_0xd847('0xd3')],'ListId':_0x4bb76a[_0xd847('0xd4')],'VoiceQueueId':_0x4bb76a['VoiceQueueId']||undefined,'CampaignId':_0x4bb76a[_0xd847('0xd6')]||undefined})['catch'](loggerCatch(_0xd847('0x194')));break;case 0x8:if(_0x4bb76a[_0xd847('0xf2')]>=_0x35f316[_0xd847('0x195')]-0x1){return!![];}this[_0xd847('0xbe')]({'active':![],'countcongestionretry':_0x4bb76a[_0xd847('0xf2')]+=0x1,'scheduledat':moment()[_0xd847('0xfc')](_0x35f316[_0xd847('0x196')],_0xd847('0xfe'))['format'](_0xd847('0xff')),'ContactId':_0x4bb76a[_0xd847('0xd3')],'ListId':_0x4bb76a['ListId'],'VoiceQueueId':_0x4bb76a[_0xd847('0xd5')]||undefined,'CampaignId':_0x4bb76a[_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x197')));break;case 0x0:if(_0x4bb76a[_0xd847('0xf4')]>=_0x35f316[_0xd847('0x198')]-0x1){return!![];}else{this[_0xd847('0xbe')]({'active':![],'countnosuchnumberretry':_0x4bb76a[_0xd847('0xf4')]+=0x1,'scheduledat':moment()['add'](_0x35f316[_0xd847('0x199')],'minutes')[_0xd847('0x78')](_0xd847('0xff')),'ContactId':_0x4bb76a[_0xd847('0xd3')],'ListId':_0x4bb76a[_0xd847('0xd4')],'VoiceQueueId':_0x4bb76a[_0xd847('0xd5')]||undefined,'CampaignId':_0x4bb76a[_0xd847('0xd6')]||undefined})['catch'](loggerCatch(_0xd847('0x19a')));}break;case 0xa:if(_0x4bb76a[_0xd847('0xf5')]>=_0x35f316[_0xd847('0x19b')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countdropretry':_0x4bb76a[_0xd847('0xf5')]+=0x1,'scheduledat':moment()[_0xd847('0xfc')](_0x35f316[_0xd847('0x19c')],'minutes')[_0xd847('0x78')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4bb76a['ContactId'],'ListId':_0x4bb76a['ListId'],'VoiceQueueId':_0x4bb76a[_0xd847('0xd5')]||undefined,'CampaignId':_0x4bb76a['CampaignId']||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x119')));break;case 0xb:if(_0x4bb76a[_0xd847('0x104')]>=_0x35f316[_0xd847('0x11e')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countabandonedretry':_0x4bb76a['countabandonedretry']+=0x1,'scheduledat':moment()[_0xd847('0xfc')](_0x35f316[_0xd847('0x11f')],_0xd847('0xfe'))[_0xd847('0x78')](_0xd847('0xff')),'ContactId':_0x4bb76a[_0xd847('0xd3')],'ListId':_0x4bb76a[_0xd847('0xd4')],'VoiceQueueId':_0x4bb76a[_0xd847('0xd5')]||undefined,'CampaignId':_0x4bb76a[_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x120')));break;case 0x13:if(_0x4bb76a[_0xd847('0xee')]>=_0x35f316['dialMachineMaxRetry']-0x1){return!![];}this[_0xd847('0xbe')]({'active':![],'countmachineretry':_0x4bb76a[_0xd847('0xee')]+=0x1,'scheduledat':moment()['add'](_0x35f316[_0xd847('0xfd')],_0xd847('0xfe'))['format'](_0xd847('0xff')),'ContactId':_0x4bb76a[_0xd847('0xd3')],'ListId':_0x4bb76a[_0xd847('0xd4')],'VoiceQueueId':_0x4bb76a[_0xd847('0xd5')]||undefined,'CampaignId':_0x4bb76a['CampaignId']||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0x4bb76a[_0xd847('0xf6')]>=_0x35f316[_0xd847('0x19d')]-0x1){return!![];}this[_0xd847('0xbe')]({'active':![],'countagentrejectretry':_0x4bb76a[_0xd847('0xf6')]+=0x1,'scheduledat':moment()[_0xd847('0xfc')](_0x35f316[_0xd847('0x19e')],'minutes')[_0xd847('0x78')](_0xd847('0xff')),'ContactId':_0x4bb76a[_0xd847('0xd3')],'ListId':_0x4bb76a['ListId'],'VoiceQueueId':_0x4bb76a[_0xd847('0xd5')]||undefined,'CampaignId':_0x4bb76a[_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x19f')));break;default:return!![];}};Dialer[_0xd847('0x1b')]['callProgressDetecting']=function(_0x186163,_0x7721c8,_0x3817f7){var _0x184896=this;var _0x4e6126=new History(_0x186163);return new BPromise(function(_0x5a6b70,_0xcb0136){if(_[_0xd847('0x3e')](_0x7721c8)&&typeof _0x7721c8!==_0xd847('0x15e')){return _0xcb0136(msgResponse(_0xd847('0x1a0'),_0xd847('0x141'),_0xd847('0x1a1')));}if(_[_0xd847('0x3e')](_0x3817f7)&&typeof _0x3817f7!==_0xd847('0x15e')){return _0xcb0136(msgResponse(_0xd847('0x1a0'),_0xd847('0x141'),_0xd847('0x1a2')));}switch(_0x3817f7[_0xd847('0x1a3')]){case'0':_0x7721c8[_0xd847('0x1a4')]+=0x1;_0x4e6126[_0xd847('0xe7')]=0x0;_0x4e6126[_0xd847('0x100')]=_0xd847('0x1a5');_0x4e6126[_0xd847('0xf4')]+=0x1;_0x4e6126['countglobal']+=0x1;ami['emit'](_0xd847('0x1a6'),ut[_0xd847('0xf0')](_0x186163,_0xd847('0x1a7')));_0x184896[_0xd847('0xcb')](_0x4e6126)[_0xd847('0xb1')](loggerCatch(_0xd847('0x103')));if(_0x184896['checkRetriveMax'](0x0,_0x186163,_0x7721c8)){if(_0x4e6126['countnosuchnumberretry']>=_0x7721c8[_0xd847('0x198')]){_0x184896[_0xd847('0x1a8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1a9'));}else{_0x184896[_0xd847('0xf8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1a9'));}}break;case'3':_0x7721c8[_0xd847('0x64')]+=0x1;_0x4e6126[_0xd847('0xe7')]=0x3;_0x4e6126[_0xd847('0x100')]=_0xd847('0x1aa');_0x4e6126[_0xd847('0xf3')]+=0x1;_0x4e6126[_0xd847('0x1ab')]+=0x1;ami[_0xd847('0x4d')](_0xd847('0x1ac'),ut['buildObj'](_0x186163,'noanswer'));_0x184896[_0xd847('0xcb')](_0x4e6126)[_0xd847('0xb1')](loggerCatch(_0xd847('0x1ad')));if(_0x184896[_0xd847('0x190')](0x3,_0x186163,_0x7721c8)){if(_0x4e6126['countnoanswerretry']>=_0x7721c8[_0xd847('0x191')]){_0x184896[_0xd847('0x1a8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1ae'));}else{_0x184896[_0xd847('0xf8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1ae'));}}break;case'5':_0x7721c8[_0xd847('0x61')]+=0x1;_0x4e6126[_0xd847('0xe7')]=0x5;_0x4e6126[_0xd847('0x100')]=_0xd847('0x1af');_0x4e6126[_0xd847('0xf1')]+=0x1;_0x4e6126[_0xd847('0x1ab')]+=0x1;ami['emit']('custom:agentbusy',ut[_0xd847('0xf0')](_0x186163,_0xd847('0x1b0')));_0x184896[_0xd847('0xcb')](_0x4e6126)[_0xd847('0xb1')](loggerCatch(_0xd847('0x1b1')));if(_0x184896['checkRetriveMax'](0x5,_0x186163,_0x7721c8)){if(_0x4e6126[_0xd847('0xf1')]>=_0x7721c8[_0xd847('0x1b2')]){_0x184896[_0xd847('0x1a8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1b3'));}else{_0x184896[_0xd847('0xf8')](_0x4e6126,_0x5a6b70,_0xcb0136,'reason\x205\x20busy');}}break;case'8':_0x7721c8[_0xd847('0x1b4')]+=0x1;_0x4e6126[_0xd847('0xe7')]=0x8;_0x4e6126[_0xd847('0x100')]=_0xd847('0x1b5');_0x4e6126[_0xd847('0xf2')]+=0x1;_0x4e6126['countglobal']+=0x1;ami[_0xd847('0x4d')]('custom:agentcongestion',ut[_0xd847('0xf0')](_0x186163,_0xd847('0x1b6')));_0x184896['createHistory'](_0x4e6126)[_0xd847('0xb1')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x184896['checkRetriveMax'](0x8,_0x186163,_0x7721c8)){if(_0x4e6126['countcongestionretry']>=_0x7721c8[_0xd847('0x195')]){_0x184896[_0xd847('0x1a8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1b7'));}else{_0x184896[_0xd847('0xf8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1b7'));}}break;case'11':_0x7721c8[_0xd847('0x1b8')]+=0x1;_0x4e6126['state']=0xb;_0x4e6126['statedesc']=_0xd847('0x121');_0x4e6126['countabandonedretry']+=0x1;_0x4e6126['countglobal']+=0x1;_0x184896['createHistory'](_0x4e6126)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x184896[_0xd847('0x190')](0xb,_0x186163,_0x7721c8)){if(_0x4e6126['countabandonedretry']>=_0x7721c8[_0xd847('0x11e')]){_0x184896[_0xd847('0x1a8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1b9'));}else{_0x184896['stateGlobal'](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1b9'));}}break;case'20':_0x7721c8[_0xd847('0x67')]+=0x1;_0x4e6126[_0xd847('0xe7')]=0x14;_0x4e6126[_0xd847('0x100')]=_0xd847('0x1ba');_0x4e6126[_0xd847('0xf6')]+=0x1;_0x4e6126['countglobal']+=0x1;ami[_0xd847('0x4d')](_0xd847('0x1bb'),ut[_0xd847('0xf0')](_0x186163,_0xd847('0x1bc')));_0x184896[_0xd847('0xcb')](_0x4e6126)['catch'](loggerCatch(_0xd847('0x1bd')));if(_0x184896[_0xd847('0x190')](0x14,_0x186163,_0x7721c8)){if(_0x4e6126[_0xd847('0xf6')]>=_0x7721c8[_0xd847('0x19d')]){_0x184896[_0xd847('0x1a8')](_0x4e6126,_0x5a6b70,_0xcb0136,'reason\x2020\x20agentreject');}else{_0x184896[_0xd847('0xf8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0xd847('0x1be'));}}break;default:_0x7721c8[_0xd847('0x68')]+=0x1;_0x4e6126[_0xd847('0xe7')]=0xc;_0x4e6126['statedesc']=_0x3817f7['reason'];_0x184896[_0xd847('0xcb')](_0x4e6126)[_0xd847('0xb1')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x184896[_0xd847('0x190')](_0x3817f7[_0xd847('0x1a3')],_0x186163,_0x7721c8)){if(_0x4e6126[_0xd847('0xf1')]+_0x4e6126['countcongestionretry']+_0x4e6126['countnoanswerretry']+_0x4e6126[_0xd847('0xf4')]+_0x4e6126[_0xd847('0xf5')]+_0x4e6126['countabandonedretry']+_0x4e6126['countmachineretry']+_0x4e6126['countagentrejectretry']>=_0x7721c8[_0xd847('0xf7')]){_0x184896[_0xd847('0xf8')](_0x4e6126,_0x5a6b70,_0xcb0136,_0x3817f7[_0xd847('0x1a3')]);}else{_0x184896['createStateFinal'](_0x4e6126,_0x5a6b70,_0xcb0136,_0x3817f7[_0xd847('0x1a3')]);}}}});};Dialer[_0xd847('0x1b')][_0xd847('0xf8')]=function(_0x473581,_0x413942,_0x330497,_0x38ccae){var _0x1f2eb4=new Final(_0x473581);_0x1f2eb4[_0xd847('0xe7')]=0xf;_0x1f2eb4[_0xd847('0x100')]=_0xd847('0x1bf');this['createStateFinal'](_0x1f2eb4,_0x413942,_0x330497,_0x38ccae);};Dialer[_0xd847('0x1b')][_0xd847('0x1a8')]=function(_0x11178b,_0x573222,_0xf70f8b,_0x3eab49){this['moveContactManagedDialer'](_0x11178b)[_0xd847('0xb7')](function(){return _0x573222(msgResponse(_0xd847('0x1a0'),_0xd847('0xd9'),_0x3eab49));})['catch'](function(){return _0xf70f8b(msgResponse(_0xd847('0x1c0'),_0xd847('0x141'),'contact\x20not\x20moved'));});};Dialer[_0xd847('0x1b')][_0xd847('0x1c1')]=function(_0x59b579){var _0x4fc116=_0x59b579[_0xd847('0x1c2')]/0x64;var _0x5e30b1=_0x59b579[_0xd847('0x117')]/(_0x59b579['outboundDropCallsDayTimeout']+_0x59b579[_0xd847('0x5f')]);var _0x24b2b9=Math[_0xd847('0x1c3')](_0x59b579[_0xd847('0x70')]*(_0x59b579[_0xd847('0x1c4')]/0x64));var _0x32d3bd=Math[_0xd847('0x1c3')](_0x59b579[_0xd847('0x70')]*(_0x59b579[_0xd847('0x1c5')]/0x64));var _0x53892f=_0x59b579['available']+_0x59b579[_0xd847('0x55')];var _0x51598d=Math[_0xd847('0x1c6')](_0x59b579[_0xd847('0x89')]*_0x59b579[_0xd847('0x72')]*_0x59b579[_0xd847('0x6e')]*_0x59b579['predictiveIntervalMultiplicativeFactor']);if(_[_0xd847('0x3e')](_0x59b579[_0xd847('0x29')])){if(!_[_0xd847('0x3e')](_0x59b579[_0xd847('0x28')])){_0x59b579[_0xd847('0x28')]=undefined;loggerPredictive[_0xd847('0x96')](_0xd847('0x1c7'),'check\x20predictive\x20is\x20not\x20undefine');}if(!_[_0xd847('0x3e')](_0x59b579['handlePredictive'])){loggerPredictive[_0xd847('0x96')](_0xd847('0x1c7'),'check\x20handlePredictive\x20is\x20not\x20undefine');clearInterval(_0x59b579[_0xd847('0x91')]);_0x59b579[_0xd847('0x91')]=undefined;}_0x59b579[_0xd847('0x29')]=moment()[_0xd847('0x78')](_0xd847('0xff'));loggerPredictive[_0xd847('0x7b')](_0x59b579[_0xd847('0x41')],_0xd847('0x1c8'),_0x59b579[_0xd847('0x29')]);this[_0xd847('0x150')](_0x59b579,0x1);}else if(ifInterval(_0x59b579[_0xd847('0x1c9')],_0x59b579[_0xd847('0x29')])){this[_0xd847('0x150')](_0x59b579,0x1);loggerPredictiveCalls[_0xd847('0x7b')](_0xd847('0x1ca'),_0x59b579['startProgressive'],_0x59b579[_0xd847('0x41')]);_0x59b579['erlangCalls']=0x0;_0x59b579[_0xd847('0x6d')]=0x0;}else if(_0x4fc116<_0x5e30b1&&_0x59b579[_0xd847('0x1cb')]==='dropRate'){freeVariablesPredictive(_0x59b579);loggerPredictive['info'](_0xd847('0x1cc'),_0xd847('0x1cd'),_0x5e30b1,_0xd847('0x29'),_0x59b579[_0xd847('0x41')]);}else if(_0x51598d<_0x59b579[_0xd847('0x6d')]&&_0x59b579[_0xd847('0x1cb')]===_0xd847('0x1ce')){freeVariablesPredictive(_0x59b579);loggerPredictive[_0xd847('0x7b')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0xd847('0x1cf'),_0x51598d,_0xd847('0x1d0'),_0x59b579['predictiveIntervalErlangCallsDroppedCalls'],'startProgressive',_0x59b579[_0xd847('0x41')]);}else if(!ifInterval(_0x59b579[_0xd847('0x1c9')],_0x59b579[_0xd847('0x29')])&&_[_0xd847('0x3e')](_0x59b579[_0xd847('0x28')])&&!_[_0xd847('0x3e')](_0x59b579[_0xd847('0x29')])){_0x59b579['startPredictive']=moment()[_0xd847('0x78')](_0xd847('0xff'));loggerPredictive[_0xd847('0x7b')](_0x59b579[_0xd847('0x41')],_0xd847('0x1d1'),_0x59b579[_0xd847('0x28')]);this['averageHandleTime'](_0x59b579['dialPredictiveInterval'])[_0xd847('0xb7')](this[_0xd847('0x1d2')](_0x59b579))[_0xd847('0xb7')](mergeDataErlangB(_0x59b579))['then'](this['startMethodPredictive'](_0x59b579))[_0xd847('0xb1')](loggerCatchPredictive(_0xd847('0x1d3'),_0x59b579));}else if(!ifInterval(_0x59b579['dialPredictiveInterval'],_0x59b579[_0xd847('0x28')])){_0x59b579[_0xd847('0x6d')]=0x0;_0x59b579[_0xd847('0x28')]=moment()['format'](_0xd847('0xff'));loggerPredictive[_0xd847('0x7b')](_0x59b579[_0xd847('0x41')],_0xd847('0x1d4'),_0x59b579['startPredictive']);clearInterval(_0x59b579[_0xd847('0x91')]);_0x59b579[_0xd847('0x91')]=undefined;this[_0xd847('0xbc')](_0x59b579[_0xd847('0x1c9')])['then'](this[_0xd847('0x1d2')](_0x59b579))[_0xd847('0xb7')](mergeDataErlangB(_0x59b579))[_0xd847('0xb7')](this[_0xd847('0x1d5')](_0x59b579))[_0xd847('0xb1')](loggerCatchPredictive(_0xd847('0x1d6'),_0x59b579));}else if(_0x59b579['predictiveIntervalAvailable']&&_0x53892f<_0x59b579[_0xd847('0x70')]-_0x32d3bd){freeVariablesPredictive(_0x59b579);loggerPredictive['info'](_0x59b579[_0xd847('0x41')],'switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',_0x53892f,')\x20are\x20less\x20than\x20threshold\x20(',_0x59b579[_0xd847('0x70')],'-',_0x32d3bd,'=',_0x59b579[_0xd847('0x70')]-_0x32d3bd,')');}else if(_0x59b579[_0xd847('0x70')]&&_0x53892f>_0x59b579[_0xd847('0x70')]+_0x24b2b9){freeVariablesPredictive(_0x59b579);loggerPredictive[_0xd847('0x7b')](_0x59b579[_0xd847('0x41')],_0xd847('0x1d7'),_0x53892f,_0xd847('0x1d8'),_0x59b579[_0xd847('0x70')],'+',_0x24b2b9,'=',_0x59b579[_0xd847('0x70')]+_0x24b2b9,')');}};Dialer[_0xd847('0x1b')][_0xd847('0x1d2')]=function(_0x476bb4){var _0x3821f5=this;return function(_0x441923){return new BPromise(function(_0x406a1e,_0x3eb3d7){_[_0xd847('0x8d')](_0x476bb4,_0x441923[0x0]);if(checkGetDataPredictive(_0x441923[0x0])){var _0x1b6f46=_0x476bb4['predictiveIntervalAvailable']=_0x476bb4[_0xd847('0x55')]+_0x476bb4[_0xd847('0x50')];var _0x2c4517=_0x476bb4['dialPredictiveInterval']*0x3c;var _0x59f6d3=_0x441923[0x0]['predictiveIntervalAvgTalktime']+_0x441923[0x0]['predictiveIntervalAvgHoldtime'];var _0x474099=(_0x441923[0x0][_0xd847('0x7e')]+_0x441923[0x0][_0xd847('0x80')]+_0x441923[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x441923[0x0]['predictiveIntervalTotalCalls'];_0x476bb4[_0xd847('0x6e')]=_0x474099>0x0?_0x474099:0x1;switch(_0x476bb4[_0xd847('0x1cb')]){case _0xd847('0x1ce'):var _0x848126=_0x476bb4[_0xd847('0x1c2')]/0x64;return _0x3821f5[_0xd847('0x1d9')](_0x1b6f46,_0x2c4517,_0x59f6d3,_0x474099,_0x848126)['then'](function(_0x103360){return _0x406a1e(_0x103360);});case'agentBusyFactor':var _0xc67065=_0x476bb4[_0xd847('0x1c2')]/0x64;return _0x3821f5[_0xd847('0x1da')](_0x1b6f46,_0x2c4517,_0x59f6d3,_0x474099,_0xc67065)[_0xd847('0xb7')](function(_0x2f7309){return _0x406a1e(_0x2f7309);});default:return _0x3eb3d7(msgResponse('[getDataPredictive]',_0xd847('0x141'),_0xd847('0x1db')));}}else{return _0x3eb3d7(msgResponse(_0xd847('0x1dc'),'Failure','check\x20failure'));}});};};Dialer[_0xd847('0x1b')][_0xd847('0x1dd')]=function(_0x2e4d33){var _0x5352a4=this;return function(_0x12db2e){return new BPromise(function(_0x441987,_0x1a70c3){_[_0xd847('0x8d')](_0x2e4d33,_0x12db2e[0x0]);if(checkGetDataPredictive(_0x12db2e[0x0])){loggerPredictive[_0xd847('0x7b')](JSON[_0xd847('0x75')](_0x12db2e[0x0]));if(_0x2e4d33[_0xd847('0x1cb')]==='dropRate'){return _0x5352a4[_0xd847('0xc7')](_0x2e4d33['id'])['then'](function(_0x1ded8b){var _0x53cfe8=_0x2e4d33[_0xd847('0x51')]-_0x1ded8b[0x0][_0xd847('0x1de')];var _0x6a2df8=_0x2e4d33[_0xd847('0x1c9')]*0x3c;var _0x3dc1da=_0x12db2e[0x0][_0xd847('0x6a')]+_0x12db2e[0x0][_0xd847('0x69')];var _0x4d435d=(_0x12db2e[0x0]['predictiveIntervalAnsweredCalls']+_0x12db2e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x12db2e[0x0][_0xd847('0x6b')])/_0x12db2e[0x0][_0xd847('0x71')];var _0x528142=_0x2e4d33[_0xd847('0x1c2')]/0x64;_0x2e4d33['predictiveIntervalPauses']=_0x1ded8b[0x0]['outboundQueuePauses']||0x0;_0x2e4d33[_0xd847('0x6e')]=_0x4d435d>0x0?_0x4d435d:0x1;return _0x5352a4[_0xd847('0x1d9')](_0x53cfe8,_0x6a2df8,_0x3dc1da,_0x4d435d,_0x528142);})[_0xd847('0xb7')](function(_0x3d8167){return _0x441987(_0x3d8167);})[_0xd847('0xb1')](function(_0x483c18){return _0x1a70c3(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x483c18)));});}if(_0x2e4d33['dialPredictiveOptimization']===_0xd847('0x1df')){return _0x5352a4['getVoiceQueueRtPauses'](_0x2e4d33['id'])[_0xd847('0xb7')](function(_0x416847){var _0x5907a2=_0x2e4d33[_0xd847('0x51')]-_0x416847[0x0][_0xd847('0x1de')];var _0x1098ba=_0x2e4d33[_0xd847('0x1c9')]*0x3c;var _0x520561=_0x12db2e[0x0]['predictiveIntervalAvgTalktime']+_0x12db2e[0x0]['predictiveIntervalAvgHoldtime'];var _0x24a4ec=(_0x12db2e[0x0]['predictiveIntervalAnsweredCalls']+_0x12db2e[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x12db2e[0x0][_0xd847('0x6b')])/_0x12db2e[0x0][_0xd847('0x71')];var _0x4e34e2=_0x2e4d33[_0xd847('0x1c2')]/0x64;_0x2e4d33['predictiveIntervalPauses']=_0x416847[0x0][_0xd847('0x1de')]||0x0;_0x2e4d33[_0xd847('0x6e')]=_0x24a4ec>0x0?_0x24a4ec:0x1;return _0x5352a4[_0xd847('0x1da')](_0x5907a2,_0x1098ba,_0x520561,_0x24a4ec,_0x4e34e2);})[_0xd847('0xb7')](function(_0x280da3){return _0x441987(_0x280da3);})[_0xd847('0xb1')](function(_0x436a23){return _0x1a70c3(msgResponse('[CatchErlangB]','Failure',JSON['stringify'](_0x436a23)));});}}else{return _0x1a70c3(msgResponse('[getDataPredictive]',_0xd847('0x141'),_0xd847('0x1e0')));}});};};Dialer[_0xd847('0x1b')][_0xd847('0x1d5')]=function(_0x4ec612){var _0x1c9004=this;return function(){var _0x37d3c4=0x0;var _0xae09a2=Math[_0xd847('0x1c6')](_0x4ec612[_0xd847('0x8b')]*0x3e8);if(_0xae09a2>0x0){_0xae09a2=_0xae09a2<0x64?0x64:_0xae09a2;loggerPredictive[_0xd847('0x7b')](_0x4ec612[_0xd847('0x41')],_0xd847('0x1e1'),_0xae09a2,_0xd847('0x8e'));_0x4ec612['handlePredictive']=setInterval(function(){_0x1c9004[_0xd847('0x91')](_0x4ec612);loggerPredictiveCalls[_0xd847('0x7b')](_0xd847('0x1e2'),_0x37d3c4+=0x1);},_0xae09a2);}else{loggerPredictive[_0xd847('0x7b')](_0x4ec612[_0xd847('0x41')],_0xd847('0x1e3'));}};};Dialer['prototype'][_0xd847('0x1e4')]=function(_0x3df437,_0x4b2083){var _0x54e09e=this;return function(_0x3006fc){if(_[_0xd847('0x48')](_0x3006fc)){if(_[_0xd847('0xdf')](_0x4b2083[_0xd847('0x1e5')])||!_0x4b2083[_0xd847('0x1e6')]){if(_0x3df437[_0xd847('0x5a')]===_0xd847('0x8')){_0x3df437['queueStatusComplete']=_['isUndefined'](_0x3df437[_0xd847('0x129')])?!![]:_0x3df437['queueStatusComplete'];var _0x481b2b=uuid['v4']();_0x54e09e[_0xd847('0xac')][_0x481b2b]=new Action(_0x3df437,_0x4b2083,_0x481b2b);loggerBooked[_0xd847('0x7b')](_0xd847('0x1e7'),_0x481b2b,_0xd847('0x1e8'),JSON[_0xd847('0x75')](_0x3df437[_0xd847('0x129')]),_0xd847('0x1e9'),_0x3df437[_0xd847('0x41')]);if(_0x3df437[_0xd847('0x129')]){_0x3df437['queueStatusComplete']=![];_0x54e09e['queueBooked'][_0x54e09e[_0xd847('0xac')][_0x481b2b][_0xd847('0xb3')]]=[];ami[_0xd847('0xae')]({'actionid':_0x481b2b,'action':_0xd847('0x1ea'),'queue':_0x3df437[_0xd847('0x41')]})['catch'](function(){_0x54e09e[_0xd847('0xb2')](_0x3df437);_0x54e09e[_0xd847('0xbe')]({'active':![],'ContactId':_0x54e09e[_0xd847('0xac')][_0x481b2b][_0xd847('0xd3')],'ListId':_0x54e09e[_0xd847('0xac')][_0x481b2b][_0xd847('0xd4')],'VoiceQueueId':_0x54e09e['actions'][_0x481b2b][_0xd847('0xd5')]||undefined,'CampaignId':_0x54e09e[_0xd847('0xac')][_0x481b2b]['CampaignId']||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x1eb')));delete _0x54e09e[_0xd847('0xac')][_0x481b2b];});}else{loggerBooked[_0xd847('0x7b')](_0xd847('0x1ec'),JSON[_0xd847('0x75')](_0x3df437[_0xd847('0x129')]),_0xd847('0x1e9'),_0x3df437['name']);_0x54e09e[_0xd847('0xb2')](_0x3df437);_0x54e09e['rescheduleContact']({'active':![],'ContactId':_0x54e09e['actions'][_0x481b2b][_0xd847('0xd3')],'ListId':_0x54e09e[_0xd847('0xac')][_0x481b2b]['ListId'],'VoiceQueueId':_0x54e09e[_0xd847('0xac')][_0x481b2b][_0xd847('0xd5')]||undefined,'CampaignId':_0x54e09e[_0xd847('0xac')][_0x481b2b][_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x1eb')));delete _0x54e09e[_0xd847('0xac')][_0x481b2b];}}else{return _0x54e09e[_0xd847('0x15d')](_0x3df437,_0x4b2083);}}else{if(getDiff(_0x4b2083['scheduledat'])<_0x3df437[_0xd847('0x1ed')]*0x3c){if(_0x4b2083[_0xd847('0x1ee')]&&!_0x4b2083['Agent'][_0xd847('0x1ef')]){_0x54e09e[_0xd847('0x1f')]['run'](_0x4b2083['id'])[_0xd847('0x1d')](function(){_0x54e09e[_0xd847('0xb2')](_0x3df437);});}else{_0x54e09e[_0xd847('0xc0')]({'active':![]},_0x4b2083['id'],0x1)[_0xd847('0x1d')](function(){_0x54e09e[_0xd847('0xb2')](_0x3df437);});}}else{_0x3df437[_0xd847('0x66')]+=0x1;_0x54e09e['updateOriginated'](_0x3df437);if(_0x3df437['dialRecallInQueue']){_0x54e09e['rescheduleContact']({'active':![],'recallme':![],'UserId':null,'ContactId':_0x4b2083['ContactId'],'ListId':_0x4b2083[_0xd847('0xd4')],'VoiceQueueId':_0x4b2083[_0xd847('0xd5')]||undefined,'CampaignId':_0x4b2083[_0xd847('0xd6')]||undefined})[_0xd847('0xb1')](loggerCatch(_0xd847('0x1f0')));_0x54e09e[_0xd847('0xcb')](createObjHistory(_0x3df437,_0x4b2083,'RECALLINQUEUE',0x17,_0xd847('0x1f1')))[_0xd847('0xb1')](loggerCatch(_0xd847('0x1f2')));}else{_0x54e09e[_0xd847('0xd1')](createObjHistory(_0x3df437,_0x4b2083,'RECALLFAILEDTIMEOUT',0x16,'RecallFailedTimeout'),_0xd847('0x1f3'),'[Originate][HistoryRecallClose]');}}}}else{_0x3df437[_0xd847('0x60')]+=0x1;_0x54e09e[_0xd847('0xd1')](createObjHistory(_0x3df437,_0x4b2083,'BLACKLIST',0xd,_0xd847('0x1f4')),_0xd847('0x1f5'),'[Originate][MoveBlacklist]');throw _0xd847('0x1f6');}};};Dialer[_0xd847('0x1b')][_0xd847('0x1f7')]=function(_0xef04ce){var _0x5b90c3=this;var _0x483ecb=_0xef04ce[_0xd847('0x1f8')]-_0xef04ce[_0xd847('0x9a')]-_0xef04ce[_0xd847('0xc3')];emitCampaignSummary(_0xef04ce);if(_0x483ecb>0x0){if(_0x483ecb>this['maxNumberOriginate']){_0x483ecb=this[_0xd847('0x24')];}_0xef04ce[_0xd847('0xc3')]+=_0x483ecb;this[_0xd847('0xc5')](_0xef04ce['id'],_0x483ecb,_0xef04ce[_0xd847('0x1f9')],_0xef04ce)[_0xd847('0xb7')](function(_0xf10b73){_0xef04ce[_0xd847('0xc3')]-=_0x483ecb;_0xef04ce[_0xd847('0xc3')]=_0xef04ce['temp']>0x0?_0xef04ce[_0xd847('0xc3')]:0x0;if(!checkContactEmpty(_0xf10b73)){_0xef04ce[_0xd847('0x3f')]=_0xd847('0x9f');logger[_0xd847('0x7b')]('[getContactCampaign2][Empty]'+_0xef04ce['name']);}else{_0xef04ce[_0xd847('0x9a')]+=_0xf10b73['length'];_0xef04ce[_0xd847('0x3f')]=_0xd847('0x1fa');for(var _0x44655c=0x0;_0x44655c<_0xf10b73[_0xd847('0x12e')];_0x44655c+=0x1){_0xef04ce[_0xd847('0x1fb')]+=0x1;if(_[_0xd847('0xdf')](_0xf10b73[_0x44655c])||_[_0xd847('0xdf')](_0xf10b73[_0x44655c][_0xd847('0x161')])||_[_0xd847('0xdf')](_0xf10b73[_0x44655c][_0xd847('0x161')][_0xd847('0x162')])){_0x5b90c3['emptyContact']('[actionOriginate]\x20',_0xef04ce,_0xf10b73[_0x44655c]);}else{_0x5b90c3[_0xd847('0xbb')](_[_0xd847('0xd2')](_0xf10b73[_0x44655c],['CampaignId',_0xd847('0x1fc')]))[_0xd847('0xb7')](_0x5b90c3[_0xd847('0x1e4')](_0xef04ce,_0xf10b73[_0x44655c]))[_0xd847('0xb1')](_0x5b90c3[_0xd847('0xcf')](_0xd847('0x1fd'),_0xef04ce));}}}})[_0xd847('0xb1')](loggerGetContactDialer('[getContactCampaign2]',_0xef04ce,_0x483ecb));}};Dialer[_0xd847('0x1b')]['handlePower']=function(_0x2c2ce1,_0x3846dd){var _0x212100=this;var _0x29c493=[];var _0x46f598=_0x3846dd>=0x1?_0x3846dd:0x1;if(_0x2c2ce1['dialMethod']===_0xd847('0x8')){_0x46f598=0x1;}var _0x417eba=Math[_0xd847('0x1c6')](_0x2c2ce1[_0xd847('0x50')]*_0x46f598)-_0x2c2ce1[_0xd847('0x9a')]-_0x2c2ce1[_0xd847('0xc3')];emitVoiceQueueSummary(_0x2c2ce1);if(_0x2c2ce1['dialLimitQueue']>0x0){var _0x394c78=_0x2c2ce1[_0xd847('0x1fe')]-_0x2c2ce1[_0xd847('0x9a')]-_0x2c2ce1[_0xd847('0x55')]-_0x2c2ce1[_0xd847('0xc3')]-_0x2c2ce1[_0xd847('0x52')];if(_0x417eba>_0x394c78){_0x417eba=_0x394c78;}}if(_0x417eba>0x0){if(_0x2c2ce1['dialMethod']===_0xd847('0x8')){_0x417eba=0x1;}if(_0x417eba>this['maxNumberOriginate']){_0x417eba=this[_0xd847('0x24')];}_0x2c2ce1[_0xd847('0xc3')]+=_0x417eba;for(var _0x2b6966 in this[_0xd847('0x22')]){if(typeof this[_0xd847('0x22')][_0x2b6966]!==_0xd847('0x99')){if(this[_0xd847('0x22')][_0x2b6966]['state']===_0xd847('0x1ff')&&this['agents'][_0x2b6966][_0xd847('0xaf')]===_0xd847('0xdc')){_0x29c493[_0xd847('0x127')](this['agents'][_0x2b6966]['id']);}}}this[_0xd847('0xc2')](_0x2c2ce1['id'],_0x29c493,_0x417eba,_0x2c2ce1[_0xd847('0x1f9')],_0x2c2ce1)[_0xd847('0xb7')](function(_0x2a59a4){_0x2c2ce1[_0xd847('0xc3')]-=_0x417eba;_0x2c2ce1['temp']=_0x2c2ce1[_0xd847('0xc3')]>0x0?_0x2c2ce1['temp']:0x0;if(!checkContactEmpty(_0x2a59a4)){_0x212100[_0xd847('0xb5')](_0x2c2ce1)[_0xd847('0xb7')](sendMessageReschedule(_0x2c2ce1))[_0xd847('0xb1')](loggerCatch(_0xd847('0xb8')));}else{_0x2c2ce1[_0xd847('0x9a')]+=_0x2a59a4[_0xd847('0x12e')];_0x2c2ce1[_0xd847('0x3f')]=_0x2c2ce1[_0xd847('0x5a')]==='booked'?'ACTIVE':_0xd847('0x1fa');for(var _0x586646=0x0;_0x586646<_0x2a59a4[_0xd847('0x12e')];_0x586646+=0x1){if(_[_0xd847('0xdf')](_0x2a59a4[_0x586646])||_[_0xd847('0xdf')](_0x2a59a4[_0x586646][_0xd847('0x161')])||_[_0xd847('0xdf')](_0x2a59a4[_0x586646][_0xd847('0x161')][_0xd847('0x162')])){_0x212100[_0xd847('0xd0')](_0xd847('0x200'),_0x2c2ce1,_0x2a59a4[_0x586646]);}else{_0x212100[_0xd847('0xb9')](_[_0xd847('0xd2')](_0x2a59a4[_0x586646],[_0xd847('0xd5'),_0xd847('0x1fc')]))['then'](_0x212100['checkContactBlack'](_0x2c2ce1,_0x2a59a4[_0x586646]))['catch'](_0x212100[_0xd847('0xcf')](_0xd847('0x200'),_0x2c2ce1));}}}})[_0xd847('0xb1')](loggerGetContactDialer(_0xd847('0x201'),_0x2c2ce1,_0x417eba));}};Dialer[_0xd847('0x1b')][_0xd847('0x91')]=function(_0x5c23c9){if(_0x5c23c9[_0xd847('0x1fe')]>0x0){var _0x7e2ba8=_0x5c23c9[_0xd847('0x1fe')]-_0x5c23c9['originated']-_0x5c23c9[_0xd847('0x55')];if(_0x7e2ba8>0x0){this[_0xd847('0x202')](_0x5c23c9);}else{loggerPredictiveCalls[_0xd847('0x7b')](_0xd847('0x203'));}}else{this[_0xd847('0x202')](_0x5c23c9);}};Dialer[_0xd847('0x1b')][_0xd847('0x202')]=function(_0x135813){var _0xd55526=this;var _0x44be49=[];_0x135813['originated']+=0x1;for(var _0x4a12b0 in this[_0xd847('0x22')]){if(typeof this[_0xd847('0x22')][_0x4a12b0]!==_0xd847('0x99')){if(this[_0xd847('0x22')][_0x4a12b0][_0xd847('0xe7')]===_0xd847('0x1ff')&&this['agents'][_0x4a12b0][_0xd847('0xaf')]===_0xd847('0xdc')){_0x44be49[_0xd847('0x127')](this['agents'][_0x4a12b0]['id']);}}}this[_0xd847('0xc2')](_0x135813['id'],_0x44be49,0x1,_0x135813[_0xd847('0x1f9')],_0x135813)[_0xd847('0xb7')](function(_0xcf689d){if(!checkContactEmpty(_0xcf689d)){checkContactLowerLimitOriginate(_0x135813,0x1,0x0);_0xd55526['countReScheduled'](_0x135813)[_0xd847('0xb7')](sendMessageReschedule(_0x135813))[_0xd847('0xb1')](loggerCatch(_0xd847('0xb8')));}else{_0x135813[_0xd847('0x3f')]='RUNNING';if(_[_0xd847('0xdf')](_0xcf689d[0x0])||_['isNil'](_0xcf689d[0x0]['Contact'])||_['isNil'](_0xcf689d[0x0][_0xd847('0x161')][_0xd847('0x162')])){_0xd55526[_0xd847('0xd0')]('[actionOriginate]\x20',_0x135813,_0xcf689d[0x0]);}else{_0xd55526[_0xd847('0xb9')](_[_0xd847('0xd2')](_0xcf689d[0x0],[_0xd847('0xd5'),_0xd847('0x1fc')]))[_0xd847('0xb7')](_0xd55526[_0xd847('0x1e4')](_0x135813,_0xcf689d[0x0]))[_0xd847('0xb1')](_0xd55526[_0xd847('0xcf')](_0xd847('0x204'),_0x135813));}}})[_0xd847('0xb1')](loggerGetContactDialer(_0xd847('0x205'),_0x135813,0x1));emitVoiceQueueSummary(_0x135813);};Dialer[_0xd847('0x1b')][_0xd847('0x1d9')]=function(_0x77f8ff,_0xcf8503,_0x168a69,_0x458add,_0x260cee,_0x23cb01){loggerPredictive['info'](_0xd847('0x206'));loggerPredictive[_0xd847('0x7b')]('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',_0x77f8ff);loggerPredictive[_0xd847('0x7b')](_0xd847('0x207'),_0xcf8503);loggerPredictive[_0xd847('0x7b')](_0xd847('0x208'),_0x168a69);loggerPredictive[_0xd847('0x7b')]('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',_0x458add);loggerPredictive[_0xd847('0x7b')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x260cee);loggerPredictive[_0xd847('0x7b')](_0xd847('0x84'));return new BPromise(function(_0x4c60bf,_0xfe756b){if(_0x77f8ff<=0x0||isNaN(_0x77f8ff)){return _0xfe756b(msgResponse(_0xd847('0x209'),_0xd847('0x4a'),_0xd847('0x20a')+_0x77f8ff));}if(_0x168a69<=0x0||isNaN(_0x168a69)){return _0xfe756b(msgResponse(_0xd847('0x209'),_0xd847('0x4a'),_0xd847('0x20b')+_0x168a69));}if(_0x458add<=0x0||isNaN(_0x458add)){return _0xfe756b(msgResponse('[abandonmentRate]','Error','p\x20=\x20'+_0x458add));}if(_0xcf8503<=0x0||isNaN(_0xcf8503)){return _0xfe756b(msgResponse(_0xd847('0x209'),'Error','interval\x20=\x20'+_0xcf8503));}if(_0x260cee<=0x0||isNaN(_0x260cee)){return _0xfe756b(msgResponse(_0xd847('0x209'),_0xd847('0x4a'),_0xd847('0x20c')+_0x260cee));}_0x23cb01=_0x23cb01||0x0;var _0x3bddf9=0x1/_0x168a69;var _0x4d0f19=0x0;var _0x123b4e=0x0;var _0x381441=0x0;var _0x562866=0x0;for(var _0x3f173d=0x0;_0x381441<_0x260cee;_0x3f173d+=0x1){_0x123b4e=_0x3f173d/_0xcf8503;_0x4d0f19=(_0x458add*_0x123b4e+_0x23cb01)/_0x3bddf9;_0x381441=erlangb(_0x4d0f19,_0x77f8ff);_0x562866=_0x4d0f19/_0x77f8ff*(0x1-erlangb(_0x4d0f19,_0x77f8ff));}return _0x4c60bf({'erlangCalls':_0x3f173d,'erlangCallToSecond':_0xcf8503/_0x3f173d,'erlangAbandonmentRate':_0x381441,'erlangBusyFactor':_0x562866});});};Dialer[_0xd847('0x1b')][_0xd847('0x1da')]=function(_0xc301ea,_0x5d49ed,_0x25238d,_0xf1cd3d,_0x212e06,_0xa236f2){loggerPredictive['info'](_0xd847('0x20d'));loggerPredictive[_0xd847('0x7b')](_0xd847('0x20e'),_0xc301ea);loggerPredictive[_0xd847('0x7b')](_0xd847('0x207'),_0x5d49ed);loggerPredictive[_0xd847('0x7b')](_0xd847('0x208'),_0x25238d);loggerPredictive[_0xd847('0x7b')](_0xd847('0x20f'),_0xf1cd3d);loggerPredictive[_0xd847('0x7b')]('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x212e06);loggerPredictive[_0xd847('0x7b')](_0xd847('0x84'));return new BPromise(function(_0x519f5a,_0x3cd01a){if(_0xc301ea<=0x0||isNaN(_0xc301ea)){return _0x3cd01a(msgResponse('[busyFactor]',_0xd847('0x4a'),_0xd847('0x20a')+_0xc301ea));}if(_0x25238d<=0x0||isNaN(_0x25238d)){return _0x3cd01a(msgResponse(_0xd847('0x210'),'Error',_0xd847('0x20b')+_0x25238d));}if(_0xf1cd3d<=0x0||isNaN(_0xf1cd3d)){return _0x3cd01a(msgResponse(_0xd847('0x210'),_0xd847('0x4a'),_0xd847('0x211')+_0xf1cd3d));}if(_0x5d49ed<=0x0||isNaN(_0x5d49ed)){return _0x3cd01a(msgResponse(_0xd847('0x210'),_0xd847('0x4a'),_0xd847('0x212')+_0x5d49ed));}if(_0x212e06<=0x0||isNaN(_0x212e06)){return _0x3cd01a(msgResponse(_0xd847('0x210'),_0xd847('0x4a'),'Umin\x20=\x20'+_0x212e06));}_0xa236f2=_0xa236f2||0x0;var _0x196425=0x1/_0x25238d;var _0x5be358=0x0;var _0x725a6b=0x0;var _0x270b93=0x0;var _0x53c9bf=0x0;for(var _0x7669fb=0x0;_0x53c9bf<_0x212e06;_0x7669fb+=0x1){_0x725a6b=_0x7669fb/_0x5d49ed;_0x5be358=(_0xf1cd3d*_0x725a6b+_0xa236f2)/_0x196425;_0x270b93=erlangb(_0x5be358,_0xc301ea);_0x53c9bf=_0x5be358/_0xc301ea*(0x1-erlangb(_0x5be358,_0xc301ea));}return _0x519f5a({'erlangCalls':_0x7669fb,'erlangCallToSecond':_0x5d49ed/_0x7669fb,'erlangAbandonmentRate':_0x270b93,'erlangBusyFactor':_0x53c9bf});});};module['exports']=Dialer; \ No newline at end of file +var _0xeea4=['Trunk','active','callerid','stringify','voice:queue:%s','ivr','format','campaign:ivr:%s','info','-----\x20Stats\x20Predictive\x20---','Total\x20Calls:\x20\x20\x20\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','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','---------------------------','isUndefined','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','merge','clearing\x20variable\x20start\x20progressive','clearing\x20variable\x20start\x20predictive','handlePredictive','string','\x22%s\x22\x20<%s>','\x22\x22\x20<>','error','stack','inspect','originated','undefined','[decremetOriginate]\x20object\x20originated\x20is\x20negative','contactsRescheduled','RESCHEDULED_CONTACTS','contacts','AVAILABLE_CONTACTS_FINISHED','[getContactDialer2][Empty]','pTalking','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Queue:\x20','is\x20not\x20active','is\x20disactive','IS_DISACTIVED','state','statedesc','endtime','starttime','loopClearZombieChannels','clearZombieChannels','uniqueId','[uniqueid]','[actions]','isNil','channel','No\x20such\x20channel','queue','[Dialer][checkChannel]','updateOriginated','[Dialer][checkChannel][ivr]','countReScheduled','then','catch','[countReScheduled]\x20','checkIsBlackList','resolve','[checkIsBlackList]\x20','checkIsBlackListIvr','[checkIsBlackListIvr]\x20','averageHandleTime','avgHandleTime','rescheduleContact','[rescheduleContact]\x20','unlockContact','[unlockContact]\x20','getContactDialer','temp','[getContactDialer]\x20','getContactDialerIvr','[getContactDialerIvr]\x20','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','moveContactManagedDialer','[moveContactManagedDialer]\x20','createHistory','[createHistory]\x20','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','notFound','saveInDb','ListId','UserId','VoiceQueueId','CampaignId','[emptyContact][createHistory]','[emptyContact]','isSuccess','isTrunkReachable','SIP/%s','status','reachable','unmonitored','variable','amdstatus','exten','dialAMDActive','value','uniqueid','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','HangupInAMD','AMD','amd','[syncHangupInAMD][createHistory]','Machine','membername','countmachineretry','custom:amd','countbusyretry','countnoanswerretry','dialGlobalMaxRetry','createStateFinal','add','dialMachineRetryFrequency','minutes','YYYY-MM-DD\x20HH:mm:ss','[rescheduleContact][Machine]','HANGUP','[syncHangupInAMDIvr][createHistory]','MACHINE','countglobal','[syncAgentComplete][createHistory][0]','countcongestionretry','countnosuchnumberretry','countdropretry','countagentrejectretry','stateGlobal','dialMachineMaxRetry','reason\x2019\x20machine....','ContactId','ivrAnswerCallsDay','AnswerAGI','AGI','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','cause-txt','Unknow','reason','[syncAgentComplete]','answertime','queueCallerAbandonCreateState','[syncAgentComplete][createHistory]','syncQueueCallerAbandon','droptime','responsetime','dialQueueTimeout','dropreason','agiafterat','dialQueueProject2','dialDropMaxRetry','dialDropRetryFrequency','Drop','calleridname','calleridnum','[syncAgentComplete][createHistory][10]','Abandoned','countabandonedretry','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','[syncAgentComplete][createHistory][11]','syncQueueMember','actionid','locked','paused','stateinterface','push','pick','idHopper','queueStatusComplete','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','length','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','run','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','[unlock3][syncQueueStatusComplete]','loopCampaigns','syncCampaigns','checkIsTrunkReachable','TRUNK_IS_NOT_REACHABLE','checkIfTime','ifTime','checkIfTimeIntervals','Intervals','\x20Intervals\x20is\x20null\x20','INTERVAL_IS_EMPTY','Failure','\x20Intervals\x20is\x20empty\x20','timezones','\x20Timezone\x20unknow\x20','isArray','command','iftime\x20%s,%s','interval','content','indexOf','true','all','some','GLOBAL_INTERVAL_IS_OVERTIME','INTERVAL_IS_OVERTIME','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','checkDialMethod','progressive','handlePower','power','dialPowerLevel','Queue','method\x20not\x20recognized','handleIvr','syncQueueSummary','dialTimezone','[syncQueueSummary]','dialGlobalInterval','launchHandleIvr','[syncCampaigns]','\x5cw{0,','pow','replace','match','object','originate','voiceQueue\x20is\x20undefine','Contact','phone','getCaller','NONE','dialAgiAfterHangupAgent','ACTIVE','xcally-motion-dialer','dialAMDGreeting','XMD-AMDAFTERGREETINGSILENCE','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','XMD-AMDMAXIMUMNUMBEROFWORDS','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','tags','createdAt','%s%s','XMD-','toUpper','dialRandomLastDigitCallerIdNumber','TrunkBackup','XMD-ORIGINATECALLERIDNAME','originatecalleridname','originatecalleridnum','Action','SIP/%s/%s%s','dialCutDigit','substring','from-sip','[originateError]:\x20%s','OriginateError','[originate][error]','Error','originate\x20action\x20Error','syncOriginateResponse','response','callProgressDetecting','[callProgressDetecting]\x20','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','[rescheduleContact][NoAnswer]','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','[rescheduleContact][Abandoned]','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','NoSuchNumber','custom:agentnosuchnumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','buildObj','noanswer','reason\x203\x20ringing\x20no\x20answer','custom:agentbusy','busy','reason\x205\x20busy','custom:agentcongestion','congestion','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','AgentReject','dialAgentRejectMaxRetry','reason\x2020\x20agentreject','Global','Success','contact\x20not\x20moved','round','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveInterval','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]','Max\x20Drop\x20','started\x20in\x20predictive\x20at','getDataPredictive','recalculate\x20predictive\x20at','startMethodPredictive','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20more\x20than\x20threshold\x20(','dialPredictiveOptimizationPercentage','abandonmentRate','busyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','outboundQueuePauses','[CatchErlangB]','agentBusyFactor','one\x20call\x20every:','[handlePredictive]','fail\x20to\x20scheduled\x20calls','checkContactBlack','[booked][checkContactBlack]','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','actionOriginate','dialRecallMeTimeout','Agent','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','RECALLINQUEUE','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RECALLFAILEDTIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','BLACKLIST','Blacklist','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','not_inuse','dialOrderByScheduledAt','Contact.phone','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','[actionOriginatePredictive]\x20','--------\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','m\x20=\x20','p\x20=\x20','interval\x20=\x20','[abandonmentRate]','Amax\x20=\x20','[busyFactor]','Umin\x20=\x20','exports','util','lodash','bluebird','uuid','moment','md5','ioredis','../preview/util/util','../../../config/environment/','dialer','booked','../../../config/logger','predictive','predictiveCalls','../ami','redis','defaults','socket.io-emitter','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','./action','./history','./final','./agentComplete','env','XCALLY_IP_AGI','127.0.0.1','rrmemory','roundrobin','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','optionPredictive','startPredictive','startProgressive','ivrOriginated','queueBooked','syncAgentConnect','bind','originateresponse','syncAgentComplete','custom:queuesummary','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','queuestatuscomplete','syncQueueStatusComplete','message','name','\x20AGENTS\x20NOT\x20LOGGED','NOT_ACTIVE','Interval','INTERVAL_IS_NULL','\x20INTERVAL_IS_NULL','isEmpty','[ifTime][Action]','milliseconds','diff','seconds','emit','type','outbound','strategy','answered','available','loggedIn','sumBillable','sumDuration','sumHoldTime','talking','unmanaged','waiting','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundRejectCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangBusyFactor'];(function(_0x34a8c8,_0x31e259){var _0x1fe6e5=function(_0x30f28d){while(--_0x30f28d){_0x34a8c8['push'](_0x34a8c8['shift']());}};_0x1fe6e5(++_0x31e259);}(_0xeea4,0x19e));var _0x4eea=function(_0x5df4df,_0x485c6d){_0x5df4df=_0x5df4df-0x0;var _0x2eafb2=_0xeea4[_0x5df4df];return _0x2eafb2;};'use strict';var util=require(_0x4eea('0x0'));var _=require(_0x4eea('0x1'));var BPromise=require(_0x4eea('0x2'));var uuid=require(_0x4eea('0x3'));var moment=require(_0x4eea('0x4'));var rr=require('rr');var md5=require(_0x4eea('0x5'));var Redis=require(_0x4eea('0x6'));var ut=require(_0x4eea('0x7'));var config=require(_0x4eea('0x8'));var logger=require('../../../config/logger')(_0x4eea('0x9'));var loggerBooked=require('../../../config/logger')(_0x4eea('0xa'));var loggerPredictive=require(_0x4eea('0xb'))(_0x4eea('0xc'));var loggerPredictiveCalls=require('../../../config/logger')(_0x4eea('0xd'));var loggerSyncQueueSummary=require(_0x4eea('0xb'))('syncQueueSummary');var ami=require(_0x4eea('0xe'));config[_0x4eea('0xf')]=_[_0x4eea('0x10')](config[_0x4eea('0xf')],{'host':'localhost','port':0x18eb});var io=require(_0x4eea('0x11'))(new Redis(config[_0x4eea('0xf')]));var cmHopper=require(_0x4eea('0x12'));var cmHopperHistory=require(_0x4eea('0x13'));var cmHopperBlack=require(_0x4eea('0x14'));var voiceQueueRt=require(_0x4eea('0x15'));var Action=require(_0x4eea('0x16'));var History=require(_0x4eea('0x17'));var Final=require(_0x4eea('0x18'));var AgentComplete=require(_0x4eea('0x19'));var QueueCallerAbandon=require('./queueCallerAbandon');var Hangup=require('./hangup');var ipAgi=process[_0x4eea('0x1a')][_0x4eea('0x1b')]||_0x4eea('0x1c');var strategy={'rrmemory':_0x4eea('0x1d'),'roundrobin':_0x4eea('0x1e')};var Sequence=function(){};Sequence[_0x4eea('0x1f')][_0x4eea('0x20')]=function(_0x1e7353){this['tail']=this[_0x4eea('0x21')]?this[_0x4eea('0x21')][_0x4eea('0x22')](_0x1e7353):_0x1e7353();};function Dialer(_0xf78777,_0x518329){this[_0x4eea('0x23')]=new Sequence();this[_0x4eea('0x24')]=_0x518329;this[_0x4eea('0x25')]=_0xf78777[_0x4eea('0x25')];this[_0x4eea('0x26')]=_0xf78777['campaigns'];this[_0x4eea('0x27')]=_0xf78777[_0x4eea('0x27')];this['trunks']=_0xf78777[_0x4eea('0x28')];this[_0x4eea('0x29')]=config[_0x4eea('0x29')]||0x2;this[_0x4eea('0x2a')]={};this[_0x4eea('0x2b')]={};this[_0x4eea('0x2c')]={};this['uniqueId']={};this[_0x4eea('0x2d')]={};this[_0x4eea('0x2e')]={};this[_0x4eea('0x2f')]={};this[_0x4eea('0x30')]={};this[_0x4eea('0x31')]={};this['queueBookedRR']={};ami['on']('agentconnect',this[_0x4eea('0x32')]['bind'](this));ami['on']('queuecallerabandon',this['syncQueueCallerAbandon'][_0x4eea('0x33')](this));ami['on'](_0x4eea('0x34'),this['syncOriginateResponse'][_0x4eea('0x33')](this));ami['on']('agentcomplete',this[_0x4eea('0x35')]['bind'](this));ami['on'](_0x4eea('0x36'),this['syncQueueSummary'][_0x4eea('0x33')](this));ami['on'](_0x4eea('0x37'),this[_0x4eea('0x38')][_0x4eea('0x33')](this));ami['on'](_0x4eea('0x39'),this[_0x4eea('0x3a')][_0x4eea('0x33')](this));ami['on'](_0x4eea('0x3b'),this[_0x4eea('0x3c')][_0x4eea('0x33')](this));ami['on'](_0x4eea('0x3d'),this['syncQueueMember']['bind'](this));ami['on'](_0x4eea('0x3e'),this[_0x4eea('0x3f')]['bind'](this));this['loopCampaigns']();this['loopClearZombieChannels']();}function isNotNull(_0x41eb66){return _0x41eb66!==null&&!_['isUndefined'](_0x41eb66);}function checkIsLoggedIn(_0x31d9be,_0x299cf7){return function(){if(_0x299cf7<=0x0){_0x31d9be[_0x4eea('0x40')]='AGENTS_NOT_LOGGED';throw _0x31d9be[_0x4eea('0x41')]+_0x4eea('0x42');}};}function isActive(_0x2f783a){return _0x2f783a;}function checkIsActive(_0x5309ee,_0x1751ce){return function(){if(!isActive(_0x1751ce)){_0x5309ee[_0x4eea('0x40')]=_0x4eea('0x43');throw _0x5309ee['name']+'\x20NOT\x20Active';}};}function checkInterval(_0x232da0){return function(){if(!isNotNull(_0x232da0[_0x4eea('0x44')])){_0x232da0['message']=_0x4eea('0x45');throw _0x232da0[_0x4eea('0x41')]+_0x4eea('0x46');}if(!isNotNull(_0x232da0[_0x4eea('0x44')]['Intervals'])){_0x232da0[_0x4eea('0x40')]='INTERVAL_IS_NULL';throw _0x232da0[_0x4eea('0x41')]+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x4eea('0x47')](_0x232da0[_0x4eea('0x44')]['Intervals']))){_0x232da0[_0x4eea('0x40')]='INTERVAL_IS_NULL';throw _0x232da0[_0x4eea('0x41')]+_0x4eea('0x46');}};}function msgResponse(_0x4f4f3c,_0x27ac6b,_0x45c9dc){return{'action':_0x4f4f3c,'response':_0x27ac6b,'message':_0x45c9dc,'stack':_0x45c9dc};}function myreject(_0x45cf99){return function(_0x4e07db){return _0x45cf99(msgResponse(_0x4eea('0x48'),'Error',JSON['stringify'](_0x4e07db)));};}function getSeconds(_0x2cb06c,_0x267f34){var _0x2f5246=moment(_0x2cb06c)['milliseconds'](0x0);var _0x57e9b6=moment(_0x267f34)[_0x4eea('0x49')](0x0);return _0x2f5246[_0x4eea('0x4a')](_0x57e9b6,_0x4eea('0x4b'));}function emit(_0xccd06c,_0x414552,_0x484d1f){io['to'](_0xccd06c)[_0x4eea('0x4c')](_0x414552,_0x484d1f);}function emitVoiceQueueSummary(_0x43476e){if(_0x43476e[_0x4eea('0x4d')]===_0x4eea('0x4e')){var _0x17d870={'id':_0x43476e['id'],'name':_0x43476e[_0x4eea('0x41')],'strategy':_0x43476e[_0x4eea('0x4f')],'answered':_0x43476e[_0x4eea('0x50')],'available':_0x43476e[_0x4eea('0x51')],'loggedIn':_0x43476e[_0x4eea('0x52')],'pTalking':_0x43476e['pTalking'],'sumBillable':_0x43476e[_0x4eea('0x53')],'sumDuration':_0x43476e[_0x4eea('0x54')],'sumHoldTime':_0x43476e[_0x4eea('0x55')]||0x0,'talking':_0x43476e[_0x4eea('0x56')],'total':_0x43476e['total'],'type':_0x43476e['type'],'unmanaged':_0x43476e[_0x4eea('0x57')],'abandoned':_0x43476e['abandoned'],'waiting':_0x43476e[_0x4eea('0x58')],'loggedInDb':_0x43476e['loggedInDb'],'dialActive':_0x43476e[_0x4eea('0x59')],'dialMethod':_0x43476e[_0x4eea('0x5a')],'dialOriginateCallerIdName':_0x43476e[_0x4eea('0x5b')],'dialOriginateCallerIdNumber':_0x43476e[_0x4eea('0x5c')],'dialOriginateTimeout':_0x43476e[_0x4eea('0x5d')],'dialPrefix':_0x43476e[_0x4eea('0x5e')],'outboundAnswerAgiCallsDay':_0x43476e['outboundAnswerAgiCallsDay'],'outboundAnswerCallsDay':_0x43476e['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x43476e[_0x4eea('0x5f')],'outboundBusyCallsDay':_0x43476e[_0x4eea('0x60')],'outboundCongestionCallsDay':_0x43476e[_0x4eea('0x61')],'outboundDropCallsDayACS':_0x43476e[_0x4eea('0x62')],'outboundDropCallsDayCallersExit':_0x43476e[_0x4eea('0x63')],'outboundDropCallsDayTimeout':_0x43476e[_0x4eea('0x64')],'outboundNoAnswerCallsDay':_0x43476e[_0x4eea('0x65')],'outboundNoSuchCallsDay':_0x43476e[_0x4eea('0x66')],'outboundOriginateFailureCallsDay':_0x43476e[_0x4eea('0x67')],'outboundReCallsDay':_0x43476e[_0x4eea('0x68')],'outboundRejectCallsDay':_0x43476e[_0x4eea('0x69')],'outboundUnknownCallsDay':_0x43476e[_0x4eea('0x6a')],'predictiveIntervalAnsweredCalls':_0x43476e[_0x4eea('0x6b')],'predictiveIntervalAvgHoldtime':_0x43476e['predictiveIntervalAvgHoldtime'],'predictiveIntervalAvgTalktime':_0x43476e[_0x4eea('0x6c')],'predictiveIntervalDroppedCallsCallersExit':_0x43476e[_0x4eea('0x6d')],'predictiveIntervalDroppedCallsTimeout':_0x43476e[_0x4eea('0x6e')],'predictiveIntervalErlangCalls':_0x43476e[_0x4eea('0x6f')],'predictiveIntervalErlangCallsDroppedCalls':_0x43476e[_0x4eea('0x70')],'predictiveIntervalHitRate':_0x43476e[_0x4eea('0x71')],'predictiveIntervalMultiplicativeFactor':_0x43476e[_0x4eea('0x72')],'predictiveIntervalPauses':_0x43476e[_0x4eea('0x73')],'predictiveIntervalAvailable':_0x43476e[_0x4eea('0x74')],'predictiveIntervalTotalCalls':_0x43476e[_0x4eea('0x75')],'message':_0x43476e['message'],'originated':_0x43476e['originated'],'erlangCalls':_0x43476e[_0x4eea('0x76')],'erlangCallToSecond':_0x43476e[_0x4eea('0x77')],'erlangAbandonmentRate':_0x43476e['erlangAbandonmentRate'],'erlangBusyFactor':_0x43476e[_0x4eea('0x78')],'startPredictive':_0x43476e[_0x4eea('0x2e')],'startProgressive':_0x43476e[_0x4eea('0x2f')]};if(_0x43476e[_0x4eea('0x79')]){_0x17d870['Trunk']={'id':_0x43476e[_0x4eea('0x79')]['id'],'name':_0x43476e[_0x4eea('0x79')]['name'],'active':_0x43476e['Trunk'][_0x4eea('0x7a')],'callerid':_0x43476e[_0x4eea('0x79')][_0x4eea('0x7b')]};}if(_0x43476e['Interval']){_0x17d870['Interval']={'id':_0x43476e[_0x4eea('0x44')]['id'],'name':_0x43476e[_0x4eea('0x44')][_0x4eea('0x41')]};}var _0x49b789=md5(JSON[_0x4eea('0x7c')](_0x17d870));if(_0x43476e[_0x4eea('0x5')]!==_0x49b789){_0x43476e[_0x4eea('0x5')]=_0x49b789;emit(util['format'](_0x4eea('0x7d'),_0x17d870[_0x4eea('0x41')]),'voice_queue:save',_0x17d870);}}}function emitCampaignSummary(_0x3e8836){if(_0x3e8836['type']===_0x4eea('0x7e')){emit(util[_0x4eea('0x7f')](_0x4eea('0x80'),_0x3e8836[_0x4eea('0x41')]),'campaign:save',_0x3e8836);}}function checkGetDataPredictive(_0x16726d){if(isNotNull(_0x16726d)&&!_[_0x4eea('0x47')](_0x16726d)){loggerPredictive[_0x4eea('0x81')](_0x4eea('0x82'));loggerPredictive[_0x4eea('0x81')](_0x4eea('0x83'),_0x16726d['predictiveIntervalTotalCalls']);loggerPredictive['info']('Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16726d[_0x4eea('0x6b')]);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x84'),_0x16726d[_0x4eea('0x6e')]);loggerPredictive['info']('Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x16726d[_0x4eea('0x6d')]);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x85'),_0x16726d[_0x4eea('0x86')]);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x87'),_0x16726d[_0x4eea('0x6c')]);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x88'));if(_0x16726d[_0x4eea('0x75')]>0x0){if(!_[_0x4eea('0x89')](_0x16726d[_0x4eea('0x6c')])&&_0x16726d[_0x4eea('0x6c')]>0x0){return!![];}loggerPredictive[_0x4eea('0x81')](_0x4eea('0x8a'));if(!_[_0x4eea('0x89')](_0x16726d[_0x4eea('0x86')])&&_0x16726d[_0x4eea('0x86')]>0x0){return!![];}loggerPredictive['info'](_0x4eea('0x8b'));}else{loggerPredictive[_0x4eea('0x81')]('Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive');}}else{loggerPredictive[_0x4eea('0x81')](_0x4eea('0x8c'));}return![];}function mergeDataErlangB(_0x20da21){return function(_0x345bcc){loggerPredictive[_0x4eea('0x81')](_0x4eea('0x8d'));loggerPredictive['info'](_0x4eea('0x8e'),_0x345bcc[_0x4eea('0x76')]);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x8f'),_0x345bcc[_0x4eea('0x77')]);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x90'),_0x345bcc[_0x4eea('0x91')]);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x92'),_0x345bcc[_0x4eea('0x78')]);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x90'),_0x345bcc[_0x4eea('0x91')]);loggerPredictive[_0x4eea('0x81')]('---------------------------');_[_0x4eea('0x93')](_0x20da21,_0x345bcc);};}function getDiff(_0x49a6ce){var _0x6f6e50=moment()[_0x4eea('0x49')](0x0);var _0x3ce46b=moment(_0x49a6ce)[_0x4eea('0x49')](0x0);return _0x6f6e50[_0x4eea('0x4a')](_0x3ce46b,_0x4eea('0x4b'));}function ifInterval(_0x4869bf,_0xe4b515){if(_[_0x4eea('0x89')](_0xe4b515)){return![];}return getDiff(_0xe4b515)<_0x4869bf*0x3c;}function freeVariablesPredictive(_0x4f6ae4){if(isNotNull(_0x4f6ae4)){if(!_['isUndefined'](_0x4f6ae4[_0x4eea('0x2f')])){_0x4f6ae4['startProgressive']=undefined;loggerPredictive[_0x4eea('0x81')](_0x4f6ae4[_0x4eea('0x41')],_0x4eea('0x94'));}if(!_[_0x4eea('0x89')](_0x4f6ae4[_0x4eea('0x2e')])){_0x4f6ae4[_0x4eea('0x2e')]=undefined;loggerPredictive[_0x4eea('0x81')](_0x4f6ae4['name'],_0x4eea('0x95'));}if(!_[_0x4eea('0x89')](_0x4f6ae4[_0x4eea('0x96')])){clearInterval(_0x4f6ae4[_0x4eea('0x96')]);_0x4f6ae4[_0x4eea('0x96')]=undefined;loggerPredictive[_0x4eea('0x81')](_0x4f6ae4['name'],'clearing\x20variable\x20handle\x20predictive');}}}function erlangb(_0x6f4694,_0x2b0421){if(_0x2b0421===0x0){return 0x0;}var _0x476d36=0x1;for(var _0x4d2e6c=0x1;_0x4d2e6c<=_0x2b0421;_0x4d2e6c+=0x1){_0x476d36=0x1+_0x476d36*_0x4d2e6c/_0x6f4694;}return 0x1/_0x476d36;}function isVoiceQueueOutbound(_0x379b1d){return _0x379b1d===_0x4eea('0x4e');}function isNotPreview(_0x17ca5f){return _0x17ca5f!==_0x4eea('0x24');}function isCampaignIvr(_0x5d80e6){return _0x5d80e6===_0x4eea('0x7e');}function getCallerId(_0x1dfab7,_0x12476c,_0x51e718){if(!_[_0x4eea('0x89')](_0x51e718)&&typeof _0x51e718==='string'&&!_[_0x4eea('0x47')](_0x51e718)){if(!_[_0x4eea('0x89')](_0x12476c)&&typeof _0x12476c===_0x4eea('0x97')&&!_[_0x4eea('0x47')](_0x12476c)){return util['format'](_0x4eea('0x98'),_0x12476c,_0x51e718);}return util[_0x4eea('0x7f')](_0x4eea('0x98'),_0x51e718,_0x51e718);}if(!_[_0x4eea('0x89')](_0x1dfab7)&&typeof _0x1dfab7===_0x4eea('0x97')&&!_['isEmpty'](_0x1dfab7)){return _0x1dfab7;}return _0x4eea('0x99');}function loggerCatchQueueSummary(_0x2c1e1b,_0x2f7b89){return function(_0x31e85a){freeVariablesPredictive(_0x2f7b89);emitVoiceQueueSummary(_0x2f7b89);emitCampaignSummary(_0x2f7b89);loggerSyncQueueSummary[_0x4eea('0x9a')](_0x2c1e1b,util['inspect'](_0x31e85a,{'showHidden':![],'depth':null}));};}function loggerCatchPredictive(_0x18cc7f,_0x1379c5){return function(_0x281b04){loggerPredictive[_0x4eea('0x9a')](_0x1379c5[_0x4eea('0x41')],_0x18cc7f);loggerPredictive[_0x4eea('0x9a')](_0x281b04[_0x4eea('0x9b')]);freeVariablesPredictive(_0x1379c5);};}function loggerCatch(_0x2d4bee){return function(_0x1782cc){logger[_0x4eea('0x9a')](_0x2d4bee,util[_0x4eea('0x9c')](_0x1782cc,{'showHidden':![],'depth':null}));};}function checkContactEmpty(_0x275e2c){return _0x275e2c&&!_[_0x4eea('0x89')](_0x275e2c)&&_0x275e2c['length']>0x0;}function decremetOriginate(_0x5802e8){if(!_[_0x4eea('0x89')](_0x5802e8)&&_0x5802e8!==null){if(typeof _0x5802e8[_0x4eea('0x9d')]!==_0x4eea('0x9e')){if(_0x5802e8['originated']>0x0){_0x5802e8[_0x4eea('0x9d')]-=0x1;}else{logger[_0x4eea('0x9a')](_0x4eea('0x9f'));}}}else{logger[_0x4eea('0x9a')]('[decremetOriginate]\x20is\x20null\x20or\x20undefined');}}function checkContactLowerLimitOriginate(_0x31bd01,_0x4fcb96,_0x354ce7){if(_0x4fcb96>_0x354ce7){for(var _0x39d651=0x0;_0x39d651<_0x4fcb96-_0x354ce7;_0x39d651+=0x1){decremetOriginate(_0x31bd01);}}}function loggerGetContactDialer(_0x206a81,_0x80d1d5,_0x10ad37){return function(_0x4b1e0c){checkContactLowerLimitOriginate(_0x80d1d5,_0x10ad37,0x0);logger[_0x4eea('0x9a')](_0x206a81,util[_0x4eea('0x9c')](_0x4b1e0c,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5091bb){return function(_0x8254ce){if(isNotNull(_0x8254ce)&&isNotNull(_0x8254ce[0x0])){if(_0x8254ce[0x0][_0x4eea('0xa0')]>0x0){_0x5091bb['message']=_0x4eea('0xa1');logger[_0x4eea('0x81')]('[getContactDialer2][ReScheduled]'+_0x5091bb[_0x4eea('0x41')],_0x8254ce[0x0][_0x4eea('0xa0')],_0x4eea('0xa2'));}else{_0x5091bb[_0x4eea('0x40')]=_0x4eea('0xa3');logger['info'](_0x4eea('0xa4')+_0x5091bb[_0x4eea('0x41')]);}}};}function notSendMessagesQueue(_0x34790b){if(_0x34790b['sendMessageOneNotActive']){freeVariablesPredictive(_0x34790b);if(_0x34790b[_0x4eea('0x9d')]===0x0&&_0x34790b['talking']===0x0&&_0x34790b[_0x4eea('0x58')]===0x0&&(_0x34790b[_0x4eea('0xa5')]||0x0)===0x0){_0x34790b[_0x4eea('0xa6')]=![];_0x34790b['available']=0x0;_0x34790b[_0x4eea('0x40')]=_0x4eea('0x43');loggerSyncQueueSummary[_0x4eea('0x9a')](_0x4eea('0xa7'),_0x34790b[_0x4eea('0x41')],_0x4eea('0xa8'));}else{_0x34790b['message']='IS_DISACTIVED';loggerSyncQueueSummary[_0x4eea('0x9a')](_0x4eea('0xa7'),_0x34790b[_0x4eea('0x41')],_0x4eea('0xa9'));}emitVoiceQueueSummary(_0x34790b);}}function notSendMessagesCampaign(_0x1e716c){if(_0x1e716c[_0x4eea('0xa6')]){if(_0x1e716c[_0x4eea('0x9d')]===0x0){_0x1e716c['sendMessageOneNotActive']=![];_0x1e716c[_0x4eea('0x40')]='NOT_ACTIVE';loggerSyncQueueSummary[_0x4eea('0x9a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1e716c[_0x4eea('0x41')],_0x4eea('0xa8'));}else{_0x1e716c['message']=_0x4eea('0xaa');loggerSyncQueueSummary[_0x4eea('0x9a')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1e716c[_0x4eea('0x41')],'is\x20disactive');}emitCampaignSummary(_0x1e716c);}}function createObjHistory(_0x18ed7b,_0x210ad0,_0x3c8afd,_0x3dcf37,_0x88df54){_0x18ed7b['message']=_0x3c8afd;var _0x191862=new Action(_0x18ed7b,_0x210ad0);var _0xdd43a5=new History(_0x191862);_0xdd43a5[_0x4eea('0xab')]=_0x3dcf37;_0xdd43a5[_0x4eea('0xac')]=_0x88df54;_0xdd43a5[_0x4eea('0xad')]=_0x191862[_0x4eea('0xae')];return _0xdd43a5;}Dialer[_0x4eea('0x1f')][_0x4eea('0xaf')]=function(){var _0x4f58cc=this;setInterval(function(){_0x4f58cc[_0x4eea('0xb0')](_0x4f58cc[_0x4eea('0xb1')],_0x4eea('0xb2'));_0x4f58cc['clearZombieChannels'](_0x4f58cc[_0x4eea('0x2b')],_0x4eea('0xb3'));},0x32c8);};Dialer[_0x4eea('0x1f')][_0x4eea('0xb0')]=function(_0x25de46,_0x58376c){var _0xa71728=this;for(var _0x2b6246 in _0x25de46){if(typeof _0x25de46[_0x2b6246]!==_0x4eea('0x9e')){this[_0x4eea('0x23')][_0x4eea('0x20')](function(){if(!_[_0x4eea('0xb4')](_0x25de46[_0x2b6246])){return ami['Action']({'action':'status','channel':_0x25de46[_0x2b6246][_0x4eea('0xb5')]})['catch'](function(_0x356101){if(_0x356101[_0x4eea('0x40')]===_0x4eea('0xb6')){setTimeout(function(){if(_0x25de46[_0x2b6246]&&_0x25de46[_0x2b6246]['type']!==_0x4eea('0x7e')){_0xa71728['updateOriginated'](_0xa71728[_0x4eea('0x25')][_0x25de46[_0x2b6246][_0x4eea('0xb7')]]);logger[_0x4eea('0x9a')](_0x4eea('0xb8'),_0x58376c,_0x2b6246,_0x25de46[_0x2b6246][_0x4eea('0xb7')]);delete _0x25de46[_0x2b6246];}if(_0x25de46[_0x2b6246]&&_0x25de46[_0x2b6246]['type']===_0x4eea('0x7e')){_0xa71728[_0x4eea('0xb9')](_0xa71728[_0x4eea('0x26')][_0x25de46[_0x2b6246][_0x4eea('0xb7')]]);logger[_0x4eea('0x9a')](_0x4eea('0xba'),_0x58376c,_0x2b6246,_0x25de46[_0x2b6246][_0x4eea('0xb7')]);delete _0x25de46[_0x2b6246];}},0x2328);}});}});}}};Dialer[_0x4eea('0x1f')][_0x4eea('0xbb')]=function(_0x57f919){return BPromise['resolve']()[_0x4eea('0xbc')](cmHopper[_0x4eea('0xbb')](_0x57f919))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xbe')));};Dialer[_0x4eea('0x1f')][_0x4eea('0xbf')]=function(_0x4d3a46){return BPromise[_0x4eea('0xc0')]()['then'](cmHopperBlack[_0x4eea('0xbf')](_0x4d3a46))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xc1')));};Dialer[_0x4eea('0x1f')][_0x4eea('0xc2')]=function(_0x23ff80){return BPromise['resolve']()['then'](cmHopperBlack[_0x4eea('0xc2')](_0x23ff80))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xc3')));};Dialer[_0x4eea('0x1f')][_0x4eea('0xc4')]=function(_0x5f3f8e){return BPromise[_0x4eea('0xc0')]()[_0x4eea('0xbc')](cmHopperHistory[_0x4eea('0xc5')](_0x5f3f8e))['catch'](loggerCatch('[averageHandleTime]\x20'));};Dialer[_0x4eea('0x1f')][_0x4eea('0xc6')]=function(_0x29648c){return BPromise[_0x4eea('0xc0')]()[_0x4eea('0xbc')](cmHopper[_0x4eea('0xc6')](_0x29648c))['catch'](loggerCatch(_0x4eea('0xc7')));};Dialer[_0x4eea('0x1f')][_0x4eea('0xc8')]=function(_0xdd3b3e,_0x11d854,_0x4c78c6){return BPromise['resolve']()['then'](cmHopper[_0x4eea('0xc8')](_0xdd3b3e,_0x11d854,_0x4c78c6))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xc9')));};Dialer['prototype'][_0x4eea('0xca')]=function(_0xbd49bc,_0x4682af,_0x4a1deb,_0x187af7,_0x1b10c6){return BPromise[_0x4eea('0xc0')]()[_0x4eea('0xbc')](cmHopper[_0x4eea('0xca')](_0xbd49bc,_0x4682af,_0x4a1deb,_0x187af7))['catch'](function(_0x31cd3d){_0x1b10c6[_0x4eea('0xcb')]-=_0x4a1deb;_0x1b10c6['temp']=_0x1b10c6[_0x4eea('0xcb')]>0x0?_0x1b10c6[_0x4eea('0xcb')]:0x0;loggerCatch(_0x4eea('0xcc'))(_0x31cd3d);});};Dialer[_0x4eea('0x1f')][_0x4eea('0xcd')]=function(_0x469780,_0x53a506,_0x38232c,_0x5cd2f6){return BPromise[_0x4eea('0xc0')]()['then'](cmHopper[_0x4eea('0xcd')](_0x469780,_0x53a506,_0x38232c))[_0x4eea('0xbd')](function(_0x855fa5){_0x5cd2f6[_0x4eea('0xcb')]-=_0x53a506;_0x5cd2f6['temp']=_0x5cd2f6[_0x4eea('0xcb')]>0x0?_0x5cd2f6[_0x4eea('0xcb')]:0x0;loggerCatch(_0x4eea('0xce'))(_0x855fa5);});};Dialer[_0x4eea('0x1f')][_0x4eea('0xcf')]=function(_0x2bbf04){return BPromise['resolve']()[_0x4eea('0xbc')](voiceQueueRt[_0x4eea('0xcf')](_0x2bbf04))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xd0')));};Dialer[_0x4eea('0x1f')][_0x4eea('0xd1')]=function(_0x378b2b){return BPromise['resolve']()[_0x4eea('0xbc')](cmHopper[_0x4eea('0xd1')](_0x378b2b))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xd2')));};Dialer[_0x4eea('0x1f')][_0x4eea('0xd3')]=function(_0x3e1029){return BPromise[_0x4eea('0xc0')]()[_0x4eea('0xbc')](cmHopperHistory['createHistory'](_0x3e1029))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xd4')));};Dialer[_0x4eea('0x1f')][_0x4eea('0xb9')]=function(_0x508a4b){if(!_[_0x4eea('0x89')](_0x508a4b)&&_0x508a4b!==null){if(typeof _0x508a4b[_0x4eea('0x9d')]!=='undefined'){if(_0x508a4b[_0x4eea('0x9d')]>0x0){_0x508a4b[_0x4eea('0x9d')]-=0x1;}else{logger[_0x4eea('0x9a')](_0x4eea('0xd5'));}}}else{logger['error'](_0x4eea('0xd6'));}};Dialer[_0x4eea('0x1f')][_0x4eea('0xd7')]=function(_0x19b827,_0x131959){var _0x199766=this;return function(_0x293b01){_0x199766['updateOriginated'](_0x131959);logger[_0x4eea('0x9a')](_0x19b827,util[_0x4eea('0x9c')](_0x293b01,{'showHidden':![],'depth':null}));};};Dialer[_0x4eea('0x1f')]['emptyContact']=function(_0x228b80,_0x35695e,_0x493f2f){var _0x40a23f={'state':0x19,'statedesc':_0x4eea('0xd8')};this['updateOriginated'](_0x35695e);this[_0x4eea('0xd9')](_[_0x4eea('0x93')](_0x40a23f,_['pick'](_0x493f2f,['ContactId',_0x4eea('0xda'),_0x4eea('0xdb'),_0x4eea('0xdc'),_0x4eea('0xdd')])),_0x4eea('0xde'),_0x4eea('0xdf'));logger[_0x4eea('0x9a')](_0x228b80);};Dialer['prototype'][_0x4eea('0xe0')]=function(_0xb6ffdb){return _0xb6ffdb==='Success';};Dialer['prototype'][_0x4eea('0xe1')]=function(_0x1791a7){return!_[_0x4eea('0x89')](_0x1791a7)&&_0x1791a7&&!_['isUndefined'](_0x1791a7['name'])&&!_['isUndefined'](_0x1791a7[_0x4eea('0x7a')])&&_0x1791a7[_0x4eea('0x7a')]&&(this[_0x4eea('0x28')][util[_0x4eea('0x7f')](_0x4eea('0xe2'),_0x1791a7[_0x4eea('0x41')])][_0x4eea('0xe3')]===_0x4eea('0xe4')||this[_0x4eea('0x28')][util['format'](_0x4eea('0xe2'),_0x1791a7[_0x4eea('0x41')])][_0x4eea('0xe3')]===_0x4eea('0xe5'));};Dialer[_0x4eea('0x1f')][_0x4eea('0xd9')]=function(_0x2fcb24,_0x1f71db,_0x2a4393){this[_0x4eea('0xd3')](_0x2fcb24)[_0x4eea('0xbd')](loggerCatch(_0x1f71db));this['moveContactManagedDialer'](_0x2fcb24)[_0x4eea('0xbd')](loggerCatch(_0x2a4393));};Dialer[_0x4eea('0x1f')][_0x4eea('0x3c')]=function(_0x573bbe){var _0x38fb1e=this[_0x4eea('0xb1')][_0x573bbe['uniqueid']];var _0x270d48;if(!_[_0x4eea('0xb4')](_0x573bbe)&&!_['isNil'](_0x573bbe[_0x4eea('0xe6')])&&!_[_0x4eea('0xb4')](_0x573bbe['variable'][_0x4eea('0xe7')])&&_0x573bbe[_0x4eea('0xe8')]==='xcally-motion-dialer'&&_0x38fb1e){if(_0x38fb1e['type']!==_0x4eea('0x7e')&&this[_0x4eea('0x25')][_0x38fb1e[_0x4eea('0xb7')]][_0x4eea('0xe9')]&&_0x573bbe[_0x4eea('0xea')]==='HANGUP'){delete this[_0x4eea('0xb1')][_0x573bbe[_0x4eea('0xeb')]];this[_0x4eea('0xb9')](this[_0x4eea('0x25')][_0x38fb1e[_0x4eea('0xb7')]]);this[_0x4eea('0x25')][_0x38fb1e[_0x4eea('0xb7')]][_0x4eea('0xec')]+=0x1;this['voiceQueues'][_0x38fb1e[_0x4eea('0xb7')]][_0x4eea('0xed')]+=0x1;_0x270d48=new Hangup(_0x38fb1e,_0x573bbe);_0x270d48[_0x4eea('0xab')]=0x12;_0x270d48[_0x4eea('0xac')]=_0x4eea('0xee');_0x270d48['membername']=_0x4eea('0xef');ami[_0x4eea('0x4c')]('custom:amd',ut['buildObj'](_0x270d48,_0x4eea('0xf0')));this[_0x4eea('0xd9')](_0x270d48,_0x4eea('0xf1'),'[syncHangupInAMD]');}if(_0x38fb1e[_0x4eea('0x4d')]!==_0x4eea('0x7e')&&this[_0x4eea('0x25')][_0x38fb1e[_0x4eea('0xb7')]][_0x4eea('0xe9')]&&_0x573bbe[_0x4eea('0xea')]==='MACHINE'){var _0x2daf24=this;return new BPromise(function(_0x403508,_0xd74e1f){delete _0x2daf24['uniqueId'][_0x573bbe[_0x4eea('0xeb')]];_0x2daf24['updateOriginated'](_0x2daf24[_0x4eea('0x25')][_0x38fb1e['queue']]);_0x2daf24[_0x4eea('0x25')][_0x38fb1e['queue']][_0x4eea('0xec')]+=0x1;_0x2daf24['voiceQueues'][_0x38fb1e['queue']][_0x4eea('0xed')]+=0x1;var _0x53ad1f=_0x2daf24['voiceQueues'][_0x38fb1e[_0x4eea('0xb7')]];var _0x2f06ab=new Hangup(_0x38fb1e,_0x573bbe);_0x2f06ab[_0x4eea('0xab')]=0x13;_0x2f06ab[_0x4eea('0xac')]=_0x4eea('0xf2');_0x2f06ab[_0x4eea('0xf3')]='AMD';_0x2f06ab[_0x4eea('0xf4')]+=0x1;_0x2f06ab['countglobal']+=0x1;_0x2f06ab[_0x4eea('0xf0')]=!![];ami['emit'](_0x4eea('0xf5'),ut['buildObj'](_0x2f06ab,_0x4eea('0xf0')));_0x2daf24['createHistory'](_0x2f06ab)['catch'](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x2f06ab[_0x4eea('0xf6')]+_0x2f06ab['countcongestionretry']+_0x2f06ab[_0x4eea('0xf7')]+_0x2f06ab['countnosuchnumberretry']+_0x2f06ab['countdropretry']+_0x2f06ab['countabandonedretry']+_0x2f06ab['countmachineretry']+_0x2f06ab['countagentrejectretry']>=_0x53ad1f[_0x4eea('0xf8')]){_0x2daf24['stateGlobal'](_0x2f06ab,_0x403508,_0xd74e1f,'reason19\x20machine....');}else{if(_0x2f06ab[_0x4eea('0xf4')]>=_0x53ad1f['dialMachineMaxRetry']){_0x2daf24[_0x4eea('0xf9')](_0x2f06ab,_0x403508,_0xd74e1f,'reason\x2019\x20machine....');}else{_0x2daf24[_0x4eea('0xc6')]({'active':![],'countmachineretry':_0x2f06ab[_0x4eea('0xf4')],'scheduledat':moment()[_0x4eea('0xfa')](_0x53ad1f[_0x4eea('0xfb')],_0x4eea('0xfc'))[_0x4eea('0x7f')](_0x4eea('0xfd')),'ContactId':_0x2f06ab['ContactId'],'ListId':_0x2f06ab[_0x4eea('0xda')],'VoiceQueueId':_0x2f06ab[_0x4eea('0xdc')]||undefined,'CampaignId':_0x2f06ab[_0x4eea('0xdd')]||undefined})[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xfe')));_0x403508({'reschedule':0x1});}}});}if(_0x38fb1e[_0x4eea('0x4d')]===_0x4eea('0x7e')&&this[_0x4eea('0x26')][_0x38fb1e['queue']][_0x4eea('0xe9')]&&_0x573bbe[_0x4eea('0xea')]===_0x4eea('0xff')){delete this['uniqueId'][_0x573bbe[_0x4eea('0xeb')]];this[_0x4eea('0xb9')](this['campaigns'][_0x38fb1e[_0x4eea('0xb7')]]);_0x270d48=new Hangup(_0x38fb1e,_0x573bbe);_0x270d48[_0x4eea('0xab')]=0x12;_0x270d48['statedesc']=_0x4eea('0xee');_0x270d48['membername']=_0x4eea('0xef');ami['emit'](_0x4eea('0xf5'),ut['buildObj'](_0x270d48,_0x4eea('0xf0')));this[_0x4eea('0xd9')](_0x270d48,_0x4eea('0x100'),'[syncHangupInAMDIvr]');}if(_0x38fb1e[_0x4eea('0x4d')]===_0x4eea('0x7e')&&this[_0x4eea('0x26')][_0x38fb1e[_0x4eea('0xb7')]][_0x4eea('0xe9')]&&_0x573bbe[_0x4eea('0xea')]===_0x4eea('0x101')){var _0x2daf24=this;return new BPromise(function(_0x14f3e5,_0x14b06b){delete _0x2daf24[_0x4eea('0xb1')][_0x573bbe[_0x4eea('0xeb')]];_0x2daf24[_0x4eea('0xb9')](_0x2daf24['campaigns'][_0x38fb1e[_0x4eea('0xb7')]]);_0x2daf24['campaigns'][_0x38fb1e[_0x4eea('0xb7')]][_0x4eea('0xec')]+=0x1;_0x2daf24[_0x4eea('0x26')][_0x38fb1e['queue']]['outboundAnswerAgiCallsDay']+=0x1;var _0x4d2b45=_0x2daf24[_0x4eea('0x26')][_0x38fb1e[_0x4eea('0xb7')]];var _0x399f9a=new Hangup(_0x38fb1e,_0x573bbe);_0x399f9a[_0x4eea('0xab')]=0x13;_0x399f9a['statedesc']=_0x4eea('0xf2');_0x399f9a[_0x4eea('0xf3')]=_0x4eea('0xef');_0x399f9a[_0x4eea('0xf4')]+=0x1;_0x399f9a[_0x4eea('0x102')]+=0x1;_0x399f9a[_0x4eea('0xf0')]=!![];ami['emit']('custom:amd',ut['buildObj'](_0x399f9a,'amd'));_0x2daf24[_0x4eea('0xd3')](_0x399f9a)[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x103')));if(_0x399f9a[_0x4eea('0xf6')]+_0x399f9a[_0x4eea('0x104')]+_0x399f9a['countnoanswerretry']+_0x399f9a[_0x4eea('0x105')]+_0x399f9a[_0x4eea('0x106')]+_0x399f9a['countabandonedretry']+_0x399f9a[_0x4eea('0xf4')]+_0x399f9a[_0x4eea('0x107')]>=_0x4d2b45[_0x4eea('0xf8')]){_0x2daf24[_0x4eea('0x108')](_0x399f9a,_0x14f3e5,_0x14b06b,'reason19\x20machine....');}else{if(_0x399f9a[_0x4eea('0xf4')]>=_0x4d2b45[_0x4eea('0x109')]){_0x2daf24[_0x4eea('0xf9')](_0x399f9a,_0x14f3e5,_0x14b06b,_0x4eea('0x10a'));}else{_0x2daf24['rescheduleContact']({'active':![],'countmachineretry':_0x399f9a['countmachineretry'],'scheduledat':moment()[_0x4eea('0xfa')](_0x4d2b45[_0x4eea('0xfb')],'minutes')[_0x4eea('0x7f')](_0x4eea('0xfd')),'ContactId':_0x399f9a[_0x4eea('0x10b')],'ListId':_0x399f9a['ListId'],'VoiceQueueId':_0x399f9a[_0x4eea('0xdc')]||undefined,'CampaignId':_0x399f9a[_0x4eea('0xdd')]||undefined})[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xfe')));_0x14f3e5({'reschedule':0x1});}}});}}};Dialer[_0x4eea('0x1f')]['syncHangup']=function(_0x1bf0c8){var _0x42fffc=this['uniqueId'][_0x1bf0c8[_0x4eea('0xeb')]];var _0xce7d21=this;var _0x5d355c;if(_0x42fffc&&_0x42fffc[_0x4eea('0x4d')]===_0x4eea('0x7e')){delete this[_0x4eea('0xb1')][_0x1bf0c8[_0x4eea('0xeb')]];this['updateOriginated'](this[_0x4eea('0x26')][_0x42fffc[_0x4eea('0xb7')]]);this[_0x4eea('0x26')][_0x42fffc[_0x4eea('0xb7')]][_0x4eea('0x10c')]+=0x1;_0x5d355c=new Hangup(_0x42fffc,_0x1bf0c8);this[_0x4eea('0xd3')](_0x5d355c)[_0x4eea('0xbd')](loggerCatch('[syncHangupIvr][createHistory]'));this['moveContactManagedDialer'](_0x5d355c)[_0x4eea('0xbd')](loggerCatch('[syncHangupIvr]'));}if(_0x42fffc&&_0x42fffc['type']!=='ivr'&&isNotNull(this['voiceQueues'][_0x42fffc[_0x4eea('0xb7')]]['dialQueueProject'])){delete this[_0x4eea('0xb1')][_0x1bf0c8[_0x4eea('0xeb')]];this[_0x4eea('0xb9')](this[_0x4eea('0x25')][_0x42fffc[_0x4eea('0xb7')]]);this[_0x4eea('0x25')][_0x42fffc[_0x4eea('0xb7')]][_0x4eea('0xec')]+=0x1;this[_0x4eea('0x25')][_0x42fffc[_0x4eea('0xb7')]][_0x4eea('0xed')]+=0x1;_0x5d355c=new Hangup(_0x42fffc,_0x1bf0c8);_0x5d355c[_0x4eea('0xab')]=0x10;_0x5d355c[_0x4eea('0xac')]=_0x4eea('0x10d');_0x5d355c[_0x4eea('0xf3')]=_0x4eea('0x10e');this['createHistory'](_0x5d355c)['catch'](loggerCatch(_0x4eea('0x10f')));this['moveContactManagedDialer'](_0x5d355c)[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x110')));}if(_0x42fffc&&_0x42fffc[_0x4eea('0x4d')]!=='ivr'&&!isNotNull(this[_0x4eea('0x25')][_0x42fffc[_0x4eea('0xb7')]][_0x4eea('0x111')])){delete this[_0x4eea('0xb1')][_0x1bf0c8[_0x4eea('0xeb')]];this[_0x4eea('0xb9')](this[_0x4eea('0x25')][_0x42fffc[_0x4eea('0xb7')]]);this[_0x4eea('0x25')][_0x42fffc[_0x4eea('0xb7')]][_0x4eea('0x6a')]+=0x1;_0x5d355c=new Hangup(_0x42fffc,_0x1bf0c8);_0x5d355c[_0x4eea('0xab')]=0xc;_0x5d355c[_0x4eea('0xac')]=_0x1bf0c8[_0x4eea('0x112')];_0x5d355c[_0x4eea('0xf3')]=_0x4eea('0x113');this['createHistory'](_0x5d355c)[_0x4eea('0xbd')](loggerCatch('[syncHangupIvr][createHistory]'));this[_0x4eea('0xd1')](_0x5d355c)['catch'](loggerCatch(_0x4eea('0x110')));}};Dialer[_0x4eea('0x1f')]['syncAgentComplete']=function(_0x266dde){var _0x5eb2fb=this[_0x4eea('0xb1')][_0x266dde['uniqueid']];var _0x268425=this;if(this[_0x4eea('0x25')][_0x266dde[_0x4eea('0xb7')]]){if(_0x5eb2fb&&_0x5eb2fb[_0x4eea('0x4d')]!==_0x4eea('0x7e')){delete this['uniqueId'][_0x266dde[_0x4eea('0xeb')]];this[_0x4eea('0x25')][_0x266dde[_0x4eea('0xb7')]][_0x4eea('0xec')]+=0x1;var _0x149749=new AgentComplete(_0x5eb2fb,_0x266dde);if(_0x266dde[_0x4eea('0x114')]==='agent'){_0x149749['agiafterat']=this[_0x4eea('0x25')][_0x266dde['queue']]['dialQueueProject2']&&this['voiceQueues'][_0x266dde[_0x4eea('0xb7')]]['dialAgiAfterHangupAgent']?moment()[_0x4eea('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;}this[_0x4eea('0xd3')](_0x149749)[_0x4eea('0xbd')](loggerCatch('[syncAgentComplete][createHistory]'));this['moveContactManagedDialer'](_0x149749)[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x115')));}}};Dialer['prototype']['syncAgentConnect']=function(_0x3a62c3){if(this[_0x4eea('0x25')][_0x3a62c3[_0x4eea('0xb7')]]){if(this[_0x4eea('0xb1')][_0x3a62c3[_0x4eea('0xeb')]]&&this[_0x4eea('0xb1')][_0x3a62c3['uniqueid']][_0x4eea('0x4d')]!=='ivr'){this['updateOriginated'](this[_0x4eea('0x25')][_0x3a62c3[_0x4eea('0xb7')]]);this[_0x4eea('0xb1')][_0x3a62c3[_0x4eea('0xeb')]][_0x4eea('0x116')]=moment()[_0x4eea('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');}}};Dialer['prototype'][_0x4eea('0x117')]=function(_0x2467d2){this[_0x4eea('0xd3')](_0x2467d2)['catch'](loggerCatch(_0x4eea('0x118')));this[_0x4eea('0xd1')](_0x2467d2)[_0x4eea('0xbd')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));};Dialer[_0x4eea('0x1f')][_0x4eea('0x119')]=function(_0x8efaa8){var _0x4daf49=this['uniqueId'][_0x8efaa8[_0x4eea('0xeb')]];var _0x487392=this;if(this['voiceQueues'][_0x8efaa8['queue']]){if(_0x4daf49&&_0x4daf49[_0x4eea('0x4d')]!==_0x4eea('0x7e')){delete this['uniqueId'][_0x8efaa8[_0x4eea('0xeb')]];this[_0x4eea('0xb9')](this[_0x4eea('0x25')][_0x8efaa8[_0x4eea('0xb7')]]);_0x4daf49[_0x4eea('0x11a')]=moment()[_0x4eea('0x7f')](_0x4eea('0xfd'));var _0x2923a2=new QueueCallerAbandon(_0x4daf49,_0x8efaa8);if(getSeconds(_0x4daf49[_0x4eea('0x11a')],_0x4daf49[_0x4eea('0x11b')])>=_0x4daf49[_0x4eea('0x11c')]){this[_0x4eea('0x25')][_0x8efaa8[_0x4eea('0xb7')]][_0x4eea('0x6e')]+=0x1;this[_0x4eea('0x25')][_0x8efaa8[_0x4eea('0xb7')]][_0x4eea('0x64')]+=0x1;this['voiceQueues'][_0x8efaa8[_0x4eea('0xb7')]][_0x4eea('0x70')]+=0x1;_0x2923a2[_0x4eea('0xab')]=0xa;_0x2923a2[_0x4eea('0xac')]='Drop';_0x2923a2[_0x4eea('0x11d')]='TIMEOUT';_0x2923a2[_0x4eea('0x11e')]=this['voiceQueues'][_0x8efaa8[_0x4eea('0xb7')]][_0x4eea('0x11f')]?moment()['format'](_0x4eea('0xfd')):undefined;_0x2923a2[_0x4eea('0x106')]+=0x1;_0x2923a2['countglobal']+=0x1;if(_0x2923a2[_0x4eea('0x106')]>=this[_0x4eea('0x25')][_0x8efaa8[_0x4eea('0xb7')]][_0x4eea('0x120')]){this[_0x4eea('0x117')](_0x2923a2);}else{this[_0x4eea('0xc6')]({'active':![],'countdropretry':_0x2923a2['countdropretry'],'scheduledat':moment()[_0x4eea('0xfa')](this[_0x4eea('0x25')][_0x8efaa8['queue']][_0x4eea('0x121')],'minutes')[_0x4eea('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4daf49['ContactId'],'ListId':_0x4daf49[_0x4eea('0xda')],'VoiceQueueId':_0x4daf49['VoiceQueueId']||undefined,'CampaignId':_0x4daf49[_0x4eea('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x4aa0ee=new History(_0x2923a2);_0x4aa0ee[_0x4eea('0xab')]=0xa;_0x4aa0ee[_0x4eea('0xac')]=_0x4eea('0x122');_0x4aa0ee[_0x4eea('0xae')]=moment()[_0x4eea('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4aa0ee[_0x4eea('0xad')]=_0x4aa0ee[_0x4eea('0xae')];_0x4aa0ee[_0x4eea('0x123')]=_0x2923a2[_0x4eea('0x123')];_0x4aa0ee[_0x4eea('0x124')]=_0x2923a2['calleridnum'];this[_0x4eea('0xd3')](_0x4aa0ee)['catch'](loggerCatch(_0x4eea('0x125')));}}else{this['voiceQueues'][_0x8efaa8[_0x4eea('0xb7')]][_0x4eea('0x6d')]+=0x1;this['voiceQueues'][_0x8efaa8[_0x4eea('0xb7')]][_0x4eea('0x63')]+=0x1;_0x2923a2[_0x4eea('0xab')]=0xb;_0x2923a2[_0x4eea('0xac')]=_0x4eea('0x126');_0x2923a2['dropreason']='CALLEREXIT';_0x2923a2[_0x4eea('0x127')]+=0x1;_0x2923a2[_0x4eea('0x102')]+=0x1;if(_0x2923a2[_0x4eea('0x127')]>=this[_0x4eea('0x25')][_0x8efaa8[_0x4eea('0xb7')]][_0x4eea('0x128')]){this['queueCallerAbandonCreateState'](_0x2923a2);}else{this[_0x4eea('0xc6')]({'active':![],'countabandonedretry':_0x2923a2[_0x4eea('0x127')],'scheduledat':moment()[_0x4eea('0xfa')](this[_0x4eea('0x25')][_0x8efaa8[_0x4eea('0xb7')]][_0x4eea('0x129')],'minutes')[_0x4eea('0x7f')](_0x4eea('0xfd')),'ContactId':_0x4daf49['ContactId'],'ListId':_0x4daf49[_0x4eea('0xda')],'VoiceQueueId':_0x4daf49[_0x4eea('0xdc')]||undefined,'CampaignId':_0x4daf49[_0x4eea('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x4aa0ee=new History(_0x2923a2);_0x4aa0ee[_0x4eea('0xab')]=0xb;_0x4aa0ee[_0x4eea('0xac')]=_0x4eea('0x126');_0x4aa0ee[_0x4eea('0xae')]=moment()[_0x4eea('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');_0x4aa0ee[_0x4eea('0xad')]=_0x4aa0ee[_0x4eea('0xae')];_0x4aa0ee['calleridname']=_0x2923a2[_0x4eea('0x123')];_0x4aa0ee[_0x4eea('0x124')]=_0x2923a2[_0x4eea('0x124')];this[_0x4eea('0xd3')](_0x4aa0ee)[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x12a')));}}}}};Dialer[_0x4eea('0x1f')]['syncNewExten']=function(_0x46c7ea){if(this[_0x4eea('0x2b')][_0x46c7ea['uniqueid']]){this[_0x4eea('0x2b')][_0x46c7ea[_0x4eea('0xeb')]][_0x4eea('0xb5')]=_0x46c7ea[_0x4eea('0xb5')];}if(this['uniqueId'][_0x46c7ea[_0x4eea('0xeb')]]){this[_0x4eea('0xb1')][_0x46c7ea[_0x4eea('0xeb')]][_0x4eea('0xb5')]=_0x46c7ea[_0x4eea('0xb5')];}};Dialer['prototype'][_0x4eea('0x12b')]=function(_0x5b2bf5){if(strategy[this['voiceQueues'][this[_0x4eea('0x2b')][_0x5b2bf5['actionid']][_0x4eea('0xb7')]]['strategy']]===_0x4eea('0x1e')){if(this[_0x4eea('0x2b')][_0x5b2bf5[_0x4eea('0x12c')]]&&_[_0x4eea('0xb4')](this['actions'][_0x5b2bf5['actionid']][_0x4eea('0x12d')])&&_0x5b2bf5[_0x4eea('0xe3')]==='1'&&_0x5b2bf5[_0x4eea('0x12e')]==='0'){if(this[_0x4eea('0x27')][_0x5b2bf5[_0x4eea('0x12f')]]){if(!this[_0x4eea('0x27')][_0x5b2bf5[_0x4eea('0x12f')]][_0x4eea('0x12d')]){this[_0x4eea('0x27')][_0x5b2bf5['stateinterface']][_0x4eea('0x12d')]=!![];this[_0x4eea('0x2b')][_0x5b2bf5[_0x4eea('0x12c')]]['locked']=!![];this[_0x4eea('0x2b')][_0x5b2bf5[_0x4eea('0x12c')]][_0x4eea('0x12f')]=_0x5b2bf5[_0x4eea('0x12f')];}}}}else if((strategy[this[_0x4eea('0x25')][this['actions'][_0x5b2bf5[_0x4eea('0x12c')]][_0x4eea('0xb7')]]['strategy']]||_0x4eea('0x1d'))===_0x4eea('0x1d')){if(this[_0x4eea('0x2b')][_0x5b2bf5[_0x4eea('0x12c')]]){if(this[_0x4eea('0x27')][_0x5b2bf5[_0x4eea('0x12f')]]){this[_0x4eea('0x2b')][_0x5b2bf5[_0x4eea('0x12c')]][_0x4eea('0x12f')]=_0x5b2bf5[_0x4eea('0x12f')];if(_[_0x4eea('0xb4')](this[_0x4eea('0x31')][this[_0x4eea('0x2b')][_0x5b2bf5[_0x4eea('0x12c')]][_0x4eea('0xb7')]])){this[_0x4eea('0x31')][this[_0x4eea('0x2b')][_0x5b2bf5[_0x4eea('0x12c')]][_0x4eea('0xb7')]]=[];}this[_0x4eea('0x31')][this['actions'][_0x5b2bf5[_0x4eea('0x12c')]][_0x4eea('0xb7')]][_0x4eea('0x130')](_[_0x4eea('0x93')](_[_0x4eea('0x131')](this['actions'][_0x5b2bf5[_0x4eea('0x12c')]],[_0x4eea('0x132'),_0x4eea('0x12f')]),{'status':_0x5b2bf5[_0x4eea('0xe3')],'paused':_0x5b2bf5[_0x4eea('0x12e')]}));}}}};function unlockQueueStatus(_0x1e5dbb,_0xb679b8){setTimeout(function(){if(_[_0x4eea('0x89')](_0x1e5dbb['queueStatusComplete'])){loggerBooked[_0x4eea('0x9a')]('[unlockQueueStatus][undefined]',_0xb679b8);}_0x1e5dbb[_0x4eea('0x133')]=!![];loggerBooked[_0x4eea('0x81')]('[booked][unlockQueueStatus]',_0xb679b8,JSON[_0x4eea('0x7c')](_['pick'](_0x1e5dbb,[_0x4eea('0x41'),_0x4eea('0x133')])));},0x1f3);}Dialer[_0x4eea('0x1f')][_0x4eea('0x3f')]=function(_0x479a02){var _0x57c5ec=this;var _0x400986=_0x57c5ec['voiceQueues'][_0x57c5ec['actions'][_0x479a02['actionid']][_0x4eea('0xb7')]];if(strategy[this[_0x4eea('0x25')][this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xb7')]][_0x4eea('0x4f')]]===_0x4eea('0x1e')){if(this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]]&&this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0x12f')]){this[_0x4eea('0x24')]['run'](this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0x132')],this['actions'][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0x12f')])['catch'](function(_0x14c0c4){logger['error'](_0x4eea('0x134'),util[_0x4eea('0x9c')](_0x14c0c4,{'showHidden':![],'depth':null}));})['finally'](function(){_0x57c5ec[_0x4eea('0xb9')](_0x57c5ec[_0x4eea('0x25')][_0x57c5ec[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xb7')]]);_0x57c5ec[_0x4eea('0x27')][_0x57c5ec[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0x12f')]][_0x4eea('0x12d')]=![];delete _0x57c5ec[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]];unlockQueueStatus(_0x400986);});}else{this['updateOriginated'](this[_0x4eea('0x25')][this['actions'][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xb7')]]);this['rescheduleContact']({'active':![],'ContactId':this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0x10b')],'ListId':this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xda')],'VoiceQueueId':this[_0x4eea('0x2b')][_0x479a02['actionid']][_0x4eea('0xdc')]||undefined,'CampaignId':this['actions'][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xdd')]||undefined})[_0x4eea('0xbd')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this['actions'][_0x479a02[_0x4eea('0x12c')]];unlockQueueStatus(_0x400986);}}else if((strategy[this[_0x4eea('0x25')][this[_0x4eea('0x2b')][_0x479a02['actionid']][_0x4eea('0xb7')]][_0x4eea('0x4f')]]||_0x4eea('0x1d'))===_0x4eea('0x1d')){var _0x235eea;if(this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]]&&!_['isEmpty'](this['queueBooked'][this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xb7')]])){if(this[_0x4eea('0x135')][_0x57c5ec[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]]['queue']]){this[_0x4eea('0x135')][_0x57c5ec[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xb7')]]=this[_0x4eea('0x135')][this['actions'][_0x479a02[_0x4eea('0x12c')]]['queue']]?this[_0x4eea('0x135')][this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xb7')]]:this[_0x4eea('0x31')][this[_0x4eea('0x2b')][_0x479a02['actionid']][_0x4eea('0xb7')]]?this['queueBooked'][this['actions'][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xb7')]][_0x4eea('0x136')]||0x0:0x0;}this[_0x4eea('0x31')][this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]]['queue']][_0x4eea('0x136')]=this[_0x4eea('0x135')][this[_0x4eea('0x2b')][_0x479a02[_0x4eea('0x12c')]][_0x4eea('0xb7')]];for(var _0xd9b75f=0x0;_0xd9b75f=0x0;})[_0x4eea('0xbd')](myreject(_0x3bd389)));}}else{_0x689cf7[_0x4eea('0x130')](ami['Action']({'action':_0x4eea('0x151'),'command':util['format'](_0x4eea('0x152'),_0xf8be2e,!_[_0x4eea('0x89')](config['timezones'][_0x5a9092])?_0x5a9092:'')})[_0x4eea('0xbc')](function(_0x4d1d68){return _0x4d1d68['content'][_0x4eea('0x155')](_0x4eea('0x156'))>=0x0;})[_0x4eea('0xbd')](myreject(_0x3bd389)));}BPromise[_0x4eea('0x157')](_0x689cf7)['then'](function(_0x2c4585){var _0x3bce6e=_[_0x4eea('0x158')](_0x2c4585);if(_0x3bce6e){return _0x39194d(_0x3bce6e);}else{_0x5ef37c['message']=_0x10ceb1?_0x4eea('0x159'):_0x4eea('0x15a');return _0x3bd389(msgResponse(_0x4eea('0x15b'),_0x4eea('0x14c'),_0x4eea('0x15c')+_0x10ceb1+'\x20'+_0x269a86+_0x4eea('0x15d')+util[_0x4eea('0x9c')](_0xf8be2e,{'showHidden':![],'depth':null})+_0x4eea('0x15e')+_0x5a9092));}})[_0x4eea('0xbd')](function(_0x568f78){return _0x3bd389(msgResponse(_0x4eea('0x147'),_0x4eea('0x14c'),JSON['stringify'](_0x568f78)));});});};Dialer[_0x4eea('0x1f')][_0x4eea('0x15f')]=function(_0x4bcbe5){var _0x3e8e1d=this;return function(){switch(_0x4bcbe5[_0x4eea('0x5a')]){case _0x4eea('0x160'):freeVariablesPredictive(_0x4bcbe5);_0x3e8e1d[_0x4eea('0x161')](_0x4bcbe5,0x1);break;case _0x4eea('0x162'):freeVariablesPredictive(_0x4bcbe5);_0x3e8e1d[_0x4eea('0x161')](_0x4bcbe5,_0x4bcbe5[_0x4eea('0x163')]);break;case _0x4eea('0xc'):_0x3e8e1d['predictive'](_0x4bcbe5);break;case _0x4eea('0xa'):freeVariablesPredictive(_0x4bcbe5);_0x3e8e1d[_0x4eea('0x161')](_0x4bcbe5,0x1);break;default:freeVariablesPredictive(_0x4bcbe5);logger[_0x4eea('0x9a')](_0x4eea('0x164'),_0x4bcbe5[_0x4eea('0x41')],_0x4eea('0x165'));}};};Dialer['prototype']['launchHandleIvr']=function(_0x492031){var _0xf1fb29=this;return function(){_0xf1fb29[_0x4eea('0x166')](_0x492031);};};Dialer['prototype'][_0x4eea('0x167')]=function(_0x15f95c){var _0x49ffab=this;if(isNotPreview(_0x15f95c['dialMethod'])){if(isVoiceQueueOutbound(_0x15f95c['type'])&&isActive(_0x15f95c[_0x4eea('0x59')])){_0x15f95c['sendMessageOneNotActive']=!![];BPromise[_0x4eea('0xc0')]()[_0x4eea('0xbc')](checkIsLoggedIn(_0x15f95c,_0x15f95c[_0x4eea('0x52')]))['then'](checkIsActive(_0x15f95c,_0x15f95c['dialActive']))[_0x4eea('0xbc')](checkInterval(_0x15f95c))['then'](_0x49ffab[_0x4eea('0x144')](_0x15f95c))[_0x4eea('0xbc')](_0x49ffab[_0x4eea('0x146')](_0x15f95c['dialGlobalInterval'],_0x15f95c['dialTimezone'],_0x15f95c[_0x4eea('0x41')],_0x15f95c))[_0x4eea('0xbc')](_0x49ffab[_0x4eea('0x148')](_0x15f95c[_0x4eea('0x44')],_0x15f95c[_0x4eea('0x168')],_0x15f95c['name'],_0x15f95c))['then'](_0x49ffab[_0x4eea('0x15f')](_0x15f95c))[_0x4eea('0xbd')](loggerCatchQueueSummary(_0x4eea('0x169'),_0x15f95c));}else{notSendMessagesQueue(_0x15f95c);}}else{freeVariablesPredictive(_0x15f95c);}};Dialer[_0x4eea('0x1f')][_0x4eea('0x143')]=function(){var _0xb535d0=this;var _0x5858f4;for(var _0x5a88d3 in this[_0x4eea('0x26')]){if(typeof this[_0x4eea('0x26')][_0x5a88d3]!==_0x4eea('0x9e')){_0x5858f4=this[_0x4eea('0x26')][_0x5a88d3];if(isCampaignIvr(_0x5858f4[_0x4eea('0x4d')])&&isActive(_0x5858f4[_0x4eea('0x7a')])){_0x5858f4[_0x4eea('0xa6')]=!![];BPromise[_0x4eea('0xc0')]()['then'](checkIsActive(_0x5858f4,_0x5858f4[_0x4eea('0x7a')]))[_0x4eea('0xbc')](checkInterval(_0x5858f4))['then'](_0xb535d0[_0x4eea('0x144')](_0x5858f4))[_0x4eea('0xbc')](_0xb535d0[_0x4eea('0x146')](_0x5858f4[_0x4eea('0x16a')],_0x5858f4[_0x4eea('0x168')],_0x5858f4[_0x4eea('0x41')],_0x5858f4))['then'](_0xb535d0['checkIfTimeIntervals'](_0x5858f4[_0x4eea('0x44')],_0x5858f4['dialTimezone'],_0x5858f4[_0x4eea('0x41')],_0x5858f4))['then'](_0xb535d0[_0x4eea('0x16b')](_0x5858f4))[_0x4eea('0xbd')](loggerCatchQueueSummary(_0x4eea('0x16c'),_0x5858f4));}else{notSendMessagesCampaign(_0x5858f4);}}}};function getCallerIdRandom(_0x5dad0f,_0x252901){var _0x106699;var _0x571e1f;var _0x302a94;if(_0x252901<=0x0){_0x252901=0x1;}_0x106699=new RegExp(_0x4eea('0x16d')+_0x252901+'}$');_0x571e1f=Math[_0x4eea('0x16e')](0xa,_0x252901-0x1);_0x302a94=Math['pow'](0xa,_0x252901)-0x1;return util[_0x4eea('0x7f')]('%s',_[_0x4eea('0x16f')](_0x5dad0f,_0x106699,_['random'](_0x571e1f,_0x302a94)));}function extractCalleridName(_0x8616ae){var _0x15f5ca=_0x8616ae[_0x4eea('0x170')](/"(.*?)"/);return _0x15f5ca?_0x15f5ca[0x1]:_0x8616ae;}function extractCalleridNumber(_0x2dfc88){var _0x6d6d3c=_0x2dfc88[_0x4eea('0x170')](/<(.*?)>/);return _0x6d6d3c?_0x6d6d3c[0x1]:_0x2dfc88;}Dialer[_0x4eea('0x1f')]['actionOriginate']=function(_0x2f821b,_0x5d94c6){var _0x4aa1ca=this;var _0x15effd=uuid['v4']();this[_0x4eea('0x2b')][_0x15effd]=new Action(_0x2f821b,_0x5d94c6,_0x15effd);return new BPromise(function(_0x408c83,_0x37bd21){if(_['isUndefined'](_0x2f821b)&&typeof _0x2f821b!==_0x4eea('0x171')){return _0x37bd21(msgResponse(_0x4eea('0x172'),_0x4eea('0x14c'),_0x4eea('0x173')));}if(_[_0x4eea('0x89')](_0x5d94c6[_0x4eea('0x174')][_0x4eea('0x175')])||_0x5d94c6[_0x4eea('0x174')][_0x4eea('0x175')]===null){return _0x37bd21(msgResponse(_0x4eea('0x172'),_0x4eea('0x14c'),'contact\x20is\x20undefine'));}var _0x67951e={'XMD-CALLERID':_0x4aa1ca[_0x4eea('0x2b')][_0x15effd][_0x4eea('0x176')](),'XMD-AGI':_0x2f821b[_0x4eea('0x111')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2f821b[_0x4eea('0x111')]):_0x4eea('0x177'),'XMD-AGIAFTER':_0x2f821b[_0x4eea('0x11f')]?util[_0x4eea('0x7f')]('\x22agi://%s/square,%s\x22',ipAgi,_0x2f821b['dialQueueProject2']):_0x4eea('0x177'),'XMD-QUEUE':_0x2f821b[_0x4eea('0x4d')]===_0x4eea('0x4e')?util[_0x4eea('0x7f')]('\x22%s,%s%s,,,%s\x22',_0x2f821b[_0x4eea('0x41')],_0x2f821b['dialQueueOptions']||'',_0x2f821b[_0x4eea('0x178')]?'c':'',_0x2f821b[_0x4eea('0x11c')]||0x3):_0x4eea('0x177'),'XMD-CONTACTID':_0x5d94c6[_0x4eea('0x10b')],'XMD-CDRTYPE':_0x4eea('0x9'),'CALLERID(all)':_0x4aa1ca[_0x4eea('0x2b')][_0x15effd][_0x4eea('0x176')](),'XMD-AMD':_0x2f821b[_0x4eea('0xe9')]?_0x4eea('0x179'):_0x4eea('0x177'),'XMD-DESTINATION':_0x4eea('0x17a')};if(_0x2f821b['dialAMDActive']){_0x67951e['XMD-AMDINITIALSILENCE']=_0x2f821b['dialAMDInitialSilence']||0x9c4;_0x67951e['XMD-AMDGREETING']=_0x2f821b[_0x4eea('0x17b')]||0x5dc;_0x67951e[_0x4eea('0x17c')]=_0x2f821b[_0x4eea('0x17d')]||0x320;_0x67951e[_0x4eea('0x17e')]=_0x2f821b['dialAMDTotalAnalysisTime']||0x1388;_0x67951e['XMD-AMDMINWORDLENGTH']=_0x2f821b[_0x4eea('0x17f')]||0x64;_0x67951e[_0x4eea('0x180')]=_0x2f821b['dialAMDBetweenWordsSilence']||0x32;_0x67951e[_0x4eea('0x181')]=_0x2f821b['dialAMDMaximumNumberOfWords']||0x3;_0x67951e[_0x4eea('0x182')]=_0x2f821b[_0x4eea('0x183')]||0x100;_0x67951e['XMD-AMDMAXIMUMWORDLENGTH']=_0x2f821b['dialAMDMaximumWordLength']||0x1388;}if(_0x2f821b[_0x4eea('0x4d')]===_0x4eea('0x4e')){_0x67951e[_0x4eea('0x184')]=_0x5d94c6[_0x4eea('0xdc')];}else{_0x67951e[_0x4eea('0x185')]=_0x5d94c6[_0x4eea('0xdd')];}for(var _0x405393 in _0x5d94c6[_0x4eea('0x174')]){if(typeof _0x5d94c6[_0x4eea('0x174')][_0x405393]!==_0x4eea('0x9e')){if(isNotNull(_0x5d94c6[_0x4eea('0x174')][_0x405393])&&_0x405393!=='id'&&_0x405393!==_0x4eea('0x186')&&_0x405393!==_0x4eea('0x187')&&_0x405393!=='updatedAt'){_0x67951e[util[_0x4eea('0x7f')](_0x4eea('0x188'),_0x4eea('0x189'),_[_0x4eea('0x18a')](_0x405393))]=_0x5d94c6[_0x4eea('0x174')][_0x405393];}}}var _0x4fae34=_0x4aa1ca[_0x4eea('0xe1')](_0x2f821b['Trunk'])?getCallerId(_0x2f821b[_0x4eea('0x79')]['callerid'],_0x2f821b['dialOriginateCallerIdName'],_0x2f821b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2f821b[_0x4eea('0x5c')],_0x2f821b[_0x4eea('0x18b')]):_0x2f821b[_0x4eea('0x5c')]):getCallerId(_[_0x4eea('0xb4')](_0x2f821b[_0x4eea('0x18c')])?_0x2f821b[_0x4eea('0x79')][_0x4eea('0x7b')]:_0x2f821b['TrunkBackup'][_0x4eea('0x7b')],_0x2f821b[_0x4eea('0x5b')],_0x2f821b['dialRandomLastDigitCallerIdNumber']>0x0?getCallerIdRandom(_0x2f821b[_0x4eea('0x5c')],_0x2f821b['dialRandomLastDigitCallerIdNumber']):_0x2f821b['dialOriginateCallerIdNumber']);if(_0x4fae34){_0x67951e[_0x4eea('0x18d')]=_0x4aa1ca['actions'][_0x15effd][_0x4eea('0x18e')]=extractCalleridName(_0x4fae34);_0x67951e['XMD-ORIGINATECALLERIDNUM']=_0x4aa1ca[_0x4eea('0x2b')][_0x15effd][_0x4eea('0x18f')]=extractCalleridNumber(_0x4fae34);}return ami[_0x4eea('0x190')]({'actionid':_0x15effd,'action':_0x4eea('0x172'),'channel':_0x4aa1ca[_0x4eea('0xe1')](_0x2f821b[_0x4eea('0x79')])?util[_0x4eea('0x7f')](_0x4eea('0x191'),_0x2f821b['Trunk'][_0x4eea('0x41')],isNotNull(_0x2f821b[_0x4eea('0x5e')])?_0x2f821b['dialPrefix']['trim']()||'':'',_0x2f821b[_0x4eea('0x192')]>0x0?_0x5d94c6[_0x4eea('0x174')][_0x4eea('0x175')]['substring'](_0x2f821b[_0x4eea('0x192')]):_0x5d94c6['Contact'][_0x4eea('0x175')]):util[_0x4eea('0x7f')]('SIP/%s/%s%s',_[_0x4eea('0xb4')](_0x2f821b['TrunkBackup'])?_0x2f821b[_0x4eea('0x79')][_0x4eea('0x41')]:_0x2f821b[_0x4eea('0x18c')]['name'],isNotNull(_0x2f821b[_0x4eea('0x5e')])?_0x2f821b[_0x4eea('0x5e')]['trim']()||'':'',_0x2f821b[_0x4eea('0x192')]>0x0?_0x5d94c6[_0x4eea('0x174')][_0x4eea('0x175')][_0x4eea('0x193')](_0x2f821b[_0x4eea('0x192')]):_0x5d94c6[_0x4eea('0x174')]['phone']),'callerid':_0x4fae34,'Exten':_0x4eea('0x17a'),'Context':_0x4eea('0x194'),'Priority':'1','variable':_0x67951e,'timeout':(_0x2f821b['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x15effd})[_0x4eea('0xbc')](function(_0x3bb00e){return _0x408c83(_0x3bb00e);})[_0x4eea('0xbd')](function(_0x14a5ab){_0x2f821b['outboundOriginateFailureCallsDay']+=0x1;var _0x149042=new History(_0x4aa1ca[_0x4eea('0x2b')][_0x15effd]);logger[_0x4eea('0x9a')](util[_0x4eea('0x7f')](_0x4eea('0x195'),JSON[_0x4eea('0x7c')](_0x14a5ab)));_0x149042['state']=0xe;_0x149042[_0x4eea('0xac')]=_0x4eea('0x196');_0x149042[_0x4eea('0xae')]=moment()[_0x4eea('0x7f')](_0x4eea('0xfd'));_0x149042[_0x4eea('0xad')]=_0x149042['starttime'];_0x4aa1ca['createHistory'](_0x149042)[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x197')));_0x4aa1ca['moveContactManagedDialer'](_0x149042)['catch'](loggerCatch(_0x4eea('0x197')))[_0x4eea('0x22')](function(){delete _0x4aa1ca['actions'][_0x15effd];return _0x37bd21(msgResponse(_0x4eea('0x172'),_0x4eea('0x198'),_0x4eea('0x199')));});});});};Dialer[_0x4eea('0x1f')][_0x4eea('0x19a')]=function(_0x5ab292){var _0x27bba3=this[_0x4eea('0x2b')][_0x5ab292[_0x4eea('0x12c')]];if(_0x27bba3){delete this['actions'][_0x5ab292[_0x4eea('0x12c')]];_0x27bba3['responsetime']=moment()['format'](_0x4eea('0xfd'));var _0x29c5ad=_0x27bba3[_0x4eea('0x4d')]===_0x4eea('0x7e')?this[_0x4eea('0x26')][_0x27bba3[_0x4eea('0xb7')]]:this['voiceQueues'][_0x27bba3['getQueue']()];if(!this[_0x4eea('0xe0')](_0x5ab292[_0x4eea('0x19b')])){this[_0x4eea('0xb9')](_0x29c5ad);return this[_0x4eea('0x19c')](_0x27bba3,_0x29c5ad,_0x5ab292)[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x19d')));}this['uniqueId'][_0x5ab292[_0x4eea('0xeb')]]=_0x27bba3;}};Dialer[_0x4eea('0x1f')][_0x4eea('0x19e')]=function(_0x2f384e,_0xad1a17,_0x4f0e1b){var _0x3c0d13=new History(_0xad1a17);if(_0x3c0d13[_0x4eea('0xf6')]+_0x3c0d13['countcongestionretry']+_0x3c0d13[_0x4eea('0xf7')]+_0x3c0d13[_0x4eea('0x105')]+_0x3c0d13['countdropretry']+_0x3c0d13[_0x4eea('0x127')]+_0x3c0d13[_0x4eea('0xf4')]+_0x3c0d13[_0x4eea('0x107')]>=_0x4f0e1b[_0x4eea('0xf8')]-0x1){return!![];}switch(_0x2f384e){case 0x3:if(_0x3c0d13[_0x4eea('0xf7')]>=_0x4f0e1b[_0x4eea('0x19f')]-0x1){return!![];}this[_0x4eea('0xc6')]({'active':![],'countnoanswerretry':_0x3c0d13[_0x4eea('0xf7')]+=0x1,'scheduledat':moment()[_0x4eea('0xfa')](_0x4f0e1b[_0x4eea('0x1a0')],_0x4eea('0xfc'))['format'](_0x4eea('0xfd')),'ContactId':_0x3c0d13[_0x4eea('0x10b')],'ListId':_0x3c0d13[_0x4eea('0xda')],'VoiceQueueId':_0x3c0d13[_0x4eea('0xdc')]||undefined,'CampaignId':_0x3c0d13['CampaignId']||undefined})[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x1a1')));break;case 0x5:if(_0x3c0d13[_0x4eea('0xf6')]>=_0x4f0e1b[_0x4eea('0x1a2')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countbusyretry':_0x3c0d13[_0x4eea('0xf6')]+=0x1,'scheduledat':moment()[_0x4eea('0xfa')](_0x4f0e1b[_0x4eea('0x1a3')],'minutes')[_0x4eea('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c0d13['ContactId'],'ListId':_0x3c0d13[_0x4eea('0xda')],'VoiceQueueId':_0x3c0d13[_0x4eea('0xdc')]||undefined,'CampaignId':_0x3c0d13[_0x4eea('0xdd')]||undefined})[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x1a4')));break;case 0x8:if(_0x3c0d13[_0x4eea('0x104')]>=_0x4f0e1b[_0x4eea('0x1a5')]-0x1){return!![];}this['rescheduleContact']({'active':![],'countcongestionretry':_0x3c0d13['countcongestionretry']+=0x1,'scheduledat':moment()[_0x4eea('0xfa')](_0x4f0e1b[_0x4eea('0x1a6')],_0x4eea('0xfc'))[_0x4eea('0x7f')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c0d13[_0x4eea('0x10b')],'ListId':_0x3c0d13[_0x4eea('0xda')],'VoiceQueueId':_0x3c0d13['VoiceQueueId']||undefined,'CampaignId':_0x3c0d13[_0x4eea('0xdd')]||undefined})[_0x4eea('0xbd')](loggerCatch('[rescheduleContact]\x20[Congestion]'));break;case 0x0:if(_0x3c0d13[_0x4eea('0x105')]>=_0x4f0e1b[_0x4eea('0x1a7')]-0x1){return!![];}else{this[_0x4eea('0xc6')]({'active':![],'countnosuchnumberretry':_0x3c0d13[_0x4eea('0x105')]+=0x1,'scheduledat':moment()[_0x4eea('0xfa')](_0x4f0e1b[_0x4eea('0x1a8')],_0x4eea('0xfc'))[_0x4eea('0x7f')](_0x4eea('0xfd')),'ContactId':_0x3c0d13[_0x4eea('0x10b')],'ListId':_0x3c0d13[_0x4eea('0xda')],'VoiceQueueId':_0x3c0d13[_0x4eea('0xdc')]||undefined,'CampaignId':_0x3c0d13[_0x4eea('0xdd')]||undefined})['catch'](loggerCatch(_0x4eea('0x1a9')));}break;case 0xa:if(_0x3c0d13[_0x4eea('0x106')]>=_0x4f0e1b[_0x4eea('0x120')]-0x1){return!![];}this[_0x4eea('0xc6')]({'active':![],'countdropretry':_0x3c0d13['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x4f0e1b[_0x4eea('0x121')],_0x4eea('0xfc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3c0d13[_0x4eea('0x10b')],'ListId':_0x3c0d13[_0x4eea('0xda')],'VoiceQueueId':_0x3c0d13[_0x4eea('0xdc')]||undefined,'CampaignId':_0x3c0d13[_0x4eea('0xdd')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));break;case 0xb:if(_0x3c0d13[_0x4eea('0x127')]>=_0x4f0e1b[_0x4eea('0x128')]-0x1){return!![];}this[_0x4eea('0xc6')]({'active':![],'countabandonedretry':_0x3c0d13['countabandonedretry']+=0x1,'scheduledat':moment()['add'](_0x4f0e1b[_0x4eea('0x129')],_0x4eea('0xfc'))[_0x4eea('0x7f')](_0x4eea('0xfd')),'ContactId':_0x3c0d13[_0x4eea('0x10b')],'ListId':_0x3c0d13[_0x4eea('0xda')],'VoiceQueueId':_0x3c0d13[_0x4eea('0xdc')]||undefined,'CampaignId':_0x3c0d13[_0x4eea('0xdd')]||undefined})[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x1aa')));break;case 0x13:if(_0x3c0d13['countmachineretry']>=_0x4f0e1b[_0x4eea('0x109')]-0x1){return!![];}this[_0x4eea('0xc6')]({'active':![],'countmachineretry':_0x3c0d13['countmachineretry']+=0x1,'scheduledat':moment()[_0x4eea('0xfa')](_0x4f0e1b[_0x4eea('0xfb')],_0x4eea('0xfc'))[_0x4eea('0x7f')](_0x4eea('0xfd')),'ContactId':_0x3c0d13[_0x4eea('0x10b')],'ListId':_0x3c0d13['ListId'],'VoiceQueueId':_0x3c0d13['VoiceQueueId']||undefined,'CampaignId':_0x3c0d13['CampaignId']||undefined})[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xfe')));break;case 0x14:if(_0x3c0d13[_0x4eea('0x107')]>=_0x4f0e1b['dialAgentRejectMaxRetry']-0x1){return!![];}this['rescheduleContact']({'active':![],'countagentrejectretry':_0x3c0d13[_0x4eea('0x107')]+=0x1,'scheduledat':moment()[_0x4eea('0xfa')](_0x4f0e1b[_0x4eea('0x1ab')],_0x4eea('0xfc'))[_0x4eea('0x7f')](_0x4eea('0xfd')),'ContactId':_0x3c0d13[_0x4eea('0x10b')],'ListId':_0x3c0d13[_0x4eea('0xda')],'VoiceQueueId':_0x3c0d13['VoiceQueueId']||undefined,'CampaignId':_0x3c0d13['CampaignId']||undefined})['catch'](loggerCatch(_0x4eea('0x1ac')));break;default:return!![];}};Dialer[_0x4eea('0x1f')][_0x4eea('0x19c')]=function(_0x46b2ff,_0x351fe2,_0x1b267e){var _0x58d749=this;var _0x4edcfb=new History(_0x46b2ff);return new BPromise(function(_0x784f45,_0x44bd88){if(_[_0x4eea('0x89')](_0x351fe2)&&typeof _0x351fe2!==_0x4eea('0x171')){return _0x44bd88(msgResponse(_0x4eea('0x1ad'),_0x4eea('0x14c'),_0x4eea('0x1ae')));}if(_['isUndefined'](_0x1b267e)&&typeof _0x1b267e!==_0x4eea('0x171')){return _0x44bd88(msgResponse(_0x4eea('0x1ad'),_0x4eea('0x14c'),'evt\x20is\x20undefine'));}switch(_0x1b267e[_0x4eea('0x114')]){case'0':_0x351fe2['outboundNoSuchCallsDay']+=0x1;_0x4edcfb[_0x4eea('0xab')]=0x0;_0x4edcfb['statedesc']=_0x4eea('0x1af');_0x4edcfb[_0x4eea('0x105')]+=0x1;_0x4edcfb[_0x4eea('0x102')]+=0x1;ami['emit'](_0x4eea('0x1b0'),ut['buildObj'](_0x46b2ff,_0x4eea('0x1b1')));_0x58d749[_0x4eea('0xd3')](_0x4edcfb)[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x103')));if(_0x58d749[_0x4eea('0x19e')](0x0,_0x46b2ff,_0x351fe2)){if(_0x4edcfb['countnosuchnumberretry']>=_0x351fe2[_0x4eea('0x1a7')]){_0x58d749[_0x4eea('0xf9')](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1b2'));}else{_0x58d749['stateGlobal'](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1b2'));}}break;case'3':_0x351fe2['outboundNoAnswerCallsDay']+=0x1;_0x4edcfb[_0x4eea('0xab')]=0x3;_0x4edcfb[_0x4eea('0xac')]=_0x4eea('0x1b3');_0x4edcfb[_0x4eea('0xf7')]+=0x1;_0x4edcfb[_0x4eea('0x102')]+=0x1;ami[_0x4eea('0x4c')]('custom:agentnoanswer',ut[_0x4eea('0x1b4')](_0x46b2ff,_0x4eea('0x1b5')));_0x58d749[_0x4eea('0xd3')](_0x4edcfb)[_0x4eea('0xbd')](loggerCatch('[syncAgentComplete][createHistory][3]'));if(_0x58d749[_0x4eea('0x19e')](0x3,_0x46b2ff,_0x351fe2)){if(_0x4edcfb[_0x4eea('0xf7')]>=_0x351fe2[_0x4eea('0x19f')]){_0x58d749['createStateFinal'](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1b6'));}else{_0x58d749[_0x4eea('0x108')](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1b6'));}}break;case'5':_0x351fe2[_0x4eea('0x60')]+=0x1;_0x4edcfb[_0x4eea('0xab')]=0x5;_0x4edcfb[_0x4eea('0xac')]='Busy';_0x4edcfb[_0x4eea('0xf6')]+=0x1;_0x4edcfb[_0x4eea('0x102')]+=0x1;ami['emit'](_0x4eea('0x1b7'),ut[_0x4eea('0x1b4')](_0x46b2ff,_0x4eea('0x1b8')));_0x58d749[_0x4eea('0xd3')](_0x4edcfb)[_0x4eea('0xbd')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x58d749['checkRetriveMax'](0x5,_0x46b2ff,_0x351fe2)){if(_0x4edcfb[_0x4eea('0xf6')]>=_0x351fe2[_0x4eea('0x1a2')]){_0x58d749[_0x4eea('0xf9')](_0x4edcfb,_0x784f45,_0x44bd88,'reason\x205\x20busy');}else{_0x58d749[_0x4eea('0x108')](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1b9'));}}break;case'8':_0x351fe2[_0x4eea('0x61')]+=0x1;_0x4edcfb[_0x4eea('0xab')]=0x8;_0x4edcfb[_0x4eea('0xac')]='Congestion';_0x4edcfb[_0x4eea('0x104')]+=0x1;_0x4edcfb['countglobal']+=0x1;ami[_0x4eea('0x4c')](_0x4eea('0x1ba'),ut[_0x4eea('0x1b4')](_0x46b2ff,_0x4eea('0x1bb')));_0x58d749[_0x4eea('0xd3')](_0x4edcfb)[_0x4eea('0xbd')](loggerCatch('[syncAgentComplete][createHistory][8]'));if(_0x58d749[_0x4eea('0x19e')](0x8,_0x46b2ff,_0x351fe2)){if(_0x4edcfb[_0x4eea('0x104')]>=_0x351fe2['dialCongestionMaxRetry']){_0x58d749['createStateFinal'](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1bc'));}else{_0x58d749[_0x4eea('0x108')](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1bc'));}}break;case'11':_0x351fe2[_0x4eea('0x1bd')]+=0x1;_0x4edcfb['state']=0xb;_0x4edcfb[_0x4eea('0xac')]=_0x4eea('0x126');_0x4edcfb[_0x4eea('0x127')]+=0x1;_0x4edcfb['countglobal']+=0x1;_0x58d749[_0x4eea('0xd3')](_0x4edcfb)[_0x4eea('0xbd')](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x58d749['checkRetriveMax'](0xb,_0x46b2ff,_0x351fe2)){if(_0x4edcfb[_0x4eea('0x127')]>=_0x351fe2['dialAbandonedMaxRetry']){_0x58d749['createStateFinal'](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1be'));}else{_0x58d749[_0x4eea('0x108')](_0x4edcfb,_0x784f45,_0x44bd88,'reason\x2011\x20abandoned');}}break;case'20':_0x351fe2[_0x4eea('0x69')]+=0x1;_0x4edcfb['state']=0x14;_0x4edcfb[_0x4eea('0xac')]=_0x4eea('0x1bf');_0x4edcfb[_0x4eea('0x107')]+=0x1;_0x4edcfb[_0x4eea('0x102')]+=0x1;ami[_0x4eea('0x4c')]('custom:agentreject',ut[_0x4eea('0x1b4')](_0x46b2ff,'agentreject'));_0x58d749[_0x4eea('0xd3')](_0x4edcfb)[_0x4eea('0xbd')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x58d749[_0x4eea('0x19e')](0x14,_0x46b2ff,_0x351fe2)){if(_0x4edcfb['countagentrejectretry']>=_0x351fe2[_0x4eea('0x1c0')]){_0x58d749[_0x4eea('0xf9')](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1c1'));}else{_0x58d749['stateGlobal'](_0x4edcfb,_0x784f45,_0x44bd88,_0x4eea('0x1c1'));}}break;default:_0x351fe2[_0x4eea('0x6a')]+=0x1;_0x4edcfb[_0x4eea('0xab')]=0xc;_0x4edcfb[_0x4eea('0xac')]=_0x1b267e['reason'];_0x58d749[_0x4eea('0xd3')](_0x4edcfb)[_0x4eea('0xbd')](loggerCatch('[syncAgentComplete][createHistory][?]'));if(_0x58d749[_0x4eea('0x19e')](_0x1b267e[_0x4eea('0x114')],_0x46b2ff,_0x351fe2)){if(_0x4edcfb[_0x4eea('0xf6')]+_0x4edcfb[_0x4eea('0x104')]+_0x4edcfb[_0x4eea('0xf7')]+_0x4edcfb[_0x4eea('0x105')]+_0x4edcfb['countdropretry']+_0x4edcfb[_0x4eea('0x127')]+_0x4edcfb[_0x4eea('0xf4')]+_0x4edcfb['countagentrejectretry']>=_0x351fe2['dialGlobalMaxRetry']){_0x58d749[_0x4eea('0x108')](_0x4edcfb,_0x784f45,_0x44bd88,_0x1b267e[_0x4eea('0x114')]);}else{_0x58d749[_0x4eea('0xf9')](_0x4edcfb,_0x784f45,_0x44bd88,_0x1b267e[_0x4eea('0x114')]);}}}});};Dialer['prototype']['stateGlobal']=function(_0x24bde6,_0x1f2de9,_0x187549,_0x4d27f1){var _0x54060a=new Final(_0x24bde6);_0x54060a[_0x4eea('0xab')]=0xf;_0x54060a['statedesc']=_0x4eea('0x1c2');this[_0x4eea('0xf9')](_0x54060a,_0x1f2de9,_0x187549,_0x4d27f1);};Dialer[_0x4eea('0x1f')][_0x4eea('0xf9')]=function(_0x5a78f5,_0xcc0ab0,_0x31437d,_0x58065c){this['moveContactManagedDialer'](_0x5a78f5)[_0x4eea('0xbc')](function(){return _0xcc0ab0(msgResponse(_0x4eea('0x1ad'),_0x4eea('0x1c3'),_0x58065c));})[_0x4eea('0xbd')](function(){return _0x31437d(msgResponse('[moveContactManagedDialer][0]',_0x4eea('0x14c'),_0x4eea('0x1c4')));});};Dialer['prototype']['predictive']=function(_0x24d89a){var _0x5ed611=_0x24d89a['dialPredictiveOptimizationPercentage']/0x64;var _0x58bac7=_0x24d89a['outboundDropCallsDayTimeout']/(_0x24d89a['outboundDropCallsDayTimeout']+_0x24d89a['outboundAnswerCallsDay']);var _0x5f2b00=Math[_0x4eea('0x1c5')](_0x24d89a[_0x4eea('0x74')]*(_0x24d89a[_0x4eea('0x1c6')]/0x64));var _0xebccdd=Math[_0x4eea('0x1c5')](_0x24d89a[_0x4eea('0x74')]*(_0x24d89a[_0x4eea('0x1c7')]/0x64));var _0x3f9c55=_0x24d89a[_0x4eea('0x51')]+_0x24d89a[_0x4eea('0x56')];var _0x441eba=Math[_0x4eea('0x1c8')](_0x24d89a[_0x4eea('0x76')]*_0x24d89a['erlangAbandonmentRate']*_0x24d89a[_0x4eea('0x71')]*_0x24d89a[_0x4eea('0x72')]);if(_[_0x4eea('0x89')](_0x24d89a['startProgressive'])){if(!_['isUndefined'](_0x24d89a[_0x4eea('0x2e')])){_0x24d89a[_0x4eea('0x2e')]=undefined;loggerPredictive[_0x4eea('0x9a')](_0x4eea('0x1c9'),_0x4eea('0x1ca'));}if(!_[_0x4eea('0x89')](_0x24d89a[_0x4eea('0x96')])){loggerPredictive['error']('[startMethodPredictive][StartProgressive]',_0x4eea('0x1cb'));clearInterval(_0x24d89a[_0x4eea('0x96')]);_0x24d89a['handlePredictive']=undefined;}_0x24d89a[_0x4eea('0x2f')]=moment()[_0x4eea('0x7f')](_0x4eea('0xfd'));loggerPredictive[_0x4eea('0x81')](_0x24d89a[_0x4eea('0x41')],_0x4eea('0x1cc'),_0x24d89a[_0x4eea('0x2f')]);this[_0x4eea('0x161')](_0x24d89a,0x1);}else if(ifInterval(_0x24d89a[_0x4eea('0x1cd')],_0x24d89a[_0x4eea('0x2f')])){this['handlePower'](_0x24d89a,0x1);loggerPredictiveCalls[_0x4eea('0x81')]('[startMethodPredictive][StartProgressive][Loop]',_0x24d89a[_0x4eea('0x2f')],_0x24d89a[_0x4eea('0x41')]);_0x24d89a[_0x4eea('0x76')]=0x0;_0x24d89a['predictiveIntervalErlangCallsDroppedCalls']=0x0;}else if(_0x5ed611<_0x58bac7&&_0x24d89a[_0x4eea('0x1ce')]===_0x4eea('0x1cf')){freeVariablesPredictive(_0x24d89a);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x1d0'),'Dropped\x20calls\x20day',_0x58bac7,'startProgressive',_0x24d89a['name']);}else if(_0x441eba<_0x24d89a[_0x4eea('0x70')]&&_0x24d89a['dialPredictiveOptimization']===_0x4eea('0x1cf')){freeVariablesPredictive(_0x24d89a);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x1d1'),_0x4eea('0x1d2'),_0x441eba,'Drop\x20in\x20this\x20interval',_0x24d89a['predictiveIntervalErlangCallsDroppedCalls'],_0x4eea('0x2f'),_0x24d89a['name']);}else if(!ifInterval(_0x24d89a['dialPredictiveInterval'],_0x24d89a['startProgressive'])&&_[_0x4eea('0x89')](_0x24d89a['startPredictive'])&&!_['isUndefined'](_0x24d89a[_0x4eea('0x2f')])){_0x24d89a[_0x4eea('0x2e')]=moment()[_0x4eea('0x7f')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x4eea('0x81')](_0x24d89a[_0x4eea('0x41')],_0x4eea('0x1d3'),_0x24d89a[_0x4eea('0x2e')]);this[_0x4eea('0xc4')](_0x24d89a[_0x4eea('0x1cd')])['then'](this[_0x4eea('0x1d4')](_0x24d89a))[_0x4eea('0xbc')](mergeDataErlangB(_0x24d89a))[_0x4eea('0xbc')](this['startMethodPredictive'](_0x24d89a))[_0x4eea('0xbd')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x24d89a));}else if(!ifInterval(_0x24d89a['dialPredictiveInterval'],_0x24d89a[_0x4eea('0x2e')])){_0x24d89a['predictiveIntervalErlangCallsDroppedCalls']=0x0;_0x24d89a[_0x4eea('0x2e')]=moment()[_0x4eea('0x7f')](_0x4eea('0xfd'));loggerPredictive['info'](_0x24d89a[_0x4eea('0x41')],_0x4eea('0x1d5'),_0x24d89a['startPredictive']);clearInterval(_0x24d89a[_0x4eea('0x96')]);_0x24d89a[_0x4eea('0x96')]=undefined;this['averageHandleTime'](_0x24d89a[_0x4eea('0x1cd')])['then'](this[_0x4eea('0x1d4')](_0x24d89a))[_0x4eea('0xbc')](mergeDataErlangB(_0x24d89a))[_0x4eea('0xbc')](this[_0x4eea('0x1d6')](_0x24d89a))[_0x4eea('0xbd')](loggerCatchPredictive(_0x4eea('0x1d7'),_0x24d89a));}else if(_0x24d89a[_0x4eea('0x74')]&&_0x3f9c55<_0x24d89a[_0x4eea('0x74')]-_0xebccdd){freeVariablesPredictive(_0x24d89a);loggerPredictive['info'](_0x24d89a['name'],_0x4eea('0x1d8'),_0x3f9c55,')\x20are\x20less\x20than\x20threshold\x20(',_0x24d89a[_0x4eea('0x74')],'-',_0xebccdd,'=',_0x24d89a['predictiveIntervalAvailable']-_0xebccdd,')');}else if(_0x24d89a[_0x4eea('0x74')]&&_0x3f9c55>_0x24d89a[_0x4eea('0x74')]+_0x5f2b00){freeVariablesPredictive(_0x24d89a);loggerPredictive[_0x4eea('0x81')](_0x24d89a[_0x4eea('0x41')],_0x4eea('0x1d8'),_0x3f9c55,_0x4eea('0x1d9'),_0x24d89a[_0x4eea('0x74')],'+',_0x5f2b00,'=',_0x24d89a[_0x4eea('0x74')]+_0x5f2b00,')');}};Dialer[_0x4eea('0x1f')][_0x4eea('0x1d4')]=function(_0x15a23a){var _0x51a003=this;return function(_0x1be793){return new BPromise(function(_0x4687bf,_0x308cb0){_['merge'](_0x15a23a,_0x1be793[0x0]);if(checkGetDataPredictive(_0x1be793[0x0])){var _0x4facae=_0x15a23a[_0x4eea('0x74')]=_0x15a23a['talking']+_0x15a23a[_0x4eea('0x51')];var _0x173132=_0x15a23a['dialPredictiveInterval']*0x3c;var _0x72a75a=_0x1be793[0x0]['predictiveIntervalAvgTalktime']+_0x1be793[0x0]['predictiveIntervalAvgHoldtime'];var _0x3c3b1c=(_0x1be793[0x0][_0x4eea('0x6b')]+_0x1be793[0x0][_0x4eea('0x6e')]+_0x1be793[0x0][_0x4eea('0x6d')])/_0x1be793[0x0][_0x4eea('0x75')];_0x15a23a['predictiveIntervalHitRate']=_0x3c3b1c>0x0?_0x3c3b1c:0x1;switch(_0x15a23a[_0x4eea('0x1ce')]){case'dropRate':var _0x3e82f0=_0x15a23a[_0x4eea('0x1da')]/0x64;return _0x51a003[_0x4eea('0x1db')](_0x4facae,_0x173132,_0x72a75a,_0x3c3b1c,_0x3e82f0)[_0x4eea('0xbc')](function(_0x2b8455){return _0x4687bf(_0x2b8455);});case'agentBusyFactor':var _0x3b3f6f=_0x15a23a[_0x4eea('0x1da')]/0x64;return _0x51a003[_0x4eea('0x1dc')](_0x4facae,_0x173132,_0x72a75a,_0x3c3b1c,_0x3b3f6f)['then'](function(_0x28e295){return _0x4687bf(_0x28e295);});default:return _0x308cb0(msgResponse('[getDataPredictive]',_0x4eea('0x14c'),_0x4eea('0x1dd')));}}else{return _0x308cb0(msgResponse(_0x4eea('0x1de'),_0x4eea('0x14c'),_0x4eea('0x1df')));}});};};Dialer['prototype']['getDataPredictiveOld']=function(_0xc6d7c6){var _0x2449ea=this;return function(_0x518a2f){return new BPromise(function(_0x38c1b4,_0x5a0c72){_[_0x4eea('0x93')](_0xc6d7c6,_0x518a2f[0x0]);if(checkGetDataPredictive(_0x518a2f[0x0])){loggerPredictive[_0x4eea('0x81')](JSON[_0x4eea('0x7c')](_0x518a2f[0x0]));if(_0xc6d7c6[_0x4eea('0x1ce')]==='dropRate'){return _0x2449ea[_0x4eea('0xcf')](_0xc6d7c6['id'])[_0x4eea('0xbc')](function(_0x1516c1){var _0xba1077=_0xc6d7c6[_0x4eea('0x52')]-_0x1516c1[0x0][_0x4eea('0x1e0')];var _0x196fa1=_0xc6d7c6[_0x4eea('0x1cd')]*0x3c;var _0x2b590b=_0x518a2f[0x0][_0x4eea('0x6c')]+_0x518a2f[0x0][_0x4eea('0x86')];var _0x2199cd=(_0x518a2f[0x0][_0x4eea('0x6b')]+_0x518a2f[0x0][_0x4eea('0x6e')]+_0x518a2f[0x0][_0x4eea('0x6d')])/_0x518a2f[0x0]['predictiveIntervalTotalCalls'];var _0x32ab91=_0xc6d7c6['dialPredictiveOptimizationPercentage']/0x64;_0xc6d7c6[_0x4eea('0x73')]=_0x1516c1[0x0]['outboundQueuePauses']||0x0;_0xc6d7c6[_0x4eea('0x71')]=_0x2199cd>0x0?_0x2199cd:0x1;return _0x2449ea[_0x4eea('0x1db')](_0xba1077,_0x196fa1,_0x2b590b,_0x2199cd,_0x32ab91);})[_0x4eea('0xbc')](function(_0x4cc896){return _0x38c1b4(_0x4cc896);})[_0x4eea('0xbd')](function(_0x3af254){return _0x5a0c72(msgResponse(_0x4eea('0x1e1'),'Failure',JSON[_0x4eea('0x7c')](_0x3af254)));});}if(_0xc6d7c6[_0x4eea('0x1ce')]===_0x4eea('0x1e2')){return _0x2449ea[_0x4eea('0xcf')](_0xc6d7c6['id'])[_0x4eea('0xbc')](function(_0x1c3c21){var _0x460605=_0xc6d7c6[_0x4eea('0x52')]-_0x1c3c21[0x0][_0x4eea('0x1e0')];var _0x4dbe4d=_0xc6d7c6[_0x4eea('0x1cd')]*0x3c;var _0x560c60=_0x518a2f[0x0][_0x4eea('0x6c')]+_0x518a2f[0x0][_0x4eea('0x86')];var _0x4bfb32=(_0x518a2f[0x0][_0x4eea('0x6b')]+_0x518a2f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x518a2f[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0x518a2f[0x0][_0x4eea('0x75')];var _0x42930f=_0xc6d7c6[_0x4eea('0x1da')]/0x64;_0xc6d7c6[_0x4eea('0x73')]=_0x1c3c21[0x0]['outboundQueuePauses']||0x0;_0xc6d7c6['predictiveIntervalHitRate']=_0x4bfb32>0x0?_0x4bfb32:0x1;return _0x2449ea['busyFactor'](_0x460605,_0x4dbe4d,_0x560c60,_0x4bfb32,_0x42930f);})[_0x4eea('0xbc')](function(_0x368398){return _0x38c1b4(_0x368398);})[_0x4eea('0xbd')](function(_0x4381e9){return _0x5a0c72(msgResponse(_0x4eea('0x1e1'),_0x4eea('0x14c'),JSON[_0x4eea('0x7c')](_0x4381e9)));});}}else{return _0x5a0c72(msgResponse(_0x4eea('0x1de'),_0x4eea('0x14c'),_0x4eea('0x1df')));}});};};Dialer['prototype'][_0x4eea('0x1d6')]=function(_0x19bff7){var _0x366b8d=this;return function(){var _0x45a532=0x0;var _0x458cd4=Math[_0x4eea('0x1c8')](_0x19bff7[_0x4eea('0x77')]*0x3e8);if(_0x458cd4>0x0){_0x458cd4=_0x458cd4<0x64?0x64:_0x458cd4;loggerPredictive[_0x4eea('0x81')](_0x19bff7[_0x4eea('0x41')],_0x4eea('0x1e3'),_0x458cd4,_0x4eea('0x49'));_0x19bff7['handlePredictive']=setInterval(function(){_0x366b8d['handlePredictive'](_0x19bff7);loggerPredictiveCalls['info'](_0x4eea('0x1e4'),_0x45a532+=0x1);},_0x458cd4);}else{loggerPredictive[_0x4eea('0x81')](_0x19bff7[_0x4eea('0x41')],_0x4eea('0x1e5'));}};};Dialer[_0x4eea('0x1f')][_0x4eea('0x1e6')]=function(_0x28e29f,_0xfe30){var _0x291339=this;return function(_0x59af64){if(_[_0x4eea('0x47')](_0x59af64)){if(_[_0x4eea('0xb4')](_0xfe30[_0x4eea('0xdb')])||!_0xfe30['recallme']){if(_0x28e29f[_0x4eea('0x5a')]===_0x4eea('0xa')){_0x28e29f[_0x4eea('0x133')]=_[_0x4eea('0x89')](_0x28e29f[_0x4eea('0x133')])?!![]:_0x28e29f['queueStatusComplete'];var _0x305efa=uuid['v4']();_0x291339[_0x4eea('0x2b')][_0x305efa]=new Action(_0x28e29f,_0xfe30,_0x305efa);loggerBooked[_0x4eea('0x81')](_0x4eea('0x1e7'),_0x305efa,'queueStatusComplete:\x20',JSON[_0x4eea('0x7c')](_0x28e29f[_0x4eea('0x133')]),_0x4eea('0x1e8'),_0x28e29f[_0x4eea('0x41')]);if(_0x28e29f[_0x4eea('0x133')]){_0x28e29f['queueStatusComplete']=![];_0x291339['queueBooked'][_0x291339[_0x4eea('0x2b')][_0x305efa]['queue']]=[];ami[_0x4eea('0x190')]({'actionid':_0x305efa,'action':_0x4eea('0x1e9'),'queue':_0x28e29f[_0x4eea('0x41')]})[_0x4eea('0xbd')](function(){_0x291339[_0x4eea('0xb9')](_0x28e29f);_0x291339[_0x4eea('0xc6')]({'active':![],'ContactId':_0x291339[_0x4eea('0x2b')][_0x305efa]['ContactId'],'ListId':_0x291339[_0x4eea('0x2b')][_0x305efa][_0x4eea('0xda')],'VoiceQueueId':_0x291339[_0x4eea('0x2b')][_0x305efa][_0x4eea('0xdc')]||undefined,'CampaignId':_0x291339[_0x4eea('0x2b')][_0x305efa][_0x4eea('0xdd')]||undefined})[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x1ea')));delete _0x291339[_0x4eea('0x2b')][_0x305efa];});}else{loggerBooked['info'](_0x4eea('0x1eb'),JSON[_0x4eea('0x7c')](_0x28e29f[_0x4eea('0x133')]),'Queue:\x20',_0x28e29f[_0x4eea('0x41')]);_0x291339[_0x4eea('0xb9')](_0x28e29f);_0x291339[_0x4eea('0xc6')]({'active':![],'ContactId':_0x291339['actions'][_0x305efa][_0x4eea('0x10b')],'ListId':_0x291339[_0x4eea('0x2b')][_0x305efa][_0x4eea('0xda')],'VoiceQueueId':_0x291339[_0x4eea('0x2b')][_0x305efa]['VoiceQueueId']||undefined,'CampaignId':_0x291339[_0x4eea('0x2b')][_0x305efa]['CampaignId']||undefined})['catch'](loggerCatch(_0x4eea('0x1ea')));delete _0x291339[_0x4eea('0x2b')][_0x305efa];}}else{return _0x291339[_0x4eea('0x1ec')](_0x28e29f,_0xfe30);}}else{if(getDiff(_0xfe30['scheduledat'])<_0x28e29f[_0x4eea('0x1ed')]*0x3c){if(_0xfe30[_0x4eea('0x1ee')]&&!_0xfe30[_0x4eea('0x1ee')]['voicePause']){_0x291339['preview'][_0x4eea('0x13b')](_0xfe30['id'])[_0x4eea('0x22')](function(){_0x291339[_0x4eea('0xb9')](_0x28e29f);});}else{_0x291339[_0x4eea('0xc8')]({'active':![]},_0xfe30['id'],0x1)[_0x4eea('0x22')](function(){_0x291339['updateOriginated'](_0x28e29f);});}}else{_0x28e29f[_0x4eea('0x68')]+=0x1;_0x291339[_0x4eea('0xb9')](_0x28e29f);if(_0x28e29f[_0x4eea('0x1ef')]){_0x291339[_0x4eea('0xc6')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0xfe30['ContactId'],'ListId':_0xfe30[_0x4eea('0xda')],'VoiceQueueId':_0xfe30['VoiceQueueId']||undefined,'CampaignId':_0xfe30['CampaignId']||undefined})[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x1f0')));_0x291339[_0x4eea('0xd3')](createObjHistory(_0x28e29f,_0xfe30,_0x4eea('0x1f1'),0x17,_0x4eea('0x1f2')))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0x1f3')));}else{_0x291339[_0x4eea('0xd9')](createObjHistory(_0x28e29f,_0xfe30,_0x4eea('0x1f4'),0x16,_0x4eea('0x1f5')),_0x4eea('0x1f6'),'[Originate][HistoryRecallClose]');}}}}else{_0x28e29f[_0x4eea('0x5f')]+=0x1;_0x291339[_0x4eea('0xd9')](createObjHistory(_0x28e29f,_0xfe30,_0x4eea('0x1f7'),0xd,_0x4eea('0x1f8')),_0x4eea('0x1f9'),_0x4eea('0x1fa'));throw _0x4eea('0x1fb');}};};Dialer['prototype']['handleIvr']=function(_0x23c902){var _0x650c5=this;var _0x25c200=_0x23c902['limitCalls']-_0x23c902[_0x4eea('0x9d')]-_0x23c902['temp'];emitCampaignSummary(_0x23c902);if(_0x25c200>0x0){if(_0x25c200>this[_0x4eea('0x29')]){_0x25c200=this[_0x4eea('0x29')];}_0x23c902[_0x4eea('0xcb')]+=_0x25c200;this[_0x4eea('0xcd')](_0x23c902['id'],_0x25c200,_0x23c902['dialOrderByScheduledAt'],_0x23c902)[_0x4eea('0xbc')](function(_0x56b1b8){_0x23c902[_0x4eea('0xcb')]-=_0x25c200;_0x23c902['temp']=_0x23c902['temp']>0x0?_0x23c902['temp']:0x0;if(!checkContactEmpty(_0x56b1b8)){_0x23c902[_0x4eea('0x40')]=_0x4eea('0xa3');logger[_0x4eea('0x81')]('[getContactCampaign2][Empty]'+_0x23c902[_0x4eea('0x41')]);}else{_0x23c902[_0x4eea('0x9d')]+=_0x56b1b8[_0x4eea('0x137')];_0x23c902['message']=_0x4eea('0x1fc');for(var _0x1c3416=0x0;_0x1c3416<_0x56b1b8[_0x4eea('0x137')];_0x1c3416+=0x1){_0x23c902[_0x4eea('0x1fd')]+=0x1;if(_[_0x4eea('0xb4')](_0x56b1b8[_0x1c3416])||_[_0x4eea('0xb4')](_0x56b1b8[_0x1c3416][_0x4eea('0x174')])||_[_0x4eea('0xb4')](_0x56b1b8[_0x1c3416][_0x4eea('0x174')][_0x4eea('0x175')])){_0x650c5[_0x4eea('0x1fe')]('[actionOriginate]\x20',_0x23c902,_0x56b1b8[_0x1c3416]);}else{_0x650c5['checkIsBlackListIvr'](_[_0x4eea('0x131')](_0x56b1b8[_0x1c3416],[_0x4eea('0xdd'),'Contact.phone']))['then'](_0x650c5[_0x4eea('0x1e6')](_0x23c902,_0x56b1b8[_0x1c3416]))[_0x4eea('0xbd')](_0x650c5[_0x4eea('0xd7')](_0x4eea('0x1ff'),_0x23c902));}}}})[_0x4eea('0xbd')](loggerGetContactDialer(_0x4eea('0x200'),_0x23c902,_0x25c200));}};Dialer[_0x4eea('0x1f')]['handlePower']=function(_0x9b7702,_0x5c9eac){var _0x2a21f7=this;var _0x457629=[];var _0x21fa5b=_0x5c9eac>=0x1?_0x5c9eac:0x1;if(_0x9b7702[_0x4eea('0x5a')]===_0x4eea('0xa')){_0x21fa5b=0x1;}var _0x54c939=Math[_0x4eea('0x1c8')](_0x9b7702[_0x4eea('0x51')]*_0x21fa5b)-_0x9b7702[_0x4eea('0x9d')]-_0x9b7702[_0x4eea('0xcb')];emitVoiceQueueSummary(_0x9b7702);if(_0x9b7702[_0x4eea('0x201')]>0x0){var _0x8c15cb=_0x9b7702['dialLimitQueue']-_0x9b7702['originated']-_0x9b7702['talking']-_0x9b7702[_0x4eea('0xcb')]-_0x9b7702[_0x4eea('0xa5')];if(_0x54c939>_0x8c15cb){_0x54c939=_0x8c15cb;}}if(_0x54c939>0x0){if(_0x9b7702[_0x4eea('0x5a')]===_0x4eea('0xa')){_0x54c939=0x1;}if(_0x54c939>this[_0x4eea('0x29')]){_0x54c939=this[_0x4eea('0x29')];}_0x9b7702[_0x4eea('0xcb')]+=_0x54c939;for(var _0x406e4b in this[_0x4eea('0x27')]){if(typeof this[_0x4eea('0x27')][_0x406e4b]!==_0x4eea('0x9e')){if(this[_0x4eea('0x27')][_0x406e4b][_0x4eea('0xab')]===_0x4eea('0x202')&&this[_0x4eea('0x27')][_0x406e4b][_0x4eea('0xe3')]===_0x4eea('0xe4')){_0x457629['push'](this[_0x4eea('0x27')][_0x406e4b]['id']);}}}this[_0x4eea('0xca')](_0x9b7702['id'],_0x457629,_0x54c939,_0x9b7702[_0x4eea('0x203')],_0x9b7702)['then'](function(_0x4f8067){_0x9b7702[_0x4eea('0xcb')]-=_0x54c939;_0x9b7702[_0x4eea('0xcb')]=_0x9b7702[_0x4eea('0xcb')]>0x0?_0x9b7702[_0x4eea('0xcb')]:0x0;if(!checkContactEmpty(_0x4f8067)){_0x2a21f7['countReScheduled'](_0x9b7702)[_0x4eea('0xbc')](sendMessageReschedule(_0x9b7702))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xbe')));}else{_0x9b7702[_0x4eea('0x9d')]+=_0x4f8067[_0x4eea('0x137')];_0x9b7702[_0x4eea('0x40')]=_0x9b7702[_0x4eea('0x5a')]===_0x4eea('0xa')?_0x4eea('0x179'):'RUNNING';for(var _0x1d6a75=0x0;_0x1d6a75<_0x4f8067[_0x4eea('0x137')];_0x1d6a75+=0x1){if(_[_0x4eea('0xb4')](_0x4f8067[_0x1d6a75])||_[_0x4eea('0xb4')](_0x4f8067[_0x1d6a75]['Contact'])||_[_0x4eea('0xb4')](_0x4f8067[_0x1d6a75][_0x4eea('0x174')]['phone'])){_0x2a21f7['emptyContact']('[actionOriginate]\x20',_0x9b7702,_0x4f8067[_0x1d6a75]);}else{_0x2a21f7['checkIsBlackList'](_[_0x4eea('0x131')](_0x4f8067[_0x1d6a75],[_0x4eea('0xdc'),_0x4eea('0x204')]))[_0x4eea('0xbc')](_0x2a21f7['checkContactBlack'](_0x9b7702,_0x4f8067[_0x1d6a75]))['catch'](_0x2a21f7[_0x4eea('0xd7')]('[actionOriginate]\x20',_0x9b7702));}}}})[_0x4eea('0xbd')](loggerGetContactDialer(_0x4eea('0x205'),_0x9b7702,_0x54c939));}};Dialer[_0x4eea('0x1f')][_0x4eea('0x96')]=function(_0x2a6de3){if(_0x2a6de3[_0x4eea('0x201')]>0x0){var _0x2e7d11=_0x2a6de3['dialLimitQueue']-_0x2a6de3[_0x4eea('0x9d')]-_0x2a6de3[_0x4eea('0x56')];if(_0x2e7d11>0x0){this[_0x4eea('0x206')](_0x2a6de3);}else{loggerPredictiveCalls[_0x4eea('0x81')](_0x4eea('0x207'));}}else{this['tryOriginatePredictive'](_0x2a6de3);}};Dialer[_0x4eea('0x1f')][_0x4eea('0x206')]=function(_0x38ac65){var _0x23c3f0=this;var _0x388589=[];_0x38ac65['originated']+=0x1;for(var _0x335c39 in this[_0x4eea('0x27')]){if(typeof this['agents'][_0x335c39]!=='undefined'){if(this[_0x4eea('0x27')][_0x335c39][_0x4eea('0xab')]===_0x4eea('0x202')&&this['agents'][_0x335c39][_0x4eea('0xe3')]===_0x4eea('0xe4')){_0x388589[_0x4eea('0x130')](this['agents'][_0x335c39]['id']);}}}this[_0x4eea('0xca')](_0x38ac65['id'],_0x388589,0x1,_0x38ac65['dialOrderByScheduledAt'],_0x38ac65)['then'](function(_0x130e4b){if(!checkContactEmpty(_0x130e4b)){checkContactLowerLimitOriginate(_0x38ac65,0x1,0x0);_0x23c3f0[_0x4eea('0xbb')](_0x38ac65)['then'](sendMessageReschedule(_0x38ac65))[_0x4eea('0xbd')](loggerCatch(_0x4eea('0xbe')));}else{_0x38ac65[_0x4eea('0x40')]=_0x4eea('0x1fc');if(_['isNil'](_0x130e4b[0x0])||_[_0x4eea('0xb4')](_0x130e4b[0x0][_0x4eea('0x174')])||_['isNil'](_0x130e4b[0x0][_0x4eea('0x174')][_0x4eea('0x175')])){_0x23c3f0[_0x4eea('0x1fe')]('[actionOriginate]\x20',_0x38ac65,_0x130e4b[0x0]);}else{_0x23c3f0[_0x4eea('0xbf')](_[_0x4eea('0x131')](_0x130e4b[0x0],[_0x4eea('0xdc'),_0x4eea('0x204')]))[_0x4eea('0xbc')](_0x23c3f0[_0x4eea('0x1e6')](_0x38ac65,_0x130e4b[0x0]))['catch'](_0x23c3f0[_0x4eea('0xd7')](_0x4eea('0x208'),_0x38ac65));}}})[_0x4eea('0xbd')](loggerGetContactDialer('[getContactDialerPredictive]',_0x38ac65,0x1));emitVoiceQueueSummary(_0x38ac65);};Dialer['prototype'][_0x4eea('0x1db')]=function(_0xd5a36a,_0x32cddc,_0x359c7e,_0x19b9bd,_0x1bb965,_0x4529a0){loggerPredictive[_0x4eea('0x81')](_0x4eea('0x209'));loggerPredictive[_0x4eea('0x81')](_0x4eea('0x20a'),_0xd5a36a);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x20b'),_0x32cddc);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x20c'),_0x359c7e);loggerPredictive['info'](_0x4eea('0x20d'),_0x19b9bd);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x20e'),_0x1bb965);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x88'));return new BPromise(function(_0x380664,_0x5b542c){if(_0xd5a36a<=0x0||isNaN(_0xd5a36a)){return _0x5b542c(msgResponse('[abandonmentRate]',_0x4eea('0x198'),_0x4eea('0x20f')+_0xd5a36a));}if(_0x359c7e<=0x0||isNaN(_0x359c7e)){return _0x5b542c(msgResponse('[abandonmentRate]',_0x4eea('0x198'),'Ts\x20=\x20'+_0x359c7e));}if(_0x19b9bd<=0x0||isNaN(_0x19b9bd)){return _0x5b542c(msgResponse('[abandonmentRate]','Error',_0x4eea('0x210')+_0x19b9bd));}if(_0x32cddc<=0x0||isNaN(_0x32cddc)){return _0x5b542c(msgResponse('[abandonmentRate]',_0x4eea('0x198'),_0x4eea('0x211')+_0x32cddc));}if(_0x1bb965<=0x0||isNaN(_0x1bb965)){return _0x5b542c(msgResponse(_0x4eea('0x212'),_0x4eea('0x198'),_0x4eea('0x213')+_0x1bb965));}_0x4529a0=_0x4529a0||0x0;var _0x2d7304=0x1/_0x359c7e;var _0x5d4582=0x0;var _0xf078f2=0x0;var _0x5bf1fb=0x0;var _0x39df67=0x0;for(var _0x2476bb=0x0;_0x5bf1fb<_0x1bb965;_0x2476bb+=0x1){_0xf078f2=_0x2476bb/_0x32cddc;_0x5d4582=(_0x19b9bd*_0xf078f2+_0x4529a0)/_0x2d7304;_0x5bf1fb=erlangb(_0x5d4582,_0xd5a36a);_0x39df67=_0x5d4582/_0xd5a36a*(0x1-erlangb(_0x5d4582,_0xd5a36a));}return _0x380664({'erlangCalls':_0x2476bb,'erlangCallToSecond':_0x32cddc/_0x2476bb,'erlangAbandonmentRate':_0x5bf1fb,'erlangBusyFactor':_0x39df67});});};Dialer[_0x4eea('0x1f')][_0x4eea('0x1dc')]=function(_0x68f71b,_0x56f125,_0x3b0331,_0x4a464a,_0x210128,_0x19a614){loggerPredictive[_0x4eea('0x81')]('----\x20Agent\x20Busy\x20Factor\x20----');loggerPredictive[_0x4eea('0x81')](_0x4eea('0x20a'),_0x68f71b);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x20b'),_0x56f125);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x20c'),_0x3b0331);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x20d'),_0x4a464a);loggerPredictive['info']('Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x210128);loggerPredictive[_0x4eea('0x81')](_0x4eea('0x88'));return new BPromise(function(_0x108349,_0x38c10c){if(_0x68f71b<=0x0||isNaN(_0x68f71b)){return _0x38c10c(msgResponse(_0x4eea('0x214'),_0x4eea('0x198'),_0x4eea('0x20f')+_0x68f71b));}if(_0x3b0331<=0x0||isNaN(_0x3b0331)){return _0x38c10c(msgResponse('[busyFactor]','Error','Ts\x20=\x20'+_0x3b0331));}if(_0x4a464a<=0x0||isNaN(_0x4a464a)){return _0x38c10c(msgResponse(_0x4eea('0x214'),'Error',_0x4eea('0x210')+_0x4a464a));}if(_0x56f125<=0x0||isNaN(_0x56f125)){return _0x38c10c(msgResponse(_0x4eea('0x214'),_0x4eea('0x198'),_0x4eea('0x211')+_0x56f125));}if(_0x210128<=0x0||isNaN(_0x210128)){return _0x38c10c(msgResponse('[busyFactor]',_0x4eea('0x198'),_0x4eea('0x215')+_0x210128));}_0x19a614=_0x19a614||0x0;var _0x2fdce3=0x1/_0x3b0331;var _0x56bb21=0x0;var _0xf7ed23=0x0;var _0x2c29d3=0x0;var _0x144542=0x0;for(var _0xea4291=0x0;_0x144542<_0x210128;_0xea4291+=0x1){_0xf7ed23=_0xea4291/_0x56f125;_0x56bb21=(_0x4a464a*_0xf7ed23+_0x19a614)/_0x2fdce3;_0x2c29d3=erlangb(_0x56bb21,_0x68f71b);_0x144542=_0x56bb21/_0x68f71b*(0x1-erlangb(_0x56bb21,_0x68f71b));}return _0x108349({'erlangCalls':_0xea4291,'erlangCallToSecond':_0x56f125/_0xea4291,'erlangAbandonmentRate':_0x2c29d3,'erlangBusyFactor':_0x144542});});};module[_0x4eea('0x216')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/queueCallerAbandon.js b/server/services/ami/dialer/queueCallerAbandon.js index 20c3e46..47d6977 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 _0x7846=['calleridnum','number','starttime','droptime','responsetime','holdtime','talktime','queue','membername','connectedlinename','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','moment','milliseconds','seconds','scheduledat','type','campaigntype','outbound','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname'];(function(_0x9527e7,_0xbd03dc){var _0x504101=function(_0x4d71e9){while(--_0x4d71e9){_0x9527e7['push'](_0x9527e7['shift']());}};_0x504101(++_0xbd03dc);}(_0x7846,0x68));var _0x6784=function(_0x2cff4f,_0x21e344){_0x2cff4f=_0x2cff4f-0x0;var _0x3df848=_0x7846[_0x2cff4f];return _0x3df848;};'use strict';var util=require('util');var _=require(_0x6784('0x0'));var moment=require(_0x6784('0x1'));function getSeconds(_0x528e07,_0x12afaa){var _0x2fb5da=moment(_0x528e07)[_0x6784('0x2')](0x0);var _0x453d23=moment(_0x12afaa)['milliseconds'](0x0);return _0x2fb5da['diff'](_0x453d23,_0x6784('0x3'));}function QueueCallerAbandon(_0xb51c96,_0x2b06f7){this[_0x6784('0x4')]=_0xb51c96[_0x6784('0x4')];this[_0x6784('0x5')]=_0xb51c96[_0x6784('0x5')];this[_0x6784('0x6')]=_0xb51c96[_0x6784('0x5')]===_0x6784('0x7')?'queue':_0xb51c96[_0x6784('0x5')];this[_0x6784('0x8')]=_0xb51c96[_0x6784('0x8')];this['countcongestionretry']=_0xb51c96['countcongestionretry'];this[_0x6784('0x9')]=_0xb51c96['countnoanswerretry'];this[_0x6784('0xa')]=_0xb51c96[_0x6784('0x8')]+_0xb51c96[_0x6784('0xb')]+_0xb51c96[_0x6784('0x9')]+_0xb51c96[_0x6784('0xc')]+_0xb51c96['countdropretry']+_0xb51c96[_0x6784('0xd')]+_0xb51c96[_0x6784('0xe')]+_0xb51c96[_0x6784('0xf')];this[_0x6784('0xc')]=_0xb51c96[_0x6784('0xc')];this[_0x6784('0x10')]=_0xb51c96['countdropretry'];this['countabandonedretry']=_0xb51c96[_0x6784('0xd')];this[_0x6784('0xe')]=_0xb51c96['countmachineretry'];this[_0x6784('0xf')]=_0xb51c96[_0x6784('0xf')];this[_0x6784('0x11')]=_0x2b06f7[_0x6784('0x11')];this[_0x6784('0x12')]=_0xb51c96['name'];this[_0x6784('0x13')]=_0xb51c96[_0x6784('0x14')];this[_0x6784('0x15')]=_0xb51c96[_0x6784('0x15')];this['responsetime']=_0xb51c96['responsetime'];this[_0x6784('0x16')]=_0xb51c96[_0x6784('0x16')];this['endtime']=this[_0x6784('0x16')];this['ringtime']=getSeconds(_0xb51c96[_0x6784('0x17')],_0xb51c96['starttime']);this[_0x6784('0x18')]=getSeconds(this[_0x6784('0x16')],_0xb51c96['responsetime']);this[_0x6784('0x19')]=0x0;this[_0x6784('0x1a')]=_0x2b06f7[_0x6784('0x1a')];this[_0x6784('0x1b')]=_0x2b06f7[_0x6784('0x1c')];this['reason']=_0x2b06f7['reason'];this[_0x6784('0x1d')]=_0xb51c96[_0x6784('0x1d')];this['callbackuniqueid']=_0xb51c96[_0x6784('0x1e')];this[_0x6784('0x1f')]=_0xb51c96[_0x6784('0x1f')];this[_0x6784('0x20')]=_0xb51c96[_0x6784('0x20')];this[_0x6784('0x21')]=_0xb51c96[_0x6784('0x21')];this[_0x6784('0x22')]=_0xb51c96[_0x6784('0x22')];this[_0x6784('0x23')]=_0xb51c96[_0x6784('0x23')];this[_0x6784('0x24')]=_0xb51c96['VoiceQueueId'];this['CampaignId']=_0xb51c96[_0x6784('0x25')];this[_0x6784('0x26')]=_0xb51c96[_0x6784('0x26')]||'';this[_0x6784('0x27')]=_0xb51c96[_0x6784('0x27')]||'';}module[_0x6784('0x28')]=QueueCallerAbandon; \ No newline at end of file +var _0x8cb8=['starttime','responsetime','droptime','ringtime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','exports','lodash','milliseconds','type','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','uniqueid','calleridname','name','number'];(function(_0x19a8ab,_0xd576af){var _0x98ce9f=function(_0x5c2174){while(--_0x5c2174){_0x19a8ab['push'](_0x19a8ab['shift']());}};_0x98ce9f(++_0xd576af);}(_0x8cb8,0x1da));var _0x88cb=function(_0x2d4661,_0x2da65c){_0x2d4661=_0x2d4661-0x0;var _0x42ed1e=_0x8cb8[_0x2d4661];return _0x42ed1e;};'use strict';var util=require('util');var _=require(_0x88cb('0x0'));var moment=require('moment');function getSeconds(_0x3bdb5c,_0x5dcdbe){var _0x5937da=moment(_0x3bdb5c)[_0x88cb('0x1')](0x0);var _0x34501e=moment(_0x5dcdbe)[_0x88cb('0x1')](0x0);return _0x5937da['diff'](_0x34501e,'seconds');}function QueueCallerAbandon(_0x279265,_0x31cbd9){this['scheduledat']=_0x279265['scheduledat'];this[_0x88cb('0x2')]=_0x279265['type'];this['campaigntype']=_0x279265[_0x88cb('0x2')]==='outbound'?'queue':_0x279265[_0x88cb('0x2')];this[_0x88cb('0x3')]=_0x279265[_0x88cb('0x3')];this[_0x88cb('0x4')]=_0x279265['countcongestionretry'];this[_0x88cb('0x5')]=_0x279265[_0x88cb('0x5')];this[_0x88cb('0x6')]=_0x279265[_0x88cb('0x3')]+_0x279265[_0x88cb('0x4')]+_0x279265['countnoanswerretry']+_0x279265['countnosuchnumberretry']+_0x279265[_0x88cb('0x7')]+_0x279265[_0x88cb('0x8')]+_0x279265[_0x88cb('0x9')]+_0x279265[_0x88cb('0xa')];this[_0x88cb('0xb')]=_0x279265[_0x88cb('0xb')];this[_0x88cb('0x7')]=_0x279265[_0x88cb('0x7')];this[_0x88cb('0x8')]=_0x279265['countabandonedretry'];this[_0x88cb('0x9')]=_0x279265[_0x88cb('0x9')];this[_0x88cb('0xa')]=_0x279265[_0x88cb('0xa')];this[_0x88cb('0xc')]=_0x31cbd9[_0x88cb('0xc')];this[_0x88cb('0xd')]=_0x279265[_0x88cb('0xe')];this['calleridnum']=_0x279265[_0x88cb('0xf')];this['starttime']=_0x279265[_0x88cb('0x10')];this[_0x88cb('0x11')]=_0x279265['responsetime'];this[_0x88cb('0x12')]=_0x279265[_0x88cb('0x12')];this['endtime']=this['droptime'];this[_0x88cb('0x13')]=getSeconds(_0x279265[_0x88cb('0x11')],_0x279265[_0x88cb('0x10')]);this['holdtime']=getSeconds(this[_0x88cb('0x12')],_0x279265['responsetime']);this['talktime']=0x0;this[_0x88cb('0x14')]=_0x31cbd9['queue'];this[_0x88cb('0x15')]=_0x31cbd9[_0x88cb('0x16')];this[_0x88cb('0x17')]=_0x31cbd9[_0x88cb('0x17')];this[_0x88cb('0x18')]=_0x279265[_0x88cb('0x18')];this[_0x88cb('0x19')]=_0x279265['callbackuniqueid'];this['callbackat']=_0x279265['callbackat'];this[_0x88cb('0x1a')]=_0x279265[_0x88cb('0x1a')];this['ContactId']=_0x279265[_0x88cb('0x1b')];this[_0x88cb('0x1c')]=_0x279265[_0x88cb('0x1c')];this[_0x88cb('0x1d')]=_0x279265[_0x88cb('0x1d')];this[_0x88cb('0x1e')]=_0x279265[_0x88cb('0x1e')];this[_0x88cb('0x1f')]=_0x279265[_0x88cb('0x1f')];this[_0x88cb('0x20')]=_0x279265['originatecalleridnum']||'';this[_0x88cb('0x21')]=_0x279265[_0x88cb('0x21')]||'';}module[_0x88cb('0x22')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index 3ea13b0..b4d725b 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 _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x4e654f,_0x4e7ba1){var _0x1e70a0=function(_0x195d40){while(--_0x195d40){_0x4e654f['push'](_0x4e654f['shift']());}};_0x1e70a0(++_0x4e7ba1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x23dc09,_0x5ab018){var _0x2e81ea=function(_0x1e2ffb){while(--_0x1e2ffb){_0x23dc09['push'](_0x23dc09['shift']());}};_0x2e81ea(++_0x5ab018);}(_0xa9e0,0x123));var _0x0a9e=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xa9e0[_0x187ee1];return _0x388160;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 33913e6..44bc789 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 _0xf050=['uuid','moment','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./rpcDb','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','newstate','syncNewExten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','syncHangup','originateresponse','syncOriginateResponse','prototype','from-voip-provider','exten','localstationid','uniqueid','channel','name','\x20syncNewchannel\x20','info','variable','hasOwnProperty','value','syncNewState','channelstate','channelstatedesc','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','resolution','transferrate','calleridnum','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20','merge','pick','response','reason','AttachmentId','update','SENDING\x20FAILED\x20','[Fax][Message][Error][Updated]','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','[Fax][Message][Updated]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','send','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','checkAfterSend','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','dir','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]','Empty\x20Fax','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','exports','util','lodash','bluebird'];(function(_0x426281,_0xfe58ba){var _0x2d05b1=function(_0x478698){while(--_0x478698){_0x426281['push'](_0x426281['shift']());}};_0x2d05b1(++_0xfe58ba);}(_0xf050,0x1e5));var _0x0f05=function(_0x36bfdd,_0x425a87){_0x36bfdd=_0x36bfdd-0x0;var _0x2f60c0=_0xf050[_0x36bfdd];return _0x2f60c0;};'use strict';var util=require(_0x0f05('0x0'));var _=require(_0x0f05('0x1'));var BPromise=require(_0x0f05('0x2'));var uuid=require(_0x0f05('0x3'));var moment=require(_0x0f05('0x4'));var path=require(_0x0f05('0x5'));var tiff2pdf=require(_0x0f05('0x6'));var gs=require(_0x0f05('0x7'));var logger=require(_0x0f05('0x8'))(_0x0f05('0x9'));var ami=require(_0x0f05('0xa'));var rpcDb=require(_0x0f05('0xb'));var Channel=require(_0x0f05('0xc'));var ut=require(_0x0f05('0xd'));var Action=require(_0x0f05('0xe'));var faxAccount=require(_0x0f05('0xf'));var attachment=require(_0x0f05('0x10'));var faxMessage=require(_0x0f05('0x11'));function Fax(_0xa2ebdf){this[_0x0f05('0x12')]={};this['faxAccounts']=_0xa2ebdf[_0x0f05('0x13')];this[_0x0f05('0x14')]=_0xa2ebdf[_0x0f05('0x14')];this[_0x0f05('0x15')]={};ami['on'](_0x0f05('0x16'),this[_0x0f05('0x17')][_0x0f05('0x18')](this));ami['on'](_0x0f05('0x19'),this[_0x0f05('0x1a')]['bind'](this));ami['on'](_0x0f05('0x1b'),this['syncNewState']['bind'](this));ami['on']('newexten',this[_0x0f05('0x1c')]['bind'](this));ami['on'](_0x0f05('0x1d'),this[_0x0f05('0x1e')]['bind'](this));ami['on'](_0x0f05('0x1f'),this[_0x0f05('0x20')][_0x0f05('0x18')](this));ami['on']('hangup',this[_0x0f05('0x21')][_0x0f05('0x18')](this));ami['on'](_0x0f05('0x22'),this[_0x0f05('0x23')]['bind'](this));}Fax[_0x0f05('0x24')][_0x0f05('0x17')]=function(_0x23c589){if(_0x23c589['context']===_0x0f05('0x25')){for(var _0x190594 in this[_0x0f05('0x13')]){if(this['faxAccounts']['hasOwnProperty'](_0x190594)){if(_0x23c589[_0x0f05('0x26')]===this[_0x0f05('0x13')][_0x190594][_0x0f05('0x27')]){this[_0x0f05('0x12')][_0x23c589[_0x0f05('0x28')]]={};this[_0x0f05('0x12')][_0x23c589[_0x0f05('0x28')]]['channel']=_0x23c589[_0x0f05('0x29')];this[_0x0f05('0x12')][_0x23c589[_0x0f05('0x28')]]['id']=this['faxAccounts'][_0x190594]['id'];this[_0x0f05('0x12')][_0x23c589[_0x0f05('0x28')]][_0x0f05('0x2a')]=this[_0x0f05('0x13')][_0x190594][_0x0f05('0x2a')];logger['info'](_0x23c589['uniqueid'],_0x0f05('0x2b'));}}}}if(this[_0x0f05('0x15')][_0x23c589['uniqueid']]){this[_0x0f05('0x12')][_0x23c589[_0x0f05('0x28')]]={};this['channels'][_0x23c589[_0x0f05('0x28')]]['channel']=_0x23c589[_0x0f05('0x29')];logger[_0x0f05('0x2c')](_0x23c589[_0x0f05('0x28')],_0x0f05('0x2b'));}};Fax[_0x0f05('0x24')]['syncVarSet']=function(_0xdc51ab){if(this['channels'][_0xdc51ab[_0x0f05('0x28')]]){for(var _0x1dc4be in _0xdc51ab[_0x0f05('0x2d')]){if(_0xdc51ab[_0x0f05('0x2d')][_0x0f05('0x2e')](_0x1dc4be)){this[_0x0f05('0x12')][_0xdc51ab[_0x0f05('0x28')]][_0x1dc4be]=_0xdc51ab[_0x0f05('0x2f')];}}}};Fax[_0x0f05('0x24')][_0x0f05('0x30')]=function(_0x39a869){if(this[_0x0f05('0x12')][_0x39a869[_0x0f05('0x28')]]){this[_0x0f05('0x12')][_0x39a869[_0x0f05('0x28')]][_0x0f05('0x31')]=_0x39a869['channelstate'];this[_0x0f05('0x12')][_0x39a869[_0x0f05('0x28')]][_0x0f05('0x32')]=_0x39a869['channelstatedesc'];}};Fax[_0x0f05('0x24')]['syncNewExten']=function(_0x5d057d){if(this[_0x0f05('0x12')][_0x5d057d[_0x0f05('0x28')]]){for(var _0x213378 in _0x5d057d['variable']){if(_0x5d057d[_0x0f05('0x2d')][_0x0f05('0x2e')](_0x213378)){this[_0x0f05('0x12')][_0x5d057d[_0x0f05('0x28')]][_0x213378]=_0x5d057d[_0x0f05('0x2f')];}}}};Fax[_0x0f05('0x24')][_0x0f05('0x1e')]=function(_0x513109){if(this[_0x0f05('0x12')][_0x513109[_0x0f05('0x28')]]){this['channels'][_0x513109[_0x0f05('0x28')]][_0x0f05('0x33')]=_0x513109[_0x0f05('0x33')];this[_0x0f05('0x12')][_0x513109[_0x0f05('0x28')]]['status']=_0x513109[_0x0f05('0x34')];this['channels'][_0x513109[_0x0f05('0x28')]][_0x0f05('0x27')]=_0x513109['localstationid'];this['channels'][_0x513109[_0x0f05('0x28')]][_0x0f05('0x35')]=_0x513109[_0x0f05('0x35')];logger[_0x0f05('0x2c')](_0x513109[_0x0f05('0x28')],_0x0f05('0x36'));}};Fax[_0x0f05('0x24')][_0x0f05('0x20')]=function(_0x52806e){var _0x2a6356=this;if(this['channels'][_0x52806e['uniqueid']]){var _0x4c6288=this[_0x0f05('0x12')][_0x52806e[_0x0f05('0x28')]]['id'];this[_0x0f05('0x12')][_0x52806e[_0x0f05('0x28')]][_0x0f05('0x37')]=_0x52806e['remotestationid'];this[_0x0f05('0x12')][_0x52806e[_0x0f05('0x28')]]['pagestransferred']=_0x52806e[_0x0f05('0x38')];this[_0x0f05('0x12')][_0x52806e['uniqueid']]['localstationid']=_0x52806e[_0x0f05('0x27')];this[_0x0f05('0x12')][_0x52806e[_0x0f05('0x28')]][_0x0f05('0x39')]=_0x52806e[_0x0f05('0x39')];this[_0x0f05('0x12')][_0x52806e[_0x0f05('0x28')]][_0x0f05('0x3a')]=_0x52806e['transferrate'];this['channels'][_0x52806e[_0x0f05('0x28')]][_0x0f05('0x35')]=_0x52806e[_0x0f05('0x35')];this[_0x0f05('0x12')][_0x52806e[_0x0f05('0x28')]][_0x0f05('0x3b')]=_0x52806e[_0x0f05('0x3b')];if(this[_0x0f05('0x12')][_0x52806e['uniqueid']][_0x0f05('0x38')]>0x0){tiff2pdf(_0x52806e[_0x0f05('0x35')],'/var/opt/motion2/server/files/attachments/',function(_0x19409c){logger['info'](_0x52806e[_0x0f05('0x28')],'\x20result\x20conversion\x20file\x20',_0x19409c[_0x0f05('0x3c')]);attachment['create']({'name':path['parse'](_0x52806e[_0x0f05('0x35')])[_0x0f05('0x2a')],'basename':path[_0x0f05('0x3d')](_0x52806e[_0x0f05('0x35')])[_0x0f05('0x2a')]+_0x0f05('0x3e'),'type':_0x0f05('0x3f')})[_0x0f05('0x40')](function(_0x3621e8){faxAccount[_0x0f05('0x41')](_0x4c6288,{'from':_0x52806e[_0x0f05('0x3b')],'mapKey':_0x0f05('0x9'),'body':path['parse'](_0x52806e['filename'])['name']+_0x0f05('0x3e'),'AttachmentId':_0x3621e8['id']})[_0x0f05('0x42')](function(_0x215aca){logger[_0x0f05('0x43')](_0x52806e['uniqueid'],_0x0f05('0x44'),JSON[_0x0f05('0x45')](_0x215aca));});})['catch'](function(_0x25604a){logger[_0x0f05('0x43')](_0x52806e[_0x0f05('0x28')],_0x0f05('0x46'),JSON[_0x0f05('0x45')](_0x25604a));});});}logger[_0x0f05('0x2c')](_0x52806e['uniqueid'],_0x0f05('0x46'));}};Fax['prototype'][_0x0f05('0x23')]=function(_0x580840){if(this[_0x0f05('0x15')][_0x580840[_0x0f05('0x28')]]){_[_0x0f05('0x47')](this['channels'][_0x580840[_0x0f05('0x28')]],_[_0x0f05('0x48')](_0x580840,[_0x0f05('0x49'),_0x0f05('0x4a')]));}};function updateStatus(_0x22cfc2){if(_0x22cfc2[_0x0f05('0x4b')]){faxMessage[_0x0f05('0x4c')](_0x22cfc2[_0x0f05('0x4b')],{'failMessage':_0x0f05('0x4d')})[_0x0f05('0x40')](function(_0xa1e013){ut['logger'](_0x0f05('0x4e'),_0xa1e013);})[_0x0f05('0x42')](function(_0x119c18){ut[_0x0f05('0x4f')](_0x0f05('0x50'),_0x119c18);});}else{ut[_0x0f05('0x4f')](_0x0f05('0x51'));}}Fax[_0x0f05('0x24')][_0x0f05('0x52')]=function(_0x382a0b,_0x4e9136,_0x14a310){var _0x55efdd=this;var _0x47ac41={};if(_0x4e9136){_0x47ac41={'read':_0x4e9136};}else{_0x47ac41={'failMessage':_0x14a310};}if(this[_0x0f05('0x15')][_0x382a0b][_0x0f05('0x4b')]){faxMessage[_0x0f05('0x4c')](this[_0x0f05('0x15')][_0x382a0b][_0x0f05('0x4b')],_0x47ac41)[_0x0f05('0x40')](function(_0x569057){ut['logger'](_0x0f05('0x53'),_0x569057);})[_0x0f05('0x42')](function(_0x8e2918){ut[_0x0f05('0x4f')]('[Fax][Message][NoUpdate1]',_0x8e2918);})[_0x0f05('0x54')](function(){delete _0x55efdd[_0x0f05('0x12')][_0x382a0b];delete _0x55efdd['actions'][_0x382a0b];});}else{ut[_0x0f05('0x4f')](_0x0f05('0x55'));delete this['channels'][_0x382a0b];delete this['actions'][_0x382a0b];}};Fax[_0x0f05('0x24')][_0x0f05('0x21')]=function(_0x1c0b7a){var _0x507b81=this;if(this[_0x0f05('0x12')][_0x1c0b7a['uniqueid']]){if(this['actions'][_0x1c0b7a[_0x0f05('0x28')]]){this[_0x0f05('0x12')][_0x1c0b7a[_0x0f05('0x28')]]['id']=this[_0x0f05('0x15')][_0x1c0b7a['uniqueid']]['id'];this[_0x0f05('0x12')][_0x1c0b7a[_0x0f05('0x28')]][_0x0f05('0x2a')]=this['actions'][_0x1c0b7a[_0x0f05('0x28')]][_0x0f05('0x2a')];}logger['info'](_0x1c0b7a[_0x0f05('0x28')],this['actions'][_0x1c0b7a[_0x0f05('0x28')]]?_0x0f05('0x56'):_0x0f05('0x57'),JSON[_0x0f05('0x45')](this['channels'][_0x1c0b7a[_0x0f05('0x28')]]));if(this[_0x0f05('0x15')][_0x1c0b7a[_0x0f05('0x28')]]){if(this[_0x0f05('0x12')][_0x1c0b7a[_0x0f05('0x28')]]['faxpages']>0x0&&this[_0x0f05('0x12')][_0x1c0b7a['uniqueid']][_0x0f05('0x1d')]===_0x0f05('0x58')){this[_0x0f05('0x52')](_0x1c0b7a[_0x0f05('0x28')],!![]);}else{this[_0x0f05('0x52')](_0x1c0b7a[_0x0f05('0x28')],![],this[_0x0f05('0x12')][_0x1c0b7a[_0x0f05('0x28')]][_0x0f05('0x59')]?_0x0f05('0x5a')+this[_0x0f05('0x12')][_0x1c0b7a['uniqueid']][_0x0f05('0x59')]:'SENDING\x20FAILED');}}}};Fax[_0x0f05('0x24')][_0x0f05('0x5b')]=function(_0x4cabd8){var _0x88a570=this;return new BPromise(function(_0xc6d0e8,_0x37a4de){_0x88a570['execOriginate'](_0x4cabd8,_0x88a570[_0x0f05('0x13')][_0x4cabd8[_0x0f05('0x5c')]])['then'](function(_0x2ea469){ut[_0x0f05('0x4f')]('[Fax][execOriginate][success]',_0x2ea469);_0xc6d0e8(ut['message'](_0x0f05('0x5d')));})[_0x0f05('0x42')](function(_0x44917b){ut[_0x0f05('0x4f')](_0x0f05('0x5e'),_0x44917b);updateStatus(_0x4cabd8);_0x37a4de(ut[_0x0f05('0x3c')]('Fax\x20failed'));});});};Fax[_0x0f05('0x24')][_0x0f05('0x5f')]=function(_0x17df76){var _0x1fd240=this;return new BPromise(function(_0x596906,_0x3c333a){var _0x49195d=_0x1fd240['checkTrunk'](_0x1fd240['faxAccounts'][_0x17df76[_0x0f05('0x5c')]][_0x0f05('0x60')],_0x17df76);if(_0x49195d[_0x0f05('0x61')]){_0x596906(ut[_0x0f05('0x3c')](_0x0f05('0x62')));}else{_0x3c333a(ut[_0x0f05('0x3c')](_0x49195d['message']));}});};function originate(_0x1fcf14,_0x57a775,_0x1ab075){return new BPromise(function(_0x1f3e38,_0x5489b8){if(_0x1ab075){var _0xca06a=util[_0x0f05('0x63')](_0x0f05('0x64'),path['parse'](_0x1fcf14[_0x0f05('0x5')])[_0x0f05('0x2a')],_0x1fcf14[_0x0f05('0x5')]);gs[_0x0f05('0x65')](_0xca06a)['then'](function(){_0x1fcf14[_0x0f05('0x5')]=util[_0x0f05('0x63')](_0x0f05('0x66'),path[_0x0f05('0x3d')](_0x1fcf14[_0x0f05('0x5')])[_0x0f05('0x67')],path[_0x0f05('0x3d')](_0x1fcf14[_0x0f05('0x5')])[_0x0f05('0x2a')]);_0x57a775['XMF-PATH']=_0x1fcf14[_0x0f05('0x5')];ut[_0x0f05('0x4f')](_0x0f05('0x68'),'');ami[_0x0f05('0x69')](ut['variablesAction'](_0x1fcf14,_0x57a775))['then'](function(_0x443b1d){_0x1f3e38(_0x443b1d);})[_0x0f05('0x42')](function(_0x35570e){_0x5489b8(_0x35570e);});})[_0x0f05('0x42')](function(_0x3ba7af){_0x5489b8(_0x3ba7af);});}else{ami['Action'](ut[_0x0f05('0x6a')](_0x1fcf14,_0x57a775))[_0x0f05('0x40')](function(_0x2ad1a7){_0x1f3e38(_0x2ad1a7);})['catch'](function(_0x244afd){_0x5489b8(_0x244afd);});}});}Fax[_0x0f05('0x24')][_0x0f05('0x6b')]=function(_0x2bba1f,_0x4a7fd4){var _0x461606=this;return new BPromise(function(_0xaf448a,_0x27b39d){var _0x19d6f3=uuid['v4']();var _0x6c3290=ut[_0x0f05('0x6c')](_0x2bba1f,_0x4a7fd4);_0x461606[_0x0f05('0x15')][_0x19d6f3]=new Action(_0x19d6f3,_0x4a7fd4,_0x2bba1f);var _0x54ddd2=_0x461606['actions'][_0x19d6f3];if(path[_0x0f05('0x3d')](_0x2bba1f[_0x0f05('0x5')])['ext']===_0x0f05('0x3e')){originate(_0x54ddd2,_0x6c3290,!![])[_0x0f05('0x40')](function(_0xee46fe){_0xaf448a(_0xee46fe);})[_0x0f05('0x42')](function(_0x37e0aa){_0x27b39d(_0x37e0aa);});}else{originate(_0x54ddd2,_0x6c3290,![])['then'](function(_0x3e3c04){_0xaf448a(_0x3e3c04);})[_0x0f05('0x42')](function(_0x1c3f2b){_0x27b39d(_0x1c3f2b);});}});};Fax[_0x0f05('0x24')][_0x0f05('0x6d')]=function(_0x25853c){return!_[_0x0f05('0x6e')](_0x25853c)&&!_[_0x0f05('0x6e')](_0x25853c[_0x0f05('0x2a')])&&!_[_0x0f05('0x6e')](_0x25853c[_0x0f05('0x6f')])&&_0x25853c['active']&&!_[_0x0f05('0x6e')](this[_0x0f05('0x14')][util[_0x0f05('0x63')](_0x0f05('0x70'),_0x25853c[_0x0f05('0x2a')])])&&!_[_0x0f05('0x6e')](this['trunks'][util[_0x0f05('0x63')]('SIP/%s',_0x25853c[_0x0f05('0x2a')])]['status'])&&(this['trunks'][util[_0x0f05('0x63')](_0x0f05('0x70'),_0x25853c[_0x0f05('0x2a')])][_0x0f05('0x34')]===_0x0f05('0x71')||this[_0x0f05('0x14')][util['format'](_0x0f05('0x70'),_0x25853c[_0x0f05('0x2a')])][_0x0f05('0x34')]===_0x0f05('0x72'));};Fax[_0x0f05('0x24')]['checkTrunk']=function(_0x7b0b3c,_0x16333){if(!this[_0x0f05('0x6d')](_0x7b0b3c)){ut['logger']('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x0f05('0x6e')](_0x7b0b3c)?'':_0x7b0b3c['name']+_0x0f05('0x73'));return{'isValid':![],'message':_0x0f05('0x74')};}if(_[_0x0f05('0x6e')](_0x16333['fax'])){ut[_0x0f05('0x4f')](_0x0f05('0x75'),JSON[_0x0f05('0x45')](_0x16333));return{'isValid':![],'message':_0x0f05('0x76')};}if(_[_0x0f05('0x6e')](_0x16333[_0x0f05('0x5')])){ut[_0x0f05('0x4f')](_0x0f05('0x77'),JSON[_0x0f05('0x45')](_0x16333));return{'isValid':![],'message':_0x0f05('0x78')};}return{'isValid':!![],'message':'Is\x20Valid'};};module[_0x0f05('0x79')]=Fax; \ No newline at end of file +var _0xd917=['[Fax][checkTrunk][Empty\x20path]','Empty\x20path','bluebird','moment','path','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxMessage','faxAccounts','trunks','actions','newchannel','syncNewchannel','bind','varset','syncVarSet','syncNewState','newexten','syncNewExten','faxstatus','syncFaxStatus','receivefax','hangup','originateresponse','syncOriginateResponse','prototype','context','from-voip-provider','exten','localstationid','channels','uniqueid','channel','name','info','\x20syncNewchannel\x20','value','channelstate','channelstatedesc','variable','operation','status','filename','\x20syncFaxStatus\x20','syncReceiveFax','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','parse','.pdf','application/pdf','then','notify','catch','error','\x20receiveFax\x20','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Error][NoUpdate1]','updateStatus','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','syncHangup','\x20hangup\x20sendFile\x20','\x20hangup\x20faxRiceive\x20','stringify','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED:\x20','execOriginate','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','[Fax][execOriginate][failure]','checkTrunk','Trunk','isValid','format','execute','%s/%s.tif','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','addVariables','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','Trunk\x20not\x20working','[Fax][checkTrunk][Empty\x20Fax]'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0xd917,0x1ba));var _0x7d91=function(_0x3f6ca7,_0x49a007){_0x3f6ca7=_0x3f6ca7-0x0;var _0x37d9b6=_0xd917[_0x3f6ca7];return _0x37d9b6;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x7d91('0x0'));var uuid=require('uuid');var moment=require(_0x7d91('0x1'));var path=require(_0x7d91('0x2'));var tiff2pdf=require('tiff2pdf');var gs=require(_0x7d91('0x3'));var logger=require(_0x7d91('0x4'))(_0x7d91('0x5'));var ami=require(_0x7d91('0x6'));var rpcDb=require('./rpcDb');var Channel=require(_0x7d91('0x7'));var ut=require(_0x7d91('0x8'));var Action=require(_0x7d91('0x9'));var faxAccount=require('../rpc/faxAccount');var attachment=require('../rpc/attachment');var faxMessage=require(_0x7d91('0xa'));function Fax(_0xc5571){this['channels']={};this[_0x7d91('0xb')]=_0xc5571[_0x7d91('0xb')];this[_0x7d91('0xc')]=_0xc5571['trunks'];this[_0x7d91('0xd')]={};ami['on'](_0x7d91('0xe'),this[_0x7d91('0xf')][_0x7d91('0x10')](this));ami['on'](_0x7d91('0x11'),this[_0x7d91('0x12')][_0x7d91('0x10')](this));ami['on']('newstate',this[_0x7d91('0x13')][_0x7d91('0x10')](this));ami['on'](_0x7d91('0x14'),this[_0x7d91('0x15')][_0x7d91('0x10')](this));ami['on'](_0x7d91('0x16'),this[_0x7d91('0x17')][_0x7d91('0x10')](this));ami['on'](_0x7d91('0x18'),this['syncReceiveFax'][_0x7d91('0x10')](this));ami['on'](_0x7d91('0x19'),this['syncHangup'][_0x7d91('0x10')](this));ami['on'](_0x7d91('0x1a'),this[_0x7d91('0x1b')][_0x7d91('0x10')](this));}Fax[_0x7d91('0x1c')]['syncNewchannel']=function(_0x17ca7c){if(_0x17ca7c[_0x7d91('0x1d')]===_0x7d91('0x1e')){for(var _0x5d1414 in this['faxAccounts']){if(this[_0x7d91('0xb')]['hasOwnProperty'](_0x5d1414)){if(_0x17ca7c[_0x7d91('0x1f')]===this['faxAccounts'][_0x5d1414][_0x7d91('0x20')]){this[_0x7d91('0x21')][_0x17ca7c[_0x7d91('0x22')]]={};this[_0x7d91('0x21')][_0x17ca7c[_0x7d91('0x22')]]['channel']=_0x17ca7c[_0x7d91('0x23')];this[_0x7d91('0x21')][_0x17ca7c[_0x7d91('0x22')]]['id']=this[_0x7d91('0xb')][_0x5d1414]['id'];this[_0x7d91('0x21')][_0x17ca7c['uniqueid']][_0x7d91('0x24')]=this[_0x7d91('0xb')][_0x5d1414]['name'];logger[_0x7d91('0x25')](_0x17ca7c['uniqueid'],'\x20syncNewchannel\x20');}}}}if(this['actions'][_0x17ca7c[_0x7d91('0x22')]]){this['channels'][_0x17ca7c[_0x7d91('0x22')]]={};this[_0x7d91('0x21')][_0x17ca7c[_0x7d91('0x22')]][_0x7d91('0x23')]=_0x17ca7c[_0x7d91('0x23')];logger[_0x7d91('0x25')](_0x17ca7c[_0x7d91('0x22')],_0x7d91('0x26'));}};Fax[_0x7d91('0x1c')]['syncVarSet']=function(_0x531f30){if(this[_0x7d91('0x21')][_0x531f30[_0x7d91('0x22')]]){for(var _0x308b55 in _0x531f30['variable']){if(_0x531f30['variable']['hasOwnProperty'](_0x308b55)){this[_0x7d91('0x21')][_0x531f30[_0x7d91('0x22')]][_0x308b55]=_0x531f30[_0x7d91('0x27')];}}}};Fax[_0x7d91('0x1c')][_0x7d91('0x13')]=function(_0xa12e01){if(this[_0x7d91('0x21')][_0xa12e01[_0x7d91('0x22')]]){this[_0x7d91('0x21')][_0xa12e01[_0x7d91('0x22')]][_0x7d91('0x28')]=_0xa12e01[_0x7d91('0x28')];this['channels'][_0xa12e01[_0x7d91('0x22')]][_0x7d91('0x29')]=_0xa12e01[_0x7d91('0x29')];}};Fax['prototype'][_0x7d91('0x15')]=function(_0x266b68){if(this[_0x7d91('0x21')][_0x266b68[_0x7d91('0x22')]]){for(var _0x25e247 in _0x266b68[_0x7d91('0x2a')]){if(_0x266b68[_0x7d91('0x2a')]['hasOwnProperty'](_0x25e247)){this[_0x7d91('0x21')][_0x266b68[_0x7d91('0x22')]][_0x25e247]=_0x266b68[_0x7d91('0x27')];}}}};Fax[_0x7d91('0x1c')][_0x7d91('0x17')]=function(_0x6df029){if(this[_0x7d91('0x21')][_0x6df029[_0x7d91('0x22')]]){this[_0x7d91('0x21')][_0x6df029['uniqueid']][_0x7d91('0x2b')]=_0x6df029[_0x7d91('0x2b')];this[_0x7d91('0x21')][_0x6df029[_0x7d91('0x22')]][_0x7d91('0x2c')]=_0x6df029[_0x7d91('0x2c')];this[_0x7d91('0x21')][_0x6df029[_0x7d91('0x22')]][_0x7d91('0x20')]=_0x6df029[_0x7d91('0x20')];this[_0x7d91('0x21')][_0x6df029[_0x7d91('0x22')]][_0x7d91('0x2d')]=_0x6df029[_0x7d91('0x2d')];logger[_0x7d91('0x25')](_0x6df029[_0x7d91('0x22')],_0x7d91('0x2e'));}};Fax['prototype'][_0x7d91('0x2f')]=function(_0x106b7d){var _0x259d07=this;if(this[_0x7d91('0x21')][_0x106b7d[_0x7d91('0x22')]]){var _0x306d44=this[_0x7d91('0x21')][_0x106b7d[_0x7d91('0x22')]]['id'];this['channels'][_0x106b7d[_0x7d91('0x22')]][_0x7d91('0x30')]=_0x106b7d[_0x7d91('0x30')];this[_0x7d91('0x21')][_0x106b7d[_0x7d91('0x22')]][_0x7d91('0x31')]=_0x106b7d['pagestransferred'];this[_0x7d91('0x21')][_0x106b7d[_0x7d91('0x22')]][_0x7d91('0x20')]=_0x106b7d[_0x7d91('0x20')];this[_0x7d91('0x21')][_0x106b7d[_0x7d91('0x22')]]['resolution']=_0x106b7d[_0x7d91('0x32')];this[_0x7d91('0x21')][_0x106b7d[_0x7d91('0x22')]][_0x7d91('0x33')]=_0x106b7d[_0x7d91('0x33')];this[_0x7d91('0x21')][_0x106b7d[_0x7d91('0x22')]][_0x7d91('0x2d')]=_0x106b7d[_0x7d91('0x2d')];this[_0x7d91('0x21')][_0x106b7d['uniqueid']]['calleridnum']=_0x106b7d[_0x7d91('0x34')];if(this[_0x7d91('0x21')][_0x106b7d[_0x7d91('0x22')]]['pagestransferred']>0x0){tiff2pdf(_0x106b7d['filename'],'/var/opt/motion2/server/files/attachments/',function(_0x2742cd){logger['info'](_0x106b7d[_0x7d91('0x22')],_0x7d91('0x35'),_0x2742cd[_0x7d91('0x36')]);attachment['create']({'name':path[_0x7d91('0x37')](_0x106b7d[_0x7d91('0x2d')])['name'],'basename':path['parse'](_0x106b7d['filename'])['name']+_0x7d91('0x38'),'type':_0x7d91('0x39')})[_0x7d91('0x3a')](function(_0x44634d){faxAccount[_0x7d91('0x3b')](_0x306d44,{'from':_0x106b7d['calleridnum'],'mapKey':_0x7d91('0x5'),'body':path[_0x7d91('0x37')](_0x106b7d['filename'])[_0x7d91('0x24')]+_0x7d91('0x38'),'AttachmentId':_0x44634d['id']})[_0x7d91('0x3c')](function(_0x58ea51){logger[_0x7d91('0x3d')](_0x106b7d[_0x7d91('0x22')],'\x20notify\x20',JSON['stringify'](_0x58ea51));});})['catch'](function(_0x26ff6c){logger[_0x7d91('0x3d')](_0x106b7d[_0x7d91('0x22')],_0x7d91('0x3e'),JSON['stringify'](_0x26ff6c));});});}logger['info'](_0x106b7d[_0x7d91('0x22')],_0x7d91('0x3e'));}};Fax[_0x7d91('0x1c')][_0x7d91('0x1b')]=function(_0x1d8ae9){if(this[_0x7d91('0xd')][_0x1d8ae9['uniqueid']]){_[_0x7d91('0x3f')](this[_0x7d91('0x21')][_0x1d8ae9[_0x7d91('0x22')]],_['pick'](_0x1d8ae9,[_0x7d91('0x40'),_0x7d91('0x41')]));}};function updateStatus(_0x340a41){if(_0x340a41[_0x7d91('0x42')]){faxMessage[_0x7d91('0x43')](_0x340a41[_0x7d91('0x42')],{'failMessage':'SENDING\x20FAILED\x20'})['then'](function(_0x358f4a){ut[_0x7d91('0x44')](_0x7d91('0x45'),_0x358f4a);})[_0x7d91('0x3c')](function(_0x4b03db){ut['logger'](_0x7d91('0x46'),_0x4b03db);});}else{ut['logger']('[Fax][Message][Error][NoUpdate2]');}}Fax['prototype'][_0x7d91('0x47')]=function(_0x44b605,_0x56e8f8,_0x131209){var _0x3cd4a9=this;var _0x32d27a={};if(_0x56e8f8){_0x32d27a={'read':_0x56e8f8};}else{_0x32d27a={'failMessage':_0x131209};}if(this['actions'][_0x44b605][_0x7d91('0x42')]){faxMessage[_0x7d91('0x43')](this[_0x7d91('0xd')][_0x44b605][_0x7d91('0x42')],_0x32d27a)['then'](function(_0x232144){ut['logger'](_0x7d91('0x48'),_0x232144);})[_0x7d91('0x3c')](function(_0x5aced5){ut['logger'](_0x7d91('0x49'),_0x5aced5);})[_0x7d91('0x4a')](function(){delete _0x3cd4a9[_0x7d91('0x21')][_0x44b605];delete _0x3cd4a9[_0x7d91('0xd')][_0x44b605];});}else{ut[_0x7d91('0x44')](_0x7d91('0x4b'));delete this[_0x7d91('0x21')][_0x44b605];delete this[_0x7d91('0xd')][_0x44b605];}};Fax[_0x7d91('0x1c')][_0x7d91('0x4c')]=function(_0x5ce420){var _0x25038c=this;if(this[_0x7d91('0x21')][_0x5ce420[_0x7d91('0x22')]]){if(this['actions'][_0x5ce420[_0x7d91('0x22')]]){this[_0x7d91('0x21')][_0x5ce420[_0x7d91('0x22')]]['id']=this[_0x7d91('0xd')][_0x5ce420[_0x7d91('0x22')]]['id'];this[_0x7d91('0x21')][_0x5ce420[_0x7d91('0x22')]][_0x7d91('0x24')]=this[_0x7d91('0xd')][_0x5ce420[_0x7d91('0x22')]][_0x7d91('0x24')];}logger[_0x7d91('0x25')](_0x5ce420[_0x7d91('0x22')],this[_0x7d91('0xd')][_0x5ce420[_0x7d91('0x22')]]?_0x7d91('0x4d'):_0x7d91('0x4e'),JSON[_0x7d91('0x4f')](this[_0x7d91('0x21')][_0x5ce420[_0x7d91('0x22')]]));if(this[_0x7d91('0xd')][_0x5ce420[_0x7d91('0x22')]]){if(this[_0x7d91('0x21')][_0x5ce420[_0x7d91('0x22')]][_0x7d91('0x50')]>0x0&&this[_0x7d91('0x21')][_0x5ce420[_0x7d91('0x22')]][_0x7d91('0x16')]===_0x7d91('0x51')){this[_0x7d91('0x47')](_0x5ce420[_0x7d91('0x22')],!![]);}else{this[_0x7d91('0x47')](_0x5ce420['uniqueid'],![],this[_0x7d91('0x21')][_0x5ce420[_0x7d91('0x22')]][_0x7d91('0x52')]?_0x7d91('0x53')+this[_0x7d91('0x21')][_0x5ce420[_0x7d91('0x22')]][_0x7d91('0x52')]:'SENDING\x20FAILED');}}}};Fax['prototype']['send']=function(_0x1602a4){var _0x26da1d=this;return new BPromise(function(_0x309f8b,_0x1c26c9){_0x26da1d[_0x7d91('0x54')](_0x1602a4,_0x26da1d['faxAccounts'][_0x1602a4[_0x7d91('0x55')]])[_0x7d91('0x3a')](function(_0xc1d811){ut[_0x7d91('0x44')](_0x7d91('0x56'),_0xc1d811);_0x309f8b(ut[_0x7d91('0x36')](_0x7d91('0x57')));})[_0x7d91('0x3c')](function(_0x1edfb6){ut[_0x7d91('0x44')](_0x7d91('0x58'),_0x1edfb6);updateStatus(_0x1602a4);_0x1c26c9(ut[_0x7d91('0x36')]('Fax\x20failed'));});});};Fax[_0x7d91('0x1c')]['checkAfterSend']=function(_0x15bac3){var _0x1758fc=this;return new BPromise(function(_0x43726e,_0x3b1d4d){var _0x4e9db3=_0x1758fc[_0x7d91('0x59')](_0x1758fc[_0x7d91('0xb')][_0x15bac3[_0x7d91('0x55')]][_0x7d91('0x5a')],_0x15bac3);if(_0x4e9db3[_0x7d91('0x5b')]){_0x43726e(ut[_0x7d91('0x36')]('Trunk\x20Reachable'));}else{_0x3b1d4d(ut['message'](_0x4e9db3[_0x7d91('0x36')]));}});};function originate(_0x2bf788,_0x155aaa,_0x2624b0){return new BPromise(function(_0x222859,_0x2b4d80){if(_0x2624b0){var _0x9f416f=util[_0x7d91('0x5c')]('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['parse'](_0x2bf788['path'])[_0x7d91('0x24')],_0x2bf788[_0x7d91('0x2')]);gs[_0x7d91('0x5d')](_0x9f416f)[_0x7d91('0x3a')](function(){_0x2bf788['path']=util['format'](_0x7d91('0x5e'),path[_0x7d91('0x37')](_0x2bf788['path'])['dir'],path['parse'](_0x2bf788[_0x7d91('0x2')])['name']);_0x155aaa[_0x7d91('0x5f')]=_0x2bf788[_0x7d91('0x2')];ut['logger'](_0x7d91('0x60'),'');ami[_0x7d91('0x61')](ut[_0x7d91('0x62')](_0x2bf788,_0x155aaa))[_0x7d91('0x3a')](function(_0x2384ed){_0x222859(_0x2384ed);})['catch'](function(_0x48530e){_0x2b4d80(_0x48530e);});})[_0x7d91('0x3c')](function(_0x5c628d){_0x2b4d80(_0x5c628d);});}else{ami['Action'](ut[_0x7d91('0x62')](_0x2bf788,_0x155aaa))[_0x7d91('0x3a')](function(_0x3ea8e3){_0x222859(_0x3ea8e3);})[_0x7d91('0x3c')](function(_0x1160d7){_0x2b4d80(_0x1160d7);});}});}Fax['prototype']['execOriginate']=function(_0x3d46f4,_0xaa6c9a){var _0x41f3ea=this;return new BPromise(function(_0x3b16e5,_0x15a220){var _0x4b5039=uuid['v4']();var _0x1767b6=ut[_0x7d91('0x63')](_0x3d46f4,_0xaa6c9a);_0x41f3ea[_0x7d91('0xd')][_0x4b5039]=new Action(_0x4b5039,_0xaa6c9a,_0x3d46f4);var _0xfc7a71=_0x41f3ea[_0x7d91('0xd')][_0x4b5039];if(path[_0x7d91('0x37')](_0x3d46f4[_0x7d91('0x2')])['ext']===_0x7d91('0x38')){originate(_0xfc7a71,_0x1767b6,!![])[_0x7d91('0x3a')](function(_0x4b7034){_0x3b16e5(_0x4b7034);})[_0x7d91('0x3c')](function(_0x3e4542){_0x15a220(_0x3e4542);});}else{originate(_0xfc7a71,_0x1767b6,![])[_0x7d91('0x3a')](function(_0x4269a2){_0x3b16e5(_0x4269a2);})[_0x7d91('0x3c')](function(_0x26deeb){_0x15a220(_0x26deeb);});}});};Fax[_0x7d91('0x1c')][_0x7d91('0x64')]=function(_0xad4fe2){return!_[_0x7d91('0x65')](_0xad4fe2)&&!_['isNil'](_0xad4fe2[_0x7d91('0x24')])&&!_[_0x7d91('0x65')](_0xad4fe2[_0x7d91('0x66')])&&_0xad4fe2['active']&&!_['isNil'](this[_0x7d91('0xc')][util[_0x7d91('0x5c')](_0x7d91('0x67'),_0xad4fe2[_0x7d91('0x24')])])&&!_[_0x7d91('0x65')](this[_0x7d91('0xc')][util[_0x7d91('0x5c')]('SIP/%s',_0xad4fe2[_0x7d91('0x24')])][_0x7d91('0x2c')])&&(this[_0x7d91('0xc')][util[_0x7d91('0x5c')](_0x7d91('0x67'),_0xad4fe2[_0x7d91('0x24')])]['status']===_0x7d91('0x68')||this['trunks'][util[_0x7d91('0x5c')](_0x7d91('0x67'),_0xad4fe2['name'])]['status']===_0x7d91('0x69'));};Fax['prototype'][_0x7d91('0x59')]=function(_0x5b55ea,_0x2f5c05){if(!this[_0x7d91('0x64')](_0x5b55ea)){ut[_0x7d91('0x44')]('[Fax][checkTrunk][Trunk\x20not\x20work]',_[_0x7d91('0x65')](_0x5b55ea)?'':_0x5b55ea[_0x7d91('0x24')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':_0x7d91('0x6a')};}if(_[_0x7d91('0x65')](_0x2f5c05['fax'])){ut['logger'](_0x7d91('0x6b'),JSON[_0x7d91('0x4f')](_0x2f5c05));return{'isValid':![],'message':'Empty\x20Fax'};}if(_['isNil'](_0x2f5c05[_0x7d91('0x2')])){ut[_0x7d91('0x44')](_0x7d91('0x6c'),JSON['stringify'](_0x2f5c05));return{'isValid':![],'message':_0x7d91('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 5339bae..8c0939a 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 _0x5500=['resolve','then','catch','bluebird','../../../config/logger','preview','lodash','error','inspect','notify'];(function(_0x285c85,_0x132c21){var _0x2f81cd=function(_0x9b9962){while(--_0x9b9962){_0x285c85['push'](_0x285c85['shift']());}};_0x2f81cd(++_0x132c21);}(_0x5500,0xb7));var _0x0550=function(_0x36ecca,_0x3b73f0){_0x36ecca=_0x36ecca-0x0;var _0x142cb5=_0x5500[_0x36ecca];return _0x142cb5;};'use strict';var util=require('util');var BPromise=require(_0x0550('0x0'));var logger=require(_0x0550('0x1'))(_0x0550('0x2'));var _=require(_0x0550('0x3'));var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x1fbdee){return function(_0x1e8f8b){logger[_0x0550('0x4')](_0x1fbdee,util[_0x0550('0x5')](_0x1e8f8b,{'showHidden':![],'depth':null}));};}exports[_0x0550('0x6')]=function(_0x3241da,_0xde4698){return BPromise[_0x0550('0x7')]()[_0x0550('0x8')](faxAccount[_0x0550('0x6')](_0x3241da,_0xde4698))[_0x0550('0x9')](loggerCatch('[Notify]\x20'));}; \ No newline at end of file +var _0x215d=['util','../../../config/logger','preview','error','notify','resolve','then','catch','[Notify]\x20'];(function(_0x1ae491,_0x5b83b9){var _0x4958a5=function(_0xf0f364){while(--_0xf0f364){_0x1ae491['push'](_0x1ae491['shift']());}};_0x4958a5(++_0x5b83b9);}(_0x215d,0x1a7));var _0xd215=function(_0xde60f,_0x1d421a){_0xde60f=_0xde60f-0x0;var _0x469adf=_0x215d[_0xde60f];return _0x469adf;};'use strict';var util=require(_0xd215('0x0'));var BPromise=require('bluebird');var logger=require(_0xd215('0x1'))(_0xd215('0x2'));var _=require('lodash');var faxAccount=require('../rpc/faxAccount');function loggerCatch(_0x90e55){return function(_0x155259){logger[_0xd215('0x3')](_0x90e55,util['inspect'](_0x155259,{'showHidden':![],'depth':null}));};}exports[_0xd215('0x4')]=function(_0x2e5e32,_0x145aeb){return BPromise[_0xd215('0x5')]()[_0xd215('0x6')](faxAccount['notify'](_0x2e5e32,_0x145aeb))[_0xd215('0x7')](loggerCatch(_0xd215('0x8')));}; \ 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 2f2cf09..2bd0b72 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 _0x194b=['fax','child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','../../../../config/logger'];(function(_0x4fe7bb,_0x1bdd1c){var _0x5659cc=function(_0x425c86){while(--_0x425c86){_0x4fe7bb['push'](_0x4fe7bb['shift']());}};_0x5659cc(++_0x1bdd1c);}(_0x194b,0x10d));var _0xb194=function(_0x29d5c8,_0x1baca8){_0x29d5c8=_0x29d5c8-0x0;var _0x19c799=_0x194b[_0x29d5c8];return _0x19c799;};'use strict';var util=require('util');var logger=require(_0xb194('0x0'))(_0xb194('0x1'));var BPromise=require('bluebird');var exec=require(_0xb194('0x2'))[_0xb194('0x3')];exports[_0xb194('0x4')]=function(_0x34ef58){return new BPromise(function(_0xbfae76,_0x238390){exec(_0x34ef58,function(_0x33bea3,_0x452472,_0x5a7a28){logger[_0xb194('0x5')](_0xb194('0x6'),_0x452472);if(_0x33bea3){logger[_0xb194('0x5')](_0xb194('0x6'),_0xb194('0x7'),util[_0xb194('0x8')](_0x33bea3,{'showHidden':![],'depth':null}),_0x452472,_0x5a7a28);_0x238390(_0x33bea3);}_0xbfae76(_0x452472);});});}; \ No newline at end of file +var _0x0e14=['execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','../../../../config/logger','fax','child_process'];(function(_0x2077c2,_0x275ab5){var _0x312f9f=function(_0x331435){while(--_0x331435){_0x2077c2['push'](_0x2077c2['shift']());}};_0x312f9f(++_0x275ab5);}(_0x0e14,0x83));var _0x40e1=function(_0x9df060,_0x253d33){_0x9df060=_0x9df060-0x0;var _0x338dfe=_0x0e14[_0x9df060];return _0x338dfe;};'use strict';var util=require(_0x40e1('0x0'));var logger=require(_0x40e1('0x1'))(_0x40e1('0x2'));var BPromise=require('bluebird');var exec=require(_0x40e1('0x3'))['exec'];exports[_0x40e1('0x4')]=function(_0x2d906b){return new BPromise(function(_0x3fe6fc,_0x1549e0){exec(_0x2d906b,function(_0x1bfa62,_0x67c9b9,_0x468689){logger[_0x40e1('0x5')]('Exec\x20gs',_0x67c9b9);if(_0x1bfa62){logger['info'](_0x40e1('0x6'),_0x40e1('0x7'),util[_0x40e1('0x8')](_0x1bfa62,{'showHidden':![],'depth':null}),_0x67c9b9,_0x468689);_0x1549e0(_0x1bfa62);}_0x3fe6fc(_0x67c9b9);});});}; \ 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 ac659e5..2abf7a2 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 _0x1422=['variablesAction','channel','xcally-motion-fax','from-sip','\x22%s\x22\x20<%s>','uniqueid','moment','../../../../config/logger','fax','logger','info','inspect','ecm','headerinfo','minrate','\x22%s\x22','modem','t38timeout','localstationid','path'];(function(_0x20fd05,_0x45b024){var _0x26ce2c=function(_0x5cbce5){while(--_0x5cbce5){_0x20fd05['push'](_0x20fd05['shift']());}};_0x26ce2c(++_0x45b024);}(_0x1422,0xe2));var _0x2142=function(_0x22ae67,_0x1d3acc){_0x22ae67=_0x22ae67-0x0;var _0x5c83b3=_0x1422[_0x22ae67];return _0x5c83b3;};'use strict';var util=require('util');var _=require('lodash');var moment=require(_0x2142('0x0'));var logger=require(_0x2142('0x1'))(_0x2142('0x2'));exports['message']=function(_0x3d99c1){return{'message':_0x3d99c1};};exports[_0x2142('0x3')]=function(_0xb4f4d8,_0x114eb6){logger[_0x2142('0x4')](_0xb4f4d8,util[_0x2142('0x5')](_0x114eb6,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x242045,_0x5c5da6){var _0x36872f={'XMF-ECM':_0x5c5da6[_0x2142('0x6')],'XMF-HEADERINFO':_0x5c5da6[_0x2142('0x7')],'XMF-MINRATE':_0x5c5da6[_0x2142('0x8')],'XMF-MAXRATE':_0x5c5da6['maxrate'],'XMF-MODEM':util['format'](_0x2142('0x9'),_0x5c5da6[_0x2142('0xa')]),'XMF-GATEWAY':_0x5c5da6['gateway'],'XMF-FAXDETECT':_0x5c5da6['faxdetect'],'XMF-T38TIMEOUT':_0x5c5da6[_0x2142('0xb')],'XMF-LOCALSTATIONID':_0x5c5da6[_0x2142('0xc')],'XMF-PATH':_0x242045[_0x2142('0xd')]};return _0x36872f;};exports[_0x2142('0xe')]=function(_0x3e5458,_0x3d0e55){return{'actionid':_0x3e5458['uniqueid'],'action':'originate','channel':_0x3e5458[_0x2142('0xf')],'Exten':_0x2142('0x10'),'Context':_0x2142('0x11'),'Priority':'1','callerid':util['format'](_0x2142('0x12'),_0x3e5458[_0x2142('0x7')]?_0x3e5458[_0x2142('0x7')]:'',_0x3e5458[_0x2142('0xc')]),'variable':_0x3d0e55,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x3e5458[_0x2142('0x13')]};}; \ No newline at end of file +var _0x5d4b=['util','moment','../../../../config/logger','fax','message','logger','inspect','addVariables','ecm','headerinfo','minrate','maxrate','\x22%s\x22','modem','t38timeout','path','variablesAction','uniqueid','originate','channel','xcally-motion-fax','from-sip','format','\x22%s\x22\x20<%s>'];(function(_0x2cdec6,_0x39d4c8){var _0xa36703=function(_0x6bb8d4){while(--_0x6bb8d4){_0x2cdec6['push'](_0x2cdec6['shift']());}};_0xa36703(++_0x39d4c8);}(_0x5d4b,0x1b0));var _0xb5d4=function(_0x40e33a,_0x5af730){_0x40e33a=_0x40e33a-0x0;var _0x211e3b=_0x5d4b[_0x40e33a];return _0x211e3b;};'use strict';var util=require(_0xb5d4('0x0'));var _=require('lodash');var moment=require(_0xb5d4('0x1'));var logger=require(_0xb5d4('0x2'))(_0xb5d4('0x3'));exports[_0xb5d4('0x4')]=function(_0x5ee3d4){return{'message':_0x5ee3d4};};exports[_0xb5d4('0x5')]=function(_0x5ad039,_0x36f997){logger['info'](_0x5ad039,util[_0xb5d4('0x6')](_0x36f997,{'showHidden':![],'depth':null}));};exports[_0xb5d4('0x7')]=function(_0x4cbcc8,_0x42b23d){var _0x1d3a25={'XMF-ECM':_0x42b23d[_0xb5d4('0x8')],'XMF-HEADERINFO':_0x42b23d[_0xb5d4('0x9')],'XMF-MINRATE':_0x42b23d[_0xb5d4('0xa')],'XMF-MAXRATE':_0x42b23d[_0xb5d4('0xb')],'XMF-MODEM':util['format'](_0xb5d4('0xc'),_0x42b23d[_0xb5d4('0xd')]),'XMF-GATEWAY':_0x42b23d['gateway'],'XMF-FAXDETECT':_0x42b23d['faxdetect'],'XMF-T38TIMEOUT':_0x42b23d[_0xb5d4('0xe')],'XMF-LOCALSTATIONID':_0x42b23d['localstationid'],'XMF-PATH':_0x4cbcc8[_0xb5d4('0xf')]};return _0x1d3a25;};exports[_0xb5d4('0x10')]=function(_0x345594,_0x5da881){return{'actionid':_0x345594[_0xb5d4('0x11')],'action':_0xb5d4('0x12'),'channel':_0x345594[_0xb5d4('0x13')],'Exten':_0xb5d4('0x14'),'Context':_0xb5d4('0x15'),'Priority':'1','callerid':util[_0xb5d4('0x16')](_0xb5d4('0x17'),_0x345594[_0xb5d4('0x9')]?_0x345594['headerinfo']:'',_0x345594['localstationid']),'variable':_0x5da881,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x345594[_0xb5d4('0x11')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index fd96f47..c887d6c 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 _0x19b6=['catch','listen','sync','log','util','./server','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','then','getAgents','initAgents','getTelephones','initTelephones','getTrunks','getVoiceQueues','getTriggers','initTriggers','getTemplates','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','getSugarcrmAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','getZohoAccounts','initZohoAccounts','getVtigerAccounts','initVtigerAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','initCampaigns','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','initVoiceCallReports'];(function(_0x1d47fa,_0x2a7dae){var _0x1b3a2a=function(_0x44e3c5){while(--_0x44e3c5){_0x1d47fa['push'](_0x1d47fa['shift']());}};_0x1b3a2a(++_0x2a7dae);}(_0x19b6,0x114));var _0x619b=function(_0x189305,_0x46c43f){_0x189305=_0x189305-0x0;var _0xea3406=_0x19b6[_0x189305];return _0xea3406;};'use strict';var BPromise=require('bluebird');var util=require(_0x619b('0x0'));var moment=require('moment');var server=require(_0x619b('0x1'));var Realtime=require('./realtime');var Report=require('./report');var Acw=require(_0x619b('0x2'));var Trigger=require(_0x619b('0x3'));var Dialer=require(_0x619b('0x4'));var Preview=require(_0x619b('0x5'));var Fax=require(_0x619b('0x6'));var user=require(_0x619b('0x7'));var voiceQueue=require(_0x619b('0x8'));var voiceQueueReport=require(_0x619b('0x9'));var voiceCallReport=require(_0x619b('0xa'));var trunk=require(_0x619b('0xb'));var trigger=require('./rpc/trigger');var template=require(_0x619b('0xc'));var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require(_0x619b('0xd'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0x619b('0xe'));var zendesk=require(_0x619b('0xf'));var salesforce=require(_0x619b('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x619b('0x11'));var desk=require(_0x619b('0x12'));var zoho=require(_0x619b('0x13'));var vtiger=require(_0x619b('0x14'));var freshsales=require(_0x619b('0x15'));var servicenow=require(_0x619b('0x16'));var dynamics365=require(_0x619b('0x17'));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()[_0x619b('0x18')](_0x619b('0x19'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x619b('0x18')](_0x619b('0x19'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise['resolve']()[_0x619b('0x1a')](user[_0x619b('0x1b')]())[_0x619b('0x1a')](realtime[_0x619b('0x1c')]())[_0x619b('0x1a')](user[_0x619b('0x1d')]())[_0x619b('0x1a')](realtime[_0x619b('0x1e')]())[_0x619b('0x1a')](trunk[_0x619b('0x1f')]())[_0x619b('0x1a')](realtime['initTrunks']())[_0x619b('0x1a')](voiceQueue[_0x619b('0x20')]())[_0x619b('0x1a')](realtime['initVoiceQueues']())['then'](trigger[_0x619b('0x21')]())['then'](realtime[_0x619b('0x22')]())[_0x619b('0x1a')](template[_0x619b('0x23')]())[_0x619b('0x1a')](realtime['initTemplates']())[_0x619b('0x1a')](zendesk['getZendeskAccounts']())[_0x619b('0x1a')](realtime[_0x619b('0x24')]())['then'](salesforce[_0x619b('0x25')]())['then'](realtime[_0x619b('0x26')]())[_0x619b('0x1a')](sugarcrm[_0x619b('0x27')]())[_0x619b('0x1a')](realtime[_0x619b('0x28')]())['then'](freshdesk[_0x619b('0x29')]())[_0x619b('0x1a')](realtime[_0x619b('0x2a')]())['then'](desk[_0x619b('0x2b')]())['then'](realtime['initDeskAccounts']())['then'](zoho[_0x619b('0x2c')]())[_0x619b('0x1a')](realtime[_0x619b('0x2d')]())[_0x619b('0x1a')](vtiger[_0x619b('0x2e')]())['then'](realtime[_0x619b('0x2f')]())[_0x619b('0x1a')](freshsales[_0x619b('0x30')]())[_0x619b('0x1a')](realtime[_0x619b('0x31')]())[_0x619b('0x1a')](servicenow[_0x619b('0x32')]())[_0x619b('0x1a')](realtime[_0x619b('0x33')]())[_0x619b('0x1a')](dynamics365[_0x619b('0x34')]())['then'](realtime[_0x619b('0x35')]())[_0x619b('0x1a')](campaign[_0x619b('0x36')]())[_0x619b('0x1a')](realtime[_0x619b('0x37')]())[_0x619b('0x1a')](voiceExtension['getVoiceExtensions']())[_0x619b('0x1a')](realtime['initVoiceExtensions']())['then'](faxAccount[_0x619b('0x38')]())[_0x619b('0x1a')](realtime[_0x619b('0x39')]())[_0x619b('0x1a')](function(){return realtime;});}function initParams(){return BPromise['resolve']()[_0x619b('0x1a')](voiceQueueReport[_0x619b('0x3a')]())[_0x619b('0x1a')](realtime['initVoiceQueueReports']())[_0x619b('0x1a')](cmHopperHistory[_0x619b('0x3b')]())[_0x619b('0x1a')](realtime[_0x619b('0x3c')]())[_0x619b('0x1a')](cmHopperHistory[_0x619b('0x3d')]())[_0x619b('0x1a')](realtime[_0x619b('0x3e')]())['then'](voiceCallReport['getVoiceCallReports']())[_0x619b('0x1a')](realtime[_0x619b('0x3f')]())[_0x619b('0x1a')](function(_0x422325){})[_0x619b('0x40')](function(_0x1be75b){console['log'](_0x1be75b);});}function main(){return server[_0x619b('0x41')](realtime,preview,fax)[_0x619b('0x1a')](function(_0x110cef){return initRealtime();})[_0x619b('0x1a')](function(){return initParams();})['then'](function(){report[_0x619b('0x42')]();setInterval(initRealtime,0x1388);})[_0x619b('0x40')](function(_0x4fa038){console[_0x619b('0x43')](_0x4fa038);});}main(); \ No newline at end of file +var _0x78bd=['getSalesforceAccounts','initSalesforceAccounts','initSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initZohoAccounts','getFreshsalesAccounts','initFreshsalesAccounts','getServicenowAccounts','initServicenowAccounts','getDynamics365Accounts','initDynamics365Accounts','initCampaigns','getVoiceExtensions','getVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getVoiceCallReports','catch','log','sync','bluebird','util','moment','./server','./realtime','./report','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/trigger','./rpc/template','./rpc/cmHopperHistory','./rpc/campaign','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/sugarcrm','./rpc/integrations/freshdesk','./rpc/integrations/desk','./rpc/integrations/zoho','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/servicenow','./rpc/integrations/dynamics365','get','hour','resolve','then','initAgents','getTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x78bd,0x1e6));var _0xd78b=function(_0x13d07a,_0x41efc3){_0x13d07a=_0x13d07a-0x0;var _0x5ee0ee=_0x78bd[_0x13d07a];return _0x5ee0ee;};'use strict';var BPromise=require(_0xd78b('0x0'));var util=require(_0xd78b('0x1'));var moment=require(_0xd78b('0x2'));var server=require(_0xd78b('0x3'));var Realtime=require(_0xd78b('0x4'));var Report=require(_0xd78b('0x5'));var Acw=require('./acw');var Trigger=require('./trigger');var Dialer=require(_0xd78b('0x6'));var Preview=require(_0xd78b('0x7'));var Fax=require('./fax');var user=require(_0xd78b('0x8'));var voiceQueue=require(_0xd78b('0x9'));var voiceQueueReport=require(_0xd78b('0xa'));var voiceCallReport=require(_0xd78b('0xb'));var trunk=require(_0xd78b('0xc'));var trigger=require(_0xd78b('0xd'));var template=require(_0xd78b('0xe'));var cmHopperHistory=require(_0xd78b('0xf'));var campaign=require(_0xd78b('0x10'));var voiceExtension=require('./rpc/voiceExtension');var faxAccount=require(_0xd78b('0x11'));var zendesk=require(_0xd78b('0x12'));var salesforce=require(_0xd78b('0x13'));var sugarcrm=require(_0xd78b('0x14'));var freshdesk=require(_0xd78b('0x15'));var desk=require(_0xd78b('0x16'));var zoho=require(_0xd78b('0x17'));var vtiger=require(_0xd78b('0x18'));var freshsales=require(_0xd78b('0x19'));var servicenow=require(_0xd78b('0x1a'));var dynamics365=require(_0xd78b('0x1b'));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()[_0xd78b('0x1c')](_0xd78b('0x1d'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0xd78b('0x1c')](_0xd78b('0x1d'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return BPromise[_0xd78b('0x1e')]()[_0xd78b('0x1f')](user['getAgents']())[_0xd78b('0x1f')](realtime[_0xd78b('0x20')]())[_0xd78b('0x1f')](user[_0xd78b('0x21')]())[_0xd78b('0x1f')](realtime['initTelephones']())[_0xd78b('0x1f')](trunk[_0xd78b('0x22')]())['then'](realtime[_0xd78b('0x23')]())[_0xd78b('0x1f')](voiceQueue['getVoiceQueues']())['then'](realtime['initVoiceQueues']())[_0xd78b('0x1f')](trigger[_0xd78b('0x24')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x25')]())[_0xd78b('0x1f')](template[_0xd78b('0x26')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x27')]())['then'](zendesk[_0xd78b('0x28')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x29')]())['then'](salesforce[_0xd78b('0x2a')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x2b')]())[_0xd78b('0x1f')](sugarcrm['getSugarcrmAccounts']())[_0xd78b('0x1f')](realtime[_0xd78b('0x2c')]())[_0xd78b('0x1f')](freshdesk[_0xd78b('0x2d')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x2e')]())[_0xd78b('0x1f')](desk[_0xd78b('0x2f')]())['then'](realtime[_0xd78b('0x30')]())['then'](zoho[_0xd78b('0x31')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x32')]())[_0xd78b('0x1f')](vtiger['getVtigerAccounts']())[_0xd78b('0x1f')](realtime['initVtigerAccounts']())[_0xd78b('0x1f')](freshsales[_0xd78b('0x33')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x34')]())[_0xd78b('0x1f')](servicenow[_0xd78b('0x35')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x36')]())[_0xd78b('0x1f')](dynamics365[_0xd78b('0x37')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x38')]())['then'](campaign['getCampaigns']())[_0xd78b('0x1f')](realtime[_0xd78b('0x39')]())['then'](voiceExtension[_0xd78b('0x3a')]())[_0xd78b('0x1f')](realtime['initVoiceExtensions']())[_0xd78b('0x1f')](faxAccount['getFaxAccounts']())[_0xd78b('0x1f')](realtime['initFaxAccounts']())[_0xd78b('0x1f')](function(){return realtime;});}function initParams(){return BPromise[_0xd78b('0x1e')]()[_0xd78b('0x1f')](voiceQueueReport[_0xd78b('0x3b')]())[_0xd78b('0x1f')](realtime['initVoiceQueueReports']())['then'](cmHopperHistory[_0xd78b('0x3c')]())[_0xd78b('0x1f')](realtime[_0xd78b('0x3d')]())['then'](cmHopperHistory['getCampaignHopperHistory']())[_0xd78b('0x1f')](realtime['initCampaignHopperHistory']())[_0xd78b('0x1f')](voiceCallReport[_0xd78b('0x3e')]())[_0xd78b('0x1f')](realtime['initVoiceCallReports']())[_0xd78b('0x1f')](function(_0x5624f4){})[_0xd78b('0x3f')](function(_0x1b44e1){console[_0xd78b('0x40')](_0x1b44e1);});}function main(){return server['listen'](realtime,preview,fax)[_0xd78b('0x1f')](function(_0x543db4){return initRealtime();})['then'](function(){return initParams();})[_0xd78b('0x1f')](function(){report[_0xd78b('0x41')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x1d3c53){console[_0xd78b('0x40')](_0x1d3c53);});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 9b662a9..e235065 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 _0xedd9=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','onhold','prototype','updateStatusRealtime','state','toLowerCase','idle','inuse','talking','statePause','toNumber','interface','format','user:%s','user:save','emit','user:presence','exports','util','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','unknown','status'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xedd9,0xfc));var _0x9edd=function(_0x22ed11,_0x3d378e){_0x22ed11=_0x22ed11-0x0;var _0x5e66c6=_0xedd9[_0x22ed11];return _0x5e66c6;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var md5=require(_0x9edd('0x2'));var Redis=require(_0x9edd('0x3'));var config=require(_0x9edd('0x4'));config[_0x9edd('0x5')]=_[_0x9edd('0x6')](config[_0x9edd('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x9edd('0x7'))(new Redis(config[_0x9edd('0x5')]));function Agent(_0x268f9e){this['id']=_0x268f9e['id']||0x0;this[_0x9edd('0x8')]=_0x268f9e['name']||'';this[_0x9edd('0x9')]=_0x268f9e['email']||'';this[_0x9edd('0xa')]=_0x268f9e[_0x9edd('0xa')]||'';this[_0x9edd('0xb')]=_0x268f9e[_0x9edd('0xb')]||'';this['state']=_0x9edd('0xc');this['stateTime']=0x0;this[_0x9edd('0xd')]=_0x9edd('0xc');this['address']='';this[_0x9edd('0xe')]='';this[_0x9edd('0xf')]='';this['interface']='';this[_0x9edd('0x10')]=_0x268f9e[_0x9edd('0x10')]||![];this[_0x9edd('0x11')]=_0x9edd('0xc');this[_0x9edd('0x12')]=0x0;this[_0x9edd('0x13')]='';this[_0x9edd('0x14')]='';this[_0x9edd('0x15')]=![];this['local']=![];this[_0x9edd('0x2')]='';}Agent[_0x9edd('0x16')][_0x9edd('0x17')]=function(_0x4d9a7){var _0x13b6b6;if(_0x4d9a7&&_0x4d9a7[_0x9edd('0x18')]){_0x13b6b6=_0x4d9a7[_0x9edd('0x18')][_0x9edd('0x19')]();switch(_0x13b6b6){case'not_inuse':_0x13b6b6=_0x9edd('0x1a');break;case _0x9edd('0x1b'):_0x13b6b6=_0x9edd('0x1c');break;}}if(_0x13b6b6&&this['voiceStatus']!==_0x13b6b6||_0x4d9a7[_0x9edd('0x1d')]){this[_0x9edd('0x12')]=_[_0x9edd('0x1e')](moment()['format']('x'));}if(_0x13b6b6){this[_0x9edd('0x11')]=_0x13b6b6;}var _0x5d879c={'id':this['id'],'name':this[_0x9edd('0x8')],'email':this[_0x9edd('0x9')],'accountcode':this['accountcode'],'fullname':this['fullname'],'state':this[_0x9edd('0x18')],'stateTime':this['stateTime'],'status':this[_0x9edd('0xd')],'address':this['address'],'online':this['online'],'voiceStatus':this[_0x9edd('0x11')],'voiceStatusTime':this[_0x9edd('0x12')],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this['voiceStatusQueue'],'interface':this[_0x9edd('0x1f')],'onhold':this[_0x9edd('0x15')]};var _0x477878=md5(JSON['stringify'](_0x5d879c));if(this[_0x9edd('0x2')]!==_0x477878){this[_0x9edd('0x2')]=_0x477878;io['to'](util[_0x9edd('0x20')](_0x9edd('0x21'),_0x5d879c[_0x9edd('0x8')]))['emit'](_0x9edd('0x22'),_0x5d879c);io[_0x9edd('0x23')](_0x9edd('0x24'),_0x5d879c);}};module[_0x9edd('0x25')]=Agent; \ No newline at end of file +var _0x9c44=['phone','mobile','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','onhold','local','prototype','updateStatusRealtime','toLowerCase','not_inuse','idle','inuse','talking','statePause','stateTime','address','voiceStatusQueue','stringify','format','user:%s','emit','user:presence','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','status','unknown'];(function(_0x3b3a82,_0x53b5e0){var _0x267063=function(_0x5aaf3d){while(--_0x5aaf3d){_0x3b3a82['push'](_0x3b3a82['shift']());}};_0x267063(++_0x53b5e0);}(_0x9c44,0x178));var _0x49c4=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0x9c44[_0x17b6e3];return _0x3906f3;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var Redis=require(_0x49c4('0x2'));var config=require(_0x49c4('0x3'));config[_0x49c4('0x4')]=_[_0x49c4('0x5')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x49c4('0x6'))(new Redis(config['redis']));function Agent(_0xc1278f){this['id']=_0xc1278f['id']||0x0;this[_0x49c4('0x7')]=_0xc1278f[_0x49c4('0x7')]||'';this[_0x49c4('0x8')]=_0xc1278f[_0x49c4('0x8')]||'';this['accountcode']=_0xc1278f[_0x49c4('0x9')]||'';this[_0x49c4('0xa')]=_0xc1278f[_0x49c4('0xa')]||'';this[_0x49c4('0xb')]='unknown';this['stateTime']=0x0;this[_0x49c4('0xc')]=_0x49c4('0xd');this['address']='';this[_0x49c4('0xe')]='';this[_0x49c4('0xf')]='';this['interface']='';this['online']=_0xc1278f[_0x49c4('0x10')]||![];this[_0x49c4('0x11')]='unknown';this[_0x49c4('0x12')]=0x0;this[_0x49c4('0x13')]='';this['voiceStatusQueue']='';this[_0x49c4('0x14')]=![];this[_0x49c4('0x15')]=![];this[_0x49c4('0x1')]='';}Agent[_0x49c4('0x16')][_0x49c4('0x17')]=function(_0x18211c){var _0x75ea8;if(_0x18211c&&_0x18211c[_0x49c4('0xb')]){_0x75ea8=_0x18211c['state'][_0x49c4('0x18')]();switch(_0x75ea8){case _0x49c4('0x19'):_0x75ea8=_0x49c4('0x1a');break;case _0x49c4('0x1b'):_0x75ea8=_0x49c4('0x1c');break;}}if(_0x75ea8&&this['voiceStatus']!==_0x75ea8||_0x18211c[_0x49c4('0x1d')]){this[_0x49c4('0x12')]=_['toNumber'](moment()['format']('x'));}if(_0x75ea8){this[_0x49c4('0x11')]=_0x75ea8;}var _0x2f82d5={'id':this['id'],'name':this[_0x49c4('0x7')],'email':this['email'],'accountcode':this[_0x49c4('0x9')],'fullname':this['fullname'],'state':this[_0x49c4('0xb')],'stateTime':this[_0x49c4('0x1e')],'status':this[_0x49c4('0xc')],'address':this[_0x49c4('0x1f')],'online':this[_0x49c4('0x10')],'voiceStatus':this[_0x49c4('0x11')],'voiceStatusTime':this[_0x49c4('0x12')],'voiceStatusCallerIdNumber':this[_0x49c4('0x13')],'voiceStatusQueue':this[_0x49c4('0x20')],'interface':this['interface'],'onhold':this['onhold']};var _0x57f502=md5(JSON[_0x49c4('0x21')](_0x2f82d5));if(this['md5']!==_0x57f502){this['md5']=_0x57f502;io['to'](util[_0x49c4('0x22')](_0x49c4('0x23'),_0x2f82d5[_0x49c4('0x7')]))[_0x49c4('0x24')]('user:save',_0x2f82d5);io['emit'](_0x49c4('0x25'),_0x2f82d5);}};module[_0x49c4('0x26')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index a9e2e08..31c5075 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 _0x0127=['dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','type','temp','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','active','limitCalls','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout'];(function(_0x156b04,_0x437136){var _0x37c7bb=function(_0x5ef7df){while(--_0x5ef7df){_0x156b04['push'](_0x156b04['shift']());}};_0x37c7bb(++_0x437136);}(_0x0127,0x1ca));var _0x7012=function(_0x21cf24,_0x411529){_0x21cf24=_0x21cf24-0x0;var _0xa749c=_0x0127[_0x21cf24];return _0xa749c;};'use strict';function Campaign(_0x5665a5){this['id']=_0x5665a5['id']||0x0;this['name']=_0x5665a5['name']||'';this[_0x7012('0x0')]=_0x5665a5[_0x7012('0x0')]||'campaign';this['originated']=0x0;this[_0x7012('0x1')]=0x0;this[_0x7012('0x2')]=0x0;this[_0x7012('0x3')]=0x0;this[_0x7012('0x4')]='';this[_0x7012('0x5')]=!![];this[_0x7012('0x6')]=_0x5665a5[_0x7012('0x6')];this[_0x7012('0x7')]=_0x5665a5[_0x7012('0x7')];this['dialTimezone']=_0x5665a5['dialTimezone']||null;this[_0x7012('0x8')]=_0x5665a5[_0x7012('0x8')]?_0x5665a5[_0x7012('0x8')]:null;this['dialOriginateCallerIdName']=_0x5665a5[_0x7012('0x9')];this[_0x7012('0xa')]=_0x5665a5[_0x7012('0xa')];this[_0x7012('0xb')]=_0x5665a5[_0x7012('0xb')]||0x1e;this['dialCongestionMaxRetry']=_0x5665a5[_0x7012('0xc')];this[_0x7012('0xd')]=_0x5665a5[_0x7012('0xd')];this[_0x7012('0xe')]=_0x5665a5[_0x7012('0xe')];this[_0x7012('0xf')]=_0x5665a5[_0x7012('0xf')];this[_0x7012('0x10')]=_0x5665a5[_0x7012('0x10')];this[_0x7012('0x11')]=_0x5665a5[_0x7012('0x11')];this[_0x7012('0x12')]=_0x5665a5[_0x7012('0x12')];this[_0x7012('0x13')]=_0x5665a5[_0x7012('0x13')]||0x3;this[_0x7012('0x14')]=_0x5665a5[_0x7012('0x14')]||0x96;this['dialDropMaxRetry']=_0x5665a5[_0x7012('0x15')]||0x3;this[_0x7012('0x16')]=_0x5665a5[_0x7012('0x16')]||0x96;this[_0x7012('0x17')]=_0x5665a5['dialAbandonedMaxRetry']||0x3;this[_0x7012('0x18')]=_0x5665a5[_0x7012('0x18')]||0x96;this['dialMachineMaxRetry']=_0x5665a5['dialMachineMaxRetry']||0x3;this[_0x7012('0x19')]=_0x5665a5[_0x7012('0x19')]||0x96;this[_0x7012('0x1a')]=_0x5665a5['dialAgentRejectMaxRetry']||0x3;this[_0x7012('0x1b')]=_0x5665a5['dialAgentRejectRetryFrequency']||0x96;this[_0x7012('0x1c')]=_0x5665a5[_0x7012('0x1c')]||_0x7012('0x1d');this['dialPrefix']=_0x5665a5['dialPrefix']||undefined;this[_0x7012('0x1e')]=_0x5665a5['dialRandomLastDigitCallerIdNumber']||undefined;this['dialCutDigit']=_0x5665a5[_0x7012('0x1f')]||undefined;this['TrunkBackup']=_0x5665a5[_0x7012('0x20')]?_0x5665a5[_0x7012('0x20')]:undefined;this['Trunk']=_0x5665a5[_0x7012('0x21')]?_0x5665a5['Trunk']:undefined;this['Interval']=_0x5665a5[_0x7012('0x22')]?_0x5665a5[_0x7012('0x22')]:undefined;this[_0x7012('0x23')]=_0x5665a5['SquareProject']?_0x5665a5['SquareProject']:undefined;this[_0x7012('0x24')]=_0x5665a5[_0x7012('0x23')]?_0x5665a5[_0x7012('0x23')][_0x7012('0x25')]:undefined;this['dialAMDActive']=_0x5665a5['dialAMDActive']||![];this[_0x7012('0x26')]=_0x5665a5['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x5665a5[_0x7012('0x27')];this[_0x7012('0x28')]=_0x5665a5[_0x7012('0x28')];this[_0x7012('0x29')]=_0x5665a5[_0x7012('0x29')];this[_0x7012('0x2a')]=_0x5665a5[_0x7012('0x2a')];this[_0x7012('0x2b')]=_0x5665a5[_0x7012('0x2b')];this[_0x7012('0x2c')]=_0x5665a5['dialAMDMaximumNumberOfWords'];this[_0x7012('0x2d')]=_0x5665a5[_0x7012('0x2d')];this[_0x7012('0x2e')]=_0x5665a5[_0x7012('0x2e')];}module['exports']=Campaign; \ No newline at end of file +var _0x8075=['TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','originated','temp','ivrAnswerCallsDay','message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit'];(function(_0xb264e3,_0xabe8f6){var _0x57aff0=function(_0x6b3f97){while(--_0x6b3f97){_0xb264e3['push'](_0xb264e3['shift']());}};_0x57aff0(++_0xabe8f6);}(_0x8075,0x6e));var _0x5807=function(_0x4c334b,_0x33e07a){_0x4c334b=_0x4c334b-0x0;var _0x4b521=_0x8075[_0x4c334b];return _0x4b521;};'use strict';function Campaign(_0x25b455){this['id']=_0x25b455['id']||0x0;this[_0x5807('0x0')]=_0x25b455[_0x5807('0x0')]||'';this[_0x5807('0x1')]=_0x25b455[_0x5807('0x1')]||'campaign';this[_0x5807('0x2')]=0x0;this[_0x5807('0x3')]=0x0;this[_0x5807('0x4')]=0x0;this['ivrTotalCallsDays']=0x0;this[_0x5807('0x5')]='';this[_0x5807('0x6')]=!![];this[_0x5807('0x7')]=_0x25b455[_0x5807('0x7')];this[_0x5807('0x8')]=_0x25b455[_0x5807('0x8')];this[_0x5807('0x9')]=_0x25b455[_0x5807('0x9')]||null;this[_0x5807('0xa')]=_0x25b455[_0x5807('0xa')]?_0x25b455[_0x5807('0xa')]:null;this['dialOriginateCallerIdName']=_0x25b455['dialOriginateCallerIdName'];this[_0x5807('0xb')]=_0x25b455[_0x5807('0xb')];this[_0x5807('0xc')]=_0x25b455[_0x5807('0xc')]||0x1e;this[_0x5807('0xd')]=_0x25b455['dialCongestionMaxRetry'];this[_0x5807('0xe')]=_0x25b455[_0x5807('0xe')];this[_0x5807('0xf')]=_0x25b455[_0x5807('0xf')];this['dialBusyRetryFrequency']=_0x25b455['dialBusyRetryFrequency'];this[_0x5807('0x10')]=_0x25b455[_0x5807('0x10')];this[_0x5807('0x11')]=_0x25b455[_0x5807('0x11')];this[_0x5807('0x12')]=_0x25b455['dialGlobalMaxRetry'];this[_0x5807('0x13')]=_0x25b455['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x25b455[_0x5807('0x14')]||0x96;this['dialDropMaxRetry']=_0x25b455[_0x5807('0x15')]||0x3;this[_0x5807('0x16')]=_0x25b455[_0x5807('0x16')]||0x96;this[_0x5807('0x17')]=_0x25b455[_0x5807('0x17')]||0x3;this[_0x5807('0x18')]=_0x25b455['dialAbandonedRetryFrequency']||0x96;this[_0x5807('0x19')]=_0x25b455[_0x5807('0x19')]||0x3;this['dialMachineRetryFrequency']=_0x25b455[_0x5807('0x1a')]||0x96;this['dialAgentRejectMaxRetry']=_0x25b455[_0x5807('0x1b')]||0x3;this[_0x5807('0x1c')]=_0x25b455[_0x5807('0x1c')]||0x96;this['dialOrderByScheduledAt']=_0x25b455[_0x5807('0x1d')]||_0x5807('0x1e');this[_0x5807('0x1f')]=_0x25b455['dialPrefix']||undefined;this['dialRandomLastDigitCallerIdNumber']=_0x25b455[_0x5807('0x20')]||undefined;this[_0x5807('0x21')]=_0x25b455[_0x5807('0x21')]||undefined;this[_0x5807('0x22')]=_0x25b455['TrunkBackup']?_0x25b455[_0x5807('0x22')]:undefined;this[_0x5807('0x23')]=_0x25b455[_0x5807('0x23')]?_0x25b455[_0x5807('0x23')]:undefined;this['Interval']=_0x25b455[_0x5807('0x24')]?_0x25b455[_0x5807('0x24')]:undefined;this[_0x5807('0x25')]=_0x25b455[_0x5807('0x25')]?_0x25b455['SquareProject']:undefined;this[_0x5807('0x26')]=_0x25b455[_0x5807('0x25')]?_0x25b455['SquareProject'][_0x5807('0x0')]:undefined;this[_0x5807('0x27')]=_0x25b455[_0x5807('0x27')]||![];this['dialAMDInitialSilence']=_0x25b455['dialAMDInitialSilence'];this['dialAMDGreeting']=_0x25b455['dialAMDGreeting'];this[_0x5807('0x28')]=_0x25b455[_0x5807('0x28')];this[_0x5807('0x29')]=_0x25b455[_0x5807('0x29')];this[_0x5807('0x2a')]=_0x25b455[_0x5807('0x2a')];this[_0x5807('0x2b')]=_0x25b455['dialAMDBetweenWordsSilence'];this[_0x5807('0x2c')]=_0x25b455[_0x5807('0x2c')];this[_0x5807('0x2d')]=_0x25b455['dialAMDSilenceThreshold'];this[_0x5807('0x2e')]=_0x25b455[_0x5807('0x2e')];}module[_0x5807('0x2f')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index bbe3b88..8c98670 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 _0xff99=['billableseconds','holdtime','type','tag','disposition','monitor','queue','transfercalleridnum','transferconnectedlinenum','transferType','mohtime','channel','calleridnum','accountcode','context','uniqueid','linkedid','answertime','endtime','unmanaged','abandoned','lastdata'];(function(_0x260f28,_0x4e9b30){var _0x3aefcc=function(_0x223b18){while(--_0x223b18){_0x260f28['push'](_0x260f28['shift']());}};_0x3aefcc(++_0x4e9b30);}(_0xff99,0x129));var _0x9ff9=function(_0x3b68e2,_0x235f7d){_0x3b68e2=_0x3b68e2-0x0;var _0x450bc6=_0xff99[_0x3b68e2];return _0x450bc6;};'use strict';function Channel(){this['starttime']=null;this[_0x9ff9('0x0')]='';this['destinationchannel']='';this[_0x9ff9('0x1')]=0x0;this['calleridname']='';this['connectedlinenum']=undefined;this['connectedlinename']=undefined;this[_0x9ff9('0x2')]=0x0;this[_0x9ff9('0x3')]='';this[_0x9ff9('0x4')]=0x0;this[_0x9ff9('0x5')]=0x0;this['exten']=0x0;this['answered']=![];this[_0x9ff9('0x6')]=null;this[_0x9ff9('0x7')]=null;this[_0x9ff9('0x8')]=![];this[_0x9ff9('0x9')]=![];this['lastapplication']='';this[_0x9ff9('0xa')]='';this['duration']=0x0;this[_0x9ff9('0xb')]=0x0;this[_0x9ff9('0xc')]=0x0;this[_0x9ff9('0xd')]=null;this[_0x9ff9('0xe')]=null;this[_0x9ff9('0xf')]=null;this[_0x9ff9('0x10')]=![];this['monitorFilename']=null;this[_0x9ff9('0x11')]=null;this['monitors']=[];this[_0x9ff9('0x12')]=undefined;this[_0x9ff9('0x13')]=undefined;this[_0x9ff9('0x14')]=undefined;this[_0x9ff9('0x15')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x3f7c=['unmanaged','abandoned','lastapplication','lastdata','duration','billableseconds','holdtime','type','disposition','monitor','queue','transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','calleridname','connectedlinename','context','uniqueid','linkedid','exten','answered','endtime'];(function(_0x2cf76f,_0x447824){var _0x7acdf8=function(_0x4879bf){while(--_0x4879bf){_0x2cf76f['push'](_0x2cf76f['shift']());}};_0x7acdf8(++_0x447824);}(_0x3f7c,0xaa));var _0xc3f7=function(_0xf97112,_0x10d2ad){_0xf97112=_0xf97112-0x0;var _0xf2067a=_0x3f7c[_0xf97112];return _0xf2067a;};'use strict';function Channel(){this[_0xc3f7('0x0')]=null;this[_0xc3f7('0x1')]='';this[_0xc3f7('0x2')]='';this[_0xc3f7('0x3')]=0x0;this[_0xc3f7('0x4')]='';this['connectedlinenum']=undefined;this[_0xc3f7('0x5')]=undefined;this['accountcode']=0x0;this[_0xc3f7('0x6')]='';this[_0xc3f7('0x7')]=0x0;this[_0xc3f7('0x8')]=0x0;this[_0xc3f7('0x9')]=0x0;this[_0xc3f7('0xa')]=![];this['answertime']=null;this[_0xc3f7('0xb')]=null;this[_0xc3f7('0xc')]=![];this[_0xc3f7('0xd')]=![];this[_0xc3f7('0xe')]='';this[_0xc3f7('0xf')]='';this[_0xc3f7('0x10')]=0x0;this[_0xc3f7('0x11')]=0x0;this[_0xc3f7('0x12')]=0x0;this[_0xc3f7('0x13')]=null;this['tag']=null;this[_0xc3f7('0x14')]=null;this[_0xc3f7('0x15')]=![];this['monitorFilename']=null;this[_0xc3f7('0x16')]=null;this['monitors']=[];this['transfercalleridnum']=undefined;this[_0xc3f7('0x17')]=undefined;this['transferType']=undefined;this[_0xc3f7('0x18')]=0x0;}module[_0xc3f7('0x19')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index dc62f7f..0007366 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 _0x5222=['username','remoteUri','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5222,0x150));var _0x2522=function(_0x4073ea,_0x56357c){_0x4073ea=_0x4073ea-0x0;var _0x44df4a=_0x5222[_0x4073ea];return _0x44df4a;};'use strict';function DeskAccount(_0x4ccf59){this['id']=_0x4ccf59['id']||0x0;this['name']=_0x4ccf59['name']||'';this[_0x2522('0x0')]=_0x4ccf59[_0x2522('0x0')]||'';this['remoteUri']=_0x4ccf59[_0x2522('0x1')]||'';this[_0x2522('0x2')]=_0x4ccf59[_0x2522('0x2')]||'';this[_0x2522('0x3')]=_0x4ccf59[_0x2522('0x3')]||'';this[_0x2522('0x4')]=_0x4ccf59[_0x2522('0x4')]||'';this[_0x2522('0x5')]=_0x4ccf59[_0x2522('0x5')]||'';this[_0x2522('0x6')]=_0x4ccf59[_0x2522('0x6')]||'';this[_0x2522('0x7')]=_0x4ccf59['tokenSecret']||'';this[_0x2522('0x8')]=_0x4ccf59[_0x2522('0x8')]||'';this[_0x2522('0x9')]=_0x4ccf59['serverUrl']||'';this[_0x2522('0xa')]=_0x4ccf59[_0x2522('0xa')]||{};}module[_0x2522('0xb')]=DeskAccount; \ No newline at end of file +var _0x0d3c=['name','username','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x279c42,_0x33614d){var _0x52eecf=function(_0xabd4ce){while(--_0xabd4ce){_0x279c42['push'](_0x279c42['shift']());}};_0x52eecf(++_0x33614d);}(_0x0d3c,0x1a2));var _0xc0d3=function(_0x51f80b,_0x2afae3){_0x51f80b=_0x51f80b-0x0;var _0x26ffdd=_0x0d3c[_0x51f80b];return _0x26ffdd;};'use strict';function DeskAccount(_0x3882f5){this['id']=_0x3882f5['id']||0x0;this[_0xc0d3('0x0')]=_0x3882f5[_0xc0d3('0x0')]||'';this[_0xc0d3('0x1')]=_0x3882f5['username']||'';this['remoteUri']=_0x3882f5['remoteUri']||'';this[_0xc0d3('0x2')]=_0x3882f5[_0xc0d3('0x2')]||'';this['password']=_0x3882f5[_0xc0d3('0x3')]||'';this[_0xc0d3('0x4')]=_0x3882f5['consumerKey']||'';this[_0xc0d3('0x5')]=_0x3882f5['consumerSecret']||'';this[_0xc0d3('0x6')]=_0x3882f5[_0xc0d3('0x6')]||'';this[_0xc0d3('0x7')]=_0x3882f5['tokenSecret']||'';this['type']=_0x3882f5[_0xc0d3('0x8')]||'';this[_0xc0d3('0x9')]=_0x3882f5['serverUrl']||'';this['Configurations']=_0x3882f5[_0xc0d3('0xa')]||{};}module['exports']=DeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/dynamics365Account.js b/server/services/ami/model/dynamics365Account.js index ef221a0..81c1455 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 _0x9348=['username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl','Configurations','name'];(function(_0x590b61,_0x4c4335){var _0x1a14dc=function(_0x2ff4f6){while(--_0x2ff4f6){_0x590b61['push'](_0x590b61['shift']());}};_0x1a14dc(++_0x4c4335);}(_0x9348,0x10d));var _0x8934=function(_0x58698c,_0x3f9b82){_0x58698c=_0x58698c-0x0;var _0x23bc2f=_0x9348[_0x58698c];return _0x23bc2f;};'use strict';function Dynamics365Account(_0x41a189){this['id']=_0x41a189['id']||0x0;this[_0x8934('0x0')]=_0x41a189[_0x8934('0x0')]||'';this[_0x8934('0x1')]=_0x41a189[_0x8934('0x1')]||'';this['password']=_0x41a189[_0x8934('0x2')]||'';this[_0x8934('0x3')]=_0x41a189['remoteUri']||'';this[_0x8934('0x4')]=_0x41a189[_0x8934('0x4')]||'';this[_0x8934('0x5')]=_0x41a189[_0x8934('0x5')]||'';this[_0x8934('0x6')]=_0x41a189[_0x8934('0x6')]||{};this['serverUrl']=_0x41a189[_0x8934('0x7')]||'';this[_0x8934('0x8')]=_0x41a189[_0x8934('0x8')]||{};}module['exports']=Dynamics365Account; \ No newline at end of file +var _0x0713=['Configurations','exports','name','username','password','remoteUri','tenantId','clientId','clientSecret','serverUrl'];(function(_0x466247,_0x5d69e3){var _0x4b352e=function(_0x58c71b){while(--_0x58c71b){_0x466247['push'](_0x466247['shift']());}};_0x4b352e(++_0x5d69e3);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';function Dynamics365Account(_0x4bf247){this['id']=_0x4bf247['id']||0x0;this['name']=_0x4bf247[_0x3071('0x0')]||'';this[_0x3071('0x1')]=_0x4bf247[_0x3071('0x1')]||'';this[_0x3071('0x2')]=_0x4bf247[_0x3071('0x2')]||'';this['remoteUri']=_0x4bf247[_0x3071('0x3')]||'';this[_0x3071('0x4')]=_0x4bf247[_0x3071('0x4')]||'';this[_0x3071('0x5')]=_0x4bf247[_0x3071('0x5')]||'';this[_0x3071('0x6')]=_0x4bf247[_0x3071('0x6')]||{};this[_0x3071('0x7')]=_0x4bf247[_0x3071('0x7')]||'';this[_0x3071('0x8')]=_0x4bf247[_0x3071('0x8')]||{};}module[_0x3071('0x9')]=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index cf2e85a..6cee4b2 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 _0x5a41=['gateway','faxdetect','t38timeout','tech','SIP','Trunk','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29'];(function(_0x47d8b1,_0x4c7cb9){var _0x237f6e=function(_0x1bf8dc){while(--_0x1bf8dc){_0x47d8b1['push'](_0x47d8b1['shift']());}};_0x237f6e(++_0x4c7cb9);}(_0x5a41,0x1b1));var _0x15a4=function(_0x5070a4,_0x1db896){_0x5070a4=_0x5070a4-0x0;var _0x179668=_0x5a41[_0x5070a4];return _0x179668;};'use strict';function FaxAccount(_0x446aa3){this['id']=_0x446aa3['id']||0x0;this[_0x15a4('0x0')]=_0x446aa3[_0x15a4('0x0')]||'';this[_0x15a4('0x1')]=_0x446aa3[_0x15a4('0x1')];this['ecm']=_0x446aa3[_0x15a4('0x2')];this[_0x15a4('0x3')]=_0x446aa3[_0x15a4('0x3')];this[_0x15a4('0x4')]=_0x446aa3[_0x15a4('0x4')];this['minrate']=_0x446aa3[_0x15a4('0x5')]||0x960;this[_0x15a4('0x6')]=_0x446aa3[_0x15a4('0x6')]||0x3840;this['modem']=_0x446aa3[_0x15a4('0x7')]||_0x15a4('0x8');this[_0x15a4('0x9')]=_0x446aa3[_0x15a4('0x9')]||'no';this[_0x15a4('0xa')]=_0x446aa3[_0x15a4('0xa')]||'no';this[_0x15a4('0xb')]=_0x446aa3['t38timeout']||0x1388;this[_0x15a4('0xc')]=_0x446aa3[_0x15a4('0xc')]||_0x15a4('0xd');this['Trunk']=_0x446aa3[_0x15a4('0xe')]?_0x446aa3[_0x15a4('0xe')]:undefined;this['ListId']=_0x446aa3['ListId'];this[_0x15a4('0xf')]=_0x446aa3[_0x15a4('0xf')];}module[_0x15a4('0x10')]=FaxAccount; \ No newline at end of file +var _0xa6ed=['maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout','tech','SIP','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate'];(function(_0x274340,_0x209642){var _0x3bdedb=function(_0x1ca685){while(--_0x1ca685){_0x274340['push'](_0x274340['shift']());}};_0x3bdedb(++_0x209642);}(_0xa6ed,0xf6));var _0xda6e=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0xa6ed[_0x2be8c2];return _0x97f531;};'use strict';function FaxAccount(_0x403d98){this['id']=_0x403d98['id']||0x0;this[_0xda6e('0x0')]=_0x403d98[_0xda6e('0x0')]||'';this[_0xda6e('0x1')]=_0x403d98[_0xda6e('0x1')];this[_0xda6e('0x2')]=_0x403d98['ecm'];this[_0xda6e('0x3')]=_0x403d98[_0xda6e('0x3')];this[_0xda6e('0x4')]=_0x403d98['localstationid'];this[_0xda6e('0x5')]=_0x403d98['minrate']||0x960;this[_0xda6e('0x6')]=_0x403d98[_0xda6e('0x6')]||0x3840;this['modem']=_0x403d98[_0xda6e('0x7')]||_0xda6e('0x8');this[_0xda6e('0x9')]=_0x403d98[_0xda6e('0x9')]||'no';this[_0xda6e('0xa')]=_0x403d98[_0xda6e('0xa')]||'no';this[_0xda6e('0xb')]=_0x403d98[_0xda6e('0xb')]||0x1388;this[_0xda6e('0xc')]=_0x403d98[_0xda6e('0xc')]||_0xda6e('0xd');this['Trunk']=_0x403d98['Trunk']?_0x403d98[_0xda6e('0xe')]:undefined;this[_0xda6e('0xf')]=_0x403d98['ListId'];this[_0xda6e('0x10')]=_0x403d98[_0xda6e('0x10')];}module[_0xda6e('0x11')]=FaxAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshdeskAccount.js b/server/services/ami/model/freshdeskAccount.js index 4bbec90..f77de41 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 _0x02bb=['exports','name','username','apiKey','token','remoteUri','serverUrl','Configurations'];(function(_0x4e6cbb,_0x3450f0){var _0x15ced4=function(_0x248dd2){while(--_0x248dd2){_0x4e6cbb['push'](_0x4e6cbb['shift']());}};_0x15ced4(++_0x3450f0);}(_0x02bb,0xc1));var _0xb02b=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x02bb[_0x413feb];return _0x40ee88;};'use strict';function FreshdeskAccount(_0x3e5146){this['id']=_0x3e5146['id']||0x0;this[_0xb02b('0x0')]=_0x3e5146[_0xb02b('0x0')]||'';this[_0xb02b('0x1')]=_0x3e5146[_0xb02b('0x1')]||'';this[_0xb02b('0x2')]=_0x3e5146[_0xb02b('0x3')]||'';this['remoteUri']=_0x3e5146[_0xb02b('0x4')]||'';this[_0xb02b('0x5')]=_0x3e5146[_0xb02b('0x5')]||'';this[_0xb02b('0x6')]=_0x3e5146[_0xb02b('0x6')]||{};}module[_0xb02b('0x7')]=FreshdeskAccount; \ No newline at end of file +var _0x6463=['exports','name','username','token','remoteUri','serverUrl','Configurations'];(function(_0x3ae2b2,_0x2d936f){var _0x1dbf00=function(_0x4072e9){while(--_0x4072e9){_0x3ae2b2['push'](_0x3ae2b2['shift']());}};_0x1dbf00(++_0x2d936f);}(_0x6463,0xa2));var _0x3646=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x6463[_0x3dd15e];return _0x231fd0;};'use strict';function FreshdeskAccount(_0xcc1d98){this['id']=_0xcc1d98['id']||0x0;this['name']=_0xcc1d98[_0x3646('0x0')]||'';this[_0x3646('0x1')]=_0xcc1d98[_0x3646('0x1')]||'';this['apiKey']=_0xcc1d98[_0x3646('0x2')]||'';this[_0x3646('0x3')]=_0xcc1d98[_0x3646('0x3')]||'';this['serverUrl']=_0xcc1d98[_0x3646('0x4')]||'';this[_0x3646('0x5')]=_0xcc1d98[_0x3646('0x5')]||{};}module[_0x3646('0x6')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 632962e..0a2e6c9 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 _0x212b=['username','apiKey','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x31b3fd,_0x45e185){var _0x1dbb64=function(_0x56fe9b){while(--_0x56fe9b){_0x31b3fd['push'](_0x31b3fd['shift']());}};_0x1dbb64(++_0x45e185);}(_0x212b,0x148));var _0xb212=function(_0x337aea,_0x3adac0){_0x337aea=_0x337aea-0x0;var _0x1dd426=_0x212b[_0x337aea];return _0x1dd426;};'use strict';function FreshsalesAccount(_0x4fab1b){this['id']=_0x4fab1b['id']||0x0;this['name']=_0x4fab1b[_0xb212('0x0')]||'';this[_0xb212('0x1')]=_0x4fab1b[_0xb212('0x1')]||'';this[_0xb212('0x2')]=_0x4fab1b['token']||'';this[_0xb212('0x3')]=_0x4fab1b[_0xb212('0x3')]||'';this[_0xb212('0x4')]=_0x4fab1b['serverUrl']||'';this[_0xb212('0x5')]=_0x4fab1b[_0xb212('0x5')]||{};}module[_0xb212('0x6')]=FreshsalesAccount; \ No newline at end of file +var _0x979e=['token','remoteUri','serverUrl','Configurations','exports','name','username','apiKey'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x979e,0x195));var _0xe979=function(_0x369bca,_0x6a3b08){_0x369bca=_0x369bca-0x0;var _0x3c56a8=_0x979e[_0x369bca];return _0x3c56a8;};'use strict';function FreshsalesAccount(_0x27b5c3){this['id']=_0x27b5c3['id']||0x0;this[_0xe979('0x0')]=_0x27b5c3[_0xe979('0x0')]||'';this[_0xe979('0x1')]=_0x27b5c3['username']||'';this[_0xe979('0x2')]=_0x27b5c3[_0xe979('0x3')]||'';this[_0xe979('0x4')]=_0x27b5c3[_0xe979('0x4')]||'';this[_0xe979('0x5')]=_0x27b5c3['serverUrl']||'';this[_0xe979('0x6')]=_0x27b5c3['Configurations']||{};}module[_0xe979('0x7')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index 3a65971..97ad9ce 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 _0xa83e=['queuecallerjoinAt','count','queuecallerabandon','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','connectedlinename','accountcode','context','priority','holdtime','assigned','lastAssignedTo','mohtime','exports','type','calleridnum','calleridname'];(function(_0x2f11b6,_0x44808d){var _0x3a0a8f=function(_0xb3e26d){while(--_0xb3e26d){_0x2f11b6['push'](_0x2f11b6['shift']());}};_0x3a0a8f(++_0x44808d);}(_0xa83e,0x1f1));var _0xea83=function(_0x1306f3,_0x1da761){_0x1306f3=_0x1306f3-0x0;var _0xc1c7bf=_0xa83e[_0x1306f3];return _0xc1c7bf;};'use strict';function QueueReport(){this[_0xea83('0x0')]='inbound';this['uniqueid']='';this[_0xea83('0x1')]='';this[_0xea83('0x2')]='';this['queue']='';this[_0xea83('0x3')]=null;this['queuecallerleaveAt']=null;this['position']=0x1;this[_0xea83('0x4')]=0x1;this[_0xea83('0x5')]=![];this[_0xea83('0x6')]=null;this[_0xea83('0x7')]=![];this[_0xea83('0x8')]=null;this[_0xea83('0x9')]=![];this['queuecallerexitAt']=null;this[_0xea83('0xa')]=0x1;this['channel']='';this['connectedlinenum']='';this[_0xea83('0xb')]='';this[_0xea83('0xc')]='';this[_0xea83('0xd')]='';this['exten']='';this[_0xea83('0xe')]='';this[_0xea83('0xf')]=0x0;this[_0xea83('0x10')]=![];this[_0xea83('0x11')]='';this[_0xea83('0x12')]=0x0;this['variables']={};}module[_0xea83('0x13')]=QueueReport; \ No newline at end of file +var _0x00cc=['mohtime','variables','exports','inbound','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexit','originalposition','channel','accountcode','context','priority','holdtime','assigned','lastAssignedTo'];(function(_0x25e037,_0x7abf1a){var _0x4896ba=function(_0x30c1e3){while(--_0x30c1e3){_0x25e037['push'](_0x25e037['shift']());}};_0x4896ba(++_0x7abf1a);}(_0x00cc,0x76));var _0xc00c=function(_0x4d0aab,_0x5981c9){_0x4d0aab=_0x4d0aab-0x0;var _0x26231c=_0x00cc[_0x4d0aab];return _0x26231c;};'use strict';function QueueReport(){this['type']=_0xc00c('0x0');this[_0xc00c('0x1')]='';this[_0xc00c('0x2')]='';this[_0xc00c('0x3')]='';this[_0xc00c('0x4')]='';this[_0xc00c('0x5')]=null;this['queuecallerleaveAt']=null;this[_0xc00c('0x6')]=0x1;this[_0xc00c('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xc00c('0x8')]=null;this[_0xc00c('0x9')]=![];this[_0xc00c('0xa')]=null;this[_0xc00c('0xb')]=![];this['queuecallerexitAt']=null;this[_0xc00c('0xc')]=0x1;this[_0xc00c('0xd')]='';this['connectedlinenum']='';this['connectedlinename']='';this[_0xc00c('0xe')]='';this[_0xc00c('0xf')]='';this['exten']='';this[_0xc00c('0x10')]='';this[_0xc00c('0x11')]=0x0;this[_0xc00c('0x12')]=![];this[_0xc00c('0x13')]='';this[_0xc00c('0x14')]=0x0;this[_0xc00c('0x15')]={};}module[_0xc00c('0x16')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index f5bbb63..79ab2f5 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 _0x0954=['exports','name','username','remoteUri','password','clientId','securityToken','type','integrationTab','serverUrl','Configurations'];(function(_0x56ba92,_0xb3c986){var _0x8fe94d=function(_0x23b21c){while(--_0x23b21c){_0x56ba92['push'](_0x56ba92['shift']());}};_0x8fe94d(++_0xb3c986);}(_0x0954,0x135));var _0x4095=function(_0x4b4638,_0xe99cda){_0x4b4638=_0x4b4638-0x0;var _0x59e92b=_0x0954[_0x4b4638];return _0x59e92b;};'use strict';function SalesforceAccount(_0x37e407){this['id']=_0x37e407['id']||0x0;this['name']=_0x37e407[_0x4095('0x0')]||'';this[_0x4095('0x1')]=_0x37e407['username']||'';this[_0x4095('0x2')]=_0x37e407[_0x4095('0x2')]||'';this[_0x4095('0x3')]=_0x37e407[_0x4095('0x3')]||'';this[_0x4095('0x4')]=_0x37e407[_0x4095('0x4')]||'';this['clientSecret']=_0x37e407['clientSecret']||'';this['securityToken']=_0x37e407[_0x4095('0x5')]||'';this[_0x4095('0x6')]=_0x37e407[_0x4095('0x6')]||_0x4095('0x7');this[_0x4095('0x8')]=_0x37e407[_0x4095('0x8')]||'';this['Configurations']=_0x37e407[_0x4095('0x9')]||{};}module[_0x4095('0xa')]=SalesforceAccount; \ No newline at end of file +var _0xc273=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','exports','name'];(function(_0x16295e,_0x4a9b05){var _0x2d9e54=function(_0x396291){while(--_0x396291){_0x16295e['push'](_0x16295e['shift']());}};_0x2d9e54(++_0x4a9b05);}(_0xc273,0x197));var _0x3c27=function(_0x524ce0,_0x3670b2){_0x524ce0=_0x524ce0-0x0;var _0x38299f=_0xc273[_0x524ce0];return _0x38299f;};'use strict';function SalesforceAccount(_0x21460e){this['id']=_0x21460e['id']||0x0;this[_0x3c27('0x0')]=_0x21460e[_0x3c27('0x0')]||'';this[_0x3c27('0x1')]=_0x21460e[_0x3c27('0x1')]||'';this[_0x3c27('0x2')]=_0x21460e['remoteUri']||'';this[_0x3c27('0x3')]=_0x21460e[_0x3c27('0x3')]||'';this[_0x3c27('0x4')]=_0x21460e['clientId']||'';this[_0x3c27('0x5')]=_0x21460e['clientSecret']||'';this[_0x3c27('0x6')]=_0x21460e[_0x3c27('0x6')]||'';this[_0x3c27('0x7')]=_0x21460e[_0x3c27('0x7')]||_0x3c27('0x8');this['serverUrl']=_0x21460e[_0x3c27('0x9')]||'';this[_0x3c27('0xa')]=_0x21460e['Configurations']||{};}module[_0x3c27('0xb')]=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index 64af88b..77ced1c 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 _0x563e=['serverUrl','name','username','password','remoteUri'];(function(_0x45b7ad,_0x362f48){var _0x116d36=function(_0x5f70f){while(--_0x5f70f){_0x45b7ad['push'](_0x45b7ad['shift']());}};_0x116d36(++_0x362f48);}(_0x563e,0x1af));var _0xe563=function(_0x16e824,_0x23ab90){_0x16e824=_0x16e824-0x0;var _0x1745ea=_0x563e[_0x16e824];return _0x1745ea;};'use strict';function ServicenowAccount(_0x484902){this['id']=_0x484902['id']||0x0;this[_0xe563('0x0')]=_0x484902['name']||'';this[_0xe563('0x1')]=_0x484902[_0xe563('0x1')]||'';this[_0xe563('0x2')]=_0x484902[_0xe563('0x2')]||'';this['remoteUri']=_0x484902[_0xe563('0x3')]||'';this[_0xe563('0x4')]=_0x484902[_0xe563('0x4')]||'';this['Configurations']=_0x484902['Configurations']||{};}module['exports']=ServicenowAccount; \ No newline at end of file +var _0xea3f=['serverUrl','Configurations','exports','name','password','remoteUri'];(function(_0x14a70b,_0x506107){var _0x2687a4=function(_0x492cb5){while(--_0x492cb5){_0x14a70b['push'](_0x14a70b['shift']());}};_0x2687a4(++_0x506107);}(_0xea3f,0x105));var _0xfea3=function(_0x1dcf37,_0x150062){_0x1dcf37=_0x1dcf37-0x0;var _0x4323ea=_0xea3f[_0x1dcf37];return _0x4323ea;};'use strict';function ServicenowAccount(_0x2bb953){this['id']=_0x2bb953['id']||0x0;this['name']=_0x2bb953[_0xfea3('0x0')]||'';this['username']=_0x2bb953['username']||'';this[_0xfea3('0x1')]=_0x2bb953[_0xfea3('0x1')]||'';this[_0xfea3('0x2')]=_0x2bb953['remoteUri']||'';this[_0xfea3('0x3')]=_0x2bb953[_0xfea3('0x3')]||'';this[_0xfea3('0x4')]=_0x2bb953[_0xfea3('0x4')]||{};}module[_0xfea3('0x5')]=ServicenowAccount; \ No newline at end of file diff --git a/server/services/ami/model/sugarcrmAccount.js b/server/services/ami/model/sugarcrmAccount.js index b9c315a..df73ab9 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 _0x4156=['exports','name','username','password','remoteUri','serverUrl','Configurations'];(function(_0x50a0c2,_0x4befab){var _0x5ebadd=function(_0x3a3342){while(--_0x3a3342){_0x50a0c2['push'](_0x50a0c2['shift']());}};_0x5ebadd(++_0x4befab);}(_0x4156,0x1eb));var _0x6415=function(_0x31abf3,_0x195f20){_0x31abf3=_0x31abf3-0x0;var _0x1f4614=_0x4156[_0x31abf3];return _0x1f4614;};'use strict';function SugarcrmAccount(_0x5f138f){this['id']=_0x5f138f['id']||0x0;this['name']=_0x5f138f[_0x6415('0x0')]||'';this['username']=_0x5f138f[_0x6415('0x1')]||'';this[_0x6415('0x2')]=_0x5f138f[_0x6415('0x2')]||'';this[_0x6415('0x3')]=_0x5f138f[_0x6415('0x3')]||'';this[_0x6415('0x4')]=_0x5f138f['serverUrl']||'';this[_0x6415('0x5')]=_0x5f138f[_0x6415('0x5')]||{};}module[_0x6415('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xa9c1=['serverUrl','Configurations','username','password','remoteUri'];(function(_0x469f41,_0x594e63){var _0x5e2728=function(_0x3f294b){while(--_0x3f294b){_0x469f41['push'](_0x469f41['shift']());}};_0x5e2728(++_0x594e63);}(_0xa9c1,0x1d3));var _0x1a9c=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0xa9c1[_0x3bf83f];return _0x22c4a9;};'use strict';function SugarcrmAccount(_0x465e61){this['id']=_0x465e61['id']||0x0;this['name']=_0x465e61['name']||'';this[_0x1a9c('0x0')]=_0x465e61[_0x1a9c('0x0')]||'';this[_0x1a9c('0x1')]=_0x465e61[_0x1a9c('0x1')]||'';this[_0x1a9c('0x2')]=_0x465e61[_0x1a9c('0x2')]||'';this['serverUrl']=_0x465e61[_0x1a9c('0x3')]||'';this[_0x1a9c('0x4')]=_0x465e61['Configurations']||{};}module['exports']=SugarcrmAccount; \ No newline at end of file diff --git a/server/services/ami/model/telephone.js b/server/services/ami/model/telephone.js index df26419..5333b26 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 _0x2b50=['unknown','stateTime','status','exports','name'];(function(_0x1cb827,_0x369239){var _0xa3dcbc=function(_0x5daee6){while(--_0x5daee6){_0x1cb827['push'](_0x1cb827['shift']());}};_0xa3dcbc(++_0x369239);}(_0x2b50,0x68));var _0x02b5=function(_0x24372a,_0x1003b6){_0x24372a=_0x24372a-0x0;var _0x283a1b=_0x2b50[_0x24372a];return _0x283a1b;};'use strict';function Telephone(_0x5a99a8){this['id']=_0x5a99a8['id']||0x0;this['name']=_0x5a99a8[_0x02b5('0x0')]||'';this['accountcode']=_0x5a99a8['accountcode']||'';this['state']=_0x02b5('0x1');this[_0x02b5('0x2')]=0x0;this[_0x02b5('0x3')]=_0x02b5('0x1');this['address']='';}module[_0x02b5('0x4')]=Telephone; \ No newline at end of file +var _0x97a8=['accountcode','state','unknown','stateTime','address','name'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x97a8,0xe3));var _0x897a=function(_0x1c9c43,_0x437ae1){_0x1c9c43=_0x1c9c43-0x0;var _0xc1ad11=_0x97a8[_0x1c9c43];return _0xc1ad11;};'use strict';function Telephone(_0x515024){this['id']=_0x515024['id']||0x0;this[_0x897a('0x0')]=_0x515024[_0x897a('0x0')]||'';this[_0x897a('0x1')]=_0x515024[_0x897a('0x1')]||'';this[_0x897a('0x2')]=_0x897a('0x3');this[_0x897a('0x4')]=0x0;this['status']=_0x897a('0x3');this[_0x897a('0x5')]='';}module['exports']=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index f9895bf..0850909 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 _0xb10b=['name','html'];(function(_0x3b52dd,_0x5f164f){var _0x472730=function(_0x4ae773){while(--_0x4ae773){_0x3b52dd['push'](_0x3b52dd['shift']());}};_0x472730(++_0x5f164f);}(_0xb10b,0x12a));var _0xbb10=function(_0x196257,_0x256195){_0x196257=_0x196257-0x0;var _0x30d5c7=_0xb10b[_0x196257];return _0x30d5c7;};'use strict';function template(_0x13ce8d){this['id']=_0x13ce8d['id']||0x0;this['name']=_0x13ce8d[_0xbb10('0x0')]||'';this[_0xbb10('0x1')]=_0x13ce8d[_0xbb10('0x1')]||'';}module['exports']=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x6785c5,_0x5d8dc7){var _0x3351af=function(_0x93fdc8){while(--_0x93fdc8){_0x6785c5['push'](_0x6785c5['shift']());}};_0x3351af(++_0x5d8dc7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 9043e0d..cfe2fb3 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 _0x0b0e=['channel','voice','status','AllConditions','AnyConditions','Actions','exports','name'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0b0e,0x187));var _0xe0b0=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x0b0e[_0xfae23b];return _0x200640;};'use strict';function Trigger(_0x29cd1e){this['id']=_0x29cd1e['id']||0x0;this['name']=_0x29cd1e[_0xe0b0('0x0')]||'';this['channel']=_0x29cd1e[_0xe0b0('0x1')]||_0xe0b0('0x2');this[_0xe0b0('0x3')]=_0x29cd1e[_0xe0b0('0x3')]||![];this[_0xe0b0('0x4')]=_0x29cd1e[_0xe0b0('0x4')]||[];this[_0xe0b0('0x5')]=_0x29cd1e[_0xe0b0('0x5')]||[];this[_0xe0b0('0x6')]=_0x29cd1e[_0xe0b0('0x6')]||[];}module[_0xe0b0('0x7')]=Trigger; \ No newline at end of file +var _0x14a0=['voice','status','AnyConditions','Actions','name','channel'];(function(_0x16d79f,_0x48d1c9){var _0x5146e3=function(_0x22c5aa){while(--_0x22c5aa){_0x16d79f['push'](_0x16d79f['shift']());}};_0x5146e3(++_0x48d1c9);}(_0x14a0,0x8e));var _0x014a=function(_0x20f687,_0xc8281f){_0x20f687=_0x20f687-0x0;var _0x54f44b=_0x14a0[_0x20f687];return _0x54f44b;};'use strict';function Trigger(_0x1ee939){this['id']=_0x1ee939['id']||0x0;this[_0x014a('0x0')]=_0x1ee939[_0x014a('0x0')]||'';this[_0x014a('0x1')]=_0x1ee939[_0x014a('0x1')]||_0x014a('0x2');this[_0x014a('0x3')]=_0x1ee939[_0x014a('0x3')]||![];this['AllConditions']=_0x1ee939['AllConditions']||[];this[_0x014a('0x4')]=_0x1ee939[_0x014a('0x4')]||[];this[_0x014a('0x5')]=_0x1ee939['Actions']||[];}module['exports']=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 6fa3ced..516a0ad 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 _0x9dfa=['indexOf','split','host','domain','domainport','refresh','stateRegistry','registrationtime','address','defaultuser','exports','active','state','stateTime','status','registry'];(function(_0x210977,_0x1216d2){var _0x248ccb=function(_0x18304b){while(--_0x18304b){_0x210977['push'](_0x210977['shift']());}};_0x248ccb(++_0x1216d2);}(_0x9dfa,0xeb));var _0xa9df=function(_0x150422,_0x18a10e){_0x150422=_0x150422-0x0;var _0x679927=_0x9dfa[_0x150422];return _0x679927;};'use strict';function Trunk(_0x5a6f0c){this['id']=_0x5a6f0c['id']||0x0;this[_0xa9df('0x0')]=_0x5a6f0c[_0xa9df('0x0')]||![];this['name']=_0x5a6f0c['name']||'';this[_0xa9df('0x1')]='unknown';this[_0xa9df('0x2')]=0x0;this[_0xa9df('0x3')]='unknown';this[_0xa9df('0x4')]=_0x5a6f0c[_0xa9df('0x4')]&&_0x5a6f0c['registry'][_0xa9df('0x5')](':')?_0x5a6f0c[_0xa9df('0x4')][_0xa9df('0x6')](':')[0x0]:'';this[_0xa9df('0x7')]='';this['port']='';this[_0xa9df('0x8')]='';this[_0xa9df('0x9')]='';this[_0xa9df('0xa')]='';this[_0xa9df('0xb')]='unknown';this[_0xa9df('0xc')]='';this[_0xa9df('0xd')]='';this['defaultuser']=_0x5a6f0c[_0xa9df('0xe')]||'';}module[_0xa9df('0xf')]=Trunk; \ No newline at end of file +var _0xed94=['stateTime','status','registry','port','domain','domainport','refresh','registrationtime','defaultuser','exports','active','name','state','unknown'];(function(_0x23346c,_0x524fb6){var _0x13d53d=function(_0x42441f){while(--_0x42441f){_0x23346c['push'](_0x23346c['shift']());}};_0x13d53d(++_0x524fb6);}(_0xed94,0x96));var _0x4ed9=function(_0x192f6d,_0x3d8296){_0x192f6d=_0x192f6d-0x0;var _0x5b6f0f=_0xed94[_0x192f6d];return _0x5b6f0f;};'use strict';function Trunk(_0x50f86c){this['id']=_0x50f86c['id']||0x0;this[_0x4ed9('0x0')]=_0x50f86c['active']||![];this[_0x4ed9('0x1')]=_0x50f86c[_0x4ed9('0x1')]||'';this[_0x4ed9('0x2')]=_0x4ed9('0x3');this[_0x4ed9('0x4')]=0x0;this[_0x4ed9('0x5')]=_0x4ed9('0x3');this[_0x4ed9('0x6')]=_0x50f86c[_0x4ed9('0x6')]&&_0x50f86c[_0x4ed9('0x6')]['indexOf'](':')?_0x50f86c['registry']['split'](':')[0x0]:'';this['host']='';this[_0x4ed9('0x7')]='';this[_0x4ed9('0x8')]='';this[_0x4ed9('0x9')]='';this[_0x4ed9('0xa')]='';this['stateRegistry']=_0x4ed9('0x3');this[_0x4ed9('0xb')]='';this['address']='';this['defaultuser']=_0x50f86c[_0x4ed9('0xc')]||'';}module[_0x4ed9('0xd')]=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index e51f429..5c4dbcf 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 _0xced4=['recordingFormat','none','mandatoryDisposition','exten'];(function(_0x1f9505,_0x5758f7){var _0x18e5a5=function(_0x441a51){while(--_0x441a51){_0x1f9505['push'](_0x1f9505['shift']());}};_0x18e5a5(++_0x5758f7);}(_0xced4,0x163));var _0x4ced=function(_0x59ee91,_0x5ca1ef){_0x59ee91=_0x59ee91-0x0;var _0x51b0b7=_0xced4[_0x59ee91];return _0x51b0b7;};'use strict';function voiceExtension(_0x325e91){this['id']=_0x325e91['id']||0x0;this[_0x4ced('0x0')]=_0x325e91[_0x4ced('0x0')]||'';this[_0x4ced('0x1')]=_0x325e91[_0x4ced('0x1')]||_0x4ced('0x2');this['mandatoryDisposition']=_0x325e91[_0x4ced('0x3')]||![];}module['exports']=voiceExtension; \ No newline at end of file +var _0x10d4=['mandatoryDisposition','exports','exten','recordingFormat','none'];(function(_0x3712d2,_0x259c5a){var _0x18d859=function(_0x5242cf){while(--_0x5242cf){_0x3712d2['push'](_0x3712d2['shift']());}};_0x18d859(++_0x259c5a);}(_0x10d4,0xa2));var _0x410d=function(_0x10b6ae,_0x56a559){_0x10b6ae=_0x10b6ae-0x0;var _0x1321e9=_0x10d4[_0x10b6ae];return _0x1321e9;};'use strict';function voiceExtension(_0x592f42){this['id']=_0x592f42['id']||0x0;this[_0x410d('0x0')]=_0x592f42[_0x410d('0x0')]||'';this[_0x410d('0x1')]=_0x592f42[_0x410d('0x1')]||_0x410d('0x2');this[_0x410d('0x3')]=_0x592f42[_0x410d('0x3')]||![];}module[_0x410d('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index 480dcf5..f46814a 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 _0x69ee=['roundrobin','name','monitor_format','type','waiting','talking','total','answered','sumDuration','sumHoldTime','sumBillable','unmanaged','abandoned','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundReCallsDay','startProgressive','startPredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','not_inuse','inuse','invalid','unavailable','ringing','onhold','wav','wav49','gsm','rrmemory'];(function(_0x342a3f,_0x5d87cf){var _0x2a1d7d=function(_0xe68f84){while(--_0xe68f84){_0x342a3f['push'](_0x342a3f['shift']());}};_0x2a1d7d(++_0x5d87cf);}(_0x69ee,0x167));var _0xe69e=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x69ee[_0x3b380d];return _0x54502b;};'use strict';var statusDesc=['unknown',_0xe69e('0x0'),_0xe69e('0x1'),'busy',_0xe69e('0x2'),_0xe69e('0x3'),_0xe69e('0x4'),'ringinuse',_0xe69e('0x5')];var monitorFormat={'wav':_0xe69e('0x6'),'wav49':_0xe69e('0x7'),'gsm':_0xe69e('0x8')};var strategy={'rrmemory':_0xe69e('0x9'),'roundrobin':_0xe69e('0xa')};function VoiceQueue(_0x476bab){this['id']=_0x476bab['id']||0x0;this['name']=_0x476bab[_0xe69e('0xb')]||'';this[_0xe69e('0xc')]=_0x476bab[_0xe69e('0xc')]||'';this[_0xe69e('0xd')]=_0x476bab[_0xe69e('0xd')]||'inbound';this[_0xe69e('0xe')]=0x0;this[_0xe69e('0xf')]=0x0;this[_0xe69e('0x10')]=0x0;this[_0xe69e('0x11')]=0x0;this[_0xe69e('0x12')]=0x0;this[_0xe69e('0x13')]=0x0;this[_0xe69e('0x14')]=0x0;this[_0xe69e('0x15')]=0x0;this[_0xe69e('0x16')]=0x0;this[_0xe69e('0x17')]=0x0;this[_0xe69e('0x18')]=0x0;this[_0xe69e('0x19')]=_0x476bab[_0xe69e('0x19')]||![];this[_0xe69e('0x1a')]=_0x476bab[_0xe69e('0x1a')]||0xa;this[_0xe69e('0x1b')]=_0x476bab[_0xe69e('0x1b')]||'no';this[_0xe69e('0x1c')]=!![];this['message']='';this['originated']=0x0;this['temp']=0x0;this[_0xe69e('0x1d')]=_0x476bab[_0xe69e('0x1d')]||null;this[_0xe69e('0x1e')]=_0x476bab[_0xe69e('0x1e')]?_0x476bab['dialGlobalInterval']:null;this['dialActive']=_0x476bab[_0xe69e('0x1f')];this['dialMethod']=_0x476bab[_0xe69e('0x20')]||'progressive';this['dialLimitChannel']=_0x476bab[_0xe69e('0x21')]||0x0;this[_0xe69e('0x22')]=_0x476bab[_0xe69e('0x22')]||0x0;this[_0xe69e('0x23')]=_0x476bab[_0xe69e('0x23')]||0x1;this[_0xe69e('0x24')]=_0x476bab[_0xe69e('0x24')]||_0xe69e('0x25');this[_0xe69e('0x26')]=_0x476bab['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x476bab['dialPredictiveInterval']||0x258;this[_0xe69e('0x27')]=_0x476bab[_0xe69e('0x27')]||'anonymous';this['dialOriginateCallerIdNumber']=_0x476bab[_0xe69e('0x28')]||_0xe69e('0x29');this[_0xe69e('0x2a')]=_0x476bab[_0xe69e('0x2a')]||0x1e;this['dialQueueOptions']=_0x476bab[_0xe69e('0x2b')]||_0xe69e('0x2c');this[_0xe69e('0x2d')]=_0x476bab[_0xe69e('0x2d')]||0x3;this[_0xe69e('0x2e')]=_0x476bab[_0xe69e('0x2e')]||undefined;this[_0xe69e('0x2f')]=_0x476bab['dialCongestionMaxRetry']||0x3;this[_0xe69e('0x30')]=_0x476bab[_0xe69e('0x30')]||0x96;this['dialBusyMaxRetry']=_0x476bab[_0xe69e('0x31')]||0x3;this[_0xe69e('0x32')]=_0x476bab['dialBusyRetryFrequency']||0x96;this['dialNoAnswerMaxRetry']=_0x476bab['dialNoAnswerMaxRetry']||0x3;this[_0xe69e('0x33')]=_0x476bab[_0xe69e('0x33')]||0x96;this[_0xe69e('0x34')]=_0x476bab['dialNoSuchNumberMaxRetry']||0x3;this['dialNoSuchNumberRetryFrequency']=_0x476bab[_0xe69e('0x35')]||0x96;this[_0xe69e('0x36')]=_0x476bab[_0xe69e('0x36')]||0x3;this[_0xe69e('0x37')]=_0x476bab[_0xe69e('0x37')]||0x96;this[_0xe69e('0x38')]=_0x476bab[_0xe69e('0x38')]||0x3;this[_0xe69e('0x39')]=_0x476bab[_0xe69e('0x39')]||0x96;this[_0xe69e('0x3a')]=_0x476bab['dialMachineMaxRetry']||0x3;this[_0xe69e('0x3b')]=_0x476bab[_0xe69e('0x3b')]||0x96;this[_0xe69e('0x3c')]=_0x476bab[_0xe69e('0x3c')]||0x3;this['dialAgentRejectRetryFrequency']=_0x476bab[_0xe69e('0x3d')]||0x96;this[_0xe69e('0x3e')]=_0x476bab['dialGlobalMaxRetry']||0x4;this[_0xe69e('0x3f')]=_0x476bab[_0xe69e('0x3f')]?_0x476bab[_0xe69e('0x3f')]:undefined;this[_0xe69e('0x40')]=_0x476bab[_0xe69e('0x40')]?_0x476bab[_0xe69e('0x40')]:undefined;this[_0xe69e('0x41')]=_0x476bab[_0xe69e('0x41')]||undefined;this[_0xe69e('0x42')]=_0x476bab['Interval']?_0x476bab[_0xe69e('0x42')]:undefined;this[_0xe69e('0x43')]=_0x476bab['dialOrderByScheduledAt']||_0xe69e('0x44');this['dialRandomLastDigitCallerIdNumber']=_0x476bab[_0xe69e('0x45')]||undefined;this[_0xe69e('0x46')]=_0x476bab[_0xe69e('0x46')]||undefined;this[_0xe69e('0x47')]=strategy[_0x476bab[_0xe69e('0x47')]]||_0xe69e('0x9');this[_0xe69e('0x48')]=!![];this[_0xe69e('0x49')]=_0x476bab['dialAMDActive']||![];this[_0xe69e('0x4a')]=_0x476bab[_0xe69e('0x4a')];this[_0xe69e('0x4b')]=_0x476bab[_0xe69e('0x4b')];this[_0xe69e('0x4c')]=_0x476bab[_0xe69e('0x4c')];this[_0xe69e('0x4d')]=_0x476bab[_0xe69e('0x4d')];this[_0xe69e('0x4e')]=_0x476bab[_0xe69e('0x4e')];this[_0xe69e('0x4f')]=_0x476bab[_0xe69e('0x4f')];this[_0xe69e('0x50')]=_0x476bab[_0xe69e('0x50')];this[_0xe69e('0x51')]=_0x476bab[_0xe69e('0x51')];this[_0xe69e('0x52')]=_0x476bab[_0xe69e('0x52')];this[_0xe69e('0x53')]=0x0;this[_0xe69e('0x54')]=0x0;this[_0xe69e('0x55')]=_0x476bab[_0xe69e('0x55')];this[_0xe69e('0x56')]=0x0;this[_0xe69e('0x57')]=0x0;this[_0xe69e('0x58')]=0x0;this[_0xe69e('0x59')]=0x0;this[_0xe69e('0x5a')]=0x0;this[_0xe69e('0x5b')]=0x0;this['outboundUnknownCallsDay']=0x0;this[_0xe69e('0x5c')]=0x0;this[_0xe69e('0x5d')]=0x0;this[_0xe69e('0x5e')]=0x0;this[_0xe69e('0x5f')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xe69e('0x60')]=0x0;this['outboundAbandonedDay']=0x0;this[_0xe69e('0x61')]=undefined;this[_0xe69e('0x62')]=undefined;this['handlePredictive']=undefined;this[_0xe69e('0x63')]=1.05;this[_0xe69e('0x64')]=0x0;this['predictiveIntervalAnsweredCalls']=0x0;this[_0xe69e('0x65')]=0x0;this[_0xe69e('0x66')]=0x0;this[_0xe69e('0x67')]=0x0;this[_0xe69e('0x68')]=0x0;this['predictiveIntervalPauses']=0x0;this[_0xe69e('0x69')]=0x0;this[_0xe69e('0x6a')]=_0x476bab[_0xe69e('0x6b')]||0x14;this['predictiveIntervalMinThreshold']=_0x476bab[_0xe69e('0x6b')]||0xa;this[_0xe69e('0x6c')]=0x0;this[_0xe69e('0x6d')]=0x0;this[_0xe69e('0x6e')]=0x1;this[_0xe69e('0x6f')]=0x0;this[_0xe69e('0x70')]=0x0;this[_0xe69e('0x71')]=0x0;this[_0xe69e('0x72')]=0x0;this[_0xe69e('0x73')]=_0x476bab[_0xe69e('0x73')]||0x1e;this[_0xe69e('0x74')]=_0x476bab['dialRecallInQueue']||![];this[_0xe69e('0x75')]=_0x476bab[_0xe69e('0x75')]||undefined;this['dialAgiAfterHangupClient']=_0x476bab[_0xe69e('0x76')]||![];this[_0xe69e('0x77')]=_0x476bab[_0xe69e('0x77')]||![];this[_0xe69e('0xc')]=monitorFormat[_0x476bab['monitor_format']]?monitorFormat[_0x476bab['monitor_format']]:undefined;this['mandatoryDisposition']=_0x476bab[_0xe69e('0x78')]||![];this[_0xe69e('0x79')]=_0x476bab['mandatoryDispositionPause']?_0x476bab[_0xe69e('0x79')]:undefined;}module[_0xe69e('0x7a')]=VoiceQueue; \ No newline at end of file +var _0x76b5=['dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','exports','unknown','not_inuse','inuse','busy','unavailable','ringing','ringinuse','wav','wav49','gsm','name','monitor_format','type','inbound','talking','answered','sumHoldTime','unmanaged','loggedIn','available','acw','acwTimeout','autopause','sendMessageOneNotActive','message','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundDropCallsDayACS','outboundReCallsDay','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialQueueProject2'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0x76b5,0x82));var _0x576b=function(_0xf0e391,_0x5433d4){_0xf0e391=_0xf0e391-0x0;var _0x1c126d=_0x76b5[_0xf0e391];return _0x1c126d;};'use strict';var statusDesc=[_0x576b('0x0'),_0x576b('0x1'),_0x576b('0x2'),_0x576b('0x3'),'invalid',_0x576b('0x4'),_0x576b('0x5'),_0x576b('0x6'),'onhold'];var monitorFormat={'wav':_0x576b('0x7'),'wav49':_0x576b('0x8'),'gsm':_0x576b('0x9')};var strategy={'rrmemory':'rrmemory','roundrobin':'roundrobin'};function VoiceQueue(_0x58f0c5){this['id']=_0x58f0c5['id']||0x0;this[_0x576b('0xa')]=_0x58f0c5[_0x576b('0xa')]||'';this[_0x576b('0xb')]=_0x58f0c5['monitor_format']||'';this['type']=_0x58f0c5[_0x576b('0xc')]||_0x576b('0xd');this['waiting']=0x0;this[_0x576b('0xe')]=0x0;this['total']=0x0;this[_0x576b('0xf')]=0x0;this['sumDuration']=0x0;this[_0x576b('0x10')]=0x0;this['sumBillable']=0x0;this[_0x576b('0x11')]=0x0;this['abandoned']=0x0;this[_0x576b('0x12')]=0x0;this[_0x576b('0x13')]=0x0;this[_0x576b('0x14')]=_0x58f0c5[_0x576b('0x14')]||![];this[_0x576b('0x15')]=_0x58f0c5[_0x576b('0x15')]||0xa;this[_0x576b('0x16')]=_0x58f0c5['autopause']||'no';this[_0x576b('0x17')]=!![];this[_0x576b('0x18')]='';this[_0x576b('0x19')]=0x0;this[_0x576b('0x1a')]=0x0;this[_0x576b('0x1b')]=_0x58f0c5[_0x576b('0x1b')]||null;this['dialGlobalInterval']=_0x58f0c5[_0x576b('0x1c')]?_0x58f0c5[_0x576b('0x1c')]:null;this[_0x576b('0x1d')]=_0x58f0c5['dialActive'];this['dialMethod']=_0x58f0c5[_0x576b('0x1e')]||_0x576b('0x1f');this[_0x576b('0x20')]=_0x58f0c5['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x58f0c5[_0x576b('0x21')]||0x0;this[_0x576b('0x22')]=_0x58f0c5['dialPowerLevel']||0x1;this[_0x576b('0x23')]=_0x58f0c5['dialPredictiveOptimization']||_0x576b('0x24');this[_0x576b('0x25')]=_0x58f0c5[_0x576b('0x25')]||0.03;this[_0x576b('0x26')]=_0x58f0c5[_0x576b('0x26')]||0x258;this['dialOriginateCallerIdName']=_0x58f0c5[_0x576b('0x27')]||'anonymous';this[_0x576b('0x28')]=_0x58f0c5[_0x576b('0x28')]||_0x576b('0x29');this[_0x576b('0x2a')]=_0x58f0c5[_0x576b('0x2a')]||0x1e;this['dialQueueOptions']=_0x58f0c5[_0x576b('0x2b')]||_0x576b('0x2c');this['dialQueueTimeout']=_0x58f0c5['dialQueueTimeout']||0x3;this[_0x576b('0x2d')]=_0x58f0c5[_0x576b('0x2d')]||undefined;this[_0x576b('0x2e')]=_0x58f0c5[_0x576b('0x2e')]||0x3;this['dialCongestionRetryFrequency']=_0x58f0c5[_0x576b('0x2f')]||0x96;this[_0x576b('0x30')]=_0x58f0c5['dialBusyMaxRetry']||0x3;this[_0x576b('0x31')]=_0x58f0c5[_0x576b('0x31')]||0x96;this[_0x576b('0x32')]=_0x58f0c5[_0x576b('0x32')]||0x3;this[_0x576b('0x33')]=_0x58f0c5[_0x576b('0x33')]||0x96;this[_0x576b('0x34')]=_0x58f0c5[_0x576b('0x34')]||0x3;this[_0x576b('0x35')]=_0x58f0c5['dialNoSuchNumberRetryFrequency']||0x96;this[_0x576b('0x36')]=_0x58f0c5[_0x576b('0x36')]||0x3;this[_0x576b('0x37')]=_0x58f0c5[_0x576b('0x37')]||0x96;this[_0x576b('0x38')]=_0x58f0c5[_0x576b('0x38')]||0x3;this[_0x576b('0x39')]=_0x58f0c5[_0x576b('0x39')]||0x96;this[_0x576b('0x3a')]=_0x58f0c5[_0x576b('0x3a')]||0x3;this[_0x576b('0x3b')]=_0x58f0c5['dialMachineRetryFrequency']||0x96;this[_0x576b('0x3c')]=_0x58f0c5[_0x576b('0x3c')]||0x3;this[_0x576b('0x3d')]=_0x58f0c5[_0x576b('0x3d')]||0x96;this[_0x576b('0x3e')]=_0x58f0c5['dialGlobalMaxRetry']||0x4;this[_0x576b('0x3f')]=_0x58f0c5['Trunk']?_0x58f0c5[_0x576b('0x3f')]:undefined;this[_0x576b('0x40')]=_0x58f0c5[_0x576b('0x40')]?_0x58f0c5['TrunkBackup']:undefined;this[_0x576b('0x41')]=_0x58f0c5[_0x576b('0x41')]||undefined;this[_0x576b('0x42')]=_0x58f0c5[_0x576b('0x42')]?_0x58f0c5['Interval']:undefined;this[_0x576b('0x43')]=_0x58f0c5[_0x576b('0x43')]||_0x576b('0x44');this[_0x576b('0x45')]=_0x58f0c5[_0x576b('0x45')]||undefined;this[_0x576b('0x46')]=_0x58f0c5[_0x576b('0x46')]||undefined;this[_0x576b('0x47')]=strategy[_0x58f0c5[_0x576b('0x47')]]||'rrmemory';this[_0x576b('0x48')]=!![];this['dialAMDActive']=_0x58f0c5[_0x576b('0x49')]||![];this[_0x576b('0x4a')]=_0x58f0c5[_0x576b('0x4a')];this[_0x576b('0x4b')]=_0x58f0c5[_0x576b('0x4b')];this[_0x576b('0x4c')]=_0x58f0c5[_0x576b('0x4c')];this[_0x576b('0x4d')]=_0x58f0c5['dialAMDTotalAnalysisTime'];this[_0x576b('0x4e')]=_0x58f0c5['dialAMDMinWordLength'];this[_0x576b('0x4f')]=_0x58f0c5[_0x576b('0x4f')];this[_0x576b('0x50')]=_0x58f0c5[_0x576b('0x50')];this[_0x576b('0x51')]=_0x58f0c5[_0x576b('0x51')];this[_0x576b('0x52')]=_0x58f0c5[_0x576b('0x52')];this['outboundRejectCallsDay']=0x0;this[_0x576b('0x53')]=0x0;this[_0x576b('0x54')]=_0x58f0c5[_0x576b('0x54')];this[_0x576b('0x55')]=0x0;this[_0x576b('0x56')]=0x0;this[_0x576b('0x57')]=0x0;this[_0x576b('0x58')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x576b('0x59')]=0x0;this[_0x576b('0x5a')]=0x0;this[_0x576b('0x5b')]=0x0;this['outboundOriginateFailureCallsDay']=0x0;this[_0x576b('0x5c')]=0x0;this[_0x576b('0x5d')]=0x0;this[_0x576b('0x5e')]=0x0;this[_0x576b('0x5f')]=0x0;this['outboundAbandonedDay']=0x0;this['startProgressive']=undefined;this[_0x576b('0x60')]=undefined;this[_0x576b('0x61')]=undefined;this[_0x576b('0x62')]=1.05;this[_0x576b('0x63')]=0x0;this[_0x576b('0x64')]=0x0;this[_0x576b('0x65')]=0x0;this[_0x576b('0x66')]=0x0;this[_0x576b('0x67')]=0x0;this[_0x576b('0x68')]=0x0;this[_0x576b('0x69')]=0x0;this[_0x576b('0x6a')]=0x0;this[_0x576b('0x6b')]=_0x58f0c5[_0x576b('0x6c')]||0x14;this[_0x576b('0x6d')]=_0x58f0c5[_0x576b('0x6c')]||0xa;this[_0x576b('0x6e')]=0x0;this[_0x576b('0x6f')]=0x0;this[_0x576b('0x70')]=0x1;this[_0x576b('0x71')]=0x0;this[_0x576b('0x72')]=0x0;this[_0x576b('0x73')]=0x0;this[_0x576b('0x74')]=0x0;this['dialRecallMeTimeout']=_0x58f0c5[_0x576b('0x75')]||0x1e;this[_0x576b('0x76')]=_0x58f0c5['dialRecallInQueue']||![];this[_0x576b('0x77')]=_0x58f0c5['dialQueueProject2']||undefined;this[_0x576b('0x78')]=_0x58f0c5['dialAgiAfterHangupClient']||![];this['dialAgiAfterHangupAgent']=_0x58f0c5[_0x576b('0x79')]||![];this[_0x576b('0xb')]=monitorFormat[_0x58f0c5[_0x576b('0xb')]]?monitorFormat[_0x58f0c5[_0x576b('0xb')]]:undefined;this['mandatoryDisposition']=_0x58f0c5[_0x576b('0x7a')]||![];this[_0x576b('0x7b')]=_0x58f0c5[_0x576b('0x7b')]?_0x58f0c5[_0x576b('0x7b')]:undefined;}module[_0x576b('0x7c')]=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index 292eef9..b007700 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 _0x9616=['serverUrl','exports','name','username','accessKey','remoteUri'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x9616,0x1f4));var _0x6961=function(_0x117f4c,_0x36a9b1){_0x117f4c=_0x117f4c-0x0;var _0x2b24e9=_0x9616[_0x117f4c];return _0x2b24e9;};'use strict';function VtigerAccount(_0x23b601){this['id']=_0x23b601['id']||0x0;this['name']=_0x23b601[_0x6961('0x0')]||'';this[_0x6961('0x1')]=_0x23b601[_0x6961('0x1')]||'';this[_0x6961('0x2')]=_0x23b601[_0x6961('0x2')]||'';this['remoteUri']=_0x23b601[_0x6961('0x3')]||'';this[_0x6961('0x4')]=_0x23b601['serverUrl']||'';this['Configurations']=_0x23b601['Configurations']||{};}module[_0x6961('0x5')]=VtigerAccount; \ No newline at end of file +var _0x6b96=['serverUrl','Configurations','exports','name','username','accessKey','remoteUri'];(function(_0x546aaf,_0x1ed138){var _0x1cbf6d=function(_0x36c837){while(--_0x36c837){_0x546aaf['push'](_0x546aaf['shift']());}};_0x1cbf6d(++_0x1ed138);}(_0x6b96,0x96));var _0x66b9=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x6b96[_0x138adb];return _0x1b27f2;};'use strict';function VtigerAccount(_0x3e28ee){this['id']=_0x3e28ee['id']||0x0;this[_0x66b9('0x0')]=_0x3e28ee['name']||'';this['username']=_0x3e28ee[_0x66b9('0x1')]||'';this[_0x66b9('0x2')]=_0x3e28ee[_0x66b9('0x2')]||'';this[_0x66b9('0x3')]=_0x3e28ee['remoteUri']||'';this[_0x66b9('0x4')]=_0x3e28ee[_0x66b9('0x4')]||'';this[_0x66b9('0x5')]=_0x3e28ee[_0x66b9('0x5')]||{};}module[_0x66b9('0x6')]=VtigerAccount; \ No newline at end of file diff --git a/server/services/ami/model/zendeskAccount.js b/server/services/ami/model/zendeskAccount.js index 8ddc016..6b65b89 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 _0x9de7=['integrationTab','serverUrl','Configurations','exports','name','username','password','token','remoteUri','authType','type'];(function(_0x1196b0,_0x36c47a){var _0x111c52=function(_0x5604c7){while(--_0x5604c7){_0x1196b0['push'](_0x1196b0['shift']());}};_0x111c52(++_0x36c47a);}(_0x9de7,0x122));var _0x79de=function(_0x306106,_0x7dc50d){_0x306106=_0x306106-0x0;var _0x4d6083=_0x9de7[_0x306106];return _0x4d6083;};'use strict';function ZendeskAccount(_0x5cba5a){this['id']=_0x5cba5a['id']||0x0;this[_0x79de('0x0')]=_0x5cba5a['name']||'';this[_0x79de('0x1')]=_0x5cba5a[_0x79de('0x1')]||'';this[_0x79de('0x2')]=_0x5cba5a[_0x79de('0x2')]||'';this[_0x79de('0x3')]=_0x5cba5a[_0x79de('0x3')]||'';this[_0x79de('0x4')]=_0x5cba5a[_0x79de('0x4')]||'';this[_0x79de('0x5')]=_0x5cba5a[_0x79de('0x5')]||'';this[_0x79de('0x6')]=_0x5cba5a[_0x79de('0x6')]||_0x79de('0x7');this[_0x79de('0x8')]=_0x5cba5a[_0x79de('0x8')]||'';this[_0x79de('0x9')]=_0x5cba5a[_0x79de('0x9')]||{};}module[_0x79de('0xa')]=ZendeskAccount; \ No newline at end of file +var _0xc680=['Configurations','name','username','password','remoteUri','authType','type','integrationTab','serverUrl'];(function(_0x21bf45,_0x17aef7){var _0x5b43a3=function(_0x12e933){while(--_0x12e933){_0x21bf45['push'](_0x21bf45['shift']());}};_0x5b43a3(++_0x17aef7);}(_0xc680,0x9a));var _0x0c68=function(_0x1bf900,_0x335121){_0x1bf900=_0x1bf900-0x0;var _0x135b39=_0xc680[_0x1bf900];return _0x135b39;};'use strict';function ZendeskAccount(_0x4be111){this['id']=_0x4be111['id']||0x0;this[_0x0c68('0x0')]=_0x4be111['name']||'';this[_0x0c68('0x1')]=_0x4be111[_0x0c68('0x1')]||'';this[_0x0c68('0x2')]=_0x4be111[_0x0c68('0x2')]||'';this['token']=_0x4be111['token']||'';this[_0x0c68('0x3')]=_0x4be111[_0x0c68('0x3')]||'';this[_0x0c68('0x4')]=_0x4be111[_0x0c68('0x4')]||'';this[_0x0c68('0x5')]=_0x4be111['type']||_0x0c68('0x6');this['serverUrl']=_0x4be111[_0x0c68('0x7')]||'';this[_0x0c68('0x8')]=_0x4be111[_0x0c68('0x8')]||{};}module['exports']=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index 38da736..2a98909 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 _0xcdf4=['Configurations','exports','name','description','host','clientId','serverUrl'];(function(_0x3b711c,_0x4b22dc){var _0x2685f0=function(_0x3b5ba6){while(--_0x3b5ba6){_0x3b711c['push'](_0x3b711c['shift']());}};_0x2685f0(++_0x4b22dc);}(_0xcdf4,0x95));var _0x4cdf=function(_0x35ab60,_0x5db398){_0x35ab60=_0x35ab60-0x0;var _0x4a0fe7=_0xcdf4[_0x35ab60];return _0x4a0fe7;};'use strict';function ZohoAccount(_0x15fc54){this['id']=_0x15fc54['id']||0x0;this[_0x4cdf('0x0')]=_0x15fc54['name']||'';this[_0x4cdf('0x1')]=_0x15fc54[_0x4cdf('0x1')]||'';this[_0x4cdf('0x2')]=_0x15fc54[_0x4cdf('0x2')]||'';this['zone']=_0x15fc54['zone']||'';this[_0x4cdf('0x3')]=_0x15fc54['clientId']||'';this['clientSecret']=_0x15fc54['clientSecret']||'';this['serverUrl']=_0x15fc54[_0x4cdf('0x4')]||'';this['code']=_0x15fc54['code']||'';this['refreshToken']=_0x15fc54['refreshToken']||'';this[_0x4cdf('0x5')]=_0x15fc54[_0x4cdf('0x5')]||{};}module[_0x4cdf('0x6')]=ZohoAccount; \ No newline at end of file +var _0xb02d=['host','clientId','clientSecret','serverUrl','code','refreshToken','Configurations','name','description'];(function(_0xd7b0a4,_0x53c7d3){var _0x184e9e=function(_0x325bbd){while(--_0x325bbd){_0xd7b0a4['push'](_0xd7b0a4['shift']());}};_0x184e9e(++_0x53c7d3);}(_0xb02d,0x142));var _0xdb02=function(_0x12bfdd,_0xb873a1){_0x12bfdd=_0x12bfdd-0x0;var _0x35cc02=_0xb02d[_0x12bfdd];return _0x35cc02;};'use strict';function ZohoAccount(_0x4bbb75){this['id']=_0x4bbb75['id']||0x0;this[_0xdb02('0x0')]=_0x4bbb75[_0xdb02('0x0')]||'';this[_0xdb02('0x1')]=_0x4bbb75[_0xdb02('0x1')]||'';this[_0xdb02('0x2')]=_0x4bbb75[_0xdb02('0x2')]||'';this['zone']=_0x4bbb75['zone']||'';this['clientId']=_0x4bbb75[_0xdb02('0x3')]||'';this[_0xdb02('0x4')]=_0x4bbb75['clientSecret']||'';this[_0xdb02('0x5')]=_0x4bbb75[_0xdb02('0x5')]||'';this[_0xdb02('0x6')]=_0x4bbb75[_0xdb02('0x6')]||'';this[_0xdb02('0x7')]=_0x4bbb75[_0xdb02('0x7')]||'';this[_0xdb02('0x8')]=_0x4bbb75[_0xdb02('0x8')]||{};}module['exports']=ZohoAccount; \ No newline at end of file diff --git a/server/services/ami/preview/action.js b/server/services/ami/preview/action.js index c7a8abb..c1bcc49 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 _0x7817=['firstName','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','type','campaigntype','queue','dialAnswer','Agent','name','membername','format','SIP/%s','Contact','phone'];(function(_0x2969b2,_0x16b78b){var _0x4f0767=function(_0x10bacb){while(--_0x10bacb){_0x2969b2['push'](_0x2969b2['shift']());}};_0x4f0767(++_0x16b78b);}(_0x7817,0x1e8));var _0x7781=function(_0x9828ec,_0x2475ac){_0x9828ec=_0x9828ec-0x0;var _0x45002e=_0x7817[_0x9828ec];return _0x45002e;};'use strict';var util=require(_0x7781('0x0'));var _=require(_0x7781('0x1'));var moment=require(_0x7781('0x2'));function checkNameSurname(_0x3e1d51,_0x39211f,_0x6aae81){var _0x18e0b8='';if(!_[_0x7781('0x3')](_0x39211f)&&_0x7781('0x4')===typeof _0x39211f){_0x18e0b8+=_0x39211f;}if(!_['isNil'](_0x6aae81)&&'string'===typeof _0x6aae81){_0x18e0b8+='\x20'+_0x6aae81;}if(_0x18e0b8!==''){return _0x18e0b8;}return _0x3e1d51;}function Action(_0x5dd58a,_0x47b792,_0x347420,_0x521a9f,_0x105c84){this[_0x7781('0x5')]=_0x347420||undefined;this[_0x7781('0x6')]=_0x5dd58a['id'];this['queue']=_0x47b792['name'];this['type']=_0x47b792[_0x7781('0x7')];this[_0x7781('0x8')]=_0x7781('0x9');this[_0x7781('0xa')]=![];this['membername']=_[_0x7781('0x3')](_0x5dd58a[_0x7781('0xb')])?undefined:_0x5dd58a[_0x7781('0xb')][_0x7781('0xc')];this['channelAgent']=this[_0x7781('0xd')]?util[_0x7781('0xe')](_0x7781('0xf'),this[_0x7781('0xd')]):_0x521a9f||undefined;this['calleridname']=checkNameSurname(_0x5dd58a[_0x7781('0x10')][_0x7781('0x11')],_0x5dd58a[_0x7781('0x10')][_0x7781('0x12')],_0x5dd58a[_0x7781('0x10')][_0x7781('0x13')]);this['active']=_0x5dd58a[_0x7781('0x14')]||![];this['calleridnum']=_0x5dd58a[_0x7781('0x10')][_0x7781('0x11')];this['scheduledat']=_0x5dd58a[_0x7781('0x15')];this[_0x7781('0x16')]=_0x5dd58a[_0x7781('0x16')]||0x0;this[_0x7781('0x17')]=_0x5dd58a[_0x7781('0x17')]||0x0;this[_0x7781('0x18')]=_0x5dd58a['countnoanswerretry']||0x0;this[_0x7781('0x19')]=(_0x5dd58a[_0x7781('0x16')]||0x0)+(_0x5dd58a[_0x7781('0x17')]||0x0)+(_0x5dd58a[_0x7781('0x18')]||0x0)+(_0x5dd58a['countnosuchnumberretry']||0x0)+(_0x5dd58a['countdropretry']||0x0)+(_0x5dd58a['countabandonedretry']||0x0)+(_0x5dd58a[_0x7781('0x1a')]||0x0)+(_0x5dd58a[_0x7781('0x1b')]||0x0);this[_0x7781('0x1c')]=_0x5dd58a[_0x7781('0x1c')]||0x0;this[_0x7781('0x1d')]=_0x5dd58a[_0x7781('0x1d')]||0x0;this[_0x7781('0x1e')]=_0x5dd58a['countabandonedretry']||0x0;this[_0x7781('0x1a')]=_0x5dd58a[_0x7781('0x1a')]||0x0;this['countagentrejectretry']=_0x5dd58a[_0x7781('0x1b')]||0x0;this[_0x7781('0x1f')]=_0x5dd58a['callback'];this[_0x7781('0x20')]=_0x5dd58a[_0x7781('0x20')];this['callbackat']=_0x5dd58a[_0x7781('0x21')];this['recallme']=_0x5dd58a[_0x7781('0x22')];this[_0x7781('0x23')]=_0x5dd58a[_0x7781('0x23')];this[_0x7781('0x24')]=_0x5dd58a['ListId'];this['UserId']=_[_0x7781('0x3')](_0x5dd58a[_0x7781('0xb')])?_0x5dd58a[_0x7781('0x25')]:_0x5dd58a['Agent']['id'];this[_0x7781('0x26')]=_0x5dd58a[_0x7781('0x26')];this['originatecalleridnum']='';this[_0x7781('0x27')]='';}Action[_0x7781('0x28')][_0x7781('0x29')]=function(){return util[_0x7781('0xe')](_0x7781('0x2a'),this[_0x7781('0x2b')],this[_0x7781('0x2c')]);};module[_0x7781('0x2d')]=Action; \ No newline at end of file +var _0xd98e=['UserId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','idContact','queue','name','type','campaigntype','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x38be4a,_0x1fc193){var _0x2756d8=function(_0x95c32c){while(--_0x95c32c){_0x38be4a['push'](_0x38be4a['shift']());}};_0x2756d8(++_0x1fc193);}(_0xd98e,0x170));var _0xed98=function(_0x23575e,_0x328391){_0x23575e=_0x23575e-0x0;var _0x44ba3a=_0xd98e[_0x23575e];return _0x44ba3a;};'use strict';var util=require(_0xed98('0x0'));var _=require(_0xed98('0x1'));var moment=require(_0xed98('0x2'));function checkNameSurname(_0x121aeb,_0x1b19e4,_0x262a4f){var _0x1b4000='';if(!_[_0xed98('0x3')](_0x1b19e4)&&_0xed98('0x4')===typeof _0x1b19e4){_0x1b4000+=_0x1b19e4;}if(!_[_0xed98('0x3')](_0x262a4f)&&_0xed98('0x4')===typeof _0x262a4f){_0x1b4000+='\x20'+_0x262a4f;}if(_0x1b4000!==''){return _0x1b4000;}return _0x121aeb;}function Action(_0x3b491e,_0x291113,_0x1ce595,_0x1d5048,_0x4e7eac){this['uniqueid']=_0x1ce595||undefined;this[_0xed98('0x5')]=_0x3b491e['id'];this[_0xed98('0x6')]=_0x291113[_0xed98('0x7')];this[_0xed98('0x8')]=_0x291113[_0xed98('0x8')];this[_0xed98('0x9')]=_0xed98('0x6');this[_0xed98('0xa')]=![];this[_0xed98('0xb')]=_[_0xed98('0x3')](_0x3b491e[_0xed98('0xc')])?undefined:_0x3b491e[_0xed98('0xc')][_0xed98('0x7')];this[_0xed98('0xd')]=this[_0xed98('0xb')]?util[_0xed98('0xe')](_0xed98('0xf'),this['membername']):_0x1d5048||undefined;this['calleridname']=checkNameSurname(_0x3b491e['Contact']['phone'],_0x3b491e[_0xed98('0x10')][_0xed98('0x11')],_0x3b491e[_0xed98('0x10')][_0xed98('0x12')]);this[_0xed98('0x13')]=_0x3b491e[_0xed98('0x13')]||![];this[_0xed98('0x14')]=_0x3b491e[_0xed98('0x10')]['phone'];this[_0xed98('0x15')]=_0x3b491e['scheduledat'];this[_0xed98('0x16')]=_0x3b491e[_0xed98('0x16')]||0x0;this[_0xed98('0x17')]=_0x3b491e[_0xed98('0x17')]||0x0;this[_0xed98('0x18')]=_0x3b491e[_0xed98('0x18')]||0x0;this[_0xed98('0x19')]=(_0x3b491e['countbusyretry']||0x0)+(_0x3b491e[_0xed98('0x17')]||0x0)+(_0x3b491e['countnoanswerretry']||0x0)+(_0x3b491e[_0xed98('0x1a')]||0x0)+(_0x3b491e['countdropretry']||0x0)+(_0x3b491e[_0xed98('0x1b')]||0x0)+(_0x3b491e[_0xed98('0x1c')]||0x0)+(_0x3b491e[_0xed98('0x1d')]||0x0);this[_0xed98('0x1a')]=_0x3b491e[_0xed98('0x1a')]||0x0;this[_0xed98('0x1e')]=_0x3b491e['countdropretry']||0x0;this['countabandonedretry']=_0x3b491e['countabandonedretry']||0x0;this['countmachineretry']=_0x3b491e[_0xed98('0x1c')]||0x0;this[_0xed98('0x1d')]=_0x3b491e[_0xed98('0x1d')]||0x0;this[_0xed98('0x1f')]=_0x3b491e[_0xed98('0x1f')];this[_0xed98('0x20')]=_0x3b491e[_0xed98('0x20')];this[_0xed98('0x21')]=_0x3b491e[_0xed98('0x21')];this[_0xed98('0x22')]=_0x3b491e[_0xed98('0x22')];this['ContactId']=_0x3b491e[_0xed98('0x23')];this[_0xed98('0x24')]=_0x3b491e[_0xed98('0x24')];this[_0xed98('0x25')]=_[_0xed98('0x3')](_0x3b491e[_0xed98('0xc')])?_0x3b491e[_0xed98('0x25')]:_0x3b491e[_0xed98('0xc')]['id'];this[_0xed98('0x26')]=_0x3b491e['VoiceQueueId'];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xed98('0x27')][_0xed98('0x28')]=function(){return util[_0xed98('0xe')](_0xed98('0x29'),this[_0xed98('0x2a')],this[_0xed98('0x2b')]);};module[_0xed98('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index 4327a8f..2fc9665 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 _0xeed5=['contactId','UserId','VoiceQueueId','ListId','status','catch','No\x20such\x20channel','updateOriginated','[clearZombieChannel]','decrementTalkink','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','clearZombieChannels','[action]','getContactRecallMe','then','length','getDiff','scheduledat','dialRecallMeTimeout','Agent','voicePause','run','logger2','[RecallMe]','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','AGENTS_NOT_LOGGED','isActive','isTrunkReachable','ACTIVE','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','rescheduleContact','scheduledAt','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','linkedid','ANSWER','uniqueid','\x20Queue','pTalking:\x20','buildObj','connect','acw','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumBillable','talktime','[syncHangup][talking][decrement]','outboundBusyCallsDay','countbusyretry','Busy','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyRetryFrequency','NOANSWER','countnoanswerretry','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','CONGESTION','countcongestionretry','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','custom:agentreject','[syncHangupRequest][logAgentReject]','AgentReject','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','countagentrejectretry','dialAgentRejectRetryFrequency','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','dialAbandonedMaxRety','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','NoAnswer','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','Congestion','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','phone','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','Calling','Call\x20failed','logBlacklist','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','SIP/%s','reachable','execRun','unlock','disableContact','getContactPreview','recallme','validateContact','checkIsBlackList','Contact.phone','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','campaign\x20Name:\x20','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','\x20Not\x20Active','dialPrefix','trim','dialCutDigit','substring','SIP/%s/%s%s','TrunkBackup','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','getCallerId','originatecalleridnum','extractCalleridNumber','addVariables','merge','Action','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','syncOriginateResponse','actionid','logLookAgent','clone','responsetime','isFailure','response','unlockContact','custom:agentringnoanswer','rejected','[syncHangup][talking]','cause','callProgressDetectingCustomer','transfer','[syncHangup][talking][cause]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','exports','bluebird','moment','md5','ioredis','../../../config/logger','preview','actionPreview','../ami','./rpcDb','./util/util','redis','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','agents','clockClearZombieChannels','originateresponse','bind','hangup','hanguprequest','syncHangupRequest','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','syncBlindTransfer','loopCampaigns','emit','type','outbound','name','strategy','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','abandoned','waiting','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','outboundAnswerAgiCallsDay','outboundDropCallsDayCallersExit','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','message','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','Trunk','active','callerid','Interval','voice:queue:%s','voice_queue:save','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','sendMessageOneNotActive','originated','available','NOT_ACTIVE','logger','\x20is\x20not\x20active','[CampaignPreview]\x20Campaign\x20Queue:\x20','syncCampaigns','hasOwnProperty','booked','setMessage','clearZombieChannel','isNil','Queue','queue','dialAnswer','pick'];(function(_0x1373f9,_0x775144){var _0x238b04=function(_0x18f9f3){while(--_0x18f9f3){_0x1373f9['push'](_0x1373f9['shift']());}};_0x238b04(++_0x775144);}(_0xeed5,0xdc));var _0x5eed=function(_0xcdf1f,_0x361624){_0xcdf1f=_0xcdf1f-0x0;var _0x34a550=_0xeed5[_0xcdf1f];return _0x34a550;};'use strict';var util=require('util');var _=require('lodash');var BPromise=require(_0x5eed('0x0'));var uuid=require('uuid');var moment=require(_0x5eed('0x1'));var md5=require(_0x5eed('0x2'));var Redis=require(_0x5eed('0x3'));var config=require('../../../config/environment');var logger=require(_0x5eed('0x4'))(_0x5eed('0x5'));var loggerAction=require(_0x5eed('0x4'))(_0x5eed('0x6'));var ami=require(_0x5eed('0x7'));var rpcDb=require(_0x5eed('0x8'));var Action=require('./action');var ut=require(_0x5eed('0x9'));config[_0x5eed('0xa')]=_['defaults'](config[_0x5eed('0xa')],{'host':_0x5eed('0xb'),'port':0x18eb});var io=require(_0x5eed('0xc'))(new Redis(config[_0x5eed('0xa')]));var Sequence=function(){};Sequence[_0x5eed('0xd')][_0x5eed('0xe')]=function(_0x591ecf){this[_0x5eed('0xf')]=this[_0x5eed('0xf')]?this[_0x5eed('0xf')][_0x5eed('0x10')](_0x591ecf):_0x591ecf();};function Preview(_0x25e402){this[_0x5eed('0x11')]=new Sequence();this[_0x5eed('0x12')]=_0x25e402[_0x5eed('0x13')];this[_0x5eed('0x14')]=_0x25e402[_0x5eed('0x14')];this[_0x5eed('0x15')]={};this[_0x5eed('0x16')]=_0x25e402[_0x5eed('0x16')];this[_0x5eed('0x17')]=0x0;ami['on'](_0x5eed('0x18'),this['syncOriginateResponse'][_0x5eed('0x19')](this));ami['on'](_0x5eed('0x1a'),this['syncHangup'][_0x5eed('0x19')](this));ami['on'](_0x5eed('0x1b'),this[_0x5eed('0x1c')]['bind'](this));ami['on']('dialend',this[_0x5eed('0x1d')]['bind'](this));ami['on'](_0x5eed('0x1e'),this[_0x5eed('0x1f')][_0x5eed('0x19')](this));ami['on'](_0x5eed('0x20'),this[_0x5eed('0x21')]['bind'](this));ami['on'](_0x5eed('0x22'),this[_0x5eed('0x23')][_0x5eed('0x19')](this));ami['on']('blindtransfer',this[_0x5eed('0x24')][_0x5eed('0x19')](this));this[_0x5eed('0x25')](this['campaignsPreview']);}function emit(_0x5e5cab,_0x24447f,_0x261d03){io['to'](_0x5e5cab)[_0x5eed('0x26')](_0x24447f,_0x261d03);}function emitCampaignPreview(_0x55e1bf){if(_0x55e1bf[_0x5eed('0x27')]===_0x5eed('0x28')){var _0x4dcbb3={'id':_0x55e1bf['id'],'name':_0x55e1bf[_0x5eed('0x29')],'strategy':_0x55e1bf[_0x5eed('0x2a')],'answered':_0x55e1bf['answered'],'available':_0x55e1bf['available'],'loggedIn':_0x55e1bf[_0x5eed('0x2b')],'pTalking':_0x55e1bf[_0x5eed('0x2c')],'sumBillable':_0x55e1bf['sumBillable'],'sumDuration':_0x55e1bf[_0x5eed('0x2d')],'sumHoldTime':_0x55e1bf[_0x5eed('0x2e')]||0x0,'talking':_0x55e1bf[_0x5eed('0x2f')],'total':_0x55e1bf[_0x5eed('0x30')],'type':_0x55e1bf['type'],'unmanaged':_0x55e1bf[_0x5eed('0x31')],'abandoned':_0x55e1bf[_0x5eed('0x32')],'waiting':_0x55e1bf[_0x5eed('0x33')],'loggedInDb':_0x55e1bf[_0x5eed('0x34')],'dialActive':_0x55e1bf[_0x5eed('0x35')],'dialMethod':_0x55e1bf[_0x5eed('0x36')],'dialOriginateCallerIdName':_0x55e1bf[_0x5eed('0x37')],'dialOriginateCallerIdNumber':_0x55e1bf[_0x5eed('0x38')],'dialOriginateTimeout':_0x55e1bf[_0x5eed('0x39')],'dialPrefix':_0x55e1bf['dialPrefix'],'outboundAnswerAgiCallsDay':_0x55e1bf[_0x5eed('0x3a')],'outboundAnswerCallsDay':_0x55e1bf['outboundAnswerCallsDay'],'outboundBlacklistCallsDay':_0x55e1bf['outboundBlacklistCallsDay'],'outboundBusyCallsDay':_0x55e1bf['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x55e1bf['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x55e1bf['outboundDropCallsDayACS'],'outboundDropCallsDayCallersExit':_0x55e1bf[_0x5eed('0x3b')],'outboundDropCallsDayTimeout':_0x55e1bf['outboundDropCallsDayTimeout'],'outboundNoAnswerCallsDay':_0x55e1bf[_0x5eed('0x3c')],'outboundNoSuchCallsDay':_0x55e1bf[_0x5eed('0x3d')],'outboundOriginateFailureCallsDay':_0x55e1bf[_0x5eed('0x3e')],'outboundReCallsDay':_0x55e1bf[_0x5eed('0x3f')],'outboundRejectCallsDay':_0x55e1bf['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x55e1bf[_0x5eed('0x40')],'outboundAbandonedCallsDay':_0x55e1bf['outboundAbandonedCallsDay'],'predictiveIntervalAnsweredCalls':_0x55e1bf[_0x5eed('0x41')],'predictiveIntervalAvgHoldtime':_0x55e1bf[_0x5eed('0x42')],'predictiveIntervalAvgTalktime':_0x55e1bf[_0x5eed('0x43')],'predictiveIntervalDroppedCallsCallersExit':_0x55e1bf[_0x5eed('0x44')],'predictiveIntervalDroppedCallsTimeout':_0x55e1bf['predictiveIntervalDroppedCallsTimeout'],'predictiveIntervalErlangCalls':_0x55e1bf[_0x5eed('0x45')],'predictiveIntervalErlangCallsDroppedCalls':_0x55e1bf[_0x5eed('0x46')],'predictiveIntervalHitRate':_0x55e1bf[_0x5eed('0x47')],'predictiveIntervalMultiplicativeFactor':_0x55e1bf[_0x5eed('0x48')],'predictiveIntervalPauses':_0x55e1bf[_0x5eed('0x49')],'predictiveIntervalAvailable':_0x55e1bf['predictiveIntervalAvailable'],'predictiveIntervalTotalCalls':_0x55e1bf['predictiveIntervalTotalCalls'],'message':_0x55e1bf[_0x5eed('0x4a')],'originated':_0x55e1bf['originated'],'erlangCalls':_0x55e1bf[_0x5eed('0x4b')],'erlangCallToSecond':_0x55e1bf[_0x5eed('0x4c')],'erlangAbandonmentRate':_0x55e1bf[_0x5eed('0x4d')],'erlangBusyFactor':_0x55e1bf[_0x5eed('0x4e')],'startPredictive':_0x55e1bf['startPredictive'],'startProgressive':_0x55e1bf['startProgressive']};if(_0x55e1bf['Trunk']){_0x4dcbb3[_0x5eed('0x4f')]={'id':_0x55e1bf[_0x5eed('0x4f')]['id'],'name':_0x55e1bf[_0x5eed('0x4f')][_0x5eed('0x29')],'active':_0x55e1bf[_0x5eed('0x4f')][_0x5eed('0x50')],'callerid':_0x55e1bf[_0x5eed('0x4f')][_0x5eed('0x51')]};}if(_0x55e1bf[_0x5eed('0x52')]){_0x4dcbb3[_0x5eed('0x52')]={'id':_0x55e1bf['Interval']['id'],'name':_0x55e1bf[_0x5eed('0x52')]['name']};}var _0xadf989=md5(JSON['stringify'](_0x4dcbb3));if(_0x55e1bf[_0x5eed('0x2')]!==_0xadf989){_0x55e1bf[_0x5eed('0x2')]=_0xadf989;emit(util['format'](_0x5eed('0x53'),_0x4dcbb3['name']),_0x5eed('0x54'),_0x4dcbb3);}}}function emitVoiceQueueChannelRemove(_0x48638d){logger[_0x5eed('0x55')](_0x5eed('0x56'),JSON[_0x5eed('0x57')](_0x48638d));emit(util[_0x5eed('0x58')](_0x5eed('0x53'),_0x48638d[_0x5eed('0x29')]),'voice_queue_channel:remove',_0x48638d);io['emit']('voice_queue_presence:remove',_0x48638d);}function notSendMessagesQueue(_0x2ed67e){if(_0x2ed67e[_0x5eed('0x59')]){if(_0x2ed67e[_0x5eed('0x5a')]===0x0&&_0x2ed67e[_0x5eed('0x2c')]===0x0){_0x2ed67e['sendMessageOneNotActive']=![];_0x2ed67e[_0x5eed('0x5b')]=0x0;_0x2ed67e['paused']=0x0;_0x2ed67e['message']=_0x5eed('0x5c');ut[_0x5eed('0x5d')]('[CampaignPreview]\x20Campaign\x20Queue:\x20',_0x2ed67e[_0x5eed('0x29')]+_0x5eed('0x5e'));}else{_0x2ed67e[_0x5eed('0x4a')]='IS_DISACTIVED';ut['logger'](_0x5eed('0x5f'),_0x2ed67e['name']+'\x20is\x20disactive');}emitCampaignPreview(_0x2ed67e);}}Preview[_0x5eed('0xd')][_0x5eed('0x25')]=function(){var _0x4902e8=this;setInterval(function(){_0x4902e8[_0x5eed('0x60')]();},0x7cf);};Preview[_0x5eed('0xd')][_0x5eed('0x60')]=function(){var _0x580bbe=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x5bad00 in _0x580bbe){if(_0x580bbe[_0x5eed('0x61')](_0x5bad00)&&(_0x580bbe[_0x5bad00][_0x5eed('0x36')]==='preview'||_0x580bbe[_0x5bad00]['dialMethod']===_0x5eed('0x62'))&&_0x580bbe[_0x5bad00][_0x5eed('0x27')]==='outbound'){if(this[_0x5eed('0x17')]>0x7){this[_0x5eed('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x580bbe[_0x5eed('0x61')](_0x5bad00)&&_0x580bbe[_0x5bad00][_0x5eed('0x36')]==='preview'&&_0x580bbe[_0x5bad00][_0x5eed('0x27')]===_0x5eed('0x28')){if(_0x580bbe[_0x5bad00][_0x5eed('0x35')]){this[_0x5eed('0x63')](_0x580bbe[_0x5bad00]);this['recallMe'](_0x580bbe[_0x5bad00]);}else{notSendMessagesQueue(_0x580bbe[_0x5bad00]);}}}};Preview[_0x5eed('0xd')][_0x5eed('0x64')]=function(_0x1dd64e){var _0x1ad5be=this;this[_0x5eed('0x11')][_0x5eed('0xe')](function(){if(!_[_0x5eed('0x65')](_0x1ad5be[_0x5eed('0x15')][_0x1dd64e])){loggerAction[_0x5eed('0x55')]('[clearZombieChannels][talking]',_0x1dd64e,_0x5eed('0x66'),_0x1ad5be[_0x5eed('0x15')][_0x1dd64e][_0x5eed('0x67')],'originated:\x20',JSON['stringify'](_0x1ad5be[_0x5eed('0x12')][_0x1ad5be['actions'][_0x1dd64e][_0x5eed('0x67')]]['originated']),'pTalking:\x20',JSON[_0x5eed('0x57')](_0x1ad5be[_0x5eed('0x12')][_0x1ad5be[_0x5eed('0x15')][_0x1dd64e][_0x5eed('0x67')]][_0x5eed('0x2c')]),JSON[_0x5eed('0x57')](_0x1ad5be[_0x5eed('0x15')][_0x1dd64e][_0x5eed('0x68')]),JSON[_0x5eed('0x57')](_[_0x5eed('0x69')](_0x1ad5be['actions'][_0x1dd64e],[_0x5eed('0x6a'),_0x5eed('0x6b'),_0x5eed('0x6c'),_0x5eed('0x6d')])));return ami['Action']({'action':_0x5eed('0x6e'),'channel':_0x1ad5be['actions'][_0x1dd64e]['channel']})[_0x5eed('0x6f')](function(_0x35e598){if(_0x35e598[_0x5eed('0x4a')]===_0x5eed('0x70')){setTimeout(function(){if(_0x1ad5be[_0x5eed('0x15')][_0x1dd64e]){ut[_0x5eed('0x71')](_0x1ad5be['campaignsPreview'][_0x1ad5be[_0x5eed('0x15')][_0x1dd64e][_0x5eed('0x67')]],_0x5eed('0x72'));if(_0x1ad5be[_0x5eed('0x15')][_0x1dd64e][_0x5eed('0x68')]===!![]){ut[_0x5eed('0x73')](_0x1ad5be[_0x5eed('0x12')][_0x1ad5be[_0x5eed('0x15')][_0x1dd64e][_0x5eed('0x67')]],'[clearZombieChannel]');ut[_0x5eed('0x74')](_0x5eed('0x75')+_0x1dd64e,_0x1ad5be[_0x5eed('0x15')][_0x1dd64e][_0x5eed('0x67')]);}ut['loggerError'](_0x5eed('0x76')+_0x1dd64e,_0x1ad5be[_0x5eed('0x15')][_0x1dd64e][_0x5eed('0x67')]);delete _0x1ad5be[_0x5eed('0x15')][_0x1dd64e];}},0x2328);}});}});};Preview[_0x5eed('0xd')][_0x5eed('0x77')]=function(){var _0x232bcb=this;loggerAction[_0x5eed('0x55')](_0x5eed('0x78'),_['size'](this['actions']));for(var _0x142218 in this['actions']){if(_0x232bcb[_0x5eed('0x15')][_0x5eed('0x61')](_0x142218)){_0x232bcb[_0x5eed('0x64')](_0x142218);}}};Preview[_0x5eed('0xd')]['recallMe']=function(_0x3193f8){var _0x32e889=this;rpcDb[_0x5eed('0x79')](_0x3193f8['id'],ut['agentReadyId'](this[_0x5eed('0x16')]))[_0x5eed('0x7a')](function(_0x24d953){if(!_[_0x5eed('0x65')](_0x24d953)){for(var _0x26d622=0x0;_0x26d622<_0x24d953[_0x5eed('0x7b')];_0x26d622+=0x1){if(ut[_0x5eed('0x7c')](_0x24d953[_0x26d622][_0x5eed('0x7d')])<_0x3193f8[_0x5eed('0x7e')]*0x3c){if(_0x24d953[_0x26d622][_0x5eed('0x7f')]&&!_0x24d953[_0x26d622][_0x5eed('0x7f')][_0x5eed('0x80')]){_0x32e889[_0x5eed('0x81')](_0x24d953[_0x26d622]['id'])['then'](ut[_0x5eed('0x82')]('[RecallMe]'))['catch'](ut[_0x5eed('0x82')](_0x5eed('0x83')));}else{rpcDb['disableContact'](_0x24d953[_0x26d622]['id']);}}else{var _0x122670=new Action(_0x24d953[_0x26d622],_0x3193f8);_0x122670[_0x5eed('0x84')]=moment()[_0x5eed('0x58')](_0x5eed('0x85'));_0x3193f8[_0x5eed('0x3f')]+=0x1;ut[_0x5eed('0x86')](_0x122670,0x17,_0x5eed('0x87'));if(_0x3193f8[_0x5eed('0x88')]){rpcDb[_0x5eed('0x89')](ut[_0x5eed('0x8a')](_0x24d953[_0x26d622]));rpcDb[_0x5eed('0x8b')](_0x122670,_0x5eed('0x8c'));}else{ut['logCustomer'](_0x122670,0x16,_0x5eed('0x8d'));rpcDb[_0x5eed('0x8b')](_0x122670,'[HistoryRecallClose]');rpcDb['createCustomerFinal'](_0x122670,'[HistoryRecallClose]');}}}}})['catch'](ut[_0x5eed('0x82')]('[getContactRecallMe]'));};Preview['prototype']['setMessage']=function(_0x1957ba){_0x1957ba[_0x5eed('0x59')]=!![];if(ut['IsNotLoggedIn'](_0x1957ba['loggedIn'])){_0x1957ba[_0x5eed('0x4a')]=_0x5eed('0x8e');}else if(!ut[_0x5eed('0x8f')](_0x1957ba[_0x5eed('0x35')])){_0x1957ba[_0x5eed('0x4a')]='NOT_ACTIVE';}else if(!this['isTrunkReachable'](_0x1957ba['Trunk'])){if(!this[_0x5eed('0x90')](_0x1957ba['TrunkBackup'])){_0x1957ba['message']='TRUNK_IS_NOT_REACHABLE';}else{_0x1957ba['message']='ACTIVE';}}else{_0x1957ba[_0x5eed('0x4a')]=_0x5eed('0x91');}emitCampaignPreview(_0x1957ba);};Preview[_0x5eed('0xd')]['callProgressDetectingCustomer']=function(_0x3ce752,_0x468863,_0x4d7992){var _0x271625=this;var _0x3efeed=this[_0x5eed('0x15')][_0x468863];var _0x55ebe9=this[_0x5eed('0x12')][_0x3efeed['queue']];var _0x4bf563;if(_0x55ebe9){switch(_0x4d7992){case'1':_0x55ebe9['outboundNoSuchCallsDay']+=0x1;_0x3efeed[_0x5eed('0x92')]+=0x1;_0x3efeed[_0x5eed('0x93')]=ut[_0x5eed('0x94')](_0x3efeed);ut[_0x5eed('0x86')](_0x3efeed,0x0,_0x5eed('0x95'));ami['emit']('custom:agentnosuchnumber',ut['buildObj'](_0x3efeed,_0x5eed('0x96')));rpcDb['createCustomerHistory'](_0x3efeed,_0x5eed('0x97'));if(ut['totalGlobal'](_0x3efeed)>=_0x55ebe9[_0x5eed('0x98')]){_0x4bf563=ut[_0x5eed('0x99')](_0x3efeed,0xf,_0x5eed('0x9a'));rpcDb[_0x5eed('0x9b')](_0x4bf563,'[callProgressDetectingCustomer][logNoSuchGlobal]');}else{if(_0x3efeed[_0x5eed('0x92')]>=_0x55ebe9['dialNoSuchNumberMaxRetry']){rpcDb[_0x5eed('0x9b')](_0x3efeed,_0x5eed('0x9c'));}else{rpcDb[_0x5eed('0x9d')](ut[_0x5eed('0x9e')](_0x3efeed,'countnosuchnumberretry',_0x55ebe9[_0x5eed('0x9f')]),_0x3efeed[_0x5eed('0xa0')],_0x3efeed[_0x5eed('0xa1')]);}}delete this[_0x5eed('0x15')][_0x3ce752[_0x5eed('0xa2')]];break;case _0x5eed('0xa3'):var _0x41a7d9=moment()[_0x5eed('0x58')](_0x5eed('0x85'));_0x3efeed['responsetime']=_0x41a7d9;_0x3efeed['answertime']=_0x41a7d9;_0x3efeed[_0x5eed('0x68')]=!![];_0x55ebe9[_0x5eed('0x2c')]+=0x1;logger[_0x5eed('0x55')]('[syncHangup][talking][increment]',_0x3efeed[_0x5eed('0xa4')],_0x5eed('0xa5'),_0x55ebe9[_0x5eed('0x29')],_0x5eed('0xa6'),_0x55ebe9[_0x5eed('0x2c')]);ami[_0x5eed('0x26')]('custom:agentconnect',ut[_0x5eed('0xa7')](_0x3efeed,_0x5eed('0xa8'),this[_0x5eed('0x12')][_0x3efeed[_0x5eed('0x67')]]));if(_0x55ebe9[_0x5eed('0xa9')]){ami[_0x5eed('0x26')](_0x5eed('0xaa'),ut[_0x5eed('0xab')](_0x3efeed));}break;case'16':ami[_0x5eed('0x26')](_0x5eed('0xac'),ut[_0x5eed('0xa7')](_0x3efeed,_0x5eed('0xad'),this[_0x5eed('0x12')][_0x3efeed[_0x5eed('0x67')]]));emitVoiceQueueChannelRemove(ut['buildObj'](_0x3efeed,_0x5eed('0xad')));_0x55ebe9[_0x5eed('0xae')]+=0x1;_0x55ebe9[_0x5eed('0x30')]+=0x1;_0x55ebe9['answered']+=0x1;ut[_0x5eed('0x73')](_0x55ebe9,_0x5eed('0xaf'));_0x3efeed[_0x5eed('0x93')]=ut[_0x5eed('0x94')](_0x3efeed);ut[_0x5eed('0x86')](_0x3efeed,0x4,_0x5eed('0xb0'));rpcDb[_0x5eed('0x8b')](_0x3efeed,_0x5eed('0xb1'));rpcDb[_0x5eed('0x9b')](_0x3efeed,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x5eed('0xb2')](_0x3efeed);_0x55ebe9[_0x5eed('0x2d')]+=_0x3efeed['talktime'];_0x55ebe9[_0x5eed('0xb3')]+=_0x3efeed[_0x5eed('0xb4')];logger[_0x5eed('0x55')](_0x5eed('0xb5'),_0x3efeed['uniqueid'],_0x5eed('0xa5'),_0x55ebe9[_0x5eed('0x29')],_0x5eed('0xa6'),_0x55ebe9[_0x5eed('0x2c')]);delete this[_0x5eed('0x15')][_0x3ce752['linkedid']];break;case'BUSY':_0x55ebe9[_0x5eed('0xb6')]+=0x1;_0x3efeed[_0x5eed('0xb7')]+=0x1;_0x3efeed['countglobal']=ut[_0x5eed('0x94')](_0x3efeed);ut[_0x5eed('0x86')](_0x3efeed,0x5,_0x5eed('0xb8'));ami['emit'](_0x5eed('0xb9'),ut['buildObj'](_0x3efeed,_0x5eed('0xba')));rpcDb[_0x5eed('0x8b')](_0x3efeed,_0x5eed('0xbb'));if(ut[_0x5eed('0x94')](_0x3efeed)>=_0x55ebe9[_0x5eed('0x98')]){_0x4bf563=ut[_0x5eed('0x99')](_0x3efeed,0xf,_0x5eed('0x9a'));rpcDb['createCustomerFinal'](_0x4bf563,_0x5eed('0xbc'));}else{if(_0x3efeed[_0x5eed('0xb7')]>=_0x55ebe9['dialBusyMaxRetry']){rpcDb[_0x5eed('0x9b')](_0x3efeed,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0x5eed('0x9d')](ut[_0x5eed('0x9e')](_0x3efeed,_0x5eed('0xb7'),_0x55ebe9[_0x5eed('0xbd')]),_0x3efeed[_0x5eed('0xa0')],_0x3efeed[_0x5eed('0xa1')]);}}break;case _0x5eed('0xbe'):_0x55ebe9[_0x5eed('0x3c')]+=0x1;_0x3efeed[_0x5eed('0xbf')]+=0x1;_0x3efeed['countglobal']=ut[_0x5eed('0x94')](_0x3efeed);ut[_0x5eed('0x86')](_0x3efeed,0x3,'NoAnswer');ami[_0x5eed('0x26')]('custom:agentnoanswer',ut['buildObj'](_0x3efeed,'noanswer'));rpcDb[_0x5eed('0x8b')](_0x3efeed,_0x5eed('0xc0'));if(ut[_0x5eed('0x94')](_0x3efeed)>=_0x55ebe9[_0x5eed('0x98')]){_0x4bf563=ut[_0x5eed('0x99')](_0x3efeed,0xf,_0x5eed('0x9a'));rpcDb[_0x5eed('0x9b')](_0x4bf563,_0x5eed('0xc1'));}else{if(_0x3efeed['countnoanswerretry']>=_0x55ebe9[_0x5eed('0xc2')]){rpcDb['createCustomerFinal'](_0x3efeed,_0x5eed('0xc0'));}else{rpcDb[_0x5eed('0x9d')](ut[_0x5eed('0x9e')](_0x3efeed,_0x5eed('0xbf'),_0x55ebe9[_0x5eed('0xc3')]),_0x3efeed['unlockAgent'],_0x3efeed[_0x5eed('0xa1')]);}}break;case _0x5eed('0xc4'):_0x55ebe9['outboundCongestionCallsDay']+=0x1;_0x3efeed[_0x5eed('0xc5')]+=0x1;_0x3efeed[_0x5eed('0x93')]=ut[_0x5eed('0x94')](_0x3efeed);ut[_0x5eed('0x86')](_0x3efeed,0x8,'Congestion');ami[_0x5eed('0x26')]('custom:agentcongestion',ut[_0x5eed('0xa7')](_0x3efeed,_0x5eed('0xc6')));rpcDb[_0x5eed('0x8b')](_0x3efeed,_0x5eed('0xc7'));if(ut[_0x5eed('0x94')](_0x3efeed)>=_0x55ebe9['dialGlobalMaxRetry']){_0x4bf563=ut['cloneAction'](_0x3efeed,0xf,_0x5eed('0x9a'));rpcDb[_0x5eed('0x9b')](_0x4bf563,_0x5eed('0xc8'));}else{if(_0x3efeed[_0x5eed('0xc5')]>=_0x55ebe9['dialCongestionMaxRetry']){rpcDb[_0x5eed('0x9b')](_0x3efeed,'[callProgressDetectingCustomer][logCongestion]');}else{rpcDb[_0x5eed('0x9d')](ut['scheduledAt'](_0x3efeed,_0x5eed('0xc5'),_0x55ebe9['dialBusyRetryFrequency']),_0x3efeed[_0x5eed('0xa0')],_0x3efeed[_0x5eed('0xa1')]);}}break;case'CANCEL':_0x55ebe9['outboundRejectCallsDay']+=0x1;_0x3efeed['countagentrejectretry']+=0x1;_0x3efeed[_0x5eed('0x93')]=ut['totalGlobal'](_0x3efeed);ut[_0x5eed('0x86')](_0x3efeed,0x14,'AgentReject');ami[_0x5eed('0x26')](_0x5eed('0xc9'),ut[_0x5eed('0xa7')](_0x3efeed,'agentreject'));rpcDb[_0x5eed('0x8b')](_0x3efeed,_0x5eed('0xca'));if(ut[_0x5eed('0x94')](_0x3efeed)>=_0x55ebe9[_0x5eed('0x98')]){_0x4bf563=ut[_0x5eed('0x99')](_0x3efeed,0x14,_0x5eed('0xcb'));rpcDb[_0x5eed('0x9b')](_0x4bf563,_0x5eed('0xcc'));}else{if(_0x3efeed['countagentrejectretry']>=_0x55ebe9[_0x5eed('0xcd')]){rpcDb['createCustomerFinal'](_0x3efeed,_0x5eed('0xcc'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x3efeed,_0x5eed('0xce'),_0x55ebe9[_0x5eed('0xcf')]),_0x3efeed['unlockAgent'],_0x3efeed[_0x5eed('0xa1')]);}}break;case _0x5eed('0xd0'):_0x55ebe9[_0x5eed('0xd1')]+=0x1;_0x3efeed[_0x5eed('0xd2')]+=0x1;_0x3efeed[_0x5eed('0x93')]=ut[_0x5eed('0x94')](_0x3efeed);ut[_0x5eed('0x86')](_0x3efeed,0xb,_0x5eed('0xd3'));rpcDb['createCustomerHistory'](_0x3efeed,_0x5eed('0xd4'));if(ut['totalGlobal'](_0x3efeed)>=_0x55ebe9[_0x5eed('0x98')]){_0x4bf563=ut[_0x5eed('0x99')](_0x3efeed,0xf,_0x5eed('0x9a'));rpcDb[_0x5eed('0x9b')](_0x4bf563,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x3efeed['countabandonedetry']>=_0x55ebe9[_0x5eed('0xd5')]){rpcDb['createCustomerFinal'](_0x3efeed,_0x5eed('0xd4'));}else{rpcDb[_0x5eed('0x9d')](ut[_0x5eed('0x9e')](_0x3efeed,_0x5eed('0xd2'),_0x55ebe9[_0x5eed('0xd6')]),_0x3efeed[_0x5eed('0xa0')],_0x3efeed[_0x5eed('0xa1')]);}}break;case'18':_0x55ebe9[_0x5eed('0x40')]+=0x1;_0x3efeed[_0x5eed('0xd7')]+=0x1;_0x3efeed[_0x5eed('0x93')]=ut[_0x5eed('0x94')](_0x3efeed);ut[_0x5eed('0x86')](_0x3efeed,0x12,_0x3ce752[_0x5eed('0xd8')]||_0x3ce752[_0x5eed('0xd9')]);ami[_0x5eed('0x26')](_0x5eed('0xda'),ut[_0x5eed('0xa7')](_0x3efeed,'amd'));rpcDb[_0x5eed('0x8b')](_0x3efeed,_0x5eed('0xdb'));if(ut[_0x5eed('0x94')](_0x3efeed)>=_0x55ebe9['dialGlobalMaxRetry']){_0x4bf563=ut[_0x5eed('0x99')](_0x3efeed,0xf,_0x5eed('0x9a'));rpcDb[_0x5eed('0x9b')](_0x4bf563,_0x5eed('0xdb'));}else{rpcDb[_0x5eed('0x9b')](_0x3efeed,'[callProgressDetectingCustomer][hangupInAMD]');}delete this[_0x5eed('0x15')][_0x3ce752[_0x5eed('0xa2')]];break;case'19':_0x55ebe9[_0x5eed('0x40')]+=0x1;_0x3efeed[_0x5eed('0x93')]=ut[_0x5eed('0x94')](_0x3efeed);ut['logCustomer'](_0x3efeed,0x13,_0x3ce752[_0x5eed('0xd8')]||_0x3ce752['dialstatus']);ami[_0x5eed('0x26')]('custom:amd',ut[_0x5eed('0xa7')](_0x3efeed,'amd'));rpcDb[_0x5eed('0x8b')](_0x3efeed,_0x5eed('0xdc'));if(ut[_0x5eed('0x94')](_0x3efeed)>=_0x55ebe9[_0x5eed('0x98')]){_0x4bf563=ut[_0x5eed('0x99')](_0x3efeed,0xf,'Global');rpcDb[_0x5eed('0x9b')](_0x4bf563,_0x5eed('0xdc'));}else{rpcDb[_0x5eed('0x9b')](_0x3efeed,_0x5eed('0xdc'));}delete this[_0x5eed('0x15')][_0x3ce752[_0x5eed('0xa2')]];break;default:if(_0x3efeed[_0x5eed('0x68')]){ut[_0x5eed('0x73')](_0x55ebe9,'[default]');ut[_0x5eed('0x74')](_0x5eed('0xdd')+_0x55ebe9[_0x5eed('0x29')],_0x3ce752);}_0x55ebe9[_0x5eed('0x40')]+=0x1;_0x3efeed[_0x5eed('0x93')]=ut[_0x5eed('0x94')](_0x3efeed);ut[_0x5eed('0x86')](_0x3efeed,0xc,_0x3ce752[_0x5eed('0xd8')]||_0x3ce752[_0x5eed('0xd9')]);rpcDb[_0x5eed('0x8b')](_0x3efeed,_0x5eed('0xde'));if(ut['totalGlobal'](_0x3efeed)>=_0x55ebe9[_0x5eed('0x98')]){_0x4bf563=ut['cloneAction'](_0x3efeed,0xf,_0x5eed('0x9a'));rpcDb[_0x5eed('0x9b')](_0x4bf563,'[callProgressDetectingCustomer][logUnknownGlobal]');}else{rpcDb['createCustomerFinal'](_0x3efeed,_0x5eed('0xdf'));}delete this[_0x5eed('0x15')][_0x3ce752[_0x5eed('0xa2')]];}if(!(_0x3efeed[_0x5eed('0x68')]&&_0x4d7992==='16')){ut[_0x5eed('0x71')](_0x55ebe9,'[callProgressDetectingCustomer]');logger['info'](_0x5eed('0xe0'),_0x3efeed[_0x5eed('0xa4')],_0x5eed('0xa5'),_0x55ebe9[_0x5eed('0x29')],_0x5eed('0xe1'),_0x55ebe9['originated']);}if(_0x4d7992!==_0x5eed('0xa3')){delete this[_0x5eed('0x15')][_0x3ce752[_0x5eed('0xa2')]];delete this[_0x5eed('0x15')][_0x3ce752['destlinkedid']];}}};Preview[_0x5eed('0xd')][_0x5eed('0xe2')]=function(_0x24fff5,_0x27b71b,_0x9ae8b4){if(_[_0x5eed('0xe3')](_0x27b71b)&&_0x5eed('0xe4')!==typeof _0x27b71b){return;}if(_[_0x5eed('0xe3')](_0x9ae8b4)&&_0x5eed('0xe4')!==typeof _0x9ae8b4){return;}switch(_0x9ae8b4[_0x5eed('0xe5')]){case'0':ut[_0x5eed('0xe6')](_0x24fff5,0x0,_0x5eed('0x95'));rpcDb[_0x5eed('0xe7')](_0x24fff5,'[callProgressDetectingAgent][logNoSuch]');break;case'3':ut[_0x5eed('0xe6')](_0x24fff5,0x3,_0x5eed('0xe8'));rpcDb[_0x5eed('0xe7')](_0x24fff5,_0x5eed('0xe9'));break;case'5':ut[_0x5eed('0xe6')](_0x24fff5,0x5,_0x5eed('0xb8'));rpcDb['createAgentHistory'](_0x24fff5,_0x5eed('0xea'));break;case'8':ut['logAgent'](_0x24fff5,0x8,_0x5eed('0xeb'));rpcDb[_0x5eed('0xe7')](_0x24fff5,_0x5eed('0xec'));break;case'22':ut['logAgent'](_0x24fff5,0x16,_0x5eed('0xed'));rpcDb[_0x5eed('0xe7')](_0x24fff5,_0x5eed('0xee'));break;default:ut[_0x5eed('0xe6')](_0x24fff5,0xc,_0x9ae8b4[_0x5eed('0xe5')]);rpcDb[_0x5eed('0xe7')](_0x24fff5,_0x5eed('0xec'));}ut[_0x5eed('0x71')](_0x27b71b,_0x5eed('0xef'));logger[_0x5eed('0x55')](_0x5eed('0xf0'),_0x24fff5[_0x5eed('0xa4')],_0x5eed('0xa5'),_0x27b71b[_0x5eed('0x29')],_0x5eed('0xe1'),_0x27b71b['originated']);delete this[_0x5eed('0x15')][_0x24fff5[_0x5eed('0xa4')]];};Preview['prototype'][_0x5eed('0xf1')]=function(_0x520e17,_0x5781d5,_0x23ea47,_0x58707c,_0x11574c){var _0x2a78ed=this;return new BPromise(function(_0x2d9e72,_0x4faf97){if(_[_0x5eed('0x65')](_0x5781d5)||_[_0x5eed('0x65')](_0x5781d5[_0x5eed('0xf2')])||_[_0x5eed('0x65')](_0x5781d5[_0x5eed('0xf2')][_0x5eed('0xf3')])||_[_0x5eed('0x65')](_0x5781d5[_0x5eed('0x6c')])){_0x4faf97(ut[_0x5eed('0x4a')](_0x5eed('0xf4'),_0x58707c,_0x11574c));return;}var _0x3a20e6=uuid['v4']();var _0x1482a0=_0x2a78ed[_0x5eed('0x12')][_0x5781d5[_0x5eed('0x66')][_0x5eed('0x29')]];var _0x1b3d9f=_0x23ea47?_0x2a78ed['agents'][_0x23ea47]['id']:undefined;_0x2a78ed[_0x5eed('0x15')][_0x3a20e6]=new Action(_0x5781d5,_0x1482a0,_0x3a20e6,_0x23ea47,_0x1b3d9f);var _0x1842ab=_0x2a78ed[_0x5eed('0x15')][_0x3a20e6];_0x1842ab['unlockAgent']=_0x58707c;_0x1842ab[_0x5eed('0xa1')]=_0x11574c;_0x1842ab[_0x5eed('0xf5')]=_0x23ea47;if(_['isEmpty'](_0x520e17)){_0x2a78ed[_0x5eed('0xf6')](_0x1842ab,_0x1482a0,_0x5781d5,_0x23ea47)[_0x5eed('0x7a')](function(_0x17fe0d){logger[_0x5eed('0x55')](_0x5eed('0xf7'),_0x5eed('0xf8')+_0x1842ab[_0x5eed('0x67')]+'\x20IdHopper:\x20'+_0x1842ab[_0x5eed('0xf9')],JSON['stringify'](_0x17fe0d));ami['emit'](_0x5eed('0xfa'),ut['buildObj'](_0x1842ab,'called',_0x2a78ed[_0x5eed('0x12')][_0x1842ab[_0x5eed('0x67')]]));_0x2d9e72(ut[_0x5eed('0x4a')](_0x5eed('0xfb')));})[_0x5eed('0x6f')](function(_0x3c41b8){ut['logger']('[Preview][execCall][failure]',_0x3c41b8);_0x4faf97(ut[_0x5eed('0x4a')](_0x5eed('0xfc'),_0x58707c,_0x11574c));});}else{_0x1482a0['outboundBlacklistCallsDay']+=0x1;ut[_0x5eed('0xfd')](_0x1842ab);rpcDb[_0x5eed('0xfe')](_0x1842ab,_0x5eed('0xff'));delete _0x2a78ed[_0x5eed('0x15')][_0x3a20e6];_0x4faf97(ut[_0x5eed('0x4a')](_0x5eed('0x100'),_0x58707c,_0x11574c));}});};Preview['prototype'][_0x5eed('0x90')]=function(_0x4d227c){return!_[_0x5eed('0x65')](_0x4d227c)&&!_[_0x5eed('0x65')](_0x4d227c[_0x5eed('0x29')])&&!_[_0x5eed('0x65')](_0x4d227c[_0x5eed('0x50')])&&_0x4d227c['active']&&!_[_0x5eed('0x65')](this[_0x5eed('0x14')][util['format'](_0x5eed('0x101'),_0x4d227c[_0x5eed('0x29')])])&&!_['isNil'](this['trunks'][util[_0x5eed('0x58')](_0x5eed('0x101'),_0x4d227c[_0x5eed('0x29')])][_0x5eed('0x6e')])&&(this[_0x5eed('0x14')][util[_0x5eed('0x58')](_0x5eed('0x101'),_0x4d227c[_0x5eed('0x29')])][_0x5eed('0x6e')]===_0x5eed('0x102')||this[_0x5eed('0x14')][util['format'](_0x5eed('0x101'),_0x4d227c[_0x5eed('0x29')])][_0x5eed('0x6e')]==='unmonitored');};Preview[_0x5eed('0xd')]['run']=function(_0x37bc19,_0x23d27f){var _0x1b405e=this;return new BPromise(function(_0x50b696,_0x2e60cc){_0x1b405e[_0x5eed('0x103')](_0x37bc19,_0x23d27f)[_0x5eed('0x7a')](function(_0x150588){_0x50b696(_[_0x5eed('0x69')](_0x150588,[_0x5eed('0x4a')]));})[_0x5eed('0x6f')](function(_0x1a24bc){if(_0x1a24bc[_0x5eed('0x104')]){rpcDb['unlockContact'](_0x37bc19);}if(_0x1a24bc[_0x5eed('0x50')]){rpcDb[_0x5eed('0x105')](_0x37bc19);}_0x2e60cc(_[_0x5eed('0x69')](_0x1a24bc,[_0x5eed('0x4a')]));});});};Preview[_0x5eed('0xd')][_0x5eed('0x103')]=function(_0x241ba1,_0x5ab862){var _0x49f2a1=this;return new BPromise(function(_0x486c5d,_0x23355b){var _0x380bf7,_0x3c3410;rpcDb[_0x5eed('0x106')](_0x241ba1)[_0x5eed('0x7a')](function(_0x29457c){if(!_[_0x5eed('0x65')](_0x29457c[0x0])){_0x3c3410=_0x29457c[0x0][_0x5eed('0x107')]?![]:!![];_0x380bf7=_0x29457c[0x0][_0x5eed('0x107')]?!![]:![];_0x380bf7=_0x5ab862?!![]:_0x380bf7;}var _0x5a3cf6=_0x49f2a1[_0x5eed('0x108')](_0x29457c);if(_0x5a3cf6['isValid']){rpcDb[_0x5eed('0x109')](_['pick'](_0x29457c[0x0],['VoiceQueueId',_0x5eed('0x10a')]))[_0x5eed('0x7a')](function(_0x308e01){_0x49f2a1[_0x5eed('0xf1')](_0x308e01,_0x29457c[0x0],_0x5ab862,_0x3c3410,_0x380bf7)['then'](function(_0x20851f){_0x486c5d(_0x20851f);})[_0x5eed('0x6f')](function(_0x8de071){_0x23355b(_0x8de071);});})['catch'](function(_0x35d15a){ut['logger'](_0x5eed('0x10b'),_0x35d15a);_0x23355b(ut[_0x5eed('0x4a')](_0x5eed('0x10c'),_0x3c3410,_0x380bf7));});}else{_0x23355b(ut[_0x5eed('0x4a')](_0x5a3cf6[_0x5eed('0x4a')],_0x3c3410,_0x380bf7));}})['catch'](function(_0x456964){ut[_0x5eed('0x5d')](_0x5eed('0x10d'),_0x456964);_0x23355b(ut[_0x5eed('0x4a')](_0x5eed('0x10c'),![],!![]));});});};Preview[_0x5eed('0xd')][_0x5eed('0x108')]=function(_0x550a86){if(_[_0x5eed('0x65')](_0x550a86)||_[_0x5eed('0x10e')](_0x550a86)||!_[_0x5eed('0x65')](_0x550a86[0x0][_0x5eed('0x7f')])&&_['isNil'](_0x550a86[0x0][_0x5eed('0x7f')][_0x5eed('0x29')])){ut[_0x5eed('0x5d')](_0x5eed('0x10f'),_0x550a86);return{'isValid':![],'message':_0x5eed('0x110')};}var _0x4b434c=this[_0x5eed('0x12')][_0x550a86[0x0]['Queue'][_0x5eed('0x29')]];_0x4b434c['message']='ACTIVE';if(_[_0x5eed('0x65')](_0x4b434c)){ut[_0x5eed('0x5d')](_0x5eed('0x111'),_0x4b434c);return{'isValid':![],'message':_0x5eed('0x112')};}if(!this[_0x5eed('0x90')](_0x4b434c[_0x5eed('0x4f')])){ut[_0x5eed('0x5d')](_0x5eed('0x113'),_0x5eed('0x114')+_0x4b434c[_0x5eed('0x29')]+'\x20Trunk\x20is\x20not\x20active');if(!this['isTrunkReachable'](_0x4b434c['TrunkBackup'])){ut[_0x5eed('0x5d')](_0x5eed('0x113'),_0x4b434c[_0x5eed('0x29')]+_0x5eed('0x115'));return{'isValid':![],'message':_0x5eed('0x116')};}}if(!ut[_0x5eed('0x8f')](_0x4b434c[_0x5eed('0x35')])){ut[_0x5eed('0x5d')]('[Preview][validateContact][Campaign\x20Active]',_0x4b434c[_0x5eed('0x29')]+_0x5eed('0x117'));return{'isValid':![],'message':'campaign\x20Name:\x20'+_0x4b434c['name']+_0x5eed('0x117')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0x5eed('0xd')][_0x5eed('0xf6')]=function(_0x290476,_0xaf2763,_0x5a3bd5,_0x2dffec){var _0x25fcb3=this;return new BPromise(function(_0xf17acd,_0x22384a){var _0x2d8c45=_0x290476[_0x5eed('0xa4')];var _0x58136f=_0x25fcb3[_0x5eed('0x90')](_0xaf2763[_0x5eed('0x4f')])?util[_0x5eed('0x58')]('SIP/%s/%s%s',_0xaf2763[_0x5eed('0x4f')][_0x5eed('0x29')],_[_0x5eed('0x65')](_0xaf2763[_0x5eed('0x118')])?'':_0xaf2763[_0x5eed('0x118')][_0x5eed('0x119')]()||'',_0xaf2763[_0x5eed('0x11a')]>0x0?_0x5a3bd5['Contact'][_0x5eed('0xf3')][_0x5eed('0x11b')](_0xaf2763[_0x5eed('0x11a')]):_0x5a3bd5[_0x5eed('0xf2')][_0x5eed('0xf3')]):util['format'](_0x5eed('0x11c'),_[_0x5eed('0x65')](_0xaf2763['TrunkBackup'])?_0xaf2763[_0x5eed('0x4f')][_0x5eed('0x29')]:_0xaf2763[_0x5eed('0x11d')][_0x5eed('0x29')],_[_0x5eed('0x65')](_0xaf2763[_0x5eed('0x118')])?'':_0xaf2763[_0x5eed('0x118')][_0x5eed('0x119')]()||'',_0xaf2763[_0x5eed('0x11a')]>0x0?_0x5a3bd5['Contact'][_0x5eed('0xf3')][_0x5eed('0x11b')](_0xaf2763['dialCutDigit']):_0x5a3bd5['Contact'][_0x5eed('0xf3')]);var _0x3d0f62=_0x25fcb3[_0x5eed('0x90')](_0xaf2763['Trunk'])?ut['getCallerId'](_0xaf2763[_0x5eed('0x4f')]['callerid'],_0xaf2763[_0x5eed('0x37')],_0xaf2763[_0x5eed('0x11e')]>0x0?ut[_0x5eed('0x11f')](_0xaf2763[_0x5eed('0x38')],_0xaf2763[_0x5eed('0x11e')]):_0xaf2763['dialOriginateCallerIdNumber']):ut[_0x5eed('0x120')](_[_0x5eed('0x65')](_0xaf2763[_0x5eed('0x11d')])?_0xaf2763[_0x5eed('0x4f')][_0x5eed('0x51')]:_0xaf2763['TrunkBackup'][_0x5eed('0x51')],_0xaf2763[_0x5eed('0x37')],_0xaf2763[_0x5eed('0x11e')]>0x0?ut[_0x5eed('0x11f')](_0xaf2763['dialOriginateCallerIdNumber'],_0xaf2763['dialRandomLastDigitCallerIdNumber']):_0xaf2763[_0x5eed('0x38')]);if(_0x3d0f62){_0x290476['originatecalleridname']=ut['extractCalleridName'](_0x3d0f62);_0x290476[_0x5eed('0x121')]=ut[_0x5eed('0x122')](_0x3d0f62);}var _0x2e5aaf=ut[_0x5eed('0x123')](_0xaf2763,_0x5a3bd5,_0x58136f,_0x3d0f62,_0x2d8c45,_0x290476);_[_0x5eed('0x124')](_0x290476,ut['toLowerVariables'](_0x2e5aaf));_0x290476[_0x5eed('0x84')]=moment()[_0x5eed('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ami[_0x5eed('0x125')](ut[_0x5eed('0x126')](_0x290476,_0xaf2763,_0x2e5aaf,_0x290476[_0x5eed('0xa1')],_0x2dffec))[_0x5eed('0x7a')](function(_0xeec9e){_0xaf2763['originated']+=0x1;logger[_0x5eed('0x55')](_0x5eed('0x127'),_0x2d8c45,_0x5eed('0xa5'),_0xaf2763[_0x5eed('0x29')],'originated:\x20',_0xaf2763['originated']);_0xf17acd(_0xeec9e);})['catch'](function(_0x210734){ut[_0x5eed('0xe6')](_0x290476,0xe,_0x5eed('0x128'));rpcDb[_0x5eed('0xe7')](_0x290476,_0x5eed('0x129'));_0x22384a(_0x210734);});});};Preview[_0x5eed('0xd')]['syncNewExten']=function(_0x3974a8){if(this['actions'][_0x3974a8[_0x5eed('0xa2')]]){this[_0x5eed('0x15')][_0x3974a8['linkedid']][_0x5eed('0x12a')]=_0x3974a8['channel'];}};Preview[_0x5eed('0xd')][_0x5eed('0x12b')]=function(_0x4ff5ca){var _0x4a1fae=this;var _0x56c61c=this[_0x5eed('0x15')][_0x4ff5ca[_0x5eed('0x12c')]];if(_0x56c61c){if(_0x56c61c[_0x5eed('0xf5')]&&this['agents'][_0x56c61c[_0x5eed('0xf5')]]){ut[_0x5eed('0x12d')](_0x56c61c,this[_0x5eed('0x16')][_0x56c61c['lookAgent']][_0x5eed('0x29')],this[_0x5eed('0x16')][_0x56c61c['lookAgent']]['id']);}var _0x1ceded=_[_0x5eed('0x12e')](_0x56c61c);_0x1ceded[_0x5eed('0x12f')]=moment()[_0x5eed('0x58')](_0x5eed('0x85'));var _0x5d83da=_0x4a1fae[_0x5eed('0x12')][_0x56c61c[_0x5eed('0x67')]];if(ut[_0x5eed('0x130')](_0x4ff5ca[_0x5eed('0x131')])){if(_0x56c61c['unlockAgent']){rpcDb[_0x5eed('0x132')](_0x56c61c['idContact']);}if(_0x56c61c[_0x5eed('0xa1')]){rpcDb[_0x5eed('0x105')](_0x56c61c['idContact']);}ami['emit'](_0x5eed('0x133'),ut[_0x5eed('0xa7')](_0x56c61c,_0x5eed('0x134'),this['campaignsPreview'][_0x56c61c[_0x5eed('0x67')]]));this['callProgressDetectingAgent'](_0x1ceded,_0x5d83da,_0x4ff5ca);}else{_0x56c61c[_0x5eed('0x84')]=moment()[_0x5eed('0x58')]('YYYY-MM-DD\x20HH:mm:ss');ut[_0x5eed('0xe6')](_0x1ceded,0x4,_0x5eed('0xb0'));rpcDb['createAgentHistory'](_0x1ceded,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x5eed('0xd')]['syncHangup']=function(_0x192200){var _0x4ce967=this;var _0x9e37eb=this[_0x5eed('0x15')][_0x192200[_0x5eed('0xa2')]];var _0x459e77;if(_0x9e37eb){_0x459e77=this[_0x5eed('0x12')][_0x9e37eb[_0x5eed('0x67')]];logger['info'](_0x5eed('0x135'),_0x192200['linkedid'],_0x5eed('0xa5'),_0x459e77[_0x5eed('0x29')],_0x5eed('0xa6'),_0x459e77[_0x5eed('0x2c')]);}if(this['actions'][_0x192200[_0x5eed('0xa2')]]&&_0x192200['linkedid']!==_0x192200['uniqueid']){if(_0x192200[_0x5eed('0x136')]==='16'&&this[_0x5eed('0x15')][_0x192200[_0x5eed('0xa2')]]['dialAnswer']){this[_0x5eed('0x137')](_0x192200,_0x192200[_0x5eed('0xa2')],_0x192200[_0x5eed('0x136')]);}else if(this[_0x5eed('0x15')][_0x192200['linkedid']][_0x5eed('0x68')]){logger['info']('[syncHangup][talking][cause]',_0x192200[_0x5eed('0xa2')],_0x192200[_0x5eed('0x136')],_0x5eed('0xa5'),_0x459e77[_0x5eed('0x29')],_0x5eed('0xa6'),_0x459e77['pTalking']);this[_0x5eed('0x137')](_0x192200,_0x192200[_0x5eed('0xa2')],_0x192200[_0x5eed('0x136')]);}}else if(_0x9e37eb&&_[_0x5eed('0x65')](_0x9e37eb['statedesc'])&&_0x459e77['dialQueueProject']&&_0x192200[_0x5eed('0xa2')]===_0x192200[_0x5eed('0xa4')]&&_[_0x5eed('0x65')](_0x192200[_0x5eed('0xe5')])&&_0x192200[_0x5eed('0x136')]==='16'&&_0x192200['channelstate']==='6'&&_['isUndefined'](_0x9e37eb[_0x5eed('0x138')])){if(_0x9e37eb[_0x5eed('0xa0')]){rpcDb['unlockContact'](_0x9e37eb['idContact']);}if(_0x9e37eb[_0x5eed('0xa1')]){rpcDb['disableContact'](_0x9e37eb[_0x5eed('0xf9')]);}_0x192200[_0x5eed('0xe5')]='22';this[_0x5eed('0xe2')](_0x9e37eb,_0x459e77,_0x192200);}else if(_0x9e37eb&&_0x9e37eb[_0x5eed('0x138')]){if(_0x192200[_0x5eed('0x136')]==='16'&&this[_0x5eed('0x15')][_0x192200[_0x5eed('0xa2')]]['dialAnswer']){logger[_0x5eed('0x55')]('[syncHangup][talking][transfer]',_0x192200[_0x5eed('0xa2')],_0x192200[_0x5eed('0x136')],_0x5eed('0xa5'),_0x459e77[_0x5eed('0x29')],_0x5eed('0xa6'),_0x459e77[_0x5eed('0x2c')]);this['callProgressDetectingCustomer'](_0x192200,_0x192200[_0x5eed('0xa2')],_0x192200[_0x5eed('0x136')]);}else if(this[_0x5eed('0x15')][_0x192200[_0x5eed('0xa2')]][_0x5eed('0x68')]){logger[_0x5eed('0x55')](_0x5eed('0x139'),_0x192200[_0x5eed('0xa2')],_0x192200[_0x5eed('0x136')],_0x5eed('0xa5'),_0x459e77[_0x5eed('0x29')],_0x5eed('0xa6'),_0x459e77[_0x5eed('0x2c')]);this[_0x5eed('0x137')](_0x192200,_0x192200[_0x5eed('0xa2')],_0x192200['cause']);}}};Preview[_0x5eed('0xd')][_0x5eed('0x1d')]=function(_0x18135f){if(this[_0x5eed('0x15')][_0x18135f[_0x5eed('0x13a')]]&&_0x18135f[_0x5eed('0x13a')]!==_0x18135f[_0x5eed('0x13b')]){this[_0x5eed('0x137')](_0x18135f,_0x18135f[_0x5eed('0x13a')],_0x18135f[_0x5eed('0xd9')]);}};Preview[_0x5eed('0xd')][_0x5eed('0x1c')]=function(_0x54d546){if(this[_0x5eed('0x15')][_0x54d546[_0x5eed('0xa2')]]&&_0x54d546[_0x5eed('0xa2')]!==_0x54d546[_0x5eed('0xa4')]&&!this[_0x5eed('0x15')][_0x54d546[_0x5eed('0xa2')]][_0x5eed('0x68')]){if(_0x54d546[_0x5eed('0x136')]==='1'){this[_0x5eed('0x137')](_0x54d546,_0x54d546[_0x5eed('0xa2')],_0x54d546[_0x5eed('0x136')]);}}};Preview[_0x5eed('0xd')][_0x5eed('0x13c')]=function(_0x43bb29,_0x3f0d2f,_0x52c126){if(this[_0x5eed('0x15')][_0x43bb29]){if(_[_0x5eed('0x65')](this[_0x5eed('0x15')][_0x43bb29]['variables'])){this[_0x5eed('0x15')][_0x43bb29][_0x5eed('0x13d')]={};}this[_0x5eed('0x15')][_0x43bb29][_0x5eed('0x13d')][_0x3f0d2f]=_0x52c126;}};Preview[_0x5eed('0xd')][_0x5eed('0x21')]=function(_0x7255a4){try{if(!_['isNil'](_0x7255a4)){if(ut[_0x5eed('0x13e')](_[_0x5eed('0x13f')](_0x7255a4['variable'])[0x0])){this[_0x5eed('0x13c')](_0x7255a4[_0x5eed('0xa4')],_[_0x5eed('0x13f')](_0x7255a4['variable'])[0x0],_0x7255a4[_0x5eed('0x140')]);}}}catch(_0x4a310e){logger[_0x5eed('0x141')](_0x5eed('0x142'),util[_0x5eed('0x143')](_0x4a310e,{'showHidden':![],'depth':null}));}};Preview[_0x5eed('0xd')][_0x5eed('0x23')]=function(_0x5c0c5e){if(_0x5c0c5e){if(this[_0x5eed('0x15')][_0x5c0c5e['transfertargetlinkedid']]){this['actions'][_0x5c0c5e[_0x5eed('0x144')]]['transfer']=!![];}}};Preview[_0x5eed('0xd')]['syncBlindTransfer']=function(_0x1f3dd9){if(_0x1f3dd9){if(this['actions'][_0x1f3dd9['transfererlinkedid']]){this[_0x5eed('0x15')][_0x1f3dd9['transfererlinkedid']]['transfer']=!![];}}};module[_0x5eed('0x145')]=Preview; \ No newline at end of file +var _0xff8e=['Answer','[callProgressDetectingCustomer][logAnswer]','sumBillable','talktime','\x20Queue','linkedid','BUSY','outboundBusyCallsDay','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','scheduledAt','countbusyretry','NOANSWER','outboundNoAnswerCallsDay','NoAnswer','custom:agentnoanswer','noanswer','dialNoAnswerMaxRetry','[callProgressDetectingCustomer][logNoAnswer]','countnoanswerretry','dialNoAnswerRetryFrequency','Congestion','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','[callProgressDetectingCustomer][logCongestionGlobal]','countcongestionretry','dialCongestionMaxRetry','dialBusyRetryFrequency','outboundRejectCallsDay','countagentrejectretry','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','dialAgentRejectMaxRetry','ABANDONED','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedRetryFrequency','countmachineretry','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','callProgressDetectingAgent','isUndefined','object','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','AnswerAGI','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','checkInBlack','Contact','Contact\x20is\x20undefined','lookAgent','execCall','[Preview][execCall][success]','Queue:\x20','idContact','custom:agentcalled','Calling','Call\x20failed','logBlacklist','createHistory','Contact\x20in\x20black\x20List','SIP/%s','status','reachable','unmonitored','execRun','unlock','disableContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','isEmpty','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20work]','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20work','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','campaign\x20Name:\x20','Is\x20Valid','SIP/%s/%s%s','dialCutDigit','phone','substring','trim','getCallerId','getCallerIdRandom','dialRandomLastDigitCallerIdNumber','originatecalleridname','extractCalleridName','originatecalleridnum','extractCalleridNumber','toLowerVariables','Action','variablesAction','[originated][increment]','OriginateError','logLookAgent','clone','response','rejected','[callProgressDetectingAgent][logAnswer]','syncHangup','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','transfer','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','syncAttendedTransfer','transfertargetlinkedid','transfererlinkedid','exports','util','lodash','bluebird','moment','md5','../../../config/environment','../../../config/logger','actionPreview','../ami','./rpcDb','./action','./util/util','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','hanguprequest','syncHangupRequest','dialend','syncDialEnd','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','blindtransfer','syncBlindTransfer','loopCampaigns','type','outbound','name','strategy','available','loggedIn','pTalking','sumDuration','sumHoldTime','talking','total','unmanaged','loggedInDb','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','outboundAnswerAgiCallsDay','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundUnknownCallsDay','outboundAbandonedCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','originated','erlangCalls','erlangCallToSecond','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','callerid','Interval','stringify','format','voice:queue:%s','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','voice_queue_channel:remove','emit','voice_queue_presence:remove','sendMessageOneNotActive','paused','message','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','\x20is\x20disactive','syncCampaigns','hasOwnProperty','preview','setMessage','recallMe','isNil','actions','Queue','originated:\x20','queue','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','channel','updateOriginated','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','[action]','size','agentReadyId','then','length','getDiff','Agent','voicePause','run','logger2','[RecallMe]','catch','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','IsNotLoggedIn','AGENTS_NOT_LOGGED','NOT_ACTIVE','isTrunkReachable','TrunkBackup','TRUNK_IS_NOT_REACHABLE','ACTIVE','callProgressDetectingCustomer','countnosuchnumberretry','NoSuchNumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','rescheduleContact','dialNoSuchNumberRetryFrequency','unlockAgent','activeContact','ANSWER','responsetime','[syncHangup][talking][increment]','uniqueid','connect','custom:agentConnectPreview','complete','[16]','countglobal','totalGlobal'];(function(_0x53454c,_0x1e0b79){var _0x5cd280=function(_0x59a128){while(--_0x59a128){_0x53454c['push'](_0x53454c['shift']());}};_0x5cd280(++_0x1e0b79);}(_0xff8e,0x1eb));var _0xeff8=function(_0xc80dd3,_0x4747ea){_0xc80dd3=_0xc80dd3-0x0;var _0x2a5490=_0xff8e[_0xc80dd3];return _0x2a5490;};'use strict';var util=require(_0xeff8('0x0'));var _=require(_0xeff8('0x1'));var BPromise=require(_0xeff8('0x2'));var uuid=require('uuid');var moment=require(_0xeff8('0x3'));var md5=require(_0xeff8('0x4'));var Redis=require('ioredis');var config=require(_0xeff8('0x5'));var logger=require('../../../config/logger')('preview');var loggerAction=require(_0xeff8('0x6'))(_0xeff8('0x7'));var ami=require(_0xeff8('0x8'));var rpcDb=require(_0xeff8('0x9'));var Action=require(_0xeff8('0xa'));var ut=require(_0xeff8('0xb'));config['redis']=_['defaults'](config['redis'],{'host':_0xeff8('0xc'),'port':0x18eb});var io=require(_0xeff8('0xd'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xeff8('0xe')][_0xeff8('0xf')]=function(_0x132976){this[_0xeff8('0x10')]=this['tail']?this['tail'][_0xeff8('0x11')](_0x132976):_0x132976();};function Preview(_0x733824){this[_0xeff8('0x12')]=new Sequence();this[_0xeff8('0x13')]=_0x733824[_0xeff8('0x14')];this[_0xeff8('0x15')]=_0x733824[_0xeff8('0x15')];this['actions']={};this[_0xeff8('0x16')]=_0x733824[_0xeff8('0x16')];this[_0xeff8('0x17')]=0x0;ami['on']('originateresponse',this[_0xeff8('0x18')][_0xeff8('0x19')](this));ami['on'](_0xeff8('0x1a'),this['syncHangup'][_0xeff8('0x19')](this));ami['on'](_0xeff8('0x1b'),this[_0xeff8('0x1c')][_0xeff8('0x19')](this));ami['on'](_0xeff8('0x1d'),this[_0xeff8('0x1e')][_0xeff8('0x19')](this));ami['on'](_0xeff8('0x1f'),this[_0xeff8('0x20')][_0xeff8('0x19')](this));ami['on'](_0xeff8('0x21'),this[_0xeff8('0x22')][_0xeff8('0x19')](this));ami['on'](_0xeff8('0x23'),this['syncAttendedTransfer'][_0xeff8('0x19')](this));ami['on'](_0xeff8('0x24'),this[_0xeff8('0x25')][_0xeff8('0x19')](this));this[_0xeff8('0x26')](this[_0xeff8('0x13')]);}function emit(_0x35ed06,_0x28484b,_0x517d63){io['to'](_0x35ed06)['emit'](_0x28484b,_0x517d63);}function emitCampaignPreview(_0x59d3e6){if(_0x59d3e6[_0xeff8('0x27')]===_0xeff8('0x28')){var _0x4fee76={'id':_0x59d3e6['id'],'name':_0x59d3e6[_0xeff8('0x29')],'strategy':_0x59d3e6[_0xeff8('0x2a')],'answered':_0x59d3e6['answered'],'available':_0x59d3e6[_0xeff8('0x2b')],'loggedIn':_0x59d3e6[_0xeff8('0x2c')],'pTalking':_0x59d3e6[_0xeff8('0x2d')],'sumBillable':_0x59d3e6['sumBillable'],'sumDuration':_0x59d3e6[_0xeff8('0x2e')],'sumHoldTime':_0x59d3e6[_0xeff8('0x2f')]||0x0,'talking':_0x59d3e6[_0xeff8('0x30')],'total':_0x59d3e6[_0xeff8('0x31')],'type':_0x59d3e6['type'],'unmanaged':_0x59d3e6[_0xeff8('0x32')],'abandoned':_0x59d3e6['abandoned'],'waiting':_0x59d3e6['waiting'],'loggedInDb':_0x59d3e6[_0xeff8('0x33')],'dialActive':_0x59d3e6[_0xeff8('0x34')],'dialMethod':_0x59d3e6[_0xeff8('0x35')],'dialOriginateCallerIdName':_0x59d3e6[_0xeff8('0x36')],'dialOriginateCallerIdNumber':_0x59d3e6[_0xeff8('0x37')],'dialOriginateTimeout':_0x59d3e6[_0xeff8('0x38')],'dialPrefix':_0x59d3e6[_0xeff8('0x39')],'outboundAnswerAgiCallsDay':_0x59d3e6[_0xeff8('0x3a')],'outboundAnswerCallsDay':_0x59d3e6[_0xeff8('0x3b')],'outboundBlacklistCallsDay':_0x59d3e6[_0xeff8('0x3c')],'outboundBusyCallsDay':_0x59d3e6['outboundBusyCallsDay'],'outboundCongestionCallsDay':_0x59d3e6['outboundCongestionCallsDay'],'outboundDropCallsDayACS':_0x59d3e6[_0xeff8('0x3d')],'outboundDropCallsDayCallersExit':_0x59d3e6[_0xeff8('0x3e')],'outboundDropCallsDayTimeout':_0x59d3e6[_0xeff8('0x3f')],'outboundNoAnswerCallsDay':_0x59d3e6['outboundNoAnswerCallsDay'],'outboundNoSuchCallsDay':_0x59d3e6[_0xeff8('0x40')],'outboundOriginateFailureCallsDay':_0x59d3e6[_0xeff8('0x41')],'outboundReCallsDay':_0x59d3e6[_0xeff8('0x42')],'outboundRejectCallsDay':_0x59d3e6['outboundRejectCallsDay'],'outboundUnknownCallsDay':_0x59d3e6[_0xeff8('0x43')],'outboundAbandonedCallsDay':_0x59d3e6[_0xeff8('0x44')],'predictiveIntervalAnsweredCalls':_0x59d3e6[_0xeff8('0x45')],'predictiveIntervalAvgHoldtime':_0x59d3e6[_0xeff8('0x46')],'predictiveIntervalAvgTalktime':_0x59d3e6[_0xeff8('0x47')],'predictiveIntervalDroppedCallsCallersExit':_0x59d3e6[_0xeff8('0x48')],'predictiveIntervalDroppedCallsTimeout':_0x59d3e6[_0xeff8('0x49')],'predictiveIntervalErlangCalls':_0x59d3e6[_0xeff8('0x4a')],'predictiveIntervalErlangCallsDroppedCalls':_0x59d3e6[_0xeff8('0x4b')],'predictiveIntervalHitRate':_0x59d3e6['predictiveIntervalHitRate'],'predictiveIntervalMultiplicativeFactor':_0x59d3e6[_0xeff8('0x4c')],'predictiveIntervalPauses':_0x59d3e6[_0xeff8('0x4d')],'predictiveIntervalAvailable':_0x59d3e6[_0xeff8('0x4e')],'predictiveIntervalTotalCalls':_0x59d3e6['predictiveIntervalTotalCalls'],'message':_0x59d3e6['message'],'originated':_0x59d3e6[_0xeff8('0x4f')],'erlangCalls':_0x59d3e6[_0xeff8('0x50')],'erlangCallToSecond':_0x59d3e6[_0xeff8('0x51')],'erlangAbandonmentRate':_0x59d3e6['erlangAbandonmentRate'],'erlangBusyFactor':_0x59d3e6[_0xeff8('0x52')],'startPredictive':_0x59d3e6[_0xeff8('0x53')],'startProgressive':_0x59d3e6[_0xeff8('0x54')]};if(_0x59d3e6[_0xeff8('0x55')]){_0x4fee76['Trunk']={'id':_0x59d3e6[_0xeff8('0x55')]['id'],'name':_0x59d3e6[_0xeff8('0x55')][_0xeff8('0x29')],'active':_0x59d3e6[_0xeff8('0x55')][_0xeff8('0x56')],'callerid':_0x59d3e6[_0xeff8('0x55')][_0xeff8('0x57')]};}if(_0x59d3e6[_0xeff8('0x58')]){_0x4fee76['Interval']={'id':_0x59d3e6['Interval']['id'],'name':_0x59d3e6[_0xeff8('0x58')][_0xeff8('0x29')]};}var _0x3da0f9=md5(JSON[_0xeff8('0x59')](_0x4fee76));if(_0x59d3e6[_0xeff8('0x4')]!==_0x3da0f9){_0x59d3e6[_0xeff8('0x4')]=_0x3da0f9;emit(util[_0xeff8('0x5a')](_0xeff8('0x5b'),_0x4fee76[_0xeff8('0x29')]),'voice_queue:save',_0x4fee76);}}}function emitVoiceQueueChannelRemove(_0x280a15){logger[_0xeff8('0x5c')](_0xeff8('0x5d'),JSON[_0xeff8('0x59')](_0x280a15));emit(util[_0xeff8('0x5a')](_0xeff8('0x5b'),_0x280a15[_0xeff8('0x29')]),_0xeff8('0x5e'),_0x280a15);io[_0xeff8('0x5f')](_0xeff8('0x60'),_0x280a15);}function notSendMessagesQueue(_0x41bdb1){if(_0x41bdb1[_0xeff8('0x61')]){if(_0x41bdb1['originated']===0x0&&_0x41bdb1[_0xeff8('0x2d')]===0x0){_0x41bdb1[_0xeff8('0x61')]=![];_0x41bdb1[_0xeff8('0x2b')]=0x0;_0x41bdb1[_0xeff8('0x62')]=0x0;_0x41bdb1[_0xeff8('0x63')]='NOT_ACTIVE';ut[_0xeff8('0x64')](_0xeff8('0x65'),_0x41bdb1[_0xeff8('0x29')]+_0xeff8('0x66'));}else{_0x41bdb1[_0xeff8('0x63')]='IS_DISACTIVED';ut['logger'](_0xeff8('0x65'),_0x41bdb1[_0xeff8('0x29')]+_0xeff8('0x67'));}emitCampaignPreview(_0x41bdb1);}}Preview['prototype'][_0xeff8('0x26')]=function(){var _0x2447f0=this;setInterval(function(){_0x2447f0[_0xeff8('0x68')]();},0x7cf);};Preview[_0xeff8('0xe')][_0xeff8('0x68')]=function(){var _0x3b1876=this['campaignsPreview'];this['clockClearZombieChannels']+=0x1;for(var _0x111b3b in _0x3b1876){if(_0x3b1876[_0xeff8('0x69')](_0x111b3b)&&(_0x3b1876[_0x111b3b][_0xeff8('0x35')]===_0xeff8('0x6a')||_0x3b1876[_0x111b3b]['dialMethod']==='booked')&&_0x3b1876[_0x111b3b][_0xeff8('0x27')]===_0xeff8('0x28')){if(this[_0xeff8('0x17')]>0x7){this[_0xeff8('0x17')]=0x0;this['clearZombieChannels']();}}if(_0x3b1876['hasOwnProperty'](_0x111b3b)&&_0x3b1876[_0x111b3b][_0xeff8('0x35')]==='preview'&&_0x3b1876[_0x111b3b][_0xeff8('0x27')]===_0xeff8('0x28')){if(_0x3b1876[_0x111b3b][_0xeff8('0x34')]){this[_0xeff8('0x6b')](_0x3b1876[_0x111b3b]);this[_0xeff8('0x6c')](_0x3b1876[_0x111b3b]);}else{notSendMessagesQueue(_0x3b1876[_0x111b3b]);}}}};Preview[_0xeff8('0xe')]['clearZombieChannel']=function(_0x2c5737){var _0xd2447f=this;this[_0xeff8('0x12')]['enqueue'](function(){if(!_[_0xeff8('0x6d')](_0xd2447f[_0xeff8('0x6e')][_0x2c5737])){loggerAction[_0xeff8('0x5c')]('[clearZombieChannels][talking]',_0x2c5737,_0xeff8('0x6f'),_0xd2447f[_0xeff8('0x6e')][_0x2c5737]['queue'],_0xeff8('0x70'),JSON[_0xeff8('0x59')](_0xd2447f[_0xeff8('0x13')][_0xd2447f[_0xeff8('0x6e')][_0x2c5737][_0xeff8('0x71')]][_0xeff8('0x4f')]),_0xeff8('0x72'),JSON[_0xeff8('0x59')](_0xd2447f[_0xeff8('0x13')][_0xd2447f['actions'][_0x2c5737]['queue']][_0xeff8('0x2d')]),JSON[_0xeff8('0x59')](_0xd2447f[_0xeff8('0x6e')][_0x2c5737][_0xeff8('0x73')]),JSON['stringify'](_[_0xeff8('0x74')](_0xd2447f['actions'][_0x2c5737],[_0xeff8('0x75'),_0xeff8('0x76'),_0xeff8('0x77'),_0xeff8('0x78')])));return ami['Action']({'action':'status','channel':_0xd2447f['actions'][_0x2c5737][_0xeff8('0x79')]})['catch'](function(_0x50008f){if(_0x50008f['message']==='No\x20such\x20channel'){setTimeout(function(){if(_0xd2447f[_0xeff8('0x6e')][_0x2c5737]){ut[_0xeff8('0x7a')](_0xd2447f[_0xeff8('0x13')][_0xd2447f['actions'][_0x2c5737]['queue']],'[clearZombieChannel]');if(_0xd2447f['actions'][_0x2c5737][_0xeff8('0x73')]===!![]){ut[_0xeff8('0x7b')](_0xd2447f[_0xeff8('0x13')][_0xd2447f[_0xeff8('0x6e')][_0x2c5737][_0xeff8('0x71')]],_0xeff8('0x7c'));ut[_0xeff8('0x7d')](_0xeff8('0x7e')+_0x2c5737,_0xd2447f[_0xeff8('0x6e')][_0x2c5737][_0xeff8('0x71')]);}ut[_0xeff8('0x7d')]('[Dialer][checkChannel][Preview]'+_0x2c5737,_0xd2447f[_0xeff8('0x6e')][_0x2c5737]['queue']);delete _0xd2447f[_0xeff8('0x6e')][_0x2c5737];}},0x2328);}});}});};Preview[_0xeff8('0xe')][_0xeff8('0x7f')]=function(){var _0x3c9a09=this;loggerAction['info'](_0xeff8('0x80'),_[_0xeff8('0x81')](this['actions']));for(var _0x2c3292 in this[_0xeff8('0x6e')]){if(_0x3c9a09[_0xeff8('0x6e')]['hasOwnProperty'](_0x2c3292)){_0x3c9a09['clearZombieChannel'](_0x2c3292);}}};Preview[_0xeff8('0xe')][_0xeff8('0x6c')]=function(_0x37338){var _0x324b8a=this;rpcDb['getContactRecallMe'](_0x37338['id'],ut[_0xeff8('0x82')](this['agents']))[_0xeff8('0x83')](function(_0xb0205){if(!_[_0xeff8('0x6d')](_0xb0205)){for(var _0x1455e9=0x0;_0x1455e9<_0xb0205[_0xeff8('0x84')];_0x1455e9+=0x1){if(ut[_0xeff8('0x85')](_0xb0205[_0x1455e9]['scheduledat'])<_0x37338['dialRecallMeTimeout']*0x3c){if(_0xb0205[_0x1455e9][_0xeff8('0x86')]&&!_0xb0205[_0x1455e9][_0xeff8('0x86')][_0xeff8('0x87')]){_0x324b8a[_0xeff8('0x88')](_0xb0205[_0x1455e9]['id'])['then'](ut[_0xeff8('0x89')](_0xeff8('0x8a')))[_0xeff8('0x8b')](ut[_0xeff8('0x89')](_0xeff8('0x8a')));}else{rpcDb['disableContact'](_0xb0205[_0x1455e9]['id']);}}else{var _0x2224ae=new Action(_0xb0205[_0x1455e9],_0x37338);_0x2224ae[_0xeff8('0x8c')]=moment()[_0xeff8('0x5a')](_0xeff8('0x8d'));_0x37338['outboundReCallsDay']+=0x1;ut[_0xeff8('0x8e')](_0x2224ae,0x17,_0xeff8('0x8f'));if(_0x37338[_0xeff8('0x90')]){rpcDb[_0xeff8('0x91')](ut[_0xeff8('0x92')](_0xb0205[_0x1455e9]));rpcDb[_0xeff8('0x93')](_0x2224ae,_0xeff8('0x94'));}else{ut[_0xeff8('0x8e')](_0x2224ae,0x16,_0xeff8('0x95'));rpcDb[_0xeff8('0x93')](_0x2224ae,_0xeff8('0x96'));rpcDb[_0xeff8('0x97')](_0x2224ae,_0xeff8('0x96'));}}}}})[_0xeff8('0x8b')](ut[_0xeff8('0x89')](_0xeff8('0x98')));};Preview[_0xeff8('0xe')][_0xeff8('0x6b')]=function(_0x25a72e){_0x25a72e[_0xeff8('0x61')]=!![];if(ut[_0xeff8('0x99')](_0x25a72e[_0xeff8('0x2c')])){_0x25a72e[_0xeff8('0x63')]=_0xeff8('0x9a');}else if(!ut['isActive'](_0x25a72e[_0xeff8('0x34')])){_0x25a72e['message']=_0xeff8('0x9b');}else if(!this[_0xeff8('0x9c')](_0x25a72e['Trunk'])){if(!this['isTrunkReachable'](_0x25a72e[_0xeff8('0x9d')])){_0x25a72e[_0xeff8('0x63')]=_0xeff8('0x9e');}else{_0x25a72e[_0xeff8('0x63')]='ACTIVE';}}else{_0x25a72e['message']=_0xeff8('0x9f');}emitCampaignPreview(_0x25a72e);};Preview[_0xeff8('0xe')][_0xeff8('0xa0')]=function(_0x27d29f,_0x4a4af7,_0x2f600f){var _0x4bd2b6=this;var _0x4188e8=this[_0xeff8('0x6e')][_0x4a4af7];var _0x192431=this[_0xeff8('0x13')][_0x4188e8[_0xeff8('0x71')]];var _0x1e75bf;if(_0x192431){switch(_0x2f600f){case'1':_0x192431[_0xeff8('0x40')]+=0x1;_0x4188e8[_0xeff8('0xa1')]+=0x1;_0x4188e8['countglobal']=ut['totalGlobal'](_0x4188e8);ut['logCustomer'](_0x4188e8,0x0,_0xeff8('0xa2'));ami[_0xeff8('0x5f')]('custom:agentnosuchnumber',ut[_0xeff8('0xa3')](_0x4188e8,_0xeff8('0xa4')));rpcDb[_0xeff8('0x93')](_0x4188e8,_0xeff8('0xa5'));if(ut['totalGlobal'](_0x4188e8)>=_0x192431[_0xeff8('0xa6')]){_0x1e75bf=ut[_0xeff8('0xa7')](_0x4188e8,0xf,_0xeff8('0xa8'));rpcDb[_0xeff8('0x97')](_0x1e75bf,_0xeff8('0xa9'));}else{if(_0x4188e8[_0xeff8('0xa1')]>=_0x192431[_0xeff8('0xaa')]){rpcDb[_0xeff8('0x97')](_0x4188e8,_0xeff8('0xa9'));}else{rpcDb[_0xeff8('0xab')](ut['scheduledAt'](_0x4188e8,_0xeff8('0xa1'),_0x192431[_0xeff8('0xac')]),_0x4188e8[_0xeff8('0xad')],_0x4188e8[_0xeff8('0xae')]);}}delete this[_0xeff8('0x6e')][_0x27d29f['linkedid']];break;case _0xeff8('0xaf'):var _0x3a1bb6=moment()[_0xeff8('0x5a')](_0xeff8('0x8d'));_0x4188e8[_0xeff8('0xb0')]=_0x3a1bb6;_0x4188e8['answertime']=_0x3a1bb6;_0x4188e8['dialAnswer']=!![];_0x192431[_0xeff8('0x2d')]+=0x1;logger['info'](_0xeff8('0xb1'),_0x4188e8[_0xeff8('0xb2')],'\x20Queue',_0x192431[_0xeff8('0x29')],'pTalking:\x20',_0x192431[_0xeff8('0x2d')]);ami[_0xeff8('0x5f')]('custom:agentconnect',ut[_0xeff8('0xa3')](_0x4188e8,_0xeff8('0xb3'),this[_0xeff8('0x13')][_0x4188e8[_0xeff8('0x71')]]));if(_0x192431['acw']){ami[_0xeff8('0x5f')](_0xeff8('0xb4'),ut['buildAcw'](_0x4188e8));}break;case'16':ami['emit']('custom:agentcomplete',ut[_0xeff8('0xa3')](_0x4188e8,'complete',this[_0xeff8('0x13')][_0x4188e8['queue']]));emitVoiceQueueChannelRemove(ut[_0xeff8('0xa3')](_0x4188e8,_0xeff8('0xb5')));_0x192431['outboundAnswerCallsDay']+=0x1;_0x192431[_0xeff8('0x31')]+=0x1;_0x192431['answered']+=0x1;ut[_0xeff8('0x7b')](_0x192431,_0xeff8('0xb6'));_0x4188e8[_0xeff8('0xb7')]=ut[_0xeff8('0xb8')](_0x4188e8);ut[_0xeff8('0x8e')](_0x4188e8,0x4,_0xeff8('0xb9'));rpcDb['createCustomerHistory'](_0x4188e8,_0xeff8('0xba'));rpcDb[_0xeff8('0x97')](_0x4188e8,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb['crateCustomerReportQueue'](_0x4188e8);_0x192431[_0xeff8('0x2e')]+=_0x4188e8['talktime'];_0x192431[_0xeff8('0xbb')]+=_0x4188e8[_0xeff8('0xbc')];logger[_0xeff8('0x5c')]('[syncHangup][talking][decrement]',_0x4188e8[_0xeff8('0xb2')],_0xeff8('0xbd'),_0x192431[_0xeff8('0x29')],_0xeff8('0x72'),_0x192431[_0xeff8('0x2d')]);delete this[_0xeff8('0x6e')][_0x27d29f[_0xeff8('0xbe')]];break;case _0xeff8('0xbf'):_0x192431[_0xeff8('0xc0')]+=0x1;_0x4188e8['countbusyretry']+=0x1;_0x4188e8[_0xeff8('0xb7')]=ut[_0xeff8('0xb8')](_0x4188e8);ut[_0xeff8('0x8e')](_0x4188e8,0x5,'Busy');ami[_0xeff8('0x5f')](_0xeff8('0xc1'),ut[_0xeff8('0xa3')](_0x4188e8,_0xeff8('0xc2')));rpcDb[_0xeff8('0x93')](_0x4188e8,_0xeff8('0xc3'));if(ut[_0xeff8('0xb8')](_0x4188e8)>=_0x192431[_0xeff8('0xa6')]){_0x1e75bf=ut[_0xeff8('0xa7')](_0x4188e8,0xf,_0xeff8('0xa8'));rpcDb[_0xeff8('0x97')](_0x1e75bf,_0xeff8('0xc4'));}else{if(_0x4188e8['countbusyretry']>=_0x192431[_0xeff8('0xc5')]){rpcDb['createCustomerFinal'](_0x4188e8,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb['rescheduleContact'](ut[_0xeff8('0xc6')](_0x4188e8,_0xeff8('0xc7'),_0x192431['dialBusyRetryFrequency']),_0x4188e8[_0xeff8('0xad')],_0x4188e8['activeContact']);}}break;case _0xeff8('0xc8'):_0x192431[_0xeff8('0xc9')]+=0x1;_0x4188e8['countnoanswerretry']+=0x1;_0x4188e8['countglobal']=ut[_0xeff8('0xb8')](_0x4188e8);ut['logCustomer'](_0x4188e8,0x3,_0xeff8('0xca'));ami[_0xeff8('0x5f')](_0xeff8('0xcb'),ut['buildObj'](_0x4188e8,_0xeff8('0xcc')));rpcDb[_0xeff8('0x93')](_0x4188e8,'[callProgressDetectingCustomer][logNoAnswer]');if(ut[_0xeff8('0xb8')](_0x4188e8)>=_0x192431[_0xeff8('0xa6')]){_0x1e75bf=ut[_0xeff8('0xa7')](_0x4188e8,0xf,'Global');rpcDb[_0xeff8('0x97')](_0x1e75bf,'[callProgressDetectingCustomer][logNoAnswerGlobal]');}else{if(_0x4188e8['countnoanswerretry']>=_0x192431[_0xeff8('0xcd')]){rpcDb[_0xeff8('0x97')](_0x4188e8,_0xeff8('0xce'));}else{rpcDb[_0xeff8('0xab')](ut[_0xeff8('0xc6')](_0x4188e8,_0xeff8('0xcf'),_0x192431[_0xeff8('0xd0')]),_0x4188e8[_0xeff8('0xad')],_0x4188e8[_0xeff8('0xae')]);}}break;case'CONGESTION':_0x192431['outboundCongestionCallsDay']+=0x1;_0x4188e8['countcongestionretry']+=0x1;_0x4188e8[_0xeff8('0xb7')]=ut[_0xeff8('0xb8')](_0x4188e8);ut[_0xeff8('0x8e')](_0x4188e8,0x8,_0xeff8('0xd1'));ami[_0xeff8('0x5f')](_0xeff8('0xd2'),ut[_0xeff8('0xa3')](_0x4188e8,_0xeff8('0xd3')));rpcDb[_0xeff8('0x93')](_0x4188e8,_0xeff8('0xd4'));if(ut[_0xeff8('0xb8')](_0x4188e8)>=_0x192431[_0xeff8('0xa6')]){_0x1e75bf=ut[_0xeff8('0xa7')](_0x4188e8,0xf,'Global');rpcDb[_0xeff8('0x97')](_0x1e75bf,_0xeff8('0xd5'));}else{if(_0x4188e8[_0xeff8('0xd6')]>=_0x192431[_0xeff8('0xd7')]){rpcDb['createCustomerFinal'](_0x4188e8,_0xeff8('0xd4'));}else{rpcDb[_0xeff8('0xab')](ut[_0xeff8('0xc6')](_0x4188e8,_0xeff8('0xd6'),_0x192431[_0xeff8('0xd8')]),_0x4188e8[_0xeff8('0xad')],_0x4188e8['activeContact']);}}break;case'CANCEL':_0x192431[_0xeff8('0xd9')]+=0x1;_0x4188e8[_0xeff8('0xda')]+=0x1;_0x4188e8['countglobal']=ut[_0xeff8('0xb8')](_0x4188e8);ut[_0xeff8('0x8e')](_0x4188e8,0x14,'AgentReject');ami[_0xeff8('0x5f')](_0xeff8('0xdb'),ut['buildObj'](_0x4188e8,_0xeff8('0xdc')));rpcDb[_0xeff8('0x93')](_0x4188e8,_0xeff8('0xdd'));if(ut['totalGlobal'](_0x4188e8)>=_0x192431[_0xeff8('0xa6')]){_0x1e75bf=ut[_0xeff8('0xa7')](_0x4188e8,0x14,'AgentReject');rpcDb['createCustomerFinal'](_0x1e75bf,_0xeff8('0xde'));}else{if(_0x4188e8['countagentrejectretry']>=_0x192431[_0xeff8('0xdf')]){rpcDb[_0xeff8('0x97')](_0x4188e8,_0xeff8('0xde'));}else{rpcDb[_0xeff8('0xab')](ut['scheduledAt'](_0x4188e8,_0xeff8('0xda'),_0x192431['dialAgentRejectRetryFrequency']),_0x4188e8[_0xeff8('0xad')],_0x4188e8[_0xeff8('0xae')]);}}break;case _0xeff8('0xe0'):_0x192431['outboundAbandonedCallsDay']+=0x1;_0x4188e8[_0xeff8('0xe1')]+=0x1;_0x4188e8[_0xeff8('0xb7')]=ut[_0xeff8('0xb8')](_0x4188e8);ut['logCustomer'](_0x4188e8,0xb,_0xeff8('0xe2'));rpcDb['createCustomerHistory'](_0x4188e8,_0xeff8('0xe3'));if(ut[_0xeff8('0xb8')](_0x4188e8)>=_0x192431[_0xeff8('0xa6')]){_0x1e75bf=ut[_0xeff8('0xa7')](_0x4188e8,0xf,_0xeff8('0xa8'));rpcDb[_0xeff8('0x97')](_0x1e75bf,_0xeff8('0xe3'));}else{if(_0x4188e8[_0xeff8('0xe4')]>=_0x192431['dialAbandonedMaxRety']){rpcDb[_0xeff8('0x97')](_0x4188e8,'[callProgressDetectingCustomer][logAbandoned]');}else{rpcDb[_0xeff8('0xab')](ut[_0xeff8('0xc6')](_0x4188e8,_0xeff8('0xe1'),_0x192431[_0xeff8('0xe5')]),_0x4188e8[_0xeff8('0xad')],_0x4188e8['activeContact']);}}break;case'18':_0x192431[_0xeff8('0x43')]+=0x1;_0x4188e8[_0xeff8('0xe6')]+=0x1;_0x4188e8[_0xeff8('0xb7')]=ut[_0xeff8('0xb8')](_0x4188e8);ut[_0xeff8('0x8e')](_0x4188e8,0x12,_0x27d29f[_0xeff8('0xe7')]||_0x27d29f[_0xeff8('0xe8')]);ami['emit'](_0xeff8('0xe9'),ut[_0xeff8('0xa3')](_0x4188e8,_0xeff8('0xea')));rpcDb[_0xeff8('0x93')](_0x4188e8,'[callProgressDetectingCustomer][hangupInAMD]');if(ut[_0xeff8('0xb8')](_0x4188e8)>=_0x192431[_0xeff8('0xa6')]){_0x1e75bf=ut[_0xeff8('0xa7')](_0x4188e8,0xf,_0xeff8('0xa8'));rpcDb[_0xeff8('0x97')](_0x1e75bf,_0xeff8('0xeb'));}else{rpcDb[_0xeff8('0x97')](_0x4188e8,_0xeff8('0xeb'));}delete this['actions'][_0x27d29f[_0xeff8('0xbe')]];break;case'19':_0x192431[_0xeff8('0x43')]+=0x1;_0x4188e8[_0xeff8('0xb7')]=ut[_0xeff8('0xb8')](_0x4188e8);ut['logCustomer'](_0x4188e8,0x13,_0x27d29f[_0xeff8('0xe7')]||_0x27d29f[_0xeff8('0xe8')]);ami[_0xeff8('0x5f')](_0xeff8('0xe9'),ut[_0xeff8('0xa3')](_0x4188e8,_0xeff8('0xea')));rpcDb[_0xeff8('0x93')](_0x4188e8,_0xeff8('0xec'));if(ut[_0xeff8('0xb8')](_0x4188e8)>=_0x192431[_0xeff8('0xa6')]){_0x1e75bf=ut[_0xeff8('0xa7')](_0x4188e8,0xf,'Global');rpcDb['createCustomerFinal'](_0x1e75bf,_0xeff8('0xec'));}else{rpcDb['createCustomerFinal'](_0x4188e8,_0xeff8('0xec'));}delete this[_0xeff8('0x6e')][_0x27d29f['linkedid']];break;default:if(_0x4188e8['dialAnswer']){ut[_0xeff8('0x7b')](_0x192431,'[default]');ut['loggerError'](_0xeff8('0xed')+_0x192431[_0xeff8('0x29')],_0x27d29f);}_0x192431[_0xeff8('0x43')]+=0x1;_0x4188e8[_0xeff8('0xb7')]=ut['totalGlobal'](_0x4188e8);ut[_0xeff8('0x8e')](_0x4188e8,0xc,_0x27d29f[_0xeff8('0xe7')]||_0x27d29f['dialstatus']);rpcDb[_0xeff8('0x93')](_0x4188e8,_0xeff8('0xee'));if(ut['totalGlobal'](_0x4188e8)>=_0x192431[_0xeff8('0xa6')]){_0x1e75bf=ut[_0xeff8('0xa7')](_0x4188e8,0xf,_0xeff8('0xa8'));rpcDb['createCustomerFinal'](_0x1e75bf,_0xeff8('0xef'));}else{rpcDb['createCustomerFinal'](_0x4188e8,'[callProgressDetectingCustomer][logUnknownGlobal]');}delete this['actions'][_0x27d29f[_0xeff8('0xbe')]];}if(!(_0x4188e8[_0xeff8('0x73')]&&_0x2f600f==='16')){ut['updateOriginated'](_0x192431,_0xeff8('0xf0'));logger['info'](_0xeff8('0xf1'),_0x4188e8[_0xeff8('0xb2')],_0xeff8('0xbd'),_0x192431[_0xeff8('0x29')],'originated:\x20',_0x192431[_0xeff8('0x4f')]);}if(_0x2f600f!==_0xeff8('0xaf')){delete this['actions'][_0x27d29f[_0xeff8('0xbe')]];delete this[_0xeff8('0x6e')][_0x27d29f[_0xeff8('0xf2')]];}}};Preview[_0xeff8('0xe')][_0xeff8('0xf3')]=function(_0xc87d0a,_0x309b2c,_0x478505){if(_[_0xeff8('0xf4')](_0x309b2c)&&'object'!==typeof _0x309b2c){return;}if(_[_0xeff8('0xf4')](_0x478505)&&_0xeff8('0xf5')!==typeof _0x478505){return;}switch(_0x478505[_0xeff8('0xf6')]){case'0':ut[_0xeff8('0xf7')](_0xc87d0a,0x0,_0xeff8('0xa2'));rpcDb[_0xeff8('0xf8')](_0xc87d0a,_0xeff8('0xf9'));break;case'3':ut[_0xeff8('0xf7')](_0xc87d0a,0x3,_0xeff8('0xca'));rpcDb[_0xeff8('0xf8')](_0xc87d0a,_0xeff8('0xfa'));break;case'5':ut[_0xeff8('0xf7')](_0xc87d0a,0x5,_0xeff8('0xfb'));rpcDb[_0xeff8('0xf8')](_0xc87d0a,'[callProgressDetectingAgent][logBusy]');break;case'8':ut['logAgent'](_0xc87d0a,0x8,_0xeff8('0xd1'));rpcDb[_0xeff8('0xf8')](_0xc87d0a,'[callProgressDetectingAgent][logCongestion]');break;case'22':ut[_0xeff8('0xf7')](_0xc87d0a,0x16,_0xeff8('0xfc'));rpcDb[_0xeff8('0xf8')](_0xc87d0a,'[callProgressDetectingAgent][logAnswerAGI]');break;default:ut['logAgent'](_0xc87d0a,0xc,_0x478505[_0xeff8('0xf6')]);rpcDb[_0xeff8('0xf8')](_0xc87d0a,'[callProgressDetectingAgent][logCongestion]');}ut[_0xeff8('0x7a')](_0x309b2c,_0xeff8('0xfd'));logger['info'](_0xeff8('0xfe'),_0xc87d0a['uniqueid'],_0xeff8('0xbd'),_0x309b2c[_0xeff8('0x29')],_0xeff8('0x70'),_0x309b2c[_0xeff8('0x4f')]);delete this[_0xeff8('0x6e')][_0xc87d0a['uniqueid']];};Preview[_0xeff8('0xe')][_0xeff8('0xff')]=function(_0x130d51,_0x350877,_0x2a3923,_0x1470d9,_0xa9161b){var _0x14284b=this;return new BPromise(function(_0x370d3f,_0x4449ef){if(_[_0xeff8('0x6d')](_0x350877)||_['isNil'](_0x350877[_0xeff8('0x100')])||_[_0xeff8('0x6d')](_0x350877[_0xeff8('0x100')]['phone'])||_[_0xeff8('0x6d')](_0x350877['VoiceQueueId'])){_0x4449ef(ut[_0xeff8('0x63')](_0xeff8('0x101'),_0x1470d9,_0xa9161b));return;}var _0x97d74=uuid['v4']();var _0x138a45=_0x14284b[_0xeff8('0x13')][_0x350877[_0xeff8('0x6f')][_0xeff8('0x29')]];var _0x813213=_0x2a3923?_0x14284b[_0xeff8('0x16')][_0x2a3923]['id']:undefined;_0x14284b[_0xeff8('0x6e')][_0x97d74]=new Action(_0x350877,_0x138a45,_0x97d74,_0x2a3923,_0x813213);var _0x13dd76=_0x14284b[_0xeff8('0x6e')][_0x97d74];_0x13dd76[_0xeff8('0xad')]=_0x1470d9;_0x13dd76[_0xeff8('0xae')]=_0xa9161b;_0x13dd76[_0xeff8('0x102')]=_0x2a3923;if(_['isEmpty'](_0x130d51)){_0x14284b[_0xeff8('0x103')](_0x13dd76,_0x138a45,_0x350877,_0x2a3923)[_0xeff8('0x83')](function(_0x2ae5b1){logger[_0xeff8('0x5c')](_0xeff8('0x104'),_0xeff8('0x105')+_0x13dd76[_0xeff8('0x71')]+'\x20IdHopper:\x20'+_0x13dd76[_0xeff8('0x106')],JSON[_0xeff8('0x59')](_0x2ae5b1));ami['emit'](_0xeff8('0x107'),ut['buildObj'](_0x13dd76,'called',_0x14284b[_0xeff8('0x13')][_0x13dd76[_0xeff8('0x71')]]));_0x370d3f(ut[_0xeff8('0x63')](_0xeff8('0x108')));})['catch'](function(_0x1ac2c0){ut['logger']('[Preview][execCall][failure]',_0x1ac2c0);_0x4449ef(ut[_0xeff8('0x63')](_0xeff8('0x109'),_0x1470d9,_0xa9161b));});}else{_0x138a45[_0xeff8('0x3c')]+=0x1;ut[_0xeff8('0x10a')](_0x13dd76);rpcDb[_0xeff8('0x10b')](_0x13dd76,'[Blacklist][error]');delete _0x14284b[_0xeff8('0x6e')][_0x97d74];_0x4449ef(ut[_0xeff8('0x63')](_0xeff8('0x10c'),_0x1470d9,_0xa9161b));}});};Preview[_0xeff8('0xe')][_0xeff8('0x9c')]=function(_0x4bcfa0){return!_[_0xeff8('0x6d')](_0x4bcfa0)&&!_[_0xeff8('0x6d')](_0x4bcfa0[_0xeff8('0x29')])&&!_['isNil'](_0x4bcfa0[_0xeff8('0x56')])&&_0x4bcfa0[_0xeff8('0x56')]&&!_[_0xeff8('0x6d')](this['trunks'][util[_0xeff8('0x5a')](_0xeff8('0x10d'),_0x4bcfa0['name'])])&&!_[_0xeff8('0x6d')](this[_0xeff8('0x15')][util[_0xeff8('0x5a')](_0xeff8('0x10d'),_0x4bcfa0['name'])][_0xeff8('0x10e')])&&(this[_0xeff8('0x15')][util['format'](_0xeff8('0x10d'),_0x4bcfa0['name'])][_0xeff8('0x10e')]===_0xeff8('0x10f')||this[_0xeff8('0x15')][util[_0xeff8('0x5a')](_0xeff8('0x10d'),_0x4bcfa0[_0xeff8('0x29')])]['status']===_0xeff8('0x110'));};Preview[_0xeff8('0xe')]['run']=function(_0x5d1cbf,_0x13a1ea){var _0x58bd9f=this;return new BPromise(function(_0x3ad085,_0x157d48){_0x58bd9f[_0xeff8('0x111')](_0x5d1cbf,_0x13a1ea)[_0xeff8('0x83')](function(_0x235648){_0x3ad085(_['pick'](_0x235648,['message']));})['catch'](function(_0x5622f5){if(_0x5622f5[_0xeff8('0x112')]){rpcDb['unlockContact'](_0x5d1cbf);}if(_0x5622f5[_0xeff8('0x56')]){rpcDb[_0xeff8('0x113')](_0x5d1cbf);}_0x157d48(_[_0xeff8('0x74')](_0x5622f5,[_0xeff8('0x63')]));});});};Preview[_0xeff8('0xe')][_0xeff8('0x111')]=function(_0x3ab9e2,_0x4d21dc){var _0x23523f=this;return new BPromise(function(_0x1ee2d9,_0x8d21e4){var _0x50d790,_0x534b21;rpcDb[_0xeff8('0x114')](_0x3ab9e2)['then'](function(_0x1414b4){if(!_['isNil'](_0x1414b4[0x0])){_0x534b21=_0x1414b4[0x0]['recallme']?![]:!![];_0x50d790=_0x1414b4[0x0][_0xeff8('0x115')]?!![]:![];_0x50d790=_0x4d21dc?!![]:_0x50d790;}var _0x332d54=_0x23523f[_0xeff8('0x116')](_0x1414b4);if(_0x332d54[_0xeff8('0x117')]){rpcDb[_0xeff8('0x118')](_[_0xeff8('0x74')](_0x1414b4[0x0],['VoiceQueueId','Contact.phone']))['then'](function(_0x2ba772){_0x23523f['checkInBlack'](_0x2ba772,_0x1414b4[0x0],_0x4d21dc,_0x534b21,_0x50d790)[_0xeff8('0x83')](function(_0x2a0b09){_0x1ee2d9(_0x2a0b09);})[_0xeff8('0x8b')](function(_0x4056eb){_0x8d21e4(_0x4056eb);});})[_0xeff8('0x8b')](function(_0x7be0f8){ut[_0xeff8('0x64')](_0xeff8('0x119'),_0x7be0f8);_0x8d21e4(ut[_0xeff8('0x63')](_0xeff8('0x11a'),_0x534b21,_0x50d790));});}else{_0x8d21e4(ut[_0xeff8('0x63')](_0x332d54[_0xeff8('0x63')],_0x534b21,_0x50d790));}})[_0xeff8('0x8b')](function(_0x39cacd){ut[_0xeff8('0x64')](_0xeff8('0x11b'),_0x39cacd);_0x8d21e4(ut[_0xeff8('0x63')](_0xeff8('0x11a'),![],!![]));});});};Preview[_0xeff8('0xe')][_0xeff8('0x116')]=function(_0x39677f){if(_[_0xeff8('0x6d')](_0x39677f)||_[_0xeff8('0x11c')](_0x39677f)||!_[_0xeff8('0x6d')](_0x39677f[0x0][_0xeff8('0x86')])&&_[_0xeff8('0x6d')](_0x39677f[0x0][_0xeff8('0x86')][_0xeff8('0x29')])){ut[_0xeff8('0x64')](_0xeff8('0x11d'),_0x39677f);return{'isValid':![],'message':_0xeff8('0x11e')};}var _0x1b26c4=this[_0xeff8('0x13')][_0x39677f[0x0]['Queue']['name']];_0x1b26c4[_0xeff8('0x63')]=_0xeff8('0x9f');if(_[_0xeff8('0x6d')](_0x1b26c4)){ut['logger']('[Preview][validateContact][Empty\x20Campaign]',_0x1b26c4);return{'isValid':![],'message':_0xeff8('0x11f')};}if(!this[_0xeff8('0x9c')](_0x1b26c4[_0xeff8('0x55')])){ut[_0xeff8('0x64')](_0xeff8('0x120'),'campaign\x20Name:\x20'+_0x1b26c4['name']+'\x20Trunk\x20is\x20not\x20active');if(!this[_0xeff8('0x9c')](_0x1b26c4[_0xeff8('0x9d')])){ut['logger']('[Preview][validateContact][Trunk\x20not\x20work]',_0x1b26c4['name']+_0xeff8('0x121'));return{'isValid':![],'message':_0xeff8('0x122')};}}if(!ut[_0xeff8('0x123')](_0x1b26c4[_0xeff8('0x34')])){ut[_0xeff8('0x64')](_0xeff8('0x124'),_0x1b26c4['name']+_0xeff8('0x125'));return{'isValid':![],'message':_0xeff8('0x126')+_0x1b26c4[_0xeff8('0x29')]+_0xeff8('0x125')};}return{'isValid':!![],'message':_0xeff8('0x127')};};Preview[_0xeff8('0xe')]['execCall']=function(_0x41dd47,_0x40da3f,_0x2e68f7,_0x5475c1){var _0x278f91=this;return new BPromise(function(_0x57ed3f,_0x3509fe){var _0x2b80d4=_0x41dd47[_0xeff8('0xb2')];var _0x5c80c7=_0x278f91[_0xeff8('0x9c')](_0x40da3f[_0xeff8('0x55')])?util['format'](_0xeff8('0x128'),_0x40da3f[_0xeff8('0x55')]['name'],_[_0xeff8('0x6d')](_0x40da3f['dialPrefix'])?'':_0x40da3f[_0xeff8('0x39')]['trim']()||'',_0x40da3f[_0xeff8('0x129')]>0x0?_0x2e68f7['Contact'][_0xeff8('0x12a')][_0xeff8('0x12b')](_0x40da3f[_0xeff8('0x129')]):_0x2e68f7[_0xeff8('0x100')]['phone']):util[_0xeff8('0x5a')](_0xeff8('0x128'),_['isNil'](_0x40da3f['TrunkBackup'])?_0x40da3f[_0xeff8('0x55')][_0xeff8('0x29')]:_0x40da3f[_0xeff8('0x9d')][_0xeff8('0x29')],_[_0xeff8('0x6d')](_0x40da3f['dialPrefix'])?'':_0x40da3f[_0xeff8('0x39')][_0xeff8('0x12c')]()||'',_0x40da3f[_0xeff8('0x129')]>0x0?_0x2e68f7['Contact']['phone'][_0xeff8('0x12b')](_0x40da3f[_0xeff8('0x129')]):_0x2e68f7[_0xeff8('0x100')][_0xeff8('0x12a')]);var _0x8a1236=_0x278f91[_0xeff8('0x9c')](_0x40da3f[_0xeff8('0x55')])?ut[_0xeff8('0x12d')](_0x40da3f[_0xeff8('0x55')][_0xeff8('0x57')],_0x40da3f[_0xeff8('0x36')],_0x40da3f['dialRandomLastDigitCallerIdNumber']>0x0?ut[_0xeff8('0x12e')](_0x40da3f[_0xeff8('0x37')],_0x40da3f[_0xeff8('0x12f')]):_0x40da3f['dialOriginateCallerIdNumber']):ut[_0xeff8('0x12d')](_[_0xeff8('0x6d')](_0x40da3f[_0xeff8('0x9d')])?_0x40da3f[_0xeff8('0x55')]['callerid']:_0x40da3f[_0xeff8('0x9d')][_0xeff8('0x57')],_0x40da3f['dialOriginateCallerIdName'],_0x40da3f['dialRandomLastDigitCallerIdNumber']>0x0?ut['getCallerIdRandom'](_0x40da3f['dialOriginateCallerIdNumber'],_0x40da3f[_0xeff8('0x12f')]):_0x40da3f[_0xeff8('0x37')]);if(_0x8a1236){_0x41dd47[_0xeff8('0x130')]=ut[_0xeff8('0x131')](_0x8a1236);_0x41dd47[_0xeff8('0x132')]=ut[_0xeff8('0x133')](_0x8a1236);}var _0xb99848=ut['addVariables'](_0x40da3f,_0x2e68f7,_0x5c80c7,_0x8a1236,_0x2b80d4,_0x41dd47);_['merge'](_0x41dd47,ut[_0xeff8('0x134')](_0xb99848));_0x41dd47[_0xeff8('0x8c')]=moment()['format'](_0xeff8('0x8d'));ami[_0xeff8('0x135')](ut[_0xeff8('0x136')](_0x41dd47,_0x40da3f,_0xb99848,_0x41dd47['activeContact'],_0x5475c1))[_0xeff8('0x83')](function(_0x3dc505){_0x40da3f[_0xeff8('0x4f')]+=0x1;logger[_0xeff8('0x5c')](_0xeff8('0x137'),_0x2b80d4,_0xeff8('0xbd'),_0x40da3f[_0xeff8('0x29')],_0xeff8('0x70'),_0x40da3f['originated']);_0x57ed3f(_0x3dc505);})[_0xeff8('0x8b')](function(_0x193d4d){ut[_0xeff8('0xf7')](_0x41dd47,0xe,_0xeff8('0x138'));rpcDb['createAgentHistory'](_0x41dd47,'[originateFailure][logOriginateFailure]');_0x3509fe(_0x193d4d);});});};Preview[_0xeff8('0xe')]['syncNewExten']=function(_0x5399e7){if(this[_0xeff8('0x6e')][_0x5399e7[_0xeff8('0xbe')]]){this['actions'][_0x5399e7[_0xeff8('0xbe')]]['channel']=_0x5399e7[_0xeff8('0x79')];}};Preview[_0xeff8('0xe')]['syncOriginateResponse']=function(_0x3debee){var _0x5dc76f=this;var _0x557886=this[_0xeff8('0x6e')][_0x3debee['actionid']];if(_0x557886){if(_0x557886[_0xeff8('0x102')]&&this[_0xeff8('0x16')][_0x557886[_0xeff8('0x102')]]){ut[_0xeff8('0x139')](_0x557886,this[_0xeff8('0x16')][_0x557886['lookAgent']][_0xeff8('0x29')],this[_0xeff8('0x16')][_0x557886[_0xeff8('0x102')]]['id']);}var _0x38f4ff=_[_0xeff8('0x13a')](_0x557886);_0x38f4ff[_0xeff8('0xb0')]=moment()[_0xeff8('0x5a')](_0xeff8('0x8d'));var _0x2d565d=_0x5dc76f[_0xeff8('0x13')][_0x557886['queue']];if(ut['isFailure'](_0x3debee[_0xeff8('0x13b')])){if(_0x557886[_0xeff8('0xad')]){rpcDb['unlockContact'](_0x557886['idContact']);}if(_0x557886[_0xeff8('0xae')]){rpcDb[_0xeff8('0x113')](_0x557886[_0xeff8('0x106')]);}ami[_0xeff8('0x5f')]('custom:agentringnoanswer',ut[_0xeff8('0xa3')](_0x557886,_0xeff8('0x13c'),this[_0xeff8('0x13')][_0x557886[_0xeff8('0x71')]]));this[_0xeff8('0xf3')](_0x38f4ff,_0x2d565d,_0x3debee);}else{_0x557886[_0xeff8('0x8c')]=moment()[_0xeff8('0x5a')](_0xeff8('0x8d'));ut['logAgent'](_0x38f4ff,0x4,_0xeff8('0xb9'));rpcDb['createAgentHistory'](_0x38f4ff,_0xeff8('0x13d'));}}};Preview[_0xeff8('0xe')][_0xeff8('0x13e')]=function(_0x37df37){var _0x42e818=this;var _0x2902c2=this['actions'][_0x37df37[_0xeff8('0xbe')]];var _0x33ddde;if(_0x2902c2){_0x33ddde=this[_0xeff8('0x13')][_0x2902c2[_0xeff8('0x71')]];logger[_0xeff8('0x5c')](_0xeff8('0x13f'),_0x37df37[_0xeff8('0xbe')],'\x20Queue',_0x33ddde['name'],_0xeff8('0x72'),_0x33ddde[_0xeff8('0x2d')]);}if(this[_0xeff8('0x6e')][_0x37df37[_0xeff8('0xbe')]]&&_0x37df37[_0xeff8('0xbe')]!==_0x37df37[_0xeff8('0xb2')]){if(_0x37df37[_0xeff8('0x140')]==='16'&&this[_0xeff8('0x6e')][_0x37df37[_0xeff8('0xbe')]][_0xeff8('0x73')]){this[_0xeff8('0xa0')](_0x37df37,_0x37df37[_0xeff8('0xbe')],_0x37df37[_0xeff8('0x140')]);}else if(this[_0xeff8('0x6e')][_0x37df37['linkedid']][_0xeff8('0x73')]){logger[_0xeff8('0x5c')](_0xeff8('0x141'),_0x37df37[_0xeff8('0xbe')],_0x37df37[_0xeff8('0x140')],_0xeff8('0xbd'),_0x33ddde['name'],'pTalking:\x20',_0x33ddde[_0xeff8('0x2d')]);this[_0xeff8('0xa0')](_0x37df37,_0x37df37[_0xeff8('0xbe')],_0x37df37['cause']);}}else if(_0x2902c2&&_['isNil'](_0x2902c2[_0xeff8('0x142')])&&_0x33ddde['dialQueueProject']&&_0x37df37[_0xeff8('0xbe')]===_0x37df37[_0xeff8('0xb2')]&&_[_0xeff8('0x6d')](_0x37df37[_0xeff8('0xf6')])&&_0x37df37[_0xeff8('0x140')]==='16'&&_0x37df37['channelstate']==='6'&&_['isUndefined'](_0x2902c2[_0xeff8('0x143')])){if(_0x2902c2[_0xeff8('0xad')]){rpcDb['unlockContact'](_0x2902c2[_0xeff8('0x106')]);}if(_0x2902c2['activeContact']){rpcDb[_0xeff8('0x113')](_0x2902c2[_0xeff8('0x106')]);}_0x37df37[_0xeff8('0xf6')]='22';this[_0xeff8('0xf3')](_0x2902c2,_0x33ddde,_0x37df37);}else if(_0x2902c2&&_0x2902c2[_0xeff8('0x143')]){if(_0x37df37[_0xeff8('0x140')]==='16'&&this[_0xeff8('0x6e')][_0x37df37[_0xeff8('0xbe')]]['dialAnswer']){logger['info']('[syncHangup][talking][transfer]',_0x37df37[_0xeff8('0xbe')],_0x37df37[_0xeff8('0x140')],'\x20Queue',_0x33ddde[_0xeff8('0x29')],'pTalking:\x20',_0x33ddde['pTalking']);this[_0xeff8('0xa0')](_0x37df37,_0x37df37[_0xeff8('0xbe')],_0x37df37[_0xeff8('0x140')]);}else if(this['actions'][_0x37df37['linkedid']]['dialAnswer']){logger[_0xeff8('0x5c')]('[syncHangup][talking][cause]',_0x37df37[_0xeff8('0xbe')],_0x37df37[_0xeff8('0x140')],'\x20Queue',_0x33ddde[_0xeff8('0x29')],_0xeff8('0x72'),_0x33ddde[_0xeff8('0x2d')]);this['callProgressDetectingCustomer'](_0x37df37,_0x37df37[_0xeff8('0xbe')],_0x37df37[_0xeff8('0x140')]);}}};Preview[_0xeff8('0xe')][_0xeff8('0x1e')]=function(_0x471551){if(this['actions'][_0x471551[_0xeff8('0xf2')]]&&_0x471551['destlinkedid']!==_0x471551[_0xeff8('0x144')]){this[_0xeff8('0xa0')](_0x471551,_0x471551[_0xeff8('0xf2')],_0x471551[_0xeff8('0xe8')]);}};Preview[_0xeff8('0xe')][_0xeff8('0x1c')]=function(_0x209afc){if(this[_0xeff8('0x6e')][_0x209afc['linkedid']]&&_0x209afc[_0xeff8('0xbe')]!==_0x209afc['uniqueid']&&!this['actions'][_0x209afc[_0xeff8('0xbe')]][_0xeff8('0x73')]){if(_0x209afc['cause']==='1'){this[_0xeff8('0xa0')](_0x209afc,_0x209afc[_0xeff8('0xbe')],_0x209afc['cause']);}}};Preview['prototype'][_0xeff8('0x145')]=function(_0x39a4fd,_0x8d5eff,_0x5341b1){if(this['actions'][_0x39a4fd]){if(_[_0xeff8('0x6d')](this[_0xeff8('0x6e')][_0x39a4fd][_0xeff8('0x146')])){this[_0xeff8('0x6e')][_0x39a4fd]['variables']={};}this['actions'][_0x39a4fd][_0xeff8('0x146')][_0x8d5eff]=_0x5341b1;}};Preview['prototype'][_0xeff8('0x22')]=function(_0x19f25c){try{if(!_[_0xeff8('0x6d')](_0x19f25c)){if(ut[_0xeff8('0x147')](_[_0xeff8('0x148')](_0x19f25c[_0xeff8('0x149')])[0x0])){this['addVariable'](_0x19f25c[_0xeff8('0xb2')],_['keys'](_0x19f25c[_0xeff8('0x149')])[0x0],_0x19f25c[_0xeff8('0x14a')]);}}}catch(_0x141fa9){logger[_0xeff8('0x14b')](_0xeff8('0x14c'),util[_0xeff8('0x14d')](_0x141fa9,{'showHidden':![],'depth':null}));}};Preview[_0xeff8('0xe')][_0xeff8('0x14e')]=function(_0x562a9f){if(_0x562a9f){if(this[_0xeff8('0x6e')][_0x562a9f[_0xeff8('0x14f')]]){this[_0xeff8('0x6e')][_0x562a9f[_0xeff8('0x14f')]]['transfer']=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x1ced42){if(_0x1ced42){if(this[_0xeff8('0x6e')][_0x1ced42[_0xeff8('0x150')]]){this[_0xeff8('0x6e')][_0x1ced42[_0xeff8('0x150')]]['transfer']=!![];}}};module[_0xeff8('0x151')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index bd4f5ed..893ddb8 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 _0xf57c=['../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/agentReportPreview','error','inspect','resolve','then','catch','[createHistory]\x20','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','[getContactPreview]\x20','createAgentHistory','createCustomerFinal','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','endtime','connectedlinename','context','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','membername','queuecallerexitreason','COMPLETED','create','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','lodash'];(function(_0x367e5b,_0x5721e4){var _0x4b909e=function(_0x22c6a4){while(--_0x22c6a4){_0x367e5b['push'](_0x367e5b['shift']());}};_0x4b909e(++_0x5721e4);}(_0xf57c,0x75));var _0xcf57=function(_0x4f847a,_0x33c2d8){_0x4f847a=_0x4f847a-0x0;var _0x29931e=_0xf57c[_0x4f847a];return _0x29931e;};'use strict';var util=require(_0xcf57('0x0'));var BPromise=require(_0xcf57('0x1'));var logger=require(_0xcf57('0x2'))(_0xcf57('0x3'));var _=require(_0xcf57('0x4'));var cmHopper=require(_0xcf57('0x5'));var cmHopperFinal=require(_0xcf57('0x6'));var cmHopperHistory=require(_0xcf57('0x7'));var cmHopperBlack=require(_0xcf57('0x8'));var voiceQueueRt=require('../rpc/voiceQueueRt');var agentReportPreview=require(_0xcf57('0x9'));var voiceQueueReport=require('../rpc/voiceQueueReport');function loggerCatch(_0x2559ee){return function(_0x4b87d1){logger[_0xcf57('0xa')](_0x2559ee,util[_0xcf57('0xb')](_0x4b87d1,{'showHidden':![],'depth':null}));};}function create(_0x835086){return BPromise[_0xcf57('0xc')]()[_0xcf57('0xd')](cmHopperHistory['createHistory'](_0x835086))[_0xcf57('0xe')](loggerCatch(_0xcf57('0xf')));}function createAgent(_0x5eaf75){return BPromise['resolve']()['then'](agentReportPreview[_0xcf57('0x10')](_0x5eaf75))[_0xcf57('0xe')](loggerCatch(_0xcf57('0xf')));}function moveContact(_0x18fc10){return BPromise[_0xcf57('0xc')]()[_0xcf57('0xd')](cmHopper[_0xcf57('0x11')](_0x18fc10,!![]))['catch'](loggerCatch(_0xcf57('0x12')));}exports[_0xcf57('0x13')]=function(_0x39622c){return BPromise[_0xcf57('0xc')]()['then'](cmHopperBlack[_0xcf57('0x13')](_0x39622c))[_0xcf57('0xe')](loggerCatch(_0xcf57('0x14')));};exports[_0xcf57('0x15')]=function(_0x105c5f){return BPromise[_0xcf57('0xc')]()['then'](cmHopper['getContactPreview'](_0x105c5f))[_0xcf57('0xe')](loggerCatch(_0xcf57('0x16')));};exports[_0xcf57('0x10')]=function(_0x525321,_0x142f50){create(_0x525321)[_0xcf57('0xe')](loggerCatch(_0x142f50));moveContact(_0x525321)[_0xcf57('0xe')](loggerCatch(_0x142f50));};exports[_0xcf57('0x17')]=function(_0x5b93fd,_0x25c613){createAgent(_0x5b93fd)['catch'](loggerCatch(_0x25c613));};exports['createCustomerHistory']=function(_0x442f00,_0x92a2e8){create(_0x442f00)[_0xcf57('0xe')](loggerCatch(_0x92a2e8));};exports[_0xcf57('0x18')]=function(_0x598dbc,_0x2d51aa){moveContact(_0x598dbc)['catch'](loggerCatch(_0x2d51aa));};exports[_0xcf57('0x19')]=function(_0x402766,_0x1613d6,_0x59ab43){if(_0x1613d6){_0x402766[_0xcf57('0x1a')]=null;}if(_0x59ab43){_0x402766[_0xcf57('0x1b')]=![];}return BPromise[_0xcf57('0xc')]()[_0xcf57('0xd')](cmHopper[_0xcf57('0x19')](_0x402766))[_0xcf57('0xe')](loggerCatch(_0xcf57('0x1c')));};exports['countReScheduled']=function(_0x1856a9){return BPromise[_0xcf57('0xc')]()[_0xcf57('0xd')](cmHopper[_0xcf57('0x1d')](_0x1856a9))['catch'](loggerCatch(_0xcf57('0x1e')));};exports[_0xcf57('0x1f')]=function(_0x427221){return BPromise[_0xcf57('0xc')]()['then'](cmHopper[_0xcf57('0x1f')]({'UserId':null},_0x427221,0x1))[_0xcf57('0xe')](loggerCatch(_0xcf57('0x20')));};exports[_0xcf57('0x21')]=function(_0x39c03d){return BPromise['resolve']()[_0xcf57('0xd')](cmHopper['unlockContact']({'active':![]},_0x39c03d,0x1))[_0xcf57('0xe')](loggerCatch(_0xcf57('0x22')));};exports['crateCustomerReportQueue']=function(_0x209a90){var _0x4df67b={};_0x4df67b[_0xcf57('0x23')]=_0x209a90['type'];_0x4df67b[_0xcf57('0x24')]=_0x209a90[_0xcf57('0x24')];_0x4df67b['calleridnum']=_0x209a90[_0xcf57('0x25')];_0x4df67b[_0xcf57('0x26')]=_0x209a90[_0xcf57('0x26')];_0x4df67b[_0xcf57('0x27')]=_0x209a90[_0xcf57('0x27')];_0x4df67b[_0xcf57('0x28')]=_0x209a90[_0xcf57('0x29')];_0x4df67b[_0xcf57('0x2a')]=_0x209a90[_0xcf57('0x29')];_0x4df67b[_0xcf57('0x2b')]=0x1;_0x4df67b[_0xcf57('0x2c')]=_0x209a90[_0xcf57('0x2d')];_0x4df67b[_0xcf57('0x2e')]=_0x209a90['membername'];_0x4df67b[_0xcf57('0x2f')]=_0xcf57('0x30');_0x4df67b[_0xcf57('0x31')]=_0xcf57('0x32');_0x4df67b[_0xcf57('0x33')]=0x0;_0x4df67b[_0xcf57('0x34')]=0x1;_0x4df67b[_0xcf57('0x35')]=_0x209a90[_0xcf57('0x36')];_0x4df67b[_0xcf57('0x37')]=_0xcf57('0x38');return BPromise[_0xcf57('0xc')]()[_0xcf57('0xd')](voiceQueueReport[_0xcf57('0x39')](_0x4df67b))['catch'](loggerCatch('[voiceQueueReport]\x20'));};exports[_0xcf57('0x3a')]=function(_0x368e9d,_0xebd314){return BPromise[_0xcf57('0xc')]()['then'](cmHopper[_0xcf57('0x3a')](_0x368e9d,_0xebd314))[_0xcf57('0xe')](loggerCatch(_0xcf57('0x3b')));};exports['rescheduleContactInQueue']=function(_0x2aa39d){return BPromise[_0xcf57('0xc')]()['then'](cmHopper[_0xcf57('0x19')](_0x2aa39d,!![],!![]))[_0xcf57('0xe')](loggerCatch(_0xcf57('0x3c')));}; \ No newline at end of file +var _0xf3ca=['from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','lodash','../rpc/cmHopper','../rpc/cmHopperFinal','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueRt','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','resolve','then','createHistory','catch','[createHistory]\x20','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','[getContactPreview]\x20','rescheduleContact','UserId','active','[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','crateCustomerReportQueue','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','queuecallercomplete','membername','context'];(function(_0x1a6c63,_0x2eedf3){var _0x1b971a=function(_0x242885){while(--_0x242885){_0x1a6c63['push'](_0x1a6c63['shift']());}};_0x1b971a(++_0x2eedf3);}(_0xf3ca,0xd8));var _0xaf3c=function(_0x9fb3d9,_0x19a3be){_0x9fb3d9=_0x9fb3d9-0x0;var _0xcd3a61=_0xf3ca[_0x9fb3d9];return _0xcd3a61;};'use strict';var util=require(_0xaf3c('0x0'));var BPromise=require(_0xaf3c('0x1'));var logger=require('../../../config/logger')('preview');var _=require(_0xaf3c('0x2'));var cmHopper=require(_0xaf3c('0x3'));var cmHopperFinal=require(_0xaf3c('0x4'));var cmHopperHistory=require(_0xaf3c('0x5'));var cmHopperBlack=require(_0xaf3c('0x6'));var voiceQueueRt=require(_0xaf3c('0x7'));var agentReportPreview=require(_0xaf3c('0x8'));var voiceQueueReport=require(_0xaf3c('0x9'));function loggerCatch(_0x6e9118){return function(_0x41eef4){logger[_0xaf3c('0xa')](_0x6e9118,util[_0xaf3c('0xb')](_0x41eef4,{'showHidden':![],'depth':null}));};}function create(_0x4e6fda){return BPromise[_0xaf3c('0xc')]()[_0xaf3c('0xd')](cmHopperHistory[_0xaf3c('0xe')](_0x4e6fda))[_0xaf3c('0xf')](loggerCatch('[createHistory]\x20'));}function createAgent(_0xf604f1){return BPromise['resolve']()[_0xaf3c('0xd')](agentReportPreview[_0xaf3c('0xe')](_0xf604f1))['catch'](loggerCatch(_0xaf3c('0x10')));}function moveContact(_0x24d022){return BPromise[_0xaf3c('0xc')]()['then'](cmHopper['moveContactManagedDialer'](_0x24d022,!![]))['catch'](loggerCatch(_0xaf3c('0x11')));}exports[_0xaf3c('0x12')]=function(_0x444117){return BPromise[_0xaf3c('0xc')]()['then'](cmHopperBlack[_0xaf3c('0x12')](_0x444117))['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0xaf3c('0x13')]=function(_0x5824e3){return BPromise[_0xaf3c('0xc')]()['then'](cmHopper[_0xaf3c('0x13')](_0x5824e3))[_0xaf3c('0xf')](loggerCatch(_0xaf3c('0x14')));};exports['createHistory']=function(_0x327c82,_0x466419){create(_0x327c82)[_0xaf3c('0xf')](loggerCatch(_0x466419));moveContact(_0x327c82)[_0xaf3c('0xf')](loggerCatch(_0x466419));};exports['createAgentHistory']=function(_0x3cd452,_0xf5e14){createAgent(_0x3cd452)[_0xaf3c('0xf')](loggerCatch(_0xf5e14));};exports['createCustomerHistory']=function(_0x88fd99,_0x1869c3){create(_0x88fd99)[_0xaf3c('0xf')](loggerCatch(_0x1869c3));};exports['createCustomerFinal']=function(_0x4bb8f3,_0x46c85a){moveContact(_0x4bb8f3)[_0xaf3c('0xf')](loggerCatch(_0x46c85a));};exports[_0xaf3c('0x15')]=function(_0x25e033,_0x2b683c,_0x24f2e9){if(_0x2b683c){_0x25e033[_0xaf3c('0x16')]=null;}if(_0x24f2e9){_0x25e033[_0xaf3c('0x17')]=![];}return BPromise[_0xaf3c('0xc')]()[_0xaf3c('0xd')](cmHopper['rescheduleContact'](_0x25e033))[_0xaf3c('0xf')](loggerCatch(_0xaf3c('0x18')));};exports['countReScheduled']=function(_0x58bf4f){return BPromise[_0xaf3c('0xc')]()[_0xaf3c('0xd')](cmHopper[_0xaf3c('0x19')](_0x58bf4f))[_0xaf3c('0xf')](loggerCatch(_0xaf3c('0x1a')));};exports['unlockContact']=function(_0x25994f){return BPromise[_0xaf3c('0xc')]()[_0xaf3c('0xd')](cmHopper[_0xaf3c('0x1b')]({'UserId':null},_0x25994f,0x1))['catch'](loggerCatch('[unlockContact]\x20'));};exports['disableContact']=function(_0x50bbd5){return BPromise[_0xaf3c('0xc')]()['then'](cmHopper['unlockContact']({'active':![]},_0x50bbd5,0x1))[_0xaf3c('0xf')](loggerCatch('[activeContact]\x20'));};exports[_0xaf3c('0x1c')]=function(_0x29e677){var _0x2de43d={};_0x2de43d['type']=_0x29e677['type'];_0x2de43d[_0xaf3c('0x1d')]=_0x29e677[_0xaf3c('0x1d')];_0x2de43d[_0xaf3c('0x1e')]=_0x29e677['calleridnum'];_0x2de43d['calleridname']=_0x29e677[_0xaf3c('0x1f')];_0x2de43d[_0xaf3c('0x20')]=_0x29e677[_0xaf3c('0x20')];_0x2de43d[_0xaf3c('0x21')]=_0x29e677[_0xaf3c('0x22')];_0x2de43d[_0xaf3c('0x23')]=_0x29e677[_0xaf3c('0x22')];_0x2de43d[_0xaf3c('0x24')]=0x1;_0x2de43d['queuecallercompleteAt']=_0x29e677['endtime'];_0x2de43d['connectedlinename']=_0x29e677[_0xaf3c('0x25')];_0x2de43d[_0xaf3c('0x26')]=_0xaf3c('0x27');_0x2de43d[_0xaf3c('0x28')]=_0xaf3c('0x29');_0x2de43d[_0xaf3c('0x2a')]=0x0;_0x2de43d[_0xaf3c('0x2b')]=0x1;_0x2de43d[_0xaf3c('0x2c')]=_0x29e677[_0xaf3c('0x25')];_0x2de43d['queuecallerexitreason']=_0xaf3c('0x2d');return BPromise[_0xaf3c('0xc')]()[_0xaf3c('0xd')](voiceQueueReport['create'](_0x2de43d))[_0xaf3c('0xf')](loggerCatch(_0xaf3c('0x2e')));};exports[_0xaf3c('0x2f')]=function(_0x3765d5,_0x53e559){return BPromise[_0xaf3c('0xc')]()[_0xaf3c('0xd')](cmHopper[_0xaf3c('0x2f')](_0x3765d5,_0x53e559))[_0xaf3c('0xf')](loggerCatch(_0xaf3c('0x30')));};exports[_0xaf3c('0x31')]=function(_0x5ea1e4){return BPromise[_0xaf3c('0xc')]()[_0xaf3c('0xd')](cmHopper[_0xaf3c('0x15')](_0x5ea1e4,!![],!![]))['catch'](loggerCatch(_0xaf3c('0x32')));}; \ 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 7f2d3e7..3fc4124 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 _0xc936=['xmd-dialurl','xmd-dialid','xmd-callerid','xmd-agi','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','getCallerIdRandom','pow','replace','random','match','extractCalleridNumber','lodash','moment','../../../../config/logger','preview','env','XCALLY_IP_AGI','127.0.0.1','milliseconds','diff','loggerCatch','error','info','inspect','loggerError','message','getCallerId','string','isEmpty','\x22%s\x22\x20<%s>','format','isUndefined','\x22\x22\x20<>','Queue','calleridname','calleridnum','ContactId','VoiceQueueId','dialOriginateTimeout','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','updatedAt','%s%s','toLowerVariables','hasOwnProperty','updateOriginated','isNil','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','state','statedesc','Blacklist','responsetime','endtime','logAgent','starttime','logLookAgent','membername','logCustomer','YYYY-MM-DD\x20HH:mm:ss','answertime','isFailure','Failure','RECALL','BOOKED','uniqueid','originate','channelAgent','from-sip','totalGlobal','countbusyretry','countcongestionretry','countagentrejectretry','clone','Global','scheduledAt','scheduledat','add','ListId','decrementTalkink','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','lastevent','name','queue','mandatoryDisposition','buildAcw','interface','agentReadyId','not_inuse','status','reachable','push','getDiff','seconds','createBody','CampaignId','idContact','campaigntype','dialAnswer','countglobal','callback','callbackat','recallme','UserId','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-listid'];(function(_0x28466d,_0x38c42a){var _0x221aeb=function(_0x871672){while(--_0x871672){_0x28466d['push'](_0x28466d['shift']());}};_0x221aeb(++_0x38c42a);}(_0xc936,0x112));var _0x6c93=function(_0x5851c3,_0x57c922){_0x5851c3=_0x5851c3-0x0;var _0xe607f3=_0xc936[_0x5851c3];return _0xe607f3;};'use strict';var util=require('util');var _=require(_0x6c93('0x0'));var moment=require(_0x6c93('0x1'));var logger=require(_0x6c93('0x2'))(_0x6c93('0x3'));var ipAgi=process[_0x6c93('0x4')][_0x6c93('0x5')]||_0x6c93('0x6');function getSeconds(_0x818317,_0x15c98d){var _0x3054b2=moment(_0x818317)[_0x6c93('0x7')](0x0);var _0x23ff74=moment(_0x15c98d)[_0x6c93('0x7')](0x0);return _0x3054b2[_0x6c93('0x8')](_0x23ff74,'seconds');}exports[_0x6c93('0x9')]=function(_0x5ea8d6){return function(_0x2ef9cc){logger[_0x6c93('0xa')](_0x5ea8d6,util['inspect'](_0x2ef9cc,{'showHidden':![],'depth':null}));};};exports['logger']=function(_0x6b9b7c,_0xde0d6c){logger[_0x6c93('0xb')](_0x6b9b7c,util[_0x6c93('0xc')](_0xde0d6c,{'showHidden':![],'depth':null}));};exports[_0x6c93('0xd')]=function(_0x51342d,_0x1a972b){logger[_0x6c93('0xa')](_0x51342d,util[_0x6c93('0xc')](_0x1a972b,{'showHidden':![],'depth':null}));};exports['logger2']=function(_0x1e1865){return function(_0x233c89){logger[_0x6c93('0xb')](_0x1e1865,util['inspect'](_0x233c89,{'showHidden':![],'depth':null}));};};exports[_0x6c93('0xe')]=function(_0x41a216,_0x48e04c,_0x25ff79){return{'message':_0x41a216,'unlock':_0x48e04c,'active':_0x25ff79};};exports[_0x6c93('0xf')]=function(_0x519062,_0xf5b45f,_0x27e9d7){if(!_['isUndefined'](_0x27e9d7)&&_0x6c93('0x10')===typeof _0x27e9d7&&!_[_0x6c93('0x11')](_0x27e9d7)){if(!_['isUndefined'](_0xf5b45f)&&'string'===typeof _0xf5b45f&&!_[_0x6c93('0x11')](_0xf5b45f)){return util['format'](_0x6c93('0x12'),_0xf5b45f,_0x27e9d7);}return util[_0x6c93('0x13')](_0x6c93('0x12'),_0x27e9d7,_0x27e9d7);}if(!_[_0x6c93('0x14')](_0x519062)&&_0x6c93('0x10')===typeof _0x519062&&!_[_0x6c93('0x11')](_0x519062)){return _0x519062;}return _0x6c93('0x15');};exports['isActive']=function(_0x301a21){if(_['isNil'](_0x301a21)){return![];}return _0x301a21;};exports['addVariables']=function(_0x31d1b1,_0x32bac1,_0x588302,_0x1ca1e8,_0x579853,_0x5d8f32){var _0x1df773={'XMD-QUEUE':_0x32bac1['Queue']?_0x32bac1[_0x6c93('0x16')]['name']:'','XMD-CALLERID':_0x1ca1e8,'XMD-CALLERID-PREVIEW':_0x5d8f32?util['format'](_0x6c93('0x12'),_0x5d8f32[_0x6c93('0x17')],_0x5d8f32[_0x6c93('0x18')]):_0x1ca1e8,'XMD-DIALID':_0x579853,'XMD-CONTACTID':_0x32bac1[_0x6c93('0x19')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x1ca1e8,'XMD-VOICEQUEUEID':_0x32bac1[_0x6c93('0x1a')],'XMD-DIALCHANNEL':_0x588302,'XMD-DIALTIMEOUT':_0x31d1b1[_0x6c93('0x1b')]||0x1e,'XMD-DIALOPTIONS':util[_0x6c93('0x13')]('\x22rtTxX%s%s\x22',_0x31d1b1[_0x6c93('0x1c')]?'g':'',_[_0x6c93('0x11')](_0x31d1b1[_0x6c93('0x1d')])?'':_0x6c93('0x1e')),'XMD-DIALURL':_0x31d1b1[_0x6c93('0x1f')]||'','XMD-AGI':_0x31d1b1[_0x6c93('0x20')]?util[_0x6c93('0x13')](_0x6c93('0x21'),ipAgi,_0x31d1b1[_0x6c93('0x20')]):'NONE','XMD-AGIAFTER':_0x31d1b1[_0x6c93('0x1c')]?util[_0x6c93('0x13')](_0x6c93('0x21'),ipAgi,_0x31d1b1['dialQueueProject2']):_0x6c93('0x22'),'XMD-ORIGINATECALLERIDNUM':_0x5d8f32?_0x5d8f32[_0x6c93('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0x5d8f32?_0x5d8f32['originatecalleridname']:'','XMD-DESTINATION':'xcally-motion-preview'};if(!_['isEmpty'](_0x31d1b1['monitor_format'])){_0x1df773[util[_0x6c93('0x13')]('%s',_0x6c93('0x24'))]=_0x31d1b1[_0x6c93('0x1d')];_0x1df773[util[_0x6c93('0x13')]('%s',_0x6c93('0x25'))]=_0x579853;}if(_0x32bac1&&_0x32bac1[_0x6c93('0x26')]){for(var _0x17e267 in _0x32bac1[_0x6c93('0x26')]){if(_0x32bac1[_0x6c93('0x26')]['hasOwnProperty'](_0x17e267)){if(!_['isNil'](_0x32bac1[_0x6c93('0x26')][_0x17e267])&&_0x17e267!=='id'&&_0x17e267!==_0x6c93('0x27')&&_0x17e267!=='createdAt'&&_0x17e267!==_0x6c93('0x28')){_0x1df773[util['format'](_0x6c93('0x29'),'XMD-',_['toUpper'](_0x17e267))]=_0x32bac1['Contact'][_0x17e267];}}}}return _0x1df773;};exports[_0x6c93('0x2a')]=function(_0x58e340){var _0xf0d68={};for(var _0x19b11a in _0x58e340){if(_0x58e340[_0x6c93('0x2b')](_0x19b11a)){_0xf0d68[util[_0x6c93('0x13')]('%s',_['toLower'](_0x19b11a))]=_0x58e340[_0x19b11a];}}return{'variables':_0xf0d68};};exports[_0x6c93('0x2c')]=function(_0x58c116,_0x186a6d){if(!_[_0x6c93('0x2d')](_0x58c116)){if(_0x58c116['hasOwnProperty'](_0x6c93('0x2e'))){if(_0x58c116['originated']>0x0){_0x58c116[_0x6c93('0x2e')]-=0x1;}else{logger['error'](_0x6c93('0x2f'),_0x186a6d);}}}else{logger[_0x6c93('0xa')](_0x6c93('0x30'),_0x186a6d);}};exports['logBlacklist']=function(_0x3b1e44){var _0x2ca628=moment()[_0x6c93('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b1e44[_0x6c93('0x31')]=0xd;_0x3b1e44[_0x6c93('0x32')]=_0x6c93('0x33');_0x3b1e44['starttime']=_0x2ca628;_0x3b1e44[_0x6c93('0x34')]=_0x2ca628;_0x3b1e44[_0x6c93('0x35')]=_0x2ca628;};exports[_0x6c93('0x36')]=function(_0x26ed0a,_0x3abac9,_0x348cab){var _0x482699=moment()[_0x6c93('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x26ed0a['state']=_0x3abac9;_0x26ed0a[_0x6c93('0x32')]=_0x348cab;_0x26ed0a[_0x6c93('0x34')]=_0x482699;_0x26ed0a['ringtime']=getSeconds(_0x26ed0a[_0x6c93('0x34')],_0x26ed0a[_0x6c93('0x37')]);};exports[_0x6c93('0x38')]=function(_0x300857,_0x1b520a,_0x5ea13a){_0x300857[_0x6c93('0x39')]=_0x1b520a;_0x300857['UserId']=_0x5ea13a;};exports[_0x6c93('0x3a')]=function(_0x53e712,_0x419271,_0x3baa63){var _0x4a775f=moment()[_0x6c93('0x13')](_0x6c93('0x3b'));_0x53e712['state']=_0x419271;_0x53e712[_0x6c93('0x32')]=_0x3baa63;_0x53e712[_0x6c93('0x34')]=_0x53e712[_0x6c93('0x34')]?_0x53e712[_0x6c93('0x34')]:_0x4a775f;_0x53e712['endtime']=_0x53e712['endtime']?_0x53e712[_0x6c93('0x35')]:_0x4a775f;_0x53e712['ringtime']=getSeconds(_0x53e712[_0x6c93('0x34')]||0x0,_0x53e712['starttime']||0x0);_0x53e712['talktime']=_0x53e712['answertime']?getSeconds(_0x53e712[_0x6c93('0x35')],_0x53e712[_0x6c93('0x3c')]):0x0;};exports[_0x6c93('0x3d')]=function(_0x2fd90f){return _0x2fd90f===_0x6c93('0x3e');};exports['variablesAction']=function(_0x5d26c1,_0x151b95,_0x5df760,_0x42c686,_0x248e22){var _0x5714a1=_0x42c686?_0x6c93('0x3f'):_0x5d26c1[_0x6c93('0x17')];_0x5714a1=_0x248e22?_0x6c93('0x40'):_0x5714a1;return{'actionid':_0x5d26c1[_0x6c93('0x41')],'action':_0x6c93('0x42'),'channel':_0x5d26c1[_0x6c93('0x43')],'callerid':util[_0x6c93('0x13')](_0x6c93('0x12'),_0x5714a1,_0x5d26c1[_0x6c93('0x18')]),'Exten':'xcally-motion-preview','Context':_0x6c93('0x44'),'Priority':'1','variable':_0x5df760,'timeout':(_0x151b95['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5d26c1['uniqueid']};};exports[_0x6c93('0x45')]=function(_0x5b7e16){return _0x5b7e16[_0x6c93('0x46')]+_0x5b7e16[_0x6c93('0x47')]+_0x5b7e16['countnoanswerretry']+_0x5b7e16[_0x6c93('0x48')]+_0x5b7e16['countnosuchnumberretry'];};exports['cloneAction']=function(_0x29bbe1){var _0x2b2b75=_[_0x6c93('0x49')](_0x29bbe1);_0x2b2b75[_0x6c93('0x31')]=0xf;_0x2b2b75[_0x6c93('0x32')]=_0x6c93('0x4a');return _0x2b2b75;};exports[_0x6c93('0x4b')]=function(_0x1cc0c8,_0x4b221e,_0x3cbd66){var _0x117c4a={};_0x117c4a[_0x4b221e]=_0x1cc0c8[_0x4b221e];_0x117c4a['active']=![];_0x117c4a[_0x6c93('0x4c')]=moment()[_0x6c93('0x4d')](_0x3cbd66,'minutes')['format'](_0x6c93('0x3b'));_0x117c4a[_0x6c93('0x19')]=_0x1cc0c8[_0x6c93('0x19')];_0x117c4a[_0x6c93('0x4e')]=_0x1cc0c8[_0x6c93('0x4e')];_0x117c4a[_0x6c93('0x1a')]=_0x1cc0c8[_0x6c93('0x1a')]||undefined;return _0x117c4a;};exports[_0x6c93('0x4f')]=function(_0x439e78,_0x4ac7d5){if(!_[_0x6c93('0x2d')](_0x439e78)){if(_0x439e78['pTalking']>0x0){_0x439e78['pTalking']-=0x1;}else{logger['error'](_0x4ac7d5,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x4ac7d5,_0x6c93('0x50'));}};exports['IsNotLoggedIn']=function(_0x2b6a8d){if(_0x2b6a8d<=0x0){return!![];}return![];};exports[_0x6c93('0x51')]=function(_0x137dc8,_0x451e61,_0x59d64c){_0x137dc8[_0x6c93('0x52')]=_0x451e61;_0x137dc8[_0x6c93('0x53')]=_0x137dc8[_0x6c93('0x54')];_0x137dc8['interface']=_0x137dc8[_0x6c93('0x43')];if(_0x59d64c){_0x137dc8[_0x6c93('0x55')]=_0x59d64c['mandatoryDisposition'];}return _0x137dc8;};exports[_0x6c93('0x56')]=function(_0x592190){var _0x36af39={};_0x36af39[_0x6c93('0x54')]=_0x592190[_0x6c93('0x54')];_0x36af39[_0x6c93('0x57')]=_0x592190[_0x6c93('0x43')];_0x36af39[_0x6c93('0x41')]=_0x592190[_0x6c93('0x41')];return _0x36af39;};exports[_0x6c93('0x58')]=function(_0x44fd31){var _0x4f7746=[];for(var _0x40ce9c in _0x44fd31){if(_0x44fd31[_0x6c93('0x2b')](_0x40ce9c)){if(!_[_0x6c93('0x2d')](_0x44fd31[_0x40ce9c])&&_0x44fd31[_0x40ce9c][_0x6c93('0x31')]===_0x6c93('0x59')&&_0x44fd31[_0x40ce9c][_0x6c93('0x5a')]===_0x6c93('0x5b')){_0x4f7746[_0x6c93('0x5c')](_0x44fd31[_0x40ce9c]['id']);}}}return _0x4f7746;};exports[_0x6c93('0x5d')]=function(_0x54a164){var _0x4155b5=moment()[_0x6c93('0x7')](0x0);var _0x29524f=moment(_0x54a164)[_0x6c93('0x7')](0x0);return _0x4155b5[_0x6c93('0x8')](_0x29524f,_0x6c93('0x5e'));};exports[_0x6c93('0x5f')]=function(_0x2eb352){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x2eb352['ContactId'],'ListId':_0x2eb352[_0x6c93('0x4e')],'VoiceQueueId':_0x2eb352[_0x6c93('0x1a')]||undefined,'CampaignId':_0x2eb352[_0x6c93('0x60')]||undefined};};exports['filterKey']=function(_0x65b29e){if(_0x65b29e==='uniqueid'||_0x65b29e===_0x6c93('0x61')||_0x65b29e==='queue'||_0x65b29e==='type'||_0x65b29e===_0x6c93('0x62')||_0x65b29e===_0x6c93('0x63')||_0x65b29e==='membername'||_0x65b29e===_0x6c93('0x43')||_0x65b29e===_0x6c93('0x17')||_0x65b29e==='active'||_0x65b29e===_0x6c93('0x18')||_0x65b29e===_0x6c93('0x4c')||_0x65b29e===_0x6c93('0x46')||_0x65b29e===_0x6c93('0x47')||_0x65b29e==='countnoanswerretry'||_0x65b29e===_0x6c93('0x64')||_0x65b29e===_0x6c93('0x65')||_0x65b29e==='callbackuniqueid'||_0x65b29e===_0x6c93('0x66')||_0x65b29e===_0x6c93('0x67')||_0x65b29e===_0x6c93('0x19')||_0x65b29e===_0x6c93('0x4e')||_0x65b29e===_0x6c93('0x68')||_0x65b29e===_0x6c93('0x1a')||_0x65b29e===_0x6c93('0x69')||_0x65b29e===_0x6c93('0x6a')||_0x65b29e===_0x6c93('0x6b')||_0x65b29e===_0x6c93('0x6c')||_0x65b29e===_0x6c93('0x6d')||_0x65b29e===_0x6c93('0x6e')||_0x65b29e==='xmd-dialtimeout'||_0x65b29e==='xmd-dialoptions'||_0x65b29e===_0x6c93('0x6f')||_0x65b29e==='xmd-dialchannel'||_0x65b29e==='xmd-contactid'||_0x65b29e==='xmd-cdrtype'||_0x65b29e===_0x6c93('0x70')||_0x65b29e==='xmd-agiafter'||_0x65b29e===_0x6c93('0x71')||_0x65b29e==='rtpaudioqos'||_0x65b29e===_0x6c93('0x72')||_0x65b29e===_0x6c93('0x73')||_0x65b29e===_0x6c93('0x74')||_0x65b29e===_0x6c93('0x75')||_0x65b29e===_0x6c93('0x76')||_0x65b29e==='rtpaudioqosrtt'||_0x65b29e==='rtpaudioqosrttbridged'||_0x65b29e==='rtpaudioqos'||_0x65b29e===_0x6c93('0x72')||_0x65b29e==='rtpaudioqosjitter'||_0x65b29e===_0x6c93('0x74')||_0x65b29e===_0x6c93('0x75')||_0x65b29e==='rtpaudioqoslossbridged'||_0x65b29e===_0x6c93('0x77')||_0x65b29e===_0x6c93('0x78')||_0x65b29e===_0x6c93('0x79')||_0x65b29e==='bridgepvtcallid'||_0x65b29e==='state'||_0x65b29e==='statedesc'){return![];}return!![];};exports[_0x6c93('0x7a')]=function(_0x13e83e,_0xba3584){var _0x3484d7,_0x2be5a1,_0x54e22a;if(_0xba3584<=0x0){_0xba3584=0x1;}_0x3484d7=new RegExp('\x5cw{0,'+_0xba3584+'}$');_0x2be5a1=Math[_0x6c93('0x7b')](0xa,_0xba3584-0x1);_0x54e22a=Math[_0x6c93('0x7b')](0xa,_0xba3584)-0x1;return util[_0x6c93('0x13')]('%s',_[_0x6c93('0x7c')](_0x13e83e,_0x3484d7,_[_0x6c93('0x7d')](_0x2be5a1,_0x54e22a)));};exports['extractCalleridName']=function(_0x31c1b1){var _0x4b899f=_0x31c1b1[_0x6c93('0x7e')](/"(.*?)"/);return _0x4b899f?_0x4b899f[0x1]:_0x31c1b1;};exports[_0x6c93('0x7f')]=function(_0x23c08b){var _0x45cc69=_0x23c08b[_0x6c93('0x7e')](/<(.*?)>/);return _0x45cc69?_0x45cc69[0x1]:_0x23c08b;}; \ No newline at end of file +var _0xd446=['rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','random','extractCalleridName','match','extractCalleridNumber','util','moment','../../../../config/logger','env','XCALLY_IP_AGI','milliseconds','seconds','loggerCatch','error','logger','info','loggerError','logger2','inspect','message','getCallerId','isUndefined','string','\x22%s\x22\x20<%s>','format','isEmpty','\x22\x22\x20<>','isNil','addVariables','Queue','name','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','dialQueueProject2','monitor_format','dialPreviewUrl','dialQueueProject','\x22agi://%s/square,%s\x22','NONE','originatecalleridnum','xcally-motion-preview','_XCALLY_MIXMONITOR_FORMAT','_XCALLY_MIXMONITOR_UNIQUEID','Contact','tags','createdAt','%s%s','XMD-','toUpper','hasOwnProperty','toLower','updateOriginated','originated','[updateOriginated]\x20is\x20null\x20or\x20undefined','logBlacklist','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','responsetime','logAgent','ringtime','starttime','logLookAgent','UserId','logCustomer','endtime','talktime','answertime','Failure','variablesAction','RECALL','uniqueid','channelAgent','from-sip','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','cloneAction','clone','Global','scheduledAt','active','scheduledat','add','minutes','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','buildObj','interface','mandatoryDisposition','buildAcw','queue','agentReadyId','not_inuse','reachable','push','getDiff','diff','createBody','CampaignId','filterKey','idContact','type','campaigntype','membername','countglobal','callbackuniqueid','callbackat','sipcallid','xmd-queue','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged'];(function(_0x4574ab,_0x18c0e5){var _0x30e0d5=function(_0x4cf45e){while(--_0x4cf45e){_0x4574ab['push'](_0x4574ab['shift']());}};_0x30e0d5(++_0x18c0e5);}(_0xd446,0x11a));var _0x6d44=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd446[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x6d44('0x0'));var _=require('lodash');var moment=require(_0x6d44('0x1'));var logger=require(_0x6d44('0x2'))('preview');var ipAgi=process[_0x6d44('0x3')][_0x6d44('0x4')]||'127.0.0.1';function getSeconds(_0x5e3d39,_0x5ce213){var _0x4aba22=moment(_0x5e3d39)[_0x6d44('0x5')](0x0);var _0x36e323=moment(_0x5ce213)[_0x6d44('0x5')](0x0);return _0x4aba22['diff'](_0x36e323,_0x6d44('0x6'));}exports[_0x6d44('0x7')]=function(_0x402f77){return function(_0x4922ec){logger[_0x6d44('0x8')](_0x402f77,util['inspect'](_0x4922ec,{'showHidden':![],'depth':null}));};};exports[_0x6d44('0x9')]=function(_0x239c86,_0x367214){logger[_0x6d44('0xa')](_0x239c86,util['inspect'](_0x367214,{'showHidden':![],'depth':null}));};exports[_0x6d44('0xb')]=function(_0x2ef8a5,_0x1f30c7){logger[_0x6d44('0x8')](_0x2ef8a5,util['inspect'](_0x1f30c7,{'showHidden':![],'depth':null}));};exports[_0x6d44('0xc')]=function(_0x4ae27c){return function(_0x35b566){logger[_0x6d44('0xa')](_0x4ae27c,util[_0x6d44('0xd')](_0x35b566,{'showHidden':![],'depth':null}));};};exports[_0x6d44('0xe')]=function(_0x314fe6,_0x3e5124,_0x10d42b){return{'message':_0x314fe6,'unlock':_0x3e5124,'active':_0x10d42b};};exports[_0x6d44('0xf')]=function(_0xa2d25f,_0x51c5a9,_0x108c1e){if(!_[_0x6d44('0x10')](_0x108c1e)&&_0x6d44('0x11')===typeof _0x108c1e&&!_['isEmpty'](_0x108c1e)){if(!_['isUndefined'](_0x51c5a9)&&'string'===typeof _0x51c5a9&&!_['isEmpty'](_0x51c5a9)){return util['format'](_0x6d44('0x12'),_0x51c5a9,_0x108c1e);}return util[_0x6d44('0x13')](_0x6d44('0x12'),_0x108c1e,_0x108c1e);}if(!_[_0x6d44('0x10')](_0xa2d25f)&&_0x6d44('0x11')===typeof _0xa2d25f&&!_[_0x6d44('0x14')](_0xa2d25f)){return _0xa2d25f;}return _0x6d44('0x15');};exports['isActive']=function(_0x27434e){if(_[_0x6d44('0x16')](_0x27434e)){return![];}return _0x27434e;};exports[_0x6d44('0x17')]=function(_0x983bcd,_0x58e120,_0x54ebab,_0x1ee799,_0xa2da3a,_0x588bd9){var _0xae7d7a={'XMD-QUEUE':_0x58e120[_0x6d44('0x18')]?_0x58e120['Queue'][_0x6d44('0x19')]:'','XMD-CALLERID':_0x1ee799,'XMD-CALLERID-PREVIEW':_0x588bd9?util['format'](_0x6d44('0x12'),_0x588bd9[_0x6d44('0x1a')],_0x588bd9[_0x6d44('0x1b')]):_0x1ee799,'XMD-DIALID':_0xa2da3a,'XMD-CONTACTID':_0x58e120[_0x6d44('0x1c')],'XMD-CDRTYPE':_0x6d44('0x1d'),'CALLERID(all)':_0x1ee799,'XMD-VOICEQUEUEID':_0x58e120[_0x6d44('0x1e')],'XMD-DIALCHANNEL':_0x54ebab,'XMD-DIALTIMEOUT':_0x983bcd['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x6d44('0x13')]('\x22rtTxX%s%s\x22',_0x983bcd[_0x6d44('0x1f')]?'g':'',_['isEmpty'](_0x983bcd[_0x6d44('0x20')])?'':'U(xcally-mixmonitor-context)'),'XMD-DIALURL':_0x983bcd[_0x6d44('0x21')]||'','XMD-AGI':_0x983bcd[_0x6d44('0x22')]?util[_0x6d44('0x13')](_0x6d44('0x23'),ipAgi,_0x983bcd[_0x6d44('0x22')]):_0x6d44('0x24'),'XMD-AGIAFTER':_0x983bcd['dialQueueProject2']?util[_0x6d44('0x13')]('\x22agi://%s/square,%s\x22',ipAgi,_0x983bcd[_0x6d44('0x1f')]):_0x6d44('0x24'),'XMD-ORIGINATECALLERIDNUM':_0x588bd9?_0x588bd9[_0x6d44('0x25')]:'','XMD-ORIGINATECALLERIDNAME':_0x588bd9?_0x588bd9['originatecalleridname']:'','XMD-DESTINATION':_0x6d44('0x26')};if(!_[_0x6d44('0x14')](_0x983bcd[_0x6d44('0x20')])){_0xae7d7a[util[_0x6d44('0x13')]('%s',_0x6d44('0x27'))]=_0x983bcd[_0x6d44('0x20')];_0xae7d7a[util['format']('%s',_0x6d44('0x28'))]=_0xa2da3a;}if(_0x58e120&&_0x58e120['Contact']){for(var _0xd67b02 in _0x58e120[_0x6d44('0x29')]){if(_0x58e120[_0x6d44('0x29')]['hasOwnProperty'](_0xd67b02)){if(!_['isNil'](_0x58e120[_0x6d44('0x29')][_0xd67b02])&&_0xd67b02!=='id'&&_0xd67b02!==_0x6d44('0x2a')&&_0xd67b02!==_0x6d44('0x2b')&&_0xd67b02!=='updatedAt'){_0xae7d7a[util[_0x6d44('0x13')](_0x6d44('0x2c'),_0x6d44('0x2d'),_[_0x6d44('0x2e')](_0xd67b02))]=_0x58e120[_0x6d44('0x29')][_0xd67b02];}}}}return _0xae7d7a;};exports['toLowerVariables']=function(_0x3f1cd8){var _0x5f5c08={};for(var _0x2482fe in _0x3f1cd8){if(_0x3f1cd8[_0x6d44('0x2f')](_0x2482fe)){_0x5f5c08[util[_0x6d44('0x13')]('%s',_[_0x6d44('0x30')](_0x2482fe))]=_0x3f1cd8[_0x2482fe];}}return{'variables':_0x5f5c08};};exports[_0x6d44('0x31')]=function(_0x183764,_0x5ae3bb){if(!_[_0x6d44('0x16')](_0x183764)){if(_0x183764[_0x6d44('0x2f')]('originated')){if(_0x183764[_0x6d44('0x32')]>0x0){_0x183764[_0x6d44('0x32')]-=0x1;}else{logger[_0x6d44('0x8')]('[updateOriginated]\x20object\x20originated\x20is\x20negative',_0x5ae3bb);}}}else{logger[_0x6d44('0x8')](_0x6d44('0x33'),_0x5ae3bb);}};exports[_0x6d44('0x34')]=function(_0x1b52a6){var _0x4f53cf=moment()['format'](_0x6d44('0x35'));_0x1b52a6[_0x6d44('0x36')]=0xd;_0x1b52a6[_0x6d44('0x37')]='Blacklist';_0x1b52a6['starttime']=_0x4f53cf;_0x1b52a6[_0x6d44('0x38')]=_0x4f53cf;_0x1b52a6['endtime']=_0x4f53cf;};exports[_0x6d44('0x39')]=function(_0x381a08,_0x2fefb9,_0xe05164){var _0x42e40e=moment()[_0x6d44('0x13')]('YYYY-MM-DD\x20HH:mm:ss');_0x381a08['state']=_0x2fefb9;_0x381a08['statedesc']=_0xe05164;_0x381a08['responsetime']=_0x42e40e;_0x381a08[_0x6d44('0x3a')]=getSeconds(_0x381a08[_0x6d44('0x38')],_0x381a08[_0x6d44('0x3b')]);};exports[_0x6d44('0x3c')]=function(_0x4b6d79,_0x253693,_0x445587){_0x4b6d79['membername']=_0x253693;_0x4b6d79[_0x6d44('0x3d')]=_0x445587;};exports[_0x6d44('0x3e')]=function(_0x218de0,_0x2535ea,_0x114e55){var _0x35a869=moment()['format'](_0x6d44('0x35'));_0x218de0[_0x6d44('0x36')]=_0x2535ea;_0x218de0[_0x6d44('0x37')]=_0x114e55;_0x218de0[_0x6d44('0x38')]=_0x218de0[_0x6d44('0x38')]?_0x218de0[_0x6d44('0x38')]:_0x35a869;_0x218de0['endtime']=_0x218de0[_0x6d44('0x3f')]?_0x218de0['endtime']:_0x35a869;_0x218de0[_0x6d44('0x3a')]=getSeconds(_0x218de0['responsetime']||0x0,_0x218de0[_0x6d44('0x3b')]||0x0);_0x218de0[_0x6d44('0x40')]=_0x218de0[_0x6d44('0x41')]?getSeconds(_0x218de0['endtime'],_0x218de0['answertime']):0x0;};exports['isFailure']=function(_0x344df2){return _0x344df2===_0x6d44('0x42');};exports[_0x6d44('0x43')]=function(_0x5a1f0e,_0x28d068,_0x165214,_0xcb16d7,_0x19cf61){var _0x44e798=_0xcb16d7?_0x6d44('0x44'):_0x5a1f0e[_0x6d44('0x1a')];_0x44e798=_0x19cf61?'BOOKED':_0x44e798;return{'actionid':_0x5a1f0e[_0x6d44('0x45')],'action':'originate','channel':_0x5a1f0e[_0x6d44('0x46')],'callerid':util[_0x6d44('0x13')]('\x22%s\x22\x20<%s>',_0x44e798,_0x5a1f0e['calleridnum']),'Exten':'xcally-motion-preview','Context':_0x6d44('0x47'),'Priority':'1','variable':_0x165214,'timeout':(_0x28d068['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x5a1f0e['uniqueid']};};exports['totalGlobal']=function(_0x245a39){return _0x245a39[_0x6d44('0x48')]+_0x245a39[_0x6d44('0x49')]+_0x245a39[_0x6d44('0x4a')]+_0x245a39['countagentrejectretry']+_0x245a39[_0x6d44('0x4b')];};exports[_0x6d44('0x4c')]=function(_0x1a451e){var _0x17a4fa=_[_0x6d44('0x4d')](_0x1a451e);_0x17a4fa[_0x6d44('0x36')]=0xf;_0x17a4fa['statedesc']=_0x6d44('0x4e');return _0x17a4fa;};exports[_0x6d44('0x4f')]=function(_0x47d96f,_0x2af8a6,_0x7d0d5){var _0x5ca031={};_0x5ca031[_0x2af8a6]=_0x47d96f[_0x2af8a6];_0x5ca031[_0x6d44('0x50')]=![];_0x5ca031[_0x6d44('0x51')]=moment()[_0x6d44('0x52')](_0x7d0d5,_0x6d44('0x53'))['format'](_0x6d44('0x35'));_0x5ca031[_0x6d44('0x1c')]=_0x47d96f['ContactId'];_0x5ca031[_0x6d44('0x54')]=_0x47d96f['ListId'];_0x5ca031[_0x6d44('0x1e')]=_0x47d96f[_0x6d44('0x1e')]||undefined;return _0x5ca031;};exports[_0x6d44('0x55')]=function(_0xc6be4a,_0x2262c6){if(!_['isNil'](_0xc6be4a)){if(_0xc6be4a['pTalking']>0x0){_0xc6be4a[_0x6d44('0x56')]-=0x1;}else{logger[_0x6d44('0x8')](_0x2262c6,_0x6d44('0x57'));}}else{logger[_0x6d44('0x8')](_0x2262c6,_0x6d44('0x58'));}};exports['IsNotLoggedIn']=function(_0x2094ce){if(_0x2094ce<=0x0){return!![];}return![];};exports[_0x6d44('0x59')]=function(_0x54457e,_0x1132ca,_0x528b06){_0x54457e['lastevent']=_0x1132ca;_0x54457e['name']=_0x54457e['queue'];_0x54457e[_0x6d44('0x5a')]=_0x54457e['channelAgent'];if(_0x528b06){_0x54457e[_0x6d44('0x5b')]=_0x528b06[_0x6d44('0x5b')];}return _0x54457e;};exports[_0x6d44('0x5c')]=function(_0x5173fa){var _0x39cc3a={};_0x39cc3a['queue']=_0x5173fa[_0x6d44('0x5d')];_0x39cc3a['interface']=_0x5173fa['channelAgent'];_0x39cc3a[_0x6d44('0x45')]=_0x5173fa['uniqueid'];return _0x39cc3a;};exports[_0x6d44('0x5e')]=function(_0xafb9cd){var _0x722804=[];for(var _0x2d1dc5 in _0xafb9cd){if(_0xafb9cd[_0x6d44('0x2f')](_0x2d1dc5)){if(!_['isNil'](_0xafb9cd[_0x2d1dc5])&&_0xafb9cd[_0x2d1dc5]['state']===_0x6d44('0x5f')&&_0xafb9cd[_0x2d1dc5]['status']===_0x6d44('0x60')){_0x722804[_0x6d44('0x61')](_0xafb9cd[_0x2d1dc5]['id']);}}}return _0x722804;};exports[_0x6d44('0x62')]=function(_0x4dbea3){var _0x58a45c=moment()[_0x6d44('0x5')](0x0);var _0x3e6c83=moment(_0x4dbea3)[_0x6d44('0x5')](0x0);return _0x58a45c[_0x6d44('0x63')](_0x3e6c83,_0x6d44('0x6'));};exports[_0x6d44('0x64')]=function(_0xfed40b){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0xfed40b[_0x6d44('0x1c')],'ListId':_0xfed40b[_0x6d44('0x54')],'VoiceQueueId':_0xfed40b['VoiceQueueId']||undefined,'CampaignId':_0xfed40b[_0x6d44('0x65')]||undefined};};exports[_0x6d44('0x66')]=function(_0x537ae4){if(_0x537ae4==='uniqueid'||_0x537ae4===_0x6d44('0x67')||_0x537ae4==='queue'||_0x537ae4===_0x6d44('0x68')||_0x537ae4===_0x6d44('0x69')||_0x537ae4==='dialAnswer'||_0x537ae4===_0x6d44('0x6a')||_0x537ae4===_0x6d44('0x46')||_0x537ae4===_0x6d44('0x1a')||_0x537ae4===_0x6d44('0x50')||_0x537ae4==='calleridnum'||_0x537ae4==='scheduledat'||_0x537ae4===_0x6d44('0x48')||_0x537ae4===_0x6d44('0x49')||_0x537ae4===_0x6d44('0x4a')||_0x537ae4===_0x6d44('0x6b')||_0x537ae4==='callback'||_0x537ae4===_0x6d44('0x6c')||_0x537ae4===_0x6d44('0x6d')||_0x537ae4==='recallme'||_0x537ae4==='ContactId'||_0x537ae4===_0x6d44('0x54')||_0x537ae4===_0x6d44('0x3d')||_0x537ae4===_0x6d44('0x1e')||_0x537ae4===_0x6d44('0x6e')||_0x537ae4==='xmd-voicequeueid'||_0x537ae4===_0x6d44('0x6f')||_0x537ae4==='xmd-phone'||_0x537ae4==='xmd-listid'||_0x537ae4===_0x6d44('0x70')||_0x537ae4===_0x6d44('0x71')||_0x537ae4===_0x6d44('0x72')||_0x537ae4===_0x6d44('0x73')||_0x537ae4==='xmd-dialchannel'||_0x537ae4==='xmd-contactid'||_0x537ae4==='xmd-cdrtype'||_0x537ae4==='xmd-callerid'||_0x537ae4===_0x6d44('0x74')||_0x537ae4===_0x6d44('0x75')||_0x537ae4===_0x6d44('0x76')||_0x537ae4===_0x6d44('0x77')||_0x537ae4===_0x6d44('0x78')||_0x537ae4===_0x6d44('0x79')||_0x537ae4===_0x6d44('0x7a')||_0x537ae4===_0x6d44('0x7b')||_0x537ae4===_0x6d44('0x7c')||_0x537ae4===_0x6d44('0x7d')||_0x537ae4===_0x6d44('0x76')||_0x537ae4==='rtpaudioqosbridged'||_0x537ae4===_0x6d44('0x78')||_0x537ae4===_0x6d44('0x79')||_0x537ae4==='rtpaudioqosloss'||_0x537ae4==='rtpaudioqoslossbridged'||_0x537ae4===_0x6d44('0x7c')||_0x537ae4===_0x6d44('0x7d')||_0x537ae4==='bridgepeer'||_0x537ae4===_0x6d44('0x7e')||_0x537ae4===_0x6d44('0x36')||_0x537ae4===_0x6d44('0x37')){return![];}return!![];};exports[_0x6d44('0x7f')]=function(_0xaa35b7,_0x3bcdc1){var _0x2425ad,_0x2b7c87,_0x21c06e;if(_0x3bcdc1<=0x0){_0x3bcdc1=0x1;}_0x2425ad=new RegExp(_0x6d44('0x80')+_0x3bcdc1+'}$');_0x2b7c87=Math['pow'](0xa,_0x3bcdc1-0x1);_0x21c06e=Math[_0x6d44('0x81')](0xa,_0x3bcdc1)-0x1;return util[_0x6d44('0x13')]('%s',_['replace'](_0xaa35b7,_0x2425ad,_[_0x6d44('0x82')](_0x2b7c87,_0x21c06e)));};exports[_0x6d44('0x83')]=function(_0x57c102){var _0xa08d81=_0x57c102[_0x6d44('0x84')](/"(.*?)"/);return _0xa08d81?_0xa08d81[0x1]:_0x57c102;};exports[_0x6d44('0x85')]=function(_0x2ec090){var _0x2c9beb=_0x2ec090[_0x6d44('0x84')](/<(.*?)>/);return _0x2c9beb?_0x2c9beb[0x1]:_0x2ec090;}; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 1f8383e..c32b880 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 _0x71ac=['queueadd','string','number','boolean','queuepause','reload','voicequeuechannel','voicequeuechannelhangup'];(function(_0x58e2a5,_0x4e822c){var _0x440ba0=function(_0x375d68){while(--_0x375d68){_0x58e2a5['push'](_0x58e2a5['shift']());}};_0x440ba0(++_0x4e822c);}(_0x71ac,0x148));var _0xc71a=function(_0x163040,_0x38a58c){_0x163040=_0x163040-0x0;var _0x364667=_0x71ac[_0x163040];return _0x364667;};'use strict';exports[_0xc71a('0x0')]={'queue':{'type':_0xc71a('0x1'),'required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':_0xc71a('0x1'),'required':!![]},'penalty':{'type':_0xc71a('0x2'),'required':![]},'paused':{'type':_0xc71a('0x3'),'required':![]}};exports['queueremove']={'queue':{'type':_0xc71a('0x1'),'required':!![]},'interface':{'type':_0xc71a('0x1'),'required':!![]}};exports[_0xc71a('0x4')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0xc71a('0x3')},'reason':{'type':_0xc71a('0x1'),'required':![]}};exports[_0xc71a('0x5')]={'module':{'type':_0xc71a('0x1'),'required':![]}};exports[_0xc71a('0x6')]={'uniqueid':{'type':_0xc71a('0x1'),'required':!![]}};exports['voicechannel']={'uniqueid':{'type':_0xc71a('0x1'),'required':!![]},'filename':{'type':_0xc71a('0x1')},'format':{'type':_0xc71a('0x1')},'mixmonitorid':{'type':_0xc71a('0x1')}};exports[_0xc71a('0x7')]={'uniqueid':{'type':_0xc71a('0x1'),'required':!![]}};exports['voicequeuechannelredirect']={'uniqueid':{'type':_0xc71a('0x1'),'required':!![]},'exten':{'type':_0xc71a('0x1'),'required':!![]},'context':{'type':'string'}}; \ No newline at end of file +var _0xf94e=['reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','boolean','queueremove','string'];(function(_0x1bdfe7,_0x5c062c){var _0x6dc98e=function(_0x50d021){while(--_0x50d021){_0x1bdfe7['push'](_0x1bdfe7['shift']());}};_0x6dc98e(++_0x5c062c);}(_0xf94e,0x1eb));var _0xef94=function(_0x4c2947,_0x5ae268){_0x4c2947=_0x4c2947-0x0;var _0x5b2970=_0xf94e[_0x4c2947];return _0x5b2970;};'use strict';exports[_0xef94('0x0')]={'queue':{'type':'string','required':!![]},'interface':{'type':'string','required':!![]},'membername':{'type':'string','required':!![]},'penalty':{'type':'number','required':![]},'paused':{'type':_0xef94('0x1'),'required':![]}};exports[_0xef94('0x2')]={'queue':{'type':_0xef94('0x3'),'required':!![]},'interface':{'type':_0xef94('0x3'),'required':!![]}};exports['queuepause']={'interface':{'type':_0xef94('0x3'),'required':!![]},'paused':{'type':_0xef94('0x1')},'reason':{'type':_0xef94('0x3'),'required':![]}};exports[_0xef94('0x4')]={'module':{'type':_0xef94('0x3'),'required':![]}};exports[_0xef94('0x5')]={'uniqueid':{'type':_0xef94('0x3'),'required':!![]}};exports[_0xef94('0x6')]={'uniqueid':{'type':_0xef94('0x3'),'required':!![]},'filename':{'type':_0xef94('0x3')},'format':{'type':'string'},'mixmonitorid':{'type':_0xef94('0x3')}};exports[_0xef94('0x7')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xef94('0x8')]={'uniqueid':{'type':_0xef94('0x3'),'required':!![]},'exten':{'type':_0xef94('0x3'),'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 1fc98d5..092d81e 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 _0x9d5d=['uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','queuecallercompleteAt','queuecallerexitAt','diff','seconds','queuecallercomplete','initVoiceCallReports','duration','disposition','ANSWERED','billableseconds','initCampaigns','dialQueueProject','SquareProject','initVoiceExtensions','initCampaignHopperHistory','initFaxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/freshsalesAccount','../model/faxAccount','trunks','voiceQueues','triggers','campaigns','outbound','voiceExtensions','channels','queueChannels','outboundChannels','settings','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','dynamics365Accounts','freshsalesAccounts','faxAccounts','mapKeys','hasOwnProperty','format','SIP/%s','interface','name','answered','sumHoldTime','sumDuration','sumBillable','isEmpty','ivrTotalCallsDays','total','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','isUndefined','agents','telephones','initTrunks','initVoiceQueues','length','initTriggers','initTemplates','templates','initZendeskAccounts','zendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initZohoAccounts','initDeskAccounts','deskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','groupBy'];(function(_0x329437,_0x1de73a){var _0x3789d9=function(_0x37832e){while(--_0x37832e){_0x329437['push'](_0x329437['shift']());}};_0x3789d9(++_0x1de73a);}(_0x9d5d,0xf7));var _0xd9d5=function(_0x6ef261,_0x277e20){_0x6ef261=_0x6ef261-0x0;var _0x2e6d09=_0x9d5d[_0x6ef261];return _0x2e6d09;};'use strict';var BPromise=require(_0xd9d5('0x0'));var util=require(_0xd9d5('0x1'));var _=require(_0xd9d5('0x2'));var moment=require(_0xd9d5('0x3'));var Agent=require(_0xd9d5('0x4'));var Telephone=require('../model/telephone');var Trunk=require('../model/trunk');var VoiceQueue=require(_0xd9d5('0x5'));var Trigger=require(_0xd9d5('0x6'));var Template=require(_0xd9d5('0x7'));var Campaign=require(_0xd9d5('0x8'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0xd9d5('0x9'));var SalesforceAccount=require(_0xd9d5('0xa'));var FreshdeskAccount=require(_0xd9d5('0xb'));var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0xd9d5('0xc'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xd9d5('0xd'));var ServicenowAccount=require(_0xd9d5('0xe'));var Dynamics365Account=require('../model/dynamics365Account');var FreshsalesAccount=require(_0xd9d5('0xf'));var FaxAccount=require(_0xd9d5('0x10'));var Realtime=function(){this['agents']={};this['telephones']={};this[_0xd9d5('0x11')]={};this[_0xd9d5('0x12')]={};this[_0xd9d5('0x13')]={};this[_0xd9d5('0x14')]={};this['templates']={};this[_0xd9d5('0x15')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xd9d5('0x16')]={};this[_0xd9d5('0x17')]={};this[_0xd9d5('0x18')]={};this[_0xd9d5('0x19')]={};this['timers']={};this[_0xd9d5('0x1a')]={};this['zendeskAccounts']={};this[_0xd9d5('0x1b')]={};this[_0xd9d5('0x1c')]={};this[_0xd9d5('0x1d')]={};this[_0xd9d5('0x1e')]={};this['deskAccounts']={};this['vtigerAccounts']={};this['servicenowAccounts']={};this[_0xd9d5('0x1f')]={};this[_0xd9d5('0x20')]={};this[_0xd9d5('0x21')]={};};function freeIsNotKey(_0x444659,_0x30725a,_0x46582d){var _0x3c7f52=_[_0xd9d5('0x22')](_0x444659,function(_0x2f0554,_0x35c942){return _0x2f0554[_0x46582d];});for(var _0x3477bc in _0x30725a){if(_0x30725a[_0xd9d5('0x23')](_0x3477bc)){if(!_0x3c7f52[_0x3477bc]){delete _0x30725a[_0x3477bc];}}}}function freeIsNotKeySip(_0xe8738d,_0x4a60ff){var _0x26e08f=_[_0xd9d5('0x22')](_0xe8738d,function(_0xebd3d1,_0x1443b2){return util[_0xd9d5('0x24')](_0xd9d5('0x25'),_0xebd3d1['name']);});for(var _0x41b528 in _0x4a60ff){if(_0x4a60ff['hasOwnProperty'](_0x41b528)){if(!_0x26e08f[_0x41b528]){delete _0x4a60ff[_0x41b528];}}}}function freeIsNotKeyAgent(_0x1d7073,_0x2201cc){var _0x4a3cc5=_[_0xd9d5('0x22')](_0x1d7073,function(_0x41f934,_0x266d92){var _0x9468ed=_['isNil'](_0x41f934[_0xd9d5('0x26')])?util[_0xd9d5('0x24')](_0xd9d5('0x25'),_0x41f934[_0xd9d5('0x27')]):_0x41f934[_0xd9d5('0x26')];return _0x9468ed;});for(var _0x386265 in _0x2201cc){if(_0x2201cc['hasOwnProperty'](_0x386265)){if(!_0x4a3cc5[_0x386265]){delete _0x2201cc[_0x386265];}}}}function clearVoiceCallReports(_0x3677c6){_0x3677c6['total']=0x0;_0x3677c6[_0xd9d5('0x28')]=0x0;_0x3677c6[_0xd9d5('0x29')]=0x0;_0x3677c6[_0xd9d5('0x2a')]=0x0;_0x3677c6[_0xd9d5('0x2b')]=0x0;}function clearCampaigns(_0x31984d){if(!_[_0xd9d5('0x2c')](_0x31984d)){for(var _0x3c039e in _0x31984d){if(_0x31984d[_0xd9d5('0x23')](_0x3c039e)){_0x31984d[_0x3c039e][_0xd9d5('0x2d')]=0x0;_0x31984d[_0x3c039e]['ivrAnswerCallsDay']=0x0;}}}}function clearVoiceQueues(_0x2eac6a){if(!_[_0xd9d5('0x2c')](_0x2eac6a)){for(var _0x2f27e4 in _0x2eac6a){if(_0x2eac6a['hasOwnProperty'](_0x2f27e4)){_0x2eac6a[_0x2f27e4][_0xd9d5('0x2e')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x28')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x2f')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x30')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x29')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x2a')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x2b')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x31')]=0x0;_0x2eac6a[_0x2f27e4]['outboundNoAnswerCallsDay']=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x32')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x33')]=0x0;_0x2eac6a[_0x2f27e4]['outboundNoSuchCallsDay']=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x34')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x35')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x36')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x37')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x38')]=0x0;_0x2eac6a[_0x2f27e4]['outboundRejectCallsDay']=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x39')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x31')]=0x0;_0x2eac6a[_0x2f27e4][_0xd9d5('0x3a')]=0x0;_0x2eac6a[_0x2f27e4]['queueStatusComplete']=!![];}}}}Realtime[_0xd9d5('0x3b')][_0xd9d5('0x3c')]=function(_0x53f307,_0x442c92){for(var _0x2b6ea9 in _0x442c92){if(_0x53f307['hasOwnProperty'](_0x2b6ea9)){_0x53f307[_0x2b6ea9]=_0x442c92[_0x2b6ea9];}}};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x3d')]=function(){var _0x53409a=this;return function(_0x427806){if(_0x427806){freeIsNotKeyAgent(_0x427806,_0x53409a['agents']);for(var _0x3948bc=0x0,_0x1398b2={},_0xf41920={};_0x3948bc<_0x427806['length'];_0x3948bc+=0x1){_0x1398b2=_0x427806[_0x3948bc];var _0x56c6c2=_['isNil'](_0x1398b2[_0xd9d5('0x26')])?util[_0xd9d5('0x24')]('SIP/%s',_0x1398b2[_0xd9d5('0x27')]):_0x1398b2[_0xd9d5('0x26')];if(_[_0xd9d5('0x3e')](_0x53409a['agents'][_0x56c6c2])){_0x53409a[_0xd9d5('0x3f')][_0x56c6c2]=new Agent(_0x1398b2);}else{_0x53409a[_0xd9d5('0x3c')](_0x53409a[_0xd9d5('0x3f')][_0x56c6c2],_0x1398b2);}}}return _0x53409a[_0xd9d5('0x3f')];};};Realtime[_0xd9d5('0x3b')]['initTelephones']=function(){var _0x4d5ef2=this;return function(_0x3dda93){if(_0x3dda93){freeIsNotKeySip(_0x3dda93,_0x4d5ef2[_0xd9d5('0x40')]);for(var _0x768f82=0x0,_0x14a450={},_0x2e01ae={};_0x768f82<_0x3dda93['length'];_0x768f82+=0x1){_0x14a450=_0x3dda93[_0x768f82];if(_['isUndefined'](_0x4d5ef2[_0xd9d5('0x40')][util['format'](_0xd9d5('0x25'),_0x14a450['name'])])){_0x4d5ef2[_0xd9d5('0x40')][util[_0xd9d5('0x24')](_0xd9d5('0x25'),_0x14a450[_0xd9d5('0x27')])]=new Telephone(_0x14a450);}else{_0x4d5ef2['mergeFromDatabase'](_0x4d5ef2[_0xd9d5('0x40')][util[_0xd9d5('0x24')]('SIP/%s',_0x14a450[_0xd9d5('0x27')])],_0x14a450);}}}return _0x4d5ef2[_0xd9d5('0x40')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x41')]=function(){var _0x4875bb=this;return function(_0x5919f3){if(_0x5919f3){freeIsNotKeySip(_0x5919f3,_0x4875bb[_0xd9d5('0x11')]);for(var _0x459b19=0x0,_0x36218a={},_0x10d736={};_0x459b19<_0x5919f3['length'];_0x459b19+=0x1){_0x36218a=_0x5919f3[_0x459b19];if(_[_0xd9d5('0x3e')](_0x4875bb[_0xd9d5('0x11')][util[_0xd9d5('0x24')](_0xd9d5('0x25'),_0x36218a[_0xd9d5('0x27')])])){_0x4875bb[_0xd9d5('0x11')][util[_0xd9d5('0x24')]('SIP/%s',_0x36218a[_0xd9d5('0x27')])]=new Trunk(_0x36218a);}else{_0x4875bb[_0xd9d5('0x3c')](_0x4875bb[_0xd9d5('0x11')][util[_0xd9d5('0x24')](_0xd9d5('0x25'),_0x36218a[_0xd9d5('0x27')])],_0x36218a);}}}return _0x4875bb[_0xd9d5('0x11')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x42')]=function(){var _0x2bc7e6=this;return function(_0x3ab9b2){if(_0x3ab9b2){freeIsNotKey(_0x3ab9b2,_0x2bc7e6[_0xd9d5('0x12')],_0xd9d5('0x27'));for(var _0x592889=0x0,_0x133bdb={},_0x20ea7f={};_0x592889<_0x3ab9b2[_0xd9d5('0x43')];_0x592889+=0x1){_0x133bdb=_0x3ab9b2[_0x592889];if(_[_0xd9d5('0x3e')](_0x2bc7e6[_0xd9d5('0x12')][_0x133bdb[_0xd9d5('0x27')]])){_0x2bc7e6[_0xd9d5('0x12')][_0x133bdb['name']]=new VoiceQueue(_0x133bdb);}else{_0x2bc7e6[_0xd9d5('0x3c')](_0x2bc7e6[_0xd9d5('0x12')][_0x133bdb['name']],_0x133bdb);}}}return _0x2bc7e6['voiceQueues'];};};Realtime['prototype'][_0xd9d5('0x44')]=function(){var _0x414940=this;return function(_0x2a3b31){if(_0x2a3b31){freeIsNotKey(_0x2a3b31,_0x414940['triggers'],'id');for(var _0x59e62f=0x0,_0x54b8f2={},_0x342544={};_0x59e62f<_0x2a3b31[_0xd9d5('0x43')];_0x59e62f+=0x1){_0x54b8f2=_0x2a3b31[_0x59e62f];if(_[_0xd9d5('0x3e')](_0x414940[_0xd9d5('0x13')][_0x54b8f2['id']])){_0x414940['triggers'][_0x54b8f2['id']]=new Trigger(_0x54b8f2);}else{_0x414940[_0xd9d5('0x3c')](_0x414940['triggers'][_0x54b8f2['id']],_0x54b8f2);}}}return _0x414940['triggers'];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x45')]=function(){var _0x4c3079=this;return function(_0x114014){if(_0x114014){freeIsNotKey(_0x114014,_0x4c3079['templates'],'id');for(var _0x411715=0x0,_0x326736={},_0x28f5e6={};_0x411715<_0x114014[_0xd9d5('0x43')];_0x411715+=0x1){_0x326736=_0x114014[_0x411715];if(_['isUndefined'](_0x4c3079[_0xd9d5('0x46')][_0x326736['id']])){_0x4c3079['templates'][_0x326736['id']]=new Template(_0x326736);}else{_0x4c3079[_0xd9d5('0x3c')](_0x4c3079[_0xd9d5('0x46')][_0x326736['id']],_0x326736);}}}return _0x4c3079[_0xd9d5('0x46')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x47')]=function(){var _0x7eee5a=this;return function(_0x6c51b9){if(_0x6c51b9){freeIsNotKey(_0x6c51b9,_0x7eee5a['zendeskAccounts'],'id');for(var _0x50aa38=0x0,_0xfe25d7={},_0x384643={};_0x50aa38<_0x6c51b9['length'];_0x50aa38+=0x1){_0xfe25d7=_0x6c51b9[_0x50aa38];if(_[_0xd9d5('0x3e')](_0x7eee5a[_0xd9d5('0x48')][_0xfe25d7['id']])){_0x7eee5a['zendeskAccounts'][_0xfe25d7['id']]=new ZendeskAccount(_0xfe25d7);}else{_0x7eee5a[_0xd9d5('0x3c')](_0x7eee5a[_0xd9d5('0x48')][_0xfe25d7['id']],_0xfe25d7);}}}return _0x7eee5a[_0xd9d5('0x48')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x49')]=function(){var _0x1250af=this;return function(_0x22d08b){if(_0x22d08b){freeIsNotKey(_0x22d08b,_0x1250af[_0xd9d5('0x1b')],'id');for(var _0xb9ae68=0x0,_0x22c2f8={},_0x49c16e={};_0xb9ae68<_0x22d08b[_0xd9d5('0x43')];_0xb9ae68+=0x1){_0x22c2f8=_0x22d08b[_0xb9ae68];if(_[_0xd9d5('0x3e')](_0x1250af[_0xd9d5('0x1b')][_0x22c2f8['id']])){_0x1250af[_0xd9d5('0x1b')][_0x22c2f8['id']]=new SalesforceAccount(_0x22c2f8);}else{_0x1250af[_0xd9d5('0x3c')](_0x1250af[_0xd9d5('0x1b')][_0x22c2f8['id']],_0x22c2f8);}}}return _0x1250af[_0xd9d5('0x1b')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x4a')]=function(){var _0x173e44=this;return function(_0x5c5f87){if(_0x5c5f87){freeIsNotKey(_0x5c5f87,_0x173e44[_0xd9d5('0x1d')],'id');for(var _0x4dc801=0x0,_0x106ffb={},_0x201479={};_0x4dc801<_0x5c5f87[_0xd9d5('0x43')];_0x4dc801+=0x1){_0x106ffb=_0x5c5f87[_0x4dc801];if(_[_0xd9d5('0x3e')](_0x173e44[_0xd9d5('0x1d')][_0x106ffb['id']])){_0x173e44[_0xd9d5('0x1d')][_0x106ffb['id']]=new FreshdeskAccount(_0x106ffb);}else{_0x173e44[_0xd9d5('0x3c')](_0x173e44[_0xd9d5('0x1d')][_0x106ffb['id']],_0x106ffb);}}}return _0x173e44['freshdeskAccounts'];};};Realtime['prototype'][_0xd9d5('0x4b')]=function(){var _0xa2852c=this;return function(_0x2a2b70){if(_0x2a2b70){freeIsNotKey(_0x2a2b70,_0xa2852c[_0xd9d5('0x1e')],'id');for(var _0x1abea6=0x0,_0x33cf1d={},_0x275212={};_0x1abea6<_0x2a2b70[_0xd9d5('0x43')];_0x1abea6+=0x1){_0x33cf1d=_0x2a2b70[_0x1abea6];if(_['isUndefined'](_0xa2852c[_0xd9d5('0x1e')][_0x33cf1d['id']])){_0xa2852c[_0xd9d5('0x1e')][_0x33cf1d['id']]=new ZohoAccount(_0x33cf1d);}else{_0xa2852c[_0xd9d5('0x3c')](_0xa2852c[_0xd9d5('0x1e')][_0x33cf1d['id']],_0x33cf1d);}}}return _0xa2852c[_0xd9d5('0x1e')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x4c')]=function(){var _0x3383e3=this;return function(_0x8ad8b7){if(_0x8ad8b7){freeIsNotKey(_0x8ad8b7,_0x3383e3[_0xd9d5('0x4d')],'id');for(var _0x3a44c9=0x0,_0x1ef7de={},_0x2e56b9={};_0x3a44c9<_0x8ad8b7['length'];_0x3a44c9+=0x1){_0x1ef7de=_0x8ad8b7[_0x3a44c9];if(_[_0xd9d5('0x3e')](_0x3383e3['deskAccounts'][_0x1ef7de['id']])){_0x3383e3[_0xd9d5('0x4d')][_0x1ef7de['id']]=new DeskAccount(_0x1ef7de);}else{_0x3383e3[_0xd9d5('0x3c')](_0x3383e3[_0xd9d5('0x4d')][_0x1ef7de['id']],_0x1ef7de);}}}return _0x3383e3[_0xd9d5('0x4d')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x4e')]=function(){var _0x54cb11=this;return function(_0xb4e333){if(_0xb4e333){freeIsNotKey(_0xb4e333,_0x54cb11[_0xd9d5('0x1c')],'id');for(var _0x206fb0=0x0,_0xa3c705={},_0x327f2d={};_0x206fb0<_0xb4e333[_0xd9d5('0x43')];_0x206fb0+=0x1){_0xa3c705=_0xb4e333[_0x206fb0];if(_['isUndefined'](_0x54cb11[_0xd9d5('0x1c')][_0xa3c705['id']])){_0x54cb11[_0xd9d5('0x1c')][_0xa3c705['id']]=new SugarcrmAccount(_0xa3c705);}else{_0x54cb11[_0xd9d5('0x3c')](_0x54cb11[_0xd9d5('0x1c')][_0xa3c705['id']],_0xa3c705);}}}return _0x54cb11[_0xd9d5('0x1c')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x4f')]=function(){var _0x271eba=this;return function(_0x3eb136){if(_0x3eb136){freeIsNotKey(_0x3eb136,_0x271eba['vtigerAccounts'],'id');for(var _0x59c66f=0x0,_0x2108c1={},_0x436920={};_0x59c66f<_0x3eb136['length'];_0x59c66f+=0x1){_0x2108c1=_0x3eb136[_0x59c66f];if(_['isUndefined'](_0x271eba[_0xd9d5('0x50')][_0x2108c1['id']])){_0x271eba[_0xd9d5('0x50')][_0x2108c1['id']]=new VtigerAccount(_0x2108c1);}else{_0x271eba[_0xd9d5('0x3c')](_0x271eba[_0xd9d5('0x50')][_0x2108c1['id']],_0x2108c1);}}}return _0x271eba[_0xd9d5('0x50')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x51')]=function(){var _0x1372b6=this;return function(_0x2a5881){if(_0x2a5881){freeIsNotKey(_0x2a5881,_0x1372b6[_0xd9d5('0x52')],'id');for(var _0x5629b6=0x0,_0xe9b3c8={},_0x2c3ea1={};_0x5629b6<_0x2a5881[_0xd9d5('0x43')];_0x5629b6+=0x1){_0xe9b3c8=_0x2a5881[_0x5629b6];if(_[_0xd9d5('0x3e')](_0x1372b6[_0xd9d5('0x52')][_0xe9b3c8['id']])){_0x1372b6[_0xd9d5('0x52')][_0xe9b3c8['id']]=new ServicenowAccount(_0xe9b3c8);}else{_0x1372b6[_0xd9d5('0x3c')](_0x1372b6['servicenowAccounts'][_0xe9b3c8['id']],_0xe9b3c8);}}}return _0x1372b6[_0xd9d5('0x52')];};};Realtime['prototype'][_0xd9d5('0x53')]=function(){var _0x21f198=this;return function(_0x2d2f0c){if(_0x2d2f0c){freeIsNotKey(_0x2d2f0c,_0x21f198['dynamics365Accounts'],'id');for(var _0x3bdb53=0x0,_0x5ed8c8={},_0x28da31={};_0x3bdb53<_0x2d2f0c['length'];_0x3bdb53+=0x1){_0x5ed8c8=_0x2d2f0c[_0x3bdb53];if(_[_0xd9d5('0x3e')](_0x21f198[_0xd9d5('0x1f')][_0x5ed8c8['id']])){_0x21f198['dynamics365Accounts'][_0x5ed8c8['id']]=new Dynamics365Account(_0x5ed8c8);}else{_0x21f198[_0xd9d5('0x3c')](_0x21f198['dynamics365Accounts'][_0x5ed8c8['id']],_0x5ed8c8);}}}return _0x21f198[_0xd9d5('0x1f')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x54')]=function(){var _0x454342=this;return function(_0x3fb838){if(_0x3fb838){freeIsNotKey(_0x3fb838,_0x454342['freshsalesAccounts'],'id');for(var _0x5c247a=0x0,_0x47d7c5={},_0x28a68c={};_0x5c247a<_0x3fb838[_0xd9d5('0x43')];_0x5c247a+=0x1){_0x47d7c5=_0x3fb838[_0x5c247a];if(_[_0xd9d5('0x3e')](_0x454342['freshsalesAccounts'][_0x47d7c5['id']])){_0x454342[_0xd9d5('0x20')][_0x47d7c5['id']]=new FreshsalesAccount(_0x47d7c5);}else{_0x454342[_0xd9d5('0x3c')](_0x454342[_0xd9d5('0x20')][_0x47d7c5['id']],_0x47d7c5);}}}return _0x454342[_0xd9d5('0x20')];};};Realtime['prototype'][_0xd9d5('0x55')]=function(){var _0x4cbe92=this;return function(_0x42a907){for(var _0x5229fb=0x0;_0x5229fb<_0x42a907['length'];_0x5229fb+=0x1){_[_0xd9d5('0x56')](_0x4cbe92[_0xd9d5('0x12')][_0x42a907[_0x5229fb][_0xd9d5('0x27')]],_0x42a907[_0x5229fb]);}return _0x4cbe92['voiceQueues'];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x57')]=function(){var _0x34e939=this;return function(_0x1136c1){clearVoiceQueues(_0x34e939['voiceQueues']);if(_0x1136c1){_0x1136c1=_[_0xd9d5('0x58')](_0x1136c1,_0xd9d5('0x59'));for(var _0x5eb38d in _0x1136c1){if(_0x1136c1['hasOwnProperty'](_0x5eb38d)){var _0xfae757={};for(var _0x7661e5=0x0;_0x7661e5<_0x1136c1[_0x5eb38d][_0xd9d5('0x43')];_0x7661e5+=0x1){var _0x3f2326=_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x5a')];if(_0x34e939[_0xd9d5('0x12')][_0x3f2326]){if(_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x5b')]){_0x34e939[_0xd9d5('0x12')][_0x3f2326][_0xd9d5('0x2f')]+=0x1;}if(_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x5c')]){_0x34e939['voiceQueues'][_0x3f2326]['abandoned']+=0x1;}_0x34e939[_0xd9d5('0x12')][_0x3f2326][_0xd9d5('0x29')]+=moment(_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x5d')])['diff'](moment(_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x5e')]),'seconds')||0x0;if(_0x7661e5===_0x1136c1[_0x5eb38d][_0xd9d5('0x43')]-0x1){_0x34e939[_0xd9d5('0x12')][_0x3f2326][_0xd9d5('0x2a')]+=moment(_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x5f')]||_0x1136c1[_0x5eb38d][_0x7661e5]['queuecallerabandonAt']||_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x60')])[_0xd9d5('0x61')](moment(_0x1136c1[_0x5eb38d][_0x7661e5]['queuecallerjoinAt']),_0xd9d5('0x62'))||0x0;_0x34e939[_0xd9d5('0x12')][_0x3f2326]['total']+=0x1;if(_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x63')]){_0x34e939[_0xd9d5('0x12')][_0x3f2326][_0xd9d5('0x28')]+=0x1;_0x34e939['voiceQueues'][_0x3f2326][_0xd9d5('0x2b')]+=moment(_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x5f')])[_0xd9d5('0x61')](moment(_0x1136c1[_0x5eb38d][_0x7661e5][_0xd9d5('0x5d')]),_0xd9d5('0x62'))||0x0;}}else{_0x34e939[_0xd9d5('0x12')][_0x3f2326]['sumDuration']+=_0x34e939[_0xd9d5('0x12')][_0x3f2326]['sumHoldTime']||0x0;}}}}}}return _0x34e939[_0xd9d5('0x12')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x64')]=function(){var _0xe92f84=this;return function(_0x353551){clearVoiceCallReports(_0xe92f84[_0xd9d5('0x15')]);if(_0x353551){for(var _0x201039=0x0;_0x201039<_0x353551[_0xd9d5('0x43')];_0x201039+=0x1){_0xe92f84[_0xd9d5('0x15')][_0xd9d5('0x2e')]+=0x1;_0xe92f84[_0xd9d5('0x15')]['sumDuration']+=_0x353551[_0x201039][_0xd9d5('0x65')];if(_0x353551[_0x201039][_0xd9d5('0x66')]===_0xd9d5('0x67')){_0xe92f84[_0xd9d5('0x15')]['answered']+=0x1;_0xe92f84[_0xd9d5('0x15')][_0xd9d5('0x29')]+=_0x353551[_0x201039][_0xd9d5('0x65')]-_0x353551[_0x201039][_0xd9d5('0x68')]||0x0;_0xe92f84['outbound'][_0xd9d5('0x2b')]+=_0x353551[_0x201039]['billableseconds'];}}}return _0xe92f84[_0xd9d5('0x15')];};};Realtime['prototype'][_0xd9d5('0x69')]=function(){var _0x46d0c5=this;return function(_0x5cfcdd){if(_0x5cfcdd){freeIsNotKey(_0x5cfcdd,_0x46d0c5[_0xd9d5('0x14')],_0xd9d5('0x27'));for(var _0x79f550=0x0,_0x1cd10e={};_0x79f550<_0x5cfcdd[_0xd9d5('0x43')];_0x79f550+=0x1){_0x1cd10e=_0x5cfcdd[_0x79f550];if(_[_0xd9d5('0x3e')](_0x46d0c5[_0xd9d5('0x14')][_0x1cd10e[_0xd9d5('0x27')]])){_0x46d0c5[_0xd9d5('0x14')][_0x1cd10e[_0xd9d5('0x27')]]=new Campaign(_0x1cd10e);}else{_0x46d0c5[_0xd9d5('0x3c')](_0x46d0c5[_0xd9d5('0x14')][_0x1cd10e['name']],_0x1cd10e);_0x46d0c5['campaigns'][_0x1cd10e[_0xd9d5('0x27')]][_0xd9d5('0x6a')]=_0x1cd10e['SquareProject']?_0x1cd10e[_0xd9d5('0x6b')][_0xd9d5('0x27')]:undefined;}}}return _0x46d0c5[_0xd9d5('0x14')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x6c')]=function(){var _0x10c759=this;return function(_0x3ea82b){if(_0x3ea82b){freeIsNotKey(_0x3ea82b,_0x10c759[_0xd9d5('0x16')],'id');for(var _0x2359b2=0x0,_0x116646={};_0x2359b2<_0x3ea82b['length'];_0x2359b2+=0x1){_0x116646=_0x3ea82b[_0x2359b2];if(_[_0xd9d5('0x3e')](_0x10c759[_0xd9d5('0x16')][_0x116646['id']])){_0x10c759['voiceExtensions'][_0x116646['id']]=new VoiceExtension(_0x116646);}else{_0x10c759[_0xd9d5('0x3c')](_0x10c759[_0xd9d5('0x16')][_0x116646['id']],_0x116646);}}}return _0x10c759[_0xd9d5('0x16')];};};Realtime[_0xd9d5('0x3b')][_0xd9d5('0x6d')]=function(){var _0xf4e006=this;return function(_0x532b3c){clearCampaigns(_0xf4e006[_0xd9d5('0x14')]);for(var _0x3c838a=0x0;_0x3c838a<_0x532b3c[_0xd9d5('0x43')];_0x3c838a+=0x1){_['merge'](_0xf4e006['campaigns'][_0x532b3c[_0x3c838a][_0xd9d5('0x27')]],_0x532b3c[_0x3c838a]);}return _0xf4e006[_0xd9d5('0x14')];};};Realtime['prototype'][_0xd9d5('0x6e')]=function(){var _0x5ead23=this;return function(_0x51988e){if(_0x51988e){freeIsNotKey(_0x51988e,_0x5ead23[_0xd9d5('0x21')],'id');for(var _0x3defa1=0x0,_0x1cf52d={},_0x5f0b0a={};_0x3defa1<_0x51988e['length'];_0x3defa1+=0x1){_0x1cf52d=_0x51988e[_0x3defa1];if(_[_0xd9d5('0x3e')](_0x5ead23[_0xd9d5('0x21')][_0x1cf52d['id']])){_0x5ead23[_0xd9d5('0x21')][_0x1cf52d['id']]=new FaxAccount(_0x1cf52d);}else{_0x5ead23[_0xd9d5('0x3c')](_0x5ead23[_0xd9d5('0x21')][_0x1cf52d['id']],_0x1cf52d);}}}return _0x5ead23[_0xd9d5('0x21')];};};module[_0xd9d5('0x6f')]=Realtime; \ No newline at end of file +var _0xcaae=['groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','queuecallerleaveAt','diff','queuecallerjoinAt','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallercomplete','queuecallercompleteAt','ANSWERED','duration','billableseconds','campaigns','dialQueueProject','SquareProject','initVoiceExtensions','initFaxAccounts','faxAccounts','exports','bluebird','util','lodash','moment','../model/agent','../model/telephone','../model/voiceQueue','../model/trigger','../model/template','../model/campaign','../model/voiceExtension','../model/salesforceAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/faxAccount','telephones','trunks','voiceQueues','triggers','templates','outbound','voiceExtensions','queueChannels','outboundChannels','timers','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','freshsalesAccounts','mapKeys','hasOwnProperty','format','SIP/%s','name','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','abandoned','sumDuration','outboundNoAnswerCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundDropCallsDayTimeout','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundReCallsDay','outboundAnswerCallsDay','prototype','mergeFromDatabase','initAgents','agents','length','isNil','isUndefined','initTelephones','initVoiceQueues','initTriggers','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','freshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','servicenowAccounts','initDynamics365Accounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports'];(function(_0x3cdcfb,_0x161e5c){var _0x59f5da=function(_0x337416){while(--_0x337416){_0x3cdcfb['push'](_0x3cdcfb['shift']());}};_0x59f5da(++_0x161e5c);}(_0xcaae,0xef));var _0xecaa=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcaae[_0x3dd15e];return _0x231fd0;};'use strict';var BPromise=require(_0xecaa('0x0'));var util=require(_0xecaa('0x1'));var _=require(_0xecaa('0x2'));var moment=require(_0xecaa('0x3'));var Agent=require(_0xecaa('0x4'));var Telephone=require(_0xecaa('0x5'));var Trunk=require('../model/trunk');var VoiceQueue=require(_0xecaa('0x6'));var Trigger=require(_0xecaa('0x7'));var Template=require(_0xecaa('0x8'));var Campaign=require(_0xecaa('0x9'));var VoiceExtension=require(_0xecaa('0xa'));var ZendeskAccount=require('../model/zendeskAccount');var SalesforceAccount=require(_0xecaa('0xb'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require(_0xecaa('0xc'));var ZohoAccount=require(_0xecaa('0xd'));var DeskAccount=require('../model/deskAccount');var VtigerAccount=require(_0xecaa('0xe'));var ServicenowAccount=require(_0xecaa('0xf'));var Dynamics365Account=require(_0xecaa('0x10'));var FreshsalesAccount=require('../model/freshsalesAccount');var FaxAccount=require(_0xecaa('0x11'));var Realtime=function(){this['agents']={};this[_0xecaa('0x12')]={};this[_0xecaa('0x13')]={};this[_0xecaa('0x14')]={};this[_0xecaa('0x15')]={};this['campaigns']={};this[_0xecaa('0x16')]={};this[_0xecaa('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this[_0xecaa('0x18')]={};this['channels']={};this[_0xecaa('0x19')]={};this[_0xecaa('0x1a')]={};this[_0xecaa('0x1b')]={};this[_0xecaa('0x1c')]={};this[_0xecaa('0x1d')]={};this[_0xecaa('0x1e')]={};this[_0xecaa('0x1f')]={};this['freshdeskAccounts']={};this[_0xecaa('0x20')]={};this[_0xecaa('0x21')]={};this['vtigerAccounts']={};this['servicenowAccounts']={};this['dynamics365Accounts']={};this[_0xecaa('0x22')]={};this['faxAccounts']={};};function freeIsNotKey(_0x411e0c,_0x239b4e,_0x19ab13){var _0xd7d6d3=_[_0xecaa('0x23')](_0x411e0c,function(_0x176684,_0xae5634){return _0x176684[_0x19ab13];});for(var _0x102970 in _0x239b4e){if(_0x239b4e[_0xecaa('0x24')](_0x102970)){if(!_0xd7d6d3[_0x102970]){delete _0x239b4e[_0x102970];}}}}function freeIsNotKeySip(_0x5ee7a0,_0x422b06){var _0x58ce05=_[_0xecaa('0x23')](_0x5ee7a0,function(_0x2c6104,_0x3905ec){return util[_0xecaa('0x25')](_0xecaa('0x26'),_0x2c6104[_0xecaa('0x27')]);});for(var _0x5550a0 in _0x422b06){if(_0x422b06[_0xecaa('0x24')](_0x5550a0)){if(!_0x58ce05[_0x5550a0]){delete _0x422b06[_0x5550a0];}}}}function freeIsNotKeyAgent(_0x4e7ee1,_0x3b4cf1){var _0x4aebc4=_['mapKeys'](_0x4e7ee1,function(_0x193cc5,_0x34868e){var _0x3c094a=_['isNil'](_0x193cc5[_0xecaa('0x28')])?util['format'](_0xecaa('0x26'),_0x193cc5[_0xecaa('0x27')]):_0x193cc5[_0xecaa('0x28')];return _0x3c094a;});for(var _0x28e2bb in _0x3b4cf1){if(_0x3b4cf1['hasOwnProperty'](_0x28e2bb)){if(!_0x4aebc4[_0x28e2bb]){delete _0x3b4cf1[_0x28e2bb];}}}}function clearVoiceCallReports(_0xdd30b5){_0xdd30b5[_0xecaa('0x29')]=0x0;_0xdd30b5[_0xecaa('0x2a')]=0x0;_0xdd30b5[_0xecaa('0x2b')]=0x0;_0xdd30b5['sumDuration']=0x0;_0xdd30b5[_0xecaa('0x2c')]=0x0;}function clearCampaigns(_0x4d7a65){if(!_[_0xecaa('0x2d')](_0x4d7a65)){for(var _0x5094b1 in _0x4d7a65){if(_0x4d7a65[_0xecaa('0x24')](_0x5094b1)){_0x4d7a65[_0x5094b1][_0xecaa('0x2e')]=0x0;_0x4d7a65[_0x5094b1][_0xecaa('0x2f')]=0x0;}}}}function clearVoiceQueues(_0x5ee9e2){if(!_[_0xecaa('0x2d')](_0x5ee9e2)){for(var _0x4efe00 in _0x5ee9e2){if(_0x5ee9e2[_0xecaa('0x24')](_0x4efe00)){_0x5ee9e2[_0x4efe00]['total']=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x2a')]=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x30')]=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x31')]=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x2b')]=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x32')]=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x2c')]=0x0;_0x5ee9e2[_0x4efe00]['outboundAnswerAgiCallsDay']=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x33')]=0x0;_0x5ee9e2[_0x4efe00]['outboundBusyCallsDay']=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x34')]=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x35')]=0x0;_0x5ee9e2[_0x4efe00]['outboundUnknownCallsDay']=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x36')]=0x0;_0x5ee9e2[_0x4efe00]['outboundDropCallsDayCallersExit']=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x37')]=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x38')]=0x0;_0x5ee9e2[_0x4efe00]['outboundRejectCallsDay']=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x39')]=0x0;_0x5ee9e2[_0x4efe00]['outboundAnswerAgiCallsDay']=0x0;_0x5ee9e2[_0x4efe00][_0xecaa('0x3a')]=0x0;_0x5ee9e2[_0x4efe00]['queueStatusComplete']=!![];}}}}Realtime[_0xecaa('0x3b')][_0xecaa('0x3c')]=function(_0x31fa13,_0x472d8d){for(var _0x2092fe in _0x472d8d){if(_0x31fa13[_0xecaa('0x24')](_0x2092fe)){_0x31fa13[_0x2092fe]=_0x472d8d[_0x2092fe];}}};Realtime['prototype'][_0xecaa('0x3d')]=function(){var _0x31e537=this;return function(_0x2a428a){if(_0x2a428a){freeIsNotKeyAgent(_0x2a428a,_0x31e537[_0xecaa('0x3e')]);for(var _0x95a565=0x0,_0x190904={},_0x4bc3af={};_0x95a565<_0x2a428a[_0xecaa('0x3f')];_0x95a565+=0x1){_0x190904=_0x2a428a[_0x95a565];var _0x2f69c0=_[_0xecaa('0x40')](_0x190904[_0xecaa('0x28')])?util[_0xecaa('0x25')](_0xecaa('0x26'),_0x190904[_0xecaa('0x27')]):_0x190904['interface'];if(_[_0xecaa('0x41')](_0x31e537[_0xecaa('0x3e')][_0x2f69c0])){_0x31e537[_0xecaa('0x3e')][_0x2f69c0]=new Agent(_0x190904);}else{_0x31e537['mergeFromDatabase'](_0x31e537[_0xecaa('0x3e')][_0x2f69c0],_0x190904);}}}return _0x31e537['agents'];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x42')]=function(){var _0x42f232=this;return function(_0x488fbe){if(_0x488fbe){freeIsNotKeySip(_0x488fbe,_0x42f232[_0xecaa('0x12')]);for(var _0x777ba1=0x0,_0xf04453={},_0x3808a7={};_0x777ba1<_0x488fbe[_0xecaa('0x3f')];_0x777ba1+=0x1){_0xf04453=_0x488fbe[_0x777ba1];if(_[_0xecaa('0x41')](_0x42f232[_0xecaa('0x12')][util[_0xecaa('0x25')](_0xecaa('0x26'),_0xf04453[_0xecaa('0x27')])])){_0x42f232[_0xecaa('0x12')][util[_0xecaa('0x25')](_0xecaa('0x26'),_0xf04453[_0xecaa('0x27')])]=new Telephone(_0xf04453);}else{_0x42f232['mergeFromDatabase'](_0x42f232[_0xecaa('0x12')][util['format'](_0xecaa('0x26'),_0xf04453['name'])],_0xf04453);}}}return _0x42f232[_0xecaa('0x12')];};};Realtime[_0xecaa('0x3b')]['initTrunks']=function(){var _0x2571be=this;return function(_0x4961f1){if(_0x4961f1){freeIsNotKeySip(_0x4961f1,_0x2571be[_0xecaa('0x13')]);for(var _0x2a8b76=0x0,_0x93d245={},_0x44ca0c={};_0x2a8b76<_0x4961f1[_0xecaa('0x3f')];_0x2a8b76+=0x1){_0x93d245=_0x4961f1[_0x2a8b76];if(_[_0xecaa('0x41')](_0x2571be[_0xecaa('0x13')][util[_0xecaa('0x25')]('SIP/%s',_0x93d245[_0xecaa('0x27')])])){_0x2571be[_0xecaa('0x13')][util[_0xecaa('0x25')](_0xecaa('0x26'),_0x93d245['name'])]=new Trunk(_0x93d245);}else{_0x2571be[_0xecaa('0x3c')](_0x2571be[_0xecaa('0x13')][util['format'](_0xecaa('0x26'),_0x93d245[_0xecaa('0x27')])],_0x93d245);}}}return _0x2571be[_0xecaa('0x13')];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x43')]=function(){var _0x3a11f4=this;return function(_0x3f4816){if(_0x3f4816){freeIsNotKey(_0x3f4816,_0x3a11f4['voiceQueues'],'name');for(var _0x5988ea=0x0,_0x51b90b={},_0x15cf4e={};_0x5988ea<_0x3f4816[_0xecaa('0x3f')];_0x5988ea+=0x1){_0x51b90b=_0x3f4816[_0x5988ea];if(_['isUndefined'](_0x3a11f4[_0xecaa('0x14')][_0x51b90b['name']])){_0x3a11f4['voiceQueues'][_0x51b90b['name']]=new VoiceQueue(_0x51b90b);}else{_0x3a11f4['mergeFromDatabase'](_0x3a11f4[_0xecaa('0x14')][_0x51b90b[_0xecaa('0x27')]],_0x51b90b);}}}return _0x3a11f4[_0xecaa('0x14')];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x44')]=function(){var _0x2dbc15=this;return function(_0x41c5ce){if(_0x41c5ce){freeIsNotKey(_0x41c5ce,_0x2dbc15[_0xecaa('0x15')],'id');for(var _0x28206e=0x0,_0x31a643={},_0x590465={};_0x28206e<_0x41c5ce['length'];_0x28206e+=0x1){_0x31a643=_0x41c5ce[_0x28206e];if(_['isUndefined'](_0x2dbc15[_0xecaa('0x15')][_0x31a643['id']])){_0x2dbc15['triggers'][_0x31a643['id']]=new Trigger(_0x31a643);}else{_0x2dbc15[_0xecaa('0x3c')](_0x2dbc15['triggers'][_0x31a643['id']],_0x31a643);}}}return _0x2dbc15[_0xecaa('0x15')];};};Realtime[_0xecaa('0x3b')]['initTemplates']=function(){var _0x3ac628=this;return function(_0x175659){if(_0x175659){freeIsNotKey(_0x175659,_0x3ac628[_0xecaa('0x16')],'id');for(var _0xba203e=0x0,_0x5461ba={},_0x3d1929={};_0xba203e<_0x175659[_0xecaa('0x3f')];_0xba203e+=0x1){_0x5461ba=_0x175659[_0xba203e];if(_[_0xecaa('0x41')](_0x3ac628['templates'][_0x5461ba['id']])){_0x3ac628[_0xecaa('0x16')][_0x5461ba['id']]=new Template(_0x5461ba);}else{_0x3ac628[_0xecaa('0x3c')](_0x3ac628[_0xecaa('0x16')][_0x5461ba['id']],_0x5461ba);}}}return _0x3ac628[_0xecaa('0x16')];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x45')]=function(){var _0xb3d619=this;return function(_0x126b71){if(_0x126b71){freeIsNotKey(_0x126b71,_0xb3d619[_0xecaa('0x1d')],'id');for(var _0xa1e911=0x0,_0x127e13={},_0x485658={};_0xa1e911<_0x126b71['length'];_0xa1e911+=0x1){_0x127e13=_0x126b71[_0xa1e911];if(_[_0xecaa('0x41')](_0xb3d619[_0xecaa('0x1d')][_0x127e13['id']])){_0xb3d619[_0xecaa('0x1d')][_0x127e13['id']]=new ZendeskAccount(_0x127e13);}else{_0xb3d619['mergeFromDatabase'](_0xb3d619[_0xecaa('0x1d')][_0x127e13['id']],_0x127e13);}}}return _0xb3d619[_0xecaa('0x1d')];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x46')]=function(){var _0xc5de2f=this;return function(_0x5845ae){if(_0x5845ae){freeIsNotKey(_0x5845ae,_0xc5de2f['salesforceAccounts'],'id');for(var _0x53b16f=0x0,_0x388548={},_0x45b426={};_0x53b16f<_0x5845ae[_0xecaa('0x3f')];_0x53b16f+=0x1){_0x388548=_0x5845ae[_0x53b16f];if(_[_0xecaa('0x41')](_0xc5de2f[_0xecaa('0x1e')][_0x388548['id']])){_0xc5de2f[_0xecaa('0x1e')][_0x388548['id']]=new SalesforceAccount(_0x388548);}else{_0xc5de2f[_0xecaa('0x3c')](_0xc5de2f[_0xecaa('0x1e')][_0x388548['id']],_0x388548);}}}return _0xc5de2f[_0xecaa('0x1e')];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x47')]=function(){var _0x1022ae=this;return function(_0x249e63){if(_0x249e63){freeIsNotKey(_0x249e63,_0x1022ae['freshdeskAccounts'],'id');for(var _0x17632a=0x0,_0x4e2b69={},_0x10b565={};_0x17632a<_0x249e63[_0xecaa('0x3f')];_0x17632a+=0x1){_0x4e2b69=_0x249e63[_0x17632a];if(_[_0xecaa('0x41')](_0x1022ae['freshdeskAccounts'][_0x4e2b69['id']])){_0x1022ae[_0xecaa('0x48')][_0x4e2b69['id']]=new FreshdeskAccount(_0x4e2b69);}else{_0x1022ae[_0xecaa('0x3c')](_0x1022ae[_0xecaa('0x48')][_0x4e2b69['id']],_0x4e2b69);}}}return _0x1022ae[_0xecaa('0x48')];};};Realtime[_0xecaa('0x3b')]['initZohoAccounts']=function(){var _0x11cfd5=this;return function(_0x385e82){if(_0x385e82){freeIsNotKey(_0x385e82,_0x11cfd5[_0xecaa('0x20')],'id');for(var _0x4800c8=0x0,_0xf7f2a1={},_0x149c15={};_0x4800c8<_0x385e82[_0xecaa('0x3f')];_0x4800c8+=0x1){_0xf7f2a1=_0x385e82[_0x4800c8];if(_['isUndefined'](_0x11cfd5[_0xecaa('0x20')][_0xf7f2a1['id']])){_0x11cfd5[_0xecaa('0x20')][_0xf7f2a1['id']]=new ZohoAccount(_0xf7f2a1);}else{_0x11cfd5[_0xecaa('0x3c')](_0x11cfd5[_0xecaa('0x20')][_0xf7f2a1['id']],_0xf7f2a1);}}}return _0x11cfd5['zohoAccounts'];};};Realtime['prototype'][_0xecaa('0x49')]=function(){var _0x55b573=this;return function(_0x253125){if(_0x253125){freeIsNotKey(_0x253125,_0x55b573[_0xecaa('0x21')],'id');for(var _0x300927=0x0,_0x1730e9={},_0x4aa1ec={};_0x300927<_0x253125[_0xecaa('0x3f')];_0x300927+=0x1){_0x1730e9=_0x253125[_0x300927];if(_[_0xecaa('0x41')](_0x55b573[_0xecaa('0x21')][_0x1730e9['id']])){_0x55b573[_0xecaa('0x21')][_0x1730e9['id']]=new DeskAccount(_0x1730e9);}else{_0x55b573['mergeFromDatabase'](_0x55b573[_0xecaa('0x21')][_0x1730e9['id']],_0x1730e9);}}}return _0x55b573[_0xecaa('0x21')];};};Realtime['prototype'][_0xecaa('0x4a')]=function(){var _0x4f0752=this;return function(_0x3e49ae){if(_0x3e49ae){freeIsNotKey(_0x3e49ae,_0x4f0752[_0xecaa('0x1f')],'id');for(var _0x21ec99=0x0,_0x224a60={},_0x15bbf1={};_0x21ec99<_0x3e49ae[_0xecaa('0x3f')];_0x21ec99+=0x1){_0x224a60=_0x3e49ae[_0x21ec99];if(_[_0xecaa('0x41')](_0x4f0752['sugarcrmAccounts'][_0x224a60['id']])){_0x4f0752['sugarcrmAccounts'][_0x224a60['id']]=new SugarcrmAccount(_0x224a60);}else{_0x4f0752[_0xecaa('0x3c')](_0x4f0752[_0xecaa('0x1f')][_0x224a60['id']],_0x224a60);}}}return _0x4f0752['sugarcrmAccounts'];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x4b')]=function(){var _0x41c5b5=this;return function(_0x5dbe93){if(_0x5dbe93){freeIsNotKey(_0x5dbe93,_0x41c5b5['vtigerAccounts'],'id');for(var _0x50b1b3=0x0,_0x270f79={},_0x514106={};_0x50b1b3<_0x5dbe93[_0xecaa('0x3f')];_0x50b1b3+=0x1){_0x270f79=_0x5dbe93[_0x50b1b3];if(_[_0xecaa('0x41')](_0x41c5b5['vtigerAccounts'][_0x270f79['id']])){_0x41c5b5['vtigerAccounts'][_0x270f79['id']]=new VtigerAccount(_0x270f79);}else{_0x41c5b5['mergeFromDatabase'](_0x41c5b5[_0xecaa('0x4c')][_0x270f79['id']],_0x270f79);}}}return _0x41c5b5['vtigerAccounts'];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x4d')]=function(){var _0x182a15=this;return function(_0x1b347d){if(_0x1b347d){freeIsNotKey(_0x1b347d,_0x182a15['servicenowAccounts'],'id');for(var _0x2b3685=0x0,_0x4c2b4c={},_0x1bb221={};_0x2b3685<_0x1b347d[_0xecaa('0x3f')];_0x2b3685+=0x1){_0x4c2b4c=_0x1b347d[_0x2b3685];if(_[_0xecaa('0x41')](_0x182a15[_0xecaa('0x4e')][_0x4c2b4c['id']])){_0x182a15[_0xecaa('0x4e')][_0x4c2b4c['id']]=new ServicenowAccount(_0x4c2b4c);}else{_0x182a15[_0xecaa('0x3c')](_0x182a15['servicenowAccounts'][_0x4c2b4c['id']],_0x4c2b4c);}}}return _0x182a15[_0xecaa('0x4e')];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x4f')]=function(){var _0x171cbf=this;return function(_0xff9105){if(_0xff9105){freeIsNotKey(_0xff9105,_0x171cbf['dynamics365Accounts'],'id');for(var _0x11b4f1=0x0,_0x154ad5={},_0x416901={};_0x11b4f1<_0xff9105[_0xecaa('0x3f')];_0x11b4f1+=0x1){_0x154ad5=_0xff9105[_0x11b4f1];if(_[_0xecaa('0x41')](_0x171cbf[_0xecaa('0x50')][_0x154ad5['id']])){_0x171cbf[_0xecaa('0x50')][_0x154ad5['id']]=new Dynamics365Account(_0x154ad5);}else{_0x171cbf['mergeFromDatabase'](_0x171cbf[_0xecaa('0x50')][_0x154ad5['id']],_0x154ad5);}}}return _0x171cbf[_0xecaa('0x50')];};};Realtime['prototype'][_0xecaa('0x51')]=function(){var _0x5a9180=this;return function(_0x21e010){if(_0x21e010){freeIsNotKey(_0x21e010,_0x5a9180[_0xecaa('0x22')],'id');for(var _0xdf7d91=0x0,_0x456a9d={},_0x23315b={};_0xdf7d91<_0x21e010[_0xecaa('0x3f')];_0xdf7d91+=0x1){_0x456a9d=_0x21e010[_0xdf7d91];if(_[_0xecaa('0x41')](_0x5a9180[_0xecaa('0x22')][_0x456a9d['id']])){_0x5a9180['freshsalesAccounts'][_0x456a9d['id']]=new FreshsalesAccount(_0x456a9d);}else{_0x5a9180[_0xecaa('0x3c')](_0x5a9180[_0xecaa('0x22')][_0x456a9d['id']],_0x456a9d);}}}return _0x5a9180[_0xecaa('0x22')];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x52')]=function(){var _0x57a04d=this;return function(_0x5588de){for(var _0x5d33b2=0x0;_0x5d33b2<_0x5588de['length'];_0x5d33b2+=0x1){_[_0xecaa('0x53')](_0x57a04d[_0xecaa('0x14')][_0x5588de[_0x5d33b2]['name']],_0x5588de[_0x5d33b2]);}return _0x57a04d[_0xecaa('0x14')];};};Realtime[_0xecaa('0x3b')][_0xecaa('0x54')]=function(){var _0x98aaa=this;return function(_0x1748b9){clearVoiceQueues(_0x98aaa['voiceQueues']);if(_0x1748b9){_0x1748b9=_[_0xecaa('0x55')](_0x1748b9,_0xecaa('0x56'));for(var _0x18315f in _0x1748b9){if(_0x1748b9['hasOwnProperty'](_0x18315f)){var _0x3c32f2={};for(var _0x46724b=0x0;_0x46724b<_0x1748b9[_0x18315f]['length'];_0x46724b+=0x1){var _0x24de53=_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x57')];if(_0x98aaa['voiceQueues'][_0x24de53]){if(_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x58')]){_0x98aaa[_0xecaa('0x14')][_0x24de53][_0xecaa('0x30')]+=0x1;}if(_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x59')]){_0x98aaa[_0xecaa('0x14')][_0x24de53][_0xecaa('0x31')]+=0x1;}_0x98aaa[_0xecaa('0x14')][_0x24de53][_0xecaa('0x2b')]+=moment(_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x5a')])[_0xecaa('0x5b')](moment(_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x5c')]),_0xecaa('0x5d'))||0x0;if(_0x46724b===_0x1748b9[_0x18315f]['length']-0x1){_0x98aaa['voiceQueues'][_0x24de53][_0xecaa('0x32')]+=moment(_0x1748b9[_0x18315f][_0x46724b]['queuecallercompleteAt']||_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x5e')]||_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x5f')])[_0xecaa('0x5b')](moment(_0x1748b9[_0x18315f][_0x46724b]['queuecallerjoinAt']),_0xecaa('0x5d'))||0x0;_0x98aaa[_0xecaa('0x14')][_0x24de53][_0xecaa('0x29')]+=0x1;if(_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x60')]){_0x98aaa[_0xecaa('0x14')][_0x24de53][_0xecaa('0x2a')]+=0x1;_0x98aaa[_0xecaa('0x14')][_0x24de53][_0xecaa('0x2c')]+=moment(_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x61')])[_0xecaa('0x5b')](moment(_0x1748b9[_0x18315f][_0x46724b][_0xecaa('0x5a')]),_0xecaa('0x5d'))||0x0;}}else{_0x98aaa[_0xecaa('0x14')][_0x24de53][_0xecaa('0x32')]+=_0x98aaa[_0xecaa('0x14')][_0x24de53][_0xecaa('0x2b')]||0x0;}}}}}}return _0x98aaa[_0xecaa('0x14')];};};Realtime[_0xecaa('0x3b')]['initVoiceCallReports']=function(){var _0x39e20f=this;return function(_0x9c2c08){clearVoiceCallReports(_0x39e20f[_0xecaa('0x17')]);if(_0x9c2c08){for(var _0xbb7c7c=0x0;_0xbb7c7c<_0x9c2c08[_0xecaa('0x3f')];_0xbb7c7c+=0x1){_0x39e20f[_0xecaa('0x17')][_0xecaa('0x29')]+=0x1;_0x39e20f[_0xecaa('0x17')][_0xecaa('0x32')]+=_0x9c2c08[_0xbb7c7c]['duration'];if(_0x9c2c08[_0xbb7c7c]['disposition']===_0xecaa('0x62')){_0x39e20f[_0xecaa('0x17')][_0xecaa('0x2a')]+=0x1;_0x39e20f[_0xecaa('0x17')][_0xecaa('0x2b')]+=_0x9c2c08[_0xbb7c7c][_0xecaa('0x63')]-_0x9c2c08[_0xbb7c7c][_0xecaa('0x64')]||0x0;_0x39e20f[_0xecaa('0x17')]['sumBillable']+=_0x9c2c08[_0xbb7c7c][_0xecaa('0x64')];}}}return _0x39e20f[_0xecaa('0x17')];};};Realtime[_0xecaa('0x3b')]['initCampaigns']=function(){var _0x48a4b9=this;return function(_0xe0419e){if(_0xe0419e){freeIsNotKey(_0xe0419e,_0x48a4b9[_0xecaa('0x65')],_0xecaa('0x27'));for(var _0x13a951=0x0,_0x41c1a1={};_0x13a951<_0xe0419e['length'];_0x13a951+=0x1){_0x41c1a1=_0xe0419e[_0x13a951];if(_['isUndefined'](_0x48a4b9[_0xecaa('0x65')][_0x41c1a1[_0xecaa('0x27')]])){_0x48a4b9[_0xecaa('0x65')][_0x41c1a1[_0xecaa('0x27')]]=new Campaign(_0x41c1a1);}else{_0x48a4b9[_0xecaa('0x3c')](_0x48a4b9[_0xecaa('0x65')][_0x41c1a1[_0xecaa('0x27')]],_0x41c1a1);_0x48a4b9[_0xecaa('0x65')][_0x41c1a1['name']][_0xecaa('0x66')]=_0x41c1a1[_0xecaa('0x67')]?_0x41c1a1[_0xecaa('0x67')][_0xecaa('0x27')]:undefined;}}}return _0x48a4b9[_0xecaa('0x65')];};};Realtime['prototype'][_0xecaa('0x68')]=function(){var _0x4fe700=this;return function(_0x4637a6){if(_0x4637a6){freeIsNotKey(_0x4637a6,_0x4fe700['voiceExtensions'],'id');for(var _0x1abccd=0x0,_0x492904={};_0x1abccd<_0x4637a6[_0xecaa('0x3f')];_0x1abccd+=0x1){_0x492904=_0x4637a6[_0x1abccd];if(_[_0xecaa('0x41')](_0x4fe700[_0xecaa('0x18')][_0x492904['id']])){_0x4fe700[_0xecaa('0x18')][_0x492904['id']]=new VoiceExtension(_0x492904);}else{_0x4fe700['mergeFromDatabase'](_0x4fe700[_0xecaa('0x18')][_0x492904['id']],_0x492904);}}}return _0x4fe700[_0xecaa('0x18')];};};Realtime['prototype']['initCampaignHopperHistory']=function(){var _0x2757b4=this;return function(_0x7f416e){clearCampaigns(_0x2757b4[_0xecaa('0x65')]);for(var _0x597e89=0x0;_0x597e89<_0x7f416e[_0xecaa('0x3f')];_0x597e89+=0x1){_['merge'](_0x2757b4[_0xecaa('0x65')][_0x7f416e[_0x597e89]['name']],_0x7f416e[_0x597e89]);}return _0x2757b4['campaigns'];};};Realtime['prototype'][_0xecaa('0x69')]=function(){var _0x545523=this;return function(_0x5b1c0b){if(_0x5b1c0b){freeIsNotKey(_0x5b1c0b,_0x545523[_0xecaa('0x6a')],'id');for(var _0x61183d=0x0,_0x6b230b={},_0x1640ae={};_0x61183d<_0x5b1c0b[_0xecaa('0x3f')];_0x61183d+=0x1){_0x6b230b=_0x5b1c0b[_0x61183d];if(_[_0xecaa('0x41')](_0x545523[_0xecaa('0x6a')][_0x6b230b['id']])){_0x545523[_0xecaa('0x6a')][_0x6b230b['id']]=new FaxAccount(_0x6b230b);}else{_0x545523[_0xecaa('0x3c')](_0x545523[_0xecaa('0x6a')][_0x6b230b['id']],_0x6b230b);}}}return _0x545523[_0xecaa('0x6a')];};};module[_0xecaa('0x6b')]=Realtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index 54ada37..20ce8e3 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 _0x5f1a=['name','interface','SIP/%s','lastAssignedTo','format','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','destination','exten','type','dialer','queue','context','from-sip','xcally-motion-preview','calleridpreview','calleridnum','originatecalleridnum','destinationchannel','channel','callerid','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','uniqueid','blindTransfer','monitors','length','monitorFilename','createdAt','connectedlinename','membername','isArray','forEach','startsWith','substring','indexOf','mobile','transfererlinkedid','exports','util','../rpc/voiceAgentReport','../rpc/voiceCallReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','sync','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','voiceDialReport','attendedtransfer','attendedTransfer','findAgent','find','accountcode','isNil'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x5f1a,0x1ba));var _0xa5f1=function(_0x5e1666,_0x10ba44){_0x5e1666=_0x5e1666-0x0;var _0x4bc958=_0x5f1a[_0x5e1666];return _0x4bc958;};'use strict';var _=require('lodash');var moment=require('moment');var util=require(_0xa5f1('0x0'));var config=require('../../../config/environment');var ami=require('../ami');var RpcVoiceAgentReport=require(_0xa5f1('0x1'));var RpcVoiceCallReport=require(_0xa5f1('0x2'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require(_0xa5f1('0x3'));var RpcVoiceQueueReport=require(_0xa5f1('0x4'));var RpcVoiceRecording=require('../rpc/voiceRecording');var RpcVoiceTransferReport=require(_0xa5f1('0x5'));var VoiceQueueReport=require(_0xa5f1('0x6'));var VoiceCallReport=require(_0xa5f1('0x7'));var VoiceAgentReport=require(_0xa5f1('0x8'));var VoiceDialReport=require(_0xa5f1('0x9'));var UserReport=require(_0xa5f1('0xa'));function Report(_0x9a8f1c){this[_0xa5f1('0xb')]=_0x9a8f1c;this[_0xa5f1('0xc')]=_0x9a8f1c['agents'];this[_0xa5f1('0xd')]=_0x9a8f1c[_0xa5f1('0xd')];}Report[_0xa5f1('0xe')][_0xa5f1('0xf')]=function(_0x4c572e){var _0x1b406a=new VoiceQueueReport(this[_0xa5f1('0xb')]);var _0x425fcd=new VoiceAgentReport(this[_0xa5f1('0xb')]);var _0x4aa440=new VoiceDialReport(this['realtime']);var _0x3d8a90=new VoiceCallReport(this[_0xa5f1('0xb')]);var _0x56724d=new UserReport(this[_0xa5f1('0xb')]);if(config[_0xa5f1('0x10')]&&config[_0xa5f1('0x10')][_0xa5f1('0x11')]){ami['on']('custom:voiceQueueReport',this[_0xa5f1('0x12')][_0xa5f1('0x13')](this));ami['on'](_0xa5f1('0x14'),this[_0xa5f1('0x15')][_0xa5f1('0x13')](this));ami['on'](_0xa5f1('0x16'),this[_0xa5f1('0x17')]['bind'](this));ami['on'](_0xa5f1('0x18'),this[_0xa5f1('0x19')][_0xa5f1('0x13')](this));ami['on']('blindtransfer',this['blindTransfer'][_0xa5f1('0x13')](this));ami['on'](_0xa5f1('0x1a'),this[_0xa5f1('0x1b')][_0xa5f1('0x13')](this));}};Report[_0xa5f1('0xe')][_0xa5f1('0x1c')]=function(_0x290aee){var _0x2fc9bd;_0x2fc9bd=_[_0xa5f1('0x1d')](this['agents'],function(_0x115213){return _0x115213[_0xa5f1('0x1e')]==_0x290aee||_0x115213['name']==_0x290aee;});if(_[_0xa5f1('0x1f')](_0x2fc9bd)){var _0x4943f6=_[_0xa5f1('0x1d')](this[_0xa5f1('0xd')],function(_0x3984dd){return _0x3984dd[_0xa5f1('0x1e')]==_0x290aee||_0x3984dd[_0xa5f1('0x20')]==_0x290aee;});if(_0x4943f6){_0x2fc9bd=_[_0xa5f1('0x1d')](this['agents'],function(_0x58fffd){return _0x58fffd[_0xa5f1('0x21')]==util['format'](_0xa5f1('0x22'),_0x4943f6[_0xa5f1('0x20')]);});}}return _0x2fc9bd;};Report[_0xa5f1('0xe')]['voiceQueueReport']=function(_0x42306c){for(var _0xbc92ec=0x0;_0xbc92ec<_0x42306c['length'];_0xbc92ec+=0x1){var _0x55678b=this[_0xa5f1('0x1c')](_0x42306c[_0xbc92ec]['connectedlinenum']);if(_0x55678b){_0x42306c[_0xbc92ec][_0xa5f1('0x1e')]=_0x55678b[_0xa5f1('0x1e')];_0x42306c[_0xbc92ec]['assigned']=!![];_0x42306c[_0xbc92ec][_0xa5f1('0x23')]=_0x55678b[_0xa5f1('0x20')];_0x42306c[_0xbc92ec][_0xa5f1('0x21')]=_[_0xa5f1('0x1f')](_0x55678b[_0xa5f1('0x21')])?util[_0xa5f1('0x24')](_0xa5f1('0x22'),_0x55678b[_0xa5f1('0x20')]):_0x55678b['interface'];if(_0x42306c[_0xbc92ec][_0xa5f1('0x25')]){_0x42306c[_0xbc92ec][_0xa5f1('0x26')]=moment()[_0xa5f1('0x24')](_0xa5f1('0x27'));}if(_0x42306c[_0xbc92ec][_0xa5f1('0x28')]){_0x42306c[_0xbc92ec][_0xa5f1('0x29')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xa5f1('0x12')](_0x42306c[_0xbc92ec]);}RpcVoiceQueueReport[_0xa5f1('0x2a')](_0x42306c[_0xbc92ec]);}};function extractCalleridNumber(_0x3e6a58){var _0x3bb251=_0x3e6a58[_0xa5f1('0x2b')](/<(.*?)>/);return _0x3bb251?_0x3bb251[0x1]:_0x3e6a58;}Report[_0xa5f1('0xe')]['voiceCallReport']=function(_0x4bf0af){_0x4bf0af[_0xa5f1('0x2c')]=_0x4bf0af['destination']||_0x4bf0af[_0xa5f1('0x2d')];if(_0x4bf0af[_0xa5f1('0x2e')]==_0xa5f1('0x2f')){_0x4bf0af['lastapplication']='queue';_0x4bf0af['lastdata']=_0x4bf0af[_0xa5f1('0x30')];if(_0x4bf0af[_0xa5f1('0x31')]=='from-voip-provider'){_0x4bf0af[_0xa5f1('0x1e')]='';_0x4bf0af[_0xa5f1('0x2c')]=extractCalleridNumber(_0x4bf0af['callerid']);}else if(_0x4bf0af[_0xa5f1('0x31')]==_0xa5f1('0x32')){if(_0x4bf0af[_0xa5f1('0x2c')]==_0xa5f1('0x33')){_0x4bf0af[_0xa5f1('0x2c')]=extractCalleridNumber(_0x4bf0af[_0xa5f1('0x34')]);_0x4bf0af[_0xa5f1('0x35')]=_0x4bf0af[_0xa5f1('0x36')];_0x4bf0af[_0xa5f1('0x37')]=[_0x4bf0af[_0xa5f1('0x38')],_0x4bf0af[_0xa5f1('0x38')]=_0x4bf0af[_0xa5f1('0x37')]][0x0];_0x4bf0af[_0xa5f1('0x39')]=_0x4bf0af[_0xa5f1('0x34')];}else{_0x4bf0af['destination']=_0x4bf0af[_0xa5f1('0x35')];_0x4bf0af['calleridnum']=_0x4bf0af[_0xa5f1('0x36')];if(_0x4bf0af['disposition']=='ANSWERED'){_0x4bf0af[_0xa5f1('0x1e')]=_0x4bf0af[_0xa5f1('0x3a')];}else{_0x4bf0af['accountcode']='';}}}}else{_0x4bf0af[_0xa5f1('0x39')]=util['format'](_0xa5f1('0x3b'),_0x4bf0af[_0xa5f1('0x3c')],_0x4bf0af['calleridnum']);}if(RpcVoiceTransferReport[_0xa5f1('0x3d')][_0x4bf0af[_0xa5f1('0x3e')]]){var _0x4a57e3=RpcVoiceTransferReport[_0xa5f1('0x3d')][_0x4bf0af[_0xa5f1('0x3e')]];_0x4a57e3['transfereelinkedid']=_0x4bf0af[_0xa5f1('0x3f')];RpcVoiceTransferReport[_0xa5f1('0x40')](_0x4a57e3);delete RpcVoiceTransferReport[_0xa5f1('0x3d')][_0x4bf0af[_0xa5f1('0x3e')]];}RpcVoiceCallReport[_0xa5f1('0x2a')](_0x4bf0af);if(_0x4bf0af['monitor']){for(var _0x125208=0x0;_0x125208<_0x4bf0af[_0xa5f1('0x41')][_0xa5f1('0x42')];_0x125208+=0x1){_0x4bf0af[_0xa5f1('0x43')]=_0x4bf0af[_0xa5f1('0x41')][_0x125208]['filename'];_0x4bf0af[_0xa5f1('0x44')]=_0x4bf0af[_0xa5f1('0x41')][_0x125208][_0xa5f1('0x44')];if(_0x4bf0af[_0xa5f1('0x2d')]=='xcally-motion-preview'){_0x4bf0af[_0xa5f1('0x35')]=_0x4bf0af[_0xa5f1('0x3a')];_0x4bf0af['calleridname']=_0x4bf0af['connectedlinename'];_0x4bf0af[_0xa5f1('0x3a')]=_0x4bf0af[_0xa5f1('0x1e')];_0x4bf0af[_0xa5f1('0x45')]=_0x4bf0af[_0xa5f1('0x46')];_0x4bf0af[_0xa5f1('0x2d')]=_0x4bf0af[_0xa5f1('0x36')];}else if(_0x4bf0af[_0xa5f1('0x2d')]=='xcally-motion-dialer'){_0x4bf0af[_0xa5f1('0x35')]=_0x4bf0af['destination'];_0x4bf0af['exten']=_0x4bf0af[_0xa5f1('0x36')];}RpcVoiceRecording[_0xa5f1('0x2a')](_0x4bf0af);}}};Report[_0xa5f1('0xe')][_0xa5f1('0x17')]=function(_0x46c2be){if(_[_0xa5f1('0x47')](_0x46c2be)){_0x46c2be[_0xa5f1('0x48')](function(_0x130f91){RpcVoiceAgentReport['create'](_0x130f91);});}else{RpcVoiceAgentReport[_0xa5f1('0x2a')](_0x46c2be);}};Report[_0xa5f1('0xe')]['voiceDialReport']=function(_0x1674da){RpcVoiceDialReport[_0xa5f1('0x2a')](_0x1674da);var _0x597c0d;var _0x4a34c3;var _0x24df4c=_0x1674da['channel'];if(_[_0xa5f1('0x49')](_0x24df4c,'Local')){_0x4a34c3=_0x24df4c[_0xa5f1('0x4a')](_0x24df4c[_0xa5f1('0x4b')]('/')+0x1,_0x24df4c[_0xa5f1('0x4b')]('@'));_0x597c0d=_[_0xa5f1('0x1d')](this['agents'],function(_0x2d8dc6){return _0x2d8dc6[_0xa5f1('0x4c')]==_0x4a34c3||_0x2d8dc6['phone']==_0x4a34c3||_0x2d8dc6[_0xa5f1('0x1e')]==_0x4a34c3;});}else{_0x4a34c3=_0x24df4c[_0xa5f1('0x4a')](_0x24df4c['indexOf']('/')+0x1,_0x24df4c['lastIndexOf']('-'));_0x597c0d=this[_0xa5f1('0x1c')](_0x4a34c3);}if(_0x597c0d){_0x1674da[_0xa5f1('0x21')]=_[_0xa5f1('0x1f')](_0x597c0d[_0xa5f1('0x21')])?util[_0xa5f1('0x24')]('SIP/%s',_0x597c0d[_0xa5f1('0x20')]):_0x597c0d[_0xa5f1('0x21')];_0x1674da[_0xa5f1('0x46')]=_0x597c0d[_0xa5f1('0x20')];_0x1674da['accountcode']=_0x597c0d[_0xa5f1('0x1e')];RpcMemberReport['voiceDialReport'](_0x1674da);}};Report['prototype']['blindTransfer']=function(_0x3b2a69){RpcVoiceTransferReport[_0xa5f1('0x3d')][_0x3b2a69[_0xa5f1('0x4d')]]=_0x3b2a69;};Report[_0xa5f1('0xe')][_0xa5f1('0x1b')]=function(_0x430545){RpcVoiceTransferReport['attendedTransfer'](_0x430545);};module[_0xa5f1('0x4e')]=Report; \ No newline at end of file +var _0x49ee=['../ami','../rpc/voiceCallReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','telephones','prototype','sync','xdr','disabled','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceAgentReport','custom:voiceDialReport','attendedTransfer','findAgent','find','accountcode','name','agents','format','voiceQueueReport','length','connectedlinenum','assigned','lastAssignedTo','interface','isNil','SIP/%s','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','match','destination','exten','type','dialer','lastapplication','queue','from-voip-provider','callerid','context','from-sip','xcally-motion-preview','originatecalleridnum','channel','calleridpreview','calleridnum','ANSWERED','\x22%s\x22\x20<%s>','calleridname','linkedid','transfereelinkedid','uniqueid','blindTransfer','create','monitor','filename','createdAt','connectedlinename','membername','xcally-motion-dialer','isArray','forEach','voiceDialReport','startsWith','Local','substring','indexOf','mobile','phone','transfers','transfererlinkedid','exports','lodash','../../../config/environment'];(function(_0x4032e3,_0x6d6449){var _0x34f51a=function(_0x3f77e4){while(--_0x3f77e4){_0x4032e3['push'](_0x4032e3['shift']());}};_0x34f51a(++_0x6d6449);}(_0x49ee,0x15a));var _0xe49e=function(_0x527288,_0x2e32e9){_0x527288=_0x527288-0x0;var _0x2cbc0f=_0x49ee[_0x527288];return _0x2cbc0f;};'use strict';var _=require(_0xe49e('0x0'));var moment=require('moment');var util=require('util');var config=require(_0xe49e('0x1'));var ami=require(_0xe49e('0x2'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0xe49e('0x3'));var RpcVoiceDialReport=require('../rpc/voiceDialReport');var RpcMemberReport=require('../rpc/memberReport');var RpcVoiceQueueReport=require(_0xe49e('0x4'));var RpcVoiceRecording=require(_0xe49e('0x5'));var RpcVoiceTransferReport=require(_0xe49e('0x6'));var VoiceQueueReport=require(_0xe49e('0x7'));var VoiceCallReport=require(_0xe49e('0x8'));var VoiceAgentReport=require(_0xe49e('0x9'));var VoiceDialReport=require(_0xe49e('0xa'));var UserReport=require(_0xe49e('0xb'));function Report(_0x21624f){this[_0xe49e('0xc')]=_0x21624f;this['agents']=_0x21624f['agents'];this[_0xe49e('0xd')]=_0x21624f[_0xe49e('0xd')];}Report[_0xe49e('0xe')][_0xe49e('0xf')]=function(_0x4d1600){var _0x3757cf=new VoiceQueueReport(this[_0xe49e('0xc')]);var _0x445706=new VoiceAgentReport(this['realtime']);var _0x5b3e12=new VoiceDialReport(this[_0xe49e('0xc')]);var _0x1fd4b5=new VoiceCallReport(this['realtime']);var _0x3f7b93=new UserReport(this['realtime']);if(config[_0xe49e('0x10')]&&config['xdr'][_0xe49e('0x11')]){ami['on'](_0xe49e('0x12'),this['voiceQueueReport'][_0xe49e('0x13')](this));ami['on'](_0xe49e('0x14'),this[_0xe49e('0x15')][_0xe49e('0x13')](this));ami['on'](_0xe49e('0x16'),this[_0xe49e('0x17')][_0xe49e('0x13')](this));ami['on'](_0xe49e('0x18'),this['voiceDialReport'][_0xe49e('0x13')](this));ami['on']('blindtransfer',this['blindTransfer'][_0xe49e('0x13')](this));ami['on']('attendedtransfer',this[_0xe49e('0x19')]['bind'](this));}};Report[_0xe49e('0xe')][_0xe49e('0x1a')]=function(_0x4bcc6b){var _0x2a91ff;_0x2a91ff=_[_0xe49e('0x1b')](this['agents'],function(_0x3b424c){return _0x3b424c[_0xe49e('0x1c')]==_0x4bcc6b||_0x3b424c[_0xe49e('0x1d')]==_0x4bcc6b;});if(_['isNil'](_0x2a91ff)){var _0x233b71=_['find'](this[_0xe49e('0xd')],function(_0xbe0e51){return _0xbe0e51[_0xe49e('0x1c')]==_0x4bcc6b||_0xbe0e51['name']==_0x4bcc6b;});if(_0x233b71){_0x2a91ff=_['find'](this[_0xe49e('0x1e')],function(_0x5de4f6){return _0x5de4f6['interface']==util[_0xe49e('0x1f')]('SIP/%s',_0x233b71[_0xe49e('0x1d')]);});}}return _0x2a91ff;};Report[_0xe49e('0xe')][_0xe49e('0x20')]=function(_0x3d30a1){for(var _0x22bc63=0x0;_0x22bc63<_0x3d30a1[_0xe49e('0x21')];_0x22bc63+=0x1){var _0x19487a=this[_0xe49e('0x1a')](_0x3d30a1[_0x22bc63][_0xe49e('0x22')]);if(_0x19487a){_0x3d30a1[_0x22bc63][_0xe49e('0x1c')]=_0x19487a[_0xe49e('0x1c')];_0x3d30a1[_0x22bc63][_0xe49e('0x23')]=!![];_0x3d30a1[_0x22bc63][_0xe49e('0x24')]=_0x19487a[_0xe49e('0x1d')];_0x3d30a1[_0x22bc63][_0xe49e('0x25')]=_[_0xe49e('0x26')](_0x19487a[_0xe49e('0x25')])?util['format'](_0xe49e('0x27'),_0x19487a[_0xe49e('0x1d')]):_0x19487a[_0xe49e('0x25')];if(_0x3d30a1[_0x22bc63][_0xe49e('0x28')]){_0x3d30a1[_0x22bc63][_0xe49e('0x29')]=moment()[_0xe49e('0x1f')](_0xe49e('0x2a'));}if(_0x3d30a1[_0x22bc63][_0xe49e('0x2b')]){_0x3d30a1[_0x22bc63][_0xe49e('0x2c')]=moment()[_0xe49e('0x1f')](_0xe49e('0x2a'));}RpcMemberReport['voiceQueueReport'](_0x3d30a1[_0x22bc63]);}RpcVoiceQueueReport['create'](_0x3d30a1[_0x22bc63]);}};function extractCalleridNumber(_0x3af099){var _0x5dc693=_0x3af099[_0xe49e('0x2d')](/<(.*?)>/);return _0x5dc693?_0x5dc693[0x1]:_0x3af099;}Report[_0xe49e('0xe')][_0xe49e('0x15')]=function(_0x2523f2){_0x2523f2[_0xe49e('0x2e')]=_0x2523f2[_0xe49e('0x2e')]||_0x2523f2[_0xe49e('0x2f')];if(_0x2523f2[_0xe49e('0x30')]==_0xe49e('0x31')){_0x2523f2[_0xe49e('0x32')]=_0xe49e('0x33');_0x2523f2['lastdata']=_0x2523f2['queue'];if(_0x2523f2['context']==_0xe49e('0x34')){_0x2523f2[_0xe49e('0x1c')]='';_0x2523f2[_0xe49e('0x2e')]=extractCalleridNumber(_0x2523f2[_0xe49e('0x35')]);}else if(_0x2523f2[_0xe49e('0x36')]==_0xe49e('0x37')){if(_0x2523f2[_0xe49e('0x2e')]==_0xe49e('0x38')){_0x2523f2['destination']=extractCalleridNumber(_0x2523f2['calleridpreview']);_0x2523f2['calleridnum']=_0x2523f2[_0xe49e('0x39')];_0x2523f2['destinationchannel']=[_0x2523f2[_0xe49e('0x3a')],_0x2523f2[_0xe49e('0x3a')]=_0x2523f2['destinationchannel']][0x0];_0x2523f2['callerid']=_0x2523f2[_0xe49e('0x3b')];}else{_0x2523f2[_0xe49e('0x2e')]=_0x2523f2[_0xe49e('0x3c')];_0x2523f2[_0xe49e('0x3c')]=_0x2523f2[_0xe49e('0x39')];if(_0x2523f2['disposition']==_0xe49e('0x3d')){_0x2523f2[_0xe49e('0x1c')]=_0x2523f2[_0xe49e('0x22')];}else{_0x2523f2['accountcode']='';}}}}else{_0x2523f2[_0xe49e('0x35')]=util[_0xe49e('0x1f')](_0xe49e('0x3e'),_0x2523f2[_0xe49e('0x3f')],_0x2523f2[_0xe49e('0x3c')]);}if(RpcVoiceTransferReport['transfers'][_0x2523f2[_0xe49e('0x40')]]){var _0x3070b4=RpcVoiceTransferReport['transfers'][_0x2523f2[_0xe49e('0x40')]];_0x3070b4[_0xe49e('0x41')]=_0x2523f2[_0xe49e('0x42')];RpcVoiceTransferReport[_0xe49e('0x43')](_0x3070b4);delete RpcVoiceTransferReport['transfers'][_0x2523f2[_0xe49e('0x40')]];}RpcVoiceCallReport[_0xe49e('0x44')](_0x2523f2);if(_0x2523f2[_0xe49e('0x45')]){for(var _0x209d6b=0x0;_0x209d6b<_0x2523f2['monitors'][_0xe49e('0x21')];_0x209d6b+=0x1){_0x2523f2['monitorFilename']=_0x2523f2['monitors'][_0x209d6b][_0xe49e('0x46')];_0x2523f2[_0xe49e('0x47')]=_0x2523f2['monitors'][_0x209d6b][_0xe49e('0x47')];if(_0x2523f2[_0xe49e('0x2f')]==_0xe49e('0x38')){_0x2523f2[_0xe49e('0x3c')]=_0x2523f2[_0xe49e('0x22')];_0x2523f2[_0xe49e('0x3f')]=_0x2523f2[_0xe49e('0x48')];_0x2523f2[_0xe49e('0x22')]=_0x2523f2[_0xe49e('0x1c')];_0x2523f2['connectedlinename']=_0x2523f2[_0xe49e('0x49')];_0x2523f2[_0xe49e('0x2f')]=_0x2523f2[_0xe49e('0x39')];}else if(_0x2523f2[_0xe49e('0x2f')]==_0xe49e('0x4a')){_0x2523f2['calleridnum']=_0x2523f2[_0xe49e('0x2e')];_0x2523f2[_0xe49e('0x2f')]=_0x2523f2[_0xe49e('0x39')];}RpcVoiceRecording[_0xe49e('0x44')](_0x2523f2);}}};Report['prototype'][_0xe49e('0x17')]=function(_0x410298){if(_[_0xe49e('0x4b')](_0x410298)){_0x410298[_0xe49e('0x4c')](function(_0x482abc){RpcVoiceAgentReport[_0xe49e('0x44')](_0x482abc);});}else{RpcVoiceAgentReport['create'](_0x410298);}};Report['prototype'][_0xe49e('0x4d')]=function(_0x1b365e){RpcVoiceDialReport[_0xe49e('0x44')](_0x1b365e);var _0x1325af;var _0xd2c670;var _0x488b62=_0x1b365e[_0xe49e('0x3a')];if(_[_0xe49e('0x4e')](_0x488b62,_0xe49e('0x4f'))){_0xd2c670=_0x488b62[_0xe49e('0x50')](_0x488b62[_0xe49e('0x51')]('/')+0x1,_0x488b62[_0xe49e('0x51')]('@'));_0x1325af=_[_0xe49e('0x1b')](this[_0xe49e('0x1e')],function(_0x4e6905){return _0x4e6905[_0xe49e('0x52')]==_0xd2c670||_0x4e6905[_0xe49e('0x53')]==_0xd2c670||_0x4e6905['accountcode']==_0xd2c670;});}else{_0xd2c670=_0x488b62['substring'](_0x488b62[_0xe49e('0x51')]('/')+0x1,_0x488b62['lastIndexOf']('-'));_0x1325af=this[_0xe49e('0x1a')](_0xd2c670);}if(_0x1325af){_0x1b365e[_0xe49e('0x25')]=_[_0xe49e('0x26')](_0x1325af['interface'])?util[_0xe49e('0x1f')](_0xe49e('0x27'),_0x1325af[_0xe49e('0x1d')]):_0x1325af[_0xe49e('0x25')];_0x1b365e[_0xe49e('0x49')]=_0x1325af[_0xe49e('0x1d')];_0x1b365e[_0xe49e('0x1c')]=_0x1325af['accountcode'];RpcMemberReport[_0xe49e('0x4d')](_0x1b365e);}};Report[_0xe49e('0xe')][_0xe49e('0x43')]=function(_0x51ce8b){RpcVoiceTransferReport[_0xe49e('0x54')][_0x51ce8b[_0xe49e('0x55')]]=_0x51ce8b;};Report[_0xe49e('0xe')]['attendedTransfer']=function(_0x462a0b){RpcVoiceTransferReport['attendedTransfer'](_0x462a0b);};module[_0xe49e('0x56')]=Report; \ No newline at end of file diff --git a/server/services/ami/report/userReport.js b/server/services/ami/report/userReport.js index 2def503..a1d55c5 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 _0xcd62=['address','[userReport][peerstatus]','registered','status','peer','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','telephone:%s','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','../ami','defaults','redis','localhost','socket.io-emitter','trunks','agents','registryentry','syncRegistry','bind','syncDeviceState','peerstatus','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','inspect','then','actionDeviceStateList','[userReport][devicestatelist]','actionSipPeerStatus','prototype','isNotNull','isUndefined','emit','info','[userReport][registry]\x20registry:%s\x20state:%s','username','state','debug','find','stateRegistry','merge','omit','event','[userReport][registry]\x20sending\x20trunk:save\x20event:','format','trunk:%s','trunk:save','[userReport][registry]','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','stateTime','toNumber','updateStatusRealtime','telephones','[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:','name','telephone:save','startsWith','Local','substring','indexOf','phone','accountcode','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s'];(function(_0x38009a,_0x2867a7){var _0xce37b9=function(_0x589170){while(--_0x589170){_0x38009a['push'](_0x38009a['shift']());}};_0xce37b9(++_0x2867a7);}(_0xcd62,0x141));var _0x2cd6=function(_0x4660e0,_0xe5101b){_0x4660e0=_0x4660e0-0x0;var _0x3a251d=_0xcd62[_0x4660e0];return _0x3a251d;};'use strict';var _=require(_0x2cd6('0x0'));var moment=require(_0x2cd6('0x1'));var util=require(_0x2cd6('0x2'));var Redis=require('ioredis');var BPromise=require('bluebird');var config=require(_0x2cd6('0x3'));var logger=require(_0x2cd6('0x4'))(_0x2cd6('0x5'));var ami=require(_0x2cd6('0x6'));config['redis']=_[_0x2cd6('0x7')](config[_0x2cd6('0x8')],{'host':_0x2cd6('0x9'),'port':0x18eb});var io=require(_0x2cd6('0xa'))(new Redis(config[_0x2cd6('0x8')]));function UserReport(_0x5dc732){this['trunks']=_0x5dc732[_0x2cd6('0xb')];this['agents']=_0x5dc732[_0x2cd6('0xc')];this['telephones']=_0x5dc732['telephones'];ami['on'](_0x2cd6('0xd'),this[_0x2cd6('0xe')][_0x2cd6('0xf')](this));ami['on']('registry',this['syncRegistry']['bind'](this));ami['on']('devicestatechange',this[_0x2cd6('0x10')][_0x2cd6('0xf')](this));ami['on'](_0x2cd6('0x11'),this[_0x2cd6('0x12')][_0x2cd6('0xf')](this));return this[_0x2cd6('0x13')]();}function showSipRegistrations(){Promise[_0x2cd6('0x14')]()['then'](ami[_0x2cd6('0x15')]())[_0x2cd6('0x16')](function(_0x123c15){logger[_0x2cd6('0x17')](_0x2cd6('0x18'),util[_0x2cd6('0x19')](_0x123c15,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x2cd6('0x14')]()[_0x2cd6('0x1a')](ami[_0x2cd6('0x1b')]())['catch'](function(_0x3879e5){logger['error'](_0x2cd6('0x1c'),util['inspect'](_0x3879e5,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x2cd6('0x14')]()[_0x2cd6('0x1a')](ami[_0x2cd6('0x1d')]())[_0x2cd6('0x16')](function(_0x1cb3ca){logger[_0x2cd6('0x17')]('[userReport][sippeerstatus]',util['inspect'](_0x1cb3ca,{'showHidden':![],'depth':null}));});}UserReport[_0x2cd6('0x1e')][_0x2cd6('0x13')]=function(){setInterval(function(){BPromise[_0x2cd6('0x14')]()[_0x2cd6('0x1a')](showSipRegistrations())['then'](listDeviceStates())[_0x2cd6('0x1a')](showPeersStatus());},0x32c8);};UserReport[_0x2cd6('0x1e')][_0x2cd6('0x1f')]=function(_0x6a8910){return _0x6a8910!==null&&!_[_0x2cd6('0x20')](_0x6a8910);};UserReport['prototype'][_0x2cd6('0x21')]=function(_0x6d0bbc,_0x51ce58,_0x25fc6b){io['to'](_0x6d0bbc)[_0x2cd6('0x21')](_0x51ce58,_0x25fc6b);};UserReport[_0x2cd6('0x1e')]['syncRegistry']=function(_0x382778){try{if(this[_0x2cd6('0x1f')](_0x382778)){logger[_0x2cd6('0x22')](_0x2cd6('0x23'),_0x382778[_0x2cd6('0x24')],_0x382778[_0x2cd6('0x25')]);logger[_0x2cd6('0x26')]('[userReport][registry]',util[_0x2cd6('0x19')](_0x382778,{'showHidden':![],'depth':null}));var _0x208394=_[_0x2cd6('0x27')](this[_0x2cd6('0xb')],{'defaultuser':_0x382778[_0x2cd6('0x24')]});if(_0x208394){_0x382778[_0x2cd6('0x28')]=_0x382778['state'];_[_0x2cd6('0x29')](_0x208394,_[_0x2cd6('0x2a')](_0x382778,[_0x2cd6('0x2b'),'actionid','username','state']));logger['debug'](_0x2cd6('0x2c'),util[_0x2cd6('0x19')](_0x208394,{'showHidden':![],'depth':null}));this[_0x2cd6('0x21')](util[_0x2cd6('0x2d')](_0x2cd6('0x2e'),_0x208394['name']),_0x2cd6('0x2f'),_0x208394);}}}catch(_0x112227){logger[_0x2cd6('0x17')](_0x2cd6('0x30'),util[_0x2cd6('0x19')](_0x112227,{'showHidden':![],'depth':null}));}};UserReport[_0x2cd6('0x1e')][_0x2cd6('0x10')]=function(_0x56e08e){try{if(this[_0x2cd6('0x1f')](_0x56e08e)){logger[_0x2cd6('0x22')](_0x2cd6('0x31'),_0x56e08e[_0x2cd6('0x32')],_0x56e08e[_0x2cd6('0x25')]);logger[_0x2cd6('0x26')](_0x2cd6('0x33'),util[_0x2cd6('0x19')](_0x56e08e,{'showHidden':![],'depth':null}));if(this['agents'][_0x56e08e[_0x2cd6('0x32')]]){if(!this[_0x2cd6('0xc')][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x34')]||_0x56e08e[_0x2cd6('0x25')][_0x2cd6('0x35')]()==_0x2cd6('0x36')){this[_0x2cd6('0xc')][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x34')]=![];if(this[_0x2cd6('0xc')][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x25')]!==_0x56e08e[_0x2cd6('0x25')]['toLowerCase']()){this[_0x2cd6('0xc')][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x37')]=_[_0x2cd6('0x38')](moment()[_0x2cd6('0x2d')]('x'));}this[_0x2cd6('0xc')][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x25')]=_0x56e08e[_0x2cd6('0x25')]['toLowerCase']();this[_0x2cd6('0xc')][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x39')](_0x56e08e);}}else if(this['telephones'][_0x56e08e[_0x2cd6('0x32')]]){if(this[_0x2cd6('0x3a')][_0x56e08e['device']][_0x2cd6('0x25')]!==_0x56e08e[_0x2cd6('0x25')]['toLowerCase']()){this['telephones'][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x37')]=_[_0x2cd6('0x38')](moment()[_0x2cd6('0x2d')]('x'));}this['telephones'][_0x56e08e['device']]['state']=_0x56e08e[_0x2cd6('0x25')][_0x2cd6('0x35')]();logger['debug'](_0x2cd6('0x3b'),util[_0x2cd6('0x19')](this[_0x2cd6('0x3a')][_0x56e08e[_0x2cd6('0x32')]],{'showHidden':![],'depth':null}));this[_0x2cd6('0x21')](util[_0x2cd6('0x2d')]('telephone:%s',this['telephones'][_0x56e08e['device']][_0x2cd6('0x3c')]),_0x2cd6('0x3d'),this[_0x2cd6('0x3a')][_0x56e08e[_0x2cd6('0x32')]]);}else if(this['trunks'][_0x56e08e[_0x2cd6('0x32')]]){if(this[_0x2cd6('0xb')][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x25')]!==_0x56e08e[_0x2cd6('0x25')][_0x2cd6('0x35')]()){this[_0x2cd6('0xb')][_0x56e08e['device']][_0x2cd6('0x37')]=_['toNumber'](moment()[_0x2cd6('0x2d')]('x'));}this['trunks'][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x25')]=_0x56e08e[_0x2cd6('0x25')][_0x2cd6('0x35')]();logger[_0x2cd6('0x26')]('[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:',util[_0x2cd6('0x19')](this['trunks'][_0x56e08e[_0x2cd6('0x32')]],{'showHidden':![],'depth':null}));this[_0x2cd6('0x21')](util[_0x2cd6('0x2d')](_0x2cd6('0x2e'),this['trunks'][_0x56e08e[_0x2cd6('0x32')]][_0x2cd6('0x3c')]),_0x2cd6('0x2f'),this[_0x2cd6('0xb')][_0x56e08e[_0x2cd6('0x32')]]);}else if(_[_0x2cd6('0x3e')](_0x56e08e[_0x2cd6('0x32')],_0x2cd6('0x3f'))){var _0x4de7d9=_0x56e08e[_0x2cd6('0x32')];var _0x111388=_0x4de7d9[_0x2cd6('0x40')](_0x4de7d9['indexOf']('/')+0x1,_0x4de7d9[_0x2cd6('0x41')]('@'));var _0x462512=_['find'](this[_0x2cd6('0xc')],function(_0x31f728){return _0x31f728['mobile']==_0x111388||_0x31f728[_0x2cd6('0x42')]==_0x111388||_0x31f728[_0x2cd6('0x43')]==_0x111388;});if(_0x462512){if(_0x462512[_0x2cd6('0x25')]!==_0x56e08e[_0x2cd6('0x25')][_0x2cd6('0x35')]()){_0x462512['stateTime']=_[_0x2cd6('0x38')](moment()[_0x2cd6('0x2d')]('x'));}_0x462512[_0x2cd6('0x25')]=_0x56e08e[_0x2cd6('0x25')][_0x2cd6('0x35')]();_0x462512[_0x2cd6('0x34')]=!![];_0x462512[_0x2cd6('0x39')](_0x56e08e);}}}}catch(_0x1ecf03){logger[_0x2cd6('0x17')](_0x2cd6('0x33'),util[_0x2cd6('0x19')](_0x1ecf03,{'showHidden':![],'depth':null}));}};UserReport[_0x2cd6('0x1e')][_0x2cd6('0x12')]=function(_0x156fcd){try{if(this[_0x2cd6('0x1f')](_0x156fcd)&&this[_0x2cd6('0x1f')](_0x156fcd[_0x2cd6('0x11')])){logger[_0x2cd6('0x22')](_0x2cd6('0x44'),_0x156fcd['peer'],_0x156fcd[_0x2cd6('0x45')],_0x156fcd[_0x2cd6('0x11')]);logger[_0x2cd6('0x26')](_0x2cd6('0x46'),util[_0x2cd6('0x19')](_0x156fcd,{'showHidden':![],'depth':null}));if(this[_0x2cd6('0xc')][_0x156fcd['peer']]){if(!this['agents'][_0x156fcd['peer']]['local']||_0x156fcd[_0x2cd6('0x11')][_0x2cd6('0x35')]()==_0x2cd6('0x47')){this['agents'][_0x156fcd['peer']][_0x2cd6('0x34')]=![];this[_0x2cd6('0xc')][_0x156fcd['peer']][_0x2cd6('0x48')]=_0x156fcd['peerstatus'][_0x2cd6('0x35')]();this['agents'][_0x156fcd[_0x2cd6('0x49')]][_0x2cd6('0x45')]=_0x156fcd[_0x2cd6('0x45')];this[_0x2cd6('0xc')][_0x156fcd[_0x2cd6('0x49')]][_0x2cd6('0x39')](_0x156fcd);}}else if(this[_0x2cd6('0x3a')][_0x156fcd[_0x2cd6('0x49')]]){this['telephones'][_0x156fcd['peer']][_0x2cd6('0x48')]=_0x156fcd[_0x2cd6('0x11')]['toLowerCase']();this[_0x2cd6('0x3a')][_0x156fcd[_0x2cd6('0x49')]][_0x2cd6('0x45')]=_0x156fcd[_0x2cd6('0x45')];logger[_0x2cd6('0x26')](_0x2cd6('0x4a'),util[_0x2cd6('0x19')](this[_0x2cd6('0x3a')][_0x156fcd[_0x2cd6('0x49')]],{'showHidden':![],'depth':null}));this['emit'](util[_0x2cd6('0x2d')](_0x2cd6('0x4b'),this[_0x2cd6('0x3a')][_0x156fcd[_0x2cd6('0x49')]]['name']),_0x2cd6('0x3d'),this[_0x2cd6('0x3a')][_0x156fcd[_0x2cd6('0x49')]]);}else if(this['trunks'][_0x156fcd[_0x2cd6('0x49')]]){this[_0x2cd6('0xb')][_0x156fcd['peer']][_0x2cd6('0x48')]=_0x156fcd['peerstatus'][_0x2cd6('0x35')]();this[_0x2cd6('0xb')][_0x156fcd['peer']][_0x2cd6('0x45')]=_0x156fcd[_0x2cd6('0x45')];logger[_0x2cd6('0x26')](_0x2cd6('0x4c'),util['inspect'](this[_0x2cd6('0xb')][_0x156fcd['peer']],{'showHidden':![],'depth':null}));this[_0x2cd6('0x21')](util['format'](_0x2cd6('0x2e'),this[_0x2cd6('0xb')][_0x156fcd[_0x2cd6('0x49')]][_0x2cd6('0x3c')]),'trunk:save',this['trunks'][_0x156fcd[_0x2cd6('0x49')]]);}}}catch(_0x10fc52){logger[_0x2cd6('0x17')](_0x2cd6('0x46'),util[_0x2cd6('0x19')](_0x10fc52,{'showHidden':![],'depth':null}));}};module[_0x2cd6('0x4d')]=UserReport; \ No newline at end of file +var _0x0b77=['phone','accountcode','peerstatus','[userReport][peerstatus]\x20peer:%s\x20address:%s\x20status:%s','address','[userReport][peerstatus]','peer','registered','updateStatusRealtime','[userReport][peerstatus]\x20sending\x20telephone:save\x20event:','status','[userReport][peerstatus]\x20sending\x20trunk:save\x20event:','exports','lodash','moment','util','ioredis','bluebird','ami','../ami','redis','defaults','socket.io-emitter','trunks','agents','telephones','registryentry','syncRegistry','bind','syncPeerStatus','syncRealtimeShow','resolve','actionSipShowRegistry','catch','error','[userReport][sipshowregistry]','then','actionDeviceStateList','[userReport][devicestatelist]','inspect','prototype','emit','isNotNull','info','[userReport][registry]\x20registry:%s\x20state:%s','state','debug','[userReport][registry]','username','stateRegistry','merge','omit','actionid','format','trunk:%s','name','trunk:save','syncDeviceState','[userReport][devicestatechange]\x20device:%s\x20state:%s','device','[userReport][devicestatechange]','local','toLowerCase','inuse','toNumber','stateTime','telephone:%s','telephone:save','[userReport][devicestatechange]\x20sending\x20trunk:save\x20event:','startsWith','Local','substring','indexOf','find','mobile'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0x0b77,0x184));var _0x70b7=function(_0x43026b,_0x928d8c){_0x43026b=_0x43026b-0x0;var _0x4a96cd=_0x0b77[_0x43026b];return _0x4a96cd;};'use strict';var _=require(_0x70b7('0x0'));var moment=require(_0x70b7('0x1'));var util=require(_0x70b7('0x2'));var Redis=require(_0x70b7('0x3'));var BPromise=require(_0x70b7('0x4'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x70b7('0x5'));var ami=require(_0x70b7('0x6'));config[_0x70b7('0x7')]=_[_0x70b7('0x8')](config[_0x70b7('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x70b7('0x9'))(new Redis(config[_0x70b7('0x7')]));function UserReport(_0x5b0993){this[_0x70b7('0xa')]=_0x5b0993[_0x70b7('0xa')];this[_0x70b7('0xb')]=_0x5b0993['agents'];this[_0x70b7('0xc')]=_0x5b0993[_0x70b7('0xc')];ami['on'](_0x70b7('0xd'),this[_0x70b7('0xe')][_0x70b7('0xf')](this));ami['on']('registry',this[_0x70b7('0xe')]['bind'](this));ami['on']('devicestatechange',this['syncDeviceState'][_0x70b7('0xf')](this));ami['on']('peerstatus',this[_0x70b7('0x10')][_0x70b7('0xf')](this));return this[_0x70b7('0x11')]();}function showSipRegistrations(){Promise[_0x70b7('0x12')]()['then'](ami[_0x70b7('0x13')]())[_0x70b7('0x14')](function(_0x5718e4){logger[_0x70b7('0x15')](_0x70b7('0x16'),util['inspect'](_0x5718e4,{'showHidden':![],'depth':null}));});}function listDeviceStates(){Promise[_0x70b7('0x12')]()[_0x70b7('0x17')](ami[_0x70b7('0x18')]())[_0x70b7('0x14')](function(_0x556a60){logger[_0x70b7('0x15')](_0x70b7('0x19'),util[_0x70b7('0x1a')](_0x556a60,{'showHidden':![],'depth':null}));});}function showPeersStatus(){Promise[_0x70b7('0x12')]()[_0x70b7('0x17')](ami['actionSipPeerStatus']())['catch'](function(_0x2b4616){logger['error']('[userReport][sippeerstatus]',util[_0x70b7('0x1a')](_0x2b4616,{'showHidden':![],'depth':null}));});}UserReport['prototype'][_0x70b7('0x11')]=function(){setInterval(function(){BPromise[_0x70b7('0x12')]()[_0x70b7('0x17')](showSipRegistrations())[_0x70b7('0x17')](listDeviceStates())[_0x70b7('0x17')](showPeersStatus());},0x32c8);};UserReport['prototype']['isNotNull']=function(_0x13bacc){return _0x13bacc!==null&&!_['isUndefined'](_0x13bacc);};UserReport[_0x70b7('0x1b')]['emit']=function(_0x36885f,_0x392e71,_0x1fb67e){io['to'](_0x36885f)[_0x70b7('0x1c')](_0x392e71,_0x1fb67e);};UserReport[_0x70b7('0x1b')]['syncRegistry']=function(_0x5eeab3){try{if(this[_0x70b7('0x1d')](_0x5eeab3)){logger[_0x70b7('0x1e')](_0x70b7('0x1f'),_0x5eeab3['username'],_0x5eeab3[_0x70b7('0x20')]);logger[_0x70b7('0x21')](_0x70b7('0x22'),util[_0x70b7('0x1a')](_0x5eeab3,{'showHidden':![],'depth':null}));var _0x37096c=_['find'](this[_0x70b7('0xa')],{'defaultuser':_0x5eeab3[_0x70b7('0x23')]});if(_0x37096c){_0x5eeab3[_0x70b7('0x24')]=_0x5eeab3[_0x70b7('0x20')];_[_0x70b7('0x25')](_0x37096c,_[_0x70b7('0x26')](_0x5eeab3,['event',_0x70b7('0x27'),_0x70b7('0x23'),_0x70b7('0x20')]));logger['debug']('[userReport][registry]\x20sending\x20trunk:save\x20event:',util[_0x70b7('0x1a')](_0x37096c,{'showHidden':![],'depth':null}));this['emit'](util[_0x70b7('0x28')](_0x70b7('0x29'),_0x37096c[_0x70b7('0x2a')]),_0x70b7('0x2b'),_0x37096c);}}}catch(_0x430e88){logger['error']('[userReport][registry]',util[_0x70b7('0x1a')](_0x430e88,{'showHidden':![],'depth':null}));}};UserReport[_0x70b7('0x1b')][_0x70b7('0x2c')]=function(_0x25eb2e){try{if(this[_0x70b7('0x1d')](_0x25eb2e)){logger['info'](_0x70b7('0x2d'),_0x25eb2e[_0x70b7('0x2e')],_0x25eb2e[_0x70b7('0x20')]);logger['debug'](_0x70b7('0x2f'),util[_0x70b7('0x1a')](_0x25eb2e,{'showHidden':![],'depth':null}));if(this['agents'][_0x25eb2e[_0x70b7('0x2e')]]){if(!this[_0x70b7('0xb')][_0x25eb2e[_0x70b7('0x2e')]][_0x70b7('0x30')]||_0x25eb2e[_0x70b7('0x20')][_0x70b7('0x31')]()==_0x70b7('0x32')){this[_0x70b7('0xb')][_0x25eb2e[_0x70b7('0x2e')]][_0x70b7('0x30')]=![];if(this[_0x70b7('0xb')][_0x25eb2e[_0x70b7('0x2e')]][_0x70b7('0x20')]!==_0x25eb2e[_0x70b7('0x20')]['toLowerCase']()){this[_0x70b7('0xb')][_0x25eb2e[_0x70b7('0x2e')]]['stateTime']=_[_0x70b7('0x33')](moment()['format']('x'));}this[_0x70b7('0xb')][_0x25eb2e[_0x70b7('0x2e')]][_0x70b7('0x20')]=_0x25eb2e[_0x70b7('0x20')]['toLowerCase']();this['agents'][_0x25eb2e[_0x70b7('0x2e')]]['updateStatusRealtime'](_0x25eb2e);}}else if(this[_0x70b7('0xc')][_0x25eb2e['device']]){if(this[_0x70b7('0xc')][_0x25eb2e[_0x70b7('0x2e')]]['state']!==_0x25eb2e[_0x70b7('0x20')]['toLowerCase']()){this[_0x70b7('0xc')][_0x25eb2e['device']][_0x70b7('0x34')]=_[_0x70b7('0x33')](moment()[_0x70b7('0x28')]('x'));}this[_0x70b7('0xc')][_0x25eb2e[_0x70b7('0x2e')]][_0x70b7('0x20')]=_0x25eb2e[_0x70b7('0x20')][_0x70b7('0x31')]();logger[_0x70b7('0x21')]('[userReport][devicestatechange]\x20sending\x20telephone:save\x20event:',util[_0x70b7('0x1a')](this[_0x70b7('0xc')][_0x25eb2e[_0x70b7('0x2e')]],{'showHidden':![],'depth':null}));this[_0x70b7('0x1c')](util[_0x70b7('0x28')](_0x70b7('0x35'),this[_0x70b7('0xc')][_0x25eb2e[_0x70b7('0x2e')]]['name']),_0x70b7('0x36'),this[_0x70b7('0xc')][_0x25eb2e['device']]);}else if(this[_0x70b7('0xa')][_0x25eb2e[_0x70b7('0x2e')]]){if(this[_0x70b7('0xa')][_0x25eb2e['device']][_0x70b7('0x20')]!==_0x25eb2e[_0x70b7('0x20')][_0x70b7('0x31')]()){this['trunks'][_0x25eb2e[_0x70b7('0x2e')]]['stateTime']=_[_0x70b7('0x33')](moment()['format']('x'));}this[_0x70b7('0xa')][_0x25eb2e[_0x70b7('0x2e')]][_0x70b7('0x20')]=_0x25eb2e[_0x70b7('0x20')]['toLowerCase']();logger['debug'](_0x70b7('0x37'),util[_0x70b7('0x1a')](this[_0x70b7('0xa')][_0x25eb2e[_0x70b7('0x2e')]],{'showHidden':![],'depth':null}));this[_0x70b7('0x1c')](util[_0x70b7('0x28')](_0x70b7('0x29'),this['trunks'][_0x25eb2e[_0x70b7('0x2e')]]['name']),'trunk:save',this[_0x70b7('0xa')][_0x25eb2e[_0x70b7('0x2e')]]);}else if(_[_0x70b7('0x38')](_0x25eb2e[_0x70b7('0x2e')],_0x70b7('0x39'))){var _0x59d82e=_0x25eb2e['device'];var _0x1c719c=_0x59d82e[_0x70b7('0x3a')](_0x59d82e[_0x70b7('0x3b')]('/')+0x1,_0x59d82e[_0x70b7('0x3b')]('@'));var _0x127130=_[_0x70b7('0x3c')](this['agents'],function(_0x399a2a){return _0x399a2a[_0x70b7('0x3d')]==_0x1c719c||_0x399a2a[_0x70b7('0x3e')]==_0x1c719c||_0x399a2a[_0x70b7('0x3f')]==_0x1c719c;});if(_0x127130){if(_0x127130[_0x70b7('0x20')]!==_0x25eb2e[_0x70b7('0x20')][_0x70b7('0x31')]()){_0x127130['stateTime']=_['toNumber'](moment()['format']('x'));}_0x127130[_0x70b7('0x20')]=_0x25eb2e['state'][_0x70b7('0x31')]();_0x127130[_0x70b7('0x30')]=!![];_0x127130['updateStatusRealtime'](_0x25eb2e);}}}}catch(_0x57dba2){logger['error'](_0x70b7('0x2f'),util[_0x70b7('0x1a')](_0x57dba2,{'showHidden':![],'depth':null}));}};UserReport[_0x70b7('0x1b')][_0x70b7('0x10')]=function(_0x270ecb){try{if(this['isNotNull'](_0x270ecb)&&this[_0x70b7('0x1d')](_0x270ecb[_0x70b7('0x40')])){logger['info'](_0x70b7('0x41'),_0x270ecb['peer'],_0x270ecb[_0x70b7('0x42')],_0x270ecb[_0x70b7('0x40')]);logger['debug'](_0x70b7('0x43'),util[_0x70b7('0x1a')](_0x270ecb,{'showHidden':![],'depth':null}));if(this[_0x70b7('0xb')][_0x270ecb[_0x70b7('0x44')]]){if(!this[_0x70b7('0xb')][_0x270ecb['peer']][_0x70b7('0x30')]||_0x270ecb[_0x70b7('0x40')][_0x70b7('0x31')]()==_0x70b7('0x45')){this[_0x70b7('0xb')][_0x270ecb[_0x70b7('0x44')]][_0x70b7('0x30')]=![];this[_0x70b7('0xb')][_0x270ecb[_0x70b7('0x44')]]['status']=_0x270ecb[_0x70b7('0x40')][_0x70b7('0x31')]();this[_0x70b7('0xb')][_0x270ecb[_0x70b7('0x44')]][_0x70b7('0x42')]=_0x270ecb['address'];this[_0x70b7('0xb')][_0x270ecb['peer']][_0x70b7('0x46')](_0x270ecb);}}else if(this[_0x70b7('0xc')][_0x270ecb['peer']]){this[_0x70b7('0xc')][_0x270ecb['peer']]['status']=_0x270ecb[_0x70b7('0x40')][_0x70b7('0x31')]();this[_0x70b7('0xc')][_0x270ecb['peer']][_0x70b7('0x42')]=_0x270ecb[_0x70b7('0x42')];logger[_0x70b7('0x21')](_0x70b7('0x47'),util[_0x70b7('0x1a')](this[_0x70b7('0xc')][_0x270ecb['peer']],{'showHidden':![],'depth':null}));this[_0x70b7('0x1c')](util['format'](_0x70b7('0x35'),this['telephones'][_0x270ecb[_0x70b7('0x44')]][_0x70b7('0x2a')]),'telephone:save',this[_0x70b7('0xc')][_0x270ecb['peer']]);}else if(this[_0x70b7('0xa')][_0x270ecb['peer']]){this[_0x70b7('0xa')][_0x270ecb['peer']][_0x70b7('0x48')]=_0x270ecb['peerstatus'][_0x70b7('0x31')]();this[_0x70b7('0xa')][_0x270ecb[_0x70b7('0x44')]]['address']=_0x270ecb['address'];logger['debug'](_0x70b7('0x49'),util['inspect'](this['trunks'][_0x270ecb[_0x70b7('0x44')]],{'showHidden':![],'depth':null}));this[_0x70b7('0x1c')](util[_0x70b7('0x28')]('trunk:%s',this['trunks'][_0x270ecb[_0x70b7('0x44')]][_0x70b7('0x2a')]),_0x70b7('0x2b'),this['trunks'][_0x270ecb[_0x70b7('0x44')]]);}}}catch(_0xd93f88){logger[_0x70b7('0x15')](_0x70b7('0x43'),util[_0x70b7('0x1a')](_0xd93f88,{'showHidden':![],'depth':null}));}};module[_0x70b7('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 c006a2a..36cfe5f 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 _0xc777=['syncAgentComplete','varset','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','membername','[%s][voiceAgentReport][agentcalled]\x20event:','uniqueid','inspect','destuniqueid','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','merge','event','privilege','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','custom:agentcalled','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','format','user:%s','error','isNotNull','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','agentconnectAt','connectedlinename','connectedlinenum','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','user:agentconnect','agentcomplete','info','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answered_elsewhere','reason','custom:agentansweredelsewhere','[%s][voiceAgentReport][agentconnect]','syncAgentRingNoAnswer','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','talktime','acw','acwtime','agentacw','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','[%s][voiceAgentReport][agentcomplete]','syncVarSet','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20event:','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','[%s][voiceAgentReport][musiconholdstop]','exports','lodash','moment','ioredis','../../../config/environment','../../../config/logger','ami','redis','localhost','socket.io-emitter','channels','voiceQueues','agents','variables','agentcalled','syncAgentCalled','bind','agentconnect','syncAgentConnect','agentringnoanswer','syncQueueCallerAbandon'];(function(_0x54745,_0x45ef5f){var _0x3ed814=function(_0x544dc6){while(--_0x544dc6){_0x54745['push'](_0x54745['shift']());}};_0x3ed814(++_0x45ef5f);}(_0xc777,0x1b7));var _0x7c77=function(_0xc5fc3a,_0x516f7b){_0xc5fc3a=_0xc5fc3a-0x0;var _0x706179=_0xc777[_0xc5fc3a];return _0x706179;};'use strict';var _=require(_0x7c77('0x0'));var moment=require(_0x7c77('0x1'));var util=require('util');var Redis=require(_0x7c77('0x2'));var config=require(_0x7c77('0x3'));var logger=require(_0x7c77('0x4'))(_0x7c77('0x5'));var ami=require('../ami');config[_0x7c77('0x6')]=_['defaults'](config['redis'],{'host':_0x7c77('0x7'),'port':0x18eb});var io=require(_0x7c77('0x8'))(new Redis(config['redis']));function VoiceAgentReport(_0x392218){this[_0x7c77('0x9')]={};this[_0x7c77('0xa')]=_0x392218['voiceQueues'];this[_0x7c77('0xb')]=_0x392218['agents'];this[_0x7c77('0xc')]={};ami['on'](_0x7c77('0xd'),this[_0x7c77('0xe')][_0x7c77('0xf')](this));ami['on'](_0x7c77('0x10'),this[_0x7c77('0x11')][_0x7c77('0xf')](this));ami['on'](_0x7c77('0x12'),this['syncAgentRingNoAnswer'][_0x7c77('0xf')](this));ami['on']('queuecallerabandon',this[_0x7c77('0x13')][_0x7c77('0xf')](this));ami['on']('agentcomplete',this[_0x7c77('0x14')][_0x7c77('0xf')](this));ami['on'](_0x7c77('0x15'),this['syncVarSet'][_0x7c77('0xf')](this));ami['on']('hangup',this['syncHangup']['bind'](this));ami['on'](_0x7c77('0x16'),this[_0x7c77('0x17')]['bind'](this));ami['on'](_0x7c77('0x18'),this[_0x7c77('0x19')][_0x7c77('0xf')](this));ami['on'](_0x7c77('0x1a'),this[_0x7c77('0x1b')][_0x7c77('0xf')](this));ami['on'](_0x7c77('0x1c'),this[_0x7c77('0x1d')][_0x7c77('0xf')](this));}VoiceAgentReport[_0x7c77('0x1e')][_0x7c77('0x1f')]=function(_0x14c051,_0x67c0a2,_0x23ee8a){io['to'](_0x14c051)[_0x7c77('0x1f')](_0x67c0a2,_0x23ee8a);};VoiceAgentReport[_0x7c77('0x1e')]['isNotNull']=function(_0x28fba0){return _0x28fba0!==null&&!_[_0x7c77('0x20')](_0x28fba0);};VoiceAgentReport[_0x7c77('0x1e')][_0x7c77('0xe')]=function(_0x41363c){try{if(this['isNotNull'](_0x41363c)){logger['info'](_0x7c77('0x21'),_0x41363c['uniqueid'],_0x41363c[_0x7c77('0x22')],_0x41363c['destuniqueid']);logger['debug'](_0x7c77('0x23'),_0x41363c[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x41363c,{'showHidden':![],'depth':null}));if(_[_0x7c77('0x20')](this[_0x7c77('0x9')][_0x41363c[_0x7c77('0x24')]])){this[_0x7c77('0x9')][_0x41363c['uniqueid']]={};}if(_['isUndefined'](this[_0x7c77('0x9')][_0x41363c[_0x7c77('0x24')]][_0x41363c[_0x7c77('0x26')]])){this[_0x7c77('0x9')][_0x41363c[_0x7c77('0x24')]][_0x41363c[_0x7c77('0x26')]]={'agentcalledAt':moment()['format'](_0x7c77('0x27')),'lastevent':_0x7c77('0x28'),'mandatoryDisposition':this[_0x7c77('0xa')][_0x41363c[_0x7c77('0x29')]]?this[_0x7c77('0xa')][_0x41363c[_0x7c77('0x29')]][_0x7c77('0x2a')]||![]:![],'type':this[_0x7c77('0xa')][_0x41363c['queue']]?this[_0x7c77('0xa')][_0x41363c[_0x7c77('0x29')]][_0x7c77('0x2b')]||'inbound':'inbound','variables':this[_0x7c77('0xc')][_0x41363c['uniqueid']]};}_[_0x7c77('0x2c')](this['channels'][_0x41363c[_0x7c77('0x24')]][_0x41363c[_0x7c77('0x26')]],_['omit'](_0x41363c,[_0x7c77('0x2d'),_0x7c77('0x2e')]));logger[_0x7c77('0x2f')](_0x7c77('0x30'),_0x41363c[_0x7c77('0x24')],util[_0x7c77('0x25')](this['channels'][_0x41363c[_0x7c77('0x24')]][_0x41363c[_0x7c77('0x26')]],{'showHidden':![],'depth':null}));ami[_0x7c77('0x1f')](_0x7c77('0x31'),this[_0x7c77('0x9')][_0x41363c[_0x7c77('0x24')]][_0x41363c[_0x7c77('0x26')]]);logger[_0x7c77('0x2f')](_0x7c77('0x32'),_0x41363c[_0x7c77('0x24')],util[_0x7c77('0x25')](this[_0x7c77('0x9')][_0x41363c[_0x7c77('0x24')]][_0x41363c[_0x7c77('0x26')]],{'showHidden':![],'depth':null}));this[_0x7c77('0x1f')](util[_0x7c77('0x33')](_0x7c77('0x34'),_0x41363c[_0x7c77('0x22')]),'user:called',this['channels'][_0x41363c[_0x7c77('0x24')]][_0x41363c[_0x7c77('0x26')]]);}}catch(_0x2b99c2){logger[_0x7c77('0x35')]('[%s][voiceAgentReport][agentcalled]',_0x41363c[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x2b99c2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')]['syncAgentConnect']=function(_0x117451){try{if(this[_0x7c77('0x36')](_0x117451)){if(this['channels'][_0x117451['uniqueid']]){logger[_0x7c77('0x2f')](_0x7c77('0x37'),_0x117451[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x117451,{'showHidden':![],'depth':null}));for(var _0x37761d in this['channels'][_0x117451[_0x7c77('0x24')]]){if(this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x7c77('0x38')](_0x37761d)){if(_0x117451[_0x7c77('0x26')]===_0x37761d){logger['info']('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x117451[_0x7c77('0x24')],_0x117451['membername'],_0x117451[_0x7c77('0x26')]);this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x39')]=moment()[_0x7c77('0x33')](_0x7c77('0x27'));this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x3a')]=_0x117451[_0x7c77('0x3a')];this['channels'][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x3b')]=_0x117451[_0x7c77('0x3b')];this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x3c')]=_0x117451[_0x7c77('0x3c')];this[_0x7c77('0x9')][_0x117451['uniqueid']][_0x37761d][_0x7c77('0x3d')]=_0x117451[_0x7c77('0x3d')];this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x3e')]=_0x117451[_0x7c77('0x3e')];this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x3f')]=_0x7c77('0x40');_[_0x7c77('0x2c')](this['agents'][_0x117451[_0x7c77('0x41')]],_[_0x7c77('0x42')](_0x117451,[_0x7c77('0x29'),_0x7c77('0x43')]));logger['debug'](_0x7c77('0x44'),_0x117451[_0x7c77('0x24')],util['inspect'](this[_0x7c77('0x9')][_0x117451['uniqueid']][_0x117451[_0x7c77('0x26')]],{'showHidden':![],'depth':null}));ami[_0x7c77('0x1f')](_0x7c77('0x45'),this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x117451[_0x7c77('0x26')]]);logger['debug']('[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:',_0x117451[_0x7c77('0x24')],util[_0x7c77('0x25')](this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x117451[_0x7c77('0x26')]],{'showHidden':![],'depth':null}));this[_0x7c77('0x1f')](util[_0x7c77('0x33')](_0x7c77('0x34'),_0x117451[_0x7c77('0x22')]),_0x7c77('0x46'),this['channels'][_0x117451[_0x7c77('0x24')]][_0x117451['destuniqueid']]);}else if(!this['channels'][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x12')]&&!this[_0x7c77('0x9')][_0x117451['uniqueid']][_0x37761d][_0x7c77('0x47')]){logger[_0x7c77('0x48')]('[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere',_0x117451[_0x7c77('0x24')],this[_0x7c77('0x9')][_0x117451['uniqueid']][_0x37761d]['membername'],_0x37761d);this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x37761d]['agentringnoanswer']=!![];this['channels'][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x49')]=moment()[_0x7c77('0x33')](_0x7c77('0x27'));this['channels'][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x4a')]=_0x117451['destuniqueid'];this['channels'][_0x117451[_0x7c77('0x24')]][_0x37761d]['answeredelsewheremembername']=_0x117451['membername'];this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x37761d]['lastevent']=_0x7c77('0x4b');this[_0x7c77('0x9')][_0x117451[_0x7c77('0x24')]][_0x37761d][_0x7c77('0x4c')]='answered_elsewhere';logger[_0x7c77('0x2f')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x117451[_0x7c77('0x24')],util[_0x7c77('0x25')](this[_0x7c77('0x9')][_0x117451['uniqueid']][_0x37761d],{'showHidden':![],'depth':null}));ami[_0x7c77('0x1f')](_0x7c77('0x4d'),this[_0x7c77('0x9')][_0x117451['uniqueid']][_0x37761d]);}}}}}}catch(_0x3c7ddd){logger['error'](_0x7c77('0x4e'),_0x117451[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x3c7ddd,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')][_0x7c77('0x4f')]=function(_0x4f4154){try{if(this[_0x7c77('0x36')](_0x4f4154)){logger['debug'](_0x7c77('0x50'),_0x4f4154['uniqueid'],util['inspect'](_0x4f4154,{'showHidden':![],'depth':null}));if(this[_0x7c77('0x9')][_0x4f4154[_0x7c77('0x24')]]&&this[_0x7c77('0x9')][_0x4f4154[_0x7c77('0x24')]][_0x4f4154[_0x7c77('0x26')]]){logger[_0x7c77('0x48')](_0x7c77('0x51'),_0x4f4154[_0x7c77('0x24')],_0x4f4154['membername'],_0x4f4154['destuniqueid']);this[_0x7c77('0x9')][_0x4f4154[_0x7c77('0x24')]][_0x4f4154[_0x7c77('0x26')]][_0x7c77('0x12')]=!![];this[_0x7c77('0x9')][_0x4f4154[_0x7c77('0x24')]][_0x4f4154[_0x7c77('0x26')]][_0x7c77('0x49')]=moment()['format'](_0x7c77('0x27'));this['channels'][_0x4f4154['uniqueid']][_0x4f4154[_0x7c77('0x26')]][_0x7c77('0x3f')]=_0x7c77('0x52');this[_0x7c77('0x9')][_0x4f4154[_0x7c77('0x24')]][_0x4f4154[_0x7c77('0x26')]][_0x7c77('0x4c')]=_0x7c77('0x52');logger['debug'](_0x7c77('0x53'),_0x4f4154['uniqueid'],util[_0x7c77('0x25')](this['channels'][_0x4f4154[_0x7c77('0x24')]][_0x4f4154['destuniqueid']],{'showHidden':![],'depth':null}));ami['emit']('custom:agentringnoanswer',this[_0x7c77('0x9')][_0x4f4154[_0x7c77('0x24')]][_0x4f4154[_0x7c77('0x26')]]);}}}catch(_0x414f29){logger['error'](_0x7c77('0x54'),_0x4f4154[_0x7c77('0x24')],util['inspect'](_0x414f29,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')]['syncQueueCallerAbandon']=function(_0x4521b1){try{if(this['isNotNull'](_0x4521b1)){logger[_0x7c77('0x2f')](_0x7c77('0x55'),_0x4521b1[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x4521b1,{'showHidden':![],'depth':null}));if(this[_0x7c77('0x9')][_0x4521b1['uniqueid']]){for(var _0x5be1f1 in this[_0x7c77('0x9')][_0x4521b1[_0x7c77('0x24')]]){if(this[_0x7c77('0x9')][_0x4521b1[_0x7c77('0x24')]][_0x7c77('0x38')](_0x5be1f1)&&!this['channels'][_0x4521b1[_0x7c77('0x24')]][_0x5be1f1][_0x7c77('0x12')]&&!this[_0x7c77('0x9')][_0x4521b1[_0x7c77('0x24')]][_0x5be1f1][_0x7c77('0x47')]){logger[_0x7c77('0x48')](_0x7c77('0x56'),_0x4521b1[_0x7c77('0x24')],this[_0x7c77('0x9')][_0x4521b1[_0x7c77('0x24')]][_0x5be1f1]['membername'],_0x5be1f1);this[_0x7c77('0x9')][_0x4521b1[_0x7c77('0x24')]][_0x5be1f1]['agentringnoanswer']=!![];this[_0x7c77('0x9')][_0x4521b1[_0x7c77('0x24')]][_0x5be1f1][_0x7c77('0x49')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');this[_0x7c77('0x9')][_0x4521b1[_0x7c77('0x24')]][_0x5be1f1][_0x7c77('0x3f')]=_0x7c77('0x57');this[_0x7c77('0x9')][_0x4521b1['uniqueid']][_0x5be1f1]['reason']=_0x7c77('0x57');logger[_0x7c77('0x2f')]('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x4521b1[_0x7c77('0x24')],util[_0x7c77('0x25')](this[_0x7c77('0x9')][_0x4521b1[_0x7c77('0x24')]][_0x5be1f1],{'showHidden':![],'depth':null}));ami[_0x7c77('0x1f')](_0x7c77('0x58'),this[_0x7c77('0x9')][_0x4521b1[_0x7c77('0x24')]][_0x5be1f1]);}}}}}catch(_0x35f2a4){logger[_0x7c77('0x35')](_0x7c77('0x59'),_0x4521b1[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x35f2a4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')]['syncAgentComplete']=function(_0x286cd3){try{if(this[_0x7c77('0x36')](_0x286cd3)){logger[_0x7c77('0x2f')](_0x7c77('0x5a'),_0x286cd3[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x286cd3,{'showHidden':![],'depth':null}));if(this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]]){for(var _0x1018b0 in this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]]){if(this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x7c77('0x38')](_0x1018b0)){if(this[_0x7c77('0x9')][_0x286cd3['uniqueid']][_0x1018b0][_0x7c77('0x39')]&&!this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0][_0x7c77('0x47')]){logger['info'](_0x7c77('0x5b'),_0x286cd3[_0x7c77('0x24')],this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0][_0x7c77('0x22')],_0x1018b0);this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0][_0x7c77('0x47')]=!![];this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0][_0x7c77('0x5c')]=moment()['format'](_0x7c77('0x27'));this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0]['lastevent']=_0x7c77('0x5d');this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0][_0x7c77('0x4c')]=_0x286cd3['reason']==_0x7c77('0x5e')?'agent':_0x286cd3['reason'];this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0][_0x7c77('0x5f')]=_0x286cd3[_0x7c77('0x5f')];if(this[_0x7c77('0xa')][_0x286cd3[_0x7c77('0x29')]]&&this['voiceQueues'][_0x286cd3['queue']][_0x7c77('0x60')]){this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0][_0x7c77('0x61')]=this[_0x7c77('0xa')][_0x286cd3[_0x7c77('0x29')]]['acwTimeout'];this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0][_0x7c77('0x62')]=!![];}this['agents'][_0x286cd3[_0x7c77('0x41')]]=_['omit'](this[_0x7c77('0xb')][_0x286cd3[_0x7c77('0x41')]],['queue','destconnectedlinenum']);logger[_0x7c77('0x2f')](_0x7c77('0x63'),_0x286cd3[_0x7c77('0x24')],util[_0x7c77('0x25')](this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0],{'showHidden':![],'depth':null}));ami[_0x7c77('0x1f')]('custom:agentcomplete',this['channels'][_0x286cd3['uniqueid']][_0x1018b0]);logger[_0x7c77('0x2f')](_0x7c77('0x64'),_0x286cd3['uniqueid'],util[_0x7c77('0x25')](this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0],{'showHidden':![],'depth':null}));this['emit'](util[_0x7c77('0x33')](_0x7c77('0x34'),_0x286cd3[_0x7c77('0x22')]),'user:agentcomplete',this[_0x7c77('0x9')][_0x286cd3[_0x7c77('0x24')]][_0x1018b0]);}}}}}}catch(_0x2a9b28){logger[_0x7c77('0x35')](_0x7c77('0x65'),_0x286cd3[_0x7c77('0x24')],util['inspect'](_0x2a9b28,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')][_0x7c77('0x66')]=function(_0xa56a79){try{if(this[_0x7c77('0x36')](_0xa56a79)){logger[_0x7c77('0x2f')](_0x7c77('0x67'),_0xa56a79[_0x7c77('0x24')],util[_0x7c77('0x25')](_0xa56a79,{'showHidden':![],'depth':null}));this[_0x7c77('0x68')](_0xa56a79[_0x7c77('0x24')],_[_0x7c77('0x69')](_0xa56a79[_0x7c77('0x6a')])[0x0],_0xa56a79[_0x7c77('0x6b')]);if(this[_0x7c77('0x9')][_0xa56a79[_0x7c77('0x24')]]){for(var _0xfe33f0 in this[_0x7c77('0x9')][_0xa56a79[_0x7c77('0x24')]]){if(this['channels'][_0xa56a79[_0x7c77('0x24')]]['hasOwnProperty'](_0xfe33f0)){logger[_0x7c77('0x48')](_0x7c77('0x6c'),_0xa56a79[_0x7c77('0x24')],_0xfe33f0,_['keys'](_0xa56a79['variable'])[0x0],_0xa56a79['value']);if(_['isUndefined'](this[_0x7c77('0x9')][_0xa56a79[_0x7c77('0x24')]][_0xfe33f0][_0x7c77('0xc')])){this[_0x7c77('0x9')][_0xa56a79[_0x7c77('0x24')]][_0xfe33f0][_0x7c77('0xc')]={};}this['channels'][_0xa56a79[_0x7c77('0x24')]][_0xfe33f0][_0x7c77('0xc')]=this[_0x7c77('0xc')][_0xa56a79[_0x7c77('0x24')]];}}}}}catch(_0x122974){logger[_0x7c77('0x35')](_0x7c77('0x6d'),_0xa56a79['uniqueid'],util[_0x7c77('0x25')](_0x122974,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')][_0x7c77('0x68')]=function(_0x1c8a1d,_0x574b04,_0x4881c3){var _0x5f028a=[_0x7c77('0x6e'),_0x7c77('0x6f'),_0x7c77('0x70'),_0x7c77('0x71'),_0x7c77('0x72'),_0x7c77('0x73'),_0x7c77('0x74'),_0x7c77('0x75'),_0x7c77('0x76'),'sipuri','bridgepeer',_0x7c77('0x77'),_0x7c77('0x78'),_0x7c77('0x79'),'memberinterface',_0x7c77('0x7a'),'membername',_0x7c77('0x7b'),_0x7c77('0x7c')];if(!_[_0x7c77('0x7d')](_0x574b04)&&!_[_0x7c77('0x7e')](_0x5f028a,_0x574b04)){if(_[_0x7c77('0x20')](this[_0x7c77('0xc')][_0x1c8a1d])){this[_0x7c77('0xc')][_0x1c8a1d]={};}this['variables'][_0x1c8a1d][_0x574b04]=_0x4881c3;}};VoiceAgentReport[_0x7c77('0x1e')][_0x7c77('0x7f')]=function(_0x5a5c6b){try{if(this[_0x7c77('0x36')](_0x5a5c6b)){logger['debug'](_0x7c77('0x80'),_0x5a5c6b[_0x7c77('0x24')],util['inspect'](_0x5a5c6b,{'showHidden':![],'depth':null}));if(this['channels'][_0x5a5c6b['uniqueid']]){for(var _0xd5949a in this[_0x7c77('0x9')][_0x5a5c6b['uniqueid']]){if(this['channels'][_0x5a5c6b[_0x7c77('0x24')]][_0x7c77('0x38')](_0xd5949a)){if(this[_0x7c77('0x9')][_0x5a5c6b[_0x7c77('0x24')]][_0xd5949a][_0x7c77('0x4c')]==_0x7c77('0x5e')&&this[_0x7c77('0x9')][_0x5a5c6b['uniqueid']][_0xd5949a][_0x7c77('0x47')]){logger[_0x7c77('0x48')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x5a5c6b[_0x7c77('0x24')],_0xd5949a);this['channels'][_0x5a5c6b[_0x7c77('0x24')]][_0xd5949a]['agentcompleteAt']=moment()[_0x7c77('0x33')](_0x7c77('0x27'));}}}logger[_0x7c77('0x2f')](_0x7c77('0x81'),_0x5a5c6b[_0x7c77('0x24')],util[_0x7c77('0x25')](_['values'](this[_0x7c77('0x9')][_0x5a5c6b[_0x7c77('0x24')]]),{'showHidden':![],'depth':null}));ami['emit'](_0x7c77('0x82'),_[_0x7c77('0x83')](this['channels'][_0x5a5c6b[_0x7c77('0x24')]]));delete this['channels'][_0x5a5c6b[_0x7c77('0x24')]];}if(this[_0x7c77('0xc')][_0x5a5c6b['uniqueid']]){delete this[_0x7c77('0xc')][_0x5a5c6b[_0x7c77('0x24')]];}}}catch(_0x47e374){logger[_0x7c77('0x35')](_0x7c77('0x84'),_0x5a5c6b[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x47e374,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')][_0x7c77('0x1b')]=function(_0x3d2496){try{if(this[_0x7c77('0x36')](_0x3d2496)){logger[_0x7c77('0x2f')](_0x7c77('0x85'),_0x3d2496['uniqueid'],util[_0x7c77('0x25')](_0x3d2496,{'showHidden':![],'depth':null}));if(this['channels'][_0x3d2496[_0x7c77('0x86')]]){for(var _0x4289ba in this['channels'][_0x3d2496[_0x7c77('0x86')]]){if(this[_0x7c77('0x9')][_0x3d2496[_0x7c77('0x86')]]['hasOwnProperty'](_0x4289ba)){if(_0x3d2496[_0x7c77('0x87')]===_0x4289ba){logger[_0x7c77('0x48')](_0x7c77('0x88'),_0x3d2496['uniqueid'],this['channels'][_0x3d2496[_0x7c77('0x86')]][_0x4289ba][_0x7c77('0x22')],_0x4289ba);var _0x544ba5=moment();this[_0x7c77('0x9')][_0x3d2496['transfereeuniqueid']][_0x4289ba][_0x7c77('0x47')]=!![];this[_0x7c77('0x9')][_0x3d2496['transfereeuniqueid']][_0x4289ba][_0x7c77('0x5c')]=moment()['format'](_0x7c77('0x27'));this['channels'][_0x3d2496['transfereeuniqueid']][_0x4289ba][_0x7c77('0x3f')]=_0x7c77('0x5d');this[_0x7c77('0x9')][_0x3d2496[_0x7c77('0x86')]][_0x4289ba][_0x7c77('0x4c')]=_0x7c77('0x5e');this[_0x7c77('0x9')][_0x3d2496[_0x7c77('0x86')]][_0x4289ba][_0x7c77('0x5f')]=_0x544ba5[_0x7c77('0x89')](this['channels'][_0x3d2496[_0x7c77('0x86')]][_0x4289ba][_0x7c77('0x39')],_0x7c77('0x8a'));}}}}if(this['channels'][_0x3d2496[_0x7c77('0x8b')]]){var _0x8c73f5=this[_0x7c77('0x9')][_0x3d2496[_0x7c77('0x8b')]];this[_0x7c77('0x9')][_0x3d2496['secondtransfereruniqueid']]=this['channels'][_0x3d2496['transfereeuniqueid']];this[_0x7c77('0x9')][_0x3d2496['transfereeuniqueid']]=_0x8c73f5;}}}catch(_0x82a2f6){logger[_0x7c77('0x35')](_0x7c77('0x8c'),_0x3d2496['uniqueid'],util[_0x7c77('0x25')](_0x82a2f6,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')][_0x7c77('0x1d')]=function(_0x54f934){try{if(this[_0x7c77('0x36')](_0x54f934)){logger['debug']('[%s][voiceAgentReport][blindtransfer]\x20event:',_0x54f934[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x54f934,{'showHidden':![],'depth':null}));if(this[_0x7c77('0x9')][_0x54f934['transfereeuniqueid']]){for(var _0x2cf647 in this[_0x7c77('0x9')][_0x54f934[_0x7c77('0x86')]]){if(this['channels'][_0x54f934['transfereeuniqueid']][_0x7c77('0x38')](_0x2cf647)){if(_0x54f934[_0x7c77('0x8d')]===_0x2cf647){logger['info']('[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x54f934['uniqueid'],this[_0x7c77('0x9')][_0x54f934[_0x7c77('0x86')]][_0x2cf647][_0x7c77('0x22')],_0x2cf647);var _0x4b8bbd=moment();this[_0x7c77('0x9')][_0x54f934[_0x7c77('0x86')]][_0x2cf647][_0x7c77('0x47')]=!![];this[_0x7c77('0x9')][_0x54f934['transfereeuniqueid']][_0x2cf647]['agentcompleteAt']=_0x4b8bbd;this['channels'][_0x54f934['transfereeuniqueid']][_0x2cf647][_0x7c77('0x3f')]='complete';this[_0x7c77('0x9')][_0x54f934['transfereeuniqueid']][_0x2cf647]['reason']=_0x7c77('0x5e');this[_0x7c77('0x9')][_0x54f934['transfereeuniqueid']][_0x2cf647][_0x7c77('0x5f')]=_0x4b8bbd[_0x7c77('0x89')](this[_0x7c77('0x9')][_0x54f934[_0x7c77('0x86')]][_0x2cf647][_0x7c77('0x39')],'seconds');}}}}}}catch(_0x41ee31){logger[_0x7c77('0x35')](_0x7c77('0x8e'),_0x54f934['uniqueid'],util[_0x7c77('0x25')](_0x41ee31,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')][_0x7c77('0x17')]=function(_0x4aae06){var _0x2afabe='';try{if(this[_0x7c77('0x36')](_0x4aae06)){logger[_0x7c77('0x2f')]('[%s][voiceAgentReport][musiconholdstart]\x20event:',_0x4aae06[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x4aae06,{'showHidden':![],'depth':null}));if(_0x4aae06['channel']){_0x2afabe=_0x4aae06[_0x7c77('0x8f')][_0x7c77('0x90')](0x0,_0x4aae06[_0x7c77('0x8f')][_0x7c77('0x91')]('-'));if(this['agents'][_0x2afabe]){logger[_0x7c77('0x48')](_0x7c77('0x92'),_0x4aae06[_0x7c77('0x24')],_0x2afabe);this['agents'][_0x2afabe][_0x7c77('0x93')]=!![];}}}}catch(_0x141423){logger[_0x7c77('0x35')](_0x7c77('0x94'),_0x4aae06[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x141423,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0x7c77('0x1e')]['syncMusicOnHoldStop']=function(_0x562495){var _0x44f0ee='';try{if(this[_0x7c77('0x36')](_0x562495)){logger[_0x7c77('0x2f')](_0x7c77('0x95'),_0x562495[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x562495,{'showHidden':![],'depth':null}));if(_0x562495[_0x7c77('0x8f')]){_0x44f0ee=_0x562495[_0x7c77('0x8f')][_0x7c77('0x90')](0x0,_0x562495[_0x7c77('0x8f')][_0x7c77('0x91')]('-'));if(this['agents'][_0x44f0ee]){logger[_0x7c77('0x48')](_0x7c77('0x96'),_0x562495[_0x7c77('0x24')],_0x44f0ee);this[_0x7c77('0xb')][_0x44f0ee][_0x7c77('0x93')]=![];}}}}catch(_0x4d63b4){logger['error'](_0x7c77('0x97'),_0x562495[_0x7c77('0x24')],util[_0x7c77('0x25')](_0x4d63b4,{'showHidden':![],'depth':null}));}};module[_0x7c77('0x98')]=VoiceAgentReport; \ No newline at end of file +var _0xb40c=['isNotNull','info','uniqueid','destuniqueid','[%s][voiceAgentReport][agentcalled]\x20event:','inspect','channels','format','YYYY-MM-DD\x20HH:mm:ss','called','queue','mandatoryDisposition','type','inbound','merge','omit','event','debug','[%s][voiceAgentReport][agentcalled]\x20sending\x20agentcalled\x20event:','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:called\x20event:','membername','user:called','error','[%s][voiceAgentReport][agentcalled]','syncAgentConnect','[%s][voiceAgentReport][agentconnect]\x20event:','hasOwnProperty','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connectedlinename','destchannelstate','destchannelstatedesc','holdtime','lastevent','connect','interface','pick','destconnectedlinenum','[%s][voiceAgentReport][agentconnect]\x20sending\x20agentconnect\x20event:','custom:agentconnect','[%s][voiceAgentReport][agentcalled]\x20sending\x20user:agentconnect\x20event:','user:%s','[%s][voiceAgentReport][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:answered_elsewhere','agentringnoanswerAt','answeredelsewheredestinationuniqueid','answeredelsewheremembername','answered_elsewhere','[%s][voiceAgentReport][agentconnect]','[%s][voiceAgentReport][agentringnoanswer]\x20event:','[%s][voiceAgentReport][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:rejected','rejected','reason','custom:agentringnoanswer','[%s][voiceAgentReport][agentringnoanswer]','[%s][voiceAgentReport][queuecallerabandon]\x20event:','[%s][voiceAgentReport][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','custom:agentqueuecallerabandon','[%s][voiceAgentReport][queuecallerabandon]','[%s][voiceAgentReport][agentcomplete]\x20event:','agentconnectAt','[%s][voiceAgentReport][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','complete','transfer','agent','talktime','acw','acwtime','acwTimeout','[%s][voiceAgentReport][agentcomplete]\x20sending\x20agentcomplete\x20event:','custom:agentcomplete','[%s][voiceAgentReport][agentcomplete]\x20sending\x20user:agentcomplete\x20event:','user:agentcomplete','[%s][voiceAgentReport][varset]\x20event:','addVariable','keys','variable','value','[%s][voiceAgentReport][varset]\x20destuniqueid:%s\x20variable:%s\x20value:%s','[%s][voiceAgentReport][varset]','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','membercalls','memberinterface','memberlastcall','memberpenalty','memberrealtime','[%s][voiceAgentReport][hangup]\x20event:','[%s][voiceAgentReport][hangup]\x20sending\x20voiceAgentReport\x20event:','custom:voiceAgentReport','values','[%s][voiceAgentReport][hangup]','[%s][voiceAgentReport][attendedtransfer]\x20event:','transfereeuniqueid','origtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','seconds','secondtransfereruniqueid','[%s][voiceAgentReport][attendedtransfer]','[%s][voiceAgentReport][blindtransfer]\x20event:','transfereruniqueid','[%s][voiceAgentReport][blindtransfer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','diff','[%s][voiceAgentReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceAgentReport][musiconholdstart]\x20event:','channel','substring','lastIndexOf','[%s][voiceAgentReport][musiconholdstart]\x20interface:%s','onhold','[%s][voiceAgentReport][musiconholdstart]','[%s][voiceAgentReport][musiconholdstop]\x20interface:%s','exports','lodash','moment','util','../../../config/environment','ami','../ami','defaults','redis','localhost','socket.io-emitter','voiceQueues','agents','variables','agentcalled','bind','agentconnect','agentringnoanswer','syncAgentRingNoAnswer','syncQueueCallerAbandon','agentcomplete','syncAgentComplete','varset','syncVarSet','hangup','syncHangup','musiconholdstart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','prototype','emit','isUndefined','syncAgentCalled'];(function(_0x5aab91,_0x2485df){var _0x24f493=function(_0x3423e8){while(--_0x3423e8){_0x5aab91['push'](_0x5aab91['shift']());}};_0x24f493(++_0x2485df);}(_0xb40c,0x79));var _0xcb40=function(_0x2d4acf,_0x2ef4d6){_0x2d4acf=_0x2d4acf-0x0;var _0x331393=_0xb40c[_0x2d4acf];return _0x331393;};'use strict';var _=require(_0xcb40('0x0'));var moment=require(_0xcb40('0x1'));var util=require(_0xcb40('0x2'));var Redis=require('ioredis');var config=require(_0xcb40('0x3'));var logger=require('../../../config/logger')(_0xcb40('0x4'));var ami=require(_0xcb40('0x5'));config['redis']=_[_0xcb40('0x6')](config[_0xcb40('0x7')],{'host':_0xcb40('0x8'),'port':0x18eb});var io=require(_0xcb40('0x9'))(new Redis(config[_0xcb40('0x7')]));function VoiceAgentReport(_0x3549f7){this['channels']={};this['voiceQueues']=_0x3549f7[_0xcb40('0xa')];this[_0xcb40('0xb')]=_0x3549f7[_0xcb40('0xb')];this[_0xcb40('0xc')]={};ami['on'](_0xcb40('0xd'),this['syncAgentCalled'][_0xcb40('0xe')](this));ami['on'](_0xcb40('0xf'),this['syncAgentConnect'][_0xcb40('0xe')](this));ami['on'](_0xcb40('0x10'),this[_0xcb40('0x11')][_0xcb40('0xe')](this));ami['on']('queuecallerabandon',this[_0xcb40('0x12')][_0xcb40('0xe')](this));ami['on'](_0xcb40('0x13'),this[_0xcb40('0x14')][_0xcb40('0xe')](this));ami['on'](_0xcb40('0x15'),this[_0xcb40('0x16')][_0xcb40('0xe')](this));ami['on'](_0xcb40('0x17'),this[_0xcb40('0x18')][_0xcb40('0xe')](this));ami['on'](_0xcb40('0x19'),this['syncMusicOnHoldStart']['bind'](this));ami['on'](_0xcb40('0x1a'),this[_0xcb40('0x1b')][_0xcb40('0xe')](this));ami['on'](_0xcb40('0x1c'),this[_0xcb40('0x1d')][_0xcb40('0xe')](this));ami['on'](_0xcb40('0x1e'),this[_0xcb40('0x1f')][_0xcb40('0xe')](this));}VoiceAgentReport[_0xcb40('0x20')][_0xcb40('0x21')]=function(_0x3b1ef3,_0xc48512,_0x40c9b3){io['to'](_0x3b1ef3)[_0xcb40('0x21')](_0xc48512,_0x40c9b3);};VoiceAgentReport[_0xcb40('0x20')]['isNotNull']=function(_0x372a3d){return _0x372a3d!==null&&!_[_0xcb40('0x22')](_0x372a3d);};VoiceAgentReport['prototype'][_0xcb40('0x23')]=function(_0x2ccd86){try{if(this[_0xcb40('0x24')](_0x2ccd86)){logger[_0xcb40('0x25')]('[%s][voiceAgentReport][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x2ccd86[_0xcb40('0x26')],_0x2ccd86['membername'],_0x2ccd86[_0xcb40('0x27')]);logger['debug'](_0xcb40('0x28'),_0x2ccd86[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x2ccd86,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0xcb40('0x2a')][_0x2ccd86['uniqueid']])){this[_0xcb40('0x2a')][_0x2ccd86[_0xcb40('0x26')]]={};}if(_[_0xcb40('0x22')](this[_0xcb40('0x2a')][_0x2ccd86[_0xcb40('0x26')]][_0x2ccd86[_0xcb40('0x27')]])){this[_0xcb40('0x2a')][_0x2ccd86[_0xcb40('0x26')]][_0x2ccd86[_0xcb40('0x27')]]={'agentcalledAt':moment()[_0xcb40('0x2b')](_0xcb40('0x2c')),'lastevent':_0xcb40('0x2d'),'mandatoryDisposition':this['voiceQueues'][_0x2ccd86[_0xcb40('0x2e')]]?this[_0xcb40('0xa')][_0x2ccd86['queue']][_0xcb40('0x2f')]||![]:![],'type':this[_0xcb40('0xa')][_0x2ccd86[_0xcb40('0x2e')]]?this[_0xcb40('0xa')][_0x2ccd86[_0xcb40('0x2e')]][_0xcb40('0x30')]||_0xcb40('0x31'):_0xcb40('0x31'),'variables':this['variables'][_0x2ccd86[_0xcb40('0x26')]]};}_[_0xcb40('0x32')](this[_0xcb40('0x2a')][_0x2ccd86[_0xcb40('0x26')]][_0x2ccd86[_0xcb40('0x27')]],_[_0xcb40('0x33')](_0x2ccd86,[_0xcb40('0x34'),'privilege']));logger[_0xcb40('0x35')](_0xcb40('0x36'),_0x2ccd86['uniqueid'],util[_0xcb40('0x29')](this[_0xcb40('0x2a')][_0x2ccd86[_0xcb40('0x26')]][_0x2ccd86[_0xcb40('0x27')]],{'showHidden':![],'depth':null}));ami[_0xcb40('0x21')]('custom:agentcalled',this[_0xcb40('0x2a')][_0x2ccd86[_0xcb40('0x26')]][_0x2ccd86[_0xcb40('0x27')]]);logger[_0xcb40('0x35')](_0xcb40('0x37'),_0x2ccd86[_0xcb40('0x26')],util['inspect'](this[_0xcb40('0x2a')][_0x2ccd86[_0xcb40('0x26')]][_0x2ccd86[_0xcb40('0x27')]],{'showHidden':![],'depth':null}));this[_0xcb40('0x21')](util[_0xcb40('0x2b')]('user:%s',_0x2ccd86[_0xcb40('0x38')]),_0xcb40('0x39'),this[_0xcb40('0x2a')][_0x2ccd86[_0xcb40('0x26')]][_0x2ccd86[_0xcb40('0x27')]]);}}catch(_0x403130){logger[_0xcb40('0x3a')](_0xcb40('0x3b'),_0x2ccd86[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x403130,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb40('0x20')][_0xcb40('0x3c')]=function(_0x5a4b6c){try{if(this[_0xcb40('0x24')](_0x5a4b6c)){if(this['channels'][_0x5a4b6c[_0xcb40('0x26')]]){logger[_0xcb40('0x35')](_0xcb40('0x3d'),_0x5a4b6c[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x5a4b6c,{'showHidden':![],'depth':null}));for(var _0x3c6efe in this[_0xcb40('0x2a')][_0x5a4b6c['uniqueid']]){if(this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0xcb40('0x3e')](_0x3c6efe)){if(_0x5a4b6c[_0xcb40('0x27')]===_0x3c6efe){logger[_0xcb40('0x25')](_0xcb40('0x3f'),_0x5a4b6c[_0xcb40('0x26')],_0x5a4b6c[_0xcb40('0x38')],_0x5a4b6c[_0xcb40('0x27')]);this['channels'][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe]['agentconnectAt']=moment()[_0xcb40('0x2b')](_0xcb40('0x2c'));this[_0xcb40('0x2a')][_0x5a4b6c['uniqueid']][_0x3c6efe][_0xcb40('0x40')]=_0x5a4b6c['connectedlinename'];this['channels'][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe]['connectedlinenum']=_0x5a4b6c['connectedlinenum'];this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe][_0xcb40('0x41')]=_0x5a4b6c[_0xcb40('0x41')];this['channels'][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe][_0xcb40('0x42')]=_0x5a4b6c['destchannelstatedesc'];this['channels'][_0x5a4b6c['uniqueid']][_0x3c6efe][_0xcb40('0x43')]=_0x5a4b6c['holdtime'];this['channels'][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe][_0xcb40('0x44')]=_0xcb40('0x45');_['merge'](this[_0xcb40('0xb')][_0x5a4b6c[_0xcb40('0x46')]],_[_0xcb40('0x47')](_0x5a4b6c,[_0xcb40('0x2e'),_0xcb40('0x48')]));logger[_0xcb40('0x35')](_0xcb40('0x49'),_0x5a4b6c[_0xcb40('0x26')],util[_0xcb40('0x29')](this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x5a4b6c['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xcb40('0x21')](_0xcb40('0x4a'),this['channels'][_0x5a4b6c[_0xcb40('0x26')]][_0x5a4b6c['destuniqueid']]);logger[_0xcb40('0x35')](_0xcb40('0x4b'),_0x5a4b6c['uniqueid'],util[_0xcb40('0x29')](this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x5a4b6c[_0xcb40('0x27')]],{'showHidden':![],'depth':null}));this['emit'](util[_0xcb40('0x2b')](_0xcb40('0x4c'),_0x5a4b6c[_0xcb40('0x38')]),'user:agentconnect',this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x5a4b6c[_0xcb40('0x27')]]);}else if(!this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe][_0xcb40('0x10')]&&!this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe]['agentcomplete']){logger[_0xcb40('0x25')](_0xcb40('0x4d'),_0x5a4b6c[_0xcb40('0x26')],this['channels'][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe][_0xcb40('0x38')],_0x3c6efe);this['channels'][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe][_0xcb40('0x10')]=!![];this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe][_0xcb40('0x4e')]=moment()[_0xcb40('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe][_0xcb40('0x4f')]=_0x5a4b6c['destuniqueid'];this[_0xcb40('0x2a')][_0x5a4b6c['uniqueid']][_0x3c6efe][_0xcb40('0x50')]=_0x5a4b6c[_0xcb40('0x38')];this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe][_0xcb40('0x44')]=_0xcb40('0x51');this['channels'][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe]['reason']=_0xcb40('0x51');logger[_0xcb40('0x35')]('[%s][voiceAgentReport][agentconnect]\x20sending\x20agentansweredelsewhere\x20event:',_0x5a4b6c[_0xcb40('0x26')],util[_0xcb40('0x29')](this['channels'][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe],{'showHidden':![],'depth':null}));ami[_0xcb40('0x21')]('custom:agentansweredelsewhere',this[_0xcb40('0x2a')][_0x5a4b6c[_0xcb40('0x26')]][_0x3c6efe]);}}}}}}catch(_0x23dbd1){logger[_0xcb40('0x3a')](_0xcb40('0x52'),_0x5a4b6c['uniqueid'],util['inspect'](_0x23dbd1,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcb40('0x11')]=function(_0x417264){try{if(this[_0xcb40('0x24')](_0x417264)){logger[_0xcb40('0x35')](_0xcb40('0x53'),_0x417264['uniqueid'],util[_0xcb40('0x29')](_0x417264,{'showHidden':![],'depth':null}));if(this['channels'][_0x417264[_0xcb40('0x26')]]&&this[_0xcb40('0x2a')][_0x417264[_0xcb40('0x26')]][_0x417264[_0xcb40('0x27')]]){logger['info'](_0xcb40('0x54'),_0x417264[_0xcb40('0x26')],_0x417264['membername'],_0x417264[_0xcb40('0x27')]);this[_0xcb40('0x2a')][_0x417264[_0xcb40('0x26')]][_0x417264[_0xcb40('0x27')]][_0xcb40('0x10')]=!![];this[_0xcb40('0x2a')][_0x417264['uniqueid']][_0x417264[_0xcb40('0x27')]]['agentringnoanswerAt']=moment()[_0xcb40('0x2b')](_0xcb40('0x2c'));this[_0xcb40('0x2a')][_0x417264[_0xcb40('0x26')]][_0x417264[_0xcb40('0x27')]][_0xcb40('0x44')]=_0xcb40('0x55');this['channels'][_0x417264[_0xcb40('0x26')]][_0x417264[_0xcb40('0x27')]][_0xcb40('0x56')]='rejected';logger['debug']('[%s][voiceAgentReport][agentringnoanswer]\x20sending\x20agentringnoanswer\x20event:',_0x417264[_0xcb40('0x26')],util['inspect'](this[_0xcb40('0x2a')][_0x417264['uniqueid']][_0x417264['destuniqueid']],{'showHidden':![],'depth':null}));ami[_0xcb40('0x21')](_0xcb40('0x57'),this['channels'][_0x417264[_0xcb40('0x26')]][_0x417264[_0xcb40('0x27')]]);}}}catch(_0x35e2a2){logger[_0xcb40('0x3a')](_0xcb40('0x58'),_0x417264[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x35e2a2,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb40('0x20')][_0xcb40('0x12')]=function(_0x51027e){try{if(this[_0xcb40('0x24')](_0x51027e)){logger[_0xcb40('0x35')](_0xcb40('0x59'),_0x51027e[_0xcb40('0x26')],util['inspect'](_0x51027e,{'showHidden':![],'depth':null}));if(this[_0xcb40('0x2a')][_0x51027e[_0xcb40('0x26')]]){for(var _0x4c78b2 in this[_0xcb40('0x2a')][_0x51027e[_0xcb40('0x26')]]){if(this['channels'][_0x51027e['uniqueid']][_0xcb40('0x3e')](_0x4c78b2)&&!this['channels'][_0x51027e['uniqueid']][_0x4c78b2]['agentringnoanswer']&&!this['channels'][_0x51027e['uniqueid']][_0x4c78b2][_0xcb40('0x13')]){logger[_0xcb40('0x25')](_0xcb40('0x5a'),_0x51027e[_0xcb40('0x26')],this['channels'][_0x51027e[_0xcb40('0x26')]][_0x4c78b2][_0xcb40('0x38')],_0x4c78b2);this[_0xcb40('0x2a')][_0x51027e[_0xcb40('0x26')]][_0x4c78b2]['agentringnoanswer']=!![];this[_0xcb40('0x2a')][_0x51027e[_0xcb40('0x26')]][_0x4c78b2][_0xcb40('0x4e')]=moment()[_0xcb40('0x2b')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xcb40('0x2a')][_0x51027e[_0xcb40('0x26')]][_0x4c78b2][_0xcb40('0x44')]='abandoned';this[_0xcb40('0x2a')][_0x51027e[_0xcb40('0x26')]][_0x4c78b2][_0xcb40('0x56')]=_0xcb40('0x5b');logger['debug']('[%s][voiceAgentReport][queuecallerabandon]\x20sending\x20agentqueuecallerabandon\x20event:',_0x51027e['uniqueid'],util[_0xcb40('0x29')](this['channels'][_0x51027e[_0xcb40('0x26')]][_0x4c78b2],{'showHidden':![],'depth':null}));ami[_0xcb40('0x21')](_0xcb40('0x5c'),this['channels'][_0x51027e[_0xcb40('0x26')]][_0x4c78b2]);}}}}}catch(_0x3b048f){logger[_0xcb40('0x3a')](_0xcb40('0x5d'),_0x51027e[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x3b048f,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb40('0x20')][_0xcb40('0x14')]=function(_0x1825de){try{if(this[_0xcb40('0x24')](_0x1825de)){logger[_0xcb40('0x35')](_0xcb40('0x5e'),_0x1825de[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x1825de,{'showHidden':![],'depth':null}));if(this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]]){for(var _0x9cadd0 in this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]]){if(this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]][_0xcb40('0x3e')](_0x9cadd0)){if(this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]][_0x9cadd0][_0xcb40('0x5f')]&&!this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]][_0x9cadd0]['agentcomplete']){logger['info'](_0xcb40('0x60'),_0x1825de[_0xcb40('0x26')],this['channels'][_0x1825de[_0xcb40('0x26')]][_0x9cadd0][_0xcb40('0x38')],_0x9cadd0);this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]][_0x9cadd0][_0xcb40('0x13')]=!![];this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]][_0x9cadd0][_0xcb40('0x61')]=moment()[_0xcb40('0x2b')](_0xcb40('0x2c'));this[_0xcb40('0x2a')][_0x1825de['uniqueid']][_0x9cadd0][_0xcb40('0x44')]=_0xcb40('0x62');this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]][_0x9cadd0]['reason']=_0x1825de['reason']==_0xcb40('0x63')?_0xcb40('0x64'):_0x1825de['reason'];this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]][_0x9cadd0][_0xcb40('0x65')]=_0x1825de[_0xcb40('0x65')];if(this['voiceQueues'][_0x1825de[_0xcb40('0x2e')]]&&this['voiceQueues'][_0x1825de[_0xcb40('0x2e')]][_0xcb40('0x66')]){this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]][_0x9cadd0][_0xcb40('0x67')]=this[_0xcb40('0xa')][_0x1825de[_0xcb40('0x2e')]][_0xcb40('0x68')];this[_0xcb40('0x2a')][_0x1825de['uniqueid']][_0x9cadd0]['agentacw']=!![];}this[_0xcb40('0xb')][_0x1825de['interface']]=_[_0xcb40('0x33')](this[_0xcb40('0xb')][_0x1825de[_0xcb40('0x46')]],['queue',_0xcb40('0x48')]);logger['debug'](_0xcb40('0x69'),_0x1825de[_0xcb40('0x26')],util[_0xcb40('0x29')](this[_0xcb40('0x2a')][_0x1825de['uniqueid']][_0x9cadd0],{'showHidden':![],'depth':null}));ami['emit'](_0xcb40('0x6a'),this[_0xcb40('0x2a')][_0x1825de[_0xcb40('0x26')]][_0x9cadd0]);logger[_0xcb40('0x35')](_0xcb40('0x6b'),_0x1825de[_0xcb40('0x26')],util['inspect'](this['channels'][_0x1825de[_0xcb40('0x26')]][_0x9cadd0],{'showHidden':![],'depth':null}));this[_0xcb40('0x21')](util[_0xcb40('0x2b')](_0xcb40('0x4c'),_0x1825de[_0xcb40('0x38')]),_0xcb40('0x6c'),this[_0xcb40('0x2a')][_0x1825de['uniqueid']][_0x9cadd0]);}}}}}}catch(_0x8d474c){logger[_0xcb40('0x3a')]('[%s][voiceAgentReport][agentcomplete]',_0x1825de['uniqueid'],util[_0xcb40('0x29')](_0x8d474c,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb40('0x20')][_0xcb40('0x16')]=function(_0x20b7b9){try{if(this[_0xcb40('0x24')](_0x20b7b9)){logger[_0xcb40('0x35')](_0xcb40('0x6d'),_0x20b7b9[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x20b7b9,{'showHidden':![],'depth':null}));this[_0xcb40('0x6e')](_0x20b7b9[_0xcb40('0x26')],_[_0xcb40('0x6f')](_0x20b7b9[_0xcb40('0x70')])[0x0],_0x20b7b9[_0xcb40('0x71')]);if(this[_0xcb40('0x2a')][_0x20b7b9[_0xcb40('0x26')]]){for(var _0x5551b1 in this['channels'][_0x20b7b9['uniqueid']]){if(this[_0xcb40('0x2a')][_0x20b7b9['uniqueid']]['hasOwnProperty'](_0x5551b1)){logger[_0xcb40('0x25')](_0xcb40('0x72'),_0x20b7b9[_0xcb40('0x26')],_0x5551b1,_[_0xcb40('0x6f')](_0x20b7b9['variable'])[0x0],_0x20b7b9[_0xcb40('0x71')]);if(_[_0xcb40('0x22')](this['channels'][_0x20b7b9['uniqueid']][_0x5551b1][_0xcb40('0xc')])){this['channels'][_0x20b7b9[_0xcb40('0x26')]][_0x5551b1][_0xcb40('0xc')]={};}this[_0xcb40('0x2a')][_0x20b7b9['uniqueid']][_0x5551b1]['variables']=this[_0xcb40('0xc')][_0x20b7b9[_0xcb40('0x26')]];}}}}}catch(_0x5fb058){logger[_0xcb40('0x3a')](_0xcb40('0x73'),_0x20b7b9['uniqueid'],util['inspect'](_0x5fb058,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb40('0x20')][_0xcb40('0x6e')]=function(_0x3fe446,_0x2019fb,_0x1f9776){var _0x106c47=[_0xcb40('0x74'),_0xcb40('0x75'),_0xcb40('0x76'),_0xcb40('0x77'),_0xcb40('0x78'),_0xcb40('0x79'),_0xcb40('0x7a'),_0xcb40('0x7b'),_0xcb40('0x7c'),'sipuri','bridgepeer','bridgepvtcallid',_0xcb40('0x7d'),'memberdynamic',_0xcb40('0x7e'),_0xcb40('0x7f'),_0xcb40('0x38'),_0xcb40('0x80'),_0xcb40('0x81')];if(!_['isNil'](_0x2019fb)&&!_['includes'](_0x106c47,_0x2019fb)){if(_[_0xcb40('0x22')](this[_0xcb40('0xc')][_0x3fe446])){this[_0xcb40('0xc')][_0x3fe446]={};}this['variables'][_0x3fe446][_0x2019fb]=_0x1f9776;}};VoiceAgentReport['prototype'][_0xcb40('0x18')]=function(_0x633ca0){try{if(this[_0xcb40('0x24')](_0x633ca0)){logger['debug'](_0xcb40('0x82'),_0x633ca0[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x633ca0,{'showHidden':![],'depth':null}));if(this[_0xcb40('0x2a')][_0x633ca0[_0xcb40('0x26')]]){for(var _0x4ad569 in this[_0xcb40('0x2a')][_0x633ca0[_0xcb40('0x26')]]){if(this[_0xcb40('0x2a')][_0x633ca0['uniqueid']][_0xcb40('0x3e')](_0x4ad569)){if(this[_0xcb40('0x2a')][_0x633ca0[_0xcb40('0x26')]][_0x4ad569][_0xcb40('0x56')]==_0xcb40('0x63')&&this[_0xcb40('0x2a')][_0x633ca0['uniqueid']][_0x4ad569][_0xcb40('0x13')]){logger[_0xcb40('0x25')]('[%s][voiceAgentReport][hangup]\x20destuniqueid:%s',_0x633ca0[_0xcb40('0x26')],_0x4ad569);this['channels'][_0x633ca0[_0xcb40('0x26')]][_0x4ad569]['agentcompleteAt']=moment()[_0xcb40('0x2b')](_0xcb40('0x2c'));}}}logger[_0xcb40('0x35')](_0xcb40('0x83'),_0x633ca0[_0xcb40('0x26')],util[_0xcb40('0x29')](_['values'](this[_0xcb40('0x2a')][_0x633ca0[_0xcb40('0x26')]]),{'showHidden':![],'depth':null}));ami['emit'](_0xcb40('0x84'),_[_0xcb40('0x85')](this[_0xcb40('0x2a')][_0x633ca0[_0xcb40('0x26')]]));delete this['channels'][_0x633ca0[_0xcb40('0x26')]];}if(this['variables'][_0x633ca0[_0xcb40('0x26')]]){delete this['variables'][_0x633ca0['uniqueid']];}}}catch(_0x22bea4){logger[_0xcb40('0x3a')](_0xcb40('0x86'),_0x633ca0[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x22bea4,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb40('0x20')][_0xcb40('0x1d')]=function(_0x3d2453){try{if(this[_0xcb40('0x24')](_0x3d2453)){logger['debug'](_0xcb40('0x87'),_0x3d2453[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x3d2453,{'showHidden':![],'depth':null}));if(this[_0xcb40('0x2a')][_0x3d2453['transfereeuniqueid']]){for(var _0x1b1236 in this[_0xcb40('0x2a')][_0x3d2453[_0xcb40('0x88')]]){if(this[_0xcb40('0x2a')][_0x3d2453[_0xcb40('0x88')]][_0xcb40('0x3e')](_0x1b1236)){if(_0x3d2453[_0xcb40('0x89')]===_0x1b1236){logger['info'](_0xcb40('0x8a'),_0x3d2453[_0xcb40('0x26')],this[_0xcb40('0x2a')][_0x3d2453[_0xcb40('0x88')]][_0x1b1236][_0xcb40('0x38')],_0x1b1236);var _0x8b0d4a=moment();this[_0xcb40('0x2a')][_0x3d2453[_0xcb40('0x88')]][_0x1b1236][_0xcb40('0x13')]=!![];this[_0xcb40('0x2a')][_0x3d2453['transfereeuniqueid']][_0x1b1236][_0xcb40('0x61')]=moment()[_0xcb40('0x2b')](_0xcb40('0x2c'));this[_0xcb40('0x2a')][_0x3d2453['transfereeuniqueid']][_0x1b1236][_0xcb40('0x44')]=_0xcb40('0x62');this['channels'][_0x3d2453['transfereeuniqueid']][_0x1b1236]['reason']='transfer';this[_0xcb40('0x2a')][_0x3d2453[_0xcb40('0x88')]][_0x1b1236][_0xcb40('0x65')]=_0x8b0d4a['diff'](this[_0xcb40('0x2a')][_0x3d2453[_0xcb40('0x88')]][_0x1b1236][_0xcb40('0x5f')],_0xcb40('0x8b'));}}}}if(this['channels'][_0x3d2453[_0xcb40('0x8c')]]){var _0x337ea1=this[_0xcb40('0x2a')][_0x3d2453['secondtransfereruniqueid']];this['channels'][_0x3d2453[_0xcb40('0x8c')]]=this[_0xcb40('0x2a')][_0x3d2453[_0xcb40('0x88')]];this['channels'][_0x3d2453[_0xcb40('0x88')]]=_0x337ea1;}}}catch(_0x34eb63){logger['error'](_0xcb40('0x8d'),_0x3d2453[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x34eb63,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb40('0x20')][_0xcb40('0x1f')]=function(_0xee9b7f){try{if(this['isNotNull'](_0xee9b7f)){logger[_0xcb40('0x35')](_0xcb40('0x8e'),_0xee9b7f[_0xcb40('0x26')],util[_0xcb40('0x29')](_0xee9b7f,{'showHidden':![],'depth':null}));if(this[_0xcb40('0x2a')][_0xee9b7f[_0xcb40('0x88')]]){for(var _0x49d7d4 in this[_0xcb40('0x2a')][_0xee9b7f[_0xcb40('0x88')]]){if(this[_0xcb40('0x2a')][_0xee9b7f[_0xcb40('0x88')]][_0xcb40('0x3e')](_0x49d7d4)){if(_0xee9b7f[_0xcb40('0x8f')]===_0x49d7d4){logger[_0xcb40('0x25')](_0xcb40('0x90'),_0xee9b7f['uniqueid'],this['channels'][_0xee9b7f['transfereeuniqueid']][_0x49d7d4][_0xcb40('0x38')],_0x49d7d4);var _0x426328=moment();this[_0xcb40('0x2a')][_0xee9b7f[_0xcb40('0x88')]][_0x49d7d4][_0xcb40('0x13')]=!![];this[_0xcb40('0x2a')][_0xee9b7f[_0xcb40('0x88')]][_0x49d7d4]['agentcompleteAt']=_0x426328;this[_0xcb40('0x2a')][_0xee9b7f['transfereeuniqueid']][_0x49d7d4][_0xcb40('0x44')]=_0xcb40('0x62');this[_0xcb40('0x2a')][_0xee9b7f[_0xcb40('0x88')]][_0x49d7d4][_0xcb40('0x56')]=_0xcb40('0x63');this[_0xcb40('0x2a')][_0xee9b7f['transfereeuniqueid']][_0x49d7d4][_0xcb40('0x65')]=_0x426328[_0xcb40('0x91')](this[_0xcb40('0x2a')][_0xee9b7f['transfereeuniqueid']][_0x49d7d4][_0xcb40('0x5f')],_0xcb40('0x8b'));}}}}}}catch(_0x320c88){logger['error'](_0xcb40('0x92'),_0xee9b7f['uniqueid'],util['inspect'](_0x320c88,{'showHidden':![],'depth':null}));}};VoiceAgentReport['prototype'][_0xcb40('0x93')]=function(_0x4cd2b4){var _0x155cd4='';try{if(this[_0xcb40('0x24')](_0x4cd2b4)){logger[_0xcb40('0x35')](_0xcb40('0x94'),_0x4cd2b4[_0xcb40('0x26')],util['inspect'](_0x4cd2b4,{'showHidden':![],'depth':null}));if(_0x4cd2b4[_0xcb40('0x95')]){_0x155cd4=_0x4cd2b4['channel'][_0xcb40('0x96')](0x0,_0x4cd2b4[_0xcb40('0x95')][_0xcb40('0x97')]('-'));if(this[_0xcb40('0xb')][_0x155cd4]){logger[_0xcb40('0x25')](_0xcb40('0x98'),_0x4cd2b4[_0xcb40('0x26')],_0x155cd4);this['agents'][_0x155cd4][_0xcb40('0x99')]=!![];}}}}catch(_0x40f950){logger['error'](_0xcb40('0x9a'),_0x4cd2b4['uniqueid'],util[_0xcb40('0x29')](_0x40f950,{'showHidden':![],'depth':null}));}};VoiceAgentReport[_0xcb40('0x20')][_0xcb40('0x1b')]=function(_0x5a64a2){var _0x22f805='';try{if(this['isNotNull'](_0x5a64a2)){logger['debug']('[%s][voiceAgentReport][musiconholdstop]\x20event:',_0x5a64a2[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x5a64a2,{'showHidden':![],'depth':null}));if(_0x5a64a2[_0xcb40('0x95')]){_0x22f805=_0x5a64a2['channel'][_0xcb40('0x96')](0x0,_0x5a64a2['channel']['lastIndexOf']('-'));if(this[_0xcb40('0xb')][_0x22f805]){logger[_0xcb40('0x25')](_0xcb40('0x9b'),_0x5a64a2[_0xcb40('0x26')],_0x22f805);this['agents'][_0x22f805][_0xcb40('0x99')]=![];}}}}catch(_0x277d00){logger[_0xcb40('0x3a')]('[%s][voiceAgentReport][musiconholdstop]',_0x5a64a2[_0xcb40('0x26')],util[_0xcb40('0x29')](_0x277d00,{'showHidden':![],'depth':null}));}};module[_0xcb40('0x9c')]=VoiceAgentReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceCallReport.js b/server/services/ami/report/voiceCallReport.js index d71e817..1b3d018 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 _0xc35a=['destinationchannel','finally','blindTransfers','outbound','custom:voiceCallReport','[%s][voiceCallReport][hangup]','origtransferercalleridnum','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','transferconnectedlinenum','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BLIND','BlindTransfer','transfererchannel','transfereruniqueid','[%s][voiceCallReport][blindtransfer]','[%s][voiceCallReport][musiconholdstart]\x20event:','[%s][voiceCallReport][musiconholdstart]','[%s][voiceCallReport][musiconholdstop]\x20event:','mohstarttime','mohtime','milliseconds','[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s','[%s][voiceCallReport][musiconholdstop]','exports','bluebird','lodash','util','path','ioredis','../../../config/environment','../../../config/logger','ami','../ami','../model/channel','../rpc/setting','unknown','not_inuse','inuse','busy','invalid','ringing','ringinuse','onhold','set','queue','agi','playback','NO\x20ANSWER','FAILED','ANSWERED','defaults','redis','socket.io-emitter','channels','agents','coreshowchannel','syncNewExten','newexten','newchannel','syncNewChannel','bind','newstate','syncNewState','syncVarSet','hangup','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','info','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','[voiceCallReport][coreshowchannels]','prototype','emit','syncNewCallerId','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','[%s][voiceCallReport][newcallerid]\x20event:','inspect','linkedid','merge','pick','keys','error','[%s][voiceCallReport][newcallerid]','isNotNull','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','isUndefined','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','disposition','toNumber','channelstate','split','destconnectedlinenum','accountcode','user:%s','name','[%s][voiceCallReport][newchannel]','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','duration','subtract','seconds','YYYY-MM-DD\x20HH:mm:ss','includes','lastdata','startsWith','cdr(','match','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','[%s][voiceCallReport][newstate]\x20event:','answered','answertime','holdtime','diff','xcally-motion-preview','connectedlinenum','connectedlinename','calleridname','UserId','membername','[%s][voiceCallReport][newstate]','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','monitor','endsWith','.wav49','.WAV','monitorFilename','find','monitors','isNil','[%s][voiceCallReport][mixMonitorFilename]','[%s][voiceCallReport][varset]\x20event:','mixmonitor_filename','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','variable','xmd-phone','xmd-callerid','callerid','xmd-cdrtype','[%s][voiceCallReport][varset]\x20variable:xmd-cdrtype\x20value:%s','type','xmd-queue','[%s][voiceCallReport][varset]\x20variable:xmd-queue\x20value:%s','xmd-originatecalleridnum','[%s][voiceCallReport][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','[%s][voiceCallReport][varset]\x20variable:xmd-destination\x20value:%s','destination','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','omit','user:agentcomplete','resolve','then','transferType','undefined','getSettings','stopRecordingOnTransfer','Action','StopMixMonitor','catch'];(function(_0x17406e,_0x1049fd){var _0x2bfc5a=function(_0x2aae05){while(--_0x2aae05){_0x17406e['push'](_0x17406e['shift']());}};_0x2bfc5a(++_0x1049fd);}(_0xc35a,0x1c6));var _0xac35=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xc35a[_0x3b380d];return _0x54502b;};'use strict';var BPromise=require(_0xac35('0x0'));var _=require(_0xac35('0x1'));var moment=require('moment');var util=require(_0xac35('0x2'));var path=require(_0xac35('0x3'));var Redis=require(_0xac35('0x4'));var config=require(_0xac35('0x5'));var logger=require(_0xac35('0x6'))(_0xac35('0x7'));var ami=require(_0xac35('0x8'));var Channel=require(_0xac35('0x9'));var RpcSetting=require(_0xac35('0xa'));var statusDesc=[_0xac35('0xb'),_0xac35('0xc'),_0xac35('0xd'),_0xac35('0xe'),_0xac35('0xf'),'unavailable',_0xac35('0x10'),_0xac35('0x11'),_0xac35('0x12')];var applications=[_0xac35('0x13'),_0xac35('0x14'),_0xac35('0x15'),'dial',_0xac35('0x16'),'voicemail'];var dispositions=[_0xac35('0x17'),_0xac35('0x18'),'FAILED','NO\x20ANSWER',_0xac35('0x17'),_0xac35('0x17'),_0xac35('0x19'),'BUSY','FAILED',_0xac35('0x18'),_0xac35('0x18')];var actions={};config['redis']=_[_0xac35('0x1a')](config[_0xac35('0x1b')],{'host':'localhost','port':0x18eb});var io=require(_0xac35('0x1c'))(new Redis(config[_0xac35('0x1b')]));function VoiceCallReport(_0x2e7038){this[_0xac35('0x1d')]=_0x2e7038[_0xac35('0x1d')];this[_0xac35('0x1e')]=_0x2e7038[_0xac35('0x1e')];this['blindTransfers']={};ami['on'](_0xac35('0x1f'),this[_0xac35('0x20')]['bind'](this));ami['on'](_0xac35('0x21'),this[_0xac35('0x20')]['bind'](this));ami['on'](_0xac35('0x22'),this[_0xac35('0x23')][_0xac35('0x24')](this));ami['on'](_0xac35('0x25'),this[_0xac35('0x26')]['bind'](this));ami['on']('varset',this[_0xac35('0x27')][_0xac35('0x24')](this));ami['on'](_0xac35('0x28'),this['syncHangup'][_0xac35('0x24')](this));ami['on']('newcallerid',this['syncNewCallerId']['bind'](this));ami['on'](_0xac35('0x29'),this[_0xac35('0x2a')][_0xac35('0x24')](this));ami['on'](_0xac35('0x2b'),this[_0xac35('0x2c')][_0xac35('0x24')](this));ami['on'](_0xac35('0x2d'),this[_0xac35('0x2e')][_0xac35('0x24')](this));ami['on'](_0xac35('0x2f'),this[_0xac35('0x30')][_0xac35('0x24')](this));try{logger[_0xac35('0x31')](_0xac35('0x32'));ami[_0xac35('0x33')]();}catch(_0x74b66e){logger['error'](_0xac35('0x34'),util['inspect'](_0x74b66e,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0xac35('0x35')]['isNotNull']=function(_0x2d38f0){return _0x2d38f0!==null&&!_['isUndefined'](_0x2d38f0);};VoiceCallReport[_0xac35('0x35')][_0xac35('0x36')]=function(_0x202f09,_0x1b2c70,_0x1c00cf){io['to'](_0x202f09)[_0xac35('0x36')](_0x1b2c70,_0x1c00cf);};VoiceCallReport[_0xac35('0x35')][_0xac35('0x37')]=function(_0x8874c0){try{if(this['isNotNull'](_0x8874c0)){logger[_0xac35('0x31')](_0xac35('0x38'),_0x8874c0[_0xac35('0x39')],_0x8874c0['calleridname'],_0x8874c0[_0xac35('0x3a')]);logger[_0xac35('0x3b')](_0xac35('0x3c'),_0x8874c0[_0xac35('0x39')],util[_0xac35('0x3d')](_0x8874c0,{'showHidden':![],'depth':null}));if(_0x8874c0[_0xac35('0x39')]===_0x8874c0[_0xac35('0x3e')]){if(!_['isUndefined'](this[_0xac35('0x1d')][_0x8874c0[_0xac35('0x39')]])){_[_0xac35('0x3f')](this['channels'][_0x8874c0[_0xac35('0x39')]],_[_0xac35('0x40')](_0x8874c0,_[_0xac35('0x41')](this['channels'][_0x8874c0[_0xac35('0x39')]])));}}}}catch(_0x405c99){logger[_0xac35('0x42')](_0xac35('0x43'),_0x8874c0[_0xac35('0x39')],util['inspect'](_0x405c99,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xac35('0x35')][_0xac35('0x23')]=function(_0x16bee1){try{if(this[_0xac35('0x44')](_0x16bee1)){logger[_0xac35('0x3b')](_0xac35('0x45'),_0x16bee1[_0xac35('0x39')],util[_0xac35('0x3d')](_0x16bee1,{'showHidden':![],'depth':null}));if(_0x16bee1[_0xac35('0x39')]===_0x16bee1[_0xac35('0x3e')]&&_0x16bee1[_0xac35('0x46')]!=_0xac35('0x47')){if(_[_0xac35('0x48')](this[_0xac35('0x1d')][_0x16bee1[_0xac35('0x39')]])){logger[_0xac35('0x31')](_0xac35('0x49'),_0x16bee1['uniqueid'],_0x16bee1[_0xac35('0x4a')],_0x16bee1[_0xac35('0x4b')]);this[_0xac35('0x1d')][_0x16bee1[_0xac35('0x39')]]=new Channel();this[_0xac35('0x1d')][_0x16bee1[_0xac35('0x39')]][_0xac35('0x4c')]=moment()[_0xac35('0x4d')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xac35('0x1d')][_0x16bee1[_0xac35('0x39')]][_0xac35('0x4e')]=dispositions[_[_0xac35('0x4f')](_0x16bee1[_0xac35('0x50')])];_[_0xac35('0x3f')](this['channels'][_0x16bee1[_0xac35('0x39')]],_['pick'](_0x16bee1,_[_0xac35('0x41')](this['channels'][_0x16bee1['uniqueid']])));if(_0x16bee1[_0xac35('0x4a')]==='from-sip'){if(this[_0xac35('0x1e')][_0x16bee1[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]]){this['agents'][_0x16bee1[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]][_0xac35('0x52')]=_0x16bee1[_0xac35('0x4b')];logger['debug']('[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:',_0x16bee1['uniqueid'],util['inspect']({'id':this[_0xac35('0x1e')][_0x16bee1['channel'][_0xac35('0x51')]('-')[0x0]]['id'],'destaccountcode':this[_0xac35('0x1e')][_0x16bee1['channel'][_0xac35('0x51')]('-')[0x0]][_0xac35('0x53')],'destconnectedlinenum':_0x16bee1[_0xac35('0x4b')]},{'showHidden':![],'depth':null}));this[_0xac35('0x36')](util[_0xac35('0x4d')](_0xac35('0x54'),this[_0xac35('0x1e')][_0x16bee1[_0xac35('0x46')]['split']('-')[0x0]][_0xac35('0x55')]),'user:agentconnect',{'id':this[_0xac35('0x1e')][_0x16bee1[_0xac35('0x46')]['split']('-')[0x0]]['id'],'destaccountcode':this[_0xac35('0x1e')][_0x16bee1[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]][_0xac35('0x53')],'destconnectedlinenum':_0x16bee1['exten']});}}}}}}catch(_0x1f77e3){logger[_0xac35('0x42')](_0xac35('0x56'),_0x16bee1[_0xac35('0x39')],util['inspect'](_0x1f77e3,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xac35('0x35')]['syncNewExten']=function(_0x1c7829){try{if(this[_0xac35('0x44')](_0x1c7829)){logger['debug'](_0xac35('0x57'),_0x1c7829[_0xac35('0x39')],util[_0xac35('0x3d')](_0x1c7829,{'showHidden':![],'depth':null}));if(_0x1c7829[_0xac35('0x39')]===_0x1c7829[_0xac35('0x3e')]&&_0x1c7829['exten']!='h'&&_0x1c7829[_0xac35('0x46')]!='OutgoingSpoolFailed'){_0x1c7829[_0xac35('0x58')]=_0x1c7829[_0xac35('0x58')][_0xac35('0x59')]();_0x1c7829[_0xac35('0x5a')]=(_0x1c7829[_0xac35('0x5b')]||_0x1c7829[_0xac35('0x5a')])[_0xac35('0x59')]();logger[_0xac35('0x31')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0x1c7829[_0xac35('0x39')],_0x1c7829[_0xac35('0x58')],_0x1c7829[_0xac35('0x5a')]);if(_[_0xac35('0x48')](this[_0xac35('0x1d')][_0x1c7829[_0xac35('0x39')]])){this['channels'][_0x1c7829[_0xac35('0x39')]]=new Channel();this[_0xac35('0x1d')][_0x1c7829[_0xac35('0x39')]][_0xac35('0x4c')]=_0x1c7829[_0xac35('0x5c')]?moment()[_0xac35('0x5d')](moment['duration'](_0x1c7829[_0xac35('0x5c')])[_0xac35('0x5e')](),'seconds')[_0xac35('0x4d')](_0xac35('0x5f')):moment()[_0xac35('0x4d')](_0xac35('0x5f'));this[_0xac35('0x1d')][_0x1c7829[_0xac35('0x39')]][_0xac35('0x4e')]=_0xac35('0x17');}_['merge'](this['channels'][_0x1c7829[_0xac35('0x39')]],_[_0xac35('0x40')](_0x1c7829,_[_0xac35('0x41')](this[_0xac35('0x1d')][_0x1c7829[_0xac35('0x39')]])));if(_[_0xac35('0x60')](applications,_0x1c7829[_0xac35('0x58')])){this['channels'][_0x1c7829['uniqueid']]['lastapplication']=_0x1c7829[_0xac35('0x58')];this[_0xac35('0x1d')][_0x1c7829['uniqueid']][_0xac35('0x61')]=_0x1c7829[_0xac35('0x5a')];if(_0x1c7829['application']===_0xac35('0x13')&&_[_0xac35('0x62')](_0x1c7829[_0xac35('0x5a')],_0xac35('0x63'))){var _0x36bcb8=_0x1c7829['applicationdata'][_0xac35('0x51')]('=');var _0x3a81e8=_0x36bcb8[0x0][_0xac35('0x64')](/cdr\((.*)\)/);if(_0x3a81e8){this[_0xac35('0x1d')][_0x1c7829['uniqueid']][_0x3a81e8[0x1]]=_0x36bcb8[0x1];}}else if(_0x1c7829[_0xac35('0x58')]===_0xac35('0x14')){this[_0xac35('0x1d')][_0x1c7829[_0xac35('0x39')]][_0xac35('0x14')]=_0x1c7829['applicationdata'][_0xac35('0x51')](',')[0x0];}}}}}catch(_0x5c5540){logger[_0xac35('0x42')](_0xac35('0x65'),_0x1c7829['uniqueid'],util[_0xac35('0x3d')](_0x5c5540,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xac35('0x35')]['syncNewState']=function(_0xe9ab88){try{if(this['isNotNull'](_0xe9ab88)){logger[_0xac35('0x31')](_0xac35('0x66'),_0xe9ab88[_0xac35('0x39')],_0xe9ab88[_0xac35('0x3e')],_0xe9ab88['calleridname'],_0xe9ab88[_0xac35('0x3a')]);logger[_0xac35('0x3b')](_0xac35('0x67'),_0xe9ab88[_0xac35('0x39')],util['inspect'](_0xe9ab88,{'showHidden':![],'depth':null}));if(_0xe9ab88[_0xac35('0x39')]!==_0xe9ab88[_0xac35('0x3e')]){if(this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x3e')]]){if(_0xe9ab88['channelstate']==='6'){if(!this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x68')]){var _0x4c1a5f=moment();this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x68')]=!![];this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x69')]=_0x4c1a5f[_0xac35('0x4d')](_0xac35('0x5f'));if(this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x4c')]){this['channels'][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x6a')]=_0x4c1a5f[_0xac35('0x6b')](this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x4c')],'seconds');}}this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x3e')]=_0xe9ab88[_0xac35('0x39')];if(_0xe9ab88[_0xac35('0x3a')]!==_0xac35('0x6c')){this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x6d')]=_0xe9ab88[_0xac35('0x3a')];}this['channels'][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x6e')]=_0xe9ab88[_0xac35('0x6f')];this[_0xac35('0x1d')][_0xe9ab88['linkedid']]['destinationchannel']=_0xe9ab88['channel'];this[_0xac35('0x1d')][_0xe9ab88['linkedid']]['disposition']=dispositions[_[_0xac35('0x4f')](_0xe9ab88['channelstate'])];if(this[_0xac35('0x1e')][_0xe9ab88['channel'][_0xac35('0x51')]('-')[0x0]]){this['channels'][_0xe9ab88[_0xac35('0x3e')]][_0xac35('0x70')]=this['agents'][_0xe9ab88[_0xac35('0x46')]['split']('-')[0x0]]['id'];this[_0xac35('0x1d')][_0xe9ab88['linkedid']]['membername']=this['agents'][_0xe9ab88['channel'][_0xac35('0x51')]('-')[0x0]][_0xac35('0x55')];}}}}else{if(this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x39')]]){if(_0xe9ab88[_0xac35('0x50')]==='6'){if(this[_0xac35('0x1e')][_0xe9ab88[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]]){this['channels'][_0xe9ab88[_0xac35('0x39')]][_0xac35('0x70')]=this['agents'][_0xe9ab88[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]]['id'];this[_0xac35('0x1d')][_0xe9ab88[_0xac35('0x39')]][_0xac35('0x71')]=this['agents'][_0xe9ab88[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]][_0xac35('0x55')];}}}}}}catch(_0x23a5df){logger[_0xac35('0x42')](_0xac35('0x72'),_0xe9ab88[_0xac35('0x39')],util[_0xac35('0x3d')](_0x23a5df,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncMixMonitorFilename']=function(_0xe37343,_0x43a92c){try{if(this[_0xac35('0x1d')][_0xe37343]){logger[_0xac35('0x31')](_0xac35('0x73'),_0xe37343,_0x43a92c);this[_0xac35('0x1d')][_0xe37343][_0xac35('0x74')]=!![];if(_[_0xac35('0x75')](_0x43a92c,_0xac35('0x76'))){_0x43a92c=_0x43a92c['replace'](_0xac35('0x76'),_0xac35('0x77'));}this[_0xac35('0x1d')][_0xe37343][_0xac35('0x78')]=_0x43a92c;var _0x5181bd=_[_0xac35('0x79')](this[_0xac35('0x1d')][_0xe37343][_0xac35('0x7a')],{'filename':_0x43a92c});if(_[_0xac35('0x7b')](_0x5181bd)){this[_0xac35('0x1d')][_0xe37343][_0xac35('0x7a')]['push']({'filename':_0x43a92c,'createdAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'mixmonitorid':'','status':'rec'});}}}catch(_0x48b0a9){logger['error'](_0xac35('0x7c'),_0xe37343,util[_0xac35('0x3d')](_0x48b0a9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xac35('0x35')][_0xac35('0x27')]=function(_0xc58928){try{if(this[_0xac35('0x44')](_0xc58928)){logger[_0xac35('0x3b')](_0xac35('0x7d'),_0xc58928['uniqueid'],util[_0xac35('0x3d')](_0xc58928,{'showHidden':![],'depth':null}));if(this['channels'][_0xc58928[_0xac35('0x39')]]&&_0xc58928['channel']!=_0xac35('0x47')){if(this['isNotNull'](_0xc58928['variable'])){if(this[_0xac35('0x44')](_0xc58928['variable'][_0xac35('0x7e')])){logger[_0xac35('0x31')](_0xac35('0x7f'),_0xc58928[_0xac35('0x39')],_0xc58928[_0xac35('0x80')]);this[_0xac35('0x81')](_0xc58928[_0xac35('0x39')],_0xc58928[_0xac35('0x80')]);}else if(this[_0xac35('0x44')](_0xc58928[_0xac35('0x82')][_0xac35('0x83')])){logger[_0xac35('0x31')]('[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s',_0xc58928[_0xac35('0x39')],_0xc58928['value']);this['channels'][_0xc58928[_0xac35('0x39')]][_0xac35('0x3a')]=_0xc58928[_0xac35('0x80')];}else if(this[_0xac35('0x44')](_0xc58928[_0xac35('0x82')][_0xac35('0x84')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmd-callerid\x20value:%s',_0xc58928[_0xac35('0x39')],_0xc58928[_0xac35('0x80')]);this[_0xac35('0x1d')][_0xc58928[_0xac35('0x39')]][_0xac35('0x85')]=_0xc58928[_0xac35('0x80')];}else if(this[_0xac35('0x44')](_0xc58928['variable'][_0xac35('0x86')])){logger[_0xac35('0x31')](_0xac35('0x87'),_0xc58928[_0xac35('0x39')],_0xc58928[_0xac35('0x80')]);this[_0xac35('0x1d')][_0xc58928[_0xac35('0x39')]][_0xac35('0x88')]=_0xc58928[_0xac35('0x80')];}else if(this['isNotNull'](_0xc58928[_0xac35('0x82')][_0xac35('0x89')])){logger['info'](_0xac35('0x8a'),_0xc58928[_0xac35('0x39')],_0xc58928[_0xac35('0x80')][_0xac35('0x51')](',')[0x0]);this[_0xac35('0x1d')][_0xc58928[_0xac35('0x39')]][_0xac35('0x14')]=_0xc58928['value'][_0xac35('0x51')](',')[0x0];}else if(this[_0xac35('0x44')](_0xc58928[_0xac35('0x82')][_0xac35('0x8b')])){logger[_0xac35('0x31')](_0xac35('0x8c'),_0xc58928['uniqueid'],_0xc58928[_0xac35('0x80')]);this[_0xac35('0x1d')][_0xc58928['uniqueid']]['originatecalleridnum']=_0xc58928['value'];}else if(this[_0xac35('0x44')](_0xc58928['variable']['xmd-destination'])){logger[_0xac35('0x31')](_0xac35('0x8d'),_0xc58928['uniqueid'],_0xc58928[_0xac35('0x80')]);this['channels'][_0xc58928[_0xac35('0x39')]][_0xac35('0x8e')]=_0xc58928[_0xac35('0x80')];}else if(this[_0xac35('0x44')](_0xc58928[_0xac35('0x82')][_0xac35('0x8f')])){logger[_0xac35('0x31')](_0xac35('0x90'),_0xc58928[_0xac35('0x39')],_0xc58928[_0xac35('0x80')]);this['channels'][_0xc58928[_0xac35('0x39')]][_0xac35('0x91')]=_0xc58928['value'];}else if(this[_0xac35('0x44')](_0xc58928[_0xac35('0x82')][_0xac35('0x92')])){logger['info']('[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s',_0xc58928[_0xac35('0x39')],_0xc58928[_0xac35('0x80')]);this[_0xac35('0x1d')][_0xc58928[_0xac35('0x39')]][_0xac35('0x14')]=_0xc58928[_0xac35('0x80')];}else if(this[_0xac35('0x44')](_0xc58928[_0xac35('0x82')]['sipcallid'])){logger[_0xac35('0x31')](_0xac35('0x93'),_0xc58928['uniqueid'],_0xc58928[_0xac35('0x80')]);this[_0xac35('0x1d')][_0xc58928['uniqueid']][_0xac35('0x94')]=_0xc58928[_0xac35('0x80')];}}}else if(this[_0xac35('0x44')](_0xc58928['variable'][_0xac35('0x7e')])){if(_0xc58928[_0xac35('0x80')]){var _0x485239=path[_0xac35('0x95')](_0xc58928['value'])[_0xac35('0x55')];logger[_0xac35('0x31')](_0xac35('0x7f'),_0x485239,_0xc58928[_0xac35('0x80')]);this[_0xac35('0x81')](_0x485239,_0xc58928['value']);}}else if(this['channels'][_0xc58928['linkedid']]){if(this['isNotNull'](_0xc58928[_0xac35('0x82')])){if(this[_0xac35('0x44')](_0xc58928[_0xac35('0x82')][_0xac35('0x96')])){logger[_0xac35('0x31')](_0xac35('0x93'),_0xc58928['linkedid'],_0xc58928['value']);this[_0xac35('0x1d')][_0xc58928[_0xac35('0x3e')]][_0xac35('0x97')]=_0xc58928['value'];}}}}}catch(_0x1110b9){logger['error'](_0xac35('0x98'),_0xc58928[_0xac35('0x39')],util[_0xac35('0x3d')](_0x1110b9,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xac35('0x35')][_0xac35('0x99')]=function(_0x1a3e35){try{if(this[_0xac35('0x44')](_0x1a3e35)){logger[_0xac35('0x3b')](_0xac35('0x9a'),_0x1a3e35[_0xac35('0x39')],util[_0xac35('0x3d')](_0x1a3e35,{'showHidden':![],'depth':null}));if(this[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]]){logger[_0xac35('0x31')](_0xac35('0x9b'),_0x1a3e35[_0xac35('0x39')],_0x1a3e35[_0xac35('0x9c')]);var _0x241872=moment();this[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x9d')]=_0x241872['format'](_0xac35('0x5f'));this[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x5c')]=_0x241872[_0xac35('0x6b')](this[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x4c')],_0xac35('0x5e'));if(this['channels'][_0x1a3e35[_0xac35('0x39')]]['answered']){this[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x9e')]=_0x241872['diff'](this[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x69')],_0xac35('0x5e'));this[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x6a')]=this[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x5c')]-this[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]]['billableseconds'];}if(_0x1a3e35[_0xac35('0x4a')]==='from-sip'){if(this[_0xac35('0x1e')][_0x1a3e35[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]]){this[_0xac35('0x1e')][_0x1a3e35['channel'][_0xac35('0x51')]('-')[0x0]]=_[_0xac35('0x9f')](this[_0xac35('0x1e')][_0x1a3e35[_0xac35('0x46')]['split']('-')[0x0]],[_0xac35('0x52')]);logger[_0xac35('0x3b')]('[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:',_0x1a3e35['uniqueid'],util[_0xac35('0x3d')]({'id':this['agents'][_0x1a3e35[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x1a3e35[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]][_0xac35('0x53')]},{'showHidden':![],'depth':null}));this[_0xac35('0x36')](util[_0xac35('0x4d')](_0xac35('0x54'),this[_0xac35('0x1e')][_0x1a3e35[_0xac35('0x46')]['split']('-')[0x0]][_0xac35('0x55')]),_0xac35('0xa0'),{'id':this[_0xac35('0x1e')][_0x1a3e35[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]]['id'],'destaccountcode':this[_0xac35('0x1e')][_0x1a3e35[_0xac35('0x46')][_0xac35('0x51')]('-')[0x0]]['accountcode']});}}var _0x2f0cbb=this;Promise[_0xac35('0xa1')]()[_0xac35('0xa2')](function(){var _0x106706=_0x2f0cbb['channels'][_0x1a3e35[_0xac35('0x39')]];if(typeof _0x106706[_0xac35('0xa3')]===_0xac35('0xa4'))return;if(_['isEmpty'](_0x106706[_0xac35('0x7a')]))return;return RpcSetting[_0xac35('0xa5')]()['then'](function(_0x115725){if(!_0x115725[_0xac35('0xa6')])return;return Promise[_0xac35('0xa1')]()[_0xac35('0xa2')](function(){return ami[_0xac35('0xa7')]({'action':_0xac35('0xa8'),'channel':_0x106706[_0xac35('0x46')]})[_0xac35('0xa9')](function(){});})[_0xac35('0xa2')](function(){return ami['Action']({'action':_0xac35('0xa8'),'channel':_0x106706[_0xac35('0xaa')]})[_0xac35('0xa9')](function(){})[_0xac35('0xab')](function(){var _0x2648d8=_0x2f0cbb[_0xac35('0x1e')][_0x106706[_0xac35('0xaa')]['split']('-')[0x0]];if(!_0x2648d8)return;io[_0xac35('0x36')]('webbar:stopmonitors',{'agentId':_0x2648d8['id'],'uniqueid':_0x106706['uniqueid']});});});});})[_0xac35('0xa2')](function(){if(_0x1a3e35['event']==='BlindTransfer'){_0x2f0cbb[_0xac35('0xac')][_0x1a3e35[_0xac35('0x39')]]=_0x2f0cbb[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]];}else{if(_0x2f0cbb[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]]['type']===_0xac35('0xad')&&_0x2f0cbb['blindTransfers'][_0x1a3e35['uniqueid']]){_0x2f0cbb[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x39')]=[_0x2f0cbb['channels'][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x3e')],_0x2f0cbb[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]][_0xac35('0x3e')]=_0x2f0cbb['channels'][_0x1a3e35[_0xac35('0x39')]]['uniqueid']][0x0];delete _0x2f0cbb['blindTransfers'][_0x1a3e35['uniqueid']];}}logger[_0xac35('0x3b')]('[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:',_0x1a3e35[_0xac35('0x39')],util[_0xac35('0x3d')](_0x2f0cbb['channels'][_0x1a3e35['uniqueid']],{'showHidden':![],'depth':null}));ami[_0xac35('0x36')](_0xac35('0xae'),_0x2f0cbb[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]]);delete _0x2f0cbb[_0xac35('0x1d')][_0x1a3e35[_0xac35('0x39')]];});}}}catch(_0x2fb68f){logger[_0xac35('0x42')](_0xac35('0xaf'),_0x1a3e35[_0xac35('0x39')],util[_0xac35('0x3d')](_0x2fb68f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0xac35('0x35')][_0xac35('0x2a')]=function(_0x176f5f){try{if(this[_0xac35('0x44')](_0x176f5f)){logger['info']('[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s',_0x176f5f[_0xac35('0x39')],_0x176f5f[_0xac35('0xb0')],_0x176f5f['transfertargetcalleridnum']);logger[_0xac35('0x3b')](_0xac35('0xb1'),_0x176f5f['uniqueid'],util[_0xac35('0x3d')](_0x176f5f,{'showHidden':![],'depth':null}));if(this[_0xac35('0x1d')][_0x176f5f['transfereeuniqueid']]){this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb2')]][_0xac35('0xb3')]=_0x176f5f[_0xac35('0xb0')];this[_0xac35('0x1d')][_0x176f5f['transfereeuniqueid']]['transferconnectedlinenum']=_0x176f5f[_0xac35('0xb4')];if(this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb5')]]){var _0x174b73=this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb5')]];this['channels'][_0x176f5f['secondtransfereruniqueid']]=this['channels'][_0x176f5f[_0xac35('0xb2')]];this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb2')]]=_0x174b73;}}else if(this[_0xac35('0x1d')][_0x176f5f['transfertargetuniqueid']]){this['channels'][_0x176f5f[_0xac35('0xb6')]][_0xac35('0xb3')]=_0x176f5f[_0xac35('0xb0')];this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb6')]][_0xac35('0xb7')]=_0x176f5f[_0xac35('0xb4')];if(this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb8')]]){var _0x174b73=this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb8')]];this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb8')]]=this['channels'][_0x176f5f[_0xac35('0xb6')]];this['channels'][_0x176f5f['transfertargetuniqueid']]=_0x174b73;}}if((this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb8')]]||this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb9')]])&&this['channels'][_0x176f5f['secondtransfereruniqueid']]){var _0x3e6c50=_[_0xac35('0xba')]([this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb8')]],this[_0xac35('0x1d')][_0x176f5f['origtransfererlinkedid']],this[_0xac35('0x1d')][_0x176f5f['secondtransfereruniqueid']]],function(_0x1ebc19){return _0x1ebc19&&_0x1ebc19[_0xac35('0x88')]===_0xac35('0xad')&&_0x1ebc19[_0xac35('0xbb')];});if(_0x3e6c50){if(this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb8')]])this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb8')]][_0xac35('0xa3')]=_0xac35('0xbc');if(this['channels'][_0x176f5f[_0xac35('0xb9')]])this[_0xac35('0x1d')][_0x176f5f['origtransfererlinkedid']][_0xac35('0xa3')]=_0xac35('0xbc');this[_0xac35('0x1d')][_0x176f5f[_0xac35('0xb5')]]['transferType']=_0xac35('0xbc');}}}}catch(_0x663bc0){logger['error'](_0xac35('0xbd'),_0x176f5f['uniqueid'],util[_0xac35('0x3d')](_0x663bc0,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype']['syncBlindTransfer']=function(_0x4a94fa){try{if(this[_0xac35('0x44')](_0x4a94fa)){logger[_0xac35('0x31')](_0xac35('0xbe'),_0x4a94fa[_0xac35('0x39')],_0x4a94fa[_0xac35('0xbf')],_0x4a94fa[_0xac35('0xc0')]);logger[_0xac35('0x3b')](_0xac35('0xc1'),_0x4a94fa['uniqueid'],util[_0xac35('0x3d')](_0x4a94fa,{'showHidden':![],'depth':null}));if(this[_0xac35('0x1d')][_0x4a94fa[_0xac35('0xb2')]]){this[_0xac35('0x1d')][_0x4a94fa[_0xac35('0xb2')]][_0xac35('0xb3')]=_0x4a94fa[_0xac35('0xbf')];this['channels'][_0x4a94fa[_0xac35('0xb2')]][_0xac35('0xb7')]=_0x4a94fa[_0xac35('0xc0')];this[_0xac35('0x1d')][_0x4a94fa['transfereeuniqueid']][_0xac35('0xa3')]=_0xac35('0xc2');this[_0xac35('0x99')]({'event':_0xac35('0xc3'),'uniqueid':_0x4a94fa[_0xac35('0xb2')],'context':_0x4a94fa[_0xac35('0x4a')],'channel':_0x4a94fa[_0xac35('0xc4')]});}else{this['channels'][_0x4a94fa[_0xac35('0xc5')]]['transferType']=_0xac35('0xc2');}}}catch(_0x5decfb){logger[_0xac35('0x42')](_0xac35('0xc6'),_0x4a94fa[_0xac35('0x39')],util['inspect'](_0x5decfb,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xac35('0x2e')]=function(_0x3e0da7){try{if(this[_0xac35('0x44')](_0x3e0da7)){logger[_0xac35('0x3b')](_0xac35('0xc7'),_0x3e0da7[_0xac35('0x39')],util[_0xac35('0x3d')](_0x3e0da7,{'showHidden':![],'depth':null}));if(this['channels'][_0x3e0da7[_0xac35('0x39')]]){if(!_[_0xac35('0x7b')](this[_0xac35('0x1d')][_0x3e0da7[_0xac35('0x39')]]['answertime'])){this[_0xac35('0x1d')][_0x3e0da7[_0xac35('0x39')]]['mohstarttime']=moment()['format'](_0xac35('0x5f'));logger[_0xac35('0x31')]('[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s',_0x3e0da7['uniqueid'],this['channels'][_0x3e0da7[_0xac35('0x39')]]['mohstarttime']);}}}}catch(_0x38d859){logger[_0xac35('0x42')](_0xac35('0xc8'),_0x3e0da7[_0xac35('0x39')],util[_0xac35('0x3d')](_0x38d859,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0xac35('0x30')]=function(_0x13856c){try{if(this[_0xac35('0x44')](_0x13856c)){logger[_0xac35('0x3b')](_0xac35('0xc9'),_0x13856c[_0xac35('0x39')],util[_0xac35('0x3d')](_0x13856c,{'showHidden':![],'depth':null}));if(this[_0xac35('0x1d')][_0x13856c[_0xac35('0x39')]]){if(!_['isNil'](this[_0xac35('0x1d')][_0x13856c[_0xac35('0x39')]][_0xac35('0xca')])){this[_0xac35('0x1d')][_0x13856c['uniqueid']][_0xac35('0xcb')]+=moment()[_0xac35('0xcc')](0x0)['diff'](this['channels'][_0x13856c['uniqueid']][_0xac35('0xca')],_0xac35('0x5e'));logger['info'](_0xac35('0xcd'),_0x13856c[_0xac35('0x39')],this[_0xac35('0x1d')][_0x13856c[_0xac35('0x39')]][_0xac35('0xcb')]);delete this[_0xac35('0x1d')][_0x13856c[_0xac35('0x39')]][_0xac35('0xca')];}}}}catch(_0x100c7c){logger[_0xac35('0x42')](_0xac35('0xce'),_0x13856c[_0xac35('0x39')],util[_0xac35('0x3d')](_0x100c7c,{'showHidden':![],'depth':null}));}};module[_0xac35('0xcf')]=VoiceCallReport; \ No newline at end of file +var _0x8b29=['busy','invalid','unavailable','ringing','ringinuse','onhold','agi','dial','playback','voicemail','NO\x20ANSWER','FAILED','ANSWERED','BUSY','redis','channels','coreshowchannel','syncNewExten','bind','newexten','syncNewChannel','newstate','syncNewState','varset','hangup','newcallerid','syncNewCallerId','syncAttendedTransfer','syncBlindTransfer','musiconholdstart','syncMusicOnHoldStop','[voiceCallReport][coreshowchannels]\x20started','actionCoreShowChannels','prototype','isNotNull','isUndefined','emit','[%s][voiceCallReport][newcallerid]\x20calleridname:%s\x20calleridnum:%s','uniqueid','calleridnum','debug','inspect','linkedid','merge','pick','keys','error','[%s][voiceCallReport][newcallerid]','[%s][voiceCallReport][newchannel]\x20event:','channel','OutgoingSpoolFailed','[%s][voiceCallReport][newchannel]\x20context:%s\x20exten:%s','context','exten','starttime','format','YYYY-MM-DD\x20HH:mm:ss','disposition','channelstate','agents','split','[%s][voiceCallReport][newchannel]\x20sending\x20user:agentconnect\x20event:','accountcode','user:%s','name','user:agentconnect','[%s][voiceCallReport][newexten]\x20event:','application','toLowerCase','applicationdata','appdata','info','duration','seconds','includes','lastapplication','set','cdr(','match','queue','[%s][voiceCallReport][newexten]','[%s][voiceCallReport][newstate]\x20linkedid:%s\x20calleridname:%s\x20calleridnum:%s','calleridname','answered','diff','xcally-motion-preview','connectedlinename','toNumber','UserId','membername','[%s][voiceCallReport][mixMonitorFilename]\x20monitorFilename:%s','endsWith','replace','.wav49','.WAV','find','monitors','isNil','push','[%s][voiceCallReport][mixMonitorFilename]','syncVarSet','[%s][voiceCallReport][varset]\x20event:','variable','[%s][voiceCallReport][varset]\x20variable:mixmonitor_filename\x20value:%s','value','syncMixMonitorFilename','xmd-phone','[%s][voiceCallReport][varset]\x20variable:xmd-phone\x20value:%s','xmd-callerid','[%s][voiceCallReport][varset]\x20variable:xmd-callerid\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','xmd-callerid-preview','[%s][voiceCallReport][varset]\x20variable:xmd-callerid-preview\x20value:%s','calleridpreview','xmcs-queue','[%s][voiceCallReport][varset]\x20variable:xmcs-queue\x20value:%s','[%s][voiceCallReport][varset]\x20variable:sipcallid\x20value:%s','sipcalluniqueid','mixmonitor_filename','parse','sipcallid','sipcalllinkedid','[%s][voiceCallReport][varset]','syncHangup','[%s][voiceCallReport][hangup]\x20event:','[%s][voiceCallReport][hangup]\x20reason:%s','cause-txt','endtime','billableseconds','answertime','from-sip','omit','[%s][voiceCallReport][hangup]\x20sending\x20user:agentcomplete\x20event:','resolve','transferType','undefined','isEmpty','getSettings','then','stopRecordingOnTransfer','Action','catch','StopMixMonitor','destinationchannel','finally','webbar:stopmonitors','blindTransfers','outbound','[%s][voiceCallReport][hangup]\x20sending\x20hangup\x20event:','custom:voiceCallReport','[%s][voiceCallReport][hangup]','[%s][voiceCallReport][attendedtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','[%s][voiceCallReport][attendedtransfer]\x20event:','transfereeuniqueid','transfercalleridnum','origtransferercalleridnum','transferconnectedlinenum','transfertargetcalleridnum','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','origtransfererlinkedid','some','routeid','ATTENDED','[%s][voiceCallReport][attendedtransfer]','[%s][voiceCallReport][blindtransfer]\x20transfercalleridnum:%s\x20transferconnectedlinenum:%s','transfereecalleridnum','extension','[%s][voiceCallReport][blindtransfer]\x20event:','BlindTransfer','transfereruniqueid','BLIND','[%s][voiceCallReport][blindtransfer]','syncMusicOnHoldStart','[%s][voiceCallReport][musiconholdstart]\x20event:','mohstarttime','[%s][voiceCallReport][musiconholdstart]\x20mohstarttime:%s','[%s][voiceCallReport][musiconholdstart]','mohtime','milliseconds','exports','bluebird','moment','util','../../../config/environment','../../../config/logger','../ami','../rpc/setting','unknown','not_inuse','inuse'];(function(_0xa328,_0x38cbee){var _0xaac218=function(_0xa0353e){while(--_0xa0353e){_0xa328['push'](_0xa328['shift']());}};_0xaac218(++_0x38cbee);}(_0x8b29,0xbe));var _0x98b2=function(_0x139c89,_0x1160fc){_0x139c89=_0x139c89-0x0;var _0x505f75=_0x8b29[_0x139c89];return _0x505f75;};'use strict';var BPromise=require(_0x98b2('0x0'));var _=require('lodash');var moment=require(_0x98b2('0x1'));var util=require(_0x98b2('0x2'));var path=require('path');var Redis=require('ioredis');var config=require(_0x98b2('0x3'));var logger=require(_0x98b2('0x4'))('ami');var ami=require(_0x98b2('0x5'));var Channel=require('../model/channel');var RpcSetting=require(_0x98b2('0x6'));var statusDesc=[_0x98b2('0x7'),_0x98b2('0x8'),_0x98b2('0x9'),_0x98b2('0xa'),_0x98b2('0xb'),_0x98b2('0xc'),_0x98b2('0xd'),_0x98b2('0xe'),_0x98b2('0xf')];var applications=['set','queue',_0x98b2('0x10'),_0x98b2('0x11'),_0x98b2('0x12'),_0x98b2('0x13')];var dispositions=[_0x98b2('0x14'),_0x98b2('0x15'),'FAILED',_0x98b2('0x14'),_0x98b2('0x14'),'NO\x20ANSWER',_0x98b2('0x16'),_0x98b2('0x17'),_0x98b2('0x15'),'FAILED','FAILED'];var actions={};config[_0x98b2('0x18')]=_['defaults'](config[_0x98b2('0x18')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function VoiceCallReport(_0x831ee8){this[_0x98b2('0x19')]=_0x831ee8[_0x98b2('0x19')];this['agents']=_0x831ee8['agents'];this['blindTransfers']={};ami['on'](_0x98b2('0x1a'),this[_0x98b2('0x1b')][_0x98b2('0x1c')](this));ami['on'](_0x98b2('0x1d'),this['syncNewExten'][_0x98b2('0x1c')](this));ami['on']('newchannel',this[_0x98b2('0x1e')]['bind'](this));ami['on'](_0x98b2('0x1f'),this[_0x98b2('0x20')][_0x98b2('0x1c')](this));ami['on'](_0x98b2('0x21'),this['syncVarSet'][_0x98b2('0x1c')](this));ami['on'](_0x98b2('0x22'),this['syncHangup']['bind'](this));ami['on'](_0x98b2('0x23'),this[_0x98b2('0x24')]['bind'](this));ami['on']('attendedtransfer',this[_0x98b2('0x25')][_0x98b2('0x1c')](this));ami['on']('blindtransfer',this[_0x98b2('0x26')][_0x98b2('0x1c')](this));ami['on'](_0x98b2('0x27'),this['syncMusicOnHoldStart'][_0x98b2('0x1c')](this));ami['on']('musiconholdstop',this[_0x98b2('0x28')]['bind'](this));try{logger['info'](_0x98b2('0x29'));ami[_0x98b2('0x2a')]();}catch(_0x5fcd00){logger['error']('[voiceCallReport][coreshowchannels]',util['inspect'](_0x5fcd00,{'showHidden':![],'depth':null}));}}VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0x2c')]=function(_0x50aafb){return _0x50aafb!==null&&!_[_0x98b2('0x2d')](_0x50aafb);};VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0x2e')]=function(_0x56efb6,_0x2e1ea4,_0x1dee11){io['to'](_0x56efb6)[_0x98b2('0x2e')](_0x2e1ea4,_0x1dee11);};VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0x24')]=function(_0x5dd95f){try{if(this[_0x98b2('0x2c')](_0x5dd95f)){logger['info'](_0x98b2('0x2f'),_0x5dd95f[_0x98b2('0x30')],_0x5dd95f['calleridname'],_0x5dd95f[_0x98b2('0x31')]);logger[_0x98b2('0x32')]('[%s][voiceCallReport][newcallerid]\x20event:',_0x5dd95f[_0x98b2('0x30')],util[_0x98b2('0x33')](_0x5dd95f,{'showHidden':![],'depth':null}));if(_0x5dd95f[_0x98b2('0x30')]===_0x5dd95f[_0x98b2('0x34')]){if(!_['isUndefined'](this['channels'][_0x5dd95f[_0x98b2('0x30')]])){_[_0x98b2('0x35')](this[_0x98b2('0x19')][_0x5dd95f[_0x98b2('0x30')]],_[_0x98b2('0x36')](_0x5dd95f,_[_0x98b2('0x37')](this['channels'][_0x5dd95f[_0x98b2('0x30')]])));}}}}catch(_0x2ecb46){logger[_0x98b2('0x38')](_0x98b2('0x39'),_0x5dd95f[_0x98b2('0x30')],util[_0x98b2('0x33')](_0x2ecb46,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0x1e')]=function(_0x273037){try{if(this[_0x98b2('0x2c')](_0x273037)){logger[_0x98b2('0x32')](_0x98b2('0x3a'),_0x273037[_0x98b2('0x30')],util['inspect'](_0x273037,{'showHidden':![],'depth':null}));if(_0x273037['uniqueid']===_0x273037[_0x98b2('0x34')]&&_0x273037[_0x98b2('0x3b')]!=_0x98b2('0x3c')){if(_[_0x98b2('0x2d')](this[_0x98b2('0x19')][_0x273037[_0x98b2('0x30')]])){logger['info'](_0x98b2('0x3d'),_0x273037[_0x98b2('0x30')],_0x273037[_0x98b2('0x3e')],_0x273037[_0x98b2('0x3f')]);this['channels'][_0x273037[_0x98b2('0x30')]]=new Channel();this[_0x98b2('0x19')][_0x273037[_0x98b2('0x30')]][_0x98b2('0x40')]=moment()[_0x98b2('0x41')](_0x98b2('0x42'));this[_0x98b2('0x19')][_0x273037['uniqueid']][_0x98b2('0x43')]=dispositions[_['toNumber'](_0x273037[_0x98b2('0x44')])];_[_0x98b2('0x35')](this[_0x98b2('0x19')][_0x273037[_0x98b2('0x30')]],_['pick'](_0x273037,_['keys'](this[_0x98b2('0x19')][_0x273037[_0x98b2('0x30')]])));if(_0x273037[_0x98b2('0x3e')]==='from-sip'){if(this[_0x98b2('0x45')][_0x273037[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]){this[_0x98b2('0x45')][_0x273037[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]['destconnectedlinenum']=_0x273037[_0x98b2('0x3f')];logger[_0x98b2('0x32')](_0x98b2('0x47'),_0x273037['uniqueid'],util[_0x98b2('0x33')]({'id':this[_0x98b2('0x45')][_0x273037[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]['id'],'destaccountcode':this[_0x98b2('0x45')][_0x273037[_0x98b2('0x3b')]['split']('-')[0x0]][_0x98b2('0x48')],'destconnectedlinenum':_0x273037['exten']},{'showHidden':![],'depth':null}));this[_0x98b2('0x2e')](util[_0x98b2('0x41')](_0x98b2('0x49'),this[_0x98b2('0x45')][_0x273037[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]][_0x98b2('0x4a')]),_0x98b2('0x4b'),{'id':this[_0x98b2('0x45')][_0x273037['channel'][_0x98b2('0x46')]('-')[0x0]]['id'],'destaccountcode':this['agents'][_0x273037[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]][_0x98b2('0x48')],'destconnectedlinenum':_0x273037[_0x98b2('0x3f')]});}}}}}}catch(_0x28234f){logger[_0x98b2('0x38')]('[%s][voiceCallReport][newchannel]',_0x273037[_0x98b2('0x30')],util[_0x98b2('0x33')](_0x28234f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0x1b')]=function(_0xc8b7d7){try{if(this['isNotNull'](_0xc8b7d7)){logger['debug'](_0x98b2('0x4c'),_0xc8b7d7[_0x98b2('0x30')],util[_0x98b2('0x33')](_0xc8b7d7,{'showHidden':![],'depth':null}));if(_0xc8b7d7[_0x98b2('0x30')]===_0xc8b7d7['linkedid']&&_0xc8b7d7['exten']!='h'&&_0xc8b7d7['channel']!=_0x98b2('0x3c')){_0xc8b7d7[_0x98b2('0x4d')]=_0xc8b7d7[_0x98b2('0x4d')][_0x98b2('0x4e')]();_0xc8b7d7[_0x98b2('0x4f')]=(_0xc8b7d7[_0x98b2('0x50')]||_0xc8b7d7[_0x98b2('0x4f')])[_0x98b2('0x4e')]();logger[_0x98b2('0x51')]('[%s][voiceCallReport][newexten]\x20application:%s\x20appdata:%s',_0xc8b7d7[_0x98b2('0x30')],_0xc8b7d7['application'],_0xc8b7d7[_0x98b2('0x4f')]);if(_[_0x98b2('0x2d')](this[_0x98b2('0x19')][_0xc8b7d7[_0x98b2('0x30')]])){this['channels'][_0xc8b7d7[_0x98b2('0x30')]]=new Channel();this[_0x98b2('0x19')][_0xc8b7d7[_0x98b2('0x30')]][_0x98b2('0x40')]=_0xc8b7d7[_0x98b2('0x52')]?moment()['subtract'](moment[_0x98b2('0x52')](_0xc8b7d7[_0x98b2('0x52')])[_0x98b2('0x53')](),_0x98b2('0x53'))[_0x98b2('0x41')](_0x98b2('0x42')):moment()[_0x98b2('0x41')](_0x98b2('0x42'));this[_0x98b2('0x19')][_0xc8b7d7[_0x98b2('0x30')]][_0x98b2('0x43')]=_0x98b2('0x14');}_['merge'](this[_0x98b2('0x19')][_0xc8b7d7[_0x98b2('0x30')]],_['pick'](_0xc8b7d7,_['keys'](this[_0x98b2('0x19')][_0xc8b7d7['uniqueid']])));if(_[_0x98b2('0x54')](applications,_0xc8b7d7[_0x98b2('0x4d')])){this[_0x98b2('0x19')][_0xc8b7d7[_0x98b2('0x30')]][_0x98b2('0x55')]=_0xc8b7d7[_0x98b2('0x4d')];this['channels'][_0xc8b7d7[_0x98b2('0x30')]]['lastdata']=_0xc8b7d7['applicationdata'];if(_0xc8b7d7[_0x98b2('0x4d')]===_0x98b2('0x56')&&_['startsWith'](_0xc8b7d7[_0x98b2('0x4f')],_0x98b2('0x57'))){var _0x47f99a=_0xc8b7d7[_0x98b2('0x4f')][_0x98b2('0x46')]('=');var _0x14327e=_0x47f99a[0x0][_0x98b2('0x58')](/cdr\((.*)\)/);if(_0x14327e){this['channels'][_0xc8b7d7['uniqueid']][_0x14327e[0x1]]=_0x47f99a[0x1];}}else if(_0xc8b7d7[_0x98b2('0x4d')]===_0x98b2('0x59')){this[_0x98b2('0x19')][_0xc8b7d7[_0x98b2('0x30')]][_0x98b2('0x59')]=_0xc8b7d7['applicationdata']['split'](',')[0x0];}}}}}catch(_0x2e9490){logger['error'](_0x98b2('0x5a'),_0xc8b7d7[_0x98b2('0x30')],util[_0x98b2('0x33')](_0x2e9490,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0x20')]=function(_0x2e7bab){try{if(this['isNotNull'](_0x2e7bab)){logger[_0x98b2('0x51')](_0x98b2('0x5b'),_0x2e7bab[_0x98b2('0x30')],_0x2e7bab[_0x98b2('0x34')],_0x2e7bab[_0x98b2('0x5c')],_0x2e7bab[_0x98b2('0x31')]);logger['debug']('[%s][voiceCallReport][newstate]\x20event:',_0x2e7bab[_0x98b2('0x30')],util[_0x98b2('0x33')](_0x2e7bab,{'showHidden':![],'depth':null}));if(_0x2e7bab[_0x98b2('0x30')]!==_0x2e7bab[_0x98b2('0x34')]){if(this[_0x98b2('0x19')][_0x2e7bab[_0x98b2('0x34')]]){if(_0x2e7bab[_0x98b2('0x44')]==='6'){if(!this[_0x98b2('0x19')][_0x2e7bab['linkedid']][_0x98b2('0x5d')]){var _0x29942c=moment();this[_0x98b2('0x19')][_0x2e7bab['linkedid']][_0x98b2('0x5d')]=!![];this[_0x98b2('0x19')][_0x2e7bab[_0x98b2('0x34')]]['answertime']=_0x29942c[_0x98b2('0x41')](_0x98b2('0x42'));if(this['channels'][_0x2e7bab[_0x98b2('0x34')]]['starttime']){this['channels'][_0x2e7bab['linkedid']]['holdtime']=_0x29942c[_0x98b2('0x5e')](this[_0x98b2('0x19')][_0x2e7bab[_0x98b2('0x34')]]['starttime'],_0x98b2('0x53'));}}this[_0x98b2('0x19')][_0x2e7bab[_0x98b2('0x34')]][_0x98b2('0x34')]=_0x2e7bab[_0x98b2('0x30')];if(_0x2e7bab[_0x98b2('0x31')]!==_0x98b2('0x5f')){this['channels'][_0x2e7bab[_0x98b2('0x34')]]['connectedlinenum']=_0x2e7bab[_0x98b2('0x31')];}this[_0x98b2('0x19')][_0x2e7bab[_0x98b2('0x34')]][_0x98b2('0x60')]=_0x2e7bab[_0x98b2('0x5c')];this[_0x98b2('0x19')][_0x2e7bab[_0x98b2('0x34')]]['destinationchannel']=_0x2e7bab['channel'];this[_0x98b2('0x19')][_0x2e7bab[_0x98b2('0x34')]][_0x98b2('0x43')]=dispositions[_[_0x98b2('0x61')](_0x2e7bab['channelstate'])];if(this[_0x98b2('0x45')][_0x2e7bab['channel'][_0x98b2('0x46')]('-')[0x0]]){this[_0x98b2('0x19')][_0x2e7bab['linkedid']][_0x98b2('0x62')]=this[_0x98b2('0x45')][_0x2e7bab[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]['id'];this[_0x98b2('0x19')][_0x2e7bab[_0x98b2('0x34')]][_0x98b2('0x63')]=this[_0x98b2('0x45')][_0x2e7bab[_0x98b2('0x3b')]['split']('-')[0x0]][_0x98b2('0x4a')];}}}}else{if(this[_0x98b2('0x19')][_0x2e7bab[_0x98b2('0x30')]]){if(_0x2e7bab[_0x98b2('0x44')]==='6'){if(this[_0x98b2('0x45')][_0x2e7bab[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]){this['channels'][_0x2e7bab[_0x98b2('0x30')]][_0x98b2('0x62')]=this[_0x98b2('0x45')][_0x2e7bab[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]['id'];this['channels'][_0x2e7bab[_0x98b2('0x30')]]['membername']=this[_0x98b2('0x45')][_0x2e7bab[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]['name'];}}}}}}catch(_0x2ee2d0){logger[_0x98b2('0x38')]('[%s][voiceCallReport][newstate]',_0x2e7bab[_0x98b2('0x30')],util['inspect'](_0x2ee2d0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x98b2('0x2b')]['syncMixMonitorFilename']=function(_0x87bd65,_0x386c27){try{if(this[_0x98b2('0x19')][_0x87bd65]){logger[_0x98b2('0x51')](_0x98b2('0x64'),_0x87bd65,_0x386c27);this[_0x98b2('0x19')][_0x87bd65]['monitor']=!![];if(_[_0x98b2('0x65')](_0x386c27,'.wav49')){_0x386c27=_0x386c27[_0x98b2('0x66')](_0x98b2('0x67'),_0x98b2('0x68'));}this[_0x98b2('0x19')][_0x87bd65]['monitorFilename']=_0x386c27;var _0x27307b=_[_0x98b2('0x69')](this[_0x98b2('0x19')][_0x87bd65][_0x98b2('0x6a')],{'filename':_0x386c27});if(_[_0x98b2('0x6b')](_0x27307b)){this[_0x98b2('0x19')][_0x87bd65][_0x98b2('0x6a')][_0x98b2('0x6c')]({'filename':_0x386c27,'createdAt':moment()['format'](_0x98b2('0x42')),'mixmonitorid':'','status':'rec'});}}}catch(_0x228797){logger[_0x98b2('0x38')](_0x98b2('0x6d'),_0x87bd65,util['inspect'](_0x228797,{'showHidden':![],'depth':null}));}};VoiceCallReport['prototype'][_0x98b2('0x6e')]=function(_0xba28ec){try{if(this['isNotNull'](_0xba28ec)){logger['debug'](_0x98b2('0x6f'),_0xba28ec[_0x98b2('0x30')],util[_0x98b2('0x33')](_0xba28ec,{'showHidden':![],'depth':null}));if(this[_0x98b2('0x19')][_0xba28ec[_0x98b2('0x30')]]&&_0xba28ec[_0x98b2('0x3b')]!='OutgoingSpoolFailed'){if(this[_0x98b2('0x2c')](_0xba28ec[_0x98b2('0x70')])){if(this[_0x98b2('0x2c')](_0xba28ec[_0x98b2('0x70')]['mixmonitor_filename'])){logger['info'](_0x98b2('0x71'),_0xba28ec[_0x98b2('0x30')],_0xba28ec[_0x98b2('0x72')]);this[_0x98b2('0x73')](_0xba28ec[_0x98b2('0x30')],_0xba28ec[_0x98b2('0x72')]);}else if(this[_0x98b2('0x2c')](_0xba28ec[_0x98b2('0x70')][_0x98b2('0x74')])){logger[_0x98b2('0x51')](_0x98b2('0x75'),_0xba28ec[_0x98b2('0x30')],_0xba28ec[_0x98b2('0x72')]);this[_0x98b2('0x19')][_0xba28ec[_0x98b2('0x30')]][_0x98b2('0x31')]=_0xba28ec[_0x98b2('0x72')];}else if(this[_0x98b2('0x2c')](_0xba28ec['variable'][_0x98b2('0x76')])){logger[_0x98b2('0x51')](_0x98b2('0x77'),_0xba28ec['uniqueid'],_0xba28ec['value']);this['channels'][_0xba28ec[_0x98b2('0x30')]][_0x98b2('0x78')]=_0xba28ec[_0x98b2('0x72')];}else if(this[_0x98b2('0x2c')](_0xba28ec[_0x98b2('0x70')][_0x98b2('0x79')])){logger['info'](_0x98b2('0x7a'),_0xba28ec['uniqueid'],_0xba28ec[_0x98b2('0x72')]);this[_0x98b2('0x19')][_0xba28ec['uniqueid']][_0x98b2('0x7b')]=_0xba28ec[_0x98b2('0x72')];}else if(this['isNotNull'](_0xba28ec[_0x98b2('0x70')]['xmd-queue'])){logger[_0x98b2('0x51')](_0x98b2('0x7c'),_0xba28ec[_0x98b2('0x30')],_0xba28ec['value'][_0x98b2('0x46')](',')[0x0]);this[_0x98b2('0x19')][_0xba28ec[_0x98b2('0x30')]]['queue']=_0xba28ec[_0x98b2('0x72')][_0x98b2('0x46')](',')[0x0];}else if(this[_0x98b2('0x2c')](_0xba28ec[_0x98b2('0x70')][_0x98b2('0x7d')])){logger[_0x98b2('0x51')](_0x98b2('0x7e'),_0xba28ec['uniqueid'],_0xba28ec[_0x98b2('0x72')]);this[_0x98b2('0x19')][_0xba28ec[_0x98b2('0x30')]]['originatecalleridnum']=_0xba28ec[_0x98b2('0x72')];}else if(this[_0x98b2('0x2c')](_0xba28ec['variable'][_0x98b2('0x7f')])){logger[_0x98b2('0x51')](_0x98b2('0x80'),_0xba28ec[_0x98b2('0x30')],_0xba28ec[_0x98b2('0x72')]);this['channels'][_0xba28ec[_0x98b2('0x30')]]['destination']=_0xba28ec[_0x98b2('0x72')];}else if(this[_0x98b2('0x2c')](_0xba28ec[_0x98b2('0x70')][_0x98b2('0x81')])){logger[_0x98b2('0x51')](_0x98b2('0x82'),_0xba28ec[_0x98b2('0x30')],_0xba28ec[_0x98b2('0x72')]);this[_0x98b2('0x19')][_0xba28ec[_0x98b2('0x30')]][_0x98b2('0x83')]=_0xba28ec[_0x98b2('0x72')];}else if(this[_0x98b2('0x2c')](_0xba28ec[_0x98b2('0x70')][_0x98b2('0x84')])){logger[_0x98b2('0x51')](_0x98b2('0x85'),_0xba28ec[_0x98b2('0x30')],_0xba28ec[_0x98b2('0x72')]);this[_0x98b2('0x19')][_0xba28ec['uniqueid']]['queue']=_0xba28ec['value'];}else if(this[_0x98b2('0x2c')](_0xba28ec[_0x98b2('0x70')]['sipcallid'])){logger['info'](_0x98b2('0x86'),_0xba28ec['uniqueid'],_0xba28ec[_0x98b2('0x72')]);this[_0x98b2('0x19')][_0xba28ec[_0x98b2('0x30')]][_0x98b2('0x87')]=_0xba28ec['value'];}}}else if(this[_0x98b2('0x2c')](_0xba28ec['variable'][_0x98b2('0x88')])){if(_0xba28ec['value']){var _0x398a16=path[_0x98b2('0x89')](_0xba28ec[_0x98b2('0x72')])[_0x98b2('0x4a')];logger[_0x98b2('0x51')](_0x98b2('0x71'),_0x398a16,_0xba28ec[_0x98b2('0x72')]);this[_0x98b2('0x73')](_0x398a16,_0xba28ec[_0x98b2('0x72')]);}}else if(this[_0x98b2('0x19')][_0xba28ec[_0x98b2('0x34')]]){if(this[_0x98b2('0x2c')](_0xba28ec[_0x98b2('0x70')])){if(this['isNotNull'](_0xba28ec[_0x98b2('0x70')][_0x98b2('0x8a')])){logger[_0x98b2('0x51')](_0x98b2('0x86'),_0xba28ec[_0x98b2('0x34')],_0xba28ec[_0x98b2('0x72')]);this[_0x98b2('0x19')][_0xba28ec[_0x98b2('0x34')]][_0x98b2('0x8b')]=_0xba28ec[_0x98b2('0x72')];}}}}}catch(_0x4488b1){logger[_0x98b2('0x38')](_0x98b2('0x8c'),_0xba28ec[_0x98b2('0x30')],util['inspect'](_0x4488b1,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0x8d')]=function(_0x591345){try{if(this[_0x98b2('0x2c')](_0x591345)){logger['debug'](_0x98b2('0x8e'),_0x591345[_0x98b2('0x30')],util[_0x98b2('0x33')](_0x591345,{'showHidden':![],'depth':null}));if(this['channels'][_0x591345[_0x98b2('0x30')]]){logger[_0x98b2('0x51')](_0x98b2('0x8f'),_0x591345[_0x98b2('0x30')],_0x591345[_0x98b2('0x90')]);var _0x35920f=moment();this[_0x98b2('0x19')][_0x591345[_0x98b2('0x30')]][_0x98b2('0x91')]=_0x35920f[_0x98b2('0x41')](_0x98b2('0x42'));this[_0x98b2('0x19')][_0x591345[_0x98b2('0x30')]][_0x98b2('0x52')]=_0x35920f['diff'](this['channels'][_0x591345[_0x98b2('0x30')]][_0x98b2('0x40')],_0x98b2('0x53'));if(this[_0x98b2('0x19')][_0x591345[_0x98b2('0x30')]][_0x98b2('0x5d')]){this['channels'][_0x591345[_0x98b2('0x30')]][_0x98b2('0x92')]=_0x35920f[_0x98b2('0x5e')](this[_0x98b2('0x19')][_0x591345[_0x98b2('0x30')]][_0x98b2('0x93')],_0x98b2('0x53'));this[_0x98b2('0x19')][_0x591345['uniqueid']]['holdtime']=this[_0x98b2('0x19')][_0x591345['uniqueid']][_0x98b2('0x52')]-this['channels'][_0x591345[_0x98b2('0x30')]][_0x98b2('0x92')];}if(_0x591345[_0x98b2('0x3e')]===_0x98b2('0x94')){if(this[_0x98b2('0x45')][_0x591345[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]){this[_0x98b2('0x45')][_0x591345[_0x98b2('0x3b')]['split']('-')[0x0]]=_[_0x98b2('0x95')](this[_0x98b2('0x45')][_0x591345[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]],['destconnectedlinenum']);logger[_0x98b2('0x32')](_0x98b2('0x96'),_0x591345['uniqueid'],util['inspect']({'id':this[_0x98b2('0x45')][_0x591345[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]['id'],'destaccountcode':this[_0x98b2('0x45')][_0x591345[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]['accountcode']},{'showHidden':![],'depth':null}));this[_0x98b2('0x2e')](util['format'](_0x98b2('0x49'),this['agents'][_0x591345['channel']['split']('-')[0x0]][_0x98b2('0x4a')]),'user:agentcomplete',{'id':this[_0x98b2('0x45')][_0x591345[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]]['id'],'destaccountcode':this[_0x98b2('0x45')][_0x591345[_0x98b2('0x3b')][_0x98b2('0x46')]('-')[0x0]][_0x98b2('0x48')]});}}var _0x240fdd=this;Promise[_0x98b2('0x97')]()['then'](function(){var _0x50c8e2=_0x240fdd['channels'][_0x591345['uniqueid']];if(typeof _0x50c8e2[_0x98b2('0x98')]===_0x98b2('0x99'))return;if(_[_0x98b2('0x9a')](_0x50c8e2[_0x98b2('0x6a')]))return;return RpcSetting[_0x98b2('0x9b')]()[_0x98b2('0x9c')](function(_0x1f639b){if(!_0x1f639b[_0x98b2('0x9d')])return;return Promise['resolve']()[_0x98b2('0x9c')](function(){return ami[_0x98b2('0x9e')]({'action':'StopMixMonitor','channel':_0x50c8e2[_0x98b2('0x3b')]})[_0x98b2('0x9f')](function(){});})['then'](function(){return ami[_0x98b2('0x9e')]({'action':_0x98b2('0xa0'),'channel':_0x50c8e2[_0x98b2('0xa1')]})[_0x98b2('0x9f')](function(){})[_0x98b2('0xa2')](function(){var _0x194884=_0x240fdd[_0x98b2('0x45')][_0x50c8e2[_0x98b2('0xa1')][_0x98b2('0x46')]('-')[0x0]];if(!_0x194884)return;io[_0x98b2('0x2e')](_0x98b2('0xa3'),{'agentId':_0x194884['id'],'uniqueid':_0x50c8e2[_0x98b2('0x30')]});});});});})[_0x98b2('0x9c')](function(){if(_0x591345['event']==='BlindTransfer'){_0x240fdd[_0x98b2('0xa4')][_0x591345['uniqueid']]=_0x240fdd[_0x98b2('0x19')][_0x591345[_0x98b2('0x30')]];}else{if(_0x240fdd[_0x98b2('0x19')][_0x591345[_0x98b2('0x30')]][_0x98b2('0x7b')]===_0x98b2('0xa5')&&_0x240fdd[_0x98b2('0xa4')][_0x591345[_0x98b2('0x30')]]){_0x240fdd[_0x98b2('0x19')][_0x591345[_0x98b2('0x30')]][_0x98b2('0x30')]=[_0x240fdd[_0x98b2('0x19')][_0x591345[_0x98b2('0x30')]][_0x98b2('0x34')],_0x240fdd[_0x98b2('0x19')][_0x591345['uniqueid']][_0x98b2('0x34')]=_0x240fdd['channels'][_0x591345[_0x98b2('0x30')]]['uniqueid']][0x0];delete _0x240fdd['blindTransfers'][_0x591345[_0x98b2('0x30')]];}}logger[_0x98b2('0x32')](_0x98b2('0xa6'),_0x591345[_0x98b2('0x30')],util[_0x98b2('0x33')](_0x240fdd['channels'][_0x591345[_0x98b2('0x30')]],{'showHidden':![],'depth':null}));ami[_0x98b2('0x2e')](_0x98b2('0xa7'),_0x240fdd[_0x98b2('0x19')][_0x591345['uniqueid']]);delete _0x240fdd[_0x98b2('0x19')][_0x591345['uniqueid']];});}}}catch(_0x35d71f){logger['error'](_0x98b2('0xa8'),_0x591345[_0x98b2('0x30')],util['inspect'](_0x35d71f,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x98b2('0x2b')]['syncAttendedTransfer']=function(_0x2c948a){try{if(this[_0x98b2('0x2c')](_0x2c948a)){logger[_0x98b2('0x51')](_0x98b2('0xa9'),_0x2c948a[_0x98b2('0x30')],_0x2c948a['origtransferercalleridnum'],_0x2c948a['transfertargetcalleridnum']);logger[_0x98b2('0x32')](_0x98b2('0xaa'),_0x2c948a[_0x98b2('0x30')],util['inspect'](_0x2c948a,{'showHidden':![],'depth':null}));if(this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xab')]]){this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xab')]][_0x98b2('0xac')]=_0x2c948a[_0x98b2('0xad')];this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xab')]][_0x98b2('0xae')]=_0x2c948a[_0x98b2('0xaf')];if(this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb0')]]){var _0x334632=this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb0')]];this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb0')]]=this[_0x98b2('0x19')][_0x2c948a['transfereeuniqueid']];this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xab')]]=_0x334632;}}else if(this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb1')]]){this[_0x98b2('0x19')][_0x2c948a['transfertargetuniqueid']][_0x98b2('0xac')]=_0x2c948a['origtransferercalleridnum'];this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb1')]]['transferconnectedlinenum']=_0x2c948a['transfertargetcalleridnum'];if(this[_0x98b2('0x19')][_0x2c948a['origtransfereruniqueid']]){var _0x334632=this['channels'][_0x2c948a[_0x98b2('0xb2')]];this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb2')]]=this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb1')]];this[_0x98b2('0x19')][_0x2c948a['transfertargetuniqueid']]=_0x334632;}}if((this[_0x98b2('0x19')][_0x2c948a['origtransfereruniqueid']]||this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb3')]])&&this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb0')]]){var _0x47ec66=_[_0x98b2('0xb4')]([this[_0x98b2('0x19')][_0x2c948a['origtransfereruniqueid']],this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb3')]],this['channels'][_0x2c948a['secondtransfereruniqueid']]],function(_0x1285af){return _0x1285af&&_0x1285af[_0x98b2('0x7b')]===_0x98b2('0xa5')&&_0x1285af[_0x98b2('0xb5')];});if(_0x47ec66){if(this['channels'][_0x2c948a[_0x98b2('0xb2')]])this[_0x98b2('0x19')][_0x2c948a['origtransfereruniqueid']][_0x98b2('0x98')]=_0x98b2('0xb6');if(this[_0x98b2('0x19')][_0x2c948a['origtransfererlinkedid']])this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb3')]]['transferType']='ATTENDED';this[_0x98b2('0x19')][_0x2c948a[_0x98b2('0xb0')]][_0x98b2('0x98')]=_0x98b2('0xb6');}}}}catch(_0x5a0d08){logger['error'](_0x98b2('0xb7'),_0x2c948a[_0x98b2('0x30')],util['inspect'](_0x5a0d08,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0x26')]=function(_0x3491ca){try{if(this['isNotNull'](_0x3491ca)){logger[_0x98b2('0x51')](_0x98b2('0xb8'),_0x3491ca[_0x98b2('0x30')],_0x3491ca[_0x98b2('0xb9')],_0x3491ca[_0x98b2('0xba')]);logger[_0x98b2('0x32')](_0x98b2('0xbb'),_0x3491ca['uniqueid'],util['inspect'](_0x3491ca,{'showHidden':![],'depth':null}));if(this[_0x98b2('0x19')][_0x3491ca[_0x98b2('0xab')]]){this[_0x98b2('0x19')][_0x3491ca[_0x98b2('0xab')]]['transfercalleridnum']=_0x3491ca['transfereecalleridnum'];this[_0x98b2('0x19')][_0x3491ca[_0x98b2('0xab')]][_0x98b2('0xae')]=_0x3491ca[_0x98b2('0xba')];this[_0x98b2('0x19')][_0x3491ca[_0x98b2('0xab')]][_0x98b2('0x98')]='BLIND';this['syncHangup']({'event':_0x98b2('0xbc'),'uniqueid':_0x3491ca[_0x98b2('0xab')],'context':_0x3491ca[_0x98b2('0x3e')],'channel':_0x3491ca['transfererchannel']});}else{this['channels'][_0x3491ca[_0x98b2('0xbd')]]['transferType']=_0x98b2('0xbe');}}}catch(_0x27efd0){logger[_0x98b2('0x38')](_0x98b2('0xbf'),_0x3491ca['uniqueid'],util[_0x98b2('0x33')](_0x27efd0,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0xc0')]=function(_0xd3a24c){try{if(this[_0x98b2('0x2c')](_0xd3a24c)){logger[_0x98b2('0x32')](_0x98b2('0xc1'),_0xd3a24c[_0x98b2('0x30')],util[_0x98b2('0x33')](_0xd3a24c,{'showHidden':![],'depth':null}));if(this[_0x98b2('0x19')][_0xd3a24c[_0x98b2('0x30')]]){if(!_['isNil'](this[_0x98b2('0x19')][_0xd3a24c[_0x98b2('0x30')]]['answertime'])){this[_0x98b2('0x19')][_0xd3a24c['uniqueid']][_0x98b2('0xc2')]=moment()[_0x98b2('0x41')](_0x98b2('0x42'));logger['info'](_0x98b2('0xc3'),_0xd3a24c['uniqueid'],this[_0x98b2('0x19')][_0xd3a24c[_0x98b2('0x30')]][_0x98b2('0xc2')]);}}}}catch(_0x37865b){logger[_0x98b2('0x38')](_0x98b2('0xc4'),_0xd3a24c['uniqueid'],util[_0x98b2('0x33')](_0x37865b,{'showHidden':![],'depth':null}));}};VoiceCallReport[_0x98b2('0x2b')][_0x98b2('0x28')]=function(_0x5601a3){try{if(this['isNotNull'](_0x5601a3)){logger['debug']('[%s][voiceCallReport][musiconholdstop]\x20event:',_0x5601a3['uniqueid'],util[_0x98b2('0x33')](_0x5601a3,{'showHidden':![],'depth':null}));if(this[_0x98b2('0x19')][_0x5601a3['uniqueid']]){if(!_['isNil'](this[_0x98b2('0x19')][_0x5601a3[_0x98b2('0x30')]][_0x98b2('0xc2')])){this[_0x98b2('0x19')][_0x5601a3['uniqueid']][_0x98b2('0xc5')]+=moment()[_0x98b2('0xc6')](0x0)['diff'](this['channels'][_0x5601a3['uniqueid']]['mohstarttime'],_0x98b2('0x53'));logger[_0x98b2('0x51')]('[%s][voiceCallReport][musiconholdstop]\x20mohtime:%s',_0x5601a3[_0x98b2('0x30')],this[_0x98b2('0x19')][_0x5601a3[_0x98b2('0x30')]][_0x98b2('0xc5')]);delete this['channels'][_0x5601a3['uniqueid']][_0x98b2('0xc2')];}}}}catch(_0x2bcddb){logger['error']('[%s][voiceCallReport][musiconholdstop]',_0x5601a3[_0x98b2('0x30')],util[_0x98b2('0x33')](_0x2bcddb,{'showHidden':![],'depth':null}));}};module[_0x98b2('0xc7')]=VoiceCallReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceDialReport.js b/server/services/ami/report/voiceDialReport.js index 588fa12..2009103 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 _0xf758=['called','channel','substring','lastIndexOf','omit','event','privilege','info','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','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','error','[%s][voiceDialReport][dialbegin]','dialstatus','ANSWER','connectedlinenum','answertime','format','lastevent','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','custom:dialconnect','syncVarSet','[%s][voiceDialReport][varset]\x20event:','addVariable','variable','value','outboundrouteid','isUndefined','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','keys','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','rtpaudioqos','rtpaudioqosjitter','rtpaudioqosloss','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberlastcall','memberpenalty','memberrealtime','isNil','includes','syncHangup','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','diff','starttime','seconds','complete','answered','holdtime','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%s][voiceDialReport][hangup]\x20sending\x20dialend\x20event:','custom:dialend','[%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','dialend','syncDialEnd','bind','varset','hangup','isNotNull','emit','prototype','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','merge','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x1b825c,_0x2b3565){var _0x28e5b1=function(_0x45763d){while(--_0x45763d){_0x1b825c['push'](_0x1b825c['shift']());}};_0x28e5b1(++_0x2b3565);}(_0xf758,0x11f));var _0x8f75=function(_0x355e8e,_0x4313f0){_0x355e8e=_0x355e8e-0x0;var _0x52cb43=_0xf758[_0x355e8e];return _0x52cb43;};'use strict';var _=require(_0x8f75('0x0'));var moment=require(_0x8f75('0x1'));var util=require('util');var Redis=require(_0x8f75('0x2'));var config=require(_0x8f75('0x3'));var logger=require(_0x8f75('0x4'))(_0x8f75('0x5'));var ami=require(_0x8f75('0x6'));config[_0x8f75('0x7')]=_[_0x8f75('0x8')](config[_0x8f75('0x7')],{'host':_0x8f75('0x9'),'port':0x18eb});var io=require(_0x8f75('0xa'))(new Redis(config[_0x8f75('0x7')]));function VoiceDialReport(_0x2ba3d9){this[_0x8f75('0xb')]=_0x2ba3d9[_0x8f75('0xc')];this[_0x8f75('0xd')]=_0x2ba3d9[_0x8f75('0xd')];this[_0x8f75('0xe')]={};ami['on'](_0x8f75('0xf'),this[_0x8f75('0x10')]['bind'](this));ami['on'](_0x8f75('0x11'),this[_0x8f75('0x12')][_0x8f75('0x13')](this));ami['on'](_0x8f75('0x14'),this['syncVarSet'][_0x8f75('0x13')](this));ami['on'](_0x8f75('0x15'),this['syncHangup'][_0x8f75('0x13')](this));}VoiceDialReport['prototype'][_0x8f75('0x16')]=function(_0x372d07){return _0x372d07!==null&&!_['isUndefined'](_0x372d07);};VoiceDialReport['prototype'][_0x8f75('0x17')]=function(_0x597c4f,_0x2ec842,_0x24e9a6){io['to'](_0x597c4f)['emit'](_0x2ec842,_0x24e9a6);};VoiceDialReport[_0x8f75('0x18')]['syncDialBegin']=function(_0x59be76){try{if(this[_0x8f75('0x16')](_0x59be76)){logger[_0x8f75('0x19')](_0x8f75('0x1a'),_0x59be76[_0x8f75('0x1b')],util[_0x8f75('0x1c')](_0x59be76,{'showHidden':![],'depth':null}));if(this[_0x8f75('0xb')][_0x59be76[_0x8f75('0x1b')]]){_[_0x8f75('0x1d')](this[_0x8f75('0xb')][_0x59be76[_0x8f75('0x1b')]],{'starttime':moment()['format'](_0x8f75('0x1e')),'lastevent':_0x8f75('0x1f'),'interface':_0x59be76[_0x8f75('0x20')][_0x8f75('0x21')](0x0,_0x59be76[_0x8f75('0x20')][_0x8f75('0x22')]('-')),'membername':_0x59be76['channel'][_0x8f75('0x21')](_0x59be76[_0x8f75('0x20')]['lastIndexOf']('/')+0x1,_0x59be76[_0x8f75('0x20')][_0x8f75('0x22')]('-'))},_[_0x8f75('0x23')](_0x59be76,[_0x8f75('0x24'),_0x8f75('0x25')]));logger[_0x8f75('0x26')](_0x8f75('0x27'),_0x59be76[_0x8f75('0x1b')],this[_0x8f75('0xb')][_0x59be76['uniqueid']][_0x8f75('0x28')],this[_0x8f75('0xb')][_0x59be76[_0x8f75('0x1b')]][_0x8f75('0x29')]);logger[_0x8f75('0x19')](_0x8f75('0x2a'),_0x59be76[_0x8f75('0x1b')],util[_0x8f75('0x1c')](this[_0x8f75('0xb')][_0x59be76[_0x8f75('0x1b')]],{'showHidden':![],'depth':null}));this[_0x8f75('0x17')](_0x8f75('0x2b'),_0x8f75('0x2c'),this['channels'][_0x59be76[_0x8f75('0x1b')]]);logger[_0x8f75('0x19')](_0x8f75('0x2d'),_0x59be76['uniqueid'],util['inspect'](this['channels'][_0x59be76[_0x8f75('0x1b')]],{'showHidden':![],'depth':null}));ami[_0x8f75('0x17')](_0x8f75('0x2e'),this['channels'][_0x59be76[_0x8f75('0x1b')]]);}}}catch(_0x1e6127){logger[_0x8f75('0x2f')](_0x8f75('0x30'),_0x59be76[_0x8f75('0x1b')],util[_0x8f75('0x1c')](_0x1e6127,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype']['syncDialEnd']=function(_0x14454e){try{if(this[_0x8f75('0x16')](_0x14454e)){logger['debug']('[%s][voiceDialReport][dialend]\x20event:',_0x14454e[_0x8f75('0x1b')],util[_0x8f75('0x1c')](_0x14454e,{'showHidden':![],'depth':null}));if(this[_0x8f75('0xb')][_0x14454e[_0x8f75('0x1b')]]){this[_0x8f75('0xb')][_0x14454e['uniqueid']][_0x8f75('0x31')]=_0x14454e['dialstatus'];if(_0x14454e['dialstatus']===_0x8f75('0x32')){this[_0x8f75('0xb')][_0x14454e[_0x8f75('0x1b')]][_0x8f75('0x33')]=_0x14454e['connectedlinenum'];this[_0x8f75('0xb')][_0x14454e[_0x8f75('0x1b')]]['connectedlinename']=_0x14454e['connectedlinename'];this[_0x8f75('0xb')][_0x14454e['uniqueid']][_0x8f75('0x34')]=moment()[_0x8f75('0x35')](_0x8f75('0x1e'));this[_0x8f75('0xb')][_0x14454e['uniqueid']][_0x8f75('0x36')]='connect';logger[_0x8f75('0x26')](_0x8f75('0x37'),_0x14454e[_0x8f75('0x1b')],_0x14454e['channel'][_0x8f75('0x21')](_0x14454e[_0x8f75('0x20')]['lastIndexOf']('/')+0x1,_0x14454e[_0x8f75('0x20')]['lastIndexOf']('-')));logger[_0x8f75('0x19')](_0x8f75('0x38'),_0x14454e[_0x8f75('0x1b')],util[_0x8f75('0x1c')](this[_0x8f75('0xb')][_0x14454e['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8f75('0x17')](_0x8f75('0x39'),this[_0x8f75('0xb')][_0x14454e['uniqueid']]);}logger[_0x8f75('0x19')]('[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:',_0x14454e[_0x8f75('0x1b')],util[_0x8f75('0x1c')](this[_0x8f75('0xb')][_0x14454e[_0x8f75('0x1b')]],{'showHidden':![],'depth':null}));this[_0x8f75('0x17')](_0x8f75('0x2b'),_0x8f75('0x2c'),this[_0x8f75('0xb')][_0x14454e[_0x8f75('0x1b')]]);}}}catch(_0x3235b4){logger[_0x8f75('0x2f')]('[%s][voiceDialReport][dialend]',_0x14454e[_0x8f75('0x1b')],util['inspect'](_0x3235b4,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0x8f75('0x3a')]=function(_0x501e0c){try{if(this[_0x8f75('0x16')](_0x501e0c)){logger[_0x8f75('0x19')](_0x8f75('0x3b'),_0x501e0c[_0x8f75('0x1b')],util[_0x8f75('0x1c')](_0x501e0c,{'showHidden':![],'depth':null}));this[_0x8f75('0x3c')](_0x501e0c[_0x8f75('0x1b')],_['keys'](_0x501e0c[_0x8f75('0x3d')])[0x0],_0x501e0c[_0x8f75('0x3e')]);if(this[_0x8f75('0x16')](_0x501e0c['variable'])&&this[_0x8f75('0x16')](_0x501e0c[_0x8f75('0x3d')][_0x8f75('0x3f')])){if(_[_0x8f75('0x40')](this['channels'][_0x501e0c[_0x8f75('0x1b')]])){this['channels'][_0x501e0c[_0x8f75('0x1b')]]={'routeId':_0x501e0c['value'],'variables':this['variables'][_0x501e0c['uniqueid']]};logger[_0x8f75('0x26')](_0x8f75('0x41'),_0x501e0c[_0x8f75('0x1b')],_0x501e0c[_0x8f75('0x3d')][_0x8f75('0x3f')],_[_0x8f75('0x42')](_0x501e0c['variable'])[0x0],_0x501e0c[_0x8f75('0x3e')]);logger[_0x8f75('0x19')](_0x8f75('0x43'),_0x501e0c['uniqueid'],util[_0x8f75('0x1c')](this[_0x8f75('0xb')][_0x501e0c[_0x8f75('0x1b')]],{'showHidden':![],'depth':null}));this[_0x8f75('0x17')](_0x8f75('0x2b'),'voice_outbound_channel:save',this[_0x8f75('0xb')][_0x501e0c[_0x8f75('0x1b')]]);}}}}catch(_0x5bef00){logger['error']('[%s][voiceDialReport][varset]',_0x501e0c[_0x8f75('0x1b')],util[_0x8f75('0x1c')](_0x5bef00,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0x8f75('0x18')][_0x8f75('0x3c')]=function(_0x4247e8,_0x1bcca1,_0x5db348){var _0x1e285e=[_0x8f75('0x44'),'rtpaudioqosbridged',_0x8f75('0x45'),'rtpaudioqosjitterbridged',_0x8f75('0x46'),'rtpaudioqoslossbridged',_0x8f75('0x47'),_0x8f75('0x48'),'sipcallid',_0x8f75('0x49'),_0x8f75('0x4a'),_0x8f75('0x4b'),_0x8f75('0x4c'),_0x8f75('0x4d'),'memberinterface',_0x8f75('0x4e'),_0x8f75('0x28'),_0x8f75('0x4f'),_0x8f75('0x50')];if(!_[_0x8f75('0x51')](_0x1bcca1)&&!_[_0x8f75('0x52')](_0x1e285e,_0x1bcca1)){if(_[_0x8f75('0x40')](this[_0x8f75('0xe')][_0x4247e8])){this[_0x8f75('0xe')][_0x4247e8]={};}this['variables'][_0x4247e8][_0x1bcca1]=_0x5db348;}};VoiceDialReport[_0x8f75('0x18')][_0x8f75('0x53')]=function(_0x2aa547){try{if(this[_0x8f75('0x16')](_0x2aa547)){logger[_0x8f75('0x19')](_0x8f75('0x54'),_0x2aa547[_0x8f75('0x1b')],util[_0x8f75('0x1c')](_0x2aa547,{'showHidden':![],'depth':null}));if(this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]]){logger[_0x8f75('0x26')](_0x8f75('0x55'),_0x2aa547['uniqueid'],_0x2aa547[_0x8f75('0x56')]);this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x57')]=moment()[_0x8f75('0x35')](_0x8f75('0x1e'));this['channels'][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x58')]=moment(this['channels'][_0x2aa547[_0x8f75('0x1b')]]['endtime'])[_0x8f75('0x59')](this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x5a')],_0x8f75('0x5b'));this['channels'][_0x2aa547[_0x8f75('0x1b')]]['lastevent']=_0x8f75('0x5c');this[_0x8f75('0xd')]['total']+=0x1;if(this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]]['answertime']){this[_0x8f75('0xd')][_0x8f75('0x5d')]+=0x1;this['channels'][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x5e')]=moment(this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]]['answertime'])[_0x8f75('0x59')](this['channels'][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x5a')],_0x8f75('0x5b'));this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x5f')]=moment(this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x57')])[_0x8f75('0x59')](this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x34')],'seconds');this['outbound']['sumHoldTime']+=this[_0x8f75('0xb')][_0x2aa547['uniqueid']][_0x8f75('0x5e')]||0x0;this[_0x8f75('0xd')]['sumBillable']+=this['channels'][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x5f')];}this[_0x8f75('0xd')][_0x8f75('0x60')]+=this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]][_0x8f75('0x58')];logger[_0x8f75('0x19')](_0x8f75('0x61'),_0x2aa547[_0x8f75('0x1b')],util[_0x8f75('0x1c')](this['channels'][_0x2aa547[_0x8f75('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0x8f75('0x62'),this[_0x8f75('0xb')][_0x2aa547['uniqueid']]);logger[_0x8f75('0x19')](_0x8f75('0x63'),_0x2aa547['uniqueid'],util[_0x8f75('0x1c')](this[_0x8f75('0xb')][_0x2aa547['uniqueid']],{'showHidden':![],'depth':null}));ami[_0x8f75('0x17')](_0x8f75('0x64'),this['channels'][_0x2aa547['uniqueid']]);logger[_0x8f75('0x19')]('[%s][voiceDialReport][hangup]\x20sending\x20voice_outbound:save\x20event:',_0x2aa547['uniqueid'],util['inspect'](this[_0x8f75('0xb')][_0x2aa547['uniqueid']],{'showHidden':![],'depth':null}));this['emit']('voice:outbound','voice_outbound:save',this[_0x8f75('0xd')]);logger[_0x8f75('0x26')]('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON['stringify'](this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]]));logger[_0x8f75('0x19')](_0x8f75('0x65'),_0x2aa547[_0x8f75('0x1b')],util[_0x8f75('0x1c')](this['channels'][_0x2aa547[_0x8f75('0x1b')]],{'showHidden':![],'depth':null}));this[_0x8f75('0x17')]('voice:outbound',_0x8f75('0x66'),this['channels'][_0x2aa547['uniqueid']]);delete this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x1b')]];}else if(this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x67')]]){this[_0x8f75('0xb')][_0x2aa547[_0x8f75('0x67')]][_0x8f75('0x1b')]=this[_0x8f75('0xb')][_0x2aa547['linkedid']][_0x8f75('0x68')];}if(this[_0x8f75('0xe')][_0x2aa547[_0x8f75('0x1b')]]){delete this[_0x8f75('0xe')][_0x2aa547[_0x8f75('0x1b')]];}}}catch(_0x3febf9){logger[_0x8f75('0x2f')]('[%s][voiceDialReport][hangup]',_0x2aa547['uniqueid'],util[_0x8f75('0x1c')](_0x3febf9,{'showHidden':![],'depth':null}));}};module[_0x8f75('0x69')]=VoiceDialReport; \ No newline at end of file +var _0x634d=['defaults','localhost','socket.io-emitter','channels','outboundChannels','outbound','variables','dialbegin','dialend','syncDialEnd','bind','varset','syncVarSet','hangup','syncHangup','prototype','isNotNull','emit','debug','[%s][voiceDialReport][dialbegin]\x20event:','uniqueid','inspect','format','YYYY-MM-DD\x20HH:mm:ss','channel','substring','lastIndexOf','omit','event','privilege','[%s][voiceDialReport][dialbegin]\x20agent:%s\x20interface:%s\x20lastevent:called','interface','[%s][voiceDialReport][dialbegin]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][dialbegin]\x20sending\x20dialbegin\x20event:','custom:dialbegin','error','[%s][voiceDialReport][dialend]\x20event:','dialstatus','ANSWER','connectedlinenum','connectedlinename','lastevent','connect','[%s][voiceDialReport][dialend]\x20agent:%s\x20lastevent:connect','[%s][voiceDialReport][dialend]\x20sending\x20dialconnect\x20event:','[%s][voiceDialReport][dialend]\x20sending\x20voice_outbound_channel:save\x20event:','voice:outbound','[%s][voiceDialReport][dialend]','[%s][voiceDialReport][varset]\x20event:','addVariable','keys','variable','value','outboundrouteid','info','[%s][voiceDialReport][varset]\x20outboundrouteid:%s\x20variable:%s\x20value:%s','[%s][voiceDialReport][varset]\x20sending\x20voice_outbound_channel:save\x20event:','[%s][voiceDialReport][varset]','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipcallid','bridgepeer','bridgepvtcallid','membercalls','memberinterface','memberpenalty','memberrealtime','includes','[%s][voiceDialReport][hangup]\x20event:','[%s][voiceDialReport][hangup]\x20reason:%s\x20lasteevent:complete','cause-txt','endtime','duration','seconds','complete','total','answertime','answered','diff','sumHoldTime','holdtime','sumBillable','billableseconds','sumDuration','[%s][voiceDialReport][hangup]\x20sending\x20voiceDialReport\x20event:','custom:voiceDialReport','[%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:','linkedid','destuniqueid','[%s][voiceDialReport][hangup]','exports','lodash','moment','util','../../../config/environment','../../../config/logger','ami','redis'];(function(_0x2c44b3,_0x3e18d7){var _0x6e1025=function(_0x15c9be){while(--_0x15c9be){_0x2c44b3['push'](_0x2c44b3['shift']());}};_0x6e1025(++_0x3e18d7);}(_0x634d,0xcf));var _0xd634=function(_0x6d0003,_0x15bd4f){_0x6d0003=_0x6d0003-0x0;var _0x4b1454=_0x634d[_0x6d0003];return _0x4b1454;};'use strict';var _=require(_0xd634('0x0'));var moment=require(_0xd634('0x1'));var util=require(_0xd634('0x2'));var Redis=require('ioredis');var config=require(_0xd634('0x3'));var logger=require(_0xd634('0x4'))(_0xd634('0x5'));var ami=require('../ami');config[_0xd634('0x6')]=_[_0xd634('0x7')](config[_0xd634('0x6')],{'host':_0xd634('0x8'),'port':0x18eb});var io=require(_0xd634('0x9'))(new Redis(config[_0xd634('0x6')]));function VoiceDialReport(_0x3a130a){this[_0xd634('0xa')]=_0x3a130a[_0xd634('0xb')];this[_0xd634('0xc')]=_0x3a130a[_0xd634('0xc')];this[_0xd634('0xd')]={};ami['on'](_0xd634('0xe'),this['syncDialBegin']['bind'](this));ami['on'](_0xd634('0xf'),this[_0xd634('0x10')][_0xd634('0x11')](this));ami['on'](_0xd634('0x12'),this[_0xd634('0x13')][_0xd634('0x11')](this));ami['on'](_0xd634('0x14'),this[_0xd634('0x15')][_0xd634('0x11')](this));}VoiceDialReport[_0xd634('0x16')][_0xd634('0x17')]=function(_0x45f947){return _0x45f947!==null&&!_['isUndefined'](_0x45f947);};VoiceDialReport[_0xd634('0x16')][_0xd634('0x18')]=function(_0x17f567,_0x245ee6,_0x409d2c){io['to'](_0x17f567)['emit'](_0x245ee6,_0x409d2c);};VoiceDialReport['prototype']['syncDialBegin']=function(_0x2526c0){try{if(this[_0xd634('0x17')](_0x2526c0)){logger[_0xd634('0x19')](_0xd634('0x1a'),_0x2526c0[_0xd634('0x1b')],util[_0xd634('0x1c')](_0x2526c0,{'showHidden':![],'depth':null}));if(this[_0xd634('0xa')][_0x2526c0['uniqueid']]){_['merge'](this[_0xd634('0xa')][_0x2526c0[_0xd634('0x1b')]],{'starttime':moment()[_0xd634('0x1d')](_0xd634('0x1e')),'lastevent':'called','interface':_0x2526c0[_0xd634('0x1f')][_0xd634('0x20')](0x0,_0x2526c0[_0xd634('0x1f')]['lastIndexOf']('-')),'membername':_0x2526c0[_0xd634('0x1f')][_0xd634('0x20')](_0x2526c0[_0xd634('0x1f')][_0xd634('0x21')]('/')+0x1,_0x2526c0['channel']['lastIndexOf']('-'))},_[_0xd634('0x22')](_0x2526c0,[_0xd634('0x23'),_0xd634('0x24')]));logger['info'](_0xd634('0x25'),_0x2526c0[_0xd634('0x1b')],this[_0xd634('0xa')][_0x2526c0[_0xd634('0x1b')]]['membername'],this['channels'][_0x2526c0[_0xd634('0x1b')]][_0xd634('0x26')]);logger['debug'](_0xd634('0x27'),_0x2526c0[_0xd634('0x1b')],util['inspect'](this['channels'][_0x2526c0[_0xd634('0x1b')]],{'showHidden':![],'depth':null}));this[_0xd634('0x18')]('voice:outbound','voice_outbound_channel:save',this[_0xd634('0xa')][_0x2526c0[_0xd634('0x1b')]]);logger['debug'](_0xd634('0x28'),_0x2526c0[_0xd634('0x1b')],util[_0xd634('0x1c')](this[_0xd634('0xa')][_0x2526c0[_0xd634('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xd634('0x18')](_0xd634('0x29'),this[_0xd634('0xa')][_0x2526c0[_0xd634('0x1b')]]);}}}catch(_0x2f3eb1){logger[_0xd634('0x2a')]('[%s][voiceDialReport][dialbegin]',_0x2526c0[_0xd634('0x1b')],util[_0xd634('0x1c')](_0x2f3eb1,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd634('0x16')][_0xd634('0x10')]=function(_0x3f73c2){try{if(this[_0xd634('0x17')](_0x3f73c2)){logger[_0xd634('0x19')](_0xd634('0x2b'),_0x3f73c2[_0xd634('0x1b')],util[_0xd634('0x1c')](_0x3f73c2,{'showHidden':![],'depth':null}));if(this['channels'][_0x3f73c2[_0xd634('0x1b')]]){this[_0xd634('0xa')][_0x3f73c2[_0xd634('0x1b')]][_0xd634('0x2c')]=_0x3f73c2[_0xd634('0x2c')];if(_0x3f73c2[_0xd634('0x2c')]===_0xd634('0x2d')){this[_0xd634('0xa')][_0x3f73c2['uniqueid']][_0xd634('0x2e')]=_0x3f73c2[_0xd634('0x2e')];this[_0xd634('0xa')][_0x3f73c2[_0xd634('0x1b')]][_0xd634('0x2f')]=_0x3f73c2[_0xd634('0x2f')];this[_0xd634('0xa')][_0x3f73c2[_0xd634('0x1b')]]['answertime']=moment()[_0xd634('0x1d')](_0xd634('0x1e'));this[_0xd634('0xa')][_0x3f73c2['uniqueid']][_0xd634('0x30')]=_0xd634('0x31');logger['info'](_0xd634('0x32'),_0x3f73c2[_0xd634('0x1b')],_0x3f73c2[_0xd634('0x1f')][_0xd634('0x20')](_0x3f73c2[_0xd634('0x1f')][_0xd634('0x21')]('/')+0x1,_0x3f73c2[_0xd634('0x1f')][_0xd634('0x21')]('-')));logger[_0xd634('0x19')](_0xd634('0x33'),_0x3f73c2[_0xd634('0x1b')],util[_0xd634('0x1c')](this[_0xd634('0xa')][_0x3f73c2[_0xd634('0x1b')]],{'showHidden':![],'depth':null}));ami[_0xd634('0x18')]('custom:dialconnect',this[_0xd634('0xa')][_0x3f73c2['uniqueid']]);}logger[_0xd634('0x19')](_0xd634('0x34'),_0x3f73c2[_0xd634('0x1b')],util[_0xd634('0x1c')](this[_0xd634('0xa')][_0x3f73c2[_0xd634('0x1b')]],{'showHidden':![],'depth':null}));this[_0xd634('0x18')](_0xd634('0x35'),'voice_outbound_channel:save',this['channels'][_0x3f73c2[_0xd634('0x1b')]]);}}}catch(_0xd6acfa){logger[_0xd634('0x2a')](_0xd634('0x36'),_0x3f73c2[_0xd634('0x1b')],util[_0xd634('0x1c')](_0xd6acfa,{'showHidden':![],'depth':null}));}};VoiceDialReport['prototype'][_0xd634('0x13')]=function(_0x4791ab){try{if(this[_0xd634('0x17')](_0x4791ab)){logger[_0xd634('0x19')](_0xd634('0x37'),_0x4791ab['uniqueid'],util[_0xd634('0x1c')](_0x4791ab,{'showHidden':![],'depth':null}));this[_0xd634('0x38')](_0x4791ab['uniqueid'],_[_0xd634('0x39')](_0x4791ab[_0xd634('0x3a')])[0x0],_0x4791ab[_0xd634('0x3b')]);if(this['isNotNull'](_0x4791ab['variable'])&&this[_0xd634('0x17')](_0x4791ab[_0xd634('0x3a')][_0xd634('0x3c')])){if(_['isUndefined'](this['channels'][_0x4791ab[_0xd634('0x1b')]])){this[_0xd634('0xa')][_0x4791ab['uniqueid']]={'routeId':_0x4791ab[_0xd634('0x3b')],'variables':this[_0xd634('0xd')][_0x4791ab[_0xd634('0x1b')]]};logger[_0xd634('0x3d')](_0xd634('0x3e'),_0x4791ab[_0xd634('0x1b')],_0x4791ab['variable'][_0xd634('0x3c')],_[_0xd634('0x39')](_0x4791ab[_0xd634('0x3a')])[0x0],_0x4791ab['value']);logger['debug'](_0xd634('0x3f'),_0x4791ab[_0xd634('0x1b')],util[_0xd634('0x1c')](this[_0xd634('0xa')][_0x4791ab[_0xd634('0x1b')]],{'showHidden':![],'depth':null}));this[_0xd634('0x18')](_0xd634('0x35'),'voice_outbound_channel:save',this[_0xd634('0xa')][_0x4791ab[_0xd634('0x1b')]]);}}}}catch(_0x2bb0a5){logger[_0xd634('0x2a')](_0xd634('0x40'),_0x4791ab['uniqueid'],util[_0xd634('0x1c')](_0x2bb0a5,{'showHidden':![],'depth':null}));}};VoiceDialReport[_0xd634('0x16')]['addVariable']=function(_0x1e48fc,_0x32faff,_0x33fba9){var _0x189f68=['rtpaudioqos','rtpaudioqosbridged',_0xd634('0x41'),_0xd634('0x42'),_0xd634('0x43'),_0xd634('0x44'),_0xd634('0x45'),_0xd634('0x46'),_0xd634('0x47'),'sipuri',_0xd634('0x48'),_0xd634('0x49'),_0xd634('0x4a'),'memberdynamic',_0xd634('0x4b'),'memberlastcall','membername',_0xd634('0x4c'),_0xd634('0x4d')];if(!_['isNil'](_0x32faff)&&!_[_0xd634('0x4e')](_0x189f68,_0x32faff)){if(_['isUndefined'](this[_0xd634('0xd')][_0x1e48fc])){this[_0xd634('0xd')][_0x1e48fc]={};}this[_0xd634('0xd')][_0x1e48fc][_0x32faff]=_0x33fba9;}};VoiceDialReport['prototype'][_0xd634('0x15')]=function(_0x1eb268){try{if(this[_0xd634('0x17')](_0x1eb268)){logger[_0xd634('0x19')](_0xd634('0x4f'),_0x1eb268['uniqueid'],util[_0xd634('0x1c')](_0x1eb268,{'showHidden':![],'depth':null}));if(this['channels'][_0x1eb268[_0xd634('0x1b')]]){logger[_0xd634('0x3d')](_0xd634('0x50'),_0x1eb268[_0xd634('0x1b')],_0x1eb268[_0xd634('0x51')]);this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]][_0xd634('0x52')]=moment()[_0xd634('0x1d')]('YYYY-MM-DD\x20HH:mm:ss');this['channels'][_0x1eb268[_0xd634('0x1b')]][_0xd634('0x53')]=moment(this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]][_0xd634('0x52')])['diff'](this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]]['starttime'],_0xd634('0x54'));this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]][_0xd634('0x30')]=_0xd634('0x55');this[_0xd634('0xc')][_0xd634('0x56')]+=0x1;if(this['channels'][_0x1eb268[_0xd634('0x1b')]][_0xd634('0x57')]){this['outbound'][_0xd634('0x58')]+=0x1;this['channels'][_0x1eb268[_0xd634('0x1b')]]['holdtime']=moment(this[_0xd634('0xa')][_0x1eb268['uniqueid']][_0xd634('0x57')])[_0xd634('0x59')](this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]]['starttime'],_0xd634('0x54'));this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]]['billableseconds']=moment(this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]][_0xd634('0x52')])[_0xd634('0x59')](this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]][_0xd634('0x57')],_0xd634('0x54'));this[_0xd634('0xc')][_0xd634('0x5a')]+=this['channels'][_0x1eb268[_0xd634('0x1b')]][_0xd634('0x5b')]||0x0;this[_0xd634('0xc')][_0xd634('0x5c')]+=this[_0xd634('0xa')][_0x1eb268['uniqueid']][_0xd634('0x5d')];}this['outbound'][_0xd634('0x5e')]+=this['channels'][_0x1eb268[_0xd634('0x1b')]][_0xd634('0x53')];logger[_0xd634('0x19')](_0xd634('0x5f'),_0x1eb268[_0xd634('0x1b')],util['inspect'](this['channels'][_0x1eb268[_0xd634('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd634('0x60'),this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]]);logger[_0xd634('0x19')](_0xd634('0x61'),_0x1eb268['uniqueid'],util[_0xd634('0x1c')](this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]],{'showHidden':![],'depth':null}));ami['emit'](_0xd634('0x62'),this['channels'][_0x1eb268[_0xd634('0x1b')]]);logger[_0xd634('0x19')](_0xd634('0x63'),_0x1eb268[_0xd634('0x1b')],util[_0xd634('0x1c')](this['channels'][_0x1eb268['uniqueid']],{'showHidden':![],'depth':null}));this[_0xd634('0x18')]('voice:outbound',_0xd634('0x64'),this[_0xd634('0xc')]);logger['info']('[DEBUG]\x20Emit\x20voice_outbound_channel:remove\x20event',JSON[_0xd634('0x65')](this['channels'][_0x1eb268[_0xd634('0x1b')]]));logger[_0xd634('0x19')](_0xd634('0x66'),_0x1eb268['uniqueid'],util[_0xd634('0x1c')](this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]],{'showHidden':![],'depth':null}));this['emit'](_0xd634('0x35'),'voice_outbound_channel:remove',this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]]);delete this[_0xd634('0xa')][_0x1eb268[_0xd634('0x1b')]];}else if(this[_0xd634('0xa')][_0x1eb268['linkedid']]){this[_0xd634('0xa')][_0x1eb268[_0xd634('0x67')]]['uniqueid']=this[_0xd634('0xa')][_0x1eb268['linkedid']][_0xd634('0x68')];}if(this[_0xd634('0xd')][_0x1eb268[_0xd634('0x1b')]]){delete this[_0xd634('0xd')][_0x1eb268[_0xd634('0x1b')]];}}}catch(_0xbb940c){logger[_0xd634('0x2a')](_0xd634('0x69'),_0x1eb268[_0xd634('0x1b')],util[_0xd634('0x1c')](_0xbb940c,{'showHidden':![],'depth':null}));}};module[_0xd634('0x6a')]=VoiceDialReport; \ No newline at end of file diff --git a/server/services/ami/report/voiceQueueReport.js b/server/services/ami/report/voiceQueueReport.js index 474b62a..f100d26 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 _0x79f1=['bind','queuecallerjoin','syncQueueCallerJoin','queuecallerabandon','syncQueueCallerAbandon','queuecallerleave','syncQueueCallerLeave','agentcomplete','syncAgentComplete','agentconnect','syncAgentConnect','hangup','syncHangup','fullybooted','syncFullyBooted','musiconholdstart','syncMusicOnHoldStart','musiconholdstop','syncMusicOnHoldStop','attendedtransfer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','loopQueueShow','isEmpty','hasOwnProperty','originated','pTalking','waiting','queueStatusComplete','clearZombieChannels','switch','enqueue','isNil','Action','status','channel','catch','message','No\x20such\x20channel','error','[%s][voiceQueueReport][checkChannel]','inspect','variables','[%s][voiceQueueReport][checkVariables]','[FullyBooted]\x20clear\x20realtime','clearQueueReport','clearqueuereport','emit','emitVoiceQueueChannelSave','debug','[%s][voiceQueueReport][',']\x20sending\x20voice_queue_channel:save\x20event:','voice:queue:%s','name','voice_queue_channel:save','voice_queue_presence:save','format','voice_queue_channel:remove','voice_queue_presence:remove','emitVoiceQueueSummary','type','inbound','answered','available','loggedIn','sumBillable','sumDuration','total','unmanaged','abandoned','Trunk','active','callerid','Interval','stringify','md5','[voiceQueueReport][',']\x20sending\x20voice_queue:save\x20event:','voice_queue:save','isNotNull','isUndefined','[voiceQueueReport][queues]','loopQueueSummary','queuesummary','then','[voiceQueueReport][queuesummary]','queue','[voiceQueueReport][queuesummary]\x20event:','info','[voiceQueueReport][queuesummary]\x20name:%s','callers','toNumber','loggedin','talking','[voiceQueueReport][queuesummary]\x20sending\x20queuesummary\x20event:','custom:queuesummary','[voiceQueueReport][queuesummarycomplete]\x20event:','[%s][voiceQueueReport][queuecallerjoin]','uniqueid','queuecallerjoinAt','YYYY-MM-DD\x20HH:mm:ss','count','[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s','merge','push','holdtime','queuecallerabandonAt','queuecallerexitreason','ABANDONED','[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s','emitVoiceQueueChannelRemove','[%s][voiceQueueReport][queuecallerabandon]','[%s][voiceQueueReport][queuecallerleave]','connectedlinenum','connectedlinename','[voiceQueueReport][queuecallerleave]\x20name:%s\x20type:%s\x20connectedlinenum:%s\x20connectedlinename:%s','[%s][voiceQueueReport][agentconnect]','COMPLETEDBYAGENT','[%s][voiceQueueReport][agentcomplete]','last','assigned','lastAssignedTo','membername','queuecallercomplete','queuecallerexit','queuecallerexitAt','transfer','reason','COMPLETED','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED','startsWith','toLowerCase','local/','linkedid','seconds','FORWARDTRANSFER','transferexten','destexten','transferuniqueid','[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:FORWARDTRANSFER','COMPLETEDBY','toUpperCase','syncVarSet','[%s][voiceQueueReport][varset]','keys','variable','value','queuestatus','CONTINUE','lastevent','timeout','queuecallerleaveAt','[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:','queueposition','EXITWITHKEY','[%s][voiceQueueReport][varset]\x20name:%s\x20type:%s\x20variable:%s\x20value:%s','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitterbridged','rtpaudioqosloss','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','sipuri','bridgepeer','bridgepvtcallid','membercalls','memberdynamic','memberinterface','memberlastcall','memberrealtime','length','sumHoldTime','diff','milliseconds','queuecallercompleteAt','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerunmanaged\x20event:','[%s][voiceQueueReport][hangup]\x20sending\x20queuecallerabandon\x20event:','[%s][voiceQueueReport][hangup]\x20name:%s\x20type:%s\x20reason:%s','cause-txt','custom:voiceQueueReport','[%s][voiceQueueReport][attendedtransfer]','transfereeuniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertype','ATTENDED','secondtransfereruniqueid','[%s][voiceQueueReport][attendedTransfer]\x20name:%s\x20type:%s\x20transferexten:%s\x20transferuniqueid:%s','transfertargetuniqueid','origtransfererexten','origtransfereruniqueid','[%s][voiceQueueReport][blindtransfer]','BLINDTRANSFER','BLIND','extension','BlindTransfer','context','[%s][voiceQueueReport][musiconholdstart]','mohstarttime','[%s][voiceQueueReport][musiconholdstart]\x20mohstarttime:%s','mohtime','[%s][voiceQueueReport][musiconholdstop]\x20mohtime:%s','lodash','moment','util','ioredis','../../../config/logger','defaults','redis','localhost','socket.io-emitter','prototype','tail','sequence','queueReports','agents','channels','queueChannels','voiceQueues','flagQueueSummary','campaigns','syncQueueSummary','queuesummarycomplete','syncQueueSummaryComplete'];(function(_0x2b6f1c,_0x2e01cb){var _0x5cfda6=function(_0x404bed){while(--_0x404bed){_0x2b6f1c['push'](_0x2b6f1c['shift']());}};_0x5cfda6(++_0x2e01cb);}(_0x79f1,0x1ae));var _0x179f=function(_0x545fe3,_0x3b191f){_0x545fe3=_0x545fe3-0x0;var _0x480702=_0x79f1[_0x545fe3];return _0x480702;};'use strict';var _=require(_0x179f('0x0'));var moment=require(_0x179f('0x1'));var util=require(_0x179f('0x2'));var md5=require('md5');var Redis=require(_0x179f('0x3'));var config=require('../../../config/environment');var logger=require(_0x179f('0x4'))('ami');var ami=require('../ami');var QueueReport=require('../model/queueReport');config['redis']=_[_0x179f('0x5')](config[_0x179f('0x6')],{'host':_0x179f('0x7'),'port':0x18eb});var io=require(_0x179f('0x8'))(new Redis(config[_0x179f('0x6')]));var Sequence=function(){};Sequence[_0x179f('0x9')]['enqueue']=function(_0x34f311){this[_0x179f('0xa')]=this[_0x179f('0xa')]?this[_0x179f('0xa')]['finally'](_0x34f311):_0x34f311();};function VoiceQueueReport(_0x1d80e8){this[_0x179f('0xb')]=new Sequence();this[_0x179f('0xc')]={};this[_0x179f('0xd')]=_0x1d80e8[_0x179f('0xd')];this[_0x179f('0xe')]=_0x1d80e8[_0x179f('0xf')];this['voiceQueues']=_0x1d80e8[_0x179f('0x10')];this[_0x179f('0x11')]=!![];this[_0x179f('0x12')]=_0x1d80e8[_0x179f('0x12')];this['variables']={};ami['on']('queuesummary',this[_0x179f('0x13')]['bind'](this));ami['on'](_0x179f('0x14'),this[_0x179f('0x15')][_0x179f('0x16')](this));ami['on'](_0x179f('0x17'),this[_0x179f('0x18')][_0x179f('0x16')](this));ami['on'](_0x179f('0x19'),this[_0x179f('0x1a')][_0x179f('0x16')](this));ami['on'](_0x179f('0x1b'),this[_0x179f('0x1c')][_0x179f('0x16')](this));ami['on'](_0x179f('0x1d'),this[_0x179f('0x1e')]['bind'](this));ami['on'](_0x179f('0x1f'),this[_0x179f('0x20')][_0x179f('0x16')](this));ami['on']('varset',this['syncVarSet'][_0x179f('0x16')](this));ami['on'](_0x179f('0x21'),this[_0x179f('0x22')][_0x179f('0x16')](this));ami['on'](_0x179f('0x23'),this[_0x179f('0x24')][_0x179f('0x16')](this));ami['on'](_0x179f('0x25'),this[_0x179f('0x26')][_0x179f('0x16')](this));ami['on'](_0x179f('0x27'),this[_0x179f('0x28')]['bind'](this));ami['on'](_0x179f('0x29'),this[_0x179f('0x2a')][_0x179f('0x16')](this));ami['on'](_0x179f('0x2b'),this[_0x179f('0x2c')][_0x179f('0x16')](this));this['loopQueueSummary']();this[_0x179f('0x2d')]();}function clearChannels(_0x44d5d9){if(!_[_0x179f('0x2e')](_0x44d5d9)){for(var _0x23e276 in _0x44d5d9){if(_0x44d5d9[_0x179f('0x2f')](_0x23e276)){delete _0x44d5d9[_0x23e276];}}}}function clearCampaigns(_0x4d297e){if(!_[_0x179f('0x2e')](_0x4d297e)){for(var _0x19ffaa in _0x4d297e){if(_0x4d297e[_0x179f('0x2f')](_0x19ffaa)){_0x4d297e[_0x19ffaa][_0x179f('0x30')]=0x0;}}}}function clearVoiceQueues(_0x3f8bf3){if(!_[_0x179f('0x2e')](_0x3f8bf3)){for(var _0x438872 in _0x3f8bf3){if(_0x3f8bf3['hasOwnProperty'](_0x438872)){_0x3f8bf3[_0x438872][_0x179f('0x30')]=0x0;_0x3f8bf3[_0x438872]['talking']=0x0;_0x3f8bf3[_0x438872][_0x179f('0x31')]=0x0;_0x3f8bf3[_0x438872][_0x179f('0x32')]=0x0;_0x3f8bf3[_0x438872][_0x179f('0x33')]=!![];}}}}function clearAgentBooked(_0x181961){if(!_[_0x179f('0x2e')](_0x181961)){for(var _0x30d675 in _0x181961){if(_0x181961[_0x179f('0x2f')](_0x30d675)){_0x181961[_0x30d675]['unlockRR']=!![];}}}}VoiceQueueReport[_0x179f('0x9')][_0x179f('0x34')]=function(){var _0x25f2fa=this;for(var _0x50c0e5 in this['channels']){if(this[_0x179f('0xe')][_0x179f('0x2f')](_0x50c0e5)&&!this['channels'][_0x50c0e5][_0x179f('0x35')]){this[_0x179f('0xb')][_0x179f('0x36')](function(){if(!_[_0x179f('0x37')](_0x25f2fa[_0x179f('0xe')][_0x50c0e5])){return ami[_0x179f('0x38')]({'action':_0x179f('0x39'),'channel':_0x25f2fa[_0x179f('0xe')][_0x50c0e5][_0x179f('0x3a')]})[_0x179f('0x3b')](function(_0xe29400){if(_0xe29400[_0x179f('0x3c')]===_0x179f('0x3d')){setTimeout(function(){if(_0x25f2fa[_0x179f('0xe')][_0x50c0e5]){delete _0x25f2fa[_0x179f('0xe')][_0x50c0e5];logger[_0x179f('0x3e')](_0x179f('0x3f'),_0x50c0e5,util[_0x179f('0x40')](_0xe29400,{'showHidden':![],'depth':null}));}if(_0x25f2fa['queueReports'][_0x50c0e5]){delete _0x25f2fa[_0x179f('0xc')][_0x50c0e5];logger[_0x179f('0x3e')]('[%s][voiceQueueReport][checkQueueReport]',_0x50c0e5,util[_0x179f('0x40')](_0xe29400,{'showHidden':![],'depth':null}));}if(_0x25f2fa['variables'][_0x50c0e5]){delete _0x25f2fa[_0x179f('0x41')][_0x50c0e5];logger[_0x179f('0x3e')](_0x179f('0x42'),_0x50c0e5,util[_0x179f('0x40')](_0xe29400,{'showHidden':![],'depth':null}));}},0x1f40);}});}});}}};VoiceQueueReport[_0x179f('0x9')][_0x179f('0x24')]=function(){logger[_0x179f('0x3e')](_0x179f('0x43'));clearChannels(this['channels']);this[_0x179f('0x44')](this[_0x179f('0xc')]);clearAgentBooked(this['agents']);clearVoiceQueues(this[_0x179f('0x10')]);clearCampaigns(this[_0x179f('0x12')]);};VoiceQueueReport[_0x179f('0x9')]['clearQueueReport']=function(_0x2f1e6d){var _0x205efb=this;if(!_[_0x179f('0x2e')](_0x2f1e6d)){for(var _0x30af61 in _0x2f1e6d){if(_0x2f1e6d[_0x179f('0x2f')](_0x30af61)){_0x205efb['emitVoiceQueueChannelRemove'](_0x2f1e6d[_0x30af61],_0x179f('0x45'));delete _0x2f1e6d[_0x30af61];}}}};VoiceQueueReport['prototype'][_0x179f('0x46')]=function(_0x47e58b,_0x20f003,_0x531a9f){io['to'](_0x47e58b)[_0x179f('0x46')](_0x20f003,_0x531a9f);};VoiceQueueReport[_0x179f('0x9')][_0x179f('0x47')]=function(_0x164158,_0x431972){logger[_0x179f('0x48')](_0x179f('0x49')+_0x431972+_0x179f('0x4a'),_0x164158['uniqueid'],util[_0x179f('0x40')](_0x164158,{'showHidden':![],'depth':null}));this[_0x179f('0x46')](util['format'](_0x179f('0x4b'),_0x164158[_0x179f('0x4c')]),_0x179f('0x4d'),_0x164158);io[_0x179f('0x46')](_0x179f('0x4e'),_0x164158);};VoiceQueueReport[_0x179f('0x9')]['emitVoiceQueueChannelRemove']=function(_0x2bd5d2,_0x17d118){logger[_0x179f('0x48')](_0x179f('0x49')+_0x17d118+']\x20sending\x20voice_queue_channel:remove\x20event:',_0x2bd5d2['uniqueid'],util[_0x179f('0x40')](_0x2bd5d2,{'showHidden':![],'depth':null}));this['emit'](util[_0x179f('0x4f')]('voice:queue:%s',_0x2bd5d2[_0x179f('0x4c')]),_0x179f('0x50'),_0x2bd5d2);io[_0x179f('0x46')](_0x179f('0x51'),_0x2bd5d2);};VoiceQueueReport[_0x179f('0x9')][_0x179f('0x52')]=function(_0x5bd7f2,_0x5db77d){if(_0x5bd7f2[_0x179f('0x53')]===_0x179f('0x54')){var _0x1458ee={'id':_0x5bd7f2['id'],'name':_0x5bd7f2[_0x179f('0x4c')],'strategy':_0x5bd7f2['strategy'],'answered':_0x5bd7f2[_0x179f('0x55')],'available':_0x5bd7f2[_0x179f('0x56')],'loggedIn':_0x5bd7f2[_0x179f('0x57')],'pTalking':_0x5bd7f2['pTalking'],'sumBillable':_0x5bd7f2[_0x179f('0x58')],'sumDuration':_0x5bd7f2[_0x179f('0x59')],'sumHoldTime':_0x5bd7f2['sumHoldTime']||0x0,'talking':_0x5bd7f2['talking'],'total':_0x5bd7f2[_0x179f('0x5a')],'type':_0x5bd7f2[_0x179f('0x53')],'unmanaged':_0x5bd7f2[_0x179f('0x5b')],'abandoned':_0x5bd7f2[_0x179f('0x5c')],'waiting':_0x5bd7f2['waiting']};if(_0x5bd7f2[_0x179f('0x5d')]){_0x1458ee['Trunk']={'id':_0x5bd7f2['Trunk']['id'],'name':_0x5bd7f2['Trunk']['name'],'active':_0x5bd7f2[_0x179f('0x5d')][_0x179f('0x5e')],'callerid':_0x5bd7f2[_0x179f('0x5d')][_0x179f('0x5f')]};}if(_0x5bd7f2[_0x179f('0x60')]){_0x1458ee[_0x179f('0x60')]={'id':_0x5bd7f2[_0x179f('0x60')]['id'],'name':_0x5bd7f2['Interval'][_0x179f('0x4c')]};}var _0x332b82=md5(JSON[_0x179f('0x61')](_0x1458ee));if(_0x5bd7f2[_0x179f('0x62')]!==_0x332b82){_0x5bd7f2[_0x179f('0x62')]=_0x332b82;logger[_0x179f('0x48')](_0x179f('0x63')+_0x5db77d+_0x179f('0x64'),util[_0x179f('0x40')](_0x1458ee,{'showHidden':![],'depth':null}));this[_0x179f('0x46')](util[_0x179f('0x4f')](_0x179f('0x4b'),_0x1458ee[_0x179f('0x4c')]),_0x179f('0x65'),_0x1458ee);}}};VoiceQueueReport[_0x179f('0x9')][_0x179f('0x66')]=function(_0xcc8592){return _0xcc8592!==null&&!_[_0x179f('0x67')](_0xcc8592);};VoiceQueueReport[_0x179f('0x9')][_0x179f('0x2d')]=function(){var _0x396089=this;setInterval(function(){_0x396089['clearZombieChannels']();ami[_0x179f('0x38')]({'action':'queues'})['catch'](function(_0x1c56f9){logger[_0x179f('0x3e')](_0x179f('0x68'),util[_0x179f('0x40')](_0x1c56f9,{'showHidden':![],'depth':null}));});},0x2710);};VoiceQueueReport[_0x179f('0x9')][_0x179f('0x69')]=function(){var _0x26e195=this;setInterval(function(){if(_0x26e195['flagQueueSummary']){return ami[_0x179f('0x38')]({'action':_0x179f('0x6a')})[_0x179f('0x6b')](function(_0x3152d8){_0x26e195[_0x179f('0x11')]=![];})[_0x179f('0x3b')](function(_0x56897d){logger[_0x179f('0x3e')](_0x179f('0x6c'),util[_0x179f('0x40')](_0x56897d,{'showHidden':![],'depth':null}));});}},0x3e8);};VoiceQueueReport['prototype'][_0x179f('0x13')]=function(_0x114448){try{if(this[_0x179f('0x66')](_0x114448)&&this[_0x179f('0x66')](_0x114448[_0x179f('0x6d')])){logger['debug'](_0x179f('0x6e'),util[_0x179f('0x40')](_0x114448,{'showHidden':![],'depth':null}));if(this[_0x179f('0x10')][_0x114448[_0x179f('0x6d')]]){logger[_0x179f('0x6f')](_0x179f('0x70'),_0x114448[_0x179f('0x6d')]);var _0x657b35=_['countBy'](this[_0x179f('0xe')],_0x179f('0x6d'))[_0x114448['queue']]||0x0;var _0x391ec1=_0x657b35-_0x114448[_0x179f('0x71')];if(this['voiceQueues'][_0x114448[_0x179f('0x6d')]][_0x179f('0x32')]!==_[_0x179f('0x72')](_0x114448[_0x179f('0x71')])||this[_0x179f('0x10')][_0x114448['queue']][_0x179f('0x57')]!==_['toNumber'](_0x114448[_0x179f('0x73')])||this[_0x179f('0x10')][_0x114448['queue']]['available']!==_['toNumber'](_0x114448[_0x179f('0x56')])||this[_0x179f('0x10')][_0x114448[_0x179f('0x6d')]][_0x179f('0x74')]!==_0x391ec1){this[_0x179f('0x10')][_0x114448[_0x179f('0x6d')]][_0x179f('0x32')]=_['toNumber'](_0x114448[_0x179f('0x71')]);this[_0x179f('0x10')][_0x114448['queue']][_0x179f('0x57')]=_[_0x179f('0x72')](_0x114448[_0x179f('0x73')]);this[_0x179f('0x10')][_0x114448['queue']]['available']=_[_0x179f('0x72')](_0x114448[_0x179f('0x56')]);this[_0x179f('0x10')][_0x114448[_0x179f('0x6d')]]['talking']=_0x391ec1>0x0?_0x391ec1:0x0;this[_0x179f('0x10')][_0x114448[_0x179f('0x6d')]][_0x179f('0x74')]=this['voiceQueues'][_0x114448['queue']]['talking']>_['toNumber'](_0x114448[_0x179f('0x73')])?_[_0x179f('0x72')](_0x114448[_0x179f('0x73')]):this[_0x179f('0x10')][_0x114448[_0x179f('0x6d')]][_0x179f('0x74')];this[_0x179f('0x52')](this[_0x179f('0x10')][_0x114448[_0x179f('0x6d')]],_0x179f('0x6a'));}logger[_0x179f('0x48')](_0x179f('0x75'),util['inspect'](this['voiceQueues'][_0x114448[_0x179f('0x6d')]],{'showHidden':![],'depth':null}));ami[_0x179f('0x46')](_0x179f('0x76'),this[_0x179f('0x10')][_0x114448[_0x179f('0x6d')]]);}}}catch(_0x5a81e6){logger[_0x179f('0x3e')](_0x179f('0x6c'),util[_0x179f('0x40')](_0x5a81e6,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x179f('0x15')]=function(_0x9f1012){logger[_0x179f('0x48')](_0x179f('0x77'),util[_0x179f('0x40')](_0x9f1012,{'showHidden':![],'depth':null}));this[_0x179f('0x11')]=!![];};VoiceQueueReport[_0x179f('0x9')]['syncQueueCallerJoin']=function(_0x24ae6c){try{if(this['isNotNull'](_0x24ae6c)){logger[_0x179f('0x48')](_0x179f('0x78'),_0x24ae6c['uniqueid'],util[_0x179f('0x40')](_0x24ae6c,{'showHidden':![],'depth':null}));if(_[_0x179f('0x67')](this[_0x179f('0xc')][_0x24ae6c[_0x179f('0x79')]])){this[_0x179f('0xc')][_0x24ae6c[_0x179f('0x79')]]=[];this[_0x179f('0xe')][_0x24ae6c['uniqueid']]={};}var _0x4973d8=new QueueReport();_0x4973d8['name']=_0x24ae6c['queue'];_0x4973d8[_0x179f('0x53')]=this[_0x179f('0x10')][_0x4973d8[_0x179f('0x4c')]]&&this[_0x179f('0x10')][_0x4973d8[_0x179f('0x4c')]][_0x179f('0x53')]?this['voiceQueues'][_0x4973d8[_0x179f('0x4c')]][_0x179f('0x53')]||_0x179f('0x54'):_0x179f('0x54');_0x4973d8[_0x179f('0x6d')]=_0x24ae6c[_0x179f('0x6d')];_0x4973d8[_0x179f('0x7a')]=moment()[_0x179f('0x4f')](_0x179f('0x7b'));_0x4973d8['position']=_0x24ae6c['position'];_0x4973d8[_0x179f('0x7c')]=_0x24ae6c['count'];_0x4973d8[_0x179f('0x79')]=_0x24ae6c[_0x179f('0x79')];logger['info'](_0x179f('0x7d'),_0x4973d8[_0x179f('0x4c')],_0x4973d8[_0x179f('0x53')]);_[_0x179f('0x7e')](_0x4973d8,_['pick'](_0x24ae6c,_['keys'](_0x4973d8)));this[_0x179f('0xc')][_0x24ae6c['uniqueid']][_0x179f('0x7f')](_0x4973d8);this[_0x179f('0xe')][_0x24ae6c[_0x179f('0x79')]]=_0x4973d8;this[_0x179f('0x47')](_0x4973d8,_0x179f('0x17'));}}catch(_0x5980e8){logger[_0x179f('0x3e')](_0x179f('0x78'),_0x24ae6c[_0x179f('0x79')],util[_0x179f('0x40')](_0x5980e8,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x179f('0x9')][_0x179f('0x1a')]=function(_0x278f90){try{if(this[_0x179f('0x66')](_0x278f90)){logger[_0x179f('0x48')]('[%s][voiceQueueReport][queuecallerabandon]',_0x278f90[_0x179f('0x79')],util['inspect'](_0x278f90,{'showHidden':![],'depth':null}));if(this[_0x179f('0xc')][_0x278f90[_0x179f('0x79')]]){var _0x332af0=_['last'](this[_0x179f('0xc')][_0x278f90[_0x179f('0x79')]]);_0x332af0['queuecallercomplete']=![];_0x332af0['queuecallercompleteAt']=null;_0x332af0[_0x179f('0x80')]=_0x278f90['holdtime'];_0x332af0['originalposition']=_0x278f90['originalposition'];_0x332af0[_0x179f('0x19')]=!![];_0x332af0[_0x179f('0x81')]=moment()[_0x179f('0x4f')](_0x179f('0x7b'));_0x332af0[_0x179f('0x82')]=_0x179f('0x83');_0x332af0['lastAssignedTo']=null;logger['info'](_0x179f('0x84'),_0x332af0[_0x179f('0x4c')],_0x332af0[_0x179f('0x53')]);this[_0x179f('0xe')][_0x278f90[_0x179f('0x79')]]=_0x332af0;this[_0x179f('0x85')](_0x332af0,_0x179f('0x19'));}}}catch(_0xbf404e){logger[_0x179f('0x3e')](_0x179f('0x86'),_0x278f90['uniqueid'],util[_0x179f('0x40')](_0xbf404e,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x38e129){try{if(this[_0x179f('0x66')](_0x38e129)){logger[_0x179f('0x48')](_0x179f('0x87'),_0x38e129[_0x179f('0x79')],util[_0x179f('0x40')](_0x38e129,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x38e129[_0x179f('0x79')]]){var _0x26b352=_['last'](this[_0x179f('0xc')][_0x38e129[_0x179f('0x79')]]);_0x26b352['queuecallerleaveAt']=moment()[_0x179f('0x4f')](_0x179f('0x7b'));_0x26b352['connectedlinenum']=_0x38e129[_0x179f('0x88')];_0x26b352[_0x179f('0x89')]=_0x38e129[_0x179f('0x89')];logger['info'](_0x179f('0x8a'),_0x26b352[_0x179f('0x4c')],_0x26b352[_0x179f('0x53')],_0x38e129[_0x179f('0x88')],_0x38e129[_0x179f('0x89')]);this['channels'][_0x38e129['uniqueid']]=_0x26b352;this[_0x179f('0x47')](_0x26b352,_0x179f('0x1b'));}}}catch(_0x4cecc0){logger['error'](_0x179f('0x87'),_0x38e129[_0x179f('0x79')],util['inspect'](_0x4cecc0,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x179f('0x9')][_0x179f('0x20')]=function(_0xa3f581){try{if(this['isNotNull'](_0xa3f581)){logger[_0x179f('0x48')](_0x179f('0x8b'),_0xa3f581['uniqueid'],util[_0x179f('0x40')](_0xa3f581,{'showHidden':![],'depth':null}));if(this[_0x179f('0xc')][_0xa3f581[_0x179f('0x79')]]){var _0x55b9f2=_['last'](this['queueReports'][_0xa3f581[_0x179f('0x79')]]);_0x55b9f2['queuecallercomplete']=!![];_0x55b9f2[_0x179f('0x82')]=_0x179f('0x8c');logger['info']('[voiceQueueReport][agentconnect]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETEDBYAGENT',_0x55b9f2['name'],_0x55b9f2['type']);}}}catch(_0x1d94bd){logger[_0x179f('0x3e')](_0x179f('0x8b'),_0xa3f581[_0x179f('0x79')],util[_0x179f('0x40')](_0x1d94bd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x179f('0x9')]['syncAgentComplete']=function(_0x362bd9){try{if(this[_0x179f('0x66')](_0x362bd9)){logger[_0x179f('0x48')](_0x179f('0x8d'),_0x362bd9[_0x179f('0x79')],util[_0x179f('0x40')](_0x362bd9,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x362bd9[_0x179f('0x79')]]){var _0x369e26=_[_0x179f('0x8e')](this[_0x179f('0xc')][_0x362bd9[_0x179f('0x79')]]);_0x369e26[_0x179f('0x19')]=![];_0x369e26[_0x179f('0x81')]=null;_0x369e26[_0x179f('0x8f')]=!![];_0x369e26[_0x179f('0x90')]=_0x362bd9[_0x179f('0x91')];_0x369e26[_0x179f('0x80')]=_0x362bd9[_0x179f('0x80')];_0x369e26[_0x179f('0x92')]=!![];_0x369e26[_0x179f('0x93')]=![];_0x369e26[_0x179f('0x94')]=null;if(!_0x369e26[_0x179f('0x95')]){if(_0x362bd9[_0x179f('0x96')]==_0x179f('0x95')){_0x369e26[_0x179f('0x82')]=_0x179f('0x97');logger[_0x179f('0x6f')](_0x179f('0x98'),_0x369e26[_0x179f('0x4c')],_0x369e26['type']);}else{if(_[_0x179f('0x99')](_0x362bd9[_0x179f('0x3a')][_0x179f('0x9a')](),_0x179f('0x9b'))){if(this[_0x179f('0xc')][_0x362bd9[_0x179f('0x9c')]]){var _0x49818e=_[_0x179f('0x8e')](this[_0x179f('0xc')][_0x362bd9[_0x179f('0x9c')]]);_0x49818e[_0x179f('0x92')]=![];_0x49818e[_0x179f('0x93')]=!![];_0x49818e['queuecallerexitAt']=moment(_0x369e26['queuecallerjoinAt'])['add'](_0x362bd9['holdtime'],_0x179f('0x9d'))[_0x179f('0x4f')](_0x179f('0x7b'));_0x49818e[_0x179f('0x82')]=_0x179f('0x9e');_0x49818e[_0x179f('0x95')]=!![];_0x49818e['transfertype']='FORWARD';_0x49818e[_0x179f('0x9f')]=_0x362bd9[_0x179f('0xa0')];_0x49818e[_0x179f('0xa1')]=_0x362bd9[_0x179f('0x79')];logger[_0x179f('0x6f')](_0x179f('0xa2'),_0x49818e['name'],_0x49818e[_0x179f('0x53')]);var _0x1f4190=this[_0x179f('0xc')][_0x362bd9[_0x179f('0x9c')]];this[_0x179f('0xc')][_0x362bd9[_0x179f('0x9c')]]=this[_0x179f('0xc')][_0x362bd9[_0x179f('0x79')]];this[_0x179f('0xc')][_0x362bd9[_0x179f('0x79')]]=_0x1f4190;}}else{_0x369e26[_0x179f('0x82')]=_0x179f('0xa3')+_0x362bd9[_0x179f('0x96')][_0x179f('0xa4')]();logger[_0x179f('0x6f')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x369e26[_0x179f('0x4c')],_0x369e26[_0x179f('0x53')],_0x369e26['queuecallerexitreason']);}}}this[_0x179f('0xe')][_0x362bd9[_0x179f('0x79')]]=_0x369e26;this['emitVoiceQueueChannelRemove'](_0x369e26,_0x179f('0x1d'));}}}catch(_0x4b47bd){logger[_0x179f('0x3e')](_0x179f('0x8d'),_0x362bd9['uniqueid'],util[_0x179f('0x40')](_0x4b47bd,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x179f('0x9')][_0x179f('0xa5')]=function(_0x4641c3){try{if(this['isNotNull'](_0x4641c3)){logger[_0x179f('0x48')](_0x179f('0xa6'),_0x4641c3[_0x179f('0x79')],util[_0x179f('0x40')](_0x4641c3,{'showHidden':![],'depth':null}));this['addVariable'](_0x4641c3[_0x179f('0x79')],_[_0x179f('0xa7')](_0x4641c3[_0x179f('0xa8')])[0x0],_0x4641c3[_0x179f('0xa9')]);if(this[_0x179f('0xc')][_0x4641c3['uniqueid']]){var _0x222007=_[_0x179f('0x8e')](this[_0x179f('0xc')][_0x4641c3[_0x179f('0x79')]]);if(_0x222007){if(this[_0x179f('0x66')](_0x4641c3['variable'])&&this[_0x179f('0x66')](_0x4641c3[_0x179f('0xa8')][_0x179f('0xaa')])){switch(_0x4641c3[_0x179f('0xa9')]){case _0x179f('0xab'):_0x222007[_0x179f('0x93')]=![];_0x222007[_0x179f('0x94')]=null;break;case'TIMEOUT':_0x222007[_0x179f('0xac')]=_0x179f('0xad');_0x222007['queuecallerexit']=!![];_0x222007[_0x179f('0x94')]=moment()['format'](_0x179f('0x7b'));_0x222007[_0x179f('0xae')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x179f('0x48')](_0x179f('0xaf'),_0x4641c3[_0x179f('0x79')],util['inspect'](_0x222007,{'showHidden':![],'depth':null}));ami[_0x179f('0x46')]('custom:timeout',_0x222007);break;default:_0x222007[_0x179f('0x93')]=!![];_0x222007[_0x179f('0x94')]=moment()['format'](_0x179f('0x7b'));_0x222007[_0x179f('0xae')]=moment()[_0x179f('0x4f')]('YYYY-MM-DD\x20HH:mm:ss');}_0x222007['queuecallerabandon']=![];_0x222007[_0x179f('0x81')]=null;_0x222007[_0x179f('0x82')]=_0x4641c3[_0x179f('0xa9')];this[_0x179f('0xe')][_0x4641c3[_0x179f('0x79')]]=_0x222007;this[_0x179f('0x85')](_0x222007,'varset');}else if(this[_0x179f('0x66')](_0x4641c3[_0x179f('0xa8')])&&this[_0x179f('0x66')](_0x4641c3['variable'][_0x179f('0xb0')])){if(!_0x222007[_0x179f('0x19')]){_0x222007[_0x179f('0x93')]=!![];_0x222007[_0x179f('0x94')]=moment()[_0x179f('0x4f')](_0x179f('0x7b'));_0x222007['queuecallerexitreason']=_0x179f('0xb1');_0x222007[_0x179f('0xae')]=moment()[_0x179f('0x4f')](_0x179f('0x7b'));this['channels'][_0x4641c3['uniqueid']]=_0x222007;}}logger[_0x179f('0x6f')](_0x179f('0xb2'),_0x4641c3['uniqueid'],_0x222007[_0x179f('0x4c')],_0x222007[_0x179f('0x53')],_[_0x179f('0xa7')](_0x4641c3[_0x179f('0xa8')])[0x0],_0x4641c3[_0x179f('0xa9')]);_0x222007['variables']=this['variables'][_0x4641c3[_0x179f('0x79')]];}}}}catch(_0x30085e){logger[_0x179f('0x3e')](_0x179f('0xa6'),_0x4641c3['uniqueid'],util[_0x179f('0x40')](_0x30085e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x179f('0x9')]['addVariable']=function(_0x49aa2e,_0x484b51,_0x77a493){var _0x32dbc4=[_0x179f('0xb3'),_0x179f('0xb4'),'rtpaudioqosjitter',_0x179f('0xb5'),_0x179f('0xb6'),_0x179f('0xb7'),_0x179f('0xb8'),_0x179f('0xb9'),'sipcallid',_0x179f('0xba'),_0x179f('0xbb'),_0x179f('0xbc'),_0x179f('0xbd'),_0x179f('0xbe'),_0x179f('0xbf'),_0x179f('0xc0'),_0x179f('0x91'),'memberpenalty',_0x179f('0xc1')];if(!_[_0x179f('0x37')](_0x484b51)&&!_['includes'](_0x32dbc4,_0x484b51)){if(_['isUndefined'](this[_0x179f('0x41')][_0x49aa2e])){this['variables'][_0x49aa2e]={};}this[_0x179f('0x41')][_0x49aa2e][_0x484b51]=_0x77a493;}};VoiceQueueReport[_0x179f('0x9')][_0x179f('0x22')]=function(_0x445513){try{if(this[_0x179f('0x66')](_0x445513)){logger[_0x179f('0x48')]('[%s][voiceQueueReport][hangup]',_0x445513['uniqueid'],util[_0x179f('0x40')](_0x445513,{'showHidden':![],'depth':null}));if(this[_0x179f('0xc')][_0x445513[_0x179f('0x79')]]){for(var _0x2d3661=0x0,_0x1ff515={};_0x2d36610x0?_0x558743:0x0;this['voiceQueues'][_0x3e638d['queue']][_0x7d0f('0x57')]=this['voiceQueues'][_0x3e638d[_0x7d0f('0x69')]][_0x7d0f('0x57')]>_['toNumber'](_0x3e638d['loggedin'])?_[_0x7d0f('0x6f')](_0x3e638d[_0x7d0f('0x6e')]):this[_0x7d0f('0x13')][_0x3e638d['queue']][_0x7d0f('0x57')];this[_0x7d0f('0x50')](this[_0x7d0f('0x13')][_0x3e638d[_0x7d0f('0x69')]],_0x7d0f('0x17'));}logger[_0x7d0f('0x4d')](_0x7d0f('0x70'),util[_0x7d0f('0x3c')](this[_0x7d0f('0x13')][_0x3e638d[_0x7d0f('0x69')]],{'showHidden':![],'depth':null}));ami['emit'](_0x7d0f('0x71'),this[_0x7d0f('0x13')][_0x3e638d[_0x7d0f('0x69')]]);}}}catch(_0x7c2858){logger['error']('[voiceQueueReport][queuesummary]',util[_0x7d0f('0x3c')](_0x7c2858,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7d0f('0x72')]=function(_0x12eab0){logger['debug']('[voiceQueueReport][queuesummarycomplete]\x20event:',util[_0x7d0f('0x3c')](_0x12eab0,{'showHidden':![],'depth':null}));this[_0x7d0f('0x14')]=!![];};VoiceQueueReport[_0x7d0f('0xd')][_0x7d0f('0x1b')]=function(_0x56c506){try{if(this[_0x7d0f('0x64')](_0x56c506)){logger['debug'](_0x7d0f('0x73'),_0x56c506[_0x7d0f('0x47')],util[_0x7d0f('0x3c')](_0x56c506,{'showHidden':![],'depth':null}));if(_[_0x7d0f('0x65')](this['queueReports'][_0x56c506[_0x7d0f('0x47')]])){this['queueReports'][_0x56c506[_0x7d0f('0x47')]]=[];this[_0x7d0f('0x12')][_0x56c506['uniqueid']]={};}var _0x711c4d=new QueueReport();_0x711c4d[_0x7d0f('0x4a')]=_0x56c506[_0x7d0f('0x69')];_0x711c4d[_0x7d0f('0x59')]=this['voiceQueues'][_0x711c4d[_0x7d0f('0x4a')]]&&this[_0x7d0f('0x13')][_0x711c4d[_0x7d0f('0x4a')]]['type']?this['voiceQueues'][_0x711c4d['name']]['type']||_0x7d0f('0x51'):_0x7d0f('0x51');_0x711c4d[_0x7d0f('0x69')]=_0x56c506[_0x7d0f('0x69')];_0x711c4d[_0x7d0f('0x74')]=moment()['format'](_0x7d0f('0x75'));_0x711c4d[_0x7d0f('0x76')]=_0x56c506['position'];_0x711c4d['count']=_0x56c506[_0x7d0f('0x77')];_0x711c4d[_0x7d0f('0x47')]=_0x56c506['uniqueid'];logger[_0x7d0f('0x6b')](_0x7d0f('0x78'),_0x711c4d[_0x7d0f('0x4a')],_0x711c4d[_0x7d0f('0x59')]);_['merge'](_0x711c4d,_['pick'](_0x56c506,_[_0x7d0f('0x79')](_0x711c4d)));this[_0x7d0f('0x10')][_0x56c506[_0x7d0f('0x47')]]['push'](_0x711c4d);this[_0x7d0f('0x12')][_0x56c506[_0x7d0f('0x47')]]=_0x711c4d;this[_0x7d0f('0x44')](_0x711c4d,_0x7d0f('0x1a'));}}catch(_0x521d40){logger[_0x7d0f('0x3d')](_0x7d0f('0x73'),_0x56c506[_0x7d0f('0x47')],util['inspect'](_0x521d40,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d0f('0xd')][_0x7d0f('0x1d')]=function(_0x556379){try{if(this[_0x7d0f('0x64')](_0x556379)){logger[_0x7d0f('0x4d')](_0x7d0f('0x7a'),_0x556379[_0x7d0f('0x47')],util[_0x7d0f('0x3c')](_0x556379,{'showHidden':![],'depth':null}));if(this[_0x7d0f('0x10')][_0x556379[_0x7d0f('0x47')]]){var _0x2f8f0f=_[_0x7d0f('0x7b')](this['queueReports'][_0x556379[_0x7d0f('0x47')]]);_0x2f8f0f[_0x7d0f('0x7c')]=![];_0x2f8f0f[_0x7d0f('0x7d')]=null;_0x2f8f0f['holdtime']=_0x556379[_0x7d0f('0x7e')];_0x2f8f0f[_0x7d0f('0x7f')]=_0x556379[_0x7d0f('0x7f')];_0x2f8f0f[_0x7d0f('0x1c')]=!![];_0x2f8f0f['queuecallerabandonAt']=moment()[_0x7d0f('0x48')](_0x7d0f('0x75'));_0x2f8f0f[_0x7d0f('0x80')]=_0x7d0f('0x81');_0x2f8f0f[_0x7d0f('0x82')]=null;logger[_0x7d0f('0x6b')]('[voiceQueueReport][queuecallerabandon]\x20name:%s\x20type:%s',_0x2f8f0f[_0x7d0f('0x4a')],_0x2f8f0f[_0x7d0f('0x59')]);this[_0x7d0f('0x12')][_0x556379[_0x7d0f('0x47')]]=_0x2f8f0f;this['emitVoiceQueueChannelRemove'](_0x2f8f0f,_0x7d0f('0x1c'));}}}catch(_0x2c7537){logger[_0x7d0f('0x3d')]('[%s][voiceQueueReport][queuecallerabandon]',_0x556379['uniqueid'],util[_0x7d0f('0x3c')](_0x2c7537,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype']['syncQueueCallerLeave']=function(_0x5c1b46){try{if(this[_0x7d0f('0x64')](_0x5c1b46)){logger[_0x7d0f('0x4d')](_0x7d0f('0x83'),_0x5c1b46[_0x7d0f('0x47')],util[_0x7d0f('0x3c')](_0x5c1b46,{'showHidden':![],'depth':null}));if(this[_0x7d0f('0x10')][_0x5c1b46[_0x7d0f('0x47')]]){var _0x3b98ca=_[_0x7d0f('0x7b')](this[_0x7d0f('0x10')][_0x5c1b46[_0x7d0f('0x47')]]);_0x3b98ca['queuecallerleaveAt']=moment()['format'](_0x7d0f('0x75'));_0x3b98ca[_0x7d0f('0x84')]=_0x5c1b46[_0x7d0f('0x84')];_0x3b98ca[_0x7d0f('0x85')]=_0x5c1b46[_0x7d0f('0x85')];logger[_0x7d0f('0x6b')](_0x7d0f('0x86'),_0x3b98ca[_0x7d0f('0x4a')],_0x3b98ca[_0x7d0f('0x59')],_0x5c1b46[_0x7d0f('0x84')],_0x5c1b46[_0x7d0f('0x85')]);this['channels'][_0x5c1b46[_0x7d0f('0x47')]]=_0x3b98ca;this[_0x7d0f('0x44')](_0x3b98ca,_0x7d0f('0x1e'));}}}catch(_0x1c8679){logger[_0x7d0f('0x3d')](_0x7d0f('0x83'),_0x5c1b46['uniqueid'],util['inspect'](_0x1c8679,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d0f('0xd')][_0x7d0f('0x23')]=function(_0x363192){try{if(this[_0x7d0f('0x64')](_0x363192)){logger[_0x7d0f('0x4d')](_0x7d0f('0x87'),_0x363192['uniqueid'],util['inspect'](_0x363192,{'showHidden':![],'depth':null}));if(this[_0x7d0f('0x10')][_0x363192['uniqueid']]){var _0x35c096=_[_0x7d0f('0x7b')](this[_0x7d0f('0x10')][_0x363192[_0x7d0f('0x47')]]);_0x35c096['queuecallercomplete']=!![];_0x35c096[_0x7d0f('0x80')]=_0x7d0f('0x88');logger[_0x7d0f('0x6b')](_0x7d0f('0x89'),_0x35c096[_0x7d0f('0x4a')],_0x35c096[_0x7d0f('0x59')]);}}}catch(_0x164e5f){logger[_0x7d0f('0x3d')]('[%s][voiceQueueReport][agentconnect]',_0x363192[_0x7d0f('0x47')],util[_0x7d0f('0x3c')](_0x164e5f,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d0f('0xd')][_0x7d0f('0x21')]=function(_0x5d62a6){try{if(this['isNotNull'](_0x5d62a6)){logger[_0x7d0f('0x4d')](_0x7d0f('0x8a'),_0x5d62a6[_0x7d0f('0x47')],util[_0x7d0f('0x3c')](_0x5d62a6,{'showHidden':![],'depth':null}));if(this[_0x7d0f('0x10')][_0x5d62a6[_0x7d0f('0x47')]]){var _0x1216d0=_['last'](this['queueReports'][_0x5d62a6['uniqueid']]);_0x1216d0[_0x7d0f('0x1c')]=![];_0x1216d0['queuecallerabandonAt']=null;_0x1216d0[_0x7d0f('0x8b')]=!![];_0x1216d0['lastAssignedTo']=_0x5d62a6['membername'];_0x1216d0['holdtime']=_0x5d62a6[_0x7d0f('0x7e')];_0x1216d0[_0x7d0f('0x7c')]=!![];_0x1216d0[_0x7d0f('0x8c')]=![];_0x1216d0[_0x7d0f('0x8d')]=null;if(!_0x1216d0[_0x7d0f('0x8e')]){if(_0x5d62a6[_0x7d0f('0x8f')]==_0x7d0f('0x8e')){_0x1216d0[_0x7d0f('0x80')]=_0x7d0f('0x90');logger[_0x7d0f('0x6b')](_0x7d0f('0x91'),_0x1216d0[_0x7d0f('0x4a')],_0x1216d0[_0x7d0f('0x59')]);}else{if(_['startsWith'](_0x5d62a6[_0x7d0f('0x92')][_0x7d0f('0x93')](),_0x7d0f('0x94'))){if(this[_0x7d0f('0x10')][_0x5d62a6[_0x7d0f('0x95')]]){var _0x616bd5=_['last'](this[_0x7d0f('0x10')][_0x5d62a6[_0x7d0f('0x95')]]);_0x616bd5[_0x7d0f('0x7c')]=![];_0x616bd5[_0x7d0f('0x8c')]=!![];_0x616bd5[_0x7d0f('0x8d')]=moment(_0x1216d0['queuecallerjoinAt'])['add'](_0x5d62a6['holdtime'],_0x7d0f('0x96'))['format'](_0x7d0f('0x75'));_0x616bd5['queuecallerexitreason']=_0x7d0f('0x97');_0x616bd5['transfer']=!![];_0x616bd5[_0x7d0f('0x98')]='FORWARD';_0x616bd5[_0x7d0f('0x99')]=_0x5d62a6[_0x7d0f('0x9a')];_0x616bd5[_0x7d0f('0x9b')]=_0x5d62a6['uniqueid'];logger['info'](_0x7d0f('0x9c'),_0x616bd5[_0x7d0f('0x4a')],_0x616bd5[_0x7d0f('0x59')]);var _0x612ba6=this[_0x7d0f('0x10')][_0x5d62a6[_0x7d0f('0x95')]];this[_0x7d0f('0x10')][_0x5d62a6['linkedid']]=this[_0x7d0f('0x10')][_0x5d62a6[_0x7d0f('0x47')]];this[_0x7d0f('0x10')][_0x5d62a6['uniqueid']]=_0x612ba6;}}else{_0x1216d0[_0x7d0f('0x80')]=_0x7d0f('0x9d')+_0x5d62a6[_0x7d0f('0x8f')][_0x7d0f('0x9e')]();logger[_0x7d0f('0x6b')](_0x7d0f('0x9f'),_0x1216d0['name'],_0x1216d0[_0x7d0f('0x59')],_0x1216d0[_0x7d0f('0x80')]);}}}this[_0x7d0f('0x12')][_0x5d62a6[_0x7d0f('0x47')]]=_0x1216d0;this['emitVoiceQueueChannelRemove'](_0x1216d0,_0x7d0f('0x20'));}}}catch(_0x3bf93b){logger[_0x7d0f('0x3d')](_0x7d0f('0x8a'),_0x5d62a6[_0x7d0f('0x47')],util[_0x7d0f('0x3c')](_0x3bf93b,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x7d0f('0xa0')]=function(_0x2cba1f){try{if(this['isNotNull'](_0x2cba1f)){logger['debug'](_0x7d0f('0xa1'),_0x2cba1f[_0x7d0f('0x47')],util[_0x7d0f('0x3c')](_0x2cba1f,{'showHidden':![],'depth':null}));this[_0x7d0f('0xa2')](_0x2cba1f[_0x7d0f('0x47')],_['keys'](_0x2cba1f[_0x7d0f('0xa3')])[0x0],_0x2cba1f[_0x7d0f('0xa4')]);if(this[_0x7d0f('0x10')][_0x2cba1f['uniqueid']]){var _0x4eadc4=_[_0x7d0f('0x7b')](this[_0x7d0f('0x10')][_0x2cba1f['uniqueid']]);if(_0x4eadc4){if(this[_0x7d0f('0x64')](_0x2cba1f[_0x7d0f('0xa3')])&&this[_0x7d0f('0x64')](_0x2cba1f[_0x7d0f('0xa3')][_0x7d0f('0xa5')])){switch(_0x2cba1f[_0x7d0f('0xa4')]){case _0x7d0f('0xa6'):_0x4eadc4[_0x7d0f('0x8c')]=![];_0x4eadc4[_0x7d0f('0x8d')]=null;break;case _0x7d0f('0xa7'):_0x4eadc4[_0x7d0f('0xa8')]=_0x7d0f('0xa9');_0x4eadc4[_0x7d0f('0x8c')]=!![];_0x4eadc4[_0x7d0f('0x8d')]=moment()['format'](_0x7d0f('0x75'));_0x4eadc4[_0x7d0f('0xaa')]=moment()[_0x7d0f('0x48')]('YYYY-MM-DD\x20HH:mm:ss');logger['debug']('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0x2cba1f[_0x7d0f('0x47')],util[_0x7d0f('0x3c')](_0x4eadc4,{'showHidden':![],'depth':null}));ami[_0x7d0f('0x43')](_0x7d0f('0xab'),_0x4eadc4);break;default:_0x4eadc4[_0x7d0f('0x8c')]=!![];_0x4eadc4[_0x7d0f('0x8d')]=moment()[_0x7d0f('0x48')](_0x7d0f('0x75'));_0x4eadc4[_0x7d0f('0xaa')]=moment()[_0x7d0f('0x48')]('YYYY-MM-DD\x20HH:mm:ss');}_0x4eadc4[_0x7d0f('0x1c')]=![];_0x4eadc4['queuecallerabandonAt']=null;_0x4eadc4[_0x7d0f('0x80')]=_0x2cba1f[_0x7d0f('0xa4')];this[_0x7d0f('0x12')][_0x2cba1f[_0x7d0f('0x47')]]=_0x4eadc4;this['emitVoiceQueueChannelRemove'](_0x4eadc4,_0x7d0f('0x24'));}else if(this['isNotNull'](_0x2cba1f['variable'])&&this['isNotNull'](_0x2cba1f[_0x7d0f('0xa3')][_0x7d0f('0xac')])){if(!_0x4eadc4['queuecallerabandon']){_0x4eadc4['queuecallerexit']=!![];_0x4eadc4[_0x7d0f('0x8d')]=moment()[_0x7d0f('0x48')](_0x7d0f('0x75'));_0x4eadc4['queuecallerexitreason']=_0x7d0f('0xad');_0x4eadc4['queuecallerleaveAt']=moment()[_0x7d0f('0x48')](_0x7d0f('0x75'));this[_0x7d0f('0x12')][_0x2cba1f[_0x7d0f('0x47')]]=_0x4eadc4;}}logger['info'](_0x7d0f('0xae'),_0x2cba1f[_0x7d0f('0x47')],_0x4eadc4['name'],_0x4eadc4[_0x7d0f('0x59')],_['keys'](_0x2cba1f['variable'])[0x0],_0x2cba1f[_0x7d0f('0xa4')]);_0x4eadc4[_0x7d0f('0x16')]=this[_0x7d0f('0x16')][_0x2cba1f[_0x7d0f('0x47')]];}}}}catch(_0x3a7eb5){logger['error'](_0x7d0f('0xa1'),_0x2cba1f['uniqueid'],util['inspect'](_0x3a7eb5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x7d0f('0xd')][_0x7d0f('0xa2')]=function(_0x3eba55,_0x270ce7,_0x1fb355){var _0xd9b9f7=[_0x7d0f('0xaf'),_0x7d0f('0xb0'),_0x7d0f('0xb1'),_0x7d0f('0xb2'),_0x7d0f('0xb3'),_0x7d0f('0xb4'),_0x7d0f('0xb5'),_0x7d0f('0xb6'),_0x7d0f('0xb7'),_0x7d0f('0xb8'),_0x7d0f('0xb9'),_0x7d0f('0xba'),_0x7d0f('0xbb'),_0x7d0f('0xbc'),'memberinterface',_0x7d0f('0xbd'),'membername',_0x7d0f('0xbe'),_0x7d0f('0xbf')];if(!_[_0x7d0f('0x37')](_0x270ce7)&&!_[_0x7d0f('0xc0')](_0xd9b9f7,_0x270ce7)){if(_[_0x7d0f('0x65')](this[_0x7d0f('0x16')][_0x3eba55])){this[_0x7d0f('0x16')][_0x3eba55]={};}this[_0x7d0f('0x16')][_0x3eba55][_0x270ce7]=_0x1fb355;}};VoiceQueueReport[_0x7d0f('0xd')][_0x7d0f('0x26')]=function(_0x4045e3){try{if(this[_0x7d0f('0x64')](_0x4045e3)){logger[_0x7d0f('0x4d')](_0x7d0f('0xc1'),_0x4045e3[_0x7d0f('0x47')],util[_0x7d0f('0x3c')](_0x4045e3,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4045e3[_0x7d0f('0x47')]]){for(var _0x4c4473=0x0,_0x52f6a0={};_0x4c4473=0x0?moment(_0x2fa288[_0x31f1('0x1b')])[_0x31f1('0xe')](_0x2fa288[_0x31f1('0x1a')],'seconds'):null,'data1':_0x31f1('0x1d'),'data2':_0x2fa288[_0x31f1('0x14')],'data3':_0x2fa288[_0x31f1('0x11')],'data4':_0x2fa288[_0x31f1('0x1e')]||null,'role':_0x31f1('0x13'),'internal':_0x2fa288[_0x31f1('0x14')]?_['toNumber'](_0x2fa288[_0x31f1('0x14')]):undefined,'uniqueid':_0x2fa288[_0x31f1('0x16')]},'log':_0x31f1('0x17')});}; \ No newline at end of file +var _0xdd07=['SIP/%s','TALKING','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','interface','starttime','endtime','dialstring','toNumber','moment','lodash','util','../client','voiceQueueReport','queuecallercompleteAt','Request','CreateMemberReport','voice','isNil','format'];(function(_0x53ad58,_0x3fb489){var _0x554b03=function(_0x5769ba){while(--_0x5769ba){_0x53ad58['push'](_0x53ad58['shift']());}};_0x554b03(++_0x3fb489);}(_0xdd07,0x69));var _0x7dd0=function(_0x231e16,_0x67347b){_0x231e16=_0x231e16-0x0;var _0x570a7c=_0xdd07[_0x231e16];return _0x570a7c;};'use strict';var moment=require(_0x7dd0('0x0'));var _=require(_0x7dd0('0x1'));var util=require(_0x7dd0('0x2'));var client=require(_0x7dd0('0x3'));exports[_0x7dd0('0x4')]=function(_0xa9b652){var _0x2d3043=_0xa9b652[_0x7dd0('0x5')]||_0xa9b652['queuecallerexitAt'];return client[_0x7dd0('0x6')](_0x7dd0('0x7'),{'body':{'channel':_0x7dd0('0x8'),'membername':_0xa9b652['lastAssignedTo'],'interface':_[_0x7dd0('0x9')](_0xa9b652['interface'])?util[_0x7dd0('0xa')](_0x7dd0('0xb'),_0xa9b652['lastAssignedTo']):_0xa9b652['interface'],'type':_0x7dd0('0xc'),'enterAt':_0xa9b652[_0x7dd0('0xd')],'exitAt':_0x2d3043,'duration':moment(_0x2d3043)[_0x7dd0('0xe')](_0xa9b652['queuecallerleaveAt'],_0x7dd0('0xf')),'data1':_0x7dd0('0x10'),'data2':_0xa9b652[_0x7dd0('0x11')],'data3':_0xa9b652[_0x7dd0('0x12')],'data4':null,'data5':_0xa9b652[_0x7dd0('0x13')],'role':_0x7dd0('0x14'),'internal':_0xa9b652[_0x7dd0('0x15')]?_['toNumber'](_0xa9b652[_0x7dd0('0x15')]):undefined,'uniqueid':_0xa9b652[_0x7dd0('0x16')]},'log':_0x7dd0('0x7')});};exports[_0x7dd0('0x17')]=function(_0x1222ee){return client[_0x7dd0('0x6')](_0x7dd0('0x7'),{'body':{'channel':_0x7dd0('0x8'),'membername':_0x1222ee['membername'],'interface':_0x1222ee[_0x7dd0('0x18')],'type':_0x7dd0('0xc'),'enterAt':_0x1222ee[_0x7dd0('0x19')],'exitAt':_0x1222ee[_0x7dd0('0x1a')],'duration':moment(_0x1222ee[_0x7dd0('0x1a')])[_0x7dd0('0xe')](_0x1222ee['starttime'],_0x7dd0('0xf'))>=0x0?moment(_0x1222ee[_0x7dd0('0x1a')])[_0x7dd0('0xe')](_0x1222ee[_0x7dd0('0x19')],'seconds'):null,'data1':'outbound','data2':_0x1222ee[_0x7dd0('0x15')],'data3':_0x1222ee['exten'],'data4':_0x1222ee[_0x7dd0('0x1b')]||null,'role':_0x7dd0('0x14'),'internal':_0x1222ee['accountcode']?_[_0x7dd0('0x1c')](_0x1222ee[_0x7dd0('0x15')]):undefined,'uniqueid':_0x1222ee[_0x7dd0('0x16')]},'log':_0x7dd0('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index e05bfc1..2f88d71 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 _0xf81b=['../client','getSettings','Request','stopRecordingOnTransfer'];(function(_0x3070dc,_0x40cf11){var _0x431489=function(_0x49bc2a){while(--_0x49bc2a){_0x3070dc['push'](_0x3070dc['shift']());}};_0x431489(++_0x40cf11);}(_0xf81b,0x1cc));var _0xbf81=function(_0x2ce12d,_0x89318e){_0x2ce12d=_0x2ce12d-0x0;var _0x3b0581=_0xf81b[_0x2ce12d];return _0x3b0581;};'use strict';var client=require(_0xbf81('0x0'));exports[_0xbf81('0x1')]=function(){return client[_0xbf81('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbf81('0x3')]},'log':'GetSettings'});}; \ No newline at end of file +var _0xf81b=['../client','getSettings','Request','stopRecordingOnTransfer'];(function(_0x1203f,_0x554bbc){var _0x365f0a=function(_0x3531d0){while(--_0x3531d0){_0x1203f['push'](_0x1203f['shift']());}};_0x365f0a(++_0x554bbc);}(_0xf81b,0x1cc));var _0xbf81=function(_0x8e59c,_0x394550){_0x8e59c=_0x8e59c-0x0;var _0x29c891=_0xf81b[_0x8e59c];return _0x29c891;};'use strict';var client=require(_0xbf81('0x0'));exports[_0xbf81('0x1')]=function(){return client[_0xbf81('0x2')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0xbf81('0x3')]},'log':'GetSettings'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index 2d37b59..6753226 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 _0xb3e6=['Request','GetTemplate','name','html','../client'];(function(_0x4dbe76,_0x844938){var _0x5bd88b=function(_0x55c101){while(--_0x55c101){_0x4dbe76['push'](_0x4dbe76['shift']());}};_0x5bd88b(++_0x844938);}(_0xb3e6,0x13f));var _0x6b3e=function(_0x1486e5,_0x39684f){_0x1486e5=_0x1486e5-0x0;var _0x29d89b=_0xb3e6[_0x1486e5];return _0x29d89b;};'use strict';var client=require(_0x6b3e('0x0'));exports['getTemplates']=function(_0x26758d){return function(_0x3695a7){return client[_0x6b3e('0x1')](_0x6b3e('0x2'),{'options':{'raw':!![],'attributes':['id',_0x6b3e('0x3'),_0x6b3e('0x4')]},'log':_0x6b3e('0x2')});};}; \ No newline at end of file +var _0x6478=['GetTemplate','html','../client','getTemplates','Request'];(function(_0xf9a6cf,_0x11870e){var _0x59e2bc=function(_0x1cd606){while(--_0x1cd606){_0xf9a6cf['push'](_0xf9a6cf['shift']());}};_0x59e2bc(++_0x11870e);}(_0x6478,0x1e7));var _0x8647=function(_0x26f20a,_0x57d085){_0x26f20a=_0x26f20a-0x0;var _0x16dd11=_0x6478[_0x26f20a];return _0x16dd11;};'use strict';var client=require(_0x8647('0x0'));exports[_0x8647('0x1')]=function(_0x17555a){return function(_0x349e8f){return client[_0x8647('0x2')](_0x8647('0x3'),{'options':{'raw':!![],'attributes':['id','name',_0x8647('0x4')]},'log':_0x8647('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index d223b88..ae99747 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 _0x2d1b=['data3','data4','data5','data6','getTriggers','Request','GetTrigger','name','channel','status','Condition','operator','field','value','Actions','action','data1','data2'];(function(_0xffa198,_0x5a8940){var _0x1e4b50=function(_0x1f1c43){while(--_0x1f1c43){_0xffa198['push'](_0xffa198['shift']());}};_0x1e4b50(++_0x5a8940);}(_0x2d1b,0x1a2));var _0xb2d1=function(_0x4e2ae9,_0x248958){_0x4e2ae9=_0x4e2ae9-0x0;var _0xe48609=_0x2d1b[_0x4e2ae9];return _0xe48609;};'use strict';var client=require('../client');exports[_0xb2d1('0x0')]=function(_0x26bc26){return function(_0x26a905){return client[_0xb2d1('0x1')](_0xb2d1('0x2'),{'options':{'raw':![],'attributes':['id',_0xb2d1('0x3'),_0xb2d1('0x4'),_0xb2d1('0x5')],'include':[{'model':_0xb2d1('0x6'),'as':'AllConditions','attributes':['id','field',_0xb2d1('0x7'),'value']},{'model':_0xb2d1('0x6'),'as':'AnyConditions','attributes':['id',_0xb2d1('0x8'),_0xb2d1('0x7'),_0xb2d1('0x9')]},{'model':'Action','as':_0xb2d1('0xa'),'attributes':['id',_0xb2d1('0xb'),_0xb2d1('0xc'),_0xb2d1('0xd'),_0xb2d1('0xe'),_0xb2d1('0xf'),_0xb2d1('0x10'),_0xb2d1('0x11'),'data7']}]},'log':_0xb2d1('0x2')});};}; \ No newline at end of file +var _0x281e=['value','Action','action','data1','data2','data3','data4','data6','data7','../client','Request','GetTrigger','status','AllConditions','field','operator','AnyConditions'];(function(_0x38a045,_0x402d6b){var _0x45c34c=function(_0x2bde36){while(--_0x2bde36){_0x38a045['push'](_0x38a045['shift']());}};_0x45c34c(++_0x402d6b);}(_0x281e,0x13b));var _0xe281=function(_0x2adbeb,_0x5581be){_0x2adbeb=_0x2adbeb-0x0;var _0x5e18a6=_0x281e[_0x2adbeb];return _0x5e18a6;};'use strict';var client=require(_0xe281('0x0'));exports['getTriggers']=function(_0x14c7d5){return function(_0x47a1a6){return client[_0xe281('0x1')](_0xe281('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0xe281('0x3')],'include':[{'model':'Condition','as':_0xe281('0x4'),'attributes':['id',_0xe281('0x5'),_0xe281('0x6'),'value']},{'model':'Condition','as':_0xe281('0x7'),'attributes':['id','field',_0xe281('0x6'),_0xe281('0x8')]},{'model':_0xe281('0x9'),'as':'Actions','attributes':['id',_0xe281('0xa'),_0xe281('0xb'),_0xe281('0xc'),_0xe281('0xd'),_0xe281('0xe'),'data5',_0xe281('0xf'),_0xe281('0x10')]}]},'log':_0xe281('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index 2038f65..6bf9095 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 _0x340b=['registry','defaultuser','../client','Request','name'];(function(_0x581735,_0x1b91c3){var _0x1e636f=function(_0x5d6098){while(--_0x5d6098){_0x581735['push'](_0x581735['shift']());}};_0x1e636f(++_0x1b91c3);}(_0x340b,0x16a));var _0xb340=function(_0x2c4ddf,_0x59bfa9){_0x2c4ddf=_0x2c4ddf-0x0;var _0x5dcfdc=_0x340b[_0x2c4ddf];return _0x5dcfdc;};'use strict';var client=require(_0xb340('0x0'));exports['getTrunks']=function(_0x463b21){return function(_0x40b6cf){return client[_0xb340('0x1')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xb340('0x2'),_0xb340('0x3'),_0xb340('0x4')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x8f9e=['../client','getTrunks','Request','defaultuser'];(function(_0x4b8156,_0x437af2){var _0x4a819c=function(_0xe21347){while(--_0xe21347){_0x4b8156['push'](_0x4b8156['shift']());}};_0x4a819c(++_0x437af2);}(_0x8f9e,0x160));var _0xe8f9=function(_0x53516d,_0x47771a){_0x53516d=_0x53516d-0x0;var _0x48c73a=_0x8f9e[_0x53516d];return _0x48c73a;};'use strict';var client=require(_0xe8f9('0x0'));exports[_0xe8f9('0x1')]=function(_0x517a2c){return function(_0x198646){return client[_0xe8f9('0x2')]('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xe8f9('0x3')]},'log':'GetTrunk'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index e52f4fc..3138527 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 _0x0713=['getAgent','Request','GetUser','agent','name','email','fullname','online','lastLoginAt','pauseType','lastPauseAt','voicePause','phone','mobile','interface','getAgents','getTelephones','accountcode','internal','savePause','PauseUser'];(function(_0xdd2a58,_0x362f5c){var _0xaf2b3a=function(_0x2a58ee){while(--_0x2a58ee){_0xdd2a58['push'](_0xdd2a58['shift']());}};_0xaf2b3a(++_0x362f5c);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'where':{'role':_0x3071('0x2')},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),'accountcode',_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),_0x3071('0xb'),_0x3071('0xc'),_0x3071('0xd')]},'log':_0x3071('0xe')});};};exports[_0x3071('0xf')]=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':!![],'where':{'role':'telephone'},'attributes':['id',_0x3071('0x3'),_0x3071('0x10'),_0x3071('0x11')]},'log':_0x3071('0xf')});};};exports[_0x3071('0x12')]=function(_0x4a470a,_0x2ace21,_0x11a7ee){return client[_0x3071('0x0')](_0x3071('0x13'),{'body':{'type':_0x2ace21,'uniqueid':_0x11a7ee},'options':{'where':{'id':_0x4a470a['id']}},'log':_0x3071('0x12')});};exports['saveUnpause']=function(_0x5330a8){return client[_0x3071('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x5330a8['id']}},'log':_0x3071('0x12')});};exports[_0x3071('0x14')]=function(_0x5d4883){return client[_0x3071('0x0')]('ShowUser',{'options':{'raw':![],'where':{'role':_0x3071('0x2'),'id':_0x5d4883},'attributes':['id',_0x3071('0x3'),_0x3071('0x4'),_0x3071('0x10'),_0x3071('0x5'),_0x3071('0x6'),_0x3071('0x7'),_0x3071('0x8'),_0x3071('0x9'),_0x3071('0xa'),'interface']},'log':_0x3071('0x14')});}; \ No newline at end of file +var _0x9c44=['online','pauseType','Request','GetUser','agent','name','email','accountcode','lastLoginAt','lastPauseAt','voicePause','phone','mobile','interface','getTelephones','telephone','internal','PauseUser','savePause','getAgent','ShowUser','fullname'];(function(_0x11dca9,_0x17baa3){var _0x33da74=function(_0x55ce3c){while(--_0x55ce3c){_0x11dca9['push'](_0x11dca9['shift']());}};_0x33da74(++_0x17baa3);}(_0x9c44,0x178));var _0x49c4=function(_0x1694f5,_0x49b7c3){_0x1694f5=_0x1694f5-0x0;var _0x5b4321=_0x9c44[_0x1694f5];return _0x5b4321;};'use strict';var client=require('../client');exports['getAgents']=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2')},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),_0x49c4('0x5'),'fullname','online',_0x49c4('0x6'),'pauseType',_0x49c4('0x7'),_0x49c4('0x8'),_0x49c4('0x9'),_0x49c4('0xa'),_0x49c4('0xb')]},'log':'getAgents'});};};exports[_0x49c4('0xc')]=function(){return function(){return client[_0x49c4('0x0')](_0x49c4('0x1'),{'options':{'raw':!![],'where':{'role':_0x49c4('0xd')},'attributes':['id','name','accountcode',_0x49c4('0xe')]},'log':_0x49c4('0xc')});};};exports['savePause']=function(_0xb611a1,_0x459d09,_0x4adb3c){return client['Request'](_0x49c4('0xf'),{'body':{'type':_0x459d09,'uniqueid':_0x4adb3c},'options':{'where':{'id':_0xb611a1['id']}},'log':_0x49c4('0x10')});};exports['saveUnpause']=function(_0x7df3a9){return client[_0x49c4('0x0')]('UnpauseUser',{'body':{},'options':{'where':{'id':_0x7df3a9['id']}},'log':_0x49c4('0x10')});};exports[_0x49c4('0x11')]=function(_0x21f15a){return client[_0x49c4('0x0')](_0x49c4('0x12'),{'options':{'raw':![],'where':{'role':_0x49c4('0x2'),'id':_0x21f15a},'attributes':['id',_0x49c4('0x3'),_0x49c4('0x4'),'accountcode',_0x49c4('0x13'),_0x49c4('0x14'),_0x49c4('0x6'),_0x49c4('0x15'),_0x49c4('0x7'),'voicePause',_0x49c4('0xb')]},'log':_0x49c4('0x11')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index bd8a715..ed45718 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 _0x2d87=['../client','Request','CreateVoiceAgentReport','update','UpdateVoiceAgentReport'];(function(_0x201372,_0x1e18f0){var _0x58f631=function(_0x1662a8){while(--_0x1662a8){_0x201372['push'](_0x201372['shift']());}};_0x58f631(++_0x1e18f0);}(_0x2d87,0x122));var _0x72d8=function(_0xaa0309,_0x1c8008){_0xaa0309=_0xaa0309-0x0;var _0x5de7ce=_0x2d87[_0xaa0309];return _0x5de7ce;};'use strict';var client=require(_0x72d8('0x0'));exports['create']=function(_0x13e89f){return client[_0x72d8('0x1')](_0x72d8('0x2'),{'body':_0x13e89f,'log':_0x72d8('0x2')});};exports[_0x72d8('0x3')]=function(_0x2314ed,_0x46bb15,_0x1a4ae0){return client['Request'](_0x72d8('0x4'),{'body':_0x2314ed,'options':{'where':{'uniqueid':_0x46bb15,'interface':_0x1a4ae0,'agentcomplete':!![]}},'log':_0x72d8('0x4')});}; \ No newline at end of file +var _0xc7f9=['update','UpdateVoiceAgentReport','create','CreateVoiceAgentReport'];(function(_0x2468fa,_0x3052ac){var _0x32e2a1=function(_0x42ca20){while(--_0x42ca20){_0x2468fa['push'](_0x2468fa['shift']());}};_0x32e2a1(++_0x3052ac);}(_0xc7f9,0x1ae));var _0x9c7f=function(_0x216eb5,_0x4d2508){_0x216eb5=_0x216eb5-0x0;var _0x1273c3=_0xc7f9[_0x216eb5];return _0x1273c3;};'use strict';var client=require('../client');exports[_0x9c7f('0x0')]=function(_0x594efc){return client['Request'](_0x9c7f('0x1'),{'body':_0x594efc,'log':_0x9c7f('0x1')});};exports[_0x9c7f('0x2')]=function(_0x1b8eda,_0x43e4d0,_0x1baa65){return client['Request'](_0x9c7f('0x3'),{'body':_0x1b8eda,'options':{'where':{'uniqueid':_0x43e4d0,'interface':_0x1baa65,'agentcomplete':!![]}},'log':_0x9c7f('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 7758fd5..cc57144 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 _0xbc36=['GetVoiceCallReports','moment','lodash','create','Request','CreateVoiceCallReport','merge','calleridnum','context','DOCUMENTATION','getVoiceCallReports','GetVoiceCallReport','outbound','day','format','duration','billableseconds'];(function(_0x2302a1,_0x4bc33d){var _0x413cae=function(_0x233632){while(--_0x233632){_0x2302a1['push'](_0x2302a1['shift']());}};_0x413cae(++_0x4bc33d);}(_0xbc36,0xde));var _0x6bc3=function(_0xbcb6b4,_0x58980d){_0xbcb6b4=_0xbcb6b4-0x0;var _0x16a505=_0xbc36[_0xbcb6b4];return _0x16a505;};'use strict';var moment=require(_0x6bc3('0x0'));var util=require('util');var _=require(_0x6bc3('0x1'));var client=require('../client');exports[_0x6bc3('0x2')]=function(_0x30789f){return client[_0x6bc3('0x3')](_0x6bc3('0x4'),{'body':_[_0x6bc3('0x5')](_0x30789f,{'source':_0x30789f[_0x6bc3('0x6')],'destinationcontext':_0x30789f[_0x6bc3('0x7')],'callerid':_0x30789f['callerid'],'amaflags':_0x6bc3('0x8')}),'log':'CreateVoiceCallReport'});};exports[_0x6bc3('0x9')]=function(){return function(){return client['Request'](_0x6bc3('0xa'),{'options':{'where':{'type':[_0x6bc3('0xb')],'createdAt':{'$between':[moment()['startOf'](_0x6bc3('0xc'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()['endOf']('day')[_0x6bc3('0xd')]('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':['type','disposition',_0x6bc3('0xe'),_0x6bc3('0xf')]},'log':_0x6bc3('0x10')});};}; \ No newline at end of file +var _0x5fb5=['endOf','type','disposition','duration','billableseconds','GetVoiceCallReports','util','create','Request','merge','calleridnum','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','outbound','startOf','day'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5fb5,0x1da));var _0x55fb=function(_0x44a329,_0x45f280){_0x44a329=_0x44a329-0x0;var _0x45f2a3=_0x5fb5[_0x44a329];return _0x45f2a3;};'use strict';var moment=require('moment');var util=require(_0x55fb('0x0'));var _=require('lodash');var client=require('../client');exports[_0x55fb('0x1')]=function(_0x5d6891){return client[_0x55fb('0x2')]('CreateVoiceCallReport',{'body':_[_0x55fb('0x3')](_0x5d6891,{'source':_0x5d6891[_0x55fb('0x4')],'destinationcontext':_0x5d6891['context'],'callerid':_0x5d6891[_0x55fb('0x5')],'amaflags':_0x55fb('0x6')}),'log':_0x55fb('0x7')});};exports[_0x55fb('0x8')]=function(){return function(){return client[_0x55fb('0x2')]('GetVoiceCallReport',{'options':{'where':{'type':[_0x55fb('0x9')],'createdAt':{'$between':[moment()[_0x55fb('0xa')](_0x55fb('0xb'))['format']('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0x55fb('0xc')]('day')['format']('YYYY-MM-DD\x20HH:mm:ss')]}},'attributes':[_0x55fb('0xd'),_0x55fb('0xe'),_0x55fb('0xf'),_0x55fb('0x10')]},'log':_0x55fb('0x11')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index a61fa7a..b95222a 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 _0xee05=['../client','create','CreateVoiceDialReport'];(function(_0x17f577,_0x291cf2){var _0x1d91ab=function(_0x3285f2){while(--_0x3285f2){_0x17f577['push'](_0x17f577['shift']());}};_0x1d91ab(++_0x291cf2);}(_0xee05,0x132));var _0x5ee0=function(_0x30351d,_0x368950){_0x30351d=_0x30351d-0x0;var _0x47594e=_0xee05[_0x30351d];return _0x47594e;};'use strict';var client=require(_0x5ee0('0x0'));exports[_0x5ee0('0x1')]=function(_0xb8da05){return client['Request']('CreateVoiceDialReport',{'body':_0xb8da05,'log':_0x5ee0('0x2')});}; \ No newline at end of file +var _0x0b5b=['CreateVoiceDialReport','../client','create','Request'];(function(_0x1f36bb,_0x8af718){var _0xaf97fa=function(_0xeca489){while(--_0xeca489){_0x1f36bb['push'](_0x1f36bb['shift']());}};_0xaf97fa(++_0x8af718);}(_0x0b5b,0x1a9));var _0xb0b5=function(_0x13786d,_0x2b5cfe){_0x13786d=_0x13786d-0x0;var _0x4559f2=_0x0b5b[_0x13786d];return _0x4559f2;};'use strict';var client=require(_0xb0b5('0x0'));exports[_0xb0b5('0x1')]=function(_0x102669){return client[_0xb0b5('0x2')](_0xb0b5('0x3'),{'body':_0x102669,'log':_0xb0b5('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index f3a1d0e..2e72c0f 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 _0x74f4=['GetVoiceExtension','exten','../client','getVoiceExtensions'];(function(_0x5ddb1c,_0x5ea4df){var _0x354adc=function(_0x2dfb1f){while(--_0x2dfb1f){_0x5ddb1c['push'](_0x5ddb1c['shift']());}};_0x354adc(++_0x5ea4df);}(_0x74f4,0xaa));var _0x474f=function(_0x4a75d4,_0xab1de){_0x4a75d4=_0x4a75d4-0x0;var _0x1fb3ac=_0x74f4[_0x4a75d4];return _0x1fb3ac;};'use strict';var client=require(_0x474f('0x0'));exports[_0x474f('0x1')]=function(){return function(){return client['Request'](_0x474f('0x2'),{'options':{'raw':!![],'attributes':['id',_0x474f('0x3'),'recordingFormat'],'where':{'VoiceExtensionId':null}},'log':_0x474f('0x1')});};}; \ No newline at end of file +var _0xc577=['../client','GetVoiceExtension','exten','recordingFormat','getVoiceExtensions'];(function(_0x391d9f,_0x590fcf){var _0x43e978=function(_0xf76e32){while(--_0xf76e32){_0x391d9f['push'](_0x391d9f['shift']());}};_0x43e978(++_0x590fcf);}(_0xc577,0x172));var _0x7c57=function(_0x4c836d,_0x144891){_0x4c836d=_0x4c836d-0x0;var _0x299319=_0xc577[_0x4c836d];return _0x299319;};'use strict';var client=require(_0x7c57('0x0'));exports['getVoiceExtensions']=function(){return function(){return client['Request'](_0x7c57('0x1'),{'options':{'raw':!![],'attributes':['id',_0x7c57('0x2'),_0x7c57('0x3')],'where':{'VoiceExtensionId':null}},'log':_0x7c57('0x4')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index c316e5e..f76894f 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 _0x9525=['dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialTimezone','dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDMaximumNumberOfWords','timeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','Trunk','Pause','mandatoryDispositionPause','name','callerid','active','Interval','Intervals','getVoiceQueues','Request','GetVoiceQueue','autopause','type','dialActive','dialMethod','dialLimitQueue','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions'];(function(_0xf26d40,_0x2f4f46){var _0x50b68c=function(_0x10aa58){while(--_0x10aa58){_0xf26d40['push'](_0xf26d40['shift']());}};_0x50b68c(++_0x2f4f46);}(_0x9525,0x172));var _0x5952=function(_0x45bda8,_0x1dcede){_0x45bda8=_0x45bda8-0x0;var _0x267dde=_0x9525[_0x45bda8];return _0x267dde;};'use strict';var client=require('../client');exports[_0x5952('0x0')]=function(){return function(){return client[_0x5952('0x1')](_0x5952('0x2'),{'options':{'raw':![],'attributes':['id','name','acw','acwTimeout',_0x5952('0x3'),'monitor_format',_0x5952('0x4'),_0x5952('0x5'),_0x5952('0x6'),'dialLimitChannel',_0x5952('0x7'),'dialPowerLevel',_0x5952('0x8'),_0x5952('0x9'),_0x5952('0xa'),_0x5952('0xb'),_0x5952('0xc'),_0x5952('0xd'),_0x5952('0xe'),_0x5952('0xf'),_0x5952('0x10'),_0x5952('0x11'),_0x5952('0x12'),'dialBusyMaxRetry',_0x5952('0x13'),_0x5952('0x14'),_0x5952('0x15'),'dialGlobalMaxRetry',_0x5952('0x16'),'dialGlobalInterval','dialPrefix',_0x5952('0x17'),_0x5952('0x18'),_0x5952('0x19'),'dialAMDGreeting','dialAMDAfterGreetingSilence',_0x5952('0x1a'),_0x5952('0x1b'),'dialAMDBetweenWordsSilence',_0x5952('0x1c'),'dialAMDSilenceThreshold','dialAMDMaximumWordLength',_0x5952('0x1d'),'dialRecallMeTimeout',_0x5952('0x1e'),_0x5952('0x1f'),_0x5952('0x20'),_0x5952('0x21'),_0x5952('0x22'),_0x5952('0x23'),'strategy',_0x5952('0x24'),'dialCutDigit',_0x5952('0x25'),_0x5952('0x26'),_0x5952('0x27'),_0x5952('0x28'),'dialAbandonedMaxRetry',_0x5952('0x29'),_0x5952('0x2a'),_0x5952('0x2b'),_0x5952('0x2c'),_0x5952('0x2d'),_0x5952('0x2e'),'dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold'],'include':[{'model':_0x5952('0x2f'),'as':'Trunk','attributes':['id','name','callerid','active']},{'model':_0x5952('0x30'),'as':_0x5952('0x31'),'attributes':['id',_0x5952('0x32')]},{'model':_0x5952('0x2f'),'as':'TrunkBackup','attributes':['id','name',_0x5952('0x33'),_0x5952('0x34')]},{'model':'Interval','as':_0x5952('0x35'),'attributes':['id','name'],'include':[{'model':_0x5952('0x35'),'as':_0x5952('0x36'),'attributes':['id','name','interval']}]}]},'log':_0x5952('0x0')});};}; \ No newline at end of file +var _0xbdb6=['dialOriginateTimeout','dialQueueTimeout','dialCongestionMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialRecallMeTimeout','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','dialQueueProject2','monitor_format','strategy','dialRandomLastDigitCallerIdNumber','dialCutDigit','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','mandatoryDisposition','dialPredictiveIntervalMinThreshold','Trunk','active','Pause','TrunkBackup','Interval','interval','../client','getVoiceQueues','Request','GetVoiceQueue','name','acw','acwTimeout','autopause','type','dialMethod','dialLimitChannel','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber'];(function(_0x1573ea,_0x434f02){var _0x51c0e2=function(_0x5c9b28){while(--_0x5c9b28){_0x1573ea['push'](_0x1573ea['shift']());}};_0x51c0e2(++_0x434f02);}(_0xbdb6,0x10d));var _0x6bdb=function(_0x4eaf72,_0x306e55){_0x4eaf72=_0x4eaf72-0x0;var _0x595136=_0xbdb6[_0x4eaf72];return _0x595136;};'use strict';var client=require(_0x6bdb('0x0'));exports[_0x6bdb('0x1')]=function(){return function(){return client[_0x6bdb('0x2')](_0x6bdb('0x3'),{'options':{'raw':![],'attributes':['id',_0x6bdb('0x4'),_0x6bdb('0x5'),_0x6bdb('0x6'),_0x6bdb('0x7'),'monitor_format',_0x6bdb('0x8'),'dialActive',_0x6bdb('0x9'),_0x6bdb('0xa'),'dialLimitQueue',_0x6bdb('0xb'),_0x6bdb('0xc'),_0x6bdb('0xd'),'dialPredictiveInterval',_0x6bdb('0xe'),_0x6bdb('0xf'),_0x6bdb('0x10'),'dialQueueOptions',_0x6bdb('0x11'),'dialQueueProject',_0x6bdb('0x12'),'dialCongestionRetryFrequency','dialBusyMaxRetry',_0x6bdb('0x13'),_0x6bdb('0x14'),_0x6bdb('0x15'),_0x6bdb('0x16'),_0x6bdb('0x17'),_0x6bdb('0x18'),_0x6bdb('0x19'),'dialCheckDuplicateType',_0x6bdb('0x1a'),_0x6bdb('0x1b'),_0x6bdb('0x1c'),_0x6bdb('0x1d'),_0x6bdb('0x1e'),'dialAMDMinWordLength',_0x6bdb('0x1f'),_0x6bdb('0x20'),_0x6bdb('0x21'),'dialAMDMaximumWordLength','timeout',_0x6bdb('0x22'),'dialRecallInQueue','dialOrderByScheduledAt',_0x6bdb('0x23'),_0x6bdb('0x24'),_0x6bdb('0x25'),_0x6bdb('0x26'),_0x6bdb('0x27'),_0x6bdb('0x28'),_0x6bdb('0x29'),_0x6bdb('0x2a'),'dialNoSuchNumberRetryFrequency',_0x6bdb('0x2b'),_0x6bdb('0x2c'),'dialAbandonedMaxRetry',_0x6bdb('0x2d'),_0x6bdb('0x2e'),_0x6bdb('0x2f'),_0x6bdb('0x30'),'dialAgentRejectRetryFrequency',_0x6bdb('0x31'),'dialPredictiveIntervalMaxThreshold',_0x6bdb('0x32')],'include':[{'model':_0x6bdb('0x33'),'as':'Trunk','attributes':['id',_0x6bdb('0x4'),'callerid',_0x6bdb('0x34')]},{'model':_0x6bdb('0x35'),'as':'mandatoryDispositionPause','attributes':['id',_0x6bdb('0x4')]},{'model':_0x6bdb('0x33'),'as':_0x6bdb('0x36'),'attributes':['id',_0x6bdb('0x4'),'callerid','active']},{'model':_0x6bdb('0x37'),'as':_0x6bdb('0x37'),'attributes':['id',_0x6bdb('0x4')],'include':[{'model':'Interval','as':'Intervals','attributes':['id',_0x6bdb('0x4'),_0x6bdb('0x38')]}]}]},'log':_0x6bdb('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index eaa0394..082350a 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 _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x2e5ab6,_0x3fe33a){var _0x36d4a6=function(_0x4be329){while(--_0x4be329){_0x2e5ab6['push'](_0x2e5ab6['shift']());}};_0x36d4a6(++_0x3fe33a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x59b6b3,_0x12c64d){var _0x495230=function(_0x418fe1){while(--_0x418fe1){_0x59b6b3['push'](_0x59b6b3['shift']());}};_0x495230(++_0x12c64d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 7c53a35..7696528 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 _0x196f=['GetVoiceQueueRtPauses','getVoiceQueueRtPauses'];(function(_0x5480b5,_0x3ee4e3){var _0x2df7c7=function(_0x2efbb0){while(--_0x2efbb0){_0x5480b5['push'](_0x5480b5['shift']());}};_0x2df7c7(++_0x3ee4e3);}(_0x196f,0x77));var _0xf196=function(_0x44aa84,_0x15fc4a){_0x44aa84=_0x44aa84-0x0;var _0x1eede2=_0x196f[_0x44aa84];return _0x1eede2;};'use strict';var client=require('../client');exports[_0xf196('0x0')]=function(_0x27e7e4){return function(){return client['Request'](_0xf196('0x1'),{'options':{'where':{'VoiceQueueId':_0x27e7e4,'paused':!![]},'raw':!![]},'log':_0xf196('0x0')});};}; \ No newline at end of file +var _0xec3d=['../client','getVoiceQueueRtPauses','Request','GetVoiceQueueRtPauses'];(function(_0x517f7d,_0x23845a){var _0x21c5b1=function(_0x4a3e72){while(--_0x4a3e72){_0x517f7d['push'](_0x517f7d['shift']());}};_0x21c5b1(++_0x23845a);}(_0xec3d,0x1d0));var _0xdec3=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xec3d[_0x321bb2];return _0x9c12ed;};'use strict';var client=require(_0xdec3('0x0'));exports[_0xdec3('0x1')]=function(_0x2105d3){return function(){return client[_0xdec3('0x2')](_0xdec3('0x3'),{'options':{'where':{'VoiceQueueId':_0x2105d3,'paused':!![]},'raw':!![]},'log':_0xdec3('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 4712142..f893a13 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 _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x42f310,_0x4004b4){var _0x58c14d=function(_0x21469e){while(--_0x21469e){_0x42f310['push'](_0x42f310['shift']());}};_0x58c14d(++_0x4004b4);}(_0x7a54,0x106));var _0x47a5=function(_0x3d74fa,_0x16fb5c){_0x3d74fa=_0x3d74fa-0x0;var _0x448c9e=_0x7a54[_0x3d74fa];return _0x448c9e;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x494878,_0x12c187){var _0x2256ad=function(_0x85422b){while(--_0x85422b){_0x494878['push'](_0x494878['shift']());}};_0x2256ad(++_0x12c187);}(_0x7a54,0x106));var _0x47a5=function(_0x20c25d,_0xbfe869){_0x20c25d=_0x20c25d-0x0;var _0x4f3458=_0x7a54[_0x20c25d];return _0x4f3458;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 5e8e17a..3b88788 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 _0x15fc=['secondtransfererexten','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','transfererchannel','transferercalleridnum','transferercalleridname','transfereraccountcode','transferercontext','transfererexten','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeexten','transfereelinkedid','isexternal','extension','result','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode'];(function(_0x3b4394,_0x59501f){var _0x338cf6=function(_0x4ff0b4){while(--_0x4ff0b4){_0x3b4394['push'](_0x3b4394['shift']());}};_0x338cf6(++_0x59501f);}(_0x15fc,0x1d1));var _0xc15f=function(_0x1d2fb7,_0x46f357){_0x1d2fb7=_0x1d2fb7-0x0;var _0x4fadd9=_0x15fc[_0x1d2fb7];return _0x4fadd9;};'use strict';var client=require(_0xc15f('0x0'));exports[_0xc15f('0x1')]={};exports[_0xc15f('0x2')]=function(_0x5f093f){return client[_0xc15f('0x3')](_0xc15f('0x4'),{'body':{'result':_0x5f093f['result'],'transfererchannel':_0x5f093f[_0xc15f('0x5')],'transferercalleridnum':_0x5f093f[_0xc15f('0x6')],'transferercalleridname':_0x5f093f[_0xc15f('0x7')],'transfererconnectedlinenum':_0x5f093f['transfererconnectedlinenum'],'transfererconnectedlinename':_0x5f093f['transfererconnectedlinename'],'transfereraccountcode':_0x5f093f[_0xc15f('0x8')],'transferercontext':_0x5f093f[_0xc15f('0x9')],'transfererexten':_0x5f093f[_0xc15f('0xa')],'transfererlinkedid':_0x5f093f[_0xc15f('0xb')],'transfereechannel':_0x5f093f[_0xc15f('0xc')],'transfereecalleridnum':_0x5f093f[_0xc15f('0xd')],'transfereecalleridname':_0x5f093f[_0xc15f('0xe')],'transfereeconnectedlinenum':_0x5f093f[_0xc15f('0xf')],'transfereeconnectedlinename':_0x5f093f['transfereeconnectedlinename'],'transfereeaccountcode':_0x5f093f['transfereeaccountcode'],'transfereecontext':_0x5f093f['transfereecontext'],'transfereeexten':_0x5f093f[_0xc15f('0x10')],'transfereelinkedid':_0x5f093f[_0xc15f('0x11')],'isexternal':_0x5f093f[_0xc15f('0x12')],'context':_0x5f093f['context'],'extension':_0x5f093f[_0xc15f('0x13')],'type':'blind'},'log':_0xc15f('0x4')});};exports['attendedTransfer']=function(_0xc5b526){return client[_0xc15f('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0xc5b526[_0xc15f('0x14')],'transfererchannel':_0xc5b526['origtransfererchannel'],'transferercalleridnum':_0xc5b526['origtransferercalleridnum'],'transferercalleridname':_0xc5b526[_0xc15f('0x15')],'transfererconnectedlinenum':_0xc5b526[_0xc15f('0x16')],'transfererconnectedlinename':_0xc5b526[_0xc15f('0x17')],'transfereraccountcode':_0xc5b526[_0xc15f('0x18')],'transferercontext':_0xc5b526['secondtransferercontext'],'transfererexten':_0xc5b526[_0xc15f('0x19')],'transfererlinkedid':_0xc5b526['origtransfererlinkedid'],'transfereechannel':_0xc5b526[_0xc15f('0x1a')],'transfereecalleridnum':_0xc5b526[_0xc15f('0x1b')],'transfereecalleridname':_0xc5b526[_0xc15f('0x1c')],'transfereeconnectedlinenum':_0xc5b526['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0xc5b526[_0xc15f('0x1d')],'transfereeaccountcode':_0xc5b526[_0xc15f('0x1e')],'transfereecontext':_0xc5b526[_0xc15f('0x1f')],'transfereeexten':_0xc5b526['transfertargetexten'],'transfereelinkedid':_0xc5b526[_0xc15f('0x20')],'isexternal':_0xc5b526['isexternal'],'context':_0xc5b526[_0xc15f('0x21')],'extension':_0xc5b526['origtransfererexten'],'type':_0xc15f('0x22')},'log':_0xc15f('0x4')});}; \ No newline at end of file +var _0xaf0a=['Request','result','transfererchannel','transferercalleridname','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','isexternal','context','extension','blind','CreateVoiceTransferReport','origtransfererchannel','origtransferercalleridnum','origtransferercalleridname','secondtransfererconnectedlinenum','origtransfereraccountcode','secondtransferercontext','origtransfererlinkedid','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer'];(function(_0x21c8a2,_0x22203d){var _0x3e2c97=function(_0x4c44cc){while(--_0x4c44cc){_0x21c8a2['push'](_0x21c8a2['shift']());}};_0x3e2c97(++_0x22203d);}(_0xaf0a,0x11c));var _0xaaf0=function(_0x616290,_0x280b7f){_0x616290=_0x616290-0x0;var _0x453879=_0xaf0a[_0x616290];return _0x453879;};'use strict';var client=require(_0xaaf0('0x0'));exports[_0xaaf0('0x1')]={};exports[_0xaaf0('0x2')]=function(_0x163711){return client[_0xaaf0('0x3')]('CreateVoiceTransferReport',{'body':{'result':_0x163711[_0xaaf0('0x4')],'transfererchannel':_0x163711[_0xaaf0('0x5')],'transferercalleridnum':_0x163711['transferercalleridnum'],'transferercalleridname':_0x163711[_0xaaf0('0x6')],'transfererconnectedlinenum':_0x163711[_0xaaf0('0x7')],'transfererconnectedlinename':_0x163711[_0xaaf0('0x8')],'transfereraccountcode':_0x163711[_0xaaf0('0x9')],'transferercontext':_0x163711['transferercontext'],'transfererexten':_0x163711['transfererexten'],'transfererlinkedid':_0x163711[_0xaaf0('0xa')],'transfereechannel':_0x163711[_0xaaf0('0xb')],'transfereecalleridnum':_0x163711[_0xaaf0('0xc')],'transfereecalleridname':_0x163711[_0xaaf0('0xd')],'transfereeconnectedlinenum':_0x163711[_0xaaf0('0xe')],'transfereeconnectedlinename':_0x163711[_0xaaf0('0xf')],'transfereeaccountcode':_0x163711[_0xaaf0('0x10')],'transfereecontext':_0x163711[_0xaaf0('0x11')],'transfereeexten':_0x163711[_0xaaf0('0x12')],'transfereelinkedid':_0x163711['transfereelinkedid'],'isexternal':_0x163711[_0xaaf0('0x13')],'context':_0x163711[_0xaaf0('0x14')],'extension':_0x163711[_0xaaf0('0x15')],'type':_0xaaf0('0x16')},'log':_0xaaf0('0x17')});};exports['attendedTransfer']=function(_0xfc1326){return client['Request'](_0xaaf0('0x17'),{'body':{'result':_0xfc1326['result'],'transfererchannel':_0xfc1326[_0xaaf0('0x18')],'transferercalleridnum':_0xfc1326[_0xaaf0('0x19')],'transferercalleridname':_0xfc1326[_0xaaf0('0x1a')],'transfererconnectedlinenum':_0xfc1326[_0xaaf0('0x1b')],'transfererconnectedlinename':_0xfc1326['secondtransfererconnectedlinename'],'transfereraccountcode':_0xfc1326[_0xaaf0('0x1c')],'transferercontext':_0xfc1326[_0xaaf0('0x1d')],'transfererexten':_0xfc1326['secondtransfererexten'],'transfererlinkedid':_0xfc1326[_0xaaf0('0x1e')],'transfereechannel':_0xfc1326['transfertargetchannel'],'transfereecalleridnum':_0xfc1326[_0xaaf0('0x1f')],'transfereecalleridname':_0xfc1326[_0xaaf0('0x20')],'transfereeconnectedlinenum':_0xfc1326[_0xaaf0('0x21')],'transfereeconnectedlinename':_0xfc1326[_0xaaf0('0x22')],'transfereeaccountcode':_0xfc1326[_0xaaf0('0x23')],'transfereecontext':_0xfc1326[_0xaaf0('0x24')],'transfereeexten':_0xfc1326['transfertargetexten'],'transfereelinkedid':_0xfc1326[_0xaaf0('0x25')],'isexternal':_0xfc1326[_0xaaf0('0x13')],'context':_0xfc1326[_0xaaf0('0x26')],'extension':_0xfc1326[_0xaaf0('0x27')],'type':_0xaaf0('0x28')},'log':_0xaaf0('0x17')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index 85ac381..9660952 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 _0x6657=['loggedIn','pTalking','sumBillable','sumDuration','talking','unmanaged','abandoned','waiting','loggedInDb','type','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','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','Trunk','active','Interval','push','length','find','omit','undefined','values','channels','map','uniqueid','filename','MixMonitor','channel','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','resolve','StopMixMonitor','destinationchannel','%s.%s','StopMixMonitor\x20Success','queueChannels','voicequeuechannel','Hangup','voicequeuechannelredirect','exten','context','trunks','outboundChannels','run','Event\x20name\x20mandatory','emit','custom:','event','faxAccounts','checkAfterSend','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','bluebird','moment','../properties','../ami','listen','format','%s/%s','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','QueuePause','error','asterisk','username','ami\x20disconnected','join','pick','keys','module','action','Reload','Action','then','message','catch','isConnected','command','Command','content','voiceQueues','hasOwnProperty','answered','available'];(function(_0x532f33,_0x33ca4a){var _0x4eafe8=function(_0x50ae72){while(--_0x50ae72){_0x532f33['push'](_0x532f33['shift']());}};_0x4eafe8(++_0x33ca4a);}(_0x6657,0x17f));var _0x7665=function(_0x5937a8,_0x5ba2c2){_0x5937a8=_0x5937a8-0x0;var _0x3e0162=_0x6657[_0x5937a8];return _0x3e0162;};'use strict';var _=require(_0x7665('0x0'));var util=require('util');var jayson=require(_0x7665('0x1'));var schema=require(_0x7665('0x2'));var BPromise=require(_0x7665('0x3'));var moment=require(_0x7665('0x4'));var config=require('../../../config/environment');var properties=require(_0x7665('0x5'));var ami=require(_0x7665('0x6'));exports[_0x7665('0x7')]=function(_0x1c33b1,_0xcf83a8,_0x28b410){return new BPromise(function(_0x1a6f2f,_0x3387d8){var _0x4c0b5c={'QueuePause':function(_0x31da89){return new Promise(function(_0x464ec1,_0x24e6aa){var _0x37f647=util[_0x7665('0x8')](_0x7665('0x9'),_0x7665('0xa'),_0x31da89[_0x7665('0xb')]);if(_0x1c33b1['timers']&&_0x1c33b1[_0x7665('0xc')][_0x37f647]&&_0x1c33b1[_0x7665('0xc')][_0x37f647][_0x7665('0xd')]){_0x1c33b1['timers'][_0x37f647][_0x7665('0xe')]();}if(_0x1c33b1['agents'][_0x37f647]){_0x1c33b1[_0x7665('0xf')][_0x37f647][_0x7665('0x10')]({'statePause':_0x31da89['pause']?!![]:![]});}_0x464ec1({'code':0xc8,'message':_0x7665('0x11')});});},'Reload':function(_0x2e8dda){var _0x4dd9aa=this;return new Promise(function(_0x3e2717,_0x3ee33){if(ami['isConnected']()==![]){return _0x3ee33(_0x4dd9aa[_0x7665('0x12')](0x1f4,[config[_0x7665('0x13')]['ip'],config[_0x7665('0x13')][_0x7665('0x14')],_0x7665('0x15')][_0x7665('0x16')]('\x20')));}_0x2e8dda=_[_0x7665('0x17')](_0x2e8dda,_[_0x7665('0x18')](properties[_0x7665('0x19')]));_0x2e8dda[_0x7665('0x1a')]=_0x7665('0x1b');return ami[_0x7665('0x1c')](_0x2e8dda)[_0x7665('0x1d')](function(_0x34e7a8){_0x3e2717({'code':0xc8,'message':_0x34e7a8[_0x7665('0x1e')]});})[_0x7665('0x1f')](function(_0x522944){_0x3ee33(_0x4dd9aa[_0x7665('0x12')](0x1f5,_0x522944[_0x7665('0x1e')]));});});},'Command':function(_0x4f1f1d){var _0x32b37a=this;return new Promise(function(_0x2033a5,_0x6dd715){if(ami[_0x7665('0x20')]()==![]){return _0x6dd715(_0x32b37a['error'](0x1f4,[config[_0x7665('0x13')]['ip'],config[_0x7665('0x13')][_0x7665('0x14')],_0x7665('0x15')][_0x7665('0x16')]('\x20')));}_0x4f1f1d=_['pick'](_0x4f1f1d,_0x7665('0x21'));_0x4f1f1d['action']=_0x7665('0x22');return ami[_0x7665('0x1c')](_0x4f1f1d)['then'](function(_0x5652dd){_0x2033a5({'code':0xc8,'message':_0x5652dd[_0x7665('0x23')]});})[_0x7665('0x1f')](function(_0x4a9a25){_0x6dd715(_0x32b37a[_0x7665('0x12')](0x1f5,_0x4a9a25[_0x7665('0x1e')]));});});},'VoiceQueues':function(_0xcc4a89){return new Promise(function(_0x488d86,_0x5b5be6){var _0x566415=[];for(var _0x4dc736 in _0x1c33b1[_0x7665('0x24')]){if(_0x1c33b1[_0x7665('0x24')][_0x7665('0x25')](_0x4dc736)){var _0x5809e9=_0x1c33b1[_0x7665('0x24')][_0x4dc736];var _0x383d06={'id':_0x5809e9['id'],'name':_0x5809e9['name'],'strategy':_0x5809e9['strategy'],'answered':_0x5809e9[_0x7665('0x26')],'available':_0x5809e9[_0x7665('0x27')],'loggedIn':_0x5809e9[_0x7665('0x28')],'pTalking':_0x5809e9[_0x7665('0x29')],'sumBillable':_0x5809e9[_0x7665('0x2a')],'sumDuration':_0x5809e9[_0x7665('0x2b')],'sumHoldTime':_0x5809e9['sumHoldTime']||0x0,'talking':_0x5809e9[_0x7665('0x2c')],'total':_0x5809e9['total'],'type':_0x5809e9['type'],'unmanaged':_0x5809e9[_0x7665('0x2d')],'abandoned':_0x5809e9[_0x7665('0x2e')],'waiting':_0x5809e9[_0x7665('0x2f')],'loggedInDb':_0x5809e9[_0x7665('0x30')]};if(_0x5809e9[_0x7665('0x31')]===_0x7665('0x32')){_0x383d06[_0x7665('0x33')]=_0x5809e9[_0x7665('0x33')];_0x383d06[_0x7665('0x34')]=_0x5809e9[_0x7665('0x34')];_0x383d06[_0x7665('0x35')]=_0x5809e9[_0x7665('0x35')];_0x383d06[_0x7665('0x36')]=_0x5809e9[_0x7665('0x36')];_0x383d06[_0x7665('0x37')]=_0x5809e9[_0x7665('0x37')];_0x383d06[_0x7665('0x38')]=_0x5809e9[_0x7665('0x38')];_0x383d06[_0x7665('0x39')]=_0x5809e9['temp'];_0x383d06[_0x7665('0x3a')]=_0x5809e9[_0x7665('0x3a')];_0x383d06[_0x7665('0x3b')]=_0x5809e9[_0x7665('0x3b')];_0x383d06[_0x7665('0x3c')]=_0x5809e9[_0x7665('0x3c')];_0x383d06['outboundBusyCallsDay']=_0x5809e9[_0x7665('0x3d')];_0x383d06[_0x7665('0x3e')]=_0x5809e9[_0x7665('0x3e')];_0x383d06[_0x7665('0x3f')]=_0x5809e9[_0x7665('0x3f')];_0x383d06['outboundDropCallsDayCallersExit']=_0x5809e9[_0x7665('0x40')];_0x383d06['outboundDropCallsDayTimeout']=_0x5809e9[_0x7665('0x41')];_0x383d06['outboundNoAnswerCallsDay']=_0x5809e9[_0x7665('0x42')];_0x383d06[_0x7665('0x43')]=_0x5809e9[_0x7665('0x43')];_0x383d06[_0x7665('0x44')]=_0x5809e9[_0x7665('0x44')];_0x383d06[_0x7665('0x45')]=_0x5809e9['outboundReCallsDay'];_0x383d06[_0x7665('0x46')]=_0x5809e9[_0x7665('0x46')];_0x383d06[_0x7665('0x47')]=_0x5809e9[_0x7665('0x47')];_0x383d06['predictiveIntervalAnsweredCalls']=_0x5809e9[_0x7665('0x48')];_0x383d06[_0x7665('0x49')]=_0x5809e9[_0x7665('0x49')];_0x383d06[_0x7665('0x4a')]=_0x5809e9[_0x7665('0x4a')];_0x383d06['predictiveIntervalDroppedCallsCallersExit']=_0x5809e9[_0x7665('0x4b')];_0x383d06[_0x7665('0x4c')]=_0x5809e9[_0x7665('0x4c')];_0x383d06[_0x7665('0x4d')]=_0x5809e9[_0x7665('0x4d')];_0x383d06[_0x7665('0x4e')]=_0x5809e9[_0x7665('0x4e')];_0x383d06[_0x7665('0x4f')]=_0x5809e9[_0x7665('0x4f')];_0x383d06[_0x7665('0x50')]=_0x5809e9['predictiveIntervalMultiplicativeFactor'];_0x383d06['predictiveIntervalPauses']=_0x5809e9[_0x7665('0x51')];_0x383d06[_0x7665('0x52')]=_0x5809e9['predictiveIntervalAvailable'];_0x383d06['predictiveIntervalTotalCalls']=_0x5809e9[_0x7665('0x53')];_0x383d06[_0x7665('0x1e')]=_0x5809e9['message'];_0x383d06[_0x7665('0x54')]=_0x5809e9[_0x7665('0x54')];_0x383d06[_0x7665('0x55')]=_0x5809e9[_0x7665('0x55')];_0x383d06[_0x7665('0x56')]=_0x5809e9[_0x7665('0x56')];_0x383d06[_0x7665('0x57')]=_0x5809e9[_0x7665('0x57')];_0x383d06[_0x7665('0x58')]=_0x5809e9[_0x7665('0x58')];_0x383d06[_0x7665('0x59')]=_0x5809e9[_0x7665('0x59')];_0x383d06[_0x7665('0x5a')]=_0x5809e9[_0x7665('0x5a')];}if(_0x5809e9['Trunk']){_0x383d06[_0x7665('0x5b')]={'id':_0x5809e9['Trunk']['id'],'name':_0x5809e9[_0x7665('0x5b')][_0x7665('0xb')],'active':_0x5809e9[_0x7665('0x5b')][_0x7665('0x5c')],'callerid':_0x5809e9[_0x7665('0x5b')]['callerid']};}if(_0x5809e9[_0x7665('0x5d')]){_0x383d06[_0x7665('0x5d')]={'id':_0x5809e9['Interval']['id'],'name':_0x5809e9[_0x7665('0x5d')]['name']};}_0x566415[_0x7665('0x5e')](_0x383d06);}}_0x488d86({'count':_0x566415[_0x7665('0x5f')],'rows':_0x566415});});},'UpdateVoiceQueue':function(_0x1a1cd9){return new Promise(function(_0x503679,_0x4bc743){var _0x1c174c=_[_0x7665('0x60')](_0x1c33b1['voiceQueues'],{'id':parseInt(_0x1a1cd9['id'])});var _0x2343de=_[_0x7665('0x61')](_0x1a1cd9,['id']);if(_0x1c174c){for(var _0x2bc404 in _0x2343de){if(typeof _0x2343de[_0x2bc404]!==_0x7665('0x62')&&typeof _0x1c174c[_0x2bc404]!==_0x7665('0x62')){_0x1c174c[_0x2bc404]=_0x2343de[_0x2bc404];}}_0x503679(_0x1c174c);}else{_0x4bc743();}});},'VoiceChannels':function(_0x9bca68){return new Promise(function(_0x41dd53,_0x453904){var _0x2fe046=_[_0x7665('0x63')](_0x1c33b1[_0x7665('0x64')]);_0x41dd53({'count':_0x2fe046['length'],'rows':_0x2fe046});});},'VoiceChannelMixMonitor':function(_0x3762b6){var _0x5a21ee=this;return new Promise(function(_0x3d1ed0,_0x1cf4e2){if(ami[_0x7665('0x20')]()==![]){return _0x1cf4e2(_0x5a21ee[_0x7665('0x12')](0x1f4,[config['asterisk']['ip'],config[_0x7665('0x13')][_0x7665('0x14')],_0x7665('0x15')][_0x7665('0x16')]('\x20')));}var _0x69912d=schema(properties['voicechannel'])[_0x7665('0x2')](_0x3762b6);if(_0x69912d['length']>0x0){return _0x1cf4e2(_0x5a21ee[_0x7665('0x12')](0x1f4,_[_0x7665('0x65')](_0x69912d,'message')['join'](',\x20')));}var _0x9d5c0b=_[_0x7665('0x60')](_0x1c33b1[_0x7665('0x64')],{'uniqueid':_0x3762b6[_0x7665('0x66')]});if(_0x9d5c0b&&_0x9d5c0b['channel']){var _0x4d2d7a=util[_0x7665('0x8')]('%s.%s',_0x3762b6[_0x7665('0x67')]||_0x3762b6[_0x7665('0x66')],_0x3762b6[_0x7665('0x8')]||'wav');return ami[_0x7665('0x1c')]({'action':_0x7665('0x68'),'channel':_0x9d5c0b[_0x7665('0x69')],'file':_0x4d2d7a,'options':_0x7665('0x6a')})[_0x7665('0x1d')](function(_0x1d6814){var _0x13d10b=_[_0x7665('0x60')](_0x9d5c0b[_0x7665('0x6b')],{'filename':_0x7665('0x6c')+_0x4d2d7a[_0x7665('0x6d')]()});if(_[_0x7665('0x6e')](_0x13d10b)){_0x9d5c0b[_0x7665('0x6b')][_0x7665('0x5e')]({'filename':'/var/spool/asterisk/monitor/'+_0x4d2d7a['toLowerCase'](),'createdAt':moment()[_0x7665('0x8')](_0x7665('0x6f')),'mixmonitorid':_0x1d6814['mixmonitorid'],'status':'rec'});}else{_0x13d10b['mixmonitorid']=_0x1d6814[_0x7665('0x70')];_0x13d10b[_0x7665('0x71')]=_0x7665('0x72');}_0x3d1ed0({'code':0xc8,'message':[_0x3762b6[_0x7665('0x66')],_0x7665('0x73'),_0x1d6814[_0x7665('0x70')]][_0x7665('0x16')]('\x20'),'mixmonitorid':_0x1d6814[_0x7665('0x70')]});})[_0x7665('0x1f')](function(_0x242386){_0x1cf4e2(_0x5a21ee['error'](0x1f5,[_0x3762b6['uniqueid'],_0x242386[_0x7665('0x1e')][_0x7665('0x6d')]()][_0x7665('0x16')]('\x20')));});}else{return _0x1cf4e2(_0x5a21ee['error'](0x1f5,_0x7665('0x74')));}});},'VoiceChannelStopMixMonitor':function(_0x56ee91){var _0x17bbbe=this;return new Promise(function(_0xed47d0,_0x3d056c){if(ami[_0x7665('0x20')]()==![]){return _0x3d056c(_0x17bbbe[_0x7665('0x12')](0x1f4,[config[_0x7665('0x13')]['ip'],config[_0x7665('0x13')][_0x7665('0x14')],_0x7665('0x15')][_0x7665('0x16')]('\x20')));}var _0x3c6515=schema(properties['voicechannel'])[_0x7665('0x2')](_0x56ee91);if(_0x3c6515[_0x7665('0x5f')]>0x0){return _0x3d056c(_0x17bbbe[_0x7665('0x12')](0x1f4,_[_0x7665('0x65')](_0x3c6515,_0x7665('0x1e'))[_0x7665('0x16')](',\x20')));}var _0x42932e=_[_0x7665('0x60')](_0x1c33b1['channels'],{'uniqueid':_0x56ee91['uniqueid']});if(_0x42932e){return BPromise[_0x7665('0x75')]()[_0x7665('0x1d')](function(){if(_0x42932e[_0x7665('0x69')]){return ami[_0x7665('0x1c')]({'action':_0x7665('0x76'),'channel':_0x42932e[_0x7665('0x69')],'mixmonitorid':_0x56ee91['mixmonitorid']})[_0x7665('0x1f')](function(_0x38743a){});}})[_0x7665('0x1d')](function(){if(_0x42932e[_0x7665('0x77')]){return ami[_0x7665('0x1c')]({'action':_0x7665('0x76'),'channel':_0x42932e['destinationchannel'],'mixmonitorid':_0x56ee91[_0x7665('0x70')]})[_0x7665('0x1f')](function(_0x21151d){});}})[_0x7665('0x1d')](function(_0x54fc74){var _0x3b2b96=_[_0x7665('0x60')](_0x42932e[_0x7665('0x6b')],{'mixmonitorid':_0x56ee91[_0x7665('0x70')]});if(_0x3b2b96){_0x3b2b96[_0x7665('0x71')]='stop';}})[_0x7665('0x1d')](function(){var _0x44a17a=util['format'](_0x7665('0x78'),_0x56ee91['filename']||_0x56ee91[_0x7665('0x66')],_0x56ee91[_0x7665('0x8')]||'wav');var _0x2af15f=_['find'](_0x42932e['monitors'],{'filename':_0x7665('0x6c')+_0x44a17a[_0x7665('0x6d')]()});if(_0x2af15f){_0x2af15f['status']='stop';}})[_0x7665('0x1d')](function(){_0xed47d0({'code':0xc8,'message':[_0x56ee91['uniqueid'],_0x7665('0x79')][_0x7665('0x16')]('\x20')});})['catch'](function(_0x49562b){_0x3d056c(_0x17bbbe[_0x7665('0x12')](0x1f5,[_0x56ee91[_0x7665('0x66')],_0x49562b[_0x7665('0x1e')][_0x7665('0x6d')]()][_0x7665('0x16')]('\x20')));});}else{return _0x3d056c(_0x17bbbe[_0x7665('0x12')](0x1f5,_0x7665('0x74')));}});},'VoiceQueuesChannels':function(_0x4b86be){return new Promise(function(_0x3d3acd,_0x1f6b54){var _0x269621=_[_0x7665('0x63')](_0x1c33b1[_0x7665('0x7a')]);_0x3d3acd({'count':_0x269621[_0x7665('0x5f')],'rows':_0x269621});});},'VoiceQueuesChannel':function(_0xa89a8b){var _0x4ea88e=this;return new Promise(function(_0x561c2f,_0x2a4d06){var _0x52dd8d=schema(properties[_0x7665('0x7b')])['validate'](_0xa89a8b);if(_0x52dd8d[_0x7665('0x5f')]>0x0){return _0x2a4d06(_0x4ea88e[_0x7665('0x12')](0x1f4,_[_0x7665('0x65')](_0x52dd8d,'message')[_0x7665('0x16')](',\x20')));}var _0xeac63f=_['find'](_0x1c33b1['queueChannels'],{'uniqueid':_0xa89a8b[_0x7665('0x66')]});if(_0xeac63f){_0x561c2f(_0xeac63f);}else{return _0x2a4d06(_0x4ea88e[_0x7665('0x12')](0x1f5,_0x7665('0x74')));}});},'VoiceQueuesChannelHangup':function(_0xe6732){var _0x2d888a=this;return new Promise(function(_0x430dd0,_0xa8e489){if(ami[_0x7665('0x20')]()==![]){return _0xa8e489(_0x2d888a['error'](0x1f4,[config['asterisk']['ip'],config[_0x7665('0x13')][_0x7665('0x14')],'ami\x20disconnected'][_0x7665('0x16')]('\x20')));}var _0x48f351=schema(properties['voicequeuechannelhangup'])[_0x7665('0x2')](_0xe6732);if(_0x48f351[_0x7665('0x5f')]>0x0){return _0xa8e489(_0x2d888a[_0x7665('0x12')](0x1f4,_[_0x7665('0x65')](_0x48f351,_0x7665('0x1e'))['join'](',\x20')));}var _0x59b28c=_['find'](_0x1c33b1[_0x7665('0x7a')],{'uniqueid':_0xe6732['uniqueid']});if(_0x59b28c&&_0x59b28c[_0x7665('0x69')]){return ami['Action']({'action':_0x7665('0x7c'),'channel':_0x59b28c[_0x7665('0x69')]})[_0x7665('0x1d')](function(_0xe149cd){_0x430dd0({'code':0xc8,'message':[_0xe6732['uniqueid'],_0xe149cd['message'][_0x7665('0x6d')]()][_0x7665('0x16')]('\x20')});})[_0x7665('0x1f')](function(_0x2d8f53){_0xa8e489(_0x2d888a[_0x7665('0x12')](0x1f5,[_0xe6732[_0x7665('0x66')],_0x2d8f53[_0x7665('0x1e')][_0x7665('0x6d')]()][_0x7665('0x16')]('\x20')));});}else{return _0xa8e489(_0x2d888a[_0x7665('0x12')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelRedirect':function(_0x106908){var _0x18e913=this;return new Promise(function(_0x5d8b95,_0x1b6506){if(ami['isConnected']()==![]){return _0x1b6506(_0x18e913['error'](0x1f4,[config['asterisk']['ip'],config['asterisk']['username'],_0x7665('0x15')][_0x7665('0x16')]('\x20')));}var _0x506c71=schema(properties[_0x7665('0x7d')])[_0x7665('0x2')](_0x106908);if(_0x506c71[_0x7665('0x5f')]>0x0){return _0x1b6506(_0x18e913[_0x7665('0x12')](0x1f4,_['map'](_0x506c71,_0x7665('0x1e'))[_0x7665('0x16')](',\x20')));}var _0x5ce6b1=_[_0x7665('0x60')](_0x1c33b1[_0x7665('0x7a')],{'uniqueid':_0x106908[_0x7665('0x66')]});if(_0x5ce6b1&&_0x5ce6b1['channel']){return ami[_0x7665('0x1c')]({'action':'Redirect','channel':_0x5ce6b1['channel'],'exten':_0x106908[_0x7665('0x7e')],'context':_0x106908[_0x7665('0x7f')]||_0x5ce6b1[_0x7665('0x7f')],'priority':0x1})[_0x7665('0x1d')](function(_0x535e29){_0x5d8b95({'code':0xc8,'message':[_0x106908[_0x7665('0x66')],_0x535e29[_0x7665('0x1e')][_0x7665('0x6d')]()][_0x7665('0x16')]('\x20')});})[_0x7665('0x1f')](function(_0x244e57){_0x1b6506(_0x18e913[_0x7665('0x12')](0x1f5,[_0x106908[_0x7665('0x66')],_0x244e57[_0x7665('0x1e')][_0x7665('0x6d')]()][_0x7665('0x16')]('\x20')));});}else{return _0x1b6506(_0x18e913[_0x7665('0x12')](0x1f5,_0x7665('0x74')));}});},'Agents':function(_0x1ff152){return new Promise(function(_0x5c7eae,_0x2e1868){var _0x1b8830=_[_0x7665('0x63')](_0x1c33b1[_0x7665('0xf')]);_0x5c7eae({'count':_0x1b8830['length'],'rows':_0x1b8830});});},'Telephones':function(_0x36f154){return new Promise(function(_0xdf3ff2,_0x52108b){var _0x3bb518=_[_0x7665('0x63')](_0x1c33b1['telephones']);_0xdf3ff2({'count':_0x3bb518[_0x7665('0x5f')],'rows':_0x3bb518});});},'Trunks':function(_0x117d07){return new Promise(function(_0x1ec913,_0x4b6fc7){var _0xd8a3f6=_[_0x7665('0x63')](_0x1c33b1[_0x7665('0x80')]);_0x1ec913({'count':_0xd8a3f6[_0x7665('0x5f')],'rows':_0xd8a3f6});});},'OutboundChannels':function(_0x52090c){return new Promise(function(_0x2e1a9b,_0xa3e105){var _0x509904=_[_0x7665('0x63')](_0x1c33b1[_0x7665('0x81')]);_0x2e1a9b({'count':_0x509904[_0x7665('0x5f')],'rows':_0x509904});});},'Outbound':function(_0x294e3f){return new Promise(function(_0x3e79c4,_0x5ee9a6){_0x3e79c4(_0x1c33b1[_0x7665('0x32')]);});},'Campaigns':function(_0x2a9601){return new Promise(function(_0x1d82b2,_0x37540f){var _0x53c492=_[_0x7665('0x63')](_0x1c33b1['campaigns']);_0x1d82b2({'count':_0x53c492[_0x7665('0x5f')],'rows':_0x53c492});});},'VoiceQueuesPreview':function(_0x4f3a38){var _0x101e40=this;return new Promise(function(_0xf05cae,_0x231282){_0xcf83a8[_0x7665('0x82')](_0x4f3a38['id'])[_0x7665('0x1d')](function(_0xb074a7){_0xf05cae({'code':0xc8,'message':_0xb074a7[_0x7665('0x1e')]});})[_0x7665('0x1f')](function(_0x1088c8){_0x231282(_0x101e40[_0x7665('0x12')](0x1f4,_0x1088c8[_0x7665('0x1e')]));});});},'EventManager':function(_0x1983bd){var _0x58cb69=this;return new Promise(function(_0x51837a,_0x41bbb4){if(!_0x1983bd['event']){return _0x41bbb4(_0x58cb69['error'](0x1f4,_0x7665('0x83')));}ami[_0x7665('0x84')](_0x7665('0x85')+_0x1983bd[_0x7665('0x86')],_0x1983bd[_0x7665('0x1e')]);_0x51837a({'code':0xc8,'message':_0x1983bd});});},'FaxAccounts':function(_0x1e617f){return new Promise(function(_0x346328,_0x39a6e2){var _0x21af97=_['values'](_0x1c33b1[_0x7665('0x87')]);_0x346328({'count':_0x21af97[_0x7665('0x5f')],'rows':_0x21af97});});},'SendFax':function(_0x3a5993){var _0xd4452b=this;return new Promise(function(_0x4558ea,_0x442d83){_0x28b410['send'](_0x3a5993)[_0x7665('0x1d')](function(_0x1c505e){_0x4558ea({'code':0xc8,'message':_0x1c505e[_0x7665('0x1e')]});})[_0x7665('0x1f')](function(_0x3a4045){_0x442d83(_0xd4452b[_0x7665('0x12')](0x1f4,_0x3a4045['message']));});});},'CheckAfterSend':function(_0xba1a77){var _0x6949dc=this;return new Promise(function(_0x165ddd,_0xa64995){_0x28b410[_0x7665('0x88')](_0xba1a77)[_0x7665('0x1d')](function(_0x4410fe){_0x165ddd({'code':0xc8,'message':_0x4410fe[_0x7665('0x1e')]});})[_0x7665('0x1f')](function(_0x132170){_0xa64995(_0x6949dc[_0x7665('0x12')](0x1f4,_0x132170['message']));});});}};var _0x356786=jayson['server'](_0x4c0b5c)['http']();_0x356786['on'](_0x7665('0x12'),function(_0x1c83cb){return _0x3387d8(_0x1c83cb);});_0x356786[_0x7665('0x7')](0x232a,_0x7665('0x89'),function(){console[_0x7665('0x8a')](_0x7665('0x8b'),0x232a);return _0x1a6f2f(_0x7665('0x8c')+0x232a);});});}; \ No newline at end of file +var _0xf69c=['predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','Trunk','active','callerid','Interval','length','omit','undefined','voicechannel','map','find','channels','uniqueid','%s.%s','filename','wav','MixMonitor','channel','ai(mixmonitorid)','/var/spool/asterisk/monitor/','toLowerCase','isNil','YYYY-MM-DD\x20HH:mm:ss','rec','status','MixMonitor\x20Success','mixmonitorid','resolve','StopMixMonitor','destinationchannel','stop','monitors','StopMixMonitor\x20Success','values','queueChannels','Channel\x20doesn\x27t\x20exist','voicequeuechannelhangup','Hangup','voicequeuechannelredirect','Redirect','exten','context','trunks','outboundChannels','event','emit','custom:','faxAccounts','send','server','http','127.0.0.1','RPC\x20listening\x20on\x20port:','lodash','jayson/promise','validate','moment','../properties','listen','format','SIP','name','timers','timer','updateAcw','agents','updateStatusRealtime','pause','QueuePause','username','join','pick','keys','module','Reload','Action','message','catch','error','isConnected','asterisk','ami\x20disconnected','command','action','Command','then','content','hasOwnProperty','voiceQueues','strategy','answered','available','loggedIn','pTalking','sumHoldTime','talking','total','type','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','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable'];(function(_0x257f1e,_0x1c8a29){var _0x181610=function(_0x68d7d7){while(--_0x68d7d7){_0x257f1e['push'](_0x257f1e['shift']());}};_0x181610(++_0x1c8a29);}(_0xf69c,0x151));var _0xcf69=function(_0x1347f8,_0x233feb){_0x1347f8=_0x1347f8-0x0;var _0x218368=_0xf69c[_0x1347f8];return _0x218368;};'use strict';var _=require(_0xcf69('0x0'));var util=require('util');var jayson=require(_0xcf69('0x1'));var schema=require(_0xcf69('0x2'));var BPromise=require('bluebird');var moment=require(_0xcf69('0x3'));var config=require('../../../config/environment');var properties=require(_0xcf69('0x4'));var ami=require('../ami');exports[_0xcf69('0x5')]=function(_0x4d8180,_0x1c813d,_0x168197){return new BPromise(function(_0x225c65,_0x35aa67){var _0x3b7608={'QueuePause':function(_0x5f1e98){return new Promise(function(_0x38478c,_0xbeb916){var _0x46b433=util[_0xcf69('0x6')]('%s/%s',_0xcf69('0x7'),_0x5f1e98[_0xcf69('0x8')]);if(_0x4d8180[_0xcf69('0x9')]&&_0x4d8180[_0xcf69('0x9')][_0x46b433]&&_0x4d8180[_0xcf69('0x9')][_0x46b433][_0xcf69('0xa')]){_0x4d8180['timers'][_0x46b433][_0xcf69('0xb')]();}if(_0x4d8180['agents'][_0x46b433]){_0x4d8180[_0xcf69('0xc')][_0x46b433][_0xcf69('0xd')]({'statePause':_0x5f1e98[_0xcf69('0xe')]?!![]:![]});}_0x38478c({'code':0xc8,'message':_0xcf69('0xf')});});},'Reload':function(_0x329250){var _0x2981ab=this;return new Promise(function(_0x182dde,_0x34e299){if(ami['isConnected']()==![]){return _0x34e299(_0x2981ab['error'](0x1f4,[config['asterisk']['ip'],config['asterisk'][_0xcf69('0x10')],'ami\x20disconnected'][_0xcf69('0x11')]('\x20')));}_0x329250=_[_0xcf69('0x12')](_0x329250,_[_0xcf69('0x13')](properties[_0xcf69('0x14')]));_0x329250['action']=_0xcf69('0x15');return ami[_0xcf69('0x16')](_0x329250)['then'](function(_0x486e06){_0x182dde({'code':0xc8,'message':_0x486e06[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x39306a){_0x34e299(_0x2981ab[_0xcf69('0x19')](0x1f5,_0x39306a[_0xcf69('0x17')]));});});},'Command':function(_0xfd30d2){var _0x120980=this;return new Promise(function(_0x210630,_0x53666e){if(ami[_0xcf69('0x1a')]()==![]){return _0x53666e(_0x120980['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}_0xfd30d2=_[_0xcf69('0x12')](_0xfd30d2,_0xcf69('0x1d'));_0xfd30d2[_0xcf69('0x1e')]=_0xcf69('0x1f');return ami[_0xcf69('0x16')](_0xfd30d2)[_0xcf69('0x20')](function(_0x7d86bc){_0x210630({'code':0xc8,'message':_0x7d86bc[_0xcf69('0x21')]});})[_0xcf69('0x18')](function(_0x3ec2fb){_0x53666e(_0x120980['error'](0x1f5,_0x3ec2fb[_0xcf69('0x17')]));});});},'VoiceQueues':function(_0x1abce9){return new Promise(function(_0x183067,_0x278ce3){var _0x9a006b=[];for(var _0x1a0b33 in _0x4d8180['voiceQueues']){if(_0x4d8180['voiceQueues'][_0xcf69('0x22')](_0x1a0b33)){var _0x59de98=_0x4d8180[_0xcf69('0x23')][_0x1a0b33];var _0x81a49f={'id':_0x59de98['id'],'name':_0x59de98[_0xcf69('0x8')],'strategy':_0x59de98[_0xcf69('0x24')],'answered':_0x59de98[_0xcf69('0x25')],'available':_0x59de98[_0xcf69('0x26')],'loggedIn':_0x59de98[_0xcf69('0x27')],'pTalking':_0x59de98[_0xcf69('0x28')],'sumBillable':_0x59de98['sumBillable'],'sumDuration':_0x59de98['sumDuration'],'sumHoldTime':_0x59de98[_0xcf69('0x29')]||0x0,'talking':_0x59de98[_0xcf69('0x2a')],'total':_0x59de98[_0xcf69('0x2b')],'type':_0x59de98[_0xcf69('0x2c')],'unmanaged':_0x59de98['unmanaged'],'abandoned':_0x59de98[_0xcf69('0x2d')],'waiting':_0x59de98[_0xcf69('0x2e')],'loggedInDb':_0x59de98[_0xcf69('0x2f')]};if(_0x59de98[_0xcf69('0x2c')]===_0xcf69('0x30')){_0x81a49f[_0xcf69('0x31')]=_0x59de98[_0xcf69('0x31')];_0x81a49f[_0xcf69('0x32')]=_0x59de98[_0xcf69('0x32')];_0x81a49f[_0xcf69('0x33')]=_0x59de98['dialOriginateCallerIdName'];_0x81a49f[_0xcf69('0x34')]=_0x59de98['dialOriginateCallerIdNumber'];_0x81a49f[_0xcf69('0x35')]=_0x59de98[_0xcf69('0x35')];_0x81a49f[_0xcf69('0x36')]=_0x59de98[_0xcf69('0x36')];_0x81a49f[_0xcf69('0x37')]=_0x59de98[_0xcf69('0x37')];_0x81a49f[_0xcf69('0x38')]=_0x59de98[_0xcf69('0x38')];_0x81a49f[_0xcf69('0x39')]=_0x59de98[_0xcf69('0x39')];_0x81a49f['outboundBlacklistCallsDay']=_0x59de98[_0xcf69('0x3a')];_0x81a49f[_0xcf69('0x3b')]=_0x59de98['outboundBusyCallsDay'];_0x81a49f[_0xcf69('0x3c')]=_0x59de98['outboundCongestionCallsDay'];_0x81a49f[_0xcf69('0x3d')]=_0x59de98['outboundDropCallsDayACS'];_0x81a49f['outboundDropCallsDayCallersExit']=_0x59de98[_0xcf69('0x3e')];_0x81a49f[_0xcf69('0x3f')]=_0x59de98[_0xcf69('0x3f')];_0x81a49f[_0xcf69('0x40')]=_0x59de98[_0xcf69('0x40')];_0x81a49f[_0xcf69('0x41')]=_0x59de98['outboundNoSuchCallsDay'];_0x81a49f['outboundOriginateFailureCallsDay']=_0x59de98[_0xcf69('0x42')];_0x81a49f[_0xcf69('0x43')]=_0x59de98[_0xcf69('0x43')];_0x81a49f[_0xcf69('0x44')]=_0x59de98[_0xcf69('0x44')];_0x81a49f[_0xcf69('0x45')]=_0x59de98[_0xcf69('0x45')];_0x81a49f[_0xcf69('0x46')]=_0x59de98[_0xcf69('0x46')];_0x81a49f[_0xcf69('0x47')]=_0x59de98[_0xcf69('0x47')];_0x81a49f[_0xcf69('0x48')]=_0x59de98[_0xcf69('0x48')];_0x81a49f[_0xcf69('0x49')]=_0x59de98[_0xcf69('0x49')];_0x81a49f[_0xcf69('0x4a')]=_0x59de98[_0xcf69('0x4a')];_0x81a49f[_0xcf69('0x4b')]=_0x59de98[_0xcf69('0x4b')];_0x81a49f[_0xcf69('0x4c')]=_0x59de98[_0xcf69('0x4c')];_0x81a49f['predictiveIntervalHitRate']=_0x59de98['predictiveIntervalHitRate'];_0x81a49f[_0xcf69('0x4d')]=_0x59de98[_0xcf69('0x4d')];_0x81a49f[_0xcf69('0x4e')]=_0x59de98[_0xcf69('0x4e')];_0x81a49f['predictiveIntervalAvailable']=_0x59de98[_0xcf69('0x4f')];_0x81a49f[_0xcf69('0x50')]=_0x59de98[_0xcf69('0x50')];_0x81a49f[_0xcf69('0x17')]=_0x59de98[_0xcf69('0x17')];_0x81a49f['originated']=_0x59de98[_0xcf69('0x51')];_0x81a49f[_0xcf69('0x52')]=_0x59de98['erlangCalls'];_0x81a49f[_0xcf69('0x53')]=_0x59de98[_0xcf69('0x53')];_0x81a49f[_0xcf69('0x54')]=_0x59de98['erlangAbandonmentRate'];_0x81a49f[_0xcf69('0x55')]=_0x59de98['erlangBusyFactor'];_0x81a49f[_0xcf69('0x56')]=_0x59de98[_0xcf69('0x56')];_0x81a49f['startProgressive']=_0x59de98['startProgressive'];}if(_0x59de98[_0xcf69('0x57')]){_0x81a49f[_0xcf69('0x57')]={'id':_0x59de98[_0xcf69('0x57')]['id'],'name':_0x59de98['Trunk']['name'],'active':_0x59de98[_0xcf69('0x57')][_0xcf69('0x58')],'callerid':_0x59de98['Trunk'][_0xcf69('0x59')]};}if(_0x59de98[_0xcf69('0x5a')]){_0x81a49f[_0xcf69('0x5a')]={'id':_0x59de98[_0xcf69('0x5a')]['id'],'name':_0x59de98[_0xcf69('0x5a')][_0xcf69('0x8')]};}_0x9a006b['push'](_0x81a49f);}}_0x183067({'count':_0x9a006b[_0xcf69('0x5b')],'rows':_0x9a006b});});},'UpdateVoiceQueue':function(_0x39522d){return new Promise(function(_0x3e33e6,_0x58e261){var _0x1a1270=_['find'](_0x4d8180[_0xcf69('0x23')],{'id':parseInt(_0x39522d['id'])});var _0x81d8a7=_[_0xcf69('0x5c')](_0x39522d,['id']);if(_0x1a1270){for(var _0x45c458 in _0x81d8a7){if(typeof _0x81d8a7[_0x45c458]!==_0xcf69('0x5d')&&typeof _0x1a1270[_0x45c458]!=='undefined'){_0x1a1270[_0x45c458]=_0x81d8a7[_0x45c458];}}_0x3e33e6(_0x1a1270);}else{_0x58e261();}});},'VoiceChannels':function(_0x57748d){return new Promise(function(_0xca4bc0,_0x29dfbf){var _0x43ded1=_['values'](_0x4d8180['channels']);_0xca4bc0({'count':_0x43ded1['length'],'rows':_0x43ded1});});},'VoiceChannelMixMonitor':function(_0x2f2b20){var _0x814320=this;return new Promise(function(_0x91069e,_0x4c55e4){if(ami[_0xcf69('0x1a')]()==![]){return _0x4c55e4(_0x814320['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config['asterisk'][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x2f8346=schema(properties[_0xcf69('0x5e')])[_0xcf69('0x2')](_0x2f2b20);if(_0x2f8346[_0xcf69('0x5b')]>0x0){return _0x4c55e4(_0x814320[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x2f8346,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x52473a=_[_0xcf69('0x60')](_0x4d8180[_0xcf69('0x61')],{'uniqueid':_0x2f2b20[_0xcf69('0x62')]});if(_0x52473a&&_0x52473a['channel']){var _0x294e08=util['format'](_0xcf69('0x63'),_0x2f2b20[_0xcf69('0x64')]||_0x2f2b20[_0xcf69('0x62')],_0x2f2b20[_0xcf69('0x6')]||_0xcf69('0x65'));return ami[_0xcf69('0x16')]({'action':_0xcf69('0x66'),'channel':_0x52473a[_0xcf69('0x67')],'file':_0x294e08,'options':_0xcf69('0x68')})[_0xcf69('0x20')](function(_0x2f83f6){var _0x2be62c=_[_0xcf69('0x60')](_0x52473a['monitors'],{'filename':_0xcf69('0x69')+_0x294e08[_0xcf69('0x6a')]()});if(_[_0xcf69('0x6b')](_0x2be62c)){_0x52473a['monitors']['push']({'filename':_0xcf69('0x69')+_0x294e08['toLowerCase'](),'createdAt':moment()[_0xcf69('0x6')](_0xcf69('0x6c')),'mixmonitorid':_0x2f83f6['mixmonitorid'],'status':_0xcf69('0x6d')});}else{_0x2be62c['mixmonitorid']=_0x2f83f6['mixmonitorid'];_0x2be62c[_0xcf69('0x6e')]=_0xcf69('0x6d');}_0x91069e({'code':0xc8,'message':[_0x2f2b20[_0xcf69('0x62')],_0xcf69('0x6f'),_0x2f83f6['mixmonitorid']][_0xcf69('0x11')]('\x20'),'mixmonitorid':_0x2f83f6[_0xcf69('0x70')]});})[_0xcf69('0x18')](function(_0x5996eb){_0x4c55e4(_0x814320['error'](0x1f5,[_0x2f2b20[_0xcf69('0x62')],_0x5996eb[_0xcf69('0x17')][_0xcf69('0x6a')]()]['join']('\x20')));});}else{return _0x4c55e4(_0x814320['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x4ab987){var _0x5d036b=this;return new Promise(function(_0x4bfd20,_0x1ace3c){if(ami[_0xcf69('0x1a')]()==![]){return _0x1ace3c(_0x5d036b['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x19310e=schema(properties['voicechannel'])['validate'](_0x4ab987);if(_0x19310e[_0xcf69('0x5b')]>0x0){return _0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x19310e,_0xcf69('0x17'))['join'](',\x20')));}var _0x593502=_['find'](_0x4d8180['channels'],{'uniqueid':_0x4ab987[_0xcf69('0x62')]});if(_0x593502){return BPromise[_0xcf69('0x71')]()[_0xcf69('0x20')](function(){if(_0x593502[_0xcf69('0x67')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x72'),'channel':_0x593502['channel'],'mixmonitorid':_0x4ab987[_0xcf69('0x70')]})[_0xcf69('0x18')](function(_0x111089){});}})[_0xcf69('0x20')](function(){if(_0x593502[_0xcf69('0x73')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x72'),'channel':_0x593502[_0xcf69('0x73')],'mixmonitorid':_0x4ab987[_0xcf69('0x70')]})[_0xcf69('0x18')](function(_0x16d25d){});}})['then'](function(_0x1d5dc1){var _0x3e5450=_[_0xcf69('0x60')](_0x593502['monitors'],{'mixmonitorid':_0x4ab987[_0xcf69('0x70')]});if(_0x3e5450){_0x3e5450['status']=_0xcf69('0x74');}})['then'](function(){var _0x4b3250=util[_0xcf69('0x6')](_0xcf69('0x63'),_0x4ab987[_0xcf69('0x64')]||_0x4ab987[_0xcf69('0x62')],_0x4ab987[_0xcf69('0x6')]||'wav');var _0x5d098a=_[_0xcf69('0x60')](_0x593502[_0xcf69('0x75')],{'filename':'/var/spool/asterisk/monitor/'+_0x4b3250['toLowerCase']()});if(_0x5d098a){_0x5d098a['status']=_0xcf69('0x74');}})[_0xcf69('0x20')](function(){_0x4bfd20({'code':0xc8,'message':[_0x4ab987['uniqueid'],_0xcf69('0x76')]['join']('\x20')});})[_0xcf69('0x18')](function(_0x3b76ce){_0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f5,[_0x4ab987[_0xcf69('0x62')],_0x3b76ce[_0xcf69('0x17')]['toLowerCase']()]['join']('\x20')));});}else{return _0x1ace3c(_0x5d036b[_0xcf69('0x19')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x188d15){return new Promise(function(_0x54cf09,_0x53ee6c){var _0x5a183e=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0x78')]);_0x54cf09({'count':_0x5a183e[_0xcf69('0x5b')],'rows':_0x5a183e});});},'VoiceQueuesChannel':function(_0xbb5438){var _0x566520=this;return new Promise(function(_0x287912,_0x5658f4){var _0x243fda=schema(properties['voicequeuechannel'])[_0xcf69('0x2')](_0xbb5438);if(_0x243fda[_0xcf69('0x5b')]>0x0){return _0x5658f4(_0x566520['error'](0x1f4,_[_0xcf69('0x5f')](_0x243fda,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x490cce=_['find'](_0x4d8180[_0xcf69('0x78')],{'uniqueid':_0xbb5438[_0xcf69('0x62')]});if(_0x490cce){_0x287912(_0x490cce);}else{return _0x5658f4(_0x566520['error'](0x1f5,_0xcf69('0x79')));}});},'VoiceQueuesChannelHangup':function(_0x38e0b2){var _0x746a64=this;return new Promise(function(_0x4bc426,_0x48774f){if(ami[_0xcf69('0x1a')]()==![]){return _0x48774f(_0x746a64['error'](0x1f4,[config[_0xcf69('0x1b')]['ip'],config[_0xcf69('0x1b')]['username'],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x5b68b8=schema(properties[_0xcf69('0x7a')])['validate'](_0x38e0b2);if(_0x5b68b8[_0xcf69('0x5b')]>0x0){return _0x48774f(_0x746a64[_0xcf69('0x19')](0x1f4,_[_0xcf69('0x5f')](_0x5b68b8,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x52eae3=_[_0xcf69('0x60')](_0x4d8180['queueChannels'],{'uniqueid':_0x38e0b2[_0xcf69('0x62')]});if(_0x52eae3&&_0x52eae3[_0xcf69('0x67')]){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x7b'),'channel':_0x52eae3['channel']})['then'](function(_0x2f97f5){_0x4bc426({'code':0xc8,'message':[_0x38e0b2[_0xcf69('0x62')],_0x2f97f5[_0xcf69('0x17')][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')});})[_0xcf69('0x18')](function(_0x5d5dfe){_0x48774f(_0x746a64[_0xcf69('0x19')](0x1f5,[_0x38e0b2[_0xcf69('0x62')],_0x5d5dfe[_0xcf69('0x17')][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')));});}else{return _0x48774f(_0x746a64['error'](0x1f5,_0xcf69('0x79')));}});},'VoiceQueuesChannelRedirect':function(_0x595e2f){var _0x4dbf4e=this;return new Promise(function(_0x96cf1d,_0x270e79){if(ami['isConnected']()==![]){return _0x270e79(_0x4dbf4e['error'](0x1f4,[config['asterisk']['ip'],config[_0xcf69('0x1b')][_0xcf69('0x10')],_0xcf69('0x1c')][_0xcf69('0x11')]('\x20')));}var _0x3d1055=schema(properties[_0xcf69('0x7c')])['validate'](_0x595e2f);if(_0x3d1055[_0xcf69('0x5b')]>0x0){return _0x270e79(_0x4dbf4e[_0xcf69('0x19')](0x1f4,_['map'](_0x3d1055,_0xcf69('0x17'))[_0xcf69('0x11')](',\x20')));}var _0x3cfb21=_[_0xcf69('0x60')](_0x4d8180[_0xcf69('0x78')],{'uniqueid':_0x595e2f[_0xcf69('0x62')]});if(_0x3cfb21&&_0x3cfb21['channel']){return ami[_0xcf69('0x16')]({'action':_0xcf69('0x7d'),'channel':_0x3cfb21[_0xcf69('0x67')],'exten':_0x595e2f[_0xcf69('0x7e')],'context':_0x595e2f['context']||_0x3cfb21[_0xcf69('0x7f')],'priority':0x1})[_0xcf69('0x20')](function(_0x2cdcc3){_0x96cf1d({'code':0xc8,'message':[_0x595e2f[_0xcf69('0x62')],_0x2cdcc3['message'][_0xcf69('0x6a')]()]['join']('\x20')});})[_0xcf69('0x18')](function(_0x1af8a0){_0x270e79(_0x4dbf4e['error'](0x1f5,[_0x595e2f['uniqueid'],_0x1af8a0['message'][_0xcf69('0x6a')]()][_0xcf69('0x11')]('\x20')));});}else{return _0x270e79(_0x4dbf4e['error'](0x1f5,_0xcf69('0x79')));}});},'Agents':function(_0x2002e1){return new Promise(function(_0x145bde,_0x2cd107){var _0x1cb7fd=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0xc')]);_0x145bde({'count':_0x1cb7fd[_0xcf69('0x5b')],'rows':_0x1cb7fd});});},'Telephones':function(_0x3f67d7){return new Promise(function(_0x4a7f65,_0x455dd0){var _0x2ca0d3=_[_0xcf69('0x77')](_0x4d8180['telephones']);_0x4a7f65({'count':_0x2ca0d3['length'],'rows':_0x2ca0d3});});},'Trunks':function(_0x57f3cb){return new Promise(function(_0x24194c,_0x587c1b){var _0x5eabdb=_[_0xcf69('0x77')](_0x4d8180[_0xcf69('0x80')]);_0x24194c({'count':_0x5eabdb[_0xcf69('0x5b')],'rows':_0x5eabdb});});},'OutboundChannels':function(_0x352d40){return new Promise(function(_0x2b79f0,_0x1fc8db){var _0xeb1b54=_['values'](_0x4d8180[_0xcf69('0x81')]);_0x2b79f0({'count':_0xeb1b54[_0xcf69('0x5b')],'rows':_0xeb1b54});});},'Outbound':function(_0x29e5fc){return new Promise(function(_0x2fbec3,_0x53438c){_0x2fbec3(_0x4d8180[_0xcf69('0x30')]);});},'Campaigns':function(_0xf339fa){return new Promise(function(_0x29d887,_0x3c7db3){var _0xac1fa9=_['values'](_0x4d8180['campaigns']);_0x29d887({'count':_0xac1fa9[_0xcf69('0x5b')],'rows':_0xac1fa9});});},'VoiceQueuesPreview':function(_0x165f37){var _0x4ece02=this;return new Promise(function(_0x14e9d6,_0x45a3a7){_0x1c813d['run'](_0x165f37['id'])[_0xcf69('0x20')](function(_0x548195){_0x14e9d6({'code':0xc8,'message':_0x548195[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x3d1fb0){_0x45a3a7(_0x4ece02[_0xcf69('0x19')](0x1f4,_0x3d1fb0[_0xcf69('0x17')]));});});},'EventManager':function(_0x1fe4a9){var _0x29574f=this;return new Promise(function(_0x478426,_0x3748b5){if(!_0x1fe4a9[_0xcf69('0x82')]){return _0x3748b5(_0x29574f[_0xcf69('0x19')](0x1f4,'Event\x20name\x20mandatory'));}ami[_0xcf69('0x83')](_0xcf69('0x84')+_0x1fe4a9['event'],_0x1fe4a9['message']);_0x478426({'code':0xc8,'message':_0x1fe4a9});});},'FaxAccounts':function(_0x11cdad){return new Promise(function(_0x437d15,_0x3f7b13){var _0x4c8346=_['values'](_0x4d8180[_0xcf69('0x85')]);_0x437d15({'count':_0x4c8346[_0xcf69('0x5b')],'rows':_0x4c8346});});},'SendFax':function(_0x8a4d91){var _0x47d3cb=this;return new Promise(function(_0x172362,_0x2f2ca0){_0x168197[_0xcf69('0x86')](_0x8a4d91)['then'](function(_0x363533){_0x172362({'code':0xc8,'message':_0x363533[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x3e73b9){_0x2f2ca0(_0x47d3cb[_0xcf69('0x19')](0x1f4,_0x3e73b9[_0xcf69('0x17')]));});});},'CheckAfterSend':function(_0x2d1bbf){var _0x4bca3d=this;return new Promise(function(_0x3e29d3,_0x1279fc){_0x168197['checkAfterSend'](_0x2d1bbf)[_0xcf69('0x20')](function(_0x17ef57){_0x3e29d3({'code':0xc8,'message':_0x17ef57[_0xcf69('0x17')]});})[_0xcf69('0x18')](function(_0x18db19){_0x1279fc(_0x4bca3d[_0xcf69('0x19')](0x1f4,_0x18db19['message']));});});}};var _0x1d7528=jayson[_0xcf69('0x87')](_0x3b7608)[_0xcf69('0x88')]();_0x1d7528['on'](_0xcf69('0x19'),function(_0x220220){return _0x35aa67(_0x220220);});_0x1d7528['listen'](0x232a,_0xcf69('0x89'),function(){console['log']('AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!',0x232a);return _0x225c65(_0xcf69('0x8a')+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 43773c1..5c86f58 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 _0x85c7=['destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','isEmpty','length','info','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','calleridnum','calleridname','Unknown','destcalleridname','','createContact','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','user:%s','name','trigger:%s','action','toLowerCase','merge','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','localhost','[CM][%s][%s]','stringify','emit','exec','data1','data2','xmd-contactid','ListId','data3','phone','$or','map','routeId'];(function(_0x24a277,_0xfd57bb){var _0x89105e=function(_0x4f4ee6){while(--_0x4f4ee6){_0x24a277['push'](_0x24a277['shift']());}};_0x89105e(++_0xfd57bb);}(_0x85c7,0x99));var _0x785c=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0x85c7[_0x1d1779];return _0x2377e9;};'use strict';var _=require('lodash');var BPromise=require('bluebird');var Redis=require(_0x785c('0x0'));var util=require(_0x785c('0x1'));var config=require(_0x785c('0x2'));var logger=require(_0x785c('0x3'))(_0x785c('0x4'));var cmContactRpc=require(_0x785c('0x5'));config[_0x785c('0x6')]=_['defaults'](config['redis'],{'host':_0x785c('0x7'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x290199,_0x263564,_0x43234c,_0x2f8e97,_0x60b793){logger['info'](_0x785c('0x8'),_0x290199,_0x263564['id'],_0x43234c,_0x2f8e97,JSON[_0x785c('0x9')](_0x60b793));io['to'](_0x43234c)[_0x785c('0xa')](_0x2f8e97,_0x60b793);}exports[_0x785c('0xb')]=function(_0x1eb7c6,_0x2684ff,_0x148f69,_0x36eb85){var _0x4a6504,_0x4f6e60;var _0x1bd1f2={};var _0x4b39a9=Number(_0x148f69[_0x785c('0xc')]);var _0x591b6c=_0x148f69['data2']?Boolean(Number(_0x148f69[_0x785c('0xd')])):![];var _0x2be05c;if(_0x36eb85[_0x785c('0xe')]){_0x1bd1f2['id']=_0x36eb85[_0x785c('0xe')];}if(!_0x1bd1f2['id']){_0x1bd1f2[_0x785c('0xf')]=_0x4b39a9;_0x2be05c=_0x148f69[_0x785c('0x10')]&&_0x148f69['data3']!=='0'?_0x148f69['data3']['split'](','):[_0x785c('0x11')];_0x1bd1f2[_0x785c('0x12')]=_[_0x785c('0x13')](_0x2be05c,function(_0x20d13e){var _0x1c71e3={};_0x1c71e3[_0x20d13e]=_0x36eb85[_0x785c('0x14')]?_0x36eb85[_0x785c('0x15')]:_0x36eb85['calleridnum'];return _0x1c71e3;});}var _0x4d46f6=['id',_0x785c('0x16'),_0x785c('0x17'),'phone',_0x785c('0x18'),_0x785c('0x19'),_0x785c('0xf'),_0x785c('0x1a'),_0x785c('0x1b'),_0x785c('0x1c')];var _0x31c2e6=_[_0x785c('0x1d')](_0x4d46f6,_0x2be05c);BPromise[_0x785c('0x1e')]()[_0x785c('0x1f')](cmContactRpc[_0x785c('0x20')]({'attributes':_0x31c2e6,'where':_0x1bd1f2}))[_0x785c('0x1f')](function(_0x10efda){_0x4f6e60=_0x10efda;if(!_[_0x785c('0x21')](_0x4f6e60)){if(_0x4f6e60[_0x785c('0x22')]===0x1){_0x4a6504=_0x4f6e60[0x0];logger[_0x785c('0x23')](_0x785c('0x24'),_0x36eb85[_0x785c('0x25')],_0x2684ff['id'],_0x4a6504['id']);}else{logger[_0x785c('0x23')](_0x785c('0x26'),_0x36eb85['uniqueid'],_0x2684ff['id'],_[_0x785c('0x13')](_0x4f6e60,'id')[_0x785c('0x27')](','));}return;}else{logger[_0x785c('0x23')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x36eb85[_0x785c('0x25')],_0x2684ff['id']);var _0x11141f={'ListId':_0x4b39a9};var _0x2d2c10=_0x148f69[_0x785c('0x28')]&&_0x148f69[_0x785c('0x28')]!=='0'?_0x148f69[_0x785c('0x28')]:_0x785c('0x11');if(_0x591b6c){logger['info'](_0x785c('0x29'),_0x36eb85['uniqueid'],_0x2684ff['id']);_0x11141f[_0x2d2c10]=_[_0x785c('0x2a')](_0x36eb85['routeId'])?_0x36eb85[_0x785c('0x2b')]:_0x36eb85[_0x785c('0x15')];if(_[_0x785c('0x2a')](_0x36eb85['routeId'])){_0x11141f[_0x785c('0x16')]=_0x36eb85['calleridname']&&_0x36eb85[_0x785c('0x2c')]!==''?_0x36eb85[_0x785c('0x2c')]:_0x785c('0x2d');}else{_0x11141f[_0x785c('0x16')]=_0x36eb85[_0x785c('0x2e')]&&_0x36eb85[_0x785c('0x2e')]!==_0x785c('0x2f')?_0x36eb85[_0x785c('0x2e')]:_0x785c('0x2d');}return BPromise[_0x785c('0x1e')]()[_0x785c('0x1f')](cmContactRpc[_0x785c('0x30')](_0x11141f))[_0x785c('0x1f')](function(_0x58e1fe){_0x4a6504=_0x58e1fe;_0x4f6e60['push'](_0x58e1fe);if(_0x4a6504){logger['info']('[CM][%s][%s]\x20Contact\x20created:%s',_0x36eb85[_0x785c('0x25')],_0x2684ff['id'],_0x4a6504['id']);}return;});}else{logger[_0x785c('0x23')](_0x785c('0x31'),_0x36eb85[_0x785c('0x25')],_0x2684ff['id']);_0x11141f[_0x2d2c10]=_[_0x785c('0x2a')](_0x36eb85[_0x785c('0x14')])?_0x36eb85[_0x785c('0x2b')]:_0x36eb85[_0x785c('0x15')];if(_[_0x785c('0x2a')](_0x36eb85[_0x785c('0x14')])){_0x11141f[_0x785c('0x16')]=_0x36eb85['calleridname']&&_0x36eb85['calleridname']!==_0x785c('0x2f')?_0x36eb85[_0x785c('0x2c')]:_0x785c('0x2d');}else{_0x11141f[_0x785c('0x16')]=_0x36eb85[_0x785c('0x2e')]&&_0x36eb85['destcalleridname']!==_0x785c('0x2f')?_0x36eb85[_0x785c('0x2e')]:'Unknown';}_0x4a6504=_0x11141f;_0x4f6e60[_0x785c('0x32')](_0x11141f);return;}}})[_0x785c('0x1f')](function(){if(_0x1eb7c6){emit(_0x36eb85[_0x785c('0x25')],_0x2684ff,util[_0x785c('0x33')](_0x785c('0x34'),_0x1eb7c6[_0x785c('0x35')]),util[_0x785c('0x33')](_0x785c('0x36'),_0x148f69[_0x785c('0x37')][_0x785c('0x38')]()),{'evt':_[_0x785c('0x39')](_0x36eb85,{'autoCreate':_0x591b6c}),'contact':_0x4a6504===undefined?{}:_0x4a6504,'contacts':_0x4f6e60[_0x785c('0x22')]===0x0?undefined:_0x4f6e60});}});}; \ No newline at end of file +var _0x0ba6=['action','merge','lodash','bluebird','ioredis','util','../../../../config/environment','redis','defaults','socket.io-emitter','[CM][%s][%s]','stringify','emit','exec','data1','data2','data3','split','phone','$or','map','destcalleridnum','calleridnum','firstName','mobile','fax','ListId','createdAt','updatedAt','union','then','getContacts','isEmpty','length','[CM][%s][%s]\x20Contact\x20found:%s','info','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','uniqueid','data4','[CM][%s][%s]\x20Autocreate\x20enabled','isNil','routeId','calleridname','','Unknown','destcalleridname','resolve','createContact','push','[CM][%s][%s]\x20Contact\x20created:%s','format','user:%s','name'];(function(_0x51d98c,_0x591b77){var _0x52a73e=function(_0x2329d9){while(--_0x2329d9){_0x51d98c['push'](_0x51d98c['shift']());}};_0x52a73e(++_0x591b77);}(_0x0ba6,0x110));var _0x60ba=function(_0x1b64dd,_0x2cf769){_0x1b64dd=_0x1b64dd-0x0;var _0xeb464c=_0x0ba6[_0x1b64dd];return _0xeb464c;};'use strict';var _=require(_0x60ba('0x0'));var BPromise=require(_0x60ba('0x1'));var Redis=require(_0x60ba('0x2'));var util=require(_0x60ba('0x3'));var config=require(_0x60ba('0x4'));var logger=require('../../../../config/logger')('trigger');var cmContactRpc=require('../../rpc/cmContact');config[_0x60ba('0x5')]=_[_0x60ba('0x6')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x60ba('0x7'))(new Redis(config[_0x60ba('0x5')]));function emit(_0x39d0a6,_0x7d942d,_0x477e27,_0x1edce5,_0x275e30){logger['info'](_0x60ba('0x8'),_0x39d0a6,_0x7d942d['id'],_0x477e27,_0x1edce5,JSON[_0x60ba('0x9')](_0x275e30));io['to'](_0x477e27)[_0x60ba('0xa')](_0x1edce5,_0x275e30);}exports[_0x60ba('0xb')]=function(_0x56c253,_0x19f9bc,_0x1457ac,_0x276cba){var _0x4eacd1,_0x2bbce5;var _0x5694e1={};var _0x47fd7b=Number(_0x1457ac[_0x60ba('0xc')]);var _0xc8d8a1=_0x1457ac[_0x60ba('0xd')]?Boolean(Number(_0x1457ac['data2'])):![];var _0x2959dd;if(_0x276cba['xmd-contactid']){_0x5694e1['id']=_0x276cba['xmd-contactid'];}if(!_0x5694e1['id']){_0x5694e1['ListId']=_0x47fd7b;_0x2959dd=_0x1457ac['data3']&&_0x1457ac[_0x60ba('0xe')]!=='0'?_0x1457ac[_0x60ba('0xe')][_0x60ba('0xf')](','):[_0x60ba('0x10')];_0x5694e1[_0x60ba('0x11')]=_[_0x60ba('0x12')](_0x2959dd,function(_0x992fd4){var _0xaccc62={};_0xaccc62[_0x992fd4]=_0x276cba['routeId']?_0x276cba[_0x60ba('0x13')]:_0x276cba[_0x60ba('0x14')];return _0xaccc62;});}var _0x32baf2=['id',_0x60ba('0x15'),'lastName','phone',_0x60ba('0x16'),_0x60ba('0x17'),_0x60ba('0x18'),_0x60ba('0x19'),'scheduledAt',_0x60ba('0x1a')];var _0x1011ac=_[_0x60ba('0x1b')](_0x32baf2,_0x2959dd);BPromise['resolve']()[_0x60ba('0x1c')](cmContactRpc[_0x60ba('0x1d')]({'attributes':_0x1011ac,'where':_0x5694e1}))[_0x60ba('0x1c')](function(_0x218f33){_0x2bbce5=_0x218f33;if(!_[_0x60ba('0x1e')](_0x2bbce5)){if(_0x2bbce5[_0x60ba('0x1f')]===0x1){_0x4eacd1=_0x2bbce5[0x0];logger['info'](_0x60ba('0x20'),_0x276cba['uniqueid'],_0x19f9bc['id'],_0x4eacd1['id']);}else{logger[_0x60ba('0x21')](_0x60ba('0x22'),_0x276cba['uniqueid'],_0x19f9bc['id'],_[_0x60ba('0x12')](_0x2bbce5,'id')[_0x60ba('0x23')](','));}return;}else{logger[_0x60ba('0x21')]('[CM][%s][%s]\x20Contact\x20not\x20found',_0x276cba[_0x60ba('0x24')],_0x19f9bc['id']);var _0x60970b={'ListId':_0x47fd7b};var _0x51051e=_0x1457ac[_0x60ba('0x25')]&&_0x1457ac[_0x60ba('0x25')]!=='0'?_0x1457ac[_0x60ba('0x25')]:_0x60ba('0x10');if(_0xc8d8a1){logger[_0x60ba('0x21')](_0x60ba('0x26'),_0x276cba[_0x60ba('0x24')],_0x19f9bc['id']);_0x60970b[_0x51051e]=_[_0x60ba('0x27')](_0x276cba['routeId'])?_0x276cba[_0x60ba('0x14')]:_0x276cba[_0x60ba('0x13')];if(_[_0x60ba('0x27')](_0x276cba[_0x60ba('0x28')])){_0x60970b[_0x60ba('0x15')]=_0x276cba[_0x60ba('0x29')]&&_0x276cba['calleridname']!==_0x60ba('0x2a')?_0x276cba[_0x60ba('0x29')]:_0x60ba('0x2b');}else{_0x60970b[_0x60ba('0x15')]=_0x276cba[_0x60ba('0x2c')]&&_0x276cba['destcalleridname']!==_0x60ba('0x2a')?_0x276cba[_0x60ba('0x2c')]:'Unknown';}return BPromise[_0x60ba('0x2d')]()[_0x60ba('0x1c')](cmContactRpc[_0x60ba('0x2e')](_0x60970b))[_0x60ba('0x1c')](function(_0x57b83e){_0x4eacd1=_0x57b83e;_0x2bbce5[_0x60ba('0x2f')](_0x57b83e);if(_0x4eacd1){logger['info'](_0x60ba('0x30'),_0x276cba[_0x60ba('0x24')],_0x19f9bc['id'],_0x4eacd1['id']);}return;});}else{logger[_0x60ba('0x21')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x276cba[_0x60ba('0x24')],_0x19f9bc['id']);_0x60970b[_0x51051e]=_['isNil'](_0x276cba[_0x60ba('0x28')])?_0x276cba[_0x60ba('0x14')]:_0x276cba[_0x60ba('0x13')];if(_['isNil'](_0x276cba[_0x60ba('0x28')])){_0x60970b['firstName']=_0x276cba[_0x60ba('0x29')]&&_0x276cba[_0x60ba('0x29')]!==''?_0x276cba['calleridname']:'Unknown';}else{_0x60970b[_0x60ba('0x15')]=_0x276cba[_0x60ba('0x2c')]&&_0x276cba[_0x60ba('0x2c')]!==_0x60ba('0x2a')?_0x276cba[_0x60ba('0x2c')]:_0x60ba('0x2b');}_0x4eacd1=_0x60970b;_0x2bbce5[_0x60ba('0x2f')](_0x60970b);return;}}})[_0x60ba('0x1c')](function(){if(_0x56c253){emit(_0x276cba[_0x60ba('0x24')],_0x19f9bc,util[_0x60ba('0x31')](_0x60ba('0x32'),_0x56c253[_0x60ba('0x33')]),util[_0x60ba('0x31')]('trigger:%s',_0x1457ac[_0x60ba('0x34')]['toLowerCase']()),{'evt':_[_0x60ba('0x35')](_0x276cba,{'autoCreate':_0xc8d8a1}),'contact':_0x4eacd1===undefined?{}:_0x4eacd1,'contacts':_0x2bbce5[_0x60ba('0x1f')]===0x0?undefined:_0x2bbce5});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index 2709251..da4f64e 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 _0x09ef=['popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','sugarcrmAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','freshsalesAccounts','accounts','custom:agentcalled','syncCustomEvent','custom:agentconnect','bind','custom:agentringnoanswer','custom:agentcomplete','custom:agentnoanswer','custom:agentbusy','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','custom:dialbegin','syncAgentDial','custom:dialconnect','custom:dialend','custom:newinteraction','custom:closedinteraction','custom:rejectmessage','prototype','emit','info','clone','interface','checkTriggers','status','merge','Actions','length','action','motionbar','browser','data1','TemplateId','data2','html','render','template\x20not\x20found','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','800','data5','windowHeight','data6','600','winApplication','user:%s','name','format','trigger:%s:%s','jscripty','trigger:%s','toLowerCase','contactmanager','integration','exec','queue','routeId','urlforward','parse','query','search','replace','checkTrigger','AllConditions','every','checkConditions','AnyConditions','channel','field','account','chat','value','ChatWebsiteId','upperFirst','operator','event','agent','membername','lastevent','exports','util','lodash','url','mustache','./urlforward','./integration','./script','../../../config/logger','trigger','../ami','redis','defaults','localhost','socket.io-emitter'];(function(_0x15d18f,_0x126b0e){var _0xd12bf7=function(_0x19e661){while(--_0x19e661){_0x15d18f['push'](_0x15d18f['shift']());}};_0xd12bf7(++_0x126b0e);}(_0x09ef,0xe0));var _0xf09e=function(_0x5084ac,_0x1c39ef){_0x5084ac=_0x5084ac-0x0;var _0x1f8689=_0x09ef[_0x5084ac];return _0x1f8689;};'use strict';var util=require(_0xf09e('0x0'));var _=require(_0xf09e('0x1'));var url=require(_0xf09e('0x2'));var Mustache=require(_0xf09e('0x3'));var Redis=require('ioredis');var urlforward=require(_0xf09e('0x4'));var integration=require(_0xf09e('0x5'));var cmContact=require('./cmContact');var script=require(_0xf09e('0x6'));var config=require('../../../config/environment');var logger=require(_0xf09e('0x7'))(_0xf09e('0x8'));var ami=require(_0xf09e('0x9'));config[_0xf09e('0xa')]=_[_0xf09e('0xb')](config[_0xf09e('0xa')],{'host':_0xf09e('0xc'),'port':0x18eb});var io=require(_0xf09e('0xd'))(new Redis(config['redis']));var operators={'equals':function(_0x582dd1,_0x54301f){return _0x582dd1==_0x54301f;},'not_equals':function(_0x3057ac,_0x5d7403){return _0x3057ac!=_0x5d7403;}};var barAndWebActions=[_0xf09e('0xe'),_0xf09e('0x2'),_0xf09e('0xf')];function Trigger(_0x138d1c){this[_0xf09e('0x10')]=_0x138d1c[_0xf09e('0x10')];this[_0xf09e('0x11')]=_0x138d1c['agents'];this[_0xf09e('0x12')]=_0x138d1c[_0xf09e('0x12')];this[_0xf09e('0x13')]=_0x138d1c[_0xf09e('0x13')];this['voiceExtensions']=_0x138d1c[_0xf09e('0x14')];this[_0xf09e('0x15')]=_0x138d1c[_0xf09e('0x15')];this[_0xf09e('0x16')]=_0x138d1c[_0xf09e('0x16')];this[_0xf09e('0x17')]=_0x138d1c[_0xf09e('0x17')];this['sugarcrmAccounts']=_0x138d1c[_0xf09e('0x18')];this[_0xf09e('0x19')]=_0x138d1c[_0xf09e('0x19')];this[_0xf09e('0x1a')]=_0x138d1c['deskAccounts'];this['vtigerAccounts']=_0x138d1c[_0xf09e('0x1b')];this[_0xf09e('0x1c')]=_0x138d1c['servicenowAccounts'];this['dynamics365Accounts']=_0x138d1c[_0xf09e('0x1d')];this[_0xf09e('0x1e')]=_0x138d1c[_0xf09e('0x1e')];this[_0xf09e('0x1f')]={'zendesk':this[_0xf09e('0x15')],'salesforce':this[_0xf09e('0x17')],'freshdesk':this['freshdeskAccounts'],'sugarcrm':this['sugarcrmAccounts'],'zoho':this[_0xf09e('0x19')],'desk':this['deskAccounts'],'vtiger':this[_0xf09e('0x1b')],'dynamics365':this['dynamics365Accounts'],'freshsales':this[_0xf09e('0x1e')],'servicenow':this[_0xf09e('0x1c')]};ami['on'](_0xf09e('0x20'),this[_0xf09e('0x21')]['bind'](this));ami['on'](_0xf09e('0x22'),this['syncCustomEvent'][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x24'),this['syncCustomEvent'][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x25'),this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on']('custom:agentnosuchnumber',this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x26'),this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x27'),this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x28'),this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x29'),this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x2a'),this[_0xf09e('0x21')]['bind'](this));ami['on'](_0xf09e('0x2b'),this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x2c'),this[_0xf09e('0x21')]['bind'](this));ami['on'](_0xf09e('0x2d'),this[_0xf09e('0x2e')][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x2f'),this[_0xf09e('0x2e')][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x30'),this[_0xf09e('0x2e')]['bind'](this));ami['on'](_0xf09e('0x31'),this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on'](_0xf09e('0x32'),this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on']('custom:incomingmessage',this[_0xf09e('0x21')][_0xf09e('0x23')](this));ami['on']('custom:outgoingmessage',this['syncCustomEvent'][_0xf09e('0x23')](this));ami['on']('custom:acceptmessage',this[_0xf09e('0x21')]['bind'](this));ami['on'](_0xf09e('0x33'),this[_0xf09e('0x21')][_0xf09e('0x23')](this));}Trigger[_0xf09e('0x34')][_0xf09e('0x35')]=function(_0x300a81,_0x514e3c,_0x2b1591){logger[_0xf09e('0x36')](_0x300a81,_0x514e3c,JSON['stringify'](_0x2b1591));io['to'](_0x300a81)['emit'](_0x514e3c,_0x2b1591);};Trigger['prototype'][_0xf09e('0x21')]=function(_0x4a32b8){var _0x299b63=_[_0xf09e('0x37')](_0x4a32b8);this['checkTriggers'](_0x299b63);};Trigger[_0xf09e('0x34')][_0xf09e('0x2e')]=function(_0x241bde){if(this[_0xf09e('0x11')][_0x241bde[_0xf09e('0x38')]]){this[_0xf09e('0x21')](_0x241bde);}};Trigger['prototype'][_0xf09e('0x39')]=function(_0x181f89){var _0x44e751;for(var _0x2f65dc in this[_0xf09e('0x10')]){if(this[_0xf09e('0x10')]['hasOwnProperty'](_0x2f65dc)){if(this[_0xf09e('0x10')][_0x2f65dc][_0xf09e('0x3a')]){_0x44e751=this['checkTrigger'](this[_0xf09e('0x10')][_0x2f65dc],_0x181f89);if(_0x44e751){_[_0xf09e('0x3b')](_0x181f89,_0x181f89['variables']);for(var _0x425020=0x0,_0x26c9c9,_0x409fd4,_0x4cf9bd;_0x4250200x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ No newline at end of file +var _0x9957=['Motion','CTI','concat','Tags','/api/v2/users/%d','Descriptions','%s/customers/%d/cases','serverUrl','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','Displaying\x20ticket\x20to\x20agent...','user:%s','trigger:desk:display','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','Desk\x20account\x20type\x20not\x20recognized','error','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','integrationTab','newTab','%s/agent/tickets/%s','catch','unmanaged','monitor_format','lastevent','The\x20Ticket\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','./util','../../../../config/environment','../../../../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','entries','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','[HTTP]','stringify','GET','password','authType','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','%s/customers/search','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/customers','POST','work','map','includes','string','picklist','type','nameField','customField','content','idField','custom_fields','variable','variableName','customVariable','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','merge','getString','Subjects','phone','new','xCALLY'];(function(_0x3e6a1b,_0x270477){var _0xd0f251=function(_0x29d9b8){while(--_0x29d9b8){_0x3e6a1b['push'](_0x3e6a1b['shift']());}};_0xd0f251(++_0x270477);}(_0x9957,0x93));var _0x7995=function(_0x618414,_0x1a7a60){_0x618414=_0x618414-0x0;var _0x21c19a=_0x9957[_0x618414];return _0x21c19a;};'use strict';var _=require(_0x7995('0x0'));var rp=require(_0x7995('0x1'));var md5=require(_0x7995('0x2'));var util=require(_0x7995('0x3'));var Redis=require('ioredis');var intUtil=require(_0x7995('0x4'));var config=require(_0x7995('0x5'));var logger=require(_0x7995('0x6'))(_0x7995('0x7'));config['redis']=_[_0x7995('0x8')](config[_0x7995('0x9')],{'host':_0x7995('0xa'),'port':0x18eb});var io=require(_0x7995('0xb'))(new Redis(config[_0x7995('0x9')]));function emit(_0x326741,_0x4996ca,_0x465276){io['to'](_0x326741)[_0x7995('0xc')](_0x4996ca,_0x465276);}var headers={'Content-Type':'application/json','Accept':_0x7995('0xd')};function getUser(_0x3116fb,_0x18c8a3){if(intUtil[_0x7995('0xe')](_0x18c8a3)===!![]){logger[_0x7995('0xf')](_0x7995('0x10'),_0x18c8a3);return request({'uri':util[_0x7995('0x11')]('%s/users',_0x3116fb[_0x7995('0x12')])})[_0x7995('0x13')](function(_0x581f22){if(_0x581f22[_0x7995('0x14')]){return _[_0x7995('0x15')](_0x581f22[_0x7995('0x16')][_0x7995('0x17')],{'email':_0x18c8a3});}})[_0x7995('0x13')](function(_0x23999f){if(_0x23999f){logger[_0x7995('0xf')]('Agent\x20found!');return _0x23999f;}else{logger['info'](_0x7995('0x18'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb[_0x7995('0x12')])});}});}else{logger[_0x7995('0xf')](_0x7995('0x1a'));return request({'uri':util[_0x7995('0x11')](_0x7995('0x19'),_0x3116fb['remoteUri'])});}}function request(_0x2eeacc){logger['debug'](_0x7995('0x1b'),JSON[_0x7995('0x1c')](_0x2eeacc));return rp(_[_0x7995('0x8')](_0x2eeacc,{'method':_0x7995('0x1d'),'headers':headers,'json':!![]}));}function getAuth(_0x1e1415){var _0x37a7d4;if(_0x1e1415['authType']==='basic'){_0x37a7d4=util[_0x7995('0x11')]('%s:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x1e')]);}else if(_0x1e1415[_0x7995('0x1f')]==='token'){_0x37a7d4=util[_0x7995('0x11')]('%s/token:%s',_0x1e1415['username'],_0x1e1415[_0x7995('0x20')]);}return util[_0x7995('0x11')](_0x7995('0x21'),new Buffer(_0x37a7d4)[_0x7995('0x22')](_0x7995('0x23')));}function getEndUser(_0x1c278a,_0x5d40ae,_0x32a09a){logger[_0x7995('0xf')](_0x7995('0x24'),_0x32a09a);return request({'uri':util[_0x7995('0x11')](_0x7995('0x25'),_0x1c278a[_0x7995('0x12')]),'qs':{'phone':_0x32a09a}})[_0x7995('0x13')](function(_0x472195){if(_0x472195['total_entries']){logger[_0x7995('0xf')](_0x7995('0x26'));return _0x472195[_0x7995('0x16')][_0x7995('0x17')][0x0];}else{logger[_0x7995('0xf')](_0x7995('0x27'));return request({'uri':util['format'](_0x7995('0x28'),_0x1c278a['remoteUri']),'method':_0x7995('0x29'),'body':{'first_name':_0x5d40ae,'title':_0x5d40ae,'phone_numbers':[{'type':_0x7995('0x2a'),'value':_0x32a09a}]}});}});}function getTags(_0xf16cc2,_0x132a42){var _0x11c1eb=[];if(_0xf16cc2&&_0xf16cc2['length']>0x0){_0x11c1eb=_[_0x7995('0x2b')](_0xf16cc2,_0x132a42);}return _0x11c1eb;}function getCustomFields(_0x514445,_0x456a28){var _0x3250e0=[];var _0x4253e5={'custom_fields':{}};if(_0x514445['length']>0x0){_['forEach'](_0x514445,function(_0x48e573){if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x30')]&&!_0x48e573[_0x7995('0x31')]){_0x4253e5[_0x48e573['nameField']['toLowerCase']()]=_0x48e573[_0x7995('0x32')]['toString']();}else if(_[_0x7995('0x2c')]([_0x7995('0x2d'),_0x7995('0x2e')],_0x48e573[_0x7995('0x2f')])&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x48e573['content']['toString']();}else if(_0x48e573['type']===_0x7995('0x35')&&_0x48e573[_0x7995('0x36')]&&_0x48e573['idField']&&_0x48e573[_0x7995('0x31')]){_0x456a28[_0x48e573['variableName']]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573[_0x7995('0x36')]]['toString']());}else if(_0x48e573['type']===_0x7995('0x37')&&_0x48e573['Variable']&&_0x48e573['Variable'][_0x7995('0x38')]&&_0x48e573[_0x7995('0x33')]&&_0x48e573['customField']){_0x456a28[_0x48e573[_0x7995('0x39')][_0x7995('0x38')][_0x7995('0x3a')]()]&&(_0x4253e5[_0x7995('0x34')][_0x48e573[_0x7995('0x33')]]=_0x456a28[_0x48e573['Variable'][_0x7995('0x38')][_0x7995('0x3a')]()][_0x7995('0x22')]());}});}if(_0x4253e5[_0x7995('0x3b')]){_0x4253e5['priority']=Number(_0x4253e5[_0x7995('0x3b')]);}return _0x4253e5;}function getTicket(_0x235df7,_0x3eb04f,_0xe5ea43,_0x1f5bee,_0x1035dc){logger['info'](_0x7995('0x3c'));var _0x3be298=_[_0x7995('0x3d')]({'subject':intUtil[_0x7995('0x3e')](_0x1f5bee[_0x7995('0x3f')],_0x1035dc,'\x20'),'type':_0x7995('0x40'),'status':_0x7995('0x41'),'labels':[_0x7995('0x42'),_0x7995('0x43'),_0x7995('0x44')][_0x7995('0x45')](getTags(_0x1f5bee[_0x7995('0x46')],_0x7995('0x38'))),'description':intUtil['getString'](_0x1f5bee['Descriptions'],_0x1035dc,'\x0a'),'_links':{'assigned_user':{'href':util[_0x7995('0x11')](_0x7995('0x47'),_0x3eb04f['id']),'class':'user'}},'message':{'direction':'in','body':intUtil['getString'](_0x1f5bee[_0x7995('0x48')],_0x1035dc,'\x0a')}},getCustomFields(_0x1f5bee['Fields'],_0x1035dc));return request({'uri':util['format'](_0x7995('0x49'),_0x235df7[_0x7995('0x12')],_0xe5ea43['id']),'method':_0x7995('0x29'),'body':_0x3be298});}exports['queue']=function(_0x46ac4f,_0x5e85b9,_0x3993b5,_0x5a8881,_0x493066,_0x39c5b8){var _0x403f54,_0xc04e5;_0x39c5b8[_0x7995('0x12')]=intUtil['stripTrailingSlash'](_0x39c5b8[_0x7995('0x12')]);_0x39c5b8[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x39c5b8[_0x7995('0x4a')]);if(_0x493066&&_0x493066['monitor_format']){logger['info'](_0x7995('0x4c'),'Recording\x20is\x20enabled!');_0x5e85b9[_0x7995('0x4d')]=util['format'](_0x7995('0x4e'),_0x39c5b8['serverUrl'],_0x5e85b9[_0x7995('0x4f')],md5(_0x5e85b9[_0x7995('0x4f')]));}else{_0x5e85b9['recordingURL']='';}headers[_0x7995('0x50')]=getAuth(_0x39c5b8);return getUser(_0x39c5b8,_0x5a8881[_0x7995('0x51')])[_0x7995('0x13')](function(_0xb70a51){_0x403f54=_0xb70a51;logger['info'](_0x7995('0x52'),_0x403f54['id']);return getEndUser(_0x39c5b8,_0x5e85b9[_0x7995('0x53')],_0x5e85b9[_0x7995('0x54')]);})['then'](function(_0xe228a5){_0xc04e5=_0xe228a5;logger[_0x7995('0xf')](_0x7995('0x55'),_0xc04e5['id']);return getTicket(_0x39c5b8,_0x403f54,_0xc04e5,_0x3993b5,_0x5e85b9);})[_0x7995('0x13')](function(_0x255313){if(_0x255313){logger['info'](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x255313['id']);switch(_0x39c5b8[_0x7995('0x2f')]){case'integrationTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x255313['id']});break;case'newTab':logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x5a'));emit(util['format'](_0x7995('0x58'),_0x5a8881[_0x7995('0x38')]),_0x7995('0x5b'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x255313['id'])});break;default:logger['error'](_0x7995('0x4c'),_0x7995('0x5c'));}}})['catch'](function(_0x1cd85){console[_0x7995('0x5d')](_0x1cd85);logger[_0x7995('0x5d')](_0x7995('0x4c'),JSON[_0x7995('0x1c')](_0x1cd85));});};exports['outbound']=function(_0x29ee32,_0x4ab09f,_0x14fe7f,_0x33c801,_0x206d2a,_0x50c7b5,_0x5e1f34){var _0x54e2b1,_0x563f8e;_0x50c7b5[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x12')]);_0x50c7b5[_0x7995('0x4a')]=intUtil[_0x7995('0x4b')](_0x50c7b5[_0x7995('0x4a')]);if(_0x5e1f34&&_0x5e1f34[_0x7995('0x5e')]&&_0x5e1f34[_0x7995('0x5e')]!==_0x7995('0x5f')){logger[_0x7995('0xf')](_0x7995('0x60'),_0x7995('0x61'));_0x4ab09f[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x50c7b5[_0x7995('0x4a')],_0x4ab09f[_0x7995('0x4f')],md5(_0x4ab09f[_0x7995('0x4f')]));}headers[_0x7995('0x50')]=getAuth(_0x50c7b5);return getUser(_0x50c7b5,_0x33c801['email'])[_0x7995('0x13')](function(_0x630737){_0x54e2b1=_0x630737;logger[_0x7995('0xf')](_0x7995('0x52'),_0x54e2b1['id']);return getEndUser(_0x50c7b5,_0x4ab09f['destcalleridname'],_0x4ab09f['destcalleridnum']);})[_0x7995('0x13')](function(_0x197b52){_0x563f8e=_0x197b52;logger[_0x7995('0xf')](_0x7995('0x55'),_0x563f8e['id']);return getTicket(_0x50c7b5,_0x54e2b1,_0x563f8e,_0x14fe7f,_0x4ab09f);})['then'](function(_0x13cd7b){if(_0x13cd7b){logger[_0x7995('0xf')](_0x7995('0x56'));logger[_0x7995('0xf')]('The\x20Ticket\x20ID\x20is:',_0x13cd7b['id']);switch(_0x50c7b5['type']){case _0x7995('0x62'):logger[_0x7995('0xf')](_0x7995('0x4c'),_0x7995('0x57'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801[_0x7995('0x38')]),_0x7995('0x59'),{'recordId':_0x13cd7b['id']});break;case _0x7995('0x63'):logger['info'](_0x7995('0x4c'),_0x7995('0x5a'));emit(util[_0x7995('0x11')](_0x7995('0x58'),_0x33c801['name']),'trigger:browser:url',{'uri':util[_0x7995('0x11')](_0x7995('0x64'),_0x50c7b5['remoteUri'],_0x13cd7b['id'])});break;default:logger[_0x7995('0x5d')](_0x7995('0x60'),_0x7995('0x5c'));}}})[_0x7995('0x65')](function(_0x32cb04){logger['error'](_0x7995('0x60'),JSON['stringify'](_0x32cb04));});};exports[_0x7995('0x66')]=function(_0xe31dcb,_0x1722e2,_0x25b534,_0x4388c1,_0xeb8920,_0x2b3c1d){var _0x44372a,_0x10f012;_0x2b3c1d[_0x7995('0x12')]=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x12')]);_0x2b3c1d['serverUrl']=intUtil[_0x7995('0x4b')](_0x2b3c1d[_0x7995('0x4a')]);if(_0xeb8920&&_0xeb8920[_0x7995('0x67')]){logger[_0x7995('0xf')]('['+_0x1722e2[_0x7995('0x68')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x1722e2[_0x7995('0x4d')]=util[_0x7995('0x11')](_0x7995('0x4e'),_0x2b3c1d[_0x7995('0x4a')],_0x1722e2['uniqueid'],md5(_0x1722e2[_0x7995('0x4f')]));}else{_0x1722e2['recordingURL']='';}headers['Authorization']=getAuth(_0x2b3c1d);return getUser(_0x2b3c1d)[_0x7995('0x13')](function(_0x36d27d){_0x44372a=_0x36d27d;logger[_0x7995('0xf')](_0x7995('0x52'),_0x44372a['id']);return getEndUser(_0x2b3c1d,_0x1722e2[_0x7995('0x53')],_0x1722e2[_0x7995('0x54')]);})[_0x7995('0x13')](function(_0x13dc73){_0x10f012=_0x13dc73;logger[_0x7995('0xf')](_0x7995('0x55'),_0x10f012['id']);return getTicket(_0x2b3c1d,_0x44372a,_0x10f012,_0x25b534,_0x1722e2);})['then'](function(_0x2dc1f7){if(_0x2dc1f7){logger[_0x7995('0xf')](_0x7995('0x56'));logger['info'](_0x7995('0x69'),_0x2dc1f7['id']);}})[_0x7995('0x65')](function(_0x705f0){logger[_0x7995('0x5d')]('['+_0x1722e2[_0x7995('0x68')][_0x7995('0x6a')]()+']',JSON[_0x7995('0x1c')](_0x705f0));});}; \ 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 5debee5..9e69633 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 _0x97b5=['queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','stripTrailingSlash','serverUrl','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','lodash','bluebird','request-promise','util','./util','md5','ioredis','../../../../config/logger','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','clientId','remoteUri','username','password','clientSecret','then','access_token','catch',']\x20Wrong\x20credentials!','message','4.0','isNil','validateEmail','email','userEmail','length','internalemailaddress','info','toUpperCase',']\x20Agent\x20found\x20','systemuserid','userId',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','/systemusers(','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','value','telephone1',']\x20Enduser\x20created!','includes','string','type','nameField','idField','content','ticketType','getString','Descriptions','/contacts(','Fields','phonecalls','assign','callDirection'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0x97b5,0xd4));var _0x597b=function(_0x124298,_0x542004){_0x124298=_0x124298-0x0;var _0x35ac24=_0x97b5[_0x124298];return _0x35ac24;};'use strict';var _=require(_0x597b('0x0'));var BPromise=require(_0x597b('0x1'));var rp=require(_0x597b('0x2'));var util=require(_0x597b('0x3'));var intUtil=require(_0x597b('0x4'));var md5=require(_0x597b('0x5'));var Redis=require(_0x597b('0x6'));var logger=require(_0x597b('0x7'))('dynamics365');var config=require(_0x597b('0x8'));config[_0x597b('0x9')]=_[_0x597b('0xa')](config[_0x597b('0x9')],{'host':_0x597b('0xb'),'port':0x18eb});var io=require(_0x597b('0xc'))(new Redis(config[_0x597b('0x9')]));function getAuthToken(_0x26fee2,_0x519882,_0x54efb1){var _0x1c8d89={'method':_0x597b('0xd'),'uri':_0x519882,'form':{'client_id':_0x26fee2[_0x597b('0xe')],'resource':_0x26fee2[_0x597b('0xf')],'username':_0x26fee2[_0x597b('0x10')],'password':_0x26fee2['password'],'grant_type':_0x597b('0x11'),'client_secret':_0x26fee2[_0x597b('0x12')]},'json':!![]};return rp(_0x1c8d89)[_0x597b('0x13')](function(_0x47250f){return _0x47250f[_0x597b('0x14')];})[_0x597b('0x15')](function(_0x4d1c1c){logger['error']('['+[_0x54efb1['toUpperCase']()]+_0x597b('0x16'));return _0x4d1c1c[_0x597b('0x17')];});}function getUser(_0x137311,_0x4cd00e,_0x3d09bb,_0x3a0806,_0x1e487d,_0x2e83c2){return new BPromise(function(_0x38d53b,_0x1396aa){return getAuthToken(_0x4cd00e,_0x3a0806,_0x2e83c2)[_0x597b('0x13')](function(_0x441f33){var _0x39dca0={'method':'GET','uri':_0x1e487d+'systemusers?$select=internalemailaddress,isdisabled,systemuserid','headers':{'Authorization':'Bearer\x20'+_0x441f33,'OData-Version':_0x597b('0x18')},'json':!![]};return rp(_0x39dca0);})[_0x597b('0x13')](function(_0x536e10){var _0x17d44b=_0x536e10['value'];var _0x4381c6=![];var _0x42a9ed=null;if(!_[_0x597b('0x19')](_0x3d09bb)){if(intUtil[_0x597b('0x1a')](_0x3d09bb[_0x597b('0x1b')])){_0x137311[_0x597b('0x1c')]=_0x3d09bb[_0x597b('0x1b')];for(_0x42a9ed=0x0;_0x42a9ed<_0x17d44b[_0x597b('0x1d')];_0x42a9ed++){if(_0x17d44b[_0x42a9ed][_0x597b('0x1e')]===_0x3d09bb['email']&&!_0x17d44b[_0x42a9ed]['isdisabled']){_0x4381c6=!![];logger[_0x597b('0x1f')]('['+[_0x2e83c2[_0x597b('0x20')]()]+_0x597b('0x21')+_0x17d44b[_0x42a9ed][_0x597b('0x22')]+'!');_0x137311[_0x597b('0x23')]=_0x17d44b[_0x42a9ed][_0x597b('0x22')];}}}}if(!_0x4381c6){logger['info']('['+[_0x2e83c2[_0x597b('0x20')]()]+_0x597b('0x24'));_0x137311['userEmail']=_0x4cd00e[_0x597b('0x10')];for(_0x42a9ed=0x0;_0x42a9ed<_0x17d44b[_0x597b('0x1d')];_0x42a9ed++){if(_0x17d44b[_0x42a9ed][_0x597b('0x1e')]===_0x4cd00e[_0x597b('0x10')]){_0x137311[_0x597b('0x23')]=_0x17d44b[_0x42a9ed][_0x597b('0x22')];}}}_0x38d53b(_0x137311);})[_0x597b('0x15')](function(_0x401fc4){_0x1396aa(_0x401fc4[_0x597b('0x17')]);});});}function createEndUser(_0x3a39f1,_0x51d786,_0x5a4635,_0x4ee9a1,_0x13a701,_0x1b0319){return new BPromise(function(_0x2b7e6b,_0x38da67){return getAuthToken(_0x51d786,_0x5a4635,_0x1b0319)[_0x597b('0x13')](function(_0x4c9e47){var _0x50f0ae=_0x1b0319[_0x597b('0x25')]()===_0x597b('0x26')?_0x13a701[_0x597b('0x27')]:_0x13a701[_0x597b('0x28')];var _0x201fe8={'method':'POST','uri':_0x4ee9a1+_0x597b('0x29'),'body':{'telephone1':_0x50f0ae,'fullname':_0x50f0ae,'firstname':_0x50f0ae,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':_0x597b('0x2a')+_0x3a39f1[_0x597b('0x23')]+')'},'headers':{'Authorization':_0x597b('0x2b')+_0x4c9e47,'OData-Version':_0x597b('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0x201fe8);})[_0x597b('0x13')](function(_0x126586){var _0x2e2a06=_0x126586[_0x597b('0x2c')][_0x597b('0x2d')];var _0xde3484=_0x2e2a06[_0x597b('0x2e')](_0x2e2a06['lastIndexOf']('(')+0x1,_0x2e2a06[_0x597b('0x2f')](')'));_0x3a39f1[_0x597b('0x30')]=_0xde3484;_0x2b7e6b(_0x3a39f1);})[_0x597b('0x15')](function(_0x7e7de0){_0x38da67(_0x7e7de0[_0x597b('0x17')]);});});}function getEndUser(_0x4ff6c8,_0x56b433,_0x2efe56,_0x174db1,_0x471dc9,_0xa285f3){return new BPromise(function(_0x10a037,_0x3c9eff){var _0x4f412c=_0xa285f3[_0x597b('0x25')]()===_0x597b('0x26')?_0x471dc9[_0x597b('0x27')]:_0x471dc9[_0x597b('0x28')];return getAuthToken(_0x56b433,_0x2efe56,_0xa285f3)['then'](function(_0x5bf8d8){var _0x3a8cb8={'method':_0x597b('0x31'),'uri':_0x174db1+_0x597b('0x32')+_0x4f412c[_0x597b('0x33')]('+',_0x597b('0x34'))+'\x27','headers':{'Authorization':_0x597b('0x2b')+_0x5bf8d8,'If-None-Match':null,'OData-Version':_0x597b('0x18')},'json':!![]};return rp(_0x3a8cb8);})[_0x597b('0x13')](function(_0x46d994){var _0x8674eb=null;if(_0x46d994){var _0x4408fa=_0x46d994[_0x597b('0x35')];var _0x10fcdc=![];for(_0x8674eb=0x0;_0x8674eb<_0x4408fa[_0x597b('0x1d')];_0x8674eb++){if(_0x4408fa[_0x8674eb][_0x597b('0x36')]===_0x4f412c){_0x10fcdc=!![];_0x4ff6c8[_0x597b('0x30')]=_0x4408fa[_0x8674eb]['contactid'];}}if(_0x10fcdc){_0x10a037(_0x4ff6c8);}else{return createEndUser(_0x4ff6c8,_0x56b433,_0x2efe56,_0x174db1,_0x471dc9,_0xa285f3)[_0x597b('0x13')](function(_0x58d783){logger['info']('['+[_0xa285f3[_0x597b('0x20')]()]+_0x597b('0x37'),_0x58d783['enduserId']);_0x10a037(_0x58d783);});}}else{return createEndUser(_0x4ff6c8,_0x56b433,_0x2efe56,_0x174db1,_0x471dc9,_0xa285f3)['then'](function(_0x36d003){logger[_0x597b('0x1f')]('['+[_0xa285f3['toUpperCase']()]+']\x20Enduser\x20Created!',_0x36d003['enduserId']);_0x10a037(_0x36d003);});}});});}function getCustomFields(_0x4fc905,_0x404e30,_0x2632a1){var _0x3c9f0b={};if(_0x4fc905[_0x597b('0x1d')]>0x0){_['forEach'](_0x4fc905,function(_0x2972a0){if(_[_0x597b('0x38')]([_0x597b('0x39'),'picklist'],_0x2972a0[_0x597b('0x3a')])&&_0x2972a0[_0x597b('0x3b')]&&!_0x2972a0['customField']){var _0xd70a22=_0x2972a0[_0x597b('0x3c')]['toLowerCase']();var _0x3e5939=_0xd70a22[_0x597b('0x2e')](0x0,_0xd70a22['indexOf']('_'));var _0x52c13a=_0xd70a22[_0x597b('0x2e')](_0xd70a22['indexOf']('_')+0x1);if(_0x3e5939===_0x2632a1){_0x3c9f0b[_0x52c13a]=_0x2972a0[_0x597b('0x3d')];}}});}return _0x3c9f0b;}function getTicket(_0x11951b,_0xa17d98,_0x193349,_0x26f3c1,_0x5c1a3d,_0xd4671a,_0x132512){return new BPromise(function(_0x1e0b4f,_0x447d61){var _0x687750;return getAuthToken(_0xa17d98,_0x193349,_0x132512)[_0x597b('0x13')](function(_0x3dd3cd){if(_0xd4671a[_0x597b('0x3e')]==='incident'){_0x687750={'method':_0x597b('0xd'),'uri':_0x26f3c1+'incidents','body':Object['assign']({},{'title':intUtil[_0x597b('0x3f')](_0xd4671a['Subjects'],_0x5c1a3d,'\x20'),'description':intUtil['getString'](_0xd4671a[_0x597b('0x40')],_0x5c1a3d,'\x0a'),'customerid_contact@odata.bind':_0x597b('0x41')+_0x11951b['enduserId']+')','ownerid@odata.bind':'/systemusers('+_0x11951b[_0x597b('0x23')]+')','caseorigincode':'1'},getCustomFields(_0xd4671a[_0x597b('0x42')],_0x5c1a3d,_0xd4671a['ticketType'])),'headers':{'Authorization':_0x597b('0x2b')+_0x3dd3cd,'OData-Version':_0x597b('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0xd4671a['ticketType']==='phonecall'){_0x687750={'method':_0x597b('0xd'),'uri':_0x26f3c1+_0x597b('0x43'),'body':Object[_0x597b('0x44')]({},{'subject':intUtil[_0x597b('0x3f')](_0xd4671a['Subjects'],_0x5c1a3d,'\x20'),'phonenumber':String(_0x5c1a3d['calleridnum']),'description':intUtil[_0x597b('0x3f')](_0xd4671a[_0x597b('0x40')],_0x5c1a3d,'\x0a'),'regardingobjectid_contact@odata.bind':_0x597b('0x41')+_0x11951b[_0x597b('0x30')]+')','ownerid@odata.bind':_0x597b('0x2a')+_0x11951b['userId']+')','directioncode':_0x11951b[_0x597b('0x45')]===_0x597b('0x46')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0x597b('0x2a')+_0x11951b['userId']+')','participationtypemask':_0x11951b[_0x597b('0x45')]===_0x597b('0x46')?0x2:0x1},{'partyid_contact@odata.bind':_0x597b('0x41')+_0x11951b['enduserId']+')','participationtypemask':_0x11951b[_0x597b('0x45')]===_0x597b('0x46')?0x1:0x2}]},getCustomFields(_0xd4671a[_0x597b('0x42')],_0x5c1a3d,_0xd4671a[_0x597b('0x3e')])),'headers':{'Authorization':'Bearer\x20'+_0x3dd3cd,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x687750);})[_0x597b('0x13')](function(_0x3d4796){var _0x3e9afd=_0x3d4796[_0x597b('0x2c')][_0x597b('0x2d')];var _0x2c394f=_0x3e9afd['substring'](_0x3e9afd[_0x597b('0x2f')]('(')+0x1,_0x3e9afd[_0x597b('0x2f')](')'));_0x11951b['ticketId']=_0x2c394f;_0x1e0b4f(_0x11951b);})[_0x597b('0x15')](function(_0xd519cb){_0x447d61(_0xd519cb[_0x597b('0x17')]);});});}function emit(_0x27d638,_0x17abbf,_0x5ccc4f,_0x49f9eb){var _0x545d9e={'uri':util[_0x597b('0x47')](_0x597b('0x48'),_0x27d638,_0x5ccc4f,_0x49f9eb)};io['to'](util[_0x597b('0x47')](_0x597b('0x49'),_0x17abbf))[_0x597b('0x4a')]('trigger:browser:url',_0x545d9e);}exports['cs']=function(_0x5238a9,_0x52584e,_0x28723b,_0x19979e,_0x20eacb,_0x3171e6,_0x76ea7c,_0x3001df){var _0x2f80de={};_0x3171e6[_0x597b('0xf')]=intUtil[_0x597b('0x4b')](_0x3171e6[_0x597b('0xf')]);_0x3171e6[_0x597b('0x4c')]=intUtil['stripTrailingSlash'](_0x3171e6[_0x597b('0x4c')]);_0x2f80de[_0x597b('0x45')]=_0x3001df==='queue'||_0x3001df==='unmanaged'?_0x597b('0x46'):_0x597b('0x26');var _0x1ee332=util[_0x597b('0x47')](_0x597b('0x4d'),_0x3171e6['remoteUri']);var _0x202aa6=util['format']('https://login.microsoftonline.com/%s/oauth2/token',_0x3171e6['tenantId']);var _0x2ac9ba=util[_0x597b('0x47')](_0x597b('0x4e'),_0x3171e6[_0x597b('0x4c')],_0x52584e[_0x597b('0x4f')],md5(_0x52584e[_0x597b('0x4f')]));if(_0x20eacb&&_0x20eacb[_0x597b('0x50')]){logger['info']('[QUEUE]',_0x597b('0x51'));_0x52584e[_0x597b('0x52')]=_0x2ac9ba;}else if(_0x76ea7c&&_0x76ea7c[_0x597b('0x53')]&&_0x76ea7c[_0x597b('0x53')]!==_0x597b('0x54')){logger[_0x597b('0x1f')](_0x597b('0x55'),_0x597b('0x51'));_0x52584e[_0x597b('0x52')]=_0x2ac9ba;}else{_0x52584e[_0x597b('0x52')]='';}return getUser(_0x2f80de,_0x3171e6,_0x19979e,_0x202aa6,_0x1ee332,_0x3001df)[_0x597b('0x13')](function(_0x55adcb){logger[_0x597b('0x1f')]('['+_0x3001df[_0x597b('0x20')]()+_0x597b('0x56'),_0x55adcb[_0x597b('0x23')]);logger[_0x597b('0x1f')]('['+_0x3001df[_0x597b('0x20')]()+_0x597b('0x57'),_0x55adcb['userEmail']);return getEndUser(_0x55adcb,_0x3171e6,_0x202aa6,_0x1ee332,_0x52584e,_0x3001df);})[_0x597b('0x13')](function(_0x259eec){logger[_0x597b('0x1f')]('['+_0x3001df[_0x597b('0x20')]()+_0x597b('0x58'),_0x259eec[_0x597b('0x30')]);logger[_0x597b('0x1f')]('['+_0x3001df[_0x597b('0x20')]()+']\x20The\x20Enduser\x20phone\x20is:',_0x52584e[_0x597b('0x28')]);return getTicket(_0x259eec,_0x3171e6,_0x202aa6,_0x1ee332,_0x52584e,_0x28723b,_0x3001df);})['then'](function(_0x18a519){logger[_0x597b('0x1f')](util[_0x597b('0x47')]('['+_0x3001df['toUpperCase']()+_0x597b('0x59'),_0x28723b[_0x597b('0x3e')],_0x18a519[_0x597b('0x5a')]));logger[_0x597b('0x1f')](util['format']('['+_0x3001df[_0x597b('0x20')]()+']\x20Call\x20direction:\x20%s',_0x3001df));if(_0x3001df!=='unmanaged'){logger[_0x597b('0x1f')]('['+_0x3001df[_0x597b('0x20')]()+']',_0x597b('0x5b'));emit(_0x3171e6[_0x597b('0xf')],_0x19979e['name'],_0x28723b[_0x597b('0x3e')],_0x18a519[_0x597b('0x5a')]);}})[_0x597b('0x15')](function(_0x3596e9){logger['error']('['+_0x3001df[_0x597b('0x20')]()+_0x597b('0x5c'),util[_0x597b('0x5d')](_0x3596e9,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x1d7e=['callDirection','queue','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','https://login.microsoftonline.com/%s/oauth2/token','tenantId','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:','ticketId',']\x20Call\x20direction:\x20%s','name',']\x20Error\x20running\x20Dynamics365\x20integration','inspect','bluebird','request-promise','util','md5','../../../../config/logger','dynamics365','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','POST','remoteUri','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','4.0','value','isNil','validateEmail','email','userEmail','internalemailaddress','isdisabled','info','systemuserid','userId','username','length','toLowerCase','destcalleridnum','Bearer\x20','headers','odata-entityid','substring','lastIndexOf','enduserId','outbound','calleridnum','contacts?$select=telephone1&$filter=telephone1\x20eq\x20\x27','replace','%2b','telephone1','contactid',']\x20Enduser\x20created!','forEach','includes','string','picklist','type','nameField','indexOf','ticketType','incident','incidents','getString','Subjects','Descriptions','/contacts(','/systemusers(','Fields','phonecall','assign'];(function(_0x5074c7,_0x3d5226){var _0x4554db=function(_0x24c658){while(--_0x24c658){_0x5074c7['push'](_0x5074c7['shift']());}};_0x4554db(++_0x3d5226);}(_0x1d7e,0x7d));var _0xe1d7=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x1d7e[_0xa464c9];return _0x3d73c4;};'use strict';var _=require('lodash');var BPromise=require(_0xe1d7('0x0'));var rp=require(_0xe1d7('0x1'));var util=require(_0xe1d7('0x2'));var intUtil=require('./util');var md5=require(_0xe1d7('0x3'));var Redis=require('ioredis');var logger=require(_0xe1d7('0x4'))(_0xe1d7('0x5'));var config=require(_0xe1d7('0x6'));config[_0xe1d7('0x7')]=_[_0xe1d7('0x8')](config[_0xe1d7('0x7')],{'host':_0xe1d7('0x9'),'port':0x18eb});var io=require(_0xe1d7('0xa'))(new Redis(config[_0xe1d7('0x7')]));function getAuthToken(_0x439ffd,_0x3f1859,_0x494eaf){var _0x366005={'method':_0xe1d7('0xb'),'uri':_0x3f1859,'form':{'client_id':_0x439ffd['clientId'],'resource':_0x439ffd[_0xe1d7('0xc')],'username':_0x439ffd['username'],'password':_0x439ffd[_0xe1d7('0xd')],'grant_type':'password','client_secret':_0x439ffd[_0xe1d7('0xe')]},'json':!![]};return rp(_0x366005)['then'](function(_0x4ae583){return _0x4ae583[_0xe1d7('0xf')];})[_0xe1d7('0x10')](function(_0x785b8c){logger[_0xe1d7('0x11')]('['+[_0x494eaf[_0xe1d7('0x12')]()]+_0xe1d7('0x13'));return _0x785b8c[_0xe1d7('0x14')];});}function getUser(_0x383b18,_0x58fb5b,_0x6e0dc7,_0x247286,_0x156a3f,_0x3d3d8d){return new BPromise(function(_0x193a0e,_0x2d017a){return getAuthToken(_0x58fb5b,_0x247286,_0x3d3d8d)[_0xe1d7('0x15')](function(_0x565278){var _0x391f55={'method':_0xe1d7('0x16'),'uri':_0x156a3f+_0xe1d7('0x17'),'headers':{'Authorization':'Bearer\x20'+_0x565278,'OData-Version':_0xe1d7('0x18')},'json':!![]};return rp(_0x391f55);})[_0xe1d7('0x15')](function(_0x800c15){var _0x1f82ce=_0x800c15[_0xe1d7('0x19')];var _0x446ce6=![];var _0xdad949=null;if(!_[_0xe1d7('0x1a')](_0x6e0dc7)){if(intUtil[_0xe1d7('0x1b')](_0x6e0dc7[_0xe1d7('0x1c')])){_0x383b18[_0xe1d7('0x1d')]=_0x6e0dc7[_0xe1d7('0x1c')];for(_0xdad949=0x0;_0xdad949<_0x1f82ce['length'];_0xdad949++){if(_0x1f82ce[_0xdad949][_0xe1d7('0x1e')]===_0x6e0dc7[_0xe1d7('0x1c')]&&!_0x1f82ce[_0xdad949][_0xe1d7('0x1f')]){_0x446ce6=!![];logger[_0xe1d7('0x20')]('['+[_0x3d3d8d[_0xe1d7('0x12')]()]+']\x20Agent\x20found\x20'+_0x1f82ce[_0xdad949][_0xe1d7('0x21')]+'!');_0x383b18[_0xe1d7('0x22')]=_0x1f82ce[_0xdad949][_0xe1d7('0x21')];}}}}if(!_0x446ce6){logger[_0xe1d7('0x20')]('['+[_0x3d3d8d[_0xe1d7('0x12')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x383b18[_0xe1d7('0x1d')]=_0x58fb5b[_0xe1d7('0x23')];for(_0xdad949=0x0;_0xdad949<_0x1f82ce[_0xe1d7('0x24')];_0xdad949++){if(_0x1f82ce[_0xdad949][_0xe1d7('0x1e')]===_0x58fb5b[_0xe1d7('0x23')]){_0x383b18[_0xe1d7('0x22')]=_0x1f82ce[_0xdad949][_0xe1d7('0x21')];}}}_0x193a0e(_0x383b18);})[_0xe1d7('0x10')](function(_0x1fed8c){_0x2d017a(_0x1fed8c[_0xe1d7('0x14')]);});});}function createEndUser(_0x55446d,_0x672bed,_0x7c1923,_0x3abcb3,_0x4fea12,_0x11dde2){return new BPromise(function(_0x4079db,_0x19c671){return getAuthToken(_0x672bed,_0x7c1923,_0x11dde2)[_0xe1d7('0x15')](function(_0x471c82){var _0x42e74d=_0x11dde2[_0xe1d7('0x25')]()==='outbound'?_0x4fea12[_0xe1d7('0x26')]:_0x4fea12['calleridnum'];var _0xbc38f3={'method':_0xe1d7('0xb'),'uri':_0x3abcb3+'contacts','body':{'telephone1':_0x42e74d,'fullname':_0x42e74d,'firstname':_0x42e74d,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x55446d[_0xe1d7('0x22')]+')'},'headers':{'Authorization':_0xe1d7('0x27')+_0x471c82,'OData-Version':_0xe1d7('0x18')},'json':!![],'resolveWithFullResponse':!![]};return rp(_0xbc38f3);})[_0xe1d7('0x15')](function(_0x2786d0){var _0x5bf10c=_0x2786d0[_0xe1d7('0x28')][_0xe1d7('0x29')];var _0x7df62f=_0x5bf10c[_0xe1d7('0x2a')](_0x5bf10c[_0xe1d7('0x2b')]('(')+0x1,_0x5bf10c['lastIndexOf'](')'));_0x55446d[_0xe1d7('0x2c')]=_0x7df62f;_0x4079db(_0x55446d);})[_0xe1d7('0x10')](function(_0x380157){_0x19c671(_0x380157[_0xe1d7('0x14')]);});});}function getEndUser(_0x430acd,_0x39a866,_0x1c044b,_0x39302a,_0x542d78,_0x2df96d){return new BPromise(function(_0x15ba98,_0x3a0aab){var _0x5b3fd0=_0x2df96d[_0xe1d7('0x25')]()===_0xe1d7('0x2d')?_0x542d78[_0xe1d7('0x26')]:_0x542d78[_0xe1d7('0x2e')];return getAuthToken(_0x39a866,_0x1c044b,_0x2df96d)[_0xe1d7('0x15')](function(_0x118d32){var _0x4fd7a5={'method':_0xe1d7('0x16'),'uri':_0x39302a+_0xe1d7('0x2f')+_0x5b3fd0[_0xe1d7('0x30')]('+',_0xe1d7('0x31'))+'\x27','headers':{'Authorization':_0xe1d7('0x27')+_0x118d32,'If-None-Match':null,'OData-Version':_0xe1d7('0x18')},'json':!![]};return rp(_0x4fd7a5);})['then'](function(_0x3b3e1b){var _0x228f2c=null;if(_0x3b3e1b){var _0x36f1d6=_0x3b3e1b['value'];var _0x33ba92=![];for(_0x228f2c=0x0;_0x228f2c<_0x36f1d6[_0xe1d7('0x24')];_0x228f2c++){if(_0x36f1d6[_0x228f2c][_0xe1d7('0x32')]===_0x5b3fd0){_0x33ba92=!![];_0x430acd['enduserId']=_0x36f1d6[_0x228f2c][_0xe1d7('0x33')];}}if(_0x33ba92){_0x15ba98(_0x430acd);}else{return createEndUser(_0x430acd,_0x39a866,_0x1c044b,_0x39302a,_0x542d78,_0x2df96d)['then'](function(_0x558000){logger[_0xe1d7('0x20')]('['+[_0x2df96d['toUpperCase']()]+_0xe1d7('0x34'),_0x558000[_0xe1d7('0x2c')]);_0x15ba98(_0x558000);});}}else{return createEndUser(_0x430acd,_0x39a866,_0x1c044b,_0x39302a,_0x542d78,_0x2df96d)[_0xe1d7('0x15')](function(_0x524137){logger[_0xe1d7('0x20')]('['+[_0x2df96d[_0xe1d7('0x12')]()]+']\x20Enduser\x20Created!',_0x524137[_0xe1d7('0x2c')]);_0x15ba98(_0x524137);});}});});}function getCustomFields(_0x4fe6c0,_0x30f07a,_0x4def25){var _0x637d0e={};if(_0x4fe6c0[_0xe1d7('0x24')]>0x0){_[_0xe1d7('0x35')](_0x4fe6c0,function(_0x2854b5){if(_[_0xe1d7('0x36')]([_0xe1d7('0x37'),_0xe1d7('0x38')],_0x2854b5[_0xe1d7('0x39')])&&_0x2854b5[_0xe1d7('0x3a')]&&!_0x2854b5['customField']){var _0x2e587d=_0x2854b5['idField'][_0xe1d7('0x25')]();var _0xf92029=_0x2e587d[_0xe1d7('0x2a')](0x0,_0x2e587d[_0xe1d7('0x3b')]('_'));var _0xcbd4b2=_0x2e587d[_0xe1d7('0x2a')](_0x2e587d[_0xe1d7('0x3b')]('_')+0x1);if(_0xf92029===_0x4def25){_0x637d0e[_0xcbd4b2]=_0x2854b5['content'];}}});}return _0x637d0e;}function getTicket(_0x26d1b0,_0x2841ce,_0x2e7f23,_0x2b195b,_0x19e219,_0x477505,_0x579963){return new BPromise(function(_0xb1420a,_0x286142){var _0x1b2733;return getAuthToken(_0x2841ce,_0x2e7f23,_0x579963)['then'](function(_0x1cb180){if(_0x477505[_0xe1d7('0x3c')]===_0xe1d7('0x3d')){_0x1b2733={'method':_0xe1d7('0xb'),'uri':_0x2b195b+_0xe1d7('0x3e'),'body':Object['assign']({},{'title':intUtil[_0xe1d7('0x3f')](_0x477505[_0xe1d7('0x40')],_0x19e219,'\x20'),'description':intUtil[_0xe1d7('0x3f')](_0x477505[_0xe1d7('0x41')],_0x19e219,'\x0a'),'customerid_contact@odata.bind':_0xe1d7('0x42')+_0x26d1b0[_0xe1d7('0x2c')]+')','ownerid@odata.bind':_0xe1d7('0x43')+_0x26d1b0[_0xe1d7('0x22')]+')','caseorigincode':'1'},getCustomFields(_0x477505[_0xe1d7('0x44')],_0x19e219,_0x477505[_0xe1d7('0x3c')])),'headers':{'Authorization':'Bearer\x20'+_0x1cb180,'OData-Version':_0xe1d7('0x18')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x477505[_0xe1d7('0x3c')]===_0xe1d7('0x45')){_0x1b2733={'method':'POST','uri':_0x2b195b+'phonecalls','body':Object[_0xe1d7('0x46')]({},{'subject':intUtil[_0xe1d7('0x3f')](_0x477505[_0xe1d7('0x40')],_0x19e219,'\x20'),'phonenumber':String(_0x19e219[_0xe1d7('0x2e')]),'description':intUtil[_0xe1d7('0x3f')](_0x477505['Descriptions'],_0x19e219,'\x0a'),'regardingobjectid_contact@odata.bind':_0xe1d7('0x42')+_0x26d1b0['enduserId']+')','ownerid@odata.bind':_0xe1d7('0x43')+_0x26d1b0[_0xe1d7('0x22')]+')','directioncode':_0x26d1b0[_0xe1d7('0x47')]===_0xe1d7('0x48')?![]:!![],'phonecall_activity_parties':[{'partyid_systemuser@odata.bind':_0xe1d7('0x43')+_0x26d1b0['userId']+')','participationtypemask':_0x26d1b0[_0xe1d7('0x47')]===_0xe1d7('0x48')?0x2:0x1},{'partyid_contact@odata.bind':_0xe1d7('0x42')+_0x26d1b0['enduserId']+')','participationtypemask':_0x26d1b0[_0xe1d7('0x47')]===_0xe1d7('0x48')?0x1:0x2}]},getCustomFields(_0x477505[_0xe1d7('0x44')],_0x19e219,_0x477505['ticketType'])),'headers':{'Authorization':_0xe1d7('0x27')+_0x1cb180,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x1b2733);})[_0xe1d7('0x15')](function(_0x2b53e1){var _0x43b462=_0x2b53e1['headers']['odata-entityid'];var _0x247a08=_0x43b462[_0xe1d7('0x2a')](_0x43b462[_0xe1d7('0x2b')]('(')+0x1,_0x43b462[_0xe1d7('0x2b')](')'));_0x26d1b0['ticketId']=_0x247a08;_0xb1420a(_0x26d1b0);})[_0xe1d7('0x10')](function(_0x162f29){_0x286142(_0x162f29[_0xe1d7('0x14')]);});});}function emit(_0x421b83,_0x59b758,_0x9b6dcd,_0x3f1c47){var _0x34585d={'uri':util[_0xe1d7('0x49')](_0xe1d7('0x4a'),_0x421b83,_0x9b6dcd,_0x3f1c47)};io['to'](util['format'](_0xe1d7('0x4b'),_0x59b758))[_0xe1d7('0x4c')](_0xe1d7('0x4d'),_0x34585d);}exports['cs']=function(_0x443d13,_0x4aa854,_0x22b144,_0x5bc050,_0x164f98,_0x3b4318,_0x2105d1,_0x422a1d){var _0x4b1118={};_0x3b4318[_0xe1d7('0xc')]=intUtil[_0xe1d7('0x4e')](_0x3b4318['remoteUri']);_0x3b4318[_0xe1d7('0x4f')]=intUtil[_0xe1d7('0x4e')](_0x3b4318[_0xe1d7('0x4f')]);_0x4b1118[_0xe1d7('0x47')]=_0x422a1d===_0xe1d7('0x48')||_0x422a1d===_0xe1d7('0x50')?_0xe1d7('0x48'):_0xe1d7('0x2d');var _0x3834f3=util[_0xe1d7('0x49')]('%s/api/data/v9.0/',_0x3b4318['remoteUri']);var _0x52d0dc=util[_0xe1d7('0x49')](_0xe1d7('0x51'),_0x3b4318[_0xe1d7('0x52')]);var _0x56a5df=util['format'](_0xe1d7('0x53'),_0x3b4318[_0xe1d7('0x4f')],_0x4aa854['uniqueid'],md5(_0x4aa854['uniqueid']));if(_0x164f98&&_0x164f98[_0xe1d7('0x54')]){logger[_0xe1d7('0x20')](_0xe1d7('0x55'),_0xe1d7('0x56'));_0x4aa854[_0xe1d7('0x57')]=_0x56a5df;}else if(_0x2105d1&&_0x2105d1[_0xe1d7('0x58')]&&_0x2105d1['recordingFormat']!=='none'){logger[_0xe1d7('0x20')]('[OUTBOUND]',_0xe1d7('0x56'));_0x4aa854['recordingURL']=_0x56a5df;}else{_0x4aa854['recordingURL']='';}return getUser(_0x4b1118,_0x3b4318,_0x5bc050,_0x52d0dc,_0x3834f3,_0x422a1d)[_0xe1d7('0x15')](function(_0x5d3b70){logger[_0xe1d7('0x20')]('['+_0x422a1d['toUpperCase']()+_0xe1d7('0x59'),_0x5d3b70[_0xe1d7('0x22')]);logger[_0xe1d7('0x20')]('['+_0x422a1d[_0xe1d7('0x12')]()+_0xe1d7('0x5a'),_0x5d3b70[_0xe1d7('0x1d')]);return getEndUser(_0x5d3b70,_0x3b4318,_0x52d0dc,_0x3834f3,_0x4aa854,_0x422a1d);})[_0xe1d7('0x15')](function(_0x3a9562){logger['info']('['+_0x422a1d[_0xe1d7('0x12')]()+_0xe1d7('0x5b'),_0x3a9562[_0xe1d7('0x2c')]);logger[_0xe1d7('0x20')]('['+_0x422a1d['toUpperCase']()+_0xe1d7('0x5c'),_0x4aa854[_0xe1d7('0x2e')]);return getTicket(_0x3a9562,_0x3b4318,_0x52d0dc,_0x3834f3,_0x4aa854,_0x22b144,_0x422a1d);})['then'](function(_0x1f41c0){logger['info'](util[_0xe1d7('0x49')]('['+_0x422a1d['toUpperCase']()+']\x20The\x20%s\x20ID\x20is:\x20%s',_0x22b144[_0xe1d7('0x3c')],_0x1f41c0[_0xe1d7('0x5d')]));logger[_0xe1d7('0x20')](util[_0xe1d7('0x49')]('['+_0x422a1d[_0xe1d7('0x12')]()+_0xe1d7('0x5e'),_0x422a1d));if(_0x422a1d!==_0xe1d7('0x50')){logger[_0xe1d7('0x20')]('['+_0x422a1d[_0xe1d7('0x12')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x3b4318[_0xe1d7('0xc')],_0x5bc050[_0xe1d7('0x5f')],_0x22b144['ticketType'],_0x1f41c0[_0xe1d7('0x5d')]);}})[_0xe1d7('0x10')](function(_0x2ae67a){logger[_0xe1d7('0x11')]('['+_0x422a1d['toUpperCase']()+_0xe1d7('0x60'),util[_0xe1d7('0x61')](_0x2ae67a,{'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 389f6b9..659c1bc 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 _0xd6d7=['Subjects','getString','Descriptions','
','Tags','name','Fields','mapValues','keyBy','custom_fields','value','format','%s/api/v2/tickets','remoteUri','POST','then','%s/api/v2/agents','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','length','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','picklist','type','customField','nameField','toLowerCase','content','idField','push','variable','variableName','Variable','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','%s/helpdesk/tickets/%d','catch','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','user:%s','trigger:browser:url','error','unmanaged','lastevent','Authorization','The\x20Enduser\x20ID\x20is:','toUpperCase','lodash','request-promise','md5','util','ioredis','../../../../config/environment','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridname'];(function(_0x1344d6,_0x2181e6){var _0xf45b24=function(_0x2d90c1){while(--_0x2d90c1){_0x1344d6['push'](_0x1344d6['shift']());}};_0xf45b24(++_0x2181e6);}(_0xd6d7,0xb2));var _0x7d6d=function(_0x4d9822,_0x408dec){_0x4d9822=_0x4d9822-0x0;var _0x5a0505=_0xd6d7[_0x4d9822];return _0x5a0505;};'use strict';var _=require(_0x7d6d('0x0'));var rp=require(_0x7d6d('0x1'));var md5=require(_0x7d6d('0x2'));var util=require(_0x7d6d('0x3'));var Redis=require(_0x7d6d('0x4'));var intUtil=require('./util');var config=require(_0x7d6d('0x5'));var logger=require('../../../../config/logger')(_0x7d6d('0x6'));config[_0x7d6d('0x7')]=_[_0x7d6d('0x8')](config[_0x7d6d('0x7')],{'host':'localhost','port':0x18eb});var io=require(_0x7d6d('0x9'))(new Redis(config['redis']));var headers={'Content-Type':_0x7d6d('0xa'),'Accept':_0x7d6d('0xa')};function emit(_0x323b30,_0x4617c7,_0x3f3722){io['to'](_0x323b30)[_0x7d6d('0xb')](_0x4617c7,_0x3f3722);}function getTicket(_0x2e36a2,_0x5869f7,_0x497a4c,_0x2f5085,_0x37ac5f){logger[_0x7d6d('0xc')](_0x7d6d('0xd'));var _0x4e453f=_[_0x7d6d('0xe')]({'responder_id':_0x5869f7['id'],'requester_id':_0x497a4c['id'],'name':util['format']('Caller\x20-\x20%s',_0x37ac5f[_0x7d6d('0xf')]),'phone':_0x37ac5f['calleridnum'],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x2f5085[_0x7d6d('0x10')],_0x37ac5f,'\x20'),'description':intUtil[_0x7d6d('0x11')](_0x2f5085[_0x7d6d('0x12')],_0x37ac5f,_0x7d6d('0x13')),'tags':getTags(_0x2f5085[_0x7d6d('0x14')],_0x7d6d('0x15'))},getCustomFields(_0x2f5085[_0x7d6d('0x16')],_0x37ac5f));_0x4e453f['custom_fields']=_[_0x7d6d('0x17')](_[_0x7d6d('0x18')](_0x4e453f[_0x7d6d('0x19')],'id'),_0x7d6d('0x1a'));return request({'uri':util[_0x7d6d('0x1b')](_0x7d6d('0x1c'),_0x2e36a2[_0x7d6d('0x1d')]),'method':_0x7d6d('0x1e'),'body':_0x4e453f})[_0x7d6d('0x1f')](function(_0x8d670a){logger[_0x7d6d('0xc')]('Ticket\x20created!');return _0x8d670a;});}function getUser(_0x15cd6f,_0x3a81c3){if(intUtil['validateEmail'](_0x3a81c3)){return request({'uri':util['format'](_0x7d6d('0x20'),_0x15cd6f[_0x7d6d('0x1d')]),'qs':{'email':_0x3a81c3}})[_0x7d6d('0x1f')](function(_0x35a038){if(_0x35a038['length']){logger[_0x7d6d('0xc')](_0x7d6d('0x21'));return _[_0x7d6d('0x22')](_0x35a038,function(_0x167bb6){return _0x167bb6[_0x7d6d('0x23')][_0x7d6d('0x24')]===_0x3a81c3;});}else{logger['info'](_0x7d6d('0x25'));return request({'uri':util[_0x7d6d('0x1b')](_0x7d6d('0x26'),_0x15cd6f[_0x7d6d('0x1d')])})['then'](function(_0xb77433){logger[_0x7d6d('0xc')](_0x7d6d('0x27'));return _0xb77433;});}});}else{logger[_0x7d6d('0xc')](_0x7d6d('0x28'));return request({'uri':util['format'](_0x7d6d('0x26'),_0x15cd6f[_0x7d6d('0x1d')])})['then'](function(_0x4ce7da){logger['info']('Admin\x20account\x20selected.');return _0x4ce7da;});}}function getEndUser(_0x2016f6,_0x26cf65,_0x4b814f){logger[_0x7d6d('0xc')](_0x7d6d('0x29'),_0x4b814f);return request({'uri':util[_0x7d6d('0x1b')](_0x7d6d('0x2a'),_0x2016f6[_0x7d6d('0x1d')]),'qs':{'phone':_0x4b814f}})[_0x7d6d('0x1f')](function(_0x32cc00){if(_0x32cc00[_0x7d6d('0x2b')]){logger['info'](_0x7d6d('0x2c'));return _[_0x7d6d('0x22')](_0x32cc00,{'phone':_0x4b814f});}else{logger[_0x7d6d('0xc')](_0x7d6d('0x2d'));return request({'uri':util[_0x7d6d('0x1b')]('%s/api/v2/contacts',_0x2016f6[_0x7d6d('0x1d')]),'method':'POST','body':{'name':_0x26cf65,'phone':_0x4b814f}})['then'](function(_0x5a5381){logger[_0x7d6d('0xc')](_0x7d6d('0x2e'));return _0x5a5381;});}});}function getAuth(_0x1d992d){return util['format'](_0x7d6d('0x2f'),new Buffer(_0x1d992d['apiKey']+':X')[_0x7d6d('0x30')](_0x7d6d('0x31')));}function request(_0x335e03){logger[_0x7d6d('0x32')](_0x7d6d('0x33'),JSON[_0x7d6d('0x34')](_0x335e03));return rp(_['defaults'](_0x335e03,{'method':_0x7d6d('0x35'),'headers':headers,'json':!![]}));}function getTags(_0x291c50,_0x4dcef3){var _0x513ef2=[];if(_0x291c50&&_0x291c50[_0x7d6d('0x2b')]>0x0){_0x513ef2=_[_0x7d6d('0x36')](_0x291c50,_0x4dcef3);}return _0x513ef2;}function getCustomFields(_0x5bb120,_0xf58e70){var _0x5157b2=[];var _0x524160={'custom_fields':[]};if(_0x5bb120['length']>0x0){_[_0x7d6d('0x37')](_0x5bb120,function(_0x11fcfa){if(_[_0x7d6d('0x38')](['string',_0x7d6d('0x39')],_0x11fcfa[_0x7d6d('0x3a')])&&_0x11fcfa['nameField']&&!_0x11fcfa[_0x7d6d('0x3b')]){_0x524160[_0x11fcfa[_0x7d6d('0x3c')][_0x7d6d('0x3d')]()]=_0x11fcfa[_0x7d6d('0x3e')]['toString']();}else if(_[_0x7d6d('0x38')](['string','picklist'],_0x11fcfa[_0x7d6d('0x3a')])&&_0x11fcfa[_0x7d6d('0x3f')]&&_0x11fcfa['customField']){_0x524160[_0x7d6d('0x19')][_0x7d6d('0x40')]({'id':_0x11fcfa[_0x7d6d('0x3f')],'value':_0x11fcfa['content']['toString']()});}else if(_0x11fcfa[_0x7d6d('0x3a')]===_0x7d6d('0x41')&&_0x11fcfa[_0x7d6d('0x42')]&&_0x11fcfa[_0x7d6d('0x3f')]&&_0x11fcfa['customField']){_0xf58e70[_0x11fcfa[_0x7d6d('0x42')]]&&_0x524160['custom_fields'][_0x7d6d('0x40')]({'id':_0x11fcfa[_0x7d6d('0x3f')],'value':_0xf58e70[_0x11fcfa[_0x7d6d('0x42')]][_0x7d6d('0x30')]()});}else if(_0x11fcfa[_0x7d6d('0x3a')]==='customVariable'&&_0x11fcfa[_0x7d6d('0x43')]&&_0x11fcfa['Variable'][_0x7d6d('0x15')]&&_0x11fcfa[_0x7d6d('0x3f')]&&_0x11fcfa[_0x7d6d('0x3b')]){_0xf58e70[_0x11fcfa[_0x7d6d('0x43')][_0x7d6d('0x15')][_0x7d6d('0x3d')]()]&&_0x524160[_0x7d6d('0x19')][_0x7d6d('0x40')]({'id':_0x11fcfa[_0x7d6d('0x3f')],'value':_0xf58e70[_0x11fcfa['Variable']['name'][_0x7d6d('0x3d')]()]['toString']()});}});}return _0x524160;}exports[_0x7d6d('0x44')]=function(_0x7a3f2,_0x1ec254,_0x11d642,_0x29388f,_0x2be495,_0x19f1e6){var _0x14c43a,_0x513f62;_0x19f1e6[_0x7d6d('0x1d')]=intUtil[_0x7d6d('0x45')](_0x19f1e6[_0x7d6d('0x1d')]);_0x19f1e6[_0x7d6d('0x46')]=intUtil[_0x7d6d('0x45')](_0x19f1e6['serverUrl']);if(_0x2be495&&_0x2be495[_0x7d6d('0x47')]){logger[_0x7d6d('0xc')](_0x7d6d('0x48'),_0x7d6d('0x49'));_0x1ec254[_0x7d6d('0x4a')]=util[_0x7d6d('0x1b')](_0x7d6d('0x4b'),_0x19f1e6[_0x7d6d('0x46')],_0x1ec254[_0x7d6d('0x4c')],md5(_0x1ec254[_0x7d6d('0x4c')]));}else{_0x1ec254['recordingURL']='';}headers['Authorization']=getAuth(_0x19f1e6);return getUser(_0x19f1e6,_0x29388f[_0x7d6d('0x24')])[_0x7d6d('0x1f')](function(_0x515f38){_0x14c43a=_0x515f38;logger['info'](_0x7d6d('0x4d'),_0x14c43a['id']);return getEndUser(_0x19f1e6,_0x1ec254[_0x7d6d('0xf')],_0x1ec254[_0x7d6d('0x4e')]);})[_0x7d6d('0x1f')](function(_0x40d9a4){_0x513f62=_0x40d9a4;logger[_0x7d6d('0xc')]('The\x20Enduser\x20ID\x20is:',_0x513f62['id']);return getTicket(_0x19f1e6,_0x14c43a,_0x513f62,_0x11d642,_0x1ec254);})[_0x7d6d('0x1f')](function(_0x39427d){if(_0x39427d&&_0x39427d['id']){logger['info'](_0x7d6d('0x4f'));logger['info'](_0x7d6d('0x50'),_0x39427d['id']);logger['info'](_0x7d6d('0x48'),_0x7d6d('0x51'));emit(util['format']('user:%s',_0x29388f[_0x7d6d('0x15')]),'trigger:browser:url',{'uri':util[_0x7d6d('0x1b')](_0x7d6d('0x52'),_0x19f1e6[_0x7d6d('0x1d')],_0x39427d['id'])});}})[_0x7d6d('0x53')](function(_0xc49a5d){logger['error'](_0x7d6d('0x48'),JSON[_0x7d6d('0x34')](_0xc49a5d));});};exports['outbound']=function(_0x30ba4b,_0x53ff14,_0x176525,_0x20dc44,_0x239479,_0x4b8544,_0x5a64bf){var _0x5ed97c,_0x57ba17;_0x4b8544[_0x7d6d('0x1d')]=intUtil[_0x7d6d('0x45')](_0x4b8544['remoteUri']);_0x4b8544[_0x7d6d('0x46')]=intUtil[_0x7d6d('0x45')](_0x4b8544['serverUrl']);if(_0x5a64bf&&_0x5a64bf['recordingFormat']&&_0x5a64bf[_0x7d6d('0x54')]!==_0x7d6d('0x55')){logger['info'](_0x7d6d('0x56'),'Recording\x20is\x20enabled!');_0x53ff14[_0x7d6d('0x4a')]=util[_0x7d6d('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4b8544['serverUrl'],_0x53ff14[_0x7d6d('0x4c')],md5(_0x53ff14[_0x7d6d('0x4c')]));}headers['Authorization']=getAuth(_0x4b8544);return getUser(_0x4b8544,_0x20dc44[_0x7d6d('0x24')])[_0x7d6d('0x1f')](function(_0x3e1833){_0x5ed97c=_0x3e1833;logger[_0x7d6d('0xc')]('The\x20User\x20ID\x20is:',_0x5ed97c['id']);return getEndUser(_0x4b8544,_0x53ff14[_0x7d6d('0x57')],_0x53ff14[_0x7d6d('0x58')]);})[_0x7d6d('0x1f')](function(_0x33f40b){_0x57ba17=_0x33f40b;logger['info']('The\x20Enduser\x20ID\x20is:',_0x57ba17['id']);return getTicket(_0x4b8544,_0x5ed97c,_0x57ba17,_0x176525,_0x53ff14);})[_0x7d6d('0x1f')](function(_0x2fe7ba){if(_0x2fe7ba&&_0x2fe7ba['id']){logger['info'](_0x7d6d('0x4f'));logger[_0x7d6d('0xc')](_0x7d6d('0x50'),_0x2fe7ba['id']);logger[_0x7d6d('0xc')]('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x7d6d('0x59'),_0x20dc44[_0x7d6d('0x15')]),_0x7d6d('0x5a'),{'uri':util[_0x7d6d('0x1b')]('%s/helpdesk/tickets/%d',_0x4b8544[_0x7d6d('0x1d')],_0x2fe7ba['id'])});}})[_0x7d6d('0x53')](function(_0x218ba0){logger[_0x7d6d('0x5b')](_0x7d6d('0x56'),JSON['stringify'](_0x218ba0));});};exports[_0x7d6d('0x5c')]=function(_0x560280,_0x1b9815,_0x211856,_0x4001c7,_0x5a0279,_0x2d99f6){var _0x3be39f,_0x1cd1d6;_0x2d99f6[_0x7d6d('0x1d')]=intUtil[_0x7d6d('0x45')](_0x2d99f6[_0x7d6d('0x1d')]);_0x2d99f6[_0x7d6d('0x46')]=intUtil[_0x7d6d('0x45')](_0x2d99f6[_0x7d6d('0x46')]);if(_0x5a0279&&_0x5a0279[_0x7d6d('0x47')]){logger[_0x7d6d('0xc')]('['+_0x1b9815[_0x7d6d('0x5d')]['toUpperCase']()+']',_0x7d6d('0x49'));_0x1b9815['recordingURL']=util[_0x7d6d('0x1b')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2d99f6[_0x7d6d('0x46')],_0x1b9815[_0x7d6d('0x4c')],md5(_0x1b9815[_0x7d6d('0x4c')]));}else{_0x1b9815[_0x7d6d('0x4a')]='';}headers[_0x7d6d('0x5e')]=getAuth(_0x2d99f6);return getUser(_0x2d99f6,'')['then'](function(_0x21d5e7){_0x3be39f=_0x21d5e7;logger['info'](_0x7d6d('0x4d'),_0x3be39f['id']);return getEndUser(_0x2d99f6,_0x1b9815[_0x7d6d('0xf')],_0x1b9815[_0x7d6d('0x4e')]);})[_0x7d6d('0x1f')](function(_0x4a7c06){_0x1cd1d6=_0x4a7c06;logger[_0x7d6d('0xc')](_0x7d6d('0x5f'),_0x1cd1d6['id']);return getTicket(_0x2d99f6,_0x3be39f,_0x1cd1d6,_0x211856,_0x1b9815);})[_0x7d6d('0x1f')](function(_0x4a83e1){if(_0x4a83e1){logger[_0x7d6d('0xc')](_0x7d6d('0x4f'));logger[_0x7d6d('0xc')](_0x7d6d('0x50'),_0x4a83e1['id']);}})['catch'](function(_0x5080ac){logger[_0x7d6d('0x5b')]('['+_0x1b9815[_0x7d6d('0x5d')][_0x7d6d('0x60')]()+']',JSON[_0x7d6d('0x34')](_0x5080ac));});}; \ No newline at end of file +var _0x7e94=['The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/helpdesk/tickets/%d','error','[QUEUE]','outbound','stripTrailingSlash','recordingFormat','none','[OUTBOUND]','destcalleridnum','catch','unmanaged','monitor_format','lastevent','toUpperCase','request-promise','util','ioredis','./util','../../../../config/logger','freshdesk','redis','defaults','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','Fields','custom_fields','mapValues','keyBy','value','format','%s/api/v2/tickets','then','Ticket\x20created!','validateEmail','length','Agent\x20found!','find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','remoteUri','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','%s/api/v2/contacts','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Basic\x20%s','apiKey','base64','debug','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','customField','content','toString','includes','push','idField','variable','variableName','Variable','toLowerCase','serverUrl','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:'];(function(_0x528511,_0x815fd3){var _0xd1b2b7=function(_0x3bf131){while(--_0x3bf131){_0x528511['push'](_0x528511['shift']());}};_0xd1b2b7(++_0x815fd3);}(_0x7e94,0x125));var _0x47e9=function(_0x3e8f2c,_0x30ea3b){_0x3e8f2c=_0x3e8f2c-0x0;var _0x315be2=_0x7e94[_0x3e8f2c];return _0x315be2;};'use strict';var _=require('lodash');var rp=require(_0x47e9('0x0'));var md5=require('md5');var util=require(_0x47e9('0x1'));var Redis=require(_0x47e9('0x2'));var intUtil=require(_0x47e9('0x3'));var config=require('../../../../config/environment');var logger=require(_0x47e9('0x4'))(_0x47e9('0x5'));config[_0x47e9('0x6')]=_[_0x47e9('0x7')](config[_0x47e9('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x47e9('0x8'))(new Redis(config['redis']));var headers={'Content-Type':'application/json','Accept':_0x47e9('0x9')};function emit(_0x821800,_0x4ccfbe,_0x5a2de2){io['to'](_0x821800)[_0x47e9('0xa')](_0x4ccfbe,_0x5a2de2);}function getTicket(_0x1d5c39,_0x236a19,_0xb453,_0x328fcf,_0x1fa156){logger[_0x47e9('0xb')](_0x47e9('0xc'));var _0xbf9c59=_[_0x47e9('0xd')]({'responder_id':_0x236a19['id'],'requester_id':_0xb453['id'],'name':util['format'](_0x47e9('0xe'),_0x1fa156[_0x47e9('0xf')]),'phone':_0x1fa156[_0x47e9('0x10')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0x47e9('0x11')](_0x328fcf[_0x47e9('0x12')],_0x1fa156,'\x20'),'description':intUtil['getString'](_0x328fcf[_0x47e9('0x13')],_0x1fa156,_0x47e9('0x14')),'tags':getTags(_0x328fcf[_0x47e9('0x15')],_0x47e9('0x16'))},getCustomFields(_0x328fcf[_0x47e9('0x17')],_0x1fa156));_0xbf9c59[_0x47e9('0x18')]=_[_0x47e9('0x19')](_[_0x47e9('0x1a')](_0xbf9c59['custom_fields'],'id'),_0x47e9('0x1b'));return request({'uri':util[_0x47e9('0x1c')](_0x47e9('0x1d'),_0x1d5c39['remoteUri']),'method':'POST','body':_0xbf9c59})[_0x47e9('0x1e')](function(_0xf87aed){logger[_0x47e9('0xb')](_0x47e9('0x1f'));return _0xf87aed;});}function getUser(_0x3fb415,_0x4194ea){if(intUtil[_0x47e9('0x20')](_0x4194ea)){return request({'uri':util[_0x47e9('0x1c')]('%s/api/v2/agents',_0x3fb415['remoteUri']),'qs':{'email':_0x4194ea}})[_0x47e9('0x1e')](function(_0x54d84d){if(_0x54d84d[_0x47e9('0x21')]){logger[_0x47e9('0xb')](_0x47e9('0x22'));return _[_0x47e9('0x23')](_0x54d84d,function(_0x45a056){return _0x45a056[_0x47e9('0x24')][_0x47e9('0x25')]===_0x4194ea;});}else{logger[_0x47e9('0xb')](_0x47e9('0x26'));return request({'uri':util['format'](_0x47e9('0x27'),_0x3fb415[_0x47e9('0x28')])})[_0x47e9('0x1e')](function(_0x218669){logger[_0x47e9('0xb')](_0x47e9('0x29'));return _0x218669;});}});}else{logger[_0x47e9('0xb')](_0x47e9('0x2a'));return request({'uri':util[_0x47e9('0x1c')](_0x47e9('0x27'),_0x3fb415[_0x47e9('0x28')])})[_0x47e9('0x1e')](function(_0x4ccf7c){logger[_0x47e9('0xb')](_0x47e9('0x29'));return _0x4ccf7c;});}}function getEndUser(_0x2052ed,_0x418005,_0x1cf71f){logger[_0x47e9('0xb')](_0x47e9('0x2b'),_0x1cf71f);return request({'uri':util[_0x47e9('0x1c')](_0x47e9('0x2c'),_0x2052ed['remoteUri']),'qs':{'phone':_0x1cf71f}})['then'](function(_0x1cbb44){if(_0x1cbb44['length']){logger[_0x47e9('0xb')]('Enduser\x20found!');return _[_0x47e9('0x23')](_0x1cbb44,{'phone':_0x1cf71f});}else{logger[_0x47e9('0xb')](_0x47e9('0x2d'));return request({'uri':util[_0x47e9('0x1c')](_0x47e9('0x2c'),_0x2052ed[_0x47e9('0x28')]),'method':'POST','body':{'name':_0x418005,'phone':_0x1cf71f}})[_0x47e9('0x1e')](function(_0x503ec5){logger['info']('Enduser\x20created.');return _0x503ec5;});}});}function getAuth(_0x400179){return util[_0x47e9('0x1c')](_0x47e9('0x2e'),new Buffer(_0x400179[_0x47e9('0x2f')]+':X')['toString'](_0x47e9('0x30')));}function request(_0x1ac74e){logger[_0x47e9('0x31')](_0x47e9('0x32'),JSON[_0x47e9('0x33')](_0x1ac74e));return rp(_[_0x47e9('0x7')](_0x1ac74e,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x32a3a6,_0x205af8){var _0x3f3f51=[];if(_0x32a3a6&&_0x32a3a6[_0x47e9('0x21')]>0x0){_0x3f3f51=_[_0x47e9('0x34')](_0x32a3a6,_0x205af8);}return _0x3f3f51;}function getCustomFields(_0x2e6ccb,_0x3893b7){var _0x538b92=[];var _0x585ba2={'custom_fields':[]};if(_0x2e6ccb[_0x47e9('0x21')]>0x0){_[_0x47e9('0x35')](_0x2e6ccb,function(_0x5b029a){if(_['includes']([_0x47e9('0x36'),_0x47e9('0x37')],_0x5b029a[_0x47e9('0x38')])&&_0x5b029a[_0x47e9('0x39')]&&!_0x5b029a[_0x47e9('0x3a')]){_0x585ba2[_0x5b029a[_0x47e9('0x39')]['toLowerCase']()]=_0x5b029a[_0x47e9('0x3b')][_0x47e9('0x3c')]();}else if(_[_0x47e9('0x3d')]([_0x47e9('0x36'),'picklist'],_0x5b029a[_0x47e9('0x38')])&&_0x5b029a['idField']&&_0x5b029a[_0x47e9('0x3a')]){_0x585ba2[_0x47e9('0x18')][_0x47e9('0x3e')]({'id':_0x5b029a[_0x47e9('0x3f')],'value':_0x5b029a[_0x47e9('0x3b')][_0x47e9('0x3c')]()});}else if(_0x5b029a[_0x47e9('0x38')]===_0x47e9('0x40')&&_0x5b029a['variableName']&&_0x5b029a[_0x47e9('0x3f')]&&_0x5b029a[_0x47e9('0x3a')]){_0x3893b7[_0x5b029a[_0x47e9('0x41')]]&&_0x585ba2['custom_fields'][_0x47e9('0x3e')]({'id':_0x5b029a[_0x47e9('0x3f')],'value':_0x3893b7[_0x5b029a[_0x47e9('0x41')]][_0x47e9('0x3c')]()});}else if(_0x5b029a[_0x47e9('0x38')]==='customVariable'&&_0x5b029a['Variable']&&_0x5b029a[_0x47e9('0x42')][_0x47e9('0x16')]&&_0x5b029a[_0x47e9('0x3f')]&&_0x5b029a[_0x47e9('0x3a')]){_0x3893b7[_0x5b029a[_0x47e9('0x42')][_0x47e9('0x16')][_0x47e9('0x43')]()]&&_0x585ba2[_0x47e9('0x18')][_0x47e9('0x3e')]({'id':_0x5b029a[_0x47e9('0x3f')],'value':_0x3893b7[_0x5b029a[_0x47e9('0x42')]['name'][_0x47e9('0x43')]()]['toString']()});}});}return _0x585ba2;}exports['queue']=function(_0x29d23d,_0x1722dd,_0x39ace8,_0x3feb20,_0x5e573d,_0x120989){var _0xf32d5b,_0x2bacda;_0x120989['remoteUri']=intUtil['stripTrailingSlash'](_0x120989['remoteUri']);_0x120989[_0x47e9('0x44')]=intUtil['stripTrailingSlash'](_0x120989['serverUrl']);if(_0x5e573d&&_0x5e573d['monitor_format']){logger[_0x47e9('0xb')]('[QUEUE]',_0x47e9('0x45'));_0x1722dd[_0x47e9('0x46')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x120989['serverUrl'],_0x1722dd[_0x47e9('0x47')],md5(_0x1722dd[_0x47e9('0x47')]));}else{_0x1722dd[_0x47e9('0x46')]='';}headers[_0x47e9('0x48')]=getAuth(_0x120989);return getUser(_0x120989,_0x3feb20[_0x47e9('0x25')])[_0x47e9('0x1e')](function(_0x46de8c){_0xf32d5b=_0x46de8c;logger[_0x47e9('0xb')](_0x47e9('0x49'),_0xf32d5b['id']);return getEndUser(_0x120989,_0x1722dd[_0x47e9('0xf')],_0x1722dd[_0x47e9('0x10')]);})['then'](function(_0x33d599){_0x2bacda=_0x33d599;logger['info'](_0x47e9('0x4a'),_0x2bacda['id']);return getTicket(_0x120989,_0xf32d5b,_0x2bacda,_0x39ace8,_0x1722dd);})[_0x47e9('0x1e')](function(_0x520690){if(_0x520690&&_0x520690['id']){logger[_0x47e9('0xb')]('Ticket\x20created!');logger[_0x47e9('0xb')](_0x47e9('0x4b'),_0x520690['id']);logger[_0x47e9('0xb')]('[QUEUE]',_0x47e9('0x4c'));emit(util[_0x47e9('0x1c')]('user:%s',_0x3feb20[_0x47e9('0x16')]),_0x47e9('0x4d'),{'uri':util[_0x47e9('0x1c')](_0x47e9('0x4e'),_0x120989[_0x47e9('0x28')],_0x520690['id'])});}})['catch'](function(_0x40e8ce){logger[_0x47e9('0x4f')](_0x47e9('0x50'),JSON[_0x47e9('0x33')](_0x40e8ce));});};exports[_0x47e9('0x51')]=function(_0x41fa48,_0x5954bb,_0x41a9e1,_0x331fc4,_0x3735b8,_0x52ce35,_0x240ac0){var _0x4d5174,_0x3de04e;_0x52ce35[_0x47e9('0x28')]=intUtil[_0x47e9('0x52')](_0x52ce35[_0x47e9('0x28')]);_0x52ce35['serverUrl']=intUtil['stripTrailingSlash'](_0x52ce35['serverUrl']);if(_0x240ac0&&_0x240ac0[_0x47e9('0x53')]&&_0x240ac0[_0x47e9('0x53')]!==_0x47e9('0x54')){logger[_0x47e9('0xb')](_0x47e9('0x55'),_0x47e9('0x45'));_0x5954bb[_0x47e9('0x46')]=util[_0x47e9('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x52ce35['serverUrl'],_0x5954bb['uniqueid'],md5(_0x5954bb[_0x47e9('0x47')]));}headers[_0x47e9('0x48')]=getAuth(_0x52ce35);return getUser(_0x52ce35,_0x331fc4[_0x47e9('0x25')])[_0x47e9('0x1e')](function(_0x4381ea){_0x4d5174=_0x4381ea;logger['info'](_0x47e9('0x49'),_0x4d5174['id']);return getEndUser(_0x52ce35,_0x5954bb['destcalleridname'],_0x5954bb[_0x47e9('0x56')]);})[_0x47e9('0x1e')](function(_0x42b2ae){_0x3de04e=_0x42b2ae;logger['info'](_0x47e9('0x4a'),_0x3de04e['id']);return getTicket(_0x52ce35,_0x4d5174,_0x3de04e,_0x41a9e1,_0x5954bb);})[_0x47e9('0x1e')](function(_0x3c78a4){if(_0x3c78a4&&_0x3c78a4['id']){logger[_0x47e9('0xb')](_0x47e9('0x1f'));logger[_0x47e9('0xb')]('The\x20Ticket\x20ID\x20is:',_0x3c78a4['id']);logger[_0x47e9('0xb')](_0x47e9('0x55'),_0x47e9('0x4c'));emit(util[_0x47e9('0x1c')]('user:%s',_0x331fc4[_0x47e9('0x16')]),_0x47e9('0x4d'),{'uri':util[_0x47e9('0x1c')]('%s/helpdesk/tickets/%d',_0x52ce35[_0x47e9('0x28')],_0x3c78a4['id'])});}})[_0x47e9('0x57')](function(_0x401431){logger[_0x47e9('0x4f')](_0x47e9('0x55'),JSON[_0x47e9('0x33')](_0x401431));});};exports[_0x47e9('0x58')]=function(_0x4188dd,_0x2b7771,_0x5c2e21,_0x58f0fe,_0x58dab4,_0x4e7047){var _0x372fe4,_0x1ed158;_0x4e7047[_0x47e9('0x28')]=intUtil[_0x47e9('0x52')](_0x4e7047[_0x47e9('0x28')]);_0x4e7047[_0x47e9('0x44')]=intUtil['stripTrailingSlash'](_0x4e7047[_0x47e9('0x44')]);if(_0x58dab4&&_0x58dab4[_0x47e9('0x59')]){logger[_0x47e9('0xb')]('['+_0x2b7771[_0x47e9('0x5a')][_0x47e9('0x5b')]()+']',_0x47e9('0x45'));_0x2b7771['recordingURL']=util[_0x47e9('0x1c')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e7047[_0x47e9('0x44')],_0x2b7771[_0x47e9('0x47')],md5(_0x2b7771['uniqueid']));}else{_0x2b7771[_0x47e9('0x46')]='';}headers[_0x47e9('0x48')]=getAuth(_0x4e7047);return getUser(_0x4e7047,'')['then'](function(_0x4699eb){_0x372fe4=_0x4699eb;logger['info']('The\x20User\x20ID\x20is:',_0x372fe4['id']);return getEndUser(_0x4e7047,_0x2b7771[_0x47e9('0xf')],_0x2b7771[_0x47e9('0x10')]);})[_0x47e9('0x1e')](function(_0x31b89f){_0x1ed158=_0x31b89f;logger[_0x47e9('0xb')](_0x47e9('0x4a'),_0x1ed158['id']);return getTicket(_0x4e7047,_0x372fe4,_0x1ed158,_0x5c2e21,_0x2b7771);})[_0x47e9('0x1e')](function(_0x236ba5){if(_0x236ba5){logger[_0x47e9('0xb')](_0x47e9('0x1f'));logger[_0x47e9('0xb')](_0x47e9('0x4b'),_0x236ba5['id']);}})['catch'](function(_0x5bb1b8){logger[_0x47e9('0x4f')]('['+_0x2b7771[_0x47e9('0x5a')][_0x47e9('0x5b')]()+']',JSON[_0x47e9('0x33')](_0x5bb1b8));});}; \ 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 297a090..08b27fd 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 _0x41db=['emit','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','destcalleridnum','calleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','name','inspect','lodash','request-promise','md5','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','localhost','socket.io-emitter','GET','headers','info','Getting\x20admin\x20information','length','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','/api/selector/owners','Getting\x20user\x20list','then','users','agentEmail','Getting\x20user\x20with\x20email','email','User\x20found:','userId','Admin\x20selected','userEmail','/api/lookup?q=','&f=','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','work_number','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Descriptions','Contact','ticketId','task','Task\x20created:','/contacts/','user:%s'];(function(_0x2fdde3,_0x58cd82){var _0x257a98=function(_0x5b2d5f){while(--_0x5b2d5f){_0x2fdde3['push'](_0x2fdde3['shift']());}};_0x257a98(++_0x58cd82);}(_0x41db,0x11e));var _0xb41d=function(_0x220a8e,_0x515db2){_0x220a8e=_0x220a8e-0x0;var _0x25b99a=_0x41db[_0x220a8e];return _0x25b99a;};'use strict';var _=require(_0xb41d('0x0'));var rp=require(_0xb41d('0x1'));var md5=require(_0xb41d('0x2'));var util=require(_0xb41d('0x3'));var moment=require(_0xb41d('0x4'));var Promise=require(_0xb41d('0x5'));var Redis=require(_0xb41d('0x6'));var intUtil=require(_0xb41d('0x7'));var config=require(_0xb41d('0x8'));var logger=require(_0xb41d('0x9'))(_0xb41d('0xa'));config[_0xb41d('0xb')]=_['defaults'](config[_0xb41d('0xb')],{'host':_0xb41d('0xc'),'port':0x18eb});var io=require(_0xb41d('0xd'))(new Redis(config[_0xb41d('0xb')]));function getAdminId(_0x7c10d9,_0x5eabb8,_0x39a8bb,_0x2ff8cd){return new Promise(function(_0x25f6f4,_0x596b3f){var _0x3ea462=![];var _0x120ac1={'method':_0xb41d('0xe'),'uri':_0x2ff8cd+'/api/selector/owners','json':!![]};_0x120ac1[_0xb41d('0xf')]=_0x39a8bb;logger[_0xb41d('0x10')](_0xb41d('0x11'));return rp(_0x120ac1)['then'](function(_0x48c361){if(_0x48c361){var _0x1c9847=_0x48c361['users'];var _0x10db97=null;for(_0x10db97=0x0;_0x10db97<_0x1c9847[_0xb41d('0x12')];_0x10db97++){if(_0x1c9847[_0x10db97]['email']===_0x7c10d9[_0xb41d('0x13')]){_0x7c10d9[_0xb41d('0x14')]=_0x1c9847[_0x10db97]['id'];_0x3ea462=!![];}}if(_0x3ea462){logger[_0xb41d('0x10')](_0xb41d('0x15'),_0x7c10d9[_0xb41d('0x14')]);_0x25f6f4(_0x7c10d9);}else{_0x596b3f({'statusCode':0x194,'message':_0xb41d('0x16')});}}else{_0x596b3f({'statusCode':0x194,'message':_0xb41d('0x16')});}})[_0xb41d('0x17')](function(_0xa8d469){logger[_0xb41d('0x18')]('['+[_0x5eabb8[_0xb41d('0x19')]()]+']',_0xa8d469[_0xb41d('0x1a')]);_0x596b3f(_0xa8d469);});});}function getUser(_0xf6434b,_0x1260ef,_0xfd7da3){return function(_0x11c816){return new Promise(function(_0x1abe36,_0x493401){var _0x155415={'method':_0xb41d('0xe'),'uri':_0xfd7da3+_0xb41d('0x1b'),'json':!![]};_0x155415['headers']=_0x1260ef;logger[_0xb41d('0x10')](_0xb41d('0x1c'));return rp(_0x155415)[_0xb41d('0x1d')](function(_0x2252f0){if(_0x2252f0){var _0x55dfb0=_0x2252f0[_0xb41d('0x1e')];var _0xab2ebe=![];var _0x3ab508=null;if(_0x11c816[_0xb41d('0x1f')]!==null){logger[_0xb41d('0x10')](_0xb41d('0x20'),_0x11c816[_0xb41d('0x1f')]);_0x11c816['userEmail']=_0x11c816[_0xb41d('0x1f')];for(_0x3ab508=0x0;_0x3ab508<_0x55dfb0[_0xb41d('0x12')];_0x3ab508++){if(_0x55dfb0[_0x3ab508][_0xb41d('0x21')]===_0x11c816[_0xb41d('0x1f')]){_0xab2ebe=!![];_0x11c816['userId']=_0x55dfb0[_0x3ab508]['id'];logger['info'](_0xb41d('0x22'),_0x11c816[_0xb41d('0x23')]);}}}if(!_0xab2ebe){logger[_0xb41d('0x10')](_0xb41d('0x24'));_0x11c816[_0xb41d('0x25')]=_0x11c816[_0xb41d('0x13')];_0x11c816[_0xb41d('0x23')]=_0x11c816[_0xb41d('0x14')];_0xab2ebe=!![];}if(_0xab2ebe){_0x1abe36(_0x11c816);}else{_0x493401({'statusCode':0x194,'message':_0xb41d('0x16')});}}else{_0x493401({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x28c7ce){logger[_0xb41d('0x18')]('['+[_0xf6434b[_0xb41d('0x19')]()]+']',_0x28c7ce[_0xb41d('0x1a')]);_0x493401(_0x28c7ce);});});};}function searchContact(_0x59bb04,_0x37c8dd,_0x75167a,_0x4ddb8e){return new Promise(function(_0x104af1,_0x364af8){var _0x49df0b={'method':_0xb41d('0xe'),'headers':_0x37c8dd,'uri':_0x59bb04+_0xb41d('0x26')+_0x4ddb8e+_0xb41d('0x27')+_0x75167a+'&entities=contact','json':!![]};rp(_0x49df0b)[_0xb41d('0x1d')](function(_0x556185){var _0x5e6eca=_[_0xb41d('0x28')](_0x556185[_0xb41d('0x29')]['contacts'],[_0x75167a,_0x4ddb8e]);_0x104af1(_0x5e6eca);})[_0xb41d('0x17')](function(_0x1a1170){_0x364af8(_0x1a1170);});});}function getEndUser(_0x3f18fc,_0x53cf86,_0x30e25b){return function(_0x3ca4ef){return new Promise(function(_0x5f10b1,_0x20280c){logger['info'](util[_0xb41d('0x2a')](_0xb41d('0x2b'),_0x3ca4ef[_0xb41d('0x2c')]));searchContact(_0x30e25b,_0x53cf86,_0xb41d('0x2d'),_0x3ca4ef[_0xb41d('0x2c')])['then'](function(_0x5a42cf){if(_0x5a42cf){_0x3ca4ef[_0xb41d('0x2e')]=_0x5a42cf['id'];logger[_0xb41d('0x10')](_0xb41d('0x2f'),_0x3ca4ef[_0xb41d('0x2e')]);return _0x5f10b1(_0x3ca4ef);}searchContact(_0x30e25b,_0x53cf86,_0xb41d('0x30'),_0x3ca4ef[_0xb41d('0x2c')])[_0xb41d('0x1d')](function(_0x1b082c){if(_0x1b082c){_0x3ca4ef[_0xb41d('0x2e')]=_0x1b082c['id'];logger['info'](_0xb41d('0x31'),_0x3ca4ef[_0xb41d('0x2e')]);return _0x5f10b1(_0x3ca4ef);}createEndUser(_0x3ca4ef,_0x3f18fc,_0x53cf86,_0x30e25b)[_0xb41d('0x1d')](function(_0x3208cb){logger[_0xb41d('0x10')](_0xb41d('0x32'),_0x3208cb[_0xb41d('0x2e')]);return _0x5f10b1(_0x3208cb);});});})[_0xb41d('0x17')](function(_0x2f68af){_0x20280c(_0x2f68af);});});};}function createEndUser(_0x3aa05a,_0x4f0b3a,_0x5d91a8,_0x44431e){return new Promise(function(_0x1ec700,_0x40e0e7){var _0x2315d8=moment();var _0x1f8a54={'method':_0xb41d('0x33'),'uri':_0x44431e+_0xb41d('0x34'),'body':{'contact':{'last_name':_0x3aa05a[_0xb41d('0x2c')],'work_number':_0x3aa05a[_0xb41d('0x2c')],'mobile_number':_0x3aa05a['contactNumber'],'owner_id':_0x3aa05a['userId'],'created_at':_0x2315d8['format'](_0xb41d('0x35'))}},'json':!![]};_0x1f8a54['headers']=_0x5d91a8;logger[_0xb41d('0x10')](_0xb41d('0x36'));return rp(_0x1f8a54)['then'](function(_0x149bb8){_0x3aa05a['endUserId']=_0x149bb8[_0xb41d('0x37')]['id'];_0x1ec700(_0x3aa05a);})[_0xb41d('0x17')](function(_0x3bcd0a){logger[_0xb41d('0x18')]('['+[_0x4f0b3a[_0xb41d('0x19')]()]+']',_0x3bcd0a[_0xb41d('0x1a')]);_0x40e0e7(_0x3bcd0a['message']);});});}function getTicket(_0x121d09,_0x4e2fb3,_0x30c0c2,_0x1326ff,_0x3f08df){return function(_0x3079ff){logger['info'](_0xb41d('0x38'));return new Promise(function(_0x2739c5,_0x1a6cc5){var _0xb075fe=moment();var _0x59679a={'method':'POST','uri':_0x30c0c2+_0xb41d('0x39'),'body':{'title':intUtil[_0xb41d('0x3a')](_0x1326ff['Subjects'],_0x3f08df,'\x20'),'description':intUtil[_0xb41d('0x3a')](_0x1326ff[_0xb41d('0x3b')],_0x3f08df,'\x0a'),'owner_id':_0x3079ff[_0xb41d('0x23')],'creater_id':_0x3079ff[_0xb41d('0x14')],'targetable_id':_0x3079ff['endUserId'],'targetable_type':_0xb41d('0x3c'),'created_at':_0xb075fe[_0xb41d('0x2a')](_0xb41d('0x35')),'due_date':_0xb075fe['add'](0x1e,'m')[_0xb41d('0x2a')](_0xb41d('0x35'))},'json':!![]};_0x59679a[_0xb41d('0xf')]=_0x4e2fb3;return rp(_0x59679a)[_0xb41d('0x1d')](function(_0x12e752){_0x3079ff[_0xb41d('0x3d')]=_0x12e752[_0xb41d('0x3e')]['id'];logger[_0xb41d('0x10')](_0xb41d('0x3f'),_0x3079ff[_0xb41d('0x3d')]);_0x2739c5(_0x3079ff);})[_0xb41d('0x17')](function(_0x13e5ce){logger[_0xb41d('0x18')]('['+[_0x121d09[_0xb41d('0x19')]()]+']',_0x13e5ce[_0xb41d('0x1a')]);_0x1a6cc5(_0x13e5ce[_0xb41d('0x1a')]);});});};}function emit(_0x17cf6d,_0xc0080,_0x5eb0f3){var _0x235b02={'uri':_0x17cf6d+_0xb41d('0x40')+_0x5eb0f3};io['to'](util[_0xb41d('0x2a')](_0xb41d('0x41'),_0xc0080))[_0xb41d('0x42')]('trigger:browser:url',_0x235b02);}exports['cs']=function(_0x4fb32d,_0x17525e,_0x38742e,_0x29c9eb,_0xcf7f05,_0x4d1191,_0x59241b,_0x38adb9){var _0x2f6f64={};var _0x3a78e={'Authorization':'Token\x20token='+_0x4d1191['apiKey']};_0x4d1191[_0xb41d('0x43')]=intUtil[_0xb41d('0x44')](_0x4d1191['remoteUri']);_0x4d1191[_0xb41d('0x45')]=intUtil[_0xb41d('0x44')](_0x4d1191['serverUrl']);var _0x310b15=_0x4d1191[_0xb41d('0x43')];_0x2f6f64[_0xb41d('0x13')]=_0x4d1191['username'];_0x2f6f64[_0xb41d('0x2c')]=_0x38adb9[_0xb41d('0x46')]()===_0xb41d('0x47')?_0x17525e[_0xb41d('0x48')]:_0x17525e[_0xb41d('0x49')];_0x2f6f64['callDirection']=_0x38adb9===_0xb41d('0x4a')||_0x38adb9==='unmanaged'?_0xb41d('0x4a'):'outbound';if(_0x29c9eb){_0x2f6f64[_0xb41d('0x1f')]=_0x29c9eb[_0xb41d('0x21')];}var _0x2cb00d=util[_0xb41d('0x2a')](_0xb41d('0x4b'),_0x4d1191[_0xb41d('0x45')],_0x17525e[_0xb41d('0x4c')],md5(_0x17525e[_0xb41d('0x4c')]));if(_0xcf7f05&&_0xcf7f05[_0xb41d('0x4d')]){logger[_0xb41d('0x10')](_0xb41d('0x4e'),_0xb41d('0x4f'));_0x17525e[_0xb41d('0x50')]=_0x2cb00d;}else if(_0x59241b&&_0x59241b[_0xb41d('0x51')]&&_0x59241b[_0xb41d('0x51')]!==_0xb41d('0x52')){logger['info'](_0xb41d('0x53'),_0xb41d('0x4f'));_0x17525e['recordingURL']=_0x2cb00d;}else{_0x17525e[_0xb41d('0x50')]='';}return getAdminId(_0x2f6f64,_0x38adb9,_0x3a78e,_0x310b15)[_0xb41d('0x1d')](getUser(_0x38adb9,_0x3a78e,_0x310b15))['then'](getEndUser(_0x38adb9,_0x3a78e,_0x310b15))[_0xb41d('0x1d')](getTicket(_0x38adb9,_0x3a78e,_0x310b15,_0x38742e,_0x17525e))[_0xb41d('0x1d')](function(_0x5c8a8d){logger[_0xb41d('0x10')](util[_0xb41d('0x2a')](_0xb41d('0x54'),_0x5c8a8d[_0xb41d('0x3d')]));if(_0x38adb9!==_0xb41d('0x55')){logger[_0xb41d('0x10')]('['+[_0x38adb9[_0xb41d('0x19')]()]+']','Displaying\x20task\x20in\x20a\x20new\x20tab...');emit(_0x310b15,_0x29c9eb[_0xb41d('0x56')],_0x5c8a8d[_0xb41d('0x2e')]);}})[_0xb41d('0x17')](function(_0x1b9ecd){logger[_0xb41d('0x18')]('['+[_0x38adb9[_0xb41d('0x19')]()]+']\x20Error\x20running\x20Freshsales\x20integration',util[_0xb41d('0x57')](_0x1b9ecd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x0994=['name',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','md5','util','moment','freshsales','redis','localhost','socket.io-emitter','GET','info','Getting\x20admin\x20information','then','users','length','email','Admin\x20found:','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','User\x20found:','userId','Admin\x20selected','userEmail','adminEmail','adminId','/api/lookup?q=','&f=','find','contacts','format','contactNumber','mobile_number','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','YYYY-MM-DDTHH:mm:ss','headers','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','Contact','add','ticketId','task','user:%s','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','toLowerCase','outbound','calleridnum','callDirection','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','Displaying\x20task\x20in\x20a\x20new\x20tab...'];(function(_0x18dbd7,_0x501752){var _0x466ae0=function(_0x483b9b){while(--_0x483b9b){_0x18dbd7['push'](_0x18dbd7['shift']());}};_0x466ae0(++_0x501752);}(_0x0994,0xfc));var _0x4099=function(_0x5a9197,_0x2a1c8f){_0x5a9197=_0x5a9197-0x0;var _0x4f9431=_0x0994[_0x5a9197];return _0x4f9431;};'use strict';var _=require(_0x4099('0x0'));var rp=require(_0x4099('0x1'));var md5=require(_0x4099('0x2'));var util=require(_0x4099('0x3'));var moment=require(_0x4099('0x4'));var Promise=require('bluebird');var Redis=require('ioredis');var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0x4099('0x5'));config[_0x4099('0x6')]=_['defaults'](config['redis'],{'host':_0x4099('0x7'),'port':0x18eb});var io=require(_0x4099('0x8'))(new Redis(config['redis']));function getAdminId(_0x3b269c,_0x90e84c,_0xba9118,_0x22664a){return new Promise(function(_0x5dc4de,_0x46a767){var _0x25501f=![];var _0x161b79={'method':_0x4099('0x9'),'uri':_0x22664a+'/api/selector/owners','json':!![]};_0x161b79['headers']=_0xba9118;logger[_0x4099('0xa')](_0x4099('0xb'));return rp(_0x161b79)[_0x4099('0xc')](function(_0x1fa870){if(_0x1fa870){var _0x174620=_0x1fa870[_0x4099('0xd')];var _0x5d6c61=null;for(_0x5d6c61=0x0;_0x5d6c61<_0x174620[_0x4099('0xe')];_0x5d6c61++){if(_0x174620[_0x5d6c61][_0x4099('0xf')]===_0x3b269c['adminEmail']){_0x3b269c['adminId']=_0x174620[_0x5d6c61]['id'];_0x25501f=!![];}}if(_0x25501f){logger[_0x4099('0xa')](_0x4099('0x10'),_0x3b269c['adminId']);_0x5dc4de(_0x3b269c);}else{_0x46a767({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x46a767({'statusCode':0x194,'message':_0x4099('0x11')});}})[_0x4099('0x12')](function(_0x3d903b){logger[_0x4099('0x13')]('['+[_0x90e84c[_0x4099('0x14')]()]+']',_0x3d903b[_0x4099('0x15')]);_0x46a767(_0x3d903b);});});}function getUser(_0xcd7940,_0x55b2fd,_0x12d8bf){return function(_0x3c725e){return new Promise(function(_0x5e17bb,_0x17f66b){var _0x1ce41e={'method':_0x4099('0x9'),'uri':_0x12d8bf+'/api/selector/owners','json':!![]};_0x1ce41e['headers']=_0x55b2fd;logger[_0x4099('0xa')](_0x4099('0x16'));return rp(_0x1ce41e)['then'](function(_0x1306c5){if(_0x1306c5){var _0xf78118=_0x1306c5[_0x4099('0xd')];var _0x322155=![];var _0x9c50e4=null;if(_0x3c725e[_0x4099('0x17')]!==null){logger[_0x4099('0xa')](_0x4099('0x18'),_0x3c725e[_0x4099('0x17')]);_0x3c725e['userEmail']=_0x3c725e[_0x4099('0x17')];for(_0x9c50e4=0x0;_0x9c50e4<_0xf78118['length'];_0x9c50e4++){if(_0xf78118[_0x9c50e4][_0x4099('0xf')]===_0x3c725e['agentEmail']){_0x322155=!![];_0x3c725e['userId']=_0xf78118[_0x9c50e4]['id'];logger[_0x4099('0xa')](_0x4099('0x19'),_0x3c725e[_0x4099('0x1a')]);}}}if(!_0x322155){logger[_0x4099('0xa')](_0x4099('0x1b'));_0x3c725e[_0x4099('0x1c')]=_0x3c725e[_0x4099('0x1d')];_0x3c725e[_0x4099('0x1a')]=_0x3c725e[_0x4099('0x1e')];_0x322155=!![];}if(_0x322155){_0x5e17bb(_0x3c725e);}else{_0x17f66b({'statusCode':0x194,'message':_0x4099('0x11')});}}else{_0x17f66b({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})['catch'](function(_0x4adfb0){logger[_0x4099('0x13')]('['+[_0xcd7940[_0x4099('0x14')]()]+']',_0x4adfb0[_0x4099('0x15')]);_0x17f66b(_0x4adfb0);});});};}function searchContact(_0xc44e67,_0xd5733e,_0xef805a,_0xd4c4d9){return new Promise(function(_0x234b4d,_0x402a62){var _0xede8ad={'method':_0x4099('0x9'),'headers':_0xd5733e,'uri':_0xc44e67+_0x4099('0x1f')+_0xd4c4d9+_0x4099('0x20')+_0xef805a+'&entities=contact','json':!![]};rp(_0xede8ad)[_0x4099('0xc')](function(_0x47ef84){var _0x2da321=_[_0x4099('0x21')](_0x47ef84[_0x4099('0x22')]['contacts'],[_0xef805a,_0xd4c4d9]);_0x234b4d(_0x2da321);})[_0x4099('0x12')](function(_0x459feb){_0x402a62(_0x459feb);});});}function getEndUser(_0x39a839,_0x287f63,_0x2feeb5){return function(_0x1e0380){return new Promise(function(_0x568e30,_0x3eb7c4){logger['info'](util[_0x4099('0x23')]('Searching\x20contact\x20with\x20phone\x20%s',_0x1e0380[_0x4099('0x24')]));searchContact(_0x2feeb5,_0x287f63,_0x4099('0x25'),_0x1e0380[_0x4099('0x24')])['then'](function(_0x1e7c0c){if(_0x1e7c0c){_0x1e0380['endUserId']=_0x1e7c0c['id'];logger['info'](_0x4099('0x26'),_0x1e0380[_0x4099('0x27')]);return _0x568e30(_0x1e0380);}searchContact(_0x2feeb5,_0x287f63,'work_number',_0x1e0380[_0x4099('0x24')])[_0x4099('0xc')](function(_0x4a3cf1){if(_0x4a3cf1){_0x1e0380[_0x4099('0x27')]=_0x4a3cf1['id'];logger['info'](_0x4099('0x28'),_0x1e0380[_0x4099('0x27')]);return _0x568e30(_0x1e0380);}createEndUser(_0x1e0380,_0x39a839,_0x287f63,_0x2feeb5)[_0x4099('0xc')](function(_0x4f3ba0){logger[_0x4099('0xa')](_0x4099('0x29'),_0x4f3ba0[_0x4099('0x27')]);return _0x568e30(_0x4f3ba0);});});})[_0x4099('0x12')](function(_0x22cb73){_0x3eb7c4(_0x22cb73);});});};}function createEndUser(_0x5ed74e,_0x2be73a,_0x59c23b,_0x540690){return new Promise(function(_0x3218ac,_0x3c2d7e){var _0x17cee6=moment();var _0x4d68df={'method':_0x4099('0x2a'),'uri':_0x540690+_0x4099('0x2b'),'body':{'contact':{'last_name':_0x5ed74e['contactNumber'],'work_number':_0x5ed74e[_0x4099('0x24')],'mobile_number':_0x5ed74e['contactNumber'],'owner_id':_0x5ed74e[_0x4099('0x1a')],'created_at':_0x17cee6[_0x4099('0x23')](_0x4099('0x2c'))}},'json':!![]};_0x4d68df[_0x4099('0x2d')]=_0x59c23b;logger[_0x4099('0xa')](_0x4099('0x2e'));return rp(_0x4d68df)[_0x4099('0xc')](function(_0xcea9a5){_0x5ed74e[_0x4099('0x27')]=_0xcea9a5[_0x4099('0x2f')]['id'];_0x3218ac(_0x5ed74e);})[_0x4099('0x12')](function(_0xe06f5a){logger['error']('['+[_0x2be73a[_0x4099('0x14')]()]+']',_0xe06f5a[_0x4099('0x15')]);_0x3c2d7e(_0xe06f5a[_0x4099('0x15')]);});});}function getTicket(_0x3d369f,_0x18b4cc,_0x262e64,_0x1aa513,_0x4c6080){return function(_0x2733d9){logger[_0x4099('0xa')](_0x4099('0x30'));return new Promise(function(_0x1d26cd,_0x56ab2b){var _0x23f815=moment();var _0x3f09af={'method':_0x4099('0x2a'),'uri':_0x262e64+_0x4099('0x31'),'body':{'title':intUtil[_0x4099('0x32')](_0x1aa513[_0x4099('0x33')],_0x4c6080,'\x20'),'description':intUtil[_0x4099('0x32')](_0x1aa513[_0x4099('0x34')],_0x4c6080,'\x0a'),'owner_id':_0x2733d9[_0x4099('0x1a')],'creater_id':_0x2733d9['adminId'],'targetable_id':_0x2733d9[_0x4099('0x27')],'targetable_type':_0x4099('0x35'),'created_at':_0x23f815[_0x4099('0x23')](_0x4099('0x2c')),'due_date':_0x23f815[_0x4099('0x36')](0x1e,'m')['format']('YYYY-MM-DDTHH:mm:ss')},'json':!![]};_0x3f09af[_0x4099('0x2d')]=_0x18b4cc;return rp(_0x3f09af)[_0x4099('0xc')](function(_0x2a935e){_0x2733d9[_0x4099('0x37')]=_0x2a935e[_0x4099('0x38')]['id'];logger[_0x4099('0xa')]('Task\x20created:',_0x2733d9[_0x4099('0x37')]);_0x1d26cd(_0x2733d9);})[_0x4099('0x12')](function(_0x268ab4){logger['error']('['+[_0x3d369f[_0x4099('0x14')]()]+']',_0x268ab4['message']);_0x56ab2b(_0x268ab4[_0x4099('0x15')]);});});};}function emit(_0x28584b,_0x1c542d,_0x4cfb55){var _0x2f65e4={'uri':_0x28584b+'/contacts/'+_0x4cfb55};io['to'](util['format'](_0x4099('0x39'),_0x1c542d))['emit']('trigger:browser:url',_0x2f65e4);}exports['cs']=function(_0x3cecab,_0x455289,_0x424f29,_0x380593,_0x3eb3ea,_0x318fec,_0x5ba6af,_0x273de1){var _0xa46586={};var _0x4fcb30={'Authorization':_0x4099('0x3a')+_0x318fec[_0x4099('0x3b')]};_0x318fec[_0x4099('0x3c')]=intUtil[_0x4099('0x3d')](_0x318fec[_0x4099('0x3c')]);_0x318fec[_0x4099('0x3e')]=intUtil[_0x4099('0x3d')](_0x318fec['serverUrl']);var _0x3b06d6=_0x318fec[_0x4099('0x3c')];_0xa46586[_0x4099('0x1d')]=_0x318fec['username'];_0xa46586[_0x4099('0x24')]=_0x273de1[_0x4099('0x3f')]()===_0x4099('0x40')?_0x455289['destcalleridnum']:_0x455289[_0x4099('0x41')];_0xa46586[_0x4099('0x42')]=_0x273de1===_0x4099('0x43')||_0x273de1===_0x4099('0x44')?_0x4099('0x43'):_0x4099('0x40');if(_0x380593){_0xa46586[_0x4099('0x17')]=_0x380593[_0x4099('0xf')];}var _0x42add0=util[_0x4099('0x23')](_0x4099('0x45'),_0x318fec[_0x4099('0x3e')],_0x455289[_0x4099('0x46')],md5(_0x455289['uniqueid']));if(_0x3eb3ea&&_0x3eb3ea[_0x4099('0x47')]){logger[_0x4099('0xa')](_0x4099('0x48'),_0x4099('0x49'));_0x455289[_0x4099('0x4a')]=_0x42add0;}else if(_0x5ba6af&&_0x5ba6af[_0x4099('0x4b')]&&_0x5ba6af[_0x4099('0x4b')]!==_0x4099('0x4c')){logger['info'](_0x4099('0x4d'),_0x4099('0x49'));_0x455289[_0x4099('0x4a')]=_0x42add0;}else{_0x455289[_0x4099('0x4a')]='';}return getAdminId(_0xa46586,_0x273de1,_0x4fcb30,_0x3b06d6)['then'](getUser(_0x273de1,_0x4fcb30,_0x3b06d6))[_0x4099('0xc')](getEndUser(_0x273de1,_0x4fcb30,_0x3b06d6))[_0x4099('0xc')](getTicket(_0x273de1,_0x4fcb30,_0x3b06d6,_0x424f29,_0x455289))['then'](function(_0x1bf088){logger['info'](util[_0x4099('0x23')](_0x4099('0x4e'),_0x1bf088[_0x4099('0x37')]));if(_0x273de1!=='unmanaged'){logger[_0x4099('0xa')]('['+[_0x273de1[_0x4099('0x14')]()]+']',_0x4099('0x4f'));emit(_0x3b06d6,_0x380593[_0x4099('0x50')],_0x1bf088[_0x4099('0x27')]);}})[_0x4099('0x12')](function(_0x5292e6){logger[_0x4099('0x13')]('['+[_0x273de1[_0x4099('0x14')]()]+_0x4099('0x51'),util[_0x4099('0x52')](_0x5292e6,{'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 8f7a050..18b0313 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 _0x8678=['freshsales','servicenow','includes','data1','toLowerCase','data2','find','data3','queue','outbound','EVENT\x20UNKNOWN','salesforce','log','error','[EXEC]','../../../../config/logger','format','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./desk','./freshsales','zendesk','sugarcrm','freshdesk','zoho','desk'];(function(_0x34f918,_0x2d6048){var _0x2cd142=function(_0x51b6f2){while(--_0x51b6f2){_0x34f918['push'](_0x34f918['shift']());}};_0x2cd142(++_0x2d6048);}(_0x8678,0x1d3));var _0x8867=function(_0x1d419b,_0x5622e4){_0x1d419b=_0x1d419b-0x0;var _0xb7966e=_0x8678[_0x1d419b];return _0xb7966e;};'use strict';var _=require(_0x8867('0x0'));var util=require(_0x8867('0x1'));var zendesk=require(_0x8867('0x2'));var salesforce=require(_0x8867('0x3'));var sugarcrm=require(_0x8867('0x4'));var freshdesk=require(_0x8867('0x5'));var zoho=require('./zoho');var desk=require(_0x8867('0x6'));var vtiger=require('./vtiger');var servicenow=require('./servicenow');var dynamics365=require('./dynamics365');var freshsales=require(_0x8867('0x7'));var integrations=[_0x8867('0x8'),'salesforce',_0x8867('0x9'),_0x8867('0xa'),_0x8867('0xb'),_0x8867('0xc'),'vtiger','dynamics365',_0x8867('0xd'),_0x8867('0xe')];exports['exec']=function(_0x5f118a,_0x433abc,_0x28eeb8,_0x4437a2,_0x32817a,_0x495cc3){if(_0x28eeb8){if(_[_0x8867('0xf')](integrations,_0x5f118a[_0x8867('0x10')][_0x8867('0x11')]())){try{var _0xe0fed8=null;var _0x4a8a24='';var _0x383afc=_0x28eeb8[_0x5f118a[_0x8867('0x10')][_0x8867('0x11')]()];if(_0x383afc){var _0x78b1e0=_0x383afc[_0x5f118a[_0x8867('0x12')]];if(_0x78b1e0){var _0x5a6836=_[_0x8867('0x13')](_0x78b1e0['Configurations'],{'id':parseInt(_0x5f118a[_0x8867('0x14')],0xa)});if(_0x5a6836){if(_0x4437a2){if(_0x32817a&&_0x433abc[_0x8867('0x15')]){_0x4a8a24='queue';}else if(_0x433abc['routeId']){_0x4a8a24=_0x8867('0x16');}else{console['log'](_0x8867('0x17'),_0x433abc);}}else{_0x4a8a24='unmanaged';}switch(_0x5f118a[_0x8867('0x10')]['toLowerCase']()){case'zendesk':zendesk[_0x4a8a24](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3);break;case _0x8867('0x18'):salesforce[_0x4a8a24](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3);break;case _0x8867('0x9'):sugarcrm[_0x4a8a24](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3);break;case _0x8867('0xa'):freshdesk[_0x4a8a24](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3);break;case _0x8867('0xb'):zoho[_0x4a8a24](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3);break;case _0x8867('0xc'):desk[_0x4a8a24](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3);break;case'vtiger':vtiger[_0x4a8a24](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3);break;case'freshsales':freshsales['cs'](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3,_0x4a8a24);break;case _0x8867('0xe'):servicenow['cs'](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3,_0x4a8a24);break;case'dynamics365':dynamics365['cs'](_0x5f118a,_0x433abc,_0x5a6836,_0x4437a2,_0x32817a,_0x78b1e0,_0x495cc3,_0x4a8a24);break;default:console[_0x8867('0x19')]('unknown\x20integration');}}else{_0xe0fed8=require('../../../../config/logger')(_0x5f118a[_0x8867('0x10')][_0x8867('0x11')]());_0xe0fed8[_0x8867('0x1a')](_0x8867('0x1b'),util['format']('%s\x20configuration\x20#%s\x20not\x20found',_0x5f118a[_0x8867('0x10')][_0x8867('0x11')](),_0x5f118a[_0x8867('0x14')]));}}else{_0xe0fed8=require(_0x8867('0x1c'))(_0x5f118a[_0x8867('0x10')][_0x8867('0x11')]());_0xe0fed8['error'](_0x8867('0x1b'),util[_0x8867('0x1d')]('%s\x20account\x20#%s\x20not\x20found',_0x5f118a[_0x8867('0x10')][_0x8867('0x11')](),_0x5f118a[_0x8867('0x12')]));}}else{}}catch(_0x4b36e4){console[_0x8867('0x1a')](_0x4b36e4);}}}}; \ No newline at end of file +var _0x854c=['data2','find','Configurations','data3','queue','routeId','log','EVENT\x20UNKNOWN','salesforce','vtiger','unknown\x20integration','../../../../config/logger','error','format','%s\x20account\x20#%s\x20not\x20found','lodash','util','./zendesk','./salesforce','./freshdesk','./desk','./vtiger','./dynamics365','./freshsales','sugarcrm','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','exec','includes','toLowerCase','data1'];(function(_0x15e583,_0x3b88e2){var _0x511c22=function(_0x34a4fe){while(--_0x34a4fe){_0x15e583['push'](_0x15e583['shift']());}};_0x511c22(++_0x3b88e2);}(_0x854c,0x127));var _0xc854=function(_0x9f5b67,_0x39dc1f){_0x9f5b67=_0x9f5b67-0x0;var _0x350c8e=_0x854c[_0x9f5b67];return _0x350c8e;};'use strict';var _=require(_0xc854('0x0'));var util=require(_0xc854('0x1'));var zendesk=require(_0xc854('0x2'));var salesforce=require(_0xc854('0x3'));var sugarcrm=require('./sugarcrm');var freshdesk=require(_0xc854('0x4'));var zoho=require('./zoho');var desk=require(_0xc854('0x5'));var vtiger=require(_0xc854('0x6'));var servicenow=require('./servicenow');var dynamics365=require(_0xc854('0x7'));var freshsales=require(_0xc854('0x8'));var integrations=['zendesk','salesforce',_0xc854('0x9'),_0xc854('0xa'),_0xc854('0xb'),_0xc854('0xc'),'vtiger',_0xc854('0xd'),_0xc854('0xe'),_0xc854('0xf')];exports[_0xc854('0x10')]=function(_0x4bd47b,_0x24f2eb,_0x3f0a48,_0x3c98db,_0x1d3895,_0xc2c2e9){if(_0x3f0a48){if(_[_0xc854('0x11')](integrations,_0x4bd47b['data1'][_0xc854('0x12')]())){try{var _0x45c410=null;var _0x5a7bab='';var _0x36af7c=_0x3f0a48[_0x4bd47b[_0xc854('0x13')][_0xc854('0x12')]()];if(_0x36af7c){var _0x21270d=_0x36af7c[_0x4bd47b[_0xc854('0x14')]];if(_0x21270d){var _0x4f6079=_[_0xc854('0x15')](_0x21270d[_0xc854('0x16')],{'id':parseInt(_0x4bd47b[_0xc854('0x17')],0xa)});if(_0x4f6079){if(_0x3c98db){if(_0x1d3895&&_0x24f2eb[_0xc854('0x18')]){_0x5a7bab=_0xc854('0x18');}else if(_0x24f2eb[_0xc854('0x19')]){_0x5a7bab='outbound';}else{console[_0xc854('0x1a')](_0xc854('0x1b'),_0x24f2eb);}}else{_0x5a7bab='unmanaged';}switch(_0x4bd47b[_0xc854('0x13')]['toLowerCase']()){case'zendesk':zendesk[_0x5a7bab](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9);break;case _0xc854('0x1c'):salesforce[_0x5a7bab](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9);break;case _0xc854('0x9'):sugarcrm[_0x5a7bab](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9);break;case _0xc854('0xa'):freshdesk[_0x5a7bab](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9);break;case _0xc854('0xb'):zoho[_0x5a7bab](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9);break;case _0xc854('0xc'):desk[_0x5a7bab](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9);break;case _0xc854('0x1d'):vtiger[_0x5a7bab](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9);break;case _0xc854('0xe'):freshsales['cs'](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9,_0x5a7bab);break;case _0xc854('0xf'):servicenow['cs'](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9,_0x5a7bab);break;case _0xc854('0xd'):dynamics365['cs'](_0x4bd47b,_0x24f2eb,_0x4f6079,_0x3c98db,_0x1d3895,_0x21270d,_0xc2c2e9,_0x5a7bab);break;default:console[_0xc854('0x1a')](_0xc854('0x1e'));}}else{_0x45c410=require(_0xc854('0x1f'))(_0x4bd47b['data1']['toLowerCase']());_0x45c410[_0xc854('0x20')]('[EXEC]',util[_0xc854('0x21')]('%s\x20configuration\x20#%s\x20not\x20found',_0x4bd47b[_0xc854('0x13')][_0xc854('0x12')](),_0x4bd47b[_0xc854('0x17')]));}}else{_0x45c410=require('../../../../config/logger')(_0x4bd47b['data1'][_0xc854('0x12')]());_0x45c410['error']('[EXEC]',util[_0xc854('0x21')](_0xc854('0x22'),_0x4bd47b[_0xc854('0x13')][_0xc854('0x12')](),_0x4bd47b['data2']));}}else{}}catch(_0x508185){console[_0xc854('0x20')](_0x508185);}}}}; \ 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 07a12d0..eef8211 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 _0xd65e=['catch','[QUEUE]','outbound','recordingFormat','[OUTBOUND]','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','%s/%s/e','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','request-promise','moment','md5','jsforce','util','./util','salesforce','defaults','redis','localhost','socket.io-emitter','assign','getString','Descriptions','utc','IsReminderSet','IsRecurrence','endUserType','lead','WhoId','account','ticketType','Case','contact','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','isNil','User','find','length','Email','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','then','user_id','display_name','identity','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','cloneDeep','additionalSearchContact','merge','$or','additionalSearchLead','account_contact_lead','additionalSearchAccount','Account','Contact','Lead','first','Phone','attributes','type','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','LastName','','format','Caller\x20-\x20%s','Company','upperFirst','includes','picklist','idField','content','toString','variable','variableName','name','Variable','password','concat','securityToken','Connection','remoteUri','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','stripTrailingSlash','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridname','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.'];(function(_0x67f95e,_0x3ca797){var _0x538f5a=function(_0xc919e9){while(--_0xc919e9){_0x67f95e['push'](_0x67f95e['shift']());}};_0x538f5a(++_0x3ca797);}(_0xd65e,0x90));var _0xed65=function(_0x367afb,_0x37658f){_0x367afb=_0x367afb-0x0;var _0x2c26d7=_0xd65e[_0x367afb];return _0x2c26d7;};'use strict';var _=require('lodash');var rp=require(_0xed65('0x0'));var moment=require(_0xed65('0x1'));var BPromise=require('bluebird');var md5=require(_0xed65('0x2'));var jsforce=require(_0xed65('0x3'));var util=require(_0xed65('0x4'));var Redis=require('ioredis');var intUtil=require(_0xed65('0x5'));var config=require('../../../../config/environment');var logger=require('../../../../config/logger')(_0xed65('0x6'));config['redis']=_[_0xed65('0x7')](config[_0xed65('0x8')],{'host':_0xed65('0x9'),'port':0x18eb});var io=require(_0xed65('0xa'))(new Redis(config[_0xed65('0x8')]));function emit(_0x34de86,_0x37fd03,_0x2c9542){io['to'](_0x34de86)['emit'](_0x37fd03,_0x2c9542);}function getTicket(_0x43a1de,_0x2e6bab,_0x11b8cf,_0x24b994,_0x56e22f,_0x13c47c,_0x9879a2,_0x155cbf){var _0x4e992d=Object[_0xed65('0xb')]({},{'OwnerId':_0x2e6bab['id'],'Subject':intUtil['getString'](_0x24b994['Subjects'],_0x56e22f,'\x20'),'Description':intUtil[_0xed65('0xc')](_0x24b994[_0xed65('0xd')],_0x56e22f,'\x0a')},getCustomFields(_0x13c47c,_0x56e22f));if(_0x11b8cf){if(_0x24b994['ticketType']==='Task'){_0x4e992d['ActivityDate']=moment[_0xed65('0xe')]();_0x4e992d[_0xed65('0xf')]=![];_0x4e992d[_0xed65('0x10')]=![];if(_0x11b8cf[_0xed65('0x11')]==='contact'||_0x11b8cf[_0xed65('0x11')]===_0xed65('0x12')){_0x4e992d[_0xed65('0x13')]=_0x11b8cf['id'];}else if(_0x11b8cf[_0xed65('0x11')]===_0xed65('0x14')){_0x4e992d['WhatId']=_0x11b8cf['id'];}}else if(_0x24b994[_0xed65('0x15')]===_0xed65('0x16')){if(_0x11b8cf[_0xed65('0x11')]===_0xed65('0x17')){_0x4e992d[_0xed65('0x18')]=_0x11b8cf['id'];}else if(_0x11b8cf[_0xed65('0x11')]===_0xed65('0x14')){_0x4e992d[_0xed65('0x19')]=_0x11b8cf['id'];}else if(_0x11b8cf[_0xed65('0x11')]===_0xed65('0x12')&&_0x24b994['leadId']){_0x4e992d[_0x24b994[_0xed65('0x1a')]]=_0x11b8cf['id'];}else{logger[_0xed65('0x1b')](_0xed65('0x1c'));}}}return _0x9879a2[_0xed65('0x1d')](_0x24b994[_0xed65('0x15')])['create'](_0x4e992d);}function getUser(_0x447f87,_0x5f4a41,_0xb095b1){if(!_[_0xed65('0x1e')](_0x5f4a41)&&intUtil['validateEmail'](_0x5f4a41)){var _0x248b44={'Email':_0x5f4a41};var _0xb1ef44={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0xb095b1[_0xed65('0x1d')](_0xed65('0x1f'))[_0xed65('0x20')](_0x248b44,_0xb1ef44)['execute']()['then'](function(_0x1ce499){if(_0x1ce499[_0xed65('0x21')]){var _0x2fb760=_[_0xed65('0x20')](_0x1ce499,function(_0x49a734){return _0x49a734[_0xed65('0x22')]===_0x5f4a41;});if(_0x2fb760){logger[_0xed65('0x1b')]('Agent\x20%s\x20found.',_0x5f4a41);return BPromise[_0xed65('0x23')]({'id':_0x2fb760['Id'],'name':_0x2fb760[_0xed65('0x24')]});}}else{logger[_0xed65('0x1b')](_0xed65('0x25'),_0x5f4a41);return _0xb095b1['identity']()[_0xed65('0x26')](function(_0x1ec292){return BPromise[_0xed65('0x23')]({'id':_0x1ec292[_0xed65('0x27')],'name':_0x1ec292[_0xed65('0x28')]});});}});}else{logger[_0xed65('0x1b')](_0xed65('0x25'),_0x5f4a41);return _0xb095b1[_0xed65('0x29')]()[_0xed65('0x26')](function(_0x2f80d0){return BPromise[_0xed65('0x23')]({'id':_0x2f80d0[_0xed65('0x27')],'name':_0x2f80d0[_0xed65('0x28')]});});}}function getEndUser(_0x2c7e7c,_0x30f825,_0x442515,_0x377756,_0x547af4){var _0x589110={'$or':{'Phone':_0x377756}};var _0x48f3f1={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xed65('0x23')]()[_0xed65('0x26')](function(){logger[_0xed65('0x1b')](_0xed65('0x2a'),_0x377756,_0x30f825['moduleSearch']);switch(_0x30f825[_0xed65('0x2b')]){case'contact_lead':var _0x3c18a1=_[_0xed65('0x2c')](_0x589110);if(_0x30f825['additionalSearchContact']){var _0x46df2f={};_0x46df2f[_0x30f825[_0xed65('0x2d')]]=_0x377756;_[_0xed65('0x2e')](_0x3c18a1[_0xed65('0x2f')],_0x46df2f);}return _0x547af4[_0xed65('0x1d')]('Contact')[_0xed65('0x20')](_0x3c18a1,_0x48f3f1)['execute']()[_0xed65('0x26')](function(_0x358a7a){if(_0x358a7a&&_0x358a7a[_0xed65('0x21')]){return _0x358a7a;}else{var _0x17d274=_[_0xed65('0x2c')](_0x589110);if(_0x30f825['additionalSearchLead']){var _0x31a7ac={};_0x31a7ac[_0x30f825[_0xed65('0x30')]]=_0x377756;_[_0xed65('0x2e')](_0x17d274[_0xed65('0x2f')],_0x31a7ac);}return _0x547af4[_0xed65('0x1d')]('Lead')[_0xed65('0x20')](_0x17d274,_0x48f3f1);}});case _0xed65('0x31'):var _0x505d91=_[_0xed65('0x2c')](_0x589110);if(_0x30f825[_0xed65('0x32')]){var _0x46df2f={};_0x46df2f[_0x30f825['additionalSearchAccount']]=_0x377756;_[_0xed65('0x2e')](_0x505d91[_0xed65('0x2f')],_0x46df2f);}return _0x547af4[_0xed65('0x1d')](_0xed65('0x33'))[_0xed65('0x20')](_0x505d91,_0x48f3f1)['execute']()[_0xed65('0x26')](function(_0x57385d){if(_0x57385d&&_0x57385d[_0xed65('0x21')]){return _0x57385d;}else{var _0xa4f7ea=_[_0xed65('0x2c')](_0x589110);if(_0x30f825[_0xed65('0x2d')]){var _0x5caa7a={};_0x5caa7a[_0x30f825['additionalSearchContact']]=_0x377756;_[_0xed65('0x2e')](_0xa4f7ea[_0xed65('0x2f')],_0x5caa7a);}return _0x547af4[_0xed65('0x1d')](_0xed65('0x34'))[_0xed65('0x20')](_0xa4f7ea,_0x48f3f1)[_0xed65('0x26')](function(_0x52f4f4){if(_0x52f4f4&&_0x52f4f4[_0xed65('0x21')]){return _0x52f4f4;}else{var _0x258e71=_[_0xed65('0x2c')](_0x589110);if(_0x30f825[_0xed65('0x30')]){var _0x336409={};_0x336409[_0x30f825[_0xed65('0x30')]]=_0x377756;_[_0xed65('0x2e')](_0x258e71[_0xed65('0x2f')],_0x336409);}return _0x547af4[_0xed65('0x1d')](_0xed65('0x35'))[_0xed65('0x20')](_0x258e71,_0x48f3f1);}});}});case _0xed65('0x17'):var _0x3c18a1=_[_0xed65('0x2c')](_0x589110);if(_0x30f825[_0xed65('0x2d')]){var _0x46df2f={};_0x46df2f[_0x30f825[_0xed65('0x2d')]]=_0x377756;_[_0xed65('0x2e')](_0x3c18a1[_0xed65('0x2f')],_0x46df2f);}return _0x547af4[_0xed65('0x1d')](_0xed65('0x34'))['find'](_0x3c18a1,_0x48f3f1)['execute']();case _0xed65('0x12'):var _0x11a3c8=_['cloneDeep'](_0x589110);if(_0x30f825[_0xed65('0x30')]){var _0x46df2f={};_0x46df2f[_0x30f825[_0xed65('0x30')]]=_0x377756;_[_0xed65('0x2e')](_0x11a3c8['$or'],_0x46df2f);}return _0x547af4[_0xed65('0x1d')](_0xed65('0x35'))[_0xed65('0x20')](_0x11a3c8,_0x48f3f1);case'account':var _0x505d91=_[_0xed65('0x2c')](_0x589110);if(_0x30f825[_0xed65('0x32')]){var _0x46df2f={};_0x46df2f[_0x30f825[_0xed65('0x32')]]=_0x377756;_['merge'](_0x505d91[_0xed65('0x2f')],_0x46df2f);}return _0x547af4[_0xed65('0x1d')]('Account')['find'](_0x505d91,_0x48f3f1);default:return null;}})[_0xed65('0x26')](function(_0x3b3457){if(_0x3b3457&&_0x3b3457['length']){var _0x2e54a9=_[_0xed65('0x36')](_0x3b3457);if(_0x2e54a9){return BPromise[_0xed65('0x23')]({'id':_0x2e54a9['Id'],'name':_0x2e54a9[_0xed65('0x24')],'phone':_0x2e54a9[_0xed65('0x37')],'endUserType':_0x2e54a9[_0xed65('0x38')][_0xed65('0x39')][_0xed65('0x3a')]()});}}})['then'](function(_0x225f45){if(_0x225f45){logger[_0xed65('0x1b')](_0xed65('0x3b'),_0x225f45['endUserType'],_0x377756);return BPromise[_0xed65('0x23')](_0x225f45);}else{logger[_0xed65('0x1b')](_0xed65('0x3c'),_0x377756);var _0x10b5bb={'Phone':_0x377756};if(_0x30f825[_0xed65('0x3d')]){if(_0x30f825[_0xed65('0x3d')]===_0xed65('0x17')){logger[_0xed65('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x377756,_0x30f825[_0xed65('0x3d')]);_0x10b5bb[_0xed65('0x3e')]=_0x442515!==_0xed65('0x3f')?_0x442515:util[_0xed65('0x40')](_0xed65('0x41'),_0x377756);}else if(_0x30f825['moduleCreate']===_0xed65('0x12')){logger[_0xed65('0x1b')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x377756,_0x30f825[_0xed65('0x3d')]);_0x10b5bb[_0xed65('0x3e')]=_0x442515!==''?_0x442515:util[_0xed65('0x40')](_0xed65('0x41'),_0x377756);_0x10b5bb[_0xed65('0x42')]='No\x20Company';}else if(_0x30f825[_0xed65('0x3d')]===_0xed65('0x14')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x377756,_0x30f825['moduleCreate']);_0x10b5bb[_0xed65('0x24')]=_0x442515!==''?_0x442515:util[_0xed65('0x40')](_0xed65('0x41'),_0x377756);}else{return null;}}return _0x547af4['sobject'](_[_0xed65('0x43')](_0x30f825['moduleCreate']))['create'](_0x10b5bb)['then'](function(_0xdd0b1f){return BPromise[_0xed65('0x23')]({'id':_0xdd0b1f['id'],'endUserType':_0x30f825[_0xed65('0x3d')]});});}});}function getCustomFields(_0x4aee53,_0x52eac1){var _0x527a45={};if(_0x4aee53[_0xed65('0x21')]>0x0){_['forEach'](_0x4aee53,function(_0xd4b9f3){if(_[_0xed65('0x44')](['string',_0xed65('0x45')],_0xd4b9f3[_0xed65('0x39')])&&_0xd4b9f3[_0xed65('0x46')]){_0x527a45[_0xd4b9f3[_0xed65('0x46')]]=_0xd4b9f3[_0xed65('0x47')][_0xed65('0x48')]();}else if(_0xd4b9f3[_0xed65('0x39')]===_0xed65('0x49')&&_0xd4b9f3[_0xed65('0x4a')]&&_0xd4b9f3[_0xed65('0x46')]){_0x52eac1[_0xd4b9f3['variableName']]&&(_0x527a45[_0xd4b9f3[_0xed65('0x46')]]=_0x52eac1[_0xd4b9f3[_0xed65('0x4a')]][_0xed65('0x48')]());}else if(_0xd4b9f3['type']==='customVariable'&&_0xd4b9f3['Variable']&&_0xd4b9f3['Variable'][_0xed65('0x4b')]&&_0xd4b9f3[_0xed65('0x46')]){_0x52eac1[_0xd4b9f3['Variable'][_0xed65('0x4b')][_0xed65('0x3a')]()]&&(_0x527a45[_0xd4b9f3['idField']]=_0x52eac1[_0xd4b9f3[_0xed65('0x4c')][_0xed65('0x4b')][_0xed65('0x3a')]()][_0xed65('0x48')]());}});}return _0x527a45;}function getConnection(_0x1ff570){var _0x1455bd=_0x1ff570[_0xed65('0x4d')][_0xed65('0x4e')](_0x1ff570[_0xed65('0x4f')]);var _0x21706c=new jsforce[(_0xed65('0x50'))]({'oauth2':{'loginUrl':_0x1ff570[_0xed65('0x51')]||_0xed65('0x52'),'clientId':_0x1ff570[_0xed65('0x53')],'clientSecret':_0x1ff570[_0xed65('0x54')]}});return _0x21706c[_0xed65('0x55')](_0x1ff570[_0xed65('0x56')],_0x1455bd)[_0xed65('0x26')](function(){logger[_0xed65('0x1b')](_0xed65('0x57'));return _0x21706c;});}exports['queue']=function(_0x15d047,_0x28c7fe,_0x5650a4,_0x5c6931,_0x2a9c69,_0x12bf02){var _0x41e4bc,_0x2a891d,_0x25cc14,_0x386026;_0x12bf02[_0xed65('0x58')]=intUtil[_0xed65('0x59')](_0x12bf02[_0xed65('0x58')]);_0x12bf02['remoteUri']=intUtil[_0xed65('0x59')](_0x12bf02['remoteUri']);if(_0x2a9c69&&_0x2a9c69['monitor_format']){logger[_0xed65('0x1b')]('[QUEUE]',_0xed65('0x5a'));_0x28c7fe[_0xed65('0x5b')]=util['format'](_0xed65('0x5c'),_0x12bf02[_0xed65('0x58')],_0x28c7fe[_0xed65('0x5d')],md5(_0x28c7fe[_0xed65('0x5d')]));}else{_0x28c7fe[_0xed65('0x5b')]='';}return getConnection(_0x12bf02)['then'](function(_0x43377c){_0x386026=_0x43377c;return getUser(_0x12bf02,_0x5c6931[_0xed65('0x5e')],_0x386026);})[_0xed65('0x26')](function(_0x3daacd){_0x41e4bc=_0x3daacd;return getEndUser(_0x12bf02,_0x5650a4,_0x28c7fe[_0xed65('0x5f')],_0x28c7fe['calleridnum'],_0x386026);})[_0xed65('0x26')](function(_0x3795f0){_0x2a891d=_0x3795f0;return getTicket(_0x12bf02,_0x41e4bc,_0x2a891d,_0x5650a4,_0x28c7fe,_0x5650a4[_0xed65('0x60')],_0x386026,_0xed65('0x61'));})['then'](function(_0x4389a6){_0x25cc14=_0x4389a6;logger['info'](_0xed65('0x62'),_0x25cc14['id']);logger[_0xed65('0x1b')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x25cc14['id'],_0x5c6931['name'],_0x12bf02[_0xed65('0x39')]);switch(_0x12bf02[_0xed65('0x39')]){case'integrationTab':emit(util['format'](_0xed65('0x63'),_0x5c6931[_0xed65('0x4b')]),_0xed65('0x64'),{'recordId':_0x25cc14['id']});break;case _0xed65('0x65'):emit(util['format'](_0xed65('0x63'),_0x5c6931[_0xed65('0x4b')]),_0xed65('0x66'),{'uri':util['format']('%s/%s/e',_0x386026[_0xed65('0x67')],_0x25cc14['id'])});break;default:logger[_0xed65('0x68')](_0xed65('0x69'));}})[_0xed65('0x6a')](function(_0x252f5b){logger[_0xed65('0x68')](_0xed65('0x6b'),_0x252f5b);});};exports[_0xed65('0x6c')]=function(_0x2016d5,_0x4bd1d8,_0x4f8b2b,_0x6ac82e,_0x457bf2,_0x5c9762,_0x14359a){var _0x522e13,_0x22614f,_0x2aea25,_0x29457e;_0x5c9762['serverUrl']=intUtil['stripTrailingSlash'](_0x5c9762[_0xed65('0x58')]);_0x5c9762['remoteUri']=intUtil['stripTrailingSlash'](_0x5c9762[_0xed65('0x51')]);if(_0x14359a&&_0x14359a[_0xed65('0x6d')]&&_0x14359a[_0xed65('0x6d')]!=='none'){logger['info'](_0xed65('0x6e'),_0xed65('0x5a'));_0x4bd1d8[_0xed65('0x5b')]=util[_0xed65('0x40')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5c9762[_0xed65('0x58')],_0x4bd1d8['uniqueid'],md5(_0x4bd1d8[_0xed65('0x5d')]));}return getConnection(_0x5c9762)['then'](function(_0x167a3b){_0x29457e=_0x167a3b;return getUser(_0x5c9762,_0x6ac82e[_0xed65('0x5e')],_0x29457e);})[_0xed65('0x26')](function(_0x2e8d10){_0x522e13=_0x2e8d10;return getEndUser(_0x5c9762,_0x4f8b2b,_0x4bd1d8[_0xed65('0x6f')],_0x4bd1d8[_0xed65('0x70')],_0x29457e);})[_0xed65('0x26')](function(_0x33438c){_0x22614f=_0x33438c;return getTicket(_0x5c9762,_0x522e13,_0x22614f,_0x4f8b2b,_0x4bd1d8,_0x4f8b2b['Fields'],_0x29457e,'outbound');})[_0xed65('0x26')](function(_0x5f00eb){_0x2aea25=_0x5f00eb;logger[_0xed65('0x1b')](_0xed65('0x71'),_0x2aea25['id']);logger[_0xed65('0x1b')](_0xed65('0x72'),_0x2aea25['id'],_0x6ac82e[_0xed65('0x4b')],_0x5c9762[_0xed65('0x39')]);switch(_0x5c9762[_0xed65('0x39')]){case _0xed65('0x73'):emit(util[_0xed65('0x40')](_0xed65('0x63'),_0x6ac82e['name']),_0xed65('0x64'),{'recordId':_0x2aea25['id']});break;case _0xed65('0x65'):emit(util['format'](_0xed65('0x63'),_0x6ac82e[_0xed65('0x4b')]),_0xed65('0x66'),{'uri':util[_0xed65('0x40')](_0xed65('0x74'),_0x29457e[_0xed65('0x67')],_0x2aea25['id'])});break;default:logger[_0xed65('0x68')]('[OUTBOUND]',_0xed65('0x75'));}})['catch'](function(_0x50bfbd){logger[_0xed65('0x68')](_0xed65('0x6e'),_0x50bfbd);});};exports[_0xed65('0x76')]=function(_0x2f9454,_0x1a0c89,_0x30f348,_0x4ae963,_0x46159b,_0x242513){var _0x1a89b8,_0x4426d9,_0x498151,_0x19cd07;_0x242513[_0xed65('0x58')]=intUtil[_0xed65('0x59')](_0x242513['serverUrl']);_0x242513['remoteUri']=intUtil[_0xed65('0x59')](_0x242513['remoteUri']);if(_0x46159b&&_0x46159b[_0xed65('0x77')]){logger[_0xed65('0x1b')]('['+_0x1a0c89['lastevent'][_0xed65('0x78')]()+']',_0xed65('0x5a'));_0x1a0c89[_0xed65('0x5b')]=util[_0xed65('0x40')](_0xed65('0x5c'),_0x242513[_0xed65('0x58')],_0x1a0c89[_0xed65('0x5d')],md5(_0x1a0c89[_0xed65('0x5d')]));}else{_0x1a0c89[_0xed65('0x5b')]='';}return getConnection(_0x242513)[_0xed65('0x26')](function(_0x2436c8){_0x19cd07=_0x2436c8;if(!_[_0xed65('0x1e')](_0x4ae963)){return getUser(_0x242513,_0x4ae963[_0xed65('0x4b')],_0x19cd07);}else{return getUser(_0x242513,null,_0x19cd07);}})[_0xed65('0x26')](function(_0x5249f7){_0x1a89b8=_0x5249f7;return getEndUser(_0x242513,_0x30f348,_0x1a0c89[_0xed65('0x5f')],_0x1a0c89[_0xed65('0x79')],_0x19cd07);})[_0xed65('0x26')](function(_0x21c908){_0x4426d9=_0x21c908;return getTicket(_0x242513,_0x1a89b8,_0x4426d9,_0x30f348,_0x1a0c89,_0x30f348['Fields'],_0x19cd07);})[_0xed65('0x26')](function(_0x40fb50){_0x498151=_0x40fb50;logger[_0xed65('0x1b')]('['+_0x1a0c89[_0xed65('0x7a')][_0xed65('0x78')]()+_0xed65('0x7b'),_0x498151['id']);logger[_0xed65('0x1b')]('['+_0x1a0c89[_0xed65('0x7a')][_0xed65('0x78')]()+_0xed65('0x7c'),_0x242513[_0xed65('0x39')]);})[_0xed65('0x6a')](function(_0x4477f2){logger[_0xed65('0x68')]('['+_0x1a0c89[_0xed65('0x7a')][_0xed65('0x78')]()+']',_0x4477f2);});}; \ No newline at end of file +var _0xcc3a=['merge','$or','Contact','cloneDeep','additionalSearchLead','sobject','Lead','account_contact_lead','additionalSearchAccount','Account','first','Phone','attributes','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.','LastName','','format','Caller\x20-\x20%s','Company','forEach','includes','string','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','concat','securityToken','https://login.salesforce.com','clientId','clientSecret','Connection\x20established.','serverUrl','stripTrailingSlash','remoteUri','monitor_format','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','calleridname','calleridnum','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','trigger:salesforce:display','user:%s','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','[QUEUE]','outbound','recordingFormat','email','destcalleridname','Fields','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','[OUTBOUND]','Salesforce\x20account\x20type\x20not\x20recognized','unmanaged','lastevent','toUpperCase','request-promise','moment','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','emit','assign','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','create','isNil','validateEmail','User','find','execute','then','length','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','additionalSearchContact'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xcc3a,0xcc));var _0xacc3=function(_0x101e7b,_0x4ef05b){_0x101e7b=_0x101e7b-0x0;var _0x4995c0=_0xcc3a[_0x101e7b];return _0x4995c0;};'use strict';var _=require('lodash');var rp=require(_0xacc3('0x0'));var moment=require(_0xacc3('0x1'));var BPromise=require('bluebird');var md5=require(_0xacc3('0x2'));var jsforce=require('jsforce');var util=require(_0xacc3('0x3'));var Redis=require(_0xacc3('0x4'));var intUtil=require(_0xacc3('0x5'));var config=require(_0xacc3('0x6'));var logger=require(_0xacc3('0x7'))(_0xacc3('0x8'));config['redis']=_['defaults'](config[_0xacc3('0x9')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xacc3('0x9')]));function emit(_0x4d9f8f,_0x524701,_0x27c32e){io['to'](_0x4d9f8f)[_0xacc3('0xa')](_0x524701,_0x27c32e);}function getTicket(_0x51ce44,_0x5a08c6,_0x4788a8,_0x2f9df7,_0x9636cd,_0xa10720,_0x3ad29b,_0x35720c){var _0x34847f=Object[_0xacc3('0xb')]({},{'OwnerId':_0x5a08c6['id'],'Subject':intUtil[_0xacc3('0xc')](_0x2f9df7['Subjects'],_0x9636cd,'\x20'),'Description':intUtil[_0xacc3('0xc')](_0x2f9df7[_0xacc3('0xd')],_0x9636cd,'\x0a')},getCustomFields(_0xa10720,_0x9636cd));if(_0x4788a8){if(_0x2f9df7['ticketType']===_0xacc3('0xe')){_0x34847f[_0xacc3('0xf')]=moment[_0xacc3('0x10')]();_0x34847f[_0xacc3('0x11')]=![];_0x34847f[_0xacc3('0x12')]=![];if(_0x4788a8[_0xacc3('0x13')]===_0xacc3('0x14')||_0x4788a8[_0xacc3('0x13')]===_0xacc3('0x15')){_0x34847f[_0xacc3('0x16')]=_0x4788a8['id'];}else if(_0x4788a8['endUserType']===_0xacc3('0x17')){_0x34847f[_0xacc3('0x18')]=_0x4788a8['id'];}}else if(_0x2f9df7[_0xacc3('0x19')]===_0xacc3('0x1a')){if(_0x4788a8[_0xacc3('0x13')]===_0xacc3('0x14')){_0x34847f['ContactId']=_0x4788a8['id'];}else if(_0x4788a8['endUserType']===_0xacc3('0x17')){_0x34847f[_0xacc3('0x1b')]=_0x4788a8['id'];}else if(_0x4788a8['endUserType']===_0xacc3('0x15')&&_0x2f9df7['leadId']){_0x34847f[_0x2f9df7[_0xacc3('0x1c')]]=_0x4788a8['id'];}else{logger[_0xacc3('0x1d')](_0xacc3('0x1e'));}}}return _0x3ad29b['sobject'](_0x2f9df7[_0xacc3('0x19')])[_0xacc3('0x1f')](_0x34847f);}function getUser(_0x412f54,_0x2e7dd1,_0x1cefee){if(!_[_0xacc3('0x20')](_0x2e7dd1)&&intUtil[_0xacc3('0x21')](_0x2e7dd1)){var _0x27a457={'Email':_0x2e7dd1};var _0x1959af={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x1cefee['sobject'](_0xacc3('0x22'))[_0xacc3('0x23')](_0x27a457,_0x1959af)[_0xacc3('0x24')]()[_0xacc3('0x25')](function(_0x3451c5){if(_0x3451c5[_0xacc3('0x26')]){var _0x1ec726=_[_0xacc3('0x23')](_0x3451c5,function(_0x57e57b){return _0x57e57b[_0xacc3('0x27')]===_0x2e7dd1;});if(_0x1ec726){logger[_0xacc3('0x1d')](_0xacc3('0x28'),_0x2e7dd1);return BPromise[_0xacc3('0x29')]({'id':_0x1ec726['Id'],'name':_0x1ec726[_0xacc3('0x2a')]});}}else{logger[_0xacc3('0x1d')](_0xacc3('0x2b'),_0x2e7dd1);return _0x1cefee[_0xacc3('0x2c')]()['then'](function(_0x2185bd){return BPromise[_0xacc3('0x29')]({'id':_0x2185bd['user_id'],'name':_0x2185bd[_0xacc3('0x2d')]});});}});}else{logger[_0xacc3('0x1d')]('Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.',_0x2e7dd1);return _0x1cefee[_0xacc3('0x2c')]()[_0xacc3('0x25')](function(_0x4207a7){return BPromise[_0xacc3('0x29')]({'id':_0x4207a7['user_id'],'name':_0x4207a7[_0xacc3('0x2d')]});});}}function getEndUser(_0x8d5f8,_0x32316e,_0x5c7c4f,_0x1e46cb,_0x14cee0){var _0x458764={'$or':{'Phone':_0x1e46cb}};var _0x29e9b7={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xacc3('0x29')]()[_0xacc3('0x25')](function(){logger['info'](_0xacc3('0x2e'),_0x1e46cb,_0x32316e[_0xacc3('0x2f')]);switch(_0x32316e[_0xacc3('0x2f')]){case _0xacc3('0x30'):var _0x3264ed=_['cloneDeep'](_0x458764);if(_0x32316e[_0xacc3('0x31')]){var _0x3e5647={};_0x3e5647[_0x32316e[_0xacc3('0x31')]]=_0x1e46cb;_[_0xacc3('0x32')](_0x3264ed[_0xacc3('0x33')],_0x3e5647);}return _0x14cee0['sobject'](_0xacc3('0x34'))['find'](_0x3264ed,_0x29e9b7)[_0xacc3('0x24')]()[_0xacc3('0x25')](function(_0x16de89){if(_0x16de89&&_0x16de89[_0xacc3('0x26')]){return _0x16de89;}else{var _0x24e20b=_[_0xacc3('0x35')](_0x458764);if(_0x32316e[_0xacc3('0x36')]){var _0x3eae24={};_0x3eae24[_0x32316e[_0xacc3('0x36')]]=_0x1e46cb;_[_0xacc3('0x32')](_0x24e20b[_0xacc3('0x33')],_0x3eae24);}return _0x14cee0[_0xacc3('0x37')](_0xacc3('0x38'))[_0xacc3('0x23')](_0x24e20b,_0x29e9b7);}});case _0xacc3('0x39'):var _0x203226=_['cloneDeep'](_0x458764);if(_0x32316e[_0xacc3('0x3a')]){var _0x3e5647={};_0x3e5647[_0x32316e['additionalSearchAccount']]=_0x1e46cb;_['merge'](_0x203226[_0xacc3('0x33')],_0x3e5647);}return _0x14cee0[_0xacc3('0x37')](_0xacc3('0x3b'))[_0xacc3('0x23')](_0x203226,_0x29e9b7)['execute']()[_0xacc3('0x25')](function(_0x4fd227){if(_0x4fd227&&_0x4fd227[_0xacc3('0x26')]){return _0x4fd227;}else{var _0x4e9804=_[_0xacc3('0x35')](_0x458764);if(_0x32316e['additionalSearchContact']){var _0x32759a={};_0x32759a[_0x32316e[_0xacc3('0x31')]]=_0x1e46cb;_['merge'](_0x4e9804['$or'],_0x32759a);}return _0x14cee0[_0xacc3('0x37')](_0xacc3('0x34'))['find'](_0x4e9804,_0x29e9b7)[_0xacc3('0x25')](function(_0x42ace2){if(_0x42ace2&&_0x42ace2[_0xacc3('0x26')]){return _0x42ace2;}else{var _0x975440=_['cloneDeep'](_0x458764);if(_0x32316e[_0xacc3('0x36')]){var _0x1a7b92={};_0x1a7b92[_0x32316e[_0xacc3('0x36')]]=_0x1e46cb;_[_0xacc3('0x32')](_0x975440[_0xacc3('0x33')],_0x1a7b92);}return _0x14cee0[_0xacc3('0x37')](_0xacc3('0x38'))['find'](_0x975440,_0x29e9b7);}});}});case _0xacc3('0x14'):var _0x3264ed=_['cloneDeep'](_0x458764);if(_0x32316e[_0xacc3('0x31')]){var _0x3e5647={};_0x3e5647[_0x32316e[_0xacc3('0x31')]]=_0x1e46cb;_[_0xacc3('0x32')](_0x3264ed[_0xacc3('0x33')],_0x3e5647);}return _0x14cee0[_0xacc3('0x37')](_0xacc3('0x34'))['find'](_0x3264ed,_0x29e9b7)[_0xacc3('0x24')]();case _0xacc3('0x15'):var _0x1fe9a6=_[_0xacc3('0x35')](_0x458764);if(_0x32316e[_0xacc3('0x36')]){var _0x3e5647={};_0x3e5647[_0x32316e[_0xacc3('0x36')]]=_0x1e46cb;_['merge'](_0x1fe9a6[_0xacc3('0x33')],_0x3e5647);}return _0x14cee0[_0xacc3('0x37')](_0xacc3('0x38'))[_0xacc3('0x23')](_0x1fe9a6,_0x29e9b7);case'account':var _0x203226=_[_0xacc3('0x35')](_0x458764);if(_0x32316e[_0xacc3('0x3a')]){var _0x3e5647={};_0x3e5647[_0x32316e['additionalSearchAccount']]=_0x1e46cb;_[_0xacc3('0x32')](_0x203226[_0xacc3('0x33')],_0x3e5647);}return _0x14cee0[_0xacc3('0x37')](_0xacc3('0x3b'))[_0xacc3('0x23')](_0x203226,_0x29e9b7);default:return null;}})[_0xacc3('0x25')](function(_0x5a72f9){if(_0x5a72f9&&_0x5a72f9[_0xacc3('0x26')]){var _0x1087b7=_[_0xacc3('0x3c')](_0x5a72f9);if(_0x1087b7){return BPromise[_0xacc3('0x29')]({'id':_0x1087b7['Id'],'name':_0x1087b7['Name'],'phone':_0x1087b7[_0xacc3('0x3d')],'endUserType':_0x1087b7[_0xacc3('0x3e')]['type'][_0xacc3('0x3f')]()});}}})[_0xacc3('0x25')](function(_0x5d7b95){if(_0x5d7b95){logger[_0xacc3('0x1d')](_0xacc3('0x40'),_0x5d7b95[_0xacc3('0x13')],_0x1e46cb);return BPromise[_0xacc3('0x29')](_0x5d7b95);}else{logger[_0xacc3('0x1d')](_0xacc3('0x41'),_0x1e46cb);var _0x112864={'Phone':_0x1e46cb};if(_0x32316e[_0xacc3('0x42')]){if(_0x32316e['moduleCreate']===_0xacc3('0x14')){logger[_0xacc3('0x1d')](_0xacc3('0x43'),_0x1e46cb,_0x32316e[_0xacc3('0x42')]);_0x112864[_0xacc3('0x44')]=_0x5c7c4f!==_0xacc3('0x45')?_0x5c7c4f:util[_0xacc3('0x46')](_0xacc3('0x47'),_0x1e46cb);}else if(_0x32316e[_0xacc3('0x42')]===_0xacc3('0x15')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x1e46cb,_0x32316e[_0xacc3('0x42')]);_0x112864[_0xacc3('0x44')]=_0x5c7c4f!==_0xacc3('0x45')?_0x5c7c4f:util[_0xacc3('0x46')](_0xacc3('0x47'),_0x1e46cb);_0x112864[_0xacc3('0x48')]='No\x20Company';}else if(_0x32316e[_0xacc3('0x42')]===_0xacc3('0x17')){logger['info'](_0xacc3('0x43'),_0x1e46cb,_0x32316e[_0xacc3('0x42')]);_0x112864['Name']=_0x5c7c4f!==_0xacc3('0x45')?_0x5c7c4f:util[_0xacc3('0x46')](_0xacc3('0x47'),_0x1e46cb);}else{return null;}}return _0x14cee0[_0xacc3('0x37')](_['upperFirst'](_0x32316e[_0xacc3('0x42')]))[_0xacc3('0x1f')](_0x112864)[_0xacc3('0x25')](function(_0x1d1f8b){return BPromise['resolve']({'id':_0x1d1f8b['id'],'endUserType':_0x32316e['moduleCreate']});});}});}function getCustomFields(_0x3df43a,_0x319c49){var _0x53fc33={};if(_0x3df43a[_0xacc3('0x26')]>0x0){_[_0xacc3('0x49')](_0x3df43a,function(_0x2c53c){if(_[_0xacc3('0x4a')]([_0xacc3('0x4b'),_0xacc3('0x4c')],_0x2c53c['type'])&&_0x2c53c[_0xacc3('0x4d')]){_0x53fc33[_0x2c53c[_0xacc3('0x4d')]]=_0x2c53c[_0xacc3('0x4e')][_0xacc3('0x4f')]();}else if(_0x2c53c[_0xacc3('0x50')]===_0xacc3('0x51')&&_0x2c53c[_0xacc3('0x52')]&&_0x2c53c[_0xacc3('0x4d')]){_0x319c49[_0x2c53c[_0xacc3('0x52')]]&&(_0x53fc33[_0x2c53c[_0xacc3('0x4d')]]=_0x319c49[_0x2c53c[_0xacc3('0x52')]][_0xacc3('0x4f')]());}else if(_0x2c53c[_0xacc3('0x50')]===_0xacc3('0x53')&&_0x2c53c[_0xacc3('0x54')]&&_0x2c53c['Variable']['name']&&_0x2c53c[_0xacc3('0x4d')]){_0x319c49[_0x2c53c[_0xacc3('0x54')]['name'][_0xacc3('0x3f')]()]&&(_0x53fc33[_0x2c53c[_0xacc3('0x4d')]]=_0x319c49[_0x2c53c[_0xacc3('0x54')][_0xacc3('0x55')][_0xacc3('0x3f')]()]['toString']());}});}return _0x53fc33;}function getConnection(_0x1582b1){var _0x27b26e=_0x1582b1['password'][_0xacc3('0x56')](_0x1582b1[_0xacc3('0x57')]);var _0x44df58=new jsforce['Connection']({'oauth2':{'loginUrl':_0x1582b1['remoteUri']||_0xacc3('0x58'),'clientId':_0x1582b1[_0xacc3('0x59')],'clientSecret':_0x1582b1[_0xacc3('0x5a')]}});return _0x44df58['login'](_0x1582b1['username'],_0x27b26e)['then'](function(){logger['info'](_0xacc3('0x5b'));return _0x44df58;});}exports['queue']=function(_0xe0f713,_0x45f137,_0x461e5a,_0x56e290,_0x57ae22,_0xa327a3){var _0x459e20,_0xcce3de,_0x4fd45a,_0x340214;_0xa327a3[_0xacc3('0x5c')]=intUtil[_0xacc3('0x5d')](_0xa327a3[_0xacc3('0x5c')]);_0xa327a3[_0xacc3('0x5e')]=intUtil[_0xacc3('0x5d')](_0xa327a3[_0xacc3('0x5e')]);if(_0x57ae22&&_0x57ae22[_0xacc3('0x5f')]){logger[_0xacc3('0x1d')]('[QUEUE]',_0xacc3('0x60'));_0x45f137['recordingURL']=util['format'](_0xacc3('0x61'),_0xa327a3[_0xacc3('0x5c')],_0x45f137[_0xacc3('0x62')],md5(_0x45f137[_0xacc3('0x62')]));}else{_0x45f137[_0xacc3('0x63')]='';}return getConnection(_0xa327a3)[_0xacc3('0x25')](function(_0x2a56b2){_0x340214=_0x2a56b2;return getUser(_0xa327a3,_0x56e290['email'],_0x340214);})['then'](function(_0x1b484b){_0x459e20=_0x1b484b;return getEndUser(_0xa327a3,_0x461e5a,_0x45f137[_0xacc3('0x64')],_0x45f137[_0xacc3('0x65')],_0x340214);})[_0xacc3('0x25')](function(_0x4162f0){_0xcce3de=_0x4162f0;return getTicket(_0xa327a3,_0x459e20,_0xcce3de,_0x461e5a,_0x45f137,_0x461e5a['Fields'],_0x340214,_0xacc3('0x66'));})[_0xacc3('0x25')](function(_0x1977d3){_0x4fd45a=_0x1977d3;logger[_0xacc3('0x1d')](_0xacc3('0x67'),_0x4fd45a['id']);logger['info'](_0xacc3('0x68'),_0x4fd45a['id'],_0x56e290[_0xacc3('0x55')],_0xa327a3['type']);switch(_0xa327a3['type']){case _0xacc3('0x69'):emit(util[_0xacc3('0x46')]('user:%s',_0x56e290['name']),_0xacc3('0x6a'),{'recordId':_0x4fd45a['id']});break;case'newTab':emit(util[_0xacc3('0x46')](_0xacc3('0x6b'),_0x56e290[_0xacc3('0x55')]),_0xacc3('0x6c'),{'uri':util[_0xacc3('0x46')](_0xacc3('0x6d'),_0x340214[_0xacc3('0x6e')],_0x4fd45a['id'])});break;default:logger[_0xacc3('0x6f')](_0xacc3('0x70'));}})[_0xacc3('0x71')](function(_0x1130fd){logger[_0xacc3('0x6f')](_0xacc3('0x72'),_0x1130fd);});};exports[_0xacc3('0x73')]=function(_0x46dd5b,_0x41f266,_0x3ddc51,_0x33d20b,_0x32d8b0,_0x4d864a,_0x330e7a){var _0xa3ac82,_0x5b46e8,_0x259205,_0x29ba50;_0x4d864a['serverUrl']=intUtil[_0xacc3('0x5d')](_0x4d864a[_0xacc3('0x5c')]);_0x4d864a[_0xacc3('0x5e')]=intUtil[_0xacc3('0x5d')](_0x4d864a[_0xacc3('0x5e')]);if(_0x330e7a&&_0x330e7a[_0xacc3('0x74')]&&_0x330e7a[_0xacc3('0x74')]!=='none'){logger['info']('[OUTBOUND]',_0xacc3('0x60'));_0x41f266['recordingURL']=util['format'](_0xacc3('0x61'),_0x4d864a[_0xacc3('0x5c')],_0x41f266[_0xacc3('0x62')],md5(_0x41f266['uniqueid']));}return getConnection(_0x4d864a)['then'](function(_0x3c0496){_0x29ba50=_0x3c0496;return getUser(_0x4d864a,_0x33d20b[_0xacc3('0x75')],_0x29ba50);})[_0xacc3('0x25')](function(_0x30d9d8){_0xa3ac82=_0x30d9d8;return getEndUser(_0x4d864a,_0x3ddc51,_0x41f266[_0xacc3('0x76')],_0x41f266['destcalleridnum'],_0x29ba50);})['then'](function(_0x29a7fd){_0x5b46e8=_0x29a7fd;return getTicket(_0x4d864a,_0xa3ac82,_0x5b46e8,_0x3ddc51,_0x41f266,_0x3ddc51[_0xacc3('0x77')],_0x29ba50,_0xacc3('0x73'));})[_0xacc3('0x25')](function(_0x45a057){_0x259205=_0x45a057;logger[_0xacc3('0x1d')](_0xacc3('0x78'),_0x259205['id']);logger[_0xacc3('0x1d')](_0xacc3('0x79'),_0x259205['id'],_0x33d20b[_0xacc3('0x55')],_0x4d864a[_0xacc3('0x50')]);switch(_0x4d864a[_0xacc3('0x50')]){case _0xacc3('0x69'):emit(util['format'](_0xacc3('0x6b'),_0x33d20b[_0xacc3('0x55')]),_0xacc3('0x6a'),{'recordId':_0x259205['id']});break;case'newTab':emit(util[_0xacc3('0x46')](_0xacc3('0x6b'),_0x33d20b[_0xacc3('0x55')]),_0xacc3('0x6c'),{'uri':util[_0xacc3('0x46')]('%s/%s/e',_0x29ba50[_0xacc3('0x6e')],_0x259205['id'])});break;default:logger[_0xacc3('0x6f')](_0xacc3('0x7a'),_0xacc3('0x7b'));}})[_0xacc3('0x71')](function(_0x111ffa){logger['error'](_0xacc3('0x7a'),_0x111ffa);});};exports[_0xacc3('0x7c')]=function(_0x177c11,_0xc4a89f,_0x360274,_0x5e9e9a,_0x22c2c2,_0x275a2d){var _0x3678f2,_0x1dcd38,_0x4b275,_0x1450d7;_0x275a2d[_0xacc3('0x5c')]=intUtil[_0xacc3('0x5d')](_0x275a2d[_0xacc3('0x5c')]);_0x275a2d[_0xacc3('0x5e')]=intUtil[_0xacc3('0x5d')](_0x275a2d['remoteUri']);if(_0x22c2c2&&_0x22c2c2['monitor_format']){logger[_0xacc3('0x1d')]('['+_0xc4a89f[_0xacc3('0x7d')][_0xacc3('0x7e')]()+']','Recording\x20is\x20enabled!');_0xc4a89f[_0xacc3('0x63')]=util[_0xacc3('0x46')](_0xacc3('0x61'),_0x275a2d['serverUrl'],_0xc4a89f[_0xacc3('0x62')],md5(_0xc4a89f[_0xacc3('0x62')]));}else{_0xc4a89f['recordingURL']='';}return getConnection(_0x275a2d)[_0xacc3('0x25')](function(_0x1b79fe){_0x1450d7=_0x1b79fe;if(!_[_0xacc3('0x20')](_0x5e9e9a)){return getUser(_0x275a2d,_0x5e9e9a[_0xacc3('0x55')],_0x1450d7);}else{return getUser(_0x275a2d,null,_0x1450d7);}})[_0xacc3('0x25')](function(_0x2e47d0){_0x3678f2=_0x2e47d0;return getEndUser(_0x275a2d,_0x360274,_0xc4a89f[_0xacc3('0x64')],_0xc4a89f[_0xacc3('0x65')],_0x1450d7);})[_0xacc3('0x25')](function(_0x34d378){_0x1dcd38=_0x34d378;return getTicket(_0x275a2d,_0x3678f2,_0x1dcd38,_0x360274,_0xc4a89f,_0x360274[_0xacc3('0x77')],_0x1450d7);})[_0xacc3('0x25')](function(_0x241913){_0x4b275=_0x241913;logger[_0xacc3('0x1d')]('['+_0xc4a89f[_0xacc3('0x7d')][_0xacc3('0x7e')]()+']\x20Ticket\x20%s\x20created.',_0x4b275['id']);logger[_0xacc3('0x1d')]('['+_0xc4a89f[_0xacc3('0x7d')][_0xacc3('0x7e')]()+']\x20Integration\x20account\x20type\x20%s.',_0x275a2d[_0xacc3('0x50')]);})['catch'](function(_0x506ba5){logger['error']('['+_0xc4a89f[_0xacc3('0x7d')][_0xacc3('0x7e')]()+']',_0x506ba5);});}; \ 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 8a04aff..342694d 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 _0x4e17=['sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','isNil','email','endUserNumber','destcalleridnum','calleridnum','queue','unmanaged','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','inspect','bluebird','request-promise','util','md5','ioredis','../../../../config/environment','../../../../config/logger','servicenow','redis','socket.io-emitter','GET','then','result','length','adminId','sys_id','info','toUpperCase','catch','error','message','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','user','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','picklist','nameField','content','toString','idField','customField','toLowerCase','type','variable','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','incident','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','Incident','Incident\x20-\x20','ticketNumber','forEach','push',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','Tags','map','%26sysparm_record_target%3Dincident','%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','password','sysparm_limit=1'];(function(_0x49b618,_0x2a3f11){var _0x4fbc3a=function(_0x3fc171){while(--_0x3fc171){_0x49b618['push'](_0x49b618['shift']());}};_0x4fbc3a(++_0x2a3f11);}(_0x4e17,0x168));var _0x74e1=function(_0x124344,_0x2010cf){_0x124344=_0x124344-0x0;var _0x33c976=_0x4e17[_0x124344];return _0x33c976;};'use strict';var _=require('lodash');var Promise=require(_0x74e1('0x0'));var rp=require(_0x74e1('0x1'));var util=require(_0x74e1('0x2'));var md5=require(_0x74e1('0x3'));var Redis=require(_0x74e1('0x4'));var intUtil=require('./util');var config=require(_0x74e1('0x5'));var logger=require(_0x74e1('0x6'))(_0x74e1('0x7'));config[_0x74e1('0x8')]=_['defaults'](config[_0x74e1('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0x74e1('0x9'))(new Redis(config['redis']));function getAdminUser(_0x23933f,_0xba025b,_0x3e853b,_0x118078,_0x4286b0,_0x4fcadc){return new Promise(function(_0x34ee4d,_0x36cc65){var _0x156879={'method':_0x74e1('0xa'),'uri':_0x118078+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0x4286b0+'&'+_0x4fcadc,'auth':_0xba025b,'json':!![]};return rp(_0x156879)[_0x74e1('0xb')](function(_0x2a9c7b){if(_0x2a9c7b[_0x74e1('0xc')][_0x74e1('0xd')]>0x0){_0x3e853b[_0x74e1('0xe')]=_0x2a9c7b['result'][0x0][_0x74e1('0xf')];}logger[_0x74e1('0x10')]('['+[_0x23933f[_0x74e1('0x11')]()]+'],\x20getAdminUser\x20crm',_0x3e853b);_0x34ee4d(_0x3e853b);})[_0x74e1('0x12')](function(_0x1c70ef){logger[_0x74e1('0x13')]('['+[_0x23933f['toUpperCase']()]+']',_0x1c70ef[_0x74e1('0x14')]);_0x36cc65(_0x1c70ef[_0x74e1('0x14')]);});});}function getUser(_0x3e5d81,_0x1e4f34,_0xa116e9,_0x21201f,_0x422332){return function(_0x570af4){logger[_0x74e1('0x10')]('['+[_0x3e5d81[_0x74e1('0x11')]()]+'],\x20getUser\x20input\x20crm',_0x570af4);return new Promise(function(_0x24a0c8,_0x1b8657){if(intUtil[_0x74e1('0x15')](_0x570af4[_0x74e1('0x16')])){var _0x1859c7={'method':_0x74e1('0xa'),'uri':_0xa116e9+_0x74e1('0x17')+_0x570af4['userEmail']+'&'+_0x21201f+'&'+_0x422332,'auth':_0x1e4f34,'json':!![]};logger['info']('['+[_0x3e5d81[_0x74e1('0x11')]()]+_0x74e1('0x18'),_0x1859c7);return rp(_0x1859c7)[_0x74e1('0xb')](function(_0x1b9a40){logger[_0x74e1('0x10')]('['+[_0x3e5d81['toUpperCase']()]+_0x74e1('0x19'),_0x1b9a40);if(_0x1b9a40[_0x74e1('0xc')][_0x74e1('0xd')]>0x0&&String(_0x1b9a40[_0x74e1('0xc')][0x0][_0x74e1('0x1a')])===_0x74e1('0x1b')){_0x570af4['userId']=_0x1b9a40[_0x74e1('0xc')][0x0]['sys_id'];}else{_0x570af4[_0x74e1('0x1c')]=_0x570af4[_0x74e1('0xe')];_0x570af4[_0x74e1('0x16')]=_0x570af4[_0x74e1('0x1d')];}logger['info']('['+[_0x3e5d81['toUpperCase']()]+_0x74e1('0x1e'),_0x570af4);_0x24a0c8(_0x570af4);})['catch'](function(_0x25ac6c){logger[_0x74e1('0x13')]('['+[_0x3e5d81['toUpperCase']()]+']',_0x25ac6c[_0x74e1('0x14')]);_0x1b8657(_0x25ac6c[_0x74e1('0x14')]);});}else{logger[_0x74e1('0x10')]('['+[_0x3e5d81[_0x74e1('0x11')]()]+_0x74e1('0x1f'));_0x570af4['userId']=_0x570af4['adminId'];_0x570af4[_0x74e1('0x16')]=_0x570af4[_0x74e1('0x1d')];_0x24a0c8(_0x570af4);}});};}function createEndUser(_0xec4aff,_0x1c14b2,_0x893d66,_0x11000a,_0x19ffdb){logger['info']('['+[_0xec4aff['toUpperCase']()]+_0x74e1('0x20'),_0x893d66);return new Promise(function(_0x148b3a,_0x40488c){var _0x55aaf9={'method':_0x74e1('0x21'),'uri':_0x11000a+'sys_user?'+_0x19ffdb,'body':{'user_name':_0x893d66['endUserNumber'],'roles':_0x74e1('0x22'),'first_name':_0x893d66['endUserNumber'],'active':_0x74e1('0x1b'),'date_format':'System','phone':_0x893d66['endUserNumber']},'auth':_0x1c14b2,'json':!![]};return rp(_0x55aaf9)[_0x74e1('0xb')](function(_0x4be43d){logger[_0x74e1('0x10')]('['+[_0xec4aff['toUpperCase']()]+_0x74e1('0x23'),_0x4be43d[_0x74e1('0xc')]);_0x893d66[_0x74e1('0x24')]=_0x4be43d[_0x74e1('0xc')]['sys_id'];_0x148b3a(_0x893d66);})['catch'](function(_0x418bf8){logger['error']('['+[_0xec4aff[_0x74e1('0x11')]()]+']',_0x418bf8[_0x74e1('0x14')]);_0x40488c(_0x418bf8[_0x74e1('0x14')]);});});}function getEndUser(_0x226470,_0x16316a,_0x9cf889,_0x1a3eaa,_0x20690b){return function(_0x1c18a0){logger[_0x74e1('0x10')]('['+[_0x226470[_0x74e1('0x11')]()]+'],\x20getEndUser\x20input\x20crm',_0x1c18a0);return new Promise(function(_0x1c02e1,_0x3945fc){var _0x31e751={'method':_0x74e1('0xa'),'uri':_0x9cf889+_0x74e1('0x25')+_0x1c18a0['endUserNumber']+'&'+_0x1a3eaa+'&'+_0x20690b,'auth':_0x16316a,'json':!![]};return rp(_0x31e751)[_0x74e1('0xb')](function(_0x4d44a0){if(_0x4d44a0['result'][_0x74e1('0xd')]>0x0){_0x1c18a0['endUserId']=_0x4d44a0[_0x74e1('0xc')][0x0][_0x74e1('0xf')];logger[_0x74e1('0x10')]('['+[_0x226470[_0x74e1('0x11')]()]+_0x74e1('0x26'),_0x1c18a0);_0x1c02e1(_0x1c18a0);}else{return createEndUser(_0x226470,_0x16316a,_0x1c18a0,_0x9cf889,_0x1a3eaa)[_0x74e1('0xb')](function(_0xd6d034){logger['info']('['+[_0x226470['toUpperCase']()]+_0x74e1('0x27'),_0xd6d034);_0x1c02e1(_0xd6d034);});}})[_0x74e1('0x12')](function(_0x4086f3){logger['error']('['+[_0x226470[_0x74e1('0x11')]()]+']',_0x4086f3[_0x74e1('0x14')]);_0x3945fc(_0x4086f3[_0x74e1('0x14')]);});});};}function getCustomFields(_0x448985,_0x41c338){var _0x31c4f8={};if(_0x448985['length']>0x0){_['forEach'](_0x448985,function(_0x3d96aa){if(_[_0x74e1('0x28')]([_0x74e1('0x29'),_0x74e1('0x2a')],_0x3d96aa['type'])&&_0x3d96aa[_0x74e1('0x2b')]&&!_0x3d96aa['customField']){_0x31c4f8[_0x3d96aa[_0x74e1('0x2b')]['toLowerCase']()]=_0x3d96aa[_0x74e1('0x2c')][_0x74e1('0x2d')]();}else if(_['includes']([_0x74e1('0x29'),'picklist'],_0x3d96aa['type'])&&_0x3d96aa[_0x74e1('0x2e')]&&_0x3d96aa[_0x74e1('0x2f')]){_0x31c4f8[_0x3d96aa[_0x74e1('0x2e')][_0x74e1('0x30')]()]=_0x3d96aa['content']['toString']();}else if(_0x3d96aa[_0x74e1('0x31')]===_0x74e1('0x32')&&_0x3d96aa[_0x74e1('0x33')]&&_0x3d96aa[_0x74e1('0x2e')]&&_0x3d96aa[_0x74e1('0x2f')]){_0x31c4f8[_0x3d96aa[_0x74e1('0x2e')][_0x74e1('0x30')]()]=_0x41c338[_0x3d96aa[_0x74e1('0x33')]][_0x74e1('0x2d')]();}else if(_0x3d96aa[_0x74e1('0x31')]===_0x74e1('0x34')&&_0x3d96aa[_0x74e1('0x35')]&&_0x3d96aa[_0x74e1('0x35')][_0x74e1('0x36')]&&_0x3d96aa[_0x74e1('0x2e')]&&_0x3d96aa['customField']){_0x31c4f8[_0x3d96aa[_0x74e1('0x2e')][_0x74e1('0x30')]()]=_0x41c338[_0x3d96aa[_0x74e1('0x35')][_0x74e1('0x36')]['toLowerCase']()][_0x74e1('0x2d')]();}});}return _0x31c4f8;}function getTicket(_0x57cf33,_0x5b0a3b,_0x388deb,_0x511cbe,_0x4b3971,_0x229969){return function(_0x14e36f){logger[_0x74e1('0x10')]('['+[_0x57cf33['toUpperCase']()]+_0x74e1('0x37'),_0x14e36f);return new Promise(function(_0x4abc20,_0xe6fd4){var _0x28ca55=_0x57cf33[_0x74e1('0x30')]()===_0x74e1('0x38')?_0x14e36f[_0x74e1('0x1c')]:_0x14e36f['endUserId'];var _0x44e71b={'method':_0x74e1('0x21'),'uri':_0x388deb+_0x74e1('0x39')+'?'+_0x229969,'body':Object[_0x74e1('0x3a')]({},{'active':_0x74e1('0x1b'),'caller_id':_0x28ca55,'assigned_to':_0x14e36f[_0x74e1('0x1c')],'short_description':intUtil[_0x74e1('0x3b')](_0x511cbe[_0x74e1('0x3c')],_0x4b3971,'\x20'),'description':intUtil['getString'](_0x511cbe[_0x74e1('0x3d')],_0x4b3971,'\x0a')},getCustomFields(_0x511cbe[_0x74e1('0x3e')],_0x4b3971)),'auth':_0x5b0a3b,'json':!![]};return rp(_0x44e71b)[_0x74e1('0xb')](function(_0x1bbfb3){logger[_0x74e1('0x10')]('['+[_0x57cf33[_0x74e1('0x11')]()]+_0x74e1('0x3f'),_0x1bbfb3[_0x74e1('0xc')]);_0x14e36f[_0x74e1('0x40')]=_0x1bbfb3[_0x74e1('0xc')][_0x74e1('0xf')];_0x14e36f['ticketNumber']=_0x1bbfb3[_0x74e1('0xc')][_0x74e1('0x41')];logger[_0x74e1('0x10')]('['+[_0x57cf33[_0x74e1('0x11')]()]+_0x74e1('0x42'),_0x14e36f);_0x4abc20(_0x14e36f);})[_0x74e1('0x12')](function(_0x140b2f){logger[_0x74e1('0x13')]('['+[_0x57cf33[_0x74e1('0x11')]()]+']',_0x140b2f['message']);_0xe6fd4(_0x140b2f['message']);});});};}function createRemoteTag(_0x4251f8,_0x4074af,_0x4d2e19,_0x80048f){return new Promise(function(_0x54d628,_0x8e14c6){var _0x2e2ba7={'method':'POST','uri':_0x4d2e19+_0x74e1('0x43')+'?'+_0x80048f,'body':{'short_description':_0x4251f8,'global':!![],'active':!![],'name':_0x4251f8},'auth':_0x4074af,'json':!![]};return rp(_0x2e2ba7)[_0x74e1('0xb')](function(_0x2297d5){var _0x45b817=_0x2297d5[_0x74e1('0xc')]['sys_id'];_0x54d628(_0x45b817);});});}function getRemoteTag(_0x28787d,_0x55bcf1,_0x57a3f0,_0x479d3a,_0x2c8d56){return new Promise(function(_0x32473e,_0x47f7d3){var _0x526dad={'method':_0x74e1('0xa'),'uri':_0x57a3f0+'label'+_0x74e1('0x44')+_0x28787d+'&'+_0x479d3a,'auth':_0x55bcf1,'json':!![]};return rp(_0x526dad)[_0x74e1('0xb')](function(_0x3827bd){if(_0x3827bd['result'][_0x74e1('0xd')]>0x0){var _0x17473e=_0x3827bd[_0x74e1('0xc')][0x0][_0x74e1('0xf')];_0x32473e(_0x17473e);}else{return createRemoteTag(_0x28787d,_0x55bcf1,_0x57a3f0,_0x479d3a)[_0x74e1('0xb')](function(_0x588210){_0x32473e(_0x588210);});}});});}function assignTagToIncident(_0x38fb5b,_0x32f17d,_0xa3cf0a,_0x3ef01f,_0xb2d66a){return new Promise(function(_0x1d8f68,_0x5da08e){var _0x5a0af9={'method':_0x74e1('0x21'),'uri':_0xa3cf0a+_0x74e1('0x45')+'?'+_0xb2d66a,'body':{'label':_0x38fb5b,'table':_0x74e1('0x39'),'id_type':_0x74e1('0x46'),'table_key':_0x3ef01f[_0x74e1('0x40')],'title':_0x74e1('0x47')+_0x3ef01f[_0x74e1('0x48')],'id_display':_0x3ef01f[_0x74e1('0x48')]},'auth':_0x32f17d,'json':!![]};return rp(_0x5a0af9)[_0x74e1('0xb')](function(_0x245d54){_0x1d8f68();})[_0x74e1('0x12')](function(){_0x1d8f68();});});}function manageTags(_0x14f8bb,_0x102373,_0x560e86,_0x4d82a0,_0x50d93b,_0x1b304e,_0x5db83){return new Promise(function(_0x26c6cb,_0x15165f){var _0x2a02a2=[];_0x102373[_0x74e1('0x49')](function(_0x2c4874){_0x2a02a2[_0x74e1('0x4a')](getRemoteTag(_0x2c4874,_0x560e86,_0x4d82a0,_0x1b304e,_0x5db83));});return Promise['all'](_0x2a02a2)[_0x74e1('0xb')](function(_0x36663c){if(_0x36663c[_0x74e1('0xd')]){logger[_0x74e1('0x10')]('['+[_0x14f8bb[_0x74e1('0x11')]()]+_0x74e1('0x4b'),_0x36663c);var _0x2206bc=[];_0x36663c['forEach'](function(_0x477a59){_0x2206bc[_0x74e1('0x4a')](assignTagToIncident(_0x477a59,_0x560e86,_0x4d82a0,_0x50d93b,_0x1b304e));});return Promise['all'](_0x2206bc)['then'](function(){_0x26c6cb();})['catch'](function(){_0x26c6cb();});}else{_0x26c6cb();}});});}function getTags(_0x36f4ff,_0x53371e,_0x8d5d9c,_0x201fab,_0x5dae23,_0x19db4d){return function(_0x452359){return new Promise(function(_0x52704e,_0x1397fa){var _0x309567=[];var _0x3b069e=_0x201fab[_0x74e1('0x4c')];if(_0x3b069e&&_0x3b069e[_0x74e1('0xd')]>0x0){_0x309567=_[_0x74e1('0x4d')](_0x3b069e,_0x74e1('0x36'));}if(_0x309567[_0x74e1('0xd')]>0x0){return manageTags(_0x36f4ff,_0x309567,_0x53371e,_0x8d5d9c,_0x452359,_0x5dae23,_0x19db4d)['then'](function(){_0x52704e(_0x452359);});}else{_0x52704e(_0x452359);}});};}function emit(_0x154e17,_0x2cf373,_0x41ee6f){var _0x63c72=_0x74e1('0x4e')+_0x74e1('0x4f')+_0x74e1('0x50')+_0x74e1('0x51');var _0x1f9948={'uri':_0x154e17+_0x74e1('0x52')+_0x41ee6f+_0x63c72};io['to'](util[_0x74e1('0x53')]('user:%s',_0x2cf373))[_0x74e1('0x54')](_0x74e1('0x55'),_0x1f9948);}exports['cs']=function(_0x149900,_0x400e95,_0x2a1dc9,_0xcbfe49,_0x516ffa,_0x3e1fbf,_0x45040c,_0x1bdb40){var _0x3769a2={};var _0x1e623b={'user':_0x3e1fbf['username'],'pass':_0x3e1fbf[_0x74e1('0x56')]};var _0x3149e0=_0x74e1('0x57');var _0xbe7220=_0x74e1('0x58');_0x3e1fbf[_0x74e1('0x59')]=intUtil[_0x74e1('0x5a')](_0x3e1fbf[_0x74e1('0x59')]);_0x3e1fbf[_0x74e1('0x5b')]=intUtil[_0x74e1('0x5a')](_0x3e1fbf['serverUrl']);var _0x89bf6c=util['format']('%s/api/now/table/',_0x3e1fbf[_0x74e1('0x59')]);_0x3769a2[_0x74e1('0x16')]=!_[_0x74e1('0x5c')](_0xcbfe49)?_0xcbfe49[_0x74e1('0x5d')]:null;_0x3769a2['adminEmail']=_0x3e1fbf[_0x74e1('0x5d')];_0x3769a2[_0x74e1('0x5e')]=_0x1bdb40[_0x74e1('0x30')]()===_0x74e1('0x38')?_0x400e95[_0x74e1('0x5f')]:_0x400e95[_0x74e1('0x60')];_0x3769a2['callDirection']=_0x1bdb40===_0x74e1('0x61')||_0x1bdb40===_0x74e1('0x62')?'queue':_0x74e1('0x38');var _0x1b493d=util[_0x74e1('0x53')](_0x74e1('0x63'),_0x3e1fbf['serverUrl'],_0x400e95[_0x74e1('0x64')],md5(_0x400e95[_0x74e1('0x64')]));if(_0x516ffa&&_0x516ffa[_0x74e1('0x65')]){logger[_0x74e1('0x10')](_0x74e1('0x66'),_0x74e1('0x67'));_0x400e95[_0x74e1('0x68')]=_0x1b493d;}else if(_0x45040c&&_0x45040c[_0x74e1('0x69')]&&_0x45040c[_0x74e1('0x69')]!==_0x74e1('0x6a')){logger['info'](_0x74e1('0x6b'),_0x74e1('0x67'));_0x400e95[_0x74e1('0x68')]=_0x1b493d;}else{_0x400e95[_0x74e1('0x68')]='';}return getAdminUser(_0x1bdb40,_0x1e623b,_0x3769a2,_0x89bf6c,_0xbe7220,_0x3149e0)[_0x74e1('0xb')](getUser(_0x1bdb40,_0x1e623b,_0x89bf6c,_0xbe7220,_0x3149e0))[_0x74e1('0xb')](getEndUser(_0x1bdb40,_0x1e623b,_0x89bf6c,_0xbe7220,_0x3149e0))[_0x74e1('0xb')](getTicket(_0x1bdb40,_0x1e623b,_0x89bf6c,_0x2a1dc9,_0x400e95,_0xbe7220))[_0x74e1('0xb')](function(_0x412f9f){logger[_0x74e1('0x10')](util[_0x74e1('0x53')](_0x74e1('0x6c'),_0x412f9f[_0x74e1('0x40')]));logger[_0x74e1('0x10')](util[_0x74e1('0x53')](_0x74e1('0x6d'),_0x1bdb40));if(_0x1bdb40!==_0x74e1('0x62')){logger[_0x74e1('0x10')]('['+[_0x1bdb40[_0x74e1('0x11')]()]+']',_0x74e1('0x6e'));emit(_0x3e1fbf[_0x74e1('0x59')],_0xcbfe49[_0x74e1('0x36')],_0x412f9f['ticketId']);}})[_0x74e1('0x12')](function(_0x3bca3e){logger[_0x74e1('0x13')]('['+[_0x1bdb40[_0x74e1('0x11')]()]+']\x20Error\x20running\x20ServiceNow\x20integration',util[_0x74e1('0x6f')](_0x3bca3e,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xfa4c=['ticketNumber',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident','Incident','push','all','Tags','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','/nav_to.do?uri=incident.do?sys_id%3D','user:%s','trigger:browser:url','username','password','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','remoteUri','serverUrl','format','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','unmanaged','queue','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','recordingFormat','none','[OUTBOUND]','call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','GET','length','adminId','result','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','error','message','],\x20getUser\x20input\x20crm','validateEmail','userEmail','sys_user?sysparm_query=email%3D','],\x20getUser\x20rp\x20obj','then','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','sys_user?','endUserNumber','user','System','],\x20EndUser\x20schema','catch','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','endUserId','forEach','picklist','type','nameField','customField','toLowerCase','content','toString','includes','string','idField','variableName','customVariable','Variable','name',']\x20getTicket\x20input\x20crm','outbound','POST','assign','getString','Subjects','Descriptions',']\x20POST\x20incident\x20entity\x20schema','ticketId'];(function(_0x38ead1,_0x305199){var _0x4cad8a=function(_0x31d3bc){while(--_0x31d3bc){_0x38ead1['push'](_0x38ead1['shift']());}};_0x4cad8a(++_0x305199);}(_0xfa4c,0x1e1));var _0xcfa4=function(_0x1b6166,_0x25502a){_0x1b6166=_0x1b6166-0x0;var _0x32d7f6=_0xfa4c[_0x1b6166];return _0x32d7f6;};'use strict';var _=require('lodash');var Promise=require(_0xcfa4('0x0'));var rp=require(_0xcfa4('0x1'));var util=require('util');var md5=require('md5');var Redis=require('ioredis');var intUtil=require(_0xcfa4('0x2'));var config=require(_0xcfa4('0x3'));var logger=require(_0xcfa4('0x4'))(_0xcfa4('0x5'));config[_0xcfa4('0x6')]=_[_0xcfa4('0x7')](config[_0xcfa4('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcfa4('0x6')]));function getAdminUser(_0x25b6c0,_0x1d7c38,_0x2dce7b,_0x1d3368,_0xa814e3,_0x203666){return new Promise(function(_0xc2ff84,_0x11a5d0){var _0x1d0d73={'method':_0xcfa4('0x8'),'uri':_0x1d3368+'sys_user?sysparm_query=user_name%3Dadmin'+'&'+_0xa814e3+'&'+_0x203666,'auth':_0x1d7c38,'json':!![]};return rp(_0x1d0d73)['then'](function(_0x138e0f){if(_0x138e0f['result'][_0xcfa4('0x9')]>0x0){_0x2dce7b[_0xcfa4('0xa')]=_0x138e0f[_0xcfa4('0xb')][0x0][_0xcfa4('0xc')];}logger[_0xcfa4('0xd')]('['+[_0x25b6c0[_0xcfa4('0xe')]()]+_0xcfa4('0xf'),_0x2dce7b);_0xc2ff84(_0x2dce7b);})['catch'](function(_0x14236e){logger[_0xcfa4('0x10')]('['+[_0x25b6c0[_0xcfa4('0xe')]()]+']',_0x14236e[_0xcfa4('0x11')]);_0x11a5d0(_0x14236e[_0xcfa4('0x11')]);});});}function getUser(_0x1ce3be,_0x2dd43a,_0x17857d,_0x3708de,_0x5e728e){return function(_0x53537f){logger[_0xcfa4('0xd')]('['+[_0x1ce3be[_0xcfa4('0xe')]()]+_0xcfa4('0x12'),_0x53537f);return new Promise(function(_0x26e6dc,_0xfcd4a){if(intUtil[_0xcfa4('0x13')](_0x53537f[_0xcfa4('0x14')])){var _0x41264a={'method':_0xcfa4('0x8'),'uri':_0x17857d+_0xcfa4('0x15')+_0x53537f[_0xcfa4('0x14')]+'&'+_0x3708de+'&'+_0x5e728e,'auth':_0x2dd43a,'json':!![]};logger[_0xcfa4('0xd')]('['+[_0x1ce3be[_0xcfa4('0xe')]()]+_0xcfa4('0x16'),_0x41264a);return rp(_0x41264a)[_0xcfa4('0x17')](function(_0x1c5414){logger[_0xcfa4('0xd')]('['+[_0x1ce3be[_0xcfa4('0xe')]()]+'],\x20getUser\x20entity',_0x1c5414);if(_0x1c5414[_0xcfa4('0xb')]['length']>0x0&&String(_0x1c5414['result'][0x0][_0xcfa4('0x18')])===_0xcfa4('0x19')){_0x53537f['userId']=_0x1c5414['result'][0x0][_0xcfa4('0xc')];}else{_0x53537f[_0xcfa4('0x1a')]=_0x53537f[_0xcfa4('0xa')];_0x53537f[_0xcfa4('0x14')]=_0x53537f[_0xcfa4('0x1b')];}logger['info']('['+[_0x1ce3be[_0xcfa4('0xe')]()]+_0xcfa4('0x1c'),_0x53537f);_0x26e6dc(_0x53537f);})['catch'](function(_0x2d55d6){logger[_0xcfa4('0x10')]('['+[_0x1ce3be[_0xcfa4('0xe')]()]+']',_0x2d55d6['message']);_0xfcd4a(_0x2d55d6[_0xcfa4('0x11')]);});}else{logger['info']('['+[_0x1ce3be[_0xcfa4('0xe')]()]+_0xcfa4('0x1d'));_0x53537f[_0xcfa4('0x1a')]=_0x53537f[_0xcfa4('0xa')];_0x53537f[_0xcfa4('0x14')]=_0x53537f[_0xcfa4('0x1b')];_0x26e6dc(_0x53537f);}});};}function createEndUser(_0x251038,_0x458d1f,_0x5e7437,_0x85f59a,_0x1adcc6){logger[_0xcfa4('0xd')]('['+[_0x251038['toUpperCase']()]+_0xcfa4('0x1e'),_0x5e7437);return new Promise(function(_0x32404c,_0x5ede81){var _0xf4bd77={'method':'POST','uri':_0x85f59a+_0xcfa4('0x1f')+_0x1adcc6,'body':{'user_name':_0x5e7437[_0xcfa4('0x20')],'roles':_0xcfa4('0x21'),'first_name':_0x5e7437[_0xcfa4('0x20')],'active':_0xcfa4('0x19'),'date_format':_0xcfa4('0x22'),'phone':_0x5e7437[_0xcfa4('0x20')]},'auth':_0x458d1f,'json':!![]};return rp(_0xf4bd77)[_0xcfa4('0x17')](function(_0x28e412){logger[_0xcfa4('0xd')]('['+[_0x251038[_0xcfa4('0xe')]()]+_0xcfa4('0x23'),_0x28e412[_0xcfa4('0xb')]);_0x5e7437['endUserId']=_0x28e412[_0xcfa4('0xb')]['sys_id'];_0x32404c(_0x5e7437);})[_0xcfa4('0x24')](function(_0x377781){logger[_0xcfa4('0x10')]('['+[_0x251038['toUpperCase']()]+']',_0x377781[_0xcfa4('0x11')]);_0x5ede81(_0x377781[_0xcfa4('0x11')]);});});}function getEndUser(_0xa77742,_0x38cdc4,_0x519ca5,_0x240c64,_0x2008dd){return function(_0x4daf9b){logger[_0xcfa4('0xd')]('['+[_0xa77742['toUpperCase']()]+_0xcfa4('0x25'),_0x4daf9b);return new Promise(function(_0x246b94,_0x37d6fc){var _0x3134bf={'method':_0xcfa4('0x8'),'uri':_0x519ca5+_0xcfa4('0x26')+_0x4daf9b[_0xcfa4('0x20')]+'&'+_0x240c64+'&'+_0x2008dd,'auth':_0x38cdc4,'json':!![]};return rp(_0x3134bf)['then'](function(_0x23cf5c){if(_0x23cf5c[_0xcfa4('0xb')]['length']>0x0){_0x4daf9b[_0xcfa4('0x27')]=_0x23cf5c[_0xcfa4('0xb')][0x0]['sys_id'];logger[_0xcfa4('0xd')]('['+[_0xa77742[_0xcfa4('0xe')]()]+'],\x20getEndUser\x20crm',_0x4daf9b);_0x246b94(_0x4daf9b);}else{return createEndUser(_0xa77742,_0x38cdc4,_0x4daf9b,_0x519ca5,_0x240c64)[_0xcfa4('0x17')](function(_0x16b93b){logger[_0xcfa4('0xd')]('['+[_0xa77742['toUpperCase']()]+'],\x20createEndUser\x20crm',_0x16b93b);_0x246b94(_0x16b93b);});}})[_0xcfa4('0x24')](function(_0x18864a){logger[_0xcfa4('0x10')]('['+[_0xa77742[_0xcfa4('0xe')]()]+']',_0x18864a[_0xcfa4('0x11')]);_0x37d6fc(_0x18864a['message']);});});};}function getCustomFields(_0x4fe5f4,_0x1dec64){var _0x4999e2={};if(_0x4fe5f4[_0xcfa4('0x9')]>0x0){_[_0xcfa4('0x28')](_0x4fe5f4,function(_0x6fb9d2){if(_['includes'](['string',_0xcfa4('0x29')],_0x6fb9d2[_0xcfa4('0x2a')])&&_0x6fb9d2[_0xcfa4('0x2b')]&&!_0x6fb9d2[_0xcfa4('0x2c')]){_0x4999e2[_0x6fb9d2[_0xcfa4('0x2b')][_0xcfa4('0x2d')]()]=_0x6fb9d2[_0xcfa4('0x2e')][_0xcfa4('0x2f')]();}else if(_[_0xcfa4('0x30')]([_0xcfa4('0x31'),_0xcfa4('0x29')],_0x6fb9d2[_0xcfa4('0x2a')])&&_0x6fb9d2[_0xcfa4('0x32')]&&_0x6fb9d2[_0xcfa4('0x2c')]){_0x4999e2[_0x6fb9d2[_0xcfa4('0x32')][_0xcfa4('0x2d')]()]=_0x6fb9d2[_0xcfa4('0x2e')]['toString']();}else if(_0x6fb9d2[_0xcfa4('0x2a')]==='variable'&&_0x6fb9d2['variableName']&&_0x6fb9d2['idField']&&_0x6fb9d2[_0xcfa4('0x2c')]){_0x4999e2[_0x6fb9d2[_0xcfa4('0x32')]['toLowerCase']()]=_0x1dec64[_0x6fb9d2[_0xcfa4('0x33')]][_0xcfa4('0x2f')]();}else if(_0x6fb9d2['type']===_0xcfa4('0x34')&&_0x6fb9d2[_0xcfa4('0x35')]&&_0x6fb9d2['Variable'][_0xcfa4('0x36')]&&_0x6fb9d2[_0xcfa4('0x32')]&&_0x6fb9d2[_0xcfa4('0x2c')]){_0x4999e2[_0x6fb9d2[_0xcfa4('0x32')][_0xcfa4('0x2d')]()]=_0x1dec64[_0x6fb9d2[_0xcfa4('0x35')]['name'][_0xcfa4('0x2d')]()][_0xcfa4('0x2f')]();}});}return _0x4999e2;}function getTicket(_0x34abdb,_0x304a99,_0x179468,_0x218e6e,_0x39bc7a,_0x35df4f){return function(_0x552684){logger[_0xcfa4('0xd')]('['+[_0x34abdb[_0xcfa4('0xe')]()]+_0xcfa4('0x37'),_0x552684);return new Promise(function(_0xe5b6cf,_0x4c3673){var _0x4edc6a=_0x34abdb[_0xcfa4('0x2d')]()===_0xcfa4('0x38')?_0x552684['userId']:_0x552684[_0xcfa4('0x27')];var _0x297684={'method':_0xcfa4('0x39'),'uri':_0x179468+'incident'+'?'+_0x35df4f,'body':Object[_0xcfa4('0x3a')]({},{'active':_0xcfa4('0x19'),'caller_id':_0x4edc6a,'assigned_to':_0x552684[_0xcfa4('0x1a')],'short_description':intUtil[_0xcfa4('0x3b')](_0x218e6e[_0xcfa4('0x3c')],_0x39bc7a,'\x20'),'description':intUtil['getString'](_0x218e6e[_0xcfa4('0x3d')],_0x39bc7a,'\x0a')},getCustomFields(_0x218e6e['Fields'],_0x39bc7a)),'auth':_0x304a99,'json':!![]};return rp(_0x297684)[_0xcfa4('0x17')](function(_0x3bbd29){logger[_0xcfa4('0xd')]('['+[_0x34abdb['toUpperCase']()]+_0xcfa4('0x3e'),_0x3bbd29[_0xcfa4('0xb')]);_0x552684[_0xcfa4('0x3f')]=_0x3bbd29['result'][_0xcfa4('0xc')];_0x552684[_0xcfa4('0x40')]=_0x3bbd29[_0xcfa4('0xb')]['number'];logger[_0xcfa4('0xd')]('['+[_0x34abdb[_0xcfa4('0xe')]()]+_0xcfa4('0x41'),_0x552684);_0xe5b6cf(_0x552684);})[_0xcfa4('0x24')](function(_0x28381e){logger[_0xcfa4('0x10')]('['+[_0x34abdb[_0xcfa4('0xe')]()]+']',_0x28381e[_0xcfa4('0x11')]);_0x4c3673(_0x28381e['message']);});});};}function createRemoteTag(_0x2c8097,_0xac3f40,_0x563794,_0x2b66ee){return new Promise(function(_0x1dedab,_0x583e52){var _0x4e4d7f={'method':_0xcfa4('0x39'),'uri':_0x563794+'label'+'?'+_0x2b66ee,'body':{'short_description':_0x2c8097,'global':!![],'active':!![],'name':_0x2c8097},'auth':_0xac3f40,'json':!![]};return rp(_0x4e4d7f)[_0xcfa4('0x17')](function(_0x1db5e5){var _0x541928=_0x1db5e5[_0xcfa4('0xb')][_0xcfa4('0xc')];_0x1dedab(_0x541928);});});}function getRemoteTag(_0x14c594,_0xc56e0,_0x132b5a,_0xc21dfd,_0x290918){return new Promise(function(_0x5ea6f4,_0x33af7e){var _0x2d411d={'method':_0xcfa4('0x8'),'uri':_0x132b5a+_0xcfa4('0x42')+_0xcfa4('0x43')+_0x14c594+'&'+_0xc21dfd,'auth':_0xc56e0,'json':!![]};return rp(_0x2d411d)['then'](function(_0x6053b5){if(_0x6053b5[_0xcfa4('0xb')][_0xcfa4('0x9')]>0x0){var _0xee9f45=_0x6053b5['result'][0x0][_0xcfa4('0xc')];_0x5ea6f4(_0xee9f45);}else{return createRemoteTag(_0x14c594,_0xc56e0,_0x132b5a,_0xc21dfd)[_0xcfa4('0x17')](function(_0x253637){_0x5ea6f4(_0x253637);});}});});}function assignTagToIncident(_0x48c669,_0x476975,_0xcc8a6f,_0x2c3fff,_0x105ca0){return new Promise(function(_0x237a6e,_0x38a5fa){var _0x54e11b={'method':_0xcfa4('0x39'),'uri':_0xcc8a6f+_0xcfa4('0x44')+'?'+_0x105ca0,'body':{'label':_0x48c669,'table':_0xcfa4('0x45'),'id_type':_0xcfa4('0x46'),'table_key':_0x2c3fff['ticketId'],'title':'Incident\x20-\x20'+_0x2c3fff[_0xcfa4('0x40')],'id_display':_0x2c3fff[_0xcfa4('0x40')]},'auth':_0x476975,'json':!![]};return rp(_0x54e11b)[_0xcfa4('0x17')](function(_0x269665){_0x237a6e();})[_0xcfa4('0x24')](function(){_0x237a6e();});});}function manageTags(_0xae299b,_0x4cc5e2,_0x34f64d,_0x4c383c,_0x35943a,_0x2ee6fd,_0x4fd96e){return new Promise(function(_0x575d16,_0x592f54){var _0x5b8da4=[];_0x4cc5e2[_0xcfa4('0x28')](function(_0x343a32){_0x5b8da4[_0xcfa4('0x47')](getRemoteTag(_0x343a32,_0x34f64d,_0x4c383c,_0x2ee6fd,_0x4fd96e));});return Promise['all'](_0x5b8da4)['then'](function(_0x406936){if(_0x406936['length']){logger['info']('['+[_0xae299b['toUpperCase']()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x406936);var _0x8c81a6=[];_0x406936[_0xcfa4('0x28')](function(_0x31778a){_0x8c81a6['push'](assignTagToIncident(_0x31778a,_0x34f64d,_0x4c383c,_0x35943a,_0x2ee6fd));});return Promise[_0xcfa4('0x48')](_0x8c81a6)['then'](function(){_0x575d16();})['catch'](function(){_0x575d16();});}else{_0x575d16();}});});}function getTags(_0x3ea0d6,_0x1d01aa,_0x2d4871,_0x457a64,_0x271112,_0x3d6480){return function(_0x4cb29f){return new Promise(function(_0x4de9f5,_0x24c0c2){var _0x265d2c=[];var _0x483c93=_0x457a64[_0xcfa4('0x49')];if(_0x483c93&&_0x483c93[_0xcfa4('0x9')]>0x0){_0x265d2c=_['map'](_0x483c93,_0xcfa4('0x36'));}if(_0x265d2c[_0xcfa4('0x9')]>0x0){return manageTags(_0x3ea0d6,_0x265d2c,_0x1d01aa,_0x2d4871,_0x4cb29f,_0x271112,_0x3d6480)[_0xcfa4('0x17')](function(){_0x4de9f5(_0x4cb29f);});}else{_0x4de9f5(_0x4cb29f);}});};}function emit(_0x322aec,_0x24d7ce,_0xc1e78){var _0x402469=_0xcfa4('0x4a')+_0xcfa4('0x4b')+_0xcfa4('0x4c')+_0xcfa4('0x4d');var _0x5a9ceb={'uri':_0x322aec+_0xcfa4('0x4e')+_0xc1e78+_0x402469};io['to'](util['format'](_0xcfa4('0x4f'),_0x24d7ce))['emit'](_0xcfa4('0x50'),_0x5a9ceb);}exports['cs']=function(_0x4ef8ba,_0x20f14d,_0xf5ca92,_0xec936e,_0x488fab,_0x28f21e,_0x5b80bc,_0xc0d79f){var _0x261846={};var _0x34da07={'user':_0x28f21e[_0xcfa4('0x51')],'pass':_0x28f21e[_0xcfa4('0x52')]};var _0x4e5dc1=_0xcfa4('0x53');var _0x5a17c0=_0xcfa4('0x54');_0x28f21e['remoteUri']=intUtil[_0xcfa4('0x55')](_0x28f21e[_0xcfa4('0x56')]);_0x28f21e['serverUrl']=intUtil['stripTrailingSlash'](_0x28f21e[_0xcfa4('0x57')]);var _0xdd0a=util[_0xcfa4('0x58')](_0xcfa4('0x59'),_0x28f21e[_0xcfa4('0x56')]);_0x261846[_0xcfa4('0x14')]=!_[_0xcfa4('0x5a')](_0xec936e)?_0xec936e[_0xcfa4('0x5b')]:null;_0x261846[_0xcfa4('0x1b')]=_0x28f21e[_0xcfa4('0x5b')];_0x261846[_0xcfa4('0x20')]=_0xc0d79f[_0xcfa4('0x2d')]()==='outbound'?_0x20f14d[_0xcfa4('0x5c')]:_0x20f14d[_0xcfa4('0x5d')];_0x261846[_0xcfa4('0x5e')]=_0xc0d79f==='queue'||_0xc0d79f===_0xcfa4('0x5f')?_0xcfa4('0x60'):'outbound';var _0x116686=util[_0xcfa4('0x58')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x28f21e[_0xcfa4('0x57')],_0x20f14d['uniqueid'],md5(_0x20f14d[_0xcfa4('0x61')]));if(_0x488fab&&_0x488fab[_0xcfa4('0x62')]){logger[_0xcfa4('0xd')](_0xcfa4('0x63'),_0xcfa4('0x64'));_0x20f14d[_0xcfa4('0x65')]=_0x116686;}else if(_0x5b80bc&&_0x5b80bc['recordingFormat']&&_0x5b80bc[_0xcfa4('0x66')]!==_0xcfa4('0x67')){logger[_0xcfa4('0xd')](_0xcfa4('0x68'),_0xcfa4('0x64'));_0x20f14d[_0xcfa4('0x65')]=_0x116686;}else{_0x20f14d[_0xcfa4('0x65')]='';}return getAdminUser(_0xc0d79f,_0x34da07,_0x261846,_0xdd0a,_0x5a17c0,_0x4e5dc1)['then'](getUser(_0xc0d79f,_0x34da07,_0xdd0a,_0x5a17c0,_0x4e5dc1))['then'](getEndUser(_0xc0d79f,_0x34da07,_0xdd0a,_0x5a17c0,_0x4e5dc1))[_0xcfa4('0x17')](getTicket(_0xc0d79f,_0x34da07,_0xdd0a,_0xf5ca92,_0x20f14d,_0x5a17c0))['then'](function(_0x1c8467){logger[_0xcfa4('0xd')](util[_0xcfa4('0x58')]('The\x20ticket\x20ID\x20is:\x20%s',_0x1c8467['ticketId']));logger[_0xcfa4('0xd')](util[_0xcfa4('0x58')](_0xcfa4('0x69'),_0xc0d79f));if(_0xc0d79f!==_0xcfa4('0x5f')){logger[_0xcfa4('0xd')]('['+[_0xc0d79f[_0xcfa4('0xe')]()]+']',_0xcfa4('0x6a'));emit(_0x28f21e[_0xcfa4('0x56')],_0xec936e[_0xcfa4('0x36')],_0x1c8467[_0xcfa4('0x3f')]);}})[_0xcfa4('0x24')](function(_0x1f52bd){logger[_0xcfa4('0x10')]('['+[_0xc0d79f['toUpperCase']()]+_0xcfa4('0x6b'),util[_0xcfa4('0x6c')](_0x1f52bd,{'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 212c61d..09fdb74 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 _0xdb14=['debug','[HTTP]','merge','map','type','string','customField','toLowerCase','idField','content','variable','custom_fields','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','set_relationship','Calls','queue','remoteUri','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Inbound','Ticket\x20created!','contacts','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','error','uri','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','Outbound','The\x20Ticket\x20ID\x20is:','users','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','trigger:browser:url','%s/service/v4_1/rest.php','lastevent','isNil','toUpperCase','request-promise','bluebird','md5','util','ioredis','../../../../config/environment','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','Descriptions','date_start','toISOString','slice','replace','parent_id','parent_type','Contacts','forEach','variableName','push','set_entry','JSON','format','Basic\x20%s','apiKey','toString','get_server_info','stringify','get_entry_list','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','entry_list','length','find','name_value_list','Agent\x20found!','resolve','value','user_id','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.'];(function(_0x57fa33,_0x2b8222){var _0x12e724=function(_0x481a33){while(--_0x481a33){_0x57fa33['push'](_0x57fa33['shift']());}};_0x12e724(++_0x2b8222);}(_0xdb14,0x131));var _0x4db1=function(_0x85c64f,_0x54b56e){_0x85c64f=_0x85c64f-0x0;var _0x2ca230=_0xdb14[_0x85c64f];return _0x2ca230;};'use strict';var _=require('lodash');var rp=require(_0x4db1('0x0'));var BPromise=require(_0x4db1('0x1'));var md5=require(_0x4db1('0x2'));var util=require(_0x4db1('0x3'));var Redis=require(_0x4db1('0x4'));var intUtil=require('./util');var config=require(_0x4db1('0x5'));var logger=require('../../../../config/logger')(_0x4db1('0x6'));config[_0x4db1('0x7')]=_[_0x4db1('0x8')](config[_0x4db1('0x7')],{'host':_0x4db1('0x9'),'port':0x18eb});var io=require(_0x4db1('0xa'))(new Redis(config[_0x4db1('0x7')]));var def={'method':_0x4db1('0xb'),'json':!![]};function emit(_0x5e562f,_0x43fc78,_0x26bcfb){io['to'](_0x5e562f)[_0x4db1('0xc')](_0x43fc78,_0x26bcfb);}function getTicket(_0x598a93,_0x2a8d02,_0x3cd2e0,_0x202036,_0xb19af8,_0x566f5b,_0x5d9c50,_0x26b13b){logger[_0x4db1('0xd')](_0x4db1('0xe'));var _0x24c80c=new Date();var _0x314d6c=[{'name':_0x4db1('0xf'),'value':intUtil[_0x4db1('0x10')](_0x202036[_0x4db1('0x11')],_0xb19af8,'\x20')},{'name':_0x4db1('0x12'),'value':_0x2a8d02['id']},{'name':_0x4db1('0x13'),'value':_0x2a8d02['id']},{'name':'description','value':intUtil[_0x4db1('0x10')](_0x202036[_0x4db1('0x14')],_0xb19af8,'\x0a')},{'name':_0x4db1('0x15'),'value':_0x24c80c[_0x4db1('0x16')]()[_0x4db1('0x17')](0x0,0x13)[_0x4db1('0x18')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':'duration_minutes','value':'15'},{'name':_0x4db1('0x19'),'value':_0x3cd2e0['id']},{'name':_0x4db1('0x1a'),'value':_0x4db1('0x1b')},{'name':'parent_name','value':_0x3cd2e0['name']},{'name':'direction','value':_0x26b13b}];if(_0x566f5b['length']){_[_0x4db1('0x1c')](_0x566f5b,function(_0x2c9534){if(_0xb19af8[_0x2c9534[_0x4db1('0x1d')]]){_0x314d6c[_0x4db1('0x1e')]({'name':_0x2c9534['idField'],'value':_0xb19af8[_0x2c9534['variableName']]});}});}return request({'form':{'method':_0x4db1('0x1f'),'input_type':'JSON','response_type':_0x4db1('0x20'),'rest_data':JSON['stringify']({'session':_0x5d9c50['id'],'module_name':'Calls','name_value_list':_0x314d6c})}});}function getAuth(_0x8d1092){return util[_0x4db1('0x21')](_0x4db1('0x22'),new Buffer(_0x8d1092[_0x4db1('0x23')]+':X')[_0x4db1('0x24')]('base64'));}function getServerInfo(_0x206e19){return request({'form':{'method':_0x4db1('0x25'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4db1('0x26')]({'session':_0x206e19['id']})}});}function getUser(_0x4a827f,_0x2de179,_0x45c81a){if(!_['isNil'](_0x2de179)){logger[_0x4db1('0xd')]('Getting\x20agent\x20with\x20name',_0x2de179);return request({'form':{'method':_0x4db1('0x27'),'input_type':_0x4db1('0x20'),'response_type':_0x4db1('0x20'),'rest_data':JSON['stringify']({'session':_0x45c81a['id'],'module_name':'Employees','query':util['format'](_0x4db1('0x28'),_0x2de179),'order_by':'','offset':'0','select_fields':['id',_0x4db1('0xf'),_0x4db1('0x29')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4db1('0x2a')](function(_0x36dbe4){if(_0x36dbe4[_0x4db1('0x2b')][_0x4db1('0x2c')]){var _0x35515c=_[_0x4db1('0x2d')](_0x36dbe4['entry_list'],function(_0xe5efee){return _0xe5efee[_0x4db1('0x2e')]['user_name']['value']===_0x2de179;});if(_0x35515c){logger[_0x4db1('0xd')](_0x4db1('0x2f'));return BPromise[_0x4db1('0x30')]({'id':_0x35515c[_0x4db1('0x2e')]['id']['value'],'name':_0x35515c['name_value_list'][_0x4db1('0xf')][_0x4db1('0x31')]});}}logger[_0x4db1('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x4db1('0x30')]({'id':_0x45c81a[_0x4db1('0x2e')][_0x4db1('0x32')]['value'],'name':_0x45c81a[_0x4db1('0x2e')][_0x4db1('0x29')][_0x4db1('0x31')]});});}else{logger[_0x4db1('0xd')](_0x4db1('0x33'));return BPromise[_0x4db1('0x30')]({'id':_0x45c81a['name_value_list']['user_id'][_0x4db1('0x31')],'name':_0x45c81a[_0x4db1('0x2e')]['user_name'][_0x4db1('0x31')]});}}function getEndUser(_0x44679f,_0x49796f,_0x1377e2,_0x476acc){logger['info'](_0x4db1('0x34'),_0x1377e2);return request({'form':{'method':_0x4db1('0x27'),'input_type':'JSON','response_type':'JSON','rest_data':JSON[_0x4db1('0x26')]({'session':_0x476acc['id'],'module_name':_0x4db1('0x1b'),'query':util[_0x4db1('0x21')](_0x4db1('0x35'),_0x1377e2),'order_by':'','offset':'0','select_fields':['id',_0x4db1('0xf'),_0x4db1('0x36')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x4db1('0x2a')](function(_0x4da16c){if(_0x4da16c['entry_list'][_0x4db1('0x2c')]){var _0x537252=_[_0x4db1('0x2d')](_0x4da16c['entry_list'],function(_0x4ff930){return _0x4ff930[_0x4db1('0x2e')]['phone_home']['value']===_0x1377e2;});if(_0x537252){logger[_0x4db1('0xd')](_0x4db1('0x37'));return BPromise[_0x4db1('0x30')]({'id':_0x537252[_0x4db1('0x2e')]['id'][_0x4db1('0x31')],'name':_0x537252[_0x4db1('0x2e')]['name']['value'],'phone':_0x537252[_0x4db1('0x2e')][_0x4db1('0x36')][_0x4db1('0x31')]});}}else{logger['info'](_0x4db1('0x38'));return request({'form':{'method':_0x4db1('0x1f'),'input_type':_0x4db1('0x20'),'response_type':_0x4db1('0x20'),'rest_data':JSON[_0x4db1('0x26')]({'session':_0x476acc['id'],'module_name':_0x4db1('0x1b'),'name_value_list':[{'name':_0x4db1('0x39'),'value':_0x49796f!==_0x4db1('0x3a')?_0x49796f:util[_0x4db1('0x21')](_0x4db1('0x3b'),_0x1377e2)},{'name':_0x4db1('0x36'),'value':_0x1377e2}]})}})[_0x4db1('0x2a')](function(_0x19e5db){logger[_0x4db1('0xd')](_0x4db1('0x3c'));return BPromise[_0x4db1('0x30')]({'id':_0x19e5db['id'],'name':_0x19e5db[_0x4db1('0x2b')]['first_name'][_0x4db1('0x31')],'phone':_0x19e5db[_0x4db1('0x2b')][_0x4db1('0x36')][_0x4db1('0x31')]});});}});}function request(_0x5182bf){logger[_0x4db1('0x3d')](_0x4db1('0x3e'),JSON[_0x4db1('0x26')](_0x5182bf));return rp(_[_0x4db1('0x3f')](def,_0x5182bf));}function getTags(_0x2019b2,_0x3fbfa4){var _0x2bd13d=[];if(_0x2019b2&&_0x2019b2[_0x4db1('0x2c')]>0x0){_0x2bd13d=_[_0x4db1('0x40')](_0x2019b2,_0x3fbfa4);}return _0x2bd13d;}function getCustomFields(_0x132116,_0x10837a){var _0x5e0af7=[];var _0x56212f={'custom_fields':[]};if(_0x132116[_0x4db1('0x2c')]>0x0){_[_0x4db1('0x1c')](_0x132116,function(_0x478861){if(_0x478861[_0x4db1('0x41')]===_0x4db1('0x42')&&_0x478861['nameField']&&!_0x478861[_0x4db1('0x43')]){_0x56212f[_0x478861['nameField'][_0x4db1('0x44')]()]=_0x478861['content'][_0x4db1('0x24')]();}else if(_0x478861[_0x4db1('0x41')]===_0x4db1('0x42')&&_0x478861[_0x4db1('0x45')]&&_0x478861[_0x4db1('0x43')]){_0x56212f['custom_fields'][_0x4db1('0x1e')]({'id':_0x478861[_0x4db1('0x45')],'value':_0x478861[_0x4db1('0x46')][_0x4db1('0x24')]()});}else if(_0x478861[_0x4db1('0x41')]===_0x4db1('0x47')&&_0x478861[_0x4db1('0x1d')]&&_0x478861[_0x4db1('0x45')]&&_0x478861[_0x4db1('0x43')]){_0x10837a[_0x478861[_0x4db1('0x1d')]]&&_0x56212f[_0x4db1('0x48')][_0x4db1('0x1e')]({'id':_0x478861[_0x4db1('0x45')],'value':_0x10837a[_0x478861[_0x4db1('0x1d')]][_0x4db1('0x24')]()});}else if(_0x478861[_0x4db1('0x41')]===_0x4db1('0x49')&&_0x478861['Variable']&&_0x478861['Variable'][_0x4db1('0xf')]&&_0x478861[_0x4db1('0x45')]&&_0x478861['customField']){_0x10837a[_0x478861[_0x4db1('0x4a')][_0x4db1('0xf')][_0x4db1('0x44')]()]&&_0x56212f[_0x4db1('0x48')]['push']({'id':_0x478861[_0x4db1('0x45')],'value':_0x10837a[_0x478861[_0x4db1('0x4a')][_0x4db1('0xf')][_0x4db1('0x44')]()][_0x4db1('0x24')]()});}});}return _0x56212f;}function getConnection(_0x549f52){return request({'method':_0x4db1('0xb'),'form':{'method':_0x4db1('0x4b'),'input_type':_0x4db1('0x20'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x549f52[_0x4db1('0x4c')],'password':_0x549f52[_0x4db1('0x4d')],'encryption':_0x4db1('0x4e')},'application':_0x4db1('0x4f')})}})[_0x4db1('0x2a')](function(_0x25c1d8){var _0xab805e=_0x25c1d8;if(_0xab805e['id']){def[_0x4db1('0x50')]=_0xab805e['id'];return BPromise[_0x4db1('0x30')](_0xab805e);}else{throw new Error(util[_0x4db1('0x21')]('Account\x20%d\x20is\x20not\x20valid',_0x549f52['id']));}});}function setRelationship(_0x440916,_0x3adc54,_0x2fa294,_0xf23021){return request({'form':{'method':_0x4db1('0x51'),'input_type':'JSON','response_type':_0x4db1('0x20'),'rest_data':JSON['stringify']({'session':_0x440916['id'],'module_name':_0x4db1('0x52'),'module_id':_0x2fa294['id'],'link_field_name':_0xf23021,'related_ids':[_0x3adc54['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x4db1('0x53')]=function(_0x4662d3,_0x1f10a7,_0x21b5b1,_0x558ba0,_0x161e31,_0xdeaef6){var _0x265f88,_0x5940e9,_0x18f053,_0x11687d;_0xdeaef6[_0x4db1('0x54')]=intUtil[_0x4db1('0x55')](_0xdeaef6['remoteUri']);_0xdeaef6[_0x4db1('0x56')]=intUtil[_0x4db1('0x55')](_0xdeaef6[_0x4db1('0x56')]);def['uri']=util[_0x4db1('0x21')]('%s/service/v4_1/rest.php',_0xdeaef6[_0x4db1('0x54')]);if(_0x161e31&&_0x161e31[_0x4db1('0x57')]){logger[_0x4db1('0xd')](_0x4db1('0x58'),_0x4db1('0x59'));_0x1f10a7['recordingURL']=util[_0x4db1('0x21')](_0x4db1('0x5a'),_0xdeaef6[_0x4db1('0x56')],_0x1f10a7['uniqueid'],md5(_0x1f10a7[_0x4db1('0x5b')]));}else{_0x1f10a7[_0x4db1('0x5c')]='';}return getConnection(_0xdeaef6)[_0x4db1('0x2a')](function(_0x179199){_0x11687d=_0x179199;return getUser(_0xdeaef6,_0x558ba0[_0x4db1('0xf')],_0x11687d);})[_0x4db1('0x2a')](function(_0x3ee8c2){_0x265f88=_0x3ee8c2;logger[_0x4db1('0xd')](_0x4db1('0x5d'),_0x265f88['id']);return getEndUser(_0xdeaef6,_0x1f10a7[_0x4db1('0x5e')],_0x1f10a7[_0x4db1('0x5f')],_0x11687d);})['then'](function(_0x53eb60){_0x5940e9=_0x53eb60;logger[_0x4db1('0xd')](_0x4db1('0x60'),_0x5940e9['id']);return getTicket(_0xdeaef6,_0x265f88,_0x5940e9,_0x21b5b1,_0x1f10a7,_0x21b5b1[_0x4db1('0x61')],_0x11687d,_0x4db1('0x62'));})[_0x4db1('0x2a')](function(_0x461a88){_0x18f053=_0x461a88;logger[_0x4db1('0xd')](_0x4db1('0x63'));logger[_0x4db1('0xd')]('The\x20Ticket\x20ID\x20is:',_0x18f053['id']);return setRelationship(_0x11687d,_0x265f88,_0x18f053,'users');})[_0x4db1('0x2a')](function(){return setRelationship(_0x11687d,_0x5940e9,_0x18f053,_0x4db1('0x64'));})['then'](function(){return getServerInfo(_0x11687d);})[_0x4db1('0x2a')](function(_0x2104d8){var _0x49de8d=parseInt(_0x2104d8[_0x4db1('0x65')]['charAt'](0x0));var _0x24e0f0=util[_0x4db1('0x21')](_0x4db1('0x66'),_0xdeaef6[_0x4db1('0x54')],_0x18f053['id']);if(_0x49de8d>0x6){_0x24e0f0=util['format']('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0xdeaef6[_0x4db1('0x54')],_0x18f053['id']);}logger[_0x4db1('0xd')](_0x4db1('0x58'),_0x4db1('0x67'));emit(util[_0x4db1('0x21')](_0x4db1('0x68'),_0x558ba0[_0x4db1('0xf')]),'trigger:browser:url',{'uri':_0x24e0f0});})[_0x4db1('0x69')](function(_0x541aa0){logger[_0x4db1('0x6a')](_0x4db1('0x58'),JSON['stringify'](_0x541aa0));});};exports['outbound']=function(_0x269951,_0x3ccde4,_0x379881,_0x299d93,_0x4e054c,_0x3ec152,_0x1a5462){var _0x2d68a2,_0xdf5023,_0x5cb0b2,_0x2cc347;_0x3ec152[_0x4db1('0x54')]=intUtil[_0x4db1('0x55')](_0x3ec152[_0x4db1('0x54')]);_0x3ec152[_0x4db1('0x56')]=intUtil[_0x4db1('0x55')](_0x3ec152[_0x4db1('0x56')]);def[_0x4db1('0x6b')]=util[_0x4db1('0x21')]('%s/service/v4_1/rest.php',_0x3ec152[_0x4db1('0x54')]);if(_0x1a5462&&_0x1a5462['recordingFormat']&&_0x1a5462[_0x4db1('0x6c')]!==_0x4db1('0x6d')){logger['info'](_0x4db1('0x6e'),_0x4db1('0x59'));_0x3ccde4[_0x4db1('0x5c')]=util[_0x4db1('0x21')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3ec152[_0x4db1('0x56')],_0x3ccde4[_0x4db1('0x5b')],md5(_0x3ccde4[_0x4db1('0x5b')]));}return getConnection(_0x3ec152)[_0x4db1('0x2a')](function(_0x4dfa48){_0x2cc347=_0x4dfa48;return getUser(_0x3ec152,_0x299d93[_0x4db1('0xf')],_0x2cc347);})[_0x4db1('0x2a')](function(_0x4fe2f5){_0x2d68a2=_0x4fe2f5;logger[_0x4db1('0xd')](_0x4db1('0x5d'),_0x2d68a2['id']);return getEndUser(_0x3ec152,_0x3ccde4[_0x4db1('0x6f')],_0x3ccde4[_0x4db1('0x70')],_0x2cc347);})[_0x4db1('0x2a')](function(_0x20c467){_0xdf5023=_0x20c467;logger[_0x4db1('0xd')](_0x4db1('0x60'),_0xdf5023['id']);return getTicket(_0x3ec152,_0x2d68a2,_0xdf5023,_0x379881,_0x3ccde4,_0x379881[_0x4db1('0x61')],_0x2cc347,_0x4db1('0x71'));})['then'](function(_0x1a857f){_0x5cb0b2=_0x1a857f;logger['info'](_0x4db1('0x63'));logger[_0x4db1('0xd')](_0x4db1('0x72'),_0x5cb0b2['id']);return setRelationship(_0x2cc347,_0x2d68a2,_0x5cb0b2,_0x4db1('0x73'));})[_0x4db1('0x2a')](function(){return setRelationship(_0x2cc347,_0xdf5023,_0x5cb0b2,'contacts');})['then'](function(){return getServerInfo(_0x2cc347);})[_0x4db1('0x2a')](function(_0x21e8d3){var _0x58a641=parseInt(_0x21e8d3[_0x4db1('0x65')]['charAt'](0x0));var _0x56810=util[_0x4db1('0x21')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x3ec152[_0x4db1('0x54')],_0x5cb0b2['id']);if(_0x58a641>0x6){_0x56810=util[_0x4db1('0x21')](_0x4db1('0x74'),_0x3ec152[_0x4db1('0x54')],_0x5cb0b2['id']);}logger['info'](_0x4db1('0x6e'),_0x4db1('0x67'));emit(util[_0x4db1('0x21')]('user:%s',_0x299d93[_0x4db1('0xf')]),_0x4db1('0x75'),{'uri':_0x56810});})[_0x4db1('0x69')](function(_0x61b5ac){logger[_0x4db1('0x6a')](_0x4db1('0x6e'),JSON['stringify'](_0x61b5ac));});};exports['unmanaged']=function(_0x53e7ee,_0x392369,_0x38d553,_0x41c77b,_0x4efd81,_0x3331de){var _0x2ad49a,_0x228f37,_0x3f9e50,_0xafab13;_0x3331de[_0x4db1('0x54')]=intUtil['stripTrailingSlash'](_0x3331de['remoteUri']);_0x3331de[_0x4db1('0x56')]=intUtil['stripTrailingSlash'](_0x3331de[_0x4db1('0x56')]);def['uri']=util[_0x4db1('0x21')](_0x4db1('0x76'),_0x3331de[_0x4db1('0x54')]);if(_0x4efd81&&_0x4efd81[_0x4db1('0x57')]){logger[_0x4db1('0xd')]('['+_0x392369[_0x4db1('0x77')]['toUpperCase']()+']',_0x4db1('0x59'));_0x392369[_0x4db1('0x5c')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3331de['serverUrl'],_0x392369[_0x4db1('0x5b')],md5(_0x392369[_0x4db1('0x5b')]));}else{_0x392369['recordingURL']='';}return getConnection(_0x3331de)['then'](function(_0x2f4280){_0xafab13=_0x2f4280;if(!_[_0x4db1('0x78')](_0x41c77b)){return getUser(_0x3331de,_0x41c77b[_0x4db1('0xf')],_0xafab13);}else{return getUser(_0x3331de,null,_0xafab13);}})['then'](function(_0x5bb4a7){_0x2ad49a=_0x5bb4a7;logger[_0x4db1('0xd')](_0x4db1('0x5d'),_0x2ad49a['id']);return getEndUser(_0x3331de,_0x392369['calleridname'],_0x392369['calleridnum'],_0xafab13);})[_0x4db1('0x2a')](function(_0x1c1448){_0x228f37=_0x1c1448;logger[_0x4db1('0xd')](_0x4db1('0x60'),_0x228f37['id']);return getTicket(_0x3331de,_0x2ad49a,_0x228f37,_0x38d553,_0x392369,_0x38d553[_0x4db1('0x61')],_0xafab13,'Inbound');})[_0x4db1('0x2a')](function(_0xfdafc1){_0x3f9e50=_0xfdafc1;logger[_0x4db1('0xd')](_0x4db1('0x63'));logger[_0x4db1('0xd')](_0x4db1('0x72'),_0x3f9e50['id']);return setRelationship(_0xafab13,_0x2ad49a,_0x3f9e50,_0x4db1('0x73'));})[_0x4db1('0x2a')](function(){return setRelationship(_0xafab13,_0x228f37,_0x3f9e50,_0x4db1('0x64'));})['then'](function(){return getServerInfo(_0xafab13);})[_0x4db1('0x69')](function(_0xc84511){logger[_0x4db1('0x6a')]('['+_0x392369[_0x4db1('0x77')][_0x4db1('0x79')]()+']',JSON[_0x4db1('0x26')](_0xc84511));});}; \ No newline at end of file +var _0x94d8=['phone_home','then','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','','Caller\x20-\x20%s','Enduser\x20created.','first_name','[HTTP]','merge','type','string','nameField','customField','toLowerCase','toString','idField','custom_fields','content','variable','customVariable','Variable','POST','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','queue','stripTrailingSlash','remoteUri','serverUrl','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','users','contacts','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','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','error','outbound','uri','recordingFormat','none','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Fields','Outbound','[OUTBOUND]','catch','monitor_format','toUpperCase','lastevent','lodash','request-promise','bluebird','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','emit','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','Descriptions','toISOString','slice','duration_minutes','parent_id','Contacts','parent_name','direction','length','forEach','push','variableName','set_entry','JSON','stringify','Calls','format','Basic\x20%s','apiKey','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','get_entry_list','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','entry_list','find','name_value_list','value','Agent\x20found!','resolve','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone'];(function(_0x541523,_0x226b02){var _0x49bf51=function(_0x454342){while(--_0x454342){_0x541523['push'](_0x541523['shift']());}};_0x49bf51(++_0x226b02);}(_0x94d8,0x149));var _0x894d=function(_0x11fbf1,_0x4272b7){_0x11fbf1=_0x11fbf1-0x0;var _0x1fa899=_0x94d8[_0x11fbf1];return _0x1fa899;};'use strict';var _=require(_0x894d('0x0'));var rp=require(_0x894d('0x1'));var BPromise=require(_0x894d('0x2'));var md5=require(_0x894d('0x3'));var util=require('util');var Redis=require(_0x894d('0x4'));var intUtil=require(_0x894d('0x5'));var config=require(_0x894d('0x6'));var logger=require(_0x894d('0x7'))(_0x894d('0x8'));config[_0x894d('0x9')]=_[_0x894d('0xa')](config[_0x894d('0x9')],{'host':_0x894d('0xb'),'port':0x18eb});var io=require(_0x894d('0xc'))(new Redis(config[_0x894d('0x9')]));var def={'method':'POST','json':!![]};function emit(_0x1eb86e,_0x10ac9f,_0x105fa0){io['to'](_0x1eb86e)[_0x894d('0xd')](_0x10ac9f,_0x105fa0);}function getTicket(_0x65db55,_0xae131b,_0x2d6dd5,_0x1cb0c6,_0x1bd4a1,_0x1a8c0c,_0xe467f8,_0x2a1fb3){logger[_0x894d('0xe')](_0x894d('0xf'));var _0x2d0968=new Date();var _0x438a4e=[{'name':_0x894d('0x10'),'value':intUtil[_0x894d('0x11')](_0x1cb0c6[_0x894d('0x12')],_0x1bd4a1,'\x20')},{'name':_0x894d('0x13'),'value':_0xae131b['id']},{'name':_0x894d('0x14'),'value':_0xae131b['id']},{'name':_0x894d('0x15'),'value':intUtil[_0x894d('0x11')](_0x1cb0c6[_0x894d('0x16')],_0x1bd4a1,'\x0a')},{'name':'date_start','value':_0x2d0968[_0x894d('0x17')]()[_0x894d('0x18')](0x0,0x13)['replace']('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x894d('0x19'),'value':'15'},{'name':_0x894d('0x1a'),'value':_0x2d6dd5['id']},{'name':'parent_type','value':_0x894d('0x1b')},{'name':_0x894d('0x1c'),'value':_0x2d6dd5[_0x894d('0x10')]},{'name':_0x894d('0x1d'),'value':_0x2a1fb3}];if(_0x1a8c0c[_0x894d('0x1e')]){_[_0x894d('0x1f')](_0x1a8c0c,function(_0x4e2ba2){if(_0x1bd4a1[_0x4e2ba2['variableName']]){_0x438a4e[_0x894d('0x20')]({'name':_0x4e2ba2['idField'],'value':_0x1bd4a1[_0x4e2ba2[_0x894d('0x21')]]});}});}return request({'form':{'method':_0x894d('0x22'),'input_type':_0x894d('0x23'),'response_type':'JSON','rest_data':JSON[_0x894d('0x24')]({'session':_0xe467f8['id'],'module_name':_0x894d('0x25'),'name_value_list':_0x438a4e})}});}function getAuth(_0x287f1c){return util[_0x894d('0x26')](_0x894d('0x27'),new Buffer(_0x287f1c[_0x894d('0x28')]+':X')['toString'](_0x894d('0x29')));}function getServerInfo(_0x212ccc){return request({'form':{'method':_0x894d('0x2a'),'input_type':_0x894d('0x23'),'response_type':_0x894d('0x23'),'rest_data':JSON[_0x894d('0x24')]({'session':_0x212ccc['id']})}});}function getUser(_0x2e6d1e,_0x4b2101,_0x53c1c8){if(!_[_0x894d('0x2b')](_0x4b2101)){logger[_0x894d('0xe')](_0x894d('0x2c'),_0x4b2101);return request({'form':{'method':_0x894d('0x2d'),'input_type':_0x894d('0x23'),'response_type':_0x894d('0x23'),'rest_data':JSON['stringify']({'session':_0x53c1c8['id'],'module_name':_0x894d('0x2e'),'query':util['format'](_0x894d('0x2f'),_0x4b2101),'order_by':'','offset':'0','select_fields':['id',_0x894d('0x10'),_0x894d('0x30')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0xe86be6){if(_0xe86be6[_0x894d('0x31')]['length']){var _0x5977dd=_[_0x894d('0x32')](_0xe86be6[_0x894d('0x31')],function(_0x3a251f){return _0x3a251f[_0x894d('0x33')][_0x894d('0x30')][_0x894d('0x34')]===_0x4b2101;});if(_0x5977dd){logger['info'](_0x894d('0x35'));return BPromise[_0x894d('0x36')]({'id':_0x5977dd[_0x894d('0x33')]['id'][_0x894d('0x34')],'name':_0x5977dd[_0x894d('0x33')][_0x894d('0x10')][_0x894d('0x34')]});}}logger[_0x894d('0xe')](_0x894d('0x37'));return BPromise[_0x894d('0x36')]({'id':_0x53c1c8[_0x894d('0x33')][_0x894d('0x38')][_0x894d('0x34')],'name':_0x53c1c8[_0x894d('0x33')][_0x894d('0x30')][_0x894d('0x34')]});});}else{logger[_0x894d('0xe')]('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x894d('0x36')]({'id':_0x53c1c8[_0x894d('0x33')][_0x894d('0x38')][_0x894d('0x34')],'name':_0x53c1c8[_0x894d('0x33')][_0x894d('0x30')][_0x894d('0x34')]});}}function getEndUser(_0xfa1544,_0x121563,_0x5703aa,_0x9e7d0f){logger[_0x894d('0xe')](_0x894d('0x39'),_0x5703aa);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x894d('0x23'),'rest_data':JSON['stringify']({'session':_0x9e7d0f['id'],'module_name':_0x894d('0x1b'),'query':util[_0x894d('0x26')]('contacts.phone_home\x20=\x20\x22%s\x22',_0x5703aa),'order_by':'','offset':'0','select_fields':['id',_0x894d('0x10'),_0x894d('0x3a')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x894d('0x3b')](function(_0xc7855d){if(_0xc7855d['entry_list'][_0x894d('0x1e')]){var _0x36aaf9=_[_0x894d('0x32')](_0xc7855d[_0x894d('0x31')],function(_0x509486){return _0x509486[_0x894d('0x33')][_0x894d('0x3a')][_0x894d('0x34')]===_0x5703aa;});if(_0x36aaf9){logger[_0x894d('0xe')](_0x894d('0x3c'));return BPromise[_0x894d('0x36')]({'id':_0x36aaf9[_0x894d('0x33')]['id'][_0x894d('0x34')],'name':_0x36aaf9['name_value_list']['name'][_0x894d('0x34')],'phone':_0x36aaf9['name_value_list'][_0x894d('0x3a')][_0x894d('0x34')]});}}else{logger[_0x894d('0xe')](_0x894d('0x3d'));return request({'form':{'method':_0x894d('0x22'),'input_type':'JSON','response_type':_0x894d('0x23'),'rest_data':JSON[_0x894d('0x24')]({'session':_0x9e7d0f['id'],'module_name':_0x894d('0x1b'),'name_value_list':[{'name':'first_name','value':_0x121563!==_0x894d('0x3e')?_0x121563:util[_0x894d('0x26')](_0x894d('0x3f'),_0x5703aa)},{'name':_0x894d('0x3a'),'value':_0x5703aa}]})}})[_0x894d('0x3b')](function(_0x3d1a84){logger[_0x894d('0xe')](_0x894d('0x40'));return BPromise[_0x894d('0x36')]({'id':_0x3d1a84['id'],'name':_0x3d1a84[_0x894d('0x31')][_0x894d('0x41')][_0x894d('0x34')],'phone':_0x3d1a84['entry_list'][_0x894d('0x3a')][_0x894d('0x34')]});});}});}function request(_0x598a80){logger['debug'](_0x894d('0x42'),JSON[_0x894d('0x24')](_0x598a80));return rp(_[_0x894d('0x43')](def,_0x598a80));}function getTags(_0x35fc55,_0x37a928){var _0x2fdbd5=[];if(_0x35fc55&&_0x35fc55[_0x894d('0x1e')]>0x0){_0x2fdbd5=_['map'](_0x35fc55,_0x37a928);}return _0x2fdbd5;}function getCustomFields(_0x480862,_0x53c289){var _0x5e498a=[];var _0x240805={'custom_fields':[]};if(_0x480862[_0x894d('0x1e')]>0x0){_[_0x894d('0x1f')](_0x480862,function(_0x1b39d4){if(_0x1b39d4[_0x894d('0x44')]===_0x894d('0x45')&&_0x1b39d4[_0x894d('0x46')]&&!_0x1b39d4[_0x894d('0x47')]){_0x240805[_0x1b39d4[_0x894d('0x46')][_0x894d('0x48')]()]=_0x1b39d4['content'][_0x894d('0x49')]();}else if(_0x1b39d4['type']===_0x894d('0x45')&&_0x1b39d4[_0x894d('0x4a')]&&_0x1b39d4[_0x894d('0x47')]){_0x240805[_0x894d('0x4b')][_0x894d('0x20')]({'id':_0x1b39d4['idField'],'value':_0x1b39d4[_0x894d('0x4c')][_0x894d('0x49')]()});}else if(_0x1b39d4[_0x894d('0x44')]===_0x894d('0x4d')&&_0x1b39d4[_0x894d('0x21')]&&_0x1b39d4['idField']&&_0x1b39d4[_0x894d('0x47')]){_0x53c289[_0x1b39d4[_0x894d('0x21')]]&&_0x240805['custom_fields']['push']({'id':_0x1b39d4[_0x894d('0x4a')],'value':_0x53c289[_0x1b39d4['variableName']]['toString']()});}else if(_0x1b39d4[_0x894d('0x44')]===_0x894d('0x4e')&&_0x1b39d4[_0x894d('0x4f')]&&_0x1b39d4[_0x894d('0x4f')][_0x894d('0x10')]&&_0x1b39d4[_0x894d('0x4a')]&&_0x1b39d4[_0x894d('0x47')]){_0x53c289[_0x1b39d4[_0x894d('0x4f')][_0x894d('0x10')][_0x894d('0x48')]()]&&_0x240805[_0x894d('0x4b')][_0x894d('0x20')]({'id':_0x1b39d4['idField'],'value':_0x53c289[_0x1b39d4['Variable'][_0x894d('0x10')][_0x894d('0x48')]()][_0x894d('0x49')]()});}});}return _0x240805;}function getConnection(_0x39c13b){return request({'method':_0x894d('0x50'),'form':{'method':_0x894d('0x51'),'input_type':'JSON','response_type':_0x894d('0x23'),'rest_data':JSON[_0x894d('0x24')]({'user_auth':{'user_name':_0x39c13b[_0x894d('0x52')],'password':_0x39c13b[_0x894d('0x53')],'encryption':_0x894d('0x54')},'application':_0x894d('0x55')})}})[_0x894d('0x3b')](function(_0x2e38e0){var _0x34c6e0=_0x2e38e0;if(_0x34c6e0['id']){def[_0x894d('0x56')]=_0x34c6e0['id'];return BPromise['resolve'](_0x34c6e0);}else{throw new Error(util[_0x894d('0x26')](_0x894d('0x57'),_0x39c13b['id']));}});}function setRelationship(_0x3ac813,_0x22b870,_0x253f27,_0x4477dc){return request({'form':{'method':_0x894d('0x58'),'input_type':'JSON','response_type':_0x894d('0x23'),'rest_data':JSON[_0x894d('0x24')]({'session':_0x3ac813['id'],'module_name':'Calls','module_id':_0x253f27['id'],'link_field_name':_0x4477dc,'related_ids':[_0x22b870['id']],'name_value_list':[],'delete':0x0})}});}exports[_0x894d('0x59')]=function(_0x2fe263,_0x41483d,_0x36a870,_0x1dc40f,_0x113772,_0x20963f){var _0x22989f,_0x21fdf0,_0x160d29,_0x4847e9;_0x20963f['remoteUri']=intUtil[_0x894d('0x5a')](_0x20963f[_0x894d('0x5b')]);_0x20963f[_0x894d('0x5c')]=intUtil[_0x894d('0x5a')](_0x20963f[_0x894d('0x5c')]);def['uri']=util[_0x894d('0x26')](_0x894d('0x5d'),_0x20963f[_0x894d('0x5b')]);if(_0x113772&&_0x113772['monitor_format']){logger[_0x894d('0xe')](_0x894d('0x5e'),_0x894d('0x5f'));_0x41483d[_0x894d('0x60')]=util[_0x894d('0x26')](_0x894d('0x61'),_0x20963f[_0x894d('0x5c')],_0x41483d[_0x894d('0x62')],md5(_0x41483d['uniqueid']));}else{_0x41483d[_0x894d('0x60')]='';}return getConnection(_0x20963f)['then'](function(_0x4ec375){_0x4847e9=_0x4ec375;return getUser(_0x20963f,_0x1dc40f[_0x894d('0x10')],_0x4847e9);})[_0x894d('0x3b')](function(_0x992005){_0x22989f=_0x992005;logger[_0x894d('0xe')]('The\x20User\x20ID\x20is:',_0x22989f['id']);return getEndUser(_0x20963f,_0x41483d[_0x894d('0x63')],_0x41483d[_0x894d('0x64')],_0x4847e9);})[_0x894d('0x3b')](function(_0x579865){_0x21fdf0=_0x579865;logger['info'](_0x894d('0x65'),_0x21fdf0['id']);return getTicket(_0x20963f,_0x22989f,_0x21fdf0,_0x36a870,_0x41483d,_0x36a870['Fields'],_0x4847e9,_0x894d('0x66'));})[_0x894d('0x3b')](function(_0x4588f3){_0x160d29=_0x4588f3;logger[_0x894d('0xe')](_0x894d('0x67'));logger['info'](_0x894d('0x68'),_0x160d29['id']);return setRelationship(_0x4847e9,_0x22989f,_0x160d29,_0x894d('0x69'));})[_0x894d('0x3b')](function(){return setRelationship(_0x4847e9,_0x21fdf0,_0x160d29,_0x894d('0x6a'));})['then'](function(){return getServerInfo(_0x4847e9);})[_0x894d('0x3b')](function(_0xc9058f){var _0x4b53fd=parseInt(_0xc9058f[_0x894d('0x6b')][_0x894d('0x6c')](0x0));var _0x2bdbb8=util[_0x894d('0x26')](_0x894d('0x6d'),_0x20963f['remoteUri'],_0x160d29['id']);if(_0x4b53fd>0x6){_0x2bdbb8=util[_0x894d('0x26')](_0x894d('0x6e'),_0x20963f['remoteUri'],_0x160d29['id']);}logger[_0x894d('0xe')](_0x894d('0x5e'),_0x894d('0x6f'));emit(util[_0x894d('0x26')](_0x894d('0x70'),_0x1dc40f[_0x894d('0x10')]),_0x894d('0x71'),{'uri':_0x2bdbb8});})['catch'](function(_0x5a4a22){logger[_0x894d('0x72')](_0x894d('0x5e'),JSON[_0x894d('0x24')](_0x5a4a22));});};exports[_0x894d('0x73')]=function(_0xd78c8f,_0x3aa7c7,_0x45aef1,_0x59d140,_0x431e75,_0x33b541,_0x292db){var _0x5253b3,_0x2d748e,_0x33c6ab,_0x3f3114;_0x33b541[_0x894d('0x5b')]=intUtil[_0x894d('0x5a')](_0x33b541[_0x894d('0x5b')]);_0x33b541[_0x894d('0x5c')]=intUtil[_0x894d('0x5a')](_0x33b541[_0x894d('0x5c')]);def[_0x894d('0x74')]=util['format']('%s/service/v4_1/rest.php',_0x33b541['remoteUri']);if(_0x292db&&_0x292db[_0x894d('0x75')]&&_0x292db['recordingFormat']!==_0x894d('0x76')){logger[_0x894d('0xe')]('[OUTBOUND]',_0x894d('0x5f'));_0x3aa7c7[_0x894d('0x60')]=util[_0x894d('0x26')](_0x894d('0x61'),_0x33b541[_0x894d('0x5c')],_0x3aa7c7[_0x894d('0x62')],md5(_0x3aa7c7[_0x894d('0x62')]));}return getConnection(_0x33b541)[_0x894d('0x3b')](function(_0x346aa0){_0x3f3114=_0x346aa0;return getUser(_0x33b541,_0x59d140[_0x894d('0x10')],_0x3f3114);})[_0x894d('0x3b')](function(_0x7535cb){_0x5253b3=_0x7535cb;logger[_0x894d('0xe')](_0x894d('0x77'),_0x5253b3['id']);return getEndUser(_0x33b541,_0x3aa7c7[_0x894d('0x78')],_0x3aa7c7[_0x894d('0x79')],_0x3f3114);})[_0x894d('0x3b')](function(_0x1ef591){_0x2d748e=_0x1ef591;logger['info'](_0x894d('0x65'),_0x2d748e['id']);return getTicket(_0x33b541,_0x5253b3,_0x2d748e,_0x45aef1,_0x3aa7c7,_0x45aef1[_0x894d('0x7a')],_0x3f3114,_0x894d('0x7b'));})['then'](function(_0x5d25ac){_0x33c6ab=_0x5d25ac;logger[_0x894d('0xe')]('Ticket\x20created!');logger[_0x894d('0xe')](_0x894d('0x68'),_0x33c6ab['id']);return setRelationship(_0x3f3114,_0x5253b3,_0x33c6ab,_0x894d('0x69'));})['then'](function(){return setRelationship(_0x3f3114,_0x2d748e,_0x33c6ab,_0x894d('0x6a'));})['then'](function(){return getServerInfo(_0x3f3114);})[_0x894d('0x3b')](function(_0x48664e){var _0x12f02=parseInt(_0x48664e[_0x894d('0x6b')]['charAt'](0x0));var _0x26c39c=util[_0x894d('0x26')](_0x894d('0x6d'),_0x33b541[_0x894d('0x5b')],_0x33c6ab['id']);if(_0x12f02>0x6){_0x26c39c=util[_0x894d('0x26')](_0x894d('0x6e'),_0x33b541['remoteUri'],_0x33c6ab['id']);}logger[_0x894d('0xe')](_0x894d('0x7c'),_0x894d('0x6f'));emit(util[_0x894d('0x26')](_0x894d('0x70'),_0x59d140[_0x894d('0x10')]),'trigger:browser:url',{'uri':_0x26c39c});})[_0x894d('0x7d')](function(_0x1548d5){logger[_0x894d('0x72')](_0x894d('0x7c'),JSON['stringify'](_0x1548d5));});};exports['unmanaged']=function(_0x3035f9,_0x3eb5c7,_0xd4f92f,_0x54c11a,_0x684abc,_0x2722ad){var _0x532362,_0x4e678c,_0x395cd0,_0x267f4f;_0x2722ad[_0x894d('0x5b')]=intUtil[_0x894d('0x5a')](_0x2722ad['remoteUri']);_0x2722ad[_0x894d('0x5c')]=intUtil[_0x894d('0x5a')](_0x2722ad[_0x894d('0x5c')]);def[_0x894d('0x74')]=util[_0x894d('0x26')](_0x894d('0x5d'),_0x2722ad['remoteUri']);if(_0x684abc&&_0x684abc[_0x894d('0x7e')]){logger[_0x894d('0xe')]('['+_0x3eb5c7['lastevent'][_0x894d('0x7f')]()+']','Recording\x20is\x20enabled!');_0x3eb5c7[_0x894d('0x60')]=util[_0x894d('0x26')](_0x894d('0x61'),_0x2722ad[_0x894d('0x5c')],_0x3eb5c7[_0x894d('0x62')],md5(_0x3eb5c7[_0x894d('0x62')]));}else{_0x3eb5c7[_0x894d('0x60')]='';}return getConnection(_0x2722ad)['then'](function(_0x5324b6){_0x267f4f=_0x5324b6;if(!_[_0x894d('0x2b')](_0x54c11a)){return getUser(_0x2722ad,_0x54c11a['name'],_0x267f4f);}else{return getUser(_0x2722ad,null,_0x267f4f);}})[_0x894d('0x3b')](function(_0x27a43a){_0x532362=_0x27a43a;logger[_0x894d('0xe')](_0x894d('0x77'),_0x532362['id']);return getEndUser(_0x2722ad,_0x3eb5c7['calleridname'],_0x3eb5c7['calleridnum'],_0x267f4f);})[_0x894d('0x3b')](function(_0x5c3d85){_0x4e678c=_0x5c3d85;logger[_0x894d('0xe')](_0x894d('0x65'),_0x4e678c['id']);return getTicket(_0x2722ad,_0x532362,_0x4e678c,_0xd4f92f,_0x3eb5c7,_0xd4f92f[_0x894d('0x7a')],_0x267f4f,_0x894d('0x66'));})['then'](function(_0x2eb3b4){_0x395cd0=_0x2eb3b4;logger[_0x894d('0xe')](_0x894d('0x67'));logger[_0x894d('0xe')](_0x894d('0x68'),_0x395cd0['id']);return setRelationship(_0x267f4f,_0x532362,_0x395cd0,_0x894d('0x69'));})[_0x894d('0x3b')](function(){return setRelationship(_0x267f4f,_0x4e678c,_0x395cd0,'contacts');})[_0x894d('0x3b')](function(){return getServerInfo(_0x267f4f);})[_0x894d('0x7d')](function(_0x12b4d8){logger['error']('['+_0x3eb5c7[_0x894d('0x80')]['toUpperCase']()+']',JSON[_0x894d('0x24')](_0x12b4d8));});}; \ 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 7019ef3..fef89eb 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 _0x980a=['toLowerCase','keyType','string','key','%s:\x20%s','keyContent','format','join','stripTrailingSlash','substring','validateEmail','isNil','test','util','getString','length','sortBy','push','content','type','variable','variableName','toString','customVariable','Variable','name'];(function(_0x2dbd5e,_0x202f18){var _0x41855f=function(_0x1c8ed3){while(--_0x1c8ed3){_0x2dbd5e['push'](_0x2dbd5e['shift']());}};_0x41855f(++_0x202f18);}(_0x980a,0x111));var _0xa980=function(_0x47fd7b,_0x4f707f){_0x47fd7b=_0x47fd7b-0x0;var _0x131753=_0x980a[_0x47fd7b];return _0x131753;};'use strict';var _=require('lodash');var util=require(_0xa980('0x0'));exports[_0xa980('0x1')]=function(_0x3cd66f,_0x105455,_0x466523){var _0x423e8d=[];if(_0x3cd66f[_0xa980('0x2')]>0x0){var _0x10fb98=_[_0xa980('0x3')](_0x3cd66f,['id']);for(var _0x3fed27=0x0;_0x3fed27<_0x10fb98['length'];_0x3fed27++){var _0x4f4748=_0x10fb98[_0x3fed27];if(_0x4f4748['type']==='string'){_0x423e8d[_0xa980('0x4')](_0x4f4748[_0xa980('0x5')]);}else if(_0x4f4748[_0xa980('0x6')]===_0xa980('0x7')&&_0x4f4748[_0xa980('0x8')]){_0x105455[_0x4f4748[_0xa980('0x8')]]&&_0x423e8d[_0xa980('0x4')](_0x105455[_0x4f4748['variableName']][_0xa980('0x9')]());}else if(_0x4f4748[_0xa980('0x6')]===_0xa980('0xa')&&_0x4f4748[_0xa980('0xb')]&&_0x4f4748[_0xa980('0xb')][_0xa980('0xc')]){_0x105455[_0x4f4748['Variable']['name'][_0xa980('0xd')]()]&&_0x423e8d[_0xa980('0x4')](_0x105455[_0x4f4748[_0xa980('0xb')][_0xa980('0xc')][_0xa980('0xd')]()][_0xa980('0x9')]());}else if(_0x4f4748[_0xa980('0x6')]==='keyValue'){if(_0x4f4748[_0xa980('0xe')]===_0xa980('0xf')&&_0x4f4748[_0xa980('0x10')]){_0x423e8d['push'](util['format'](_0xa980('0x11'),_0x4f4748[_0xa980('0x10')],_0x4f4748[_0xa980('0x12')]));}else if(_0x4f4748[_0xa980('0xe')]===_0xa980('0x7')&&_0x4f4748[_0xa980('0x8')]&&_0x4f4748[_0xa980('0x10')]){_0x105455[_0x4f4748['variableName']]&&_0x423e8d['push'](util[_0xa980('0x13')](_0xa980('0x11'),_0x4f4748['key'],_0x105455[_0x4f4748[_0xa980('0x8')]]));}else if(_0x4f4748['keyType']==='customVariable'&&_0x4f4748[_0xa980('0xb')]&&_0x4f4748[_0xa980('0xb')][_0xa980('0xc')]&&_0x4f4748[_0xa980('0x10')]){_0x105455[_0x4f4748[_0xa980('0xb')][_0xa980('0xc')][_0xa980('0xd')]()]&&_0x423e8d[_0xa980('0x4')](util[_0xa980('0x13')](_0xa980('0x11'),_0x4f4748[_0xa980('0x10')],_0x105455[_0x4f4748[_0xa980('0xb')][_0xa980('0xc')][_0xa980('0xd')]()]));}}}}return _0x423e8d[_0xa980('0x14')](_0x466523);};exports[_0xa980('0x15')]=function(_0x3ffb17){var _0x1b94a7=_0x3ffb17['slice'](-0x1);if(_0x1b94a7==='/'){_0x3ffb17=_0x3ffb17[_0xa980('0x16')](0x0,_0x3ffb17['lastIndexOf'](_0x1b94a7));}return _0x3ffb17;};exports[_0xa980('0x17')]=function(_0x2d7ec9){if(!_[_0xa980('0x18')](_0x2d7ec9)&&_0x2d7ec9!==''){var _0xf6c8e6=/^(([^<>()\[\]\\.,;:\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 _0xf6c8e6[_0xa980('0x19')](String(_0x2d7ec9)[_0xa980('0xd')]());}else{return![];}}; \ No newline at end of file +var _0x09c1=['string','push','content','variable','variableName','toString','type','customVariable','Variable','name','toLowerCase','keyType','format','%s:\x20%s','key','join','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length'];(function(_0x2898b0,_0x1c3347){var _0x59f91c=function(_0x5abe2e){while(--_0x5abe2e){_0x2898b0['push'](_0x2898b0['shift']());}};_0x59f91c(++_0x1c3347);}(_0x09c1,0x9e));var _0x109c=function(_0x4295bc,_0x55b581){_0x4295bc=_0x4295bc-0x0;var _0x2f0298=_0x09c1[_0x4295bc];return _0x2f0298;};'use strict';var _=require(_0x109c('0x0'));var util=require(_0x109c('0x1'));exports[_0x109c('0x2')]=function(_0x557534,_0x26147a,_0x1d1630){var _0x128d12=[];if(_0x557534['length']>0x0){var _0x11e251=_['sortBy'](_0x557534,['id']);for(var _0x265bc1=0x0;_0x265bc1<_0x11e251[_0x109c('0x3')];_0x265bc1++){var _0x9e614c=_0x11e251[_0x265bc1];if(_0x9e614c['type']===_0x109c('0x4')){_0x128d12[_0x109c('0x5')](_0x9e614c[_0x109c('0x6')]);}else if(_0x9e614c['type']===_0x109c('0x7')&&_0x9e614c[_0x109c('0x8')]){_0x26147a[_0x9e614c[_0x109c('0x8')]]&&_0x128d12[_0x109c('0x5')](_0x26147a[_0x9e614c[_0x109c('0x8')]][_0x109c('0x9')]());}else if(_0x9e614c[_0x109c('0xa')]===_0x109c('0xb')&&_0x9e614c['Variable']&&_0x9e614c[_0x109c('0xc')][_0x109c('0xd')]){_0x26147a[_0x9e614c[_0x109c('0xc')][_0x109c('0xd')][_0x109c('0xe')]()]&&_0x128d12[_0x109c('0x5')](_0x26147a[_0x9e614c[_0x109c('0xc')][_0x109c('0xd')][_0x109c('0xe')]()][_0x109c('0x9')]());}else if(_0x9e614c['type']==='keyValue'){if(_0x9e614c[_0x109c('0xf')]==='string'&&_0x9e614c['key']){_0x128d12[_0x109c('0x5')](util[_0x109c('0x10')](_0x109c('0x11'),_0x9e614c[_0x109c('0x12')],_0x9e614c['keyContent']));}else if(_0x9e614c[_0x109c('0xf')]===_0x109c('0x7')&&_0x9e614c['variableName']&&_0x9e614c['key']){_0x26147a[_0x9e614c[_0x109c('0x8')]]&&_0x128d12[_0x109c('0x5')](util[_0x109c('0x10')](_0x109c('0x11'),_0x9e614c[_0x109c('0x12')],_0x26147a[_0x9e614c[_0x109c('0x8')]]));}else if(_0x9e614c[_0x109c('0xf')]===_0x109c('0xb')&&_0x9e614c[_0x109c('0xc')]&&_0x9e614c['Variable']['name']&&_0x9e614c['key']){_0x26147a[_0x9e614c[_0x109c('0xc')]['name'][_0x109c('0xe')]()]&&_0x128d12[_0x109c('0x5')](util[_0x109c('0x10')](_0x109c('0x11'),_0x9e614c['key'],_0x26147a[_0x9e614c[_0x109c('0xc')][_0x109c('0xd')][_0x109c('0xe')]()]));}}}}return _0x128d12[_0x109c('0x13')](_0x1d1630);};exports[_0x109c('0x14')]=function(_0x20e500){var _0x420be3=_0x20e500[_0x109c('0x15')](-0x1);if(_0x420be3==='/'){_0x20e500=_0x20e500[_0x109c('0x16')](0x0,_0x20e500[_0x109c('0x17')](_0x420be3));}return _0x20e500;};exports[_0x109c('0x18')]=function(_0x4e037f){if(!_[_0x109c('0x19')](_0x4e037f)&&_0x4e037f!==''){var _0x2cef25=/^(([^<>()\[\]\\.,;:\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 _0x2cef25[_0x109c('0x1a')](String(_0x4e037f)[_0x109c('0xe')]());}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 689da80..a52c268 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 _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','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','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x37fd9e,_0x10e26d){var _0x452c9b=function(_0x7a954b){while(--_0x7a954b){_0x37fd9e['push'](_0x37fd9e['shift']());}};_0x452c9b(++_0x10e26d);}(_0x9c44,0x178));var _0x49c4=function(_0x4b055c,_0x4b870b){_0x4b055c=_0x4b055c-0x0;var _0x4b62bb=_0x9c44[_0x4b055c];return _0x4b62bb;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file +var _0xd8b0=['info','Creating\x20new\x20ticket...','merge','Normal','Subjects','POST','format','%s/webservice.php','remoteUri','create','username','sessionName','HelpDesk','stringify','success','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','error','statusCode','[vTiger],\x20%s,\x20%s,\x20%s','validateEmail','Getting\x20agent\x20with\x20email','then','Agent\x20found!','resolve','email1','first_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','admin','catch','userId','getUser','Searching\x20end\x20user\x20with\x20phone','GET','query','Enduser\x20found!','firstname','Enduser\x20created.','lastname','phone','accessKey','getchallenge','login','token','getConnection','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','recordingURL','email','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Fields','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','outbound','recordingFormat','none','[OUTBOUND]','uniqueid','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','../../../../config/logger','vTiger','redis','localhost','socket.io-emitter','emit','length','forEach','includes','picklist','idField','content','toString','type','variable','variableName','customVariable','Variable','name','toLowerCase'];(function(_0x5ac0f0,_0xee4d98){var _0x4aceec=function(_0x3a9044){while(--_0x3a9044){_0x5ac0f0['push'](_0x5ac0f0['shift']());}};_0x4aceec(++_0xee4d98);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var rp=require(_0x0d8b('0x1'));var BPromise=require('bluebird');var md5=require('md5');var util=require('util');var Redis=require(_0x0d8b('0x2'));var intUtil=require(_0x0d8b('0x3'));var config=require(_0x0d8b('0x4'));var logger=require(_0x0d8b('0x5'))(_0x0d8b('0x6'));config['redis']=_['defaults'](config[_0x0d8b('0x7')],{'host':_0x0d8b('0x8'),'port':0x18eb});var io=require(_0x0d8b('0x9'))(new Redis(config['redis']));function emit(_0x413284,_0x284169,_0x58e4e2){io['to'](_0x413284)[_0x0d8b('0xa')](_0x284169,_0x58e4e2);}function getCustomFields(_0x348e65,_0x3b027f){var _0x1f4800={};if(_0x348e65[_0x0d8b('0xb')]>0x0){_[_0x0d8b('0xc')](_0x348e65,function(_0x2c5e9e){if(_[_0x0d8b('0xd')](['string',_0x0d8b('0xe')],_0x2c5e9e['type'])&&_0x2c5e9e[_0x0d8b('0xf')]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x2c5e9e[_0x0d8b('0x10')][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x13')&&_0x2c5e9e[_0x0d8b('0x14')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x14')]][_0x0d8b('0x11')]();}else if(_0x2c5e9e[_0x0d8b('0x12')]===_0x0d8b('0x15')&&_0x2c5e9e['Variable']&&_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]&&_0x2c5e9e[_0x0d8b('0xf')]&&_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')]['toLowerCase']()]){_0x1f4800[_0x2c5e9e[_0x0d8b('0xf')]]=_0x3b027f[_0x2c5e9e[_0x0d8b('0x16')][_0x0d8b('0x17')][_0x0d8b('0x18')]()][_0x0d8b('0x11')]();}});}return _0x1f4800;}function createTicket(_0x18dd2d,_0x264b39,_0xa3612a,_0x4a15bf,_0x27512e,_0x23d58f,_0x196c0a){logger[_0x0d8b('0x19')](_0x0d8b('0x1a'));var _0x5b709c=_[_0x0d8b('0x1b')]({'parent_id':'','assigned_user_id':_0x264b39['id'],'ticketpriorities':_0x0d8b('0x1c'),'ticketstatus':'Open','ticket_title':intUtil['getString'](_0x4a15bf[_0x0d8b('0x1d')],_0x27512e,'\x20'),'description':intUtil['getString'](_0x4a15bf['Descriptions'],_0x27512e,'\x0a'),'contact_id':_0xa3612a['id']},getCustomFields(_0x23d58f,_0x27512e));var _0x5527d8={'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x18dd2d[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'username':_0x18dd2d[_0x0d8b('0x23')],'sessionName':_0x196c0a[_0x0d8b('0x24')],'elementType':_0x0d8b('0x25'),'element':JSON[_0x0d8b('0x26')](_0x5b709c)},'json':!![]};return request(_0x5527d8)['then'](function(_0xe8bbee){if(_0xe8bbee[_0x0d8b('0x27')]){return BPromise['resolve']({'id':_0xe8bbee[_0x0d8b('0x28')]['id']});}else{throw new Error(util['format'](_0x0d8b('0x29'),JSON[_0x0d8b('0x26')](_0xe8bbee[_0x0d8b('0x2a')])));}})['catch'](function(_0x59a905){var _0x28f639=_0x59a905[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),'createTicket',_0x28f639,JSON[_0x0d8b('0x26')](_0x59a905));});}function getUser(_0x4b59e5,_0x97050a,_0x48f24f){if(intUtil[_0x0d8b('0x2d')](_0x97050a)){logger['info'](_0x0d8b('0x2e'),_0x97050a);return request({'method':'GET','uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x4b59e5[_0x0d8b('0x21')]),'qs':{'operation':'query','username':_0x4b59e5['username'],'sessionName':_0x48f24f['sessionName'],'query':util[_0x0d8b('0x1f')]('SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;',_0x97050a)},'json':!![]})[_0x0d8b('0x2f')](function(_0x54f6f3){if(_0x54f6f3['success']&&_0x54f6f3[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x30'));return BPromise[_0x0d8b('0x31')]({'id':_0x54f6f3[_0x0d8b('0x28')][0x0]['id'],'email':_0x54f6f3[_0x0d8b('0x28')][0x0][_0x0d8b('0x32')],'name':_0x54f6f3['result'][0x0][_0x0d8b('0x33')]+'\x20'+_0x54f6f3[_0x0d8b('0x28')]['last_name']});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f['userId'],'email':_0x4b59e5[_0x0d8b('0x23')],'name':_0x0d8b('0x35')});}})[_0x0d8b('0x36')](function(_0x31ceba){var _0x933e01=_0x31ceba['statusCode']||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),'getUser',_0x933e01,JSON[_0x0d8b('0x26')](_0x31ceba));});}else{logger[_0x0d8b('0x19')](_0x0d8b('0x34'));return BPromise[_0x0d8b('0x31')]({'id':_0x48f24f[_0x0d8b('0x37')],'email':_0x4b59e5['username'],'name':'admin'})[_0x0d8b('0x36')](function(_0x5c2c04){var _0x531c55=_0x5c2c04[_0x0d8b('0x2b')]||0x1f4;logger[_0x0d8b('0x2a')](_0x0d8b('0x2c'),_0x0d8b('0x38'),_0x531c55,JSON[_0x0d8b('0x26')](_0x5c2c04));});}}function getEndUser(_0x24c789,_0x579324,_0x6e5bab,_0x6a02ad){logger[_0x0d8b('0x19')](_0x0d8b('0x39'),_0x6e5bab);return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x24c789['remoteUri']),'qs':{'operation':_0x0d8b('0x3b'),'username':_0x24c789[_0x0d8b('0x23')],'sessionName':_0x6a02ad[_0x0d8b('0x24')],'query':util[_0x0d8b('0x1f')]('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;',_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab,_0x6e5bab)},'json':!![]})[_0x0d8b('0x2f')](function(_0x4b4bde){if(_0x4b4bde[_0x0d8b('0x27')]&&_0x4b4bde[_0x0d8b('0x28')][_0x0d8b('0xb')]){logger[_0x0d8b('0x19')](_0x0d8b('0x3c'));return BPromise[_0x0d8b('0x31')]({'id':_0x4b4bde[_0x0d8b('0x28')][0x0]['id'],'name':_0x4b4bde[_0x0d8b('0x28')][0x0][_0x0d8b('0x3d')]+'\x20'+_0x4b4bde[_0x0d8b('0x28')][0x0]['lastname'],'phone':_0x6e5bab});}else{logger['info']('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'method':'POST','uri':util['format'](_0x0d8b('0x20'),_0x24c789[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x22'),'sessionName':_0x6a02ad['sessionName'],'elementType':'Contacts','element':JSON[_0x0d8b('0x26')]({'lastname':_0x579324,'phone':_0x6e5bab,'assigned_user_id':'\x20'})},'json':!![]})[_0x0d8b('0x2f')](function(_0x344278){logger['info'](_0x0d8b('0x3e'));return BPromise[_0x0d8b('0x31')]({'id':_0x344278['result']['id'],'name':_0x344278['result'][_0x0d8b('0x3f')],'phone':_0x344278['result'][_0x0d8b('0x40')]});})['catch'](function(_0x53f643){var _0x30ccee=_0x53f643[_0x0d8b('0x2b')]||0x1f4;logger['error']('[vTiger],\x20%s,\x20%s,\x20%s','getEndUser',_0x30ccee,JSON['stringify'](_0x53f643));});}});}function getConnection(_0x374d40){var _0x1e0498=_0x374d40[_0x0d8b('0x23')];var _0x490eda=_0x374d40[_0x0d8b('0x41')];return request({'method':_0x0d8b('0x3a'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'qs':{'operation':_0x0d8b('0x42'),'username':_0x1e0498},'json':!![]})[_0x0d8b('0x2f')](function(_0x1d5067){if(_0x1d5067[_0x0d8b('0x27')]){return request({'method':_0x0d8b('0x1e'),'uri':util[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x374d40[_0x0d8b('0x21')]),'form':{'operation':_0x0d8b('0x43'),'username':_0x1e0498,'accessKey':md5(_0x1d5067[_0x0d8b('0x28')][_0x0d8b('0x44')]+_0x490eda)},'json':!![]});}})[_0x0d8b('0x2f')](function(_0x1e162c){if(_0x1e162c[_0x0d8b('0x27')]){return BPromise['resolve'](_0x1e162c[_0x0d8b('0x28')]);}else{throw new Error(util['format']('Account\x20%d\x20is\x20not\x20valid',_0x374d40['id']));}})[_0x0d8b('0x36')](function(_0x113fb7){var _0x3f943a=_0x113fb7[_0x0d8b('0x2b')]||0x1f4;logger['error'](_0x0d8b('0x2c'),_0x0d8b('0x45'),_0x3f943a,JSON[_0x0d8b('0x26')](_0x113fb7));});}function request(_0x241587){logger[_0x0d8b('0x19')]('[HTTP]',JSON['stringify'](_0x241587));return rp(_0x241587);}exports['queue']=function(_0x573f4f,_0x368ede,_0xf22c3c,_0x5e3bb4,_0x4950a8,_0x44c5c1){var _0x3d3cb6,_0x5c5bd7,_0x5ef6c3,_0x900906;_0x44c5c1[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x44c5c1[_0x0d8b('0x21')]);if(_0x4950a8&&_0x4950a8[_0x0d8b('0x47')]){logger['info'](_0x0d8b('0x48'),_0x0d8b('0x49'));_0x368ede['recordingURL']=util['format'](_0x0d8b('0x4a'),_0x44c5c1[_0x0d8b('0x4b')],_0x368ede['uniqueid'],md5(_0x368ede['uniqueid']));}else{_0x368ede[_0x0d8b('0x4c')]='';}return getConnection(_0x44c5c1)[_0x0d8b('0x2f')](function(_0x377027){_0x900906=_0x377027;return getUser(_0x44c5c1,_0x5e3bb4[_0x0d8b('0x4d')],_0x900906);})['then'](function(_0x356b3d){_0x3d3cb6=_0x356b3d;logger['info']('The\x20User\x20ID\x20is:',_0x3d3cb6['id']);return getEndUser(_0x44c5c1,_0x368ede[_0x0d8b('0x4e')],_0x368ede[_0x0d8b('0x4f')],_0x900906);})['then'](function(_0x4a8f33){_0x5c5bd7=_0x4a8f33;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x5c5bd7['id']);return createTicket(_0x44c5c1,_0x3d3cb6,_0x5c5bd7,_0xf22c3c,_0x368ede,_0xf22c3c[_0x0d8b('0x51')],_0x900906);})[_0x0d8b('0x2f')](function(_0x3afc3a){_0x5ef6c3=_0x3afc3a;logger[_0x0d8b('0x19')](_0x0d8b('0x52'));logger[_0x0d8b('0x19')]('The\x20Ticket\x20ID\x20is:',_0x5ef6c3['id']);var _0x24a859=util[_0x0d8b('0x1f')](_0x0d8b('0x53'),_0x44c5c1[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5ef6c3['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x48'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')]('user:%s',_0x5e3bb4[_0x0d8b('0x17')]),_0x0d8b('0x56'),{'uri':_0x24a859});})[_0x0d8b('0x36')](function(_0x23de9e){logger[_0x0d8b('0x2a')]('[QUEUE]',JSON[_0x0d8b('0x26')](_0x23de9e));});};exports[_0x0d8b('0x57')]=function(_0x181d49,_0x17a87f,_0x1d6cd4,_0x59ada2,_0x4d0e7c,_0x3b1166,_0x291b83){var _0x3e4a41,_0xbbb520,_0x5a70bd,_0x199122;_0x3b1166[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x3b1166['remoteUri']);_0x3b1166[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x3b1166[_0x0d8b('0x4b')]);if(_0x291b83&&_0x291b83[_0x0d8b('0x58')]&&_0x291b83[_0x0d8b('0x58')]!==_0x0d8b('0x59')){logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),'Recording\x20is\x20enabled!');_0x17a87f[_0x0d8b('0x4c')]=util['format'](_0x0d8b('0x4a'),_0x3b1166[_0x0d8b('0x4b')],_0x17a87f[_0x0d8b('0x5b')],md5(_0x17a87f[_0x0d8b('0x5b')]));}return getConnection(_0x3b1166)['then'](function(_0x19e097){_0x199122=_0x19e097;return getUser(_0x3b1166,_0x59ada2[_0x0d8b('0x4d')],_0x199122);})[_0x0d8b('0x2f')](function(_0x2332fc){_0x3e4a41=_0x2332fc;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0x3e4a41['id']);return getEndUser(_0x3b1166,_0x17a87f[_0x0d8b('0x5d')],_0x17a87f[_0x0d8b('0x5e')],_0x199122);})[_0x0d8b('0x2f')](function(_0x34affb){_0xbbb520=_0x34affb;logger['info']('The\x20Enduser\x20ID\x20is:',_0xbbb520['id']);return createTicket(_0x3b1166,_0x3e4a41,_0xbbb520,_0x1d6cd4,_0x17a87f,_0x1d6cd4[_0x0d8b('0x51')],_0x199122);})[_0x0d8b('0x2f')](function(_0x53e399){_0x5a70bd=_0x53e399;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger['info'](_0x0d8b('0x5f'),_0x5a70bd['id']);var _0x1c4e96=util['format']('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x3b1166[_0x0d8b('0x21')],_[_0x0d8b('0x54')](_0x5a70bd['id'],'x')[0x1]);logger[_0x0d8b('0x19')](_0x0d8b('0x5a'),_0x0d8b('0x55'));emit(util[_0x0d8b('0x1f')](_0x0d8b('0x60'),_0x59ada2['name']),_0x0d8b('0x56'),{'uri':_0x1c4e96});})['catch'](function(_0x1a203e){logger[_0x0d8b('0x2a')](_0x0d8b('0x5a'),JSON[_0x0d8b('0x26')](_0x1a203e));});};exports['unmanaged']=function(_0x3fe47d,_0x4a1c4a,_0x3a356b,_0x2c6c5f,_0x1c5fe2,_0x2ebea3){var _0xc5c35f,_0x2b44e5,_0x3e927c,_0x91aa89;_0x2ebea3[_0x0d8b('0x21')]=intUtil[_0x0d8b('0x46')](_0x2ebea3['remoteUri']);_0x2ebea3[_0x0d8b('0x4b')]=intUtil['stripTrailingSlash'](_0x2ebea3[_0x0d8b('0x4b')]);if(_0x1c5fe2&&_0x1c5fe2[_0x0d8b('0x47')]){logger['info']('['+_0x4a1c4a[_0x0d8b('0x61')]['toUpperCase']()+']',_0x0d8b('0x49'));_0x4a1c4a[_0x0d8b('0x4c')]=util[_0x0d8b('0x1f')](_0x0d8b('0x4a'),_0x2ebea3[_0x0d8b('0x4b')],_0x4a1c4a[_0x0d8b('0x5b')],md5(_0x4a1c4a[_0x0d8b('0x5b')]));}else{_0x4a1c4a[_0x0d8b('0x4c')]='';}return getConnection(_0x2ebea3)['then'](function(_0x10eca6){_0x91aa89=_0x10eca6;return getUser(_0x2ebea3,'',_0x91aa89);})[_0x0d8b('0x2f')](function(_0x5b2916){_0xc5c35f=_0x5b2916;logger[_0x0d8b('0x19')](_0x0d8b('0x5c'),_0xc5c35f['id']);return getEndUser(_0x2ebea3,_0x4a1c4a[_0x0d8b('0x4e')],_0x4a1c4a[_0x0d8b('0x4f')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0x9e44b4){_0x2b44e5=_0x9e44b4;logger[_0x0d8b('0x19')](_0x0d8b('0x50'),_0x2b44e5['id']);return createTicket(_0x2ebea3,_0xc5c35f,_0x2b44e5,_0x3a356b,_0x4a1c4a,_0x3a356b[_0x0d8b('0x51')],_0x91aa89);})[_0x0d8b('0x2f')](function(_0xe35028){_0x3e927c=_0xe35028;logger[_0x0d8b('0x19')]('Ticket\x20created!');logger[_0x0d8b('0x19')](_0x0d8b('0x5f'),_0x3e927c['id']);})[_0x0d8b('0x36')](function(_0x58525c){logger['error']('['+_0x4a1c4a[_0x0d8b('0x61')][_0x0d8b('0x62')]()+']',JSON[_0x0d8b('0x26')](_0x58525c));});}; \ 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 a236698..0e00899 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 _0x7275=['Caller\x20-\x20%s','authType','%s:%s','username','password','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','idField','custom_fields','content','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','Authorization','The\x20User\x20ID\x20is:','calleridnum','The\x20Enduser\x20ID\x20is:','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...','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','inspect','outbound','recordingFormat','none','[OUTBOUND]','email','destcalleridname','destcalleridnum','%s/channels/voice/agents/%d/tickets/%d/display.json','/api/v2','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','POST','merge','name','getString','Subjects','Descriptions','Fields','then','Ticket\x20created!','ticket','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','format','type:user\x20role:agent\x20email:%s','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','length','end-user','first','Enduser\x20found!','%s/users.json'];(function(_0x139c86,_0x17f962){var _0x16ceeb=function(_0x335b9f){while(--_0x335b9f){_0x139c86['push'](_0x139c86['shift']());}};_0x16ceeb(++_0x17f962);}(_0x7275,0xb8));var _0x5727=function(_0x1363ce,_0x23d11e){_0x1363ce=_0x1363ce-0x0;var _0x4d15c4=_0x7275[_0x1363ce];return _0x4d15c4;};'use strict';var _=require(_0x5727('0x0'));var rp=require('request-promise');var md5=require(_0x5727('0x1'));var util=require(_0x5727('0x2'));var Redis=require(_0x5727('0x3'));var intUtil=require(_0x5727('0x4'));var config=require(_0x5727('0x5'));var logger=require(_0x5727('0x6'))(_0x5727('0x7'));config[_0x5727('0x8')]=_[_0x5727('0x9')](config['redis'],{'host':_0x5727('0xa'),'port':0x18eb});var io=require(_0x5727('0xb'))(new Redis(config[_0x5727('0x8')]));function emit(_0x394865,_0x27835d,_0x5bdbda){io['to'](_0x394865)[_0x5727('0xc')](_0x27835d,_0x5bdbda);}var headers={'Content-Type':_0x5727('0xd'),'Accept':_0x5727('0xd')};function getTicket(_0x24dfeb,_0x32ee3f,_0x6ea838,_0x49bebb,_0x2fae81){logger[_0x5727('0xe')](_0x5727('0xf'));return request({'uri':util['format'](_0x5727('0x10'),_0x24dfeb[_0x5727('0x11')]),'method':_0x5727('0x12'),'body':{'ticket':_[_0x5727('0x13')]({'requester_id':_0x6ea838['id'],'submitter_id':_0x32ee3f?_0x32ee3f['id']:undefined,'assignee_id':_0x32ee3f?_0x32ee3f['id']:undefined,'tags':getTags(_0x49bebb['Tags'],_0x5727('0x14')),'subject':intUtil[_0x5727('0x15')](_0x49bebb[_0x5727('0x16')],_0x2fae81,'\x20'),'description':intUtil[_0x5727('0x15')](_0x49bebb[_0x5727('0x17')],_0x2fae81,'\x0a'),'comment':{'public':![],'body':intUtil[_0x5727('0x15')](_0x49bebb[_0x5727('0x17')],_0x2fae81,'\x0a')}},getCustomFields(_0x49bebb[_0x5727('0x18')],_0x2fae81))}})[_0x5727('0x19')](function(_0x14a33e){logger['info'](_0x5727('0x1a'));return _0x14a33e[_0x5727('0x1b')];});}function getUser(_0x578368,_0x5789a5){if(intUtil[_0x5727('0x1c')](_0x5789a5)){logger[_0x5727('0xe')](_0x5727('0x1d'),_0x5789a5);return request({'uri':util['format'](_0x5727('0x1e'),_0x578368['remoteUri']),'qs':{'query':util[_0x5727('0x1f')](_0x5727('0x20'),_0x5789a5)}})[_0x5727('0x19')](function(_0x20421e){if(_0x20421e['count']){logger[_0x5727('0xe')](_0x5727('0x21'));return _[_0x5727('0x22')](_0x20421e[_0x5727('0x23')],{'email':_0x5789a5,'role':_0x5727('0x24')});}else{logger[_0x5727('0xe')](_0x5727('0x25'));return request({'uri':util[_0x5727('0x1f')](_0x5727('0x26'),_0x578368[_0x5727('0x11')])})[_0x5727('0x19')](function(_0x4ccdd6){logger[_0x5727('0xe')](_0x5727('0x27'));return _0x4ccdd6[_0x5727('0x28')];});}});}else{logger[_0x5727('0xe')](_0x5727('0x25'));return request({'uri':util['format'](_0x5727('0x26'),_0x578368['remoteUri'])})[_0x5727('0x19')](function(_0x2ac337){logger['info'](_0x5727('0x27'));return _0x2ac337['user'];});}}function getEndUser(_0x923872,_0x1f626,_0x1dbf0b){logger[_0x5727('0xe')](_0x5727('0x29'),_0x1dbf0b);return request({'uri':util[_0x5727('0x1f')]('%s/search.json',_0x923872['remoteUri']),'qs':{'query':util[_0x5727('0x1f')](_0x5727('0x2a'),_0x1dbf0b)}})[_0x5727('0x19')](function(_0x4de864){var _0x3cd491;if(_0x4de864[_0x5727('0x23')][_0x5727('0x2b')]){_0x4de864['results']=_['filter'](_0x4de864[_0x5727('0x23')],{'suspended':![],'role':_0x5727('0x2c')});if(_0x4de864['results']['length']){_0x3cd491=_[_0x5727('0x2d')](_0x4de864[_0x5727('0x23')]);}}if(_0x3cd491){logger[_0x5727('0xe')](_0x5727('0x2e'));return _0x3cd491;}else{logger[_0x5727('0xe')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util['format'](_0x5727('0x2f'),_0x923872[_0x5727('0x11')]),'method':_0x5727('0x12'),'body':{'user':{'role':_0x5727('0x2c'),'name':util[_0x5727('0x1f')](_0x5727('0x30'),_0x1f626||_0x1dbf0b),'phone':_0x1dbf0b}}})[_0x5727('0x19')](function(_0x388ff1){logger[_0x5727('0xe')]('Enduser\x20created.');return _0x388ff1[_0x5727('0x28')];});}});}function getAuth(_0x56b52c){var _0x3aad7c;if(_0x56b52c[_0x5727('0x31')]==='password'){_0x3aad7c=util[_0x5727('0x1f')](_0x5727('0x32'),_0x56b52c[_0x5727('0x33')],_0x56b52c[_0x5727('0x34')]);}else if(_0x56b52c['authType']===_0x5727('0x35')){_0x3aad7c=util[_0x5727('0x1f')](_0x5727('0x36'),_0x56b52c[_0x5727('0x33')],_0x56b52c['token']);}return util[_0x5727('0x1f')](_0x5727('0x37'),new Buffer(_0x3aad7c)[_0x5727('0x38')](_0x5727('0x39')));}function request(_0x228588){logger[_0x5727('0x3a')](_0x5727('0x3b'),JSON[_0x5727('0x3c')](_0x228588));return rp(_[_0x5727('0x9')](_0x228588,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x56252d,_0xa8a20c){var _0x14c563=[];if(_0x56252d&&_0x56252d[_0x5727('0x2b')]>0x0){_0x14c563=_[_0x5727('0x3d')](_0x56252d,_0xa8a20c);}return _0x14c563;}function getCustomFields(_0x220184,_0x5c898d){var _0x2cc234=[];var _0x39cb36={'custom_fields':[]};if(_0x220184[_0x5727('0x2b')]>0x0){_[_0x5727('0x3e')](_0x220184,function(_0x5be66e){if(_[_0x5727('0x3f')]([_0x5727('0x40'),_0x5727('0x41')],_0x5be66e[_0x5727('0x42')])&&_0x5be66e[_0x5727('0x43')]&&!_0x5be66e[_0x5727('0x44')]){_0x39cb36[_0x5be66e[_0x5727('0x43')][_0x5727('0x45')]()]=_0x5be66e['content']['toString']();}else if(_[_0x5727('0x3f')](['string',_0x5727('0x41')],_0x5be66e[_0x5727('0x42')])&&_0x5be66e[_0x5727('0x46')]&&_0x5be66e['customField']){_0x39cb36[_0x5727('0x47')]['push']({'id':_0x5be66e[_0x5727('0x46')],'value':_0x5be66e[_0x5727('0x48')][_0x5727('0x38')]()});}else if(_0x5be66e[_0x5727('0x42')]===_0x5727('0x49')&&_0x5be66e['variableName']&&_0x5be66e[_0x5727('0x46')]&&_0x5be66e[_0x5727('0x44')]){_0x5c898d[_0x5be66e[_0x5727('0x4a')]]&&_0x39cb36[_0x5727('0x47')][_0x5727('0x4b')]({'id':_0x5be66e[_0x5727('0x46')],'value':_0x5c898d[_0x5be66e[_0x5727('0x4a')]][_0x5727('0x38')]()});}else if(_0x5be66e['type']===_0x5727('0x4c')&&_0x5be66e[_0x5727('0x4d')]&&_0x5be66e['Variable'][_0x5727('0x14')]&&_0x5be66e[_0x5727('0x46')]&&_0x5be66e[_0x5727('0x44')]){_0x5c898d[_0x5be66e[_0x5727('0x4d')][_0x5727('0x14')][_0x5727('0x45')]()]&&_0x39cb36[_0x5727('0x47')][_0x5727('0x4b')]({'id':_0x5be66e[_0x5727('0x46')],'value':_0x5c898d[_0x5be66e[_0x5727('0x4d')]['name'][_0x5727('0x45')]()][_0x5727('0x38')]()});}});}return _0x39cb36;}exports[_0x5727('0x4e')]=function(_0x1a07b5,_0x186626,_0x106594,_0x2aea4a,_0x251fba,_0x38bebb){var _0x4cf3e6,_0x212fe1;_0x38bebb['remoteUri']=intUtil[_0x5727('0x4f')](_0x38bebb[_0x5727('0x11')]);_0x38bebb[_0x5727('0x50')]=intUtil[_0x5727('0x4f')](_0x38bebb['serverUrl']);if(_0x251fba&&_0x251fba['monitor_format']){logger[_0x5727('0xe')](_0x5727('0x51'),_0x5727('0x52'));_0x186626['recordingURL']=util[_0x5727('0x1f')](_0x5727('0x53'),_0x38bebb[_0x5727('0x50')],_0x186626[_0x5727('0x54')],md5(_0x186626['uniqueid']));}else{_0x186626[_0x5727('0x55')]='';}headers[_0x5727('0x56')]=getAuth(_0x38bebb);return getUser(_0x38bebb,_0x2aea4a['email'])['then'](function(_0x9d7515){_0x4cf3e6=_0x9d7515;logger[_0x5727('0xe')](_0x5727('0x57'),_0x4cf3e6['id']);return getEndUser(_0x38bebb,_0x186626['calleridname'],_0x186626[_0x5727('0x58')]);})['then'](function(_0x58fef2){_0x212fe1=_0x58fef2;logger[_0x5727('0xe')](_0x5727('0x59'),_0x212fe1['id']);return getTicket(_0x38bebb,_0x4cf3e6,_0x212fe1,_0x106594,_0x186626);})[_0x5727('0x19')](function(_0x259eeb){if(_0x259eeb){logger['info'](_0x5727('0x5a'),_0x259eeb['id']);switch(_0x38bebb[_0x5727('0x42')]){case _0x5727('0x5b'):logger[_0x5727('0xe')]('[QUEUE]',_0x5727('0x5c'));return request({'uri':util[_0x5727('0x1f')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x38bebb[_0x5727('0x11')],_0x4cf3e6['id'],_0x259eeb['id']),'method':_0x5727('0x12')});case'newTab':logger[_0x5727('0xe')](_0x5727('0x51'),_0x5727('0x5d'));emit(util['format'](_0x5727('0x5e'),_0x2aea4a[_0x5727('0x14')]),_0x5727('0x5f'),{'uri':util[_0x5727('0x1f')](_0x5727('0x60'),_0x38bebb['remoteUri'][_0x5727('0x61')]('/api/v2',''),_0x259eeb['id'])});break;default:logger[_0x5727('0x62')]('[QUEUE]',_0x5727('0x63'));}}})[_0x5727('0x64')](function(_0x4839b9){logger[_0x5727('0x62')](_0x5727('0x65'),util[_0x5727('0x66')](_0x4839b9,{'showHidden':!![],'depth':null}));});};exports[_0x5727('0x67')]=function(_0x525864,_0xad6f8,_0x5ad7b7,_0x313fa6,_0x87b9f3,_0x177f50,_0x3acee7){var _0x73d1da,_0x3c3b1c;_0x177f50[_0x5727('0x11')]=intUtil[_0x5727('0x4f')](_0x177f50[_0x5727('0x11')]);_0x177f50[_0x5727('0x50')]=intUtil[_0x5727('0x4f')](_0x177f50[_0x5727('0x50')]);if(_0x3acee7&&_0x3acee7[_0x5727('0x68')]&&_0x3acee7[_0x5727('0x68')]!==_0x5727('0x69')){logger[_0x5727('0xe')](_0x5727('0x6a'),'Recording\x20is\x20enabled!');_0xad6f8['recordingURL']=util[_0x5727('0x1f')](_0x5727('0x53'),_0x177f50[_0x5727('0x50')],_0xad6f8[_0x5727('0x54')],md5(_0xad6f8[_0x5727('0x54')]));}headers[_0x5727('0x56')]=getAuth(_0x177f50);return getUser(_0x177f50,_0x313fa6[_0x5727('0x6b')])[_0x5727('0x19')](function(_0x422704){_0x73d1da=_0x422704;logger['info'](_0x5727('0x57'),_0x73d1da['id']);return getEndUser(_0x177f50,_0xad6f8[_0x5727('0x6c')],_0xad6f8[_0x5727('0x6d')]);})[_0x5727('0x19')](function(_0x156818){_0x3c3b1c=_0x156818;logger[_0x5727('0xe')](_0x5727('0x59'),_0x3c3b1c['id']);return getTicket(_0x177f50,_0x73d1da,_0x3c3b1c,_0x5ad7b7,_0xad6f8);})[_0x5727('0x19')](function(_0x5801d1){if(_0x5801d1){logger[_0x5727('0xe')](_0x5727('0x5a'),_0x5801d1['id']);switch(_0x177f50['type']){case _0x5727('0x5b'):logger['info']('[OUTBOUND]',_0x5727('0x5c'));return request({'uri':util['format'](_0x5727('0x6e'),_0x177f50['remoteUri'],_0x73d1da['id'],_0x5801d1['id']),'method':_0x5727('0x12')});case'newTab':logger[_0x5727('0xe')](_0x5727('0x6a'),_0x5727('0x5d'));emit(util[_0x5727('0x1f')](_0x5727('0x5e'),_0x313fa6['name']),_0x5727('0x5f'),{'uri':util[_0x5727('0x1f')](_0x5727('0x60'),_0x177f50[_0x5727('0x11')][_0x5727('0x61')](_0x5727('0x6f'),''),_0x5801d1['id'])});break;default:logger[_0x5727('0x62')](_0x5727('0x6a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x5727('0x64')](function(_0x2da951){logger[_0x5727('0x62')](_0x5727('0x70'),util['inspect'](_0x2da951,{'showHidden':!![],'depth':null}));});};exports['unmanaged']=function(_0xc1e3a2,_0x13e6c6,_0x315415,_0x4d184d,_0x5ea2d8,_0x35c43f){var _0x25fdb3,_0x34c89e;_0x35c43f['remoteUri']=intUtil[_0x5727('0x4f')](_0x35c43f[_0x5727('0x11')]);_0x35c43f[_0x5727('0x50')]=intUtil['stripTrailingSlash'](_0x35c43f[_0x5727('0x50')]);if(_0x5ea2d8&&_0x5ea2d8['monitor_format']){logger[_0x5727('0xe')]('['+_0x13e6c6[_0x5727('0x71')]['toUpperCase']()+']',_0x5727('0x52'));_0x13e6c6[_0x5727('0x55')]=util[_0x5727('0x1f')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35c43f[_0x5727('0x50')],_0x13e6c6[_0x5727('0x54')],md5(_0x13e6c6[_0x5727('0x54')]));}else{_0x13e6c6[_0x5727('0x55')]='';}headers[_0x5727('0x56')]=getAuth(_0x35c43f);return getUser(_0x35c43f)[_0x5727('0x19')](function(_0x2ca451){_0x25fdb3=_0x2ca451;logger['info'](_0x5727('0x57'),_0x25fdb3['id']);return getEndUser(_0x35c43f,_0x13e6c6['calleridname'],_0x13e6c6[_0x5727('0x58')]);})[_0x5727('0x19')](function(_0x475ce1){_0x34c89e=_0x475ce1;logger['info'](_0x5727('0x59'),_0x34c89e['id']);return getTicket(_0x35c43f,_0x25fdb3,_0x34c89e,_0x315415,_0x13e6c6);})[_0x5727('0x19')](function(_0x50720d){if(_0x50720d){logger[_0x5727('0xe')](_0x5727('0x5a'),_0x50720d['id']);}})[_0x5727('0x64')](function(_0x11cda6){logger[_0x5727('0x62')]('['+_0x13e6c6[_0x5727('0x71')][_0x5727('0x72')]()+']'+_0x5727('0x73'),util[_0x5727('0x66')](_0x11cda6,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x745a=['%s/users.json','Enduser\x20created.','authType','password','%s:%s','token','%s/token:%s','username','base64','[HTTP]','stringify','length','map','includes','string','picklist','type','nameField','toLowerCase','idField','customField','push','content','toString','variable','custom_fields','variableName','customVariable','Variable','name','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\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','/api/v2','Zendesk\x20account\x20type\x20not\x20recognized','catch','error','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','The\x20Ticket\x20ID\x20is:','lastevent','\x20Error\x20running\x20Zendesk\x20integration','lodash','request-promise','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','zendesk','redis','localhost','emit','application/json','info','format','POST','merge','getString','Subjects','Descriptions','then','Ticket\x20created!','validateEmail','Getting\x20agent\x20with\x20email','%s/search.json','remoteUri','type:user\x20role:agent\x20email:%s','Agent\x20found!','find','results','agent','%s/users/me.json','Admin\x20account\x20selected.','user','Searching\x20enduser\x20with\x20phone','type:user\x20role:end-user\x20phone:%s','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!'];(function(_0x37c38d,_0x478f79){var _0x28a3cf=function(_0x14357b){while(--_0x14357b){_0x37c38d['push'](_0x37c38d['shift']());}};_0x28a3cf(++_0x478f79);}(_0x745a,0xb4));var _0xa745=function(_0x5f309e,_0x66e31){_0x5f309e=_0x5f309e-0x0;var _0x487b5e=_0x745a[_0x5f309e];return _0x487b5e;};'use strict';var _=require(_0xa745('0x0'));var rp=require(_0xa745('0x1'));var md5=require(_0xa745('0x2'));var util=require(_0xa745('0x3'));var Redis=require(_0xa745('0x4'));var intUtil=require(_0xa745('0x5'));var config=require(_0xa745('0x6'));var logger=require(_0xa745('0x7'))(_0xa745('0x8'));config[_0xa745('0x9')]=_['defaults'](config[_0xa745('0x9')],{'host':_0xa745('0xa'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa745('0x9')]));function emit(_0x57e11b,_0x377d3c,_0x33f9ef){io['to'](_0x57e11b)[_0xa745('0xb')](_0x377d3c,_0x33f9ef);}var headers={'Content-Type':_0xa745('0xc'),'Accept':_0xa745('0xc')};function getTicket(_0x30c6f9,_0xcfa71b,_0x308aa0,_0x17b8ac,_0x1230d6){logger[_0xa745('0xd')]('Creating\x20new\x20ticket...');return request({'uri':util[_0xa745('0xe')]('%s/tickets.json',_0x30c6f9['remoteUri']),'method':_0xa745('0xf'),'body':{'ticket':_[_0xa745('0x10')]({'requester_id':_0x308aa0['id'],'submitter_id':_0xcfa71b?_0xcfa71b['id']:undefined,'assignee_id':_0xcfa71b?_0xcfa71b['id']:undefined,'tags':getTags(_0x17b8ac['Tags'],'name'),'subject':intUtil[_0xa745('0x11')](_0x17b8ac[_0xa745('0x12')],_0x1230d6,'\x20'),'description':intUtil[_0xa745('0x11')](_0x17b8ac[_0xa745('0x13')],_0x1230d6,'\x0a'),'comment':{'public':![],'body':intUtil['getString'](_0x17b8ac[_0xa745('0x13')],_0x1230d6,'\x0a')}},getCustomFields(_0x17b8ac['Fields'],_0x1230d6))}})[_0xa745('0x14')](function(_0x2d4b0b){logger[_0xa745('0xd')](_0xa745('0x15'));return _0x2d4b0b['ticket'];});}function getUser(_0x844278,_0x17257d){if(intUtil[_0xa745('0x16')](_0x17257d)){logger[_0xa745('0xd')](_0xa745('0x17'),_0x17257d);return request({'uri':util[_0xa745('0xe')](_0xa745('0x18'),_0x844278[_0xa745('0x19')]),'qs':{'query':util['format'](_0xa745('0x1a'),_0x17257d)}})[_0xa745('0x14')](function(_0x3d838f){if(_0x3d838f['count']){logger[_0xa745('0xd')](_0xa745('0x1b'));return _[_0xa745('0x1c')](_0x3d838f[_0xa745('0x1d')],{'email':_0x17257d,'role':_0xa745('0x1e')});}else{logger[_0xa745('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa745('0xe')](_0xa745('0x1f'),_0x844278[_0xa745('0x19')])})[_0xa745('0x14')](function(_0x2f3426){logger[_0xa745('0xd')](_0xa745('0x20'));return _0x2f3426[_0xa745('0x21')];});}});}else{logger[_0xa745('0xd')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xa745('0xe')](_0xa745('0x1f'),_0x844278[_0xa745('0x19')])})[_0xa745('0x14')](function(_0xdfb558){logger[_0xa745('0xd')](_0xa745('0x20'));return _0xdfb558['user'];});}}function getEndUser(_0x4277a2,_0x408c66,_0x57abb2){logger[_0xa745('0xd')](_0xa745('0x22'),_0x57abb2);return request({'uri':util[_0xa745('0xe')](_0xa745('0x18'),_0x4277a2[_0xa745('0x19')]),'qs':{'query':util[_0xa745('0xe')](_0xa745('0x23'),_0x57abb2)}})['then'](function(_0x2c890f){var _0x5482a8;if(_0x2c890f['results']['length']){_0x2c890f[_0xa745('0x1d')]=_['filter'](_0x2c890f['results'],{'suspended':![],'role':_0xa745('0x24')});if(_0x2c890f[_0xa745('0x1d')]['length']){_0x5482a8=_[_0xa745('0x25')](_0x2c890f[_0xa745('0x1d')]);}}if(_0x5482a8){logger[_0xa745('0xd')](_0xa745('0x26'));return _0x5482a8;}else{logger['info'](_0xa745('0x27'));return request({'uri':util[_0xa745('0xe')](_0xa745('0x28'),_0x4277a2[_0xa745('0x19')]),'method':'POST','body':{'user':{'role':_0xa745('0x24'),'name':util[_0xa745('0xe')]('Caller\x20-\x20%s',_0x408c66||_0x57abb2),'phone':_0x57abb2}}})[_0xa745('0x14')](function(_0x341ef3){logger[_0xa745('0xd')](_0xa745('0x29'));return _0x341ef3[_0xa745('0x21')];});}});}function getAuth(_0x2b6343){var _0x5624d6;if(_0x2b6343[_0xa745('0x2a')]===_0xa745('0x2b')){_0x5624d6=util[_0xa745('0xe')](_0xa745('0x2c'),_0x2b6343['username'],_0x2b6343[_0xa745('0x2b')]);}else if(_0x2b6343[_0xa745('0x2a')]===_0xa745('0x2d')){_0x5624d6=util[_0xa745('0xe')](_0xa745('0x2e'),_0x2b6343[_0xa745('0x2f')],_0x2b6343['token']);}return util['format']('Basic\x20%s',new Buffer(_0x5624d6)['toString'](_0xa745('0x30')));}function request(_0x2746bd){logger['debug'](_0xa745('0x31'),JSON[_0xa745('0x32')](_0x2746bd));return rp(_['defaults'](_0x2746bd,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0xcfdda0,_0x44f1f8){var _0x1137ae=[];if(_0xcfdda0&&_0xcfdda0[_0xa745('0x33')]>0x0){_0x1137ae=_[_0xa745('0x34')](_0xcfdda0,_0x44f1f8);}return _0x1137ae;}function getCustomFields(_0x4bc3d1,_0x1e3b2d){var _0x4ed526=[];var _0x456e66={'custom_fields':[]};if(_0x4bc3d1['length']>0x0){_['forEach'](_0x4bc3d1,function(_0x2b0f28){if(_[_0xa745('0x35')]([_0xa745('0x36'),_0xa745('0x37')],_0x2b0f28[_0xa745('0x38')])&&_0x2b0f28[_0xa745('0x39')]&&!_0x2b0f28['customField']){_0x456e66[_0x2b0f28[_0xa745('0x39')][_0xa745('0x3a')]()]=_0x2b0f28['content']['toString']();}else if(_[_0xa745('0x35')]([_0xa745('0x36'),_0xa745('0x37')],_0x2b0f28[_0xa745('0x38')])&&_0x2b0f28[_0xa745('0x3b')]&&_0x2b0f28[_0xa745('0x3c')]){_0x456e66['custom_fields'][_0xa745('0x3d')]({'id':_0x2b0f28[_0xa745('0x3b')],'value':_0x2b0f28[_0xa745('0x3e')][_0xa745('0x3f')]()});}else if(_0x2b0f28[_0xa745('0x38')]===_0xa745('0x40')&&_0x2b0f28['variableName']&&_0x2b0f28[_0xa745('0x3b')]&&_0x2b0f28[_0xa745('0x3c')]){_0x1e3b2d[_0x2b0f28['variableName']]&&_0x456e66[_0xa745('0x41')][_0xa745('0x3d')]({'id':_0x2b0f28[_0xa745('0x3b')],'value':_0x1e3b2d[_0x2b0f28[_0xa745('0x42')]][_0xa745('0x3f')]()});}else if(_0x2b0f28[_0xa745('0x38')]===_0xa745('0x43')&&_0x2b0f28[_0xa745('0x44')]&&_0x2b0f28['Variable'][_0xa745('0x45')]&&_0x2b0f28['idField']&&_0x2b0f28[_0xa745('0x3c')]){_0x1e3b2d[_0x2b0f28[_0xa745('0x44')][_0xa745('0x45')][_0xa745('0x3a')]()]&&_0x456e66[_0xa745('0x41')][_0xa745('0x3d')]({'id':_0x2b0f28['idField'],'value':_0x1e3b2d[_0x2b0f28[_0xa745('0x44')][_0xa745('0x45')][_0xa745('0x3a')]()][_0xa745('0x3f')]()});}});}return _0x456e66;}exports[_0xa745('0x46')]=function(_0x41024b,_0x3baaa9,_0x58fe5,_0x49e83e,_0x354f12,_0xfe833b){var _0xb2f88f,_0x3b883c;_0xfe833b[_0xa745('0x19')]=intUtil[_0xa745('0x47')](_0xfe833b['remoteUri']);_0xfe833b[_0xa745('0x48')]=intUtil['stripTrailingSlash'](_0xfe833b[_0xa745('0x48')]);if(_0x354f12&&_0x354f12[_0xa745('0x49')]){logger[_0xa745('0xd')](_0xa745('0x4a'),_0xa745('0x4b'));_0x3baaa9[_0xa745('0x4c')]=util[_0xa745('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0xfe833b[_0xa745('0x48')],_0x3baaa9[_0xa745('0x4d')],md5(_0x3baaa9['uniqueid']));}else{_0x3baaa9[_0xa745('0x4c')]='';}headers[_0xa745('0x4e')]=getAuth(_0xfe833b);return getUser(_0xfe833b,_0x49e83e[_0xa745('0x4f')])[_0xa745('0x14')](function(_0xfa94b7){_0xb2f88f=_0xfa94b7;logger[_0xa745('0xd')](_0xa745('0x50'),_0xb2f88f['id']);return getEndUser(_0xfe833b,_0x3baaa9[_0xa745('0x51')],_0x3baaa9[_0xa745('0x52')]);})[_0xa745('0x14')](function(_0xf5601c){_0x3b883c=_0xf5601c;logger[_0xa745('0xd')](_0xa745('0x53'),_0x3b883c['id']);return getTicket(_0xfe833b,_0xb2f88f,_0x3b883c,_0x58fe5,_0x3baaa9);})[_0xa745('0x14')](function(_0x21f1ce){if(_0x21f1ce){logger['info']('The\x20Ticket\x20ID\x20is:',_0x21f1ce['id']);switch(_0xfe833b[_0xa745('0x38')]){case _0xa745('0x54'):logger[_0xa745('0xd')]('[QUEUE]',_0xa745('0x55'));return request({'uri':util[_0xa745('0xe')](_0xa745('0x56'),_0xfe833b[_0xa745('0x19')],_0xb2f88f['id'],_0x21f1ce['id']),'method':_0xa745('0xf')});case _0xa745('0x57'):logger[_0xa745('0xd')](_0xa745('0x4a'),_0xa745('0x58'));emit(util[_0xa745('0xe')](_0xa745('0x59'),_0x49e83e[_0xa745('0x45')]),_0xa745('0x5a'),{'uri':util[_0xa745('0xe')](_0xa745('0x5b'),_0xfe833b[_0xa745('0x19')][_0xa745('0x5c')](_0xa745('0x5d'),''),_0x21f1ce['id'])});break;default:logger['error'](_0xa745('0x4a'),_0xa745('0x5e'));}}})[_0xa745('0x5f')](function(_0x42d7d3){logger[_0xa745('0x60')](_0xa745('0x61'),util[_0xa745('0x62')](_0x42d7d3,{'showHidden':!![],'depth':null}));});};exports[_0xa745('0x63')]=function(_0x88a370,_0xd9235f,_0x42896a,_0x4a3256,_0x1ab551,_0x2c6fdb,_0x4dd7d5){var _0x3120c0,_0x53f061;_0x2c6fdb[_0xa745('0x19')]=intUtil[_0xa745('0x47')](_0x2c6fdb[_0xa745('0x19')]);_0x2c6fdb[_0xa745('0x48')]=intUtil['stripTrailingSlash'](_0x2c6fdb['serverUrl']);if(_0x4dd7d5&&_0x4dd7d5[_0xa745('0x64')]&&_0x4dd7d5[_0xa745('0x64')]!=='none'){logger[_0xa745('0xd')](_0xa745('0x65'),_0xa745('0x4b'));_0xd9235f[_0xa745('0x4c')]=util['format'](_0xa745('0x66'),_0x2c6fdb[_0xa745('0x48')],_0xd9235f[_0xa745('0x4d')],md5(_0xd9235f[_0xa745('0x4d')]));}headers[_0xa745('0x4e')]=getAuth(_0x2c6fdb);return getUser(_0x2c6fdb,_0x4a3256['email'])[_0xa745('0x14')](function(_0x76f0c7){_0x3120c0=_0x76f0c7;logger[_0xa745('0xd')](_0xa745('0x50'),_0x3120c0['id']);return getEndUser(_0x2c6fdb,_0xd9235f[_0xa745('0x67')],_0xd9235f[_0xa745('0x68')]);})[_0xa745('0x14')](function(_0x29a7bf){_0x53f061=_0x29a7bf;logger[_0xa745('0xd')]('The\x20Enduser\x20ID\x20is:',_0x53f061['id']);return getTicket(_0x2c6fdb,_0x3120c0,_0x53f061,_0x42896a,_0xd9235f);})['then'](function(_0x3b09a9){if(_0x3b09a9){logger[_0xa745('0xd')]('The\x20Ticket\x20ID\x20is:',_0x3b09a9['id']);switch(_0x2c6fdb['type']){case _0xa745('0x54'):logger[_0xa745('0xd')]('[OUTBOUND]',_0xa745('0x55'));return request({'uri':util[_0xa745('0xe')](_0xa745('0x56'),_0x2c6fdb[_0xa745('0x19')],_0x3120c0['id'],_0x3b09a9['id']),'method':'POST'});case _0xa745('0x57'):logger[_0xa745('0xd')](_0xa745('0x65'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xa745('0xe')](_0xa745('0x59'),_0x4a3256[_0xa745('0x45')]),'trigger:browser:url',{'uri':util[_0xa745('0xe')](_0xa745('0x5b'),_0x2c6fdb['remoteUri']['replace']('/api/v2',''),_0x3b09a9['id'])});break;default:logger['error'](_0xa745('0x65'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})['catch'](function(_0x3db8f1){logger[_0xa745('0x60')](_0xa745('0x69'),util[_0xa745('0x62')](_0x3db8f1,{'showHidden':!![],'depth':null}));});};exports[_0xa745('0x6a')]=function(_0x57ab44,_0x371498,_0x46351e,_0x54c45d,_0x35308d,_0x2bbf55){var _0x48ec44,_0x3599f4;_0x2bbf55[_0xa745('0x19')]=intUtil[_0xa745('0x47')](_0x2bbf55['remoteUri']);_0x2bbf55[_0xa745('0x48')]=intUtil[_0xa745('0x47')](_0x2bbf55['serverUrl']);if(_0x35308d&&_0x35308d[_0xa745('0x49')]){logger[_0xa745('0xd')]('['+_0x371498['lastevent']['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x371498['recordingURL']=util[_0xa745('0xe')](_0xa745('0x66'),_0x2bbf55['serverUrl'],_0x371498[_0xa745('0x4d')],md5(_0x371498[_0xa745('0x4d')]));}else{_0x371498[_0xa745('0x4c')]='';}headers['Authorization']=getAuth(_0x2bbf55);return getUser(_0x2bbf55)[_0xa745('0x14')](function(_0x570bd4){_0x48ec44=_0x570bd4;logger[_0xa745('0xd')](_0xa745('0x50'),_0x48ec44['id']);return getEndUser(_0x2bbf55,_0x371498[_0xa745('0x51')],_0x371498[_0xa745('0x52')]);})[_0xa745('0x14')](function(_0x2ceaf1){_0x3599f4=_0x2ceaf1;logger['info'](_0xa745('0x53'),_0x3599f4['id']);return getTicket(_0x2bbf55,_0x48ec44,_0x3599f4,_0x46351e,_0x371498);})['then'](function(_0x352a7a){if(_0x352a7a){logger[_0xa745('0xd')](_0xa745('0x6b'),_0x352a7a['id']);}})[_0xa745('0x5f')](function(_0x5e4426){logger[_0xa745('0x60')]('['+_0x371498[_0xa745('0x6c')]['toUpperCase']()+']'+_0xa745('0x6d'),util['inspect'](_0x5e4426,{'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 16c1a72..f9597a4 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 _0x6c28=['variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','isNil','access_token','isBefore','zone','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.eu','/oauth/v2/token','refreshToken','refresh_token','then','expires_in','seconds','error','Failing\x20creating\x20the\x20access_token','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','catch','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','SUCCESS','Error:\x20','log','CREATE\x20ERROR','moduleSearch','uri','https://www.zohoapis.','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','Leads','nothing','contact','/crm/v2/Leads/search?criteria=((Phone:equals:','Owner','Subject','getString','Subjects','Description','Descriptions','Full_Name','First_Name','Last_Name','What_Id','$se_module','talktime','Call_Duration','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','diff','called','Call_Result','Called','connect','Answered','Rejected','abandoned','Timeout','Call_Start_Time','outbound','starttime','agentcalledAt','merge','Fields','POST','/crm/v2/Calls','code','Call\x20created!','details','err','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','user:%s','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','destcalleridname','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','lastevent','toUpperCase','recordingURL','md5','util','./util','moment','bluebird','../../../../config/environment','../../../../config/logger','zoho','defaults','redis','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','string','picklist','type','idField','content','toString'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x6c28,0x119));var _0x86c2=function(_0x2e0fd6,_0x1097a7){_0x2e0fd6=_0x2e0fd6-0x0;var _0x1c7cf4=_0x6c28[_0x2e0fd6];return _0x1c7cf4;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0x86c2('0x0'));var util=require(_0x86c2('0x1'));var intUtil=require(_0x86c2('0x2'));var moment=require(_0x86c2('0x3'));var Redis=require('ioredis');var BPromise=require(_0x86c2('0x4'));var config=require(_0x86c2('0x5'));var logger=require(_0x86c2('0x6'))(_0x86c2('0x7'));config['redis']=_[_0x86c2('0x8')](config[_0x86c2('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x86c2('0xa'))(new Redis(config[_0x86c2('0x9')]));function emit(_0x365059,_0x593e68,_0x539653){io['to'](_0x365059)[_0x86c2('0xb')](_0x593e68,_0x539653);}function request(_0x1341a0){logger[_0x86c2('0xc')](_0x86c2('0xd'),JSON[_0x86c2('0xe')](_0x1341a0));return rp(_0x1341a0);}function getCustomFields(_0x14458f,_0x5c9d2b){var _0xaab7b={};if(_0x14458f[_0x86c2('0xf')]>0x0){_['forEach'](_0x14458f,function(_0x4ccc7b){if(_[_0x86c2('0x10')]([_0x86c2('0x11'),_0x86c2('0x12')],_0x4ccc7b[_0x86c2('0x13')])&&_0x4ccc7b[_0x86c2('0x14')]){_0xaab7b[_0x4ccc7b[_0x86c2('0x14')]]=_0x4ccc7b[_0x86c2('0x15')][_0x86c2('0x16')]();}else if(_0x4ccc7b[_0x86c2('0x13')]===_0x86c2('0x17')&&_0x4ccc7b[_0x86c2('0x18')]&&_0x4ccc7b['idField']&&_0x5c9d2b[_0x4ccc7b[_0x86c2('0x18')]]){_0xaab7b[_0x4ccc7b[_0x86c2('0x14')]]=_0x5c9d2b[_0x4ccc7b[_0x86c2('0x18')]][_0x86c2('0x16')]();}else if(_0x4ccc7b[_0x86c2('0x13')]===_0x86c2('0x19')&&_0x4ccc7b[_0x86c2('0x1a')]&&_0x4ccc7b[_0x86c2('0x1a')]['name']&&_0x4ccc7b[_0x86c2('0x14')]&&_0x5c9d2b[_0x4ccc7b[_0x86c2('0x1a')][_0x86c2('0x1b')][_0x86c2('0x1c')]()]){_0xaab7b[_0x4ccc7b['idField']]=_0x5c9d2b[_0x4ccc7b[_0x86c2('0x1a')][_0x86c2('0x1b')]['toLowerCase']()][_0x86c2('0x16')]();}});}return _0xaab7b;}function getName(_0x129f0a){if(_0x129f0a[_0x86c2('0x1d')]('\x20')>0x0){var _0x553353=_0x129f0a[_0x86c2('0x1e')](/ (.+)/);if(_0x553353[0x1]){return _0x553353;}}return[_0x129f0a,_0x129f0a];}var accountsTokens={};function getAccessToken(_0x3e2c55){return new Promise(function(_0x18ee21,_0x4e2757){if(!_[_0x86c2('0x1f')](accountsTokens[_0x3e2c55['id']])&&!_['isNil'](accountsTokens[_0x3e2c55['id']][_0x86c2('0x20')])){if(moment()[_0x86c2('0x21')](accountsTokens[_0x3e2c55['id']]['expires_in'])){_0x18ee21(accountsTokens[_0x3e2c55['id']][_0x86c2('0x20')]);}}var _0x594179;switch(_0x3e2c55[_0x86c2('0x22')]){case'US':_0x594179='https://accounts.zoho.com';break;case'AU':_0x594179=_0x86c2('0x23');break;case'EU':_0x594179='https://accounts.zoho.eu';break;case'IN':_0x594179=_0x86c2('0x24');break;case'CN':_0x594179='https://accounts.zoho.com.cn';break;default:_0x594179=_0x86c2('0x25');break;}var _0x3ef7fc={'method':'POST','uri':_0x594179+_0x86c2('0x26'),'qs':{'refresh_token':_0x3e2c55[_0x86c2('0x27')],'client_id':_0x3e2c55['clientId'],'client_secret':_0x3e2c55['clientSecret'],'grant_type':_0x86c2('0x28')},'json':!![]};return rp(_0x3ef7fc)[_0x86c2('0x29')](function(_0x29181f){accountsTokens[_0x3e2c55['id']]={'access_token':_0x29181f['access_token'],'expires_in':moment()['add'](_0x29181f[_0x86c2('0x2a')],_0x86c2('0x2b'))};_0x18ee21(_0x29181f[_0x86c2('0x20')]);})['catch'](function(_0x42f3b1){logger[_0x86c2('0x2c')](_0x86c2('0x2d'),_0x42f3b1[_0x86c2('0x2e')]);_0x4e2757(_0x42f3b1);});});}function getUser(_0x14e971,_0x28f25f,_0x1b271b,_0x36330b){logger[_0x86c2('0x2f')](_0x86c2('0x30'));return request({'method':_0x86c2('0x31'),'uri':util[_0x86c2('0x32')](_0x86c2('0x33'),_0x28f25f),'qs':{'type':_0x86c2('0x34')},'headers':{'Authorization':_0x86c2('0x35')+_0x14e971},'json':!![]})[_0x86c2('0x29')](function(_0x471912){if(_0x471912['users']){var _0x32b41e=-0x1;if(_['isArrayLikeObject'](_0x471912[_0x86c2('0x36')])){if(!_[_0x86c2('0x1f')](_0x36330b)){_0x32b41e=_['findIndex'](_0x471912['users'],function(_0x40457c){return _0x40457c[_0x86c2('0x37')]===_0x36330b;});}if(_0x32b41e>=0x0){logger['info'](_0x86c2('0x38'));}else{logger[_0x86c2('0x2f')](_0x86c2('0x39'));_0x32b41e=_[_0x86c2('0x3a')](_0x471912['users'],function(_0x49b052){return _0x49b052[_0x86c2('0x3b')][_0x86c2('0x1b')]===_0x86c2('0x3c');});}return _0x471912[_0x86c2('0x36')][_0x32b41e];}else{if(_0x471912['user']['profile'][_0x86c2('0x1b')]===_0x86c2('0x3c')){logger[_0x86c2('0x2f')](_0x86c2('0x39'));user=_0x471912['user'];return user;}else{logger['error'](_0x86c2('0x3d'),JSON['stringify'](_0x471912));throw new Error(_0x86c2('0x3e')+JSON[_0x86c2('0xe')](_0x471912));}}}else{logger[_0x86c2('0x2c')](_0x86c2('0x3d'),JSON[_0x86c2('0xe')](_0x471912));throw new Error(_0x86c2('0x3e')+JSON[_0x86c2('0xe')](_0x471912));}})['catch'](function(_0x46ec8a){console[_0x86c2('0x2c')](_0x46ec8a);});}function getZohoUser(_0x3adae6,_0x255c1d){return new BPromise(function(_0x8fde6,_0x5df525){request(_0x3adae6)[_0x86c2('0x29')](function(_0x2dc6b3){var _0x566889=null;if(_0x2dc6b3){_0x566889=_0x2dc6b3[_0x86c2('0x3f')][0x0];_0x566889[_0x86c2('0x40')]=_0x255c1d;}_0x8fde6(_0x566889);})[_0x86c2('0x41')](function(_0x589532){_0x5df525(_0x589532);});});}function createEndUser(_0x171282,_0x4ddac0,_0x1b27cc,_0x4d1e16,_0x26b845,_0x35ded4){var _0x1b27cc=getName(_0x1b27cc);return request({'method':'POST','uri':'https://www.zohoapis.'+_0x4ddac0+_0x86c2('0x42')+_[_0x86c2('0x43')](_0x35ded4[_0x86c2('0x44')])+'s','body':{'data':[{'Last_Name':_0x1b27cc[0x1],'First_Name':_0x1b27cc[0x0],'Phone':_0x4d1e16,'Owner':{'name':!_['isNil'](_0x26b845[_0x86c2('0x45')][_0x86c2('0x1b')])?_0x26b845[_0x86c2('0x45')][_0x86c2('0x1b')]:!_[_0x86c2('0x1f')](_0x26b845['first_name'])?_0x26b845[_0x86c2('0x46')]+'\x20'+_0x26b845[_0x86c2('0x47')]:_0x26b845[_0x86c2('0x47')],'id':_0x26b845['id']}}]},'headers':{'Authorization':_0x86c2('0x35')+_0x171282},'json':!![]})[_0x86c2('0x29')](function(_0x54e967){if(_0x54e967&&_0x54e967[_0x86c2('0x3f')][0x0]['code']===_0x86c2('0x48')){var _0x2f30d3=_0x54e967['data'][0x0]['details'];_0x2f30d3[_0x86c2('0x40')]=_[_0x86c2('0x43')](_0x35ded4['moduleCreate'])+'s';return _0x2f30d3;}logger[_0x86c2('0x2c')](_0x86c2('0x3d'),JSON[_0x86c2('0xe')](data));throw new Error(_0x86c2('0x49')+JSON[_0x86c2('0xe')](data));})['catch'](function(_0xd174d9){console[_0x86c2('0x4a')](_0x86c2('0x4b'),_0xd174d9);});}function getEndUser(_0x2e0a60,_0x2d4d08,_0x37f49c,_0x107bff,_0x1b1bdb,_0x4ec0f0,_0x149a56){var _0x5ae17f={'method':_0x86c2('0x31'),'uri':'','headers':{'Authorization':_0x86c2('0x35')+_0x2e0a60},'json':!![]};switch(_0x149a56[_0x86c2('0x4c')]){case'contact_lead':_0x5ae17f[_0x86c2('0x4d')]=_0x86c2('0x4e')+_0x2d4d08+_0x86c2('0x4f')+_0x1b1bdb+'))';return getZohoUser(_0x5ae17f,_0x86c2('0x50'))[_0x86c2('0x29')](function(_0x199bac){if(_0x199bac)return _0x199bac;_0x5ae17f[_0x86c2('0x4d')]=_0x86c2('0x4e')+_0x2d4d08+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x1b1bdb+'))';return getZohoUser(_0x5ae17f,_0x86c2('0x51'))[_0x86c2('0x29')](function(_0x493a62){if(_0x493a62)return _0x493a62;if(_0x149a56[_0x86c2('0x44')]!=_0x86c2('0x52')){return createEndUser(_0x2e0a60,_0x2d4d08,_0x107bff,_0x1b1bdb,_0x4ec0f0,_0x149a56);}else{return{};}});});break;case _0x86c2('0x53'):_0x5ae17f[_0x86c2('0x4d')]=_0x86c2('0x4e')+_0x2d4d08+_0x86c2('0x4f')+_0x1b1bdb+'))';return getZohoUser(_0x5ae17f,_0x86c2('0x50'))[_0x86c2('0x29')](function(_0x4520fa){if(_0x4520fa)return _0x4520fa;if(_0x149a56[_0x86c2('0x44')]!=_0x86c2('0x52')){return createEndUser(_0x2e0a60,_0x2d4d08,_0x107bff,_0x1b1bdb,_0x4ec0f0,_0x149a56);}else{return{};}});break;case'lead':_0x5ae17f['uri']=_0x86c2('0x4e')+_0x2d4d08+_0x86c2('0x54')+_0x1b1bdb+'))';return getZohoUser(_0x5ae17f,_0x86c2('0x51'))['then'](function(_0x3d75a0){if(_0x3d75a0)return _0x3d75a0;if(_0x149a56[_0x86c2('0x44')]!=_0x86c2('0x52')){return createEndUser(_0x2e0a60,_0x2d4d08,_0x107bff,_0x1b1bdb,_0x4ec0f0,_0x149a56);}else{return{};}});break;}}function getCall(_0x65c29c,_0x904595,_0x4c16d2,_0x5c4fd9,_0x1a97be,_0x2ea424,_0x57e8d4,_0x3ca17c){logger[_0x86c2('0x2f')]('Creating\x20new\x20call...');var _0x542686={};_0x542686[_0x86c2('0x55')]={'name':!_[_0x86c2('0x1f')](_0x5c4fd9['role'][_0x86c2('0x1b')])&&!_[_0x86c2('0x1f')](_0x5c4fd9[_0x86c2('0x3b')]['name'])&&_0x5c4fd9[_0x86c2('0x3b')][_0x86c2('0x1b')]==='administrator'?_0x5c4fd9[_0x86c2('0x45')]['name']:!_[_0x86c2('0x1f')](_0x5c4fd9[_0x86c2('0x46')])?_0x5c4fd9[_0x86c2('0x46')]+'\x20'+_0x5c4fd9[_0x86c2('0x47')]:_0x5c4fd9['last_name'],'id':_0x5c4fd9['id']};_0x542686[_0x86c2('0x56')]=intUtil[_0x86c2('0x57')](_0x2ea424[_0x86c2('0x58')],_0x57e8d4,'\x20');_0x542686[_0x86c2('0x59')]=intUtil['getString'](_0x2ea424[_0x86c2('0x5a')],_0x57e8d4,'\x0a');if(_0x1a97be[_0x86c2('0x40')]===_0x86c2('0x50')){_0x542686['Who_Id']={'name':!_['isNil'](_0x1a97be[_0x86c2('0x5b')])?_0x1a97be[_0x86c2('0x5b')]:!_[_0x86c2('0x1f')](_0x1a97be[_0x86c2('0x5c')])?_0x1a97be['First_Name']+'\x20'+_0x1a97be[_0x86c2('0x5d')]:_0x1a97be[_0x86c2('0x5d')],'id':_0x1a97be['id']};}if(_0x1a97be[_0x86c2('0x40')]==='Leads'){_0x542686[_0x86c2('0x5e')]={'name':!_[_0x86c2('0x1f')](_0x1a97be['Full_Name'])?_0x1a97be[_0x86c2('0x5b')]:!_[_0x86c2('0x1f')](_0x1a97be[_0x86c2('0x5c')])?_0x1a97be[_0x86c2('0x5c')]+'\x20'+_0x1a97be[_0x86c2('0x5d')]:_0x1a97be['Last_Name'],'id':_0x1a97be['id']};_0x542686[_0x86c2('0x5f')]=_['startCase'](_0x1a97be['enduserType']);}if(_0x57e8d4[_0x86c2('0x60')]){_0x542686[_0x86c2('0x61')]=moment['utc'](parseInt(_0x57e8d4[_0x86c2('0x60')])*0x3e8)['format'](_0x86c2('0x62'));}else if(_0x57e8d4[_0x86c2('0x63')]&&_0x57e8d4[_0x86c2('0x64')]){_0x542686[_0x86c2('0x61')]=moment['utc'](moment(_0x57e8d4[_0x86c2('0x64')],_0x86c2('0x65'))[_0x86c2('0x66')](moment(_0x57e8d4['starttime'],_0x86c2('0x65'))))[_0x86c2('0x32')](_0x86c2('0x62'));}switch(_0x57e8d4['lastevent']){case _0x86c2('0x67'):_0x542686[_0x86c2('0x68')]=_0x86c2('0x69');break;case'complete':case _0x86c2('0x6a'):_0x542686[_0x86c2('0x68')]=_0x86c2('0x6b');break;case'rejected':_0x542686[_0x86c2('0x68')]=_0x86c2('0x6c');break;case _0x86c2('0x6d'):_0x542686[_0x86c2('0x68')]='Abandoned';break;case'timeout':_0x542686['Call_Result']=_0x86c2('0x6e');default:}_0x542686[_0x86c2('0x6f')]=(_0x3ca17c===_0x86c2('0x70')?moment(_0x57e8d4[_0x86c2('0x71')])[_0x86c2('0x32')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x57e8d4[_0x86c2('0x72')])[_0x86c2('0x32')](_0x86c2('0x65')))||moment()['format'](_0x86c2('0x65'));_0x542686['Call_Type']=_0x3ca17c||'Inbound';_0x542686=_[_0x86c2('0x73')](_0x542686,getCustomFields(_0x2ea424[_0x86c2('0x74')],_0x57e8d4));return request({'method':_0x86c2('0x75'),'uri':_0x86c2('0x4e')+_0x904595+_0x86c2('0x76'),'headers':{'Authorization':_0x86c2('0x35')+_0x65c29c},'body':{'data':[_0x542686]},'json':!![]})['then'](function(_0x3c726b){if(_0x3c726b&&_0x3c726b[_0x86c2('0x3f')][0x0][_0x86c2('0x77')]===_0x86c2('0x48')){logger[_0x86c2('0x2f')](_0x86c2('0x78'));return{'id':_0x3c726b[_0x86c2('0x3f')][0x0][_0x86c2('0x79')]['id']};}})[_0x86c2('0x41')](function(_0x3c79b9){logger[_0x86c2('0x2f')]('err',_0x3c79b9[_0x86c2('0x2e')]);console[_0x86c2('0x4a')](_0x86c2('0x7a'),_0x3c79b9);});}exports['queue']=function(_0x1671da,_0x30f531,_0x3b6850,_0x11cdef,_0x2f7577,_0x265413){var _0x151f76,_0xd1ac8a,_0x588f3e;_0x265413[_0x86c2('0x7b')]=intUtil[_0x86c2('0x7c')](_0x265413[_0x86c2('0x7b')]);_0x265413['serverUrl']=intUtil[_0x86c2('0x7c')](_0x265413[_0x86c2('0x7d')]);if(_0x2f7577&&_0x2f7577[_0x86c2('0x7e')]){logger[_0x86c2('0x2f')](_0x86c2('0x7f'),_0x86c2('0x80'));_0x30f531['recordingURL']=_0x265413[_0x86c2('0x7d')]+'/api/voice/recordings/'+_0x30f531[_0x86c2('0x81')]+_0x86c2('0x82')+md5(_0x30f531[_0x86c2('0x81')]);}else{_0x30f531['recordingURL']='';}var _0x2b2ba0=_0x265413[_0x86c2('0x7b')]===_0x86c2('0x83')?'eu':_0x86c2('0x84');return getAccessToken(_0x265413)[_0x86c2('0x29')](function(_0x10c5ab){_0x588f3e=_0x10c5ab;return getUser(_0x588f3e,_0x2b2ba0,_0x265413,_0x11cdef[_0x86c2('0x37')]);})[_0x86c2('0x29')](function(_0x1d9601){_0x151f76=_0x1d9601;logger[_0x86c2('0x2f')](_0x86c2('0x85'),_0x151f76['id']);return getEndUser(_0x588f3e,_0x2b2ba0,_0x265413,_0x30f531[_0x86c2('0x86')],_0x30f531[_0x86c2('0x87')],_0x151f76,_0x3b6850);})[_0x86c2('0x29')](function(_0x4cfe3f){_0xd1ac8a=_0x4cfe3f;return getCall(_0x588f3e,_0x2b2ba0,_0x265413,_0x151f76,_0xd1ac8a,_0x3b6850,_0x30f531,_0x86c2('0x88'));})[_0x86c2('0x29')](function(_0x5a03d4){if(_0x5a03d4){logger[_0x86c2('0x2f')](_0x86c2('0x89'),_0x5a03d4['id']);logger[_0x86c2('0x2f')](_0x86c2('0x7f'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x86c2('0x32')](_0x86c2('0x8a'),_0x11cdef[_0x86c2('0x1b')]),'trigger:browser:url',{'uri':_0x86c2('0x8b')+_0x265413[_0x86c2('0x7b')]+_0x86c2('0x8c')+_0x5a03d4['id']});}})[_0x86c2('0x41')](function(_0x5c8839){logger[_0x86c2('0x2c')](_0x86c2('0x7f'),JSON[_0x86c2('0xe')](_0x5c8839));});};exports['outbound']=function(_0x329491,_0x4132f5,_0x56c845,_0x1dfc1c,_0x361a4f,_0x34bd85,_0x128f1a){var _0x20e4e6,_0x58f051,_0x2dddf8;_0x34bd85[_0x86c2('0x7b')]=intUtil[_0x86c2('0x7c')](_0x34bd85['host']);_0x34bd85[_0x86c2('0x7d')]=intUtil[_0x86c2('0x7c')](_0x34bd85[_0x86c2('0x7d')]);if(_0x128f1a&&_0x128f1a[_0x86c2('0x8d')]&&_0x128f1a[_0x86c2('0x8d')]!==_0x86c2('0x8e')){logger['info'](_0x86c2('0x8f'),_0x86c2('0x80'));_0x4132f5['recordingURL']=_0x34bd85[_0x86c2('0x7d')]+'/api/voice/recordings/'+_0x4132f5[_0x86c2('0x81')]+'/downloads?type=uniqueid&token='+md5(_0x4132f5[_0x86c2('0x81')]);}var _0x36bb95=_0x34bd85['host']==='zoho.eu'?'eu':_0x86c2('0x84');return getAccessToken(_0x34bd85)[_0x86c2('0x29')](function(_0x1b53f6){_0x2dddf8=_0x1b53f6;return getUser(_0x2dddf8,_0x36bb95,_0x34bd85,_0x1dfc1c[_0x86c2('0x37')]);})[_0x86c2('0x29')](function(_0x1abd8e){_0x20e4e6=_0x1abd8e;logger['info']('The\x20User\x20ID\x20is:',_0x20e4e6['id']);return getEndUser(_0x2dddf8,_0x36bb95,_0x34bd85,_0x4132f5[_0x86c2('0x90')],_0x4132f5['destcalleridnum'],_0x20e4e6,_0x56c845);})['then'](function(_0x377b92){_0x58f051=_0x377b92;return getCall(_0x2dddf8,_0x36bb95,_0x34bd85,_0x20e4e6,_0x58f051,_0x56c845,_0x4132f5,_0x86c2('0x91'));})['then'](function(_0x5637af){if(_0x5637af){logger[_0x86c2('0x2f')](_0x86c2('0x89'),_0x5637af['id']);logger['info'](_0x86c2('0x8f'),_0x86c2('0x92'));emit(util['format'](_0x86c2('0x8a'),_0x1dfc1c[_0x86c2('0x1b')]),_0x86c2('0x93'),{'uri':_0x86c2('0x8b')+_0x34bd85['host']+_0x86c2('0x8c')+_0x5637af['id']});}})[_0x86c2('0x41')](function(_0x561cf8){logger[_0x86c2('0x2c')](_0x86c2('0x8f'),JSON[_0x86c2('0xe')](_0x561cf8));});};exports[_0x86c2('0x94')]=function(_0x1ceb4c,_0x461e91,_0x3912c6,_0x5058e2,_0x4d783f,_0x33b8ff){var _0x3189f1,_0x539d61,_0x4cd686;_0x33b8ff['host']=intUtil['stripTrailingSlash'](_0x33b8ff[_0x86c2('0x7b')]);_0x33b8ff[_0x86c2('0x7d')]=intUtil[_0x86c2('0x7c')](_0x33b8ff[_0x86c2('0x7d')]);if(_0x4d783f&&_0x4d783f['monitor_format']){logger[_0x86c2('0x2f')]('['+_0x461e91[_0x86c2('0x95')][_0x86c2('0x96')]()+']','Recording\x20is\x20enabled!');_0x461e91[_0x86c2('0x97')]=_0x33b8ff[_0x86c2('0x7d')]+'/api/voice/recordings/'+_0x461e91[_0x86c2('0x81')]+_0x86c2('0x82')+md5(_0x461e91[_0x86c2('0x81')]);}else{_0x461e91[_0x86c2('0x97')]='';}var _0x59a9ca=_0x33b8ff['host']===_0x86c2('0x83')?'eu':'com';return getAccessToken(_0x33b8ff)[_0x86c2('0x29')](function(_0x20aaf3){_0x4cd686=_0x20aaf3;return getUser(_0x4cd686,_0x59a9ca,_0x33b8ff);})[_0x86c2('0x29')](function(_0x2a7f38){_0x3189f1=_0x2a7f38;logger[_0x86c2('0x2f')]('The\x20User\x20ID\x20is:',_0x3189f1['id']);return getEndUser(_0x4cd686,_0x59a9ca,_0x33b8ff,_0x461e91[_0x86c2('0x86')],_0x461e91[_0x86c2('0x87')],_0x3189f1,_0x3912c6);})[_0x86c2('0x29')](function(_0x2c39c5){_0x539d61=_0x2c39c5;return getCall(_0x4cd686,_0x59a9ca,_0x33b8ff,_0x3189f1,_0x539d61,_0x3912c6,_0x461e91,_0x86c2('0x88'));})['then'](function(_0x491944){if(_0x491944){logger['info'](_0x86c2('0x89'),_0x491944['id']);}})[_0x86c2('0x41')](function(_0x44e6e1){logger[_0x86c2('0x2c')]('['+_0x461e91[_0x86c2('0x95')][_0x86c2('0x96')]()+']',JSON[_0x86c2('0xe')](_0x44e6e1));});}; \ No newline at end of file +var _0x710f=['code','Call\x20created!','details','err','queue','host','stripTrailingSlash','serverUrl','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','email','The\x20User\x20ID\x20is:','calleridnum','The\x20Call\x20ID\x20is:','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','/crm/EntityInfo.do?module=Calls&id=','outbound','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','https://crm.','unmanaged','monitor_format','toUpperCase','calleridname','Inbound','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','debug','[HTTP]','stringify','length','forEach','includes','string','type','idField','content','toString','variable','variableName','customVariable','Variable','name','toLowerCase','indexOf','split','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','clientSecret','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','GET','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','info','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','/crm/v2/','startCase','moduleCreate','role','SUCCESS','enduserType','Error:\x20','log','CREATE\x20ERROR','moduleSearch','contact_lead','uri','https://www.zohoapis.','Contacts','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','/crm/v2/Contacts/search?criteria=((Phone:equals:','lead','Leads','Creating\x20new\x20call...','Owner','administrator','first_name','last_name','Subject','getString','Subjects','Description','Who_Id','Full_Name','First_Name','Last_Name','What_Id','talktime','Call_Duration','mm:ss','answertime','endtime','utc','YYYY-MM-DDTHH:mm:ss','diff','format','lastevent','Call_Result','Called','complete','connect','Answered','rejected','Rejected','abandoned','Abandoned','timeout','Timeout','Call_Start_Time','starttime','agentcalledAt','Call_Type','merge'];(function(_0x4d3752,_0x7943fb){var _0x1f8333=function(_0x477fb9){while(--_0x477fb9){_0x4d3752['push'](_0x4d3752['shift']());}};_0x1f8333(++_0x7943fb);}(_0x710f,0xc7));var _0xf710=function(_0xe71d4e,_0x5e2762){_0xe71d4e=_0xe71d4e-0x0;var _0x2fa128=_0x710f[_0xe71d4e];return _0x2fa128;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require('md5');var util=require(_0xf710('0x0'));var intUtil=require(_0xf710('0x1'));var moment=require(_0xf710('0x2'));var Redis=require(_0xf710('0x3'));var BPromise=require(_0xf710('0x4'));var config=require(_0xf710('0x5'));var logger=require(_0xf710('0x6'))(_0xf710('0x7'));config[_0xf710('0x8')]=_[_0xf710('0x9')](config[_0xf710('0x8')],{'host':_0xf710('0xa'),'port':0x18eb});var io=require(_0xf710('0xb'))(new Redis(config['redis']));function emit(_0x166ee7,_0x811ec9,_0x45e885){io['to'](_0x166ee7)['emit'](_0x811ec9,_0x45e885);}function request(_0x58e1cb){logger[_0xf710('0xc')](_0xf710('0xd'),JSON[_0xf710('0xe')](_0x58e1cb));return rp(_0x58e1cb);}function getCustomFields(_0x1f4fc1,_0xdd9e0e){var _0x7c4c8b={};if(_0x1f4fc1[_0xf710('0xf')]>0x0){_[_0xf710('0x10')](_0x1f4fc1,function(_0x15239b){if(_[_0xf710('0x11')]([_0xf710('0x12'),'picklist'],_0x15239b[_0xf710('0x13')])&&_0x15239b['idField']){_0x7c4c8b[_0x15239b[_0xf710('0x14')]]=_0x15239b[_0xf710('0x15')][_0xf710('0x16')]();}else if(_0x15239b[_0xf710('0x13')]===_0xf710('0x17')&&_0x15239b[_0xf710('0x18')]&&_0x15239b[_0xf710('0x14')]&&_0xdd9e0e[_0x15239b[_0xf710('0x18')]]){_0x7c4c8b[_0x15239b['idField']]=_0xdd9e0e[_0x15239b[_0xf710('0x18')]]['toString']();}else if(_0x15239b[_0xf710('0x13')]===_0xf710('0x19')&&_0x15239b[_0xf710('0x1a')]&&_0x15239b[_0xf710('0x1a')][_0xf710('0x1b')]&&_0x15239b[_0xf710('0x14')]&&_0xdd9e0e[_0x15239b[_0xf710('0x1a')][_0xf710('0x1b')]['toLowerCase']()]){_0x7c4c8b[_0x15239b[_0xf710('0x14')]]=_0xdd9e0e[_0x15239b[_0xf710('0x1a')]['name'][_0xf710('0x1c')]()][_0xf710('0x16')]();}});}return _0x7c4c8b;}function getName(_0x231dbe){if(_0x231dbe[_0xf710('0x1d')]('\x20')>0x0){var _0x5720b6=_0x231dbe[_0xf710('0x1e')](/ (.+)/);if(_0x5720b6[0x1]){return _0x5720b6;}}return[_0x231dbe,_0x231dbe];}var accountsTokens={};function getAccessToken(_0x890db4){return new Promise(function(_0x47c1eb,_0xdb9ccd){if(!_[_0xf710('0x1f')](accountsTokens[_0x890db4['id']])&&!_['isNil'](accountsTokens[_0x890db4['id']][_0xf710('0x20')])){if(moment()[_0xf710('0x21')](accountsTokens[_0x890db4['id']][_0xf710('0x22')])){_0x47c1eb(accountsTokens[_0x890db4['id']][_0xf710('0x20')]);}}var _0x295b0a;switch(_0x890db4[_0xf710('0x23')]){case'US':_0x295b0a=_0xf710('0x24');break;case'AU':_0x295b0a=_0xf710('0x25');break;case'EU':_0x295b0a=_0xf710('0x26');break;case'IN':_0x295b0a=_0xf710('0x27');break;case'CN':_0x295b0a=_0xf710('0x28');break;default:_0x295b0a='https://accounts.zoho.eu';break;}var _0x25edd6={'method':_0xf710('0x29'),'uri':_0x295b0a+_0xf710('0x2a'),'qs':{'refresh_token':_0x890db4[_0xf710('0x2b')],'client_id':_0x890db4['clientId'],'client_secret':_0x890db4[_0xf710('0x2c')],'grant_type':'refresh_token'},'json':!![]};return rp(_0x25edd6)[_0xf710('0x2d')](function(_0x1df2e0){accountsTokens[_0x890db4['id']]={'access_token':_0x1df2e0[_0xf710('0x20')],'expires_in':moment()['add'](_0x1df2e0['expires_in'],_0xf710('0x2e'))};_0x47c1eb(_0x1df2e0[_0xf710('0x20')]);})[_0xf710('0x2f')](function(_0x5259c8){logger[_0xf710('0x30')](_0xf710('0x31'),_0x5259c8['stack']);_0xdb9ccd(_0x5259c8);});});}function getUser(_0x3ef1d6,_0x16769e,_0x4347a1,_0xc6b9b5){logger['info']('Search\x20user');return request({'method':_0xf710('0x32'),'uri':util['format'](_0xf710('0x33'),_0x16769e),'qs':{'type':_0xf710('0x34')},'headers':{'Authorization':_0xf710('0x35')+_0x3ef1d6},'json':!![]})[_0xf710('0x2d')](function(_0x58ace8){if(_0x58ace8[_0xf710('0x36')]){var _0x402ece=-0x1;if(_[_0xf710('0x37')](_0x58ace8[_0xf710('0x36')])){if(!_[_0xf710('0x1f')](_0xc6b9b5)){_0x402ece=_['findIndex'](_0x58ace8[_0xf710('0x36')],function(_0x193f65){return _0x193f65['email']===_0xc6b9b5;});}if(_0x402ece>=0x0){logger[_0xf710('0x38')](_0xf710('0x39'));}else{logger[_0xf710('0x38')](_0xf710('0x3a'));_0x402ece=_[_0xf710('0x3b')](_0x58ace8[_0xf710('0x36')],function(_0x4ac66c){return _0x4ac66c[_0xf710('0x3c')][_0xf710('0x1b')]===_0xf710('0x3d');});}return _0x58ace8[_0xf710('0x36')][_0x402ece];}else{if(_0x58ace8[_0xf710('0x3e')][_0xf710('0x3c')][_0xf710('0x1b')]===_0xf710('0x3d')){logger[_0xf710('0x38')](_0xf710('0x3a'));user=_0x58ace8['user'];return user;}else{logger[_0xf710('0x30')](_0xf710('0x3f'),JSON['stringify'](_0x58ace8));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0xf710('0xe')](_0x58ace8));}}}else{logger[_0xf710('0x30')](_0xf710('0x3f'),JSON['stringify'](_0x58ace8));throw new Error(_0xf710('0x40')+JSON['stringify'](_0x58ace8));}})['catch'](function(_0x498b9d){console[_0xf710('0x30')](_0x498b9d);});}function getZohoUser(_0x16201e,_0x5552f9){return new BPromise(function(_0x2cbc1c,_0x29ffa4){request(_0x16201e)[_0xf710('0x2d')](function(_0x38a2b0){var _0x139012=null;if(_0x38a2b0){_0x139012=_0x38a2b0[_0xf710('0x41')][0x0];_0x139012['enduserType']=_0x5552f9;}_0x2cbc1c(_0x139012);})[_0xf710('0x2f')](function(_0x28c065){_0x29ffa4(_0x28c065);});});}function createEndUser(_0x15381a,_0x39bba5,_0xf41732,_0x18b9ee,_0x4cee57,_0x1feba3){var _0xf41732=getName(_0xf41732);return request({'method':_0xf710('0x29'),'uri':'https://www.zohoapis.'+_0x39bba5+_0xf710('0x42')+_[_0xf710('0x43')](_0x1feba3[_0xf710('0x44')])+'s','body':{'data':[{'Last_Name':_0xf41732[0x1],'First_Name':_0xf41732[0x0],'Phone':_0x18b9ee,'Owner':{'name':!_['isNil'](_0x4cee57[_0xf710('0x45')][_0xf710('0x1b')])?_0x4cee57['role'][_0xf710('0x1b')]:!_['isNil'](_0x4cee57['first_name'])?_0x4cee57['first_name']+'\x20'+_0x4cee57['last_name']:_0x4cee57['last_name'],'id':_0x4cee57['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x15381a},'json':!![]})[_0xf710('0x2d')](function(_0x3d08ad){if(_0x3d08ad&&_0x3d08ad[_0xf710('0x41')][0x0]['code']===_0xf710('0x46')){var _0x1dc4c6=_0x3d08ad[_0xf710('0x41')][0x0]['details'];_0x1dc4c6[_0xf710('0x47')]=_[_0xf710('0x43')](_0x1feba3[_0xf710('0x44')])+'s';return _0x1dc4c6;}logger[_0xf710('0x30')](_0xf710('0x3f'),JSON[_0xf710('0xe')](data));throw new Error(_0xf710('0x48')+JSON[_0xf710('0xe')](data));})['catch'](function(_0x1e4c5b){console[_0xf710('0x49')](_0xf710('0x4a'),_0x1e4c5b);});}function getEndUser(_0x20e1e7,_0x4a335f,_0x2ea91a,_0x31bc28,_0x26ffca,_0x5b749f,_0x2a8609){var _0x3c3fb6={'method':_0xf710('0x32'),'uri':'','headers':{'Authorization':_0xf710('0x35')+_0x20e1e7},'json':!![]};switch(_0x2a8609[_0xf710('0x4b')]){case _0xf710('0x4c'):_0x3c3fb6[_0xf710('0x4d')]=_0xf710('0x4e')+_0x4a335f+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x26ffca+'))';return getZohoUser(_0x3c3fb6,_0xf710('0x4f'))[_0xf710('0x2d')](function(_0x158dc3){if(_0x158dc3)return _0x158dc3;_0x3c3fb6[_0xf710('0x4d')]=_0xf710('0x4e')+_0x4a335f+_0xf710('0x50')+_0x26ffca+'))';return getZohoUser(_0x3c3fb6,'Leads')[_0xf710('0x2d')](function(_0x793e2a){if(_0x793e2a)return _0x793e2a;if(_0x2a8609[_0xf710('0x44')]!=_0xf710('0x51')){return createEndUser(_0x20e1e7,_0x4a335f,_0x31bc28,_0x26ffca,_0x5b749f,_0x2a8609);}else{return{};}});});break;case'contact':_0x3c3fb6[_0xf710('0x4d')]=_0xf710('0x4e')+_0x4a335f+_0xf710('0x52')+_0x26ffca+'))';return getZohoUser(_0x3c3fb6,_0xf710('0x4f'))['then'](function(_0x5e7636){if(_0x5e7636)return _0x5e7636;if(_0x2a8609[_0xf710('0x44')]!='nothing'){return createEndUser(_0x20e1e7,_0x4a335f,_0x31bc28,_0x26ffca,_0x5b749f,_0x2a8609);}else{return{};}});break;case _0xf710('0x53'):_0x3c3fb6['uri']=_0xf710('0x4e')+_0x4a335f+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x26ffca+'))';return getZohoUser(_0x3c3fb6,_0xf710('0x54'))[_0xf710('0x2d')](function(_0x3c2bf6){if(_0x3c2bf6)return _0x3c2bf6;if(_0x2a8609['moduleCreate']!=_0xf710('0x51')){return createEndUser(_0x20e1e7,_0x4a335f,_0x31bc28,_0x26ffca,_0x5b749f,_0x2a8609);}else{return{};}});break;}}function getCall(_0x9e1053,_0xf68144,_0x3e78a9,_0x3a02da,_0x574fc0,_0x556cef,_0x4a59e1,_0xa36f60){logger[_0xf710('0x38')](_0xf710('0x55'));var _0x31df38={};_0x31df38[_0xf710('0x56')]={'name':!_[_0xf710('0x1f')](_0x3a02da['role'][_0xf710('0x1b')])&&!_[_0xf710('0x1f')](_0x3a02da[_0xf710('0x3c')][_0xf710('0x1b')])&&_0x3a02da['profile']['name']===_0xf710('0x57')?_0x3a02da[_0xf710('0x45')][_0xf710('0x1b')]:!_[_0xf710('0x1f')](_0x3a02da[_0xf710('0x58')])?_0x3a02da[_0xf710('0x58')]+'\x20'+_0x3a02da[_0xf710('0x59')]:_0x3a02da[_0xf710('0x59')],'id':_0x3a02da['id']};_0x31df38[_0xf710('0x5a')]=intUtil[_0xf710('0x5b')](_0x556cef[_0xf710('0x5c')],_0x4a59e1,'\x20');_0x31df38[_0xf710('0x5d')]=intUtil[_0xf710('0x5b')](_0x556cef['Descriptions'],_0x4a59e1,'\x0a');if(_0x574fc0[_0xf710('0x47')]===_0xf710('0x4f')){_0x31df38[_0xf710('0x5e')]={'name':!_['isNil'](_0x574fc0[_0xf710('0x5f')])?_0x574fc0[_0xf710('0x5f')]:!_[_0xf710('0x1f')](_0x574fc0[_0xf710('0x60')])?_0x574fc0[_0xf710('0x60')]+'\x20'+_0x574fc0[_0xf710('0x61')]:_0x574fc0[_0xf710('0x61')],'id':_0x574fc0['id']};}if(_0x574fc0[_0xf710('0x47')]===_0xf710('0x54')){_0x31df38[_0xf710('0x62')]={'name':!_['isNil'](_0x574fc0[_0xf710('0x5f')])?_0x574fc0['Full_Name']:!_[_0xf710('0x1f')](_0x574fc0[_0xf710('0x60')])?_0x574fc0[_0xf710('0x60')]+'\x20'+_0x574fc0[_0xf710('0x61')]:_0x574fc0[_0xf710('0x61')],'id':_0x574fc0['id']};_0x31df38['$se_module']=_[_0xf710('0x43')](_0x574fc0[_0xf710('0x47')]);}if(_0x4a59e1[_0xf710('0x63')]){_0x31df38[_0xf710('0x64')]=moment['utc'](parseInt(_0x4a59e1[_0xf710('0x63')])*0x3e8)['format'](_0xf710('0x65'));}else if(_0x4a59e1[_0xf710('0x66')]&&_0x4a59e1[_0xf710('0x67')]){_0x31df38[_0xf710('0x64')]=moment[_0xf710('0x68')](moment(_0x4a59e1[_0xf710('0x67')],_0xf710('0x69'))[_0xf710('0x6a')](moment(_0x4a59e1['starttime'],_0xf710('0x69'))))[_0xf710('0x6b')]('mm:ss');}switch(_0x4a59e1[_0xf710('0x6c')]){case'called':_0x31df38[_0xf710('0x6d')]=_0xf710('0x6e');break;case _0xf710('0x6f'):case _0xf710('0x70'):_0x31df38[_0xf710('0x6d')]=_0xf710('0x71');break;case _0xf710('0x72'):_0x31df38[_0xf710('0x6d')]=_0xf710('0x73');break;case _0xf710('0x74'):_0x31df38[_0xf710('0x6d')]=_0xf710('0x75');break;case _0xf710('0x76'):_0x31df38[_0xf710('0x6d')]=_0xf710('0x77');default:}_0x31df38[_0xf710('0x78')]=(_0xa36f60==='outbound'?moment(_0x4a59e1[_0xf710('0x79')])[_0xf710('0x6b')]('YYYY-MM-DDTHH:mm:ss'):moment(_0x4a59e1[_0xf710('0x7a')])[_0xf710('0x6b')](_0xf710('0x69')))||moment()[_0xf710('0x6b')](_0xf710('0x69'));_0x31df38[_0xf710('0x7b')]=_0xa36f60||'Inbound';_0x31df38=_[_0xf710('0x7c')](_0x31df38,getCustomFields(_0x556cef['Fields'],_0x4a59e1));return request({'method':_0xf710('0x29'),'uri':'https://www.zohoapis.'+_0xf68144+'/crm/v2/Calls','headers':{'Authorization':_0xf710('0x35')+_0x9e1053},'body':{'data':[_0x31df38]},'json':!![]})[_0xf710('0x2d')](function(_0x3d1ffc){if(_0x3d1ffc&&_0x3d1ffc[_0xf710('0x41')][0x0][_0xf710('0x7d')]===_0xf710('0x46')){logger[_0xf710('0x38')](_0xf710('0x7e'));return{'id':_0x3d1ffc['data'][0x0][_0xf710('0x7f')]['id']};}})[_0xf710('0x2f')](function(_0x1d707d){logger[_0xf710('0x38')](_0xf710('0x80'),_0x1d707d['stack']);console['log'](_0xf710('0x80'),_0x1d707d);});}exports[_0xf710('0x81')]=function(_0x46b996,_0x6966ec,_0x5d3c8b,_0x30f93b,_0x277006,_0x31d11b){var _0x3cd09d,_0x31dff5,_0xf7e8a9;_0x31d11b[_0xf710('0x82')]=intUtil[_0xf710('0x83')](_0x31d11b['host']);_0x31d11b[_0xf710('0x84')]=intUtil[_0xf710('0x83')](_0x31d11b[_0xf710('0x84')]);if(_0x277006&&_0x277006['monitor_format']){logger[_0xf710('0x38')](_0xf710('0x85'),_0xf710('0x86'));_0x6966ec[_0xf710('0x87')]=_0x31d11b[_0xf710('0x84')]+_0xf710('0x88')+_0x6966ec[_0xf710('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x6966ec[_0xf710('0x89')]);}else{_0x6966ec[_0xf710('0x87')]='';}var _0x113d52=_0x31d11b['host']===_0xf710('0x8a')?'eu':_0xf710('0x8b');return getAccessToken(_0x31d11b)['then'](function(_0x5ebb3a){_0xf7e8a9=_0x5ebb3a;return getUser(_0xf7e8a9,_0x113d52,_0x31d11b,_0x30f93b[_0xf710('0x8c')]);})['then'](function(_0x48f43e){_0x3cd09d=_0x48f43e;logger[_0xf710('0x38')](_0xf710('0x8d'),_0x3cd09d['id']);return getEndUser(_0xf7e8a9,_0x113d52,_0x31d11b,_0x6966ec['calleridname'],_0x6966ec[_0xf710('0x8e')],_0x3cd09d,_0x5d3c8b);})['then'](function(_0x230648){_0x31dff5=_0x230648;return getCall(_0xf7e8a9,_0x113d52,_0x31d11b,_0x3cd09d,_0x31dff5,_0x5d3c8b,_0x6966ec,'Inbound');})['then'](function(_0x37bdab){if(_0x37bdab){logger[_0xf710('0x38')](_0xf710('0x8f'),_0x37bdab['id']);logger['info'](_0xf710('0x85'),_0xf710('0x90'));emit(util[_0xf710('0x6b')](_0xf710('0x91'),_0x30f93b['name']),_0xf710('0x92'),{'uri':'https://crm.'+_0x31d11b[_0xf710('0x82')]+_0xf710('0x93')+_0x37bdab['id']});}})['catch'](function(_0x507e42){logger[_0xf710('0x30')](_0xf710('0x85'),JSON[_0xf710('0xe')](_0x507e42));});};exports[_0xf710('0x94')]=function(_0x2f5050,_0x1daaa2,_0x10f485,_0x2adbf0,_0x1c81a6,_0x5f3315,_0x5ec511){var _0x55c19b,_0x24ebe2,_0x59bf38;_0x5f3315[_0xf710('0x82')]=intUtil[_0xf710('0x83')](_0x5f3315[_0xf710('0x82')]);_0x5f3315[_0xf710('0x84')]=intUtil[_0xf710('0x83')](_0x5f3315[_0xf710('0x84')]);if(_0x5ec511&&_0x5ec511[_0xf710('0x95')]&&_0x5ec511[_0xf710('0x95')]!==_0xf710('0x96')){logger[_0xf710('0x38')](_0xf710('0x97'),_0xf710('0x86'));_0x1daaa2[_0xf710('0x87')]=_0x5f3315[_0xf710('0x84')]+_0xf710('0x88')+_0x1daaa2[_0xf710('0x89')]+_0xf710('0x98')+md5(_0x1daaa2[_0xf710('0x89')]);}var _0x36ab0b=_0x5f3315['host']===_0xf710('0x8a')?'eu':'com';return getAccessToken(_0x5f3315)[_0xf710('0x2d')](function(_0x649c60){_0x59bf38=_0x649c60;return getUser(_0x59bf38,_0x36ab0b,_0x5f3315,_0x2adbf0[_0xf710('0x8c')]);})['then'](function(_0x2e5023){_0x55c19b=_0x2e5023;logger[_0xf710('0x38')](_0xf710('0x8d'),_0x55c19b['id']);return getEndUser(_0x59bf38,_0x36ab0b,_0x5f3315,_0x1daaa2[_0xf710('0x99')],_0x1daaa2[_0xf710('0x9a')],_0x55c19b,_0x10f485);})[_0xf710('0x2d')](function(_0xa69ca4){_0x24ebe2=_0xa69ca4;return getCall(_0x59bf38,_0x36ab0b,_0x5f3315,_0x55c19b,_0x24ebe2,_0x10f485,_0x1daaa2,_0xf710('0x9b'));})[_0xf710('0x2d')](function(_0x2150a2){if(_0x2150a2){logger[_0xf710('0x38')](_0xf710('0x8f'),_0x2150a2['id']);logger[_0xf710('0x38')]('[OUTBOUND]',_0xf710('0x90'));emit(util[_0xf710('0x6b')](_0xf710('0x91'),_0x2adbf0['name']),_0xf710('0x92'),{'uri':_0xf710('0x9c')+_0x5f3315[_0xf710('0x82')]+_0xf710('0x93')+_0x2150a2['id']});}})['catch'](function(_0x2cd7e7){logger[_0xf710('0x30')](_0xf710('0x97'),JSON[_0xf710('0xe')](_0x2cd7e7));});};exports[_0xf710('0x9d')]=function(_0x5017c5,_0x1bc871,_0x2ad4dc,_0x123993,_0x1569e6,_0x210cf2){var _0x277c22,_0xcbc7e5,_0x1bff7a;_0x210cf2[_0xf710('0x82')]=intUtil[_0xf710('0x83')](_0x210cf2['host']);_0x210cf2[_0xf710('0x84')]=intUtil['stripTrailingSlash'](_0x210cf2[_0xf710('0x84')]);if(_0x1569e6&&_0x1569e6[_0xf710('0x9e')]){logger[_0xf710('0x38')]('['+_0x1bc871[_0xf710('0x6c')][_0xf710('0x9f')]()+']',_0xf710('0x86'));_0x1bc871[_0xf710('0x87')]=_0x210cf2[_0xf710('0x84')]+_0xf710('0x88')+_0x1bc871[_0xf710('0x89')]+'/downloads?type=uniqueid&token='+md5(_0x1bc871['uniqueid']);}else{_0x1bc871[_0xf710('0x87')]='';}var _0x15c3a2=_0x210cf2[_0xf710('0x82')]===_0xf710('0x8a')?'eu':_0xf710('0x8b');return getAccessToken(_0x210cf2)[_0xf710('0x2d')](function(_0x272e4b){_0x1bff7a=_0x272e4b;return getUser(_0x1bff7a,_0x15c3a2,_0x210cf2);})['then'](function(_0x5f3e2b){_0x277c22=_0x5f3e2b;logger['info']('The\x20User\x20ID\x20is:',_0x277c22['id']);return getEndUser(_0x1bff7a,_0x15c3a2,_0x210cf2,_0x1bc871[_0xf710('0xa0')],_0x1bc871[_0xf710('0x8e')],_0x277c22,_0x2ad4dc);})[_0xf710('0x2d')](function(_0x3396a1){_0xcbc7e5=_0x3396a1;return getCall(_0x1bff7a,_0x15c3a2,_0x210cf2,_0x277c22,_0xcbc7e5,_0x2ad4dc,_0x1bc871,_0xf710('0xa1'));})[_0xf710('0x2d')](function(_0x4c1684){if(_0x4c1684){logger[_0xf710('0x38')](_0xf710('0x8f'),_0x4c1684['id']);}})[_0xf710('0x2f')](function(_0x1d1d0c){logger['error']('['+_0x1bc871[_0xf710('0x6c')][_0xf710('0x9f')]()+']',JSON[_0xf710('0xe')](_0x1d1d0c));});}; \ 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 e403a9a..b6dc150 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 _0xbfbb=['exec','data2','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','trigger'];(function(_0x55c09a,_0x4f2c79){var _0x3fb09b=function(_0x3c6dd7){while(--_0x3c6dd7){_0x55c09a['push'](_0x55c09a['shift']());}};_0x3fb09b(++_0x4f2c79);}(_0xbfbb,0x158));var _0xbbfb=function(_0x3610ed,_0x42070a){_0x3610ed=_0x3610ed-0x0;var _0x17ef1c=_0xbfbb[_0x3610ed];return _0x17ef1c;};'use strict';var util=require(_0xbbfb('0x0'));var sh=require(_0xbbfb('0x1'));var Mustache=require(_0xbbfb('0x2'));var logger=require('../../../../config/logger')(_0xbbfb('0x3'));exports[_0xbbfb('0x4')]=function(_0x19f6dd,_0xd11609){var _0xa1a3f6=_0x19f6dd[_0xbbfb('0x5')]?_0x19f6dd['data2']:'Script';var _0x49365c=_0x19f6dd['data3']?Mustache['render'](_0x19f6dd[_0xbbfb('0x6')],_0xd11609):_0xd11609;sh['exec'](_0x49365c,function(_0x4f0e50,_0x21d97e,_0x461778){if(_0x4f0e50!==0x0){logger[_0xbbfb('0x7')](util['format'](_0xbbfb('0x8'),_0xa1a3f6,_0x49365c,_0x4f0e50,_0x461778));}else{logger[_0xbbfb('0x9')](util[_0xbbfb('0xa')](_0xbbfb('0xb'),_0xa1a3f6,_0x49365c,_0x21d97e));}});}; \ No newline at end of file +var _0x2e9b=['data3','render','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util','shelljs','mustache','../../../../config/logger','trigger','exec','data2','Script'];(function(_0x3015b7,_0x5e7b76){var _0x432d69=function(_0x248316){while(--_0x248316){_0x3015b7['push'](_0x3015b7['shift']());}};_0x432d69(++_0x5e7b76);}(_0x2e9b,0x8e));var _0xb2e9=function(_0xef2d09,_0x2b275e){_0xef2d09=_0xef2d09-0x0;var _0x3dd09e=_0x2e9b[_0xef2d09];return _0x3dd09e;};'use strict';var util=require(_0xb2e9('0x0'));var sh=require(_0xb2e9('0x1'));var Mustache=require(_0xb2e9('0x2'));var logger=require(_0xb2e9('0x3'))(_0xb2e9('0x4'));exports[_0xb2e9('0x5')]=function(_0x1f961d,_0x41d56f){var _0x3b0e16=_0x1f961d[_0xb2e9('0x6')]?_0x1f961d['data2']:_0xb2e9('0x7');var _0x379c44=_0x1f961d[_0xb2e9('0x8')]?Mustache[_0xb2e9('0x9')](_0x1f961d['data3'],_0x41d56f):_0x41d56f;sh[_0xb2e9('0x5')](_0x379c44,function(_0x4d885f,_0x2232d1,_0x2c0144){if(_0x4d885f!==0x0){logger[_0xb2e9('0xa')](util['format'](_0xb2e9('0xb'),_0x3b0e16,_0x379c44,_0x4d885f,_0x2c0144));}else{logger[_0xb2e9('0xc')](util[_0xb2e9('0xd')](_0xb2e9('0xe'),_0x3b0e16,_0x379c44,_0x2232d1));}});}; \ 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 b178dc1..7be4b0d 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 _0x2c14=['catch','statusCode','name','message','util','lodash','trigger','data1','toUpperCase','render','data2','data5','number','data6','parse','error','stack','GET','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','then',',\x20request\x20body:\x20','object','stringify','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s'];(function(_0x49b811,_0x150b1c){var _0x372f4d=function(_0x56fce1){while(--_0x56fce1){_0x49b811['push'](_0x49b811['shift']());}};_0x372f4d(++_0x150b1c);}(_0x2c14,0x124));var _0x42c1=function(_0x40040b,_0x23fcf0){_0x40040b=_0x40040b-0x0;var _0x37d316=_0x2c14[_0x40040b];return _0x37d316;};'use strict';var rp=require('request-promise');var util=require(_0x42c1('0x0'));var _=require(_0x42c1('0x1'));var Mustache=require('mustache');var logger=require('../../../../config/logger')(_0x42c1('0x2'));exports['exec']=function(_0x4cdcfc,_0x3742a5){var _0x59f4af,_0x5be35c;var _0x14ba80={'method':_0x4cdcfc[_0x42c1('0x3')][_0x42c1('0x4')](),'uri':Mustache[_0x42c1('0x5')](_0x4cdcfc[_0x42c1('0x6')],_0x3742a5),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x4cdcfc[_0x42c1('0x7')])===_0x42c1('0x8')&&parseInt(_0x4cdcfc[_0x42c1('0x7')])>=0x1&&parseInt(_0x4cdcfc[_0x42c1('0x7')])<=0xa?parseInt(_0x4cdcfc[_0x42c1('0x7')])*0x3e8:0x5*0x3e8};try{_0x14ba80['headers']=_0x4cdcfc[_0x42c1('0x9')]?JSON[_0x42c1('0xa')](Mustache['render'](_0x4cdcfc[_0x42c1('0x9')],_0x3742a5)):{};}catch(_0x4119ea){logger[_0x42c1('0xb')](_0x4119ea[_0x42c1('0xc')]);}switch(_0x4cdcfc[_0x42c1('0x3')][_0x42c1('0x4')]()){case _0x42c1('0xd'):case _0x42c1('0xe'):_0x59f4af=null;_0x14ba80['qs']=_0x3742a5;break;case _0x42c1('0xf'):case _0x42c1('0x10'):if(_0x4cdcfc[_0x42c1('0x11')]){try{_0x59f4af=JSON['parse'](Mustache[_0x42c1('0x5')](_0x4cdcfc[_0x42c1('0x11')],_0x3742a5));_0x14ba80[_0x42c1('0x12')]=_0x59f4af;}catch(_0x819992){logger[_0x42c1('0xb')](_0x819992[_0x42c1('0xc')]);logger[_0x42c1('0xb')](_0x42c1('0x13'));}}else{_0x59f4af=_0x3742a5;_0x14ba80[_0x42c1('0x12')]=_0x59f4af;}break;}logger[_0x42c1('0x14')](util[_0x42c1('0x15')](_0x42c1('0x16'),_0x4cdcfc['data1'],_0x4cdcfc[_0x42c1('0x6')],JSON['stringify'](_0x14ba80)));rp(_0x14ba80)[_0x42c1('0x17')](function(_0xc3472){_0x59f4af=!_['isNil'](_0x59f4af)?_0x42c1('0x18')+_0x59f4af:'';_0x5be35c=typeof _0xc3472[_0x42c1('0x12')]===_0x42c1('0x19')?JSON[_0x42c1('0x1a')](_0xc3472[_0x42c1('0x12')]):_0xc3472[_0x42c1('0x12')];logger[_0x42c1('0x14')](util[_0x42c1('0x15')](_0x42c1('0x1b'),_0x4cdcfc['data1'],_0x4cdcfc[_0x42c1('0x6')],_0xc3472['statusCode'],_0x5be35c));})[_0x42c1('0x1c')](function(_0x38219f){logger[_0x42c1('0xb')](util[_0x42c1('0x15')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x4cdcfc['data1'],_0x4cdcfc[_0x42c1('0x6')],_0x38219f[_0x42c1('0x1d')],_0x38219f[_0x42c1('0x1e')],_0x38219f[_0x42c1('0x1f')]));});}; \ No newline at end of file +var _0xa062=['data6','parse','render','stack','GET','DELETE','POST','PUT','data7','body','error','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','stringify','then','isNil',',\x20request\x20body:\x20','%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','message','request-promise','util','lodash','mustache','../../../../config/logger','trigger','exec','data1','toUpperCase','data2','data5','number','headers'];(function(_0x1b1f88,_0x3fe1cb){var _0x5045b9=function(_0x5c1367){while(--_0x5c1367){_0x1b1f88['push'](_0x1b1f88['shift']());}};_0x5045b9(++_0x3fe1cb);}(_0xa062,0x113));var _0x2a06=function(_0x51d959,_0x14cdb0){_0x51d959=_0x51d959-0x0;var _0x27c3a0=_0xa062[_0x51d959];return _0x27c3a0;};'use strict';var rp=require(_0x2a06('0x0'));var util=require(_0x2a06('0x1'));var _=require(_0x2a06('0x2'));var Mustache=require(_0x2a06('0x3'));var logger=require(_0x2a06('0x4'))(_0x2a06('0x5'));exports[_0x2a06('0x6')]=function(_0x374e33,_0x2cb298){var _0x16bf27,_0xf9b7ab;var _0x1cbc47={'method':_0x374e33[_0x2a06('0x7')][_0x2a06('0x8')](),'uri':Mustache['render'](_0x374e33[_0x2a06('0x9')],_0x2cb298),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x374e33[_0x2a06('0xa')])===_0x2a06('0xb')&&parseInt(_0x374e33[_0x2a06('0xa')])>=0x1&&parseInt(_0x374e33[_0x2a06('0xa')])<=0xa?parseInt(_0x374e33[_0x2a06('0xa')])*0x3e8:0x5*0x3e8};try{_0x1cbc47[_0x2a06('0xc')]=_0x374e33[_0x2a06('0xd')]?JSON[_0x2a06('0xe')](Mustache[_0x2a06('0xf')](_0x374e33[_0x2a06('0xd')],_0x2cb298)):{};}catch(_0x22f6fb){logger['error'](_0x22f6fb[_0x2a06('0x10')]);}switch(_0x374e33['data1'][_0x2a06('0x8')]()){case _0x2a06('0x11'):case _0x2a06('0x12'):_0x16bf27=null;_0x1cbc47['qs']=_0x2cb298;break;case _0x2a06('0x13'):case _0x2a06('0x14'):if(_0x374e33[_0x2a06('0x15')]){try{_0x16bf27=JSON['parse'](Mustache[_0x2a06('0xf')](_0x374e33[_0x2a06('0x15')],_0x2cb298));_0x1cbc47[_0x2a06('0x16')]=_0x16bf27;}catch(_0x1d5329){logger[_0x2a06('0x17')](_0x1d5329[_0x2a06('0x10')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x16bf27=_0x2cb298;_0x1cbc47['body']=_0x16bf27;}break;}logger[_0x2a06('0x18')](util[_0x2a06('0x19')](_0x2a06('0x1a'),_0x374e33['data1'],_0x374e33[_0x2a06('0x9')],JSON[_0x2a06('0x1b')](_0x1cbc47)));rp(_0x1cbc47)[_0x2a06('0x1c')](function(_0x3999f1){_0x16bf27=!_[_0x2a06('0x1d')](_0x16bf27)?_0x2a06('0x1e')+_0x16bf27:'';_0xf9b7ab=typeof _0x3999f1['body']==='object'?JSON[_0x2a06('0x1b')](_0x3999f1[_0x2a06('0x16')]):_0x3999f1[_0x2a06('0x16')];logger['info'](util[_0x2a06('0x19')](_0x2a06('0x1f'),_0x374e33['data1'],_0x374e33[_0x2a06('0x9')],_0x3999f1[_0x2a06('0x20')],_0xf9b7ab));})[_0x2a06('0x21')](function(_0x3786f6){logger['error'](util[_0x2a06('0x19')](_0x2a06('0x22'),_0x374e33[_0x2a06('0x7')],_0x374e33[_0x2a06('0x9')],_0x3786f6[_0x2a06('0x20')],_0x3786f6['name'],_0x3786f6[_0x2a06('0x23')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index f752da2..b2cbcf5 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 _0x6548=['http','Request','request','debug','rpc','routing','error','message','catch','exports','jayson/promise','../../config/logger','client'];(function(_0x3a690e,_0x212e1e){var _0x5be711=function(_0x586765){while(--_0x586765){_0x3a690e['push'](_0x3a690e['shift']());}};_0x5be711(++_0x212e1e);}(_0x6548,0x190));var _0x8654=function(_0x23d923,_0x2850db){_0x23d923=_0x23d923-0x0;var _0x469b7e=_0x6548[_0x23d923];return _0x469b7e;};'use strict';var jayson=require(_0x8654('0x0'));var BPromise=require('bluebird');var logger=require(_0x8654('0x1'))('routing');var client=jayson[_0x8654('0x2')][_0x8654('0x3')]({'port':0x2329});client[_0x8654('0x4')]=function(_0x2d4e93,_0x218d55){return new BPromise(function(_0x21374b,_0x1d8077){return client[_0x8654('0x5')](_0x2d4e93,_0x218d55)['then'](function(_0x171cda){logger[_0x8654('0x6')](_0x8654('0x7'),_0x8654('0x8'),_0x2d4e93,_0x218d55,_0x171cda);if(_0x171cda[_0x8654('0x9')]){logger['error'](_0x8654('0x7'),_0x8654('0x8'),_0x2d4e93,_0x171cda[_0x8654('0x9')][_0x8654('0xa')],_0x218d55);return _0x1d8077(_0x171cda['error'][_0x8654('0xa')]);}else{return _0x21374b(_0x171cda['result']);}})[_0x8654('0xb')](function(_0x144591){logger[_0x8654('0x9')]('rpc',_0x8654('0x8'),_0x2d4e93,_0x144591,_0x218d55);return _0x1d8077(_0x144591);});});};module[_0x8654('0xc')]=client; \ No newline at end of file +var _0x80d9=['client','http','Request','request','then','rpc','routing','error','message','result','exports','bluebird','../../config/logger'];(function(_0x54ca16,_0x337f55){var _0x4cef16=function(_0x44434f){while(--_0x44434f){_0x54ca16['push'](_0x54ca16['shift']());}};_0x4cef16(++_0x337f55);}(_0x80d9,0xa7));var _0x980d=function(_0x420a37,_0x375920){_0x420a37=_0x420a37-0x0;var _0x3103c6=_0x80d9[_0x420a37];return _0x3103c6;};'use strict';var jayson=require('jayson/promise');var BPromise=require(_0x980d('0x0'));var logger=require(_0x980d('0x1'))('routing');var client=jayson[_0x980d('0x2')][_0x980d('0x3')]({'port':0x2329});client[_0x980d('0x4')]=function(_0x4dc40a,_0x4b2291){return new BPromise(function(_0x341fa1,_0x55f55f){return client[_0x980d('0x5')](_0x4dc40a,_0x4b2291)[_0x980d('0x6')](function(_0x2948a5){logger['debug'](_0x980d('0x7'),_0x980d('0x8'),_0x4dc40a,_0x4b2291,_0x2948a5);if(_0x2948a5[_0x980d('0x9')]){logger[_0x980d('0x9')](_0x980d('0x7'),_0x980d('0x8'),_0x4dc40a,_0x2948a5['error']['message'],_0x4b2291);return _0x55f55f(_0x2948a5['error'][_0x980d('0xa')]);}else{return _0x341fa1(_0x2948a5[_0x980d('0xb')]);}})['catch'](function(_0x4d5851){logger['error'](_0x980d('0x7'),_0x980d('0x8'),_0x4dc40a,_0x4d5851,_0x4b2291);return _0x55f55f(_0x4d5851);});});};module[_0x980d('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index f9a7146..34116be 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 _0xabc4=['mailAccounts','listen','getSettings','log','bluebird','./server','./lib/email','./rpc/mailAccount','./rpc/setting','resolve','getMailAccounts','then','initMailAccounts','refresh'];(function(_0x2f02a6,_0x590018){var _0x39b361=function(_0x19eb2a){while(--_0x19eb2a){_0x2f02a6['push'](_0x2f02a6['shift']());}};_0x39b361(++_0x590018);}(_0xabc4,0x146));var _0x4abc=function(_0x4ca29f,_0xbd0bdf){_0x4ca29f=_0x4ca29f-0x0;var _0xe8ce27=_0xabc4[_0x4ca29f];return _0xe8ce27;};'use strict';var BPromise=require(_0x4abc('0x0'));var server=require(_0x4abc('0x1'));var Realtime=require('./realtime');var EmailChannel=require(_0x4abc('0x2'));var mailAccount=require(_0x4abc('0x3'));var setting=require(_0x4abc('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0x4abc('0x5')]()['then'](mailAccount[_0x4abc('0x6')]())[_0x4abc('0x7')](realtime[_0x4abc('0x8')]())['then'](function(){email[_0x4abc('0x9')](realtime[_0x4abc('0xa')]);return realtime;});}function main(){return server[_0x4abc('0xb')](realtime,email)[_0x4abc('0x7')](function(){return initRealtime();})[_0x4abc('0x7')](function(){return setting[_0x4abc('0xc')]();})[_0x4abc('0x7')](function(_0x187322){return setInterval(initRealtime,_0x187322['loginMailFrequency']*0x3e8);})['catch'](function(_0x41e09f){console[_0x4abc('0xd')](_0x41e09f);});}main(); \ No newline at end of file +var _0x3f7c=['loginMailFrequency','catch','bluebird','./server','./realtime','./lib/email','./rpc/mailAccount','resolve','getMailAccounts','then','initMailAccounts','refresh','listen','getSettings'];(function(_0x5be0f7,_0x435f97){var _0x224e5c=function(_0x127d87){while(--_0x127d87){_0x5be0f7['push'](_0x5be0f7['shift']());}};_0x224e5c(++_0x435f97);}(_0x3f7c,0xaa));var _0xc3f7=function(_0x331652,_0x32e4cf){_0x331652=_0x331652-0x0;var _0x4a2713=_0x3f7c[_0x331652];return _0x4a2713;};'use strict';var BPromise=require(_0xc3f7('0x0'));var server=require(_0xc3f7('0x1'));var Realtime=require(_0xc3f7('0x2'));var EmailChannel=require(_0xc3f7('0x3'));var mailAccount=require(_0xc3f7('0x4'));var setting=require('./rpc/setting');var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return BPromise[_0xc3f7('0x5')]()['then'](mailAccount[_0xc3f7('0x6')]())[_0xc3f7('0x7')](realtime[_0xc3f7('0x8')]())[_0xc3f7('0x7')](function(){email[_0xc3f7('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xc3f7('0xa')](realtime,email)[_0xc3f7('0x7')](function(){return initRealtime();})[_0xc3f7('0x7')](function(){return setting[_0xc3f7('0xb')]();})[_0xc3f7('0x7')](function(_0x34530a){return setInterval(initRealtime,_0x34530a[_0xc3f7('0xc')]*0x3e8);})[_0xc3f7('0xd')](function(_0x39a3d4){console['log'](_0x39a3d4);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index ff4ef16..d255406 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 _0x9e80=['localhost','socket.io-emitter','./smtp','../rpc/mailAccount','info','mailAccounts','imapAccounts','smtp','prototype','name','key','Imap','status','messageStatus','total','isNil','emit','mailAccount:update','refresh','hasOwnProperty','active','box','handleImapBox','handleImapEmail','bind','error','handleImapError','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','stringify','handleImapEnd','lastSync','sendMail','send','verifySmtp','Smtp','verify','verified','exports','lodash','moment','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults'];(function(_0x45ecea,_0x267d8b){var _0x13de4e=function(_0x4e4097){while(--_0x4e4097){_0x45ecea['push'](_0x45ecea['shift']());}};_0x13de4e(++_0x267d8b);}(_0x9e80,0x1b7));var _0x09e8=function(_0x3e2610,_0x592d39){_0x3e2610=_0x3e2610-0x0;var _0x34cad1=_0x9e80[_0x3e2610];return _0x34cad1;};'use strict';var _=require(_0x09e8('0x0'));var moment=require(_0x09e8('0x1'));var BPromise=require('bluebird');var md5=require(_0x09e8('0x2'));var Redis=require(_0x09e8('0x3'));var config=require(_0x09e8('0x4'));var logger=require(_0x09e8('0x5'))(_0x09e8('0x6'));config[_0x09e8('0x7')]=_[_0x09e8('0x8')](config[_0x09e8('0x7')],{'host':_0x09e8('0x9'),'port':0x18eb});var io=require(_0x09e8('0xa'))(new Redis(config[_0x09e8('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0x09e8('0xb'));var mailAccount=require(_0x09e8('0xc'));var md5Accounts={};function EmailChannel(_0x1996b0){logger[_0x09e8('0xd')]('start\x20email\x20channel');this[_0x09e8('0xe')]=_0x1996b0[_0x09e8('0xe')];this[_0x09e8('0xf')]={};this[_0x09e8('0x10')]=new EmailSmtp();}EmailChannel[_0x09e8('0x11')]['emit']=function(_0x1d4120){var _0x319c06=this[_0x09e8('0xe')][_0x1d4120];var _0xc314cf={'id':_0x319c06['id'],'name':_0x319c06[_0x09e8('0x12')],'key':_0x319c06[_0x09e8('0x13')],'active':_0x319c06['active'],'Imap':{'status':_0x319c06[_0x09e8('0x14')][_0x09e8('0x15')],'messageStatus':_0x319c06[_0x09e8('0x14')][_0x09e8('0x16')],'total':_0x319c06['Imap'][_0x09e8('0x17')]}};if(_[_0x09e8('0x18')](md5Accounts[_0x1d4120])){md5Accounts[_0x1d4120]={};}var _0x430a9c=md5(JSON['stringify'](_0xc314cf));if(md5Accounts[_0x1d4120][_0x09e8('0x2')]!==_0x430a9c){md5Accounts[_0x1d4120][_0x09e8('0x2')]=_0x430a9c;io[_0x09e8('0x19')](_0x09e8('0x1a'),_0xc314cf);}};EmailChannel[_0x09e8('0x11')][_0x09e8('0x1b')]=function(_0x2d6014){for(var _0x25c8ea in _0x2d6014){if(_0x2d6014[_0x09e8('0x1c')](_0x25c8ea)){if(_0x2d6014[_0x25c8ea]['Imap']&&_0x2d6014[_0x25c8ea][_0x09e8('0x1d')]){var _0x1f2cb5=_0x2d6014[_0x25c8ea]['Imap'];if(!this[_0x09e8('0xf')]['hasOwnProperty'](_0x1f2cb5['id'])){this[_0x09e8('0xf')][_0x1f2cb5['id']]=new EmailImap(_0x1f2cb5,_0x2d6014[_0x25c8ea][_0x09e8('0x6')]);this[_0x09e8('0xf')][_0x1f2cb5['id']]['on'](_0x09e8('0x1e'),this[_0x09e8('0x1f')]['bind'](this,_0x25c8ea));this[_0x09e8('0xf')][_0x1f2cb5['id']]['on']('email',this[_0x09e8('0x20')][_0x09e8('0x21')](this,_0x25c8ea));this['imapAccounts'][_0x1f2cb5['id']]['on']('end',this['handleImapEnd'][_0x09e8('0x21')](this,_0x25c8ea));this['imapAccounts'][_0x1f2cb5['id']]['on'](_0x09e8('0x22'),this[_0x09e8('0x23')][_0x09e8('0x21')](this,_0x25c8ea));}}else{if(_[_0x09e8('0x18')](this['mailAccounts'][_0x25c8ea]['Imap'])){this[_0x09e8('0xe')][_0x25c8ea][_0x09e8('0x14')]={};}this['mailAccounts'][_0x25c8ea][_0x09e8('0x14')][_0x09e8('0x15')]=_0x09e8('0x24');this[_0x09e8('0xe')][_0x25c8ea]['Imap']['messageStatus']='';this[_0x09e8('0x19')](_0x25c8ea);}}}};EmailChannel[_0x09e8('0x11')]['handleImapBox']=function(_0x3407cc,_0x50af14){if(this[_0x09e8('0xe')][_0x3407cc]){this[_0x09e8('0xe')][_0x3407cc][_0x09e8('0x14')]['status']='connected';this[_0x09e8('0xe')][_0x3407cc]['Imap']['messageStatus']=_0x50af14[_0x09e8('0x12')];if(_0x50af14['messages']){this[_0x09e8('0xe')][_0x3407cc]['Imap'][_0x09e8('0x17')]=_0x50af14[_0x09e8('0x25')][_0x09e8('0x17')];}return this['emit'](_0x3407cc);}};EmailChannel['prototype']['handleImapEmail']=function(_0x258be0,_0x512777){logger['info'](_0x09e8('0x26'),_0x512777[_0x09e8('0x27')],_0x512777[_0x09e8('0x28')],_0x512777['from'],_0x258be0);if(this[_0x09e8('0xe')][_0x258be0]){return mailAccount[_0x09e8('0x29')](_0x258be0,_0x512777)[_0x09e8('0x2a')](function(_0x5b11d1){if(_0x5b11d1){logger[_0x09e8('0xd')](_0x09e8('0x2b'));}})[_0x09e8('0x2c')](function(_0x47c3cf){logger[_0x09e8('0x22')](_0x09e8('0x2d'),JSON[_0x09e8('0x2e')](_0x47c3cf));});}};EmailChannel[_0x09e8('0x11')][_0x09e8('0x2f')]=function(_0x1dcdf9){if(this[_0x09e8('0xe')][_0x1dcdf9]&&this[_0x09e8('0xe')][_0x1dcdf9][_0x09e8('0x14')]){if(this['imapAccounts'][this['mailAccounts'][_0x1dcdf9][_0x09e8('0x14')]['id']]){delete this['imapAccounts'][this[_0x09e8('0xe')][_0x1dcdf9][_0x09e8('0x14')]['id']];}this[_0x09e8('0xe')][_0x1dcdf9][_0x09e8('0x14')][_0x09e8('0x30')]=moment();this[_0x09e8('0x19')](_0x1dcdf9);}};EmailChannel[_0x09e8('0x11')][_0x09e8('0x23')]=function(_0x513e51,_0x47eca2){if(this[_0x09e8('0xe')][_0x513e51]){this['mailAccounts'][_0x513e51]['Imap'][_0x09e8('0x15')]=_0x09e8('0x22');this[_0x09e8('0xe')][_0x513e51]['Imap'][_0x09e8('0x16')]=_0x47eca2;return this['emit'](_0x513e51);}};EmailChannel[_0x09e8('0x11')][_0x09e8('0x31')]=function(_0x3cd429,_0x573d09){return this[_0x09e8('0x10')][_0x09e8('0x32')](_0x3cd429,_0x573d09);};EmailChannel[_0x09e8('0x11')][_0x09e8('0x33')]=function(_0x2ae8c6){var _0x4a5e86=this;if(this[_0x09e8('0xe')][_0x2ae8c6['id']]){if(_[_0x09e8('0x18')](this[_0x09e8('0xe')][_0x2ae8c6['id']]['Smtp'])){this[_0x09e8('0xe')][_0x2ae8c6['id']][_0x09e8('0x34')]={};}this[_0x09e8('0xe')][_0x2ae8c6['id']]['Smtp'][_0x09e8('0x30')]=moment();return new BPromise(function(_0x235442,_0x179f60){return _0x4a5e86[_0x09e8('0x10')][_0x09e8('0x35')](_0x2ae8c6)['then'](function(_0x5bc14d){_0x4a5e86[_0x09e8('0xe')][_0x2ae8c6['id']][_0x09e8('0x34')][_0x09e8('0x15')]=_0x09e8('0x36');_0x4a5e86[_0x09e8('0xe')][_0x2ae8c6['id']]['Smtp'][_0x09e8('0x16')]='';_0x4a5e86[_0x09e8('0x19')](_0x2ae8c6['id']);_0x235442(_0x5bc14d);})[_0x09e8('0x2c')](function(_0x29aa9f){_0x4a5e86[_0x09e8('0xe')][_0x2ae8c6['id']][_0x09e8('0x34')][_0x09e8('0x15')]=_0x09e8('0x22');_0x4a5e86[_0x09e8('0xe')][_0x2ae8c6['id']][_0x09e8('0x34')][_0x09e8('0x16')]=_0x29aa9f;_0x4a5e86[_0x09e8('0x19')](_0x2ae8c6['id']);_0x179f60(_0x29aa9f);});});}return this[_0x09e8('0x10')][_0x09e8('0x35')](_0x2ae8c6);};module[_0x09e8('0x37')]=EmailChannel; \ No newline at end of file +var _0x8739=['stringify','mailAccount:update','hasOwnProperty','active','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','handleImapError','disabled','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','from','then','Mail\x20accepted\x20from\x20routing','catch','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','sendMail','smtp','send','verifySmtp','Smtp','verify','exports','lodash','moment','bluebird','ioredis','../../../config/environment','../../../config/logger','email','defaults','redis','localhost','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','prototype','emit','name','key','Imap','status','messageStatus','total','isNil'];(function(_0x268db4,_0xb0b614){var _0x4a27c7=function(_0x49d718){while(--_0x49d718){_0x268db4['push'](_0x268db4['shift']());}};_0x4a27c7(++_0xb0b614);}(_0x8739,0x1a6));var _0x9873=function(_0x2746a8,_0x283ffb){_0x2746a8=_0x2746a8-0x0;var _0x150e65=_0x8739[_0x2746a8];return _0x150e65;};'use strict';var _=require(_0x9873('0x0'));var moment=require(_0x9873('0x1'));var BPromise=require(_0x9873('0x2'));var md5=require('md5');var Redis=require(_0x9873('0x3'));var config=require(_0x9873('0x4'));var logger=require(_0x9873('0x5'))(_0x9873('0x6'));config['redis']=_[_0x9873('0x7')](config[_0x9873('0x8')],{'host':_0x9873('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x9873('0x8')]));var EmailImap=require(_0x9873('0xa'));var EmailSmtp=require(_0x9873('0xb'));var mailAccount=require(_0x9873('0xc'));var md5Accounts={};function EmailChannel(_0x46e57f){logger[_0x9873('0xd')](_0x9873('0xe'));this[_0x9873('0xf')]=_0x46e57f[_0x9873('0xf')];this[_0x9873('0x10')]={};this['smtp']=new EmailSmtp();}EmailChannel[_0x9873('0x11')][_0x9873('0x12')]=function(_0x4e93a2){var _0x4cc4af=this['mailAccounts'][_0x4e93a2];var _0x9def87={'id':_0x4cc4af['id'],'name':_0x4cc4af[_0x9873('0x13')],'key':_0x4cc4af[_0x9873('0x14')],'active':_0x4cc4af['active'],'Imap':{'status':_0x4cc4af[_0x9873('0x15')][_0x9873('0x16')],'messageStatus':_0x4cc4af[_0x9873('0x15')][_0x9873('0x17')],'total':_0x4cc4af[_0x9873('0x15')][_0x9873('0x18')]}};if(_[_0x9873('0x19')](md5Accounts[_0x4e93a2])){md5Accounts[_0x4e93a2]={};}var _0x680e95=md5(JSON[_0x9873('0x1a')](_0x9def87));if(md5Accounts[_0x4e93a2]['md5']!==_0x680e95){md5Accounts[_0x4e93a2]['md5']=_0x680e95;io[_0x9873('0x12')](_0x9873('0x1b'),_0x9def87);}};EmailChannel[_0x9873('0x11')]['refresh']=function(_0x3824bf){for(var _0x719c80 in _0x3824bf){if(_0x3824bf[_0x9873('0x1c')](_0x719c80)){if(_0x3824bf[_0x719c80][_0x9873('0x15')]&&_0x3824bf[_0x719c80][_0x9873('0x1d')]){var _0x4a01c8=_0x3824bf[_0x719c80][_0x9873('0x15')];if(!this[_0x9873('0x10')][_0x9873('0x1c')](_0x4a01c8['id'])){this['imapAccounts'][_0x4a01c8['id']]=new EmailImap(_0x4a01c8,_0x3824bf[_0x719c80][_0x9873('0x6')]);this['imapAccounts'][_0x4a01c8['id']]['on'](_0x9873('0x1e'),this[_0x9873('0x1f')][_0x9873('0x20')](this,_0x719c80));this[_0x9873('0x10')][_0x4a01c8['id']]['on'](_0x9873('0x6'),this[_0x9873('0x21')]['bind'](this,_0x719c80));this[_0x9873('0x10')][_0x4a01c8['id']]['on'](_0x9873('0x22'),this[_0x9873('0x23')][_0x9873('0x20')](this,_0x719c80));this[_0x9873('0x10')][_0x4a01c8['id']]['on'](_0x9873('0x24'),this[_0x9873('0x25')][_0x9873('0x20')](this,_0x719c80));}}else{if(_[_0x9873('0x19')](this[_0x9873('0xf')][_0x719c80]['Imap'])){this[_0x9873('0xf')][_0x719c80][_0x9873('0x15')]={};}this['mailAccounts'][_0x719c80][_0x9873('0x15')][_0x9873('0x16')]=_0x9873('0x26');this[_0x9873('0xf')][_0x719c80][_0x9873('0x15')][_0x9873('0x17')]='';this[_0x9873('0x12')](_0x719c80);}}}};EmailChannel[_0x9873('0x11')]['handleImapBox']=function(_0x4dc8ec,_0x30f62e){if(this[_0x9873('0xf')][_0x4dc8ec]){this['mailAccounts'][_0x4dc8ec][_0x9873('0x15')][_0x9873('0x16')]='connected';this[_0x9873('0xf')][_0x4dc8ec][_0x9873('0x15')][_0x9873('0x17')]=_0x30f62e[_0x9873('0x13')];if(_0x30f62e[_0x9873('0x27')]){this[_0x9873('0xf')][_0x4dc8ec][_0x9873('0x15')][_0x9873('0x18')]=_0x30f62e[_0x9873('0x27')][_0x9873('0x18')];}return this[_0x9873('0x12')](_0x4dc8ec);}};EmailChannel['prototype'][_0x9873('0x21')]=function(_0x971bfc,_0x29a49e){logger['info'](_0x9873('0x28'),_0x29a49e[_0x9873('0x29')],_0x29a49e[_0x9873('0x2a')],_0x29a49e[_0x9873('0x2b')],_0x971bfc);if(this[_0x9873('0xf')][_0x971bfc]){return mailAccount['notify'](_0x971bfc,_0x29a49e)[_0x9873('0x2c')](function(_0x2f3695){if(_0x2f3695){logger[_0x9873('0xd')](_0x9873('0x2d'));}})[_0x9873('0x2e')](function(_0x52057d){logger['error'](_0x9873('0x2f'),JSON['stringify'](_0x52057d));});}};EmailChannel[_0x9873('0x11')][_0x9873('0x23')]=function(_0x22a64d){if(this[_0x9873('0xf')][_0x22a64d]&&this[_0x9873('0xf')][_0x22a64d]['Imap']){if(this[_0x9873('0x10')][this[_0x9873('0xf')][_0x22a64d][_0x9873('0x15')]['id']]){delete this[_0x9873('0x10')][this[_0x9873('0xf')][_0x22a64d][_0x9873('0x15')]['id']];}this['mailAccounts'][_0x22a64d][_0x9873('0x15')][_0x9873('0x30')]=moment();this[_0x9873('0x12')](_0x22a64d);}};EmailChannel[_0x9873('0x11')][_0x9873('0x25')]=function(_0x41b9b0,_0x344de3){if(this[_0x9873('0xf')][_0x41b9b0]){this[_0x9873('0xf')][_0x41b9b0][_0x9873('0x15')][_0x9873('0x16')]=_0x9873('0x24');this[_0x9873('0xf')][_0x41b9b0][_0x9873('0x15')][_0x9873('0x17')]=_0x344de3;return this[_0x9873('0x12')](_0x41b9b0);}};EmailChannel['prototype'][_0x9873('0x31')]=function(_0x2e3bfd,_0x4eedfa){return this[_0x9873('0x32')][_0x9873('0x33')](_0x2e3bfd,_0x4eedfa);};EmailChannel[_0x9873('0x11')][_0x9873('0x34')]=function(_0x586808){var _0x581478=this;if(this['mailAccounts'][_0x586808['id']]){if(_['isNil'](this[_0x9873('0xf')][_0x586808['id']][_0x9873('0x35')])){this[_0x9873('0xf')][_0x586808['id']][_0x9873('0x35')]={};}this['mailAccounts'][_0x586808['id']][_0x9873('0x35')][_0x9873('0x30')]=moment();return new BPromise(function(_0x9e36a5,_0x57ad98){return _0x581478[_0x9873('0x32')][_0x9873('0x36')](_0x586808)[_0x9873('0x2c')](function(_0x124ffd){_0x581478['mailAccounts'][_0x586808['id']][_0x9873('0x35')][_0x9873('0x16')]='verified';_0x581478['mailAccounts'][_0x586808['id']][_0x9873('0x35')]['messageStatus']='';_0x581478[_0x9873('0x12')](_0x586808['id']);_0x9e36a5(_0x124ffd);})[_0x9873('0x2e')](function(_0x5ba300){_0x581478[_0x9873('0xf')][_0x586808['id']][_0x9873('0x35')][_0x9873('0x16')]='error';_0x581478[_0x9873('0xf')][_0x586808['id']]['Smtp'][_0x9873('0x17')]=_0x5ba300;_0x581478[_0x9873('0x12')](_0x586808['id']);_0x57ad98(_0x5ba300);});});}return this[_0x9873('0x32')][_0x9873('0x36')](_0x586808);};module[_0x9873('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 91a36f1..60af7d7 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 _0x2123=['authTimeout','isNil','service','authentication','user','password','port','tls','autotls','required','host','getHost','anonymous@xcally.com','handleOpenBox','emit','box','handleCloseBox','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','handleFetchMessage','handleFetchEnd','closeBox','handleMessageBody','handleMessageAttributes','handleMessageEnd','handleSimpleParser','handleFetchError','stringify','textCode','hasOwnProperty','path','util','imap','lodash','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','./utils','email','INBOX','getAccount','account','handleReady','bind','once','end','handleEnd','error','handleError','connect','inherits','prototype','connTimeout'];(function(_0x542ba4,_0x118d31){var _0x34bf34=function(_0x4d7ae2){while(--_0x4d7ae2){_0x542ba4['push'](_0x542ba4['shift']());}};_0x34bf34(++_0x118d31);}(_0x2123,0x190));var _0x3212=function(_0x50fe2f,_0x2f1d84){_0x50fe2f=_0x50fe2f-0x0;var _0x4cd216=_0x2123[_0x50fe2f];return _0x4cd216;};'use strict';var fs=require('fs');var path=require(_0x3212('0x0'));var util=require(_0x3212('0x1'));var Imap=require(_0x3212('0x2'));var _=require(_0x3212('0x3'));var rs=require(_0x3212('0x4'));var simpleParser=require(_0x3212('0x5'))[_0x3212('0x6')];var Iconv=require(_0x3212('0x7'))[_0x3212('0x8')];var EventEmitter=require(_0x3212('0x9'))[_0x3212('0xa')];var utils=require(_0x3212('0xb'));var logger=require('../../../config/logger')(_0x3212('0xc'));function EmailImap(_0x2b1302,_0x1fec5d){this['mailbox']=_0x3212('0xd');this['account']=this[_0x3212('0xe')](_0x2b1302,_0x1fec5d);this[_0x3212('0x2')]=new Imap(this[_0x3212('0xf')]);this[_0x3212('0x2')]['once']('ready',this[_0x3212('0x10')][_0x3212('0x11')](this));this[_0x3212('0x2')][_0x3212('0x12')](_0x3212('0x13'),this[_0x3212('0x14')][_0x3212('0x11')](this));this[_0x3212('0x2')]['on'](_0x3212('0x15'),this[_0x3212('0x16')][_0x3212('0x11')](this));this[_0x3212('0x2')][_0x3212('0x17')]();}util[_0x3212('0x18')](EmailImap,EventEmitter);EmailImap[_0x3212('0x19')][_0x3212('0xe')]=function(_0x17f8f9,_0x1bfe20){var _0x19edfb={'connTimeout':_0x17f8f9[_0x3212('0x1a')]?_0x17f8f9[_0x3212('0x1a')]*0x3e8:0x2710,'authTimeout':_0x17f8f9[_0x3212('0x1b')]?_0x17f8f9['authTimeout']*0x3e8:0x1388};if(_[_0x3212('0x1c')](_0x17f8f9[_0x3212('0x1d')])){if(_0x17f8f9[_0x3212('0x1e')]){_0x19edfb[_0x3212('0x1f')]=_0x17f8f9[_0x3212('0x1f')];_0x19edfb[_0x3212('0x20')]=_0x17f8f9[_0x3212('0x20')];}_0x19edfb['host']=_0x17f8f9['host'];_0x19edfb[_0x3212('0x21')]=_0x17f8f9['port']||0x3e1;if(_0x17f8f9[_0x3212('0x22')]){_0x19edfb[_0x3212('0x22')]=!![];}else{_0x19edfb[_0x3212('0x22')]=![];_0x19edfb[_0x3212('0x23')]=_0x3212('0x24');}}else{_0x19edfb['user']=_0x17f8f9[_0x3212('0x1f')];_0x19edfb[_0x3212('0x20')]=_0x17f8f9['password'];_0x19edfb[_0x3212('0x25')]=utils[_0x3212('0x26')](_0x17f8f9[_0x3212('0x1d')]);_0x19edfb['port']=0x3e1;_0x19edfb['tls']=!![];}_0x19edfb[_0x3212('0xc')]=_0x1bfe20||_0x17f8f9[_0x3212('0x1f')]||_0x3212('0x27');return _0x19edfb;};EmailImap[_0x3212('0x19')][_0x3212('0x10')]=function(){this[_0x3212('0x2')]['openBox'](this['mailbox'],![],this[_0x3212('0x28')]['bind'](this));};EmailImap[_0x3212('0x19')][_0x3212('0x28')]=function(_0x3319d0,_0x5bb0a5){if(_0x3319d0){this[_0x3212('0x16')](_0x3319d0,!![]);}else{this[_0x3212('0x29')](_0x3212('0x2a'),_0x5bb0a5);this['readUnseen']();}};EmailImap[_0x3212('0x19')][_0x3212('0x2b')]=function(_0x108eee){if(_0x108eee){this[_0x3212('0x16')](_0x108eee,!![]);}else{this[_0x3212('0x2')][_0x3212('0x13')]();}};EmailImap[_0x3212('0x19')][_0x3212('0x2c')]=function(){this[_0x3212('0x2')][_0x3212('0x2d')]([_0x3212('0x2e')],this[_0x3212('0x2f')]['bind'](this));};EmailImap[_0x3212('0x19')][_0x3212('0x2f')]=function(_0x4726fb,_0x1cbab5){if(_0x4726fb){this[_0x3212('0x16')](_0x4726fb,!![]);}else{if(_0x1cbab5[_0x3212('0x30')]){try{var _0x3a7883=this['imap'][_0x3212('0x31')](_0x1cbab5,{'bodies':'','markSeen':!![]});_0x3a7883['on']('message',this[_0x3212('0x32')]['bind'](this));_0x3a7883[_0x3212('0x12')]('error',this['handleFetchError'][_0x3212('0x11')](this));_0x3a7883['once'](_0x3212('0x13'),this[_0x3212('0x33')][_0x3212('0x11')](this));}catch(_0x4cbd23){logger[_0x3212('0x15')](_0x4cbd23);}}else{this[_0x3212('0x2')][_0x3212('0x34')](!![],this['handleCloseBox'][_0x3212('0x11')](this));}}};EmailImap[_0x3212('0x19')][_0x3212('0x32')]=function(_0x2b5d04,_0xc690c4){_0x2b5d04['on']('body',this[_0x3212('0x35')][_0x3212('0x11')](this));_0x2b5d04[_0x3212('0x12')]('attributes',this[_0x3212('0x36')][_0x3212('0x11')](this));_0x2b5d04[_0x3212('0x12')](_0x3212('0x13'),this['handleMessageEnd'][_0x3212('0x11')](this));};EmailImap[_0x3212('0x19')][_0x3212('0x35')]=function(_0x39ffd0,_0x5ae0cc){simpleParser(_0x39ffd0,{'Iconv':Iconv},this['handleSimpleParser']['bind'](this));};EmailImap['prototype'][_0x3212('0x36')]=function(_0x436a80){};EmailImap[_0x3212('0x19')][_0x3212('0x37')]=function(){};EmailImap['prototype'][_0x3212('0x38')]=function(_0x3f2505,_0x18e20){if(_0x3f2505){logger[_0x3212('0x15')](_0x3f2505);}else{var _0x5914bf=this;utils['parser'](this[_0x3212('0xf')],_0x18e20,function(_0x17f515){_0x5914bf[_0x3212('0x29')](_0x3212('0xc'),_0x17f515);});}};EmailImap[_0x3212('0x19')][_0x3212('0x33')]=function(){this[_0x3212('0x2')]['closeBox'](!![],this[_0x3212('0x2b')][_0x3212('0x11')](this));};EmailImap[_0x3212('0x19')][_0x3212('0x39')]=function(_0x483cf9){this[_0x3212('0x16')](_0x483cf9);this[_0x3212('0x2')][_0x3212('0x34')](!![],this[_0x3212('0x2b')]['bind'](this));};EmailImap[_0x3212('0x19')]['handleEnd']=function(){this[_0x3212('0x29')](_0x3212('0x13'));};EmailImap[_0x3212('0x19')][_0x3212('0x16')]=function(_0x9a24e3,_0x216469){logger[_0x3212('0x15')](_0x3212('0x16'),this['account'][_0x3212('0xc')],JSON[_0x3212('0x3a')](_0x9a24e3));var _0x3e6dc1='';if(_0x9a24e3){if(_0x9a24e3[_0x3212('0x3b')]){_0x3e6dc1=_0x9a24e3[_0x3212('0x3b')];}else{for(var _0x36ccb2 in _0x9a24e3){if(_0x9a24e3[_0x3212('0x3c')](_0x36ccb2)){_0x3e6dc1+=_['upperFirst'](_0x36ccb2)+':\x20'+_0x9a24e3[_0x36ccb2]+'\x0a';}}}}if(_0x216469){this[_0x3212('0x2')][_0x3212('0x13')]();}else{this[_0x3212('0x29')](_0x3212('0x15'),_0x3e6dc1);this['emit']('end');}};module['exports']=EmailImap; \ No newline at end of file +var _0x54ef=['attributes','handleMessageEnd','handleMessageBody','handleSimpleParser','handleMessageAttributes','error','parser','account','closeBox','stringify','textCode','hasOwnProperty','upperFirst','exports','path','util','imap','randomstring','mailparser','simpleParser','iconv','Iconv','events','EventEmitter','email','INBOX','getAccount','once','ready','handleReady','end','handleEnd','bind','connect','inherits','connTimeout','authTimeout','authentication','user','password','host','port','tls','required','getHost','service','anonymous@xcally.com','openBox','mailbox','handleOpenBox','prototype','handleError','emit','box','readUnseen','search','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchError','handleFetchEnd','handleCloseBox'];(function(_0x2d6f5a,_0x22580d){var _0x31eded=function(_0x5cb557){while(--_0x5cb557){_0x2d6f5a['push'](_0x2d6f5a['shift']());}};_0x31eded(++_0x22580d);}(_0x54ef,0x112));var _0xf54e=function(_0x6b0623,_0x420379){_0x6b0623=_0x6b0623-0x0;var _0x45ed33=_0x54ef[_0x6b0623];return _0x45ed33;};'use strict';var fs=require('fs');var path=require(_0xf54e('0x0'));var util=require(_0xf54e('0x1'));var Imap=require(_0xf54e('0x2'));var _=require('lodash');var rs=require(_0xf54e('0x3'));var simpleParser=require(_0xf54e('0x4'))[_0xf54e('0x5')];var Iconv=require(_0xf54e('0x6'))[_0xf54e('0x7')];var EventEmitter=require(_0xf54e('0x8'))[_0xf54e('0x9')];var utils=require('./utils');var logger=require('../../../config/logger')(_0xf54e('0xa'));function EmailImap(_0x99cf9,_0x2464ae){this['mailbox']=_0xf54e('0xb');this['account']=this[_0xf54e('0xc')](_0x99cf9,_0x2464ae);this[_0xf54e('0x2')]=new Imap(this['account']);this[_0xf54e('0x2')][_0xf54e('0xd')](_0xf54e('0xe'),this[_0xf54e('0xf')]['bind'](this));this[_0xf54e('0x2')][_0xf54e('0xd')](_0xf54e('0x10'),this[_0xf54e('0x11')]['bind'](this));this[_0xf54e('0x2')]['on']('error',this['handleError'][_0xf54e('0x12')](this));this[_0xf54e('0x2')][_0xf54e('0x13')]();}util[_0xf54e('0x14')](EmailImap,EventEmitter);EmailImap['prototype'][_0xf54e('0xc')]=function(_0x1bbeaa,_0x1855fe){var _0x15f639={'connTimeout':_0x1bbeaa['connTimeout']?_0x1bbeaa[_0xf54e('0x15')]*0x3e8:0x2710,'authTimeout':_0x1bbeaa[_0xf54e('0x16')]?_0x1bbeaa[_0xf54e('0x16')]*0x3e8:0x1388};if(_['isNil'](_0x1bbeaa['service'])){if(_0x1bbeaa[_0xf54e('0x17')]){_0x15f639[_0xf54e('0x18')]=_0x1bbeaa[_0xf54e('0x18')];_0x15f639[_0xf54e('0x19')]=_0x1bbeaa[_0xf54e('0x19')];}_0x15f639[_0xf54e('0x1a')]=_0x1bbeaa[_0xf54e('0x1a')];_0x15f639[_0xf54e('0x1b')]=_0x1bbeaa[_0xf54e('0x1b')]||0x3e1;if(_0x1bbeaa[_0xf54e('0x1c')]){_0x15f639[_0xf54e('0x1c')]=!![];}else{_0x15f639['tls']=![];_0x15f639['autotls']=_0xf54e('0x1d');}}else{_0x15f639['user']=_0x1bbeaa[_0xf54e('0x18')];_0x15f639[_0xf54e('0x19')]=_0x1bbeaa[_0xf54e('0x19')];_0x15f639[_0xf54e('0x1a')]=utils[_0xf54e('0x1e')](_0x1bbeaa[_0xf54e('0x1f')]);_0x15f639[_0xf54e('0x1b')]=0x3e1;_0x15f639[_0xf54e('0x1c')]=!![];}_0x15f639[_0xf54e('0xa')]=_0x1855fe||_0x1bbeaa[_0xf54e('0x18')]||_0xf54e('0x20');return _0x15f639;};EmailImap['prototype'][_0xf54e('0xf')]=function(){this['imap'][_0xf54e('0x21')](this[_0xf54e('0x22')],![],this[_0xf54e('0x23')][_0xf54e('0x12')](this));};EmailImap[_0xf54e('0x24')][_0xf54e('0x23')]=function(_0x1e08d1,_0x43488d){if(_0x1e08d1){this[_0xf54e('0x25')](_0x1e08d1,!![]);}else{this[_0xf54e('0x26')](_0xf54e('0x27'),_0x43488d);this[_0xf54e('0x28')]();}};EmailImap[_0xf54e('0x24')]['handleCloseBox']=function(_0xb3706e){if(_0xb3706e){this['handleError'](_0xb3706e,!![]);}else{this[_0xf54e('0x2')]['end']();}};EmailImap[_0xf54e('0x24')][_0xf54e('0x28')]=function(){this[_0xf54e('0x2')][_0xf54e('0x29')]([_0xf54e('0x2a')],this[_0xf54e('0x2b')][_0xf54e('0x12')](this));};EmailImap['prototype']['handleReadUnseen']=function(_0x2f96b1,_0x258d29){if(_0x2f96b1){this[_0xf54e('0x25')](_0x2f96b1,!![]);}else{if(_0x258d29[_0xf54e('0x2c')]){try{var _0xb2d4c4=this[_0xf54e('0x2')][_0xf54e('0x2d')](_0x258d29,{'bodies':'','markSeen':!![]});_0xb2d4c4['on'](_0xf54e('0x2e'),this[_0xf54e('0x2f')][_0xf54e('0x12')](this));_0xb2d4c4['once']('error',this[_0xf54e('0x30')][_0xf54e('0x12')](this));_0xb2d4c4['once'](_0xf54e('0x10'),this[_0xf54e('0x31')][_0xf54e('0x12')](this));}catch(_0x52ab49){logger['error'](_0x52ab49);}}else{this['imap']['closeBox'](!![],this[_0xf54e('0x32')][_0xf54e('0x12')](this));}}};EmailImap[_0xf54e('0x24')][_0xf54e('0x2f')]=function(_0x29dc39,_0x3a2104){_0x29dc39['on']('body',this['handleMessageBody']['bind'](this));_0x29dc39[_0xf54e('0xd')](_0xf54e('0x33'),this['handleMessageAttributes']['bind'](this));_0x29dc39[_0xf54e('0xd')](_0xf54e('0x10'),this[_0xf54e('0x34')]['bind'](this));};EmailImap[_0xf54e('0x24')][_0xf54e('0x35')]=function(_0x50aeca,_0x38d7a0){simpleParser(_0x50aeca,{'Iconv':Iconv},this[_0xf54e('0x36')][_0xf54e('0x12')](this));};EmailImap[_0xf54e('0x24')][_0xf54e('0x37')]=function(_0x199056){};EmailImap['prototype']['handleMessageEnd']=function(){};EmailImap[_0xf54e('0x24')][_0xf54e('0x36')]=function(_0x46c51a,_0x4b1f84){if(_0x46c51a){logger[_0xf54e('0x38')](_0x46c51a);}else{var _0x22fa6f=this;utils[_0xf54e('0x39')](this[_0xf54e('0x3a')],_0x4b1f84,function(_0x361e4c){_0x22fa6f[_0xf54e('0x26')](_0xf54e('0xa'),_0x361e4c);});}};EmailImap[_0xf54e('0x24')][_0xf54e('0x31')]=function(){this[_0xf54e('0x2')][_0xf54e('0x3b')](!![],this[_0xf54e('0x32')][_0xf54e('0x12')](this));};EmailImap[_0xf54e('0x24')][_0xf54e('0x30')]=function(_0x5085c1){this['handleError'](_0x5085c1);this['imap'][_0xf54e('0x3b')](!![],this[_0xf54e('0x32')]['bind'](this));};EmailImap[_0xf54e('0x24')][_0xf54e('0x11')]=function(){this[_0xf54e('0x26')]('end');};EmailImap[_0xf54e('0x24')][_0xf54e('0x25')]=function(_0x1e016e,_0x794be7){logger[_0xf54e('0x38')](_0xf54e('0x25'),this[_0xf54e('0x3a')][_0xf54e('0xa')],JSON[_0xf54e('0x3c')](_0x1e016e));var _0x47bedd='';if(_0x1e016e){if(_0x1e016e[_0xf54e('0x3d')]){_0x47bedd=_0x1e016e[_0xf54e('0x3d')];}else{for(var _0x40df32 in _0x1e016e){if(_0x1e016e[_0xf54e('0x3e')](_0x40df32)){_0x47bedd+=_[_0xf54e('0x3f')](_0x40df32)+':\x20'+_0x1e016e[_0x40df32]+'\x0a';}}}}if(_0x794be7){this[_0xf54e('0x2')]['end']();}else{this[_0xf54e('0x26')]('error',_0x47bedd);this[_0xf54e('0x26')]('end');}};module[_0xf54e('0x40')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 4cee9df..e210669 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 _0x2d36=['prototype','verify','createTransport','Not\x20verifired','bluebird','nodemailer-plugin-inline-base64','send','use','compile','sendMail','toString'];(function(_0x59bcb1,_0x5a4b6c){var _0x4a737f=function(_0x546a49){while(--_0x546a49){_0x59bcb1['push'](_0x59bcb1['shift']());}};_0x4a737f(++_0x5a4b6c);}(_0x2d36,0xa9));var _0x62d3=function(_0x4cbc81,_0x51dac2){_0x4cbc81=_0x4cbc81-0x0;var _0x14dda0=_0x2d36[_0x4cbc81];return _0x14dda0;};'use strict';var nodemailer=require('nodemailer');var BPromise=require(_0x62d3('0x0'));var inlineBase64=require(_0x62d3('0x1'));function EmailSmtp(){}EmailSmtp['prototype'][_0x62d3('0x2')]=function(_0x28d29a,_0x21928a){return new BPromise(function(_0x1d095d,_0x1ab00a){var _0x49aa44=nodemailer['createTransport'](_0x28d29a);_0x49aa44[_0x62d3('0x3')](_0x62d3('0x4'),inlineBase64());_0x49aa44[_0x62d3('0x5')](_0x21928a,function(_0x16eddc,_0x17dcbc){if(_0x16eddc){_0x1ab00a(_0x16eddc[_0x62d3('0x6')]());}else{_0x1d095d(_0x17dcbc);}});});};EmailSmtp[_0x62d3('0x7')][_0x62d3('0x8')]=function(_0x337210){return new BPromise(function(_0x9811a0,_0x9dd7ac){var _0x2c38dc=nodemailer[_0x62d3('0x9')](_0x337210);_0x2c38dc[_0x62d3('0x8')](function(_0x492d30,_0xa1ce4){if(_0x492d30){_0x9dd7ac(_0x492d30[_0x62d3('0x6')]());}else{if(_0xa1ce4){_0x9811a0(_0xa1ce4);}else{_0x9dd7ac(_0x62d3('0xa'));}}});});};module['exports']=EmailSmtp; \ No newline at end of file +var _0x5007=['exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','toString','verify','Not\x20verifired'];(function(_0x38b9d8,_0x36ae03){var _0xeb62d0=function(_0x399214){while(--_0x399214){_0x38b9d8['push'](_0x38b9d8['shift']());}};_0xeb62d0(++_0x36ae03);}(_0x5007,0xfe));var _0x7500=function(_0x7166ff,_0x535b2a){_0x7166ff=_0x7166ff-0x0;var _0x11ffdf=_0x5007[_0x7166ff];return _0x11ffdf;};'use strict';var nodemailer=require(_0x7500('0x0'));var BPromise=require('bluebird');var inlineBase64=require(_0x7500('0x1'));function EmailSmtp(){}EmailSmtp[_0x7500('0x2')][_0x7500('0x3')]=function(_0x2ef298,_0x1925a5){return new BPromise(function(_0x1b636e,_0x55fd27){var _0x5b4a79=nodemailer[_0x7500('0x4')](_0x2ef298);_0x5b4a79[_0x7500('0x5')](_0x7500('0x6'),inlineBase64());_0x5b4a79['sendMail'](_0x1925a5,function(_0x4b6d90,_0x929f2){if(_0x4b6d90){_0x55fd27(_0x4b6d90[_0x7500('0x7')]());}else{_0x1b636e(_0x929f2);}});});};EmailSmtp[_0x7500('0x2')][_0x7500('0x8')]=function(_0x735f75){return new BPromise(function(_0x56fc73,_0x2d3ffc){var _0x24e0f2=nodemailer[_0x7500('0x4')](_0x735f75);_0x24e0f2[_0x7500('0x8')](function(_0x5dd3d5,_0xcfc5e9){if(_0x5dd3d5){_0x2d3ffc(_0x5dd3d5['toString']());}else{if(_0xcfc5e9){_0x56fc73(_0xcfc5e9);}else{_0x2d3ffc(_0x7500('0x9'));}}});});};module[_0x7500('0xa')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 8db1e8d..c06ba7b 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 _0x282b=['\x20]','body','textAsHtml','message','originTo','originCc','attachment','format','now','root','server/files/attachments/','content','push','contentType','from','subject','messageId','inReplyTo','date','YYYY-MM-DD\x20HH:mm:ss','filter','application/ms-tnef','info','Email\x20message\x20%s\x20is\x20in\x20TNEF\x20format:\x20message\x20content\x20will\x20be\x20converted\x20by\x20the\x20system','parseBuffer','first','BodyHTML','

Empty\x20message

','Attachments','Title','Data','getHost','gmail','imap.gmail.com','yahoo','hotmail','outlook365','127.0.0.1','lodash','moment','randomstring','path','util','email','head','value','address','@xcally.com','name','length','slice','join','Anonymous','isEmpty','generate','html','test','replace','includes','\x20[Attachment:\x20'];(function(_0x394b23,_0x36d244){var _0xccfc8b=function(_0x2609f6){while(--_0x2609f6){_0x394b23['push'](_0x394b23['shift']());}};_0xccfc8b(++_0x36d244);}(_0x282b,0xec));var _0xb282=function(_0xc56138,_0x2167fe){_0xc56138=_0xc56138-0x0;var _0x3c3413=_0x282b[_0xc56138];return _0x3c3413;};'use strict';var _=require(_0xb282('0x0'));var moment=require(_0xb282('0x1'));var random=require(_0xb282('0x2'));var fs=require('fs');var path=require(_0xb282('0x3'));var util=require(_0xb282('0x4'));var tnef=require('node-tnef');var logger=require('../../../config/logger')(_0xb282('0x5'));var config=require('../../../config/environment');function getAddress(_0x3fbbaf){var _0x175c83=_[_0xb282('0x6')](_0x3fbbaf[_0xb282('0x7')]);return _0x175c83&&_0x175c83[_0xb282('0x8')]?_0x175c83[_0xb282('0x8')]:'anonymous'+random['generate'](0x6)+_0xb282('0x9');}function getFirstName(_0x436eaa){var _0x4ef1c3=_[_0xb282('0x6')](_0x436eaa[_0xb282('0x7')]);if(_0x4ef1c3&&_0x4ef1c3[_0xb282('0xa')]){var _0x2d86ba=_0x4ef1c3['name']['split'](/\s+/);return _0x2d86ba[_0xb282('0xb')]?_0x2d86ba[_0xb282('0xc')](0x0,-0x1)[_0xb282('0xd')]('\x20'):_0x4ef1c3[_0xb282('0xa')];}return _0xb282('0xe');}function getLastName(_0x5f1c71){var _0x5d52d2=_[_0xb282('0x6')](_0x5f1c71[_0xb282('0x7')]);if(_0x5d52d2&&_0x5d52d2[_0xb282('0xa')]){var _0x9e9072=_0x5d52d2[_0xb282('0xa')]['split'](/\s+/);return _0x9e9072[_0xb282('0xb')]>0x1?_0x9e9072['pop']():'';}return'';}function getMails(_0xe1d53,_0x211862){var _0x4af892='';for(var _0x525cfa=0x0;_0x525cfa<_0x211862['value'][_0xb282('0xb')];_0x525cfa+=0x1){if(_0x211862[_0xb282('0x7')][_0x525cfa][_0xb282('0x8')]!==_0xe1d53){if(!_[_0xb282('0xf')](_0x4af892)){_0x4af892+=',';}_0x4af892+=_0x211862[_0xb282('0x7')][_0x525cfa]['name']||_0x211862[_0xb282('0x7')][_0x525cfa][_0xb282('0x8')]||'';_0x4af892+='\x20<';_0x4af892+=_0x211862[_0xb282('0x7')][_0x525cfa][_0xb282('0x8')]?_0x211862[_0xb282('0x7')][_0x525cfa]['address']:'anonymous'+random[_0xb282('0x10')](0x6)+_0xb282('0x9');_0x4af892+='>';}}return _0x4af892;}function parseEmail(_0x599f9e,_0x89543a,_0x34b6c7){if(_0x89543a[_0xb282('0x11')]){var _0x438dbe=/)<[^<]*)*<\/script>/gi;while(_0x438dbe[_0xb282('0x12')](_0x89543a['html'])){_0x89543a[_0xb282('0x11')]=_0x89543a[_0xb282('0x11')][_0xb282('0x13')](_0x438dbe,'');}if(_0x89543a['html'][_0xb282('0x14')](_0xb282('0x15'))){var _0x3c55ad=[];_0x89543a[_0xb282('0x16')][_0xb282('0x17')](_0x56645f=>{_0x3c55ad['push'](_0x56645f[_0xb282('0x18')]);});var _0x3c7f1f=/]+>/g;var _0x4934f0=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x5e828e=_0x89543a[_0xb282('0x11')][_0xb282('0x13')](_0x4934f0,_0xb282('0x19'));var _0x3c4018=_0x5e828e[_0xb282('0x13')](_0x3c7f1f,_0xb282('0x1a'));for(let _0x5b1d3d=0x0;_0x5b1d3d<_0x3c55ad[_0xb282('0xb')];_0x5b1d3d++){var _0x42015c=_0x3c4018['replace'](_0xb282('0x1a'),_0xb282('0x1b')+_0x3c55ad[_0x5b1d3d]+_0xb282('0x1c'));_0x3c4018=_0x42015c;}_0x89543a[_0xb282('0x11')]=_0x3c4018;}_0x34b6c7['body']=_0x89543a[_0xb282('0x11')];}else{_0x34b6c7[_0xb282('0x1d')]=_0x89543a[_0xb282('0x1e')];}if(_0x34b6c7[_0xb282('0x1d')]){_0x34b6c7[_0xb282('0x1d')]=_0x34b6c7[_0xb282('0x1d')][_0xb282('0x13')](/Empty\x20message

','getHost','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','imap-mail.outlook.com','outlook365','outlook.office365.com','127.0.0.1','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','address','anonymous','generate','@xcally.com','value','name','slice','join','pop','length','isEmpty','html','test','includes','\x20[Attachment:\x20','\x20]','textAsHtml','body','0x1?_0x5e662e[_0x8ea2('0x11')]():'';}return'';}function getMails(_0x4726a7,_0x416bae){var _0x78669a='';for(var _0x393faf=0x0;_0x393faf<_0x416bae[_0x8ea2('0xd')][_0x8ea2('0x12')];_0x393faf+=0x1){if(_0x416bae[_0x8ea2('0xd')][_0x393faf][_0x8ea2('0x9')]!==_0x4726a7){if(!_[_0x8ea2('0x13')](_0x78669a)){_0x78669a+=',';}_0x78669a+=_0x416bae[_0x8ea2('0xd')][_0x393faf][_0x8ea2('0xe')]||_0x416bae[_0x8ea2('0xd')][_0x393faf][_0x8ea2('0x9')]||'';_0x78669a+='\x20<';_0x78669a+=_0x416bae[_0x8ea2('0xd')][_0x393faf][_0x8ea2('0x9')]?_0x416bae[_0x8ea2('0xd')][_0x393faf][_0x8ea2('0x9')]:_0x8ea2('0xa')+random[_0x8ea2('0xb')](0x6)+_0x8ea2('0xc');_0x78669a+='>';}}return _0x78669a;}function parseEmail(_0x287597,_0x52b58c,_0x4be7c9){if(_0x52b58c[_0x8ea2('0x14')]){var _0x248c18=/)<[^<]*)*<\/script>/gi;while(_0x248c18[_0x8ea2('0x15')](_0x52b58c['html'])){_0x52b58c[_0x8ea2('0x14')]=_0x52b58c[_0x8ea2('0x14')]['replace'](_0x248c18,'');}if(_0x52b58c[_0x8ea2('0x14')][_0x8ea2('0x16')](_0x8ea2('0x17'))){var _0x9f9548=[];_0x52b58c[_0x8ea2('0x18')][_0x8ea2('0x19')](_0x199417=>{_0x9f9548[_0x8ea2('0x1a')](_0x199417[_0x8ea2('0x1b')]);});var _0x4d5030=/]+>/g;var _0x433bc5=/src=\"data:image\/([a-zA-Z]*);base64,([^\"]*)\"/g;var _0x4f48bd=_0x52b58c[_0x8ea2('0x14')][_0x8ea2('0x1c')](_0x433bc5,_0x8ea2('0x1d'));var _0x4e2106=_0x4f48bd['replace'](_0x4d5030,_0x8ea2('0x1e'));for(let _0x4dc7bf=0x0;_0x4dc7bf<_0x9f9548[_0x8ea2('0x12')];_0x4dc7bf++){var _0x4e786d=_0x4e2106[_0x8ea2('0x1c')](_0x8ea2('0x1e'),_0x8ea2('0x1f')+_0x9f9548[_0x4dc7bf]+_0x8ea2('0x20'));_0x4e2106=_0x4e786d;}_0x52b58c['html']=_0x4e2106;}_0x4be7c9['body']=_0x52b58c[_0x8ea2('0x14')];}else{_0x4be7c9['body']=_0x52b58c[_0x8ea2('0x21')];}if(_0x4be7c9[_0x8ea2('0x22')]){_0x4be7c9[_0x8ea2('0x22')]=_0x4be7c9[_0x8ea2('0x22')][_0x8ea2('0x1c')](/Empty\x20message

';if(_0x3afb80[_0x8ea2('0x3a')]){for(var _0x17df7b=0x0;_0x17df7b<_0x3afb80[_0x8ea2('0x3a')][_0x8ea2('0x12')];_0x17df7b++){var _0x20992d=_0x3afb80['Attachments'][_0x17df7b];_0x4f9a8c[_0x8ea2('0x24')][_0x8ea2('0x18')][_0x8ea2('0x1a')]({'filename':_0x20992d['Title'],'content':new Buffer(_0x20992d[_0x8ea2('0x3b')])});}}}_0x3995ff(parseEmail(_0x282f00,_0x6d0e0c,_0x4f9a8c));});}else{_0x6d0e0c[_0x8ea2('0x14')]=_0x8ea2('0x3c');_0x3995ff(parseEmail(_0x282f00,_0x6d0e0c,_0x4f9a8c));}}else{_0x3995ff(parseEmail(_0x282f00,_0x6d0e0c,_0x4f9a8c));}};exports[_0x8ea2('0x3d')]=function(_0x315ed1){switch(_0x315ed1){case _0x8ea2('0x3e'):return _0x8ea2('0x3f');case _0x8ea2('0x40'):return _0x8ea2('0x41');case _0x8ea2('0x42'):return _0x8ea2('0x43');case _0x8ea2('0x44'):return _0x8ea2('0x45');}return _0x8ea2('0x46');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 0c0ab94..f7155ee 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc6c4=['SERV','Imap','Smtp','exports','lodash','name','Service','key'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xc6c4,0x12c));var _0x4c6c=function(_0x5f4c4d,_0x1c6086){_0x5f4c4d=_0x5f4c4d-0x0;var _0x409157=_0xc6c4[_0x5f4c4d];return _0x409157;};'use strict';var _=require(_0x4c6c('0x0'));function MailAccount(_0x493525){this['id']=_0x493525['id']||0x0;this['name']=_0x493525[_0x4c6c('0x1')]||_0x4c6c('0x2');this[_0x4c6c('0x3')]=_0x493525[_0x4c6c('0x3')]||_0x4c6c('0x4');this['active']=_0x493525['active']||![];this[_0x4c6c('0x5')]=_0x493525[_0x4c6c('0x5')]||[];this[_0x4c6c('0x6')]=_0x493525[_0x4c6c('0x6')]||[];}module[_0x4c6c('0x7')]=MailAccount; \ No newline at end of file +var _0x20f6=['Smtp','exports','lodash','name','Service','key','SERV','active','Imap'];(function(_0x120237,_0x5a21b7){var _0x2b3b4c=function(_0x38107a){while(--_0x38107a){_0x120237['push'](_0x120237['shift']());}};_0x2b3b4c(++_0x5a21b7);}(_0x20f6,0x18e));var _0x620f=function(_0x406477,_0x13124f){_0x406477=_0x406477-0x0;var _0x10da37=_0x20f6[_0x406477];return _0x10da37;};'use strict';var _=require(_0x620f('0x0'));function MailAccount(_0x62af0){this['id']=_0x62af0['id']||0x0;this['name']=_0x62af0[_0x620f('0x1')]||_0x620f('0x2');this[_0x620f('0x3')]=_0x62af0['key']||_0x620f('0x4');this[_0x620f('0x5')]=_0x62af0[_0x620f('0x5')]||![];this[_0x620f('0x6')]=_0x62af0[_0x620f('0x6')]||[];this[_0x620f('0x7')]=_0x62af0['Smtp']||[];}module[_0x620f('0x8')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index f35005d..9e35960 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf6c1=['prototype','length','isUndefined','merge','lodash','../model/mailAccount','mailAccounts','mapKeys','mergeFromDatabase','hasOwnProperty'];(function(_0x9cd4c3,_0x1c9b2c){var _0x4c9025=function(_0x25b3c6){while(--_0x25b3c6){_0x9cd4c3['push'](_0x9cd4c3['shift']());}};_0x4c9025(++_0x1c9b2c);}(_0xf6c1,0x68));var _0x1f6c=function(_0x226762,_0x10b06f){_0x226762=_0x226762-0x0;var _0x5ae055=_0xf6c1[_0x226762];return _0x5ae055;};'use strict';var _=require(_0x1f6c('0x0'));var MailAccount=require(_0x1f6c('0x1'));var Realtime=function(){this[_0x1f6c('0x2')]={};};function freeIsNotKey(_0x1bc496,_0x22a0ca,_0x4fa979){var _0x34e859=_[_0x1f6c('0x3')](_0x1bc496,function(_0x19f215,_0x18ba38){return _0x19f215[_0x4fa979];});for(var _0x2305c6 in _0x22a0ca){if(_0x22a0ca['hasOwnProperty'](_0x2305c6)){if(!_0x34e859[_0x2305c6]){delete _0x22a0ca[_0x2305c6];}}}}Realtime['prototype'][_0x1f6c('0x4')]=function(_0x3e1fee,_0x589d4a){for(var _0x56cdc3 in _0x589d4a){if(_0x3e1fee[_0x1f6c('0x5')](_0x56cdc3)){_0x3e1fee[_0x56cdc3]=_0x589d4a[_0x56cdc3];}}};Realtime[_0x1f6c('0x6')]['initMailAccounts']=function(){var _0x32ac33=this;return function(_0x303f24){if(_0x303f24){freeIsNotKey(_0x303f24,_0x32ac33[_0x1f6c('0x2')],'id');for(var _0x2d11ab=0x0,_0x3eda96={},_0x7544ff={};_0x2d11ab<_0x303f24[_0x1f6c('0x7')];_0x2d11ab+=0x1){_0x3eda96=_0x303f24[_0x2d11ab];if(_[_0x1f6c('0x8')](_0x32ac33[_0x1f6c('0x2')][_0x3eda96['id']])){_0x32ac33[_0x1f6c('0x2')][_0x3eda96['id']]=new MailAccount(_0x3eda96);}else{_[_0x1f6c('0x9')](_0x32ac33[_0x1f6c('0x2')][_0x3eda96['id']],_0x3eda96);}}}return _0x32ac33[_0x1f6c('0x2')];};};module['exports']=Realtime; \ No newline at end of file +var _0xbca6=['hasOwnProperty','prototype','mergeFromDatabase','initMailAccounts','isUndefined','exports','lodash','../model/mailAccount','mailAccounts','mapKeys'];(function(_0x1c99f3,_0x50b01f){var _0x22a5ab=function(_0x24842f){while(--_0x24842f){_0x1c99f3['push'](_0x1c99f3['shift']());}};_0x22a5ab(++_0x50b01f);}(_0xbca6,0x9c));var _0x6bca=function(_0x1ca747,_0x597607){_0x1ca747=_0x1ca747-0x0;var _0x37cdec=_0xbca6[_0x1ca747];return _0x37cdec;};'use strict';var _=require(_0x6bca('0x0'));var MailAccount=require(_0x6bca('0x1'));var Realtime=function(){this[_0x6bca('0x2')]={};};function freeIsNotKey(_0x4582c7,_0x102b30,_0x3b6309){var _0x253ad1=_[_0x6bca('0x3')](_0x4582c7,function(_0x33e80a,_0x33ea9e){return _0x33e80a[_0x3b6309];});for(var _0x29d580 in _0x102b30){if(_0x102b30[_0x6bca('0x4')](_0x29d580)){if(!_0x253ad1[_0x29d580]){delete _0x102b30[_0x29d580];}}}}Realtime[_0x6bca('0x5')][_0x6bca('0x6')]=function(_0x1a7959,_0x2ce2a5){for(var _0x67d8d1 in _0x2ce2a5){if(_0x1a7959['hasOwnProperty'](_0x67d8d1)){_0x1a7959[_0x67d8d1]=_0x2ce2a5[_0x67d8d1];}}};Realtime[_0x6bca('0x5')][_0x6bca('0x7')]=function(){var _0x197a83=this;return function(_0xf7b2bf){if(_0xf7b2bf){freeIsNotKey(_0xf7b2bf,_0x197a83[_0x6bca('0x2')],'id');for(var _0xf020f2=0x0,_0x28e500={},_0x5ada11={};_0xf020f2<_0xf7b2bf['length'];_0xf020f2+=0x1){_0x28e500=_0xf7b2bf[_0xf020f2];if(_[_0x6bca('0x8')](_0x197a83[_0x6bca('0x2')][_0x28e500['id']])){_0x197a83[_0x6bca('0x2')][_0x28e500['id']]=new MailAccount(_0x28e500);}else{_['merge'](_0x197a83[_0x6bca('0x2')][_0x28e500['id']],_0x28e500);}}}return _0x197a83['mailAccounts'];};};module[_0x6bca('0x9')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index c5a8c2f..5f9fecc 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe39=['NotifyMailAccount','../client','getMailAccounts','GetMailAccount','email','active','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount','notify','Request'];(function(_0x4106ad,_0x3eb3d){var _0x3b0cc4=function(_0x23eb75){while(--_0x23eb75){_0x4106ad['push'](_0x4106ad['shift']());}};_0x3b0cc4(++_0x3eb3d);}(_0xfe39,0x1b3));var _0x9fe3=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0xfe39[_0x411017];return _0x2adeea;};'use strict';var client=require(_0x9fe3('0x0'));exports[_0x9fe3('0x1')]=function(){return function(){return client['Request'](_0x9fe3('0x2'),{'options':{'attributes':['id','name','service',_0x9fe3('0x3'),_0x9fe3('0x4'),'key','ListId',_0x9fe3('0x5')],'raw':![],'include':[{'model':_0x9fe3('0x6'),'as':_0x9fe3('0x7')},{'model':_0x9fe3('0x8'),'as':_0x9fe3('0x9')}]},'log':_0x9fe3('0xa')});};};exports[_0x9fe3('0xb')]=function(_0x5a3bd6,_0x211eb2){return client[_0x9fe3('0xc')](_0x9fe3('0xd'),{'account':{'id':_0x5a3bd6},'body':_0x211eb2,'log':_0x9fe3('0xd')});}; \ No newline at end of file +var _0xd90a=['notify','NotifyMailAccount','../client','Request','name','email','active','key','ListId','TemplateId','MailServerIn','Imap','MailServerOut','Smtp','getMailAccount'];(function(_0x3d5cb6,_0x52765e){var _0x4a2ab9=function(_0x28e166){while(--_0x28e166){_0x3d5cb6['push'](_0x3d5cb6['shift']());}};_0x4a2ab9(++_0x52765e);}(_0xd90a,0x6b));var _0xad90=function(_0x4eaaf0,_0x303d7e){_0x4eaaf0=_0x4eaaf0-0x0;var _0x51884a=_0xd90a[_0x4eaaf0];return _0x51884a;};'use strict';var client=require(_0xad90('0x0'));exports['getMailAccounts']=function(){return function(){return client[_0xad90('0x1')]('GetMailAccount',{'options':{'attributes':['id',_0xad90('0x2'),'service',_0xad90('0x3'),_0xad90('0x4'),_0xad90('0x5'),_0xad90('0x6'),_0xad90('0x7')],'raw':![],'include':[{'model':_0xad90('0x8'),'as':_0xad90('0x9')},{'model':_0xad90('0xa'),'as':_0xad90('0xb')}]},'log':_0xad90('0xc')});};};exports[_0xad90('0xd')]=function(_0x128f6b,_0x50c129){return client[_0xad90('0x1')](_0xad90('0xe'),{'account':{'id':_0x128f6b},'body':_0x50c129,'log':'NotifyMailAccount'});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index 0ca0fcf..12db795 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5d9c=['GetSettings','getSettings','Request'];(function(_0x52fbb2,_0x38ea3){var _0x14e3a5=function(_0x2e7cd7){while(--_0x2e7cd7){_0x52fbb2['push'](_0x52fbb2['shift']());}};_0x14e3a5(++_0x38ea3);}(_0x5d9c,0x196));var _0xc5d9=function(_0x14972d,_0x33a085){_0x14972d=_0x14972d-0x0;var _0x55e5ad=_0x5d9c[_0x14972d];return _0x55e5ad;};'use strict';var client=require('../client');exports[_0xc5d9('0x0')]=function(){return client[_0xc5d9('0x1')]('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0xc5d9('0x2')});}; \ No newline at end of file +var _0x8dc6=['getSettings','ShowSetting','loginMailFrequency','GetSettings','../client'];(function(_0x3bcc8e,_0x112afc){var _0x3b1bee=function(_0x55d6bb){while(--_0x55d6bb){_0x3bcc8e['push'](_0x3bcc8e['shift']());}};_0x3b1bee(++_0x112afc);}(_0x8dc6,0x17b));var _0x68dc=function(_0x4ae829,_0x2c842c){_0x4ae829=_0x4ae829-0x0;var _0x256b31=_0x8dc6[_0x4ae829];return _0x256b31;};'use strict';var client=require(_0x68dc('0x0'));exports[_0x68dc('0x1')]=function(){return client['Request'](_0x68dc('0x2'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x68dc('0x3')]},'log':_0x68dc('0x4')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index d603914..9c9d184 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47a7d0,_0x4e182d){_0x47a7d0=_0x47a7d0-0x0;var _0xb9bd08=_0xa9e0[_0x47a7d0];return _0xb9bd08;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xa9e0[_0x220dbb];return _0x2b77de;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 964ae02..28f9ea9 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7512=['createServer','timeout','listen','port','websocket','polling','defaults','adapter','socket.io-redis','redis','../../config/triggers','default','../../config/socketio','../../config/express','../../routes','once','express','sticky-session','ioredis','../../config/environment'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x7512,0x1dc));var _0x2751=function(_0x4f5670,_0x3ef7e4){_0x4f5670=_0x4f5670-0x0;var _0x5a7277=_0x7512[_0x4f5670];return _0x5a7277;};'use strict';var _=require('lodash');var http=require('http');var express=require(_0x2751('0x0'));var sticky=require(_0x2751('0x1'));var Redis=require(_0x2751('0x2'));var config=require(_0x2751('0x3'));var app=express();var server=http[_0x2751('0x4')](app);server[_0x2751('0x5')]=0xdbba0;if(sticky[_0x2751('0x6')](server,config[_0x2751('0x7')])){var socketio=require('socket.io')(server,{'transports':[_0x2751('0x8'),_0x2751('0x9')]});config['redis']=_[_0x2751('0xa')](config['redis'],{'host':'localhost','port':0x18eb});socketio[_0x2751('0xb')](require(_0x2751('0xc'))({'pubClient':new Redis(config[_0x2751('0xd')]),'subClient':new Redis(config[_0x2751('0xd')])}));require(_0x2751('0xe'))[_0x2751('0xf')]();require(_0x2751('0x10'))[_0x2751('0xf')](socketio);require(_0x2751('0x11'))[_0x2751('0xf')](app);require(_0x2751('0x12'))['default'](app);}else{server[_0x2751('0x13')]('listening',function(){console['log']('Express\x20server\x20listening\x20on\x20port\x20%d!',config[_0x2751('0x7')]);});}exports=module['exports']=app; \ No newline at end of file +var _0x4849=['once','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','ioredis','../../config/environment','createServer','timeout','port','socket.io','redis','defaults','localhost','socket.io-redis','../../config/triggers','default','../../config/socketio','../../config/express'];(function(_0x49ab59,_0x35304e){var _0x36a382=function(_0x1c895d){while(--_0x1c895d){_0x49ab59['push'](_0x49ab59['shift']());}};_0x36a382(++_0x35304e);}(_0x4849,0xc1));var _0x9484=function(_0x2476b3,_0x4baadb){_0x2476b3=_0x2476b3-0x0;var _0x579991=_0x4849[_0x2476b3];return _0x579991;};'use strict';var _=require(_0x9484('0x0'));var http=require(_0x9484('0x1'));var express=require(_0x9484('0x2'));var sticky=require('sticky-session');var Redis=require(_0x9484('0x3'));var config=require(_0x9484('0x4'));var app=express();var server=http[_0x9484('0x5')](app);server[_0x9484('0x6')]=0xdbba0;if(sticky['listen'](server,config[_0x9484('0x7')])){var socketio=require(_0x9484('0x8'))(server,{'transports':['websocket','polling']});config[_0x9484('0x9')]=_[_0x9484('0xa')](config[_0x9484('0x9')],{'host':_0x9484('0xb'),'port':0x18eb});socketio['adapter'](require(_0x9484('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x9484('0x9')])}));require(_0x9484('0xd'))[_0x9484('0xe')]();require(_0x9484('0xf'))[_0x9484('0xe')](socketio);require(_0x9484('0x10'))['default'](app);require('../../routes')[_0x9484('0xe')](app);}else{server[_0x9484('0x11')]('listening',function(){console[_0x9484('0x12')](_0x9484('0x13'),config[_0x9484('0x7')]);});}exports=module[_0x9484('0x14')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index 1bddf2c..3dbee45 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcdac=['../../config/logger','routing','http','Request','request','rpc','error','message','catch','jayson/promise'];(function(_0x5628d5,_0x390bbe){var _0x5c8a2e=function(_0x84386){while(--_0x84386){_0x5628d5['push'](_0x5628d5['shift']());}};_0x5c8a2e(++_0x390bbe);}(_0xcdac,0xdb));var _0xccda=function(_0x5b7891,_0x19cff6){_0x5b7891=_0x5b7891-0x0;var _0x5b67f5=_0xcdac[_0x5b7891];return _0x5b67f5;};'use strict';var jayson=require(_0xccda('0x0'));var BPromise=require('bluebird');var logger=require(_0xccda('0x1'))(_0xccda('0x2'));var client=jayson['client'][_0xccda('0x3')]({'port':0x2329});client[_0xccda('0x4')]=function(_0x49c17e,_0xa8a2d6){return new BPromise(function(_0x89e4e7,_0x1f22bd){return client[_0xccda('0x5')](_0x49c17e,_0xa8a2d6)['then'](function(_0x1be5e8){logger['debug'](_0xccda('0x6'),_0xccda('0x2'),_0x49c17e,_0xa8a2d6,_0x1be5e8);if(_0x1be5e8[_0xccda('0x7')]){logger['error'](_0xccda('0x6'),_0xccda('0x2'),_0x49c17e,_0x1be5e8[_0xccda('0x7')][_0xccda('0x8')],_0xa8a2d6);return _0x1f22bd(_0x1be5e8[_0xccda('0x7')][_0xccda('0x8')]);}else{return _0x89e4e7(_0x1be5e8['result']);}})[_0xccda('0x9')](function(_0x170377){logger[_0xccda('0x7')]('rpc','routing',_0x49c17e,_0x170377,_0xa8a2d6);return _0x1f22bd(_0x170377);});});};module['exports']=client; \ No newline at end of file +var _0x06c7=['catch','exports','jayson/promise','bluebird','../../config/logger','routing','request','then','rpc','error','message'];(function(_0xdab8df,_0x10ddf9){var _0x456359=function(_0x524315){while(--_0x524315){_0xdab8df['push'](_0xdab8df['shift']());}};_0x456359(++_0x10ddf9);}(_0x06c7,0xd3));var _0x706c=function(_0x9b0599,_0x3bf23d){_0x9b0599=_0x9b0599-0x0;var _0x561925=_0x06c7[_0x9b0599];return _0x561925;};'use strict';var jayson=require(_0x706c('0x0'));var BPromise=require(_0x706c('0x1'));var logger=require(_0x706c('0x2'))(_0x706c('0x3'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x279d6e,_0x3b8c32){return new BPromise(function(_0x1c19fd,_0x3d54fc){return client[_0x706c('0x4')](_0x279d6e,_0x3b8c32)[_0x706c('0x5')](function(_0x22cb95){logger['debug'](_0x706c('0x6'),'routing',_0x279d6e,_0x3b8c32,_0x22cb95);if(_0x22cb95[_0x706c('0x7')]){logger[_0x706c('0x7')](_0x706c('0x6'),_0x706c('0x3'),_0x279d6e,_0x22cb95[_0x706c('0x7')][_0x706c('0x8')],_0x3b8c32);return _0x3d54fc(_0x22cb95[_0x706c('0x7')][_0x706c('0x8')]);}else{return _0x1c19fd(_0x22cb95['result']);}})[_0x706c('0x9')](function(_0x505f68){logger[_0x706c('0x7')]('rpc',_0x706c('0x3'),_0x279d6e,_0x505f68,_0x3b8c32);return _0x3d54fc(_0x505f68);});});};module[_0x706c('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index ad7f1ee..6621240 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x098a=['getChatQueues','initChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/mailQueue','./rpc/whatsappQueue','resolve','then','initAgents','getIntervals','initIntervals','getOpenchannelQueues','initOpenchannelQueues'];(function(_0x17eb9d,_0x95861a){var _0x53a1e0=function(_0x18b19a){while(--_0x18b19a){_0x17eb9d['push'](_0x17eb9d['shift']());}};_0x53a1e0(++_0x95861a);}(_0x098a,0x77));var _0xa098=function(_0x55021e,_0x619243){_0x55021e=_0x55021e-0x0;var _0x433cd8=_0x098a[_0x55021e];return _0x433cd8;};'use strict';var BPromise=require(_0xa098('0x0'));var server=require(_0xa098('0x1'));var Realtime=require(_0xa098('0x2'));var user=require(_0xa098('0x3'));var interval=require(_0xa098('0x4'));var openchannelQueue=require(_0xa098('0x5'));var chatQueue=require(_0xa098('0x6'));var smsQueue=require('./rpc/smsQueue');var mailQueue=require(_0xa098('0x7'));var faxQueue=require('./rpc/faxQueue');var whatsappQueue=require(_0xa098('0x8'));var realtime=new Realtime();function initRealtime(){return BPromise[_0xa098('0x9')]()[_0xa098('0xa')](user['getAgents']())[_0xa098('0xa')](realtime[_0xa098('0xb')]())[_0xa098('0xa')](interval[_0xa098('0xc')]())['then'](realtime[_0xa098('0xd')]())[_0xa098('0xa')](openchannelQueue[_0xa098('0xe')]())[_0xa098('0xa')](realtime[_0xa098('0xf')]())[_0xa098('0xa')](chatQueue[_0xa098('0x10')]())['then'](realtime[_0xa098('0x11')]())[_0xa098('0xa')](smsQueue['getSmsQueues']())[_0xa098('0xa')](realtime[_0xa098('0x12')]())[_0xa098('0xa')](mailQueue[_0xa098('0x13')]())[_0xa098('0xa')](realtime[_0xa098('0x14')]())[_0xa098('0xa')](faxQueue[_0xa098('0x15')]())['then'](realtime[_0xa098('0x16')]())[_0xa098('0xa')](whatsappQueue[_0xa098('0x17')]())[_0xa098('0xa')](realtime[_0xa098('0x18')]())[_0xa098('0xa')](function(){return realtime;});}function main(){return server[_0xa098('0x19')](realtime)[_0xa098('0xa')](function(_0x31c953){return initRealtime();})['then'](function(_0x1252fb){return setInterval(initRealtime,0x1388);})[_0xa098('0x1a')](function(_0x1e40ac){console['log'](_0x1e40ac);});}main(); \ No newline at end of file +var _0x8fba=['./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','resolve','then','getAgents','getIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','initSmsQueues','getMailQueues','initFaxQueues','getWhatsappQueues','initWhatsappQueues','listen','catch','log','bluebird','./server'];(function(_0x4285fb,_0x4b1b00){var _0x1b4078=function(_0x32dec6){while(--_0x32dec6){_0x4285fb['push'](_0x4285fb['shift']());}};_0x1b4078(++_0x4b1b00);}(_0x8fba,0x102));var _0xa8fb=function(_0x3c3761,_0x3a1f12){_0x3c3761=_0x3c3761-0x0;var _0x4afdef=_0x8fba[_0x3c3761];return _0x4afdef;};'use strict';var BPromise=require(_0xa8fb('0x0'));var server=require(_0xa8fb('0x1'));var Realtime=require('./realtime');var user=require(_0xa8fb('0x2'));var interval=require(_0xa8fb('0x3'));var openchannelQueue=require(_0xa8fb('0x4'));var chatQueue=require(_0xa8fb('0x5'));var smsQueue=require(_0xa8fb('0x6'));var mailQueue=require(_0xa8fb('0x7'));var faxQueue=require(_0xa8fb('0x8'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0xa8fb('0x9')]()[_0xa8fb('0xa')](user[_0xa8fb('0xb')]())[_0xa8fb('0xa')](realtime['initAgents']())[_0xa8fb('0xa')](interval[_0xa8fb('0xc')]())['then'](realtime['initIntervals']())[_0xa8fb('0xa')](openchannelQueue[_0xa8fb('0xd')]())['then'](realtime[_0xa8fb('0xe')]())[_0xa8fb('0xa')](chatQueue[_0xa8fb('0xf')]())['then'](realtime[_0xa8fb('0x10')]())[_0xa8fb('0xa')](smsQueue[_0xa8fb('0x11')]())['then'](realtime[_0xa8fb('0x12')]())[_0xa8fb('0xa')](mailQueue[_0xa8fb('0x13')]())[_0xa8fb('0xa')](realtime['initMailQueues']())[_0xa8fb('0xa')](faxQueue['getFaxQueues']())[_0xa8fb('0xa')](realtime[_0xa8fb('0x14')]())['then'](whatsappQueue[_0xa8fb('0x15')]())[_0xa8fb('0xa')](realtime[_0xa8fb('0x16')]())['then'](function(){return realtime;});}function main(){return server[_0xa8fb('0x17')](realtime)[_0xa8fb('0xa')](function(_0x2d739d){return initRealtime();})[_0xa8fb('0xa')](function(_0x2f6e1d){return setInterval(initRealtime,0x1388);})[_0xa8fb('0x18')](function(_0x1b68d9){console[_0xa8fb('0x19')](_0x1b68d9);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index dad9b06..c63516f 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x59ff6c,_0x104389){var _0x23be14=function(_0x2a6a3c){while(--_0x2a6a3c){_0x59ff6c['push'](_0x59ff6c['shift']());}};_0x23be14(++_0x104389);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1b2ff7,_0x12a034){_0x1b2ff7=_0x1b2ff7-0x0;var _0x31656a=_0xc4aa[_0x1b2ff7];return _0x31656a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file +var _0x1261=['isNil','register','ignoreFactChanges','activeRules','prototype','isArray','rules','concat','isObject','push','sync','filter','orderBy','asc','result','clone','name','nextTick','ruleRef','isEqual','restart','length','condition','noop','findRules','matches','turn','prioritize','priority','toString','consequence','fromJSON','isString','parse','map','object','exports','util','events','EventEmitter','init'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x1261,0x144));var _0x1126=function(_0x4b7d87,_0x238711){_0x4b7d87=_0x4b7d87-0x0;var _0x3b9f82=_0x1261[_0x4b7d87];return _0x3b9f82;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var EventEmitter=require(_0x1126('0x1'))[_0x1126('0x2')];function RuleEngine(_0x331a2c,_0x39b786){this[_0x1126('0x3')]();if(!_[_0x1126('0x4')](_0x331a2c)){this[_0x1126('0x5')](_0x331a2c);}if(_0x39b786){this[_0x1126('0x6')]=_0x39b786[_0x1126('0x6')];}return this;}util['inherits'](RuleEngine,EventEmitter);RuleEngine['prototype'][_0x1126('0x3')]=function(_0x907180){this['rules']=[];this[_0x1126('0x7')]=[];};RuleEngine[_0x1126('0x8')][_0x1126('0x5')]=function(_0x3abb0b){if(Array[_0x1126('0x9')](_0x3abb0b)){this['rules']=this[_0x1126('0xa')][_0x1126('0xb')](_0x3abb0b);}else if(_0x3abb0b!==null&&_[_0x1126('0xc')](_0x3abb0b)){this['rules'][_0x1126('0xd')](_0x3abb0b);}this['sync']();};RuleEngine['prototype'][_0x1126('0xe')]=function(){this['activeRules']=this[_0x1126('0xa')][_0x1126('0xf')](function(_0xd26a32){if(_[_0x1126('0x4')](_0xd26a32['on'])){_0xd26a32['on']=!![];}if(_0xd26a32['on']===!![]){return _0xd26a32;}});this[_0x1126('0x7')]=_[_0x1126('0x10')](this[_0x1126('0x7')],['p'],[_0x1126('0x11')]);};RuleEngine[_0x1126('0x8')]['execute']=function(_0x5de9a7,_0x1af673){var _0x154e20=![];_0x5de9a7[_0x1126('0x12')]=!![];var _0x4be0c6=_[_0x1126('0x13')](_0x5de9a7);var _0x4794a7=_[_0x1126('0x13')](_0x5de9a7);var _0x42f379=this[_0x1126('0x7')];var _0x4e1c97=[];var _0x245cd7=this[_0x1126('0x6')];(function FnRuleLoop(_0x4a7b49){var _0x4d2b38={'rules':function(){return _0x42f379;},'rule':function(){return _0x42f379[_0x4a7b49];},'when':function(_0x22ae0b){if(_0x22ae0b){var _0x2b2487=_0x42f379[_0x4a7b49]['consequence'];_0x2b2487['ruleRef']=_0x42f379[_0x4a7b49]['id']||_0x42f379[_0x4a7b49][_0x1126('0x14')]||'index_'+_0x4a7b49;process[_0x1126('0x15')](function(){_0x4e1c97[_0x1126('0xd')](_0x2b2487[_0x1126('0x16')]);_0x2b2487['call'](_0x4be0c6,_0x4d2b38);});}else{process[_0x1126('0x15')](function(){_0x4d2b38['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x154e20=!![];return FnRuleLoop(0x0);},'next':function(_0x56efeb){if(!_0x245cd7&&!_[_0x1126('0x17')](_0x4794a7,_0x4be0c6)){_0x4794a7=_[_0x1126('0x13')](_0x4be0c6);process[_0x1126('0x15')](function(){_0x4d2b38[_0x1126('0x18')]();});}else{process['nextTick'](function(){if(_[_0x1126('0x4')](_0x56efeb)){return FnRuleLoop(_0x4a7b49+0x1);}else{return FnRuleLoop(_0x56efeb);}});}}};if(_0x4a7b49<_0x42f379[_0x1126('0x19')]&&_0x154e20===![]){var _0x48a08d=_0x42f379[_0x4a7b49][_0x1126('0x1a')];_0x48a08d['call'](_0x4be0c6,_0x4d2b38);}else{process['nextTick'](function(){_0x4be0c6['matchPath']=_0x4e1c97;return _0x1af673?_0x1af673(_0x4be0c6):_[_0x1126('0x1b')]();});}}(0x0));};RuleEngine[_0x1126('0x8')][_0x1126('0x1c')]=function(_0x34bcf1){if(_[_0x1126('0x4')](_0x34bcf1)){return this[_0x1126('0xa')];}else{var _0xea0971=_[_0x1126('0x1d')](_0x34bcf1);return _['filter'](this[_0x1126('0xa')],_0xea0971);}};RuleEngine[_0x1126('0x8')][_0x1126('0x1e')]=function(_0x5ddf63,_0x541bc9){var _0xeb7d89=_0x5ddf63==='on'||_0x5ddf63==='ON'?!![]:![];var _0x39bf0e=this['findRules'](_0x541bc9);for(var _0x2fb797=0x0,_0x23d2bc=_0x39bf0e['length'];_0x2fb797<_0x23d2bc;_0x2fb797+=0x1){_0x39bf0e[_0x2fb797]['on']=_0xeb7d89;}this[_0x1126('0xe')]();};RuleEngine['prototype'][_0x1126('0x1f')]=function(_0x4bd50b,_0x771bb8){_0x4bd50b=parseInt(_0x4bd50b,0xa);var _0x583ce6=this[_0x1126('0x1c')](_0x771bb8);for(var _0x5f2611=0x0,_0x5252e0=_0x583ce6['length'];_0x5f2611<_0x5252e0;_0x5f2611+=0x1){_0x583ce6[_0x5f2611][_0x1126('0x20')]=_0x4bd50b;}this[_0x1126('0xe')]();};RuleEngine[_0x1126('0x8')]['toJSON']=function(){var _0x2a3055=this[_0x1126('0xa')];if(_0x2a3055 instanceof Array){_0x2a3055=_0x2a3055['map'](function(_0x3dd50e){_0x3dd50e[_0x1126('0x1a')]=_0x3dd50e[_0x1126('0x1a')][_0x1126('0x21')]();_0x3dd50e['consequence']=_0x3dd50e['consequence'][_0x1126('0x21')]();return _0x3dd50e;});}else if(!_[_0x1126('0x4')](_0x2a3055)){_0x2a3055[_0x1126('0x1a')]=_0x2a3055[_0x1126('0x1a')]['toString']();_0x2a3055[_0x1126('0x22')]=_0x2a3055[_0x1126('0x22')][_0x1126('0x21')]();}return _0x2a3055;};RuleEngine[_0x1126('0x8')][_0x1126('0x23')]=function(_0x5df232){this[_0x1126('0x3')]();if(_[_0x1126('0x24')](_0x5df232)){_0x5df232=JSON[_0x1126('0x25')](_0x5df232);}if(_0x5df232 instanceof Array){_0x5df232=_0x5df232[_0x1126('0x26')](function(_0x5c019d){_0x5c019d['condition']=eval('('+_0x5c019d[_0x1126('0x1a')]+')');_0x5c019d[_0x1126('0x22')]=eval('('+_0x5c019d['consequence']+')');return _0x5c019d;});}else if(_0x5df232!==null&&typeof _0x5df232==_0x1126('0x27')){_0x5df232[_0x1126('0x1a')]=eval('('+_0x5df232[_0x1126('0x1a')]+')');_0x5df232['consequence']=eval('('+_0x5df232['consequence']+')');}this[_0x1126('0x5')](_0x5df232);};module[_0x1126('0x28')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index 2c3ab07..202fe63 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb97b=['result','sendMailMessage','bluebird','client','http','request','then','error','message'];(function(_0x21af3a,_0x386e1d){var _0x268a49=function(_0x41a650){while(--_0x41a650){_0x21af3a['push'](_0x21af3a['shift']());}};_0x268a49(++_0x386e1d);}(_0xb97b,0x92));var _0xbb97=function(_0x426b0e,_0x24266d){_0x426b0e=_0x426b0e-0x0;var _0x989131=_0xb97b[_0x426b0e];return _0x989131;};'use strict';var BPromise=require(_0xbb97('0x0'));var jayson=require('jayson/promise');var client=jayson[_0xbb97('0x1')][_0xbb97('0x2')]({'port':0x232b});function request(_0x1e15fa,_0x4945cc){return new BPromise(function(_0x3fb18a,_0x289e37){return client[_0xbb97('0x3')](_0x1e15fa,_0x4945cc)[_0xbb97('0x4')](function(_0x2dc226){if(_0x2dc226['error']){return _0x289e37(_0x2dc226[_0xbb97('0x5')][_0xbb97('0x6')]);}else{return _0x3fb18a(_0x2dc226[_0xbb97('0x7')]);}})['catch'](function(_0x578ee6){return _0x289e37(_0x578ee6);});});}exports[_0xbb97('0x8')]=function(_0x564916,_0x2db54d){return request('SendMail',{'account':_0x564916,'message':_0x2db54d});}; \ No newline at end of file +var _0xb75a=['sendMailMessage','SendMail','bluebird','jayson/promise','client','request','then','error','message','catch'];(function(_0x474241,_0xaa4c69){var _0x510a20=function(_0x65b231){while(--_0x65b231){_0x474241['push'](_0x474241['shift']());}};_0x510a20(++_0xaa4c69);}(_0xb75a,0x17e));var _0xab75=function(_0x33f750,_0x3a0638){_0x33f750=_0x33f750-0x0;var _0xd2186a=_0xb75a[_0x33f750];return _0xd2186a;};'use strict';var BPromise=require(_0xab75('0x0'));var jayson=require(_0xab75('0x1'));var client=jayson[_0xab75('0x2')]['http']({'port':0x232b});function request(_0x111355,_0x4f5350){return new BPromise(function(_0x205ac1,_0x523fad){return client[_0xab75('0x3')](_0x111355,_0x4f5350)[_0xab75('0x4')](function(_0x3a6ac0){if(_0x3a6ac0[_0xab75('0x5')]){return _0x523fad(_0x3a6ac0['error'][_0xab75('0x6')]);}else{return _0x205ac1(_0x3a6ac0['result']);}})[_0xab75('0x7')](function(_0xa0e7f5){return _0x523fad(_0xa0e7f5);});});}exports[_0xab75('0x8')]=function(_0x578b24,_0x306a0c){return request(_0xab75('0x9'),{'account':_0x578b24,'message':_0x306a0c});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index 04d59cd..4d101af 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0c3a=['toNumber','format','smsPause','chatStatus','faxStatusTime','smsStatusTime','openchannelStatusTime','stringify','emit','lodash','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailCapacity','mailCurrentCapacity','faxStatus','faxCapacity','faxCurrentCapacity','smsCapacity','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','mail','chat','openchannel','fax','sms','whatsapp','length','Status','StatusTime'];(function(_0x21a0cf,_0x3a2d6e){var _0x32cabd=function(_0x16160c){while(--_0x16160c){_0x21a0cf['push'](_0x21a0cf['shift']());}};_0x32cabd(++_0x3a2d6e);}(_0x0c3a,0x171));var _0xa0c3=function(_0x5c443b,_0x3a1278){_0x5c443b=_0x5c443b-0x0;var _0x50a6f1=_0x0c3a[_0x5c443b];return _0x50a6f1;};'use strict';var _=require(_0xa0c3('0x0'));var moment=require(_0xa0c3('0x1'));var md5=require(_0xa0c3('0x2'));var Redis=require(_0xa0c3('0x3'));var config=require(_0xa0c3('0x4'));config[_0xa0c3('0x5')]=_[_0xa0c3('0x6')](config['redis'],{'host':_0xa0c3('0x7'),'port':0x18eb});var io=require(_0xa0c3('0x8'))(new Redis(config['redis']));function Agent(_0x88f47){this['id']=_0x88f47['id']||0x0;this[_0xa0c3('0x9')]=_0x88f47['name']||'';this[_0xa0c3('0xa')]=_0x88f47['online']||!![];this['voicePause']=_0x88f47[_0xa0c3('0xb')]||![];this[_0xa0c3('0xc')]=_0x88f47[_0xa0c3('0xc')]||![];this[_0xa0c3('0xd')]=_0x88f47['mailPause']||![];this[_0xa0c3('0xe')]=_0x88f47[_0xa0c3('0xe')]||![];this['smsPause']=_0x88f47['smsPause']||![];this[_0xa0c3('0xf')]=_0x88f47[_0xa0c3('0xf')]||![];this['chatStatus']=_0xa0c3('0x10');this[_0xa0c3('0x11')]=0x0;this[_0xa0c3('0x12')]=_0x88f47['chatCapacity']||0x0;this[_0xa0c3('0x13')]=0x0;this[_0xa0c3('0x14')]='unknown';this['mailStatusTime']=0x0;this[_0xa0c3('0x15')]=_0x88f47[_0xa0c3('0x15')]||0x0;this[_0xa0c3('0x16')]=0x0;this[_0xa0c3('0x17')]=_0xa0c3('0x10');this['faxStatusTime']=0x0;this[_0xa0c3('0x18')]=_0x88f47['faxCapacity']||0x0;this[_0xa0c3('0x19')]=0x0;this['smsStatus']='unknown';this['smsStatusTime']=0x0;this[_0xa0c3('0x1a')]=_0x88f47[_0xa0c3('0x1a')]||0x0;this[_0xa0c3('0x1b')]=0x0;this['whatsappStatus']=_0xa0c3('0x10');this[_0xa0c3('0x1c')]=0x0;this[_0xa0c3('0x1d')]=_0x88f47[_0xa0c3('0x1d')]||0x0;this[_0xa0c3('0x1e')]=0x0;this[_0xa0c3('0x1f')]=_0xa0c3('0x10');this['openchannelStatusTime']=0x0;this[_0xa0c3('0x20')]=_0x88f47['openchannelCapacity']||0x0;this[_0xa0c3('0x21')]=0x0;this[_0xa0c3('0x22')]=![];this[_0xa0c3('0x23')]=undefined;this[_0xa0c3('0x2')]='';this['updateRealtime']();}Agent[_0xa0c3('0x24')][_0xa0c3('0x25')]=function(_0x1ad918){if(this[_0x1ad918+_0xa0c3('0x26')]>0x0){if(this[_0x1ad918+_0xa0c3('0x27')]>0x0&&this[_0x1ad918+_0xa0c3('0x26')]>=this[_0x1ad918+_0xa0c3('0x27')]){return'maxcapacity';}else{return _0xa0c3('0x28');}}else{return _0xa0c3('0x29');}};Agent[_0xa0c3('0x24')]['updateRealtime']=function(){var _0x47b303=[_0xa0c3('0x2a'),_0xa0c3('0x2b'),_0xa0c3('0x2c'),_0xa0c3('0x2d'),_0xa0c3('0x2e'),_0xa0c3('0x2f')];for(var _0x381f3b=0x0;_0x381f3b<_0x47b303[_0xa0c3('0x30')];_0x381f3b+=0x1){var _0x5bc220=this[_0xa0c3('0x25')](_0x47b303[_0x381f3b]);if(this[_0x47b303[_0x381f3b]+_0xa0c3('0x31')]!==_0x5bc220){this[_0x47b303[_0x381f3b]+_0xa0c3('0x32')]=_[_0xa0c3('0x33')](moment()[_0xa0c3('0x34')]('x'));}this[_0x47b303[_0x381f3b]+'Status']=_0x5bc220;}var _0x160290={'id':this['id'],'name':this['name'],'online':this[_0xa0c3('0xa')],'voicePause':this[_0xa0c3('0xb')],'chatPause':this[_0xa0c3('0xc')],'mailPause':this[_0xa0c3('0xd')],'smsPause':this[_0xa0c3('0x35')],'faxPause':this[_0xa0c3('0xe')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xa0c3('0x36')],'chatStatusTime':this[_0xa0c3('0x11')],'chatCapacity':this[_0xa0c3('0x12')],'chatCurrentCapacity':this[_0xa0c3('0x13')],'mailStatus':this[_0xa0c3('0x14')],'mailStatusTime':this['mailStatusTime'],'mailCapacity':this[_0xa0c3('0x15')],'mailCurrentCapacity':this[_0xa0c3('0x16')],'faxStatus':this[_0xa0c3('0x17')],'faxStatusTime':this[_0xa0c3('0x37')],'faxCapacity':this['faxCapacity'],'faxCurrentCapacity':this[_0xa0c3('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xa0c3('0x38')],'smsCapacity':this[_0xa0c3('0x1a')],'smsCurrentCapacity':this[_0xa0c3('0x1b')],'whatsappStatus':this['whatsappStatus'],'whatsappStatusTime':this[_0xa0c3('0x1c')],'whatsappCapacity':this[_0xa0c3('0x1d')],'whatsappCurrentCapacity':this[_0xa0c3('0x1e')],'openchannelStatus':this[_0xa0c3('0x1f')],'openchannelStatusTime':this[_0xa0c3('0x39')],'openchannelCapacity':this[_0xa0c3('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this[_0xa0c3('0x22')],'busyQueue':this[_0xa0c3('0x23')]};var _0x33089e=md5(JSON[_0xa0c3('0x3a')](_0x160290));if(this[_0xa0c3('0x2')]!==_0x33089e){this[_0xa0c3('0x2')]=_0x33089e;io[_0xa0c3('0x3b')]('user:save',_0x160290);}};module['exports']=Agent; \ No newline at end of file +var _0x147f=['prototype','Capacity','CurrentCapacity','maxcapacity','working','mail','chat','openchannel','fax','sms','whatsapp','length','getChannelStatus','Status','StatusTime','toNumber','format','online','chatStatusTime','faxStatus','smsCurrentCapacity','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','emit','user:save','exports','lodash','moment','md5','../../../config/environment','redis','localhost','socket.io-emitter','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','busy','busyQueue','updateRealtime'];(function(_0x52ea08,_0x15d935){var _0x28d546=function(_0x4a3aa7){while(--_0x4a3aa7){_0x52ea08['push'](_0x52ea08['shift']());}};_0x28d546(++_0x15d935);}(_0x147f,0xd5));var _0xf147=function(_0x56876e,_0x36880a){_0x56876e=_0x56876e-0x0;var _0x4c41a0=_0x147f[_0x56876e];return _0x4c41a0;};'use strict';var _=require(_0xf147('0x0'));var moment=require(_0xf147('0x1'));var md5=require(_0xf147('0x2'));var Redis=require('ioredis');var config=require(_0xf147('0x3'));config[_0xf147('0x4')]=_['defaults'](config[_0xf147('0x4')],{'host':_0xf147('0x5'),'port':0x18eb});var io=require(_0xf147('0x6'))(new Redis(config[_0xf147('0x4')]));function Agent(_0x3888f6){this['id']=_0x3888f6['id']||0x0;this[_0xf147('0x7')]=_0x3888f6[_0xf147('0x7')]||'';this['online']=_0x3888f6['online']||!![];this[_0xf147('0x8')]=_0x3888f6[_0xf147('0x8')]||![];this[_0xf147('0x9')]=_0x3888f6['chatPause']||![];this['mailPause']=_0x3888f6[_0xf147('0xa')]||![];this[_0xf147('0xb')]=_0x3888f6['faxPause']||![];this[_0xf147('0xc')]=_0x3888f6[_0xf147('0xc')]||![];this[_0xf147('0xd')]=_0x3888f6[_0xf147('0xd')]||![];this[_0xf147('0xe')]=_0xf147('0xf');this['chatStatusTime']=0x0;this['chatCapacity']=_0x3888f6[_0xf147('0x10')]||0x0;this['chatCurrentCapacity']=0x0;this[_0xf147('0x11')]=_0xf147('0xf');this[_0xf147('0x12')]=0x0;this[_0xf147('0x13')]=_0x3888f6['mailCapacity']||0x0;this[_0xf147('0x14')]=0x0;this['faxStatus']=_0xf147('0xf');this[_0xf147('0x15')]=0x0;this[_0xf147('0x16')]=_0x3888f6[_0xf147('0x16')]||0x0;this[_0xf147('0x17')]=0x0;this[_0xf147('0x18')]=_0xf147('0xf');this[_0xf147('0x19')]=0x0;this[_0xf147('0x1a')]=_0x3888f6['smsCapacity']||0x0;this['smsCurrentCapacity']=0x0;this[_0xf147('0x1b')]=_0xf147('0xf');this[_0xf147('0x1c')]=0x0;this[_0xf147('0x1d')]=_0x3888f6['whatsappCapacity']||0x0;this[_0xf147('0x1e')]=0x0;this[_0xf147('0x1f')]=_0xf147('0xf');this['openchannelStatusTime']=0x0;this['openchannelCapacity']=_0x3888f6['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xf147('0x20')]=![];this[_0xf147('0x21')]=undefined;this[_0xf147('0x2')]='';this[_0xf147('0x22')]();}Agent[_0xf147('0x23')]['getChannelStatus']=function(_0x24b4b9){if(this[_0x24b4b9+'CurrentCapacity']>0x0){if(this[_0x24b4b9+_0xf147('0x24')]>0x0&&this[_0x24b4b9+_0xf147('0x25')]>=this[_0x24b4b9+_0xf147('0x24')]){return _0xf147('0x26');}else{return _0xf147('0x27');}}else{return'idle';}};Agent['prototype'][_0xf147('0x22')]=function(){var _0x444353=[_0xf147('0x28'),_0xf147('0x29'),_0xf147('0x2a'),_0xf147('0x2b'),_0xf147('0x2c'),_0xf147('0x2d')];for(var _0x4b1b5c=0x0;_0x4b1b5c<_0x444353[_0xf147('0x2e')];_0x4b1b5c+=0x1){var _0x5ab4b3=this[_0xf147('0x2f')](_0x444353[_0x4b1b5c]);if(this[_0x444353[_0x4b1b5c]+_0xf147('0x30')]!==_0x5ab4b3){this[_0x444353[_0x4b1b5c]+_0xf147('0x31')]=_[_0xf147('0x32')](moment()[_0xf147('0x33')]('x'));}this[_0x444353[_0x4b1b5c]+'Status']=_0x5ab4b3;}var _0x46cf4f={'id':this['id'],'name':this[_0xf147('0x7')],'online':this[_0xf147('0x34')],'voicePause':this[_0xf147('0x8')],'chatPause':this[_0xf147('0x9')],'mailPause':this[_0xf147('0xa')],'smsPause':this[_0xf147('0xc')],'faxPause':this[_0xf147('0xb')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xf147('0xe')],'chatStatusTime':this[_0xf147('0x35')],'chatCapacity':this[_0xf147('0x10')],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0xf147('0x11')],'mailStatusTime':this[_0xf147('0x12')],'mailCapacity':this[_0xf147('0x13')],'mailCurrentCapacity':this[_0xf147('0x14')],'faxStatus':this[_0xf147('0x36')],'faxStatusTime':this[_0xf147('0x15')],'faxCapacity':this[_0xf147('0x16')],'faxCurrentCapacity':this[_0xf147('0x17')],'smsStatus':this[_0xf147('0x18')],'smsStatusTime':this[_0xf147('0x19')],'smsCapacity':this[_0xf147('0x1a')],'smsCurrentCapacity':this[_0xf147('0x37')],'whatsappStatus':this[_0xf147('0x1b')],'whatsappStatusTime':this[_0xf147('0x1c')],'whatsappCapacity':this[_0xf147('0x1d')],'whatsappCurrentCapacity':this[_0xf147('0x1e')],'openchannelStatus':this['openchannelStatus'],'openchannelStatusTime':this[_0xf147('0x38')],'openchannelCapacity':this[_0xf147('0x39')],'openchannelCurrentCapacity':this[_0xf147('0x3a')],'busy':this[_0xf147('0x20')],'busyQueue':this[_0xf147('0x21')]};var _0x32e7dd=md5(JSON['stringify'](_0x46cf4f));if(this[_0xf147('0x2')]!==_0x32e7dd){this['md5']=_0x32e7dd;io[_0xf147('0x3b')](_0xf147('0x3c'),_0x46cf4f);}};module[_0xf147('0x3d')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index 919b2df..aff21e6 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 _0x7327=['timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','length','online','available','stringify','format','chat:queue:%s','emit','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name'];(function(_0x23ad48,_0x104b01){var _0x199a20=function(_0x4805d0){while(--_0x4805d0){_0x23ad48['push'](_0x23ad48['shift']());}};_0x199a20(++_0x104b01);}(_0x7327,0x84));var _0x7732=function(_0x2daee0,_0x2712b9){_0x2daee0=_0x2daee0-0x0;var _0x324bf1=_0x7327[_0x2daee0];return _0x324bf1;};'use strict';var _=require('lodash');var md5=require(_0x7732('0x0'));var util=require(_0x7732('0x1'));var Redis=require(_0x7732('0x2'));var config=require(_0x7732('0x3'));config[_0x7732('0x4')]=_['defaults'](config[_0x7732('0x4')],{'host':_0x7732('0x5'),'port':0x18eb});var io=require(_0x7732('0x6'))(new Redis(config[_0x7732('0x4')]));function ChatQueue(_0x2980c0){this['id']=_0x2980c0['id']||0x0;this[_0x7732('0x7')]=_0x2980c0[_0x7732('0x7')]||'';this[_0x7732('0x8')]=_0x2980c0[_0x7732('0x8')]||0xa;this[_0x7732('0x9')]=_0x2980c0[_0x7732('0x9')]||_0x7732('0xa');this[_0x7732('0xb')]=_0x2980c0[_0x7732('0xb')];this[_0x7732('0xc')]={};this[_0x7732('0xd')]=0x0;this['md5']='';this[_0x7732('0xe')]();this[_0x7732('0xf')]();}ChatQueue[_0x7732('0x10')][_0x7732('0xe')]=function(){var _0x45c1c7=this[_0x7732('0xc')][_0x7732('0x11')];this['mapAgentsId']=_[_0x7732('0x12')](this['Agents'],'id');this['mapAgentsId']['_rr']=_0x45c1c7;};ChatQueue[_0x7732('0x10')][_0x7732('0xf')]=function(){this[_0x7732('0x13')]=0x0;this[_0x7732('0x14')]=0x0;for(var _0x5ebc04=0x0;_0x5ebc04=0x0?this[_0x7732('0x17')]:0x0;var _0x5a936c={'id':this['id'],'available':this[_0x7732('0x17')],'loggedIn':this[_0x7732('0x13')],'name':this['name'],'paused':this[_0x7732('0x14')],'waiting':this[_0x7732('0xd')]};var _0x390ea3=md5(JSON[_0x7732('0x18')](_0x5a936c));if(this[_0x7732('0x0')]!==_0x390ea3){this[_0x7732('0x0')]=_0x390ea3;io['to'](util[_0x7732('0x19')](_0x7732('0x1a'),_0x5a936c[_0x7732('0x7')]))[_0x7732('0x1b')]('chat_queue:save',_0x5a936c);}};module['exports']=ChatQueue; \ No newline at end of file +var _0x43e5=['available','stringify','format','chat:queue:%s','emit','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','updateRouting','updateRealtime','prototype','_rr','map','Agents','loggedIn','paused','online','chatPause'];(function(_0x2a0e81,_0x3c9262){var _0x1f5583=function(_0x5b6560){while(--_0x5b6560){_0x2a0e81['push'](_0x2a0e81['shift']());}};_0x1f5583(++_0x3c9262);}(_0x43e5,0x1e6));var _0x543e=function(_0xe02f2a,_0x25082a){_0xe02f2a=_0xe02f2a-0x0;var _0x185257=_0x43e5[_0xe02f2a];return _0x185257;};'use strict';var _=require(_0x543e('0x0'));var md5=require(_0x543e('0x1'));var util=require(_0x543e('0x2'));var Redis=require(_0x543e('0x3'));var config=require(_0x543e('0x4'));config[_0x543e('0x5')]=_[_0x543e('0x6')](config[_0x543e('0x5')],{'host':_0x543e('0x7'),'port':0x18eb});var io=require(_0x543e('0x8'))(new Redis(config[_0x543e('0x5')]));function ChatQueue(_0xc75efc){this['id']=_0xc75efc['id']||0x0;this[_0x543e('0x9')]=_0xc75efc[_0x543e('0x9')]||'';this[_0x543e('0xa')]=_0xc75efc[_0x543e('0xa')]||0xa;this['strategy']=_0xc75efc[_0x543e('0xb')]||_0x543e('0xc');this['Agents']=_0xc75efc['Agents'];this[_0x543e('0xd')]={};this['waiting']=0x0;this[_0x543e('0x1')]='';this[_0x543e('0xe')]();this[_0x543e('0xf')]();}ChatQueue[_0x543e('0x10')][_0x543e('0xe')]=function(){var _0x13bea1=this['mapAgentsId'][_0x543e('0x11')];this[_0x543e('0xd')]=_[_0x543e('0x12')](this[_0x543e('0x13')],'id');this[_0x543e('0xd')][_0x543e('0x11')]=_0x13bea1;};ChatQueue[_0x543e('0x10')]['updateRealtime']=function(){this[_0x543e('0x14')]=0x0;this[_0x543e('0x15')]=0x0;for(var _0x32ba93=0x0;_0x32ba93=0x0?this[_0x543e('0x18')]:0x0;var _0xfb9ed2={'id':this['id'],'available':this[_0x543e('0x18')],'loggedIn':this[_0x543e('0x14')],'name':this[_0x543e('0x9')],'paused':this[_0x543e('0x15')],'waiting':this['waiting']};var _0x1137f1=md5(JSON[_0x543e('0x19')](_0xfb9ed2));if(this[_0x543e('0x1')]!==_0x1137f1){this[_0x543e('0x1')]=_0x1137f1;io['to'](util[_0x543e('0x1a')](_0x543e('0x1b'),_0xfb9ed2[_0x543e('0x9')]))[_0x543e('0x1c')]('chat_queue:save',_0xfb9ed2);}};module[_0x543e('0x1d')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 28c2c57..71dd0bb 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 _0x64d8=['waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','faxPause','available','stringify','format','fax_queue:save','exports','lodash','md5','util','../../../config/environment','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents'];(function(_0x31f317,_0x39b141){var _0x547eb3=function(_0x3bcfe0){while(--_0x3bcfe0){_0x31f317['push'](_0x31f317['shift']());}};_0x547eb3(++_0x39b141);}(_0x64d8,0xdc));var _0x864d=function(_0x18a01c,_0xd1a13a){_0x18a01c=_0x18a01c-0x0;var _0x2b0cd6=_0x64d8[_0x18a01c];return _0x2b0cd6;};'use strict';var _=require(_0x864d('0x0'));var md5=require(_0x864d('0x1'));var util=require(_0x864d('0x2'));var Redis=require('ioredis');var config=require(_0x864d('0x3'));config[_0x864d('0x4')]=_[_0x864d('0x5')](config[_0x864d('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x864d('0x6'))(new Redis(config['redis']));function FaxQueue(_0x51bcdf){this['id']=_0x51bcdf['id']||0x0;this[_0x864d('0x7')]=_0x51bcdf['name']||'';this[_0x864d('0x8')]=_0x51bcdf[_0x864d('0x8')]||0xa;this['strategy']=_0x51bcdf[_0x864d('0x9')]||_0x864d('0xa');this[_0x864d('0xb')]=_0x51bcdf['Agents'];this['mapAgentsId']={};this[_0x864d('0xc')]=0x0;this[_0x864d('0x1')]='';this[_0x864d('0xd')]();this[_0x864d('0xe')]();}FaxQueue['prototype'][_0x864d('0xd')]=function(){var _0x1a0abf=this[_0x864d('0xf')][_0x864d('0x10')];this['mapAgentsId']=_[_0x864d('0x11')](this[_0x864d('0xb')],'id');this[_0x864d('0xf')][_0x864d('0x10')]=_0x1a0abf;};FaxQueue[_0x864d('0x12')]['updateRealtime']=function(){this[_0x864d('0x13')]=0x0;this[_0x864d('0x14')]=0x0;for(var _0x4b58f2=0x0;_0x4b58f2=0x0?this[_0x864d('0x18')]:0x0;var _0x1682a9={'id':this['id'],'available':this[_0x864d('0x18')],'loggedIn':this[_0x864d('0x13')],'name':this[_0x864d('0x7')],'paused':this[_0x864d('0x14')],'waiting':this[_0x864d('0xc')]};var _0x3a7e7d=md5(JSON[_0x864d('0x19')](_0x1682a9));if(this[_0x864d('0x1')]!==_0x3a7e7d){this[_0x864d('0x1')]=_0x3a7e7d;io['to'](util[_0x864d('0x1a')]('fax:queue:%s',_0x1682a9[_0x864d('0x7')]))['emit'](_0x864d('0x1b'),_0x1682a9);}};module[_0x864d('0x1c')]=FaxQueue; \ No newline at end of file +var _0xc2b0=['redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','md5','updateRouting','_rr','map','updateRealtime','loggedIn','paused','length','faxPause','available','waiting','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','util','../../../config/environment'];(function(_0x5dfd65,_0x1ad889){var _0x47f853=function(_0x3fafbf){while(--_0x3fafbf){_0x5dfd65['push'](_0x5dfd65['shift']());}};_0x47f853(++_0x1ad889);}(_0xc2b0,0x176));var _0x0c2b=function(_0x5d8502,_0x3a7146){_0x5d8502=_0x5d8502-0x0;var _0x58804c=_0xc2b0[_0x5d8502];return _0x58804c;};'use strict';var _=require(_0x0c2b('0x0'));var md5=require('md5');var util=require(_0x0c2b('0x1'));var Redis=require('ioredis');var config=require(_0x0c2b('0x2'));config[_0x0c2b('0x3')]=_[_0x0c2b('0x4')](config[_0x0c2b('0x3')],{'host':_0x0c2b('0x5'),'port':0x18eb});var io=require(_0x0c2b('0x6'))(new Redis(config['redis']));function FaxQueue(_0x3112fe){this['id']=_0x3112fe['id']||0x0;this[_0x0c2b('0x7')]=_0x3112fe[_0x0c2b('0x7')]||'';this[_0x0c2b('0x8')]=_0x3112fe['timeout']||0xa;this['strategy']=_0x3112fe[_0x0c2b('0x9')]||_0x0c2b('0xa');this[_0x0c2b('0xb')]=_0x3112fe[_0x0c2b('0xb')];this[_0x0c2b('0xc')]={};this['waiting']=0x0;this[_0x0c2b('0xd')]='';this[_0x0c2b('0xe')]();this['updateRealtime']();}FaxQueue['prototype'][_0x0c2b('0xe')]=function(){var _0x358863=this[_0x0c2b('0xc')][_0x0c2b('0xf')];this['mapAgentsId']=_[_0x0c2b('0x10')](this[_0x0c2b('0xb')],'id');this[_0x0c2b('0xc')][_0x0c2b('0xf')]=_0x358863;};FaxQueue['prototype'][_0x0c2b('0x11')]=function(){this[_0x0c2b('0x12')]=0x0;this[_0x0c2b('0x13')]=0x0;for(var _0x3c66ef=0x0;_0x3c66ef=0x0?this[_0x0c2b('0x16')]:0x0;var _0x495ae9={'id':this['id'],'available':this[_0x0c2b('0x16')],'loggedIn':this['loggedIn'],'name':this[_0x0c2b('0x7')],'paused':this[_0x0c2b('0x13')],'waiting':this[_0x0c2b('0x17')]};var _0x4b662a=md5(JSON['stringify'](_0x495ae9));if(this[_0x0c2b('0xd')]!==_0x4b662a){this[_0x0c2b('0xd')]=_0x4b662a;io['to'](util[_0x0c2b('0x18')](_0x0c2b('0x19'),_0x495ae9['name']))[_0x0c2b('0x1a')](_0x0c2b('0x1b'),_0x495ae9);}};module[_0x0c2b('0x1c')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index e5f2352..68e07d7 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 _0x9ba7=['Intervals','exports','name'];(function(_0x73b95,_0xb1332a){var _0x59865b=function(_0x218f84){while(--_0x218f84){_0x73b95['push'](_0x73b95['shift']());}};_0x59865b(++_0xb1332a);}(_0x9ba7,0x8f));var _0x79ba=function(_0x5581ba,_0x268887){_0x5581ba=_0x5581ba-0x0;var _0x1e927f=_0x9ba7[_0x5581ba];return _0x1e927f;};'use strict';function Interval(_0x3a2576){this['id']=_0x3a2576['id']||0x0;this[_0x79ba('0x0')]=_0x3a2576['name']||'';this[_0x79ba('0x1')]=_0x3a2576[_0x79ba('0x1')]||{};}module[_0x79ba('0x2')]=Interval; \ No newline at end of file +var _0xe272=['exports','name','Intervals'];(function(_0x4f6ecf,_0x1232a4){var _0x24e86d=function(_0x18cd3d){while(--_0x18cd3d){_0x4f6ecf['push'](_0x4f6ecf['shift']());}};_0x24e86d(++_0x1232a4);}(_0xe272,0x11b));var _0x2e27=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xe272[_0x297fd3];return _0x2af381;};'use strict';function Interval(_0x383dd1){this['id']=_0x383dd1['id']||0x0;this[_0x2e27('0x0')]=_0x383dd1[_0x2e27('0x0')]||'';this[_0x2e27('0x1')]=_0x383dd1['Intervals']||{};}module[_0x2e27('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 9b5c689..5c222dd 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 _0xf4f1=['md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','Agents','_rr','length','online','mailPause','paused','available','loggedIn','stringify','format','mail:queue:%s','exports','lodash'];(function(_0x2a880e,_0x44beb7){var _0x45e0ce=function(_0x10cbc2){while(--_0x10cbc2){_0x2a880e['push'](_0x2a880e['shift']());}};_0x45e0ce(++_0x44beb7);}(_0xf4f1,0x95));var _0x1f4f=function(_0x338d37,_0xe971d7){_0x338d37=_0x338d37-0x0;var _0xa95f8f=_0xf4f1[_0x338d37];return _0xa95f8f;};'use strict';var _=require(_0x1f4f('0x0'));var md5=require(_0x1f4f('0x1'));var util=require(_0x1f4f('0x2'));var Redis=require(_0x1f4f('0x3'));var config=require(_0x1f4f('0x4'));config[_0x1f4f('0x5')]=_[_0x1f4f('0x6')](config[_0x1f4f('0x5')],{'host':_0x1f4f('0x7'),'port':0x18eb});var io=require(_0x1f4f('0x8'))(new Redis(config[_0x1f4f('0x5')]));function MailQueue(_0x488f9f){this['id']=_0x488f9f['id']||0x0;this[_0x1f4f('0x9')]=_0x488f9f[_0x1f4f('0x9')]||'';this[_0x1f4f('0xa')]=_0x488f9f['timeout']||0xa;this[_0x1f4f('0xb')]=_0x488f9f[_0x1f4f('0xb')]||_0x1f4f('0xc');this['Agents']=_0x488f9f['Agents'];this[_0x1f4f('0xd')]={};this[_0x1f4f('0xe')]=0x0;this[_0x1f4f('0x1')]='';this['updateRouting']();this[_0x1f4f('0xf')]();}MailQueue[_0x1f4f('0x10')][_0x1f4f('0x11')]=function(){var _0x2c068d=this[_0x1f4f('0xd')]['_rr'];this['mapAgentsId']=_['map'](this[_0x1f4f('0x12')],'id');this[_0x1f4f('0xd')][_0x1f4f('0x13')]=_0x2c068d;};MailQueue[_0x1f4f('0x10')][_0x1f4f('0xf')]=function(){this['loggedIn']=0x0;this['paused']=0x0;for(var _0x2cf6db=0x0;_0x2cf6db=0x0?this['available']:0x0;var _0x173f47={'id':this['id'],'available':this[_0x1f4f('0x18')],'loggedIn':this['loggedIn'],'name':this[_0x1f4f('0x9')],'paused':this[_0x1f4f('0x17')],'waiting':this['waiting']};var _0x2dad5e=md5(JSON[_0x1f4f('0x1a')](_0x173f47));if(this[_0x1f4f('0x1')]!==_0x2dad5e){this[_0x1f4f('0x1')]=_0x2dad5e;io['to'](util[_0x1f4f('0x1b')](_0x1f4f('0x1c'),_0x173f47[_0x1f4f('0x9')]))['emit']('mail_queue:save',_0x173f47);}};module[_0x1f4f('0x1d')]=MailQueue; \ No newline at end of file +var _0x6c60=['localhost','socket.io-emitter','name','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','loggedIn','length','online','mailPause','available','paused','stringify','md5','mail:queue:%s','emit','mail_queue:save','lodash','util','../../../config/environment','redis','defaults'];(function(_0x4176b1,_0x177e05){var _0x3fdc4f=function(_0x2f0aa4){while(--_0x2f0aa4){_0x4176b1['push'](_0x4176b1['shift']());}};_0x3fdc4f(++_0x177e05);}(_0x6c60,0x175));var _0x06c6=function(_0x1bbc08,_0x444008){_0x1bbc08=_0x1bbc08-0x0;var _0x5d825b=_0x6c60[_0x1bbc08];return _0x5d825b;};'use strict';var _=require(_0x06c6('0x0'));var md5=require('md5');var util=require(_0x06c6('0x1'));var Redis=require('ioredis');var config=require(_0x06c6('0x2'));config[_0x06c6('0x3')]=_[_0x06c6('0x4')](config['redis'],{'host':_0x06c6('0x5'),'port':0x18eb});var io=require(_0x06c6('0x6'))(new Redis(config[_0x06c6('0x3')]));function MailQueue(_0x5ae199){this['id']=_0x5ae199['id']||0x0;this[_0x06c6('0x7')]=_0x5ae199[_0x06c6('0x7')]||'';this['timeout']=_0x5ae199['timeout']||0xa;this['strategy']=_0x5ae199[_0x06c6('0x8')]||_0x06c6('0x9');this['Agents']=_0x5ae199[_0x06c6('0xa')];this[_0x06c6('0xb')]={};this[_0x06c6('0xc')]=0x0;this['md5']='';this[_0x06c6('0xd')]();this[_0x06c6('0xe')]();}MailQueue[_0x06c6('0xf')][_0x06c6('0xd')]=function(){var _0x5324cd=this[_0x06c6('0xb')]['_rr'];this['mapAgentsId']=_['map'](this[_0x06c6('0xa')],'id');this['mapAgentsId']['_rr']=_0x5324cd;};MailQueue[_0x06c6('0xf')]['updateRealtime']=function(){this[_0x06c6('0x10')]=0x0;this['paused']=0x0;for(var _0x741fac=0x0;_0x741fac=0x0?this[_0x06c6('0x14')]:0x0;var _0x47ab40={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0x06c6('0x7')],'paused':this[_0x06c6('0x15')],'waiting':this[_0x06c6('0xc')]};var _0x4fd325=md5(JSON[_0x06c6('0x16')](_0x47ab40));if(this[_0x06c6('0x17')]!==_0x4fd325){this['md5']=_0x4fd325;io['to'](util['format'](_0x06c6('0x18'),_0x47ab40[_0x06c6('0x7')]))[_0x06c6('0x19')](_0x06c6('0x1a'),_0x47ab40);}};module['exports']=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index b7bfc79..251e75e 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 _0x5fc3=['format','openchannel:queue:%s','name','emit','openchannel_queue:save','exports','lodash','md5','ioredis','../../../config/environment','redis','defaults','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','prototype','loggedIn','paused','openchannelPause','available'];(function(_0x834637,_0x1b0ce9){var _0x44d3a0=function(_0x10f79b){while(--_0x10f79b){_0x834637['push'](_0x834637['shift']());}};_0x44d3a0(++_0x1b0ce9);}(_0x5fc3,0xa8));var _0x35fc=function(_0x247fa1,_0x4ec37c){_0x247fa1=_0x247fa1-0x0;var _0x244f35=_0x5fc3[_0x247fa1];return _0x244f35;};'use strict';var _=require(_0x35fc('0x0'));var md5=require(_0x35fc('0x1'));var util=require('util');var Redis=require(_0x35fc('0x2'));var config=require(_0x35fc('0x3'));config[_0x35fc('0x4')]=_[_0x35fc('0x5')](config[_0x35fc('0x4')],{'host':'localhost','port':0x18eb});var io=require(_0x35fc('0x6'))(new Redis(config[_0x35fc('0x4')]));function OpenchannelQueue(_0x186a06){this['id']=_0x186a06['id']||0x0;this['name']=_0x186a06['name']||'';this[_0x35fc('0x7')]=_0x186a06['timeout']||0xa;this[_0x35fc('0x8')]=_0x186a06[_0x35fc('0x8')]||_0x35fc('0x9');this[_0x35fc('0xa')]=_0x186a06[_0x35fc('0xa')];this[_0x35fc('0xb')]={};this[_0x35fc('0xc')]=0x0;this['md5']='';this[_0x35fc('0xd')]();this[_0x35fc('0xe')]();}OpenchannelQueue['prototype'][_0x35fc('0xd')]=function(){var _0x33f491=this['mapAgentsId'][_0x35fc('0xf')];this[_0x35fc('0xb')]=_['map'](this['Agents'],'id');this[_0x35fc('0xb')]['_rr']=_0x33f491;};OpenchannelQueue[_0x35fc('0x10')][_0x35fc('0xe')]=function(){this[_0x35fc('0x11')]=0x0;this[_0x35fc('0x12')]=0x0;for(var _0x38d9f2=0x0;_0x38d9f2=0x0?this['available']:0x0;var _0x41e165={'id':this['id'],'available':this[_0x35fc('0x14')],'loggedIn':this[_0x35fc('0x11')],'name':this['name'],'paused':this[_0x35fc('0x12')],'waiting':this[_0x35fc('0xc')]};var _0x465eb3=md5(JSON['stringify'](_0x41e165));if(this[_0x35fc('0x1')]!==_0x465eb3){this[_0x35fc('0x1')]=_0x465eb3;io['to'](util[_0x35fc('0x15')](_0x35fc('0x16'),_0x41e165[_0x35fc('0x17')]))[_0x35fc('0x18')](_0x35fc('0x19'),_0x41e165);}};module[_0x35fc('0x1a')]=OpenchannelQueue; \ No newline at end of file +var _0xc4aa=['strategy','Agents','mapAgentsId','updateRouting','updateRealtime','map','_rr','prototype','loggedIn','paused','length','online','available','waiting','stringify','format','openchannel:queue:%s','emit','openchannel_queue:save','lodash','md5','util','ioredis','../../../config/environment','redis','socket.io-emitter','name','timeout'];(function(_0x44946b,_0xf874ec){var _0x249bc4=function(_0x40a23e){while(--_0x40a23e){_0x44946b['push'](_0x44946b['shift']());}};_0x249bc4(++_0xf874ec);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x46698a,_0x8de1e4){_0x46698a=_0x46698a-0x0;var _0x356db0=_0xc4aa[_0x46698a];return _0x356db0;};'use strict';var _=require(_0xac4a('0x0'));var md5=require(_0xac4a('0x1'));var util=require(_0xac4a('0x2'));var Redis=require(_0xac4a('0x3'));var config=require(_0xac4a('0x4'));config[_0xac4a('0x5')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0xac4a('0x6'))(new Redis(config[_0xac4a('0x5')]));function OpenchannelQueue(_0x730a38){this['id']=_0x730a38['id']||0x0;this[_0xac4a('0x7')]=_0x730a38[_0xac4a('0x7')]||'';this[_0xac4a('0x8')]=_0x730a38[_0xac4a('0x8')]||0xa;this[_0xac4a('0x9')]=_0x730a38['strategy']||'beepall';this[_0xac4a('0xa')]=_0x730a38[_0xac4a('0xa')];this[_0xac4a('0xb')]={};this['waiting']=0x0;this[_0xac4a('0x1')]='';this[_0xac4a('0xc')]();this[_0xac4a('0xd')]();}OpenchannelQueue['prototype'][_0xac4a('0xc')]=function(){var _0x488e3c=this[_0xac4a('0xb')]['_rr'];this[_0xac4a('0xb')]=_[_0xac4a('0xe')](this[_0xac4a('0xa')],'id');this['mapAgentsId'][_0xac4a('0xf')]=_0x488e3c;};OpenchannelQueue[_0xac4a('0x10')][_0xac4a('0xd')]=function(){this[_0xac4a('0x11')]=0x0;this[_0xac4a('0x12')]=0x0;for(var _0x3b71c0=0x0;_0x3b71c0=0x0?this[_0xac4a('0x15')]:0x0;var _0x44ec59={'id':this['id'],'available':this['available'],'loggedIn':this['loggedIn'],'name':this[_0xac4a('0x7')],'paused':this[_0xac4a('0x12')],'waiting':this[_0xac4a('0x16')]};var _0x4d837c=md5(JSON[_0xac4a('0x17')](_0x44ec59));if(this[_0xac4a('0x1')]!==_0x4d837c){this[_0xac4a('0x1')]=_0x4d837c;io['to'](util[_0xac4a('0x18')](_0xac4a('0x19'),_0x44ec59[_0xac4a('0x7')]))[_0xac4a('0x1a')](_0xac4a('0x1b'),_0x44ec59);}};module['exports']=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index 3d0422e..bc41782 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 _0x01fe=['defaults','redis','localhost','socket.io-emitter','name','timeout','strategy','Agents','waiting','updateRouting','updateRealtime','mapAgentsId','_rr','map','prototype','loggedIn','paused','length','online','available','stringify','md5','sms:queue:%s','emit','sms_queue:save','exports','lodash','util','ioredis'];(function(_0x102402,_0x4eaaf8){var _0x321b44=function(_0x198c94){while(--_0x198c94){_0x102402['push'](_0x102402['shift']());}};_0x321b44(++_0x4eaaf8);}(_0x01fe,0x102));var _0xe01f=function(_0x18958f,_0x3a4b37){_0x18958f=_0x18958f-0x0;var _0x53cc5c=_0x01fe[_0x18958f];return _0x53cc5c;};'use strict';var _=require(_0xe01f('0x0'));var md5=require('md5');var util=require(_0xe01f('0x1'));var Redis=require(_0xe01f('0x2'));var config=require('../../../config/environment');config['redis']=_[_0xe01f('0x3')](config[_0xe01f('0x4')],{'host':_0xe01f('0x5'),'port':0x18eb});var io=require(_0xe01f('0x6'))(new Redis(config['redis']));function SmsQueue(_0x14340f){this['id']=_0x14340f['id']||0x0;this['name']=_0x14340f[_0xe01f('0x7')]||'';this[_0xe01f('0x8')]=_0x14340f[_0xe01f('0x8')]||0xa;this[_0xe01f('0x9')]=_0x14340f[_0xe01f('0x9')]||'beepall';this[_0xe01f('0xa')]=_0x14340f[_0xe01f('0xa')];this['mapAgentsId']={};this[_0xe01f('0xb')]=0x0;this['md5']='';this[_0xe01f('0xc')]();this[_0xe01f('0xd')]();}SmsQueue['prototype'][_0xe01f('0xc')]=function(){var _0x4f409c=this[_0xe01f('0xe')][_0xe01f('0xf')];this[_0xe01f('0xe')]=_[_0xe01f('0x10')](this[_0xe01f('0xa')],'id');this[_0xe01f('0xe')][_0xe01f('0xf')]=_0x4f409c;};SmsQueue[_0xe01f('0x11')]['updateRealtime']=function(){this[_0xe01f('0x12')]=0x0;this[_0xe01f('0x13')]=0x0;for(var _0x2d55c8=0x0;_0x2d55c8=0x0?this[_0xe01f('0x16')]:0x0;var _0x26cd4d={'id':this['id'],'available':this[_0xe01f('0x16')],'loggedIn':this[_0xe01f('0x12')],'name':this['name'],'paused':this[_0xe01f('0x13')],'waiting':this['waiting']};var _0x948cfa=md5(JSON[_0xe01f('0x17')](_0x26cd4d));if(this[_0xe01f('0x18')]!==_0x948cfa){this[_0xe01f('0x18')]=_0x948cfa;io['to'](util['format'](_0xe01f('0x19'),_0x26cd4d[_0xe01f('0x7')]))[_0xe01f('0x1a')](_0xe01f('0x1b'),_0x26cd4d);}};module[_0xe01f('0x1c')]=SmsQueue; \ No newline at end of file +var _0xd382=['timeout','strategy','beepall','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','Agents','prototype','loggedIn','paused','length','online','smsPause','available','stringify','format','emit','sms_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xd382,0x1b6));var _0x2d38=function(_0x217b3f,_0x14640f){_0x217b3f=_0x217b3f-0x0;var _0x53b1c3=_0xd382[_0x217b3f];return _0x53b1c3;};'use strict';var _=require(_0x2d38('0x0'));var md5=require(_0x2d38('0x1'));var util=require(_0x2d38('0x2'));var Redis=require(_0x2d38('0x3'));var config=require(_0x2d38('0x4'));config[_0x2d38('0x5')]=_[_0x2d38('0x6')](config[_0x2d38('0x5')],{'host':_0x2d38('0x7'),'port':0x18eb});var io=require(_0x2d38('0x8'))(new Redis(config['redis']));function SmsQueue(_0x551289){this['id']=_0x551289['id']||0x0;this['name']=_0x551289[_0x2d38('0x9')]||'';this[_0x2d38('0xa')]=_0x551289['timeout']||0xa;this[_0x2d38('0xb')]=_0x551289[_0x2d38('0xb')]||_0x2d38('0xc');this['Agents']=_0x551289['Agents'];this[_0x2d38('0xd')]={};this[_0x2d38('0xe')]=0x0;this[_0x2d38('0x1')]='';this['updateRouting']();this[_0x2d38('0xf')]();}SmsQueue['prototype'][_0x2d38('0x10')]=function(){var _0x3bfc7f=this[_0x2d38('0xd')][_0x2d38('0x11')];this[_0x2d38('0xd')]=_[_0x2d38('0x12')](this[_0x2d38('0x13')],'id');this['mapAgentsId'][_0x2d38('0x11')]=_0x3bfc7f;};SmsQueue[_0x2d38('0x14')][_0x2d38('0xf')]=function(){this[_0x2d38('0x15')]=0x0;this[_0x2d38('0x16')]=0x0;for(var _0x5cc0a4=0x0;_0x5cc0a4=0x0?this[_0x2d38('0x1a')]:0x0;var _0x45c7a8={'id':this['id'],'available':this[_0x2d38('0x1a')],'loggedIn':this['loggedIn'],'name':this[_0x2d38('0x9')],'paused':this[_0x2d38('0x16')],'waiting':this['waiting']};var _0x42c23e=md5(JSON[_0x2d38('0x1b')](_0x45c7a8));if(this[_0x2d38('0x1')]!==_0x42c23e){this['md5']=_0x42c23e;io['to'](util[_0x2d38('0x1c')]('sms:queue:%s',_0x45c7a8['name']))[_0x2d38('0x1d')](_0x2d38('0x1e'),_0x45c7a8);}};module[_0x2d38('0x1f')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 3eeed3c..8df1f84 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 _0x3a16=['length','online','whatsappPause','paused','available','stringify','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','updateRouting','updateRealtime','prototype','_rr','map','loggedIn'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x3a16,0x140));var _0x63a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3a16[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x63a1('0x0'));var md5=require('md5');var util=require(_0x63a1('0x1'));var Redis=require(_0x63a1('0x2'));var config=require(_0x63a1('0x3'));config['redis']=_['defaults'](config[_0x63a1('0x4')],{'host':_0x63a1('0x5'),'port':0x18eb});var io=require(_0x63a1('0x6'))(new Redis(config[_0x63a1('0x4')]));function WhatsappQueue(_0x23e2fb){this['id']=_0x23e2fb['id']||0x0;this[_0x63a1('0x7')]=_0x23e2fb[_0x63a1('0x7')]||'';this[_0x63a1('0x8')]=_0x23e2fb[_0x63a1('0x8')]||0xa;this['strategy']=_0x23e2fb[_0x63a1('0x9')]||_0x63a1('0xa');this[_0x63a1('0xb')]=_0x23e2fb['Agents'];this[_0x63a1('0xc')]={};this[_0x63a1('0xd')]=0x0;this[_0x63a1('0xe')]='';this[_0x63a1('0xf')]();this[_0x63a1('0x10')]();}WhatsappQueue[_0x63a1('0x11')][_0x63a1('0xf')]=function(){var _0x2f53dd=this[_0x63a1('0xc')][_0x63a1('0x12')];this['mapAgentsId']=_[_0x63a1('0x13')](this[_0x63a1('0xb')],'id');this[_0x63a1('0xc')]['_rr']=_0x2f53dd;};WhatsappQueue[_0x63a1('0x11')][_0x63a1('0x10')]=function(){this[_0x63a1('0x14')]=0x0;this['paused']=0x0;for(var _0x4c1eb1=0x0;_0x4c1eb1=0x0?this[_0x63a1('0x19')]:0x0;var _0x24ef94={'id':this['id'],'available':this[_0x63a1('0x19')],'loggedIn':this[_0x63a1('0x14')],'name':this[_0x63a1('0x7')],'paused':this[_0x63a1('0x18')],'waiting':this[_0x63a1('0xd')]};var _0x15ac31=md5(JSON[_0x63a1('0x1a')](_0x24ef94));if(this[_0x63a1('0xe')]!==_0x15ac31){this['md5']=_0x15ac31;io['to'](util['format'](_0x63a1('0x1b'),_0x24ef94['name']))[_0x63a1('0x1c')](_0x63a1('0x1d'),_0x24ef94);}};module[_0x63a1('0x1e')]=WhatsappQueue; \ No newline at end of file +var _0x04ad=['../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','prototype','_rr','updateRealtime','loggedIn','paused','length','online','whatsappPause','available','stringify','md5','format','emit','exports','lodash','ioredis'];(function(_0x5404f6,_0x5900a7){var _0x13230b=function(_0x15be12){while(--_0x15be12){_0x5404f6['push'](_0x5404f6['shift']());}};_0x13230b(++_0x5900a7);}(_0x04ad,0x116));var _0xd04a=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x04ad[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xd04a('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xd04a('0x1'));var config=require(_0xd04a('0x2'));config[_0xd04a('0x3')]=_['defaults'](config[_0xd04a('0x3')],{'host':_0xd04a('0x4'),'port':0x18eb});var io=require(_0xd04a('0x5'))(new Redis(config[_0xd04a('0x3')]));function WhatsappQueue(_0x683852){this['id']=_0x683852['id']||0x0;this[_0xd04a('0x6')]=_0x683852['name']||'';this[_0xd04a('0x7')]=_0x683852[_0xd04a('0x7')]||0xa;this['strategy']=_0x683852[_0xd04a('0x8')]||_0xd04a('0x9');this[_0xd04a('0xa')]=_0x683852[_0xd04a('0xa')];this[_0xd04a('0xb')]={};this[_0xd04a('0xc')]=0x0;this['md5']='';this[_0xd04a('0xd')]();this['updateRealtime']();}WhatsappQueue[_0xd04a('0xe')][_0xd04a('0xd')]=function(){var _0x17d5e9=this[_0xd04a('0xb')]['_rr'];this[_0xd04a('0xb')]=_['map'](this[_0xd04a('0xa')],'id');this[_0xd04a('0xb')][_0xd04a('0xf')]=_0x17d5e9;};WhatsappQueue[_0xd04a('0xe')][_0xd04a('0x10')]=function(){this[_0xd04a('0x11')]=0x0;this[_0xd04a('0x12')]=0x0;for(var _0x592f4e=0x0;_0x592f4e=0x0?this['available']:0x0;var _0x1d2677={'id':this['id'],'available':this['available'],'loggedIn':this[_0xd04a('0x11')],'name':this[_0xd04a('0x6')],'paused':this[_0xd04a('0x12')],'waiting':this[_0xd04a('0xc')]};var _0x3865c0=md5(JSON[_0xd04a('0x17')](_0x1d2677));if(this[_0xd04a('0x18')]!==_0x3865c0){this[_0xd04a('0x18')]=_0x3865c0;io['to'](util[_0xd04a('0x19')]('whatsapp:queue:%s',_0x1d2677[_0xd04a('0x6')]))[_0xd04a('0x1a')]('whatsapp_queue:save',_0x1d2677);}};module[_0xd04a('0x1b')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 3f552d1..7b80044 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 _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3b5250,_0x7a0b2c){_0x3b5250=_0x3b5250-0x0;var _0xc844a1=_0xa9e0[_0x3b5250];return _0xc844a1;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xb10b=['faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','mapKeys','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','isUndefined','initIntervals','length','initOpenchannelQueues','updateRealtime','initChatQueues','chatQueues','initSmsQueues','updateRouting','initMailQueues','initFaxQueues','initWhatsappQueues','exports','bluebird','lodash','moment','../model/agent','../model/openchannelQueue','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','smsQueues','mailQueues'];(function(_0x31770b,_0x28b167){var _0x5bcaf0=function(_0x2ef034){while(--_0x2ef034){_0x31770b['push'](_0x31770b['shift']());}};_0x5bcaf0(++_0x28b167);}(_0xb10b,0x12a));var _0xbb10=function(_0x4ec65f,_0x871c26){_0x4ec65f=_0x4ec65f-0x0;var _0x5d1143=_0xb10b[_0x4ec65f];return _0x5d1143;};'use strict';var BPromise=require(_0xbb10('0x0'));var util=require('util');var _=require(_0xbb10('0x1'));var moment=require(_0xbb10('0x2'));var Agent=require(_0xbb10('0x3'));var Interval=require('../model/interval');var OpenchannelQueue=require(_0xbb10('0x4'));var ChatQueue=require(_0xbb10('0x5'));var SmsQueue=require(_0xbb10('0x6'));var MailQueue=require(_0xbb10('0x7'));var FaxQueue=require(_0xbb10('0x8'));var WhatsappQueue=require(_0xbb10('0x9'));var Realtime=function(){this['agents']={};this[_0xbb10('0xa')]={};this[_0xbb10('0xb')]={};this['chatQueues']={};this[_0xbb10('0xc')]={};this[_0xbb10('0xd')]={};this[_0xbb10('0xe')]={};this[_0xbb10('0xf')]={};this[_0xbb10('0x10')]={};this[_0xbb10('0x11')]={};this[_0xbb10('0x12')]={};this[_0xbb10('0x13')]={};this['faxQueuesWaitingInteractions']={};this['whatsappQueuesWaitingInteractions']={};};function freeIsNotKey(_0x20bd61,_0x118a74,_0xce64f3){var _0x5e136d=_[_0xbb10('0x14')](_0x20bd61,function(_0x5be7e0,_0x44fb19){return _0x5be7e0[_0xce64f3];});for(var _0x916a32 in _0x118a74){if(_0x118a74[_0xbb10('0x15')](_0x916a32)){if(!_0x5e136d[_0x916a32]){delete _0x118a74[_0x916a32];}}}}Realtime[_0xbb10('0x16')][_0xbb10('0x17')]=function(_0x147230,_0x58a612){for(var _0x26e021 in _0x58a612){if(_0x147230[_0xbb10('0x15')](_0x26e021)){_0x147230[_0x26e021]=_0x58a612[_0x26e021];}}};Realtime[_0xbb10('0x16')][_0xbb10('0x18')]=function(){var _0x3df17b=this;return function(_0x2f2ebf){if(_0x2f2ebf){freeIsNotKey(_0x2f2ebf,_0x3df17b[_0xbb10('0x19')],'id');for(var _0x36b5e8=0x0,_0x3e26f4={},_0x2b184e={};_0x36b5e8<_0x2f2ebf['length'];_0x36b5e8+=0x1){_0x3e26f4=_0x2f2ebf[_0x36b5e8];if(_[_0xbb10('0x1a')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']])){_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']]=new Agent(_0x3e26f4);}else{_0x3df17b[_0xbb10('0x17')](_0x3df17b[_0xbb10('0x19')][_0x3e26f4['id']],_0x3e26f4);}}}return _0x3df17b[_0xbb10('0x19')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x1b')]=function(){var _0xbf2906=this;return function(_0xe1c665){if(_0xe1c665){freeIsNotKey(_0xe1c665,_0xbf2906['intervals'],'id');for(var _0x5ff0cf=0x0,_0x19f48d={},_0x388fab={};_0x5ff0cf<_0xe1c665[_0xbb10('0x1c')];_0x5ff0cf+=0x1){_0x19f48d=_0xe1c665[_0x5ff0cf];if(_[_0xbb10('0x1a')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']])){_0xbf2906['intervals'][_0x19f48d['id']]=new Interval(_0x19f48d);}else{_0xbf2906[_0xbb10('0x17')](_0xbf2906[_0xbb10('0xa')][_0x19f48d['id']],_0x19f48d);}}}return _0xbf2906['intervals'];};};Realtime['prototype'][_0xbb10('0x1d')]=function(){var _0x311abe=this;return function(_0x2e911d){if(_0x2e911d){freeIsNotKey(_0x2e911d,_0x311abe[_0xbb10('0xb')],'id');for(var _0x445761=0x0,_0x1824b7={},_0x407cb4={};_0x445761<_0x2e911d[_0xbb10('0x1c')];_0x445761+=0x1){_0x1824b7=_0x2e911d[_0x445761];if(_[_0xbb10('0x1a')](_0x311abe[_0xbb10('0xb')][_0x1824b7['id']])){_0x311abe[_0xbb10('0xb')][_0x1824b7['id']]=new OpenchannelQueue(_0x1824b7);}else{_0x311abe[_0xbb10('0x17')](_0x311abe['openchannelQueues'][_0x1824b7['id']],_0x1824b7);}_0x311abe['openchannelQueues'][_0x1824b7['id']]['updateRouting']();_0x311abe[_0xbb10('0xb')][_0x1824b7['id']][_0xbb10('0x1e')]();}}return _0x311abe[_0xbb10('0xb')];};};Realtime['prototype'][_0xbb10('0x1f')]=function(){var _0x24d586=this;return function(_0x6ed43b){if(_0x6ed43b){freeIsNotKey(_0x6ed43b,_0x24d586[_0xbb10('0x20')],'id');for(var _0x1acce9=0x0,_0x20d946={},_0x2a0e8b={};_0x1acce9<_0x6ed43b['length'];_0x1acce9+=0x1){_0x20d946=_0x6ed43b[_0x1acce9];if(_[_0xbb10('0x1a')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']])){_0x24d586[_0xbb10('0x20')][_0x20d946['id']]=new ChatQueue(_0x20d946);}else{_0x24d586[_0xbb10('0x17')](_0x24d586[_0xbb10('0x20')][_0x20d946['id']],_0x20d946);}_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRouting']();_0x24d586[_0xbb10('0x20')][_0x20d946['id']]['updateRealtime']();}}return _0x24d586[_0xbb10('0x20')];};};Realtime['prototype'][_0xbb10('0x21')]=function(){var _0x1dcc9c=this;return function(_0x1b59f9){if(_0x1b59f9){freeIsNotKey(_0x1b59f9,_0x1dcc9c['smsQueues'],'id');for(var _0x518d47=0x0,_0x4c3744={},_0x34f65e={};_0x518d47<_0x1b59f9['length'];_0x518d47+=0x1){_0x4c3744=_0x1b59f9[_0x518d47];if(_[_0xbb10('0x1a')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']])){_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']]=new SmsQueue(_0x4c3744);}else{_0x1dcc9c[_0xbb10('0x17')](_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']],_0x4c3744);}_0x1dcc9c[_0xbb10('0xc')][_0x4c3744['id']][_0xbb10('0x22')]();_0x1dcc9c['smsQueues'][_0x4c3744['id']][_0xbb10('0x1e')]();}}return _0x1dcc9c[_0xbb10('0xc')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x23')]=function(){var _0xfb2c5e=this;return function(_0x9de708){if(_0x9de708){freeIsNotKey(_0x9de708,_0xfb2c5e[_0xbb10('0xd')],'id');for(var _0x10202c=0x0,_0x3c8d7d={},_0x56943c={};_0x10202c<_0x9de708[_0xbb10('0x1c')];_0x10202c+=0x1){_0x3c8d7d=_0x9de708[_0x10202c];if(_[_0xbb10('0x1a')](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']])){_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']]=new MailQueue(_0x3c8d7d);}else{_0xfb2c5e['mergeFromDatabase'](_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']],_0x3c8d7d);}_0xfb2c5e['mailQueues'][_0x3c8d7d['id']]['updateRouting']();_0xfb2c5e[_0xbb10('0xd')][_0x3c8d7d['id']][_0xbb10('0x1e')]();}}return _0xfb2c5e[_0xbb10('0xd')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x24')]=function(){var _0x29d11a=this;return function(_0x547062){if(_0x547062){freeIsNotKey(_0x547062,_0x29d11a[_0xbb10('0xe')],'id');for(var _0x25d72f=0x0,_0x52de31={},_0x5e3fbd={};_0x25d72f<_0x547062['length'];_0x25d72f+=0x1){_0x52de31=_0x547062[_0x25d72f];if(_[_0xbb10('0x1a')](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']])){_0x29d11a[_0xbb10('0xe')][_0x52de31['id']]=new FaxQueue(_0x52de31);}else{_0x29d11a['mergeFromDatabase'](_0x29d11a[_0xbb10('0xe')][_0x52de31['id']],_0x52de31);}_0x29d11a[_0xbb10('0xe')][_0x52de31['id']][_0xbb10('0x22')]();_0x29d11a['faxQueues'][_0x52de31['id']][_0xbb10('0x1e')]();}}return _0x29d11a[_0xbb10('0xe')];};};Realtime[_0xbb10('0x16')][_0xbb10('0x25')]=function(){var _0x4f1cdd=this;return function(_0xd238e9){if(_0xd238e9){freeIsNotKey(_0xd238e9,_0x4f1cdd[_0xbb10('0xf')],'id');for(var _0x5835fd=0x0,_0xe2040f={},_0x2e3214={};_0x5835fd<_0xd238e9[_0xbb10('0x1c')];_0x5835fd+=0x1){_0xe2040f=_0xd238e9[_0x5835fd];if(_[_0xbb10('0x1a')](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']])){_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]=new WhatsappQueue(_0xe2040f);}else{_0x4f1cdd['mergeFromDatabase'](_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']],_0xe2040f);}_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']][_0xbb10('0x22')]();_0x4f1cdd[_0xbb10('0xf')][_0xe2040f['id']]['updateRealtime']();}}return _0x4f1cdd[_0xbb10('0xf')];};};module[_0xbb10('0x26')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index a253849..bd27361 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 _0xc0b3=['addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction','updateChatInteraction'];(function(_0x466ac3,_0x178907){var _0x3e498c=function(_0x52ddae){while(--_0x52ddae){_0x466ac3['push'](_0x466ac3['shift']());}};_0x3e498c(++_0x178907);}(_0xc0b3,0x7b));var _0x3c0b=function(_0x4225e5,_0x56a819){_0x4225e5=_0x4225e5-0x0;var _0x51a839=_0xc0b3[_0x4225e5];return _0x51a839;};'use strict';var client=require(_0x3c0b('0x0'));exports[_0x3c0b('0x1')]=function(_0x2c8e7f,_0x2ab2f0){return client[_0x3c0b('0x2')](_0x3c0b('0x3'),{'body':_0x2ab2f0,'options':{'where':{'id':_0x2c8e7f}},'log':_0x3c0b('0x4')});};exports[_0x3c0b('0x5')]=function(_0x3eefa0,_0x406c25){return client['Request'](_0x3c0b('0x6'),{'body':_0x406c25,'options':{'where':{'id':_0x3eefa0}},'log':_0x3c0b('0x7')});}; \ No newline at end of file +var _0x4242=['updateChatInteraction','addTags','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','Request','UpdateChatInteraction'];(function(_0x201ba6,_0x2a24f3){var _0x135c4d=function(_0x3f039d){while(--_0x3f039d){_0x201ba6['push'](_0x201ba6['shift']());}};_0x135c4d(++_0x2a24f3);}(_0x4242,0x174));var _0x2424=function(_0x1990f8,_0x354acd){_0x1990f8=_0x1990f8-0x0;var _0x405cde=_0x4242[_0x1990f8];return _0x405cde;};'use strict';var client=require(_0x2424('0x0'));exports[_0x2424('0x1')]=function(_0x439b6b,_0x243b69){return client[_0x2424('0x2')](_0x2424('0x3'),{'body':_0x243b69,'options':{'where':{'id':_0x439b6b}},'log':_0x2424('0x4')});};exports[_0x2424('0x5')]=function(_0xb44c21,_0x364c2a){return client[_0x2424('0x2')](_0x2424('0x6'),{'body':_0x364c2a,'options':{'where':{'id':_0xb44c21}},'log':_0x2424('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 0b22500..a7edc94 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 _0xdaa7=['../client','create','CreateChatMessage','createChatMessage'];(function(_0x2338fa,_0x80579a){var _0x42df9b=function(_0x13fe56){while(--_0x13fe56){_0x2338fa['push'](_0x2338fa['shift']());}};_0x42df9b(++_0x80579a);}(_0xdaa7,0x90));var _0x7daa=function(_0x4c7d8b,_0x572388){_0x4c7d8b=_0x4c7d8b-0x0;var _0x187158=_0xdaa7[_0x4c7d8b];return _0x187158;};'use strict';var client=require(_0x7daa('0x0'));exports[_0x7daa('0x1')]=function(_0x2424d1){return client['Request'](_0x7daa('0x2'),{'body':_0x2424d1,'log':_0x7daa('0x3')});}; \ No newline at end of file +var _0x9c77=['CreateChatMessage','createChatMessage','Request'];(function(_0x85f059,_0x27d70e){var _0x3520f7=function(_0x5b7c68){while(--_0x5b7c68){_0x85f059['push'](_0x85f059['shift']());}};_0x3520f7(++_0x27d70e);}(_0x9c77,0x176));var _0x79c7=function(_0x2c27bc,_0x57f722){_0x2c27bc=_0x2c27bc-0x0;var _0x2ec298=_0x9c77[_0x2c27bc];return _0x2ec298;};'use strict';var client=require('../client');exports['create']=function(_0x365f62){return client[_0x79c7('0x0')](_0x79c7('0x1'),{'body':_0x365f62,'log':_0x79c7('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 48e3852..682e851 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 _0xea31=['name','timeout','strategy','User','Agents','online','chatPause','getChatQueues','../client','Request','GetChatQueue'];(function(_0x3076b5,_0x6bc9df){var _0x5ef5da=function(_0xac1ad1){while(--_0xac1ad1){_0x3076b5['push'](_0x3076b5['shift']());}};_0x5ef5da(++_0x6bc9df);}(_0xea31,0x6b));var _0x1ea3=function(_0x45425c,_0x1f24c9){_0x45425c=_0x45425c-0x0;var _0x5118ed=_0xea31[_0x45425c];return _0x5118ed;};'use strict';var client=require(_0x1ea3('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x1ea3('0x1')](_0x1ea3('0x2'),{'options':{'raw':![],'attributes':['id',_0x1ea3('0x3'),_0x1ea3('0x4'),_0x1ea3('0x5')],'include':[{'model':_0x1ea3('0x6'),'as':_0x1ea3('0x7'),'attributes':['id','name',_0x1ea3('0x8'),_0x1ea3('0x9')]}]},'log':_0x1ea3('0xa')});};}; \ No newline at end of file +var _0xe93b=['getChatQueues','Request','GetChatQueue','timeout','strategy','User','Agents','name','online','chatPause'];(function(_0x20ef08,_0x4f1b14){var _0x3eadf2=function(_0x5391bc){while(--_0x5391bc){_0x20ef08['push'](_0x20ef08['shift']());}};_0x3eadf2(++_0x4f1b14);}(_0xe93b,0x1c2));var _0xbe93=function(_0x3e9a4e,_0x40ce39){_0x3e9a4e=_0x3e9a4e-0x0;var _0x1a044d=_0xe93b[_0x3e9a4e];return _0x1a044d;};'use strict';var client=require('../client');exports[_0xbe93('0x0')]=function(){return function(){return client[_0xbe93('0x1')](_0xbe93('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xbe93('0x3'),_0xbe93('0x4')],'include':[{'model':_0xbe93('0x5'),'as':_0xbe93('0x6'),'attributes':['id',_0xbe93('0x7'),_0xbe93('0x8'),_0xbe93('0x9')]}]},'log':_0xbe93('0x0')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index 150f698..7105a36 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 _0x02ef=['UpdateChatQueueReport','DESC','../client','CreateChatQueueReport','Request'];(function(_0x41768c,_0x1b2884){var _0x3ab8c0=function(_0x15649d){while(--_0x15649d){_0x41768c['push'](_0x41768c['shift']());}};_0x3ab8c0(++_0x1b2884);}(_0x02ef,0x11a));var _0xf02e=function(_0x13c673,_0x73db44){_0x13c673=_0x13c673-0x0;var _0x27dd05=_0x02ef[_0x13c673];return _0x27dd05;};'use strict';var client=require(_0xf02e('0x0'));exports['create']=function(_0x3c6866){return client['Request'](_0xf02e('0x1'),{'body':_0x3c6866,'log':_0xf02e('0x1')});};exports['update']=function(_0x158153,_0x4783f7){return client[_0xf02e('0x2')](_0xf02e('0x3'),{'body':_0x4783f7,'options':{'where':{'uniqueid':_0x158153},'order':[['id',_0xf02e('0x4')]],'limit':0x1},'log':'UpdateChatQueueReport'});}; \ No newline at end of file +var _0xac31=['Request','CreateChatQueueReport','update','UpdateChatQueueReport','../client','create'];(function(_0x2a4c2b,_0x1ce4a3){var _0x5c5cd1=function(_0x2f65e4){while(--_0x2f65e4){_0x2a4c2b['push'](_0x2a4c2b['shift']());}};_0x5c5cd1(++_0x1ce4a3);}(_0xac31,0xca));var _0x1ac3=function(_0x196077,_0x2f3c43){_0x196077=_0x196077-0x0;var _0x96252f=_0xac31[_0x196077];return _0x96252f;};'use strict';var client=require(_0x1ac3('0x0'));exports[_0x1ac3('0x1')]=function(_0x1cd966){return client[_0x1ac3('0x2')](_0x1ac3('0x3'),{'body':_0x1cd966,'log':_0x1ac3('0x3')});};exports[_0x1ac3('0x4')]=function(_0x59b42c,_0x33b5ab){return client[_0x1ac3('0x2')]('UpdateChatQueueReport',{'body':_0x33b5ab,'options':{'where':{'uniqueid':_0x59b42c},'order':[['id','DESC']],'limit':0x1},'log':_0x1ac3('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index daf658c..6850d63 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 _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x316efe,_0x3e8022){var _0x1efea6=function(_0x4a8333){while(--_0x4a8333){_0x316efe['push'](_0x316efe['shift']());}};_0x1efea6(++_0x3e8022);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x40e0f4,_0x2e51ed){var _0x45d66f=function(_0x2e03dc){while(--_0x2e03dc){_0x40e0f4['push'](_0x40e0f4['shift']());}};_0x45d66f(++_0x2e51ed);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index f2a5fc0..b2f6717 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 _0xe4d3=['CreateFaxMessage'];(function(_0xbc25e1,_0x27007d){var _0xaf0a85=function(_0x52acb3){while(--_0x52acb3){_0xbc25e1['push'](_0xbc25e1['shift']());}};_0xaf0a85(++_0x27007d);}(_0xe4d3,0x160));var _0x3e4d=function(_0x94bc6a,_0x3ffd48){_0x94bc6a=_0x94bc6a-0x0;var _0x1d6acd=_0xe4d3[_0x94bc6a];return _0x1d6acd;};'use strict';var client=require('../client');exports['create']=function(_0x210ad3){return client['Request'](_0x3e4d('0x0'),{'body':_0x210ad3,'log':'createFaxMessage'});}; \ No newline at end of file +var _0xe45c=['create','CreateFaxMessage','createFaxMessage','../client'];(function(_0x5a5c6b,_0x5baa12){var _0x5e24fc=function(_0x436b7a){while(--_0x436b7a){_0x5a5c6b['push'](_0x5a5c6b['shift']());}};_0x5e24fc(++_0x5baa12);}(_0xe45c,0x6f));var _0xce45=function(_0x50366c,_0x25594b){_0x50366c=_0x50366c-0x0;var _0x50cfaf=_0xe45c[_0x50366c];return _0x50cfaf;};'use strict';var client=require(_0xce45('0x0'));exports[_0xce45('0x1')]=function(_0x162e20){return client['Request'](_0xce45('0x2'),{'body':_0x162e20,'log':_0xce45('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index d398ef2..0ea6465 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 _0xc477=['Request','GetFaxQueue','name','timeout','strategy','User','Agents','faxPause','../client','getFaxQueues'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0xc477,0x152));var _0x7c47=function(_0x12d033,_0x25fa2f){_0x12d033=_0x12d033-0x0;var _0x3b4e80=_0xc477[_0x12d033];return _0x3b4e80;};'use strict';var client=require(_0x7c47('0x0'));exports[_0x7c47('0x1')]=function(){return function(){return client[_0x7c47('0x2')](_0x7c47('0x3'),{'options':{'raw':![],'attributes':['id',_0x7c47('0x4'),_0x7c47('0x5'),_0x7c47('0x6')],'include':[{'model':_0x7c47('0x7'),'as':_0x7c47('0x8'),'attributes':['id',_0x7c47('0x4'),'online',_0x7c47('0x9')]}]},'log':_0x7c47('0x1')});};}; \ No newline at end of file +var _0x4de6=['strategy','User','Agents','online','faxPause','Request','GetFaxQueue','name','timeout'];(function(_0x15e878,_0x93dda5){var _0x544834=function(_0x45a41b){while(--_0x45a41b){_0x15e878['push'](_0x15e878['shift']());}};_0x544834(++_0x93dda5);}(_0x4de6,0x9e));var _0x64de=function(_0x1956b5,_0x4940dc){_0x1956b5=_0x1956b5-0x0;var _0x48406d=_0x4de6[_0x1956b5];return _0x48406d;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x64de('0x0')](_0x64de('0x1'),{'options':{'raw':![],'attributes':['id',_0x64de('0x2'),_0x64de('0x3'),_0x64de('0x4')],'include':[{'model':_0x64de('0x5'),'as':_0x64de('0x6'),'attributes':['id',_0x64de('0x2'),_0x64de('0x7'),_0x64de('0x8')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index f5a6029..0f9f7ab 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 _0x5ab3=['Request','UpdateFaxQueueReport','DESC','../client','create','CreateFaxQueueReport','update'];(function(_0x1e0b32,_0x8fae14){var _0x2e104d=function(_0x21a7d2){while(--_0x21a7d2){_0x1e0b32['push'](_0x1e0b32['shift']());}};_0x2e104d(++_0x8fae14);}(_0x5ab3,0x1ed));var _0x35ab=function(_0x124164,_0xa5fee5){_0x124164=_0x124164-0x0;var _0x1fd861=_0x5ab3[_0x124164];return _0x1fd861;};'use strict';var client=require(_0x35ab('0x0'));exports[_0x35ab('0x1')]=function(_0x7b9204){return client['Request'](_0x35ab('0x2'),{'body':_0x7b9204,'log':_0x35ab('0x2')});};exports[_0x35ab('0x3')]=function(_0x5f0b93,_0x32d2d9){return client[_0x35ab('0x4')](_0x35ab('0x5'),{'body':_0x32d2d9,'options':{'where':{'uniqueid':_0x5f0b93},'order':[['id',_0x35ab('0x6')]],'limit':0x1},'log':_0x35ab('0x5')});}; \ No newline at end of file +var _0xbef0=['CreateFaxQueueReport','update','UpdateFaxQueueReport','DESC','create','Request'];(function(_0xe46ad5,_0x437e5c){var _0xc4e6aa=function(_0x52fd06){while(--_0x52fd06){_0xe46ad5['push'](_0xe46ad5['shift']());}};_0xc4e6aa(++_0x437e5c);}(_0xbef0,0x148));var _0x0bef=function(_0x116206,_0xb38062){_0x116206=_0x116206-0x0;var _0x4609ab=_0xbef0[_0x116206];return _0x4609ab;};'use strict';var client=require('../client');exports[_0x0bef('0x0')]=function(_0x3117eb){return client[_0x0bef('0x1')](_0x0bef('0x2'),{'body':_0x3117eb,'log':_0x0bef('0x2')});};exports[_0x0bef('0x3')]=function(_0x2df385,_0x26f4ea){return client[_0x0bef('0x1')](_0x0bef('0x4'),{'body':_0x26f4ea,'options':{'where':{'uniqueid':_0x2df385},'order':[['id',_0x0bef('0x5')]],'limit':0x1},'log':_0x0bef('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 6480ae8..3d37e7e 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 _0x4d7c=['getIntervals','Request','Interval','Intervals','interval'];(function(_0x114d1f,_0x55548e){var _0x5b91d4=function(_0x358415){while(--_0x358415){_0x114d1f['push'](_0x114d1f['shift']());}};_0x5b91d4(++_0x55548e);}(_0x4d7c,0x118));var _0xc4d7=function(_0x3effa2,_0x24f486){_0x3effa2=_0x3effa2-0x0;var _0x592795=_0x4d7c[_0x3effa2];return _0x592795;};'use strict';var client=require('../client');exports[_0xc4d7('0x0')]=function(){return function(){return client[_0xc4d7('0x1')]('GetInterval',{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id','name'],'include':[{'model':_0xc4d7('0x2'),'as':_0xc4d7('0x3'),'attributes':['id','name',_0xc4d7('0x4')]}]},'log':_0xc4d7('0x0')});};}; \ No newline at end of file +var _0x302b=['name','Interval','interval','getIntervals','GetInterval'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x302b,0x121));var _0xb302=function(_0x35da42,_0x5c2610){_0x35da42=_0x35da42-0x0;var _0x370035=_0x302b[_0x35da42];return _0x370035;};'use strict';var client=require('../client');exports['getIntervals']=function(){return function(){return client['Request'](_0xb302('0x0'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xb302('0x1')],'include':[{'model':_0xb302('0x2'),'as':'Intervals','attributes':['id',_0xb302('0x1'),_0xb302('0x3')]}]},'log':_0xb302('0x4')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index cd805dd..f416327 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 _0x57ca=['UpdateMailInteraction','updateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction','update','Request'];(function(_0x104b6f,_0x2298a1){var _0x528acf=function(_0x2564f6){while(--_0x2564f6){_0x104b6f['push'](_0x104b6f['shift']());}};_0x528acf(++_0x2298a1);}(_0x57ca,0x108));var _0xa57c=function(_0x2495da,_0x53be46){_0x2495da=_0x2495da-0x0;var _0x351a4c=_0x57ca[_0x2495da];return _0x351a4c;};'use strict';var client=require('../client');exports[_0xa57c('0x0')]=function(_0x4ad696,_0x4b1712){return client[_0xa57c('0x1')](_0xa57c('0x2'),{'body':_0x4b1712,'options':{'where':{'id':_0x4ad696}},'log':_0xa57c('0x3')});};exports[_0xa57c('0x4')]=function(_0x1da469,_0x48be2d){return client[_0xa57c('0x1')](_0xa57c('0x5'),{'body':_0x48be2d,'options':{'where':{'id':_0x1da469}},'log':_0xa57c('0x6')});}; \ No newline at end of file +var _0xdd4f=['../client','Request','UpdateMailInteraction','addTags','AddTagsToMailInteraction','addTagsToChatInteraction'];(function(_0x35a274,_0x98b399){var _0x40d905=function(_0x5c8455){while(--_0x5c8455){_0x35a274['push'](_0x35a274['shift']());}};_0x40d905(++_0x98b399);}(_0xdd4f,0x1ce));var _0xfdd4=function(_0x1102aa,_0x4251a4){_0x1102aa=_0x1102aa-0x0;var _0xa33952=_0xdd4f[_0x1102aa];return _0xa33952;};'use strict';var client=require(_0xfdd4('0x0'));exports['update']=function(_0x5656ab,_0x55d8f9){return client[_0xfdd4('0x1')](_0xfdd4('0x2'),{'body':_0x55d8f9,'options':{'where':{'id':_0x5656ab}},'log':'updateMailInteraction'});};exports[_0xfdd4('0x3')]=function(_0x3175f6,_0x6b2b0d){return client['Request'](_0xfdd4('0x4'),{'body':_0x6b2b0d,'options':{'where':{'id':_0x3175f6}},'log':_0xfdd4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 3e891ec..3534cd6 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 _0x230d=['CreateMailMessage','createMailMessage','create','Request'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x230d,0x1d2));var _0xd230=function(_0x19950b,_0x53d0d7){_0x19950b=_0x19950b-0x0;var _0x3c6b41=_0x230d[_0x19950b];return _0x3c6b41;};'use strict';var client=require('../client');exports[_0xd230('0x0')]=function(_0x421edb){return client[_0xd230('0x1')](_0xd230('0x2'),{'body':_0x421edb,'log':_0xd230('0x3')});}; \ No newline at end of file +var _0x7794=['../client','create','Request','CreateMailMessage'];(function(_0x33fe03,_0x7c917c){var _0x4b8744=function(_0x2a2549){while(--_0x2a2549){_0x33fe03['push'](_0x33fe03['shift']());}};_0x4b8744(++_0x7c917c);}(_0x7794,0xc0));var _0x4779=function(_0x3b4381,_0x1cc964){_0x3b4381=_0x3b4381-0x0;var _0x104e1c=_0x7794[_0x3b4381];return _0x104e1c;};'use strict';var client=require(_0x4779('0x0'));exports[_0x4779('0x1')]=function(_0x45f5df){return client[_0x4779('0x2')](_0x4779('0x3'),{'body':_0x45f5df,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index cb09a48..88745b6 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 _0x1575=['strategy','User','Agents','../client','getMailQueues','Request','timeout'];(function(_0x60df74,_0x458e29){var _0x5ee872=function(_0x356888){while(--_0x356888){_0x60df74['push'](_0x60df74['shift']());}};_0x5ee872(++_0x458e29);}(_0x1575,0x9d));var _0x5157=function(_0x31f770,_0x406a8f){_0x31f770=_0x31f770-0x0;var _0x9bafb7=_0x1575[_0x31f770];return _0x9bafb7;};'use strict';var client=require(_0x5157('0x0'));exports[_0x5157('0x1')]=function(){return function(){return client[_0x5157('0x2')]('GetMailQueue',{'options':{'raw':![],'attributes':['id','name',_0x5157('0x3'),_0x5157('0x4')],'include':[{'model':_0x5157('0x5'),'as':_0x5157('0x6'),'attributes':['id','name','online','mailPause']}]},'log':_0x5157('0x1')});};}; \ No newline at end of file +var _0x99a6=['Request','GetMailQueue','timeout','strategy','User','Agents','name','mailPause','../client','getMailQueues'];(function(_0xae3626,_0x3edc8e){var _0x500102=function(_0x16eb60){while(--_0x16eb60){_0xae3626['push'](_0xae3626['shift']());}};_0x500102(++_0x3edc8e);}(_0x99a6,0x120));var _0x699a=function(_0x3b1e6f,_0x17e752){_0x3b1e6f=_0x3b1e6f-0x0;var _0x5760a2=_0x99a6[_0x3b1e6f];return _0x5760a2;};'use strict';var client=require(_0x699a('0x0'));exports[_0x699a('0x1')]=function(){return function(){return client[_0x699a('0x2')](_0x699a('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x699a('0x4'),_0x699a('0x5')],'include':[{'model':_0x699a('0x6'),'as':_0x699a('0x7'),'attributes':['id',_0x699a('0x8'),'online',_0x699a('0x9')]}]},'log':_0x699a('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index e8ea4f3..fff8930 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 _0xc430=['../client','create','Request','update','UpdateMailQueueReport'];(function(_0x95a74b,_0xe6f566){var _0x141f96=function(_0x2df35b){while(--_0x2df35b){_0x95a74b['push'](_0x95a74b['shift']());}};_0x141f96(++_0xe6f566);}(_0xc430,0x7d));var _0x0c43=function(_0x21dd78,_0xd919bf){_0x21dd78=_0x21dd78-0x0;var _0x4a1818=_0xc430[_0x21dd78];return _0x4a1818;};'use strict';var client=require(_0x0c43('0x0'));exports[_0x0c43('0x1')]=function(_0x40928d){return client[_0x0c43('0x2')]('CreateMailQueueReport',{'body':_0x40928d,'log':'CreateMailQueueReport'});};exports[_0x0c43('0x3')]=function(_0x4ba7fb,_0x11b190){return client[_0x0c43('0x2')](_0x0c43('0x4'),{'body':_0x11b190,'options':{'where':{'uniqueid':_0x4ba7fb},'order':[['id','DESC']],'limit':0x1},'log':_0x0c43('0x4')});}; \ No newline at end of file +var _0xb21e=['DESC','../client','create','Request','CreateMailQueueReport','update','UpdateMailQueueReport'];(function(_0x39a2d6,_0x477459){var _0x23af66=function(_0x2eb95e){while(--_0x2eb95e){_0x39a2d6['push'](_0x39a2d6['shift']());}};_0x23af66(++_0x477459);}(_0xb21e,0x1cf));var _0xeb21=function(_0x1c546c,_0x5c57cb){_0x1c546c=_0x1c546c-0x0;var _0x2cc384=_0xb21e[_0x1c546c];return _0x2cc384;};'use strict';var client=require(_0xeb21('0x0'));exports[_0xeb21('0x1')]=function(_0x16a73b){return client[_0xeb21('0x2')]('CreateMailQueueReport',{'body':_0x16a73b,'log':_0xeb21('0x3')});};exports[_0xeb21('0x4')]=function(_0x5d1e64,_0x5e728a){return client[_0xeb21('0x2')](_0xeb21('0x5'),{'body':_0x5e728a,'options':{'where':{'uniqueid':_0x5d1e64},'order':[['id',_0xeb21('0x6')]],'limit':0x1},'log':_0xeb21('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index 80ac8b4..3150d37 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 _0x176f=['../client','update','Request','updateOpenchannelInteraction','AddTagsToOpenchannelInteraction','addTagsToChatInteraction'];(function(_0x3452bd,_0x403199){var _0x2c6606=function(_0x22d59d){while(--_0x22d59d){_0x3452bd['push'](_0x3452bd['shift']());}};_0x2c6606(++_0x403199);}(_0x176f,0x10e));var _0xf176=function(_0xa4fff2,_0xfd8e8f){_0xa4fff2=_0xa4fff2-0x0;var _0x1fd6d8=_0x176f[_0xa4fff2];return _0x1fd6d8;};'use strict';var client=require(_0xf176('0x0'));exports[_0xf176('0x1')]=function(_0x387c15,_0x5200e1){return client[_0xf176('0x2')]('UpdateOpenchannelInteraction',{'body':_0x5200e1,'options':{'where':{'id':_0x387c15}},'log':_0xf176('0x3')});};exports['addTags']=function(_0x51fc31,_0x2c60f7){return client[_0xf176('0x2')](_0xf176('0x4'),{'body':_0x2c60f7,'options':{'where':{'id':_0x51fc31}},'log':_0xf176('0x5')});}; \ No newline at end of file +var _0x93a5=['update','Request','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','../client'];(function(_0x3c4054,_0x585ab6){var _0x246c89=function(_0x4f305c){while(--_0x4f305c){_0x3c4054['push'](_0x3c4054['shift']());}};_0x246c89(++_0x585ab6);}(_0x93a5,0x1db));var _0x593a=function(_0x3f8a03,_0x319b9c){_0x3f8a03=_0x3f8a03-0x0;var _0x147fb2=_0x93a5[_0x3f8a03];return _0x147fb2;};'use strict';var client=require(_0x593a('0x0'));exports[_0x593a('0x1')]=function(_0x43ffa2,_0x22484e){return client[_0x593a('0x2')](_0x593a('0x3'),{'body':_0x22484e,'options':{'where':{'id':_0x43ffa2}},'log':_0x593a('0x4')});};exports[_0x593a('0x5')]=function(_0x195c4d,_0x5b5fda){return client['Request'](_0x593a('0x6'),{'body':_0x5b5fda,'options':{'where':{'id':_0x195c4d}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index dfd8e4e..2892d03 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 _0xc115=['create','Request','CreateOpenchannelMessage','../client'];(function(_0x2a878c,_0x3903ec){var _0x434c8e=function(_0x213353){while(--_0x213353){_0x2a878c['push'](_0x2a878c['shift']());}};_0x434c8e(++_0x3903ec);}(_0xc115,0x11f));var _0x5c11=function(_0xa4cd7a,_0x5582db){_0xa4cd7a=_0xa4cd7a-0x0;var _0xd4053a=_0xc115[_0xa4cd7a];return _0xd4053a;};'use strict';var client=require(_0x5c11('0x0'));exports[_0x5c11('0x1')]=function(_0x29a52f){return client[_0x5c11('0x2')](_0x5c11('0x3'),{'body':_0x29a52f,'log':'createOpenchannelMessage'});}; \ No newline at end of file +var _0x7af7=['create','Request','CreateOpenchannelMessage','createOpenchannelMessage','../client'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af7,0xae));var _0x77af=function(_0x46451c,_0x88ddd){_0x46451c=_0x46451c-0x0;var _0x12dce4=_0x7af7[_0x46451c];return _0x12dce4;};'use strict';var client=require(_0x77af('0x0'));exports[_0x77af('0x1')]=function(_0x717ad1){return client[_0x77af('0x2')](_0x77af('0x3'),{'body':_0x717ad1,'log':_0x77af('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index c21f0d0..466c266 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 _0xc212=['openchannelPause','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User','Agents','online'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc212,0x1af));var _0x2c21=function(_0x1c6753,_0x57d1d3){_0x1c6753=_0x1c6753-0x0;var _0x44600b=_0xc212[_0x1c6753];return _0x44600b;};'use strict';var client=require('../client');exports[_0x2c21('0x0')]=function(){return function(){return client[_0x2c21('0x1')](_0x2c21('0x2'),{'options':{'raw':![],'attributes':['id',_0x2c21('0x3'),_0x2c21('0x4'),_0x2c21('0x5')],'include':[{'model':_0x2c21('0x6'),'as':_0x2c21('0x7'),'attributes':['id',_0x2c21('0x3'),_0x2c21('0x8'),_0x2c21('0x9')]}]},'log':_0x2c21('0x0')});};}; \ No newline at end of file +var _0x90db=['Agents','online','openchannelPause','../client','getOpenchannelQueues','Request','GetOpenchannelQueue','name','timeout','strategy','User'];(function(_0x2c4666,_0x5468c2){var _0x28777b=function(_0x3a679){while(--_0x3a679){_0x2c4666['push'](_0x2c4666['shift']());}};_0x28777b(++_0x5468c2);}(_0x90db,0x179));var _0xb90d=function(_0x47e7cb,_0x4c1b8d){_0x47e7cb=_0x47e7cb-0x0;var _0x2a8874=_0x90db[_0x47e7cb];return _0x2a8874;};'use strict';var client=require(_0xb90d('0x0'));exports[_0xb90d('0x1')]=function(){return function(){return client[_0xb90d('0x2')](_0xb90d('0x3'),{'options':{'raw':![],'attributes':['id',_0xb90d('0x4'),_0xb90d('0x5'),_0xb90d('0x6')],'include':[{'model':_0xb90d('0x7'),'as':_0xb90d('0x8'),'attributes':['id','name',_0xb90d('0x9'),_0xb90d('0xa')]}]},'log':_0xb90d('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 831fe48..13dc66e 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 _0x44f8=['Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport','../client','create'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x44f8,0x1de));var _0x844f=function(_0x2e8b43,_0x2c9d7e){_0x2e8b43=_0x2e8b43-0x0;var _0x245adc=_0x44f8[_0x2e8b43];return _0x245adc;};'use strict';var client=require(_0x844f('0x0'));exports[_0x844f('0x1')]=function(_0x1d704c){return client[_0x844f('0x2')](_0x844f('0x3'),{'body':_0x1d704c,'log':_0x844f('0x3')});};exports['update']=function(_0x51cee4,_0x26151e){return client['Request']('UpdateOpenchannelQueueReport',{'body':_0x26151e,'options':{'where':{'uniqueid':_0x51cee4},'order':[['id','DESC']],'limit':0x1},'log':_0x844f('0x4')});}; \ No newline at end of file +var _0x4d71=['CreateOpenchannelQueueReport','update','Request','UpdateOpenchannelQueueReport','DESC','../client'];(function(_0x1cfa0d,_0x4391f2){var _0xe33279=function(_0x3ce7c1){while(--_0x3ce7c1){_0x1cfa0d['push'](_0x1cfa0d['shift']());}};_0xe33279(++_0x4391f2);}(_0x4d71,0x6b));var _0x14d7=function(_0x3d17ed,_0x4c3dd4){_0x3d17ed=_0x3d17ed-0x0;var _0x1289b6=_0x4d71[_0x3d17ed];return _0x1289b6;};'use strict';var client=require(_0x14d7('0x0'));exports['create']=function(_0x515979){return client['Request'](_0x14d7('0x1'),{'body':_0x515979,'log':_0x14d7('0x1')});};exports[_0x14d7('0x2')]=function(_0x2fface,_0x5d3bf7){return client[_0x14d7('0x3')](_0x14d7('0x4'),{'body':_0x5d3bf7,'options':{'where':{'uniqueid':_0x2fface},'order':[['id',_0x14d7('0x5')]],'limit':0x1},'log':_0x14d7('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index dcfe96d..0b27b32 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 _0x17ba=['addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','../client','update','Request','UpdateSmsInteraction','updateSmsInteraction'];(function(_0xf356fa,_0x4bb70e){var _0x4931b5=function(_0x290669){while(--_0x290669){_0xf356fa['push'](_0xf356fa['shift']());}};_0x4931b5(++_0x4bb70e);}(_0x17ba,0xab));var _0xa17b=function(_0x3b4b4e,_0x473d90){_0x3b4b4e=_0x3b4b4e-0x0;var _0x5bc9e2=_0x17ba[_0x3b4b4e];return _0x5bc9e2;};'use strict';var client=require(_0xa17b('0x0'));exports[_0xa17b('0x1')]=function(_0x4a2032,_0x2ce1c0){return client[_0xa17b('0x2')](_0xa17b('0x3'),{'body':_0x2ce1c0,'options':{'where':{'id':_0x4a2032}},'log':_0xa17b('0x4')});};exports[_0xa17b('0x5')]=function(_0x38c13c,_0x11d7b7){return client[_0xa17b('0x2')](_0xa17b('0x6'),{'body':_0x11d7b7,'options':{'where':{'id':_0x38c13c}},'log':_0xa17b('0x7')});}; \ No newline at end of file +var _0xfd28=['updateSmsInteraction','addTags','AddTagsToSmsInteraction','addTagsToSmsInteraction','update','Request'];(function(_0x1d9e24,_0x57987c){var _0x36f1dc=function(_0x5803a2){while(--_0x5803a2){_0x1d9e24['push'](_0x1d9e24['shift']());}};_0x36f1dc(++_0x57987c);}(_0xfd28,0x148));var _0x8fd2=function(_0x51b0dc,_0x5307b7){_0x51b0dc=_0x51b0dc-0x0;var _0x13fa89=_0xfd28[_0x51b0dc];return _0x13fa89;};'use strict';var client=require('../client');exports[_0x8fd2('0x0')]=function(_0x117219,_0x4d3190){return client[_0x8fd2('0x1')]('UpdateSmsInteraction',{'body':_0x4d3190,'options':{'where':{'id':_0x117219}},'log':_0x8fd2('0x2')});};exports[_0x8fd2('0x3')]=function(_0x4e2108,_0x4b22ae){return client[_0x8fd2('0x1')](_0x8fd2('0x4'),{'body':_0x4b22ae,'options':{'where':{'id':_0x4e2108}},'log':_0x8fd2('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 125d902..c9c0bec 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 _0x359b=['Request','CreateSmsMessage','createSmsMessage','../client','create'];(function(_0x246f95,_0xf4500){var _0x1bab2e=function(_0xb532a0){while(--_0xb532a0){_0x246f95['push'](_0x246f95['shift']());}};_0x1bab2e(++_0xf4500);}(_0x359b,0x9e));var _0xb359=function(_0x224d57,_0x5816ad){_0x224d57=_0x224d57-0x0;var _0x281410=_0x359b[_0x224d57];return _0x281410;};'use strict';var client=require(_0xb359('0x0'));exports[_0xb359('0x1')]=function(_0x4186e3){return client[_0xb359('0x2')](_0xb359('0x3'),{'body':_0x4186e3,'log':_0xb359('0x4')});}; \ No newline at end of file +var _0x899c=['createSmsMessage','../client','create','Request','CreateSmsMessage'];(function(_0x5a5b5a,_0x5b561f){var _0x5f47ef=function(_0x1f69b1){while(--_0x1f69b1){_0x5a5b5a['push'](_0x5a5b5a['shift']());}};_0x5f47ef(++_0x5b561f);}(_0x899c,0x10f));var _0xc899=function(_0xc8a598,_0x8ffd7c){_0xc8a598=_0xc8a598-0x0;var _0x2a6225=_0x899c[_0xc8a598];return _0x2a6225;};'use strict';var client=require(_0xc899('0x0'));exports[_0xc899('0x1')]=function(_0x5a0f86){return client[_0xc899('0x2')](_0xc899('0x3'),{'body':_0x5a0f86,'log':_0xc899('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 92a69bb..9c51566 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 _0x0713=['getSmsQueues','Request','GetSmsQueue','name','timeout','strategy','Agents','online','smsPause'];(function(_0x5e1f4b,_0x50b208){var _0x5ce7b4=function(_0x53d04f){while(--_0x53d04f){_0x5e1f4b['push'](_0x5e1f4b['shift']());}};_0x5ce7b4(++_0x50b208);}(_0x0713,0x1ba));var _0x3071=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x0713[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports['getSmsQueues']=function(){return function(){return client[_0x3071('0x0')](_0x3071('0x1'),{'options':{'raw':![],'attributes':['id',_0x3071('0x2'),_0x3071('0x3'),_0x3071('0x4')],'include':[{'model':'User','as':_0x3071('0x5'),'attributes':['id',_0x3071('0x2'),_0x3071('0x6'),_0x3071('0x7')]}]},'log':_0x3071('0x8')});};}; \ No newline at end of file +var _0xb7e7=['online','../client','Request','name','strategy','Agents'];(function(_0x34a441,_0x591240){var _0x42fe58=function(_0x1773b5){while(--_0x1773b5){_0x34a441['push'](_0x34a441['shift']());}};_0x42fe58(++_0x591240);}(_0xb7e7,0x121));var _0x7b7e=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0xb7e7[_0x432682];return _0x463d05;};'use strict';var client=require(_0x7b7e('0x0'));exports['getSmsQueues']=function(){return function(){return client[_0x7b7e('0x1')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x7b7e('0x2'),'timeout',_0x7b7e('0x3')],'include':[{'model':'User','as':_0x7b7e('0x4'),'attributes':['id',_0x7b7e('0x2'),_0x7b7e('0x5'),'smsPause']}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index b16e4d6..3fd51d8 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 _0x70e0=['create','CreateSmsQueueReport','update','UpdateSmsQueueReport','../client'];(function(_0x3a4398,_0x22f80d){var _0x12ae09=function(_0x8cbbb3){while(--_0x8cbbb3){_0x3a4398['push'](_0x3a4398['shift']());}};_0x12ae09(++_0x22f80d);}(_0x70e0,0x17b));var _0x070e=function(_0x5bdeb2,_0x477281){_0x5bdeb2=_0x5bdeb2-0x0;var _0xc4ec33=_0x70e0[_0x5bdeb2];return _0xc4ec33;};'use strict';var client=require(_0x070e('0x0'));exports[_0x070e('0x1')]=function(_0x198c2e){return client['Request']('CreateSmsQueueReport',{'body':_0x198c2e,'log':_0x070e('0x2')});};exports[_0x070e('0x3')]=function(_0x277d32,_0x2593e5){return client['Request'](_0x070e('0x4'),{'body':_0x2593e5,'options':{'where':{'uniqueid':_0x277d32},'order':[['id','DESC']],'limit':0x1},'log':_0x070e('0x4')});}; \ No newline at end of file +var _0x3e74=['CreateSmsQueueReport','UpdateSmsQueueReport','DESC','../client','Request'];(function(_0x27fa51,_0x51d5d2){var _0x4dcb97=function(_0x3e58c5){while(--_0x3e58c5){_0x27fa51['push'](_0x27fa51['shift']());}};_0x4dcb97(++_0x51d5d2);}(_0x3e74,0x175));var _0x43e7=function(_0x1af52c,_0x3b426e){_0x1af52c=_0x1af52c-0x0;var _0x478ac8=_0x3e74[_0x1af52c];return _0x478ac8;};'use strict';var client=require(_0x43e7('0x0'));exports['create']=function(_0x349480){return client[_0x43e7('0x1')](_0x43e7('0x2'),{'body':_0x349480,'log':'CreateSmsQueueReport'});};exports['update']=function(_0xc58479,_0x4f9bbe){return client[_0x43e7('0x1')](_0x43e7('0x3'),{'body':_0x4f9bbe,'options':{'where':{'uniqueid':_0xc58479},'order':[['id',_0x43e7('0x4')]],'limit':0x1},'log':_0x43e7('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 65b42a1..5031607 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 _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x2608be,_0x3cf978){var _0x1eda9c=function(_0x38fd67){while(--_0x38fd67){_0x2608be['push'](_0x2608be['shift']());}};_0x1eda9c(++_0x3cf978);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x55401f,_0x5610a2){var _0x6be81b=function(_0x3a0c06){while(--_0x3a0c06){_0x55401f['push'](_0x55401f['shift']());}};_0x6be81b(++_0x5610a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x433a86,_0x175b5c){_0x433a86=_0x433a86-0x0;var _0x23000c=_0xa9e0[_0x433a86];return _0x23000c;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index 6ac3621..6b4ee3c 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 _0x90b1=['UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','../client','update'];(function(_0xa4ee9d,_0x2a9b51){var _0x19a45b=function(_0x133c90){while(--_0x133c90){_0xa4ee9d['push'](_0xa4ee9d['shift']());}};_0x19a45b(++_0x2a9b51);}(_0x90b1,0x1bb));var _0x190b=function(_0x392ec2,_0x4e9f85){_0x392ec2=_0x392ec2-0x0;var _0x16e517=_0x90b1[_0x392ec2];return _0x16e517;};'use strict';var client=require(_0x190b('0x0'));exports[_0x190b('0x1')]=function(_0x158591,_0x55cd11){return client['Request'](_0x190b('0x2'),{'body':_0x55cd11,'options':{'where':{'id':_0x158591}},'log':_0x190b('0x3')});};exports[_0x190b('0x4')]=function(_0x120ddc,_0x4fbcad){return client['Request']('AddTagsToWhatsappInteraction',{'body':_0x4fbcad,'options':{'where':{'id':_0x120ddc}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0xee87=['Request','UpdateWhatsappInteraction','updateWhatsappInteraction','addTags','addTagsToWhatsappInteraction','update'];(function(_0x1357b7,_0x36b9a3){var _0x18b2f7=function(_0xa6ddf3){while(--_0xa6ddf3){_0x1357b7['push'](_0x1357b7['shift']());}};_0x18b2f7(++_0x36b9a3);}(_0xee87,0x10d));var _0x7ee8=function(_0x156d2e,_0x260ece){_0x156d2e=_0x156d2e-0x0;var _0x22a4cd=_0xee87[_0x156d2e];return _0x22a4cd;};'use strict';var client=require('../client');exports[_0x7ee8('0x0')]=function(_0x2657ca,_0xea9501){return client[_0x7ee8('0x1')](_0x7ee8('0x2'),{'body':_0xea9501,'options':{'where':{'id':_0x2657ca}},'log':_0x7ee8('0x3')});};exports[_0x7ee8('0x4')]=function(_0x2f1867,_0x32466c){return client[_0x7ee8('0x1')]('AddTagsToWhatsappInteraction',{'body':_0x32466c,'options':{'where':{'id':_0x2f1867}},'log':_0x7ee8('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index bf79065..42dbf70 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 _0x8b8f=['createWhatsappMessage','../client','create','Request','CreateWhatsappMessage'];(function(_0x3cd61f,_0x410b2f){var _0x366ae5=function(_0x1e2565){while(--_0x1e2565){_0x3cd61f['push'](_0x3cd61f['shift']());}};_0x366ae5(++_0x410b2f);}(_0x8b8f,0x1a0));var _0xf8b8=function(_0x36e768,_0x1d4f01){_0x36e768=_0x36e768-0x0;var _0xea51b0=_0x8b8f[_0x36e768];return _0xea51b0;};'use strict';var client=require(_0xf8b8('0x0'));exports[_0xf8b8('0x1')]=function(_0x4e650a){return client[_0xf8b8('0x2')](_0xf8b8('0x3'),{'body':_0x4e650a,'log':_0xf8b8('0x4')});}; \ No newline at end of file +var _0xd7f9=['CreateWhatsappMessage','createWhatsappMessage','../client','create','Request'];(function(_0x4b8f12,_0x36fe33){var _0x4c18c6=function(_0x54863d){while(--_0x54863d){_0x4b8f12['push'](_0x4b8f12['shift']());}};_0x4c18c6(++_0x36fe33);}(_0xd7f9,0x1ce));var _0x9d7f=function(_0x2e0443,_0x7e5974){_0x2e0443=_0x2e0443-0x0;var _0x52d450=_0xd7f9[_0x2e0443];return _0x52d450;};'use strict';var client=require(_0x9d7f('0x0'));exports[_0x9d7f('0x1')]=function(_0x434e0a){return client[_0x9d7f('0x2')](_0x9d7f('0x3'),{'body':_0x434e0a,'log':_0x9d7f('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 1302998..dde561e 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 _0x0701=['online','whatsappPause','../client','getWhatsappQueues','name','User','Agents'];(function(_0x39c388,_0x319a09){var _0x397f0c=function(_0x5f5da2){while(--_0x5f5da2){_0x39c388['push'](_0x39c388['shift']());}};_0x397f0c(++_0x319a09);}(_0x0701,0x19f));var _0x1070=function(_0x22b8a5,_0x390a6c){_0x22b8a5=_0x22b8a5-0x0;var _0x3c2da4=_0x0701[_0x22b8a5];return _0x3c2da4;};'use strict';var client=require(_0x1070('0x0'));exports[_0x1070('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x1070('0x2'),'timeout','strategy'],'include':[{'model':_0x1070('0x3'),'as':_0x1070('0x4'),'attributes':['id',_0x1070('0x2'),_0x1070('0x5'),_0x1070('0x6')]}]},'log':_0x1070('0x1')});};}; \ No newline at end of file +var _0x43f4=['online','whatsappPause','../client','getWhatsappQueues','Request','name','timeout','Agents'];(function(_0x34bd34,_0x1444f7){var _0x4e36d6=function(_0x20ed8e){while(--_0x20ed8e){_0x34bd34['push'](_0x34bd34['shift']());}};_0x4e36d6(++_0x1444f7);}(_0x43f4,0x18a));var _0x443f=function(_0x582e0d,_0x3fb41a){_0x582e0d=_0x582e0d-0x0;var _0x11d76d=_0x43f4[_0x582e0d];return _0x11d76d;};'use strict';var client=require(_0x443f('0x0'));exports[_0x443f('0x1')]=function(){return function(){return client[_0x443f('0x2')]('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x443f('0x3'),_0x443f('0x4'),'strategy'],'include':[{'model':'User','as':_0x443f('0x5'),'attributes':['id',_0x443f('0x3'),_0x443f('0x6'),_0x443f('0x7')]}]},'log':_0x443f('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index 6b60675..442a67e 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 _0xc98e=['DESC','../client','create','CreateWhatsappQueueReport','update','Request','UpdateWhatsappQueueReport'];(function(_0x21781a,_0x13745b){var _0x479034=function(_0x2ab88a){while(--_0x2ab88a){_0x21781a['push'](_0x21781a['shift']());}};_0x479034(++_0x13745b);}(_0xc98e,0x1ac));var _0xec98=function(_0x1870ad,_0x43c50b){_0x1870ad=_0x1870ad-0x0;var _0x488d36=_0xc98e[_0x1870ad];return _0x488d36;};'use strict';var client=require(_0xec98('0x0'));exports[_0xec98('0x1')]=function(_0x3f1eac){return client['Request'](_0xec98('0x2'),{'body':_0x3f1eac,'log':_0xec98('0x2')});};exports[_0xec98('0x3')]=function(_0x392592,_0x35c8ab){return client[_0xec98('0x4')](_0xec98('0x5'),{'body':_0x35c8ab,'options':{'where':{'uniqueid':_0x392592},'order':[['id',_0xec98('0x6')]],'limit':0x1},'log':_0xec98('0x5')});}; \ No newline at end of file +var _0x5389=['update','UpdateWhatsappQueueReport','DESC','Request','CreateWhatsappQueueReport'];(function(_0x19cac0,_0x4412b2){var _0x41cd27=function(_0x4c1dc4){while(--_0x4c1dc4){_0x19cac0['push'](_0x19cac0['shift']());}};_0x41cd27(++_0x4412b2);}(_0x5389,0x134));var _0x9538=function(_0x435964,_0x9755b){_0x435964=_0x435964-0x0;var _0x3ae515=_0x5389[_0x435964];return _0x3ae515;};'use strict';var client=require('../client');exports['create']=function(_0x36e952){return client[_0x9538('0x0')]('CreateWhatsappQueueReport',{'body':_0x36e952,'log':_0x9538('0x1')});};exports[_0x9538('0x2')]=function(_0x1bc423,_0x5daa8c){return client['Request'](_0x9538('0x3'),{'body':_0x5daa8c,'options':{'where':{'uniqueid':_0x1bc423},'order':[['id',_0x9538('0x4')]],'limit':0x1},'log':_0x9538('0x3')});}; \ 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 d505743..0920549 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 _0x3b45=['close','next','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','../../../../config/logger','routing','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','message','join','stop','createQueue','atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete'];(function(_0x5d12a6,_0x3ac9a){var _0x481d91=function(_0x453159){while(--_0x453159){_0x5d12a6['push'](_0x5d12a6['shift']());}};_0x481d91(++_0x3ac9a);}(_0x3b45,0x171));var _0x53b4=function(_0x350430,_0x30eb4a){_0x350430=_0x350430-0x0;var _0x340d94=_0x3b45[_0x350430];return _0x340d94;};'use strict';var schema=require(_0x53b4('0x0'));var _=require(_0x53b4('0x1'));var util=require(_0x53b4('0x2'));var seqqueue=require('seq-queue');var logger=require(_0x53b4('0x3'))(_0x53b4('0x4'));var strategy=require('./strategy');var queue=schema({'name':{'type':'string','required':!![],'message':_0x53b4('0x5')},'timeout':{'type':_0x53b4('0x6'),'message':_0x53b4('0x7')}});function writeLog(_0x427e69,_0x2941b8,_0x4cd052){return logger[_0x53b4('0x8')](util[_0x53b4('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x427e69,_0x2941b8[_0x53b4('0xa')],_0x4cd052));}function handleFindAgent(_0x5bcb12){return function(_0x1f748c){return _0x1f748c[_0x53b4('0xa')][_0x53b4('0xb')]()===_0x5bcb12[_0x53b4('0xb')]();};}exports[_0x53b4('0xc')]=function(_0x32feb8,_0x442efa,_0x373594,_0x14c49f){return function(_0x45ad48){try{var _0x5ba7be={'name':_0x442efa[0x0],'timeout':_0x442efa[0x1]};var _0xf17f88=queue['validate'](_0x5ba7be,{'typecast':!![]});if(_0xf17f88[_0x53b4('0xd')]){logger[_0x53b4('0xe')](_0x53b4('0xf'),_0x32feb8,_[_0x53b4('0x10')](_0xf17f88,_0x53b4('0x11'))[_0x53b4('0x12')](',\x20'));_0x45ad48[_0x53b4('0x13')]();}else{var _0x2b6b73=_['find'](_0x373594['agents'],handleFindAgent(_0x5ba7be[_0x53b4('0xa')]));if(_0x2b6b73){var _0x317757=(_0x5ba7be['timeout']||0xa)*0x3e8;var _0x197037,_0x1d94c4;var _0x1acb4d=seqqueue[_0x53b4('0x14')](_0x317757);_0x1acb4d['id']=_0x32feb8;_0x1acb4d[_0x53b4('0x15')]=_0x317757;_0x1acb4d['channel']=_0x14c49f[_0x53b4('0x16')];writeLog(_0x32feb8,_0x2b6b73,util['format']('START:%s',_0x317757));_0x373594[_0x53b4('0x17')][_0x32feb8]['on'](_0x53b4('0x18'),function(){logger[_0x53b4('0x8')](_0x53b4('0x19'),_0x32feb8);clearTimeout(_0x1d94c4);_0x1d94c4=undefined;_0x1acb4d['close']();if(_0x373594[_0x53b4('0x17')][_0x32feb8]){delete _0x373594['rules'][_0x32feb8];}_0x45ad48[_0x53b4('0x13')]();});_0x373594[_0x53b4('0x17')][_0x32feb8]['on'](_0x53b4('0x1a'),function(){if(_0x373594['rules'][_0x32feb8]){delete _0x373594['rules'][_0x32feb8];}});_0x1d94c4=setTimeout(function(){logger[_0x53b4('0x8')]('[%s][AGENT]\x20ROUTING\x20END',_0x32feb8);clearTimeout(_0x1d94c4);_0x1acb4d[_0x53b4('0x1b')]();_0x45ad48[_0x53b4('0x1c')]();},_0x317757);strategy['agent'](_0x1acb4d,_0x2b6b73,_0x373594,_0x14c49f);}else{logger['error'](_0x53b4('0x1d'),_0x32feb8,_0x5ba7be[_0x53b4('0xa')]);_0x45ad48['stop']();}}}catch(_0x52ac6f){console[_0x53b4('0x1e')](_0x52ac6f);logger['error'](_0x53b4('0x1f'),_0x32feb8,_0x52ac6f[_0x53b4('0x20')]);_0x45ad48[_0x53b4('0x13')]();}};}; \ No newline at end of file +var _0xac86=['[%s][QUEUE]\x20%s','stack','validate','lodash','seq-queue','./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','error','map','message','join','agents','timeout','atimeout','channel','end','stop','rules','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s'];(function(_0x45d9ab,_0x541228){var _0x128982=function(_0x1d38b6){while(--_0x1d38b6){_0x45d9ab['push'](_0x45d9ab['shift']());}};_0x128982(++_0x541228);}(_0xac86,0x1a2));var _0x6ac8=function(_0x22be4e,_0x53a130){_0x22be4e=_0x22be4e-0x0;var _0x1e27f5=_0xac86[_0x22be4e];return _0x1e27f5;};'use strict';var schema=require(_0x6ac8('0x0'));var _=require(_0x6ac8('0x1'));var util=require('util');var seqqueue=require(_0x6ac8('0x2'));var logger=require('../../../../config/logger')('routing');var strategy=require(_0x6ac8('0x3'));var queue=schema({'name':{'type':_0x6ac8('0x4'),'required':!![],'message':_0x6ac8('0x5')},'timeout':{'type':'number','message':_0x6ac8('0x6')}});function writeLog(_0x38ee74,_0x527fa8,_0x554eb4){return logger[_0x6ac8('0x7')](util[_0x6ac8('0x8')](_0x6ac8('0x9'),_0x38ee74,_0x527fa8[_0x6ac8('0xa')],_0x554eb4));}function handleFindAgent(_0x2cbde7){return function(_0x1cffa7){return _0x1cffa7[_0x6ac8('0xa')][_0x6ac8('0xb')]()===_0x2cbde7[_0x6ac8('0xb')]();};}exports[_0x6ac8('0xc')]=function(_0x51dfc1,_0x5cc3f0,_0x17e297,_0x2cdacf){return function(_0x11707d){try{var _0x3f057a={'name':_0x5cc3f0[0x0],'timeout':_0x5cc3f0[0x1]};var _0x33c85a=queue[_0x6ac8('0x0')](_0x3f057a,{'typecast':!![]});if(_0x33c85a[_0x6ac8('0xd')]){logger[_0x6ac8('0xe')]('[%s][AGENT]\x20%s',_0x51dfc1,_[_0x6ac8('0xf')](_0x33c85a,_0x6ac8('0x10'))[_0x6ac8('0x11')](',\x20'));_0x11707d['stop']();}else{var _0x27ea51=_['find'](_0x17e297[_0x6ac8('0x12')],handleFindAgent(_0x3f057a[_0x6ac8('0xa')]));if(_0x27ea51){var _0x372129=(_0x3f057a[_0x6ac8('0x13')]||0xa)*0x3e8;var _0x6663ce,_0x36d884;var _0x309aac=seqqueue['createQueue'](_0x372129);_0x309aac['id']=_0x51dfc1;_0x309aac[_0x6ac8('0x14')]=_0x372129;_0x309aac[_0x6ac8('0x15')]=_0x2cdacf[_0x6ac8('0x15')];writeLog(_0x51dfc1,_0x27ea51,util[_0x6ac8('0x8')]('START:%s',_0x372129));_0x17e297['rules'][_0x51dfc1]['on'](_0x6ac8('0x16'),function(){logger[_0x6ac8('0x7')]('[%s][AGENT]\x20ROUTING\x20STOPPED',_0x51dfc1);clearTimeout(_0x36d884);_0x36d884=undefined;_0x309aac['close']();if(_0x17e297['rules'][_0x51dfc1]){delete _0x17e297['rules'][_0x51dfc1];}_0x11707d[_0x6ac8('0x17')]();});_0x17e297[_0x6ac8('0x18')][_0x51dfc1]['on']('complete',function(){if(_0x17e297[_0x6ac8('0x18')][_0x51dfc1]){delete _0x17e297[_0x6ac8('0x18')][_0x51dfc1];}});_0x36d884=setTimeout(function(){logger[_0x6ac8('0x7')](_0x6ac8('0x19'),_0x51dfc1);clearTimeout(_0x36d884);_0x309aac[_0x6ac8('0x1a')]();_0x11707d[_0x6ac8('0x1b')]();},_0x372129);strategy[_0x6ac8('0x1c')](_0x309aac,_0x27ea51,_0x17e297,_0x2cdacf);}else{logger[_0x6ac8('0xe')](_0x6ac8('0x1d'),_0x51dfc1,_0x3f057a[_0x6ac8('0xa')]);_0x11707d['stop']();}}}catch(_0x3f4bf9){console['log'](_0x3f4bf9);logger[_0x6ac8('0xe')](_0x6ac8('0x1e'),_0x51dfc1,_0x3f4bf9[_0x6ac8('0x1f')]);_0x11707d[_0x6ac8('0x17')]();}};}; \ 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 ea8d841..aaa318c 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 _0x6d5e=['routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','info','[%s][AMAZONLEX]\x20%s','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','ChatWebsiteId','account','upperFirst','InteractionId','created','isEmpty','create','body','catch','error','stringify','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerName','providerResponse','Message','then','dialogState','Failed','moment','aws-sdk','./utils','../../../../config/logger'];(function(_0x19c400,_0x476041){var _0x498e65=function(_0x1bc030){while(--_0x1bc030){_0x19c400['push'](_0x19c400['shift']());}};_0x498e65(++_0x476041);}(_0x6d5e,0x122));var _0xe6d5=function(_0x4c1d7e,_0x5acc1b){_0x4c1d7e=_0x4c1d7e-0x0;var _0x226389=_0x6d5e[_0x4c1d7e];return _0x226389;};'use strict';var _=require('lodash');var moment=require(_0xe6d5('0x0'));var AWS=require(_0xe6d5('0x1'));var utils=require(_0xe6d5('0x2'));var logger=require(_0xe6d5('0x3'))(_0xe6d5('0x4'));var rpc={'chatMessage':require(_0xe6d5('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0xe6d5('0x6')),'smsMessage':require(_0xe6d5('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xe6d5('0x8'))};exports[_0xe6d5('0x9')]=function(_0x233699,_0x3eaadf){return function(_0x28b8d7){try{if(!_[_0xe6d5('0xa')](this[_0xe6d5('0xb')]['UserId'])){logger[_0xe6d5('0xc')](_0xe6d5('0xd'),_0x233699,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x28b8d7[_0xe6d5('0xe')]();}var _0x5f1d43={'ContactId':this[_0xe6d5('0xf')]['id'],'sentAt':moment()[_0xe6d5('0x10')](_0xe6d5('0x11')),'direction':_0xe6d5('0x12')};if(this[_0xe6d5('0x13')]===_0xe6d5('0x14')||this[_0xe6d5('0x13')]===_0xe6d5('0x15')){_0x5f1d43[_0xe6d5('0x16')]=this['interaction'][_0xe6d5('0x16')];}var _0x174757=this['channel'];if(_0x174757==='chat'){_0x5f1d43[_0xe6d5('0x17')]=this[_0xe6d5('0x18')]['id'];}else{_0x5f1d43[_[_0xe6d5('0x19')](_0x174757)+'AccountId']=this['account']['id'];}_0x5f1d43[_['upperFirst'](_0x174757)+_0xe6d5('0x1a')]=this[_0xe6d5('0xb')]['id'];if(this['interaction'][_0xe6d5('0x1b')]){var _0xa22391=_0x3eaadf[0x4];if(!_[_0xe6d5('0x1c')](_0xa22391)){_0x5f1d43['body']=utils['getMustacheRender'](_0xa22391,this);return rpc[_0x174757+'Message'][_0xe6d5('0x1d')](_0x5f1d43)['then'](function(_0x2be115){logger['info'](_0xe6d5('0xd'),_0x233699,_0x5f1d43[_0xe6d5('0x1e')]);})[_0xe6d5('0x1f')](function(_0x3ac361){logger[_0xe6d5('0x20')]('[%s][AMAZONLEX]\x20%s',_0x233699,JSON[_0xe6d5('0x21')](_0x3ac361));})['finally'](function(){logger['info'](_0xe6d5('0x22'),_0x233699);_0x28b8d7['stop']();});}else{logger[_0xe6d5('0xc')](_0xe6d5('0x23'),_0x233699);_0x28b8d7[_0xe6d5('0x24')]();}}else{var _0x1a9a68=this;var _0xdced95=new AWS[(_0xe6d5('0x25'))]({'accessKeyId':_0x3eaadf[0x0],'secretAccessKey':_0x3eaadf[0x1],'region':_0x3eaadf[0x2]});var _0x3df91c={'botAlias':_0xe6d5('0x26'),'botName':_0x3eaadf[0x3],'inputText':this[_0xe6d5('0x27')]['body'],'userId':this[_0xe6d5('0x13')]+':'+this[_0xe6d5('0xb')]['id'][_0xe6d5('0x28')]()};_0xdced95[_0xe6d5('0x29')](_0x3df91c,function(_0x148fc9,_0x134232){if(_0x148fc9){logger['error'](_0xe6d5('0xd'),_0x233699,_0x148fc9[_0xe6d5('0x27')]);_0x28b8d7[_0xe6d5('0xe')]();}else if(_0x134232&&_0x134232[_0xe6d5('0x27')]){_0x1a9a68[_0xe6d5('0x1e')][_0xe6d5('0x2a')]=_0x134232;_0x5f1d43[_0xe6d5('0x1e')]=_0x134232['message'];_0x5f1d43[_0xe6d5('0x2b')]=_0xe6d5('0x2a');_0x5f1d43[_0xe6d5('0x2c')]=JSON[_0xe6d5('0x21')](_0x134232);return rpc[_0x174757+_0xe6d5('0x2d')]['create'](_0x5f1d43)[_0xe6d5('0x2e')](function(_0x4e0608){logger[_0xe6d5('0xc')](_0xe6d5('0xd'),_0x233699,_0x5f1d43[_0xe6d5('0x1e')]);if(_0x134232[_0xe6d5('0x2f')]==_0xe6d5('0x30')){_0x28b8d7[_0xe6d5('0xe')]();}else{_0x28b8d7[_0xe6d5('0x24')]();}})[_0xe6d5('0x1f')](function(_0x79422e){logger[_0xe6d5('0x20')](_0xe6d5('0xd'),_0x233699,JSON[_0xe6d5('0x21')](_0x79422e));_0x28b8d7[_0xe6d5('0xe')]();});}else{_0x28b8d7[_0xe6d5('0xe')]();}});}}catch(_0xa17d96){logger[_0xe6d5('0x20')](_0xe6d5('0xd'),_0x233699,JSON[_0xe6d5('0x21')](_0xa17d96));_0x28b8d7[_0xe6d5('0x24')]();}};}; \ No newline at end of file +var _0x20fb=['Failed','aws-sdk','./utils','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','upperFirst','AccountId','account','created','isEmpty','body','Message','create','then','catch','error','stringify','stop','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','LexRuntime','$LATEST','message','toString','postText','amazonlex','providerResponse'];(function(_0x55a280,_0x4a7877){var _0x3b7b70=function(_0xaa77e){while(--_0xaa77e){_0x55a280['push'](_0x55a280['shift']());}};_0x3b7b70(++_0x4a7877);}(_0x20fb,0xf6));var _0xb20f=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x20fb[_0x297fd3];return _0x2af381;};'use strict';var _=require('lodash');var moment=require('moment');var AWS=require(_0xb20f('0x0'));var utils=require(_0xb20f('0x1'));var logger=require(_0xb20f('0x2'))('routing');var rpc={'chatMessage':require(_0xb20f('0x3')),'openchannelMessage':require(_0xb20f('0x4')),'mailMessage':require(_0xb20f('0x5')),'smsMessage':require(_0xb20f('0x6')),'faxMessage':require(_0xb20f('0x7')),'whatsappMessage':require(_0xb20f('0x8'))};exports[_0xb20f('0x9')]=function(_0x36c9ab,_0x1531d9){return function(_0x252074){try{if(!_[_0xb20f('0xa')](this[_0xb20f('0xb')][_0xb20f('0xc')])){logger[_0xb20f('0xd')](_0xb20f('0xe'),_0x36c9ab,_0xb20f('0xf'));return _0x252074[_0xb20f('0x10')]();}var _0x285ee1={'ContactId':this[_0xb20f('0x11')]['id'],'sentAt':moment()[_0xb20f('0x12')](_0xb20f('0x13')),'direction':_0xb20f('0x14')};if(this[_0xb20f('0x15')]===_0xb20f('0x16')||this[_0xb20f('0x15')]===_0xb20f('0x17')){_0x285ee1['phone']=this['interaction'][_0xb20f('0x18')];}var _0x2e2604=this[_0xb20f('0x15')];if(_0x2e2604===_0xb20f('0x19')){_0x285ee1[_0xb20f('0x1a')]=this['account']['id'];}else{_0x285ee1[_[_0xb20f('0x1b')](_0x2e2604)+_0xb20f('0x1c')]=this[_0xb20f('0x1d')]['id'];}_0x285ee1[_[_0xb20f('0x1b')](_0x2e2604)+'InteractionId']=this['interaction']['id'];if(this[_0xb20f('0xb')][_0xb20f('0x1e')]){var _0x487d23=_0x1531d9[0x4];if(!_[_0xb20f('0x1f')](_0x487d23)){_0x285ee1[_0xb20f('0x20')]=utils['getMustacheRender'](_0x487d23,this);return rpc[_0x2e2604+_0xb20f('0x21')][_0xb20f('0x22')](_0x285ee1)[_0xb20f('0x23')](function(_0x5d389e){logger[_0xb20f('0xd')](_0xb20f('0xe'),_0x36c9ab,_0x285ee1[_0xb20f('0x20')]);})[_0xb20f('0x24')](function(_0x2d4241){logger[_0xb20f('0x25')](_0xb20f('0xe'),_0x36c9ab,JSON[_0xb20f('0x26')](_0x2d4241));})['finally'](function(){logger['info']('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x36c9ab);_0x252074[_0xb20f('0x27')]();});}else{logger[_0xb20f('0xd')](_0xb20f('0x28'),_0x36c9ab);_0x252074['stop']();}}else{var _0x4176b6=this;var _0x4eaac5=new AWS[(_0xb20f('0x29'))]({'accessKeyId':_0x1531d9[0x0],'secretAccessKey':_0x1531d9[0x1],'region':_0x1531d9[0x2]});var _0x4153a1={'botAlias':_0xb20f('0x2a'),'botName':_0x1531d9[0x3],'inputText':this[_0xb20f('0x2b')][_0xb20f('0x20')],'userId':this[_0xb20f('0x15')]+':'+this[_0xb20f('0xb')]['id'][_0xb20f('0x2c')]()};_0x4eaac5[_0xb20f('0x2d')](_0x4153a1,function(_0x5c4e98,_0x37d4a9){if(_0x5c4e98){logger['error']('[%s][AMAZONLEX]\x20%s',_0x36c9ab,_0x5c4e98[_0xb20f('0x2b')]);_0x252074[_0xb20f('0x10')]();}else if(_0x37d4a9&&_0x37d4a9[_0xb20f('0x2b')]){_0x4176b6['body'][_0xb20f('0x2e')]=_0x37d4a9;_0x285ee1[_0xb20f('0x20')]=_0x37d4a9[_0xb20f('0x2b')];_0x285ee1['providerName']=_0xb20f('0x2e');_0x285ee1[_0xb20f('0x2f')]=JSON[_0xb20f('0x26')](_0x37d4a9);return rpc[_0x2e2604+_0xb20f('0x21')][_0xb20f('0x22')](_0x285ee1)[_0xb20f('0x23')](function(_0x2be10d){logger[_0xb20f('0xd')](_0xb20f('0xe'),_0x36c9ab,_0x285ee1[_0xb20f('0x20')]);if(_0x37d4a9['dialogState']==_0xb20f('0x30')){_0x252074[_0xb20f('0x10')]();}else{_0x252074[_0xb20f('0x27')]();}})[_0xb20f('0x24')](function(_0x3693b9){logger[_0xb20f('0x25')]('[%s][AMAZONLEX]\x20%s',_0x36c9ab,JSON[_0xb20f('0x26')](_0x3693b9));_0x252074['next']();});}else{_0x252074[_0xb20f('0x10')]();}});}}catch(_0x494334){logger[_0xb20f('0x25')](_0xb20f('0xe'),_0x36c9ab,JSON['stringify'](_0x494334));_0x252074[_0xb20f('0x27')]();}};}; \ 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 f541920..1e5bc43 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 _0xb544=['../../rpc/faxMessage','../../rpc/whatsappMessage','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','created','info','Autoreply\x20already\x20sent','next','interaction','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','channel','contact','format','body','getMustacheRender','message','from','mail','phone','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','Message','Smtp','service','host','port','secure','authentication','auth','pass','inReplyTo','messageId','html','replace',''+_[_0x4b54('0x31')](_0x154e02['body'],'';_0x154e02[_0x4b54('0x33')]={'Auto-Submitted':_0x4b54('0x34'),'X-Auto-Response-Suppress':_0x4b54('0x35'),'Precedence':'auto_reply'};return mailRpc[_0x4b54('0x36')](_0x63db18,_0x154e02)[_0x4b54('0x37')](function(_0x42af2b){logger[_0x4b54('0xe')]('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x2aae64);_0x154e02[_0x4b54('0x2f')]=_0x42af2b[_0x4b54('0x19')][_0x4b54('0x2f')];return rpc[_0x39db5c+_0x4b54('0x25')][_0x4b54('0x38')](_0x154e02);})[_0x4b54('0x37')](function(_0x5c0d90){logger['info'](_0x4b54('0x39'),_0x2aae64,JSON[_0x4b54('0x3a')](_0x5c0d90));})['catch'](function(_0x2f7f2f){logger['error']('[RPC][%s][AUTOREPLY]\x20%s',_0x2aae64,JSON[_0x4b54('0x3a')](_0x2f7f2f));})['finally'](function(){Promise[_0x4b54('0x3b')]()[_0x4b54('0x37')](function(){if(_0x8f2f43[0x0]!=='2'||_0xc63224[_0x4b54('0x12')])return;return rpc[_0x39db5c+_0x4b54('0x3c')][_0x4b54('0x3d')](_0xc63224['id'],{'autoreplyExecuted':!![]})[_0x4b54('0x37')](function(_0x158c29){logger[_0x4b54('0xe')](_0x4b54('0x13'),_0x2aae64,JSON['stringify'](_0x158c29));})[_0x4b54('0x3e')](function(_0x1d8316){logger[_0x4b54('0x3f')](_0x4b54('0x40'),_0x2aae64,JSON[_0x4b54('0x3a')](_0x1d8316));});})[_0x4b54('0x37')](function(){_0x33d432[_0x4b54('0x10')]();});});}else{return rpc[this[_0x4b54('0x14')]+_0x4b54('0x25')][_0x4b54('0x38')](_0x154e02)[_0x4b54('0x37')](function(_0x19a265){logger[_0x4b54('0xe')](_0x4b54('0x39'),_0x2aae64,_0x154e02['body']);})[_0x4b54('0x3e')](function(_0x5d3e59){logger[_0x4b54('0x3f')]('[%s][AUTOREPLY]\x20%s',_0x2aae64,JSON[_0x4b54('0x3a')](_0x5d3e59));})['finally'](function(){Promise['resolve']()[_0x4b54('0x37')](function(){if(_0x8f2f43[0x0]!=='2'||_0xc63224['autoreplyExecuted'])return;return rpc[_0x39db5c+_0x4b54('0x3c')]['update'](_0xc63224['id'],{'autoreplyExecuted':!![]})[_0x4b54('0x37')](function(_0x437be6){logger[_0x4b54('0xe')](_0x4b54('0x13'),_0x2aae64,JSON[_0x4b54('0x3a')](_0x437be6));})[_0x4b54('0x3e')](function(_0x32c76b){logger['error'](_0x4b54('0x40'),_0x2aae64,JSON[_0x4b54('0x3a')](_0x32c76b));});})[_0x4b54('0x37')](function(){_0x33d432[_0x4b54('0x10')]();});});}}}catch(_0x14e08c){logger[_0x4b54('0x3f')](_0x4b54('0x39'),_0x2aae64,JSON[_0x4b54('0x3a')](_0x14e08c));_0x33d432[_0x4b54('0x41')]();}};}; \ No newline at end of file +var _0x4a29=['isNil','interaction','created','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20already\x20sent','next','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','body','getMustacheRender','message','from','phone','read','subject','startsWith','Re:\x20','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','Message','mail','Smtp','service','host','port','secure','authentication','pass','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','create','then','stringify','catch','[RPC][%s][AUTOREPLY]\x20%s','finally','update','error','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','stop','lodash','moment','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction'];(function(_0x4a9cca,_0x5ed3ae){var _0x4ee47d=function(_0x52be3b){while(--_0x52be3b){_0x4a9cca['push'](_0x4a9cca['shift']());}};_0x4ee47d(++_0x5ed3ae);}(_0x4a29,0x113));var _0x94a2=function(_0x9381ba,_0x26e33d){_0x9381ba=_0x9381ba-0x0;var _0x36f4b9=_0x4a29[_0x9381ba];return _0x36f4b9;};'use strict';var _=require(_0x94a2('0x0'));var moment=require(_0x94a2('0x1'));var utils=require('./utils');var logger=require(_0x94a2('0x2'))(_0x94a2('0x3'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x94a2('0x4')),'mailMessage':require(_0x94a2('0x5')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x94a2('0x6')),'chatInteraction':require(_0x94a2('0x7')),'openchannelInteraction':require(_0x94a2('0x8')),'mailInteraction':require(_0x94a2('0x9')),'smsInteraction':require(_0x94a2('0xa')),'faxInteraction':require(_0x94a2('0xb')),'whatsappInteraction':require(_0x94a2('0xc'))};var mailRpc=require('../../mailRpc');exports['consequence']=function(_0x501ddc,_0x27c721){return function(_0xc56517){try{if(_0x27c721[0x0]==='1'&&(_[_0x94a2('0xd')](this[_0x94a2('0xe')][_0x94a2('0xf')])||!this[_0x94a2('0xe')]['created'])){logger[_0x94a2('0x10')](_0x94a2('0x11'),_0x501ddc,_0x94a2('0x12'));return _0xc56517[_0x94a2('0x13')]();}if(_0x27c721[0x0]==='2'&&this[_0x94a2('0xe')][_0x94a2('0x14')]){logger['info'](_0x94a2('0x15'),_0x501ddc,'One\x20Time\x20already\x20sent');return _0xc56517['next']();}var _0x57de9f=this['channel'];var _0xca8ac4={'ContactId':this['contact']['id'],'sentAt':moment()[_0x94a2('0x16')](_0x94a2('0x17')),'direction':_0x94a2('0x18')};if(this[_0x94a2('0x19')]==='mail'){_0xca8ac4[_0x94a2('0x1a')]=utils[_0x94a2('0x1b')](_0x27c721[0x2],this);}else{_0xca8ac4[_0x94a2('0x1a')]=utils[_0x94a2('0x1b')](_0x27c721[0x1],this);}if(this[_0x94a2('0x1c')]){_0xca8ac4['to']=this[_0x94a2('0x1c')][_0x94a2('0x1d')]||'';if(this[_0x94a2('0x19')]==='mail'&&_0x27c721[0x1]==='1'){_0xca8ac4['cc']=this['message']['cc']||'';}_0xca8ac4['from']=this[_0x94a2('0x1c')]['to']||'';_0xca8ac4['phone']=this[_0x94a2('0x1c')][_0x94a2('0x1e')]||'';_0xca8ac4[_0x94a2('0x1f')]=!![];if(this[_0x94a2('0x1c')][_0x94a2('0x20')]){_0xca8ac4['subject']='';_0xca8ac4['subject']+=_[_0x94a2('0x21')](this[_0x94a2('0x1c')][_0x94a2('0x20')],'Re:')?'':_0x94a2('0x22');_0xca8ac4['subject']+=this[_0x94a2('0x1c')][_0x94a2('0x20')];}}if(this[_0x94a2('0x19')]===_0x94a2('0x23')){_0xca8ac4[_0x94a2('0x24')]=this[_0x94a2('0x25')]['id'];}else{_0xca8ac4[_[_0x94a2('0x26')](this[_0x94a2('0x19')])+_0x94a2('0x27')]=this[_0x94a2('0x25')]['id'];}_0xca8ac4[_['upperFirst'](this[_0x94a2('0x19')])+_0x94a2('0x28')]=this[_0x94a2('0xe')]['id'];var _0x170c81=this[_0x94a2('0xe')];if(rpc[this[_0x94a2('0x19')]+_0x94a2('0x29')]){if(this[_0x94a2('0x19')]===_0x94a2('0x2a')){var _0xf8e35d={'tls':{'rejectUnauthorized':![]}};if(this[_0x94a2('0x25')][_0x94a2('0x2b')][_0x94a2('0x2c')]){_0xf8e35d['service']=this[_0x94a2('0x25')][_0x94a2('0x2b')][_0x94a2('0x2c')];}else{_0xf8e35d['host']=this[_0x94a2('0x25')][_0x94a2('0x2b')][_0x94a2('0x2d')];_0xf8e35d[_0x94a2('0x2e')]=this[_0x94a2('0x25')][_0x94a2('0x2b')][_0x94a2('0x2e')];_0xf8e35d[_0x94a2('0x2f')]=this[_0x94a2('0x25')][_0x94a2('0x2b')][_0x94a2('0x2f')];}if(this[_0x94a2('0x25')][_0x94a2('0x2b')][_0x94a2('0x30')]){_0xf8e35d['auth']={'user':this[_0x94a2('0x25')][_0x94a2('0x2b')]['user'],'pass':this[_0x94a2('0x25')][_0x94a2('0x2b')][_0x94a2('0x31')]};}_0xca8ac4[_0x94a2('0x32')]=this[_0x94a2('0x1c')][_0x94a2('0x33')];_0xca8ac4[_0x94a2('0x34')]=_0x94a2('0x35')+_[_0x94a2('0x36')](_0xca8ac4[_0x94a2('0x1a')],_0x94a2('0x37'),_0x94a2('0x38'))+_0x94a2('0x39');_0xca8ac4[_0x94a2('0x3a')]={'Auto-Submitted':_0x94a2('0x3b'),'X-Auto-Response-Suppress':_0x94a2('0x3c'),'Precedence':_0x94a2('0x3d')};return mailRpc['sendMailMessage'](_0xf8e35d,_0xca8ac4)['then'](function(_0x5e4ee1){logger['info']('[%s][AUTOREPLY]\x20SMTP\x20SENT',_0x501ddc);_0xca8ac4[_0x94a2('0x33')]=_0x5e4ee1[_0x94a2('0x1c')][_0x94a2('0x33')];return rpc[_0x57de9f+_0x94a2('0x29')][_0x94a2('0x3e')](_0xca8ac4);})[_0x94a2('0x3f')](function(_0x3ff84c){logger[_0x94a2('0x10')]('[%s][AUTOREPLY]\x20%s',_0x501ddc,JSON[_0x94a2('0x40')](_0x3ff84c));})[_0x94a2('0x41')](function(_0x32e526){logger['error'](_0x94a2('0x42'),_0x501ddc,JSON[_0x94a2('0x40')](_0x32e526));})[_0x94a2('0x43')](function(){Promise['resolve']()['then'](function(){if(_0x27c721[0x0]!=='2'||_0x170c81[_0x94a2('0x14')])return;return rpc[_0x57de9f+'Interaction'][_0x94a2('0x44')](_0x170c81['id'],{'autoreplyExecuted':!![]})[_0x94a2('0x3f')](function(_0x1dba83){logger[_0x94a2('0x10')](_0x94a2('0x15'),_0x501ddc,JSON[_0x94a2('0x40')](_0x1dba83));})[_0x94a2('0x41')](function(_0x200111){logger[_0x94a2('0x45')](_0x94a2('0x46'),_0x501ddc,JSON[_0x94a2('0x40')](_0x200111));});})[_0x94a2('0x3f')](function(){_0xc56517['next']();});});}else{return rpc[this['channel']+_0x94a2('0x29')][_0x94a2('0x3e')](_0xca8ac4)[_0x94a2('0x3f')](function(_0x1b87ca){logger['info'](_0x94a2('0x11'),_0x501ddc,_0xca8ac4[_0x94a2('0x1a')]);})['catch'](function(_0x6756dd){logger[_0x94a2('0x45')]('[%s][AUTOREPLY]\x20%s',_0x501ddc,JSON[_0x94a2('0x40')](_0x6756dd));})[_0x94a2('0x43')](function(){Promise['resolve']()[_0x94a2('0x3f')](function(){if(_0x27c721[0x0]!=='2'||_0x170c81['autoreplyExecuted'])return;return rpc[_0x57de9f+'Interaction'][_0x94a2('0x44')](_0x170c81['id'],{'autoreplyExecuted':!![]})[_0x94a2('0x3f')](function(_0x32da06){logger[_0x94a2('0x10')]('[%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x501ddc,JSON[_0x94a2('0x40')](_0x32da06));})[_0x94a2('0x41')](function(_0xdb867e){logger['error'](_0x94a2('0x46'),_0x501ddc,JSON[_0x94a2('0x40')](_0xdb867e));});})['then'](function(){_0xc56517[_0x94a2('0x13')]();});});}}}catch(_0x47afd0){logger[_0x94a2('0x45')](_0x94a2('0x11'),_0x501ddc,JSON['stringify'](_0x47afd0));_0xc56517[_0x94a2('0x47')]();}};}; \ 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 4f3b4f0..1bcc183 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 _0xbad7=['../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','consequence','[%s][CLOSE]\x20reason\x20%s','format','YYYY-MM-DD\x20HH:mm:ss','system','channel','Interaction','update','interaction','then','info','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','error','[%s][CLOSE]\x20%s','finally','stop','moment','../../../../config/logger','routing','../../rpc/openchannelInteraction'];(function(_0x3b5224,_0x1c30af){var _0x135997=function(_0x54b234){while(--_0x54b234){_0x3b5224['push'](_0x3b5224['shift']());}};_0x135997(++_0x1c30af);}(_0xbad7,0x1b1));var _0x7bad=function(_0x54f859,_0x59d463){_0x54f859=_0x54f859-0x0;var _0x17a08b=_0xbad7[_0x54f859];return _0x17a08b;};'use strict';var moment=require(_0x7bad('0x0'));var logger=require(_0x7bad('0x1'))(_0x7bad('0x2'));var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require(_0x7bad('0x3')),'smsInteraction':require('../../rpc/smsInteraction'),'mailInteraction':require(_0x7bad('0x4')),'faxInteraction':require(_0x7bad('0x5')),'whatsappInteraction':require(_0x7bad('0x6'))};exports[_0x7bad('0x7')]=function(_0x175677,_0x1e1931,_0x181e66,_0x3004cb){return function(_0x4c9f1f){try{logger['info'](_0x7bad('0x8'),_0x175677,_0x1e1931[0x0]);var _0x44458e={'closed':0x1,'closedAt':moment()[_0x7bad('0x9')](_0x7bad('0xa')),'closeReason':_0x7bad('0xb'),'disposition':_0x1e1931[0x0]};if(rpc[_0x3004cb[_0x7bad('0xc')]+'Interaction']){rpc[_0x3004cb['channel']+_0x7bad('0xd')][_0x7bad('0xe')](_0x3004cb[_0x7bad('0xf')]['id'],_0x44458e)[_0x7bad('0x10')](function(_0x5dd805){logger[_0x7bad('0x11')](_0x7bad('0x12'),_0x175677,_0x3004cb[_0x7bad('0xf')]['id']);})['catch'](function(_0x42df11){logger[_0x7bad('0x13')](_0x7bad('0x14'),_0x175677,JSON['stringify'](_0x42df11));})[_0x7bad('0x15')](function(){_0x4c9f1f[_0x7bad('0x16')]();});}}catch(_0x20886d){logger['error'](_0x7bad('0x14'),_0x175677,JSON['stringify'](_0x20886d));_0x4c9f1f[_0x7bad('0x16')]();}};}; \ No newline at end of file +var _0x0d99=['Interaction','interaction','then','[%s][CLOSE]\x20interaction\x20%s\x20has\x20been\x20closed!','catch','error','[%s][CLOSE]\x20%s','stringify','finally','stop','moment','../../../../config/logger','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','info','[%s][CLOSE]\x20reason\x20%s','format'];(function(_0x10c817,_0x15af85){var _0x19235a=function(_0x4f6458){while(--_0x4f6458){_0x10c817['push'](_0x10c817['shift']());}};_0x19235a(++_0x15af85);}(_0x0d99,0x1a8));var _0x90d9=function(_0x30187a,_0x20c300){_0x30187a=_0x30187a-0x0;var _0x396d87=_0x0d99[_0x30187a];return _0x396d87;};'use strict';var moment=require(_0x90d9('0x0'));var logger=require(_0x90d9('0x1'))('routing');var rpc={'chatInteraction':require('../../rpc/chatInteraction'),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x90d9('0x2')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x90d9('0x3')),'whatsappInteraction':require(_0x90d9('0x4'))};exports['consequence']=function(_0x4baf8e,_0x376399,_0x5ac3a0,_0x548e59){return function(_0x23568f){try{logger[_0x90d9('0x5')](_0x90d9('0x6'),_0x4baf8e,_0x376399[0x0]);var _0x4ff178={'closed':0x1,'closedAt':moment()[_0x90d9('0x7')]('YYYY-MM-DD\x20HH:mm:ss'),'closeReason':'system','disposition':_0x376399[0x0]};if(rpc[_0x548e59['channel']+_0x90d9('0x8')]){rpc[_0x548e59['channel']+_0x90d9('0x8')]['update'](_0x548e59[_0x90d9('0x9')]['id'],_0x4ff178)[_0x90d9('0xa')](function(_0x50253f){logger['info'](_0x90d9('0xb'),_0x4baf8e,_0x548e59[_0x90d9('0x9')]['id']);})[_0x90d9('0xc')](function(_0x480547){logger[_0x90d9('0xd')](_0x90d9('0xe'),_0x4baf8e,JSON[_0x90d9('0xf')](_0x480547));})[_0x90d9('0x10')](function(){_0x23568f['stop']();});}}catch(_0x3912bd){logger[_0x90d9('0xd')](_0x90d9('0xe'),_0x4baf8e,JSON[_0x90d9('0xf')](_0x3912bd));_0x23568f[_0x90d9('0x11')]();}};}; \ 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 ea0baa7..51a6b5a 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 _0x8921=['../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','info','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','whatsapp','phone','chat','ChatWebsiteId','account','upperFirst','created','isEmpty','body','getMustacheRender','then','catch','error','[%s][DIALOGFLOW]\x20%s','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','textRequest','message','result','fulfillment','speech','providerName','dialogflow','providerResponse','Message','create','endConversation','stop','lodash','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage'];(function(_0xb301d4,_0x27ed18){var _0x3b5bde=function(_0x1fbc5f){while(--_0x1fbc5f){_0xb301d4['push'](_0xb301d4['shift']());}};_0x3b5bde(++_0x27ed18);}(_0x8921,0x9a));var _0x1892=function(_0x4c715b,_0x4e802b){_0x4c715b=_0x4c715b-0x0;var _0x395bec=_0x8921[_0x4c715b];return _0x395bec;};'use strict';var _=require(_0x1892('0x0'));var moment=require('moment');var apiai=require(_0x1892('0x1'));var md5=require(_0x1892('0x2'));var utils=require(_0x1892('0x3'));var logger=require(_0x1892('0x4'))(_0x1892('0x5'));var rpc={'chatMessage':require(_0x1892('0x6')),'openchannelMessage':require(_0x1892('0x7')),'mailMessage':require(_0x1892('0x8')),'smsMessage':require(_0x1892('0x9')),'faxMessage':require(_0x1892('0xa')),'whatsappMessage':require(_0x1892('0xb'))};exports[_0x1892('0xc')]=function(_0x504741,_0xfe2155){return function(_0x6a2604){try{if(!_[_0x1892('0xd')](this[_0x1892('0xe')][_0x1892('0xf')])){logger[_0x1892('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x504741,_0x1892('0x11'));return _0x6a2604[_0x1892('0x12')]();}var _0x7435c2={'ContactId':this[_0x1892('0x13')]['id'],'sentAt':moment()[_0x1892('0x14')](_0x1892('0x15')),'direction':_0x1892('0x16')};if(this[_0x1892('0x17')]===_0x1892('0x18')||this[_0x1892('0x17')]===_0x1892('0x19')){_0x7435c2['phone']=this[_0x1892('0xe')][_0x1892('0x1a')];}var _0x102096=this['channel'];if(_0x102096===_0x1892('0x1b')){_0x7435c2[_0x1892('0x1c')]=this[_0x1892('0x1d')]['id'];}else{_0x7435c2[_[_0x1892('0x1e')](_0x102096)+'AccountId']=this['account']['id'];}_0x7435c2[_[_0x1892('0x1e')](_0x102096)+'InteractionId']=this[_0x1892('0xe')]['id'];if(this['interaction'][_0x1892('0x1f')]){var _0x425251=_0xfe2155[0x2];if(!_[_0x1892('0x20')](_0x425251)){_0x7435c2[_0x1892('0x21')]=utils[_0x1892('0x22')](_0x425251,this);return rpc[_0x102096+'Message']['create'](_0x7435c2)[_0x1892('0x23')](function(_0x49937d){logger[_0x1892('0x10')]('[%s][DIALOGFLOW]\x20%s',_0x504741,_0x7435c2[_0x1892('0x21')]);})[_0x1892('0x24')](function(_0x4c2e74){logger[_0x1892('0x25')](_0x1892('0x26'),_0x504741,JSON[_0x1892('0x27')](_0x4c2e74));})[_0x1892('0x28')](function(){logger['info']('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x504741);_0x6a2604['stop']();});}else{logger[_0x1892('0x10')](_0x1892('0x29'),_0x504741);_0x6a2604['stop']();}}else{var _0xa9a3e0=this;var _0x8fd69a=apiai(_0xfe2155[0x0],{'language':_0xfe2155[0x1]||'en'});return _0x8fd69a[_0x1892('0x2a')](this[_0x1892('0x2b')]['body'],{'sessionId':md5(this[_0x1892('0xe')]['id'])})[_0x1892('0x23')](function(_0x2fc141){_0xa9a3e0[_0x1892('0x21')]['dialogflow']=_0x2fc141;_0x7435c2[_0x1892('0x21')]=_0x2fc141[_0x1892('0x2c')][_0x1892('0x2d')][_0x1892('0x2e')];_0x7435c2[_0x1892('0x2f')]=_0x1892('0x30');_0x7435c2[_0x1892('0x31')]=JSON[_0x1892('0x27')](_0x2fc141);return rpc[_0x102096+_0x1892('0x32')][_0x1892('0x33')](_0x7435c2)[_0x1892('0x23')](function(_0x5bbcf1){logger[_0x1892('0x10')](_0x1892('0x26'),_0x504741,_0x7435c2['body']);if(_0x2fc141[_0x1892('0x2c')]['metadata'][_0x1892('0x34')]){_0x6a2604[_0x1892('0x12')]();}else{_0x6a2604[_0x1892('0x35')]();}})[_0x1892('0x24')](function(_0x823674){logger['error'](_0x1892('0x26'),_0x504741,JSON[_0x1892('0x27')](_0x823674));_0x6a2604[_0x1892('0x12')]();});})[_0x1892('0x24')](function(_0x43e72b){logger[_0x1892('0x25')](_0x1892('0x26'),_0x504741,_0x43e72b[_0x1892('0x2b')]);_0x6a2604[_0x1892('0x12')]();});}}catch(_0x504ba1){logger['error']('[%s][DIALOGFLOW]\x20%s',_0x504741,JSON[_0x1892('0x27')](_0x504ba1));_0x6a2604[_0x1892('0x35')]();}};}; \ No newline at end of file +var _0x044a=['body','result','fulfillment','providerName','dialogflow','metadata','endConversation','lodash','moment','apiai-promise','md5','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','consequence','isNil','interaction','UserId','[%s][DIALOGFLOW]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','sms','phone','channel','chat','ChatWebsiteId','upperFirst','account','InteractionId','isEmpty','getMustacheRender','Message','create','then','catch','error','stringify','finally','[%s][DIALOGFLOW]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','info','textRequest','message'];(function(_0x5b253d,_0x1a776c){var _0xeec584=function(_0x4c0cfd){while(--_0x4c0cfd){_0x5b253d['push'](_0x5b253d['shift']());}};_0xeec584(++_0x1a776c);}(_0x044a,0x173));var _0xa044=function(_0x9f4726,_0x202c9b){_0x9f4726=_0x9f4726-0x0;var _0x1930eb=_0x044a[_0x9f4726];return _0x1930eb;};'use strict';var _=require(_0xa044('0x0'));var moment=require(_0xa044('0x1'));var apiai=require(_0xa044('0x2'));var md5=require(_0xa044('0x3'));var utils=require(_0xa044('0x4'));var logger=require(_0xa044('0x5'))(_0xa044('0x6'));var rpc={'chatMessage':require(_0xa044('0x7')),'openchannelMessage':require(_0xa044('0x8')),'mailMessage':require(_0xa044('0x9')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xa044('0xa')),'whatsappMessage':require(_0xa044('0xb'))};exports[_0xa044('0xc')]=function(_0x1c04bb,_0x59b81b){return function(_0xe12f7d){try{if(!_[_0xa044('0xd')](this[_0xa044('0xe')][_0xa044('0xf')])){logger['info'](_0xa044('0x10'),_0x1c04bb,_0xa044('0x11'));return _0xe12f7d[_0xa044('0x12')]();}var _0x47a9dc={'ContactId':this[_0xa044('0x13')]['id'],'sentAt':moment()[_0xa044('0x14')](_0xa044('0x15')),'direction':_0xa044('0x16')};if(this['channel']===_0xa044('0x17')||this['channel']==='whatsapp'){_0x47a9dc[_0xa044('0x18')]=this[_0xa044('0xe')][_0xa044('0x18')];}var _0x344c7d=this[_0xa044('0x19')];if(_0x344c7d===_0xa044('0x1a')){_0x47a9dc[_0xa044('0x1b')]=this['account']['id'];}else{_0x47a9dc[_[_0xa044('0x1c')](_0x344c7d)+'AccountId']=this[_0xa044('0x1d')]['id'];}_0x47a9dc[_[_0xa044('0x1c')](_0x344c7d)+_0xa044('0x1e')]=this[_0xa044('0xe')]['id'];if(this[_0xa044('0xe')]['created']){var _0x516c34=_0x59b81b[0x2];if(!_[_0xa044('0x1f')](_0x516c34)){_0x47a9dc['body']=utils[_0xa044('0x20')](_0x516c34,this);return rpc[_0x344c7d+_0xa044('0x21')][_0xa044('0x22')](_0x47a9dc)[_0xa044('0x23')](function(_0x3ccbd3){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1c04bb,_0x47a9dc['body']);})[_0xa044('0x24')](function(_0x417cbb){logger[_0xa044('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x1c04bb,JSON[_0xa044('0x26')](_0x417cbb));})[_0xa044('0x27')](function(){logger['info'](_0xa044('0x28'),_0x1c04bb);_0xe12f7d[_0xa044('0x29')]();});}else{logger[_0xa044('0x2a')]('[%s][DIALOGFLOW]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x1c04bb);_0xe12f7d[_0xa044('0x29')]();}}else{var _0x966548=this;var _0x26747b=apiai(_0x59b81b[0x0],{'language':_0x59b81b[0x1]||'en'});return _0x26747b[_0xa044('0x2b')](this[_0xa044('0x2c')][_0xa044('0x2d')],{'sessionId':md5(this[_0xa044('0xe')]['id'])})[_0xa044('0x23')](function(_0x36c237){_0x966548['body']['dialogflow']=_0x36c237;_0x47a9dc[_0xa044('0x2d')]=_0x36c237[_0xa044('0x2e')][_0xa044('0x2f')]['speech'];_0x47a9dc[_0xa044('0x30')]=_0xa044('0x31');_0x47a9dc['providerResponse']=JSON[_0xa044('0x26')](_0x36c237);return rpc[_0x344c7d+_0xa044('0x21')]['create'](_0x47a9dc)[_0xa044('0x23')](function(_0x2889c2){logger['info']('[%s][DIALOGFLOW]\x20%s',_0x1c04bb,_0x47a9dc['body']);if(_0x36c237[_0xa044('0x2e')][_0xa044('0x32')][_0xa044('0x33')]){_0xe12f7d['next']();}else{_0xe12f7d[_0xa044('0x29')]();}})[_0xa044('0x24')](function(_0x485212){logger[_0xa044('0x25')]('[%s][DIALOGFLOW]\x20%s',_0x1c04bb,JSON['stringify'](_0x485212));_0xe12f7d[_0xa044('0x12')]();});})['catch'](function(_0x30fd39){logger[_0xa044('0x25')](_0xa044('0x10'),_0x1c04bb,_0x30fd39[_0xa044('0x2c')]);_0xe12f7d[_0xa044('0x12')]();});}}catch(_0xf2d227){logger['error'](_0xa044('0x10'),_0x1c04bb,JSON[_0xa044('0x26')](_0xf2d227));_0xe12f7d[_0xa044('0x29')]();}};}; \ 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 03ec06c..19f6d9b 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 _0xa7aa=['message','dialogflow','md5','moment','bluebird','../../../../config/logger','routing','../../rpc/openchannelMessage','../../rpc/whatsappMessage','clone','body','Message','create','then','info','catch','error','stringify','consequence','isNil','UserId','[%s][DIALOGFLOWV2]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','contact','format','YYYY-MM-DD\x20HH:mm:ss','channel','whatsapp','phone','account','upperFirst','AccountId','InteractionId','interaction','created','getMustacheRender','finally','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','SessionsClient','detectIntent','length','queryResult','diagnosticInfo','fields','end_conversation','boolValue','DIALOGFLOWV2_ACTION','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_ENDCONVERSATION','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','DIALOGFLOWV2_LANGUAGECODE','languageCode','queryText','dialogflowV2','providerResponse','fulfillmentText','push','all','next'];(function(_0x235482,_0x14b833){var _0x5f5bea=function(_0x17a254){while(--_0x17a254){_0x235482['push'](_0x235482['shift']());}};_0x5f5bea(++_0x14b833);}(_0xa7aa,0x8d));var _0xaa7a=function(_0x56ce71,_0x2892f8){_0x56ce71=_0x56ce71-0x0;var _0x5398ab=_0xa7aa[_0x56ce71];return _0x5398ab;};'use strict';var _=require('lodash');var dialogflow=require(_0xaa7a('0x0'));var md5=require(_0xaa7a('0x1'));var moment=require(_0xaa7a('0x2'));var Promise=require(_0xaa7a('0x3'));var logger=require(_0xaa7a('0x4'))(_0xaa7a('0x5'));var utils=require('./utils');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xaa7a('0x6')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xaa7a('0x7'))};function createMessage(_0x4e5615,_0x5495b0,_0xc1585f,_0x2d77b3){return new Promise(function(_0x474c8d,_0x1a39af){var _0x5271c4=_[_0xaa7a('0x8')](_0xc1585f);_0x5271c4[_0xaa7a('0x9')]=_0x2d77b3;return rpc[_0x5495b0+_0xaa7a('0xa')][_0xaa7a('0xb')](_0x5271c4)[_0xaa7a('0xc')](function(){logger[_0xaa7a('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x4e5615,_0x5271c4['body']);_0x474c8d();})[_0xaa7a('0xe')](function(_0x40c043){logger[_0xaa7a('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x4e5615,JSON[_0xaa7a('0x10')](_0x40c043));_0x1a39af(_0x40c043);});});}exports[_0xaa7a('0x11')]=function(_0x552334,_0x4a69d6){return function(_0x592329){try{if(!_[_0xaa7a('0x12')](this['interaction'][_0xaa7a('0x13')])){logger[_0xaa7a('0xd')](_0xaa7a('0x14'),_0x552334,_0xaa7a('0x15'));return _0x592329['next']();}var _0x370b70={'ContactId':this[_0xaa7a('0x16')]['id'],'sentAt':moment()[_0xaa7a('0x17')](_0xaa7a('0x18')),'direction':'out'};if(this[_0xaa7a('0x19')]==='sms'||this['channel']===_0xaa7a('0x1a')){_0x370b70[_0xaa7a('0x1b')]=this['interaction'][_0xaa7a('0x1b')];}var _0x95b605=this[_0xaa7a('0x19')];if(_0x95b605==='chat'){_0x370b70['ChatWebsiteId']=this[_0xaa7a('0x1c')]['id'];}else{_0x370b70[_[_0xaa7a('0x1d')](_0x95b605)+_0xaa7a('0x1e')]=this[_0xaa7a('0x1c')]['id'];}_0x370b70[_['upperFirst'](_0x95b605)+_0xaa7a('0x1f')]=this[_0xaa7a('0x20')]['id'];if(this[_0xaa7a('0x20')][_0xaa7a('0x21')]){var _0x54376b=_0x4a69d6[0x4];if(!_['isEmpty'](_0x54376b)){_0x370b70[_0xaa7a('0x9')]=utils[_0xaa7a('0x22')](_0x54376b,this);return rpc[_0x95b605+_0xaa7a('0xa')]['create'](_0x370b70)[_0xaa7a('0xc')](function(_0x1bb8f3){logger[_0xaa7a('0xd')]('[%s][DIALOGFLOWV2]\x20%s',_0x552334,_0x370b70[_0xaa7a('0x9')]);})[_0xaa7a('0xe')](function(_0x4e0088){logger[_0xaa7a('0xf')](_0xaa7a('0x14'),_0x552334,JSON[_0xaa7a('0x10')](_0x4e0088));})[_0xaa7a('0x23')](function(){logger[_0xaa7a('0xd')](_0xaa7a('0x24'),_0x552334);_0x592329[_0xaa7a('0x25')]();});}else{logger['info'](_0xaa7a('0x26'),_0x552334);_0x592329[_0xaa7a('0x25')]();}}else{var _0x302fa2=this;var _0x520ea2=_0x4a69d6[0x2][_0xaa7a('0x27')](/\\n/g,'\x0a');var _0x1c5778={'credentials':{'private_key':_0x520ea2,'client_email':_0x4a69d6[0x1]}};var _0x7268e7=new dialogflow[(_0xaa7a('0x28'))](_0x1c5778);var _0x54fbee=_0x7268e7['sessionPath'](_0x4a69d6[0x0],md5(_0x302fa2[_0xaa7a('0x20')]['id']));var _0x10ef66={'session':_0x54fbee,'queryInput':{'text':{'text':_0x302fa2['message'][_0xaa7a('0x9')],'languageCode':_0x4a69d6[0x3]||'en'}}};return _0x7268e7[_0xaa7a('0x29')](_0x10ef66)['then'](function(_0x28f42c){if(_0x28f42c&&_0x28f42c[_0xaa7a('0x2a')]){_0x302fa2[_0xaa7a('0x9')]['dialogflowV2']=_0x28f42c;var _0x5ab0d1=_0x28f42c[0x0];var _0x36679e=_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x2c')]&&_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x2c')]['fields']?_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x2c')][_0xaa7a('0x2d')][_0xaa7a('0x2e')][_0xaa7a('0x2f')]:![];_0x302fa2[_0xaa7a('0x9')][_0xaa7a('0x30')]=_0x5ab0d1['queryResult'][_0xaa7a('0x31')];_0x302fa2[_0xaa7a('0x9')][_0xaa7a('0x32')]=_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x33')];_0x302fa2[_0xaa7a('0x9')][_0xaa7a('0x34')]=_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x2c')]&&_0x5ab0d1['queryResult'][_0xaa7a('0x2c')][_0xaa7a('0x2d')]?_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x2c')][_0xaa7a('0x2d')]['end_conversation'][_0xaa7a('0x2f')]:![];_0x302fa2['body'][_0xaa7a('0x35')]=_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x36')][_0xaa7a('0x37')];_0x302fa2['body'][_0xaa7a('0x38')]=_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x36')][_0xaa7a('0x39')];_0x302fa2[_0xaa7a('0x9')][_0xaa7a('0x3a')]=_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x36')][_0xaa7a('0x3b')];_0x302fa2[_0xaa7a('0x9')][_0xaa7a('0x3c')]=_0x5ab0d1['queryResult'][_0xaa7a('0x3d')];_0x302fa2[_0xaa7a('0x9')]['DIALOGFLOWV2_QUERYTEXT']=_0x5ab0d1[_0xaa7a('0x2b')][_0xaa7a('0x3e')];_0x302fa2[_0xaa7a('0x9')]['DIALOGFLOWV2_SCORE']=_0x5ab0d1[_0xaa7a('0x2b')]['intentDetectionConfidence'];_0x370b70['providerName']=_0xaa7a('0x3f');_0x370b70[_0xaa7a('0x40')]=JSON[_0xaa7a('0x10')](_0x28f42c);var _0x1388ed=[];for(var _0xade556=0x0;_0xade556<_0x28f42c[_0xaa7a('0x2a')];_0xade556++){var _0x704d4=_0x28f42c[_0xade556];if(_0x704d4&&_0x704d4['queryResult']&&_0x704d4[_0xaa7a('0x2b')][_0xaa7a('0x41')]){_0x1388ed[_0xaa7a('0x42')](createMessage(_0x552334,_0x95b605,_0x370b70,_0x704d4['queryResult']['fulfillmentText']));}}return Promise[_0xaa7a('0x43')](_0x1388ed)[_0xaa7a('0xc')](function(){if(_0x36679e){_0x592329[_0xaa7a('0x44')]();}else{_0x592329[_0xaa7a('0x25')]();}})[_0xaa7a('0xe')](function(_0x460e7f){logger[_0xaa7a('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x552334,JSON[_0xaa7a('0x10')](_0x460e7f));_0x592329['next']();});}})['catch'](function(_0xc8ed79){logger['error'](_0xaa7a('0x14'),_0x552334,_0xc8ed79[_0xaa7a('0x45')]);_0x592329['next']();});}}catch(_0x54d7b8){logger[_0xaa7a('0xf')]('[%s][DIALOGFLOWV2]\x20%s',_0x552334,JSON[_0xaa7a('0x10')](_0x54d7b8));_0x592329[_0xaa7a('0x25')]();}};}; \ No newline at end of file +var _0xebec=['message','detectIntent','length','dialogflowV2','queryResult','diagnosticInfo','fields','end_conversation','action','DIALOGFLOWV2_ALLREQUIREDPARAMSPRESENT','allRequiredParamsPresent','DIALOGFLOWV2_INTENTNAME','intent','name','DIALOGFLOWV2_INTENTDISPLAYNAME','displayName','DIALOGFLOWV2_ISFALLBACKINTENT','isFallback','languageCode','DIALOGFLOWV2_QUERYTEXT','queryText','DIALOGFLOWV2_SCORE','intentDetectionConfidence','providerName','providerResponse','push','fulfillmentText','all','next','lodash','dialogflow','md5','bluebird','../../../../config/logger','routing','./utils','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/whatsappMessage','clone','body','Message','create','info','[%s][DIALOGFLOWV2]\x20%s','catch','error','stringify','consequence','isNil','interaction','UserId','contact','format','sms','channel','phone','chat','account','upperFirst','AccountId','isEmpty','then','finally','stop','[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','replace','sessionPath'];(function(_0x44cf5b,_0x3637c5){var _0x3ecab7=function(_0x163d95){while(--_0x163d95){_0x44cf5b['push'](_0x44cf5b['shift']());}};_0x3ecab7(++_0x3637c5);}(_0xebec,0x135));var _0xcebe=function(_0x12efc4,_0x13f7b6){_0x12efc4=_0x12efc4-0x0;var _0x2d67c6=_0xebec[_0x12efc4];return _0x2d67c6;};'use strict';var _=require(_0xcebe('0x0'));var dialogflow=require(_0xcebe('0x1'));var md5=require(_0xcebe('0x2'));var moment=require('moment');var Promise=require(_0xcebe('0x3'));var logger=require(_0xcebe('0x4'))(_0xcebe('0x5'));var utils=require(_0xcebe('0x6'));var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0xcebe('0x7')),'mailMessage':require(_0xcebe('0x8')),'smsMessage':require(_0xcebe('0x9')),'faxMessage':require(_0xcebe('0xa')),'whatsappMessage':require(_0xcebe('0xb'))};function createMessage(_0x2c5b0a,_0x115fab,_0x645689,_0x2e7adb){return new Promise(function(_0x4a6c54,_0x470e19){var _0x2f9028=_[_0xcebe('0xc')](_0x645689);_0x2f9028[_0xcebe('0xd')]=_0x2e7adb;return rpc[_0x115fab+_0xcebe('0xe')][_0xcebe('0xf')](_0x2f9028)['then'](function(){logger[_0xcebe('0x10')](_0xcebe('0x11'),_0x2c5b0a,_0x2f9028[_0xcebe('0xd')]);_0x4a6c54();})[_0xcebe('0x12')](function(_0x151d72){logger[_0xcebe('0x13')](_0xcebe('0x11'),_0x2c5b0a,JSON[_0xcebe('0x14')](_0x151d72));_0x470e19(_0x151d72);});});}exports[_0xcebe('0x15')]=function(_0x5cc1f1,_0x38995e){return function(_0x36ddeb){try{if(!_[_0xcebe('0x16')](this[_0xcebe('0x17')][_0xcebe('0x18')])){logger[_0xcebe('0x10')](_0xcebe('0x11'),_0x5cc1f1,'Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.');return _0x36ddeb['next']();}var _0x2abc97={'ContactId':this[_0xcebe('0x19')]['id'],'sentAt':moment()[_0xcebe('0x1a')]('YYYY-MM-DD\x20HH:mm:ss'),'direction':'out'};if(this['channel']===_0xcebe('0x1b')||this[_0xcebe('0x1c')]==='whatsapp'){_0x2abc97['phone']=this[_0xcebe('0x17')][_0xcebe('0x1d')];}var _0x22e009=this['channel'];if(_0x22e009===_0xcebe('0x1e')){_0x2abc97['ChatWebsiteId']=this[_0xcebe('0x1f')]['id'];}else{_0x2abc97[_[_0xcebe('0x20')](_0x22e009)+_0xcebe('0x21')]=this['account']['id'];}_0x2abc97[_[_0xcebe('0x20')](_0x22e009)+'InteractionId']=this[_0xcebe('0x17')]['id'];if(this[_0xcebe('0x17')]['created']){var _0x4fb6a4=_0x38995e[0x4];if(!_[_0xcebe('0x22')](_0x4fb6a4)){_0x2abc97[_0xcebe('0xd')]=utils['getMustacheRender'](_0x4fb6a4,this);return rpc[_0x22e009+_0xcebe('0xe')]['create'](_0x2abc97)[_0xcebe('0x23')](function(_0x36ec0f){logger[_0xcebe('0x10')](_0xcebe('0x11'),_0x5cc1f1,_0x2abc97[_0xcebe('0xd')]);})[_0xcebe('0x12')](function(_0x5cf5b7){logger[_0xcebe('0x13')]('[%s][DIALOGFLOWV2]\x20%s',_0x5cc1f1,JSON[_0xcebe('0x14')](_0x5cf5b7));})[_0xcebe('0x24')](function(){logger[_0xcebe('0x10')]('[%s][DIALOGFLOWV2]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x5cc1f1);_0x36ddeb[_0xcebe('0x25')]();});}else{logger['info'](_0xcebe('0x26'),_0x5cc1f1);_0x36ddeb['stop']();}}else{var _0x41c882=this;var _0x3bf84c=_0x38995e[0x2][_0xcebe('0x27')](/\\n/g,'\x0a');var _0x4c9ff1={'credentials':{'private_key':_0x3bf84c,'client_email':_0x38995e[0x1]}};var _0xb8f807=new dialogflow['SessionsClient'](_0x4c9ff1);var _0x1b41d2=_0xb8f807[_0xcebe('0x28')](_0x38995e[0x0],md5(_0x41c882[_0xcebe('0x17')]['id']));var _0xf158fa={'session':_0x1b41d2,'queryInput':{'text':{'text':_0x41c882[_0xcebe('0x29')][_0xcebe('0xd')],'languageCode':_0x38995e[0x3]||'en'}}};return _0xb8f807[_0xcebe('0x2a')](_0xf158fa)['then'](function(_0x1b1ff7){if(_0x1b1ff7&&_0x1b1ff7[_0xcebe('0x2b')]){_0x41c882[_0xcebe('0xd')][_0xcebe('0x2c')]=_0x1b1ff7;var _0x50ea10=_0x1b1ff7[0x0];var _0x20391e=_0x50ea10[_0xcebe('0x2d')]['diagnosticInfo']&&_0x50ea10[_0xcebe('0x2d')][_0xcebe('0x2e')]['fields']?_0x50ea10['queryResult'][_0xcebe('0x2e')][_0xcebe('0x2f')][_0xcebe('0x30')]['boolValue']:![];_0x41c882[_0xcebe('0xd')]['DIALOGFLOWV2_ACTION']=_0x50ea10['queryResult'][_0xcebe('0x31')];_0x41c882[_0xcebe('0xd')][_0xcebe('0x32')]=_0x50ea10[_0xcebe('0x2d')][_0xcebe('0x33')];_0x41c882[_0xcebe('0xd')]['DIALOGFLOWV2_ENDCONVERSATION']=_0x50ea10[_0xcebe('0x2d')][_0xcebe('0x2e')]&&_0x50ea10[_0xcebe('0x2d')][_0xcebe('0x2e')][_0xcebe('0x2f')]?_0x50ea10['queryResult'][_0xcebe('0x2e')][_0xcebe('0x2f')][_0xcebe('0x30')]['boolValue']:![];_0x41c882['body'][_0xcebe('0x34')]=_0x50ea10[_0xcebe('0x2d')][_0xcebe('0x35')][_0xcebe('0x36')];_0x41c882[_0xcebe('0xd')][_0xcebe('0x37')]=_0x50ea10[_0xcebe('0x2d')][_0xcebe('0x35')][_0xcebe('0x38')];_0x41c882[_0xcebe('0xd')][_0xcebe('0x39')]=_0x50ea10[_0xcebe('0x2d')][_0xcebe('0x35')][_0xcebe('0x3a')];_0x41c882[_0xcebe('0xd')]['DIALOGFLOWV2_LANGUAGECODE']=_0x50ea10[_0xcebe('0x2d')][_0xcebe('0x3b')];_0x41c882[_0xcebe('0xd')][_0xcebe('0x3c')]=_0x50ea10['queryResult'][_0xcebe('0x3d')];_0x41c882[_0xcebe('0xd')][_0xcebe('0x3e')]=_0x50ea10[_0xcebe('0x2d')][_0xcebe('0x3f')];_0x2abc97[_0xcebe('0x40')]=_0xcebe('0x2c');_0x2abc97[_0xcebe('0x41')]=JSON[_0xcebe('0x14')](_0x1b1ff7);var _0x31ed8d=[];for(var _0x274c9c=0x0;_0x274c9c<_0x1b1ff7[_0xcebe('0x2b')];_0x274c9c++){var _0x2f7f8e=_0x1b1ff7[_0x274c9c];if(_0x2f7f8e&&_0x2f7f8e[_0xcebe('0x2d')]&&_0x2f7f8e['queryResult']['fulfillmentText']){_0x31ed8d[_0xcebe('0x42')](createMessage(_0x5cc1f1,_0x22e009,_0x2abc97,_0x2f7f8e[_0xcebe('0x2d')][_0xcebe('0x43')]));}}return Promise[_0xcebe('0x44')](_0x31ed8d)['then'](function(){if(_0x20391e){_0x36ddeb[_0xcebe('0x45')]();}else{_0x36ddeb[_0xcebe('0x25')]();}})[_0xcebe('0x12')](function(_0x21e964){logger[_0xcebe('0x13')](_0xcebe('0x11'),_0x5cc1f1,JSON[_0xcebe('0x14')](_0x21e964));_0x36ddeb[_0xcebe('0x45')]();});}})[_0xcebe('0x12')](function(_0x1ef85f){logger[_0xcebe('0x13')](_0xcebe('0x11'),_0x5cc1f1,_0x1ef85f['message']);_0x36ddeb['next']();});}}catch(_0x38458f){logger['error'](_0xcebe('0x11'),_0x5cc1f1,JSON[_0xcebe('0x14')](_0x38458f));_0x36ddeb[_0xcebe('0x25')]();}};}; \ 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 310636a..6e6ce15 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 _0xfd86=['consequence','fromString','getMustacheRender','error','[%s][GOTOIF]\x20%s','map','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','[%s][GOTOIF]\x20eval\x20error:\x20%s','stringify','stop','validate','html-to-text','./utils','../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number'];(function(_0x20fb02,_0x96c029){var _0x24a33e=function(_0x4b5c8a){while(--_0x4b5c8a){_0x20fb02['push'](_0x20fb02['shift']());}};_0x24a33e(++_0x96c029);}(_0xfd86,0x1c7));var _0x6fd8=function(_0x3b19ea,_0x518b6b){_0x3b19ea=_0x3b19ea-0x0;var _0x40ece9=_0xfd86[_0x3b19ea];return _0x40ece9;};'use strict';var schema=require(_0x6fd8('0x0'));var _=require('lodash');var htmlToText=require(_0x6fd8('0x1'));var utils=require(_0x6fd8('0x2'));var logger=require(_0x6fd8('0x3'))(_0x6fd8('0x4'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x6fd8('0x5')},'priorityTrue':{'type':_0x6fd8('0x6'),'message':_0x6fd8('0x7')},'priorityFalse':{'type':_0x6fd8('0x6'),'message':_0x6fd8('0x8')}});exports[_0x6fd8('0x9')]=function(_0xbef57c,_0x51972b){return function(_0x4ee5f4){try{var _0x501f0c={'condition':htmlToText[_0x6fd8('0xa')](utils[_0x6fd8('0xb')](_0x51972b[0x0],this),{'wordwrap':![]})['replace'](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x51972b[0x1],'priorityFalse':_0x51972b[0x2]};var _0x3f7b50=gotoif[_0x6fd8('0x0')](_0x501f0c,{'typecast':!![]});if(_0x3f7b50['length']){logger[_0x6fd8('0xc')](_0x6fd8('0xd'),_0xbef57c,_[_0x6fd8('0xe')](_0x3f7b50,'message')[_0x6fd8('0xf')](',\x20'));_0x4ee5f4['stop']();}else{try{var _0x4b813d=eval('('+_0x501f0c[_0x6fd8('0x10')]+')');var _0x46c2b6=_0x4b813d?_0x501f0c[_0x6fd8('0x11')]:_0x501f0c[_0x6fd8('0x12')];logger[_0x6fd8('0x13')](_0x6fd8('0x14'),_0xbef57c,_0x501f0c[_0x6fd8('0x10')],_0x4b813d,_0x46c2b6||_0x6fd8('0x15'));if(_0x46c2b6){var _0x52e40b=_[_0x6fd8('0x16')](_0x4ee5f4[_0x6fd8('0x17')](),{'p':_0x46c2b6});if(_0x52e40b>=0x0){logger[_0x6fd8('0x13')](_0x6fd8('0x18'),_0xbef57c,_0x46c2b6||_0x6fd8('0x15'),_0x52e40b);_0x4ee5f4['next'](_0x52e40b);}else{logger['info'](_0x6fd8('0x19'),_0xbef57c,_0x46c2b6||_0x6fd8('0x15'));_0x4ee5f4['stop']();}}else{_0x4ee5f4[_0x6fd8('0x15')]();}}catch(_0x7ef404){logger[_0x6fd8('0xc')](_0x6fd8('0x1a'),_0xbef57c,_0x7ef404['message']);_0x4ee5f4['stop']();}}}catch(_0x10cb78){logger['error'](_0x6fd8('0xd'),_0xbef57c,JSON[_0x6fd8('0x1b')](_0x10cb78));_0x4ee5f4[_0x6fd8('0x1c')]();}};}; \ No newline at end of file +var _0x66db=['../../../../config/logger','routing','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence','fromString','getMustacheRender','replace','error','[%s][GOTOIF]\x20%s','map','message','join','priorityTrue','priorityFalse','[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s','condition','next','rules','info','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','stop','[%s][GOTOIF]\x20eval\x20error:\x20%s','validate','lodash','html-to-text','./utils'];(function(_0x3afad3,_0x5266f8){var _0x4e55c6=function(_0x1100d7){while(--_0x1100d7){_0x3afad3['push'](_0x3afad3['shift']());}};_0x4e55c6(++_0x5266f8);}(_0x66db,0x158));var _0xb66d=function(_0x5abdfc,_0x385c27){_0x5abdfc=_0x5abdfc-0x0;var _0x124657=_0x66db[_0x5abdfc];return _0x124657;};'use strict';var schema=require(_0xb66d('0x0'));var _=require(_0xb66d('0x1'));var htmlToText=require(_0xb66d('0x2'));var utils=require(_0xb66d('0x3'));var logger=require(_0xb66d('0x4'))(_0xb66d('0x5'));var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0xb66d('0x6')},'priorityTrue':{'type':_0xb66d('0x7'),'message':_0xb66d('0x8')},'priorityFalse':{'type':_0xb66d('0x7'),'message':_0xb66d('0x9')}});exports[_0xb66d('0xa')]=function(_0x151be0,_0x23dae8){return function(_0xda834){try{var _0x5b5eb8={'condition':htmlToText[_0xb66d('0xb')](utils[_0xb66d('0xc')](_0x23dae8[0x0],this),{'wordwrap':![]})[_0xb66d('0xd')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0x23dae8[0x1],'priorityFalse':_0x23dae8[0x2]};var _0x39f525=gotoif[_0xb66d('0x0')](_0x5b5eb8,{'typecast':!![]});if(_0x39f525['length']){logger[_0xb66d('0xe')](_0xb66d('0xf'),_0x151be0,_[_0xb66d('0x10')](_0x39f525,_0xb66d('0x11'))[_0xb66d('0x12')](',\x20'));_0xda834['stop']();}else{try{var _0x56e5e1=eval('('+_0x5b5eb8['condition']+')');var _0x25fcb9=_0x56e5e1?_0x5b5eb8[_0xb66d('0x13')]:_0x5b5eb8[_0xb66d('0x14')];logger['info'](_0xb66d('0x15'),_0x151be0,_0x5b5eb8[_0xb66d('0x16')],_0x56e5e1,_0x25fcb9||_0xb66d('0x17'));if(_0x25fcb9){var _0x4f4e02=_['findIndex'](_0xda834[_0xb66d('0x18')](),{'p':_0x25fcb9});if(_0x4f4e02>=0x0){logger[_0xb66d('0x19')](_0xb66d('0x1a'),_0x151be0,_0x25fcb9||_0xb66d('0x17'),_0x4f4e02);_0xda834[_0xb66d('0x17')](_0x4f4e02);}else{logger[_0xb66d('0x19')]('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x151be0,_0x25fcb9||_0xb66d('0x17'));_0xda834[_0xb66d('0x1b')]();}}else{_0xda834[_0xb66d('0x17')]();}}catch(_0x3d18f7){logger['error'](_0xb66d('0x1c'),_0x151be0,_0x3d18f7[_0xb66d('0x11')]);_0xda834['stop']();}}}catch(_0x49f0eb){logger[_0xb66d('0xe')](_0xb66d('0xf'),_0x151be0,JSON['stringify'](_0x49f0eb));_0xda834[_0xb66d('0x1b')]();}};}; \ 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 3dbbce4..79bd1ec 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 _0x20bd=['validate','lodash','routing','number','consequence','length','error','[%s][GOTOP]\x20%s','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x20bd,0xf7));var _0xd20b=function(_0x4d4739,_0x3405fb){_0x4d4739=_0x4d4739-0x0;var _0x2a0ed9=_0x20bd[_0x4d4739];return _0x2a0ed9;};'use strict';var schema=require(_0xd20b('0x0'));var _=require(_0xd20b('0x1'));var logger=require('../../../../config/logger')(_0xd20b('0x2'));var gotop=schema({'priority':{'type':_0xd20b('0x3'),'required':!![],'message':'priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required'}});exports[_0xd20b('0x4')]=function(_0x3b88b9,_0x63bade){return function(_0x1bb094){try{var _0x27397e={'priority':_0x63bade[0x0]};var _0x302888=gotop[_0xd20b('0x0')](_0x27397e,{'typecast':!![]});if(_0x302888[_0xd20b('0x5')]){logger[_0xd20b('0x6')](_0xd20b('0x7'),_0x3b88b9,_['map'](_0x302888,_0xd20b('0x8'))[_0xd20b('0x9')](',\x20'));_0x1bb094[_0xd20b('0xa')]();}else{logger[_0xd20b('0xb')](_0xd20b('0xc'),_0x3b88b9,_0x27397e[_0xd20b('0xd')]);if(_0x27397e[_0xd20b('0xd')]){var _0x30c23b=_['findIndex'](_0x1bb094[_0xd20b('0xe')](),{'p':_0x27397e[_0xd20b('0xd')]});if(_0x30c23b>=0x0){logger[_0xd20b('0xb')](_0xd20b('0xf'),_0x3b88b9,_0x27397e[_0xd20b('0xd')]||_0xd20b('0x10'),_0x30c23b);_0x1bb094[_0xd20b('0x10')](_0x30c23b);}else{logger[_0xd20b('0xb')](_0xd20b('0x11'),_0x3b88b9,_0x27397e[_0xd20b('0xd')]||_0xd20b('0x10'));_0x1bb094[_0xd20b('0xa')]();}}else{_0x1bb094[_0xd20b('0x10')]();}}}catch(_0x58d828){logger[_0xd20b('0x6')](_0xd20b('0x7'),_0x3b88b9,JSON[_0xd20b('0x12')](_0x58d828));_0x1bb094['stop']();}};}; \ No newline at end of file +var _0x8083=['[%s][GOTOP]\x20%s','stringify','validate','lodash','../../../../config/logger','routing','number','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','length','error','join','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','info','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','stop'];(function(_0x35f135,_0x4042dd){var _0x434f7c=function(_0x356573){while(--_0x356573){_0x35f135['push'](_0x35f135['shift']());}};_0x434f7c(++_0x4042dd);}(_0x8083,0x87));var _0x3808=function(_0x11160d,_0x413adc){_0x11160d=_0x11160d-0x0;var _0x21520a=_0x8083[_0x11160d];return _0x21520a;};'use strict';var schema=require(_0x3808('0x0'));var _=require(_0x3808('0x1'));var logger=require(_0x3808('0x2'))(_0x3808('0x3'));var gotop=schema({'priority':{'type':_0x3808('0x4'),'required':!![],'message':_0x3808('0x5')}});exports['consequence']=function(_0x393a09,_0x4d28ee){return function(_0x544774){try{var _0x2987d2={'priority':_0x4d28ee[0x0]};var _0x322061=gotop[_0x3808('0x0')](_0x2987d2,{'typecast':!![]});if(_0x322061[_0x3808('0x6')]){logger[_0x3808('0x7')]('[%s][GOTOP]\x20%s',_0x393a09,_['map'](_0x322061,'message')[_0x3808('0x8')](',\x20'));_0x544774['stop']();}else{logger['info'](_0x3808('0x9'),_0x393a09,_0x2987d2['priority']);if(_0x2987d2[_0x3808('0xa')]){var _0x11e2df=_[_0x3808('0xb')](_0x544774[_0x3808('0xc')](),{'p':_0x2987d2['priority']});if(_0x11e2df>=0x0){logger[_0x3808('0xd')](_0x3808('0xe'),_0x393a09,_0x2987d2[_0x3808('0xa')]||_0x3808('0xf'),_0x11e2df);_0x544774[_0x3808('0xf')](_0x11e2df);}else{logger['info']('[%s][GOTOP]\x20priority\x20%s\x20not\x20found',_0x393a09,_0x2987d2[_0x3808('0xa')]||_0x3808('0xf'));_0x544774[_0x3808('0x10')]();}}else{_0x544774[_0x3808('0xf')]();}}}catch(_0x37cfb4){logger[_0x3808('0x7')](_0x3808('0x11'),_0x393a09,JSON[_0x3808('0x12')](_0x37cfb4));_0x544774['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 75071e6..a968c04 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 _0x5f63=['./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','consequence','contact','channel','chat','ChatWebsiteId','account','upperFirst','InteractionId','interaction','Message','create','then','info','[%s][MESSAGE]\x20%s','body','catch','stringify','stop','error','lodash'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5f63,0x117));var _0x35f6=function(_0x15a037,_0x34f628){_0x15a037=_0x15a037-0x0;var _0x7babe6=_0x5f63[_0x15a037];return _0x7babe6;};'use strict';var _=require(_0x35f6('0x0'));var utils=require(_0x35f6('0x1'));var logger=require(_0x35f6('0x2'))(_0x35f6('0x3'));var rpc={'chatMessage':require(_0x35f6('0x4')),'openchannelMessage':require(_0x35f6('0x5')),'mailMessage':require(_0x35f6('0x6')),'smsMessage':require(_0x35f6('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0x35f6('0x8'))};exports[_0x35f6('0x9')]=function(_0x34f0c2,_0xe63a5b){return function(_0x36101a){try{var _0x2b7ea7={'body':utils['getMustacheRender'](_0xe63a5b[0x0],this),'ContactId':this[_0x35f6('0xa')]['id']};if(this[_0x35f6('0xb')]===_0x35f6('0xc')){_0x2b7ea7[_0x35f6('0xd')]=this[_0x35f6('0xe')]['id'];}else{_0x2b7ea7[_[_0x35f6('0xf')](this[_0x35f6('0xb')])+'AccountId']=this['account']['id'];}_0x2b7ea7[_['upperFirst'](this[_0x35f6('0xb')])+_0x35f6('0x10')]=this[_0x35f6('0x11')]['id'];if(rpc[this['channel']+_0x35f6('0x12')]){return rpc[this[_0x35f6('0xb')]+_0x35f6('0x12')][_0x35f6('0x13')](_0x2b7ea7)[_0x35f6('0x14')](function(_0x3128a1){logger[_0x35f6('0x15')](_0x35f6('0x16'),_0x34f0c2,_0x2b7ea7[_0x35f6('0x17')]);_0x36101a['next']();})[_0x35f6('0x18')](function(_0x12f620){logger['error']('[%s][MESSAGE]\x20%s',_0x34f0c2,JSON[_0x35f6('0x19')](_0x12f620));_0x36101a[_0x35f6('0x1a')]();});}}catch(_0x3f9d6b){logger[_0x35f6('0x1b')]('[%s][MESSAGE]\x20%s',_0x34f0c2,JSON['stringify'](_0x3f9d6b));_0x36101a[_0x35f6('0x1a')]();}};}; \ No newline at end of file +var _0x6f18=['error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','contact','channel','chat','ChatWebsiteId','account','AccountId','upperFirst','InteractionId','interaction','Message','create','then','info','body','next','catch'];(function(_0x523d4e,_0x29a059){var _0x153195=function(_0xd6fae7){while(--_0xd6fae7){_0x523d4e['push'](_0x523d4e['shift']());}};_0x153195(++_0x29a059);}(_0x6f18,0x1b4));var _0x86f1=function(_0x40da38,_0x9f4dbc){_0x40da38=_0x40da38-0x0;var _0x4a3e67=_0x6f18[_0x40da38];return _0x4a3e67;};'use strict';var _=require(_0x86f1('0x0'));var utils=require('./utils');var logger=require(_0x86f1('0x1'))('routing');var rpc={'chatMessage':require(_0x86f1('0x2')),'openchannelMessage':require(_0x86f1('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x86f1('0x4')),'faxMessage':require(_0x86f1('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0x86f1('0x6')]=function(_0x2733f7,_0x3c91dc){return function(_0x15a5e1){try{var _0x403f48={'body':utils['getMustacheRender'](_0x3c91dc[0x0],this),'ContactId':this[_0x86f1('0x7')]['id']};if(this[_0x86f1('0x8')]===_0x86f1('0x9')){_0x403f48[_0x86f1('0xa')]=this[_0x86f1('0xb')]['id'];}else{_0x403f48[_['upperFirst'](this[_0x86f1('0x8')])+_0x86f1('0xc')]=this[_0x86f1('0xb')]['id'];}_0x403f48[_[_0x86f1('0xd')](this[_0x86f1('0x8')])+_0x86f1('0xe')]=this[_0x86f1('0xf')]['id'];if(rpc[this[_0x86f1('0x8')]+'Message']){return rpc[this[_0x86f1('0x8')]+_0x86f1('0x10')][_0x86f1('0x11')](_0x403f48)[_0x86f1('0x12')](function(_0x692342){logger[_0x86f1('0x13')]('[%s][MESSAGE]\x20%s',_0x2733f7,_0x403f48[_0x86f1('0x14')]);_0x15a5e1[_0x86f1('0x15')]();})[_0x86f1('0x16')](function(_0x648502){logger[_0x86f1('0x17')](_0x86f1('0x18'),_0x2733f7,JSON[_0x86f1('0x19')](_0x648502));_0x15a5e1[_0x86f1('0x1a')]();});}}catch(_0x512cde){logger[_0x86f1('0x17')](_0x86f1('0x18'),_0x2733f7,JSON[_0x86f1('0x19')](_0x512cde));_0x15a5e1[_0x86f1('0x1a')]();}};}; \ 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 4a2a4dc..e208016 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 _0xe681=['./utils','../../../../config/logger','routing','consequence','info','[%s][NOOP]\x20%s','error','stringify'];(function(_0x12321d,_0x1cf3bf){var _0x18fec7=function(_0x4b21c9){while(--_0x4b21c9){_0x12321d['push'](_0x12321d['shift']());}};_0x18fec7(++_0x1cf3bf);}(_0xe681,0xf8));var _0x1e68=function(_0x1769f0,_0x10d7dd){_0x1769f0=_0x1769f0-0x0;var _0x4db0a9=_0xe681[_0x1769f0];return _0x4db0a9;};'use strict';var utils=require(_0x1e68('0x0'));var logger=require(_0x1e68('0x1'))(_0x1e68('0x2'));exports[_0x1e68('0x3')]=function(_0x2a8e5f,_0x5bd975){return function(_0x1aba14){try{logger[_0x1e68('0x4')](_0x1e68('0x5'),_0x2a8e5f,utils['getMustacheRender'](_0x5bd975[0x0],this));_0x1aba14['next']();}catch(_0x40a97a){logger[_0x1e68('0x6')](_0x1e68('0x5'),_0x2a8e5f,JSON[_0x1e68('0x7')](_0x40a97a));_0x1aba14['stop']();}};}; \ No newline at end of file +var _0x057c=['routing','consequence','info','getMustacheRender','error','[%s][NOOP]\x20%s','stringify','stop','./utils','../../../../config/logger'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0x057c,0x1ac));var _0xc057=function(_0x460e85,_0x1c0b16){_0x460e85=_0x460e85-0x0;var _0x4f2b12=_0x057c[_0x460e85];return _0x4f2b12;};'use strict';var utils=require(_0xc057('0x0'));var logger=require(_0xc057('0x1'))(_0xc057('0x2'));exports[_0xc057('0x3')]=function(_0x22deb5,_0x2dc95e){return function(_0x29366b){try{logger[_0xc057('0x4')]('[%s][NOOP]\x20%s',_0x22deb5,utils[_0xc057('0x5')](_0x2dc95e[0x0],this));_0x29366b['next']();}catch(_0xde4c0f){logger[_0xc057('0x6')](_0xc057('0x7'),_0x22deb5,JSON[_0xc057('0x8')](_0xde4c0f));_0x29366b[_0xc057('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 4d72a06..e306af7 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 _0x3552=['name','QueueReport','create','error','create\x20queue\x20report','info','[%s][STOP:QUEUE][NAME:%s]','update','[%s][END:QUEUE][NAME:%s]','catch','update\x20queue\x20report','toLowerCase','consequence','validate','[%s][QUEUE]\x20%s','map','join','stop','find','Queues','timeout','createQueue','atimeout','qtimeout','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','next','strategy','rrmemory','beepall','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','redis','defaults','localhost','socket.io-emitter','account','queue','from','joinAt','emit','clone','queue_id','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','MessageId','message','chat','AccountId','WebsiteId','[%s][START:QUEUE][NAME:%s]'];(function(_0x208d75,_0x92d742){var _0x382d27=function(_0x3aaba3){while(--_0x3aaba3){_0x208d75['push'](_0x208d75['shift']());}};_0x382d27(++_0x92d742);}(_0x3552,0x11d));var _0x2355=function(_0x112c7b,_0x1b4980){_0x112c7b=_0x112c7b-0x0;var _0x25c345=_0x3552[_0x112c7b];return _0x25c345;};'use strict';var schema=require('validate');var _=require(_0x2355('0x0'));var util=require(_0x2355('0x1'));var seqqueue=require(_0x2355('0x2'));var moment=require(_0x2355('0x3'));var Redis=require(_0x2355('0x4'));var config=require(_0x2355('0x5'));var logger=require('../../../../config/logger')('routing');var strategy=require('./strategy');config[_0x2355('0x6')]=_[_0x2355('0x7')](config['redis'],{'host':_0x2355('0x8'),'port':0x18eb});var io=require(_0x2355('0x9'))(new Redis(config[_0x2355('0x6')]));var attributes=['id','queue_id',_0x2355('0xa'),_0x2355('0xb'),_0x2355('0xc'),_0x2355('0xd')];function emit(_0x316151,_0x1818c7,_0x2a97e5){io['to'](_0x316151)[_0x2355('0xe')](_0x1818c7,_0x2a97e5);}function emitChannelQueueInteraction(_0x5b3c9d,_0x2e6b5a,_0x575f1d,_0x5ea4d4,_0x5ed750,_0x174fbf,_0x300a48,_0x258953){var _0x40131a=_[_0x2355('0xf')](_0x575f1d);_0x40131a[_0x2355('0x10')]=_0x258953;_0x40131a[_0x2355('0xb')]=_0x2e6b5a;_0x40131a['account']=_0x5ea4d4;_0x40131a['id']=_0x5ed750;if(_0x174fbf){_0x300a48[util[_0x2355('0x11')](_0x2355('0x12'),_0x5b3c9d)][_0x5ed750]=_[_0x2355('0x13')](_0x40131a,attributes);}else{delete _0x300a48[util[_0x2355('0x11')](_0x2355('0x12'),_0x5b3c9d)][_0x5ed750];}emit(util[_0x2355('0x11')](_0x2355('0x14'),_0x5b3c9d,_0x2e6b5a),util['format'](_0x2355('0x15'),_0x5b3c9d,_0x174fbf?_0x2355('0x16'):'remove'),_[_0x2355('0x13')](_0x40131a,attributes));}var rpc={'openchannelQueueReport':require(_0x2355('0x17')),'mailQueueReport':require(_0x2355('0x18')),'chatQueueReport':require(_0x2355('0x19')),'smsQueueReport':require(_0x2355('0x1a')),'faxQueueReport':require('../../rpc/faxQueueReport'),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0x2355('0x1b'),'required':!![],'message':_0x2355('0x1c')},'timeout':{'type':_0x2355('0x1d'),'message':_0x2355('0x1e')}});function startRouting(_0x5b1657,_0x18f581,_0x165490,_0x5bcd7f){if(_0x5b1657&&_0x18f581&&_0x165490){_0x18f581[_0x2355('0x1f')]+=0x1;var _0x1e916d={'uniqueid':_0x5b1657,'from':_0x165490[_0x2355('0x20')]?_0x165490[_0x2355('0x20')][_0x2355('0xc')]:'','joinAt':moment()[_0x2355('0x11')](_0x2355('0x21')),'ContactId':_0x165490[_0x2355('0x22')]?_0x165490[_0x2355('0x22')]['id']:null,'ListId':_0x165490['list']?_0x165490[_0x2355('0x23')]['id']:null};_0x1e916d[_[_0x2355('0x24')](_0x165490[_0x2355('0x25')])+_0x2355('0x26')]=_0x18f581['id']||null;_0x1e916d[_[_0x2355('0x24')](_0x165490['channel'])+_0x2355('0x27')]=_0x165490[_0x2355('0x28')]?_0x165490[_0x2355('0x28')]['id']:null;_0x1e916d[_[_0x2355('0x24')](_0x165490[_0x2355('0x25')])+_0x2355('0x29')]=_0x165490[_0x2355('0x2a')]?_0x165490['message']['id']:null;_0x1e916d[_[_0x2355('0x24')](_0x165490[_0x2355('0x25')])+(_0x165490[_0x2355('0x25')]!==_0x2355('0x2b')?_0x2355('0x2c'):_0x2355('0x2d'))]=_0x165490[_0x2355('0xa')]?_0x165490[_0x2355('0xa')]['id']:null;logger['info'](util[_0x2355('0x11')](_0x2355('0x2e'),_0x5b1657,_0x18f581[_0x2355('0x2f')]));emitChannelQueueInteraction(_0x165490[_0x2355('0x25')],_0x18f581[_0x2355('0x2f')],_0x1e916d,_0x165490[_0x2355('0xa')][_0x2355('0x2f')],_0x165490[_0x2355('0x2a')]['id'],!![],_0x5bcd7f,_0x18f581['id']);if(rpc[_0x165490[_0x2355('0x25')]+_0x2355('0x30')]){return rpc[_0x165490[_0x2355('0x25')]+_0x2355('0x30')][_0x2355('0x31')](_0x1e916d)['catch'](function(_0x5c81e1){logger[_0x2355('0x32')](_0x2355('0x33'));});}}}function stopRouting(_0x77b231,_0x35a191,_0x2689f4,_0x5a0be5){if(_0x77b231&&_0x35a191){_0x35a191[_0x2355('0x1f')]-=0x1;var _0x16f6d5={'leaveAt':moment()[_0x2355('0x11')](_0x2355('0x21')),'acceptAt':moment()['format'](_0x2355('0x21')),'reason':'accepted'};logger[_0x2355('0x34')](util[_0x2355('0x11')](_0x2355('0x35'),_0x77b231,_0x35a191[_0x2355('0x2f')]));emitChannelQueueInteraction(_0x2689f4[_0x2355('0x25')],_0x35a191['name'],_0x2689f4[_0x2355('0x20')],_0x2689f4[_0x2355('0xa')]['name'],_0x2689f4[_0x2355('0x2a')]['id'],![],_0x5a0be5,_0x35a191['id']);if(rpc[_0x2689f4[_0x2355('0x25')]+'QueueReport']){return rpc[_0x2689f4['channel']+_0x2355('0x30')][_0x2355('0x36')](_0x77b231,_0x16f6d5)['catch'](function(_0x82116c){logger[_0x2355('0x32')]('update\x20queue\x20report');});}}}function endRouting(_0x12eb82,_0x2f725b,_0x535fef,_0x300377){if(_0x12eb82&&_0x2f725b){_0x2f725b[_0x2355('0x1f')]-=0x1;var _0x13daa7={'leaveAt':moment()[_0x2355('0x11')](_0x2355('0x21')),'exitAt':moment()[_0x2355('0x11')](_0x2355('0x21')),'reason':'timeout'};logger[_0x2355('0x34')](util[_0x2355('0x11')](_0x2355('0x37'),_0x12eb82,_0x2f725b['name']));emitChannelQueueInteraction(_0x535fef[_0x2355('0x25')],_0x2f725b[_0x2355('0x2f')],_0x535fef['body'],_0x535fef[_0x2355('0xa')][_0x2355('0x2f')],_0x535fef[_0x2355('0x2a')]['id'],![],_0x300377);if(rpc[_0x535fef[_0x2355('0x25')]+_0x2355('0x30')]){return rpc[_0x535fef[_0x2355('0x25')]+_0x2355('0x30')]['update'](_0x12eb82,_0x13daa7)[_0x2355('0x38')](function(_0x4c5a99){logger[_0x2355('0x32')](_0x2355('0x39'));});}}}function handleFindQueue(_0x9ab557){return function(_0x106826){return _0x106826[_0x2355('0x2f')][_0x2355('0x3a')]()===_0x9ab557[_0x2355('0x3a')]();};}exports[_0x2355('0x3b')]=function(_0x325c3f,_0x250707,_0x1fd5c7,_0xebc89c){return function(_0x235dcd){try{var _0x1ffe6d={'name':_0x250707[0x0],'timeout':_0x250707[0x1]};var _0x2d4931=queue[_0x2355('0x3c')](_0x1ffe6d,{'typecast':!![]});if(_0x2d4931['length']){logger[_0x2355('0x32')](_0x2355('0x3d'),_0x325c3f,_[_0x2355('0x3e')](_0x2d4931,_0x2355('0x2a'))[_0x2355('0x3f')](',\x20'));_0x235dcd[_0x2355('0x40')]();}else{var _0x34b006=_[_0x2355('0x41')](_0x1fd5c7[_0xebc89c['channel']+_0x2355('0x42')],handleFindQueue(_0x1ffe6d[_0x2355('0x2f')]));if(_0x34b006){startRouting(_0x325c3f,_0x34b006,_0xebc89c,_0x1fd5c7);var _0x577a62=(_0x34b006['timeout']||0xa)*0x3e8;var _0x4fa667=(_0x1ffe6d[_0x2355('0x43')]||0x14)*0x3e8;var _0x8eb4d7,_0x4ee077;if(_0x577a62>_0x4fa667){_0x4fa667=_0x577a62;}var _0x517daf=seqqueue[_0x2355('0x44')](_0x577a62);_0x517daf['id']=_0x325c3f;_0x517daf[_0x2355('0x45')]=_0x577a62;_0x517daf[_0x2355('0x46')]=_0x4fa667;_0x517daf[_0x2355('0x25')]=_0xebc89c[_0x2355('0x25')];_0x1fd5c7[_0x2355('0x47')][_0x325c3f]['on'](_0x2355('0x48'),function(){logger[_0x2355('0x34')](_0x2355('0x49'),_0x325c3f);stopRouting(_0x325c3f,_0x34b006,_0xebc89c,_0x1fd5c7);clearTimeout(_0x8eb4d7);_0x8eb4d7=undefined;_0x517daf[_0x2355('0x4a')](!![]);if(_0x1fd5c7['rules'][_0x325c3f]){delete _0x1fd5c7[_0x2355('0x47')][_0x325c3f];}_0x235dcd['stop']();});_0x1fd5c7[_0x2355('0x47')][_0x325c3f]['on'](_0x2355('0x4b'),function(){if(_0x1fd5c7[_0x2355('0x47')][_0x325c3f]){delete _0x1fd5c7[_0x2355('0x47')][_0x325c3f];}});_0x8eb4d7=setTimeout(function(){logger[_0x2355('0x34')]('[%s][QUEUE]\x20APPLICATION\x20END',_0x325c3f);endRouting(_0x325c3f,_0x34b006,_0xebc89c,_0x1fd5c7);clearTimeout(_0x8eb4d7);_0x517daf[_0x2355('0x4a')](!![]);_0x235dcd[_0x2355('0x4c')]();},_0x4fa667);switch(_0x34b006[_0x2355('0x4d')]){case _0x2355('0x4e'):strategy[_0x2355('0x4e')](_0x517daf,_0x34b006,_0x1fd5c7,_0xebc89c);break;default:strategy[_0x2355('0x4f')](_0x517daf,_0x34b006,_0x1fd5c7,_0xebc89c);}}else{logger['error'](_0x2355('0x50'),_0x325c3f,_0x1ffe6d[_0x2355('0x2f')]);_0x235dcd['stop']();}}}catch(_0x39ef23){console[_0x2355('0x51')](_0x39ef23);logger['error'](_0x2355('0x3d'),_0x325c3f,_0x39ef23[_0x2355('0x52')]);_0x235dcd[_0x2355('0x40')]();}};}; \ No newline at end of file +var _0xca99=['format','%sQueuesWaitingInteractions','pick','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/mailQueueReport','../../rpc/chatQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','InteractionId','interaction','message','chat','AccountId','WebsiteId','account','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','catch','[%s][STOP:QUEUE][NAME:%s]','timeout','[%s][END:QUEUE][NAME:%s]','error','update\x20queue\x20report','toLowerCase','consequence','length','[%s][QUEUE]\x20%s','map','stop','Queues','createQueue','qtimeout','rules','close','next','strategy','beepall','log','stack','validate','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','routing','redis','localhost','socket.io-emitter','queue_id','queue','from','joinAt','emit','clone'];(function(_0x37301a,_0x5f31c5){var _0x289430=function(_0x1cacaf){while(--_0x1cacaf){_0x37301a['push'](_0x37301a['shift']());}};_0x289430(++_0x5f31c5);}(_0xca99,0xca));var _0x9ca9=function(_0x518fda,_0x57a086){_0x518fda=_0x518fda-0x0;var _0x3027cc=_0xca99[_0x518fda];return _0x3027cc;};'use strict';var schema=require(_0x9ca9('0x0'));var _=require(_0x9ca9('0x1'));var util=require(_0x9ca9('0x2'));var seqqueue=require(_0x9ca9('0x3'));var moment=require(_0x9ca9('0x4'));var Redis=require(_0x9ca9('0x5'));var config=require(_0x9ca9('0x6'));var logger=require('../../../../config/logger')(_0x9ca9('0x7'));var strategy=require('./strategy');config[_0x9ca9('0x8')]=_['defaults'](config[_0x9ca9('0x8')],{'host':_0x9ca9('0x9'),'port':0x18eb});var io=require(_0x9ca9('0xa'))(new Redis(config[_0x9ca9('0x8')]));var attributes=['id',_0x9ca9('0xb'),'account',_0x9ca9('0xc'),_0x9ca9('0xd'),_0x9ca9('0xe')];function emit(_0x46f875,_0x8db379,_0x132c53){io['to'](_0x46f875)[_0x9ca9('0xf')](_0x8db379,_0x132c53);}function emitChannelQueueInteraction(_0x560dfa,_0x2d6a6d,_0x564e89,_0x5d3a98,_0x4ae3c5,_0x1ce6a4,_0x1e027d,_0x1a9861){var _0xc28f04=_[_0x9ca9('0x10')](_0x564e89);_0xc28f04[_0x9ca9('0xb')]=_0x1a9861;_0xc28f04[_0x9ca9('0xc')]=_0x2d6a6d;_0xc28f04['account']=_0x5d3a98;_0xc28f04['id']=_0x4ae3c5;if(_0x1ce6a4){_0x1e027d[util[_0x9ca9('0x11')](_0x9ca9('0x12'),_0x560dfa)][_0x4ae3c5]=_[_0x9ca9('0x13')](_0xc28f04,attributes);}else{delete _0x1e027d[util[_0x9ca9('0x11')]('%sQueuesWaitingInteractions',_0x560dfa)][_0x4ae3c5];}emit(util[_0x9ca9('0x11')]('%s:queue:%s',_0x560dfa,_0x2d6a6d),util['format'](_0x9ca9('0x14'),_0x560dfa,_0x1ce6a4?_0x9ca9('0x15'):_0x9ca9('0x16')),_['pick'](_0xc28f04,attributes));}var rpc={'openchannelQueueReport':require(_0x9ca9('0x17')),'mailQueueReport':require(_0x9ca9('0x18')),'chatQueueReport':require(_0x9ca9('0x19')),'smsQueueReport':require(_0x9ca9('0x1a')),'faxQueueReport':require(_0x9ca9('0x1b')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':'string','required':!![],'message':_0x9ca9('0x1c')},'timeout':{'type':_0x9ca9('0x1d'),'message':_0x9ca9('0x1e')}});function startRouting(_0x1b3f62,_0x595d8f,_0x30aa91,_0x5050c6){if(_0x1b3f62&&_0x595d8f&&_0x30aa91){_0x595d8f[_0x9ca9('0x1f')]+=0x1;var _0x5bdca3={'uniqueid':_0x1b3f62,'from':_0x30aa91['body']?_0x30aa91[_0x9ca9('0x20')][_0x9ca9('0xd')]:'','joinAt':moment()['format'](_0x9ca9('0x21')),'ContactId':_0x30aa91[_0x9ca9('0x22')]?_0x30aa91['contact']['id']:null,'ListId':_0x30aa91[_0x9ca9('0x23')]?_0x30aa91[_0x9ca9('0x23')]['id']:null};_0x5bdca3[_[_0x9ca9('0x24')](_0x30aa91[_0x9ca9('0x25')])+_0x9ca9('0x26')]=_0x595d8f['id']||null;_0x5bdca3[_['upperFirst'](_0x30aa91[_0x9ca9('0x25')])+_0x9ca9('0x27')]=_0x30aa91[_0x9ca9('0x28')]?_0x30aa91['interaction']['id']:null;_0x5bdca3[_[_0x9ca9('0x24')](_0x30aa91['channel'])+'MessageId']=_0x30aa91[_0x9ca9('0x29')]?_0x30aa91[_0x9ca9('0x29')]['id']:null;_0x5bdca3[_[_0x9ca9('0x24')](_0x30aa91[_0x9ca9('0x25')])+(_0x30aa91[_0x9ca9('0x25')]!==_0x9ca9('0x2a')?_0x9ca9('0x2b'):_0x9ca9('0x2c'))]=_0x30aa91[_0x9ca9('0x2d')]?_0x30aa91[_0x9ca9('0x2d')]['id']:null;logger[_0x9ca9('0x2e')](util[_0x9ca9('0x11')](_0x9ca9('0x2f'),_0x1b3f62,_0x595d8f['name']));emitChannelQueueInteraction(_0x30aa91[_0x9ca9('0x25')],_0x595d8f[_0x9ca9('0x30')],_0x5bdca3,_0x30aa91['account'][_0x9ca9('0x30')],_0x30aa91['message']['id'],!![],_0x5050c6,_0x595d8f['id']);if(rpc[_0x30aa91[_0x9ca9('0x25')]+_0x9ca9('0x31')]){return rpc[_0x30aa91['channel']+_0x9ca9('0x31')][_0x9ca9('0x32')](_0x5bdca3)[_0x9ca9('0x33')](function(_0x2497be){logger['error']('create\x20queue\x20report');});}}}function stopRouting(_0x8fb354,_0x2352d2,_0x17dbfe,_0x430a36){if(_0x8fb354&&_0x2352d2){_0x2352d2[_0x9ca9('0x1f')]-=0x1;var _0xb0f6c0={'leaveAt':moment()[_0x9ca9('0x11')](_0x9ca9('0x21')),'acceptAt':moment()['format'](_0x9ca9('0x21')),'reason':'accepted'};logger['info'](util[_0x9ca9('0x11')](_0x9ca9('0x34'),_0x8fb354,_0x2352d2[_0x9ca9('0x30')]));emitChannelQueueInteraction(_0x17dbfe['channel'],_0x2352d2[_0x9ca9('0x30')],_0x17dbfe[_0x9ca9('0x20')],_0x17dbfe[_0x9ca9('0x2d')][_0x9ca9('0x30')],_0x17dbfe['message']['id'],![],_0x430a36,_0x2352d2['id']);if(rpc[_0x17dbfe[_0x9ca9('0x25')]+_0x9ca9('0x31')]){return rpc[_0x17dbfe[_0x9ca9('0x25')]+'QueueReport']['update'](_0x8fb354,_0xb0f6c0)['catch'](function(_0x58668b){logger['error']('update\x20queue\x20report');});}}}function endRouting(_0x4a02a6,_0x4b9ac9,_0x4181e5,_0x3a2733){if(_0x4a02a6&&_0x4b9ac9){_0x4b9ac9['waiting']-=0x1;var _0x5a2635={'leaveAt':moment()[_0x9ca9('0x11')]('YYYY-MM-DD\x20HH:mm:ss'),'exitAt':moment()[_0x9ca9('0x11')](_0x9ca9('0x21')),'reason':_0x9ca9('0x35')};logger['info'](util[_0x9ca9('0x11')](_0x9ca9('0x36'),_0x4a02a6,_0x4b9ac9[_0x9ca9('0x30')]));emitChannelQueueInteraction(_0x4181e5[_0x9ca9('0x25')],_0x4b9ac9[_0x9ca9('0x30')],_0x4181e5[_0x9ca9('0x20')],_0x4181e5['account']['name'],_0x4181e5['message']['id'],![],_0x3a2733);if(rpc[_0x4181e5[_0x9ca9('0x25')]+_0x9ca9('0x31')]){return rpc[_0x4181e5['channel']+'QueueReport']['update'](_0x4a02a6,_0x5a2635)[_0x9ca9('0x33')](function(_0x1e8ff0){logger[_0x9ca9('0x37')](_0x9ca9('0x38'));});}}}function handleFindQueue(_0x287910){return function(_0x4e586f){return _0x4e586f['name'][_0x9ca9('0x39')]()===_0x287910[_0x9ca9('0x39')]();};}exports[_0x9ca9('0x3a')]=function(_0xa1b24e,_0x7c1efe,_0x13379e,_0x54faa6){return function(_0xbc0075){try{var _0x2c0d71={'name':_0x7c1efe[0x0],'timeout':_0x7c1efe[0x1]};var _0x7ba3d4=queue[_0x9ca9('0x0')](_0x2c0d71,{'typecast':!![]});if(_0x7ba3d4[_0x9ca9('0x3b')]){logger['error'](_0x9ca9('0x3c'),_0xa1b24e,_[_0x9ca9('0x3d')](_0x7ba3d4,'message')['join'](',\x20'));_0xbc0075[_0x9ca9('0x3e')]();}else{var _0x43f06a=_['find'](_0x13379e[_0x54faa6[_0x9ca9('0x25')]+_0x9ca9('0x3f')],handleFindQueue(_0x2c0d71[_0x9ca9('0x30')]));if(_0x43f06a){startRouting(_0xa1b24e,_0x43f06a,_0x54faa6,_0x13379e);var _0x4897b8=(_0x43f06a[_0x9ca9('0x35')]||0xa)*0x3e8;var _0xf1443=(_0x2c0d71[_0x9ca9('0x35')]||0x14)*0x3e8;var _0x75faac,_0xa5c96d;if(_0x4897b8>_0xf1443){_0xf1443=_0x4897b8;}var _0x114466=seqqueue[_0x9ca9('0x40')](_0x4897b8);_0x114466['id']=_0xa1b24e;_0x114466['atimeout']=_0x4897b8;_0x114466[_0x9ca9('0x41')]=_0xf1443;_0x114466[_0x9ca9('0x25')]=_0x54faa6[_0x9ca9('0x25')];_0x13379e[_0x9ca9('0x42')][_0xa1b24e]['on']('end',function(){logger['info']('[%s][QUEUE]\x20ROUTING\x20STOPPED',_0xa1b24e);stopRouting(_0xa1b24e,_0x43f06a,_0x54faa6,_0x13379e);clearTimeout(_0x75faac);_0x75faac=undefined;_0x114466[_0x9ca9('0x43')](!![]);if(_0x13379e['rules'][_0xa1b24e]){delete _0x13379e[_0x9ca9('0x42')][_0xa1b24e];}_0xbc0075[_0x9ca9('0x3e')]();});_0x13379e[_0x9ca9('0x42')][_0xa1b24e]['on']('complete',function(){if(_0x13379e[_0x9ca9('0x42')][_0xa1b24e]){delete _0x13379e[_0x9ca9('0x42')][_0xa1b24e];}});_0x75faac=setTimeout(function(){logger[_0x9ca9('0x2e')]('[%s][QUEUE]\x20APPLICATION\x20END',_0xa1b24e);endRouting(_0xa1b24e,_0x43f06a,_0x54faa6,_0x13379e);clearTimeout(_0x75faac);_0x114466[_0x9ca9('0x43')](!![]);_0xbc0075[_0x9ca9('0x44')]();},_0xf1443);switch(_0x43f06a[_0x9ca9('0x45')]){case'rrmemory':strategy['rrmemory'](_0x114466,_0x43f06a,_0x13379e,_0x54faa6);break;default:strategy[_0x9ca9('0x46')](_0x114466,_0x43f06a,_0x13379e,_0x54faa6);}}else{logger[_0x9ca9('0x37')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0xa1b24e,_0x2c0d71[_0x9ca9('0x30')]);_0xbc0075['stop']();}}}catch(_0x40b683){console[_0x9ca9('0x47')](_0x40b683);logger[_0x9ca9('0x37')](_0x9ca9('0x3c'),_0xa1b24e,_0x40b683[_0x9ca9('0x48')]);_0xbc0075[_0x9ca9('0x3e')]();}};}; \ 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 5615716..e32b506 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 _0xbd85=['[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','realtime','handleRun','bind','handleTimeout','drained','prototype','push','handleDrained','info','[%s][AGENT]\x20try\x20with\x20%s','agents','forcedOwnership','isAgentAvailable','channel','busy','busyQueue','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x360fa4,_0x4f613d){var _0x285c35=function(_0x2db46a){while(--_0x2db46a){_0x360fa4['push'](_0x360fa4['shift']());}};_0x285c35(++_0x4f613d);}(_0xbd85,0x187));var _0x5bd8=function(_0x3a2118,_0x31fc3c){_0x3a2118=_0x3a2118-0x0;var _0x1d181d=_0xbd85[_0x3a2118];return _0x1d181d;};'use strict';var _=require(_0x5bd8('0x0'));var uuid=require(_0x5bd8('0x1'));var util=require(_0x5bd8('0x2'));var logger=require(_0x5bd8('0x3'))(_0x5bd8('0x4'));var Agent=function(_0x42fdaa,_0x1e4117,_0x5ba0b9,_0x396958){this[_0x5bd8('0x5')]=uuid['v4']();this[_0x5bd8('0x6')]=_0x42fdaa;this[_0x5bd8('0x7')]=_0x1e4117;this[_0x5bd8('0x8')]=_0x5ba0b9;this[_0x5bd8('0x4')]=_0x396958;this[_0x5bd8('0x6')]['push'](this[_0x5bd8('0x9')][_0x5bd8('0xa')](this),this[_0x5bd8('0xb')][_0x5bd8('0xa')](this));this[_0x5bd8('0x6')]['on']('timeout',this['handleTimeout'][_0x5bd8('0xa')](this));this[_0x5bd8('0x6')]['on'](_0x5bd8('0xc'),this['handleDrained'][_0x5bd8('0xa')](this));};Agent[_0x5bd8('0xd')][_0x5bd8('0xe')]=function(){this[_0x5bd8('0x6')]['push'](this[_0x5bd8('0x9')][_0x5bd8('0xa')](this),this[_0x5bd8('0xb')][_0x5bd8('0xa')](this));};Agent[_0x5bd8('0xd')][_0x5bd8('0xf')]=function(){this['handleTimeout'](!![]);};Agent['prototype'][_0x5bd8('0x9')]=function(_0x517f68){logger[_0x5bd8('0x10')](_0x5bd8('0x11'),this['squeue']['id'],this[_0x5bd8('0x7')]['id']);if(_['isNil'](this[_0x5bd8('0x8')][_0x5bd8('0x12')][this[_0x5bd8('0x7')]['id']])){logger[_0x5bd8('0x10')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0x5bd8('0x6')]['id'],this['agent']['id']);setTimeout(this['push'][_0x5bd8('0xa')](this),0x3e8);}else{if(this[_0x5bd8('0x4')][_0x5bd8('0x13')]||util[_0x5bd8('0x14')](this[_0x5bd8('0x6')]['id'],this[_0x5bd8('0x8')][_0x5bd8('0x12')][this[_0x5bd8('0x7')]['id']],this[_0x5bd8('0x6')][_0x5bd8('0x15')],![])){this[_0x5bd8('0x8')][_0x5bd8('0x12')][this['agent']['id']][_0x5bd8('0x16')]=!![];this['realtime'][_0x5bd8('0x12')][this[_0x5bd8('0x7')]['id']][_0x5bd8('0x17')]=undefined;util[_0x5bd8('0x18')](this[_0x5bd8('0x5')],this[_0x5bd8('0x6')]['id'],this['realtime']['agents'][this[_0x5bd8('0x7')]['id']],null,this[_0x5bd8('0x4')]);util[_0x5bd8('0x19')](this[_0x5bd8('0x6')]['id'],this[_0x5bd8('0x8')][_0x5bd8('0x12')][this[_0x5bd8('0x7')]['id']],_0x5bd8('0x1a')+(this[_0x5bd8('0x4')]['forcedOwnership']?_0x5bd8('0x1b'):''));}else{logger[_0x5bd8('0x10')](_0x5bd8('0x1c'),this['squeue']['id'],this['agent']['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0x5bd8('0xd')][_0x5bd8('0xb')]=function(_0xe0581c){if(_['isNil'](this[_0x5bd8('0x8')][_0x5bd8('0x12')][this['agent']['id']])){return logger['info'](_0x5bd8('0x1d'),this['squeue']['id'],this['agent']['id']);}else{logger[_0x5bd8('0x10')](_0x5bd8('0x1e'),this[_0x5bd8('0x6')]['id'],this['agent']['id']);util[_0x5bd8('0x1f')](this[_0x5bd8('0x5')],this[_0x5bd8('0x6')]['id'],this[_0x5bd8('0x8')]['agents'][this[_0x5bd8('0x7')]['id']],null,this['routing']);this[_0x5bd8('0x8')][_0x5bd8('0x12')][this[_0x5bd8('0x7')]['id']]['busy']=![];this['realtime']['agents'][this[_0x5bd8('0x7')]['id']][_0x5bd8('0x17')]=undefined;util[_0x5bd8('0x19')](this[_0x5bd8('0x6')]['id'],this[_0x5bd8('0x8')]['agents'][this[_0x5bd8('0x7')]['id']],_0xe0581c?_0x5bd8('0x20'):_0x5bd8('0x21'));}if(!_0xe0581c){setTimeout(this[_0x5bd8('0xe')][_0x5bd8('0xa')](this),0x3e8);}};function agent(_0x24516f,_0x2304df,_0x58ebe8,_0x531c40){return new Agent(_0x24516f,_0x2304df,_0x58ebe8,_0x531c40);}module[_0x5bd8('0x22')]=agent; \ No newline at end of file +var _0x9395=['[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','STOP','TIMEOUT','exports','uuid','./util','routing','notificationId','squeue','agent','push','bind','handleTimeout','timeout','handleDrained','prototype','handleRun','[%s][AGENT]\x20try\x20with\x20%s','isNil','realtime','info','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','busy','busyQueue','showNotification','writeLog','forcedOwnership',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available'];(function(_0x3c7e01,_0xd50322){var _0x2756ac=function(_0x424721){while(--_0x424721){_0x3c7e01['push'](_0x3c7e01['shift']());}};_0x2756ac(++_0xd50322);}(_0x9395,0x170));var _0x5939=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x9395[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var uuid=require(_0x5939('0x0'));var util=require(_0x5939('0x1'));var logger=require('../../../../../config/logger')(_0x5939('0x2'));var Agent=function(_0x418d60,_0x16b412,_0x222ce6,_0x49aa68){this[_0x5939('0x3')]=uuid['v4']();this[_0x5939('0x4')]=_0x418d60;this[_0x5939('0x5')]=_0x16b412;this['realtime']=_0x222ce6;this[_0x5939('0x2')]=_0x49aa68;this[_0x5939('0x4')][_0x5939('0x6')](this['handleRun'][_0x5939('0x7')](this),this[_0x5939('0x8')][_0x5939('0x7')](this));this['squeue']['on'](_0x5939('0x9'),this[_0x5939('0x8')][_0x5939('0x7')](this));this[_0x5939('0x4')]['on']('drained',this[_0x5939('0xa')][_0x5939('0x7')](this));};Agent[_0x5939('0xb')][_0x5939('0x6')]=function(){this[_0x5939('0x4')][_0x5939('0x6')](this[_0x5939('0xc')][_0x5939('0x7')](this),this[_0x5939('0x8')][_0x5939('0x7')](this));};Agent[_0x5939('0xb')]['handleDrained']=function(){this[_0x5939('0x8')](!![]);};Agent['prototype']['handleRun']=function(_0x5a56eb){logger['info'](_0x5939('0xd'),this[_0x5939('0x4')]['id'],this[_0x5939('0x5')]['id']);if(_[_0x5939('0xe')](this[_0x5939('0xf')]['agents'][this[_0x5939('0x5')]['id']])){logger[_0x5939('0x10')](_0x5939('0x11'),this[_0x5939('0x4')]['id'],this[_0x5939('0x5')]['id']);setTimeout(this[_0x5939('0x6')][_0x5939('0x7')](this),0x3e8);}else{if(this['routing']['forcedOwnership']||util[_0x5939('0x12')](this[_0x5939('0x4')]['id'],this[_0x5939('0xf')][_0x5939('0x13')][this[_0x5939('0x5')]['id']],this[_0x5939('0x4')][_0x5939('0x14')],![])){this[_0x5939('0xf')][_0x5939('0x13')][this[_0x5939('0x5')]['id']][_0x5939('0x15')]=!![];this[_0x5939('0xf')][_0x5939('0x13')][this[_0x5939('0x5')]['id']][_0x5939('0x16')]=undefined;util[_0x5939('0x17')](this[_0x5939('0x3')],this[_0x5939('0x4')]['id'],this[_0x5939('0xf')]['agents'][this[_0x5939('0x5')]['id']],null,this[_0x5939('0x2')]);util[_0x5939('0x18')](this[_0x5939('0x4')]['id'],this[_0x5939('0xf')][_0x5939('0x13')][this['agent']['id']],'RINGING'+(this['routing'][_0x5939('0x19')]?_0x5939('0x1a'):''));}else{logger['info'](_0x5939('0x1b'),this['squeue']['id'],this[_0x5939('0x5')]['id']);setTimeout(this['push'][_0x5939('0x7')](this),0x3e8);}}};Agent[_0x5939('0xb')]['handleTimeout']=function(_0x5b2b36){if(_[_0x5939('0xe')](this[_0x5939('0xf')]['agents'][this[_0x5939('0x5')]['id']])){return logger['info'](_0x5939('0x11'),this[_0x5939('0x4')]['id'],this[_0x5939('0x5')]['id']);}else{logger[_0x5939('0x10')](_0x5939('0x1c'),this[_0x5939('0x4')]['id'],this[_0x5939('0x5')]['id']);util[_0x5939('0x1d')](this['notificationId'],this[_0x5939('0x4')]['id'],this[_0x5939('0xf')][_0x5939('0x13')][this[_0x5939('0x5')]['id']],null,this[_0x5939('0x2')]);this[_0x5939('0xf')]['agents'][this['agent']['id']]['busy']=![];this[_0x5939('0xf')][_0x5939('0x13')][this[_0x5939('0x5')]['id']][_0x5939('0x16')]=undefined;util['writeLog'](this[_0x5939('0x4')]['id'],this[_0x5939('0xf')][_0x5939('0x13')][this[_0x5939('0x5')]['id']],_0x5b2b36?_0x5939('0x1e'):_0x5939('0x1f'));}if(!_0x5b2b36){setTimeout(this[_0x5939('0x6')][_0x5939('0x7')](this),0x3e8);}};function agent(_0x91ee9f,_0x179d69,_0x436d00,_0x5f5a87){return new Agent(_0x91ee9f,_0x179d69,_0x436d00,_0x5f5a87);}module[_0x5939('0x20')]=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 96b7fcf..725e4da 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 _0x36b2=['length','hideNotification','STOP','TIMEOUT','exports','lodash','uuid','./util','routing','notificationId','queue','realtime','squeue','push','handleRun','handleTimeout','bind','timeout','drained','prototype','handleDrained','isNil','Agents','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','isAgentAvailable','agents','channel','writeLog','busyQueue','name','showNotification','info','[%s][QUEUE]\x20ALL\x20AGENTS\x20ARE\x20BUSY','[%s][QUEUE]\x20EMPTY'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x36b2,0x6b));var _0x236b=function(_0x4867c2,_0x3a306d){_0x4867c2=_0x4867c2-0x0;var _0x29791c=_0x36b2[_0x4867c2];return _0x29791c;};'use strict';var _=require(_0x236b('0x0'));var uuid=require(_0x236b('0x1'));var util=require(_0x236b('0x2'));var logger=require('../../../../../config/logger')(_0x236b('0x3'));var Beepall=function(_0x2aa6b5,_0x45d0d4,_0x55cbf4,_0x1dc22b){this[_0x236b('0x4')]=uuid['v4']();this['squeue']=_0x2aa6b5;this[_0x236b('0x5')]=_0x45d0d4;this[_0x236b('0x6')]=_0x55cbf4;this[_0x236b('0x3')]=_0x1dc22b;this[_0x236b('0x7')][_0x236b('0x8')](this[_0x236b('0x9')]['bind'](this),this[_0x236b('0xa')][_0x236b('0xb')](this));this[_0x236b('0x7')]['on'](_0x236b('0xc'),this['handleTimeout'][_0x236b('0xb')](this));this[_0x236b('0x7')]['on'](_0x236b('0xd'),this['handleDrained'][_0x236b('0xb')](this));};Beepall[_0x236b('0xe')][_0x236b('0x8')]=function(){this['squeue'][_0x236b('0x8')](this['handleRun']['bind'](this),this[_0x236b('0xa')]['bind'](this));};Beepall[_0x236b('0xe')][_0x236b('0xf')]=function(_0x1d79c6){this[_0x236b('0xa')](!![]);};Beepall[_0x236b('0xe')][_0x236b('0x9')]=function(_0x2c38b8){var _0x54ed95=!![];if(!_['isNil'](this[_0x236b('0x5')])&&!_[_0x236b('0x10')](this[_0x236b('0x5')][_0x236b('0x11')])&&this[_0x236b('0x5')]['Agents']['length']>0x0){for(var _0xab13f4=0x0,_0x5f4243;_0xab13f40x0){for(var _0x238b98=0x0,_0x2c3cb2;_0x238b980x0&&_0x2c0c21[_0x5e70ec+_0x75d1('0x25')]>=_0x2c0c21[_0x5e70ec+'Capacity']){writeLog(_0x526f6c,_0x2c0c21,_0x5e70ec['toUpperCase']()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x75d1('0x26')]=function(_0x30d9f3,_0x45c182,_0x468bf0,_0x38653d,_0x519ceb){return sendNotification(!![],_0x30d9f3,_0x45c182,_0x468bf0,_0x38653d,_0x519ceb);};exports['hideNotification']=function(_0x410e16,_0x197f52,_0x4967b5,_0x2408b6,_0x5aa4fa){return sendNotification(![],_0x410e16,_0x197f52,_0x4967b5,_0x2408b6,_0x5aa4fa);};exports[_0x75d1('0x27')]=writeLog; \ No newline at end of file +var _0x3831=['busy','BUSY','online','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','\x20MAXCAPACITY','showNotification','hideNotification','writeLog','lodash','../utils','mustache','ioredis','../../../../../config/environment','../../../../../config/logger','redis','emit','user:%s','name','user:save','split','\x20interaction','notificationSound','account','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error','[%s][QUEUE]\x20%s','format','save','remove','info','[%s][QUEUE][AGENT:%s][STATUS:%s]'];(function(_0x333604,_0x402816){var _0x10258d=function(_0x6196f5){while(--_0x6196f5){_0x333604['push'](_0x333604['shift']());}};_0x10258d(++_0x402816);}(_0x3831,0x14c));var _0x1383=function(_0x47c038,_0x1f7096){_0x47c038=_0x47c038-0x0;var _0x1e0f88=_0x3831[_0x47c038];return _0x1e0f88;};'use strict';var _=require(_0x1383('0x0'));var util=require('util');var utils=require(_0x1383('0x1'));var Mustache=require(_0x1383('0x2'));var Redis=require(_0x1383('0x3'));var config=require(_0x1383('0x4'));var logger=require(_0x1383('0x5'))('routing');config[_0x1383('0x6')]=_['defaults'](config[_0x1383('0x6')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function emit(_0x45a030,_0x5a6ba0,_0x187027){io['to'](_0x45a030)[_0x1383('0x7')](_0x5a6ba0,_0x187027);}function sendNotification(_0x2e9a5b,_0x266bde,_0xd6be3b,_0x7cb670,_0x3ca0e6,_0xe0ee2f){io['to'](util['format'](_0x1383('0x8'),_0x7cb670[_0x1383('0x9')]))[_0x1383('0x7')](_0x1383('0xa'),_0x7cb670);var _0x3675cb=_0xe0ee2f||{};var _0x5d5ee2=_0xd6be3b[_0x1383('0xb')]('.');var _0xbc12ea={'uniqueid':_0x266bde,'channel':_0x5d5ee2[0x0],'id':_0x5d5ee2[0x1],'title':_0x5d5ee2[0x0]+_0x1383('0xc'),'interactionId':_0x5d5ee2[0x2],'queue':_0x3ca0e6?_0x3ca0e6['name']:null,'sound':_0x3675cb['account'][_0x1383('0xd')],'shake':_0x3675cb[_0x1383('0xe')][_0x1383('0xf')]};try{if(!_0x3675cb[_0x1383('0x10')]){_0x3675cb[_0x1383('0x10')]={};}if(_0x3ca0e6){_0x3675cb[_0x1383('0x10')][_0x1383('0x11')]=_0x3ca0e6;}else if(_0x3675cb[_0x1383('0x10')]['queue']){delete _0x3675cb[_0x1383('0x10')][_0x1383('0x11')];}_0xbc12ea[_0x1383('0x12')]=utils[_0x1383('0x13')](_0x3675cb[_0x1383('0xe')][_0x1383('0x14')],_0x3675cb);}catch(_0x49fa65){_0xbc12ea['msg']='I\x20can\x27t\x20render\x20your\x20template';logger[_0x1383('0x15')](util['format'](_0x1383('0x16'),_0x266bde,_0x49fa65['message']));}io['to'](util['format']('user:%s',_0x7cb670[_0x1383('0x9')]))['emit'](util[_0x1383('0x17')]('notification:%s',_0x2e9a5b?_0x1383('0x18'):_0x1383('0x19')),_0xbc12ea);}function writeLog(_0xca314,_0x39884b,_0x32fb05){return logger[_0x1383('0x1a')](util[_0x1383('0x17')](_0x1383('0x1b'),_0xca314,_0x39884b[_0x1383('0x9')],_0x32fb05));}exports['isAgentAvailable']=function(_0x1aa695,_0x24f914,_0x39fea2,_0x241c3d){if(_0x24f914[_0x1383('0x1c')]){writeLog(_0x1aa695,_0x24f914,_0x1383('0x1d'));return![];}if(!_0x24f914[_0x1383('0x1e')]){writeLog(_0x1aa695,_0x24f914,'OFFLINE');return![];}if(_0x24f914[_0x39fea2+'Pause']){writeLog(_0x1aa695,_0x24f914,_0x1383('0x1f'));return![];}if(_0x241c3d&&_0x24f914[_0x1383('0x20')](_0x39fea2+_0x1383('0x21'))&&_0x24f914[_0x1383('0x20')](_0x39fea2+_0x1383('0x22'))){if(_0x24f914[_0x39fea2+'Capacity']>0x0&&_0x24f914[_0x39fea2+'CurrentCapacity']>=_0x24f914[_0x39fea2+'Capacity']){writeLog(_0x1aa695,_0x24f914,_0x39fea2[_0x1383('0x23')]()+_0x1383('0x24'));return![];}}return!![];};exports[_0x1383('0x25')]=function(_0x263aea,_0x5866a1,_0x1f7688,_0x4ac2d4,_0x3c788b){return sendNotification(!![],_0x263aea,_0x5866a1,_0x1f7688,_0x4ac2d4,_0x3c788b);};exports[_0x1383('0x26')]=function(_0x42d63f,_0x23e541,_0x3357e9,_0x15a3c4,_0x37a768){return sendNotification(![],_0x42d63f,_0x23e541,_0x3357e9,_0x15a3c4,_0x37a768);};exports[_0x1383('0x27')]=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 517d036..4771e02 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 _0x5e90=['map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','getMustacheRender','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s'];(function(_0x3f8fa7,_0x5387ca){var _0x3f80e9=function(_0x282ae0){while(--_0x282ae0){_0x3f8fa7['push'](_0x3f8fa7['shift']());}};_0x3f80e9(++_0x5387ca);}(_0x5e90,0x12e));var _0x05e9=function(_0x412ac2,_0x2b8c18){_0x412ac2=_0x412ac2-0x0;var _0x548c79=_0x5e90[_0x412ac2];return _0x548c79;};'use strict';var schema=require('validate');var sh=require(_0x05e9('0x0'));var _=require(_0x05e9('0x1'));var utils=require(_0x05e9('0x2'));var logger=require('../../../../config/logger')(_0x05e9('0x3'));var system=schema({'command':{'type':_0x05e9('0x4'),'required':!![],'message':_0x05e9('0x5')}});exports[_0x05e9('0x6')]=function(_0x2faf19,_0x52b382){return function(_0x5ad3f4){try{var _0x43ddbd={'command':_0x52b382[0x0]};var _0x4df0b5=system['validate'](_0x43ddbd,{'typecast':!![]});if(_0x4df0b5[_0x05e9('0x7')]){logger[_0x05e9('0x8')](_0x05e9('0x9'),_0x2faf19,_[_0x05e9('0xa')](_0x4df0b5,'message')[_0x05e9('0xb')](',\x20'));logger[_0x05e9('0xc')](_0x05e9('0xd'),_0x2faf19);_0x5ad3f4[_0x05e9('0xe')]();}else{var _0xbe23d8=this;var _0x446eea=utils[_0x05e9('0xf')](_0x52b382[0x0],this);logger[_0x05e9('0xc')](_0x05e9('0x10'),_0x2faf19,_0x446eea);sh[_0x05e9('0x11')](_[_0x05e9('0x12')](_0x446eea),function(_0x308d61,_0x478649){logger[_0x05e9('0xc')](_0x05e9('0x13'),_0x2faf19,_0x308d61);if(_0x308d61==0x0){var _0x54b0d6=_0x478649['replace'](/(\r\n|\n|\r)/gm,'');if(_[_0x05e9('0x14')](_0x52b382[0x1])||_[_0x05e9('0x15')](_0x52b382[0x1])){logger[_0x05e9('0xc')]('[%s][SYSTEM]\x20no\x20variable',_0x2faf19);_0xbe23d8[_0x05e9('0x16')][_0x52b382[0x1]]=_0x54b0d6;}else{logger[_0x05e9('0xc')](_0x05e9('0x17'),_0x2faf19,_0x52b382[0x1],_0x54b0d6);_0xbe23d8[_0x05e9('0x16')][_0x52b382[0x1]]=_0x54b0d6;}}_0x5ad3f4[_0x05e9('0xe')]();});}}catch(_0x5d3b4b){logger[_0x05e9('0x8')](_0x05e9('0x9'),_0x2faf19,_[_0x05e9('0x18')](_0x5d3b4b)?JSON[_0x05e9('0x19')](_0x5d3b4b):_0x5d3b4b);logger[_0x05e9('0xc')](_0x05e9('0xd'),_0x2faf19);_0x5ad3f4[_0x05e9('0xe')]();}};}; \ No newline at end of file +var _0x8627=['[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','lodash','./utils','../../../../config/logger','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','validate','length','error','[%s][SYSTEM]\x20%s','map','join','info','next','exec','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isNil','isEmpty','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify'];(function(_0x1b8fcc,_0x4167d9){var _0x5eb893=function(_0x153037){while(--_0x153037){_0x1b8fcc['push'](_0x1b8fcc['shift']());}};_0x5eb893(++_0x4167d9);}(_0x8627,0xd1));var _0x7862=function(_0x3655a4,_0x5afc3f){_0x3655a4=_0x3655a4-0x0;var _0x321f8f=_0x8627[_0x3655a4];return _0x321f8f;};'use strict';var schema=require('validate');var sh=require('shelljs');var _=require(_0x7862('0x0'));var utils=require(_0x7862('0x1'));var logger=require(_0x7862('0x2'))(_0x7862('0x3'));var system=schema({'command':{'type':_0x7862('0x4'),'required':!![],'message':_0x7862('0x5')}});exports[_0x7862('0x6')]=function(_0x27771a,_0x4718ec){return function(_0x3468f5){try{var _0x53eb1b={'command':_0x4718ec[0x0]};var _0x1966f9=system[_0x7862('0x7')](_0x53eb1b,{'typecast':!![]});if(_0x1966f9[_0x7862('0x8')]){logger[_0x7862('0x9')](_0x7862('0xa'),_0x27771a,_[_0x7862('0xb')](_0x1966f9,'message')[_0x7862('0xc')](',\x20'));logger[_0x7862('0xd')]('[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next',_0x27771a);_0x3468f5[_0x7862('0xe')]();}else{var _0x235845=this;var _0x4faaf2=utils['getMustacheRender'](_0x4718ec[0x0],this);logger[_0x7862('0xd')]('[%s][SYSTEM]\x20commnad:\x20%s',_0x27771a,_0x4faaf2);sh[_0x7862('0xf')](_[_0x7862('0x10')](_0x4faaf2),function(_0x5689bd,_0x5b9137){logger[_0x7862('0xd')](_0x7862('0x11'),_0x27771a,_0x5689bd);if(_0x5689bd==0x0){var _0x567fcf=_0x5b9137[_0x7862('0x12')](/(\r\n|\n|\r)/gm,'');if(_[_0x7862('0x13')](_0x4718ec[0x1])||_[_0x7862('0x14')](_0x4718ec[0x1])){logger[_0x7862('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x27771a);_0x235845[_0x7862('0x15')][_0x4718ec[0x1]]=_0x567fcf;}else{logger[_0x7862('0xd')](_0x7862('0x16'),_0x27771a,_0x4718ec[0x1],_0x567fcf);_0x235845[_0x7862('0x15')][_0x4718ec[0x1]]=_0x567fcf;}}_0x3468f5['next']();});}}catch(_0x1e5b7f){logger[_0x7862('0x9')](_0x7862('0xa'),_0x27771a,_[_0x7862('0x17')](_0x1e5b7f)?JSON[_0x7862('0x18')](_0x1e5b7f):_0x1e5b7f);logger[_0x7862('0xd')](_0x7862('0x19'),_0x27771a);_0x3468f5[_0x7862('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 2d04d81..2d46959 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 _0x5ea8=['interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','finally','error','[%s][TAG]\x20%s','isObject','stringify','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','consequence','validate','length','join','info','next','channel','Interaction','addTags'];(function(_0x3c3fde,_0x190444){var _0x155dc7=function(_0x35cfea){while(--_0x35cfea){_0x3c3fde['push'](_0x3c3fde['shift']());}};_0x155dc7(++_0x190444);}(_0x5ea8,0xda));var _0x85ea=function(_0x1c4ea8,_0x242d2){_0x1c4ea8=_0x1c4ea8-0x0;var _0x42a768=_0x5ea8[_0x1c4ea8];return _0x42a768;};'use strict';var schema=require('validate');var _=require(_0x85ea('0x0'));var rpc={'chatInteraction':require(_0x85ea('0x1')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x85ea('0x2')),'mailInteraction':require(_0x85ea('0x3')),'faxInteraction':require(_0x85ea('0x4')),'whatsappInteraction':require(_0x85ea('0x5'))};var logger=require(_0x85ea('0x6'))('routing');var tag=schema({'tag':{'type':'number','required':!![],'message':'TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required'}});exports[_0x85ea('0x7')]=function(_0x369d15,_0x23e711,_0xb31cac,_0x4cf89a){return function(_0x4852b5){try{var _0x1c9641={'tag':_0x23e711[0x0]};var _0x1832f9=tag[_0x85ea('0x8')](_0x1c9641,{'typecast':!![]});if(_0x1832f9[_0x85ea('0x9')]){logger['error']('[%s][TAG]\x20%s',_0x369d15,_['map'](_0x1832f9,'message')[_0x85ea('0xa')](',\x20'));logger[_0x85ea('0xb')]('[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next',_0x369d15);_0x4852b5[_0x85ea('0xc')]();}else{var _0x1f6323={'ids':[_0x23e711[0x0]]};if(rpc[_0x4cf89a[_0x85ea('0xd')]+_0x85ea('0xe')]){rpc[_0x4cf89a[_0x85ea('0xd')]+_0x85ea('0xe')][_0x85ea('0xf')](_0x4cf89a[_0x85ea('0x10')]['id'],_0x1f6323)[_0x85ea('0x11')](function(_0x1c0c80){logger[_0x85ea('0xb')](_0x85ea('0x12'),_0x369d15,_0x23e711[0x1],_0x4cf89a[_0x85ea('0xd')],_0x4cf89a[_0x85ea('0x10')]['id']);})[_0x85ea('0x13')](function(_0x3dd24a){logger['error']('[%s][TAG]\x20%s',_0x369d15,JSON['stringify'](_0x3dd24a));logger[_0x85ea('0xb')](_0x85ea('0x14'),_0x369d15);})[_0x85ea('0x15')](function(){_0x4852b5[_0x85ea('0xc')]();});}}}catch(_0x4540d9){logger[_0x85ea('0x16')](_0x85ea('0x17'),_0x369d15,_[_0x85ea('0x18')](_0x4540d9)?JSON[_0x85ea('0x19')](_0x4540d9):_0x4540d9);logger[_0x85ea('0xb')](_0x85ea('0x14'),_0x369d15);_0x4852b5[_0x85ea('0xc')]();}};}; \ No newline at end of file +var _0x29e1=['map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','next','channel','Interaction','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','stringify','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../../../config/logger','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','error','[%s][TAG]\x20%s'];(function(_0x152405,_0x5e8952){var _0x46647a=function(_0x4608b5){while(--_0x4608b5){_0x152405['push'](_0x152405['shift']());}};_0x46647a(++_0x5e8952);}(_0x29e1,0x11d));var _0x129e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29e1[_0x3dd15e];return _0x231fd0;};'use strict';var schema=require(_0x129e('0x0'));var _=require(_0x129e('0x1'));var rpc={'chatInteraction':require(_0x129e('0x2')),'openchannelInteraction':require(_0x129e('0x3')),'smsInteraction':require(_0x129e('0x4')),'mailInteraction':require(_0x129e('0x5')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var logger=require(_0x129e('0x6'))('routing');var tag=schema({'tag':{'type':_0x129e('0x7'),'required':!![],'message':_0x129e('0x8')}});exports[_0x129e('0x9')]=function(_0x2ce4ef,_0x447074,_0xd88bf3,_0x8b5d0c){return function(_0x427345){try{var _0x2e5520={'tag':_0x447074[0x0]};var _0x443257=tag['validate'](_0x2e5520,{'typecast':!![]});if(_0x443257['length']){logger[_0x129e('0xa')](_0x129e('0xb'),_0x2ce4ef,_[_0x129e('0xc')](_0x443257,_0x129e('0xd'))[_0x129e('0xe')](',\x20'));logger[_0x129e('0xf')](_0x129e('0x10'),_0x2ce4ef);_0x427345[_0x129e('0x11')]();}else{var _0x3d157c={'ids':[_0x447074[0x0]]};if(rpc[_0x8b5d0c[_0x129e('0x12')]+_0x129e('0x13')]){rpc[_0x8b5d0c[_0x129e('0x12')]+_0x129e('0x13')][_0x129e('0x14')](_0x8b5d0c[_0x129e('0x15')]['id'],_0x3d157c)[_0x129e('0x16')](function(_0x50024c){logger[_0x129e('0xf')](_0x129e('0x17'),_0x2ce4ef,_0x447074[0x1],_0x8b5d0c['channel'],_0x8b5d0c[_0x129e('0x15')]['id']);})[_0x129e('0x18')](function(_0x3ba056){logger[_0x129e('0xa')]('[%s][TAG]\x20%s',_0x2ce4ef,JSON[_0x129e('0x19')](_0x3ba056));logger[_0x129e('0xf')](_0x129e('0x10'),_0x2ce4ef);})['finally'](function(){_0x427345[_0x129e('0x11')]();});}}}catch(_0x4d944a){logger[_0x129e('0xa')](_0x129e('0xb'),_0x2ce4ef,_[_0x129e('0x1a')](_0x4d944a)?JSON[_0x129e('0x19')](_0x4d944a):_0x4d944a);logger[_0x129e('0xf')](_0x129e('0x10'),_0x2ce4ef);_0x427345[_0x129e('0x11')]();}};}; \ 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 e2ee3e7..f0c2879 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 _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x6769c9,_0x2353a2){var _0x683e2a=function(_0x567044){while(--_0x567044){_0x6769c9['push'](_0x6769c9['shift']());}};_0x683e2a(++_0x2353a2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1cfa0d,_0x4391f2){_0x1cfa0d=_0x1cfa0d-0x0;var _0xe33279=_0xa9e0[_0x1cfa0d];return _0xe33279;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file +var _0xa9e0=['message','account','interaction','mustache','lodash','exports','render','body','contact'];(function(_0x3640b6,_0x1383de){var _0x45f099=function(_0x46e2e4){while(--_0x46e2e4){_0x3640b6['push'](_0x3640b6['shift']());}};_0x45f099(++_0x1383de);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0xa9e0[_0x5b561d];return _0x431060;};'use strict';var Mustache=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'getMustacheRender':function(_0x5dd881,_0x550fbc){return Mustache[_0x0a9e('0x3')](_0x5dd881,_['merge'](_0x550fbc[_0x0a9e('0x4')],{'contact':_0x550fbc[_0x0a9e('0x5')],'message':_0x550fbc[_0x0a9e('0x6')],'account':_0x550fbc[_0x0a9e('0x7')],'interaction':_0x550fbc[_0x0a9e('0x8')],'list':_0x550fbc['list']}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 1a01109..6829c78 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 _0x5590=['applications','length','existsSync','join','app','.js','toLowerCase','autoreply','appdata','split','mail','push','slice','dialogflow','amazonlex','tag','TagId','%s:%s:%s','./interval','condition','consequence','priority','info','Push\x20new\x20rule','intervals','\x20|\x20','Please\x20create\x20a\x20new\x20file\x20under','rules','execute','stringify','matchPath','complete','No\x20applications\x20to\x20execute','stack','error','routing\x20is\x20empty','agent','agents','busy','end','QueueReport','update','UserId','catch','message\x20is\x20empty','emit','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','agent\x20not\x20found','values','chatQueues','loggedIn','name','mailQueues','available','paused','waiting','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','util','jayson/promise','bluebird','uuid','routing','../rpc/openchannelQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','interval','listen','channel','message','interaction'];(function(_0x51b698,_0x2fd161){var _0xfa0590=function(_0x3741ce){while(--_0x3741ce){_0x51b698['push'](_0x51b698['shift']());}};_0xfa0590(++_0x2fd161);}(_0x5590,0x160));var _0x0559=function(_0x38442e,_0x3f8649){_0x38442e=_0x38442e-0x0;var _0x529e1c=_0x5590[_0x38442e];return _0x529e1c;};'use strict';var _=require('lodash');var util=require(_0x0559('0x0'));var path=require('path');var fs=require('fs');var jayson=require(_0x0559('0x1'));var BPromise=require(_0x0559('0x2'));var uuid=require(_0x0559('0x3'));var config=require('../../../config/environment');var logger=require('../../../config/logger')(_0x0559('0x4'));var rpc={'openchannelQueueReport':require(_0x0559('0x5')),'mailQueueReport':require('../rpc/mailQueueReport'),'chatQueueReport':require(_0x0559('0x6')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0x0559('0x7')),'whatsappQueueReport':require(_0x0559('0x8'))};var RuleEngine=require(_0x0559('0x9'));function getId(_0x21c6fb,_0xc2b9f3,_0x880cc7){return util[_0x0559('0xa')](_0x0559('0xb'),_0x21c6fb,_0xc2b9f3||0x0,_0x880cc7||0x0);}function getIntervals(_0x4c2d73,_0x47df0d){var _0x55f02e=[];if(!_[_0x0559('0xc')](_0x47df0d[_0x0559('0xd')])&&!_[_0x0559('0xc')](_0x4c2d73[_0x47df0d[_0x0559('0xd')]])&&!_['isNil'](_0x4c2d73[_0x47df0d[_0x0559('0xd')]][_0x0559('0xe')])){_0x55f02e=_['map'](_0x4c2d73[_0x47df0d[_0x0559('0xd')]]['Intervals'],_0x0559('0xf'));}else if(!_[_0x0559('0xc')](_0x47df0d[_0x0559('0xf')])){_0x55f02e=[_0x47df0d[_0x0559('0xf')]];}return _0x55f02e;}exports[_0x0559('0x10')]=function(_0x3319ef){_0x3319ef['rules']={};return new BPromise(function(_0x2fe455,_0x2d8836){var _0x568302={'Start':function(_0x4b595e){var _0x205610=this;return new Promise(function(_0x5193c8,_0x22fc67){if(_0x4b595e){try{var _0x55e8df=[];var _0x47cec1=getId(_0x4b595e[_0x0559('0x11')],_0x4b595e[_0x0559('0x12')]?_0x4b595e['message']['id']:0x0,_0x4b595e['interaction']?_0x4b595e[_0x0559('0x13')]['id']:0x0);if(_0x4b595e[_0x0559('0x14')]&&_['isArray'](_0x4b595e[_0x0559('0x14')])&&_0x4b595e['applications'][_0x0559('0x15')]){for(var _0xe824d7=0x0;_0xe824d7<_0x4b595e[_0x0559('0x14')][_0x0559('0x15')];_0xe824d7+=0x1){var _0xec3ff6=_0x4b595e[_0x0559('0x14')][_0xe824d7];if(fs[_0x0559('0x16')](path[_0x0559('0x17')](__dirname,_0x0559('0x14'),_0xec3ff6[_0x0559('0x18')]+_0x0559('0x19')))){var _0x1cee2d=[];switch(_0xec3ff6[_0x0559('0x18')][_0x0559('0x1a')]()){case _0x0559('0x1b'):var _0x2c1277=_0xec3ff6[_0x0559('0x1c')][_0x0559('0x1d')](',');if(_0x4b595e[_0x0559('0x11')]===_0x0559('0x1e')){_0x1cee2d['push'](_0x2c1277[0x0]);_0x1cee2d[_0x0559('0x1f')](_0x2c1277[0x1]);_0x1cee2d['push'](_0x2c1277[_0x0559('0x20')](0x2,_0x2c1277['length'])[_0x0559('0x17')](','));}else{_0x1cee2d[_0x0559('0x1f')](_0x2c1277[0x0]);_0x1cee2d[_0x0559('0x1f')](_0x2c1277['slice'](0x1,_0x2c1277['length'])[_0x0559('0x17')](','));}break;case _0x0559('0x21'):var _0x41ff57=_0xec3ff6[_0x0559('0x1c')][_0x0559('0x1d')](',');_0x1cee2d[_0x0559('0x1f')](_0x41ff57[0x0]);_0x1cee2d[_0x0559('0x1f')](_0x41ff57[0x1]);_0x1cee2d['push'](_0x41ff57['slice'](0x2,_0x41ff57[_0x0559('0x15')])[_0x0559('0x17')](','));break;case'dialogflowv2':var _0x362d57=_0xec3ff6[_0x0559('0x1c')][_0x0559('0x1d')](',');_0x1cee2d['push'](_0x362d57[0x0]);_0x1cee2d['push'](_0x362d57[0x1]);_0x1cee2d['push'](_0x362d57[0x2]);_0x1cee2d[_0x0559('0x1f')](_0x362d57[0x3]);_0x1cee2d[_0x0559('0x1f')](_0x362d57['slice'](0x4,_0x362d57[_0x0559('0x15')])[_0x0559('0x17')](','));break;case _0x0559('0x22'):var _0x23366e=_0xec3ff6[_0x0559('0x1c')]['split'](',');_0x1cee2d[_0x0559('0x1f')](_0x23366e[0x0]);_0x1cee2d[_0x0559('0x1f')](_0x23366e[0x1]);_0x1cee2d[_0x0559('0x1f')](_0x23366e[0x2]);_0x1cee2d[_0x0559('0x1f')](_0x23366e[0x3]);_0x1cee2d[_0x0559('0x1f')](_0x23366e['slice'](0x4,_0x23366e[_0x0559('0x15')])[_0x0559('0x17')](','));break;case _0x0559('0x12'):_0x1cee2d[_0x0559('0x1f')](_0xec3ff6[_0x0559('0x1c')]);break;case _0x0559('0x23'):_0x1cee2d[_0x0559('0x1f')](_0xec3ff6[_0x0559('0x24')]);_0x1cee2d['push'](_0xec3ff6['appdata']);break;default:_0x1cee2d=_[_0x0559('0xc')](_0xec3ff6[_0x0559('0x1c')])?[]:_0xec3ff6[_0x0559('0x1c')][_0x0559('0x1d')](',');}var _0x1086d9={'id':util[_0x0559('0xa')](_0x0559('0x25'),_0x47cec1,_0xec3ff6['id'],_0xec3ff6['app']),'condition':require(_0x0559('0x26'))[_0x0559('0x27')](_0x47cec1,getIntervals(_0x3319ef['intervals'],_0xec3ff6),_0x3319ef),'consequence':require('./applications/'+_0xec3ff6[_0x0559('0x18')])[_0x0559('0x28')](_0x47cec1,_0x1cee2d,_0x3319ef,_0x4b595e),'p':_0xec3ff6[_0x0559('0x29')]||0x0};logger[_0x0559('0x2a')](_0x0559('0x2b'),_0x1086d9['id'],'on\x20interval',getIntervals(_0x3319ef[_0x0559('0x2c')],_0xec3ff6)[_0x0559('0x17')](_0x0559('0x2d')));_0x55e8df[_0x0559('0x1f')](_0x1086d9);}else{logger['error'](_0x0559('0x2e'),path[_0x0559('0x17')](__dirname,_0x0559('0x14'),_0xec3ff6[_0x0559('0x18')]+'.js'));}}_0x3319ef[_0x0559('0x2f')][_0x47cec1]=new RuleEngine(_0x55e8df);_0x3319ef[_0x0559('0x2f')][_0x47cec1][_0x0559('0x30')](_0x4b595e,function(_0x27101e){logger[_0x0559('0x2a')]('Applications\x20executed',JSON[_0x0559('0x31')](_0x27101e[_0x0559('0x32')]));if(_0x3319ef[_0x0559('0x2f')][_0x47cec1]){_0x3319ef['rules'][_0x47cec1]['emit'](_0x0559('0x33'));}});return _0x5193c8({'code':0xc8,'message':_0x4b595e});}else{logger[_0x0559('0x2a')](_0x0559('0x34'));return _0x5193c8({'code':0xc8,'message':_0x4b595e});}}catch(_0x3654a9){logger['error'](_0x3654a9[_0x0559('0x35')]);return _0x22fc67(_0x205610[_0x0559('0x36')](0x1f4,_0x3654a9));}}return _0x22fc67(_0x0559('0x37'));});},'AcceptMessage':function(_0x4dde63){var _0x47a938=this;return new Promise(function(_0x4894fe,_0xc93f49){if(_0x4dde63[_0x0559('0x38')]&&_0x4dde63[_0x0559('0x38')]['id']){if(_0x3319ef['agents'][_0x4dde63['agent']['id']]){_0x3319ef[_0x0559('0x39')][_0x4dde63['agent']['id']][_0x0559('0x3a')]=![];_0x3319ef[_0x0559('0x39')][_0x4dde63[_0x0559('0x38')]['id']]['busyQueue']=undefined;}}if(_0x4dde63[_0x0559('0x12')]&&_0x4dde63['message']['id']){try{var _0x4ab787=getId(_0x4dde63[_0x0559('0x11')],_0x4dde63['message']?_0x4dde63[_0x0559('0x12')]['id']:0x0,_0x4dde63[_0x0559('0x13')]?_0x4dde63[_0x0559('0x13')]['id']:0x0);if(_0x3319ef[_0x0559('0x2f')][_0x4ab787]){_0x3319ef['rules'][_0x4ab787]['emit'](_0x0559('0x3b'));if(rpc[_0x4dde63['channel']+_0x0559('0x3c')]){rpc[_0x4dde63[_0x0559('0x11')]+_0x0559('0x3c')][_0x0559('0x3d')](_0x4ab787,{'UserId':_0x4dde63[_0x0559('0x12')][_0x0559('0x3e')]})[_0x0559('0x3f')](function(_0x57f50d){logger[_0x0559('0x36')]('error\x20update\x20queue\x20report');});}}return _0x4894fe({'code':0xc8,'message':_0x4dde63});}catch(_0xd83521){logger[_0x0559('0x36')](_0xd83521[_0x0559('0x35')]);return _0xc93f49(_0x47a938[_0x0559('0x36')](0x1f4,_0xd83521));}}logger[_0x0559('0x36')](_0x0559('0x40'));return _0xc93f49(_0x47a938[_0x0559('0x36')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x480a44){var _0x570e38=this;return new Promise(function(_0x7bb0e5,_0x5646f1){if(_0x480a44[_0x0559('0x38')]&&_0x480a44[_0x0559('0x38')]['id']){try{if(_0x3319ef['agents'][_0x480a44['agent']['id']]){_0x3319ef[_0x0559('0x39')][_0x480a44[_0x0559('0x38')]['id']]['busy']=![];_0x3319ef[_0x0559('0x39')][_0x480a44['agent']['id']]['busyQueue']=undefined;}return _0x7bb0e5({'code':0xc8,'message':_0x480a44});}catch(_0x3ca372){logger['error'](_0x3ca372['stack']);return _0x5646f1(_0x570e38[_0x0559('0x36')](0x1f4,_0x3ca372));}}logger[_0x0559('0x36')]('message\x20is\x20empty');return _0x5646f1(_0x570e38[_0x0559('0x36')](0x1f4,_0x0559('0x40')));});},'AbandonInteraction':function(_0x2eec7b){var _0x1811e1=this;return new Promise(function(_0xbf1fec,_0x5b1fec){if(_0x2eec7b[_0x0559('0x11')]&&_0x2eec7b[_0x0559('0x13')]&&_0x2eec7b[_0x0559('0x13')]['id']){try{var _0x1cf2e5=getId(_0x2eec7b['channel'],_0x2eec7b[_0x0559('0x12')]?_0x2eec7b['message']['id']:0x0,_0x2eec7b[_0x0559('0x13')]?_0x2eec7b[_0x0559('0x13')]['id']:0x0);if(_0x3319ef[_0x0559('0x2f')][_0x1cf2e5]){_0x3319ef[_0x0559('0x2f')][_0x1cf2e5][_0x0559('0x41')](_0x0559('0x3b'));}return _0xbf1fec({'code':0xc8,'message':_0x2eec7b});}catch(_0xe003d2){logger[_0x0559('0x36')](_0xe003d2[_0x0559('0x35')]);return _0x5b1fec(_0x1811e1['error'](0x1f4,_0xe003d2));}}logger[_0x0559('0x36')](_0x0559('0x40'));return _0x5b1fec(_0x1811e1[_0x0559('0x36')](0x1f4,_0x0559('0x40')));});},'AgentCapacity':function(_0x224d31){var _0x514b7c=this;return new Promise(function(_0x529565,_0x2eb75b){if(_0x3319ef[_0x0559('0x39')][_0x0559('0x42')](_0x224d31['id'])){for(var _0x1d3b6c in _0x224d31['capacity']){if(_0x224d31[_0x0559('0x43')][_0x0559('0x42')](_0x1d3b6c)){if(_0x3319ef[_0x0559('0x39')][_0x224d31['id']]['hasOwnProperty'](_0x1d3b6c+_0x0559('0x44'))){_0x3319ef['agents'][_0x224d31['id']][_0x1d3b6c+_0x0559('0x44')]=parseInt(_0x224d31[_0x0559('0x43')][_0x1d3b6c],0xa);}}}_0x3319ef[_0x0559('0x39')][_0x224d31['id']][_0x0559('0x45')]();return _0x529565({'code':0xc8,'message':_0x3319ef[_0x0559('0x39')][_0x224d31['id']]});}else{return _0x2eb75b(_0x514b7c[_0x0559('0x36')](0x1f4,_0x0559('0x46')));}});},'Agents':function(_0x5ed1b1){return new Promise(function(_0x24dde7,_0x3819df){var _0x5dcbf4=_[_0x0559('0x47')](_0x3319ef['agents']);_0x24dde7({'count':_0x5dcbf4[_0x0559('0x15')],'rows':_0x5dcbf4});});},'ChatQueues':function(_0x103058){return new Promise(function(_0x5c744d,_0x2eda78){var _0x316192=[];for(var _0x135d4a in _0x3319ef[_0x0559('0x48')]){if(_0x3319ef['chatQueues']['hasOwnProperty'](_0x135d4a)){var _0x38a1cb=_0x3319ef[_0x0559('0x48')][_0x135d4a];var _0x569a24={'id':_0x38a1cb['id'],'available':_0x38a1cb['available'],'loggedIn':_0x38a1cb[_0x0559('0x49')],'name':_0x38a1cb[_0x0559('0x4a')],'paused':_0x38a1cb['paused'],'waiting':_0x38a1cb['waiting']};_0x316192['push'](_0x569a24);}}_0x5c744d({'count':_0x316192[_0x0559('0x15')],'rows':_0x316192});});},'MailQueues':function(_0x41cac0){return new Promise(function(_0x2797ca,_0xd0c821){var _0x52a2b8=[];for(var _0x2c1b4d in _0x3319ef[_0x0559('0x4b')]){if(_0x3319ef[_0x0559('0x4b')][_0x0559('0x42')](_0x2c1b4d)){var _0x76b34d=_0x3319ef[_0x0559('0x4b')][_0x2c1b4d];var _0x4453b3={'id':_0x76b34d['id'],'available':_0x76b34d[_0x0559('0x4c')],'loggedIn':_0x76b34d[_0x0559('0x49')],'name':_0x76b34d[_0x0559('0x4a')],'paused':_0x76b34d[_0x0559('0x4d')],'waiting':_0x76b34d[_0x0559('0x4e')]};_0x52a2b8[_0x0559('0x1f')](_0x4453b3);}}_0x2797ca({'count':_0x52a2b8[_0x0559('0x15')],'rows':_0x52a2b8});});},'OpenchannelQueues':function(_0x39f03e){return new Promise(function(_0x27188b,_0x284945){var _0x18bab3=[];for(var _0x24824e in _0x3319ef[_0x0559('0x4f')]){if(_0x3319ef['openchannelQueues'][_0x0559('0x42')](_0x24824e)){var _0x1e3eeb=_0x3319ef[_0x0559('0x4f')][_0x24824e];var _0x2d7cef={'id':_0x1e3eeb['id'],'available':_0x1e3eeb['available'],'loggedIn':_0x1e3eeb[_0x0559('0x49')],'name':_0x1e3eeb[_0x0559('0x4a')],'paused':_0x1e3eeb[_0x0559('0x4d')],'waiting':_0x1e3eeb[_0x0559('0x4e')]};_0x18bab3[_0x0559('0x1f')](_0x2d7cef);}}_0x27188b({'count':_0x18bab3['length'],'rows':_0x18bab3});});},'SmsQueues':function(_0x53a839){return new Promise(function(_0x2fff19,_0x486952){var _0x25156c=[];for(var _0x510aba in _0x3319ef[_0x0559('0x50')]){if(_0x3319ef[_0x0559('0x50')][_0x0559('0x42')](_0x510aba)){var _0x2602cd=_0x3319ef[_0x0559('0x50')][_0x510aba];var _0x263ac8={'id':_0x2602cd['id'],'available':_0x2602cd['available'],'loggedIn':_0x2602cd[_0x0559('0x49')],'name':_0x2602cd[_0x0559('0x4a')],'paused':_0x2602cd[_0x0559('0x4d')],'waiting':_0x2602cd[_0x0559('0x4e')]};_0x25156c[_0x0559('0x1f')](_0x263ac8);}}_0x2fff19({'count':_0x25156c[_0x0559('0x15')],'rows':_0x25156c});});},'FaxQueues':function(_0x7aafd4){return new Promise(function(_0x1da57c,_0x5b9751){var _0x102715=[];for(var _0x99dd67 in _0x3319ef[_0x0559('0x51')]){if(_0x3319ef['faxQueues'][_0x0559('0x42')](_0x99dd67)){var _0x1800b6=_0x3319ef[_0x0559('0x51')][_0x99dd67];var _0x5c4ea2={'id':_0x1800b6['id'],'available':_0x1800b6[_0x0559('0x4c')],'loggedIn':_0x1800b6[_0x0559('0x49')],'name':_0x1800b6[_0x0559('0x4a')],'paused':_0x1800b6[_0x0559('0x4d')],'waiting':_0x1800b6[_0x0559('0x4e')]};_0x102715['push'](_0x5c4ea2);}}_0x1da57c({'count':_0x102715[_0x0559('0x15')],'rows':_0x102715});});},'WhatsappQueues':function(_0x3dd9b4){return new Promise(function(_0x195a16,_0x5ed9f0){var _0x5534a3=[];for(var _0x589bd5 in _0x3319ef[_0x0559('0x52')]){if(_0x3319ef[_0x0559('0x52')][_0x0559('0x42')](_0x589bd5)){var _0x45acdf=_0x3319ef[_0x0559('0x52')][_0x589bd5];var _0x5b0ecf={'id':_0x45acdf['id'],'available':_0x45acdf[_0x0559('0x4c')],'loggedIn':_0x45acdf[_0x0559('0x49')],'name':_0x45acdf[_0x0559('0x4a')],'paused':_0x45acdf[_0x0559('0x4d')],'waiting':_0x45acdf[_0x0559('0x4e')]};_0x5534a3['push'](_0x5b0ecf);}}_0x195a16({'count':_0x5534a3[_0x0559('0x15')],'rows':_0x5534a3});});},'ChatQueuesWaitingInteractions':function(_0x152e27){return new Promise(function(_0x22a1e2,_0x3de206){var _0x29262b=_[_0x0559('0x47')](_0x3319ef[_0x0559('0x53')]);_0x22a1e2({'count':_0x29262b[_0x0559('0x15')],'rows':_0x29262b});});},'MailQueuesWaitingInteractions':function(_0x33d8e1){return new Promise(function(_0x526e36,_0x4c153a){var _0x419d16=_[_0x0559('0x47')](_0x3319ef['mailQueuesWaitingInteractions']);_0x526e36({'count':_0x419d16['length'],'rows':_0x419d16});});},'OpenchannelQueuesWaitingInteractions':function(_0x22f731){return new Promise(function(_0xe20da7,_0x3f983d){var _0x1e9625=_[_0x0559('0x47')](_0x3319ef[_0x0559('0x54')]);_0xe20da7({'count':_0x1e9625[_0x0559('0x15')],'rows':_0x1e9625});});},'SmsQueuesWaitingInteractions':function(_0x4165ea){return new Promise(function(_0x589669,_0x25fdd9){var _0xe433f0=_['values'](_0x3319ef[_0x0559('0x55')]);_0x589669({'count':_0xe433f0[_0x0559('0x15')],'rows':_0xe433f0});});},'FaxQueuesWaitingInteractions':function(_0x1be56e){return new Promise(function(_0x57d727,_0x552870){var _0x2eb0ef=_[_0x0559('0x47')](_0x3319ef['faxQueuesWaitingInteractions']);_0x57d727({'count':_0x2eb0ef[_0x0559('0x15')],'rows':_0x2eb0ef});});},'WhatsappQueuesWaitingInteractions':function(_0x33ba71){return new Promise(function(_0xc1e6aa,_0x367159){var _0x265198=_[_0x0559('0x47')](_0x3319ef[_0x0559('0x56')]);_0xc1e6aa({'count':_0x265198['length'],'rows':_0x265198});});}};var _0xe82dab=jayson[_0x0559('0x57')](_0x568302)[_0x0559('0x58')]();_0xe82dab['on'](_0x0559('0x36'),function(_0x1a17e8){logger[_0x0559('0x36')](JSON[_0x0559('0x31')](_0x1a17e8));return _0x2d8836(_0x1a17e8);});_0xe82dab[_0x0559('0x10')](0x232c,_0x0559('0x59'),function(){console[_0x0559('0x5a')](_0x0559('0x5b'),0x232c);return _0x2fe455(_0x0559('0x5c')+0x232c);});});}; \ No newline at end of file +var _0xb13c=['stack','emit','end','hasOwnProperty','capacity','CurrentCapacity','updateRealtime','values','chatQueues','available','paused','waiting','mailQueues','loggedIn','name','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','http','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','path','jayson/promise','bluebird','uuid','../../../config/logger','routing','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../lib/rule-engine','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','rules','channel','message','interaction','applications','isArray','length','existsSync','join','app','toLowerCase','autoreply','appdata','push','slice','dialogflow','split','dialogflowv2','TagId','condition','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','intervals','\x20|\x20','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','stringify','complete','No\x20applications\x20to\x20execute','routing\x20is\x20empty','agent','agents','busy','busyQueue','QueueReport','update','UserId','catch','error\x20update\x20queue\x20report','message\x20is\x20empty'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb13c,0x18f));var _0xcb13=function(_0x64aff8,_0x106082){_0x64aff8=_0x64aff8-0x0;var _0x5488a3=_0xb13c[_0x64aff8];return _0x5488a3;};'use strict';var _=require(_0xcb13('0x0'));var util=require('util');var path=require(_0xcb13('0x1'));var fs=require('fs');var jayson=require(_0xcb13('0x2'));var BPromise=require(_0xcb13('0x3'));var uuid=require(_0xcb13('0x4'));var config=require('../../../config/environment');var logger=require(_0xcb13('0x5'))(_0xcb13('0x6'));var rpc={'openchannelQueueReport':require('../rpc/openchannelQueueReport'),'mailQueueReport':require(_0xcb13('0x7')),'chatQueueReport':require(_0xcb13('0x8')),'smsQueueReport':require(_0xcb13('0x9')),'faxQueueReport':require(_0xcb13('0xa')),'whatsappQueueReport':require('../rpc/whatsappQueueReport')};var RuleEngine=require(_0xcb13('0xb'));function getId(_0xee5ba2,_0x5b69d5,_0x97f4bb){return util[_0xcb13('0xc')](_0xcb13('0xd'),_0xee5ba2,_0x5b69d5||0x0,_0x97f4bb||0x0);}function getIntervals(_0x1a0251,_0x3486ca){var _0x5d27cf=[];if(!_['isNil'](_0x3486ca['IntervalId'])&&!_[_0xcb13('0xe')](_0x1a0251[_0x3486ca[_0xcb13('0xf')]])&&!_[_0xcb13('0xe')](_0x1a0251[_0x3486ca['IntervalId']][_0xcb13('0x10')])){_0x5d27cf=_[_0xcb13('0x11')](_0x1a0251[_0x3486ca[_0xcb13('0xf')]]['Intervals'],'interval');}else if(!_['isNil'](_0x3486ca[_0xcb13('0x12')])){_0x5d27cf=[_0x3486ca['interval']];}return _0x5d27cf;}exports[_0xcb13('0x13')]=function(_0x3f9480){_0x3f9480[_0xcb13('0x14')]={};return new BPromise(function(_0x214e7d,_0xcc27df){var _0x1cb234={'Start':function(_0xbff7fe){var _0x23d6da=this;return new Promise(function(_0x5c3c52,_0x562113){if(_0xbff7fe){try{var _0x4d2ae3=[];var _0x5a38fe=getId(_0xbff7fe[_0xcb13('0x15')],_0xbff7fe[_0xcb13('0x16')]?_0xbff7fe[_0xcb13('0x16')]['id']:0x0,_0xbff7fe[_0xcb13('0x17')]?_0xbff7fe[_0xcb13('0x17')]['id']:0x0);if(_0xbff7fe[_0xcb13('0x18')]&&_[_0xcb13('0x19')](_0xbff7fe[_0xcb13('0x18')])&&_0xbff7fe[_0xcb13('0x18')][_0xcb13('0x1a')]){for(var _0xb769ae=0x0;_0xb769ae<_0xbff7fe[_0xcb13('0x18')]['length'];_0xb769ae+=0x1){var _0x5c9729=_0xbff7fe[_0xcb13('0x18')][_0xb769ae];if(fs[_0xcb13('0x1b')](path[_0xcb13('0x1c')](__dirname,_0xcb13('0x18'),_0x5c9729[_0xcb13('0x1d')]+'.js'))){var _0x11792b=[];switch(_0x5c9729[_0xcb13('0x1d')][_0xcb13('0x1e')]()){case _0xcb13('0x1f'):var _0x4edb4e=_0x5c9729[_0xcb13('0x20')]['split'](',');if(_0xbff7fe[_0xcb13('0x15')]==='mail'){_0x11792b[_0xcb13('0x21')](_0x4edb4e[0x0]);_0x11792b[_0xcb13('0x21')](_0x4edb4e[0x1]);_0x11792b[_0xcb13('0x21')](_0x4edb4e[_0xcb13('0x22')](0x2,_0x4edb4e[_0xcb13('0x1a')])['join'](','));}else{_0x11792b['push'](_0x4edb4e[0x0]);_0x11792b[_0xcb13('0x21')](_0x4edb4e[_0xcb13('0x22')](0x1,_0x4edb4e[_0xcb13('0x1a')])['join'](','));}break;case _0xcb13('0x23'):var _0x46c393=_0x5c9729[_0xcb13('0x20')][_0xcb13('0x24')](',');_0x11792b[_0xcb13('0x21')](_0x46c393[0x0]);_0x11792b['push'](_0x46c393[0x1]);_0x11792b[_0xcb13('0x21')](_0x46c393[_0xcb13('0x22')](0x2,_0x46c393[_0xcb13('0x1a')])['join'](','));break;case _0xcb13('0x25'):var _0x1eb616=_0x5c9729[_0xcb13('0x20')]['split'](',');_0x11792b[_0xcb13('0x21')](_0x1eb616[0x0]);_0x11792b['push'](_0x1eb616[0x1]);_0x11792b[_0xcb13('0x21')](_0x1eb616[0x2]);_0x11792b['push'](_0x1eb616[0x3]);_0x11792b[_0xcb13('0x21')](_0x1eb616['slice'](0x4,_0x1eb616[_0xcb13('0x1a')])[_0xcb13('0x1c')](','));break;case'amazonlex':var _0x527db9=_0x5c9729[_0xcb13('0x20')][_0xcb13('0x24')](',');_0x11792b[_0xcb13('0x21')](_0x527db9[0x0]);_0x11792b[_0xcb13('0x21')](_0x527db9[0x1]);_0x11792b[_0xcb13('0x21')](_0x527db9[0x2]);_0x11792b[_0xcb13('0x21')](_0x527db9[0x3]);_0x11792b[_0xcb13('0x21')](_0x527db9['slice'](0x4,_0x527db9[_0xcb13('0x1a')])[_0xcb13('0x1c')](','));break;case'message':_0x11792b[_0xcb13('0x21')](_0x5c9729[_0xcb13('0x20')]);break;case'tag':_0x11792b['push'](_0x5c9729[_0xcb13('0x26')]);_0x11792b[_0xcb13('0x21')](_0x5c9729[_0xcb13('0x20')]);break;default:_0x11792b=_[_0xcb13('0xe')](_0x5c9729['appdata'])?[]:_0x5c9729[_0xcb13('0x20')][_0xcb13('0x24')](',');}var _0x420880={'id':util[_0xcb13('0xc')]('%s:%s:%s',_0x5a38fe,_0x5c9729['id'],_0x5c9729[_0xcb13('0x1d')]),'condition':require('./interval')[_0xcb13('0x27')](_0x5a38fe,getIntervals(_0x3f9480['intervals'],_0x5c9729),_0x3f9480),'consequence':require(_0xcb13('0x28')+_0x5c9729[_0xcb13('0x1d')])['consequence'](_0x5a38fe,_0x11792b,_0x3f9480,_0xbff7fe),'p':_0x5c9729[_0xcb13('0x29')]||0x0};logger[_0xcb13('0x2a')](_0xcb13('0x2b'),_0x420880['id'],_0xcb13('0x2c'),getIntervals(_0x3f9480[_0xcb13('0x2d')],_0x5c9729)[_0xcb13('0x1c')](_0xcb13('0x2e')));_0x4d2ae3['push'](_0x420880);}else{logger[_0xcb13('0x2f')](_0xcb13('0x30'),path[_0xcb13('0x1c')](__dirname,'applications',_0x5c9729[_0xcb13('0x1d')]+_0xcb13('0x31')));}}_0x3f9480[_0xcb13('0x14')][_0x5a38fe]=new RuleEngine(_0x4d2ae3);_0x3f9480['rules'][_0x5a38fe][_0xcb13('0x32')](_0xbff7fe,function(_0x309d0e){logger['info'](_0xcb13('0x33'),JSON[_0xcb13('0x34')](_0x309d0e['matchPath']));if(_0x3f9480['rules'][_0x5a38fe]){_0x3f9480[_0xcb13('0x14')][_0x5a38fe]['emit'](_0xcb13('0x35'));}});return _0x5c3c52({'code':0xc8,'message':_0xbff7fe});}else{logger[_0xcb13('0x2a')](_0xcb13('0x36'));return _0x5c3c52({'code':0xc8,'message':_0xbff7fe});}}catch(_0xb0047f){logger[_0xcb13('0x2f')](_0xb0047f['stack']);return _0x562113(_0x23d6da[_0xcb13('0x2f')](0x1f4,_0xb0047f));}}return _0x562113(_0xcb13('0x37'));});},'AcceptMessage':function(_0x20d08a){var _0x5c0f3c=this;return new Promise(function(_0x5722cd,_0x2a107b){if(_0x20d08a[_0xcb13('0x38')]&&_0x20d08a[_0xcb13('0x38')]['id']){if(_0x3f9480[_0xcb13('0x39')][_0x20d08a[_0xcb13('0x38')]['id']]){_0x3f9480[_0xcb13('0x39')][_0x20d08a[_0xcb13('0x38')]['id']][_0xcb13('0x3a')]=![];_0x3f9480[_0xcb13('0x39')][_0x20d08a[_0xcb13('0x38')]['id']][_0xcb13('0x3b')]=undefined;}}if(_0x20d08a[_0xcb13('0x16')]&&_0x20d08a[_0xcb13('0x16')]['id']){try{var _0x19fe43=getId(_0x20d08a['channel'],_0x20d08a[_0xcb13('0x16')]?_0x20d08a['message']['id']:0x0,_0x20d08a[_0xcb13('0x17')]?_0x20d08a['interaction']['id']:0x0);if(_0x3f9480[_0xcb13('0x14')][_0x19fe43]){_0x3f9480['rules'][_0x19fe43]['emit']('end');if(rpc[_0x20d08a[_0xcb13('0x15')]+'QueueReport']){rpc[_0x20d08a[_0xcb13('0x15')]+_0xcb13('0x3c')][_0xcb13('0x3d')](_0x19fe43,{'UserId':_0x20d08a['message'][_0xcb13('0x3e')]})[_0xcb13('0x3f')](function(_0x291854){logger[_0xcb13('0x2f')](_0xcb13('0x40'));});}}return _0x5722cd({'code':0xc8,'message':_0x20d08a});}catch(_0x1fb5aa){logger[_0xcb13('0x2f')](_0x1fb5aa['stack']);return _0x2a107b(_0x5c0f3c[_0xcb13('0x2f')](0x1f4,_0x1fb5aa));}}logger[_0xcb13('0x2f')](_0xcb13('0x41'));return _0x2a107b(_0x5c0f3c[_0xcb13('0x2f')](0x1f4,_0xcb13('0x41')));});},'RejectMessage':function(_0x2af31d){var _0x4f19fd=this;return new Promise(function(_0x46e34b,_0x51aa1e){if(_0x2af31d[_0xcb13('0x38')]&&_0x2af31d['agent']['id']){try{if(_0x3f9480[_0xcb13('0x39')][_0x2af31d[_0xcb13('0x38')]['id']]){_0x3f9480[_0xcb13('0x39')][_0x2af31d[_0xcb13('0x38')]['id']][_0xcb13('0x3a')]=![];_0x3f9480['agents'][_0x2af31d[_0xcb13('0x38')]['id']][_0xcb13('0x3b')]=undefined;}return _0x46e34b({'code':0xc8,'message':_0x2af31d});}catch(_0x54bc2a){logger[_0xcb13('0x2f')](_0x54bc2a[_0xcb13('0x42')]);return _0x51aa1e(_0x4f19fd['error'](0x1f4,_0x54bc2a));}}logger[_0xcb13('0x2f')](_0xcb13('0x41'));return _0x51aa1e(_0x4f19fd[_0xcb13('0x2f')](0x1f4,_0xcb13('0x41')));});},'AbandonInteraction':function(_0x3832bb){var _0x43c99c=this;return new Promise(function(_0x5c2ceb,_0x4dfab9){if(_0x3832bb[_0xcb13('0x15')]&&_0x3832bb['interaction']&&_0x3832bb[_0xcb13('0x17')]['id']){try{var _0xc0b12=getId(_0x3832bb[_0xcb13('0x15')],_0x3832bb[_0xcb13('0x16')]?_0x3832bb[_0xcb13('0x16')]['id']:0x0,_0x3832bb['interaction']?_0x3832bb[_0xcb13('0x17')]['id']:0x0);if(_0x3f9480[_0xcb13('0x14')][_0xc0b12]){_0x3f9480[_0xcb13('0x14')][_0xc0b12][_0xcb13('0x43')](_0xcb13('0x44'));}return _0x5c2ceb({'code':0xc8,'message':_0x3832bb});}catch(_0x12a701){logger[_0xcb13('0x2f')](_0x12a701[_0xcb13('0x42')]);return _0x4dfab9(_0x43c99c[_0xcb13('0x2f')](0x1f4,_0x12a701));}}logger[_0xcb13('0x2f')](_0xcb13('0x41'));return _0x4dfab9(_0x43c99c[_0xcb13('0x2f')](0x1f4,_0xcb13('0x41')));});},'AgentCapacity':function(_0x124c89){var _0x422d6f=this;return new Promise(function(_0x12585e,_0x576a84){if(_0x3f9480[_0xcb13('0x39')][_0xcb13('0x45')](_0x124c89['id'])){for(var _0x522c62 in _0x124c89[_0xcb13('0x46')]){if(_0x124c89[_0xcb13('0x46')]['hasOwnProperty'](_0x522c62)){if(_0x3f9480[_0xcb13('0x39')][_0x124c89['id']][_0xcb13('0x45')](_0x522c62+_0xcb13('0x47'))){_0x3f9480['agents'][_0x124c89['id']][_0x522c62+_0xcb13('0x47')]=parseInt(_0x124c89[_0xcb13('0x46')][_0x522c62],0xa);}}}_0x3f9480[_0xcb13('0x39')][_0x124c89['id']][_0xcb13('0x48')]();return _0x12585e({'code':0xc8,'message':_0x3f9480[_0xcb13('0x39')][_0x124c89['id']]});}else{return _0x576a84(_0x422d6f[_0xcb13('0x2f')](0x1f4,'agent\x20not\x20found'));}});},'Agents':function(_0x181c71){return new Promise(function(_0x14c234,_0x15b9ff){var _0x5930c1=_[_0xcb13('0x49')](_0x3f9480[_0xcb13('0x39')]);_0x14c234({'count':_0x5930c1[_0xcb13('0x1a')],'rows':_0x5930c1});});},'ChatQueues':function(_0x37c002){return new Promise(function(_0x3b1897,_0x64ea0f){var _0x323222=[];for(var _0x4a31da in _0x3f9480['chatQueues']){if(_0x3f9480[_0xcb13('0x4a')]['hasOwnProperty'](_0x4a31da)){var _0x5808a8=_0x3f9480[_0xcb13('0x4a')][_0x4a31da];var _0x417802={'id':_0x5808a8['id'],'available':_0x5808a8[_0xcb13('0x4b')],'loggedIn':_0x5808a8['loggedIn'],'name':_0x5808a8['name'],'paused':_0x5808a8[_0xcb13('0x4c')],'waiting':_0x5808a8[_0xcb13('0x4d')]};_0x323222[_0xcb13('0x21')](_0x417802);}}_0x3b1897({'count':_0x323222[_0xcb13('0x1a')],'rows':_0x323222});});},'MailQueues':function(_0x3ac023){return new Promise(function(_0x45af22,_0x14de2c){var _0x5b75e7=[];for(var _0x488013 in _0x3f9480[_0xcb13('0x4e')]){if(_0x3f9480[_0xcb13('0x4e')]['hasOwnProperty'](_0x488013)){var _0x559cff=_0x3f9480[_0xcb13('0x4e')][_0x488013];var _0x56caf3={'id':_0x559cff['id'],'available':_0x559cff[_0xcb13('0x4b')],'loggedIn':_0x559cff[_0xcb13('0x4f')],'name':_0x559cff['name'],'paused':_0x559cff[_0xcb13('0x4c')],'waiting':_0x559cff[_0xcb13('0x4d')]};_0x5b75e7[_0xcb13('0x21')](_0x56caf3);}}_0x45af22({'count':_0x5b75e7[_0xcb13('0x1a')],'rows':_0x5b75e7});});},'OpenchannelQueues':function(_0x2e78c3){return new Promise(function(_0x2e701a,_0x3a0438){var _0x335ff2=[];for(var _0x39f05e in _0x3f9480['openchannelQueues']){if(_0x3f9480['openchannelQueues'][_0xcb13('0x45')](_0x39f05e)){var _0x28174a=_0x3f9480['openchannelQueues'][_0x39f05e];var _0x55ec4f={'id':_0x28174a['id'],'available':_0x28174a[_0xcb13('0x4b')],'loggedIn':_0x28174a[_0xcb13('0x4f')],'name':_0x28174a[_0xcb13('0x50')],'paused':_0x28174a[_0xcb13('0x4c')],'waiting':_0x28174a[_0xcb13('0x4d')]};_0x335ff2[_0xcb13('0x21')](_0x55ec4f);}}_0x2e701a({'count':_0x335ff2[_0xcb13('0x1a')],'rows':_0x335ff2});});},'SmsQueues':function(_0x1890ca){return new Promise(function(_0x18bb89,_0x4e924e){var _0x2e2302=[];for(var _0xc09ee1 in _0x3f9480['smsQueues']){if(_0x3f9480[_0xcb13('0x51')][_0xcb13('0x45')](_0xc09ee1)){var _0x1c1522=_0x3f9480['smsQueues'][_0xc09ee1];var _0x2c8ad1={'id':_0x1c1522['id'],'available':_0x1c1522[_0xcb13('0x4b')],'loggedIn':_0x1c1522[_0xcb13('0x4f')],'name':_0x1c1522[_0xcb13('0x50')],'paused':_0x1c1522[_0xcb13('0x4c')],'waiting':_0x1c1522[_0xcb13('0x4d')]};_0x2e2302['push'](_0x2c8ad1);}}_0x18bb89({'count':_0x2e2302[_0xcb13('0x1a')],'rows':_0x2e2302});});},'FaxQueues':function(_0x2c4707){return new Promise(function(_0x5de991,_0xd1d33b){var _0x457de0=[];for(var _0x99948a in _0x3f9480[_0xcb13('0x52')]){if(_0x3f9480[_0xcb13('0x52')][_0xcb13('0x45')](_0x99948a)){var _0x519306=_0x3f9480['faxQueues'][_0x99948a];var _0x3e31b5={'id':_0x519306['id'],'available':_0x519306[_0xcb13('0x4b')],'loggedIn':_0x519306['loggedIn'],'name':_0x519306[_0xcb13('0x50')],'paused':_0x519306[_0xcb13('0x4c')],'waiting':_0x519306['waiting']};_0x457de0[_0xcb13('0x21')](_0x3e31b5);}}_0x5de991({'count':_0x457de0[_0xcb13('0x1a')],'rows':_0x457de0});});},'WhatsappQueues':function(_0x152a66){return new Promise(function(_0x1225ec,_0x5126ca){var _0x64bf0c=[];for(var _0x9c928f in _0x3f9480[_0xcb13('0x53')]){if(_0x3f9480[_0xcb13('0x53')]['hasOwnProperty'](_0x9c928f)){var _0x10c76a=_0x3f9480[_0xcb13('0x53')][_0x9c928f];var _0x31c5f5={'id':_0x10c76a['id'],'available':_0x10c76a['available'],'loggedIn':_0x10c76a['loggedIn'],'name':_0x10c76a[_0xcb13('0x50')],'paused':_0x10c76a['paused'],'waiting':_0x10c76a['waiting']};_0x64bf0c[_0xcb13('0x21')](_0x31c5f5);}}_0x1225ec({'count':_0x64bf0c[_0xcb13('0x1a')],'rows':_0x64bf0c});});},'ChatQueuesWaitingInteractions':function(_0x542087){return new Promise(function(_0x55c056,_0x47d341){var _0x31eb7b=_[_0xcb13('0x49')](_0x3f9480[_0xcb13('0x54')]);_0x55c056({'count':_0x31eb7b['length'],'rows':_0x31eb7b});});},'MailQueuesWaitingInteractions':function(_0x46a223){return new Promise(function(_0x38fd04,_0x42c346){var _0x2f822b=_[_0xcb13('0x49')](_0x3f9480['mailQueuesWaitingInteractions']);_0x38fd04({'count':_0x2f822b[_0xcb13('0x1a')],'rows':_0x2f822b});});},'OpenchannelQueuesWaitingInteractions':function(_0x2fd63c){return new Promise(function(_0x45b478,_0xe13f88){var _0xdf428c=_[_0xcb13('0x49')](_0x3f9480['openchannelQueuesWaitingInteractions']);_0x45b478({'count':_0xdf428c[_0xcb13('0x1a')],'rows':_0xdf428c});});},'SmsQueuesWaitingInteractions':function(_0x30cbe8){return new Promise(function(_0x3b4309,_0x2aa642){var _0x4ad787=_['values'](_0x3f9480[_0xcb13('0x55')]);_0x3b4309({'count':_0x4ad787[_0xcb13('0x1a')],'rows':_0x4ad787});});},'FaxQueuesWaitingInteractions':function(_0x175b7d){return new Promise(function(_0x2d50ef,_0x4953ae){var _0x30bf1f=_[_0xcb13('0x49')](_0x3f9480[_0xcb13('0x56')]);_0x2d50ef({'count':_0x30bf1f[_0xcb13('0x1a')],'rows':_0x30bf1f});});},'WhatsappQueuesWaitingInteractions':function(_0x4a47db){return new Promise(function(_0x3983db,_0x3b2ed7){var _0x5eb3f3=_[_0xcb13('0x49')](_0x3f9480[_0xcb13('0x57')]);_0x3983db({'count':_0x5eb3f3[_0xcb13('0x1a')],'rows':_0x5eb3f3});});}};var _0x319605=jayson['server'](_0x1cb234)[_0xcb13('0x58')]();_0x319605['on'](_0xcb13('0x2f'),function(_0x57689e){logger[_0xcb13('0x2f')](JSON['stringify'](_0x57689e));return _0xcc27df(_0x57689e);});_0x319605[_0xcb13('0x13')](0x232c,_0xcb13('0x59'),function(){console[_0xcb13('0x5a')](_0xcb13('0x5b'),0x232c);return _0x214e7d(_0xcb13('0x5c')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index cb41d01..e246d17 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 _0xae49=['client','request','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','push','Command','format','iftime\x20%s','then','indexOf','true','[%s][INTERVAL]\x20%s','all','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','stop','bluebird','routing'];(function(_0x40ce42,_0x617743){var _0xbe94f1=function(_0x4790a2){while(--_0x4790a2){_0x40ce42['push'](_0x40ce42['shift']());}};_0xbe94f1(++_0x617743);}(_0xae49,0x1a2));var _0x9ae4=function(_0x48e68c,_0x58f266){_0x48e68c=_0x48e68c-0x0;var _0x52bf0f=_0xae49[_0x48e68c];return _0x52bf0f;};'use strict';var util=require('util');var BPromise=require(_0x9ae4('0x0'));var jayson=require('jayson/promise');var _=require('lodash');var logger=require('../../../config/logger')(_0x9ae4('0x1'));var client=jayson[_0x9ae4('0x2')]['http']({'port':0x232a});function request(_0x444615,_0x1a0eb0){return new BPromise(function(_0x65c3a1,_0x170c00){return client[_0x9ae4('0x3')](_0x444615,_0x1a0eb0)['then'](function(_0x19880c){if(_0x19880c[_0x9ae4('0x4')]){return _0x170c00(_0x19880c['error'][_0x9ae4('0x5')]);}else{return _0x65c3a1(_0x19880c[_0x9ae4('0x6')]);}})[_0x9ae4('0x7')](function(_0x43ec16){return _0x170c00(_0x43ec16);});});}exports[_0x9ae4('0x8')]=function(_0x1a6f74,_0x235db8,_0x5746c7){return function(_0x414049){if(_0x5746c7[_0x9ae4('0x9')]&&!_0x5746c7[_0x9ae4('0x9')][_0x1a6f74]){logger[_0x9ae4('0xa')](_0x9ae4('0xb'),_0x1a6f74);return _0x414049['stop']();}var _0x5c1d3c=[];for(var _0x150948=0x0;_0x150948<_0x235db8[_0x9ae4('0xc')];_0x150948+=0x1){_0x5c1d3c[_0x9ae4('0xd')](request(_0x9ae4('0xe'),{'command':util[_0x9ae4('0xf')](_0x9ae4('0x10'),_0x235db8[_0x150948])})[_0x9ae4('0x11')](function(_0x414d36){return _0x414d36&&_0x414d36[_0x9ae4('0x5')]&&_0x414d36['message'][_0x9ae4('0x12')](_0x9ae4('0x13'))>=0x0?!![]:![];})[_0x9ae4('0x7')](function(_0x4d3f3c){logger['error'](_0x9ae4('0x14'),_0x1a6f74,_0x235db8[_0x150948]);}));}BPromise[_0x9ae4('0x15')](_0x5c1d3c)[_0x9ae4('0x11')](function(_0x46efdb){var _0x1ad4b5=_['some'](_0x46efdb);logger[_0x9ae4('0xa')](_0x9ae4('0x16'),_0x1a6f74,_0x235db8[_0x9ae4('0x17')](_0x9ae4('0x18')),_0x1ad4b5);_0x414049[_0x9ae4('0x19')](_0x1ad4b5);})[_0x9ae4('0x7')](function(_0x3cb7c4){console['log'](_0x3cb7c4);logger['error']('[%s][INTERVAL]\x20%s\x20%s',_0x1a6f74,_0x235db8[_0x9ae4('0x17')](_0x9ae4('0x18')),_0x3cb7c4[_0x9ae4('0x1a')]);_0x414049[_0x9ae4('0x1b')]();});};}; \ No newline at end of file +var _0xa4c6=['request','then','error','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','length','push','Command','format','message','true','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','join','\x20|\x20','when','stack','util','bluebird','jayson/promise','client','http'];(function(_0x466e57,_0x21b819){var _0x34df42=function(_0x3e9758){while(--_0x3e9758){_0x466e57['push'](_0x466e57['shift']());}};_0x34df42(++_0x21b819);}(_0xa4c6,0xa9));var _0x6a4c=function(_0x4b525a,_0x34a563){_0x4b525a=_0x4b525a-0x0;var _0x4718d6=_0xa4c6[_0x4b525a];return _0x4718d6;};'use strict';var util=require(_0x6a4c('0x0'));var BPromise=require(_0x6a4c('0x1'));var jayson=require(_0x6a4c('0x2'));var _=require('lodash');var logger=require('../../../config/logger')('routing');var client=jayson[_0x6a4c('0x3')][_0x6a4c('0x4')]({'port':0x232a});function request(_0x4d4e07,_0x6b4cf8){return new BPromise(function(_0x7de959,_0x567129){return client[_0x6a4c('0x5')](_0x4d4e07,_0x6b4cf8)[_0x6a4c('0x6')](function(_0x51031b){if(_0x51031b[_0x6a4c('0x7')]){return _0x567129(_0x51031b[_0x6a4c('0x7')]['message']);}else{return _0x7de959(_0x51031b[_0x6a4c('0x8')]);}})[_0x6a4c('0x9')](function(_0x55d219){return _0x567129(_0x55d219);});});}exports[_0x6a4c('0xa')]=function(_0x4768ae,_0x475ed7,_0x47ec00){return function(_0x5c9747){if(_0x47ec00[_0x6a4c('0xb')]&&!_0x47ec00[_0x6a4c('0xb')][_0x4768ae]){logger[_0x6a4c('0xc')](_0x6a4c('0xd'),_0x4768ae);return _0x5c9747[_0x6a4c('0xe')]();}var _0x145b88=[];for(var _0x7a3452=0x0;_0x7a3452<_0x475ed7[_0x6a4c('0xf')];_0x7a3452+=0x1){_0x145b88[_0x6a4c('0x10')](request(_0x6a4c('0x11'),{'command':util[_0x6a4c('0x12')]('iftime\x20%s',_0x475ed7[_0x7a3452])})[_0x6a4c('0x6')](function(_0x2a9c1d){return _0x2a9c1d&&_0x2a9c1d[_0x6a4c('0x13')]&&_0x2a9c1d['message']['indexOf'](_0x6a4c('0x14'))>=0x0?!![]:![];})[_0x6a4c('0x9')](function(_0x1bef30){logger[_0x6a4c('0x7')](_0x6a4c('0x15'),_0x4768ae,_0x475ed7[_0x7a3452]);}));}BPromise[_0x6a4c('0x16')](_0x145b88)[_0x6a4c('0x6')](function(_0xc9d44){var _0x52cc60=_[_0x6a4c('0x17')](_0xc9d44);logger['info'](_0x6a4c('0x18'),_0x4768ae,_0x475ed7[_0x6a4c('0x19')](_0x6a4c('0x1a')),_0x52cc60);_0x5c9747[_0x6a4c('0x1b')](_0x52cc60);})[_0x6a4c('0x9')](function(_0x5a632b){console['log'](_0x5a632b);logger[_0x6a4c('0x7')](_0x6a4c('0x18'),_0x4768ae,_0x475ed7[_0x6a4c('0x19')]('\x20|\x20'),_0x5a632b[_0x6a4c('0x1c')]);_0x5c9747['stop']();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index 51db675..f2e2da4 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 _0xbaf0=['includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','talktime','agentconnect','[%s][agents][agentconnect]','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','agentconnectAt','connect','answered_elsewhere','answeredelsewheremembername','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime','complete','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','transfertype','blind','transferexten','extension','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfereruniqueid','ATTENDED','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','agent','[%s][agents][hangup]','util','./utils','info','format','uniqueid','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','agentcalledAt','now','connectedlinename','error','agentringnoanswer','isNil','debug','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','holdtime','ringtime','push','forIn'];(function(_0x522951,_0x2b6511){var _0x390bbb=function(_0x9a768c){while(--_0x9a768c){_0x522951['push'](_0x522951['shift']());}};_0x390bbb(++_0x2b6511);}(_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 utils=require(_0x0baf('0x1'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1e212d,_0x263f79){utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s',_0x1e212d[_0x0baf('0x4')],_0x1e212d[_0x0baf('0x5')],_0x1e212d[_0x0baf('0x6')],_0x1e212d[_0x0baf('0x7')],_0x1e212d[_0x0baf('0x8')],_0x1e212d[_0x0baf('0x9')],_0x1e212d[_0x0baf('0xa')],_0x1e212d[_0x0baf('0xb')]));if(_0x1e212d[_0x0baf('0x6')]){utils['getVoiceQueueByName'](_0x1e212d[_0x0baf('0x6')])['then'](function(_0x4605c3){if(_0x4605c3){_0x1e212d[_0x0baf('0xc')]=_0x4605c3[_0x0baf('0xc')];_0x1e212d[_0x0baf('0xd')]=_0x1e212d[_0x0baf('0xe')]?_0x4605c3[_0x0baf('0xf')]:![];_0x1e212d[_0x0baf('0x10')]=_0x1e212d[_0x0baf('0xd')]?_0x4605c3[_0x0baf('0x11')]:0x0;}utils[_0x0baf('0x12')](_0x0baf('0x13'),_0x1e212d);});}else{utils['request']('CreateVoiceAgentReport',_0x1e212d);}if(_0x263f79){delete transfers[_0x1e212d[_0x0baf('0x4')]];}else{delete agents[_0x1e212d[_0x0baf('0x14')]];}}exports[_0x0baf('0x15')]=function(_0x13df17){try{utils['debug'](util[_0x0baf('0x3')]('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x13df17);agents[_0x13df17[_0x0baf('0x14')]]=_0x13df17;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();agents[_0x13df17[_0x0baf('0x14')]]['lastevent']='called';agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0xa')]=null;agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x18')]=null;utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x13df17[_0x0baf('0x4')],agents[_0x13df17[_0x0baf('0x14')]][_0x0baf('0x7')],_0x13df17[_0x0baf('0x14')]));}catch(_0x47070d){utils[_0x0baf('0x19')](util['format']('[%s][agents][agentcalled]',_0x13df17[_0x0baf('0x4')]),_0x47070d);}};exports[_0x0baf('0x1a')]=function(_0x32e839){try{if(!_[_0x0baf('0x1b')](agents[_0x32e839[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0x32e839);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x1e'),_0x32e839['uniqueid'],agents[_0x32e839[_0x0baf('0x14')]]['membername'],_0x32e839['destuniqueid']));agents[_0x32e839[_0x0baf('0x14')]]['agentringnoanswer']=!![];agents[_0x32e839['destuniqueid']][_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x20');agents[_0x32e839['destuniqueid']][_0x0baf('0x21')]=_0x0baf('0x20');agents[_0x32e839[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x32e839[_0x0baf('0x23')]?parseInt(_0x32e839[_0x0baf('0x23')])/0x3e8:0x0;agents[_0x32e839[_0x0baf('0x14')]]['talktime']=0x0;unanswered[_0x0baf('0x24')](_0x32e839[_0x0baf('0x14')]);}}catch(_0xcaf13d){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x1d'),_0x32e839[_0x0baf('0x4')]),_0xcaf13d);}};exports['queuecallerabandon']=function(_0x44ec31){try{_[_0x0baf('0x25')](agents,function(_0x478ce8,_0xb4dbb1){if(_0x478ce8[_0x0baf('0x4')]==_0x44ec31[_0x0baf('0x4')]&&!_[_0x0baf('0x26')](unanswered,_0x478ce8['destuniqueid'])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31[_0x0baf('0x4')]),_0x44ec31);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x28'),_0x44ec31[_0x0baf('0x4')],_0x478ce8[_0x0baf('0x7')],_0x478ce8[_0x0baf('0x14')]));_0x478ce8[_0x0baf('0x1a')]=!![];_0x478ce8[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x478ce8[_0x0baf('0xb')]='abandoned';_0x478ce8[_0x0baf('0x21')]='abandoned';_0x478ce8[_0x0baf('0x22')]=_0x44ec31[_0x0baf('0x22')];_0x478ce8[_0x0baf('0x29')]=0x0;writeDB(_0x478ce8);}});}catch(_0x3d65f2){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x27'),_0x44ec31['uniqueid']),_0x3d65f2);}};exports[_0x0baf('0x2a')]=function(_0x2447c2){try{if(agents[_0x2447c2[_0x0baf('0x14')]]){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x2447c2);utils[_0x0baf('0x2')](util['format'](_0x0baf('0x2c'),_0x2447c2[_0x0baf('0x4')],agents[_0x2447c2['destuniqueid']][_0x0baf('0x7')],_0x2447c2['destuniqueid']));agents[_0x2447c2['destuniqueid']][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();agents[_0x2447c2['destuniqueid']]['connectedlinenum']=_0x2447c2[_0x0baf('0xa')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x18')]=_0x2447c2[_0x0baf('0x18')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];agents[_0x2447c2[_0x0baf('0x14')]][_0x0baf('0xb')]=_0x0baf('0x2e');_[_0x0baf('0x25')](agents,function(_0x148540,_0x354cb1){if(_0x148540[_0x0baf('0x14')]!=_0x2447c2['destuniqueid']&&_0x148540[_0x0baf('0x4')]==_0x2447c2[_0x0baf('0x4')]){_0x148540['talktime']=0x0;_0x148540[_0x0baf('0x22')]=_0x2447c2[_0x0baf('0x23')];_0x148540[_0x0baf('0x1a')]=!![];_0x148540[_0x0baf('0x1f')]=utils[_0x0baf('0x17')]();_0x148540[_0x0baf('0xb')]='answered_elsewhere';_0x148540[_0x0baf('0x21')]=_0x0baf('0x2f');_0x148540['answeredelsewheredestinationuniqueid']=_0x2447c2[_0x0baf('0x14')];_0x148540[_0x0baf('0x30')]=_0x2447c2[_0x0baf('0x7')];writeDB(_0x148540);}});}}catch(_0x57903e){utils['error'](util[_0x0baf('0x3')](_0x0baf('0x2b'),_0x2447c2[_0x0baf('0x4')]),_0x57903e);}};exports[_0x0baf('0xe')]=function(_0x2b6d54){try{if(!_[_0x0baf('0x1b')](agents[_0x2b6d54[_0x0baf('0x14')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54['uniqueid']),_0x2b6d54);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x32'),_0x2b6d54[_0x0baf('0x4')],agents[_0x2b6d54[_0x0baf('0x14')]]['membername'],_0x2b6d54[_0x0baf('0x14')]));agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0xe')]=!![];agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')]=utils['now']();agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x33')],agents[_0x2b6d54[_0x0baf('0x14')]][_0x0baf('0x2d')]);agents[_0x2b6d54['destuniqueid']][_0x0baf('0x21')]=_0x2b6d54[_0x0baf('0x21')];agents[_0x2b6d54[_0x0baf('0x14')]]['lastevent']=_0x0baf('0x35');writeDB(agents[_0x2b6d54[_0x0baf('0x14')]]);}}catch(_0x10fa62){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x31'),_0x2b6d54[_0x0baf('0x4')]),_0x10fa62);}};exports['blindtransfer']=function(_0x22c451){try{if(!_[_0x0baf('0x1b')](agents[_0x22c451[_0x0baf('0x36')]])){utils[_0x0baf('0x1c')](util[_0x0baf('0x3')](_0x0baf('0x37'),_0x22c451[_0x0baf('0x4')]),_0x22c451);utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x38'),_0x22c451[_0x0baf('0x4')],agents[_0x22c451['transfereruniqueid']]['membername'],agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')]));agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x39')]=!![];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3a')]=_0x0baf('0x3b');agents[_0x22c451['transfereruniqueid']][_0x0baf('0x3c')]=_0x22c451[_0x0baf('0x3d')];agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x3e')]=agents[_0x22c451[_0x0baf('0x36')]][_0x0baf('0x4')];}}catch(_0x5e1849){utils[_0x0baf('0x19')](util['format'](_0x0baf('0x37'),_0x22c451['uniqueid']),_0x5e1849);}};exports[_0x0baf('0x3f')]=function(_0x5eaeb2){try{utils[_0x0baf('0x1c')](util['format'](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5eaeb2);if(_0x5eaeb2[_0x0baf('0x41')]==_0x5eaeb2[_0x0baf('0x42')]){if(!_[_0x0baf('0x1b')](agents[_0x5eaeb2['secondtransfereruniqueid']])){utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x43'),_0x5eaeb2[_0x0baf('0x41')],agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x7')]));agents[_0x5eaeb2['secondtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3a')]=_0x0baf('0x45');agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x46')];agents[_0x5eaeb2['secondtransfereruniqueid']]['transferuniqueid']=_0x5eaeb2[_0x0baf('0x41')];}if(_0x5eaeb2[_0x0baf('0x47')]&&agents[_0x5eaeb2[_0x0baf('0x47')]]){agents[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x1;transfers[_0x5eaeb2[_0x0baf('0x47')]]=_[_0x0baf('0x49')](agents[_0x5eaeb2[_0x0baf('0x47')]]);transfers[_0x5eaeb2[_0x0baf('0x47')]]['calleridnum']=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x44')]][_0x0baf('0x4a')];transfers[_0x5eaeb2[_0x0baf('0x47')]]['agentcalledAt']=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x47')]][_0x0baf('0x48')]=0x2;}}else if(_0x5eaeb2['secondtransfereruniqueid']==_0x5eaeb2[_0x0baf('0x4b')]){if(!_['isNil'](agents[_0x5eaeb2[_0x0baf('0x41')]])){utils['info'](util['format'](_0x0baf('0x43'),_0x5eaeb2['origtransfereruniqueid'],agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x7')]));agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x39')]=!![];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3a')]='ATTENDED';agents[_0x5eaeb2['origtransfereruniqueid']][_0x0baf('0x3c')]=_0x5eaeb2[_0x0baf('0x4c')];agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x3e')]=_0x5eaeb2[_0x0baf('0x44')];}if(_0x5eaeb2['transfertargetuniqueid']&&agents[_0x5eaeb2[_0x0baf('0x4d')]]){agents[_0x5eaeb2['transfertargetuniqueid']]['agententerreason']=0x1;transfers[_0x5eaeb2['transfertargetuniqueid']]=_[_0x0baf('0x49')](agents[_0x5eaeb2['transfertargetuniqueid']]);transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x9')]=agents[_0x5eaeb2[_0x0baf('0x41')]][_0x0baf('0x9')];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x4a')]=agents[_0x5eaeb2[_0x0baf('0x41')]]['calleridname'];transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x16')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x2d')]=utils[_0x0baf('0x17')]();transfers[_0x5eaeb2['transfertargetuniqueid']][_0x0baf('0x22')]=0x0;transfers[_0x5eaeb2[_0x0baf('0x4d')]][_0x0baf('0x48')]=0x2;}}}catch(_0x5d4053){utils[_0x0baf('0x19')](util[_0x0baf('0x3')](_0x0baf('0x40'),_0x5eaeb2[_0x0baf('0x41')]),_0x5d4053);}};exports[_0x0baf('0x4e')]=function(_0x27a959){try{utils[_0x0baf('0x1c')](util['format']('[%s][agents][hangup]',_0x27a959['uniqueid']),_0x27a959);if(agents[_0x27a959[_0x0baf('0x4')]]&&agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]===_0x0baf('0x20')){if(_0x27a959[_0x0baf('0x4f')]==='21'){agents[_0x27a959[_0x0baf('0x4')]]['reason']='rejected';agents[_0x27a959[_0x0baf('0x4')]]['lastevent']=_0x0baf('0x50');}utils[_0x0baf('0x2')](util['format'](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);var _0x5ea0f3=unanswered['indexOf'](_0x27a959['uniqueid']);if(_0x5ea0f3>-0x1){unanswered['splice'](_0x5ea0f3,0x1);}}if(transfers[_0x27a959['uniqueid']]){transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xe')]=!![];transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils['now']();transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x29')]=utils['diffTime'](transfers[_0x27a959['uniqueid']][_0x0baf('0x33')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x2d')]);transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=_0x0baf('0x52');transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27a959[_0x0baf('0x4')],transfers[_0x27a959[_0x0baf('0x4')]]['membername'],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],transfers[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(transfers[_0x27a959[_0x0baf('0x4')]],!![]);}if(agents[_0x27a959['uniqueid']]&&agents[_0x27a959['uniqueid']][_0x0baf('0x2d')]){agents[_0x27a959[_0x0baf('0x4')]]['agentcomplete']=!![];agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x33')]=utils[_0x0baf('0x17')]();agents[_0x27a959['uniqueid']][_0x0baf('0x29')]=utils[_0x0baf('0x34')](agents[_0x27a959[_0x0baf('0x4')]]['agentcompleteAt'],agents[_0x27a959[_0x0baf('0x4')]]['agentconnectAt']);agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')]=agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x39')]?_0x0baf('0x39'):'agent';agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]='complete';utils[_0x0baf('0x2')](util[_0x0baf('0x3')](_0x0baf('0x51'),_0x27a959[_0x0baf('0x4')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x7')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0x21')],agents[_0x27a959[_0x0baf('0x4')]][_0x0baf('0xb')]));writeDB(agents[_0x27a959[_0x0baf('0x4')]]);}}catch(_0x2c2f09){utils['error'](util['format'](_0x0baf('0x53'),_0x27a959[_0x0baf('0x4')]),_0x2c2f09);}}; \ No newline at end of file +var _0x6e6c=['agentconnectAt','complete','blindtransfer','transfereruniqueid','transfer','transferexten','extension','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','transfertype','ATTENDED','transfereeuniqueid','agententerreason','clone','calleridnum','calleridname','secondtransfererlinkedid','secondtransfererexten','transfertargetuniqueid','cause','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agent','[%s][agents][hangup]','lodash','util','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','membername','interface','connectedlinenum','lastevent','getVoiceQueueByName','queue','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','uniqueid','agentcalledAt','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','error','format','agentringnoanswer','[%s][agents][agentringnoanswer]','info','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','now','timeout','holdtime','ringtime','talktime','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','reason','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','isNil','[%s][agents][agentcomplete]','[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete','agentcompleteAt','diffTime'];(function(_0x5a183f,_0x5284b5){var _0x3e8e4e=function(_0x5368e4){while(--_0x5368e4){_0x5a183f['push'](_0x5a183f['shift']());}};_0x3e8e4e(++_0x5284b5);}(_0x6e6c,0xc3));var _0xc6e6=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x6e6c[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xc6e6('0x0'));var util=require(_0xc6e6('0x1'));var utils=require('./utils');var agents={};var transfers={};var unanswered=[];function writeDB(_0x370b21,_0x1b63fe){utils['info'](util['format'](_0xc6e6('0x2'),_0x370b21['uniqueid'],_0x370b21[_0xc6e6('0x3')],_0x370b21['queue'],_0x370b21[_0xc6e6('0x4')],_0x370b21[_0xc6e6('0x5')],_0x370b21['calleridnum'],_0x370b21[_0xc6e6('0x6')],_0x370b21[_0xc6e6('0x7')]));if(_0x370b21['queue']){utils[_0xc6e6('0x8')](_0x370b21[_0xc6e6('0x9')])['then'](function(_0x324f05){if(_0x324f05){_0x370b21['type']=_0x324f05[_0xc6e6('0xa')];_0x370b21[_0xc6e6('0xb')]=_0x370b21[_0xc6e6('0xc')]?_0x324f05[_0xc6e6('0xd')]:![];_0x370b21[_0xc6e6('0xe')]=_0x370b21[_0xc6e6('0xb')]?_0x324f05[_0xc6e6('0xf')]:0x0;}utils[_0xc6e6('0x10')](_0xc6e6('0x11'),_0x370b21);});}else{utils['request'](_0xc6e6('0x11'),_0x370b21);}if(_0x1b63fe){delete transfers[_0x370b21['uniqueid']];}else{delete agents[_0x370b21[_0xc6e6('0x12')]];}}exports[_0xc6e6('0x13')]=function(_0x33aea0){try{utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x33aea0);agents[_0x33aea0[_0xc6e6('0x12')]]=_0x33aea0;agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x17')]=utils['now']();agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x7')]='called';agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x6')]=null;agents[_0x33aea0[_0xc6e6('0x12')]]['connectedlinename']=null;utils['info'](util['format'](_0xc6e6('0x18'),_0x33aea0['uniqueid'],agents[_0x33aea0[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x33aea0[_0xc6e6('0x12')]));}catch(_0x41afe6){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x15'),_0x33aea0[_0xc6e6('0x16')]),_0x41afe6);}};exports[_0xc6e6('0x1b')]=function(_0x3d734d){try{if(!_['isNil'](agents[_0x3d734d[_0xc6e6('0x12')]])){utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x1c'),_0x3d734d[_0xc6e6('0x16')]),_0x3d734d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x1e'),_0x3d734d[_0xc6e6('0x16')],agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0x3d734d[_0xc6e6('0x12')]));agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1b')]=!![];agents[_0x3d734d['destuniqueid']][_0xc6e6('0x1f')]=utils[_0xc6e6('0x20')]();agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x7')]='timeout';agents[_0x3d734d[_0xc6e6('0x12')]]['reason']=_0xc6e6('0x21');agents[_0x3d734d['destuniqueid']][_0xc6e6('0x22')]=_0x3d734d[_0xc6e6('0x23')]?parseInt(_0x3d734d[_0xc6e6('0x23')])/0x3e8:0x0;agents[_0x3d734d[_0xc6e6('0x12')]][_0xc6e6('0x24')]=0x0;unanswered['push'](_0x3d734d[_0xc6e6('0x12')]);}}catch(_0x1501bd){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][agentringnoanswer]',_0x3d734d[_0xc6e6('0x16')]),_0x1501bd);}};exports['queuecallerabandon']=function(_0x29411c){try{_[_0xc6e6('0x25')](agents,function(_0x12c616,_0xc578b3){if(_0x12c616[_0xc6e6('0x16')]==_0x29411c[_0xc6e6('0x16')]&&!_[_0xc6e6('0x26')](unanswered,_0x12c616[_0xc6e6('0x12')])){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c[_0xc6e6('0x16')]),_0x29411c);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x28'),_0x29411c[_0xc6e6('0x16')],_0x12c616[_0xc6e6('0x4')],_0x12c616['destuniqueid']));_0x12c616[_0xc6e6('0x1b')]=!![];_0x12c616[_0xc6e6('0x1f')]=utils['now']();_0x12c616['lastevent']=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x2a')]=_0xc6e6('0x29');_0x12c616[_0xc6e6('0x22')]=_0x29411c[_0xc6e6('0x22')];_0x12c616[_0xc6e6('0x24')]=0x0;writeDB(_0x12c616);}});}catch(_0x59a8f0){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x27'),_0x29411c['uniqueid']),_0x59a8f0);}};exports['agentconnect']=function(_0xa5138d){try{if(agents[_0xa5138d[_0xc6e6('0x12')]]){utils[_0xc6e6('0x14')](util[_0xc6e6('0x1a')]('[%s][agents][agentconnect]',_0xa5138d['uniqueid']),_0xa5138d);utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x2b'),_0xa5138d['uniqueid'],agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x4')],_0xa5138d[_0xc6e6('0x12')]));agents[_0xa5138d[_0xc6e6('0x12')]]['agentconnectAt']=utils['now']();agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x6')]=_0xa5138d[_0xc6e6('0x6')];agents[_0xa5138d[_0xc6e6('0x12')]]['connectedlinename']=_0xa5138d['connectedlinename'];agents[_0xa5138d[_0xc6e6('0x12')]][_0xc6e6('0x22')]=_0xa5138d[_0xc6e6('0x23')];agents[_0xa5138d[_0xc6e6('0x12')]]['lastevent']=_0xc6e6('0x2c');_[_0xc6e6('0x25')](agents,function(_0x5ddab4,_0x500b7e){if(_0x5ddab4[_0xc6e6('0x12')]!=_0xa5138d['destuniqueid']&&_0x5ddab4[_0xc6e6('0x16')]==_0xa5138d[_0xc6e6('0x16')]){_0x5ddab4['talktime']=0x0;_0x5ddab4[_0xc6e6('0x22')]=_0xa5138d['ringtime'];_0x5ddab4[_0xc6e6('0x1b')]=!![];_0x5ddab4['agentringnoanswerAt']=utils[_0xc6e6('0x20')]();_0x5ddab4[_0xc6e6('0x7')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2a')]=_0xc6e6('0x2d');_0x5ddab4[_0xc6e6('0x2e')]=_0xa5138d[_0xc6e6('0x12')];_0x5ddab4[_0xc6e6('0x2f')]=_0xa5138d[_0xc6e6('0x4')];writeDB(_0x5ddab4);}});}}catch(_0x5722db){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x30'),_0xa5138d[_0xc6e6('0x16')]),_0x5722db);}};exports['agentcomplete']=function(_0xc5f4fb){try{if(!_[_0xc6e6('0x31')](agents[_0xc5f4fb[_0xc6e6('0x12')]])){utils[_0xc6e6('0x14')](util['format'](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xc5f4fb);utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x33'),_0xc5f4fb['uniqueid'],agents[_0xc5f4fb[_0xc6e6('0x12')]]['membername'],_0xc5f4fb[_0xc6e6('0x12')]));agents[_0xc5f4fb['destuniqueid']][_0xc6e6('0xc')]=!![];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](agents[_0xc5f4fb[_0xc6e6('0x12')]]['agentcompleteAt'],agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x36')]);agents[_0xc5f4fb[_0xc6e6('0x12')]]['reason']=_0xc5f4fb[_0xc6e6('0x2a')];agents[_0xc5f4fb[_0xc6e6('0x12')]][_0xc6e6('0x7')]=_0xc6e6('0x37');writeDB(agents[_0xc5f4fb[_0xc6e6('0x12')]]);}}catch(_0xefd557){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x32'),_0xc5f4fb[_0xc6e6('0x16')]),_0xefd557);}};exports[_0xc6e6('0x38')]=function(_0x470167){try{if(!_[_0xc6e6('0x31')](agents[_0x470167[_0xc6e6('0x39')]])){utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x470167);utils[_0xc6e6('0x1d')](util['format']('[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s',_0x470167['uniqueid'],agents[_0x470167['transfereruniqueid']]['membername'],agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')]));agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3a')]=!![];agents[_0x470167[_0xc6e6('0x39')]]['transfertype']='blind';agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x3b')]=_0x470167[_0xc6e6('0x3c')];agents[_0x470167[_0xc6e6('0x39')]]['transferuniqueid']=agents[_0x470167[_0xc6e6('0x39')]][_0xc6e6('0x16')];}}catch(_0x286dc1){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')]('[%s][agents][blindtransfer]',_0x470167[_0xc6e6('0x16')]),_0x286dc1);}};exports[_0xc6e6('0x3d')]=function(_0x288912){try{utils['debug'](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x288912);if(_0x288912[_0xc6e6('0x3f')]==_0x288912[_0xc6e6('0x40')]){if(!_['isNil'](agents[_0x288912[_0xc6e6('0x41')]])){utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x42'),_0x288912[_0xc6e6('0x3f')],agents[_0x288912['secondtransfereruniqueid']]['membername']));agents[_0x288912['secondtransfereruniqueid']][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x3b')]=_0x288912['origtransfererexten'];agents[_0x288912[_0xc6e6('0x41')]]['transferuniqueid']=_0x288912[_0xc6e6('0x3f')];}if(_0x288912[_0xc6e6('0x45')]&&agents[_0x288912[_0xc6e6('0x45')]]){agents[_0x288912['transfereeuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912['transfereeuniqueid']]=_[_0xc6e6('0x47')](agents[_0x288912['transfereeuniqueid']]);transfers[_0x288912['transfereeuniqueid']][_0xc6e6('0x48')]=agents[_0x288912['secondtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x41')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x17')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]]['agentconnectAt']=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x45')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912[_0xc6e6('0x45')]]['agententerreason']=0x2;}}else if(_0x288912[_0xc6e6('0x41')]==_0x288912[_0xc6e6('0x4a')]){if(!_[_0xc6e6('0x31')](agents[_0x288912['origtransfereruniqueid']])){utils['info'](util[_0xc6e6('0x1a')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x288912['origtransfereruniqueid'],agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x4')]));agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3a')]=!![];agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x43')]=_0xc6e6('0x44');agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x3b')]=_0x288912[_0xc6e6('0x4b')];agents[_0x288912[_0xc6e6('0x3f')]]['transferuniqueid']=_0x288912['secondtransfereruniqueid'];}if(_0x288912[_0xc6e6('0x4c')]&&agents[_0x288912['transfertargetuniqueid']]){agents[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x1;transfers[_0x288912[_0xc6e6('0x4c')]]=_[_0xc6e6('0x47')](agents[_0x288912['transfertargetuniqueid']]);transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x48')]=agents[_0x288912['origtransfereruniqueid']]['calleridnum'];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x49')]=agents[_0x288912[_0xc6e6('0x3f')]][_0xc6e6('0x49')];transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x17')]=utils['now']();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x36')]=utils[_0xc6e6('0x20')]();transfers[_0x288912[_0xc6e6('0x4c')]][_0xc6e6('0x22')]=0x0;transfers[_0x288912['transfertargetuniqueid']][_0xc6e6('0x46')]=0x2;}}}catch(_0x3b1549){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x3e'),_0x288912[_0xc6e6('0x3f')]),_0x3b1549);}};exports['hangup']=function(_0x27e74b){try{utils['debug'](util[_0xc6e6('0x1a')]('[%s][agents][hangup]',_0x27e74b['uniqueid']),_0x27e74b);if(agents[_0x27e74b[_0xc6e6('0x16')]]&&agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')]===_0xc6e6('0x21')){if(_0x27e74b[_0xc6e6('0x4d')]==='21'){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]='rejected';agents[_0x27e74b[_0xc6e6('0x16')]]['lastevent']='rejected';}utils[_0xc6e6('0x1d')](util[_0xc6e6('0x1a')](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]]['membername'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x2a')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);var _0x292107=unanswered[_0xc6e6('0x4f')](_0x27e74b['uniqueid']);if(_0x292107>-0x1){unanswered[_0xc6e6('0x50')](_0x292107,0x1);}}if(transfers[_0x27e74b[_0xc6e6('0x16')]]){transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];transfers[_0x27e74b[_0xc6e6('0x16')]]['agentcompleteAt']=utils[_0xc6e6('0x20')]();transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x24')]=utils[_0xc6e6('0x35')](transfers[_0x27e74b['uniqueid']]['agentcompleteAt'],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x36')]);transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')]=_0xc6e6('0x51');transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format']('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x27e74b[_0xc6e6('0x16')],transfers[_0x27e74b['uniqueid']][_0xc6e6('0x4')],transfers[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x2a')],transfers[_0x27e74b['uniqueid']]['lastevent']));writeDB(transfers[_0x27e74b[_0xc6e6('0x16')]],!![]);}if(agents[_0x27e74b['uniqueid']]&&agents[_0x27e74b[_0xc6e6('0x16')]]['agentconnectAt']){agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0xc')]=!![];agents[_0x27e74b['uniqueid']][_0xc6e6('0x34')]=utils[_0xc6e6('0x20')]();agents[_0x27e74b[_0xc6e6('0x16')]]['talktime']=utils[_0xc6e6('0x35')](agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x34')],agents[_0x27e74b['uniqueid']][_0xc6e6('0x36')]);agents[_0x27e74b[_0xc6e6('0x16')]]['reason']=agents[_0x27e74b['uniqueid']]['transfer']?_0xc6e6('0x3a'):_0xc6e6('0x51');agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x7')]=_0xc6e6('0x37');utils[_0xc6e6('0x1d')](util['format'](_0xc6e6('0x4e'),_0x27e74b['uniqueid'],agents[_0x27e74b[_0xc6e6('0x16')]][_0xc6e6('0x4')],agents[_0x27e74b[_0xc6e6('0x16')]]['reason'],agents[_0x27e74b['uniqueid']][_0xc6e6('0x7')]));writeDB(agents[_0x27e74b[_0xc6e6('0x16')]]);}}catch(_0x1826d){utils[_0xc6e6('0x19')](util[_0xc6e6('0x1a')](_0xc6e6('0x52'),_0x27e74b[_0xc6e6('0x16')]),_0x1826d);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index c767323..56029db 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 _0xc29f=['xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','[%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','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','sipcallid','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','lodash','util','./utils','./transfers.controller','FAILED','NO\x20ANSWER','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','calleridnum','connectedlinenum','lastevent','accountcode','request','CreateVoiceCallReport','newchannel','debug','[%s][calls][newchannel]','OutgoingSpoolFailed','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','exten','now','DOCUMENTATION','error','newstate','[%s][calls][newstate]','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','context','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','transfertargetchannel','origtransfererchannel','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','[%s][calls][varset]','xmd-originatecalleridnum','value','source','variable','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','xmd-callerid-preview','[%s][calls][varset]\x20variable:%s\x20value:%s'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc29f,0x8b));var _0xfc29=function(_0xac264b,_0x1414f1){_0xac264b=_0xac264b-0x0;var _0x3281b0=_0xc29f[_0xac264b];return _0x3281b0;};'use strict';var _=require(_0xfc29('0x0'));var util=require(_0xfc29('0x1'));var utils=require(_0xfc29('0x2'));var transfers=require(_0xfc29('0x3'));var dispositions=['NO\x20ANSWER',_0xfc29('0x4'),_0xfc29('0x4'),'NO\x20ANSWER',_0xfc29('0x5'),'NO\x20ANSWER',_0xfc29('0x6'),_0xfc29('0x7'),_0xfc29('0x4'),_0xfc29('0x4'),_0xfc29('0x4')];var channels={};function writeDB(_0x3be979){var _0x20aaa5;if(transfers[_0xfc29('0x8')][_0x3be979[_0xfc29('0x9')]]){_0x20aaa5=_0x3be979[_0xfc29('0x9')];_0x3be979['uniqueid']=transfers['blinds'][_0x3be979[_0xfc29('0x9')]][_0xfc29('0xa')];}utils['info'](util[_0xfc29('0xb')](_0xfc29('0xc'),_0x3be979['uniqueid'],_0x3be979[_0xfc29('0xd')],_0x3be979[_0xfc29('0xe')],_0x3be979[_0xfc29('0xf')],_0x3be979[_0xfc29('0x10')],_0x3be979[_0xfc29('0x11')],_0x3be979[_0xfc29('0x12')],_0x3be979[_0xfc29('0x13')]));if(_0x3be979[_0xfc29('0x14')]){utils['getUserByInternal'](_0x3be979[_0xfc29('0x14')])['then'](function(_0x57f6c4){if(_0x57f6c4){_0x3be979['UserId']=_0x57f6c4['id'];}utils[_0xfc29('0x15')](_0xfc29('0x16'),_0x3be979);});}else{utils[_0xfc29('0x15')](_0xfc29('0x16'),_0x3be979);}if(channels[_0x3be979[_0xfc29('0x9')]]){delete channels[_0x3be979[_0xfc29('0x9')]];}else if(_0x20aaa5&&channels[_0x20aaa5]){delete transfers[_0xfc29('0x8')][_0x20aaa5];delete channels[_0x20aaa5];}}exports[_0xfc29('0x17')]=function(_0x2e417b){try{utils[_0xfc29('0x18')](util['format'](_0xfc29('0x19'),_0x2e417b[_0xfc29('0x9')]),_0x2e417b);if(_0x2e417b['uniqueid']==_0x2e417b['linkedid']&&_0x2e417b[_0xfc29('0xd')]!=_0xfc29('0x1a')){utils[_0xfc29('0x1b')](util[_0xfc29('0xb')](_0xfc29('0x1c'),_0x2e417b[_0xfc29('0x9')],_0x2e417b['context'],_0x2e417b[_0xfc29('0x1d')]));channels[_0x2e417b[_0xfc29('0x9')]]={'uniqueid':_0x2e417b[_0xfc29('0x9')],'accountcode':_0x2e417b[_0xfc29('0x14')],'source':_0x2e417b[_0xfc29('0x11')],'destination':_0x2e417b['exten'],'destinationcontext':_0x2e417b['context'],'channel':_0x2e417b[_0xfc29('0xd')],'starttime':utils[_0xfc29('0x1e')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':'NO\x20ANSWER','amaflags':_0xfc29('0x1f')};}}catch(_0x2916d4){utils[_0xfc29('0x20')](util['format'](_0xfc29('0x19'),_0x2e417b[_0xfc29('0x9')]),_0x2916d4);}};exports[_0xfc29('0x21')]=function(_0x5e2fe5){try{utils[_0xfc29('0x18')](util[_0xfc29('0xb')](_0xfc29('0x22'),_0x5e2fe5[_0xfc29('0x9')]),_0x5e2fe5);if(!_[_0xfc29('0x23')](channels[_0x5e2fe5[_0xfc29('0x9')]])&&_0x5e2fe5[_0xfc29('0x24')]==0x6){utils[_0xfc29('0x1b')](util['format'](_0xfc29('0x25'),_0x5e2fe5[_0xfc29('0x9')],_0x5e2fe5[_0xfc29('0x26')],_0x5e2fe5['channel']));if(_['isNil'](channels[_0x5e2fe5[_0xfc29('0x9')]][_0xfc29('0x27')])){channels[_0x5e2fe5[_0xfc29('0x9')]][_0xfc29('0x27')]=utils['now']();}}else if(!_[_0xfc29('0x23')](channels[_0x5e2fe5['linkedid']])&&_0x5e2fe5[_0xfc29('0x24')]==0x6&&_0x5e2fe5[_0xfc29('0x26')]!='transfer'){utils[_0xfc29('0x1b')](util[_0xfc29('0xb')](_0xfc29('0x28'),_0x5e2fe5[_0xfc29('0x9')],_0x5e2fe5[_0xfc29('0x29')],_0x5e2fe5[_0xfc29('0x26')],_0x5e2fe5['channel']));channels[_0x5e2fe5['linkedid']][_0xfc29('0x14')]=_0x5e2fe5[_0xfc29('0x14')];channels[_0x5e2fe5[_0xfc29('0x29')]][_0xfc29('0x2a')]=_0x5e2fe5[_0xfc29('0xd')];if(_[_0xfc29('0x23')](channels[_0x5e2fe5[_0xfc29('0x29')]][_0xfc29('0x2b')])){channels[_0x5e2fe5[_0xfc29('0x29')]]['answertime']=utils[_0xfc29('0x1e')]();}channels[_0x5e2fe5[_0xfc29('0x29')]][_0xfc29('0x2c')]=dispositions[_[_0xfc29('0x2d')](_0x5e2fe5['channelstate'])]||'ANSWERED';}}catch(_0x5c74b0){utils['error'](util[_0xfc29('0xb')](_0xfc29('0x22'),_0x5e2fe5[_0xfc29('0x9')]),_0x5c74b0);}};exports[_0xfc29('0x2e')]=function(_0x124f01){try{if(!_[_0xfc29('0x23')](channels[_0x124f01[_0xfc29('0x9')]])){utils[_0xfc29('0x18')](util['format'](_0xfc29('0x2f'),_0x124f01[_0xfc29('0x9')]),_0x124f01);if(_[_0xfc29('0x23')](channels[_0x124f01[_0xfc29('0x9')]][_0xfc29('0x30')])){channels[_0x124f01[_0xfc29('0x9')]][_0xfc29('0x30')]=_0x124f01['calleridname']+'\x20<'+_0x124f01[_0xfc29('0x11')]+'>';}utils[_0xfc29('0x1b')](util['format']('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x124f01[_0xfc29('0x9')],channels[_0x124f01[_0xfc29('0x9')]]['callerid'],_0x124f01[_0xfc29('0x31')]));channels[_0x124f01[_0xfc29('0x9')]][_0xfc29('0x32')]=utils[_0xfc29('0x1e')]();channels[_0x124f01[_0xfc29('0x9')]][_0xfc29('0x33')]=utils[_0xfc29('0x34')](channels[_0x124f01[_0xfc29('0x9')]][_0xfc29('0x32')],channels[_0x124f01[_0xfc29('0x9')]]['starttime']);channels[_0x124f01['uniqueid']][_0xfc29('0x35')]=channels[_0x124f01[_0xfc29('0x9')]][_0xfc29('0x2b')]?utils[_0xfc29('0x34')](channels[_0x124f01[_0xfc29('0x9')]]['endtime'],channels[_0x124f01[_0xfc29('0x9')]]['answertime']):0x0;writeDB(channels[_0x124f01[_0xfc29('0x9')]]);}}catch(_0x57b516){utils['error'](util['format']('[%s][calls][hangup]',_0x124f01[_0xfc29('0x9')]),_0x57b516);}};exports[_0xfc29('0x36')]=function(_0x1533bd){try{if(!_[_0xfc29('0x23')](channels[_0x1533bd[_0xfc29('0x37')]])){utils[_0xfc29('0x18')](util[_0xfc29('0xb')]('[%s][calls][attendedtransfer]',_0x1533bd[_0xfc29('0x38')]),_0x1533bd);if(channels[_0x1533bd[_0xfc29('0x37')]]['channel']==_0x1533bd[_0xfc29('0x39')]){utils[_0xfc29('0x1b')](util[_0xfc29('0xb')](_0xfc29('0x3a'),_0x1533bd[_0xfc29('0x38')],_0x1533bd['localtwolinkedid'],_0x1533bd[_0xfc29('0x3b')]));channels[_0x1533bd[_0xfc29('0x37')]][_0xfc29('0x2a')]=_0x1533bd[_0xfc29('0x3b')];channels[_0x1533bd[_0xfc29('0x37')]][_0xfc29('0x3c')]=_0xfc29('0x3d');}else if(channels[_0x1533bd[_0xfc29('0x37')]][_0xfc29('0xd')]=_0x1533bd[_0xfc29('0x3e')]){utils[_0xfc29('0x1b')](util[_0xfc29('0xb')](_0xfc29('0x3a'),_0x1533bd['origtransfereruniqueid'],_0x1533bd['localtwolinkedid'],_0x1533bd[_0xfc29('0x3f')]));channels[_0x1533bd['localtwolinkedid']][_0xfc29('0x2a')]=_0x1533bd[_0xfc29('0x3f')];channels[_0x1533bd[_0xfc29('0x37')]]['userfield']='_attended';}}}catch(_0x37a9de){utils[_0xfc29('0x20')](util['format'](_0xfc29('0x40'),_0x1533bd[_0xfc29('0x38')]),_0x37a9de);}};exports['musiconholdstart']=function(_0x824acd){try{if(!_[_0xfc29('0x23')](channels[_0x824acd['uniqueid']])){utils[_0xfc29('0x18')](util[_0xfc29('0xb')](_0xfc29('0x41'),_0x824acd[_0xfc29('0x9')]),_0x824acd);channels[_0x824acd[_0xfc29('0x9')]]['musiconholdstartAt']=utils['now']();utils['info'](util[_0xfc29('0xb')](_0xfc29('0x42'),_0x824acd[_0xfc29('0x9')],channels[_0x824acd[_0xfc29('0x9')]][_0xfc29('0x43')]));}}catch(_0x40abd4){utils[_0xfc29('0x20')](util['format'](_0xfc29('0x41'),_0x824acd[_0xfc29('0x9')]),_0x40abd4);}};exports[_0xfc29('0x44')]=function(_0x293545){try{if(!_['isNil'](channels[_0x293545[_0xfc29('0x9')]])){utils['debug'](util[_0xfc29('0xb')](_0xfc29('0x45'),_0x293545[_0xfc29('0x9')]),_0x293545);if(!_[_0xfc29('0x23')](channels[_0x293545[_0xfc29('0x9')]][_0xfc29('0x43')])){channels[_0x293545[_0xfc29('0x9')]][_0xfc29('0x46')]+=utils[_0xfc29('0x34')](utils[_0xfc29('0x1e')](),channels[_0x293545['uniqueid']][_0xfc29('0x43')]);utils[_0xfc29('0x1b')](util['format'](_0xfc29('0x47'),_0x293545['uniqueid'],channels[_0x293545[_0xfc29('0x9')]]['mohtime']));delete channels[_0x293545[_0xfc29('0x9')]]['musiconholdstartAt'];}}}catch(_0x5993d8){utils[_0xfc29('0x20')](util['format']('[%s][calls][musiconholdstop]',_0x293545[_0xfc29('0x9')]),_0x5993d8);}};exports['varset']=function(_0x864dc6){try{if(!_[_0xfc29('0x23')](channels[_0x864dc6['uniqueid']])){utils[_0xfc29('0x18')](util[_0xfc29('0xb')](_0xfc29('0x48'),_0x864dc6[_0xfc29('0x9')]),_0x864dc6);if(!_[_0xfc29('0x23')](_0x864dc6['variable'][_0xfc29('0x49')])){utils['info'](util[_0xfc29('0xb')]('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x864dc6[_0xfc29('0x9')],_0x864dc6[_0xfc29('0x4a')]));channels[_0x864dc6[_0xfc29('0x9')]][_0xfc29('0x4b')]=_0x864dc6[_0xfc29('0x4a')];}if(!_[_0xfc29('0x23')](_0x864dc6[_0xfc29('0x4c')][_0xfc29('0x4d')])){utils[_0xfc29('0x1b')](util[_0xfc29('0xb')](_0xfc29('0x4e'),_0x864dc6[_0xfc29('0x9')],_0x864dc6['value']));channels[_0x864dc6[_0xfc29('0x9')]][_0xfc29('0x4f')]=_0x864dc6[_0xfc29('0x4a')];channels[_0x864dc6[_0xfc29('0x9')]][_0xfc29('0x30')]='\x22'+_0x864dc6[_0xfc29('0x4a')]+_0xfc29('0x50')+_0x864dc6[_0xfc29('0x4a')]+'>';}if(!_[_0xfc29('0x23')](_0x864dc6[_0xfc29('0x4c')][_0xfc29('0x51')])||!_[_0xfc29('0x23')](_0x864dc6['variable']['xmd-callerid'])){utils[_0xfc29('0x1b')](util[_0xfc29('0xb')](_0xfc29('0x52'),_0x864dc6[_0xfc29('0x9')],!_['isNil'](_0x864dc6[_0xfc29('0x4c')][_0xfc29('0x51')])?'xmd-callerid-preview':'xmd-callerid',_0x864dc6[_0xfc29('0x4a')]));channels[_0x864dc6[_0xfc29('0x9')]][_0xfc29('0x30')]=_0x864dc6[_0xfc29('0x4a')];}if(!_['isNil'](_0x864dc6['variable'][_0xfc29('0x53')])||!_[_0xfc29('0x23')](_0x864dc6[_0xfc29('0x4c')][_0xfc29('0x54')])){utils[_0xfc29('0x1b')](util['format'](_0xfc29('0x52'),_0x864dc6['uniqueid'],!_[_0xfc29('0x23')](_0x864dc6[_0xfc29('0x4c')][_0xfc29('0x53')])?_0xfc29('0x53'):_0xfc29('0x54'),_0x864dc6[_0xfc29('0x4a')]));channels[_0x864dc6[_0xfc29('0x9')]][_0xfc29('0x55')]=_0xfc29('0x56');channels[_0x864dc6[_0xfc29('0x9')]][_0xfc29('0x57')]=_0x864dc6[_0xfc29('0x4a')];channels[_0x864dc6['uniqueid']][_0xfc29('0xe')]=!![];}if(!_[_0xfc29('0x23')](_0x864dc6[_0xfc29('0x4c')]['xmd-contactid'])){utils['info'](util[_0xfc29('0xb')](_0xfc29('0x58'),_0x864dc6['uniqueid'],_0x864dc6[_0xfc29('0x4a')]));channels[_0x864dc6['uniqueid']][_0xfc29('0x59')]=_0x864dc6[_0xfc29('0x4a')];}if(!_[_0xfc29('0x23')](_0x864dc6['variable'][_0xfc29('0x5a')])){utils['info'](util[_0xfc29('0xb')](_0xfc29('0x5b'),_0x864dc6[_0xfc29('0x9')],_0x864dc6[_0xfc29('0x4a')]));channels[_0x864dc6[_0xfc29('0x9')]][_0xfc29('0x5c')]=_0x864dc6[_0xfc29('0x4a')];}if(!_['isNil'](_0x864dc6[_0xfc29('0x4c')][_0xfc29('0x5d')])){utils[_0xfc29('0x1b')](util['format'](_0xfc29('0x5e'),_0x864dc6[_0xfc29('0x9')],_0x864dc6[_0xfc29('0x4a')]));channels[_0x864dc6[_0xfc29('0x9')]]['routeid']=_0x864dc6[_0xfc29('0x4a')];}if(!_[_0xfc29('0x23')](_0x864dc6[_0xfc29('0x4c')]['sipcallid'])){utils[_0xfc29('0x1b')](util['format'](_0xfc29('0x5f'),_0x864dc6[_0xfc29('0x9')],_0x864dc6[_0xfc29('0x4a')]));channels[_0x864dc6[_0xfc29('0x9')]][_0xfc29('0x60')]=_0x864dc6[_0xfc29('0x4a')];}}}catch(_0x431a7d){utils[_0xfc29('0x20')](util[_0xfc29('0xb')](_0xfc29('0x48'),_0x864dc6[_0xfc29('0x9')]),_0x431a7d);}};exports[_0xfc29('0x61')]=function(_0x5f4c23){try{if(!_[_0xfc29('0x23')](channels[_0x5f4c23['uniqueid']])){utils[_0xfc29('0x18')](util['format'](_0xfc29('0x62'),_0x5f4c23[_0xfc29('0x9')]),_0x5f4c23);utils[_0xfc29('0x1b')](util[_0xfc29('0xb')](_0xfc29('0x63'),_0x5f4c23[_0xfc29('0x9')],_0x5f4c23[_0xfc29('0x64')],_0x5f4c23['appdata']));if(_0x5f4c23[_0xfc29('0x64')][_0xfc29('0x65')]()==_0xfc29('0x66')&&_['startsWith'](_0x5f4c23[_0xfc29('0x67')][_0xfc29('0x65')](),_0xfc29('0x68'))){var _0x3f68aa=_0x5f4c23['appdata'][_0xfc29('0x69')]('=');var _0x2d9194=_0x3f68aa[0x0][_0xfc29('0x6a')](_0x3f68aa[0x0][_0xfc29('0x6b')]('(')+0x1,_0x3f68aa[0x0]['lastIndexOf'](')'));var _0x2a3bd5=_0x3f68aa[0x1];channels[_0x5f4c23[_0xfc29('0x9')]][_0x2d9194]=_0x2a3bd5;}if(!_[_0xfc29('0x6c')](['hangup',_0xfc29('0x6d'),_0xfc29('0x6e'),'set','gotoif'],_0x5f4c23[_0xfc29('0x64')][_0xfc29('0x65')]())){channels[_0x5f4c23[_0xfc29('0x9')]][_0xfc29('0x55')]=_0x5f4c23[_0xfc29('0x64')];channels[_0x5f4c23[_0xfc29('0x9')]][_0xfc29('0x57')]=_0x5f4c23[_0xfc29('0x67')];}}}catch(_0x3b98be){utils['error'](util[_0xfc29('0xb')](_0xfc29('0x62'),_0x5f4c23[_0xfc29('0x9')]),_0x3b98be);}}; \ No newline at end of file +var _0x1c56=['interface','connectedlinenum','lastevent','getUserByInternal','accountcode','UserId','request','CreateVoiceCallReport','newchannel','[%s][calls][newchannel]','channel','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','calleridnum','now','DOCUMENTATION','newstate','[%s][calls][newstate]','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','isNil','linkedid','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','error','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','endtime','duration','diffTime','billableseconds','attendedtransfer','localtwolinkedid','debug','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','origtransfereruniqueid','secondtransfererchannel','destinationchannel','_attended','origtransfererchannel','userfield','[%s][calls][attendedtransfer]','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][musiconholdstop]\x20mohtime:%s','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','source','value','xmd-phone','destination','\x22\x20<','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmcs-queue','xmd-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','ContactId','xmd-cdrtype','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','application','toLowerCase','appdata','cdr','split','substring','lastIndexOf','includes','noop','execif','set','lodash','util','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','membername'];(function(_0x53e23b,_0x237980){var _0x33fb60=function(_0x5446e3){while(--_0x5446e3){_0x53e23b['push'](_0x53e23b['shift']());}};_0x33fb60(++_0x237980);}(_0x1c56,0x1a7));var _0x61c5=function(_0xfb42e6,_0x5f5d4b){_0xfb42e6=_0xfb42e6-0x0;var _0x27265b=_0x1c56[_0xfb42e6];return _0x27265b;};'use strict';var _=require(_0x61c5('0x0'));var util=require(_0x61c5('0x1'));var utils=require('./utils');var transfers=require(_0x61c5('0x2'));var dispositions=[_0x61c5('0x3'),'FAILED',_0x61c5('0x4'),_0x61c5('0x3'),'NO\x20ANSWER','NO\x20ANSWER',_0x61c5('0x5'),_0x61c5('0x6'),_0x61c5('0x4'),_0x61c5('0x4'),'FAILED'];var channels={};function writeDB(_0x4d17f4){var _0x4e7c60;if(transfers[_0x61c5('0x7')][_0x4d17f4[_0x61c5('0x8')]]){_0x4e7c60=_0x4d17f4[_0x61c5('0x8')];_0x4d17f4[_0x61c5('0x8')]=transfers[_0x61c5('0x7')][_0x4d17f4[_0x61c5('0x8')]][_0x61c5('0x9')];}utils['info'](util[_0x61c5('0xa')](_0x61c5('0xb'),_0x4d17f4[_0x61c5('0x8')],_0x4d17f4['channel'],_0x4d17f4['queue'],_0x4d17f4[_0x61c5('0xc')],_0x4d17f4[_0x61c5('0xd')],_0x4d17f4['calleridnum'],_0x4d17f4[_0x61c5('0xe')],_0x4d17f4[_0x61c5('0xf')]));if(_0x4d17f4['accountcode']){utils[_0x61c5('0x10')](_0x4d17f4[_0x61c5('0x11')])['then'](function(_0x4d658c){if(_0x4d658c){_0x4d17f4[_0x61c5('0x12')]=_0x4d658c['id'];}utils[_0x61c5('0x13')](_0x61c5('0x14'),_0x4d17f4);});}else{utils[_0x61c5('0x13')]('CreateVoiceCallReport',_0x4d17f4);}if(channels[_0x4d17f4[_0x61c5('0x8')]]){delete channels[_0x4d17f4['uniqueid']];}else if(_0x4e7c60&&channels[_0x4e7c60]){delete transfers['blinds'][_0x4e7c60];delete channels[_0x4e7c60];}}exports[_0x61c5('0x15')]=function(_0x36bf84){try{utils['debug'](util['format'](_0x61c5('0x16'),_0x36bf84[_0x61c5('0x8')]),_0x36bf84);if(_0x36bf84[_0x61c5('0x8')]==_0x36bf84['linkedid']&&_0x36bf84[_0x61c5('0x17')]!='OutgoingSpoolFailed'){utils[_0x61c5('0x18')](util['format'](_0x61c5('0x19'),_0x36bf84[_0x61c5('0x8')],_0x36bf84[_0x61c5('0x1a')],_0x36bf84[_0x61c5('0x1b')]));channels[_0x36bf84['uniqueid']]={'uniqueid':_0x36bf84['uniqueid'],'accountcode':_0x36bf84[_0x61c5('0x11')],'source':_0x36bf84[_0x61c5('0x1c')],'destination':_0x36bf84['exten'],'destinationcontext':_0x36bf84[_0x61c5('0x1a')],'channel':_0x36bf84['channel'],'starttime':utils[_0x61c5('0x1d')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x61c5('0x3'),'amaflags':_0x61c5('0x1e')};}}catch(_0x1db907){utils['error'](util[_0x61c5('0xa')](_0x61c5('0x16'),_0x36bf84['uniqueid']),_0x1db907);}};exports[_0x61c5('0x1f')]=function(_0x345f28){try{utils['debug'](util[_0x61c5('0xa')](_0x61c5('0x20'),_0x345f28[_0x61c5('0x8')]),_0x345f28);if(!_['isNil'](channels[_0x345f28['uniqueid']])&&_0x345f28[_0x61c5('0x21')]==0x6){utils[_0x61c5('0x18')](util['format'](_0x61c5('0x22'),_0x345f28[_0x61c5('0x8')],_0x345f28[_0x61c5('0x1a')],_0x345f28[_0x61c5('0x17')]));if(_['isNil'](channels[_0x345f28[_0x61c5('0x8')]][_0x61c5('0x23')])){channels[_0x345f28['uniqueid']]['systemanswertime']=utils[_0x61c5('0x1d')]();}}else if(!_[_0x61c5('0x24')](channels[_0x345f28[_0x61c5('0x25')]])&&_0x345f28[_0x61c5('0x21')]==0x6&&_0x345f28['context']!=_0x61c5('0x26')){utils[_0x61c5('0x18')](util[_0x61c5('0xa')](_0x61c5('0x27'),_0x345f28[_0x61c5('0x8')],_0x345f28['linkedid'],_0x345f28['context'],_0x345f28['channel']));channels[_0x345f28[_0x61c5('0x25')]][_0x61c5('0x11')]=_0x345f28[_0x61c5('0x11')];channels[_0x345f28[_0x61c5('0x25')]]['destinationchannel']=_0x345f28[_0x61c5('0x17')];if(_['isNil'](channels[_0x345f28[_0x61c5('0x25')]][_0x61c5('0x28')])){channels[_0x345f28[_0x61c5('0x25')]][_0x61c5('0x28')]=utils[_0x61c5('0x1d')]();}channels[_0x345f28['linkedid']]['disposition']=dispositions[_['toNumber'](_0x345f28[_0x61c5('0x21')])]||_0x61c5('0x5');}}catch(_0x33bdab){utils[_0x61c5('0x29')](util[_0x61c5('0xa')](_0x61c5('0x20'),_0x345f28[_0x61c5('0x8')]),_0x33bdab);}};exports[_0x61c5('0x2a')]=function(_0x488ed7){try{if(!_[_0x61c5('0x24')](channels[_0x488ed7[_0x61c5('0x8')]])){utils['debug'](util[_0x61c5('0xa')](_0x61c5('0x2b'),_0x488ed7[_0x61c5('0x8')]),_0x488ed7);if(_[_0x61c5('0x24')](channels[_0x488ed7[_0x61c5('0x8')]][_0x61c5('0x2c')])){channels[_0x488ed7[_0x61c5('0x8')]]['callerid']=_0x488ed7[_0x61c5('0x2d')]+'\x20<'+_0x488ed7[_0x61c5('0x1c')]+'>';}utils[_0x61c5('0x18')](util[_0x61c5('0xa')](_0x61c5('0x2e'),_0x488ed7[_0x61c5('0x8')],channels[_0x488ed7['uniqueid']]['callerid'],_0x488ed7[_0x61c5('0x2f')]));channels[_0x488ed7[_0x61c5('0x8')]][_0x61c5('0x30')]=utils[_0x61c5('0x1d')]();channels[_0x488ed7['uniqueid']][_0x61c5('0x31')]=utils[_0x61c5('0x32')](channels[_0x488ed7['uniqueid']][_0x61c5('0x30')],channels[_0x488ed7[_0x61c5('0x8')]]['starttime']);channels[_0x488ed7['uniqueid']][_0x61c5('0x33')]=channels[_0x488ed7[_0x61c5('0x8')]][_0x61c5('0x28')]?utils['diffTime'](channels[_0x488ed7[_0x61c5('0x8')]]['endtime'],channels[_0x488ed7[_0x61c5('0x8')]][_0x61c5('0x28')]):0x0;writeDB(channels[_0x488ed7['uniqueid']]);}}catch(_0x528737){utils['error'](util[_0x61c5('0xa')](_0x61c5('0x2b'),_0x488ed7[_0x61c5('0x8')]),_0x528737);}};exports[_0x61c5('0x34')]=function(_0x430c68){try{if(!_['isNil'](channels[_0x430c68[_0x61c5('0x35')]])){utils[_0x61c5('0x36')](util[_0x61c5('0xa')]('[%s][calls][attendedtransfer]',_0x430c68['origtransfereruniqueid']),_0x430c68);if(channels[_0x430c68[_0x61c5('0x35')]][_0x61c5('0x17')]==_0x430c68['transfereechannel']){utils[_0x61c5('0x18')](util[_0x61c5('0xa')](_0x61c5('0x37'),_0x430c68[_0x61c5('0x38')],_0x430c68['localtwolinkedid'],_0x430c68[_0x61c5('0x39')]));channels[_0x430c68[_0x61c5('0x35')]][_0x61c5('0x3a')]=_0x430c68[_0x61c5('0x39')];channels[_0x430c68[_0x61c5('0x35')]]['userfield']=_0x61c5('0x3b');}else if(channels[_0x430c68[_0x61c5('0x35')]][_0x61c5('0x17')]=_0x430c68['transfertargetchannel']){utils[_0x61c5('0x18')](util['format'](_0x61c5('0x37'),_0x430c68[_0x61c5('0x38')],_0x430c68[_0x61c5('0x35')],_0x430c68[_0x61c5('0x3c')]));channels[_0x430c68[_0x61c5('0x35')]]['destinationchannel']=_0x430c68[_0x61c5('0x3c')];channels[_0x430c68[_0x61c5('0x35')]][_0x61c5('0x3d')]=_0x61c5('0x3b');}}}catch(_0x442f09){utils[_0x61c5('0x29')](util[_0x61c5('0xa')](_0x61c5('0x3e'),_0x430c68[_0x61c5('0x38')]),_0x442f09);}};exports['musiconholdstart']=function(_0x2ec7af){try{if(!_['isNil'](channels[_0x2ec7af[_0x61c5('0x8')]])){utils[_0x61c5('0x36')](util['format'](_0x61c5('0x3f'),_0x2ec7af[_0x61c5('0x8')]),_0x2ec7af);channels[_0x2ec7af[_0x61c5('0x8')]][_0x61c5('0x40')]=utils[_0x61c5('0x1d')]();utils['info'](util[_0x61c5('0xa')](_0x61c5('0x41'),_0x2ec7af[_0x61c5('0x8')],channels[_0x2ec7af['uniqueid']][_0x61c5('0x40')]));}}catch(_0x4109b9){utils[_0x61c5('0x29')](util['format']('[%s][calls][musiconholdstart]',_0x2ec7af[_0x61c5('0x8')]),_0x4109b9);}};exports[_0x61c5('0x42')]=function(_0x954a30){try{if(!_[_0x61c5('0x24')](channels[_0x954a30['uniqueid']])){utils[_0x61c5('0x36')](util[_0x61c5('0xa')](_0x61c5('0x43'),_0x954a30[_0x61c5('0x8')]),_0x954a30);if(!_[_0x61c5('0x24')](channels[_0x954a30['uniqueid']][_0x61c5('0x40')])){channels[_0x954a30['uniqueid']][_0x61c5('0x44')]+=utils[_0x61c5('0x32')](utils['now'](),channels[_0x954a30[_0x61c5('0x8')]][_0x61c5('0x40')]);utils[_0x61c5('0x18')](util[_0x61c5('0xa')](_0x61c5('0x45'),_0x954a30[_0x61c5('0x8')],channels[_0x954a30[_0x61c5('0x8')]][_0x61c5('0x44')]));delete channels[_0x954a30[_0x61c5('0x8')]][_0x61c5('0x40')];}}}catch(_0x3886b1){utils['error'](util[_0x61c5('0xa')](_0x61c5('0x43'),_0x954a30[_0x61c5('0x8')]),_0x3886b1);}};exports['varset']=function(_0x2e5746){try{if(!_[_0x61c5('0x24')](channels[_0x2e5746[_0x61c5('0x8')]])){utils[_0x61c5('0x36')](util[_0x61c5('0xa')]('[%s][calls][varset]',_0x2e5746[_0x61c5('0x8')]),_0x2e5746);if(!_[_0x61c5('0x24')](_0x2e5746[_0x61c5('0x46')][_0x61c5('0x47')])){utils[_0x61c5('0x18')](util['format'](_0x61c5('0x48'),_0x2e5746[_0x61c5('0x8')],_0x2e5746['value']));channels[_0x2e5746[_0x61c5('0x8')]][_0x61c5('0x49')]=_0x2e5746[_0x61c5('0x4a')];}if(!_[_0x61c5('0x24')](_0x2e5746[_0x61c5('0x46')][_0x61c5('0x4b')])){utils['info'](util[_0x61c5('0xa')]('[%s][calls][varset]\x20variable:xmd-phone\x20value:%s',_0x2e5746[_0x61c5('0x8')],_0x2e5746['value']));channels[_0x2e5746['uniqueid']][_0x61c5('0x4c')]=_0x2e5746[_0x61c5('0x4a')];channels[_0x2e5746[_0x61c5('0x8')]][_0x61c5('0x2c')]='\x22'+_0x2e5746[_0x61c5('0x4a')]+_0x61c5('0x4d')+_0x2e5746[_0x61c5('0x4a')]+'>';}if(!_['isNil'](_0x2e5746[_0x61c5('0x46')][_0x61c5('0x4e')])||!_['isNil'](_0x2e5746['variable'][_0x61c5('0x4f')])){utils[_0x61c5('0x18')](util[_0x61c5('0xa')](_0x61c5('0x50'),_0x2e5746['uniqueid'],!_[_0x61c5('0x24')](_0x2e5746[_0x61c5('0x46')][_0x61c5('0x4e')])?_0x61c5('0x4e'):_0x61c5('0x4f'),_0x2e5746[_0x61c5('0x4a')]));channels[_0x2e5746[_0x61c5('0x8')]][_0x61c5('0x2c')]=_0x2e5746['value'];}if(!_[_0x61c5('0x24')](_0x2e5746[_0x61c5('0x46')]['xmd-queue'])||!_[_0x61c5('0x24')](_0x2e5746[_0x61c5('0x46')][_0x61c5('0x51')])){utils[_0x61c5('0x18')](util['format'](_0x61c5('0x50'),_0x2e5746[_0x61c5('0x8')],!_[_0x61c5('0x24')](_0x2e5746[_0x61c5('0x46')][_0x61c5('0x52')])?_0x61c5('0x52'):_0x61c5('0x51'),_0x2e5746['value']));channels[_0x2e5746[_0x61c5('0x8')]][_0x61c5('0x53')]=_0x61c5('0x54');channels[_0x2e5746['uniqueid']][_0x61c5('0x55')]=_0x2e5746['value'];channels[_0x2e5746[_0x61c5('0x8')]][_0x61c5('0x56')]=!![];}if(!_[_0x61c5('0x24')](_0x2e5746[_0x61c5('0x46')][_0x61c5('0x57')])){utils[_0x61c5('0x18')](util['format']('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x2e5746[_0x61c5('0x8')],_0x2e5746[_0x61c5('0x4a')]));channels[_0x2e5746['uniqueid']][_0x61c5('0x58')]=_0x2e5746[_0x61c5('0x4a')];}if(!_[_0x61c5('0x24')](_0x2e5746['variable'][_0x61c5('0x59')])){utils[_0x61c5('0x18')](util[_0x61c5('0xa')](_0x61c5('0x5a'),_0x2e5746['uniqueid'],_0x2e5746['value']));channels[_0x2e5746[_0x61c5('0x8')]][_0x61c5('0x5b')]=_0x2e5746[_0x61c5('0x4a')];}if(!_[_0x61c5('0x24')](_0x2e5746[_0x61c5('0x46')][_0x61c5('0x5c')])){utils[_0x61c5('0x18')](util['format'](_0x61c5('0x5d'),_0x2e5746['uniqueid'],_0x2e5746[_0x61c5('0x4a')]));channels[_0x2e5746[_0x61c5('0x8')]][_0x61c5('0x5e')]=_0x2e5746['value'];}if(!_['isNil'](_0x2e5746[_0x61c5('0x46')]['sipcallid'])){utils['info'](util[_0x61c5('0xa')](_0x61c5('0x5f'),_0x2e5746['uniqueid'],_0x2e5746['value']));channels[_0x2e5746[_0x61c5('0x8')]]['sipcallid']=_0x2e5746[_0x61c5('0x4a')];}}}catch(_0x3c457a){utils[_0x61c5('0x29')](util[_0x61c5('0xa')]('[%s][calls][varset]',_0x2e5746[_0x61c5('0x8')]),_0x3c457a);}};exports[_0x61c5('0x60')]=function(_0x17a009){try{if(!_[_0x61c5('0x24')](channels[_0x17a009[_0x61c5('0x8')]])){utils[_0x61c5('0x36')](util['format'](_0x61c5('0x61'),_0x17a009['uniqueid']),_0x17a009);utils[_0x61c5('0x18')](util['format']('[%s][calls][newexten]\x20application:%s\x20appdata:%s',_0x17a009['uniqueid'],_0x17a009['application'],_0x17a009['appdata']));if(_0x17a009[_0x61c5('0x62')][_0x61c5('0x63')]()=='set'&&_['startsWith'](_0x17a009[_0x61c5('0x64')][_0x61c5('0x63')](),_0x61c5('0x65'))){var _0x4f0556=_0x17a009[_0x61c5('0x64')][_0x61c5('0x66')]('=');var _0xbdaaaa=_0x4f0556[0x0][_0x61c5('0x67')](_0x4f0556[0x0][_0x61c5('0x68')]('(')+0x1,_0x4f0556[0x0][_0x61c5('0x68')](')'));var _0x4117a1=_0x4f0556[0x1];channels[_0x17a009[_0x61c5('0x8')]][_0xbdaaaa]=_0x4117a1;}if(!_[_0x61c5('0x69')]([_0x61c5('0x2a'),_0x61c5('0x6a'),_0x61c5('0x6b'),_0x61c5('0x6c'),'gotoif'],_0x17a009[_0x61c5('0x62')][_0x61c5('0x63')]())){channels[_0x17a009[_0x61c5('0x8')]][_0x61c5('0x53')]=_0x17a009[_0x61c5('0x62')];channels[_0x17a009[_0x61c5('0x8')]]['lastdata']=_0x17a009[_0x61c5('0x64')];}}}catch(_0x9bc2a){utils['error'](util[_0x61c5('0xa')](_0x61c5('0x61'),_0x17a009['uniqueid']),_0x9bc2a);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 74fcfae..3b468a9 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 _0x2dc6=['[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','[core]\x20connected'];(function(_0x5d5bcb,_0x25e2ea){var _0x4ea5eb=function(_0x36782b){while(--_0x36782b){_0x5d5bcb['push'](_0x5d5bcb['shift']());}};_0x4ea5eb(++_0x25e2ea);}(_0x2dc6,0x173));var _0x62dc=function(_0x26d1f0,_0x1010d7){_0x26d1f0=_0x26d1f0-0x0;var _0x4662c2=_0x2dc6[_0x26d1f0];return _0x4662c2;};'use strict';var utils=require(_0x62dc('0x0'));exports[_0x62dc('0x1')]=function(){utils['info'](_0x62dc('0x2'));};exports['shutdown']=function(){utils['info'](_0x62dc('0x3'));};exports[_0x62dc('0x4')]=function(){utils['info'](_0x62dc('0x5'));};exports[_0x62dc('0x6')]=function(_0x31a8a7){utils[_0x62dc('0x6')](_0x62dc('0x7'),_0x31a8a7);};exports[_0x62dc('0x8')]=function(){utils['info'](_0x62dc('0x9'));};exports[_0x62dc('0xa')]=function(_0x528dc1){}; \ No newline at end of file +var _0xb2cf=['[core]\x20shutdown','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close','[core]\x20close','managerevent','./utils','connect','info','[core]\x20connected','shutdown'];(function(_0x274d4b,_0x128681){var _0x1a1f03=function(_0x420675){while(--_0x420675){_0x274d4b['push'](_0x274d4b['shift']());}};_0x1a1f03(++_0x128681);}(_0xb2cf,0x10c));var _0xfb2c=function(_0x2cebf7,_0x1e0a74){_0x2cebf7=_0x2cebf7-0x0;var _0x47306c=_0xb2cf[_0x2cebf7];return _0x47306c;};'use strict';var utils=require(_0xfb2c('0x0'));exports[_0xfb2c('0x1')]=function(){utils[_0xfb2c('0x2')](_0xfb2c('0x3'));};exports[_0xfb2c('0x4')]=function(){utils['info'](_0xfb2c('0x5'));};exports[_0xfb2c('0x6')]=function(){utils['info'](_0xfb2c('0x7'));};exports[_0xfb2c('0x8')]=function(_0x241d3f){utils[_0xfb2c('0x8')](_0xfb2c('0x9'),_0x241d3f);};exports[_0xfb2c('0xa')]=function(){utils[_0xfb2c('0x2')](_0xfb2c('0xb'));};exports[_0xfb2c('0xc')]=function(_0x46d369){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 5019a88..f9f2a0f 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 _0x761f=['dialend','[%s][dials][dialend]','answertime','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','cause-txt','complete','duration','diffTime','endtime','holdtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','dialstring','calleridnum','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','debug','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','uniqueid','application','appdata','toLowerCase','cdr(routeid)','split','error','varset','[%s][dials][varset]','isNil','variable','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called'];(function(_0x25a42a,_0x3d489b){var _0x1129b1=function(_0x4ae61b){while(--_0x4ae61b){_0x25a42a['push'](_0x25a42a['shift']());}};_0x1129b1(++_0x3d489b);}(_0x761f,0xf3));var _0xf761=function(_0x57a50d,_0x2871f8){_0x57a50d=_0x57a50d-0x0;var _0x1b25b3=_0x761f[_0x57a50d];return _0x1b25b3;};'use strict';var _=require('lodash');var util=require(_0xf761('0x0'));var utils=require(_0xf761('0x1'));var dials={};function writeDB(_0x423d96){utils[_0xf761('0x2')](util[_0xf761('0x3')](_0xf761('0x4'),_0x423d96['uniqueid'],_0x423d96['channel'],_0x423d96[_0xf761('0x5')],_0x423d96[_0xf761('0x6')],_0x423d96[_0xf761('0x7')],_0x423d96[_0xf761('0x8')]));utils[_0xf761('0x9')](_0xf761('0xa'),_0x423d96);delete dials[_0x423d96['uniqueid']];}exports[_0xf761('0xb')]=function(_0xea32c7){try{utils[_0xf761('0xc')](util[_0xf761('0x3')](_0xf761('0xd'),_0xea32c7['uniqueid']),_0xea32c7);utils[_0xf761('0x2')](util[_0xf761('0x3')](_0xf761('0xe'),_0xea32c7[_0xf761('0xf')],_0xea32c7[_0xf761('0x10')],_0xea32c7[_0xf761('0x11')]));if(_0xea32c7[_0xf761('0x10')]['toLowerCase']()=='set'&&_['startsWith'](_0xea32c7[_0xf761('0x11')][_0xf761('0x12')](),_0xf761('0x13'))){var _0x2be55b=_0xea32c7[_0xf761('0x11')][_0xf761('0x14')]('=');dials[_0xea32c7[_0xf761('0xf')]]={'routeId':_0x2be55b[0x1]};}}catch(_0x10b386){utils[_0xf761('0x15')](util[_0xf761('0x3')](_0xf761('0xd'),_0xea32c7[_0xf761('0xf')]),_0x10b386);}};exports[_0xf761('0x16')]=function(_0x84a11b){try{utils[_0xf761('0xc')](util[_0xf761('0x3')](_0xf761('0x17'),_0x84a11b[_0xf761('0xf')]),_0x84a11b);if(!_[_0xf761('0x18')](_0x84a11b[_0xf761('0x19')]['outboundrouteid'])){utils[_0xf761('0x2')](util[_0xf761('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x84a11b[_0xf761('0xf')],_0x84a11b['value']));dials[_0x84a11b[_0xf761('0xf')]]={'routeId':_0x84a11b['value']};}}catch(_0x5db3c4){utils[_0xf761('0x15')](util[_0xf761('0x3')](_0xf761('0x17'),_0x84a11b[_0xf761('0xf')]),_0x5db3c4);}};exports['dialbegin']=function(_0x40179c){try{if(!_[_0xf761('0x18')](dials[_0x40179c['uniqueid']])){utils[_0xf761('0xc')](util[_0xf761('0x3')](_0xf761('0x1a'),_0x40179c[_0xf761('0xf')]),_0x40179c);dials[_0x40179c[_0xf761('0xf')]]=_[_0xf761('0x1b')](dials[_0x40179c['uniqueid']],_0x40179c);dials[_0x40179c[_0xf761('0xf')]][_0xf761('0x1c')]=utils[_0xf761('0x1d')]();dials[_0x40179c[_0xf761('0xf')]][_0xf761('0x1e')]=_0xf761('0x1f');utils[_0xf761('0x2')](util['format'](_0xf761('0x20'),_0x40179c['uniqueid'],dials[_0x40179c[_0xf761('0xf')]][_0xf761('0x1c')]));}}catch(_0xb2e5f9){utils[_0xf761('0x15')](util[_0xf761('0x3')]('[%s][dials][dialbegin]',_0x40179c[_0xf761('0xf')]),_0xb2e5f9);}};exports[_0xf761('0x21')]=function(_0x25a0a0){try{if(!_[_0xf761('0x18')](dials[_0x25a0a0[_0xf761('0xf')]])){utils[_0xf761('0xc')](util[_0xf761('0x3')](_0xf761('0x22'),_0x25a0a0[_0xf761('0xf')]),_0x25a0a0);dials[_0x25a0a0[_0xf761('0xf')]]['dialstatus']=_0x25a0a0[_0xf761('0x8')];if(_0x25a0a0['dialstatus']=='ANSWER'){dials[_0x25a0a0[_0xf761('0xf')]]=_['assign'](dials[_0x25a0a0[_0xf761('0xf')]],_0x25a0a0);dials[_0x25a0a0['uniqueid']][_0xf761('0x23')]=utils[_0xf761('0x1d')]();dials[_0x25a0a0['uniqueid']]['lastevent']=_0xf761('0x24');utils[_0xf761('0x2')](util[_0xf761('0x3')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x25a0a0[_0xf761('0xf')],_0x25a0a0[_0xf761('0x8')],dials[_0x25a0a0[_0xf761('0xf')]][_0xf761('0x23')]));}else{utils[_0xf761('0x2')](util[_0xf761('0x3')](_0xf761('0x25'),_0x25a0a0[_0xf761('0xf')],_0x25a0a0['dialstatus']));}}}catch(_0x33b0e1){utils[_0xf761('0x15')](util[_0xf761('0x3')](_0xf761('0x22'),_0x25a0a0['uniqueid']),_0x33b0e1);}};exports['hangup']=function(_0x51d39a){try{if(!_[_0xf761('0x18')](dials[_0x51d39a[_0xf761('0xf')]])){utils['debug'](util[_0xf761('0x3')](_0xf761('0x26'),_0x51d39a[_0xf761('0xf')]),_0x51d39a);utils[_0xf761('0x2')](util[_0xf761('0x3')]('[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s',_0x51d39a[_0xf761('0xf')],_0x51d39a['calleridnum'],_0x51d39a['calleridname'],_0x51d39a[_0xf761('0x27')]));dials[_0x51d39a['uniqueid']]=_[_0xf761('0x1b')](dials[_0x51d39a[_0xf761('0xf')]],{'endtime':utils[_0xf761('0x1d')](),'lastevent':_0xf761('0x28')});dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x29')]=utils[_0xf761('0x2a')](dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x2b')],dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x1c')]);dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x2c')]=utils['diffTime'](dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x23')]||dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x2b')],dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x1c')]);dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x2d')]=dials[_0x51d39a[_0xf761('0xf')]]['answertime']?utils[_0xf761('0x2a')](dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x2b')],dials[_0x51d39a[_0xf761('0xf')]][_0xf761('0x23')]):0x0;writeDB(dials[_0x51d39a[_0xf761('0xf')]]);}}catch(_0x1eaa78){utils[_0xf761('0x15')](util[_0xf761('0x3')]('[%s][dials][hangup]',_0x51d39a[_0xf761('0xf')]),_0x1eaa78);}}; \ No newline at end of file +var _0xd0a7=['error','varset','[%s][dials][varset]','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','value','isNil','debug','[%s][dials][dialbegin]','starttime','now','lastevent','called','dialend','assign','connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][dialend]','hangup','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','cause-txt','duration','diffTime','endtime','holdtime','answertime','billableseconds','lodash','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus','request','CreateVoiceDialReport','newexten','[%s][dials][newexten]','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','toLowerCase','set','appdata','cdr(routeid)','split'];(function(_0x4e7c11,_0x202003){var _0x1d5f28=function(_0x4c0592){while(--_0x4c0592){_0x4e7c11['push'](_0x4e7c11['shift']());}};_0x1d5f28(++_0x202003);}(_0xd0a7,0x1b5));var _0x7d0a=function(_0xe1f034,_0x9c9b23){_0xe1f034=_0xe1f034-0x0;var _0x3e882e=_0xd0a7[_0xe1f034];return _0x3e882e;};'use strict';var _=require(_0x7d0a('0x0'));var util=require(_0x7d0a('0x1'));var utils=require(_0x7d0a('0x2'));var dials={};function writeDB(_0x515729){utils[_0x7d0a('0x3')](util[_0x7d0a('0x4')](_0x7d0a('0x5'),_0x515729[_0x7d0a('0x6')],_0x515729[_0x7d0a('0x7')],_0x515729[_0x7d0a('0x8')],_0x515729['calleridnum'],_0x515729[_0x7d0a('0x9')],_0x515729[_0x7d0a('0xa')]));utils[_0x7d0a('0xb')](_0x7d0a('0xc'),_0x515729);delete dials[_0x515729[_0x7d0a('0x6')]];}exports[_0x7d0a('0xd')]=function(_0x39f75d){try{utils['debug'](util['format'](_0x7d0a('0xe'),_0x39f75d[_0x7d0a('0x6')]),_0x39f75d);utils[_0x7d0a('0x3')](util[_0x7d0a('0x4')](_0x7d0a('0xf'),_0x39f75d[_0x7d0a('0x6')],_0x39f75d[_0x7d0a('0x10')],_0x39f75d['appdata']));if(_0x39f75d[_0x7d0a('0x10')][_0x7d0a('0x11')]()==_0x7d0a('0x12')&&_['startsWith'](_0x39f75d[_0x7d0a('0x13')][_0x7d0a('0x11')](),_0x7d0a('0x14'))){var _0x301665=_0x39f75d[_0x7d0a('0x13')][_0x7d0a('0x15')]('=');dials[_0x39f75d['uniqueid']]={'routeId':_0x301665[0x1]};}}catch(_0x814987){utils[_0x7d0a('0x16')](util['format'](_0x7d0a('0xe'),_0x39f75d['uniqueid']),_0x814987);}};exports[_0x7d0a('0x17')]=function(_0x2f9eb5){try{utils['debug'](util[_0x7d0a('0x4')](_0x7d0a('0x18'),_0x2f9eb5[_0x7d0a('0x6')]),_0x2f9eb5);if(!_['isNil'](_0x2f9eb5[_0x7d0a('0x19')][_0x7d0a('0x1a')])){utils[_0x7d0a('0x3')](util['format'](_0x7d0a('0x1b'),_0x2f9eb5[_0x7d0a('0x6')],_0x2f9eb5[_0x7d0a('0x1c')]));dials[_0x2f9eb5[_0x7d0a('0x6')]]={'routeId':_0x2f9eb5[_0x7d0a('0x1c')]};}}catch(_0x320814){utils[_0x7d0a('0x16')](util[_0x7d0a('0x4')](_0x7d0a('0x18'),_0x2f9eb5[_0x7d0a('0x6')]),_0x320814);}};exports['dialbegin']=function(_0x187383){try{if(!_[_0x7d0a('0x1d')](dials[_0x187383[_0x7d0a('0x6')]])){utils[_0x7d0a('0x1e')](util['format'](_0x7d0a('0x1f'),_0x187383[_0x7d0a('0x6')]),_0x187383);dials[_0x187383[_0x7d0a('0x6')]]=_['assign'](dials[_0x187383['uniqueid']],_0x187383);dials[_0x187383['uniqueid']][_0x7d0a('0x20')]=utils[_0x7d0a('0x21')]();dials[_0x187383['uniqueid']][_0x7d0a('0x22')]=_0x7d0a('0x23');utils[_0x7d0a('0x3')](util['format']('[%s][dials][hangup]\x20starttime:%s\x20lastevent:called',_0x187383['uniqueid'],dials[_0x187383[_0x7d0a('0x6')]][_0x7d0a('0x20')]));}}catch(_0x3d6ed3){utils[_0x7d0a('0x16')](util[_0x7d0a('0x4')](_0x7d0a('0x1f'),_0x187383[_0x7d0a('0x6')]),_0x3d6ed3);}};exports[_0x7d0a('0x24')]=function(_0x1e5123){try{if(!_[_0x7d0a('0x1d')](dials[_0x1e5123[_0x7d0a('0x6')]])){utils['debug'](util[_0x7d0a('0x4')]('[%s][dials][dialend]',_0x1e5123[_0x7d0a('0x6')]),_0x1e5123);dials[_0x1e5123[_0x7d0a('0x6')]][_0x7d0a('0xa')]=_0x1e5123[_0x7d0a('0xa')];if(_0x1e5123[_0x7d0a('0xa')]=='ANSWER'){dials[_0x1e5123['uniqueid']]=_[_0x7d0a('0x25')](dials[_0x1e5123['uniqueid']],_0x1e5123);dials[_0x1e5123[_0x7d0a('0x6')]]['answertime']=utils['now']();dials[_0x1e5123['uniqueid']]['lastevent']=_0x7d0a('0x26');utils[_0x7d0a('0x3')](util[_0x7d0a('0x4')]('[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect',_0x1e5123[_0x7d0a('0x6')],_0x1e5123[_0x7d0a('0xa')],dials[_0x1e5123[_0x7d0a('0x6')]]['answertime']));}else{utils['info'](util[_0x7d0a('0x4')](_0x7d0a('0x27'),_0x1e5123[_0x7d0a('0x6')],_0x1e5123[_0x7d0a('0xa')]));}}}catch(_0x5cf1f6){utils['error'](util[_0x7d0a('0x4')](_0x7d0a('0x28'),_0x1e5123['uniqueid']),_0x5cf1f6);}};exports[_0x7d0a('0x29')]=function(_0x119149){try{if(!_[_0x7d0a('0x1d')](dials[_0x119149['uniqueid']])){utils[_0x7d0a('0x1e')](util[_0x7d0a('0x4')]('[%s][dials][hangup]',_0x119149[_0x7d0a('0x6')]),_0x119149);utils[_0x7d0a('0x3')](util[_0x7d0a('0x4')](_0x7d0a('0x2a'),_0x119149[_0x7d0a('0x6')],_0x119149['calleridnum'],_0x119149[_0x7d0a('0x2b')],_0x119149[_0x7d0a('0x2c')]));dials[_0x119149[_0x7d0a('0x6')]]=_[_0x7d0a('0x25')](dials[_0x119149[_0x7d0a('0x6')]],{'endtime':utils[_0x7d0a('0x21')](),'lastevent':'complete'});dials[_0x119149[_0x7d0a('0x6')]][_0x7d0a('0x2d')]=utils[_0x7d0a('0x2e')](dials[_0x119149[_0x7d0a('0x6')]][_0x7d0a('0x2f')],dials[_0x119149['uniqueid']][_0x7d0a('0x20')]);dials[_0x119149[_0x7d0a('0x6')]][_0x7d0a('0x30')]=utils[_0x7d0a('0x2e')](dials[_0x119149[_0x7d0a('0x6')]][_0x7d0a('0x31')]||dials[_0x119149[_0x7d0a('0x6')]][_0x7d0a('0x2f')],dials[_0x119149[_0x7d0a('0x6')]][_0x7d0a('0x20')]);dials[_0x119149[_0x7d0a('0x6')]][_0x7d0a('0x32')]=dials[_0x119149['uniqueid']]['answertime']?utils['diffTime'](dials[_0x119149[_0x7d0a('0x6')]][_0x7d0a('0x2f')],dials[_0x119149[_0x7d0a('0x6')]]['answertime']):0x0;writeDB(dials[_0x119149[_0x7d0a('0x6')]]);}}catch(_0x32274e){utils[_0x7d0a('0x16')](util[_0x7d0a('0x4')]('[%s][dials][hangup]',_0x119149[_0x7d0a('0x6')]),_0x32274e);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index bf73fa0..5e0ef48 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 _0xa378=['[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','port','asterisk','username','keepConnected','xdr','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./members.controller','./transfers.controller','./core.controller','connect','shutdown','fullybooted','error','managerevent','devicestatechange','format','[%s][index][devicestatechange]','device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','debug','[%s][index][agentringnoanswer]','[%s][index][agentconnect]','agentconnect','agentcomplete','[%s][index][agentcomplete]','[%s][index][queuecallerabandon]','queuecallerabandon','queuecallerjoin','[%s][index][queuecallerjoin]','[%s][index][queuecallerleave]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','hangup','[%s][index][hangup]','cdr'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xa378,0x14a));var _0x8a37=function(_0x4faf43,_0x103a56){_0x4faf43=_0x4faf43-0x0;var _0x4ada5f=_0xa378[_0x4faf43];return _0x4ada5f;};var AsteriskManager=require(_0x8a37('0x0'));var config=require(_0x8a37('0x1'));var utils=require(_0x8a37('0x2'));var util=require(_0x8a37('0x3'));var ami=new AsteriskManager(config['asterisk'][_0x8a37('0x4')],config[_0x8a37('0x5')]['ip'],config[_0x8a37('0x5')][_0x8a37('0x6')],config[_0x8a37('0x5')]['password'],!![]);ami[_0x8a37('0x7')]();if(config[_0x8a37('0x8')]&&config[_0x8a37('0x8')]['disabled']){utils[_0x8a37('0x9')](_0x8a37('0xa'));}else{var agents=require(_0x8a37('0xb'));var calls=require(_0x8a37('0xc'));var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require(_0x8a37('0xd'));var dials=require('./dials.controller');var transfers=require(_0x8a37('0xe'));var core=require(_0x8a37('0xf'));ami['on']('connect',core[_0x8a37('0x10')]);ami['on'](_0x8a37('0x11'),core[_0x8a37('0x11')]);ami['on'](_0x8a37('0x12'),core[_0x8a37('0x12')]);ami['on']('error',core[_0x8a37('0x13')]);ami['on']('close',core['close']);ami['on'](_0x8a37('0x14'),core[_0x8a37('0x14')]);ami['on'](_0x8a37('0x15'),function(_0x3ae275){try{utils['debug'](util[_0x8a37('0x16')](_0x8a37('0x17'),_0x3ae275[_0x8a37('0x18')]),_0x3ae275);members['devicestatechange'](_0x3ae275);}catch(_0x21dd42){utils[_0x8a37('0x13')](util[_0x8a37('0x16')](_0x8a37('0x17'),_0x3ae275[_0x8a37('0x18')]),_0x21dd42);}});ami['on'](_0x8a37('0x19'),function(_0x5eb491){try{utils['debug'](util[_0x8a37('0x16')](_0x8a37('0x1a'),_0x5eb491[_0x8a37('0x1b')]),_0x5eb491);agents[_0x8a37('0x19')](_0x5eb491);}catch(_0x11f7f6){utils['error'](util[_0x8a37('0x16')](_0x8a37('0x1a'),_0x5eb491[_0x8a37('0x1b')]),_0x11f7f6);}});ami['on'](_0x8a37('0x1c'),function(_0x33e5d0){try{utils[_0x8a37('0x1d')](util[_0x8a37('0x16')](_0x8a37('0x1e'),_0x33e5d0[_0x8a37('0x1b')]),_0x33e5d0);agents['agentringnoanswer'](_0x33e5d0);}catch(_0x422952){utils[_0x8a37('0x13')](util['format'](_0x8a37('0x1e'),_0x33e5d0[_0x8a37('0x1b')]),_0x422952);}});ami['on']('agentconnect',function(_0x1ce1dc){try{utils[_0x8a37('0x1d')](util[_0x8a37('0x16')](_0x8a37('0x1f'),_0x1ce1dc[_0x8a37('0x1b')]),_0x1ce1dc);agents[_0x8a37('0x20')](_0x1ce1dc);queues[_0x8a37('0x20')](_0x1ce1dc);}catch(_0x1507fc){utils['error'](util[_0x8a37('0x16')](_0x8a37('0x1f'),_0x1ce1dc['uniqueid']),_0x1507fc);}});ami['on'](_0x8a37('0x21'),function(_0x41276e){try{utils['debug'](util[_0x8a37('0x16')]('[%s][index][agentcomplete]',_0x41276e['uniqueid']),_0x41276e);agents[_0x8a37('0x21')](_0x41276e);queues[_0x8a37('0x21')](_0x41276e);members['agentcomplete'](_0x41276e);}catch(_0x19a1b){utils[_0x8a37('0x13')](util[_0x8a37('0x16')](_0x8a37('0x22'),_0x41276e[_0x8a37('0x1b')]),_0x19a1b);}});ami['on']('queuecallerabandon',function(_0x3854dc){try{utils['debug'](util['format'](_0x8a37('0x23'),_0x3854dc['uniqueid']),_0x3854dc);agents[_0x8a37('0x24')](_0x3854dc);queues[_0x8a37('0x24')](_0x3854dc);}catch(_0x50a88b){utils[_0x8a37('0x13')](util['format']('[%s][index][queuecallerabandon]',_0x3854dc[_0x8a37('0x1b')]),_0x50a88b);}});ami['on'](_0x8a37('0x25'),function(_0x308ba0){try{utils[_0x8a37('0x1d')](util[_0x8a37('0x16')](_0x8a37('0x26'),_0x308ba0['uniqueid']),_0x308ba0);queues[_0x8a37('0x25')](_0x308ba0);recordings['queuecallerjoin'](_0x308ba0);}catch(_0x4204ee){utils[_0x8a37('0x13')](util[_0x8a37('0x16')](_0x8a37('0x26'),_0x308ba0[_0x8a37('0x1b')]),_0x4204ee);}});ami['on']('queuecallerleave',function(_0x9586ed){try{utils[_0x8a37('0x1d')](util[_0x8a37('0x16')]('[%s][index][queuecallerleave]',_0x9586ed[_0x8a37('0x1b')]),_0x9586ed);queues['queuecallerleave'](_0x9586ed);}catch(_0x18b678){utils[_0x8a37('0x13')](util['format'](_0x8a37('0x27'),_0x9586ed['uniqueid']),_0x18b678);}});ami['on'](_0x8a37('0x28'),function(_0x455a72){try{utils['debug'](util[_0x8a37('0x16')]('[%s][index][musiconholdstart]',_0x455a72['uniqueid']),_0x455a72);queues[_0x8a37('0x28')](_0x455a72);calls['musiconholdstart'](_0x455a72);}catch(_0x2b774b){utils[_0x8a37('0x13')](util[_0x8a37('0x16')]('[%s][index][musiconholdstart]',_0x455a72[_0x8a37('0x1b')]),_0x2b774b);}});ami['on'](_0x8a37('0x29'),function(_0x266427){try{utils['debug'](util[_0x8a37('0x16')](_0x8a37('0x2a'),_0x266427[_0x8a37('0x1b')]),_0x266427);queues[_0x8a37('0x29')](_0x266427);calls[_0x8a37('0x29')](_0x266427);}catch(_0x2900a6){utils[_0x8a37('0x13')](util[_0x8a37('0x16')](_0x8a37('0x2a'),_0x266427[_0x8a37('0x1b')]),_0x2900a6);}});ami['on'](_0x8a37('0x2b'),function(_0x21acd3){try{utils[_0x8a37('0x1d')](util[_0x8a37('0x16')](_0x8a37('0x2c'),_0x21acd3[_0x8a37('0x1b')]),_0x21acd3);calls[_0x8a37('0x2b')](_0x21acd3);recordings[_0x8a37('0x2b')](_0x21acd3);}catch(_0x3a4ef2){utils[_0x8a37('0x13')](util[_0x8a37('0x16')]('[%s][index][newstate]',_0x21acd3[_0x8a37('0x1b')]),_0x3a4ef2);}});ami['on'](_0x8a37('0x2d'),function(_0x59ac50){try{utils['debug'](util['format']('[%s][index][hangup]',_0x59ac50[_0x8a37('0x1b')]),_0x59ac50);calls[_0x8a37('0x2d')](_0x59ac50);recordings[_0x8a37('0x2d')](_0x59ac50);dials[_0x8a37('0x2d')](_0x59ac50);agents[_0x8a37('0x2d')](_0x59ac50);queues[_0x8a37('0x2d')](_0x59ac50);}catch(_0x46b167){utils['error'](util[_0x8a37('0x16')](_0x8a37('0x2e'),_0x59ac50[_0x8a37('0x1b')]),_0x46b167);}});ami['on'](_0x8a37('0x2f'),function(_0x569797){try{utils['debug'](util[_0x8a37('0x16')]('[%s][index][cdr]',_0x569797[_0x8a37('0x1b')]),_0x569797);members[_0x8a37('0x2f')](_0x569797);}catch(_0x2c6d52){utils[_0x8a37('0x13')](util[_0x8a37('0x16')](_0x8a37('0x30'),_0x569797[_0x8a37('0x1b')]),_0x2c6d52);}});ami['on'](_0x8a37('0x31'),function(_0x1fd35f){try{utils['debug'](util['format'](_0x8a37('0x32'),_0x1fd35f[_0x8a37('0x1b')]),_0x1fd35f);queues[_0x8a37('0x31')](_0x1fd35f);agents[_0x8a37('0x31')](_0x1fd35f);transfers[_0x8a37('0x31')](_0x1fd35f);}catch(_0x28fa1a){utils['error'](util['format'](_0x8a37('0x32'),_0x1fd35f[_0x8a37('0x1b')]),_0x28fa1a);}});ami['on'](_0x8a37('0x33'),function(_0x5ca9c6){try{utils[_0x8a37('0x1d')](util[_0x8a37('0x16')](_0x8a37('0x34'),_0x5ca9c6[_0x8a37('0x35')]),_0x5ca9c6);queues[_0x8a37('0x33')](_0x5ca9c6);transfers[_0x8a37('0x33')](_0x5ca9c6);agents[_0x8a37('0x33')](_0x5ca9c6);calls[_0x8a37('0x33')](_0x5ca9c6);}catch(_0x50a17f){utils[_0x8a37('0x13')](util[_0x8a37('0x16')](_0x8a37('0x34'),_0x5ca9c6[_0x8a37('0x35')]),_0x50a17f);}});ami['on'](_0x8a37('0x36'),function(_0x36d75e){try{utils['debug'](util[_0x8a37('0x16')]('[%s][index][varset]',_0x36d75e[_0x8a37('0x1b')]),_0x36d75e);queues[_0x8a37('0x36')](_0x36d75e);recordings[_0x8a37('0x36')](_0x36d75e);calls[_0x8a37('0x36')](_0x36d75e);dials[_0x8a37('0x36')](_0x36d75e);}catch(_0x38c7e0){utils['error'](util[_0x8a37('0x16')](_0x8a37('0x37'),_0x36d75e['uniqueid']),_0x38c7e0);}});ami['on'](_0x8a37('0x38'),function(_0x34c720){try{utils['debug'](util[_0x8a37('0x16')](_0x8a37('0x39'),_0x34c720[_0x8a37('0x1b')]),_0x34c720);calls['newexten'](_0x34c720);recordings[_0x8a37('0x38')](_0x34c720);dials[_0x8a37('0x38')](_0x34c720);}catch(_0x40f534){utils[_0x8a37('0x13')](util[_0x8a37('0x16')]('[%s][index][newexten]',_0x34c720[_0x8a37('0x1b')]),_0x40f534);}});ami['on'](_0x8a37('0x3a'),function(_0x3bc32b){try{utils['debug'](util[_0x8a37('0x16')](_0x8a37('0x3b'),_0x3bc32b[_0x8a37('0x1b')]),_0x3bc32b);calls[_0x8a37('0x3a')](_0x3bc32b);recordings['newchannel'](_0x3bc32b);}catch(_0x5bda0e){utils[_0x8a37('0x13')](util[_0x8a37('0x16')](_0x8a37('0x3b'),_0x3bc32b[_0x8a37('0x1b')]),_0x5bda0e);}});ami['on'](_0x8a37('0x3c'),function(_0x481f81){try{utils[_0x8a37('0x1d')](util[_0x8a37('0x16')]('[%s][index][dialbegin]',_0x481f81[_0x8a37('0x1b')]),_0x481f81);dials[_0x8a37('0x3c')](_0x481f81);}catch(_0x52b36f){utils['error'](util[_0x8a37('0x16')]('[%s]dialbegin',_0x481f81[_0x8a37('0x1b')]),_0x52b36f);}});ami['on'](_0x8a37('0x3d'),function(_0x391641){try{utils['debug'](util[_0x8a37('0x16')](_0x8a37('0x3e'),_0x391641[_0x8a37('0x1b')]),_0x391641);dials[_0x8a37('0x3d')](_0x391641);}catch(_0x40e61d){utils[_0x8a37('0x13')](util[_0x8a37('0x16')](_0x8a37('0x3e'),_0x391641[_0x8a37('0x1b')]),_0x40e61d);}});} \ No newline at end of file +var _0x28a0=['device','agentcalled','[%s][index][agentcalled]','uniqueid','agentringnoanswer','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','[%s][index][agentcomplete]','queuecallerabandon','[%s][index][queuecallerabandon]','[%s][index][queuecallerjoin]','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','[%s][index][varset]','varset','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','dialbegin','[%s][index][dialbegin]','[%s]dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','asterisk','port','password','keepConnected','xdr','disabled','info','XDR\x20DISABLED','./agents.controller','./calls.controller','./queues.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','connect','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]'];(function(_0x10a00b,_0x2a3c2a){var _0x349213=function(_0x518421){while(--_0x518421){_0x10a00b['push'](_0x10a00b['shift']());}};_0x349213(++_0x2a3c2a);}(_0x28a0,0xff));var _0x028a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x28a0[_0x2b4411];return _0x8e41ef;};var AsteriskManager=require(_0x028a('0x0'));var config=require(_0x028a('0x1'));var utils=require(_0x028a('0x2'));var util=require(_0x028a('0x3'));var ami=new AsteriskManager(config[_0x028a('0x4')][_0x028a('0x5')],config[_0x028a('0x4')]['ip'],config[_0x028a('0x4')]['username'],config[_0x028a('0x4')][_0x028a('0x6')],!![]);ami[_0x028a('0x7')]();if(config[_0x028a('0x8')]&&config[_0x028a('0x8')][_0x028a('0x9')]){utils[_0x028a('0xa')](_0x028a('0xb'));}else{var agents=require(_0x028a('0xc'));var calls=require(_0x028a('0xd'));var queues=require(_0x028a('0xe'));var recordings=require(_0x028a('0xf'));var members=require(_0x028a('0x10'));var dials=require(_0x028a('0x11'));var transfers=require(_0x028a('0x12'));var core=require('./core.controller');ami['on']('connect',core[_0x028a('0x13')]);ami['on']('shutdown',core[_0x028a('0x14')]);ami['on'](_0x028a('0x15'),core[_0x028a('0x15')]);ami['on'](_0x028a('0x16'),core[_0x028a('0x16')]);ami['on'](_0x028a('0x17'),core[_0x028a('0x17')]);ami['on'](_0x028a('0x18'),core[_0x028a('0x18')]);ami['on'](_0x028a('0x19'),function(_0x535f8e){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x1c'),_0x535f8e[_0x028a('0x1d')]),_0x535f8e);members[_0x028a('0x19')](_0x535f8e);}catch(_0x3677c4){utils['error'](util[_0x028a('0x1b')](_0x028a('0x1c'),_0x535f8e[_0x028a('0x1d')]),_0x3677c4);}});ami['on'](_0x028a('0x1e'),function(_0x270698){try{utils[_0x028a('0x1a')](util['format'](_0x028a('0x1f'),_0x270698[_0x028a('0x20')]),_0x270698);agents[_0x028a('0x1e')](_0x270698);}catch(_0x34b4ec){utils[_0x028a('0x16')](util[_0x028a('0x1b')](_0x028a('0x1f'),_0x270698[_0x028a('0x20')]),_0x34b4ec);}});ami['on'](_0x028a('0x21'),function(_0x4e8aa2){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x22'),_0x4e8aa2[_0x028a('0x20')]),_0x4e8aa2);agents[_0x028a('0x21')](_0x4e8aa2);}catch(_0x4d9a23){utils[_0x028a('0x16')](util[_0x028a('0x1b')](_0x028a('0x22'),_0x4e8aa2[_0x028a('0x20')]),_0x4d9a23);}});ami['on'](_0x028a('0x23'),function(_0x4f17fd){try{utils[_0x028a('0x1a')](util['format'](_0x028a('0x24'),_0x4f17fd[_0x028a('0x20')]),_0x4f17fd);agents['agentconnect'](_0x4f17fd);queues[_0x028a('0x23')](_0x4f17fd);}catch(_0x195ba7){utils[_0x028a('0x16')](util[_0x028a('0x1b')]('[%s][index][agentconnect]',_0x4f17fd[_0x028a('0x20')]),_0x195ba7);}});ami['on'](_0x028a('0x25'),function(_0x5ec5bd){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')]('[%s][index][agentcomplete]',_0x5ec5bd[_0x028a('0x20')]),_0x5ec5bd);agents[_0x028a('0x25')](_0x5ec5bd);queues['agentcomplete'](_0x5ec5bd);members[_0x028a('0x25')](_0x5ec5bd);}catch(_0x136c01){utils[_0x028a('0x16')](util[_0x028a('0x1b')](_0x028a('0x26'),_0x5ec5bd[_0x028a('0x20')]),_0x136c01);}});ami['on'](_0x028a('0x27'),function(_0xe60e78){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x28'),_0xe60e78['uniqueid']),_0xe60e78);agents[_0x028a('0x27')](_0xe60e78);queues['queuecallerabandon'](_0xe60e78);}catch(_0x342909){utils['error'](util[_0x028a('0x1b')](_0x028a('0x28'),_0xe60e78[_0x028a('0x20')]),_0x342909);}});ami['on']('queuecallerjoin',function(_0x1d477e){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x29'),_0x1d477e[_0x028a('0x20')]),_0x1d477e);queues['queuecallerjoin'](_0x1d477e);recordings[_0x028a('0x2a')](_0x1d477e);}catch(_0x5935df){utils['error'](util['format'](_0x028a('0x29'),_0x1d477e[_0x028a('0x20')]),_0x5935df);}});ami['on'](_0x028a('0x2b'),function(_0x4f95c1){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x2c'),_0x4f95c1[_0x028a('0x20')]),_0x4f95c1);queues[_0x028a('0x2b')](_0x4f95c1);}catch(_0x3860f0){utils[_0x028a('0x16')](util['format'](_0x028a('0x2c'),_0x4f95c1[_0x028a('0x20')]),_0x3860f0);}});ami['on']('musiconholdstart',function(_0x2dd696){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x2d'),_0x2dd696['uniqueid']),_0x2dd696);queues['musiconholdstart'](_0x2dd696);calls[_0x028a('0x2e')](_0x2dd696);}catch(_0x2d1107){utils[_0x028a('0x16')](util[_0x028a('0x1b')](_0x028a('0x2d'),_0x2dd696[_0x028a('0x20')]),_0x2d1107);}});ami['on'](_0x028a('0x2f'),function(_0x3910fe){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x30'),_0x3910fe['uniqueid']),_0x3910fe);queues[_0x028a('0x2f')](_0x3910fe);calls[_0x028a('0x2f')](_0x3910fe);}catch(_0x2c17eb){utils['error'](util[_0x028a('0x1b')](_0x028a('0x30'),_0x3910fe[_0x028a('0x20')]),_0x2c17eb);}});ami['on'](_0x028a('0x31'),function(_0x3f4404){try{utils[_0x028a('0x1a')](util['format']('[%s][index][newstate]',_0x3f4404[_0x028a('0x20')]),_0x3f4404);calls[_0x028a('0x31')](_0x3f4404);recordings['newstate'](_0x3f4404);}catch(_0x4993f0){utils[_0x028a('0x16')](util['format'](_0x028a('0x32'),_0x3f4404[_0x028a('0x20')]),_0x4993f0);}});ami['on'](_0x028a('0x33'),function(_0x22c809){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x34'),_0x22c809[_0x028a('0x20')]),_0x22c809);calls['hangup'](_0x22c809);recordings[_0x028a('0x33')](_0x22c809);dials[_0x028a('0x33')](_0x22c809);agents[_0x028a('0x33')](_0x22c809);queues['hangup'](_0x22c809);}catch(_0xa13f83){utils['error'](util[_0x028a('0x1b')](_0x028a('0x34'),_0x22c809['uniqueid']),_0xa13f83);}});ami['on'](_0x028a('0x35'),function(_0xf82881){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x36'),_0xf82881['uniqueid']),_0xf82881);members[_0x028a('0x35')](_0xf82881);}catch(_0x11fefd){utils[_0x028a('0x16')](util['format'](_0x028a('0x36'),_0xf82881['uniqueid']),_0x11fefd);}});ami['on'](_0x028a('0x37'),function(_0x230585){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')]('[%s][index][blindtransfer]',_0x230585[_0x028a('0x20')]),_0x230585);queues[_0x028a('0x37')](_0x230585);agents[_0x028a('0x37')](_0x230585);transfers[_0x028a('0x37')](_0x230585);}catch(_0x650ebe){utils[_0x028a('0x16')](util[_0x028a('0x1b')](_0x028a('0x38'),_0x230585[_0x028a('0x20')]),_0x650ebe);}});ami['on'](_0x028a('0x39'),function(_0x178455){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x3a'),_0x178455[_0x028a('0x3b')]),_0x178455);queues['attendedtransfer'](_0x178455);transfers[_0x028a('0x39')](_0x178455);agents[_0x028a('0x39')](_0x178455);calls['attendedtransfer'](_0x178455);}catch(_0x2df07b){utils[_0x028a('0x16')](util['format'](_0x028a('0x3a'),_0x178455['origtransfereruniqueid']),_0x2df07b);}});ami['on']('varset',function(_0x4c412b){try{utils[_0x028a('0x1a')](util['format'](_0x028a('0x3c'),_0x4c412b[_0x028a('0x20')]),_0x4c412b);queues[_0x028a('0x3d')](_0x4c412b);recordings['varset'](_0x4c412b);calls['varset'](_0x4c412b);dials[_0x028a('0x3d')](_0x4c412b);}catch(_0xb4bb64){utils[_0x028a('0x16')](util[_0x028a('0x1b')]('[%s][index][varset]',_0x4c412b[_0x028a('0x20')]),_0xb4bb64);}});ami['on'](_0x028a('0x3e'),function(_0x2ed961){try{utils['debug'](util[_0x028a('0x1b')](_0x028a('0x3f'),_0x2ed961[_0x028a('0x20')]),_0x2ed961);calls[_0x028a('0x3e')](_0x2ed961);recordings[_0x028a('0x3e')](_0x2ed961);dials[_0x028a('0x3e')](_0x2ed961);}catch(_0x4a38c3){utils['error'](util[_0x028a('0x1b')](_0x028a('0x3f'),_0x2ed961['uniqueid']),_0x4a38c3);}});ami['on'](_0x028a('0x40'),function(_0x131b53){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')](_0x028a('0x41'),_0x131b53[_0x028a('0x20')]),_0x131b53);calls[_0x028a('0x40')](_0x131b53);recordings['newchannel'](_0x131b53);}catch(_0x51d705){utils['error'](util[_0x028a('0x1b')]('[%s][index][newchannel]',_0x131b53[_0x028a('0x20')]),_0x51d705);}});ami['on'](_0x028a('0x42'),function(_0x2486bc){try{utils[_0x028a('0x1a')](util['format'](_0x028a('0x43'),_0x2486bc[_0x028a('0x20')]),_0x2486bc);dials[_0x028a('0x42')](_0x2486bc);}catch(_0xe878dc){utils[_0x028a('0x16')](util[_0x028a('0x1b')](_0x028a('0x44'),_0x2486bc[_0x028a('0x20')]),_0xe878dc);}});ami['on'](_0x028a('0x45'),function(_0x207cbf){try{utils[_0x028a('0x1a')](util[_0x028a('0x1b')]('[%s][index][dialend]',_0x207cbf[_0x028a('0x20')]),_0x207cbf);dials[_0x028a('0x45')](_0x207cbf);}catch(_0x3ad838){utils[_0x028a('0x16')](util[_0x028a('0x1b')](_0x028a('0x46'),_0x207cbf[_0x028a('0x20')]),_0x3ad838);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 68141e5..bc556f6 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 _0xde94=['[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data1','source','data3','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','lodash','util','./utils','Local/_attended@transfer','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','channel','data2','membername','interface','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','split','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','TALKING','now','agent','NOT_INUSE','isNil','exitAt','diffTime','agentcomplete','debug','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign'];(function(_0x5c51cc,_0x37d5b0){var _0x1833bb=function(_0x204a09){while(--_0x204a09){_0x5c51cc['push'](_0x5c51cc['shift']());}};_0x1833bb(++_0x37d5b0);}(_0xde94,0x134));var _0x4de9=function(_0x5b8d6f,_0xb4aad1){_0x5b8d6f=_0x5b8d6f-0x0;var _0xace7d4=_0xde94[_0x5b8d6f];return _0xace7d4;};'use strict';var _=require(_0x4de9('0x0'));var util=require(_0x4de9('0x1'));var utils=require(_0x4de9('0x2'));var members={};var exclude=[_0x4de9('0x3'),_0x4de9('0x4')];function writeDB(_0x3d379d){utils[_0x4de9('0x5')](util[_0x4de9('0x6')](_0x4de9('0x7'),_0x3d379d[_0x4de9('0x8')],_0x3d379d['interface'],_0x3d379d[_0x4de9('0x9')],_0x3d379d[_0x4de9('0xa')],_0x3d379d[_0x4de9('0xb')],_0x3d379d['type']));if(_0x3d379d[_0x4de9('0xc')]){utils[_0x4de9('0xd')](_0x3d379d['interface'])[_0x4de9('0xe')](function(_0x51a8a7){if(_0x51a8a7){_0x3d379d[_0x4de9('0xb')]=_0x51a8a7[_0x4de9('0xf')];_0x3d379d['internal']=_0x51a8a7[_0x4de9('0x10')];utils[_0x4de9('0x11')](_0x4de9('0x12'),_0x3d379d);}else{utils[_0x4de9('0x13')](_0x3d379d[_0x4de9('0xc')][_0x4de9('0x14')]('/')[0x1])['then'](function(_0x51c4af){if(_0x51c4af){_0x3d379d[_0x4de9('0xb')]=_0x51c4af[_0x4de9('0xf')];_0x3d379d[_0x4de9('0x10')]=_0x51c4af[_0x4de9('0x10')];utils['request'](_0x4de9('0x12'),_0x3d379d);}});}})[_0x4de9('0x15')](function(_0x38f10f){utils[_0x4de9('0x16')](util[_0x4de9('0x6')](_0x4de9('0x17'),_0x3d379d['uniqueid']),_0x38f10f);});}delete members[_0x3d379d['interface']];}function startsWith(_0xa3dd05,_0x1e6bcc){return _[_0x4de9('0x18')](_0xa3dd05,function(_0x1ae2b5){return _[_0x4de9('0x19')](_0x1e6bcc,_0x1ae2b5);});}exports[_0x4de9('0x1a')]=function(_0x5371b1){try{utils['debug'](util[_0x4de9('0x6')](_0x4de9('0x1b'),members[_0x5371b1[_0x4de9('0x1c')]]?members[_0x5371b1[_0x4de9('0x1c')]][_0x4de9('0x8')]:_0x5371b1['device']),_0x5371b1);utils[_0x4de9('0x5')](util['format'](_0x4de9('0x1d'),members[_0x5371b1[_0x4de9('0x1c')]]?members[_0x5371b1[_0x4de9('0x1c')]][_0x4de9('0x8')]:_0x5371b1[_0x4de9('0x1c')],_0x5371b1[_0x4de9('0x1e')],_0x5371b1[_0x4de9('0x1c')]));switch(_0x5371b1[_0x4de9('0x1e')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x5371b1[_0x4de9('0x1c')])){members[_0x5371b1[_0x4de9('0x1c')]]={'channel':'voice','interface':_0x5371b1['device'],'type':_0x4de9('0x1f'),'enterAt':utils[_0x4de9('0x20')](),'role':_0x4de9('0x21')};}break;case _0x4de9('0x22'):if(!_[_0x4de9('0x23')](members[_0x5371b1[_0x4de9('0x1c')]])){members[_0x5371b1['device']][_0x4de9('0x24')]=utils[_0x4de9('0x20')]();members[_0x5371b1[_0x4de9('0x1c')]]['duration']=utils[_0x4de9('0x25')](members[_0x5371b1[_0x4de9('0x1c')]][_0x4de9('0x24')],members[_0x5371b1['device']]['enterAt']);if(members[_0x5371b1[_0x4de9('0x1c')]][_0x4de9('0x8')]){writeDB(members[_0x5371b1['device']]);}}break;default:break;}}catch(_0x873dc6){utils[_0x4de9('0x16')](util[_0x4de9('0x6')]('[%s][members][devicestatechange]',members[_0x5371b1['device']]?members[_0x5371b1[_0x4de9('0x1c')]][_0x4de9('0x8')]:_0x5371b1['device']),_0x873dc6);}};exports[_0x4de9('0x26')]=function(_0x222099){try{if(!_['isNil'](members[_0x222099['interface']])){utils[_0x4de9('0x27')](util[_0x4de9('0x6')]('[%s][members][agentcomplete]',_0x222099[_0x4de9('0x8')]),_0x222099);utils[_0x4de9('0x5')](util[_0x4de9('0x6')](_0x4de9('0x28'),_0x222099[_0x4de9('0x8')],_0x222099['interface'],_0x222099['queue']));members[_0x222099['interface']]=_[_0x4de9('0x29')](members[_0x222099[_0x4de9('0xc')]],{'data4':_0x222099['queue'],'uniqueid':_0x222099[_0x4de9('0x8')]});}}catch(_0x41c377){utils[_0x4de9('0x16')](util[_0x4de9('0x6')](_0x4de9('0x2a'),_0x222099['uniqueid']),_0x41c377);}};exports[_0x4de9('0x2b')]=function(_0x1eef1d){try{utils[_0x4de9('0x27')](util['format'](_0x4de9('0x2c'),_0x1eef1d[_0x4de9('0x8')]),_0x1eef1d);if(_0x1eef1d[_0x4de9('0x9')]){var _0x3b2349=_0x1eef1d[_0x4de9('0x9')][_0x4de9('0x14')]('-')[0x0];if(!_[_0x4de9('0x23')](members[_0x3b2349])){members[_0x3b2349]=_['assign'](members[_0x3b2349],{'data1':members[_0x3b2349][_0x4de9('0x2d')]||_0x1eef1d['type'],'data2':members[_0x3b2349][_0x4de9('0xa')]||_0x1eef1d[_0x4de9('0x2e')],'data3':members[_0x3b2349][_0x4de9('0x2f')]||_0x1eef1d['destination'],'uniqueid':members[_0x3b2349]['uniqueid']||_0x1eef1d[_0x4de9('0x8')]});utils[_0x4de9('0x5')](util['format'](_0x4de9('0x30'),_0x1eef1d[_0x4de9('0x8')],members[_0x3b2349][_0x4de9('0x2d')],members[_0x3b2349][_0x4de9('0xa')],members[_0x3b2349][_0x4de9('0x2f')]));if(members[_0x3b2349][_0x4de9('0x24')]){writeDB(members[_0x3b2349]);}}}if(_0x1eef1d[_0x4de9('0x31')]){var _0x4d59fd=_0x1eef1d[_0x4de9('0x31')][_0x4de9('0x14')]('-')[0x0];if(!_[_0x4de9('0x23')](members[_0x4d59fd])){members[_0x4d59fd]=_[_0x4de9('0x29')](members[_0x4d59fd],{'data1':members[_0x4d59fd][_0x4de9('0x2d')]||_0x1eef1d['type'],'data2':members[_0x4d59fd][_0x4de9('0xa')]||_0x1eef1d[_0x4de9('0x2e')],'data3':members[_0x4d59fd][_0x4de9('0x2f')]||_0x1eef1d['destination'],'uniqueid':members[_0x4d59fd][_0x4de9('0x8')]||_0x1eef1d['uniqueid']});utils['info'](util[_0x4de9('0x6')](_0x4de9('0x30'),_0x1eef1d[_0x4de9('0x8')],members[_0x4d59fd][_0x4de9('0x2d')],members[_0x4d59fd][_0x4de9('0xa')],members[_0x4d59fd][_0x4de9('0x2f')]));if(members[_0x4d59fd][_0x4de9('0x24')]){writeDB(members[_0x4d59fd]);}}}}catch(_0x1e6807){utils[_0x4de9('0x16')](util['format'](_0x4de9('0x2c'),_0x1eef1d[_0x4de9('0x8')]),_0x1e6807);}}; \ No newline at end of file +var _0xd5fe=['data2','membername','type','interface','getUserByInterface','name','internal','request','getUserByName','split','then','CreateMemberReport','catch','error','format','[%s][members][writeDB]','some','startsWith','debug','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','NOT_INUSE','isNil','exitAt','duration','diffTime','enterAt','[%s][members][devicestatechange]','agentcomplete','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','cdr','channel','data1','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','destinationchannel','data3','destination','lodash','util','Local/_attended@transfer','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid'];(function(_0x17aa64,_0x1b6f20){var _0x44daa4=function(_0x5121da){while(--_0x5121da){_0x17aa64['push'](_0x17aa64['shift']());}};_0x44daa4(++_0x1b6f20);}(_0xd5fe,0x1ab));var _0xed5f=function(_0x266618,_0x18f637){_0x266618=_0x266618-0x0;var _0x54dbf5=_0xd5fe[_0x266618];return _0x54dbf5;};'use strict';var _=require(_0xed5f('0x0'));var util=require(_0xed5f('0x1'));var utils=require('./utils');var members={};var exclude=[_0xed5f('0x2'),'Queue:'];function writeDB(_0x1d5b5b){utils['info'](util['format'](_0xed5f('0x3'),_0x1d5b5b[_0xed5f('0x4')],_0x1d5b5b['interface'],_0x1d5b5b['channel'],_0x1d5b5b[_0xed5f('0x5')],_0x1d5b5b[_0xed5f('0x6')],_0x1d5b5b[_0xed5f('0x7')]));if(_0x1d5b5b[_0xed5f('0x8')]){utils[_0xed5f('0x9')](_0x1d5b5b[_0xed5f('0x8')])['then'](function(_0xf9ac71){if(_0xf9ac71){_0x1d5b5b['membername']=_0xf9ac71[_0xed5f('0xa')];_0x1d5b5b['internal']=_0xf9ac71[_0xed5f('0xb')];utils[_0xed5f('0xc')]('CreateMemberReport',_0x1d5b5b);}else{utils[_0xed5f('0xd')](_0x1d5b5b[_0xed5f('0x8')][_0xed5f('0xe')]('/')[0x1])[_0xed5f('0xf')](function(_0x538a56){if(_0x538a56){_0x1d5b5b[_0xed5f('0x6')]=_0x538a56[_0xed5f('0xa')];_0x1d5b5b[_0xed5f('0xb')]=_0x538a56[_0xed5f('0xb')];utils['request'](_0xed5f('0x10'),_0x1d5b5b);}});}})[_0xed5f('0x11')](function(_0x19ac7b){utils[_0xed5f('0x12')](util[_0xed5f('0x13')](_0xed5f('0x14'),_0x1d5b5b[_0xed5f('0x4')]),_0x19ac7b);});}delete members[_0x1d5b5b[_0xed5f('0x8')]];}function startsWith(_0x229f3b,_0x2f8210){return _[_0xed5f('0x15')](_0x229f3b,function(_0x339e09){return _[_0xed5f('0x16')](_0x2f8210,_0x339e09);});}exports['devicestatechange']=function(_0x1ff354){try{utils[_0xed5f('0x17')](util[_0xed5f('0x13')]('[%s][members][devicestatechange]',members[_0x1ff354[_0xed5f('0x18')]]?members[_0x1ff354[_0xed5f('0x18')]][_0xed5f('0x4')]:_0x1ff354['device']),_0x1ff354);utils[_0xed5f('0x19')](util[_0xed5f('0x13')](_0xed5f('0x1a'),members[_0x1ff354[_0xed5f('0x18')]]?members[_0x1ff354[_0xed5f('0x18')]][_0xed5f('0x4')]:_0x1ff354['device'],_0x1ff354[_0xed5f('0x1b')],_0x1ff354['device']));switch(_0x1ff354[_0xed5f('0x1b')]){case'INUSE':case'BUSY':if(!startsWith(exclude,_0x1ff354[_0xed5f('0x18')])){members[_0x1ff354[_0xed5f('0x18')]]={'channel':'voice','interface':_0x1ff354[_0xed5f('0x18')],'type':'TALKING','enterAt':utils['now'](),'role':'agent'};}break;case _0xed5f('0x1c'):if(!_[_0xed5f('0x1d')](members[_0x1ff354[_0xed5f('0x18')]])){members[_0x1ff354[_0xed5f('0x18')]][_0xed5f('0x1e')]=utils['now']();members[_0x1ff354[_0xed5f('0x18')]][_0xed5f('0x1f')]=utils[_0xed5f('0x20')](members[_0x1ff354[_0xed5f('0x18')]][_0xed5f('0x1e')],members[_0x1ff354[_0xed5f('0x18')]][_0xed5f('0x21')]);if(members[_0x1ff354[_0xed5f('0x18')]][_0xed5f('0x4')]){writeDB(members[_0x1ff354[_0xed5f('0x18')]]);}}break;default:break;}}catch(_0x212b2b){utils['error'](util[_0xed5f('0x13')](_0xed5f('0x22'),members[_0x1ff354[_0xed5f('0x18')]]?members[_0x1ff354[_0xed5f('0x18')]]['uniqueid']:_0x1ff354['device']),_0x212b2b);}};exports[_0xed5f('0x23')]=function(_0x2883db){try{if(!_[_0xed5f('0x1d')](members[_0x2883db[_0xed5f('0x8')]])){utils[_0xed5f('0x17')](util[_0xed5f('0x13')](_0xed5f('0x24'),_0x2883db[_0xed5f('0x4')]),_0x2883db);utils[_0xed5f('0x19')](util[_0xed5f('0x13')](_0xed5f('0x25'),_0x2883db['uniqueid'],_0x2883db[_0xed5f('0x8')],_0x2883db[_0xed5f('0x26')]));members[_0x2883db[_0xed5f('0x8')]]=_[_0xed5f('0x27')](members[_0x2883db['interface']],{'data4':_0x2883db[_0xed5f('0x26')],'uniqueid':_0x2883db[_0xed5f('0x4')]});}}catch(_0x515fbc){utils[_0xed5f('0x12')](util['format'](_0xed5f('0x24'),_0x2883db[_0xed5f('0x4')]),_0x515fbc);}};exports[_0xed5f('0x28')]=function(_0x517d19){try{utils['debug'](util[_0xed5f('0x13')]('[%s][members][cdr]',_0x517d19[_0xed5f('0x4')]),_0x517d19);if(_0x517d19[_0xed5f('0x29')]){var _0xa71818=_0x517d19['channel'][_0xed5f('0xe')]('-')[0x0];if(!_[_0xed5f('0x1d')](members[_0xa71818])){members[_0xa71818]=_['assign'](members[_0xa71818],{'data1':members[_0xa71818][_0xed5f('0x2a')]||_0x517d19['type'],'data2':members[_0xa71818][_0xed5f('0x5')]||_0x517d19[_0xed5f('0x2b')],'data3':members[_0xa71818]['data3']||_0x517d19['destination'],'uniqueid':members[_0xa71818]['uniqueid']||_0x517d19[_0xed5f('0x4')]});utils[_0xed5f('0x19')](util['format'](_0xed5f('0x2c'),_0x517d19[_0xed5f('0x4')],members[_0xa71818]['data1'],members[_0xa71818][_0xed5f('0x5')],members[_0xa71818]['data3']));if(members[_0xa71818][_0xed5f('0x1e')]){writeDB(members[_0xa71818]);}}}if(_0x517d19[_0xed5f('0x2d')]){var _0x2ad998=_0x517d19[_0xed5f('0x2d')][_0xed5f('0xe')]('-')[0x0];if(!_[_0xed5f('0x1d')](members[_0x2ad998])){members[_0x2ad998]=_[_0xed5f('0x27')](members[_0x2ad998],{'data1':members[_0x2ad998][_0xed5f('0x2a')]||_0x517d19[_0xed5f('0x7')],'data2':members[_0x2ad998]['data2']||_0x517d19['source'],'data3':members[_0x2ad998][_0xed5f('0x2e')]||_0x517d19[_0xed5f('0x2f')],'uniqueid':members[_0x2ad998][_0xed5f('0x4')]||_0x517d19[_0xed5f('0x4')]});utils[_0xed5f('0x19')](util[_0xed5f('0x13')](_0xed5f('0x2c'),_0x517d19[_0xed5f('0x4')],members[_0x2ad998][_0xed5f('0x2a')],members[_0x2ad998][_0xed5f('0x5')],members[_0x2ad998][_0xed5f('0x2e')]));if(members[_0x2ad998][_0xed5f('0x1e')]){writeDB(members[_0x2ad998]);}}}}catch(_0x7f858b){utils[_0xed5f('0x12')](util['format']('[%s][members][cdr]',_0x517d19[_0xed5f('0x4')]),_0x7f858b);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 5c3e0bb..230c7fb 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 _0x42ed=['[%s][queues][varset]','variable','queuestatus','toUpperCase','CONTINUE','queuecallerexitAt','value','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','diffTime','queuecallerjoinAt','count','connectedlinename','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','assigned','destaccountcode','[%s][queues][agentconnect]','agentcomplete','queuecallercomplete','reason','transfer','TRANSFER','[%s][queues][agentcomplete]','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','extension','transferuniqueid','BLINDTRANSFER','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','ATTENDED','transferexten','origtransfererexten','ATTENDEDTRANSFER','transfereelinkedid','clone','transfertargetuniqueid','calleridname','holdtime','[%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','transfertargetlinkedid','mohtime','musiconholdstart','[%s][queues][musiconholdstart]','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','util','./utils','info','format','uniqueid','channel','queue','lastAssignedTo','calleridnum','accountcode','getVoiceQueueByName','type','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','assign','now','error','hangup','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallerexitreason','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','debug'];(function(_0x2d85f6,_0x39e33c){var _0x42aa=function(_0x374ff0){while(--_0x374ff0){_0x2d85f6['push'](_0x2d85f6['shift']());}};_0x42aa(++_0x39e33c);}(_0x42ed,0xa5));var _0xd42e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x42ed[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xd42e('0x0'));var utils=require(_0xd42e('0x1'));var queues={};function writeDB(_0x281e52){utils[_0xd42e('0x2')](util[_0xd42e('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x281e52[_0xd42e('0x4')],_0x281e52[_0xd42e('0x5')],_0x281e52[_0xd42e('0x6')],_0x281e52[_0xd42e('0x7')],_0x281e52[_0xd42e('0x8')],_0x281e52[_0xd42e('0x9')],_0x281e52['queuecallerexitreason']));if(_0x281e52[_0xd42e('0x6')]){utils[_0xd42e('0xa')](_0x281e52[_0xd42e('0x6')])['then'](function(_0x185a08){if(_0x185a08){_0x281e52[_0xd42e('0xb')]=_0x185a08['type'];}utils['request'](_0xd42e('0xc'),_0x281e52);});}else{utils['request'](_0xd42e('0xc'),_0x281e52);}if(_0x281e52[_0xd42e('0xd')]){delete queues[_0x281e52['transfereduniqueid']];}else{delete queues[_0x281e52['uniqueid']];}}exports[_0xd42e('0xe')]=function(_0x40e6cd){try{utils['debug'](util['format'](_0xd42e('0xf'),_0x40e6cd[_0xd42e('0x4')]),_0x40e6cd);utils[_0xd42e('0x2')](util[_0xd42e('0x3')](_0xd42e('0x10'),_0x40e6cd[_0xd42e('0x4')],_0x40e6cd['queue'],_0x40e6cd[_0xd42e('0x11')]));queues[_0x40e6cd[_0xd42e('0x4')]]=_[_0xd42e('0x12')](_0x40e6cd,{'originalposition':_0x40e6cd[_0xd42e('0x11')],'queuecallerjoinAt':utils[_0xd42e('0x13')](),'mohtime':0x0});}catch(_0x572921){utils[_0xd42e('0x14')](util[_0xd42e('0x3')]('[%s][queues][queuecallerjoin]',_0x40e6cd[_0xd42e('0x4')]),_0x572921);}};exports[_0xd42e('0x15')]=function(_0x56b43e){try{if(!_[_0xd42e('0x16')](queues[_0x56b43e[_0xd42e('0x4')]])){utils['debug'](util[_0xd42e('0x3')](_0xd42e('0x17'),_0x56b43e[_0xd42e('0x4')]),_0x56b43e);if(queues[_0x56b43e[_0xd42e('0x4')]][_0xd42e('0x18')]){if(!queues[_0x56b43e[_0xd42e('0x4')]][_0xd42e('0x19')]&&!queues[_0x56b43e[_0xd42e('0x4')]][_0xd42e('0x1a')]){queues[_0x56b43e['uniqueid']]['queuecallercomplete']=!![];queues[_0x56b43e[_0xd42e('0x4')]]['queuecallercompleteAt']=utils['now']();queues[_0x56b43e['uniqueid']][_0xd42e('0x1b')]=_0xd42e('0x1c');}utils['info'](util[_0xd42e('0x3')](_0xd42e('0x1d'),_0x56b43e[_0xd42e('0x4')],queues[_0x56b43e['uniqueid']][_0xd42e('0x1e')],queues[_0x56b43e[_0xd42e('0x4')]][_0xd42e('0x1b')]));writeDB(queues[_0x56b43e[_0xd42e('0x4')]]);}else if(queues[_0x56b43e['uniqueid']][_0xd42e('0xd')]){utils[_0xd42e('0x2')](util[_0xd42e('0x3')]('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x56b43e[_0xd42e('0x4')],queues[_0x56b43e[_0xd42e('0x4')]][_0xd42e('0x1e')],queues[_0x56b43e[_0xd42e('0x4')]]['transfereduniqueid']));queues[queues[_0x56b43e[_0xd42e('0x4')]]['transfereduniqueid']]=queues[_0x56b43e[_0xd42e('0x4')]];queues[queues[_0x56b43e['uniqueid']][_0xd42e('0xd')]][_0xd42e('0x1f')]=0x2;delete queues[_0x56b43e[_0xd42e('0x4')]];}}}catch(_0x391dfd){utils[_0xd42e('0x14')](util[_0xd42e('0x3')](_0xd42e('0x17'),_0x56b43e[_0xd42e('0x4')]),_0x391dfd);}};exports['varset']=function(_0x49dc80){try{utils[_0xd42e('0x20')](util['format'](_0xd42e('0x21'),_0x49dc80[_0xd42e('0x4')]),_0x49dc80);if(!_[_0xd42e('0x16')](_0x49dc80[_0xd42e('0x22')][_0xd42e('0x23')])&&_0x49dc80['value'][_0xd42e('0x24')]()!==_0xd42e('0x25')){if(!_['isNil'](queues[_0x49dc80[_0xd42e('0x4')]])){queues[_0x49dc80['uniqueid']]['queuecallerabandon']=![];queues[_0x49dc80[_0xd42e('0x4')]]['queuecallerabandonAt']=null;queues[_0x49dc80[_0xd42e('0x4')]][_0xd42e('0x1a')]=!![];queues[_0x49dc80[_0xd42e('0x4')]][_0xd42e('0x26')]=utils['now']();queues[_0x49dc80[_0xd42e('0x4')]][_0xd42e('0x1b')]=_0x49dc80[_0xd42e('0x27')][_0xd42e('0x24')]();utils[_0xd42e('0x2')](util[_0xd42e('0x3')](_0xd42e('0x28'),_0x49dc80[_0xd42e('0x4')],queues[_0x49dc80[_0xd42e('0x4')]][_0xd42e('0x1e')],_0x49dc80[_0xd42e('0x27')],queues[_0x49dc80['uniqueid']][_0xd42e('0x1b')]));writeDB(queues[_0x49dc80[_0xd42e('0x4')]]);}}else if(!_['isNil'](_0x49dc80[_0xd42e('0x22')][_0xd42e('0x29')])){if(!_['isNil'](queues[_0x49dc80[_0xd42e('0x4')]])&&!queues[_0x49dc80['uniqueid']][_0xd42e('0x19')]){queues[_0x49dc80['uniqueid']]['queuecallerabandon']=![];queues[_0x49dc80['uniqueid']][_0xd42e('0x2a')]=null;queues[_0x49dc80[_0xd42e('0x4')]][_0xd42e('0x1a')]=!![];queues[_0x49dc80[_0xd42e('0x4')]][_0xd42e('0x26')]=utils[_0xd42e('0x13')]();queues[_0x49dc80[_0xd42e('0x4')]][_0xd42e('0x1b')]='EXITWITHKEY';utils[_0xd42e('0x2')](util['format'](_0xd42e('0x2b'),_0x49dc80[_0xd42e('0x4')],queues[_0x49dc80[_0xd42e('0x4')]][_0xd42e('0x1e')],_0x49dc80['value'],queues[_0x49dc80[_0xd42e('0x4')]][_0xd42e('0x1b')]));}}}catch(_0x1706e8){utils[_0xd42e('0x14')](util[_0xd42e('0x3')](_0xd42e('0x21'),_0x49dc80['uniqueid']),_0x1706e8);}};exports[_0xd42e('0x19')]=function(_0x297dd9){try{if(!_['isNil'](queues[_0x297dd9['uniqueid']])){utils[_0xd42e('0x20')](util[_0xd42e('0x3')]('[%s][queues][queuecallerabandon]',_0x297dd9['uniqueid']),_0x297dd9);queues[_0x297dd9['uniqueid']]['queuecallerexit']=![];queues[_0x297dd9[_0xd42e('0x4')]][_0xd42e('0x26')]=null;queues[_0x297dd9[_0xd42e('0x4')]][_0xd42e('0x19')]=!![];queues[_0x297dd9[_0xd42e('0x4')]][_0xd42e('0x2a')]=utils[_0xd42e('0x13')]();queues[_0x297dd9[_0xd42e('0x4')]][_0xd42e('0x1b')]=_0xd42e('0x2c');utils[_0xd42e('0x2')](util['format'](_0xd42e('0x2d'),_0x297dd9[_0xd42e('0x4')],queues[_0x297dd9[_0xd42e('0x4')]][_0xd42e('0x1e')],queues[_0x297dd9[_0xd42e('0x4')]][_0xd42e('0x1b')]));}}catch(_0x1c8733){utils[_0xd42e('0x14')](util['format'](_0xd42e('0x2e'),_0x297dd9[_0xd42e('0x4')]),_0x1c8733);}};exports[_0xd42e('0x2f')]=function(_0xaf6c7d){try{if(!_[_0xd42e('0x16')](queues[_0xaf6c7d[_0xd42e('0x4')]])){utils[_0xd42e('0x20')](util[_0xd42e('0x3')](_0xd42e('0x30'),_0xaf6c7d[_0xd42e('0x4')]),_0xaf6c7d);utils[_0xd42e('0x2')](util[_0xd42e('0x3')](_0xd42e('0x31'),_0xaf6c7d[_0xd42e('0x4')],queues[_0xaf6c7d['uniqueid']][_0xd42e('0x1e')],_0xaf6c7d[_0xd42e('0x32')],_0xaf6c7d['connectedlinename']));queues[_0xaf6c7d['uniqueid']]['queuecallerleave']=!![];queues[_0xaf6c7d[_0xd42e('0x4')]][_0xd42e('0x18')]=utils[_0xd42e('0x13')]();queues[_0xaf6c7d['uniqueid']]['holdtime']=utils[_0xd42e('0x33')](queues[_0xaf6c7d[_0xd42e('0x4')]][_0xd42e('0x18')],queues[_0xaf6c7d['uniqueid']][_0xd42e('0x34')]);queues[_0xaf6c7d[_0xd42e('0x4')]][_0xd42e('0x11')]=_0xaf6c7d['position'];queues[_0xaf6c7d[_0xd42e('0x4')]][_0xd42e('0x35')]=_0xaf6c7d[_0xd42e('0x35')];queues[_0xaf6c7d[_0xd42e('0x4')]]['connectedlinenum']=_0xaf6c7d[_0xd42e('0x32')];queues[_0xaf6c7d['uniqueid']][_0xd42e('0x36')]=_0xaf6c7d[_0xd42e('0x36')];}}catch(_0x10be5e){utils[_0xd42e('0x14')](util['format'](_0xd42e('0x30'),_0xaf6c7d[_0xd42e('0x4')]),_0x10be5e);}};exports['agentconnect']=function(_0x3ac544){try{if(!_[_0xd42e('0x16')](queues[_0x3ac544[_0xd42e('0x4')]])){utils[_0xd42e('0x20')](util[_0xd42e('0x3')]('[%s][queues][agentconnect]',_0x3ac544[_0xd42e('0x4')]),_0x3ac544);utils[_0xd42e('0x2')](util[_0xd42e('0x3')](_0xd42e('0x37'),_0x3ac544[_0xd42e('0x4')],queues[_0x3ac544[_0xd42e('0x4')]][_0xd42e('0x1e')],_0x3ac544[_0xd42e('0x38')],_0x3ac544['destaccountcode']));queues[_0x3ac544['uniqueid']]['queuecallerabandon']=![];queues[_0x3ac544[_0xd42e('0x4')]][_0xd42e('0x19')]=![];queues[_0x3ac544['uniqueid']][_0xd42e('0x2a')]=null;queues[_0x3ac544[_0xd42e('0x4')]][_0xd42e('0x1a')]=![];queues[_0x3ac544['uniqueid']]['queuecallerexitreason']=null;queues[_0x3ac544[_0xd42e('0x4')]][_0xd42e('0x26')]=null;queues[_0x3ac544[_0xd42e('0x4')]][_0xd42e('0x39')]=!![];queues[_0x3ac544[_0xd42e('0x4')]][_0xd42e('0x9')]=_0x3ac544[_0xd42e('0x3a')];queues[_0x3ac544[_0xd42e('0x4')]]['lastAssignedTo']=_0x3ac544['membername'];}}catch(_0x35e27f){utils[_0xd42e('0x14')](util[_0xd42e('0x3')](_0xd42e('0x3b'),_0x3ac544[_0xd42e('0x4')]),_0x35e27f);}};exports[_0xd42e('0x3c')]=function(_0x51946a){try{if(!_[_0xd42e('0x16')](queues[_0x51946a[_0xd42e('0x4')]])){if(queues[_0x51946a['uniqueid']]['queuecallerleaveAt']){utils[_0xd42e('0x20')](util[_0xd42e('0x3')]('[%s][queues][agentcomplete]',_0x51946a[_0xd42e('0x4')]),_0x51946a);queues[_0x51946a[_0xd42e('0x4')]][_0xd42e('0x19')]=![];queues[_0x51946a[_0xd42e('0x4')]][_0xd42e('0x19')]=![];queues[_0x51946a[_0xd42e('0x4')]][_0xd42e('0x2a')]=null;queues[_0x51946a['uniqueid']][_0xd42e('0x1a')]=![];queues[_0x51946a[_0xd42e('0x4')]]['queuecallerexitAt']=null;queues[_0x51946a[_0xd42e('0x4')]][_0xd42e('0x39')]=!![];queues[_0x51946a[_0xd42e('0x4')]][_0xd42e('0x7')]=_0x51946a[_0xd42e('0x38')];queues[_0x51946a[_0xd42e('0x4')]][_0xd42e('0x3d')]=!![];queues[_0x51946a[_0xd42e('0x4')]]['queuecallercompleteAt']=utils[_0xd42e('0x13')]();if(_0x51946a[_0xd42e('0x3e')]==_0xd42e('0x3f')){if(!queues[_0x51946a[_0xd42e('0x4')]][_0xd42e('0x3f')]){queues[_0x51946a['uniqueid']][_0xd42e('0x1b')]=_0xd42e('0x40');}}else{queues[_0x51946a['uniqueid']][_0xd42e('0x1b')]='COMPLETEDBY'+_0x51946a[_0xd42e('0x3e')][_0xd42e('0x24')]();}utils[_0xd42e('0x2')](util[_0xd42e('0x3')]('[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s',_0x51946a[_0xd42e('0x4')],queues[_0x51946a['uniqueid']][_0xd42e('0x1e')],_0x51946a[_0xd42e('0x38')],queues[_0x51946a[_0xd42e('0x4')]][_0xd42e('0x1b')]));writeDB(queues[_0x51946a[_0xd42e('0x4')]]);}}}catch(_0x1d0ac9){utils[_0xd42e('0x14')](util[_0xd42e('0x3')](_0xd42e('0x41'),_0x51946a[_0xd42e('0x4')]),_0x1d0ac9);}};exports[_0xd42e('0x42')]=function(_0x4fedfa){try{if(!_[_0xd42e('0x16')](queues[_0x4fedfa[_0xd42e('0x43')]])){utils['debug'](util[_0xd42e('0x3')](_0xd42e('0x44'),_0x4fedfa[_0xd42e('0x4')]),_0x4fedfa);queues[_0x4fedfa['transfereeuniqueid']][_0xd42e('0x3f')]=!![];queues[_0x4fedfa['transfereeuniqueid']][_0xd42e('0x45')]=_0xd42e('0x46');queues[_0x4fedfa[_0xd42e('0x43')]]['transferexten']=_0x4fedfa[_0xd42e('0x47')];queues[_0x4fedfa[_0xd42e('0x43')]][_0xd42e('0x48')]=_0x4fedfa[_0xd42e('0x43')];queues[_0x4fedfa[_0xd42e('0x43')]][_0xd42e('0x1b')]=_0xd42e('0x49');utils[_0xd42e('0x2')](util[_0xd42e('0x3')]('[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER',_0x4fedfa['uniqueid'],queues[_0x4fedfa['transfereeuniqueid']][_0xd42e('0x1e')],_0x4fedfa['transfereeuniqueid'],_0x4fedfa[_0xd42e('0x47')]));}}catch(_0xff2880){utils[_0xd42e('0x14')](util[_0xd42e('0x3')](_0xd42e('0x44'),_0x4fedfa['uniqueid']),_0xff2880);}};exports['attendedtransfer']=function(_0x17d11b){try{utils['debug'](util[_0xd42e('0x3')]('[%s][queues][attendedtransfer]',_0x17d11b[_0xd42e('0x4a')]),_0x17d11b);if(_0x17d11b[_0xd42e('0x4a')]==_0x17d11b[_0xd42e('0x4b')]){if(!_[_0xd42e('0x16')](queues[_0x17d11b[_0xd42e('0x4c')]])){utils[_0xd42e('0x2')](util[_0xd42e('0x3')](_0xd42e('0x4d'),_0x17d11b[_0xd42e('0x4a')],queues[_0x17d11b[_0xd42e('0x4c')]][_0xd42e('0x1e')],_0x17d11b['origtransfererexten']));queues[_0x17d11b['secondtransfererlinkedid']]['transfer']=!![];queues[_0x17d11b['secondtransfererlinkedid']]['transfertype']=_0xd42e('0x4e');queues[_0x17d11b[_0xd42e('0x4c')]][_0xd42e('0x4f')]=_0x17d11b[_0xd42e('0x50')];queues[_0x17d11b[_0xd42e('0x4c')]][_0xd42e('0x48')]=_0x17d11b[_0xd42e('0x4a')];queues[_0x17d11b['secondtransfererlinkedid']]['queuecallerexitreason']=_0xd42e('0x51');}if(!_['isNil'](queues[_0x17d11b[_0xd42e('0x4b')]])){if(_0x17d11b[_0xd42e('0x52')]&&queues[_0x17d11b[_0xd42e('0x52')]]){queues[_0x17d11b[_0xd42e('0x52')]]['queuecallerenterreason']=0x1;queues[_0x17d11b[_0xd42e('0x43')]]=_[_0xd42e('0x53')](queues[_0x17d11b[_0xd42e('0x52')]]);queues[_0x17d11b[_0xd42e('0x43')]][_0xd42e('0xd')]=_0x17d11b[_0xd42e('0x54')];queues[_0x17d11b[_0xd42e('0x43')]][_0xd42e('0x1f')]=0x2;queues[_0x17d11b[_0xd42e('0x43')]][_0xd42e('0x8')]=queues[_0x17d11b[_0xd42e('0x4c')]][_0xd42e('0x8')];queues[_0x17d11b[_0xd42e('0x43')]][_0xd42e('0x55')]=queues[_0x17d11b[_0xd42e('0x4c')]]['calleridname'];queues[_0x17d11b[_0xd42e('0x43')]]['queuecallerjoinAt']=utils[_0xd42e('0x13')]();queues[_0x17d11b['transfereeuniqueid']][_0xd42e('0x18')]=utils[_0xd42e('0x13')]();queues[_0x17d11b[_0xd42e('0x43')]][_0xd42e('0x56')]=0x0;queues[_0x17d11b[_0xd42e('0x43')]]['mohtime']=0x0;utils['info'](util[_0xd42e('0x3')](_0xd42e('0x57'),_0x17d11b[_0xd42e('0x4a')],queues[_0x17d11b['transfereeuniqueid']][_0xd42e('0x1e')],queues[_0x17d11b['transfereeuniqueid']][_0xd42e('0x8')],queues[_0x17d11b[_0xd42e('0x43')]][_0xd42e('0x55')]));}else{utils['info'](util[_0xd42e('0x3')](_0xd42e('0x58'),_0x17d11b['origtransfereruniqueid'],queues[_0x17d11b[_0xd42e('0x4b')]]['name'],_0x17d11b[_0xd42e('0x4c')]));queues[_0x17d11b[_0xd42e('0x4b')]][_0xd42e('0xd')]=_0x17d11b['secondtransfererlinkedid'];}}}else if(_0x17d11b[_0xd42e('0x59')]==_0x17d11b[_0xd42e('0x4c')]){if(!_[_0xd42e('0x16')](queues[_0x17d11b[_0xd42e('0x4b')]])){utils[_0xd42e('0x2')](util[_0xd42e('0x3')](_0xd42e('0x5a'),_0x17d11b[_0xd42e('0x4a')],queues[_0x17d11b[_0xd42e('0x4b')]][_0xd42e('0x1e')],_0x17d11b['secondtransfereruniqueid'],_0x17d11b[_0xd42e('0x5b')]));queues[_0x17d11b[_0xd42e('0x4b')]][_0xd42e('0x3f')]=!![];queues[_0x17d11b[_0xd42e('0x4b')]]['transfertype']='ATTENDED';queues[_0x17d11b[_0xd42e('0x4b')]]['transferexten']=_0x17d11b[_0xd42e('0x5b')];queues[_0x17d11b[_0xd42e('0x4b')]][_0xd42e('0x48')]=_0x17d11b[_0xd42e('0x59')];queues[_0x17d11b[_0xd42e('0x4b')]][_0xd42e('0x1b')]=_0xd42e('0x51');}if(!_[_0xd42e('0x16')](queues[_0x17d11b[_0xd42e('0x4c')]])){if(_0x17d11b['transfertargetlinkedid']&&queues[_0x17d11b[_0xd42e('0x5c')]]){queues[_0x17d11b[_0xd42e('0x5c')]][_0xd42e('0x1f')]=0x1;queues[_0x17d11b[_0xd42e('0x54')]]=_[_0xd42e('0x53')](queues[_0x17d11b[_0xd42e('0x5c')]]);queues[_0x17d11b[_0xd42e('0x54')]][_0xd42e('0xd')]=_0x17d11b[_0xd42e('0x54')];queues[_0x17d11b[_0xd42e('0x54')]][_0xd42e('0x1f')]=0x2;queues[_0x17d11b[_0xd42e('0x54')]][_0xd42e('0x8')]=queues[_0x17d11b['origtransfererlinkedid']][_0xd42e('0x8')];queues[_0x17d11b[_0xd42e('0x54')]][_0xd42e('0x55')]=queues[_0x17d11b[_0xd42e('0x4b')]][_0xd42e('0x55')];queues[_0x17d11b[_0xd42e('0x54')]]['queuecallerjoinAt']=utils[_0xd42e('0x13')]();queues[_0x17d11b[_0xd42e('0x54')]][_0xd42e('0x18')]=utils[_0xd42e('0x13')]();queues[_0x17d11b[_0xd42e('0x54')]][_0xd42e('0x56')]=0x0;queues[_0x17d11b[_0xd42e('0x54')]][_0xd42e('0x5d')]=0x0;utils[_0xd42e('0x2')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x17d11b[_0xd42e('0x4a')],queues[_0x17d11b[_0xd42e('0x54')]][_0xd42e('0x1e')],queues[_0x17d11b['transfertargetuniqueid']][_0xd42e('0xd')],queues[_0x17d11b[_0xd42e('0x54')]]['calleridnum'],queues[_0x17d11b[_0xd42e('0x54')]]['calleridname']));}else{utils['info'](util[_0xd42e('0x3')](_0xd42e('0x58'),_0x17d11b[_0xd42e('0x4a')],queues[_0x17d11b[_0xd42e('0x4c')]][_0xd42e('0x1e')],_0x17d11b[_0xd42e('0x4b')]));queues[_0x17d11b['secondtransfererlinkedid']][_0xd42e('0xd')]=_0x17d11b[_0xd42e('0x4b')];}}}}catch(_0x13fb28){utils[_0xd42e('0x14')](util[_0xd42e('0x3')]('[%s][queues][attendedtransfer]',_0x17d11b[_0xd42e('0x4a')]),_0x13fb28);}};exports[_0xd42e('0x5e')]=function(_0x5b57a7){try{if(!_[_0xd42e('0x16')](queues[_0x5b57a7['uniqueid']])){utils[_0xd42e('0x20')](util[_0xd42e('0x3')](_0xd42e('0x5f'),_0x5b57a7['uniqueid']),_0x5b57a7);queues[_0x5b57a7[_0xd42e('0x4')]]['musiconholdstartAt']=utils[_0xd42e('0x13')]();utils[_0xd42e('0x2')](util[_0xd42e('0x3')](_0xd42e('0x60'),_0x5b57a7[_0xd42e('0x4')],queues[_0x5b57a7[_0xd42e('0x4')]]['name'],queues[_0x5b57a7[_0xd42e('0x4')]][_0xd42e('0x61')]));}}catch(_0x3add18){utils[_0xd42e('0x14')](util[_0xd42e('0x3')](_0xd42e('0x5f'),_0x5b57a7[_0xd42e('0x4')]),_0x3add18);}};exports['musiconholdstop']=function(_0x300ca4){try{if(!_[_0xd42e('0x16')](queues[_0x300ca4[_0xd42e('0x4')]])){if(!_['isNil'](queues[_0x300ca4['uniqueid']][_0xd42e('0x61')])){utils['debug'](util['format']('[%s][queues][musiconholdstop]',_0x300ca4[_0xd42e('0x4')]),_0x300ca4);queues[_0x300ca4[_0xd42e('0x4')]][_0xd42e('0x5d')]+=utils[_0xd42e('0x33')](utils[_0xd42e('0x13')](),queues[_0x300ca4['uniqueid']][_0xd42e('0x61')]);utils[_0xd42e('0x2')](util[_0xd42e('0x3')](_0xd42e('0x62'),_0x300ca4[_0xd42e('0x4')],queues[_0x300ca4[_0xd42e('0x4')]][_0xd42e('0x1e')],queues[_0x300ca4[_0xd42e('0x4')]][_0xd42e('0x5d')]));delete queues[_0x300ca4['uniqueid']][_0xd42e('0x61')];}}}catch(_0x4b68c6){utils[_0xd42e('0x14')](util[_0xd42e('0x3')]('[%s][queues][musiconholdstop]',_0x300ca4[_0xd42e('0x4')]),_0x4b68c6);}}; \ No newline at end of file +var _0x2173=['clone','calleridname','holdtime','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','transfertype','transfertargetlinkedid','transfertargetuniqueid','musiconholdstart','[%s][queues][musiconholdstart]','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstop]','diffTime','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','format','uniqueid','channel','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','info','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','[%s][queues][queuecallerjoin]','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerabandon','queuecallerexit','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','[%s][queues][varset]','queuestatus','value','toUpperCase','CONTINUE','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','variable','queueposition','queuecallerabandonAt','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerjoinAt','count','agentconnect','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','destaccountcode','assigned','lastAssignedTo','agentcomplete','queuecallercomplete','transfer','TRANSFER','COMPLETEDBY','reason','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','transfereeuniqueid','[%s][queues][blindtransfer]','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','secondtransfererlinkedid','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','transfereelinkedid'];(function(_0x3e1284,_0x31647b){var _0xec43e5=function(_0x39d9f5){while(--_0x39d9f5){_0x3e1284['push'](_0x3e1284['shift']());}};_0xec43e5(++_0x31647b);}(_0x2173,0x1b3));var _0x3217=function(_0x4cd22f,_0x57c3ea){_0x4cd22f=_0x4cd22f-0x0;var _0x2342d3=_0x2173[_0x4cd22f];return _0x2342d3;};'use strict';var _=require(_0x3217('0x0'));var util=require(_0x3217('0x1'));var utils=require(_0x3217('0x2'));var queues={};function writeDB(_0x4b2d86){utils['info'](util[_0x3217('0x3')]('[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s',_0x4b2d86[_0x3217('0x4')],_0x4b2d86[_0x3217('0x5')],_0x4b2d86['queue'],_0x4b2d86['lastAssignedTo'],_0x4b2d86[_0x3217('0x6')],_0x4b2d86[_0x3217('0x7')],_0x4b2d86[_0x3217('0x8')]));if(_0x4b2d86[_0x3217('0x9')]){utils[_0x3217('0xa')](_0x4b2d86[_0x3217('0x9')])['then'](function(_0x44884f){if(_0x44884f){_0x4b2d86['type']=_0x44884f[_0x3217('0xb')];}utils[_0x3217('0xc')](_0x3217('0xd'),_0x4b2d86);});}else{utils[_0x3217('0xc')]('CreateVoiceQueueReport',_0x4b2d86);}if(_0x4b2d86[_0x3217('0xe')]){delete queues[_0x4b2d86[_0x3217('0xe')]];}else{delete queues[_0x4b2d86[_0x3217('0x4')]];}}exports[_0x3217('0xf')]=function(_0x3e9880){try{utils[_0x3217('0x10')](util[_0x3217('0x3')]('[%s][queues][queuecallerjoin]',_0x3e9880['uniqueid']),_0x3e9880);utils[_0x3217('0x11')](util[_0x3217('0x3')](_0x3217('0x12'),_0x3e9880['uniqueid'],_0x3e9880['queue'],_0x3e9880[_0x3217('0x13')]));queues[_0x3e9880['uniqueid']]=_['assign'](_0x3e9880,{'originalposition':_0x3e9880['position'],'queuecallerjoinAt':utils[_0x3217('0x14')](),'mohtime':0x0});}catch(_0x4cb935){utils[_0x3217('0x15')](util['format'](_0x3217('0x16'),_0x3e9880[_0x3217('0x4')]),_0x4cb935);}};exports['hangup']=function(_0x191c66){try{if(!_[_0x3217('0x17')](queues[_0x191c66[_0x3217('0x4')]])){utils['debug'](util[_0x3217('0x3')](_0x3217('0x18'),_0x191c66['uniqueid']),_0x191c66);if(queues[_0x191c66[_0x3217('0x4')]][_0x3217('0x19')]){if(!queues[_0x191c66[_0x3217('0x4')]][_0x3217('0x1a')]&&!queues[_0x191c66[_0x3217('0x4')]][_0x3217('0x1b')]){queues[_0x191c66[_0x3217('0x4')]]['queuecallercomplete']=!![];queues[_0x191c66[_0x3217('0x4')]][_0x3217('0x1c')]=utils[_0x3217('0x14')]();queues[_0x191c66[_0x3217('0x4')]][_0x3217('0x8')]=_0x3217('0x1d');}utils['info'](util[_0x3217('0x3')](_0x3217('0x1e'),_0x191c66['uniqueid'],queues[_0x191c66[_0x3217('0x4')]][_0x3217('0x1f')],queues[_0x191c66['uniqueid']][_0x3217('0x8')]));writeDB(queues[_0x191c66['uniqueid']]);}else if(queues[_0x191c66['uniqueid']]['transfereduniqueid']){utils['info'](util[_0x3217('0x3')](_0x3217('0x20'),_0x191c66[_0x3217('0x4')],queues[_0x191c66[_0x3217('0x4')]][_0x3217('0x1f')],queues[_0x191c66['uniqueid']][_0x3217('0xe')]));queues[queues[_0x191c66[_0x3217('0x4')]]['transfereduniqueid']]=queues[_0x191c66[_0x3217('0x4')]];queues[queues[_0x191c66[_0x3217('0x4')]][_0x3217('0xe')]][_0x3217('0x21')]=0x2;delete queues[_0x191c66[_0x3217('0x4')]];}}}catch(_0x5dcb0c){utils[_0x3217('0x15')](util[_0x3217('0x3')](_0x3217('0x18'),_0x191c66[_0x3217('0x4')]),_0x5dcb0c);}};exports[_0x3217('0x22')]=function(_0xc27383){try{utils[_0x3217('0x10')](util[_0x3217('0x3')](_0x3217('0x23'),_0xc27383[_0x3217('0x4')]),_0xc27383);if(!_[_0x3217('0x17')](_0xc27383['variable'][_0x3217('0x24')])&&_0xc27383[_0x3217('0x25')][_0x3217('0x26')]()!==_0x3217('0x27')){if(!_['isNil'](queues[_0xc27383[_0x3217('0x4')]])){queues[_0xc27383[_0x3217('0x4')]]['queuecallerabandon']=![];queues[_0xc27383[_0x3217('0x4')]]['queuecallerabandonAt']=null;queues[_0xc27383[_0x3217('0x4')]][_0x3217('0x1b')]=!![];queues[_0xc27383[_0x3217('0x4')]][_0x3217('0x28')]=utils['now']();queues[_0xc27383[_0x3217('0x4')]][_0x3217('0x8')]=_0xc27383[_0x3217('0x25')]['toUpperCase']();utils[_0x3217('0x11')](util[_0x3217('0x3')](_0x3217('0x29'),_0xc27383[_0x3217('0x4')],queues[_0xc27383[_0x3217('0x4')]][_0x3217('0x1f')],_0xc27383[_0x3217('0x25')],queues[_0xc27383['uniqueid']][_0x3217('0x8')]));writeDB(queues[_0xc27383['uniqueid']]);}}else if(!_[_0x3217('0x17')](_0xc27383[_0x3217('0x2a')][_0x3217('0x2b')])){if(!_[_0x3217('0x17')](queues[_0xc27383[_0x3217('0x4')]])&&!queues[_0xc27383[_0x3217('0x4')]][_0x3217('0x1a')]){queues[_0xc27383[_0x3217('0x4')]][_0x3217('0x1a')]=![];queues[_0xc27383[_0x3217('0x4')]][_0x3217('0x2c')]=null;queues[_0xc27383[_0x3217('0x4')]]['queuecallerexit']=!![];queues[_0xc27383[_0x3217('0x4')]][_0x3217('0x28')]=utils['now']();queues[_0xc27383[_0x3217('0x4')]][_0x3217('0x8')]='EXITWITHKEY';utils[_0x3217('0x11')](util[_0x3217('0x3')](_0x3217('0x2d'),_0xc27383[_0x3217('0x4')],queues[_0xc27383['uniqueid']][_0x3217('0x1f')],_0xc27383[_0x3217('0x25')],queues[_0xc27383['uniqueid']][_0x3217('0x8')]));}}}catch(_0x126336){utils[_0x3217('0x15')](util['format'](_0x3217('0x23'),_0xc27383['uniqueid']),_0x126336);}};exports['queuecallerabandon']=function(_0x54a20b){try{if(!_[_0x3217('0x17')](queues[_0x54a20b[_0x3217('0x4')]])){utils[_0x3217('0x10')](util['format'](_0x3217('0x2e'),_0x54a20b[_0x3217('0x4')]),_0x54a20b);queues[_0x54a20b[_0x3217('0x4')]][_0x3217('0x1b')]=![];queues[_0x54a20b[_0x3217('0x4')]][_0x3217('0x28')]=null;queues[_0x54a20b[_0x3217('0x4')]][_0x3217('0x1a')]=!![];queues[_0x54a20b[_0x3217('0x4')]][_0x3217('0x2c')]=utils[_0x3217('0x14')]();queues[_0x54a20b[_0x3217('0x4')]][_0x3217('0x8')]=_0x3217('0x2f');utils[_0x3217('0x11')](util['format'](_0x3217('0x30'),_0x54a20b['uniqueid'],queues[_0x54a20b['uniqueid']][_0x3217('0x1f')],queues[_0x54a20b[_0x3217('0x4')]][_0x3217('0x8')]));}}catch(_0x5c60b2){utils[_0x3217('0x15')](util[_0x3217('0x3')](_0x3217('0x2e'),_0x54a20b[_0x3217('0x4')]),_0x5c60b2);}};exports['queuecallerleave']=function(_0x44b5c0){try{if(!_[_0x3217('0x17')](queues[_0x44b5c0[_0x3217('0x4')]])){utils[_0x3217('0x10')](util[_0x3217('0x3')](_0x3217('0x31'),_0x44b5c0['uniqueid']),_0x44b5c0);utils['info'](util[_0x3217('0x3')](_0x3217('0x32'),_0x44b5c0['uniqueid'],queues[_0x44b5c0[_0x3217('0x4')]][_0x3217('0x1f')],_0x44b5c0[_0x3217('0x33')],_0x44b5c0[_0x3217('0x34')]));queues[_0x44b5c0[_0x3217('0x4')]]['queuecallerleave']=!![];queues[_0x44b5c0['uniqueid']]['queuecallerleaveAt']=utils['now']();queues[_0x44b5c0[_0x3217('0x4')]]['holdtime']=utils['diffTime'](queues[_0x44b5c0['uniqueid']][_0x3217('0x19')],queues[_0x44b5c0[_0x3217('0x4')]][_0x3217('0x35')]);queues[_0x44b5c0[_0x3217('0x4')]][_0x3217('0x13')]=_0x44b5c0[_0x3217('0x13')];queues[_0x44b5c0[_0x3217('0x4')]]['count']=_0x44b5c0[_0x3217('0x36')];queues[_0x44b5c0['uniqueid']][_0x3217('0x33')]=_0x44b5c0[_0x3217('0x33')];queues[_0x44b5c0['uniqueid']][_0x3217('0x34')]=_0x44b5c0[_0x3217('0x34')];}}catch(_0x2b4ecb){utils[_0x3217('0x15')](util[_0x3217('0x3')]('[%s][queues][queuecallerleave]',_0x44b5c0[_0x3217('0x4')]),_0x2b4ecb);}};exports[_0x3217('0x37')]=function(_0x24e490){try{if(!_[_0x3217('0x17')](queues[_0x24e490[_0x3217('0x4')]])){utils[_0x3217('0x10')](util[_0x3217('0x3')]('[%s][queues][agentconnect]',_0x24e490[_0x3217('0x4')]),_0x24e490);utils[_0x3217('0x11')](util['format'](_0x3217('0x38'),_0x24e490[_0x3217('0x4')],queues[_0x24e490['uniqueid']][_0x3217('0x1f')],_0x24e490[_0x3217('0x39')],_0x24e490[_0x3217('0x3a')]));queues[_0x24e490['uniqueid']][_0x3217('0x1a')]=![];queues[_0x24e490[_0x3217('0x4')]][_0x3217('0x1a')]=![];queues[_0x24e490[_0x3217('0x4')]][_0x3217('0x2c')]=null;queues[_0x24e490[_0x3217('0x4')]][_0x3217('0x1b')]=![];queues[_0x24e490[_0x3217('0x4')]][_0x3217('0x8')]=null;queues[_0x24e490[_0x3217('0x4')]][_0x3217('0x28')]=null;queues[_0x24e490[_0x3217('0x4')]][_0x3217('0x3b')]=!![];queues[_0x24e490[_0x3217('0x4')]][_0x3217('0x7')]=_0x24e490[_0x3217('0x3a')];queues[_0x24e490[_0x3217('0x4')]][_0x3217('0x3c')]=_0x24e490[_0x3217('0x39')];}}catch(_0x206359){utils[_0x3217('0x15')](util[_0x3217('0x3')]('[%s][queues][agentconnect]',_0x24e490[_0x3217('0x4')]),_0x206359);}};exports[_0x3217('0x3d')]=function(_0x69c57a){try{if(!_['isNil'](queues[_0x69c57a['uniqueid']])){if(queues[_0x69c57a['uniqueid']][_0x3217('0x19')]){utils[_0x3217('0x10')](util['format']('[%s][queues][agentcomplete]',_0x69c57a[_0x3217('0x4')]),_0x69c57a);queues[_0x69c57a['uniqueid']][_0x3217('0x1a')]=![];queues[_0x69c57a[_0x3217('0x4')]]['queuecallerabandon']=![];queues[_0x69c57a[_0x3217('0x4')]]['queuecallerabandonAt']=null;queues[_0x69c57a[_0x3217('0x4')]][_0x3217('0x1b')]=![];queues[_0x69c57a[_0x3217('0x4')]][_0x3217('0x28')]=null;queues[_0x69c57a['uniqueid']][_0x3217('0x3b')]=!![];queues[_0x69c57a[_0x3217('0x4')]]['lastAssignedTo']=_0x69c57a[_0x3217('0x39')];queues[_0x69c57a[_0x3217('0x4')]][_0x3217('0x3e')]=!![];queues[_0x69c57a[_0x3217('0x4')]][_0x3217('0x1c')]=utils['now']();if(_0x69c57a['reason']==_0x3217('0x3f')){if(!queues[_0x69c57a[_0x3217('0x4')]][_0x3217('0x3f')]){queues[_0x69c57a['uniqueid']][_0x3217('0x8')]=_0x3217('0x40');}}else{queues[_0x69c57a['uniqueid']][_0x3217('0x8')]=_0x3217('0x41')+_0x69c57a[_0x3217('0x42')][_0x3217('0x26')]();}utils[_0x3217('0x11')](util[_0x3217('0x3')](_0x3217('0x43'),_0x69c57a['uniqueid'],queues[_0x69c57a[_0x3217('0x4')]][_0x3217('0x1f')],_0x69c57a['membername'],queues[_0x69c57a[_0x3217('0x4')]][_0x3217('0x8')]));writeDB(queues[_0x69c57a[_0x3217('0x4')]]);}}}catch(_0x4fdbd3){utils[_0x3217('0x15')](util[_0x3217('0x3')]('[%s][queues][agentcomplete]',_0x69c57a[_0x3217('0x4')]),_0x4fdbd3);}};exports['blindtransfer']=function(_0x27d8d5){try{if(!_['isNil'](queues[_0x27d8d5[_0x3217('0x44')]])){utils[_0x3217('0x10')](util['format'](_0x3217('0x45'),_0x27d8d5['uniqueid']),_0x27d8d5);queues[_0x27d8d5['transfereeuniqueid']][_0x3217('0x3f')]=!![];queues[_0x27d8d5[_0x3217('0x44')]]['transfertype']='BLIND';queues[_0x27d8d5['transfereeuniqueid']][_0x3217('0x46')]=_0x27d8d5[_0x3217('0x47')];queues[_0x27d8d5[_0x3217('0x44')]][_0x3217('0x48')]=_0x27d8d5[_0x3217('0x44')];queues[_0x27d8d5['transfereeuniqueid']][_0x3217('0x8')]=_0x3217('0x49');utils[_0x3217('0x11')](util[_0x3217('0x3')](_0x3217('0x4a'),_0x27d8d5[_0x3217('0x4')],queues[_0x27d8d5[_0x3217('0x44')]][_0x3217('0x1f')],_0x27d8d5[_0x3217('0x44')],_0x27d8d5[_0x3217('0x47')]));}}catch(_0x34a192){utils[_0x3217('0x15')](util['format']('[%s][queues][blindtransfer]',_0x27d8d5['uniqueid']),_0x34a192);}};exports[_0x3217('0x4b')]=function(_0x2eecfd){try{utils[_0x3217('0x10')](util[_0x3217('0x3')](_0x3217('0x4c'),_0x2eecfd[_0x3217('0x4d')]),_0x2eecfd);if(_0x2eecfd[_0x3217('0x4d')]==_0x2eecfd[_0x3217('0x4e')]){if(!_[_0x3217('0x17')](queues[_0x2eecfd['secondtransfererlinkedid']])){utils[_0x3217('0x11')](util['format'](_0x3217('0x4f'),_0x2eecfd[_0x3217('0x4d')],queues[_0x2eecfd[_0x3217('0x50')]][_0x3217('0x1f')],_0x2eecfd[_0x3217('0x51')]));queues[_0x2eecfd[_0x3217('0x50')]][_0x3217('0x3f')]=!![];queues[_0x2eecfd[_0x3217('0x50')]]['transfertype']=_0x3217('0x52');queues[_0x2eecfd[_0x3217('0x50')]][_0x3217('0x46')]=_0x2eecfd['origtransfererexten'];queues[_0x2eecfd[_0x3217('0x50')]][_0x3217('0x48')]=_0x2eecfd[_0x3217('0x4d')];queues[_0x2eecfd[_0x3217('0x50')]][_0x3217('0x8')]=_0x3217('0x53');}if(!_['isNil'](queues[_0x2eecfd['origtransfererlinkedid']])){if(_0x2eecfd[_0x3217('0x54')]&&queues[_0x2eecfd[_0x3217('0x54')]]){queues[_0x2eecfd[_0x3217('0x54')]][_0x3217('0x21')]=0x1;queues[_0x2eecfd[_0x3217('0x44')]]=_[_0x3217('0x55')](queues[_0x2eecfd[_0x3217('0x54')]]);queues[_0x2eecfd[_0x3217('0x44')]][_0x3217('0xe')]=_0x2eecfd['transfertargetuniqueid'];queues[_0x2eecfd[_0x3217('0x44')]][_0x3217('0x21')]=0x2;queues[_0x2eecfd[_0x3217('0x44')]][_0x3217('0x6')]=queues[_0x2eecfd['secondtransfererlinkedid']][_0x3217('0x6')];queues[_0x2eecfd[_0x3217('0x44')]][_0x3217('0x56')]=queues[_0x2eecfd[_0x3217('0x50')]][_0x3217('0x56')];queues[_0x2eecfd[_0x3217('0x44')]][_0x3217('0x35')]=utils[_0x3217('0x14')]();queues[_0x2eecfd[_0x3217('0x44')]]['queuecallerleaveAt']=utils['now']();queues[_0x2eecfd[_0x3217('0x44')]][_0x3217('0x57')]=0x0;queues[_0x2eecfd[_0x3217('0x44')]][_0x3217('0x58')]=0x0;utils[_0x3217('0x11')](util[_0x3217('0x3')](_0x3217('0x59'),_0x2eecfd['origtransfereruniqueid'],queues[_0x2eecfd[_0x3217('0x44')]][_0x3217('0x1f')],queues[_0x2eecfd['transfereeuniqueid']]['calleridnum'],queues[_0x2eecfd[_0x3217('0x44')]]['calleridname']));}else{utils[_0x3217('0x11')](util[_0x3217('0x3')](_0x3217('0x5a'),_0x2eecfd[_0x3217('0x4d')],queues[_0x2eecfd[_0x3217('0x4e')]][_0x3217('0x1f')],_0x2eecfd['secondtransfererlinkedid']));queues[_0x2eecfd[_0x3217('0x4e')]][_0x3217('0xe')]=_0x2eecfd[_0x3217('0x50')];}}}else if(_0x2eecfd[_0x3217('0x5b')]==_0x2eecfd[_0x3217('0x50')]){if(!_[_0x3217('0x17')](queues[_0x2eecfd['origtransfererlinkedid']])){utils['info'](util[_0x3217('0x3')](_0x3217('0x5c'),_0x2eecfd[_0x3217('0x4d')],queues[_0x2eecfd[_0x3217('0x4e')]][_0x3217('0x1f')],_0x2eecfd['secondtransfereruniqueid'],_0x2eecfd[_0x3217('0x5d')]));queues[_0x2eecfd[_0x3217('0x4e')]][_0x3217('0x3f')]=!![];queues[_0x2eecfd[_0x3217('0x4e')]][_0x3217('0x5e')]='ATTENDED';queues[_0x2eecfd['origtransfererlinkedid']][_0x3217('0x46')]=_0x2eecfd[_0x3217('0x5d')];queues[_0x2eecfd[_0x3217('0x4e')]][_0x3217('0x48')]=_0x2eecfd['secondtransfereruniqueid'];queues[_0x2eecfd['origtransfererlinkedid']][_0x3217('0x8')]=_0x3217('0x53');}if(!_['isNil'](queues[_0x2eecfd[_0x3217('0x50')]])){if(_0x2eecfd[_0x3217('0x5f')]&&queues[_0x2eecfd[_0x3217('0x5f')]]){queues[_0x2eecfd[_0x3217('0x5f')]][_0x3217('0x21')]=0x1;queues[_0x2eecfd[_0x3217('0x60')]]=_[_0x3217('0x55')](queues[_0x2eecfd[_0x3217('0x5f')]]);queues[_0x2eecfd[_0x3217('0x60')]]['transfereduniqueid']=_0x2eecfd[_0x3217('0x60')];queues[_0x2eecfd[_0x3217('0x60')]][_0x3217('0x21')]=0x2;queues[_0x2eecfd[_0x3217('0x60')]]['calleridnum']=queues[_0x2eecfd['origtransfererlinkedid']]['calleridnum'];queues[_0x2eecfd[_0x3217('0x60')]][_0x3217('0x56')]=queues[_0x2eecfd[_0x3217('0x4e')]][_0x3217('0x56')];queues[_0x2eecfd[_0x3217('0x60')]]['queuecallerjoinAt']=utils[_0x3217('0x14')]();queues[_0x2eecfd[_0x3217('0x60')]]['queuecallerleaveAt']=utils['now']();queues[_0x2eecfd[_0x3217('0x60')]]['holdtime']=0x0;queues[_0x2eecfd[_0x3217('0x60')]][_0x3217('0x58')]=0x0;utils['info'](util[_0x3217('0x3')]('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s',_0x2eecfd[_0x3217('0x4d')],queues[_0x2eecfd[_0x3217('0x60')]][_0x3217('0x1f')],queues[_0x2eecfd[_0x3217('0x60')]][_0x3217('0xe')],queues[_0x2eecfd[_0x3217('0x60')]][_0x3217('0x6')],queues[_0x2eecfd['transfertargetuniqueid']][_0x3217('0x56')]));}else{utils['info'](util[_0x3217('0x3')](_0x3217('0x5a'),_0x2eecfd[_0x3217('0x4d')],queues[_0x2eecfd['secondtransfererlinkedid']][_0x3217('0x1f')],_0x2eecfd['origtransfererlinkedid']));queues[_0x2eecfd['secondtransfererlinkedid']][_0x3217('0xe')]=_0x2eecfd[_0x3217('0x4e')];}}}}catch(_0x21526b){utils['error'](util[_0x3217('0x3')](_0x3217('0x4c'),_0x2eecfd[_0x3217('0x4d')]),_0x21526b);}};exports[_0x3217('0x61')]=function(_0x472104){try{if(!_[_0x3217('0x17')](queues[_0x472104['uniqueid']])){utils[_0x3217('0x10')](util[_0x3217('0x3')](_0x3217('0x62'),_0x472104[_0x3217('0x4')]),_0x472104);queues[_0x472104[_0x3217('0x4')]][_0x3217('0x63')]=utils[_0x3217('0x14')]();utils['info'](util[_0x3217('0x3')](_0x3217('0x64'),_0x472104['uniqueid'],queues[_0x472104[_0x3217('0x4')]]['name'],queues[_0x472104[_0x3217('0x4')]][_0x3217('0x63')]));}}catch(_0x5d11db){utils[_0x3217('0x15')](util[_0x3217('0x3')](_0x3217('0x62'),_0x472104[_0x3217('0x4')]),_0x5d11db);}};exports['musiconholdstop']=function(_0x1dea5d){try{if(!_[_0x3217('0x17')](queues[_0x1dea5d[_0x3217('0x4')]])){if(!_[_0x3217('0x17')](queues[_0x1dea5d[_0x3217('0x4')]][_0x3217('0x63')])){utils['debug'](util[_0x3217('0x3')](_0x3217('0x65'),_0x1dea5d[_0x3217('0x4')]),_0x1dea5d);queues[_0x1dea5d[_0x3217('0x4')]][_0x3217('0x58')]+=utils[_0x3217('0x66')](utils[_0x3217('0x14')](),queues[_0x1dea5d[_0x3217('0x4')]][_0x3217('0x63')]);utils[_0x3217('0x11')](util[_0x3217('0x3')](_0x3217('0x67'),_0x1dea5d[_0x3217('0x4')],queues[_0x1dea5d['uniqueid']]['name'],queues[_0x1dea5d[_0x3217('0x4')]]['mohtime']));delete queues[_0x1dea5d[_0x3217('0x4')]]['musiconholdstartAt'];}}}catch(_0x347f29){utils['error'](util[_0x3217('0x3')](_0x3217('0x65'),_0x1dea5d['uniqueid']),_0x347f29);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index b0ccf39..154a9f8 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 _0x1078=['connectedlinename','type','outbound','forEach','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','cdr','split','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','lodash','util','info','[%s][recordings][writeDB]','uniqueid','getUserByInternal','accountcode','then','name','UserId','request','CreateVoiceRecording','newchannel','format','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','debug','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','linkedid','transfer','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','monitors','[%s][recordings][hangup]','calleridnum','calleridname','connectedlinenum'];(function(_0x5627e1,_0x1b2dbf){var _0x2f013f=function(_0x142015){while(--_0x142015){_0x5627e1['push'](_0x5627e1['shift']());}};_0x2f013f(++_0x1b2dbf);}(_0x1078,0xbb));var _0x8107=function(_0x2227e9,_0x516f04){_0x2227e9=_0x2227e9-0x0;var _0x457502=_0x1078[_0x2227e9];return _0x457502;};'use strict';var _=require(_0x8107('0x0'));var util=require(_0x8107('0x1'));var utils=require('./utils');var recordings={};function writeDB(_0x470bcc){utils[_0x8107('0x2')](util['format'](_0x8107('0x3'),_0x470bcc[_0x8107('0x4')]));if(_0x470bcc['accountcode']){utils[_0x8107('0x5')](_0x470bcc[_0x8107('0x6')])[_0x8107('0x7')](function(_0x30fe77){if(_0x30fe77){_0x470bcc['membername']=_0x30fe77[_0x8107('0x8')];_0x470bcc[_0x8107('0x9')]=_0x30fe77['id'];}utils[_0x8107('0xa')](_0x8107('0xb'),_0x470bcc);});}else{utils[_0x8107('0xa')](_0x8107('0xb'),_0x470bcc);}}exports[_0x8107('0xc')]=function(_0x4b3c0d){try{utils['debug'](util[_0x8107('0xd')](_0x8107('0xe'),_0x4b3c0d[_0x8107('0x4')]),_0x4b3c0d);if(_0x4b3c0d[_0x8107('0x4')]==_0x4b3c0d['linkedid']){utils[_0x8107('0x2')](util[_0x8107('0xd')](_0x8107('0xf'),_0x4b3c0d['uniqueid'],_0x4b3c0d[_0x8107('0x10')],_0x4b3c0d[_0x8107('0x11')]));recordings[_0x4b3c0d[_0x8107('0x4')]]={'uniqueid':_0x4b3c0d['uniqueid'],'accountcode':_0x4b3c0d[_0x8107('0x6')],'exten':_0x4b3c0d[_0x8107('0x11')],'context':_0x4b3c0d[_0x8107('0x10')],'channel':_0x4b3c0d[_0x8107('0x12')],'monitors':[]};}}catch(_0x130293){utils[_0x8107('0x13')](util[_0x8107('0xd')](_0x8107('0xe'),_0x4b3c0d[_0x8107('0x4')]),_0x130293);}};exports['newstate']=function(_0x2967a5){try{utils[_0x8107('0x14')](util[_0x8107('0xd')](_0x8107('0x15'),_0x2967a5[_0x8107('0x4')]),_0x2967a5);if(!_[_0x8107('0x16')](recordings[_0x2967a5[_0x8107('0x4')]])&&_0x2967a5[_0x8107('0x17')]==0x6){utils[_0x8107('0x2')](util['format'](_0x8107('0x18'),_0x2967a5[_0x8107('0x4')],_0x2967a5[_0x8107('0x10')],_0x2967a5[_0x8107('0x12')]));}else if(!_[_0x8107('0x16')](recordings[_0x2967a5[_0x8107('0x19')]])&&_0x2967a5[_0x8107('0x17')]==0x6&&_0x2967a5[_0x8107('0x10')]!=_0x8107('0x1a')){utils[_0x8107('0x2')](util[_0x8107('0xd')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x2967a5[_0x8107('0x4')],_0x2967a5['linkedid'],_0x2967a5['context'],_0x2967a5['channel']));recordings[_0x2967a5[_0x8107('0x19')]][_0x8107('0x6')]=_0x2967a5[_0x8107('0x6')];}}catch(_0x221503){utils[_0x8107('0x13')](util[_0x8107('0xd')](_0x8107('0x15'),_0x2967a5['uniqueid']),_0x221503);}};exports[_0x8107('0x1b')]=function(_0x3d6ea3){try{if(!_[_0x8107('0x16')](_0x3d6ea3[_0x8107('0x1c')])&&!_[_0x8107('0x16')](_0x3d6ea3[_0x8107('0x1c')][_0x8107('0x1d')])){utils[_0x8107('0x14')](util[_0x8107('0xd')](_0x8107('0x1e'),_0x3d6ea3[_0x8107('0x4')]),_0x3d6ea3);utils[_0x8107('0x2')](util[_0x8107('0xd')](_0x8107('0x1f'),_0x3d6ea3[_0x8107('0x4')],_0x3d6ea3[_0x8107('0x1c')],_0x3d6ea3[_0x8107('0x20')]));if(_['endsWith'](_0x3d6ea3[_0x8107('0x20')],_0x8107('0x21'))){_0x3d6ea3['value']=_0x3d6ea3['value'][_0x8107('0x22')](_0x8107('0x21'),_0x8107('0x23'));}if(recordings[_0x3d6ea3[_0x8107('0x19')]]){var _0x3ce4c1=_['find'](recordings[_0x3d6ea3[_0x8107('0x19')]]['monitors'],{'value':_0x3d6ea3[_0x8107('0x20')]});if(_[_0x8107('0x16')](_0x3ce4c1)){recordings[_0x3d6ea3[_0x8107('0x19')]][_0x8107('0x24')]['push']({'value':_0x3d6ea3[_0x8107('0x20')]});}}}}catch(_0x2bfbc0){utils[_0x8107('0x13')](util['format'](_0x8107('0x1e'),_0x3d6ea3[_0x8107('0x4')]),_0x2bfbc0);}};exports['hangup']=function(_0x28ba03){try{if(!_[_0x8107('0x16')](recordings[_0x28ba03[_0x8107('0x4')]])){utils[_0x8107('0x14')](util[_0x8107('0xd')](_0x8107('0x25'),_0x28ba03[_0x8107('0x4')]),_0x28ba03);utils[_0x8107('0x2')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x28ba03['uniqueid'],_0x28ba03[_0x8107('0x26')],_0x28ba03['calleridname'],_0x28ba03['cause-txt']));recordings[_0x28ba03[_0x8107('0x4')]][_0x8107('0x26')]=_0x28ba03[_0x8107('0x26')];recordings[_0x28ba03[_0x8107('0x4')]][_0x8107('0x27')]=_0x28ba03[_0x8107('0x27')];recordings[_0x28ba03['uniqueid']]['connectedlinenum']=_0x28ba03[_0x8107('0x28')];recordings[_0x28ba03['uniqueid']]['connectedlinename']=_0x28ba03[_0x8107('0x29')];if(recordings[_0x28ba03['uniqueid']][_0x8107('0x2a')]==_0x8107('0x2b')&&recordings[_0x28ba03['uniqueid']]['accountcode']){recordings[_0x28ba03[_0x8107('0x4')]]['connectedlinenum']=recordings[_0x28ba03[_0x8107('0x4')]][_0x8107('0x6')];recordings[_0x28ba03[_0x8107('0x4')]][_0x8107('0x29')]='';}recordings[_0x28ba03['uniqueid']][_0x8107('0x24')][_0x8107('0x2c')](function(_0x32104c){var _0x48f5ca=_['clone'](recordings[_0x28ba03[_0x8107('0x4')]]);_0x48f5ca[_0x8107('0x20')]=_0x32104c[_0x8107('0x20')];writeDB(_0x48f5ca);});delete recordings[_0x28ba03[_0x8107('0x4')]];}}catch(_0x27a921){utils['error'](util['format'](_0x8107('0x25'),_0x28ba03[_0x8107('0x4')]),_0x27a921);}};exports['newexten']=function(_0x22fd69){try{if(!_[_0x8107('0x16')](recordings[_0x22fd69[_0x8107('0x4')]])){utils[_0x8107('0x14')](util[_0x8107('0xd')](_0x8107('0x2d'),_0x22fd69[_0x8107('0x4')]),_0x22fd69);utils[_0x8107('0x2')](util[_0x8107('0xd')](_0x8107('0x2e'),_0x22fd69[_0x8107('0x4')],_0x22fd69[_0x8107('0x2f')],_0x22fd69[_0x8107('0x30')]));if(_0x22fd69['application'][_0x8107('0x31')]()=='set'&&_['startsWith'](_0x22fd69[_0x8107('0x30')][_0x8107('0x31')](),_0x8107('0x32'))){var _0x370266=_0x22fd69[_0x8107('0x30')][_0x8107('0x33')]('=');var _0x31b1d0=_0x370266[0x0]['substring'](_0x370266[0x0][_0x8107('0x34')]('(')+0x1,_0x370266[0x0][_0x8107('0x34')](')'));var _0x491bfd=_0x370266[0x1];recordings[_0x22fd69[_0x8107('0x4')]][_0x31b1d0]=_0x491bfd;}}}catch(_0x34f3d2){utils['error'](util[_0x8107('0xd')](_0x8107('0x2d'),_0x22fd69[_0x8107('0x4')]),_0x34f3d2);}};exports[_0x8107('0x35')]=function(_0x193f9b){try{if(!_[_0x8107('0x16')](recordings[_0x193f9b[_0x8107('0x4')]])){utils[_0x8107('0x14')](util[_0x8107('0xd')](_0x8107('0x36'),_0x193f9b[_0x8107('0x4')]),_0x193f9b);utils[_0x8107('0x2')](util[_0x8107('0xd')](_0x8107('0x37'),_0x193f9b['uniqueid'],_0x193f9b[_0x8107('0x38')]));recordings[_0x193f9b[_0x8107('0x4')]][_0x8107('0x38')]=_0x193f9b[_0x8107('0x38')];}}catch(_0x3a0553){utils['error'](util['format'](_0x8107('0x36'),_0x193f9b[_0x8107('0x4')]),_0x3a0553);}}; \ No newline at end of file +var _0x817b=['lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]','queue','lodash','util','./utils','info','format','[%s][recordings][writeDB]','accountcode','getUserByInternal','then','name','UserId','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','uniqueid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','isNil','channelstate','linkedid','transfer','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','[%s][recordings][newstate]','varset','variable','mixmonitor_filename','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','endsWith','.wav49','value','replace','.WAV','find','monitors','hangup','[%s][recordings][hangup]','calleridname','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','set','toLowerCase','cdr','appdata','split','substring'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x817b,0x104));var _0xb817=function(_0x5b8faa,_0x463e01){_0x5b8faa=_0x5b8faa-0x0;var _0x3f40e8=_0x817b[_0x5b8faa];return _0x3f40e8;};'use strict';var _=require(_0xb817('0x0'));var util=require(_0xb817('0x1'));var utils=require(_0xb817('0x2'));var recordings={};function writeDB(_0x3fb8f2){utils[_0xb817('0x3')](util[_0xb817('0x4')](_0xb817('0x5'),_0x3fb8f2['uniqueid']));if(_0x3fb8f2[_0xb817('0x6')]){utils[_0xb817('0x7')](_0x3fb8f2[_0xb817('0x6')])[_0xb817('0x8')](function(_0x2499a6){if(_0x2499a6){_0x3fb8f2['membername']=_0x2499a6[_0xb817('0x9')];_0x3fb8f2[_0xb817('0xa')]=_0x2499a6['id'];}utils[_0xb817('0xb')](_0xb817('0xc'),_0x3fb8f2);});}else{utils[_0xb817('0xb')](_0xb817('0xc'),_0x3fb8f2);}}exports[_0xb817('0xd')]=function(_0xc7d39e){try{utils[_0xb817('0xe')](util['format'](_0xb817('0xf'),_0xc7d39e[_0xb817('0x10')]),_0xc7d39e);if(_0xc7d39e[_0xb817('0x10')]==_0xc7d39e['linkedid']){utils[_0xb817('0x3')](util['format'](_0xb817('0x11'),_0xc7d39e[_0xb817('0x10')],_0xc7d39e[_0xb817('0x12')],_0xc7d39e[_0xb817('0x13')]));recordings[_0xc7d39e[_0xb817('0x10')]]={'uniqueid':_0xc7d39e['uniqueid'],'accountcode':_0xc7d39e['accountcode'],'exten':_0xc7d39e[_0xb817('0x13')],'context':_0xc7d39e['context'],'channel':_0xc7d39e[_0xb817('0x14')],'monitors':[]};}}catch(_0x12b9de){utils[_0xb817('0x15')](util[_0xb817('0x4')]('[%s][recordings][newchannel]',_0xc7d39e[_0xb817('0x10')]),_0x12b9de);}};exports[_0xb817('0x16')]=function(_0x488561){try{utils[_0xb817('0xe')](util[_0xb817('0x4')]('[%s][recordings][newstate]',_0x488561[_0xb817('0x10')]),_0x488561);if(!_[_0xb817('0x17')](recordings[_0x488561[_0xb817('0x10')]])&&_0x488561[_0xb817('0x18')]==0x6){utils[_0xb817('0x3')](util[_0xb817('0x4')]('[%s][recordings][newstate]\x20context:%s\x20channel:%s',_0x488561[_0xb817('0x10')],_0x488561[_0xb817('0x12')],_0x488561[_0xb817('0x14')]));}else if(!_[_0xb817('0x17')](recordings[_0x488561[_0xb817('0x19')]])&&_0x488561['channelstate']==0x6&&_0x488561[_0xb817('0x12')]!=_0xb817('0x1a')){utils[_0xb817('0x3')](util[_0xb817('0x4')](_0xb817('0x1b'),_0x488561['uniqueid'],_0x488561['linkedid'],_0x488561['context'],_0x488561['channel']));recordings[_0x488561['linkedid']][_0xb817('0x6')]=_0x488561[_0xb817('0x6')];}}catch(_0x1f41e7){utils[_0xb817('0x15')](util[_0xb817('0x4')](_0xb817('0x1c'),_0x488561[_0xb817('0x10')]),_0x1f41e7);}};exports[_0xb817('0x1d')]=function(_0x56ea6b){try{if(!_[_0xb817('0x17')](_0x56ea6b[_0xb817('0x1e')])&&!_[_0xb817('0x17')](_0x56ea6b[_0xb817('0x1e')][_0xb817('0x1f')])){utils[_0xb817('0xe')](util[_0xb817('0x4')](_0xb817('0x20'),_0x56ea6b[_0xb817('0x10')]),_0x56ea6b);utils[_0xb817('0x3')](util[_0xb817('0x4')](_0xb817('0x21'),_0x56ea6b['uniqueid'],_0x56ea6b[_0xb817('0x1e')],_0x56ea6b['value']));if(_[_0xb817('0x22')](_0x56ea6b['value'],_0xb817('0x23'))){_0x56ea6b[_0xb817('0x24')]=_0x56ea6b[_0xb817('0x24')][_0xb817('0x25')](_0xb817('0x23'),_0xb817('0x26'));}if(recordings[_0x56ea6b['linkedid']]){var _0xec94e8=_[_0xb817('0x27')](recordings[_0x56ea6b['linkedid']][_0xb817('0x28')],{'value':_0x56ea6b['value']});if(_[_0xb817('0x17')](_0xec94e8)){recordings[_0x56ea6b[_0xb817('0x19')]][_0xb817('0x28')]['push']({'value':_0x56ea6b['value']});}}}}catch(_0x3f2951){utils['error'](util[_0xb817('0x4')](_0xb817('0x20'),_0x56ea6b['uniqueid']),_0x3f2951);}};exports[_0xb817('0x29')]=function(_0x570793){try{if(!_[_0xb817('0x17')](recordings[_0x570793[_0xb817('0x10')]])){utils[_0xb817('0xe')](util[_0xb817('0x4')](_0xb817('0x2a'),_0x570793[_0xb817('0x10')]),_0x570793);utils[_0xb817('0x3')](util['format']('[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s',_0x570793[_0xb817('0x10')],_0x570793['calleridnum'],_0x570793[_0xb817('0x2b')],_0x570793['cause-txt']));recordings[_0x570793['uniqueid']][_0xb817('0x2c')]=_0x570793[_0xb817('0x2c')];recordings[_0x570793[_0xb817('0x10')]][_0xb817('0x2b')]=_0x570793[_0xb817('0x2b')];recordings[_0x570793[_0xb817('0x10')]]['connectedlinenum']=_0x570793[_0xb817('0x2d')];recordings[_0x570793[_0xb817('0x10')]][_0xb817('0x2e')]=_0x570793[_0xb817('0x2e')];if(recordings[_0x570793['uniqueid']][_0xb817('0x2f')]==_0xb817('0x30')&&recordings[_0x570793[_0xb817('0x10')]][_0xb817('0x6')]){recordings[_0x570793[_0xb817('0x10')]][_0xb817('0x2d')]=recordings[_0x570793[_0xb817('0x10')]][_0xb817('0x6')];recordings[_0x570793[_0xb817('0x10')]][_0xb817('0x2e')]='';}recordings[_0x570793[_0xb817('0x10')]]['monitors'][_0xb817('0x31')](function(_0x4d6e60){var _0x2a5c01=_['clone'](recordings[_0x570793['uniqueid']]);_0x2a5c01[_0xb817('0x24')]=_0x4d6e60['value'];writeDB(_0x2a5c01);});delete recordings[_0x570793[_0xb817('0x10')]];}}catch(_0x5f38cf){utils[_0xb817('0x15')](util[_0xb817('0x4')]('[%s][recordings][hangup]',_0x570793[_0xb817('0x10')]),_0x5f38cf);}};exports[_0xb817('0x32')]=function(_0xb5d435){try{if(!_[_0xb817('0x17')](recordings[_0xb5d435[_0xb817('0x10')]])){utils[_0xb817('0xe')](util[_0xb817('0x4')](_0xb817('0x33'),_0xb5d435['uniqueid']),_0xb5d435);utils[_0xb817('0x3')](util[_0xb817('0x4')](_0xb817('0x34'),_0xb5d435[_0xb817('0x10')],_0xb5d435[_0xb817('0x35')],_0xb5d435['appdata']));if(_0xb5d435['application']['toLowerCase']()==_0xb817('0x36')&&_['startsWith'](_0xb5d435['appdata'][_0xb817('0x37')](),_0xb817('0x38'))){var _0x4607e7=_0xb5d435[_0xb817('0x39')][_0xb817('0x3a')]('=');var _0x1a1ac7=_0x4607e7[0x0][_0xb817('0x3b')](_0x4607e7[0x0][_0xb817('0x3c')]('(')+0x1,_0x4607e7[0x0][_0xb817('0x3c')](')'));var _0x5d28c9=_0x4607e7[0x1];recordings[_0xb5d435[_0xb817('0x10')]][_0x1a1ac7]=_0x5d28c9;}}}catch(_0x1cf55f){utils[_0xb817('0x15')](util[_0xb817('0x4')](_0xb817('0x33'),_0xb5d435[_0xb817('0x10')]),_0x1cf55f);}};exports[_0xb817('0x3d')]=function(_0x5c4dfe){try{if(!_[_0xb817('0x17')](recordings[_0x5c4dfe[_0xb817('0x10')]])){utils[_0xb817('0xe')](util['format'](_0xb817('0x3e'),_0x5c4dfe[_0xb817('0x10')]),_0x5c4dfe);utils[_0xb817('0x3')](util[_0xb817('0x4')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x5c4dfe['uniqueid'],_0x5c4dfe[_0xb817('0x3f')]));recordings[_0x5c4dfe[_0xb817('0x10')]][_0xb817('0x3f')]=_0x5c4dfe['queue'];}}catch(_0x2b9431){utils['error'](util[_0xb817('0x4')](_0xb817('0x3e'),_0x5c4dfe['uniqueid']),_0x2b9431);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index 3f538e5..501394c 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 _0x567f=['format','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','request','blindtransfer','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','blinds','transfereruniqueid','error','attendedtransfer','debug','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten','transfereechannel','transfertargetconnectedlinenum','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','[%s][transfers][attendedtransfer]','lodash','util','./utils','info'];(function(_0x1ffd67,_0x1c18ba){var _0xce170f=function(_0x16cdb2){while(--_0x16cdb2){_0x1ffd67['push'](_0x1ffd67['shift']());}};_0xce170f(++_0x1c18ba);}(_0x567f,0xf8));var _0xf567=function(_0x5da0e9,_0x43c898){_0x5da0e9=_0x5da0e9-0x0;var _0x4b022d=_0x567f[_0x5da0e9];return _0x4b022d;};'use strict';var _=require(_0xf567('0x0'));var util=require(_0xf567('0x1'));var utils=require(_0xf567('0x2'));function writeDB(_0x1d947a){utils[_0xf567('0x3')](util[_0xf567('0x4')](_0xf567('0x5'),_0x1d947a[_0xf567('0x6')]===_0xf567('0x7')?_0x1d947a[_0xf567('0x8')]:_0x1d947a[_0xf567('0x9')],_0x1d947a[_0xf567('0x6')]));utils[_0xf567('0xa')]('CreateVoiceTransferReport',_0x1d947a);}exports['blinds']={};exports[_0xf567('0xb')]=function(_0x4619a6){try{utils['debug'](util[_0xf567('0x4')](_0xf567('0xc'),_0x4619a6[_0xf567('0x9')]),_0x4619a6);utils[_0xf567('0x3')](util[_0xf567('0x4')](_0xf567('0xd'),_0x4619a6[_0xf567('0x9')],_0x4619a6['transferercalleridnum'],_0x4619a6[_0xf567('0xe')],_0x4619a6[_0xf567('0xf')],_0x4619a6[_0xf567('0x10')]));_0x4619a6['type']=_0xf567('0x11');exports[_0xf567('0x12')][_0x4619a6[_0xf567('0x13')]]=_0x4619a6;writeDB(_0x4619a6);}catch(_0x565213){utils[_0xf567('0x14')](util['format']('[%s][transfers][blindtransfer]',_0x4619a6[_0xf567('0x9')]),_0x565213);}};exports[_0xf567('0x15')]=function(_0x32b80a){try{utils[_0xf567('0x16')](util[_0xf567('0x4')]('[%s][transfers][attendedtransfer]',_0x32b80a[_0xf567('0x8')]),_0x32b80a);utils[_0xf567('0x3')](util[_0xf567('0x4')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x32b80a['origtransfereruniqueid'],_0x32b80a[_0xf567('0x17')],_0x32b80a[_0xf567('0x18')],_0x32b80a[_0xf567('0x19')],_0x32b80a[_0xf567('0x1a')]));_0x32b80a=_[_0xf567('0x1b')](_0x32b80a,{'transfererchannel':_0x32b80a['origtransfererchannel'],'transferercalleridnum':_0x32b80a[_0xf567('0x17')],'transferercalleridname':_0x32b80a[_0xf567('0x18')],'transfererconnectedlinenum':_0x32b80a[_0xf567('0x1c')],'transfererconnectedlinename':_0x32b80a[_0xf567('0x1d')],'transfereraccountcode':_0x32b80a[_0xf567('0x1e')],'transferercontext':_0x32b80a['secondtransferercontext'],'transfererexten':_0x32b80a[_0xf567('0x1f')],'transfererlinkedid':_0x32b80a[_0xf567('0x20')],'context':_0x32b80a[_0xf567('0x21')],'extension':_0x32b80a[_0xf567('0x22')],'type':_0xf567('0x7')});if(_['isNil'](_0x32b80a[_0xf567('0x23')])){_0x32b80a=_[_0xf567('0x1b')](_0x32b80a,{'transfereechannel':_0x32b80a['transfertargetchannel'],'transfereecalleridnum':_0x32b80a[_0xf567('0x19')],'transfereecalleridname':_0x32b80a[_0xf567('0x1a')],'transfereeconnectedlinenum':_0x32b80a[_0xf567('0x24')],'transfereeconnectedlinename':_0x32b80a['transfertargetconnectedlinename'],'transfereeaccountcode':_0x32b80a[_0xf567('0x25')],'transfereecontext':_0x32b80a[_0xf567('0x26')],'transfereeexten':_0x32b80a[_0xf567('0x27')],'transfereelinkedid':_0x32b80a[_0xf567('0x28')]});}writeDB(_0x32b80a);}catch(_0x192d19){utils['error'](util['format'](_0xf567('0x29'),_0x32b80a[_0xf567('0x8')]),_0x192d19);}}; \ No newline at end of file +var _0x5645=['transfertargetcontext','transfertargetexten','transfertargetlinkedid','./utils','info','[%s][transfers][writeDB]\x20type:%s','type','attended','origtransfereruniqueid','uniqueid','CreateVoiceTransferReport','blinds','blindtransfer','debug','format','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','blind','error','attendedtransfer','[%s][transfers][attendedtransfer]','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','assign','origtransfererchannel','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransfererexten','origtransfererlinkedid','origtransferercontext','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinename','transfertargetaccountcode'];(function(_0x1928c9,_0x13a6d1){var _0x51b5fb=function(_0x24cf70){while(--_0x24cf70){_0x1928c9['push'](_0x1928c9['shift']());}};_0x51b5fb(++_0x13a6d1);}(_0x5645,0x7b));var _0x5564=function(_0x348b91,_0x1afb92){_0x348b91=_0x348b91-0x0;var _0x13827d=_0x5645[_0x348b91];return _0x13827d;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x5564('0x0'));function writeDB(_0x5adfd1){utils[_0x5564('0x1')](util['format'](_0x5564('0x2'),_0x5adfd1[_0x5564('0x3')]===_0x5564('0x4')?_0x5adfd1[_0x5564('0x5')]:_0x5adfd1[_0x5564('0x6')],_0x5adfd1[_0x5564('0x3')]));utils['request'](_0x5564('0x7'),_0x5adfd1);}exports[_0x5564('0x8')]={};exports[_0x5564('0x9')]=function(_0x524898){try{utils[_0x5564('0xa')](util[_0x5564('0xb')](_0x5564('0xc'),_0x524898[_0x5564('0x6')]),_0x524898);utils[_0x5564('0x1')](util['format'](_0x5564('0xd'),_0x524898[_0x5564('0x6')],_0x524898[_0x5564('0xe')],_0x524898[_0x5564('0xf')],_0x524898[_0x5564('0x10')],_0x524898[_0x5564('0x11')]));_0x524898[_0x5564('0x3')]=_0x5564('0x12');exports[_0x5564('0x8')][_0x524898['transfereruniqueid']]=_0x524898;writeDB(_0x524898);}catch(_0x21fd30){utils[_0x5564('0x13')](util[_0x5564('0xb')](_0x5564('0xc'),_0x524898[_0x5564('0x6')]),_0x21fd30);}};exports[_0x5564('0x14')]=function(_0x269b9a){try{utils[_0x5564('0xa')](util['format'](_0x5564('0x15'),_0x269b9a[_0x5564('0x5')]),_0x269b9a);utils['info'](util[_0x5564('0xb')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x269b9a[_0x5564('0x5')],_0x269b9a[_0x5564('0x16')],_0x269b9a[_0x5564('0x17')],_0x269b9a[_0x5564('0x18')],_0x269b9a['transfertargetcalleridname']));_0x269b9a=_[_0x5564('0x19')](_0x269b9a,{'transfererchannel':_0x269b9a[_0x5564('0x1a')],'transferercalleridnum':_0x269b9a[_0x5564('0x16')],'transferercalleridname':_0x269b9a['origtransferercalleridname'],'transfererconnectedlinenum':_0x269b9a['secondtransfererconnectedlinenum'],'transfererconnectedlinename':_0x269b9a[_0x5564('0x1b')],'transfereraccountcode':_0x269b9a[_0x5564('0x1c')],'transferercontext':_0x269b9a['secondtransferercontext'],'transfererexten':_0x269b9a[_0x5564('0x1d')],'transfererlinkedid':_0x269b9a[_0x5564('0x1e')],'context':_0x269b9a[_0x5564('0x1f')],'extension':_0x269b9a['origtransfererexten'],'type':_0x5564('0x4')});if(_[_0x5564('0x20')](_0x269b9a[_0x5564('0x21')])){_0x269b9a=_['assign'](_0x269b9a,{'transfereechannel':_0x269b9a[_0x5564('0x22')],'transfereecalleridnum':_0x269b9a[_0x5564('0x18')],'transfereecalleridname':_0x269b9a['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x269b9a['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x269b9a[_0x5564('0x23')],'transfereeaccountcode':_0x269b9a[_0x5564('0x24')],'transfereecontext':_0x269b9a[_0x5564('0x25')],'transfereeexten':_0x269b9a[_0x5564('0x26')],'transfereelinkedid':_0x269b9a[_0x5564('0x27')]});}writeDB(_0x269b9a);}catch(_0x2772e1){utils['error'](util['format'](_0x5564('0x15'),_0x269b9a['origtransfereruniqueid']),_0x2772e1);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 1cb1a76..3f88366 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 _0xfeba=['now','isBefore','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','then','[utils][request]\x20name:%s','catch','request','GetUser','internal','name','interface','[utils][getUser]\x20where:%s','result','length','found','notfound','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','getUserByName','[utils][getUserByName]','getVoiceQueueByName','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','subtractTime','YYYY-MM-DD\x20HH:mm:ss','diff','sumTime'];(function(_0x4f1ff8,_0x4bce40){var _0x4ca1e3=function(_0x4f075b){while(--_0x4f075b){_0x4f1ff8['push'](_0x4f1ff8['shift']());}};_0x4ca1e3(++_0x4bce40);}(_0xfeba,0x18e));var _0xafeb=function(_0x230421,_0x573f87){_0x230421=_0x230421-0x0;var _0x2de778=_0xfeba[_0x230421];return _0x2de778;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xafeb('0x0'));var moment=require(_0xafeb('0x1'));var util=require(_0xafeb('0x2'));var client=jayson[_0xafeb('0x3')][_0xafeb('0x4')]({'port':0x2329});var logger=require(_0xafeb('0x5'))('xdr');exports[_0xafeb('0x6')]=function(_0x3a0118,_0xe9a692){logger[_0xafeb('0x6')](_0x3a0118,_0xe9a692?util[_0xafeb('0x7')](_0xe9a692,{'showHidden':![],'depth':null}):'');};exports[_0xafeb('0x8')]=function(_0x5a1cce,_0x365d97){logger[_0xafeb('0x8')](_0x5a1cce,_0x365d97?util['inspect'](_0x365d97,{'showHidden':![],'depth':null}):'');};exports[_0xafeb('0x9')]=function(_0x57e707,_0x2b1c90){logger[_0xafeb('0x9')](_0x57e707,_0x2b1c90?util[_0xafeb('0x7')](_0x2b1c90,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0x240a5d,_0xd9702f){return client['request'](_0x240a5d,{'body':_0xd9702f})[_0xafeb('0xa')](function(_0x4284da){logger[_0xafeb('0x8')](_0xafeb('0xb'),_0x240a5d,_0x4284da?util[_0xafeb('0x7')](_0x4284da,{'showHidden':![],'depth':null}):'');})[_0xafeb('0xc')](function(_0x2ef518){logger[_0xafeb('0x9')](_0xafeb('0xb'),_0x240a5d,_0x2ef518?util[_0xafeb('0x7')](_0x2ef518,{'showHidden':![],'depth':null}):'');});};function getUser(_0x73ed15){return client[_0xafeb('0xd')](_0xafeb('0xe'),{'options':{'raw':!![],'attributes':['id',_0xafeb('0xf'),_0xafeb('0x10'),_0xafeb('0x11')],'where':_0x73ed15,'limit':0x1}})[_0xafeb('0xa')](function(_0x38fb63){logger['debug'](_0xafeb('0x12'),JSON['stringify'](_0x73ed15),_0x38fb63?util['inspect'](_0x38fb63,{'showHidden':![],'depth':null}):'');return _0x38fb63[_0xafeb('0x13')][_0xafeb('0x14')]?_0x38fb63[_0xafeb('0x13')][0x0]:null;});}exports['getUserByInternal']=function(_0x4e8cfb){return new BPromise(function(_0x51cf3d,_0x288f1f){if(_0x4e8cfb){return getUser({'internal':_0x4e8cfb})['then'](function(_0x341e39){logger[_0xafeb('0x6')]('[utils][getUserByInternal]\x20internal:%s\x20%s',_0x4e8cfb,_0x341e39?_0xafeb('0x15'):_0xafeb('0x16'));return _0x51cf3d(_0x341e39);})[_0xafeb('0xc')](function(_0x4fd28c){logger[_0xafeb('0x9')](_0xafeb('0x17'),_0x4fd28c?util['inspect'](_0x4fd28c,{'showHidden':![],'depth':null}):'');return _0x51cf3d(null);});}return _0x51cf3d(null);});};exports[_0xafeb('0x18')]=function(_0x3edd36){return new BPromise(function(_0x136945,_0x177e90){if(_0x3edd36){return getUser({'interface':_0x3edd36})[_0xafeb('0xa')](function(_0x5b8bad){logger['info'](_0xafeb('0x19'),_0x3edd36,_0x5b8bad?_0xafeb('0x15'):_0xafeb('0x16'));return _0x136945(_0x5b8bad);})['catch'](function(_0x252a35){logger[_0xafeb('0x9')]('[utils][getUserByInterface]',_0x252a35?util[_0xafeb('0x7')](_0x252a35,{'showHidden':![],'depth':null}):'');return _0x136945(null);});}return _0x136945(null);});};exports[_0xafeb('0x1a')]=function(_0x3cfe43){return new BPromise(function(_0x57d478,_0x51a2f5){if(_0x3cfe43){return getUser({'name':_0x3cfe43})[_0xafeb('0xa')](function(_0x76b01c){logger['info']('[utils][getUserByName]\x20name:%s\x20%s',_0x3cfe43,_0x76b01c?_0xafeb('0x15'):_0xafeb('0x16'));return _0x57d478(_0x76b01c);})[_0xafeb('0xc')](function(_0x1f52ac){logger['error'](_0xafeb('0x1b'),_0x1f52ac?util['inspect'](_0x1f52ac,{'showHidden':![],'depth':null}):'');return _0x57d478(null);});}return _0x57d478(null);});};exports[_0xafeb('0x1c')]=function(_0x21fcd2){return new BPromise(function(_0x25bfe1,_0x4ee56e){if(_0x21fcd2){return client[_0xafeb('0xd')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xafeb('0x10'),_0xafeb('0x1d'),_0xafeb('0x1e'),_0xafeb('0x1f')],'where':{'name':_0x21fcd2},'limit':0x1}})[_0xafeb('0xa')](function(_0x4c892a){logger[_0xafeb('0x8')](_0xafeb('0x20'),_0x21fcd2,_0x4c892a?util[_0xafeb('0x7')](_0x4c892a,{'showHidden':![],'depth':null}):'');logger[_0xafeb('0x6')](_0xafeb('0x21'),_0x21fcd2,_0x4c892a?_0xafeb('0x15'):_0xafeb('0x16'));return _0x25bfe1(_0x4c892a['result'][_0xafeb('0x14')]?_0x4c892a[_0xafeb('0x13')][0x0]:null);})['catch'](function(_0x5009aa){logger[_0xafeb('0x9')]('[utils][getVoiceQueueByName]',_0x5009aa?util[_0xafeb('0x7')](_0x5009aa,{'showHidden':![],'depth':null}):'');return _0x25bfe1(null);});}return _0x25bfe1(null);});};exports[_0xafeb('0x22')]=function(_0x7719bf,_0x2810e9){return moment(_0x7719bf)[_0xafeb('0x23')](_0x2810e9,_0xafeb('0x24'))[_0xafeb('0x25')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0xafeb('0x26')]=function(_0x2b4d44,_0x49e52f){return moment(_0x2b4d44)['subtract'](_0x49e52f,_0xafeb('0x24'))[_0xafeb('0x25')](_0xafeb('0x27'));};exports['diffTime']=function(_0x1db256,_0x4775e0){return moment(_0x1db256)[_0xafeb('0x28')](moment(_0x4775e0),'seconds');};exports[_0xafeb('0x29')]=function(_0x361009,_0x4413e9){return parseInt(_0x361009,0xa)+parseInt(_0x4413e9,0xa);};exports[_0xafeb('0x2a')]=function(){return moment()[_0xafeb('0x25')](_0xafeb('0x27'));};exports['isAfter']=function(_0xf7a082,_0x5d124b){if(_0x5d124b){return moment(_0xf7a082)['isAfter'](_0x5d124b);}return!![];};exports['isBefore']=function(_0x1b1edf,_0x47e8ec){if(_0x47e8ec){return moment(_0x1b1edf)[_0xafeb('0x2b')](_0x47e8ec);}else if(_0x1b1edf){return!![];}return![];}; \ No newline at end of file +var _0xc1b3=['jayson/promise','moment','util','client','http','xdr','info','inspect','debug','error','request','then','catch','[utils][request]\x20name:%s','GetUser','internal','name','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','notfound','getVoiceQueueByName','type','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtract','diffTime','diff','sumTime','now','isAfter','isBefore','bluebird'];(function(_0x405a98,_0x2ff7dc){var _0xd2705f=function(_0x25375e){while(--_0x25375e){_0x405a98['push'](_0x405a98['shift']());}};_0xd2705f(++_0x2ff7dc);}(_0xc1b3,0x1d5));var _0x3c1b=function(_0x51a6bf,_0x5eb1ee){_0x51a6bf=_0x51a6bf-0x0;var _0x4a39b4=_0xc1b3[_0x51a6bf];return _0x4a39b4;};'use strict';var BPromise=require(_0x3c1b('0x0'));var jayson=require(_0x3c1b('0x1'));var moment=require(_0x3c1b('0x2'));var util=require(_0x3c1b('0x3'));var client=jayson[_0x3c1b('0x4')][_0x3c1b('0x5')]({'port':0x2329});var logger=require('../../config/logger')(_0x3c1b('0x6'));exports['info']=function(_0x183f6e,_0x216625){logger[_0x3c1b('0x7')](_0x183f6e,_0x216625?util[_0x3c1b('0x8')](_0x216625,{'showHidden':![],'depth':null}):'');};exports[_0x3c1b('0x9')]=function(_0x839f9c,_0x42ddb0){logger[_0x3c1b('0x9')](_0x839f9c,_0x42ddb0?util[_0x3c1b('0x8')](_0x42ddb0,{'showHidden':![],'depth':null}):'');};exports[_0x3c1b('0xa')]=function(_0x1ccc85,_0x8a6607){logger['error'](_0x1ccc85,_0x8a6607?util[_0x3c1b('0x8')](_0x8a6607,{'showHidden':![],'depth':null}):'');};exports[_0x3c1b('0xb')]=function(_0x4cc394,_0x3cce06){return client[_0x3c1b('0xb')](_0x4cc394,{'body':_0x3cce06})[_0x3c1b('0xc')](function(_0x16bdd9){logger[_0x3c1b('0x9')]('[utils][request]\x20name:%s',_0x4cc394,_0x16bdd9?util[_0x3c1b('0x8')](_0x16bdd9,{'showHidden':![],'depth':null}):'');})[_0x3c1b('0xd')](function(_0x1f969d){logger[_0x3c1b('0xa')](_0x3c1b('0xe'),_0x4cc394,_0x1f969d?util[_0x3c1b('0x8')](_0x1f969d,{'showHidden':![],'depth':null}):'');});};function getUser(_0x2afa8a){return client[_0x3c1b('0xb')](_0x3c1b('0xf'),{'options':{'raw':!![],'attributes':['id',_0x3c1b('0x10'),_0x3c1b('0x11'),'interface'],'where':_0x2afa8a,'limit':0x1}})['then'](function(_0x3e6c5f){logger['debug'](_0x3c1b('0x12'),JSON[_0x3c1b('0x13')](_0x2afa8a),_0x3e6c5f?util['inspect'](_0x3e6c5f,{'showHidden':![],'depth':null}):'');return _0x3e6c5f[_0x3c1b('0x14')][_0x3c1b('0x15')]?_0x3e6c5f[_0x3c1b('0x14')][0x0]:null;});}exports['getUserByInternal']=function(_0xffbea7){return new BPromise(function(_0x11abdf,_0x49413d){if(_0xffbea7){return getUser({'internal':_0xffbea7})[_0x3c1b('0xc')](function(_0x7cf98f){logger[_0x3c1b('0x7')](_0x3c1b('0x16'),_0xffbea7,_0x7cf98f?_0x3c1b('0x17'):'notfound');return _0x11abdf(_0x7cf98f);})[_0x3c1b('0xd')](function(_0x3759c9){logger[_0x3c1b('0xa')](_0x3c1b('0x18'),_0x3759c9?util[_0x3c1b('0x8')](_0x3759c9,{'showHidden':![],'depth':null}):'');return _0x11abdf(null);});}return _0x11abdf(null);});};exports[_0x3c1b('0x19')]=function(_0x119b9d){return new BPromise(function(_0x1cf493,_0x45f17d){if(_0x119b9d){return getUser({'interface':_0x119b9d})['then'](function(_0x460d9b){logger[_0x3c1b('0x7')](_0x3c1b('0x1a'),_0x119b9d,_0x460d9b?'found':'notfound');return _0x1cf493(_0x460d9b);})['catch'](function(_0x5f4a49){logger[_0x3c1b('0xa')](_0x3c1b('0x1b'),_0x5f4a49?util[_0x3c1b('0x8')](_0x5f4a49,{'showHidden':![],'depth':null}):'');return _0x1cf493(null);});}return _0x1cf493(null);});};exports[_0x3c1b('0x1c')]=function(_0x427ff3){return new BPromise(function(_0x496a03,_0x4ecf12){if(_0x427ff3){return getUser({'name':_0x427ff3})[_0x3c1b('0xc')](function(_0x23017c){logger['info'](_0x3c1b('0x1d'),_0x427ff3,_0x23017c?_0x3c1b('0x17'):_0x3c1b('0x1e'));return _0x496a03(_0x23017c);})[_0x3c1b('0xd')](function(_0x4669cc){logger['error']('[utils][getUserByName]',_0x4669cc?util['inspect'](_0x4669cc,{'showHidden':![],'depth':null}):'');return _0x496a03(null);});}return _0x496a03(null);});};exports[_0x3c1b('0x1f')]=function(_0x155bc5){return new BPromise(function(_0x1d7a7,_0x133d4e){if(_0x155bc5){return client[_0x3c1b('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0x3c1b('0x11'),_0x3c1b('0x20'),'acw',_0x3c1b('0x21')],'where':{'name':_0x155bc5},'limit':0x1}})['then'](function(_0x1dbda2){logger['debug']('[utils][getVoiceQueueByName]\x20name:%s',_0x155bc5,_0x1dbda2?util[_0x3c1b('0x8')](_0x1dbda2,{'showHidden':![],'depth':null}):'');logger[_0x3c1b('0x7')](_0x3c1b('0x22'),_0x155bc5,_0x1dbda2?'found':'notfound');return _0x1d7a7(_0x1dbda2[_0x3c1b('0x14')][_0x3c1b('0x15')]?_0x1dbda2[_0x3c1b('0x14')][0x0]:null);})[_0x3c1b('0xd')](function(_0x1d2129){logger[_0x3c1b('0xa')]('[utils][getVoiceQueueByName]',_0x1d2129?util[_0x3c1b('0x8')](_0x1d2129,{'showHidden':![],'depth':null}):'');return _0x1d7a7(null);});}return _0x1d7a7(null);});};exports[_0x3c1b('0x23')]=function(_0x144466,_0x39627c){return moment(_0x144466)[_0x3c1b('0x24')](_0x39627c,_0x3c1b('0x25'))[_0x3c1b('0x26')](_0x3c1b('0x27'));};exports['subtractTime']=function(_0x1a3813,_0x21314d){return moment(_0x1a3813)[_0x3c1b('0x28')](_0x21314d,'seconds')[_0x3c1b('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x3c1b('0x29')]=function(_0x18f228,_0x264383){return moment(_0x18f228)[_0x3c1b('0x2a')](moment(_0x264383),_0x3c1b('0x25'));};exports[_0x3c1b('0x2b')]=function(_0x348ed3,_0x51c9fe){return parseInt(_0x348ed3,0xa)+parseInt(_0x51c9fe,0xa);};exports[_0x3c1b('0x2c')]=function(){return moment()[_0x3c1b('0x26')](_0x3c1b('0x27'));};exports[_0x3c1b('0x2d')]=function(_0x2722fb,_0x515863){if(_0x515863){return moment(_0x2722fb)[_0x3c1b('0x2d')](_0x515863);}return!![];};exports[_0x3c1b('0x2e')]=function(_0xdcb165,_0x433b51){if(_0x433b51){return moment(_0xdcb165)[_0x3c1b('0x2e')](_0x433b51);}else if(_0xdcb165){return!![];}return![];}; \ No newline at end of file